From: support Date: Wed, 16 Nov 2022 16:43:02 +0000 (+0000) Subject: Built motion from commit 3fa07c60.|2.6.21 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=a3822df4f932cb928128ea172efe5615f558e365;p=motion2.git Built motion from commit 3fa07c60.|2.6.21 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e4790b4..b07a88c 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-16T15:39:57.667Z", + "time": "2022-11-16T16:34:40.826Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cea28d5..66a0810 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-16T15:39:57.667Z", + "time": "2022-11-16T16:34:40.826Z", "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 2a6671f..0f3e97a 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 _0x4044=['contactManager','integration','motionbar','jscripty','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x1a9708,_0x12a6a8){var _0x2d46aa=function(_0x2c846b){while(--_0x2c846b){_0x1a9708['push'](_0x1a9708['shift']());}};_0x2d46aa(++_0x12a6a8);}(_0x4044,0xcb));var _0x4404=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4044[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x4404('0x0'));module[_0x4404('0x1')]={'name':{'type':Sequelize[_0x4404('0x2')],'get':function(_0xb95ec4){return this[_0x4404('0x3')](_0x4404('0x4'));}},'action':{'type':Sequelize[_0x4404('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4404('0x6'),_0x4404('0x7'),_0x4404('0x8'),_0x4404('0x9'),_0x4404('0xa'),'browser','bot',_0x4404('0xb')]],'msg':_0x4404('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xd')},'data2':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xe')},'data3':{'type':Sequelize[_0x4404('0x5')](0x1000),'comment':_0x4404('0xf')},'data4':{'type':Sequelize[_0x4404('0x5')](0x1000),'comments':_0x4404('0x10')},'data5':{'type':Sequelize[_0x4404('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x4404('0x5')],'comments':_0x4404('0x11')},'data7':{'type':Sequelize[_0x4404('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xc6e1=['STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','exports','action','integration','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x495f6f,_0x20c392){var _0x39bbf3=function(_0x24b0e3){while(--_0x24b0e3){_0x495f6f['push'](_0x495f6f['shift']());}};_0x39bbf3(++_0x20c392);}(_0xc6e1,0x164));var _0x1c6e=function(_0x565016,_0x15d827){_0x565016=_0x565016-0x0;var _0x2f211a=_0xc6e1[_0x565016];return _0x2f211a;};'use strict';var Sequelize=require('sequelize');module[_0x1c6e('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd9d757){return this['getDataValue'](_0x1c6e('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x1c6e('0x2'),_0x1c6e('0x3'),'jscripty','urlForward',_0x1c6e('0x4'),_0x1c6e('0x5'),_0x1c6e('0x6')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x1c6e('0x7')},'data1':{'type':Sequelize[_0x1c6e('0x8')](0x1000),'comment':_0x1c6e('0x9')},'data2':{'type':Sequelize[_0x1c6e('0x8')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x1c6e('0xa')},'data4':{'type':Sequelize[_0x1c6e('0x8')](0x1000),'comments':_0x1c6e('0xb')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x1c6e('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0x1c6e('0xd')},'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 f942d82..a4e802e 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 _0x4103=['update','destroy','error','stack','name','body','Action','find','params','then','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x3e36b8,_0x1ff2f0){var _0x594fd2=function(_0x370e11){while(--_0x370e11){_0x3e36b8['push'](_0x3e36b8['shift']());}};_0x594fd2(++_0x1ff2f0);}(_0x4103,0xd3));var _0x3410=function(_0x2a90f4,_0x3d46e7){_0x2a90f4=_0x2a90f4-0x0;var _0x4da9bc=_0x4103[_0x2a90f4];return _0x4da9bc;};'use strict';var emlformat=require(_0x3410('0x0'));var rimraf=require(_0x3410('0x1'));var zipdir=require(_0x3410('0x2'));var jsonpatch=require(_0x3410('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3410('0x4'));var Mustache=require('mustache');var util=require(_0x3410('0x5'));var path=require(_0x3410('0x6'));var sox=require(_0x3410('0x7'));var csv=require(_0x3410('0x8'));var ejs=require(_0x3410('0x9'));var fs=require('fs');var fs_extra=require(_0x3410('0xa'));var _=require(_0x3410('0xb'));var squel=require(_0x3410('0xc'));var crypto=require(_0x3410('0xd'));var jsforce=require(_0x3410('0xe'));var deskjs=require(_0x3410('0xf'));var toCsv=require(_0x3410('0x8'));var querystring=require(_0x3410('0x10'));var Papa=require(_0x3410('0x11'));var Redis=require(_0x3410('0x12'));var authService=require(_0x3410('0x13'));var qs=require(_0x3410('0x14'));var as=require(_0x3410('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3410('0x16'))(_0x3410('0x17'));var utils=require(_0x3410('0x18'));var config=require(_0x3410('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3410('0x1a'))['db'];function respondWithStatusCode(_0x4a820d,_0x38e4df){_0x38e4df=_0x38e4df||0xcc;return function(_0x5e2dfa){if(_0x5e2dfa){return _0x4a820d[_0x3410('0x1b')](_0x38e4df);}return _0x4a820d[_0x3410('0x1c')](_0x38e4df)[_0x3410('0x1d')]();};}function respondWithResult(_0x7da02b,_0x37db61){_0x37db61=_0x37db61||0xc8;return function(_0x162423){if(_0x162423){return _0x7da02b[_0x3410('0x1c')](_0x37db61)['json'](_0x162423);}};}function respondWithFilteredResult(_0x2e5582,_0x511c02){return function(_0x27794d){if(_0x27794d){var _0x1536c4=typeof _0x511c02[_0x3410('0x1e')]===_0x3410('0x1f')&&typeof _0x511c02['limit']===_0x3410('0x1f');var _0x3af1e6=_0x27794d[_0x3410('0x20')];var _0x2c2ce9=_0x1536c4?0x0:_0x511c02[_0x3410('0x1e')];var _0x48bfa9=_0x1536c4?_0x27794d['count']:_0x511c02['offset']+_0x511c02[_0x3410('0x21')];var _0x7f9dfc;if(_0x48bfa9>=_0x3af1e6){_0x48bfa9=_0x3af1e6;_0x7f9dfc=0xc8;}else{_0x7f9dfc=0xce;}_0x2e5582['status'](_0x7f9dfc);return _0x2e5582[_0x3410('0x22')](_0x3410('0x23'),_0x2c2ce9+'-'+_0x48bfa9+'/'+_0x3af1e6)[_0x3410('0x24')](_0x27794d);}return null;};}function patchUpdates(_0x8edcc9){return function(_0x139eb1){try{jsonpatch['apply'](_0x139eb1,_0x8edcc9,!![]);}catch(_0x9985a2){return BPromise[_0x3410('0x25')](_0x9985a2);}return _0x139eb1[_0x3410('0x26')]();};}function saveUpdates(_0x1d9664,_0x3d02ac){return function(_0x2744fc){if(_0x2744fc){return _0x2744fc[_0x3410('0x27')](_0x1d9664)['then'](function(_0x170132){return _0x170132;});}return null;};}function removeEntity(_0x35d14d,_0x297c57){return function(_0x577651){if(_0x577651){return _0x577651[_0x3410('0x28')]()['then'](function(){_0x35d14d[_0x3410('0x1c')](0xcc)[_0x3410('0x1d')]();});}};}function handleEntityNotFound(_0x5168e8,_0x1849f3){return function(_0x4c69b9){if(!_0x4c69b9){_0x5168e8[_0x3410('0x1b')](0x194);}return _0x4c69b9;};}function handleError(_0x3cbf7e,_0x1d18c3){_0x1d18c3=_0x1d18c3||0x1f4;return function(_0x32e00a){logger[_0x3410('0x29')](_0x32e00a[_0x3410('0x2a')]);if(_0x32e00a[_0x3410('0x2b')]){delete _0x32e00a[_0x3410('0x2b')];}_0x3cbf7e[_0x3410('0x1c')](_0x1d18c3)['send'](_0x32e00a);};}exports[_0x3410('0x27')]=function(_0x584b7d,_0x48a2f0){if(_0x584b7d['body']['id']){delete _0x584b7d[_0x3410('0x2c')]['id'];}return db[_0x3410('0x2d')][_0x3410('0x2e')]({'where':{'id':_0x584b7d[_0x3410('0x2f')]['id']}})[_0x3410('0x30')](handleEntityNotFound(_0x48a2f0,null))['then'](saveUpdates(_0x584b7d[_0x3410('0x2c')],null))[_0x3410('0x30')](respondWithResult(_0x48a2f0,null))[_0x3410('0x31')](handleError(_0x48a2f0,null));};exports[_0x3410('0x28')]=function(_0x3e30c0,_0x2be857){return db[_0x3410('0x2d')]['find']({'where':{'id':_0x3e30c0['params']['id']}})[_0x3410('0x30')](handleEntityNotFound(_0x2be857,null))[_0x3410('0x30')](removeEntity(_0x2be857,null))[_0x3410('0x31')](handleError(_0x2be857,null));}; \ No newline at end of file +var _0x25ca=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','error','stack','name','body','find','params','catch','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x25ca,0x10f));var _0xa25c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x25ca[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0xa25c('0x0'));var rimraf=require(_0xa25c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa25c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa25c('0x3'));var Mustache=require(_0xa25c('0x4'));var util=require(_0xa25c('0x5'));var path=require('path');var sox=require(_0xa25c('0x6'));var csv=require(_0xa25c('0x7'));var ejs=require(_0xa25c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa25c('0x9'));var squel=require(_0xa25c('0xa'));var crypto=require(_0xa25c('0xb'));var jsforce=require(_0xa25c('0xc'));var deskjs=require(_0xa25c('0xd'));var toCsv=require(_0xa25c('0x7'));var querystring=require(_0xa25c('0xe'));var Papa=require(_0xa25c('0xf'));var Redis=require(_0xa25c('0x10'));var authService=require(_0xa25c('0x11'));var qs=require(_0xa25c('0x12'));var as=require(_0xa25c('0x13'));var hardwareService=require(_0xa25c('0x14'));var logger=require(_0xa25c('0x15'))(_0xa25c('0x16'));var utils=require('../../config/utils');var config=require(_0xa25c('0x17'));var licenseUtil=require(_0xa25c('0x18'));var db=require(_0xa25c('0x19'))['db'];function respondWithStatusCode(_0x2fee20,_0x2dcdd7){_0x2dcdd7=_0x2dcdd7||0xcc;return function(_0x32cf21){if(_0x32cf21){return _0x2fee20[_0xa25c('0x1a')](_0x2dcdd7);}return _0x2fee20[_0xa25c('0x1b')](_0x2dcdd7)[_0xa25c('0x1c')]();};}function respondWithResult(_0x18ed7f,_0x42145b){_0x42145b=_0x42145b||0xc8;return function(_0x8c0d9a){if(_0x8c0d9a){return _0x18ed7f[_0xa25c('0x1b')](_0x42145b)[_0xa25c('0x1d')](_0x8c0d9a);}};}function respondWithFilteredResult(_0x430afb,_0x50cf06){return function(_0x57c65c){if(_0x57c65c){var _0x56c69c=typeof _0x50cf06[_0xa25c('0x1e')]==='undefined'&&typeof _0x50cf06['limit']===_0xa25c('0x1f');var _0x1503fc=_0x57c65c[_0xa25c('0x20')];var _0x557151=_0x56c69c?0x0:_0x50cf06[_0xa25c('0x1e')];var _0x585280=_0x56c69c?_0x57c65c[_0xa25c('0x20')]:_0x50cf06[_0xa25c('0x1e')]+_0x50cf06[_0xa25c('0x21')];var _0x3e908b;if(_0x585280>=_0x1503fc){_0x585280=_0x1503fc;_0x3e908b=0xc8;}else{_0x3e908b=0xce;}_0x430afb[_0xa25c('0x1b')](_0x3e908b);return _0x430afb[_0xa25c('0x22')]('Content-Range',_0x557151+'-'+_0x585280+'/'+_0x1503fc)['json'](_0x57c65c);}return null;};}function patchUpdates(_0x5d2032){return function(_0x3db9d7){try{jsonpatch[_0xa25c('0x23')](_0x3db9d7,_0x5d2032,!![]);}catch(_0x418ffd){return BPromise[_0xa25c('0x24')](_0x418ffd);}return _0x3db9d7['save']();};}function saveUpdates(_0x4d5a0f,_0x1e7e41){return function(_0x288a0c){if(_0x288a0c){return _0x288a0c[_0xa25c('0x25')](_0x4d5a0f)[_0xa25c('0x26')](function(_0xfedb6a){return _0xfedb6a;});}return null;};}function removeEntity(_0xa321b9,_0x4f4d22){return function(_0x33e9ac){if(_0x33e9ac){return _0x33e9ac['destroy']()['then'](function(){_0xa321b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b1ccf,_0x2083ae){return function(_0x200d54){if(!_0x200d54){_0x1b1ccf[_0xa25c('0x1a')](0x194);}return _0x200d54;};}function handleError(_0x29c137,_0x4a61d1){_0x4a61d1=_0x4a61d1||0x1f4;return function(_0x3ff7cb){logger[_0xa25c('0x27')](_0x3ff7cb[_0xa25c('0x28')]);if(_0x3ff7cb[_0xa25c('0x29')]){delete _0x3ff7cb[_0xa25c('0x29')];}_0x29c137[_0xa25c('0x1b')](_0x4a61d1)['send'](_0x3ff7cb);};}exports[_0xa25c('0x25')]=function(_0x2ab3e9,_0x4e4bad){if(_0x2ab3e9['body']['id']){delete _0x2ab3e9[_0xa25c('0x2a')]['id'];}return db['Action'][_0xa25c('0x2b')]({'where':{'id':_0x2ab3e9[_0xa25c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4e4bad,null))[_0xa25c('0x26')](saveUpdates(_0x2ab3e9['body'],null))['then'](respondWithResult(_0x4e4bad,null))[_0xa25c('0x2d')](handleError(_0x4e4bad,null));};exports[_0xa25c('0x2e')]=function(_0x5e20f1,_0x3fbab4){return db['Action'][_0xa25c('0x2b')]({'where':{'id':_0x5e20f1['params']['id']}})[_0xa25c('0x26')](handleEntityNotFound(_0x3fbab4,null))[_0xa25c('0x26')](removeEntity(_0x3fbab4,null))[_0xa25c('0x2d')](handleError(_0x3fbab4,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index df33f28..050e09a 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 _0xa013=['util','api','moment','bluebird','request-promise','path','./action.attributes','exports','Action','tools_actions'];(function(_0x22a8c4,_0x51c09a){var _0x104c6d=function(_0x4d4d3d){while(--_0x4d4d3d){_0x22a8c4['push'](_0x22a8c4['shift']());}};_0x104c6d(++_0x51c09a);}(_0xa013,0x1ea));var _0x3a01=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xa013[_0x547add];return _0x2ed1f3;};'use strict';var _=require('lodash');var util=require(_0x3a01('0x0'));var logger=require('../../config/logger')(_0x3a01('0x1'));var moment=require(_0x3a01('0x2'));var BPromise=require(_0x3a01('0x3'));var rp=require(_0x3a01('0x4'));var fs=require('fs');var path=require(_0x3a01('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a01('0x6'));module[_0x3a01('0x7')]=function(_0x27ee4f,_0x3b5fef){return _0x27ee4f['define'](_0x3a01('0x8'),attributes,{'tableName':_0x3a01('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4858=['request-promise','path','./action.attributes','exports','define','Action','tools_actions','lodash','util','bluebird'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x4858,0xf7));var _0x8485=function(_0x123cc3,_0x361fd8){_0x123cc3=_0x123cc3-0x0;var _0x134ee0=_0x4858[_0x123cc3];return _0x134ee0;};'use strict';var _=require(_0x8485('0x0'));var util=require(_0x8485('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8485('0x2'));var rp=require(_0x8485('0x3'));var fs=require('fs');var path=require(_0x8485('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8485('0x5'));module[_0x8485('0x6')]=function(_0x3b9028,_0x3522dd){return _0x3b9028[_0x8485('0x7')](_0x8485('0x8'),attributes,{'tableName':_0x8485('0x9'),'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 66799dd..1bfeba3 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x53ec,0x192));var _0xc53e=function(_0x3657d9,_0x3de284){_0x3657d9=_0x3657d9-0x0;var _0x4e5b18=_0x53ec[_0x3657d9];return _0x4e5b18;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xf494,0x1c6));var _0x4f49=function(_0x12fd15,_0x59601a){_0x12fd15=_0x12fd15-0x0;var _0x43d2aa=_0xf494[_0x12fd15];return _0x43d2aa;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 34e1789..c66b2fb 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 _0xa1b0=['destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./action.controller','put','update','delete','isAuthenticated'];(function(_0x199b91,_0x3f6f72){var _0x4cffea=function(_0x352d7e){while(--_0x352d7e){_0x199b91['push'](_0x199b91['shift']());}};_0x4cffea(++_0x3f6f72);}(_0xa1b0,0x169));var _0x0a1b=function(_0x2edb72,_0x2264e2){_0x2edb72=_0x2edb72-0x0;var _0x79fb87=_0xa1b0[_0x2edb72];return _0x79fb87;};'use strict';var multer=require(_0x0a1b('0x0'));var util=require('util');var path=require(_0x0a1b('0x1'));var timeout=require(_0x0a1b('0x2'));var express=require(_0x0a1b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a1b('0x4'));var interaction=require(_0x0a1b('0x5'));var config=require('../../config/environment');var controller=require(_0x0a1b('0x6'));router[_0x0a1b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0a1b('0x8')]);router[_0x0a1b('0x9')]('/:id',auth[_0x0a1b('0xa')](),controller[_0x0a1b('0xb')]);module['exports']=router; \ No newline at end of file +var _0xb9cd=['/:id','update','isAuthenticated','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','put'];(function(_0x5b564d,_0x533fa7){var _0x37cac6=function(_0x5e12a0){while(--_0x5e12a0){_0x5b564d['push'](_0x5b564d['shift']());}};_0x37cac6(++_0x533fa7);}(_0xb9cd,0x1c1));var _0xdb9c=function(_0xf8e45b,_0x336e08){_0xf8e45b=_0xf8e45b-0x0;var _0xb38c41=_0xb9cd[_0xf8e45b];return _0xb38c41;};'use strict';var multer=require('multer');var util=require(_0xdb9c('0x0'));var path=require(_0xdb9c('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb9c('0x2'));var router=express[_0xdb9c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdb9c('0x4'));var interaction=require(_0xdb9c('0x5'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xdb9c('0x6')](_0xdb9c('0x7'),auth['isAuthenticated'](),controller[_0xdb9c('0x8')]);router['delete'](_0xdb9c('0x7'),auth[_0xdb9c('0x9')](),controller[_0xdb9c('0xa')]);module[_0xdb9c('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7c48e4e..8a03197 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 _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x134cb7,_0x4ed24e){var _0x5d81e2=function(_0x788943){while(--_0x788943){_0x134cb7['push'](_0x134cb7['shift']());}};_0x5d81e2(++_0x4ed24e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x5fc3[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0x28fd11,_0xb7b5ca){var _0x51caa0=function(_0x39ffeb){while(--_0x39ffeb){_0x28fd11['push'](_0x28fd11['shift']());}};_0x51caa0(++_0xb7b5ca);}(_0x8958,0x93));var _0x8895=function(_0x17054a,_0x247ee2){_0x17054a=_0x17054a-0x0;var _0x4dc74e=_0x8958[_0x17054a];return _0x4dc74e;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 9f2cca0..49d313e 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 _0x4159=['metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','operator','getFields','groupBy','output','web','fullPath','%s-%s.%s','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','MIN(%s)','findAll','DESC','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','error','name','index','rawAttributes','fieldName','type','key','map','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x4159,0x17d));var _0x9415=function(_0x305d7e,_0x377df9){_0x305d7e=_0x305d7e-0x0;var _0x9403d3=_0x4159[_0x305d7e];return _0x9403d3;};'use strict';var emlformat=require(_0x9415('0x0'));var rimraf=require(_0x9415('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9415('0x2'));var rp=require(_0x9415('0x3'));var moment=require(_0x9415('0x4'));var BPromise=require(_0x9415('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9415('0x6'));var sox=require(_0x9415('0x7'));var csv=require(_0x9415('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9415('0x9'));var squel=require(_0x9415('0xa'));var crypto=require(_0x9415('0xb'));var jsforce=require(_0x9415('0xc'));var deskjs=require(_0x9415('0xd'));var toCsv=require(_0x9415('0x8'));var querystring=require('querystring');var Papa=require(_0x9415('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9415('0xf'));var as=require(_0x9415('0x10'));var hardwareService=require(_0x9415('0x11'));var logger=require(_0x9415('0x12'))('api');var utils=require(_0x9415('0x13'));var config=require(_0x9415('0x14'));var licenseUtil=require(_0x9415('0x15'));var db=require(_0x9415('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9415('0x17')];function respondWithStatusCode(_0x29e5af,_0x57c3d1){_0x57c3d1=_0x57c3d1||0xcc;return function(_0x185a20){if(_0x185a20){return _0x29e5af[_0x9415('0x18')](_0x57c3d1);}return _0x29e5af[_0x9415('0x19')](_0x57c3d1)['end']();};}function respondWithResult(_0x245a46,_0x2f1b97){_0x2f1b97=_0x2f1b97||0xc8;return function(_0x3656b2){if(_0x3656b2){return _0x245a46['status'](_0x2f1b97)[_0x9415('0x1a')](_0x3656b2);}};}function respondWithFilteredResult(_0x4d6035,_0x5b049a){return function(_0x4bf3f5){if(_0x4bf3f5){var _0x5b9fb8=typeof _0x5b049a[_0x9415('0x1b')]===_0x9415('0x1c')&&typeof _0x5b049a[_0x9415('0x1d')]===_0x9415('0x1c');var _0x12183e=_0x4bf3f5[_0x9415('0x1e')];var _0x554427=_0x5b9fb8?0x0:_0x5b049a[_0x9415('0x1b')];var _0x5350ea=_0x5b9fb8?_0x4bf3f5['count']:_0x5b049a['offset']+_0x5b049a[_0x9415('0x1d')];var _0x3c82d2;if(_0x5350ea>=_0x12183e){_0x5350ea=_0x12183e;_0x3c82d2=0xc8;}else{_0x3c82d2=0xce;}_0x4d6035[_0x9415('0x19')](_0x3c82d2);return _0x4d6035[_0x9415('0x1f')](_0x9415('0x20'),_0x554427+'-'+_0x5350ea+'/'+_0x12183e)[_0x9415('0x1a')](_0x4bf3f5);}return null;};}function patchUpdates(_0x4c9277){return function(_0x12941e){try{jsonpatch[_0x9415('0x21')](_0x12941e,_0x4c9277,!![]);}catch(_0x23bbf1){return BPromise[_0x9415('0x22')](_0x23bbf1);}return _0x12941e[_0x9415('0x23')]();};}function saveUpdates(_0x1d98fd,_0x656499){return function(_0x128ecd){if(_0x128ecd){return _0x128ecd[_0x9415('0x24')](_0x1d98fd)[_0x9415('0x25')](function(_0xdb7b45){return _0xdb7b45;});}return null;};}function removeEntity(_0xc31ff2,_0x43d52a){return function(_0x398ff4){if(_0x398ff4){return _0x398ff4[_0x9415('0x26')]()[_0x9415('0x25')](function(){var _0x4c18c8=_0x398ff4['get']({'plain':!![]});var _0x1115ba=_0x9415('0x27');return db['UserProfileResource'][_0x9415('0x26')]({'where':{'type':_0x1115ba,'resourceId':_0x4c18c8['id']}})[_0x9415('0x25')](function(){return _0x398ff4;});})[_0x9415('0x25')](function(){_0xc31ff2[_0x9415('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f064,_0x1b09d8){return function(_0x166feb){if(!_0x166feb){_0x11f064[_0x9415('0x18')](0x194);}return _0x166feb;};}function handleError(_0x356467,_0x9b7e2f){_0x9b7e2f=_0x9b7e2f||0x1f4;return function(_0x3a2be5){logger[_0x9415('0x28')](_0x3a2be5['stack']);if(_0x3a2be5[_0x9415('0x29')]){delete _0x3a2be5[_0x9415('0x29')];}_0x356467[_0x9415('0x19')](_0x9b7e2f)['send'](_0x3a2be5);};}exports[_0x9415('0x2a')]=function(_0xcd2544,_0x570982){var _0x54d20b={},_0x4ff991={},_0x16641c={'count':0x0,'rows':[]};var _0x52712c=_['map'](db['AnalyticCustomReport'][_0x9415('0x2b')],function(_0x3922c9){return{'name':_0x3922c9[_0x9415('0x2c')],'type':_0x3922c9[_0x9415('0x2d')][_0x9415('0x2e')]};});_0x4ff991['model']=_[_0x9415('0x2f')](_0x52712c,_0x9415('0x29'));_0x4ff991['query']=_[_0x9415('0x30')](_0xcd2544[_0x9415('0x31')]);_0x4ff991['filters']=_[_0x9415('0x32')](_0x4ff991[_0x9415('0x33')],_0x4ff991[_0x9415('0x31')]);_0x54d20b['attributes']=_[_0x9415('0x32')](_0x4ff991['model'],qs[_0x9415('0x34')](_0xcd2544[_0x9415('0x31')][_0x9415('0x34')]));_0x54d20b[_0x9415('0x35')]=_0x54d20b['attributes'][_0x9415('0x36')]?_0x54d20b[_0x9415('0x35')]:_0x4ff991[_0x9415('0x33')];if(!_0xcd2544['query']['hasOwnProperty'](_0x9415('0x37'))){_0x54d20b[_0x9415('0x1d')]=qs[_0x9415('0x1d')](_0xcd2544['query']['limit']);_0x54d20b[_0x9415('0x1b')]=qs['offset'](_0xcd2544[_0x9415('0x31')][_0x9415('0x1b')]);}_0x54d20b[_0x9415('0x38')]=qs[_0x9415('0x39')](_0xcd2544[_0x9415('0x31')][_0x9415('0x39')]);_0x54d20b['where']=qs['filters'](_[_0x9415('0x3a')](_0xcd2544[_0x9415('0x31')],_0x4ff991[_0x9415('0x3b')]),_0x52712c);if(_0xcd2544[_0x9415('0x31')][_0x9415('0x3c')]){_0x54d20b[_0x9415('0x3d')]=_[_0x9415('0x3e')](_0x54d20b['where'],{'$or':_[_0x9415('0x2f')](_0x52712c,function(_0x36e95d){if(_0x36e95d['type']!==_0x9415('0x3f')){var _0x4303f4={};_0x4303f4[_0x36e95d[_0x9415('0x29')]]={'$like':'%'+_0xcd2544[_0x9415('0x31')]['filter']+'%'};return _0x4303f4;}})});}_0x54d20b=_[_0x9415('0x3e')]({},_0x54d20b,_0xcd2544[_0x9415('0x40')]);var _0x5dfd9d={'where':_0x54d20b['where']};return db[_0x9415('0x41')][_0x9415('0x1e')](_0x5dfd9d)[_0x9415('0x25')](function(_0x27fdae){_0x16641c['count']=_0x27fdae;if(_0xcd2544[_0x9415('0x31')]['includeAll']){_0x54d20b[_0x9415('0x42')]=[{'all':!![]}];}return db[_0x9415('0x41')]['findAll'](_0x54d20b);})['then'](function(_0x3c2e0f){_0x16641c[_0x9415('0x43')]=_0x3c2e0f;return _0x16641c;})['then'](respondWithFilteredResult(_0x570982,_0x54d20b))[_0x9415('0x44')](handleError(_0x570982,null));};exports[_0x9415('0x45')]=function(_0xa11859,_0x41c6ed){var _0x3a03df={'raw':![],'where':{'id':_0xa11859[_0x9415('0x46')]['id']}},_0x3760cf={};_0x3760cf[_0x9415('0x33')]=_['keys'](db[_0x9415('0x41')][_0x9415('0x2b')]);_0x3760cf[_0x9415('0x31')]=_[_0x9415('0x30')](_0xa11859['query']);_0x3760cf['filters']=_[_0x9415('0x32')](_0x3760cf[_0x9415('0x33')],_0x3760cf[_0x9415('0x31')]);_0x3a03df['attributes']=_[_0x9415('0x32')](_0x3760cf[_0x9415('0x33')],qs['fields'](_0xa11859[_0x9415('0x31')][_0x9415('0x34')]));_0x3a03df[_0x9415('0x35')]=_0x3a03df[_0x9415('0x35')][_0x9415('0x36')]?_0x3a03df[_0x9415('0x35')]:_0x3760cf[_0x9415('0x33')];if(_0xa11859[_0x9415('0x31')]['includeAll']){_0x3a03df[_0x9415('0x42')]=[{'all':!![]}];}_0x3a03df=_[_0x9415('0x3e')]({},_0x3a03df,_0xa11859[_0x9415('0x40')]);return db[_0x9415('0x41')][_0x9415('0x47')](_0x3a03df)[_0x9415('0x25')](handleEntityNotFound(_0x41c6ed,null))[_0x9415('0x25')](respondWithResult(_0x41c6ed,null))['catch'](handleError(_0x41c6ed,null));};exports[_0x9415('0x48')]=function(_0xdabc6f,_0x53e3c7){return db[_0x9415('0x41')][_0x9415('0x48')](_0xdabc6f[_0x9415('0x49')],{})['then'](function(_0x441752){var _0x4ffb9c=_0xdabc6f[_0x9415('0x4a')][_0x9415('0x4b')]({'plain':!![]});if(!_0x4ffb9c)throw new Error(_0x9415('0x4c'));if(_0x4ffb9c[_0x9415('0x4d')]==='user'){var _0x216595=_0x441752[_0x9415('0x4b')]({'plain':!![]});var _0x525f3c='Reports';return db[_0x9415('0x4e')][_0x9415('0x47')]({'where':{'name':_0x525f3c,'userProfileId':_0x4ffb9c[_0x9415('0x4f')]},'raw':!![]})[_0x9415('0x25')](function(_0x56fcb7){if(_0x56fcb7&&_0x56fcb7[_0x9415('0x50')]===0x0){return db[_0x9415('0x51')][_0x9415('0x48')]({'name':_0x216595[_0x9415('0x29')],'resourceId':_0x216595['id'],'type':_0x9415('0x27'),'sectionId':_0x56fcb7['id']},{})['then'](function(){return _0x441752;});}else{return _0x441752;}})[_0x9415('0x44')](function(_0x5c01a2){logger[_0x9415('0x28')](_0x9415('0x52'),_0x5c01a2);throw _0x5c01a2;});}return _0x441752;})['then'](respondWithResult(_0x53e3c7,0xc9))[_0x9415('0x44')](handleError(_0x53e3c7,null));};exports[_0x9415('0x24')]=function(_0x4c35c3,_0x3cfe46){if(_0x4c35c3[_0x9415('0x49')]['id']){delete _0x4c35c3[_0x9415('0x49')]['id'];}return db[_0x9415('0x41')][_0x9415('0x47')]({'where':{'id':_0x4c35c3[_0x9415('0x46')]['id']}})[_0x9415('0x25')](handleEntityNotFound(_0x3cfe46,null))['then'](saveUpdates(_0x4c35c3[_0x9415('0x49')],null))['then'](respondWithResult(_0x3cfe46,null))[_0x9415('0x44')](handleError(_0x3cfe46,null));};exports[_0x9415('0x26')]=function(_0x1d5e86,_0x3a4325){return db['AnalyticCustomReport'][_0x9415('0x47')]({'where':{'id':_0x1d5e86['params']['id']}})[_0x9415('0x25')](handleEntityNotFound(_0x3a4325,null))[_0x9415('0x25')](removeEntity(_0x3a4325,null))[_0x9415('0x44')](handleError(_0x3a4325,null));};exports[_0x9415('0x53')]=function(_0x43602f,_0x1f6042){var _0x461794=0xa;var _0xcefce1=[_0x9415('0x54'),'left_join',_0x9415('0x55'),_0x9415('0x56')];var _0x57a877={'SUM':_0x9415('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9415('0x58'),'MIN':'MIN(%s)','AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':_0x9415('0x5c')};var _0x648f24={'SEC_TO_TIME':_0x9415('0x5d'),'DATE':_0x9415('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5c6ba8=function(_0x2c76cf){return!_['includes']([_0x9415('0x60'),_0x9415('0x61'),_0x9415('0x62'),_0x9415('0x63')],_0x2c76cf);};var _0x465b04=function(_0x5e11e6){if(!_0x5e11e6||!_0x5e11e6[_0x9415('0x64')][_0x9415('0x36')]){return'';}for(var _0x590f86='(',_0x4aef44=0x0;_0x4aef44<_0x5e11e6[_0x9415('0x64')][_0x9415('0x36')];_0x4aef44+=0x1){_0x4aef44>0x0&&(_0x590f86+='\x20'+_0x5e11e6['operator']+'\x20');_0x590f86+=_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x65')]?_0x465b04(_0x5e11e6[_0x9415('0x64')][_0x4aef44]['group']):_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x66')]+'\x20'+_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x67')]+(_0x5c6ba8(_0x5e11e6[_0x9415('0x64')][_0x4aef44]['condition'])?'\x20'+_0x5e11e6[_0x9415('0x64')][_0x4aef44][_0x9415('0x68')]:'');}return _0x590f86+')';};var _0x15e6d1={'where':{'id':_0x43602f[_0x9415('0x46')]['id']}},_0x3234fb,_0x1231e6,_0x142116,_0x28e075,_0x4743c3;_0x15e6d1=_['merge']({},_0x15e6d1,_0x43602f[_0x9415('0x40')]);return db[_0x9415('0x41')]['find'](_0x15e6d1)[_0x9415('0x25')](function(_0x49c7d4){if(_0x49c7d4){_0x3234fb=_0x49c7d4;return _0x49c7d4['getFields']();}return null;})[_0x9415('0x25')](function(_0x2f2577){if(_0x2f2577){if(!_0x2f2577[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x1231e6=_0x2f2577;return db[_0x9415('0x6c')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x23e7bd){if(_0x23e7bd){_0x142116=_[_0x9415('0x6d')](_0x23e7bd,'id');var _0x585b04;var _0x5173e1=squel[_0x9415('0x6e')]();_0x5173e1[_0x9415('0x6f')](_0x3234fb[_0x9415('0x70')]);for(var _0x31b0cf=0x0;_0x31b0cf<_0x1231e6[_0x9415('0x36')];_0x31b0cf+=0x1){_0x585b04=_0x1231e6[_0x31b0cf]['MetricId']?_0x142116[_0x1231e6[_0x31b0cf][_0x9415('0x71')]][_0x9415('0x72')]:_0x1231e6[_0x31b0cf][_0x9415('0x66')];_0x585b04=_0x1231e6[_0x31b0cf][_0x9415('0x73')]?_[_0x9415('0x74')](_0x57a877[_0x1231e6[_0x31b0cf][_0x9415('0x73')]],'%s',_0x585b04):_0x585b04;_0x585b04=_0x1231e6[_0x31b0cf][_0x9415('0x75')]?_[_0x9415('0x74')](_0x648f24[_0x1231e6[_0x31b0cf][_0x9415('0x75')]],'%s',_0x585b04):_0x585b04;if(_0x1231e6[_0x31b0cf]['groupBy']){_0x5173e1['group'](_0x585b04);}_0x1231e6[_0x31b0cf][_0x9415('0x76')]&&_0x5173e1[_0x9415('0x38')](_0x585b04,_0x1231e6[_0x31b0cf][_0x9415('0x76')]==='DESC'?![]:!![]);_0x5173e1[_0x9415('0x66')](_0x585b04,_0x1231e6[_0x31b0cf][_0x9415('0x77')]||_0x585b04);}if(_0x3234fb[_0x9415('0x78')]){_0x3234fb[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x3234fb[_0x9415('0x78')]);for(var _0x144a24=0x0;_0x144a24<_0x3234fb[_0x9415('0x78')]['length'];_0x144a24+=0x1){if(_0x3234fb[_0x9415('0x78')][_0x144a24]['type']&&_['includes'](_0xcefce1,_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x2d')])&&_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7a')]&&_0x3234fb[_0x9415('0x78')][_0x144a24]['foreignTable']&&_0x3234fb['joins'][_0x144a24][_0x9415('0x7b')]){_0x5173e1[_0x3234fb['joins'][_0x144a24][_0x9415('0x2d')]](_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7c')],null,util[_0x9415('0x75')](_0x9415('0x7d'),_0x3234fb[_0x9415('0x70')],_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7a')],_0x3234fb[_0x9415('0x78')][_0x144a24][_0x9415('0x7c')],_0x3234fb[_0x9415('0x78')][_0x144a24]['foreignKey']));}}}if(_0x3234fb[_0x9415('0x7e')]){_0x3234fb['conditions']=JSON[_0x9415('0x79')](_0x3234fb[_0x9415('0x7e')]);_0x5173e1[_0x9415('0x3d')](_0x465b04(_0x3234fb['conditions'][_0x9415('0x65')]));}_0x4743c3=_0x5173e1[_0x9415('0x7f')]();_0x5173e1['limit'](_0x461794);_0x5173e1[_0x9415('0x1b')](0x0);logger[_0x9415('0x80')]('Limited\x20Query:',_0x5173e1[_0x9415('0x81')]());return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x5173e1[_0x9415('0x81')](),{'type':dbH['sequelize'][_0x9415('0x83')][_0x9415('0x84')]});}})[_0x9415('0x25')](respondWithResult(_0x1f6042,null))['catch'](handleError(_0x1f6042,null));};function runReport(_0x8a2383,_0x13e2ed,_0x1b228e){var _0x280181=_0x13e2ed[_0x9415('0x29')];var _0xd16b87=0xa;var _0x4fea59=[_0x9415('0x54'),_0x9415('0x85'),_0x9415('0x55'),'cross_join'];var _0x58c13d={'SUM':_0x9415('0x57'),'COUNT':_0x9415('0x86'),'COUNT DISTINCT':_0x9415('0x87'),'MAX':_0x9415('0x58'),'MIN':'MIN(%s)','AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xce6fb0={'SEC_TO_TIME':_0x9415('0x5d'),'DATE':_0x9415('0x5e'),'HOUR':_0x9415('0x88'),'ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':_0x9415('0x89')};var _0x3eec3b=function(_0x297861){return!_[_0x9415('0x8a')]([_0x9415('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x297861);};var _0x419eee=function(_0x10a38d){if(!_0x10a38d||!_0x10a38d[_0x9415('0x64')][_0x9415('0x36')]){return'';}for(var _0x32b709='(',_0x4562a9=0x0;_0x4562a9<_0x10a38d[_0x9415('0x64')][_0x9415('0x36')];_0x4562a9+=0x1){_0x4562a9>0x0&&(_0x32b709+='\x20'+_0x10a38d[_0x9415('0x8b')]+'\x20');_0x32b709+=_0x10a38d[_0x9415('0x64')][_0x4562a9]['group']?_0x419eee(_0x10a38d[_0x9415('0x64')][_0x4562a9][_0x9415('0x65')]):_0x10a38d[_0x9415('0x64')][_0x4562a9]['field']+'\x20'+_0x10a38d[_0x9415('0x64')][_0x4562a9]['condition']+(_0x3eec3b(_0x10a38d['rules'][_0x4562a9][_0x9415('0x67')])?'\x20'+_0x10a38d['rules'][_0x4562a9][_0x9415('0x68')]:'');}return _0x32b709+')';};var _0x4c37f8={'where':{'id':_0x8a2383['id']}},_0x2f2638,_0x4487b5,_0x4245f8,_0x552f21,_0x5be4f0;_0x4c37f8=_[_0x9415('0x3e')]({},_0x4c37f8,_0x1b228e);return db['AnalyticCustomReport'][_0x9415('0x47')](_0x4c37f8)[_0x9415('0x25')](function(_0x28acc3){if(_0x28acc3){_0x2f2638=_0x28acc3;return _0x28acc3[_0x9415('0x8c')]();}return null;})['then'](function(_0x3ef552){if(_0x3ef552){if(!_0x3ef552[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x4487b5=_0x3ef552;return db[_0x9415('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x9415('0x25')](function(_0x3934a0){if(_0x3934a0){_0x4245f8=_[_0x9415('0x6d')](_0x3934a0,'id');var _0x50cb1a;var _0x23d6ee=squel[_0x9415('0x6e')]();_0x23d6ee[_0x9415('0x6f')](_0x2f2638[_0x9415('0x70')]);for(var _0x41b494=0x0;_0x41b494<_0x4487b5['length'];_0x41b494+=0x1){_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x71')]?_0x4245f8[_0x4487b5[_0x41b494][_0x9415('0x71')]][_0x9415('0x72')]:_0x4487b5[_0x41b494][_0x9415('0x66')];_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x73')]?_[_0x9415('0x74')](_0x58c13d[_0x4487b5[_0x41b494]['function']],'%s',_0x50cb1a):_0x50cb1a;_0x50cb1a=_0x4487b5[_0x41b494][_0x9415('0x75')]?_[_0x9415('0x74')](_0xce6fb0[_0x4487b5[_0x41b494][_0x9415('0x75')]],'%s',_0x50cb1a):_0x50cb1a;if(_0x4487b5[_0x41b494][_0x9415('0x8d')]){_0x23d6ee[_0x9415('0x65')](_0x50cb1a);}_0x4487b5[_0x41b494][_0x9415('0x76')]&&_0x23d6ee[_0x9415('0x38')](_0x50cb1a,_0x4487b5[_0x41b494]['orderBy']==='DESC'?![]:!![]);_0x23d6ee[_0x9415('0x66')](_0x50cb1a,_0x4487b5[_0x41b494][_0x9415('0x77')]||_0x50cb1a);}if(_0x2f2638[_0x9415('0x78')]){_0x2f2638[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x2f2638[_0x9415('0x78')]);for(var _0x571ae2=0x0;_0x571ae2<_0x2f2638['joins'][_0x9415('0x36')];_0x571ae2+=0x1){if(_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x2d')]&&_[_0x9415('0x8a')](_0x4fea59,_0x2f2638['joins'][_0x571ae2]['type'])&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7a')]&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7c')]&&_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7b')]){_0x23d6ee[_0x2f2638['joins'][_0x571ae2][_0x9415('0x2d')]](_0x2f2638['joins'][_0x571ae2][_0x9415('0x7c')],null,util[_0x9415('0x75')](_0x9415('0x7d'),_0x2f2638[_0x9415('0x70')],_0x2f2638['joins'][_0x571ae2]['parentKey'],_0x2f2638[_0x9415('0x78')][_0x571ae2]['foreignTable'],_0x2f2638[_0x9415('0x78')][_0x571ae2][_0x9415('0x7b')]));}}}if(_0x2f2638[_0x9415('0x7e')]){_0x2f2638[_0x9415('0x7e')]=JSON[_0x9415('0x79')](_0x2f2638[_0x9415('0x7e')]);_0x23d6ee[_0x9415('0x3d')](_0x419eee(_0x2f2638[_0x9415('0x7e')][_0x9415('0x65')]));}_0x5be4f0=_0x23d6ee['clone']();_0x23d6ee[_0x9415('0x1d')](_0xd16b87);_0x23d6ee['offset'](0x0);return;}})[_0x9415('0x25')](function(){if(_0x13e2ed[_0x9415('0x8e')]===_0x9415('0x8f')){return null;}var _0x5c6651=_[_0x9415('0x3e')](_0x13e2ed,{'name':_0x13e2ed[_0x9415('0x90')]||_0x13e2ed[_0x9415('0x29')]||_0x2f2638[_0x9415('0x29')],'basename':_0x280181,'savename':util[_0x9415('0x75')](_0x9415('0x91'),_0x13e2ed[_0x9415('0x29')]||_0x2f2638[_0x9415('0x29')],require('randomstring')[_0x9415('0x92')](0x4),_0x13e2ed[_0x9415('0x8e')]||_0x9415('0x93')),'reportId':_0x2f2638['id'],'reportType':_0x9415('0x94')});return db['AnalyticExtractedReport'][_0x9415('0x48')](_0x5c6651,{'raw':!![]});})['then'](function(_0x4ef66c){if(_0x2f2638['table']==='cdr'){_0x5be4f0[_0x9415('0x3d')](_0x2f2638[_0x9415('0x70')]+_0x9415('0x95'),_0x13e2ed['startDate'],_0x13e2ed[_0x9415('0x96')]);}else{_0x5be4f0['where'](_0x2f2638[_0x9415('0x70')]+_0x9415('0x97'),_0x13e2ed[_0x9415('0x98')],_0x13e2ed[_0x9415('0x96')]);}if(_0x4ef66c){logger[_0x9415('0x99')]('Run\x20Query:',_0x5be4f0[_0x9415('0x81')]());require(_0x9415('0x9a'))[_0x9415('0x9b')](path[_0x9415('0x54')](__dirname,_0x9415('0x9c'),_0x4ef66c[_0x9415('0x8e')]),[_0x4ef66c['id'],_0x5be4f0[_0x9415('0x81')](),path[_0x9415('0x54')](__dirname,_0x9415('0x9d'),_0x4ef66c['savename']),_0x280181]);return _0x4ef66c;}else{var _0x4cdf14=squel['select']();_0x4cdf14[_0x9415('0x6f')]('('+_0x5be4f0[_0x9415('0x81')]()+')','countTable');_0x4cdf14[_0x9415('0x66')](_0x9415('0x9e'),_0x9415('0x1e'));_0x5be4f0[_0x9415('0x1d')](_0x13e2ed['limit']||_0xd16b87);_0x5be4f0[_0x9415('0x1b')](_0x13e2ed['offset']||0x0);return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x4cdf14['toString'](),{'type':dbH[_0x9415('0x82')][_0x9415('0x83')][_0x9415('0x84')]})[_0x9415('0x25')](function(_0x3583d9){if(!_0x3583d9[_0x9415('0x36')]){_0x552f21=0x0;}else{_0x552f21=_0x3583d9[0x0]['count']||0x0;}return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x5be4f0[_0x9415('0x81')](),{'type':dbH[_0x9415('0x82')]['QueryTypes'][_0x9415('0x84')]});})['then'](function(_0x1b3679){return{'rows':_0x1b3679||[],'count':_0x552f21};});}});}exports[_0x9415('0x9f')]=function(_0xe0e521,_0x29f581){return runReport(_0xe0e521[_0x9415('0x46')],_0xe0e521[_0x9415('0x31')],_0xe0e521['options'])[_0x9415('0x25')](respondWithResult(_0x29f581,null))['catch'](handleError(_0x29f581,null));};exports[_0x9415('0xa0')]=runReport;exports[_0x9415('0x31')]=function(_0x4299bb,_0x1eaab0){var _0x13fed2=0xa;var _0x90a04=[_0x9415('0x54'),_0x9415('0x85'),_0x9415('0x55'),_0x9415('0x56')];var _0x112b24={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9415('0x87'),'MAX':_0x9415('0x58'),'MIN':_0x9415('0xa1'),'AVG':_0x9415('0x59'),'GROUP_CONCAT':_0x9415('0x5a'),'GROUP_CONCAT ASC':_0x9415('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x27e3ab={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9415('0x5e'),'HOUR':_0x9415('0x88'),'ROUND':_0x9415('0x5f'),'UNIX_TIMESTAMP':_0x9415('0x89')};var _0x408eeb=function(_0x3aeab2){return!_[_0x9415('0x8a')]([_0x9415('0x60'),_0x9415('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x3aeab2);};var _0x5b9df7=function(_0x478e1e){if(!_0x478e1e||!_0x478e1e[_0x9415('0x64')]['length']){return'';}for(var _0x579f87='(',_0x53128c=0x0;_0x53128c<_0x478e1e[_0x9415('0x64')][_0x9415('0x36')];_0x53128c+=0x1){_0x53128c>0x0&&(_0x579f87+='\x20'+_0x478e1e[_0x9415('0x8b')]+'\x20');_0x579f87+=_0x478e1e[_0x9415('0x64')][_0x53128c]['group']?_0x5b9df7(_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x65')]):_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x66')]+'\x20'+_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x67')]+(_0x408eeb(_0x478e1e[_0x9415('0x64')][_0x53128c]['condition'])?'\x20'+_0x478e1e[_0x9415('0x64')][_0x53128c][_0x9415('0x68')]:'');}return _0x579f87+')';};var _0x2c5fae={'where':{'id':_0x4299bb[_0x9415('0x46')]['id']}},_0x1034f7,_0x41972b,_0x3513c7,_0x5e1af9,_0x506998;_0x2c5fae=_['merge']({},_0x2c5fae,_0x4299bb[_0x9415('0x40')]);return db['AnalyticCustomReport'][_0x9415('0x47')](_0x2c5fae)[_0x9415('0x25')](function(_0x2151a5){if(_0x2151a5){_0x1034f7=_0x2151a5;return _0x2151a5[_0x9415('0x8c')]();}return null;})['then'](function(_0x2f3258){if(_0x2f3258){if(!_0x2f3258[_0x9415('0x36')]){throw new db[(_0x9415('0x69'))][(_0x9415('0x6a'))](_0x9415('0x6b'),0x193);}_0x41972b=_0x2f3258;return db['AnalyticMetric'][_0x9415('0xa2')]({'raw':!![]});}return null;})[_0x9415('0x25')](function(_0x34b294){if(_0x34b294){_0x3513c7=_[_0x9415('0x6d')](_0x34b294,'id');var _0x2e656d;var _0x1d501d=squel[_0x9415('0x6e')]();_0x1d501d[_0x9415('0x6f')](_0x1034f7[_0x9415('0x70')]);for(var _0x59e4b7=0x0;_0x59e4b7<_0x41972b[_0x9415('0x36')];_0x59e4b7+=0x1){_0x2e656d=_0x41972b[_0x59e4b7][_0x9415('0x71')]?_0x3513c7[_0x41972b[_0x59e4b7][_0x9415('0x71')]]['metric']:_0x41972b[_0x59e4b7][_0x9415('0x66')];_0x2e656d=_0x41972b[_0x59e4b7][_0x9415('0x73')]?_[_0x9415('0x74')](_0x112b24[_0x41972b[_0x59e4b7]['function']],'%s',_0x2e656d):_0x2e656d;_0x2e656d=_0x41972b[_0x59e4b7]['format']?_['replace'](_0x27e3ab[_0x41972b[_0x59e4b7][_0x9415('0x75')]],'%s',_0x2e656d):_0x2e656d;if(_0x41972b[_0x59e4b7][_0x9415('0x8d')]){_0x1d501d[_0x9415('0x65')](_0x2e656d);}_0x41972b[_0x59e4b7]['orderBy']&&_0x1d501d[_0x9415('0x38')](_0x2e656d,_0x41972b[_0x59e4b7]['orderBy']===_0x9415('0xa3')?![]:!![]);_0x1d501d['field'](_0x2e656d,_0x41972b[_0x59e4b7]['alias']||_0x2e656d);}if(_0x1034f7['joins']){_0x1034f7[_0x9415('0x78')]=JSON[_0x9415('0x79')](_0x1034f7[_0x9415('0x78')]);for(var _0x1dfda9=0x0;_0x1dfda9<_0x1034f7[_0x9415('0x78')][_0x9415('0x36')];_0x1dfda9+=0x1){if(_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x2d')]&&_['includes'](_0x90a04,_0x1034f7['joins'][_0x1dfda9][_0x9415('0x2d')])&&_0x1034f7[_0x9415('0x78')][_0x1dfda9]['parentKey']&&_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7c')]&&_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7b')]){_0x1d501d[_0x1034f7[_0x9415('0x78')][_0x1dfda9]['type']](_0x1034f7[_0x9415('0x78')][_0x1dfda9][_0x9415('0x7c')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1034f7[_0x9415('0x70')],_0x1034f7['joins'][_0x1dfda9][_0x9415('0x7a')],_0x1034f7[_0x9415('0x78')][_0x1dfda9]['foreignTable'],_0x1034f7['joins'][_0x1dfda9][_0x9415('0x7b')]));}}}if(_0x1034f7[_0x9415('0x7e')]){_0x1034f7[_0x9415('0x7e')]=JSON[_0x9415('0x79')](_0x1034f7[_0x9415('0x7e')]);_0x1d501d[_0x9415('0x3d')](_0x5b9df7(_0x1034f7['conditions'][_0x9415('0x65')]));}_0x506998=_0x1d501d['clone']();_0x1d501d[_0x9415('0x1d')](_0x13fed2);_0x1d501d[_0x9415('0x1b')](0x0);logger[_0x9415('0x80')](_0x9415('0xa4'),_0x1d501d['toString']());return dbH[_0x9415('0x82')][_0x9415('0x31')](_0x1d501d[_0x9415('0x81')](),{'type':dbH[_0x9415('0x82')][_0x9415('0x83')][_0x9415('0x84')]});}})['then'](function(){return{'sql':_0x506998[_0x9415('0x81')]()};})[_0x9415('0x25')](respondWithResult(_0x1eaab0,null))[_0x9415('0x44')](handleError(_0x1eaab0,null));}; \ No newline at end of file +var _0x43fa=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','Sequelize','AnalyticMetric','foreignKey','output','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','undefined','limit','count','offset','Content-Range','json','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0x43fa,0x15c));var _0xa43f=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x43fa[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0xa43f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa43f('0x1'));var rp=require(_0xa43f('0x2'));var moment=require('moment');var BPromise=require(_0xa43f('0x3'));var Mustache=require(_0xa43f('0x4'));var util=require(_0xa43f('0x5'));var path=require(_0xa43f('0x6'));var sox=require(_0xa43f('0x7'));var csv=require('to-csv');var ejs=require(_0xa43f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa43f('0x9'));var squel=require(_0xa43f('0xa'));var crypto=require(_0xa43f('0xb'));var jsforce=require(_0xa43f('0xc'));var deskjs=require(_0xa43f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa43f('0xe'));var Papa=require(_0xa43f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa43f('0x10'));var as=require(_0xa43f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa43f('0x12'))(_0xa43f('0x13'));var utils=require(_0xa43f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa43f('0x15'))['db'];var dbH=require(_0xa43f('0x15'))[_0xa43f('0x16')];function respondWithStatusCode(_0x29905a,_0x4a9fae){_0x4a9fae=_0x4a9fae||0xcc;return function(_0x29e315){if(_0x29e315){return _0x29905a[_0xa43f('0x17')](_0x4a9fae);}return _0x29905a[_0xa43f('0x18')](_0x4a9fae)['end']();};}function respondWithResult(_0x5bcb1b,_0x2476c1){_0x2476c1=_0x2476c1||0xc8;return function(_0x3b9f37){if(_0x3b9f37){return _0x5bcb1b[_0xa43f('0x18')](_0x2476c1)['json'](_0x3b9f37);}};}function respondWithFilteredResult(_0xd45d5,_0x9be065){return function(_0x3ba1c6){if(_0x3ba1c6){var _0x46699d=typeof _0x9be065['offset']===_0xa43f('0x19')&&typeof _0x9be065[_0xa43f('0x1a')]==='undefined';var _0x3eca35=_0x3ba1c6[_0xa43f('0x1b')];var _0x4ff1cf=_0x46699d?0x0:_0x9be065[_0xa43f('0x1c')];var _0x4702a8=_0x46699d?_0x3ba1c6[_0xa43f('0x1b')]:_0x9be065[_0xa43f('0x1c')]+_0x9be065[_0xa43f('0x1a')];var _0xa24214;if(_0x4702a8>=_0x3eca35){_0x4702a8=_0x3eca35;_0xa24214=0xc8;}else{_0xa24214=0xce;}_0xd45d5[_0xa43f('0x18')](_0xa24214);return _0xd45d5['set'](_0xa43f('0x1d'),_0x4ff1cf+'-'+_0x4702a8+'/'+_0x3eca35)[_0xa43f('0x1e')](_0x3ba1c6);}return null;};}function patchUpdates(_0x1b31a7){return function(_0x2f0c4f){try{jsonpatch['apply'](_0x2f0c4f,_0x1b31a7,!![]);}catch(_0x3e1cc8){return BPromise['reject'](_0x3e1cc8);}return _0x2f0c4f['save']();};}function saveUpdates(_0xa45eae,_0x329c28){return function(_0x39408c){if(_0x39408c){return _0x39408c[_0xa43f('0x1f')](_0xa45eae)[_0xa43f('0x20')](function(_0x4bc3ac){return _0x4bc3ac;});}return null;};}function removeEntity(_0x2284b8,_0x28ab06){return function(_0x412d11){if(_0x412d11){return _0x412d11[_0xa43f('0x21')]()[_0xa43f('0x20')](function(){var _0x23a1be=_0x412d11[_0xa43f('0x22')]({'plain':!![]});var _0x47ba39=_0xa43f('0x23');return db[_0xa43f('0x24')][_0xa43f('0x21')]({'where':{'type':_0x47ba39,'resourceId':_0x23a1be['id']}})['then'](function(){return _0x412d11;});})[_0xa43f('0x20')](function(){_0x2284b8['status'](0xcc)[_0xa43f('0x25')]();});}};}function handleEntityNotFound(_0x7a7dd9,_0x338863){return function(_0x2424d9){if(!_0x2424d9){_0x7a7dd9[_0xa43f('0x17')](0x194);}return _0x2424d9;};}function handleError(_0x55414b,_0x4e874c){_0x4e874c=_0x4e874c||0x1f4;return function(_0xe63921){logger[_0xa43f('0x26')](_0xe63921[_0xa43f('0x27')]);if(_0xe63921['name']){delete _0xe63921[_0xa43f('0x28')];}_0x55414b[_0xa43f('0x18')](_0x4e874c)[_0xa43f('0x29')](_0xe63921);};}exports[_0xa43f('0x2a')]=function(_0x4ae1b4,_0x89aed7){var _0x522bf0={},_0xce9220={},_0x1ffa4b={'count':0x0,'rows':[]};var _0x52aaf9=_['map'](db[_0xa43f('0x2b')][_0xa43f('0x2c')],function(_0x4c38f8){return{'name':_0x4c38f8[_0xa43f('0x2d')],'type':_0x4c38f8[_0xa43f('0x2e')][_0xa43f('0x2f')]};});_0xce9220[_0xa43f('0x30')]=_[_0xa43f('0x31')](_0x52aaf9,'name');_0xce9220['query']=_[_0xa43f('0x32')](_0x4ae1b4[_0xa43f('0x33')]);_0xce9220[_0xa43f('0x34')]=_['intersection'](_0xce9220['model'],_0xce9220[_0xa43f('0x33')]);_0x522bf0[_0xa43f('0x35')]=_[_0xa43f('0x36')](_0xce9220[_0xa43f('0x30')],qs[_0xa43f('0x37')](_0x4ae1b4['query'][_0xa43f('0x37')]));_0x522bf0['attributes']=_0x522bf0[_0xa43f('0x35')][_0xa43f('0x38')]?_0x522bf0['attributes']:_0xce9220[_0xa43f('0x30')];if(!_0x4ae1b4['query'][_0xa43f('0x39')](_0xa43f('0x3a'))){_0x522bf0['limit']=qs[_0xa43f('0x1a')](_0x4ae1b4['query'][_0xa43f('0x1a')]);_0x522bf0[_0xa43f('0x1c')]=qs[_0xa43f('0x1c')](_0x4ae1b4[_0xa43f('0x33')]['offset']);}_0x522bf0['order']=qs[_0xa43f('0x3b')](_0x4ae1b4[_0xa43f('0x33')][_0xa43f('0x3b')]);_0x522bf0['where']=qs['filters'](_[_0xa43f('0x3c')](_0x4ae1b4[_0xa43f('0x33')],_0xce9220[_0xa43f('0x34')]),_0x52aaf9);if(_0x4ae1b4[_0xa43f('0x33')]['filter']){_0x522bf0[_0xa43f('0x3d')]=_['merge'](_0x522bf0[_0xa43f('0x3d')],{'$or':_[_0xa43f('0x31')](_0x52aaf9,function(_0x26a486){if(_0x26a486['type']!==_0xa43f('0x3e')){var _0x174cef={};_0x174cef[_0x26a486[_0xa43f('0x28')]]={'$like':'%'+_0x4ae1b4['query']['filter']+'%'};return _0x174cef;}})});}_0x522bf0=_['merge']({},_0x522bf0,_0x4ae1b4[_0xa43f('0x3f')]);var _0x139426={'where':_0x522bf0['where']};return db['AnalyticCustomReport'][_0xa43f('0x1b')](_0x139426)[_0xa43f('0x20')](function(_0x308087){_0x1ffa4b[_0xa43f('0x1b')]=_0x308087;if(_0x4ae1b4[_0xa43f('0x33')][_0xa43f('0x40')]){_0x522bf0[_0xa43f('0x41')]=[{'all':!![]}];}return db[_0xa43f('0x2b')][_0xa43f('0x42')](_0x522bf0);})[_0xa43f('0x20')](function(_0x40ec26){_0x1ffa4b['rows']=_0x40ec26;return _0x1ffa4b;})[_0xa43f('0x20')](respondWithFilteredResult(_0x89aed7,_0x522bf0))[_0xa43f('0x43')](handleError(_0x89aed7,null));};exports[_0xa43f('0x44')]=function(_0x20c062,_0x2fcdfd){var _0x55c9d6={'raw':![],'where':{'id':_0x20c062[_0xa43f('0x45')]['id']}},_0xdb168e={};_0xdb168e['model']=_[_0xa43f('0x32')](db[_0xa43f('0x2b')][_0xa43f('0x2c')]);_0xdb168e[_0xa43f('0x33')]=_['keys'](_0x20c062[_0xa43f('0x33')]);_0xdb168e[_0xa43f('0x34')]=_['intersection'](_0xdb168e[_0xa43f('0x30')],_0xdb168e['query']);_0x55c9d6[_0xa43f('0x35')]=_[_0xa43f('0x36')](_0xdb168e[_0xa43f('0x30')],qs[_0xa43f('0x37')](_0x20c062['query']['fields']));_0x55c9d6['attributes']=_0x55c9d6[_0xa43f('0x35')][_0xa43f('0x38')]?_0x55c9d6['attributes']:_0xdb168e['model'];if(_0x20c062[_0xa43f('0x33')][_0xa43f('0x40')]){_0x55c9d6[_0xa43f('0x41')]=[{'all':!![]}];}_0x55c9d6=_[_0xa43f('0x46')]({},_0x55c9d6,_0x20c062[_0xa43f('0x3f')]);return db[_0xa43f('0x2b')][_0xa43f('0x47')](_0x55c9d6)['then'](handleEntityNotFound(_0x2fcdfd,null))[_0xa43f('0x20')](respondWithResult(_0x2fcdfd,null))['catch'](handleError(_0x2fcdfd,null));};exports[_0xa43f('0x48')]=function(_0x2300c3,_0x4a48a2){return db[_0xa43f('0x2b')][_0xa43f('0x48')](_0x2300c3[_0xa43f('0x49')],{})[_0xa43f('0x20')](function(_0x2cd7e1){var _0x2d2f87=_0x2300c3[_0xa43f('0x4a')]['get']({'plain':!![]});if(!_0x2d2f87)throw new Error(_0xa43f('0x4b'));if(_0x2d2f87['role']===_0xa43f('0x4a')){var _0x5559aa=_0x2cd7e1[_0xa43f('0x22')]({'plain':!![]});var _0x1dca74=_0xa43f('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x1dca74,'userProfileId':_0x2d2f87[_0xa43f('0x4d')]},'raw':!![]})['then'](function(_0x321de8){if(_0x321de8&&_0x321de8[_0xa43f('0x4e')]===0x0){return db[_0xa43f('0x24')][_0xa43f('0x48')]({'name':_0x5559aa[_0xa43f('0x28')],'resourceId':_0x5559aa['id'],'type':_0xa43f('0x23'),'sectionId':_0x321de8['id']},{})[_0xa43f('0x20')](function(){return _0x2cd7e1;});}else{return _0x2cd7e1;}})['catch'](function(_0x5dac3a){logger[_0xa43f('0x26')](_0xa43f('0x4f'),_0x5dac3a);throw _0x5dac3a;});}return _0x2cd7e1;})['then'](respondWithResult(_0x4a48a2,0xc9))['catch'](handleError(_0x4a48a2,null));};exports['update']=function(_0x29a9d6,_0x288cf6){if(_0x29a9d6['body']['id']){delete _0x29a9d6['body']['id'];}return db['AnalyticCustomReport'][_0xa43f('0x47')]({'where':{'id':_0x29a9d6[_0xa43f('0x45')]['id']}})[_0xa43f('0x20')](handleEntityNotFound(_0x288cf6,null))[_0xa43f('0x20')](saveUpdates(_0x29a9d6[_0xa43f('0x49')],null))[_0xa43f('0x20')](respondWithResult(_0x288cf6,null))[_0xa43f('0x43')](handleError(_0x288cf6,null));};exports['destroy']=function(_0xa9e99b,_0x2f23c9){return db['AnalyticCustomReport'][_0xa43f('0x47')]({'where':{'id':_0xa9e99b[_0xa43f('0x45')]['id']}})[_0xa43f('0x20')](handleEntityNotFound(_0x2f23c9,null))[_0xa43f('0x20')](removeEntity(_0x2f23c9,null))['catch'](handleError(_0x2f23c9,null));};exports[_0xa43f('0x50')]=function(_0x56de81,_0x4cd555){var _0x3631eb=0xa;var _0x27a7bc=[_0xa43f('0x51'),_0xa43f('0x52'),'right_join',_0xa43f('0x53')];var _0x316e50={'SUM':_0xa43f('0x54'),'COUNT':_0xa43f('0x55'),'COUNT DISTINCT':_0xa43f('0x56'),'MAX':_0xa43f('0x57'),'MIN':_0xa43f('0x58'),'AVG':_0xa43f('0x59'),'GROUP_CONCAT':_0xa43f('0x5a'),'GROUP_CONCAT ASC':_0xa43f('0x5b'),'GROUP_CONCAT DESC':_0xa43f('0x5c')};var _0x4b106e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa43f('0x5d'),'HOUR':_0xa43f('0x5e'),'ROUND':_0xa43f('0x5f'),'UNIX_TIMESTAMP':_0xa43f('0x60')};var _0x402650=function(_0x56b932){return!_[_0xa43f('0x61')](['IS\x20NULL',_0xa43f('0x62'),_0xa43f('0x63'),'IS\x20NOT\x20EMPTY'],_0x56b932);};var _0x4791a0=function(_0x4bc83a){if(!_0x4bc83a||!_0x4bc83a[_0xa43f('0x64')][_0xa43f('0x38')]){return'';}for(var _0x5c78ff='(',_0x2b1d85=0x0;_0x2b1d85<_0x4bc83a[_0xa43f('0x64')][_0xa43f('0x38')];_0x2b1d85+=0x1){_0x2b1d85>0x0&&(_0x5c78ff+='\x20'+_0x4bc83a[_0xa43f('0x65')]+'\x20');_0x5c78ff+=_0x4bc83a['rules'][_0x2b1d85]['group']?_0x4791a0(_0x4bc83a[_0xa43f('0x64')][_0x2b1d85][_0xa43f('0x66')]):_0x4bc83a[_0xa43f('0x64')][_0x2b1d85][_0xa43f('0x67')]+'\x20'+_0x4bc83a[_0xa43f('0x64')][_0x2b1d85][_0xa43f('0x68')]+(_0x402650(_0x4bc83a[_0xa43f('0x64')][_0x2b1d85]['condition'])?'\x20'+_0x4bc83a['rules'][_0x2b1d85][_0xa43f('0x69')]:'');}return _0x5c78ff+')';};var _0x4b3e98={'where':{'id':_0x56de81[_0xa43f('0x45')]['id']}},_0x172f17,_0x5b6a69,_0x21fe8c,_0x2ad6ba,_0x11b99a;_0x4b3e98=_[_0xa43f('0x46')]({},_0x4b3e98,_0x56de81['options']);return db[_0xa43f('0x2b')][_0xa43f('0x47')](_0x4b3e98)[_0xa43f('0x20')](function(_0xdac3c9){if(_0xdac3c9){_0x172f17=_0xdac3c9;return _0xdac3c9[_0xa43f('0x6a')]();}return null;})[_0xa43f('0x20')](function(_0x2ff250){if(_0x2ff250){if(!_0x2ff250[_0xa43f('0x38')]){throw new db['Sequelize'][(_0xa43f('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5b6a69=_0x2ff250;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x1a0fbb){if(_0x1a0fbb){_0x21fe8c=_[_0xa43f('0x6c')](_0x1a0fbb,'id');var _0x1b2d58;var _0x293d93=squel[_0xa43f('0x6d')]();_0x293d93[_0xa43f('0x6e')](_0x172f17[_0xa43f('0x6f')]);for(var _0x48bd87=0x0;_0x48bd87<_0x5b6a69[_0xa43f('0x38')];_0x48bd87+=0x1){_0x1b2d58=_0x5b6a69[_0x48bd87][_0xa43f('0x70')]?_0x21fe8c[_0x5b6a69[_0x48bd87]['MetricId']][_0xa43f('0x71')]:_0x5b6a69[_0x48bd87]['field'];_0x1b2d58=_0x5b6a69[_0x48bd87]['function']?_['replace'](_0x316e50[_0x5b6a69[_0x48bd87][_0xa43f('0x72')]],'%s',_0x1b2d58):_0x1b2d58;_0x1b2d58=_0x5b6a69[_0x48bd87][_0xa43f('0x73')]?_[_0xa43f('0x74')](_0x4b106e[_0x5b6a69[_0x48bd87]['format']],'%s',_0x1b2d58):_0x1b2d58;if(_0x5b6a69[_0x48bd87][_0xa43f('0x75')]){_0x293d93[_0xa43f('0x66')](_0x1b2d58);}_0x5b6a69[_0x48bd87][_0xa43f('0x76')]&&_0x293d93[_0xa43f('0x77')](_0x1b2d58,_0x5b6a69[_0x48bd87][_0xa43f('0x76')]===_0xa43f('0x78')?![]:!![]);_0x293d93[_0xa43f('0x67')](_0x1b2d58,_0x5b6a69[_0x48bd87][_0xa43f('0x79')]||_0x1b2d58);}if(_0x172f17['joins']){_0x172f17[_0xa43f('0x7a')]=JSON[_0xa43f('0x7b')](_0x172f17[_0xa43f('0x7a')]);for(var _0x386c8c=0x0;_0x386c8c<_0x172f17['joins']['length'];_0x386c8c+=0x1){if(_0x172f17['joins'][_0x386c8c][_0xa43f('0x2e')]&&_[_0xa43f('0x61')](_0x27a7bc,_0x172f17['joins'][_0x386c8c]['type'])&&_0x172f17['joins'][_0x386c8c]['parentKey']&&_0x172f17[_0xa43f('0x7a')][_0x386c8c][_0xa43f('0x7c')]&&_0x172f17['joins'][_0x386c8c]['foreignKey']){_0x293d93[_0x172f17[_0xa43f('0x7a')][_0x386c8c][_0xa43f('0x2e')]](_0x172f17[_0xa43f('0x7a')][_0x386c8c][_0xa43f('0x7c')],null,util['format'](_0xa43f('0x7d'),_0x172f17[_0xa43f('0x6f')],_0x172f17['joins'][_0x386c8c][_0xa43f('0x7e')],_0x172f17[_0xa43f('0x7a')][_0x386c8c]['foreignTable'],_0x172f17[_0xa43f('0x7a')][_0x386c8c]['foreignKey']));}}}if(_0x172f17[_0xa43f('0x7f')]){_0x172f17[_0xa43f('0x7f')]=JSON['parse'](_0x172f17[_0xa43f('0x7f')]);_0x293d93[_0xa43f('0x3d')](_0x4791a0(_0x172f17[_0xa43f('0x7f')]['group']));}_0x11b99a=_0x293d93[_0xa43f('0x80')]();_0x293d93[_0xa43f('0x1a')](_0x3631eb);_0x293d93['offset'](0x0);logger[_0xa43f('0x81')](_0xa43f('0x82'),_0x293d93[_0xa43f('0x83')]());return dbH['sequelize']['query'](_0x293d93[_0xa43f('0x83')](),{'type':dbH[_0xa43f('0x84')][_0xa43f('0x85')][_0xa43f('0x86')]});}})[_0xa43f('0x20')](respondWithResult(_0x4cd555,null))[_0xa43f('0x43')](handleError(_0x4cd555,null));};function runReport(_0x780c31,_0x4686b6,_0x1d0b3a){var _0x4a652b=_0x4686b6[_0xa43f('0x28')];var _0x109bbe=0xa;var _0x591c8b=[_0xa43f('0x51'),'left_join','right_join',_0xa43f('0x53')];var _0xe16784={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa43f('0x56'),'MAX':_0xa43f('0x57'),'MIN':_0xa43f('0x58'),'AVG':_0xa43f('0x59'),'GROUP_CONCAT':_0xa43f('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x216dba={'SEC_TO_TIME':_0xa43f('0x87'),'DATE':_0xa43f('0x5d'),'HOUR':_0xa43f('0x5e'),'ROUND':_0xa43f('0x5f'),'UNIX_TIMESTAMP':_0xa43f('0x60')};var _0x8549d1=function(_0x52552e){return!_['includes'](['IS\x20NULL',_0xa43f('0x62'),_0xa43f('0x63'),_0xa43f('0x88')],_0x52552e);};var _0x4c4e60=function(_0x5d5af1){if(!_0x5d5af1||!_0x5d5af1[_0xa43f('0x64')][_0xa43f('0x38')]){return'';}for(var _0x20420b='(',_0x4ec13f=0x0;_0x4ec13f<_0x5d5af1[_0xa43f('0x64')][_0xa43f('0x38')];_0x4ec13f+=0x1){_0x4ec13f>0x0&&(_0x20420b+='\x20'+_0x5d5af1['operator']+'\x20');_0x20420b+=_0x5d5af1[_0xa43f('0x64')][_0x4ec13f][_0xa43f('0x66')]?_0x4c4e60(_0x5d5af1[_0xa43f('0x64')][_0x4ec13f][_0xa43f('0x66')]):_0x5d5af1[_0xa43f('0x64')][_0x4ec13f]['field']+'\x20'+_0x5d5af1['rules'][_0x4ec13f][_0xa43f('0x68')]+(_0x8549d1(_0x5d5af1[_0xa43f('0x64')][_0x4ec13f]['condition'])?'\x20'+_0x5d5af1[_0xa43f('0x64')][_0x4ec13f][_0xa43f('0x69')]:'');}return _0x20420b+')';};var _0x256b70={'where':{'id':_0x780c31['id']}},_0x160270,_0x5165d7,_0x2aab32,_0x1db1ab,_0x58dd04;_0x256b70=_[_0xa43f('0x46')]({},_0x256b70,_0x1d0b3a);return db[_0xa43f('0x2b')]['find'](_0x256b70)[_0xa43f('0x20')](function(_0x483426){if(_0x483426){_0x160270=_0x483426;return _0x483426[_0xa43f('0x6a')]();}return null;})['then'](function(_0x129d49){if(_0x129d49){if(!_0x129d49[_0xa43f('0x38')]){throw new db[(_0xa43f('0x89'))][(_0xa43f('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5165d7=_0x129d49;return db[_0xa43f('0x8a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x212f1e){if(_0x212f1e){_0x2aab32=_[_0xa43f('0x6c')](_0x212f1e,'id');var _0x515652;var _0x554dda=squel['select']();_0x554dda[_0xa43f('0x6e')](_0x160270['table']);for(var _0x88677b=0x0;_0x88677b<_0x5165d7[_0xa43f('0x38')];_0x88677b+=0x1){_0x515652=_0x5165d7[_0x88677b][_0xa43f('0x70')]?_0x2aab32[_0x5165d7[_0x88677b][_0xa43f('0x70')]][_0xa43f('0x71')]:_0x5165d7[_0x88677b][_0xa43f('0x67')];_0x515652=_0x5165d7[_0x88677b][_0xa43f('0x72')]?_[_0xa43f('0x74')](_0xe16784[_0x5165d7[_0x88677b][_0xa43f('0x72')]],'%s',_0x515652):_0x515652;_0x515652=_0x5165d7[_0x88677b][_0xa43f('0x73')]?_[_0xa43f('0x74')](_0x216dba[_0x5165d7[_0x88677b][_0xa43f('0x73')]],'%s',_0x515652):_0x515652;if(_0x5165d7[_0x88677b][_0xa43f('0x75')]){_0x554dda[_0xa43f('0x66')](_0x515652);}_0x5165d7[_0x88677b][_0xa43f('0x76')]&&_0x554dda[_0xa43f('0x77')](_0x515652,_0x5165d7[_0x88677b][_0xa43f('0x76')]===_0xa43f('0x78')?![]:!![]);_0x554dda['field'](_0x515652,_0x5165d7[_0x88677b][_0xa43f('0x79')]||_0x515652);}if(_0x160270[_0xa43f('0x7a')]){_0x160270[_0xa43f('0x7a')]=JSON[_0xa43f('0x7b')](_0x160270[_0xa43f('0x7a')]);for(var _0x266884=0x0;_0x266884<_0x160270[_0xa43f('0x7a')][_0xa43f('0x38')];_0x266884+=0x1){if(_0x160270['joins'][_0x266884][_0xa43f('0x2e')]&&_[_0xa43f('0x61')](_0x591c8b,_0x160270['joins'][_0x266884][_0xa43f('0x2e')])&&_0x160270['joins'][_0x266884][_0xa43f('0x7e')]&&_0x160270['joins'][_0x266884][_0xa43f('0x7c')]&&_0x160270['joins'][_0x266884][_0xa43f('0x8b')]){_0x554dda[_0x160270['joins'][_0x266884][_0xa43f('0x2e')]](_0x160270[_0xa43f('0x7a')][_0x266884]['foreignTable'],null,util[_0xa43f('0x73')](_0xa43f('0x7d'),_0x160270[_0xa43f('0x6f')],_0x160270[_0xa43f('0x7a')][_0x266884][_0xa43f('0x7e')],_0x160270[_0xa43f('0x7a')][_0x266884][_0xa43f('0x7c')],_0x160270[_0xa43f('0x7a')][_0x266884][_0xa43f('0x8b')]));}}}if(_0x160270[_0xa43f('0x7f')]){_0x160270[_0xa43f('0x7f')]=JSON['parse'](_0x160270['conditions']);_0x554dda['where'](_0x4c4e60(_0x160270['conditions']['group']));}_0x58dd04=_0x554dda[_0xa43f('0x80')]();_0x554dda[_0xa43f('0x1a')](_0x109bbe);_0x554dda[_0xa43f('0x1c')](0x0);return;}})[_0xa43f('0x20')](function(){if(_0x4686b6[_0xa43f('0x8c')]==='web'){return null;}var _0x339b3e=_[_0xa43f('0x46')](_0x4686b6,{'name':_0x4686b6['fullPath']||_0x4686b6['name']||_0x160270[_0xa43f('0x28')],'basename':_0x4a652b,'savename':util[_0xa43f('0x73')]('%s-%s.%s',_0x4686b6[_0xa43f('0x28')]||_0x160270[_0xa43f('0x28')],require(_0xa43f('0x8d'))[_0xa43f('0x8e')](0x4),_0x4686b6[_0xa43f('0x8c')]||'csv'),'reportId':_0x160270['id'],'reportType':_0xa43f('0x8f')});return db[_0xa43f('0x90')][_0xa43f('0x48')](_0x339b3e,{'raw':!![]});})['then'](function(_0x582cfc){if(_0x160270[_0xa43f('0x6f')]===_0xa43f('0x91')){_0x58dd04[_0xa43f('0x3d')](_0x160270[_0xa43f('0x6f')]+_0xa43f('0x92'),_0x4686b6[_0xa43f('0x93')],_0x4686b6[_0xa43f('0x94')]);}else{_0x58dd04[_0xa43f('0x3d')](_0x160270[_0xa43f('0x6f')]+_0xa43f('0x95'),_0x4686b6[_0xa43f('0x93')],_0x4686b6[_0xa43f('0x94')]);}if(_0x582cfc){logger[_0xa43f('0x96')]('Run\x20Query:',_0x58dd04[_0xa43f('0x83')]());require('child_process')[_0xa43f('0x97')](path[_0xa43f('0x51')](__dirname,_0xa43f('0x98'),_0x582cfc[_0xa43f('0x8c')]),[_0x582cfc['id'],_0x58dd04[_0xa43f('0x83')](),path['join'](__dirname,_0xa43f('0x99'),_0x582cfc['savename']),_0x4a652b]);return _0x582cfc;}else{var _0x4b5518=squel[_0xa43f('0x6d')]();_0x4b5518[_0xa43f('0x6e')]('('+_0x58dd04['toString']()+')','countTable');_0x4b5518[_0xa43f('0x67')](_0xa43f('0x9a'),_0xa43f('0x1b'));_0x58dd04[_0xa43f('0x1a')](_0x4686b6['limit']||_0x109bbe);_0x58dd04[_0xa43f('0x1c')](_0x4686b6[_0xa43f('0x1c')]||0x0);return dbH[_0xa43f('0x84')]['query'](_0x4b5518[_0xa43f('0x83')](),{'type':dbH['sequelize'][_0xa43f('0x85')][_0xa43f('0x86')]})[_0xa43f('0x20')](function(_0x471d59){if(!_0x471d59[_0xa43f('0x38')]){_0x1db1ab=0x0;}else{_0x1db1ab=_0x471d59[0x0][_0xa43f('0x1b')]||0x0;}return dbH[_0xa43f('0x84')][_0xa43f('0x33')](_0x58dd04['toString'](),{'type':dbH['sequelize'][_0xa43f('0x85')]['SELECT']});})[_0xa43f('0x20')](function(_0x5f0052){return{'rows':_0x5f0052||[],'count':_0x1db1ab};});}});}exports[_0xa43f('0x9b')]=function(_0x279f19,_0x18816b){return runReport(_0x279f19[_0xa43f('0x45')],_0x279f19['query'],_0x279f19['options'])[_0xa43f('0x20')](respondWithResult(_0x18816b,null))['catch'](handleError(_0x18816b,null));};exports[_0xa43f('0x9c')]=runReport;exports[_0xa43f('0x33')]=function(_0x2958ec,_0x403189){var _0x2b55d2=0xa;var _0xb2af87=[_0xa43f('0x51'),_0xa43f('0x52'),'right_join',_0xa43f('0x53')];var _0x216f5d={'SUM':_0xa43f('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa43f('0x57'),'MIN':'MIN(%s)','AVG':_0xa43f('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xa43f('0x5b'),'GROUP_CONCAT DESC':_0xa43f('0x5c')};var _0x1feace={'SEC_TO_TIME':_0xa43f('0x87'),'DATE':_0xa43f('0x5d'),'HOUR':_0xa43f('0x5e'),'ROUND':_0xa43f('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x260a7b=function(_0x594178){return!_[_0xa43f('0x61')]([_0xa43f('0x9d'),_0xa43f('0x62'),_0xa43f('0x63'),_0xa43f('0x88')],_0x594178);};var _0x415334=function(_0x22b511){if(!_0x22b511||!_0x22b511['rules'][_0xa43f('0x38')]){return'';}for(var _0x471d7e='(',_0x2f3b24=0x0;_0x2f3b24<_0x22b511[_0xa43f('0x64')][_0xa43f('0x38')];_0x2f3b24+=0x1){_0x2f3b24>0x0&&(_0x471d7e+='\x20'+_0x22b511[_0xa43f('0x65')]+'\x20');_0x471d7e+=_0x22b511[_0xa43f('0x64')][_0x2f3b24][_0xa43f('0x66')]?_0x415334(_0x22b511[_0xa43f('0x64')][_0x2f3b24][_0xa43f('0x66')]):_0x22b511[_0xa43f('0x64')][_0x2f3b24]['field']+'\x20'+_0x22b511['rules'][_0x2f3b24][_0xa43f('0x68')]+(_0x260a7b(_0x22b511[_0xa43f('0x64')][_0x2f3b24][_0xa43f('0x68')])?'\x20'+_0x22b511[_0xa43f('0x64')][_0x2f3b24][_0xa43f('0x69')]:'');}return _0x471d7e+')';};var _0x2ca2bf={'where':{'id':_0x2958ec[_0xa43f('0x45')]['id']}},_0x588f98,_0x36990c,_0xa21e44,_0x30d82d,_0x2c3b18;_0x2ca2bf=_['merge']({},_0x2ca2bf,_0x2958ec[_0xa43f('0x3f')]);return db[_0xa43f('0x2b')][_0xa43f('0x47')](_0x2ca2bf)[_0xa43f('0x20')](function(_0x2f3f7f){if(_0x2f3f7f){_0x588f98=_0x2f3f7f;return _0x2f3f7f[_0xa43f('0x6a')]();}return null;})[_0xa43f('0x20')](function(_0x1010f8){if(_0x1010f8){if(!_0x1010f8['length']){throw new db['Sequelize'][(_0xa43f('0x6b'))](_0xa43f('0x9e'),0x193);}_0x36990c=_0x1010f8;return db[_0xa43f('0x8a')]['findAll']({'raw':!![]});}return null;})[_0xa43f('0x20')](function(_0x44b83c){if(_0x44b83c){_0xa21e44=_[_0xa43f('0x6c')](_0x44b83c,'id');var _0x12c138;var _0x230d99=squel['select']();_0x230d99[_0xa43f('0x6e')](_0x588f98['table']);for(var _0x5be9a9=0x0;_0x5be9a9<_0x36990c['length'];_0x5be9a9+=0x1){_0x12c138=_0x36990c[_0x5be9a9][_0xa43f('0x70')]?_0xa21e44[_0x36990c[_0x5be9a9][_0xa43f('0x70')]][_0xa43f('0x71')]:_0x36990c[_0x5be9a9]['field'];_0x12c138=_0x36990c[_0x5be9a9][_0xa43f('0x72')]?_[_0xa43f('0x74')](_0x216f5d[_0x36990c[_0x5be9a9][_0xa43f('0x72')]],'%s',_0x12c138):_0x12c138;_0x12c138=_0x36990c[_0x5be9a9][_0xa43f('0x73')]?_[_0xa43f('0x74')](_0x1feace[_0x36990c[_0x5be9a9][_0xa43f('0x73')]],'%s',_0x12c138):_0x12c138;if(_0x36990c[_0x5be9a9]['groupBy']){_0x230d99['group'](_0x12c138);}_0x36990c[_0x5be9a9][_0xa43f('0x76')]&&_0x230d99['order'](_0x12c138,_0x36990c[_0x5be9a9][_0xa43f('0x76')]===_0xa43f('0x78')?![]:!![]);_0x230d99['field'](_0x12c138,_0x36990c[_0x5be9a9][_0xa43f('0x79')]||_0x12c138);}if(_0x588f98['joins']){_0x588f98[_0xa43f('0x7a')]=JSON['parse'](_0x588f98[_0xa43f('0x7a')]);for(var _0x5cad96=0x0;_0x5cad96<_0x588f98[_0xa43f('0x7a')][_0xa43f('0x38')];_0x5cad96+=0x1){if(_0x588f98['joins'][_0x5cad96]['type']&&_['includes'](_0xb2af87,_0x588f98[_0xa43f('0x7a')][_0x5cad96][_0xa43f('0x2e')])&&_0x588f98['joins'][_0x5cad96][_0xa43f('0x7e')]&&_0x588f98[_0xa43f('0x7a')][_0x5cad96]['foreignTable']&&_0x588f98[_0xa43f('0x7a')][_0x5cad96][_0xa43f('0x8b')]){_0x230d99[_0x588f98[_0xa43f('0x7a')][_0x5cad96][_0xa43f('0x2e')]](_0x588f98[_0xa43f('0x7a')][_0x5cad96][_0xa43f('0x7c')],null,util[_0xa43f('0x73')]('%s.%s\x20=\x20%s.%s',_0x588f98[_0xa43f('0x6f')],_0x588f98['joins'][_0x5cad96][_0xa43f('0x7e')],_0x588f98[_0xa43f('0x7a')][_0x5cad96][_0xa43f('0x7c')],_0x588f98['joins'][_0x5cad96][_0xa43f('0x8b')]));}}}if(_0x588f98[_0xa43f('0x7f')]){_0x588f98[_0xa43f('0x7f')]=JSON['parse'](_0x588f98['conditions']);_0x230d99[_0xa43f('0x3d')](_0x415334(_0x588f98[_0xa43f('0x7f')][_0xa43f('0x66')]));}_0x2c3b18=_0x230d99[_0xa43f('0x80')]();_0x230d99[_0xa43f('0x1a')](_0x2b55d2);_0x230d99[_0xa43f('0x1c')](0x0);logger[_0xa43f('0x81')](_0xa43f('0x82'),_0x230d99[_0xa43f('0x83')]());return dbH[_0xa43f('0x84')][_0xa43f('0x33')](_0x230d99['toString'](),{'type':dbH[_0xa43f('0x84')][_0xa43f('0x85')][_0xa43f('0x86')]});}})[_0xa43f('0x20')](function(){return{'sql':_0x2c3b18[_0xa43f('0x83')]()};})[_0xa43f('0x20')](respondWithResult(_0x403189,null))[_0xa43f('0x43')](handleError(_0x403189,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2d6512c..16406ee 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 _0x96a6=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96a6,0x128));var _0x696a=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x96a6[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x696a('0x0'));var util=require(_0x696a('0x1'));var logger=require(_0x696a('0x2'))(_0x696a('0x3'));var moment=require(_0x696a('0x4'));var BPromise=require(_0x696a('0x5'));var rp=require(_0x696a('0x6'));var fs=require('fs');var path=require(_0x696a('0x7'));var rimraf=require(_0x696a('0x8'));var config=require(_0x696a('0x9'));var attributes=require(_0x696a('0xa'));module[_0x696a('0xb')]=function(_0x469cc9,_0x309129){return _0x469cc9['define'](_0x696a('0xc'),attributes,{'tableName':_0x696a('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x200c=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x200c,0x140));var _0xc200=function(_0x7aa365,_0xc71a5c){_0x7aa365=_0x7aa365-0x0;var _0x4fe0b4=_0x200c[_0x7aa365];return _0x4fe0b4;};'use strict';var _=require(_0xc200('0x0'));var util=require(_0xc200('0x1'));var logger=require(_0xc200('0x2'))(_0xc200('0x3'));var moment=require(_0xc200('0x4'));var BPromise=require(_0xc200('0x5'));var rp=require(_0xc200('0x6'));var fs=require('fs');var path=require(_0xc200('0x7'));var rimraf=require(_0xc200('0x8'));var config=require(_0xc200('0x9'));var attributes=require(_0xc200('0xa'));module[_0xc200('0xb')]=function(_0x250917,_0x4fd896){return _0x250917['define']('AnalyticCustomReport',attributes,{'tableName':_0xc200('0xc'),'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 9ece6f5..b6ab299 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 _0xfd0c=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0xfd0c,0x179));var _0xcfd0=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0xfd0c[_0x46ef1d];return _0x49ce69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcfd0('0x0'));var BPromise=require(_0xcfd0('0x1'));var rs=require(_0xcfd0('0x2'));var fs=require('fs');var Redis=require(_0xcfd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfd0('0x4'));var logger=require(_0xcfd0('0x5'))(_0xcfd0('0x6'));var config=require(_0xcfd0('0x7'));var jayson=require(_0xcfd0('0x8'));var client=jayson[_0xcfd0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b16b1,_0xe0c6d7,_0xaed066){return new BPromise(function(_0x2113e7,_0x4cf61c){return client[_0xcfd0('0xa')](_0x2b16b1,_0xaed066)[_0xcfd0('0xb')](function(_0x3d3d25){logger[_0xcfd0('0xc')](_0xcfd0('0xd'),_0xe0c6d7,_0xcfd0('0xe'));logger[_0xcfd0('0xf')](_0xcfd0('0x10'),_0xe0c6d7,_0xcfd0('0xe'),JSON[_0xcfd0('0x11')](_0x3d3d25));if(_0x3d3d25[_0xcfd0('0x12')]){if(_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x13')]===0x1f4){logger[_0xcfd0('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0x3d3d25['error']['message']);return _0x4cf61c(_0x3d3d25['error']['message']);}logger[_0xcfd0('0x12')](_0xcfd0('0xd'),_0xe0c6d7,_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x14')]);return _0x2113e7(_0x3d3d25[_0xcfd0('0x12')][_0xcfd0('0x14')]);}else{logger[_0xcfd0('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0xcfd0('0xe'));_0x2113e7(_0x3d3d25[_0xcfd0('0x15')]['message']);}})[_0xcfd0('0x16')](function(_0x3cc2c3){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xe0c6d7,_0x3cc2c3);_0x4cf61c(_0x3cc2c3);});});} \ No newline at end of file +var _0x5845=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3dcab,_0x58860f){var _0x517c6a=function(_0x1bcf1f){while(--_0x1bcf1f){_0x3dcab['push'](_0x3dcab['shift']());}};_0x517c6a(++_0x58860f);}(_0x5845,0xc0));var _0x5584=function(_0xe1509f,_0x33d732){_0xe1509f=_0xe1509f-0x0;var _0x31ed71=_0x5845[_0xe1509f];return _0x31ed71;};'use strict';var _=require(_0x5584('0x0'));var util=require(_0x5584('0x1'));var moment=require(_0x5584('0x2'));var BPromise=require(_0x5584('0x3'));var rs=require(_0x5584('0x4'));var fs=require('fs');var Redis=require(_0x5584('0x5'));var db=require(_0x5584('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5584('0x7'))(_0x5584('0x8'));var config=require(_0x5584('0x9'));var jayson=require(_0x5584('0xa'));var client=jayson[_0x5584('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d3060,_0x407895,_0x365fd4){return new BPromise(function(_0x133f32,_0x3f21ba){return client[_0x5584('0xc')](_0x2d3060,_0x365fd4)[_0x5584('0xd')](function(_0x428211){logger[_0x5584('0xe')](_0x5584('0xf'),_0x407895,_0x5584('0x10'));logger[_0x5584('0x11')](_0x5584('0x12'),_0x407895,_0x5584('0x10'),JSON[_0x5584('0x13')](_0x428211));if(_0x428211[_0x5584('0x14')]){if(_0x428211[_0x5584('0x14')][_0x5584('0x15')]===0x1f4){logger[_0x5584('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x407895,_0x428211['error'][_0x5584('0x16')]);return _0x3f21ba(_0x428211[_0x5584('0x14')][_0x5584('0x16')]);}logger[_0x5584('0x14')](_0x5584('0xf'),_0x407895,_0x428211['error']['message']);return _0x133f32(_0x428211[_0x5584('0x14')]['message']);}else{logger[_0x5584('0xe')](_0x5584('0xf'),_0x407895,_0x5584('0x10'));_0x133f32(_0x428211['result'][_0x5584('0x16')]);}})[_0x5584('0x17')](function(_0x5bc057){logger['error'](_0x5584('0xf'),_0x407895,_0x5bc057);_0x3f21ba(_0x5bc057);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 7cf70c4..81dcc06 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 _0x1d39=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1d39,0x72));var _0x91d3=function(_0x102f0a,_0x13474d){_0x102f0a=_0x102f0a-0x0;var _0x35e503=_0x1d39[_0x102f0a];return _0x35e503;};'use strict';var multer=require(_0x91d3('0x0'));var util=require(_0x91d3('0x1'));var path=require(_0x91d3('0x2'));var timeout=require(_0x91d3('0x3'));var express=require(_0x91d3('0x4'));var router=express[_0x91d3('0x5')]();var fs_extra=require(_0x91d3('0x6'));var auth=require(_0x91d3('0x7'));var interaction=require(_0x91d3('0x8'));var config=require('../../config/environment');var controller=require(_0x91d3('0x9'));router[_0x91d3('0xa')]('/',auth[_0x91d3('0xb')](),controller[_0x91d3('0xc')]);router[_0x91d3('0xa')](_0x91d3('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x91d3('0xa')](_0x91d3('0xe'),auth[_0x91d3('0xb')](),controller[_0x91d3('0xf')]);router[_0x91d3('0xa')](_0x91d3('0x10'),auth[_0x91d3('0xb')](),controller[_0x91d3('0x11')]);router[_0x91d3('0xa')](_0x91d3('0x12'),auth[_0x91d3('0xb')](),controller[_0x91d3('0x13')]);router[_0x91d3('0x14')]('/',auth['isAuthenticated'](),controller[_0x91d3('0x15')]);router[_0x91d3('0x16')]('/:id',auth[_0x91d3('0xb')](),controller[_0x91d3('0x17')]);router[_0x91d3('0x18')]('/:id',auth[_0x91d3('0xb')](),controller[_0x91d3('0x19')]);module[_0x91d3('0x1a')]=router; \ No newline at end of file +var _0xe0a1=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller'];(function(_0x1e830c,_0x31776b){var _0x3196e9=function(_0xfe5078){while(--_0xfe5078){_0x1e830c['push'](_0x1e830c['shift']());}};_0x3196e9(++_0x31776b);}(_0xe0a1,0x115));var _0x1e0a=function(_0x556632,_0xc57c26){_0x556632=_0x556632-0x0;var _0x56aee8=_0xe0a1[_0x556632];return _0x56aee8;};'use strict';var multer=require(_0x1e0a('0x0'));var util=require(_0x1e0a('0x1'));var path=require(_0x1e0a('0x2'));var timeout=require(_0x1e0a('0x3'));var express=require(_0x1e0a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1e0a('0x5'));var interaction=require(_0x1e0a('0x6'));var config=require(_0x1e0a('0x7'));var controller=require(_0x1e0a('0x8'));router[_0x1e0a('0x9')]('/',auth[_0x1e0a('0xa')](),controller[_0x1e0a('0xb')]);router[_0x1e0a('0x9')](_0x1e0a('0xc'),auth[_0x1e0a('0xa')](),controller[_0x1e0a('0xd')]);router['get'](_0x1e0a('0xe'),auth[_0x1e0a('0xa')](),controller[_0x1e0a('0xf')]);router[_0x1e0a('0x9')](_0x1e0a('0x10'),auth['isAuthenticated'](),controller['run']);router['get'](_0x1e0a('0x11'),auth['isAuthenticated'](),controller[_0x1e0a('0x12')]);router[_0x1e0a('0x13')]('/',auth[_0x1e0a('0xa')](),controller[_0x1e0a('0x14')]);router[_0x1e0a('0x15')](_0x1e0a('0xc'),auth[_0x1e0a('0xa')](),controller[_0x1e0a('0x16')]);router[_0x1e0a('0x17')](_0x1e0a('0xc'),auth['isAuthenticated'](),controller[_0x1e0a('0x18')]);module[_0x1e0a('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 413735c..c21e0b2 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x541a43,_0x1c647e){var _0x322b5e=function(_0x23a468){while(--_0x23a468){_0x541a43['push'](_0x541a43['shift']());}};_0x322b5e(++_0x1c647e);}(_0x33c5,0xe6));var _0x533c=function(_0x1a4cac,_0x116f47){_0x1a4cac=_0x1a4cac-0x0;var _0x142f2f=_0x33c5[_0x1a4cac];return _0x142f2f;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0xdc97,0x13b));var _0x7dc9=function(_0x245fd2,_0x2bebb9){_0x245fd2=_0x245fd2-0x0;var _0x406992=_0xdc97[_0x245fd2];return _0x406992;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bfbaafe..c67ce1f 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x1683cf,_0x20b3cb){var _0x1159ad=function(_0x241e90){while(--_0x241e90){_0x1683cf['push'](_0x1683cf['shift']());}};_0x1159ad(++_0x20b3cb);}(_0x2675,0x75));var _0x5267=function(_0x196e4a,_0x2fbad1){_0x196e4a=_0x196e4a-0x0;var _0x3aa61d=_0x2675[_0x196e4a];return _0x3aa61d;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0x5fc3=['QueryTypes','right_join','HOUR(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','destroy','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','getFields','ValidationErrorItem','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)'];(function(_0x25cc55,_0x34bc44){var _0x37943c=function(_0x2ab2e8){while(--_0x2ab2e8){_0x25cc55['push'](_0x25cc55['shift']());}};_0x37943c(++_0x34bc44);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0x5fc3[_0xd1b4d7];return _0x3002ec;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x35fc('0x17')];function respondWithStatusCode(_0x5d462a,_0x397738){_0x397738=_0x397738||0xcc;return function(_0x22055e){if(_0x22055e){return _0x5d462a[_0x35fc('0x18')](_0x397738);}return _0x5d462a[_0x35fc('0x19')](_0x397738)[_0x35fc('0x1a')]();};}function respondWithResult(_0x5cfe94,_0x59507a){_0x59507a=_0x59507a||0xc8;return function(_0x5eac0f){if(_0x5eac0f){return _0x5cfe94['status'](_0x59507a)[_0x35fc('0x1b')](_0x5eac0f);}};}function respondWithFilteredResult(_0x229d56,_0x53b898){return function(_0x154958){if(_0x154958){var _0x227a49=typeof _0x53b898[_0x35fc('0x1c')]==='undefined'&&typeof _0x53b898[_0x35fc('0x1d')]===_0x35fc('0x1e');var _0x553677=_0x154958[_0x35fc('0x1f')];var _0x363e47=_0x227a49?0x0:_0x53b898[_0x35fc('0x1c')];var _0x5f56c6=_0x227a49?_0x154958[_0x35fc('0x1f')]:_0x53b898[_0x35fc('0x1c')]+_0x53b898[_0x35fc('0x1d')];var _0x488234;if(_0x5f56c6>=_0x553677){_0x5f56c6=_0x553677;_0x488234=0xc8;}else{_0x488234=0xce;}_0x229d56[_0x35fc('0x19')](_0x488234);return _0x229d56[_0x35fc('0x20')](_0x35fc('0x21'),_0x363e47+'-'+_0x5f56c6+'/'+_0x553677)[_0x35fc('0x1b')](_0x154958);}return null;};}function patchUpdates(_0x20ffde){return function(_0x21f1a9){try{jsonpatch[_0x35fc('0x22')](_0x21f1a9,_0x20ffde,!![]);}catch(_0x3b05b0){return BPromise[_0x35fc('0x23')](_0x3b05b0);}return _0x21f1a9[_0x35fc('0x24')]();};}function saveUpdates(_0x5bd2b8,_0x323aee){return function(_0xd5399f){if(_0xd5399f){return _0xd5399f[_0x35fc('0x25')](_0x5bd2b8)[_0x35fc('0x26')](function(_0x3b4743){return _0x3b4743;});}return null;};}function removeEntity(_0x55e9e7,_0x33f5e8){return function(_0x4c587a){if(_0x4c587a){return _0x4c587a['destroy']()[_0x35fc('0x26')](function(){var _0x5a93df=_0x4c587a[_0x35fc('0x27')]({'plain':!![]});var _0x51cfec=_0x35fc('0x28');return db['UserProfileResource'][_0x35fc('0x29')]({'where':{'type':_0x51cfec,'resourceId':_0x5a93df['id']}})[_0x35fc('0x26')](function(){return _0x4c587a;});})['then'](function(){_0x55e9e7['status'](0xcc)[_0x35fc('0x1a')]();});}};}function handleEntityNotFound(_0x58edb6,_0x274208){return function(_0x1a5d92){if(!_0x1a5d92){_0x58edb6['sendStatus'](0x194);}return _0x1a5d92;};}function handleError(_0x26b7cb,_0x645eac){_0x645eac=_0x645eac||0x1f4;return function(_0x383837){logger[_0x35fc('0x2a')](_0x383837[_0x35fc('0x2b')]);if(_0x383837[_0x35fc('0x2c')]){delete _0x383837[_0x35fc('0x2c')];}_0x26b7cb[_0x35fc('0x19')](_0x645eac)['send'](_0x383837);};}exports[_0x35fc('0x2d')]=function(_0x220931,_0x22af18){var _0x52acc5={},_0xe79f52={},_0x16f067={'count':0x0,'rows':[]};var _0x3822a8=_[_0x35fc('0x2e')](db[_0x35fc('0x2f')][_0x35fc('0x30')],function(_0x222ddb){return{'name':_0x222ddb[_0x35fc('0x31')],'type':_0x222ddb[_0x35fc('0x32')][_0x35fc('0x33')]};});_0xe79f52['model']=_['map'](_0x3822a8,_0x35fc('0x2c'));_0xe79f52['query']=_[_0x35fc('0x34')](_0x220931[_0x35fc('0x35')]);_0xe79f52[_0x35fc('0x36')]=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],_0xe79f52[_0x35fc('0x35')]);_0x52acc5['attributes']=_[_0x35fc('0x37')](_0xe79f52[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x220931[_0x35fc('0x35')][_0x35fc('0x39')]));_0x52acc5[_0x35fc('0x3a')]=_0x52acc5['attributes'][_0x35fc('0x3b')]?_0x52acc5[_0x35fc('0x3a')]:_0xe79f52[_0x35fc('0x38')];if(!_0x220931['query'][_0x35fc('0x3c')]('nolimit')){_0x52acc5[_0x35fc('0x1d')]=qs[_0x35fc('0x1d')](_0x220931[_0x35fc('0x35')][_0x35fc('0x1d')]);_0x52acc5['offset']=qs['offset'](_0x220931['query'][_0x35fc('0x1c')]);}_0x52acc5['order']=qs[_0x35fc('0x3d')](_0x220931['query'][_0x35fc('0x3d')]);_0x52acc5[_0x35fc('0x3e')]=qs[_0x35fc('0x36')](_[_0x35fc('0x3f')](_0x220931[_0x35fc('0x35')],_0xe79f52[_0x35fc('0x36')]),_0x3822a8);if(_0x220931[_0x35fc('0x35')]['filter']){_0x52acc5[_0x35fc('0x3e')]=_[_0x35fc('0x40')](_0x52acc5['where'],{'$or':_[_0x35fc('0x2e')](_0x3822a8,function(_0x1ccc41){if(_0x1ccc41[_0x35fc('0x32')]!==_0x35fc('0x41')){var _0x813866={};_0x813866[_0x1ccc41[_0x35fc('0x2c')]]={'$like':'%'+_0x220931['query'][_0x35fc('0x42')]+'%'};return _0x813866;}})});}_0x52acc5=_[_0x35fc('0x40')]({},_0x52acc5,_0x220931[_0x35fc('0x43')]);var _0x52543b={'where':_0x52acc5[_0x35fc('0x3e')]};return db[_0x35fc('0x2f')]['count'](_0x52543b)[_0x35fc('0x26')](function(_0x280af1){_0x16f067[_0x35fc('0x1f')]=_0x280af1;if(_0x220931[_0x35fc('0x35')][_0x35fc('0x44')]){_0x52acc5[_0x35fc('0x45')]=[{'all':!![]}];}return db[_0x35fc('0x2f')][_0x35fc('0x46')](_0x52acc5);})['then'](function(_0x596e83){_0x16f067[_0x35fc('0x47')]=_0x596e83;return _0x16f067;})[_0x35fc('0x26')](respondWithFilteredResult(_0x22af18,_0x52acc5))['catch'](handleError(_0x22af18,null));};exports['show']=function(_0x4ff202,_0x79677d){var _0x10f98b={'raw':!![],'where':{'id':_0x4ff202[_0x35fc('0x48')]['id']}},_0x4e56ed={};_0x4e56ed[_0x35fc('0x38')]=_[_0x35fc('0x34')](db[_0x35fc('0x2f')]['rawAttributes']);_0x4e56ed['query']=_['keys'](_0x4ff202['query']);_0x4e56ed['filters']=_[_0x35fc('0x37')](_0x4e56ed[_0x35fc('0x38')],_0x4e56ed['query']);_0x10f98b[_0x35fc('0x3a')]=_['intersection'](_0x4e56ed[_0x35fc('0x38')],qs[_0x35fc('0x39')](_0x4ff202[_0x35fc('0x35')][_0x35fc('0x39')]));_0x10f98b[_0x35fc('0x3a')]=_0x10f98b['attributes'][_0x35fc('0x3b')]?_0x10f98b[_0x35fc('0x3a')]:_0x4e56ed['model'];if(_0x4ff202[_0x35fc('0x35')][_0x35fc('0x44')]){_0x10f98b[_0x35fc('0x45')]=[{'all':!![]}];}_0x10f98b=_[_0x35fc('0x40')]({},_0x10f98b,_0x4ff202['options']);return db[_0x35fc('0x2f')]['find'](_0x10f98b)['then'](handleEntityNotFound(_0x79677d,null))[_0x35fc('0x26')](respondWithResult(_0x79677d,null))[_0x35fc('0x49')](handleError(_0x79677d,null));};exports[_0x35fc('0x4a')]=function(_0xca8aef,_0xf2ca20){return db[_0x35fc('0x2f')][_0x35fc('0x4a')](_0xca8aef[_0x35fc('0x4b')],{})['then'](function(_0x3e2961){var _0x91d7c0=_0xca8aef[_0x35fc('0x4c')][_0x35fc('0x27')]({'plain':!![]});if(!_0x91d7c0)throw new Error(_0x35fc('0x4d'));if(_0x91d7c0[_0x35fc('0x4e')]===_0x35fc('0x4c')){var _0x347a4a=_0x3e2961[_0x35fc('0x27')]({'plain':!![]});var _0xe6eb6a=_0x35fc('0x4f');return db[_0x35fc('0x50')][_0x35fc('0x51')]({'where':{'name':_0xe6eb6a,'userProfileId':_0x91d7c0[_0x35fc('0x52')]},'raw':!![]})['then'](function(_0x553ed6){if(_0x553ed6&&_0x553ed6[_0x35fc('0x53')]===0x0){return db[_0x35fc('0x54')][_0x35fc('0x4a')]({'name':_0x347a4a[_0x35fc('0x2c')],'resourceId':_0x347a4a['id'],'type':_0x35fc('0x28'),'sectionId':_0x553ed6['id']},{})[_0x35fc('0x26')](function(){return _0x3e2961;});}else{return _0x3e2961;}})['catch'](function(_0x4f024c){logger[_0x35fc('0x2a')](_0x35fc('0x55'),_0x4f024c);throw _0x4f024c;});}return _0x3e2961;})[_0x35fc('0x26')](respondWithResult(_0xf2ca20,0xc9))[_0x35fc('0x49')](handleError(_0xf2ca20,null));};exports['update']=function(_0x467980,_0x13281f){if(_0x467980['body']['id']){delete _0x467980[_0x35fc('0x4b')]['id'];}return db[_0x35fc('0x2f')]['find']({'where':{'id':_0x467980[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x13281f,null))[_0x35fc('0x26')](saveUpdates(_0x467980[_0x35fc('0x4b')],null))['then'](respondWithResult(_0x13281f,null))['catch'](handleError(_0x13281f,null));};exports['destroy']=function(_0x240338,_0x2ea8d6){return db['AnalyticDefaultReport'][_0x35fc('0x51')]({'where':{'id':_0x240338[_0x35fc('0x48')]['id']}})[_0x35fc('0x26')](handleEntityNotFound(_0x2ea8d6,null))[_0x35fc('0x26')](removeEntity(_0x2ea8d6,null))[_0x35fc('0x49')](handleError(_0x2ea8d6,null));};exports['preview']=function(_0x2d9d45,_0x757aa6){var _0x39d470=0xa;var _0x509e77=[_0x35fc('0x56'),_0x35fc('0x57'),'right_join',_0x35fc('0x58')];var _0x164c7b={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x303927={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23b54f=function(_0xb1c68a){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xb1c68a);};var _0x5353ea=function(_0x4faef4){if(!_0x4faef4||!_0x4faef4['rules'][_0x35fc('0x3b')]){return'';}for(var _0x44250b='(',_0xd470e8=0x0;_0xd470e8<_0x4faef4[_0x35fc('0x65')]['length'];_0xd470e8+=0x1){_0xd470e8>0x0&&(_0x44250b+='\x20'+_0x4faef4[_0x35fc('0x66')]+'\x20');_0x44250b+=_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]?_0x5353ea(_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x67')]):_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x68')]+'\x20'+_0x4faef4[_0x35fc('0x65')][_0xd470e8][_0x35fc('0x69')]+(_0x23b54f(_0x4faef4['rules'][_0xd470e8][_0x35fc('0x69')])?'\x20'+_0x4faef4['rules'][_0xd470e8][_0x35fc('0x6a')]:'');}return _0x44250b+')';};var _0x9029e3={'where':{'id':_0x2d9d45['params']['id']}},_0x2ac8e1,_0x2bc76c,_0x4bdde7,_0x465c14,_0x4af592;_0x9029e3=_['merge']({},_0x9029e3,_0x2d9d45[_0x35fc('0x43')]);return db['AnalyticDefaultReport'][_0x35fc('0x51')](_0x9029e3)['then'](function(_0x11717){if(_0x11717){_0x2ac8e1=_0x11717;return _0x11717['getFields']();}return null;})[_0x35fc('0x26')](function(_0x455b84){if(_0x455b84){if(!_0x455b84[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))]['ValidationErrorItem'](_0x35fc('0x6c'),0x193);}_0x2bc76c=_0x455b84;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3aa7fa){if(_0x3aa7fa){_0x4bdde7=_[_0x35fc('0x6e')](_0x3aa7fa,'id');var _0x37764b;var _0x3c1b56=squel[_0x35fc('0x6f')]();_0x3c1b56[_0x35fc('0x70')](_0x2ac8e1[_0x35fc('0x71')]);for(var _0x4464d5=0x0;_0x4464d5<_0x2bc76c['length'];_0x4464d5+=0x1){_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x72')]?_0x4bdde7[_0x2bc76c[_0x4464d5][_0x35fc('0x72')]][_0x35fc('0x73')]:_0x2bc76c[_0x4464d5]['field'];_0x37764b=_0x2bc76c[_0x4464d5][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x164c7b[_0x2bc76c[_0x4464d5]['function']],'%s',_0x37764b):_0x37764b;_0x37764b=_0x2bc76c[_0x4464d5]['format']?_[_0x35fc('0x75')](_0x303927[_0x2bc76c[_0x4464d5]['format']],'%s',_0x37764b):_0x37764b;if(_0x2bc76c[_0x4464d5][_0x35fc('0x76')]){_0x3c1b56[_0x35fc('0x67')](_0x37764b);}_0x2bc76c[_0x4464d5][_0x35fc('0x77')]&&_0x3c1b56[_0x35fc('0x78')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x77')]===_0x35fc('0x79')?![]:!![]);_0x3c1b56[_0x35fc('0x68')](_0x37764b,_0x2bc76c[_0x4464d5][_0x35fc('0x7a')]||_0x37764b);}if(_0x2ac8e1[_0x35fc('0x7b')]){_0x2ac8e1[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x2ac8e1[_0x35fc('0x7b')]);for(var _0x29f2b9=0x0;_0x29f2b9<_0x2ac8e1[_0x35fc('0x7b')][_0x35fc('0x3b')];_0x29f2b9+=0x1){if(_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]&&_[_0x35fc('0x62')](_0x509e77,_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')])&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7d')]&&_0x2ac8e1['joins'][_0x29f2b9][_0x35fc('0x7e')]&&_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]){_0x3c1b56[_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x32')]](_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],null,util[_0x35fc('0x80')](_0x35fc('0x81'),_0x2ac8e1[_0x35fc('0x71')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9]['parentKey'],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7e')],_0x2ac8e1[_0x35fc('0x7b')][_0x29f2b9][_0x35fc('0x7f')]));}}}if(_0x2ac8e1[_0x35fc('0x82')]){_0x2ac8e1[_0x35fc('0x82')]=JSON['parse'](_0x2ac8e1[_0x35fc('0x82')]);_0x3c1b56[_0x35fc('0x3e')](_0x5353ea(_0x2ac8e1[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x4af592=_0x3c1b56[_0x35fc('0x83')]();_0x3c1b56[_0x35fc('0x1d')](_0x39d470);_0x3c1b56[_0x35fc('0x1c')](0x0);logger[_0x35fc('0x84')](_0x35fc('0x85'),_0x3c1b56['toString']());return dbH[_0x35fc('0x86')]['query'](_0x3c1b56[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')]['QueryTypes'][_0x35fc('0x88')]});}})[_0x35fc('0x26')](respondWithResult(_0x757aa6,null))[_0x35fc('0x49')](handleError(_0x757aa6,null));};function runReport(_0x4274d6,_0x4026cc,_0x1a765f){var _0x42f87e=_0x4026cc[_0x35fc('0x2c')];var _0x25ee61=0xa;var _0x5806bf=['join','left_join','right_join',_0x35fc('0x58')];var _0x23cf84={'SUM':_0x35fc('0x59'),'COUNT':_0x35fc('0x5a'),'COUNT DISTINCT':_0x35fc('0x5b'),'MAX':'MAX(%s)','MIN':_0x35fc('0x5d'),'AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x15e936={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x319033=function(_0x9fe765){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x9fe765);};var _0x2faff7=function(_0xa2c5f8){if(!_0xa2c5f8||!_0xa2c5f8[_0x35fc('0x65')][_0x35fc('0x3b')]){return'';}for(var _0x221c5b='(',_0x1fcd36=0x0;_0x1fcd36<_0xa2c5f8['rules'][_0x35fc('0x3b')];_0x1fcd36+=0x1){_0x1fcd36>0x0&&(_0x221c5b+='\x20'+_0xa2c5f8['operator']+'\x20');_0x221c5b+=_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]?_0x2faff7(_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x67')]):_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x68')]+'\x20'+_0xa2c5f8['rules'][_0x1fcd36][_0x35fc('0x69')]+(_0x319033(_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x69')])?'\x20'+_0xa2c5f8[_0x35fc('0x65')][_0x1fcd36][_0x35fc('0x6a')]:'');}return _0x221c5b+')';};var _0x5abdf9={'where':{'id':_0x4274d6['id']}},_0x5512f6,_0x487cb5,_0x23b261,_0x4c742c,_0x2fae26;_0x5abdf9=_[_0x35fc('0x40')]({},_0x5abdf9,_0x1a765f);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x5abdf9)['then'](function(_0x28e80d){if(_0x28e80d){_0x5512f6=_0x28e80d;return _0x28e80d[_0x35fc('0x8e')]();}return null;})[_0x35fc('0x26')](function(_0x47c507){if(_0x47c507){if(!_0x47c507[_0x35fc('0x3b')]){throw new db[(_0x35fc('0x6b'))][(_0x35fc('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x487cb5=_0x47c507;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x2edb1b){if(_0x2edb1b){_0x23b261=_[_0x35fc('0x6e')](_0x2edb1b,'id');var _0x3858a9;var _0x4859be=squel[_0x35fc('0x6f')]();_0x4859be[_0x35fc('0x70')](_0x5512f6['table']);for(var _0x5849a0=0x0;_0x5849a0<_0x487cb5[_0x35fc('0x3b')];_0x5849a0+=0x1){_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x72')]?_0x23b261[_0x487cb5[_0x5849a0][_0x35fc('0x72')]]['metric']:_0x487cb5[_0x5849a0]['field'];_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0x23cf84[_0x487cb5[_0x5849a0]['function']],'%s',_0x3858a9):_0x3858a9;_0x3858a9=_0x487cb5[_0x5849a0][_0x35fc('0x80')]?_[_0x35fc('0x75')](_0x15e936[_0x487cb5[_0x5849a0][_0x35fc('0x80')]],'%s',_0x3858a9):_0x3858a9;if(_0x487cb5[_0x5849a0]['groupBy']){_0x4859be[_0x35fc('0x67')](_0x3858a9);}_0x487cb5[_0x5849a0][_0x35fc('0x77')]&&_0x4859be[_0x35fc('0x78')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x77')]==='DESC'?![]:!![]);_0x4859be[_0x35fc('0x68')](_0x3858a9,_0x487cb5[_0x5849a0][_0x35fc('0x7a')]||_0x3858a9);}if(_0x5512f6[_0x35fc('0x7b')]){_0x5512f6['joins']=JSON[_0x35fc('0x7c')](_0x5512f6[_0x35fc('0x7b')]);for(var _0x425f72=0x0;_0x425f72<_0x5512f6['joins'][_0x35fc('0x3b')];_0x425f72+=0x1){if(_0x5512f6[_0x35fc('0x7b')][_0x425f72]['type']&&_[_0x35fc('0x62')](_0x5806bf,_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x32')])&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')]&&_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]){_0x4859be[_0x5512f6['joins'][_0x425f72][_0x35fc('0x32')]](_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],null,util[_0x35fc('0x80')]('%s.%s\x20=\x20%s.%s',_0x5512f6[_0x35fc('0x71')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7d')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7e')],_0x5512f6[_0x35fc('0x7b')][_0x425f72][_0x35fc('0x7f')]));}}}if(_0x5512f6[_0x35fc('0x82')]){_0x5512f6['conditions']=JSON['parse'](_0x5512f6[_0x35fc('0x82')]);_0x4859be[_0x35fc('0x3e')](_0x2faff7(_0x5512f6[_0x35fc('0x82')]['group']));}_0x2fae26=_0x4859be[_0x35fc('0x83')]();_0x4859be[_0x35fc('0x1d')](_0x25ee61);_0x4859be[_0x35fc('0x1c')](0x0);return;}})[_0x35fc('0x26')](function(){if(_0x4026cc['output']==='web'){return null;}var _0x379650=_['merge'](_0x4026cc,{'name':_0x4026cc[_0x35fc('0x90')]||_0x4026cc[_0x35fc('0x2c')]||_0x5512f6['name'],'basename':_0x42f87e,'savename':util['format'](_0x35fc('0x91'),_0x4026cc[_0x35fc('0x2c')]||_0x5512f6[_0x35fc('0x2c')],require('randomstring')[_0x35fc('0x92')](0x4),_0x4026cc[_0x35fc('0x93')]||_0x35fc('0x94')),'reportId':_0x5512f6['id'],'reportType':'default'});return db[_0x35fc('0x95')][_0x35fc('0x4a')](_0x379650,{'raw':!![]});})[_0x35fc('0x26')](function(_0x328e90){if(_0x5512f6['table']===_0x35fc('0x96')){_0x2fae26[_0x35fc('0x3e')](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x97'),_0x4026cc[_0x35fc('0x98')],_0x4026cc[_0x35fc('0x99')]);}else{_0x2fae26['where'](_0x5512f6[_0x35fc('0x71')]+_0x35fc('0x9a'),_0x4026cc['startDate'],_0x4026cc[_0x35fc('0x99')]);}if(_0x328e90){logger[_0x35fc('0x9b')]('Run\x20Query:',_0x2fae26[_0x35fc('0x87')]());require(_0x35fc('0x9c'))[_0x35fc('0x9d')](path[_0x35fc('0x56')](__dirname,_0x35fc('0x9e'),_0x328e90['output']),[_0x328e90['id'],_0x2fae26[_0x35fc('0x87')](),path[_0x35fc('0x56')](__dirname,_0x35fc('0x9f'),_0x328e90['savename']),_0x42f87e]);return _0x328e90;}else{var _0x1224cd=squel['select']();_0x1224cd['from']('('+_0x2fae26[_0x35fc('0x87')]()+')',_0x35fc('0xa0'));_0x1224cd[_0x35fc('0x68')](_0x35fc('0xa1'),_0x35fc('0x1f'));_0x2fae26['limit'](_0x4026cc[_0x35fc('0x1d')]||_0x25ee61);_0x2fae26[_0x35fc('0x1c')](_0x4026cc[_0x35fc('0x1c')]||0x0);return dbH['sequelize'][_0x35fc('0x35')](_0x1224cd[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]})['then'](function(_0x1a2d73){if(!_0x1a2d73[_0x35fc('0x3b')]){_0x4c742c=0x0;}else{_0x4c742c=_0x1a2d73[0x0]['count']||0x0;}return dbH['sequelize'][_0x35fc('0x35')](_0x2fae26[_0x35fc('0x87')](),{'type':dbH[_0x35fc('0x86')][_0x35fc('0xa2')][_0x35fc('0x88')]});})[_0x35fc('0x26')](function(_0x8c80ca){return{'rows':_0x8c80ca||[],'count':_0x4c742c};});}});}exports['run']=function(_0x5dc286,_0x146ce1){return runReport(_0x5dc286[_0x35fc('0x48')],_0x5dc286[_0x35fc('0x35')],_0x5dc286[_0x35fc('0x43')])[_0x35fc('0x26')](respondWithResult(_0x146ce1,null))['catch'](handleError(_0x146ce1,null));};exports['runReport']=runReport;exports[_0x35fc('0x35')]=function(_0x2451f2,_0x3fff79){var _0x1c6ce9=0xa;var _0x4b2079=['join',_0x35fc('0x57'),_0x35fc('0xa3'),_0x35fc('0x58')];var _0xd46d64={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x35fc('0x5b'),'MAX':_0x35fc('0x5c'),'MIN':'MIN(%s)','AVG':_0x35fc('0x5e'),'GROUP_CONCAT':_0x35fc('0x89'),'GROUP_CONCAT ASC':_0x35fc('0x5f'),'GROUP_CONCAT DESC':_0x35fc('0x60')};var _0x274337={'SEC_TO_TIME':_0x35fc('0x8a'),'DATE':_0x35fc('0x61'),'HOUR':_0x35fc('0xa4'),'ROUND':_0x35fc('0x8b'),'UNIX_TIMESTAMP':_0x35fc('0x8c')};var _0x19ae76=function(_0x366a3b){return!_[_0x35fc('0x62')]([_0x35fc('0x63'),_0x35fc('0x64'),_0x35fc('0x8d'),'IS\x20NOT\x20EMPTY'],_0x366a3b);};var _0x345026=function(_0x553f7d){if(!_0x553f7d||!_0x553f7d[_0x35fc('0x65')]['length']){return'';}for(var _0x5aa072='(',_0x3c96ef=0x0;_0x3c96ef<_0x553f7d[_0x35fc('0x65')][_0x35fc('0x3b')];_0x3c96ef+=0x1){_0x3c96ef>0x0&&(_0x5aa072+='\x20'+_0x553f7d['operator']+'\x20');_0x5aa072+=_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]?_0x345026(_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x67')]):_0x553f7d[_0x35fc('0x65')][_0x3c96ef][_0x35fc('0x68')]+'\x20'+_0x553f7d['rules'][_0x3c96ef]['condition']+(_0x19ae76(_0x553f7d[_0x35fc('0x65')][_0x3c96ef]['condition'])?'\x20'+_0x553f7d['rules'][_0x3c96ef][_0x35fc('0x6a')]:'');}return _0x5aa072+')';};var _0x48b826={'where':{'id':_0x2451f2[_0x35fc('0x48')]['id']}},_0x556f9a,_0x5ae83f,_0x450769,_0x5d461c,_0x355154;_0x48b826=_[_0x35fc('0x40')]({},_0x48b826,_0x2451f2[_0x35fc('0x43')]);return db[_0x35fc('0x2f')][_0x35fc('0x51')](_0x48b826)['then'](function(_0x522ff2){if(_0x522ff2){_0x556f9a=_0x522ff2;return _0x522ff2[_0x35fc('0x8e')]();}return null;})['then'](function(_0x233c94){if(_0x233c94){if(!_0x233c94[_0x35fc('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5ae83f=_0x233c94;return db[_0x35fc('0x6d')][_0x35fc('0x46')]({'raw':!![]});}return null;})[_0x35fc('0x26')](function(_0x135e18){if(_0x135e18){_0x450769=_[_0x35fc('0x6e')](_0x135e18,'id');var _0x28525f;var _0x9116b1=squel[_0x35fc('0x6f')]();_0x9116b1['from'](_0x556f9a['table']);for(var _0x5cefdb=0x0;_0x5cefdb<_0x5ae83f['length'];_0x5cefdb+=0x1){_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x72')]?_0x450769[_0x5ae83f[_0x5cefdb]['MetricId']][_0x35fc('0x73')]:_0x5ae83f[_0x5cefdb]['field'];_0x28525f=_0x5ae83f[_0x5cefdb][_0x35fc('0x74')]?_[_0x35fc('0x75')](_0xd46d64[_0x5ae83f[_0x5cefdb]['function']],'%s',_0x28525f):_0x28525f;_0x28525f=_0x5ae83f[_0x5cefdb]['format']?_[_0x35fc('0x75')](_0x274337[_0x5ae83f[_0x5cefdb][_0x35fc('0x80')]],'%s',_0x28525f):_0x28525f;if(_0x5ae83f[_0x5cefdb][_0x35fc('0x76')]){_0x9116b1[_0x35fc('0x67')](_0x28525f);}_0x5ae83f[_0x5cefdb][_0x35fc('0x77')]&&_0x9116b1['order'](_0x28525f,_0x5ae83f[_0x5cefdb]['orderBy']===_0x35fc('0x79')?![]:!![]);_0x9116b1['field'](_0x28525f,_0x5ae83f[_0x5cefdb][_0x35fc('0x7a')]||_0x28525f);}if(_0x556f9a['joins']){_0x556f9a[_0x35fc('0x7b')]=JSON[_0x35fc('0x7c')](_0x556f9a[_0x35fc('0x7b')]);for(var _0x10e30e=0x0;_0x10e30e<_0x556f9a['joins'][_0x35fc('0x3b')];_0x10e30e+=0x1){if(_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')]&&_['includes'](_0x4b2079,_0x556f9a['joins'][_0x10e30e][_0x35fc('0x32')])&&_0x556f9a['joins'][_0x10e30e][_0x35fc('0x7d')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')]&&_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]){_0x9116b1[_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x32')]](_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],null,util['format'](_0x35fc('0x81'),_0x556f9a[_0x35fc('0x71')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7d')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7e')],_0x556f9a[_0x35fc('0x7b')][_0x10e30e][_0x35fc('0x7f')]));}}}if(_0x556f9a['conditions']){_0x556f9a['conditions']=JSON['parse'](_0x556f9a['conditions']);_0x9116b1['where'](_0x345026(_0x556f9a[_0x35fc('0x82')][_0x35fc('0x67')]));}_0x355154=_0x9116b1[_0x35fc('0x83')]();_0x9116b1[_0x35fc('0x1d')](_0x1c6ce9);_0x9116b1[_0x35fc('0x1c')](0x0);logger['debug'](_0x35fc('0x85'),_0x9116b1[_0x35fc('0x87')]());return dbH[_0x35fc('0x86')][_0x35fc('0x35')](_0x9116b1[_0x35fc('0x87')](),{'type':dbH['sequelize'][_0x35fc('0xa2')][_0x35fc('0x88')]});}})[_0x35fc('0x26')](function(){return{'sql':_0x355154['toString']()};})[_0x35fc('0x26')](respondWithResult(_0x3fff79,null))[_0x35fc('0x49')](handleError(_0x3fff79,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index badca95..aaa18f0 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 _0x1381=['api','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1381,0xbd));var _0x1138=function(_0x3e5df4,_0x2c4d65){_0x3e5df4=_0x3e5df4-0x0;var _0x176426=_0x1381[_0x3e5df4];return _0x176426;};'use strict';var _=require(_0x1138('0x0'));var util=require(_0x1138('0x1'));var logger=require(_0x1138('0x2'))(_0x1138('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1138('0x4'));var rimraf=require(_0x1138('0x5'));var config=require(_0x1138('0x6'));var attributes=require(_0x1138('0x7'));module[_0x1138('0x8')]=function(_0x1fa38d,_0x2ba82c){return _0x1fa38d[_0x1138('0x9')](_0x1138('0xa'),attributes,{'tableName':_0x1138('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77b7=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x50c566,_0x1eb6db){var _0x3409d0=function(_0x57225b){while(--_0x57225b){_0x50c566['push'](_0x50c566['shift']());}};_0x3409d0(++_0x1eb6db);}(_0x77b7,0x96));var _0x777b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x77b7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x777b('0x0'));var util=require(_0x777b('0x1'));var logger=require(_0x777b('0x2'))(_0x777b('0x3'));var moment=require(_0x777b('0x4'));var BPromise=require(_0x777b('0x5'));var rp=require(_0x777b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x777b('0x7'));var config=require(_0x777b('0x8'));var attributes=require(_0x777b('0x9'));module[_0x777b('0xa')]=function(_0x462918,_0x2cfbb0){return _0x462918[_0x777b('0xb')](_0x777b('0xc'),attributes,{'tableName':_0x777b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a184edb..6ada0fd 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 _0x6452=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x6452,0x114));var _0x2645=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0x6452[_0x263f9d];return _0x4c4efa;};'use strict';var _=require(_0x2645('0x0'));var util=require('util');var moment=require(_0x2645('0x1'));var BPromise=require(_0x2645('0x2'));var rs=require(_0x2645('0x3'));var fs=require('fs');var Redis=require(_0x2645('0x4'));var db=require(_0x2645('0x5'))['db'];var utils=require(_0x2645('0x6'));var logger=require(_0x2645('0x7'))('rpc');var config=require(_0x2645('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2645('0x9')][_0x2645('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x424ed6,_0x41bb35,_0x2a6903){return new BPromise(function(_0x113e37,_0x20c92d){return client[_0x2645('0xb')](_0x424ed6,_0x2a6903)[_0x2645('0xc')](function(_0x4196e1){logger[_0x2645('0xd')](_0x2645('0xe'),_0x41bb35,'request\x20sent');logger[_0x2645('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x41bb35,'request\x20sent',JSON['stringify'](_0x4196e1));if(_0x4196e1[_0x2645('0x10')]){if(_0x4196e1['error'][_0x2645('0x11')]===0x1f4){logger[_0x2645('0x10')](_0x2645('0xe'),_0x41bb35,_0x4196e1[_0x2645('0x10')]['message']);return _0x20c92d(_0x4196e1[_0x2645('0x10')][_0x2645('0x12')]);}logger['error'](_0x2645('0xe'),_0x41bb35,_0x4196e1[_0x2645('0x10')][_0x2645('0x12')]);return _0x113e37(_0x4196e1['error'][_0x2645('0x12')]);}else{logger[_0x2645('0xd')](_0x2645('0xe'),_0x41bb35,'request\x20sent');_0x113e37(_0x4196e1[_0x2645('0x13')]['message']);}})[_0x2645('0x14')](function(_0x433ca2){logger['error'](_0x2645('0xe'),_0x41bb35,_0x433ca2);_0x20c92d(_0x433ca2);});});} \ No newline at end of file +var _0x9ecf=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','code','error','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x1f00a1,_0x479a2d){var _0x343eb4=function(_0x27a99a){while(--_0x27a99a){_0x1f00a1['push'](_0x1f00a1['shift']());}};_0x343eb4(++_0x479a2d);}(_0x9ecf,0xf3));var _0xf9ec=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0x9ecf[_0x385467];return _0x5ed67e;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var moment=require(_0xf9ec('0x2'));var BPromise=require(_0xf9ec('0x3'));var rs=require(_0xf9ec('0x4'));var fs=require('fs');var Redis=require(_0xf9ec('0x5'));var db=require(_0xf9ec('0x6'))['db'];var utils=require(_0xf9ec('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf9ec('0x8'));var jayson=require(_0xf9ec('0x9'));var client=jayson[_0xf9ec('0xa')][_0xf9ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45c38f,_0x47a960,_0x99e7b7){return new BPromise(function(_0x2259e1,_0x382e40){return client[_0xf9ec('0xc')](_0x45c38f,_0x99e7b7)[_0xf9ec('0xd')](function(_0x253d84){logger[_0xf9ec('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x47a960,_0xf9ec('0xf'));logger[_0xf9ec('0x10')](_0xf9ec('0x11'),_0x47a960,_0xf9ec('0xf'),JSON['stringify'](_0x253d84));if(_0x253d84['error']){if(_0x253d84['error'][_0xf9ec('0x12')]===0x1f4){logger[_0xf9ec('0x13')](_0xf9ec('0x14'),_0x47a960,_0x253d84[_0xf9ec('0x13')]['message']);return _0x382e40(_0x253d84[_0xf9ec('0x13')][_0xf9ec('0x15')]);}logger[_0xf9ec('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x47a960,_0x253d84[_0xf9ec('0x13')]['message']);return _0x2259e1(_0x253d84[_0xf9ec('0x13')]['message']);}else{logger[_0xf9ec('0xe')](_0xf9ec('0x14'),_0x47a960,'request\x20sent');_0x2259e1(_0x253d84[_0xf9ec('0x16')][_0xf9ec('0x15')]);}})[_0xf9ec('0x17')](function(_0x59b45e){logger[_0xf9ec('0x13')](_0xf9ec('0x14'),_0x47a960,_0x59b45e);_0x382e40(_0x59b45e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2f10a72..57de92b 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 _0xefc9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports'];(function(_0x4c0269,_0x361697){var _0xf38bbf=function(_0x579638){while(--_0x579638){_0x4c0269['push'](_0x4c0269['shift']());}};_0xf38bbf(++_0x361697);}(_0xefc9,0x170));var _0x9efc=function(_0x4a5859,_0x5c26f2){_0x4a5859=_0x4a5859-0x0;var _0x1d11d2=_0xefc9[_0x4a5859];return _0x1d11d2;};'use strict';var multer=require(_0x9efc('0x0'));var util=require(_0x9efc('0x1'));var path=require(_0x9efc('0x2'));var timeout=require(_0x9efc('0x3'));var express=require(_0x9efc('0x4'));var router=express[_0x9efc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9efc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x9efc('0x7')]('/',auth['isAuthenticated'](),controller[_0x9efc('0x8')]);router['get'](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0xb')]);router[_0x9efc('0x7')](_0x9efc('0xc'),auth['isAuthenticated'](),controller[_0x9efc('0xd')]);router['get'](_0x9efc('0xe'),auth[_0x9efc('0xa')](),controller[_0x9efc('0xf')]);router[_0x9efc('0x7')](_0x9efc('0x10'),auth['isAuthenticated'](),controller[_0x9efc('0x11')]);router['post']('/',auth[_0x9efc('0xa')](),controller['create']);router[_0x9efc('0x12')](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0x13')]);router[_0x9efc('0x14')](_0x9efc('0x9'),auth[_0x9efc('0xa')](),controller[_0x9efc('0x15')]);module[_0x9efc('0x16')]=router; \ No newline at end of file +var _0xb9f8=['path','connect-timeout','express','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id/preview','/:id/run','/:id/query','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x564311,_0x1ab783){var _0x406daa=function(_0x4633f1){while(--_0x4633f1){_0x564311['push'](_0x564311['shift']());}};_0x406daa(++_0x1ab783);}(_0xb9f8,0x1e2));var _0x8b9f=function(_0x1f6aea,_0x1a98b2){_0x1f6aea=_0x1f6aea-0x0;var _0x518896=_0xb9f8[_0x1f6aea];return _0x518896;};'use strict';var multer=require(_0x8b9f('0x0'));var util=require(_0x8b9f('0x1'));var path=require(_0x8b9f('0x2'));var timeout=require(_0x8b9f('0x3'));var express=require(_0x8b9f('0x4'));var router=express['Router']();var fs_extra=require(_0x8b9f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b9f('0x6'));var controller=require(_0x8b9f('0x7'));router[_0x8b9f('0x8')]('/',auth[_0x8b9f('0x9')](),controller[_0x8b9f('0xa')]);router[_0x8b9f('0x8')]('/:id',auth[_0x8b9f('0x9')](),controller['show']);router[_0x8b9f('0x8')](_0x8b9f('0xb'),auth[_0x8b9f('0x9')](),controller['preview']);router[_0x8b9f('0x8')](_0x8b9f('0xc'),auth['isAuthenticated'](),controller['run']);router[_0x8b9f('0x8')](_0x8b9f('0xd'),auth['isAuthenticated'](),controller['query']);router[_0x8b9f('0xe')]('/',auth['isAuthenticated'](),controller[_0x8b9f('0xf')]);router[_0x8b9f('0x10')](_0x8b9f('0x11'),auth['isAuthenticated'](),controller[_0x8b9f('0x12')]);router[_0x8b9f('0x13')]('/:id',auth[_0x8b9f('0x9')](),controller[_0x8b9f('0x14')]);module[_0x8b9f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 0d32c5b..5303060 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 _0xfdc1=['STRING','csv','DATE','Loading','ENUM','scheduled','manual','INTEGER','sequelize','moment'];(function(_0x28f160,_0x5c3761){var _0x42092a=function(_0x4e342d){while(--_0x4e342d){_0x28f160['push'](_0x28f160['shift']());}};_0x42092a(++_0x5c3761);}(_0xfdc1,0x166));var _0x1fdc=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xfdc1[_0x2d8d69];return _0x39ae22;};'use strict';var Sequelize=require(_0x1fdc('0x0'));var moment=require(_0x1fdc('0x1'));module['exports']={'name':{'type':Sequelize[_0x1fdc('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf','xlsx'),'allowNull':![],'defaultValue':_0x1fdc('0x3')},'savename':{'type':Sequelize[_0x1fdc('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1fdc('0x4')]},'endDate':{'type':Sequelize[_0x1fdc('0x4')]},'status':{'type':Sequelize[_0x1fdc('0x2')],'defaultValue':_0x1fdc('0x5')},'type':{'type':Sequelize[_0x1fdc('0x6')]('manual',_0x1fdc('0x7')),'allowNull':![],'defaultValue':_0x1fdc('0x8')},'reportId':{'type':Sequelize[_0x1fdc('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1fdc('0x2')]}}; \ No newline at end of file +var _0x37e8=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x37e8,0x19f));var _0x837e=function(_0x275843,_0x100e83){_0x275843=_0x275843-0x0;var _0x2cf47e=_0x37e8[_0x275843];return _0x2cf47e;};'use strict';var Sequelize=require(_0x837e('0x0'));var moment=require('moment');module[_0x837e('0x1')]={'name':{'type':Sequelize[_0x837e('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x837e('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x837e('0x3')](_0x837e('0x4'),_0x837e('0x5'),_0x837e('0x6')),'allowNull':![],'defaultValue':_0x837e('0x4')},'savename':{'type':Sequelize[_0x837e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x837e('0x7')]},'endDate':{'type':Sequelize[_0x837e('0x7')]},'status':{'type':Sequelize[_0x837e('0x2')],'defaultValue':_0x837e('0x8')},'type':{'type':Sequelize[_0x837e('0x3')](_0x837e('0x9'),_0x837e('0xa')),'allowNull':![],'defaultValue':_0x837e('0x9')},'reportId':{'type':Sequelize[_0x837e('0xb')](0xb)[_0x837e('0xc')]},'reportType':{'type':Sequelize[_0x837e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f73f8e9..109a07d 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 _0x2819=['ExtractedReports','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','findAll','params','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','basename','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','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','undefined','limit','count','offset','set','apply','then','destroy'];(function(_0x50aee6,_0x4cb5d7){var _0x30b530=function(_0x424aab){while(--_0x424aab){_0x50aee6['push'](_0x50aee6['shift']());}};_0x30b530(++_0x4cb5d7);}(_0x2819,0x14f));var _0x9281=function(_0xd9be0a,_0xa8dc94){_0xd9be0a=_0xd9be0a-0x0;var _0x2ecd86=_0x2819[_0xd9be0a];return _0x2ecd86;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9281('0x0'));var jsonpatch=require(_0x9281('0x1'));var rp=require(_0x9281('0x2'));var moment=require(_0x9281('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9281('0x4'));var util=require(_0x9281('0x5'));var path=require(_0x9281('0x6'));var sox=require(_0x9281('0x7'));var csv=require(_0x9281('0x8'));var ejs=require(_0x9281('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9281('0xa'));var squel=require(_0x9281('0xb'));var crypto=require(_0x9281('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9281('0xd'));var toCsv=require(_0x9281('0x8'));var querystring=require(_0x9281('0xe'));var Papa=require('papaparse');var Redis=require(_0x9281('0xf'));var authService=require(_0x9281('0x10'));var qs=require(_0x9281('0x11'));var as=require(_0x9281('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9281('0x13'))(_0x9281('0x14'));var utils=require(_0x9281('0x15'));var config=require(_0x9281('0x16'));var licenseUtil=require(_0x9281('0x17'));var db=require(_0x9281('0x18'))['db'];function respondWithStatusCode(_0x26e0a5,_0x1e16b5){_0x1e16b5=_0x1e16b5||0xcc;return function(_0x5e5a2f){if(_0x5e5a2f){return _0x26e0a5[_0x9281('0x19')](_0x1e16b5);}return _0x26e0a5[_0x9281('0x1a')](_0x1e16b5)[_0x9281('0x1b')]();};}function respondWithResult(_0x1b49ce,_0x1728c4){_0x1728c4=_0x1728c4||0xc8;return function(_0x4126f9){if(_0x4126f9){return _0x1b49ce[_0x9281('0x1a')](_0x1728c4)[_0x9281('0x1c')](_0x4126f9);}};}function respondWithFilteredResult(_0x2c3eb8,_0x4cc7b0){return function(_0xe74414){if(_0xe74414){var _0x26c4c2=typeof _0x4cc7b0['offset']===_0x9281('0x1d')&&typeof _0x4cc7b0[_0x9281('0x1e')]==='undefined';var _0x184964=_0xe74414[_0x9281('0x1f')];var _0x126cc4=_0x26c4c2?0x0:_0x4cc7b0[_0x9281('0x20')];var _0x121cd4=_0x26c4c2?_0xe74414['count']:_0x4cc7b0[_0x9281('0x20')]+_0x4cc7b0['limit'];var _0x46df0c;if(_0x121cd4>=_0x184964){_0x121cd4=_0x184964;_0x46df0c=0xc8;}else{_0x46df0c=0xce;}_0x2c3eb8[_0x9281('0x1a')](_0x46df0c);return _0x2c3eb8[_0x9281('0x21')]('Content-Range',_0x126cc4+'-'+_0x121cd4+'/'+_0x184964)[_0x9281('0x1c')](_0xe74414);}return null;};}function patchUpdates(_0x38932e){return function(_0x1cc89e){try{jsonpatch[_0x9281('0x22')](_0x1cc89e,_0x38932e,!![]);}catch(_0x5820b9){return BPromise['reject'](_0x5820b9);}return _0x1cc89e['save']();};}function saveUpdates(_0x2b1771,_0x3bf9f0){return function(_0xb14ac0){if(_0xb14ac0){return _0xb14ac0['update'](_0x2b1771)[_0x9281('0x23')](function(_0x50596c){return _0x50596c;});}return null;};}function removeEntity(_0x121011,_0xafaa9d){return function(_0x2396c8){if(_0x2396c8){return _0x2396c8[_0x9281('0x24')]()[_0x9281('0x23')](function(){var _0x457428=_0x2396c8['get']({'plain':!![]});var _0x2d7d25=_0x9281('0x25');return db['UserProfileResource'][_0x9281('0x24')]({'where':{'type':_0x2d7d25,'resourceId':_0x457428['id']}})[_0x9281('0x23')](function(){return _0x2396c8;});})[_0x9281('0x23')](function(){_0x121011[_0x9281('0x1a')](0xcc)[_0x9281('0x1b')]();});}};}function handleEntityNotFound(_0x42cbcb,_0x1df6b5){return function(_0x248faf){if(!_0x248faf){_0x42cbcb[_0x9281('0x19')](0x194);}return _0x248faf;};}function handleError(_0xb7162d,_0x287000){_0x287000=_0x287000||0x1f4;return function(_0x421605){logger[_0x9281('0x26')](_0x421605[_0x9281('0x27')]);if(_0x421605[_0x9281('0x28')]){delete _0x421605[_0x9281('0x28')];}_0xb7162d[_0x9281('0x1a')](_0x287000)['send'](_0x421605);};}exports[_0x9281('0x29')]=function(_0x3db566,_0x55dae2){var _0x323fc9={},_0x49d5c9={},_0x39947={'count':0x0,'rows':[]};var _0x25ad25=_['map'](db['AnalyticExtractedReport'][_0x9281('0x2a')],function(_0x14a8f1){return{'name':_0x14a8f1[_0x9281('0x2b')],'type':_0x14a8f1['type'][_0x9281('0x2c')]};});_0x49d5c9[_0x9281('0x2d')]=_[_0x9281('0x2e')](_0x25ad25,'name');_0x49d5c9[_0x9281('0x2f')]=_[_0x9281('0x30')](_0x3db566['query']);_0x49d5c9[_0x9281('0x31')]=_[_0x9281('0x32')](_0x49d5c9[_0x9281('0x2d')],_0x49d5c9['query']);_0x323fc9['attributes']=_['intersection'](_0x49d5c9[_0x9281('0x2d')],qs[_0x9281('0x33')](_0x3db566[_0x9281('0x2f')][_0x9281('0x33')]));_0x323fc9[_0x9281('0x34')]=_0x323fc9[_0x9281('0x34')][_0x9281('0x35')]?_0x323fc9[_0x9281('0x34')]:_0x49d5c9[_0x9281('0x2d')];if(!_0x3db566['query'][_0x9281('0x36')](_0x9281('0x37'))){_0x323fc9[_0x9281('0x1e')]=qs[_0x9281('0x1e')](_0x3db566[_0x9281('0x2f')][_0x9281('0x1e')]);_0x323fc9[_0x9281('0x20')]=qs['offset'](_0x3db566[_0x9281('0x2f')][_0x9281('0x20')]);}_0x323fc9['order']=qs[_0x9281('0x38')](_0x3db566[_0x9281('0x2f')][_0x9281('0x38')]);_0x323fc9[_0x9281('0x39')]=qs['filters'](_[_0x9281('0x3a')](_0x3db566[_0x9281('0x2f')],_0x49d5c9['filters']),_0x25ad25);if(_0x3db566[_0x9281('0x2f')]['filter']){_0x323fc9[_0x9281('0x39')]=_['merge'](_0x323fc9[_0x9281('0x39')],{'$or':_[_0x9281('0x2e')](_0x25ad25,function(_0x36c93e){if(_0x36c93e[_0x9281('0x3b')]!==_0x9281('0x3c')){var _0x3754f0={};_0x3754f0[_0x36c93e[_0x9281('0x28')]]={'$like':'%'+_0x3db566['query'][_0x9281('0x3d')]+'%'};return _0x3754f0;}})});}_0x323fc9=_['merge']({},_0x323fc9,_0x3db566[_0x9281('0x3e')]);var _0x1b96c9={'where':_0x323fc9[_0x9281('0x39')]};return db[_0x9281('0x3f')][_0x9281('0x1f')](_0x1b96c9)[_0x9281('0x23')](function(_0x5cfc2d){_0x39947[_0x9281('0x1f')]=_0x5cfc2d;if(_0x3db566[_0x9281('0x2f')][_0x9281('0x40')]){_0x323fc9[_0x9281('0x41')]=[{'all':!![]}];}return db[_0x9281('0x3f')][_0x9281('0x42')](_0x323fc9);})[_0x9281('0x23')](function(_0x38fe70){_0x39947['rows']=_0x38fe70;return _0x39947;})[_0x9281('0x23')](respondWithFilteredResult(_0x55dae2,_0x323fc9))['catch'](handleError(_0x55dae2,null));};exports['show']=function(_0x30a9ae,_0x2276a2){var _0x2280f5={'raw':!![],'where':{'id':_0x30a9ae[_0x9281('0x43')]['id']}},_0x4d661d={};_0x4d661d[_0x9281('0x2d')]=_['keys'](db[_0x9281('0x3f')][_0x9281('0x2a')]);_0x4d661d[_0x9281('0x2f')]=_[_0x9281('0x30')](_0x30a9ae[_0x9281('0x2f')]);_0x4d661d[_0x9281('0x31')]=_[_0x9281('0x32')](_0x4d661d[_0x9281('0x2d')],_0x4d661d[_0x9281('0x2f')]);_0x2280f5['attributes']=_['intersection'](_0x4d661d[_0x9281('0x2d')],qs[_0x9281('0x33')](_0x30a9ae['query'][_0x9281('0x33')]));_0x2280f5[_0x9281('0x34')]=_0x2280f5[_0x9281('0x34')][_0x9281('0x35')]?_0x2280f5[_0x9281('0x34')]:_0x4d661d[_0x9281('0x2d')];if(_0x30a9ae['query'][_0x9281('0x40')]){_0x2280f5[_0x9281('0x41')]=[{'all':!![]}];}_0x2280f5=_[_0x9281('0x44')]({},_0x2280f5,_0x30a9ae[_0x9281('0x3e')]);return db[_0x9281('0x3f')][_0x9281('0x45')](_0x2280f5)['then'](handleEntityNotFound(_0x2276a2,null))['then'](respondWithResult(_0x2276a2,null))[_0x9281('0x46')](handleError(_0x2276a2,null));};exports[_0x9281('0x47')]=function(_0x16a3ba,_0x4857fe){return db[_0x9281('0x3f')][_0x9281('0x47')](_0x16a3ba[_0x9281('0x48')],{})['then'](function(_0x5be425){var _0x506330=_0x16a3ba[_0x9281('0x49')][_0x9281('0x4a')]({'plain':!![]});if(!_0x506330)throw new Error(_0x9281('0x4b'));if(_0x506330[_0x9281('0x4c')]===_0x9281('0x49')){var _0x3e2663=_0x5be425[_0x9281('0x4a')]({'plain':!![]});var _0x212dae=_0x9281('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x212dae,'userProfileId':_0x506330[_0x9281('0x4d')]},'raw':!![]})[_0x9281('0x23')](function(_0x53807f){if(_0x53807f&&_0x53807f[_0x9281('0x4e')]===0x0){return db[_0x9281('0x4f')]['create']({'name':_0x3e2663[_0x9281('0x28')],'resourceId':_0x3e2663['id'],'type':_0x53807f[_0x9281('0x28')],'sectionId':_0x53807f['id']},{})['then'](function(){return _0x5be425;});}else{return _0x5be425;}})[_0x9281('0x46')](function(_0x5cbcd0){logger[_0x9281('0x26')](_0x9281('0x50'),_0x5cbcd0);throw _0x5cbcd0;});}return _0x5be425;})[_0x9281('0x23')](respondWithResult(_0x4857fe,0xc9))[_0x9281('0x46')](handleError(_0x4857fe,null));};exports['update']=function(_0x7ea4f4,_0x332f38){if(_0x7ea4f4[_0x9281('0x48')]['id']){delete _0x7ea4f4[_0x9281('0x48')]['id'];}return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x7ea4f4['params']['id']}})[_0x9281('0x23')](handleEntityNotFound(_0x332f38,null))[_0x9281('0x23')](saveUpdates(_0x7ea4f4[_0x9281('0x48')],null))['then'](respondWithResult(_0x332f38,null))[_0x9281('0x46')](handleError(_0x332f38,null));};exports[_0x9281('0x24')]=function(_0x305099,_0x29b227){return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x305099[_0x9281('0x43')]['id']}})[_0x9281('0x23')](handleEntityNotFound(_0x29b227,null))[_0x9281('0x23')](removeEntity(_0x29b227,null))['catch'](handleError(_0x29b227,null));};exports[_0x9281('0x51')]=function(_0x181bc6,_0x56ddbc,_0x481a98){return db[_0x9281('0x3f')][_0x9281('0x45')]({'where':{'id':_0x181bc6[_0x9281('0x43')]['id']},'attributes':['name','basename','savename',_0x9281('0x52')],'raw':!![]})[_0x9281('0x23')](handleEntityNotFound(_0x56ddbc,null))[_0x9281('0x23')](function(_0xa6e4e0){if(_0xa6e4e0){if(!fs[_0x9281('0x53')](path['join'](config[_0x9281('0x54')],_0x9281('0x55'),_0xa6e4e0[_0x9281('0x56')]))){throw new db[(_0x9281('0x57'))]['ValidationError'](_0x9281('0x58'));}if(_0x181bc6['query'][_0x9281('0x59')]){return _0x56ddbc[_0x9281('0x19')](0xc8);}return _0x56ddbc[_0x9281('0x51')](path['join'](config['root'],_0x9281('0x55'),_0xa6e4e0[_0x9281('0x56')]),util[_0x9281('0x5a')]('%s.%s',_0xa6e4e0[_0x9281('0x5b')]||_0xa6e4e0[_0x9281('0x28')],_0xa6e4e0[_0x9281('0x52')][_0x9281('0x5c')]()));}})[_0x9281('0x46')](handleError(_0x56ddbc,null));}; \ No newline at end of file +var _0x8ea6=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','root','server/files/reports','ValidationError','exists','join','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','AnalyticExtractedReport','include','rows','catch','params','keys','includeAll','options','find','create','user','role','UserProfileSection','autoAssociation','UserProfileResource'];(function(_0x58c10d,_0x1d5885){var _0x6b0ecd=function(_0x18827e){while(--_0x18827e){_0x58c10d['push'](_0x58c10d['shift']());}};_0x6b0ecd(++_0x1d5885);}(_0x8ea6,0x172));var _0x68ea=function(_0x368f34,_0x2efa91){_0x368f34=_0x368f34-0x0;var _0x48d458=_0x8ea6[_0x368f34];return _0x48d458;};'use strict';var emlformat=require(_0x68ea('0x0'));var rimraf=require(_0x68ea('0x1'));var zipdir=require(_0x68ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68ea('0x3'));var moment=require(_0x68ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x68ea('0x5'));var util=require(_0x68ea('0x6'));var path=require('path');var sox=require(_0x68ea('0x7'));var csv=require('to-csv');var ejs=require(_0x68ea('0x8'));var fs=require('fs');var fs_extra=require(_0x68ea('0x9'));var _=require(_0x68ea('0xa'));var squel=require('squel');var crypto=require(_0x68ea('0xb'));var jsforce=require(_0x68ea('0xc'));var deskjs=require(_0x68ea('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68ea('0xe'));var authService=require(_0x68ea('0xf'));var qs=require(_0x68ea('0x10'));var as=require(_0x68ea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x68ea('0x12'));var config=require(_0x68ea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x68ea('0x14'))['db'];function respondWithStatusCode(_0x3790cd,_0x23ca8c){_0x23ca8c=_0x23ca8c||0xcc;return function(_0xaef2d1){if(_0xaef2d1){return _0x3790cd[_0x68ea('0x15')](_0x23ca8c);}return _0x3790cd['status'](_0x23ca8c)[_0x68ea('0x16')]();};}function respondWithResult(_0x28ca1d,_0x38c22c){_0x38c22c=_0x38c22c||0xc8;return function(_0x192fdb){if(_0x192fdb){return _0x28ca1d[_0x68ea('0x17')](_0x38c22c)[_0x68ea('0x18')](_0x192fdb);}};}function respondWithFilteredResult(_0x834e7d,_0x5a3423){return function(_0x494e98){if(_0x494e98){var _0x4afe14=typeof _0x5a3423['offset']==='undefined'&&typeof _0x5a3423[_0x68ea('0x19')]===_0x68ea('0x1a');var _0x35458a=_0x494e98[_0x68ea('0x1b')];var _0x5736ce=_0x4afe14?0x0:_0x5a3423[_0x68ea('0x1c')];var _0x514a62=_0x4afe14?_0x494e98[_0x68ea('0x1b')]:_0x5a3423['offset']+_0x5a3423[_0x68ea('0x19')];var _0x287a9a;if(_0x514a62>=_0x35458a){_0x514a62=_0x35458a;_0x287a9a=0xc8;}else{_0x287a9a=0xce;}_0x834e7d[_0x68ea('0x17')](_0x287a9a);return _0x834e7d[_0x68ea('0x1d')]('Content-Range',_0x5736ce+'-'+_0x514a62+'/'+_0x35458a)['json'](_0x494e98);}return null;};}function patchUpdates(_0x209964){return function(_0x67d01){try{jsonpatch['apply'](_0x67d01,_0x209964,!![]);}catch(_0x2f370c){return BPromise[_0x68ea('0x1e')](_0x2f370c);}return _0x67d01[_0x68ea('0x1f')]();};}function saveUpdates(_0x27a6b7,_0x43fc72){return function(_0x21cfb1){if(_0x21cfb1){return _0x21cfb1[_0x68ea('0x20')](_0x27a6b7)[_0x68ea('0x21')](function(_0x3d6e2f){return _0x3d6e2f;});}return null;};}function removeEntity(_0x10cc99,_0x360026){return function(_0x39fcd5){if(_0x39fcd5){return _0x39fcd5['destroy']()[_0x68ea('0x21')](function(){var _0x2b4283=_0x39fcd5[_0x68ea('0x22')]({'plain':!![]});var _0xf2b9a0=_0x68ea('0x23');return db['UserProfileResource'][_0x68ea('0x24')]({'where':{'type':_0xf2b9a0,'resourceId':_0x2b4283['id']}})[_0x68ea('0x21')](function(){return _0x39fcd5;});})[_0x68ea('0x21')](function(){_0x10cc99[_0x68ea('0x17')](0xcc)[_0x68ea('0x16')]();});}};}function handleEntityNotFound(_0x161f80,_0x534703){return function(_0x488fb4){if(!_0x488fb4){_0x161f80[_0x68ea('0x15')](0x194);}return _0x488fb4;};}function handleError(_0x3a2ae0,_0x18e40f){_0x18e40f=_0x18e40f||0x1f4;return function(_0x11a04c){logger[_0x68ea('0x25')](_0x11a04c[_0x68ea('0x26')]);if(_0x11a04c[_0x68ea('0x27')]){delete _0x11a04c['name'];}_0x3a2ae0['status'](_0x18e40f)[_0x68ea('0x28')](_0x11a04c);};}exports['index']=function(_0x320528,_0x462438){var _0x58d10d={},_0x26201f={},_0x576ca1={'count':0x0,'rows':[]};var _0x1b3f64=_[_0x68ea('0x29')](db['AnalyticExtractedReport'][_0x68ea('0x2a')],function(_0x2d5a5d){return{'name':_0x2d5a5d['fieldName'],'type':_0x2d5a5d[_0x68ea('0x2b')][_0x68ea('0x2c')]};});_0x26201f['model']=_['map'](_0x1b3f64,_0x68ea('0x27'));_0x26201f['query']=_['keys'](_0x320528[_0x68ea('0x2d')]);_0x26201f[_0x68ea('0x2e')]=_[_0x68ea('0x2f')](_0x26201f['model'],_0x26201f[_0x68ea('0x2d')]);_0x58d10d['attributes']=_[_0x68ea('0x2f')](_0x26201f[_0x68ea('0x30')],qs['fields'](_0x320528['query'][_0x68ea('0x31')]));_0x58d10d[_0x68ea('0x32')]=_0x58d10d['attributes'][_0x68ea('0x33')]?_0x58d10d[_0x68ea('0x32')]:_0x26201f['model'];if(!_0x320528['query'][_0x68ea('0x34')](_0x68ea('0x35'))){_0x58d10d[_0x68ea('0x19')]=qs['limit'](_0x320528[_0x68ea('0x2d')][_0x68ea('0x19')]);_0x58d10d[_0x68ea('0x1c')]=qs[_0x68ea('0x1c')](_0x320528[_0x68ea('0x2d')][_0x68ea('0x1c')]);}_0x58d10d[_0x68ea('0x36')]=qs[_0x68ea('0x37')](_0x320528[_0x68ea('0x2d')][_0x68ea('0x37')]);_0x58d10d[_0x68ea('0x38')]=qs[_0x68ea('0x2e')](_[_0x68ea('0x39')](_0x320528[_0x68ea('0x2d')],_0x26201f['filters']),_0x1b3f64);if(_0x320528[_0x68ea('0x2d')]['filter']){_0x58d10d[_0x68ea('0x38')]=_[_0x68ea('0x3a')](_0x58d10d['where'],{'$or':_[_0x68ea('0x29')](_0x1b3f64,function(_0x595865){if(_0x595865[_0x68ea('0x2b')]!=='VIRTUAL'){var _0x467aea={};_0x467aea[_0x595865[_0x68ea('0x27')]]={'$like':'%'+_0x320528[_0x68ea('0x2d')][_0x68ea('0x3b')]+'%'};return _0x467aea;}})});}_0x58d10d=_[_0x68ea('0x3a')]({},_0x58d10d,_0x320528['options']);var _0x56ffa6={'where':_0x58d10d[_0x68ea('0x38')]};return db[_0x68ea('0x3c')][_0x68ea('0x1b')](_0x56ffa6)[_0x68ea('0x21')](function(_0x30854a){_0x576ca1[_0x68ea('0x1b')]=_0x30854a;if(_0x320528[_0x68ea('0x2d')]['includeAll']){_0x58d10d[_0x68ea('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x58d10d);})[_0x68ea('0x21')](function(_0x3f83a1){_0x576ca1[_0x68ea('0x3e')]=_0x3f83a1;return _0x576ca1;})['then'](respondWithFilteredResult(_0x462438,_0x58d10d))[_0x68ea('0x3f')](handleError(_0x462438,null));};exports['show']=function(_0x18eac2,_0x1c22af){var _0x14453c={'raw':!![],'where':{'id':_0x18eac2[_0x68ea('0x40')]['id']}},_0x716147={};_0x716147['model']=_['keys'](db[_0x68ea('0x3c')]['rawAttributes']);_0x716147['query']=_[_0x68ea('0x41')](_0x18eac2[_0x68ea('0x2d')]);_0x716147[_0x68ea('0x2e')]=_[_0x68ea('0x2f')](_0x716147[_0x68ea('0x30')],_0x716147['query']);_0x14453c[_0x68ea('0x32')]=_[_0x68ea('0x2f')](_0x716147[_0x68ea('0x30')],qs[_0x68ea('0x31')](_0x18eac2[_0x68ea('0x2d')][_0x68ea('0x31')]));_0x14453c[_0x68ea('0x32')]=_0x14453c[_0x68ea('0x32')][_0x68ea('0x33')]?_0x14453c[_0x68ea('0x32')]:_0x716147['model'];if(_0x18eac2[_0x68ea('0x2d')][_0x68ea('0x42')]){_0x14453c['include']=[{'all':!![]}];}_0x14453c=_[_0x68ea('0x3a')]({},_0x14453c,_0x18eac2[_0x68ea('0x43')]);return db[_0x68ea('0x3c')][_0x68ea('0x44')](_0x14453c)[_0x68ea('0x21')](handleEntityNotFound(_0x1c22af,null))[_0x68ea('0x21')](respondWithResult(_0x1c22af,null))[_0x68ea('0x3f')](handleError(_0x1c22af,null));};exports[_0x68ea('0x45')]=function(_0x437cb7,_0x4a3308){return db[_0x68ea('0x3c')][_0x68ea('0x45')](_0x437cb7['body'],{})[_0x68ea('0x21')](function(_0x19e040){var _0x366686=_0x437cb7[_0x68ea('0x46')][_0x68ea('0x22')]({'plain':!![]});if(!_0x366686)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x366686[_0x68ea('0x47')]===_0x68ea('0x46')){var _0x2c8f61=_0x19e040[_0x68ea('0x22')]({'plain':!![]});var _0x1ae552=_0x68ea('0x23');return db[_0x68ea('0x48')][_0x68ea('0x44')]({'where':{'name':_0x1ae552,'userProfileId':_0x366686['userProfileId']},'raw':!![]})[_0x68ea('0x21')](function(_0x3ee407){if(_0x3ee407&&_0x3ee407[_0x68ea('0x49')]===0x0){return db[_0x68ea('0x4a')]['create']({'name':_0x2c8f61[_0x68ea('0x27')],'resourceId':_0x2c8f61['id'],'type':_0x3ee407[_0x68ea('0x27')],'sectionId':_0x3ee407['id']},{})['then'](function(){return _0x19e040;});}else{return _0x19e040;}})[_0x68ea('0x3f')](function(_0x54c990){logger['error'](_0x68ea('0x4b'),_0x54c990);throw _0x54c990;});}return _0x19e040;})['then'](respondWithResult(_0x4a3308,0xc9))['catch'](handleError(_0x4a3308,null));};exports['update']=function(_0x4f10b2,_0xf5f79b){if(_0x4f10b2[_0x68ea('0x4c')]['id']){delete _0x4f10b2[_0x68ea('0x4c')]['id'];}return db[_0x68ea('0x3c')][_0x68ea('0x44')]({'where':{'id':_0x4f10b2[_0x68ea('0x40')]['id']}})[_0x68ea('0x21')](handleEntityNotFound(_0xf5f79b,null))[_0x68ea('0x21')](saveUpdates(_0x4f10b2[_0x68ea('0x4c')],null))[_0x68ea('0x21')](respondWithResult(_0xf5f79b,null))['catch'](handleError(_0xf5f79b,null));};exports['destroy']=function(_0x748b07,_0xa86228){return db[_0x68ea('0x3c')][_0x68ea('0x44')]({'where':{'id':_0x748b07[_0x68ea('0x40')]['id']}})[_0x68ea('0x21')](handleEntityNotFound(_0xa86228,null))[_0x68ea('0x21')](removeEntity(_0xa86228,null))[_0x68ea('0x3f')](handleError(_0xa86228,null));};exports[_0x68ea('0x4d')]=function(_0x55c37e,_0x1a6f92,_0x43d04b){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x55c37e[_0x68ea('0x40')]['id']},'attributes':['name',_0x68ea('0x4e'),_0x68ea('0x4f'),_0x68ea('0x50')],'raw':!![]})[_0x68ea('0x21')](handleEntityNotFound(_0x1a6f92,null))[_0x68ea('0x21')](function(_0x5d235d){if(_0x5d235d){if(!fs[_0x68ea('0x51')](path['join'](config[_0x68ea('0x52')],_0x68ea('0x53'),_0x5d235d[_0x68ea('0x4f')]))){throw new db['Sequelize'][(_0x68ea('0x54'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x55c37e[_0x68ea('0x2d')][_0x68ea('0x55')]){return _0x1a6f92[_0x68ea('0x15')](0xc8);}return _0x1a6f92['download'](path[_0x68ea('0x56')](config[_0x68ea('0x52')],'server/files/reports',_0x5d235d[_0x68ea('0x4f')]),util['format'](_0x68ea('0x57'),_0x5d235d[_0x68ea('0x4e')]||_0x5d235d[_0x68ea('0x27')],_0x5d235d[_0x68ea('0x50')][_0x68ea('0x58')]()));}})[_0x68ea('0x3f')](handleError(_0x1a6f92,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index fcdde82..704713e 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 _0x11cb=['define','AnalyticExtractedReport','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports'];(function(_0x126337,_0x391d14){var _0x162b45=function(_0x39cd9c){while(--_0x39cd9c){_0x126337['push'](_0x126337['shift']());}};_0x162b45(++_0x391d14);}(_0x11cb,0x1b2));var _0xb11c=function(_0x6d73cf,_0x3c0622){_0x6d73cf=_0x6d73cf-0x0;var _0x5bcc34=_0x11cb[_0x6d73cf];return _0x5bcc34;};'use strict';var _=require(_0xb11c('0x0'));var util=require('util');var logger=require(_0xb11c('0x1'))(_0xb11c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb11c('0x3'));var rimraf=require(_0xb11c('0x4'));var config=require(_0xb11c('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xb11c('0x6')]=function(_0x58f866,_0x3e596b){return _0x58f866[_0xb11c('0x7')](_0xb11c('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f04=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4f4a4d,_0x385c99){var _0x1cba2c=function(_0x16929d){while(--_0x16929d){_0x4f4a4d['push'](_0x4f4a4d['shift']());}};_0x1cba2c(++_0x385c99);}(_0x6f04,0x1df));var _0x46f0=function(_0x5f58c5,_0x67ac5a){_0x5f58c5=_0x5f58c5-0x0;var _0x50919d=_0x6f04[_0x5f58c5];return _0x50919d;};'use strict';var _=require(_0x46f0('0x0'));var util=require(_0x46f0('0x1'));var logger=require(_0x46f0('0x2'))(_0x46f0('0x3'));var moment=require(_0x46f0('0x4'));var BPromise=require(_0x46f0('0x5'));var rp=require(_0x46f0('0x6'));var fs=require('fs');var path=require(_0x46f0('0x7'));var rimraf=require(_0x46f0('0x8'));var config=require(_0x46f0('0x9'));var attributes=require('./analyticExtractedReport.attributes');module[_0x46f0('0xa')]=function(_0x2705ae,_0x11772e){return _0x2705ae[_0x46f0('0xb')](_0x46f0('0xc'),attributes,{'tableName':_0x46f0('0xd'),'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 525f935..fd59a88 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 _0x002b=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','lodash','util','bluebird'];(function(_0x273eec,_0x139927){var _0x5771d7=function(_0x2f1967){while(--_0x2f1967){_0x273eec['push'](_0x273eec['shift']());}};_0x5771d7(++_0x139927);}(_0x002b,0x138));var _0xb002=function(_0xb603f1,_0x31555a){_0xb603f1=_0xb603f1-0x0;var _0x5a77aa=_0x002b[_0xb603f1];return _0x5a77aa;};'use strict';var _=require(_0xb002('0x0'));var util=require(_0xb002('0x1'));var moment=require('moment');var BPromise=require(_0xb002('0x2'));var rs=require(_0xb002('0x3'));var fs=require('fs');var Redis=require(_0xb002('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb002('0x5'));var logger=require(_0xb002('0x6'))('rpc');var config=require(_0xb002('0x7'));var jayson=require(_0xb002('0x8'));var client=jayson[_0xb002('0x9')][_0xb002('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x270026,_0x10453e,_0x290479){return new BPromise(function(_0x559803,_0x483a5c){return client[_0xb002('0xb')](_0x270026,_0x290479)[_0xb002('0xc')](function(_0x5ae886){logger[_0xb002('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10453e,_0xb002('0xe'));logger[_0xb002('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x10453e,'request\x20sent',JSON[_0xb002('0x10')](_0x5ae886));if(_0x5ae886[_0xb002('0x11')]){if(_0x5ae886[_0xb002('0x11')]['code']===0x1f4){logger[_0xb002('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10453e,_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);return _0x483a5c(_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);}logger['error'](_0xb002('0x13'),_0x10453e,_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);return _0x559803(_0x5ae886[_0xb002('0x11')][_0xb002('0x12')]);}else{logger['info'](_0xb002('0x13'),_0x10453e,_0xb002('0xe'));_0x559803(_0x5ae886[_0xb002('0x14')]['message']);}})['catch'](function(_0x597b0a){logger[_0xb002('0x11')](_0xb002('0x13'),_0x10453e,_0x597b0a);_0x483a5c(_0x597b0a);});});} \ No newline at end of file +var _0xb6ff=['../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb6ff,0x15a));var _0xfb6f=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0xb6ff[_0x34325b];return _0x3da348;};'use strict';var _=require(_0xfb6f('0x0'));var util=require(_0xfb6f('0x1'));var moment=require(_0xfb6f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb6f('0x3'));var db=require(_0xfb6f('0x4'))['db'];var utils=require(_0xfb6f('0x5'));var logger=require(_0xfb6f('0x6'))(_0xfb6f('0x7'));var config=require(_0xfb6f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfb6f('0x9')][_0xfb6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aaa89,_0x546b80,_0x5c25f4){return new BPromise(function(_0x4de90a,_0xd71721){return client['request'](_0x4aaa89,_0x5c25f4)[_0xfb6f('0xb')](function(_0x37805a){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x546b80,_0xfb6f('0xc'));logger[_0xfb6f('0xd')](_0xfb6f('0xe'),_0x546b80,_0xfb6f('0xc'),JSON[_0xfb6f('0xf')](_0x37805a));if(_0x37805a['error']){if(_0x37805a[_0xfb6f('0x10')][_0xfb6f('0x11')]===0x1f4){logger[_0xfb6f('0x10')](_0xfb6f('0x12'),_0x546b80,_0x37805a[_0xfb6f('0x10')][_0xfb6f('0x13')]);return _0xd71721(_0x37805a[_0xfb6f('0x10')][_0xfb6f('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x546b80,_0x37805a['error'][_0xfb6f('0x13')]);return _0x4de90a(_0x37805a['error'][_0xfb6f('0x13')]);}else{logger['info'](_0xfb6f('0x12'),_0x546b80,_0xfb6f('0xc'));_0x4de90a(_0x37805a[_0xfb6f('0x14')]['message']);}})[_0xfb6f('0x15')](function(_0x33e224){logger[_0xfb6f('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x546b80,_0x33e224);_0xd71721(_0x33e224);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 26c6ef4..3dcc01a 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 _0x8f5d=['show','/:id/download','post','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x8f5d,0xa9));var _0xd8f5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8f5d[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require(_0xd8f5('0x0'));var path=require(_0xd8f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f5('0x2'));var router=express[_0xd8f5('0x3')]();var fs_extra=require(_0xd8f5('0x4'));var auth=require(_0xd8f5('0x5'));var interaction=require(_0xd8f5('0x6'));var config=require(_0xd8f5('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xd8f5('0x8')](),controller['index']);router[_0xd8f5('0x9')](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0xb')]);router[_0xd8f5('0x9')](_0xd8f5('0xc'),auth[_0xd8f5('0x8')](),controller['download']);router[_0xd8f5('0xd')]('/',auth[_0xd8f5('0x8')](),controller['create']);router[_0xd8f5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd8f5('0xf')]);router['delete'](_0xd8f5('0xa'),auth[_0xd8f5('0x8')](),controller[_0xd8f5('0x10')]);module[_0xd8f5('0x11')]=router; \ No newline at end of file +var _0x3b30=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id/download','isAuthenticated','download','post','create','put','/:id'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x3b30,0x16c));var _0x03b3=function(_0x437c86,_0xa1a0dc){_0x437c86=_0x437c86-0x0;var _0x553fa1=_0x3b30[_0x437c86];return _0x553fa1;};'use strict';var multer=require(_0x03b3('0x0'));var util=require(_0x03b3('0x1'));var path=require('path');var timeout=require(_0x03b3('0x2'));var express=require('express');var router=express[_0x03b3('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x03b3('0x4'));var config=require(_0x03b3('0x5'));var controller=require(_0x03b3('0x6'));router[_0x03b3('0x7')]('/',auth['isAuthenticated'](),controller[_0x03b3('0x8')]);router[_0x03b3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x03b3('0x7')](_0x03b3('0x9'),auth[_0x03b3('0xa')](),controller[_0x03b3('0xb')]);router[_0x03b3('0xc')]('/',auth[_0x03b3('0xa')](),controller[_0x03b3('0xd')]);router[_0x03b3('0xe')](_0x03b3('0xf'),auth[_0x03b3('0xa')](),controller[_0x03b3('0x10')]);router[_0x03b3('0x11')](_0x03b3('0xf'),auth[_0x03b3('0xa')](),controller[_0x03b3('0x12')]);module[_0x03b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 90b1ef6..a360efb 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 _0xe767=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0xe767,0x11a));var _0x7e76=function(_0x248031,_0xb67576){_0x248031=_0x248031-0x0;var _0x5d144d=_0xe767[_0x248031];return _0x5d144d;};'use strict';var Sequelize=require(_0x7e76('0x0'));module['exports']={'field':{'type':Sequelize[_0x7e76('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7e76('0x2')]},'format':{'type':Sequelize[_0x7e76('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x7e76('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x76fd=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x76fd,0x10b));var _0xd76f=function(_0x20dc9b,_0x2c80b4){_0x20dc9b=_0x20dc9b-0x0;var _0x5074ee=_0x76fd[_0x20dc9b];return _0x5074ee;};'use strict';var Sequelize=require(_0xd76f('0x0'));module[_0xd76f('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd76f('0x2')]},'function':{'type':Sequelize[_0xd76f('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd76f('0x2')]},'custom':{'type':Sequelize[_0xd76f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6295cc3..33bcf14 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 _0x78eb=['params','find','create','body','bulkCreate','ids','addFields','findOne','transaction','CustomReportId','findAll','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticFieldReport','catch'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x78eb,0x153));var _0xb78e=function(_0x2ba31b,_0x44b207){_0x2ba31b=_0x2ba31b-0x0;var _0x23d222=_0x78eb[_0x2ba31b];return _0x23d222;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb78e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb78e('0x1'));var moment=require(_0xb78e('0x2'));var BPromise=require(_0xb78e('0x3'));var Mustache=require(_0xb78e('0x4'));var util=require(_0xb78e('0x5'));var path=require(_0xb78e('0x6'));var sox=require('sox');var csv=require(_0xb78e('0x7'));var ejs=require(_0xb78e('0x8'));var fs=require('fs');var fs_extra=require(_0xb78e('0x9'));var _=require(_0xb78e('0xa'));var squel=require(_0xb78e('0xb'));var crypto=require(_0xb78e('0xc'));var jsforce=require(_0xb78e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb78e('0x7'));var querystring=require(_0xb78e('0xe'));var Papa=require(_0xb78e('0xf'));var Redis=require(_0xb78e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb78e('0x11'));var as=require(_0xb78e('0x12'));var hardwareService=require(_0xb78e('0x13'));var logger=require(_0xb78e('0x14'))('api');var utils=require(_0xb78e('0x15'));var config=require(_0xb78e('0x16'));var licenseUtil=require(_0xb78e('0x17'));var db=require(_0xb78e('0x18'))['db'];function respondWithStatusCode(_0x53ed2e,_0x5a625c){_0x5a625c=_0x5a625c||0xcc;return function(_0x5648a7){if(_0x5648a7){return _0x53ed2e['sendStatus'](_0x5a625c);}return _0x53ed2e[_0xb78e('0x19')](_0x5a625c)[_0xb78e('0x1a')]();};}function respondWithResult(_0x3cbf2a,_0x16c8da){_0x16c8da=_0x16c8da||0xc8;return function(_0x2cf88c){if(_0x2cf88c){return _0x3cbf2a['status'](_0x16c8da)['json'](_0x2cf88c);}};}function respondWithFilteredResult(_0x12549c,_0x315ac2){return function(_0xc178f8){if(_0xc178f8){var _0x3a9f87=typeof _0x315ac2[_0xb78e('0x1b')]===_0xb78e('0x1c')&&typeof _0x315ac2[_0xb78e('0x1d')]===_0xb78e('0x1c');var _0x5316d3=_0xc178f8['count'];var _0x3bd8e9=_0x3a9f87?0x0:_0x315ac2[_0xb78e('0x1b')];var _0x3ceca8=_0x3a9f87?_0xc178f8[_0xb78e('0x1e')]:_0x315ac2[_0xb78e('0x1b')]+_0x315ac2[_0xb78e('0x1d')];var _0x4a1a43;if(_0x3ceca8>=_0x5316d3){_0x3ceca8=_0x5316d3;_0x4a1a43=0xc8;}else{_0x4a1a43=0xce;}_0x12549c[_0xb78e('0x19')](_0x4a1a43);return _0x12549c[_0xb78e('0x1f')](_0xb78e('0x20'),_0x3bd8e9+'-'+_0x3ceca8+'/'+_0x5316d3)['json'](_0xc178f8);}return null;};}function patchUpdates(_0xa9bd30){return function(_0x49b8f7){try{jsonpatch[_0xb78e('0x21')](_0x49b8f7,_0xa9bd30,!![]);}catch(_0x1a3071){return BPromise[_0xb78e('0x22')](_0x1a3071);}return _0x49b8f7['save']();};}function saveUpdates(_0x1cab74,_0xe76b1){return function(_0x1bc524){if(_0x1bc524){return _0x1bc524[_0xb78e('0x23')](_0x1cab74)[_0xb78e('0x24')](function(_0x28a96e){return _0x28a96e;});}return null;};}function removeEntity(_0x141028,_0x1701ad){return function(_0x11792f){if(_0x11792f){return _0x11792f[_0xb78e('0x25')]()['then'](function(){_0x141028[_0xb78e('0x19')](0xcc)[_0xb78e('0x1a')]();});}};}function handleEntityNotFound(_0x123185,_0xb45429){return function(_0x5349c8){if(!_0x5349c8){_0x123185[_0xb78e('0x26')](0x194);}return _0x5349c8;};}function handleError(_0x19a797,_0x3aa958){_0x3aa958=_0x3aa958||0x1f4;return function(_0x135f89){logger[_0xb78e('0x27')](_0x135f89[_0xb78e('0x28')]);if(_0x135f89[_0xb78e('0x29')]){delete _0x135f89['name'];}_0x19a797[_0xb78e('0x19')](_0x3aa958)[_0xb78e('0x2a')](_0x135f89);};}exports[_0xb78e('0x2b')]=function(_0x2d5a95,_0x195363){var _0x95f9e9={},_0x1f4459={},_0x3efdac={'count':0x0,'rows':[]};var _0x16bc21=_[_0xb78e('0x2c')](db['AnalyticFieldReport'][_0xb78e('0x2d')],function(_0x42995c){return{'name':_0x42995c[_0xb78e('0x2e')],'type':_0x42995c[_0xb78e('0x2f')][_0xb78e('0x30')]};});_0x1f4459[_0xb78e('0x31')]=_[_0xb78e('0x2c')](_0x16bc21,'name');_0x1f4459[_0xb78e('0x32')]=_[_0xb78e('0x33')](_0x2d5a95[_0xb78e('0x32')]);_0x1f4459[_0xb78e('0x34')]=_[_0xb78e('0x35')](_0x1f4459[_0xb78e('0x31')],_0x1f4459[_0xb78e('0x32')]);_0x95f9e9['attributes']=_['intersection'](_0x1f4459[_0xb78e('0x31')],qs[_0xb78e('0x36')](_0x2d5a95['query'][_0xb78e('0x36')]));_0x95f9e9[_0xb78e('0x37')]=_0x95f9e9[_0xb78e('0x37')][_0xb78e('0x38')]?_0x95f9e9['attributes']:_0x1f4459[_0xb78e('0x31')];if(!_0x2d5a95['query'][_0xb78e('0x39')](_0xb78e('0x3a'))){_0x95f9e9['limit']=qs[_0xb78e('0x1d')](_0x2d5a95[_0xb78e('0x32')]['limit']);_0x95f9e9[_0xb78e('0x1b')]=qs['offset'](_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x1b')]);}_0x95f9e9[_0xb78e('0x3b')]=qs[_0xb78e('0x3c')](_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3c')]);_0x95f9e9[_0xb78e('0x3d')]=qs[_0xb78e('0x34')](_[_0xb78e('0x3e')](_0x2d5a95[_0xb78e('0x32')],_0x1f4459[_0xb78e('0x34')]),_0x16bc21);if(_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3f')]){_0x95f9e9['where']=_[_0xb78e('0x40')](_0x95f9e9[_0xb78e('0x3d')],{'$or':_['map'](_0x16bc21,function(_0x709d7a){if(_0x709d7a['type']!==_0xb78e('0x41')){var _0x5b235b={};_0x5b235b[_0x709d7a[_0xb78e('0x29')]]={'$like':'%'+_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x3f')]+'%'};return _0x5b235b;}})});}_0x95f9e9=_[_0xb78e('0x40')]({},_0x95f9e9,_0x2d5a95[_0xb78e('0x42')]);var _0x318b0a={'where':_0x95f9e9[_0xb78e('0x3d')]};return db['AnalyticFieldReport'][_0xb78e('0x1e')](_0x318b0a)['then'](function(_0x520b68){_0x3efdac['count']=_0x520b68;if(_0x2d5a95[_0xb78e('0x32')][_0xb78e('0x43')]){_0x95f9e9[_0xb78e('0x44')]=[{'all':!![]}];}return db[_0xb78e('0x45')]['findAll'](_0x95f9e9);})[_0xb78e('0x24')](function(_0x117776){_0x3efdac['rows']=_0x117776;return _0x3efdac;})[_0xb78e('0x24')](respondWithFilteredResult(_0x195363,_0x95f9e9))[_0xb78e('0x46')](handleError(_0x195363,null));};exports['show']=function(_0x57ea46,_0x22e1ce){var _0x40ef14={'raw':![],'where':{'id':_0x57ea46[_0xb78e('0x47')]['id']}},_0x5ce10c={};_0x5ce10c[_0xb78e('0x31')]=_[_0xb78e('0x33')](db[_0xb78e('0x45')][_0xb78e('0x2d')]);_0x5ce10c['query']=_[_0xb78e('0x33')](_0x57ea46[_0xb78e('0x32')]);_0x5ce10c[_0xb78e('0x34')]=_[_0xb78e('0x35')](_0x5ce10c[_0xb78e('0x31')],_0x5ce10c[_0xb78e('0x32')]);_0x40ef14[_0xb78e('0x37')]=_['intersection'](_0x5ce10c['model'],qs['fields'](_0x57ea46[_0xb78e('0x32')][_0xb78e('0x36')]));_0x40ef14[_0xb78e('0x37')]=_0x40ef14['attributes'][_0xb78e('0x38')]?_0x40ef14[_0xb78e('0x37')]:_0x5ce10c[_0xb78e('0x31')];if(_0x57ea46[_0xb78e('0x32')][_0xb78e('0x43')]){_0x40ef14[_0xb78e('0x44')]=[{'all':!![]}];}_0x40ef14=_['merge']({},_0x40ef14,_0x57ea46[_0xb78e('0x42')]);return db[_0xb78e('0x45')][_0xb78e('0x48')](_0x40ef14)[_0xb78e('0x24')](handleEntityNotFound(_0x22e1ce,null))[_0xb78e('0x24')](respondWithResult(_0x22e1ce,null))[_0xb78e('0x46')](handleError(_0x22e1ce,null));};exports[_0xb78e('0x49')]=function(_0x5a3f6b,_0x2f758d){return db[_0xb78e('0x45')][_0xb78e('0x49')](_0x5a3f6b[_0xb78e('0x4a')],{})[_0xb78e('0x24')](respondWithResult(_0x2f758d,0xc9))[_0xb78e('0x46')](handleError(_0x2f758d,null));};exports[_0xb78e('0x4b')]=function(_0x3a859f,_0x180dab){return db['AnalyticFieldReport']['bulkCreate'](_0x3a859f['body'],{'raw':![],'individualHooks':!![]})[_0xb78e('0x24')](respondWithResult(_0x180dab,0xc9))[_0xb78e('0x46')](handleError(_0x180dab,null));};exports[_0xb78e('0x23')]=function(_0x4ca402,_0x14cdf5){if(_0x4ca402[_0xb78e('0x4a')]['id']){delete _0x4ca402[_0xb78e('0x4a')]['id'];}return db[_0xb78e('0x45')][_0xb78e('0x48')]({'where':{'id':_0x4ca402['params']['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x14cdf5,null))['then'](saveUpdates(_0x4ca402[_0xb78e('0x4a')],null))[_0xb78e('0x24')](respondWithResult(_0x14cdf5,null))[_0xb78e('0x46')](handleError(_0x14cdf5,null));};exports[_0xb78e('0x25')]=function(_0x545070,_0x3d9888){return db[_0xb78e('0x45')][_0xb78e('0x48')]({'where':{'id':_0x545070[_0xb78e('0x47')]['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x3d9888,null))['then'](removeEntity(_0x3d9888,null))[_0xb78e('0x46')](handleError(_0x3d9888,null));};exports['bulkDestroy']=function(_0x374742,_0x4e8e5f){return db[_0xb78e('0x45')][_0xb78e('0x25')]({'where':{'id':_0x374742[_0xb78e('0x32')][_0xb78e('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4e8e5f,0xcc))[_0xb78e('0x46')](handleError(_0x4e8e5f,null));};exports[_0xb78e('0x4d')]=function(_0x288259,_0x471977,_0x501236){return db['AnalyticCustomReport'][_0xb78e('0x4e')]({'where':{'id':_0x288259[_0xb78e('0x47')]['id']}})[_0xb78e('0x24')](handleEntityNotFound(_0x471977,null))['then'](function(_0x16ea11){if(_0x16ea11){return db['sequelize'][_0xb78e('0x4f')](function(_0x40fe2d){return db[_0xb78e('0x45')][_0xb78e('0x25')]({'where':{'CustomReportId':_0x288259[_0xb78e('0x47')]['id']},'transaction':_0x40fe2d})[_0xb78e('0x24')](function(_0x39c51f){var _0x5d2ca9=_[_0xb78e('0x2c')](_0x288259[_0xb78e('0x4a')],function(_0x417203){delete _0x417203['id'];_0x417203[_0xb78e('0x50')]=_0x288259[_0xb78e('0x47')]['id'];return _0x417203;});return db[_0xb78e('0x45')][_0xb78e('0x4b')](_0x5d2ca9,{'transaction':_0x40fe2d});});})['then'](function(){return db[_0xb78e('0x45')][_0xb78e('0x51')]({'where':{'CustomReportId':_0x288259[_0xb78e('0x47')]['id']}});});}})[_0xb78e('0x24')](respondWithResult(_0x471977,null))['catch'](handleError(_0x471977,null));}; \ No newline at end of file +var _0x504b=['util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','index','map','AnalyticFieldReport','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','length','merge','find','create','bulkCreate','body','destroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x9d6855,_0x5b6da6){var _0x3bbc78=function(_0x17d464){while(--_0x17d464){_0x9d6855['push'](_0x9d6855['shift']());}};_0x3bbc78(++_0x5b6da6);}(_0x504b,0xa2));var _0xb504=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x504b[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb504('0x0'));var zipdir=require(_0xb504('0x1'));var jsonpatch=require(_0xb504('0x2'));var rp=require(_0xb504('0x3'));var moment=require(_0xb504('0x4'));var BPromise=require(_0xb504('0x5'));var Mustache=require('mustache');var util=require(_0xb504('0x6'));var path=require(_0xb504('0x7'));var sox=require(_0xb504('0x8'));var csv=require('to-csv');var ejs=require(_0xb504('0x9'));var fs=require('fs');var fs_extra=require(_0xb504('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb504('0xb'));var jsforce=require(_0xb504('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb504('0xd'));var querystring=require(_0xb504('0xe'));var Papa=require(_0xb504('0xf'));var Redis=require('ioredis');var authService=require(_0xb504('0x10'));var qs=require(_0xb504('0x11'));var as=require(_0xb504('0x12'));var hardwareService=require(_0xb504('0x13'));var logger=require(_0xb504('0x14'))(_0xb504('0x15'));var utils=require(_0xb504('0x16'));var config=require(_0xb504('0x17'));var licenseUtil=require(_0xb504('0x18'));var db=require(_0xb504('0x19'))['db'];function respondWithStatusCode(_0x22d2bc,_0x41528b){_0x41528b=_0x41528b||0xcc;return function(_0x4228df){if(_0x4228df){return _0x22d2bc['sendStatus'](_0x41528b);}return _0x22d2bc[_0xb504('0x1a')](_0x41528b)[_0xb504('0x1b')]();};}function respondWithResult(_0x44ac70,_0x975535){_0x975535=_0x975535||0xc8;return function(_0x2e1458){if(_0x2e1458){return _0x44ac70[_0xb504('0x1a')](_0x975535)['json'](_0x2e1458);}};}function respondWithFilteredResult(_0x1d182a,_0x4f57c4){return function(_0x36e5b8){if(_0x36e5b8){var _0x295136=typeof _0x4f57c4[_0xb504('0x1c')]===_0xb504('0x1d')&&typeof _0x4f57c4['limit']===_0xb504('0x1d');var _0x3598bf=_0x36e5b8[_0xb504('0x1e')];var _0x48e52d=_0x295136?0x0:_0x4f57c4[_0xb504('0x1c')];var _0x38b1c2=_0x295136?_0x36e5b8[_0xb504('0x1e')]:_0x4f57c4[_0xb504('0x1c')]+_0x4f57c4[_0xb504('0x1f')];var _0x595abe;if(_0x38b1c2>=_0x3598bf){_0x38b1c2=_0x3598bf;_0x595abe=0xc8;}else{_0x595abe=0xce;}_0x1d182a[_0xb504('0x1a')](_0x595abe);return _0x1d182a[_0xb504('0x20')](_0xb504('0x21'),_0x48e52d+'-'+_0x38b1c2+'/'+_0x3598bf)[_0xb504('0x22')](_0x36e5b8);}return null;};}function patchUpdates(_0x9efbaa){return function(_0x56a97b){try{jsonpatch[_0xb504('0x23')](_0x56a97b,_0x9efbaa,!![]);}catch(_0x239748){return BPromise['reject'](_0x239748);}return _0x56a97b[_0xb504('0x24')]();};}function saveUpdates(_0x4fa1d9,_0x3f6b9d){return function(_0x29d333){if(_0x29d333){return _0x29d333[_0xb504('0x25')](_0x4fa1d9)[_0xb504('0x26')](function(_0x2142c8){return _0x2142c8;});}return null;};}function removeEntity(_0x472348,_0x4bf1d3){return function(_0x89f593){if(_0x89f593){return _0x89f593['destroy']()[_0xb504('0x26')](function(){_0x472348['status'](0xcc)[_0xb504('0x1b')]();});}};}function handleEntityNotFound(_0x4e68b0,_0x548c61){return function(_0x302cb0){if(!_0x302cb0){_0x4e68b0[_0xb504('0x27')](0x194);}return _0x302cb0;};}function handleError(_0x2ac70c,_0x593944){_0x593944=_0x593944||0x1f4;return function(_0x492255){logger[_0xb504('0x28')](_0x492255[_0xb504('0x29')]);if(_0x492255[_0xb504('0x2a')]){delete _0x492255['name'];}_0x2ac70c[_0xb504('0x1a')](_0x593944)['send'](_0x492255);};}exports[_0xb504('0x2b')]=function(_0x6abc9e,_0x11feef){var _0x1a8e61={},_0x31bb4f={},_0x29d9a9={'count':0x0,'rows':[]};var _0x164ac8=_[_0xb504('0x2c')](db[_0xb504('0x2d')]['rawAttributes'],function(_0x29d25c){return{'name':_0x29d25c['fieldName'],'type':_0x29d25c[_0xb504('0x2e')][_0xb504('0x2f')]};});_0x31bb4f[_0xb504('0x30')]=_[_0xb504('0x2c')](_0x164ac8,_0xb504('0x2a'));_0x31bb4f[_0xb504('0x31')]=_[_0xb504('0x32')](_0x6abc9e['query']);_0x31bb4f[_0xb504('0x33')]=_[_0xb504('0x34')](_0x31bb4f['model'],_0x31bb4f[_0xb504('0x31')]);_0x1a8e61['attributes']=_['intersection'](_0x31bb4f[_0xb504('0x30')],qs['fields'](_0x6abc9e[_0xb504('0x31')]['fields']));_0x1a8e61[_0xb504('0x35')]=_0x1a8e61[_0xb504('0x35')]['length']?_0x1a8e61['attributes']:_0x31bb4f[_0xb504('0x30')];if(!_0x6abc9e['query'][_0xb504('0x36')](_0xb504('0x37'))){_0x1a8e61[_0xb504('0x1f')]=qs[_0xb504('0x1f')](_0x6abc9e[_0xb504('0x31')][_0xb504('0x1f')]);_0x1a8e61[_0xb504('0x1c')]=qs['offset'](_0x6abc9e[_0xb504('0x31')][_0xb504('0x1c')]);}_0x1a8e61[_0xb504('0x38')]=qs['sort'](_0x6abc9e[_0xb504('0x31')]['sort']);_0x1a8e61[_0xb504('0x39')]=qs[_0xb504('0x33')](_[_0xb504('0x3a')](_0x6abc9e[_0xb504('0x31')],_0x31bb4f[_0xb504('0x33')]),_0x164ac8);if(_0x6abc9e['query'][_0xb504('0x3b')]){_0x1a8e61[_0xb504('0x39')]=_['merge'](_0x1a8e61[_0xb504('0x39')],{'$or':_[_0xb504('0x2c')](_0x164ac8,function(_0x3fb7f8){if(_0x3fb7f8[_0xb504('0x2e')]!==_0xb504('0x3c')){var _0x2ebe71={};_0x2ebe71[_0x3fb7f8['name']]={'$like':'%'+_0x6abc9e[_0xb504('0x31')][_0xb504('0x3b')]+'%'};return _0x2ebe71;}})});}_0x1a8e61=_['merge']({},_0x1a8e61,_0x6abc9e[_0xb504('0x3d')]);var _0x3b7dd0={'where':_0x1a8e61[_0xb504('0x39')]};return db[_0xb504('0x2d')]['count'](_0x3b7dd0)[_0xb504('0x26')](function(_0x515e4a){_0x29d9a9[_0xb504('0x1e')]=_0x515e4a;if(_0x6abc9e['query'][_0xb504('0x3e')]){_0x1a8e61[_0xb504('0x3f')]=[{'all':!![]}];}return db[_0xb504('0x2d')][_0xb504('0x40')](_0x1a8e61);})[_0xb504('0x26')](function(_0x5b845e){_0x29d9a9[_0xb504('0x41')]=_0x5b845e;return _0x29d9a9;})[_0xb504('0x26')](respondWithFilteredResult(_0x11feef,_0x1a8e61))[_0xb504('0x42')](handleError(_0x11feef,null));};exports[_0xb504('0x43')]=function(_0x47d6eb,_0x17c99d){var _0xb03a1d={'raw':![],'where':{'id':_0x47d6eb[_0xb504('0x44')]['id']}},_0x2153f4={};_0x2153f4[_0xb504('0x30')]=_[_0xb504('0x32')](db[_0xb504('0x2d')][_0xb504('0x45')]);_0x2153f4[_0xb504('0x31')]=_['keys'](_0x47d6eb[_0xb504('0x31')]);_0x2153f4[_0xb504('0x33')]=_[_0xb504('0x34')](_0x2153f4[_0xb504('0x30')],_0x2153f4[_0xb504('0x31')]);_0xb03a1d[_0xb504('0x35')]=_[_0xb504('0x34')](_0x2153f4[_0xb504('0x30')],qs[_0xb504('0x46')](_0x47d6eb['query']['fields']));_0xb03a1d['attributes']=_0xb03a1d[_0xb504('0x35')][_0xb504('0x47')]?_0xb03a1d[_0xb504('0x35')]:_0x2153f4[_0xb504('0x30')];if(_0x47d6eb[_0xb504('0x31')][_0xb504('0x3e')]){_0xb03a1d[_0xb504('0x3f')]=[{'all':!![]}];}_0xb03a1d=_[_0xb504('0x48')]({},_0xb03a1d,_0x47d6eb[_0xb504('0x3d')]);return db['AnalyticFieldReport'][_0xb504('0x49')](_0xb03a1d)[_0xb504('0x26')](handleEntityNotFound(_0x17c99d,null))[_0xb504('0x26')](respondWithResult(_0x17c99d,null))[_0xb504('0x42')](handleError(_0x17c99d,null));};exports[_0xb504('0x4a')]=function(_0x35b7e5,_0xdcb972){return db[_0xb504('0x2d')][_0xb504('0x4a')](_0x35b7e5['body'],{})['then'](respondWithResult(_0xdcb972,0xc9))[_0xb504('0x42')](handleError(_0xdcb972,null));};exports[_0xb504('0x4b')]=function(_0x3c391a,_0x369a14){return db[_0xb504('0x2d')][_0xb504('0x4b')](_0x3c391a['body'],{'raw':![],'individualHooks':!![]})[_0xb504('0x26')](respondWithResult(_0x369a14,0xc9))[_0xb504('0x42')](handleError(_0x369a14,null));};exports[_0xb504('0x25')]=function(_0x4720fa,_0xa1cf48){if(_0x4720fa[_0xb504('0x4c')]['id']){delete _0x4720fa[_0xb504('0x4c')]['id'];}return db[_0xb504('0x2d')]['find']({'where':{'id':_0x4720fa['params']['id']}})[_0xb504('0x26')](handleEntityNotFound(_0xa1cf48,null))[_0xb504('0x26')](saveUpdates(_0x4720fa[_0xb504('0x4c')],null))['then'](respondWithResult(_0xa1cf48,null))[_0xb504('0x42')](handleError(_0xa1cf48,null));};exports[_0xb504('0x4d')]=function(_0x18a2ab,_0xa71fd7){return db[_0xb504('0x2d')][_0xb504('0x49')]({'where':{'id':_0x18a2ab[_0xb504('0x44')]['id']}})['then'](handleEntityNotFound(_0xa71fd7,null))[_0xb504('0x26')](removeEntity(_0xa71fd7,null))[_0xb504('0x42')](handleError(_0xa71fd7,null));};exports['bulkDestroy']=function(_0x53c700,_0x37faff){return db[_0xb504('0x2d')][_0xb504('0x4d')]({'where':{'id':_0x53c700[_0xb504('0x31')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x37faff,0xcc))['catch'](handleError(_0x37faff,null));};exports[_0xb504('0x4e')]=function(_0x107c25,_0x3075fe,_0x4aee0c){return db[_0xb504('0x4f')][_0xb504('0x50')]({'where':{'id':_0x107c25[_0xb504('0x44')]['id']}})[_0xb504('0x26')](handleEntityNotFound(_0x3075fe,null))[_0xb504('0x26')](function(_0x18849b){if(_0x18849b){return db[_0xb504('0x51')][_0xb504('0x52')](function(_0x23b64f){return db[_0xb504('0x2d')][_0xb504('0x4d')]({'where':{'CustomReportId':_0x107c25[_0xb504('0x44')]['id']},'transaction':_0x23b64f})[_0xb504('0x26')](function(_0x32cecd){var _0x2720f9=_[_0xb504('0x2c')](_0x107c25[_0xb504('0x4c')],function(_0x220739){delete _0x220739['id'];_0x220739[_0xb504('0x53')]=_0x107c25[_0xb504('0x44')]['id'];return _0x220739;});return db[_0xb504('0x2d')][_0xb504('0x4b')](_0x2720f9,{'transaction':_0x23b64f});});})[_0xb504('0x26')](function(){return db[_0xb504('0x2d')]['findAll']({'where':{'CustomReportId':_0x107c25['params']['id']}});});}})[_0xb504('0x26')](respondWithResult(_0x3075fe,null))['catch'](handleError(_0x3075fe,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index bf63d57..4b81a73 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 _0xeb9a=['bluebird','path','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x27e0c0,_0x35ae92){var _0xebc02b=function(_0x5a207c){while(--_0x5a207c){_0x27e0c0['push'](_0x27e0c0['shift']());}};_0xebc02b(++_0x35ae92);}(_0xeb9a,0x7e));var _0xaeb9=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xeb9a[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xaeb9('0x0'));var util=require('util');var logger=require(_0xaeb9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaeb9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb9('0x3'));var rimraf=require('rimraf');var config=require(_0xaeb9('0x4'));var attributes=require(_0xaeb9('0x5'));module['exports']=function(_0x2fb9d7,_0x43ae9d){return _0x2fb9d7['define'](_0xaeb9('0x6'),attributes,{'tableName':_0xaeb9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24bf=['request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','util','../../config/logger','api','moment','bluebird'];(function(_0x2998db,_0x3424f1){var _0x115fea=function(_0x3b493c){while(--_0x3b493c){_0x2998db['push'](_0x2998db['shift']());}};_0x115fea(++_0x3424f1);}(_0x24bf,0x1ab));var _0xf24b=function(_0x123935,_0x1670ba){_0x123935=_0x123935-0x0;var _0x1a8ebf=_0x24bf[_0x123935];return _0x1a8ebf;};'use strict';var _=require('lodash');var util=require(_0xf24b('0x0'));var logger=require(_0xf24b('0x1'))(_0xf24b('0x2'));var moment=require(_0xf24b('0x3'));var BPromise=require(_0xf24b('0x4'));var rp=require(_0xf24b('0x5'));var fs=require('fs');var path=require(_0xf24b('0x6'));var rimraf=require('rimraf');var config=require(_0xf24b('0x7'));var attributes=require(_0xf24b('0x8'));module[_0xf24b('0x9')]=function(_0x1be7ba,_0x5ad218){return _0x1be7ba[_0xf24b('0xa')](_0xf24b('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 72316f2..2e7fa8c 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 _0x4255=['request','then','request\x20sent','debug','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x4255,0x1a8));var _0x5425=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x4255[_0x318840];return _0x223da4;};'use strict';var _=require(_0x5425('0x0'));var util=require(_0x5425('0x1'));var moment=require(_0x5425('0x2'));var BPromise=require(_0x5425('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5425('0x4'));var db=require(_0x5425('0x5'))['db'];var utils=require(_0x5425('0x6'));var logger=require(_0x5425('0x7'))(_0x5425('0x8'));var config=require(_0x5425('0x9'));var jayson=require(_0x5425('0xa'));var client=jayson[_0x5425('0xb')][_0x5425('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x257ac6,_0xf048d2,_0x4101f6){return new BPromise(function(_0x28a486,_0x1dd752){return client[_0x5425('0xd')](_0x257ac6,_0x4101f6)[_0x5425('0xe')](function(_0x5c7291){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'));logger[_0x5425('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'),JSON[_0x5425('0x11')](_0x5c7291));if(_0x5c7291[_0x5425('0x12')]){if(_0x5c7291[_0x5425('0x12')]['code']===0x1f4){logger[_0x5425('0x12')](_0x5425('0x13'),_0xf048d2,_0x5c7291['error'][_0x5425('0x14')]);return _0x1dd752(_0x5c7291[_0x5425('0x12')][_0x5425('0x14')]);}logger[_0x5425('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5c7291[_0x5425('0x12')]['message']);return _0x28a486(_0x5c7291[_0x5425('0x12')][_0x5425('0x14')]);}else{logger[_0x5425('0x15')]('AnalyticFieldReport,\x20%s,\x20%s',_0xf048d2,_0x5425('0xf'));_0x28a486(_0x5c7291[_0x5425('0x16')][_0x5425('0x14')]);}})['catch'](function(_0x37c791){logger[_0x5425('0x12')](_0x5425('0x13'),_0xf048d2,_0x37c791);_0x1dd752(_0x37c791);});});} \ No newline at end of file +var _0x0a09=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x0a09,0xc9));var _0x90a0=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0x0a09[_0x5dee2a];return _0x31e98e;};'use strict';var _=require(_0x90a0('0x0'));var util=require(_0x90a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90a0('0x2'))['db'];var utils=require(_0x90a0('0x3'));var logger=require('../../config/logger')(_0x90a0('0x4'));var config=require(_0x90a0('0x5'));var jayson=require(_0x90a0('0x6'));var client=jayson[_0x90a0('0x7')][_0x90a0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6f8fda,_0x3d008c,_0x46b177){return new BPromise(function(_0x444d0d,_0x5395d5){return client[_0x90a0('0x9')](_0x6f8fda,_0x46b177)[_0x90a0('0xa')](function(_0x4962c1){logger[_0x90a0('0xb')](_0x90a0('0xc'),_0x3d008c,_0x90a0('0xd'));logger[_0x90a0('0xe')](_0x90a0('0xf'),_0x3d008c,'request\x20sent',JSON[_0x90a0('0x10')](_0x4962c1));if(_0x4962c1[_0x90a0('0x11')]){if(_0x4962c1[_0x90a0('0x11')]['code']===0x1f4){logger[_0x90a0('0x11')](_0x90a0('0xc'),_0x3d008c,_0x4962c1[_0x90a0('0x11')][_0x90a0('0x12')]);return _0x5395d5(_0x4962c1[_0x90a0('0x11')][_0x90a0('0x12')]);}logger[_0x90a0('0x11')](_0x90a0('0xc'),_0x3d008c,_0x4962c1[_0x90a0('0x11')]['message']);return _0x444d0d(_0x4962c1[_0x90a0('0x11')]['message']);}else{logger[_0x90a0('0xb')](_0x90a0('0xc'),_0x3d008c,_0x90a0('0xd'));_0x444d0d(_0x4962c1[_0x90a0('0x13')]['message']);}})[_0x90a0('0x14')](function(_0x5bd3f5){logger[_0x90a0('0x11')](_0x90a0('0xc'),_0x3d008c,_0x5bd3f5);_0x5395d5(_0x5bd3f5);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fc32696..a55aace 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(_0x1c9f10,_0x168c27){var _0x5f1900=function(_0x123ac7){while(--_0x123ac7){_0x1c9f10['push'](_0x1c9f10['shift']());}};_0x5f1900(++_0x168c27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_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 e0d72aa..ae95fd6 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 _0x8482=['name','TEXT','exports','STRING'];(function(_0x297d2a,_0x2e6e66){var _0x5f411d=function(_0x54d6e8){while(--_0x54d6e8){_0x297d2a['push'](_0x297d2a['shift']());}};_0x5f411d(++_0x2e6e66);}(_0x8482,0x14e));var _0x2848=function(_0x1390ed,_0xee1253){_0x1390ed=_0x1390ed-0x0;var _0x26f4f8=_0x8482[_0x1390ed];return _0x26f4f8;};'use strict';var Sequelize=require('sequelize');module[_0x2848('0x0')]={'name':{'type':Sequelize[_0x2848('0x1')],'allowNull':![],'unique':_0x2848('0x2')},'table':{'type':Sequelize[_0x2848('0x1')]},'metric':{'type':Sequelize[_0x2848('0x3')]},'description':{'type':Sequelize[_0x2848('0x1')]}}; \ No newline at end of file +var _0x235a=['sequelize','exports','STRING'];(function(_0x20ac53,_0x36b359){var _0x52989a=function(_0x5814fa){while(--_0x5814fa){_0x20ac53['push'](_0x20ac53['shift']());}};_0x52989a(++_0x36b359);}(_0x235a,0x1ef));var _0xa235=function(_0x369633,_0x1e75a7){_0x369633=_0x369633-0x0;var _0x45ccd2=_0x235a[_0x369633];return _0x45ccd2;};'use strict';var Sequelize=require(_0xa235('0x0'));module[_0xa235('0x1')]={'name':{'type':Sequelize[_0xa235('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xa235('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xa235('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2a15aaf..d4974d8 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 _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x6aa7,0x178));var _0x76aa=function(_0x36af89,_0x5c0018){_0x36af89=_0x36af89-0x0;var _0x118b16=_0x6aa7[_0x36af89];return _0x118b16;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x29e54f,_0x33535a){var _0x4c619f=function(_0xc98342){while(--_0xc98342){_0x29e54f['push'](_0x29e54f['shift']());}};_0x4c619f(++_0x33535a);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x599cb1,_0x1206ca){_0x599cb1=_0x599cb1-0x0;var _0x2c0d60=_0x9c5a[_0x599cb1];return _0x2c0d60;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b0c1cd3..ef2c701 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 _0x9485=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','bluebird'];(function(_0x519459,_0x327088){var _0x303f78=function(_0x49ba17){while(--_0x49ba17){_0x519459['push'](_0x519459['shift']());}};_0x303f78(++_0x327088);}(_0x9485,0x8b));var _0x5948=function(_0x476d80,_0x29e526){_0x476d80=_0x476d80-0x0;var _0x3d183d=_0x9485[_0x476d80];return _0x3d183d;};'use strict';var _=require(_0x5948('0x0'));var util=require(_0x5948('0x1'));var logger=require(_0x5948('0x2'))(_0x5948('0x3'));var moment=require('moment');var BPromise=require(_0x5948('0x4'));var rp=require(_0x5948('0x5'));var fs=require('fs');var path=require(_0x5948('0x6'));var rimraf=require('rimraf');var config=require(_0x5948('0x7'));var attributes=require(_0x5948('0x8'));module[_0x5948('0x9')]=function(_0x4312a8,_0x19ccdd){return _0x4312a8[_0x5948('0xa')]('AnalyticMetric',attributes,{'tableName':_0x5948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bfc=['exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','path','../../config/environment','./analyticMetric.attributes'];(function(_0x3ef96c,_0xdfd9e0){var _0x3ea47f=function(_0x349edb){while(--_0x349edb){_0x3ef96c['push'](_0x3ef96c['shift']());}};_0x3ea47f(++_0xdfd9e0);}(_0x6bfc,0x159));var _0xc6bf=function(_0x26a96a,_0x383520){_0x26a96a=_0x26a96a-0x0;var _0x2c51ad=_0x6bfc[_0x26a96a];return _0x2c51ad;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var logger=require(_0xc6bf('0x1'))(_0xc6bf('0x2'));var moment=require('moment');var BPromise=require(_0xc6bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6bf('0x4'));var rimraf=require('rimraf');var config=require(_0xc6bf('0x5'));var attributes=require(_0xc6bf('0x6'));module[_0xc6bf('0x7')]=function(_0x4a999e,_0x27a5d9){return _0x4a999e[_0xc6bf('0x8')](_0xc6bf('0x9'),attributes,{'tableName':_0xc6bf('0xa'),'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 d7140d4..4ba7390 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 _0x9327=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x9327,0x1be));var _0x7932=function(_0x18ce11,_0x24c013){_0x18ce11=_0x18ce11-0x0;var _0x3ecc18=_0x9327[_0x18ce11];return _0x3ecc18;};'use strict';var _=require(_0x7932('0x0'));var util=require(_0x7932('0x1'));var moment=require(_0x7932('0x2'));var BPromise=require(_0x7932('0x3'));var rs=require(_0x7932('0x4'));var fs=require('fs');var Redis=require(_0x7932('0x5'));var db=require(_0x7932('0x6'))['db'];var utils=require(_0x7932('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7932('0x8'));var jayson=require(_0x7932('0x9'));var client=jayson[_0x7932('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29f683,_0x528003,_0x2158a7){return new BPromise(function(_0x4d4fd5,_0x58c986){return client[_0x7932('0xb')](_0x29f683,_0x2158a7)[_0x7932('0xc')](function(_0x365de0){logger[_0x7932('0xd')](_0x7932('0xe'),_0x528003,_0x7932('0xf'));logger[_0x7932('0x10')](_0x7932('0x11'),_0x528003,_0x7932('0xf'),JSON[_0x7932('0x12')](_0x365de0));if(_0x365de0[_0x7932('0x13')]){if(_0x365de0[_0x7932('0x13')]['code']===0x1f4){logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x365de0[_0x7932('0x13')]['message']);return _0x58c986(_0x365de0[_0x7932('0x13')][_0x7932('0x14')]);}logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x365de0['error'][_0x7932('0x14')]);return _0x4d4fd5(_0x365de0[_0x7932('0x13')][_0x7932('0x14')]);}else{logger[_0x7932('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x528003,_0x7932('0xf'));_0x4d4fd5(_0x365de0[_0x7932('0x15')][_0x7932('0x14')]);}})[_0x7932('0x16')](function(_0x112890){logger[_0x7932('0x13')](_0x7932('0xe'),_0x528003,_0x112890);_0x58c986(_0x112890);});});} \ No newline at end of file +var _0x15f2=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4433ad,_0x212563){var _0x2688c5=function(_0xc05888){while(--_0xc05888){_0x4433ad['push'](_0x4433ad['shift']());}};_0x2688c5(++_0x212563);}(_0x15f2,0x103));var _0x215f=function(_0xb400ce,_0x51e8dc){_0xb400ce=_0xb400ce-0x0;var _0x50b4bc=_0x15f2[_0xb400ce];return _0x50b4bc;};'use strict';var _=require(_0x215f('0x0'));var util=require(_0x215f('0x1'));var moment=require(_0x215f('0x2'));var BPromise=require(_0x215f('0x3'));var rs=require(_0x215f('0x4'));var fs=require('fs');var Redis=require(_0x215f('0x5'));var db=require(_0x215f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x215f('0x7'))(_0x215f('0x8'));var config=require('../../config/environment');var jayson=require(_0x215f('0x9'));var client=jayson[_0x215f('0xa')][_0x215f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db208,_0x168deb,_0x2ae000){return new BPromise(function(_0x4a088,_0x50d03b){return client[_0x215f('0xc')](_0x5db208,_0x2ae000)['then'](function(_0x5a34b6){logger[_0x215f('0xd')](_0x215f('0xe'),_0x168deb,_0x215f('0xf'));logger[_0x215f('0x10')](_0x215f('0x11'),_0x168deb,'request\x20sent',JSON['stringify'](_0x5a34b6));if(_0x5a34b6[_0x215f('0x12')]){if(_0x5a34b6[_0x215f('0x12')][_0x215f('0x13')]===0x1f4){logger['error'](_0x215f('0xe'),_0x168deb,_0x5a34b6['error'][_0x215f('0x14')]);return _0x50d03b(_0x5a34b6['error'][_0x215f('0x14')]);}logger[_0x215f('0x12')](_0x215f('0xe'),_0x168deb,_0x5a34b6[_0x215f('0x12')][_0x215f('0x14')]);return _0x4a088(_0x5a34b6['error'][_0x215f('0x14')]);}else{logger[_0x215f('0xd')](_0x215f('0xe'),_0x168deb,_0x215f('0xf'));_0x4a088(_0x5a34b6['result']['message']);}})[_0x215f('0x15')](function(_0x125705){logger[_0x215f('0x12')](_0x215f('0xe'),_0x168deb,_0x125705);_0x50d03b(_0x125705);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0115527..a8c70f0 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 _0x1ffe=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5cfa2b,_0x5b9ee9){var _0x3bf9d2=function(_0x49f969){while(--_0x49f969){_0x5cfa2b['push'](_0x5cfa2b['shift']());}};_0x3bf9d2(++_0x5b9ee9);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x40f881,_0x341766){_0x40f881=_0x40f881-0x0;var _0x1fc947=_0x1ffe[_0x40f881];return _0x1fc947;};'use strict';var multer=require(_0xe1ff('0x0'));var util=require(_0xe1ff('0x1'));var path=require(_0xe1ff('0x2'));var timeout=require(_0xe1ff('0x3'));var express=require(_0xe1ff('0x4'));var router=express[_0xe1ff('0x5')]();var fs_extra=require(_0xe1ff('0x6'));var auth=require(_0xe1ff('0x7'));var interaction=require(_0xe1ff('0x8'));var config=require(_0xe1ff('0x9'));var controller=require(_0xe1ff('0xa'));router[_0xe1ff('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1ff('0xb')](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0xe')]);router[_0xe1ff('0xf')]('/',auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x10')]);router[_0xe1ff('0x11')](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x12')]);router['delete'](_0xe1ff('0xc'),auth[_0xe1ff('0xd')](),controller[_0xe1ff('0x13')]);module[_0xe1ff('0x14')]=router; \ No newline at end of file +var _0xb5bb=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','isAuthenticated'];(function(_0x46bc2f,_0x57f4b0){var _0x5760c5=function(_0x296a99){while(--_0x296a99){_0x46bc2f['push'](_0x46bc2f['shift']());}};_0x5760c5(++_0x57f4b0);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x449b41,_0x71feab){_0x449b41=_0x449b41-0x0;var _0x15ef26=_0xb5bb[_0x449b41];return _0x15ef26;};'use strict';var multer=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var path=require(_0xbb5b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb5b('0x3'));var router=express[_0xbb5b('0x4')]();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('./analyticMetric.controller');router['get']('/',auth[_0xbb5b('0x5')](),controller[_0xbb5b('0x6')]);router['get'](_0xbb5b('0x7'),auth[_0xbb5b('0x5')](),controller[_0xbb5b('0x8')]);router[_0xbb5b('0x9')]('/',auth[_0xbb5b('0x5')](),controller[_0xbb5b('0xa')]);router[_0xbb5b('0xb')](_0xbb5b('0x7'),auth[_0xbb5b('0x5')](),controller[_0xbb5b('0xc')]);router[_0xbb5b('0xd')](_0xbb5b('0x7'),auth[_0xbb5b('0x5')](),controller[_0xbb5b('0xe')]);module[_0xbb5b('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 2064b67..3d7a333 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 _0x5197=['sequelize','exports','TEXT'];(function(_0x3afc52,_0x3d4196){var _0x4d0792=function(_0x412066){while(--_0x412066){_0x3afc52['push'](_0x3afc52['shift']());}};_0x4d0792(++_0x3d4196);}(_0x5197,0x19b));var _0x7519=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5197[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x7519('0x0'));module[_0x7519('0x1')]={'tree':{'type':Sequelize[_0x7519('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfbdd=['TEXT','sequelize','exports'];(function(_0x202e7e,_0xf84615){var _0x157528=function(_0x15811a){while(--_0x15811a){_0x202e7e['push'](_0x202e7e['shift']());}};_0x157528(++_0xf84615);}(_0xfbdd,0xe2));var _0xdfbd=function(_0x6cdca5,_0x35f359){_0x6cdca5=_0x6cdca5-0x0;var _0x34d64c=_0xfbdd[_0x6cdca5];return _0x34d64c;};'use strict';var Sequelize=require(_0xdfbd('0x0'));module[_0xdfbd('0x1')]={'tree':{'type':Sequelize[_0xdfbd('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 6c422ae..ecfc1d3 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 _0xa5a5=['filter','merge','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','name','send','map','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick'];(function(_0x2fa32b,_0x181a36){var _0x25f18c=function(_0x4ec865){while(--_0x4ec865){_0x2fa32b['push'](_0x2fa32b['shift']());}};_0x25f18c(++_0x181a36);}(_0xa5a5,0xe5));var _0x5a5a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa5a5[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x5a5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5a5a('0x2'));var BPromise=require(_0x5a5a('0x3'));var Mustache=require(_0x5a5a('0x4'));var util=require(_0x5a5a('0x5'));var path=require(_0x5a5a('0x6'));var sox=require(_0x5a5a('0x7'));var csv=require(_0x5a5a('0x8'));var ejs=require(_0x5a5a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a5a('0xa'));var squel=require(_0x5a5a('0xb'));var crypto=require(_0x5a5a('0xc'));var jsforce=require(_0x5a5a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a5a('0xe'));var Papa=require('papaparse');var Redis=require(_0x5a5a('0xf'));var authService=require(_0x5a5a('0x10'));var qs=require(_0x5a5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a5a('0x12'))(_0x5a5a('0x13'));var utils=require('../../config/utils');var config=require(_0x5a5a('0x14'));var licenseUtil=require(_0x5a5a('0x15'));var db=require(_0x5a5a('0x16'))['db'];function respondWithStatusCode(_0xc043a6,_0x1744e5){_0x1744e5=_0x1744e5||0xcc;return function(_0x19fbf4){if(_0x19fbf4){return _0xc043a6[_0x5a5a('0x17')](_0x1744e5);}return _0xc043a6[_0x5a5a('0x18')](_0x1744e5)[_0x5a5a('0x19')]();};}function respondWithResult(_0x592a26,_0x47ace5){_0x47ace5=_0x47ace5||0xc8;return function(_0x562b7f){if(_0x562b7f){return _0x592a26[_0x5a5a('0x18')](_0x47ace5)['json'](_0x562b7f);}};}function respondWithFilteredResult(_0x3d05ff,_0x166d1e){return function(_0xe84150){if(_0xe84150){var _0x44feb3=typeof _0x166d1e[_0x5a5a('0x1a')]==='undefined'&&typeof _0x166d1e[_0x5a5a('0x1b')]===_0x5a5a('0x1c');var _0x10ee18=_0xe84150[_0x5a5a('0x1d')];var _0x1b496=_0x44feb3?0x0:_0x166d1e[_0x5a5a('0x1a')];var _0x23fd1c=_0x44feb3?_0xe84150['count']:_0x166d1e[_0x5a5a('0x1a')]+_0x166d1e[_0x5a5a('0x1b')];var _0x223d4d;if(_0x23fd1c>=_0x10ee18){_0x23fd1c=_0x10ee18;_0x223d4d=0xc8;}else{_0x223d4d=0xce;}_0x3d05ff[_0x5a5a('0x18')](_0x223d4d);return _0x3d05ff[_0x5a5a('0x1e')](_0x5a5a('0x1f'),_0x1b496+'-'+_0x23fd1c+'/'+_0x10ee18)[_0x5a5a('0x20')](_0xe84150);}return null;};}function patchUpdates(_0x1ac5c4){return function(_0x4389f2){try{jsonpatch[_0x5a5a('0x21')](_0x4389f2,_0x1ac5c4,!![]);}catch(_0x330972){return BPromise['reject'](_0x330972);}return _0x4389f2[_0x5a5a('0x22')]();};}function saveUpdates(_0x199f1a,_0x38355b){return function(_0x3e06c5){if(_0x3e06c5){return _0x3e06c5['update'](_0x199f1a)[_0x5a5a('0x23')](function(_0x33a86c){return _0x33a86c;});}return null;};}function removeEntity(_0x21192c,_0x30da98){return function(_0x195a0c){if(_0x195a0c){return _0x195a0c[_0x5a5a('0x24')]()['then'](function(){_0x21192c['status'](0xcc)[_0x5a5a('0x19')]();});}};}function handleEntityNotFound(_0x4cd27f,_0x284478){return function(_0xab1d9e){if(!_0xab1d9e){_0x4cd27f['sendStatus'](0x194);}return _0xab1d9e;};}function handleError(_0x1a0a5b,_0x1ac391){_0x1ac391=_0x1ac391||0x1f4;return function(_0x5a538f){logger[_0x5a5a('0x25')](_0x5a538f['stack']);if(_0x5a538f[_0x5a5a('0x26')]){delete _0x5a538f[_0x5a5a('0x26')];}_0x1a0a5b['status'](_0x1ac391)[_0x5a5a('0x27')](_0x5a538f);};}exports['index']=function(_0x3326d2,_0x59d653){var _0x45f27a={},_0x3c4ea1={},_0xecabdf={'count':0x0,'rows':[]};var _0x4598a8=_[_0x5a5a('0x28')](db['AnalyticTreeReport'][_0x5a5a('0x29')],function(_0x4174fb){return{'name':_0x4174fb['fieldName'],'type':_0x4174fb['type']['key']};});_0x3c4ea1[_0x5a5a('0x2a')]=_['map'](_0x4598a8,'name');_0x3c4ea1[_0x5a5a('0x2b')]=_[_0x5a5a('0x2c')](_0x3326d2[_0x5a5a('0x2b')]);_0x3c4ea1[_0x5a5a('0x2d')]=_[_0x5a5a('0x2e')](_0x3c4ea1[_0x5a5a('0x2a')],_0x3c4ea1[_0x5a5a('0x2b')]);_0x45f27a['attributes']=_['intersection'](_0x3c4ea1[_0x5a5a('0x2a')],qs[_0x5a5a('0x2f')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x2f')]));_0x45f27a['attributes']=_0x45f27a[_0x5a5a('0x30')][_0x5a5a('0x31')]?_0x45f27a['attributes']:_0x3c4ea1[_0x5a5a('0x2a')];if(!_0x3326d2[_0x5a5a('0x2b')]['hasOwnProperty'](_0x5a5a('0x32'))){_0x45f27a[_0x5a5a('0x1b')]=qs[_0x5a5a('0x1b')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x1b')]);_0x45f27a[_0x5a5a('0x1a')]=qs[_0x5a5a('0x1a')](_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x1a')]);}_0x45f27a[_0x5a5a('0x33')]=qs[_0x5a5a('0x34')](_0x3326d2[_0x5a5a('0x2b')]['sort']);_0x45f27a[_0x5a5a('0x35')]=qs[_0x5a5a('0x2d')](_[_0x5a5a('0x36')](_0x3326d2['query'],_0x3c4ea1[_0x5a5a('0x2d')]),_0x4598a8);if(_0x3326d2['query'][_0x5a5a('0x37')]){_0x45f27a[_0x5a5a('0x35')]=_[_0x5a5a('0x38')](_0x45f27a['where'],{'$or':_[_0x5a5a('0x28')](_0x4598a8,function(_0x2bb704){if(_0x2bb704['type']!==_0x5a5a('0x39')){var _0x5bc3fe={};_0x5bc3fe[_0x2bb704['name']]={'$like':'%'+_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x37')]+'%'};return _0x5bc3fe;}})});}_0x45f27a=_[_0x5a5a('0x38')]({},_0x45f27a,_0x3326d2[_0x5a5a('0x3a')]);var _0x41044b={'where':_0x45f27a[_0x5a5a('0x35')]};return db[_0x5a5a('0x3b')]['count'](_0x41044b)[_0x5a5a('0x23')](function(_0x1aaa49){_0xecabdf[_0x5a5a('0x1d')]=_0x1aaa49;if(_0x3326d2[_0x5a5a('0x2b')][_0x5a5a('0x3c')]){_0x45f27a[_0x5a5a('0x3d')]=[{'all':!![]}];}return db[_0x5a5a('0x3b')][_0x5a5a('0x3e')](_0x45f27a);})[_0x5a5a('0x23')](function(_0x5d44e5){_0xecabdf[_0x5a5a('0x3f')]=_0x5d44e5;return _0xecabdf;})['then'](respondWithFilteredResult(_0x59d653,_0x45f27a))[_0x5a5a('0x40')](handleError(_0x59d653,null));};exports[_0x5a5a('0x41')]=function(_0x401aa4,_0x4941fb){var _0x4b206b={'raw':!![],'where':{'id':_0x401aa4[_0x5a5a('0x42')]['id']}},_0x1fd4fa={};_0x1fd4fa[_0x5a5a('0x2a')]=_[_0x5a5a('0x2c')](db[_0x5a5a('0x3b')][_0x5a5a('0x29')]);_0x1fd4fa[_0x5a5a('0x2b')]=_['keys'](_0x401aa4[_0x5a5a('0x2b')]);_0x1fd4fa[_0x5a5a('0x2d')]=_[_0x5a5a('0x2e')](_0x1fd4fa[_0x5a5a('0x2a')],_0x1fd4fa[_0x5a5a('0x2b')]);_0x4b206b[_0x5a5a('0x30')]=_[_0x5a5a('0x2e')](_0x1fd4fa[_0x5a5a('0x2a')],qs[_0x5a5a('0x2f')](_0x401aa4[_0x5a5a('0x2b')]['fields']));_0x4b206b[_0x5a5a('0x30')]=_0x4b206b[_0x5a5a('0x30')][_0x5a5a('0x31')]?_0x4b206b[_0x5a5a('0x30')]:_0x1fd4fa[_0x5a5a('0x2a')];if(_0x401aa4['query'][_0x5a5a('0x3c')]){_0x4b206b[_0x5a5a('0x3d')]=[{'all':!![]}];}_0x4b206b=_[_0x5a5a('0x38')]({},_0x4b206b,_0x401aa4[_0x5a5a('0x3a')]);return db['AnalyticTreeReport'][_0x5a5a('0x43')](_0x4b206b)[_0x5a5a('0x23')](handleEntityNotFound(_0x4941fb,null))[_0x5a5a('0x23')](respondWithResult(_0x4941fb,null))[_0x5a5a('0x40')](handleError(_0x4941fb,null));};exports[_0x5a5a('0x44')]=function(_0x22dde0,_0x4a917f){return db[_0x5a5a('0x3b')][_0x5a5a('0x44')](_0x22dde0['body'],{})[_0x5a5a('0x23')](respondWithResult(_0x4a917f,0xc9))['catch'](handleError(_0x4a917f,null));};exports[_0x5a5a('0x45')]=function(_0x2ac22c,_0x158ea1){if(_0x2ac22c[_0x5a5a('0x46')]['id']){delete _0x2ac22c['body']['id'];}return db[_0x5a5a('0x3b')][_0x5a5a('0x43')]({'where':{'id':_0x2ac22c[_0x5a5a('0x42')]['id']}})[_0x5a5a('0x23')](handleEntityNotFound(_0x158ea1,null))[_0x5a5a('0x23')](saveUpdates(_0x2ac22c['body'],null))['then'](respondWithResult(_0x158ea1,null))[_0x5a5a('0x40')](handleError(_0x158ea1,null));};exports[_0x5a5a('0x24')]=function(_0xe9f27e,_0x4c9d77){return db[_0x5a5a('0x3b')][_0x5a5a('0x43')]({'where':{'id':_0xe9f27e[_0x5a5a('0x42')]['id']}})[_0x5a5a('0x23')](handleEntityNotFound(_0x4c9d77,null))['then'](removeEntity(_0x4c9d77,null))[_0x5a5a('0x40')](handleError(_0x4c9d77,null));}; \ No newline at end of file +var _0x58a7=['map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticTreeReport','include','findAll','rows','catch','show','length','create','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','error','name','index'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x58a7,0xad));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x758a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x758a('0x1'));var jsonpatch=require(_0x758a('0x2'));var rp=require(_0x758a('0x3'));var moment=require('moment');var BPromise=require(_0x758a('0x4'));var Mustache=require('mustache');var util=require(_0x758a('0x5'));var path=require('path');var sox=require(_0x758a('0x6'));var csv=require(_0x758a('0x7'));var ejs=require(_0x758a('0x8'));var fs=require('fs');var fs_extra=require(_0x758a('0x9'));var _=require(_0x758a('0xa'));var squel=require(_0x758a('0xb'));var crypto=require(_0x758a('0xc'));var jsforce=require(_0x758a('0xd'));var deskjs=require(_0x758a('0xe'));var toCsv=require(_0x758a('0x7'));var querystring=require(_0x758a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x758a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x758a('0x11'));var hardwareService=require(_0x758a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x758a('0x13'));var config=require(_0x758a('0x14'));var licenseUtil=require(_0x758a('0x15'));var db=require(_0x758a('0x16'))['db'];function respondWithStatusCode(_0x3954dc,_0x4f8b53){_0x4f8b53=_0x4f8b53||0xcc;return function(_0x78a45c){if(_0x78a45c){return _0x3954dc['sendStatus'](_0x4f8b53);}return _0x3954dc['status'](_0x4f8b53)[_0x758a('0x17')]();};}function respondWithResult(_0x291c95,_0x2838b5){_0x2838b5=_0x2838b5||0xc8;return function(_0x3ef0f0){if(_0x3ef0f0){return _0x291c95[_0x758a('0x18')](_0x2838b5)['json'](_0x3ef0f0);}};}function respondWithFilteredResult(_0x4134d6,_0x5ca1ad){return function(_0x11e754){if(_0x11e754){var _0x47c01c=typeof _0x5ca1ad[_0x758a('0x19')]===_0x758a('0x1a')&&typeof _0x5ca1ad[_0x758a('0x1b')]===_0x758a('0x1a');var _0x1e3ff6=_0x11e754['count'];var _0x57601b=_0x47c01c?0x0:_0x5ca1ad[_0x758a('0x19')];var _0x529186=_0x47c01c?_0x11e754[_0x758a('0x1c')]:_0x5ca1ad[_0x758a('0x19')]+_0x5ca1ad[_0x758a('0x1b')];var _0x110911;if(_0x529186>=_0x1e3ff6){_0x529186=_0x1e3ff6;_0x110911=0xc8;}else{_0x110911=0xce;}_0x4134d6[_0x758a('0x18')](_0x110911);return _0x4134d6[_0x758a('0x1d')]('Content-Range',_0x57601b+'-'+_0x529186+'/'+_0x1e3ff6)[_0x758a('0x1e')](_0x11e754);}return null;};}function patchUpdates(_0x303f3d){return function(_0x1b468d){try{jsonpatch[_0x758a('0x1f')](_0x1b468d,_0x303f3d,!![]);}catch(_0x5a9f7b){return BPromise[_0x758a('0x20')](_0x5a9f7b);}return _0x1b468d[_0x758a('0x21')]();};}function saveUpdates(_0xc185bf,_0x41f789){return function(_0x98e727){if(_0x98e727){return _0x98e727[_0x758a('0x22')](_0xc185bf)['then'](function(_0x2c0767){return _0x2c0767;});}return null;};}function removeEntity(_0x497e31,_0x5d3efe){return function(_0x442914){if(_0x442914){return _0x442914[_0x758a('0x23')]()[_0x758a('0x24')](function(){_0x497e31[_0x758a('0x18')](0xcc)[_0x758a('0x17')]();});}};}function handleEntityNotFound(_0x4fa26b,_0x188749){return function(_0x49a3c4){if(!_0x49a3c4){_0x4fa26b['sendStatus'](0x194);}return _0x49a3c4;};}function handleError(_0x6f0a3a,_0x1d489c){_0x1d489c=_0x1d489c||0x1f4;return function(_0x5bbb8c){logger[_0x758a('0x25')](_0x5bbb8c['stack']);if(_0x5bbb8c[_0x758a('0x26')]){delete _0x5bbb8c[_0x758a('0x26')];}_0x6f0a3a[_0x758a('0x18')](_0x1d489c)['send'](_0x5bbb8c);};}exports[_0x758a('0x27')]=function(_0x4e1021,_0x385ac1){var _0x5727d4={},_0x160b85={},_0x4fd2bf={'count':0x0,'rows':[]};var _0x891bb5=_[_0x758a('0x28')](db['AnalyticTreeReport'][_0x758a('0x29')],function(_0x3294fb){return{'name':_0x3294fb['fieldName'],'type':_0x3294fb['type'][_0x758a('0x2a')]};});_0x160b85[_0x758a('0x2b')]=_[_0x758a('0x28')](_0x891bb5,_0x758a('0x26'));_0x160b85[_0x758a('0x2c')]=_[_0x758a('0x2d')](_0x4e1021['query']);_0x160b85[_0x758a('0x2e')]=_['intersection'](_0x160b85[_0x758a('0x2b')],_0x160b85['query']);_0x5727d4['attributes']=_[_0x758a('0x2f')](_0x160b85['model'],qs['fields'](_0x4e1021[_0x758a('0x2c')][_0x758a('0x30')]));_0x5727d4[_0x758a('0x31')]=_0x5727d4[_0x758a('0x31')]['length']?_0x5727d4[_0x758a('0x31')]:_0x160b85[_0x758a('0x2b')];if(!_0x4e1021[_0x758a('0x2c')]['hasOwnProperty'](_0x758a('0x32'))){_0x5727d4['limit']=qs[_0x758a('0x1b')](_0x4e1021[_0x758a('0x2c')][_0x758a('0x1b')]);_0x5727d4['offset']=qs[_0x758a('0x19')](_0x4e1021[_0x758a('0x2c')][_0x758a('0x19')]);}_0x5727d4[_0x758a('0x33')]=qs[_0x758a('0x34')](_0x4e1021[_0x758a('0x2c')][_0x758a('0x34')]);_0x5727d4[_0x758a('0x35')]=qs['filters'](_[_0x758a('0x36')](_0x4e1021['query'],_0x160b85[_0x758a('0x2e')]),_0x891bb5);if(_0x4e1021[_0x758a('0x2c')][_0x758a('0x37')]){_0x5727d4[_0x758a('0x35')]=_[_0x758a('0x38')](_0x5727d4[_0x758a('0x35')],{'$or':_[_0x758a('0x28')](_0x891bb5,function(_0x193c1a){if(_0x193c1a[_0x758a('0x39')]!==_0x758a('0x3a')){var _0x1741dc={};_0x1741dc[_0x193c1a['name']]={'$like':'%'+_0x4e1021[_0x758a('0x2c')][_0x758a('0x37')]+'%'};return _0x1741dc;}})});}_0x5727d4=_[_0x758a('0x38')]({},_0x5727d4,_0x4e1021[_0x758a('0x3b')]);var _0x4f039b={'where':_0x5727d4[_0x758a('0x35')]};return db[_0x758a('0x3c')][_0x758a('0x1c')](_0x4f039b)[_0x758a('0x24')](function(_0x3f92bc){_0x4fd2bf[_0x758a('0x1c')]=_0x3f92bc;if(_0x4e1021[_0x758a('0x2c')]['includeAll']){_0x5727d4[_0x758a('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x758a('0x3e')](_0x5727d4);})[_0x758a('0x24')](function(_0x5d2241){_0x4fd2bf[_0x758a('0x3f')]=_0x5d2241;return _0x4fd2bf;})[_0x758a('0x24')](respondWithFilteredResult(_0x385ac1,_0x5727d4))[_0x758a('0x40')](handleError(_0x385ac1,null));};exports[_0x758a('0x41')]=function(_0x13a1c2,_0x25b70c){var _0x1870b8={'raw':!![],'where':{'id':_0x13a1c2['params']['id']}},_0x4f0681={};_0x4f0681[_0x758a('0x2b')]=_['keys'](db[_0x758a('0x3c')][_0x758a('0x29')]);_0x4f0681['query']=_['keys'](_0x13a1c2[_0x758a('0x2c')]);_0x4f0681[_0x758a('0x2e')]=_['intersection'](_0x4f0681[_0x758a('0x2b')],_0x4f0681['query']);_0x1870b8[_0x758a('0x31')]=_[_0x758a('0x2f')](_0x4f0681[_0x758a('0x2b')],qs[_0x758a('0x30')](_0x13a1c2[_0x758a('0x2c')]['fields']));_0x1870b8[_0x758a('0x31')]=_0x1870b8[_0x758a('0x31')][_0x758a('0x42')]?_0x1870b8[_0x758a('0x31')]:_0x4f0681[_0x758a('0x2b')];if(_0x13a1c2[_0x758a('0x2c')]['includeAll']){_0x1870b8[_0x758a('0x3d')]=[{'all':!![]}];}_0x1870b8=_[_0x758a('0x38')]({},_0x1870b8,_0x13a1c2['options']);return db[_0x758a('0x3c')]['find'](_0x1870b8)[_0x758a('0x24')](handleEntityNotFound(_0x25b70c,null))[_0x758a('0x24')](respondWithResult(_0x25b70c,null))[_0x758a('0x40')](handleError(_0x25b70c,null));};exports[_0x758a('0x43')]=function(_0x4b222f,_0x4300c8){return db[_0x758a('0x3c')][_0x758a('0x43')](_0x4b222f[_0x758a('0x44')],{})[_0x758a('0x24')](respondWithResult(_0x4300c8,0xc9))[_0x758a('0x40')](handleError(_0x4300c8,null));};exports['update']=function(_0x34d2eb,_0x1617b4){if(_0x34d2eb[_0x758a('0x44')]['id']){delete _0x34d2eb[_0x758a('0x44')]['id'];}return db[_0x758a('0x3c')][_0x758a('0x45')]({'where':{'id':_0x34d2eb[_0x758a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1617b4,null))[_0x758a('0x24')](saveUpdates(_0x34d2eb[_0x758a('0x44')],null))[_0x758a('0x24')](respondWithResult(_0x1617b4,null))[_0x758a('0x40')](handleError(_0x1617b4,null));};exports[_0x758a('0x23')]=function(_0x138625,_0x2d91e5){return db[_0x758a('0x3c')][_0x758a('0x45')]({'where':{'id':_0x138625[_0x758a('0x46')]['id']}})[_0x758a('0x24')](handleEntityNotFound(_0x2d91e5,null))[_0x758a('0x24')](removeEntity(_0x2d91e5,null))['catch'](handleError(_0x2d91e5,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 3bda9f0..17b7e42 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 _0xc85a=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','request-promise','../../config/environment','./analyticTreeReport.attributes'];(function(_0x1e9993,_0x517a0d){var _0x1cb53b=function(_0xf1f206){while(--_0xf1f206){_0x1e9993['push'](_0x1e9993['shift']());}};_0x1cb53b(++_0x517a0d);}(_0xc85a,0xc2));var _0xac85=function(_0x41c3e5,_0x2cb474){_0x41c3e5=_0x41c3e5-0x0;var _0x58f28a=_0xc85a[_0x41c3e5];return _0x58f28a;};'use strict';var _=require(_0xac85('0x0'));var util=require('util');var logger=require(_0xac85('0x1'))(_0xac85('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac85('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac85('0x4'));var attributes=require(_0xac85('0x5'));module[_0xac85('0x6')]=function(_0x262bd2,_0xd98ee0){return _0x262bd2[_0xac85('0x7')](_0xac85('0x8'),attributes,{'tableName':_0xac85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae1=['../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util'];(function(_0x275665,_0x4aa87a){var _0x2114cc=function(_0x49a3b7){while(--_0x49a3b7){_0x275665['push'](_0x275665['shift']());}};_0x2114cc(++_0x4aa87a);}(_0x8ae1,0x106));var _0x18ae=function(_0x5aa16b,_0x4ec27e){_0x5aa16b=_0x5aa16b-0x0;var _0x316906=_0x8ae1[_0x5aa16b];return _0x316906;};'use strict';var _=require(_0x18ae('0x0'));var util=require(_0x18ae('0x1'));var logger=require(_0x18ae('0x2'))(_0x18ae('0x3'));var moment=require(_0x18ae('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ae('0x5'));var rimraf=require(_0x18ae('0x6'));var config=require(_0x18ae('0x7'));var attributes=require(_0x18ae('0x8'));module[_0x18ae('0x9')]=function(_0x218d83,_0x596960){return _0x218d83[_0x18ae('0xa')](_0x18ae('0xb'),attributes,{'tableName':'analytics_report_trees','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 eb0af92..0dcd2b6 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x4dd16d,_0x5e4f7b){_0x4dd16d=_0x4dd16d-0x0;var _0x1a1312=_0x7a54[_0x4dd16d];return _0x1a1312;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x581531,_0x463062){var _0x3e14c3=function(_0x1cb44c){while(--_0x1cb44c){_0x581531['push'](_0x581531['shift']());}};_0x3e14c3(++_0x463062);}(_0xadb5,0xad));var _0x5adb=function(_0x491dc7,_0x4360c6){_0x491dc7=_0x491dc7-0x0;var _0x1ea6e3=_0xadb5[_0x491dc7];return _0x1ea6e3;};'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']('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index d4bad67..30d7fae 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 _0xf656=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2d8e75,_0x2b0757){var _0x52c809=function(_0x36a2d1){while(--_0x36a2d1){_0x2d8e75['push'](_0x2d8e75['shift']());}};_0x52c809(++_0x2b0757);}(_0xf656,0x15b));var _0x6f65=function(_0x427ff0,_0x435d5a){_0x427ff0=_0x427ff0-0x0;var _0x5e9c09=_0xf656[_0x427ff0];return _0x5e9c09;};'use strict';var multer=require(_0x6f65('0x0'));var util=require(_0x6f65('0x1'));var path=require(_0x6f65('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f65('0x3'));var router=express[_0x6f65('0x4')]();var fs_extra=require(_0x6f65('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f65('0x6'));var config=require(_0x6f65('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x6f65('0x8')]('/',auth[_0x6f65('0x9')](),controller[_0x6f65('0xa')]);router[_0x6f65('0x8')](_0x6f65('0xb'),auth[_0x6f65('0x9')](),controller[_0x6f65('0xc')]);router[_0x6f65('0xd')]('/',auth[_0x6f65('0x9')](),controller[_0x6f65('0xe')]);router[_0x6f65('0xf')](_0x6f65('0xb'),auth[_0x6f65('0x9')](),controller[_0x6f65('0x10')]);router[_0x6f65('0x11')]('/:id',auth[_0x6f65('0x9')](),controller[_0x6f65('0x12')]);module[_0x6f65('0x13')]=router; \ No newline at end of file +var _0x9c52=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','create','/:id','update','delete','destroy','multer','util'];(function(_0x564e34,_0x1c2e14){var _0x380912=function(_0x1cce9f){while(--_0x1cce9f){_0x564e34['push'](_0x564e34['shift']());}};_0x380912(++_0x1c2e14);}(_0x9c52,0x196));var _0x29c5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9c52[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x29c5('0x0'));var util=require(_0x29c5('0x1'));var path=require('path');var timeout=require(_0x29c5('0x2'));var express=require('express');var router=express[_0x29c5('0x3')]();var fs_extra=require(_0x29c5('0x4'));var auth=require(_0x29c5('0x5'));var interaction=require(_0x29c5('0x6'));var config=require(_0x29c5('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x29c5('0x8')]('/',auth['isAuthenticated'](),controller[_0x29c5('0x9')]);router[_0x29c5('0x8')]('/:id',auth[_0x29c5('0xa')](),controller['show']);router[_0x29c5('0xb')]('/',auth[_0x29c5('0xa')](),controller[_0x29c5('0xc')]);router['put'](_0x29c5('0xd'),auth[_0x29c5('0xa')](),controller[_0x29c5('0xe')]);router[_0x29c5('0xf')](_0x29c5('0xd'),auth[_0x29c5('0xa')](),controller[_0x29c5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 75cda10..4d0b4a5 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 _0x8664=['sequelize','exports','STRING'];(function(_0x13a864,_0x25535e){var _0x536fa7=function(_0x336d8b){while(--_0x336d8b){_0x13a864['push'](_0x13a864['shift']());}};_0x536fa7(++_0x25535e);}(_0x8664,0x11a));var _0x4866=function(_0x9b0cac,_0x11caf8){_0x9b0cac=_0x9b0cac-0x0;var _0x1475a8=_0x8664[_0x9b0cac];return _0x1475a8;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'name':{'type':Sequelize[_0x4866('0x2')]},'basename':{'type':Sequelize[_0x4866('0x2')]},'type':{'type':Sequelize[_0x4866('0x2')]}}; \ No newline at end of file +var _0x6334=['exports','STRING','sequelize'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x6334,0x119));var _0x4633=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0x6334[_0x3816c2];return _0x144669;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'name':{'type':Sequelize[_0x4633('0x2')]},'basename':{'type':Sequelize[_0x4633('0x2')]},'type':{'type':Sequelize[_0x4633('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1f6ff6a..40bed9b 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 _0xf8cf=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','error','stack','name','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','keys','length','options','catch','clone','params','find','get','updatedAt','body','createdAt','create','update','file','filename','findOne','ChatOfflineMessageId','join','offline-chat/','basename','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x2ce39f,_0x38b640){var _0x4c5756=function(_0x14e29a){while(--_0x14e29a){_0x2ce39f['push'](_0x2ce39f['shift']());}};_0x4c5756(++_0x38b640);}(_0xf8cf,0x199));var _0xff8c=function(_0x3258d7,_0x24c14a){_0x3258d7=_0x3258d7-0x0;var _0x507314=_0xf8cf[_0x3258d7];return _0x507314;};'use strict';var emlformat=require(_0xff8c('0x0'));var rimraf=require(_0xff8c('0x1'));var zipdir=require(_0xff8c('0x2'));var jsonpatch=require(_0xff8c('0x3'));var rp=require(_0xff8c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xff8c('0x5'));var util=require(_0xff8c('0x6'));var path=require(_0xff8c('0x7'));var sox=require(_0xff8c('0x8'));var csv=require(_0xff8c('0x9'));var ejs=require(_0xff8c('0xa'));var fs=require('fs');var fs_extra=require(_0xff8c('0xb'));var _=require(_0xff8c('0xc'));var squel=require(_0xff8c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xff8c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff8c('0xf'));var Papa=require(_0xff8c('0x10'));var Redis=require('ioredis');var authService=require(_0xff8c('0x11'));var qs=require(_0xff8c('0x12'));var as=require(_0xff8c('0x13'));var hardwareService=require(_0xff8c('0x14'));var logger=require('../../config/logger')(_0xff8c('0x15'));var utils=require(_0xff8c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff8c('0x17'));var db=require(_0xff8c('0x18'))['db'];function respondWithStatusCode(_0x3769df,_0x22858a){_0x22858a=_0x22858a||0xcc;return function(_0xb47805){if(_0xb47805){return _0x3769df[_0xff8c('0x19')](_0x22858a);}return _0x3769df[_0xff8c('0x1a')](_0x22858a)[_0xff8c('0x1b')]();};}function respondWithResult(_0x46b750,_0x34fa04){_0x34fa04=_0x34fa04||0xc8;return function(_0x49cfaf){if(_0x49cfaf){return _0x46b750[_0xff8c('0x1a')](_0x34fa04)[_0xff8c('0x1c')](_0x49cfaf);}};}function respondWithFilteredResult(_0x18f490,_0x2a4503){return function(_0x46d420){if(_0x46d420){var _0x458e5b=typeof _0x2a4503[_0xff8c('0x1d')]===_0xff8c('0x1e')&&typeof _0x2a4503[_0xff8c('0x1f')]===_0xff8c('0x1e');var _0x2890ad=_0x46d420[_0xff8c('0x20')];var _0xd8461d=_0x458e5b?0x0:_0x2a4503[_0xff8c('0x1d')];var _0x268058=_0x458e5b?_0x46d420[_0xff8c('0x20')]:_0x2a4503[_0xff8c('0x1d')]+_0x2a4503[_0xff8c('0x1f')];var _0xf9b94d;if(_0x268058>=_0x2890ad){_0x268058=_0x2890ad;_0xf9b94d=0xc8;}else{_0xf9b94d=0xce;}_0x18f490['status'](_0xf9b94d);return _0x18f490['set']('Content-Range',_0xd8461d+'-'+_0x268058+'/'+_0x2890ad)['json'](_0x46d420);}return null;};}function patchUpdates(_0x293083){return function(_0x5dcb24){try{jsonpatch[_0xff8c('0x21')](_0x5dcb24,_0x293083,!![]);}catch(_0x20bce2){return BPromise[_0xff8c('0x22')](_0x20bce2);}return _0x5dcb24[_0xff8c('0x23')]();};}function saveUpdates(_0x405429,_0x40711c){return function(_0x19b1db){if(_0x19b1db){return _0x19b1db['update'](_0x405429)[_0xff8c('0x24')](function(_0x4c6368){return _0x4c6368;});}return null;};}function removeEntity(_0x414e0c,_0x59802f){return function(_0x1702b0){if(_0x1702b0){return _0x1702b0['destroy']()[_0xff8c('0x24')](function(){_0x414e0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x299139,_0x2e659d){return function(_0x1a2bf7){if(!_0x1a2bf7){_0x299139[_0xff8c('0x19')](0x194);}return _0x1a2bf7;};}function handleError(_0x35f494,_0x157271){_0x157271=_0x157271||0x1f4;return function(_0x1541d3){logger[_0xff8c('0x25')](_0x1541d3[_0xff8c('0x26')]);if(_0x1541d3[_0xff8c('0x27')]){delete _0x1541d3[_0xff8c('0x27')];}_0x35f494[_0xff8c('0x1a')](_0x157271)['send'](_0x1541d3);};}exports[_0xff8c('0x28')]=function(_0x1bdaf8,_0x2df16a){var _0x587235={},_0xebbc0f={},_0x1a5f12={'count':0x0,'rows':[]};var _0xf499c5=_[_0xff8c('0x29')](db[_0xff8c('0x2a')][_0xff8c('0x2b')],function(_0xe39923){return{'name':_0xe39923['fieldName'],'type':_0xe39923[_0xff8c('0x2c')][_0xff8c('0x2d')]};});_0xebbc0f[_0xff8c('0x2e')]=_[_0xff8c('0x29')](_0xf499c5,_0xff8c('0x27'));_0xebbc0f[_0xff8c('0x2f')]=_['keys'](_0x1bdaf8['query']);_0xebbc0f[_0xff8c('0x30')]=_[_0xff8c('0x31')](_0xebbc0f[_0xff8c('0x2e')],_0xebbc0f[_0xff8c('0x2f')]);_0x587235[_0xff8c('0x32')]=_[_0xff8c('0x31')](_0xebbc0f[_0xff8c('0x2e')],qs[_0xff8c('0x33')](_0x1bdaf8['query'][_0xff8c('0x33')]));_0x587235[_0xff8c('0x32')]=_0x587235['attributes']['length']?_0x587235[_0xff8c('0x32')]:_0xebbc0f[_0xff8c('0x2e')];if(!_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x34')](_0xff8c('0x35'))){_0x587235[_0xff8c('0x1f')]=qs[_0xff8c('0x1f')](_0x1bdaf8[_0xff8c('0x2f')]['limit']);_0x587235[_0xff8c('0x1d')]=qs['offset'](_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x1d')]);}_0x587235[_0xff8c('0x36')]=qs['sort'](_0x1bdaf8['query']['sort']);_0x587235[_0xff8c('0x37')]=qs['filters'](_[_0xff8c('0x38')](_0x1bdaf8[_0xff8c('0x2f')],_0xebbc0f[_0xff8c('0x30')]),_0xf499c5);if(_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x39')]){_0x587235['where']=_[_0xff8c('0x3a')](_0x587235[_0xff8c('0x37')],{'$or':_[_0xff8c('0x29')](_0xf499c5,function(_0x3990c9){if(_0x3990c9['type']!==_0xff8c('0x3b')){var _0x2c41fe={};_0x2c41fe[_0x3990c9[_0xff8c('0x27')]]={'$like':'%'+_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x39')]+'%'};return _0x2c41fe;}})});}_0x587235=_[_0xff8c('0x3a')]({},_0x587235,_0x1bdaf8['options']);var _0xe73e8={'where':_0x587235[_0xff8c('0x37')]};return db[_0xff8c('0x2a')]['count'](_0xe73e8)[_0xff8c('0x24')](function(_0xf4c18e){_0x1a5f12[_0xff8c('0x20')]=_0xf4c18e;if(_0x1bdaf8[_0xff8c('0x2f')][_0xff8c('0x3c')]){_0x587235[_0xff8c('0x3d')]=[{'all':!![]}];}return db[_0xff8c('0x2a')][_0xff8c('0x3e')](_0x587235);})[_0xff8c('0x24')](function(_0x2a1eb3){_0x1a5f12['rows']=_0x2a1eb3;return _0x1a5f12;})[_0xff8c('0x24')](respondWithFilteredResult(_0x2df16a,_0x587235))['catch'](handleError(_0x2df16a,null));};exports[_0xff8c('0x3f')]=function(_0x3fc815,_0x1dc626){var _0x20f4ef={'raw':!![],'where':{'id':_0x3fc815['params']['id']}},_0x15a152={};_0x15a152[_0xff8c('0x2e')]=_[_0xff8c('0x40')](db['Attachment']['rawAttributes']);_0x15a152[_0xff8c('0x2f')]=_[_0xff8c('0x40')](_0x3fc815[_0xff8c('0x2f')]);_0x15a152[_0xff8c('0x30')]=_[_0xff8c('0x31')](_0x15a152[_0xff8c('0x2e')],_0x15a152[_0xff8c('0x2f')]);_0x20f4ef[_0xff8c('0x32')]=_['intersection'](_0x15a152['model'],qs['fields'](_0x3fc815['query'][_0xff8c('0x33')]));_0x20f4ef[_0xff8c('0x32')]=_0x20f4ef[_0xff8c('0x32')][_0xff8c('0x41')]?_0x20f4ef[_0xff8c('0x32')]:_0x15a152['model'];if(_0x3fc815[_0xff8c('0x2f')]['includeAll']){_0x20f4ef[_0xff8c('0x3d')]=[{'all':!![]}];}_0x20f4ef=_['merge']({},_0x20f4ef,_0x3fc815[_0xff8c('0x42')]);return db[_0xff8c('0x2a')]['find'](_0x20f4ef)[_0xff8c('0x24')](handleEntityNotFound(_0x1dc626,null))[_0xff8c('0x24')](respondWithResult(_0x1dc626,null))[_0xff8c('0x43')](handleError(_0x1dc626,null));};exports[_0xff8c('0x44')]=function(_0x25a664,_0x123e8a){var _0x3fb54b={'where':{'id':_0x25a664[_0xff8c('0x45')]['id']}},_0x506e83={};_0x506e83[_0xff8c('0x2e')]=_[_0xff8c('0x40')](db[_0xff8c('0x2a')][_0xff8c('0x2b')]);_0x3fb54b[_0xff8c('0x32')]=_[_0xff8c('0x31')](_0x506e83[_0xff8c('0x2e')],qs[_0xff8c('0x33')](_0x25a664['query'][_0xff8c('0x33')]));_0x3fb54b[_0xff8c('0x32')]=_0x3fb54b['attributes'][_0xff8c('0x41')]?_0x3fb54b['attributes']:_0x506e83[_0xff8c('0x2e')];if(_0x25a664[_0xff8c('0x2f')][_0xff8c('0x3c')]){_0x3fb54b[_0xff8c('0x3d')]=[{'all':!![]}];}_0x3fb54b=_[_0xff8c('0x3a')]({},_0x3fb54b,_0x25a664[_0xff8c('0x42')]);return db[_0xff8c('0x2a')][_0xff8c('0x46')](_0x3fb54b)['then'](handleEntityNotFound(_0x123e8a,null))[_0xff8c('0x24')](function(_0x1005bb){if(_0x1005bb){var _0x5e3e8f=_0x1005bb[_0xff8c('0x47')]({'plain':!![]});_0x5e3e8f=qs['omit'](_0x5e3e8f,['id','createdAt',_0xff8c('0x48')]);_0x25a664[_0xff8c('0x49')]=_['omit'](_0x25a664[_0xff8c('0x49')],['id',_0xff8c('0x4a'),'updatedAt']);return db[_0xff8c('0x2a')][_0xff8c('0x4b')](_[_0xff8c('0x3a')](_0x5e3e8f,_0x25a664[_0xff8c('0x49')]),{'include':_0x25a664['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xff8c('0x24')](respondWithResult(_0x123e8a,0xc9))[_0xff8c('0x43')](handleError(_0x123e8a,null));};exports[_0xff8c('0x4c')]=function(_0x1dabd3,_0xb03957){if(_0x1dabd3[_0xff8c('0x49')]['id']){delete _0x1dabd3[_0xff8c('0x49')]['id'];}return db['Attachment'][_0xff8c('0x46')]({'where':{'id':_0x1dabd3['params']['id']}})[_0xff8c('0x24')](handleEntityNotFound(_0xb03957,null))[_0xff8c('0x24')](saveUpdates(_0x1dabd3[_0xff8c('0x49')],null))[_0xff8c('0x24')](respondWithResult(_0xb03957,null))[_0xff8c('0x43')](handleError(_0xb03957,null));};exports['destroy']=function(_0x193ec9,_0x684edc){return db[_0xff8c('0x2a')][_0xff8c('0x46')]({'where':{'id':_0x193ec9[_0xff8c('0x45')]['id']}})['then'](handleEntityNotFound(_0x684edc,null))[_0xff8c('0x24')](removeEntity(_0x684edc,null))[_0xff8c('0x43')](handleError(_0x684edc,null));};exports['create']=function(_0x2be596,_0x562d24,_0x558dd8){_0x2be596[_0xff8c('0x49')][_0xff8c('0x27')]=_0x2be596[_0xff8c('0x4d')]['originalname'];_0x2be596[_0xff8c('0x49')]['basename']=_0x2be596[_0xff8c('0x4d')][_0xff8c('0x4e')];_0x2be596['body'][_0xff8c('0x2c')]=_0x2be596['file']['mimetype'];return db[_0xff8c('0x2a')][_0xff8c('0x4b')](_0x2be596[_0xff8c('0x49')])['then'](respondWithResult(_0x562d24,0xc9))[_0xff8c('0x43')](handleError(_0x562d24,null));};exports['download']=function(_0x275f32,_0x28eb05,_0x52191a){return db[_0xff8c('0x2a')][_0xff8c('0x4f')]({'where':{'id':_0x275f32[_0xff8c('0x45')]['id']},'raw':!![]})[_0xff8c('0x24')](handleEntityNotFound(_0x28eb05,null))[_0xff8c('0x24')](function(_0x1069d9){if(_0x1069d9){var _0x5270d8=_0x1069d9[_0xff8c('0x50')]!==null;var _0x2e6d4c=path[_0xff8c('0x51')](config['root'],'server/files/attachments/');if(_0x5270d8){_0x2e6d4c=path[_0xff8c('0x51')](_0x2e6d4c,_0xff8c('0x52'));}var _0x149559=path['join'](_0x2e6d4c,_0x1069d9[_0xff8c('0x53')]);return _0x28eb05[_0xff8c('0x54')](_0x149559);}})[_0xff8c('0x43')](handleError(_0x28eb05,null));}; \ No newline at end of file +var _0x63bf=['root','join','offline-chat/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','catch','show','params','include','merge','clone','find','get','omit','createdAt','updatedAt','body','file','basename','filename','mimetype','create','findOne'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x63bf,0x170));var _0xf63b=function(_0x33ec3b,_0x5c6b90){_0x33ec3b=_0x33ec3b-0x0;var _0x33e416=_0x63bf[_0x33ec3b];return _0x33e416;};'use strict';var emlformat=require(_0xf63b('0x0'));var rimraf=require(_0xf63b('0x1'));var zipdir=require(_0xf63b('0x2'));var jsonpatch=require(_0xf63b('0x3'));var rp=require(_0xf63b('0x4'));var moment=require(_0xf63b('0x5'));var BPromise=require(_0xf63b('0x6'));var Mustache=require(_0xf63b('0x7'));var util=require(_0xf63b('0x8'));var path=require(_0xf63b('0x9'));var sox=require(_0xf63b('0xa'));var csv=require(_0xf63b('0xb'));var ejs=require(_0xf63b('0xc'));var fs=require('fs');var fs_extra=require(_0xf63b('0xd'));var _=require(_0xf63b('0xe'));var squel=require('squel');var crypto=require(_0xf63b('0xf'));var jsforce=require(_0xf63b('0x10'));var deskjs=require(_0xf63b('0x11'));var toCsv=require(_0xf63b('0xb'));var querystring=require(_0xf63b('0x12'));var Papa=require(_0xf63b('0x13'));var Redis=require(_0xf63b('0x14'));var authService=require(_0xf63b('0x15'));var qs=require(_0xf63b('0x16'));var as=require(_0xf63b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf63b('0x18'))(_0xf63b('0x19'));var utils=require('../../config/utils');var config=require(_0xf63b('0x1a'));var licenseUtil=require(_0xf63b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd5f7,_0x377385){_0x377385=_0x377385||0xcc;return function(_0x272c9d){if(_0x272c9d){return _0x5dd5f7['sendStatus'](_0x377385);}return _0x5dd5f7[_0xf63b('0x1c')](_0x377385)[_0xf63b('0x1d')]();};}function respondWithResult(_0x3170ac,_0x3e6bb7){_0x3e6bb7=_0x3e6bb7||0xc8;return function(_0x2b09ab){if(_0x2b09ab){return _0x3170ac[_0xf63b('0x1c')](_0x3e6bb7)['json'](_0x2b09ab);}};}function respondWithFilteredResult(_0x453479,_0x49f75a){return function(_0x321173){if(_0x321173){var _0x307dfc=typeof _0x49f75a[_0xf63b('0x1e')]===_0xf63b('0x1f')&&typeof _0x49f75a[_0xf63b('0x20')]==='undefined';var _0x2d1f17=_0x321173[_0xf63b('0x21')];var _0x1a0b33=_0x307dfc?0x0:_0x49f75a['offset'];var _0x9b25cf=_0x307dfc?_0x321173[_0xf63b('0x21')]:_0x49f75a[_0xf63b('0x1e')]+_0x49f75a['limit'];var _0x1f4d17;if(_0x9b25cf>=_0x2d1f17){_0x9b25cf=_0x2d1f17;_0x1f4d17=0xc8;}else{_0x1f4d17=0xce;}_0x453479[_0xf63b('0x1c')](_0x1f4d17);return _0x453479[_0xf63b('0x22')](_0xf63b('0x23'),_0x1a0b33+'-'+_0x9b25cf+'/'+_0x2d1f17)['json'](_0x321173);}return null;};}function patchUpdates(_0x2790af){return function(_0x3920c0){try{jsonpatch[_0xf63b('0x24')](_0x3920c0,_0x2790af,!![]);}catch(_0x2097be){return BPromise[_0xf63b('0x25')](_0x2097be);}return _0x3920c0[_0xf63b('0x26')]();};}function saveUpdates(_0x17bd9b,_0x3ee7df){return function(_0x63dee8){if(_0x63dee8){return _0x63dee8[_0xf63b('0x27')](_0x17bd9b)[_0xf63b('0x28')](function(_0x55f392){return _0x55f392;});}return null;};}function removeEntity(_0xdec62c,_0x5e749b){return function(_0x4b517d){if(_0x4b517d){return _0x4b517d[_0xf63b('0x29')]()[_0xf63b('0x28')](function(){_0xdec62c[_0xf63b('0x1c')](0xcc)[_0xf63b('0x1d')]();});}};}function handleEntityNotFound(_0x2e4db6,_0x433708){return function(_0x290f9a){if(!_0x290f9a){_0x2e4db6[_0xf63b('0x2a')](0x194);}return _0x290f9a;};}function handleError(_0x363a73,_0x574a79){_0x574a79=_0x574a79||0x1f4;return function(_0x1758d0){logger[_0xf63b('0x2b')](_0x1758d0[_0xf63b('0x2c')]);if(_0x1758d0[_0xf63b('0x2d')]){delete _0x1758d0[_0xf63b('0x2d')];}_0x363a73['status'](_0x574a79)[_0xf63b('0x2e')](_0x1758d0);};}exports[_0xf63b('0x2f')]=function(_0x45e9e5,_0x4835d1){var _0x38405e={},_0x5834e2={},_0x514bb9={'count':0x0,'rows':[]};var _0x110e11=_[_0xf63b('0x30')](db[_0xf63b('0x31')][_0xf63b('0x32')],function(_0x48121a){return{'name':_0x48121a[_0xf63b('0x33')],'type':_0x48121a[_0xf63b('0x34')][_0xf63b('0x35')]};});_0x5834e2[_0xf63b('0x36')]=_[_0xf63b('0x30')](_0x110e11,'name');_0x5834e2['query']=_[_0xf63b('0x37')](_0x45e9e5[_0xf63b('0x38')]);_0x5834e2[_0xf63b('0x39')]=_['intersection'](_0x5834e2['model'],_0x5834e2[_0xf63b('0x38')]);_0x38405e[_0xf63b('0x3a')]=_[_0xf63b('0x3b')](_0x5834e2['model'],qs[_0xf63b('0x3c')](_0x45e9e5['query']['fields']));_0x38405e[_0xf63b('0x3a')]=_0x38405e[_0xf63b('0x3a')][_0xf63b('0x3d')]?_0x38405e['attributes']:_0x5834e2['model'];if(!_0x45e9e5[_0xf63b('0x38')][_0xf63b('0x3e')](_0xf63b('0x3f'))){_0x38405e[_0xf63b('0x20')]=qs[_0xf63b('0x20')](_0x45e9e5['query'][_0xf63b('0x20')]);_0x38405e[_0xf63b('0x1e')]=qs[_0xf63b('0x1e')](_0x45e9e5[_0xf63b('0x38')][_0xf63b('0x1e')]);}_0x38405e['order']=qs[_0xf63b('0x40')](_0x45e9e5['query'][_0xf63b('0x40')]);_0x38405e[_0xf63b('0x41')]=qs[_0xf63b('0x39')](_['pick'](_0x45e9e5[_0xf63b('0x38')],_0x5834e2['filters']),_0x110e11);if(_0x45e9e5['query'][_0xf63b('0x42')]){_0x38405e[_0xf63b('0x41')]=_['merge'](_0x38405e[_0xf63b('0x41')],{'$or':_[_0xf63b('0x30')](_0x110e11,function(_0x27a72f){if(_0x27a72f[_0xf63b('0x34')]!=='VIRTUAL'){var _0x457f24={};_0x457f24[_0x27a72f[_0xf63b('0x2d')]]={'$like':'%'+_0x45e9e5['query'][_0xf63b('0x42')]+'%'};return _0x457f24;}})});}_0x38405e=_['merge']({},_0x38405e,_0x45e9e5[_0xf63b('0x43')]);var _0x4b6cca={'where':_0x38405e[_0xf63b('0x41')]};return db[_0xf63b('0x31')][_0xf63b('0x21')](_0x4b6cca)[_0xf63b('0x28')](function(_0x188f85){_0x514bb9[_0xf63b('0x21')]=_0x188f85;if(_0x45e9e5['query'][_0xf63b('0x44')]){_0x38405e['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x38405e);})[_0xf63b('0x28')](function(_0x5a17c5){_0x514bb9['rows']=_0x5a17c5;return _0x514bb9;})[_0xf63b('0x28')](respondWithFilteredResult(_0x4835d1,_0x38405e))[_0xf63b('0x45')](handleError(_0x4835d1,null));};exports[_0xf63b('0x46')]=function(_0x2327c4,_0x4dcb83){var _0x12f2a6={'raw':!![],'where':{'id':_0x2327c4[_0xf63b('0x47')]['id']}},_0x133b60={};_0x133b60[_0xf63b('0x36')]=_[_0xf63b('0x37')](db['Attachment'][_0xf63b('0x32')]);_0x133b60[_0xf63b('0x38')]=_[_0xf63b('0x37')](_0x2327c4[_0xf63b('0x38')]);_0x133b60[_0xf63b('0x39')]=_[_0xf63b('0x3b')](_0x133b60[_0xf63b('0x36')],_0x133b60[_0xf63b('0x38')]);_0x12f2a6[_0xf63b('0x3a')]=_[_0xf63b('0x3b')](_0x133b60['model'],qs[_0xf63b('0x3c')](_0x2327c4['query']['fields']));_0x12f2a6['attributes']=_0x12f2a6[_0xf63b('0x3a')]['length']?_0x12f2a6[_0xf63b('0x3a')]:_0x133b60['model'];if(_0x2327c4[_0xf63b('0x38')][_0xf63b('0x44')]){_0x12f2a6[_0xf63b('0x48')]=[{'all':!![]}];}_0x12f2a6=_[_0xf63b('0x49')]({},_0x12f2a6,_0x2327c4[_0xf63b('0x43')]);return db[_0xf63b('0x31')]['find'](_0x12f2a6)[_0xf63b('0x28')](handleEntityNotFound(_0x4dcb83,null))['then'](respondWithResult(_0x4dcb83,null))[_0xf63b('0x45')](handleError(_0x4dcb83,null));};exports[_0xf63b('0x4a')]=function(_0x272a85,_0xcc6e0){var _0x188635={'where':{'id':_0x272a85['params']['id']}},_0x5ebfea={};_0x5ebfea[_0xf63b('0x36')]=_['keys'](db['Attachment']['rawAttributes']);_0x188635[_0xf63b('0x3a')]=_[_0xf63b('0x3b')](_0x5ebfea[_0xf63b('0x36')],qs[_0xf63b('0x3c')](_0x272a85[_0xf63b('0x38')]['fields']));_0x188635[_0xf63b('0x3a')]=_0x188635[_0xf63b('0x3a')][_0xf63b('0x3d')]?_0x188635[_0xf63b('0x3a')]:_0x5ebfea[_0xf63b('0x36')];if(_0x272a85[_0xf63b('0x38')][_0xf63b('0x44')]){_0x188635[_0xf63b('0x48')]=[{'all':!![]}];}_0x188635=_['merge']({},_0x188635,_0x272a85[_0xf63b('0x43')]);return db[_0xf63b('0x31')][_0xf63b('0x4b')](_0x188635)[_0xf63b('0x28')](handleEntityNotFound(_0xcc6e0,null))[_0xf63b('0x28')](function(_0x265daa){if(_0x265daa){var _0x3c6fba=_0x265daa[_0xf63b('0x4c')]({'plain':!![]});_0x3c6fba=qs[_0xf63b('0x4d')](_0x3c6fba,['id',_0xf63b('0x4e'),_0xf63b('0x4f')]);_0x272a85['body']=_[_0xf63b('0x4d')](_0x272a85[_0xf63b('0x50')],['id',_0xf63b('0x4e'),_0xf63b('0x4f')]);return db[_0xf63b('0x31')]['create'](_[_0xf63b('0x49')](_0x3c6fba,_0x272a85['body']),{'include':_0x272a85[_0xf63b('0x38')][_0xf63b('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xcc6e0,0xc9))[_0xf63b('0x45')](handleError(_0xcc6e0,null));};exports[_0xf63b('0x27')]=function(_0xc83aff,_0xce8fe6){if(_0xc83aff[_0xf63b('0x50')]['id']){delete _0xc83aff[_0xf63b('0x50')]['id'];}return db[_0xf63b('0x31')][_0xf63b('0x4b')]({'where':{'id':_0xc83aff[_0xf63b('0x47')]['id']}})[_0xf63b('0x28')](handleEntityNotFound(_0xce8fe6,null))[_0xf63b('0x28')](saveUpdates(_0xc83aff[_0xf63b('0x50')],null))[_0xf63b('0x28')](respondWithResult(_0xce8fe6,null))[_0xf63b('0x45')](handleError(_0xce8fe6,null));};exports['destroy']=function(_0x21f1b9,_0x52898e){return db[_0xf63b('0x31')][_0xf63b('0x4b')]({'where':{'id':_0x21f1b9[_0xf63b('0x47')]['id']}})[_0xf63b('0x28')](handleEntityNotFound(_0x52898e,null))[_0xf63b('0x28')](removeEntity(_0x52898e,null))[_0xf63b('0x45')](handleError(_0x52898e,null));};exports['create']=function(_0x18b3d5,_0x536456,_0x3c7c7c){_0x18b3d5[_0xf63b('0x50')]['name']=_0x18b3d5[_0xf63b('0x51')]['originalname'];_0x18b3d5[_0xf63b('0x50')][_0xf63b('0x52')]=_0x18b3d5[_0xf63b('0x51')][_0xf63b('0x53')];_0x18b3d5[_0xf63b('0x50')][_0xf63b('0x34')]=_0x18b3d5[_0xf63b('0x51')][_0xf63b('0x54')];return db[_0xf63b('0x31')][_0xf63b('0x55')](_0x18b3d5['body'])['then'](respondWithResult(_0x536456,0xc9))['catch'](handleError(_0x536456,null));};exports['download']=function(_0x182b9b,_0x1fabb5,_0x5a318c){return db[_0xf63b('0x31')][_0xf63b('0x56')]({'where':{'id':_0x182b9b[_0xf63b('0x47')]['id']},'raw':!![]})[_0xf63b('0x28')](handleEntityNotFound(_0x1fabb5,null))['then'](function(_0x239f9f){if(_0x239f9f){var _0x33f0d2=_0x239f9f['ChatOfflineMessageId']!==null;var _0x213543=path['join'](config[_0xf63b('0x57')],'server/files/attachments/');if(_0x33f0d2){_0x213543=path[_0xf63b('0x58')](_0x213543,_0xf63b('0x59'));}var _0x15e222=path['join'](_0x213543,_0x239f9f['basename']);return _0x1fabb5[_0xf63b('0x5a')](_0x15e222);}})[_0xf63b('0x45')](handleError(_0x1fabb5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8e137fa..135c449 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 _0x6933=['define','Attachment','attachments','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./attachment.attributes','exports'];(function(_0x49a942,_0x25068f){var _0x2835de=function(_0x2c349c){while(--_0x2c349c){_0x49a942['push'](_0x49a942['shift']());}};_0x2835de(++_0x25068f);}(_0x6933,0xc6));var _0x3693=function(_0x35268e,_0x4acfd1){_0x35268e=_0x35268e-0x0;var _0x28ba11=_0x6933[_0x35268e];return _0x28ba11;};'use strict';var _=require(_0x3693('0x0'));var util=require(_0x3693('0x1'));var logger=require(_0x3693('0x2'))(_0x3693('0x3'));var moment=require(_0x3693('0x4'));var BPromise=require('bluebird');var rp=require(_0x3693('0x5'));var fs=require('fs');var path=require(_0x3693('0x6'));var rimraf=require('rimraf');var config=require(_0x3693('0x7'));var attributes=require(_0x3693('0x8'));module[_0x3693('0x9')]=function(_0x32a877,_0x125d1d){return _0x32a877[_0x3693('0xa')](_0x3693('0xb'),attributes,{'tableName':_0x3693('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb346=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments'];(function(_0x29258e,_0x2f0265){var _0x54df78=function(_0x192c0f){while(--_0x192c0f){_0x29258e['push'](_0x29258e['shift']());}};_0x54df78(++_0x2f0265);}(_0xb346,0x12c));var _0x6b34=function(_0x4bc984,_0x148796){_0x4bc984=_0x4bc984-0x0;var _0x51e438=_0xb346[_0x4bc984];return _0x51e438;};'use strict';var _=require(_0x6b34('0x0'));var util=require(_0x6b34('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b34('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b34('0x3'));var fs=require('fs');var path=require(_0x6b34('0x4'));var rimraf=require(_0x6b34('0x5'));var config=require(_0x6b34('0x6'));var attributes=require(_0x6b34('0x7'));module[_0x6b34('0x8')]=function(_0x206f83,_0x50bbee){return _0x206f83[_0x6b34('0x9')](_0x6b34('0xa'),attributes,{'tableName':_0x6b34('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 ceecafd..0180f24 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 _0x00bb=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Attachment','body','options','then','CreateAttachment','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','Attachment,\x20%s,\x20%s'];(function(_0x35863f,_0x4f3a04){var _0x35a567=function(_0x192d22){while(--_0x192d22){_0x35863f['push'](_0x35863f['shift']());}};_0x35a567(++_0x4f3a04);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}exports['CreateAttachment']=function(_0x2a7231){var _0x599347=this;return new Promise(function(_0x415f91,_0x5aa9a0){return db[_0xb00b('0x12')]['create'](_0x2a7231[_0xb00b('0x13')],{'raw':_0x2a7231[_0xb00b('0x14')]?_0x2a7231['options']['raw']===undefined?!![]:![]:!![]})[_0xb00b('0x15')](function(_0x4a334b){logger[_0xb00b('0x9')](_0xb00b('0x16'),_0x2a7231);logger[_0xb00b('0xc')](_0xb00b('0x16'),_0x2a7231,JSON['stringify'](_0x4a334b));_0x415f91(_0x4a334b);})[_0xb00b('0x11')](function(_0x4df284){logger[_0xb00b('0xf')](_0xb00b('0x16'),_0x4df284['message'],_0x2a7231);_0x5aa9a0(_0x599347[_0xb00b('0xf')](0x1f4,_0x4df284[_0xb00b('0x10')]));});});}; \ No newline at end of file +var _0x1d5b=['catch','Attachment','create','options','raw','then','CreateAttachment','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Attachment,\x20%s,\x20%s','message','result'];(function(_0x3ef05a,_0x48eafc){var _0x2e3898=function(_0x1e5bdb){while(--_0x1e5bdb){_0x3ef05a['push'](_0x3ef05a['shift']());}};_0x2e3898(++_0x48eafc);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x1848e2,_0x450a56){_0x1848e2=_0x1848e2-0x0;var _0x23085d=_0x1d5b[_0x1848e2];return _0x23085d;};'use strict';var _=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var moment=require(_0xb1d5('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1d5('0x4'))['db'];var utils=require(_0xb1d5('0x5'));var logger=require(_0xb1d5('0x6'))(_0xb1d5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1d5('0x8')][_0xb1d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b2392,_0x40ee0e,_0x3b452f){return new BPromise(function(_0xb2d955,_0x1cbd9d){return client[_0xb1d5('0xa')](_0x3b2392,_0x3b452f)['then'](function(_0x3fe694){logger[_0xb1d5('0xb')]('Attachment,\x20%s,\x20%s',_0x40ee0e,'request\x20sent');logger[_0xb1d5('0xc')](_0xb1d5('0xd'),_0x40ee0e,_0xb1d5('0xe'),JSON['stringify'](_0x3fe694));if(_0x3fe694[_0xb1d5('0xf')]){if(_0x3fe694[_0xb1d5('0xf')][_0xb1d5('0x10')]===0x1f4){logger['error'](_0xb1d5('0x11'),_0x40ee0e,_0x3fe694[_0xb1d5('0xf')][_0xb1d5('0x12')]);return _0x1cbd9d(_0x3fe694[_0xb1d5('0xf')]['message']);}logger[_0xb1d5('0xf')](_0xb1d5('0x11'),_0x40ee0e,_0x3fe694[_0xb1d5('0xf')]['message']);return _0xb2d955(_0x3fe694[_0xb1d5('0xf')][_0xb1d5('0x12')]);}else{logger[_0xb1d5('0xb')](_0xb1d5('0x11'),_0x40ee0e,_0xb1d5('0xe'));_0xb2d955(_0x3fe694[_0xb1d5('0x13')]['message']);}})[_0xb1d5('0x14')](function(_0x51cb99){logger[_0xb1d5('0xf')](_0xb1d5('0x11'),_0x40ee0e,_0x51cb99);_0x1cbd9d(_0x51cb99);});});}exports['CreateAttachment']=function(_0x1870c2){var _0x1fd51f=this;return new Promise(function(_0xe3d99,_0x5853e9){return db[_0xb1d5('0x15')][_0xb1d5('0x16')](_0x1870c2['body'],{'raw':_0x1870c2[_0xb1d5('0x17')]?_0x1870c2[_0xb1d5('0x17')][_0xb1d5('0x18')]===undefined?!![]:![]:!![]})[_0xb1d5('0x19')](function(_0x2fa863){logger['info'](_0xb1d5('0x1a'),_0x1870c2);logger[_0xb1d5('0xc')](_0xb1d5('0x1a'),_0x1870c2,JSON[_0xb1d5('0x1b')](_0x2fa863));_0xe3d99(_0x2fa863);})[_0xb1d5('0x14')](function(_0x50e15f){logger[_0xb1d5('0xf')]('CreateAttachment',_0x50e15f[_0xb1d5('0x12')],_0x1870c2);_0x5853e9(_0x1fd51f['error'](0x1f4,_0x50e15f[_0xb1d5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 58fdc48..3e516fb 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x48f637,_0x196f2){var _0x2aa226=function(_0x3367f4){while(--_0x3367f4){_0x48f637['push'](_0x48f637['shift']());}};_0x2aa226(++_0x196f2);}(_0xadb5,0xad));var _0x5adb=function(_0x4fd451,_0xcc0801){_0x4fd451=_0x4fd451-0x0;var _0x160342=_0xadb5[_0x4fd451];return _0x160342;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1f9c7a,_0x46178b){var _0x474f00=function(_0x182844){while(--_0x182844){_0x1f9c7a['push'](_0x1f9c7a['shift']());}};_0x474f00(++_0x46178b);}(_0x2032,0xd9));var _0x2203=function(_0x48c828,_0x272bd7){_0x48c828=_0x48c828-0x0;var _0x7e41df=_0x2032[_0x48c828];return _0x7e41df;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 19fd19e..3f4eb47 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 _0x787c=['../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','admin','user','then','name','add','minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','../../mysqldb'];(function(_0x1e8cb5,_0x2ecea0){var _0x969afb=function(_0x25b36c){while(--_0x25b36c){_0x1e8cb5['push'](_0x1e8cb5['shift']());}};_0x969afb(++_0x2ecea0);}(_0x787c,0xbe));var _0xc787=function(_0x106c55,_0x3bef8a){_0x106c55=_0x106c55-0x0;var _0x18cc48=_0x787c[_0x106c55];return _0x18cc48;};'use strict';var passport=require(_0xc787('0x0'));var LocalStrategy=require(_0xc787('0x1'))['Strategy'];var moment=require(_0xc787('0x2'));var ActiveDirectory=require(_0xc787('0x3'));var BPromise=require(_0xc787('0x4'));var util=require('util');var db=require(_0xc787('0x5'))['db'];var authService=require(_0xc787('0x6'));var utils=require(_0xc787('0x7'));var config=require(_0xc787('0x8'));var logger=require(_0xc787('0x9'))(_0xc787('0xa'));function isActiveDirectoryConfigured(_0x1865b9){var _0x5a3048=![];if(typeof _0x1865b9['activedirectory']!=='undefined'){_0x5a3048=_0x1865b9[_0xc787('0xb')][_0xc787('0xc')]&&_0x1865b9['activedirectory'][_0xc787('0xd')]&&_0x1865b9[_0xc787('0xb')][_0xc787('0xe')];}return _0x5a3048;}function adAuthenticate(_0x1771b9,_0xe75816,_0x1b5280){return new BPromise(function(_0x3e520d,_0xab38b3){try{var _0x38cd1e=new ActiveDirectory(_0x1771b9);_0x38cd1e[_0xc787('0xf')](_0xe75816,_0x1b5280,function(_0xd9baca,_0x4afaf3){if(_0xd9baca){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0xe75816,util[_0xc787('0x10')](_0xd9baca,{'showHidden':![],'depth':null}));_0xab38b3(_0xc787('0x11'));}else if(!_0x4afaf3){logger[_0xc787('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0xe75816);_0xab38b3(_0xc787('0x11'));}else{_0x3e520d(_0x4afaf3);}});}catch(_0xc23137){_0xab38b3(_0xc23137);}});}function ActiveDirectoryAuthenticate(_0x99b033,_0x499d8b,_0x2e3fbf,_0x1ffef0){var _0x4aea25,_0x3327b9;if(!isActiveDirectoryConfigured(config)){logger[_0xc787('0x12')](_0xc787('0x13'),_0x499d8b);return _0x1ffef0(null,![],{'message':_0xc787('0x11')});}return db[_0xc787('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xc787('0x15'),_0xc787('0x16')],'raw':!![]})['then'](function(_0x367929){_0x4aea25=_0x367929;if(!_0x4aea25[_0xc787('0x15')]){logger[_0xc787('0x12')](_0xc787('0x17'),_0x499d8b);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x99b033[_0xc787('0x18')]({'attributes':['id','name',_0xc787('0x19'),_0xc787('0x1a'),_0xc787('0x1b'),_0xc787('0x1c'),_0xc787('0x1d'),_0xc787('0x1e'),_0xc787('0x1f')],'where':{'name':_0x499d8b,'role':{'$or':[_0xc787('0x20'),_0xc787('0x21'),'agent']},'adSsoEnabled':!![]}});})[_0xc787('0x22')](function(_0x32dffc){if(!_0x32dffc||_0x32dffc&&_0x32dffc[_0xc787('0x23')]!==_0x499d8b){throw new Error(_0xc787('0x11'));}_0x3327b9=_0x32dffc;var _0x321dbf=_0x3327b9[_0xc787('0x23')]+'@'+config[_0xc787('0xb')][_0xc787('0xe')];return adAuthenticate(config[_0xc787('0xb')],_0x321dbf,_0x2e3fbf);})[_0xc787('0x22')](function(_0x58f0f8){if(_0x3327b9[_0xc787('0x1c')]){throw new Error(_0xc787('0x11'));}if(_0x4aea25[_0xc787('0x16')]>0x0){if(_0x3327b9[_0xc787('0x1d')]){if(moment(_0x3327b9[_0xc787('0x1e')])[_0xc787('0x24')](_0x4aea25[_0xc787('0x16')],_0xc787('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xc787('0x26')](_0x3327b9,0x0,![],null)[_0xc787('0x22')](function(){return utils[_0xc787('0x27')](_0x3327b9);})['then'](function(){return _0x1ffef0(null,_0x3327b9);});}else{return utils['getLicense'](_0x3327b9)[_0xc787('0x22')](function(){return _0x1ffef0(null,_0x3327b9);});}}else{return utils['getLicense'](_0x3327b9)['then'](function(){return _0x1ffef0(null,_0x3327b9);});}})[_0xc787('0x28')](function(_0x575887){return _0x1ffef0(null,![],_0x575887);});}function handleError(_0xd60968,_0x5dbc6e,_0x2e8f10){return _0xd60968[_0xc787('0x29')](_0x5dbc6e||0x1f4)['send']({'message':_0x2e8f10?_0x2e8f10[_0xc787('0x2a')]||_0x2e8f10:''});}exports[_0xc787('0x2b')]=function(_0x3a5240,_0xabb96b,_0x41a450){passport[_0xc787('0xf')](_0xc787('0x2c'),function(_0xdb7944,_0x46c7f9,_0x471e57){var _0x42157e=_0xdb7944||_0x471e57;if(_0x42157e){return handleError(_0xabb96b,0x191,_0x42157e);}if(!_0x46c7f9){return handleError(_0xabb96b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x248a62={'payload':{'id':_0x46c7f9['id'],'role':_0x46c7f9['role']},'options':{'expiresIn':0x15180}};return authService[_0xc787('0x2d')](_0x248a62)['then'](function(_0x16bee6){_0xabb96b[_0xc787('0x2e')]({'id':_0x46c7f9['id'],'token':_0x16bee6,'statusCall':'','isAlreadyLogged':_0x46c7f9['online']});});}})(_0x3a5240,_0xabb96b,_0x41a450);};passport[_0xc787('0x2f')](_0xc787('0x2c'),new LocalStrategy({'usernameField':_0xc787('0x23'),'passwordField':'password'},function(_0x292c8a,_0x261b5e,_0x207aa3){return ActiveDirectoryAuthenticate(db[_0xc787('0x30')],_0x292c8a,_0x261b5e,_0x207aa3);})); \ No newline at end of file +var _0x5f50=['domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','minutes','clearBlockUser','getLicense','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x5f50,0xbb));var _0x05f5=function(_0x4d5a7c,_0x124f0f){_0x4d5a7c=_0x4d5a7c-0x0;var _0x332adf=_0x5f50[_0x4d5a7c];return _0x332adf;};'use strict';var passport=require(_0x05f5('0x0'));var LocalStrategy=require(_0x05f5('0x1'))[_0x05f5('0x2')];var moment=require(_0x05f5('0x3'));var ActiveDirectory=require(_0x05f5('0x4'));var BPromise=require(_0x05f5('0x5'));var util=require(_0x05f5('0x6'));var db=require(_0x05f5('0x7'))['db'];var authService=require(_0x05f5('0x8'));var utils=require(_0x05f5('0x9'));var config=require(_0x05f5('0xa'));var logger=require(_0x05f5('0xb'))(_0x05f5('0xc'));function isActiveDirectoryConfigured(_0x101399){var _0xc33a5=![];if(typeof _0x101399[_0x05f5('0xd')]!==_0x05f5('0xe')){_0xc33a5=_0x101399['activedirectory'][_0x05f5('0xf')]&&_0x101399['activedirectory'][_0x05f5('0x10')]&&_0x101399[_0x05f5('0xd')][_0x05f5('0x11')];}return _0xc33a5;}function adAuthenticate(_0x8677d2,_0x287ee8,_0x554431){return new BPromise(function(_0x5b0023,_0x58a5b4){try{var _0x713762=new ActiveDirectory(_0x8677d2);_0x713762[_0x05f5('0x12')](_0x287ee8,_0x554431,function(_0x3c0d96,_0x3aa8ce){if(_0x3c0d96){logger[_0x05f5('0x13')](_0x05f5('0x14'),_0x287ee8,util['inspect'](_0x3c0d96,{'showHidden':![],'depth':null}));_0x58a5b4('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x3aa8ce){logger['error'](_0x05f5('0x15'),_0x287ee8);_0x58a5b4(_0x05f5('0x16'));}else{_0x5b0023(_0x3aa8ce);}});}catch(_0x1893db){_0x58a5b4(_0x1893db);}});}function ActiveDirectoryAuthenticate(_0x2d0a76,_0xd15ed4,_0x16c940,_0x495308){var _0x3239c1,_0x5435d1;if(!isActiveDirectoryConfigured(config)){logger[_0x05f5('0x13')](_0x05f5('0x17'),_0xd15ed4);return _0x495308(null,![],{'message':_0x05f5('0x16')});}return db[_0x05f5('0x18')][_0x05f5('0x19')]({'where':{'id':0x1},'attributes':[_0x05f5('0x1a'),_0x05f5('0x1b')],'raw':!![]})[_0x05f5('0x1c')](function(_0x3528c8){_0x3239c1=_0x3528c8;if(!_0x3239c1[_0x05f5('0x1a')]){logger[_0x05f5('0x13')](_0x05f5('0x1d'),_0xd15ed4);throw new Error(_0x05f5('0x16'));}return _0x2d0a76[_0x05f5('0x19')]({'attributes':['id',_0x05f5('0x1e'),'password',_0x05f5('0x1f'),_0x05f5('0x20'),_0x05f5('0x21'),_0x05f5('0x22'),_0x05f5('0x23'),_0x05f5('0x24')],'where':{'name':_0xd15ed4,'role':{'$or':[_0x05f5('0x25'),_0x05f5('0x26'),_0x05f5('0x27')]},'adSsoEnabled':!![]}});})[_0x05f5('0x1c')](function(_0x11b4df){if(!_0x11b4df||_0x11b4df&&_0x11b4df[_0x05f5('0x1e')]!==_0xd15ed4){throw new Error(_0x05f5('0x16'));}_0x5435d1=_0x11b4df;var _0x2b9bd5=_0x5435d1[_0x05f5('0x1e')]+'@'+config[_0x05f5('0xd')][_0x05f5('0x11')];return adAuthenticate(config[_0x05f5('0xd')],_0x2b9bd5,_0x16c940);})['then'](function(_0x17037e){if(_0x5435d1[_0x05f5('0x21')]){throw new Error(_0x05f5('0x16'));}if(_0x3239c1[_0x05f5('0x1b')]>0x0){if(_0x5435d1[_0x05f5('0x22')]){if(moment(_0x5435d1[_0x05f5('0x23')])['add'](_0x3239c1[_0x05f5('0x1b')],_0x05f5('0x28'))>moment()){throw new Error(_0x05f5('0x16'));}return utils[_0x05f5('0x29')](_0x5435d1,0x0,![],null)[_0x05f5('0x1c')](function(){return utils['getLicense'](_0x5435d1);})['then'](function(){return _0x495308(null,_0x5435d1);});}else{return utils[_0x05f5('0x2a')](_0x5435d1)[_0x05f5('0x1c')](function(){return _0x495308(null,_0x5435d1);});}}else{return utils[_0x05f5('0x2a')](_0x5435d1)['then'](function(){return _0x495308(null,_0x5435d1);});}})['catch'](function(_0x114b8d){return _0x495308(null,![],_0x114b8d);});}function handleError(_0x5e7652,_0xdec973,_0x5e0702){return _0x5e7652['status'](_0xdec973||0x1f4)[_0x05f5('0x2b')]({'message':_0x5e0702?_0x5e0702[_0x05f5('0x2c')]||_0x5e0702:''});}exports[_0x05f5('0x2d')]=function(_0xbcd816,_0x3213a7,_0x3baee9){passport['authenticate']('ad-login',function(_0x59a5e9,_0x1aff23,_0x2d335f){var _0x8db842=_0x59a5e9||_0x2d335f;if(_0x8db842){return handleError(_0x3213a7,0x191,_0x8db842);}if(!_0x1aff23){return handleError(_0x3213a7,0x194,{'message':_0x05f5('0x2e')});}else{var _0x1f867c={'payload':{'id':_0x1aff23['id'],'role':_0x1aff23[_0x05f5('0x20')]},'options':{'expiresIn':0x15180}};return authService[_0x05f5('0x2f')](_0x1f867c)[_0x05f5('0x1c')](function(_0x5a2bd8){_0x3213a7[_0x05f5('0x30')]({'id':_0x1aff23['id'],'token':_0x5a2bd8,'statusCall':'','isAlreadyLogged':_0x1aff23[_0x05f5('0x24')]});});}})(_0xbcd816,_0x3213a7,_0x3baee9);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0x05f5('0x1e'),'passwordField':_0x05f5('0x31')},function(_0xe1011a,_0x26d1ae,_0x473bc4){return ActiveDirectoryAuthenticate(db[_0x05f5('0x32')],_0xe1011a,_0x26d1ae,_0x473bc4);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 894842e..bab59bb 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 _0x5d07=['express','post','login','exports'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0x5d07,0xa0));var _0x75d0=function(_0x33c619,_0x4f7c37){_0x33c619=_0x33c619-0x0;var _0xde7647=_0x5d07[_0x33c619];return _0xde7647;};'use strict';var express=require(_0x75d0('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x75d0('0x1')]('/',controller[_0x75d0('0x2')]);module[_0x75d0('0x3')]=router; \ No newline at end of file +var _0xa0d8=['login','exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x42cb8d,_0x273bca){var _0x2713b6=function(_0x15b77f){while(--_0x15b77f){_0x42cb8d['push'](_0x42cb8d['shift']());}};_0x2713b6(++_0x273bca);}(_0xa0d8,0x18e));var _0x8a0d=function(_0x206367,_0x3fc479){_0x206367=_0x206367-0x0;var _0x40b1fb=_0xa0d8[_0x206367];return _0x40b1fb;};'use strict';var express=require(_0x8a0d('0x0'));var router=express[_0x8a0d('0x1')]();var controller=require(_0x8a0d('0x2'));router[_0x8a0d('0x3')]('/',controller[_0x8a0d('0x4')]);module[_0x8a0d('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 98531cd..68a3f47 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(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x7a54,0x106));var _0x47a5=function(_0x2e89fb,_0x3d3db6){_0x2e89fb=_0x2e89fb-0x0;var _0x1d07dc=_0x7a54[_0x2e89fb];return _0x1d07dc;};'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 _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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a54,0x106));var _0x47a5=function(_0x575044,_0x3f5c1a){_0x575044=_0x575044-0x0;var _0x5cbeb8=_0x7a54[_0x575044];return _0x5cbeb8;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9c4c39f..56e6668 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 _0xe0ad=['login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x220865,_0x5726be){var _0x4eb39a=function(_0x274b5e){while(--_0x274b5e){_0x220865['push'](_0x220865['shift']());}};_0x4eb39a(++_0x5726be);}(_0xe0ad,0x10b));var _0xde0a=function(_0x3c3033,_0x2f5373){_0x3c3033=_0x3c3033-0x0;var _0x530524=_0xe0ad[_0x3c3033];return _0x530524;};'use strict';var express=require(_0xde0a('0x0'));var passport=require(_0xde0a('0x1'));var router=express['Router']();var controller=require(_0xde0a('0x2'));var userController=require(_0xde0a('0x3'));var authService=require(_0xde0a('0x4'));router[_0xde0a('0x5')]('/',controller['login']);router['get'](_0xde0a('0x6'),controller[_0xde0a('0x7')],authService[_0xde0a('0x8')],userController[_0xde0a('0x9')],authService[_0xde0a('0xa')]);module[_0xde0a('0xb')]=router; \ No newline at end of file +var _0x9483=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express'];(function(_0xd89fde,_0x4d2417){var _0xe67f58=function(_0x4b21f9){while(--_0x4b21f9){_0xd89fde['push'](_0xd89fde['shift']());}};_0xe67f58(++_0x4d2417);}(_0x9483,0x154));var _0x3948=function(_0x25a733,_0x2563af){_0x25a733=_0x25a733-0x0;var _0x3f4613=_0x9483[_0x25a733];return _0x3f4613;};'use strict';var express=require(_0x3948('0x0'));var passport=require('passport');var router=express[_0x3948('0x1')]();var controller=require(_0x3948('0x2'));var userController=require(_0x3948('0x3'));var authService=require(_0x3948('0x4'));router[_0x3948('0x5')]('/',controller[_0x3948('0x6')]);router[_0x3948('0x5')](_0x3948('0x7'),controller[_0x3948('0x8')],authService[_0x3948('0x9')],userController[_0x3948('0x6')],authService[_0x3948('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 720cf85..fa2b985 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 _0xaf50=['allowedLoginAttempts','blockedAt','clearBlockUser','add','catch','getLicense','MailAccount','find','email','Smtp','format','\x22%s\x22\x20<%s>','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local-login','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Setting','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','http','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','loginAttempts','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38fafb,_0x1a3932){var _0x1c533d=function(_0x3b2c54){while(--_0x3b2c54){_0x38fafb['push'](_0x38fafb['shift']());}};_0x1c533d(++_0x1a3932);}(_0xaf50,0x116));var _0x0af5=function(_0x14ce42,_0x195d59){_0x14ce42=_0x14ce42-0x0;var _0x21327f=_0xaf50[_0x14ce42];return _0x21327f;};'use strict';var util=require(_0x0af5('0x0'));var passport=require('passport');var LocalStrategy=require(_0x0af5('0x1'))[_0x0af5('0x2')];var jayson=require(_0x0af5('0x3'));var _=require(_0x0af5('0x4'));var rs=require(_0x0af5('0x5'));var moment=require('moment');var db=require(_0x0af5('0x6'))['db'];var authService=require(_0x0af5('0x7'));var utils=require('../../config/utils');var client=jayson['client'][_0x0af5('0x8')]({'port':0x232b});function localAuthenticate(_0xbb4a69,_0x25660c,_0x147fa1,_0x3b0d83){var _0x521a89,_0x398c11;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0af5('0x9')],'raw':!![]})[_0x0af5('0xa')](function(_0x35f590){_0x521a89=_0x35f590;return _0xbb4a69[_0x0af5('0xb')]({'attributes':['id',_0x0af5('0xc'),_0x0af5('0xd'),_0x0af5('0xe'),_0x0af5('0xf'),_0x0af5('0x10'),_0x0af5('0x11'),'blockedAt',_0x0af5('0x12')],'where':{'name':_0x25660c,'role':{'$or':['admin','user',_0x0af5('0x13')]}}});})['then'](function(_0x1c18e3){if(!_0x1c18e3||_0x1c18e3&&_0x1c18e3['name']!==_0x25660c){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x398c11=_0x1c18e3;return _0x398c11;}})[_0x0af5('0xa')](function(){_0x398c11[_0x0af5('0x14')](_0x147fa1,function(_0x176d72,_0x28ad8d){var _0x57a8ed=_0x398c11['loginAttempts']+0x1;if(_0x176d72){return _0x3b0d83(_0x176d72);}else if(!_0x28ad8d){if(_0x398c11[_0x0af5('0x10')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else if(_0x521a89[_0x0af5('0x16')]>0x0){if(_0x398c11[_0x0af5('0x11')]){if(_0x521a89[_0x0af5('0x9')]>0x0){if(moment(_0x398c11[_0x0af5('0x17')])['add'](_0x521a89['blockDuration'],'minutes')>moment()){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils[_0x0af5('0x18')](_0x398c11,_0x57a8ed,![],null)[_0x0af5('0xa')](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{if(_0x57a8ed>=_0x521a89['allowedLoginAttempts']){return utils['clearBlockUser'](_0x398c11,0x0,!![],moment())['then'](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}else{return utils[_0x0af5('0x18')](_0x398c11,_0x57a8ed,![],null)[_0x0af5('0xa')](function(){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});});}}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{if(_0x398c11[_0x0af5('0x10')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else if(_0x521a89[_0x0af5('0x16')]>0x0){if(_0x398c11['blocked']){if(_0x521a89[_0x0af5('0x9')]>0x0){if(moment(_0x398c11[_0x0af5('0x17')])[_0x0af5('0x19')](_0x521a89[_0x0af5('0x9')],'minutes')>moment()){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils['clearBlockUser'](_0x398c11,0x0,![],null)['then'](function(){return utils['getLicense'](_0x398c11);})[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);});}}else{return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}}else{return utils['clearBlockUser'](_0x398c11,0x0,![],null)[_0x0af5('0xa')](function(){return utils['getLicense'](_0x398c11);})[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);})[_0x0af5('0x1a')](function(_0x2b3670){return _0x3b0d83(null,![],_0x2b3670);});}}else{if(_0x398c11[_0x0af5('0x11')]){return _0x3b0d83(null,![],{'message':_0x0af5('0x15')});}else{return utils[_0x0af5('0x1b')](_0x398c11)[_0x0af5('0xa')](function(){return _0x3b0d83(null,_0x398c11);});}}}});})['catch'](function(_0x118bda){return _0x3b0d83(null,![],_0x118bda);});}function sendServiceMail(_0x5e2044){return db[_0x0af5('0x1c')][_0x0af5('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x0af5('0xc'),_0x0af5('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x0af5('0x1f'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x436109){if(!_0x436109){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3b31e3=_0x436109['getSmtpOptions']();var _0x11cd20={'account':_0x3b31e3,'message':_['merge']({'from':util[_0x0af5('0x20')](_0x0af5('0x21'),_0x436109[_0x0af5('0xc')],_0x436109[_0x0af5('0x1e')]||_0x436109[_0x0af5('0x1f')][_0x0af5('0x22')])},_0x5e2044)};return client[_0x0af5('0x23')](_0x0af5('0x24'),_0x11cd20);})[_0x0af5('0xa')](function(_0x31e791){if(_0x31e791[_0x0af5('0x25')]){throw new Error(util[_0x0af5('0x20')](_0x0af5('0x26'),_0x31e791[_0x0af5('0x25')]['message']||JSON[_0x0af5('0x27')](_0x31e791[_0x0af5('0x25')])));}return!![];});}function handleError(_0x15866f,_0x56f14e,_0x41ca95){return _0x15866f[_0x0af5('0x28')](_0x56f14e||0x1f4)[_0x0af5('0x29')]({'message':_0x41ca95?_0x41ca95['message']||_0x41ca95:''});}exports[_0x0af5('0x2a')]=function(_0x4368e3,_0x42d946,_0x3f193e){passport[_0x0af5('0x14')](_0x0af5('0x2b'),function(_0x4a7e51,_0x4a107e,_0x9b94e6){var _0x19edac=_0x4a7e51||_0x9b94e6;if(_0x19edac){return handleError(_0x42d946,0x191,_0x19edac);}if(!_0x4a107e){return handleError(_0x42d946,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x414c63={'payload':{'id':_0x4a107e['id'],'role':_0x4a107e[_0x0af5('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x414c63)[_0x0af5('0xa')](function(_0x451281){_0x42d946[_0x0af5('0x2c')]({'id':_0x4a107e['id'],'token':_0x451281,'statusCall':'','isAlreadyLogged':_0x4a107e[_0x0af5('0x2d')]});});}})(_0x4368e3,_0x42d946,_0x3f193e);};exports[_0x0af5('0x2e')]=function(_0x5eb97e,_0x150a2e){if(!_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')]){return handleError(_0x150a2e,0x1f4,{'message':_0x0af5('0x30')});}var _0x4ef993=rs[_0x0af5('0x31')]();_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')]=_0x5eb97e['body'][_0x0af5('0x1e')]['trim']()[_0x0af5('0x32')]();var _0x3517f4;return db['Setting'][_0x0af5('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0xafb041){_0x3517f4=_0xafb041;return db[_0x0af5('0x33')][_0x0af5('0x1d')]({'where':{'email':_0x5eb97e['body']['email']}});})[_0x0af5('0xa')](function(_0x56b201){if(!_0x56b201){throw new Error(_0x0af5('0x34'));}if(_0x56b201['disabled']){throw new Error(_0x0af5('0x35'));}if(_0x56b201[_0x0af5('0x11')]){if(moment(_0x56b201[_0x0af5('0x17')])[_0x0af5('0x19')](_0x3517f4[_0x0af5('0x9')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x56b201[_0x0af5('0x11')]=![];_0x56b201[_0x0af5('0x17')]=null;}}_0x56b201[_0x0af5('0x36')]=_0x4ef993;_0x56b201[_0x0af5('0x37')]=Date[_0x0af5('0x38')]()+0x36ee80;return _0x56b201[_0x0af5('0x39')]();})['then'](function(){return sendServiceMail({'to':_0x5eb97e[_0x0af5('0x2f')][_0x0af5('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0af5('0x3a')+_0x0af5('0x3b')+_0x0af5('0x3c')+_0x5eb97e[_0x0af5('0x3d')][_0x0af5('0x3e')]+_0x0af5('0x3f')+_0x4ef993+'\x0a\x0a'+_0x0af5('0x40')});})['then'](function(){_0x150a2e[_0x0af5('0x28')](0xc8)['send']({'message':_0x0af5('0x41')});})[_0x0af5('0x1a')](function(_0x5d819e){return handleError(_0x150a2e,0x1f4,_0x5d819e);});};exports['reset']=function(_0x12b7a8,_0x406f37){return db[_0x0af5('0x33')]['find']({'where':{'resetPasswordToken':_0x12b7a8[_0x0af5('0x42')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x0af5('0xa')](function(_0xc3a5f7){if(!_0xc3a5f7){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x0af5('0x43')][_0x0af5('0xb')]({'attributes':['id',_0x0af5('0x44'),_0x0af5('0x45'),_0x0af5('0x46')]})[_0x0af5('0xa')](function(_0x3a957f){if(_0x3a957f[_0x0af5('0x44')])authService['validatePasswordPattern'](_0x12b7a8['body']['password']);if(!_0x3a957f[_0x0af5('0x45')]||!_0xc3a5f7[_0x0af5('0x47')])return _0xc3a5f7;authService[_0x0af5('0x48')](_0x12b7a8[_0x0af5('0x2f')]['password'],_0xc3a5f7[_0x0af5('0x47')],_0x3a957f[_0x0af5('0x46')]);return _0xc3a5f7;})[_0x0af5('0xa')](function(){_0xc3a5f7[_0x0af5('0xd')]=_0x12b7a8[_0x0af5('0x2f')]['password'];_0xc3a5f7[_0x0af5('0x36')]=null;_0xc3a5f7[_0x0af5('0x37')]=null;return _0xc3a5f7[_0x0af5('0x39')]();});})[_0x0af5('0xa')](function(){_0x406f37['status'](0xc8)[_0x0af5('0x29')]({'message':_0x0af5('0x49')});})[_0x0af5('0x1a')](function(_0x1efb20){return handleError(_0x406f37,0x1f4,_0x1efb20);});};passport[_0x0af5('0x4a')](_0x0af5('0x2b'),new LocalStrategy({'usernameField':_0x0af5('0xc'),'passwordField':_0x0af5('0xd')},function(_0xe1e43,_0x75fed8,_0x3bcc27){return localAuthenticate(db['User'],_0xe1e43,_0x75fed8,_0x3bcc27);})); \ No newline at end of file +var _0x2b0d=['blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','add','minutes','getLicense','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','signToken','json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','catch','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','local-login','util','passport','passport-local','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2b0d,0x8f));var _0xd2b0=function(_0x48f683,_0xec583){_0x48f683=_0x48f683-0x0;var _0x13acce=_0x2b0d[_0x48f683];return _0x13acce;};'use strict';var util=require(_0xd2b0('0x0'));var passport=require(_0xd2b0('0x1'));var LocalStrategy=require(_0xd2b0('0x2'))['Strategy'];var jayson=require(_0xd2b0('0x3'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0xd2b0('0x4'));var db=require(_0xd2b0('0x5'))['db'];var authService=require(_0xd2b0('0x6'));var utils=require(_0xd2b0('0x7'));var client=jayson[_0xd2b0('0x8')][_0xd2b0('0x9')]({'port':0x232b});function localAuthenticate(_0x121b2e,_0x2d057b,_0x5bb03e,_0x7d18c0){var _0x2e2588,_0x3b0194;return db[_0xd2b0('0xa')][_0xd2b0('0xb')]({'where':{'id':0x1},'attributes':[_0xd2b0('0xc'),_0xd2b0('0xd')],'raw':!![]})[_0xd2b0('0xe')](function(_0x3bd115){_0x2e2588=_0x3bd115;return _0x121b2e['findOne']({'attributes':['id',_0xd2b0('0xf'),_0xd2b0('0x10'),_0xd2b0('0x11'),_0xd2b0('0x12'),_0xd2b0('0x13'),_0xd2b0('0x14'),_0xd2b0('0x15'),_0xd2b0('0x16')],'where':{'name':_0x2d057b,'role':{'$or':['admin',_0xd2b0('0x17'),_0xd2b0('0x18')]}}});})[_0xd2b0('0xe')](function(_0x2b50a8){if(!_0x2b50a8||_0x2b50a8&&_0x2b50a8[_0xd2b0('0xf')]!==_0x2d057b){throw new Error(_0xd2b0('0x19'));}else{_0x3b0194=_0x2b50a8;return _0x3b0194;}})['then'](function(){_0x3b0194['authenticate'](_0x5bb03e,function(_0x54603c,_0x38508c){var _0x34a1e8=_0x3b0194[_0xd2b0('0x16')]+0x1;if(_0x54603c){return _0x7d18c0(_0x54603c);}else if(!_0x38508c){if(_0x3b0194['disabled']){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}else if(_0x2e2588[_0xd2b0('0xc')]>0x0){if(_0x3b0194[_0xd2b0('0x14')]){if(_0x2e2588[_0xd2b0('0xd')]>0x0){if(moment(_0x3b0194[_0xd2b0('0x15')])['add'](_0x2e2588['blockDuration'],'minutes')>moment()){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}else{return utils[_0xd2b0('0x1a')](_0x3b0194,_0x34a1e8,![],null)[_0xd2b0('0xe')](function(){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});});}}else{return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}}else{if(_0x34a1e8>=_0x2e2588[_0xd2b0('0xc')]){return utils[_0xd2b0('0x1a')](_0x3b0194,0x0,!![],moment())[_0xd2b0('0xe')](function(){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});});}else{return utils[_0xd2b0('0x1a')](_0x3b0194,_0x34a1e8,![],null)[_0xd2b0('0xe')](function(){return _0x7d18c0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}}else{if(_0x3b0194['disabled']){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}else if(_0x2e2588[_0xd2b0('0xc')]>0x0){if(_0x3b0194['blocked']){if(_0x2e2588['blockDuration']>0x0){if(moment(_0x3b0194[_0xd2b0('0x15')])[_0xd2b0('0x1b')](_0x2e2588[_0xd2b0('0xd')],_0xd2b0('0x1c'))>moment()){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}else{return utils[_0xd2b0('0x1a')](_0x3b0194,0x0,![],null)['then'](function(){return utils[_0xd2b0('0x1d')](_0x3b0194);})[_0xd2b0('0xe')](function(){return _0x7d18c0(null,_0x3b0194);});}}else{return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}}else{return utils[_0xd2b0('0x1a')](_0x3b0194,0x0,![],null)[_0xd2b0('0xe')](function(){return utils[_0xd2b0('0x1d')](_0x3b0194);})[_0xd2b0('0xe')](function(){return _0x7d18c0(null,_0x3b0194);})['catch'](function(_0x4ec9f5){return _0x7d18c0(null,![],_0x4ec9f5);});}}else{if(_0x3b0194[_0xd2b0('0x14')]){return _0x7d18c0(null,![],{'message':_0xd2b0('0x19')});}else{return utils[_0xd2b0('0x1d')](_0x3b0194)['then'](function(){return _0x7d18c0(null,_0x3b0194);});}}}});})['catch'](function(_0x415ac6){return _0x7d18c0(null,![],_0x415ac6);});}function sendServiceMail(_0x1e5a58){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xd2b0('0xf'),_0xd2b0('0x1e')],'include':[{'model':db[_0xd2b0('0x1f')],'as':_0xd2b0('0x20'),'include':[{'model':db[_0xd2b0('0x21')],'as':'CloudProvider'}]}]})[_0xd2b0('0xe')](function(_0x245a67){if(!_0x245a67){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x16c806=_0x245a67[_0xd2b0('0x22')]();var _0x508617={'account':_0x16c806,'message':_['merge']({'from':util['format']('\x22%s\x22\x20<%s>',_0x245a67[_0xd2b0('0xf')],_0x245a67[_0xd2b0('0x1e')]||_0x245a67[_0xd2b0('0x20')][_0xd2b0('0x17')])},_0x1e5a58)};return client[_0xd2b0('0x23')](_0xd2b0('0x24'),_0x508617);})[_0xd2b0('0xe')](function(_0x3db759){if(_0x3db759[_0xd2b0('0x25')]){throw new Error(util[_0xd2b0('0x26')](_0xd2b0('0x27'),_0x3db759[_0xd2b0('0x25')][_0xd2b0('0x28')]||JSON[_0xd2b0('0x29')](_0x3db759[_0xd2b0('0x25')])));}return!![];});}function handleError(_0x335fea,_0x120277,_0x6b2cb5){return _0x335fea[_0xd2b0('0x2a')](_0x120277||0x1f4)['send']({'message':_0x6b2cb5?_0x6b2cb5['message']||_0x6b2cb5:''});}exports[_0xd2b0('0x2b')]=function(_0x1f59ba,_0x3b9941,_0x42ca41){passport['authenticate']('local-login',function(_0xfc63fc,_0x5ce38d,_0x18be8f){var _0x1760c7=_0xfc63fc||_0x18be8f;if(_0x1760c7){return handleError(_0x3b9941,0x191,_0x1760c7);}if(!_0x5ce38d){return handleError(_0x3b9941,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0xb65a4c={'payload':{'id':_0x5ce38d['id'],'role':_0x5ce38d[_0xd2b0('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xd2b0('0x2c')](_0xb65a4c)[_0xd2b0('0xe')](function(_0x43593b){_0x3b9941[_0xd2b0('0x2d')]({'id':_0x5ce38d['id'],'token':_0x43593b,'statusCall':'','isAlreadyLogged':_0x5ce38d[_0xd2b0('0x2e')]});});}})(_0x1f59ba,_0x3b9941,_0x42ca41);};exports['forgot']=function(_0x26fd7c,_0x5a4b4c){if(!_0x26fd7c[_0xd2b0('0x2f')][_0xd2b0('0x1e')]){return handleError(_0x5a4b4c,0x1f4,{'message':_0xd2b0('0x30')});}var _0x1b0736=rs['generate']();_0x26fd7c[_0xd2b0('0x2f')][_0xd2b0('0x1e')]=_0x26fd7c[_0xd2b0('0x2f')][_0xd2b0('0x1e')][_0xd2b0('0x31')]()[_0xd2b0('0x32')]();var _0x107965;return db[_0xd2b0('0xa')][_0xd2b0('0xb')]({'where':{'id':0x1},'attributes':[_0xd2b0('0xc'),_0xd2b0('0xd')],'raw':!![]})[_0xd2b0('0xe')](function(_0x9449db){_0x107965=_0x9449db;return db[_0xd2b0('0x33')][_0xd2b0('0x34')]({'where':{'email':_0x26fd7c['body'][_0xd2b0('0x1e')]}});})[_0xd2b0('0xe')](function(_0x4fd250){if(!_0x4fd250){throw new Error(_0xd2b0('0x35'));}if(_0x4fd250[_0xd2b0('0x13')]){throw new Error(_0xd2b0('0x36'));}if(_0x4fd250['blocked']){if(moment(_0x4fd250[_0xd2b0('0x15')])[_0xd2b0('0x1b')](_0x107965[_0xd2b0('0xd')],'minutes')>moment()){throw new Error(_0xd2b0('0x37'));}else{_0x4fd250[_0xd2b0('0x14')]=![];_0x4fd250[_0xd2b0('0x15')]=null;}}_0x4fd250[_0xd2b0('0x38')]=_0x1b0736;_0x4fd250['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x4fd250[_0xd2b0('0x39')]();})[_0xd2b0('0xe')](function(){return sendServiceMail({'to':_0x26fd7c['body'][_0xd2b0('0x1e')],'subject':_0xd2b0('0x3a'),'text':_0xd2b0('0x3b')+_0xd2b0('0x3c')+_0xd2b0('0x3d')+_0x26fd7c['headers'][_0xd2b0('0x3e')]+_0xd2b0('0x3f')+_0x1b0736+'\x0a\x0a'+_0xd2b0('0x40')});})[_0xd2b0('0xe')](function(){_0x5a4b4c[_0xd2b0('0x2a')](0xc8)[_0xd2b0('0x41')]({'message':_0xd2b0('0x42')});})[_0xd2b0('0x43')](function(_0x59f1cc){return handleError(_0x5a4b4c,0x1f4,_0x59f1cc);});};exports['reset']=function(_0x202a03,_0x265bc3){return db[_0xd2b0('0x33')][_0xd2b0('0x34')]({'where':{'resetPasswordToken':_0x202a03[_0xd2b0('0x44')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x4c9066){if(!_0x4c9066){throw new Error(_0xd2b0('0x45'));}return db['Setting'][_0xd2b0('0xb')]({'attributes':['id',_0xd2b0('0x46'),_0xd2b0('0x47'),_0xd2b0('0x48')]})[_0xd2b0('0xe')](function(_0x26c2c7){if(_0x26c2c7[_0xd2b0('0x46')])authService[_0xd2b0('0x49')](_0x202a03[_0xd2b0('0x2f')][_0xd2b0('0x10')]);if(!_0x26c2c7[_0xd2b0('0x47')]||!_0x4c9066[_0xd2b0('0x4a')])return _0x4c9066;authService['validatePasswordHistory'](_0x202a03[_0xd2b0('0x2f')][_0xd2b0('0x10')],_0x4c9066[_0xd2b0('0x4a')],_0x26c2c7[_0xd2b0('0x48')]);return _0x4c9066;})['then'](function(){_0x4c9066['password']=_0x202a03[_0xd2b0('0x2f')][_0xd2b0('0x10')];_0x4c9066[_0xd2b0('0x38')]=null;_0x4c9066['resetPasswordExpires']=null;return _0x4c9066['save']();});})[_0xd2b0('0xe')](function(){_0x265bc3[_0xd2b0('0x2a')](0xc8)['send']({'message':_0xd2b0('0x4b')});})[_0xd2b0('0x43')](function(_0x4d98d0){return handleError(_0x265bc3,0x1f4,_0x4d98d0);});};passport[_0xd2b0('0x4c')](_0xd2b0('0x4d'),new LocalStrategy({'usernameField':_0xd2b0('0xf'),'passwordField':_0xd2b0('0x10')},function(_0x41a9e9,_0x163d60,_0x504f3a){return localAuthenticate(db['User'],_0x41a9e9,_0x163d60,_0x504f3a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1e4de7a..da2fc3d 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 _0x242d=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports','express','Router'];(function(_0x239109,_0x5e9534){var _0x3d40f7=function(_0x5e8efb){while(--_0x5e8efb){_0x239109['push'](_0x239109['shift']());}};_0x3d40f7(++_0x5e9534);}(_0x242d,0xdf));var _0xd242=function(_0xbddf5d,_0x442a60){_0xbddf5d=_0xbddf5d-0x0;var _0x227959=_0x242d[_0xbddf5d];return _0x227959;};'use strict';var express=require(_0xd242('0x0'));var router=express[_0xd242('0x1')]();var controller=require(_0xd242('0x2'));router[_0xd242('0x3')]('/',controller[_0xd242('0x4')]);router[_0xd242('0x3')](_0xd242('0x5'),controller[_0xd242('0x6')]);router['post'](_0xd242('0x7'),controller['reset']);module[_0xd242('0x8')]=router; \ No newline at end of file +var _0xcfe5=['post','login','/forgot','forgot','/reset/:token','reset','exports','./authLocal.controller'];(function(_0x33ba2f,_0x3b6fe3){var _0x5ac7c8=function(_0x2106d7){while(--_0x2106d7){_0x33ba2f['push'](_0x33ba2f['shift']());}};_0x5ac7c8(++_0x3b6fe3);}(_0xcfe5,0xa7));var _0x5cfe=function(_0x335d2d,_0x26e065){_0x335d2d=_0x335d2d-0x0;var _0x379073=_0xcfe5[_0x335d2d];return _0x379073;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x5cfe('0x0'));router[_0x5cfe('0x1')]('/',controller[_0x5cfe('0x2')]);router[_0x5cfe('0x1')](_0x5cfe('0x3'),controller[_0x5cfe('0x4')]);router[_0x5cfe('0x1')](_0x5cfe('0x5'),controller[_0x5cfe('0x6')]);module[_0x5cfe('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index cf30e21..cd80ed7 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 _0xe176=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x4c8134,_0x3e2348){var _0x587a11=function(_0x2016e9){while(--_0x2016e9){_0x4c8134['push'](_0x4c8134['shift']());}};_0x587a11(++_0x3e2348);}(_0xe176,0xf6));var _0x6e17=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0xe176[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require(_0x6e17('0x0'));module[_0x6e17('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x6e17('0x2')]},'description':{'type':Sequelize[_0x6e17('0x2')]},'status':{'type':Sequelize[_0x6e17('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6e17('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc5b2=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc5b2,0x1a1));var _0x2c5b=function(_0x4d855b,_0x47a802){_0x4d855b=_0x4d855b-0x0;var _0x3c7e99=_0xc5b2[_0x4d855b];return _0x3c7e99;};'use strict';var Sequelize=require(_0x2c5b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c5b('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x2c5b('0x1')]},'description':{'type':Sequelize[_0x2c5b('0x1')]},'status':{'type':Sequelize[_0x2c5b('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2c5b('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 8c7aff9..4875415 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 _0x6186=['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','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','catch','show','params','length','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6186,0xa1));var _0x6618=function(_0x2ceba7,_0x451ce4){_0x2ceba7=_0x2ceba7-0x0;var _0x5348eb=_0x6186[_0x2ceba7];return _0x5348eb;};'use strict';var emlformat=require(_0x6618('0x0'));var rimraf=require(_0x6618('0x1'));var zipdir=require(_0x6618('0x2'));var jsonpatch=require(_0x6618('0x3'));var rp=require(_0x6618('0x4'));var moment=require(_0x6618('0x5'));var BPromise=require(_0x6618('0x6'));var Mustache=require(_0x6618('0x7'));var util=require('util');var path=require(_0x6618('0x8'));var sox=require(_0x6618('0x9'));var csv=require(_0x6618('0xa'));var ejs=require(_0x6618('0xb'));var fs=require('fs');var fs_extra=require(_0x6618('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6618('0xd'));var deskjs=require(_0x6618('0xe'));var toCsv=require(_0x6618('0xa'));var querystring=require(_0x6618('0xf'));var Papa=require('papaparse');var Redis=require(_0x6618('0x10'));var authService=require(_0x6618('0x11'));var qs=require(_0x6618('0x12'));var as=require(_0x6618('0x13'));var hardwareService=require(_0x6618('0x14'));var logger=require(_0x6618('0x15'))(_0x6618('0x16'));var utils=require(_0x6618('0x17'));var config=require(_0x6618('0x18'));var licenseUtil=require(_0x6618('0x19'));var db=require(_0x6618('0x1a'))['db'];function respondWithStatusCode(_0x391d4e,_0x15ee30){_0x15ee30=_0x15ee30||0xcc;return function(_0x3867b4){if(_0x3867b4){return _0x391d4e[_0x6618('0x1b')](_0x15ee30);}return _0x391d4e[_0x6618('0x1c')](_0x15ee30)['end']();};}function respondWithResult(_0x332339,_0x30f82f){_0x30f82f=_0x30f82f||0xc8;return function(_0x43adb1){if(_0x43adb1){return _0x332339[_0x6618('0x1c')](_0x30f82f)[_0x6618('0x1d')](_0x43adb1);}};}function respondWithFilteredResult(_0x295293,_0x3a1e73){return function(_0x165cc2){if(_0x165cc2){var _0x3d8151=typeof _0x3a1e73[_0x6618('0x1e')]===_0x6618('0x1f')&&typeof _0x3a1e73[_0x6618('0x20')]===_0x6618('0x1f');var _0x65c83b=_0x165cc2[_0x6618('0x21')];var _0x3603f5=_0x3d8151?0x0:_0x3a1e73[_0x6618('0x1e')];var _0x2f5364=_0x3d8151?_0x165cc2[_0x6618('0x21')]:_0x3a1e73[_0x6618('0x1e')]+_0x3a1e73[_0x6618('0x20')];var _0x4d1e2d;if(_0x2f5364>=_0x65c83b){_0x2f5364=_0x65c83b;_0x4d1e2d=0xc8;}else{_0x4d1e2d=0xce;}_0x295293[_0x6618('0x1c')](_0x4d1e2d);return _0x295293[_0x6618('0x22')](_0x6618('0x23'),_0x3603f5+'-'+_0x2f5364+'/'+_0x65c83b)[_0x6618('0x1d')](_0x165cc2);}return null;};}function patchUpdates(_0x25c541){return function(_0x411885){try{jsonpatch[_0x6618('0x24')](_0x411885,_0x25c541,!![]);}catch(_0x540e97){return BPromise[_0x6618('0x25')](_0x540e97);}return _0x411885[_0x6618('0x26')]();};}function saveUpdates(_0x29c2ca,_0x1cebdf){return function(_0x2d5f37){if(_0x2d5f37){return _0x2d5f37[_0x6618('0x27')](_0x29c2ca)[_0x6618('0x28')](function(_0x278ac9){return _0x278ac9;});}return null;};}function removeEntity(_0x29da8b,_0x4aa963){return function(_0x180489){if(_0x180489){return _0x180489[_0x6618('0x29')]()['then'](function(){_0x29da8b[_0x6618('0x1c')](0xcc)[_0x6618('0x2a')]();});}};}function handleEntityNotFound(_0x284261,_0x36a433){return function(_0x414b28){if(!_0x414b28){_0x284261[_0x6618('0x1b')](0x194);}return _0x414b28;};}function handleError(_0x4b614e,_0x963d2b){_0x963d2b=_0x963d2b||0x1f4;return function(_0x38b7a2){logger['error'](_0x38b7a2[_0x6618('0x2b')]);if(_0x38b7a2['name']){delete _0x38b7a2[_0x6618('0x2c')];}_0x4b614e[_0x6618('0x1c')](_0x963d2b)[_0x6618('0x2d')](_0x38b7a2);};}exports[_0x6618('0x2e')]=function(_0x68eb6b,_0x3a960d){var _0x8c7444={},_0x47e6e5={},_0x460d6d={'count':0x0,'rows':[]};var _0x20d4f7=_[_0x6618('0x2f')](db['Automation'][_0x6618('0x30')],function(_0x351c43){return{'name':_0x351c43[_0x6618('0x31')],'type':_0x351c43[_0x6618('0x32')]['key']};});_0x47e6e5[_0x6618('0x33')]=_['map'](_0x20d4f7,_0x6618('0x2c'));_0x47e6e5[_0x6618('0x34')]=_[_0x6618('0x35')](_0x68eb6b[_0x6618('0x34')]);_0x47e6e5[_0x6618('0x36')]=_[_0x6618('0x37')](_0x47e6e5[_0x6618('0x33')],_0x47e6e5[_0x6618('0x34')]);_0x8c7444[_0x6618('0x38')]=_[_0x6618('0x37')](_0x47e6e5[_0x6618('0x33')],qs[_0x6618('0x39')](_0x68eb6b['query']['fields']));_0x8c7444['attributes']=_0x8c7444['attributes']['length']?_0x8c7444[_0x6618('0x38')]:_0x47e6e5['model'];if(!_0x68eb6b[_0x6618('0x34')][_0x6618('0x3a')](_0x6618('0x3b'))){_0x8c7444[_0x6618('0x20')]=qs[_0x6618('0x20')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x20')]);_0x8c7444['offset']=qs[_0x6618('0x1e')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x1e')]);}_0x8c7444[_0x6618('0x3c')]=qs[_0x6618('0x3d')](_0x68eb6b[_0x6618('0x34')][_0x6618('0x3d')]);_0x8c7444['where']=qs[_0x6618('0x36')](_[_0x6618('0x3e')](_0x68eb6b['query'],_0x47e6e5[_0x6618('0x36')]),_0x20d4f7);if(_0x68eb6b['query'][_0x6618('0x3f')]){_0x8c7444[_0x6618('0x40')]=_[_0x6618('0x41')](_0x8c7444['where'],{'$or':_['map'](_0x20d4f7,function(_0x3fbfa0){if(_0x3fbfa0[_0x6618('0x32')]!==_0x6618('0x42')){var _0x4e1862={};_0x4e1862[_0x3fbfa0['name']]={'$like':'%'+_0x68eb6b[_0x6618('0x34')][_0x6618('0x3f')]+'%'};return _0x4e1862;}})});}_0x8c7444=_[_0x6618('0x41')]({},_0x8c7444,_0x68eb6b[_0x6618('0x43')]);var _0x356da8={'where':_0x8c7444[_0x6618('0x40')]};return db[_0x6618('0x44')][_0x6618('0x21')](_0x356da8)[_0x6618('0x28')](function(_0x110507){_0x460d6d[_0x6618('0x21')]=_0x110507;if(_0x68eb6b[_0x6618('0x34')][_0x6618('0x45')]){_0x8c7444['include']=[{'all':!![]}];}return db[_0x6618('0x44')][_0x6618('0x46')](_0x8c7444);})['then'](function(_0x6885ce){_0x460d6d[_0x6618('0x47')]=_0x6885ce;return _0x460d6d;})[_0x6618('0x28')](respondWithFilteredResult(_0x3a960d,_0x8c7444))[_0x6618('0x48')](handleError(_0x3a960d,null));};exports[_0x6618('0x49')]=function(_0x25ac5b,_0x220725){var _0x24191d={'raw':![],'where':{'id':_0x25ac5b[_0x6618('0x4a')]['id']}},_0x58207b={};_0x58207b[_0x6618('0x33')]=_[_0x6618('0x35')](db['Automation'][_0x6618('0x30')]);_0x58207b['query']=_['keys'](_0x25ac5b[_0x6618('0x34')]);_0x58207b[_0x6618('0x36')]=_[_0x6618('0x37')](_0x58207b[_0x6618('0x33')],_0x58207b['query']);_0x24191d['attributes']=_['intersection'](_0x58207b[_0x6618('0x33')],qs[_0x6618('0x39')](_0x25ac5b[_0x6618('0x34')][_0x6618('0x39')]));_0x24191d[_0x6618('0x38')]=_0x24191d[_0x6618('0x38')][_0x6618('0x4b')]?_0x24191d[_0x6618('0x38')]:_0x58207b[_0x6618('0x33')];if(_0x25ac5b[_0x6618('0x34')]['includeAll']){_0x24191d['include']=[{'all':!![]}];}_0x24191d=_[_0x6618('0x41')]({},_0x24191d,_0x25ac5b[_0x6618('0x43')]);return db[_0x6618('0x44')][_0x6618('0x4c')](_0x24191d)[_0x6618('0x28')](handleEntityNotFound(_0x220725,null))[_0x6618('0x28')](respondWithResult(_0x220725,null))['catch'](handleError(_0x220725,null));};exports['create']=function(_0x2f4b0e,_0x4c8c16){return db[_0x6618('0x44')][_0x6618('0x4d')](_0x2f4b0e['body'],{})[_0x6618('0x28')](respondWithResult(_0x4c8c16,0xc9))[_0x6618('0x48')](handleError(_0x4c8c16,null));};exports[_0x6618('0x27')]=function(_0x5da09b,_0xdfbce){if(_0x5da09b[_0x6618('0x4e')]['id']){delete _0x5da09b[_0x6618('0x4e')]['id'];}return db[_0x6618('0x44')][_0x6618('0x4c')]({'where':{'id':_0x5da09b[_0x6618('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdfbce,null))[_0x6618('0x28')](saveUpdates(_0x5da09b['body'],null))[_0x6618('0x28')](respondWithResult(_0xdfbce,null))['catch'](handleError(_0xdfbce,null));};exports[_0x6618('0x29')]=function(_0x4fbe83,_0x120e36){return db['Automation'][_0x6618('0x4c')]({'where':{'id':_0x4fbe83[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x120e36,null))['then'](removeEntity(_0x120e36,null))['catch'](handleError(_0x120e36,null));};exports[_0x6618('0x4f')]=function(_0x669ba2,_0x5588e3,_0x52d63d){return db[_0x6618('0x50')][_0x6618('0x4c')]({'where':{'id':_0x669ba2[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x5588e3,null))[_0x6618('0x28')](function(_0x369ed4){if(_0x369ed4){return _0x369ed4[_0x6618('0x4f')](_0x669ba2[_0x6618('0x4e')][_0x6618('0x51')],_[_0x6618('0x52')](_0x669ba2['body'],[_0x6618('0x51'),'id'])||{});}})[_0x6618('0x28')](respondWithResult(_0x5588e3,null))[_0x6618('0x48')](handleError(_0x5588e3,null));};exports['getConditions']=function(_0x4e5f05,_0x17d60d,_0xda6c91){var _0x5c3d61={};var _0x5a206d={};var _0x52a063;var _0x194f80;return db[_0x6618('0x44')][_0x6618('0x53')]({'where':{'id':_0x4e5f05['params']['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x17d60d,null))[_0x6618('0x28')](function(_0x18d8fa){if(_0x18d8fa){_0x52a063=_0x18d8fa;_0x5a206d[_0x6618('0x33')]=_['keys'](db['Condition'][_0x6618('0x30')]);_0x5a206d[_0x6618('0x34')]=_[_0x6618('0x35')](_0x4e5f05[_0x6618('0x34')]);_0x5a206d['filters']=_[_0x6618('0x37')](_0x5a206d['model'],_0x5a206d[_0x6618('0x34')]);_0x5c3d61[_0x6618('0x38')]=_['intersection'](_0x5a206d[_0x6618('0x33')],qs['fields'](_0x4e5f05[_0x6618('0x34')][_0x6618('0x39')]));_0x5c3d61['attributes']=_0x5c3d61[_0x6618('0x38')][_0x6618('0x4b')]?_0x5c3d61[_0x6618('0x38')]:_0x5a206d[_0x6618('0x33')];_0x5c3d61['order']=qs['sort'](_0x4e5f05[_0x6618('0x34')][_0x6618('0x3d')]);_0x5c3d61[_0x6618('0x40')]=qs[_0x6618('0x36')](_[_0x6618('0x3e')](_0x4e5f05[_0x6618('0x34')],_0x5a206d[_0x6618('0x36')]));if(_0x4e5f05['query']['filter']){_0x5c3d61[_0x6618('0x40')]=_[_0x6618('0x41')](_0x5c3d61[_0x6618('0x40')],{'$or':_[_0x6618('0x2f')](_0x5c3d61['attributes'],function(_0x298179){var _0x39acda={};_0x39acda[_0x298179]={'$like':'%'+_0x4e5f05['query'][_0x6618('0x3f')]+'%'};return _0x39acda;})});}_0x5c3d61=_[_0x6618('0x41')]({},_0x5c3d61,_0x4e5f05[_0x6618('0x43')]);return _0x52a063[_0x6618('0x54')](_0x5c3d61);}})['then'](function(_0x11ef47){if(_0x11ef47){_0x194f80=_0x11ef47[_0x6618('0x4b')];if(!_0x4e5f05[_0x6618('0x34')][_0x6618('0x3a')]('nolimit')){_0x5c3d61['limit']=qs[_0x6618('0x20')](_0x4e5f05[_0x6618('0x34')][_0x6618('0x20')]);_0x5c3d61[_0x6618('0x1e')]=qs[_0x6618('0x1e')](_0x4e5f05[_0x6618('0x34')][_0x6618('0x1e')]);}return _0x52a063[_0x6618('0x54')](_0x5c3d61);}})['then'](function(_0x2c967c){if(_0x2c967c){return _0x2c967c?{'count':_0x194f80,'rows':_0x2c967c}:null;}})[_0x6618('0x28')](respondWithResult(_0x17d60d,null))[_0x6618('0x48')](handleError(_0x17d60d,null));};exports[_0x6618('0x55')]=function(_0x24d1e8,_0x76d709,_0x460d92){return db[_0x6618('0x56')][_0x6618('0x4c')]({'where':{'id':_0x24d1e8['params']['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x76d709,null))[_0x6618('0x28')](function(_0x2be967){if(_0x2be967){return _0x2be967[_0x6618('0x55')](_0x24d1e8['body'][_0x6618('0x51')],_[_0x6618('0x52')](_0x24d1e8[_0x6618('0x4e')],[_0x6618('0x51'),'id'])||{});}})[_0x6618('0x28')](respondWithResult(_0x76d709,null))['catch'](handleError(_0x76d709,null));};exports[_0x6618('0x57')]=function(_0x2d8e90,_0x9e126c,_0x3a2e8b){var _0x5a3f99={};var _0x4c32d4={};var _0x58b4fc;var _0x9f9faf;return db[_0x6618('0x44')][_0x6618('0x53')]({'where':{'id':_0x2d8e90[_0x6618('0x4a')]['id']}})[_0x6618('0x28')](handleEntityNotFound(_0x9e126c,null))[_0x6618('0x28')](function(_0x59a59e){if(_0x59a59e){_0x58b4fc=_0x59a59e;_0x4c32d4[_0x6618('0x33')]=_['keys'](db[_0x6618('0x56')][_0x6618('0x30')]);_0x4c32d4[_0x6618('0x34')]=_[_0x6618('0x35')](_0x2d8e90[_0x6618('0x34')]);_0x4c32d4[_0x6618('0x36')]=_[_0x6618('0x37')](_0x4c32d4[_0x6618('0x33')],_0x4c32d4['query']);_0x5a3f99['attributes']=_[_0x6618('0x37')](_0x4c32d4[_0x6618('0x33')],qs[_0x6618('0x39')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x39')]));_0x5a3f99[_0x6618('0x38')]=_0x5a3f99[_0x6618('0x38')][_0x6618('0x4b')]?_0x5a3f99['attributes']:_0x4c32d4[_0x6618('0x33')];_0x5a3f99[_0x6618('0x3c')]=qs[_0x6618('0x3d')](_0x2d8e90['query'][_0x6618('0x3d')]);_0x5a3f99[_0x6618('0x40')]=qs['filters'](_[_0x6618('0x3e')](_0x2d8e90['query'],_0x4c32d4[_0x6618('0x36')]));if(_0x2d8e90['query'][_0x6618('0x3f')]){_0x5a3f99[_0x6618('0x40')]=_[_0x6618('0x41')](_0x5a3f99[_0x6618('0x40')],{'$or':_[_0x6618('0x2f')](_0x5a3f99['attributes'],function(_0x140553){var _0x2e7b1={};_0x2e7b1[_0x140553]={'$like':'%'+_0x2d8e90[_0x6618('0x34')]['filter']+'%'};return _0x2e7b1;})});}_0x5a3f99=_[_0x6618('0x41')]({},_0x5a3f99,_0x2d8e90['options']);return _0x58b4fc[_0x6618('0x57')](_0x5a3f99);}})[_0x6618('0x28')](function(_0x3cef95){if(_0x3cef95){_0x9f9faf=_0x3cef95[_0x6618('0x4b')];if(!_0x2d8e90[_0x6618('0x34')][_0x6618('0x3a')]('nolimit')){_0x5a3f99[_0x6618('0x20')]=qs[_0x6618('0x20')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x20')]);_0x5a3f99[_0x6618('0x1e')]=qs[_0x6618('0x1e')](_0x2d8e90[_0x6618('0x34')][_0x6618('0x1e')]);}return _0x58b4fc[_0x6618('0x57')](_0x5a3f99);}})[_0x6618('0x28')](function(_0x532f26){if(_0x532f26){return _0x532f26?{'count':_0x9f9faf,'rows':_0x532f26}:null;}})[_0x6618('0x28')](respondWithResult(_0x9e126c,null))[_0x6618('0x48')](handleError(_0x9e126c,null));}; \ No newline at end of file +var _0x63fd=['set','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','index','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','merge','map','VIRTUAL','rows','catch','params','includeAll','include','options','find','create','body','Condition','ids','omit','getConditions','sort','pick','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count'];(function(_0x2a3a3a,_0x1e83af){var _0x52de3e=function(_0x1d7e04){while(--_0x1d7e04){_0x2a3a3a['push'](_0x2a3a3a['shift']());}};_0x52de3e(++_0x1e83af);}(_0x63fd,0x1c1));var _0xd63f=function(_0x48ad8a,_0x236ed5){_0x48ad8a=_0x48ad8a-0x0;var _0x113991=_0x63fd[_0x48ad8a];return _0x113991;};'use strict';var emlformat=require(_0xd63f('0x0'));var rimraf=require(_0xd63f('0x1'));var zipdir=require(_0xd63f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd63f('0x3'));var moment=require('moment');var BPromise=require(_0xd63f('0x4'));var Mustache=require(_0xd63f('0x5'));var util=require(_0xd63f('0x6'));var path=require(_0xd63f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd63f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd63f('0x9'));var squel=require(_0xd63f('0xa'));var crypto=require(_0xd63f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd63f('0xc'));var toCsv=require(_0xd63f('0xd'));var querystring=require(_0xd63f('0xe'));var Papa=require('papaparse');var Redis=require(_0xd63f('0xf'));var authService=require(_0xd63f('0x10'));var qs=require(_0xd63f('0x11'));var as=require(_0xd63f('0x12'));var hardwareService=require(_0xd63f('0x13'));var logger=require(_0xd63f('0x14'))(_0xd63f('0x15'));var utils=require(_0xd63f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd63f('0x17'));var db=require(_0xd63f('0x18'))['db'];function respondWithStatusCode(_0x55196f,_0x2182f7){_0x2182f7=_0x2182f7||0xcc;return function(_0x14c0b2){if(_0x14c0b2){return _0x55196f['sendStatus'](_0x2182f7);}return _0x55196f[_0xd63f('0x19')](_0x2182f7)[_0xd63f('0x1a')]();};}function respondWithResult(_0x6cc01b,_0x2da861){_0x2da861=_0x2da861||0xc8;return function(_0x11dcc4){if(_0x11dcc4){return _0x6cc01b[_0xd63f('0x19')](_0x2da861)['json'](_0x11dcc4);}};}function respondWithFilteredResult(_0x39be29,_0x16fdbd){return function(_0x37a2b6){if(_0x37a2b6){var _0x362703=typeof _0x16fdbd[_0xd63f('0x1b')]===_0xd63f('0x1c')&&typeof _0x16fdbd[_0xd63f('0x1d')]===_0xd63f('0x1c');var _0x5cd072=_0x37a2b6[_0xd63f('0x1e')];var _0x2c2618=_0x362703?0x0:_0x16fdbd[_0xd63f('0x1b')];var _0x4b0746=_0x362703?_0x37a2b6[_0xd63f('0x1e')]:_0x16fdbd['offset']+_0x16fdbd[_0xd63f('0x1d')];var _0x24855e;if(_0x4b0746>=_0x5cd072){_0x4b0746=_0x5cd072;_0x24855e=0xc8;}else{_0x24855e=0xce;}_0x39be29[_0xd63f('0x19')](_0x24855e);return _0x39be29[_0xd63f('0x1f')](_0xd63f('0x20'),_0x2c2618+'-'+_0x4b0746+'/'+_0x5cd072)[_0xd63f('0x21')](_0x37a2b6);}return null;};}function patchUpdates(_0x52e24d){return function(_0xe3985){try{jsonpatch[_0xd63f('0x22')](_0xe3985,_0x52e24d,!![]);}catch(_0x126838){return BPromise['reject'](_0x126838);}return _0xe3985[_0xd63f('0x23')]();};}function saveUpdates(_0x31263e,_0x2af191){return function(_0x346775){if(_0x346775){return _0x346775[_0xd63f('0x24')](_0x31263e)[_0xd63f('0x25')](function(_0xe189be){return _0xe189be;});}return null;};}function removeEntity(_0x32951e,_0x2b8f6c){return function(_0x27f9e9){if(_0x27f9e9){return _0x27f9e9[_0xd63f('0x26')]()[_0xd63f('0x25')](function(){_0x32951e[_0xd63f('0x19')](0xcc)[_0xd63f('0x1a')]();});}};}function handleEntityNotFound(_0x3bf95d,_0x1b4c11){return function(_0x23586b){if(!_0x23586b){_0x3bf95d[_0xd63f('0x27')](0x194);}return _0x23586b;};}function handleError(_0x3c820f,_0x2d56c3){_0x2d56c3=_0x2d56c3||0x1f4;return function(_0x25959a){logger['error'](_0x25959a[_0xd63f('0x28')]);if(_0x25959a[_0xd63f('0x29')]){delete _0x25959a[_0xd63f('0x29')];}_0x3c820f['status'](_0x2d56c3)['send'](_0x25959a);};}exports[_0xd63f('0x2a')]=function(_0x593e4e,_0x2ae21e){var _0x579c9e={},_0x12b40f={},_0x156d24={'count':0x0,'rows':[]};var _0x2c760d=_['map'](db[_0xd63f('0x2b')][_0xd63f('0x2c')],function(_0x3ec38e){return{'name':_0x3ec38e[_0xd63f('0x2d')],'type':_0x3ec38e[_0xd63f('0x2e')][_0xd63f('0x2f')]};});_0x12b40f[_0xd63f('0x30')]=_['map'](_0x2c760d,'name');_0x12b40f[_0xd63f('0x31')]=_[_0xd63f('0x32')](_0x593e4e[_0xd63f('0x31')]);_0x12b40f[_0xd63f('0x33')]=_[_0xd63f('0x34')](_0x12b40f[_0xd63f('0x30')],_0x12b40f[_0xd63f('0x31')]);_0x579c9e['attributes']=_['intersection'](_0x12b40f[_0xd63f('0x30')],qs[_0xd63f('0x35')](_0x593e4e[_0xd63f('0x31')][_0xd63f('0x35')]));_0x579c9e[_0xd63f('0x36')]=_0x579c9e[_0xd63f('0x36')][_0xd63f('0x37')]?_0x579c9e[_0xd63f('0x36')]:_0x12b40f[_0xd63f('0x30')];if(!_0x593e4e[_0xd63f('0x31')][_0xd63f('0x38')]('nolimit')){_0x579c9e[_0xd63f('0x1d')]=qs[_0xd63f('0x1d')](_0x593e4e[_0xd63f('0x31')]['limit']);_0x579c9e[_0xd63f('0x1b')]=qs[_0xd63f('0x1b')](_0x593e4e[_0xd63f('0x31')][_0xd63f('0x1b')]);}_0x579c9e['order']=qs['sort'](_0x593e4e['query']['sort']);_0x579c9e[_0xd63f('0x39')]=qs[_0xd63f('0x33')](_['pick'](_0x593e4e[_0xd63f('0x31')],_0x12b40f[_0xd63f('0x33')]),_0x2c760d);if(_0x593e4e[_0xd63f('0x31')][_0xd63f('0x3a')]){_0x579c9e[_0xd63f('0x39')]=_[_0xd63f('0x3b')](_0x579c9e[_0xd63f('0x39')],{'$or':_[_0xd63f('0x3c')](_0x2c760d,function(_0x34e21a){if(_0x34e21a[_0xd63f('0x2e')]!==_0xd63f('0x3d')){var _0x53e519={};_0x53e519[_0x34e21a[_0xd63f('0x29')]]={'$like':'%'+_0x593e4e[_0xd63f('0x31')][_0xd63f('0x3a')]+'%'};return _0x53e519;}})});}_0x579c9e=_[_0xd63f('0x3b')]({},_0x579c9e,_0x593e4e['options']);var _0x2fc29a={'where':_0x579c9e[_0xd63f('0x39')]};return db[_0xd63f('0x2b')][_0xd63f('0x1e')](_0x2fc29a)['then'](function(_0x51a2ab){_0x156d24[_0xd63f('0x1e')]=_0x51a2ab;if(_0x593e4e[_0xd63f('0x31')]['includeAll']){_0x579c9e['include']=[{'all':!![]}];}return db[_0xd63f('0x2b')]['findAll'](_0x579c9e);})['then'](function(_0x17a8b3){_0x156d24[_0xd63f('0x3e')]=_0x17a8b3;return _0x156d24;})[_0xd63f('0x25')](respondWithFilteredResult(_0x2ae21e,_0x579c9e))[_0xd63f('0x3f')](handleError(_0x2ae21e,null));};exports['show']=function(_0x797df4,_0x55690d){var _0x28ae60={'raw':![],'where':{'id':_0x797df4[_0xd63f('0x40')]['id']}},_0x1ef9b1={};_0x1ef9b1['model']=_[_0xd63f('0x32')](db[_0xd63f('0x2b')]['rawAttributes']);_0x1ef9b1[_0xd63f('0x31')]=_[_0xd63f('0x32')](_0x797df4[_0xd63f('0x31')]);_0x1ef9b1['filters']=_[_0xd63f('0x34')](_0x1ef9b1[_0xd63f('0x30')],_0x1ef9b1[_0xd63f('0x31')]);_0x28ae60[_0xd63f('0x36')]=_['intersection'](_0x1ef9b1[_0xd63f('0x30')],qs[_0xd63f('0x35')](_0x797df4[_0xd63f('0x31')]['fields']));_0x28ae60[_0xd63f('0x36')]=_0x28ae60[_0xd63f('0x36')][_0xd63f('0x37')]?_0x28ae60[_0xd63f('0x36')]:_0x1ef9b1[_0xd63f('0x30')];if(_0x797df4[_0xd63f('0x31')][_0xd63f('0x41')]){_0x28ae60[_0xd63f('0x42')]=[{'all':!![]}];}_0x28ae60=_[_0xd63f('0x3b')]({},_0x28ae60,_0x797df4[_0xd63f('0x43')]);return db['Automation'][_0xd63f('0x44')](_0x28ae60)[_0xd63f('0x25')](handleEntityNotFound(_0x55690d,null))['then'](respondWithResult(_0x55690d,null))[_0xd63f('0x3f')](handleError(_0x55690d,null));};exports['create']=function(_0x139fe2,_0x50b8a4){return db[_0xd63f('0x2b')][_0xd63f('0x45')](_0x139fe2['body'],{})[_0xd63f('0x25')](respondWithResult(_0x50b8a4,0xc9))[_0xd63f('0x3f')](handleError(_0x50b8a4,null));};exports[_0xd63f('0x24')]=function(_0x5ac13c,_0x35f832){if(_0x5ac13c[_0xd63f('0x46')]['id']){delete _0x5ac13c[_0xd63f('0x46')]['id'];}return db[_0xd63f('0x2b')][_0xd63f('0x44')]({'where':{'id':_0x5ac13c[_0xd63f('0x40')]['id']}})['then'](handleEntityNotFound(_0x35f832,null))[_0xd63f('0x25')](saveUpdates(_0x5ac13c[_0xd63f('0x46')],null))[_0xd63f('0x25')](respondWithResult(_0x35f832,null))[_0xd63f('0x3f')](handleError(_0x35f832,null));};exports['destroy']=function(_0x4163b2,_0x34cea8){return db[_0xd63f('0x2b')][_0xd63f('0x44')]({'where':{'id':_0x4163b2['params']['id']}})['then'](handleEntityNotFound(_0x34cea8,null))['then'](removeEntity(_0x34cea8,null))[_0xd63f('0x3f')](handleError(_0x34cea8,null));};exports['addConditions']=function(_0x46d3ee,_0x3a6368,_0x384b43){return db[_0xd63f('0x47')][_0xd63f('0x44')]({'where':{'id':_0x46d3ee[_0xd63f('0x40')]['id']}})[_0xd63f('0x25')](handleEntityNotFound(_0x3a6368,null))['then'](function(_0x5a52bf){if(_0x5a52bf){return _0x5a52bf['addConditions'](_0x46d3ee[_0xd63f('0x46')][_0xd63f('0x48')],_[_0xd63f('0x49')](_0x46d3ee[_0xd63f('0x46')],[_0xd63f('0x48'),'id'])||{});}})[_0xd63f('0x25')](respondWithResult(_0x3a6368,null))['catch'](handleError(_0x3a6368,null));};exports[_0xd63f('0x4a')]=function(_0x2535bc,_0x2503fd,_0x12e68d){var _0x3fa929={};var _0x1c6ac8={};var _0x3e833b;var _0x5a6d7b;return db[_0xd63f('0x2b')]['findOne']({'where':{'id':_0x2535bc[_0xd63f('0x40')]['id']}})[_0xd63f('0x25')](handleEntityNotFound(_0x2503fd,null))[_0xd63f('0x25')](function(_0x56650c){if(_0x56650c){_0x3e833b=_0x56650c;_0x1c6ac8[_0xd63f('0x30')]=_[_0xd63f('0x32')](db[_0xd63f('0x47')]['rawAttributes']);_0x1c6ac8[_0xd63f('0x31')]=_[_0xd63f('0x32')](_0x2535bc['query']);_0x1c6ac8[_0xd63f('0x33')]=_[_0xd63f('0x34')](_0x1c6ac8[_0xd63f('0x30')],_0x1c6ac8[_0xd63f('0x31')]);_0x3fa929['attributes']=_[_0xd63f('0x34')](_0x1c6ac8['model'],qs['fields'](_0x2535bc[_0xd63f('0x31')][_0xd63f('0x35')]));_0x3fa929[_0xd63f('0x36')]=_0x3fa929[_0xd63f('0x36')][_0xd63f('0x37')]?_0x3fa929['attributes']:_0x1c6ac8[_0xd63f('0x30')];_0x3fa929['order']=qs[_0xd63f('0x4b')](_0x2535bc[_0xd63f('0x31')][_0xd63f('0x4b')]);_0x3fa929['where']=qs[_0xd63f('0x33')](_[_0xd63f('0x4c')](_0x2535bc[_0xd63f('0x31')],_0x1c6ac8[_0xd63f('0x33')]));if(_0x2535bc[_0xd63f('0x31')]['filter']){_0x3fa929[_0xd63f('0x39')]=_[_0xd63f('0x3b')](_0x3fa929['where'],{'$or':_['map'](_0x3fa929[_0xd63f('0x36')],function(_0x2115d0){var _0x14b05c={};_0x14b05c[_0x2115d0]={'$like':'%'+_0x2535bc[_0xd63f('0x31')]['filter']+'%'};return _0x14b05c;})});}_0x3fa929=_['merge']({},_0x3fa929,_0x2535bc[_0xd63f('0x43')]);return _0x3e833b['getConditions'](_0x3fa929);}})['then'](function(_0x171376){if(_0x171376){_0x5a6d7b=_0x171376[_0xd63f('0x37')];if(!_0x2535bc[_0xd63f('0x31')]['hasOwnProperty']('nolimit')){_0x3fa929[_0xd63f('0x1d')]=qs['limit'](_0x2535bc[_0xd63f('0x31')][_0xd63f('0x1d')]);_0x3fa929['offset']=qs[_0xd63f('0x1b')](_0x2535bc['query'][_0xd63f('0x1b')]);}return _0x3e833b[_0xd63f('0x4a')](_0x3fa929);}})[_0xd63f('0x25')](function(_0x179b82){if(_0x179b82){return _0x179b82?{'count':_0x5a6d7b,'rows':_0x179b82}:null;}})[_0xd63f('0x25')](respondWithResult(_0x2503fd,null))[_0xd63f('0x3f')](handleError(_0x2503fd,null));};exports[_0xd63f('0x4d')]=function(_0x3bb93a,_0x3ab32f,_0x19de53){return db[_0xd63f('0x4e')][_0xd63f('0x44')]({'where':{'id':_0x3bb93a[_0xd63f('0x40')]['id']}})[_0xd63f('0x25')](handleEntityNotFound(_0x3ab32f,null))[_0xd63f('0x25')](function(_0x1c42cb){if(_0x1c42cb){return _0x1c42cb[_0xd63f('0x4d')](_0x3bb93a[_0xd63f('0x46')]['ids'],_[_0xd63f('0x49')](_0x3bb93a[_0xd63f('0x46')],[_0xd63f('0x48'),'id'])||{});}})[_0xd63f('0x25')](respondWithResult(_0x3ab32f,null))['catch'](handleError(_0x3ab32f,null));};exports[_0xd63f('0x4f')]=function(_0x233428,_0x10fc19,_0x22019b){var _0x82986f={};var _0x2db988={};var _0x3ef4ca;var _0x352ed1;return db[_0xd63f('0x2b')]['findOne']({'where':{'id':_0x233428[_0xd63f('0x40')]['id']}})[_0xd63f('0x25')](handleEntityNotFound(_0x10fc19,null))[_0xd63f('0x25')](function(_0x4a1696){if(_0x4a1696){_0x3ef4ca=_0x4a1696;_0x2db988[_0xd63f('0x30')]=_['keys'](db[_0xd63f('0x4e')][_0xd63f('0x2c')]);_0x2db988[_0xd63f('0x31')]=_['keys'](_0x233428['query']);_0x2db988['filters']=_['intersection'](_0x2db988[_0xd63f('0x30')],_0x2db988[_0xd63f('0x31')]);_0x82986f[_0xd63f('0x36')]=_[_0xd63f('0x34')](_0x2db988[_0xd63f('0x30')],qs[_0xd63f('0x35')](_0x233428[_0xd63f('0x31')][_0xd63f('0x35')]));_0x82986f[_0xd63f('0x36')]=_0x82986f[_0xd63f('0x36')][_0xd63f('0x37')]?_0x82986f['attributes']:_0x2db988[_0xd63f('0x30')];_0x82986f['order']=qs['sort'](_0x233428[_0xd63f('0x31')][_0xd63f('0x4b')]);_0x82986f[_0xd63f('0x39')]=qs[_0xd63f('0x33')](_[_0xd63f('0x4c')](_0x233428[_0xd63f('0x31')],_0x2db988['filters']));if(_0x233428[_0xd63f('0x31')]['filter']){_0x82986f[_0xd63f('0x39')]=_[_0xd63f('0x3b')](_0x82986f['where'],{'$or':_[_0xd63f('0x3c')](_0x82986f[_0xd63f('0x36')],function(_0x8dd615){var _0x4b277a={};_0x4b277a[_0x8dd615]={'$like':'%'+_0x233428[_0xd63f('0x31')][_0xd63f('0x3a')]+'%'};return _0x4b277a;})});}_0x82986f=_[_0xd63f('0x3b')]({},_0x82986f,_0x233428['options']);return _0x3ef4ca[_0xd63f('0x4f')](_0x82986f);}})['then'](function(_0x3ddf66){if(_0x3ddf66){_0x352ed1=_0x3ddf66[_0xd63f('0x37')];if(!_0x233428[_0xd63f('0x31')][_0xd63f('0x38')]('nolimit')){_0x82986f[_0xd63f('0x1d')]=qs[_0xd63f('0x1d')](_0x233428[_0xd63f('0x31')]['limit']);_0x82986f[_0xd63f('0x1b')]=qs[_0xd63f('0x1b')](_0x233428['query'][_0xd63f('0x1b')]);}return _0x3ef4ca[_0xd63f('0x4f')](_0x82986f);}})[_0xd63f('0x25')](function(_0x97d30f){if(_0x97d30f){return _0x97d30f?{'count':_0x352ed1,'rows':_0x97d30f}:null;}})[_0xd63f('0x25')](respondWithResult(_0x10fc19,null))[_0xd63f('0x3f')](handleError(_0x10fc19,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c8fb1d9..5deacc8 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 _0x3709=['request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3cec8c,_0x3f6c1d){var _0x38032e=function(_0x4ef75b){while(--_0x4ef75b){_0x3cec8c['push'](_0x3cec8c['shift']());}};_0x38032e(++_0x3f6c1d);}(_0x3709,0xe5));var _0x9370=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3709[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x9370('0x0'));var util=require(_0x9370('0x1'));var logger=require(_0x9370('0x2'))(_0x9370('0x3'));var moment=require('moment');var BPromise=require(_0x9370('0x4'));var rp=require(_0x9370('0x5'));var fs=require('fs');var path=require(_0x9370('0x6'));var rimraf=require(_0x9370('0x7'));var config=require('../../config/environment');var attributes=require(_0x9370('0x8'));module[_0x9370('0x9')]=function(_0x82ee63,_0x3ab958){return _0x82ee63[_0x9370('0xa')](_0x9370('0xb'),attributes,{'tableName':_0x9370('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd7=['api','moment','bluebird','path','../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5fd7,0x6c));var _0x75fd=function(_0x346ba5,_0x190f6c){_0x346ba5=_0x346ba5-0x0;var _0x4a3521=_0x5fd7[_0x346ba5];return _0x4a3521;};'use strict';var _=require(_0x75fd('0x0'));var util=require(_0x75fd('0x1'));var logger=require('../../config/logger')(_0x75fd('0x2'));var moment=require(_0x75fd('0x3'));var BPromise=require(_0x75fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75fd('0x5'));var rimraf=require('rimraf');var config=require(_0x75fd('0x6'));var attributes=require(_0x75fd('0x7'));module[_0x75fd('0x8')]=function(_0x3e1941,_0x1dded6){return _0x3e1941[_0x75fd('0x9')]('Automation',attributes,{'tableName':_0x75fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 7e97964..4fd4fea 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 _0xa958=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring'];(function(_0x141a86,_0xefe6c0){var _0x5e7c1b=function(_0x276243){while(--_0x276243){_0x141a86['push'](_0x141a86['shift']());}};_0x5e7c1b(++_0xefe6c0);}(_0xa958,0x94));var _0x8a95=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xa958[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x8a95('0x0'));var util=require('util');var moment=require(_0x8a95('0x1'));var BPromise=require(_0x8a95('0x2'));var rs=require(_0x8a95('0x3'));var fs=require('fs');var Redis=require(_0x8a95('0x4'));var db=require(_0x8a95('0x5'))['db'];var utils=require(_0x8a95('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a95('0x7'));var jayson=require(_0x8a95('0x8'));var client=jayson[_0x8a95('0x9')][_0x8a95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387db4,_0xdd54e1,_0x161f00){return new BPromise(function(_0x49287d,_0xe03b31){return client[_0x8a95('0xb')](_0x387db4,_0x161f00)[_0x8a95('0xc')](function(_0x240b22){logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));logger['debug'](_0x8a95('0x10'),_0xdd54e1,_0x8a95('0xf'),JSON['stringify'](_0x240b22));if(_0x240b22[_0x8a95('0x11')]){if(_0x240b22['error']['code']===0x1f4){logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0xe03b31(_0x240b22['error'][_0x8a95('0x12')]);}logger[_0x8a95('0x11')]('Automation,\x20%s,\x20%s',_0xdd54e1,_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);return _0x49287d(_0x240b22[_0x8a95('0x11')][_0x8a95('0x12')]);}else{logger[_0x8a95('0xd')](_0x8a95('0xe'),_0xdd54e1,_0x8a95('0xf'));_0x49287d(_0x240b22['result'][_0x8a95('0x12')]);}})['catch'](function(_0x334b18){logger['error'](_0x8a95('0xe'),_0xdd54e1,_0x334b18);_0xe03b31(_0x334b18);});});} \ No newline at end of file +var _0x27f3=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3770bf,_0x2f78fb){var _0x29a6fc=function(_0x3348e5){while(--_0x3348e5){_0x3770bf['push'](_0x3770bf['shift']());}};_0x29a6fc(++_0x2f78fb);}(_0x27f3,0x1e9));var _0x327f=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x27f3[_0x3a07c1];return _0x2bbe15;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var moment=require('moment');var BPromise=require(_0x327f('0x2'));var rs=require(_0x327f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var config=require(_0x327f('0x7'));var jayson=require(_0x327f('0x8'));var client=jayson[_0x327f('0x9')][_0x327f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x181949,_0x19b8cc,_0x551a98){return new BPromise(function(_0x12b0f7,_0x3b4593){return client[_0x327f('0xb')](_0x181949,_0x551a98)[_0x327f('0xc')](function(_0x89473b){logger[_0x327f('0xd')]('Automation,\x20%s,\x20%s',_0x19b8cc,_0x327f('0xe'));logger[_0x327f('0xf')](_0x327f('0x10'),_0x19b8cc,_0x327f('0xe'),JSON[_0x327f('0x11')](_0x89473b));if(_0x89473b[_0x327f('0x12')]){if(_0x89473b[_0x327f('0x12')][_0x327f('0x13')]===0x1f4){logger['error'](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);return _0x3b4593(_0x89473b[_0x327f('0x12')][_0x327f('0x15')]);}logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x89473b[_0x327f('0x12')]['message']);return _0x12b0f7(_0x89473b['error'][_0x327f('0x15')]);}else{logger[_0x327f('0xd')](_0x327f('0x14'),_0x19b8cc,_0x327f('0xe'));_0x12b0f7(_0x89473b[_0x327f('0x16')][_0x327f('0x15')]);}})[_0x327f('0x17')](function(_0x6de69e){logger[_0x327f('0x12')](_0x327f('0x14'),_0x19b8cc,_0x6de69e);_0x3b4593(_0x6de69e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index bc2c501..de259e3 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 _0x0d77=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions','post','addActions','put','update','exports','multer','util','path','express','Router'];(function(_0x392f8b,_0x121ff9){var _0x3bea2d=function(_0x25be3e){while(--_0x25be3e){_0x392f8b['push'](_0x392f8b['shift']());}};_0x3bea2d(++_0x121ff9);}(_0x0d77,0x8b));var _0x70d7=function(_0x1627ce,_0x9b92ed){_0x1627ce=_0x1627ce-0x0;var _0xb11196=_0x0d77[_0x1627ce];return _0xb11196;};'use strict';var multer=require(_0x70d7('0x0'));var util=require(_0x70d7('0x1'));var path=require(_0x70d7('0x2'));var timeout=require('connect-timeout');var express=require(_0x70d7('0x3'));var router=express[_0x70d7('0x4')]();var fs_extra=require(_0x70d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70d7('0x6'));var config=require(_0x70d7('0x7'));var controller=require('./automation.controller');router[_0x70d7('0x8')]('/',auth[_0x70d7('0x9')](),controller[_0x70d7('0xa')]);router[_0x70d7('0x8')](_0x70d7('0xb'),auth['isAuthenticated'](),controller[_0x70d7('0xc')]);router['get'](_0x70d7('0xd'),auth['isAuthenticated'](),controller[_0x70d7('0xe')]);router['get'](_0x70d7('0xf'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x10')]);router['post']('/',auth[_0x70d7('0x9')](),controller[_0x70d7('0x11')]);router['post']('/:id/conditions',auth[_0x70d7('0x9')](),controller[_0x70d7('0x12')]);router[_0x70d7('0x13')](_0x70d7('0xf'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x14')]);router[_0x70d7('0x15')](_0x70d7('0xb'),auth[_0x70d7('0x9')](),controller[_0x70d7('0x16')]);router['delete'](_0x70d7('0xb'),auth[_0x70d7('0x9')](),controller['destroy']);module[_0x70d7('0x17')]=router; \ No newline at end of file +var _0x9181=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put'];(function(_0x342cc2,_0x153b3e){var _0x2b21f7=function(_0x506604){while(--_0x506604){_0x342cc2['push'](_0x342cc2['shift']());}};_0x2b21f7(++_0x153b3e);}(_0x9181,0x182));var _0x1918=function(_0x3c2346,_0x472ec5){_0x3c2346=_0x3c2346-0x0;var _0x174f25=_0x9181[_0x3c2346];return _0x174f25;};'use strict';var multer=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var path=require(_0x1918('0x2'));var timeout=require(_0x1918('0x3'));var express=require(_0x1918('0x4'));var router=express['Router']();var fs_extra=require(_0x1918('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var controller=require(_0x1918('0x8'));router[_0x1918('0x9')]('/',auth[_0x1918('0xa')](),controller[_0x1918('0xb')]);router['get'](_0x1918('0xc'),auth['isAuthenticated'](),controller[_0x1918('0xd')]);router['get'](_0x1918('0xe'),auth[_0x1918('0xa')](),controller[_0x1918('0xf')]);router[_0x1918('0x9')](_0x1918('0x10'),auth[_0x1918('0xa')](),controller[_0x1918('0x11')]);router[_0x1918('0x12')]('/',auth[_0x1918('0xa')](),controller[_0x1918('0x13')]);router[_0x1918('0x12')](_0x1918('0xe'),auth[_0x1918('0xa')](),controller['addConditions']);router[_0x1918('0x12')](_0x1918('0x10'),auth[_0x1918('0xa')](),controller[_0x1918('0x14')]);router[_0x1918('0x15')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller['update']);router[_0x1918('0x16')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller[_0x1918('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 025c245..42a76d3 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 _0x1280=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','ENUM','always','onlyIfOpen','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\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1280,0x98));var _0x0128=function(_0x2bafde,_0x39326c){_0x2bafde=_0x2bafde-0x0;var _0x5733dc=_0x1280[_0x2bafde];return _0x5733dc;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'name':{'type':Sequelize[_0x0128('0x2')],'unique':_0x0128('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0128('0x4')),'allowNull':![],'defaultValue':_0x0128('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x0128('0x5')],'defaultValue':0x0,'comment':_0x0128('0x6')},'limitCalls':{'type':Sequelize[_0x0128('0x7')](0x4)[_0x0128('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0128('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0128('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'comment':_0x0128('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0128('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0128('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0128('0xe')](_0x0128('0xf'),'never',_0x0128('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0128('0x5')],'defaultValue':0x0,'comment':_0x0128('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x0128('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0128('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0128('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0128('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0128('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0128('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0128('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0128('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0128('0x7')](0x9)[_0x0128('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0128('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0128('0x19')),'defaultValue':_0x0128('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0128('0x1b')},'dialCutDigit':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0128('0x7')](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0128('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)[_0x0128('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x1f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0128('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0128('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0128('0x20')}}; \ No newline at end of file +var _0x12dd=['07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x432b15,_0x6526a5){var _0x7234ff=function(_0x416ed4){while(--_0x416ed4){_0x432b15['push'](_0x432b15['shift']());}};_0x7234ff(++_0x6526a5);}(_0x12dd,0xd8));var _0xd12d=function(_0x50817a,_0x3b8363){_0x50817a=_0x50817a-0x0;var _0x1664fc=_0x12dd[_0x50817a];return _0x1664fc;};'use strict';var Sequelize=require(_0xd12d('0x0'));module[_0xd12d('0x1')]={'name':{'type':Sequelize[_0xd12d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd12d('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd12d('0x4')],'defaultValue':0x0,'comment':_0xd12d('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xd12d('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd12d('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd12d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd12d('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd12d('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd12d('0x9')](0x5)[_0xd12d('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd12d('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd12d('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd12d('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd12d('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd12d('0xe')},'dialTimezone':{'type':Sequelize[_0xd12d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd12d('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xd12d('0x3')](_0xd12d('0x10'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xd12d('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd12d('0x9')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd12d('0x11')},'dialAMDGreeting':{'type':Sequelize[_0xd12d('0x9')](0x9)[_0xd12d('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd12d('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd12d('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd12d('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd12d('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0xd12d('0x9')](0x9)[_0xd12d('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd12d('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd12d('0x9')](0x9)[_0xd12d('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd12d('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd12d('0x9')](0x9)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd12d('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd12d('0x9')](0x9)[_0xd12d('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd12d('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd12d('0x3')](_0xd12d('0x18'),_0xd12d('0x19')),'defaultValue':_0xd12d('0x18')},'dialPrefix':{'type':Sequelize[_0xd12d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd12d('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd12d('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd12d('0x9')](0x5)[_0xd12d('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd12d('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd12d('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd12d('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd12d('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd12d('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd12d('0x9')](0x3)[_0xd12d('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b4688e7..f43466c 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 _0x4242=['field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','insert','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','stack','name','send','index','map','Campaign','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','catch','show','params','length','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','body','createdAt','UserProfileSection','userProfileId','autoAssociation','getHoppers','findOne','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','into','cm_hopper','phone','ContactId','ListId','select'];(function(_0x380711,_0x274f90){var _0x23156e=function(_0x139b34){while(--_0x139b34){_0x380711['push'](_0x380711['shift']());}};_0x23156e(++_0x274f90);}(_0x4242,0xb5));var _0x2424=function(_0x41d268,_0x34ed51){_0x41d268=_0x41d268-0x0;var _0x14962d=_0x4242[_0x41d268];return _0x14962d;};'use strict';var emlformat=require(_0x2424('0x0'));var rimraf=require(_0x2424('0x1'));var zipdir=require(_0x2424('0x2'));var jsonpatch=require(_0x2424('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2424('0x4'));var Mustache=require(_0x2424('0x5'));var util=require(_0x2424('0x6'));var path=require('path');var sox=require(_0x2424('0x7'));var csv=require(_0x2424('0x8'));var ejs=require(_0x2424('0x9'));var fs=require('fs');var fs_extra=require(_0x2424('0xa'));var _=require(_0x2424('0xb'));var squel=require('squel');var crypto=require(_0x2424('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2424('0x8'));var querystring=require(_0x2424('0xd'));var Papa=require(_0x2424('0xe'));var Redis=require('ioredis');var authService=require(_0x2424('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2424('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2424('0x11'))(_0x2424('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2424('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa18032,_0x35926e){_0x35926e=_0x35926e||0xcc;return function(_0x4a0d97){if(_0x4a0d97){return _0xa18032[_0x2424('0x14')](_0x35926e);}return _0xa18032[_0x2424('0x15')](_0x35926e)[_0x2424('0x16')]();};}function respondWithResult(_0x449b27,_0x6cbc4d){_0x6cbc4d=_0x6cbc4d||0xc8;return function(_0x28d9eb){if(_0x28d9eb){return _0x449b27['status'](_0x6cbc4d)[_0x2424('0x17')](_0x28d9eb);}};}function respondWithFilteredResult(_0x5922ef,_0x4af4c4){return function(_0x5b1ed9){if(_0x5b1ed9){var _0x9798ad=typeof _0x4af4c4['offset']===_0x2424('0x18')&&typeof _0x4af4c4[_0x2424('0x19')]===_0x2424('0x18');var _0x363a15=_0x5b1ed9[_0x2424('0x1a')];var _0x26a9ce=_0x9798ad?0x0:_0x4af4c4['offset'];var _0x2becd7=_0x9798ad?_0x5b1ed9['count']:_0x4af4c4['offset']+_0x4af4c4[_0x2424('0x19')];var _0x390b4c;if(_0x2becd7>=_0x363a15){_0x2becd7=_0x363a15;_0x390b4c=0xc8;}else{_0x390b4c=0xce;}_0x5922ef[_0x2424('0x15')](_0x390b4c);return _0x5922ef[_0x2424('0x1b')]('Content-Range',_0x26a9ce+'-'+_0x2becd7+'/'+_0x363a15)['json'](_0x5b1ed9);}return null;};}function patchUpdates(_0x4ebd68){return function(_0x5468e1){try{jsonpatch[_0x2424('0x1c')](_0x5468e1,_0x4ebd68,!![]);}catch(_0x14e96b){return BPromise[_0x2424('0x1d')](_0x14e96b);}return _0x5468e1[_0x2424('0x1e')]();};}function saveUpdates(_0x33346b,_0x176a05){return function(_0x4e7f2d){if(_0x4e7f2d){return _0x4e7f2d[_0x2424('0x1f')](_0x33346b)[_0x2424('0x20')](function(_0xf2352f){return _0xf2352f;});}return null;};}function removeEntity(_0x6de5a0,_0x155d6f){return function(_0x4787cc){if(_0x4787cc){return _0x4787cc['destroy']()[_0x2424('0x20')](function(){var _0x1c9b1e=_0x4787cc[_0x2424('0x21')]({'plain':!![]});var _0x346576=_0x2424('0x22');return db[_0x2424('0x23')][_0x2424('0x24')]({'where':{'type':_0x346576,'resourceId':_0x1c9b1e['id']}})[_0x2424('0x20')](function(){return _0x4787cc;});})[_0x2424('0x20')](function(){_0x6de5a0[_0x2424('0x15')](0xcc)[_0x2424('0x16')]();});}};}function handleEntityNotFound(_0x1e9f18,_0x32914c){return function(_0x3c32a5){if(!_0x3c32a5){_0x1e9f18[_0x2424('0x14')](0x194);}return _0x3c32a5;};}function handleError(_0x178458,_0x21e87e){_0x21e87e=_0x21e87e||0x1f4;return function(_0x4e5770){logger['error'](_0x4e5770[_0x2424('0x25')]);if(_0x4e5770[_0x2424('0x26')]){delete _0x4e5770[_0x2424('0x26')];}_0x178458['status'](_0x21e87e)[_0x2424('0x27')](_0x4e5770);};}exports[_0x2424('0x28')]=function(_0x359d0b,_0xc0bec2){var _0x41c9d1={},_0x355f8c={},_0x4f5318={'count':0x0,'rows':[]};var _0xc88f0=_[_0x2424('0x29')](db[_0x2424('0x2a')][_0x2424('0x2b')],function(_0x3a5fff){return{'name':_0x3a5fff[_0x2424('0x2c')],'type':_0x3a5fff['type'][_0x2424('0x2d')]};});_0x355f8c[_0x2424('0x2e')]=_[_0x2424('0x29')](_0xc88f0,_0x2424('0x26'));_0x355f8c[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x359d0b[_0x2424('0x2f')]);_0x355f8c[_0x2424('0x31')]=_[_0x2424('0x32')](_0x355f8c[_0x2424('0x2e')],_0x355f8c[_0x2424('0x2f')]);_0x41c9d1[_0x2424('0x33')]=_[_0x2424('0x32')](_0x355f8c[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x359d0b[_0x2424('0x2f')][_0x2424('0x34')]));_0x41c9d1[_0x2424('0x33')]=_0x41c9d1[_0x2424('0x33')]['length']?_0x41c9d1[_0x2424('0x33')]:_0x355f8c[_0x2424('0x2e')];if(!_0x359d0b[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x41c9d1[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x359d0b['query'][_0x2424('0x19')]);_0x41c9d1[_0x2424('0x37')]=qs[_0x2424('0x37')](_0x359d0b[_0x2424('0x2f')][_0x2424('0x37')]);}_0x41c9d1[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x359d0b[_0x2424('0x2f')]['sort']);_0x41c9d1[_0x2424('0x3a')]=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x359d0b[_0x2424('0x2f')],_0x355f8c[_0x2424('0x31')]),_0xc88f0);if(_0x359d0b['query'][_0x2424('0x3c')]){_0x41c9d1[_0x2424('0x3a')]=_['merge'](_0x41c9d1[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0xc88f0,function(_0x34b67f){if(_0x34b67f[_0x2424('0x3d')]!==_0x2424('0x3e')){var _0x5ce73c={};_0x5ce73c[_0x34b67f[_0x2424('0x26')]]={'$like':'%'+_0x359d0b['query'][_0x2424('0x3c')]+'%'};return _0x5ce73c;}})});}_0x41c9d1=_[_0x2424('0x3f')]({},_0x41c9d1,_0x359d0b['options']);var _0x3765a4={'where':_0x41c9d1[_0x2424('0x3a')]};return db['Campaign'][_0x2424('0x1a')](_0x3765a4)[_0x2424('0x20')](function(_0xa3890c){_0x4f5318[_0x2424('0x1a')]=_0xa3890c;if(_0x359d0b['query'][_0x2424('0x40')]){_0x41c9d1['include']=[{'all':!![]}];}return db['Campaign'][_0x2424('0x41')](_0x41c9d1);})['then'](function(_0x2eb008){_0x4f5318['rows']=_0x2eb008;return _0x4f5318;})[_0x2424('0x20')](respondWithFilteredResult(_0xc0bec2,_0x41c9d1))[_0x2424('0x42')](handleError(_0xc0bec2,null));};exports[_0x2424('0x43')]=function(_0x1732af,_0x592fef){var _0x50cbad={'raw':![],'where':{'id':_0x1732af[_0x2424('0x44')]['id']}},_0xe497e9={};_0xe497e9[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x2a')][_0x2424('0x2b')]);_0xe497e9[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x1732af[_0x2424('0x2f')]);_0xe497e9[_0x2424('0x31')]=_['intersection'](_0xe497e9[_0x2424('0x2e')],_0xe497e9[_0x2424('0x2f')]);_0x50cbad[_0x2424('0x33')]=_[_0x2424('0x32')](_0xe497e9[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x1732af['query'][_0x2424('0x34')]));_0x50cbad[_0x2424('0x33')]=_0x50cbad[_0x2424('0x33')][_0x2424('0x45')]?_0x50cbad[_0x2424('0x33')]:_0xe497e9['model'];if(_0x1732af[_0x2424('0x2f')][_0x2424('0x40')]){_0x50cbad[_0x2424('0x46')]=[{'all':!![]}];}_0x50cbad=_[_0x2424('0x3f')]({},_0x50cbad,_0x1732af[_0x2424('0x47')]);return db[_0x2424('0x2a')]['find'](_0x50cbad)[_0x2424('0x20')](handleEntityNotFound(_0x592fef,null))['then'](respondWithResult(_0x592fef,null))['catch'](handleError(_0x592fef,null));};exports[_0x2424('0x48')]=function(_0x396545,_0x117b24){return db[_0x2424('0x2a')][_0x2424('0x48')](_0x396545['body'],{})[_0x2424('0x20')](function(_0x21aa9a){var _0x29cf75=_0x396545[_0x2424('0x49')][_0x2424('0x21')]({'plain':!![]});if(!_0x29cf75)throw new Error(_0x2424('0x4a'));if(_0x29cf75[_0x2424('0x4b')]===_0x2424('0x49')){var _0x2a2310=_0x21aa9a[_0x2424('0x21')]({'plain':!![]});var _0x103ce7=_0x2424('0x22');return db['UserProfileSection'][_0x2424('0x4c')]({'where':{'name':_0x103ce7,'userProfileId':_0x29cf75['userProfileId']},'raw':!![]})[_0x2424('0x20')](function(_0x41e97b){if(_0x41e97b&&_0x41e97b['autoAssociation']===0x0){return db[_0x2424('0x23')][_0x2424('0x48')]({'name':_0x2a2310[_0x2424('0x26')],'resourceId':_0x2a2310['id'],'type':_0x41e97b[_0x2424('0x26')],'sectionId':_0x41e97b['id']},{})[_0x2424('0x20')](function(){return _0x21aa9a;});}else{return _0x21aa9a;}})[_0x2424('0x42')](function(_0x25ed24){logger[_0x2424('0x4d')](_0x2424('0x4e'),_0x25ed24);throw _0x25ed24;});}return _0x21aa9a;})[_0x2424('0x20')](respondWithResult(_0x117b24,0xc9))['catch'](handleError(_0x117b24,null));};exports['clone']=function(_0x32c4d5,_0x17cc8b){var _0x22b37e={'where':{'id':_0x32c4d5[_0x2424('0x44')]['id']}},_0x3e7017={};_0x3e7017[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x2a')][_0x2424('0x2b')]);_0x22b37e[_0x2424('0x33')]=_[_0x2424('0x32')](_0x3e7017[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x32c4d5[_0x2424('0x2f')][_0x2424('0x34')]));_0x22b37e[_0x2424('0x33')]=_0x22b37e[_0x2424('0x33')]['length']?_0x22b37e[_0x2424('0x33')]:_0x3e7017[_0x2424('0x2e')];if(_0x32c4d5['query'][_0x2424('0x40')]){_0x22b37e['include']=[{'all':!![]}];}_0x22b37e=_[_0x2424('0x3f')]({},_0x22b37e,_0x32c4d5[_0x2424('0x47')]);return db['Campaign']['find'](_0x22b37e)[_0x2424('0x20')](handleEntityNotFound(_0x17cc8b,null))['then'](function(_0x580b5e){if(_0x580b5e){var _0x47e1ec=_0x580b5e[_0x2424('0x21')]({'plain':!![]});_0x47e1ec=qs[_0x2424('0x4f')](_0x47e1ec,['id','createdAt',_0x2424('0x50')]);_0x32c4d5[_0x2424('0x51')]=_[_0x2424('0x4f')](_0x32c4d5['body'],['id',_0x2424('0x52'),_0x2424('0x50')]);return db[_0x2424('0x2a')]['create'](_[_0x2424('0x3f')](_0x47e1ec,_0x32c4d5['body']),{'include':_0x32c4d5[_0x2424('0x2f')][_0x2424('0x40')]?[{'all':!![]}]:undefined})[_0x2424('0x20')](function(_0x1ed445){var _0x49b040=_0x32c4d5['user'][_0x2424('0x21')]({'plain':!![]});if(!_0x49b040)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49b040[_0x2424('0x4b')]===_0x2424('0x49')){var _0x49c2a8=_0x1ed445['get']({'plain':!![]});var _0x40b356=_0x2424('0x22');return db[_0x2424('0x53')][_0x2424('0x4c')]({'where':{'name':_0x40b356,'userProfileId':_0x49b040[_0x2424('0x54')]},'raw':!![]})[_0x2424('0x20')](function(_0x5bd6ac){if(_0x5bd6ac&&_0x5bd6ac[_0x2424('0x55')]===0x0){return db[_0x2424('0x23')]['create']({'name':_0x49c2a8[_0x2424('0x26')],'resourceId':_0x49c2a8['id'],'type':_0x5bd6ac[_0x2424('0x26')],'sectionId':_0x5bd6ac['id']},{})[_0x2424('0x20')](function(){return _0x1ed445;});}else{return _0x1ed445;}})['catch'](function(_0x31ce02){logger[_0x2424('0x4d')](_0x2424('0x4e'),_0x31ce02);throw _0x31ce02;});}return _0x1ed445;});}})[_0x2424('0x20')](respondWithResult(_0x17cc8b,0xc9))['catch'](handleError(_0x17cc8b,null));};exports[_0x2424('0x1f')]=function(_0x28c04c,_0x54b0c5){if(_0x28c04c['body']['id']){delete _0x28c04c['body']['id'];}return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x28c04c[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x54b0c5,null))[_0x2424('0x20')](saveUpdates(_0x28c04c[_0x2424('0x51')],null))[_0x2424('0x20')](respondWithResult(_0x54b0c5,null))['catch'](handleError(_0x54b0c5,null));};exports[_0x2424('0x24')]=function(_0xa22f3b,_0x43484b){return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0xa22f3b[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x43484b,null))['then'](removeEntity(_0x43484b,null))[_0x2424('0x42')](handleError(_0x43484b,null));};exports[_0x2424('0x56')]=function(_0x1c1ce6,_0x23bb5f,_0x5a8377){var _0xc0c2ee={'raw':!![],'where':{}};var _0x3a3b76={};var _0x1a88b7={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x1c1ce6['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x23bb5f,null))[_0x2424('0x20')](function(_0x2bb46e){if(_0x2bb46e){_0x3a3b76['model']=_[_0x2424('0x30')](db['CmHopper'][_0x2424('0x2b')]);_0x3a3b76[_0x2424('0x2f')]=_['keys'](_0x1c1ce6['query']);_0x3a3b76['filters']=_['intersection'](_0x3a3b76[_0x2424('0x2e')],_0x3a3b76[_0x2424('0x2f')]);_0xc0c2ee[_0x2424('0x33')]=_[_0x2424('0x32')](_0x3a3b76[_0x2424('0x2e')],qs['fields'](_0x1c1ce6[_0x2424('0x2f')]['fields']));_0xc0c2ee[_0x2424('0x33')]=_0xc0c2ee[_0x2424('0x33')][_0x2424('0x45')]?_0xc0c2ee[_0x2424('0x33')]:_0x3a3b76['model'];if(!_0x1c1ce6['query'][_0x2424('0x35')](_0x2424('0x36'))){_0xc0c2ee[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x1c1ce6[_0x2424('0x2f')]['limit']);_0xc0c2ee['offset']=qs['offset'](_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x37')]);}_0xc0c2ee[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x39')]);_0xc0c2ee['where']=qs['filters'](_['pick'](_0x1c1ce6[_0x2424('0x2f')],_0x3a3b76[_0x2424('0x31')]));_0xc0c2ee['where'][_0x2424('0x58')]=_0x2bb46e['id'];if(_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x3c')]){_0xc0c2ee[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0xc0c2ee[_0x2424('0x3a')],{'$or':_['map'](_0xc0c2ee[_0x2424('0x33')],function(_0x53efd3){var _0x4de1f8={};_0x4de1f8[_0x53efd3]={'$like':'%'+_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x4de1f8;})});}_0xc0c2ee=_['merge']({},_0xc0c2ee,_0x1c1ce6['options']);return db['CmHopper'][_0x2424('0x1a')]({'where':_0xc0c2ee[_0x2424('0x3a')]})['then'](function(_0x5329eb){_0x1a88b7['count']=_0x5329eb;if(_0x1c1ce6[_0x2424('0x2f')][_0x2424('0x40')]){_0xc0c2ee['include']=[{'all':!![]}];}return db[_0x2424('0x59')][_0x2424('0x41')](_0xc0c2ee);})[_0x2424('0x20')](function(_0x22b950){_0x1a88b7[_0x2424('0x5a')]=_0x22b950;return _0x1a88b7;});}})['then'](respondWithFilteredResult(_0x23bb5f,_0xc0c2ee))[_0x2424('0x42')](handleError(_0x23bb5f,null));};exports[_0x2424('0x5b')]=function(_0x2bd44e,_0x44cab1,_0x1a9e01){var _0x1bfa59={'raw':!![],'where':{}};var _0x36a853={};var _0x234d6f={'count':0x0,'rows':[]};return db[_0x2424('0x2a')]['findOne']({'where':{'id':_0x2bd44e[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x44cab1,null))['then'](function(_0x559a9f){if(_0x559a9f){_0x36a853['model']=_[_0x2424('0x30')](db['CmHopperHistory'][_0x2424('0x2b')]);_0x36a853[_0x2424('0x2f')]=_['keys'](_0x2bd44e['query']);_0x36a853[_0x2424('0x31')]=_[_0x2424('0x32')](_0x36a853[_0x2424('0x2e')],_0x36a853[_0x2424('0x2f')]);_0x1bfa59[_0x2424('0x33')]=_[_0x2424('0x32')](_0x36a853[_0x2424('0x2e')],qs['fields'](_0x2bd44e['query'][_0x2424('0x34')]));_0x1bfa59[_0x2424('0x33')]=_0x1bfa59['attributes']['length']?_0x1bfa59[_0x2424('0x33')]:_0x36a853[_0x2424('0x2e')];if(!_0x2bd44e[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x1bfa59[_0x2424('0x19')]=qs['limit'](_0x2bd44e[_0x2424('0x2f')][_0x2424('0x19')]);_0x1bfa59[_0x2424('0x37')]=qs['offset'](_0x2bd44e[_0x2424('0x2f')][_0x2424('0x37')]);}_0x1bfa59[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x2bd44e['query']['sort']);_0x1bfa59['where']=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x2bd44e[_0x2424('0x2f')],_0x36a853[_0x2424('0x31')]));_0x1bfa59['where']['CampaignId']=_0x559a9f['id'];if(_0x2bd44e['query'][_0x2424('0x3c')]){_0x1bfa59[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x1bfa59[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0x1bfa59[_0x2424('0x33')],function(_0x2141fd){var _0x645a00={};_0x645a00[_0x2141fd]={'$like':'%'+_0x2bd44e[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x645a00;})});}_0x1bfa59=_[_0x2424('0x3f')]({},_0x1bfa59,_0x2bd44e['options']);return db[_0x2424('0x5c')][_0x2424('0x1a')]({'where':_0x1bfa59[_0x2424('0x3a')]})['then'](function(_0x10a1a3){_0x234d6f[_0x2424('0x1a')]=_0x10a1a3;if(_0x2bd44e['query']['includeAll']){_0x1bfa59[_0x2424('0x46')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bfa59);})[_0x2424('0x20')](function(_0x5703ad){_0x234d6f[_0x2424('0x5a')]=_0x5703ad;return _0x234d6f;});}})[_0x2424('0x20')](respondWithFilteredResult(_0x44cab1,_0x1bfa59))['catch'](handleError(_0x44cab1,null));};exports[_0x2424('0x5d')]=function(_0x5cac35,_0x334eec,_0x216df9){var _0x3caa67={'raw':!![],'where':{}};var _0x1da12b={};var _0x4ceeac={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x5cac35[_0x2424('0x44')]['id']}})['then'](handleEntityNotFound(_0x334eec,null))[_0x2424('0x20')](function(_0x9dc490){if(_0x9dc490){_0x1da12b[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x5e')]['rawAttributes']);_0x1da12b[_0x2424('0x2f')]=_[_0x2424('0x30')](_0x5cac35[_0x2424('0x2f')]);_0x1da12b[_0x2424('0x31')]=_[_0x2424('0x32')](_0x1da12b['model'],_0x1da12b[_0x2424('0x2f')]);_0x3caa67[_0x2424('0x33')]=_[_0x2424('0x32')](_0x1da12b[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x5cac35[_0x2424('0x2f')]['fields']));_0x3caa67[_0x2424('0x33')]=_0x3caa67['attributes']['length']?_0x3caa67['attributes']:_0x1da12b[_0x2424('0x2e')];if(!_0x5cac35[_0x2424('0x2f')][_0x2424('0x35')](_0x2424('0x36'))){_0x3caa67[_0x2424('0x19')]=qs['limit'](_0x5cac35[_0x2424('0x2f')]['limit']);_0x3caa67['offset']=qs[_0x2424('0x37')](_0x5cac35['query'][_0x2424('0x37')]);}_0x3caa67[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x5cac35[_0x2424('0x2f')][_0x2424('0x39')]);_0x3caa67[_0x2424('0x3a')]=qs[_0x2424('0x31')](_[_0x2424('0x3b')](_0x5cac35[_0x2424('0x2f')],_0x1da12b[_0x2424('0x31')]));_0x3caa67[_0x2424('0x3a')][_0x2424('0x58')]=_0x9dc490['id'];if(_0x5cac35[_0x2424('0x2f')][_0x2424('0x3c')]){_0x3caa67[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x3caa67['where'],{'$or':_['map'](_0x3caa67['attributes'],function(_0x151557){var _0x3b3a61={};_0x3b3a61[_0x151557]={'$like':'%'+_0x5cac35[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x3b3a61;})});}_0x3caa67=_['merge']({},_0x3caa67,_0x5cac35[_0x2424('0x47')]);return db[_0x2424('0x5e')]['count']({'where':_0x3caa67[_0x2424('0x3a')]})[_0x2424('0x20')](function(_0xa59944){_0x4ceeac[_0x2424('0x1a')]=_0xa59944;if(_0x5cac35[_0x2424('0x2f')][_0x2424('0x40')]){_0x3caa67[_0x2424('0x46')]=[{'all':!![]}];}return db[_0x2424('0x5e')][_0x2424('0x41')](_0x3caa67);})[_0x2424('0x20')](function(_0x2b93ed){_0x4ceeac[_0x2424('0x5a')]=_0x2b93ed;return _0x4ceeac;});}})['then'](respondWithFilteredResult(_0x334eec,_0x3caa67))[_0x2424('0x42')](handleError(_0x334eec,null));};exports[_0x2424('0x5f')]=function(_0x3701da,_0x39118e,_0x42ae8b){var _0x370b3d={'raw':!![],'where':{}};var _0x31bb69={};var _0x156d08={'count':0x0,'rows':[]};return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x3701da['params']['id']}})['then'](handleEntityNotFound(_0x39118e,null))[_0x2424('0x20')](function(_0x15366a){if(_0x15366a){_0x31bb69[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x60')][_0x2424('0x2b')]);_0x31bb69[_0x2424('0x2f')]=_['keys'](_0x3701da[_0x2424('0x2f')]);_0x31bb69['filters']=_[_0x2424('0x32')](_0x31bb69[_0x2424('0x2e')],_0x31bb69[_0x2424('0x2f')]);_0x370b3d[_0x2424('0x33')]=_[_0x2424('0x32')](_0x31bb69['model'],qs[_0x2424('0x34')](_0x3701da[_0x2424('0x2f')][_0x2424('0x34')]));_0x370b3d[_0x2424('0x33')]=_0x370b3d[_0x2424('0x33')][_0x2424('0x45')]?_0x370b3d['attributes']:_0x31bb69[_0x2424('0x2e')];if(!_0x3701da['query'][_0x2424('0x35')]('nolimit')){_0x370b3d[_0x2424('0x19')]=qs['limit'](_0x3701da[_0x2424('0x2f')][_0x2424('0x19')]);_0x370b3d[_0x2424('0x37')]=qs['offset'](_0x3701da[_0x2424('0x2f')][_0x2424('0x37')]);}_0x370b3d[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x3701da[_0x2424('0x2f')][_0x2424('0x39')]);_0x370b3d[_0x2424('0x3a')]=qs[_0x2424('0x31')](_['pick'](_0x3701da[_0x2424('0x2f')],_0x31bb69['filters']));_0x370b3d[_0x2424('0x3a')][_0x2424('0x58')]=_0x15366a['id'];if(_0x3701da[_0x2424('0x2f')][_0x2424('0x3c')]){_0x370b3d[_0x2424('0x3a')]=_['merge'](_0x370b3d[_0x2424('0x3a')],{'$or':_[_0x2424('0x29')](_0x370b3d['attributes'],function(_0x44ecbf){var _0xeab622={};_0xeab622[_0x44ecbf]={'$like':'%'+_0x3701da[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0xeab622;})});}_0x370b3d=_[_0x2424('0x3f')]({},_0x370b3d,_0x3701da[_0x2424('0x47')]);return db['CmHopperBlack']['count']({'where':_0x370b3d[_0x2424('0x3a')]})[_0x2424('0x20')](function(_0x2df43e){_0x156d08[_0x2424('0x1a')]=_0x2df43e;if(_0x3701da[_0x2424('0x2f')][_0x2424('0x40')]){_0x370b3d[_0x2424('0x46')]=[{'all':!![]}];}return db[_0x2424('0x60')]['findAll'](_0x370b3d);})[_0x2424('0x20')](function(_0x12386a){_0x156d08[_0x2424('0x5a')]=_0x12386a;return _0x156d08;});}})['then'](respondWithFilteredResult(_0x39118e,_0x370b3d))[_0x2424('0x42')](handleError(_0x39118e,null));};exports['getLists']=function(_0x6722fc,_0x476c51,_0x3d171a){var _0x11ecf2={};var _0x372797={};var _0x34a0bb;var _0x43c087;return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x6722fc['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x476c51,null))[_0x2424('0x20')](function(_0x5b3ab7){if(_0x5b3ab7){_0x34a0bb=_0x5b3ab7;_0x372797[_0x2424('0x2e')]=_[_0x2424('0x30')](db['CmList'][_0x2424('0x2b')]);_0x372797[_0x2424('0x2f')]=_['keys'](_0x6722fc[_0x2424('0x2f')]);_0x372797['filters']=_[_0x2424('0x32')](_0x372797[_0x2424('0x2e')],_0x372797[_0x2424('0x2f')]);_0x11ecf2[_0x2424('0x33')]=_[_0x2424('0x32')](_0x372797[_0x2424('0x2e')],qs[_0x2424('0x34')](_0x6722fc[_0x2424('0x2f')][_0x2424('0x34')]));_0x11ecf2['attributes']=_0x11ecf2[_0x2424('0x33')][_0x2424('0x45')]?_0x11ecf2[_0x2424('0x33')]:_0x372797[_0x2424('0x2e')];_0x11ecf2[_0x2424('0x38')]=qs['sort'](_0x6722fc['query']['sort']);_0x11ecf2[_0x2424('0x3a')]=qs[_0x2424('0x31')](_['pick'](_0x6722fc['query'],_0x372797[_0x2424('0x31')]));if(_0x6722fc['query'][_0x2424('0x3c')]){_0x11ecf2[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x11ecf2['where'],{'$or':_[_0x2424('0x29')](_0x11ecf2[_0x2424('0x33')],function(_0x150d7e){var _0x1cbad4={};_0x1cbad4[_0x150d7e]={'$like':'%'+_0x6722fc[_0x2424('0x2f')][_0x2424('0x3c')]+'%'};return _0x1cbad4;})});}_0x11ecf2=_[_0x2424('0x3f')]({},_0x11ecf2,_0x6722fc[_0x2424('0x47')]);return _0x34a0bb['getLists'](_0x11ecf2);}})[_0x2424('0x20')](function(_0x43c10f){if(_0x43c10f){_0x43c087=_0x43c10f[_0x2424('0x45')];if(!_0x6722fc['query'][_0x2424('0x35')](_0x2424('0x36'))){_0x11ecf2[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x6722fc['query']['limit']);_0x11ecf2['offset']=qs[_0x2424('0x37')](_0x6722fc['query']['offset']);}return _0x34a0bb[_0x2424('0x61')](_0x11ecf2);}})[_0x2424('0x20')](function(_0x33fe81){if(_0x33fe81){return _0x33fe81?{'count':_0x43c087,'rows':_0x33fe81}:null;}})['then'](respondWithResult(_0x476c51,null))['catch'](handleError(_0x476c51,null));};exports['addLists']=function(_0x361fa6,_0x589d99,_0x2ae3dc){var _0x129ad9,_0x276a22;var _0x3238ad=[];var _0x51d857=moment()[_0x2424('0x62')](_0x2424('0x63'));return db[_0x2424('0x2a')]['find']({'where':{'id':_0x361fa6[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x589d99,null))[_0x2424('0x20')](function(_0x384049){if(_0x384049){_0x276a22=_0x384049;return _0x384049[_0x2424('0x64')](_0x361fa6[_0x2424('0x51')][_0x2424('0x65')],_[_0x2424('0x4f')](_0x361fa6[_0x2424('0x51')],[_0x2424('0x65'),'id'])||{});}return null;})[_0x2424('0x66')](function(_0x413359){var _0x259e1a;var _0x58c7a6;_0x129ad9=_0x413359||[];var _0x50d55a=[];if(_0x413359){for(var _0x4fd595=0x0;_0x4fd595<_0x413359['length'];_0x4fd595+=0x1){var _0x4837ee=_0x413359[_0x4fd595][_0x2424('0x21')]({'plain':!![]});_0x276a22['dialCheckDuplicateType']=_0x361fa6[_0x2424('0x51')]['dialCheckDuplicateType']?_0x361fa6['body']['dialCheckDuplicateType']:_0x276a22['dialCheckDuplicateType'];switch(_0x276a22['dialCheckDuplicateType']){case'always':_0x259e1a=squel['insert']()[_0x2424('0x67')](_0x2424('0x68'))['fromQuery']([_0x2424('0x69'),'scheduledAt',_0x2424('0x6a'),_0x2424('0x6b'),'CampaignId',_0x2424('0x52'),_0x2424('0x50')],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x69'),_0x2424('0x69'))['field'](_0x2424('0x6e'),_0x2424('0x6f'))[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee['CmListId'][_0x2424('0x70')](),'ListId')[_0x2424('0x6d')](_0x361fa6[_0x2424('0x44')]['id'][_0x2424('0x70')](),_0x2424('0x58'))['field']('\x27'+_0x51d857+'\x27','createdAt')[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')](_0x2424('0x73'))[_0x2424('0x3a')]('ListId\x20=\x20?',_0x4837ee[_0x2424('0x74')]['toString']())[_0x2424('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0x2424('0x3a')](_0x2424('0x75'),squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x76'))['from'](_0x2424('0x77'))[_0x2424('0x3a')](_0x2424('0x78'),_0x361fa6['params']['id'][_0x2424('0x70')]()))[_0x2424('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x2424('0x6d')](_0x2424('0x79'))[_0x2424('0x71')](_0x2424('0x68'))[_0x2424('0x3a')]('CampaignId\x20=\x20?',_0x361fa6[_0x2424('0x44')]['id']['toString']())))[_0x2424('0x70')]();break;case _0x2424('0x7a'):_0x259e1a=squel['insert']()['into'](_0x2424('0x68'))[_0x2424('0x7b')]([_0x2424('0x69'),_0x2424('0x6f'),_0x2424('0x6a'),'ListId',_0x2424('0x58'),_0x2424('0x52'),_0x2424('0x50')],squel['select']()[_0x2424('0x6d')](_0x2424('0x69'),'phone')[_0x2424('0x6d')](_0x2424('0x6e'),_0x2424('0x6f'))[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))[_0x2424('0x6d')](_0x361fa6[_0x2424('0x44')]['id']['toString'](),_0x2424('0x58'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x52'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')](_0x2424('0x73'))[_0x2424('0x3a')]('ListId\x20=\x20?',_0x4837ee[_0x2424('0x74')][_0x2424('0x70')]())[_0x2424('0x3a')](_0x2424('0x7c'))[_0x2424('0x3a')](_0x2424('0x75'),squel[_0x2424('0x6c')]()[_0x2424('0x6d')]('COALESCE(phone,\x27\x27)')[_0x2424('0x71')]('cm_hopper')[_0x2424('0x3a')](_0x2424('0x78'),_0x361fa6[_0x2424('0x44')]['id'][_0x2424('0x70')]())))[_0x2424('0x70')]();break;default:_0x259e1a=squel['insert']()[_0x2424('0x67')](_0x2424('0x68'))[_0x2424('0x7b')]([_0x2424('0x69'),_0x2424('0x6f'),_0x2424('0x6a'),_0x2424('0x6b'),_0x2424('0x58'),_0x2424('0x52'),_0x2424('0x50')],squel['select']()[_0x2424('0x6d')]('phone','phone')[_0x2424('0x6d')](_0x2424('0x6e'),'scheduledAt')[_0x2424('0x6d')]('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0x4837ee[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))[_0x2424('0x6d')](_0x361fa6['params']['id'][_0x2424('0x70')](),_0x2424('0x58'))['field']('\x27'+_0x51d857+'\x27',_0x2424('0x52'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')]('deletedAt\x20IS\x20NULL')[_0x2424('0x3a')](_0x2424('0x7d'),_0x4837ee[_0x2424('0x74')]['toString']())[_0x2424('0x3a')](_0x2424('0x7c')))[_0x2424('0x70')]();}_0x58c7a6=squel[_0x2424('0x7e')]()['into'](_0x2424('0x7f'))['fromQuery'](['cmHopperId',_0x2424('0x6f'),_0x2424('0x69'),_0x2424('0x80'),_0x2424('0x52'),'updatedAt'],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x81'),'id')[_0x2424('0x6d')]('NOW()',_0x2424('0x6f'))[_0x2424('0x6d')](_0x2424('0x82'),_0x2424('0x69'))['field'](_0x2424('0x83'),_0x2424('0x80'))[_0x2424('0x6d')]('\x27'+_0x51d857+'\x27','createdAt')['field']('\x27'+_0x51d857+'\x27',_0x2424('0x50'))[_0x2424('0x71')]('cm_contact_has_items','ci')[_0x2424('0x84')](_0x2424('0x68'),'h',_0x2424('0x85'))[_0x2424('0x3a')](_0x2424('0x86'),_0x4837ee['CmListId'][_0x2424('0x70')]())[_0x2424('0x3a')](_0x2424('0x87'),_0x361fa6['params']['id'][_0x2424('0x70')]())[_0x2424('0x3a')]('h.createdAt\x20=\x20?',_0x51d857))['toString']();_0x50d55a[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x259e1a));_0x3238ad[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x58c7a6));}return BPromise[_0x2424('0x8a')](_0x50d55a);}})[_0x2424('0x20')](function(){return BPromise[_0x2424('0x8a')](_0x3238ad);})[_0x2424('0x20')](function(){return _0x129ad9;})[_0x2424('0x20')](respondWithResult(_0x589d99,null))[_0x2424('0x42')](handleError(_0x589d99,null));};exports[_0x2424('0x8b')]=function(_0x5e6e6e,_0x3f01ba,_0xaf370b){return db[_0x2424('0x2a')]['find']({'where':{'id':_0x5e6e6e[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x3f01ba,null))[_0x2424('0x20')](function(_0x4fb517){if(_0x4fb517){return _0x4fb517[_0x2424('0x8b')](_0x5e6e6e[_0x2424('0x2f')][_0x2424('0x65')]);}})[_0x2424('0x20')](function(_0x250169){if(_0x250169){return db[_0x2424('0x59')]['destroy']({'where':{'ListId':_0x5e6e6e[_0x2424('0x2f')][_0x2424('0x65')],'CampaignId':_0x5e6e6e['params']['id']}})['then'](function(){return _0x250169;});}})[_0x2424('0x20')](respondWithStatusCode(_0x3f01ba,null))[_0x2424('0x42')](handleError(_0x3f01ba,null));};exports[_0x2424('0x8c')]=function(_0x224cae,_0x3558ff,_0x32c856){var _0x4b0ee6={};var _0x2ee97d={};var _0x196790;var _0x19981f;return db[_0x2424('0x2a')][_0x2424('0x57')]({'where':{'id':_0x224cae['params']['id']}})['then'](handleEntityNotFound(_0x3558ff,null))[_0x2424('0x20')](function(_0x19d620){if(_0x19d620){_0x196790=_0x19d620;_0x2ee97d[_0x2424('0x2e')]=_[_0x2424('0x30')](db[_0x2424('0x8d')]['rawAttributes']);_0x2ee97d['query']=_[_0x2424('0x30')](_0x224cae[_0x2424('0x2f')]);_0x2ee97d[_0x2424('0x31')]=_[_0x2424('0x32')](_0x2ee97d[_0x2424('0x2e')],_0x2ee97d['query']);_0x4b0ee6[_0x2424('0x33')]=_[_0x2424('0x32')](_0x2ee97d[_0x2424('0x2e')],qs['fields'](_0x224cae[_0x2424('0x2f')][_0x2424('0x34')]));_0x4b0ee6[_0x2424('0x33')]=_0x4b0ee6[_0x2424('0x33')]['length']?_0x4b0ee6[_0x2424('0x33')]:_0x2ee97d[_0x2424('0x2e')];_0x4b0ee6[_0x2424('0x38')]=qs[_0x2424('0x39')](_0x224cae[_0x2424('0x2f')]['sort']);_0x4b0ee6[_0x2424('0x3a')]=qs['filters'](_[_0x2424('0x3b')](_0x224cae[_0x2424('0x2f')],_0x2ee97d['filters']));if(_0x224cae[_0x2424('0x2f')][_0x2424('0x3c')]){_0x4b0ee6[_0x2424('0x3a')]=_[_0x2424('0x3f')](_0x4b0ee6[_0x2424('0x3a')],{'$or':_['map'](_0x4b0ee6[_0x2424('0x33')],function(_0x17cb45){var _0x2e9ab6={};_0x2e9ab6[_0x17cb45]={'$like':'%'+_0x224cae[_0x2424('0x2f')]['filter']+'%'};return _0x2e9ab6;})});}_0x4b0ee6=_[_0x2424('0x3f')]({},_0x4b0ee6,_0x224cae[_0x2424('0x47')]);return _0x196790[_0x2424('0x8c')](_0x4b0ee6);}})[_0x2424('0x20')](function(_0x59a3d0){if(_0x59a3d0){_0x19981f=_0x59a3d0[_0x2424('0x45')];if(!_0x224cae['query'][_0x2424('0x35')](_0x2424('0x36'))){_0x4b0ee6[_0x2424('0x19')]=qs[_0x2424('0x19')](_0x224cae['query']['limit']);_0x4b0ee6[_0x2424('0x37')]=qs['offset'](_0x224cae[_0x2424('0x2f')][_0x2424('0x37')]);}return _0x196790[_0x2424('0x8c')](_0x4b0ee6);}})[_0x2424('0x20')](function(_0x31fd3b){if(_0x31fd3b){return _0x31fd3b?{'count':_0x19981f,'rows':_0x31fd3b}:null;}})['then'](respondWithResult(_0x3558ff,null))[_0x2424('0x42')](handleError(_0x3558ff,null));};exports[_0x2424('0x8e')]=function(_0x17e968,_0x51c062,_0x4ee736){var _0x1d62a1,_0x2628c5;var _0x5aa025=[];var _0x1ef05d=moment()[_0x2424('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x17e968['params']['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x51c062,null))['then'](function(_0x23d83c){if(_0x23d83c){_0x2628c5=_0x23d83c;return _0x23d83c[_0x2424('0x8e')](_0x17e968['body'][_0x2424('0x65')],_[_0x2424('0x4f')](_0x17e968[_0x2424('0x51')],['ids','id'])||{});}return null;})[_0x2424('0x66')](function(_0x63955d){var _0x7b7ee8;var _0x53ac48;_0x1d62a1=_0x63955d||[];var _0x30ba78=[];if(_0x63955d){for(var _0x626faf=0x0;_0x626faf<_0x63955d[_0x2424('0x45')];_0x626faf+=0x1){var _0xd41693=_0x63955d[_0x626faf][_0x2424('0x21')]({'plain':!![]});_0x7b7ee8=squel[_0x2424('0x7e')]()[_0x2424('0x67')](_0x2424('0x8f'))['fromQuery']([_0x2424('0x69'),_0x2424('0x6a'),_0x2424('0x6b'),'CampaignId','createdAt','updatedAt'],squel[_0x2424('0x6c')]()[_0x2424('0x6d')](_0x2424('0x69'),_0x2424('0x69'))['field']('id',_0x2424('0x6a'))[_0x2424('0x6d')](_0xd41693[_0x2424('0x74')][_0x2424('0x70')](),_0x2424('0x6b'))['field'](_0x17e968[_0x2424('0x44')]['id'][_0x2424('0x70')](),_0x2424('0x58'))[_0x2424('0x6d')](_0x2424('0x6e'),'createdAt')[_0x2424('0x6d')](_0x2424('0x6e'),_0x2424('0x50'))[_0x2424('0x71')](_0x2424('0x72'))[_0x2424('0x3a')]('deletedAt\x20IS\x20NULL')[_0x2424('0x3a')]('ListId\x20=\x20?',_0xd41693[_0x2424('0x74')]['toString']())[_0x2424('0x3a')](_0x2424('0x7c')))['toString']();_0x30ba78[_0x2424('0x88')](db[_0x2424('0x89')][_0x2424('0x2f')](_0x7b7ee8));}return BPromise['all'](_0x30ba78);}})['then'](function(){return _0x1d62a1;})[_0x2424('0x20')](respondWithResult(_0x51c062,null))['catch'](handleError(_0x51c062,null));};exports[_0x2424('0x90')]=function(_0x135b4a,_0x11d42a,_0x305756){return db[_0x2424('0x2a')][_0x2424('0x4c')]({'where':{'id':_0x135b4a[_0x2424('0x44')]['id']}})[_0x2424('0x20')](handleEntityNotFound(_0x11d42a,null))['then'](function(_0x441d1e){if(_0x441d1e){return _0x441d1e[_0x2424('0x90')](_0x135b4a[_0x2424('0x2f')][_0x2424('0x65')]);}})[_0x2424('0x20')](function(_0x261f68){if(_0x261f68){return db[_0x2424('0x60')][_0x2424('0x24')]({'where':{'ListId':_0x135b4a[_0x2424('0x2f')][_0x2424('0x65')],'CampaignId':_0x135b4a[_0x2424('0x44')]['id']}})[_0x2424('0x20')](function(){return _0x261f68;});}})[_0x2424('0x20')](respondWithStatusCode(_0x11d42a,null))['catch'](handleError(_0x11d42a,null));}; \ No newline at end of file +var _0x0ca5=['Campaign','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','CmHopper','order','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','CmList','getBlackLists','addBlackLists','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map'];(function(_0x5d1869,_0x487d59){var _0x4987d3=function(_0x291bf9){while(--_0x291bf9){_0x5d1869['push'](_0x5d1869['shift']());}};_0x4987d3(++_0x487d59);}(_0x0ca5,0xfc));var _0x50ca=function(_0x187730,_0x19cc8d){_0x187730=_0x187730-0x0;var _0x1181a4=_0x0ca5[_0x187730];return _0x1181a4;};'use strict';var emlformat=require(_0x50ca('0x0'));var rimraf=require(_0x50ca('0x1'));var zipdir=require(_0x50ca('0x2'));var jsonpatch=require(_0x50ca('0x3'));var rp=require(_0x50ca('0x4'));var moment=require(_0x50ca('0x5'));var BPromise=require(_0x50ca('0x6'));var Mustache=require(_0x50ca('0x7'));var util=require('util');var path=require(_0x50ca('0x8'));var sox=require(_0x50ca('0x9'));var csv=require(_0x50ca('0xa'));var ejs=require(_0x50ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50ca('0xc'));var squel=require(_0x50ca('0xd'));var crypto=require('crypto');var jsforce=require(_0x50ca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x50ca('0xa'));var querystring=require('querystring');var Papa=require(_0x50ca('0xf'));var Redis=require(_0x50ca('0x10'));var authService=require(_0x50ca('0x11'));var qs=require(_0x50ca('0x12'));var as=require(_0x50ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x50ca('0x14'));var utils=require(_0x50ca('0x15'));var config=require(_0x50ca('0x16'));var licenseUtil=require(_0x50ca('0x17'));var db=require(_0x50ca('0x18'))['db'];function respondWithStatusCode(_0x26797d,_0x297cb5){_0x297cb5=_0x297cb5||0xcc;return function(_0x323ab7){if(_0x323ab7){return _0x26797d[_0x50ca('0x19')](_0x297cb5);}return _0x26797d[_0x50ca('0x1a')](_0x297cb5)[_0x50ca('0x1b')]();};}function respondWithResult(_0x41cb54,_0x2ba68b){_0x2ba68b=_0x2ba68b||0xc8;return function(_0x868867){if(_0x868867){return _0x41cb54[_0x50ca('0x1a')](_0x2ba68b)['json'](_0x868867);}};}function respondWithFilteredResult(_0x168436,_0x5729e1){return function(_0x708d02){if(_0x708d02){var _0x3035e5=typeof _0x5729e1[_0x50ca('0x1c')]==='undefined'&&typeof _0x5729e1[_0x50ca('0x1d')]==='undefined';var _0x1d16bd=_0x708d02[_0x50ca('0x1e')];var _0x1b1f61=_0x3035e5?0x0:_0x5729e1[_0x50ca('0x1c')];var _0x4d9cbc=_0x3035e5?_0x708d02[_0x50ca('0x1e')]:_0x5729e1[_0x50ca('0x1c')]+_0x5729e1[_0x50ca('0x1d')];var _0x4bc6b9;if(_0x4d9cbc>=_0x1d16bd){_0x4d9cbc=_0x1d16bd;_0x4bc6b9=0xc8;}else{_0x4bc6b9=0xce;}_0x168436['status'](_0x4bc6b9);return _0x168436[_0x50ca('0x1f')](_0x50ca('0x20'),_0x1b1f61+'-'+_0x4d9cbc+'/'+_0x1d16bd)[_0x50ca('0x21')](_0x708d02);}return null;};}function patchUpdates(_0x346406){return function(_0x1bdd6f){try{jsonpatch[_0x50ca('0x22')](_0x1bdd6f,_0x346406,!![]);}catch(_0x48203d){return BPromise['reject'](_0x48203d);}return _0x1bdd6f[_0x50ca('0x23')]();};}function saveUpdates(_0x2e522f,_0x1f3d65){return function(_0x44c017){if(_0x44c017){return _0x44c017[_0x50ca('0x24')](_0x2e522f)[_0x50ca('0x25')](function(_0x7e6bad){return _0x7e6bad;});}return null;};}function removeEntity(_0x16f5b5,_0x4c4f58){return function(_0x53e1e7){if(_0x53e1e7){return _0x53e1e7[_0x50ca('0x26')]()['then'](function(){var _0x2c828a=_0x53e1e7[_0x50ca('0x27')]({'plain':!![]});var _0x4a4b6e=_0x50ca('0x28');return db[_0x50ca('0x29')][_0x50ca('0x26')]({'where':{'type':_0x4a4b6e,'resourceId':_0x2c828a['id']}})['then'](function(){return _0x53e1e7;});})[_0x50ca('0x25')](function(){_0x16f5b5['status'](0xcc)[_0x50ca('0x1b')]();});}};}function handleEntityNotFound(_0x1ebf0d,_0x17cfd0){return function(_0x58ebac){if(!_0x58ebac){_0x1ebf0d[_0x50ca('0x19')](0x194);}return _0x58ebac;};}function handleError(_0x4fd8a7,_0xca51f){_0xca51f=_0xca51f||0x1f4;return function(_0x44fc76){logger[_0x50ca('0x2a')](_0x44fc76[_0x50ca('0x2b')]);if(_0x44fc76[_0x50ca('0x2c')]){delete _0x44fc76[_0x50ca('0x2c')];}_0x4fd8a7[_0x50ca('0x1a')](_0xca51f)[_0x50ca('0x2d')](_0x44fc76);};}exports[_0x50ca('0x2e')]=function(_0x34aad2,_0x784edb){var _0x5e4285={},_0x474a2a={},_0x2c3133={'count':0x0,'rows':[]};var _0x16e8bf=_[_0x50ca('0x2f')](db[_0x50ca('0x30')][_0x50ca('0x31')],function(_0x697e9){return{'name':_0x697e9[_0x50ca('0x32')],'type':_0x697e9['type'][_0x50ca('0x33')]};});_0x474a2a[_0x50ca('0x34')]=_[_0x50ca('0x2f')](_0x16e8bf,_0x50ca('0x2c'));_0x474a2a[_0x50ca('0x35')]=_['keys'](_0x34aad2[_0x50ca('0x35')]);_0x474a2a['filters']=_[_0x50ca('0x36')](_0x474a2a[_0x50ca('0x34')],_0x474a2a[_0x50ca('0x35')]);_0x5e4285[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x474a2a['model'],qs[_0x50ca('0x38')](_0x34aad2[_0x50ca('0x35')][_0x50ca('0x38')]));_0x5e4285[_0x50ca('0x37')]=_0x5e4285[_0x50ca('0x37')]['length']?_0x5e4285[_0x50ca('0x37')]:_0x474a2a[_0x50ca('0x34')];if(!_0x34aad2['query'][_0x50ca('0x39')](_0x50ca('0x3a'))){_0x5e4285[_0x50ca('0x1d')]=qs[_0x50ca('0x1d')](_0x34aad2[_0x50ca('0x35')]['limit']);_0x5e4285[_0x50ca('0x1c')]=qs[_0x50ca('0x1c')](_0x34aad2[_0x50ca('0x35')]['offset']);}_0x5e4285['order']=qs['sort'](_0x34aad2['query'][_0x50ca('0x3b')]);_0x5e4285['where']=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x34aad2[_0x50ca('0x35')],_0x474a2a[_0x50ca('0x3c')]),_0x16e8bf);if(_0x34aad2[_0x50ca('0x35')][_0x50ca('0x3e')]){_0x5e4285[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x5e4285[_0x50ca('0x3f')],{'$or':_[_0x50ca('0x2f')](_0x16e8bf,function(_0x5c48a1){if(_0x5c48a1[_0x50ca('0x41')]!==_0x50ca('0x42')){var _0x590f93={};_0x590f93[_0x5c48a1[_0x50ca('0x2c')]]={'$like':'%'+_0x34aad2[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x590f93;}})});}_0x5e4285=_[_0x50ca('0x40')]({},_0x5e4285,_0x34aad2[_0x50ca('0x43')]);var _0x222382={'where':_0x5e4285[_0x50ca('0x3f')]};return db[_0x50ca('0x30')][_0x50ca('0x1e')](_0x222382)['then'](function(_0x570535){_0x2c3133[_0x50ca('0x1e')]=_0x570535;if(_0x34aad2[_0x50ca('0x35')][_0x50ca('0x44')]){_0x5e4285[_0x50ca('0x45')]=[{'all':!![]}];}return db[_0x50ca('0x30')][_0x50ca('0x46')](_0x5e4285);})['then'](function(_0x4ac01a){_0x2c3133['rows']=_0x4ac01a;return _0x2c3133;})[_0x50ca('0x25')](respondWithFilteredResult(_0x784edb,_0x5e4285))['catch'](handleError(_0x784edb,null));};exports[_0x50ca('0x47')]=function(_0x17c9fe,_0x4177cf){var _0x27c4ce={'raw':![],'where':{'id':_0x17c9fe[_0x50ca('0x48')]['id']}},_0x24f388={};_0x24f388[_0x50ca('0x34')]=_[_0x50ca('0x49')](db[_0x50ca('0x30')]['rawAttributes']);_0x24f388[_0x50ca('0x35')]=_[_0x50ca('0x49')](_0x17c9fe[_0x50ca('0x35')]);_0x24f388[_0x50ca('0x3c')]=_[_0x50ca('0x36')](_0x24f388['model'],_0x24f388[_0x50ca('0x35')]);_0x27c4ce[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x24f388[_0x50ca('0x34')],qs[_0x50ca('0x38')](_0x17c9fe['query'][_0x50ca('0x38')]));_0x27c4ce[_0x50ca('0x37')]=_0x27c4ce[_0x50ca('0x37')][_0x50ca('0x4a')]?_0x27c4ce['attributes']:_0x24f388[_0x50ca('0x34')];if(_0x17c9fe[_0x50ca('0x35')]['includeAll']){_0x27c4ce[_0x50ca('0x45')]=[{'all':!![]}];}_0x27c4ce=_[_0x50ca('0x40')]({},_0x27c4ce,_0x17c9fe[_0x50ca('0x43')]);return db[_0x50ca('0x30')][_0x50ca('0x4b')](_0x27c4ce)[_0x50ca('0x25')](handleEntityNotFound(_0x4177cf,null))[_0x50ca('0x25')](respondWithResult(_0x4177cf,null))[_0x50ca('0x4c')](handleError(_0x4177cf,null));};exports[_0x50ca('0x4d')]=function(_0x2c6f55,_0x39ea){return db[_0x50ca('0x30')][_0x50ca('0x4d')](_0x2c6f55[_0x50ca('0x4e')],{})[_0x50ca('0x25')](function(_0x1b88d5){var _0x415277=_0x2c6f55[_0x50ca('0x4f')]['get']({'plain':!![]});if(!_0x415277)throw new Error(_0x50ca('0x50'));if(_0x415277[_0x50ca('0x51')]==='user'){var _0x1bac1b=_0x1b88d5[_0x50ca('0x27')]({'plain':!![]});var _0x78e460=_0x50ca('0x28');return db[_0x50ca('0x52')][_0x50ca('0x4b')]({'where':{'name':_0x78e460,'userProfileId':_0x415277[_0x50ca('0x53')]},'raw':!![]})[_0x50ca('0x25')](function(_0x5c3296){if(_0x5c3296&&_0x5c3296[_0x50ca('0x54')]===0x0){return db[_0x50ca('0x29')]['create']({'name':_0x1bac1b[_0x50ca('0x2c')],'resourceId':_0x1bac1b['id'],'type':_0x5c3296[_0x50ca('0x2c')],'sectionId':_0x5c3296['id']},{})['then'](function(){return _0x1b88d5;});}else{return _0x1b88d5;}})[_0x50ca('0x4c')](function(_0x56903a){logger[_0x50ca('0x2a')](_0x50ca('0x55'),_0x56903a);throw _0x56903a;});}return _0x1b88d5;})['then'](respondWithResult(_0x39ea,0xc9))['catch'](handleError(_0x39ea,null));};exports[_0x50ca('0x56')]=function(_0x1c75aa,_0x4b9e77){var _0x1d6032={'where':{'id':_0x1c75aa[_0x50ca('0x48')]['id']}},_0x33625f={};_0x33625f[_0x50ca('0x34')]=_['keys'](db[_0x50ca('0x30')][_0x50ca('0x31')]);_0x1d6032[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x33625f[_0x50ca('0x34')],qs[_0x50ca('0x38')](_0x1c75aa[_0x50ca('0x35')][_0x50ca('0x38')]));_0x1d6032[_0x50ca('0x37')]=_0x1d6032[_0x50ca('0x37')][_0x50ca('0x4a')]?_0x1d6032[_0x50ca('0x37')]:_0x33625f['model'];if(_0x1c75aa[_0x50ca('0x35')]['includeAll']){_0x1d6032[_0x50ca('0x45')]=[{'all':!![]}];}_0x1d6032=_[_0x50ca('0x40')]({},_0x1d6032,_0x1c75aa[_0x50ca('0x43')]);return db['Campaign'][_0x50ca('0x4b')](_0x1d6032)[_0x50ca('0x25')](handleEntityNotFound(_0x4b9e77,null))[_0x50ca('0x25')](function(_0x3a84eb){if(_0x3a84eb){var _0x15e08e=_0x3a84eb['get']({'plain':!![]});_0x15e08e=qs[_0x50ca('0x57')](_0x15e08e,['id',_0x50ca('0x58'),_0x50ca('0x59')]);_0x1c75aa[_0x50ca('0x4e')]=_['omit'](_0x1c75aa[_0x50ca('0x4e')],['id',_0x50ca('0x58'),_0x50ca('0x59')]);return db[_0x50ca('0x30')][_0x50ca('0x4d')](_[_0x50ca('0x40')](_0x15e08e,_0x1c75aa['body']),{'include':_0x1c75aa[_0x50ca('0x35')][_0x50ca('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x2a5174){var _0xfaa5ae=_0x1c75aa['user'][_0x50ca('0x27')]({'plain':!![]});if(!_0xfaa5ae)throw new Error(_0x50ca('0x50'));if(_0xfaa5ae['role']==='user'){var _0x58acd0=_0x2a5174[_0x50ca('0x27')]({'plain':!![]});var _0x5490ce='IvrCampaigns';return db['UserProfileSection'][_0x50ca('0x4b')]({'where':{'name':_0x5490ce,'userProfileId':_0xfaa5ae[_0x50ca('0x53')]},'raw':!![]})[_0x50ca('0x25')](function(_0x35243d){if(_0x35243d&&_0x35243d[_0x50ca('0x54')]===0x0){return db[_0x50ca('0x29')][_0x50ca('0x4d')]({'name':_0x58acd0[_0x50ca('0x2c')],'resourceId':_0x58acd0['id'],'type':_0x35243d['name'],'sectionId':_0x35243d['id']},{})[_0x50ca('0x25')](function(){return _0x2a5174;});}else{return _0x2a5174;}})[_0x50ca('0x4c')](function(_0xf455ad){logger[_0x50ca('0x2a')](_0x50ca('0x55'),_0xf455ad);throw _0xf455ad;});}return _0x2a5174;});}})['then'](respondWithResult(_0x4b9e77,0xc9))[_0x50ca('0x4c')](handleError(_0x4b9e77,null));};exports['update']=function(_0x35b135,_0x50278e){if(_0x35b135[_0x50ca('0x4e')]['id']){delete _0x35b135['body']['id'];}return db[_0x50ca('0x30')][_0x50ca('0x4b')]({'where':{'id':_0x35b135['params']['id']}})['then'](handleEntityNotFound(_0x50278e,null))[_0x50ca('0x25')](saveUpdates(_0x35b135[_0x50ca('0x4e')],null))['then'](respondWithResult(_0x50278e,null))[_0x50ca('0x4c')](handleError(_0x50278e,null));};exports[_0x50ca('0x26')]=function(_0x27f51a,_0x4057a7){return db['Campaign'][_0x50ca('0x4b')]({'where':{'id':_0x27f51a[_0x50ca('0x48')]['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x4057a7,null))[_0x50ca('0x25')](removeEntity(_0x4057a7,null))['catch'](handleError(_0x4057a7,null));};exports['getHoppers']=function(_0x1e7eb5,_0x1ea533,_0x429a66){var _0x581363={'raw':!![],'where':{}};var _0x35bbf7={};var _0x49e45d={'count':0x0,'rows':[]};return db[_0x50ca('0x30')][_0x50ca('0x5a')]({'where':{'id':_0x1e7eb5[_0x50ca('0x48')]['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x1ea533,null))[_0x50ca('0x25')](function(_0x41a18e){if(_0x41a18e){_0x35bbf7[_0x50ca('0x34')]=_['keys'](db[_0x50ca('0x5b')]['rawAttributes']);_0x35bbf7['query']=_[_0x50ca('0x49')](_0x1e7eb5[_0x50ca('0x35')]);_0x35bbf7[_0x50ca('0x3c')]=_[_0x50ca('0x36')](_0x35bbf7[_0x50ca('0x34')],_0x35bbf7[_0x50ca('0x35')]);_0x581363[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x35bbf7['model'],qs[_0x50ca('0x38')](_0x1e7eb5[_0x50ca('0x35')]['fields']));_0x581363['attributes']=_0x581363['attributes'][_0x50ca('0x4a')]?_0x581363[_0x50ca('0x37')]:_0x35bbf7[_0x50ca('0x34')];if(!_0x1e7eb5[_0x50ca('0x35')][_0x50ca('0x39')](_0x50ca('0x3a'))){_0x581363[_0x50ca('0x1d')]=qs[_0x50ca('0x1d')](_0x1e7eb5[_0x50ca('0x35')][_0x50ca('0x1d')]);_0x581363[_0x50ca('0x1c')]=qs[_0x50ca('0x1c')](_0x1e7eb5[_0x50ca('0x35')][_0x50ca('0x1c')]);}_0x581363[_0x50ca('0x5c')]=qs['sort'](_0x1e7eb5['query'][_0x50ca('0x3b')]);_0x581363[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x1e7eb5[_0x50ca('0x35')],_0x35bbf7[_0x50ca('0x3c')]));_0x581363[_0x50ca('0x3f')]['CampaignId']=_0x41a18e['id'];if(_0x1e7eb5[_0x50ca('0x35')]['filter']){_0x581363[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x581363[_0x50ca('0x3f')],{'$or':_[_0x50ca('0x2f')](_0x581363['attributes'],function(_0x4c8dec){var _0x35f7de={};_0x35f7de[_0x4c8dec]={'$like':'%'+_0x1e7eb5['query'][_0x50ca('0x3e')]+'%'};return _0x35f7de;})});}_0x581363=_[_0x50ca('0x40')]({},_0x581363,_0x1e7eb5[_0x50ca('0x43')]);return db['CmHopper'][_0x50ca('0x1e')]({'where':_0x581363['where']})[_0x50ca('0x25')](function(_0x30c196){_0x49e45d[_0x50ca('0x1e')]=_0x30c196;if(_0x1e7eb5[_0x50ca('0x35')][_0x50ca('0x44')]){_0x581363[_0x50ca('0x45')]=[{'all':!![]}];}return db[_0x50ca('0x5b')][_0x50ca('0x46')](_0x581363);})[_0x50ca('0x25')](function(_0x41d94b){_0x49e45d[_0x50ca('0x5d')]=_0x41d94b;return _0x49e45d;});}})[_0x50ca('0x25')](respondWithFilteredResult(_0x1ea533,_0x581363))['catch'](handleError(_0x1ea533,null));};exports[_0x50ca('0x5e')]=function(_0x7f5c59,_0x158218,_0x23fa73){var _0x3be355={'raw':!![],'where':{}};var _0x27d0ad={};var _0x46d5cb={'count':0x0,'rows':[]};return db['Campaign'][_0x50ca('0x5a')]({'where':{'id':_0x7f5c59[_0x50ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x158218,null))[_0x50ca('0x25')](function(_0x342d67){if(_0x342d67){_0x27d0ad['model']=_[_0x50ca('0x49')](db[_0x50ca('0x5f')][_0x50ca('0x31')]);_0x27d0ad[_0x50ca('0x35')]=_[_0x50ca('0x49')](_0x7f5c59[_0x50ca('0x35')]);_0x27d0ad[_0x50ca('0x3c')]=_[_0x50ca('0x36')](_0x27d0ad['model'],_0x27d0ad[_0x50ca('0x35')]);_0x3be355[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x27d0ad[_0x50ca('0x34')],qs['fields'](_0x7f5c59[_0x50ca('0x35')][_0x50ca('0x38')]));_0x3be355[_0x50ca('0x37')]=_0x3be355['attributes'][_0x50ca('0x4a')]?_0x3be355[_0x50ca('0x37')]:_0x27d0ad[_0x50ca('0x34')];if(!_0x7f5c59[_0x50ca('0x35')][_0x50ca('0x39')](_0x50ca('0x3a'))){_0x3be355[_0x50ca('0x1d')]=qs[_0x50ca('0x1d')](_0x7f5c59[_0x50ca('0x35')]['limit']);_0x3be355[_0x50ca('0x1c')]=qs[_0x50ca('0x1c')](_0x7f5c59['query'][_0x50ca('0x1c')]);}_0x3be355[_0x50ca('0x5c')]=qs['sort'](_0x7f5c59['query']['sort']);_0x3be355[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x7f5c59['query'],_0x27d0ad['filters']));_0x3be355[_0x50ca('0x3f')][_0x50ca('0x60')]=_0x342d67['id'];if(_0x7f5c59[_0x50ca('0x35')][_0x50ca('0x3e')]){_0x3be355[_0x50ca('0x3f')]=_['merge'](_0x3be355[_0x50ca('0x3f')],{'$or':_[_0x50ca('0x2f')](_0x3be355[_0x50ca('0x37')],function(_0x18ea46){var _0x243037={};_0x243037[_0x18ea46]={'$like':'%'+_0x7f5c59[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x243037;})});}_0x3be355=_[_0x50ca('0x40')]({},_0x3be355,_0x7f5c59['options']);return db[_0x50ca('0x5f')]['count']({'where':_0x3be355[_0x50ca('0x3f')]})[_0x50ca('0x25')](function(_0x5391bf){_0x46d5cb[_0x50ca('0x1e')]=_0x5391bf;if(_0x7f5c59[_0x50ca('0x35')][_0x50ca('0x44')]){_0x3be355[_0x50ca('0x45')]=[{'all':!![]}];}return db[_0x50ca('0x5f')][_0x50ca('0x46')](_0x3be355);})[_0x50ca('0x25')](function(_0x5e79f0){_0x46d5cb[_0x50ca('0x5d')]=_0x5e79f0;return _0x46d5cb;});}})[_0x50ca('0x25')](respondWithFilteredResult(_0x158218,_0x3be355))[_0x50ca('0x4c')](handleError(_0x158218,null));};exports[_0x50ca('0x61')]=function(_0x5ba6fc,_0xacd7c2,_0x30cdb8){var _0x481d06={'raw':!![],'where':{}};var _0x96ce95={};var _0x51bcbc={'count':0x0,'rows':[]};return db['Campaign'][_0x50ca('0x5a')]({'where':{'id':_0x5ba6fc['params']['id']}})['then'](handleEntityNotFound(_0xacd7c2,null))[_0x50ca('0x25')](function(_0x3f4c40){if(_0x3f4c40){_0x96ce95[_0x50ca('0x34')]=_[_0x50ca('0x49')](db['CmHopperFinal'][_0x50ca('0x31')]);_0x96ce95[_0x50ca('0x35')]=_[_0x50ca('0x49')](_0x5ba6fc['query']);_0x96ce95['filters']=_[_0x50ca('0x36')](_0x96ce95[_0x50ca('0x34')],_0x96ce95['query']);_0x481d06['attributes']=_['intersection'](_0x96ce95[_0x50ca('0x34')],qs[_0x50ca('0x38')](_0x5ba6fc['query'][_0x50ca('0x38')]));_0x481d06[_0x50ca('0x37')]=_0x481d06[_0x50ca('0x37')]['length']?_0x481d06[_0x50ca('0x37')]:_0x96ce95[_0x50ca('0x34')];if(!_0x5ba6fc[_0x50ca('0x35')]['hasOwnProperty']('nolimit')){_0x481d06[_0x50ca('0x1d')]=qs['limit'](_0x5ba6fc['query'][_0x50ca('0x1d')]);_0x481d06['offset']=qs[_0x50ca('0x1c')](_0x5ba6fc[_0x50ca('0x35')]['offset']);}_0x481d06[_0x50ca('0x5c')]=qs[_0x50ca('0x3b')](_0x5ba6fc['query']['sort']);_0x481d06[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x5ba6fc[_0x50ca('0x35')],_0x96ce95['filters']));_0x481d06[_0x50ca('0x3f')][_0x50ca('0x60')]=_0x3f4c40['id'];if(_0x5ba6fc['query'][_0x50ca('0x3e')]){_0x481d06[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x481d06[_0x50ca('0x3f')],{'$or':_['map'](_0x481d06[_0x50ca('0x37')],function(_0x7b1c63){var _0x15908c={};_0x15908c[_0x7b1c63]={'$like':'%'+_0x5ba6fc[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x15908c;})});}_0x481d06=_[_0x50ca('0x40')]({},_0x481d06,_0x5ba6fc[_0x50ca('0x43')]);return db[_0x50ca('0x62')]['count']({'where':_0x481d06['where']})[_0x50ca('0x25')](function(_0x218398){_0x51bcbc[_0x50ca('0x1e')]=_0x218398;if(_0x5ba6fc['query']['includeAll']){_0x481d06[_0x50ca('0x45')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x481d06);})[_0x50ca('0x25')](function(_0x18c09d){_0x51bcbc[_0x50ca('0x5d')]=_0x18c09d;return _0x51bcbc;});}})[_0x50ca('0x25')](respondWithFilteredResult(_0xacd7c2,_0x481d06))[_0x50ca('0x4c')](handleError(_0xacd7c2,null));};exports[_0x50ca('0x63')]=function(_0x9cb226,_0x19377a,_0x2d930e){var _0x5765e6={'raw':!![],'where':{}};var _0x35d66f={};var _0x1e987f={'count':0x0,'rows':[]};return db[_0x50ca('0x30')][_0x50ca('0x5a')]({'where':{'id':_0x9cb226[_0x50ca('0x48')]['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x19377a,null))[_0x50ca('0x25')](function(_0x1f7e46){if(_0x1f7e46){_0x35d66f['model']=_[_0x50ca('0x49')](db[_0x50ca('0x64')][_0x50ca('0x31')]);_0x35d66f[_0x50ca('0x35')]=_[_0x50ca('0x49')](_0x9cb226[_0x50ca('0x35')]);_0x35d66f[_0x50ca('0x3c')]=_[_0x50ca('0x36')](_0x35d66f[_0x50ca('0x34')],_0x35d66f[_0x50ca('0x35')]);_0x5765e6[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x35d66f[_0x50ca('0x34')],qs[_0x50ca('0x38')](_0x9cb226[_0x50ca('0x35')][_0x50ca('0x38')]));_0x5765e6[_0x50ca('0x37')]=_0x5765e6[_0x50ca('0x37')][_0x50ca('0x4a')]?_0x5765e6[_0x50ca('0x37')]:_0x35d66f[_0x50ca('0x34')];if(!_0x9cb226[_0x50ca('0x35')][_0x50ca('0x39')](_0x50ca('0x3a'))){_0x5765e6['limit']=qs[_0x50ca('0x1d')](_0x9cb226[_0x50ca('0x35')][_0x50ca('0x1d')]);_0x5765e6[_0x50ca('0x1c')]=qs['offset'](_0x9cb226[_0x50ca('0x35')]['offset']);}_0x5765e6[_0x50ca('0x5c')]=qs[_0x50ca('0x3b')](_0x9cb226[_0x50ca('0x35')][_0x50ca('0x3b')]);_0x5765e6[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x9cb226[_0x50ca('0x35')],_0x35d66f[_0x50ca('0x3c')]));_0x5765e6[_0x50ca('0x3f')][_0x50ca('0x60')]=_0x1f7e46['id'];if(_0x9cb226['query']['filter']){_0x5765e6[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x5765e6['where'],{'$or':_['map'](_0x5765e6['attributes'],function(_0x4ef2f6){var _0x42551d={};_0x42551d[_0x4ef2f6]={'$like':'%'+_0x9cb226[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x42551d;})});}_0x5765e6=_[_0x50ca('0x40')]({},_0x5765e6,_0x9cb226[_0x50ca('0x43')]);return db[_0x50ca('0x64')][_0x50ca('0x1e')]({'where':_0x5765e6[_0x50ca('0x3f')]})[_0x50ca('0x25')](function(_0x23f234){_0x1e987f[_0x50ca('0x1e')]=_0x23f234;if(_0x9cb226[_0x50ca('0x35')][_0x50ca('0x44')]){_0x5765e6[_0x50ca('0x45')]=[{'all':!![]}];}return db[_0x50ca('0x64')]['findAll'](_0x5765e6);})[_0x50ca('0x25')](function(_0x4ece34){_0x1e987f[_0x50ca('0x5d')]=_0x4ece34;return _0x1e987f;});}})[_0x50ca('0x25')](respondWithFilteredResult(_0x19377a,_0x5765e6))[_0x50ca('0x4c')](handleError(_0x19377a,null));};exports[_0x50ca('0x65')]=function(_0x31dce6,_0x455f7a,_0x28f31a){var _0x18a134={};var _0x248ceb={};var _0x2bb919;var _0x3c4c2e;return db['Campaign'][_0x50ca('0x5a')]({'where':{'id':_0x31dce6[_0x50ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x455f7a,null))[_0x50ca('0x25')](function(_0x44974f){if(_0x44974f){_0x2bb919=_0x44974f;_0x248ceb[_0x50ca('0x34')]=_['keys'](db['CmList'][_0x50ca('0x31')]);_0x248ceb[_0x50ca('0x35')]=_[_0x50ca('0x49')](_0x31dce6[_0x50ca('0x35')]);_0x248ceb['filters']=_[_0x50ca('0x36')](_0x248ceb[_0x50ca('0x34')],_0x248ceb[_0x50ca('0x35')]);_0x18a134[_0x50ca('0x37')]=_['intersection'](_0x248ceb['model'],qs[_0x50ca('0x38')](_0x31dce6[_0x50ca('0x35')][_0x50ca('0x38')]));_0x18a134[_0x50ca('0x37')]=_0x18a134[_0x50ca('0x37')][_0x50ca('0x4a')]?_0x18a134[_0x50ca('0x37')]:_0x248ceb[_0x50ca('0x34')];_0x18a134[_0x50ca('0x5c')]=qs[_0x50ca('0x3b')](_0x31dce6['query'][_0x50ca('0x3b')]);_0x18a134[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x31dce6[_0x50ca('0x35')],_0x248ceb[_0x50ca('0x3c')]));if(_0x31dce6[_0x50ca('0x35')][_0x50ca('0x3e')]){_0x18a134[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x18a134[_0x50ca('0x3f')],{'$or':_['map'](_0x18a134[_0x50ca('0x37')],function(_0x502fea){var _0x590731={};_0x590731[_0x502fea]={'$like':'%'+_0x31dce6[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x590731;})});}_0x18a134=_[_0x50ca('0x40')]({},_0x18a134,_0x31dce6['options']);return _0x2bb919[_0x50ca('0x65')](_0x18a134);}})[_0x50ca('0x25')](function(_0x758bfb){if(_0x758bfb){_0x3c4c2e=_0x758bfb[_0x50ca('0x4a')];if(!_0x31dce6[_0x50ca('0x35')][_0x50ca('0x39')](_0x50ca('0x3a'))){_0x18a134['limit']=qs[_0x50ca('0x1d')](_0x31dce6[_0x50ca('0x35')]['limit']);_0x18a134[_0x50ca('0x1c')]=qs[_0x50ca('0x1c')](_0x31dce6[_0x50ca('0x35')][_0x50ca('0x1c')]);}return _0x2bb919['getLists'](_0x18a134);}})[_0x50ca('0x25')](function(_0x1b49cf){if(_0x1b49cf){return _0x1b49cf?{'count':_0x3c4c2e,'rows':_0x1b49cf}:null;}})[_0x50ca('0x25')](respondWithResult(_0x455f7a,null))[_0x50ca('0x4c')](handleError(_0x455f7a,null));};exports['addLists']=function(_0x13faaa,_0x793cd9,_0x4ffdbd){var _0xffb1bb,_0x4edf5c;var _0x551ff9=[];var _0x5b8b75=moment()[_0x50ca('0x66')](_0x50ca('0x67'));return db[_0x50ca('0x30')][_0x50ca('0x4b')]({'where':{'id':_0x13faaa['params']['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x793cd9,null))[_0x50ca('0x25')](function(_0x2e14ee){if(_0x2e14ee){_0x4edf5c=_0x2e14ee;return _0x2e14ee[_0x50ca('0x68')](_0x13faaa['body'][_0x50ca('0x69')],_[_0x50ca('0x57')](_0x13faaa[_0x50ca('0x4e')],[_0x50ca('0x69'),'id'])||{});}return null;})[_0x50ca('0x6a')](function(_0x1f52c4){var _0x4e89ca;var _0x3d8282;_0xffb1bb=_0x1f52c4||[];var _0x476006=[];if(_0x1f52c4){for(var _0xdd08aa=0x0;_0xdd08aa<_0x1f52c4['length'];_0xdd08aa+=0x1){var _0x250a99=_0x1f52c4[_0xdd08aa][_0x50ca('0x27')]({'plain':!![]});_0x4edf5c[_0x50ca('0x6b')]=_0x13faaa[_0x50ca('0x4e')][_0x50ca('0x6b')]?_0x13faaa[_0x50ca('0x4e')][_0x50ca('0x6b')]:_0x4edf5c[_0x50ca('0x6b')];switch(_0x4edf5c[_0x50ca('0x6b')]){case _0x50ca('0x6c'):_0x4e89ca=squel[_0x50ca('0x6d')]()[_0x50ca('0x6e')](_0x50ca('0x6f'))['fromQuery']([_0x50ca('0x70'),_0x50ca('0x71'),_0x50ca('0x72'),'ListId',_0x50ca('0x60'),_0x50ca('0x58'),_0x50ca('0x59')],squel['select']()[_0x50ca('0x73')](_0x50ca('0x70'),_0x50ca('0x70'))['field'](_0x50ca('0x74'),_0x50ca('0x71'))['field']('id',_0x50ca('0x72'))[_0x50ca('0x73')](_0x250a99[_0x50ca('0x75')][_0x50ca('0x76')](),_0x50ca('0x77'))['field'](_0x13faaa[_0x50ca('0x48')]['id']['toString'](),_0x50ca('0x60'))[_0x50ca('0x73')]('\x27'+_0x5b8b75+'\x27',_0x50ca('0x58'))[_0x50ca('0x73')]('\x27'+_0x5b8b75+'\x27','updatedAt')[_0x50ca('0x78')](_0x50ca('0x79'))[_0x50ca('0x3f')](_0x50ca('0x7a'))['where'](_0x50ca('0x7b'),_0x250a99[_0x50ca('0x75')][_0x50ca('0x76')]())['where'](_0x50ca('0x7c'))['where'](_0x50ca('0x7d'),squel[_0x50ca('0x7e')]()[_0x50ca('0x73')](_0x50ca('0x7f'))['from'](_0x50ca('0x80'))[_0x50ca('0x3f')](_0x50ca('0x81'),_0x13faaa[_0x50ca('0x48')]['id'][_0x50ca('0x76')]()))[_0x50ca('0x3f')](_0x50ca('0x7d'),squel[_0x50ca('0x7e')]()[_0x50ca('0x73')](_0x50ca('0x82'))[_0x50ca('0x78')](_0x50ca('0x6f'))[_0x50ca('0x3f')](_0x50ca('0x81'),_0x13faaa['params']['id'][_0x50ca('0x76')]())))['toString']();break;case _0x50ca('0x83'):_0x4e89ca=squel[_0x50ca('0x6d')]()['into'](_0x50ca('0x6f'))[_0x50ca('0x84')]([_0x50ca('0x70'),_0x50ca('0x71'),_0x50ca('0x72'),'ListId','CampaignId',_0x50ca('0x58'),_0x50ca('0x59')],squel['select']()[_0x50ca('0x73')]('phone',_0x50ca('0x70'))[_0x50ca('0x73')](_0x50ca('0x74'),_0x50ca('0x71'))[_0x50ca('0x73')]('id','ContactId')[_0x50ca('0x73')](_0x250a99['CmListId']['toString'](),'ListId')[_0x50ca('0x73')](_0x13faaa[_0x50ca('0x48')]['id']['toString'](),_0x50ca('0x60'))['field']('\x27'+_0x5b8b75+'\x27',_0x50ca('0x58'))['field']('\x27'+_0x5b8b75+'\x27',_0x50ca('0x59'))[_0x50ca('0x78')]('cm_contacts')[_0x50ca('0x3f')](_0x50ca('0x7a'))[_0x50ca('0x3f')](_0x50ca('0x7b'),_0x250a99[_0x50ca('0x75')]['toString']())[_0x50ca('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x50ca('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x50ca('0x7e')]()[_0x50ca('0x73')](_0x50ca('0x82'))['from'](_0x50ca('0x6f'))[_0x50ca('0x3f')]('CampaignId\x20=\x20?',_0x13faaa[_0x50ca('0x48')]['id'][_0x50ca('0x76')]())))[_0x50ca('0x76')]();break;default:_0x4e89ca=squel[_0x50ca('0x6d')]()[_0x50ca('0x6e')](_0x50ca('0x6f'))[_0x50ca('0x84')](['phone',_0x50ca('0x71'),_0x50ca('0x72'),_0x50ca('0x77'),_0x50ca('0x60'),_0x50ca('0x58'),_0x50ca('0x59')],squel['select']()[_0x50ca('0x73')](_0x50ca('0x70'),_0x50ca('0x70'))[_0x50ca('0x73')](_0x50ca('0x74'),'scheduledAt')[_0x50ca('0x73')]('id','ContactId')[_0x50ca('0x73')](_0x250a99['CmListId']['toString'](),_0x50ca('0x77'))[_0x50ca('0x73')](_0x13faaa[_0x50ca('0x48')]['id'][_0x50ca('0x76')](),_0x50ca('0x60'))[_0x50ca('0x73')]('\x27'+_0x5b8b75+'\x27',_0x50ca('0x58'))['field']('\x27'+_0x5b8b75+'\x27',_0x50ca('0x59'))[_0x50ca('0x78')]('cm_contacts')['where'](_0x50ca('0x7a'))[_0x50ca('0x3f')](_0x50ca('0x7b'),_0x250a99['CmListId'][_0x50ca('0x76')]())[_0x50ca('0x3f')](_0x50ca('0x7c')))[_0x50ca('0x76')]();}_0x3d8282=squel[_0x50ca('0x6d')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x50ca('0x85'),_0x50ca('0x71'),'phone',_0x50ca('0x86'),_0x50ca('0x58'),_0x50ca('0x59')],squel[_0x50ca('0x7e')]()[_0x50ca('0x73')](_0x50ca('0x87'),'id')[_0x50ca('0x73')](_0x50ca('0x74'),_0x50ca('0x71'))[_0x50ca('0x73')](_0x50ca('0x88'),_0x50ca('0x70'))[_0x50ca('0x73')](_0x50ca('0x89'),_0x50ca('0x86'))[_0x50ca('0x73')]('\x27'+_0x5b8b75+'\x27',_0x50ca('0x58'))[_0x50ca('0x73')]('\x27'+_0x5b8b75+'\x27',_0x50ca('0x59'))[_0x50ca('0x78')]('cm_contact_has_items','ci')['join'](_0x50ca('0x6f'),'h',_0x50ca('0x8a'))[_0x50ca('0x3f')](_0x50ca('0x8b'),_0x250a99[_0x50ca('0x75')][_0x50ca('0x76')]())[_0x50ca('0x3f')](_0x50ca('0x8c'),_0x13faaa[_0x50ca('0x48')]['id'][_0x50ca('0x76')]())[_0x50ca('0x3f')](_0x50ca('0x8d'),_0x5b8b75))[_0x50ca('0x76')]();_0x476006[_0x50ca('0x8e')](db[_0x50ca('0x8f')][_0x50ca('0x35')](_0x4e89ca));_0x551ff9[_0x50ca('0x8e')](db[_0x50ca('0x8f')][_0x50ca('0x35')](_0x3d8282));}return BPromise['all'](_0x476006);}})[_0x50ca('0x25')](function(){return BPromise['all'](_0x551ff9);})['then'](function(){return _0xffb1bb;})[_0x50ca('0x25')](respondWithResult(_0x793cd9,null))['catch'](handleError(_0x793cd9,null));};exports[_0x50ca('0x90')]=function(_0x55d853,_0x1cb14f,_0x3fd363){return db[_0x50ca('0x30')][_0x50ca('0x4b')]({'where':{'id':_0x55d853['params']['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x1cb14f,null))[_0x50ca('0x25')](function(_0x40ba5d){if(_0x40ba5d){return _0x40ba5d[_0x50ca('0x90')](_0x55d853[_0x50ca('0x35')][_0x50ca('0x69')]);}})[_0x50ca('0x25')](function(_0x19b5d2){if(_0x19b5d2){return db[_0x50ca('0x5b')]['destroy']({'where':{'ListId':_0x55d853[_0x50ca('0x35')]['ids'],'CampaignId':_0x55d853['params']['id']}})[_0x50ca('0x25')](function(){return _0x19b5d2;});}})[_0x50ca('0x25')](respondWithStatusCode(_0x1cb14f,null))[_0x50ca('0x4c')](handleError(_0x1cb14f,null));};exports['getBlackLists']=function(_0x584d90,_0x1fbb7f,_0x73466d){var _0x55b03f={};var _0x4267e0={};var _0x28907f;var _0x10bb47;return db[_0x50ca('0x30')][_0x50ca('0x5a')]({'where':{'id':_0x584d90[_0x50ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x1fbb7f,null))[_0x50ca('0x25')](function(_0x5565e0){if(_0x5565e0){_0x28907f=_0x5565e0;_0x4267e0[_0x50ca('0x34')]=_[_0x50ca('0x49')](db[_0x50ca('0x91')][_0x50ca('0x31')]);_0x4267e0['query']=_[_0x50ca('0x49')](_0x584d90[_0x50ca('0x35')]);_0x4267e0[_0x50ca('0x3c')]=_['intersection'](_0x4267e0[_0x50ca('0x34')],_0x4267e0[_0x50ca('0x35')]);_0x55b03f[_0x50ca('0x37')]=_[_0x50ca('0x36')](_0x4267e0[_0x50ca('0x34')],qs[_0x50ca('0x38')](_0x584d90[_0x50ca('0x35')][_0x50ca('0x38')]));_0x55b03f[_0x50ca('0x37')]=_0x55b03f[_0x50ca('0x37')]['length']?_0x55b03f[_0x50ca('0x37')]:_0x4267e0[_0x50ca('0x34')];_0x55b03f[_0x50ca('0x5c')]=qs[_0x50ca('0x3b')](_0x584d90['query']['sort']);_0x55b03f[_0x50ca('0x3f')]=qs[_0x50ca('0x3c')](_[_0x50ca('0x3d')](_0x584d90[_0x50ca('0x35')],_0x4267e0[_0x50ca('0x3c')]));if(_0x584d90[_0x50ca('0x35')][_0x50ca('0x3e')]){_0x55b03f[_0x50ca('0x3f')]=_[_0x50ca('0x40')](_0x55b03f[_0x50ca('0x3f')],{'$or':_[_0x50ca('0x2f')](_0x55b03f[_0x50ca('0x37')],function(_0x5a2211){var _0x352f73={};_0x352f73[_0x5a2211]={'$like':'%'+_0x584d90[_0x50ca('0x35')][_0x50ca('0x3e')]+'%'};return _0x352f73;})});}_0x55b03f=_[_0x50ca('0x40')]({},_0x55b03f,_0x584d90[_0x50ca('0x43')]);return _0x28907f[_0x50ca('0x92')](_0x55b03f);}})[_0x50ca('0x25')](function(_0x11d4e5){if(_0x11d4e5){_0x10bb47=_0x11d4e5[_0x50ca('0x4a')];if(!_0x584d90[_0x50ca('0x35')][_0x50ca('0x39')]('nolimit')){_0x55b03f[_0x50ca('0x1d')]=qs[_0x50ca('0x1d')](_0x584d90['query'][_0x50ca('0x1d')]);_0x55b03f['offset']=qs[_0x50ca('0x1c')](_0x584d90[_0x50ca('0x35')]['offset']);}return _0x28907f[_0x50ca('0x92')](_0x55b03f);}})[_0x50ca('0x25')](function(_0x5103f8){if(_0x5103f8){return _0x5103f8?{'count':_0x10bb47,'rows':_0x5103f8}:null;}})[_0x50ca('0x25')](respondWithResult(_0x1fbb7f,null))[_0x50ca('0x4c')](handleError(_0x1fbb7f,null));};exports[_0x50ca('0x93')]=function(_0x5b5ae0,_0x2b012f,_0x5c4c5b){var _0x50bc72,_0x5cd5fa;var _0x4b2197=[];var _0xf68a1e=moment()[_0x50ca('0x66')](_0x50ca('0x67'));return db[_0x50ca('0x30')][_0x50ca('0x4b')]({'where':{'id':_0x5b5ae0['params']['id']}})[_0x50ca('0x25')](handleEntityNotFound(_0x2b012f,null))[_0x50ca('0x25')](function(_0xfd7575){if(_0xfd7575){_0x5cd5fa=_0xfd7575;return _0xfd7575['addBlackLists'](_0x5b5ae0['body']['ids'],_[_0x50ca('0x57')](_0x5b5ae0[_0x50ca('0x4e')],[_0x50ca('0x69'),'id'])||{});}return null;})[_0x50ca('0x6a')](function(_0x3af322){var _0x230812;var _0x473532;_0x50bc72=_0x3af322||[];var _0xd6bb61=[];if(_0x3af322){for(var _0x4e8593=0x0;_0x4e8593<_0x3af322[_0x50ca('0x4a')];_0x4e8593+=0x1){var _0x306606=_0x3af322[_0x4e8593]['get']({'plain':!![]});_0x230812=squel[_0x50ca('0x6d')]()['into']('cm_hopper_black')[_0x50ca('0x84')]([_0x50ca('0x70'),_0x50ca('0x72'),_0x50ca('0x77'),_0x50ca('0x60'),'createdAt',_0x50ca('0x59')],squel[_0x50ca('0x7e')]()[_0x50ca('0x73')]('phone',_0x50ca('0x70'))[_0x50ca('0x73')]('id','ContactId')[_0x50ca('0x73')](_0x306606[_0x50ca('0x75')]['toString'](),_0x50ca('0x77'))['field'](_0x5b5ae0[_0x50ca('0x48')]['id']['toString'](),_0x50ca('0x60'))[_0x50ca('0x73')]('NOW()',_0x50ca('0x58'))[_0x50ca('0x73')](_0x50ca('0x74'),_0x50ca('0x59'))[_0x50ca('0x78')]('cm_contacts')[_0x50ca('0x3f')](_0x50ca('0x7a'))[_0x50ca('0x3f')](_0x50ca('0x7b'),_0x306606[_0x50ca('0x75')][_0x50ca('0x76')]())[_0x50ca('0x3f')](_0x50ca('0x7c')))[_0x50ca('0x76')]();_0xd6bb61[_0x50ca('0x8e')](db[_0x50ca('0x8f')][_0x50ca('0x35')](_0x230812));}return BPromise[_0x50ca('0x94')](_0xd6bb61);}})[_0x50ca('0x25')](function(){return _0x50bc72;})[_0x50ca('0x25')](respondWithResult(_0x2b012f,null))['catch'](handleError(_0x2b012f,null));};exports[_0x50ca('0x95')]=function(_0x1c8601,_0xc0f64f,_0x45967a){return db[_0x50ca('0x30')][_0x50ca('0x4b')]({'where':{'id':_0x1c8601[_0x50ca('0x48')]['id']}})['then'](handleEntityNotFound(_0xc0f64f,null))[_0x50ca('0x25')](function(_0x477ac3){if(_0x477ac3){return _0x477ac3[_0x50ca('0x95')](_0x1c8601[_0x50ca('0x35')][_0x50ca('0x69')]);}})[_0x50ca('0x25')](function(_0x2a15f2){if(_0x2a15f2){return db[_0x50ca('0x64')][_0x50ca('0x26')]({'where':{'ListId':_0x1c8601[_0x50ca('0x35')][_0x50ca('0x69')],'CampaignId':_0x1c8601[_0x50ca('0x48')]['id']}})[_0x50ca('0x25')](function(){return _0x2a15f2;});}})[_0x50ca('0x25')](respondWithStatusCode(_0xc0f64f,null))[_0x50ca('0x4c')](handleError(_0xc0f64f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f31b6b7..6a97cb6 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x58f6fd,_0x8e6c3d){var _0x44dce4=function(_0x451ea8){while(--_0x451ea8){_0x58f6fd['push'](_0x58f6fd['shift']());}};_0x44dce4(++_0x8e6c3d);}(_0x7a54,0x106));var _0x47a5=function(_0x41300c,_0x5f471e){_0x41300c=_0x41300c-0x0;var _0x28ed92=_0x7a54[_0x41300c];return _0x28ed92;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 456ff92..7b40ada 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 _0x20ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCampaign','Campaign','options','raw','attributes','limit','include','model','map','lodash','util','moment'];(function(_0x4df771,_0x198e2f){var _0x1cfd83=function(_0x15b866){while(--_0x15b866){_0x4df771['push'](_0x4df771['shift']());}};_0x1cfd83(++_0x198e2f);}(_0x20ce,0x10d));var _0xe20c=function(_0x3b0c30,_0x488e87){_0x3b0c30=_0x3b0c30-0x0;var _0x55ba8c=_0x20ce[_0x3b0c30];return _0x55ba8c;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x893e48,_0x26b9be,_0x2d88b5){return new BPromise(function(_0x8f79ad,_0x290fb5){return client[_0xe20c('0xd')](_0x893e48,_0x2d88b5)[_0xe20c('0xe')](function(_0x385d61){logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,_0xe20c('0x11'));logger[_0xe20c('0x12')](_0xe20c('0x13'),_0x26b9be,_0xe20c('0x11'),JSON['stringify'](_0x385d61));if(_0x385d61[_0xe20c('0x14')]){if(_0x385d61[_0xe20c('0x14')][_0xe20c('0x15')]===0x1f4){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61['error'][_0xe20c('0x16')]);return _0x290fb5(_0x385d61[_0xe20c('0x14')]['message']);}logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x385d61[_0xe20c('0x14')]['message']);return _0x8f79ad(_0x385d61[_0xe20c('0x14')][_0xe20c('0x16')]);}else{logger[_0xe20c('0xf')](_0xe20c('0x10'),_0x26b9be,'request\x20sent');_0x8f79ad(_0x385d61[_0xe20c('0x17')]['message']);}})[_0xe20c('0x18')](function(_0x4061ed){logger[_0xe20c('0x14')](_0xe20c('0x10'),_0x26b9be,_0x4061ed);_0x290fb5(_0x4061ed);});});}exports[_0xe20c('0x19')]=function(_0x2d58a7){var _0x2a4292=this;return new Promise(function(_0x3d8df5,_0x305f2f){return db[_0xe20c('0x1a')]['findAll']({'raw':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7['options']['where']||null:null,'attributes':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1d')]||null:null,'limit':_0x2d58a7['options']?_0x2d58a7['options'][_0xe20c('0x1e')]||null:null,'include':_0x2d58a7[_0xe20c('0x1b')]?_0x2d58a7[_0xe20c('0x1b')][_0xe20c('0x1f')]?_['map'](_0x2d58a7[_0xe20c('0x1b')]['include'],function(_0x13bf33){return{'model':db[_0x13bf33[_0xe20c('0x20')]],'as':_0x13bf33['as'],'attributes':_0x13bf33[_0xe20c('0x1d')],'include':_0x13bf33[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x13bf33[_0xe20c('0x1f')],function(_0x12846c){return{'model':db[_0x12846c['model']],'as':_0x12846c['as'],'attributes':_0x12846c[_0xe20c('0x1d')],'include':_0x12846c[_0xe20c('0x1f')]?_[_0xe20c('0x21')](_0x12846c[_0xe20c('0x1f')],function(_0x2dd621){return{'model':db[_0x2dd621[_0xe20c('0x20')]],'as':_0x2dd621['as'],'attributes':_0x2dd621[_0xe20c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe20c('0xe')](function(_0x562e52){logger[_0xe20c('0xf')](_0xe20c('0x19'),_0x2d58a7);logger[_0xe20c('0x12')](_0xe20c('0x19'),_0x2d58a7,JSON['stringify'](_0x562e52));_0x3d8df5(_0x562e52);})[_0xe20c('0x18')](function(_0x54df97){logger['error'](_0xe20c('0x19'),_0x54df97[_0xe20c('0x16')],_0x2d58a7);_0x305f2f(_0x2a4292[_0xe20c('0x14')](0x1f4,_0x54df97['message']));});});}; \ No newline at end of file +var _0x6c96=['GetCampaign','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','Campaign','findAll','options','raw','attributes','map','include','model','info'];(function(_0x6c70aa,_0xde0c6d){var _0x78eee8=function(_0x74ddbc){while(--_0x74ddbc){_0x6c70aa['push'](_0x6c70aa['shift']());}};_0x78eee8(++_0xde0c6d);}(_0x6c96,0x1c1));var _0x66c9=function(_0x5a471e,_0x4ec7ed){_0x5a471e=_0x5a471e-0x0;var _0xdfc1e1=_0x6c96[_0x5a471e];return _0xdfc1e1;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var moment=require(_0x66c9('0x1'));var BPromise=require(_0x66c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66c9('0x3'));var db=require(_0x66c9('0x4'))['db'];var utils=require(_0x66c9('0x5'));var logger=require(_0x66c9('0x6'))(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var jayson=require(_0x66c9('0x9'));var client=jayson['client'][_0x66c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6baa,_0xb03819,_0x4d7692){return new BPromise(function(_0x55b488,_0xfc41a4){return client[_0x66c9('0xb')](_0x4c6baa,_0x4d7692)[_0x66c9('0xc')](function(_0x2e8ad5){logger['info']('Campaign,\x20%s,\x20%s',_0xb03819,'request\x20sent');logger['debug'](_0x66c9('0xd'),_0xb03819,_0x66c9('0xe'),JSON[_0x66c9('0xf')](_0x2e8ad5));if(_0x2e8ad5['error']){if(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x11')]===0x1f4){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5['error'][_0x66c9('0x13')]);return _0xfc41a4(_0x2e8ad5['error'][_0x66c9('0x13')]);}logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5[_0x66c9('0x10')]['message']);return _0x55b488(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x13')]);}else{logger['info'](_0x66c9('0x12'),_0xb03819,_0x66c9('0xe'));_0x55b488(_0x2e8ad5[_0x66c9('0x14')][_0x66c9('0x13')]);}})[_0x66c9('0x15')](function(_0x14d989){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x14d989);_0xfc41a4(_0x14d989);});});}exports['GetCampaign']=function(_0x11242a){var _0x578245=this;return new Promise(function(_0x4b4a50,_0x30c5fa){return db[_0x66c9('0x16')][_0x66c9('0x17')]({'raw':_0x11242a[_0x66c9('0x18')]?_0x11242a[_0x66c9('0x18')][_0x66c9('0x19')]===undefined?!![]:![]:!![],'where':_0x11242a[_0x66c9('0x18')]?_0x11242a['options']['where']||null:null,'attributes':_0x11242a[_0x66c9('0x18')]?_0x11242a[_0x66c9('0x18')][_0x66c9('0x1a')]||null:null,'limit':_0x11242a[_0x66c9('0x18')]?_0x11242a[_0x66c9('0x18')]['limit']||null:null,'include':_0x11242a[_0x66c9('0x18')]?_0x11242a[_0x66c9('0x18')]['include']?_[_0x66c9('0x1b')](_0x11242a[_0x66c9('0x18')][_0x66c9('0x1c')],function(_0x3f3be1){return{'model':db[_0x3f3be1[_0x66c9('0x1d')]],'as':_0x3f3be1['as'],'attributes':_0x3f3be1[_0x66c9('0x1a')],'include':_0x3f3be1[_0x66c9('0x1c')]?_['map'](_0x3f3be1[_0x66c9('0x1c')],function(_0x5bb599){return{'model':db[_0x5bb599['model']],'as':_0x5bb599['as'],'attributes':_0x5bb599[_0x66c9('0x1a')],'include':_0x5bb599['include']?_[_0x66c9('0x1b')](_0x5bb599['include'],function(_0x95ce9f){return{'model':db[_0x95ce9f['model']],'as':_0x95ce9f['as'],'attributes':_0x95ce9f[_0x66c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x66c9('0xc')](function(_0x1f9d01){logger[_0x66c9('0x1e')](_0x66c9('0x1f'),_0x11242a);logger['debug'](_0x66c9('0x1f'),_0x11242a,JSON[_0x66c9('0xf')](_0x1f9d01));_0x4b4a50(_0x1f9d01);})[_0x66c9('0x15')](function(_0x1279e5){logger['error'](_0x66c9('0x1f'),_0x1279e5['message'],_0x11242a);_0x30c5fa(_0x578245[_0x66c9('0x10')](0x1f4,_0x1279e5[_0x66c9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5801728..1b2c5ce 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 _0x28ed=['clone','addLists','addBlackLists','put','delete','removeLists','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone'];(function(_0x21f089,_0x5ebacd){var _0x59c5e7=function(_0x2af336){while(--_0x2af336){_0x21f089['push'](_0x21f089['shift']());}};_0x59c5e7(++_0x5ebacd);}(_0x28ed,0x1b9));var _0xd28e=function(_0x289818,_0x43e99f){_0x289818=_0x289818-0x0;var _0x30e9cb=_0x28ed[_0x289818];return _0x30e9cb;};'use strict';var multer=require('multer');var util=require(_0xd28e('0x0'));var path=require('path');var timeout=require(_0xd28e('0x1'));var express=require(_0xd28e('0x2'));var router=express[_0xd28e('0x3')]();var fs_extra=require(_0xd28e('0x4'));var auth=require(_0xd28e('0x5'));var interaction=require(_0xd28e('0x6'));var config=require(_0xd28e('0x7'));var controller=require(_0xd28e('0x8'));router[_0xd28e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd28e('0x9')](_0xd28e('0xa'),auth[_0xd28e('0xb')](),controller[_0xd28e('0xc')]);router[_0xd28e('0x9')]('/:id/hoppers',auth[_0xd28e('0xb')](),controller[_0xd28e('0xd')]);router['get'](_0xd28e('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xd28e('0x9')](_0xd28e('0xf'),auth[_0xd28e('0xb')](),controller['getHopperFinals']);router[_0xd28e('0x9')](_0xd28e('0x10'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x11')]);router['get'](_0xd28e('0x12'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x13')]);router[_0xd28e('0x9')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller['getBlackLists']);router[_0xd28e('0x15')]('/',auth[_0xd28e('0xb')](),controller['create']);router['post'](_0xd28e('0x16'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x17')]);router['post'](_0xd28e('0x12'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x18')]);router[_0xd28e('0x15')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller[_0xd28e('0x19')]);router[_0xd28e('0x1a')]('/:id',auth[_0xd28e('0xb')](),controller['update']);router['delete'](_0xd28e('0xa'),auth[_0xd28e('0xb')](),controller['destroy']);router[_0xd28e('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xd28e('0x1c')]);router[_0xd28e('0x1b')](_0xd28e('0x14'),auth[_0xd28e('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x3172=['./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','addLists','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2abb00,_0x383dcd){var _0x318e93=function(_0xf02a15){while(--_0xf02a15){_0x2abb00['push'](_0x2abb00['shift']());}};_0x318e93(++_0x383dcd);}(_0x3172,0x106));var _0x2317=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x3172[_0x3f00ee];return _0x18a07e;};'use strict';var multer=require(_0x2317('0x0'));var util=require(_0x2317('0x1'));var path=require(_0x2317('0x2'));var timeout=require(_0x2317('0x3'));var express=require(_0x2317('0x4'));var router=express[_0x2317('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2317('0x6'));var interaction=require(_0x2317('0x7'));var config=require('../../config/environment');var controller=require(_0x2317('0x8'));router[_0x2317('0x9')]('/',auth[_0x2317('0xa')](),controller['index']);router[_0x2317('0x9')]('/:id',auth[_0x2317('0xa')](),controller[_0x2317('0xb')]);router[_0x2317('0x9')](_0x2317('0xc'),auth['isAuthenticated'](),controller[_0x2317('0xd')]);router[_0x2317('0x9')](_0x2317('0xe'),auth[_0x2317('0xa')](),controller[_0x2317('0xf')]);router[_0x2317('0x9')]('/:id/hopper_finals',auth[_0x2317('0xa')](),controller[_0x2317('0x10')]);router[_0x2317('0x9')](_0x2317('0x11'),auth[_0x2317('0xa')](),controller[_0x2317('0x12')]);router[_0x2317('0x9')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x13')]);router['get'](_0x2317('0x14'),auth[_0x2317('0xa')](),controller[_0x2317('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2317('0x16')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x2317('0x16')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x17')]);router[_0x2317('0x16')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router['put'](_0x2317('0x18'),auth[_0x2317('0xa')](),controller['update']);router[_0x2317('0x19')](_0x2317('0x18'),auth[_0x2317('0xa')](),controller[_0x2317('0x1a')]);router[_0x2317('0x19')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x1b')]);router[_0x2317('0x19')](_0x2317('0x14'),auth['isAuthenticated'](),controller[_0x2317('0x1c')]);module[_0x2317('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index a2242b7..f086a0f 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 _0xa626=['key','sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x3965ce,_0x4dfc39){var _0x1528b5=function(_0x5b2cb1){while(--_0x5b2cb1){_0x3965ce['push'](_0x3965ce['shift']());}};_0x1528b5(++_0x4dfc39);}(_0xa626,0x89));var _0x6a62=function(_0x396e0f,_0x402bb2){_0x396e0f=_0x396e0f-0x0;var _0x300558=_0xa626[_0x396e0f];return _0x300558;};'use strict';var Sequelize=require(_0x6a62('0x0'));module[_0x6a62('0x1')]={'key':{'type':Sequelize[_0x6a62('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6a62('0x3')],'length':_0x6a62('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6a62('0x5')],'get':function(){return this[_0x6a62('0x6')](_0x6a62('0x7'));}}}; \ No newline at end of file +var _0x0d0d=['VIRTUAL','getDataValue','key','sequelize','exports','STRING','TEXT','medium'];(function(_0x312338,_0x5f1036){var _0xc4e67=function(_0x1bcf30){while(--_0x1bcf30){_0x312338['push'](_0x312338['shift']());}};_0xc4e67(++_0x5f1036);}(_0x0d0d,0x83));var _0xd0d0=function(_0x229783,_0x44ae32){_0x229783=_0x229783-0x0;var _0x35d1a4=_0x0d0d[_0x229783];return _0x35d1a4;};'use strict';var Sequelize=require(_0xd0d0('0x0'));module[_0xd0d0('0x1')]={'key':{'type':Sequelize[_0xd0d0('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xd0d0('0x3')],'length':_0xd0d0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xd0d0('0x2')]},'name':{'type':Sequelize[_0xd0d0('0x5')],'get':function(){return this[_0xd0d0('0x6')](_0xd0d0('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f9b0c35..fc27046 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 _0x23a0=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','CannedAnswer','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','rawAttributes','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x3211fe,_0x61867f){var _0x20b1db=function(_0x21ee72){while(--_0x21ee72){_0x3211fe['push'](_0x3211fe['shift']());}};_0x20b1db(++_0x61867f);}(_0x23a0,0x1a4));var _0x023a=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x23a0[_0x4f431d];return _0x4f31e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x023a('0x0'));var zipdir=require(_0x023a('0x1'));var jsonpatch=require(_0x023a('0x2'));var rp=require(_0x023a('0x3'));var moment=require(_0x023a('0x4'));var BPromise=require(_0x023a('0x5'));var Mustache=require(_0x023a('0x6'));var util=require(_0x023a('0x7'));var path=require('path');var sox=require(_0x023a('0x8'));var csv=require(_0x023a('0x9'));var ejs=require(_0x023a('0xa'));var fs=require('fs');var fs_extra=require(_0x023a('0xb'));var _=require(_0x023a('0xc'));var squel=require('squel');var crypto=require(_0x023a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x023a('0xe'));var toCsv=require(_0x023a('0x9'));var querystring=require(_0x023a('0xf'));var Papa=require(_0x023a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x023a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x023a('0x12'));var logger=require(_0x023a('0x13'))('api');var utils=require(_0x023a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x023a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x865d51,_0x454f89){_0x454f89=_0x454f89||0xcc;return function(_0x1a6531){if(_0x1a6531){return _0x865d51[_0x023a('0x16')](_0x454f89);}return _0x865d51[_0x023a('0x17')](_0x454f89)[_0x023a('0x18')]();};}function respondWithResult(_0x247e3b,_0x3c550d){_0x3c550d=_0x3c550d||0xc8;return function(_0x3d1d03){if(_0x3d1d03){return _0x247e3b[_0x023a('0x17')](_0x3c550d)[_0x023a('0x19')](_0x3d1d03);}};}function respondWithFilteredResult(_0x1c8a70,_0x258515){return function(_0x4ad98d){if(_0x4ad98d){var _0x290c73=typeof _0x258515[_0x023a('0x1a')]==='undefined'&&typeof _0x258515[_0x023a('0x1b')]===_0x023a('0x1c');var _0x156c4c=_0x4ad98d[_0x023a('0x1d')];var _0x2c7531=_0x290c73?0x0:_0x258515[_0x023a('0x1a')];var _0x4bd762=_0x290c73?_0x4ad98d[_0x023a('0x1d')]:_0x258515['offset']+_0x258515['limit'];var _0x23e1f8;if(_0x4bd762>=_0x156c4c){_0x4bd762=_0x156c4c;_0x23e1f8=0xc8;}else{_0x23e1f8=0xce;}_0x1c8a70['status'](_0x23e1f8);return _0x1c8a70[_0x023a('0x1e')](_0x023a('0x1f'),_0x2c7531+'-'+_0x4bd762+'/'+_0x156c4c)[_0x023a('0x19')](_0x4ad98d);}return null;};}function patchUpdates(_0x545447){return function(_0x493ba6){try{jsonpatch[_0x023a('0x20')](_0x493ba6,_0x545447,!![]);}catch(_0x45fc9a){return BPromise[_0x023a('0x21')](_0x45fc9a);}return _0x493ba6[_0x023a('0x22')]();};}function saveUpdates(_0x416b5f,_0x3da2e5){return function(_0x1109c5){if(_0x1109c5){return _0x1109c5['update'](_0x416b5f)[_0x023a('0x23')](function(_0x145e89){return _0x145e89;});}return null;};}function removeEntity(_0x14968e,_0x38092a){return function(_0x113190){if(_0x113190){return _0x113190[_0x023a('0x24')]()['then'](function(){var _0x159baf=_0x113190[_0x023a('0x25')]({'plain':!![]});var _0x58ddc9=_0x023a('0x26');return db[_0x023a('0x27')][_0x023a('0x24')]({'where':{'type':_0x58ddc9,'resourceId':_0x159baf['id']}})[_0x023a('0x23')](function(){return _0x113190;});})[_0x023a('0x23')](function(){_0x14968e[_0x023a('0x17')](0xcc)[_0x023a('0x18')]();});}};}function handleEntityNotFound(_0x50f0ea,_0x5010c3){return function(_0x5ebf94){if(!_0x5ebf94){_0x50f0ea[_0x023a('0x16')](0x194);}return _0x5ebf94;};}function handleError(_0x452956,_0xd92855){_0xd92855=_0xd92855||0x1f4;return function(_0x3e2a6a){logger[_0x023a('0x28')](_0x3e2a6a[_0x023a('0x29')]);if(_0x3e2a6a[_0x023a('0x2a')]){delete _0x3e2a6a[_0x023a('0x2a')];}_0x452956[_0x023a('0x17')](_0xd92855)[_0x023a('0x2b')](_0x3e2a6a);};}exports['index']=function(_0x167d34,_0x2ded17){var _0x161034={},_0x1924db={},_0xb26ff2={'count':0x0,'rows':[]};var _0x4a09a8=_[_0x023a('0x2c')](db[_0x023a('0x2d')]['rawAttributes'],function(_0x430558){return{'name':_0x430558[_0x023a('0x2e')],'type':_0x430558[_0x023a('0x2f')][_0x023a('0x30')]};});_0x1924db[_0x023a('0x31')]=_[_0x023a('0x2c')](_0x4a09a8,_0x023a('0x2a'));_0x1924db['query']=_[_0x023a('0x32')](_0x167d34[_0x023a('0x33')]);_0x1924db[_0x023a('0x34')]=_['intersection'](_0x1924db[_0x023a('0x31')],_0x1924db[_0x023a('0x33')]);_0x161034[_0x023a('0x35')]=_[_0x023a('0x36')](_0x1924db[_0x023a('0x31')],qs[_0x023a('0x37')](_0x167d34[_0x023a('0x33')][_0x023a('0x37')]));_0x161034['attributes']=_0x161034[_0x023a('0x35')][_0x023a('0x38')]?_0x161034[_0x023a('0x35')]:_0x1924db[_0x023a('0x31')];if(!_0x167d34['query'][_0x023a('0x39')](_0x023a('0x3a'))){_0x161034[_0x023a('0x1b')]=qs[_0x023a('0x1b')](_0x167d34[_0x023a('0x33')][_0x023a('0x1b')]);_0x161034['offset']=qs['offset'](_0x167d34[_0x023a('0x33')]['offset']);}_0x161034[_0x023a('0x3b')]=qs[_0x023a('0x3c')](_0x167d34['query'][_0x023a('0x3c')]);_0x161034[_0x023a('0x3d')]=qs['filters'](_[_0x023a('0x3e')](_0x167d34[_0x023a('0x33')],_0x1924db[_0x023a('0x34')]),_0x4a09a8);if(_0x167d34['query'][_0x023a('0x3f')]){_0x161034['where']=_[_0x023a('0x40')](_0x161034[_0x023a('0x3d')],{'$or':[{'key':{'$like':'%'+_0x167d34['query'][_0x023a('0x3f')]+'%'}},{'value':{'$like':'%'+_0x167d34[_0x023a('0x33')]['filter']+'%'}}]});}_0x161034=_[_0x023a('0x40')]({},_0x161034,_0x167d34[_0x023a('0x41')]);var _0x3dda67={'where':_0x161034[_0x023a('0x3d')]};return db['CannedAnswer'][_0x023a('0x1d')](_0x3dda67)['then'](function(_0x379b0f){_0xb26ff2[_0x023a('0x1d')]=_0x379b0f;if(_0x167d34[_0x023a('0x33')][_0x023a('0x42')]){_0x161034[_0x023a('0x43')]=[{'all':!![]}];}return db[_0x023a('0x2d')][_0x023a('0x44')](_0x161034);})[_0x023a('0x23')](function(_0x20421e){_0xb26ff2['rows']=_0x20421e;return _0xb26ff2;})['then'](respondWithFilteredResult(_0x2ded17,_0x161034))[_0x023a('0x45')](handleError(_0x2ded17,null));};exports['show']=function(_0x357e1f,_0x1b948d){var _0x5b58fe={'raw':!![],'where':{'id':_0x357e1f[_0x023a('0x46')]['id']}},_0x40892c={};_0x40892c[_0x023a('0x31')]=_[_0x023a('0x32')](db['CannedAnswer'][_0x023a('0x47')]);_0x40892c[_0x023a('0x33')]=_[_0x023a('0x32')](_0x357e1f['query']);_0x40892c['filters']=_[_0x023a('0x36')](_0x40892c[_0x023a('0x31')],_0x40892c[_0x023a('0x33')]);_0x5b58fe[_0x023a('0x35')]=_[_0x023a('0x36')](_0x40892c[_0x023a('0x31')],qs[_0x023a('0x37')](_0x357e1f[_0x023a('0x33')][_0x023a('0x37')]));_0x5b58fe[_0x023a('0x35')]=_0x5b58fe[_0x023a('0x35')][_0x023a('0x38')]?_0x5b58fe['attributes']:_0x40892c[_0x023a('0x31')];if(_0x357e1f[_0x023a('0x33')][_0x023a('0x42')]){_0x5b58fe[_0x023a('0x43')]=[{'all':!![]}];}_0x5b58fe=_[_0x023a('0x40')]({},_0x5b58fe,_0x357e1f[_0x023a('0x41')]);return db[_0x023a('0x2d')][_0x023a('0x48')](_0x5b58fe)[_0x023a('0x23')](handleEntityNotFound(_0x1b948d,null))['then'](respondWithResult(_0x1b948d,null))['catch'](handleError(_0x1b948d,null));};exports[_0x023a('0x49')]=function(_0x12eeed,_0x5c8b95){if(_0x12eeed[_0x023a('0x4a')]['id']){delete _0x12eeed[_0x023a('0x4a')]['id'];}return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':{'id':_0x12eeed[_0x023a('0x46')]['id']}})[_0x023a('0x23')](handleEntityNotFound(_0x5c8b95,null))['then'](saveUpdates(_0x12eeed['body'],null))[_0x023a('0x23')](respondWithResult(_0x5c8b95,null))[_0x023a('0x45')](handleError(_0x5c8b95,null));};exports[_0x023a('0x24')]=function(_0x78a1c1,_0x38f8e3){return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':{'id':_0x78a1c1['params']['id']}})[_0x023a('0x23')](handleEntityNotFound(_0x38f8e3,null))[_0x023a('0x23')](removeEntity(_0x38f8e3,null))[_0x023a('0x45')](handleError(_0x38f8e3,null));};exports[_0x023a('0x4b')]=function(_0x44413c,_0xbbd81){var _0x36df50={'key':_0x44413c['body'][_0x023a('0x30')]};if(_0x44413c[_0x023a('0x4a')][_0x023a('0x4c')]){_0x36df50[_0x023a('0x4c')]=_0x44413c[_0x023a('0x4a')]['MailAccountId'];}else if(_0x44413c[_0x023a('0x4a')]['SmsAccountId']){_0x36df50['SmsAccountId']=_0x44413c[_0x023a('0x4a')][_0x023a('0x4d')];}else if(_0x44413c[_0x023a('0x4a')][_0x023a('0x4e')]){_0x36df50[_0x023a('0x4e')]=_0x44413c[_0x023a('0x4a')][_0x023a('0x4e')];}else if(_0x44413c['body']['ChatWebsiteId']){_0x36df50[_0x023a('0x4f')]=_0x44413c[_0x023a('0x4a')][_0x023a('0x4f')];}return db[_0x023a('0x2d')][_0x023a('0x48')]({'where':_0x36df50})[_0x023a('0x23')](function(_0x24a162){if(_0x24a162){throw new db[(_0x023a('0x50'))]['ValidationError'](_0x023a('0x51'));}return db['CannedAnswer'][_0x023a('0x4b')](_0x44413c[_0x023a('0x4a')]);})[_0x023a('0x23')](function(_0x5f3aac){var _0x2bd696=_0x44413c['user'][_0x023a('0x25')]({'plain':!![]});if(!_0x2bd696)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bd696[_0x023a('0x52')]===_0x023a('0x53')){var _0xa52dc3=_0x5f3aac['get']({'plain':!![]});return db['UserProfileSection'][_0x023a('0x48')]({'where':{'name':_0x023a('0x26'),'userProfileId':_0x2bd696[_0x023a('0x54')]},'raw':!![]})[_0x023a('0x23')](function(_0x3dec40){if(_0x3dec40&&_0x3dec40[_0x023a('0x55')]===0x0){return db[_0x023a('0x27')][_0x023a('0x4b')]({'name':_0xa52dc3[_0x023a('0x2a')],'resourceId':_0xa52dc3['id'],'type':_0x3dec40['name'],'sectionId':_0x3dec40['id']},{})['then'](function(){return _0x5f3aac;});}else{return _0x5f3aac;}})[_0x023a('0x45')](function(_0x46a92e){logger[_0x023a('0x28')](_0x023a('0x56'),_0x46a92e);throw _0x46a92e;});}return _0x5f3aac;})['then'](respondWithResult(_0xbbd81,0xc9))[_0x023a('0x45')](handleError(_0xbbd81,null));}; \ No newline at end of file +var _0x40fd=['moment','bluebird','util','sox','lodash','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','json','apply','reject','update','then','destroy','get','error','stack','name','send','CannedAnswer','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','rawAttributes','keys','body','find','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x40fd,0xee));var _0xd40f=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x40fd[_0x967959];return _0x5c4489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd40f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd40f('0x1'));var rp=require('request-promise');var moment=require(_0xd40f('0x2'));var BPromise=require(_0xd40f('0x3'));var Mustache=require('mustache');var util=require(_0xd40f('0x4'));var path=require('path');var sox=require(_0xd40f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd40f('0x6'));var squel=require(_0xd40f('0x7'));var crypto=require(_0xd40f('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd40f('0x9'));var querystring=require('querystring');var Papa=require(_0xd40f('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd40f('0xb'));var as=require(_0xd40f('0xc'));var hardwareService=require(_0xd40f('0xd'));var logger=require('../../config/logger')(_0xd40f('0xe'));var utils=require(_0xd40f('0xf'));var config=require(_0xd40f('0x10'));var licenseUtil=require(_0xd40f('0x11'));var db=require(_0xd40f('0x12'))['db'];function respondWithStatusCode(_0x21be08,_0x3b2ded){_0x3b2ded=_0x3b2ded||0xcc;return function(_0x274fc4){if(_0x274fc4){return _0x21be08[_0xd40f('0x13')](_0x3b2ded);}return _0x21be08['status'](_0x3b2ded)[_0xd40f('0x14')]();};}function respondWithResult(_0x29da90,_0x5d4420){_0x5d4420=_0x5d4420||0xc8;return function(_0x161b51){if(_0x161b51){return _0x29da90['status'](_0x5d4420)['json'](_0x161b51);}};}function respondWithFilteredResult(_0x40b061,_0x3cabc0){return function(_0x14dd44){if(_0x14dd44){var _0x3dacfb=typeof _0x3cabc0[_0xd40f('0x15')]===_0xd40f('0x16')&&typeof _0x3cabc0[_0xd40f('0x17')]==='undefined';var _0xfeb6eb=_0x14dd44[_0xd40f('0x18')];var _0xb1c056=_0x3dacfb?0x0:_0x3cabc0[_0xd40f('0x15')];var _0x3523b4=_0x3dacfb?_0x14dd44['count']:_0x3cabc0[_0xd40f('0x15')]+_0x3cabc0['limit'];var _0x416473;if(_0x3523b4>=_0xfeb6eb){_0x3523b4=_0xfeb6eb;_0x416473=0xc8;}else{_0x416473=0xce;}_0x40b061[_0xd40f('0x19')](_0x416473);return _0x40b061[_0xd40f('0x1a')]('Content-Range',_0xb1c056+'-'+_0x3523b4+'/'+_0xfeb6eb)[_0xd40f('0x1b')](_0x14dd44);}return null;};}function patchUpdates(_0x1dffc4){return function(_0x480e59){try{jsonpatch[_0xd40f('0x1c')](_0x480e59,_0x1dffc4,!![]);}catch(_0x32d940){return BPromise[_0xd40f('0x1d')](_0x32d940);}return _0x480e59['save']();};}function saveUpdates(_0x3bc96c,_0xc0b5f0){return function(_0x282927){if(_0x282927){return _0x282927[_0xd40f('0x1e')](_0x3bc96c)[_0xd40f('0x1f')](function(_0x34df8a){return _0x34df8a;});}return null;};}function removeEntity(_0x1f9888,_0x1b039c){return function(_0x461c07){if(_0x461c07){return _0x461c07[_0xd40f('0x20')]()[_0xd40f('0x1f')](function(){var _0x25cd76=_0x461c07[_0xd40f('0x21')]({'plain':!![]});var _0x5b36dc='CannedAnswers';return db['UserProfileResource']['destroy']({'where':{'type':_0x5b36dc,'resourceId':_0x25cd76['id']}})[_0xd40f('0x1f')](function(){return _0x461c07;});})['then'](function(){_0x1f9888['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e96e3,_0x5509d8){return function(_0x174ab9){if(!_0x174ab9){_0x4e96e3[_0xd40f('0x13')](0x194);}return _0x174ab9;};}function handleError(_0x378599,_0x53e00e){_0x53e00e=_0x53e00e||0x1f4;return function(_0xd269b7){logger[_0xd40f('0x22')](_0xd269b7[_0xd40f('0x23')]);if(_0xd269b7[_0xd40f('0x24')]){delete _0xd269b7['name'];}_0x378599[_0xd40f('0x19')](_0x53e00e)[_0xd40f('0x25')](_0xd269b7);};}exports['index']=function(_0x9b4c49,_0xbbbc2b){var _0x100fe7={},_0x14407e={},_0x198dbe={'count':0x0,'rows':[]};var _0x3ab59a=_['map'](db[_0xd40f('0x26')]['rawAttributes'],function(_0x45a794){return{'name':_0x45a794[_0xd40f('0x27')],'type':_0x45a794[_0xd40f('0x28')][_0xd40f('0x29')]};});_0x14407e[_0xd40f('0x2a')]=_[_0xd40f('0x2b')](_0x3ab59a,_0xd40f('0x24'));_0x14407e[_0xd40f('0x2c')]=_['keys'](_0x9b4c49[_0xd40f('0x2c')]);_0x14407e[_0xd40f('0x2d')]=_[_0xd40f('0x2e')](_0x14407e[_0xd40f('0x2a')],_0x14407e['query']);_0x100fe7[_0xd40f('0x2f')]=_['intersection'](_0x14407e[_0xd40f('0x2a')],qs['fields'](_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x30')]));_0x100fe7[_0xd40f('0x2f')]=_0x100fe7['attributes'][_0xd40f('0x31')]?_0x100fe7['attributes']:_0x14407e[_0xd40f('0x2a')];if(!_0x9b4c49['query'][_0xd40f('0x32')](_0xd40f('0x33'))){_0x100fe7[_0xd40f('0x17')]=qs[_0xd40f('0x17')](_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x17')]);_0x100fe7['offset']=qs[_0xd40f('0x15')](_0x9b4c49['query']['offset']);}_0x100fe7[_0xd40f('0x34')]=qs[_0xd40f('0x35')](_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x35')]);_0x100fe7[_0xd40f('0x36')]=qs[_0xd40f('0x2d')](_[_0xd40f('0x37')](_0x9b4c49[_0xd40f('0x2c')],_0x14407e['filters']),_0x3ab59a);if(_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x38')]){_0x100fe7['where']=_[_0xd40f('0x39')](_0x100fe7[_0xd40f('0x36')],{'$or':[{'key':{'$like':'%'+_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x38')]+'%'}},{'value':{'$like':'%'+_0x9b4c49[_0xd40f('0x2c')][_0xd40f('0x38')]+'%'}}]});}_0x100fe7=_[_0xd40f('0x39')]({},_0x100fe7,_0x9b4c49[_0xd40f('0x3a')]);var _0x379cbb={'where':_0x100fe7[_0xd40f('0x36')]};return db[_0xd40f('0x26')]['count'](_0x379cbb)[_0xd40f('0x1f')](function(_0x427ce0){_0x198dbe[_0xd40f('0x18')]=_0x427ce0;if(_0x9b4c49['query']['includeAll']){_0x100fe7[_0xd40f('0x3b')]=[{'all':!![]}];}return db[_0xd40f('0x26')]['findAll'](_0x100fe7);})[_0xd40f('0x1f')](function(_0x45fd45){_0x198dbe[_0xd40f('0x3c')]=_0x45fd45;return _0x198dbe;})['then'](respondWithFilteredResult(_0xbbbc2b,_0x100fe7))[_0xd40f('0x3d')](handleError(_0xbbbc2b,null));};exports['show']=function(_0x39826e,_0x5c4d51){var _0x21a47f={'raw':!![],'where':{'id':_0x39826e['params']['id']}},_0x44b78f={};_0x44b78f[_0xd40f('0x2a')]=_['keys'](db['CannedAnswer'][_0xd40f('0x3e')]);_0x44b78f[_0xd40f('0x2c')]=_[_0xd40f('0x3f')](_0x39826e[_0xd40f('0x2c')]);_0x44b78f[_0xd40f('0x2d')]=_[_0xd40f('0x2e')](_0x44b78f[_0xd40f('0x2a')],_0x44b78f['query']);_0x21a47f[_0xd40f('0x2f')]=_[_0xd40f('0x2e')](_0x44b78f['model'],qs[_0xd40f('0x30')](_0x39826e[_0xd40f('0x2c')][_0xd40f('0x30')]));_0x21a47f[_0xd40f('0x2f')]=_0x21a47f[_0xd40f('0x2f')]['length']?_0x21a47f[_0xd40f('0x2f')]:_0x44b78f[_0xd40f('0x2a')];if(_0x39826e[_0xd40f('0x2c')]['includeAll']){_0x21a47f[_0xd40f('0x3b')]=[{'all':!![]}];}_0x21a47f=_[_0xd40f('0x39')]({},_0x21a47f,_0x39826e['options']);return db[_0xd40f('0x26')]['find'](_0x21a47f)['then'](handleEntityNotFound(_0x5c4d51,null))[_0xd40f('0x1f')](respondWithResult(_0x5c4d51,null))[_0xd40f('0x3d')](handleError(_0x5c4d51,null));};exports['update']=function(_0x52609a,_0x5e897e){if(_0x52609a[_0xd40f('0x40')]['id']){delete _0x52609a[_0xd40f('0x40')]['id'];}return db[_0xd40f('0x26')][_0xd40f('0x41')]({'where':{'id':_0x52609a[_0xd40f('0x42')]['id']}})['then'](handleEntityNotFound(_0x5e897e,null))['then'](saveUpdates(_0x52609a[_0xd40f('0x40')],null))['then'](respondWithResult(_0x5e897e,null))['catch'](handleError(_0x5e897e,null));};exports[_0xd40f('0x20')]=function(_0x5b2207,_0x34bfdc){return db[_0xd40f('0x26')]['find']({'where':{'id':_0x5b2207[_0xd40f('0x42')]['id']}})[_0xd40f('0x1f')](handleEntityNotFound(_0x34bfdc,null))['then'](removeEntity(_0x34bfdc,null))[_0xd40f('0x3d')](handleError(_0x34bfdc,null));};exports['create']=function(_0x1b3308,_0x1f260f){var _0x1bbae3={'key':_0x1b3308['body']['key']};if(_0x1b3308['body'][_0xd40f('0x43')]){_0x1bbae3[_0xd40f('0x43')]=_0x1b3308['body'][_0xd40f('0x43')];}else if(_0x1b3308['body'][_0xd40f('0x44')]){_0x1bbae3['SmsAccountId']=_0x1b3308[_0xd40f('0x40')][_0xd40f('0x44')];}else if(_0x1b3308['body'][_0xd40f('0x45')]){_0x1bbae3['OpenchannelAccountId']=_0x1b3308[_0xd40f('0x40')][_0xd40f('0x45')];}else if(_0x1b3308[_0xd40f('0x40')][_0xd40f('0x46')]){_0x1bbae3[_0xd40f('0x46')]=_0x1b3308[_0xd40f('0x40')]['ChatWebsiteId'];}return db['CannedAnswer'][_0xd40f('0x41')]({'where':_0x1bbae3})[_0xd40f('0x1f')](function(_0x45256c){if(_0x45256c){throw new db[(_0xd40f('0x47'))][(_0xd40f('0x48'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xd40f('0x26')]['create'](_0x1b3308[_0xd40f('0x40')]);})[_0xd40f('0x1f')](function(_0x545ce7){var _0x5a77c9=_0x1b3308[_0xd40f('0x49')][_0xd40f('0x21')]({'plain':!![]});if(!_0x5a77c9)throw new Error(_0xd40f('0x4a'));if(_0x5a77c9['role']===_0xd40f('0x49')){var _0x5d48be=_0x545ce7['get']({'plain':!![]});return db[_0xd40f('0x4b')][_0xd40f('0x41')]({'where':{'name':_0xd40f('0x4c'),'userProfileId':_0x5a77c9[_0xd40f('0x4d')]},'raw':!![]})[_0xd40f('0x1f')](function(_0x2fbda7){if(_0x2fbda7&&_0x2fbda7['autoAssociation']===0x0){return db[_0xd40f('0x4e')]['create']({'name':_0x5d48be[_0xd40f('0x24')],'resourceId':_0x5d48be['id'],'type':_0x2fbda7['name'],'sectionId':_0x2fbda7['id']},{})[_0xd40f('0x1f')](function(){return _0x545ce7;});}else{return _0x545ce7;}})[_0xd40f('0x3d')](function(_0x328ce2){logger[_0xd40f('0x22')](_0xd40f('0x4f'),_0x328ce2);throw _0x328ce2;});}return _0x545ce7;})[_0xd40f('0x1f')](respondWithResult(_0x1f260f,0xc9))[_0xd40f('0x3d')](handleError(_0x1f260f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 39b0444..fb3ac0a 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 _0xb19d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2ab731,_0xff00ef){var _0xe6fbcf=function(_0x931811){while(--_0x931811){_0x2ab731['push'](_0x2ab731['shift']());}};_0xe6fbcf(++_0xff00ef);}(_0xb19d,0x8b));var _0xdb19=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0xb19d[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0xdb19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdb19('0x1'));var moment=require(_0xdb19('0x2'));var BPromise=require(_0xdb19('0x3'));var rp=require(_0xdb19('0x4'));var fs=require('fs');var path=require(_0xdb19('0x5'));var rimraf=require(_0xdb19('0x6'));var config=require(_0xdb19('0x7'));var attributes=require(_0xdb19('0x8'));module[_0xdb19('0x9')]=function(_0x54124f,_0x3d32ce){return _0x54124f['define'](_0xdb19('0xa'),attributes,{'tableName':_0xdb19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb19('0xc'),'collate':_0xdb19('0xd')});}; \ No newline at end of file +var _0xec98=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0xea3411,_0xc14d0d){var _0x3cdc89=function(_0x4f6b52){while(--_0x4f6b52){_0xea3411['push'](_0xea3411['shift']());}};_0x3cdc89(++_0xc14d0d);}(_0xec98,0x84));var _0x8ec9=function(_0x4b6dc5,_0x2bbc50){_0x4b6dc5=_0x4b6dc5-0x0;var _0x529c0a=_0xec98[_0x4b6dc5];return _0x529c0a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ec9('0x0'))(_0x8ec9('0x1'));var moment=require(_0x8ec9('0x2'));var BPromise=require(_0x8ec9('0x3'));var rp=require(_0x8ec9('0x4'));var fs=require('fs');var path=require(_0x8ec9('0x5'));var rimraf=require(_0x8ec9('0x6'));var config=require(_0x8ec9('0x7'));var attributes=require(_0x8ec9('0x8'));module[_0x8ec9('0x9')]=function(_0x347168,_0x5619b0){return _0x347168[_0x8ec9('0xa')](_0x8ec9('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 093ffcc..2cb182c 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(_0x389147,_0x47145d){var _0xbdfea2=function(_0x320dc9){while(--_0x320dc9){_0x389147['push'](_0x389147['shift']());}};_0xbdfea2(++_0x47145d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x2b5fdb,_0x24aac1){var _0x17cfa4=function(_0x3021df){while(--_0x3021df){_0x2b5fdb['push'](_0x2b5fdb['shift']());}};_0x17cfa4(++_0x24aac1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 6f28875..303b492 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 _0x8f78=['put','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create'];(function(_0x57cc06,_0x25b1c7){var _0x1a35f6=function(_0x3ff448){while(--_0x3ff448){_0x57cc06['push'](_0x57cc06['shift']());}};_0x1a35f6(++_0x25b1c7);}(_0x8f78,0x6f));var _0x88f7=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f78[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x88f7('0x0'));var path=require(_0x88f7('0x1'));var timeout=require(_0x88f7('0x2'));var express=require(_0x88f7('0x3'));var router=express[_0x88f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x88f7('0x5'));var interaction=require(_0x88f7('0x6'));var config=require(_0x88f7('0x7'));var controller=require(_0x88f7('0x8'));router[_0x88f7('0x9')]('/',auth[_0x88f7('0xa')](),controller[_0x88f7('0xb')]);router[_0x88f7('0x9')]('/:id',auth[_0x88f7('0xa')](),controller[_0x88f7('0xc')]);router[_0x88f7('0xd')]('/',auth['isAuthenticated'](),controller[_0x88f7('0xe')]);router[_0x88f7('0xf')]('/:id',auth[_0x88f7('0xa')](),controller['update']);router['delete'](_0x88f7('0x10'),auth[_0x88f7('0xa')](),controller[_0x88f7('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0396=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','index','get','/:id','show','post','put','destroy','multer','util'];(function(_0x36beb4,_0x36ea3a){var _0x16bbeb=function(_0x4e4db7){while(--_0x4e4db7){_0x36beb4['push'](_0x36beb4['shift']());}};_0x16bbeb(++_0x36ea3a);}(_0x0396,0x10e));var _0x6039=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0396[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var path=require('path');var timeout=require(_0x6039('0x2'));var express=require(_0x6039('0x3'));var router=express[_0x6039('0x4')]();var fs_extra=require(_0x6039('0x5'));var auth=require(_0x6039('0x6'));var interaction=require(_0x6039('0x7'));var config=require('../../config/environment');var controller=require(_0x6039('0x8'));router['get']('/',auth[_0x6039('0x9')](),controller[_0x6039('0xa')]);router[_0x6039('0xb')](_0x6039('0xc'),auth[_0x6039('0x9')](),controller[_0x6039('0xd')]);router[_0x6039('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6039('0xf')](_0x6039('0xc'),auth[_0x6039('0x9')](),controller['update']);router['delete'](_0x6039('0xc'),auth[_0x6039('0x9')](),controller[_0x6039('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 91db337..b9a0814 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 _0xc68d=['STRING','INTEGER','exports','DATE'];(function(_0x29dc54,_0x2cc32e){var _0xaabea6=function(_0x172357){while(--_0x172357){_0x29dc54['push'](_0x29dc54['shift']());}};_0xaabea6(++_0x2cc32e);}(_0xc68d,0x17a));var _0xdc68=function(_0x3d51f8,_0x1d86e1){_0x3d51f8=_0x3d51f8-0x0;var _0x4fd7d1=_0xc68d[_0x3d51f8];return _0x4fd7d1;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'calldate':{'type':Sequelize[_0xdc68('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xdc68('0x2')]},'dst':{'type':Sequelize[_0xdc68('0x2')]},'dcontext':{'type':Sequelize[_0xdc68('0x2')]},'channel':{'type':Sequelize[_0xdc68('0x2')]},'dstchannel':{'type':Sequelize[_0xdc68('0x2')]},'lastapp':{'type':Sequelize[_0xdc68('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdc68('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdc68('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdc68('0x2')]},'userfield':{'type':Sequelize[_0xdc68('0x2')]},'uniqueid':{'type':Sequelize[_0xdc68('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdc68('0x2')]},'type':{'type':Sequelize[_0xdc68('0x2')]},'tag':{'type':Sequelize[_0xdc68('0x2')]}}; \ No newline at end of file +var _0xe07b=['INTEGER','sequelize','STRING'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0xe07b,0x181));var _0xbe07=function(_0x40895a,_0x5f3f54){_0x40895a=_0x40895a-0x0;var _0x89871d=_0xe07b[_0x40895a];return _0x89871d;};'use strict';var Sequelize=require(_0xbe07('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xbe07('0x1')]},'src':{'type':Sequelize[_0xbe07('0x1')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xbe07('0x1')]},'channel':{'type':Sequelize[_0xbe07('0x1')]},'dstchannel':{'type':Sequelize[_0xbe07('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xbe07('0x1')]},'duration':{'type':Sequelize[_0xbe07('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xbe07('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbe07('0x1')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xbe07('0x1')]},'uniqueid':{'type':Sequelize[_0xbe07('0x1')]},'linkedid':{'type':Sequelize[_0xbe07('0x1')]},'sequence':{'type':Sequelize[_0xbe07('0x1')]},'peeraccount':{'type':Sequelize[_0xbe07('0x1')]},'type':{'type':Sequelize[_0xbe07('0x1')]},'tag':{'type':Sequelize[_0xbe07('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d5a2cae..20444cd 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 _0xe107=['Cdr','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x214c08,_0x2e903a){var _0x67963a=function(_0x30334c){while(--_0x30334c){_0x214c08['push'](_0x214c08['shift']());}};_0x67963a(++_0x2e903a);}(_0xe107,0xb3));var _0x7e10=function(_0x179168,_0x8f4f27){_0x179168=_0x179168-0x0;var _0x4f0260=_0xe107[_0x179168];return _0x4f0260;};'use strict';var emlformat=require(_0x7e10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e10('0x1'));var jsonpatch=require(_0x7e10('0x2'));var rp=require(_0x7e10('0x3'));var moment=require('moment');var BPromise=require(_0x7e10('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e10('0x5'));var sox=require(_0x7e10('0x6'));var csv=require(_0x7e10('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e10('0x8'));var squel=require(_0x7e10('0x9'));var crypto=require(_0x7e10('0xa'));var jsforce=require(_0x7e10('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e10('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e10('0xd'));var qs=require(_0x7e10('0xe'));var as=require(_0x7e10('0xf'));var hardwareService=require(_0x7e10('0x10'));var logger=require(_0x7e10('0x11'))('api');var utils=require(_0x7e10('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7e10('0x13'));var db=require(_0x7e10('0x14'))['db'];function respondWithStatusCode(_0x2f4d72,_0x5434dd){_0x5434dd=_0x5434dd||0xcc;return function(_0xc2e42b){if(_0xc2e42b){return _0x2f4d72[_0x7e10('0x15')](_0x5434dd);}return _0x2f4d72[_0x7e10('0x16')](_0x5434dd)[_0x7e10('0x17')]();};}function respondWithResult(_0x119ff5,_0x1b4d9d){_0x1b4d9d=_0x1b4d9d||0xc8;return function(_0x1c2b22){if(_0x1c2b22){return _0x119ff5[_0x7e10('0x16')](_0x1b4d9d)['json'](_0x1c2b22);}};}function respondWithFilteredResult(_0x15e9e5,_0x433221){return function(_0x4bd78a){if(_0x4bd78a){var _0x48339f=typeof _0x433221[_0x7e10('0x18')]==='undefined'&&typeof _0x433221[_0x7e10('0x19')]===_0x7e10('0x1a');var _0xdbda1a=_0x4bd78a[_0x7e10('0x1b')];var _0x4fd639=_0x48339f?0x0:_0x433221[_0x7e10('0x18')];var _0x2b4850=_0x48339f?_0x4bd78a[_0x7e10('0x1b')]:_0x433221['offset']+_0x433221[_0x7e10('0x19')];var _0x36149a;if(_0x2b4850>=_0xdbda1a){_0x2b4850=_0xdbda1a;_0x36149a=0xc8;}else{_0x36149a=0xce;}_0x15e9e5[_0x7e10('0x16')](_0x36149a);return _0x15e9e5[_0x7e10('0x1c')](_0x7e10('0x1d'),_0x4fd639+'-'+_0x2b4850+'/'+_0xdbda1a)['json'](_0x4bd78a);}return null;};}function patchUpdates(_0x45a0cb){return function(_0x2c6227){try{jsonpatch['apply'](_0x2c6227,_0x45a0cb,!![]);}catch(_0x3c5629){return BPromise[_0x7e10('0x1e')](_0x3c5629);}return _0x2c6227[_0x7e10('0x1f')]();};}function saveUpdates(_0x482faa,_0x4a667b){return function(_0x415cb7){if(_0x415cb7){return _0x415cb7[_0x7e10('0x20')](_0x482faa)[_0x7e10('0x21')](function(_0x1c72df){return _0x1c72df;});}return null;};}function removeEntity(_0x35e7c9,_0x105a55){return function(_0x12c36d){if(_0x12c36d){return _0x12c36d[_0x7e10('0x22')]()['then'](function(){_0x35e7c9['status'](0xcc)[_0x7e10('0x17')]();});}};}function handleEntityNotFound(_0xe34c1e,_0x1bfe8a){return function(_0x13eeb3){if(!_0x13eeb3){_0xe34c1e['sendStatus'](0x194);}return _0x13eeb3;};}function handleError(_0x537365,_0x116446){_0x116446=_0x116446||0x1f4;return function(_0x12ba1b){logger[_0x7e10('0x23')](_0x12ba1b[_0x7e10('0x24')]);if(_0x12ba1b[_0x7e10('0x25')]){delete _0x12ba1b[_0x7e10('0x25')];}_0x537365[_0x7e10('0x16')](_0x116446)[_0x7e10('0x26')](_0x12ba1b);};}exports[_0x7e10('0x27')]=function(_0x3b020c,_0x5691f8){var _0x4e225d={},_0xbc509={},_0x884343={'count':0x0,'rows':[]};var _0x560460=_['map'](db[_0x7e10('0x28')][_0x7e10('0x29')],function(_0x537587){return{'name':_0x537587[_0x7e10('0x2a')],'type':_0x537587['type'][_0x7e10('0x2b')]};});_0xbc509[_0x7e10('0x2c')]=_[_0x7e10('0x2d')](_0x560460,_0x7e10('0x25'));_0xbc509[_0x7e10('0x2e')]=_[_0x7e10('0x2f')](_0x3b020c['query']);_0xbc509[_0x7e10('0x30')]=_['intersection'](_0xbc509[_0x7e10('0x2c')],_0xbc509[_0x7e10('0x2e')]);_0x4e225d[_0x7e10('0x31')]=_[_0x7e10('0x32')](_0xbc509[_0x7e10('0x2c')],qs[_0x7e10('0x33')](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x33')]));_0x4e225d[_0x7e10('0x31')]=_0x4e225d['attributes'][_0x7e10('0x34')]?_0x4e225d[_0x7e10('0x31')]:_0xbc509[_0x7e10('0x2c')];if(!_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x35')]('nolimit')){_0x4e225d[_0x7e10('0x19')]=qs[_0x7e10('0x19')](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x19')]);_0x4e225d['offset']=qs['offset'](_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x18')]);}_0x4e225d[_0x7e10('0x36')]=qs[_0x7e10('0x37')](_0x3b020c['query'][_0x7e10('0x37')]);_0x4e225d[_0x7e10('0x38')]=qs['filters'](_[_0x7e10('0x39')](_0x3b020c[_0x7e10('0x2e')],_0xbc509['filters']),_0x560460);if(_0x3b020c['query']['filter']){_0x4e225d[_0x7e10('0x38')]=_[_0x7e10('0x3a')](_0x4e225d[_0x7e10('0x38')],{'$or':_[_0x7e10('0x2d')](_0x560460,function(_0xd696d2){if(_0xd696d2[_0x7e10('0x3b')]!==_0x7e10('0x3c')){var _0x419085={};_0x419085[_0xd696d2['name']]={'$like':'%'+_0x3b020c[_0x7e10('0x2e')][_0x7e10('0x3d')]+'%'};return _0x419085;}})});}_0x4e225d=_[_0x7e10('0x3a')]({},_0x4e225d,_0x3b020c[_0x7e10('0x3e')]);var _0x4ebf4a={'where':_0x4e225d[_0x7e10('0x38')]};return db[_0x7e10('0x28')][_0x7e10('0x1b')](_0x4ebf4a)[_0x7e10('0x21')](function(_0x3ad2f0){_0x884343[_0x7e10('0x1b')]=_0x3ad2f0;if(_0x3b020c[_0x7e10('0x2e')]['includeAll']){_0x4e225d[_0x7e10('0x3f')]=[{'all':!![]}];}return db[_0x7e10('0x28')]['findAll'](_0x4e225d);})[_0x7e10('0x21')](function(_0x5c62ac){_0x884343[_0x7e10('0x40')]=_0x5c62ac;return _0x884343;})['then'](respondWithFilteredResult(_0x5691f8,_0x4e225d))[_0x7e10('0x41')](handleError(_0x5691f8,null));};exports[_0x7e10('0x42')]=function(_0x1940ff,_0x18e9b2){var _0x3c6a01={'raw':!![],'where':{'id':_0x1940ff[_0x7e10('0x43')]['id']}},_0x4c2946={};_0x4c2946[_0x7e10('0x2c')]=_[_0x7e10('0x2f')](db[_0x7e10('0x28')][_0x7e10('0x29')]);_0x4c2946['query']=_[_0x7e10('0x2f')](_0x1940ff[_0x7e10('0x2e')]);_0x4c2946['filters']=_['intersection'](_0x4c2946[_0x7e10('0x2c')],_0x4c2946[_0x7e10('0x2e')]);_0x3c6a01['attributes']=_[_0x7e10('0x32')](_0x4c2946['model'],qs[_0x7e10('0x33')](_0x1940ff['query'][_0x7e10('0x33')]));_0x3c6a01[_0x7e10('0x31')]=_0x3c6a01['attributes']['length']?_0x3c6a01['attributes']:_0x4c2946['model'];if(_0x1940ff['query'][_0x7e10('0x44')]){_0x3c6a01[_0x7e10('0x3f')]=[{'all':!![]}];}_0x3c6a01=_[_0x7e10('0x3a')]({},_0x3c6a01,_0x1940ff[_0x7e10('0x3e')]);return db[_0x7e10('0x28')]['find'](_0x3c6a01)[_0x7e10('0x21')](handleEntityNotFound(_0x18e9b2,null))['then'](respondWithResult(_0x18e9b2,null))[_0x7e10('0x41')](handleError(_0x18e9b2,null));};exports[_0x7e10('0x45')]=function(_0x43745a,_0x290f9c){return db['Cdr']['create'](_0x43745a[_0x7e10('0x46')],{})[_0x7e10('0x21')](respondWithResult(_0x290f9c,0xc9))['catch'](handleError(_0x290f9c,null));};exports['update']=function(_0x2ceaec,_0x3f0a05){if(_0x2ceaec[_0x7e10('0x46')]['id']){delete _0x2ceaec[_0x7e10('0x46')]['id'];}return db[_0x7e10('0x28')][_0x7e10('0x47')]({'where':{'id':_0x2ceaec[_0x7e10('0x43')]['id']}})[_0x7e10('0x21')](handleEntityNotFound(_0x3f0a05,null))['then'](saveUpdates(_0x2ceaec[_0x7e10('0x46')],null))['then'](respondWithResult(_0x3f0a05,null))[_0x7e10('0x41')](handleError(_0x3f0a05,null));};exports[_0x7e10('0x22')]=function(_0x29bd0d,_0x4fec7f){return db['Cdr'][_0x7e10('0x47')]({'where':{'id':_0x29bd0d[_0x7e10('0x43')]['id']}})[_0x7e10('0x21')](handleEntityNotFound(_0x4fec7f,null))[_0x7e10('0x21')](removeEntity(_0x4fec7f,null))[_0x7e10('0x41')](handleError(_0x4fec7f,null));};exports['describe']=function(_0x39c23d,_0x498ebf){return db['Cdr'][_0x7e10('0x48')]()[_0x7e10('0x21')](respondWithResult(_0x498ebf,null))['catch'](handleError(_0x498ebf,null));}; \ No newline at end of file +var _0x29d4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','intersection','find','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x3e4e6b,_0x5da600){var _0x1427ec=function(_0x15ab01){while(--_0x15ab01){_0x3e4e6b['push'](_0x3e4e6b['shift']());}};_0x1427ec(++_0x5da600);}(_0x29d4,0x1a1));var _0x429d=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x29d4[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x429d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x429d('0x1'));var jsonpatch=require(_0x429d('0x2'));var rp=require(_0x429d('0x3'));var moment=require(_0x429d('0x4'));var BPromise=require(_0x429d('0x5'));var Mustache=require('mustache');var util=require(_0x429d('0x6'));var path=require(_0x429d('0x7'));var sox=require(_0x429d('0x8'));var csv=require(_0x429d('0x9'));var ejs=require(_0x429d('0xa'));var fs=require('fs');var fs_extra=require(_0x429d('0xb'));var _=require(_0x429d('0xc'));var squel=require(_0x429d('0xd'));var crypto=require('crypto');var jsforce=require(_0x429d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x429d('0x9'));var querystring=require(_0x429d('0xf'));var Papa=require(_0x429d('0x10'));var Redis=require('ioredis');var authService=require(_0x429d('0x11'));var qs=require(_0x429d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429d('0x13'));var logger=require(_0x429d('0x14'))(_0x429d('0x15'));var utils=require('../../config/utils');var config=require(_0x429d('0x16'));var licenseUtil=require(_0x429d('0x17'));var db=require(_0x429d('0x18'))['db'];function respondWithStatusCode(_0x1cb1cf,_0x4843af){_0x4843af=_0x4843af||0xcc;return function(_0x1c542c){if(_0x1c542c){return _0x1cb1cf[_0x429d('0x19')](_0x4843af);}return _0x1cb1cf[_0x429d('0x1a')](_0x4843af)['end']();};}function respondWithResult(_0x315d8d,_0x5dc247){_0x5dc247=_0x5dc247||0xc8;return function(_0x5c32ab){if(_0x5c32ab){return _0x315d8d[_0x429d('0x1a')](_0x5dc247)[_0x429d('0x1b')](_0x5c32ab);}};}function respondWithFilteredResult(_0x1bfbdb,_0x2ee97b){return function(_0x8c8a15){if(_0x8c8a15){var _0x2363a0=typeof _0x2ee97b['offset']===_0x429d('0x1c')&&typeof _0x2ee97b['limit']===_0x429d('0x1c');var _0x35830e=_0x8c8a15[_0x429d('0x1d')];var _0x2dc57a=_0x2363a0?0x0:_0x2ee97b['offset'];var _0x240a7d=_0x2363a0?_0x8c8a15[_0x429d('0x1d')]:_0x2ee97b[_0x429d('0x1e')]+_0x2ee97b['limit'];var _0x329d67;if(_0x240a7d>=_0x35830e){_0x240a7d=_0x35830e;_0x329d67=0xc8;}else{_0x329d67=0xce;}_0x1bfbdb[_0x429d('0x1a')](_0x329d67);return _0x1bfbdb[_0x429d('0x1f')](_0x429d('0x20'),_0x2dc57a+'-'+_0x240a7d+'/'+_0x35830e)[_0x429d('0x1b')](_0x8c8a15);}return null;};}function patchUpdates(_0x4534bd){return function(_0x5a4093){try{jsonpatch[_0x429d('0x21')](_0x5a4093,_0x4534bd,!![]);}catch(_0x165e4d){return BPromise[_0x429d('0x22')](_0x165e4d);}return _0x5a4093['save']();};}function saveUpdates(_0x1492f1,_0x13fc71){return function(_0x452572){if(_0x452572){return _0x452572[_0x429d('0x23')](_0x1492f1)[_0x429d('0x24')](function(_0x1023e6){return _0x1023e6;});}return null;};}function removeEntity(_0x4c6d89,_0x28f84e){return function(_0x3a9a75){if(_0x3a9a75){return _0x3a9a75['destroy']()[_0x429d('0x24')](function(){_0x4c6d89[_0x429d('0x1a')](0xcc)[_0x429d('0x25')]();});}};}function handleEntityNotFound(_0x11c423,_0x5d2e06){return function(_0x3b12f6){if(!_0x3b12f6){_0x11c423[_0x429d('0x19')](0x194);}return _0x3b12f6;};}function handleError(_0x387639,_0x3896ee){_0x3896ee=_0x3896ee||0x1f4;return function(_0x3e4e73){logger['error'](_0x3e4e73[_0x429d('0x26')]);if(_0x3e4e73[_0x429d('0x27')]){delete _0x3e4e73[_0x429d('0x27')];}_0x387639[_0x429d('0x1a')](_0x3896ee)[_0x429d('0x28')](_0x3e4e73);};}exports[_0x429d('0x29')]=function(_0x2351c9,_0xdc7bf9){var _0x2ceb54={},_0x50ef02={},_0x31cae6={'count':0x0,'rows':[]};var _0x3ca640=_['map'](db[_0x429d('0x2a')][_0x429d('0x2b')],function(_0x2e95b5){return{'name':_0x2e95b5[_0x429d('0x2c')],'type':_0x2e95b5[_0x429d('0x2d')]['key']};});_0x50ef02[_0x429d('0x2e')]=_[_0x429d('0x2f')](_0x3ca640,_0x429d('0x27'));_0x50ef02[_0x429d('0x30')]=_[_0x429d('0x31')](_0x2351c9[_0x429d('0x30')]);_0x50ef02['filters']=_['intersection'](_0x50ef02[_0x429d('0x2e')],_0x50ef02[_0x429d('0x30')]);_0x2ceb54['attributes']=_['intersection'](_0x50ef02[_0x429d('0x2e')],qs['fields'](_0x2351c9[_0x429d('0x30')][_0x429d('0x32')]));_0x2ceb54[_0x429d('0x33')]=_0x2ceb54[_0x429d('0x33')]['length']?_0x2ceb54[_0x429d('0x33')]:_0x50ef02[_0x429d('0x2e')];if(!_0x2351c9['query']['hasOwnProperty']('nolimit')){_0x2ceb54['limit']=qs['limit'](_0x2351c9[_0x429d('0x30')]['limit']);_0x2ceb54['offset']=qs[_0x429d('0x1e')](_0x2351c9[_0x429d('0x30')][_0x429d('0x1e')]);}_0x2ceb54[_0x429d('0x34')]=qs[_0x429d('0x35')](_0x2351c9[_0x429d('0x30')]['sort']);_0x2ceb54[_0x429d('0x36')]=qs[_0x429d('0x37')](_[_0x429d('0x38')](_0x2351c9[_0x429d('0x30')],_0x50ef02[_0x429d('0x37')]),_0x3ca640);if(_0x2351c9[_0x429d('0x30')][_0x429d('0x39')]){_0x2ceb54[_0x429d('0x36')]=_[_0x429d('0x3a')](_0x2ceb54[_0x429d('0x36')],{'$or':_[_0x429d('0x2f')](_0x3ca640,function(_0x1e3924){if(_0x1e3924[_0x429d('0x2d')]!==_0x429d('0x3b')){var _0x1a80bc={};_0x1a80bc[_0x1e3924[_0x429d('0x27')]]={'$like':'%'+_0x2351c9['query']['filter']+'%'};return _0x1a80bc;}})});}_0x2ceb54=_[_0x429d('0x3a')]({},_0x2ceb54,_0x2351c9[_0x429d('0x3c')]);var _0x569811={'where':_0x2ceb54[_0x429d('0x36')]};return db[_0x429d('0x2a')][_0x429d('0x1d')](_0x569811)['then'](function(_0x50a907){_0x31cae6[_0x429d('0x1d')]=_0x50a907;if(_0x2351c9[_0x429d('0x30')]['includeAll']){_0x2ceb54[_0x429d('0x3d')]=[{'all':!![]}];}return db[_0x429d('0x2a')]['findAll'](_0x2ceb54);})[_0x429d('0x24')](function(_0x5182d3){_0x31cae6[_0x429d('0x3e')]=_0x5182d3;return _0x31cae6;})[_0x429d('0x24')](respondWithFilteredResult(_0xdc7bf9,_0x2ceb54))[_0x429d('0x3f')](handleError(_0xdc7bf9,null));};exports[_0x429d('0x40')]=function(_0x4da740,_0x34a79c){var _0x38b40c={'raw':!![],'where':{'id':_0x4da740['params']['id']}},_0x2a97c1={};_0x2a97c1['model']=_[_0x429d('0x31')](db[_0x429d('0x2a')][_0x429d('0x2b')]);_0x2a97c1[_0x429d('0x30')]=_['keys'](_0x4da740[_0x429d('0x30')]);_0x2a97c1[_0x429d('0x37')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],_0x2a97c1[_0x429d('0x30')]);_0x38b40c[_0x429d('0x33')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],qs[_0x429d('0x32')](_0x4da740[_0x429d('0x30')]['fields']));_0x38b40c[_0x429d('0x33')]=_0x38b40c['attributes']['length']?_0x38b40c['attributes']:_0x2a97c1[_0x429d('0x2e')];if(_0x4da740[_0x429d('0x30')]['includeAll']){_0x38b40c[_0x429d('0x3d')]=[{'all':!![]}];}_0x38b40c=_[_0x429d('0x3a')]({},_0x38b40c,_0x4da740['options']);return db[_0x429d('0x2a')][_0x429d('0x42')](_0x38b40c)[_0x429d('0x24')](handleEntityNotFound(_0x34a79c,null))[_0x429d('0x24')](respondWithResult(_0x34a79c,null))[_0x429d('0x3f')](handleError(_0x34a79c,null));};exports['create']=function(_0x29c7a2,_0xd9451b){return db[_0x429d('0x2a')][_0x429d('0x43')](_0x29c7a2['body'],{})[_0x429d('0x24')](respondWithResult(_0xd9451b,0xc9))[_0x429d('0x3f')](handleError(_0xd9451b,null));};exports[_0x429d('0x23')]=function(_0x58b6c7,_0x471ba5){if(_0x58b6c7['body']['id']){delete _0x58b6c7[_0x429d('0x44')]['id'];}return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x58b6c7['params']['id']}})['then'](handleEntityNotFound(_0x471ba5,null))[_0x429d('0x24')](saveUpdates(_0x58b6c7['body'],null))[_0x429d('0x24')](respondWithResult(_0x471ba5,null))[_0x429d('0x3f')](handleError(_0x471ba5,null));};exports[_0x429d('0x45')]=function(_0x25121e,_0x31d1e7){return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x25121e[_0x429d('0x46')]['id']}})['then'](handleEntityNotFound(_0x31d1e7,null))['then'](removeEntity(_0x31d1e7,null))[_0x429d('0x3f')](handleError(_0x31d1e7,null));};exports[_0x429d('0x47')]=function(_0x18f172,_0x3a15d1){return db['Cdr'][_0x429d('0x47')]()[_0x429d('0x24')](respondWithResult(_0x3a15d1,null))[_0x429d('0x3f')](handleError(_0x3a15d1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e1565f6..19c7e9e 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x48c100,_0x566f57){var _0x34dc16=function(_0x3133a7){while(--_0x3133a7){_0x48c100['push'](_0x48c100['shift']());}};_0x34dc16(++_0x566f57);}(_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 +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x361f10,_0x50a3a8){var _0x101ded=function(_0x347132){while(--_0x347132){_0x361f10['push'](_0x361f10['shift']());}};_0x101ded(++_0x50a3a8);}(_0x7a54,0x106));var _0x47a5=function(_0x3c2f4c,_0x15425e){_0x3c2f4c=_0x3c2f4c-0x0;var _0x4e1092=_0x7a54[_0x3c2f4c];return _0x4e1092;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 33672db..a63a9b0 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 _0x3ada=['client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x3ada,0x1c6));var _0xa3ad=function(_0x50687e,_0x5c2c7f){_0x50687e=_0x50687e-0x0;var _0x90fdca=_0x3ada[_0x50687e];return _0x90fdca;};'use strict';var _=require(_0xa3ad('0x0'));var util=require(_0xa3ad('0x1'));var moment=require(_0xa3ad('0x2'));var BPromise=require(_0xa3ad('0x3'));var rs=require(_0xa3ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ad('0x5'))['db'];var utils=require(_0xa3ad('0x6'));var logger=require(_0xa3ad('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3ad('0x8')][_0xa3ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12c6e5,_0x2d71f0,_0x4ef152){return new BPromise(function(_0x50313b,_0x4a118c){return client[_0xa3ad('0xa')](_0x12c6e5,_0x4ef152)[_0xa3ad('0xb')](function(_0x5dd4fe){logger[_0xa3ad('0xc')](_0xa3ad('0xd'),_0x2d71f0,_0xa3ad('0xe'));logger[_0xa3ad('0xf')](_0xa3ad('0x10'),_0x2d71f0,_0xa3ad('0xe'),JSON['stringify'](_0x5dd4fe));if(_0x5dd4fe[_0xa3ad('0x11')]){if(_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x12')]===0x1f4){logger[_0xa3ad('0x11')](_0xa3ad('0xd'),_0x2d71f0,_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x13')]);return _0x4a118c(_0x5dd4fe[_0xa3ad('0x11')]['message']);}logger[_0xa3ad('0x11')](_0xa3ad('0xd'),_0x2d71f0,_0x5dd4fe[_0xa3ad('0x11')]['message']);return _0x50313b(_0x5dd4fe[_0xa3ad('0x11')][_0xa3ad('0x13')]);}else{logger[_0xa3ad('0xc')](_0xa3ad('0xd'),_0x2d71f0,_0xa3ad('0xe'));_0x50313b(_0x5dd4fe['result']['message']);}})[_0xa3ad('0x14')](function(_0x4d959c){logger[_0xa3ad('0x11')]('Cdr,\x20%s,\x20%s',_0x2d71f0,_0x4d959c);_0x4a118c(_0x4d959c);});});} \ No newline at end of file +var _0xec8d=['info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0xec8d,0x1ab));var _0xdec8=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xec8d[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0xdec8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdec8('0x1'));var rs=require(_0xdec8('0x2'));var fs=require('fs');var Redis=require(_0xdec8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdec8('0x4'));var config=require(_0xdec8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdec8('0x6')][_0xdec8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55db5f,_0x3ce58e,_0x500661){return new BPromise(function(_0x31a690,_0x5bba09){return client[_0xdec8('0x8')](_0x55db5f,_0x500661)[_0xdec8('0x9')](function(_0x43ece8){logger[_0xdec8('0xa')](_0xdec8('0xb'),_0x3ce58e,_0xdec8('0xc'));logger['debug'](_0xdec8('0xd'),_0x3ce58e,_0xdec8('0xc'),JSON[_0xdec8('0xe')](_0x43ece8));if(_0x43ece8['error']){if(_0x43ece8[_0xdec8('0xf')][_0xdec8('0x10')]===0x1f4){logger[_0xdec8('0xf')](_0xdec8('0xb'),_0x3ce58e,_0x43ece8['error'][_0xdec8('0x11')]);return _0x5bba09(_0x43ece8[_0xdec8('0xf')][_0xdec8('0x11')]);}logger[_0xdec8('0xf')](_0xdec8('0xb'),_0x3ce58e,_0x43ece8['error']['message']);return _0x31a690(_0x43ece8[_0xdec8('0xf')]['message']);}else{logger[_0xdec8('0xa')](_0xdec8('0xb'),_0x3ce58e,'request\x20sent');_0x31a690(_0x43ece8['result'][_0xdec8('0x11')]);}})[_0xdec8('0x12')](function(_0x49e4f1){logger['error'](_0xdec8('0xb'),_0x3ce58e,_0x49e4f1);_0x5bba09(_0x49e4f1);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f41c2ab..0552ed7 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(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x32eb3d,_0x1b22aa){var _0x2ca79b=function(_0x571c61){while(--_0x571c61){_0x32eb3d['push'](_0x32eb3d['shift']());}};_0x2ca79b(++_0x1b22aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xb10b[_0x4c7d8b];return _0x187158;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 7f07aed..3ffc217 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 _0xf15c=['STRING','*,*,*,*','sequelize','exports','INTEGER','TEXT'];(function(_0x155e75,_0x4f7417){var _0xbf6ea9=function(_0x328d1c){while(--_0x328d1c){_0x155e75['push'](_0x155e75['shift']());}};_0xbf6ea9(++_0x4f7417);}(_0xf15c,0x170));var _0xcf15=function(_0x38a117,_0x30ab59){_0x38a117=_0x38a117-0x0;var _0x1e814a=_0xf15c[_0x38a117];return _0x1e814a;};'use strict';var Sequelize=require(_0xcf15('0x0'));module[_0xcf15('0x1')]={'priority':{'type':Sequelize[_0xcf15('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcf15('0x3')]()},'description':{'type':Sequelize[_0xcf15('0x4')]},'interval':{'type':Sequelize[_0xcf15('0x4')],'defaultValue':_0xcf15('0x5')}}; \ No newline at end of file +var _0xd942=['sequelize','exports','INTEGER','TEXT','STRING'];(function(_0xfb282a,_0xc3cc55){var _0x168b9f=function(_0x2ce57e){while(--_0x2ce57e){_0xfb282a['push'](_0xfb282a['shift']());}};_0x168b9f(++_0xc3cc55);}(_0xd942,0x17c));var _0x2d94=function(_0x91e6c3,_0x252d04){_0x91e6c3=_0x91e6c3-0x0;var _0x121636=_0xd942[_0x91e6c3];return _0x121636;};'use strict';var Sequelize=require(_0x2d94('0x0'));module[_0x2d94('0x1')]={'priority':{'type':Sequelize[_0x2d94('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2d94('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2d94('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 703c33e..cabb97a 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 _0x05b0=['includeAll','merge','catch','find','params','body','destroy','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','end','error','stack','name','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length'];(function(_0xc84cac,_0x188911){var _0x2ed0fe=function(_0x1d3aea){while(--_0x1d3aea){_0xc84cac['push'](_0xc84cac['shift']());}};_0x2ed0fe(++_0x188911);}(_0x05b0,0x188));var _0x005b=function(_0x2b494e,_0x419bf4){_0x2b494e=_0x2b494e-0x0;var _0x523f0a=_0x05b0[_0x2b494e];return _0x523f0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x005b('0x0'));var jsonpatch=require(_0x005b('0x1'));var rp=require('request-promise');var moment=require(_0x005b('0x2'));var BPromise=require(_0x005b('0x3'));var Mustache=require('mustache');var util=require(_0x005b('0x4'));var path=require(_0x005b('0x5'));var sox=require('sox');var csv=require(_0x005b('0x6'));var ejs=require(_0x005b('0x7'));var fs=require('fs');var fs_extra=require(_0x005b('0x8'));var _=require(_0x005b('0x9'));var squel=require(_0x005b('0xa'));var crypto=require(_0x005b('0xb'));var jsforce=require(_0x005b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x005b('0x6'));var querystring=require(_0x005b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x005b('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x005b('0xf'))(_0x005b('0x10'));var utils=require('../../config/utils');var config=require(_0x005b('0x11'));var licenseUtil=require(_0x005b('0x12'));var db=require(_0x005b('0x13'))['db'];function respondWithStatusCode(_0x10f9bb,_0xce7212){_0xce7212=_0xce7212||0xcc;return function(_0xe2674e){if(_0xe2674e){return _0x10f9bb[_0x005b('0x14')](_0xce7212);}return _0x10f9bb['status'](_0xce7212)['end']();};}function respondWithResult(_0x52ad9c,_0x309c8f){_0x309c8f=_0x309c8f||0xc8;return function(_0x50b7ce){if(_0x50b7ce){return _0x52ad9c[_0x005b('0x15')](_0x309c8f)['json'](_0x50b7ce);}};}function respondWithFilteredResult(_0x1c8eed,_0x1f7743){return function(_0x2ce01e){if(_0x2ce01e){var _0x1991e8=typeof _0x1f7743[_0x005b('0x16')]==='undefined'&&typeof _0x1f7743[_0x005b('0x17')]===_0x005b('0x18');var _0xf3cf84=_0x2ce01e['count'];var _0x206c0a=_0x1991e8?0x0:_0x1f7743[_0x005b('0x16')];var _0x50a6eb=_0x1991e8?_0x2ce01e[_0x005b('0x19')]:_0x1f7743[_0x005b('0x16')]+_0x1f7743[_0x005b('0x17')];var _0x434874;if(_0x50a6eb>=_0xf3cf84){_0x50a6eb=_0xf3cf84;_0x434874=0xc8;}else{_0x434874=0xce;}_0x1c8eed[_0x005b('0x15')](_0x434874);return _0x1c8eed['set'](_0x005b('0x1a'),_0x206c0a+'-'+_0x50a6eb+'/'+_0xf3cf84)[_0x005b('0x1b')](_0x2ce01e);}return null;};}function patchUpdates(_0x4ae164){return function(_0x24637d){try{jsonpatch[_0x005b('0x1c')](_0x24637d,_0x4ae164,!![]);}catch(_0xd97375){return BPromise['reject'](_0xd97375);}return _0x24637d[_0x005b('0x1d')]();};}function saveUpdates(_0x145c36,_0x319981){return function(_0x3521c9){if(_0x3521c9){return _0x3521c9[_0x005b('0x1e')](_0x145c36)[_0x005b('0x1f')](function(_0x4f632f){return _0x4f632f;});}return null;};}function removeEntity(_0x322229,_0x169428){return function(_0x1fef26){if(_0x1fef26){return _0x1fef26['destroy']()[_0x005b('0x1f')](function(){_0x322229['status'](0xcc)[_0x005b('0x20')]();});}};}function handleEntityNotFound(_0x527294,_0x542fa2){return function(_0x2dc341){if(!_0x2dc341){_0x527294[_0x005b('0x14')](0x194);}return _0x2dc341;};}function handleError(_0x3effd5,_0x267f10){_0x267f10=_0x267f10||0x1f4;return function(_0x6730d4){logger[_0x005b('0x21')](_0x6730d4[_0x005b('0x22')]);if(_0x6730d4[_0x005b('0x23')]){delete _0x6730d4['name'];}_0x3effd5[_0x005b('0x15')](_0x267f10)[_0x005b('0x24')](_0x6730d4);};}exports[_0x005b('0x25')]=function(_0x13e834,_0x2e92d1){var _0x1d8f93={'raw':!![],'where':{'id':_0x13e834['params']['id']}},_0x4775a2={};_0x4775a2[_0x005b('0x26')]=_[_0x005b('0x27')](db[_0x005b('0x28')][_0x005b('0x29')]);_0x4775a2['query']=_['keys'](_0x13e834[_0x005b('0x2a')]);_0x4775a2[_0x005b('0x2b')]=_['intersection'](_0x4775a2['model'],_0x4775a2[_0x005b('0x2a')]);_0x1d8f93['attributes']=_[_0x005b('0x2c')](_0x4775a2[_0x005b('0x26')],qs[_0x005b('0x2d')](_0x13e834['query']['fields']));_0x1d8f93[_0x005b('0x2e')]=_0x1d8f93[_0x005b('0x2e')][_0x005b('0x2f')]?_0x1d8f93['attributes']:_0x4775a2['model'];if(_0x13e834[_0x005b('0x2a')][_0x005b('0x30')]){_0x1d8f93['include']=[{'all':!![]}];}_0x1d8f93=_[_0x005b('0x31')]({},_0x1d8f93,_0x13e834['options']);return db[_0x005b('0x28')]['find'](_0x1d8f93)['then'](handleEntityNotFound(_0x2e92d1,null))[_0x005b('0x1f')](respondWithResult(_0x2e92d1,null))[_0x005b('0x32')](handleError(_0x2e92d1,null));};exports[_0x005b('0x1e')]=function(_0xe5b24e,_0x430d10){if(_0xe5b24e['body']['id']){delete _0xe5b24e['body']['id'];}return db[_0x005b('0x28')][_0x005b('0x33')]({'where':{'id':_0xe5b24e[_0x005b('0x34')]['id']}})[_0x005b('0x1f')](handleEntityNotFound(_0x430d10,null))[_0x005b('0x1f')](saveUpdates(_0xe5b24e[_0x005b('0x35')],null))['then'](respondWithResult(_0x430d10,null))[_0x005b('0x32')](handleError(_0x430d10,null));};exports[_0x005b('0x36')]=function(_0x2c2ced,_0x58923d){return db[_0x005b('0x28')][_0x005b('0x33')]({'where':{'id':_0x2c2ced[_0x005b('0x34')]['id']}})[_0x005b('0x1f')](handleEntityNotFound(_0x58923d,null))[_0x005b('0x1f')](removeEntity(_0x58923d,null))[_0x005b('0x32')](handleError(_0x58923d,null));}; \ No newline at end of file +var _0x4ef1=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','destroy','then','error','stack','name','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatApplication','catch','body','eml-format'];(function(_0x3954f0,_0x38ff5f){var _0x41fc13=function(_0x55004e){while(--_0x55004e){_0x3954f0['push'](_0x3954f0['shift']());}};_0x41fc13(++_0x38ff5f);}(_0x4ef1,0xeb));var _0x14ef=function(_0xe8d117,_0x509df1){_0xe8d117=_0xe8d117-0x0;var _0x3141bf=_0x4ef1[_0xe8d117];return _0x3141bf;};'use strict';var emlformat=require(_0x14ef('0x0'));var rimraf=require(_0x14ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ef('0x2'));var rp=require(_0x14ef('0x3'));var moment=require(_0x14ef('0x4'));var BPromise=require(_0x14ef('0x5'));var Mustache=require(_0x14ef('0x6'));var util=require(_0x14ef('0x7'));var path=require(_0x14ef('0x8'));var sox=require(_0x14ef('0x9'));var csv=require(_0x14ef('0xa'));var ejs=require(_0x14ef('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14ef('0xc'));var squel=require(_0x14ef('0xd'));var crypto=require('crypto');var jsforce=require(_0x14ef('0xe'));var deskjs=require(_0x14ef('0xf'));var toCsv=require(_0x14ef('0xa'));var querystring=require(_0x14ef('0x10'));var Papa=require(_0x14ef('0x11'));var Redis=require('ioredis');var authService=require(_0x14ef('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x14ef('0x13'));var hardwareService=require(_0x14ef('0x14'));var logger=require(_0x14ef('0x15'))(_0x14ef('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x14ef('0x17'));var db=require(_0x14ef('0x18'))['db'];function respondWithStatusCode(_0x4a7610,_0x3cf22b){_0x3cf22b=_0x3cf22b||0xcc;return function(_0x467ffc){if(_0x467ffc){return _0x4a7610[_0x14ef('0x19')](_0x3cf22b);}return _0x4a7610['status'](_0x3cf22b)[_0x14ef('0x1a')]();};}function respondWithResult(_0xbe32b8,_0x2263f1){_0x2263f1=_0x2263f1||0xc8;return function(_0xa9e67d){if(_0xa9e67d){return _0xbe32b8['status'](_0x2263f1)[_0x14ef('0x1b')](_0xa9e67d);}};}function respondWithFilteredResult(_0x14b857,_0x435fc1){return function(_0x20aefa){if(_0x20aefa){var _0x5364e5=typeof _0x435fc1[_0x14ef('0x1c')]===_0x14ef('0x1d')&&typeof _0x435fc1[_0x14ef('0x1e')]===_0x14ef('0x1d');var _0x42f3cc=_0x20aefa[_0x14ef('0x1f')];var _0x17f63a=_0x5364e5?0x0:_0x435fc1[_0x14ef('0x1c')];var _0x19b2cb=_0x5364e5?_0x20aefa[_0x14ef('0x1f')]:_0x435fc1[_0x14ef('0x1c')]+_0x435fc1[_0x14ef('0x1e')];var _0x1fce64;if(_0x19b2cb>=_0x42f3cc){_0x19b2cb=_0x42f3cc;_0x1fce64=0xc8;}else{_0x1fce64=0xce;}_0x14b857[_0x14ef('0x20')](_0x1fce64);return _0x14b857['set']('Content-Range',_0x17f63a+'-'+_0x19b2cb+'/'+_0x42f3cc)[_0x14ef('0x1b')](_0x20aefa);}return null;};}function patchUpdates(_0x34a991){return function(_0x376bac){try{jsonpatch[_0x14ef('0x21')](_0x376bac,_0x34a991,!![]);}catch(_0x4686cf){return BPromise[_0x14ef('0x22')](_0x4686cf);}return _0x376bac[_0x14ef('0x23')]();};}function saveUpdates(_0x11e9a3,_0x52f889){return function(_0x477e18){if(_0x477e18){return _0x477e18['update'](_0x11e9a3)['then'](function(_0xcaf3a6){return _0xcaf3a6;});}return null;};}function removeEntity(_0xd52011,_0x37bb6f){return function(_0x275cc7){if(_0x275cc7){return _0x275cc7[_0x14ef('0x24')]()[_0x14ef('0x25')](function(){_0xd52011[_0x14ef('0x20')](0xcc)[_0x14ef('0x1a')]();});}};}function handleEntityNotFound(_0x45105f,_0x168fa6){return function(_0x582b89){if(!_0x582b89){_0x45105f[_0x14ef('0x19')](0x194);}return _0x582b89;};}function handleError(_0x5cb75d,_0x184f29){_0x184f29=_0x184f29||0x1f4;return function(_0x21a176){logger[_0x14ef('0x26')](_0x21a176[_0x14ef('0x27')]);if(_0x21a176['name']){delete _0x21a176[_0x14ef('0x28')];}_0x5cb75d['status'](_0x184f29)['send'](_0x21a176);};}exports[_0x14ef('0x29')]=function(_0x40d50d,_0x17d961){var _0x344c2a={'raw':!![],'where':{'id':_0x40d50d[_0x14ef('0x2a')]['id']}},_0x38f5e9={};_0x38f5e9[_0x14ef('0x2b')]=_[_0x14ef('0x2c')](db['ChatApplication'][_0x14ef('0x2d')]);_0x38f5e9[_0x14ef('0x2e')]=_[_0x14ef('0x2c')](_0x40d50d[_0x14ef('0x2e')]);_0x38f5e9[_0x14ef('0x2f')]=_[_0x14ef('0x30')](_0x38f5e9[_0x14ef('0x2b')],_0x38f5e9[_0x14ef('0x2e')]);_0x344c2a[_0x14ef('0x31')]=_[_0x14ef('0x30')](_0x38f5e9[_0x14ef('0x2b')],qs['fields'](_0x40d50d['query'][_0x14ef('0x32')]));_0x344c2a[_0x14ef('0x31')]=_0x344c2a[_0x14ef('0x31')][_0x14ef('0x33')]?_0x344c2a['attributes']:_0x38f5e9['model'];if(_0x40d50d[_0x14ef('0x2e')][_0x14ef('0x34')]){_0x344c2a[_0x14ef('0x35')]=[{'all':!![]}];}_0x344c2a=_[_0x14ef('0x36')]({},_0x344c2a,_0x40d50d[_0x14ef('0x37')]);return db[_0x14ef('0x38')]['find'](_0x344c2a)[_0x14ef('0x25')](handleEntityNotFound(_0x17d961,null))[_0x14ef('0x25')](respondWithResult(_0x17d961,null))[_0x14ef('0x39')](handleError(_0x17d961,null));};exports['update']=function(_0x494be0,_0x553d76){if(_0x494be0[_0x14ef('0x3a')]['id']){delete _0x494be0[_0x14ef('0x3a')]['id'];}return db[_0x14ef('0x38')]['find']({'where':{'id':_0x494be0['params']['id']}})[_0x14ef('0x25')](handleEntityNotFound(_0x553d76,null))['then'](saveUpdates(_0x494be0[_0x14ef('0x3a')],null))[_0x14ef('0x25')](respondWithResult(_0x553d76,null))[_0x14ef('0x39')](handleError(_0x553d76,null));};exports['destroy']=function(_0x35a63b,_0x29e885){return db[_0x14ef('0x38')]['find']({'where':{'id':_0x35a63b[_0x14ef('0x2a')]['id']}})['then'](handleEntityNotFound(_0x29e885,null))[_0x14ef('0x25')](removeEntity(_0x29e885,null))[_0x14ef('0x39')](handleError(_0x29e885,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6d86dde..7c1581d 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 _0x963a=['bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x158bec,_0x39eb7e){var _0x33575a=function(_0x20abb5){while(--_0x20abb5){_0x158bec['push'](_0x158bec['shift']());}};_0x33575a(++_0x39eb7e);}(_0x963a,0xbe));var _0xa963=function(_0xb12056,_0x389b06){_0xb12056=_0xb12056-0x0;var _0x5bc09a=_0x963a[_0xb12056];return _0x5bc09a;};'use strict';var _=require(_0xa963('0x0'));var util=require(_0xa963('0x1'));var logger=require(_0xa963('0x2'))(_0xa963('0x3'));var moment=require(_0xa963('0x4'));var BPromise=require(_0xa963('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa963('0x6'));var rimraf=require(_0xa963('0x7'));var config=require(_0xa963('0x8'));var attributes=require(_0xa963('0x9'));module['exports']=function(_0x34110d,_0x4c9765){return _0x34110d[_0xa963('0xa')](_0xa963('0xb'),attributes,{'tableName':_0xa963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa963('0xd'),'collate':_0xa963('0xe')});}; \ No newline at end of file +var _0x0165=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0165,0x192));var _0x5016=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0165[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5016('0x0'));var util=require(_0x5016('0x1'));var logger=require(_0x5016('0x2'))(_0x5016('0x3'));var moment=require(_0x5016('0x4'));var BPromise=require(_0x5016('0x5'));var rp=require(_0x5016('0x6'));var fs=require('fs');var path=require(_0x5016('0x7'));var rimraf=require(_0x5016('0x8'));var config=require(_0x5016('0x9'));var attributes=require(_0x5016('0xa'));module['exports']=function(_0xfc4c74,_0x125296){return _0xfc4c74[_0x5016('0xb')](_0x5016('0xc'),attributes,{'tableName':_0x5016('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5016('0xe'),'collate':_0x5016('0xf')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index bc99977..a4f6d26 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 _0xe877=['request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xe877,0x1e7));var _0x7e87=function(_0x1bb51d,_0x1c2d9c){_0x1bb51d=_0x1bb51d-0x0;var _0x386643=_0xe877[_0x1bb51d];return _0x386643;};'use strict';var _=require(_0x7e87('0x0'));var util=require(_0x7e87('0x1'));var moment=require(_0x7e87('0x2'));var BPromise=require(_0x7e87('0x3'));var rs=require(_0x7e87('0x4'));var fs=require('fs');var Redis=require(_0x7e87('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e87('0x6'));var logger=require(_0x7e87('0x7'))(_0x7e87('0x8'));var config=require(_0x7e87('0x9'));var jayson=require(_0x7e87('0xa'));var client=jayson[_0x7e87('0xb')][_0x7e87('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x359486,_0x266518,_0x5e4354){return new BPromise(function(_0x45da89,_0x21b672){return client[_0x7e87('0xd')](_0x359486,_0x5e4354)[_0x7e87('0xe')](function(_0x451c25){logger[_0x7e87('0xf')](_0x7e87('0x10'),_0x266518,'request\x20sent');logger[_0x7e87('0x11')](_0x7e87('0x12'),_0x266518,'request\x20sent',JSON[_0x7e87('0x13')](_0x451c25));if(_0x451c25[_0x7e87('0x14')]){if(_0x451c25['error'][_0x7e87('0x15')]===0x1f4){logger[_0x7e87('0x14')](_0x7e87('0x10'),_0x266518,_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);return _0x21b672(_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x266518,_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);return _0x45da89(_0x451c25[_0x7e87('0x14')][_0x7e87('0x16')]);}else{logger[_0x7e87('0xf')](_0x7e87('0x10'),_0x266518,_0x7e87('0x17'));_0x45da89(_0x451c25['result'][_0x7e87('0x16')]);}})[_0x7e87('0x18')](function(_0x1c46b4){logger[_0x7e87('0x14')](_0x7e87('0x10'),_0x266518,_0x1c46b4);_0x21b672(_0x1c46b4);});});} \ No newline at end of file +var _0x434e=['ChatApplication,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x434e,0x137));var _0xe434=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x434e[_0x4404ff];return _0x5e7b19;};'use strict';var _=require(_0xe434('0x0'));var util=require(_0xe434('0x1'));var moment=require(_0xe434('0x2'));var BPromise=require(_0xe434('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe434('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe434('0x5'));var logger=require('../../config/logger')(_0xe434('0x6'));var config=require(_0xe434('0x7'));var jayson=require(_0xe434('0x8'));var client=jayson[_0xe434('0x9')][_0xe434('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30feee,_0xf50fb0,_0x2e0c22){return new BPromise(function(_0x405ee8,_0xf709b9){return client[_0xe434('0xb')](_0x30feee,_0x2e0c22)[_0xe434('0xc')](function(_0x2a8fd2){logger['info']('ChatApplication,\x20%s,\x20%s',_0xf50fb0,'request\x20sent');logger[_0xe434('0xd')](_0xe434('0xe'),_0xf50fb0,'request\x20sent',JSON[_0xe434('0xf')](_0x2a8fd2));if(_0x2a8fd2[_0xe434('0x10')]){if(_0x2a8fd2[_0xe434('0x10')][_0xe434('0x11')]===0x1f4){logger[_0xe434('0x10')]('ChatApplication,\x20%s,\x20%s',_0xf50fb0,_0x2a8fd2[_0xe434('0x10')][_0xe434('0x12')]);return _0xf709b9(_0x2a8fd2[_0xe434('0x10')]['message']);}logger[_0xe434('0x10')](_0xe434('0x13'),_0xf50fb0,_0x2a8fd2['error'][_0xe434('0x12')]);return _0x405ee8(_0x2a8fd2[_0xe434('0x10')]['message']);}else{logger['info'](_0xe434('0x13'),_0xf50fb0,_0xe434('0x14'));_0x405ee8(_0x2a8fd2['result'][_0xe434('0x12')]);}})[_0xe434('0x15')](function(_0xbcaf04){logger[_0xe434('0x10')](_0xe434('0x13'),_0xf50fb0,_0xbcaf04);_0xf709b9(_0xbcaf04);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 42b4adc..a19a93d 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 _0xaa21=['./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xaa21,0xe6));var _0x1aa2=function(_0x3c368b,_0x2746e6){_0x3c368b=_0x3c368b-0x0;var _0x3b610a=_0xaa21[_0x3c368b];return _0x3b610a;};'use strict';var multer=require(_0x1aa2('0x0'));var util=require(_0x1aa2('0x1'));var path=require('path');var timeout=require(_0x1aa2('0x2'));var express=require(_0x1aa2('0x3'));var router=express[_0x1aa2('0x4')]();var fs_extra=require(_0x1aa2('0x5'));var auth=require(_0x1aa2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1aa2('0x7'));var controller=require(_0x1aa2('0x8'));router[_0x1aa2('0x9')]('/:id',auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xb')]);router[_0x1aa2('0xc')](_0x1aa2('0xd'),auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xe')]);router['delete'](_0x1aa2('0xd'),auth[_0x1aa2('0xa')](),controller[_0x1aa2('0xf')]);module[_0x1aa2('0x10')]=router; \ No newline at end of file +var _0x04b1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x25d569,_0x5ace56){var _0x2f70f6=function(_0x4eb2ff){while(--_0x4eb2ff){_0x25d569['push'](_0x25d569['shift']());}};_0x2f70f6(++_0x5ace56);}(_0x04b1,0xbb));var _0x104b=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x04b1[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x104b('0x0'));var util=require(_0x104b('0x1'));var path=require(_0x104b('0x2'));var timeout=require(_0x104b('0x3'));var express=require(_0x104b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x104b('0x5'));var interaction=require(_0x104b('0x6'));var config=require(_0x104b('0x7'));var controller=require(_0x104b('0x8'));router['get'](_0x104b('0x9'),auth[_0x104b('0xa')](),controller[_0x104b('0xb')]);router[_0x104b('0xc')](_0x104b('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x104b('0xd')](_0x104b('0x9'),auth[_0x104b('0xa')](),controller[_0x104b('0xe')]);module[_0x104b('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 06bd8aa..b085894 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 _0x13c5=['sequelize'];(function(_0x242b57,_0x4c78da){var _0x42ee35=function(_0x4d7593){while(--_0x4d7593){_0x242b57['push'](_0x242b57['shift']());}};_0x42ee35(++_0x4c78da);}(_0x13c5,0x7a));var _0x513c=function(_0x30bfc6,_0x493833){_0x30bfc6=_0x30bfc6-0x0;var _0x2ac420=_0x13c5[_0x30bfc6];return _0x2ac420;};'use strict';var Sequelize=require(_0x513c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x3185=['exports','STRING','BOOLEAN','sequelize'];(function(_0x784fec,_0x3f7922){var _0x33975e=function(_0x55e73d){while(--_0x55e73d){_0x784fec['push'](_0x784fec['shift']());}};_0x33975e(++_0x3f7922);}(_0x3185,0x177));var _0x5318=function(_0xc758c6,_0x1d2099){_0xc758c6=_0xc758c6-0x0;var _0x2fd7e2=_0x3185[_0xc758c6];return _0x2fd7e2;};'use strict';var Sequelize=require(_0x5318('0x0'));module[_0x5318('0x1')]={'name':{'type':Sequelize[_0x5318('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5318('0x2')]},'write':{'type':Sequelize[_0x5318('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 71a008d..b28d357 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 _0xce1e=['getMessages','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','offset','undefined','count','limit','set','json','reject','save','then','destroy','sendStatus','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','create','body','update','find','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','$gte','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23a246,_0x4eb2c5){var _0x4684a9=function(_0xa064aa){while(--_0xa064aa){_0x23a246['push'](_0x23a246['shift']());}};_0x4684a9(++_0x4eb2c5);}(_0xce1e,0x1c3));var _0xece1=function(_0x2e1924,_0x391674){_0x2e1924=_0x2e1924-0x0;var _0x34cd54=_0xce1e[_0x2e1924];return _0x34cd54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xece1('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xece1('0x1'));var BPromise=require(_0xece1('0x2'));var Mustache=require('mustache');var util=require(_0xece1('0x3'));var path=require('path');var sox=require(_0xece1('0x4'));var csv=require('to-csv');var ejs=require(_0xece1('0x5'));var fs=require('fs');var fs_extra=require(_0xece1('0x6'));var _=require(_0xece1('0x7'));var squel=require('squel');var crypto=require(_0xece1('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xece1('0x9'));var querystring=require(_0xece1('0xa'));var Papa=require(_0xece1('0xb'));var Redis=require(_0xece1('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xece1('0xd'));var as=require(_0xece1('0xe'));var hardwareService=require(_0xece1('0xf'));var logger=require(_0xece1('0x10'))('api');var utils=require(_0xece1('0x11'));var config=require(_0xece1('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xece1('0x13'))['db'];config['redis']=_[_0xece1('0x14')](config[_0xece1('0x15')],{'host':_0xece1('0x16'),'port':0x18eb});var socket=require(_0xece1('0x17'))(new Redis(config['redis']));require(_0xece1('0x18'))[_0xece1('0x19')](socket);function respondWithStatusCode(_0x4819d0,_0x369e1a){_0x369e1a=_0x369e1a||0xcc;return function(_0x1a004b){if(_0x1a004b){return _0x4819d0['sendStatus'](_0x369e1a);}return _0x4819d0[_0xece1('0x1a')](_0x369e1a)[_0xece1('0x1b')]();};}function respondWithResult(_0x4f713c,_0x18cf26){_0x18cf26=_0x18cf26||0xc8;return function(_0x34e08a){if(_0x34e08a){return _0x4f713c['status'](_0x18cf26)['json'](_0x34e08a);}};}function respondWithFilteredResult(_0x350980,_0x1c6227){return function(_0x2837f5){if(_0x2837f5){var _0x2d56e3=typeof _0x1c6227[_0xece1('0x1c')]==='undefined'&&typeof _0x1c6227['limit']===_0xece1('0x1d');var _0x213653=_0x2837f5['count'];var _0x11fc32=_0x2d56e3?0x0:_0x1c6227[_0xece1('0x1c')];var _0x58f6c6=_0x2d56e3?_0x2837f5[_0xece1('0x1e')]:_0x1c6227[_0xece1('0x1c')]+_0x1c6227[_0xece1('0x1f')];var _0x1f1cc1;if(_0x58f6c6>=_0x213653){_0x58f6c6=_0x213653;_0x1f1cc1=0xc8;}else{_0x1f1cc1=0xce;}_0x350980[_0xece1('0x1a')](_0x1f1cc1);return _0x350980[_0xece1('0x20')]('Content-Range',_0x11fc32+'-'+_0x58f6c6+'/'+_0x213653)[_0xece1('0x21')](_0x2837f5);}return null;};}function patchUpdates(_0x42258c){return function(_0x44c6ed){try{jsonpatch['apply'](_0x44c6ed,_0x42258c,!![]);}catch(_0x19e892){return BPromise[_0xece1('0x22')](_0x19e892);}return _0x44c6ed[_0xece1('0x23')]();};}function saveUpdates(_0x326ac4,_0x3d788a){return function(_0x37a6d5){if(_0x37a6d5){return _0x37a6d5['update'](_0x326ac4)[_0xece1('0x24')](function(_0x52bfbd){return _0x52bfbd;});}return null;};}function removeEntity(_0x3e6d67,_0x263283){return function(_0x5af9b5){if(_0x5af9b5){return _0x5af9b5[_0xece1('0x25')]()[_0xece1('0x24')](function(){_0x3e6d67[_0xece1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbd63,_0x4c9e57){return function(_0x451a5d){if(!_0x451a5d){_0x3cbd63[_0xece1('0x26')](0x194);}return _0x451a5d;};}function handleError(_0x2d59a4,_0x1df1f8){_0x1df1f8=_0x1df1f8||0x1f4;return function(_0x498688){logger[_0xece1('0x27')](_0x498688[_0xece1('0x28')]);if(_0x498688[_0xece1('0x29')]){delete _0x498688[_0xece1('0x29')];}_0x2d59a4[_0xece1('0x1a')](_0x1df1f8)[_0xece1('0x2a')](_0x498688);};}exports['index']=function(_0x157928,_0x5f27ec){var _0x19b534={},_0x3636e6={},_0x260c94={'count':0x0,'rows':[]};var _0x1b03f2=_[_0xece1('0x2b')](db[_0xece1('0x2c')][_0xece1('0x2d')],function(_0x750eb2){return{'name':_0x750eb2[_0xece1('0x2e')],'type':_0x750eb2['type']['key']};});_0x3636e6[_0xece1('0x2f')]=_[_0xece1('0x2b')](_0x1b03f2,_0xece1('0x29'));_0x3636e6[_0xece1('0x30')]=_[_0xece1('0x31')](_0x157928['query']);_0x3636e6['filters']=_[_0xece1('0x32')](_0x3636e6[_0xece1('0x2f')],_0x3636e6[_0xece1('0x30')]);_0x19b534[_0xece1('0x33')]=_['intersection'](_0x3636e6[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x157928[_0xece1('0x30')][_0xece1('0x34')]));_0x19b534[_0xece1('0x33')]=_0x19b534[_0xece1('0x33')][_0xece1('0x35')]?_0x19b534[_0xece1('0x33')]:_0x3636e6['model'];if(!_0x157928[_0xece1('0x30')][_0xece1('0x36')]('nolimit')){_0x19b534[_0xece1('0x1f')]=qs[_0xece1('0x1f')](_0x157928[_0xece1('0x30')][_0xece1('0x1f')]);_0x19b534[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x157928[_0xece1('0x30')]['offset']);}_0x19b534[_0xece1('0x37')]=qs[_0xece1('0x38')](_0x157928[_0xece1('0x30')][_0xece1('0x38')]);_0x19b534[_0xece1('0x39')]=qs['filters'](_[_0xece1('0x3a')](_0x157928[_0xece1('0x30')],_0x3636e6[_0xece1('0x3b')]),_0x1b03f2);if(_0x157928[_0xece1('0x30')][_0xece1('0x3c')]){_0x19b534[_0xece1('0x39')]=_[_0xece1('0x3d')](_0x19b534['where'],{'$or':_[_0xece1('0x2b')](_0x1b03f2,function(_0x5a8c13){if(_0x5a8c13['type']!==_0xece1('0x3e')){var _0x13cb72={};_0x13cb72[_0x5a8c13[_0xece1('0x29')]]={'$like':'%'+_0x157928[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x13cb72;}})});}_0x19b534=_[_0xece1('0x3d')]({},_0x19b534,_0x157928[_0xece1('0x3f')]);var _0x2844c5={'where':_0x19b534['where']};return db[_0xece1('0x2c')][_0xece1('0x1e')](_0x2844c5)[_0xece1('0x24')](function(_0x20f274){_0x260c94[_0xece1('0x1e')]=_0x20f274;if(_0x157928['query'][_0xece1('0x40')]){_0x19b534['include']=[{'all':!![]}];}return db[_0xece1('0x2c')][_0xece1('0x41')](_0x19b534);})[_0xece1('0x24')](function(_0x40e1c2){_0x260c94[_0xece1('0x42')]=_0x40e1c2;return _0x260c94;})[_0xece1('0x24')](respondWithFilteredResult(_0x5f27ec,_0x19b534))[_0xece1('0x43')](handleError(_0x5f27ec,null));};exports['show']=function(_0x53fb7b,_0x5dba92){var _0x28e432={'raw':!![],'where':{'id':_0x53fb7b[_0xece1('0x44')]['id']}},_0x5b6699={};_0x5b6699['model']=_[_0xece1('0x31')](db[_0xece1('0x2c')][_0xece1('0x2d')]);_0x5b6699['query']=_[_0xece1('0x31')](_0x53fb7b['query']);_0x5b6699[_0xece1('0x3b')]=_[_0xece1('0x32')](_0x5b6699[_0xece1('0x2f')],_0x5b6699[_0xece1('0x30')]);_0x28e432[_0xece1('0x33')]=_[_0xece1('0x32')](_0x5b6699[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x53fb7b[_0xece1('0x30')][_0xece1('0x34')]));_0x28e432[_0xece1('0x33')]=_0x28e432[_0xece1('0x33')][_0xece1('0x35')]?_0x28e432[_0xece1('0x33')]:_0x5b6699[_0xece1('0x2f')];if(_0x53fb7b[_0xece1('0x30')]['includeAll']){_0x28e432['include']=[{'all':!![]}];}_0x28e432=_['merge']({},_0x28e432,_0x53fb7b[_0xece1('0x3f')]);return db['ChatGroup']['find'](_0x28e432)[_0xece1('0x24')](handleEntityNotFound(_0x5dba92,null))[_0xece1('0x24')](respondWithResult(_0x5dba92,null))[_0xece1('0x43')](handleError(_0x5dba92,null));};exports[_0xece1('0x45')]=function(_0x622c6f,_0xa47ce2){return db[_0xece1('0x2c')][_0xece1('0x45')](_0x622c6f[_0xece1('0x46')],{})['then'](respondWithResult(_0xa47ce2,0xc9))[_0xece1('0x43')](handleError(_0xa47ce2,null));};exports[_0xece1('0x47')]=function(_0x1f1118,_0x521745){if(_0x1f1118[_0xece1('0x46')]['id']){delete _0x1f1118[_0xece1('0x46')]['id'];}return db['ChatGroup'][_0xece1('0x48')]({'where':{'id':_0x1f1118[_0xece1('0x44')]['id']}})['then'](handleEntityNotFound(_0x521745,null))[_0xece1('0x24')](saveUpdates(_0x1f1118['body'],null))[_0xece1('0x24')](respondWithResult(_0x521745,null))['catch'](handleError(_0x521745,null));};exports['destroy']=function(_0x3bfdad,_0xdc467b){return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x3bfdad[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0xdc467b,null))[_0xece1('0x24')](removeEntity(_0xdc467b,null))[_0xece1('0x43')](handleError(_0xdc467b,null));};exports[_0xece1('0x49')]=function(_0x22aa89,_0x40a523){return db[_0xece1('0x2c')][_0xece1('0x49')]()[_0xece1('0x24')](respondWithResult(_0x40a523,null))['catch'](handleError(_0x40a523,null));};exports[_0xece1('0x4a')]=function(_0x22b0f0,_0x41d16b,_0x23d22e){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x22b0f0[_0xece1('0x44')]['id'],'ToId':_0x22b0f0[_0xece1('0x4b')]['id'],'read':![]}})[_0xece1('0x24')](function(_0x558910){return{'id':_[_0xece1('0x4c')](_0x22b0f0[_0xece1('0x44')]['id']),'count':_0x558910};})[_0xece1('0x24')](respondWithResult(_0x41d16b,null))[_0xece1('0x43')](handleError(_0x41d16b,null));};exports[_0xece1('0x4d')]=function(_0xecda99,_0x5cfee4,_0x293311){return db[_0xece1('0x2c')]['find']({'where':{'id':_0xecda99[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x5cfee4,null))['then'](function(_0x513cb6){if(_0x513cb6){return _0x513cb6[_0xece1('0x4d')](_0xecda99[_0xece1('0x46')][_0xece1('0x4e')],_[_0xece1('0x4f')](_0xecda99[_0xece1('0x46')],[_0xece1('0x4e'),'id'])||{});}})[_0xece1('0x24')](respondWithResult(_0x5cfee4,null))[_0xece1('0x43')](handleError(_0x5cfee4,null));};exports[_0xece1('0x50')]=function(_0x5d843a,_0x15425c,_0x5daca1){var _0x50f272={};var _0x5d0406={};var _0x5bbdf1;var _0x3897d3;return db[_0xece1('0x2c')]['findOne']({'where':{'id':_0x5d843a[_0xece1('0x44')]['id']}})['then'](handleEntityNotFound(_0x15425c,null))['then'](function(_0x34da65){if(_0x34da65){_0x5bbdf1=_0x34da65;_0x5d0406['model']=_[_0xece1('0x31')](db[_0xece1('0x51')][_0xece1('0x2d')]);_0x5d0406['query']=_[_0xece1('0x31')](_0x5d843a['query']);_0x5d0406['filters']=_[_0xece1('0x32')](_0x5d0406['model'],_0x5d0406[_0xece1('0x30')]);_0x50f272[_0xece1('0x33')]=_['intersection'](_0x5d0406[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x5d843a[_0xece1('0x30')]['fields']));_0x50f272['attributes']=_0x50f272[_0xece1('0x33')][_0xece1('0x35')]?_0x50f272[_0xece1('0x33')]:_0x5d0406[_0xece1('0x2f')];_0x50f272['order']=qs['sort'](_0x5d843a[_0xece1('0x30')][_0xece1('0x38')]);_0x50f272[_0xece1('0x39')]=qs[_0xece1('0x3b')](_['pick'](_0x5d843a[_0xece1('0x30')],_0x5d0406['filters']));if(_0x5d843a[_0xece1('0x30')][_0xece1('0x3c')]){_0x50f272[_0xece1('0x39')]=_['merge'](_0x50f272[_0xece1('0x39')],{'$or':_[_0xece1('0x2b')](_0x50f272['attributes'],function(_0x43ab16){var _0x1a4f2a={};_0x1a4f2a[_0x43ab16]={'$like':'%'+_0x5d843a[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x1a4f2a;})});}_0x50f272=_[_0xece1('0x3d')]({},_0x50f272,_0x5d843a[_0xece1('0x3f')]);return _0x5bbdf1[_0xece1('0x50')](_0x50f272);}})['then'](function(_0x2ffd86){if(_0x2ffd86){_0x3897d3=_0x2ffd86[_0xece1('0x35')];if(!_0x5d843a[_0xece1('0x30')][_0xece1('0x36')](_0xece1('0x52'))){_0x50f272['limit']=qs[_0xece1('0x1f')](_0x5d843a['query'][_0xece1('0x1f')]);_0x50f272[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x5d843a[_0xece1('0x30')]['offset']);}return _0x5bbdf1[_0xece1('0x50')](_0x50f272);}})[_0xece1('0x24')](function(_0x1583c7){if(_0x1583c7){return _0x1583c7?{'count':_0x3897d3,'rows':_0x1583c7}:null;}})[_0xece1('0x24')](respondWithResult(_0x15425c,null))[_0xece1('0x43')](handleError(_0x15425c,null));};exports[_0xece1('0x53')]=function(_0x49e8ed,_0x5a9c9f,_0x5dc6ee){return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x49e8ed[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x5a9c9f,null))[_0xece1('0x24')](function(_0x3f62f4){if(_0x3f62f4){return _0x3f62f4[_0xece1('0x53')](_0x49e8ed[_0xece1('0x30')][_0xece1('0x4e')]);}})['then'](respondWithStatusCode(_0x5a9c9f,null))[_0xece1('0x43')](handleError(_0x5a9c9f,null));};exports[_0xece1('0x54')]=function(_0x399690,_0x3e36f6,_0x519a62){if(_0x399690['body']['id']){delete _0x399690[_0xece1('0x46')]['id'];}return db[_0xece1('0x2c')][_0xece1('0x48')]({'where':{'id':_0x399690['params']['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x3e36f6,null))[_0xece1('0x24')](function(_0x2720ea){if(_0x2720ea){_0x399690['body'][_0xece1('0x55')]=_0x2720ea['id'];return db[_0xece1('0x56')][_0xece1('0x45')](_0x399690[_0xece1('0x46')]);}})[_0xece1('0x24')](respondWithResult(_0x3e36f6,null))[_0xece1('0x43')](handleError(_0x3e36f6,null));};exports['getMessages']=function(_0x4494d2,_0x13af42,_0x3c85cc){var _0x5da0d3={};var _0xf9895e={};var _0x544bdd;var _0x3ad8f3;return db['ChatGroup']['findOne']({'where':{'id':_0x4494d2[_0xece1('0x44')]['id']}})[_0xece1('0x24')](handleEntityNotFound(_0x13af42,null))[_0xece1('0x24')](function(_0x32552e){if(_0x32552e){_0x544bdd=_0x32552e;_0xf9895e[_0xece1('0x2f')]=_['keys'](db[_0xece1('0x56')][_0xece1('0x2d')]);_0xf9895e[_0xece1('0x30')]=_[_0xece1('0x31')](_0x4494d2[_0xece1('0x30')]);_0xf9895e[_0xece1('0x3b')]=_[_0xece1('0x32')](_0xf9895e[_0xece1('0x2f')],_0xf9895e[_0xece1('0x30')]);_0x5da0d3[_0xece1('0x33')]=_['intersection'](_0xf9895e[_0xece1('0x2f')],qs[_0xece1('0x34')](_0x4494d2[_0xece1('0x30')][_0xece1('0x34')]));_0x5da0d3[_0xece1('0x33')]=_0x5da0d3[_0xece1('0x33')]['length']?_0x5da0d3[_0xece1('0x33')]:_0xf9895e[_0xece1('0x2f')];_0x5da0d3[_0xece1('0x37')]=qs['sort'](_0x4494d2[_0xece1('0x30')][_0xece1('0x38')]);_0x5da0d3['where']=qs[_0xece1('0x3b')](_[_0xece1('0x3a')](_0x4494d2[_0xece1('0x30')],_0xf9895e[_0xece1('0x3b')]));if(_0x4494d2[_0xece1('0x30')][_0xece1('0x3c')]){_0x5da0d3[_0xece1('0x39')]=_[_0xece1('0x3d')](_0x5da0d3[_0xece1('0x39')],{'$or':_['map'](_0x5da0d3[_0xece1('0x33')],function(_0x55e969){var _0x368fe6={};_0x368fe6[_0x55e969]={'$like':'%'+_0x4494d2[_0xece1('0x30')][_0xece1('0x3c')]+'%'};return _0x368fe6;})});}if(_0x4494d2[_0xece1('0x30')][_0xece1('0x57')]){var _0x5b31c4=_0x4494d2[_0xece1('0x30')]['$gte']['split'](',');var _0x3ec215={};_0x3ec215[_0x5b31c4[0x0]]={'$gte':moment(_0x5b31c4[0x1])['format'](_0xece1('0x58'))};_0x5da0d3[_0xece1('0x39')]=_['merge'](_0x5da0d3[_0xece1('0x39')],_0x3ec215);}_0x5da0d3=_['merge']({},_0x5da0d3,_0x4494d2['options']);return _0x544bdd['getMessages'](_0x5da0d3);}})[_0xece1('0x24')](function(_0x4383f4){if(_0x4383f4){_0x3ad8f3=_0x4383f4[_0xece1('0x35')];if(!_0x4494d2[_0xece1('0x30')][_0xece1('0x36')](_0xece1('0x52'))){_0x5da0d3[_0xece1('0x1f')]=qs['limit'](_0x4494d2['query'][_0xece1('0x1f')]);_0x5da0d3[_0xece1('0x1c')]=qs[_0xece1('0x1c')](_0x4494d2[_0xece1('0x30')][_0xece1('0x1c')]);}return _0x544bdd[_0xece1('0x59')](_0x5da0d3);}})['then'](function(_0x321c3c){if(_0x321c3c){return _0x321c3c?{'count':_0x3ad8f3,'rows':_0x321c3c}:null;}})[_0xece1('0x24')](respondWithResult(_0x13af42,null))[_0xece1('0x43')](handleError(_0x13af42,null));}; \ No newline at end of file +var _0x827e=['update','then','destroy','error','name','send','index','ChatGroup','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','length','attributes','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','User','order','filter','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x575a56,_0x5a5f09){var _0x34b558=function(_0x343586){while(--_0x343586){_0x575a56['push'](_0x575a56['shift']());}};_0x34b558(++_0x5a5f09);}(_0x827e,0x1b6));var _0xe827=function(_0x1c4306,_0x3c2a2c){_0x1c4306=_0x1c4306-0x0;var _0xb429a6=_0x827e[_0x1c4306];return _0xb429a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe827('0x0'));var zipdir=require(_0xe827('0x1'));var jsonpatch=require(_0xe827('0x2'));var rp=require(_0xe827('0x3'));var moment=require(_0xe827('0x4'));var BPromise=require(_0xe827('0x5'));var Mustache=require(_0xe827('0x6'));var util=require(_0xe827('0x7'));var path=require(_0xe827('0x8'));var sox=require('sox');var csv=require(_0xe827('0x9'));var ejs=require(_0xe827('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe827('0xb'));var squel=require(_0xe827('0xc'));var crypto=require(_0xe827('0xd'));var jsforce=require(_0xe827('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe827('0x9'));var querystring=require(_0xe827('0xf'));var Papa=require(_0xe827('0x10'));var Redis=require(_0xe827('0x11'));var authService=require(_0xe827('0x12'));var qs=require(_0xe827('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe827('0x14'));var logger=require(_0xe827('0x15'))(_0xe827('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe827('0x17'))['db'];config[_0xe827('0x18')]=_[_0xe827('0x19')](config[_0xe827('0x18')],{'host':_0xe827('0x1a'),'port':0x18eb});var socket=require(_0xe827('0x1b'))(new Redis(config[_0xe827('0x18')]));require('./chatGroup.socket')[_0xe827('0x1c')](socket);function respondWithStatusCode(_0x1fe1ce,_0x2f8820){_0x2f8820=_0x2f8820||0xcc;return function(_0x8567c7){if(_0x8567c7){return _0x1fe1ce[_0xe827('0x1d')](_0x2f8820);}return _0x1fe1ce['status'](_0x2f8820)[_0xe827('0x1e')]();};}function respondWithResult(_0x49433b,_0x4c37ca){_0x4c37ca=_0x4c37ca||0xc8;return function(_0x2f83df){if(_0x2f83df){return _0x49433b[_0xe827('0x1f')](_0x4c37ca)[_0xe827('0x20')](_0x2f83df);}};}function respondWithFilteredResult(_0x152c2a,_0x32f7db){return function(_0xf81129){if(_0xf81129){var _0x42645e=typeof _0x32f7db[_0xe827('0x21')]===_0xe827('0x22')&&typeof _0x32f7db[_0xe827('0x23')]===_0xe827('0x22');var _0x13ed54=_0xf81129[_0xe827('0x24')];var _0x5866e5=_0x42645e?0x0:_0x32f7db['offset'];var _0x14fd97=_0x42645e?_0xf81129['count']:_0x32f7db[_0xe827('0x21')]+_0x32f7db[_0xe827('0x23')];var _0x582e79;if(_0x14fd97>=_0x13ed54){_0x14fd97=_0x13ed54;_0x582e79=0xc8;}else{_0x582e79=0xce;}_0x152c2a[_0xe827('0x1f')](_0x582e79);return _0x152c2a[_0xe827('0x25')](_0xe827('0x26'),_0x5866e5+'-'+_0x14fd97+'/'+_0x13ed54)[_0xe827('0x20')](_0xf81129);}return null;};}function patchUpdates(_0x22fcbe){return function(_0x8b11bb){try{jsonpatch[_0xe827('0x27')](_0x8b11bb,_0x22fcbe,!![]);}catch(_0x3e619d){return BPromise[_0xe827('0x28')](_0x3e619d);}return _0x8b11bb[_0xe827('0x29')]();};}function saveUpdates(_0x4f1186,_0x32db4){return function(_0x3b9f13){if(_0x3b9f13){return _0x3b9f13[_0xe827('0x2a')](_0x4f1186)[_0xe827('0x2b')](function(_0xfb620f){return _0xfb620f;});}return null;};}function removeEntity(_0x156e1c,_0x4052e8){return function(_0x114a96){if(_0x114a96){return _0x114a96[_0xe827('0x2c')]()[_0xe827('0x2b')](function(){_0x156e1c[_0xe827('0x1f')](0xcc)[_0xe827('0x1e')]();});}};}function handleEntityNotFound(_0x7a5370,_0x4089af){return function(_0x5c2f16){if(!_0x5c2f16){_0x7a5370['sendStatus'](0x194);}return _0x5c2f16;};}function handleError(_0x32fe14,_0x2a2f7d){_0x2a2f7d=_0x2a2f7d||0x1f4;return function(_0x12d9e4){logger[_0xe827('0x2d')](_0x12d9e4['stack']);if(_0x12d9e4[_0xe827('0x2e')]){delete _0x12d9e4[_0xe827('0x2e')];}_0x32fe14[_0xe827('0x1f')](_0x2a2f7d)[_0xe827('0x2f')](_0x12d9e4);};}exports[_0xe827('0x30')]=function(_0x15eae6,_0x2c9e2a){var _0x507e9c={},_0x50d0e9={},_0x5ebfda={'count':0x0,'rows':[]};var _0x4f8f76=_['map'](db[_0xe827('0x31')][_0xe827('0x32')],function(_0x15de88){return{'name':_0x15de88[_0xe827('0x33')],'type':_0x15de88['type']['key']};});_0x50d0e9[_0xe827('0x34')]=_[_0xe827('0x35')](_0x4f8f76,_0xe827('0x2e'));_0x50d0e9[_0xe827('0x36')]=_[_0xe827('0x37')](_0x15eae6[_0xe827('0x36')]);_0x50d0e9[_0xe827('0x38')]=_[_0xe827('0x39')](_0x50d0e9[_0xe827('0x34')],_0x50d0e9[_0xe827('0x36')]);_0x507e9c['attributes']=_['intersection'](_0x50d0e9[_0xe827('0x34')],qs[_0xe827('0x3a')](_0x15eae6['query'][_0xe827('0x3a')]));_0x507e9c['attributes']=_0x507e9c['attributes'][_0xe827('0x3b')]?_0x507e9c[_0xe827('0x3c')]:_0x50d0e9['model'];if(!_0x15eae6[_0xe827('0x36')]['hasOwnProperty']('nolimit')){_0x507e9c[_0xe827('0x23')]=qs[_0xe827('0x23')](_0x15eae6[_0xe827('0x36')][_0xe827('0x23')]);_0x507e9c[_0xe827('0x21')]=qs[_0xe827('0x21')](_0x15eae6['query'][_0xe827('0x21')]);}_0x507e9c['order']=qs[_0xe827('0x3d')](_0x15eae6[_0xe827('0x36')]['sort']);_0x507e9c[_0xe827('0x3e')]=qs['filters'](_[_0xe827('0x3f')](_0x15eae6['query'],_0x50d0e9[_0xe827('0x38')]),_0x4f8f76);if(_0x15eae6[_0xe827('0x36')]['filter']){_0x507e9c[_0xe827('0x3e')]=_['merge'](_0x507e9c[_0xe827('0x3e')],{'$or':_['map'](_0x4f8f76,function(_0x5069e4){if(_0x5069e4[_0xe827('0x40')]!==_0xe827('0x41')){var _0x527a15={};_0x527a15[_0x5069e4[_0xe827('0x2e')]]={'$like':'%'+_0x15eae6[_0xe827('0x36')]['filter']+'%'};return _0x527a15;}})});}_0x507e9c=_[_0xe827('0x42')]({},_0x507e9c,_0x15eae6[_0xe827('0x43')]);var _0x57de7e={'where':_0x507e9c[_0xe827('0x3e')]};return db[_0xe827('0x31')][_0xe827('0x24')](_0x57de7e)[_0xe827('0x2b')](function(_0x2a7a4f){_0x5ebfda[_0xe827('0x24')]=_0x2a7a4f;if(_0x15eae6[_0xe827('0x36')][_0xe827('0x44')]){_0x507e9c[_0xe827('0x45')]=[{'all':!![]}];}return db[_0xe827('0x31')][_0xe827('0x46')](_0x507e9c);})[_0xe827('0x2b')](function(_0x4e697d){_0x5ebfda['rows']=_0x4e697d;return _0x5ebfda;})[_0xe827('0x2b')](respondWithFilteredResult(_0x2c9e2a,_0x507e9c))[_0xe827('0x47')](handleError(_0x2c9e2a,null));};exports[_0xe827('0x48')]=function(_0x558966,_0x798894){var _0x258fdb={'raw':!![],'where':{'id':_0x558966[_0xe827('0x49')]['id']}},_0x387a97={};_0x387a97[_0xe827('0x34')]=_['keys'](db['ChatGroup'][_0xe827('0x32')]);_0x387a97[_0xe827('0x36')]=_[_0xe827('0x37')](_0x558966[_0xe827('0x36')]);_0x387a97[_0xe827('0x38')]=_[_0xe827('0x39')](_0x387a97[_0xe827('0x34')],_0x387a97[_0xe827('0x36')]);_0x258fdb[_0xe827('0x3c')]=_[_0xe827('0x39')](_0x387a97[_0xe827('0x34')],qs[_0xe827('0x3a')](_0x558966[_0xe827('0x36')][_0xe827('0x3a')]));_0x258fdb[_0xe827('0x3c')]=_0x258fdb[_0xe827('0x3c')][_0xe827('0x3b')]?_0x258fdb[_0xe827('0x3c')]:_0x387a97[_0xe827('0x34')];if(_0x558966[_0xe827('0x36')]['includeAll']){_0x258fdb[_0xe827('0x45')]=[{'all':!![]}];}_0x258fdb=_[_0xe827('0x42')]({},_0x258fdb,_0x558966['options']);return db['ChatGroup'][_0xe827('0x4a')](_0x258fdb)[_0xe827('0x2b')](handleEntityNotFound(_0x798894,null))[_0xe827('0x2b')](respondWithResult(_0x798894,null))[_0xe827('0x47')](handleError(_0x798894,null));};exports[_0xe827('0x4b')]=function(_0x5589c2,_0x1a21ea){return db[_0xe827('0x31')]['create'](_0x5589c2[_0xe827('0x4c')],{})['then'](respondWithResult(_0x1a21ea,0xc9))['catch'](handleError(_0x1a21ea,null));};exports[_0xe827('0x2a')]=function(_0x3a9cce,_0x50e557){if(_0x3a9cce[_0xe827('0x4c')]['id']){delete _0x3a9cce[_0xe827('0x4c')]['id'];}return db[_0xe827('0x31')][_0xe827('0x4a')]({'where':{'id':_0x3a9cce['params']['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0x50e557,null))[_0xe827('0x2b')](saveUpdates(_0x3a9cce[_0xe827('0x4c')],null))[_0xe827('0x2b')](respondWithResult(_0x50e557,null))[_0xe827('0x47')](handleError(_0x50e557,null));};exports[_0xe827('0x2c')]=function(_0x2f091a,_0xd0bd93){return db[_0xe827('0x31')][_0xe827('0x4a')]({'where':{'id':_0x2f091a[_0xe827('0x49')]['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0xd0bd93,null))['then'](removeEntity(_0xd0bd93,null))[_0xe827('0x47')](handleError(_0xd0bd93,null));};exports[_0xe827('0x4d')]=function(_0xfa17e,_0x1bf86e){return db['ChatGroup'][_0xe827('0x4d')]()['then'](respondWithResult(_0x1bf86e,null))[_0xe827('0x47')](handleError(_0x1bf86e,null));};exports['getUnread']=function(_0x279470,_0x291a46,_0x3297ea){return db[_0xe827('0x4e')][_0xe827('0x24')]({'where':{'ChatGroupId':_0x279470[_0xe827('0x49')]['id'],'ToId':_0x279470[_0xe827('0x4f')]['id'],'read':![]}})[_0xe827('0x2b')](function(_0x31c9da){return{'id':_[_0xe827('0x50')](_0x279470['params']['id']),'count':_0x31c9da};})[_0xe827('0x2b')](respondWithResult(_0x291a46,null))[_0xe827('0x47')](handleError(_0x291a46,null));};exports[_0xe827('0x51')]=function(_0x756ff7,_0x31efbc,_0x238a56){return db[_0xe827('0x31')][_0xe827('0x4a')]({'where':{'id':_0x756ff7['params']['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0x31efbc,null))['then'](function(_0x1ed343){if(_0x1ed343){return _0x1ed343['addMembers'](_0x756ff7[_0xe827('0x4c')][_0xe827('0x52')],_['omit'](_0x756ff7[_0xe827('0x4c')],[_0xe827('0x52'),'id'])||{});}})[_0xe827('0x2b')](respondWithResult(_0x31efbc,null))[_0xe827('0x47')](handleError(_0x31efbc,null));};exports[_0xe827('0x53')]=function(_0x44d1df,_0x1fe704,_0x3d727a){var _0x31a5f1={};var _0x59a1f9={};var _0x383e7c;var _0x9c8529;return db[_0xe827('0x31')]['findOne']({'where':{'id':_0x44d1df[_0xe827('0x49')]['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0x1fe704,null))['then'](function(_0x36b39b){if(_0x36b39b){_0x383e7c=_0x36b39b;_0x59a1f9[_0xe827('0x34')]=_[_0xe827('0x37')](db[_0xe827('0x54')]['rawAttributes']);_0x59a1f9[_0xe827('0x36')]=_[_0xe827('0x37')](_0x44d1df['query']);_0x59a1f9['filters']=_[_0xe827('0x39')](_0x59a1f9[_0xe827('0x34')],_0x59a1f9[_0xe827('0x36')]);_0x31a5f1['attributes']=_[_0xe827('0x39')](_0x59a1f9[_0xe827('0x34')],qs[_0xe827('0x3a')](_0x44d1df[_0xe827('0x36')]['fields']));_0x31a5f1[_0xe827('0x3c')]=_0x31a5f1[_0xe827('0x3c')][_0xe827('0x3b')]?_0x31a5f1[_0xe827('0x3c')]:_0x59a1f9[_0xe827('0x34')];_0x31a5f1[_0xe827('0x55')]=qs[_0xe827('0x3d')](_0x44d1df[_0xe827('0x36')]['sort']);_0x31a5f1[_0xe827('0x3e')]=qs['filters'](_['pick'](_0x44d1df[_0xe827('0x36')],_0x59a1f9[_0xe827('0x38')]));if(_0x44d1df['query'][_0xe827('0x56')]){_0x31a5f1[_0xe827('0x3e')]=_[_0xe827('0x42')](_0x31a5f1[_0xe827('0x3e')],{'$or':_[_0xe827('0x35')](_0x31a5f1[_0xe827('0x3c')],function(_0x176ded){var _0x37b271={};_0x37b271[_0x176ded]={'$like':'%'+_0x44d1df[_0xe827('0x36')][_0xe827('0x56')]+'%'};return _0x37b271;})});}_0x31a5f1=_[_0xe827('0x42')]({},_0x31a5f1,_0x44d1df[_0xe827('0x43')]);return _0x383e7c[_0xe827('0x53')](_0x31a5f1);}})[_0xe827('0x2b')](function(_0x1ba02a){if(_0x1ba02a){_0x9c8529=_0x1ba02a[_0xe827('0x3b')];if(!_0x44d1df['query'][_0xe827('0x57')]('nolimit')){_0x31a5f1[_0xe827('0x23')]=qs['limit'](_0x44d1df[_0xe827('0x36')][_0xe827('0x23')]);_0x31a5f1[_0xe827('0x21')]=qs['offset'](_0x44d1df['query'][_0xe827('0x21')]);}return _0x383e7c[_0xe827('0x53')](_0x31a5f1);}})[_0xe827('0x2b')](function(_0x24219c){if(_0x24219c){return _0x24219c?{'count':_0x9c8529,'rows':_0x24219c}:null;}})[_0xe827('0x2b')](respondWithResult(_0x1fe704,null))[_0xe827('0x47')](handleError(_0x1fe704,null));};exports[_0xe827('0x58')]=function(_0x2f0d26,_0xc4e441,_0x5ba2a3){return db[_0xe827('0x31')][_0xe827('0x4a')]({'where':{'id':_0x2f0d26[_0xe827('0x49')]['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0xc4e441,null))[_0xe827('0x2b')](function(_0x5149f0){if(_0x5149f0){return _0x5149f0[_0xe827('0x58')](_0x2f0d26[_0xe827('0x36')][_0xe827('0x52')]);}})[_0xe827('0x2b')](respondWithStatusCode(_0xc4e441,null))['catch'](handleError(_0xc4e441,null));};exports[_0xe827('0x59')]=function(_0x1cded9,_0x2ad3e6,_0x45de21){if(_0x1cded9['body']['id']){delete _0x1cded9[_0xe827('0x4c')]['id'];}return db[_0xe827('0x31')][_0xe827('0x4a')]({'where':{'id':_0x1cded9[_0xe827('0x49')]['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0x2ad3e6,null))['then'](function(_0x267682){if(_0x267682){_0x1cded9[_0xe827('0x4c')][_0xe827('0x5a')]=_0x267682['id'];return db[_0xe827('0x4e')][_0xe827('0x4b')](_0x1cded9[_0xe827('0x4c')]);}})[_0xe827('0x2b')](respondWithResult(_0x2ad3e6,null))['catch'](handleError(_0x2ad3e6,null));};exports[_0xe827('0x5b')]=function(_0x3a9a96,_0x183dbe,_0x1df32d){var _0x4a64c6={};var _0x14c411={};var _0x924a3c;var _0x3d6e72;return db[_0xe827('0x31')]['findOne']({'where':{'id':_0x3a9a96[_0xe827('0x49')]['id']}})[_0xe827('0x2b')](handleEntityNotFound(_0x183dbe,null))[_0xe827('0x2b')](function(_0x287cdf){if(_0x287cdf){_0x924a3c=_0x287cdf;_0x14c411[_0xe827('0x34')]=_['keys'](db[_0xe827('0x4e')][_0xe827('0x32')]);_0x14c411[_0xe827('0x36')]=_[_0xe827('0x37')](_0x3a9a96['query']);_0x14c411['filters']=_[_0xe827('0x39')](_0x14c411['model'],_0x14c411[_0xe827('0x36')]);_0x4a64c6[_0xe827('0x3c')]=_['intersection'](_0x14c411['model'],qs['fields'](_0x3a9a96[_0xe827('0x36')]['fields']));_0x4a64c6[_0xe827('0x3c')]=_0x4a64c6['attributes']['length']?_0x4a64c6[_0xe827('0x3c')]:_0x14c411['model'];_0x4a64c6[_0xe827('0x55')]=qs[_0xe827('0x3d')](_0x3a9a96[_0xe827('0x36')][_0xe827('0x3d')]);_0x4a64c6[_0xe827('0x3e')]=qs[_0xe827('0x38')](_[_0xe827('0x3f')](_0x3a9a96[_0xe827('0x36')],_0x14c411['filters']));if(_0x3a9a96[_0xe827('0x36')][_0xe827('0x56')]){_0x4a64c6[_0xe827('0x3e')]=_['merge'](_0x4a64c6['where'],{'$or':_['map'](_0x4a64c6[_0xe827('0x3c')],function(_0x3c53fb){var _0x5228eb={};_0x5228eb[_0x3c53fb]={'$like':'%'+_0x3a9a96[_0xe827('0x36')]['filter']+'%'};return _0x5228eb;})});}if(_0x3a9a96[_0xe827('0x36')][_0xe827('0x5c')]){var _0x225362=_0x3a9a96[_0xe827('0x36')][_0xe827('0x5c')]['split'](',');var _0x3ab35a={};_0x3ab35a[_0x225362[0x0]]={'$gte':moment(_0x225362[0x1])[_0xe827('0x5d')](_0xe827('0x5e'))};_0x4a64c6['where']=_['merge'](_0x4a64c6[_0xe827('0x3e')],_0x3ab35a);}_0x4a64c6=_[_0xe827('0x42')]({},_0x4a64c6,_0x3a9a96['options']);return _0x924a3c[_0xe827('0x5b')](_0x4a64c6);}})[_0xe827('0x2b')](function(_0x462e56){if(_0x462e56){_0x3d6e72=_0x462e56[_0xe827('0x3b')];if(!_0x3a9a96['query'][_0xe827('0x57')](_0xe827('0x5f'))){_0x4a64c6[_0xe827('0x23')]=qs[_0xe827('0x23')](_0x3a9a96[_0xe827('0x36')][_0xe827('0x23')]);_0x4a64c6[_0xe827('0x21')]=qs[_0xe827('0x21')](_0x3a9a96[_0xe827('0x36')]['offset']);}return _0x924a3c['getMessages'](_0x4a64c6);}})['then'](function(_0x4bc2a5){if(_0x4bc2a5){return _0x4bc2a5?{'count':_0x3d6e72,'rows':_0x4bc2a5}:null;}})['then'](respondWithResult(_0x183dbe,null))[_0xe827('0x47')](handleError(_0x183dbe,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c78352d..454d815 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 _0x6440=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3cafb8,_0x32860e){var _0x4b7f85=function(_0x31b11d){while(--_0x31b11d){_0x3cafb8['push'](_0x3cafb8['shift']());}};_0x4b7f85(++_0x32860e);}(_0x6440,0x1de));var _0x0644=function(_0x1d6a82,_0x37c315){_0x1d6a82=_0x1d6a82-0x0;var _0x5834ac=_0x6440[_0x1d6a82];return _0x5834ac;};'use strict';var EventEmitter=require(_0x0644('0x0'));var ChatGroup=require(_0x0644('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x0644('0x2')](0x0);var events={'afterCreate':_0x0644('0x3'),'afterUpdate':_0x0644('0x4'),'afterDestroy':'remove'};function emitEvent(_0x46b094){return function(_0x40db45,_0x15eb72,_0x3fba73){ChatGroupEvents[_0x0644('0x5')](_0x46b094+':'+_0x40db45['id'],_0x40db45);ChatGroupEvents[_0x0644('0x5')](_0x46b094,_0x40db45);_0x3fba73(null);};}for(var e in events){if(events[_0x0644('0x6')](e)){var event=events[e];ChatGroup[_0x0644('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x6c99=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0xd24b43,_0x11caa4){var _0x2b1b44=function(_0x5b84af){while(--_0x5b84af){_0xd24b43['push'](_0xd24b43['shift']());}};_0x2b1b44(++_0x11caa4);}(_0x6c99,0x19b));var _0x96c9=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x6c99[_0x585d81];return _0x1aca0d;};'use strict';var EventEmitter=require(_0x96c9('0x0'));var ChatGroup=require(_0x96c9('0x1'))['db'][_0x96c9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x96c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x96c9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a9bd4){return function(_0x276fba,_0x15d946,_0x46973f){ChatGroupEvents['emit'](_0x2a9bd4+':'+_0x276fba['id'],_0x276fba);ChatGroupEvents['emit'](_0x2a9bd4,_0x276fba);_0x46973f(null);};}for(var e in events){if(events[_0x96c9('0x5')](e)){var event=events[e];ChatGroup[_0x96c9('0x6')](e,emitEvent(event));}}module[_0x96c9('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index ce153af..21e207f 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 _0xde73=['../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0xa30026,_0x3136b6){var _0x2bb310=function(_0x8a3b65){while(--_0x8a3b65){_0xa30026['push'](_0xa30026['shift']());}};_0x2bb310(++_0x3136b6);}(_0xde73,0x185));var _0x3de7=function(_0x4e6b0b,_0x3f1de2){_0x4e6b0b=_0x4e6b0b-0x0;var _0x2c9f2f=_0xde73[_0x4e6b0b];return _0x2c9f2f;};'use strict';var _=require(_0x3de7('0x0'));var util=require(_0x3de7('0x1'));var logger=require(_0x3de7('0x2'))('api');var moment=require(_0x3de7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3de7('0x4'));var fs=require('fs');var path=require(_0x3de7('0x5'));var rimraf=require(_0x3de7('0x6'));var config=require(_0x3de7('0x7'));var attributes=require('./chatGroup.attributes');module[_0x3de7('0x8')]=function(_0x572696,_0x271b02){return _0x572696[_0x3de7('0x9')](_0x3de7('0xa'),attributes,{'tableName':_0x3de7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfae=['bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','api','moment'];(function(_0x410bb2,_0x1e6277){var _0x430bc0=function(_0x117e33){while(--_0x117e33){_0x410bb2['push'](_0x410bb2['shift']());}};_0x430bc0(++_0x1e6277);}(_0xbfae,0x1a0));var _0xebfa=function(_0x3d5898,_0x4206bd){_0x3d5898=_0x3d5898-0x0;var _0x5cc107=_0xbfae[_0x3d5898];return _0x5cc107;};'use strict';var _=require(_0xebfa('0x0'));var util=require(_0xebfa('0x1'));var logger=require('../../config/logger')(_0xebfa('0x2'));var moment=require(_0xebfa('0x3'));var BPromise=require(_0xebfa('0x4'));var rp=require(_0xebfa('0x5'));var fs=require('fs');var path=require(_0xebfa('0x6'));var rimraf=require(_0xebfa('0x7'));var config=require(_0xebfa('0x8'));var attributes=require(_0xebfa('0x9'));module[_0xebfa('0xa')]=function(_0x314af0,_0x2a2d8d){return _0x314af0[_0xebfa('0xb')](_0xebfa('0xc'),attributes,{'tableName':_0xebfa('0xd'),'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 ba6c33c..3738da4 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 _0x35e2=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x4282a7,_0x351556){var _0x5b7916=function(_0x216bac){while(--_0x216bac){_0x4282a7['push'](_0x4282a7['shift']());}};_0x5b7916(++_0x351556);}(_0x35e2,0x1ed));var _0x235e=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x35e2[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x235e('0x0'));var util=require('util');var moment=require(_0x235e('0x1'));var BPromise=require(_0x235e('0x2'));var rs=require(_0x235e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x235e('0x4'))['db'];var utils=require(_0x235e('0x5'));var logger=require(_0x235e('0x6'))(_0x235e('0x7'));var config=require(_0x235e('0x8'));var jayson=require(_0x235e('0x9'));var client=jayson[_0x235e('0xa')][_0x235e('0xb')]({'port':0x232a});config[_0x235e('0xc')]=_[_0x235e('0xd')](config[_0x235e('0xc')],{'host':_0x235e('0xe'),'port':0x18eb});var socket=require(_0x235e('0xf'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x235e('0x10')](socket);function respondWithRpcPromise(_0x41f1c8,_0x4a3ec7,_0x40dc4d){return new BPromise(function(_0x22a10d,_0x247da6){return client[_0x235e('0x11')](_0x41f1c8,_0x40dc4d)[_0x235e('0x12')](function(_0x1a85f6){logger[_0x235e('0x13')](_0x235e('0x14'),_0x4a3ec7,_0x235e('0x15'));logger[_0x235e('0x16')](_0x235e('0x17'),_0x4a3ec7,_0x235e('0x15'),JSON[_0x235e('0x18')](_0x1a85f6));if(_0x1a85f6[_0x235e('0x19')]){if(_0x1a85f6['error']['code']===0x1f4){logger[_0x235e('0x19')](_0x235e('0x14'),_0x4a3ec7,_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);return _0x247da6(_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4a3ec7,_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);return _0x22a10d(_0x1a85f6[_0x235e('0x19')][_0x235e('0x1a')]);}else{logger[_0x235e('0x13')](_0x235e('0x14'),_0x4a3ec7,_0x235e('0x15'));_0x22a10d(_0x1a85f6['result'][_0x235e('0x1a')]);}})['catch'](function(_0x3b4ce9){logger[_0x235e('0x19')](_0x235e('0x14'),_0x4a3ec7,_0x3b4ce9);_0x247da6(_0x3b4ce9);});});} \ No newline at end of file +var _0xe011=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4942aa,_0xd6e51){var _0x1f3fac=function(_0x2987f9){while(--_0x2987f9){_0x4942aa['push'](_0x4942aa['shift']());}};_0x1f3fac(++_0xd6e51);}(_0xe011,0x14c));var _0x1e01=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xe011[_0x592e40];return _0x5d4288;};'use strict';var _=require(_0x1e01('0x0'));var util=require(_0x1e01('0x1'));var moment=require(_0x1e01('0x2'));var BPromise=require(_0x1e01('0x3'));var rs=require(_0x1e01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e01('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e01('0x6'))(_0x1e01('0x7'));var config=require(_0x1e01('0x8'));var jayson=require(_0x1e01('0x9'));var client=jayson[_0x1e01('0xa')][_0x1e01('0xb')]({'port':0x232a});config[_0x1e01('0xc')]=_[_0x1e01('0xd')](config[_0x1e01('0xc')],{'host':_0x1e01('0xe'),'port':0x18eb});var socket=require(_0x1e01('0xf'))(new Redis(config[_0x1e01('0xc')]));require(_0x1e01('0x10'))['register'](socket);function respondWithRpcPromise(_0x1859ee,_0x225d1e,_0x1c2e9c){return new BPromise(function(_0x209c7b,_0x56caad){return client['request'](_0x1859ee,_0x1c2e9c)['then'](function(_0x4d2942){logger[_0x1e01('0x11')](_0x1e01('0x12'),_0x225d1e,_0x1e01('0x13'));logger[_0x1e01('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x225d1e,_0x1e01('0x13'),JSON[_0x1e01('0x15')](_0x4d2942));if(_0x4d2942[_0x1e01('0x16')]){if(_0x4d2942[_0x1e01('0x16')]['code']===0x1f4){logger[_0x1e01('0x16')]('ChatGroup,\x20%s,\x20%s',_0x225d1e,_0x4d2942['error']['message']);return _0x56caad(_0x4d2942['error'][_0x1e01('0x17')]);}logger[_0x1e01('0x16')]('ChatGroup,\x20%s,\x20%s',_0x225d1e,_0x4d2942[_0x1e01('0x16')][_0x1e01('0x17')]);return _0x209c7b(_0x4d2942[_0x1e01('0x16')][_0x1e01('0x17')]);}else{logger[_0x1e01('0x11')]('ChatGroup,\x20%s,\x20%s',_0x225d1e,'request\x20sent');_0x209c7b(_0x4d2942[_0x1e01('0x18')][_0x1e01('0x17')]);}})[_0x1e01('0x19')](function(_0x141c0d){logger[_0x1e01('0x16')](_0x1e01('0x12'),_0x225d1e,_0x141c0d);_0x56caad(_0x141c0d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e256bb3..69cb54e 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 _0x3098=['length','chatGroup:','./chatGroup.events','update','emit','removeListener'];(function(_0xf4cdcd,_0x159fdb){var _0x1ab584=function(_0x161fae){while(--_0x161fae){_0xf4cdcd['push'](_0xf4cdcd['shift']());}};_0x1ab584(++_0x159fdb);}(_0x3098,0xd4));var _0x8309=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x3098[_0x5bd4f6];return _0x33a165;};'use strict';var ChatGroupEvents=require(_0x8309('0x0'));var events=['save','remove',_0x8309('0x1')];function createListener(_0x50364d,_0x43f999){return function(_0x4a05dc){_0x43f999[_0x8309('0x2')](_0x50364d,_0x4a05dc);};}function removeListener(_0x5646b7,_0x3dd970){return function(){ChatGroupEvents[_0x8309('0x3')](_0x5646b7,_0x3dd970);};}exports['register']=function(_0x9b911b){for(var _0x5ecd62=0x0,_0x409a82=events[_0x8309('0x4')];_0x5ecd62<_0x409a82;_0x5ecd62++){var _0x27dfe0=events[_0x5ecd62];var _0x472b7e=createListener(_0x8309('0x5')+_0x27dfe0,_0x9b911b);ChatGroupEvents['on'](_0x27dfe0,_0x472b7e);}}; \ No newline at end of file +var _0xe3ad=['remove','update','removeListener','length','chatGroup:','./chatGroup.events'];(function(_0x3937e7,_0x91712b){var _0x197ad7=function(_0x16e5b2){while(--_0x16e5b2){_0x3937e7['push'](_0x3937e7['shift']());}};_0x197ad7(++_0x91712b);}(_0xe3ad,0x1cd));var _0xde3a=function(_0x11f03d,_0x174f58){_0x11f03d=_0x11f03d-0x0;var _0x3e2d55=_0xe3ad[_0x11f03d];return _0x3e2d55;};'use strict';var ChatGroupEvents=require(_0xde3a('0x0'));var events=['save',_0xde3a('0x1'),_0xde3a('0x2')];function createListener(_0x21fd55,_0xe06157){return function(_0x5eac14){_0xe06157['emit'](_0x21fd55,_0x5eac14);};}function removeListener(_0x5c56a0,_0xb894e2){return function(){ChatGroupEvents[_0xde3a('0x3')](_0x5c56a0,_0xb894e2);};}exports['register']=function(_0x440f96){for(var _0x52ef99=0x0,_0x1178f3=events[_0xde3a('0x4')];_0x52ef99<_0x1178f3;_0x52ef99++){var _0xa53db2=events[_0x52ef99];var _0x4adcec=createListener(_0xde3a('0x5')+_0xa53db2,_0x440f96);ChatGroupEvents['on'](_0xa53db2,_0x4adcec);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2852c86..3e237fe 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 _0x667e=['get','isAuthenticated','index','/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','update','delete','removeMembers','exports','multer','connect-timeout','express','Router','fs-extra','./chatGroup.controller'];(function(_0x1db117,_0x40b195){var _0xd31170=function(_0x396a9a){while(--_0x396a9a){_0x1db117['push'](_0x1db117['shift']());}};_0xd31170(++_0x40b195);}(_0x667e,0x90));var _0xe667=function(_0x4fb992,_0x3a43f2){_0x4fb992=_0x4fb992-0x0;var _0x4271a5=_0x667e[_0x4fb992];return _0x4271a5;};'use strict';var multer=require(_0xe667('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe667('0x1'));var express=require(_0xe667('0x2'));var router=express[_0xe667('0x3')]();var fs_extra=require(_0xe667('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe667('0x5'));router[_0xe667('0x6')]('/',auth[_0xe667('0x7')](),controller[_0xe667('0x8')]);router[_0xe667('0x6')](_0xe667('0x9'),auth[_0xe667('0x7')](),controller['describe']);router[_0xe667('0x6')](_0xe667('0xa'),auth[_0xe667('0x7')](),controller['show']);router['get'](_0xe667('0xb'),auth['isAuthenticated'](),controller[_0xe667('0xc')]);router[_0xe667('0x6')](_0xe667('0xd'),auth[_0xe667('0x7')](),controller[_0xe667('0xe')]);router[_0xe667('0x6')](_0xe667('0xf'),auth[_0xe667('0x7')](),controller[_0xe667('0x10')]);router['post']('/',auth[_0xe667('0x7')](),controller[_0xe667('0x11')]);router[_0xe667('0x12')](_0xe667('0xd'),auth[_0xe667('0x7')](),controller[_0xe667('0x13')]);router[_0xe667('0x12')](_0xe667('0xf'),auth[_0xe667('0x7')](),controller['addMessage']);router[_0xe667('0x14')]('/:id',auth[_0xe667('0x7')](),controller[_0xe667('0x15')]);router['delete'](_0xe667('0xa'),auth[_0xe667('0x7')](),controller['destroy']);router[_0xe667('0x16')](_0xe667('0xd'),auth['isAuthenticated'](),controller[_0xe667('0x17')]);module[_0xe667('0x18')]=router; \ No newline at end of file +var _0x3318=['/:id/members','/:id/messages','getMessages','create','addMembers','post','addMessage','update','destroy','removeMembers','multer','path','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/unread','getUnread'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x3318,0xd2));var _0x8331=function(_0x4f3056,_0xe685f6){_0x4f3056=_0x4f3056-0x0;var _0x2b8af0=_0x3318[_0x4f3056];return _0x2b8af0;};'use strict';var multer=require(_0x8331('0x0'));var util=require('util');var path=require(_0x8331('0x1'));var timeout=require('connect-timeout');var express=require(_0x8331('0x2'));var router=express[_0x8331('0x3')]();var fs_extra=require(_0x8331('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8331('0x5'));var config=require('../../config/environment');var controller=require(_0x8331('0x6'));router['get']('/',auth[_0x8331('0x7')](),controller[_0x8331('0x8')]);router[_0x8331('0x9')](_0x8331('0xa'),auth['isAuthenticated'](),controller[_0x8331('0xb')]);router[_0x8331('0x9')](_0x8331('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8331('0x9')](_0x8331('0xd'),auth[_0x8331('0x7')](),controller[_0x8331('0xe')]);router['get'](_0x8331('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x8331('0x10'),auth[_0x8331('0x7')](),controller[_0x8331('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8331('0x12')]);router['post'](_0x8331('0xf'),auth['isAuthenticated'](),controller[_0x8331('0x13')]);router[_0x8331('0x14')](_0x8331('0x10'),auth[_0x8331('0x7')](),controller[_0x8331('0x15')]);router['put'](_0x8331('0xc'),auth['isAuthenticated'](),controller[_0x8331('0x16')]);router['delete'](_0x8331('0xc'),auth[_0x8331('0x7')](),controller[_0x8331('0x17')]);router['delete'](_0x8331('0xf'),auth[_0x8331('0x7')](),controller[_0x8331('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2f5587a..a8237c4 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 _0x1276=['thumb','TEXT','DATE','STRING','long','ENUM','out','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5c0374,_0x3f578c){var _0x514224=function(_0x905ec){while(--_0x905ec){_0x5c0374['push'](_0x5c0374['shift']());}};_0x514224(++_0x3f578c);}(_0x1276,0x131));var _0x6127=function(_0x2c12fa,_0x536777){_0x2c12fa=_0x2c12fa-0x0;var _0x78d795=_0x1276[_0x2c12fa];return _0x78d795;};'use strict';var Sequelize=require(_0x6127('0x0'));module[_0x6127('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6127('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x6127('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6127('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6127('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6127('0x6')]},'thirdDisposition':{'type':Sequelize[_0x6127('0x6')]},'note':{'type':Sequelize[_0x6127('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6127('0x6')]},'osVersion':{'type':Sequelize[_0x6127('0x6')]},'deviceModel':{'type':Sequelize[_0x6127('0x6')]},'deviceVendor':{'type':Sequelize[_0x6127('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6127('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6127('0x4')](_0x6127('0x7'))},'read1stAt':{'type':Sequelize[_0x6127('0x5')]},'lastMsgAt':{'type':Sequelize[_0x6127('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6127('0x8')]('in',_0x6127('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6127('0x6')]},'customerPort':{'type':Sequelize[_0x6127('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6127('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6127('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6127('0x2')]}}; \ No newline at end of file +var _0xe83d=['INTEGER','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x4e604d,_0x406668){var _0x309a25=function(_0x21414b){while(--_0x21414b){_0x4e604d['push'](_0x4e604d['shift']());}};_0x309a25(++_0x406668);}(_0xe83d,0x1a5));var _0xde83=function(_0x2f640d,_0x2ba443){_0x2f640d=_0x2f640d-0x0;var _0x3c2d49=_0xe83d[_0x2f640d];return _0x3c2d49;};'use strict';var Sequelize=require(_0xde83('0x0'));module[_0xde83('0x1')]={'closed':{'type':Sequelize[_0xde83('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xde83('0x3')](_0xde83('0x4'),_0xde83('0x5')),'defaultValue':_0xde83('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xde83('0x6')]},'mailTranscript':{'type':Sequelize[_0xde83('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xde83('0x8')]},'disposition':{'type':Sequelize[_0xde83('0x7')]},'secondDisposition':{'type':Sequelize[_0xde83('0x7')]},'thirdDisposition':{'type':Sequelize[_0xde83('0x7')]},'note':{'type':Sequelize[_0xde83('0x7')]},'browserName':{'type':Sequelize[_0xde83('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xde83('0x7')]},'osVersion':{'type':Sequelize[_0xde83('0x7')]},'deviceModel':{'type':Sequelize[_0xde83('0x7')]},'deviceVendor':{'type':Sequelize[_0xde83('0x7')]},'deviceType':{'type':Sequelize[_0xde83('0x7')]},'referer':{'type':Sequelize[_0xde83('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xde83('0x6')](_0xde83('0x9'))},'read1stAt':{'type':Sequelize[_0xde83('0x8')]},'lastMsgAt':{'type':Sequelize[_0xde83('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xde83('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xde83('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xde83('0xb')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index bffbf25..454e24a 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 _0x96ee=['color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','push','firstName','lastName','direction','read','Owner','get','mkdirSync','N.A.','closed','closedAt','disposition','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','value','renderFile','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','rimraf','request-promise','mustache','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','send','render','merge','contact','agent','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','query','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','find','create','body','update','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','attachId','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','System','customer','agentIdentifier','agent_alias','alias','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','getMyMessages','ChatInteractionId','secret','includeAgent','addTags','spread','Tag'];(function(_0x1cef73,_0xa6d6a){var _0x2fae84=function(_0x2e3955){while(--_0x2e3955){_0x1cef73['push'](_0x1cef73['shift']());}};_0x2fae84(++_0xa6d6a);}(_0x96ee,0xf5));var _0xe96e=function(_0x590381,_0x5c3948){_0x590381=_0x590381-0x0;var _0xe300df=_0x96ee[_0x590381];return _0xe300df;};'use strict';var rimraf=require(_0xe96e('0x0'));var zipdir=require('zip-dir');var rp=require(_0xe96e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe96e('0x2'));var util=require(_0xe96e('0x3'));var path=require(_0xe96e('0x4'));var ejs=require(_0xe96e('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe96e('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xe96e('0x7'));var pdf=require(_0xe96e('0x8'));var logger=require(_0xe96e('0x9'))(_0xe96e('0xa'));var config=require('../../config/environment');var db=require(_0xe96e('0xb'))['db'];config['redis']=_[_0xe96e('0xc')](config[_0xe96e('0xd')],{'host':_0xe96e('0xe'),'port':0x18eb});var socket=require(_0xe96e('0xf'))(new Redis(config[_0xe96e('0xd')]));require(_0xe96e('0x10'))[_0xe96e('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe96e('0x12')][_0xe96e('0x13')]({'port':0x232b});var client9004=jayson[_0xe96e('0x12')][_0xe96e('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x2f3307,_0x518d0f,_0x9c9186,_0xbfe6f9){return new BPromise(function(_0x36403d,_0x4278d2){var _0x4b91c5=_0xbfe6f9||client;return _0x4b91c5[_0xe96e('0x14')](_0x2f3307,_0x9c9186)[_0xe96e('0x15')](function(_0x1ad776){logger[_0xe96e('0x16')](_0xe96e('0x17'),_0x518d0f,'request\x20sent');logger[_0xe96e('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x518d0f,'request\x20sent',JSON[_0xe96e('0x19')](_0x1ad776));if(_0x1ad776[_0xe96e('0x1a')]){if(_0x1ad776[_0xe96e('0x1a')]['code']===0x1f4){logger[_0xe96e('0x1a')](_0xe96e('0x17'),_0x518d0f,_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);return _0x4278d2(_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);}logger['error'](_0xe96e('0x17'),_0x518d0f,_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);return _0x36403d(_0x1ad776[_0xe96e('0x1a')][_0xe96e('0x1b')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x518d0f,_0xe96e('0x1c'));_0x36403d(_0x1ad776[_0xe96e('0x1d')]['message']);}})[_0xe96e('0x1e')](function(_0x2fe9c1){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x518d0f,_0x2fe9c1);_0x4278d2(_0x2fe9c1);});});}function respondWithStatusCode(_0x3b076c,_0x2fd521){_0x2fd521=_0x2fd521||0xcc;return function(_0x3479d1){if(_0x3479d1){return _0x3b076c[_0xe96e('0x1f')](_0x2fd521);}return _0x3b076c[_0xe96e('0x20')](_0x2fd521)[_0xe96e('0x21')]();};}function respondWithResult(_0x38484f,_0x3a5ee7){_0x3a5ee7=_0x3a5ee7||0xc8;return function(_0x9ceb4b){if(_0x9ceb4b){return _0x38484f[_0xe96e('0x20')](_0x3a5ee7)[_0xe96e('0x22')](_0x9ceb4b);}};}function respondWithFilteredResult(_0x459c49,_0xf5d16){return function(_0x3b6206){if(_0x3b6206){var _0x440512=typeof _0xf5d16[_0xe96e('0x23')]===_0xe96e('0x24')&&typeof _0xf5d16[_0xe96e('0x25')]==='undefined';var _0x270985=_0x3b6206[_0xe96e('0x26')];var _0x5f17a5=_0x440512?0x0:_0xf5d16['offset'];var _0x94e258=_0x440512?_0x3b6206[_0xe96e('0x26')]:_0xf5d16[_0xe96e('0x23')]+_0xf5d16[_0xe96e('0x25')];var _0x2eee27;if(_0x94e258>=_0x270985){_0x94e258=_0x270985;_0x2eee27=0xc8;}else{_0x2eee27=0xce;}_0x459c49[_0xe96e('0x20')](_0x2eee27);return _0x459c49[_0xe96e('0x27')](_0xe96e('0x28'),_0x5f17a5+'-'+_0x94e258+'/'+_0x270985)['json'](_0x3b6206);}return null;};}function saveUpdates(_0x121a90){return function(_0xafeaa4){if(_0xafeaa4){return _0xafeaa4['update'](_0x121a90)['then'](function(_0x4b487d){return _0x4b487d;});}return null;};}function removeEntity(_0x400bd7){return function(_0x420297){if(_0x420297){return _0x420297[_0xe96e('0x29')]()['then'](function(){_0x400bd7[_0xe96e('0x20')](0xcc)[_0xe96e('0x21')]();});}};}function handleEntityNotFound(_0x43a5b5){return function(_0x36bc95){if(!_0x36bc95){_0x43a5b5[_0xe96e('0x1f')](0x194);}return _0x36bc95;};}function handleError(_0x3bca47,_0xa1b923){_0xa1b923=_0xa1b923||0x1f4;return function(_0xefe248){logger[_0xe96e('0x1a')](_0xefe248[_0xe96e('0x2a')]);if(_0xefe248[_0xe96e('0x2b')]){delete _0xefe248[_0xe96e('0x2b')];}_0x3bca47[_0xe96e('0x20')](_0xa1b923)[_0xe96e('0x2c')](_0xefe248);};}function getMustacheRender(_0x51b717,_0x2e6f15){return Mustache[_0xe96e('0x2d')](_0x51b717,_[_0xe96e('0x2e')](_0x2e6f15['body'],{'contact':_0x2e6f15[_0xe96e('0x2f')],'message':_0x2e6f15['message'],'agent':_0x2e6f15[_0xe96e('0x30')],'interaction':_0x2e6f15['interaction'],'account':_0x2e6f15[_0xe96e('0x31')]}))||'';}exports[_0xe96e('0x32')]=function(_0x246bab,_0xe3ac2a){var _0x5df22c={};var _0x378f11=_[_0xe96e('0x33')](db[_0xe96e('0x34')][_0xe96e('0x35')],function(_0x278fcb){return{'name':_0x278fcb[_0xe96e('0x36')],'type':_0x278fcb[_0xe96e('0x37')][_0xe96e('0x38')]};});_0x5df22c=qs[_0xe96e('0x39')](_0x378f11,_0x246bab);return interaction['findAll']('chat',_0x246bab[_0xe96e('0x3a')],_0x246bab['user'],_0x5df22c,_0x378f11)['then'](respondWithFilteredResult(_0xe3ac2a,_0x5df22c))[_0xe96e('0x1e')](handleError(_0xe3ac2a,null));};exports[_0xe96e('0x3b')]=function(_0x14d405,_0xb0ca4f){var _0x302ac2={'raw':![],'where':{'id':_0x14d405[_0xe96e('0x3c')]['id']}},_0x4ab390={};_0x4ab390[_0xe96e('0x3d')]=_['keys'](db[_0xe96e('0x34')]['rawAttributes']);_0x4ab390[_0xe96e('0x3a')]=_[_0xe96e('0x3e')](_0x14d405[_0xe96e('0x3a')]);_0x4ab390[_0xe96e('0x3f')]=_[_0xe96e('0x40')](_0x4ab390[_0xe96e('0x3d')],_0x4ab390[_0xe96e('0x3a')]);_0x302ac2[_0xe96e('0x41')]=_['intersection'](_0x4ab390[_0xe96e('0x3d')],qs[_0xe96e('0x42')](_0x14d405[_0xe96e('0x3a')][_0xe96e('0x42')]));_0x302ac2[_0xe96e('0x41')]=_0x302ac2['attributes'][_0xe96e('0x43')]?_0x302ac2[_0xe96e('0x41')]:_0x4ab390[_0xe96e('0x3d')];if(_0x14d405[_0xe96e('0x3a')][_0xe96e('0x44')]){_0x302ac2[_0xe96e('0x45')]=[{'all':!![]}];}_0x302ac2=_[_0xe96e('0x2e')]({},_0x302ac2,_0x14d405['options']);return db[_0xe96e('0x34')][_0xe96e('0x46')](_0x302ac2)[_0xe96e('0x15')](handleEntityNotFound(_0xb0ca4f,null))[_0xe96e('0x15')](respondWithResult(_0xb0ca4f,null))[_0xe96e('0x1e')](handleError(_0xb0ca4f,null));};exports['create']=function(_0x44917e,_0x3c1f63){return db[_0xe96e('0x34')][_0xe96e('0x47')](_0x44917e[_0xe96e('0x48')],{})['then'](respondWithResult(_0x3c1f63,0xc9))[_0xe96e('0x1e')](handleError(_0x3c1f63,null));};exports[_0xe96e('0x49')]=function(_0x1a9d84,_0x5e027b){if(_0x1a9d84['body']['id']){delete _0x1a9d84[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x1a9d84[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x5e027b,null))[_0xe96e('0x15')](saveUpdates(_0x1a9d84[_0xe96e('0x48')],null))['then'](respondWithResult(_0x5e027b,null))[_0xe96e('0x1e')](handleError(_0x5e027b,null));};exports['destroy']=function(_0x52be25,_0x22d2f4){return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x52be25['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x22d2f4,null))[_0xe96e('0x15')](removeEntity(_0x22d2f4,null))['catch'](handleError(_0x22d2f4,null));};exports[_0xe96e('0x4a')]=function(_0x3b4436,_0x226ba8){return db['ChatInteraction'][_0xe96e('0x4a')]()[_0xe96e('0x15')](respondWithResult(_0x226ba8,null))['catch'](handleError(_0x226ba8,null));};exports[_0xe96e('0x4b')]=function(_0x585f9f,_0x1964d5){var _0x393a08=_0x585f9f[_0xe96e('0x3c')]['id'];var _0x30db48;var _0x1f4989;var _0x4777da;return db[_0xe96e('0x34')]['findOne']({'where':{'id':_0x393a08}})[_0xe96e('0x15')](function(_0x96e9ab){_0x30db48=_0x96e9ab;return db[_0xe96e('0x4c')]['findOne']({'where':{'id':_0x96e9ab[_0xe96e('0x4d')]},'attributes':['id',_0xe96e('0x4e'),'vidaooEscalation',_0xe96e('0x4f'),_0xe96e('0x50'),_0xe96e('0x51')],'raw':!![]});})[_0xe96e('0x15')](function(_0x358eae){if(_0x358eae&&_0x358eae['vidaooApiKey']&&_0x358eae[_0xe96e('0x52')]){_0x1f4989=_0x358eae;var _0x2b5c42={'interaction':{'id':_0x393a08},'agent':{'id':_0x585f9f[_0xe96e('0x53')]['id'],'name':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x2b')],'fullname':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x54')],'email':_0x585f9f[_0xe96e('0x53')][_0xe96e('0x55')]},'contact':_0x585f9f[_0xe96e('0x48')][_0xe96e('0x2f')],'account':_0x585f9f[_0xe96e('0x48')]['account']};var _0x2d41dc={'rejectUnauthorized':![],'method':_0xe96e('0x56'),'url':_0xe96e('0x57'),'headers':{'X-APIKEY':_0x358eae[_0xe96e('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x585f9f[_0xe96e('0x53')][_0xe96e('0x55')]],'buttons':null,'topic':_0x1f4989['vidaooTopic'],'note':_[_0xe96e('0x58')](_0x1f4989[_0xe96e('0x50')])?null:getMustacheRender(_0x1f4989['vidaooNote'],_0x2b5c42),'metadata':null},'redirect':_0xe96e('0x59'),'json':!![]};try{if(!_['isNull'](_0x1f4989[_0xe96e('0x51')])){var _0x33d522=getMustacheRender(_0x1f4989[_0xe96e('0x51')],_0x2b5c42);var _0x17deab=JSON['parse'](_0x33d522);_0x2d41dc['body'][_0xe96e('0x5a')]=_0x17deab;}}catch(_0x2f0a6c){throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x5d'));}return rp(_0x2d41dc);}else{throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe96e('0x15')](function(_0x4ffc04){_0x4777da=_0x4ffc04;if(_0x4777da['id']){var _0x420da7={'body':_0x4777da[_0xe96e('0x5e')],'ChatWebsiteId':_0x1f4989['id'],'ChatInteractionId':_0x30db48['id'],'direction':_0xe96e('0x5f'),'UserId':_0x585f9f['user']['id']};return db[_0xe96e('0x60')][_0xe96e('0x47')](_0x420da7,{});}else{throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x61'));}})[_0xe96e('0x15')](function(){return _0x30db48[_0xe96e('0x62')]({'vidaooSessionId':_0x4777da['id']});})[_0xe96e('0x15')](respondWithResult(_0x1964d5,null))['catch'](handleError(_0x1964d5,null));};exports['customUpdate']=function(_0x2bb4f3,_0x42577c){if(_0x2bb4f3[_0xe96e('0x48')]['id']){delete _0x2bb4f3[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x2bb4f3[_0xe96e('0x3c')]['id']},'include':[{'model':db[_0xe96e('0x63')],'as':_0xe96e('0x64')}]})['then'](handleEntityNotFound(_0x42577c,null))['then'](saveUpdates(_0x2bb4f3[_0xe96e('0x48')],null))[_0xe96e('0x15')](respondWithResult(_0x42577c,null))[_0xe96e('0x1e')](handleError(_0x42577c,null));};exports[_0xe96e('0x65')]=function(_0x373989,_0x1ee563){if(_0x373989[_0xe96e('0x48')]['id']){delete _0x373989[_0xe96e('0x48')]['id'];}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x373989[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](function(_0x1ad969){if(!_0x1ad969){logger[_0xe96e('0x1a')](_0xe96e('0x66'),'abandon',0x194,_0xe96e('0x67'));_0x1ee563[_0xe96e('0x1f')](0x194);}else{if(_0x1ad969[_0xe96e('0x68')]){throw new db[(_0xe96e('0x5b'))][(_0xe96e('0x5c'))](_0xe96e('0x69'));}}return _0x1ad969;})[_0xe96e('0x15')](function(_0x5bbd94){if(_0x5bbd94){return _0x5bbd94[_0xe96e('0x49')]({'closed':_0x373989[_0xe96e('0x48')]['closed'],'disposition':_0x373989[_0xe96e('0x48')]['disposition']})[_0xe96e('0x15')](function(_0x3864a3){return _0x3864a3;});}})[_0xe96e('0x15')](function(){return respondWithRpcPromise('AbandonInteraction',_0xe96e('0x65'),_0x373989['body'],client9004);})[_0xe96e('0x15')](respondWithResult(_0x1ee563,null))['catch'](handleError(_0x1ee563,null));};exports[_0xe96e('0x6a')]=function(_0x13c2e3,_0xb51c71){_0x13c2e3[_0xe96e('0x48')][_0xe96e('0x2b')]=_0x13c2e3[_0xe96e('0x6b')][_0xe96e('0x6c')];_0x13c2e3[_0xe96e('0x48')][_0xe96e('0x6d')]=_0x13c2e3[_0xe96e('0x6b')]['filename'];_0x13c2e3[_0xe96e('0x48')]['type']=_0x13c2e3[_0xe96e('0x6b')][_0xe96e('0x6e')];return db[_0xe96e('0x6f')][_0xe96e('0x47')](_0x13c2e3[_0xe96e('0x48')])['then'](respondWithResult(_0xb51c71,0xc9))[_0xe96e('0x1e')](handleError(_0xb51c71,null));};exports[_0xe96e('0x70')]=function(_0x19c66f,_0x40e52c){return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x19c66f[_0xe96e('0x3c')]['id']},'raw':!![]})[_0xe96e('0x15')](handleEntityNotFound(_0x40e52c,null))[_0xe96e('0x15')](function(_0x12e021){if(_0x12e021){if(_0x12e021['closed']){return _0x40e52c[_0xe96e('0x20')](0x193)[_0xe96e('0x22')]({'status':0x193,'message':_0xe96e('0x72')});}return db[_0xe96e('0x6f')][_0xe96e('0x71')]({'where':{'id':_0x19c66f[_0xe96e('0x3a')][_0xe96e('0x73')]},'raw':!![]})[_0xe96e('0x15')](handleEntityNotFound(_0x40e52c,null));}})['then'](function(_0x1adaea){if(_0x1adaea){var _0x47b73a=_0x1adaea[_0xe96e('0x74')]!==null;var _0x2f9543=path[_0xe96e('0x75')](config[_0xe96e('0x76')],'server/files/attachments/');if(_0x47b73a){_0x2f9543=path[_0xe96e('0x75')](_0x2f9543,'offline-chat/');}var _0x1f6759=path[_0xe96e('0x75')](_0x2f9543,_0x1adaea[_0xe96e('0x6d')]);return _0x40e52c[_0xe96e('0x77')](_0x1f6759);}})[_0xe96e('0x1e')](handleError(_0x40e52c,null));};exports[_0xe96e('0x78')]=function(_0xd6004f,_0x5169ae){var _0x533e29=null;var _0x54913e=null;var _0x287fce=null;if(_0xd6004f[_0xe96e('0x48')]['id']){delete _0xd6004f[_0xe96e('0x48')]['id'];}if(_0xd6004f['body'][_0xe96e('0x79')]){_0x287fce=path[_0xe96e('0x75')](config[_0xe96e('0x76')],_0xe96e('0x7a'),util[_0xe96e('0x7b')](_0xe96e('0x7c'),Date[_0xe96e('0x7d')]()));_0xd6004f[_0xe96e('0x48')][_0xe96e('0x7e')]=_0x287fce;}return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0xd6004f['params']['id']},'include':[{'model':db[_0xe96e('0x60')],'as':_0xe96e('0x7f'),'include':[{'model':db[_0xe96e('0x80')],'as':_0xe96e('0x80')}]}]})[_0xe96e('0x15')](handleEntityNotFound(_0x5169ae,null))[_0xe96e('0x15')](saveUpdates(_0xd6004f[_0xe96e('0x48')],null))[_0xe96e('0x15')](function(_0x3395a3){if(_0x3395a3){_0x533e29=_0x3395a3;return db[_0xe96e('0x4c')][_0xe96e('0x46')]({'where':{'id':_0x533e29[_0xe96e('0x4d')]}});}})[_0xe96e('0x15')](function(_0x503442){if(_0x503442){_0x54913e=_0x503442;return db[_0xe96e('0x63')][_0xe96e('0x46')]({'where':{'id':_0x533e29[_0xe96e('0x81')]}});}})[_0xe96e('0x15')](function(_0x2b94ff){if(_0x2b94ff){if(_0x287fce){var _0x33727e=null;for(var _0x1d0b4c=0x1;_0x1d0b4c<_0x533e29[_0xe96e('0x7f')][_0xe96e('0x43')];++_0x1d0b4c){_0x33727e=_0x533e29[_0xe96e('0x7f')][_0x1d0b4c];var _0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e['agentAlias'],_0x33727e[_0xe96e('0x68')]):_0xe96e('0x83');var _0x584101=_0xd6004f[_0xe96e('0x48')][_0xe96e('0x84')]||util[_0xe96e('0x7b')]('%s%d','Visitor',_0x33727e[_0xe96e('0x81')]);switch(_0x54913e[_0xe96e('0x85')]){case'website_alias':_0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e['agentAlias'],_0x33727e[_0xe96e('0x68')]):'System';break;case _0xe96e('0x86'):_0x3d319f=_0x33727e[_0xe96e('0x68')]?_0x33727e[_0xe96e('0x80')][_0xe96e('0x87')]||_0x33727e[_0xe96e('0x80')]['fullname']:_0xe96e('0x83');break;case _0xe96e('0x88'):_0x3d319f=_0x33727e[_0xe96e('0x68')]?_0x33727e['User'][_0xe96e('0x54')]:'System';break;default:_0x3d319f=_0x33727e[_0xe96e('0x68')]?util[_0xe96e('0x7b')](_0xe96e('0x82'),_0x54913e[_0xe96e('0x89')],_0x33727e[_0xe96e('0x68')]):_0xe96e('0x83');}var _0x322e26=util[_0xe96e('0x7b')](_0xe96e('0x8a'),moment(_0x33727e[_0xe96e('0x8b')])[_0xe96e('0x7b')](_0xe96e('0x8c')),_0x33727e['direction']==='in'?_0x584101:_0x3d319f,_0x33727e[_0xe96e('0x48')]);if(!_0x33727e['secret']){fs[_0xe96e('0x8d')](_0x287fce,_0x322e26);}}return db[_0xe96e('0x8e')][_0xe96e('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xe96e('0x8f')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe96e('0x90'),'raw':!![]}]}]});}}})[_0xe96e('0x15')](function(_0x53c0b6){if(!_0x53c0b6||!_0x53c0b6[_0xe96e('0x91')]||!_0xd6004f[_0xe96e('0x48')])return _0x533e29;var _0xe3e71e=_0x53c0b6[_0xe96e('0x92')]();return respondWithRpcPromise(_0xe96e('0x93'),_0xe96e('0x94'),{'account':_0xe3e71e,'message':{'from':util[_0xe96e('0x7b')](_0xe96e('0x95'),_0x53c0b6['name'],_0x53c0b6[_0xe96e('0x55')]||_0x53c0b6['Smtp'][_0xe96e('0x53')]),'to':_0xd6004f[_0xe96e('0x48')][_0xe96e('0x79')],'subject':_0xe96e('0x96'),'text':util[_0xe96e('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0xd6004f[_0xe96e('0x48')]['mailTranscript']),'attachments':[{'path':_0x287fce}]}})[_0xe96e('0x15')](function(){return _0x533e29;})[_0xe96e('0x1e')](function(_0x4e8612){logger[_0xe96e('0x1a')](_0x4e8612);});})[_0xe96e('0x15')](respondWithStatusCode(_0x5169ae,0xc8))['catch'](handleError(_0x5169ae,null));};exports['addMessage']=function(_0x1d6c82,_0x1c72de){return db['ChatMessage']['find']({'where':{'id':_0x1d6c82['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x1c72de,null))[_0xe96e('0x15')](function(_0x204d41){if(_0x204d41){return _0x204d41[_0xe96e('0x97')](_0x1d6c82[_0xe96e('0x48')][_0xe96e('0x98')],_[_0xe96e('0x99')](_0x1d6c82[_0xe96e('0x48')],[_0xe96e('0x98'),'id'])||{});}})['then'](respondWithResult(_0x1c72de,null))[_0xe96e('0x1e')](handleError(_0x1c72de,null));};exports['getMessages']=function(_0x1b4e13,_0x104db5){var _0x4d93f4={'raw':![],'where':{}};var _0x236a05={};var _0x3c4487={'count':0x0,'rows':[]};return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x1b4e13[_0xe96e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x104db5,null))[_0xe96e('0x15')](function(_0x120001){if(_0x120001){_0x236a05[_0xe96e('0x3d')]=_[_0xe96e('0x3e')](db[_0xe96e('0x60')][_0xe96e('0x35')]);_0x236a05[_0xe96e('0x3a')]=_[_0xe96e('0x3e')](_0x1b4e13[_0xe96e('0x3a')]);_0x236a05[_0xe96e('0x3f')]=_['intersection'](_0x236a05[_0xe96e('0x3d')],_0x236a05[_0xe96e('0x3a')]);_0x4d93f4['attributes']=_[_0xe96e('0x40')](_0x236a05[_0xe96e('0x3d')],qs[_0xe96e('0x42')](_0x1b4e13[_0xe96e('0x3a')]['fields']));_0x4d93f4[_0xe96e('0x41')]=_0x4d93f4[_0xe96e('0x41')][_0xe96e('0x43')]?_0x4d93f4[_0xe96e('0x41')]:_0x236a05[_0xe96e('0x3d')];if(!_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x9a')](_0xe96e('0x9b'))){_0x4d93f4[_0xe96e('0x25')]=qs[_0xe96e('0x25')](_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x25')]);_0x4d93f4[_0xe96e('0x23')]=qs[_0xe96e('0x23')](_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x23')]);}_0x4d93f4['order']=qs[_0xe96e('0x9c')](_0x1b4e13['query'][_0xe96e('0x9c')]);_0x4d93f4['where']=qs[_0xe96e('0x3f')](_[_0xe96e('0x9d')](_0x1b4e13[_0xe96e('0x3a')],_0x236a05[_0xe96e('0x3f')]));_0x4d93f4[_0xe96e('0x9e')]['ChatInteractionId']=_0x120001['id'];if(_0x1b4e13['query'][_0xe96e('0x9f')]){_0x4d93f4[_0xe96e('0x9e')]=_['merge'](_0x4d93f4[_0xe96e('0x9e')],{'$or':_[_0xe96e('0x33')](_0x4d93f4[_0xe96e('0x41')],function(_0x33d216){var _0x5d4030={};_0x5d4030[_0x33d216]={'$like':'%'+_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x9f')]+'%'};return _0x5d4030;})});}if(_0x1b4e13['query'][_0xe96e('0xa0')]){var _0x59f6f9=_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0xa0')][_0xe96e('0xa1')](',');var _0x2a88da={};_0x2a88da[_0x59f6f9[0x0]]={'$gte':moment(_0x59f6f9[0x1])['format'](_0xe96e('0xa2'))};_0x4d93f4[_0xe96e('0x9e')]=_[_0xe96e('0x2e')](_0x4d93f4[_0xe96e('0x9e')],_0x2a88da);}_0x4d93f4=_[_0xe96e('0x2e')]({},_0x4d93f4,_0x1b4e13[_0xe96e('0xa3')]);return db[_0xe96e('0x60')][_0xe96e('0x26')]({'where':_0x4d93f4[_0xe96e('0x9e')]})[_0xe96e('0x15')](function(_0x5e93f1){_0x3c4487[_0xe96e('0x26')]=_0x5e93f1;if(_0x1b4e13[_0xe96e('0x3a')][_0xe96e('0x44')]){_0x4d93f4[_0xe96e('0x45')]=[{'all':!![]}];}return db[_0xe96e('0x60')][_0xe96e('0xa4')](_0x4d93f4);})[_0xe96e('0x15')](function(_0x2df5f3){_0x3c4487[_0xe96e('0xa5')]=_0x2df5f3;return _0x3c4487;});}})['then'](respondWithFilteredResult(_0x104db5,_0x4d93f4))['catch'](handleError(_0x104db5,null));};exports[_0xe96e('0xa6')]=function(_0x2111d1,_0x4cf3a3){var _0x4abe37={'where':{}},_0x581016={},_0x383fe8={'count':0x0,'rows':[]};return db[_0xe96e('0x34')][_0xe96e('0x71')]({'where':{'id':_0x2111d1[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x4cf3a3,null))[_0xe96e('0x15')](function(_0x413697){if(_0x413697){_0x581016['model']=_[_0xe96e('0x3e')](db[_0xe96e('0x60')][_0xe96e('0x35')]);_0x581016[_0xe96e('0x3a')]=_['keys'](_0x2111d1['query']);_0x581016[_0xe96e('0x3f')]=_['intersection'](_0x581016[_0xe96e('0x3d')],_0x581016[_0xe96e('0x3a')]);_0x4abe37['attributes']=_['intersection'](_0x581016['model'],qs[_0xe96e('0x42')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x42')]));_0x4abe37[_0xe96e('0x41')]=_0x4abe37[_0xe96e('0x41')][_0xe96e('0x43')]?_0x4abe37['attributes']:_0x581016[_0xe96e('0x3d')];if(!_0x2111d1[_0xe96e('0x3a')]['hasOwnProperty'](_0xe96e('0x9b'))){_0x4abe37[_0xe96e('0x25')]=qs[_0xe96e('0x25')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x25')]);_0x4abe37[_0xe96e('0x23')]=qs[_0xe96e('0x23')](_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x23')]);}_0x4abe37['order']=qs[_0xe96e('0x9c')](_0x2111d1['query'][_0xe96e('0x9c')]);_0x4abe37[_0xe96e('0x9e')]=qs[_0xe96e('0x3f')](_[_0xe96e('0x9d')](_0x2111d1[_0xe96e('0x3a')],_0x581016[_0xe96e('0x3f')]));_0x4abe37[_0xe96e('0x9e')][_0xe96e('0xa7')]=_0x413697['id'];if(_0x2111d1[_0xe96e('0x3a')][_0xe96e('0x9f')]){_0x4abe37[_0xe96e('0x9e')]=_[_0xe96e('0x2e')](_0x4abe37['where'],{'$or':_['map'](_0x4abe37[_0xe96e('0x41')],function(_0x4ca553){var _0xd40b59={};_0xd40b59[_0x4ca553]={'$like':'%'+_0x2111d1[_0xe96e('0x3a')]['filter']+'%'};return _0xd40b59;})});}_0x4abe37[_0xe96e('0x9e')][_0xe96e('0xa8')]=![];if(_0x2111d1[_0xe96e('0x3a')]['id']){_0x4abe37['where']['id']={'$gt':_0x2111d1[_0xe96e('0x3a')]['id']};}_0x4abe37=_[_0xe96e('0x2e')]({},_0x4abe37,_0x2111d1[_0xe96e('0xa3')]);return db[_0xe96e('0x60')][_0xe96e('0x26')]({'where':_0x4abe37[_0xe96e('0x9e')]})[_0xe96e('0x15')](function(_0xe1f2aa){_0x383fe8[_0xe96e('0x26')]=_0xe1f2aa;_0x4abe37[_0xe96e('0x45')]=[];if(_0x2111d1['query'][_0xe96e('0xa9')]){_0x4abe37['include']['push']({'model':db[_0xe96e('0x80')],'as':'User','attributes':['id','fullname','alias']});}if(_0x2111d1[_0xe96e('0x3a')]['includeAll']){_0x4abe37[_0xe96e('0x45')]=[{'all':!![]}];}return db['ChatMessage'][_0xe96e('0xa4')](_0x4abe37);})[_0xe96e('0x15')](function(_0x6e0bd4){_0x383fe8[_0xe96e('0xa5')]=_0x6e0bd4;return _0x383fe8;});}})[_0xe96e('0x15')](respondWithFilteredResult(_0x4cf3a3,_0x4abe37))['catch'](handleError(_0x4cf3a3,null));};exports[_0xe96e('0xaa')]=function(_0x3f1d4f,_0x37bb01){return db['ChatInteraction'][_0xe96e('0x46')]({'where':{'id':_0x3f1d4f[_0xe96e('0x3c')]['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x37bb01,null))[_0xe96e('0x15')](function(_0x5a0cd8){if(_0x5a0cd8){return _0x5a0cd8['setTags'](_0x3f1d4f[_0xe96e('0x48')][_0xe96e('0x98')],_['omit'](_0x3f1d4f['body'],['ids','id'])||{})[_0xe96e('0xab')](function(){return db[_0xe96e('0xac')][_0xe96e('0xa4')]({'attributes':['id',_0xe96e('0x2b'),_0xe96e('0xad')],'where':{'id':_0x3f1d4f['body'][_0xe96e('0x98')]}});})[_0xe96e('0x15')](function(_0x27aa9c){socket['emit'](_0xe96e('0xae'),{'id':Number(_0x3f1d4f[_0xe96e('0x3c')]['id']),'tags':_0x27aa9c||[]});return{'id':Number(_0x3f1d4f['params']['id']),'tags':_0x27aa9c||[]};});}})['then'](respondWithResult(_0x37bb01,null))[_0xe96e('0x1e')](handleError(_0x37bb01,null));};exports[_0xe96e('0xaf')]=function(_0xb8a649,_0x4ea8ae){return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0xb8a649['params']['id']}})[_0xe96e('0x15')](handleEntityNotFound(_0x4ea8ae,null))[_0xe96e('0x15')](function(_0x2a79ec){if(_0x2a79ec){return _0x2a79ec[_0xe96e('0xaf')](_0xb8a649[_0xe96e('0x3a')][_0xe96e('0x98')]);}})[_0xe96e('0x15')](respondWithStatusCode(_0x4ea8ae,null))[_0xe96e('0x1e')](handleError(_0x4ea8ae,null));};exports[_0xe96e('0x77')]=function(_0x4c275a,_0x4a3211){var _0x4decb6=moment()[_0xe96e('0xb0')]()[_0xe96e('0xb1')]();var _0x47dcc5=path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xb3'),_0xe96e('0xb4'));var _0x140ac5=path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xb3'),_0xe96e('0xb5'));var _0x414c49=path[_0xe96e('0x75')](_0x47dcc5,_0x4decb6);var _0x29dc15=util[_0xe96e('0x7b')]('transcript-%d-%s.zip',_0x4c275a[_0xe96e('0x3c')]['id'],_0x4decb6);var _0x39bcd9=path['join'](_0x47dcc5,_0x29dc15);var _0x5f240c=[];_0x5f240c[_0xe96e('0xb6')]({'model':db[_0xe96e('0x80')],'as':_0xe96e('0x80'),'attributes':['id','fullname'],'raw':!![]});_0x5f240c['push']({'model':db[_0xe96e('0x63')],'as':_0xe96e('0x64'),'attributes':['id',_0xe96e('0xb7'),_0xe96e('0xb8')],'raw':!![]});if(_0x4c275a['query'][_0xe96e('0xb5')]){_0x5f240c[_0xe96e('0xb6')]({'model':db['Attachment'],'as':_0xe96e('0x6f'),'raw':!![]});}var _0x2b6c77=[{'model':db[_0xe96e('0x60')],'as':_0xe96e('0x7f'),'attributes':['id','body',_0xe96e('0x8b'),_0xe96e('0xb9'),_0xe96e('0xa8'),_0xe96e('0xba')],'include':_0x5f240c}];_0x2b6c77['push']({'model':db[_0xe96e('0x4c')],'as':'Account','attributes':['id',_0xe96e('0x2b')]});_0x2b6c77[_0xe96e('0xb6')]({'model':db[_0xe96e('0x80')],'as':_0xe96e('0xbb'),'attributes':['id',_0xe96e('0x54')]});return db[_0xe96e('0x34')][_0xe96e('0x46')]({'where':{'id':_0x4c275a[_0xe96e('0x3c')]['id']},'include':_0x2b6c77})['then'](handleEntityNotFound(_0x4a3211,null))[_0xe96e('0x15')](function(_0xf4f2f3){if(_0xf4f2f3){var _0x35a58d=_0xf4f2f3[_0xe96e('0xbc')]({'plain':!![]});fs[_0xe96e('0xbd')](_0x414c49);var _0x2986e8={'channel':'Chat','account':_0x35a58d['Account']['name'],'agent':_0x35a58d[_0xe96e('0xbb')]?_0x35a58d[_0xe96e('0xbb')][_0xe96e('0x54')]:_0xe96e('0xbe'),'createdAt':moment(_0x35a58d['createdAt'])[_0xe96e('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe96e('0xb1')](),'closedAt':_0x35a58d[_0xe96e('0xbf')]?moment(_0x35a58d[_0xe96e('0xc0')])[_0xe96e('0x7b')](_0xe96e('0xa2'))[_0xe96e('0xb1')]():'','disposition':_0x35a58d[_0xe96e('0xc1')],'chatInfo':{'browser':_0x35a58d[_0xe96e('0xc2')],'os':_0x35a58d[_0xe96e('0xc3')],'referer':_0x35a58d['referer'],'customerIp':_0x35a58d[_0xe96e('0xc4')],'customerPort':_0x35a58d[_0xe96e('0xc5')]?_0x35a58d[_0xe96e('0xc5')]:_0xe96e('0xbe')},'messages':_(_0x35a58d[_0xe96e('0x7f')])[_0xe96e('0xc6')]()[_0xe96e('0x9f')]({'secret':![]})[_0xe96e('0x33')](function(_0x1831e3){if(_0x1831e3[_0xe96e('0x6f')]){var _0x3d3f49=path[_0xe96e('0x75')](_0x140ac5,_0x1831e3[_0xe96e('0x6f')]['basename']);if(fs['existsSync'](_0x3d3f49)){fs[_0xe96e('0xc7')](_0x3d3f49)[_0xe96e('0xc8')](fs['createWriteStream'](path[_0xe96e('0x75')](_0x414c49,_0x1831e3['Attachment'][_0xe96e('0x6d')])));}}return{'date':moment(_0x1831e3[_0xe96e('0x8b')])[_0xe96e('0x7b')](_0xe96e('0xa2'))[_0xe96e('0xb1')](),'sender':_0x1831e3['direction']===_0xe96e('0x5f')?_0x1831e3['User']?_0x1831e3['User'][_0xe96e('0x54')]:_0xe96e('0x83'):_0x1831e3[_0xe96e('0x64')][_0xe96e('0xb7')]+(_0x1831e3[_0xe96e('0x64')]['lastName']?'\x20'+_0x1831e3[_0xe96e('0x64')][_0xe96e('0xb8')]:''),'body':_0x1831e3['Attachment']?_0x1831e3['Attachment'][_0xe96e('0x6d')]:_0x1831e3[_0xe96e('0x48')],'direction':_0x1831e3[_0xe96e('0xb9')]===_0xe96e('0x5f')?'A':'C','secret':_0x1831e3[_0xe96e('0xa8')],'read':_0x1831e3[_0xe96e('0xba')],'attachment':_0x1831e3[_0xe96e('0x6f')]};})[_0xe96e('0xc9')]()};return ejs[_0xe96e('0xca')](path[_0xe96e('0x75')](config['root'],_0xe96e('0xb2'),_0xe96e('0xcb'),_0xe96e('0xcc')),{'interaction':_0x2986e8})[_0xe96e('0x15')](function(_0x826008){var _0x3d5cec=path[_0xe96e('0x75')](_0x414c49,_0xe96e('0xcd')+_0x35a58d['id']+'-'+_0x4decb6+'.pdf');var _0x31244c={'path':_0x3d5cec,'channel':_0xe96e('0xce'),'interactionId':_0x35a58d['id']};return pdf[_0xe96e('0xcf')](_0x826008,_0x31244c);})[_0xe96e('0x15')](function(){return new Promise(function(_0x3792b0,_0x178ed3){zipdir(_0x414c49,{'saveTo':_0x39bcd9},function(_0x1b464b,_0x4d55fa){if(_0x1b464b)return _0x178ed3(_0x1b464b);return _0x3792b0(_0x4d55fa);});})[_0xe96e('0x15')](function(){return new BPromise(function(_0xd121bb,_0x587609){rimraf(_0x414c49,function(_0x211e62){if(_0x211e62)_0x587609(_0x211e62);return _0xd121bb();});});})[_0xe96e('0x15')](function(){return _0x4a3211[_0xe96e('0x77')](_0x39bcd9,_0x29dc15,function(_0x214a83){if(_0x214a83){logger[_0xe96e('0x1a')](_0xe96e('0xd0'),_0x214a83);}else{fs['unlinkSync'](_0x39bcd9);}});});});}else{return _0x4a3211['sendStatus'](0xc8);}})['catch'](handleError(_0x4a3211,null));}; \ No newline at end of file +var _0x200a=['pathTranscript','Messages','User','ChatWebsiteId','CmContact','ContactId','format','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','agent_alias','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatMessage','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','push','includeAll','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','firstName','lastName','attachments','read','Owner','get','mkdirSync','Chat','browserName','referer','customerPort','N.A.','Attachment','existsSync','createReadStream','createWriteStream','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','stack','name','send','merge','body','contact','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','query','user','model','keys','rawAttributes','filters','attributes','intersection','fields','length','include','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','basename','filename','file','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0x200a,0x122));var _0xa200=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x200a[_0x13d07a];return _0x5ee0ee;};'use strict';var rimraf=require(_0xa200('0x0'));var zipdir=require(_0xa200('0x1'));var rp=require('request-promise');var moment=require(_0xa200('0x2'));var BPromise=require(_0xa200('0x3'));var Mustache=require(_0xa200('0x4'));var util=require(_0xa200('0x5'));var path=require(_0xa200('0x6'));var ejs=require(_0xa200('0x7'));var fs=require('fs');var _=require(_0xa200('0x8'));var Redis=require(_0xa200('0x9'));var interaction=require(_0xa200('0xa'));var qs=require(_0xa200('0xb'));var pdf=require(_0xa200('0xc'));var logger=require(_0xa200('0xd'))(_0xa200('0xe'));var config=require(_0xa200('0xf'));var db=require(_0xa200('0x10'))['db'];config[_0xa200('0x11')]=_[_0xa200('0x12')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa200('0x13'))(new Redis(config[_0xa200('0x11')]));require('./chatInteraction.socket')[_0xa200('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa200('0x15')][_0xa200('0x16')]({'port':0x232b});var client9004=jayson[_0xa200('0x15')][_0xa200('0x16')]({'port':0x232c});function respondWithRpcPromise(_0xe27c18,_0x16a9d2,_0x4cff13,_0x4dad0d){return new BPromise(function(_0x586143,_0x283d39){var _0x11ec0b=_0x4dad0d||client;return _0x11ec0b[_0xa200('0x17')](_0xe27c18,_0x4cff13)['then'](function(_0x29f923){logger[_0xa200('0x18')](_0xa200('0x19'),_0x16a9d2,_0xa200('0x1a'));logger[_0xa200('0x1b')](_0xa200('0x1c'),_0x16a9d2,_0xa200('0x1a'),JSON['stringify'](_0x29f923));if(_0x29f923[_0xa200('0x1d')]){if(_0x29f923[_0xa200('0x1d')][_0xa200('0x1e')]===0x1f4){logger[_0xa200('0x1d')](_0xa200('0x19'),_0x16a9d2,_0x29f923[_0xa200('0x1d')][_0xa200('0x1f')]);return _0x283d39(_0x29f923['error'][_0xa200('0x1f')]);}logger[_0xa200('0x1d')](_0xa200('0x19'),_0x16a9d2,_0x29f923[_0xa200('0x1d')][_0xa200('0x1f')]);return _0x586143(_0x29f923[_0xa200('0x1d')][_0xa200('0x1f')]);}else{logger['info'](_0xa200('0x19'),_0x16a9d2,_0xa200('0x1a'));_0x586143(_0x29f923[_0xa200('0x20')][_0xa200('0x1f')]);}})[_0xa200('0x21')](function(_0x3b6071){logger[_0xa200('0x1d')](_0xa200('0x19'),_0x16a9d2,_0x3b6071);_0x283d39(_0x3b6071);});});}function respondWithStatusCode(_0x33ab73,_0x4277e5){_0x4277e5=_0x4277e5||0xcc;return function(_0x46a9d1){if(_0x46a9d1){return _0x33ab73[_0xa200('0x22')](_0x4277e5);}return _0x33ab73[_0xa200('0x23')](_0x4277e5)[_0xa200('0x24')]();};}function respondWithResult(_0x52fdc6,_0x473ea7){_0x473ea7=_0x473ea7||0xc8;return function(_0x3aa058){if(_0x3aa058){return _0x52fdc6[_0xa200('0x23')](_0x473ea7)['json'](_0x3aa058);}};}function respondWithFilteredResult(_0x27059f,_0x162288){return function(_0x45f005){if(_0x45f005){var _0x161547=typeof _0x162288[_0xa200('0x25')]===_0xa200('0x26')&&typeof _0x162288['limit']===_0xa200('0x26');var _0x1c0f6a=_0x45f005[_0xa200('0x27')];var _0xcadc5d=_0x161547?0x0:_0x162288[_0xa200('0x25')];var _0xb4274b=_0x161547?_0x45f005['count']:_0x162288[_0xa200('0x25')]+_0x162288[_0xa200('0x28')];var _0x45f144;if(_0xb4274b>=_0x1c0f6a){_0xb4274b=_0x1c0f6a;_0x45f144=0xc8;}else{_0x45f144=0xce;}_0x27059f[_0xa200('0x23')](_0x45f144);return _0x27059f[_0xa200('0x29')](_0xa200('0x2a'),_0xcadc5d+'-'+_0xb4274b+'/'+_0x1c0f6a)[_0xa200('0x2b')](_0x45f005);}return null;};}function saveUpdates(_0x5d8d61){return function(_0x5b2ee7){if(_0x5b2ee7){return _0x5b2ee7[_0xa200('0x2c')](_0x5d8d61)[_0xa200('0x2d')](function(_0x3e35c1){return _0x3e35c1;});}return null;};}function removeEntity(_0x2d6023){return function(_0xd83bda){if(_0xd83bda){return _0xd83bda[_0xa200('0x2e')]()['then'](function(){_0x2d6023[_0xa200('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5036ee){return function(_0x444843){if(!_0x444843){_0x5036ee['sendStatus'](0x194);}return _0x444843;};}function handleError(_0x17a672,_0x5719e7){_0x5719e7=_0x5719e7||0x1f4;return function(_0x212ff0){logger[_0xa200('0x1d')](_0x212ff0[_0xa200('0x2f')]);if(_0x212ff0[_0xa200('0x30')]){delete _0x212ff0['name'];}_0x17a672[_0xa200('0x23')](_0x5719e7)[_0xa200('0x31')](_0x212ff0);};}function getMustacheRender(_0x5657a9,_0x17688f){return Mustache['render'](_0x5657a9,_[_0xa200('0x32')](_0x17688f[_0xa200('0x33')],{'contact':_0x17688f[_0xa200('0x34')],'message':_0x17688f[_0xa200('0x1f')],'agent':_0x17688f['agent'],'interaction':_0x17688f[_0xa200('0x35')],'account':_0x17688f[_0xa200('0x36')]}))||'';}exports[_0xa200('0x37')]=function(_0x261876,_0x36dde9){var _0x2ab2b8={};var _0x2930de=_[_0xa200('0x38')](db[_0xa200('0x39')]['rawAttributes'],function(_0x309927){return{'name':_0x309927[_0xa200('0x3a')],'type':_0x309927[_0xa200('0x3b')][_0xa200('0x3c')]};});_0x2ab2b8=qs[_0xa200('0x3d')](_0x2930de,_0x261876);return interaction[_0xa200('0x3e')]('chat',_0x261876[_0xa200('0x3f')],_0x261876[_0xa200('0x40')],_0x2ab2b8,_0x2930de)[_0xa200('0x2d')](respondWithFilteredResult(_0x36dde9,_0x2ab2b8))['catch'](handleError(_0x36dde9,null));};exports['show']=function(_0x35a8b7,_0x1c7b1c){var _0x5bd523={'raw':![],'where':{'id':_0x35a8b7['params']['id']}},_0x5d5881={};_0x5d5881[_0xa200('0x41')]=_[_0xa200('0x42')](db[_0xa200('0x39')][_0xa200('0x43')]);_0x5d5881['query']=_['keys'](_0x35a8b7[_0xa200('0x3f')]);_0x5d5881[_0xa200('0x44')]=_['intersection'](_0x5d5881[_0xa200('0x41')],_0x5d5881[_0xa200('0x3f')]);_0x5bd523[_0xa200('0x45')]=_[_0xa200('0x46')](_0x5d5881['model'],qs['fields'](_0x35a8b7['query'][_0xa200('0x47')]));_0x5bd523[_0xa200('0x45')]=_0x5bd523[_0xa200('0x45')][_0xa200('0x48')]?_0x5bd523[_0xa200('0x45')]:_0x5d5881[_0xa200('0x41')];if(_0x35a8b7[_0xa200('0x3f')]['includeAll']){_0x5bd523[_0xa200('0x49')]=[{'all':!![]}];}_0x5bd523=_['merge']({},_0x5bd523,_0x35a8b7[_0xa200('0x4a')]);return db[_0xa200('0x39')][_0xa200('0x4b')](_0x5bd523)[_0xa200('0x2d')](handleEntityNotFound(_0x1c7b1c,null))[_0xa200('0x2d')](respondWithResult(_0x1c7b1c,null))['catch'](handleError(_0x1c7b1c,null));};exports[_0xa200('0x4c')]=function(_0x5591bc,_0x3a7be5){return db['ChatInteraction'][_0xa200('0x4c')](_0x5591bc[_0xa200('0x33')],{})['then'](respondWithResult(_0x3a7be5,0xc9))['catch'](handleError(_0x3a7be5,null));};exports[_0xa200('0x2c')]=function(_0x59c49b,_0x364efe){if(_0x59c49b[_0xa200('0x33')]['id']){delete _0x59c49b[_0xa200('0x33')]['id'];}return db['ChatInteraction'][_0xa200('0x4b')]({'where':{'id':_0x59c49b[_0xa200('0x4d')]['id']}})[_0xa200('0x2d')](handleEntityNotFound(_0x364efe,null))[_0xa200('0x2d')](saveUpdates(_0x59c49b[_0xa200('0x33')],null))[_0xa200('0x2d')](respondWithResult(_0x364efe,null))[_0xa200('0x21')](handleError(_0x364efe,null));};exports[_0xa200('0x2e')]=function(_0x1dce31,_0x5e5ee1){return db[_0xa200('0x39')]['find']({'where':{'id':_0x1dce31[_0xa200('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5e5ee1,null))[_0xa200('0x2d')](removeEntity(_0x5e5ee1,null))['catch'](handleError(_0x5e5ee1,null));};exports[_0xa200('0x4e')]=function(_0x1e5640,_0x2fc07c){return db[_0xa200('0x39')][_0xa200('0x4e')]()[_0xa200('0x2d')](respondWithResult(_0x2fc07c,null))[_0xa200('0x21')](handleError(_0x2fc07c,null));};exports[_0xa200('0x4f')]=function(_0x258a7a,_0x54ac83){var _0xa5a433=_0x258a7a['params']['id'];var _0x47a899;var _0x5166b9;var _0xf73e64;return db[_0xa200('0x39')][_0xa200('0x50')]({'where':{'id':_0xa5a433}})[_0xa200('0x2d')](function(_0x7b4bf){_0x47a899=_0x7b4bf;return db[_0xa200('0x51')][_0xa200('0x50')]({'where':{'id':_0x7b4bf['ChatWebsiteId']},'attributes':['id',_0xa200('0x52'),_0xa200('0x53'),_0xa200('0x54'),_0xa200('0x55'),_0xa200('0x56')],'raw':!![]});})[_0xa200('0x2d')](function(_0x5498e3){if(_0x5498e3&&_0x5498e3[_0xa200('0x52')]&&_0x5498e3[_0xa200('0x53')]){_0x5166b9=_0x5498e3;var _0x6983eb={'interaction':{'id':_0xa5a433},'agent':{'id':_0x258a7a['user']['id'],'name':_0x258a7a['user'][_0xa200('0x30')],'fullname':_0x258a7a[_0xa200('0x40')]['fullname'],'email':_0x258a7a['user'][_0xa200('0x57')]},'contact':_0x258a7a[_0xa200('0x33')][_0xa200('0x34')],'account':_0x258a7a['body']['account']};var _0x488c55={'rejectUnauthorized':![],'method':_0xa200('0x58'),'url':_0xa200('0x59'),'headers':{'X-APIKEY':_0x5498e3['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x258a7a[_0xa200('0x40')][_0xa200('0x57')]],'buttons':null,'topic':_0x5166b9[_0xa200('0x54')],'note':_[_0xa200('0x5a')](_0x5166b9[_0xa200('0x55')])?null:getMustacheRender(_0x5166b9['vidaooNote'],_0x6983eb),'metadata':null},'redirect':_0xa200('0x5b'),'json':!![]};try{if(!_[_0xa200('0x5a')](_0x5166b9[_0xa200('0x56')])){var _0x543665=getMustacheRender(_0x5166b9[_0xa200('0x56')],_0x6983eb);var _0x5eb916=JSON[_0xa200('0x5c')](_0x543665);_0x488c55[_0xa200('0x33')]['metadata']=_0x5eb916;}}catch(_0x4ea3fc){throw new db[(_0xa200('0x5d'))][(_0xa200('0x5e'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x488c55);}else{throw new db[(_0xa200('0x5d'))][(_0xa200('0x5e'))](_0xa200('0x5f'));}})[_0xa200('0x2d')](function(_0x20175c){_0xf73e64=_0x20175c;if(_0xf73e64['id']){var _0x2e56b9={'body':_0xf73e64[_0xa200('0x60')],'ChatWebsiteId':_0x5166b9['id'],'ChatInteractionId':_0x47a899['id'],'direction':_0xa200('0x61'),'UserId':_0x258a7a[_0xa200('0x40')]['id']};return db['ChatMessage'][_0xa200('0x4c')](_0x2e56b9,{});}else{throw new db[(_0xa200('0x5d'))][(_0xa200('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa200('0x2d')](function(){return _0x47a899['updateAttributes']({'vidaooSessionId':_0xf73e64['id']});})[_0xa200('0x2d')](respondWithResult(_0x54ac83,null))['catch'](handleError(_0x54ac83,null));};exports['customUpdate']=function(_0x728842,_0x4ef602){if(_0x728842[_0xa200('0x33')]['id']){delete _0x728842['body']['id'];}return db[_0xa200('0x39')][_0xa200('0x4b')]({'where':{'id':_0x728842['params']['id']},'include':[{'model':db['CmContact'],'as':_0xa200('0x62')}]})[_0xa200('0x2d')](handleEntityNotFound(_0x4ef602,null))[_0xa200('0x2d')](saveUpdates(_0x728842['body'],null))[_0xa200('0x2d')](respondWithResult(_0x4ef602,null))[_0xa200('0x21')](handleError(_0x4ef602,null));};exports['abandon']=function(_0x17bf7a,_0x2339b5){if(_0x17bf7a[_0xa200('0x33')]['id']){delete _0x17bf7a[_0xa200('0x33')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x17bf7a[_0xa200('0x4d')]['id']}})[_0xa200('0x2d')](function(_0x249045){if(!_0x249045){logger[_0xa200('0x1d')](_0xa200('0x63'),_0xa200('0x64'),0x194,'entity\x20not\x20found');_0x2339b5[_0xa200('0x22')](0x194);}else{if(_0x249045[_0xa200('0x65')]){throw new db[(_0xa200('0x5d'))][(_0xa200('0x5e'))](_0xa200('0x66'));}}return _0x249045;})[_0xa200('0x2d')](function(_0x289259){if(_0x289259){return _0x289259[_0xa200('0x2c')]({'closed':_0x17bf7a['body'][_0xa200('0x67')],'disposition':_0x17bf7a[_0xa200('0x33')][_0xa200('0x68')]})['then'](function(_0x40713f){return _0x40713f;});}})[_0xa200('0x2d')](function(){return respondWithRpcPromise(_0xa200('0x69'),'abandon',_0x17bf7a[_0xa200('0x33')],client9004);})[_0xa200('0x2d')](respondWithResult(_0x2339b5,null))[_0xa200('0x21')](handleError(_0x2339b5,null));};exports['attachmentUpload']=function(_0xab966b,_0x171365){_0xab966b[_0xa200('0x33')][_0xa200('0x30')]=_0xab966b['file']['originalname'];_0xab966b[_0xa200('0x33')][_0xa200('0x6a')]=_0xab966b['file'][_0xa200('0x6b')];_0xab966b[_0xa200('0x33')]['type']=_0xab966b[_0xa200('0x6c')]['mimetype'];return db['Attachment'][_0xa200('0x4c')](_0xab966b['body'])['then'](respondWithResult(_0x171365,0xc9))[_0xa200('0x21')](handleError(_0x171365,null));};exports[_0xa200('0x6d')]=function(_0xdb95d6,_0x62fdd3){return db[_0xa200('0x39')][_0xa200('0x50')]({'where':{'id':_0xdb95d6['params']['id']},'raw':!![]})[_0xa200('0x2d')](handleEntityNotFound(_0x62fdd3,null))[_0xa200('0x2d')](function(_0x2d637d){if(_0x2d637d){if(_0x2d637d[_0xa200('0x67')]){return _0x62fdd3[_0xa200('0x23')](0x193)['json']({'status':0x193,'message':_0xa200('0x6e')});}return db['Attachment']['findOne']({'where':{'id':_0xdb95d6[_0xa200('0x3f')][_0xa200('0x6f')]},'raw':!![]})[_0xa200('0x2d')](handleEntityNotFound(_0x62fdd3,null));}})[_0xa200('0x2d')](function(_0xc5b5a3){if(_0xc5b5a3){var _0x1f72ef=_0xc5b5a3[_0xa200('0x70')]!==null;var _0x56e130=path[_0xa200('0x71')](config[_0xa200('0x72')],'server/files/attachments/');if(_0x1f72ef){_0x56e130=path['join'](_0x56e130,_0xa200('0x73'));}var _0x536545=path['join'](_0x56e130,_0xc5b5a3[_0xa200('0x6a')]);return _0x62fdd3[_0xa200('0x74')](_0x536545);}})[_0xa200('0x21')](handleError(_0x62fdd3,null));};exports[_0xa200('0x75')]=function(_0x53b7f5,_0x40a28d){var _0x37e081=null;var _0x1923ae=null;var _0x330f15=null;if(_0x53b7f5[_0xa200('0x33')]['id']){delete _0x53b7f5['body']['id'];}if(_0x53b7f5[_0xa200('0x33')][_0xa200('0x76')]){_0x330f15=path[_0xa200('0x71')](config['root'],_0xa200('0x77'),util['format'](_0xa200('0x78'),Date[_0xa200('0x79')]()));_0x53b7f5[_0xa200('0x33')][_0xa200('0x7a')]=_0x330f15;}return db[_0xa200('0x39')][_0xa200('0x4b')]({'where':{'id':_0x53b7f5[_0xa200('0x4d')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa200('0x7b'),'include':[{'model':db[_0xa200('0x7c')],'as':_0xa200('0x7c')}]}]})['then'](handleEntityNotFound(_0x40a28d,null))[_0xa200('0x2d')](saveUpdates(_0x53b7f5['body'],null))[_0xa200('0x2d')](function(_0x2f8fbf){if(_0x2f8fbf){_0x37e081=_0x2f8fbf;return db[_0xa200('0x51')][_0xa200('0x4b')]({'where':{'id':_0x37e081[_0xa200('0x7d')]}});}})['then'](function(_0x3a4c08){if(_0x3a4c08){_0x1923ae=_0x3a4c08;return db[_0xa200('0x7e')][_0xa200('0x4b')]({'where':{'id':_0x37e081[_0xa200('0x7f')]}});}})[_0xa200('0x2d')](function(_0x2ac580){if(_0x2ac580){if(_0x330f15){var _0x1a1d47=null;for(var _0x283866=0x1;_0x283866<_0x37e081[_0xa200('0x7b')][_0xa200('0x48')];++_0x283866){_0x1a1d47=_0x37e081[_0xa200('0x7b')][_0x283866];var _0x4a444f=_0x1a1d47['UserId']?util[_0xa200('0x80')](_0xa200('0x81'),_0x1923ae[_0xa200('0x82')],_0x1a1d47[_0xa200('0x65')]):'System';var _0x130933=_0x53b7f5[_0xa200('0x33')][_0xa200('0x83')]||util[_0xa200('0x80')](_0xa200('0x81'),_0xa200('0x84'),_0x1a1d47[_0xa200('0x7f')]);switch(_0x1923ae[_0xa200('0x85')]){case'website_alias':_0x4a444f=_0x1a1d47['UserId']?util[_0xa200('0x80')](_0xa200('0x81'),_0x1923ae[_0xa200('0x82')],_0x1a1d47[_0xa200('0x65')]):_0xa200('0x86');break;case _0xa200('0x87'):_0x4a444f=_0x1a1d47[_0xa200('0x65')]?_0x1a1d47['User'][_0xa200('0x88')]||_0x1a1d47[_0xa200('0x7c')][_0xa200('0x89')]:'System';break;case _0xa200('0x8a'):_0x4a444f=_0x1a1d47[_0xa200('0x65')]?_0x1a1d47[_0xa200('0x7c')]['fullname']:_0xa200('0x86');break;default:_0x4a444f=_0x1a1d47['UserId']?util[_0xa200('0x80')](_0xa200('0x81'),_0x1923ae[_0xa200('0x82')],_0x1a1d47[_0xa200('0x65')]):_0xa200('0x86');}var _0x1fcc9e=util[_0xa200('0x80')]('[%s]\x20%s:\x20%s\x0a',moment(_0x1a1d47[_0xa200('0x8b')])[_0xa200('0x80')](_0xa200('0x8c')),_0x1a1d47['direction']==='in'?_0x130933:_0x4a444f,_0x1a1d47[_0xa200('0x33')]);if(!_0x1a1d47[_0xa200('0x8d')]){fs[_0xa200('0x8e')](_0x330f15,_0x1fcc9e);}}return db[_0xa200('0x8f')][_0xa200('0x50')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa200('0x90'),'raw':!![],'include':[{'model':db[_0xa200('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xa200('0x2d')](function(_0x5a30c3){if(!_0x5a30c3||!_0x5a30c3[_0xa200('0x90')]||!_0x53b7f5[_0xa200('0x33')])return _0x37e081;var _0x2e11e8=_0x5a30c3[_0xa200('0x92')]();return respondWithRpcPromise(_0xa200('0x93'),'sendMail',{'account':_0x2e11e8,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5a30c3[_0xa200('0x30')],_0x5a30c3[_0xa200('0x57')]||_0x5a30c3[_0xa200('0x90')][_0xa200('0x40')]),'to':_0x53b7f5['body'][_0xa200('0x76')],'subject':_0xa200('0x94'),'text':util['format'](_0xa200('0x95'),_0x53b7f5[_0xa200('0x33')][_0xa200('0x76')]),'attachments':[{'path':_0x330f15}]}})[_0xa200('0x2d')](function(){return _0x37e081;})[_0xa200('0x21')](function(_0x5d5f71){logger[_0xa200('0x1d')](_0x5d5f71);});})[_0xa200('0x2d')](respondWithStatusCode(_0x40a28d,0xc8))[_0xa200('0x21')](handleError(_0x40a28d,null));};exports['addMessage']=function(_0x2d3198,_0x576504){return db['ChatMessage']['find']({'where':{'id':_0x2d3198[_0xa200('0x4d')]['id']}})['then'](handleEntityNotFound(_0x576504,null))['then'](function(_0x1d170a){if(_0x1d170a){return _0x1d170a[_0xa200('0x96')](_0x2d3198[_0xa200('0x33')][_0xa200('0x97')],_[_0xa200('0x98')](_0x2d3198['body'],[_0xa200('0x97'),'id'])||{});}})[_0xa200('0x2d')](respondWithResult(_0x576504,null))[_0xa200('0x21')](handleError(_0x576504,null));};exports[_0xa200('0x99')]=function(_0x22ef99,_0xa76751){var _0x5be697={'raw':![],'where':{}};var _0x8a0b4a={};var _0x3598f4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa200('0x50')]({'where':{'id':_0x22ef99[_0xa200('0x4d')]['id']}})['then'](handleEntityNotFound(_0xa76751,null))['then'](function(_0x4f6cd5){if(_0x4f6cd5){_0x8a0b4a[_0xa200('0x41')]=_[_0xa200('0x42')](db[_0xa200('0x9a')][_0xa200('0x43')]);_0x8a0b4a[_0xa200('0x3f')]=_[_0xa200('0x42')](_0x22ef99[_0xa200('0x3f')]);_0x8a0b4a[_0xa200('0x44')]=_[_0xa200('0x46')](_0x8a0b4a[_0xa200('0x41')],_0x8a0b4a['query']);_0x5be697[_0xa200('0x45')]=_[_0xa200('0x46')](_0x8a0b4a[_0xa200('0x41')],qs[_0xa200('0x47')](_0x22ef99['query'][_0xa200('0x47')]));_0x5be697[_0xa200('0x45')]=_0x5be697['attributes']['length']?_0x5be697[_0xa200('0x45')]:_0x8a0b4a[_0xa200('0x41')];if(!_0x22ef99['query'][_0xa200('0x9b')](_0xa200('0x9c'))){_0x5be697[_0xa200('0x28')]=qs['limit'](_0x22ef99[_0xa200('0x3f')][_0xa200('0x28')]);_0x5be697[_0xa200('0x25')]=qs[_0xa200('0x25')](_0x22ef99[_0xa200('0x3f')]['offset']);}_0x5be697[_0xa200('0x9d')]=qs[_0xa200('0x9e')](_0x22ef99[_0xa200('0x3f')]['sort']);_0x5be697[_0xa200('0x9f')]=qs[_0xa200('0x44')](_[_0xa200('0xa0')](_0x22ef99[_0xa200('0x3f')],_0x8a0b4a[_0xa200('0x44')]));_0x5be697[_0xa200('0x9f')][_0xa200('0xa1')]=_0x4f6cd5['id'];if(_0x22ef99[_0xa200('0x3f')][_0xa200('0xa2')]){_0x5be697['where']=_[_0xa200('0x32')](_0x5be697[_0xa200('0x9f')],{'$or':_['map'](_0x5be697['attributes'],function(_0x34fb2c){var _0x2e039f={};_0x2e039f[_0x34fb2c]={'$like':'%'+_0x22ef99['query'][_0xa200('0xa2')]+'%'};return _0x2e039f;})});}if(_0x22ef99[_0xa200('0x3f')]['$gte']){var _0x8ef06e=_0x22ef99[_0xa200('0x3f')][_0xa200('0xa3')][_0xa200('0xa4')](',');var _0xe9cffe={};_0xe9cffe[_0x8ef06e[0x0]]={'$gte':moment(_0x8ef06e[0x1])[_0xa200('0x80')](_0xa200('0xa5'))};_0x5be697[_0xa200('0x9f')]=_['merge'](_0x5be697[_0xa200('0x9f')],_0xe9cffe);}_0x5be697=_['merge']({},_0x5be697,_0x22ef99[_0xa200('0x4a')]);return db[_0xa200('0x9a')][_0xa200('0x27')]({'where':_0x5be697[_0xa200('0x9f')]})['then'](function(_0x416a1f){_0x3598f4[_0xa200('0x27')]=_0x416a1f;if(_0x22ef99[_0xa200('0x3f')]['includeAll']){_0x5be697[_0xa200('0x49')]=[{'all':!![]}];}return db[_0xa200('0x9a')][_0xa200('0x3e')](_0x5be697);})[_0xa200('0x2d')](function(_0x3d112d){_0x3598f4['rows']=_0x3d112d;return _0x3598f4;});}})[_0xa200('0x2d')](respondWithFilteredResult(_0xa76751,_0x5be697))[_0xa200('0x21')](handleError(_0xa76751,null));};exports[_0xa200('0xa6')]=function(_0x1f9dad,_0x339669){var _0x3f30e4={'where':{}},_0x11d500={},_0x29a02d={'count':0x0,'rows':[]};return db[_0xa200('0x39')][_0xa200('0x50')]({'where':{'id':_0x1f9dad[_0xa200('0x4d')]['id']}})[_0xa200('0x2d')](handleEntityNotFound(_0x339669,null))[_0xa200('0x2d')](function(_0xae3b82){if(_0xae3b82){_0x11d500[_0xa200('0x41')]=_['keys'](db[_0xa200('0x9a')][_0xa200('0x43')]);_0x11d500[_0xa200('0x3f')]=_[_0xa200('0x42')](_0x1f9dad[_0xa200('0x3f')]);_0x11d500[_0xa200('0x44')]=_['intersection'](_0x11d500[_0xa200('0x41')],_0x11d500[_0xa200('0x3f')]);_0x3f30e4[_0xa200('0x45')]=_['intersection'](_0x11d500['model'],qs[_0xa200('0x47')](_0x1f9dad[_0xa200('0x3f')][_0xa200('0x47')]));_0x3f30e4[_0xa200('0x45')]=_0x3f30e4[_0xa200('0x45')][_0xa200('0x48')]?_0x3f30e4['attributes']:_0x11d500['model'];if(!_0x1f9dad[_0xa200('0x3f')][_0xa200('0x9b')](_0xa200('0x9c'))){_0x3f30e4[_0xa200('0x28')]=qs[_0xa200('0x28')](_0x1f9dad['query'][_0xa200('0x28')]);_0x3f30e4[_0xa200('0x25')]=qs[_0xa200('0x25')](_0x1f9dad[_0xa200('0x3f')][_0xa200('0x25')]);}_0x3f30e4['order']=qs[_0xa200('0x9e')](_0x1f9dad['query'][_0xa200('0x9e')]);_0x3f30e4['where']=qs[_0xa200('0x44')](_['pick'](_0x1f9dad[_0xa200('0x3f')],_0x11d500['filters']));_0x3f30e4['where'][_0xa200('0xa1')]=_0xae3b82['id'];if(_0x1f9dad['query']['filter']){_0x3f30e4['where']=_[_0xa200('0x32')](_0x3f30e4['where'],{'$or':_[_0xa200('0x38')](_0x3f30e4[_0xa200('0x45')],function(_0x4bc308){var _0x4fc412={};_0x4fc412[_0x4bc308]={'$like':'%'+_0x1f9dad[_0xa200('0x3f')][_0xa200('0xa2')]+'%'};return _0x4fc412;})});}_0x3f30e4[_0xa200('0x9f')][_0xa200('0x8d')]=![];if(_0x1f9dad[_0xa200('0x3f')]['id']){_0x3f30e4[_0xa200('0x9f')]['id']={'$gt':_0x1f9dad['query']['id']};}_0x3f30e4=_[_0xa200('0x32')]({},_0x3f30e4,_0x1f9dad[_0xa200('0x4a')]);return db[_0xa200('0x9a')]['count']({'where':_0x3f30e4[_0xa200('0x9f')]})[_0xa200('0x2d')](function(_0x21365a){_0x29a02d[_0xa200('0x27')]=_0x21365a;_0x3f30e4['include']=[];if(_0x1f9dad['query']['includeAgent']){_0x3f30e4[_0xa200('0x49')][_0xa200('0xa7')]({'model':db[_0xa200('0x7c')],'as':_0xa200('0x7c'),'attributes':['id',_0xa200('0x89'),_0xa200('0x88')]});}if(_0x1f9dad['query'][_0xa200('0xa8')]){_0x3f30e4[_0xa200('0x49')]=[{'all':!![]}];}return db[_0xa200('0x9a')][_0xa200('0x3e')](_0x3f30e4);})[_0xa200('0x2d')](function(_0x5a0954){_0x29a02d['rows']=_0x5a0954;return _0x29a02d;});}})[_0xa200('0x2d')](respondWithFilteredResult(_0x339669,_0x3f30e4))['catch'](handleError(_0x339669,null));};exports[_0xa200('0xa9')]=function(_0x3373a2,_0x351ce3){return db[_0xa200('0x39')][_0xa200('0x4b')]({'where':{'id':_0x3373a2['params']['id']}})[_0xa200('0x2d')](handleEntityNotFound(_0x351ce3,null))[_0xa200('0x2d')](function(_0x585f38){if(_0x585f38){return _0x585f38[_0xa200('0xaa')](_0x3373a2[_0xa200('0x33')]['ids'],_['omit'](_0x3373a2['body'],[_0xa200('0x97'),'id'])||{})[_0xa200('0xab')](function(){return db[_0xa200('0xac')][_0xa200('0x3e')]({'attributes':['id',_0xa200('0x30'),_0xa200('0xad')],'where':{'id':_0x3373a2[_0xa200('0x33')][_0xa200('0x97')]}});})['then'](function(_0x46f859){socket[_0xa200('0xae')](_0xa200('0xaf'),{'id':Number(_0x3373a2['params']['id']),'tags':_0x46f859||[]});return{'id':Number(_0x3373a2[_0xa200('0x4d')]['id']),'tags':_0x46f859||[]};});}})[_0xa200('0x2d')](respondWithResult(_0x351ce3,null))[_0xa200('0x21')](handleError(_0x351ce3,null));};exports[_0xa200('0xb0')]=function(_0x549410,_0x194070){return db[_0xa200('0x39')]['find']({'where':{'id':_0x549410[_0xa200('0x4d')]['id']}})[_0xa200('0x2d')](handleEntityNotFound(_0x194070,null))['then'](function(_0x488009){if(_0x488009){return _0x488009[_0xa200('0xb0')](_0x549410[_0xa200('0x3f')]['ids']);}})[_0xa200('0x2d')](respondWithStatusCode(_0x194070,null))['catch'](handleError(_0x194070,null));};exports[_0xa200('0x74')]=function(_0x7ed559,_0x3c83eb){var _0x4a2f46=moment()['unix']()[_0xa200('0xb1')]();var _0x30bef2=path['join'](config[_0xa200('0x72')],_0xa200('0xb2'),_0xa200('0xb3'),_0xa200('0xb4'));var _0x56b934=path['join'](config['root'],_0xa200('0xb2'),'files','attachments');var _0x33fe1a=path['join'](_0x30bef2,_0x4a2f46);var _0x3f16d2=util[_0xa200('0x80')]('transcript-%d-%s.zip',_0x7ed559[_0xa200('0x4d')]['id'],_0x4a2f46);var _0x2fc57f=path[_0xa200('0x71')](_0x30bef2,_0x3f16d2);var _0x433c7d=[];_0x433c7d[_0xa200('0xa7')]({'model':db[_0xa200('0x7c')],'as':'User','attributes':['id',_0xa200('0x89')],'raw':!![]});_0x433c7d[_0xa200('0xa7')]({'model':db[_0xa200('0x7e')],'as':_0xa200('0x62'),'attributes':['id',_0xa200('0xb5'),_0xa200('0xb6')],'raw':!![]});if(_0x7ed559[_0xa200('0x3f')][_0xa200('0xb7')]){_0x433c7d[_0xa200('0xa7')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x5841ca=[{'model':db[_0xa200('0x9a')],'as':'Messages','attributes':['id','body',_0xa200('0x8b'),'direction',_0xa200('0x8d'),_0xa200('0xb8')],'include':_0x433c7d}];_0x5841ca[_0xa200('0xa7')]({'model':db[_0xa200('0x51')],'as':'Account','attributes':['id',_0xa200('0x30')]});_0x5841ca['push']({'model':db[_0xa200('0x7c')],'as':_0xa200('0xb9'),'attributes':['id',_0xa200('0x89')]});return db['ChatInteraction']['find']({'where':{'id':_0x7ed559[_0xa200('0x4d')]['id']},'include':_0x5841ca})[_0xa200('0x2d')](handleEntityNotFound(_0x3c83eb,null))[_0xa200('0x2d')](function(_0x2c901d){if(_0x2c901d){var _0x237008=_0x2c901d[_0xa200('0xba')]({'plain':!![]});fs[_0xa200('0xbb')](_0x33fe1a);var _0x2d6375={'channel':_0xa200('0xbc'),'account':_0x237008['Account'][_0xa200('0x30')],'agent':_0x237008[_0xa200('0xb9')]?_0x237008[_0xa200('0xb9')][_0xa200('0x89')]:'N.A.','createdAt':moment(_0x237008['createdAt'])['format'](_0xa200('0xa5'))[_0xa200('0xb1')](),'closedAt':_0x237008['closed']?moment(_0x237008['closedAt'])[_0xa200('0x80')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x237008['disposition'],'chatInfo':{'browser':_0x237008[_0xa200('0xbd')],'os':_0x237008['osName'],'referer':_0x237008[_0xa200('0xbe')],'customerIp':_0x237008['customerIp'],'customerPort':_0x237008[_0xa200('0xbf')]?_0x237008[_0xa200('0xbf')]:_0xa200('0xc0')},'messages':_(_0x237008[_0xa200('0x7b')])['tail']()[_0xa200('0xa2')]({'secret':![]})[_0xa200('0x38')](function(_0x261f06){if(_0x261f06[_0xa200('0xc1')]){var _0x20380b=path[_0xa200('0x71')](_0x56b934,_0x261f06[_0xa200('0xc1')][_0xa200('0x6a')]);if(fs[_0xa200('0xc2')](_0x20380b)){fs[_0xa200('0xc3')](_0x20380b)['pipe'](fs[_0xa200('0xc4')](path['join'](_0x33fe1a,_0x261f06[_0xa200('0xc1')]['basename'])));}}return{'date':moment(_0x261f06[_0xa200('0x8b')])[_0xa200('0x80')](_0xa200('0xa5'))[_0xa200('0xb1')](),'sender':_0x261f06[_0xa200('0xc5')]===_0xa200('0x61')?_0x261f06['User']?_0x261f06[_0xa200('0x7c')]['fullname']:_0xa200('0x86'):_0x261f06[_0xa200('0x62')][_0xa200('0xb5')]+(_0x261f06[_0xa200('0x62')]['lastName']?'\x20'+_0x261f06[_0xa200('0x62')][_0xa200('0xb6')]:''),'body':_0x261f06['Attachment']?_0x261f06[_0xa200('0xc1')][_0xa200('0x6a')]:_0x261f06[_0xa200('0x33')],'direction':_0x261f06[_0xa200('0xc5')]===_0xa200('0x61')?'A':'C','secret':_0x261f06[_0xa200('0x8d')],'read':_0x261f06[_0xa200('0xb8')],'attachment':_0x261f06['Attachment']};})[_0xa200('0xc6')]()};return ejs[_0xa200('0xc7')](path[_0xa200('0x71')](config[_0xa200('0x72')],_0xa200('0xb2'),_0xa200('0xc8'),_0xa200('0xc9')),{'interaction':_0x2d6375})[_0xa200('0x2d')](function(_0x57403b){var _0x2d3833=path[_0xa200('0x71')](_0x33fe1a,_0xa200('0xca')+_0x237008['id']+'-'+_0x4a2f46+_0xa200('0xcb'));var _0x495dd9={'path':_0x2d3833,'channel':_0xa200('0xbc'),'interactionId':_0x237008['id']};return pdf[_0xa200('0xcc')](_0x57403b,_0x495dd9);})[_0xa200('0x2d')](function(){return new Promise(function(_0x42b9d5,_0x5de955){zipdir(_0x33fe1a,{'saveTo':_0x2fc57f},function(_0x13e10d,_0x53f9a7){if(_0x13e10d)return _0x5de955(_0x13e10d);return _0x42b9d5(_0x53f9a7);});})[_0xa200('0x2d')](function(){return new BPromise(function(_0x4889dc,_0x124640){rimraf(_0x33fe1a,function(_0x3eb8e7){if(_0x3eb8e7)_0x124640(_0x3eb8e7);return _0x4889dc();});});})[_0xa200('0x2d')](function(){return _0x3c83eb[_0xa200('0x74')](_0x2fc57f,_0x3f16d2,function(_0x17efd6){if(_0x17efd6){logger[_0xa200('0x1d')](_0xa200('0xcd'),_0x17efd6);}else{fs['unlinkSync'](_0x2fc57f);}});});});}else{return _0x3c83eb[_0xa200('0x22')](0xc8);}})[_0xa200('0x21')](handleError(_0x3c83eb,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 467cabc..0179154 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 _0x10e1=['ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x10e1,0x6f));var _0x110e=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x10e1[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0x110e('0x0'));var ChatInteraction=require(_0x110e('0x1'))['db'][_0x110e('0x2')];var ChatMessage=require(_0x110e('0x1'))['db'][_0x110e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x110e('0x4')](0x0);var events={'afterCreate':_0x110e('0x5'),'afterUpdate':_0x110e('0x6'),'afterDestroy':_0x110e('0x7')};function emitEvent(_0x37fd08){return function(_0x330b98,_0x16ebab,_0x3f6a99){_0x330b98[_0x110e('0x8')]({'attributes':['id'],'raw':!![]})[_0x110e('0x9')](function(_0x5e1860){_0x330b98['setDataValue'](_0x110e('0xa'),_0x5e1860[_0x110e('0xb')](function(_0x3deffd){return{'id':_0x3deffd['id']};}));return ChatMessage[_0x110e('0xc')]({'where':{'ChatInteractionId':_0x330b98['id'],'direction':'in','read':![]},'raw':!![]});})[_0x110e('0x9')](function(_0x5c1799){_0x330b98[_0x110e('0xd')](_0x110e('0xe'),_0x5c1799['length']);ChatInteractionEvents[_0x110e('0xf')](_0x37fd08+':'+_0x330b98['id'],_0x330b98);ChatInteractionEvents[_0x110e('0xf')](_0x37fd08,_0x330b98);_0x3f6a99(null);})[_0x110e('0x10')](_0x3f6a99(null));};}for(var e in events){if(events[_0x110e('0x11')](e)){var event=events[e];ChatInteraction[_0x110e('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xa616=['map','setDataValue','emit','hook','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','Users'];(function(_0x1fb1ef,_0x264f70){var _0x2bbfc0=function(_0x25ef4a){while(--_0x25ef4a){_0x1fb1ef['push'](_0x1fb1ef['shift']());}};_0x2bbfc0(++_0x264f70);}(_0xa616,0x1b4));var _0x6a61=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xa616[_0x9edfd5];return _0x330738;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x6a61('0x0'))['db'][_0x6a61('0x1')];var ChatMessage=require(_0x6a61('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6a61('0x2')](0x0);var events={'afterCreate':_0x6a61('0x3'),'afterUpdate':_0x6a61('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41e753){return function(_0x22b0cc,_0x160bab,_0xf57118){_0x22b0cc[_0x6a61('0x5')]({'attributes':['id'],'raw':!![]})[_0x6a61('0x6')](function(_0x37a2eb){_0x22b0cc['setDataValue'](_0x6a61('0x7'),_0x37a2eb[_0x6a61('0x8')](function(_0x747583){return{'id':_0x747583['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x22b0cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6a61('0x6')](function(_0x4cb149){_0x22b0cc[_0x6a61('0x9')]('unreadMessages',_0x4cb149['length']);ChatInteractionEvents[_0x6a61('0xa')](_0x41e753+':'+_0x22b0cc['id'],_0x22b0cc);ChatInteractionEvents[_0x6a61('0xa')](_0x41e753,_0x22b0cc);_0xf57118(null);})['catch'](_0xf57118(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x6a61('0xb')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 7ae2c60..cd92ecf 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 _0x5eed=['../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x2c8a49,_0x483a66){var _0x5f4ec3=function(_0x381a42){while(--_0x381a42){_0x2c8a49['push'](_0x2c8a49['shift']());}};_0x5f4ec3(++_0x483a66);}(_0x5eed,0x134));var _0xd5ee=function(_0x20f322,_0x3631b2){_0x20f322=_0x20f322-0x0;var _0x57b28b=_0x5eed[_0x20f322];return _0x57b28b;};'use strict';var _=require(_0xd5ee('0x0'));var util=require(_0xd5ee('0x1'));var logger=require(_0xd5ee('0x2'))('api');var moment=require(_0xd5ee('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(_0xd5ee('0x4'));var attributes=require(_0xd5ee('0x5'));module[_0xd5ee('0x6')]=function(_0x32f128,_0xcabcdf){return _0x32f128['define'](_0xd5ee('0x7'),attributes,{'tableName':_0xd5ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3751f6,_0x26c6f6,_0x4b6a26){if(_0x3751f6['changed']('closed')){_0x3751f6['closedAt']=moment()[_0xd5ee('0x9')](_0xd5ee('0xa'));}_0x4b6a26(null,_0x3751f6);}},'charset':_0xd5ee('0xb'),'collate':_0xd5ee('0xc')});}; \ No newline at end of file +var _0xf8a1=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xf8a1,0x1ac));var _0x1f8a=function(_0x2c5eac,_0x319ede){_0x2c5eac=_0x2c5eac-0x0;var _0x13773d=_0xf8a1[_0x2c5eac];return _0x13773d;};'use strict';var _=require('lodash');var util=require(_0x1f8a('0x0'));var logger=require(_0x1f8a('0x1'))(_0x1f8a('0x2'));var moment=require(_0x1f8a('0x3'));var BPromise=require(_0x1f8a('0x4'));var rp=require(_0x1f8a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f8a('0x6'));var config=require(_0x1f8a('0x7'));var attributes=require(_0x1f8a('0x8'));module['exports']=function(_0x17d9ae,_0x5ac147){return _0x17d9ae[_0x1f8a('0x9')](_0x1f8a('0xa'),attributes,{'tableName':_0x1f8a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53ce4b,_0x498530,_0x2ea868){if(_0x53ce4b[_0x1f8a('0xc')]('closed')){_0x53ce4b[_0x1f8a('0xd')]=moment()['format'](_0x1f8a('0xe'));}_0x2ea868(null,_0x53ce4b);}},'charset':_0x1f8a('0xf'),'collate':_0x1f8a('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 323fcf5..2386a89 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 _0xc311=['error','code','message','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e2bed,_0x2be54b){var _0xcfab35=function(_0xf81f45){while(--_0xf81f45){_0x1e2bed['push'](_0x1e2bed['shift']());}};_0xcfab35(++_0x2be54b);}(_0xc311,0x1ac));var _0x1c31=function(_0x47deac,_0x229fd7){_0x47deac=_0x47deac-0x0;var _0x2e6b3d=_0xc311[_0x47deac];return _0x2e6b3d;};'use strict';var _=require(_0x1c31('0x0'));var util=require('util');var moment=require(_0x1c31('0x1'));var BPromise=require('bluebird');var rs=require(_0x1c31('0x2'));var fs=require('fs');var Redis=require(_0x1c31('0x3'));var db=require(_0x1c31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c31('0x5'))(_0x1c31('0x6'));var config=require(_0x1c31('0x7'));var jayson=require(_0x1c31('0x8'));var client=jayson['client'][_0x1c31('0x9')]({'port':0x232a});config[_0x1c31('0xa')]=_[_0x1c31('0xb')](config[_0x1c31('0xa')],{'host':_0x1c31('0xc'),'port':0x18eb});var socket=require(_0x1c31('0xd'))(new Redis(config[_0x1c31('0xa')]));require('./chatInteraction.socket')[_0x1c31('0xe')](socket);function respondWithRpcPromise(_0x5d65bb,_0x576586,_0x5d182a){return new BPromise(function(_0x412615,_0x474d2d){return client[_0x1c31('0xf')](_0x5d65bb,_0x5d182a)[_0x1c31('0x10')](function(_0x3d26a3){logger[_0x1c31('0x11')](_0x1c31('0x12'),_0x576586,_0x1c31('0x13'));logger[_0x1c31('0x14')](_0x1c31('0x15'),_0x576586,_0x1c31('0x13'),JSON[_0x1c31('0x16')](_0x3d26a3));if(_0x3d26a3[_0x1c31('0x17')]){if(_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x18')]===0x1f4){logger[_0x1c31('0x17')](_0x1c31('0x12'),_0x576586,_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x19')]);return _0x474d2d(_0x3d26a3['error'][_0x1c31('0x19')]);}logger[_0x1c31('0x17')](_0x1c31('0x12'),_0x576586,_0x3d26a3[_0x1c31('0x17')]['message']);return _0x412615(_0x3d26a3[_0x1c31('0x17')][_0x1c31('0x19')]);}else{logger[_0x1c31('0x11')](_0x1c31('0x12'),_0x576586,_0x1c31('0x13'));_0x412615(_0x3d26a3['result'][_0x1c31('0x19')]);}})[_0x1c31('0x1a')](function(_0x342d21){logger[_0x1c31('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x576586,_0x342d21);_0x474d2d(_0x342d21);});});}exports[_0x1c31('0x1b')]=function(_0x338809){var _0x1c17da=this;return new Promise(function(_0x35ce5e,_0x3c8dfc){return db[_0x1c31('0x1c')]['update'](_0x338809[_0x1c31('0x1d')],{'raw':_0x338809['options']?_0x338809[_0x1c31('0x1e')][_0x1c31('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')]['where']||null:null,'attributes':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')][_0x1c31('0x20')]||null:null,'limit':_0x338809[_0x1c31('0x1e')]?_0x338809[_0x1c31('0x1e')][_0x1c31('0x21')]||null:null})['then'](function(_0xdfbdb1){logger[_0x1c31('0x11')](_0x1c31('0x1b'),_0x338809);logger['debug'](_0x1c31('0x1b'),_0x338809,JSON[_0x1c31('0x16')](_0xdfbdb1));_0x35ce5e(_0xdfbdb1);})[_0x1c31('0x1a')](function(_0x3b474f){logger[_0x1c31('0x17')]('UpdateChatInteraction',_0x3b474f[_0x1c31('0x19')],_0x338809);_0x3c8dfc(_0x1c17da[_0x1c31('0x17')](0x1f4,_0x3b474f[_0x1c31('0x19')]));});});};exports[_0x1c31('0x22')]=function(_0x35383b){return new Promise(function(_0x2cab5f,_0x31cc91){return db[_0x1c31('0x1c')][_0x1c31('0x23')]({'where':_0x35383b['options']?_0x35383b[_0x1c31('0x1e')][_0x1c31('0x24')]||null:null})[_0x1c31('0x10')](function(_0x4beb56){if(_0x4beb56){return _0x4beb56[_0x1c31('0x25')](_0x35383b[_0x1c31('0x1d')][_0x1c31('0x26')],_[_0x1c31('0x27')](_0x35383b[_0x1c31('0x1d')],['ids','id'])||{});}})['spread'](function(_0x3ba33e){logger[_0x1c31('0x11')](_0x1c31('0x28'),_0x35383b);logger[_0x1c31('0x14')](_0x1c31('0x28'),_0x35383b,JSON[_0x1c31('0x16')](_0x3ba33e));_0x2cab5f(_0x3ba33e);})[_0x1c31('0x1a')](function(_0x3a74a0){logger[_0x1c31('0x17')](_0x1c31('0x28'),_0x3a74a0[_0x1c31('0x19')],_0x35383b);_0x31cc91(_this['error'](0x1f4,_0x3a74a0['message']));});});}; \ No newline at end of file +var _0xd786=['socket.io-emitter','./chatInteraction.socket','register','info','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToChatInteraction','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost'];(function(_0x1d2a7e,_0x330e09){var _0x135f9f=function(_0x5d0bfa){while(--_0x5d0bfa){_0x1d2a7e['push'](_0x1d2a7e['shift']());}};_0x135f9f(++_0x330e09);}(_0xd786,0xb6));var _0x6d78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd786[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d78('0x0'));var util=require(_0x6d78('0x1'));var moment=require(_0x6d78('0x2'));var BPromise=require(_0x6d78('0x3'));var rs=require(_0x6d78('0x4'));var fs=require('fs');var Redis=require(_0x6d78('0x5'));var db=require(_0x6d78('0x6'))['db'];var utils=require(_0x6d78('0x7'));var logger=require('../../config/logger')(_0x6d78('0x8'));var config=require(_0x6d78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6d78('0xa')]['http']({'port':0x232a});config[_0x6d78('0xb')]=_['defaults'](config[_0x6d78('0xb')],{'host':_0x6d78('0xc'),'port':0x18eb});var socket=require(_0x6d78('0xd'))(new Redis(config[_0x6d78('0xb')]));require(_0x6d78('0xe'))[_0x6d78('0xf')](socket);function respondWithRpcPromise(_0x4bf8d2,_0x44a6ce,_0x44c57e){return new BPromise(function(_0x135b0e,_0x492a22){return client['request'](_0x4bf8d2,_0x44c57e)['then'](function(_0x5976da){logger[_0x6d78('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x44a6ce,_0x6d78('0x11'));logger[_0x6d78('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x44a6ce,_0x6d78('0x11'),JSON[_0x6d78('0x13')](_0x5976da));if(_0x5976da['error']){if(_0x5976da[_0x6d78('0x14')][_0x6d78('0x15')]===0x1f4){logger['error'](_0x6d78('0x16'),_0x44a6ce,_0x5976da[_0x6d78('0x14')][_0x6d78('0x17')]);return _0x492a22(_0x5976da[_0x6d78('0x14')][_0x6d78('0x17')]);}logger[_0x6d78('0x14')](_0x6d78('0x16'),_0x44a6ce,_0x5976da['error'][_0x6d78('0x17')]);return _0x135b0e(_0x5976da[_0x6d78('0x14')][_0x6d78('0x17')]);}else{logger[_0x6d78('0x10')](_0x6d78('0x16'),_0x44a6ce,_0x6d78('0x11'));_0x135b0e(_0x5976da['result'][_0x6d78('0x17')]);}})[_0x6d78('0x18')](function(_0x1c43c9){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x44a6ce,_0x1c43c9);_0x492a22(_0x1c43c9);});});}exports[_0x6d78('0x19')]=function(_0x59b710){var _0x5b2d2f=this;return new Promise(function(_0x4a0fd5,_0x1b9ffd){return db[_0x6d78('0x1a')][_0x6d78('0x1b')](_0x59b710[_0x6d78('0x1c')],{'raw':_0x59b710[_0x6d78('0x1d')]?_0x59b710['options'][_0x6d78('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b710[_0x6d78('0x1d')]?_0x59b710[_0x6d78('0x1d')][_0x6d78('0x1f')]||null:null,'attributes':_0x59b710[_0x6d78('0x1d')]?_0x59b710['options'][_0x6d78('0x20')]||null:null,'limit':_0x59b710[_0x6d78('0x1d')]?_0x59b710[_0x6d78('0x1d')][_0x6d78('0x21')]||null:null})[_0x6d78('0x22')](function(_0x3991b0){logger['info']('UpdateChatInteraction',_0x59b710);logger[_0x6d78('0x12')](_0x6d78('0x19'),_0x59b710,JSON[_0x6d78('0x13')](_0x3991b0));_0x4a0fd5(_0x3991b0);})[_0x6d78('0x18')](function(_0x480fbe){logger[_0x6d78('0x14')](_0x6d78('0x19'),_0x480fbe['message'],_0x59b710);_0x1b9ffd(_0x5b2d2f[_0x6d78('0x14')](0x1f4,_0x480fbe[_0x6d78('0x17')]));});});};exports[_0x6d78('0x23')]=function(_0x1e8f28){return new Promise(function(_0x4b831a,_0x588a00){return db['ChatInteraction']['find']({'where':_0x1e8f28['options']?_0x1e8f28['options']['where']||null:null})['then'](function(_0x32ee24){if(_0x32ee24){return _0x32ee24['addTags'](_0x1e8f28[_0x6d78('0x1c')][_0x6d78('0x24')],_['omit'](_0x1e8f28[_0x6d78('0x1c')],[_0x6d78('0x24'),'id'])||{});}})[_0x6d78('0x25')](function(_0x54e53b){logger[_0x6d78('0x10')](_0x6d78('0x26'),_0x1e8f28);logger[_0x6d78('0x12')](_0x6d78('0x26'),_0x1e8f28,JSON[_0x6d78('0x13')](_0x54e53b));_0x4b831a(_0x54e53b);})['catch'](function(_0x4a9fab){logger[_0x6d78('0x14')](_0x6d78('0x26'),_0x4a9fab[_0x6d78('0x17')],_0x1e8f28);_0x588a00(_this[_0x6d78('0x14')](0x1f4,_0x4a9fab[_0x6d78('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2f80698..24428b1 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 _0x0fd1=['remove','emit','removeListener','register','length','./chatInteraction.events','save'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0fd1,0x12b));var _0x10fd=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x0fd1[_0x1f9f37];return _0x21c080;};'use strict';var ChatInteractionEvents=require(_0x10fd('0x0'));var events=[_0x10fd('0x1'),_0x10fd('0x2'),'update'];function createListener(_0x17838b,_0x462192){return function(_0x463e65){_0x462192[_0x10fd('0x3')](_0x17838b,_0x463e65);};}function removeListener(_0x634117,_0x33b0ec){return function(){ChatInteractionEvents[_0x10fd('0x4')](_0x634117,_0x33b0ec);};}exports[_0x10fd('0x5')]=function(_0x48150b){for(var _0x35a74b=0x0,_0x1d8be4=events[_0x10fd('0x6')];_0x35a74b<_0x1d8be4;_0x35a74b++){var _0x28094f=events[_0x35a74b];var _0x362c75=createListener('chatInteraction:'+_0x28094f,_0x48150b);ChatInteractionEvents['on'](_0x28094f,_0x362c75);}}; \ No newline at end of file +var _0x24e9=['./chatInteraction.events','save','remove','update','emit','removeListener','register','chatInteraction:'];(function(_0x5dfe1b,_0x258f3e){var _0x37c3d3=function(_0x48cc79){while(--_0x48cc79){_0x5dfe1b['push'](_0x5dfe1b['shift']());}};_0x37c3d3(++_0x258f3e);}(_0x24e9,0x1a8));var _0x924e=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x24e9[_0x22e47a];return _0x15a12a;};'use strict';var ChatInteractionEvents=require(_0x924e('0x0'));var events=[_0x924e('0x1'),_0x924e('0x2'),_0x924e('0x3')];function createListener(_0x3089b3,_0x35ba78){return function(_0x19254c){_0x35ba78[_0x924e('0x4')](_0x3089b3,_0x19254c);};}function removeListener(_0x45ee53,_0x5be91d){return function(){ChatInteractionEvents[_0x924e('0x5')](_0x45ee53,_0x5be91d);};}exports[_0x924e('0x6')]=function(_0x57a15d){for(var _0x2ae816=0x0,_0x577ea6=events['length'];_0x2ae816<_0x577ea6;_0x2ae816++){var _0x172436=events[_0x2ae816];var _0x6b84c4=createListener(_0x924e('0x7')+_0x172436,_0x57a15d);ChatInteractionEvents['on'](_0x172436,_0x6b84c4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b1df7fe..227cc5c 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 _0xf407=['isAuthenticated','index','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','abandon','close','delete','chat','chatinteraction:destroy','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get'];(function(_0x37f94c,_0x474dd6){var _0x4452a4=function(_0x30da23){while(--_0x30da23){_0x37f94c['push'](_0x37f94c['shift']());}};_0x4452a4(++_0x474dd6);}(_0xf407,0xc2));var _0x7f40=function(_0x55b6e1,_0x37c619){_0x55b6e1=_0x55b6e1-0x0;var _0x410f04=_0xf407[_0x55b6e1];return _0x410f04;};'use strict';var multer=require('multer');var util=require(_0x7f40('0x0'));var path=require(_0x7f40('0x1'));var timeout=require(_0x7f40('0x2'));var express=require(_0x7f40('0x3'));var router=express['Router']();var fs_extra=require(_0x7f40('0x4'));var auth=require(_0x7f40('0x5'));var interaction=require(_0x7f40('0x6'));var config=require(_0x7f40('0x7'));var controller=require(_0x7f40('0x8'));router[_0x7f40('0x9')]('/',auth[_0x7f40('0xa')](),controller[_0x7f40('0xb')]);router[_0x7f40('0x9')]('/describe',auth[_0x7f40('0xa')](),controller['describe']);router['get'](_0x7f40('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x7f40('0x9')](_0x7f40('0xd'),auth[_0x7f40('0xe')](),controller[_0x7f40('0xf')]);router[_0x7f40('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x7f40('0x10')]);router[_0x7f40('0x9')](_0x7f40('0x11'),auth[_0x7f40('0xe')](),controller[_0x7f40('0x12')]);router[_0x7f40('0x9')]('/:id/download',auth[_0x7f40('0xa')](),controller[_0x7f40('0x13')]);router[_0x7f40('0x14')]('/',auth[_0x7f40('0xa')](),controller[_0x7f40('0x15')]);router[_0x7f40('0x14')](_0x7f40('0x16'),auth[_0x7f40('0xa')](),controller[_0x7f40('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25a5b9,_0x531a87,_0x1fa906){_0x1fa906(null,path[_0x7f40('0x18')](config[_0x7f40('0x19')],'server/files/attachments/'));},'filename':function(_0x64c9fc,_0xe7c7ca,_0x2ae059){_0x2ae059(null,util[_0x7f40('0x1a')](_0x7f40('0x1b'),Date[_0x7f40('0x1c')](),_0xe7c7ca[_0x7f40('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7f40('0x14')](_0x7f40('0x1e'),upload[_0x7f40('0x1f')](_0x7f40('0x20')),controller[_0x7f40('0x21')]);router['post'](_0x7f40('0x22'),auth['isChatInteractionAuthorized'](),controller[_0x7f40('0x23')]);router[_0x7f40('0x14')](_0x7f40('0x24'),auth[_0x7f40('0xa')](),interaction[_0x7f40('0x25')]('chat',_0x7f40('0x26')),controller[_0x7f40('0x27')]);router[_0x7f40('0x28')](_0x7f40('0xc'),auth[_0x7f40('0xa')](),interaction[_0x7f40('0x25')]('chat',_0x7f40('0x29')),controller[_0x7f40('0x2a')]);router[_0x7f40('0x28')](_0x7f40('0x2b'),controller['customUpdate']);router[_0x7f40('0x28')]('/:id/abandon',auth[_0x7f40('0xe')](),controller[_0x7f40('0x2c')]);router[_0x7f40('0x28')]('/:id/close',controller[_0x7f40('0x2d')]);router[_0x7f40('0x2e')](_0x7f40('0xc'),auth[_0x7f40('0xa')](),interaction['tracked'](_0x7f40('0x2f'),_0x7f40('0x30')),controller[_0x7f40('0x31')]);router[_0x7f40('0x2e')]('/:id/tags',auth[_0x7f40('0xa')](),controller['removeTags']);module[_0x7f40('0x32')]=router; \ No newline at end of file +var _0x75be=['tracked','chatinteraction:update','update','put','customUpdate','/:id/abandon','/:id/close','chatinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','download','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','post','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','/:id'];(function(_0x14d29c,_0x316135){var _0x21ef00=function(_0x1a3351){while(--_0x1a3351){_0x14d29c['push'](_0x14d29c['shift']());}};_0x21ef00(++_0x316135);}(_0x75be,0x10a));var _0xe75b=function(_0x23deec,_0x9aafd7){_0x23deec=_0x23deec-0x0;var _0x124d90=_0x75be[_0x23deec];return _0x124d90;};'use strict';var multer=require(_0xe75b('0x0'));var util=require(_0xe75b('0x1'));var path=require(_0xe75b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe75b('0x3')]();var fs_extra=require(_0xe75b('0x4'));var auth=require(_0xe75b('0x5'));var interaction=require(_0xe75b('0x6'));var config=require('../../config/environment');var controller=require(_0xe75b('0x7'));router[_0xe75b('0x8')]('/',auth[_0xe75b('0x9')](),controller[_0xe75b('0xa')]);router[_0xe75b('0x8')](_0xe75b('0xb'),auth[_0xe75b('0x9')](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller[_0xe75b('0xc')]);router['get'](_0xe75b('0xd'),auth[_0xe75b('0xe')](),controller[_0xe75b('0xf')]);router[_0xe75b('0x8')](_0xe75b('0x10'),auth['isAuthenticated'](),controller[_0xe75b('0x11')]);router[_0xe75b('0x8')]('/:id/my_messages',auth[_0xe75b('0xe')](),controller['getMyMessages']);router['get'](_0xe75b('0x12'),auth[_0xe75b('0x9')](),controller[_0xe75b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe75b('0x14')]);router['post'](_0xe75b('0x15'),auth[_0xe75b('0x9')](),controller[_0xe75b('0x16')]);var upload=multer({'storage':multer[_0xe75b('0x17')]({'destination':function(_0x5bd4da,_0x11f95e,_0x284049){_0x284049(null,path[_0xe75b('0x18')](config[_0xe75b('0x19')],'server/files/attachments/'));},'filename':function(_0x954b74,_0x48ce76,_0x133e56){_0x133e56(null,util[_0xe75b('0x1a')]('%s-%s',Date['now'](),_0x48ce76[_0xe75b('0x1b')][_0xe75b('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe75b('0x1d'),upload[_0xe75b('0x1e')](_0xe75b('0x1f')),controller[_0xe75b('0x20')]);router[_0xe75b('0x21')]('/:id/messages',auth[_0xe75b('0xe')](),controller[_0xe75b('0x22')]);router[_0xe75b('0x21')](_0xe75b('0x23'),auth['isAuthenticated'](),interaction['tracked'](_0xe75b('0x24'),_0xe75b('0x25')),controller[_0xe75b('0x26')]);router['put'](_0xe75b('0x27'),auth[_0xe75b('0x9')](),interaction[_0xe75b('0x28')](_0xe75b('0x24'),_0xe75b('0x29')),controller[_0xe75b('0x2a')]);router[_0xe75b('0x2b')]('/:id/custom_update',controller[_0xe75b('0x2c')]);router[_0xe75b('0x2b')](_0xe75b('0x2d'),auth[_0xe75b('0xe')](),controller['abandon']);router[_0xe75b('0x2b')](_0xe75b('0x2e'),controller['close']);router['delete'](_0xe75b('0x27'),auth[_0xe75b('0x9')](),interaction[_0xe75b('0x28')](_0xe75b('0x24'),_0xe75b('0x2f')),controller[_0xe75b('0x30')]);router[_0xe75b('0x31')](_0xe75b('0x23'),auth[_0xe75b('0x9')](),controller['removeTags']);module[_0xe75b('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 98b0d2b..5fa6371 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 _0x5e39=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5e39,0x19e));var _0x95e3=function(_0x20e8d8,_0x4e5d66){_0x20e8d8=_0x20e8d8-0x0;var _0x3ed8dd=_0x5e39[_0x20e8d8];return _0x3ed8dd;};'use strict';var Sequelize=require(_0x95e3('0x0'));module['exports']={'body':{'type':Sequelize[_0x95e3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x95e3('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x95e3('0x3')]}}; \ No newline at end of file +var _0x209f=['BOOLEAN','INTEGER','exports','TEXT'];(function(_0x26c7d3,_0x31be42){var _0x430566=function(_0x295191){while(--_0x295191){_0x26c7d3['push'](_0x26c7d3['shift']());}};_0x430566(++_0x31be42);}(_0x209f,0x11a));var _0xf209=function(_0x407bd4,_0x4bfc3a){_0x407bd4=_0x407bd4-0x0;var _0x1f05c3=_0x209f[_0x407bd4];return _0x1f05c3;};'use strict';var Sequelize=require('sequelize');module[_0xf209('0x0')]={'body':{'type':Sequelize[_0xf209('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf209('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf209('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f7d78bf..514f569 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 _0x36f6=['nolimit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','create','body','update','find','params','describe','messages','lastMessageAt','createdAt','format','lastMessage','User','agent','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','type','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','all','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4ec322,_0x4192ca){var _0x24aa83=function(_0x4f5f7a){while(--_0x4f5f7a){_0x4ec322['push'](_0x4ec322['shift']());}};_0x24aa83(++_0x4192ca);}(_0x36f6,0x103));var _0x636f=function(_0x2a9548,_0x2742f6){_0x2a9548=_0x2a9548-0x0;var _0xf55c55=_0x36f6[_0x2a9548];return _0xf55c55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x636f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x636f('0x1'));var rp=require('request-promise');var moment=require(_0x636f('0x2'));var BPromise=require(_0x636f('0x3'));var Mustache=require(_0x636f('0x4'));var util=require(_0x636f('0x5'));var path=require('path');var sox=require(_0x636f('0x6'));var csv=require('to-csv');var ejs=require(_0x636f('0x7'));var fs=require('fs');var fs_extra=require(_0x636f('0x8'));var _=require('lodash');var squel=require(_0x636f('0x9'));var crypto=require(_0x636f('0xa'));var jsforce=require(_0x636f('0xb'));var deskjs=require(_0x636f('0xc'));var toCsv=require(_0x636f('0xd'));var querystring=require(_0x636f('0xe'));var Papa=require('papaparse');var Redis=require(_0x636f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x636f('0x10'));var hardwareService=require(_0x636f('0x11'));var logger=require('../../config/logger')(_0x636f('0x12'));var utils=require(_0x636f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x636f('0x14'));var db=require(_0x636f('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x636f('0x16'),'port':0x18eb});var socket=require(_0x636f('0x17'))(new Redis(config[_0x636f('0x18')]));require(_0x636f('0x19'))[_0x636f('0x1a')](socket);function respondWithStatusCode(_0x4e5b79,_0x29433b){_0x29433b=_0x29433b||0xcc;return function(_0x5297d2){if(_0x5297d2){return _0x4e5b79[_0x636f('0x1b')](_0x29433b);}return _0x4e5b79[_0x636f('0x1c')](_0x29433b)[_0x636f('0x1d')]();};}function respondWithResult(_0x2fb846,_0x5201f4){_0x5201f4=_0x5201f4||0xc8;return function(_0x190208){if(_0x190208){return _0x2fb846[_0x636f('0x1c')](_0x5201f4)[_0x636f('0x1e')](_0x190208);}};}function respondWithFilteredResult(_0x52cb39,_0x16d460){return function(_0xc8f2fd){if(_0xc8f2fd){var _0x33730c=typeof _0x16d460['offset']===_0x636f('0x1f')&&typeof _0x16d460[_0x636f('0x20')]===_0x636f('0x1f');var _0x190a58=_0xc8f2fd[_0x636f('0x21')];var _0x235b3a=_0x33730c?0x0:_0x16d460[_0x636f('0x22')];var _0x150983=_0x33730c?_0xc8f2fd[_0x636f('0x21')]:_0x16d460[_0x636f('0x22')]+_0x16d460[_0x636f('0x20')];var _0xd25ba9;if(_0x150983>=_0x190a58){_0x150983=_0x190a58;_0xd25ba9=0xc8;}else{_0xd25ba9=0xce;}_0x52cb39[_0x636f('0x1c')](_0xd25ba9);return _0x52cb39[_0x636f('0x23')](_0x636f('0x24'),_0x235b3a+'-'+_0x150983+'/'+_0x190a58)[_0x636f('0x1e')](_0xc8f2fd);}return null;};}function patchUpdates(_0x5b9cdd){return function(_0x599c7e){try{jsonpatch['apply'](_0x599c7e,_0x5b9cdd,!![]);}catch(_0x5ee310){return BPromise[_0x636f('0x25')](_0x5ee310);}return _0x599c7e[_0x636f('0x26')]();};}function saveUpdates(_0x1f51b5,_0x5eb4cb){return function(_0x16ff4b){if(_0x16ff4b){return _0x16ff4b['update'](_0x1f51b5)['then'](function(_0x1fbbb8){return _0x1fbbb8;});}return null;};}function removeEntity(_0x49d207,_0x30dd8d){return function(_0x3b35c2){if(_0x3b35c2){return _0x3b35c2[_0x636f('0x27')]()[_0x636f('0x28')](function(){_0x49d207[_0x636f('0x1c')](0xcc)[_0x636f('0x1d')]();});}};}function handleEntityNotFound(_0x60e9bb,_0x504391){return function(_0x1a488c){if(!_0x1a488c){_0x60e9bb['sendStatus'](0x194);}return _0x1a488c;};}function handleError(_0xc930eb,_0x48a5b8){_0x48a5b8=_0x48a5b8||0x1f4;return function(_0x32fc6a){logger[_0x636f('0x29')](_0x32fc6a[_0x636f('0x2a')]);if(_0x32fc6a[_0x636f('0x2b')]){delete _0x32fc6a[_0x636f('0x2b')];}_0xc930eb['status'](_0x48a5b8)[_0x636f('0x2c')](_0x32fc6a);};}exports['index']=function(_0x169342,_0x35416e){var _0x457113={},_0x13772a={},_0x40f256={'count':0x0,'rows':[]};var _0x2d7d67=_[_0x636f('0x2d')](db[_0x636f('0x2e')][_0x636f('0x2f')],function(_0xb20b20){return{'name':_0xb20b20[_0x636f('0x30')],'type':_0xb20b20['type'][_0x636f('0x31')]};});_0x13772a[_0x636f('0x32')]=_[_0x636f('0x2d')](_0x2d7d67,'name');_0x13772a[_0x636f('0x33')]=_[_0x636f('0x34')](_0x169342[_0x636f('0x33')]);_0x13772a[_0x636f('0x35')]=_[_0x636f('0x36')](_0x13772a[_0x636f('0x32')],_0x13772a[_0x636f('0x33')]);_0x457113[_0x636f('0x37')]=_[_0x636f('0x36')](_0x13772a[_0x636f('0x32')],qs[_0x636f('0x38')](_0x169342[_0x636f('0x33')]['fields']));_0x457113['attributes']=_0x457113[_0x636f('0x37')][_0x636f('0x39')]?_0x457113[_0x636f('0x37')]:_0x13772a['model'];if(!_0x169342['query'][_0x636f('0x3a')](_0x636f('0x3b'))){_0x457113[_0x636f('0x20')]=qs[_0x636f('0x20')](_0x169342[_0x636f('0x33')][_0x636f('0x20')]);_0x457113['offset']=qs[_0x636f('0x22')](_0x169342['query'][_0x636f('0x22')]);}_0x457113['order']=qs[_0x636f('0x3c')](_0x169342[_0x636f('0x33')][_0x636f('0x3c')]);_0x457113['where']=qs[_0x636f('0x35')](_[_0x636f('0x3d')](_0x169342['query'],_0x13772a['filters']),_0x2d7d67);if(_0x169342['query']['filter']){_0x457113[_0x636f('0x3e')]=_[_0x636f('0x3f')](_0x457113[_0x636f('0x3e')],{'$or':_[_0x636f('0x2d')](_0x2d7d67,function(_0x4a0bb2){if(_0x4a0bb2['type']!==_0x636f('0x40')){var _0x2e9654={};_0x2e9654[_0x4a0bb2['name']]={'$like':'%'+_0x169342[_0x636f('0x33')][_0x636f('0x41')]+'%'};return _0x2e9654;}})});}_0x457113=_[_0x636f('0x3f')]({},_0x457113,_0x169342['options']);var _0x537c16={'where':_0x457113[_0x636f('0x3e')]};return db[_0x636f('0x2e')][_0x636f('0x21')](_0x537c16)[_0x636f('0x28')](function(_0x17d552){_0x40f256[_0x636f('0x21')]=_0x17d552;if(_0x169342[_0x636f('0x33')][_0x636f('0x42')]){_0x457113[_0x636f('0x43')]=[{'all':!![]}];}return db[_0x636f('0x2e')][_0x636f('0x44')](_0x457113);})[_0x636f('0x28')](function(_0x2a38df){_0x40f256[_0x636f('0x45')]=_0x2a38df;return _0x40f256;})[_0x636f('0x28')](respondWithFilteredResult(_0x35416e,_0x457113))[_0x636f('0x46')](handleError(_0x35416e,null));};exports['show']=function(_0x504dd4,_0xeb1b69){var _0x3bee5c={'raw':!![],'where':{'id':_0x504dd4['params']['id']}},_0x193aa8={};_0x193aa8[_0x636f('0x32')]=_[_0x636f('0x34')](db[_0x636f('0x2e')][_0x636f('0x2f')]);_0x193aa8[_0x636f('0x33')]=_[_0x636f('0x34')](_0x504dd4['query']);_0x193aa8[_0x636f('0x35')]=_['intersection'](_0x193aa8[_0x636f('0x32')],_0x193aa8[_0x636f('0x33')]);_0x3bee5c[_0x636f('0x37')]=_[_0x636f('0x36')](_0x193aa8['model'],qs['fields'](_0x504dd4['query'][_0x636f('0x38')]));_0x3bee5c[_0x636f('0x37')]=_0x3bee5c[_0x636f('0x37')][_0x636f('0x39')]?_0x3bee5c[_0x636f('0x37')]:_0x193aa8['model'];if(_0x504dd4[_0x636f('0x33')][_0x636f('0x42')]){_0x3bee5c[_0x636f('0x43')]=[{'all':!![]}];}_0x3bee5c=_[_0x636f('0x3f')]({},_0x3bee5c,_0x504dd4[_0x636f('0x47')]);return db[_0x636f('0x2e')]['find'](_0x3bee5c)[_0x636f('0x28')](handleEntityNotFound(_0xeb1b69,null))[_0x636f('0x28')](respondWithResult(_0xeb1b69,null))[_0x636f('0x46')](handleError(_0xeb1b69,null));};exports[_0x636f('0x48')]=function(_0x4ca429,_0x4b07a5){return db['ChatInternalMessage']['create'](_0x4ca429[_0x636f('0x49')],{})['then'](respondWithResult(_0x4b07a5,0xc9))[_0x636f('0x46')](handleError(_0x4b07a5,null));};exports[_0x636f('0x4a')]=function(_0x45664f,_0x542365){if(_0x45664f[_0x636f('0x49')]['id']){delete _0x45664f['body']['id'];}return db[_0x636f('0x2e')][_0x636f('0x4b')]({'where':{'id':_0x45664f['params']['id']}})[_0x636f('0x28')](handleEntityNotFound(_0x542365,null))[_0x636f('0x28')](saveUpdates(_0x45664f[_0x636f('0x49')],null))[_0x636f('0x28')](respondWithResult(_0x542365,null))['catch'](handleError(_0x542365,null));};exports['destroy']=function(_0xcf7537,_0x13e7ea){return db[_0x636f('0x2e')][_0x636f('0x4b')]({'where':{'id':_0xcf7537[_0x636f('0x4c')]['id']}})[_0x636f('0x28')](handleEntityNotFound(_0x13e7ea,null))[_0x636f('0x28')](removeEntity(_0x13e7ea,null))[_0x636f('0x46')](handleError(_0x13e7ea,null));};exports['describe']=function(_0x13fb11,_0x367649){return db[_0x636f('0x2e')][_0x636f('0x4d')]()[_0x636f('0x28')](respondWithResult(_0x367649,null))[_0x636f('0x46')](handleError(_0x367649,null));};function wrapUser(_0x4b43d5){return function(_0x3c726a){var _0x5b44ef=_0x4b43d5['get']({'plain':!![]});_0x5b44ef[_0x636f('0x4e')]=[];if(_0x3c726a){_0x5b44ef[_0x636f('0x4f')]=_0x3c726a[_0x636f('0x50')];_0x5b44ef['lastMessage']=_0x3c726a;}else{_0x5b44ef['lastMessageAt']=moment(0x0)[_0x636f('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b44ef[_0x636f('0x52')]={};}return _0x5b44ef;};}exports['getUsers']=function(_0x367443,_0x5a6218,_0x51bdc7){var _0x3b7629=[];return db[_0x636f('0x53')][_0x636f('0x44')]({'where':{'role':[_0x636f('0x54'),'admin','user']},'attributes':['id','fullname',_0x636f('0x2b'),_0x636f('0x55'),_0x636f('0x56'),_0x636f('0x57'),_0x636f('0x58'),_0x636f('0x59'),'allowmessenger',_0x636f('0x5a')],'order':qs[_0x636f('0x3c')]('-online'),'include':[{'model':db[_0x636f('0x5b')],'as':_0x636f('0x5c'),'attributes':['id',_0x636f('0x2b'),_0x636f('0x5d')],'through':{'attributes':[]}}]})[_0x636f('0x28')](function(_0x392225){if(_0x392225){var _0x5f0fa5=_0x367443['user'][_0x636f('0x5e')]({'plain':!![]});if(!_0x5f0fa5)throw new Error(_0x636f('0x5f'));if(_0x5f0fa5[_0x636f('0x55')]===_0x636f('0x60')){return db[_0x636f('0x61')][_0x636f('0x4b')]({'where':{'name':'Agents','userProfileId':_0x5f0fa5[_0x636f('0x62')]},'raw':!![]})[_0x636f('0x28')](function(_0x1a7dbe){if(_0x1a7dbe){if(_0x1a7dbe[_0x636f('0x63')]===0x0){return db[_0x636f('0x64')]['findAll']({'where':{'sectionId':_0x1a7dbe['id']},'raw':!![]})[_0x636f('0x28')](function(_0x506fe0){var _0x5c6a19=[];if(_['isEmpty'](_0x506fe0)){_0x5c6a19=_[_0x636f('0x41')](_0x392225,function(_0x1b6cbc){if(_0x1b6cbc['role']!==_0x636f('0x54')){return _0x1b6cbc;}});return _0x5c6a19;}else{for(var _0x65e34=0x0;_0x65e34<_0x392225[_0x636f('0x39')];_0x65e34++){var _0x418abf=_0x392225[_0x65e34];if(_0x418abf[_0x636f('0x55')]==='agent'){var _0x1f18af=_['find'](_0x506fe0,function(_0x28c77e){return _0x28c77e[_0x636f('0x65')]===_0x418abf['id'];});if(_0x1f18af)_0x5c6a19['push'](_0x418abf);}else{_0x5c6a19[_0x636f('0x66')](_0x418abf);}}return _0x5c6a19;}});}else{return _0x392225;}}else{var _0x2d55a0=_[_0x636f('0x41')](_0x392225,function(_0x2dec9e){if(_0x2dec9e['role']!==_0x636f('0x54')){return _0x2dec9e;}});return _0x2d55a0;}});}else{return _0x392225;}}})[_0x636f('0x28')](function(_0x50b730){var _0x370879=[];if(_0x50b730){_0x3b7629=_0x50b730;for(var _0x2649a3=0x0;_0x2649a3<_0x50b730[_0x636f('0x39')];_0x2649a3+=0x1){_0x3b7629[_0x2649a3][_0x636f('0x4e')]=[];_0x370879[_0x636f('0x66')](db['ChatInternalMessage'][_0x636f('0x4b')]({'where':{'FromId':[_0x367443['user']['id'],_0x50b730[_0x2649a3]['id']],'ToId':[_0x367443['user']['id'],_0x50b730[_0x2649a3]['id']],'ChatGroupId':null},'attributes':['id',_0x636f('0x50'),_0x636f('0x67'),_0x636f('0x68'),'read',_0x636f('0x49')],'order':qs[_0x636f('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x636f('0x28')](wrapUser(_0x50b730[_0x2649a3])));}return BPromise[_0x636f('0x69')](_0x370879);}return[];})[_0x636f('0x28')](function(_0x2124d4){return{'rows':_0x2124d4,'count':_0x2124d4[_0x636f('0x39')]};})[_0x636f('0x28')](respondWithResult(_0x5a6218,null))[_0x636f('0x46')](handleError(_0x5a6218,null));}; \ No newline at end of file +var _0x09af=['body','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','user','role','userpic','internal','online','allowmessenger','showWebBar','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','ChatInternalMessage','type','key','model','map','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','length','find','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09af,0x1c7));var _0xf09a=function(_0x552dfe,_0x22f551){_0x552dfe=_0x552dfe-0x0;var _0x38c0f8=_0x09af[_0x552dfe];return _0x38c0f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf09a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf09a('0x1'));var rp=require(_0xf09a('0x2'));var moment=require(_0xf09a('0x3'));var BPromise=require(_0xf09a('0x4'));var Mustache=require('mustache');var util=require(_0xf09a('0x5'));var path=require(_0xf09a('0x6'));var sox=require(_0xf09a('0x7'));var csv=require('to-csv');var ejs=require(_0xf09a('0x8'));var fs=require('fs');var fs_extra=require(_0xf09a('0x9'));var _=require('lodash');var squel=require(_0xf09a('0xa'));var crypto=require('crypto');var jsforce=require(_0xf09a('0xb'));var deskjs=require(_0xf09a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf09a('0xd'));var Papa=require(_0xf09a('0xe'));var Redis=require(_0xf09a('0xf'));var authService=require(_0xf09a('0x10'));var qs=require(_0xf09a('0x11'));var as=require(_0xf09a('0x12'));var hardwareService=require(_0xf09a('0x13'));var logger=require('../../config/logger')(_0xf09a('0x14'));var utils=require('../../config/utils');var config=require(_0xf09a('0x15'));var licenseUtil=require(_0xf09a('0x16'));var db=require('../../mysqldb')['db'];config[_0xf09a('0x17')]=_[_0xf09a('0x18')](config[_0xf09a('0x17')],{'host':_0xf09a('0x19'),'port':0x18eb});var socket=require(_0xf09a('0x1a'))(new Redis(config[_0xf09a('0x17')]));require(_0xf09a('0x1b'))[_0xf09a('0x1c')](socket);function respondWithStatusCode(_0x34508b,_0x6bda7e){_0x6bda7e=_0x6bda7e||0xcc;return function(_0x43fcfc){if(_0x43fcfc){return _0x34508b['sendStatus'](_0x6bda7e);}return _0x34508b[_0xf09a('0x1d')](_0x6bda7e)['end']();};}function respondWithResult(_0x43ebf7,_0x44ad29){_0x44ad29=_0x44ad29||0xc8;return function(_0x3b8121){if(_0x3b8121){return _0x43ebf7[_0xf09a('0x1d')](_0x44ad29)['json'](_0x3b8121);}};}function respondWithFilteredResult(_0x544a7b,_0x5bfb97){return function(_0x3a0871){if(_0x3a0871){var _0x1e8ffc=typeof _0x5bfb97['offset']===_0xf09a('0x1e')&&typeof _0x5bfb97[_0xf09a('0x1f')]===_0xf09a('0x1e');var _0x489e55=_0x3a0871['count'];var _0x2ee289=_0x1e8ffc?0x0:_0x5bfb97['offset'];var _0x476281=_0x1e8ffc?_0x3a0871[_0xf09a('0x20')]:_0x5bfb97[_0xf09a('0x21')]+_0x5bfb97[_0xf09a('0x1f')];var _0x599291;if(_0x476281>=_0x489e55){_0x476281=_0x489e55;_0x599291=0xc8;}else{_0x599291=0xce;}_0x544a7b[_0xf09a('0x1d')](_0x599291);return _0x544a7b[_0xf09a('0x22')]('Content-Range',_0x2ee289+'-'+_0x476281+'/'+_0x489e55)[_0xf09a('0x23')](_0x3a0871);}return null;};}function patchUpdates(_0x295f51){return function(_0x39d03d){try{jsonpatch[_0xf09a('0x24')](_0x39d03d,_0x295f51,!![]);}catch(_0xb36cc){return BPromise[_0xf09a('0x25')](_0xb36cc);}return _0x39d03d[_0xf09a('0x26')]();};}function saveUpdates(_0x435f76,_0x344344){return function(_0x2dba85){if(_0x2dba85){return _0x2dba85[_0xf09a('0x27')](_0x435f76)['then'](function(_0x287aa6){return _0x287aa6;});}return null;};}function removeEntity(_0x15e3ae,_0x45cca1){return function(_0x2617bd){if(_0x2617bd){return _0x2617bd['destroy']()[_0xf09a('0x28')](function(){_0x15e3ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32eafd,_0x285d3b){return function(_0x4e218d){if(!_0x4e218d){_0x32eafd[_0xf09a('0x29')](0x194);}return _0x4e218d;};}function handleError(_0x1c545c,_0xebc70a){_0xebc70a=_0xebc70a||0x1f4;return function(_0x1da3e0){logger[_0xf09a('0x2a')](_0x1da3e0[_0xf09a('0x2b')]);if(_0x1da3e0[_0xf09a('0x2c')]){delete _0x1da3e0['name'];}_0x1c545c[_0xf09a('0x1d')](_0xebc70a)['send'](_0x1da3e0);};}exports[_0xf09a('0x2d')]=function(_0x467b0f,_0xb7ddf6){var _0xa6fb9f={},_0x444c8c={},_0xc15377={'count':0x0,'rows':[]};var _0x225cb6=_['map'](db[_0xf09a('0x2e')]['rawAttributes'],function(_0x316a1a){return{'name':_0x316a1a['fieldName'],'type':_0x316a1a[_0xf09a('0x2f')][_0xf09a('0x30')]};});_0x444c8c[_0xf09a('0x31')]=_[_0xf09a('0x32')](_0x225cb6,'name');_0x444c8c[_0xf09a('0x33')]=_['keys'](_0x467b0f['query']);_0x444c8c['filters']=_[_0xf09a('0x34')](_0x444c8c['model'],_0x444c8c[_0xf09a('0x33')]);_0xa6fb9f[_0xf09a('0x35')]=_[_0xf09a('0x34')](_0x444c8c[_0xf09a('0x31')],qs[_0xf09a('0x36')](_0x467b0f['query'][_0xf09a('0x36')]));_0xa6fb9f[_0xf09a('0x35')]=_0xa6fb9f['attributes']['length']?_0xa6fb9f[_0xf09a('0x35')]:_0x444c8c[_0xf09a('0x31')];if(!_0x467b0f[_0xf09a('0x33')]['hasOwnProperty'](_0xf09a('0x37'))){_0xa6fb9f[_0xf09a('0x1f')]=qs[_0xf09a('0x1f')](_0x467b0f[_0xf09a('0x33')][_0xf09a('0x1f')]);_0xa6fb9f['offset']=qs[_0xf09a('0x21')](_0x467b0f[_0xf09a('0x33')]['offset']);}_0xa6fb9f[_0xf09a('0x38')]=qs[_0xf09a('0x39')](_0x467b0f[_0xf09a('0x33')][_0xf09a('0x39')]);_0xa6fb9f['where']=qs[_0xf09a('0x3a')](_[_0xf09a('0x3b')](_0x467b0f[_0xf09a('0x33')],_0x444c8c[_0xf09a('0x3a')]),_0x225cb6);if(_0x467b0f['query'][_0xf09a('0x3c')]){_0xa6fb9f[_0xf09a('0x3d')]=_[_0xf09a('0x3e')](_0xa6fb9f[_0xf09a('0x3d')],{'$or':_[_0xf09a('0x32')](_0x225cb6,function(_0x56f5f){if(_0x56f5f[_0xf09a('0x2f')]!==_0xf09a('0x3f')){var _0x2e8c8d={};_0x2e8c8d[_0x56f5f[_0xf09a('0x2c')]]={'$like':'%'+_0x467b0f[_0xf09a('0x33')]['filter']+'%'};return _0x2e8c8d;}})});}_0xa6fb9f=_['merge']({},_0xa6fb9f,_0x467b0f[_0xf09a('0x40')]);var _0xdfcbb9={'where':_0xa6fb9f['where']};return db['ChatInternalMessage'][_0xf09a('0x20')](_0xdfcbb9)[_0xf09a('0x28')](function(_0x11f633){_0xc15377[_0xf09a('0x20')]=_0x11f633;if(_0x467b0f[_0xf09a('0x33')][_0xf09a('0x41')]){_0xa6fb9f[_0xf09a('0x42')]=[{'all':!![]}];}return db[_0xf09a('0x2e')][_0xf09a('0x43')](_0xa6fb9f);})[_0xf09a('0x28')](function(_0x5261ab){_0xc15377['rows']=_0x5261ab;return _0xc15377;})[_0xf09a('0x28')](respondWithFilteredResult(_0xb7ddf6,_0xa6fb9f))[_0xf09a('0x44')](handleError(_0xb7ddf6,null));};exports['show']=function(_0x3b9163,_0x303bb0){var _0x2ccf6d={'raw':!![],'where':{'id':_0x3b9163[_0xf09a('0x45')]['id']}},_0x510121={};_0x510121['model']=_[_0xf09a('0x46')](db[_0xf09a('0x2e')][_0xf09a('0x47')]);_0x510121['query']=_[_0xf09a('0x46')](_0x3b9163[_0xf09a('0x33')]);_0x510121[_0xf09a('0x3a')]=_[_0xf09a('0x34')](_0x510121[_0xf09a('0x31')],_0x510121['query']);_0x2ccf6d[_0xf09a('0x35')]=_['intersection'](_0x510121[_0xf09a('0x31')],qs[_0xf09a('0x36')](_0x3b9163[_0xf09a('0x33')][_0xf09a('0x36')]));_0x2ccf6d[_0xf09a('0x35')]=_0x2ccf6d['attributes'][_0xf09a('0x48')]?_0x2ccf6d[_0xf09a('0x35')]:_0x510121[_0xf09a('0x31')];if(_0x3b9163['query'][_0xf09a('0x41')]){_0x2ccf6d['include']=[{'all':!![]}];}_0x2ccf6d=_[_0xf09a('0x3e')]({},_0x2ccf6d,_0x3b9163[_0xf09a('0x40')]);return db[_0xf09a('0x2e')][_0xf09a('0x49')](_0x2ccf6d)[_0xf09a('0x28')](handleEntityNotFound(_0x303bb0,null))[_0xf09a('0x28')](respondWithResult(_0x303bb0,null))[_0xf09a('0x44')](handleError(_0x303bb0,null));};exports['create']=function(_0x345ce3,_0x5a6c01){return db[_0xf09a('0x2e')][_0xf09a('0x4a')](_0x345ce3[_0xf09a('0x4b')],{})['then'](respondWithResult(_0x5a6c01,0xc9))[_0xf09a('0x44')](handleError(_0x5a6c01,null));};exports[_0xf09a('0x27')]=function(_0x4abb8d,_0x3ad175){if(_0x4abb8d[_0xf09a('0x4b')]['id']){delete _0x4abb8d[_0xf09a('0x4b')]['id'];}return db[_0xf09a('0x2e')]['find']({'where':{'id':_0x4abb8d['params']['id']}})[_0xf09a('0x28')](handleEntityNotFound(_0x3ad175,null))['then'](saveUpdates(_0x4abb8d[_0xf09a('0x4b')],null))[_0xf09a('0x28')](respondWithResult(_0x3ad175,null))[_0xf09a('0x44')](handleError(_0x3ad175,null));};exports['destroy']=function(_0x243a7c,_0x4464ba){return db[_0xf09a('0x2e')][_0xf09a('0x49')]({'where':{'id':_0x243a7c[_0xf09a('0x45')]['id']}})[_0xf09a('0x28')](handleEntityNotFound(_0x4464ba,null))[_0xf09a('0x28')](removeEntity(_0x4464ba,null))[_0xf09a('0x44')](handleError(_0x4464ba,null));};exports[_0xf09a('0x4c')]=function(_0x2dcffc,_0x369634){return db[_0xf09a('0x2e')][_0xf09a('0x4c')]()[_0xf09a('0x28')](respondWithResult(_0x369634,null))[_0xf09a('0x44')](handleError(_0x369634,null));};function wrapUser(_0x3e706f){return function(_0x225413){var _0x5373db=_0x3e706f['get']({'plain':!![]});_0x5373db[_0xf09a('0x4d')]=[];if(_0x225413){_0x5373db[_0xf09a('0x4e')]=_0x225413['createdAt'];_0x5373db['lastMessage']=_0x225413;}else{_0x5373db['lastMessageAt']=moment(0x0)[_0xf09a('0x4f')](_0xf09a('0x50'));_0x5373db[_0xf09a('0x51')]={};}return _0x5373db;};}exports[_0xf09a('0x52')]=function(_0x4de89e,_0x36bfe5,_0x50504a){var _0x137303=[];return db[_0xf09a('0x53')]['findAll']({'where':{'role':[_0xf09a('0x54'),'admin',_0xf09a('0x55')]},'attributes':['id','fullname','name',_0xf09a('0x56'),_0xf09a('0x57'),_0xf09a('0x58'),_0xf09a('0x59'),'lastLoginAt',_0xf09a('0x5a'),_0xf09a('0x5b')],'order':qs[_0xf09a('0x39')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xf09a('0x5c'),'attributes':['id','name',_0xf09a('0x2f')],'through':{'attributes':[]}}]})[_0xf09a('0x28')](function(_0x877473){if(_0x877473){var _0x2c1d26=_0x4de89e[_0xf09a('0x55')][_0xf09a('0x5d')]({'plain':!![]});if(!_0x2c1d26)throw new Error(_0xf09a('0x5e'));if(_0x2c1d26[_0xf09a('0x56')]==='user'){return db['UserProfileSection'][_0xf09a('0x49')]({'where':{'name':'Agents','userProfileId':_0x2c1d26[_0xf09a('0x5f')]},'raw':!![]})[_0xf09a('0x28')](function(_0x5d7df0){if(_0x5d7df0){if(_0x5d7df0[_0xf09a('0x60')]===0x0){return db[_0xf09a('0x61')][_0xf09a('0x43')]({'where':{'sectionId':_0x5d7df0['id']},'raw':!![]})[_0xf09a('0x28')](function(_0x513b7b){var _0x1548d6=[];if(_[_0xf09a('0x62')](_0x513b7b)){_0x1548d6=_[_0xf09a('0x3c')](_0x877473,function(_0x3e58c4){if(_0x3e58c4['role']!=='agent'){return _0x3e58c4;}});return _0x1548d6;}else{for(var _0x5dce16=0x0;_0x5dce16<_0x877473[_0xf09a('0x48')];_0x5dce16++){var _0xd055f5=_0x877473[_0x5dce16];if(_0xd055f5[_0xf09a('0x56')]===_0xf09a('0x54')){var _0x257ab5=_[_0xf09a('0x49')](_0x513b7b,function(_0x20ec3d){return _0x20ec3d[_0xf09a('0x63')]===_0xd055f5['id'];});if(_0x257ab5)_0x1548d6[_0xf09a('0x64')](_0xd055f5);}else{_0x1548d6[_0xf09a('0x64')](_0xd055f5);}}return _0x1548d6;}});}else{return _0x877473;}}else{var _0x5f471a=_[_0xf09a('0x3c')](_0x877473,function(_0xfb134){if(_0xfb134[_0xf09a('0x56')]!=='agent'){return _0xfb134;}});return _0x5f471a;}});}else{return _0x877473;}}})['then'](function(_0xc6e32e){var _0xd6176b=[];if(_0xc6e32e){_0x137303=_0xc6e32e;for(var _0x1949e5=0x0;_0x1949e5<_0xc6e32e[_0xf09a('0x48')];_0x1949e5+=0x1){_0x137303[_0x1949e5][_0xf09a('0x4d')]=[];_0xd6176b['push'](db[_0xf09a('0x2e')][_0xf09a('0x49')]({'where':{'FromId':[_0x4de89e['user']['id'],_0xc6e32e[_0x1949e5]['id']],'ToId':[_0x4de89e[_0xf09a('0x55')]['id'],_0xc6e32e[_0x1949e5]['id']],'ChatGroupId':null},'attributes':['id',_0xf09a('0x65'),_0xf09a('0x66'),'ToId',_0xf09a('0x67'),_0xf09a('0x4b')],'order':qs[_0xf09a('0x39')](_0xf09a('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf09a('0x28')](wrapUser(_0xc6e32e[_0x1949e5])));}return BPromise[_0xf09a('0x69')](_0xd6176b);}return[];})[_0xf09a('0x28')](function(_0x488f07){return{'rows':_0x488f07,'count':_0x488f07[_0xf09a('0x48')]};})[_0xf09a('0x28')](respondWithResult(_0x36bfe5,null))[_0xf09a('0x44')](handleError(_0x36bfe5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 004c80e..a16a381 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 _0x9370=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x30c552,_0x2b82e5){var _0x19b79c=function(_0x4a8e42){while(--_0x4a8e42){_0x30c552['push'](_0x30c552['shift']());}};_0x19b79c(++_0x2b82e5);}(_0x9370,0x158));var _0x0937=function(_0x242cf7,_0x45077c){_0x242cf7=_0x242cf7-0x0;var _0x2611d6=_0x9370[_0x242cf7];return _0x2611d6;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x0937('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0937('0x1')](0x0);var events={'afterCreate':_0x0937('0x2'),'afterUpdate':_0x0937('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18af83){return function(_0x42bcab,_0x4577cb,_0x470d2a){ChatInternalMessageEvents[_0x0937('0x4')](_0x18af83+':'+_0x42bcab['id'],_0x42bcab);ChatInternalMessageEvents[_0x0937('0x4')](_0x18af83,_0x42bcab);_0x470d2a(null);};}for(var e in events){if(events[_0x0937('0x5')](e)){var event=events[e];ChatInternalMessage[_0x0937('0x6')](e,emitEvent(event));}}module[_0x0937('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x898c=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save'];(function(_0x2828e3,_0x226f75){var _0x3205e1=function(_0x680dd8){while(--_0x680dd8){_0x2828e3['push'](_0x2828e3['shift']());}};_0x3205e1(++_0x226f75);}(_0x898c,0x73));var _0xc898=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x898c[_0x3b6652];return _0x14d39f;};'use strict';var EventEmitter=require(_0xc898('0x0'));var ChatInternalMessage=require(_0xc898('0x1'))['db'][_0xc898('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc898('0x3')](0x0);var events={'afterCreate':_0xc898('0x4'),'afterUpdate':_0xc898('0x5'),'afterDestroy':_0xc898('0x6')};function emitEvent(_0x3be9ba){return function(_0x2cb021,_0x5a5dfb,_0x2c3940){ChatInternalMessageEvents[_0xc898('0x7')](_0x3be9ba+':'+_0x2cb021['id'],_0x2cb021);ChatInternalMessageEvents[_0xc898('0x7')](_0x3be9ba,_0x2cb021);_0x2c3940(null);};}for(var e in events){if(events[_0xc898('0x8')](e)){var event=events[e];ChatInternalMessage[_0xc898('0x9')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c924062..e32a11f 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 _0x148a=['./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','../../config/environment'];(function(_0x193dd8,_0x4ad6c6){var _0x2ddafe=function(_0x348691){while(--_0x348691){_0x193dd8['push'](_0x193dd8['shift']());}};_0x2ddafe(++_0x4ad6c6);}(_0x148a,0xb8));var _0xa148=function(_0x440ad1,_0x329511){_0x440ad1=_0x440ad1-0x0;var _0x32cebd=_0x148a[_0x440ad1];return _0x32cebd;};'use strict';var _=require(_0xa148('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa148('0x1'));var BPromise=require(_0xa148('0x2'));var rp=require(_0xa148('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa148('0x4'));var attributes=require(_0xa148('0x5'));module[_0xa148('0x6')]=function(_0x1ee966,_0x49efd3){return _0x1ee966['define']('ChatInternalMessage',attributes,{'tableName':_0xa148('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa148('0x8')});}; \ No newline at end of file +var _0xe04f=['request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4','lodash','api','bluebird'];(function(_0x2ab726,_0x21370a){var _0x10bcae=function(_0x5cf377){while(--_0x5cf377){_0x2ab726['push'](_0x2ab726['shift']());}};_0x10bcae(++_0x21370a);}(_0xe04f,0xd9));var _0xfe04=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xe04f[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0xfe04('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe04('0x1'));var moment=require('moment');var BPromise=require(_0xfe04('0x2'));var rp=require(_0xfe04('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe04('0x4'));var config=require(_0xfe04('0x5'));var attributes=require(_0xfe04('0x6'));module['exports']=function(_0xce28c2,_0x2a7aae){return _0xce28c2[_0xfe04('0x7')](_0xfe04('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe04('0x9'),'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 21f7ef1..7474735 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 _0xef1c=['ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','then'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xef1c,0x176));var _0xcef1=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xef1c[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xcef1('0x0'));var util=require(_0xcef1('0x1'));var moment=require('moment');var BPromise=require(_0xcef1('0x2'));var rs=require(_0xcef1('0x3'));var fs=require('fs');var Redis=require(_0xcef1('0x4'));var db=require(_0xcef1('0x5'))['db'];var utils=require(_0xcef1('0x6'));var logger=require(_0xcef1('0x7'))('rpc');var config=require(_0xcef1('0x8'));var jayson=require(_0xcef1('0x9'));var client=jayson[_0xcef1('0xa')]['http']({'port':0x232a});config[_0xcef1('0xb')]=_['defaults'](config[_0xcef1('0xb')],{'host':_0xcef1('0xc'),'port':0x18eb});var socket=require(_0xcef1('0xd'))(new Redis(config[_0xcef1('0xb')]));require('./chatInternalMessage.socket')[_0xcef1('0xe')](socket);function respondWithRpcPromise(_0x44bc05,_0x4fe666,_0x1352f4){return new BPromise(function(_0x12b227,_0x2a450b){return client['request'](_0x44bc05,_0x1352f4)[_0xcef1('0xf')](function(_0x5316dd){logger['info'](_0xcef1('0x10'),_0x4fe666,'request\x20sent');logger[_0xcef1('0x11')](_0xcef1('0x12'),_0x4fe666,_0xcef1('0x13'),JSON['stringify'](_0x5316dd));if(_0x5316dd[_0xcef1('0x14')]){if(_0x5316dd[_0xcef1('0x14')][_0xcef1('0x15')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4fe666,_0x5316dd[_0xcef1('0x14')]['message']);return _0x2a450b(_0x5316dd['error'][_0xcef1('0x16')]);}logger[_0xcef1('0x14')](_0xcef1('0x10'),_0x4fe666,_0x5316dd[_0xcef1('0x14')]['message']);return _0x12b227(_0x5316dd[_0xcef1('0x14')][_0xcef1('0x16')]);}else{logger[_0xcef1('0x17')](_0xcef1('0x10'),_0x4fe666,_0xcef1('0x13'));_0x12b227(_0x5316dd[_0xcef1('0x18')][_0xcef1('0x16')]);}})[_0xcef1('0x19')](function(_0x57f94a){logger[_0xcef1('0x14')](_0xcef1('0x10'),_0x4fe666,_0x57f94a);_0x2a450b(_0x57f94a);});});} \ No newline at end of file +var _0x6ab7=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info'];(function(_0x482c2b,_0x4e7ffe){var _0x45ca44=function(_0x18ae8a){while(--_0x18ae8a){_0x482c2b['push'](_0x482c2b['shift']());}};_0x45ca44(++_0x4e7ffe);}(_0x6ab7,0x15a));var _0x76ab=function(_0x387f6e,_0x52977b){_0x387f6e=_0x387f6e-0x0;var _0x68e3b2=_0x6ab7[_0x387f6e];return _0x68e3b2;};'use strict';var _=require(_0x76ab('0x0'));var util=require(_0x76ab('0x1'));var moment=require(_0x76ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x76ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x76ab('0x5'))('rpc');var config=require(_0x76ab('0x6'));var jayson=require(_0x76ab('0x7'));var client=jayson[_0x76ab('0x8')][_0x76ab('0x9')]({'port':0x232a});config[_0x76ab('0xa')]=_[_0x76ab('0xb')](config[_0x76ab('0xa')],{'host':_0x76ab('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76ab('0xa')]));require(_0x76ab('0xd'))[_0x76ab('0xe')](socket);function respondWithRpcPromise(_0x52ec19,_0x12073a,_0x59d49f){return new BPromise(function(_0x1f8df1,_0x66d790){return client[_0x76ab('0xf')](_0x52ec19,_0x59d49f)[_0x76ab('0x10')](function(_0x3437bd){logger[_0x76ab('0x11')](_0x76ab('0x12'),_0x12073a,_0x76ab('0x13'));logger['debug'](_0x76ab('0x14'),_0x12073a,_0x76ab('0x13'),JSON[_0x76ab('0x15')](_0x3437bd));if(_0x3437bd[_0x76ab('0x16')]){if(_0x3437bd[_0x76ab('0x16')]['code']===0x1f4){logger[_0x76ab('0x16')](_0x76ab('0x12'),_0x12073a,_0x3437bd[_0x76ab('0x16')][_0x76ab('0x17')]);return _0x66d790(_0x3437bd['error'][_0x76ab('0x17')]);}logger[_0x76ab('0x16')](_0x76ab('0x12'),_0x12073a,_0x3437bd[_0x76ab('0x16')][_0x76ab('0x17')]);return _0x1f8df1(_0x3437bd['error']['message']);}else{logger[_0x76ab('0x11')](_0x76ab('0x12'),_0x12073a,'request\x20sent');_0x1f8df1(_0x3437bd[_0x76ab('0x18')][_0x76ab('0x17')]);}})[_0x76ab('0x19')](function(_0x4071fd){logger[_0x76ab('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x12073a,_0x4071fd);_0x66d790(_0x4071fd);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fae3e7f..af5869f 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 _0x5c31=['emit','register','chatInternalMessage:','remove'];(function(_0x1c92b9,_0x4dfa28){var _0x32e602=function(_0x25e2ff){while(--_0x25e2ff){_0x1c92b9['push'](_0x1c92b9['shift']());}};_0x32e602(++_0x4dfa28);}(_0x5c31,0x107));var _0x15c3=function(_0x5964c8,_0x3b18a8){_0x5964c8=_0x5964c8-0x0;var _0x140b2d=_0x5c31[_0x5964c8];return _0x140b2d;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x15c3('0x0'),'update'];function createListener(_0x3f0079,_0x53116c){return function(_0x40ae25){_0x53116c[_0x15c3('0x1')](_0x3f0079,_0x40ae25);};}function removeListener(_0x5a1a85,_0xea579c){return function(){ChatInternalMessageEvents['removeListener'](_0x5a1a85,_0xea579c);};}exports[_0x15c3('0x2')]=function(_0x299879){for(var _0x38f303=0x0,_0x57cc0f=events['length'];_0x38f303<_0x57cc0f;_0x38f303++){var _0x5635c1=events[_0x38f303];var _0x34f4ef=createListener(_0x15c3('0x3')+_0x5635c1,_0x299879);ChatInternalMessageEvents['on'](_0x5635c1,_0x34f4ef);}}; \ No newline at end of file +var _0x8d88=['remove','update','emit','removeListener','register','./chatInternalMessage.events','save'];(function(_0x4ec7f2,_0x3d92d2){var _0x118004=function(_0x1ac4fb){while(--_0x1ac4fb){_0x4ec7f2['push'](_0x4ec7f2['shift']());}};_0x118004(++_0x3d92d2);}(_0x8d88,0x1be));var _0x88d8=function(_0x2ae424,_0x307344){_0x2ae424=_0x2ae424-0x0;var _0x5c9540=_0x8d88[_0x2ae424];return _0x5c9540;};'use strict';var ChatInternalMessageEvents=require(_0x88d8('0x0'));var events=[_0x88d8('0x1'),_0x88d8('0x2'),_0x88d8('0x3')];function createListener(_0xd185e8,_0x156436){return function(_0x37fd71){_0x156436[_0x88d8('0x4')](_0xd185e8,_0x37fd71);};}function removeListener(_0x297e09,_0x1a10da){return function(){ChatInternalMessageEvents[_0x88d8('0x5')](_0x297e09,_0x1a10da);};}exports[_0x88d8('0x6')]=function(_0x402203){for(var _0x118e16=0x0,_0x53b9c9=events['length'];_0x118e16<_0x53b9c9;_0x118e16++){var _0x508641=events[_0x118e16];var _0x2aa2f3=createListener('chatInternalMessage:'+_0x508641,_0x402203);ChatInternalMessageEvents['on'](_0x508641,_0x2aa2f3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d38ebcd..1acea68 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 _0x0143=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','multer'];(function(_0x45c8e3,_0x4c2b9f){var _0x5068b3=function(_0x3e1c72){while(--_0x3e1c72){_0x45c8e3['push'](_0x45c8e3['shift']());}};_0x5068b3(++_0x4c2b9f);}(_0x0143,0x113));var _0x3014=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0143[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x3014('0x0'));var util=require(_0x3014('0x1'));var path=require(_0x3014('0x2'));var timeout=require('connect-timeout');var express=require(_0x3014('0x3'));var router=express[_0x3014('0x4')]();var fs_extra=require(_0x3014('0x5'));var auth=require(_0x3014('0x6'));var interaction=require(_0x3014('0x7'));var config=require(_0x3014('0x8'));var controller=require(_0x3014('0x9'));router[_0x3014('0xa')]('/',auth['isAuthenticated'](),controller[_0x3014('0xb')]);router['get'](_0x3014('0xc'),auth[_0x3014('0xd')](),controller[_0x3014('0xe')]);router[_0x3014('0xa')](_0x3014('0xf'),auth[_0x3014('0xd')](),controller[_0x3014('0x10')]);router['get'](_0x3014('0x11'),auth[_0x3014('0xd')](),controller[_0x3014('0x12')]);router[_0x3014('0x13')]('/',auth[_0x3014('0xd')](),controller[_0x3014('0x14')]);router[_0x3014('0x15')](_0x3014('0x11'),controller[_0x3014('0x16')]);router['delete'](_0x3014('0x11'),auth[_0x3014('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaaad=['./chatInternalMessage.controller','index','get','/describe','isAuthenticated','describe','/users','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaaad,0xa1));var _0xdaaa=function(_0x241672,_0x5d9d8a){_0x241672=_0x241672-0x0;var _0x2f81aa=_0xaaad[_0x241672];return _0x2f81aa;};'use strict';var multer=require('multer');var util=require(_0xdaaa('0x0'));var path=require(_0xdaaa('0x1'));var timeout=require(_0xdaaa('0x2'));var express=require('express');var router=express[_0xdaaa('0x3')]();var fs_extra=require(_0xdaaa('0x4'));var auth=require(_0xdaaa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdaaa('0x6'));var controller=require(_0xdaaa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdaaa('0x8')]);router[_0xdaaa('0x9')](_0xdaaa('0xa'),auth[_0xdaaa('0xb')](),controller[_0xdaaa('0xc')]);router['get'](_0xdaaa('0xd'),auth[_0xdaaa('0xb')](),controller['getUsers']);router['get'](_0xdaaa('0xe'),auth[_0xdaaa('0xb')](),controller['show']);router['post']('/',auth[_0xdaaa('0xb')](),controller[_0xdaaa('0xf')]);router[_0xdaaa('0x10')]('/:id',controller[_0xdaaa('0x11')]);router[_0xdaaa('0x12')]('/:id',auth[_0xdaaa('0xb')](),controller[_0xdaaa('0x13')]);module[_0xdaaa('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index b4f311d..1458f28 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 _0x4213=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x3ccd28,_0x4f37fc){var _0x50548c=function(_0x422f25){while(--_0x422f25){_0x3ccd28['push'](_0x3ccd28['shift']());}};_0x50548c(++_0x4f37fc);}(_0x4213,0x77));var _0x3421=function(_0x5a660a,_0x3a388f){_0x5a660a=_0x5a660a-0x0;var _0x53a90b=_0x4213[_0x5a660a];return _0x53a90b;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'body':{'type':Sequelize[_0x3421('0x2')](_0x3421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3421('0x5')]('in','out'),'defaultValue':_0x3421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3421('0x7')]},'providerResponse':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file +var _0x68b7=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x1d4495,_0x4e7607){var _0x53ac0c=function(_0x9d686e){while(--_0x9d686e){_0x1d4495['push'](_0x1d4495['shift']());}};_0x53ac0c(++_0x4e7607);}(_0x68b7,0x8c));var _0x768b=function(_0xe12aa2,_0x2bc7de){_0xe12aa2=_0xe12aa2-0x0;var _0x3bbde6=_0x68b7[_0xe12aa2];return _0x3bbde6;};'use strict';var Sequelize=require(_0x768b('0x0'));module['exports']={'body':{'type':Sequelize[_0x768b('0x1')](_0x768b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x768b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x768b('0x4')]('in',_0x768b('0x5')),'defaultValue':_0x768b('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x768b('0x6')]},'providerResponse':{'type':Sequelize[_0x768b('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0758d70..3a7d176 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 _0x89a7=['stack','name','send','ChatMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','create','body','update','find','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','formData','chat-interactions','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','parse','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','end'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x89a7,0x1ea));var _0x789a=function(_0x35dbd1,_0x5d53b8){_0x35dbd1=_0x35dbd1-0x0;var _0x5ebe70=_0x89a7[_0x35dbd1];return _0x5ebe70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x789a('0x0'));var zipdir=require(_0x789a('0x1'));var jsonpatch=require(_0x789a('0x2'));var rp=require(_0x789a('0x3'));var moment=require(_0x789a('0x4'));var BPromise=require(_0x789a('0x5'));var Mustache=require(_0x789a('0x6'));var util=require(_0x789a('0x7'));var path=require(_0x789a('0x8'));var sox=require(_0x789a('0x9'));var csv=require('to-csv');var ejs=require(_0x789a('0xa'));var fs=require('fs');var fs_extra=require(_0x789a('0xb'));var _=require(_0x789a('0xc'));var squel=require(_0x789a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x789a('0xe'));var toCsv=require(_0x789a('0xf'));var querystring=require(_0x789a('0x10'));var Papa=require('papaparse');var Redis=require(_0x789a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x789a('0x12'));var as=require(_0x789a('0x13'));var hardwareService=require(_0x789a('0x14'));var logger=require(_0x789a('0x15'))(_0x789a('0x16'));var utils=require(_0x789a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x789a('0x18'));var db=require('../../mysqldb')['db'];config[_0x789a('0x19')]=_[_0x789a('0x1a')](config['redis'],{'host':_0x789a('0x1b'),'port':0x18eb});var socket=require(_0x789a('0x1c'))(new Redis(config[_0x789a('0x19')]));require(_0x789a('0x1d'))[_0x789a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x789a('0x1f')][_0x789a('0x20')]({'port':0x232c});var client9002=jayson[_0x789a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4622b0,_0x8bd795,_0xf6e08,_0xdb29e1){return new BPromise(function(_0x5565e6,_0x2e50c0){var _0x163a41=_0xdb29e1||client;return _0x163a41[_0x789a('0x21')](_0x4622b0,_0xf6e08)[_0x789a('0x22')](function(_0x47e981){logger[_0x789a('0x23')](_0x789a('0x24'),_0x8bd795,'request\x20sent');logger[_0x789a('0x25')](_0x789a('0x26'),_0x8bd795,_0x789a('0x27'),JSON['stringify'](_0x47e981));if(_0x47e981[_0x789a('0x28')]){if(_0x47e981[_0x789a('0x28')]['code']===0x1f4){logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x47e981[_0x789a('0x28')]['message']);return _0x2e50c0(_0x47e981['error']['message']);}logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x47e981[_0x789a('0x28')][_0x789a('0x29')]);return _0x5565e6(_0x47e981[_0x789a('0x28')][_0x789a('0x29')]);}else{logger[_0x789a('0x23')](_0x789a('0x24'),_0x8bd795,_0x789a('0x27'));_0x5565e6(_0x47e981[_0x789a('0x2a')]['message']);}})[_0x789a('0x2b')](function(_0x6046bf){logger[_0x789a('0x28')](_0x789a('0x24'),_0x8bd795,_0x6046bf);_0x2e50c0(_0x6046bf);});});}function respondWithStatusCode(_0x170205,_0x477431){_0x477431=_0x477431||0xcc;return function(_0x59e174){if(_0x59e174){return _0x170205[_0x789a('0x2c')](_0x477431);}return _0x170205['status'](_0x477431)['end']();};}function respondWithResult(_0x94113f,_0x507acc){_0x507acc=_0x507acc||0xc8;return function(_0x11fa40){if(_0x11fa40){return _0x94113f[_0x789a('0x2d')](_0x507acc)[_0x789a('0x2e')](_0x11fa40);}};}function respondWithFilteredResult(_0x8268d8,_0x13fa67){return function(_0x162ae3){if(_0x162ae3){var _0x3bd461=typeof _0x13fa67[_0x789a('0x2f')]===_0x789a('0x30')&&typeof _0x13fa67[_0x789a('0x31')]===_0x789a('0x30');var _0x4ae3fc=_0x162ae3['count'];var _0xe77aff=_0x3bd461?0x0:_0x13fa67[_0x789a('0x2f')];var _0x56bbfd=_0x3bd461?_0x162ae3[_0x789a('0x32')]:_0x13fa67[_0x789a('0x2f')]+_0x13fa67[_0x789a('0x31')];var _0x577c77;if(_0x56bbfd>=_0x4ae3fc){_0x56bbfd=_0x4ae3fc;_0x577c77=0xc8;}else{_0x577c77=0xce;}_0x8268d8['status'](_0x577c77);return _0x8268d8[_0x789a('0x33')](_0x789a('0x34'),_0xe77aff+'-'+_0x56bbfd+'/'+_0x4ae3fc)['json'](_0x162ae3);}return null;};}function patchUpdates(_0x2401d4){return function(_0x297201){try{jsonpatch[_0x789a('0x35')](_0x297201,_0x2401d4,!![]);}catch(_0x1445c1){return BPromise[_0x789a('0x36')](_0x1445c1);}return _0x297201[_0x789a('0x37')]();};}function saveUpdates(_0x3a2f72,_0x234d83){return function(_0xacbadc){if(_0xacbadc){return _0xacbadc['update'](_0x3a2f72)[_0x789a('0x22')](function(_0x3c6f69){return _0x3c6f69;});}return null;};}function removeEntity(_0x322b0d,_0x457fb0){return function(_0x2893fa){if(_0x2893fa){return _0x2893fa[_0x789a('0x38')]()['then'](function(){_0x322b0d['status'](0xcc)[_0x789a('0x39')]();});}};}function handleEntityNotFound(_0x1eed3e,_0x418b44){return function(_0x316b92){if(!_0x316b92){_0x1eed3e['sendStatus'](0x194);}return _0x316b92;};}function handleError(_0x216f17,_0x5b840f){_0x5b840f=_0x5b840f||0x1f4;return function(_0x3a26b2){logger[_0x789a('0x28')](_0x3a26b2[_0x789a('0x3a')]);if(_0x3a26b2[_0x789a('0x3b')]){delete _0x3a26b2['name'];}_0x216f17[_0x789a('0x2d')](_0x5b840f)[_0x789a('0x3c')](_0x3a26b2);};}exports['index']=function(_0x355b9b,_0x4ab5d3){var _0x153e8d={},_0x290687={},_0x48ae84={'count':0x0,'rows':[]};var _0x4c7362=_['map'](db[_0x789a('0x3d')][_0x789a('0x3e')],function(_0x3aadff){return{'name':_0x3aadff[_0x789a('0x3f')],'type':_0x3aadff[_0x789a('0x40')][_0x789a('0x41')]};});_0x290687[_0x789a('0x42')]=_[_0x789a('0x43')](_0x4c7362,_0x789a('0x3b'));_0x290687[_0x789a('0x44')]=_[_0x789a('0x45')](_0x355b9b[_0x789a('0x44')]);_0x290687[_0x789a('0x46')]=_[_0x789a('0x47')](_0x290687['model'],_0x290687[_0x789a('0x44')]);_0x153e8d['attributes']=_[_0x789a('0x47')](_0x290687[_0x789a('0x42')],qs[_0x789a('0x48')](_0x355b9b['query'][_0x789a('0x48')]));_0x153e8d[_0x789a('0x49')]=_0x153e8d[_0x789a('0x49')][_0x789a('0x4a')]?_0x153e8d[_0x789a('0x49')]:_0x290687[_0x789a('0x42')];if(!_0x355b9b[_0x789a('0x44')][_0x789a('0x4b')](_0x789a('0x4c'))){_0x153e8d['limit']=qs[_0x789a('0x31')](_0x355b9b[_0x789a('0x44')][_0x789a('0x31')]);_0x153e8d['offset']=qs[_0x789a('0x2f')](_0x355b9b[_0x789a('0x44')][_0x789a('0x2f')]);}_0x153e8d[_0x789a('0x4d')]=qs[_0x789a('0x4e')](_0x355b9b[_0x789a('0x44')][_0x789a('0x4e')]);_0x153e8d[_0x789a('0x4f')]=qs[_0x789a('0x46')](_[_0x789a('0x50')](_0x355b9b[_0x789a('0x44')],_0x290687['filters']),_0x4c7362);if(_0x355b9b[_0x789a('0x44')]['filter']){_0x153e8d[_0x789a('0x4f')]=_['merge'](_0x153e8d[_0x789a('0x4f')],{'$or':_['map'](_0x4c7362,function(_0x443e63){if(_0x443e63['type']!==_0x789a('0x51')){var _0x4edf9c={};_0x4edf9c[_0x443e63[_0x789a('0x3b')]]={'$like':'%'+_0x355b9b[_0x789a('0x44')][_0x789a('0x52')]+'%'};return _0x4edf9c;}})});}_0x153e8d=_[_0x789a('0x53')]({},_0x153e8d,_0x355b9b[_0x789a('0x54')]);var _0x1de307={'where':_0x153e8d[_0x789a('0x4f')]};return db['ChatMessage'][_0x789a('0x32')](_0x1de307)[_0x789a('0x22')](function(_0x2a778b){_0x48ae84[_0x789a('0x32')]=_0x2a778b;if(_0x355b9b['query'][_0x789a('0x55')]){_0x153e8d['include']=[{'all':!![]}];}return db[_0x789a('0x3d')][_0x789a('0x56')](_0x153e8d);})['then'](function(_0x2307fc){_0x48ae84['rows']=_0x2307fc;return _0x48ae84;})[_0x789a('0x22')](respondWithFilteredResult(_0x4ab5d3,_0x153e8d))[_0x789a('0x2b')](handleError(_0x4ab5d3,null));};exports[_0x789a('0x57')]=function(_0x34d1c3,_0x1e9994){var _0x1105c5={'raw':!![],'where':{'id':_0x34d1c3[_0x789a('0x58')]['id']}},_0x1a47dd={};_0x1a47dd['model']=_[_0x789a('0x45')](db['ChatMessage'][_0x789a('0x3e')]);_0x1a47dd[_0x789a('0x44')]=_['keys'](_0x34d1c3['query']);_0x1a47dd[_0x789a('0x46')]=_[_0x789a('0x47')](_0x1a47dd[_0x789a('0x42')],_0x1a47dd[_0x789a('0x44')]);_0x1105c5['attributes']=_[_0x789a('0x47')](_0x1a47dd['model'],qs[_0x789a('0x48')](_0x34d1c3['query'][_0x789a('0x48')]));_0x1105c5[_0x789a('0x49')]=_0x1105c5['attributes'][_0x789a('0x4a')]?_0x1105c5[_0x789a('0x49')]:_0x1a47dd['model'];if(_0x34d1c3[_0x789a('0x44')]['includeAll']){_0x1105c5['include']=[{'all':!![]}];}_0x1105c5=_[_0x789a('0x53')]({},_0x1105c5,_0x34d1c3['options']);return db['ChatMessage']['find'](_0x1105c5)[_0x789a('0x22')](handleEntityNotFound(_0x1e9994,null))[_0x789a('0x22')](respondWithResult(_0x1e9994,null))[_0x789a('0x2b')](handleError(_0x1e9994,null));};exports[_0x789a('0x59')]=function(_0x13f868,_0x50c861){return db[_0x789a('0x3d')][_0x789a('0x59')](_0x13f868[_0x789a('0x5a')],{})['then'](respondWithResult(_0x50c861,0xc9))['catch'](handleError(_0x50c861,null));};exports[_0x789a('0x5b')]=function(_0x4b1562,_0x4df20c){if(_0x4b1562['body']['id']){delete _0x4b1562[_0x789a('0x5a')]['id'];}return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x4b1562['params']['id']}})['then'](handleEntityNotFound(_0x4df20c,null))[_0x789a('0x22')](saveUpdates(_0x4b1562[_0x789a('0x5a')],null))[_0x789a('0x22')](respondWithResult(_0x4df20c,null))[_0x789a('0x2b')](handleError(_0x4df20c,null));};exports[_0x789a('0x38')]=function(_0x5ec407,_0x496f09){return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x5ec407[_0x789a('0x58')]['id']}})[_0x789a('0x22')](handleEntityNotFound(_0x496f09,null))[_0x789a('0x22')](removeEntity(_0x496f09,null))[_0x789a('0x2b')](handleError(_0x496f09,null));};exports[_0x789a('0x5d')]=function(_0x51b4d9,_0x36920e){return db[_0x789a('0x3d')][_0x789a('0x5d')]()[_0x789a('0x22')](respondWithResult(_0x36920e,null))[_0x789a('0x2b')](handleError(_0x36920e,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x3bf3c6,_0x2fcd2b,_0x3c7175){var _0x2971ee={'agent':{},'channel':_0x789a('0x5e')};if(_0x3bf3c6[_0x789a('0x5a')]['id']){delete _0x3bf3c6['body']['id'];}_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x5f')]=!![];_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x60')]=moment()[_0x789a('0x61')](_0x789a('0x62'));_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x63')]=_0x3bf3c6['body'][_0x789a('0x63')]||_0x3bf3c6[_0x789a('0x64')]['id'];_0x2971ee[_0x789a('0x65')]['id']=_0x3bf3c6['body'][_0x789a('0x63')];return db[_0x789a('0x3d')][_0x789a('0x5c')]({'where':{'id':_0x3bf3c6['params']['id'],'UserId':null}})[_0x789a('0x22')](handleEntityNotFound(_0x2fcd2b,null))[_0x789a('0x22')](saveUpdates(_0x3bf3c6[_0x789a('0x5a')],null))[_0x789a('0x22')](function(_0x4ee645){if(_0x4ee645){_0x2971ee[_0x789a('0x29')]=_0x4ee645['get']({'plain':!![]});return db[_0x789a('0x66')][_0x789a('0x5c')]({'where':{'id':_0x4ee645['ChatInteractionId']}});}return null;})[_0x789a('0x22')](handleEntityNotFound(_0x2fcd2b,null))[_0x789a('0x22')](function(_0x41c1c1){if(_0x41c1c1){return _0x41c1c1[_0x789a('0x5b')]({'UserId':_0x3bf3c6['body'][_0x789a('0x63')],'read1stAt':_[_0x789a('0x67')](_0x41c1c1[_0x789a('0x68')])?moment()[_0x789a('0x61')](_0x789a('0x62')):undefined});}return null;})[_0x789a('0x22')](function(_0x13a209){if(_0x13a209){_0x2971ee[_0x789a('0x69')]=_0x13a209[_0x789a('0x6a')]({'plain':!![]});interaction_log['info'](_0x789a('0x6b'),_0x3bf3c6[_0x789a('0x64')]['id'],_0x3bf3c6[_0x789a('0x64')][_0x789a('0x3b')],_0x3bf3c6['user'][_0x789a('0x6c')],_0x2971ee[_0x789a('0x69')]['id'],_0x3bf3c6[_0x789a('0x5a')]?JSON['stringify'](_0x3bf3c6[_0x789a('0x5a')]):_0x789a('0x6d'));return respondWithRpcPromise(_0x789a('0x6e'),_0x789a('0x6f'),_0x2971ee);}return null;})['then'](function(_0x575071){var _0x4a4fa4=_0x789a('0x70')+_0x575071[_0x789a('0x29')]['ContactId'];return db['sequelize'][_0x789a('0x44')](_0x4a4fa4,{'type':db[_0x789a('0x71')][_0x789a('0x72')][_0x789a('0x73')],'raw':!![]})[_0x789a('0x22')](function(_0x535aab){return _0x535aab;});})['then'](function(_0x53c228){if(_0x53c228){_0x2971ee[_0x789a('0x29')][_0x789a('0x74')]=_0x53c228[0x0];if(!_0x3bf3c6[_0x789a('0x5a')][_0x789a('0x63')])return;return db[_0x789a('0x75')]['find']({'where':{'id':_0x3bf3c6['body'][_0x789a('0x63')],'role':'agent'},'attributes':['id','name','fullname',_0x789a('0x76'),_0x789a('0x77')],'raw':!![]});}return null;})['then'](function(_0x18e4f9){if(!_0x18e4f9)return null;_0x2971ee[_0x789a('0x29')]['agent']=_0x18e4f9;return _0x2971ee;})[_0x789a('0x22')](function(_0x153c7e){if(_0x153c7e){if(_0x3bf3c6[_0x789a('0x5a')]['manual']){_0x2971ee[_0x789a('0x29')][_0x789a('0x78')]=util[_0x789a('0x61')](_0x789a('0x79'),_0x3bf3c6[_0x789a('0x64')][_0x789a('0x3b')]);_0x2971ee[_0x789a('0x29')][_0x789a('0x7a')]=_0x2971ee[_0x789a('0x7a')];_0x2971ee['message'][_0x789a('0x7b')]=_0x2971ee[_0x789a('0x7a')];_0x2971ee[_0x789a('0x29')][_0x789a('0x7c')]=_0x789a('0x7d');return respondWithRpcPromise(_0x789a('0x7e'),_0x789a('0x7e'),{'event':_0x789a('0x7f'),'message':_[_0x789a('0x53')](_0x2971ee[_0x789a('0x29')],JSON['parse'](_0x2971ee[_0x789a('0x69')][_0x789a('0x80')]))},client9002)[_0x789a('0x22')](function(){return _0x2971ee;});}return _0x2971ee;}return null;})[_0x789a('0x22')](respondWithResult(_0x2fcd2b,null))[_0x789a('0x2b')](handleError(_0x2fcd2b,null));};var interaction_log=require('../../config/logger')(_0x789a('0x81'));exports['reject']=function(_0x26caba,_0x461757,_0x1c3d84){var _0x1a3a2f={'agent':{},'channel':_0x789a('0x5e')};if(_0x26caba['body']['id']){delete _0x26caba[_0x789a('0x5a')]['id'];}_0x26caba['body'][_0x789a('0x63')]=_0x26caba[_0x789a('0x5a')][_0x789a('0x63')]||_0x26caba[_0x789a('0x64')]['id'];_0x1a3a2f[_0x789a('0x65')]['id']=_0x26caba[_0x789a('0x5a')][_0x789a('0x63')];return db['ChatMessage'][_0x789a('0x5c')]({'where':{'id':_0x26caba['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x461757,null))[_0x789a('0x22')](function(_0x23b9ac){if(_0x23b9ac){_0x1a3a2f[_0x789a('0x29')]=_0x23b9ac[_0x789a('0x6a')]({'plain':!![]});return db[_0x789a('0x66')][_0x789a('0x5c')]({'where':{'id':_0x23b9ac[_0x789a('0x82')]}});}return null;})[_0x789a('0x22')](handleEntityNotFound(_0x461757,null))[_0x789a('0x22')](function(_0x236e63){if(_0x236e63){_0x1a3a2f[_0x789a('0x69')]=_0x236e63[_0x789a('0x6a')]({'plain':!![]});interaction_log[_0x789a('0x23')](_0x789a('0x83'),_0x26caba[_0x789a('0x64')]['id'],_0x26caba[_0x789a('0x64')][_0x789a('0x3b')],_0x26caba[_0x789a('0x64')][_0x789a('0x6c')],_0x1a3a2f['interaction']['id'],_0x26caba['body']?JSON['stringify'](_0x26caba['body']):_0x789a('0x6d'));return respondWithRpcPromise(_0x789a('0x84'),_0x789a('0x85'),_0x1a3a2f);}return null;})['then'](function(_0x1ebb55){var _0x4ed710=_0x789a('0x70')+_0x1ebb55[_0x789a('0x29')][_0x789a('0x86')];return db[_0x789a('0x87')][_0x789a('0x44')](_0x4ed710,{'type':db[_0x789a('0x71')]['QueryTypes'][_0x789a('0x73')],'raw':!![]})['then'](function(_0x48dd09){return _0x48dd09;});})[_0x789a('0x22')](function(_0x154d02){if(_0x154d02){_0x1a3a2f['message'][_0x789a('0x74')]=_0x154d02[0x0];if(!_0x26caba[_0x789a('0x5a')][_0x789a('0x63')])return;return db[_0x789a('0x75')][_0x789a('0x5c')]({'where':{'id':_0x26caba[_0x789a('0x5a')][_0x789a('0x63')],'role':_0x789a('0x65')},'attributes':['id',_0x789a('0x3b'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x789a('0x22')](function(_0x26cd2d){if(!_0x26cd2d)return null;_0x1a3a2f['message'][_0x789a('0x65')]=_0x26cd2d;return _0x1a3a2f;})[_0x789a('0x22')](function(_0x2e2de7){if(_0x2e2de7){_0x2e2de7[_0x789a('0x29')][_0x789a('0x78')]=util[_0x789a('0x61')](_0x789a('0x79'),_0x26caba[_0x789a('0x64')][_0x789a('0x3b')]);_0x2e2de7[_0x789a('0x29')][_0x789a('0x7a')]=_0x1a3a2f[_0x789a('0x7a')];_0x2e2de7['message'][_0x789a('0x7b')]=_0x1a3a2f['channel'];_0x2e2de7[_0x789a('0x29')][_0x789a('0x7c')]=_0x789a('0x36');respondWithRpcPromise(_0x789a('0x7e'),_0x789a('0x7e'),{'event':'rejectmessage','message':_[_0x789a('0x53')](_0x1a3a2f[_0x789a('0x29')],JSON[_0x789a('0x88')](_0x1a3a2f[_0x789a('0x69')][_0x789a('0x80')]))},client9002);return _0x1a3a2f;}return null;})[_0x789a('0x22')](respondWithResult(_0x461757,null))['catch'](handleError(_0x461757,null));}; \ No newline at end of file +var _0x8a7d=['status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','sequelize','Sequelize','QueryTypes','internal','rimraf','zip-dir','fast-json-patch','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','../../config/license/util','../../mysqldb','redis','defaults','jayson/promise','client','http','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','info','result','catch','sendStatus'];(function(_0x43af85,_0x5d5177){var _0x43db4f=function(_0x1d225f){while(--_0x1d225f){_0x43af85['push'](_0x43af85['shift']());}};_0x43db4f(++_0x5d5177);}(_0x8a7d,0x1ee));var _0xd8a7=function(_0x4f16b1,_0xa5e55d){_0x4f16b1=_0x4f16b1-0x0;var _0x25f479=_0x8a7d[_0x4f16b1];return _0x25f479;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8a7('0x0'));var zipdir=require(_0xd8a7('0x1'));var jsonpatch=require(_0xd8a7('0x2'));var rp=require(_0xd8a7('0x3'));var moment=require(_0xd8a7('0x4'));var BPromise=require(_0xd8a7('0x5'));var Mustache=require(_0xd8a7('0x6'));var util=require(_0xd8a7('0x7'));var path=require(_0xd8a7('0x8'));var sox=require(_0xd8a7('0x9'));var csv=require(_0xd8a7('0xa'));var ejs=require(_0xd8a7('0xb'));var fs=require('fs');var fs_extra=require(_0xd8a7('0xc'));var _=require('lodash');var squel=require(_0xd8a7('0xd'));var crypto=require(_0xd8a7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd8a7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd8a7('0x10'));var Papa=require(_0xd8a7('0x11'));var Redis=require(_0xd8a7('0x12'));var authService=require(_0xd8a7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd8a7('0x14'));var hardwareService=require(_0xd8a7('0x15'));var logger=require(_0xd8a7('0x16'))('api');var utils=require(_0xd8a7('0x17'));var config=require(_0xd8a7('0x18'));var licenseUtil=require(_0xd8a7('0x19'));var db=require(_0xd8a7('0x1a'))['db'];config[_0xd8a7('0x1b')]=_[_0xd8a7('0x1c')](config[_0xd8a7('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8a7('0x1b')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xd8a7('0x1d'));var client=jayson[_0xd8a7('0x1e')][_0xd8a7('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xd8a7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x313143,_0xbdebc5,_0x4b9bb1,_0xc2f1d5){return new BPromise(function(_0xae7160,_0x4e2e2d){var _0x30adec=_0xc2f1d5||client;return _0x30adec[_0xd8a7('0x20')](_0x313143,_0x4b9bb1)[_0xd8a7('0x21')](function(_0x66028d){logger['info']('ChatMessage,\x20%s,\x20%s',_0xbdebc5,_0xd8a7('0x22'));logger[_0xd8a7('0x23')](_0xd8a7('0x24'),_0xbdebc5,_0xd8a7('0x22'),JSON[_0xd8a7('0x25')](_0x66028d));if(_0x66028d[_0xd8a7('0x26')]){if(_0x66028d[_0xd8a7('0x26')][_0xd8a7('0x27')]===0x1f4){logger[_0xd8a7('0x26')]('ChatMessage,\x20%s,\x20%s',_0xbdebc5,_0x66028d[_0xd8a7('0x26')][_0xd8a7('0x28')]);return _0x4e2e2d(_0x66028d['error'][_0xd8a7('0x28')]);}logger[_0xd8a7('0x26')](_0xd8a7('0x29'),_0xbdebc5,_0x66028d[_0xd8a7('0x26')][_0xd8a7('0x28')]);return _0xae7160(_0x66028d['error'][_0xd8a7('0x28')]);}else{logger[_0xd8a7('0x2a')](_0xd8a7('0x29'),_0xbdebc5,_0xd8a7('0x22'));_0xae7160(_0x66028d[_0xd8a7('0x2b')][_0xd8a7('0x28')]);}})[_0xd8a7('0x2c')](function(_0x48fe22){logger['error'](_0xd8a7('0x29'),_0xbdebc5,_0x48fe22);_0x4e2e2d(_0x48fe22);});});}function respondWithStatusCode(_0x1f95ba,_0x11ee70){_0x11ee70=_0x11ee70||0xcc;return function(_0x5025f7){if(_0x5025f7){return _0x1f95ba[_0xd8a7('0x2d')](_0x11ee70);}return _0x1f95ba[_0xd8a7('0x2e')](_0x11ee70)[_0xd8a7('0x2f')]();};}function respondWithResult(_0x5b5800,_0x5544a2){_0x5544a2=_0x5544a2||0xc8;return function(_0x479801){if(_0x479801){return _0x5b5800[_0xd8a7('0x2e')](_0x5544a2)['json'](_0x479801);}};}function respondWithFilteredResult(_0x343601,_0x3a8b7b){return function(_0x436148){if(_0x436148){var _0x54a1f2=typeof _0x3a8b7b[_0xd8a7('0x30')]==='undefined'&&typeof _0x3a8b7b[_0xd8a7('0x31')]===_0xd8a7('0x32');var _0x34c71f=_0x436148[_0xd8a7('0x33')];var _0x3107e8=_0x54a1f2?0x0:_0x3a8b7b[_0xd8a7('0x30')];var _0x476efd=_0x54a1f2?_0x436148[_0xd8a7('0x33')]:_0x3a8b7b[_0xd8a7('0x30')]+_0x3a8b7b['limit'];var _0x1a8bae;if(_0x476efd>=_0x34c71f){_0x476efd=_0x34c71f;_0x1a8bae=0xc8;}else{_0x1a8bae=0xce;}_0x343601[_0xd8a7('0x2e')](_0x1a8bae);return _0x343601['set'](_0xd8a7('0x34'),_0x3107e8+'-'+_0x476efd+'/'+_0x34c71f)[_0xd8a7('0x35')](_0x436148);}return null;};}function patchUpdates(_0x5eba8f){return function(_0x105805){try{jsonpatch[_0xd8a7('0x36')](_0x105805,_0x5eba8f,!![]);}catch(_0x26c21b){return BPromise[_0xd8a7('0x37')](_0x26c21b);}return _0x105805[_0xd8a7('0x38')]();};}function saveUpdates(_0x43e8fc,_0x2e3e18){return function(_0x5925e8){if(_0x5925e8){return _0x5925e8[_0xd8a7('0x39')](_0x43e8fc)[_0xd8a7('0x21')](function(_0x135932){return _0x135932;});}return null;};}function removeEntity(_0x601d05,_0x9d9fc8){return function(_0x325f89){if(_0x325f89){return _0x325f89[_0xd8a7('0x3a')]()['then'](function(){_0x601d05[_0xd8a7('0x2e')](0xcc)[_0xd8a7('0x2f')]();});}};}function handleEntityNotFound(_0x4d1c24,_0xaae5da){return function(_0x1a16f9){if(!_0x1a16f9){_0x4d1c24[_0xd8a7('0x2d')](0x194);}return _0x1a16f9;};}function handleError(_0x326e7e,_0x582b7b){_0x582b7b=_0x582b7b||0x1f4;return function(_0x20bdd0){logger[_0xd8a7('0x26')](_0x20bdd0[_0xd8a7('0x3b')]);if(_0x20bdd0[_0xd8a7('0x3c')]){delete _0x20bdd0[_0xd8a7('0x3c')];}_0x326e7e[_0xd8a7('0x2e')](_0x582b7b)[_0xd8a7('0x3d')](_0x20bdd0);};}exports[_0xd8a7('0x3e')]=function(_0x42769d,_0x39c3c8){var _0x293f14={},_0x31094a={},_0x4eba98={'count':0x0,'rows':[]};var _0x16a299=_['map'](db[_0xd8a7('0x3f')][_0xd8a7('0x40')],function(_0x32cd8a){return{'name':_0x32cd8a['fieldName'],'type':_0x32cd8a[_0xd8a7('0x41')][_0xd8a7('0x42')]};});_0x31094a[_0xd8a7('0x43')]=_['map'](_0x16a299,_0xd8a7('0x3c'));_0x31094a[_0xd8a7('0x44')]=_[_0xd8a7('0x45')](_0x42769d[_0xd8a7('0x44')]);_0x31094a[_0xd8a7('0x46')]=_[_0xd8a7('0x47')](_0x31094a[_0xd8a7('0x43')],_0x31094a[_0xd8a7('0x44')]);_0x293f14[_0xd8a7('0x48')]=_['intersection'](_0x31094a[_0xd8a7('0x43')],qs[_0xd8a7('0x49')](_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x49')]));_0x293f14[_0xd8a7('0x48')]=_0x293f14['attributes'][_0xd8a7('0x4a')]?_0x293f14[_0xd8a7('0x48')]:_0x31094a[_0xd8a7('0x43')];if(!_0x42769d[_0xd8a7('0x44')]['hasOwnProperty'](_0xd8a7('0x4b'))){_0x293f14[_0xd8a7('0x31')]=qs[_0xd8a7('0x31')](_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x31')]);_0x293f14[_0xd8a7('0x30')]=qs[_0xd8a7('0x30')](_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x30')]);}_0x293f14[_0xd8a7('0x4c')]=qs[_0xd8a7('0x4d')](_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x4d')]);_0x293f14[_0xd8a7('0x4e')]=qs[_0xd8a7('0x46')](_[_0xd8a7('0x4f')](_0x42769d[_0xd8a7('0x44')],_0x31094a['filters']),_0x16a299);if(_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x50')]){_0x293f14[_0xd8a7('0x4e')]=_[_0xd8a7('0x51')](_0x293f14[_0xd8a7('0x4e')],{'$or':_[_0xd8a7('0x52')](_0x16a299,function(_0x13e9cb){if(_0x13e9cb['type']!==_0xd8a7('0x53')){var _0xb5d14c={};_0xb5d14c[_0x13e9cb[_0xd8a7('0x3c')]]={'$like':'%'+_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x50')]+'%'};return _0xb5d14c;}})});}_0x293f14=_[_0xd8a7('0x51')]({},_0x293f14,_0x42769d[_0xd8a7('0x54')]);var _0x58ce70={'where':_0x293f14['where']};return db[_0xd8a7('0x3f')][_0xd8a7('0x33')](_0x58ce70)[_0xd8a7('0x21')](function(_0x4eb5aa){_0x4eba98[_0xd8a7('0x33')]=_0x4eb5aa;if(_0x42769d[_0xd8a7('0x44')][_0xd8a7('0x55')]){_0x293f14['include']=[{'all':!![]}];}return db[_0xd8a7('0x3f')][_0xd8a7('0x56')](_0x293f14);})[_0xd8a7('0x21')](function(_0x19bc78){_0x4eba98[_0xd8a7('0x57')]=_0x19bc78;return _0x4eba98;})[_0xd8a7('0x21')](respondWithFilteredResult(_0x39c3c8,_0x293f14))[_0xd8a7('0x2c')](handleError(_0x39c3c8,null));};exports[_0xd8a7('0x58')]=function(_0x283ed4,_0x4d2393){var _0x24423b={'raw':!![],'where':{'id':_0x283ed4[_0xd8a7('0x59')]['id']}},_0x594c8e={};_0x594c8e[_0xd8a7('0x43')]=_[_0xd8a7('0x45')](db['ChatMessage']['rawAttributes']);_0x594c8e['query']=_['keys'](_0x283ed4[_0xd8a7('0x44')]);_0x594c8e[_0xd8a7('0x46')]=_[_0xd8a7('0x47')](_0x594c8e[_0xd8a7('0x43')],_0x594c8e['query']);_0x24423b[_0xd8a7('0x48')]=_['intersection'](_0x594c8e[_0xd8a7('0x43')],qs['fields'](_0x283ed4[_0xd8a7('0x44')][_0xd8a7('0x49')]));_0x24423b[_0xd8a7('0x48')]=_0x24423b[_0xd8a7('0x48')][_0xd8a7('0x4a')]?_0x24423b[_0xd8a7('0x48')]:_0x594c8e[_0xd8a7('0x43')];if(_0x283ed4[_0xd8a7('0x44')][_0xd8a7('0x55')]){_0x24423b['include']=[{'all':!![]}];}_0x24423b=_[_0xd8a7('0x51')]({},_0x24423b,_0x283ed4[_0xd8a7('0x54')]);return db[_0xd8a7('0x3f')][_0xd8a7('0x5a')](_0x24423b)[_0xd8a7('0x21')](handleEntityNotFound(_0x4d2393,null))[_0xd8a7('0x21')](respondWithResult(_0x4d2393,null))['catch'](handleError(_0x4d2393,null));};exports[_0xd8a7('0x5b')]=function(_0x705f34,_0x23a556){return db['ChatMessage']['create'](_0x705f34['body'],{})[_0xd8a7('0x21')](respondWithResult(_0x23a556,0xc9))[_0xd8a7('0x2c')](handleError(_0x23a556,null));};exports['update']=function(_0x1f237b,_0x43af31){if(_0x1f237b[_0xd8a7('0x5c')]['id']){delete _0x1f237b[_0xd8a7('0x5c')]['id'];}return db[_0xd8a7('0x3f')]['find']({'where':{'id':_0x1f237b[_0xd8a7('0x59')]['id']}})[_0xd8a7('0x21')](handleEntityNotFound(_0x43af31,null))[_0xd8a7('0x21')](saveUpdates(_0x1f237b[_0xd8a7('0x5c')],null))[_0xd8a7('0x21')](respondWithResult(_0x43af31,null))[_0xd8a7('0x2c')](handleError(_0x43af31,null));};exports['destroy']=function(_0x44c5c9,_0x4ffbdb){return db[_0xd8a7('0x3f')][_0xd8a7('0x5a')]({'where':{'id':_0x44c5c9['params']['id']}})[_0xd8a7('0x21')](handleEntityNotFound(_0x4ffbdb,null))[_0xd8a7('0x21')](removeEntity(_0x4ffbdb,null))[_0xd8a7('0x2c')](handleError(_0x4ffbdb,null));};exports['describe']=function(_0x36c2be,_0x1befd0){return db[_0xd8a7('0x3f')][_0xd8a7('0x5d')]()['then'](respondWithResult(_0x1befd0,null))[_0xd8a7('0x2c')](handleError(_0x1befd0,null));};var interaction_log=require(_0xd8a7('0x16'))(_0xd8a7('0x5e'));exports[_0xd8a7('0x5f')]=function(_0x33477f,_0x2c90fb,_0x4d2449){var _0x3d4129={'agent':{},'channel':_0xd8a7('0x60')};if(_0x33477f[_0xd8a7('0x5c')]['id']){delete _0x33477f[_0xd8a7('0x5c')]['id'];}_0x33477f[_0xd8a7('0x5c')][_0xd8a7('0x61')]=!![];_0x33477f[_0xd8a7('0x5c')][_0xd8a7('0x62')]=moment()[_0xd8a7('0x63')](_0xd8a7('0x64'));_0x33477f[_0xd8a7('0x5c')][_0xd8a7('0x65')]=_0x33477f[_0xd8a7('0x5c')]['UserId']||_0x33477f[_0xd8a7('0x66')]['id'];_0x3d4129[_0xd8a7('0x67')]['id']=_0x33477f['body'][_0xd8a7('0x65')];return db[_0xd8a7('0x3f')][_0xd8a7('0x5a')]({'where':{'id':_0x33477f[_0xd8a7('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c90fb,null))[_0xd8a7('0x21')](saveUpdates(_0x33477f[_0xd8a7('0x5c')],null))['then'](function(_0x1b5f0e){if(_0x1b5f0e){_0x3d4129[_0xd8a7('0x28')]=_0x1b5f0e[_0xd8a7('0x68')]({'plain':!![]});return db[_0xd8a7('0x69')][_0xd8a7('0x5a')]({'where':{'id':_0x1b5f0e[_0xd8a7('0x6a')]}});}return null;})[_0xd8a7('0x21')](handleEntityNotFound(_0x2c90fb,null))[_0xd8a7('0x21')](function(_0x3a55b0){if(_0x3a55b0){return _0x3a55b0[_0xd8a7('0x39')]({'UserId':_0x33477f[_0xd8a7('0x5c')][_0xd8a7('0x65')],'read1stAt':_['isNil'](_0x3a55b0[_0xd8a7('0x6b')])?moment()[_0xd8a7('0x63')](_0xd8a7('0x64')):undefined});}return null;})[_0xd8a7('0x21')](function(_0x463250){if(_0x463250){_0x3d4129['interaction']=_0x463250[_0xd8a7('0x68')]({'plain':!![]});interaction_log[_0xd8a7('0x2a')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33477f[_0xd8a7('0x66')]['id'],_0x33477f[_0xd8a7('0x66')][_0xd8a7('0x3c')],_0x33477f['user']['role'],_0x3d4129[_0xd8a7('0x6c')]['id'],_0x33477f[_0xd8a7('0x5c')]?JSON['stringify'](_0x33477f['body']):'null');return respondWithRpcPromise(_0xd8a7('0x6d'),_0xd8a7('0x6e'),_0x3d4129);}return null;})[_0xd8a7('0x21')](function(_0x8333df){var _0x53a7f8=_0xd8a7('0x6f')+_0x8333df[_0xd8a7('0x28')][_0xd8a7('0x70')];return db['sequelize'][_0xd8a7('0x44')](_0x53a7f8,{'type':db['Sequelize']['QueryTypes'][_0xd8a7('0x71')],'raw':!![]})['then'](function(_0x9b5e6d){return _0x9b5e6d;});})[_0xd8a7('0x21')](function(_0x46ea18){if(_0x46ea18){_0x3d4129[_0xd8a7('0x28')][_0xd8a7('0x72')]=_0x46ea18[0x0];if(!_0x33477f['body'][_0xd8a7('0x65')])return;return db[_0xd8a7('0x73')]['find']({'where':{'id':_0x33477f[_0xd8a7('0x5c')]['UserId'],'role':_0xd8a7('0x67')},'attributes':['id',_0xd8a7('0x3c'),_0xd8a7('0x74'),_0xd8a7('0x75'),'internal'],'raw':!![]});}return null;})[_0xd8a7('0x21')](function(_0x29ffb4){if(!_0x29ffb4)return null;_0x3d4129[_0xd8a7('0x28')][_0xd8a7('0x67')]=_0x29ffb4;return _0x3d4129;})['then'](function(_0x37802f){if(_0x37802f){if(_0x33477f[_0xd8a7('0x5c')]['manual']){_0x3d4129['message'][_0xd8a7('0x76')]=util[_0xd8a7('0x63')]('SIP/%s',_0x33477f[_0xd8a7('0x66')][_0xd8a7('0x3c')]);_0x3d4129[_0xd8a7('0x28')][_0xd8a7('0x77')]=_0x3d4129['channel'];_0x3d4129['message'][_0xd8a7('0x78')]=_0x3d4129[_0xd8a7('0x77')];_0x3d4129[_0xd8a7('0x28')][_0xd8a7('0x79')]=_0xd8a7('0x5f');return respondWithRpcPromise(_0xd8a7('0x7a'),_0xd8a7('0x7a'),{'event':_0xd8a7('0x7b'),'message':_[_0xd8a7('0x51')](_0x3d4129[_0xd8a7('0x28')],JSON[_0xd8a7('0x7c')](_0x3d4129['interaction'][_0xd8a7('0x7d')]))},client9002)[_0xd8a7('0x21')](function(){return _0x3d4129;});}return _0x3d4129;}return null;})['then'](respondWithResult(_0x2c90fb,null))[_0xd8a7('0x2c')](handleError(_0x2c90fb,null));};var interaction_log=require(_0xd8a7('0x16'))(_0xd8a7('0x5e'));exports[_0xd8a7('0x37')]=function(_0x49f588,_0x5eb5c4,_0x2e1d2d){var _0x4fa4e2={'agent':{},'channel':_0xd8a7('0x60')};if(_0x49f588['body']['id']){delete _0x49f588[_0xd8a7('0x5c')]['id'];}_0x49f588[_0xd8a7('0x5c')][_0xd8a7('0x65')]=_0x49f588[_0xd8a7('0x5c')][_0xd8a7('0x65')]||_0x49f588[_0xd8a7('0x66')]['id'];_0x4fa4e2[_0xd8a7('0x67')]['id']=_0x49f588[_0xd8a7('0x5c')][_0xd8a7('0x65')];return db[_0xd8a7('0x3f')][_0xd8a7('0x5a')]({'where':{'id':_0x49f588[_0xd8a7('0x59')]['id'],'UserId':null}})[_0xd8a7('0x21')](handleEntityNotFound(_0x5eb5c4,null))[_0xd8a7('0x21')](function(_0xadd7ac){if(_0xadd7ac){_0x4fa4e2[_0xd8a7('0x28')]=_0xadd7ac[_0xd8a7('0x68')]({'plain':!![]});return db[_0xd8a7('0x69')]['find']({'where':{'id':_0xadd7ac[_0xd8a7('0x6a')]}});}return null;})[_0xd8a7('0x21')](handleEntityNotFound(_0x5eb5c4,null))[_0xd8a7('0x21')](function(_0x21d298){if(_0x21d298){_0x4fa4e2['interaction']=_0x21d298['get']({'plain':!![]});interaction_log[_0xd8a7('0x2a')](_0xd8a7('0x7e'),_0x49f588[_0xd8a7('0x66')]['id'],_0x49f588[_0xd8a7('0x66')][_0xd8a7('0x3c')],_0x49f588[_0xd8a7('0x66')][_0xd8a7('0x7f')],_0x4fa4e2[_0xd8a7('0x6c')]['id'],_0x49f588[_0xd8a7('0x5c')]?JSON['stringify'](_0x49f588[_0xd8a7('0x5c')]):_0xd8a7('0x80'));return respondWithRpcPromise(_0xd8a7('0x81'),_0xd8a7('0x82'),_0x4fa4e2);}return null;})[_0xd8a7('0x21')](function(_0x5bda03){var _0x63d464=_0xd8a7('0x6f')+_0x5bda03[_0xd8a7('0x28')][_0xd8a7('0x70')];return db[_0xd8a7('0x83')]['query'](_0x63d464,{'type':db[_0xd8a7('0x84')][_0xd8a7('0x85')][_0xd8a7('0x71')],'raw':!![]})[_0xd8a7('0x21')](function(_0x4be182){return _0x4be182;});})[_0xd8a7('0x21')](function(_0x28cf40){if(_0x28cf40){_0x4fa4e2['message'][_0xd8a7('0x72')]=_0x28cf40[0x0];if(!_0x49f588[_0xd8a7('0x5c')][_0xd8a7('0x65')])return;return db['User']['find']({'where':{'id':_0x49f588[_0xd8a7('0x5c')][_0xd8a7('0x65')],'role':_0xd8a7('0x67')},'attributes':['id','name',_0xd8a7('0x74'),_0xd8a7('0x75'),_0xd8a7('0x86')],'raw':!![]});}return null;})[_0xd8a7('0x21')](function(_0x2cced4){if(!_0x2cced4)return null;_0x4fa4e2[_0xd8a7('0x28')][_0xd8a7('0x67')]=_0x2cced4;return _0x4fa4e2;})['then'](function(_0x1c93f4){if(_0x1c93f4){_0x1c93f4[_0xd8a7('0x28')][_0xd8a7('0x76')]=util['format']('SIP/%s',_0x49f588[_0xd8a7('0x66')][_0xd8a7('0x3c')]);_0x1c93f4[_0xd8a7('0x28')][_0xd8a7('0x77')]=_0x4fa4e2[_0xd8a7('0x77')];_0x1c93f4[_0xd8a7('0x28')][_0xd8a7('0x78')]=_0x4fa4e2[_0xd8a7('0x77')];_0x1c93f4[_0xd8a7('0x28')][_0xd8a7('0x79')]=_0xd8a7('0x37');respondWithRpcPromise(_0xd8a7('0x7a'),'EventManager',{'event':'rejectmessage','message':_['merge'](_0x4fa4e2[_0xd8a7('0x28')],JSON[_0xd8a7('0x7c')](_0x4fa4e2['interaction'][_0xd8a7('0x7d')]))},client9002);return _0x4fa4e2;}return null;})[_0xd8a7('0x21')](respondWithResult(_0x5eb5c4,null))['catch'](handleError(_0x5eb5c4,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 25d8295..10c747a 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 _0x18bc=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x6afc9c,_0xf6b755){var _0x195d68=function(_0x48f1eb){while(--_0x48f1eb){_0x6afc9c['push'](_0x6afc9c['shift']());}};_0x195d68(++_0xf6b755);}(_0x18bc,0x13b));var _0xc18b=function(_0x3eff8f,_0x58a445){_0x3eff8f=_0x3eff8f-0x0;var _0x23eabd=_0x18bc[_0x3eff8f];return _0x23eabd;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xc18b('0x0'))['db'][_0xc18b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xc18b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc18b('0x3'),'afterDestroy':_0xc18b('0x4')};function emitEvent(_0x466f19){return function(_0x3e3642,_0x5076e2,_0x185661){ChatMessageEvents[_0xc18b('0x5')](_0x466f19+':'+_0x3e3642['id'],_0x3e3642);ChatMessageEvents[_0xc18b('0x5')](_0x466f19,_0x3e3642);_0x185661(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xc18b('0x6')](e,emitEvent(event));}}module[_0xc18b('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9681=['emit','hasOwnProperty','hook','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x1ff93a,_0x42d526){var _0x4f3dd0=function(_0x574494){while(--_0x574494){_0x1ff93a['push'](_0x1ff93a['shift']());}};_0x4f3dd0(++_0x42d526);}(_0x9681,0x1d3));var _0x1968=function(_0x46693f,_0x264558){_0x46693f=_0x46693f-0x0;var _0x42bcc7=_0x9681[_0x46693f];return _0x42bcc7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x1968('0x0'))['db'][_0x1968('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1968('0x2')](0x0);var events={'afterCreate':_0x1968('0x3'),'afterUpdate':_0x1968('0x4'),'afterDestroy':'remove'};function emitEvent(_0x58cfab){return function(_0x2ea7ae,_0x44289d,_0x2b9444){ChatMessageEvents[_0x1968('0x5')](_0x58cfab+':'+_0x2ea7ae['id'],_0x2ea7ae);ChatMessageEvents[_0x1968('0x5')](_0x58cfab,_0x2ea7ae);_0x2b9444(null);};}for(var e in events){if(events[_0x1968('0x6')](e)){var event=events[e];ChatMessage[_0x1968('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index cc6e82d..8b6bee4 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 _0x25ab=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','ChatInteraction','ChatInteractionId','then','update','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0x25ab,0xe7));var _0xb25a=function(_0xed4502,_0x2852ed){_0xed4502=_0xed4502-0x0;var _0x155e33=_0x25ab[_0xed4502];return _0x155e33;};'use strict';var _=require(_0xb25a('0x0'));var util=require(_0xb25a('0x1'));var logger=require(_0xb25a('0x2'))(_0xb25a('0x3'));var moment=require(_0xb25a('0x4'));var BPromise=require(_0xb25a('0x5'));var rp=require(_0xb25a('0x6'));var fs=require('fs');var path=require(_0xb25a('0x7'));var rimraf=require(_0xb25a('0x8'));var config=require(_0xb25a('0x9'));var attributes=require(_0xb25a('0xa'));module[_0xb25a('0xb')]=function(_0x1d917f,_0x358e83){return _0x1d917f[_0xb25a('0xc')](_0xb25a('0xd'),attributes,{'tableName':_0xb25a('0xe'),'paranoid':![],'indexes':[{'name':_0xb25a('0xf'),'fields':[_0xb25a('0x10')],'type':_0xb25a('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36bb4c,_0xfafb6a,_0x1a6cef){var _0x1ab887=_0x1d917f[_0xb25a('0x12')];var _0x20de0a=_0x36bb4c[_0xb25a('0x13')]({'plain':!![]});if(_0x20de0a['direction'][_0xb25a('0x14')]()==='in'||_0x20de0a[_0xb25a('0x15')][_0xb25a('0x14')]()===_0xb25a('0x16')&&!_0x20de0a['secret']&&!_['isNil'](_0x20de0a['UserId'])){_0x1ab887[_0xb25a('0x17')]['findOne']({'where':{'id':_0x20de0a[_0xb25a('0x18')]}})[_0xb25a('0x19')](function(_0x354e13){if(_0x354e13){_0x354e13[_0xb25a('0x1a')]({'lastMsgAt':_0x20de0a['createdAt'],'lastMsgDirection':_0x20de0a[_0xb25a('0x15')][_0xb25a('0x14')]()});}})[_0xb25a('0x1b')](function(_0x4f1c10){console[_0xb25a('0x1c')](_0x4f1c10);});}_0x1a6cef();}},'charset':_0xb25a('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1b36=['path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','ChatInteractionId','update','catch','error','utf8mb4','util','../../config/logger','moment'];(function(_0x518aa4,_0x12e509){var _0x43ddde=function(_0x5a7b7c){while(--_0x5a7b7c){_0x518aa4['push'](_0x518aa4['shift']());}};_0x43ddde(++_0x12e509);}(_0x1b36,0x169));var _0x61b3=function(_0x5bd048,_0x17cce2){_0x5bd048=_0x5bd048-0x0;var _0x16f94f=_0x1b36[_0x5bd048];return _0x16f94f;};'use strict';var _=require('lodash');var util=require(_0x61b3('0x0'));var logger=require(_0x61b3('0x1'))('api');var moment=require(_0x61b3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x61b3('0x3'));var rimraf=require(_0x61b3('0x4'));var config=require(_0x61b3('0x5'));var attributes=require(_0x61b3('0x6'));module['exports']=function(_0x468f69,_0x34bf74){return _0x468f69[_0x61b3('0x7')](_0x61b3('0x8'),attributes,{'tableName':_0x61b3('0x9'),'paranoid':![],'indexes':[{'name':_0x61b3('0xa'),'fields':[_0x61b3('0xb')],'type':_0x61b3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1269b1,_0x5a9e90,_0x416c12){var _0x40dc1f=_0x468f69[_0x61b3('0xd')];var _0x391c5f=_0x1269b1[_0x61b3('0xe')]({'plain':!![]});if(_0x391c5f[_0x61b3('0xf')]['toLowerCase']()==='in'||_0x391c5f['direction'][_0x61b3('0x10')]()==='out'&&!_0x391c5f[_0x61b3('0x11')]&&!_[_0x61b3('0x12')](_0x391c5f[_0x61b3('0x13')])){_0x40dc1f['ChatInteraction'][_0x61b3('0x14')]({'where':{'id':_0x391c5f[_0x61b3('0x15')]}})['then'](function(_0x533b9c){if(_0x533b9c){_0x533b9c[_0x61b3('0x16')]({'lastMsgAt':_0x391c5f['createdAt'],'lastMsgDirection':_0x391c5f['direction']['toLowerCase']()});}})[_0x61b3('0x17')](function(_0x4b7b98){console[_0x61b3('0x18')](_0x4b7b98);});}_0x416c12();}},'charset':_0x61b3('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d7bbd56..5846dcd 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 _0xc83f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','body','options','raw','CreateChatMessage','lodash','util'];(function(_0x57fd0d,_0x2630ea){var _0x4b57f6=function(_0x5d314c){while(--_0x5d314c){_0x57fd0d['push'](_0x57fd0d['shift']());}};_0x4b57f6(++_0x2630ea);}(_0xc83f,0xf6));var _0xfc83=function(_0x336221,_0x4e04de){_0x336221=_0x336221-0x0;var _0x2ad2a5=_0xc83f[_0x336221];return _0x2ad2a5;};'use strict';var _=require(_0xfc83('0x0'));var util=require(_0xfc83('0x1'));var moment=require('moment');var BPromise=require(_0xfc83('0x2'));var rs=require(_0xfc83('0x3'));var fs=require('fs');var Redis=require(_0xfc83('0x4'));var db=require(_0xfc83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc83('0x6'))(_0xfc83('0x7'));var config=require(_0xfc83('0x8'));var jayson=require(_0xfc83('0x9'));var client=jayson[_0xfc83('0xa')][_0xfc83('0xb')]({'port':0x232a});config[_0xfc83('0xc')]=_['defaults'](config[_0xfc83('0xc')],{'host':_0xfc83('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc83('0xe'))[_0xfc83('0xf')](socket);function respondWithRpcPromise(_0x578dcc,_0x14e792,_0x12ee60){return new BPromise(function(_0xae5fd8,_0x4beed1){return client[_0xfc83('0x10')](_0x578dcc,_0x12ee60)[_0xfc83('0x11')](function(_0x1d0dd4){logger[_0xfc83('0x12')](_0xfc83('0x13'),_0x14e792,'request\x20sent');logger[_0xfc83('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x14e792,_0xfc83('0x15'),JSON[_0xfc83('0x16')](_0x1d0dd4));if(_0x1d0dd4['error']){if(_0x1d0dd4['error']['code']===0x1f4){logger[_0xfc83('0x17')](_0xfc83('0x13'),_0x14e792,_0x1d0dd4[_0xfc83('0x17')][_0xfc83('0x18')]);return _0x4beed1(_0x1d0dd4[_0xfc83('0x17')]['message']);}logger[_0xfc83('0x17')]('ChatMessage,\x20%s,\x20%s',_0x14e792,_0x1d0dd4['error'][_0xfc83('0x18')]);return _0xae5fd8(_0x1d0dd4[_0xfc83('0x17')][_0xfc83('0x18')]);}else{logger['info'](_0xfc83('0x13'),_0x14e792,_0xfc83('0x15'));_0xae5fd8(_0x1d0dd4[_0xfc83('0x19')][_0xfc83('0x18')]);}})[_0xfc83('0x1a')](function(_0x188c7e){logger[_0xfc83('0x17')](_0xfc83('0x13'),_0x14e792,_0x188c7e);_0x4beed1(_0x188c7e);});});}exports['CreateChatMessage']=function(_0xb2d9d4){var _0x45dd1b=this;return new Promise(function(_0x3cce2f,_0x54ff9c){return db['ChatMessage']['create'](_0xb2d9d4[_0xfc83('0x1b')],{'raw':_0xb2d9d4[_0xfc83('0x1c')]?_0xb2d9d4['options'][_0xfc83('0x1d')]===undefined?!![]:![]:!![]})[_0xfc83('0x11')](function(_0x173918){logger[_0xfc83('0x12')](_0xfc83('0x1e'),_0xb2d9d4);logger[_0xfc83('0x14')](_0xfc83('0x1e'),_0xb2d9d4,JSON[_0xfc83('0x16')](_0x173918));_0x3cce2f(_0x173918);})['catch'](function(_0x40c5f2){logger[_0xfc83('0x17')](_0xfc83('0x1e'),_0x40c5f2[_0xfc83('0x18')],_0xb2d9d4);_0x54ff9c(_0x45dd1b[_0xfc83('0x17')](0x1f4,_0x40c5f2[_0xfc83('0x18')]));});});}; \ No newline at end of file +var _0xa359=['error','code','ChatMessage,\x20%s,\x20%s','message','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x455a13,_0x56e09e){var _0x4e2505=function(_0x1964f0){while(--_0x1964f0){_0x455a13['push'](_0x455a13['shift']());}};_0x4e2505(++_0x56e09e);}(_0xa359,0x12c));var _0x9a35=function(_0xd9a2fb,_0x4a6f57){_0xd9a2fb=_0xd9a2fb-0x0;var _0x2ed62e=_0xa359[_0xd9a2fb];return _0x2ed62e;};'use strict';var _=require(_0x9a35('0x0'));var util=require(_0x9a35('0x1'));var moment=require('moment');var BPromise=require(_0x9a35('0x2'));var rs=require(_0x9a35('0x3'));var fs=require('fs');var Redis=require(_0x9a35('0x4'));var db=require(_0x9a35('0x5'))['db'];var utils=require(_0x9a35('0x6'));var logger=require(_0x9a35('0x7'))(_0x9a35('0x8'));var config=require(_0x9a35('0x9'));var jayson=require(_0x9a35('0xa'));var client=jayson[_0x9a35('0xb')][_0x9a35('0xc')]({'port':0x232a});config[_0x9a35('0xd')]=_['defaults'](config[_0x9a35('0xd')],{'host':_0x9a35('0xe'),'port':0x18eb});var socket=require(_0x9a35('0xf'))(new Redis(config[_0x9a35('0xd')]));require(_0x9a35('0x10'))[_0x9a35('0x11')](socket);function respondWithRpcPromise(_0xa7522a,_0x5b73f2,_0x2e5d84){return new BPromise(function(_0x520370,_0x2924cf){return client[_0x9a35('0x12')](_0xa7522a,_0x2e5d84)[_0x9a35('0x13')](function(_0x42c80f){logger[_0x9a35('0x14')]('ChatMessage,\x20%s,\x20%s',_0x5b73f2,'request\x20sent');logger[_0x9a35('0x15')](_0x9a35('0x16'),_0x5b73f2,_0x9a35('0x17'),JSON['stringify'](_0x42c80f));if(_0x42c80f[_0x9a35('0x18')]){if(_0x42c80f[_0x9a35('0x18')][_0x9a35('0x19')]===0x1f4){logger[_0x9a35('0x18')](_0x9a35('0x1a'),_0x5b73f2,_0x42c80f[_0x9a35('0x18')][_0x9a35('0x1b')]);return _0x2924cf(_0x42c80f[_0x9a35('0x18')][_0x9a35('0x1b')]);}logger[_0x9a35('0x18')]('ChatMessage,\x20%s,\x20%s',_0x5b73f2,_0x42c80f[_0x9a35('0x18')]['message']);return _0x520370(_0x42c80f[_0x9a35('0x18')][_0x9a35('0x1b')]);}else{logger[_0x9a35('0x14')](_0x9a35('0x1a'),_0x5b73f2,'request\x20sent');_0x520370(_0x42c80f['result'][_0x9a35('0x1b')]);}})['catch'](function(_0x3618d6){logger['error'](_0x9a35('0x1a'),_0x5b73f2,_0x3618d6);_0x2924cf(_0x3618d6);});});}exports[_0x9a35('0x1c')]=function(_0x3fcd8e){var _0x5df1fd=this;return new Promise(function(_0x14dbc8,_0xa6f489){return db[_0x9a35('0x1d')][_0x9a35('0x1e')](_0x3fcd8e[_0x9a35('0x1f')],{'raw':_0x3fcd8e[_0x9a35('0x20')]?_0x3fcd8e['options'][_0x9a35('0x21')]===undefined?!![]:![]:!![]})[_0x9a35('0x13')](function(_0x5c286b){logger[_0x9a35('0x14')](_0x9a35('0x1c'),_0x3fcd8e);logger[_0x9a35('0x15')]('CreateChatMessage',_0x3fcd8e,JSON[_0x9a35('0x22')](_0x5c286b));_0x14dbc8(_0x5c286b);})[_0x9a35('0x23')](function(_0x1f94b7){logger[_0x9a35('0x18')](_0x9a35('0x1c'),_0x1f94b7['message'],_0x3fcd8e);_0xa6f489(_0x5df1fd['error'](0x1f4,_0x1f94b7[_0x9a35('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9b4ef2c..24fc0e0 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 _0xec39=['length','chatMessage:','./chatMessage.events','save','remove','update','removeListener'];(function(_0x108b66,_0x37db88){var _0x3ed76=function(_0x2a22c5){while(--_0x2a22c5){_0x108b66['push'](_0x108b66['shift']());}};_0x3ed76(++_0x37db88);}(_0xec39,0x19f));var _0x9ec3=function(_0x2fb75b,_0x2b327d){_0x2fb75b=_0x2fb75b-0x0;var _0x49e6ce=_0xec39[_0x2fb75b];return _0x49e6ce;};'use strict';var ChatMessageEvents=require(_0x9ec3('0x0'));var events=[_0x9ec3('0x1'),_0x9ec3('0x2'),_0x9ec3('0x3')];function createListener(_0x1fc7a7,_0xb3d117){return function(_0x3d481c){_0xb3d117['emit'](_0x1fc7a7,_0x3d481c);};}function removeListener(_0x1f43fb,_0x1c944d){return function(){ChatMessageEvents[_0x9ec3('0x4')](_0x1f43fb,_0x1c944d);};}exports['register']=function(_0x49ddff){for(var _0x55adba=0x0,_0x3742c5=events[_0x9ec3('0x5')];_0x55adba<_0x3742c5;_0x55adba++){var _0x29a6a2=events[_0x55adba];var _0x595e3a=createListener(_0x9ec3('0x6')+_0x29a6a2,_0x49ddff);ChatMessageEvents['on'](_0x29a6a2,_0x595e3a);}}; \ No newline at end of file +var _0x1c9a=['register','length','chatMessage:','./chatMessage.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x30fbeb,_0x9561ae){_0x30fbeb=_0x30fbeb-0x0;var _0x30993a=_0x1c9a[_0x30fbeb];return _0x30993a;};'use strict';var ChatMessageEvents=require(_0xa1c9('0x0'));var events=[_0xa1c9('0x1'),'remove',_0xa1c9('0x2')];function createListener(_0x867bbb,_0x38c48f){return function(_0x408418){_0x38c48f[_0xa1c9('0x3')](_0x867bbb,_0x408418);};}function removeListener(_0x4a0d3d,_0x2f883c){return function(){ChatMessageEvents['removeListener'](_0x4a0d3d,_0x2f883c);};}exports[_0xa1c9('0x4')]=function(_0xdd22bf){for(var _0x237862=0x0,_0x2b0c89=events[_0xa1c9('0x5')];_0x237862<_0x2b0c89;_0x237862++){var _0x46b19a=events[_0x237862];var _0x3b1a2c=createListener(_0xa1c9('0x6')+_0x46b19a,_0xdd22bf);ChatMessageEvents['on'](_0x46b19a,_0x3b1a2c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fbbda93..8bba29a 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 _0x668b=['chat','chatmessage:create','create','put','update','/:id/accept','reject','delete','/:id','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','tracked'];(function(_0x3e3cab,_0x246974){var _0x5ca183=function(_0x2422a5){while(--_0x2422a5){_0x3e3cab['push'](_0x3e3cab['shift']());}};_0x5ca183(++_0x246974);}(_0x668b,0x1a8));var _0xb668=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x668b[_0x5b077b];return _0x16faf7;};'use strict';var multer=require(_0xb668('0x0'));var util=require('util');var path=require(_0xb668('0x1'));var timeout=require(_0xb668('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb668('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x4'));var config=require(_0xb668('0x5'));var controller=require(_0xb668('0x6'));router[_0xb668('0x7')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0x7')](_0xb668('0xa'),auth[_0xb668('0x8')](),controller[_0xb668('0xb')]);router[_0xb668('0x7')]('/:id',auth[_0xb668('0x8')](),controller['show']);router['post']('/',auth[_0xb668('0x8')](),interaction[_0xb668('0xc')](_0xb668('0xd'),_0xb668('0xe')),controller[_0xb668('0xf')]);router[_0xb668('0x10')]('/:id',controller[_0xb668('0x11')]);router[_0xb668('0x10')](_0xb668('0x12'),auth[_0xb668('0x8')](),controller['accept']);router[_0xb668('0x10')]('/:id/reject',auth[_0xb668('0x8')](),controller[_0xb668('0x13')]);router[_0xb668('0x14')](_0xb668('0x15'),auth[_0xb668('0x8')](),controller['destroy']);module[_0xb668('0x16')]=router; \ No newline at end of file +var _0x784b=['chat','put','update','/:id/accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','tracked'];(function(_0x4f434e,_0x56d8cd){var _0x107307=function(_0x47cfa6){while(--_0x47cfa6){_0x4f434e['push'](_0x4f434e['shift']());}};_0x107307(++_0x56d8cd);}(_0x784b,0x158));var _0xb784=function(_0x58c727,_0x3e2226){_0x58c727=_0x58c727-0x0;var _0x3a0b28=_0x784b[_0x58c727];return _0x3a0b28;};'use strict';var multer=require('multer');var util=require(_0xb784('0x0'));var path=require(_0xb784('0x1'));var timeout=require(_0xb784('0x2'));var express=require(_0xb784('0x3'));var router=express[_0xb784('0x4')]();var fs_extra=require(_0xb784('0x5'));var auth=require(_0xb784('0x6'));var interaction=require(_0xb784('0x7'));var config=require(_0xb784('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xb784('0x9')](),controller[_0xb784('0xa')]);router[_0xb784('0xb')]('/describe',auth[_0xb784('0x9')](),controller[_0xb784('0xc')]);router[_0xb784('0xb')](_0xb784('0xd'),auth[_0xb784('0x9')](),controller[_0xb784('0xe')]);router['post']('/',auth[_0xb784('0x9')](),interaction[_0xb784('0xf')](_0xb784('0x10'),'chatmessage:create'),controller['create']);router[_0xb784('0x11')](_0xb784('0xd'),controller[_0xb784('0x12')]);router[_0xb784('0x11')](_0xb784('0x13'),auth[_0xb784('0x9')](),controller['accept']);router[_0xb784('0x11')](_0xb784('0x14'),auth[_0xb784('0x9')](),controller[_0xb784('0x15')]);router[_0xb784('0x16')]('/:id',auth[_0xb784('0x9')](),controller['destroy']);module[_0xb784('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8f11e87..95051f1 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 _0x2032=['medium','exports','TEXT'];(function(_0x166e34,_0x38f5ab){var _0x15061b=function(_0x356112){while(--_0x356112){_0x166e34['push'](_0x166e34['shift']());}};_0x15061b(++_0x38f5ab);}(_0x2032,0xd9));var _0x2203=function(_0x1ed5d9,_0x52d183){_0x1ed5d9=_0x1ed5d9-0x0;var _0x326c59=_0x2032[_0x1ed5d9];return _0x326c59;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x3705ea,_0x437c26){var _0x6e16b3=function(_0x3437bb){while(--_0x3437bb){_0x3705ea['push'](_0x3705ea['shift']());}};_0x6e16b3(++_0x437c26);}(_0x2032,0xd9));var _0x2203=function(_0x567c91,_0xdef69f){_0x567c91=_0x567c91-0x0;var _0x1307fd=_0x2032[_0x567c91];return _0x1307fd;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 979732d..137bb88 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x205dc5,_0x191197){var _0x442e92=function(_0x13d30c){while(--_0x13d30c){_0x205dc5['push'](_0x205dc5['shift']());}};_0x442e92(++_0x191197);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x7a54,0x106));var _0x47a5=function(_0x17660f,_0x405ba5){_0x17660f=_0x17660f-0x0;var _0x43d318=_0x7a54[_0x17660f];return _0x43d318;};'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 14374a0..6d0a30c 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 _0xb0b4=['events','../../mysqldb','setMaxListeners','save','remove','emit','exports'];(function(_0x4f5c5c,_0x20088e){var _0x4e686c=function(_0x2aa945){while(--_0x2aa945){_0x4f5c5c['push'](_0x4f5c5c['shift']());}};_0x4e686c(++_0x20088e);}(_0xb0b4,0x134));var _0x4b0b=function(_0x47210c,_0x127cb3){_0x47210c=_0x47210c-0x0;var _0x24d779=_0xb0b4[_0x47210c];return _0x24d779;};'use strict';var EventEmitter=require(_0x4b0b('0x0'));var ChatOfflineMessage=require(_0x4b0b('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4b0b('0x2')](0x0);var events={'afterCreate':_0x4b0b('0x3'),'afterUpdate':'update','afterDestroy':_0x4b0b('0x4')};function emitEvent(_0x365ce2){return function(_0x2ec8b6,_0x1d66f1,_0x315e2d){ChatOfflineMessageEvents[_0x4b0b('0x5')](_0x365ce2+':'+_0x2ec8b6['id'],_0x2ec8b6);ChatOfflineMessageEvents[_0x4b0b('0x5')](_0x365ce2,_0x2ec8b6);_0x315e2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x4b0b('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xbcba=['events','../../mysqldb','ChatOfflineMessage','update','emit','exports'];(function(_0xc97b68,_0x528d2f){var _0x2b74b1=function(_0x24cd51){while(--_0x24cd51){_0xc97b68['push'](_0xc97b68['shift']());}};_0x2b74b1(++_0x528d2f);}(_0xbcba,0x198));var _0xabcb=function(_0x51d6e4,_0x2d128c){_0x51d6e4=_0x51d6e4-0x0;var _0xe65f55=_0xbcba[_0x51d6e4];return _0xe65f55;};'use strict';var EventEmitter=require(_0xabcb('0x0'));var ChatOfflineMessage=require(_0xabcb('0x1'))['db'][_0xabcb('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xabcb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4025be){return function(_0x473eb8,_0x481ed8,_0x1e0568){ChatOfflineMessageEvents[_0xabcb('0x4')](_0x4025be+':'+_0x473eb8['id'],_0x473eb8);ChatOfflineMessageEvents[_0xabcb('0x4')](_0x4025be,_0x473eb8);_0x1e0568(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xabcb('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e1b889c..736f3ed 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 _0xd1d4=['./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd1d4,0x84));var _0x4d1d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xd1d4[_0x24259d];return _0x5a701;};'use strict';var attributes=require(_0x4d1d('0x0'));module[_0x4d1d('0x1')]=function(_0x27c02c){return _0x27c02c[_0x4d1d('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x4d1d('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d1d('0x4'),'collate':_0x4d1d('0x5')});}; \ No newline at end of file +var _0x1852=['utf8mb4_unicode_ci','define','chat_offline_messages','utf8mb4'];(function(_0x25db03,_0x409553){var _0xcffd92=function(_0x56be1c){while(--_0x56be1c){_0x25db03['push'](_0x25db03['shift']());}};_0xcffd92(++_0x409553);}(_0x1852,0xe9));var _0x2185=function(_0x1d37c9,_0x4ab636){_0x1d37c9=_0x1d37c9-0x0;var _0x2f8c25=_0x1852[_0x1d37c9];return _0x2f8c25;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x12bb8a){return _0x12bb8a[_0x2185('0x0')]('ChatOfflineMessage',attributes,{'tableName':_0x2185('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2185('0x2'),'collate':_0x2185('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a30c8e1..2bf6cbb 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 _0x1e9d=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','then','info'];(function(_0x50c86a,_0x2fec99){var _0x53420a=function(_0x56bb66){while(--_0x56bb66){_0x50c86a['push'](_0x50c86a['shift']());}};_0x53420a(++_0x2fec99);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x36c06c,_0x208e85){_0x36c06c=_0x36c06c-0x0;var _0x2abf77=_0x1e9d[_0x36c06c];return _0x2abf77;};'use strict';var _=require(_0xd1e9('0x0'));var util=require('util');var moment=require(_0xd1e9('0x1'));var BPromise=require(_0xd1e9('0x2'));var rs=require(_0xd1e9('0x3'));var fs=require('fs');var Redis=require(_0xd1e9('0x4'));var db=require(_0xd1e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15061,_0x3dea6,_0x3a9acc){return new BPromise(function(_0x5aff45,_0x466da8){return client['request'](_0x15061,_0x3a9acc)[_0xd1e9('0x7')](function(_0x207bee){logger[_0xd1e9('0x8')](_0xd1e9('0x9'),_0x3dea6,_0xd1e9('0xa'));logger[_0xd1e9('0xb')](_0xd1e9('0xc'),_0x3dea6,_0xd1e9('0xa'),JSON[_0xd1e9('0xd')](_0x207bee));if(_0x207bee[_0xd1e9('0xe')]){if(_0x207bee[_0xd1e9('0xe')]['code']===0x1f4){logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0x207bee[_0xd1e9('0xe')][_0xd1e9('0xf')]);return _0x466da8(_0x207bee[_0xd1e9('0xe')]['message']);}logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0x207bee[_0xd1e9('0xe')][_0xd1e9('0xf')]);return _0x5aff45(_0x207bee['error']['message']);}else{logger['info'](_0xd1e9('0x9'),_0x3dea6,'request\x20sent');_0x5aff45(_0x207bee[_0xd1e9('0x10')][_0xd1e9('0xf')]);}})[_0xd1e9('0x11')](function(_0xc89082){logger[_0xd1e9('0xe')](_0xd1e9('0x9'),_0x3dea6,_0xc89082);_0x466da8(_0xc89082);});});} \ No newline at end of file +var _0xbac5=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5d3fb8,_0x126d3e){var _0x2397a7=function(_0x10eaf5){while(--_0x10eaf5){_0x5d3fb8['push'](_0x5d3fb8['shift']());}};_0x2397a7(++_0x126d3e);}(_0xbac5,0xa9));var _0x5bac=function(_0x410612,_0x551c48){_0x410612=_0x410612-0x0;var _0xbfa860=_0xbac5[_0x410612];return _0xbfa860;};'use strict';var _=require(_0x5bac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bac('0x1'));var fs=require('fs');var Redis=require(_0x5bac('0x2'));var db=require(_0x5bac('0x3'))['db'];var utils=require(_0x5bac('0x4'));var logger=require('../../config/logger')(_0x5bac('0x5'));var config=require('../../config/environment');var jayson=require(_0x5bac('0x6'));var client=jayson[_0x5bac('0x7')][_0x5bac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x109bd4,_0x6bb18e,_0xbb61af){return new BPromise(function(_0x1bed4b,_0x5b2599){return client[_0x5bac('0x9')](_0x109bd4,_0xbb61af)[_0x5bac('0xa')](function(_0x51b66d){logger[_0x5bac('0xb')](_0x5bac('0xc'),_0x6bb18e,_0x5bac('0xd'));logger[_0x5bac('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x6bb18e,'request\x20sent',JSON[_0x5bac('0xf')](_0x51b66d));if(_0x51b66d['error']){if(_0x51b66d[_0x5bac('0x10')][_0x5bac('0x11')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x6bb18e,_0x51b66d[_0x5bac('0x10')][_0x5bac('0x12')]);return _0x5b2599(_0x51b66d['error'][_0x5bac('0x12')]);}logger[_0x5bac('0x10')](_0x5bac('0xc'),_0x6bb18e,_0x51b66d['error'][_0x5bac('0x12')]);return _0x1bed4b(_0x51b66d[_0x5bac('0x10')][_0x5bac('0x12')]);}else{logger[_0x5bac('0xb')](_0x5bac('0xc'),_0x6bb18e,_0x5bac('0xd'));_0x1bed4b(_0x51b66d[_0x5bac('0x13')][_0x5bac('0x12')]);}})[_0x5bac('0x14')](function(_0x4ed70d){logger[_0x5bac('0x10')](_0x5bac('0xc'),_0x6bb18e,_0x4ed70d);_0x5b2599(_0x4ed70d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 5e24fa1..8f1619d 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 _0x219e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0xaf280a,_0x3b0cdb){var _0x7453b=function(_0x24e59a){while(--_0x24e59a){_0xaf280a['push'](_0xaf280a['shift']());}};_0x7453b(++_0x3b0cdb);}(_0x219e,0x80));var _0xe219=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x219e[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0xe219('0x0'));var path=require(_0xe219('0x1'));var timeout=require(_0xe219('0x2'));var express=require(_0xe219('0x3'));var router=express['Router']();var fs_extra=require(_0xe219('0x4'));var auth=require(_0xe219('0x5'));var interaction=require(_0xe219('0x6'));var config=require(_0xe219('0x7'));var controller=require(_0xe219('0x8'));router[_0xe219('0x9')]('/',auth[_0xe219('0xa')](),controller[_0xe219('0xb')]);router[_0xe219('0x9')](_0xe219('0xc'),auth[_0xe219('0xa')](),controller[_0xe219('0xd')]);router[_0xe219('0x9')](_0xe219('0xe'),auth['isAuthenticated'](),controller[_0xe219('0xf')]);router[_0xe219('0x10')]('/',auth['isAuthenticated'](),controller[_0xe219('0x11')]);router[_0xe219('0x12')]('/:id',auth[_0xe219('0xa')](),controller['update']);router[_0xe219('0x13')](_0xe219('0xe'),auth[_0xe219('0xa')](),controller[_0xe219('0x14')]);module[_0xe219('0x15')]=router; \ No newline at end of file +var _0x6421=['fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','create','update','delete','destroy','multer','util','Router'];(function(_0x1c2298,_0x23dc7c){var _0x4df526=function(_0x2a3bc8){while(--_0x2a3bc8){_0x1c2298['push'](_0x1c2298['shift']());}};_0x4df526(++_0x23dc7c);}(_0x6421,0x1bd));var _0x1642=function(_0x11e236,_0x391328){_0x11e236=_0x11e236-0x0;var _0x4efcd0=_0x6421[_0x11e236];return _0x4efcd0;};'use strict';var multer=require(_0x1642('0x0'));var util=require(_0x1642('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1642('0x2')]();var fs_extra=require(_0x1642('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1642('0x4'));var config=require(_0x1642('0x5'));var controller=require(_0x1642('0x6'));router['get']('/',auth[_0x1642('0x7')](),controller['index']);router[_0x1642('0x8')](_0x1642('0x9'),auth[_0x1642('0x7')](),controller[_0x1642('0xa')]);router['get'](_0x1642('0xb'),auth[_0x1642('0x7')](),controller['show']);router['post']('/',auth[_0x1642('0x7')](),controller[_0x1642('0xc')]);router['put'](_0x1642('0xb'),auth[_0x1642('0x7')](),controller[_0x1642('0xd')]);router[_0x1642('0xe')](_0x1642('0xb'),auth['isAuthenticated'](),controller[_0x1642('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1aa7041..0e699d9 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 _0xd3e1=['ENUM','timeout','mouseOver','sequelize','exports'];(function(_0x362195,_0x15100b){var _0x5c4054=function(_0x43c26){while(--_0x43c26){_0x362195['push'](_0x362195['shift']());}};_0x5c4054(++_0x15100b);}(_0xd3e1,0x18e));var _0x1d3e=function(_0x3109ee,_0x32a8c1){_0x3109ee=_0x3109ee-0x0;var _0x288424=_0xd3e1[_0x3109ee];return _0x288424;};'use strict';var Sequelize=require(_0x1d3e('0x0'));module[_0x1d3e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1d3e('0x2')]('mouseOver',_0x1d3e('0x3')),'defaultValue':_0x1d3e('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xca71=['INTEGER','sequelize','STRING','mouseOver'];(function(_0x3ea45a,_0x124d7e){var _0x4e0da4=function(_0x50422b){while(--_0x50422b){_0x3ea45a['push'](_0x3ea45a['shift']());}};_0x4e0da4(++_0x124d7e);}(_0xca71,0x129));var _0x1ca7=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xca71[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require(_0x1ca7('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ca7('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1ca7('0x2'),'timeout'),'defaultValue':_0x1ca7('0x2')},'selector':{'type':Sequelize[_0x1ca7('0x1')]},'timeout':{'type':Sequelize[_0x1ca7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c7a9ed1..0de0ffb 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 _0x294b=['length','includeAll','include','options','ChatProactiveAction','find','create','body','catch','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','save','then','sendStatus','error','name','send','show','params','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1147fb,_0x57bfa2){var _0x4d8bbe=function(_0x55707b){while(--_0x55707b){_0x1147fb['push'](_0x1147fb['shift']());}};_0x4d8bbe(++_0x57bfa2);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb294('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb294('0x1'));var jsonpatch=require(_0xb294('0x2'));var rp=require(_0xb294('0x3'));var moment=require(_0xb294('0x4'));var BPromise=require(_0xb294('0x5'));var Mustache=require(_0xb294('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb294('0x7'));var csv=require(_0xb294('0x8'));var ejs=require(_0xb294('0x9'));var fs=require('fs');var fs_extra=require(_0xb294('0xa'));var _=require(_0xb294('0xb'));var squel=require('squel');var crypto=require(_0xb294('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb294('0xd'));var Papa=require(_0xb294('0xe'));var Redis=require(_0xb294('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb294('0x10'));var logger=require(_0xb294('0x11'))(_0xb294('0x12'));var utils=require(_0xb294('0x13'));var config=require(_0xb294('0x14'));var licenseUtil=require(_0xb294('0x15'));var db=require(_0xb294('0x16'))['db'];function respondWithStatusCode(_0x13a3fc,_0x2b2bb5){_0x2b2bb5=_0x2b2bb5||0xcc;return function(_0x3e0fe5){if(_0x3e0fe5){return _0x13a3fc['sendStatus'](_0x2b2bb5);}return _0x13a3fc['status'](_0x2b2bb5)[_0xb294('0x17')]();};}function respondWithResult(_0x4c0959,_0x4b5996){_0x4b5996=_0x4b5996||0xc8;return function(_0x22beca){if(_0x22beca){return _0x4c0959[_0xb294('0x18')](_0x4b5996)[_0xb294('0x19')](_0x22beca);}};}function respondWithFilteredResult(_0x366f8f,_0x3f7323){return function(_0x2f3b62){if(_0x2f3b62){var _0x1a4089=typeof _0x3f7323[_0xb294('0x1a')]===_0xb294('0x1b')&&typeof _0x3f7323[_0xb294('0x1c')]===_0xb294('0x1b');var _0x51110b=_0x2f3b62[_0xb294('0x1d')];var _0x1ecc68=_0x1a4089?0x0:_0x3f7323['offset'];var _0x5e8ce6=_0x1a4089?_0x2f3b62[_0xb294('0x1d')]:_0x3f7323[_0xb294('0x1a')]+_0x3f7323[_0xb294('0x1c')];var _0x449e81;if(_0x5e8ce6>=_0x51110b){_0x5e8ce6=_0x51110b;_0x449e81=0xc8;}else{_0x449e81=0xce;}_0x366f8f[_0xb294('0x18')](_0x449e81);return _0x366f8f['set']('Content-Range',_0x1ecc68+'-'+_0x5e8ce6+'/'+_0x51110b)[_0xb294('0x19')](_0x2f3b62);}return null;};}function patchUpdates(_0x46b2ac){return function(_0x526914){try{jsonpatch[_0xb294('0x1e')](_0x526914,_0x46b2ac,!![]);}catch(_0x18e7dd){return BPromise['reject'](_0x18e7dd);}return _0x526914[_0xb294('0x1f')]();};}function saveUpdates(_0x21b9b2,_0x33c416){return function(_0x4afd48){if(_0x4afd48){return _0x4afd48['update'](_0x21b9b2)[_0xb294('0x20')](function(_0x5bdc68){return _0x5bdc68;});}return null;};}function removeEntity(_0x36b173,_0x5be6d5){return function(_0x101339){if(_0x101339){return _0x101339['destroy']()[_0xb294('0x20')](function(){_0x36b173['status'](0xcc)[_0xb294('0x17')]();});}};}function handleEntityNotFound(_0x405b66,_0x2d0c62){return function(_0xabcb26){if(!_0xabcb26){_0x405b66[_0xb294('0x21')](0x194);}return _0xabcb26;};}function handleError(_0x469647,_0x2fe3a9){_0x2fe3a9=_0x2fe3a9||0x1f4;return function(_0x52853){logger[_0xb294('0x22')](_0x52853['stack']);if(_0x52853['name']){delete _0x52853[_0xb294('0x23')];}_0x469647[_0xb294('0x18')](_0x2fe3a9)[_0xb294('0x24')](_0x52853);};}exports[_0xb294('0x25')]=function(_0x47fca9,_0x59fbde){var _0x1167e5={'raw':!![],'where':{'id':_0x47fca9[_0xb294('0x26')]['id']}},_0x3c2aa5={};_0x3c2aa5[_0xb294('0x27')]=_['keys'](db['ChatProactiveAction']['rawAttributes']);_0x3c2aa5[_0xb294('0x28')]=_[_0xb294('0x29')](_0x47fca9[_0xb294('0x28')]);_0x3c2aa5[_0xb294('0x2a')]=_[_0xb294('0x2b')](_0x3c2aa5[_0xb294('0x27')],_0x3c2aa5[_0xb294('0x28')]);_0x1167e5[_0xb294('0x2c')]=_[_0xb294('0x2b')](_0x3c2aa5[_0xb294('0x27')],qs[_0xb294('0x2d')](_0x47fca9[_0xb294('0x28')][_0xb294('0x2d')]));_0x1167e5['attributes']=_0x1167e5['attributes'][_0xb294('0x2e')]?_0x1167e5['attributes']:_0x3c2aa5[_0xb294('0x27')];if(_0x47fca9[_0xb294('0x28')][_0xb294('0x2f')]){_0x1167e5[_0xb294('0x30')]=[{'all':!![]}];}_0x1167e5=_['merge']({},_0x1167e5,_0x47fca9[_0xb294('0x31')]);return db[_0xb294('0x32')][_0xb294('0x33')](_0x1167e5)[_0xb294('0x20')](handleEntityNotFound(_0x59fbde,null))[_0xb294('0x20')](respondWithResult(_0x59fbde,null))['catch'](handleError(_0x59fbde,null));};exports['create']=function(_0x47fbf3,_0x324f8f){return db[_0xb294('0x32')][_0xb294('0x34')](_0x47fbf3[_0xb294('0x35')],{})[_0xb294('0x20')](respondWithResult(_0x324f8f,0xc9))[_0xb294('0x36')](handleError(_0x324f8f,null));};exports[_0xb294('0x37')]=function(_0x5df86d,_0x3f2e12){if(_0x5df86d[_0xb294('0x35')]['id']){delete _0x5df86d[_0xb294('0x35')]['id'];}return db[_0xb294('0x32')][_0xb294('0x33')]({'where':{'id':_0x5df86d[_0xb294('0x26')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x3f2e12,null))[_0xb294('0x20')](saveUpdates(_0x5df86d['body'],null))['then'](respondWithResult(_0x3f2e12,null))[_0xb294('0x36')](handleError(_0x3f2e12,null));};exports['destroy']=function(_0x26af32,_0x565546){return db[_0xb294('0x32')][_0xb294('0x33')]({'where':{'id':_0x26af32[_0xb294('0x26')]['id']}})[_0xb294('0x20')](handleEntityNotFound(_0x565546,null))[_0xb294('0x20')](removeEntity(_0x565546,null))['catch'](handleError(_0x565546,null));}; \ No newline at end of file +var _0x4453=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','reject','save','update','destroy','end','error','stack','send','model','keys','ChatProactiveAction','query','intersection','attributes','fields','length','includeAll','include','then','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1237b1,_0x19ce6b){var _0x429a0c=function(_0x52144e){while(--_0x52144e){_0x1237b1['push'](_0x1237b1['shift']());}};_0x429a0c(++_0x19ce6b);}(_0x4453,0x9c));var _0x3445=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x4453[_0x2e655a];return _0x26f13b;};'use strict';var emlformat=require(_0x3445('0x0'));var rimraf=require(_0x3445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3445('0x2'));var rp=require(_0x3445('0x3'));var moment=require('moment');var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require(_0x3445('0x9'));var ejs=require(_0x3445('0xa'));var fs=require('fs');var fs_extra=require(_0x3445('0xb'));var _=require(_0x3445('0xc'));var squel=require(_0x3445('0xd'));var crypto=require('crypto');var jsforce=require(_0x3445('0xe'));var deskjs=require(_0x3445('0xf'));var toCsv=require(_0x3445('0x9'));var querystring=require(_0x3445('0x10'));var Papa=require(_0x3445('0x11'));var Redis=require(_0x3445('0x12'));var authService=require(_0x3445('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3445('0x14'));var hardwareService=require(_0x3445('0x15'));var logger=require(_0x3445('0x16'))(_0x3445('0x17'));var utils=require('../../config/utils');var config=require(_0x3445('0x18'));var licenseUtil=require(_0x3445('0x19'));var db=require(_0x3445('0x1a'))['db'];function respondWithStatusCode(_0x17e955,_0x41783b){_0x41783b=_0x41783b||0xcc;return function(_0x378bb6){if(_0x378bb6){return _0x17e955[_0x3445('0x1b')](_0x41783b);}return _0x17e955['status'](_0x41783b)['end']();};}function respondWithResult(_0x10ef76,_0x51f5f4){_0x51f5f4=_0x51f5f4||0xc8;return function(_0x23dfc8){if(_0x23dfc8){return _0x10ef76['status'](_0x51f5f4)[_0x3445('0x1c')](_0x23dfc8);}};}function respondWithFilteredResult(_0x3c7c0e,_0x2ccc36){return function(_0x3b0339){if(_0x3b0339){var _0x19ecee=typeof _0x2ccc36[_0x3445('0x1d')]===_0x3445('0x1e')&&typeof _0x2ccc36['limit']===_0x3445('0x1e');var _0x426fbf=_0x3b0339['count'];var _0x26ea84=_0x19ecee?0x0:_0x2ccc36[_0x3445('0x1d')];var _0x3bf4da=_0x19ecee?_0x3b0339[_0x3445('0x1f')]:_0x2ccc36[_0x3445('0x1d')]+_0x2ccc36[_0x3445('0x20')];var _0x21caef;if(_0x3bf4da>=_0x426fbf){_0x3bf4da=_0x426fbf;_0x21caef=0xc8;}else{_0x21caef=0xce;}_0x3c7c0e[_0x3445('0x21')](_0x21caef);return _0x3c7c0e[_0x3445('0x22')]('Content-Range',_0x26ea84+'-'+_0x3bf4da+'/'+_0x426fbf)[_0x3445('0x1c')](_0x3b0339);}return null;};}function patchUpdates(_0x103f81){return function(_0x41718b){try{jsonpatch['apply'](_0x41718b,_0x103f81,!![]);}catch(_0x5e0ddc){return BPromise[_0x3445('0x23')](_0x5e0ddc);}return _0x41718b[_0x3445('0x24')]();};}function saveUpdates(_0x402c7a,_0x57389d){return function(_0x28b943){if(_0x28b943){return _0x28b943[_0x3445('0x25')](_0x402c7a)['then'](function(_0x24b7d5){return _0x24b7d5;});}return null;};}function removeEntity(_0x586df5,_0x2cd7ac){return function(_0x5718f2){if(_0x5718f2){return _0x5718f2[_0x3445('0x26')]()['then'](function(){_0x586df5[_0x3445('0x21')](0xcc)[_0x3445('0x27')]();});}};}function handleEntityNotFound(_0x10bfe8,_0xece9b6){return function(_0x4d790c){if(!_0x4d790c){_0x10bfe8[_0x3445('0x1b')](0x194);}return _0x4d790c;};}function handleError(_0x42c92e,_0x2596fe){_0x2596fe=_0x2596fe||0x1f4;return function(_0x190723){logger[_0x3445('0x28')](_0x190723[_0x3445('0x29')]);if(_0x190723['name']){delete _0x190723['name'];}_0x42c92e[_0x3445('0x21')](_0x2596fe)[_0x3445('0x2a')](_0x190723);};}exports['show']=function(_0x247083,_0x5d2247){var _0x402efb={'raw':!![],'where':{'id':_0x247083['params']['id']}},_0x35cf56={};_0x35cf56[_0x3445('0x2b')]=_[_0x3445('0x2c')](db[_0x3445('0x2d')]['rawAttributes']);_0x35cf56[_0x3445('0x2e')]=_[_0x3445('0x2c')](_0x247083[_0x3445('0x2e')]);_0x35cf56['filters']=_[_0x3445('0x2f')](_0x35cf56[_0x3445('0x2b')],_0x35cf56[_0x3445('0x2e')]);_0x402efb[_0x3445('0x30')]=_['intersection'](_0x35cf56['model'],qs[_0x3445('0x31')](_0x247083['query'][_0x3445('0x31')]));_0x402efb['attributes']=_0x402efb[_0x3445('0x30')][_0x3445('0x32')]?_0x402efb[_0x3445('0x30')]:_0x35cf56[_0x3445('0x2b')];if(_0x247083[_0x3445('0x2e')][_0x3445('0x33')]){_0x402efb[_0x3445('0x34')]=[{'all':!![]}];}_0x402efb=_['merge']({},_0x402efb,_0x247083['options']);return db[_0x3445('0x2d')]['find'](_0x402efb)[_0x3445('0x35')](handleEntityNotFound(_0x5d2247,null))['then'](respondWithResult(_0x5d2247,null))[_0x3445('0x36')](handleError(_0x5d2247,null));};exports[_0x3445('0x37')]=function(_0x3eb0cf,_0x4b6e77){return db[_0x3445('0x2d')]['create'](_0x3eb0cf['body'],{})[_0x3445('0x35')](respondWithResult(_0x4b6e77,0xc9))[_0x3445('0x36')](handleError(_0x4b6e77,null));};exports[_0x3445('0x25')]=function(_0x20ccf6,_0xe625f2){if(_0x20ccf6[_0x3445('0x38')]['id']){delete _0x20ccf6[_0x3445('0x38')]['id'];}return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x20ccf6[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0xe625f2,null))[_0x3445('0x35')](saveUpdates(_0x20ccf6[_0x3445('0x38')],null))[_0x3445('0x35')](respondWithResult(_0xe625f2,null))[_0x3445('0x36')](handleError(_0xe625f2,null));};exports[_0x3445('0x26')]=function(_0x172856,_0x341623){return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x172856[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0x341623,null))[_0x3445('0x35')](removeEntity(_0x341623,null))[_0x3445('0x36')](handleError(_0x341623,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 04f5601..62c59cc 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 _0xbd8e=['path','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xca11fe,_0x33eb73){var _0x55bcd0=function(_0x582433){while(--_0x582433){_0xca11fe['push'](_0xca11fe['shift']());}};_0x55bcd0(++_0x33eb73);}(_0xbd8e,0x1e9));var _0xebd8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbd8e[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xebd8('0x0'));var util=require(_0xebd8('0x1'));var logger=require(_0xebd8('0x2'))(_0xebd8('0x3'));var moment=require(_0xebd8('0x4'));var BPromise=require('bluebird');var rp=require(_0xebd8('0x5'));var fs=require('fs');var path=require(_0xebd8('0x6'));var rimraf=require(_0xebd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xebd8('0x8'));module[_0xebd8('0x9')]=function(_0xcaf978,_0x340a79){return _0xcaf978['define'](_0xebd8('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94f0=['../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ca9fa,_0x52ebed){var _0x3580cf=function(_0x28f86d){while(--_0x28f86d){_0x1ca9fa['push'](_0x1ca9fa['shift']());}};_0x3580cf(++_0x52ebed);}(_0x94f0,0x19c));var _0x094f=function(_0x58ba98,_0x4b3f3c){_0x58ba98=_0x58ba98-0x0;var _0x5ef6b9=_0x94f0[_0x58ba98];return _0x5ef6b9;};'use strict';var _=require(_0x094f('0x0'));var util=require(_0x094f('0x1'));var logger=require(_0x094f('0x2'))(_0x094f('0x3'));var moment=require(_0x094f('0x4'));var BPromise=require(_0x094f('0x5'));var rp=require(_0x094f('0x6'));var fs=require('fs');var path=require(_0x094f('0x7'));var rimraf=require('rimraf');var config=require(_0x094f('0x8'));var attributes=require(_0x094f('0x9'));module[_0x094f('0xa')]=function(_0x30167e,_0x5a9612){return _0x30167e[_0x094f('0xb')](_0x094f('0xc'),attributes,{'tableName':_0x094f('0xd'),'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 64d01bf..7a466f3 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 _0x96ce=['result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x25d7ab,_0x21f44b){var _0x513242=function(_0x536fda){while(--_0x536fda){_0x25d7ab['push'](_0x25d7ab['shift']());}};_0x513242(++_0x21f44b);}(_0x96ce,0x144));var _0xe96c=function(_0x4b2a8f,_0x5277ac){_0x4b2a8f=_0x4b2a8f-0x0;var _0x311556=_0x96ce[_0x4b2a8f];return _0x311556;};'use strict';var _=require(_0xe96c('0x0'));var util=require(_0xe96c('0x1'));var moment=require(_0xe96c('0x2'));var BPromise=require(_0xe96c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe96c('0x4'));var logger=require(_0xe96c('0x5'))(_0xe96c('0x6'));var config=require(_0xe96c('0x7'));var jayson=require(_0xe96c('0x8'));var client=jayson[_0xe96c('0x9')][_0xe96c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e91a,_0x4d9203,_0x3ae7c5){return new BPromise(function(_0x2b5cae,_0x45b7c8){return client[_0xe96c('0xb')](_0x14e91a,_0x3ae7c5)['then'](function(_0x38a8b1){logger['info'](_0xe96c('0xc'),_0x4d9203,_0xe96c('0xd'));logger[_0xe96c('0xe')](_0xe96c('0xf'),_0x4d9203,_0xe96c('0xd'),JSON[_0xe96c('0x10')](_0x38a8b1));if(_0x38a8b1[_0xe96c('0x11')]){if(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x12')]===0x1f4){logger[_0xe96c('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d9203,_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);return _0x45b7c8(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);}logger[_0xe96c('0x11')](_0xe96c('0xc'),_0x4d9203,_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);return _0x2b5cae(_0x38a8b1[_0xe96c('0x11')][_0xe96c('0x13')]);}else{logger[_0xe96c('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d9203,_0xe96c('0xd'));_0x2b5cae(_0x38a8b1[_0xe96c('0x15')][_0xe96c('0x13')]);}})[_0xe96c('0x16')](function(_0x51d852){logger[_0xe96c('0x11')](_0xe96c('0xc'),_0x4d9203,_0x51d852);_0x45b7c8(_0x51d852);});});} \ No newline at end of file +var _0xf59d=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0xf59d,0x1ec));var _0xdf59=function(_0x4cc280,_0x3b77f3){_0x4cc280=_0x4cc280-0x0;var _0x16ed24=_0xf59d[_0x4cc280];return _0x16ed24;};'use strict';var _=require(_0xdf59('0x0'));var util=require('util');var moment=require(_0xdf59('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf59('0x2'));var fs=require('fs');var Redis=require(_0xdf59('0x3'));var db=require(_0xdf59('0x4'))['db'];var utils=require(_0xdf59('0x5'));var logger=require('../../config/logger')(_0xdf59('0x6'));var config=require('../../config/environment');var jayson=require(_0xdf59('0x7'));var client=jayson[_0xdf59('0x8')][_0xdf59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6afcb3,_0x496d84,_0x57a47d){return new BPromise(function(_0x4d07eb,_0x33e76e){return client[_0xdf59('0xa')](_0x6afcb3,_0x57a47d)['then'](function(_0x20e477){logger[_0xdf59('0xb')](_0xdf59('0xc'),_0x496d84,_0xdf59('0xd'));logger[_0xdf59('0xe')](_0xdf59('0xf'),_0x496d84,_0xdf59('0xd'),JSON[_0xdf59('0x10')](_0x20e477));if(_0x20e477[_0xdf59('0x11')]){if(_0x20e477[_0xdf59('0x11')][_0xdf59('0x12')]===0x1f4){logger[_0xdf59('0x11')](_0xdf59('0xc'),_0x496d84,_0x20e477[_0xdf59('0x11')]['message']);return _0x33e76e(_0x20e477[_0xdf59('0x11')][_0xdf59('0x13')]);}logger[_0xdf59('0x11')](_0xdf59('0xc'),_0x496d84,_0x20e477[_0xdf59('0x11')][_0xdf59('0x13')]);return _0x4d07eb(_0x20e477[_0xdf59('0x11')][_0xdf59('0x13')]);}else{logger[_0xdf59('0xb')](_0xdf59('0xc'),_0x496d84,_0xdf59('0xd'));_0x4d07eb(_0x20e477[_0xdf59('0x14')]['message']);}})[_0xdf59('0x15')](function(_0x32e3ce){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x496d84,_0x32e3ce);_0x33e76e(_0x32e3ce);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7933199..c0720aa 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xcabd19,_0x55efa6){_0xcabd19=_0xcabd19-0x0;var _0x387a0d=_0xb4c7[_0xcabd19];return _0x387a0d;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x5d58=['/:id','isAuthenticated','show','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x363319,_0x4fa1a1){var _0x182a62=function(_0x78f65b){while(--_0x78f65b){_0x363319['push'](_0x363319['shift']());}};_0x182a62(++_0x4fa1a1);}(_0x5d58,0x187));var _0x85d5=function(_0x4d5f50,_0x258964){_0x4d5f50=_0x4d5f50-0x0;var _0x213ee3=_0x5d58[_0x4d5f50];return _0x213ee3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./chatProactiveAction.controller');router[_0x85d5('0x4')](_0x85d5('0x5'),auth[_0x85d5('0x6')](),controller[_0x85d5('0x7')]);router['post']('/',auth[_0x85d5('0x6')](),controller[_0x85d5('0x8')]);router['put'](_0x85d5('0x5'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0xa')](_0x85d5('0x5'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 979d6aa..6c59227 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 _0xb9b6=['ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x29db4e,_0x323087){var _0xa264bc=function(_0x4d7f84){while(--_0x4d7f84){_0x29db4e['push'](_0x29db4e['shift']());}};_0xa264bc(++_0x323087);}(_0xb9b6,0x1bf));var _0x6b9b=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xb9b6[_0x24392f];return _0x591e33;};'use strict';var Sequelize=require(_0x6b9b('0x0'));module[_0x6b9b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6b9b('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6b9b('0x3')]('rrmemory',_0x6b9b('0x4'),_0x6b9b('0x5'))}}; \ No newline at end of file +var _0x9901=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0xd0e5b0,_0x25448b){var _0x4761ed=function(_0x558ac6){while(--_0x558ac6){_0xd0e5b0['push'](_0xd0e5b0['shift']());}};_0x4761ed(++_0x25448b);}(_0x9901,0x1af));var _0x1990=function(_0x214a3c,_0x48bd33){_0x214a3c=_0x214a3c-0x0;var _0x3743dc=_0x9901[_0x214a3c];return _0x3743dc;};'use strict';var Sequelize=require(_0x1990('0x0'));module[_0x1990('0x1')]={'name':{'type':Sequelize[_0x1990('0x2')],'unique':_0x1990('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1990('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1990('0x4')](_0x1990('0x5'),_0x1990('0x6'),_0x1990('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e5b312f..9bbbc05 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 _0x879c=['sendStatus','error','stack','name','index','map','fieldName','type','key','getOptions','where','ChatQueue','count','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','nolimit','limit','order','sort','pick','ChatQueueId','filter','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','Team','getTeams','addTeams','ids','User','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','userChatQueue:save','removeTeams','select','field','from','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','emit','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','undefined','offset','status','set','Content-Range','json','update','then','destroy','ChatQueues','UserProfileResource'];(function(_0x390fa7,_0xb1b52c){var _0x3dddbe=function(_0x5aa8e6){while(--_0x5aa8e6){_0x390fa7['push'](_0x390fa7['shift']());}};_0x3dddbe(++_0xb1b52c);}(_0x879c,0x153));var _0xc879=function(_0x3ccc28,_0x5036d5){_0x3ccc28=_0x3ccc28-0x0;var _0x47dd45=_0x879c[_0x3ccc28];return _0x47dd45;};'use strict';var BPromise=require(_0xc879('0x0'));var util=require(_0xc879('0x1'));var _=require('lodash');var squel=require(_0xc879('0x2'));var Redis=require(_0xc879('0x3'));var qs=require(_0xc879('0x4'));var logger=require('../../config/logger')('api');var config=require(_0xc879('0x5'));var db=require(_0xc879('0x6'))['db'];config[_0xc879('0x7')]=_[_0xc879('0x8')](config[_0xc879('0x7')],{'host':_0xc879('0x9'),'port':0x18eb});var socket=require(_0xc879('0xa'))(new Redis(config[_0xc879('0x7')]));require('./chatQueue.socket')[_0xc879('0xb')](socket);function respondWithStatusCode(_0x18a3d2,_0x157f6c){_0x157f6c=_0x157f6c||0xcc;return function(_0x3700ce){if(_0x3700ce){return _0x18a3d2['sendStatus'](_0x157f6c);}return _0x18a3d2['status'](_0x157f6c)[_0xc879('0xc')]();};}function respondWithResult(_0x38715a,_0x1c6263){_0x1c6263=_0x1c6263||0xc8;return function(_0x1f13b9){if(_0x1f13b9){return _0x38715a['status'](_0x1c6263)['json'](_0x1f13b9);}};}function respondWithFilteredResult(_0x2e5829,_0x375941){return function(_0x2c2653){if(_0x2c2653){var _0x5478b2=typeof _0x375941['offset']==='undefined'&&typeof _0x375941['limit']===_0xc879('0xd');var _0x6f9cab=_0x2c2653['count'];var _0x483ba6=_0x5478b2?0x0:_0x375941[_0xc879('0xe')];var _0x31c9ed=_0x5478b2?_0x2c2653['count']:_0x375941[_0xc879('0xe')]+_0x375941['limit'];var _0x4841c4;if(_0x31c9ed>=_0x6f9cab){_0x31c9ed=_0x6f9cab;_0x4841c4=0xc8;}else{_0x4841c4=0xce;}_0x2e5829[_0xc879('0xf')](_0x4841c4);return _0x2e5829[_0xc879('0x10')](_0xc879('0x11'),_0x483ba6+'-'+_0x31c9ed+'/'+_0x6f9cab)[_0xc879('0x12')](_0x2c2653);}return null;};}function saveUpdates(_0x21b975){return function(_0x8631c3){if(_0x8631c3){return _0x8631c3[_0xc879('0x13')](_0x21b975)[_0xc879('0x14')](function(_0x50fe4a){return _0x50fe4a;});}return null;};}function removeEntity(_0x19d6b7){return function(_0x4aca43){if(_0x4aca43){return _0x4aca43[_0xc879('0x15')]()[_0xc879('0x14')](function(){var _0x324ff3=_0x4aca43['get']({'plain':!![]});var _0x460655=_0xc879('0x16');return db[_0xc879('0x17')]['destroy']({'where':{'type':_0x460655,'resourceId':_0x324ff3['id']}})[_0xc879('0x14')](function(){return _0x4aca43;});})[_0xc879('0x14')](function(){_0x19d6b7['status'](0xcc)[_0xc879('0xc')]();});}};}function handleEntityNotFound(_0x31301c){return function(_0x5a1968){if(!_0x5a1968){_0x31301c[_0xc879('0x18')](0x194);}return _0x5a1968;};}function handleError(_0x2044ce,_0x58c9dc){_0x58c9dc=_0x58c9dc||0x1f4;return function(_0x183ae5){logger[_0xc879('0x19')](_0x183ae5[_0xc879('0x1a')]);if(_0x183ae5[_0xc879('0x1b')]){delete _0x183ae5[_0xc879('0x1b')];}_0x2044ce[_0xc879('0xf')](_0x58c9dc)['send'](_0x183ae5);};}exports[_0xc879('0x1c')]=function(_0xb61693,_0x3243ce){var _0x31e0d5={};var _0x19b2df={'count':0x0,'rows':[]};var _0xfdda72=_[_0xc879('0x1d')](db['ChatQueue']['rawAttributes'],function(_0x1a6165){return{'name':_0x1a6165[_0xc879('0x1e')],'type':_0x1a6165[_0xc879('0x1f')][_0xc879('0x20')]};});_0x31e0d5=qs[_0xc879('0x21')](_0xfdda72,_0xb61693);var _0x5a2b91={'where':_0x31e0d5[_0xc879('0x22')]};return db[_0xc879('0x23')][_0xc879('0x24')](_0x5a2b91)['then'](function(_0x4eed06){_0x19b2df[_0xc879('0x24')]=_0x4eed06;_0x31e0d5[_0xc879('0x25')]=qs[_0xc879('0x25')](_0xb61693[_0xc879('0x26')]);return db[_0xc879('0x23')][_0xc879('0x27')](_0x31e0d5);})[_0xc879('0x14')](function(_0x25a8a5){_0x19b2df[_0xc879('0x28')]=_0x25a8a5;return _0x19b2df;})[_0xc879('0x14')](respondWithFilteredResult(_0x3243ce,_0x31e0d5))[_0xc879('0x29')](handleError(_0x3243ce,null));};exports[_0xc879('0x2a')]=function(_0x2c16b1,_0x507968){var _0x1a5359={'raw':!![],'where':{'id':_0x2c16b1[_0xc879('0x2b')]['id']}},_0x451e31={};_0x451e31[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x23')][_0xc879('0x2e')]);_0x451e31[_0xc879('0x26')]=_[_0xc879('0x2d')](_0x2c16b1[_0xc879('0x26')]);_0x451e31['filters']=_[_0xc879('0x2f')](_0x451e31[_0xc879('0x2c')],_0x451e31['query']);_0x1a5359[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x451e31[_0xc879('0x2c')],qs[_0xc879('0x31')](_0x2c16b1['query'][_0xc879('0x31')]));_0x1a5359[_0xc879('0x30')]=_0x1a5359['attributes'][_0xc879('0x32')]?_0x1a5359['attributes']:_0x451e31['model'];if(_0x2c16b1[_0xc879('0x26')][_0xc879('0x33')]){_0x1a5359['include']=[{'all':!![]}];}_0x1a5359=_[_0xc879('0x34')]({},_0x1a5359,_0x2c16b1[_0xc879('0x35')]);return db[_0xc879('0x23')][_0xc879('0x36')](_0x1a5359)['then'](handleEntityNotFound(_0x507968,null))[_0xc879('0x14')](respondWithResult(_0x507968,null))[_0xc879('0x29')](handleError(_0x507968,null));};exports[_0xc879('0x37')]=function(_0x129f85,_0x105d4c){return db[_0xc879('0x23')][_0xc879('0x37')](_0x129f85[_0xc879('0x38')],{})['then'](function(_0x5d3cce){var _0x2591b2=_0x129f85[_0xc879('0x39')][_0xc879('0x3a')]({'plain':!![]});if(!_0x2591b2)throw new Error(_0xc879('0x3b'));if(_0x2591b2[_0xc879('0x3c')]===_0xc879('0x39')){var _0x16fb1a=_0x5d3cce[_0xc879('0x3a')]({'plain':!![]});var _0x19210e=_0xc879('0x16');return db[_0xc879('0x3d')]['find']({'where':{'name':_0x19210e,'userProfileId':_0x2591b2[_0xc879('0x3e')]},'raw':!![]})[_0xc879('0x14')](function(_0x501ce6){if(_0x501ce6&&_0x501ce6['autoAssociation']===0x0){return db[_0xc879('0x17')]['create']({'name':_0x16fb1a['name'],'resourceId':_0x16fb1a['id'],'type':_0x501ce6[_0xc879('0x1b')],'sectionId':_0x501ce6['id']},{})[_0xc879('0x14')](function(){return _0x5d3cce;});}else{return _0x5d3cce;}})[_0xc879('0x29')](function(_0x42b378){logger[_0xc879('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42b378);throw _0x42b378;});}return _0x5d3cce;})[_0xc879('0x14')](respondWithResult(_0x105d4c,0xc9))[_0xc879('0x29')](handleError(_0x105d4c,null));};exports['update']=function(_0x237cb3,_0x24a9f4){if(_0x237cb3['body']['id']){delete _0x237cb3[_0xc879('0x38')]['id'];}return db[_0xc879('0x23')]['find']({'where':{'id':_0x237cb3[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x24a9f4,null))[_0xc879('0x14')](saveUpdates(_0x237cb3['body'],null))[_0xc879('0x14')](respondWithResult(_0x24a9f4,null))[_0xc879('0x29')](handleError(_0x24a9f4,null));};exports[_0xc879('0x15')]=function(_0x1ba7cc,_0x4abe70){return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x1ba7cc['params']['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x4abe70,null))[_0xc879('0x14')](removeEntity(_0x4abe70,null))[_0xc879('0x29')](handleError(_0x4abe70,null));};exports['describe']=function(_0x2c99ce,_0x461857){return db['ChatQueue'][_0xc879('0x3f')]()[_0xc879('0x14')](respondWithResult(_0x461857,null))[_0xc879('0x29')](handleError(_0x461857,null));};exports[_0xc879('0x40')]=function(_0x39a6b5,_0x4ff21d){var _0x2c70ae={'raw':!![],'where':{}},_0x3f7d89={},_0x46a3f0;return db[_0xc879('0x23')][_0xc879('0x41')]({'where':{'id':_0x39a6b5[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x4ff21d,null))[_0xc879('0x14')](function(_0x3f2db1){if(_0x3f2db1){_0x46a3f0=_0x3f2db1[_0xc879('0x3a')]({'plain':!![]});_0x3f7d89[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x42')][_0xc879('0x2e')]);_0x3f7d89['query']=_[_0xc879('0x2d')](_0x39a6b5[_0xc879('0x26')]);_0x3f7d89[_0xc879('0x43')]=_[_0xc879('0x2f')](_0x3f7d89['model'],_0x3f7d89[_0xc879('0x26')]);_0x2c70ae[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x3f7d89[_0xc879('0x2c')],qs['fields'](_0x39a6b5['query'][_0xc879('0x31')]));_0x2c70ae[_0xc879('0x30')]=_0x2c70ae[_0xc879('0x30')][_0xc879('0x32')]?_0x2c70ae[_0xc879('0x30')]:_0x3f7d89[_0xc879('0x2c')];if(!_0x39a6b5[_0xc879('0x26')][_0xc879('0x44')](_0xc879('0x45'))){_0x2c70ae[_0xc879('0x46')]=qs[_0xc879('0x46')](_0x39a6b5[_0xc879('0x26')][_0xc879('0x46')]);_0x2c70ae['offset']=qs[_0xc879('0xe')](_0x39a6b5[_0xc879('0x26')][_0xc879('0xe')]);}_0x2c70ae[_0xc879('0x47')]=qs[_0xc879('0x48')](_0x39a6b5['query'][_0xc879('0x48')]);_0x2c70ae[_0xc879('0x22')]=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0x39a6b5[_0xc879('0x26')],_0x3f7d89[_0xc879('0x43')]));_0x2c70ae[_0xc879('0x22')][_0xc879('0x4a')]=_0x3f2db1['id'];if(_0x39a6b5[_0xc879('0x26')][_0xc879('0x4b')]){_0x2c70ae['where']=_[_0xc879('0x34')](_0x2c70ae[_0xc879('0x22')],{'$or':_[_0xc879('0x1d')](_0x2c70ae[_0xc879('0x30')],function(_0x21ae3e){var _0x81349e={};_0x81349e[_0x21ae3e]={'$like':'%'+_0x39a6b5[_0xc879('0x26')][_0xc879('0x4b')]+'%'};return _0x81349e;})});}_0x2c70ae=_[_0xc879('0x34')]({},_0x2c70ae,_0x39a6b5[_0xc879('0x35')]);return db[_0xc879('0x42')][_0xc879('0x27')](_0x2c70ae);}})['then'](function(_0x4d23bc){if(_0x4d23bc){return db['User'][_0xc879('0x4c')]({'where':{'id':_['map'](_0x4d23bc,_0xc879('0x4d')),'role':_0xc879('0x4e')},'attributes':['id',_0xc879('0x1b'),_0xc879('0x4f'),_0xc879('0x50'),_0xc879('0x51')]});}})[_0xc879('0x14')](function(_0x17a4f9){if(_0x17a4f9){return{'count':_0x17a4f9[_0xc879('0x24')],'rows':_[_0xc879('0x1d')](_0x17a4f9[_0xc879('0x28')],function(_0x376290){return{'membername':_0x376290['name'],'UserId':_0x376290['id'],'queue_name':_0x46a3f0[_0xc879('0x1b')],'ChatQueueId':_0x46a3f0['id'],'interface':util['format']('%s/%s','SIP',_0x376290[_0xc879('0x1b')]),'penalty':0x0,'paused':_0x376290[_0xc879('0x4f')],'createdAt':_0x376290['createdAt'],'updatedAt':_0x376290[_0xc879('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc879('0x14')](respondWithFilteredResult(_0x4ff21d,_0x2c70ae))['catch'](handleError(_0x4ff21d,null));};exports['getTeams']=function(_0x47fbfb,_0x1ffdc9){var _0x38bb30={};var _0x391f3e={};var _0xdeeeaa;var _0x459452;return db['ChatQueue'][_0xc879('0x41')]({'where':{'id':_0x47fbfb[_0xc879('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1ffdc9,null))[_0xc879('0x14')](function(_0x5b1cee){if(_0x5b1cee){_0xdeeeaa=_0x5b1cee;_0x391f3e[_0xc879('0x2c')]=_[_0xc879('0x2d')](db[_0xc879('0x52')][_0xc879('0x2e')]);_0x391f3e[_0xc879('0x26')]=_['keys'](_0x47fbfb['query']);_0x391f3e['filters']=_[_0xc879('0x2f')](_0x391f3e[_0xc879('0x2c')],_0x391f3e[_0xc879('0x26')]);_0x38bb30[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x391f3e[_0xc879('0x2c')],qs['fields'](_0x47fbfb[_0xc879('0x26')][_0xc879('0x31')]));_0x38bb30[_0xc879('0x30')]=_0x38bb30[_0xc879('0x30')][_0xc879('0x32')]?_0x38bb30[_0xc879('0x30')]:_0x391f3e[_0xc879('0x2c')];_0x38bb30[_0xc879('0x47')]=qs[_0xc879('0x48')](_0x47fbfb[_0xc879('0x26')][_0xc879('0x48')]);_0x38bb30[_0xc879('0x22')]=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0x47fbfb[_0xc879('0x26')],_0x391f3e[_0xc879('0x43')]));if(_0x47fbfb[_0xc879('0x26')][_0xc879('0x4b')]){_0x38bb30[_0xc879('0x22')]=_[_0xc879('0x34')](_0x38bb30[_0xc879('0x22')],{'$or':_[_0xc879('0x1d')](_0x38bb30[_0xc879('0x30')],function(_0x26a4d){var _0x4eff4c={};_0x4eff4c[_0x26a4d]={'$like':'%'+_0x47fbfb['query'][_0xc879('0x4b')]+'%'};return _0x4eff4c;})});}_0x38bb30=_[_0xc879('0x34')]({},_0x38bb30,_0x47fbfb[_0xc879('0x35')]);return _0xdeeeaa['getTeams'](_0x38bb30);}})[_0xc879('0x14')](function(_0x4cd76c){if(_0x4cd76c){_0x459452=_0x4cd76c[_0xc879('0x32')];if(!_0x47fbfb[_0xc879('0x26')][_0xc879('0x44')](_0xc879('0x45'))){_0x38bb30[_0xc879('0x46')]=qs[_0xc879('0x46')](_0x47fbfb[_0xc879('0x26')]['limit']);_0x38bb30['offset']=qs['offset'](_0x47fbfb[_0xc879('0x26')]['offset']);}return _0xdeeeaa[_0xc879('0x53')](_0x38bb30);}})[_0xc879('0x14')](function(_0x615d6f){if(_0x615d6f){return _0x615d6f?{'count':_0x459452,'rows':_0x615d6f}:null;}})[_0xc879('0x14')](respondWithResult(_0x1ffdc9,null))[_0xc879('0x29')](handleError(_0x1ffdc9,null));};exports[_0xc879('0x54')]=function(_0x3eeeee,_0x21d876){var _0xf97f1f=_0x3eeeee['body'][_0xc879('0x55')];return db[_0xc879('0x52')][_0xc879('0x27')]({'where':{'id':_0xf97f1f},'attributes':['id'],'include':[{'model':db[_0xc879('0x56')],'as':'Agents','attributes':['id',_0xc879('0x1b'),_0xc879('0x57'),'voicePause',_0xc879('0x58')],'raw':!![]}]})[_0xc879('0x14')](function(_0x5f06a6){if(_0x5f06a6){var _0x2c5fb6=_[_0xc879('0x59')](_0x5f06a6,function(_0x15af03){var _0x4f4e31=_0x15af03[_0xc879('0x3a')]({'plain':!![]});return _0x4f4e31[_0xc879('0x5a')];});return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x3eeeee[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](function(_0x166db5){return db[_0xc879('0x5b')][_0xc879('0x5c')](function(_0x55332b){return _0x166db5[_0xc879('0x54')](_0xf97f1f,{'transaction':_0x55332b})['then'](function(){return BPromise[_0xc879('0x5d')](_0x2c5fb6,function(_0x1868fa){return db[_0xc879('0x42')]['findOrCreate']({'where':{'UserId':_0x1868fa['id'],'ChatQueueId':_0x3eeeee[_0xc879('0x2b')]['id']},'transaction':_0x55332b});});})[_0xc879('0x14')](function(){_0x2c5fb6[_0xc879('0x5e')](function(_0x5afa40){socket['emit'](_0xc879('0x5f'),{'UserId':_0x5afa40['id'],'ChatQueueId':_0x166db5['id']});});});});});}})[_0xc879('0x14')](respondWithStatusCode(_0x21d876,null))[_0xc879('0x29')](handleError(_0x21d876,null));};exports[_0xc879('0x60')]=function(_0x3bcdf2,_0x3a625a){return db[_0xc879('0x52')][_0xc879('0x27')]({'where':{'id':_0x3bcdf2[_0xc879('0x26')][_0xc879('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc879('0x14')](handleEntityNotFound(_0x3a625a,null))['then'](function(_0x1b9b46){var _0x3cbf87=_[_0xc879('0x1d')](_0x1b9b46,'id');var _0x56870f=[];var _0x160ed5=[];var _0x4ec3af=squel[_0xc879('0x61')]();_0x4ec3af[_0xc879('0x62')]('tq.TeamId')[_0xc879('0x63')]('team_has_chat_queues','tq')['join'](_0xc879('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc879('0x22')](_0xc879('0x65'),_0x3bcdf2[_0xc879('0x2b')]['id']);for(var _0x86455e=0x0;_0x86455e<_0x1b9b46[_0xc879('0x32')];_0x86455e+=0x1){let _0x23d53c=_0x1b9b46[_0x86455e];for(var _0xc0bbc1=0x0;_0xc0bbc1<_0x23d53c[_0xc879('0x5a')][_0xc879('0x32')];_0xc0bbc1+=0x1){let _0x3f830c=_0x23d53c[_0xc879('0x5a')][_0xc0bbc1];var _0x18aebb=_0x4ec3af[_0xc879('0x66')]();_0x18aebb[_0xc879('0x22')](_0xc879('0x67'),_0x3f830c['id']);_0x160ed5['push'](db[_0xc879('0x5b')][_0xc879('0x26')](_0x18aebb['toString'](),{'type':db[_0xc879('0x5b')][_0xc879('0x68')][_0xc879('0x69')]})[_0xc879('0x14')](function(_0x51fa7f){if(_0x51fa7f[_0xc879('0x32')]===0x1){return _0x3f830c['id'];}else{var _0x4a5042=_[_0xc879('0x6a')](_[_0xc879('0x1d')](_0x51fa7f,_0xc879('0x6b')),function(_0x5ec0aa){return _[_0xc879('0x6c')](_0x3cbf87,_0x5ec0aa);});if(_0x4a5042){return _0x3f830c['id'];}}}));}}return BPromise[_0xc879('0x6d')](_0x160ed5)['then'](function(_0x3cb142){_0x56870f=_(_0x56870f)[_0xc879('0x6e')](_0x3cb142)[_0xc879('0x6f')]()[_0xc879('0x70')]();return db[_0xc879('0x23')][_0xc879('0x36')]({'where':{'id':_0x3bcdf2['params']['id']}})[_0xc879('0x14')](function(_0x48fb57){return db[_0xc879('0x5b')][_0xc879('0x5c')](function(_0x1366bc){return _0x48fb57['removeTeams'](_0x3bcdf2['query'][_0xc879('0x55')],{'transaction':_0x1366bc})[_0xc879('0x14')](function(){if(!_[_0xc879('0x71')](_0x56870f)){return _0x48fb57[_0xc879('0x72')](_0x56870f,{'transaction':_0x1366bc});}})[_0xc879('0x14')](function(){_0x56870f[_0xc879('0x5e')](function(_0x208c3a){socket['emit'](_0xc879('0x73'),{'UserId':_0x208c3a,'ChatQueueId':_0x48fb57['id']});});});});});});})[_0xc879('0x14')](respondWithStatusCode(_0x3a625a,null))['catch'](handleError(_0x3a625a,null));};exports[_0xc879('0x74')]=function(_0x18572f,_0x527029){return db[_0xc879('0x23')]['find']({'where':{'id':_0x18572f[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x527029,null))[_0xc879('0x14')](function(_0x4da649){if(_0x4da649){return _0x4da649['addAgents'](_0x18572f['body']['ids'],_[_0xc879('0x75')](_0x18572f[_0xc879('0x38')],[_0xc879('0x55'),'id'])||{})[_0xc879('0x76')](function(_0x14ef02){for(var _0x45f866=0x0;_0x45f866<_0x18572f['body'][_0xc879('0x55')][_0xc879('0x32')];_0x45f866+=0x1){socket[_0xc879('0x77')](_0xc879('0x5f'),{'UserId':Number(_0x18572f[_0xc879('0x38')]['ids'][_0x45f866]),'ChatQueueId':Number(_0x18572f['params']['id'])});}return _0x14ef02;});}})[_0xc879('0x14')](respondWithResult(_0x527029,null))[_0xc879('0x29')](handleError(_0x527029,null));};exports[_0xc879('0x72')]=function(_0x5b4814,_0x1cbae7){return db['ChatQueue']['find']({'where':{'id':_0x5b4814[_0xc879('0x2b')]['id']}})[_0xc879('0x14')](handleEntityNotFound(_0x1cbae7,null))[_0xc879('0x14')](function(_0x2244d3){if(_0x2244d3){return _0x2244d3['removeAgents'](_0x5b4814[_0xc879('0x26')][_0xc879('0x55')])[_0xc879('0x14')](function(){if(_['isArray'](_0x5b4814['query'][_0xc879('0x55')])){for(var _0xee6d61=0x0;_0xee6d61<_0x5b4814[_0xc879('0x26')][_0xc879('0x55')]['length'];_0xee6d61+=0x1){socket['emit'](_0xc879('0x73'),{'UserId':Number(_0x5b4814[_0xc879('0x26')][_0xc879('0x55')][_0xee6d61]),'ChatQueueId':Number(_0x5b4814['params']['id'])});}}else{socket[_0xc879('0x77')](_0xc879('0x73'),{'UserId':Number(_0x5b4814[_0xc879('0x26')][_0xc879('0x55')]),'ChatQueueId':Number(_0x5b4814[_0xc879('0x2b')]['id'])});}});}})[_0xc879('0x14')](respondWithStatusCode(_0x1cbae7,null))[_0xc879('0x29')](handleError(_0x1cbae7,null));};exports['getAgents']=function(_0xd5adc4,_0x447dc){var _0x488897={};var _0x1483d9={};var _0x1df534;var _0x172452;return db['ChatQueue']['findOne']({'where':{'id':_0xd5adc4[_0xc879('0x2b')]['id']}})['then'](handleEntityNotFound(_0x447dc,null))[_0xc879('0x14')](function(_0x4ecfba){if(_0x4ecfba){_0x1df534=_0x4ecfba;_0x1483d9[_0xc879('0x2c')]=_['keys'](db[_0xc879('0x56')][_0xc879('0x2e')]);_0x1483d9['query']=_[_0xc879('0x2d')](_0xd5adc4[_0xc879('0x26')]);_0x1483d9['filters']=_['intersection'](_0x1483d9[_0xc879('0x2c')],_0x1483d9[_0xc879('0x26')]);_0x488897[_0xc879('0x30')]=_[_0xc879('0x2f')](_0x1483d9['model'],qs['fields'](_0xd5adc4[_0xc879('0x26')][_0xc879('0x31')]));_0x488897[_0xc879('0x30')]=_0x488897[_0xc879('0x30')][_0xc879('0x32')]?_0x488897[_0xc879('0x30')]:_0x1483d9[_0xc879('0x2c')];_0x488897[_0xc879('0x47')]=qs['sort'](_0xd5adc4['query'][_0xc879('0x48')]);_0x488897['where']=qs[_0xc879('0x43')](_[_0xc879('0x49')](_0xd5adc4['query'],_0x1483d9['filters']));if(_0xd5adc4[_0xc879('0x26')][_0xc879('0x4b')]){_0x488897[_0xc879('0x22')]=_['merge'](_0x488897[_0xc879('0x22')],{'$or':_['map'](_0x488897[_0xc879('0x30')],function(_0x370840){var _0x5689ea={};_0x5689ea[_0x370840]={'$like':'%'+_0xd5adc4['query'][_0xc879('0x4b')]+'%'};return _0x5689ea;})});}_0x488897=_['merge']({},_0x488897,_0xd5adc4[_0xc879('0x35')]);return _0x1df534[_0xc879('0x78')](_0x488897);}})[_0xc879('0x14')](function(_0x51a092){if(_0x51a092){_0x172452=_0x51a092[_0xc879('0x32')];if(!_0xd5adc4[_0xc879('0x26')][_0xc879('0x44')]('nolimit')){_0x488897['limit']=qs[_0xc879('0x46')](_0xd5adc4['query'][_0xc879('0x46')]);_0x488897[_0xc879('0xe')]=qs[_0xc879('0xe')](_0xd5adc4[_0xc879('0x26')][_0xc879('0xe')]);}return _0x1df534[_0xc879('0x78')](_0x488897);}})[_0xc879('0x14')](function(_0x358cb2){if(_0x358cb2){return _0x358cb2?{'count':_0x172452,'rows':_0x358cb2}:null;}})[_0xc879('0x14')](respondWithResult(_0x447dc,null))[_0xc879('0x29')](handleError(_0x447dc,null));}; \ No newline at end of file +var _0x9b6d=['ioredis','api','../../config/environment','../../mysqldb','redis','./chatQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','where','query','findAll','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','filter','map','User','agent','updatedAt','format','%s/%s','SIP','chatPause','createdAt','getTeams','ids','Team','Agents','online','interface','flatMap','addTeams','each','UserChatQueue','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','squel'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x9b6d,0x16c));var _0xd9b6=function(_0x4865a2,_0x3a0b4a){_0x4865a2=_0x4865a2-0x0;var _0x285625=_0x9b6d[_0x4865a2];return _0x285625;};'use strict';var BPromise=require(_0xd9b6('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xd9b6('0x1'));var Redis=require(_0xd9b6('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xd9b6('0x3'));var config=require(_0xd9b6('0x4'));var db=require(_0xd9b6('0x5'))['db'];config[_0xd9b6('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd9b6('0x7'))[_0xd9b6('0x8')](socket);function respondWithStatusCode(_0x1616cf,_0xba7736){_0xba7736=_0xba7736||0xcc;return function(_0x2bb813){if(_0x2bb813){return _0x1616cf[_0xd9b6('0x9')](_0xba7736);}return _0x1616cf[_0xd9b6('0xa')](_0xba7736)[_0xd9b6('0xb')]();};}function respondWithResult(_0x201373,_0x4f7926){_0x4f7926=_0x4f7926||0xc8;return function(_0x5cf494){if(_0x5cf494){return _0x201373['status'](_0x4f7926)[_0xd9b6('0xc')](_0x5cf494);}};}function respondWithFilteredResult(_0x2cf821,_0x577295){return function(_0x539f07){if(_0x539f07){var _0x52710f=typeof _0x577295['offset']==='undefined'&&typeof _0x577295[_0xd9b6('0xd')]===_0xd9b6('0xe');var _0x49692f=_0x539f07[_0xd9b6('0xf')];var _0x534118=_0x52710f?0x0:_0x577295[_0xd9b6('0x10')];var _0x32a16c=_0x52710f?_0x539f07[_0xd9b6('0xf')]:_0x577295[_0xd9b6('0x10')]+_0x577295['limit'];var _0xb29a0a;if(_0x32a16c>=_0x49692f){_0x32a16c=_0x49692f;_0xb29a0a=0xc8;}else{_0xb29a0a=0xce;}_0x2cf821[_0xd9b6('0xa')](_0xb29a0a);return _0x2cf821[_0xd9b6('0x11')]('Content-Range',_0x534118+'-'+_0x32a16c+'/'+_0x49692f)['json'](_0x539f07);}return null;};}function saveUpdates(_0x2587e1){return function(_0x34eda2){if(_0x34eda2){return _0x34eda2[_0xd9b6('0x12')](_0x2587e1)[_0xd9b6('0x13')](function(_0x348761){return _0x348761;});}return null;};}function removeEntity(_0x52a095){return function(_0x300ec5){if(_0x300ec5){return _0x300ec5[_0xd9b6('0x14')]()['then'](function(){var _0xaf5d5b=_0x300ec5[_0xd9b6('0x15')]({'plain':!![]});var _0x3e7783=_0xd9b6('0x16');return db[_0xd9b6('0x17')][_0xd9b6('0x14')]({'where':{'type':_0x3e7783,'resourceId':_0xaf5d5b['id']}})[_0xd9b6('0x13')](function(){return _0x300ec5;});})[_0xd9b6('0x13')](function(){_0x52a095[_0xd9b6('0xa')](0xcc)[_0xd9b6('0xb')]();});}};}function handleEntityNotFound(_0x4ce225){return function(_0x179776){if(!_0x179776){_0x4ce225[_0xd9b6('0x9')](0x194);}return _0x179776;};}function handleError(_0x3dde56,_0x476ebe){_0x476ebe=_0x476ebe||0x1f4;return function(_0x597290){logger[_0xd9b6('0x18')](_0x597290[_0xd9b6('0x19')]);if(_0x597290[_0xd9b6('0x1a')]){delete _0x597290[_0xd9b6('0x1a')];}_0x3dde56['status'](_0x476ebe)[_0xd9b6('0x1b')](_0x597290);};}exports[_0xd9b6('0x1c')]=function(_0x5ca001,_0x5c07fe){var _0x236cca={};var _0x10e708={'count':0x0,'rows':[]};var _0x2bffc5=_['map'](db[_0xd9b6('0x1d')][_0xd9b6('0x1e')],function(_0x2da963){return{'name':_0x2da963[_0xd9b6('0x1f')],'type':_0x2da963[_0xd9b6('0x20')][_0xd9b6('0x21')]};});_0x236cca=qs['getOptions'](_0x2bffc5,_0x5ca001);var _0x56f1c3={'where':_0x236cca[_0xd9b6('0x22')]};return db[_0xd9b6('0x1d')][_0xd9b6('0xf')](_0x56f1c3)['then'](function(_0x1fb22c){_0x10e708['count']=_0x1fb22c;_0x236cca['include']=qs['include'](_0x5ca001[_0xd9b6('0x23')]);return db[_0xd9b6('0x1d')][_0xd9b6('0x24')](_0x236cca);})[_0xd9b6('0x13')](function(_0x11e5ec){_0x10e708[_0xd9b6('0x25')]=_0x11e5ec;return _0x10e708;})[_0xd9b6('0x13')](respondWithFilteredResult(_0x5c07fe,_0x236cca))[_0xd9b6('0x26')](handleError(_0x5c07fe,null));};exports[_0xd9b6('0x27')]=function(_0x407f43,_0x3f6913){var _0x5b636c={'raw':!![],'where':{'id':_0x407f43['params']['id']}},_0x164801={};_0x164801['model']=_[_0xd9b6('0x28')](db[_0xd9b6('0x1d')]['rawAttributes']);_0x164801[_0xd9b6('0x23')]=_[_0xd9b6('0x28')](_0x407f43['query']);_0x164801[_0xd9b6('0x29')]=_[_0xd9b6('0x2a')](_0x164801[_0xd9b6('0x2b')],_0x164801['query']);_0x5b636c[_0xd9b6('0x2c')]=_['intersection'](_0x164801['model'],qs[_0xd9b6('0x2d')](_0x407f43[_0xd9b6('0x23')][_0xd9b6('0x2d')]));_0x5b636c[_0xd9b6('0x2c')]=_0x5b636c[_0xd9b6('0x2c')][_0xd9b6('0x2e')]?_0x5b636c[_0xd9b6('0x2c')]:_0x164801[_0xd9b6('0x2b')];if(_0x407f43['query'][_0xd9b6('0x2f')]){_0x5b636c['include']=[{'all':!![]}];}_0x5b636c=_[_0xd9b6('0x30')]({},_0x5b636c,_0x407f43[_0xd9b6('0x31')]);return db[_0xd9b6('0x1d')]['find'](_0x5b636c)[_0xd9b6('0x13')](handleEntityNotFound(_0x3f6913,null))[_0xd9b6('0x13')](respondWithResult(_0x3f6913,null))[_0xd9b6('0x26')](handleError(_0x3f6913,null));};exports['create']=function(_0x27ae45,_0x1103de){return db['ChatQueue'][_0xd9b6('0x32')](_0x27ae45['body'],{})[_0xd9b6('0x13')](function(_0x3bc928){var _0x1b0037=_0x27ae45[_0xd9b6('0x33')][_0xd9b6('0x15')]({'plain':!![]});if(!_0x1b0037)throw new Error(_0xd9b6('0x34'));if(_0x1b0037[_0xd9b6('0x35')]==='user'){var _0x13e90f=_0x3bc928[_0xd9b6('0x15')]({'plain':!![]});var _0x49e3bc=_0xd9b6('0x16');return db[_0xd9b6('0x36')]['find']({'where':{'name':_0x49e3bc,'userProfileId':_0x1b0037[_0xd9b6('0x37')]},'raw':!![]})['then'](function(_0x4da282){if(_0x4da282&&_0x4da282[_0xd9b6('0x38')]===0x0){return db[_0xd9b6('0x17')][_0xd9b6('0x32')]({'name':_0x13e90f['name'],'resourceId':_0x13e90f['id'],'type':_0x4da282['name'],'sectionId':_0x4da282['id']},{})[_0xd9b6('0x13')](function(){return _0x3bc928;});}else{return _0x3bc928;}})[_0xd9b6('0x26')](function(_0xb1988b){logger['error'](_0xd9b6('0x39'),_0xb1988b);throw _0xb1988b;});}return _0x3bc928;})[_0xd9b6('0x13')](respondWithResult(_0x1103de,0xc9))[_0xd9b6('0x26')](handleError(_0x1103de,null));};exports[_0xd9b6('0x12')]=function(_0x30501d,_0x4dce2d){if(_0x30501d[_0xd9b6('0x3a')]['id']){delete _0x30501d[_0xd9b6('0x3a')]['id'];}return db['ChatQueue'][_0xd9b6('0x3b')]({'where':{'id':_0x30501d[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](handleEntityNotFound(_0x4dce2d,null))[_0xd9b6('0x13')](saveUpdates(_0x30501d['body'],null))[_0xd9b6('0x13')](respondWithResult(_0x4dce2d,null))[_0xd9b6('0x26')](handleError(_0x4dce2d,null));};exports[_0xd9b6('0x14')]=function(_0x2df6bb,_0x49f305){return db[_0xd9b6('0x1d')][_0xd9b6('0x3b')]({'where':{'id':_0x2df6bb[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](handleEntityNotFound(_0x49f305,null))[_0xd9b6('0x13')](removeEntity(_0x49f305,null))['catch'](handleError(_0x49f305,null));};exports['describe']=function(_0x1866dc,_0x346a76){return db['ChatQueue'][_0xd9b6('0x3d')]()[_0xd9b6('0x13')](respondWithResult(_0x346a76,null))[_0xd9b6('0x26')](handleError(_0x346a76,null));};exports['getMembers']=function(_0x188a8f,_0x42dd44){var _0xb0891c={'raw':!![],'where':{}},_0xc1b492={},_0x21f4db;return db['ChatQueue'][_0xd9b6('0x3e')]({'where':{'id':_0x188a8f[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](handleEntityNotFound(_0x42dd44,null))[_0xd9b6('0x13')](function(_0x251b07){if(_0x251b07){_0x21f4db=_0x251b07[_0xd9b6('0x15')]({'plain':!![]});_0xc1b492[_0xd9b6('0x2b')]=_['keys'](db['UserChatQueue']['rawAttributes']);_0xc1b492[_0xd9b6('0x23')]=_['keys'](_0x188a8f['query']);_0xc1b492[_0xd9b6('0x29')]=_[_0xd9b6('0x2a')](_0xc1b492[_0xd9b6('0x2b')],_0xc1b492[_0xd9b6('0x23')]);_0xb0891c[_0xd9b6('0x2c')]=_[_0xd9b6('0x2a')](_0xc1b492['model'],qs[_0xd9b6('0x2d')](_0x188a8f[_0xd9b6('0x23')][_0xd9b6('0x2d')]));_0xb0891c['attributes']=_0xb0891c[_0xd9b6('0x2c')][_0xd9b6('0x2e')]?_0xb0891c['attributes']:_0xc1b492[_0xd9b6('0x2b')];if(!_0x188a8f['query'][_0xd9b6('0x3f')](_0xd9b6('0x40'))){_0xb0891c[_0xd9b6('0xd')]=qs[_0xd9b6('0xd')](_0x188a8f[_0xd9b6('0x23')][_0xd9b6('0xd')]);_0xb0891c['offset']=qs[_0xd9b6('0x10')](_0x188a8f[_0xd9b6('0x23')][_0xd9b6('0x10')]);}_0xb0891c[_0xd9b6('0x41')]=qs[_0xd9b6('0x42')](_0x188a8f[_0xd9b6('0x23')][_0xd9b6('0x42')]);_0xb0891c['where']=qs['filters'](_[_0xd9b6('0x43')](_0x188a8f['query'],_0xc1b492[_0xd9b6('0x29')]));_0xb0891c[_0xd9b6('0x22')]['ChatQueueId']=_0x251b07['id'];if(_0x188a8f[_0xd9b6('0x23')][_0xd9b6('0x44')]){_0xb0891c[_0xd9b6('0x22')]=_[_0xd9b6('0x30')](_0xb0891c[_0xd9b6('0x22')],{'$or':_[_0xd9b6('0x45')](_0xb0891c[_0xd9b6('0x2c')],function(_0x3cfab3){var _0x4898cc={};_0x4898cc[_0x3cfab3]={'$like':'%'+_0x188a8f[_0xd9b6('0x23')]['filter']+'%'};return _0x4898cc;})});}_0xb0891c=_[_0xd9b6('0x30')]({},_0xb0891c,_0x188a8f[_0xd9b6('0x31')]);return db['UserChatQueue'][_0xd9b6('0x24')](_0xb0891c);}})[_0xd9b6('0x13')](function(_0x1c20ec){if(_0x1c20ec){return db[_0xd9b6('0x46')]['findAndCountAll']({'where':{'id':_[_0xd9b6('0x45')](_0x1c20ec,'UserId'),'role':_0xd9b6('0x47')},'attributes':['id',_0xd9b6('0x1a'),'chatPause',_0xd9b6('0x48'),'createdAt']});}})[_0xd9b6('0x13')](function(_0x20a08b){if(_0x20a08b){return{'count':_0x20a08b[_0xd9b6('0xf')],'rows':_[_0xd9b6('0x45')](_0x20a08b[_0xd9b6('0x25')],function(_0x664aea){return{'membername':_0x664aea[_0xd9b6('0x1a')],'UserId':_0x664aea['id'],'queue_name':_0x21f4db[_0xd9b6('0x1a')],'ChatQueueId':_0x21f4db['id'],'interface':util[_0xd9b6('0x49')](_0xd9b6('0x4a'),_0xd9b6('0x4b'),_0x664aea[_0xd9b6('0x1a')]),'penalty':0x0,'paused':_0x664aea[_0xd9b6('0x4c')],'createdAt':_0x664aea[_0xd9b6('0x4d')],'updatedAt':_0x664aea['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9b6('0x13')](respondWithFilteredResult(_0x42dd44,_0xb0891c))[_0xd9b6('0x26')](handleError(_0x42dd44,null));};exports[_0xd9b6('0x4e')]=function(_0x1d3512,_0x56a2c9){var _0x2f7432={};var _0x143edc={};var _0x2e12cb;var _0x2f1c07;return db['ChatQueue']['findOne']({'where':{'id':_0x1d3512[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](handleEntityNotFound(_0x56a2c9,null))[_0xd9b6('0x13')](function(_0x52419a){if(_0x52419a){_0x2e12cb=_0x52419a;_0x143edc[_0xd9b6('0x2b')]=_['keys'](db['Team'][_0xd9b6('0x1e')]);_0x143edc[_0xd9b6('0x23')]=_['keys'](_0x1d3512[_0xd9b6('0x23')]);_0x143edc[_0xd9b6('0x29')]=_[_0xd9b6('0x2a')](_0x143edc['model'],_0x143edc[_0xd9b6('0x23')]);_0x2f7432[_0xd9b6('0x2c')]=_[_0xd9b6('0x2a')](_0x143edc['model'],qs[_0xd9b6('0x2d')](_0x1d3512[_0xd9b6('0x23')][_0xd9b6('0x2d')]));_0x2f7432[_0xd9b6('0x2c')]=_0x2f7432['attributes'][_0xd9b6('0x2e')]?_0x2f7432[_0xd9b6('0x2c')]:_0x143edc[_0xd9b6('0x2b')];_0x2f7432[_0xd9b6('0x41')]=qs[_0xd9b6('0x42')](_0x1d3512[_0xd9b6('0x23')][_0xd9b6('0x42')]);_0x2f7432[_0xd9b6('0x22')]=qs[_0xd9b6('0x29')](_['pick'](_0x1d3512[_0xd9b6('0x23')],_0x143edc['filters']));if(_0x1d3512[_0xd9b6('0x23')][_0xd9b6('0x44')]){_0x2f7432[_0xd9b6('0x22')]=_[_0xd9b6('0x30')](_0x2f7432[_0xd9b6('0x22')],{'$or':_[_0xd9b6('0x45')](_0x2f7432[_0xd9b6('0x2c')],function(_0x2c394d){var _0x116325={};_0x116325[_0x2c394d]={'$like':'%'+_0x1d3512[_0xd9b6('0x23')][_0xd9b6('0x44')]+'%'};return _0x116325;})});}_0x2f7432=_[_0xd9b6('0x30')]({},_0x2f7432,_0x1d3512[_0xd9b6('0x31')]);return _0x2e12cb[_0xd9b6('0x4e')](_0x2f7432);}})[_0xd9b6('0x13')](function(_0x5451b5){if(_0x5451b5){_0x2f1c07=_0x5451b5['length'];if(!_0x1d3512['query'][_0xd9b6('0x3f')](_0xd9b6('0x40'))){_0x2f7432[_0xd9b6('0xd')]=qs[_0xd9b6('0xd')](_0x1d3512[_0xd9b6('0x23')]['limit']);_0x2f7432[_0xd9b6('0x10')]=qs[_0xd9b6('0x10')](_0x1d3512[_0xd9b6('0x23')][_0xd9b6('0x10')]);}return _0x2e12cb['getTeams'](_0x2f7432);}})['then'](function(_0x5a72cb){if(_0x5a72cb){return _0x5a72cb?{'count':_0x2f1c07,'rows':_0x5a72cb}:null;}})['then'](respondWithResult(_0x56a2c9,null))['catch'](handleError(_0x56a2c9,null));};exports['addTeams']=function(_0x179c20,_0x58b343){var _0x21772b=_0x179c20['body'][_0xd9b6('0x4f')];return db[_0xd9b6('0x50')][_0xd9b6('0x24')]({'where':{'id':_0x21772b},'attributes':['id'],'include':[{'model':db[_0xd9b6('0x46')],'as':_0xd9b6('0x51'),'attributes':['id','name',_0xd9b6('0x52'),'voicePause',_0xd9b6('0x53')],'raw':!![]}]})['then'](function(_0x14dba4){if(_0x14dba4){var _0x975ded=_[_0xd9b6('0x54')](_0x14dba4,function(_0x333d27){var _0x36c90a=_0x333d27['get']({'plain':!![]});return _0x36c90a[_0xd9b6('0x51')];});return db[_0xd9b6('0x1d')][_0xd9b6('0x3b')]({'where':{'id':_0x179c20[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](function(_0x1aa46f){return db['sequelize']['transaction'](function(_0x5065e8){return _0x1aa46f[_0xd9b6('0x55')](_0x21772b,{'transaction':_0x5065e8})[_0xd9b6('0x13')](function(){return BPromise[_0xd9b6('0x56')](_0x975ded,function(_0x4bf6b9){return db[_0xd9b6('0x57')]['findOrCreate']({'where':{'UserId':_0x4bf6b9['id'],'ChatQueueId':_0x179c20[_0xd9b6('0x3c')]['id']},'transaction':_0x5065e8});});})[_0xd9b6('0x13')](function(){_0x975ded[_0xd9b6('0x58')](function(_0x592488){socket[_0xd9b6('0x59')](_0xd9b6('0x5a'),{'UserId':_0x592488['id'],'ChatQueueId':_0x1aa46f['id']});});});});});}})[_0xd9b6('0x13')](respondWithStatusCode(_0x58b343,null))['catch'](handleError(_0x58b343,null));};exports[_0xd9b6('0x5b')]=function(_0x2b35fa,_0x51de09){return db[_0xd9b6('0x50')][_0xd9b6('0x24')]({'where':{'id':_0x2b35fa[_0xd9b6('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd9b6('0x46')],'as':_0xd9b6('0x51'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51de09,null))[_0xd9b6('0x13')](function(_0x3938ca){var _0x4a3661=_[_0xd9b6('0x45')](_0x3938ca,'id');var _0x38cbbe=[];var _0x471add=[];var _0x5e417a=squel[_0xd9b6('0x5c')]();_0x5e417a[_0xd9b6('0x5d')](_0xd9b6('0x5e'))[_0xd9b6('0x5f')](_0xd9b6('0x60'),'tq')[_0xd9b6('0x61')](_0xd9b6('0x62'),'ut',_0xd9b6('0x63'))[_0xd9b6('0x22')](_0xd9b6('0x64'),_0x2b35fa[_0xd9b6('0x3c')]['id']);for(var _0x2e602a=0x0;_0x2e602a<_0x3938ca[_0xd9b6('0x2e')];_0x2e602a+=0x1){let _0x70634b=_0x3938ca[_0x2e602a];for(var _0x2d0c37=0x0;_0x2d0c37<_0x70634b[_0xd9b6('0x51')]['length'];_0x2d0c37+=0x1){let _0x2ebec0=_0x70634b[_0xd9b6('0x51')][_0x2d0c37];var _0x18102d=_0x5e417a[_0xd9b6('0x65')]();_0x18102d['where'](_0xd9b6('0x66'),_0x2ebec0['id']);_0x471add[_0xd9b6('0x67')](db[_0xd9b6('0x68')][_0xd9b6('0x23')](_0x18102d['toString'](),{'type':db[_0xd9b6('0x68')][_0xd9b6('0x69')][_0xd9b6('0x6a')]})[_0xd9b6('0x13')](function(_0x47479a){if(_0x47479a[_0xd9b6('0x2e')]===0x1){return _0x2ebec0['id'];}else{var _0x4efc90=_[_0xd9b6('0x6b')](_[_0xd9b6('0x45')](_0x47479a,_0xd9b6('0x6c')),function(_0x2e81a4){return _[_0xd9b6('0x6d')](_0x4a3661,_0x2e81a4);});if(_0x4efc90){return _0x2ebec0['id'];}}}));}}return BPromise[_0xd9b6('0x6e')](_0x471add)[_0xd9b6('0x13')](function(_0x3c1022){_0x38cbbe=_(_0x38cbbe)[_0xd9b6('0x6f')](_0x3c1022)[_0xd9b6('0x70')]()[_0xd9b6('0x71')]();return db[_0xd9b6('0x1d')][_0xd9b6('0x3b')]({'where':{'id':_0x2b35fa[_0xd9b6('0x3c')]['id']}})[_0xd9b6('0x13')](function(_0x19e81f){return db['sequelize'][_0xd9b6('0x72')](function(_0x1459c0){return _0x19e81f[_0xd9b6('0x5b')](_0x2b35fa[_0xd9b6('0x23')][_0xd9b6('0x4f')],{'transaction':_0x1459c0})[_0xd9b6('0x13')](function(){if(!_['isEmpty'](_0x38cbbe)){return _0x19e81f[_0xd9b6('0x73')](_0x38cbbe,{'transaction':_0x1459c0});}})[_0xd9b6('0x13')](function(){_0x38cbbe['forEach'](function(_0x1aa3b8){socket[_0xd9b6('0x59')](_0xd9b6('0x74'),{'UserId':_0x1aa3b8,'ChatQueueId':_0x19e81f['id']});});});});});});})[_0xd9b6('0x13')](respondWithStatusCode(_0x51de09,null))['catch'](handleError(_0x51de09,null));};exports[_0xd9b6('0x75')]=function(_0x4942f2,_0x3ec5b8){return db[_0xd9b6('0x1d')]['find']({'where':{'id':_0x4942f2['params']['id']}})['then'](handleEntityNotFound(_0x3ec5b8,null))['then'](function(_0x5b1d0a){if(_0x5b1d0a){return _0x5b1d0a[_0xd9b6('0x75')](_0x4942f2[_0xd9b6('0x3a')][_0xd9b6('0x4f')],_[_0xd9b6('0x76')](_0x4942f2[_0xd9b6('0x3a')],['ids','id'])||{})[_0xd9b6('0x77')](function(_0x559b79){for(var _0xf73727=0x0;_0xf73727<_0x4942f2[_0xd9b6('0x3a')]['ids'][_0xd9b6('0x2e')];_0xf73727+=0x1){socket[_0xd9b6('0x59')](_0xd9b6('0x5a'),{'UserId':Number(_0x4942f2[_0xd9b6('0x3a')][_0xd9b6('0x4f')][_0xf73727]),'ChatQueueId':Number(_0x4942f2['params']['id'])});}return _0x559b79;});}})[_0xd9b6('0x13')](respondWithResult(_0x3ec5b8,null))[_0xd9b6('0x26')](handleError(_0x3ec5b8,null));};exports[_0xd9b6('0x73')]=function(_0x3a71eb,_0xef94f7){return db['ChatQueue'][_0xd9b6('0x3b')]({'where':{'id':_0x3a71eb[_0xd9b6('0x3c')]['id']}})['then'](handleEntityNotFound(_0xef94f7,null))[_0xd9b6('0x13')](function(_0xf55393){if(_0xf55393){return _0xf55393['removeAgents'](_0x3a71eb['query'][_0xd9b6('0x4f')])[_0xd9b6('0x13')](function(){if(_[_0xd9b6('0x78')](_0x3a71eb[_0xd9b6('0x23')][_0xd9b6('0x4f')])){for(var _0x1c1c36=0x0;_0x1c1c36<_0x3a71eb[_0xd9b6('0x23')][_0xd9b6('0x4f')][_0xd9b6('0x2e')];_0x1c1c36+=0x1){socket[_0xd9b6('0x59')](_0xd9b6('0x74'),{'UserId':Number(_0x3a71eb[_0xd9b6('0x23')][_0xd9b6('0x4f')][_0x1c1c36]),'ChatQueueId':Number(_0x3a71eb[_0xd9b6('0x3c')]['id'])});}}else{socket['emit'](_0xd9b6('0x74'),{'UserId':Number(_0x3a71eb[_0xd9b6('0x23')]['ids']),'ChatQueueId':Number(_0x3a71eb[_0xd9b6('0x3c')]['id'])});}});}})[_0xd9b6('0x13')](respondWithStatusCode(_0xef94f7,null))[_0xd9b6('0x26')](handleError(_0xef94f7,null));};exports[_0xd9b6('0x79')]=function(_0xf318dd,_0xf39ff){var _0x7e206b={};var _0x3fee08={};var _0x54c35f;var _0x4658d5;return db[_0xd9b6('0x1d')][_0xd9b6('0x3e')]({'where':{'id':_0xf318dd['params']['id']}})[_0xd9b6('0x13')](handleEntityNotFound(_0xf39ff,null))[_0xd9b6('0x13')](function(_0x6b739f){if(_0x6b739f){_0x54c35f=_0x6b739f;_0x3fee08[_0xd9b6('0x2b')]=_[_0xd9b6('0x28')](db[_0xd9b6('0x46')][_0xd9b6('0x1e')]);_0x3fee08[_0xd9b6('0x23')]=_[_0xd9b6('0x28')](_0xf318dd[_0xd9b6('0x23')]);_0x3fee08['filters']=_[_0xd9b6('0x2a')](_0x3fee08[_0xd9b6('0x2b')],_0x3fee08[_0xd9b6('0x23')]);_0x7e206b[_0xd9b6('0x2c')]=_['intersection'](_0x3fee08['model'],qs[_0xd9b6('0x2d')](_0xf318dd[_0xd9b6('0x23')][_0xd9b6('0x2d')]));_0x7e206b['attributes']=_0x7e206b['attributes']['length']?_0x7e206b['attributes']:_0x3fee08[_0xd9b6('0x2b')];_0x7e206b[_0xd9b6('0x41')]=qs[_0xd9b6('0x42')](_0xf318dd['query'][_0xd9b6('0x42')]);_0x7e206b[_0xd9b6('0x22')]=qs[_0xd9b6('0x29')](_[_0xd9b6('0x43')](_0xf318dd['query'],_0x3fee08['filters']));if(_0xf318dd[_0xd9b6('0x23')][_0xd9b6('0x44')]){_0x7e206b['where']=_[_0xd9b6('0x30')](_0x7e206b[_0xd9b6('0x22')],{'$or':_[_0xd9b6('0x45')](_0x7e206b[_0xd9b6('0x2c')],function(_0x11eea4){var _0xe8aa3={};_0xe8aa3[_0x11eea4]={'$like':'%'+_0xf318dd['query'][_0xd9b6('0x44')]+'%'};return _0xe8aa3;})});}_0x7e206b=_[_0xd9b6('0x30')]({},_0x7e206b,_0xf318dd[_0xd9b6('0x31')]);return _0x54c35f[_0xd9b6('0x79')](_0x7e206b);}})['then'](function(_0x338a5c){if(_0x338a5c){_0x4658d5=_0x338a5c[_0xd9b6('0x2e')];if(!_0xf318dd[_0xd9b6('0x23')][_0xd9b6('0x3f')](_0xd9b6('0x40'))){_0x7e206b[_0xd9b6('0xd')]=qs['limit'](_0xf318dd['query']['limit']);_0x7e206b[_0xd9b6('0x10')]=qs[_0xd9b6('0x10')](_0xf318dd[_0xd9b6('0x23')][_0xd9b6('0x10')]);}return _0x54c35f[_0xd9b6('0x79')](_0x7e206b);}})[_0xd9b6('0x13')](function(_0x21ce2a){if(_0x21ce2a){return _0x21ce2a?{'count':_0x4658d5,'rows':_0x21ce2a}:null;}})[_0xd9b6('0x13')](respondWithResult(_0xf39ff,null))[_0xd9b6('0x26')](handleError(_0xf39ff,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c07d08e..dc39f60 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 _0x4566=['hook','exports','events','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4566,0x80));var _0x6456=function(_0x30bf06,_0x5a6c0b){_0x30bf06=_0x30bf06-0x0;var _0x11f9e2=_0x4566[_0x30bf06];return _0x11f9e2;};'use strict';var EventEmitter=require(_0x6456('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6456('0x1')](0x0);var events={'afterCreate':_0x6456('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3dc644){return function(_0x5b9137,_0x1cec40,_0x28a80c){ChatQueueEvents[_0x6456('0x3')](_0x3dc644+':'+_0x5b9137['id'],_0x5b9137);ChatQueueEvents[_0x6456('0x3')](_0x3dc644,_0x5b9137);_0x28a80c(null);};}for(var e in events){if(events[_0x6456('0x4')](e)){var event=events[e];ChatQueue[_0x6456('0x5')](e,emitEvent(event));}}module[_0x6456('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0xede3=['emit','hasOwnProperty','exports','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x431b5b,_0x5e4051){var _0x5b496d=function(_0x203fc5){while(--_0x203fc5){_0x431b5b['push'](_0x431b5b['shift']());}};_0x5b496d(++_0x5e4051);}(_0xede3,0xf3));var _0x3ede=function(_0xccd377,_0x45c664){_0xccd377=_0xccd377-0x0;var _0x127a4c=_0xede3[_0xccd377];return _0x127a4c;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x3ede('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3ede('0x1')](0x0);var events={'afterCreate':_0x3ede('0x2'),'afterUpdate':_0x3ede('0x3'),'afterDestroy':_0x3ede('0x4')};function emitEvent(_0x4f9d20){return function(_0x1fac6a,_0x36219f,_0x1a08b4){ChatQueueEvents[_0x3ede('0x5')](_0x4f9d20+':'+_0x1fac6a['id'],_0x1fac6a);ChatQueueEvents['emit'](_0x4f9d20,_0x1fac6a);_0x1a08b4(null);};}for(var e in events){if(events[_0x3ede('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x3ede('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 2418f73..c9864b5 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 _0xd92a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x400f6d,_0x488583){var _0x57ee04=function(_0x53c4b8){while(--_0x53c4b8){_0x400f6d['push'](_0x400f6d['shift']());}};_0x57ee04(++_0x488583);}(_0xd92a,0x12b));var _0xad92=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd92a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xad92('0x0'));var util=require(_0xad92('0x1'));var logger=require(_0xad92('0x2'))(_0xad92('0x3'));var moment=require(_0xad92('0x4'));var BPromise=require(_0xad92('0x5'));var rp=require(_0xad92('0x6'));var fs=require('fs');var path=require(_0xad92('0x7'));var rimraf=require(_0xad92('0x8'));var config=require(_0xad92('0x9'));var attributes=require(_0xad92('0xa'));module[_0xad92('0xb')]=function(_0x59172c,_0x2c15e4){return _0x59172c[_0xad92('0xc')](_0xad92('0xd'),attributes,{'tableName':_0xad92('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8041=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x8041,0x132));var _0x1804=function(_0x18f044,_0xc6ce72){_0x18f044=_0x18f044-0x0;var _0x485f00=_0x8041[_0x18f044];return _0x485f00;};'use strict';var _=require(_0x1804('0x0'));var util=require('util');var logger=require(_0x1804('0x1'))(_0x1804('0x2'));var moment=require(_0x1804('0x3'));var BPromise=require(_0x1804('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1804('0x5'));var config=require(_0x1804('0x6'));var attributes=require(_0x1804('0x7'));module[_0x1804('0x8')]=function(_0x2457e4,_0x425a3a){return _0x2457e4[_0x1804('0x9')](_0x1804('0xa'),attributes,{'tableName':_0x1804('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index d943e23..f36daa4 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 _0xe8a1=['result','catch','GetChatQueue','raw','options','where','attributes','include','model','map','then','info','stringify','ShowChatQueue','ChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x4632a9,_0x11306d){var _0x2cfe3f=function(_0x4b0530){while(--_0x4b0530){_0x4632a9['push'](_0x4632a9['shift']());}};_0x2cfe3f(++_0x11306d);}(_0xe8a1,0x1d8));var _0x1e8a=function(_0x44223c,_0x43a1e4){_0x44223c=_0x44223c-0x0;var _0x2314ce=_0xe8a1[_0x44223c];return _0x2314ce;};'use strict';var _=require(_0x1e8a('0x0'));var util=require(_0x1e8a('0x1'));var moment=require(_0x1e8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e8a('0x3'));var fs=require('fs');var Redis=require(_0x1e8a('0x4'));var db=require(_0x1e8a('0x5'))['db'];var utils=require(_0x1e8a('0x6'));var logger=require(_0x1e8a('0x7'))(_0x1e8a('0x8'));var config=require(_0x1e8a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e8a('0xa')]({'port':0x232a});config[_0x1e8a('0xb')]=_[_0x1e8a('0xc')](config[_0x1e8a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e8a('0xb')]));require('./chatQueue.socket')[_0x1e8a('0xd')](socket);function respondWithRpcPromise(_0x271b82,_0x4ac6b6,_0x5793af){return new BPromise(function(_0x439024,_0x170fc4){return client[_0x1e8a('0xe')](_0x271b82,_0x5793af)['then'](function(_0xaf3fee){logger['info'](_0x1e8a('0xf'),_0x4ac6b6,_0x1e8a('0x10'));logger[_0x1e8a('0x11')](_0x1e8a('0x12'),_0x4ac6b6,'request\x20sent',JSON['stringify'](_0xaf3fee));if(_0xaf3fee['error']){if(_0xaf3fee['error'][_0x1e8a('0x13')]===0x1f4){logger[_0x1e8a('0x14')](_0x1e8a('0xf'),_0x4ac6b6,_0xaf3fee['error']['message']);return _0x170fc4(_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);}logger['error'](_0x1e8a('0xf'),_0x4ac6b6,_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);return _0x439024(_0xaf3fee[_0x1e8a('0x14')][_0x1e8a('0x15')]);}else{logger['info'](_0x1e8a('0xf'),_0x4ac6b6,'request\x20sent');_0x439024(_0xaf3fee[_0x1e8a('0x16')]['message']);}})[_0x1e8a('0x17')](function(_0x4d0e63){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4ac6b6,_0x4d0e63);_0x170fc4(_0x4d0e63);});});}exports[_0x1e8a('0x18')]=function(_0x2a9e0e){var _0x1e7d2e=this;return new Promise(function(_0x482b9b,_0xc9c032){return db['ChatQueue']['findAll']({'raw':_0x2a9e0e['options']?_0x2a9e0e['options'][_0x1e8a('0x19')]===undefined?!![]:![]:!![],'where':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e['options'][_0x1e8a('0x1b')]||null:null,'attributes':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e[_0x1e8a('0x1a')][_0x1e8a('0x1c')]||null:null,'limit':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e[_0x1e8a('0x1a')]['limit']||null:null,'include':_0x2a9e0e[_0x1e8a('0x1a')]?_0x2a9e0e['options'][_0x1e8a('0x1d')]?_['map'](_0x2a9e0e['options']['include'],function(_0xd4a087){return{'model':db[_0xd4a087[_0x1e8a('0x1e')]],'as':_0xd4a087['as'],'attributes':_0xd4a087[_0x1e8a('0x1c')],'include':_0xd4a087[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0xd4a087[_0x1e8a('0x1d')],function(_0x2b0197){return{'model':db[_0x2b0197[_0x1e8a('0x1e')]],'as':_0x2b0197['as'],'attributes':_0x2b0197[_0x1e8a('0x1c')],'include':_0x2b0197[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0x2b0197[_0x1e8a('0x1d')],function(_0x5eea6c){return{'model':db[_0x5eea6c[_0x1e8a('0x1e')]],'as':_0x5eea6c['as'],'attributes':_0x5eea6c[_0x1e8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e8a('0x20')](function(_0x1d2d48){logger[_0x1e8a('0x21')](_0x1e8a('0x18'),_0x2a9e0e);logger['debug'](_0x1e8a('0x18'),_0x2a9e0e,JSON[_0x1e8a('0x22')](_0x1d2d48));_0x482b9b(_0x1d2d48);})[_0x1e8a('0x17')](function(_0x33d056){logger[_0x1e8a('0x14')](_0x1e8a('0x18'),_0x33d056[_0x1e8a('0x15')],_0x2a9e0e);_0xc9c032(_0x1e7d2e[_0x1e8a('0x14')](0x1f4,_0x33d056[_0x1e8a('0x15')]));});});};exports[_0x1e8a('0x23')]=function(_0xccb74f){var _0x264d8f=this;return new Promise(function(_0x52d2fe,_0x2ee088){return db[_0x1e8a('0x24')][_0x1e8a('0x25')]({'raw':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x19')]===undefined?!![]:![]:!![],'where':_0xccb74f['options']?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1b')]||null:null,'attributes':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')]['attributes']||null:null,'include':_0xccb74f[_0x1e8a('0x1a')]?_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0xccb74f[_0x1e8a('0x1a')][_0x1e8a('0x1d')],function(_0x151a62){return{'model':db[_0x151a62['model']],'as':_0x151a62['as'],'attributes':_0x151a62[_0x1e8a('0x1c')],'include':_0x151a62['include']?_['map'](_0x151a62['include'],function(_0x574796){return{'model':db[_0x574796[_0x1e8a('0x1e')]],'as':_0x574796['as'],'attributes':_0x574796['attributes'],'include':_0x574796[_0x1e8a('0x1d')]?_[_0x1e8a('0x1f')](_0x574796[_0x1e8a('0x1d')],function(_0x4b2737){return{'model':db[_0x4b2737['model']],'as':_0x4b2737['as'],'attributes':_0x4b2737[_0x1e8a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1e8a('0x20')](function(_0x57edb1){logger[_0x1e8a('0x21')](_0x1e8a('0x23'),_0xccb74f);logger['debug'](_0x1e8a('0x23'),_0xccb74f,JSON[_0x1e8a('0x22')](_0x57edb1));_0x52d2fe(_0x57edb1);})[_0x1e8a('0x17')](function(_0x519628){logger['error'](_0x1e8a('0x23'),_0x519628['message'],_0xccb74f);_0x2ee088(_0x264d8f[_0x1e8a('0x14')](0x1f4,_0x519628[_0x1e8a('0x15')]));});});}; \ No newline at end of file +var _0x1a83=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','then','debug','stringify','ShowChatQueue','find','catch','lodash','util','moment'];(function(_0x21fd26,_0x5356d5){var _0x3142e2=function(_0x18c2a1){while(--_0x18c2a1){_0x21fd26['push'](_0x21fd26['shift']());}};_0x3142e2(++_0x5356d5);}(_0x1a83,0x1c0));var _0x31a8=function(_0x401e69,_0x2e9e44){_0x401e69=_0x401e69-0x0;var _0x32f999=_0x1a83[_0x401e69];return _0x32f999;};'use strict';var _=require(_0x31a8('0x0'));var util=require(_0x31a8('0x1'));var moment=require(_0x31a8('0x2'));var BPromise=require('bluebird');var rs=require(_0x31a8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31a8('0x4'))['db'];var utils=require(_0x31a8('0x5'));var logger=require(_0x31a8('0x6'))(_0x31a8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x31a8('0x8')][_0x31a8('0x9')]({'port':0x232a});config[_0x31a8('0xa')]=_[_0x31a8('0xb')](config[_0x31a8('0xa')],{'host':_0x31a8('0xc'),'port':0x18eb});var socket=require(_0x31a8('0xd'))(new Redis(config[_0x31a8('0xa')]));require(_0x31a8('0xe'))[_0x31a8('0xf')](socket);function respondWithRpcPromise(_0x4f1881,_0x310a3c,_0x486ab0){return new BPromise(function(_0x4a1446,_0x3b0e78){return client[_0x31a8('0x10')](_0x4f1881,_0x486ab0)['then'](function(_0x2b5927){logger[_0x31a8('0x11')](_0x31a8('0x12'),_0x310a3c,_0x31a8('0x13'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x310a3c,_0x31a8('0x13'),JSON['stringify'](_0x2b5927));if(_0x2b5927[_0x31a8('0x14')]){if(_0x2b5927['error'][_0x31a8('0x15')]===0x1f4){logger[_0x31a8('0x14')](_0x31a8('0x12'),_0x310a3c,_0x2b5927['error'][_0x31a8('0x16')]);return _0x3b0e78(_0x2b5927[_0x31a8('0x14')]['message']);}logger[_0x31a8('0x14')]('ChatQueue,\x20%s,\x20%s',_0x310a3c,_0x2b5927[_0x31a8('0x14')][_0x31a8('0x16')]);return _0x4a1446(_0x2b5927['error'][_0x31a8('0x16')]);}else{logger[_0x31a8('0x11')](_0x31a8('0x12'),_0x310a3c,_0x31a8('0x13'));_0x4a1446(_0x2b5927[_0x31a8('0x17')][_0x31a8('0x16')]);}})['catch'](function(_0x44b4f2){logger[_0x31a8('0x14')]('ChatQueue,\x20%s,\x20%s',_0x310a3c,_0x44b4f2);_0x3b0e78(_0x44b4f2);});});}exports[_0x31a8('0x18')]=function(_0x35475a){var _0x44a515=this;return new Promise(function(_0x228e79,_0x552af8){return db[_0x31a8('0x19')][_0x31a8('0x1a')]({'raw':_0x35475a[_0x31a8('0x1b')]?_0x35475a[_0x31a8('0x1b')][_0x31a8('0x1c')]===undefined?!![]:![]:!![],'where':_0x35475a[_0x31a8('0x1b')]?_0x35475a[_0x31a8('0x1b')][_0x31a8('0x1d')]||null:null,'attributes':_0x35475a[_0x31a8('0x1b')]?_0x35475a['options']['attributes']||null:null,'limit':_0x35475a[_0x31a8('0x1b')]?_0x35475a['options'][_0x31a8('0x1e')]||null:null,'include':_0x35475a[_0x31a8('0x1b')]?_0x35475a[_0x31a8('0x1b')]['include']?_[_0x31a8('0x1f')](_0x35475a[_0x31a8('0x1b')][_0x31a8('0x20')],function(_0x36a7b1){return{'model':db[_0x36a7b1[_0x31a8('0x21')]],'as':_0x36a7b1['as'],'attributes':_0x36a7b1[_0x31a8('0x22')],'include':_0x36a7b1[_0x31a8('0x20')]?_['map'](_0x36a7b1[_0x31a8('0x20')],function(_0x4a1e58){return{'model':db[_0x4a1e58[_0x31a8('0x21')]],'as':_0x4a1e58['as'],'attributes':_0x4a1e58[_0x31a8('0x22')],'include':_0x4a1e58[_0x31a8('0x20')]?_[_0x31a8('0x1f')](_0x4a1e58['include'],function(_0x510641){return{'model':db[_0x510641['model']],'as':_0x510641['as'],'attributes':_0x510641['attributes']};}):[]};}):[]};}):[]:[]})[_0x31a8('0x23')](function(_0x2e5165){logger[_0x31a8('0x11')](_0x31a8('0x18'),_0x35475a);logger[_0x31a8('0x24')]('GetChatQueue',_0x35475a,JSON[_0x31a8('0x25')](_0x2e5165));_0x228e79(_0x2e5165);})['catch'](function(_0x5aa4a4){logger[_0x31a8('0x14')](_0x31a8('0x18'),_0x5aa4a4[_0x31a8('0x16')],_0x35475a);_0x552af8(_0x44a515[_0x31a8('0x14')](0x1f4,_0x5aa4a4[_0x31a8('0x16')]));});});};exports[_0x31a8('0x26')]=function(_0x362ff1){var _0x32aafb=this;return new Promise(function(_0x5652ac,_0x4074c1){return db['ChatQueue'][_0x31a8('0x27')]({'raw':_0x362ff1[_0x31a8('0x1b')]?_0x362ff1['options']['raw']===undefined?!![]:![]:!![],'where':_0x362ff1[_0x31a8('0x1b')]?_0x362ff1[_0x31a8('0x1b')][_0x31a8('0x1d')]||null:null,'attributes':_0x362ff1[_0x31a8('0x1b')]?_0x362ff1['options'][_0x31a8('0x22')]||null:null,'include':_0x362ff1[_0x31a8('0x1b')]?_0x362ff1['options']['include']?_[_0x31a8('0x1f')](_0x362ff1[_0x31a8('0x1b')]['include'],function(_0x595f42){return{'model':db[_0x595f42[_0x31a8('0x21')]],'as':_0x595f42['as'],'attributes':_0x595f42[_0x31a8('0x22')],'include':_0x595f42['include']?_[_0x31a8('0x1f')](_0x595f42[_0x31a8('0x20')],function(_0x2e213a){return{'model':db[_0x2e213a['model']],'as':_0x2e213a['as'],'attributes':_0x2e213a['attributes'],'include':_0x2e213a[_0x31a8('0x20')]?_[_0x31a8('0x1f')](_0x2e213a[_0x31a8('0x20')],function(_0x53815b){return{'model':db[_0x53815b['model']],'as':_0x53815b['as'],'attributes':_0x53815b[_0x31a8('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a93a1){logger['info']('ShowChatQueue',_0x362ff1);logger[_0x31a8('0x24')](_0x31a8('0x26'),_0x362ff1,JSON[_0x31a8('0x25')](_0x1a93a1));_0x5652ac(_0x1a93a1);})[_0x31a8('0x28')](function(_0x4f611d){logger['error'](_0x31a8('0x26'),_0x4f611d['message'],_0x362ff1);_0x4074c1(_0x32aafb[_0x31a8('0x14')](0x1f4,_0x4f611d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index dee3df4..44ec72b 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 _0xac31=['remove','update','length','chatQueue:','./chatQueue.events','save'];(function(_0x4f4757,_0x44241a){var _0x549c37=function(_0x3c3cfb){while(--_0x3c3cfb){_0x4f4757['push'](_0x4f4757['shift']());}};_0x549c37(++_0x44241a);}(_0xac31,0xca));var _0x1ac3=function(_0x2b4863,_0x5811ee){_0x2b4863=_0x2b4863-0x0;var _0x3733f1=_0xac31[_0x2b4863];return _0x3733f1;};'use strict';var ChatQueueEvents=require(_0x1ac3('0x0'));var events=[_0x1ac3('0x1'),_0x1ac3('0x2'),_0x1ac3('0x3')];function createListener(_0xd6934,_0x11dd6d){return function(_0x95548d){_0x11dd6d['emit'](_0xd6934,_0x95548d);};}function removeListener(_0x33b5ab,_0x434b5e){return function(){ChatQueueEvents['removeListener'](_0x33b5ab,_0x434b5e);};}exports['register']=function(_0xbe22b7){for(var _0x20027f=0x0,_0x2bf9b1=events[_0x1ac3('0x4')];_0x20027f<_0x2bf9b1;_0x20027f++){var _0x157604=events[_0x20027f];var _0x57893c=createListener(_0x1ac3('0x5')+_0x157604,_0xbe22b7);ChatQueueEvents['on'](_0x157604,_0x57893c);}}; \ No newline at end of file +var _0x34e5=['update','emit','removeListener','register','length','chatQueue:','save'];(function(_0xf256c3,_0x4d6a47){var _0x502a42=function(_0xfde84b){while(--_0xfde84b){_0xf256c3['push'](_0xf256c3['shift']());}};_0x502a42(++_0x4d6a47);}(_0x34e5,0x172));var _0x534e=function(_0x23e626,_0x354852){_0x23e626=_0x23e626-0x0;var _0x52755e=_0x34e5[_0x23e626];return _0x52755e;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x534e('0x0'),'remove',_0x534e('0x1')];function createListener(_0x467e3e,_0x425ae8){return function(_0x246650){_0x425ae8[_0x534e('0x2')](_0x467e3e,_0x246650);};}function removeListener(_0x50b790,_0x11a158){return function(){ChatQueueEvents[_0x534e('0x3')](_0x50b790,_0x11a158);};}exports[_0x534e('0x4')]=function(_0x117f0c){for(var _0x436a92=0x0,_0x2d0370=events[_0x534e('0x5')];_0x436a92<_0x2d0370;_0x436a92++){var _0x5620d4=events[_0x436a92];var _0x24d562=createListener(_0x534e('0x6')+_0x5620d4,_0x117f0c);ChatQueueEvents['on'](_0x5620d4,_0x24d562);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 3a2e5ec..ef75b81 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x44d42a,_0xe76ad8){var _0x172b8f=function(_0x4560b1){while(--_0x4560b1){_0x44d42a['push'](_0x44d42a['shift']());}};_0x172b8f(++_0xe76ad8);}(_0x814b,0x1a2));var _0xb814=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x814b[_0xc87d08];return _0x30a714;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 3cc4641..c3f9f03 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 _0x45a8=['sequelize','exports','STRING','DATE','moment'];(function(_0x182700,_0x87ffd5){var _0x1bb3b2=function(_0x1296ee){while(--_0x1296ee){_0x182700['push'](_0x182700['shift']());}};_0x1bb3b2(++_0x87ffd5);}(_0x45a8,0x112));var _0x845a=function(_0x11d10f,_0x275d65){_0x11d10f=_0x11d10f-0x0;var _0x4f3a86=_0x45a8[_0x11d10f];return _0x4f3a86;};'use strict';var moment=require(_0x845a('0x0'));var Sequelize=require(_0x845a('0x1'));module[_0x845a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x845a('0x3')]},'joinAt':{'type':Sequelize[_0x845a('0x4')]},'leaveAt':{'type':Sequelize[_0x845a('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x845a('0x4')]},'reason':{'type':Sequelize[_0x845a('0x3')]}}; \ No newline at end of file +var _0xfcbe=['DATE','sequelize','exports','STRING'];(function(_0xca06e,_0x25a203){var _0x32bb7e=function(_0x9362f6){while(--_0x9362f6){_0xca06e['push'](_0xca06e['shift']());}};_0x32bb7e(++_0x25a203);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x39a8de,_0xe44c5f){_0x39a8de=_0x39a8de-0x0;var _0x422c2c=_0xfcbe[_0x39a8de];return _0x422c2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xefcb('0x0'));module[_0xefcb('0x1')]={'uniqueid':{'type':Sequelize[_0xefcb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xefcb('0x2')]},'joinAt':{'type':Sequelize[_0xefcb('0x3')]},'leaveAt':{'type':Sequelize[_0xefcb('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xefcb('0x3')]},'reason':{'type':Sequelize[_0xefcb('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5f4a680..9835b36 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 _0xcac3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir'];(function(_0x14d956,_0x569303){var _0xc46c95=function(_0x37468b){while(--_0x37468b){_0x14d956['push'](_0x14d956['shift']());}};_0xc46c95(++_0x569303);}(_0xcac3,0x193));var _0x3cac=function(_0x4c03ea,_0x3465be){_0x4c03ea=_0x4c03ea-0x0;var _0x7a6922=_0xcac3[_0x4c03ea];return _0x7a6922;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3cac('0x0'));var zipdir=require(_0x3cac('0x1'));var jsonpatch=require(_0x3cac('0x2'));var rp=require(_0x3cac('0x3'));var moment=require(_0x3cac('0x4'));var BPromise=require(_0x3cac('0x5'));var Mustache=require(_0x3cac('0x6'));var util=require(_0x3cac('0x7'));var path=require(_0x3cac('0x8'));var sox=require(_0x3cac('0x9'));var csv=require(_0x3cac('0xa'));var ejs=require(_0x3cac('0xb'));var fs=require('fs');var fs_extra=require(_0x3cac('0xc'));var _=require(_0x3cac('0xd'));var squel=require(_0x3cac('0xe'));var crypto=require(_0x3cac('0xf'));var jsforce=require(_0x3cac('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3cac('0xa'));var querystring=require(_0x3cac('0x11'));var Papa=require(_0x3cac('0x12'));var Redis=require(_0x3cac('0x13'));var authService=require(_0x3cac('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3cac('0x15'));var hardwareService=require(_0x3cac('0x16'));var logger=require(_0x3cac('0x17'))(_0x3cac('0x18'));var utils=require(_0x3cac('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cac('0x1a'))['db'];function respondWithStatusCode(_0xfc7684,_0x2d3ca6){_0x2d3ca6=_0x2d3ca6||0xcc;return function(_0x134b95){if(_0x134b95){return _0xfc7684[_0x3cac('0x1b')](_0x2d3ca6);}return _0xfc7684[_0x3cac('0x1c')](_0x2d3ca6)[_0x3cac('0x1d')]();};}function respondWithResult(_0x4bee52,_0x37a3b1){_0x37a3b1=_0x37a3b1||0xc8;return function(_0x2db008){if(_0x2db008){return _0x4bee52[_0x3cac('0x1c')](_0x37a3b1)[_0x3cac('0x1e')](_0x2db008);}};}function respondWithFilteredResult(_0x4680aa,_0x8d8927){return function(_0x202437){if(_0x202437){var _0x37e529=typeof _0x8d8927[_0x3cac('0x1f')]===_0x3cac('0x20')&&typeof _0x8d8927[_0x3cac('0x21')]===_0x3cac('0x20');var _0x2c1766=_0x202437[_0x3cac('0x22')];var _0x1b1007=_0x37e529?0x0:_0x8d8927[_0x3cac('0x1f')];var _0x752c5b=_0x37e529?_0x202437[_0x3cac('0x22')]:_0x8d8927[_0x3cac('0x1f')]+_0x8d8927[_0x3cac('0x21')];var _0x1a2e7e;if(_0x752c5b>=_0x2c1766){_0x752c5b=_0x2c1766;_0x1a2e7e=0xc8;}else{_0x1a2e7e=0xce;}_0x4680aa[_0x3cac('0x1c')](_0x1a2e7e);return _0x4680aa['set'](_0x3cac('0x23'),_0x1b1007+'-'+_0x752c5b+'/'+_0x2c1766)[_0x3cac('0x1e')](_0x202437);}return null;};}function patchUpdates(_0x5af4b9){return function(_0x1d5d41){try{jsonpatch[_0x3cac('0x24')](_0x1d5d41,_0x5af4b9,!![]);}catch(_0x40a088){return BPromise[_0x3cac('0x25')](_0x40a088);}return _0x1d5d41[_0x3cac('0x26')]();};}function saveUpdates(_0x147d3b,_0x530057){return function(_0x19010f){if(_0x19010f){return _0x19010f['update'](_0x147d3b)['then'](function(_0x5a78ed){return _0x5a78ed;});}return null;};}function removeEntity(_0xf63f1d,_0x842c3d){return function(_0x2fe8a9){if(_0x2fe8a9){return _0x2fe8a9[_0x3cac('0x27')]()[_0x3cac('0x28')](function(){_0xf63f1d[_0x3cac('0x1c')](0xcc)[_0x3cac('0x1d')]();});}};}function handleEntityNotFound(_0x3f79b6,_0x303d05){return function(_0x456883){if(!_0x456883){_0x3f79b6[_0x3cac('0x1b')](0x194);}return _0x456883;};}function handleError(_0x407e8b,_0x5c60df){_0x5c60df=_0x5c60df||0x1f4;return function(_0x24c4fb){logger[_0x3cac('0x29')](_0x24c4fb[_0x3cac('0x2a')]);if(_0x24c4fb[_0x3cac('0x2b')]){delete _0x24c4fb[_0x3cac('0x2b')];}_0x407e8b[_0x3cac('0x1c')](_0x5c60df)[_0x3cac('0x2c')](_0x24c4fb);};}exports[_0x3cac('0x2d')]=function(_0xbc5721,_0x2d7847){var _0x2b7caf={},_0x391412={},_0x2019c0={'count':0x0,'rows':[]};var _0x29c896=_[_0x3cac('0x2e')](db[_0x3cac('0x2f')][_0x3cac('0x30')],function(_0xa08a6){return{'name':_0xa08a6[_0x3cac('0x31')],'type':_0xa08a6[_0x3cac('0x32')][_0x3cac('0x33')]};});_0x391412[_0x3cac('0x34')]=_[_0x3cac('0x2e')](_0x29c896,'name');_0x391412[_0x3cac('0x35')]=_[_0x3cac('0x36')](_0xbc5721[_0x3cac('0x35')]);_0x391412[_0x3cac('0x37')]=_[_0x3cac('0x38')](_0x391412['model'],_0x391412['query']);_0x2b7caf[_0x3cac('0x39')]=_[_0x3cac('0x38')](_0x391412['model'],qs[_0x3cac('0x3a')](_0xbc5721['query']['fields']));_0x2b7caf[_0x3cac('0x39')]=_0x2b7caf[_0x3cac('0x39')]['length']?_0x2b7caf[_0x3cac('0x39')]:_0x391412[_0x3cac('0x34')];if(!_0xbc5721[_0x3cac('0x35')][_0x3cac('0x3b')](_0x3cac('0x3c'))){_0x2b7caf[_0x3cac('0x21')]=qs[_0x3cac('0x21')](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x21')]);_0x2b7caf['offset']=qs['offset'](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x1f')]);}_0x2b7caf[_0x3cac('0x3d')]=qs[_0x3cac('0x3e')](_0xbc5721[_0x3cac('0x35')][_0x3cac('0x3e')]);_0x2b7caf[_0x3cac('0x3f')]=qs[_0x3cac('0x37')](_['pick'](_0xbc5721[_0x3cac('0x35')],_0x391412[_0x3cac('0x37')]),_0x29c896);if(_0xbc5721['query'][_0x3cac('0x40')]){_0x2b7caf[_0x3cac('0x3f')]=_[_0x3cac('0x41')](_0x2b7caf['where'],{'$or':_['map'](_0x29c896,function(_0x22e17b){if(_0x22e17b[_0x3cac('0x32')]!==_0x3cac('0x42')){var _0xc9b8c2={};_0xc9b8c2[_0x22e17b[_0x3cac('0x2b')]]={'$like':'%'+_0xbc5721[_0x3cac('0x35')][_0x3cac('0x40')]+'%'};return _0xc9b8c2;}})});}_0x2b7caf=_[_0x3cac('0x41')]({},_0x2b7caf,_0xbc5721[_0x3cac('0x43')]);var _0x2cb2c0={'where':_0x2b7caf[_0x3cac('0x3f')]};return db[_0x3cac('0x2f')][_0x3cac('0x22')](_0x2cb2c0)['then'](function(_0x25b897){_0x2019c0['count']=_0x25b897;if(_0xbc5721[_0x3cac('0x35')][_0x3cac('0x44')]){_0x2b7caf[_0x3cac('0x45')]=[{'all':!![]}];}return db[_0x3cac('0x2f')][_0x3cac('0x46')](_0x2b7caf);})['then'](function(_0x135a22){_0x2019c0[_0x3cac('0x47')]=_0x135a22;return _0x2019c0;})[_0x3cac('0x28')](respondWithFilteredResult(_0x2d7847,_0x2b7caf))[_0x3cac('0x48')](handleError(_0x2d7847,null));};exports[_0x3cac('0x49')]=function(_0x455487,_0x1f46ce){var _0x25f972={'raw':!![],'where':{'id':_0x455487[_0x3cac('0x4a')]['id']}},_0x1fb9be={};_0x1fb9be[_0x3cac('0x34')]=_[_0x3cac('0x36')](db['ChatQueueReport']['rawAttributes']);_0x1fb9be[_0x3cac('0x35')]=_[_0x3cac('0x36')](_0x455487['query']);_0x1fb9be[_0x3cac('0x37')]=_[_0x3cac('0x38')](_0x1fb9be['model'],_0x1fb9be[_0x3cac('0x35')]);_0x25f972[_0x3cac('0x39')]=_[_0x3cac('0x38')](_0x1fb9be[_0x3cac('0x34')],qs[_0x3cac('0x3a')](_0x455487[_0x3cac('0x35')][_0x3cac('0x3a')]));_0x25f972[_0x3cac('0x39')]=_0x25f972['attributes'][_0x3cac('0x4b')]?_0x25f972['attributes']:_0x1fb9be['model'];if(_0x455487[_0x3cac('0x35')][_0x3cac('0x44')]){_0x25f972['include']=[{'all':!![]}];}_0x25f972=_[_0x3cac('0x41')]({},_0x25f972,_0x455487[_0x3cac('0x43')]);return db[_0x3cac('0x2f')][_0x3cac('0x4c')](_0x25f972)[_0x3cac('0x28')](handleEntityNotFound(_0x1f46ce,null))['then'](respondWithResult(_0x1f46ce,null))[_0x3cac('0x48')](handleError(_0x1f46ce,null));};exports[_0x3cac('0x4d')]=function(_0x550a9c,_0x3f26d1){return db[_0x3cac('0x2f')][_0x3cac('0x4d')](_0x550a9c[_0x3cac('0x4e')],{})['then'](respondWithResult(_0x3f26d1,0xc9))[_0x3cac('0x48')](handleError(_0x3f26d1,null));};exports[_0x3cac('0x4f')]=function(_0x1827ba,_0xab4339){if(_0x1827ba[_0x3cac('0x4e')]['id']){delete _0x1827ba['body']['id'];}return db[_0x3cac('0x2f')][_0x3cac('0x4c')]({'where':{'id':_0x1827ba[_0x3cac('0x4a')]['id']}})['then'](handleEntityNotFound(_0xab4339,null))[_0x3cac('0x28')](saveUpdates(_0x1827ba[_0x3cac('0x4e')],null))[_0x3cac('0x28')](respondWithResult(_0xab4339,null))[_0x3cac('0x48')](handleError(_0xab4339,null));};exports['destroy']=function(_0x22b140,_0x39c044){return db['ChatQueueReport'][_0x3cac('0x4c')]({'where':{'id':_0x22b140['params']['id']}})[_0x3cac('0x28')](handleEntityNotFound(_0x39c044,null))[_0x3cac('0x28')](removeEntity(_0x39c044,null))[_0x3cac('0x48')](handleError(_0x39c044,null));};exports['describe']=function(_0x503fca,_0x568c7b){return db[_0x3cac('0x2f')][_0x3cac('0x50')]()['then'](respondWithResult(_0x568c7b,null))[_0x3cac('0x48')](handleError(_0x568c7b,null));}; \ No newline at end of file +var _0xc1db=['show','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','filter','merge','VIRTUAL','options','where','ChatQueueReport','includeAll','findAll','rows'];(function(_0x347498,_0x332242){var _0x334f2b=function(_0x4156d1){while(--_0x4156d1){_0x347498['push'](_0x347498['shift']());}};_0x334f2b(++_0x332242);}(_0xc1db,0x120));var _0xbc1d=function(_0x294333,_0xa6bb22){_0x294333=_0x294333-0x0;var _0x2a47c0=_0xc1db[_0x294333];return _0x2a47c0;};'use strict';var emlformat=require(_0xbc1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc1d('0x1'));var jsonpatch=require(_0xbc1d('0x2'));var rp=require(_0xbc1d('0x3'));var moment=require(_0xbc1d('0x4'));var BPromise=require(_0xbc1d('0x5'));var Mustache=require('mustache');var util=require(_0xbc1d('0x6'));var path=require(_0xbc1d('0x7'));var sox=require(_0xbc1d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc1d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc1d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbc1d('0xb'));var toCsv=require(_0xbc1d('0xc'));var querystring=require('querystring');var Papa=require(_0xbc1d('0xd'));var Redis=require('ioredis');var authService=require(_0xbc1d('0xe'));var qs=require(_0xbc1d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc1d('0x10'));var logger=require(_0xbc1d('0x11'))(_0xbc1d('0x12'));var utils=require(_0xbc1d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbc1d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3801b9,_0x112284){_0x112284=_0x112284||0xcc;return function(_0x50982e){if(_0x50982e){return _0x3801b9[_0xbc1d('0x15')](_0x112284);}return _0x3801b9[_0xbc1d('0x16')](_0x112284)['end']();};}function respondWithResult(_0x373f20,_0x35d81d){_0x35d81d=_0x35d81d||0xc8;return function(_0x58e7f4){if(_0x58e7f4){return _0x373f20[_0xbc1d('0x16')](_0x35d81d)['json'](_0x58e7f4);}};}function respondWithFilteredResult(_0x4142e4,_0x238c0d){return function(_0xfe7015){if(_0xfe7015){var _0xf56647=typeof _0x238c0d[_0xbc1d('0x17')]===_0xbc1d('0x18')&&typeof _0x238c0d['limit']===_0xbc1d('0x18');var _0x57cb2a=_0xfe7015[_0xbc1d('0x19')];var _0x225310=_0xf56647?0x0:_0x238c0d['offset'];var _0x58c56e=_0xf56647?_0xfe7015['count']:_0x238c0d[_0xbc1d('0x17')]+_0x238c0d[_0xbc1d('0x1a')];var _0x44887e;if(_0x58c56e>=_0x57cb2a){_0x58c56e=_0x57cb2a;_0x44887e=0xc8;}else{_0x44887e=0xce;}_0x4142e4[_0xbc1d('0x16')](_0x44887e);return _0x4142e4['set'](_0xbc1d('0x1b'),_0x225310+'-'+_0x58c56e+'/'+_0x57cb2a)[_0xbc1d('0x1c')](_0xfe7015);}return null;};}function patchUpdates(_0x59f362){return function(_0xd5886c){try{jsonpatch['apply'](_0xd5886c,_0x59f362,!![]);}catch(_0x5ab558){return BPromise[_0xbc1d('0x1d')](_0x5ab558);}return _0xd5886c['save']();};}function saveUpdates(_0x25fa75,_0x52c7c9){return function(_0x1b065e){if(_0x1b065e){return _0x1b065e[_0xbc1d('0x1e')](_0x25fa75)['then'](function(_0x1951a1){return _0x1951a1;});}return null;};}function removeEntity(_0x1890c0,_0x3955ab){return function(_0x4a0579){if(_0x4a0579){return _0x4a0579['destroy']()[_0xbc1d('0x1f')](function(){_0x1890c0['status'](0xcc)[_0xbc1d('0x20')]();});}};}function handleEntityNotFound(_0x13ce62,_0x59fd2e){return function(_0x4d959a){if(!_0x4d959a){_0x13ce62[_0xbc1d('0x15')](0x194);}return _0x4d959a;};}function handleError(_0x970e66,_0x5896d1){_0x5896d1=_0x5896d1||0x1f4;return function(_0x7b37c3){logger[_0xbc1d('0x21')](_0x7b37c3[_0xbc1d('0x22')]);if(_0x7b37c3[_0xbc1d('0x23')]){delete _0x7b37c3[_0xbc1d('0x23')];}_0x970e66[_0xbc1d('0x16')](_0x5896d1)[_0xbc1d('0x24')](_0x7b37c3);};}exports['index']=function(_0x363afd,_0x5e97e3){var _0x584fa5={},_0x40d1e2={},_0x420f28={'count':0x0,'rows':[]};var _0x238a4d=_[_0xbc1d('0x25')](db['ChatQueueReport'][_0xbc1d('0x26')],function(_0x292504){return{'name':_0x292504[_0xbc1d('0x27')],'type':_0x292504[_0xbc1d('0x28')][_0xbc1d('0x29')]};});_0x40d1e2[_0xbc1d('0x2a')]=_[_0xbc1d('0x25')](_0x238a4d,_0xbc1d('0x23'));_0x40d1e2[_0xbc1d('0x2b')]=_[_0xbc1d('0x2c')](_0x363afd[_0xbc1d('0x2b')]);_0x40d1e2[_0xbc1d('0x2d')]=_[_0xbc1d('0x2e')](_0x40d1e2['model'],_0x40d1e2[_0xbc1d('0x2b')]);_0x584fa5[_0xbc1d('0x2f')]=_[_0xbc1d('0x2e')](_0x40d1e2[_0xbc1d('0x2a')],qs[_0xbc1d('0x30')](_0x363afd[_0xbc1d('0x2b')]['fields']));_0x584fa5[_0xbc1d('0x2f')]=_0x584fa5[_0xbc1d('0x2f')][_0xbc1d('0x31')]?_0x584fa5['attributes']:_0x40d1e2[_0xbc1d('0x2a')];if(!_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x32')]('nolimit')){_0x584fa5[_0xbc1d('0x1a')]=qs[_0xbc1d('0x1a')](_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x1a')]);_0x584fa5['offset']=qs['offset'](_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x17')]);}_0x584fa5[_0xbc1d('0x33')]=qs['sort'](_0x363afd['query']['sort']);_0x584fa5['where']=qs[_0xbc1d('0x2d')](_[_0xbc1d('0x34')](_0x363afd[_0xbc1d('0x2b')],_0x40d1e2[_0xbc1d('0x2d')]),_0x238a4d);if(_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x35')]){_0x584fa5['where']=_[_0xbc1d('0x36')](_0x584fa5['where'],{'$or':_[_0xbc1d('0x25')](_0x238a4d,function(_0x560a7c){if(_0x560a7c[_0xbc1d('0x28')]!==_0xbc1d('0x37')){var _0xddc19b={};_0xddc19b[_0x560a7c['name']]={'$like':'%'+_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x35')]+'%'};return _0xddc19b;}})});}_0x584fa5=_[_0xbc1d('0x36')]({},_0x584fa5,_0x363afd[_0xbc1d('0x38')]);var _0x512a88={'where':_0x584fa5[_0xbc1d('0x39')]};return db[_0xbc1d('0x3a')][_0xbc1d('0x19')](_0x512a88)[_0xbc1d('0x1f')](function(_0x107e00){_0x420f28[_0xbc1d('0x19')]=_0x107e00;if(_0x363afd[_0xbc1d('0x2b')][_0xbc1d('0x3b')]){_0x584fa5['include']=[{'all':!![]}];}return db[_0xbc1d('0x3a')][_0xbc1d('0x3c')](_0x584fa5);})['then'](function(_0xbf378){_0x420f28[_0xbc1d('0x3d')]=_0xbf378;return _0x420f28;})['then'](respondWithFilteredResult(_0x5e97e3,_0x584fa5))['catch'](handleError(_0x5e97e3,null));};exports[_0xbc1d('0x3e')]=function(_0x371f25,_0x3e09f9){var _0x4a9006={'raw':!![],'where':{'id':_0x371f25[_0xbc1d('0x3f')]['id']}},_0x2475cb={};_0x2475cb[_0xbc1d('0x2a')]=_[_0xbc1d('0x2c')](db['ChatQueueReport'][_0xbc1d('0x26')]);_0x2475cb['query']=_[_0xbc1d('0x2c')](_0x371f25[_0xbc1d('0x2b')]);_0x2475cb['filters']=_[_0xbc1d('0x2e')](_0x2475cb[_0xbc1d('0x2a')],_0x2475cb[_0xbc1d('0x2b')]);_0x4a9006[_0xbc1d('0x2f')]=_['intersection'](_0x2475cb[_0xbc1d('0x2a')],qs['fields'](_0x371f25[_0xbc1d('0x2b')]['fields']));_0x4a9006[_0xbc1d('0x2f')]=_0x4a9006['attributes'][_0xbc1d('0x31')]?_0x4a9006[_0xbc1d('0x2f')]:_0x2475cb[_0xbc1d('0x2a')];if(_0x371f25[_0xbc1d('0x2b')][_0xbc1d('0x3b')]){_0x4a9006['include']=[{'all':!![]}];}_0x4a9006=_[_0xbc1d('0x36')]({},_0x4a9006,_0x371f25['options']);return db['ChatQueueReport'][_0xbc1d('0x40')](_0x4a9006)[_0xbc1d('0x1f')](handleEntityNotFound(_0x3e09f9,null))[_0xbc1d('0x1f')](respondWithResult(_0x3e09f9,null))[_0xbc1d('0x41')](handleError(_0x3e09f9,null));};exports[_0xbc1d('0x42')]=function(_0x567be6,_0x5be3d4){return db[_0xbc1d('0x3a')][_0xbc1d('0x42')](_0x567be6['body'],{})[_0xbc1d('0x1f')](respondWithResult(_0x5be3d4,0xc9))[_0xbc1d('0x41')](handleError(_0x5be3d4,null));};exports[_0xbc1d('0x1e')]=function(_0x1238b3,_0x3b0472){if(_0x1238b3[_0xbc1d('0x43')]['id']){delete _0x1238b3[_0xbc1d('0x43')]['id'];}return db[_0xbc1d('0x3a')][_0xbc1d('0x40')]({'where':{'id':_0x1238b3[_0xbc1d('0x3f')]['id']}})[_0xbc1d('0x1f')](handleEntityNotFound(_0x3b0472,null))[_0xbc1d('0x1f')](saveUpdates(_0x1238b3[_0xbc1d('0x43')],null))[_0xbc1d('0x1f')](respondWithResult(_0x3b0472,null))[_0xbc1d('0x41')](handleError(_0x3b0472,null));};exports[_0xbc1d('0x44')]=function(_0x413918,_0xfcd402){return db['ChatQueueReport'][_0xbc1d('0x40')]({'where':{'id':_0x413918[_0xbc1d('0x3f')]['id']}})[_0xbc1d('0x1f')](handleEntityNotFound(_0xfcd402,null))[_0xbc1d('0x1f')](removeEntity(_0xfcd402,null))[_0xbc1d('0x41')](handleError(_0xfcd402,null));};exports[_0xbc1d('0x45')]=function(_0x3114bb,_0x54448f){return db['ChatQueueReport'][_0xbc1d('0x45')]()[_0xbc1d('0x1f')](respondWithResult(_0x54448f,null))[_0xbc1d('0x41')](handleError(_0x54448f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f5b7dd0..dfe6059 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 _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0xb10b,0x12a));var _0xbb10=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0xb10b[_0x1de01d];return _0x2865ef;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x2cee8a,_0x5d16ba){var _0xdd2ee5=function(_0x17408a){while(--_0x17408a){_0x2cee8a['push'](_0x2cee8a['shift']());}};_0xdd2ee5(++_0x5d16ba);}(_0x757a,0xde));var _0xa757=function(_0x301c1b,_0x1198c3){_0x301c1b=_0x301c1b-0x0;var _0x1986ec=_0x757a[_0x301c1b];return _0x1986ec;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 31b38d0..af33847 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 _0xccde=['ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','ChatQueueReport','create','options','raw','info','CreateChatQueueReport','catch','UpdateChatQueueReport','update','body','where','limit','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','debug'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xccde,0x113));var _0xeccd=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xccde[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require('lodash');var util=require(_0xeccd('0x0'));var moment=require('moment');var BPromise=require(_0xeccd('0x1'));var rs=require(_0xeccd('0x2'));var fs=require('fs');var Redis=require(_0xeccd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeccd('0x4'));var logger=require(_0xeccd('0x5'))('rpc');var config=require(_0xeccd('0x6'));var jayson=require(_0xeccd('0x7'));var client=jayson[_0xeccd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6f0e,_0x4beb0a,_0x25f064){return new BPromise(function(_0x34be82,_0x47fa75){return client[_0xeccd('0x9')](_0x1b6f0e,_0x25f064)[_0xeccd('0xa')](function(_0x31fda3){logger['info'](_0xeccd('0xb'),_0x4beb0a,'request\x20sent');logger[_0xeccd('0xc')](_0xeccd('0xd'),_0x4beb0a,_0xeccd('0xe'),JSON[_0xeccd('0xf')](_0x31fda3));if(_0x31fda3['error']){if(_0x31fda3['error'][_0xeccd('0x10')]===0x1f4){logger['error'](_0xeccd('0xb'),_0x4beb0a,_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);return _0x47fa75(_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);}logger[_0xeccd('0x11')](_0xeccd('0xb'),_0x4beb0a,_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);return _0x34be82(_0x31fda3[_0xeccd('0x11')][_0xeccd('0x12')]);}else{logger['info'](_0xeccd('0xb'),_0x4beb0a,'request\x20sent');_0x34be82(_0x31fda3[_0xeccd('0x13')][_0xeccd('0x12')]);}})['catch'](function(_0x38a381){logger[_0xeccd('0x11')](_0xeccd('0xb'),_0x4beb0a,_0x38a381);_0x47fa75(_0x38a381);});});}exports['CreateChatQueueReport']=function(_0x575cef){var _0x4da23c=this;return new Promise(function(_0x393825,_0x156370){return db[_0xeccd('0x14')][_0xeccd('0x15')](_0x575cef['body'],{'raw':_0x575cef[_0xeccd('0x16')]?_0x575cef[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![]})[_0xeccd('0xa')](function(_0x4d2d06){logger[_0xeccd('0x18')](_0xeccd('0x19'),_0x575cef);logger[_0xeccd('0xc')](_0xeccd('0x19'),_0x575cef,JSON[_0xeccd('0xf')](_0x4d2d06));_0x393825(_0x4d2d06);})[_0xeccd('0x1a')](function(_0x2f35c1){logger[_0xeccd('0x11')](_0xeccd('0x19'),_0x2f35c1[_0xeccd('0x12')],_0x575cef);_0x156370(_0x4da23c['error'](0x1f4,_0x2f35c1[_0xeccd('0x12')]));});});};exports[_0xeccd('0x1b')]=function(_0x1ff48a){var _0xa09a02=this;return new Promise(function(_0x48b655,_0x1a9af4){return db[_0xeccd('0x14')][_0xeccd('0x1c')](_0x1ff48a[_0xeccd('0x1d')],{'raw':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff48a['options']?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x1e')]||null:null,'attributes':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')]['attributes']||null:null,'limit':_0x1ff48a[_0xeccd('0x16')]?_0x1ff48a[_0xeccd('0x16')][_0xeccd('0x1f')]||null:null})[_0xeccd('0xa')](function(_0x266096){logger[_0xeccd('0x18')]('UpdateChatQueueReport',_0x1ff48a);logger[_0xeccd('0xc')](_0xeccd('0x1b'),_0x1ff48a,JSON['stringify'](_0x266096));_0x48b655(_0x266096);})[_0xeccd('0x1a')](function(_0x39424b){logger['error'](_0xeccd('0x1b'),_0x39424b[_0xeccd('0x12')],_0x1ff48a);_0x1a9af4(_0xa09a02[_0xeccd('0x11')](0x1f4,_0x39424b[_0xeccd('0x12')]));});});}; \ No newline at end of file +var _0x6ffa=['then','stringify','UpdateChatQueueReport','ChatQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateChatQueueReport','body','options','raw'];(function(_0x560d5a,_0x3a55){var _0x49c6fb=function(_0x300547){while(--_0x300547){_0x560d5a['push'](_0x560d5a['shift']());}};_0x49c6fb(++_0x3a55);}(_0x6ffa,0x80));var _0xa6ff=function(_0x5c3b28,_0x1a82bd){_0x5c3b28=_0x5c3b28-0x0;var _0x19b0db=_0x6ffa[_0x5c3b28];return _0x19b0db;};'use strict';var _=require('lodash');var util=require(_0xa6ff('0x0'));var moment=require(_0xa6ff('0x1'));var BPromise=require(_0xa6ff('0x2'));var rs=require(_0xa6ff('0x3'));var fs=require('fs');var Redis=require(_0xa6ff('0x4'));var db=require(_0xa6ff('0x5'))['db'];var utils=require(_0xa6ff('0x6'));var logger=require(_0xa6ff('0x7'))(_0xa6ff('0x8'));var config=require(_0xa6ff('0x9'));var jayson=require(_0xa6ff('0xa'));var client=jayson[_0xa6ff('0xb')][_0xa6ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b88cc,_0x6ab513,_0x45e3b0){return new BPromise(function(_0x191574,_0x2db57f){return client[_0xa6ff('0xd')](_0x5b88cc,_0x45e3b0)['then'](function(_0x5d76e2){logger['info'](_0xa6ff('0xe'),_0x6ab513,_0xa6ff('0xf'));logger[_0xa6ff('0x10')](_0xa6ff('0x11'),_0x6ab513,_0xa6ff('0xf'),JSON['stringify'](_0x5d76e2));if(_0x5d76e2[_0xa6ff('0x12')]){if(_0x5d76e2['error'][_0xa6ff('0x13')]===0x1f4){logger[_0xa6ff('0x12')](_0xa6ff('0xe'),_0x6ab513,_0x5d76e2['error']['message']);return _0x2db57f(_0x5d76e2['error'][_0xa6ff('0x14')]);}logger[_0xa6ff('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x6ab513,_0x5d76e2['error'][_0xa6ff('0x14')]);return _0x191574(_0x5d76e2[_0xa6ff('0x12')][_0xa6ff('0x14')]);}else{logger[_0xa6ff('0x15')](_0xa6ff('0xe'),_0x6ab513,'request\x20sent');_0x191574(_0x5d76e2['result'][_0xa6ff('0x14')]);}})[_0xa6ff('0x16')](function(_0x38b1d7){logger[_0xa6ff('0x12')](_0xa6ff('0xe'),_0x6ab513,_0x38b1d7);_0x2db57f(_0x38b1d7);});});}exports[_0xa6ff('0x17')]=function(_0x34439b){var _0x191e4f=this;return new Promise(function(_0x9c2521,_0x457979){return db['ChatQueueReport']['create'](_0x34439b[_0xa6ff('0x18')],{'raw':_0x34439b[_0xa6ff('0x19')]?_0x34439b['options'][_0xa6ff('0x1a')]===undefined?!![]:![]:!![]})[_0xa6ff('0x1b')](function(_0x4c70c8){logger[_0xa6ff('0x15')]('CreateChatQueueReport',_0x34439b);logger[_0xa6ff('0x10')](_0xa6ff('0x17'),_0x34439b,JSON[_0xa6ff('0x1c')](_0x4c70c8));_0x9c2521(_0x4c70c8);})['catch'](function(_0x51758c){logger['error'](_0xa6ff('0x17'),_0x51758c[_0xa6ff('0x14')],_0x34439b);_0x457979(_0x191e4f['error'](0x1f4,_0x51758c[_0xa6ff('0x14')]));});});};exports[_0xa6ff('0x1d')]=function(_0x27c92b){var _0x4af762=this;return new Promise(function(_0x47ea5f,_0x3eba6f){return db[_0xa6ff('0x1e')]['update'](_0x27c92b['body'],{'raw':_0x27c92b[_0xa6ff('0x19')]?_0x27c92b[_0xa6ff('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27c92b[_0xa6ff('0x19')]?_0x27c92b['options']['where']||null:null,'attributes':_0x27c92b[_0xa6ff('0x19')]?_0x27c92b[_0xa6ff('0x19')]['attributes']||null:null,'limit':_0x27c92b['options']?_0x27c92b['options']['limit']||null:null})[_0xa6ff('0x1b')](function(_0x3d2f15){logger[_0xa6ff('0x15')](_0xa6ff('0x1d'),_0x27c92b);logger['debug'](_0xa6ff('0x1d'),_0x27c92b,JSON['stringify'](_0x3d2f15));_0x47ea5f(_0x3d2f15);})[_0xa6ff('0x16')](function(_0x1185e1){logger[_0xa6ff('0x12')](_0xa6ff('0x1d'),_0x1185e1[_0xa6ff('0x14')],_0x27c92b);_0x3eba6f(_0x4af762[_0xa6ff('0x12')](0x1f4,_0x1185e1[_0xa6ff('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 0b320b0..97c5250 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 _0x2c78=['get','isAuthenticated','index','describe','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c78,0x6e));var _0x82c7=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0x2c78[_0x4eb662];return _0x2d7889;};'use strict';var multer=require(_0x82c7('0x0'));var util=require(_0x82c7('0x1'));var path=require(_0x82c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x82c7('0x3'));var router=express[_0x82c7('0x4')]();var fs_extra=require(_0x82c7('0x5'));var auth=require(_0x82c7('0x6'));var interaction=require(_0x82c7('0x7'));var config=require(_0x82c7('0x8'));var controller=require(_0x82c7('0x9'));router[_0x82c7('0xa')]('/',auth[_0x82c7('0xb')](),controller[_0x82c7('0xc')]);router[_0x82c7('0xa')]('/describe',auth[_0x82c7('0xb')](),controller[_0x82c7('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x82c7('0xe')]);router[_0x82c7('0xf')](_0x82c7('0x10'),auth['isAuthenticated'](),controller[_0x82c7('0x11')]);router['delete']('/:id',auth[_0x82c7('0xb')](),controller[_0x82c7('0x12')]);module[_0x82c7('0x13')]=router; \ No newline at end of file +var _0x89d3=['./chatQueueReport.controller','get','isAuthenticated','index','post','put','destroy','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x89d3,0x1eb));var _0x389d=function(_0x1c68d9,_0x1591f1){_0x1c68d9=_0x1c68d9-0x0;var _0x5a47f8=_0x89d3[_0x1c68d9];return _0x5a47f8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x389d('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x389d('0x1'));var interaction=require(_0x389d('0x2'));var config=require(_0x389d('0x3'));var controller=require(_0x389d('0x4'));router[_0x389d('0x5')]('/',auth[_0x389d('0x6')](),controller[_0x389d('0x7')]);router[_0x389d('0x5')]('/describe',auth[_0x389d('0x6')](),controller['describe']);router[_0x389d('0x5')]('/:id',auth[_0x389d('0x6')](),controller['show']);router[_0x389d('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x389d('0x9')]('/:id',auth[_0x389d('0x6')](),controller['update']);router['delete']('/:id',auth[_0x389d('0x6')](),controller[_0x389d('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 381e088..535654d 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4d3681,_0x136f19){var _0x22c7ac=function(_0x3c6120){while(--_0x3c6120){_0x4d3681['push'](_0x4d3681['shift']());}};_0x22c7ac(++_0x136f19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x52b494,_0x144998){var _0x295940=function(_0x2ee8eb){while(--_0x2ee8eb){_0x52b494['push'](_0x52b494['shift']());}};_0x295940(++_0x144998);}(_0x54ef,0x112));var _0xf54e=function(_0x3bbd58,_0x448cad){_0x3bbd58=_0x3bbd58-0x0;var _0x1f8559=_0x54ef[_0x3bbd58];return _0x1f8559;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 3422a24..c1a88a1 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 _0x05df=['offset','undefined','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','status','end','json'];(function(_0xa21cbf,_0x551394){var _0xed2632=function(_0x31f41e){while(--_0x31f41e){_0xa21cbf['push'](_0xa21cbf['shift']());}};_0xed2632(++_0x551394);}(_0x05df,0x101));var _0xf05d=function(_0x63fecc,_0x318df4){_0x63fecc=_0x63fecc-0x0;var _0x17936c=_0x05df[_0x63fecc];return _0x17936c;};'use strict';var emlformat=require(_0xf05d('0x0'));var rimraf=require(_0xf05d('0x1'));var zipdir=require(_0xf05d('0x2'));var jsonpatch=require(_0xf05d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf05d('0x4'));var Mustache=require(_0xf05d('0x5'));var util=require(_0xf05d('0x6'));var path=require(_0xf05d('0x7'));var sox=require('sox');var csv=require(_0xf05d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf05d('0x9'));var squel=require('squel');var crypto=require(_0xf05d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf05d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf05d('0xc'));var Papa=require(_0xf05d('0xd'));var Redis=require(_0xf05d('0xe'));var authService=require(_0xf05d('0xf'));var qs=require(_0xf05d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf05d('0x11'));var logger=require('../../config/logger')(_0xf05d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf05d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10f652,_0x192871){_0x192871=_0x192871||0xcc;return function(_0x111fde){if(_0x111fde){return _0x10f652['sendStatus'](_0x192871);}return _0x10f652[_0xf05d('0x14')](_0x192871)[_0xf05d('0x15')]();};}function respondWithResult(_0x46f79e,_0x314140){_0x314140=_0x314140||0xc8;return function(_0x271815){if(_0x271815){return _0x46f79e['status'](_0x314140)[_0xf05d('0x16')](_0x271815);}};}function respondWithFilteredResult(_0x49a010,_0x3ac901){return function(_0x106297){if(_0x106297){var _0x2b97c0=typeof _0x3ac901[_0xf05d('0x17')]===_0xf05d('0x18')&&typeof _0x3ac901['limit']===_0xf05d('0x18');var _0x3697c3=_0x106297[_0xf05d('0x19')];var _0x22e3ad=_0x2b97c0?0x0:_0x3ac901[_0xf05d('0x17')];var _0x4d59d3=_0x2b97c0?_0x106297['count']:_0x3ac901[_0xf05d('0x17')]+_0x3ac901['limit'];var _0x5522e4;if(_0x4d59d3>=_0x3697c3){_0x4d59d3=_0x3697c3;_0x5522e4=0xc8;}else{_0x5522e4=0xce;}_0x49a010[_0xf05d('0x14')](_0x5522e4);return _0x49a010['set']('Content-Range',_0x22e3ad+'-'+_0x4d59d3+'/'+_0x3697c3)[_0xf05d('0x16')](_0x106297);}return null;};}function patchUpdates(_0x5ad4fe){return function(_0x21941b){try{jsonpatch[_0xf05d('0x1a')](_0x21941b,_0x5ad4fe,!![]);}catch(_0x4024bc){return BPromise[_0xf05d('0x1b')](_0x4024bc);}return _0x21941b[_0xf05d('0x1c')]();};}function saveUpdates(_0x4dfcfe,_0xc8c4e1){return function(_0x41296e){if(_0x41296e){return _0x41296e[_0xf05d('0x1d')](_0x4dfcfe)[_0xf05d('0x1e')](function(_0x34fee9){return _0x34fee9;});}return null;};}function removeEntity(_0x20c706,_0x29321b){return function(_0x1b84ea){if(_0x1b84ea){return _0x1b84ea[_0xf05d('0x1f')]()[_0xf05d('0x1e')](function(){_0x20c706[_0xf05d('0x14')](0xcc)[_0xf05d('0x15')]();});}};}function handleEntityNotFound(_0x5829dd,_0x2d1a41){return function(_0x433e02){if(!_0x433e02){_0x5829dd[_0xf05d('0x20')](0x194);}return _0x433e02;};}function handleError(_0x329330,_0x43161e){_0x43161e=_0x43161e||0x1f4;return function(_0x1039e4){logger[_0xf05d('0x21')](_0x1039e4[_0xf05d('0x22')]);if(_0x1039e4[_0xf05d('0x23')]){delete _0x1039e4[_0xf05d('0x23')];}_0x329330[_0xf05d('0x14')](_0x43161e)[_0xf05d('0x24')](_0x1039e4);};}exports['index']=function(_0x1a585c,_0x5bcb99){var _0x341ec0={},_0x2ec064={},_0x388596={'count':0x0,'rows':[]};var _0x2f7436=_['map'](db[_0xf05d('0x25')][_0xf05d('0x26')],function(_0x45f3ce){return{'name':_0x45f3ce[_0xf05d('0x27')],'type':_0x45f3ce[_0xf05d('0x28')][_0xf05d('0x29')]};});_0x2ec064[_0xf05d('0x2a')]=_[_0xf05d('0x2b')](_0x2f7436,_0xf05d('0x23'));_0x2ec064[_0xf05d('0x2c')]=_['keys'](_0x1a585c[_0xf05d('0x2c')]);_0x2ec064['filters']=_[_0xf05d('0x2d')](_0x2ec064[_0xf05d('0x2a')],_0x2ec064[_0xf05d('0x2c')]);_0x341ec0[_0xf05d('0x2e')]=_[_0xf05d('0x2d')](_0x2ec064[_0xf05d('0x2a')],qs[_0xf05d('0x2f')](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x2f')]));_0x341ec0[_0xf05d('0x2e')]=_0x341ec0[_0xf05d('0x2e')][_0xf05d('0x30')]?_0x341ec0[_0xf05d('0x2e')]:_0x2ec064[_0xf05d('0x2a')];if(!_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x31')](_0xf05d('0x32'))){_0x341ec0['limit']=qs['limit'](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x33')]);_0x341ec0[_0xf05d('0x17')]=qs[_0xf05d('0x17')](_0x1a585c[_0xf05d('0x2c')]['offset']);}_0x341ec0[_0xf05d('0x34')]=qs['sort'](_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x35')]);_0x341ec0[_0xf05d('0x36')]=qs[_0xf05d('0x37')](_['pick'](_0x1a585c[_0xf05d('0x2c')],_0x2ec064[_0xf05d('0x37')]),_0x2f7436);if(_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x38')]){_0x341ec0['where']=_[_0xf05d('0x39')](_0x341ec0[_0xf05d('0x36')],{'$or':_[_0xf05d('0x2b')](_0x2f7436,function(_0x3f171f){if(_0x3f171f[_0xf05d('0x28')]!=='VIRTUAL'){var _0x112fa5={};_0x112fa5[_0x3f171f[_0xf05d('0x23')]]={'$like':'%'+_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x38')]+'%'};return _0x112fa5;}})});}_0x341ec0=_['merge']({},_0x341ec0,_0x1a585c[_0xf05d('0x3a')]);var _0x220968={'where':_0x341ec0[_0xf05d('0x36')]};return db[_0xf05d('0x25')][_0xf05d('0x19')](_0x220968)['then'](function(_0x133989){_0x388596[_0xf05d('0x19')]=_0x133989;if(_0x1a585c[_0xf05d('0x2c')][_0xf05d('0x3b')]){_0x341ec0['include']=[{'all':!![]}];}return db[_0xf05d('0x25')][_0xf05d('0x3c')](_0x341ec0);})[_0xf05d('0x1e')](function(_0x592abc){_0x388596[_0xf05d('0x3d')]=_0x592abc;return _0x388596;})[_0xf05d('0x1e')](respondWithFilteredResult(_0x5bcb99,_0x341ec0))[_0xf05d('0x3e')](handleError(_0x5bcb99,null));};exports[_0xf05d('0x3f')]=function(_0x1a66ef,_0x2a02d4){var _0xe17bcf={'raw':!![],'where':{'id':_0x1a66ef[_0xf05d('0x40')]['id']}},_0x2f3c89={};_0x2f3c89[_0xf05d('0x2a')]=_[_0xf05d('0x41')](db[_0xf05d('0x25')][_0xf05d('0x26')]);_0x2f3c89[_0xf05d('0x2c')]=_[_0xf05d('0x41')](_0x1a66ef['query']);_0x2f3c89[_0xf05d('0x37')]=_[_0xf05d('0x2d')](_0x2f3c89['model'],_0x2f3c89[_0xf05d('0x2c')]);_0xe17bcf[_0xf05d('0x2e')]=_[_0xf05d('0x2d')](_0x2f3c89[_0xf05d('0x2a')],qs[_0xf05d('0x2f')](_0x1a66ef[_0xf05d('0x2c')][_0xf05d('0x2f')]));_0xe17bcf[_0xf05d('0x2e')]=_0xe17bcf[_0xf05d('0x2e')][_0xf05d('0x30')]?_0xe17bcf[_0xf05d('0x2e')]:_0x2f3c89[_0xf05d('0x2a')];if(_0x1a66ef[_0xf05d('0x2c')][_0xf05d('0x3b')]){_0xe17bcf[_0xf05d('0x42')]=[{'all':!![]}];}_0xe17bcf=_['merge']({},_0xe17bcf,_0x1a66ef['options']);return db[_0xf05d('0x25')][_0xf05d('0x43')](_0xe17bcf)[_0xf05d('0x1e')](handleEntityNotFound(_0x2a02d4,null))['then'](respondWithResult(_0x2a02d4,null))['catch'](handleError(_0x2a02d4,null));};exports[_0xf05d('0x44')]=function(_0x166e72,_0x32336f){return db[_0xf05d('0x25')][_0xf05d('0x44')](_0x166e72[_0xf05d('0x45')],{})[_0xf05d('0x1e')](respondWithResult(_0x32336f,0xc9))[_0xf05d('0x3e')](handleError(_0x32336f,null));};exports['update']=function(_0x37f345,_0x1f328e){if(_0x37f345['body']['id']){delete _0x37f345[_0xf05d('0x45')]['id'];}return db['ChatTransferReport'][_0xf05d('0x43')]({'where':{'id':_0x37f345[_0xf05d('0x40')]['id']}})[_0xf05d('0x1e')](handleEntityNotFound(_0x1f328e,null))[_0xf05d('0x1e')](saveUpdates(_0x37f345[_0xf05d('0x45')],null))[_0xf05d('0x1e')](respondWithResult(_0x1f328e,null))[_0xf05d('0x3e')](handleError(_0x1f328e,null));};exports[_0xf05d('0x1f')]=function(_0x594090,_0x118e41){return db[_0xf05d('0x25')][_0xf05d('0x43')]({'where':{'id':_0x594090['params']['id']}})[_0xf05d('0x1e')](handleEntityNotFound(_0x118e41,null))[_0xf05d('0x1e')](removeEntity(_0x118e41,null))['catch'](handleError(_0x118e41,null));};exports['describe']=function(_0x2a0d20,_0x1ef603){return db[_0xf05d('0x25')]['describe']()[_0xf05d('0x1e')](respondWithResult(_0x1ef603,null))[_0xf05d('0x3e')](handleError(_0x1ef603,null));}; \ No newline at end of file +var _0x1b67=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x29d8d9,_0x3c685e){var _0x66d8a4=function(_0x245d10){while(--_0x245d10){_0x29d8d9['push'](_0x29d8d9['shift']());}};_0x66d8a4(++_0x3c685e);}(_0x1b67,0x182));var _0x71b6=function(_0xcf075f,_0x2c8a29){_0xcf075f=_0xcf075f-0x0;var _0x18e13c=_0x1b67[_0xcf075f];return _0x18e13c;};'use strict';var emlformat=require(_0x71b6('0x0'));var rimraf=require(_0x71b6('0x1'));var zipdir=require(_0x71b6('0x2'));var jsonpatch=require(_0x71b6('0x3'));var rp=require(_0x71b6('0x4'));var moment=require(_0x71b6('0x5'));var BPromise=require(_0x71b6('0x6'));var Mustache=require(_0x71b6('0x7'));var util=require(_0x71b6('0x8'));var path=require(_0x71b6('0x9'));var sox=require(_0x71b6('0xa'));var csv=require(_0x71b6('0xb'));var ejs=require(_0x71b6('0xc'));var fs=require('fs');var fs_extra=require(_0x71b6('0xd'));var _=require('lodash');var squel=require(_0x71b6('0xe'));var crypto=require(_0x71b6('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x71b6('0x10'));var Papa=require(_0x71b6('0x11'));var Redis=require(_0x71b6('0x12'));var authService=require(_0x71b6('0x13'));var qs=require(_0x71b6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x71b6('0x15'));var logger=require('../../config/logger')(_0x71b6('0x16'));var utils=require(_0x71b6('0x17'));var config=require(_0x71b6('0x18'));var licenseUtil=require(_0x71b6('0x19'));var db=require(_0x71b6('0x1a'))['db'];function respondWithStatusCode(_0x574732,_0x2ea1f3){_0x2ea1f3=_0x2ea1f3||0xcc;return function(_0x3db077){if(_0x3db077){return _0x574732[_0x71b6('0x1b')](_0x2ea1f3);}return _0x574732[_0x71b6('0x1c')](_0x2ea1f3)[_0x71b6('0x1d')]();};}function respondWithResult(_0x1ce4f5,_0x338862){_0x338862=_0x338862||0xc8;return function(_0x2996d7){if(_0x2996d7){return _0x1ce4f5['status'](_0x338862)['json'](_0x2996d7);}};}function respondWithFilteredResult(_0x1c393f,_0x146d08){return function(_0x314710){if(_0x314710){var _0x4c7293=typeof _0x146d08[_0x71b6('0x1e')]===_0x71b6('0x1f')&&typeof _0x146d08['limit']===_0x71b6('0x1f');var _0x85f926=_0x314710[_0x71b6('0x20')];var _0x5a5f1a=_0x4c7293?0x0:_0x146d08['offset'];var _0xf942d2=_0x4c7293?_0x314710[_0x71b6('0x20')]:_0x146d08['offset']+_0x146d08[_0x71b6('0x21')];var _0x13c561;if(_0xf942d2>=_0x85f926){_0xf942d2=_0x85f926;_0x13c561=0xc8;}else{_0x13c561=0xce;}_0x1c393f[_0x71b6('0x1c')](_0x13c561);return _0x1c393f[_0x71b6('0x22')](_0x71b6('0x23'),_0x5a5f1a+'-'+_0xf942d2+'/'+_0x85f926)[_0x71b6('0x24')](_0x314710);}return null;};}function patchUpdates(_0x34950e){return function(_0x4be029){try{jsonpatch['apply'](_0x4be029,_0x34950e,!![]);}catch(_0x457cd5){return BPromise['reject'](_0x457cd5);}return _0x4be029[_0x71b6('0x25')]();};}function saveUpdates(_0x1740db,_0xff6c22){return function(_0x1bfce3){if(_0x1bfce3){return _0x1bfce3[_0x71b6('0x26')](_0x1740db)['then'](function(_0x3b55c3){return _0x3b55c3;});}return null;};}function removeEntity(_0x36f8cb,_0x5627ed){return function(_0x1594e5){if(_0x1594e5){return _0x1594e5[_0x71b6('0x27')]()[_0x71b6('0x28')](function(){_0x36f8cb[_0x71b6('0x1c')](0xcc)[_0x71b6('0x1d')]();});}};}function handleEntityNotFound(_0x271da0,_0x5eb3e7){return function(_0x4accc5){if(!_0x4accc5){_0x271da0[_0x71b6('0x1b')](0x194);}return _0x4accc5;};}function handleError(_0x5db233,_0x1d2626){_0x1d2626=_0x1d2626||0x1f4;return function(_0x2fadef){logger[_0x71b6('0x29')](_0x2fadef[_0x71b6('0x2a')]);if(_0x2fadef['name']){delete _0x2fadef[_0x71b6('0x2b')];}_0x5db233[_0x71b6('0x1c')](_0x1d2626)['send'](_0x2fadef);};}exports[_0x71b6('0x2c')]=function(_0x397fb4,_0x4b6bf9){var _0x31c159={},_0x247aef={},_0x49ac4c={'count':0x0,'rows':[]};var _0x519c2c=_[_0x71b6('0x2d')](db[_0x71b6('0x2e')][_0x71b6('0x2f')],function(_0x388dee){return{'name':_0x388dee[_0x71b6('0x30')],'type':_0x388dee[_0x71b6('0x31')][_0x71b6('0x32')]};});_0x247aef[_0x71b6('0x33')]=_[_0x71b6('0x2d')](_0x519c2c,_0x71b6('0x2b'));_0x247aef[_0x71b6('0x34')]=_[_0x71b6('0x35')](_0x397fb4[_0x71b6('0x34')]);_0x247aef['filters']=_[_0x71b6('0x36')](_0x247aef[_0x71b6('0x33')],_0x247aef['query']);_0x31c159['attributes']=_['intersection'](_0x247aef[_0x71b6('0x33')],qs[_0x71b6('0x37')](_0x397fb4[_0x71b6('0x34')][_0x71b6('0x37')]));_0x31c159[_0x71b6('0x38')]=_0x31c159[_0x71b6('0x38')][_0x71b6('0x39')]?_0x31c159[_0x71b6('0x38')]:_0x247aef[_0x71b6('0x33')];if(!_0x397fb4[_0x71b6('0x34')][_0x71b6('0x3a')](_0x71b6('0x3b'))){_0x31c159[_0x71b6('0x21')]=qs[_0x71b6('0x21')](_0x397fb4[_0x71b6('0x34')][_0x71b6('0x21')]);_0x31c159['offset']=qs['offset'](_0x397fb4['query']['offset']);}_0x31c159[_0x71b6('0x3c')]=qs[_0x71b6('0x3d')](_0x397fb4[_0x71b6('0x34')][_0x71b6('0x3d')]);_0x31c159[_0x71b6('0x3e')]=qs[_0x71b6('0x3f')](_[_0x71b6('0x40')](_0x397fb4['query'],_0x247aef['filters']),_0x519c2c);if(_0x397fb4['query'][_0x71b6('0x41')]){_0x31c159['where']=_[_0x71b6('0x42')](_0x31c159[_0x71b6('0x3e')],{'$or':_[_0x71b6('0x2d')](_0x519c2c,function(_0xd1576c){if(_0xd1576c[_0x71b6('0x31')]!==_0x71b6('0x43')){var _0x5a723d={};_0x5a723d[_0xd1576c[_0x71b6('0x2b')]]={'$like':'%'+_0x397fb4[_0x71b6('0x34')][_0x71b6('0x41')]+'%'};return _0x5a723d;}})});}_0x31c159=_[_0x71b6('0x42')]({},_0x31c159,_0x397fb4['options']);var _0x3a7e0c={'where':_0x31c159[_0x71b6('0x3e')]};return db[_0x71b6('0x2e')][_0x71b6('0x20')](_0x3a7e0c)[_0x71b6('0x28')](function(_0x57b6eb){_0x49ac4c['count']=_0x57b6eb;if(_0x397fb4[_0x71b6('0x34')][_0x71b6('0x44')]){_0x31c159[_0x71b6('0x45')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x31c159);})[_0x71b6('0x28')](function(_0x4ad949){_0x49ac4c[_0x71b6('0x46')]=_0x4ad949;return _0x49ac4c;})[_0x71b6('0x28')](respondWithFilteredResult(_0x4b6bf9,_0x31c159))[_0x71b6('0x47')](handleError(_0x4b6bf9,null));};exports['show']=function(_0x11bb42,_0x4aa65a){var _0x53499c={'raw':!![],'where':{'id':_0x11bb42[_0x71b6('0x48')]['id']}},_0x3f4bc3={};_0x3f4bc3['model']=_[_0x71b6('0x35')](db[_0x71b6('0x2e')][_0x71b6('0x2f')]);_0x3f4bc3[_0x71b6('0x34')]=_[_0x71b6('0x35')](_0x11bb42[_0x71b6('0x34')]);_0x3f4bc3[_0x71b6('0x3f')]=_[_0x71b6('0x36')](_0x3f4bc3['model'],_0x3f4bc3[_0x71b6('0x34')]);_0x53499c['attributes']=_['intersection'](_0x3f4bc3[_0x71b6('0x33')],qs[_0x71b6('0x37')](_0x11bb42['query'][_0x71b6('0x37')]));_0x53499c['attributes']=_0x53499c[_0x71b6('0x38')][_0x71b6('0x39')]?_0x53499c[_0x71b6('0x38')]:_0x3f4bc3['model'];if(_0x11bb42[_0x71b6('0x34')][_0x71b6('0x44')]){_0x53499c['include']=[{'all':!![]}];}_0x53499c=_[_0x71b6('0x42')]({},_0x53499c,_0x11bb42[_0x71b6('0x49')]);return db[_0x71b6('0x2e')][_0x71b6('0x4a')](_0x53499c)[_0x71b6('0x28')](handleEntityNotFound(_0x4aa65a,null))[_0x71b6('0x28')](respondWithResult(_0x4aa65a,null))[_0x71b6('0x47')](handleError(_0x4aa65a,null));};exports[_0x71b6('0x4b')]=function(_0x2d13d1,_0x45596f){return db[_0x71b6('0x2e')][_0x71b6('0x4b')](_0x2d13d1[_0x71b6('0x4c')],{})['then'](respondWithResult(_0x45596f,0xc9))[_0x71b6('0x47')](handleError(_0x45596f,null));};exports['update']=function(_0x29b032,_0x2b6bb4){if(_0x29b032['body']['id']){delete _0x29b032['body']['id'];}return db[_0x71b6('0x2e')][_0x71b6('0x4a')]({'where':{'id':_0x29b032[_0x71b6('0x48')]['id']}})[_0x71b6('0x28')](handleEntityNotFound(_0x2b6bb4,null))[_0x71b6('0x28')](saveUpdates(_0x29b032[_0x71b6('0x4c')],null))[_0x71b6('0x28')](respondWithResult(_0x2b6bb4,null))['catch'](handleError(_0x2b6bb4,null));};exports[_0x71b6('0x27')]=function(_0x1c165b,_0x194f0b){return db['ChatTransferReport'][_0x71b6('0x4a')]({'where':{'id':_0x1c165b['params']['id']}})[_0x71b6('0x28')](handleEntityNotFound(_0x194f0b,null))[_0x71b6('0x28')](removeEntity(_0x194f0b,null))[_0x71b6('0x47')](handleError(_0x194f0b,null));};exports['describe']=function(_0x4e95c7,_0x5d24c2){return db['ChatTransferReport'][_0x71b6('0x4d')]()['then'](respondWithResult(_0x5d24c2,null))[_0x71b6('0x47')](handleError(_0x5d24c2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2024a25..9629895 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 _0x57e4=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x57e4,0x197));var _0x457e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x457e('0x0'));var util=require(_0x457e('0x1'));var logger=require(_0x457e('0x2'))(_0x457e('0x3'));var moment=require('moment');var BPromise=require(_0x457e('0x4'));var rp=require(_0x457e('0x5'));var fs=require('fs');var path=require(_0x457e('0x6'));var rimraf=require(_0x457e('0x7'));var config=require(_0x457e('0x8'));var attributes=require(_0x457e('0x9'));module[_0x457e('0xa')]=function(_0x21de0e,_0x22cca9){return _0x21de0e[_0x457e('0xb')](_0x457e('0xc'),attributes,{'tableName':_0x457e('0xd'),'paranoid':![],'indexes':[{'name':_0x457e('0xe'),'fields':[_0x457e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb46=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0xb7ff33,_0x1541ed){var _0x4a22f5=function(_0x435883){while(--_0x435883){_0xb7ff33['push'](_0xb7ff33['shift']());}};_0x4a22f5(++_0x1541ed);}(_0xdb46,0x85));var _0x6db4=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xdb46[_0x13ce0c];return _0x4388fb;};'use strict';var _=require(_0x6db4('0x0'));var util=require(_0x6db4('0x1'));var logger=require(_0x6db4('0x2'))(_0x6db4('0x3'));var moment=require(_0x6db4('0x4'));var BPromise=require(_0x6db4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6db4('0x6'));var rimraf=require(_0x6db4('0x7'));var config=require('../../config/environment');var attributes=require(_0x6db4('0x8'));module['exports']=function(_0x305080,_0x3de215){return _0x305080[_0x6db4('0x9')](_0x6db4('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x6db4('0xb'),'fields':[_0x6db4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 50190c3..1788656 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 _0xe802=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','bluebird','randomstring','../../config/environment','jayson/promise'];(function(_0x275caa,_0x166d5e){var _0x28d670=function(_0x2a20e1){while(--_0x2a20e1){_0x275caa['push'](_0x275caa['shift']());}};_0x28d670(++_0x166d5e);}(_0xe802,0x8b));var _0x2e80=function(_0x1de352,_0x5e2970){_0x1de352=_0x1de352-0x0;var _0x2e80fd=_0xe802[_0x1de352];return _0x2e80fd;};'use strict';var _=require(_0x2e80('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2e80('0x1'));var rs=require(_0x2e80('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e80('0x3'));var jayson=require(_0x2e80('0x4'));var client=jayson[_0x2e80('0x5')][_0x2e80('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x405e81,_0x277072,_0x3b9aa7){return new BPromise(function(_0x54ea09,_0x402768){return client[_0x2e80('0x7')](_0x405e81,_0x3b9aa7)[_0x2e80('0x8')](function(_0x4bd762){logger[_0x2e80('0x9')](_0x2e80('0xa'),_0x277072,_0x2e80('0xb'));logger[_0x2e80('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x277072,'request\x20sent',JSON[_0x2e80('0xd')](_0x4bd762));if(_0x4bd762[_0x2e80('0xe')]){if(_0x4bd762[_0x2e80('0xe')][_0x2e80('0xf')]===0x1f4){logger[_0x2e80('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x277072,_0x4bd762[_0x2e80('0xe')][_0x2e80('0x10')]);return _0x402768(_0x4bd762[_0x2e80('0xe')][_0x2e80('0x10')]);}logger[_0x2e80('0xe')](_0x2e80('0xa'),_0x277072,_0x4bd762['error'][_0x2e80('0x10')]);return _0x54ea09(_0x4bd762['error']['message']);}else{logger[_0x2e80('0x9')](_0x2e80('0xa'),_0x277072,_0x2e80('0xb'));_0x54ea09(_0x4bd762[_0x2e80('0x11')][_0x2e80('0x10')]);}})['catch'](function(_0x4ac39c){logger[_0x2e80('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x277072,_0x4ac39c);_0x402768(_0x4ac39c);});});} \ No newline at end of file +var _0x7790=['../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0x7790,0x154));var _0x0779=function(_0x5a4a44,_0x27f080){_0x5a4a44=_0x5a4a44-0x0;var _0x2ef2c9=_0x7790[_0x5a4a44];return _0x2ef2c9;};'use strict';var _=require(_0x0779('0x0'));var util=require(_0x0779('0x1'));var moment=require(_0x0779('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0779('0x3'));var db=require(_0x0779('0x4'))['db'];var utils=require(_0x0779('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0779('0x6'));var jayson=require(_0x0779('0x7'));var client=jayson[_0x0779('0x8')][_0x0779('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4846f8,_0x32e9d7,_0xdc70){return new BPromise(function(_0x499787,_0x3cb188){return client[_0x0779('0xa')](_0x4846f8,_0xdc70)[_0x0779('0xb')](function(_0x29edd1){logger[_0x0779('0xc')](_0x0779('0xd'),_0x32e9d7,_0x0779('0xe'));logger[_0x0779('0xf')](_0x0779('0x10'),_0x32e9d7,'request\x20sent',JSON[_0x0779('0x11')](_0x29edd1));if(_0x29edd1[_0x0779('0x12')]){if(_0x29edd1['error'][_0x0779('0x13')]===0x1f4){logger[_0x0779('0x12')](_0x0779('0xd'),_0x32e9d7,_0x29edd1[_0x0779('0x12')][_0x0779('0x14')]);return _0x3cb188(_0x29edd1[_0x0779('0x12')]['message']);}logger[_0x0779('0x12')](_0x0779('0xd'),_0x32e9d7,_0x29edd1[_0x0779('0x12')][_0x0779('0x14')]);return _0x499787(_0x29edd1['error'][_0x0779('0x14')]);}else{logger['info'](_0x0779('0xd'),_0x32e9d7,'request\x20sent');_0x499787(_0x29edd1[_0x0779('0x15')][_0x0779('0x14')]);}})[_0x0779('0x16')](function(_0x3c6b65){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x32e9d7,_0x3c6b65);_0x3cb188(_0x3c6b65);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 483f338..ff06093 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 _0x99ec=['../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','post','create','put','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x557b4a,_0x5c3929){var _0x59fa97=function(_0x24694f){while(--_0x24694f){_0x557b4a['push'](_0x557b4a['shift']());}};_0x59fa97(++_0x5c3929);}(_0x99ec,0x176));var _0xc99e=function(_0xb984a7,_0x564ef9){_0xb984a7=_0xb984a7-0x0;var _0x247044=_0x99ec[_0xb984a7];return _0x247044;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc99e('0x0'));var express=require(_0xc99e('0x1'));var router=express[_0xc99e('0x2')]();var fs_extra=require(_0xc99e('0x3'));var auth=require(_0xc99e('0x4'));var interaction=require(_0xc99e('0x5'));var config=require(_0xc99e('0x6'));var controller=require(_0xc99e('0x7'));router['get']('/',auth[_0xc99e('0x8')](),controller[_0xc99e('0x9')]);router['get'](_0xc99e('0xa'),auth[_0xc99e('0x8')](),controller[_0xc99e('0xb')]);router[_0xc99e('0xc')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller['show']);router[_0xc99e('0xe')]('/',auth[_0xc99e('0x8')](),controller[_0xc99e('0xf')]);router[_0xc99e('0x10')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller['update']);router[_0xc99e('0x11')](_0xc99e('0xd'),auth[_0xc99e('0x8')](),controller[_0xc99e('0x12')]);module[_0xc99e('0x13')]=router; \ No newline at end of file +var _0x0c8d=['../../components/interaction/service','../../config/environment','./chatTransferReport.controller','/describe','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x46a20d,_0x34e9d3){var _0x32007c=function(_0x3a55ad){while(--_0x3a55ad){_0x46a20d['push'](_0x46a20d['shift']());}};_0x32007c(++_0x34e9d3);}(_0x0c8d,0x176));var _0xd0c8=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0c8d[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xd0c8('0x0'));var util=require(_0xd0c8('0x1'));var path=require(_0xd0c8('0x2'));var timeout=require(_0xd0c8('0x3'));var express=require('express');var router=express[_0xd0c8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd0c8('0x5'));var interaction=require(_0xd0c8('0x6'));var config=require(_0xd0c8('0x7'));var controller=require(_0xd0c8('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd0c8('0x9'),auth[_0xd0c8('0xa')](),controller['describe']);router['get'](_0xd0c8('0xb'),auth[_0xd0c8('0xa')](),controller[_0xd0c8('0xc')]);router[_0xd0c8('0xd')]('/',auth[_0xd0c8('0xa')](),controller[_0xd0c8('0xe')]);router[_0xd0c8('0xf')](_0xd0c8('0xb'),auth[_0xd0c8('0xa')](),controller['update']);router[_0xd0c8('0x10')](_0xd0c8('0xb'),auth['isAuthenticated'](),controller[_0xd0c8('0x11')]);module[_0xd0c8('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 62ce960..07bcf55 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 _0x0b8b=['parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#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}}','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b8b,0x116));var _0xb0b8=function(_0x498bdd,_0x470eeb){_0x498bdd=_0x498bdd-0x0;var _0x392cb7=_0x0b8b[_0x498bdd];return _0x392cb7;};'use strict';var Sequelize=require(_0xb0b8('0x0'));var rs=require(_0xb0b8('0x1'));module[_0xb0b8('0x2')]={'name':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x4')},'key':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb0b8('0x3')]},'animation':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb0b8('0x9')](_0xb0b8('0xa'),_0xb0b8('0xb')),'defaultValue':_0xb0b8('0xa')},'header_online':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xc')},'start_chat_button':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xd')},'offline_chat_button':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xe')},'header_offline':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb0b8('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x13')},'closingMessageButton':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x14')},'conditionAgreement':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x15')},'ratingType':{'type':Sequelize[_0xb0b8('0x9')](_0xb0b8('0x16'),_0xb0b8('0x17')),'defaultValue':_0xb0b8('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':function(){return JSON[_0xb0b8('0x18')]({'items':[{'type':_0xb0b8('0x19'),'variable':null,'config':{'placeholder':_0xb0b8('0x1a'),'type':'text','required':!![]},'props':{'title':_0xb0b8('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xb0b8('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0b8('0x4'),'type':_0xb0b8('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb0b8('0x1b'))?JSON['parse'](this['getDataValue'](_0xb0b8('0x1b'))):{};},'set':function(_0x549c23){return this[_0xb0b8('0x1c')](_0xb0b8('0x1b'),JSON[_0xb0b8('0x18')](_0x549c23));}},'offlineForm':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':function(){return JSON[_0xb0b8('0x18')]({'items':[{'type':'input','props':{'title':_0xb0b8('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb0b8('0x4'),'type':_0xb0b8('0x4')},'variable':null},{'type':_0xb0b8('0x1d'),'config':{'placeholder':_0xb0b8('0x1e')},'props':{'title':_0xb0b8('0x1e'),'helpText':_0xb0b8('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xb0b8('0x20')](_0xb0b8('0x21'))?JSON[_0xb0b8('0x22')](this[_0xb0b8('0x20')]('offlineForm')):{};},'set':function(_0x495bf3){return this[_0xb0b8('0x1c')](_0xb0b8('0x21'),JSON[_0xb0b8('0x18')](_0x495bf3));}},'token':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':function(){return rs[_0xb0b8('0x23')]();}},'autoclose':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb0b8('0x3')]},'forwardOffline':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x27')},'skipUnmanaged':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x14')},'sendUnmanaged':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb0b8('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xb0b8('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x29')},'verticalAlignment':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2a')},'messagesAlignment':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2b')},'defaultTitle':{'type':Sequelize[_0xb0b8('0x3')]},'customerAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb0b8('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0b8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0b8('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb0b8('0x3')],'defaultValue':_0xb0b8('0x2d')},'systemAvatar':{'type':Sequelize[_0xb0b8('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0b8('0x7')],'comment':_0xb0b8('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![],'comment':_0xb0b8('0x2f'),'set':function(_0x3d94b8){if(!_0x3d94b8)this[_0xb0b8('0x1c')](_0xb0b8('0x30'),null);this[_0xb0b8('0x1c')](_0xb0b8('0x31'),_0x3d94b8);}},'vidaooEscalation':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb0b8('0x3')]},'vidaooTopic':{'type':Sequelize[_0xb0b8('0x3')],'allowNull':![],'defaultValue':_0xb0b8('0x32')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xb0b8('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xb0b8('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb0b8('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb0b8('0x11')]}}; \ No newline at end of file +var _0x1bbc=['randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','squared','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Send','Feedback','ENUM','star','stringify','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','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}}','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x1bbc,0x149));var _0xc1bb=function(_0x4beb99,_0x11fa63){_0x4beb99=_0x4beb99-0x0;var _0x3f8491=_0x1bbc[_0x4beb99];return _0x3f8491;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc1bb('0x0'));module[_0xc1bb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'unique':_0xc1bb('0x3')},'description':{'type':Sequelize[_0xc1bb('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0x4')},'mapKeyOffline':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x5')},'customerAlias':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'defaultValue':_0xc1bb('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'defaultValue':_0xc1bb('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'defaultValue':_0xc1bb('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc1bb('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc1bb('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xc1bb('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0xb')},'offline_chat_button':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0xc')},'download_transcript':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc1bb('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xc1bb('0xe')]},'closingQuestion':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x11')},'placeholderMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x12')},'closingMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0x13')},'skipMessageButton':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x14')},'ratingType':{'type':Sequelize[_0xc1bb('0x15')](_0xc1bb('0x16'),'thumb'),'defaultValue':_0xc1bb('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc1bb('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xc1bb('0x18'),'type':'text','required':!![]},'props':{'title':_0xc1bb('0x18'),'helpText':''}},{'type':_0xc1bb('0x19'),'props':{'title':_0xc1bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc1bb('0x4'),'type':_0xc1bb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xc1bb('0x1a')](_0xc1bb('0x1b'))?JSON[_0xc1bb('0x1c')](this['getDataValue'](_0xc1bb('0x1b'))):{};},'set':function(_0x252bcc){return this[_0xc1bb('0x1d')](_0xc1bb('0x1b'),JSON[_0xc1bb('0x17')](_0x252bcc));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc1bb('0x17')]({'items':[{'type':_0xc1bb('0x19'),'props':{'title':_0xc1bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xc1bb('0x4'),'type':_0xc1bb('0x4')},'variable':null},{'type':_0xc1bb('0x1e'),'config':{'placeholder':_0xc1bb('0x1f')},'props':{'title':'Comments','helpText':_0xc1bb('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xc1bb('0x1a')](_0xc1bb('0x21'))?JSON['parse'](this[_0xc1bb('0x1a')](_0xc1bb('0x21'))):{};},'set':function(_0x165bf7){return this[_0xc1bb('0x1d')](_0xc1bb('0x21'),JSON[_0xc1bb('0x17')](_0x165bf7));}},'token':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':function(){return rs[_0xc1bb('0x22')]();}},'autoclose':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc1bb('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc1bb('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x24')},'offlineMessageBody':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x26')},'skipUnmanaged':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x27')},'sendUnmanaged':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x13')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc1bb('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc1bb('0xe')],'defaultValue':function(){return _0xc1bb('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc1bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x29')},'verticalAlignment':{'type':Sequelize[_0xc1bb('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':_0xc1bb('0x2a')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0x2b')},'defaultTitle':{'type':Sequelize[_0xc1bb('0x2')]},'customerAvatar':{'type':Sequelize[_0xc1bb('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc1bb('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc1bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xc1bb('0x2c')},'systemAvatar':{'type':Sequelize[_0xc1bb('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc1bb('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a538f){if(!_0x2a538f)this[_0xc1bb('0x1d')]('mandatoryDispositionPauseId',null);this[_0xc1bb('0x1d')]('mandatoryDisposition',_0x2a538f);}},'vidaooEscalation':{'type':Sequelize[_0xc1bb('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xc1bb('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xc1bb('0x2')],'defaultValue':function(){return _0xc1bb('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xc1bb('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index df55292..4dc2823 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 _0x5611=['Contacts','DESC','ChatApplication','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','List','applications','orderBy','priority','asc','account','contact','headers','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','email','Smtp','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','URL','address','remote','x-real-ip','connection','referer','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','offlineForm','items','fromKey','Contact','Attachments','addAgents','omit','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','util','path','lodash','html-to-text','jayson/promise','url','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','ChatWebsites','UserProfileResource','destroy','stack','name','send','Command','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','get','all','user-agent-parser','setUA','user-agent','getResult','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','browser','version','unknown','%s\x20%s','device','%s\x20%s\x20%s','model','vendor','type','index','mandatoryDispositionPause','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','where','merge','options','ChatWebsite','includeAll','findAll','params','Pause','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','getDispositions','findOne','sort','ChatWebsiteId','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','showCustomerAvatar','server/files/images/avatars/','notify','CmContact','describe','Sequelize','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x299ec9,_0x1992db){var _0x4402fe=function(_0x5c75c9){while(--_0x5c75c9){_0x299ec9['push'](_0x299ec9['shift']());}};_0x4402fe(++_0x1992db);}(_0x5611,0x7c));var _0x1561=function(_0xd34b6e,_0x4ba79c){_0xd34b6e=_0xd34b6e-0x0;var _0x51f242=_0x5611[_0xd34b6e];return _0x51f242;};'use strict';var Mustache=require(_0x1561('0x0'));var util=require(_0x1561('0x1'));var path=require(_0x1561('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1561('0x3'));var querystring=require('querystring');var htmlToText=require(_0x1561('0x4'));var Redis=require('ioredis');var jayson=require(_0x1561('0x5'));var url=require(_0x1561('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x1561('0x7'))(_0x1561('0x8'));var config=require(_0x1561('0x9'));var APIOutOfIntervalError=require(_0x1561('0xa'))[_0x1561('0xb')];var APINotFoundError=require('../../errors/api')[_0x1561('0xc')];var APIHandleError=require(_0x1561('0xa'))[_0x1561('0xd')];var db=require(_0x1561('0xe'))['db'];config['redis']=_[_0x1561('0xf')](config['redis'],{'host':_0x1561('0x10'),'port':0x18eb});var socket=require(_0x1561('0x11'))(new Redis(config['redis']));require(_0x1561('0x12'))[_0x1561('0x13')](socket);var client=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232c});var client9002=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232a});var client9003=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x232b});var client9001=jayson[_0x1561('0x14')][_0x1561('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x4798c9,_0x558fc0,_0x14c41b,_0x25f8cb){return new Promise(function(_0x3400e8,_0x19e3f3){var _0x157ebc=_0x25f8cb||client;return _0x157ebc[_0x1561('0x16')](_0x4798c9,_0x14c41b)[_0x1561('0x17')](function(_0x2d9fa8){logger['info'](_0x1561('0x18'),_0x558fc0,_0x1561('0x19'));logger[_0x1561('0x1a')](_0x1561('0x1b'),_0x558fc0,_0x1561('0x19'),JSON[_0x1561('0x1c')](_0x2d9fa8));if(_0x2d9fa8[_0x1561('0x1d')]){if(_0x2d9fa8['error'][_0x1561('0x1e')]===0x1f4){logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x2d9fa8[_0x1561('0x1d')]['message']);return _0x19e3f3(_0x2d9fa8[_0x1561('0x1d')][_0x1561('0x1f')]);}logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x2d9fa8['error'][_0x1561('0x1f')]);return _0x3400e8(_0x2d9fa8[_0x1561('0x1d')][_0x1561('0x1f')]);}else{logger[_0x1561('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x558fc0,_0x1561('0x19'));_0x3400e8(_0x2d9fa8[_0x1561('0x21')]['message']);}})[_0x1561('0x22')](function(_0x209c8d){logger[_0x1561('0x1d')](_0x1561('0x18'),_0x558fc0,_0x209c8d);_0x19e3f3(_0x209c8d);});});}function respondWithStatusCode(_0x1324ff,_0x4a01a3){_0x4a01a3=_0x4a01a3||0xcc;return function(_0x1a4b32){if(_0x1a4b32){return _0x1324ff[_0x1561('0x23')](_0x4a01a3);}return _0x1324ff[_0x1561('0x24')](_0x4a01a3)[_0x1561('0x25')]();};}function respondWithResult(_0x4d8e5e,_0x118931){_0x118931=_0x118931||0xc8;return function(_0x276905){if(_0x276905){return _0x4d8e5e['status'](_0x118931)[_0x1561('0x26')](_0x276905);}};}function respondWithFilteredResult(_0x7a0c2f,_0x336189){return function(_0x26337c){if(_0x26337c){var _0x118d05=typeof _0x336189[_0x1561('0x27')]===_0x1561('0x28')&&typeof _0x336189[_0x1561('0x29')]===_0x1561('0x28');var _0x20e8fd=_0x26337c[_0x1561('0x2a')];var _0x5d6ab2=_0x118d05?0x0:_0x336189[_0x1561('0x27')];var _0x780404=_0x118d05?_0x26337c[_0x1561('0x2a')]:_0x336189[_0x1561('0x27')]+_0x336189['limit'];var _0x50adf5;if(_0x780404>=_0x20e8fd){_0x780404=_0x20e8fd;_0x50adf5=0xc8;}else{_0x50adf5=0xce;}_0x7a0c2f[_0x1561('0x24')](_0x50adf5);return _0x7a0c2f['set'](_0x1561('0x2b'),_0x5d6ab2+'-'+_0x780404+'/'+_0x20e8fd)[_0x1561('0x26')](_0x26337c);}return null;};}function saveUpdates(_0x4272b7){return function(_0x51cb3f){if(_0x51cb3f){return _0x51cb3f[_0x1561('0x2c')](_0x4272b7)['then'](function(_0x10efe8){return _0x10efe8;});}return null;};}function removeEntity(_0x2fdb32){return function(_0x4b005b){if(_0x4b005b){return _0x4b005b['destroy']()['then'](function(){var _0x5ec5c9=_0x4b005b['get']({'plain':!![]});var _0x3e602a=_0x1561('0x2d');return db[_0x1561('0x2e')][_0x1561('0x2f')]({'where':{'type':_0x3e602a,'resourceId':_0x5ec5c9['id']}})['then'](function(){return _0x4b005b;});})[_0x1561('0x17')](function(){_0x2fdb32[_0x1561('0x24')](0xcc)[_0x1561('0x25')]();});}};}function handleEntityNotFound(_0x4b4bca){return function(_0x2ddcd3){if(!_0x2ddcd3){_0x4b4bca['sendStatus'](0x194);}return _0x2ddcd3;};}function handleError(_0x489383,_0x4847f4){_0x4847f4=_0x4847f4||0x1f4;return function(_0x3f35bd){logger['error'](_0x3f35bd[_0x1561('0x30')]);if(_0x3f35bd[_0x1561('0x31')]){delete _0x3f35bd[_0x1561('0x31')];}_0x489383['status'](_0x4847f4)[_0x1561('0x32')](_0x3f35bd);};}function iftimePromise(_0x1df4db,_0x422a42){return respondWithRpcPromise(_0x1561('0x33'),'getSnippet',{'command':_0x422a42[_0x1561('0x34')]?util[_0x1561('0x35')](_0x1561('0x36'),_0x1df4db[_0x1561('0x37')],_0x422a42['timezone']):util[_0x1561('0x35')](_0x1561('0x38'),_0x1df4db[_0x1561('0x37')])},client9002)['then'](function(_0x2232ad){var _0x2244d7=_0x2232ad&&_0x2232ad[_0x1561('0x39')](_0x1561('0x3a'))>=0x0?!![]:![];logger[_0x1561('0x20')](_0x1561('0x3b'),_0x422a42['id'],_0x1df4db['id'],_0x1df4db[_0x1561('0x37')],_0x2244d7?_0x1561('0x3c'):_0x1561('0x3d'),_0x422a42[_0x1561('0x34')]?_0x422a42[_0x1561('0x34')]:'No\x20timezone');return _0x2244d7;})['catch'](function(_0x5e6248){logger[_0x1561('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x422a42['id'],_0x1df4db['id'],_0x1df4db['interval'],util['inspect'](_0x5e6248,{'showHidden':![],'depth':null}),_0x422a42[_0x1561('0x34')]?_0x422a42['timezone']:_0x1561('0x3e'));return![];});}function checkWebsiteIntervals(_0x332551){var _0x6bd523=_[_0x1561('0x3f')](_0x332551[_0x1561('0x40')][_0x1561('0x41')],function(_0x4e26ae){var _0x4ff0c3=_0x4e26ae[_0x1561('0x42')]({'plain':!![]});return iftimePromise(_0x4ff0c3,_0x332551);});return Promise[_0x1561('0x43')](_0x6bd523)[_0x1561('0x17')](function(_0x54685f){return _['some'](_0x54685f);});}function createInteractionObject(_0x1f2055,_0xc564b,_0x28d772,_0x1ea721){var _0x280f5b=require(_0x1561('0x44'));var _0x14e7d1=new _0x280f5b();var _0x371dab=_0x14e7d1[_0x1561('0x45')](_0x28d772[_0x1561('0x46')])[_0x1561('0x47')]();var _0x3b93b5=_0xc564b['customerIp'];if(_0x28d772['cf-connecting-ip']){_0x3b93b5=_0x28d772[_0x1561('0x48')];}else if(_0x28d772['x-forwarded-for']){_0x3b93b5=_[_0x1561('0x49')](_0x28d772[_0x1561('0x4a')][_0x1561('0x4b')](','));}return{'ContactId':_0x1ea721['id'],'ChatWebsiteId':_0x1f2055,'from':(_0x1ea721[_0x1561('0x4c')]||'')+'\x20'+(_0x1ea721[_0x1561('0x4d')]||''),'customerIp':_0x3b93b5,'customerPort':_0x28d772['x-real-port']?_0x28d772['x-real-port']:null,'referer':_0xc564b['referer'],'browserName':_0x371dab[_0x1561('0x4e')][_0x1561('0x31')]&&_0x371dab[_0x1561('0x4e')][_0x1561('0x4f')]?util[_0x1561('0x35')]('%s\x20%s',_0x371dab[_0x1561('0x4e')][_0x1561('0x31')],_0x371dab[_0x1561('0x4e')][_0x1561('0x4f')]):_0x1561('0x50'),'browserVersion':_0x371dab['browser'][_0x1561('0x4f')]||_0x1561('0x50'),'osName':util[_0x1561('0x35')](_0x1561('0x51'),_0x371dab['os']['name'],_0x371dab['os'][_0x1561('0x4f')]),'osVersion':_0x371dab['os']['version'],'deviceModel':_0x371dab[_0x1561('0x52')]['model']&&_0x371dab[_0x1561('0x52')]['vendor']?util['format'](_0x1561('0x53'),_0x371dab[_0x1561('0x52')][_0x1561('0x54')],_0x371dab['device'][_0x1561('0x55')],_0x371dab[_0x1561('0x52')][_0x1561('0x56')]):null,'deviceVendor':_0x371dab[_0x1561('0x52')][_0x1561('0x55')],'deviceType':_0x371dab[_0x1561('0x52')][_0x1561('0x56')],'formData':JSON[_0x1561('0x1c')](_0xc564b)};}exports[_0x1561('0x57')]=function(_0x2f6eec,_0x1da955){var _0x163d3d={'include':[{'model':db['Pause'],'as':_0x1561('0x58')}]},_0x38e8f6={},_0xb4d577={'count':0x0,'rows':[]};var _0x56f74e=_[_0x1561('0x3f')](db['ChatWebsite'][_0x1561('0x59')],function(_0x3fbb38){return{'name':_0x3fbb38[_0x1561('0x5a')],'type':_0x3fbb38['type']['key']};});_0x38e8f6['model']=_[_0x1561('0x3f')](_0x56f74e,_0x1561('0x31'));_0x38e8f6[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x2f6eec[_0x1561('0x5b')]);_0x38e8f6[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x38e8f6[_0x1561('0x54')],_0x38e8f6[_0x1561('0x5b')]);_0x163d3d['attributes']=_[_0x1561('0x5e')](_0x38e8f6[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x2f6eec[_0x1561('0x5b')][_0x1561('0x5f')]));_0x163d3d[_0x1561('0x60')]=_0x163d3d[_0x1561('0x60')][_0x1561('0x61')]?_0x163d3d[_0x1561('0x60')]:_0x38e8f6['model'];if(!_0x2f6eec['query'][_0x1561('0x62')]('nolimit')){_0x163d3d['limit']=qs[_0x1561('0x29')](_0x2f6eec[_0x1561('0x5b')][_0x1561('0x29')]);_0x163d3d[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x2f6eec['query'][_0x1561('0x27')]);}_0x163d3d[_0x1561('0x63')]=qs['sort'](_0x2f6eec['query']['sort']);_0x163d3d['where']=qs['filters'](_[_0x1561('0x64')](_0x2f6eec[_0x1561('0x5b')],_0x38e8f6['filters']),_0x56f74e);if(_0x2f6eec[_0x1561('0x5b')][_0x1561('0x65')]){_0x163d3d[_0x1561('0x66')]=_[_0x1561('0x67')](_0x163d3d[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x56f74e,function(_0x2d8f76){if(_0x2d8f76[_0x1561('0x56')]!=='VIRTUAL'){var _0x52fd60={};_0x52fd60[_0x2d8f76[_0x1561('0x31')]]={'$like':'%'+_0x2f6eec[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x52fd60;}})});}_0x163d3d=_[_0x1561('0x67')]({},_0x163d3d,_0x2f6eec[_0x1561('0x68')]);var _0x418ca5={'where':_0x163d3d[_0x1561('0x66')]};return db[_0x1561('0x69')]['count'](_0x418ca5)[_0x1561('0x17')](function(_0x9bad5a){_0xb4d577[_0x1561('0x2a')]=_0x9bad5a;if(_0x2f6eec[_0x1561('0x5b')][_0x1561('0x6a')]){_0x163d3d['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x1561('0x6b')](_0x163d3d);})[_0x1561('0x17')](function(_0x2fb70e){_0xb4d577['rows']=_0x2fb70e;return _0xb4d577;})['then'](respondWithFilteredResult(_0x1da955,_0x163d3d))[_0x1561('0x22')](handleError(_0x1da955,null));};exports['show']=function(_0x19ac9a,_0x3bd2f6){var _0x5d96ad={'raw':![],'where':{'id':_0x19ac9a[_0x1561('0x6c')]['id']},'include':[{'model':db[_0x1561('0x6d')],'as':_0x1561('0x58')}]},_0x50e4bf={};_0x50e4bf['model']=_[_0x1561('0x5c')](db[_0x1561('0x69')][_0x1561('0x59')]);_0x50e4bf[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x19ac9a[_0x1561('0x5b')]);_0x50e4bf[_0x1561('0x5d')]=_['intersection'](_0x50e4bf[_0x1561('0x54')],_0x50e4bf[_0x1561('0x5b')]);_0x5d96ad[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x50e4bf[_0x1561('0x54')],qs['fields'](_0x19ac9a[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5d96ad[_0x1561('0x60')]=_0x5d96ad[_0x1561('0x60')][_0x1561('0x61')]?_0x5d96ad[_0x1561('0x60')]:_0x50e4bf[_0x1561('0x54')];if(_0x19ac9a[_0x1561('0x5b')][_0x1561('0x6a')]){_0x5d96ad[_0x1561('0x6e')]=[{'all':!![]}];}_0x5d96ad=_[_0x1561('0x67')]({},_0x5d96ad,_0x19ac9a[_0x1561('0x68')]);return db[_0x1561('0x69')][_0x1561('0x6f')](_0x5d96ad)[_0x1561('0x17')](handleEntityNotFound(_0x3bd2f6,null))[_0x1561('0x17')](respondWithResult(_0x3bd2f6,null))[_0x1561('0x22')](handleError(_0x3bd2f6,null));};exports[_0x1561('0x70')]=function(_0xc185dc,_0x2ab30d){return db[_0x1561('0x69')][_0x1561('0x70')](_0xc185dc['body'],{})['then'](function(_0x11b478){var _0x27757a=_0xc185dc[_0x1561('0x71')]['get']({'plain':!![]});if(!_0x27757a)throw new Error(_0x1561('0x72'));if(_0x27757a[_0x1561('0x73')]===_0x1561('0x71')){var _0x43b698=_0x11b478[_0x1561('0x42')]({'plain':!![]});var _0x3ea798='ChatWebsites';return db['UserProfileSection'][_0x1561('0x6f')]({'where':{'name':_0x3ea798,'userProfileId':_0x27757a[_0x1561('0x74')]},'raw':!![]})[_0x1561('0x17')](function(_0x1d5dbe){if(_0x1d5dbe&&_0x1d5dbe[_0x1561('0x75')]===0x0){return db[_0x1561('0x2e')][_0x1561('0x70')]({'name':_0x43b698[_0x1561('0x31')],'resourceId':_0x43b698['id'],'type':_0x1d5dbe[_0x1561('0x31')],'sectionId':_0x1d5dbe['id']},{})[_0x1561('0x17')](function(){return _0x11b478;});}else{return _0x11b478;}})[_0x1561('0x22')](function(_0x6ef25f){logger['error'](_0x1561('0x76'),_0x6ef25f);throw _0x6ef25f;});}return _0x11b478;})['then'](respondWithResult(_0x2ab30d,0xc9))[_0x1561('0x22')](handleError(_0x2ab30d,null));};exports[_0x1561('0x2c')]=function(_0x14e31e,_0xf4b317){if(_0x14e31e[_0x1561('0x77')]['id']){delete _0x14e31e[_0x1561('0x77')]['id'];}return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x14e31e['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xf4b317,null))[_0x1561('0x17')](saveUpdates(_0x14e31e['body'],null))[_0x1561('0x17')](respondWithResult(_0xf4b317,null))[_0x1561('0x22')](handleError(_0xf4b317,null));};exports[_0x1561('0x2f')]=function(_0x228235,_0x2a6cd4){return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x228235['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x2a6cd4,null))[_0x1561('0x17')](removeEntity(_0x2a6cd4,null))['catch'](handleError(_0x2a6cd4,null));};exports['describe']=function(_0x4e060b,_0x3eb78d){return db[_0x1561('0x69')]['describe']()[_0x1561('0x17')](respondWithResult(_0x3eb78d,null))[_0x1561('0x22')](handleError(_0x3eb78d,null));};exports[_0x1561('0x78')]=function(_0x336954,_0x35c92e){if(_0x336954['body']['id']){delete _0x336954['body']['id'];}return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x336954[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x35c92e,null))[_0x1561('0x17')](function(_0x4f3397){if(_0x4f3397){_0x336954['body']['ChatWebsiteId']=_0x4f3397['id'];return db['Disposition'][_0x1561('0x70')](_0x336954[_0x1561('0x77')]);}})[_0x1561('0x17')](respondWithResult(_0x35c92e,null))[_0x1561('0x22')](handleError(_0x35c92e,null));};exports[_0x1561('0x79')]=function(_0xb50dae,_0x5a0143){var _0x4c33b9={'raw':![],'where':{}};var _0x4bee5d={};var _0x5bba97={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0xb50dae[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x5a0143,null))['then'](function(_0x22b8b3){if(_0x22b8b3){_0x4bee5d['model']=_[_0x1561('0x5c')](db['Disposition'][_0x1561('0x59')]);_0x4bee5d['query']=_['keys'](_0xb50dae[_0x1561('0x5b')]);_0x4bee5d[_0x1561('0x5d')]=_['intersection'](_0x4bee5d[_0x1561('0x54')],_0x4bee5d[_0x1561('0x5b')]);_0x4c33b9[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x4bee5d[_0x1561('0x54')],qs[_0x1561('0x5f')](_0xb50dae[_0x1561('0x5b')][_0x1561('0x5f')]));_0x4c33b9[_0x1561('0x60')]=_0x4c33b9['attributes'][_0x1561('0x61')]?_0x4c33b9[_0x1561('0x60')]:_0x4bee5d['model'];if(!_0xb50dae['query'][_0x1561('0x62')]('nolimit')){_0x4c33b9[_0x1561('0x29')]=qs[_0x1561('0x29')](_0xb50dae['query']['limit']);_0x4c33b9['offset']=qs[_0x1561('0x27')](_0xb50dae[_0x1561('0x5b')][_0x1561('0x27')]);}_0x4c33b9[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0xb50dae['query'][_0x1561('0x7b')]);_0x4c33b9[_0x1561('0x66')]=qs['filters'](_[_0x1561('0x64')](_0xb50dae['query'],_0x4bee5d[_0x1561('0x5d')]));_0x4c33b9[_0x1561('0x66')][_0x1561('0x7c')]=_0x22b8b3['id'];if(_0xb50dae[_0x1561('0x5b')][_0x1561('0x65')]){_0x4c33b9[_0x1561('0x66')]=_[_0x1561('0x67')](_0x4c33b9[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x4c33b9[_0x1561('0x60')],function(_0x58d7aa){var _0x4f7966={};_0x4f7966[_0x58d7aa]={'$like':'%'+_0xb50dae[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x4f7966;})});}_0x4c33b9=_[_0x1561('0x67')]({},_0x4c33b9,_0xb50dae[_0x1561('0x68')]);return db[_0x1561('0x7d')][_0x1561('0x2a')]({'where':_0x4c33b9[_0x1561('0x66')]})[_0x1561('0x17')](function(_0x2a2ca4){_0x5bba97[_0x1561('0x2a')]=_0x2a2ca4;if(_0xb50dae['query'][_0x1561('0x6a')]){_0x4c33b9[_0x1561('0x6e')]=[{'all':!![]}];}return db[_0x1561('0x7d')][_0x1561('0x6b')](_0x4c33b9);})[_0x1561('0x17')](function(_0x4ee1dd){_0x5bba97[_0x1561('0x7e')]=_0x4ee1dd;return _0x5bba97;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x5a0143,_0x4c33b9))[_0x1561('0x22')](handleError(_0x5a0143,null));};exports[_0x1561('0x7f')]=function(_0x2395a2,_0x45a96e){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x2395a2[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x45a96e,null))[_0x1561('0x17')](function(_0x30e7f4){if(_0x30e7f4){return _0x30e7f4[_0x1561('0x7f')](_0x2395a2['query']['ids']);}})[_0x1561('0x17')](respondWithStatusCode(_0x45a96e,null))[_0x1561('0x22')](handleError(_0x45a96e,null));};exports[_0x1561('0x80')]=function(_0x517c21,_0x313c96){if(_0x517c21[_0x1561('0x77')]['id']){delete _0x517c21[_0x1561('0x77')]['id'];}return db[_0x1561('0x69')]['find']({'where':{'id':_0x517c21[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x313c96,null))[_0x1561('0x17')](function(_0x1d5096){if(_0x1d5096){_0x517c21[_0x1561('0x77')][_0x1561('0x7c')]=_0x1d5096['id'];return db[_0x1561('0x81')][_0x1561('0x70')](_0x517c21[_0x1561('0x77')]);}})[_0x1561('0x17')](respondWithResult(_0x313c96,null))[_0x1561('0x22')](handleError(_0x313c96,null));};exports[_0x1561('0x82')]=function(_0x21aff2,_0x3a15e5){var _0x3485c4={'raw':![],'where':{}};var _0x481c7d={};var _0x37ac38={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x21aff2[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3a15e5,null))[_0x1561('0x17')](function(_0x56d943){if(_0x56d943){_0x481c7d[_0x1561('0x54')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x481c7d[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x21aff2[_0x1561('0x5b')]);_0x481c7d['filters']=_[_0x1561('0x5e')](_0x481c7d['model'],_0x481c7d['query']);_0x3485c4[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x481c7d[_0x1561('0x54')],qs['fields'](_0x21aff2[_0x1561('0x5b')][_0x1561('0x5f')]));_0x3485c4['attributes']=_0x3485c4['attributes']['length']?_0x3485c4[_0x1561('0x60')]:_0x481c7d[_0x1561('0x54')];if(!_0x21aff2['query']['hasOwnProperty'](_0x1561('0x83'))){_0x3485c4[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x21aff2['query'][_0x1561('0x29')]);_0x3485c4['offset']=qs[_0x1561('0x27')](_0x21aff2['query']['offset']);}_0x3485c4['order']=qs['sort'](_0x21aff2[_0x1561('0x5b')][_0x1561('0x7b')]);_0x3485c4[_0x1561('0x66')]=qs['filters'](_[_0x1561('0x64')](_0x21aff2['query'],_0x481c7d[_0x1561('0x5d')]));_0x3485c4[_0x1561('0x66')][_0x1561('0x7c')]=_0x56d943['id'];if(_0x21aff2['query'][_0x1561('0x65')]){_0x3485c4[_0x1561('0x66')]=_[_0x1561('0x67')](_0x3485c4[_0x1561('0x66')],{'$or':_['map'](_0x3485c4[_0x1561('0x60')],function(_0x56ff77){var _0x3a8cd0={};_0x3a8cd0[_0x56ff77]={'$like':'%'+_0x21aff2[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x3a8cd0;})});}_0x3485c4=_[_0x1561('0x67')]({},_0x3485c4,_0x21aff2[_0x1561('0x68')]);return db[_0x1561('0x81')][_0x1561('0x2a')]({'where':_0x3485c4[_0x1561('0x66')]})[_0x1561('0x17')](function(_0x4d8364){_0x37ac38['count']=_0x4d8364;if(_0x21aff2[_0x1561('0x5b')][_0x1561('0x6a')]){_0x3485c4[_0x1561('0x6e')]=[{'all':!![]}];}return db[_0x1561('0x81')][_0x1561('0x6b')](_0x3485c4);})['then'](function(_0x19b8b1){_0x37ac38['rows']=_0x19b8b1;return _0x37ac38;});}})['then'](respondWithFilteredResult(_0x3a15e5,_0x3485c4))['catch'](handleError(_0x3a15e5,null));};exports[_0x1561('0x84')]=function(_0x796fe8,_0xc323a7){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x796fe8[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0xc323a7,null))[_0x1561('0x17')](function(_0x5dc259){if(_0x5dc259){return _0x5dc259[_0x1561('0x84')](_0x796fe8[_0x1561('0x5b')][_0x1561('0x85')]);}})[_0x1561('0x17')](respondWithStatusCode(_0xc323a7,null))['catch'](handleError(_0xc323a7,null));};exports[_0x1561('0x86')]=function(_0x147748,_0x1de350){_0x147748[_0x1561('0x77')][_0x1561('0x87')]=_0x147748[_0x1561('0x88')][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x147748[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x1de350,null))[_0x1561('0x17')](saveUpdates(_0x147748[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x1de350,null))[_0x1561('0x22')](handleError(_0x1de350,null));};exports[_0x1561('0x8a')]=function(_0x3cdfef,_0x5405bc){_0x3cdfef[_0x1561('0x77')][_0x1561('0x8b')]=_0x3cdfef['file'][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x3cdfef[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x5405bc,null))[_0x1561('0x17')](saveUpdates(_0x3cdfef[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x5405bc,null))[_0x1561('0x22')](handleError(_0x5405bc,null));};exports[_0x1561('0x8c')]=function(_0x5282b0,_0x47c93a){_0x5282b0[_0x1561('0x77')][_0x1561('0x8d')]=_0x5282b0['file']['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x5282b0[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x47c93a,null))[_0x1561('0x17')](saveUpdates(_0x5282b0[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x47c93a,null))[_0x1561('0x22')](handleError(_0x47c93a,null));};exports[_0x1561('0x8e')]=function(_0x33fe37,_0x17d3a5){_0x33fe37['body'][_0x1561('0x8f')]=_0x33fe37[_0x1561('0x88')][_0x1561('0x89')];return db[_0x1561('0x69')]['find']({'where':{'id':_0x33fe37['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x17d3a5,null))[_0x1561('0x17')](saveUpdates(_0x33fe37[_0x1561('0x77')],null))[_0x1561('0x17')](respondWithResult(_0x17d3a5,null))[_0x1561('0x22')](handleError(_0x17d3a5,null));};exports[_0x1561('0x90')]=function(_0x494ee7,_0xc79403){var _0x192e78=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/logos/default_logo.svg');var _0x2dcb71={'where':{'id':_0x494ee7[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x87')],'raw':!![]};var _0x4e4565=![];return require(_0x1561('0x93'))[_0x1561('0x94')]()[_0x1561('0x17')](function(_0x1ab77e){if(_0x1ab77e){_0x4e4565=_0x1ab77e[_0x1561('0x95')];}})['then'](function(){return db[_0x1561('0x69')][_0x1561('0x6f')](_0x2dcb71);})[_0x1561('0x17')](handleEntityNotFound(_0xc79403,null))[_0x1561('0x17')](function(_0x55e0fd){if(_0x55e0fd){if(!_[_0x1561('0x96')](_0x55e0fd[_0x1561('0x87')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x98'),_0x55e0fd[_0x1561('0x87')]))&&_0x4e4565){_0x192e78=path[_0x1561('0x91')](config['root'],_0x1561('0x98'),_0x55e0fd[_0x1561('0x87')]);}}return _0xc79403[_0x1561('0x99')](_0x192e78);}})[_0x1561('0x22')](handleError(_0xc79403,null));};exports[_0x1561('0x9a')]=function(_0x33b318,_0x5cbce0){var _0x23e0d8=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/default_avatar.png');var _0x400859={'where':{'id':_0x33b318['params']['id']},'attributes':['id',_0x1561('0x8b')],'raw':!![]};return db[_0x1561('0x69')][_0x1561('0x6f')](_0x400859)[_0x1561('0x17')](handleEntityNotFound(_0x5cbce0,null))[_0x1561('0x17')](function(_0x34c621){if(_0x34c621){if(!_[_0x1561('0x96')](_0x34c621[_0x1561('0x8b')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config['root'],'server/files/images/avatars/',_0x34c621['agentAvatar']))){_0x23e0d8=path[_0x1561('0x91')](config['root'],'server/files/images/avatars/',_0x34c621[_0x1561('0x8b')]);}}return _0x5cbce0[_0x1561('0x99')](_0x23e0d8);}})['catch'](handleError(_0x5cbce0,null));};exports['getCustomerAvatar']=function(_0x2e99f8,_0x206df1){var _0x10fc33=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/customer_avatar.png');var _0x162af2={'where':{'id':_0x2e99f8[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x8d'),_0x1561('0x9b')],'raw':!![]};return db[_0x1561('0x69')]['find'](_0x162af2)['then'](handleEntityNotFound(_0x206df1,null))[_0x1561('0x17')](function(_0x3d9a95){if(_0x3d9a95){if(!_['isNil'](_0x3d9a95[_0x1561('0x8d')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x3d9a95[_0x1561('0x8d')]))&&_0x3d9a95[_0x1561('0x9b')]){_0x10fc33=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/',_0x3d9a95[_0x1561('0x8d')]);}}return _0x206df1[_0x1561('0x99')](_0x10fc33);}})[_0x1561('0x22')](handleError(_0x206df1,null));};exports['getSystemAvatar']=function(_0x1fc423,_0x9b9863){var _0x46ee01=path[_0x1561('0x91')](config[_0x1561('0x92')],'server/files/images/avatars/system_avatar.png');var _0x58aaf5={'where':{'id':_0x1fc423[_0x1561('0x6c')]['id']},'attributes':['id',_0x1561('0x8f')],'raw':!![]};return db[_0x1561('0x69')]['find'](_0x58aaf5)['then'](handleEntityNotFound(_0x9b9863,null))['then'](function(_0x2885e0){if(_0x2885e0){if(!_[_0x1561('0x96')](_0x2885e0[_0x1561('0x8f')])){if(fs[_0x1561('0x97')](path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x2885e0[_0x1561('0x8f')]))){_0x46ee01=path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0x9c'),_0x2885e0[_0x1561('0x8f')]);}}return _0x9b9863['download'](_0x46ee01);}})[_0x1561('0x22')](handleError(_0x9b9863,null));};exports[_0x1561('0x9d')]=function(_0x2ff53c,_0xdcac39){var _0x3f3642={'body':_0x2ff53c[_0x1561('0x77')],'channel':'chat'};var _0xfa2a50=[];var _0x95b3ad=[];var _0x548ccd={};var _0x59d7e8=![];return db[_0x1561('0x9e')][_0x1561('0x9f')]()[_0x1561('0x17')](function(_0x20c34a){if(!_0x20c34a){throw new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xa1'));}_0xfa2a50=_['difference'](_['keys'](_0x20c34a),['createdAt',_0x1561('0xa2')]);_0x95b3ad=_[_0x1561('0xa3')](_[_0x1561('0x5c')](_0x20c34a),[_0x1561('0xa4'),_0x1561('0xa2'),_0x1561('0xa5'),_0x1561('0xa6')]);if(_0x2ff53c[_0x1561('0x77')]['id']){delete _0x2ff53c['body']['id'];}if(_[_0x1561('0x96')](_0x2ff53c['body'][_0x1561('0xa7')])){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa9'));}if(_[_0x1561('0x96')](_0x2ff53c[_0x1561('0x77')][_0x1561('0x77')])||_0x2ff53c['body']['body']===''){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')])){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xab')+_0x95b3ad);}if(!_[_0x1561('0xac')](_0x95b3ad,_0x2ff53c['body'][_0x1561('0xaa')])){throw new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xad')+_0x95b3ad);}_0x548ccd[_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')]]=_0x2ff53c['body'][_0x1561('0xa7')];})[_0x1561('0x17')](function(){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x2ff53c[_0x1561('0x6c')]['id']},'include':[{'model':db[_0x1561('0xae')],'as':'List','include':[{'model':db[_0x1561('0x9e')],'as':_0x1561('0xaf'),'where':_0x548ccd,'limit':0x1,'order':[[_0x1561('0xa2'),_0x1561('0xb0')]]}]},{'model':db[_0x1561('0xb1')],'as':_0x1561('0xb2')},{'model':db[_0x1561('0x40')],'as':_0x1561('0x40'),'include':[{'model':db[_0x1561('0x40')],'as':'Intervals','attributes':['id',_0x1561('0x37')],'raw':!![]}]}]});})[_0x1561('0x17')](function(_0x1e45c8){if(!_0x1e45c8)throw new APINotFoundError(util[_0x1561('0x35')](_0x1561('0xb3'),_0x2ff53c['params']['id']));if(!_0x1e45c8[_0x1561('0x40')]||!_0x1e45c8[_0x1561('0x40')][_0x1561('0x41')])return[_0x1e45c8,!![]];return[_0x1e45c8,checkWebsiteIntervals(_0x1e45c8)];})[_0x1561('0xb4')](function(_0x1b6008,_0x318ab4){if(!_0x318ab4)throw new APIOutOfIntervalError();if(!_0x1b6008[_0x1561('0xb5')])return;_0x3f3642['account']=_0x1b6008;_0x3f3642['list']=_0x1b6008[_0x1561('0xb5')];_0x3f3642[_0x1561('0xb6')]=_[_0x1561('0xb7')](_0x1b6008[_0x1561('0xb2')],[_0x1561('0xb8')],[_0x1561('0xb9')]);if(_0x3f3642[_0x1561('0xba')]['Applications']){delete _0x3f3642['account']['Applications'];}if(_0x3f3642['account'][_0x1561('0xb5')]&&_0x3f3642[_0x1561('0xba')][_0x1561('0xb5')][_0x1561('0xaf')]['length']){return _0x3f3642['account'][_0x1561('0xb5')][_0x1561('0xaf')][0x0];}var _0x9ba11c=_[_0x1561('0xf')](_0x2ff53c[_0x1561('0x77')],{'firstName':_0x2ff53c[_0x1561('0x77')]['from'],'ListId':_0x1b6008[_0x1561('0xa6')]});_0x9ba11c[_0x2ff53c[_0x1561('0x77')][_0x1561('0xaa')]]=_0x2ff53c[_0x1561('0x77')]['from'];return db[_0x1561('0x9e')]['create'](_0x9ba11c,{'fields':_0xfa2a50,'raw':!![]});})[_0x1561('0x17')](function(_0x11716f){_0x3f3642[_0x1561('0xbb')]=_0x11716f;var _0x43c516=createInteractionObject(_0x2ff53c['params']['id'],_0x2ff53c[_0x1561('0x77')],_0x2ff53c[_0x1561('0xbc')],_0x11716f);var _0x47f469={'ChatWebsiteId':_0x2ff53c[_0x1561('0x6c')]['id'],'closed':![]};if(_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')]){_0x47f469[_0x1561('0xbd')]=_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')];return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':_0x47f469})[_0x1561('0x17')](function(_0x1cfabd){if(_0x1cfabd){_0x59d7e8=!![];return _0x1cfabd;}_0x43c516['threadId']=_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')];_0x43c516['externalUrl']=_0x2ff53c['body'][_0x1561('0xbf')];return db[_0x1561('0xbe')]['create'](_0x43c516);});}_0x47f469['ContactId']=_0x11716f['id'];if(_0x2ff53c[_0x1561('0x77')]['interaction']&&_0x2ff53c['body'][_0x1561('0xc0')]['id']){_0x47f469['id']=_0x2ff53c[_0x1561('0x77')][_0x1561('0xc0')]['id'];return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':_0x47f469})[_0x1561('0x17')](function(_0x59b465){if(_0x59b465){_0x59d7e8=!![];return _0x59b465;}return db[_0x1561('0xbe')]['create'](_0x43c516);});}return db['ChatInteraction']['create'](_0x43c516);})[_0x1561('0x17')](function(_0x4bfe55){if(!_0x59d7e8)return _0x4bfe55;var _0x4144b4={'from':(_0x3f3642[_0x1561('0xbb')][_0x1561('0x4c')]||'')+'\x20'+(_0x3f3642['contact'][_0x1561('0x4d')]||'')};if(_0x2ff53c[_0x1561('0x77')][_0x1561('0xbd')]&&_0x2ff53c[_0x1561('0x77')][_0x1561('0xc1')]&&_0x2ff53c['body']['threadId']!=_0x2ff53c[_0x1561('0x77')][_0x1561('0xc1')]){_0x4144b4[_0x1561('0xbd')]=_0x2ff53c['body'][_0x1561('0xc1')];}return _0x4bfe55[_0x1561('0x2c')](_0x4144b4);})[_0x1561('0x17')](function(_0x43537d){_0x3f3642[_0x1561('0xc0')]=_0x43537d[_0x1561('0x42')]({'plain':!![]});_0x3f3642['interaction'][_0x1561('0xc2')]=!_0x59d7e8;if(_0x3f3642[_0x1561('0xc0')][_0x1561('0xc2')]){if(_0x3f3642[_0x1561('0xba')][_0x1561('0xc3')]){_0x3f3642[_0x1561('0xb6')][_0x1561('0xc4')]({'id':0x0,'priority':_0x3f3642[_0x1561('0xb6')][_0x1561('0x61')]+0x1,'app':'close','appdata':_0x1561('0xc5'),'interval':_0x1561('0xc6')});}}return db[_0x1561('0xc7')]['create']({'body':_0x2ff53c['body'][_0x1561('0x77')],'ChatWebsiteId':_0x2ff53c[_0x1561('0x6c')]['id'],'ChatInteractionId':_0x43537d['id'],'direction':'in','ContactId':_0x3f3642[_0x1561('0xbb')]['id'],'AttachmentId':_0x2ff53c[_0x1561('0x77')][_0x1561('0xc8')]});})['then'](function(_0x355b79){_0x3f3642['message']=_0x355b79;if(!_0x3f3642['interaction']['UserId']){return;}return db[_0x1561('0xc9')][_0x1561('0x6f')]({'attributes':['id',_0x1561('0x31')],'where':{'id':_0x3f3642[_0x1561('0xc0')][_0x1561('0xca')]}});})[_0x1561('0x17')](function(_0x487526){if(_0x487526){_0x3f3642[_0x1561('0xb6')][_0x1561('0xcb')]({'id':0x0,'priority':0x0,'app':_0x1561('0xcc'),'appdata':_0x487526['name']+','+(_0x3f3642['account'][_0x1561('0xcd')]||0xa),'interval':'*,*,*,*'});_0x3f3642[_0x1561('0xce')]=!![];}if(!_0x3f3642[_0x1561('0xc0')][_0x1561('0xcf')]){return;}return db['ChatQueue'][_0x1561('0x6f')]({'attributes':['id',_0x1561('0x31')],'where':{'id':_0x3f3642[_0x1561('0xc0')][_0x1561('0xcf')]}});})[_0x1561('0x17')](function(_0x14d5a9){if(_0x14d5a9){_0x3f3642['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x1561('0xd0'),'appdata':_0x14d5a9[_0x1561('0x31')]+','+(_0x3f3642[_0x1561('0xba')][_0x1561('0xd1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1561('0xd2'),_0x1561('0xd3'),_0x3f3642);})[_0x1561('0x17')](function(_0x344b52){respondWithRpcPromise(_0x1561('0xd4'),_0x1561('0xd4'),{'event':'notify','message':_0x344b52},client9002);return _0x344b52;})[_0x1561('0x17')](respondWithResult(_0xdcac39,null))[_0x1561('0x22')](APIHandleError(_0xdcac39));};exports[_0x1561('0xd5')]=function(_0x57f605,_0x33fc53){var _0x303c43,_0x144ffa,_0x1c15e9;var _0x888327=[];var _0x5b89b6={};var _0x4c1885=_0x57f605[_0x1561('0xd6')]||[];var _0x3dd49e=[];var _0x1dccb9;return db[_0x1561('0x9e')][_0x1561('0x9f')]()[_0x1561('0x17')](function(_0x229ebe){if(!_0x229ebe){throw new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa1'));}_0x888327=_[_0x1561('0xa3')](_[_0x1561('0x5c')](_0x229ebe),['createdAt',_0x1561('0xa2'),_0x1561('0xa5'),_0x1561('0xa6')]);if(_0x57f605[_0x1561('0x77')]['id']){delete _0x57f605[_0x1561('0x77')]['id'];}if(_[_0x1561('0x96')](_0x57f605['body'][_0x1561('0xa7')])){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))][(_0x1561('0xa8'))](_0x1561('0xa9')));}if(_[_0x1561('0x96')](_0x57f605[_0x1561('0x77')][_0x1561('0x77')])||_0x57f605[_0x1561('0x77')][_0x1561('0x77')]===''){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db['Sequelize'][(_0x1561('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x57f605[_0x1561('0x77')][_0x1561('0xd7')])){throw _0x33fc53[_0x1561('0x24')](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))]['ValidationError'](_0x1561('0xd8')+_0x888327));}if(!_[_0x1561('0xac')](_0x888327,_0x57f605['body'][_0x1561('0xd7')])){throw _0x33fc53['status'](0x1f4)[_0x1561('0x32')](new db[(_0x1561('0xa0'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x888327));}_0x5b89b6[_0x57f605['body'][_0x1561('0xd7')]]=_0x57f605['body'][_0x1561('0xa7')];})[_0x1561('0x17')](function(){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x57f605['params']['id']},'include':[{'model':db['CmList'],'as':_0x1561('0xb5')},{'model':db[_0x1561('0xd9')],'as':_0x1561('0xd9')}]});})[_0x1561('0x17')](handleEntityNotFound(_0x33fc53,null))[_0x1561('0x17')](function(_0x25d8f9){if(_0x25d8f9&&_0x25d8f9['List']){_0x144ffa=_0x25d8f9;var _0x13a3e7=_[_0x1561('0xf')](_0x57f605['body'],{'firstName':_0x57f605[_0x1561('0x77')][_0x1561('0xa7')],'phone':_0x57f605[_0x1561('0x77')]['from'],'ListId':_0x25d8f9[_0x1561('0xa6')]});_0x13a3e7[_0x57f605['body'][_0x1561('0xd7')]]=_0x57f605[_0x1561('0x77')][_0x1561('0xa7')];return db[_0x1561('0x9e')][_0x1561('0xda')]({'where':_0x5b89b6,'defaults':_0x13a3e7});}})[_0x1561('0xb4')](function(_0x1d9548){if(_0x1d9548){_0x1c15e9=_0x1d9548;var _0x48bf6d=fs[_0x1561('0xdb')](path['join'](config['root'],_0x1561('0xdc')),'utf8');var _0x109f59=ejs[_0x1561('0xdd')](_0x48bf6d,{'body':_[_0x1561('0xde')](_0x57f605['body'][_0x1561('0x77')]),'bodyTitle':_0x144ffa[_0x1561('0xdf')]});return db[_0x1561('0xe0')][_0x1561('0x70')]({'body':_0x109f59,'plainBody':htmlToText[_0x1561('0xe1')](_0x109f59),'ContactId':_0x1d9548['id'],'ChatWebsiteId':_0x144ffa['id']});}})['then'](function(_0x3bdd05){_0x1dccb9=_0x3bdd05;if(_0x4c1885['length']){var _0x100ece=_0x4c1885[_0x1561('0x3f')](function(_0x59ed43){return{'name':_0x59ed43[_0x1561('0xe2')],'basename':_0x59ed43[_0x1561('0x89')],'type':_0x59ed43[_0x1561('0xe3')],'ChatOfflineMessageId':_0x3bdd05['id']};});_0x3dd49e=_0x100ece[_0x1561('0x3f')](_0x2e1210=>{var _0x1ba24d={'filename':_0x2e1210['name'],'path':path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0xe4'),'files',_0x1561('0xe5'),_0x1561('0xe6'),_0x2e1210['basename'])};return _0x1ba24d;});if(!_0x144ffa[_0x1561('0xe7')]){return db[_0x1561('0xe8')][_0x1561('0xe9')](function(_0x1a5258){return db[_0x1561('0xea')][_0x1561('0xeb')](_0x100ece,{'transaction':_0x1a5258});});}}})[_0x1561('0x17')](function(){if(_0x1dccb9){_0x303c43=_0x1dccb9;return db[_0x1561('0xd9')][_0x1561('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0x1561('0xec')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1561('0xed')],'as':_0x1561('0xed'),'raw':!![]}]}]});}})[_0x1561('0x17')](function(_0x2b44cc){if(_0x2b44cc&&_0x2b44cc['Smtp']&&_0x144ffa['forwardOffline']&&_0x144ffa[_0x1561('0xee')]){var _0x52eb8c=_0x2b44cc[_0x1561('0xef')]();return respondWithRpcPromise(_0x1561('0xf0'),'sendMail',{'account':_0x52eb8c,'message':{'from':util[_0x1561('0x35')]('\x22%s\x22\x20<%s>',_0x2b44cc[_0x1561('0x31')],_0x2b44cc[_0x1561('0xf1')]||_0x2b44cc[_0x1561('0xf2')]['user']),'to':_0x144ffa[_0x1561('0xee')],'subject':_0x144ffa[_0x1561('0xf3')],'html':_0x303c43[_0x1561('0x77')],'attachments':_0x3dd49e}},client9003)[_0x1561('0x17')](function(){return _0x303c43;})[_0x1561('0x22')](function(_0xa67f15){logger[_0x1561('0x1d')](_0xa67f15);});}})[_0x1561('0x17')](function(){if(_0x144ffa&&_0x144ffa[_0x1561('0xe7')]&&_0x144ffa[_0x1561('0xf4')]){var _0x38329b=[];if(_0x4c1885[_0x1561('0x61')]){_0x38329b=_0x4c1885[_0x1561('0x3f')](function(_0x15bf97){return{'name':_0x15bf97[_0x1561('0xe2')],'basename':_0x15bf97[_0x1561('0x89')],'type':_0x15bf97[_0x1561('0xe3')],'ChatOfflineMessageId':_0x1dccb9['id']};});}var _0x3530f8;if(!_[_0x1561('0x96')](_0x144ffa[_0x1561('0xf5')])){var _0x4ea266=_[_0x1561('0x3f')](_0x57f605[_0x1561('0x77')],function(_0x2f52b5){return _0x2f52b5;});var _0x24c71f=_['toPairsIn'](_0x4ea266)[0x0];var _0x4364e9=_[_0x1561('0xf6')](_0x24c71f,function(_0x1bdbdd){return _0x1bdbdd;});_0x3530f8=_0x4364e9[0x1][_0x144ffa['subjectOffline']];}var _0x4b03c6={'from':_0x1c15e9[_0x1561('0xf1')],'firstName':_0x1c15e9[_0x1561('0x4c')],'lastName':_0x1c15e9['lastName'],'mapKey':_0x1561('0xf1'),'message':{'from':_0x1c15e9[_0x1561('0xf1')],'to':_0x144ffa['MailAccount'][_0x1561('0xf1')],'cc':'','subject':_['isNil'](_0x3530f8)?_0x144ffa[_0x1561('0xf3')]:_0x3530f8,'messageId':'','sentAt':new Date(),'attach':_0x38329b[_0x1561('0x61')],'attachments':_0x38329b,'originChannel':_0x1561('0xf7'),'ChatWebsiteId':_0x144ffa['id'],'ChatOfflineMessageId':_0x303c43['id'],'originTo':_0x144ffa[_0x1561('0xd9')]['email']},'body':_0x303c43[_0x1561('0x77')]};var _0x52a961={'account':{'id':_0x144ffa[_0x1561('0xf4')]},'body':_0x4b03c6,'log':_0x1561('0xf8')};return respondWithRpcPromise(_0x1561('0xf8'),'notifyMail',_0x52a961,client9001)[_0x1561('0x17')](function(){return _0x303c43;})[_0x1561('0x22')](function(_0x4859e6){logger[_0x1561('0x1d')](_0x4859e6);});}return;})[_0x1561('0x17')](function(){if(_0x303c43){return _0x303c43;}})[_0x1561('0x17')](respondWithResult(_0x33fc53,null))[_0x1561('0x22')](function(){for(var _0x31c465 of _0x4c1885){var _0x2108d0=path[_0x1561('0x91')](config[_0x1561('0x92')],_0x1561('0xe4'),_0x1561('0xd6'),_0x1561('0xe5'),_0x1561('0xe6'),_0x31c465[_0x1561('0x89')]);fs_extra['remove'](_0x2108d0)[_0x1561('0x22')](function(_0x316b0c){logger[_0x1561('0x1d')](_0x1561('0xf9'),_0x2108d0,_0x316b0c);});}});};exports[_0x1561('0xfa')]=function(_0x3388a3,_0x533113){return db[_0x1561('0xbe')][_0x1561('0x6f')]({'where':{'id':_0x3388a3['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x533113,null))[_0x1561('0x17')](function(_0x59619a){if(_0x59619a){return _0x59619a[_0x1561('0xfa')](_0x3388a3['body'][_0x1561('0x85')],_['omit'](_0x3388a3[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{});}})[_0x1561('0x17')](respondWithResult(_0x533113,null))['catch'](handleError(_0x533113,null));};exports['getInteractions']=function(_0x4af397,_0x326da2){var _0x1d0707={'raw':![],'where':{}};var _0x7fc646={};var _0x420dfb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x4af397[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x326da2,null))[_0x1561('0x17')](function(_0x33cd80){if(_0x33cd80){_0x7fc646[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xbe')][_0x1561('0x59')]);_0x7fc646['query']=_['keys'](_0x4af397[_0x1561('0x5b')]);_0x7fc646[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x7fc646[_0x1561('0x54')],_0x7fc646['query']);_0x1d0707[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x7fc646[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x4af397['query'][_0x1561('0x5f')]));_0x1d0707[_0x1561('0x60')]=_0x1d0707[_0x1561('0x60')][_0x1561('0x61')]?_0x1d0707[_0x1561('0x60')]:_0x7fc646[_0x1561('0x54')];if(!_0x4af397[_0x1561('0x5b')][_0x1561('0x62')](_0x1561('0x83'))){_0x1d0707[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x4af397[_0x1561('0x5b')][_0x1561('0x29')]);_0x1d0707[_0x1561('0x27')]=qs['offset'](_0x4af397[_0x1561('0x5b')][_0x1561('0x27')]);}_0x1d0707['order']=qs[_0x1561('0x7b')](_0x4af397[_0x1561('0x5b')][_0x1561('0x7b')]);_0x1d0707[_0x1561('0x66')]=qs[_0x1561('0x5d')](_[_0x1561('0x64')](_0x4af397['query'],_0x7fc646['filters']));_0x1d0707[_0x1561('0x66')][_0x1561('0x7c')]=_0x33cd80['id'];if(_0x4af397[_0x1561('0x5b')][_0x1561('0x65')]){_0x1d0707['where']=_[_0x1561('0x67')](_0x1d0707['where'],{'$or':_[_0x1561('0x3f')](_0x1d0707[_0x1561('0x60')],function(_0xe7fdf9){var _0x311bd1={};_0x311bd1[_0xe7fdf9]={'$like':'%'+_0x4af397[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x311bd1;})});}_0x1d0707=_[_0x1561('0x67')]({},_0x1d0707,_0x4af397[_0x1561('0x68')]);return db[_0x1561('0xbe')][_0x1561('0x2a')]({'where':_0x1d0707['where']})[_0x1561('0x17')](function(_0x4c4913){_0x420dfb[_0x1561('0x2a')]=_0x4c4913;if(_0x4af397[_0x1561('0x5b')][_0x1561('0x6a')]){_0x1d0707[_0x1561('0x6e')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1561('0xc9')],'as':'Owner','attributes':[_0x1561('0x31'),_0x1561('0xfb'),'internal'],'required':![]},{'model':db[_0x1561('0xfc')],'as':_0x1561('0xfd'),'attributes':['id',_0x1561('0x31'),_0x1561('0xfe')],'where':_0x4af397[_0x1561('0x5b')][_0x1561('0xff')]?{'id':_0x4af397[_0x1561('0x5b')]['tag']}:undefined,'required':_0x4af397['query'][_0x1561('0xff')]?!![]:![]}];}return db[_0x1561('0xbe')][_0x1561('0x6b')](_0x1d0707);})[_0x1561('0x17')](function(_0xbb4a14){_0x420dfb[_0x1561('0x7e')]=_0xbb4a14;return _0x420dfb;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x326da2,_0x1d0707))[_0x1561('0x22')](handleError(_0x326da2,null));};exports[_0x1561('0x100')]=function(_0x290042,_0x53cc1b){var _0x4a06a3=0x0;var _0x2a8ecf=0x0;var _0x2d7223=![];var _0x6fb213;var _0x5d7afe;return db['ChatWebsite'][_0x1561('0x6f')]({'where':{'id':_0x290042['params']['id']},'include':[{'model':db[_0x1561('0x40')],'as':_0x1561('0x40'),'include':[{'model':db['Interval'],'as':_0x1561('0x41'),'attributes':['id',_0x1561('0x37')]}]}]})['then'](handleEntityNotFound(_0x53cc1b,null))['then'](function(_0x552415){if(_0x552415){_0x6fb213=_0x552415;return _0x552415[_0x1561('0x101')]({'raw':!![]});}})['then'](function(_0x527177){if(_0x6fb213){if(_0x527177){_0x5d7afe=_0x527177;}}return require(_0x1561('0x93'))[_0x1561('0x94')]();})[_0x1561('0x17')](function(_0x58acdd){if(_0x58acdd){_0x2a8ecf=_0x58acdd[_0x1561('0x102')];_0x2d7223=_0x58acdd[_0x1561('0x95')];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x10eb0c){_0x4a06a3=_0x10eb0c;if(_0x2a8ecf&&_0x10eb0c>_0x2a8ecf){return db[_0x1561('0x103')][_0x1561('0x7a')]({'where':{'id':0x1}})['then'](function(_0x5e3cb9){if(_0x5e3cb9){_0x5e3cb9[_0x1561('0x104')](_0x1561('0x105'));}});}})[_0x1561('0x17')](function(){if(!_0x6fb213[_0x1561('0x40')]||!_0x6fb213[_0x1561('0x40')]['Intervals'])return!![];return checkWebsiteIntervals(_0x6fb213);})['then'](function(_0x44f1aa){var _0xce3ca8=fs[_0x1561('0xdb')](path[_0x1561('0x91')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x4f49aa=new url[(_0x1561('0x106'))](_0x6fb213[_0x1561('0x107')])['origin'];var _0x1e21a6='3.5.0';var _0x6cfa1=![];var _0x476c34={'chatVersion':_0x1e21a6,'chatWebsiteAddressOrigin':_0x4f49aa,'remote':_0x6fb213[_0x1561('0x108')],'query':querystring[_0x1561('0x1c')](_['merge'](_0x6fb213[_0x1561('0x42')]({'plain':!![]}),{'customerIp':_0x290042[_0x1561('0xbc')]['x-forwarded-for']||_0x290042['headers'][_0x1561('0x109')]||_0x290042[_0x1561('0x10a')]['remoteAddress']||_0x290042['ip'],'referer':_0x290042[_0x1561('0xbc')][_0x1561('0x10b')],'openedInteractions':_0x4a06a3,'maxInteractions':_0x2a8ecf,'virtual':_0x2d7223[_0x1561('0x102')],'online':_0x44f1aa,'custom':_0x2d7223}))['replace'](/'/g,'\x5c\x27')};_0x53cc1b[_0x1561('0x32')](ejs[_0x1561('0xdd')](Mustache[_0x1561('0xdd')](_0xce3ca8,_0x476c34),{'proactiveActions':_0x5d7afe,'alignment':_0x6fb213[_0x1561('0x10c')],'verticalAlignment':_0x6fb213[_0x1561('0x10d')],'div_color':_0x6fb213['color'],'labelText':_0x6fb213[_0x1561('0x10e')],'text_color':_0x6fb213[_0x1561('0x10f')],'text_button_color':_0x6fb213[_0x1561('0x110')],'button_color':_0x6fb213[_0x1561('0x111')],'background_color':_0x6fb213[_0x1561('0x112')],'hideWhenOffline':_0x6fb213[_0x1561('0x113')],'intervalId':_0x6fb213[_0x1561('0x114')],'isDevelopment':_0x6cfa1,'chatVersion':_0x1e21a6}));})[_0x1561('0x22')](handleError(_0x53cc1b,null));};exports[_0x1561('0x115')]=function(_0x326614,_0x2e0575){var _0x346693=_0x326614[_0x1561('0x6c')]['id'];var _0x2d6cf9=_0x326614[_0x1561('0x77')];var _0x5354f5=0xc8;var _0x65cd36=null;return db[_0x1561('0xe8')][_0x1561('0xe9')]({'isolationLevel':db['sequelize'][_0x1561('0x116')][_0x1561('0x117')][_0x1561('0x118')]},function(_0x2dec8f){return db['ChatWebsite'][_0x1561('0x7a')]({'where':{'id':_0x346693},'transaction':_0x2dec8f})['then'](function(_0x116b22){if(_0x116b22){return db[_0x1561('0xb1')][_0x1561('0x2f')]({'where':{'ChatWebsiteId':_0x346693},'transaction':_0x2dec8f})[_0x1561('0x17')](function(){var _0x2be6a4=_[_0x1561('0x3f')](_0x2d6cf9,function(_0x449a01){_0x449a01[_0x1561('0x7c')]=_0x346693;return _0x449a01;});return db[_0x1561('0xb1')][_0x1561('0xeb')](_0x2be6a4,{'transaction':_0x2dec8f});});}else{_0x5354f5=0x194;_0x65cd36=[];}});})[_0x1561('0x17')](function(){if(_0x5354f5!==0x194){return db['ChatApplication'][_0x1561('0x119')]({'where':{'ChatWebsiteId':_0x346693},'order':'priority'})['then'](function(_0x3eb9b5){_0x65cd36=_0x3eb9b5;});}})[_0x1561('0x22')](function(_0x1484eb){_0x5354f5=0x1f4;logger[_0x1561('0x1d')](_0x1484eb[_0x1561('0x30')]);if(_0x1484eb[_0x1561('0x31')]){delete _0x1484eb[_0x1561('0x31')];}_0x65cd36=_0x1484eb;})[_0x1561('0x11a')](function(){if(_0x65cd36===null){_0x2e0575[_0x1561('0x23')](_0x5354f5);}else{if(_0x5354f5===0x1f4){_0x2e0575['status'](_0x5354f5)['send'](_0x65cd36);}else{_0x2e0575[_0x1561('0x24')](_0x5354f5)[_0x1561('0x26')](_0x65cd36);}}});};exports['getApplications']=function(_0x46c063,_0x351a8b){var _0x5a85c8={};var _0x150ea2={};var _0x3af1e9;var _0x32e464;return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x46c063[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x351a8b,null))['then'](function(_0x68bd68){if(_0x68bd68){_0x3af1e9=_0x68bd68;_0x150ea2[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xb1')]['rawAttributes']);_0x150ea2[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x46c063[_0x1561('0x5b')]);_0x150ea2[_0x1561('0x5d')]=_['intersection'](_0x150ea2['model'],_0x150ea2[_0x1561('0x5b')]);_0x5a85c8[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x150ea2[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x46c063[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5a85c8[_0x1561('0x60')]=_0x5a85c8[_0x1561('0x60')][_0x1561('0x61')]?_0x5a85c8[_0x1561('0x60')]:_0x150ea2[_0x1561('0x54')];_0x5a85c8[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x46c063['query']['sort']);_0x5a85c8[_0x1561('0x66')]=qs[_0x1561('0x5d')](_['pick'](_0x46c063[_0x1561('0x5b')],_0x150ea2[_0x1561('0x5d')]));if(_0x46c063[_0x1561('0x5b')][_0x1561('0x65')]){_0x5a85c8['where']=_[_0x1561('0x67')](_0x5a85c8['where'],{'$or':_[_0x1561('0x3f')](_0x5a85c8['attributes'],function(_0x91e005){var _0x2048c7={};_0x2048c7[_0x91e005]={'$like':'%'+_0x46c063['query'][_0x1561('0x65')]+'%'};return _0x2048c7;})});}_0x5a85c8=_[_0x1561('0x67')]({},_0x5a85c8,_0x46c063[_0x1561('0x68')]);return _0x3af1e9[_0x1561('0x11b')](_0x5a85c8);}})[_0x1561('0x17')](function(_0x464f34){if(_0x464f34){_0x32e464=_0x464f34[_0x1561('0x61')];if(!_0x46c063['query']['hasOwnProperty']('nolimit')){_0x5a85c8['limit']=qs['limit'](_0x46c063[_0x1561('0x5b')][_0x1561('0x29')]);_0x5a85c8[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x46c063[_0x1561('0x5b')][_0x1561('0x27')]);}return _0x3af1e9[_0x1561('0x11b')](_0x5a85c8);}})[_0x1561('0x17')](function(_0x1846d1){if(_0x1846d1){return _0x1846d1?{'count':_0x32e464,'rows':_0x1846d1}:null;}})[_0x1561('0x17')](respondWithResult(_0x351a8b,null))[_0x1561('0x22')](handleError(_0x351a8b,null));};exports['addProactiveActions']=function(_0x48d72e,_0x3edc49){return db['chatProactiveAction'][_0x1561('0x6f')]({'where':{'id':_0x48d72e['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x3edc49,null))['then'](function(_0x5eaa93){if(_0x5eaa93){return _0x5eaa93[_0x1561('0x11c')](_0x48d72e[_0x1561('0x77')][_0x1561('0x85')],_['omit'](_0x48d72e[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{});}})['then'](respondWithResult(_0x3edc49,null))[_0x1561('0x22')](handleError(_0x3edc49,null));};exports[_0x1561('0x101')]=function(_0x368cda,_0x15d78e){var _0x5d8a7c={};var _0x117297={};var _0x26876d;var _0x156145;return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x368cda[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x15d78e,null))[_0x1561('0x17')](function(_0x301e17){if(_0x301e17){_0x26876d=_0x301e17;_0x117297[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0x11d')]['rawAttributes']);_0x117297[_0x1561('0x5b')]=_[_0x1561('0x5c')](_0x368cda[_0x1561('0x5b')]);_0x117297[_0x1561('0x5d')]=_['intersection'](_0x117297[_0x1561('0x54')],_0x117297[_0x1561('0x5b')]);_0x5d8a7c[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x117297[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x368cda[_0x1561('0x5b')][_0x1561('0x5f')]));_0x5d8a7c[_0x1561('0x60')]=_0x5d8a7c[_0x1561('0x60')][_0x1561('0x61')]?_0x5d8a7c[_0x1561('0x60')]:_0x117297[_0x1561('0x54')];_0x5d8a7c[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x368cda[_0x1561('0x5b')][_0x1561('0x7b')]);_0x5d8a7c[_0x1561('0x66')]=qs['filters'](_['pick'](_0x368cda[_0x1561('0x5b')],_0x117297[_0x1561('0x5d')]));if(_0x368cda['query'][_0x1561('0x65')]){_0x5d8a7c[_0x1561('0x66')]=_[_0x1561('0x67')](_0x5d8a7c[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x5d8a7c[_0x1561('0x60')],function(_0x5e32bd){var _0x4fd881={};_0x4fd881[_0x5e32bd]={'$like':'%'+_0x368cda[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x4fd881;})});}_0x5d8a7c=_[_0x1561('0x67')]({},_0x5d8a7c,_0x368cda[_0x1561('0x68')]);return _0x26876d['getProactiveActions'](_0x5d8a7c);}})[_0x1561('0x17')](function(_0x2df266){if(_0x2df266){_0x156145=_0x2df266[_0x1561('0x61')];if(!_0x368cda[_0x1561('0x5b')]['hasOwnProperty'](_0x1561('0x83'))){_0x5d8a7c[_0x1561('0x29')]=qs['limit'](_0x368cda[_0x1561('0x5b')][_0x1561('0x29')]);_0x5d8a7c[_0x1561('0x27')]=qs['offset'](_0x368cda[_0x1561('0x5b')][_0x1561('0x27')]);}return _0x26876d['getProactiveActions'](_0x5d8a7c);}})[_0x1561('0x17')](function(_0x179c07){if(_0x179c07){return _0x179c07?{'count':_0x156145,'rows':_0x179c07}:null;}})[_0x1561('0x17')](respondWithResult(_0x15d78e,null))['catch'](handleError(_0x15d78e,null));};exports[_0x1561('0x11e')]=function(_0x4cb41c,_0x13f759){var _0x47c714=_0x4cb41c['query']['online']==='false'?_0x1561('0x11f'):'onlineForm';return db[_0x1561('0x69')][_0x1561('0x6f')]({'attributes':['id',_0x47c714],'where':{'id':_0x4cb41c['params']['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x13f759,null))['then'](function(_0x46b060){if(_0x46b060){var _0x30ebe6=_0x46b060[_0x47c714];var _0x25352d=_0x30ebe6&&_0x30ebe6['items']?_0x30ebe6[_0x1561('0x120')]:[];_0x13f759['send']({'fromKey':_['isNil'](_0x30ebe6[_0x1561('0x121')])?undefined:_0x30ebe6[_0x1561('0x121')],'count':_0x25352d[_0x1561('0x61')],'rows':_0x25352d});}})[_0x1561('0x22')](handleError(_0x13f759,null));};exports['getOfflineMessages']=function(_0x4c079c,_0x18006a){var _0x41d00d={'raw':![],'where':{}};var _0x4b360e={};var _0x4b2b5a={'count':0x0,'rows':[]};return db[_0x1561('0x69')][_0x1561('0x7a')]({'where':{'id':_0x4c079c[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x18006a,null))['then'](function(_0x4557a1){if(_0x4557a1){_0x4b360e[_0x1561('0x54')]=_[_0x1561('0x5c')](db[_0x1561('0xe0')][_0x1561('0x59')]);_0x4b360e[_0x1561('0x5b')]=_['keys'](_0x4c079c[_0x1561('0x5b')]);_0x4b360e['filters']=_[_0x1561('0x5e')](_0x4b360e[_0x1561('0x54')],_0x4b360e[_0x1561('0x5b')]);_0x41d00d[_0x1561('0x60')]=_[_0x1561('0x5e')](_0x4b360e[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x4c079c[_0x1561('0x5b')]['fields']));_0x41d00d[_0x1561('0x60')]=_0x41d00d[_0x1561('0x60')][_0x1561('0x61')]?_0x41d00d[_0x1561('0x60')]:_0x4b360e[_0x1561('0x54')];if(!_0x4c079c['query']['hasOwnProperty'](_0x1561('0x83'))){_0x41d00d[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x4c079c[_0x1561('0x5b')][_0x1561('0x29')]);_0x41d00d[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x4c079c[_0x1561('0x5b')][_0x1561('0x27')]);}_0x41d00d[_0x1561('0x63')]=qs[_0x1561('0x7b')](_0x4c079c['query'][_0x1561('0x7b')]);_0x41d00d[_0x1561('0x66')]=qs[_0x1561('0x5d')](_[_0x1561('0x64')](_0x4c079c[_0x1561('0x5b')],_0x4b360e[_0x1561('0x5d')]));_0x41d00d['where'][_0x1561('0x7c')]=_0x4557a1['id'];if(_0x4c079c[_0x1561('0x5b')]['filter']){_0x41d00d[_0x1561('0x66')]=_[_0x1561('0x67')](_0x41d00d[_0x1561('0x66')],{'$or':_[_0x1561('0x3f')](_0x41d00d[_0x1561('0x60')],function(_0x18bc69){var _0x5d2a01={};_0x5d2a01[_0x18bc69]={'$like':'%'+_0x4c079c[_0x1561('0x5b')]['filter']+'%'};return _0x5d2a01;})});}_0x41d00d=_[_0x1561('0x67')]({},_0x41d00d,_0x4c079c[_0x1561('0x68')]);return db[_0x1561('0xe0')]['count']({'where':_0x41d00d['where']})[_0x1561('0x17')](function(_0x49977e){_0x4b2b5a['count']=_0x49977e;if(_0x4c079c[_0x1561('0x5b')][_0x1561('0x6a')]){_0x41d00d[_0x1561('0x6e')]=[{'all':!![]}];}else{_0x41d00d[_0x1561('0x6e')]=[{'model':db[_0x1561('0x9e')],'as':_0x1561('0x122'),'required':![]},{'model':db[_0x1561('0xea')],'as':_0x1561('0x123'),'required':![]}];}return db[_0x1561('0xe0')][_0x1561('0x6b')](_0x41d00d);})[_0x1561('0x17')](function(_0x37a62e){_0x4b2b5a[_0x1561('0x7e')]=_0x37a62e;return _0x4b2b5a;});}})[_0x1561('0x17')](respondWithFilteredResult(_0x18006a,_0x41d00d))[_0x1561('0x22')](handleError(_0x18006a,null));};exports[_0x1561('0x124')]=function(_0x415f38,_0x30557b){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x415f38[_0x1561('0x6c')]['id']}})[_0x1561('0x17')](handleEntityNotFound(_0x30557b,null))[_0x1561('0x17')](function(_0x183858){if(_0x183858){return _0x183858[_0x1561('0x124')](_0x415f38[_0x1561('0x77')][_0x1561('0x85')],_[_0x1561('0x125')](_0x415f38[_0x1561('0x77')],[_0x1561('0x85'),'id'])||{})['spread'](function(_0x3f2aa6){for(var _0x4fb287=0x0;_0x4fb287<_0x415f38[_0x1561('0x77')]['ids'][_0x1561('0x61')];_0x4fb287+=0x1){socket['emit'](_0x1561('0x126'),{'UserId':Number(_0x415f38['body'][_0x1561('0x85')][_0x4fb287]),'ChatWebsiteId':Number(_0x415f38[_0x1561('0x6c')]['id'])});}return _0x3f2aa6;});}})[_0x1561('0x17')](respondWithResult(_0x30557b,null))[_0x1561('0x22')](handleError(_0x30557b,null));};exports[_0x1561('0x127')]=function(_0x446e53,_0x1f9e3e){return db[_0x1561('0x69')][_0x1561('0x6f')]({'where':{'id':_0x446e53[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1f9e3e,null))[_0x1561('0x17')](function(_0xae2f9c){if(_0xae2f9c){return _0xae2f9c[_0x1561('0x127')](_0x446e53[_0x1561('0x5b')][_0x1561('0x85')])[_0x1561('0x17')](function(){if(_['isArray'](_0x446e53[_0x1561('0x5b')][_0x1561('0x85')])){for(var _0x1665dc=0x0;_0x1665dc<_0x446e53[_0x1561('0x5b')]['ids']['length'];_0x1665dc+=0x1){socket[_0x1561('0x128')](_0x1561('0x129'),{'UserId':Number(_0x446e53[_0x1561('0x5b')]['ids'][_0x1665dc]),'ChatWebsiteId':Number(_0x446e53['params']['id'])});}}else{socket[_0x1561('0x128')](_0x1561('0x129'),{'UserId':Number(_0x446e53[_0x1561('0x5b')][_0x1561('0x85')]),'ChatWebsiteId':Number(_0x446e53[_0x1561('0x6c')]['id'])});}});}})[_0x1561('0x17')](respondWithStatusCode(_0x1f9e3e,null))[_0x1561('0x22')](handleError(_0x1f9e3e,null));};exports[_0x1561('0x12a')]=function(_0x21d007,_0x3f62b0){var _0x17d13b={};var _0x194cb4={};var _0x2070a6;var _0x2f95ef;return db[_0x1561('0x69')]['findOne']({'where':{'id':_0x21d007[_0x1561('0x6c')]['id']}})['then'](handleEntityNotFound(_0x3f62b0,null))[_0x1561('0x17')](function(_0x262f76){if(_0x262f76){_0x2070a6=_0x262f76;_0x194cb4[_0x1561('0x54')]=_['keys'](db['User'][_0x1561('0x59')]);_0x194cb4['query']=_['keys'](_0x21d007[_0x1561('0x5b')]);_0x194cb4[_0x1561('0x5d')]=_[_0x1561('0x5e')](_0x194cb4[_0x1561('0x54')],_0x194cb4[_0x1561('0x5b')]);_0x17d13b['attributes']=_[_0x1561('0x5e')](_0x194cb4[_0x1561('0x54')],qs[_0x1561('0x5f')](_0x21d007['query'][_0x1561('0x5f')]));_0x17d13b[_0x1561('0x60')]=_0x17d13b[_0x1561('0x60')]['length']?_0x17d13b[_0x1561('0x60')]:_0x194cb4['model'];_0x17d13b[_0x1561('0x63')]=qs['sort'](_0x21d007[_0x1561('0x5b')]['sort']);_0x17d13b[_0x1561('0x66')]=qs[_0x1561('0x5d')](_['pick'](_0x21d007[_0x1561('0x5b')],_0x194cb4[_0x1561('0x5d')]));if(_0x21d007[_0x1561('0x5b')]['filter']){_0x17d13b[_0x1561('0x66')]=_[_0x1561('0x67')](_0x17d13b[_0x1561('0x66')],{'$or':_['map'](_0x17d13b[_0x1561('0x60')],function(_0x12eea0){var _0x2265cf={};_0x2265cf[_0x12eea0]={'$like':'%'+_0x21d007[_0x1561('0x5b')][_0x1561('0x65')]+'%'};return _0x2265cf;})});}_0x17d13b=_['merge']({},_0x17d13b,_0x21d007['options']);return _0x2070a6[_0x1561('0x12a')](_0x17d13b);}})[_0x1561('0x17')](function(_0xefddf8){if(_0xefddf8){_0x2f95ef=_0xefddf8[_0x1561('0x61')];if(!_0x21d007[_0x1561('0x5b')]['hasOwnProperty'](_0x1561('0x83'))){_0x17d13b[_0x1561('0x29')]=qs[_0x1561('0x29')](_0x21d007['query'][_0x1561('0x29')]);_0x17d13b[_0x1561('0x27')]=qs[_0x1561('0x27')](_0x21d007['query'][_0x1561('0x27')]);}return _0x2070a6[_0x1561('0x12a')](_0x17d13b);}})[_0x1561('0x17')](function(_0x2a3f85){if(_0x2a3f85){return _0x2a3f85?{'count':_0x2f95ef,'rows':_0x2a3f85}:null;}})[_0x1561('0x17')](respondWithResult(_0x3f62b0,null))[_0x1561('0x22')](handleError(_0x3f62b0,null));}; \ No newline at end of file +var _0xa503=['length','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','applications','orderBy','priority','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','send','mapKeyOffline','includes','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','originalname','toPairsIn','mapValues','subjectOffline','lastName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tags','color','tag','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','remote','x-real-ip','remoteAddress','referer','replace','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','sendStatus','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','info','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','ChatWebsites','end','stack','name','Command','getSnippet','timezone','format','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','Intervals','all','some','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','x-forwarded-for','split','x-real-port','browser','version','%s\x20%s','device','model','vendor','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys'];(function(_0x481fea,_0x1610c1){var _0x1f93b3=function(_0x4e94a0){while(--_0x4e94a0){_0x481fea['push'](_0x481fea['shift']());}};_0x1f93b3(++_0x1610c1);}(_0xa503,0xcf));var _0x3a50=function(_0x100332,_0x4d25cd){_0x100332=_0x100332-0x0;var _0x33c606=_0xa503[_0x100332];return _0x33c606;};'use strict';var Mustache=require(_0x3a50('0x0'));var util=require(_0x3a50('0x1'));var path=require(_0x3a50('0x2'));var ejs=require(_0x3a50('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a50('0x4'));var querystring=require('querystring');var htmlToText=require(_0x3a50('0x5'));var Redis=require(_0x3a50('0x6'));var jayson=require(_0x3a50('0x7'));var url=require('url');var qs=require(_0x3a50('0x8'));var logger=require(_0x3a50('0x9'))(_0x3a50('0xa'));var config=require(_0x3a50('0xb'));var APIOutOfIntervalError=require(_0x3a50('0xc'))[_0x3a50('0xd')];var APINotFoundError=require('../../errors/api')[_0x3a50('0xe')];var APIHandleError=require(_0x3a50('0xc'))[_0x3a50('0xf')];var db=require('../../mysqldb')['db'];config[_0x3a50('0x10')]=_[_0x3a50('0x11')](config[_0x3a50('0x10')],{'host':_0x3a50('0x12'),'port':0x18eb});var socket=require(_0x3a50('0x13'))(new Redis(config[_0x3a50('0x10')]));require(_0x3a50('0x14'))['register'](socket);var client=jayson[_0x3a50('0x15')][_0x3a50('0x16')]({'port':0x232c});var client9002=jayson[_0x3a50('0x15')][_0x3a50('0x16')]({'port':0x232a});var client9003=jayson[_0x3a50('0x15')]['http']({'port':0x232b});var client9001=jayson[_0x3a50('0x15')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5702ee,_0xbca6bc,_0x40274b,_0x31e79f){return new Promise(function(_0x1c32fe,_0x5649b1){var _0x2129c4=_0x31e79f||client;return _0x2129c4[_0x3a50('0x17')](_0x5702ee,_0x40274b)[_0x3a50('0x18')](function(_0x2123bd){logger['info']('ChatWebsite,\x20%s,\x20%s',_0xbca6bc,'request\x20sent');logger[_0x3a50('0x19')](_0x3a50('0x1a'),_0xbca6bc,'request\x20sent',JSON[_0x3a50('0x1b')](_0x2123bd));if(_0x2123bd['error']){if(_0x2123bd['error'][_0x3a50('0x1c')]===0x1f4){logger[_0x3a50('0x1d')](_0x3a50('0x1e'),_0xbca6bc,_0x2123bd['error'][_0x3a50('0x1f')]);return _0x5649b1(_0x2123bd[_0x3a50('0x1d')][_0x3a50('0x1f')]);}logger[_0x3a50('0x1d')](_0x3a50('0x1e'),_0xbca6bc,_0x2123bd['error'][_0x3a50('0x1f')]);return _0x1c32fe(_0x2123bd[_0x3a50('0x1d')][_0x3a50('0x1f')]);}else{logger[_0x3a50('0x20')]('ChatWebsite,\x20%s,\x20%s',_0xbca6bc,_0x3a50('0x21'));_0x1c32fe(_0x2123bd[_0x3a50('0x22')][_0x3a50('0x1f')]);}})[_0x3a50('0x23')](function(_0x23c645){logger[_0x3a50('0x1d')](_0x3a50('0x1e'),_0xbca6bc,_0x23c645);_0x5649b1(_0x23c645);});});}function respondWithStatusCode(_0x33367,_0x44e3e9){_0x44e3e9=_0x44e3e9||0xcc;return function(_0x1946c5){if(_0x1946c5){return _0x33367['sendStatus'](_0x44e3e9);}return _0x33367[_0x3a50('0x24')](_0x44e3e9)['end']();};}function respondWithResult(_0x18af36,_0x2b05e4){_0x2b05e4=_0x2b05e4||0xc8;return function(_0x3e2018){if(_0x3e2018){return _0x18af36[_0x3a50('0x24')](_0x2b05e4)[_0x3a50('0x25')](_0x3e2018);}};}function respondWithFilteredResult(_0x70eb48,_0x1da8e3){return function(_0x59421b){if(_0x59421b){var _0x49173d=typeof _0x1da8e3[_0x3a50('0x26')]===_0x3a50('0x27')&&typeof _0x1da8e3[_0x3a50('0x28')]==='undefined';var _0x28864d=_0x59421b[_0x3a50('0x29')];var _0x31b365=_0x49173d?0x0:_0x1da8e3[_0x3a50('0x26')];var _0x336553=_0x49173d?_0x59421b[_0x3a50('0x29')]:_0x1da8e3[_0x3a50('0x26')]+_0x1da8e3['limit'];var _0x4a8d93;if(_0x336553>=_0x28864d){_0x336553=_0x28864d;_0x4a8d93=0xc8;}else{_0x4a8d93=0xce;}_0x70eb48[_0x3a50('0x24')](_0x4a8d93);return _0x70eb48[_0x3a50('0x2a')](_0x3a50('0x2b'),_0x31b365+'-'+_0x336553+'/'+_0x28864d)['json'](_0x59421b);}return null;};}function saveUpdates(_0x58a44b){return function(_0x1aeadf){if(_0x1aeadf){return _0x1aeadf[_0x3a50('0x2c')](_0x58a44b)[_0x3a50('0x18')](function(_0x5818fa){return _0x5818fa;});}return null;};}function removeEntity(_0x29f7b9){return function(_0x3c32b9){if(_0x3c32b9){return _0x3c32b9[_0x3a50('0x2d')]()[_0x3a50('0x18')](function(){var _0x165af7=_0x3c32b9['get']({'plain':!![]});var _0x471321=_0x3a50('0x2e');return db['UserProfileResource'][_0x3a50('0x2d')]({'where':{'type':_0x471321,'resourceId':_0x165af7['id']}})[_0x3a50('0x18')](function(){return _0x3c32b9;});})['then'](function(){_0x29f7b9['status'](0xcc)[_0x3a50('0x2f')]();});}};}function handleEntityNotFound(_0x499568){return function(_0x498877){if(!_0x498877){_0x499568['sendStatus'](0x194);}return _0x498877;};}function handleError(_0x13348e,_0x3ff24f){_0x3ff24f=_0x3ff24f||0x1f4;return function(_0x192a3b){logger['error'](_0x192a3b[_0x3a50('0x30')]);if(_0x192a3b[_0x3a50('0x31')]){delete _0x192a3b[_0x3a50('0x31')];}_0x13348e[_0x3a50('0x24')](_0x3ff24f)['send'](_0x192a3b);};}function iftimePromise(_0xf3b53,_0x5d2624){return respondWithRpcPromise(_0x3a50('0x32'),_0x3a50('0x33'),{'command':_0x5d2624[_0x3a50('0x34')]?util[_0x3a50('0x35')](_0x3a50('0x36'),_0xf3b53['interval'],_0x5d2624[_0x3a50('0x34')]):util[_0x3a50('0x35')](_0x3a50('0x37'),_0xf3b53[_0x3a50('0x38')])},client9002)[_0x3a50('0x18')](function(_0x511705){var _0x86938a=_0x511705&&_0x511705[_0x3a50('0x39')](_0x3a50('0x3a'))>=0x0?!![]:![];logger[_0x3a50('0x20')](_0x3a50('0x3b'),_0x5d2624['id'],_0xf3b53['id'],_0xf3b53[_0x3a50('0x38')],_0x86938a?'ONLINE':'OFFLINE',_0x5d2624['timezone']?_0x5d2624[_0x3a50('0x34')]:_0x3a50('0x3c'));return _0x86938a;})[_0x3a50('0x23')](function(_0x4bf143){logger[_0x3a50('0x1d')](_0x3a50('0x3b'),_0x5d2624['id'],_0xf3b53['id'],_0xf3b53[_0x3a50('0x38')],util['inspect'](_0x4bf143,{'showHidden':![],'depth':null}),_0x5d2624[_0x3a50('0x34')]?_0x5d2624[_0x3a50('0x34')]:'No\x20timezone');return![];});}function checkWebsiteIntervals(_0xbf524b){var _0x4ea8f7=_['map'](_0xbf524b['Interval'][_0x3a50('0x3d')],function(_0x163ceb){var _0x8831ad=_0x163ceb['get']({'plain':!![]});return iftimePromise(_0x8831ad,_0xbf524b);});return Promise[_0x3a50('0x3e')](_0x4ea8f7)[_0x3a50('0x18')](function(_0x4c590f){return _[_0x3a50('0x3f')](_0x4c590f);});}function createInteractionObject(_0x3d4f90,_0x17f8d3,_0x1993a2,_0x46423f){var _0x166d21=require(_0x3a50('0x40'));var _0x32e579=new _0x166d21();var _0x5e9c35=_0x32e579[_0x3a50('0x41')](_0x1993a2[_0x3a50('0x42')])[_0x3a50('0x43')]();var _0x1ff617=_0x17f8d3[_0x3a50('0x44')];if(_0x1993a2[_0x3a50('0x45')]){_0x1ff617=_0x1993a2[_0x3a50('0x45')];}else if(_0x1993a2['x-forwarded-for']){_0x1ff617=_[_0x3a50('0x46')](_0x1993a2[_0x3a50('0x47')][_0x3a50('0x48')](','));}return{'ContactId':_0x46423f['id'],'ChatWebsiteId':_0x3d4f90,'from':(_0x46423f['firstName']||'')+'\x20'+(_0x46423f['lastName']||''),'customerIp':_0x1ff617,'customerPort':_0x1993a2[_0x3a50('0x49')]?_0x1993a2[_0x3a50('0x49')]:null,'referer':_0x17f8d3['referer'],'browserName':_0x5e9c35['browser']['name']&&_0x5e9c35[_0x3a50('0x4a')][_0x3a50('0x4b')]?util[_0x3a50('0x35')](_0x3a50('0x4c'),_0x5e9c35['browser'][_0x3a50('0x31')],_0x5e9c35['browser'][_0x3a50('0x4b')]):'unknown','browserVersion':_0x5e9c35['browser']['version']||'unknown','osName':util[_0x3a50('0x35')](_0x3a50('0x4c'),_0x5e9c35['os'][_0x3a50('0x31')],_0x5e9c35['os']['version']),'osVersion':_0x5e9c35['os'][_0x3a50('0x4b')],'deviceModel':_0x5e9c35[_0x3a50('0x4d')][_0x3a50('0x4e')]&&_0x5e9c35[_0x3a50('0x4d')]['vendor']?util[_0x3a50('0x35')]('%s\x20%s\x20%s',_0x5e9c35[_0x3a50('0x4d')][_0x3a50('0x4e')],_0x5e9c35[_0x3a50('0x4d')][_0x3a50('0x4f')],_0x5e9c35['device']['type']):null,'deviceVendor':_0x5e9c35[_0x3a50('0x4d')][_0x3a50('0x4f')],'deviceType':_0x5e9c35[_0x3a50('0x4d')]['type'],'formData':JSON[_0x3a50('0x1b')](_0x17f8d3)};}exports[_0x3a50('0x50')]=function(_0x210446,_0x599ba7){var _0x548952={'include':[{'model':db[_0x3a50('0x51')],'as':_0x3a50('0x52')}]},_0x74f772={},_0x5254d1={'count':0x0,'rows':[]};var _0x2b72d3=_[_0x3a50('0x53')](db[_0x3a50('0x54')][_0x3a50('0x55')],function(_0x586458){return{'name':_0x586458[_0x3a50('0x56')],'type':_0x586458[_0x3a50('0x57')][_0x3a50('0x58')]};});_0x74f772[_0x3a50('0x4e')]=_[_0x3a50('0x53')](_0x2b72d3,'name');_0x74f772[_0x3a50('0x59')]=_['keys'](_0x210446[_0x3a50('0x59')]);_0x74f772[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x74f772['model'],_0x74f772['query']);_0x548952['attributes']=_[_0x3a50('0x5b')](_0x74f772[_0x3a50('0x4e')],qs['fields'](_0x210446[_0x3a50('0x59')][_0x3a50('0x5c')]));_0x548952[_0x3a50('0x5d')]=_0x548952[_0x3a50('0x5d')]['length']?_0x548952[_0x3a50('0x5d')]:_0x74f772[_0x3a50('0x4e')];if(!_0x210446[_0x3a50('0x59')][_0x3a50('0x5e')]('nolimit')){_0x548952[_0x3a50('0x28')]=qs[_0x3a50('0x28')](_0x210446[_0x3a50('0x59')]['limit']);_0x548952[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x210446[_0x3a50('0x59')][_0x3a50('0x26')]);}_0x548952[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x210446[_0x3a50('0x59')][_0x3a50('0x60')]);_0x548952[_0x3a50('0x61')]=qs['filters'](_[_0x3a50('0x62')](_0x210446[_0x3a50('0x59')],_0x74f772[_0x3a50('0x5a')]),_0x2b72d3);if(_0x210446[_0x3a50('0x59')][_0x3a50('0x63')]){_0x548952[_0x3a50('0x61')]=_['merge'](_0x548952[_0x3a50('0x61')],{'$or':_[_0x3a50('0x53')](_0x2b72d3,function(_0x201050){if(_0x201050['type']!==_0x3a50('0x64')){var _0x3828a9={};_0x3828a9[_0x201050['name']]={'$like':'%'+_0x210446[_0x3a50('0x59')]['filter']+'%'};return _0x3828a9;}})});}_0x548952=_[_0x3a50('0x65')]({},_0x548952,_0x210446[_0x3a50('0x66')]);var _0x1a4e3b={'where':_0x548952[_0x3a50('0x61')]};return db[_0x3a50('0x54')]['count'](_0x1a4e3b)[_0x3a50('0x18')](function(_0x4b8724){_0x5254d1['count']=_0x4b8724;if(_0x210446[_0x3a50('0x59')][_0x3a50('0x67')]){_0x548952[_0x3a50('0x68')]=[{'all':!![]}];}return db[_0x3a50('0x54')][_0x3a50('0x69')](_0x548952);})['then'](function(_0x12a881){_0x5254d1['rows']=_0x12a881;return _0x5254d1;})[_0x3a50('0x18')](respondWithFilteredResult(_0x599ba7,_0x548952))[_0x3a50('0x23')](handleError(_0x599ba7,null));};exports[_0x3a50('0x6a')]=function(_0x576493,_0x40a0da){var _0x17ecb6={'raw':![],'where':{'id':_0x576493[_0x3a50('0x6b')]['id']},'include':[{'model':db[_0x3a50('0x51')],'as':_0x3a50('0x52')}]},_0x471c8a={};_0x471c8a['model']=_[_0x3a50('0x6c')](db['ChatWebsite']['rawAttributes']);_0x471c8a[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0x576493[_0x3a50('0x59')]);_0x471c8a['filters']=_[_0x3a50('0x5b')](_0x471c8a[_0x3a50('0x4e')],_0x471c8a['query']);_0x17ecb6[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x471c8a[_0x3a50('0x4e')],qs[_0x3a50('0x5c')](_0x576493[_0x3a50('0x59')][_0x3a50('0x5c')]));_0x17ecb6[_0x3a50('0x5d')]=_0x17ecb6[_0x3a50('0x5d')][_0x3a50('0x6d')]?_0x17ecb6[_0x3a50('0x5d')]:_0x471c8a[_0x3a50('0x4e')];if(_0x576493[_0x3a50('0x59')][_0x3a50('0x67')]){_0x17ecb6['include']=[{'all':!![]}];}_0x17ecb6=_['merge']({},_0x17ecb6,_0x576493[_0x3a50('0x66')]);return db[_0x3a50('0x54')]['find'](_0x17ecb6)[_0x3a50('0x18')](handleEntityNotFound(_0x40a0da,null))[_0x3a50('0x18')](respondWithResult(_0x40a0da,null))[_0x3a50('0x23')](handleError(_0x40a0da,null));};exports[_0x3a50('0x6e')]=function(_0x5b19b7,_0x1b7dcb){return db[_0x3a50('0x54')][_0x3a50('0x6e')](_0x5b19b7[_0x3a50('0x6f')],{})['then'](function(_0xb7dac){var _0x4df483=_0x5b19b7['user'][_0x3a50('0x70')]({'plain':!![]});if(!_0x4df483)throw new Error(_0x3a50('0x71'));if(_0x4df483[_0x3a50('0x72')]===_0x3a50('0x73')){var _0x376211=_0xb7dac['get']({'plain':!![]});var _0x360b1c=_0x3a50('0x2e');return db[_0x3a50('0x74')][_0x3a50('0x75')]({'where':{'name':_0x360b1c,'userProfileId':_0x4df483[_0x3a50('0x76')]},'raw':!![]})[_0x3a50('0x18')](function(_0x4e847c){if(_0x4e847c&&_0x4e847c['autoAssociation']===0x0){return db[_0x3a50('0x77')][_0x3a50('0x6e')]({'name':_0x376211[_0x3a50('0x31')],'resourceId':_0x376211['id'],'type':_0x4e847c[_0x3a50('0x31')],'sectionId':_0x4e847c['id']},{})[_0x3a50('0x18')](function(){return _0xb7dac;});}else{return _0xb7dac;}})[_0x3a50('0x23')](function(_0x29397a){logger[_0x3a50('0x1d')](_0x3a50('0x78'),_0x29397a);throw _0x29397a;});}return _0xb7dac;})[_0x3a50('0x18')](respondWithResult(_0x1b7dcb,0xc9))[_0x3a50('0x23')](handleError(_0x1b7dcb,null));};exports[_0x3a50('0x2c')]=function(_0x1211c3,_0x57b89b){if(_0x1211c3[_0x3a50('0x6f')]['id']){delete _0x1211c3['body']['id'];}return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x1211c3[_0x3a50('0x6b')]['id']},'include':[{'model':db[_0x3a50('0x51')],'as':_0x3a50('0x52')}]})[_0x3a50('0x18')](handleEntityNotFound(_0x57b89b,null))[_0x3a50('0x18')](saveUpdates(_0x1211c3[_0x3a50('0x6f')],null))[_0x3a50('0x18')](respondWithResult(_0x57b89b,null))['catch'](handleError(_0x57b89b,null));};exports[_0x3a50('0x2d')]=function(_0x445184,_0x15a587){return db['ChatWebsite'][_0x3a50('0x75')]({'where':{'id':_0x445184[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x15a587,null))[_0x3a50('0x18')](removeEntity(_0x15a587,null))['catch'](handleError(_0x15a587,null));};exports[_0x3a50('0x79')]=function(_0x5669cd,_0x2f72ea){return db['ChatWebsite'][_0x3a50('0x79')]()[_0x3a50('0x18')](respondWithResult(_0x2f72ea,null))['catch'](handleError(_0x2f72ea,null));};exports[_0x3a50('0x7a')]=function(_0x507a94,_0x348a3c){if(_0x507a94[_0x3a50('0x6f')]['id']){delete _0x507a94[_0x3a50('0x6f')]['id'];}return db['ChatWebsite'][_0x3a50('0x75')]({'where':{'id':_0x507a94[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x348a3c,null))[_0x3a50('0x18')](function(_0x68ed9e){if(_0x68ed9e){_0x507a94[_0x3a50('0x6f')][_0x3a50('0x7b')]=_0x68ed9e['id'];return db[_0x3a50('0x7c')][_0x3a50('0x6e')](_0x507a94[_0x3a50('0x6f')]);}})[_0x3a50('0x18')](respondWithResult(_0x348a3c,null))[_0x3a50('0x23')](handleError(_0x348a3c,null));};exports['getDispositions']=function(_0x169c91,_0x407d4f){var _0x42a174={'raw':![],'where':{}};var _0x38768b={};var _0x22673b={'count':0x0,'rows':[]};return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0x169c91['params']['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x407d4f,null))['then'](function(_0xf5fcae){if(_0xf5fcae){_0x38768b[_0x3a50('0x4e')]=_[_0x3a50('0x6c')](db['Disposition'][_0x3a50('0x55')]);_0x38768b['query']=_[_0x3a50('0x6c')](_0x169c91[_0x3a50('0x59')]);_0x38768b[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x38768b['model'],_0x38768b[_0x3a50('0x59')]);_0x42a174[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x38768b[_0x3a50('0x4e')],qs[_0x3a50('0x5c')](_0x169c91['query'][_0x3a50('0x5c')]));_0x42a174[_0x3a50('0x5d')]=_0x42a174['attributes']['length']?_0x42a174[_0x3a50('0x5d')]:_0x38768b['model'];if(!_0x169c91[_0x3a50('0x59')]['hasOwnProperty'](_0x3a50('0x7e'))){_0x42a174[_0x3a50('0x28')]=qs[_0x3a50('0x28')](_0x169c91[_0x3a50('0x59')][_0x3a50('0x28')]);_0x42a174[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x169c91[_0x3a50('0x59')][_0x3a50('0x26')]);}_0x42a174[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x169c91['query']['sort']);_0x42a174[_0x3a50('0x61')]=qs[_0x3a50('0x5a')](_[_0x3a50('0x62')](_0x169c91['query'],_0x38768b[_0x3a50('0x5a')]));_0x42a174[_0x3a50('0x61')][_0x3a50('0x7b')]=_0xf5fcae['id'];if(_0x169c91[_0x3a50('0x59')][_0x3a50('0x63')]){_0x42a174['where']=_[_0x3a50('0x65')](_0x42a174[_0x3a50('0x61')],{'$or':_[_0x3a50('0x53')](_0x42a174[_0x3a50('0x5d')],function(_0x4d5603){var _0x26d061={};_0x26d061[_0x4d5603]={'$like':'%'+_0x169c91[_0x3a50('0x59')]['filter']+'%'};return _0x26d061;})});}_0x42a174=_['merge']({},_0x42a174,_0x169c91['options']);return db[_0x3a50('0x7c')][_0x3a50('0x29')]({'where':_0x42a174[_0x3a50('0x61')]})[_0x3a50('0x18')](function(_0x4635bd){_0x22673b['count']=_0x4635bd;if(_0x169c91[_0x3a50('0x59')][_0x3a50('0x67')]){_0x42a174[_0x3a50('0x68')]=[{'all':!![]}];}return db[_0x3a50('0x7c')][_0x3a50('0x69')](_0x42a174);})[_0x3a50('0x18')](function(_0x13d4e7){_0x22673b[_0x3a50('0x7f')]=_0x13d4e7;return _0x22673b;});}})[_0x3a50('0x18')](respondWithFilteredResult(_0x407d4f,_0x42a174))['catch'](handleError(_0x407d4f,null));};exports[_0x3a50('0x80')]=function(_0x201261,_0x724612){return db[_0x3a50('0x54')]['find']({'where':{'id':_0x201261['params']['id']}})['then'](handleEntityNotFound(_0x724612,null))[_0x3a50('0x18')](function(_0x244feb){if(_0x244feb){return _0x244feb[_0x3a50('0x80')](_0x201261[_0x3a50('0x59')]['ids']);}})[_0x3a50('0x18')](respondWithStatusCode(_0x724612,null))[_0x3a50('0x23')](handleError(_0x724612,null));};exports[_0x3a50('0x81')]=function(_0x3c6828,_0x45918b){if(_0x3c6828[_0x3a50('0x6f')]['id']){delete _0x3c6828[_0x3a50('0x6f')]['id'];}return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x3c6828[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x45918b,null))['then'](function(_0x12f763){if(_0x12f763){_0x3c6828['body'][_0x3a50('0x7b')]=_0x12f763['id'];return db[_0x3a50('0x82')][_0x3a50('0x6e')](_0x3c6828[_0x3a50('0x6f')]);}})['then'](respondWithResult(_0x45918b,null))[_0x3a50('0x23')](handleError(_0x45918b,null));};exports[_0x3a50('0x83')]=function(_0x3efa7f,_0x734bb){var _0x2facd2={'raw':![],'where':{}};var _0x1fddca={};var _0x207da7={'count':0x0,'rows':[]};return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0x3efa7f[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x734bb,null))[_0x3a50('0x18')](function(_0x429c7e){if(_0x429c7e){_0x1fddca['model']=_['keys'](db[_0x3a50('0x82')][_0x3a50('0x55')]);_0x1fddca[_0x3a50('0x59')]=_['keys'](_0x3efa7f[_0x3a50('0x59')]);_0x1fddca[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x1fddca['model'],_0x1fddca[_0x3a50('0x59')]);_0x2facd2[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x1fddca['model'],qs[_0x3a50('0x5c')](_0x3efa7f[_0x3a50('0x59')][_0x3a50('0x5c')]));_0x2facd2['attributes']=_0x2facd2[_0x3a50('0x5d')][_0x3a50('0x6d')]?_0x2facd2[_0x3a50('0x5d')]:_0x1fddca[_0x3a50('0x4e')];if(!_0x3efa7f[_0x3a50('0x59')][_0x3a50('0x5e')]('nolimit')){_0x2facd2[_0x3a50('0x28')]=qs['limit'](_0x3efa7f[_0x3a50('0x59')][_0x3a50('0x28')]);_0x2facd2[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x3efa7f['query'][_0x3a50('0x26')]);}_0x2facd2['order']=qs['sort'](_0x3efa7f[_0x3a50('0x59')][_0x3a50('0x60')]);_0x2facd2['where']=qs['filters'](_[_0x3a50('0x62')](_0x3efa7f[_0x3a50('0x59')],_0x1fddca[_0x3a50('0x5a')]));_0x2facd2[_0x3a50('0x61')][_0x3a50('0x7b')]=_0x429c7e['id'];if(_0x3efa7f['query'][_0x3a50('0x63')]){_0x2facd2[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x2facd2['where'],{'$or':_[_0x3a50('0x53')](_0x2facd2[_0x3a50('0x5d')],function(_0x435b5d){var _0xb3e419={};_0xb3e419[_0x435b5d]={'$like':'%'+_0x3efa7f[_0x3a50('0x59')]['filter']+'%'};return _0xb3e419;})});}_0x2facd2=_[_0x3a50('0x65')]({},_0x2facd2,_0x3efa7f[_0x3a50('0x66')]);return db[_0x3a50('0x82')][_0x3a50('0x29')]({'where':_0x2facd2[_0x3a50('0x61')]})[_0x3a50('0x18')](function(_0x2185c5){_0x207da7[_0x3a50('0x29')]=_0x2185c5;if(_0x3efa7f[_0x3a50('0x59')][_0x3a50('0x67')]){_0x2facd2[_0x3a50('0x68')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3a50('0x69')](_0x2facd2);})[_0x3a50('0x18')](function(_0x2afd61){_0x207da7[_0x3a50('0x7f')]=_0x2afd61;return _0x207da7;});}})['then'](respondWithFilteredResult(_0x734bb,_0x2facd2))['catch'](handleError(_0x734bb,null));};exports[_0x3a50('0x84')]=function(_0x4336c1,_0x1797e4){return db['ChatWebsite']['find']({'where':{'id':_0x4336c1['params']['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x1797e4,null))[_0x3a50('0x18')](function(_0x30e063){if(_0x30e063){return _0x30e063[_0x3a50('0x84')](_0x4336c1[_0x3a50('0x59')][_0x3a50('0x85')]);}})[_0x3a50('0x18')](respondWithStatusCode(_0x1797e4,null))['catch'](handleError(_0x1797e4,null));};exports[_0x3a50('0x86')]=function(_0x44b2fb,_0x11f2c9){_0x44b2fb[_0x3a50('0x6f')][_0x3a50('0x87')]=_0x44b2fb['file'][_0x3a50('0x88')];return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x44b2fb['params']['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x11f2c9,null))[_0x3a50('0x18')](saveUpdates(_0x44b2fb['body'],null))[_0x3a50('0x18')](respondWithResult(_0x11f2c9,null))['catch'](handleError(_0x11f2c9,null));};exports[_0x3a50('0x89')]=function(_0x215693,_0x3c1f97){_0x215693[_0x3a50('0x6f')][_0x3a50('0x8a')]=_0x215693[_0x3a50('0x8b')][_0x3a50('0x88')];return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x215693[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x3c1f97,null))[_0x3a50('0x18')](saveUpdates(_0x215693[_0x3a50('0x6f')],null))[_0x3a50('0x18')](respondWithResult(_0x3c1f97,null))['catch'](handleError(_0x3c1f97,null));};exports[_0x3a50('0x8c')]=function(_0x3b3b0d,_0x21b762){_0x3b3b0d['body']['customerAvatar']=_0x3b3b0d['file']['filename'];return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x3b3b0d['params']['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x21b762,null))[_0x3a50('0x18')](saveUpdates(_0x3b3b0d['body'],null))['then'](respondWithResult(_0x21b762,null))[_0x3a50('0x23')](handleError(_0x21b762,null));};exports[_0x3a50('0x8d')]=function(_0x26c0c9,_0x345200){_0x26c0c9[_0x3a50('0x6f')][_0x3a50('0x8e')]=_0x26c0c9[_0x3a50('0x8b')][_0x3a50('0x88')];return db['ChatWebsite']['find']({'where':{'id':_0x26c0c9[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x345200,null))['then'](saveUpdates(_0x26c0c9['body'],null))[_0x3a50('0x18')](respondWithResult(_0x345200,null))[_0x3a50('0x23')](handleError(_0x345200,null));};exports[_0x3a50('0x8f')]=function(_0x59e822,_0x23ffa6){var _0xab91a1=path['join'](config[_0x3a50('0x90')],_0x3a50('0x91'));var _0x1d356f={'where':{'id':_0x59e822['params']['id']},'attributes':['id',_0x3a50('0x87')],'raw':!![]};var _0x3cae7a=![];return require(_0x3a50('0x92'))[_0x3a50('0x93')]()[_0x3a50('0x18')](function(_0x45f138){if(_0x45f138){_0x3cae7a=_0x45f138['custom'];}})[_0x3a50('0x18')](function(){return db[_0x3a50('0x54')]['find'](_0x1d356f);})[_0x3a50('0x18')](handleEntityNotFound(_0x23ffa6,null))[_0x3a50('0x18')](function(_0x59b96a){if(_0x59b96a){if(!_[_0x3a50('0x94')](_0x59b96a[_0x3a50('0x87')])){if(fs[_0x3a50('0x95')](path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x97'),_0x59b96a[_0x3a50('0x87')]))&&_0x3cae7a){_0xab91a1=path[_0x3a50('0x96')](config['root'],_0x3a50('0x97'),_0x59b96a[_0x3a50('0x87')]);}}return _0x23ffa6[_0x3a50('0x98')](_0xab91a1);}})[_0x3a50('0x23')](handleError(_0x23ffa6,null));};exports['getAvatar']=function(_0x5c2641,_0x4b655b){var _0x3d393d=path[_0x3a50('0x96')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x170914={'where':{'id':_0x5c2641[_0x3a50('0x6b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x3a50('0x54')]['find'](_0x170914)[_0x3a50('0x18')](handleEntityNotFound(_0x4b655b,null))['then'](function(_0x34edf9){if(_0x34edf9){if(!_[_0x3a50('0x94')](_0x34edf9['agentAvatar'])){if(fs[_0x3a50('0x95')](path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x99'),_0x34edf9[_0x3a50('0x8a')]))){_0x3d393d=path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x99'),_0x34edf9[_0x3a50('0x8a')]);}}return _0x4b655b['download'](_0x3d393d);}})['catch'](handleError(_0x4b655b,null));};exports[_0x3a50('0x9a')]=function(_0x3e0bad,_0x5e0fd4){var _0x6d3f02=path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x9b'));var _0x47a11a={'where':{'id':_0x3e0bad['params']['id']},'attributes':['id',_0x3a50('0x9c'),_0x3a50('0x9d')],'raw':!![]};return db[_0x3a50('0x54')][_0x3a50('0x75')](_0x47a11a)['then'](handleEntityNotFound(_0x5e0fd4,null))[_0x3a50('0x18')](function(_0x2b74d3){if(_0x2b74d3){if(!_[_0x3a50('0x94')](_0x2b74d3['customerAvatar'])){if(fs[_0x3a50('0x95')](path[_0x3a50('0x96')](config[_0x3a50('0x90')],'server/files/images/avatars/',_0x2b74d3[_0x3a50('0x9c')]))&&_0x2b74d3['showCustomerAvatar']){_0x6d3f02=path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x99'),_0x2b74d3[_0x3a50('0x9c')]);}}return _0x5e0fd4['download'](_0x6d3f02);}})[_0x3a50('0x23')](handleError(_0x5e0fd4,null));};exports[_0x3a50('0x9e')]=function(_0xed3177,_0x47a728){var _0x500865=path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x9f'));var _0x14f4a2={'where':{'id':_0xed3177[_0x3a50('0x6b')]['id']},'attributes':['id',_0x3a50('0x8e')],'raw':!![]};return db[_0x3a50('0x54')][_0x3a50('0x75')](_0x14f4a2)[_0x3a50('0x18')](handleEntityNotFound(_0x47a728,null))[_0x3a50('0x18')](function(_0x4ede24){if(_0x4ede24){if(!_['isNil'](_0x4ede24[_0x3a50('0x8e')])){if(fs[_0x3a50('0x95')](path['join'](config[_0x3a50('0x90')],_0x3a50('0x99'),_0x4ede24[_0x3a50('0x8e')]))){_0x500865=path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x99'),_0x4ede24[_0x3a50('0x8e')]);}}return _0x47a728[_0x3a50('0x98')](_0x500865);}})[_0x3a50('0x23')](handleError(_0x47a728,null));};exports[_0x3a50('0xa0')]=function(_0xbd75ef,_0x529650){var _0x342bab={'body':_0xbd75ef[_0x3a50('0x6f')],'channel':'chat'};var _0x51aa0d=[];var _0x1f33cd=[];var _0x3f8ee2={};var _0x294966=![];return db[_0x3a50('0xa1')][_0x3a50('0x79')]()[_0x3a50('0x18')](function(_0x315138){if(!_0x315138){throw new db[(_0x3a50('0xa2'))][(_0x3a50('0xa3'))](_0x3a50('0xa4'));}_0x51aa0d=_[_0x3a50('0xa5')](_[_0x3a50('0x6c')](_0x315138),[_0x3a50('0xa6'),_0x3a50('0xa7')]);_0x1f33cd=_[_0x3a50('0xa5')](_[_0x3a50('0x6c')](_0x315138),[_0x3a50('0xa6'),'updatedAt',_0x3a50('0xa8'),_0x3a50('0xa9')]);if(_0xbd75ef[_0x3a50('0x6f')]['id']){delete _0xbd75ef[_0x3a50('0x6f')]['id'];}if(_[_0x3a50('0x94')](_0xbd75ef['body'][_0x3a50('0xaa')])){throw new db[(_0x3a50('0xa2'))]['ValidationError'](_0x3a50('0xab'));}if(_[_0x3a50('0x94')](_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0x6f')])||_0xbd75ef[_0x3a50('0x6f')]['body']===''){throw new db[(_0x3a50('0xa2'))]['ValidationError'](_0x3a50('0xac'));}if(_[_0x3a50('0x94')](_0xbd75ef['body'][_0x3a50('0xad')])){throw new db[(_0x3a50('0xa2'))]['ValidationError'](_0x3a50('0xae')+_0x1f33cd);}if(!_['includes'](_0x1f33cd,_0xbd75ef['body']['mapKey'])){throw new db['Sequelize'][(_0x3a50('0xa3'))](_0x3a50('0xaf')+_0x1f33cd);}_0x3f8ee2[_0xbd75ef['body']['mapKey']]=_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xaa')];})[_0x3a50('0x18')](function(){return db['ChatWebsite'][_0x3a50('0x75')]({'where':{'id':_0xbd75ef['params']['id']},'include':[{'model':db[_0x3a50('0xb0')],'as':_0x3a50('0xb1'),'include':[{'model':db[_0x3a50('0xa1')],'as':_0x3a50('0xb2'),'where':_0x3f8ee2,'limit':0x1,'order':[['updatedAt',_0x3a50('0xb3')]]}]},{'model':db[_0x3a50('0xb4')],'as':_0x3a50('0xb5')},{'model':db[_0x3a50('0xb6')],'as':'Interval','include':[{'model':db[_0x3a50('0xb6')],'as':_0x3a50('0x3d'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x3a50('0x18')](function(_0x239719){if(!_0x239719)throw new APINotFoundError(util['format'](_0x3a50('0xb7'),_0xbd75ef['params']['id']));if(!_0x239719[_0x3a50('0xb6')]||!_0x239719['Interval'][_0x3a50('0x3d')])return[_0x239719,!![]];return[_0x239719,checkWebsiteIntervals(_0x239719)];})['spread'](function(_0x1e5e1d,_0x173ef0){if(!_0x173ef0)throw new APIOutOfIntervalError();if(!_0x1e5e1d[_0x3a50('0xb1')])return;_0x342bab[_0x3a50('0xb8')]=_0x1e5e1d;_0x342bab[_0x3a50('0xb9')]=_0x1e5e1d[_0x3a50('0xb1')];_0x342bab[_0x3a50('0xba')]=_[_0x3a50('0xbb')](_0x1e5e1d['Applications'],[_0x3a50('0xbc')],['asc']);if(_0x342bab['account'][_0x3a50('0xb5')]){delete _0x342bab[_0x3a50('0xb8')][_0x3a50('0xb5')];}if(_0x342bab[_0x3a50('0xb8')]['List']&&_0x342bab[_0x3a50('0xb8')][_0x3a50('0xb1')][_0x3a50('0xb2')][_0x3a50('0x6d')]){return _0x342bab[_0x3a50('0xb8')]['List'][_0x3a50('0xb2')][0x0];}var _0x4dc168=_['defaults'](_0xbd75ef[_0x3a50('0x6f')],{'firstName':_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xaa')],'ListId':_0x1e5e1d[_0x3a50('0xa9')]});_0x4dc168[_0xbd75ef['body'][_0x3a50('0xad')]]=_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xaa')];return db[_0x3a50('0xa1')][_0x3a50('0x6e')](_0x4dc168,{'fields':_0x51aa0d,'raw':!![]});})[_0x3a50('0x18')](function(_0x3ceefe){_0x342bab[_0x3a50('0xbd')]=_0x3ceefe;var _0x27bb9f=createInteractionObject(_0xbd75ef[_0x3a50('0x6b')]['id'],_0xbd75ef[_0x3a50('0x6f')],_0xbd75ef[_0x3a50('0xbe')],_0x3ceefe);var _0x233619={'ChatWebsiteId':_0xbd75ef[_0x3a50('0x6b')]['id'],'closed':![]};if(_0xbd75ef['body'][_0x3a50('0xbf')]){_0x233619[_0x3a50('0xbf')]=_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xbf')];return db[_0x3a50('0xc0')][_0x3a50('0x75')]({'where':_0x233619})[_0x3a50('0x18')](function(_0x1cc710){if(_0x1cc710){_0x294966=!![];return _0x1cc710;}_0x27bb9f[_0x3a50('0xbf')]=_0xbd75ef[_0x3a50('0x6f')]['threadId'];_0x27bb9f[_0x3a50('0xc1')]=_0xbd75ef['body']['externalUrl'];return db['ChatInteraction']['create'](_0x27bb9f);});}_0x233619[_0x3a50('0xc2')]=_0x3ceefe['id'];if(_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xc3')]&&_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xc3')]['id']){_0x233619['id']=_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xc3')]['id'];return db[_0x3a50('0xc0')][_0x3a50('0x75')]({'where':_0x233619})[_0x3a50('0x18')](function(_0x160d49){if(_0x160d49){_0x294966=!![];return _0x160d49;}return db['ChatInteraction']['create'](_0x27bb9f);});}return db[_0x3a50('0xc0')][_0x3a50('0x6e')](_0x27bb9f);})[_0x3a50('0x18')](function(_0x2749bb){if(!_0x294966)return _0x2749bb;var _0x616db1={'from':(_0x342bab[_0x3a50('0xbd')]['firstName']||'')+'\x20'+(_0x342bab['contact']['lastName']||'')};if(_0xbd75ef[_0x3a50('0x6f')]['threadId']&&_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xc4')]&&_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xbf')]!=_0xbd75ef['body']['messageId']){_0x616db1[_0x3a50('0xbf')]=_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xc4')];}return _0x2749bb[_0x3a50('0x2c')](_0x616db1);})[_0x3a50('0x18')](function(_0xba4e44){_0x342bab[_0x3a50('0xc3')]=_0xba4e44[_0x3a50('0x70')]({'plain':!![]});_0x342bab[_0x3a50('0xc3')][_0x3a50('0xc5')]=!_0x294966;if(_0x342bab['interaction'][_0x3a50('0xc5')]){if(_0x342bab[_0x3a50('0xb8')][_0x3a50('0xc6')]){_0x342bab[_0x3a50('0xba')][_0x3a50('0xc7')]({'id':0x0,'priority':_0x342bab[_0x3a50('0xba')][_0x3a50('0x6d')]+0x1,'app':_0x3a50('0xc8'),'appdata':_0x3a50('0xc9'),'interval':'*,*,*,*'});}}return db[_0x3a50('0xca')][_0x3a50('0x6e')]({'body':_0xbd75ef[_0x3a50('0x6f')]['body'],'ChatWebsiteId':_0xbd75ef[_0x3a50('0x6b')]['id'],'ChatInteractionId':_0xba4e44['id'],'direction':'in','ContactId':_0x342bab[_0x3a50('0xbd')]['id'],'AttachmentId':_0xbd75ef[_0x3a50('0x6f')][_0x3a50('0xcb')]});})['then'](function(_0x559dee){_0x342bab[_0x3a50('0x1f')]=_0x559dee;if(!_0x342bab[_0x3a50('0xc3')]['UserId']){return;}return db[_0x3a50('0xcc')]['find']({'attributes':['id',_0x3a50('0x31')],'where':{'id':_0x342bab['interaction'][_0x3a50('0xcd')]}});})[_0x3a50('0x18')](function(_0x50b3dc){if(_0x50b3dc){_0x342bab['applications'][_0x3a50('0xce')]({'id':0x0,'priority':0x0,'app':_0x3a50('0xcf'),'appdata':_0x50b3dc['name']+','+(_0x342bab[_0x3a50('0xb8')][_0x3a50('0xd0')]||0xa),'interval':_0x3a50('0xd1')});_0x342bab[_0x3a50('0xd2')]=!![];}if(!_0x342bab[_0x3a50('0xc3')][_0x3a50('0xd3')]){return;}return db[_0x3a50('0xd4')][_0x3a50('0x75')]({'attributes':['id',_0x3a50('0x31')],'where':{'id':_0x342bab['interaction'][_0x3a50('0xd3')]}});})[_0x3a50('0x18')](function(_0x17f43d){if(_0x17f43d){_0x342bab[_0x3a50('0xba')][_0x3a50('0xce')]({'id':0x0,'priority':0x1,'app':_0x3a50('0xd5'),'appdata':_0x17f43d[_0x3a50('0x31')]+','+(_0x342bab[_0x3a50('0xb8')][_0x3a50('0xd6')]||0x12c),'interval':_0x3a50('0xd1')});}return respondWithRpcPromise(_0x3a50('0xd7'),'startRouting',_0x342bab);})[_0x3a50('0x18')](function(_0x325459){respondWithRpcPromise(_0x3a50('0xd8'),_0x3a50('0xd8'),{'event':'notify','message':_0x325459},client9002);return _0x325459;})[_0x3a50('0x18')](respondWithResult(_0x529650,null))[_0x3a50('0x23')](APIHandleError(_0x529650));};exports[_0x3a50('0xd9')]=function(_0x4c4fc1,_0x1340b7){var _0x4fd47e,_0x4875ff,_0x42ab1f;var _0x7252bf=[];var _0xb6016c={};var _0x11a801=_0x4c4fc1[_0x3a50('0xda')]||[];var _0x2cda67=[];var _0x3fc77b;return db[_0x3a50('0xa1')][_0x3a50('0x79')]()['then'](function(_0x4f9eb7){if(!_0x4f9eb7){throw new db[(_0x3a50('0xa2'))][(_0x3a50('0xa3'))]('no\x20available\x20attributes');}_0x7252bf=_[_0x3a50('0xa5')](_[_0x3a50('0x6c')](_0x4f9eb7),[_0x3a50('0xa6'),_0x3a50('0xa7'),_0x3a50('0xa8'),_0x3a50('0xa9')]);if(_0x4c4fc1[_0x3a50('0x6f')]['id']){delete _0x4c4fc1[_0x3a50('0x6f')]['id'];}if(_[_0x3a50('0x94')](_0x4c4fc1['body'][_0x3a50('0xaa')])){throw _0x1340b7[_0x3a50('0x24')](0x1f4)[_0x3a50('0xdb')](new db[(_0x3a50('0xa2'))][(_0x3a50('0xa3'))]('from\x20is\x20mandatory'));}if(_[_0x3a50('0x94')](_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0x6f')])||_0x4c4fc1['body']['body']===''){throw _0x1340b7[_0x3a50('0x24')](0x1f4)[_0x3a50('0xdb')](new db[(_0x3a50('0xa2'))][(_0x3a50('0xa3'))](_0x3a50('0xac')));}if(_[_0x3a50('0x94')](_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0xdc')])){throw _0x1340b7[_0x3a50('0x24')](0x1f4)[_0x3a50('0xdb')](new db[(_0x3a50('0xa2'))]['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7252bf));}if(!_[_0x3a50('0xdd')](_0x7252bf,_0x4c4fc1[_0x3a50('0x6f')]['mapKeyOffline'])){throw _0x1340b7[_0x3a50('0x24')](0x1f4)[_0x3a50('0xdb')](new db[(_0x3a50('0xa2'))][(_0x3a50('0xa3'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7252bf));}_0xb6016c[_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0xdc')]]=_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0xaa')];})[_0x3a50('0x18')](function(){return db['ChatWebsite'][_0x3a50('0x75')]({'where':{'id':_0x4c4fc1[_0x3a50('0x6b')]['id']},'include':[{'model':db[_0x3a50('0xb0')],'as':_0x3a50('0xb1')},{'model':db[_0x3a50('0xde')],'as':_0x3a50('0xde')}]});})[_0x3a50('0x18')](handleEntityNotFound(_0x1340b7,null))[_0x3a50('0x18')](function(_0x46c3d0){if(_0x46c3d0&&_0x46c3d0[_0x3a50('0xb1')]){_0x4875ff=_0x46c3d0;var _0x1fbc20=_['defaults'](_0x4c4fc1[_0x3a50('0x6f')],{'firstName':_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0xaa')],'phone':_0x4c4fc1['body'][_0x3a50('0xaa')],'ListId':_0x46c3d0[_0x3a50('0xa9')]});_0x1fbc20[_0x4c4fc1['body']['mapKeyOffline']]=_0x4c4fc1[_0x3a50('0x6f')][_0x3a50('0xaa')];return db[_0x3a50('0xa1')][_0x3a50('0xdf')]({'where':_0xb6016c,'defaults':_0x1fbc20});}})['spread'](function(_0x595480){if(_0x595480){_0x42ab1f=_0x595480;var _0x18b88a=fs[_0x3a50('0xe0')](path['join'](config[_0x3a50('0x90')],_0x3a50('0xe1')),_0x3a50('0xe2'));var _0x300702=ejs[_0x3a50('0xe3')](_0x18b88a,{'body':_[_0x3a50('0xe4')](_0x4c4fc1[_0x3a50('0x6f')]['body']),'bodyTitle':_0x4875ff['offlineMessageBody']});return db[_0x3a50('0xe5')][_0x3a50('0x6e')]({'body':_0x300702,'plainBody':htmlToText['fromString'](_0x300702),'ContactId':_0x595480['id'],'ChatWebsiteId':_0x4875ff['id']});}})[_0x3a50('0x18')](function(_0x20c0df){_0x3fc77b=_0x20c0df;if(_0x11a801[_0x3a50('0x6d')]){var _0x2b4fc3=_0x11a801['map'](function(_0x44e57d){return{'name':_0x44e57d['originalname'],'basename':_0x44e57d[_0x3a50('0x88')],'type':_0x44e57d[_0x3a50('0xe6')],'ChatOfflineMessageId':_0x20c0df['id']};});_0x2cda67=_0x2b4fc3[_0x3a50('0x53')](_0x5a2ec3=>{var _0x59bd4c={'filename':_0x5a2ec3[_0x3a50('0x31')],'path':path[_0x3a50('0x96')](config['root'],_0x3a50('0xe7'),'files','attachments',_0x3a50('0xe8'),_0x5a2ec3[_0x3a50('0xe9')])};return _0x59bd4c;});if(!_0x4875ff[_0x3a50('0xea')]){return db[_0x3a50('0xeb')]['transaction'](function(_0x414cc8){return db['Attachment'][_0x3a50('0xec')](_0x2b4fc3,{'transaction':_0x414cc8});});}}})[_0x3a50('0x18')](function(){if(_0x3fc77b){_0x4fd47e=_0x3fc77b;return db[_0x3a50('0xde')][_0x3a50('0x7d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3a50('0xed'),'raw':!![],'include':[{'model':db[_0x3a50('0xee')],'as':_0x3a50('0xee'),'raw':!![]}]}]});}})[_0x3a50('0x18')](function(_0x4af506){if(_0x4af506&&_0x4af506[_0x3a50('0xed')]&&_0x4875ff[_0x3a50('0xef')]&&_0x4875ff[_0x3a50('0xf0')]){var _0x4dc62f=_0x4af506[_0x3a50('0xf1')]();return respondWithRpcPromise('SendMail',_0x3a50('0xf2'),{'account':_0x4dc62f,'message':{'from':util['format'](_0x3a50('0xf3'),_0x4af506[_0x3a50('0x31')],_0x4af506[_0x3a50('0xf4')]||_0x4af506[_0x3a50('0xed')][_0x3a50('0x73')]),'to':_0x4875ff[_0x3a50('0xf0')],'subject':_0x4875ff['offlineMessageSubject'],'html':_0x4fd47e[_0x3a50('0x6f')],'attachments':_0x2cda67}},client9003)[_0x3a50('0x18')](function(){return _0x4fd47e;})[_0x3a50('0x23')](function(_0x5064a2){logger[_0x3a50('0x1d')](_0x5064a2);});}})[_0x3a50('0x18')](function(){if(_0x4875ff&&_0x4875ff[_0x3a50('0xea')]&&_0x4875ff[_0x3a50('0xf5')]){var _0x149c2e=[];if(_0x11a801[_0x3a50('0x6d')]){_0x149c2e=_0x11a801[_0x3a50('0x53')](function(_0x4922ea){return{'name':_0x4922ea[_0x3a50('0xf6')],'basename':_0x4922ea[_0x3a50('0x88')],'type':_0x4922ea[_0x3a50('0xe6')],'ChatOfflineMessageId':_0x3fc77b['id']};});}var _0x221cbf;if(!_[_0x3a50('0x94')](_0x4875ff['subjectOffline'])){var _0x598f76=_[_0x3a50('0x53')](_0x4c4fc1[_0x3a50('0x6f')],function(_0x2430b6){return _0x2430b6;});var _0x39ff5a=_[_0x3a50('0xf7')](_0x598f76)[0x0];var _0x3a0c13=_[_0x3a50('0xf8')](_0x39ff5a,function(_0x2900fb){return _0x2900fb;});_0x221cbf=_0x3a0c13[0x1][_0x4875ff[_0x3a50('0xf9')]];}var _0x26623c={'from':_0x42ab1f[_0x3a50('0xf4')],'firstName':_0x42ab1f['firstName'],'lastName':_0x42ab1f[_0x3a50('0xfa')],'mapKey':_0x3a50('0xf4'),'message':{'from':_0x42ab1f[_0x3a50('0xf4')],'to':_0x4875ff[_0x3a50('0xde')][_0x3a50('0xf4')],'cc':'','subject':_[_0x3a50('0x94')](_0x221cbf)?_0x4875ff[_0x3a50('0xfb')]:_0x221cbf,'messageId':'','sentAt':new Date(),'attach':_0x149c2e[_0x3a50('0x6d')],'attachments':_0x149c2e,'originChannel':_0x3a50('0xfc'),'ChatWebsiteId':_0x4875ff['id'],'ChatOfflineMessageId':_0x4fd47e['id'],'originTo':_0x4875ff[_0x3a50('0xde')][_0x3a50('0xf4')]},'body':_0x4fd47e[_0x3a50('0x6f')]};var _0x51df5a={'account':{'id':_0x4875ff[_0x3a50('0xf5')]},'body':_0x26623c,'log':_0x3a50('0xfd')};return respondWithRpcPromise(_0x3a50('0xfd'),_0x3a50('0xfe'),_0x51df5a,client9001)[_0x3a50('0x18')](function(){return _0x4fd47e;})[_0x3a50('0x23')](function(_0x3e3680){logger[_0x3a50('0x1d')](_0x3e3680);});}return;})['then'](function(){if(_0x4fd47e){return _0x4fd47e;}})['then'](respondWithResult(_0x1340b7,null))[_0x3a50('0x23')](function(){for(var _0x1dcc34 of _0x11a801){var _0xcb9b2d=path[_0x3a50('0x96')](config['root'],'server',_0x3a50('0xda'),'attachments',_0x3a50('0xe8'),_0x1dcc34[_0x3a50('0x88')]);fs_extra['remove'](_0xcb9b2d)['catch'](function(_0x18f05d){logger[_0x3a50('0x1d')](_0x3a50('0xff'),_0xcb9b2d,_0x18f05d);});}});};exports[_0x3a50('0x100')]=function(_0xd681fb,_0xa04e61){return db['ChatInteraction'][_0x3a50('0x75')]({'where':{'id':_0xd681fb[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0xa04e61,null))['then'](function(_0x4030f7){if(_0x4030f7){return _0x4030f7['addInteraction'](_0xd681fb['body']['ids'],_[_0x3a50('0x101')](_0xd681fb[_0x3a50('0x6f')],[_0x3a50('0x85'),'id'])||{});}})['then'](respondWithResult(_0xa04e61,null))['catch'](handleError(_0xa04e61,null));};exports[_0x3a50('0x102')]=function(_0xe03a07,_0x5372f7){var _0x2e7608={'raw':![],'where':{}};var _0xbfb429={};var _0x11f2b1={'count':0x0,'rows':[]};return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0xe03a07[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x5372f7,null))['then'](function(_0x17a2bf){if(_0x17a2bf){_0xbfb429[_0x3a50('0x4e')]=_[_0x3a50('0x6c')](db[_0x3a50('0xc0')][_0x3a50('0x55')]);_0xbfb429[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0xe03a07['query']);_0xbfb429['filters']=_[_0x3a50('0x5b')](_0xbfb429['model'],_0xbfb429[_0x3a50('0x59')]);_0x2e7608[_0x3a50('0x5d')]=_['intersection'](_0xbfb429[_0x3a50('0x4e')],qs['fields'](_0xe03a07['query'][_0x3a50('0x5c')]));_0x2e7608[_0x3a50('0x5d')]=_0x2e7608[_0x3a50('0x5d')]['length']?_0x2e7608[_0x3a50('0x5d')]:_0xbfb429[_0x3a50('0x4e')];if(!_0xe03a07[_0x3a50('0x59')]['hasOwnProperty']('nolimit')){_0x2e7608[_0x3a50('0x28')]=qs[_0x3a50('0x28')](_0xe03a07[_0x3a50('0x59')][_0x3a50('0x28')]);_0x2e7608[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0xe03a07['query'][_0x3a50('0x26')]);}_0x2e7608[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0xe03a07[_0x3a50('0x59')][_0x3a50('0x60')]);_0x2e7608['where']=qs[_0x3a50('0x5a')](_[_0x3a50('0x62')](_0xe03a07[_0x3a50('0x59')],_0xbfb429[_0x3a50('0x5a')]));_0x2e7608[_0x3a50('0x61')][_0x3a50('0x7b')]=_0x17a2bf['id'];if(_0xe03a07[_0x3a50('0x59')]['filter']){_0x2e7608[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x2e7608[_0x3a50('0x61')],{'$or':_[_0x3a50('0x53')](_0x2e7608[_0x3a50('0x5d')],function(_0x345eaa){var _0x5329e0={};_0x5329e0[_0x345eaa]={'$like':'%'+_0xe03a07[_0x3a50('0x59')]['filter']+'%'};return _0x5329e0;})});}_0x2e7608=_[_0x3a50('0x65')]({},_0x2e7608,_0xe03a07[_0x3a50('0x66')]);return db[_0x3a50('0xc0')]['count']({'where':_0x2e7608[_0x3a50('0x61')]})[_0x3a50('0x18')](function(_0x32beae){_0x11f2b1[_0x3a50('0x29')]=_0x32beae;if(_0xe03a07[_0x3a50('0x59')]['includeAll']){_0x2e7608['include']=[{'model':db[_0x3a50('0xa1')],'as':_0x3a50('0x103'),'required':![]},{'model':db[_0x3a50('0xcc')],'as':_0x3a50('0x104'),'attributes':['name',_0x3a50('0x105'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3a50('0x106'),'attributes':['id','name',_0x3a50('0x107')],'where':_0xe03a07[_0x3a50('0x59')][_0x3a50('0x108')]?{'id':_0xe03a07[_0x3a50('0x59')][_0x3a50('0x108')]}:undefined,'required':_0xe03a07[_0x3a50('0x59')][_0x3a50('0x108')]?!![]:![]}];}return db[_0x3a50('0xc0')][_0x3a50('0x69')](_0x2e7608);})[_0x3a50('0x18')](function(_0x31207e){_0x11f2b1['rows']=_0x31207e;return _0x11f2b1;});}})[_0x3a50('0x18')](respondWithFilteredResult(_0x5372f7,_0x2e7608))[_0x3a50('0x23')](handleError(_0x5372f7,null));};exports['getSnippet']=function(_0x37df12,_0x14fc0f){var _0x49b283=0x0;var _0x4ffd22=0x0;var _0x5cbeda=![];var _0x4b923f;var _0x3b99d2;return db['ChatWebsite'][_0x3a50('0x75')]({'where':{'id':_0x37df12[_0x3a50('0x6b')]['id']},'include':[{'model':db[_0x3a50('0xb6')],'as':_0x3a50('0xb6'),'include':[{'model':db[_0x3a50('0xb6')],'as':'Intervals','attributes':['id',_0x3a50('0x38')]}]}]})[_0x3a50('0x18')](handleEntityNotFound(_0x14fc0f,null))[_0x3a50('0x18')](function(_0x79d6e2){if(_0x79d6e2){_0x4b923f=_0x79d6e2;return _0x79d6e2[_0x3a50('0x109')]({'raw':!![]});}})[_0x3a50('0x18')](function(_0x2b9bff){if(_0x4b923f){if(_0x2b9bff){_0x3b99d2=_0x2b9bff;}}return require(_0x3a50('0x92'))[_0x3a50('0x93')]();})[_0x3a50('0x18')](function(_0x13602e){if(_0x13602e){_0x4ffd22=_0x13602e[_0x3a50('0x10a')];_0x5cbeda=_0x13602e['custom'];}})[_0x3a50('0x18')](function(){return db[_0x3a50('0xc0')][_0x3a50('0x29')]({'where':{'closed':![]}});})[_0x3a50('0x18')](function(_0x595557){_0x49b283=_0x595557;if(_0x4ffd22&&_0x595557>_0x4ffd22){return db[_0x3a50('0x10b')]['findOne']({'where':{'id':0x1}})[_0x3a50('0x18')](function(_0x1c5840){if(_0x1c5840){_0x1c5840[_0x3a50('0x10c')](_0x3a50('0x10d'));}});}})[_0x3a50('0x18')](function(){if(!_0x4b923f[_0x3a50('0xb6')]||!_0x4b923f[_0x3a50('0xb6')][_0x3a50('0x3d')])return!![];return checkWebsiteIntervals(_0x4b923f);})[_0x3a50('0x18')](function(_0x4adb90){var _0x525ec9=fs[_0x3a50('0xe0')](path[_0x3a50('0x96')](config[_0x3a50('0x90')],_0x3a50('0x10e')),'utf8');var _0x576a0b=new url[(_0x3a50('0x10f'))](_0x4b923f[_0x3a50('0x110')])[_0x3a50('0x111')];var _0xa92699=_0x3a50('0x112');var _0x1710e0=![];var _0x48f91b={'chatVersion':_0xa92699,'chatWebsiteAddressOrigin':_0x576a0b,'remote':_0x4b923f[_0x3a50('0x113')],'query':querystring[_0x3a50('0x1b')](_[_0x3a50('0x65')](_0x4b923f[_0x3a50('0x70')]({'plain':!![]}),{'customerIp':_0x37df12[_0x3a50('0xbe')]['x-forwarded-for']||_0x37df12[_0x3a50('0xbe')][_0x3a50('0x114')]||_0x37df12['connection'][_0x3a50('0x115')]||_0x37df12['ip'],'referer':_0x37df12[_0x3a50('0xbe')][_0x3a50('0x116')],'openedInteractions':_0x49b283,'maxInteractions':_0x4ffd22,'virtual':_0x5cbeda[_0x3a50('0x10a')],'online':_0x4adb90,'custom':_0x5cbeda}))[_0x3a50('0x117')](/'/g,'\x5c\x27')};_0x14fc0f[_0x3a50('0xdb')](ejs[_0x3a50('0xe3')](Mustache[_0x3a50('0xe3')](_0x525ec9,_0x48f91b),{'proactiveActions':_0x3b99d2,'alignment':_0x4b923f[_0x3a50('0x118')],'verticalAlignment':_0x4b923f['verticalAlignment'],'div_color':_0x4b923f['color'],'labelText':_0x4b923f[_0x3a50('0x119')],'text_color':_0x4b923f[_0x3a50('0x11a')],'text_button_color':_0x4b923f[_0x3a50('0x11b')],'button_color':_0x4b923f[_0x3a50('0x11c')],'background_color':_0x4b923f[_0x3a50('0x11d')],'hideWhenOffline':_0x4b923f['hideWhenOffline'],'intervalId':_0x4b923f[_0x3a50('0x11e')],'isDevelopment':_0x1710e0,'chatVersion':_0xa92699}));})['catch'](handleError(_0x14fc0f,null));};exports[_0x3a50('0x11f')]=function(_0x5ca137,_0x1635af){var _0x276476=_0x5ca137[_0x3a50('0x6b')]['id'];var _0x1d9e0b=_0x5ca137[_0x3a50('0x6f')];var _0x17fe35=0xc8;var _0x111522=null;return db['sequelize'][_0x3a50('0x120')]({'isolationLevel':db[_0x3a50('0xeb')][_0x3a50('0x121')][_0x3a50('0x122')][_0x3a50('0x123')]},function(_0x3b0dde){return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0x276476},'transaction':_0x3b0dde})['then'](function(_0x27ca1e){if(_0x27ca1e){return db[_0x3a50('0xb4')][_0x3a50('0x2d')]({'where':{'ChatWebsiteId':_0x276476},'transaction':_0x3b0dde})[_0x3a50('0x18')](function(){var _0x32a5a4=_[_0x3a50('0x53')](_0x1d9e0b,function(_0x197e90){_0x197e90['ChatWebsiteId']=_0x276476;return _0x197e90;});return db[_0x3a50('0xb4')][_0x3a50('0xec')](_0x32a5a4,{'transaction':_0x3b0dde});});}else{_0x17fe35=0x194;_0x111522=[];}});})[_0x3a50('0x18')](function(){if(_0x17fe35!==0x194){return db[_0x3a50('0xb4')][_0x3a50('0x124')]({'where':{'ChatWebsiteId':_0x276476},'order':_0x3a50('0xbc')})[_0x3a50('0x18')](function(_0x4808c7){_0x111522=_0x4808c7;});}})[_0x3a50('0x23')](function(_0x4cd264){_0x17fe35=0x1f4;logger['error'](_0x4cd264[_0x3a50('0x30')]);if(_0x4cd264[_0x3a50('0x31')]){delete _0x4cd264['name'];}_0x111522=_0x4cd264;})[_0x3a50('0x125')](function(){if(_0x111522===null){_0x1635af[_0x3a50('0x126')](_0x17fe35);}else{if(_0x17fe35===0x1f4){_0x1635af[_0x3a50('0x24')](_0x17fe35)[_0x3a50('0xdb')](_0x111522);}else{_0x1635af[_0x3a50('0x24')](_0x17fe35)[_0x3a50('0x25')](_0x111522);}}});};exports[_0x3a50('0x127')]=function(_0x3b690c,_0x3efe41){var _0x2aeddb={};var _0x5356c5={};var _0x505cb8;var _0x542736;return db[_0x3a50('0x54')]['findOne']({'where':{'id':_0x3b690c[_0x3a50('0x6b')]['id']}})['then'](handleEntityNotFound(_0x3efe41,null))[_0x3a50('0x18')](function(_0x10e4ad){if(_0x10e4ad){_0x505cb8=_0x10e4ad;_0x5356c5[_0x3a50('0x4e')]=_[_0x3a50('0x6c')](db['ChatApplication'][_0x3a50('0x55')]);_0x5356c5[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0x3b690c[_0x3a50('0x59')]);_0x5356c5[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x5356c5[_0x3a50('0x4e')],_0x5356c5[_0x3a50('0x59')]);_0x2aeddb[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x5356c5[_0x3a50('0x4e')],qs['fields'](_0x3b690c[_0x3a50('0x59')]['fields']));_0x2aeddb['attributes']=_0x2aeddb[_0x3a50('0x5d')][_0x3a50('0x6d')]?_0x2aeddb[_0x3a50('0x5d')]:_0x5356c5['model'];_0x2aeddb[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x3b690c[_0x3a50('0x59')][_0x3a50('0x60')]);_0x2aeddb[_0x3a50('0x61')]=qs['filters'](_[_0x3a50('0x62')](_0x3b690c[_0x3a50('0x59')],_0x5356c5[_0x3a50('0x5a')]));if(_0x3b690c[_0x3a50('0x59')][_0x3a50('0x63')]){_0x2aeddb[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x2aeddb[_0x3a50('0x61')],{'$or':_[_0x3a50('0x53')](_0x2aeddb[_0x3a50('0x5d')],function(_0x51b614){var _0x438b06={};_0x438b06[_0x51b614]={'$like':'%'+_0x3b690c[_0x3a50('0x59')][_0x3a50('0x63')]+'%'};return _0x438b06;})});}_0x2aeddb=_[_0x3a50('0x65')]({},_0x2aeddb,_0x3b690c['options']);return _0x505cb8[_0x3a50('0x127')](_0x2aeddb);}})[_0x3a50('0x18')](function(_0x18da3b){if(_0x18da3b){_0x542736=_0x18da3b[_0x3a50('0x6d')];if(!_0x3b690c[_0x3a50('0x59')][_0x3a50('0x5e')](_0x3a50('0x7e'))){_0x2aeddb[_0x3a50('0x28')]=qs[_0x3a50('0x28')](_0x3b690c[_0x3a50('0x59')][_0x3a50('0x28')]);_0x2aeddb[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x3b690c[_0x3a50('0x59')][_0x3a50('0x26')]);}return _0x505cb8[_0x3a50('0x127')](_0x2aeddb);}})[_0x3a50('0x18')](function(_0x37ff9a){if(_0x37ff9a){return _0x37ff9a?{'count':_0x542736,'rows':_0x37ff9a}:null;}})['then'](respondWithResult(_0x3efe41,null))[_0x3a50('0x23')](handleError(_0x3efe41,null));};exports[_0x3a50('0x128')]=function(_0x103d2e,_0x5ae643){return db[_0x3a50('0x129')][_0x3a50('0x75')]({'where':{'id':_0x103d2e[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x5ae643,null))[_0x3a50('0x18')](function(_0x287685){if(_0x287685){return _0x287685[_0x3a50('0x128')](_0x103d2e[_0x3a50('0x6f')][_0x3a50('0x85')],_[_0x3a50('0x101')](_0x103d2e[_0x3a50('0x6f')],[_0x3a50('0x85'),'id'])||{});}})[_0x3a50('0x18')](respondWithResult(_0x5ae643,null))[_0x3a50('0x23')](handleError(_0x5ae643,null));};exports[_0x3a50('0x109')]=function(_0x5e462b,_0x4b3e4b){var _0x184eae={};var _0x5593e5={};var _0x18f040;var _0x2e9bed;return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0x5e462b[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x4b3e4b,null))[_0x3a50('0x18')](function(_0x29212f){if(_0x29212f){_0x18f040=_0x29212f;_0x5593e5['model']=_[_0x3a50('0x6c')](db[_0x3a50('0x12a')][_0x3a50('0x55')]);_0x5593e5[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0x5e462b['query']);_0x5593e5[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x5593e5[_0x3a50('0x4e')],_0x5593e5[_0x3a50('0x59')]);_0x184eae[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x5593e5[_0x3a50('0x4e')],qs[_0x3a50('0x5c')](_0x5e462b[_0x3a50('0x59')][_0x3a50('0x5c')]));_0x184eae[_0x3a50('0x5d')]=_0x184eae[_0x3a50('0x5d')][_0x3a50('0x6d')]?_0x184eae[_0x3a50('0x5d')]:_0x5593e5['model'];_0x184eae[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x5e462b['query']['sort']);_0x184eae[_0x3a50('0x61')]=qs['filters'](_[_0x3a50('0x62')](_0x5e462b[_0x3a50('0x59')],_0x5593e5[_0x3a50('0x5a')]));if(_0x5e462b[_0x3a50('0x59')]['filter']){_0x184eae[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x184eae[_0x3a50('0x61')],{'$or':_['map'](_0x184eae[_0x3a50('0x5d')],function(_0x323b43){var _0x3046e3={};_0x3046e3[_0x323b43]={'$like':'%'+_0x5e462b[_0x3a50('0x59')]['filter']+'%'};return _0x3046e3;})});}_0x184eae=_[_0x3a50('0x65')]({},_0x184eae,_0x5e462b[_0x3a50('0x66')]);return _0x18f040[_0x3a50('0x109')](_0x184eae);}})['then'](function(_0xd513fa){if(_0xd513fa){_0x2e9bed=_0xd513fa[_0x3a50('0x6d')];if(!_0x5e462b[_0x3a50('0x59')][_0x3a50('0x5e')](_0x3a50('0x7e'))){_0x184eae[_0x3a50('0x28')]=qs[_0x3a50('0x28')](_0x5e462b[_0x3a50('0x59')][_0x3a50('0x28')]);_0x184eae[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x5e462b[_0x3a50('0x59')]['offset']);}return _0x18f040[_0x3a50('0x109')](_0x184eae);}})['then'](function(_0x371fe6){if(_0x371fe6){return _0x371fe6?{'count':_0x2e9bed,'rows':_0x371fe6}:null;}})[_0x3a50('0x18')](respondWithResult(_0x4b3e4b,null))[_0x3a50('0x23')](handleError(_0x4b3e4b,null));};exports[_0x3a50('0x12b')]=function(_0x49e969,_0x543b25){var _0x48cba9=_0x49e969['query'][_0x3a50('0x12c')]===_0x3a50('0x12d')?'offlineForm':_0x3a50('0x12e');return db[_0x3a50('0x54')][_0x3a50('0x75')]({'attributes':['id',_0x48cba9],'where':{'id':_0x49e969['params']['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x543b25,null))[_0x3a50('0x18')](function(_0x15a3fb){if(_0x15a3fb){var _0x2044fd=_0x15a3fb[_0x48cba9];var _0x4090d9=_0x2044fd&&_0x2044fd[_0x3a50('0x12f')]?_0x2044fd['items']:[];_0x543b25[_0x3a50('0xdb')]({'fromKey':_['isNil'](_0x2044fd['fromKey'])?undefined:_0x2044fd[_0x3a50('0x130')],'count':_0x4090d9[_0x3a50('0x6d')],'rows':_0x4090d9});}})[_0x3a50('0x23')](handleError(_0x543b25,null));};exports[_0x3a50('0x131')]=function(_0x262bce,_0xd1020e){var _0x5ecc72={'raw':![],'where':{}};var _0x1e88d1={};var _0x34bb6d={'count':0x0,'rows':[]};return db[_0x3a50('0x54')]['findOne']({'where':{'id':_0x262bce[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0xd1020e,null))[_0x3a50('0x18')](function(_0x4a327c){if(_0x4a327c){_0x1e88d1['model']=_[_0x3a50('0x6c')](db[_0x3a50('0xe5')]['rawAttributes']);_0x1e88d1[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0x262bce[_0x3a50('0x59')]);_0x1e88d1[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0x1e88d1[_0x3a50('0x4e')],_0x1e88d1[_0x3a50('0x59')]);_0x5ecc72[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0x1e88d1[_0x3a50('0x4e')],qs[_0x3a50('0x5c')](_0x262bce[_0x3a50('0x59')]['fields']));_0x5ecc72[_0x3a50('0x5d')]=_0x5ecc72[_0x3a50('0x5d')]['length']?_0x5ecc72[_0x3a50('0x5d')]:_0x1e88d1['model'];if(!_0x262bce[_0x3a50('0x59')][_0x3a50('0x5e')]('nolimit')){_0x5ecc72[_0x3a50('0x28')]=qs['limit'](_0x262bce[_0x3a50('0x59')]['limit']);_0x5ecc72['offset']=qs[_0x3a50('0x26')](_0x262bce[_0x3a50('0x59')][_0x3a50('0x26')]);}_0x5ecc72[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x262bce[_0x3a50('0x59')]['sort']);_0x5ecc72[_0x3a50('0x61')]=qs[_0x3a50('0x5a')](_[_0x3a50('0x62')](_0x262bce[_0x3a50('0x59')],_0x1e88d1[_0x3a50('0x5a')]));_0x5ecc72[_0x3a50('0x61')][_0x3a50('0x7b')]=_0x4a327c['id'];if(_0x262bce[_0x3a50('0x59')]['filter']){_0x5ecc72[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x5ecc72[_0x3a50('0x61')],{'$or':_[_0x3a50('0x53')](_0x5ecc72[_0x3a50('0x5d')],function(_0x1d203f){var _0x2fc339={};_0x2fc339[_0x1d203f]={'$like':'%'+_0x262bce[_0x3a50('0x59')]['filter']+'%'};return _0x2fc339;})});}_0x5ecc72=_[_0x3a50('0x65')]({},_0x5ecc72,_0x262bce[_0x3a50('0x66')]);return db[_0x3a50('0xe5')]['count']({'where':_0x5ecc72[_0x3a50('0x61')]})[_0x3a50('0x18')](function(_0xda5f9c){_0x34bb6d['count']=_0xda5f9c;if(_0x262bce['query'][_0x3a50('0x67')]){_0x5ecc72[_0x3a50('0x68')]=[{'all':!![]}];}else{_0x5ecc72['include']=[{'model':db[_0x3a50('0xa1')],'as':_0x3a50('0x103'),'required':![]},{'model':db[_0x3a50('0x132')],'as':_0x3a50('0x133'),'required':![]}];}return db['ChatOfflineMessage'][_0x3a50('0x69')](_0x5ecc72);})[_0x3a50('0x18')](function(_0x1a3a8f){_0x34bb6d['rows']=_0x1a3a8f;return _0x34bb6d;});}})[_0x3a50('0x18')](respondWithFilteredResult(_0xd1020e,_0x5ecc72))[_0x3a50('0x23')](handleError(_0xd1020e,null));};exports[_0x3a50('0x134')]=function(_0x97a9d3,_0x20d8e4){return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x97a9d3[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0x20d8e4,null))[_0x3a50('0x18')](function(_0x5e093f){if(_0x5e093f){return _0x5e093f['addAgents'](_0x97a9d3[_0x3a50('0x6f')][_0x3a50('0x85')],_[_0x3a50('0x101')](_0x97a9d3['body'],['ids','id'])||{})[_0x3a50('0x135')](function(_0x48369f){for(var _0x59396b=0x0;_0x59396b<_0x97a9d3[_0x3a50('0x6f')][_0x3a50('0x85')][_0x3a50('0x6d')];_0x59396b+=0x1){socket[_0x3a50('0x136')](_0x3a50('0x137'),{'UserId':Number(_0x97a9d3[_0x3a50('0x6f')][_0x3a50('0x85')][_0x59396b]),'ChatWebsiteId':Number(_0x97a9d3[_0x3a50('0x6b')]['id'])});}return _0x48369f;});}})[_0x3a50('0x18')](respondWithResult(_0x20d8e4,null))['catch'](handleError(_0x20d8e4,null));};exports[_0x3a50('0x138')]=function(_0x1ddf03,_0x33203a){return db[_0x3a50('0x54')][_0x3a50('0x75')]({'where':{'id':_0x1ddf03[_0x3a50('0x6b')]['id']}})['then'](handleEntityNotFound(_0x33203a,null))['then'](function(_0x392c11){if(_0x392c11){return _0x392c11['removeAgents'](_0x1ddf03[_0x3a50('0x59')][_0x3a50('0x85')])['then'](function(){if(_[_0x3a50('0x139')](_0x1ddf03[_0x3a50('0x59')][_0x3a50('0x85')])){for(var _0x5a1c87=0x0;_0x5a1c87<_0x1ddf03['query']['ids'][_0x3a50('0x6d')];_0x5a1c87+=0x1){socket[_0x3a50('0x136')](_0x3a50('0x13a'),{'UserId':Number(_0x1ddf03[_0x3a50('0x59')][_0x3a50('0x85')][_0x5a1c87]),'ChatWebsiteId':Number(_0x1ddf03[_0x3a50('0x6b')]['id'])});}}else{socket[_0x3a50('0x136')]('userChatWebsite:remove',{'UserId':Number(_0x1ddf03[_0x3a50('0x59')][_0x3a50('0x85')]),'ChatWebsiteId':Number(_0x1ddf03[_0x3a50('0x6b')]['id'])});}});}})[_0x3a50('0x18')](respondWithStatusCode(_0x33203a,null))['catch'](handleError(_0x33203a,null));};exports[_0x3a50('0x13b')]=function(_0x3de99f,_0xc7c4f1){var _0x361132={};var _0xf4b1ba={};var _0x3e4e01;var _0x5c8d44;return db[_0x3a50('0x54')][_0x3a50('0x7d')]({'where':{'id':_0x3de99f[_0x3a50('0x6b')]['id']}})[_0x3a50('0x18')](handleEntityNotFound(_0xc7c4f1,null))[_0x3a50('0x18')](function(_0x190f21){if(_0x190f21){_0x3e4e01=_0x190f21;_0xf4b1ba[_0x3a50('0x4e')]=_[_0x3a50('0x6c')](db['User'][_0x3a50('0x55')]);_0xf4b1ba[_0x3a50('0x59')]=_[_0x3a50('0x6c')](_0x3de99f[_0x3a50('0x59')]);_0xf4b1ba[_0x3a50('0x5a')]=_[_0x3a50('0x5b')](_0xf4b1ba[_0x3a50('0x4e')],_0xf4b1ba[_0x3a50('0x59')]);_0x361132[_0x3a50('0x5d')]=_[_0x3a50('0x5b')](_0xf4b1ba['model'],qs[_0x3a50('0x5c')](_0x3de99f['query'][_0x3a50('0x5c')]));_0x361132[_0x3a50('0x5d')]=_0x361132[_0x3a50('0x5d')][_0x3a50('0x6d')]?_0x361132[_0x3a50('0x5d')]:_0xf4b1ba[_0x3a50('0x4e')];_0x361132[_0x3a50('0x5f')]=qs[_0x3a50('0x60')](_0x3de99f[_0x3a50('0x59')]['sort']);_0x361132[_0x3a50('0x61')]=qs['filters'](_[_0x3a50('0x62')](_0x3de99f[_0x3a50('0x59')],_0xf4b1ba[_0x3a50('0x5a')]));if(_0x3de99f[_0x3a50('0x59')]['filter']){_0x361132[_0x3a50('0x61')]=_[_0x3a50('0x65')](_0x361132[_0x3a50('0x61')],{'$or':_['map'](_0x361132[_0x3a50('0x5d')],function(_0x42f22a){var _0x6578f2={};_0x6578f2[_0x42f22a]={'$like':'%'+_0x3de99f[_0x3a50('0x59')][_0x3a50('0x63')]+'%'};return _0x6578f2;})});}_0x361132=_[_0x3a50('0x65')]({},_0x361132,_0x3de99f[_0x3a50('0x66')]);return _0x3e4e01[_0x3a50('0x13b')](_0x361132);}})[_0x3a50('0x18')](function(_0x466d50){if(_0x466d50){_0x5c8d44=_0x466d50[_0x3a50('0x6d')];if(!_0x3de99f['query'][_0x3a50('0x5e')]('nolimit')){_0x361132[_0x3a50('0x28')]=qs['limit'](_0x3de99f[_0x3a50('0x59')][_0x3a50('0x28')]);_0x361132[_0x3a50('0x26')]=qs[_0x3a50('0x26')](_0x3de99f[_0x3a50('0x59')][_0x3a50('0x26')]);}return _0x3e4e01[_0x3a50('0x13b')](_0x361132);}})[_0x3a50('0x18')](function(_0x2d2607){if(_0x2d2607){return _0x2d2607?{'count':_0x5c8d44,'rows':_0x2d2607}:null;}})[_0x3a50('0x18')](respondWithResult(_0xc7c4f1,null))['catch'](handleError(_0xc7c4f1,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 5a0c09d..f4148f0 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 _0x979e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x2ed85c,_0x388634){var _0x4d37e1=function(_0x66e27d){while(--_0x66e27d){_0x2ed85c['push'](_0x2ed85c['shift']());}};_0x4d37e1(++_0x388634);}(_0x979e,0x195));var _0xe979=function(_0x553881,_0x44aecc){_0x553881=_0x553881-0x0;var _0x3378fc=_0x979e[_0x553881];return _0x3378fc;};'use strict';var EventEmitter=require(_0xe979('0x0'));var ChatWebsite=require(_0xe979('0x1'))['db'][_0xe979('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe979('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe979('0x4'),'afterDestroy':_0xe979('0x5')};function emitEvent(_0x386036){return function(_0x3b4b06,_0x2d62dd,_0x5afb7f){ChatWebsiteEvents[_0xe979('0x6')](_0x386036+':'+_0x3b4b06['id'],_0x3b4b06);ChatWebsiteEvents['emit'](_0x386036,_0x3b4b06);_0x5afb7f(null);};}for(var e in events){if(events[_0xe979('0x7')](e)){var event=events[e];ChatWebsite[_0xe979('0x8')](e,emitEvent(event));}}module[_0xe979('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe49a=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x3c53fa,_0x170d9b){var _0x25b1c0=function(_0x46c8c3){while(--_0x46c8c3){_0x3c53fa['push'](_0x3c53fa['shift']());}};_0x25b1c0(++_0x170d9b);}(_0xe49a,0xd7));var _0xae49=function(_0x57aa55,_0x408e79){_0x57aa55=_0x57aa55-0x0;var _0x6bd583=_0xe49a[_0x57aa55];return _0x6bd583;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xae49('0x0'))['db'][_0xae49('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xae49('0x2')](0x0);var events={'afterCreate':_0xae49('0x3'),'afterUpdate':_0xae49('0x4'),'afterDestroy':_0xae49('0x5')};function emitEvent(_0x82a917){return function(_0x526f75,_0x33ce72,_0x1a0dd1){ChatWebsiteEvents[_0xae49('0x6')](_0x82a917+':'+_0x526f75['id'],_0x526f75);ChatWebsiteEvents['emit'](_0x82a917,_0x526f75);_0x1a0dd1(null);};}for(var e in events){if(events[_0xae49('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xae49('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 053beba..853f840 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 _0x6f9d=['moment','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x20e8bd,_0x353719){var _0x1db780=function(_0x179db8){while(--_0x179db8){_0x20e8bd['push'](_0x20e8bd['shift']());}};_0x1db780(++_0x353719);}(_0x6f9d,0x98));var _0xd6f9=function(_0x59f691,_0x1b656d){_0x59f691=_0x59f691-0x0;var _0x1f80bb=_0x6f9d[_0x59f691];return _0x1f80bb;};'use strict';var _=require(_0xd6f9('0x0'));var util=require(_0xd6f9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd6f9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6f9('0x3'));var rimraf=require(_0xd6f9('0x4'));var config=require(_0xd6f9('0x5'));var attributes=require(_0xd6f9('0x6'));module[_0xd6f9('0x7')]=function(_0xe27204,_0x148444){return _0xe27204[_0xd6f9('0x8')](_0xd6f9('0x9'),attributes,{'tableName':_0xd6f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d2e=['api','moment','request-promise','rimraf','exports','define','chat_websites'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x6d2e,0x70));var _0xe6d2=function(_0x10bae6,_0x41d85f){_0x10bae6=_0x10bae6-0x0;var _0x251123=_0x6d2e[_0x10bae6];return _0x251123;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe6d2('0x0'));var moment=require(_0xe6d2('0x1'));var BPromise=require('bluebird');var rp=require(_0xe6d2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6d2('0x3'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0xe6d2('0x4')]=function(_0x16ac49,_0x434893){return _0x16ac49[_0xe6d2('0x5')]('ChatWebsite',attributes,{'tableName':_0xe6d2('0x6'),'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 71727e9..3a2f1cf 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 _0x15f1=['redis','defaults','localhost','socket.io-emitter','register','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http'];(function(_0x538e20,_0x374aed){var _0x2d969e=function(_0x282d4c){while(--_0x282d4c){_0x538e20['push'](_0x538e20['shift']());}};_0x2d969e(++_0x374aed);}(_0x15f1,0x9e));var _0x115f=function(_0x2837ae,_0x2c47ca){_0x2837ae=_0x2837ae-0x0;var _0xf8f847=_0x15f1[_0x2837ae];return _0xf8f847;};'use strict';var _=require(_0x115f('0x0'));var util=require(_0x115f('0x1'));var moment=require(_0x115f('0x2'));var BPromise=require(_0x115f('0x3'));var rs=require(_0x115f('0x4'));var fs=require('fs');var Redis=require(_0x115f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x115f('0x6'))(_0x115f('0x7'));var config=require(_0x115f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x115f('0x9')]({'port':0x232a});config[_0x115f('0xa')]=_[_0x115f('0xb')](config[_0x115f('0xa')],{'host':_0x115f('0xc'),'port':0x18eb});var socket=require(_0x115f('0xd'))(new Redis(config[_0x115f('0xa')]));require('./chatWebsite.socket')[_0x115f('0xe')](socket);function respondWithRpcPromise(_0x4affb9,_0x1c9bf8,_0x37c19a){return new BPromise(function(_0x4f7860,_0xd1c42b){return client['request'](_0x4affb9,_0x37c19a)['then'](function(_0x4f64d5){logger[_0x115f('0xf')](_0x115f('0x10'),_0x1c9bf8,_0x115f('0x11'));logger[_0x115f('0x12')](_0x115f('0x13'),_0x1c9bf8,_0x115f('0x11'),JSON[_0x115f('0x14')](_0x4f64d5));if(_0x4f64d5[_0x115f('0x15')]){if(_0x4f64d5[_0x115f('0x15')][_0x115f('0x16')]===0x1f4){logger['error'](_0x115f('0x10'),_0x1c9bf8,_0x4f64d5[_0x115f('0x15')][_0x115f('0x17')]);return _0xd1c42b(_0x4f64d5['error'][_0x115f('0x17')]);}logger[_0x115f('0x15')](_0x115f('0x10'),_0x1c9bf8,_0x4f64d5['error'][_0x115f('0x17')]);return _0x4f7860(_0x4f64d5[_0x115f('0x15')]['message']);}else{logger[_0x115f('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x1c9bf8,'request\x20sent');_0x4f7860(_0x4f64d5['result'][_0x115f('0x17')]);}})['catch'](function(_0x37768b){logger[_0x115f('0x15')](_0x115f('0x10'),_0x1c9bf8,_0x37768b);_0xd1c42b(_0x37768b);});});} \ No newline at end of file +var _0x0260=['register','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatWebsite.socket'];(function(_0x5ae0b1,_0x855b74){var _0x7b9c8b=function(_0x59de68){while(--_0x59de68){_0x5ae0b1['push'](_0x5ae0b1['shift']());}};_0x7b9c8b(++_0x855b74);}(_0x0260,0x14d));var _0x0026=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0260[_0x5f3f88];return _0xd08119;};'use strict';var _=require('lodash');var util=require(_0x0026('0x0'));var moment=require(_0x0026('0x1'));var BPromise=require(_0x0026('0x2'));var rs=require(_0x0026('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0026('0x4'));var logger=require('../../config/logger')(_0x0026('0x5'));var config=require(_0x0026('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0026('0x7')][_0x0026('0x8')]({'port':0x232a});config[_0x0026('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0026('0xa'))(new Redis(config['redis']));require(_0x0026('0xb'))[_0x0026('0xc')](socket);function respondWithRpcPromise(_0x1749f2,_0x27e80a,_0x142719){return new BPromise(function(_0xe717dc,_0x15b3c0){return client['request'](_0x1749f2,_0x142719)['then'](function(_0x280269){logger['info'](_0x0026('0xd'),_0x27e80a,_0x0026('0xe'));logger[_0x0026('0xf')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x27e80a,'request\x20sent',JSON[_0x0026('0x10')](_0x280269));if(_0x280269[_0x0026('0x11')]){if(_0x280269[_0x0026('0x11')][_0x0026('0x12')]===0x1f4){logger[_0x0026('0x11')](_0x0026('0xd'),_0x27e80a,_0x280269['error']['message']);return _0x15b3c0(_0x280269['error'][_0x0026('0x13')]);}logger[_0x0026('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x27e80a,_0x280269[_0x0026('0x11')][_0x0026('0x13')]);return _0xe717dc(_0x280269[_0x0026('0x11')]['message']);}else{logger[_0x0026('0x14')](_0x0026('0xd'),_0x27e80a,_0x0026('0xe'));_0xe717dc(_0x280269[_0x0026('0x15')]['message']);}})[_0x0026('0x16')](function(_0x8a40cd){logger[_0x0026('0x11')](_0x0026('0xd'),_0x27e80a,_0x8a40cd);_0x15b3c0(_0x8a40cd);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index da4ba4e..4141bab 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 _0x99cb=['remove','update','emit','removeListener','register','chatWebsite:','save'];(function(_0x4f8e6c,_0x66370f){var _0x1f6937=function(_0x27cb53){while(--_0x27cb53){_0x4f8e6c['push'](_0x4f8e6c['shift']());}};_0x1f6937(++_0x66370f);}(_0x99cb,0xd8));var _0xb99c=function(_0x339b9e,_0x5d0bbc){_0x339b9e=_0x339b9e-0x0;var _0x2a669e=_0x99cb[_0x339b9e];return _0x2a669e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xb99c('0x0'),_0xb99c('0x1'),_0xb99c('0x2')];function createListener(_0x45ee85,_0xe4b0bd){return function(_0x715376){_0xe4b0bd[_0xb99c('0x3')](_0x45ee85,_0x715376);};}function removeListener(_0x2a1f60,_0x406455){return function(){ChatWebsiteEvents[_0xb99c('0x4')](_0x2a1f60,_0x406455);};}exports[_0xb99c('0x5')]=function(_0x4b9790){for(var _0x1226d5=0x0,_0x189c0a=events['length'];_0x1226d5<_0x189c0a;_0x1226d5++){var _0x6783a7=events[_0x1226d5];var _0xa94de=createListener(_0xb99c('0x6')+_0x6783a7,_0x4b9790);ChatWebsiteEvents['on'](_0x6783a7,_0xa94de);}}; \ No newline at end of file +var _0xbb9c=['length','chatWebsite:','remove','update','emit'];(function(_0x29c255,_0x30ce9b){var _0x3c5664=function(_0x1c34f5){while(--_0x1c34f5){_0x29c255['push'](_0x29c255['shift']());}};_0x3c5664(++_0x30ce9b);}(_0xbb9c,0xf7));var _0xcbb9=function(_0x16eb19,_0x58cea4){_0x16eb19=_0x16eb19-0x0;var _0x312a25=_0xbb9c[_0x16eb19];return _0x312a25;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xcbb9('0x0'),_0xcbb9('0x1')];function createListener(_0x4713ac,_0x42f01b){return function(_0x36dabc){_0x42f01b[_0xcbb9('0x2')](_0x4713ac,_0x36dabc);};}function removeListener(_0x47e60e,_0x1e3cf6){return function(){ChatWebsiteEvents['removeListener'](_0x47e60e,_0x1e3cf6);};}exports['register']=function(_0x21d1ce){for(var _0x1a2cc4=0x0,_0x5bea38=events[_0xcbb9('0x3')];_0x1a2cc4<_0x5bea38;_0x1a2cc4++){var _0x485c66=events[_0x1a2cc4];var _0x5403fe=createListener(_0xcbb9('0x4')+_0x485c66,_0x21d1ce);ChatWebsiteEvents['on'](_0x485c66,_0x5403fe);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d40e2d5..46fe449 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 _0x505e=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','now','single','file','addLogo','root','server/files/images/avatars/','%s-%s','originalname','addAvatar','addCustomerAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/:id'];(function(_0x5edd83,_0x53c99d){var _0x203431=function(_0xb11787){while(--_0xb11787){_0x5edd83['push'](_0x5edd83['shift']());}};_0x203431(++_0x53c99d);}(_0x505e,0x77));var _0xe505=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x505e[_0x3cc9d9];return _0x1a425d;};'use strict';var multer=require(_0xe505('0x0'));var util=require(_0xe505('0x1'));var path=require('path');var timeout=require(_0xe505('0x2'));var express=require(_0xe505('0x3'));var router=express['Router']();var fs_extra=require(_0xe505('0x4'));var auth=require(_0xe505('0x5'));var interaction=require(_0xe505('0x6'));var config=require(_0xe505('0x7'));var controller=require(_0xe505('0x8'));router[_0xe505('0x9')]('/',auth[_0xe505('0xa')](),controller[_0xe505('0xb')]);router['get']('/describe',auth[_0xe505('0xa')](),controller['describe']);router['get'](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0xd')]);router[_0xe505('0x9')](_0xe505('0xe'),auth['isAuthenticated'](),controller[_0xe505('0xf')]);router[_0xe505('0x9')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller['getAnswers']);router[_0xe505('0x9')]('/:id/logo',controller[_0xe505('0x11')]);router[_0xe505('0x9')](_0xe505('0x12'),controller[_0xe505('0x13')]);router[_0xe505('0x9')](_0xe505('0x14'),controller['getCustomerAvatar']);router[_0xe505('0x9')](_0xe505('0x15'),controller[_0xe505('0x16')]);router[_0xe505('0x9')](_0xe505('0x17'),auth[_0xe505('0xa')](),controller[_0xe505('0x18')]);router['get'](_0xe505('0x19'),controller['getSnippet']);router[_0xe505('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0xe505('0x1a')]);router['get'](_0xe505('0x1b'),auth[_0xe505('0xa')](),controller[_0xe505('0x1c')]);router[_0xe505('0x9')](_0xe505('0x1d'),controller[_0xe505('0x1e')]);router[_0xe505('0x9')]('/:id/offline_messages',auth[_0xe505('0xa')](),controller[_0xe505('0x1f')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xe505('0x20')]);router[_0xe505('0x21')]('/',auth['isAuthenticated'](),controller[_0xe505('0x22')]);router['post'](_0xe505('0xe'),auth[_0xe505('0xa')](),controller[_0xe505('0x23')]);router[_0xe505('0x21')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller[_0xe505('0x24')]);var upload=multer({'storage':multer[_0xe505('0x25')]({'destination':function(_0x5b0a69,_0x9a618f,_0x2559bb){_0x2559bb(null,path[_0xe505('0x26')](config['root'],_0xe505('0x27')));},'filename':function(_0x54befc,_0xa96285,_0x21df52){_0x21df52(null,util[_0xe505('0x28')]('%s-%s',Date[_0xe505('0x29')](),_0xa96285['originalname']));}})});router[_0xe505('0x21')]('/:id/logo',upload[_0xe505('0x2a')](_0xe505('0x2b')),controller[_0xe505('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x117a4f,_0x569f2d,_0xb34df3){_0xb34df3(null,path[_0xe505('0x26')](config[_0xe505('0x2d')],_0xe505('0x2e')));},'filename':function(_0x156b6f,_0x2667e0,_0x2d7d2a){_0x2d7d2a(null,util[_0xe505('0x28')](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x2667e0[_0xe505('0x30')]));}})});router[_0xe505('0x21')](_0xe505('0x12'),upload['single'](_0xe505('0x2b')),controller[_0xe505('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x49b512,_0x5b7dc5,_0x22413b){_0x22413b(null,path['join'](config['root'],_0xe505('0x2e')));},'filename':function(_0x3e6c3f,_0x296296,_0x1830b8){_0x1830b8(null,util['format'](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x296296[_0xe505('0x30')]));}})});router[_0xe505('0x21')](_0xe505('0x14'),upload[_0xe505('0x2a')](_0xe505('0x2b')),controller[_0xe505('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x536e27,_0x1fd5d4,_0x3acf47){_0x3acf47(null,path[_0xe505('0x26')](config['root'],_0xe505('0x2e')));},'filename':function(_0x58e57e,_0x104300,_0x1eb522){_0x1eb522(null,util[_0xe505('0x28')](_0xe505('0x2f'),Date[_0xe505('0x29')](),_0x104300[_0xe505('0x30')]));}})});router['post'](_0xe505('0x15'),upload[_0xe505('0x2a')]('file'),controller['addSystemAvatar']);router[_0xe505('0x21')]('/:id/notify',controller[_0xe505('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xe505('0x25')]({'destination':function(_0x232abf,_0x3f2c21,_0x3e595e){const _0x35590b=path[_0xe505('0x26')](config[_0xe505('0x2d')],'server/files',_0xe505('0x34'),_0xe505('0x35'));fs_extra[_0xe505('0x36')](_0x35590b,function(){_0x3e595e(null,_0x35590b);});},'filename':function(_0x5581b7,_0x1e5119,_0x12e771){const _0x4e8e03=_0x1e5119[_0xe505('0x30')][_0xe505('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x39e49b=path[_0xe505('0x38')](_0x4e8e03);const _0x4a1080=Date['now']()+'-'+_0x4e8e03[_0xe505('0x37')](_0x39e49b,'')+_0x39e49b;_0x12e771(null,_0x4a1080);}})});router['post'](_0xe505('0x39'),offlineUploadMulter['any'](),controller['offline']);router[_0xe505('0x21')](_0xe505('0x17'),auth['isAuthenticated'](),controller[_0xe505('0x3a')]);router['post']('/:id/applications',auth[_0xe505('0xa')](),controller[_0xe505('0x3b')]);router[_0xe505('0x21')](_0xe505('0x1b'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xe505('0x21')]('/:id/users',auth[_0xe505('0xa')](),controller['addAgents']);router['put'](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0x3c')]);router[_0xe505('0x3d')](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0x3e')]);router['delete'](_0xe505('0xe'),auth['isAuthenticated'](),controller[_0xe505('0x3f')]);router[_0xe505('0x3d')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xe505('0xa')](),controller[_0xe505('0x40')]);module[_0xe505('0x41')]=router; \ No newline at end of file +var _0x93d8=['getInteractions','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','file','server/files/images/avatars/','now','single','addAvatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','/:id','removeDispositions','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions'];(function(_0x3ea95c,_0xc11877){var _0x5b0f1a=function(_0x400e8c){while(--_0x400e8c){_0x3ea95c['push'](_0x3ea95c['shift']());}};_0x5b0f1a(++_0xc11877);}(_0x93d8,0x18d));var _0x893d=function(_0x448903,_0x532f1c){_0x448903=_0x448903-0x0;var _0x2d0cc7=_0x93d8[_0x448903];return _0x2d0cc7;};'use strict';var multer=require(_0x893d('0x0'));var util=require(_0x893d('0x1'));var path=require(_0x893d('0x2'));var timeout=require('connect-timeout');var express=require(_0x893d('0x3'));var router=express[_0x893d('0x4')]();var fs_extra=require(_0x893d('0x5'));var auth=require(_0x893d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x893d('0x7'));var controller=require(_0x893d('0x8'));router[_0x893d('0x9')]('/',auth[_0x893d('0xa')](),controller[_0x893d('0xb')]);router[_0x893d('0x9')](_0x893d('0xc'),auth[_0x893d('0xa')](),controller[_0x893d('0xd')]);router[_0x893d('0x9')]('/:id',auth[_0x893d('0xa')](),controller[_0x893d('0xe')]);router[_0x893d('0x9')]('/:id/dispositions',auth[_0x893d('0xa')](),controller[_0x893d('0xf')]);router[_0x893d('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x893d('0x10')]);router[_0x893d('0x9')]('/:id/logo',controller['getLogo']);router[_0x893d('0x9')](_0x893d('0x11'),controller[_0x893d('0x12')]);router[_0x893d('0x9')](_0x893d('0x13'),controller['getCustomerAvatar']);router[_0x893d('0x9')](_0x893d('0x14'),controller[_0x893d('0x15')]);router['get'](_0x893d('0x16'),auth[_0x893d('0xa')](),controller[_0x893d('0x17')]);router[_0x893d('0x9')]('/:id/snippet',controller[_0x893d('0x18')]);router['get'](_0x893d('0x19'),auth[_0x893d('0xa')](),controller[_0x893d('0x1a')]);router[_0x893d('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x893d('0x1b')]);router[_0x893d('0x9')]('/:id/fields',controller[_0x893d('0x1c')]);router[_0x893d('0x9')](_0x893d('0x1d'),auth['isAuthenticated'](),controller[_0x893d('0x1e')]);router[_0x893d('0x9')](_0x893d('0x1f'),auth['isAuthenticated'](),controller[_0x893d('0x20')]);router[_0x893d('0x21')]('/',auth[_0x893d('0xa')](),controller[_0x893d('0x22')]);router[_0x893d('0x21')](_0x893d('0x23'),auth['isAuthenticated'](),controller[_0x893d('0x24')]);router['post'](_0x893d('0x25'),auth['isAuthenticated'](),controller[_0x893d('0x26')]);var upload=multer({'storage':multer[_0x893d('0x27')]({'destination':function(_0x53ceb5,_0x27ff3d,_0x21e8d5){_0x21e8d5(null,path[_0x893d('0x28')](config[_0x893d('0x29')],_0x893d('0x2a')));},'filename':function(_0xeb4d36,_0x5c23e4,_0x43aa70){_0x43aa70(null,util[_0x893d('0x2b')](_0x893d('0x2c'),Date['now'](),_0x5c23e4[_0x893d('0x2d')]));}})});router[_0x893d('0x21')]('/:id/logo',upload['single'](_0x893d('0x2e')),controller['addLogo']);var upload=multer({'storage':multer[_0x893d('0x27')]({'destination':function(_0x1e6121,_0x2ddc6f,_0x509bd0){_0x509bd0(null,path[_0x893d('0x28')](config[_0x893d('0x29')],_0x893d('0x2f')));},'filename':function(_0x59cc98,_0x2735d2,_0x1b876e){_0x1b876e(null,util['format'](_0x893d('0x2c'),Date[_0x893d('0x30')](),_0x2735d2['originalname']));}})});router[_0x893d('0x21')]('/:id/avatar',upload[_0x893d('0x31')](_0x893d('0x2e')),controller[_0x893d('0x32')]);var upload=multer({'storage':multer[_0x893d('0x27')]({'destination':function(_0x21b6ff,_0xc8448a,_0x2e32d0){_0x2e32d0(null,path[_0x893d('0x28')](config[_0x893d('0x29')],'server/files/images/avatars/'));},'filename':function(_0x183d7c,_0x2ef76e,_0x32772d){_0x32772d(null,util[_0x893d('0x2b')]('%s-%s',Date[_0x893d('0x30')](),_0x2ef76e[_0x893d('0x2d')]));}})});router['post'](_0x893d('0x13'),upload['single'](_0x893d('0x2e')),controller[_0x893d('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x325090,_0x5bb02d,_0x33b635){_0x33b635(null,path['join'](config[_0x893d('0x29')],_0x893d('0x2f')));},'filename':function(_0x4a2357,_0x508add,_0x5cb95f){_0x5cb95f(null,util['format'](_0x893d('0x2c'),Date[_0x893d('0x30')](),_0x508add[_0x893d('0x2d')]));}})});router[_0x893d('0x21')]('/:id/system_avatar',upload[_0x893d('0x31')]('file'),controller[_0x893d('0x34')]);router[_0x893d('0x21')]('/:id/notify',controller[_0x893d('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x893d('0x27')]({'destination':function(_0x2bf2ac,_0x3ed0d5,_0x5530ca){const _0x192151=path[_0x893d('0x28')](config[_0x893d('0x29')],_0x893d('0x36'),_0x893d('0x37'),_0x893d('0x38'));fs_extra[_0x893d('0x39')](_0x192151,function(){_0x5530ca(null,_0x192151);});},'filename':function(_0x198380,_0x2f4d8e,_0x5b2b46){const _0x1361bc=_0x2f4d8e['originalname'][_0x893d('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x38d75c=path[_0x893d('0x3b')](_0x1361bc);const _0x3af262=Date['now']()+'-'+_0x1361bc[_0x893d('0x3a')](_0x38d75c,'')+_0x38d75c;_0x5b2b46(null,_0x3af262);}})});router[_0x893d('0x21')](_0x893d('0x3c'),offlineUploadMulter[_0x893d('0x3d')](),controller['offline']);router[_0x893d('0x21')](_0x893d('0x16'),auth[_0x893d('0xa')](),controller['addInteraction']);router['post'](_0x893d('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x893d('0x3e'),auth[_0x893d('0xa')](),controller[_0x893d('0x3f')]);router[_0x893d('0x21')]('/:id/users',auth[_0x893d('0xa')](),controller[_0x893d('0x40')]);router['put']('/:id',auth[_0x893d('0xa')](),controller[_0x893d('0x41')]);router[_0x893d('0x42')](_0x893d('0x43'),auth[_0x893d('0xa')](),controller['destroy']);router[_0x893d('0x42')](_0x893d('0x23'),auth['isAuthenticated'](),controller[_0x893d('0x44')]);router['delete'](_0x893d('0x25'),auth[_0x893d('0xa')](),controller['removeAnswers']);router[_0x893d('0x42')](_0x893d('0x1f'),auth[_0x893d('0xa')](),controller['removeAgents']);module[_0x893d('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 0ded495..974a9b3 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 _0x0ea4=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','env','app','get','client-side-logger'];(function(_0x51aa5b,_0x512fc0){var _0x5066d8=function(_0x2bdda9){while(--_0x2bdda9){_0x51aa5b['push'](_0x51aa5b['shift']());}};_0x5066d8(++_0x512fc0);}(_0x0ea4,0x181));var _0x40ea=function(_0x276e08,_0x2c5ce5){_0x276e08=_0x276e08-0x0;var _0x54dd69=_0x0ea4[_0x276e08];return _0x54dd69;};var beaverLogger=require(_0x40ea('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require('../config/environment');var router=express['Router']();var isProduction=config[_0x40ea('0x1')]==='production'||![];function clientSideLogs(_0x41c3d6,_0x30f87e,_0x343bcc){var _0x344e1f=_0x41c3d6[_0x40ea('0x2')][_0x40ea('0x3')](_0x40ea('0x4'));if(!_0x344e1f){throw new Error(_0x40ea('0x5'));}return beaverLogger[_0x40ea('0x6')]({'uri':'/client-logs','logger':_0x344e1f,'enableCors':!isProduction})(_0x41c3d6,_0x30f87e,_0x343bcc);}router[_0x40ea('0x7')](auth[_0x40ea('0x8')](),clientSideLogs);module[_0x40ea('0x9')]=router; \ No newline at end of file +var _0xfa78=['express','../components/auth/service','../config/environment','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0xfa78,0x1d4));var _0x8fa7=function(_0x11a8e3,_0x1c5772){_0x11a8e3=_0x11a8e3-0x0;var _0x4e3fcf=_0xfa78[_0x11a8e3];return _0x4e3fcf;};var beaverLogger=require('beaver-logger/server');var express=require(_0x8fa7('0x0'));var auth=require(_0x8fa7('0x1'));var config=require(_0x8fa7('0x2'));var router=express['Router']();var isProduction=config[_0x8fa7('0x3')]===_0x8fa7('0x4')||![];function clientSideLogs(_0x3d4fa4,_0x5b85e3,_0x3a1d92){var _0x5ab8d7=_0x3d4fa4['app'][_0x8fa7('0x5')](_0x8fa7('0x6'));if(!_0x5ab8d7){throw new Error(_0x8fa7('0x7'));}return beaverLogger[_0x8fa7('0x8')]({'uri':_0x8fa7('0x9'),'logger':_0x5ab8d7,'enableCors':!isProduction})(_0x3d4fa4,_0x5b85e3,_0x3a1d92);}router[_0x8fa7('0xa')](auth['isAuthenticated'](),clientSideLogs);module[_0x8fa7('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 0e2c14f..d9295a6 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 _0xcd5f=['exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcd5f,0x1a0));var _0xfcd5=function(_0x103f49,_0x2d8350){_0x103f49=_0x103f49-0x0;var _0x7fbb3b=_0xcd5f[_0x103f49];return _0x7fbb3b;};'use strict';var Sequelize=require('sequelize');module[_0xfcd5('0x0')]={'name':{'type':Sequelize[_0xfcd5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfcd5('0x2')](_0xfcd5('0x3'),_0xfcd5('0x4'),_0xfcd5('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfcd5('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xfcd5('0x1')],'comment':_0xfcd5('0x7')},'data2':{'type':Sequelize[_0xfcd5('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xfcd5('0x1')],'comment':_0xfcd5('0x8')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xfcd5('0x9')],'comment':_0xfcd5('0xa')},'data6':{'type':Sequelize[_0xfcd5('0x9')],'comment':_0xfcd5('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0xfcd5('0xc')}}; \ No newline at end of file +var _0x2cd3=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x48682a,_0x443698){var _0x20bcaa=function(_0x42f2b){while(--_0x42f2b){_0x48682a['push'](_0x48682a['shift']());}};_0x20bcaa(++_0x443698);}(_0x2cd3,0x6e));var _0x32cd=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x2cd3[_0x195577];return _0x13c367;};'use strict';var Sequelize=require(_0x32cd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x32cd('0x1')](_0x32cd('0x2'),_0x32cd('0x3'),_0x32cd('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x32cd('0x1')]('Outlook365',_0x32cd('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x32cd('0x6')},'data2':{'type':Sequelize[_0x32cd('0x7')],'comment':_0x32cd('0x8')},'data3':{'type':Sequelize[_0x32cd('0x7')],'comment':_0x32cd('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x32cd('0xa')},'data5':{'type':Sequelize[_0x32cd('0xb')],'comment':_0x32cd('0xc')},'data6':{'type':Sequelize[_0x32cd('0xb')],'comment':_0x32cd('0xd')},'data7':{'type':Sequelize[_0x32cd('0xb')],'comment':_0x32cd('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 7e914a3..21d546e 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 _0xe58b=['data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','hasOwnProperty','nolimit','query','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','body','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code'];(function(_0xec3aa8,_0x113c4b){var _0x33029b=function(_0x378db3){while(--_0x378db3){_0xec3aa8['push'](_0xec3aa8['shift']());}};_0x33029b(++_0x113c4b);}(_0xe58b,0x18a));var _0xbe58=function(_0x5e94e4,_0x32f8ee){_0x5e94e4=_0x5e94e4-0x0;var _0x59b607=_0xe58b[_0x5e94e4];return _0x59b607;};'use strict';var _=require(_0xbe58('0x0'));var Redis=require('ioredis');var qs=require(_0xbe58('0x1'));var encryptor=require(_0xbe58('0x2'));var config=require(_0xbe58('0x3'));var logger=require('../../config/logger')(_0xbe58('0x4'));var db=require(_0xbe58('0x5'))['db'];var oauth=require(_0xbe58('0x6'));config[_0xbe58('0x7')]=_['defaults'](config[_0xbe58('0x7')],{'host':_0xbe58('0x8'),'port':0x18eb});var socket=require(_0xbe58('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0xbe58('0x7')]);function respondWithStatusCode(_0x411997,_0xb1fdf8){_0xb1fdf8=_0xb1fdf8||0xcc;return function(_0xf4e016){if(_0xf4e016){return _0x411997[_0xbe58('0xa')](_0xb1fdf8);}return _0x411997[_0xbe58('0xb')](_0xb1fdf8)['end']();};}function respondWithResult(_0x46299a,_0x27da6b){_0x27da6b=_0x27da6b||0xc8;return function(_0x2ca3b3){if(_0x2ca3b3){return _0x46299a['status'](_0x27da6b)['json'](_0x2ca3b3);}};}function respondWithFilteredResult(_0xe1610a,_0x558075){return function(_0xe3a2be){if(_0xe3a2be){var _0x136866=typeof _0x558075[_0xbe58('0xc')]===_0xbe58('0xd')&&typeof _0x558075['limit']==='undefined';var _0x24b609=_0xe3a2be[_0xbe58('0xe')];var _0x4cc07b=_0x136866?0x0:_0x558075[_0xbe58('0xc')];var _0x3258b8=_0x136866?_0xe3a2be[_0xbe58('0xe')]:_0x558075[_0xbe58('0xc')]+_0x558075[_0xbe58('0xf')];var _0x58005a;if(_0x3258b8>=_0x24b609){_0x3258b8=_0x24b609;_0x58005a=0xc8;}else{_0x58005a=0xce;}_0xe1610a[_0xbe58('0xb')](_0x58005a);return _0xe1610a[_0xbe58('0x10')](_0xbe58('0x11'),_0x4cc07b+'-'+_0x3258b8+'/'+_0x24b609)[_0xbe58('0x12')](_0xe3a2be);}return null;};}function saveUpdates(_0x5975d6){return function(_0x2d02dc){if(_0x2d02dc){return _0x2d02dc[_0xbe58('0x13')](_0x5975d6)[_0xbe58('0x14')](function(_0x2d2545){return _0x2d2545;});}return null;};}function removeEntity(_0x4dd33b){return function(_0x2b4f63){if(_0x2b4f63){return _0x2b4f63[_0xbe58('0x15')]()[_0xbe58('0x14')](function(){_0x4dd33b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5291e2){return function(_0x4d3416){if(!_0x4d3416){_0x5291e2['sendStatus'](0x194);}return _0x4d3416;};}function handleError(_0x2f15cc,_0x4714b0){_0x4714b0=_0x4714b0||0x1f4;return function(_0x2d6116){logger[_0xbe58('0x16')](_0x2d6116[_0xbe58('0x17')]);if(_0x2d6116[_0xbe58('0x18')]){delete _0x2d6116[_0xbe58('0x18')];}_0x2f15cc[_0xbe58('0xb')](_0x4714b0)[_0xbe58('0x19')](_0x2d6116);};}function maskClientSecret(_0x3d3bc9){return _[_0xbe58('0x1a')](_0x3d3bc9[_0xbe58('0x1b')](0x0,0x3),0x14,'*');}exports[_0xbe58('0x1c')]=function(_0x1e3f28,_0x51e08c){var _0x5b2fab={},_0x503ffc={},_0x547595={'count':0x0,'rows':[]};var _0x36e028=_[_0xbe58('0x1d')](db[_0xbe58('0x1e')][_0xbe58('0x1f')],function(_0x49b78d){return{'name':_0x49b78d[_0xbe58('0x20')],'type':_0x49b78d[_0xbe58('0x21')][_0xbe58('0x22')]};});_0x503ffc[_0xbe58('0x23')]=_[_0xbe58('0x1d')](_0x36e028,_0xbe58('0x18'));_0x503ffc['query']=_['keys'](_0x1e3f28['query']);_0x503ffc[_0xbe58('0x24')]=_[_0xbe58('0x25')](_0x503ffc[_0xbe58('0x23')],_0x503ffc['query']);_0x5b2fab[_0xbe58('0x26')]=_['intersection'](_0x503ffc[_0xbe58('0x23')],qs[_0xbe58('0x27')](_0x1e3f28['query'][_0xbe58('0x27')]));_0x5b2fab[_0xbe58('0x26')]=_0x5b2fab[_0xbe58('0x26')]['length']?_0x5b2fab[_0xbe58('0x26')]:_0x503ffc[_0xbe58('0x23')];if(!_0x1e3f28['query'][_0xbe58('0x28')](_0xbe58('0x29'))){_0x5b2fab[_0xbe58('0xf')]=qs['limit'](_0x1e3f28[_0xbe58('0x2a')][_0xbe58('0xf')]);_0x5b2fab[_0xbe58('0xc')]=qs['offset'](_0x1e3f28['query']['offset']);}_0x5b2fab[_0xbe58('0x2b')]=qs[_0xbe58('0x2c')](_0x1e3f28[_0xbe58('0x2a')]['sort']);_0x5b2fab[_0xbe58('0x2d')]=qs[_0xbe58('0x24')](_[_0xbe58('0x2e')](_0x1e3f28[_0xbe58('0x2a')],_0x503ffc[_0xbe58('0x24')]),_0x36e028);if(_0x1e3f28[_0xbe58('0x2a')]['filter']){_0x5b2fab['where']=_[_0xbe58('0x2f')](_0x5b2fab[_0xbe58('0x2d')],{'$or':_[_0xbe58('0x1d')](_0x36e028,function(_0x5a3ac0){if(_0x5a3ac0[_0xbe58('0x21')]!==_0xbe58('0x30')){var _0x4cd886={};_0x4cd886[_0x5a3ac0[_0xbe58('0x18')]]={'$like':'%'+_0x1e3f28['query'][_0xbe58('0x31')]+'%'};return _0x4cd886;}})});}_0x5b2fab=_[_0xbe58('0x2f')]({},_0x5b2fab,_0x1e3f28['options']);var _0x42e218={'where':_0x5b2fab[_0xbe58('0x2d')]};return db[_0xbe58('0x1e')][_0xbe58('0xe')](_0x42e218)['then'](function(_0x22757e){_0x547595[_0xbe58('0xe')]=_0x22757e;if(_0x1e3f28[_0xbe58('0x2a')][_0xbe58('0x32')]){_0x5b2fab[_0xbe58('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0xbe58('0x34')](_0x5b2fab);})['then'](function(_0x376256){_0x547595[_0xbe58('0x35')]=_['map'](_0x376256,function(_0x562ce0){if(_0x562ce0[_0xbe58('0x36')]===_0xbe58('0x37')){var _0x3a81a4=encryptor[_0xbe58('0x38')](_0x562ce0[_0xbe58('0x39')]);_0x562ce0[_0xbe58('0x39')]=maskClientSecret(_0x3a81a4);}return _0x562ce0;});return _0x547595;})['then'](respondWithFilteredResult(_0x51e08c,_0x5b2fab))[_0xbe58('0x3a')](handleError(_0x51e08c,null));};exports[_0xbe58('0x3b')]=function(_0x2f6254,_0x1c5738){var _0x12daab={'raw':!![],'where':{'id':_0x2f6254[_0xbe58('0x3c')]['id']}},_0x5526cf={};_0x5526cf[_0xbe58('0x23')]=_['keys'](db['CloudProvider'][_0xbe58('0x1f')]);_0x5526cf[_0xbe58('0x2a')]=_['keys'](_0x2f6254[_0xbe58('0x2a')]);_0x5526cf[_0xbe58('0x24')]=_[_0xbe58('0x25')](_0x5526cf[_0xbe58('0x23')],_0x5526cf[_0xbe58('0x2a')]);_0x12daab[_0xbe58('0x26')]=_[_0xbe58('0x25')](_0x5526cf['model'],qs[_0xbe58('0x27')](_0x2f6254[_0xbe58('0x2a')][_0xbe58('0x27')]));_0x12daab['attributes']=_0x12daab['attributes']['length']?_0x12daab['attributes']:_0x5526cf['model'];if(_0x2f6254[_0xbe58('0x2a')][_0xbe58('0x32')]){_0x12daab[_0xbe58('0x33')]=[{'all':!![]}];}_0x12daab=_[_0xbe58('0x2f')]({},_0x12daab,_0x2f6254[_0xbe58('0x3d')]);return db[_0xbe58('0x1e')][_0xbe58('0x3e')](_0x12daab)[_0xbe58('0x14')](handleEntityNotFound(_0x1c5738,null))['then'](function(_0x28e0bb){if(_0x28e0bb[_0xbe58('0x36')]===_0xbe58('0x37')){var _0xaee2bf=encryptor[_0xbe58('0x38')](_0x28e0bb[_0xbe58('0x39')]);_0x28e0bb['data3']=maskClientSecret(_0xaee2bf);}return _0x28e0bb;})['then'](respondWithResult(_0x1c5738,null))['catch'](handleError(_0x1c5738,null));};exports['create']=function(_0x9d9a1e,_0x332a09){if(!_0x9d9a1e[_0xbe58('0x3f')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x9d9a1e['body']['service'])throw new Error(_0xbe58('0x40'));var _0x925f3b=db['CloudProvider']['rawAttributes']['service']['values'];if(!_0x925f3b['includes'](_0x9d9a1e['body'][_0xbe58('0x36')]))throw new Error(_0xbe58('0x41')+_0x925f3b[_0xbe58('0x42')](',\x20'));if(_0x9d9a1e['body'][_0xbe58('0x36')]===_0xbe58('0x37')&&_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]){_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]=encryptor[_0xbe58('0x43')](_0x9d9a1e[_0xbe58('0x3f')][_0xbe58('0x39')]);}return db[_0xbe58('0x1e')][_0xbe58('0x44')](_0x9d9a1e['body'],{})[_0xbe58('0x14')](respondWithResult(_0x332a09,0xc9))[_0xbe58('0x3a')](handleError(_0x332a09,null));};exports[_0xbe58('0x13')]=function(_0x209125,_0xb6fad6){if(_0x209125[_0xbe58('0x3f')]['id']){delete _0x209125[_0xbe58('0x3f')]['id'];}return db[_0xbe58('0x1e')]['find']({'where':{'id':_0x209125[_0xbe58('0x3c')]['id']}})['then'](handleEntityNotFound(_0xb6fad6,null))[_0xbe58('0x14')](function(_0x3b343e){if(_0x3b343e[_0xbe58('0x36')]==='MicrosoftAzure'&&_0x209125[_0xbe58('0x3f')][_0xbe58('0x39')]){_0x209125['body']['data3']=encryptor[_0xbe58('0x43')](_0x209125[_0xbe58('0x3f')][_0xbe58('0x39')]);}return _0x3b343e;})[_0xbe58('0x14')](saveUpdates(_0x209125[_0xbe58('0x3f')],null))['then'](respondWithResult(_0xb6fad6,null))['catch'](handleError(_0xb6fad6,null));};exports[_0xbe58('0x15')]=function(_0x2bbcae,_0x3f60bd){return db['CloudProvider'][_0xbe58('0x3e')]({'where':{'id':_0x2bbcae['params']['id']}})[_0xbe58('0x14')](handleEntityNotFound(_0x3f60bd,null))[_0xbe58('0x14')](removeEntity(_0x3f60bd,null))[_0xbe58('0x3a')](handleError(_0x3f60bd,null));};exports[_0xbe58('0x45')]=function(_0x92d27c,_0x37ff42){return db['CloudProvider'][_0xbe58('0x46')]({'where':{'id':_0x92d27c[_0xbe58('0x3c')]['id']},'raw':!![]})['then'](function(_0x358dc2){if(!_0x358dc2)return _0x37ff42[_0xbe58('0xa')](0x194);return{'url':oauth[_0xbe58('0x47')](_0x358dc2,_0x92d27c[_0xbe58('0x48')]['id'])};})['then'](respondWithResult(_0x37ff42,null))[_0xbe58('0x3a')](handleError(_0x37ff42,null));};exports[_0xbe58('0x49')]=function(_0x32c10c,_0x472a82){var _0xabfaf5=_0x32c10c['body'];var _0x1b7c50;var _0x48b7f8;if(_0xabfaf5[_0xbe58('0x16')])throw _0xabfaf5;redis['get'](_0xabfaf5[_0xbe58('0x4a')])['then'](function(_0x443a07){if(!_0x443a07)throw new Error(_0xbe58('0x4b'));_0x1b7c50=JSON[_0xbe58('0x4c')](_0x443a07);var _0x59052e=Buffer[_0xbe58('0x4d')](_0xabfaf5[_0xbe58('0x4a')],_0xbe58('0x4e'))['toString'](_0xbe58('0x4f'));_0x48b7f8=JSON['parse'](_0x59052e);if(!oauth[_0xbe58('0x50')](_0xabfaf5[_0xbe58('0x51')],_0x1b7c50[_0xbe58('0x52')]))throw new Error(_0xbe58('0x53'));redis[_0xbe58('0x54')](_0xabfaf5[_0xbe58('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0xabfaf5[_0xbe58('0x55')],_0x1b7c50);})[_0xbe58('0x14')](function(_0x4ebeff){_0x1b7c50[_0xbe58('0x56')]=_0x4ebeff[_0xbe58('0x57')];_0x1b7c50[_0xbe58('0x58')]=_0x4ebeff[_0xbe58('0x59')];return db[_0xbe58('0x1e')][_0xbe58('0x13')]({'data5':_0x1b7c50[_0xbe58('0x56')],'data6':_0x1b7c50[_0xbe58('0x58')]},{'where':{'id':_0x1b7c50['id']}});})[_0xbe58('0x14')](function(){oauth[_0xbe58('0x5a')](_0x1b7c50);socket[_0xbe58('0x5b')](_0xbe58('0x5c'),{'id':_0x48b7f8['id']});return;})[_0xbe58('0x14')](respondWithStatusCode(_0x472a82,null))['catch'](function(_0x5060a1){if(_0x48b7f8){socket[_0xbe58('0x5b')]('microsoftAuthorization:error',{'id':_0x48b7f8['id']});}if(!_0x1b7c50){logger[_0xbe58('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x5060a1);return _0x472a82[_0xbe58('0xb')](0x1f4)[_0xbe58('0x19')](_0x5060a1[_0xbe58('0x5d')]);}logger['error'](_0xbe58('0x5e'),_0x1b7c50['id'],JSON[_0xbe58('0x5f')](_0x5060a1));});}; \ No newline at end of file +var _0x4fe1=['encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','startRefreshInterval','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','include','find','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0x4fe1,0x127));var _0x14fe=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4fe1[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var Redis=require(_0x14fe('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x14fe('0x1'));var config=require(_0x14fe('0x2'));var logger=require(_0x14fe('0x3'))('api');var db=require(_0x14fe('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x14fe('0x5')]=_[_0x14fe('0x6')](config['redis'],{'host':_0x14fe('0x7'),'port':0x18eb});var socket=require(_0x14fe('0x8'))(new Redis(config[_0x14fe('0x5')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x167b82,_0x5264a8){_0x5264a8=_0x5264a8||0xcc;return function(_0x4eef1e){if(_0x4eef1e){return _0x167b82[_0x14fe('0x9')](_0x5264a8);}return _0x167b82[_0x14fe('0xa')](_0x5264a8)[_0x14fe('0xb')]();};}function respondWithResult(_0xb01d96,_0x152dae){_0x152dae=_0x152dae||0xc8;return function(_0x22244c){if(_0x22244c){return _0xb01d96[_0x14fe('0xa')](_0x152dae)[_0x14fe('0xc')](_0x22244c);}};}function respondWithFilteredResult(_0x21cbc6,_0x2a7bcc){return function(_0x418e49){if(_0x418e49){var _0x32896a=typeof _0x2a7bcc[_0x14fe('0xd')]==='undefined'&&typeof _0x2a7bcc[_0x14fe('0xe')]==='undefined';var _0x4f6b05=_0x418e49[_0x14fe('0xf')];var _0x233ba5=_0x32896a?0x0:_0x2a7bcc[_0x14fe('0xd')];var _0x44d0a0=_0x32896a?_0x418e49['count']:_0x2a7bcc['offset']+_0x2a7bcc[_0x14fe('0xe')];var _0x528bf6;if(_0x44d0a0>=_0x4f6b05){_0x44d0a0=_0x4f6b05;_0x528bf6=0xc8;}else{_0x528bf6=0xce;}_0x21cbc6[_0x14fe('0xa')](_0x528bf6);return _0x21cbc6[_0x14fe('0x10')](_0x14fe('0x11'),_0x233ba5+'-'+_0x44d0a0+'/'+_0x4f6b05)[_0x14fe('0xc')](_0x418e49);}return null;};}function saveUpdates(_0x475055){return function(_0x4fc509){if(_0x4fc509){return _0x4fc509[_0x14fe('0x12')](_0x475055)[_0x14fe('0x13')](function(_0x5989f9){return _0x5989f9;});}return null;};}function removeEntity(_0x578592){return function(_0x382c3d){if(_0x382c3d){return _0x382c3d[_0x14fe('0x14')]()['then'](function(){_0x578592[_0x14fe('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec0a9){return function(_0x2d6f22){if(!_0x2d6f22){_0x1ec0a9[_0x14fe('0x9')](0x194);}return _0x2d6f22;};}function handleError(_0x40fb8a,_0x42ca51){_0x42ca51=_0x42ca51||0x1f4;return function(_0x3ddee3){logger[_0x14fe('0x15')](_0x3ddee3['stack']);if(_0x3ddee3['name']){delete _0x3ddee3[_0x14fe('0x16')];}_0x40fb8a[_0x14fe('0xa')](_0x42ca51)[_0x14fe('0x17')](_0x3ddee3);};}function maskClientSecret(_0x277bf6){return _[_0x14fe('0x18')](_0x277bf6[_0x14fe('0x19')](0x0,0x3),0x14,'*');}exports[_0x14fe('0x1a')]=function(_0x1eeac3,_0x466221){var _0x171baa={},_0x4c3aae={},_0x18da44={'count':0x0,'rows':[]};var _0x44a008=_[_0x14fe('0x1b')](db[_0x14fe('0x1c')][_0x14fe('0x1d')],function(_0x27d875){return{'name':_0x27d875['fieldName'],'type':_0x27d875[_0x14fe('0x1e')][_0x14fe('0x1f')]};});_0x4c3aae[_0x14fe('0x20')]=_[_0x14fe('0x1b')](_0x44a008,_0x14fe('0x16'));_0x4c3aae['query']=_[_0x14fe('0x21')](_0x1eeac3['query']);_0x4c3aae[_0x14fe('0x22')]=_['intersection'](_0x4c3aae[_0x14fe('0x20')],_0x4c3aae[_0x14fe('0x23')]);_0x171baa[_0x14fe('0x24')]=_[_0x14fe('0x25')](_0x4c3aae[_0x14fe('0x20')],qs[_0x14fe('0x26')](_0x1eeac3[_0x14fe('0x23')][_0x14fe('0x26')]));_0x171baa['attributes']=_0x171baa[_0x14fe('0x24')][_0x14fe('0x27')]?_0x171baa[_0x14fe('0x24')]:_0x4c3aae['model'];if(!_0x1eeac3[_0x14fe('0x23')]['hasOwnProperty'](_0x14fe('0x28'))){_0x171baa[_0x14fe('0xe')]=qs[_0x14fe('0xe')](_0x1eeac3['query'][_0x14fe('0xe')]);_0x171baa[_0x14fe('0xd')]=qs[_0x14fe('0xd')](_0x1eeac3[_0x14fe('0x23')][_0x14fe('0xd')]);}_0x171baa[_0x14fe('0x29')]=qs['sort'](_0x1eeac3[_0x14fe('0x23')]['sort']);_0x171baa[_0x14fe('0x2a')]=qs[_0x14fe('0x22')](_[_0x14fe('0x2b')](_0x1eeac3['query'],_0x4c3aae[_0x14fe('0x22')]),_0x44a008);if(_0x1eeac3[_0x14fe('0x23')][_0x14fe('0x2c')]){_0x171baa[_0x14fe('0x2a')]=_['merge'](_0x171baa[_0x14fe('0x2a')],{'$or':_[_0x14fe('0x1b')](_0x44a008,function(_0x1b9e6e){if(_0x1b9e6e[_0x14fe('0x1e')]!==_0x14fe('0x2d')){var _0x3cb693={};_0x3cb693[_0x1b9e6e[_0x14fe('0x16')]]={'$like':'%'+_0x1eeac3[_0x14fe('0x23')]['filter']+'%'};return _0x3cb693;}})});}_0x171baa=_[_0x14fe('0x2e')]({},_0x171baa,_0x1eeac3[_0x14fe('0x2f')]);var _0x55c548={'where':_0x171baa['where']};return db[_0x14fe('0x1c')]['count'](_0x55c548)['then'](function(_0x7d047e){_0x18da44['count']=_0x7d047e;if(_0x1eeac3[_0x14fe('0x23')][_0x14fe('0x30')]){_0x171baa['include']=[{'all':!![]}];}return db[_0x14fe('0x1c')]['findAll'](_0x171baa);})[_0x14fe('0x13')](function(_0xb44273){_0x18da44[_0x14fe('0x31')]=_['map'](_0xb44273,function(_0x5c7f8c){if(_0x5c7f8c[_0x14fe('0x32')]===_0x14fe('0x33')){var _0x354d05=encryptor[_0x14fe('0x34')](_0x5c7f8c[_0x14fe('0x35')]);_0x5c7f8c['data3']=maskClientSecret(_0x354d05);}return _0x5c7f8c;});return _0x18da44;})['then'](respondWithFilteredResult(_0x466221,_0x171baa))[_0x14fe('0x36')](handleError(_0x466221,null));};exports[_0x14fe('0x37')]=function(_0x5a146c,_0x355bb7){var _0x58ee19={'raw':!![],'where':{'id':_0x5a146c[_0x14fe('0x38')]['id']}},_0x3d5f09={};_0x3d5f09[_0x14fe('0x20')]=_['keys'](db[_0x14fe('0x1c')][_0x14fe('0x1d')]);_0x3d5f09[_0x14fe('0x23')]=_[_0x14fe('0x21')](_0x5a146c[_0x14fe('0x23')]);_0x3d5f09[_0x14fe('0x22')]=_[_0x14fe('0x25')](_0x3d5f09['model'],_0x3d5f09[_0x14fe('0x23')]);_0x58ee19['attributes']=_[_0x14fe('0x25')](_0x3d5f09[_0x14fe('0x20')],qs['fields'](_0x5a146c['query']['fields']));_0x58ee19[_0x14fe('0x24')]=_0x58ee19[_0x14fe('0x24')][_0x14fe('0x27')]?_0x58ee19[_0x14fe('0x24')]:_0x3d5f09[_0x14fe('0x20')];if(_0x5a146c[_0x14fe('0x23')][_0x14fe('0x30')]){_0x58ee19[_0x14fe('0x39')]=[{'all':!![]}];}_0x58ee19=_[_0x14fe('0x2e')]({},_0x58ee19,_0x5a146c[_0x14fe('0x2f')]);return db[_0x14fe('0x1c')][_0x14fe('0x3a')](_0x58ee19)[_0x14fe('0x13')](handleEntityNotFound(_0x355bb7,null))[_0x14fe('0x13')](function(_0x3f1cd1){if(_0x3f1cd1['service']==='MicrosoftAzure'){var _0x36a513=encryptor['decryptString'](_0x3f1cd1[_0x14fe('0x35')]);_0x3f1cd1['data3']=maskClientSecret(_0x36a513);}return _0x3f1cd1;})[_0x14fe('0x13')](respondWithResult(_0x355bb7,null))['catch'](handleError(_0x355bb7,null));};exports['create']=function(_0x1c9024,_0x14dbc3){if(!_0x1c9024[_0x14fe('0x3b')][_0x14fe('0x16')])throw new Error(_0x14fe('0x3c'));if(!_0x1c9024[_0x14fe('0x3b')][_0x14fe('0x32')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x1973bd=db[_0x14fe('0x1c')][_0x14fe('0x1d')][_0x14fe('0x32')][_0x14fe('0x3d')];if(!_0x1973bd[_0x14fe('0x3e')](_0x1c9024['body'][_0x14fe('0x32')]))throw new Error(_0x14fe('0x3f')+_0x1973bd[_0x14fe('0x40')](',\x20'));if(_0x1c9024[_0x14fe('0x3b')]['service']===_0x14fe('0x33')&&_0x1c9024[_0x14fe('0x3b')][_0x14fe('0x35')]){_0x1c9024['body']['data3']=encryptor[_0x14fe('0x41')](_0x1c9024[_0x14fe('0x3b')][_0x14fe('0x35')]);}return db[_0x14fe('0x1c')][_0x14fe('0x42')](_0x1c9024[_0x14fe('0x3b')],{})[_0x14fe('0x13')](respondWithResult(_0x14dbc3,0xc9))[_0x14fe('0x36')](handleError(_0x14dbc3,null));};exports[_0x14fe('0x12')]=function(_0x42c14b,_0xd569b6){if(_0x42c14b[_0x14fe('0x3b')]['id']){delete _0x42c14b[_0x14fe('0x3b')]['id'];}return db['CloudProvider'][_0x14fe('0x3a')]({'where':{'id':_0x42c14b[_0x14fe('0x38')]['id']}})[_0x14fe('0x13')](handleEntityNotFound(_0xd569b6,null))[_0x14fe('0x13')](function(_0x2f5cf8){if(_0x2f5cf8['service']===_0x14fe('0x33')&&_0x42c14b[_0x14fe('0x3b')]['data3']){_0x42c14b['body']['data3']=encryptor[_0x14fe('0x41')](_0x42c14b[_0x14fe('0x3b')][_0x14fe('0x35')]);}return _0x2f5cf8;})[_0x14fe('0x13')](saveUpdates(_0x42c14b['body'],null))[_0x14fe('0x13')](respondWithResult(_0xd569b6,null))[_0x14fe('0x36')](handleError(_0xd569b6,null));};exports[_0x14fe('0x14')]=function(_0x341a2d,_0x3f6327){return db[_0x14fe('0x1c')][_0x14fe('0x3a')]({'where':{'id':_0x341a2d[_0x14fe('0x38')]['id']}})[_0x14fe('0x13')](handleEntityNotFound(_0x3f6327,null))['then'](removeEntity(_0x3f6327,null))[_0x14fe('0x36')](handleError(_0x3f6327,null));};exports[_0x14fe('0x43')]=function(_0x1b619a,_0x59d326){return db[_0x14fe('0x1c')][_0x14fe('0x44')]({'where':{'id':_0x1b619a[_0x14fe('0x38')]['id']},'raw':!![]})[_0x14fe('0x13')](function(_0xac9fb3){if(!_0xac9fb3)return _0x59d326[_0x14fe('0x9')](0x194);return{'url':oauth[_0x14fe('0x45')](_0xac9fb3,_0x1b619a[_0x14fe('0x46')]['id'])};})[_0x14fe('0x13')](respondWithResult(_0x59d326,null))[_0x14fe('0x36')](handleError(_0x59d326,null));};exports[_0x14fe('0x47')]=function(_0x3fc6c7,_0x1ed1bf){var _0x1ddb9e=_0x3fc6c7['body'];var _0x3e1753;var _0xc9a78d;if(_0x1ddb9e[_0x14fe('0x15')])throw _0x1ddb9e;redis[_0x14fe('0x48')](_0x1ddb9e[_0x14fe('0x49')])[_0x14fe('0x13')](function(_0x2ff6cb){if(!_0x2ff6cb)throw new Error(_0x14fe('0x4a'));_0x3e1753=JSON[_0x14fe('0x4b')](_0x2ff6cb);var _0x26b95e=Buffer['from'](_0x1ddb9e[_0x14fe('0x49')],'base64')['toString'](_0x14fe('0x4c'));_0xc9a78d=JSON[_0x14fe('0x4b')](_0x26b95e);if(!oauth[_0x14fe('0x4d')](_0x1ddb9e[_0x14fe('0x4e')],_0x3e1753[_0x14fe('0x4f')]))throw new Error(_0x14fe('0x50'));redis[_0x14fe('0x51')](_0x1ddb9e[_0x14fe('0x49')]);return oauth[_0x14fe('0x52')](_0x1ddb9e['code'],_0x3e1753);})['then'](function(_0x5eeb47){_0x3e1753[_0x14fe('0x53')]=_0x5eeb47[_0x14fe('0x54')];_0x3e1753[_0x14fe('0x55')]=_0x5eeb47['refresh_token'];return db[_0x14fe('0x1c')][_0x14fe('0x12')]({'data5':_0x3e1753[_0x14fe('0x53')],'data6':_0x3e1753[_0x14fe('0x55')]},{'where':{'id':_0x3e1753['id']}});})[_0x14fe('0x13')](function(){oauth[_0x14fe('0x56')](_0x3e1753);socket['emit'](_0x14fe('0x57'),{'id':_0xc9a78d['id']});return;})[_0x14fe('0x13')](respondWithStatusCode(_0x1ed1bf,null))['catch'](function(_0x2cc4cf){if(_0xc9a78d){socket['emit']('microsoftAuthorization:error',{'id':_0xc9a78d['id']});}if(!_0x3e1753){logger['error'](_0x14fe('0x58'),_0x2cc4cf);return _0x1ed1bf['status'](0x1f4)[_0x14fe('0x17')](_0x2cc4cf['message']);}logger['error'](_0x14fe('0x59'),_0x3e1753['id'],JSON['stringify'](_0x2cc4cf));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 8a500e3..dcc2b60 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 _0xfcd7=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x3348b6,_0x4fa79f){var _0xb4f7e0=function(_0x3d1958){while(--_0x3d1958){_0x3348b6['push'](_0x3348b6['shift']());}};_0xb4f7e0(++_0x4fa79f);}(_0xfcd7,0x198));var _0x7fcd=function(_0x17483e,_0x115c9a){_0x17483e=_0x17483e-0x0;var _0x507e15=_0xfcd7[_0x17483e];return _0x507e15;};'use strict';var _=require('lodash');var util=require(_0x7fcd('0x0'));var logger=require(_0x7fcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7fcd('0x2'));var rp=require(_0x7fcd('0x3'));var fs=require('fs');var path=require(_0x7fcd('0x4'));var rimraf=require(_0x7fcd('0x5'));var config=require(_0x7fcd('0x6'));var attributes=require(_0x7fcd('0x7'));module['exports']=function(_0x3743be,_0x4f3266){return _0x3743be['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x891a=['path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5dc918,_0x2dcdf7){var _0x4f961a=function(_0x1ab2c5){while(--_0x1ab2c5){_0x5dc918['push'](_0x5dc918['shift']());}};_0x4f961a(++_0x2dcdf7);}(_0x891a,0xaa));var _0xa891=function(_0x4647d7,_0x4d4caf){_0x4647d7=_0x4647d7-0x0;var _0x1885db=_0x891a[_0x4647d7];return _0x1885db;};'use strict';var _=require(_0xa891('0x0'));var util=require(_0xa891('0x1'));var logger=require('../../config/logger')(_0xa891('0x2'));var moment=require(_0xa891('0x3'));var BPromise=require(_0xa891('0x4'));var rp=require(_0xa891('0x5'));var fs=require('fs');var path=require(_0xa891('0x6'));var rimraf=require('rimraf');var config=require(_0xa891('0x7'));var attributes=require(_0xa891('0x8'));module[_0xa891('0x9')]=function(_0xd5d535,_0x3d7666){return _0xd5d535['define'](_0xa891('0xa'),attributes,{'tableName':'cloud_providers','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 f67b8f2..603ae67 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 _0x3118=['data4','form_post','scope','state','nonce','prompt','login','map','key','value','oauth2Claims','oauth2/','set','stringify','decode','iss','issuer','aud','audience','isAfter','unix','exp','then','data3','CloudProvider','findOne','refresh_token','{TENANT_ID}','data2','access_token','data6','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','/authorize','/token','type','data7','/.default','join','Dynamics365','replace','from','toString','base64','hex','client_id','data1','response_type','redirect_uri'];(function(_0x32faea,_0x3235d7){var _0x152fe9=function(_0x2f83e7){while(--_0x2f83e7){_0x32faea['push'](_0x32faea['shift']());}};_0x152fe9(++_0x3235d7);}(_0x3118,0x7e));var _0x8311=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x3118[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x8311('0x0'));var crypto=require(_0x8311('0x1'));var jwt=require(_0x8311('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x8311('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x8311('0x4'));var logger=require(_0x8311('0x5'))(_0x8311('0x6'));var schedule=require(_0x8311('0x7'));var db=require(_0x8311('0x8'))['db'];config['redis']=_[_0x8311('0x9')](config[_0x8311('0xa')],{'host':_0x8311('0xb'),'port':0x18eb});var redis=new Redis(config[_0x8311('0xa')]);var MICROSOFT_AUTH_URL=_0x8311('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x8311('0xd'),_0x8311('0xe'),_0x8311('0xf'),_0x8311('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x8311('0x11'),_0x8311('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x8311('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x8311('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x32f6e8){var _0x564e42=_['map'](AZURE_AUTH_SCOPES[_0x32f6e8[_0x8311('0x14')]]);if(_0x32f6e8[_0x8311('0x14')]==='Dynamics365')_0x564e42['push'](_0x32f6e8[_0x8311('0x15')]+_0x8311('0x16'));return _0x564e42[_0x8311('0x17')]('\x20');}function getAccessTokenScope(_0x47a059){if(_0x47a059['type']==='Outlook365')return _0x8311('0x10');if(_0x47a059[_0x8311('0x14')]===_0x8311('0x18'))return _0x47a059[_0x8311('0x15')]+_0x8311('0x16');}function generateMicrosoftAuthorizationUrl(_0x3f6157,_0x4f904b){var _0x50b927=MICROSOFT_AUTH_URL[_0x8311('0x19')]('{TENANT_ID}',_0x3f6157['data2']);var _0x1ed1da=['code','id_token'];var _0x548850=Buffer[_0x8311('0x1a')](JSON['stringify']({'id':_0x4f904b}))[_0x8311('0x1b')](_0x8311('0x1c'));var _0x45d11a=crypto['randomBytes'](0x10)[_0x8311('0x1b')](_0x8311('0x1d'));var _0x82491b=getAuthorizationScopes(_0x3f6157);var _0x1e1518=[{'key':_0x8311('0x1e'),'value':_0x3f6157[_0x8311('0x1f')]},{'key':_0x8311('0x20'),'value':encodeURIComponent(_0x1ed1da[_0x8311('0x17')]('\x20'))},{'key':_0x8311('0x21'),'value':_0x3f6157[_0x8311('0x22')]},{'key':'response_mode','value':_0x8311('0x23')},{'key':_0x8311('0x24'),'value':encodeURIComponent(_0x82491b)},{'key':_0x8311('0x25'),'value':_0x548850},{'key':_0x8311('0x26'),'value':_0x45d11a},{'key':_0x8311('0x27'),'value':_0x8311('0x28')}];var _0x2b5cc6=_0x50b927+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8311('0x29')](_0x1e1518,function(_0x3c8549){return _0x3c8549[_0x8311('0x2a')]+'='+_0x3c8549[_0x8311('0x2b')];})[_0x8311('0x17')]('&');_0x3f6157[_0x8311('0x2c')]={'issuer':_0x50b927[_0x8311('0x19')](_0x8311('0x2d'),''),'audience':_0x3f6157[_0x8311('0x1f')],'state':_0x548850,'nonce':_0x45d11a};redis[_0x8311('0x2e')](_0x548850,JSON[_0x8311('0x2f')](_0x3f6157));return _0x2b5cc6;}function isValidIdToken(_0x158a6d,_0x6c6aeb){try{var _0x5460a9=jwt[_0x8311('0x30')](_0x158a6d,{'complete':!![]});var _0x16d446=_0x5460a9['payload'];if(_0x16d446[_0x8311('0x31')]!==_0x6c6aeb[_0x8311('0x32')])return![];if(_0x16d446[_0x8311('0x33')]!==_0x6c6aeb[_0x8311('0x34')])return![];if(_0x16d446['nonce']!==_0x6c6aeb[_0x8311('0x26')])return![];if(moment()[_0x8311('0x35')](moment[_0x8311('0x36')](_0x16d446[_0x8311('0x37')])))return![];return!![];}catch(_0x4a3eaf){throw _0x4a3eaf;}}function refreshOauth2MicrosoftAccessToken(_0x3abc07){return Promise['resolve']()[_0x8311('0x38')](function(){if(_0x3abc07[_0x8311('0x39')])return _0x3abc07;return db[_0x8311('0x3a')][_0x8311('0x3b')]({'where':{'id':_0x3abc07['id']},'raw':!![]});})[_0x8311('0x38')](function(_0xf1073a){var _0x24726e={'grant_type':_0x8311('0x3c'),'refresh_token':_0xf1073a['data6'],'scope':getAccessTokenScope(_0xf1073a),'redirect_uri':_0xf1073a[_0x8311('0x22')],'client_id':_0xf1073a['data1'],'client_secret':encryptor['decryptString'](_0xf1073a[_0x8311('0x39')])};var _0x162d46={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8311('0x19')](_0x8311('0x3d'),_0xf1073a[_0x8311('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x24726e,'json':!![]};return rp(_0x162d46);})[_0x8311('0x38')](function(_0x32e10a){_0x3abc07['data5']=_0x32e10a[_0x8311('0x3f')];_0x3abc07[_0x8311('0x40')]=_0x32e10a[_0x8311('0x3c')];return db[_0x8311('0x3a')][_0x8311('0x41')]({'data5':_0x3abc07[_0x8311('0x42')],'data6':_0x3abc07[_0x8311('0x40')]},{'where':{'id':_0x3abc07['id']}});})[_0x8311('0x38')](function(){return _0x3abc07;})[_0x8311('0x43')](function(_0x599bb3){logger[_0x8311('0x44')](_0x8311('0x45'),_0x3abc07['id'],_0x599bb3);});}function getOauth2MicrosoftAccessToken(_0x5502e4,_0x258ed1){var _0x302313={'grant_type':_0x8311('0x46'),'code':_0x5502e4,'scope':getAccessTokenScope(_0x258ed1),'redirect_uri':_0x258ed1[_0x8311('0x22')],'client_id':_0x258ed1[_0x8311('0x1f')],'client_secret':encryptor[_0x8311('0x47')](_0x258ed1[_0x8311('0x39')])};var _0x119e4d={'method':_0x8311('0x48'),'uri':MICROSOFT_AUTH_URL[_0x8311('0x19')](_0x8311('0x3d'),_0x258ed1[_0x8311('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x302313,'json':!![]};return rp(_0x119e4d);}function startRefreshInterval(_0x5591e8){var _0xa9d474=schedule[_0x8311('0x49')];if(_0xa9d474[_0x5591e8['id']])clearInterval(_0xa9d474[_0x5591e8['id']]);_0xa9d474[_0x5591e8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8311('0x4a')](this,{'id':_0x5591e8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0xa9d474;}function startAllRefreshIntervals(){return db[_0x8311('0x3a')][_0x8311('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8311('0x38')](function(_0x340a2f){var _0x3300de=_0x340a2f[_0x8311('0x29')](function(_0x529ba6){return refreshOauth2MicrosoftAccessToken(_0x529ba6)[_0x8311('0x38')](function(_0xbdc990){startRefreshInterval(_0xbdc990);});});return Promise[_0x8311('0x4c')](_0x3300de);})[_0x8311('0x43')](function(_0x4be096){var _0x33a302=_0x4be096?util[_0x8311('0x4d')](_0x4be096,{'showHidden':![],'depth':null}):'';logger[_0x8311('0x44')](_0x8311('0x4e'),_0x33a302);});}module[_0x8311('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xff16=['oauth2/','data1','set','payload','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','access_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','map','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','type','push','data7','join','Outlook365','Dynamics365','/.default','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','oauth2Claims','replace'];(function(_0x21749a,_0x10aa17){var _0x1e421a=function(_0x80fa80){while(--_0x80fa80){_0x21749a['push'](_0x21749a['shift']());}};_0x1e421a(++_0x10aa17);}(_0xff16,0xc7));var _0x6ff1=function(_0x1496ab,_0x2817bc){_0x1496ab=_0x1496ab-0x0;var _0x47c14b=_0xff16[_0x1496ab];return _0x47c14b;};'use strict';var _=require(_0x6ff1('0x0'));var crypto=require(_0x6ff1('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x6ff1('0x2'));var Redis=require(_0x6ff1('0x3'));var rp=require(_0x6ff1('0x4'));var util=require(_0x6ff1('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x6ff1('0x6'));var logger=require(_0x6ff1('0x7'))(_0x6ff1('0x8'));var schedule=require(_0x6ff1('0x9'));var db=require('../../mysqldb')['db'];config[_0x6ff1('0xa')]=_[_0x6ff1('0xb')](config[_0x6ff1('0xa')],{'host':_0x6ff1('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x6ff1('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x6ff1('0xe'),'email',_0x6ff1('0xf'),_0x6ff1('0x10'),_0x6ff1('0x11'),_0x6ff1('0x12')],'Dynamics365':[_0x6ff1('0x13'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x6ff1('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x6ff1('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x27d7c5){var _0x273ef3=_['map'](AZURE_AUTH_SCOPES[_0x27d7c5[_0x6ff1('0x16')]]);if(_0x27d7c5[_0x6ff1('0x16')]==='Dynamics365')_0x273ef3[_0x6ff1('0x17')](_0x27d7c5[_0x6ff1('0x18')]+'/.default');return _0x273ef3[_0x6ff1('0x19')]('\x20');}function getAccessTokenScope(_0x11a346){if(_0x11a346[_0x6ff1('0x16')]===_0x6ff1('0x1a'))return _0x6ff1('0x10');if(_0x11a346[_0x6ff1('0x16')]===_0x6ff1('0x1b'))return _0x11a346[_0x6ff1('0x18')]+_0x6ff1('0x1c');}function generateMicrosoftAuthorizationUrl(_0x32d05a,_0x1cc161){var _0x5f3ffd=MICROSOFT_AUTH_URL['replace'](_0x6ff1('0x1d'),_0x32d05a[_0x6ff1('0x1e')]);var _0x5c8089=[_0x6ff1('0x1f'),_0x6ff1('0x20')];var _0x38786d=Buffer[_0x6ff1('0x21')](JSON[_0x6ff1('0x22')]({'id':_0x1cc161}))[_0x6ff1('0x23')](_0x6ff1('0x24'));var _0x4c6132=crypto[_0x6ff1('0x25')](0x10)['toString'](_0x6ff1('0x26'));var _0xcf8484=getAuthorizationScopes(_0x32d05a);var _0x3bf280=[{'key':_0x6ff1('0x27'),'value':_0x32d05a['data1']},{'key':_0x6ff1('0x28'),'value':encodeURIComponent(_0x5c8089['join']('\x20'))},{'key':_0x6ff1('0x29'),'value':_0x32d05a[_0x6ff1('0x2a')]},{'key':_0x6ff1('0x2b'),'value':_0x6ff1('0x2c')},{'key':_0x6ff1('0x2d'),'value':encodeURIComponent(_0xcf8484)},{'key':_0x6ff1('0x2e'),'value':_0x38786d},{'key':_0x6ff1('0x2f'),'value':_0x4c6132},{'key':_0x6ff1('0x30'),'value':_0x6ff1('0x31')}];var _0xef6812=_0x5f3ffd+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x3bf280,function(_0x5c5574){return _0x5c5574[_0x6ff1('0x32')]+'='+_0x5c5574['value'];})['join']('&');_0x32d05a[_0x6ff1('0x33')]={'issuer':_0x5f3ffd[_0x6ff1('0x34')](_0x6ff1('0x35'),''),'audience':_0x32d05a[_0x6ff1('0x36')],'state':_0x38786d,'nonce':_0x4c6132};redis[_0x6ff1('0x37')](_0x38786d,JSON[_0x6ff1('0x22')](_0x32d05a));return _0xef6812;}function isValidIdToken(_0x2989f,_0x3de0b7){try{var _0x24baba=jwt['decode'](_0x2989f,{'complete':!![]});var _0x3e7bfc=_0x24baba[_0x6ff1('0x38')];if(_0x3e7bfc['iss']!==_0x3de0b7['issuer'])return![];if(_0x3e7bfc['aud']!==_0x3de0b7[_0x6ff1('0x39')])return![];if(_0x3e7bfc['nonce']!==_0x3de0b7['nonce'])return![];if(moment()[_0x6ff1('0x3a')](moment[_0x6ff1('0x3b')](_0x3e7bfc[_0x6ff1('0x3c')])))return![];return!![];}catch(_0x3e2f5a){throw _0x3e2f5a;}}function refreshOauth2MicrosoftAccessToken(_0x1ad90a){return Promise[_0x6ff1('0x3d')]()[_0x6ff1('0x3e')](function(){if(_0x1ad90a[_0x6ff1('0x3f')])return _0x1ad90a;return db[_0x6ff1('0x40')][_0x6ff1('0x41')]({'where':{'id':_0x1ad90a['id']},'raw':!![]});})['then'](function(_0x3c757e){var _0x281c26={'grant_type':_0x6ff1('0x42'),'refresh_token':_0x3c757e[_0x6ff1('0x43')],'scope':getAccessTokenScope(_0x3c757e),'redirect_uri':_0x3c757e[_0x6ff1('0x2a')],'client_id':_0x3c757e[_0x6ff1('0x36')],'client_secret':encryptor[_0x6ff1('0x44')](_0x3c757e['data3'])};var _0x2d91a2={'method':_0x6ff1('0x45'),'uri':MICROSOFT_AUTH_URL[_0x6ff1('0x34')](_0x6ff1('0x1d'),_0x3c757e[_0x6ff1('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x281c26,'json':!![]};return rp(_0x2d91a2);})['then'](function(_0x5d62a4){_0x1ad90a['data5']=_0x5d62a4[_0x6ff1('0x46')];_0x1ad90a['data6']=_0x5d62a4[_0x6ff1('0x42')];return db['CloudProvider'][_0x6ff1('0x47')]({'data5':_0x1ad90a[_0x6ff1('0x48')],'data6':_0x1ad90a['data6']},{'where':{'id':_0x1ad90a['id']}});})['then'](function(){return _0x1ad90a;})[_0x6ff1('0x49')](function(_0x106387){logger[_0x6ff1('0x4a')](_0x6ff1('0x4b'),_0x1ad90a['id'],_0x106387);});}function getOauth2MicrosoftAccessToken(_0x580916,_0x266abb){var _0x32fe5f={'grant_type':_0x6ff1('0x4c'),'code':_0x580916,'scope':getAccessTokenScope(_0x266abb),'redirect_uri':_0x266abb[_0x6ff1('0x2a')],'client_id':_0x266abb[_0x6ff1('0x36')],'client_secret':encryptor[_0x6ff1('0x44')](_0x266abb[_0x6ff1('0x3f')])};var _0x49aa5d={'method':'POST','uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x266abb[_0x6ff1('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x32fe5f,'json':!![]};return rp(_0x49aa5d);}function startRefreshInterval(_0x108c0f){var _0x3d1a2c=schedule[_0x6ff1('0x4d')];if(_0x3d1a2c[_0x108c0f['id']])clearInterval(_0x3d1a2c[_0x108c0f['id']]);_0x3d1a2c[_0x108c0f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x6ff1('0x4e')](this,{'id':_0x108c0f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x3d1a2c;}function startAllRefreshIntervals(){return db[_0x6ff1('0x40')][_0x6ff1('0x4f')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x6ff1('0x3e')](function(_0x5ce7d0){var _0x39006a=_0x5ce7d0[_0x6ff1('0x50')](function(_0x4e0e9f){return refreshOauth2MicrosoftAccessToken(_0x4e0e9f)[_0x6ff1('0x3e')](function(_0x37c81b){startRefreshInterval(_0x37c81b);});});return Promise[_0x6ff1('0x51')](_0x39006a);})['catch'](function(_0x43b952){var _0x1df36a=_0x43b952?util[_0x6ff1('0x52')](_0x43b952,{'showHidden':![],'depth':null}):'';logger[_0x6ff1('0x4a')](_0x6ff1('0x53'),_0x1df36a);});}module['exports']={'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 d4d72bc..bb58909 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 _0x1c77=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird'];(function(_0x179b7b,_0x57b44d){var _0x5eea20=function(_0x5582aa){while(--_0x5582aa){_0x179b7b['push'](_0x179b7b['shift']());}};_0x5eea20(++_0x57b44d);}(_0x1c77,0xed));var _0x71c7=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x1c77[_0x207811];return _0x170d56;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x71c7('0x5'));var logger=require(_0x71c7('0x6'))(_0x71c7('0x7'));var config=require(_0x71c7('0x8'));var jayson=require(_0x71c7('0x9'));var client=jayson[_0x71c7('0xa')][_0x71c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57fb10,_0x57bbb6,_0x2c25a4){return new BPromise(function(_0x244867,_0x229b00){return client[_0x71c7('0xc')](_0x57fb10,_0x2c25a4)['then'](function(_0x1f5fc9){logger['info']('CloudProvider,\x20%s,\x20%s',_0x57bbb6,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x57bbb6,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x1f5fc9));if(_0x1f5fc9['error']){if(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9['error'][_0x71c7('0x14')]);return _0x229b00(_0x1f5fc9[_0x71c7('0x11')][_0x71c7('0x14')]);}logger[_0x71c7('0x11')](_0x71c7('0x13'),_0x57bbb6,_0x1f5fc9[_0x71c7('0x11')]['message']);return _0x244867(_0x1f5fc9['error'][_0x71c7('0x14')]);}else{logger[_0x71c7('0x15')](_0x71c7('0x13'),_0x57bbb6,_0x71c7('0xd'));_0x244867(_0x1f5fc9[_0x71c7('0x16')][_0x71c7('0x14')]);}})[_0x71c7('0x17')](function(_0x115262){logger['error'](_0x71c7('0x13'),_0x57bbb6,_0x115262);_0x229b00(_0x115262);});});} \ No newline at end of file +var _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55a76a,_0x2d0203){var _0x45885a=function(_0x4348d5){while(--_0x4348d5){_0x55a76a['push'](_0x55a76a['shift']());}};_0x45885a(++_0x2d0203);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8a9a[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('CloudProvider,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 96a3747..c210f70 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0x150930,_0x22a97b){_0x150930=_0x150930-0x0;var _0x3dce60=_0x7a54[_0x150930];return _0x3dce60;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1656d2,_0x47a6fd){var _0x254070=function(_0xe08001){while(--_0xe08001){_0x1656d2['push'](_0x1656d2['shift']());}};_0x254070(++_0x47a6fd);}(_0xadb5,0xad));var _0x5adb=function(_0x11b09d,_0x15b17e){_0x11b09d=_0x11b09d-0x0;var _0xc91956=_0xadb5[_0x11b09d];return _0xc91956;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 01a586b..46016dd 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 _0xbf22=['sequelize','exports','name','STRING'];(function(_0x3a5ac2,_0x4c9440){var _0x3df059=function(_0x5c04a4){while(--_0x5c04a4){_0x3a5ac2['push'](_0x3a5ac2['shift']());}};_0x3df059(++_0x4c9440);}(_0xbf22,0x11c));var _0x2bf2=function(_0x293fc0,_0x6e53d9){_0x293fc0=_0x293fc0-0x0;var _0x1e1a7c=_0xbf22[_0x293fc0];return _0x1e1a7c;};'use strict';var Sequelize=require(_0x2bf2('0x0'));module[_0x2bf2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2bf2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x2bf2('0x3')]},'website':{'type':Sequelize[_0x2bf2('0x3')]},'phone':{'type':Sequelize[_0x2bf2('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2bf2('0x3')]},'street':{'type':Sequelize[_0x2bf2('0x3')]},'postalCode':{'type':Sequelize[_0x2bf2('0x3')]},'city':{'type':Sequelize[_0x2bf2('0x3')]},'country':{'type':Sequelize[_0x2bf2('0x3')]},'email':{'type':Sequelize[_0x2bf2('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x2bf2('0x3')]},'sPostalCode':{'type':Sequelize[_0x2bf2('0x3')]},'sCity':{'type':Sequelize[_0x2bf2('0x3')]},'sCountry':{'type':Sequelize[_0x2bf2('0x3')]},'description':{'type':Sequelize[_0x2bf2('0x3')]}}; \ No newline at end of file +var _0xa2c7=['name','sequelize','exports','STRING'];(function(_0x9d75c4,_0x10f484){var _0x258ba5=function(_0x4908c5){while(--_0x4908c5){_0x9d75c4['push'](_0x9d75c4['shift']());}};_0x258ba5(++_0x10f484);}(_0xa2c7,0x195));var _0x7a2c=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xa2c7[_0x36bfe3];return _0x9b0436;};'use strict';var Sequelize=require(_0x7a2c('0x0'));module[_0x7a2c('0x1')]={'name':{'type':Sequelize[_0x7a2c('0x2')],'unique':_0x7a2c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7a2c('0x2')]},'companyId':{'type':Sequelize[_0x7a2c('0x2')]},'website':{'type':Sequelize[_0x7a2c('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7a2c('0x2')]},'street':{'type':Sequelize[_0x7a2c('0x2')]},'postalCode':{'type':Sequelize[_0x7a2c('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7a2c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x7a2c('0x2')]},'sPostalCode':{'type':Sequelize[_0x7a2c('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7a2c('0x2')]},'description':{'type':Sequelize[_0x7a2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 4daf7a7..058a17d 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 _0x189f=['findAll','rows','catch','show','params','rawAttributes','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','update','addContacts','CmContact','ids','getContacts','findOne','sort','map','eml-format','fast-json-patch','moment','bluebird','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','CmCompany'];(function(_0x14b741,_0x5caa3a){var _0x45b689=function(_0x349326){while(--_0x349326){_0x14b741['push'](_0x14b741['shift']());}};_0x45b689(++_0x5caa3a);}(_0x189f,0xd0));var _0xf189=function(_0x13f601,_0x4dc50f){_0x13f601=_0x13f601-0x0;var _0xad44c0=_0x189f[_0x13f601];return _0xad44c0;};'use strict';var emlformat=require(_0xf189('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf189('0x1'));var rp=require('request-promise');var moment=require(_0xf189('0x2'));var BPromise=require(_0xf189('0x3'));var Mustache=require('mustache');var util=require(_0xf189('0x4'));var path=require(_0xf189('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf189('0x6'));var _=require(_0xf189('0x7'));var squel=require(_0xf189('0x8'));var crypto=require('crypto');var jsforce=require(_0xf189('0x9'));var deskjs=require(_0xf189('0xa'));var toCsv=require(_0xf189('0xb'));var querystring=require(_0xf189('0xc'));var Papa=require(_0xf189('0xd'));var Redis=require(_0xf189('0xe'));var authService=require(_0xf189('0xf'));var qs=require(_0xf189('0x10'));var as=require(_0xf189('0x11'));var hardwareService=require(_0xf189('0x12'));var logger=require(_0xf189('0x13'))(_0xf189('0x14'));var utils=require(_0xf189('0x15'));var config=require(_0xf189('0x16'));var licenseUtil=require(_0xf189('0x17'));var db=require(_0xf189('0x18'))['db'];function respondWithStatusCode(_0x4d1a7e,_0x2d14e5){_0x2d14e5=_0x2d14e5||0xcc;return function(_0x303575){if(_0x303575){return _0x4d1a7e[_0xf189('0x19')](_0x2d14e5);}return _0x4d1a7e[_0xf189('0x1a')](_0x2d14e5)[_0xf189('0x1b')]();};}function respondWithResult(_0x12dfcf,_0x36dfc0){_0x36dfc0=_0x36dfc0||0xc8;return function(_0xcd6f8f){if(_0xcd6f8f){return _0x12dfcf[_0xf189('0x1a')](_0x36dfc0)[_0xf189('0x1c')](_0xcd6f8f);}};}function respondWithFilteredResult(_0xefe15a,_0x25e646){return function(_0xe00868){if(_0xe00868){var _0x341b6f=typeof _0x25e646[_0xf189('0x1d')]===_0xf189('0x1e')&&typeof _0x25e646['limit']===_0xf189('0x1e');var _0x23e301=_0xe00868[_0xf189('0x1f')];var _0x2fab10=_0x341b6f?0x0:_0x25e646[_0xf189('0x1d')];var _0x30f8e7=_0x341b6f?_0xe00868[_0xf189('0x1f')]:_0x25e646[_0xf189('0x1d')]+_0x25e646[_0xf189('0x20')];var _0x23941f;if(_0x30f8e7>=_0x23e301){_0x30f8e7=_0x23e301;_0x23941f=0xc8;}else{_0x23941f=0xce;}_0xefe15a[_0xf189('0x1a')](_0x23941f);return _0xefe15a[_0xf189('0x21')](_0xf189('0x22'),_0x2fab10+'-'+_0x30f8e7+'/'+_0x23e301)[_0xf189('0x1c')](_0xe00868);}return null;};}function patchUpdates(_0x37b227){return function(_0x52f511){try{jsonpatch[_0xf189('0x23')](_0x52f511,_0x37b227,!![]);}catch(_0x5513d0){return BPromise[_0xf189('0x24')](_0x5513d0);}return _0x52f511[_0xf189('0x25')]();};}function saveUpdates(_0x32056d,_0x5e8c75){return function(_0x40e061){if(_0x40e061){return _0x40e061['update'](_0x32056d)[_0xf189('0x26')](function(_0x20d44f){return _0x20d44f;});}return null;};}function removeEntity(_0x13e872,_0x47df8e){return function(_0x52aeeb){if(_0x52aeeb){return _0x52aeeb[_0xf189('0x27')]()[_0xf189('0x26')](function(){var _0x1b7736=_0x52aeeb[_0xf189('0x28')]({'plain':!![]});var _0x273525=_0xf189('0x29');return db[_0xf189('0x2a')]['destroy']({'where':{'type':_0x273525,'resourceId':_0x1b7736['id']}})[_0xf189('0x26')](function(){return _0x52aeeb;});})[_0xf189('0x26')](function(){_0x13e872['status'](0xcc)[_0xf189('0x1b')]();});}};}function handleEntityNotFound(_0x9106b0,_0x4af020){return function(_0x50f4e1){if(!_0x50f4e1){_0x9106b0[_0xf189('0x19')](0x194);}return _0x50f4e1;};}function handleError(_0x54e8e2,_0x5a8083){_0x5a8083=_0x5a8083||0x1f4;return function(_0x3876fb){logger[_0xf189('0x2b')](_0x3876fb[_0xf189('0x2c')]);if(_0x3876fb[_0xf189('0x2d')]){delete _0x3876fb['name'];}_0x54e8e2[_0xf189('0x1a')](_0x5a8083)[_0xf189('0x2e')](_0x3876fb);};}exports[_0xf189('0x2f')]=function(_0x1f9155,_0x2389ce){var _0x1c63b6={},_0x352977={},_0x4c3157={'count':0x0,'rows':[]};return db['CmCompany'][_0xf189('0x30')]()['then'](function(_0xb9c9ed){_0x352977['model']=_['keys'](_0xb9c9ed);_0x352977['query']=_[_0xf189('0x31')](_0x1f9155[_0xf189('0x32')]);_0x352977[_0xf189('0x33')]=_[_0xf189('0x34')](_0x352977[_0xf189('0x35')],_0x352977[_0xf189('0x32')]);_0x1c63b6[_0xf189('0x36')]=_[_0xf189('0x34')](_0x352977['model'],qs[_0xf189('0x37')](_0x1f9155[_0xf189('0x32')][_0xf189('0x37')]));_0x1c63b6[_0xf189('0x36')]=_0x1c63b6[_0xf189('0x36')][_0xf189('0x38')]?_0x1c63b6[_0xf189('0x36')]:_0x352977[_0xf189('0x35')];if(!_0x1f9155[_0xf189('0x32')][_0xf189('0x39')](_0xf189('0x3a'))){_0x1c63b6[_0xf189('0x20')]=qs[_0xf189('0x20')](_0x1f9155[_0xf189('0x32')]['limit']);_0x1c63b6['offset']=qs['offset'](_0x1f9155[_0xf189('0x32')][_0xf189('0x1d')]);}_0x1c63b6[_0xf189('0x3b')]=qs['sort'](_0x1f9155[_0xf189('0x32')]['sort']);_0x1c63b6[_0xf189('0x3c')]=qs['filters'](_[_0xf189('0x3d')](_0x1f9155[_0xf189('0x32')],_0x352977[_0xf189('0x33')]),_0xb9c9ed);if(_0x1f9155['query'][_0xf189('0x3e')]){_0x1c63b6['where']=_['merge'](_0x1c63b6[_0xf189('0x3c')],{'$or':_['map'](_0x1c63b6[_0xf189('0x36')],function(_0x2d2d28){var _0x3e86ff={};_0x3e86ff[_0x2d2d28]={'$like':'%'+_0x1f9155['query'][_0xf189('0x3e')]+'%'};return _0x3e86ff;})});}_0x1c63b6=_[_0xf189('0x3f')]({},_0x1c63b6,_0x1f9155[_0xf189('0x40')]);var _0x35b2a1={'where':_0x1c63b6[_0xf189('0x3c')]};return db['CmCompany'][_0xf189('0x1f')](_0x35b2a1)[_0xf189('0x26')](function(_0xf9bfb7){_0x4c3157[_0xf189('0x1f')]=_0xf9bfb7;if(_0x1f9155[_0xf189('0x32')][_0xf189('0x41')]){_0x1c63b6[_0xf189('0x42')]=[{'all':!![]}];}return db[_0xf189('0x43')][_0xf189('0x44')](_0x1c63b6);})['then'](function(_0x3ae77d){_0x4c3157[_0xf189('0x45')]=_0x3ae77d;return _0x4c3157;})[_0xf189('0x26')](respondWithFilteredResult(_0x2389ce,_0x1c63b6))[_0xf189('0x46')](handleError(_0x2389ce,null));})[_0xf189('0x46')](handleError(_0x2389ce,null));};exports[_0xf189('0x47')]=function(_0x5dd99a,_0x1131d7){var _0x7386b5={'raw':![],'where':{'id':_0x5dd99a[_0xf189('0x48')]['id']}},_0x335f52={};_0x335f52[_0xf189('0x35')]=_['keys'](db[_0xf189('0x43')][_0xf189('0x49')]);_0x335f52['query']=_[_0xf189('0x31')](_0x5dd99a[_0xf189('0x32')]);_0x335f52[_0xf189('0x33')]=_['intersection'](_0x335f52['model'],_0x335f52[_0xf189('0x32')]);_0x7386b5['attributes']=_[_0xf189('0x34')](_0x335f52[_0xf189('0x35')],qs[_0xf189('0x37')](_0x5dd99a[_0xf189('0x32')][_0xf189('0x37')]));_0x7386b5[_0xf189('0x36')]=_0x7386b5['attributes'][_0xf189('0x38')]?_0x7386b5[_0xf189('0x36')]:_0x335f52[_0xf189('0x35')];if(_0x5dd99a[_0xf189('0x32')][_0xf189('0x41')]){_0x7386b5[_0xf189('0x42')]=[{'all':!![]}];}_0x7386b5=_[_0xf189('0x3f')]({},_0x7386b5,_0x5dd99a[_0xf189('0x40')]);return db[_0xf189('0x43')][_0xf189('0x4a')](_0x7386b5)[_0xf189('0x26')](handleEntityNotFound(_0x1131d7,null))[_0xf189('0x26')](respondWithResult(_0x1131d7,null))[_0xf189('0x46')](handleError(_0x1131d7,null));};exports[_0xf189('0x4b')]=function(_0x460bcf,_0x5e1c11){return db['CmCompany'][_0xf189('0x4b')](_0x460bcf[_0xf189('0x4c')],{})[_0xf189('0x26')](function(_0x15ec49){var _0x4231f0=_0x460bcf[_0xf189('0x4d')][_0xf189('0x28')]({'plain':!![]});if(!_0x4231f0)throw new Error(_0xf189('0x4e'));if(_0x4231f0[_0xf189('0x4f')]==='user'){var _0x259433=_0x15ec49[_0xf189('0x28')]({'plain':!![]});var _0x5a321b=_0xf189('0x29');return db[_0xf189('0x50')]['find']({'where':{'name':_0x5a321b,'userProfileId':_0x4231f0[_0xf189('0x51')]},'raw':!![]})[_0xf189('0x26')](function(_0x7d2f62){if(_0x7d2f62&&_0x7d2f62[_0xf189('0x52')]===0x0){return db['UserProfileResource'][_0xf189('0x4b')]({'name':_0x259433[_0xf189('0x2d')],'resourceId':_0x259433['id'],'type':_0x7d2f62[_0xf189('0x2d')],'sectionId':_0x7d2f62['id']},{})[_0xf189('0x26')](function(){return _0x15ec49;});}else{return _0x15ec49;}})[_0xf189('0x46')](function(_0x390e28){logger[_0xf189('0x2b')](_0xf189('0x53'),_0x390e28);throw _0x390e28;});}return _0x15ec49;})[_0xf189('0x26')](respondWithResult(_0x5e1c11,0xc9))[_0xf189('0x46')](handleError(_0x5e1c11,null));};exports[_0xf189('0x54')]=function(_0x5643f7,_0x21bafd){if(_0x5643f7[_0xf189('0x4c')]['id']){delete _0x5643f7['body']['id'];}return db[_0xf189('0x43')]['find']({'where':{'id':_0x5643f7[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x21bafd,null))['then'](saveUpdates(_0x5643f7[_0xf189('0x4c')],null))[_0xf189('0x26')](respondWithResult(_0x21bafd,null))[_0xf189('0x46')](handleError(_0x21bafd,null));};exports[_0xf189('0x27')]=function(_0x383d11,_0x5639d5){return db['CmCompany'][_0xf189('0x4a')]({'where':{'id':_0x383d11[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x5639d5,null))['then'](removeEntity(_0x5639d5,null))[_0xf189('0x46')](handleError(_0x5639d5,null));};exports[_0xf189('0x30')]=function(_0x228ff1,_0x5b682c){return db[_0xf189('0x43')]['describe']()[_0xf189('0x26')](respondWithResult(_0x5b682c,null))[_0xf189('0x46')](handleError(_0x5b682c,null));};exports[_0xf189('0x55')]=function(_0x3363e1,_0x545117,_0x5b2dea){return db[_0xf189('0x56')][_0xf189('0x4a')]({'where':{'id':_0x3363e1[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x545117,null))[_0xf189('0x26')](function(_0x363cad){if(_0x363cad){return _0x363cad[_0xf189('0x55')](_0x3363e1[_0xf189('0x4c')][_0xf189('0x57')],_['omit'](_0x3363e1[_0xf189('0x4c')],['ids','id'])||{});}})[_0xf189('0x26')](respondWithResult(_0x545117,null))[_0xf189('0x46')](handleError(_0x545117,null));};exports[_0xf189('0x58')]=function(_0x2c76fc,_0x417c9b,_0x3eee11){var _0x3e9ad0={};var _0xcb775e={};var _0x4aaf70;var _0x235bf9;return db['CmCompany'][_0xf189('0x59')]({'where':{'id':_0x2c76fc[_0xf189('0x48')]['id']}})[_0xf189('0x26')](handleEntityNotFound(_0x417c9b,null))[_0xf189('0x26')](function(_0x51beb5){if(_0x51beb5){_0x4aaf70=_0x51beb5;_0xcb775e[_0xf189('0x35')]=_[_0xf189('0x31')](db[_0xf189('0x56')]['rawAttributes']);_0xcb775e[_0xf189('0x32')]=_[_0xf189('0x31')](_0x2c76fc[_0xf189('0x32')]);_0xcb775e[_0xf189('0x33')]=_[_0xf189('0x34')](_0xcb775e[_0xf189('0x35')],_0xcb775e[_0xf189('0x32')]);_0x3e9ad0['attributes']=_[_0xf189('0x34')](_0xcb775e['model'],qs['fields'](_0x2c76fc[_0xf189('0x32')][_0xf189('0x37')]));_0x3e9ad0[_0xf189('0x36')]=_0x3e9ad0[_0xf189('0x36')]['length']?_0x3e9ad0[_0xf189('0x36')]:_0xcb775e[_0xf189('0x35')];_0x3e9ad0[_0xf189('0x3b')]=qs[_0xf189('0x5a')](_0x2c76fc[_0xf189('0x32')][_0xf189('0x5a')]);_0x3e9ad0[_0xf189('0x3c')]=qs[_0xf189('0x33')](_[_0xf189('0x3d')](_0x2c76fc[_0xf189('0x32')],_0xcb775e[_0xf189('0x33')]));if(_0x2c76fc[_0xf189('0x32')][_0xf189('0x3e')]){_0x3e9ad0[_0xf189('0x3c')]=_[_0xf189('0x3f')](_0x3e9ad0[_0xf189('0x3c')],{'$or':_[_0xf189('0x5b')](_0x3e9ad0[_0xf189('0x36')],function(_0x6863da){var _0x5945fa={};_0x5945fa[_0x6863da]={'$like':'%'+_0x2c76fc[_0xf189('0x32')]['filter']+'%'};return _0x5945fa;})});}_0x3e9ad0=_[_0xf189('0x3f')]({},_0x3e9ad0,_0x2c76fc['options']);return _0x4aaf70[_0xf189('0x58')](_0x3e9ad0);}})[_0xf189('0x26')](function(_0x329256){if(_0x329256){_0x235bf9=_0x329256[_0xf189('0x38')];if(!_0x2c76fc[_0xf189('0x32')][_0xf189('0x39')]('nolimit')){_0x3e9ad0[_0xf189('0x20')]=qs['limit'](_0x2c76fc[_0xf189('0x32')]['limit']);_0x3e9ad0[_0xf189('0x1d')]=qs[_0xf189('0x1d')](_0x2c76fc[_0xf189('0x32')][_0xf189('0x1d')]);}return _0x4aaf70[_0xf189('0x58')](_0x3e9ad0);}})[_0xf189('0x26')](function(_0x17e3cc){if(_0x17e3cc){return _0x17e3cc?{'count':_0x235bf9,'rows':_0x17e3cc}:null;}})[_0xf189('0x26')](respondWithResult(_0x417c9b,null))[_0xf189('0x46')](handleError(_0x417c9b,null));}; \ No newline at end of file +var _0x27b3=['options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','getContacts','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','CmCompany','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map'];(function(_0xea50a0,_0xeb7977){var _0x37e8f1=function(_0x13541e){while(--_0x13541e){_0xea50a0['push'](_0xea50a0['shift']());}};_0x37e8f1(++_0xeb7977);}(_0x27b3,0x10b));var _0x327b=function(_0x30e872,_0x27f411){_0x30e872=_0x30e872-0x0;var _0x4e8fd8=_0x27b3[_0x30e872];return _0x4e8fd8;};'use strict';var emlformat=require(_0x327b('0x0'));var rimraf=require(_0x327b('0x1'));var zipdir=require(_0x327b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x327b('0x3'));var moment=require(_0x327b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x327b('0x5'));var util=require(_0x327b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x327b('0x7'));var _=require(_0x327b('0x8'));var squel=require(_0x327b('0x9'));var crypto=require('crypto');var jsforce=require(_0x327b('0xa'));var deskjs=require(_0x327b('0xb'));var toCsv=require(_0x327b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x327b('0xd'));var authService=require(_0x327b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x327b('0xf'));var hardwareService=require(_0x327b('0x10'));var logger=require(_0x327b('0x11'))(_0x327b('0x12'));var utils=require('../../config/utils');var config=require(_0x327b('0x13'));var licenseUtil=require(_0x327b('0x14'));var db=require(_0x327b('0x15'))['db'];function respondWithStatusCode(_0x5bef9f,_0x513b95){_0x513b95=_0x513b95||0xcc;return function(_0x20bc6f){if(_0x20bc6f){return _0x5bef9f[_0x327b('0x16')](_0x513b95);}return _0x5bef9f['status'](_0x513b95)[_0x327b('0x17')]();};}function respondWithResult(_0x1d4213,_0x5b8af7){_0x5b8af7=_0x5b8af7||0xc8;return function(_0x363488){if(_0x363488){return _0x1d4213[_0x327b('0x18')](_0x5b8af7)[_0x327b('0x19')](_0x363488);}};}function respondWithFilteredResult(_0x3025f7,_0x182e4e){return function(_0x485f85){if(_0x485f85){var _0x2e9a3a=typeof _0x182e4e[_0x327b('0x1a')]==='undefined'&&typeof _0x182e4e[_0x327b('0x1b')]==='undefined';var _0x6196f1=_0x485f85[_0x327b('0x1c')];var _0x58a231=_0x2e9a3a?0x0:_0x182e4e['offset'];var _0xf87753=_0x2e9a3a?_0x485f85['count']:_0x182e4e[_0x327b('0x1a')]+_0x182e4e[_0x327b('0x1b')];var _0x4747f0;if(_0xf87753>=_0x6196f1){_0xf87753=_0x6196f1;_0x4747f0=0xc8;}else{_0x4747f0=0xce;}_0x3025f7['status'](_0x4747f0);return _0x3025f7['set'](_0x327b('0x1d'),_0x58a231+'-'+_0xf87753+'/'+_0x6196f1)[_0x327b('0x19')](_0x485f85);}return null;};}function patchUpdates(_0x20fe33){return function(_0x36227e){try{jsonpatch['apply'](_0x36227e,_0x20fe33,!![]);}catch(_0x57a259){return BPromise['reject'](_0x57a259);}return _0x36227e[_0x327b('0x1e')]();};}function saveUpdates(_0x919f7e,_0x4b710c){return function(_0x4f1d25){if(_0x4f1d25){return _0x4f1d25[_0x327b('0x1f')](_0x919f7e)[_0x327b('0x20')](function(_0x5e8332){return _0x5e8332;});}return null;};}function removeEntity(_0x757a96,_0x3cb76a){return function(_0x2341fc){if(_0x2341fc){return _0x2341fc[_0x327b('0x21')]()['then'](function(){var _0x216a33=_0x2341fc[_0x327b('0x22')]({'plain':!![]});var _0x5b8152=_0x327b('0x23');return db[_0x327b('0x24')][_0x327b('0x21')]({'where':{'type':_0x5b8152,'resourceId':_0x216a33['id']}})[_0x327b('0x20')](function(){return _0x2341fc;});})['then'](function(){_0x757a96[_0x327b('0x18')](0xcc)[_0x327b('0x17')]();});}};}function handleEntityNotFound(_0x57fc31,_0x5e3dcc){return function(_0x5dc46a){if(!_0x5dc46a){_0x57fc31[_0x327b('0x16')](0x194);}return _0x5dc46a;};}function handleError(_0x4e792e,_0x473f31){_0x473f31=_0x473f31||0x1f4;return function(_0x257955){logger[_0x327b('0x25')](_0x257955[_0x327b('0x26')]);if(_0x257955[_0x327b('0x27')]){delete _0x257955[_0x327b('0x27')];}_0x4e792e[_0x327b('0x18')](_0x473f31)['send'](_0x257955);};}exports[_0x327b('0x28')]=function(_0x1cd0e7,_0x57ad5b){var _0x3d3794={},_0x561dcc={},_0x258e45={'count':0x0,'rows':[]};return db[_0x327b('0x29')]['describe']()[_0x327b('0x20')](function(_0x475302){_0x561dcc[_0x327b('0x2a')]=_['keys'](_0x475302);_0x561dcc[_0x327b('0x2b')]=_[_0x327b('0x2c')](_0x1cd0e7[_0x327b('0x2b')]);_0x561dcc['filters']=_['intersection'](_0x561dcc['model'],_0x561dcc['query']);_0x3d3794[_0x327b('0x2d')]=_['intersection'](_0x561dcc[_0x327b('0x2a')],qs['fields'](_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x2e')]));_0x3d3794['attributes']=_0x3d3794[_0x327b('0x2d')][_0x327b('0x2f')]?_0x3d3794[_0x327b('0x2d')]:_0x561dcc[_0x327b('0x2a')];if(!_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x30')](_0x327b('0x31'))){_0x3d3794[_0x327b('0x1b')]=qs['limit'](_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x1b')]);_0x3d3794[_0x327b('0x1a')]=qs[_0x327b('0x1a')](_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x1a')]);}_0x3d3794[_0x327b('0x32')]=qs['sort'](_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x33')]);_0x3d3794[_0x327b('0x34')]=qs[_0x327b('0x35')](_['pick'](_0x1cd0e7[_0x327b('0x2b')],_0x561dcc[_0x327b('0x35')]),_0x475302);if(_0x1cd0e7['query'][_0x327b('0x36')]){_0x3d3794[_0x327b('0x34')]=_[_0x327b('0x37')](_0x3d3794[_0x327b('0x34')],{'$or':_[_0x327b('0x38')](_0x3d3794['attributes'],function(_0x2c8ca1){var _0x5316d1={};_0x5316d1[_0x2c8ca1]={'$like':'%'+_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x36')]+'%'};return _0x5316d1;})});}_0x3d3794=_[_0x327b('0x37')]({},_0x3d3794,_0x1cd0e7[_0x327b('0x39')]);var _0x199eb5={'where':_0x3d3794[_0x327b('0x34')]};return db[_0x327b('0x29')][_0x327b('0x1c')](_0x199eb5)[_0x327b('0x20')](function(_0x26cb52){_0x258e45['count']=_0x26cb52;if(_0x1cd0e7[_0x327b('0x2b')][_0x327b('0x3a')]){_0x3d3794['include']=[{'all':!![]}];}return db[_0x327b('0x29')][_0x327b('0x3b')](_0x3d3794);})[_0x327b('0x20')](function(_0x1b9958){_0x258e45[_0x327b('0x3c')]=_0x1b9958;return _0x258e45;})['then'](respondWithFilteredResult(_0x57ad5b,_0x3d3794))[_0x327b('0x3d')](handleError(_0x57ad5b,null));})[_0x327b('0x3d')](handleError(_0x57ad5b,null));};exports[_0x327b('0x3e')]=function(_0x5f31f8,_0xd74cef){var _0x54d287={'raw':![],'where':{'id':_0x5f31f8[_0x327b('0x3f')]['id']}},_0x16f0f8={};_0x16f0f8[_0x327b('0x2a')]=_[_0x327b('0x2c')](db['CmCompany'][_0x327b('0x40')]);_0x16f0f8[_0x327b('0x2b')]=_[_0x327b('0x2c')](_0x5f31f8[_0x327b('0x2b')]);_0x16f0f8['filters']=_[_0x327b('0x41')](_0x16f0f8[_0x327b('0x2a')],_0x16f0f8['query']);_0x54d287[_0x327b('0x2d')]=_[_0x327b('0x41')](_0x16f0f8[_0x327b('0x2a')],qs['fields'](_0x5f31f8[_0x327b('0x2b')][_0x327b('0x2e')]));_0x54d287[_0x327b('0x2d')]=_0x54d287['attributes'][_0x327b('0x2f')]?_0x54d287[_0x327b('0x2d')]:_0x16f0f8[_0x327b('0x2a')];if(_0x5f31f8[_0x327b('0x2b')][_0x327b('0x3a')]){_0x54d287[_0x327b('0x42')]=[{'all':!![]}];}_0x54d287=_[_0x327b('0x37')]({},_0x54d287,_0x5f31f8[_0x327b('0x39')]);return db[_0x327b('0x29')][_0x327b('0x43')](_0x54d287)['then'](handleEntityNotFound(_0xd74cef,null))[_0x327b('0x20')](respondWithResult(_0xd74cef,null))[_0x327b('0x3d')](handleError(_0xd74cef,null));};exports[_0x327b('0x44')]=function(_0x5a0926,_0x342bb2){return db[_0x327b('0x29')][_0x327b('0x44')](_0x5a0926[_0x327b('0x45')],{})[_0x327b('0x20')](function(_0x5d0947){var _0x2f7d3a=_0x5a0926[_0x327b('0x46')][_0x327b('0x22')]({'plain':!![]});if(!_0x2f7d3a)throw new Error(_0x327b('0x47'));if(_0x2f7d3a['role']===_0x327b('0x46')){var _0x33d299=_0x5d0947['get']({'plain':!![]});var _0x512d04=_0x327b('0x23');return db[_0x327b('0x48')][_0x327b('0x43')]({'where':{'name':_0x512d04,'userProfileId':_0x2f7d3a['userProfileId']},'raw':!![]})[_0x327b('0x20')](function(_0x2c6fc4){if(_0x2c6fc4&&_0x2c6fc4[_0x327b('0x49')]===0x0){return db[_0x327b('0x24')][_0x327b('0x44')]({'name':_0x33d299[_0x327b('0x27')],'resourceId':_0x33d299['id'],'type':_0x2c6fc4[_0x327b('0x27')],'sectionId':_0x2c6fc4['id']},{})['then'](function(){return _0x5d0947;});}else{return _0x5d0947;}})[_0x327b('0x3d')](function(_0x12d976){logger['error'](_0x327b('0x4a'),_0x12d976);throw _0x12d976;});}return _0x5d0947;})['then'](respondWithResult(_0x342bb2,0xc9))[_0x327b('0x3d')](handleError(_0x342bb2,null));};exports['update']=function(_0x2f09df,_0x2ff78a){if(_0x2f09df[_0x327b('0x45')]['id']){delete _0x2f09df[_0x327b('0x45')]['id'];}return db[_0x327b('0x29')][_0x327b('0x43')]({'where':{'id':_0x2f09df[_0x327b('0x3f')]['id']}})[_0x327b('0x20')](handleEntityNotFound(_0x2ff78a,null))[_0x327b('0x20')](saveUpdates(_0x2f09df[_0x327b('0x45')],null))[_0x327b('0x20')](respondWithResult(_0x2ff78a,null))['catch'](handleError(_0x2ff78a,null));};exports[_0x327b('0x21')]=function(_0x28cc55,_0x46acf9){return db['CmCompany'][_0x327b('0x43')]({'where':{'id':_0x28cc55['params']['id']}})['then'](handleEntityNotFound(_0x46acf9,null))[_0x327b('0x20')](removeEntity(_0x46acf9,null))[_0x327b('0x3d')](handleError(_0x46acf9,null));};exports[_0x327b('0x4b')]=function(_0x591f48,_0x4c0700){return db[_0x327b('0x29')]['describe']()[_0x327b('0x20')](respondWithResult(_0x4c0700,null))[_0x327b('0x3d')](handleError(_0x4c0700,null));};exports[_0x327b('0x4c')]=function(_0x3e6df4,_0x406a81,_0x38ecfa){return db[_0x327b('0x4d')][_0x327b('0x43')]({'where':{'id':_0x3e6df4[_0x327b('0x3f')]['id']}})[_0x327b('0x20')](handleEntityNotFound(_0x406a81,null))['then'](function(_0x41b8f5){if(_0x41b8f5){return _0x41b8f5[_0x327b('0x4c')](_0x3e6df4['body'][_0x327b('0x4e')],_[_0x327b('0x4f')](_0x3e6df4[_0x327b('0x45')],[_0x327b('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x406a81,null))[_0x327b('0x3d')](handleError(_0x406a81,null));};exports['getContacts']=function(_0x3038b7,_0x41923c,_0x33f570){var _0x21dd5a={};var _0x1033cb={};var _0x5ada38;var _0x6ccae5;return db['CmCompany']['findOne']({'where':{'id':_0x3038b7[_0x327b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x41923c,null))[_0x327b('0x20')](function(_0x2aa5e5){if(_0x2aa5e5){_0x5ada38=_0x2aa5e5;_0x1033cb['model']=_[_0x327b('0x2c')](db[_0x327b('0x4d')]['rawAttributes']);_0x1033cb[_0x327b('0x2b')]=_[_0x327b('0x2c')](_0x3038b7[_0x327b('0x2b')]);_0x1033cb[_0x327b('0x35')]=_[_0x327b('0x41')](_0x1033cb['model'],_0x1033cb[_0x327b('0x2b')]);_0x21dd5a[_0x327b('0x2d')]=_[_0x327b('0x41')](_0x1033cb[_0x327b('0x2a')],qs[_0x327b('0x2e')](_0x3038b7[_0x327b('0x2b')][_0x327b('0x2e')]));_0x21dd5a[_0x327b('0x2d')]=_0x21dd5a['attributes'][_0x327b('0x2f')]?_0x21dd5a[_0x327b('0x2d')]:_0x1033cb['model'];_0x21dd5a[_0x327b('0x32')]=qs[_0x327b('0x33')](_0x3038b7[_0x327b('0x2b')][_0x327b('0x33')]);_0x21dd5a[_0x327b('0x34')]=qs[_0x327b('0x35')](_['pick'](_0x3038b7['query'],_0x1033cb[_0x327b('0x35')]));if(_0x3038b7[_0x327b('0x2b')][_0x327b('0x36')]){_0x21dd5a[_0x327b('0x34')]=_[_0x327b('0x37')](_0x21dd5a[_0x327b('0x34')],{'$or':_['map'](_0x21dd5a[_0x327b('0x2d')],function(_0x55185f){var _0x31b62a={};_0x31b62a[_0x55185f]={'$like':'%'+_0x3038b7['query'][_0x327b('0x36')]+'%'};return _0x31b62a;})});}_0x21dd5a=_['merge']({},_0x21dd5a,_0x3038b7['options']);return _0x5ada38[_0x327b('0x50')](_0x21dd5a);}})[_0x327b('0x20')](function(_0xbd36ba){if(_0xbd36ba){_0x6ccae5=_0xbd36ba[_0x327b('0x2f')];if(!_0x3038b7['query']['hasOwnProperty'](_0x327b('0x31'))){_0x21dd5a[_0x327b('0x1b')]=qs[_0x327b('0x1b')](_0x3038b7[_0x327b('0x2b')][_0x327b('0x1b')]);_0x21dd5a['offset']=qs['offset'](_0x3038b7['query'][_0x327b('0x1a')]);}return _0x5ada38[_0x327b('0x50')](_0x21dd5a);}})['then'](function(_0x4f7e5c){if(_0x4f7e5c){return _0x4f7e5c?{'count':_0x6ccae5,'rows':_0x4f7e5c}:null;}})[_0x327b('0x20')](respondWithResult(_0x41923c,null))[_0x327b('0x3d')](handleError(_0x41923c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 305ca54..cf1a559 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 _0xc7c1=['../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b701d,_0xa83eac){var _0x271fd7=function(_0x54fdce){while(--_0x54fdce){_0x1b701d['push'](_0x1b701d['shift']());}};_0x271fd7(++_0xa83eac);}(_0xc7c1,0x1e6));var _0x1c7c=function(_0x156b37,_0x442e2e){_0x156b37=_0x156b37-0x0;var _0x12ae4c=_0xc7c1[_0x156b37];return _0x12ae4c;};'use strict';var _=require(_0x1c7c('0x0'));var util=require(_0x1c7c('0x1'));var logger=require(_0x1c7c('0x2'))('api');var moment=require(_0x1c7c('0x3'));var BPromise=require(_0x1c7c('0x4'));var rp=require(_0x1c7c('0x5'));var fs=require('fs');var path=require(_0x1c7c('0x6'));var rimraf=require(_0x1c7c('0x7'));var config=require(_0x1c7c('0x8'));var attributes=require(_0x1c7c('0x9'));module[_0x1c7c('0xa')]=function(_0x1f2b09,_0xbf22ab){return _0x1f2b09['define'](_0x1c7c('0xb'),attributes,{'tableName':_0x1c7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6df0=['CmCompany','cm_companies','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x16e59e,_0x586ded){var _0xb4b3ac=function(_0xc8b4d8){while(--_0xc8b4d8){_0x16e59e['push'](_0x16e59e['shift']());}};_0xb4b3ac(++_0x586ded);}(_0x6df0,0x7b));var _0x06df=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x6df0[_0x173f10];return _0x53142d;};'use strict';var _=require(_0x06df('0x0'));var util=require(_0x06df('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x06df('0x2'));var rp=require(_0x06df('0x3'));var fs=require('fs');var path=require(_0x06df('0x4'));var rimraf=require(_0x06df('0x5'));var config=require(_0x06df('0x6'));var attributes=require(_0x06df('0x7'));module[_0x06df('0x8')]=function(_0x1da49f,_0x327448){return _0x1da49f['define'](_0x06df('0x9'),attributes,{'tableName':_0x06df('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 37128e1..79a6b3e 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 _0x6ac0=['http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6ac0,0x17c));var _0x06ac=function(_0x199318,_0x217869){_0x199318=_0x199318-0x0;var _0x171a8d=_0x6ac0[_0x199318];return _0x171a8d;};'use strict';var _=require(_0x06ac('0x0'));var util=require(_0x06ac('0x1'));var moment=require(_0x06ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06ac('0x3'));var db=require(_0x06ac('0x4'))['db'];var utils=require(_0x06ac('0x5'));var logger=require(_0x06ac('0x6'))(_0x06ac('0x7'));var config=require(_0x06ac('0x8'));var jayson=require(_0x06ac('0x9'));var client=jayson[_0x06ac('0xa')][_0x06ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5497f3,_0x4754e8,_0x1891b6){return new BPromise(function(_0x2e195c,_0x1c1441){return client[_0x06ac('0xc')](_0x5497f3,_0x1891b6)[_0x06ac('0xd')](function(_0x202068){logger[_0x06ac('0xe')]('CmCompany,\x20%s,\x20%s',_0x4754e8,_0x06ac('0xf'));logger[_0x06ac('0x10')](_0x06ac('0x11'),_0x4754e8,_0x06ac('0xf'),JSON[_0x06ac('0x12')](_0x202068));if(_0x202068['error']){if(_0x202068[_0x06ac('0x13')]['code']===0x1f4){logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);return _0x1c1441(_0x202068['error'][_0x06ac('0x15')]);}logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);return _0x2e195c(_0x202068[_0x06ac('0x13')][_0x06ac('0x15')]);}else{logger[_0x06ac('0xe')](_0x06ac('0x14'),_0x4754e8,_0x06ac('0xf'));_0x2e195c(_0x202068['result'][_0x06ac('0x15')]);}})[_0x06ac('0x16')](function(_0xb077c3){logger[_0x06ac('0x13')](_0x06ac('0x14'),_0x4754e8,_0xb077c3);_0x1c1441(_0xb077c3);});});} \ No newline at end of file +var _0x3be2=['client','http','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CmCompany,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x34cecb,_0x26eb8c){var _0x4b95e6=function(_0x151955){while(--_0x151955){_0x34cecb['push'](_0x34cecb['shift']());}};_0x4b95e6(++_0x26eb8c);}(_0x3be2,0x1b0));var _0x23be=function(_0x30ad9c,_0x3a5cc9){_0x30ad9c=_0x30ad9c-0x0;var _0x1f847f=_0x3be2[_0x30ad9c];return _0x1f847f;};'use strict';var _=require(_0x23be('0x0'));var util=require(_0x23be('0x1'));var moment=require(_0x23be('0x2'));var BPromise=require(_0x23be('0x3'));var rs=require(_0x23be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x23be('0x5'));var logger=require(_0x23be('0x6'))(_0x23be('0x7'));var config=require('../../config/environment');var jayson=require(_0x23be('0x8'));var client=jayson[_0x23be('0x9')][_0x23be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22af78,_0x483042,_0x23ecee){return new BPromise(function(_0x46353d,_0x9e8fb0){return client['request'](_0x22af78,_0x23ecee)[_0x23be('0xb')](function(_0x405016){logger[_0x23be('0xc')]('CmCompany,\x20%s,\x20%s',_0x483042,'request\x20sent');logger[_0x23be('0xd')](_0x23be('0xe'),_0x483042,_0x23be('0xf'),JSON[_0x23be('0x10')](_0x405016));if(_0x405016[_0x23be('0x11')]){if(_0x405016[_0x23be('0x11')]['code']===0x1f4){logger[_0x23be('0x11')](_0x23be('0x12'),_0x483042,_0x405016[_0x23be('0x11')]['message']);return _0x9e8fb0(_0x405016[_0x23be('0x11')][_0x23be('0x13')]);}logger['error'](_0x23be('0x12'),_0x483042,_0x405016[_0x23be('0x11')][_0x23be('0x13')]);return _0x46353d(_0x405016[_0x23be('0x11')][_0x23be('0x13')]);}else{logger['info'](_0x23be('0x12'),_0x483042,_0x23be('0xf'));_0x46353d(_0x405016[_0x23be('0x14')][_0x23be('0x13')]);}})['catch'](function(_0x4a38e8){logger['error'](_0x23be('0x12'),_0x483042,_0x4a38e8);_0x9e8fb0(_0x4a38e8);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2b85603..b1c1fcd 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 _0x8d4d=['../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','describe','get','/:id','getContacts','/:id/contacts','addContacts','put','update','multer','path','connect-timeout','express','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d4d,0x94));var _0xd8d4=function(_0x115497,_0x3e7156){_0x115497=_0x115497-0x0;var _0xccd20f=_0x8d4d[_0x115497];return _0xccd20f;};'use strict';var multer=require(_0xd8d4('0x0'));var util=require('util');var path=require(_0xd8d4('0x1'));var timeout=require(_0xd8d4('0x2'));var express=require(_0xd8d4('0x3'));var router=express[_0xd8d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd8d4('0x5'));var interaction=require(_0xd8d4('0x6'));var config=require('../../config/environment');var controller=require(_0xd8d4('0x7'));router['get']('/',auth[_0xd8d4('0x8')](),controller['index']);router['get']('/describe',auth[_0xd8d4('0x8')](),controller[_0xd8d4('0x9')]);router[_0xd8d4('0xa')](_0xd8d4('0xb'),auth[_0xd8d4('0x8')](),controller['show']);router[_0xd8d4('0xa')]('/:id/contacts',auth[_0xd8d4('0x8')](),controller[_0xd8d4('0xc')]);router['post']('/',auth[_0xd8d4('0x8')](),controller['create']);router['post'](_0xd8d4('0xd'),auth[_0xd8d4('0x8')](),controller[_0xd8d4('0xe')]);router[_0xd8d4('0xf')](_0xd8d4('0xb'),auth['isAuthenticated'](),controller[_0xd8d4('0x10')]);router['delete'](_0xd8d4('0xb'),auth[_0xd8d4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x779d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete','destroy','exports'];(function(_0x44125c,_0x4604fe){var _0x3b6999=function(_0x13b02c){while(--_0x13b02c){_0x44125c['push'](_0x44125c['shift']());}};_0x3b6999(++_0x4604fe);}(_0x779d,0x16c));var _0xd779=function(_0x5adad4,_0x18fce0){_0x5adad4=_0x5adad4-0x0;var _0x47e6be=_0x779d[_0x5adad4];return _0x47e6be;};'use strict';var multer=require(_0xd779('0x0'));var util=require(_0xd779('0x1'));var path=require('path');var timeout=require(_0xd779('0x2'));var express=require(_0xd779('0x3'));var router=express[_0xd779('0x4')]();var fs_extra=require(_0xd779('0x5'));var auth=require(_0xd779('0x6'));var interaction=require(_0xd779('0x7'));var config=require(_0xd779('0x8'));var controller=require(_0xd779('0x9'));router[_0xd779('0xa')]('/',auth[_0xd779('0xb')](),controller[_0xd779('0xc')]);router[_0xd779('0xa')](_0xd779('0xd'),auth['isAuthenticated'](),controller[_0xd779('0xe')]);router[_0xd779('0xa')](_0xd779('0xf'),auth[_0xd779('0xb')](),controller[_0xd779('0x10')]);router[_0xd779('0xa')](_0xd779('0x11'),auth[_0xd779('0xb')](),controller[_0xd779('0x12')]);router[_0xd779('0x13')]('/',auth[_0xd779('0xb')](),controller[_0xd779('0x14')]);router[_0xd779('0x13')](_0xd779('0x11'),auth[_0xd779('0xb')](),controller['addContacts']);router[_0xd779('0x15')](_0xd779('0xf'),auth[_0xd779('0xb')](),controller[_0xd779('0x16')]);router[_0xd779('0x17')](_0xd779('0xf'),auth[_0xd779('0xb')](),controller[_0xd779('0x18')]);module[_0xd779('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 083d9ae..81dd657 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 _0x1071=['TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','exports','STRING'];(function(_0x3c6ff6,_0x4e136a){var _0x4ac5ba=function(_0x1da29e){while(--_0x1da29e){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x4ac5ba(++_0x4e136a);}(_0x1071,0x75));var _0x1107=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1071[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x1107('0x0'));var Sequelize=require('sequelize');module[_0x1107('0x1')]={'firstName':{'type':Sequelize[_0x1107('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1107('0x2')]},'street':{'type':Sequelize[_0x1107('0x2')]},'postalCode':{'type':Sequelize[_0x1107('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1107('0x2')]},'dateOfBirth':{'type':Sequelize[_0x1107('0x2')]},'description':{'type':Sequelize[_0x1107('0x3')]},'phone':{'type':Sequelize[_0x1107('0x2')]},'mobile':{'type':Sequelize[_0x1107('0x2')]},'fax':{'type':Sequelize[_0x1107('0x2')]},'email':{'type':Sequelize[_0x1107('0x2')]},'url':{'type':Sequelize[_0x1107('0x2')]},'facebook':{'type':Sequelize[_0x1107('0x2')]},'fb_data':{'type':Sequelize[_0x1107('0x2')]},'twitter':{'type':Sequelize[_0x1107('0x2')]},'skype':{'type':Sequelize[_0x1107('0x2')]},'teams':{'type':Sequelize[_0x1107('0x2')]},'viber':{'type':Sequelize[_0x1107('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x1107('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1107('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1107('0x4')](0x2)[_0x1107('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1107('0x6')],'defaultValue':Sequelize[_0x1107('0x7')]},'dialTimezone':{'type':Sequelize[_0x1107('0x2')]},'utcOffset':{'type':Sequelize[_0x1107('0x4')]}}; \ No newline at end of file +var _0x0113=['UNSIGNED','NOW','lodash','exports','STRING','TEXT','INTEGER'];(function(_0x58a3c0,_0x15489b){var _0x1735b2=function(_0x128764){while(--_0x128764){_0x58a3c0['push'](_0x58a3c0['shift']());}};_0x1735b2(++_0x15489b);}(_0x0113,0xcd));var _0x3011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0113[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3011('0x0'));var Sequelize=require('sequelize');module[_0x3011('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3011('0x2')]},'postalCode':{'type':Sequelize[_0x3011('0x2')]},'city':{'type':Sequelize[_0x3011('0x2')]},'country':{'type':Sequelize[_0x3011('0x2')]},'dateOfBirth':{'type':Sequelize[_0x3011('0x2')]},'description':{'type':Sequelize[_0x3011('0x3')]},'phone':{'type':Sequelize[_0x3011('0x2')]},'mobile':{'type':Sequelize[_0x3011('0x2')]},'fax':{'type':Sequelize[_0x3011('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x3011('0x2')]},'facebook':{'type':Sequelize[_0x3011('0x2')]},'fb_data':{'type':Sequelize[_0x3011('0x2')]},'twitter':{'type':Sequelize[_0x3011('0x2')]},'skype':{'type':Sequelize[_0x3011('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3011('0x2')]},'line':{'type':Sequelize[_0x3011('0x2')]},'wechat':{'type':Sequelize[_0x3011('0x2')]},'telegram':{'type':Sequelize[_0x3011('0x2')]},'UserId':{'type':Sequelize[_0x3011('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x3011('0x2')]},'priority':{'type':Sequelize[_0x3011('0x4')](0x2)[_0x3011('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x3011('0x6')]},'dialTimezone':{'type':Sequelize[_0x3011('0x2')]},'utcOffset':{'type':Sequelize[_0x3011('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ff71bf8..506d49f 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 _0xe8e7=['omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','sort','filter','options','nolimit','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','order','pick','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','filename','chmodSync','child_process','CompanyId','pid','send','upload','file','parse','import','agent','binding','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csvUpdates','message','exit','mail','chat','sms','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closed','thirdDisposition','key','Owner','Tags','color','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','openchannel','externalUrl','flatten','sortBy','reverse','value','slice','moment','util','path','lodash','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','describe','findAll','query','user','catch','CmContact','find','params','tags','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','keys','duplicates','$or','where','ListId','spread','push','contact','all','show','Tag','tag','ItemType','sequelize','literal','Phones.OrderBy','$and'];(function(_0x4ff80a,_0x4eb5d6){var _0x347ad8=function(_0x3461b0){while(--_0x3461b0){_0x4ff80a['push'](_0x4ff80a['shift']());}};_0x347ad8(++_0x4eb5d6);}(_0xe8e7,0x95));var _0x7e8e=function(_0x36fbb3,_0xeacb78){_0x36fbb3=_0x36fbb3-0x0;var _0x25416a=_0xe8e7[_0x36fbb3];return _0x25416a;};'use strict';var moment=require(_0x7e8e('0x0'));var BPromise=require('bluebird');var util=require(_0x7e8e('0x1'));var path=require(_0x7e8e('0x2'));var fs=require('fs');var _=require(_0x7e8e('0x3'));var squel=require('squel');var Papa=require(_0x7e8e('0x4'));var Redis=require('ioredis');var contacts=require(_0x7e8e('0x5'));var qs=require(_0x7e8e('0x6'));var logger=require(_0x7e8e('0x7'))(_0x7e8e('0x8'));var config=require(_0x7e8e('0x9'));var shared=require(_0x7e8e('0xa'));var db=require(_0x7e8e('0xb'))['db'];config[_0x7e8e('0xc')]=_[_0x7e8e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e8e('0xe'))(new Redis(config[_0x7e8e('0xc')]));require(_0x7e8e('0xf'))['register'](socket);function respondWithResult(_0x1d17b4,_0x200668){_0x200668=_0x200668||0xc8;return function(_0x311481){if(_0x311481){return _0x1d17b4[_0x7e8e('0x10')](_0x200668)[_0x7e8e('0x11')](_0x311481);}};}function respondWithFilteredResult(_0x3ab3f6,_0x1ab139){return function(_0x37b87c){if(_0x37b87c){var _0x1e8f37=typeof _0x1ab139[_0x7e8e('0x12')]==='undefined'&&typeof _0x1ab139['limit']===_0x7e8e('0x13');var _0xa4aaa3=_0x37b87c[_0x7e8e('0x14')];var _0x294bb8=_0x1e8f37?0x0:_0x1ab139[_0x7e8e('0x12')];var _0x19dc7e=_0x1e8f37?_0x37b87c[_0x7e8e('0x14')]:_0x1ab139[_0x7e8e('0x12')]+_0x1ab139[_0x7e8e('0x15')];var _0x3fe86c;if(_0x19dc7e>=_0xa4aaa3){_0x19dc7e=_0xa4aaa3;_0x3fe86c=0xc8;}else{_0x3fe86c=0xce;}_0x3ab3f6[_0x7e8e('0x10')](_0x3fe86c);return _0x3ab3f6[_0x7e8e('0x16')](_0x7e8e('0x17'),_0x294bb8+'-'+_0x19dc7e+'/'+_0xa4aaa3)['json'](_0x37b87c);}return null;};}function saveUpdates(_0x3a80a0){return function(_0x443805){if(_0x443805){return _0x443805[_0x7e8e('0x18')](_0x3a80a0)[_0x7e8e('0x19')](function(_0x545feb){return _0x545feb;});}return null;};}function removeEntity(_0x3435be){return function(_0x58b2a1){if(_0x58b2a1){return _0x58b2a1[_0x7e8e('0x1a')]()['then'](function(){_0x3435be[_0x7e8e('0x10')](0xcc)[_0x7e8e('0x1b')]();});}};}function handleEntityNotFound(_0x1a21f5){return function(_0x2db748){if(!_0x2db748){_0x1a21f5[_0x7e8e('0x1c')](0x194);}return _0x2db748;};}function handleError(_0x1d3f26,_0x172bc1){_0x172bc1=_0x172bc1||0x1f4;return function(_0x4292d1){logger[_0x7e8e('0x1d')](_0x4292d1[_0x7e8e('0x1e')]);if(_0x4292d1['name']){delete _0x4292d1[_0x7e8e('0x1f')];}_0x1d3f26[_0x7e8e('0x10')](_0x172bc1)['send'](_0x4292d1);};}exports[_0x7e8e('0x20')]=function(_0x2cb8b6,_0x1c6b87){var _0xe41b3c={};return contacts[_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x38850d){_0xe41b3c=qs['getOptions'](_0x38850d,_0x2cb8b6);return contacts[_0x7e8e('0x22')](_0x2cb8b6[_0x7e8e('0x23')],_0x2cb8b6[_0x7e8e('0x24')],_0xe41b3c,_0x38850d);})[_0x7e8e('0x19')](respondWithFilteredResult(_0x1c6b87,_0xe41b3c))[_0x7e8e('0x25')](handleError(_0x1c6b87,null));};exports[_0x7e8e('0x1a')]=function(_0x212cc8,_0x13b6ef){return db[_0x7e8e('0x26')][_0x7e8e('0x27')]({'where':{'id':_0x212cc8[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x13b6ef,null))[_0x7e8e('0x19')](removeEntity(_0x13b6ef,null))[_0x7e8e('0x25')](handleError(_0x13b6ef,null));};exports['describe']=function(_0x178381,_0x3a2ae7){return db[_0x7e8e('0x26')][_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x2d057e){delete _0x2d057e[_0x7e8e('0x29')];for(var _0x3c167e=0x0;_0x3c167e0x0){return new Promise(function(_0x3204ba){var _0x3eaa84=[];for(var _0x479a49=0x0;_0x479a49<_0x16694f['length'];_0x479a49++){_0x3eaa84[_0x7e8e('0x62')](insertAdditionalPhones(_0x16694f[_0x479a49][_0x7e8e('0x63')],_0x16694f[_0x479a49][_0x7e8e('0x5a')]));}Promise[_0x7e8e('0x64')](_0x3eaa84)[_0x7e8e('0x19')](function(){_0x3204ba(0x1);});})[_0x7e8e('0x19')](function(){return{'success':_0x4045e1,'failure':_0x3c546a,'duplicates':_0x5541c5};});}else{return{'success':_0x4045e1,'failure':_0x3c546a,'duplicates':_0x5541c5};}}})[_0x7e8e('0x19')](respondWithResult(_0x49af18,0xc9))['catch'](handleError(_0x49af18,null));};exports[_0x7e8e('0x65')]=function(_0x2350bd,_0x5dc4c9){var _0x20771b;return db[_0x7e8e('0x26')][_0x7e8e('0x21')]()[_0x7e8e('0x19')](function(_0x596386){return db['CmContact'][_0x7e8e('0x27')]({'where':{'id':_0x2350bd['params']['id']},'include':[{'model':db[_0x7e8e('0x66')],'as':'Tags','attributes':['id',_0x7e8e('0x1f'),'color'],'required':_0x2350bd[_0x7e8e('0x23')][_0x7e8e('0x67')]?!![]:![]},{'model':db[_0x7e8e('0x4d')],'as':'Phones','where':{'CmContactId':_0x2350bd[_0x7e8e('0x28')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x7e8e('0x68')}]}],'order':[db[_0x7e8e('0x69')][_0x7e8e('0x6a')](_0x7e8e('0x6b'))],'attributes':_['keys'](_0x596386)});})[_0x7e8e('0x19')](function(_0x3d1041){if(!_[_0x7e8e('0x57')](_0x3d1041)){_0x20771b=_0x3d1041[_0x7e8e('0x3a')]({'plain':!![]});var _0x1d6023={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3d1041&&_0x3d1041[_0x7e8e('0x60')]){if(_0x3d1041[_0x7e8e('0x60')]){_0x1d6023[_0x7e8e('0x5f')][_0x7e8e('0x6c')][_0x7e8e('0x62')]({'ListId':{'$ne':_0x3d1041[_0x7e8e('0x60')]}});}}return db[_0x7e8e('0x30')][_0x7e8e('0x22')](_0x1d6023);}})['then'](function(_0x24f3d0){if(!_[_0x7e8e('0x57')](_0x24f3d0)){return _[_0x7e8e('0x6d')](_0x20771b,_[_0x7e8e('0x6e')](_0x24f3d0,function(_0x3dc1e0){return util[_0x7e8e('0x6f')](_0x7e8e('0x70'),_0x3dc1e0['id']);}));}})[_0x7e8e('0x19')](handleEntityNotFound(_0x5dc4c9,null))[_0x7e8e('0x19')](respondWithResult(_0x5dc4c9,null))['catch'](handleError(_0x5dc4c9,null));};exports['update']=function(_0x3eb78c,_0x8f757e){var _0x23437e;if(_0x3eb78c['body']['id']){delete _0x3eb78c[_0x7e8e('0x39')]['id'];}if(!_[_0x7e8e('0x57')](_0x3eb78c['body'][_0x7e8e('0x56')])){var _0x23302e=_0x3eb78c[_0x7e8e('0x39')]['dialTimezone'];if(!_['isNil'](shared[_0x7e8e('0x58')][_0x23302e]))_0x3eb78c[_0x7e8e('0x39')]['utcOffset']=shared['timezones'][_0x23302e][_0x7e8e('0x59')];}return db[_0x7e8e('0x26')]['find']({'where':{'id':_0x3eb78c[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x8f757e,null))[_0x7e8e('0x19')](saveUpdates(_0x3eb78c[_0x7e8e('0x39')],null))[_0x7e8e('0x19')](function(_0x221609){_0x23437e=_0x221609;var _0xca99e9={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x221609&&_0x221609[_0x7e8e('0x60')]){if(_0x221609[_0x7e8e('0x60')]){_0xca99e9[_0x7e8e('0x5f')][_0x7e8e('0x6c')][_0x7e8e('0x62')]({'ListId':{'$ne':_0x221609[_0x7e8e('0x60')]}});}}return db[_0x7e8e('0x30')][_0x7e8e('0x22')](_0xca99e9);})[_0x7e8e('0x19')](function(_0x219f55){if(_0x219f55){return _['omit'](_[_0x7e8e('0x71')](_0x3eb78c[_0x7e8e('0x39')],function(_0x55c3a2,_0x2bb726){return _[_0x7e8e('0x2b')](_0x2bb726,_0x7e8e('0x2c'));}),_[_0x7e8e('0x6e')](_0x219f55,function(_0x2a9a55){return util[_0x7e8e('0x6f')](_0x7e8e('0x70'),_0x2a9a55['id']);}));}})[_0x7e8e('0x19')](function(_0x1bf47d){if(_0x1bf47d&&!_[_0x7e8e('0x72')](_0x1bf47d)){var _0x41a731=squel[_0x7e8e('0x18')]()[_0x7e8e('0x73')](_0x7e8e('0x74'))['setFields'](_0x1bf47d)[_0x7e8e('0x5f')](_0x7e8e('0x75'),_0x3eb78c['params']['id'])[_0x7e8e('0x76')]();return db[_0x7e8e('0x69')]['query'](_0x41a731[_0x7e8e('0x77')],{'replacements':_0x41a731[_0x7e8e('0x33')]});}})[_0x7e8e('0x19')](function(){if(_0x3eb78c[_0x7e8e('0x39')][_0x7e8e('0x78')]&&_0x23437e){return db[_0x7e8e('0x79')][_0x7e8e('0x18')]({'phone':_0x3eb78c[_0x7e8e('0x39')][_0x7e8e('0x78')],'OrderBy':0x0},{'where':{'ContactId':_0x23437e['id']}});}})[_0x7e8e('0x19')](function(){return _0x23437e;})['then'](respondWithResult(_0x8f757e,null))[_0x7e8e('0x25')](handleError(_0x8f757e,null));};exports[_0x7e8e('0x7a')]=function(_0x7ac79d,_0x254f62){var _0x244435={};var _0x3d609={};var _0x2919f6;var _0x3ebbbb;return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x7ac79d[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x254f62,null))[_0x7e8e('0x19')](function(_0x55d44b){if(_0x55d44b){_0x2919f6=_0x55d44b;_0x3d609[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0x66')][_0x7e8e('0x7d')]);_0x3d609[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x7ac79d['query']);_0x3d609[_0x7e8e('0x7e')]=_[_0x7e8e('0x7f')](_0x3d609[_0x7e8e('0x7c')],_0x3d609['query']);_0x244435[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x3d609[_0x7e8e('0x7c')],qs[_0x7e8e('0x81')](_0x7ac79d[_0x7e8e('0x23')]['fields']));_0x244435[_0x7e8e('0x80')]=_0x244435['attributes'][_0x7e8e('0x2a')]?_0x244435[_0x7e8e('0x80')]:_0x3d609[_0x7e8e('0x7c')];_0x244435['order']=qs[_0x7e8e('0x82')](_0x7ac79d[_0x7e8e('0x23')]['sort']);_0x244435['where']=qs[_0x7e8e('0x7e')](_['pick'](_0x7ac79d[_0x7e8e('0x23')],_0x3d609[_0x7e8e('0x7e')]));if(_0x7ac79d['query'][_0x7e8e('0x83')]){_0x244435['where']=_['merge'](_0x244435[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x244435[_0x7e8e('0x80')],function(_0x5075f1){var _0x27bd24={};_0x27bd24[_0x5075f1]={'$like':'%'+_0x7ac79d[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x27bd24;})});}_0x244435=_[_0x7e8e('0x38')]({},_0x244435,_0x7ac79d[_0x7e8e('0x84')]);return _0x2919f6[_0x7e8e('0x7a')](_0x244435);}})[_0x7e8e('0x19')](function(_0x4839a6){if(_0x4839a6){_0x3ebbbb=_0x4839a6['length'];if(!_0x7ac79d[_0x7e8e('0x23')]['hasOwnProperty'](_0x7e8e('0x85'))){_0x244435['limit']=qs[_0x7e8e('0x15')](_0x7ac79d[_0x7e8e('0x23')][_0x7e8e('0x15')]);_0x244435[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x7ac79d[_0x7e8e('0x23')]['offset']);}return _0x2919f6['getTags'](_0x244435);}})[_0x7e8e('0x19')](function(_0xe28a48){if(_0xe28a48){return _0xe28a48?{'count':_0x3ebbbb,'rows':_0xe28a48}:null;}})[_0x7e8e('0x19')](respondWithResult(_0x254f62,null))['catch'](handleError(_0x254f62,null));};exports[_0x7e8e('0x86')]=function(_0x41c53e,_0x58f5c4){if(_0x41c53e[_0x7e8e('0x39')]['id']){delete _0x41c53e[_0x7e8e('0x39')]['id'];}return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x41c53e[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x58f5c4,null))['then'](function(_0x2de53d){if(_0x2de53d){return _0x2de53d[_0x7e8e('0x86')](_0x41c53e[_0x7e8e('0x39')][_0x7e8e('0x87')]||[]);}return null;})[_0x7e8e('0x19')](respondWithResult(_0x58f5c4,null))['catch'](handleError(_0x58f5c4,null));};exports[_0x7e8e('0x88')]=function(_0x40b549,_0x536a2f){var _0x1533bd=[];_0x1533bd['push'](addAdditionalPhones(_0x40b549[_0x7e8e('0x39')]));Promise[_0x7e8e('0x64')](_0x1533bd)[_0x7e8e('0x19')](function(){_0x1533bd=[];_0x1533bd[_0x7e8e('0x62')](deleteCmHopperPhones(_0x40b549[_0x7e8e('0x39')]['id']));_0x1533bd[_0x7e8e('0x62')](addCmHopperPhones(_0x40b549[_0x7e8e('0x39')]['id']));Promise['all'](_0x1533bd)['then'](function(){return[0x1];})[_0x7e8e('0x19')](respondWithResult(_0x536a2f,null));});};function addAdditionalPhones(_0x2b6b30){var _0xc89528;return new Promise(function(_0x2db050){return db[_0x7e8e('0x4d')][_0x7e8e('0x1a')]({'where':{'CmContactId':_0x2b6b30['id']}})[_0x7e8e('0x19')](function(){db[_0x7e8e('0x89')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id',_0x7e8e('0x8a')]})[_0x7e8e('0x19')](function(_0x52d558){var _0x5dc8f1=[];for(var _0x17ff9b=0x0;_0x17ff9b<_0x2b6b30[_0x7e8e('0x8b')][_0x7e8e('0x2a')];_0x17ff9b++){var _0x3c2830=_0x2b6b30[_0x7e8e('0x8c')]?_[_0x7e8e('0x57')](_0x2b6b30['item_types'][_0x17ff9b])?'':_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b]:_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]?_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]:'';var _0x252538=_['isNil'](_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['description'])?'':_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8e')];var _0x2d3e7a=_0x3c2830+':'+_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['phone']+'§'+_0x252538;if(_[_0x7e8e('0x57')](_0xc89528))_0xc89528=_0x2d3e7a;else _0xc89528+=';'+_0x2d3e7a;var _0x5bb119=null;var _0x3f42fa=null;if(_0x2b6b30['item_types']){if(!_['isNil'](_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b])){_0x3f42fa=_[_0x7e8e('0x27')](_0x52d558,function(_0x535a3d){return _0x535a3d['id']===_0x2b6b30[_0x7e8e('0x8c')][_0x17ff9b];});if(!_[_0x7e8e('0x57')](_0x3f42fa)){_0x5bb119=_0x3f42fa[_0x7e8e('0x8a')];}}}else{if(!_[_0x7e8e('0x57')](_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b])){_0x3f42fa=_['find'](_0x52d558,function(_0x5e528b){return _0x5e528b['id']===_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')];});if(!_[_0x7e8e('0x57')](_0x3f42fa)){_0x5bb119=_0x17ff9b;}}}if(_[_0x7e8e('0x57')](_0x5bb119)){_0x5bb119=0x64;}_0x5dc8f1['push'](addAdditionalPhone(_0x2b6b30['id'],_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b]['phone'],_0x2b6b30[_0x7e8e('0x8c')]?_[_0x7e8e('0x57')](_0x2b6b30['item_types'][_0x17ff9b])?null:_0x2b6b30['item_types'][_0x17ff9b]:_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]?_0x2b6b30[_0x7e8e('0x8b')][_0x17ff9b][_0x7e8e('0x8d')]:null,_0x5bb119,_0x252538));}Promise[_0x7e8e('0x64')](_0x5dc8f1)[_0x7e8e('0x19')](function(){db['CmContact']['update']({'AdditionalPhones':_0xc89528},{'where':{'id':_0x2b6b30['id']}})[_0x7e8e('0x19')](function(){_0x2db050(0x1);});});});});});}function addAdditionalPhone(_0x261120,_0x1a8113,_0x3b7ec5,_0xc60f70,_0x513ada){return db[_0x7e8e('0x4d')][_0x7e8e('0x27')]({'where':{'CmContactId':_0x261120,'item':_0x1a8113}})['then'](function(_0x5397d5){if(_0x5397d5)logger['info'](_0x7e8e('0x8f'),_0x5397d5);else{db[_0x7e8e('0x4d')]['create']({'CmContactId':_0x261120,'item':_0x1a8113,'ItemTypeId':_0x3b7ec5,'OrderBy':_0xc60f70,'ItemClass':_0x7e8e('0x90'),'description':_0x513ada});}});}function deleteCmHopperPhones(_0x50cd2b){return new Promise(function(_0x11ef02){return db[_0x7e8e('0x79')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x50cd2b}})[_0x7e8e('0x19')](function(_0x1e8f26){db[_0x7e8e('0x91')][_0x7e8e('0x1a')]({'where':{'CmHopperId':{'$in':_[_0x7e8e('0x6e')](_0x1e8f26,'id')}}});})['then'](function(){_0x11ef02(0x1);});});}function addCmHopperPhones(_0x44a1c2){return new Promise(function(_0x15620f){return db[_0x7e8e('0x79')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x44a1c2}})[_0x7e8e('0x19')](function(_0x22a886){var _0x77554a=[];_[_0x7e8e('0x6e')](_0x22a886,function(_0x1d901b){_0x77554a['push'](createCmHopperPhone(_0x44a1c2,_0x1d901b['id']));});Promise[_0x7e8e('0x64')](_0x77554a)[_0x7e8e('0x19')](function(){_0x15620f(0x1);});});});}function createCmHopperPhone(_0x103dfe,_0x3ff1ab){return new Promise(function(_0x5adc3b){db[_0x7e8e('0x4d')][_0x7e8e('0x22')]({'raw':!![],'attributes':['item',_0x7e8e('0x8a')],'where':{'CmContactId':_0x103dfe,'ItemClass':_0x7e8e('0x90')},'include':[{'model':db[_0x7e8e('0x89')],'attributes':[_0x7e8e('0x8a')],'as':_0x7e8e('0x68')}],'order':[_0x7e8e('0x8a'),db['sequelize'][_0x7e8e('0x6a')](_0x7e8e('0x92'))]})['then'](function(_0x1ecf84){var _0x1b5caf=0x1;var _0x2ccf0e=_[_0x7e8e('0x6e')](_0x1ecf84,function(_0x419ded){_0x419ded[_0x7e8e('0x93')]=_0x3ff1ab;_0x419ded[_0x7e8e('0x78')]=_0x419ded[_0x7e8e('0x94')];_0x419ded[_0x7e8e('0x8a')]=_0x1b5caf;delete _0x419ded[_0x7e8e('0x95')];_0x1b5caf=_0x1b5caf+0x1;return _0x419ded;});return db[_0x7e8e('0x91')][_0x7e8e('0x5b')](_0x2ccf0e,{});})['then'](function(){_0x5adc3b(0x1);});});}function insertAdditionalPhones(_0x20fdba,_0x236c33){return new Promise(function(_0x159ca9){var _0x226c56=[];for(var _0x2e7595=0x0;_0x2e7595<_0x236c33[_0x7e8e('0x2a')];_0x2e7595++){var _0x3885da=_0x236c33[_0x2e7595];_0x226c56[_0x7e8e('0x62')](parseContactItemType(_0x3885da));}Promise['all'](_0x226c56)[_0x7e8e('0x19')](function(){var _0x423a0e={'id':_0x20fdba['id'],'items':_0x236c33};return addAdditionalPhones(_0x423a0e)[_0x7e8e('0x19')](function(){return addCmHopperPhones(_0x20fdba['id']);});})[_0x7e8e('0x19')](function(){_0x159ca9(_0x20fdba);});});}function parseContactItemType(_0x5577d1){return new Promise(function(_0x3d6975){if(_0x5577d1[_0x7e8e('0x37')](_0x7e8e('0x8d'))){_0x3d6975(_0x5577d1);}else{return db[_0x7e8e('0x89')][_0x7e8e('0x27')]({'where':{'name':_0x5577d1[_0x7e8e('0x68')]}})[_0x7e8e('0x19')](function(_0x14cf46){if(_['isNil'](_0x14cf46))_0x5577d1[_0x7e8e('0x8d')]=null;else _0x5577d1[_0x7e8e('0x8d')]=_0x14cf46['id'];_0x3d6975(_0x5577d1);});}});}exports[_0x7e8e('0x96')]=function(_0x2ca5a7,_0x52e884){return db[_0x7e8e('0x4d')][_0x7e8e('0x22')]({'raw':!![],'where':{'CmContactId':_0x2ca5a7[_0x7e8e('0x28')]['id'],'ItemClass':_0x7e8e('0x90')},'include':[{'model':db[_0x7e8e('0x89')],'as':_0x7e8e('0x68')}],'order':[[_0x7e8e('0x8a')],[db[_0x7e8e('0x69')]['literal'](_0x7e8e('0x92'))]]})[_0x7e8e('0x19')](function(_0x20ce71){return _0x20ce71;})[_0x7e8e('0x19')](respondWithResult(_0x52e884,null))[_0x7e8e('0x25')](handleError(_0x52e884,null));};exports[_0x7e8e('0x97')]=function(_0x314cb9,_0x2415fa){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x98')]}})[_0x7e8e('0x19')](function(_0x3c0dc8){var _0xf8fed1=_[_0x7e8e('0x6e')](_0x3c0dc8,function(_0xc36fc3){_0xc36fc3[_0x7e8e('0x99')]=_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x9a')];return _0xc36fc3;});return db['CmContactHasItem'][_0x7e8e('0x5b')](_0xf8fed1,{});})[_0x7e8e('0x19')](function(){return addCmHopperPhones(_0x314cb9[_0x7e8e('0x39')][_0x7e8e('0x9a')]);})[_0x7e8e('0x19')](function(){return['ok'];})[_0x7e8e('0x19')](respondWithResult(_0x2415fa,null))['catch'](handleError(_0x2415fa,null));};exports[_0x7e8e('0x9b')]=function(_0x3cc76a,_0x5e6e75){var _0x5ea0ca=[];_0x5ea0ca[_0x7e8e('0x62')](createCmHopperPhone(_0x3cc76a[_0x7e8e('0x39')]['id'],_0x3cc76a['body'][_0x7e8e('0x9c')]));Promise[_0x7e8e('0x64')](_0x5ea0ca)[_0x7e8e('0x19')](function(){return[0x1];})[_0x7e8e('0x19')](respondWithResult(_0x5e6e75,null));};exports[_0x7e8e('0x9d')]=function(_0x209985,_0x5c3dd0){var _0x2920be={'raw':![],'where':{}};var _0x883651={};var _0x173413={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x209985[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x5c3dd0,null))[_0x7e8e('0x19')](function(_0x16c194){if(_0x16c194){_0x883651['model']=_[_0x7e8e('0x5c')](db[_0x7e8e('0x79')][_0x7e8e('0x7d')]);_0x883651[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x209985[_0x7e8e('0x23')]);_0x883651[_0x7e8e('0x7e')]=_[_0x7e8e('0x7f')](_0x883651[_0x7e8e('0x7c')],_0x883651['query']);_0x2920be[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x883651[_0x7e8e('0x7c')],qs[_0x7e8e('0x81')](_0x209985[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x2920be[_0x7e8e('0x80')]=_0x2920be['attributes'][_0x7e8e('0x2a')]?_0x2920be[_0x7e8e('0x80')]:_0x883651['model'];if(!_0x209985[_0x7e8e('0x23')][_0x7e8e('0x37')]('nolimit')){_0x2920be['limit']=qs[_0x7e8e('0x15')](_0x209985['query'][_0x7e8e('0x15')]);_0x2920be['offset']=qs[_0x7e8e('0x12')](_0x209985[_0x7e8e('0x23')][_0x7e8e('0x12')]);}_0x2920be[_0x7e8e('0x9e')]=qs[_0x7e8e('0x82')](_0x209985[_0x7e8e('0x23')]['sort']);_0x2920be[_0x7e8e('0x5f')]=qs['filters'](_[_0x7e8e('0x9f')](_0x209985['query'],_0x883651['filters']));_0x2920be['where'][_0x7e8e('0xa0')]=_0x16c194['id'];if(_0x209985[_0x7e8e('0x23')]['filter']){_0x2920be[_0x7e8e('0x5f')]=_['merge'](_0x2920be['where'],{'$or':_[_0x7e8e('0x6e')](_0x2920be[_0x7e8e('0x80')],function(_0xc68b1c){var _0x4d0129={};_0x4d0129[_0xc68b1c]={'$like':'%'+_0x209985[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x4d0129;})});}_0x2920be=_[_0x7e8e('0x38')]({},_0x2920be,_0x209985['options']);return db[_0x7e8e('0x79')][_0x7e8e('0x14')]({'where':_0x2920be[_0x7e8e('0x5f')]})['then'](function(_0x40ce14){_0x173413['count']=_0x40ce14;if(_0x209985[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x2920be[_0x7e8e('0xa2')]=[{'all':!![]}];}return db[_0x7e8e('0x79')][_0x7e8e('0x22')](_0x2920be);})[_0x7e8e('0x19')](function(_0x4d1d53){_0x173413[_0x7e8e('0xa3')]=_0x4d1d53;return _0x173413;});}})['then'](respondWithFilteredResult(_0x5c3dd0,_0x2920be))['catch'](handleError(_0x5c3dd0,null));};exports[_0x7e8e('0xa4')]=function(_0x111bb9,_0x3dbea0){var _0x393eba={'raw':!![],'where':{}};var _0x1978cd={};var _0x31079f={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')]['findOne']({'where':{'id':_0x111bb9[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x3dbea0,null))[_0x7e8e('0x19')](function(_0x1cca23){if(_0x1cca23){_0x1978cd[_0x7e8e('0x7c')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x1978cd[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x111bb9[_0x7e8e('0x23')]);_0x1978cd['filters']=_['intersection'](_0x1978cd[_0x7e8e('0x7c')],_0x1978cd[_0x7e8e('0x23')]);_0x393eba[_0x7e8e('0x80')]=_[_0x7e8e('0x7f')](_0x1978cd['model'],qs[_0x7e8e('0x81')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x393eba[_0x7e8e('0x80')]=_0x393eba['attributes'][_0x7e8e('0x2a')]?_0x393eba[_0x7e8e('0x80')]:_0x1978cd[_0x7e8e('0x7c')];if(!_0x111bb9[_0x7e8e('0x23')]['hasOwnProperty']('nolimit')){_0x393eba[_0x7e8e('0x15')]=qs[_0x7e8e('0x15')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x15')]);_0x393eba[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x12')]);}_0x393eba[_0x7e8e('0x9e')]=qs[_0x7e8e('0x82')](_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x393eba[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_[_0x7e8e('0x9f')](_0x111bb9[_0x7e8e('0x23')],_0x1978cd[_0x7e8e('0x7e')]));_0x393eba[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0x1cca23['id'];if(_0x111bb9['query'][_0x7e8e('0x83')]){_0x393eba[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x393eba[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x393eba[_0x7e8e('0x80')],function(_0x38c461){var _0x19b64e={};_0x19b64e[_0x38c461]={'$like':'%'+_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x19b64e;})});}_0x393eba=_[_0x7e8e('0x38')]({},_0x393eba,_0x111bb9[_0x7e8e('0x84')]);return db[_0x7e8e('0xa5')][_0x7e8e('0x14')]({'where':_0x393eba[_0x7e8e('0x5f')]})[_0x7e8e('0x19')](function(_0x47d208){_0x31079f[_0x7e8e('0x14')]=_0x47d208;if(_0x111bb9[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x393eba['include']=[{'all':!![]}];}return db[_0x7e8e('0xa5')][_0x7e8e('0x22')](_0x393eba);})[_0x7e8e('0x19')](function(_0xa8ef9){_0x31079f[_0x7e8e('0xa3')]=_0xa8ef9;return _0x31079f;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3dbea0,_0x393eba))['catch'](handleError(_0x3dbea0,null));};exports[_0x7e8e('0xa6')]=function(_0x2ff4e6,_0x3e782d){var _0x37c6a8={'raw':!![],'where':{}};var _0x24c87b={};var _0x1871e1={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')]['findOne']({'where':{'id':_0x2ff4e6[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x19')](handleEntityNotFound(_0x3e782d,null))[_0x7e8e('0x19')](function(_0xb20294){if(_0xb20294){_0x24c87b[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0xa7')]['rawAttributes']);_0x24c87b[_0x7e8e('0x23')]=_[_0x7e8e('0x5c')](_0x2ff4e6[_0x7e8e('0x23')]);_0x24c87b[_0x7e8e('0x7e')]=_['intersection'](_0x24c87b[_0x7e8e('0x7c')],_0x24c87b['query']);_0x37c6a8['attributes']=_[_0x7e8e('0x7f')](_0x24c87b['model'],qs[_0x7e8e('0x81')](_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x81')]));_0x37c6a8[_0x7e8e('0x80')]=_0x37c6a8[_0x7e8e('0x80')][_0x7e8e('0x2a')]?_0x37c6a8[_0x7e8e('0x80')]:_0x24c87b['model'];if(!_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x37')](_0x7e8e('0x85'))){_0x37c6a8['limit']=qs[_0x7e8e('0x15')](_0x2ff4e6[_0x7e8e('0x23')]['limit']);_0x37c6a8[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x2ff4e6[_0x7e8e('0x23')]['offset']);}_0x37c6a8['order']=qs['sort'](_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x37c6a8[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_['pick'](_0x2ff4e6[_0x7e8e('0x23')],_0x24c87b[_0x7e8e('0x7e')]));_0x37c6a8[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0xb20294['id'];if(_0x2ff4e6['query'][_0x7e8e('0x83')]){_0x37c6a8[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x37c6a8['where'],{'$or':_[_0x7e8e('0x6e')](_0x37c6a8[_0x7e8e('0x80')],function(_0x3e473e){var _0x256b2b={};_0x256b2b[_0x3e473e]={'$like':'%'+_0x2ff4e6[_0x7e8e('0x23')]['filter']+'%'};return _0x256b2b;})});}_0x37c6a8=_[_0x7e8e('0x38')]({},_0x37c6a8,_0x2ff4e6['options']);return db[_0x7e8e('0xa7')]['count']({'where':_0x37c6a8[_0x7e8e('0x5f')]})['then'](function(_0x480c01){_0x1871e1['count']=_0x480c01;if(_0x2ff4e6[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x37c6a8[_0x7e8e('0xa2')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7e8e('0x22')](_0x37c6a8);})['then'](function(_0x34392a){_0x1871e1[_0x7e8e('0xa3')]=_0x34392a;return _0x1871e1;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3e782d,_0x37c6a8))[_0x7e8e('0x25')](handleError(_0x3e782d,null));};exports['getJscriptySessions']=function(_0x33a703,_0x32618f){var _0x177412={'raw':!![],'where':{}};var _0x1c6fe0={};var _0x3f865d={'count':0x0,'rows':[]};return db[_0x7e8e('0x26')][_0x7e8e('0x7b')]({'where':{'id':_0x33a703['params']['id']}})['then'](handleEntityNotFound(_0x32618f,null))['then'](function(_0xb06475){if(_0xb06475){_0x1c6fe0[_0x7e8e('0x7c')]=_[_0x7e8e('0x5c')](db[_0x7e8e('0x53')][_0x7e8e('0x7d')]);_0x1c6fe0['query']=_[_0x7e8e('0x5c')](_0x33a703['query']);_0x1c6fe0['filters']=_['intersection'](_0x1c6fe0[_0x7e8e('0x7c')],_0x1c6fe0[_0x7e8e('0x23')]);_0x177412['attributes']=_['intersection'](_0x1c6fe0['model'],qs[_0x7e8e('0x81')](_0x33a703[_0x7e8e('0x23')]['fields']));_0x177412[_0x7e8e('0x80')]=_0x177412['attributes']['length']?_0x177412[_0x7e8e('0x80')]:_0x1c6fe0[_0x7e8e('0x7c')];if(!_0x33a703[_0x7e8e('0x23')]['hasOwnProperty'](_0x7e8e('0x85'))){_0x177412[_0x7e8e('0x15')]=qs['limit'](_0x33a703['query'][_0x7e8e('0x15')]);_0x177412[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x33a703['query']['offset']);}_0x177412[_0x7e8e('0x9e')]=qs['sort'](_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x82')]);_0x177412[_0x7e8e('0x5f')]=qs[_0x7e8e('0x7e')](_[_0x7e8e('0x9f')](_0x33a703[_0x7e8e('0x23')],_0x1c6fe0['filters']));_0x177412[_0x7e8e('0x5f')][_0x7e8e('0xa0')]=_0xb06475['id'];if(_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x83')]){_0x177412[_0x7e8e('0x5f')]=_[_0x7e8e('0x38')](_0x177412[_0x7e8e('0x5f')],{'$or':_[_0x7e8e('0x6e')](_0x177412[_0x7e8e('0x80')],function(_0x57fcdf){var _0x43a3f7={};_0x43a3f7[_0x57fcdf]={'$like':'%'+_0x33a703[_0x7e8e('0x23')][_0x7e8e('0x83')]+'%'};return _0x43a3f7;})});}_0x177412=_[_0x7e8e('0x38')]({},_0x177412,_0x33a703[_0x7e8e('0x84')]);return db[_0x7e8e('0x53')]['count']({'where':_0x177412[_0x7e8e('0x5f')]})['then'](function(_0x261324){_0x3f865d[_0x7e8e('0x14')]=_0x261324;if(_0x33a703[_0x7e8e('0x23')][_0x7e8e('0xa1')]){_0x177412['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x7e8e('0x22')](_0x177412);})[_0x7e8e('0x19')](function(_0xdd9b46){_0x3f865d[_0x7e8e('0xa3')]=_0xdd9b46;return _0x3f865d;});}})[_0x7e8e('0x19')](respondWithFilteredResult(_0x32618f,_0x177412))[_0x7e8e('0x25')](handleError(_0x32618f,null));};exports[_0x7e8e('0xa8')]=function(_0x12548f,_0x39e63f){try{if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x60')]){throw new Error(_0x7e8e('0xa9'));}if(!_0x12548f[_0x7e8e('0x39')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')]){throw new Error(_0x7e8e('0xab'));}if(!_0x12548f['body'][_0x7e8e('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x575b89=_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xad')]['split'](',');var _0x1d3e27=_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')]['split'](',');if(!_0x575b89[_0x7e8e('0x2a')]||!_0x1d3e27['length']||_0x575b89['length']!==_0x1d3e27['length']){throw new Error(_0x7e8e('0xae'));}_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x81')]=_['zipObject'](_0x575b89,_0x1d3e27);if(!_0x12548f['body'][_0x7e8e('0x81')][_0x7e8e('0x78')]){throw new Error(_0x7e8e('0xaf'));}if(!_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x81')][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}var _0x1c5e5a=path['join'](config[_0x7e8e('0xb2')],_0x7e8e('0xb3'),_0x12548f['file'][_0x7e8e('0xb4')]);fs[_0x7e8e('0xb5')](_0x1c5e5a,parseInt('0777',0x8));var _0x21bd0e=require(_0x7e8e('0xb6'))['fork'](path[_0x7e8e('0x3d')](__dirname,'../../components/import/cm/csv'),[_0x1c5e5a,_0x12548f['body'][_0x7e8e('0xad')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xaa')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x60')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xb7')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0x5d')],_0x12548f[_0x7e8e('0x39')][_0x7e8e('0xac')]]);return _0x39e63f[_0x7e8e('0x10')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x21bd0e[_0x7e8e('0xb8')]});}catch(_0x2d21fd){return _0x39e63f['status'](0x1f4)[_0x7e8e('0xb9')](_0x2d21fd);}};exports[_0x7e8e('0xba')]=function(_0x856a52,_0x287ec8){var _0x525183=fs['createReadStream'](_0x856a52[_0x7e8e('0xbb')][_0x7e8e('0x2')]);Papa[_0x7e8e('0xbc')](_0x525183,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2897ad){return _0x287ec8[_0x7e8e('0x10')](0xc8)[_0x7e8e('0x11')]({'file':_0x856a52['file'],'fields':_0x2897ad['meta'][_0x7e8e('0x81')]});}});};exports[_0x7e8e('0xbd')]=function(_0xdb9cc9,_0x6a0895){return db['User'][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e8e('0xbe')}})[_0x7e8e('0x19')](function(_0x171177){var _0x22ebab=![];if(!_0xdb9cc9['body'][_0x7e8e('0x60')]){throw new Error(_0x7e8e('0xa9'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xbf')]['phone']){throw new Error(_0x7e8e('0xaf'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xbf')][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}if(!_0xdb9cc9[_0x7e8e('0x39')][_0x7e8e('0xac')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x3dc55b=require(_0x7e8e('0xb6'))[_0x7e8e('0xc0')](path['join'](__dirname,_0x7e8e('0xc1')),[_0xdb9cc9[_0x7e8e('0x28')]['id'],JSON[_0x7e8e('0xc2')](_0xdb9cc9[_0x7e8e('0x39')]),JSON[_0x7e8e('0xc2')](_0x171177)]);_0x3dc55b['on']('message',function(){_0x22ebab=!![];return _0x6a0895[_0x7e8e('0x10')](0xc8)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc3'),'pid':_0x3dc55b['pid']});});_0x3dc55b['on']('exit',function(_0x133813){if(_0x133813&&!_0x22ebab){return _0x6a0895[_0x7e8e('0x10')](0x1f4)['json']({'message':_0x7e8e('0xc4'),'pid':_0x3dc55b[_0x7e8e('0xb8')]});}});})['catch'](handleError(_0x6a0895,null));};exports[_0x7e8e('0xc5')]=function(_0x43974b,_0x326c1d){return db[_0x7e8e('0xc6')][_0x7e8e('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7e8e('0xbe')}})[_0x7e8e('0x19')](function(_0x5d6efb){var _0x340142=![];if(!_0x43974b['body'][_0x7e8e('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x43974b[_0x7e8e('0x39')][_0x7e8e('0xbf')][_0x7e8e('0x78')]){throw new Error(_0x7e8e('0xaf'));}if(!_0x43974b[_0x7e8e('0x39')]['binding'][_0x7e8e('0xb0')]){throw new Error(_0x7e8e('0xb1'));}if(!_0x43974b[_0x7e8e('0x39')][_0x7e8e('0xac')]){throw new Error(_0x7e8e('0xc7'));}var _0x2cfda8=require('child_process')[_0x7e8e('0xc0')](path[_0x7e8e('0x3d')](__dirname,_0x7e8e('0xc8')),[_0x43974b[_0x7e8e('0x28')]['id'],JSON[_0x7e8e('0xc2')](_0x43974b[_0x7e8e('0x39')]),JSON[_0x7e8e('0xc2')](_0x5d6efb)]);_0x2cfda8['on'](_0x7e8e('0xc9'),function(){_0x340142=!![];return _0x326c1d['status'](0xc8)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc3'),'pid':_0x2cfda8['pid']});});_0x2cfda8['on'](_0x7e8e('0xca'),function(_0x96f858){if(_0x96f858&&!_0x340142){return _0x326c1d[_0x7e8e('0x10')](0x1f4)[_0x7e8e('0x11')]({'message':_0x7e8e('0xc4'),'pid':_0x2cfda8[_0x7e8e('0xb8')]});}});})['catch'](handleError(_0x326c1d,null));};exports['getJourney']=function(_0x1958e1,_0x3f3fc0){var _0x2b915a=[_0x7e8e('0xcb'),_0x7e8e('0xcc'),_0x7e8e('0xcd'),'openchannel','fax','whatsapp',_0x7e8e('0xce')];var _0x1a1c0d={'offset':0x0,'order':qs[_0x7e8e('0x82')](_0x7e8e('0xcf'))},_0x9c6fef={'count':0x0,'rows':[]};Promise['resolve']()[_0x7e8e('0x19')](function(){if(_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd0')]){if(!_[_0x7e8e('0xd1')](_0x2b915a,_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd0')][_0x7e8e('0xd2')]())){throw new Error(_0x7e8e('0xd3'));}_0x2b915a=[_0x1958e1['query'][_0x7e8e('0xd0')]['toLowerCase']()];}if(_0x1958e1['query'][_0x7e8e('0xd4')]){try{var _0x382706=JSON[_0x7e8e('0xbc')](_0x1958e1[_0x7e8e('0x23')]['range']);if(!moment(_0x382706[_0x7e8e('0x3e')])[_0x7e8e('0xd5')]()){throw new Error(_0x7e8e('0xd6'));}if(!moment(_0x382706['to'])[_0x7e8e('0xd5')]()){throw new Error(_0x7e8e('0xd7'));}}catch(_0x5cfbd8){throw new Error(_0x7e8e('0xd8'));}}if(!_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0x37')](_0x7e8e('0x85'))){_0x1a1c0d['limit']=qs[_0x7e8e('0x15')](_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0x15')]||0xa);_0x1a1c0d[_0x7e8e('0x12')]=qs[_0x7e8e('0x12')](_0x1958e1[_0x7e8e('0x23')]['offset']);}var _0xe54ceb=_0x2b915a[_0x7e8e('0x6e')](function(_0x4e10b3){if(_0x4e10b3===_0x7e8e('0xce')){var _0x6b6a71={'attributes':['id',_0x7e8e('0xd9'),_0x7e8e('0x32'),_0x7e8e('0xda'),_0x7e8e('0xdb'),_0x7e8e('0xdc'),_0x7e8e('0xdd'),_0x7e8e('0xde'),_0x7e8e('0xdf'),_0x7e8e('0xe0'),_0x7e8e('0xe1'),'userDisposition',_0x7e8e('0xe2'),_0x7e8e('0xe3'),_0x7e8e('0xe4')],'where':{'ContactId':_0x1958e1[_0x7e8e('0x28')]['id']},'include':[{'model':db[_0x7e8e('0xc6')],'as':_0x7e8e('0xc6'),'attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xe5'),_0x7e8e('0xe6')]}],'order':[[_0x7e8e('0xe1'),_0x7e8e('0xe7')]]};if(_0x1958e1[_0x7e8e('0x23')]['range']){_0x6b6a71[_0x7e8e('0x5f')][_0x7e8e('0xe1')]={'$gte':_0x382706['from'],'$lte':_0x382706['to']};}return db[_0x7e8e('0x4f')][_0x7e8e('0xe8')](_0x6b6a71)[_0x7e8e('0x19')](function(_0x125d84){_0x9c6fef[_0x7e8e('0x14')]+=_0x125d84[_0x7e8e('0x14')];return _[_0x7e8e('0x6e')](_0x125d84[_0x7e8e('0xa3')],function(_0x1984f8){var _0x49d3d7=_0x1984f8['get']({'plain':!![]});_0x49d3d7[_0x7e8e('0xd0')]=_0x4e10b3;if(_0x49d3d7[_0x7e8e('0xc6')]){_0x49d3d7[_0x7e8e('0xc6')]={'id':_0x49d3d7[_0x7e8e('0xc6')]['id'],'name':_0x49d3d7['User'][_0x7e8e('0x1f')],'fullname':_0x49d3d7[_0x7e8e('0xc6')][_0x7e8e('0xe5')],'alias':_0x49d3d7[_0x7e8e('0xc6')][_0x7e8e('0xe6')]};}return _0x49d3d7;});});}else{var _0x28e071=_[_0x7e8e('0xe9')](_0x4e10b3)+(_0x4e10b3==='chat'?_0x7e8e('0xea'):_0x7e8e('0xeb'));var _0x59e98d={'attributes':['id',_0x7e8e('0xec'),'closedAt',_0x7e8e('0xe1'),'note','disposition','secondDisposition',_0x7e8e('0xed'),'UserId',_0x28e071+'Id'],'where':{'ContactId':_0x1958e1[_0x7e8e('0x28')]['id']},'include':[{'model':db[_0x28e071],'as':'Account','attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xee')]},{'model':db['User'],'as':_0x7e8e('0xef'),'attributes':['id',_0x7e8e('0x1f'),'fullname']},{'model':db[_0x7e8e('0x66')],'as':_0x7e8e('0xf0'),'attributes':['id',_0x7e8e('0x1f'),_0x7e8e('0xf1')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x1958e1[_0x7e8e('0x23')][_0x7e8e('0xd4')]){_0x59e98d[_0x7e8e('0x5f')][_0x7e8e('0xe1')]={'$gte':_0x382706['from'],'$lte':_0x382706['to']};}switch(_0x4e10b3){case _0x7e8e('0xcc'):_0x59e98d['attributes'][_0x7e8e('0x62')](_0x7e8e('0xf2'),_0x7e8e('0xf3'),_0x7e8e('0xf4'),_0x7e8e('0xf5'),_0x7e8e('0xf6'),_0x7e8e('0xf7'),'ratingType',_0x7e8e('0xf8'),_0x7e8e('0xf9'));break;case _0x7e8e('0xcb'):_0x59e98d[_0x7e8e('0x80')]['push'](_0x7e8e('0xfa'),'substatus');break;case _0x7e8e('0xfb'):_0x59e98d[_0x7e8e('0x80')][_0x7e8e('0x62')](_0x7e8e('0xfc'),'threadId');break;}return db[_['startCase'](_0x4e10b3)+'Interaction'][_0x7e8e('0xe8')](_0x59e98d)['then'](function(_0x4f984b){_0x9c6fef[_0x7e8e('0x14')]+=_0x4f984b[_0x7e8e('0x14')];return _[_0x7e8e('0x6e')](_0x4f984b['rows'],function(_0x3fbaa6){var _0x1d17cb=_0x3fbaa6[_0x7e8e('0x3a')]({'plain':!![]});_0x1d17cb[_0x7e8e('0xd0')]=_0x4e10b3;if(_0x1d17cb['Owner']){_0x1d17cb[_0x7e8e('0xef')]={'id':_0x1d17cb[_0x7e8e('0xef')]['id'],'name':_0x1d17cb[_0x7e8e('0xef')][_0x7e8e('0x1f')],'fullname':_0x1d17cb[_0x7e8e('0xef')][_0x7e8e('0xe5')]};}return _0x1d17cb;});});}});return Promise['all'](_0xe54ceb);})[_0x7e8e('0x19')](function(_0x2876ce){return _(_0x2876ce)[_0x7e8e('0xfd')]()[_0x7e8e('0xfe')]('createdAt')[_0x7e8e('0xff')]()[_0x7e8e('0x100')]();})['then'](function(_0xe1244c){_0x9c6fef[_0x7e8e('0xa3')]=_0x1a1c0d[_0x7e8e('0x15')]?_0xe1244c[_0x7e8e('0x101')](_0x1a1c0d['offset'],_0x1a1c0d['offset']+_0x1a1c0d['limit']):_0xe1244c;return _0x9c6fef;})[_0x7e8e('0x19')](respondWithFilteredResult(_0x3f3fc0,_0x1a1c0d))[_0x7e8e('0x25')](handleError(_0x3f3fc0,null));}; \ No newline at end of file +var _0x9d5c=['intersection','nolimit','order','filter','include','getHopperHistories','rows','getHopperFinals','CmHopperFinal','ContactId','getJscriptySessions','JscriptySessionReport','includeAll','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','includes','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','type','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Account','closed','thirdDisposition','color','browserName','customerIp','customerPort','ratingType','ratingValue','referer','subject','substatus','threadId','Interaction','Owner','flatten','reverse','value','slice','moment','bluebird','util','lodash','squel','papaparse','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','offset','undefined','count','Content-Range','json','update','then','end','sendStatus','error','name','send','index','describe','getOptions','findAll','query','user','catch','destroy','CmContact','find','params','tags','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','alias','custom','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','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','ListId','findOrCreate','spread','contact','all','Tags','Phones','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','map','where','pickBy','cf_','cm_contacts','id\x20=\x20?','toParam','text','phone','Tag','rawAttributes','filters','model','attributes','fields','sort','pick','options','getTags','limit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','literal','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','findOne'];(function(_0x55e0b0,_0x34f747){var _0x116a94=function(_0x311ad3){while(--_0x311ad3){_0x55e0b0['push'](_0x55e0b0['shift']());}};_0x116a94(++_0x34f747);}(_0x9d5c,0x6b));var _0xc9d5=function(_0x46dd70,_0x218cec){_0x46dd70=_0x46dd70-0x0;var _0x5a4535=_0x9d5c[_0x46dd70];return _0x5a4535;};'use strict';var moment=require(_0xc9d5('0x0'));var BPromise=require(_0xc9d5('0x1'));var util=require(_0xc9d5('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xc9d5('0x3'));var squel=require(_0xc9d5('0x4'));var Papa=require(_0xc9d5('0x5'));var Redis=require('ioredis');var contacts=require(_0xc9d5('0x6'));var qs=require(_0xc9d5('0x7'));var logger=require(_0xc9d5('0x8'))(_0xc9d5('0x9'));var config=require(_0xc9d5('0xa'));var shared=require(_0xc9d5('0xb'));var db=require('../../mysqldb')['db'];config[_0xc9d5('0xc')]=_[_0xc9d5('0xd')](config['redis'],{'host':_0xc9d5('0xe'),'port':0x18eb});var socket=require(_0xc9d5('0xf'))(new Redis(config['redis']));require(_0xc9d5('0x10'))['register'](socket);function respondWithResult(_0x46f5cb,_0x3ed182){_0x3ed182=_0x3ed182||0xc8;return function(_0x3217e5){if(_0x3217e5){return _0x46f5cb[_0xc9d5('0x11')](_0x3ed182)['json'](_0x3217e5);}};}function respondWithFilteredResult(_0x1b1e6e,_0x397872){return function(_0x1e019b){if(_0x1e019b){var _0x6674=typeof _0x397872[_0xc9d5('0x12')]===_0xc9d5('0x13')&&typeof _0x397872['limit']===_0xc9d5('0x13');var _0x20fd7c=_0x1e019b[_0xc9d5('0x14')];var _0x58671e=_0x6674?0x0:_0x397872[_0xc9d5('0x12')];var _0x42d335=_0x6674?_0x1e019b[_0xc9d5('0x14')]:_0x397872[_0xc9d5('0x12')]+_0x397872['limit'];var _0xfca510;if(_0x42d335>=_0x20fd7c){_0x42d335=_0x20fd7c;_0xfca510=0xc8;}else{_0xfca510=0xce;}_0x1b1e6e[_0xc9d5('0x11')](_0xfca510);return _0x1b1e6e['set'](_0xc9d5('0x15'),_0x58671e+'-'+_0x42d335+'/'+_0x20fd7c)[_0xc9d5('0x16')](_0x1e019b);}return null;};}function saveUpdates(_0x59cf61){return function(_0x21c90c){if(_0x21c90c){return _0x21c90c[_0xc9d5('0x17')](_0x59cf61)[_0xc9d5('0x18')](function(_0xf42c6d){return _0xf42c6d;});}return null;};}function removeEntity(_0x566c91){return function(_0x8e5acb){if(_0x8e5acb){return _0x8e5acb['destroy']()[_0xc9d5('0x18')](function(){_0x566c91[_0xc9d5('0x11')](0xcc)[_0xc9d5('0x19')]();});}};}function handleEntityNotFound(_0x2526bb){return function(_0x5cad9a){if(!_0x5cad9a){_0x2526bb[_0xc9d5('0x1a')](0x194);}return _0x5cad9a;};}function handleError(_0x24a0a7,_0x17e256){_0x17e256=_0x17e256||0x1f4;return function(_0x541264){logger[_0xc9d5('0x1b')](_0x541264['stack']);if(_0x541264[_0xc9d5('0x1c')]){delete _0x541264[_0xc9d5('0x1c')];}_0x24a0a7['status'](_0x17e256)[_0xc9d5('0x1d')](_0x541264);};}exports[_0xc9d5('0x1e')]=function(_0x8c3266,_0x37f162){var _0x30a0ea={};return contacts[_0xc9d5('0x1f')]()[_0xc9d5('0x18')](function(_0x48fa77){_0x30a0ea=qs[_0xc9d5('0x20')](_0x48fa77,_0x8c3266);return contacts[_0xc9d5('0x21')](_0x8c3266[_0xc9d5('0x22')],_0x8c3266[_0xc9d5('0x23')],_0x30a0ea,_0x48fa77);})[_0xc9d5('0x18')](respondWithFilteredResult(_0x37f162,_0x30a0ea))[_0xc9d5('0x24')](handleError(_0x37f162,null));};exports[_0xc9d5('0x25')]=function(_0x47cba9,_0x20099c){return db[_0xc9d5('0x26')][_0xc9d5('0x27')]({'where':{'id':_0x47cba9[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x20099c,null))['then'](removeEntity(_0x20099c,null))[_0xc9d5('0x24')](handleError(_0x20099c,null));};exports[_0xc9d5('0x1f')]=function(_0x55b0d7,_0x2b9d3d){return db[_0xc9d5('0x26')][_0xc9d5('0x1f')]()['then'](function(_0x37c4b3){delete _0x37c4b3[_0xc9d5('0x29')];for(var _0x2428e6=0x0;_0x2428e60x0){return new Promise(function(_0x159a70){var _0x1d58dd=[];for(var _0x3c4aa9=0x0;_0x3c4aa9<_0xce09ea[_0xc9d5('0x2b')];_0x3c4aa9++){_0x1d58dd[_0xc9d5('0x60')](insertAdditionalPhones(_0xce09ea[_0x3c4aa9][_0xc9d5('0x64')],_0xce09ea[_0x3c4aa9][_0xc9d5('0x5b')]));}Promise[_0xc9d5('0x65')](_0x1d58dd)[_0xc9d5('0x18')](function(){_0x159a70(0x1);});})[_0xc9d5('0x18')](function(){return{'success':_0x30a81c,'failure':_0x3237c4,'duplicates':_0x426fb0};});}else{return{'success':_0x30a81c,'failure':_0x3237c4,'duplicates':_0x426fb0};}}})[_0xc9d5('0x18')](respondWithResult(_0x2b6ed3,0xc9))['catch'](handleError(_0x2b6ed3,null));};exports['show']=function(_0x16746c,_0x3c3127){var _0x171ed2;return db[_0xc9d5('0x26')]['describe']()[_0xc9d5('0x18')](function(_0x578df8){return db[_0xc9d5('0x26')][_0xc9d5('0x27')]({'where':{'id':_0x16746c['params']['id']},'include':[{'model':db['Tag'],'as':_0xc9d5('0x66'),'attributes':['id',_0xc9d5('0x1c'),'color'],'required':_0x16746c[_0xc9d5('0x22')]['tag']?!![]:![]},{'model':db[_0xc9d5('0x4e')],'as':_0xc9d5('0x67'),'where':{'CmContactId':_0x16746c[_0xc9d5('0x28')]['id']},'required':![],'include':[{'model':db[_0xc9d5('0x68')],'as':_0xc9d5('0x69')}]}],'order':[db[_0xc9d5('0x6a')]['literal'](_0xc9d5('0x6b'))],'attributes':_[_0xc9d5('0x2a')](_0x578df8)});})[_0xc9d5('0x18')](function(_0x28ce87){if(!_[_0xc9d5('0x57')](_0x28ce87)){_0x171ed2=_0x28ce87[_0xc9d5('0x3a')]({'plain':!![]});var _0x57e29e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x28ce87&&_0x28ce87['ListId']){if(_0x28ce87['ListId']){_0x57e29e['where'][_0xc9d5('0x6c')]['push']({'ListId':{'$ne':_0x28ce87['ListId']}});}}return db['CmCustomField'][_0xc9d5('0x21')](_0x57e29e);}})[_0xc9d5('0x18')](function(_0xeeda3d){if(!_['isNil'](_0xeeda3d)){return _[_0xc9d5('0x6d')](_0x171ed2,_[_0xc9d5('0x6e')](_0xeeda3d,function(_0xabcff3){return util['format']('cf_%d',_0xabcff3['id']);}));}})['then'](handleEntityNotFound(_0x3c3127,null))['then'](respondWithResult(_0x3c3127,null))[_0xc9d5('0x24')](handleError(_0x3c3127,null));};exports[_0xc9d5('0x17')]=function(_0x88b9c2,_0xe5df96){var _0x5d0f97;if(_0x88b9c2['body']['id']){delete _0x88b9c2['body']['id'];}if(!_[_0xc9d5('0x57')](_0x88b9c2[_0xc9d5('0x39')][_0xc9d5('0x58')])){var _0x48b8f3=_0x88b9c2[_0xc9d5('0x39')]['dialTimezone'];if(!_[_0xc9d5('0x57')](shared[_0xc9d5('0x59')][_0x48b8f3]))_0x88b9c2[_0xc9d5('0x39')][_0xc9d5('0x5a')]=shared[_0xc9d5('0x59')][_0x48b8f3]['utcOffset'];}return db[_0xc9d5('0x26')][_0xc9d5('0x27')]({'where':{'id':_0x88b9c2[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0xe5df96,null))[_0xc9d5('0x18')](saveUpdates(_0x88b9c2[_0xc9d5('0x39')],null))[_0xc9d5('0x18')](function(_0x5979e0){_0x5d0f97=_0x5979e0;var _0x530562={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5979e0&&_0x5979e0[_0xc9d5('0x61')]){if(_0x5979e0[_0xc9d5('0x61')]){_0x530562[_0xc9d5('0x6f')][_0xc9d5('0x6c')][_0xc9d5('0x60')]({'ListId':{'$ne':_0x5979e0[_0xc9d5('0x61')]}});}}return db['CmCustomField'][_0xc9d5('0x21')](_0x530562);})['then'](function(_0x68a4df){if(_0x68a4df){return _[_0xc9d5('0x6d')](_[_0xc9d5('0x70')](_0x88b9c2['body'],function(_0x2d609d,_0x3c3c6f){return _[_0xc9d5('0x2c')](_0x3c3c6f,_0xc9d5('0x71'));}),_[_0xc9d5('0x6e')](_0x68a4df,function(_0x4e4422){return util['format']('cf_%d',_0x4e4422['id']);}));}})[_0xc9d5('0x18')](function(_0x3e9a25){if(_0x3e9a25&&!_['isEmpty'](_0x3e9a25)){var _0x37c9ed=squel[_0xc9d5('0x17')]()['table'](_0xc9d5('0x72'))['setFields'](_0x3e9a25)[_0xc9d5('0x6f')](_0xc9d5('0x73'),_0x88b9c2['params']['id'])[_0xc9d5('0x74')]();return db['sequelize']['query'](_0x37c9ed[_0xc9d5('0x75')],{'replacements':_0x37c9ed[_0xc9d5('0x33')]});}})[_0xc9d5('0x18')](function(){if(_0x88b9c2[_0xc9d5('0x39')][_0xc9d5('0x76')]&&_0x5d0f97){return db[_0xc9d5('0x3e')][_0xc9d5('0x17')]({'phone':_0x88b9c2['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x5d0f97['id']}});}})[_0xc9d5('0x18')](function(){return _0x5d0f97;})[_0xc9d5('0x18')](respondWithResult(_0xe5df96,null))[_0xc9d5('0x24')](handleError(_0xe5df96,null));};exports['getTags']=function(_0x24295e,_0x2dabec){var _0x1c4254={};var _0xb314f5={};var _0x520f7d;var _0x6a0d5c;return db['CmContact']['findOne']({'where':{'id':_0x24295e['params']['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x2dabec,null))['then'](function(_0x5e87df){if(_0x5e87df){_0x520f7d=_0x5e87df;_0xb314f5['model']=_['keys'](db[_0xc9d5('0x77')][_0xc9d5('0x78')]);_0xb314f5[_0xc9d5('0x22')]=_[_0xc9d5('0x2a')](_0x24295e['query']);_0xb314f5[_0xc9d5('0x79')]=_['intersection'](_0xb314f5[_0xc9d5('0x7a')],_0xb314f5[_0xc9d5('0x22')]);_0x1c4254[_0xc9d5('0x7b')]=_['intersection'](_0xb314f5[_0xc9d5('0x7a')],qs['fields'](_0x24295e[_0xc9d5('0x22')][_0xc9d5('0x7c')]));_0x1c4254[_0xc9d5('0x7b')]=_0x1c4254[_0xc9d5('0x7b')][_0xc9d5('0x2b')]?_0x1c4254[_0xc9d5('0x7b')]:_0xb314f5['model'];_0x1c4254['order']=qs[_0xc9d5('0x7d')](_0x24295e[_0xc9d5('0x22')][_0xc9d5('0x7d')]);_0x1c4254[_0xc9d5('0x6f')]=qs[_0xc9d5('0x79')](_[_0xc9d5('0x7e')](_0x24295e[_0xc9d5('0x22')],_0xb314f5[_0xc9d5('0x79')]));if(_0x24295e[_0xc9d5('0x22')]['filter']){_0x1c4254[_0xc9d5('0x6f')]=_['merge'](_0x1c4254['where'],{'$or':_[_0xc9d5('0x6e')](_0x1c4254[_0xc9d5('0x7b')],function(_0x5ef4df){var _0x3be0dc={};_0x3be0dc[_0x5ef4df]={'$like':'%'+_0x24295e[_0xc9d5('0x22')]['filter']+'%'};return _0x3be0dc;})});}_0x1c4254=_['merge']({},_0x1c4254,_0x24295e[_0xc9d5('0x7f')]);return _0x520f7d[_0xc9d5('0x80')](_0x1c4254);}})[_0xc9d5('0x18')](function(_0x34bef9){if(_0x34bef9){_0x6a0d5c=_0x34bef9[_0xc9d5('0x2b')];if(!_0x24295e[_0xc9d5('0x22')][_0xc9d5('0x37')]('nolimit')){_0x1c4254[_0xc9d5('0x81')]=qs[_0xc9d5('0x81')](_0x24295e['query'][_0xc9d5('0x81')]);_0x1c4254['offset']=qs['offset'](_0x24295e[_0xc9d5('0x22')][_0xc9d5('0x12')]);}return _0x520f7d[_0xc9d5('0x80')](_0x1c4254);}})[_0xc9d5('0x18')](function(_0x380164){if(_0x380164){return _0x380164?{'count':_0x6a0d5c,'rows':_0x380164}:null;}})[_0xc9d5('0x18')](respondWithResult(_0x2dabec,null))[_0xc9d5('0x24')](handleError(_0x2dabec,null));};exports['setTags']=function(_0x675278,_0x171c03){if(_0x675278[_0xc9d5('0x39')]['id']){delete _0x675278[_0xc9d5('0x39')]['id'];}return db[_0xc9d5('0x26')]['findOne']({'where':{'id':_0x675278[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x171c03,null))[_0xc9d5('0x18')](function(_0x55ce70){if(_0x55ce70){return _0x55ce70[_0xc9d5('0x82')](_0x675278[_0xc9d5('0x39')][_0xc9d5('0x83')]||[]);}return null;})[_0xc9d5('0x18')](respondWithResult(_0x171c03,null))['catch'](handleError(_0x171c03,null));};exports[_0xc9d5('0x84')]=function(_0x5ec762,_0x3821af){var _0x4f8d9d=[];_0x4f8d9d[_0xc9d5('0x60')](addAdditionalPhones(_0x5ec762['body']));Promise['all'](_0x4f8d9d)[_0xc9d5('0x18')](function(){_0x4f8d9d=[];_0x4f8d9d[_0xc9d5('0x60')](deleteCmHopperPhones(_0x5ec762[_0xc9d5('0x39')]['id']));_0x4f8d9d[_0xc9d5('0x60')](addCmHopperPhones(_0x5ec762[_0xc9d5('0x39')]['id']));Promise['all'](_0x4f8d9d)[_0xc9d5('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x3821af,null));});};function addAdditionalPhones(_0x370a5c){var _0x25af83;return new Promise(function(_0x15bdf9){return db[_0xc9d5('0x4e')][_0xc9d5('0x25')]({'where':{'CmContactId':_0x370a5c['id']}})['then'](function(){db[_0xc9d5('0x68')][_0xc9d5('0x21')]({'raw':!![],'attributes':['id',_0xc9d5('0x85')]})[_0xc9d5('0x18')](function(_0x3ed347){var _0x2786f1=[];for(var _0xa7f4a8=0x0;_0xa7f4a8<_0x370a5c[_0xc9d5('0x86')][_0xc9d5('0x2b')];_0xa7f4a8++){var _0x38256e=_0x370a5c[_0xc9d5('0x87')]?_[_0xc9d5('0x57')](_0x370a5c[_0xc9d5('0x87')][_0xa7f4a8])?'':_0x370a5c[_0xc9d5('0x87')][_0xa7f4a8]:_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8]['ItemTypeId']?_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8][_0xc9d5('0x88')]:'';var _0x546c71=_['isNil'](_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8][_0xc9d5('0x89')])?'':_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8][_0xc9d5('0x89')];var _0x2bd772=_0x38256e+':'+_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8]['phone']+'§'+_0x546c71;if(_['isNil'](_0x25af83))_0x25af83=_0x2bd772;else _0x25af83+=';'+_0x2bd772;var _0x23f0a3=null;var _0x49e98d=null;if(_0x370a5c[_0xc9d5('0x87')]){if(!_[_0xc9d5('0x57')](_0x370a5c[_0xc9d5('0x87')][_0xa7f4a8])){_0x49e98d=_['find'](_0x3ed347,function(_0x217d20){return _0x217d20['id']===_0x370a5c[_0xc9d5('0x87')][_0xa7f4a8];});if(!_[_0xc9d5('0x57')](_0x49e98d)){_0x23f0a3=_0x49e98d[_0xc9d5('0x85')];}}}else{if(!_[_0xc9d5('0x57')](_0x370a5c['items'][_0xa7f4a8])){_0x49e98d=_[_0xc9d5('0x27')](_0x3ed347,function(_0x15b06c){return _0x15b06c['id']===_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8][_0xc9d5('0x88')];});if(!_[_0xc9d5('0x57')](_0x49e98d)){_0x23f0a3=_0xa7f4a8;}}}if(_[_0xc9d5('0x57')](_0x23f0a3)){_0x23f0a3=0x64;}_0x2786f1[_0xc9d5('0x60')](addAdditionalPhone(_0x370a5c['id'],_0x370a5c['items'][_0xa7f4a8][_0xc9d5('0x76')],_0x370a5c[_0xc9d5('0x87')]?_['isNil'](_0x370a5c['item_types'][_0xa7f4a8])?null:_0x370a5c[_0xc9d5('0x87')][_0xa7f4a8]:_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8][_0xc9d5('0x88')]?_0x370a5c[_0xc9d5('0x86')][_0xa7f4a8]['ItemTypeId']:null,_0x23f0a3,_0x546c71));}Promise['all'](_0x2786f1)[_0xc9d5('0x18')](function(){db[_0xc9d5('0x26')][_0xc9d5('0x17')]({'AdditionalPhones':_0x25af83},{'where':{'id':_0x370a5c['id']}})[_0xc9d5('0x18')](function(){_0x15bdf9(0x1);});});});});});}function addAdditionalPhone(_0x566d59,_0x58ac23,_0x71879a,_0x54b21d,_0x3f6cc7){return db['CmContactHasItem'][_0xc9d5('0x27')]({'where':{'CmContactId':_0x566d59,'item':_0x58ac23}})[_0xc9d5('0x18')](function(_0x3a16e5){if(_0x3a16e5)logger['info'](_0xc9d5('0x8a'),_0x3a16e5);else{db[_0xc9d5('0x4e')][_0xc9d5('0x43')]({'CmContactId':_0x566d59,'item':_0x58ac23,'ItemTypeId':_0x71879a,'OrderBy':_0x54b21d,'ItemClass':'PHONE','description':_0x3f6cc7});}});}function deleteCmHopperPhones(_0x44f30a){return new Promise(function(_0x1a01e0){return db['CmHopper'][_0xc9d5('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x44f30a}})[_0xc9d5('0x18')](function(_0x3ba337){db[_0xc9d5('0x8b')][_0xc9d5('0x25')]({'where':{'CmHopperId':{'$in':_['map'](_0x3ba337,'id')}}});})['then'](function(){_0x1a01e0(0x1);});});}function addCmHopperPhones(_0x41d626){return new Promise(function(_0x386c0d){return db[_0xc9d5('0x3e')][_0xc9d5('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x41d626}})[_0xc9d5('0x18')](function(_0x4c1d2a){var _0x12a116=[];_['map'](_0x4c1d2a,function(_0x1f6135){_0x12a116['push'](createCmHopperPhone(_0x41d626,_0x1f6135['id']));});Promise[_0xc9d5('0x65')](_0x12a116)[_0xc9d5('0x18')](function(){_0x386c0d(0x1);});});});}function createCmHopperPhone(_0x93baf2,_0x50fdaa){return new Promise(function(_0x12b483){db[_0xc9d5('0x4e')][_0xc9d5('0x21')]({'raw':!![],'attributes':[_0xc9d5('0x8c'),_0xc9d5('0x85')],'where':{'CmContactId':_0x93baf2,'ItemClass':_0xc9d5('0x8d')},'include':[{'model':db[_0xc9d5('0x68')],'attributes':[_0xc9d5('0x85')],'as':'ItemType'}],'order':[_0xc9d5('0x85'),db[_0xc9d5('0x6a')][_0xc9d5('0x8e')](_0xc9d5('0x8f'))]})[_0xc9d5('0x18')](function(_0x3317f8){var _0x4189d7=0x1;var _0x511f39=_[_0xc9d5('0x6e')](_0x3317f8,function(_0x10f59d){_0x10f59d['CmHopperId']=_0x50fdaa;_0x10f59d[_0xc9d5('0x76')]=_0x10f59d['item'];_0x10f59d[_0xc9d5('0x85')]=_0x4189d7;delete _0x10f59d[_0xc9d5('0x90')];_0x4189d7=_0x4189d7+0x1;return _0x10f59d;});return db[_0xc9d5('0x8b')][_0xc9d5('0x5c')](_0x511f39,{});})[_0xc9d5('0x18')](function(){_0x12b483(0x1);});});}function insertAdditionalPhones(_0x99d71f,_0x5059cc){return new Promise(function(_0x141d5b){var _0x5e5c7f=[];for(var _0x3a36d8=0x0;_0x3a36d8<_0x5059cc[_0xc9d5('0x2b')];_0x3a36d8++){var _0x42d070=_0x5059cc[_0x3a36d8];_0x5e5c7f[_0xc9d5('0x60')](parseContactItemType(_0x42d070));}Promise[_0xc9d5('0x65')](_0x5e5c7f)[_0xc9d5('0x18')](function(){var _0x53f0a3={'id':_0x99d71f['id'],'items':_0x5059cc};return addAdditionalPhones(_0x53f0a3)[_0xc9d5('0x18')](function(){return addCmHopperPhones(_0x99d71f['id']);});})[_0xc9d5('0x18')](function(){_0x141d5b(_0x99d71f);});});}function parseContactItemType(_0x113c78){return new Promise(function(_0x271b18){if(_0x113c78['hasOwnProperty']('ItemTypeId')){_0x271b18(_0x113c78);}else{return db[_0xc9d5('0x68')]['find']({'where':{'name':_0x113c78['ItemType']}})['then'](function(_0x1ae4f6){if(_[_0xc9d5('0x57')](_0x1ae4f6))_0x113c78[_0xc9d5('0x88')]=null;else _0x113c78['ItemTypeId']=_0x1ae4f6['id'];_0x271b18(_0x113c78);});}});}exports[_0xc9d5('0x91')]=function(_0x52c94e,_0x31c9be){return db[_0xc9d5('0x4e')][_0xc9d5('0x21')]({'raw':!![],'where':{'CmContactId':_0x52c94e[_0xc9d5('0x28')]['id'],'ItemClass':_0xc9d5('0x8d')},'include':[{'model':db[_0xc9d5('0x68')],'as':_0xc9d5('0x69')}],'order':[['OrderBy'],[db[_0xc9d5('0x6a')][_0xc9d5('0x8e')](_0xc9d5('0x8f'))]]})[_0xc9d5('0x18')](function(_0x1d7007){return _0x1d7007;})['then'](respondWithResult(_0x31c9be,null))[_0xc9d5('0x24')](handleError(_0x31c9be,null));};exports['duplicateAdditionalPhones']=function(_0x39bf1e,_0x10fc93){return db[_0xc9d5('0x4e')]['findAll']({'raw':!![],'where':{'CmContactId':_0x39bf1e[_0xc9d5('0x39')][_0xc9d5('0x92')]}})[_0xc9d5('0x18')](function(_0x32a9f9){var _0xf3f1c4=_[_0xc9d5('0x6e')](_0x32a9f9,function(_0x1930d1){_0x1930d1[_0xc9d5('0x93')]=_0x39bf1e[_0xc9d5('0x39')][_0xc9d5('0x94')];return _0x1930d1;});return db[_0xc9d5('0x4e')][_0xc9d5('0x5c')](_0xf3f1c4,{});})[_0xc9d5('0x18')](function(){return addCmHopperPhones(_0x39bf1e[_0xc9d5('0x39')][_0xc9d5('0x94')]);})[_0xc9d5('0x18')](function(){return['ok'];})['then'](respondWithResult(_0x10fc93,null))[_0xc9d5('0x24')](handleError(_0x10fc93,null));};exports[_0xc9d5('0x95')]=function(_0x426c2c,_0x54a425){var _0x1482d5=[];_0x1482d5['push'](createCmHopperPhone(_0x426c2c[_0xc9d5('0x39')]['id'],_0x426c2c[_0xc9d5('0x39')][_0xc9d5('0x96')]));Promise[_0xc9d5('0x65')](_0x1482d5)[_0xc9d5('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x54a425,null));};exports[_0xc9d5('0x97')]=function(_0x38f5ef,_0x6312c8){var _0x43e788={'raw':![],'where':{}};var _0x2825d7={};var _0x1909e8={'count':0x0,'rows':[]};return db[_0xc9d5('0x26')][_0xc9d5('0x98')]({'where':{'id':_0x38f5ef[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x6312c8,null))['then'](function(_0x584c44){if(_0x584c44){_0x2825d7['model']=_[_0xc9d5('0x2a')](db['CmHopper'][_0xc9d5('0x78')]);_0x2825d7['query']=_[_0xc9d5('0x2a')](_0x38f5ef['query']);_0x2825d7['filters']=_['intersection'](_0x2825d7['model'],_0x2825d7[_0xc9d5('0x22')]);_0x43e788[_0xc9d5('0x7b')]=_[_0xc9d5('0x99')](_0x2825d7[_0xc9d5('0x7a')],qs[_0xc9d5('0x7c')](_0x38f5ef[_0xc9d5('0x22')][_0xc9d5('0x7c')]));_0x43e788[_0xc9d5('0x7b')]=_0x43e788[_0xc9d5('0x7b')][_0xc9d5('0x2b')]?_0x43e788[_0xc9d5('0x7b')]:_0x2825d7[_0xc9d5('0x7a')];if(!_0x38f5ef[_0xc9d5('0x22')][_0xc9d5('0x37')](_0xc9d5('0x9a'))){_0x43e788['limit']=qs[_0xc9d5('0x81')](_0x38f5ef['query'][_0xc9d5('0x81')]);_0x43e788[_0xc9d5('0x12')]=qs['offset'](_0x38f5ef[_0xc9d5('0x22')][_0xc9d5('0x12')]);}_0x43e788[_0xc9d5('0x9b')]=qs[_0xc9d5('0x7d')](_0x38f5ef[_0xc9d5('0x22')][_0xc9d5('0x7d')]);_0x43e788[_0xc9d5('0x6f')]=qs[_0xc9d5('0x79')](_[_0xc9d5('0x7e')](_0x38f5ef['query'],_0x2825d7['filters']));_0x43e788[_0xc9d5('0x6f')]['ContactId']=_0x584c44['id'];if(_0x38f5ef[_0xc9d5('0x22')]['filter']){_0x43e788[_0xc9d5('0x6f')]=_[_0xc9d5('0x38')](_0x43e788[_0xc9d5('0x6f')],{'$or':_[_0xc9d5('0x6e')](_0x43e788[_0xc9d5('0x7b')],function(_0x4d2538){var _0x281b2b={};_0x281b2b[_0x4d2538]={'$like':'%'+_0x38f5ef[_0xc9d5('0x22')][_0xc9d5('0x9c')]+'%'};return _0x281b2b;})});}_0x43e788=_[_0xc9d5('0x38')]({},_0x43e788,_0x38f5ef[_0xc9d5('0x7f')]);return db[_0xc9d5('0x3e')][_0xc9d5('0x14')]({'where':_0x43e788[_0xc9d5('0x6f')]})[_0xc9d5('0x18')](function(_0x25454b){_0x1909e8[_0xc9d5('0x14')]=_0x25454b;if(_0x38f5ef['query']['includeAll']){_0x43e788[_0xc9d5('0x9d')]=[{'all':!![]}];}return db[_0xc9d5('0x3e')][_0xc9d5('0x21')](_0x43e788);})[_0xc9d5('0x18')](function(_0x3d30f3){_0x1909e8['rows']=_0x3d30f3;return _0x1909e8;});}})[_0xc9d5('0x18')](respondWithFilteredResult(_0x6312c8,_0x43e788))['catch'](handleError(_0x6312c8,null));};exports[_0xc9d5('0x9e')]=function(_0x57fc01,_0x39cc2f){var _0x21ca25={'raw':!![],'where':{}};var _0x474873={};var _0xfc2edc={'count':0x0,'rows':[]};return db[_0xc9d5('0x26')]['findOne']({'where':{'id':_0x57fc01['params']['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x39cc2f,null))[_0xc9d5('0x18')](function(_0x34a839){if(_0x34a839){_0x474873[_0xc9d5('0x7a')]=_[_0xc9d5('0x2a')](db[_0xc9d5('0x4f')][_0xc9d5('0x78')]);_0x474873[_0xc9d5('0x22')]=_[_0xc9d5('0x2a')](_0x57fc01['query']);_0x474873['filters']=_[_0xc9d5('0x99')](_0x474873[_0xc9d5('0x7a')],_0x474873[_0xc9d5('0x22')]);_0x21ca25[_0xc9d5('0x7b')]=_[_0xc9d5('0x99')](_0x474873[_0xc9d5('0x7a')],qs[_0xc9d5('0x7c')](_0x57fc01['query']['fields']));_0x21ca25[_0xc9d5('0x7b')]=_0x21ca25[_0xc9d5('0x7b')][_0xc9d5('0x2b')]?_0x21ca25[_0xc9d5('0x7b')]:_0x474873['model'];if(!_0x57fc01[_0xc9d5('0x22')][_0xc9d5('0x37')](_0xc9d5('0x9a'))){_0x21ca25[_0xc9d5('0x81')]=qs[_0xc9d5('0x81')](_0x57fc01['query'][_0xc9d5('0x81')]);_0x21ca25[_0xc9d5('0x12')]=qs[_0xc9d5('0x12')](_0x57fc01[_0xc9d5('0x22')][_0xc9d5('0x12')]);}_0x21ca25[_0xc9d5('0x9b')]=qs['sort'](_0x57fc01[_0xc9d5('0x22')][_0xc9d5('0x7d')]);_0x21ca25[_0xc9d5('0x6f')]=qs[_0xc9d5('0x79')](_[_0xc9d5('0x7e')](_0x57fc01[_0xc9d5('0x22')],_0x474873[_0xc9d5('0x79')]));_0x21ca25['where']['ContactId']=_0x34a839['id'];if(_0x57fc01['query'][_0xc9d5('0x9c')]){_0x21ca25[_0xc9d5('0x6f')]=_['merge'](_0x21ca25[_0xc9d5('0x6f')],{'$or':_[_0xc9d5('0x6e')](_0x21ca25[_0xc9d5('0x7b')],function(_0x3c0516){var _0x576792={};_0x576792[_0x3c0516]={'$like':'%'+_0x57fc01[_0xc9d5('0x22')][_0xc9d5('0x9c')]+'%'};return _0x576792;})});}_0x21ca25=_[_0xc9d5('0x38')]({},_0x21ca25,_0x57fc01[_0xc9d5('0x7f')]);return db[_0xc9d5('0x4f')][_0xc9d5('0x14')]({'where':_0x21ca25['where']})['then'](function(_0x129494){_0xfc2edc[_0xc9d5('0x14')]=_0x129494;if(_0x57fc01[_0xc9d5('0x22')]['includeAll']){_0x21ca25[_0xc9d5('0x9d')]=[{'all':!![]}];}return db[_0xc9d5('0x4f')]['findAll'](_0x21ca25);})[_0xc9d5('0x18')](function(_0x3e1b8b){_0xfc2edc[_0xc9d5('0x9f')]=_0x3e1b8b;return _0xfc2edc;});}})[_0xc9d5('0x18')](respondWithFilteredResult(_0x39cc2f,_0x21ca25))[_0xc9d5('0x24')](handleError(_0x39cc2f,null));};exports[_0xc9d5('0xa0')]=function(_0x46c89a,_0x44b47f){var _0xf0094e={'raw':!![],'where':{}};var _0x4500b9={};var _0x5e3b1d={'count':0x0,'rows':[]};return db[_0xc9d5('0x26')][_0xc9d5('0x98')]({'where':{'id':_0x46c89a[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x44b47f,null))[_0xc9d5('0x18')](function(_0x4458a){if(_0x4458a){_0x4500b9[_0xc9d5('0x7a')]=_[_0xc9d5('0x2a')](db[_0xc9d5('0xa1')]['rawAttributes']);_0x4500b9[_0xc9d5('0x22')]=_[_0xc9d5('0x2a')](_0x46c89a['query']);_0x4500b9[_0xc9d5('0x79')]=_[_0xc9d5('0x99')](_0x4500b9[_0xc9d5('0x7a')],_0x4500b9['query']);_0xf0094e[_0xc9d5('0x7b')]=_[_0xc9d5('0x99')](_0x4500b9['model'],qs[_0xc9d5('0x7c')](_0x46c89a[_0xc9d5('0x22')]['fields']));_0xf0094e[_0xc9d5('0x7b')]=_0xf0094e[_0xc9d5('0x7b')][_0xc9d5('0x2b')]?_0xf0094e['attributes']:_0x4500b9['model'];if(!_0x46c89a[_0xc9d5('0x22')][_0xc9d5('0x37')](_0xc9d5('0x9a'))){_0xf0094e[_0xc9d5('0x81')]=qs[_0xc9d5('0x81')](_0x46c89a[_0xc9d5('0x22')][_0xc9d5('0x81')]);_0xf0094e['offset']=qs[_0xc9d5('0x12')](_0x46c89a[_0xc9d5('0x22')][_0xc9d5('0x12')]);}_0xf0094e[_0xc9d5('0x9b')]=qs[_0xc9d5('0x7d')](_0x46c89a['query'][_0xc9d5('0x7d')]);_0xf0094e['where']=qs[_0xc9d5('0x79')](_[_0xc9d5('0x7e')](_0x46c89a[_0xc9d5('0x22')],_0x4500b9[_0xc9d5('0x79')]));_0xf0094e[_0xc9d5('0x6f')][_0xc9d5('0xa2')]=_0x4458a['id'];if(_0x46c89a['query'][_0xc9d5('0x9c')]){_0xf0094e[_0xc9d5('0x6f')]=_[_0xc9d5('0x38')](_0xf0094e['where'],{'$or':_[_0xc9d5('0x6e')](_0xf0094e['attributes'],function(_0x2a12ec){var _0x129b33={};_0x129b33[_0x2a12ec]={'$like':'%'+_0x46c89a['query'][_0xc9d5('0x9c')]+'%'};return _0x129b33;})});}_0xf0094e=_['merge']({},_0xf0094e,_0x46c89a[_0xc9d5('0x7f')]);return db[_0xc9d5('0xa1')][_0xc9d5('0x14')]({'where':_0xf0094e[_0xc9d5('0x6f')]})['then'](function(_0x1aeba8){_0x5e3b1d[_0xc9d5('0x14')]=_0x1aeba8;if(_0x46c89a[_0xc9d5('0x22')]['includeAll']){_0xf0094e[_0xc9d5('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xc9d5('0x21')](_0xf0094e);})[_0xc9d5('0x18')](function(_0x4507bb){_0x5e3b1d[_0xc9d5('0x9f')]=_0x4507bb;return _0x5e3b1d;});}})[_0xc9d5('0x18')](respondWithFilteredResult(_0x44b47f,_0xf0094e))[_0xc9d5('0x24')](handleError(_0x44b47f,null));};exports[_0xc9d5('0xa3')]=function(_0x45eb0f,_0x5cfde5){var _0x43f4dc={'raw':!![],'where':{}};var _0x49cad9={};var _0x40b77d={'count':0x0,'rows':[]};return db[_0xc9d5('0x26')][_0xc9d5('0x98')]({'where':{'id':_0x45eb0f[_0xc9d5('0x28')]['id']}})[_0xc9d5('0x18')](handleEntityNotFound(_0x5cfde5,null))['then'](function(_0x52fce7){if(_0x52fce7){_0x49cad9[_0xc9d5('0x7a')]=_[_0xc9d5('0x2a')](db[_0xc9d5('0xa4')]['rawAttributes']);_0x49cad9[_0xc9d5('0x22')]=_['keys'](_0x45eb0f[_0xc9d5('0x22')]);_0x49cad9[_0xc9d5('0x79')]=_[_0xc9d5('0x99')](_0x49cad9[_0xc9d5('0x7a')],_0x49cad9['query']);_0x43f4dc[_0xc9d5('0x7b')]=_[_0xc9d5('0x99')](_0x49cad9['model'],qs[_0xc9d5('0x7c')](_0x45eb0f[_0xc9d5('0x22')][_0xc9d5('0x7c')]));_0x43f4dc[_0xc9d5('0x7b')]=_0x43f4dc[_0xc9d5('0x7b')]['length']?_0x43f4dc['attributes']:_0x49cad9[_0xc9d5('0x7a')];if(!_0x45eb0f[_0xc9d5('0x22')][_0xc9d5('0x37')]('nolimit')){_0x43f4dc['limit']=qs['limit'](_0x45eb0f[_0xc9d5('0x22')]['limit']);_0x43f4dc[_0xc9d5('0x12')]=qs[_0xc9d5('0x12')](_0x45eb0f[_0xc9d5('0x22')][_0xc9d5('0x12')]);}_0x43f4dc[_0xc9d5('0x9b')]=qs[_0xc9d5('0x7d')](_0x45eb0f['query'][_0xc9d5('0x7d')]);_0x43f4dc[_0xc9d5('0x6f')]=qs['filters'](_[_0xc9d5('0x7e')](_0x45eb0f[_0xc9d5('0x22')],_0x49cad9[_0xc9d5('0x79')]));_0x43f4dc[_0xc9d5('0x6f')]['ContactId']=_0x52fce7['id'];if(_0x45eb0f['query'][_0xc9d5('0x9c')]){_0x43f4dc[_0xc9d5('0x6f')]=_[_0xc9d5('0x38')](_0x43f4dc[_0xc9d5('0x6f')],{'$or':_['map'](_0x43f4dc[_0xc9d5('0x7b')],function(_0x1f1669){var _0x8470af={};_0x8470af[_0x1f1669]={'$like':'%'+_0x45eb0f[_0xc9d5('0x22')]['filter']+'%'};return _0x8470af;})});}_0x43f4dc=_['merge']({},_0x43f4dc,_0x45eb0f[_0xc9d5('0x7f')]);return db[_0xc9d5('0xa4')][_0xc9d5('0x14')]({'where':_0x43f4dc[_0xc9d5('0x6f')]})[_0xc9d5('0x18')](function(_0x4f0548){_0x40b77d[_0xc9d5('0x14')]=_0x4f0548;if(_0x45eb0f[_0xc9d5('0x22')][_0xc9d5('0xa5')]){_0x43f4dc[_0xc9d5('0x9d')]=[{'all':!![]}];}return db[_0xc9d5('0xa4')]['findAll'](_0x43f4dc);})[_0xc9d5('0x18')](function(_0x448628){_0x40b77d[_0xc9d5('0x9f')]=_0x448628;return _0x40b77d;});}})[_0xc9d5('0x18')](respondWithFilteredResult(_0x5cfde5,_0x43f4dc))[_0xc9d5('0x24')](handleError(_0x5cfde5,null));};exports[_0xc9d5('0xa6')]=function(_0x45ae9f,_0x78d8bf){try{if(!_0x45ae9f['body']['ListId']){throw new Error(_0xc9d5('0xa7'));}if(!_0x45ae9f['body']['binding_keys']){throw new Error(_0xc9d5('0xa8'));}if(!_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0xa9')]){throw new Error(_0xc9d5('0xaa'));}if(!_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0xab')]){throw new Error(_0xc9d5('0xac'));}var _0x26bc41=_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0xad')][_0xc9d5('0xae')](',');var _0x562921=_0x45ae9f['body'][_0xc9d5('0xa9')][_0xc9d5('0xae')](',');if(!_0x26bc41[_0xc9d5('0x2b')]||!_0x562921[_0xc9d5('0x2b')]||_0x26bc41[_0xc9d5('0x2b')]!==_0x562921[_0xc9d5('0x2b')]){throw new Error(_0xc9d5('0xaf'));}_0x45ae9f[_0xc9d5('0x39')]['fields']=_[_0xc9d5('0xb0')](_0x26bc41,_0x562921);if(!_0x45ae9f[_0xc9d5('0x39')]['fields'][_0xc9d5('0x76')]){throw new Error(_0xc9d5('0xb1'));}if(!_0x45ae9f['body'][_0xc9d5('0x7c')][_0xc9d5('0xb2')]){throw new Error(_0xc9d5('0xb3'));}var _0x42649b=path[_0xc9d5('0x3c')](config[_0xc9d5('0xb4')],_0xc9d5('0xb5'),_0x45ae9f[_0xc9d5('0xb6')]['filename']);fs[_0xc9d5('0xb7')](_0x42649b,parseInt(_0xc9d5('0xb8'),0x8));var _0x47db80=require(_0xc9d5('0xb9'))[_0xc9d5('0xba')](path[_0xc9d5('0x3c')](__dirname,_0xc9d5('0xbb')),[_0x42649b,_0x45ae9f['body']['binding_keys'],_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0xa9')],_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0x61')],_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0xbc')],_0x45ae9f[_0xc9d5('0x39')][_0xc9d5('0x5e')],_0x45ae9f[_0xc9d5('0x39')]['socket_timestamp']]);return _0x78d8bf[_0xc9d5('0x11')](0xc8)['json']({'message':_0xc9d5('0xbd'),'pid':_0x47db80[_0xc9d5('0xbe')]});}catch(_0x47186f){return _0x78d8bf[_0xc9d5('0x11')](0x1f4)[_0xc9d5('0x1d')](_0x47186f);}};exports[_0xc9d5('0xbf')]=function(_0x2e6ca8,_0x111b38){var _0x207614=fs[_0xc9d5('0xc0')](_0x2e6ca8['file'][_0xc9d5('0xc1')]);Papa[_0xc9d5('0xc2')](_0x207614,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2cb2d0){return _0x111b38[_0xc9d5('0x11')](0xc8)['json']({'file':_0x2e6ca8[_0xc9d5('0xb6')],'fields':_0x2cb2d0['meta'][_0xc9d5('0x7c')]});}});};exports['import']=function(_0x3b0cf0,_0x3a3c21){return db[_0xc9d5('0xc3')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xc9d5('0xc4')}})[_0xc9d5('0x18')](function(_0xd15a5){var _0x27d042=![];if(!_0x3b0cf0[_0xc9d5('0x39')][_0xc9d5('0x61')]){throw new Error(_0xc9d5('0xa7'));}if(!_0x3b0cf0[_0xc9d5('0x39')][_0xc9d5('0xc5')][_0xc9d5('0x76')]){throw new Error(_0xc9d5('0xb1'));}if(!_0x3b0cf0[_0xc9d5('0x39')][_0xc9d5('0xc5')][_0xc9d5('0xb2')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x3b0cf0[_0xc9d5('0x39')][_0xc9d5('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1e0adc=require(_0xc9d5('0xb9'))[_0xc9d5('0xba')](path['join'](__dirname,_0xc9d5('0xc6')),[_0x3b0cf0[_0xc9d5('0x28')]['id'],JSON[_0xc9d5('0xc7')](_0x3b0cf0['body']),JSON[_0xc9d5('0xc7')](_0xd15a5)]);_0x1e0adc['on'](_0xc9d5('0xc8'),function(){_0x27d042=!![];return _0x3a3c21[_0xc9d5('0x11')](0xc8)[_0xc9d5('0x16')]({'message':_0xc9d5('0xc9'),'pid':_0x1e0adc['pid']});});_0x1e0adc['on'](_0xc9d5('0xca'),function(_0x9973ef){if(_0x9973ef&&!_0x27d042){return _0x3a3c21['status'](0x1f4)[_0xc9d5('0x16')]({'message':_0xc9d5('0xcb'),'pid':_0x1e0adc[_0xc9d5('0xbe')]});}});})[_0xc9d5('0x24')](handleError(_0x3a3c21,null));};exports['importUpdates']=function(_0x2603d6,_0x3a2f6d){return db[_0xc9d5('0xc3')][_0xc9d5('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xc9d5('0xc4')}})[_0xc9d5('0x18')](function(_0x2f52ab){var _0x31d513=![];if(!_0x2603d6[_0xc9d5('0x39')][_0xc9d5('0x61')]){throw new Error(_0xc9d5('0xa7'));}if(!_0x2603d6[_0xc9d5('0x39')][_0xc9d5('0xc5')][_0xc9d5('0x76')]){throw new Error(_0xc9d5('0xb1'));}if(!_0x2603d6[_0xc9d5('0x39')][_0xc9d5('0xc5')][_0xc9d5('0xb2')]){throw new Error(_0xc9d5('0xb3'));}if(!_0x2603d6[_0xc9d5('0x39')][_0xc9d5('0xab')]){throw new Error(_0xc9d5('0xac'));}var _0x5466ad=require(_0xc9d5('0xb9'))['fork'](path[_0xc9d5('0x3c')](__dirname,_0xc9d5('0xcc')),[_0x2603d6[_0xc9d5('0x28')]['id'],JSON['stringify'](_0x2603d6[_0xc9d5('0x39')]),JSON[_0xc9d5('0xc7')](_0x2f52ab)]);_0x5466ad['on'](_0xc9d5('0xc8'),function(){_0x31d513=!![];return _0x3a2f6d['status'](0xc8)[_0xc9d5('0x16')]({'message':_0xc9d5('0xc9'),'pid':_0x5466ad[_0xc9d5('0xbe')]});});_0x5466ad['on']('exit',function(_0x5bb5ce){if(_0x5bb5ce&&!_0x31d513){return _0x3a2f6d[_0xc9d5('0x11')](0x1f4)[_0xc9d5('0x16')]({'message':_0xc9d5('0xcb'),'pid':_0x5466ad[_0xc9d5('0xbe')]});}});})[_0xc9d5('0x24')](handleError(_0x3a2f6d,null));};exports[_0xc9d5('0xcd')]=function(_0x15f8b3,_0x179856){var _0x448f24=[_0xc9d5('0xce'),_0xc9d5('0xcf'),_0xc9d5('0xd0'),_0xc9d5('0xd1'),_0xc9d5('0xd2'),_0xc9d5('0xd3'),_0xc9d5('0xd4')];var _0x237757={'offset':0x0,'order':qs['sort']('-createdAt')},_0x18a3c2={'count':0x0,'rows':[]};Promise[_0xc9d5('0xd5')]()[_0xc9d5('0x18')](function(){if(_0x15f8b3[_0xc9d5('0x22')]['channel']){if(!_[_0xc9d5('0xd6')](_0x448f24,_0x15f8b3[_0xc9d5('0x22')]['channel'][_0xc9d5('0xd7')]())){throw new Error(_0xc9d5('0xd8'));}_0x448f24=[_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0xd9')]['toLowerCase']()];}if(_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0xda')]){try{var _0x25ce5c=JSON[_0xc9d5('0xc2')](_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0xda')]);if(!moment(_0x25ce5c['from'])[_0xc9d5('0xdb')]()){throw new Error(_0xc9d5('0xdc'));}if(!moment(_0x25ce5c['to'])[_0xc9d5('0xdb')]()){throw new Error(_0xc9d5('0xdd'));}}catch(_0x3bbd72){throw new Error(_0xc9d5('0xde'));}}if(!_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0x37')](_0xc9d5('0x9a'))){_0x237757[_0xc9d5('0x81')]=qs[_0xc9d5('0x81')](_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0x81')]||0xa);_0x237757[_0xc9d5('0x12')]=qs[_0xc9d5('0x12')](_0x15f8b3[_0xc9d5('0x22')]['offset']);}var _0x36bc31=_0x448f24[_0xc9d5('0x6e')](function(_0x438b02){if(_0x438b02===_0xc9d5('0xd4')){var _0x22676d={'attributes':['id',_0xc9d5('0xdf'),_0xc9d5('0xe0'),_0xc9d5('0xe1'),_0xc9d5('0xe2'),_0xc9d5('0xe3'),_0xc9d5('0xe4'),_0xc9d5('0xe5'),_0xc9d5('0xe6'),_0xc9d5('0xe7'),_0xc9d5('0xe8'),_0xc9d5('0xe9'),'userSecondDisposition',_0xc9d5('0xea'),_0xc9d5('0xeb')],'where':{'ContactId':_0x15f8b3['params']['id']},'include':[{'model':db['User'],'as':_0xc9d5('0xc3'),'attributes':['id',_0xc9d5('0x1c'),_0xc9d5('0xec'),_0xc9d5('0x31')]}],'order':[[_0xc9d5('0xe8'),_0xc9d5('0xed')]]};if(_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0xda')]){_0x22676d['where']['createdAt']={'$gte':_0x25ce5c[_0xc9d5('0x41')],'$lte':_0x25ce5c['to']};}return db[_0xc9d5('0xee')][_0xc9d5('0xef')](_0x22676d)['then'](function(_0x2f8fc3){_0x18a3c2['count']+=_0x2f8fc3['count'];return _['map'](_0x2f8fc3['rows'],function(_0x2ab135){var _0x2eec3e=_0x2ab135[_0xc9d5('0x3a')]({'plain':!![]});_0x2eec3e['channel']=_0x438b02;if(_0x2eec3e[_0xc9d5('0xc3')]){_0x2eec3e['User']={'id':_0x2eec3e[_0xc9d5('0xc3')]['id'],'name':_0x2eec3e['User'][_0xc9d5('0x1c')],'fullname':_0x2eec3e['User'][_0xc9d5('0xec')],'alias':_0x2eec3e[_0xc9d5('0xc3')][_0xc9d5('0x31')]};}return _0x2eec3e;});});}else{var _0x40010a=_[_0xc9d5('0xf0')](_0x438b02)+(_0x438b02===_0xc9d5('0xcf')?'Website':_0xc9d5('0xf1'));var _0x3f4dc3={'attributes':['id',_0xc9d5('0xf2'),'closedAt','createdAt','note','disposition','secondDisposition',_0xc9d5('0xf3'),'UserId',_0x40010a+'Id'],'where':{'ContactId':_0x15f8b3[_0xc9d5('0x28')]['id']},'include':[{'model':db[_0x40010a],'as':_0xc9d5('0xf1'),'attributes':['id',_0xc9d5('0x1c'),'key']},{'model':db[_0xc9d5('0xc3')],'as':'Owner','attributes':['id',_0xc9d5('0x1c'),'fullname']},{'model':db[_0xc9d5('0x77')],'as':_0xc9d5('0x66'),'attributes':['id',_0xc9d5('0x1c'),_0xc9d5('0xf4')],'through':{'attributes':[]}}],'order':[[_0xc9d5('0xe8'),_0xc9d5('0xed')]]};if(_0x15f8b3[_0xc9d5('0x22')][_0xc9d5('0xda')]){_0x3f4dc3[_0xc9d5('0x6f')][_0xc9d5('0xe8')]={'$gte':_0x25ce5c[_0xc9d5('0x41')],'$lte':_0x25ce5c['to']};}switch(_0x438b02){case _0xc9d5('0xcf'):_0x3f4dc3[_0xc9d5('0x7b')][_0xc9d5('0x60')](_0xc9d5('0xf5'),_0xc9d5('0xf6'),_0xc9d5('0xf7'),'deviceModel','osName','ratingMessage',_0xc9d5('0xf8'),_0xc9d5('0xf9'),_0xc9d5('0xfa'));break;case _0xc9d5('0xce'):_0x3f4dc3[_0xc9d5('0x7b')][_0xc9d5('0x60')](_0xc9d5('0xfb'),_0xc9d5('0xfc'));break;case _0xc9d5('0xd1'):_0x3f4dc3[_0xc9d5('0x7b')][_0xc9d5('0x60')]('externalUrl',_0xc9d5('0xfd'));break;}return db[_['startCase'](_0x438b02)+_0xc9d5('0xfe')][_0xc9d5('0xef')](_0x3f4dc3)[_0xc9d5('0x18')](function(_0x8e277d){_0x18a3c2[_0xc9d5('0x14')]+=_0x8e277d[_0xc9d5('0x14')];return _['map'](_0x8e277d[_0xc9d5('0x9f')],function(_0x48236){var _0x481736=_0x48236['get']({'plain':!![]});_0x481736['channel']=_0x438b02;if(_0x481736[_0xc9d5('0xff')]){_0x481736[_0xc9d5('0xff')]={'id':_0x481736[_0xc9d5('0xff')]['id'],'name':_0x481736[_0xc9d5('0xff')][_0xc9d5('0x1c')],'fullname':_0x481736[_0xc9d5('0xff')][_0xc9d5('0xec')]};}return _0x481736;});});}});return Promise[_0xc9d5('0x65')](_0x36bc31);})[_0xc9d5('0x18')](function(_0x3878cc){return _(_0x3878cc)[_0xc9d5('0x100')]()['sortBy']('createdAt')[_0xc9d5('0x101')]()[_0xc9d5('0x102')]();})[_0xc9d5('0x18')](function(_0x2b5318){_0x18a3c2['rows']=_0x237757[_0xc9d5('0x81')]?_0x2b5318[_0xc9d5('0x103')](_0x237757[_0xc9d5('0x12')],_0x237757[_0xc9d5('0x12')]+_0x237757[_0xc9d5('0x81')]):_0x2b5318;return _0x18a3c2;})[_0xc9d5('0x18')](respondWithFilteredResult(_0x179856,_0x237757))[_0xc9d5('0x24')](handleError(_0x179856,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index f374120..0bb0570 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 _0x0bb2=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4a1efa,_0x3e9587){var _0x57f83a=function(_0x373bd7){while(--_0x373bd7){_0x4a1efa['push'](_0x4a1efa['shift']());}};_0x57f83a(++_0x3e9587);}(_0x0bb2,0x1dd));var _0x20bb=function(_0x2c7ce7,_0x8d34cf){_0x2c7ce7=_0x2c7ce7-0x0;var _0x59c1bf=_0x0bb2[_0x2c7ce7];return _0x59c1bf;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x20bb('0x0'))['db'][_0x20bb('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x20bb('0x2')](0x0);var events={'afterCreate':_0x20bb('0x3'),'afterUpdate':_0x20bb('0x4'),'afterDestroy':_0x20bb('0x5')};function emitEvent(_0x5bb2bd){return function(_0x2756cc,_0x27bd9c,_0x4923c3){CmContactEvents['emit'](_0x5bb2bd+':'+_0x2756cc['id'],_0x2756cc);CmContactEvents[_0x20bb('0x6')](_0x5bb2bd,_0x2756cc);_0x4923c3(null);};}for(var e in events){if(events[_0x20bb('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x20bb('0x8')]=CmContactEvents; \ No newline at end of file +var _0xc499=['exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0xc499,0x123));var _0x9c49=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0xc499[_0x47fa10];return _0x204f30;};'use strict';var EventEmitter=require(_0x9c49('0x0'));var CmContact=require(_0x9c49('0x1'))['db'][_0x9c49('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9c49('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c49('0x4'),'afterDestroy':_0x9c49('0x5')};function emitEvent(_0x1614a){return function(_0x1d8e3e,_0x4f9bfd,_0x3e5707){CmContactEvents[_0x9c49('0x6')](_0x1614a+':'+_0x1d8e3e['id'],_0x1d8e3e);CmContactEvents['emit'](_0x1614a,_0x1d8e3e);_0x3e5707(null);};}for(var e in events){if(events[_0x9c49('0x7')](e)){var event=events[e];CmContact[_0x9c49('0x8')](e,emitEvent(event));}}module[_0x9c49('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 8f9d12a..62ef166 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 _0xd7a6=['lastName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','afterCreate','inspect','scheduledat','format','dialTimezone','VoiceQueue','isNil','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','findOne','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','CmHopperBlack','message','BlackLists','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName'];(function(_0x3c3d77,_0x35896c){var _0x323fe1=function(_0x34ef7b){while(--_0x34ef7b){_0x3c3d77['push'](_0x3c3d77['shift']());}};_0x323fe1(++_0x35896c);}(_0xd7a6,0x1b1));var _0x6d7a=function(_0x343ab5,_0x246140){_0x343ab5=_0x343ab5-0x0;var _0x21d0e6=_0xd7a6[_0x343ab5];return _0x21d0e6;};'use strict';var _=require(_0x6d7a('0x0'));var util=require('util');var logger=require(_0x6d7a('0x1'))(_0x6d7a('0x2'));var moment=require(_0x6d7a('0x3'));var BPromise=require(_0x6d7a('0x4'));var rp=require(_0x6d7a('0x5'));var fs=require('fs');var path=require(_0x6d7a('0x6'));var rimraf=require(_0x6d7a('0x7'));var config=require('../../config/environment');var shared=require(_0x6d7a('0x8'));var attributes=require(_0x6d7a('0x9'));module[_0x6d7a('0xa')]=function(_0x47663c,_0x87a1db){return _0x47663c[_0x6d7a('0xb')](_0x6d7a('0xc'),attributes,{'tableName':_0x6d7a('0xd'),'paranoid':!![],'indexes':[{'name':_0x6d7a('0xe'),'fields':[_0x6d7a('0xe')]},{'name':_0x6d7a('0xf'),'fields':[_0x6d7a('0x10'),_0x6d7a('0x11'),_0x6d7a('0xe'),'mobile','fax',_0x6d7a('0x12')],'type':_0x6d7a('0x13')}],'timestamps':!![],'charset':_0x6d7a('0x14'),'collate':_0x6d7a('0x15'),'hooks':{'afterCreate':function(_0x3d432d,_0x1b7653,_0x99e5cb){var _0x10d074=_0x47663c[_0x6d7a('0x16')];var _0x45d5b5=_0x3d432d['get']({'plain':!![]});function _0x50ee1e(){return function(_0x5ff070){logger[_0x6d7a('0x17')]('cmContact',_0x6d7a('0x18'),util[_0x6d7a('0x19')](_0x5ff070,{'showHidden':![],'depth':null}));};}function _0x40445a(_0x404fc3,_0x57d028){var _0x4702c8=_0x57d028[_0x6d7a('0x1a')]?_0x57d028[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x29345d,_0x2d60c6){if(_['isNil'](_0x57d028[_0x6d7a('0x1c')])){_0x29345d({'ret':_0x4702c8});}else{_0x10d074[_0x6d7a('0x1d')]['findOne']({'where':{'id':_0x404fc3['id']}})['then'](function(_0x5549ff){if(!_[_0x6d7a('0x1e')](_0x5549ff)){var _0x380002=_0x5549ff[_0x6d7a('0x1c')];if(!_[_0x6d7a('0x1e')](_0x380002)){var _0xff68a6=shared['timezones'];var _0x129f42=_0xff68a6[_0x380002];var _0x4365a7=_0xff68a6[_0x57d028[_0x6d7a('0x1c')]];if(!_[_0x6d7a('0x1e')](_0x129f42)&&!_[_0x6d7a('0x1e')](_0x4365a7)){var _0x294f7a=_0x129f42['utcOffset']-_0x4365a7[_0x6d7a('0x1f')];_0x4702c8=_0x57d028[_0x6d7a('0x1a')]?_0x57d028['scheduledat']:moment();var _0x115996=moment(_0x4702c8)[_0x6d7a('0x20')](_0x294f7a,_0x6d7a('0x21'));_0x29345d({'ret':_0x115996[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x29345d({'ret':_0x4702c8});}else _0x29345d({'ret':_0x4702c8});}else{_0x29345d({'ret':_0x4702c8});}});}});return 0xa;}var _0xf8f269=function(_0x3b4d8d){return new BPromise(function(_0x2b4737,_0x292a3e){_0x40445a(_0x3b4d8d,_0x45d5b5)[_0x6d7a('0x22')](function(_0x5341f5){_0x45d5b5[_0x6d7a('0x1a')]=_0x5341f5[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['findOne']({'where':{'phone':_0x45d5b5['phone'],'VoiceQueueId':_0x3b4d8d['id']}})[_0x6d7a('0x22')](function(_0x5d3144){if(!_[_0x6d7a('0x1e')](_0x5d3144)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x26')+_0x3b4d8d['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5['callbackUniqueid']?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'VoiceQueueId':_0x3b4d8d['id']});})[_0x6d7a('0x2c')](function(_0x5857f2){_0x292a3e(_0x5857f2);});});});};var _0x4abe7a=function(_0x5cc373){return new BPromise(function(_0x340d5a,_0x4e441d){_0x40445a(_0x5cc373,_0x45d5b5)[_0x6d7a('0x22')](function(_0x311fdf){_0x45d5b5[_0x6d7a('0x1a')]=_0x311fdf[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['findOne']({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'VoiceQueueId':_0x5cc373['id']}})[_0x6d7a('0x22')](function(_0x207e33){if(!_[_0x6d7a('0x1e')](_0x207e33)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5cc373['id']);}return _0x10d074[_0x6d7a('0x2d')]['findOne']({'where':{'calleridnum':_0x45d5b5[_0x6d7a('0xe')],'VoiceQueueId':_0x5cc373['id']}});})[_0x6d7a('0x22')](function(_0x23a348){if(!_[_0x6d7a('0x1e')](_0x23a348)){throw new Error(_0x6d7a('0x2e')+_0x45d5b5['phone']+_0x6d7a('0x2f')+_0x5cc373['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5['scheduledat']?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5['callbackUniqueid']:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5cc373['id']});})[_0x6d7a('0x2c')](function(_0xb1f58f){_0x4e441d(_0xb1f58f);});});});};function _0x425fab(){return function(_0x38ae4e){logger[_0x6d7a('0x17')]('cmContact',_0x6d7a('0x18'),util[_0x6d7a('0x19')](_0x38ae4e,{'showHidden':![],'depth':null}));};}function _0x3efdd2(_0x3cc3b5,_0x46d852){var _0x3860cf=_0x46d852[_0x6d7a('0x1a')]?_0x46d852['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x421ec4,_0x40b22e){if(_[_0x6d7a('0x1e')](_0x46d852[_0x6d7a('0x1c')])){_0x421ec4({'ret':_0x3860cf});}else{_0x10d074[_0x6d7a('0x30')][_0x6d7a('0x31')]({'where':{'id':_0x3cc3b5['id']}})[_0x6d7a('0x22')](function(_0x9eed96){if(!_[_0x6d7a('0x1e')](_0x9eed96)){var _0x5bbd2e=_0x9eed96[_0x6d7a('0x1c')];if(!_['isNil'](_0x5bbd2e)){var _0x473616=shared[_0x6d7a('0x32')];var _0x3f5f00=_0x473616[_0x5bbd2e];var _0x3fdc72=_0x473616[_0x46d852['dialTimezone']];if(!_[_0x6d7a('0x1e')](_0x3f5f00)&&!_['isNil'](_0x3fdc72)){var _0x256bde=_0x3f5f00[_0x6d7a('0x1f')]-_0x3fdc72['utcOffset'];_0x3860cf=_0x46d852['scheduledat']?_0x46d852['scheduledat']:moment();var _0x171380=moment(_0x3860cf)[_0x6d7a('0x20')](_0x256bde,_0x6d7a('0x21'));_0x421ec4({'ret':_0x171380[_0x6d7a('0x1b')](_0x6d7a('0x2b'))});}else _0x421ec4({'ret':_0x3860cf});}else _0x421ec4({'ret':_0x3860cf});}else{_0x421ec4({'ret':_0x3860cf});}});}});return 0xa;}var _0x5c0be2=function(_0x20117e){return new BPromise(function(_0x1b14bb,_0x20e309){_0x3efdd2(_0x20117e,_0x45d5b5)[_0x6d7a('0x22')](function(_0x532b03){_0x45d5b5[_0x6d7a('0x1a')]=_0x532b03['ret'];_0x10d074['CmHopper'][_0x6d7a('0x31')]({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'CampaignId':_0x20117e['id']}})['then'](function(_0x5735d8){if(!_[_0x6d7a('0x1e')](_0x5735d8)){throw new Error('cmContact,\x20afterCreate\x20'+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x33')+_0x20117e['id']);}return _0x10d074[_0x6d7a('0x24')]['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5['callbackUniqueid']?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x20117e['id']});})[_0x6d7a('0x2c')](function(_0x2a5462){_0x20e309(_0x2a5462);});});});};var _0x9fbe25=function(_0x1bf02a){return new BPromise(function(_0x2b8adb,_0x26b40f){_0x3efdd2(_0x1bf02a,_0x45d5b5)[_0x6d7a('0x22')](function(_0x197741){_0x45d5b5[_0x6d7a('0x1a')]=_0x197741[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')][_0x6d7a('0x31')]({'where':{'phone':_0x45d5b5[_0x6d7a('0xe')],'CampaignId':_0x1bf02a['id']}})['then'](function(_0x2db7ee){if(!_[_0x6d7a('0x1e')](_0x2db7ee)){throw new Error(_0x6d7a('0x25')+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x34')+_0x1bf02a['id']);}return _0x10d074[_0x6d7a('0x2d')][_0x6d7a('0x31')]({'where':{'calleridnum':_0x45d5b5['phone'],'CampaignId':_0x1bf02a['id']}});})[_0x6d7a('0x22')](function(_0x133cd5){if(!_[_0x6d7a('0x1e')](_0x133cd5)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x45d5b5[_0x6d7a('0xe')]+_0x6d7a('0x35')+_0x1bf02a['id']);}return _0x10d074[_0x6d7a('0x24')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')),'callback':_0x45d5b5[_0x6d7a('0x2a')]?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x1bf02a['id']});})[_0x6d7a('0x2c')](function(_0x46a8c2){_0x26b40f(_0x46a8c2);});});});};if(_0x45d5b5[_0x6d7a('0x28')]){_0x10d074[_0x6d7a('0x1d')][_0x6d7a('0x36')]({'where':{'type':_0x6d7a('0x37')},'attributes':['id',_0x6d7a('0x38'),'dialTimezone'],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x3a'),'where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})['then'](function(_0x4b4664){if(_0x4b4664){var _0x1fde38=[];for(var _0x73d701=0x0,_0x39599a;_0x73d701<_0x4b4664[_0x6d7a('0x3b')];_0x73d701+=0x1){_0x39599a=_0x4b4664[_0x73d701][_0x6d7a('0x3c')]({'plain':!![]});switch(_0x39599a[_0x6d7a('0x38')]){case _0x6d7a('0x3d'):_0x4abe7a(_0x39599a)[_0x6d7a('0x2c')](_0x50ee1e());break;case _0x6d7a('0x3e'):_0xf8f269(_0x39599a)[_0x6d7a('0x2c')](_0x50ee1e());break;default:_0x3efdd2(_0x39599a,_0x45d5b5)[_0x6d7a('0x22')](function(_0x4bed5b){_0x45d5b5[_0x6d7a('0x1a')]=_0x4bed5b[_0x6d7a('0x23')];_0x10d074[_0x6d7a('0x24')]['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5[_0x6d7a('0x1a')]:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x45d5b5['priority']?_0x45d5b5[_0x6d7a('0x29')]:0x2,'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5[_0x6d7a('0x2a')]:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()['format'](_0x6d7a('0x2b')):undefined,'VoiceQueueId':_0x39599a['id']})[_0x6d7a('0x2c')](_0x50ee1e());});}}}})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x1d')][_0x6d7a('0x36')]({'where':{'type':_0x6d7a('0x37')},'attributes':['id'],'include':[{'model':_0x10d074['CmList'],'as':'BlackLists','where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})['then'](function(_0xf837a8){if(_0xf837a8){var _0x3ab61e=[];for(var _0x5ec8cd=0x0,_0x1a242e;_0x5ec8cd<_0xf837a8[_0x6d7a('0x3b')];_0x5ec8cd+=0x1){_0x1a242e=_0xf837a8[_0x5ec8cd][_0x6d7a('0x3c')]({'plain':!![]});_0x10d074[_0x6d7a('0x3f')][_0x6d7a('0x27')]({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5['ListId'],'VoiceQueueId':_0x1a242e['id']})[_0x6d7a('0x2c')](function(_0xeb4d2b){logger['error']('cmContact,\x20%s,\x20%s','afterCreate',_0xeb4d2b[_0x6d7a('0x40')]);});}}});})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x30')]['findAll']({'attributes':['id',_0x6d7a('0x38'),_0x6d7a('0x1c')],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x3a'),'where':{'id':_0x45d5b5['ListId']}}]})[_0x6d7a('0x22')](function(_0x5453eb){if(_0x5453eb){var _0x252cad=[];for(var _0x26cea3=0x0,_0x119ae7;_0x26cea3<_0x5453eb['length'];_0x26cea3+=0x1){_0x119ae7=_0x5453eb[_0x26cea3][_0x6d7a('0x3c')]({'plain':!![]});switch(_0x119ae7[_0x6d7a('0x38')]){case _0x6d7a('0x3d'):_0x9fbe25(_0x119ae7)[_0x6d7a('0x2c')](_0x425fab());break;case _0x6d7a('0x3e'):_0x5c0be2(_0x119ae7)[_0x6d7a('0x2c')](_0x425fab());break;default:_0x10d074['CmHopper']['create']({'phone':_0x45d5b5[_0x6d7a('0xe')],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5['ListId'],'scheduledat':_0x45d5b5[_0x6d7a('0x1a')]?_0x45d5b5['scheduledat']:moment()[_0x6d7a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x45d5b5[_0x6d7a('0x29')]?_0x45d5b5[_0x6d7a('0x29')]:0x2,'callback':_0x45d5b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x45d5b5[_0x6d7a('0x2a')]?_0x45d5b5['callbackUniqueid']:undefined,'callbackat':_0x45d5b5[_0x6d7a('0x2a')]?moment()[_0x6d7a('0x1b')](_0x6d7a('0x2b')):undefined,'CampaignId':_0x119ae7['id']})[_0x6d7a('0x2c')](_0x425fab());}}}});})[_0x6d7a('0x22')](function(){return _0x10d074[_0x6d7a('0x30')][_0x6d7a('0x36')]({'attributes':['id'],'include':[{'model':_0x10d074[_0x6d7a('0x39')],'as':_0x6d7a('0x41'),'where':{'id':_0x45d5b5[_0x6d7a('0x28')]}}]})[_0x6d7a('0x22')](function(_0x7b1c75){if(_0x7b1c75){var _0x4b6c52=[];for(var _0x4f3147=0x0,_0xc30f65;_0x4f3147<_0x7b1c75[_0x6d7a('0x3b')];_0x4f3147+=0x1){_0xc30f65=_0x7b1c75[_0x4f3147]['get']({'plain':!![]});_0x10d074[_0x6d7a('0x3f')][_0x6d7a('0x27')]({'phone':_0x45d5b5['phone'],'ContactId':_0x45d5b5['id'],'ListId':_0x45d5b5[_0x6d7a('0x28')],'CampaignId':_0xc30f65['id']})['catch'](function(_0x57147c){logger[_0x6d7a('0x17')](_0x6d7a('0x42'),'afterCreate',_0x57147c['message']);});}}});})['then'](function(){_0x99e5cb();})['catch'](function(_0x360a5c){logger['error']('cmContact,\x20%s,\x20%s',_0x6d7a('0x18'),_0x360a5c['message']);_0x99e5cb(_0x360a5c);});}else{_0x99e5cb(new Error(_0x6d7a('0x43')));}},'afterDestroy':function(_0x21accb,_0x2d3c53,_0xeb867c){var _0x4f5308=_0x47663c['models'];var _0x564c17=_0x21accb[_0x6d7a('0x3c')]({'plain':!![]});return _0x4f5308[_0x6d7a('0x24')][_0x6d7a('0x36')]({'raw':!![],'where':{'ListId':_0x564c17[_0x6d7a('0x28')],'ContactId':_0x564c17['id']}})[_0x6d7a('0x22')](function(_0x3e2582){if(!_[_0x6d7a('0x44')](_0x3e2582)){var _0x1079bd=[];for(var _0x236289=0x0;_0x236289<_0x3e2582[_0x6d7a('0x3b')];_0x236289+=0x1){var _0x18f721=_0x4f5308[_0x6d7a('0x24')][_0x6d7a('0x45')]({'where':{'ListId':_0x3e2582[_0x236289][_0x6d7a('0x28')],'ContactId':_0x3e2582[_0x236289][_0x6d7a('0x46')],'VoiceQueueId':_0x3e2582[_0x236289]['VoiceQueueId'],'CampaignId':_0x3e2582[_0x236289][_0x6d7a('0x47')]}});_0x1079bd['push'](_0x18f721);}return BPromise[_0x6d7a('0x48')](_0x1079bd);}})[_0x6d7a('0x22')](function(_0x12eb1c){logger['info'](_0x6d7a('0x49'),util[_0x6d7a('0x19')](_0x12eb1c,{'showHidden':![],'depth':null}));_0xeb867c();})[_0x6d7a('0x2c')](function(_0x1f2226){logger['error'](_0x6d7a('0x4a'),util[_0x6d7a('0x19')](_0x1f2226,{'showHidden':![],'depth':null}));_0xeb867c(_0x1f2226);});}}});}; \ No newline at end of file +var _0x5927=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','VoiceQueue','findAll','CmList','Lists','length','outbound','BlackLists','CmHopperBlack','error','cmContact,\x20%s,\x20%s','Campaign','dialCheckDuplicateType','always','isEmpty','destroy','ContactId','VoiceQueueId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContact.attributes','exports','CmContact','cm_contacts','phone','firstName','lastName','fax','email','FULLTEXT','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','timezones','utcOffset','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','ret'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5927,0x180));var _0x7592=function(_0x4970d6,_0x2e6b07){_0x4970d6=_0x4970d6-0x0;var _0x2857f3=_0x5927[_0x4970d6];return _0x2857f3;};'use strict';var _=require(_0x7592('0x0'));var util=require(_0x7592('0x1'));var logger=require(_0x7592('0x2'))(_0x7592('0x3'));var moment=require(_0x7592('0x4'));var BPromise=require(_0x7592('0x5'));var rp=require(_0x7592('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7592('0x7'));var config=require(_0x7592('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0x7592('0x9'));module[_0x7592('0xa')]=function(_0x4459eb,_0x91e2d1){return _0x4459eb['define'](_0x7592('0xb'),attributes,{'tableName':_0x7592('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x7592('0xd')]},{'name':'fti_cm_contacts','fields':[_0x7592('0xe'),_0x7592('0xf'),'phone','mobile',_0x7592('0x10'),_0x7592('0x11')],'type':_0x7592('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x7592('0x13'),'hooks':{'afterCreate':function(_0x498d03,_0x1551d9,_0x2ca929){var _0x3dcf7c=_0x4459eb['models'];var _0x11c40a=_0x498d03[_0x7592('0x14')]({'plain':!![]});function _0x2adf4c(){return function(_0x4a733d){logger['error'](_0x7592('0x15'),_0x7592('0x16'),util[_0x7592('0x17')](_0x4a733d,{'showHidden':![],'depth':null}));};}function _0x3bc3a0(_0x45707c,_0x3b71f8){var _0x4572fe=_0x3b71f8[_0x7592('0x18')]?_0x3b71f8['scheduledat']:moment()[_0x7592('0x19')](_0x7592('0x1a'));return new BPromise(function(_0x33c663,_0x27eaf9){if(_[_0x7592('0x1b')](_0x3b71f8[_0x7592('0x1c')])){_0x33c663({'ret':_0x4572fe});}else{_0x3dcf7c['VoiceQueue'][_0x7592('0x1d')]({'where':{'id':_0x45707c['id']}})[_0x7592('0x1e')](function(_0x4fa5ec){if(!_['isNil'](_0x4fa5ec)){var _0x42fa20=_0x4fa5ec[_0x7592('0x1c')];if(!_[_0x7592('0x1b')](_0x42fa20)){var _0x5390c5=shared[_0x7592('0x1f')];var _0x400087=_0x5390c5[_0x42fa20];var _0x2ad898=_0x5390c5[_0x3b71f8[_0x7592('0x1c')]];if(!_[_0x7592('0x1b')](_0x400087)&&!_[_0x7592('0x1b')](_0x2ad898)){var _0xe0f8e2=_0x400087[_0x7592('0x20')]-_0x2ad898[_0x7592('0x20')];_0x4572fe=_0x3b71f8['scheduledat']?_0x3b71f8[_0x7592('0x18')]:moment();var _0x1516f0=moment(_0x4572fe)[_0x7592('0x21')](_0xe0f8e2,_0x7592('0x22'));_0x33c663({'ret':_0x1516f0[_0x7592('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x33c663({'ret':_0x4572fe});}else _0x33c663({'ret':_0x4572fe});}else{_0x33c663({'ret':_0x4572fe});}});}});return 0xa;}var _0x3490cc=function(_0x875b60){return new BPromise(function(_0x46d8da,_0x199ad5){_0x3bc3a0(_0x875b60,_0x11c40a)[_0x7592('0x1e')](function(_0x168997){_0x11c40a[_0x7592('0x18')]=_0x168997['ret'];_0x3dcf7c[_0x7592('0x23')][_0x7592('0x1d')]({'where':{'phone':_0x11c40a['phone'],'VoiceQueueId':_0x875b60['id']}})[_0x7592('0x1e')](function(_0x4708e7){if(!_[_0x7592('0x1b')](_0x4708e7)){throw new Error(_0x7592('0x24')+_0x11c40a[_0x7592('0xd')]+_0x7592('0x25')+_0x875b60['id']);}return _0x3dcf7c[_0x7592('0x23')][_0x7592('0x26')]({'phone':_0x11c40a['phone'],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a['ListId'],'priority':_0x11c40a[_0x7592('0x27')]?_0x11c40a['priority']:0x2,'scheduledat':_0x11c40a[_0x7592('0x18')]?_0x11c40a[_0x7592('0x18')]:moment()[_0x7592('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a[_0x7592('0x28')]?_0x11c40a[_0x7592('0x28')]:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()[_0x7592('0x19')](_0x7592('0x1a')):undefined,'VoiceQueueId':_0x875b60['id']});})['catch'](function(_0x2f967f){_0x199ad5(_0x2f967f);});});});};var _0x3d25c2=function(_0x4a08e5){return new BPromise(function(_0x35b5e3,_0x4954b2){_0x3bc3a0(_0x4a08e5,_0x11c40a)['then'](function(_0x2be923){_0x11c40a['scheduledat']=_0x2be923[_0x7592('0x29')];_0x3dcf7c['CmHopper']['findOne']({'where':{'phone':_0x11c40a[_0x7592('0xd')],'VoiceQueueId':_0x4a08e5['id']}})[_0x7592('0x1e')](function(_0x302b7a){if(!_[_0x7592('0x1b')](_0x302b7a)){throw new Error(_0x7592('0x24')+_0x11c40a[_0x7592('0xd')]+_0x7592('0x2a')+_0x4a08e5['id']);}return _0x3dcf7c[_0x7592('0x2b')][_0x7592('0x1d')]({'where':{'calleridnum':_0x11c40a[_0x7592('0xd')],'VoiceQueueId':_0x4a08e5['id']}});})['then'](function(_0x3c2dcd){if(!_[_0x7592('0x1b')](_0x3c2dcd)){throw new Error(_0x7592('0x2c')+_0x11c40a[_0x7592('0xd')]+_0x7592('0x2d')+_0x4a08e5['id']);}return _0x3dcf7c[_0x7592('0x23')][_0x7592('0x26')]({'phone':_0x11c40a['phone'],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'priority':_0x11c40a[_0x7592('0x27')]?_0x11c40a[_0x7592('0x27')]:0x2,'scheduledat':_0x11c40a[_0x7592('0x18')]?_0x11c40a['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a[_0x7592('0x28')]?_0x11c40a['callbackUniqueid']:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()['format'](_0x7592('0x1a')):undefined,'VoiceQueueId':_0x4a08e5['id']});})[_0x7592('0x2f')](function(_0x3c5821){_0x4954b2(_0x3c5821);});});});};function _0x459fb4(){return function(_0x1f265c){logger['error']('cmContact',_0x7592('0x16'),util['inspect'](_0x1f265c,{'showHidden':![],'depth':null}));};}function _0x15260b(_0x427b60,_0xe2eadc){var _0x27a7a9=_0xe2eadc[_0x7592('0x18')]?_0xe2eadc[_0x7592('0x18')]:moment()[_0x7592('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x38f9f5,_0x171fea){if(_[_0x7592('0x1b')](_0xe2eadc['dialTimezone'])){_0x38f9f5({'ret':_0x27a7a9});}else{_0x3dcf7c['Campaign']['findOne']({'where':{'id':_0x427b60['id']}})[_0x7592('0x1e')](function(_0x459401){if(!_[_0x7592('0x1b')](_0x459401)){var _0x43db7d=_0x459401[_0x7592('0x1c')];if(!_[_0x7592('0x1b')](_0x43db7d)){var _0x7807c9=shared[_0x7592('0x1f')];var _0x558b6a=_0x7807c9[_0x43db7d];var _0x45383c=_0x7807c9[_0xe2eadc[_0x7592('0x1c')]];if(!_['isNil'](_0x558b6a)&&!_[_0x7592('0x1b')](_0x45383c)){var _0x175b83=_0x558b6a[_0x7592('0x20')]-_0x45383c[_0x7592('0x20')];_0x27a7a9=_0xe2eadc[_0x7592('0x18')]?_0xe2eadc['scheduledat']:moment();var _0x211eae=moment(_0x27a7a9)[_0x7592('0x21')](_0x175b83,_0x7592('0x22'));_0x38f9f5({'ret':_0x211eae['format'](_0x7592('0x1a'))});}else _0x38f9f5({'ret':_0x27a7a9});}else _0x38f9f5({'ret':_0x27a7a9});}else{_0x38f9f5({'ret':_0x27a7a9});}});}});return 0xa;}var _0x32fa88=function(_0x461915){return new BPromise(function(_0x3e6c1b,_0x31cb13){_0x15260b(_0x461915,_0x11c40a)[_0x7592('0x1e')](function(_0x5c8183){_0x11c40a[_0x7592('0x18')]=_0x5c8183[_0x7592('0x29')];_0x3dcf7c[_0x7592('0x23')][_0x7592('0x1d')]({'where':{'phone':_0x11c40a[_0x7592('0xd')],'CampaignId':_0x461915['id']}})[_0x7592('0x1e')](function(_0x463443){if(!_[_0x7592('0x1b')](_0x463443)){throw new Error('cmContact,\x20afterCreate\x20'+_0x11c40a[_0x7592('0xd')]+_0x7592('0x30')+_0x461915['id']);}return _0x3dcf7c[_0x7592('0x23')][_0x7592('0x26')]({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'priority':_0x11c40a[_0x7592('0x27')]?_0x11c40a[_0x7592('0x27')]:0x2,'scheduledat':_0x11c40a[_0x7592('0x18')]?_0x11c40a[_0x7592('0x18')]:moment()[_0x7592('0x19')](_0x7592('0x1a')),'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a['callbackUniqueid']?_0x11c40a[_0x7592('0x28')]:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()[_0x7592('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x461915['id']});})[_0x7592('0x2f')](function(_0x2e98fa){_0x31cb13(_0x2e98fa);});});});};var _0x90ccc4=function(_0x5c02bb){return new BPromise(function(_0x106cb2,_0x2c6366){_0x15260b(_0x5c02bb,_0x11c40a)[_0x7592('0x1e')](function(_0xd7087c){_0x11c40a[_0x7592('0x18')]=_0xd7087c[_0x7592('0x29')];_0x3dcf7c['CmHopper'][_0x7592('0x1d')]({'where':{'phone':_0x11c40a[_0x7592('0xd')],'CampaignId':_0x5c02bb['id']}})[_0x7592('0x1e')](function(_0x3638d3){if(!_[_0x7592('0x1b')](_0x3638d3)){throw new Error(_0x7592('0x24')+_0x11c40a['phone']+_0x7592('0x31')+_0x5c02bb['id']);}return _0x3dcf7c[_0x7592('0x2b')][_0x7592('0x1d')]({'where':{'calleridnum':_0x11c40a['phone'],'CampaignId':_0x5c02bb['id']}});})[_0x7592('0x1e')](function(_0x3ef105){if(!_[_0x7592('0x1b')](_0x3ef105)){throw new Error(_0x7592('0x2c')+_0x11c40a[_0x7592('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x5c02bb['id']);}return _0x3dcf7c[_0x7592('0x23')]['create']({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'priority':_0x11c40a['priority']?_0x11c40a[_0x7592('0x27')]:0x2,'scheduledat':_0x11c40a['scheduledat']?_0x11c40a[_0x7592('0x18')]:moment()[_0x7592('0x19')](_0x7592('0x1a')),'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a[_0x7592('0x28')]?_0x11c40a[_0x7592('0x28')]:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()[_0x7592('0x19')](_0x7592('0x1a')):undefined,'CampaignId':_0x5c02bb['id']});})['catch'](function(_0x3b8362){_0x2c6366(_0x3b8362);});});});};if(_0x11c40a['ListId']){_0x3dcf7c[_0x7592('0x32')][_0x7592('0x33')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType',_0x7592('0x1c')],'include':[{'model':_0x3dcf7c[_0x7592('0x34')],'as':_0x7592('0x35'),'where':{'id':_0x11c40a['ListId']}}]})[_0x7592('0x1e')](function(_0x1b9fcf){if(_0x1b9fcf){var _0x3d5308=[];for(var _0x3f8bd0=0x0,_0x38520f;_0x3f8bd0<_0x1b9fcf[_0x7592('0x36')];_0x3f8bd0+=0x1){_0x38520f=_0x1b9fcf[_0x3f8bd0][_0x7592('0x14')]({'plain':!![]});switch(_0x38520f['dialCheckDuplicateType']){case'always':_0x3d25c2(_0x38520f)['catch'](_0x2adf4c());break;case'onlyIfOpen':_0x3490cc(_0x38520f)['catch'](_0x2adf4c());break;default:_0x15260b(_0x38520f,_0x11c40a)[_0x7592('0x1e')](function(_0x16d7c8){_0x11c40a['scheduledat']=_0x16d7c8[_0x7592('0x29')];_0x3dcf7c['CmHopper'][_0x7592('0x26')]({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'scheduledat':_0x11c40a['scheduledat']?_0x11c40a[_0x7592('0x18')]:moment()['format'](_0x7592('0x1a')),'priority':_0x11c40a['priority']?_0x11c40a[_0x7592('0x27')]:0x2,'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a[_0x7592('0x28')]?_0x11c40a[_0x7592('0x28')]:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()[_0x7592('0x19')](_0x7592('0x1a')):undefined,'VoiceQueueId':_0x38520f['id']})[_0x7592('0x2f')](_0x2adf4c());});}}}})[_0x7592('0x1e')](function(){return _0x3dcf7c[_0x7592('0x32')]['findAll']({'where':{'type':_0x7592('0x37')},'attributes':['id'],'include':[{'model':_0x3dcf7c[_0x7592('0x34')],'as':_0x7592('0x38'),'where':{'id':_0x11c40a[_0x7592('0x2e')]}}]})[_0x7592('0x1e')](function(_0x1f685f){if(_0x1f685f){var _0x3727d5=[];for(var _0x59ca3c=0x0,_0x40ce63;_0x59ca3c<_0x1f685f[_0x7592('0x36')];_0x59ca3c+=0x1){_0x40ce63=_0x1f685f[_0x59ca3c][_0x7592('0x14')]({'plain':!![]});_0x3dcf7c[_0x7592('0x39')][_0x7592('0x26')]({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'VoiceQueueId':_0x40ce63['id']})[_0x7592('0x2f')](function(_0x635282){logger[_0x7592('0x3a')](_0x7592('0x3b'),_0x7592('0x16'),_0x635282['message']);});}}});})[_0x7592('0x1e')](function(){return _0x3dcf7c[_0x7592('0x3c')][_0x7592('0x33')]({'attributes':['id',_0x7592('0x3d'),_0x7592('0x1c')],'include':[{'model':_0x3dcf7c[_0x7592('0x34')],'as':'Lists','where':{'id':_0x11c40a['ListId']}}]})[_0x7592('0x1e')](function(_0x238c3d){if(_0x238c3d){var _0x205908=[];for(var _0x57e5ba=0x0,_0x25e791;_0x57e5ba<_0x238c3d[_0x7592('0x36')];_0x57e5ba+=0x1){_0x25e791=_0x238c3d[_0x57e5ba][_0x7592('0x14')]({'plain':!![]});switch(_0x25e791[_0x7592('0x3d')]){case _0x7592('0x3e'):_0x90ccc4(_0x25e791)['catch'](_0x459fb4());break;case'onlyIfOpen':_0x32fa88(_0x25e791)[_0x7592('0x2f')](_0x459fb4());break;default:_0x3dcf7c['CmHopper'][_0x7592('0x26')]({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'scheduledat':_0x11c40a[_0x7592('0x18')]?_0x11c40a[_0x7592('0x18')]:moment()['format'](_0x7592('0x1a')),'priority':_0x11c40a[_0x7592('0x27')]?_0x11c40a[_0x7592('0x27')]:0x2,'callback':_0x11c40a[_0x7592('0x28')]?!![]:![],'callbackuniqueid':_0x11c40a[_0x7592('0x28')]?_0x11c40a['callbackUniqueid']:undefined,'callbackat':_0x11c40a[_0x7592('0x28')]?moment()[_0x7592('0x19')](_0x7592('0x1a')):undefined,'CampaignId':_0x25e791['id']})[_0x7592('0x2f')](_0x459fb4());}}}});})[_0x7592('0x1e')](function(){return _0x3dcf7c[_0x7592('0x3c')][_0x7592('0x33')]({'attributes':['id'],'include':[{'model':_0x3dcf7c[_0x7592('0x34')],'as':_0x7592('0x38'),'where':{'id':_0x11c40a[_0x7592('0x2e')]}}]})['then'](function(_0x1253c7){if(_0x1253c7){var _0x43c187=[];for(var _0x14e463=0x0,_0x549ccd;_0x14e463<_0x1253c7[_0x7592('0x36')];_0x14e463+=0x1){_0x549ccd=_0x1253c7[_0x14e463][_0x7592('0x14')]({'plain':!![]});_0x3dcf7c['CmHopperBlack'][_0x7592('0x26')]({'phone':_0x11c40a[_0x7592('0xd')],'ContactId':_0x11c40a['id'],'ListId':_0x11c40a[_0x7592('0x2e')],'CampaignId':_0x549ccd['id']})[_0x7592('0x2f')](function(_0x3e1670){logger[_0x7592('0x3a')]('cmContact,\x20%s,\x20%s',_0x7592('0x16'),_0x3e1670['message']);});}}});})[_0x7592('0x1e')](function(){_0x2ca929();})[_0x7592('0x2f')](function(_0x11ba0f){logger[_0x7592('0x3a')](_0x7592('0x3b'),_0x7592('0x16'),_0x11ba0f['message']);_0x2ca929(_0x11ba0f);});}else{_0x2ca929(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x204e00,_0x27a7af,_0x22e461){var _0x45c9a7=_0x4459eb['models'];var _0x3d253e=_0x204e00[_0x7592('0x14')]({'plain':!![]});return _0x45c9a7[_0x7592('0x23')][_0x7592('0x33')]({'raw':!![],'where':{'ListId':_0x3d253e[_0x7592('0x2e')],'ContactId':_0x3d253e['id']}})[_0x7592('0x1e')](function(_0x238ca2){if(!_[_0x7592('0x3f')](_0x238ca2)){var _0x484f84=[];for(var _0x1a0765=0x0;_0x1a0765<_0x238ca2[_0x7592('0x36')];_0x1a0765+=0x1){var _0x56bc9e=_0x45c9a7[_0x7592('0x23')][_0x7592('0x40')]({'where':{'ListId':_0x238ca2[_0x1a0765]['ListId'],'ContactId':_0x238ca2[_0x1a0765][_0x7592('0x41')],'VoiceQueueId':_0x238ca2[_0x1a0765][_0x7592('0x42')],'CampaignId':_0x238ca2[_0x1a0765]['CampaignId']}});_0x484f84[_0x7592('0x43')](_0x56bc9e);}return BPromise[_0x7592('0x44')](_0x484f84);}})['then'](function(_0x218df5){logger['info'](_0x7592('0x45'),util[_0x7592('0x17')](_0x218df5,{'showHidden':![],'depth':null}));_0x22e461();})['catch'](function(_0x16afeb){logger[_0x7592('0x3a')](_0x7592('0x46'),util[_0x7592('0x17')](_0x16afeb,{'showHidden':![],'depth':null}));_0x22e461(_0x16afeb);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d770ac1..e1d9fca 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(_0x485980,_0x116f6a){var _0x2af559=function(_0x3947d0){while(--_0x3947d0){_0x485980['push'](_0x485980['shift']());}};_0x2af559(++_0x116f6a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x34e533,_0x267e79){var _0xfd690c=function(_0x2ca6a4){while(--_0x2ca6a4){_0x34e533['push'](_0x34e533['shift']());}};_0xfd690c(++_0x267e79);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 ae3ce9e..c91f10d 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 _0xde64=['sequelize','exports','INTEGER','STRING'];(function(_0x203e10,_0x57832f){var _0x1f8e7a=function(_0x5d3d62){while(--_0x5d3d62){_0x203e10['push'](_0x203e10['shift']());}};_0x1f8e7a(++_0x57832f);}(_0xde64,0x17c));var _0x4de6=function(_0x5668dc,_0x241126){_0x5668dc=_0x5668dc-0x0;var _0xd8a94c=_0xde64[_0x5668dc];return _0xd8a94c;};'use strict';var Sequelize=require(_0x4de6('0x0'));module[_0x4de6('0x1')]={'CmContactId':{'type':Sequelize[_0x4de6('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x4de6('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x4de6('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x39cb=['STRING','exports','INTEGER'];(function(_0x4ae5be,_0x354bd2){var _0x4c15ec=function(_0x5a9b38){while(--_0x5a9b38){_0x4ae5be['push'](_0x4ae5be['shift']());}};_0x4c15ec(++_0x354bd2);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0xb39c('0x0')]={'CmContactId':{'type':Sequelize[_0xb39c('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb39c('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb39c('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xb39c('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xb39c('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 b7e3e2c..61f5d9f 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 _0x11af=['send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','keys','includeAll','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','name'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x11af,0x184));var _0xf11a=function(_0x1ecd20,_0x3f7f6f){_0x1ecd20=_0x1ecd20-0x0;var _0x312a78=_0x11af[_0x1ecd20];return _0x312a78;};'use strict';var emlformat=require(_0xf11a('0x0'));var rimraf=require(_0xf11a('0x1'));var zipdir=require(_0xf11a('0x2'));var jsonpatch=require(_0xf11a('0x3'));var rp=require(_0xf11a('0x4'));var moment=require(_0xf11a('0x5'));var BPromise=require(_0xf11a('0x6'));var Mustache=require(_0xf11a('0x7'));var util=require(_0xf11a('0x8'));var path=require(_0xf11a('0x9'));var sox=require('sox');var csv=require(_0xf11a('0xa'));var ejs=require(_0xf11a('0xb'));var fs=require('fs');var fs_extra=require(_0xf11a('0xc'));var _=require(_0xf11a('0xd'));var squel=require(_0xf11a('0xe'));var crypto=require(_0xf11a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf11a('0x10'));var toCsv=require(_0xf11a('0xa'));var querystring=require(_0xf11a('0x11'));var Papa=require('papaparse');var Redis=require(_0xf11a('0x12'));var authService=require(_0xf11a('0x13'));var qs=require(_0xf11a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf11a('0x15'));var logger=require(_0xf11a('0x16'))(_0xf11a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf11a('0x18'));var db=require(_0xf11a('0x19'))['db'];function respondWithStatusCode(_0x31b3a5,_0x4234f8){_0x4234f8=_0x4234f8||0xcc;return function(_0x315131){if(_0x315131){return _0x31b3a5[_0xf11a('0x1a')](_0x4234f8);}return _0x31b3a5[_0xf11a('0x1b')](_0x4234f8)[_0xf11a('0x1c')]();};}function respondWithResult(_0x3d0f81,_0x1f2f57){_0x1f2f57=_0x1f2f57||0xc8;return function(_0x595020){if(_0x595020){return _0x3d0f81[_0xf11a('0x1b')](_0x1f2f57)[_0xf11a('0x1d')](_0x595020);}};}function respondWithFilteredResult(_0x40c762,_0x5eda80){return function(_0x2ee0cc){if(_0x2ee0cc){var _0x1c3214=typeof _0x5eda80[_0xf11a('0x1e')]==='undefined'&&typeof _0x5eda80[_0xf11a('0x1f')]===_0xf11a('0x20');var _0x43fc1c=_0x2ee0cc[_0xf11a('0x21')];var _0x2e0a22=_0x1c3214?0x0:_0x5eda80[_0xf11a('0x1e')];var _0x2cd908=_0x1c3214?_0x2ee0cc['count']:_0x5eda80[_0xf11a('0x1e')]+_0x5eda80['limit'];var _0x1a2b79;if(_0x2cd908>=_0x43fc1c){_0x2cd908=_0x43fc1c;_0x1a2b79=0xc8;}else{_0x1a2b79=0xce;}_0x40c762[_0xf11a('0x1b')](_0x1a2b79);return _0x40c762[_0xf11a('0x22')](_0xf11a('0x23'),_0x2e0a22+'-'+_0x2cd908+'/'+_0x43fc1c)[_0xf11a('0x1d')](_0x2ee0cc);}return null;};}function patchUpdates(_0x82511){return function(_0x50cdcb){try{jsonpatch[_0xf11a('0x24')](_0x50cdcb,_0x82511,!![]);}catch(_0x1584c8){return BPromise[_0xf11a('0x25')](_0x1584c8);}return _0x50cdcb[_0xf11a('0x26')]();};}function saveUpdates(_0x26a644,_0x249267){return function(_0x3f68a1){if(_0x3f68a1){return _0x3f68a1[_0xf11a('0x27')](_0x26a644)[_0xf11a('0x28')](function(_0x1cfdef){return _0x1cfdef;});}return null;};}function removeEntity(_0x56ba1c,_0x5b0de7){return function(_0x47bfe1){if(_0x47bfe1){return _0x47bfe1[_0xf11a('0x29')]()[_0xf11a('0x28')](function(){var _0x3ffe8b=_0x47bfe1[_0xf11a('0x2a')]({'plain':!![]});var _0xb7948b=_0xf11a('0x2b');return db[_0xf11a('0x2c')][_0xf11a('0x29')]({'where':{'type':_0xb7948b,'resourceId':_0x3ffe8b['id']}})['then'](function(){return _0x47bfe1;});})[_0xf11a('0x28')](function(){_0x56ba1c[_0xf11a('0x1b')](0xcc)[_0xf11a('0x1c')]();});}};}function handleEntityNotFound(_0x3a1149,_0x180003){return function(_0x1ff67d){if(!_0x1ff67d){_0x3a1149['sendStatus'](0x194);}return _0x1ff67d;};}function handleError(_0x2e791e,_0x196787){_0x196787=_0x196787||0x1f4;return function(_0x44c9e5){logger[_0xf11a('0x2d')](_0x44c9e5['stack']);if(_0x44c9e5[_0xf11a('0x2e')]){delete _0x44c9e5[_0xf11a('0x2e')];}_0x2e791e[_0xf11a('0x1b')](_0x196787)[_0xf11a('0x2f')](_0x44c9e5);};}exports[_0xf11a('0x30')]=function(_0x400309,_0x21267){var _0x11b513={},_0x4de448={},_0x15c868={'count':0x0,'rows':[]};var _0x12b847=_[_0xf11a('0x31')](db[_0xf11a('0x32')][_0xf11a('0x33')],function(_0x406dc2){return{'name':_0x406dc2[_0xf11a('0x34')],'type':_0x406dc2[_0xf11a('0x35')][_0xf11a('0x36')]};});_0x4de448['model']=_[_0xf11a('0x31')](_0x12b847,'name');_0x4de448['query']=_['keys'](_0x400309[_0xf11a('0x37')]);_0x4de448[_0xf11a('0x38')]=_[_0xf11a('0x39')](_0x4de448[_0xf11a('0x3a')],_0x4de448[_0xf11a('0x37')]);_0x11b513[_0xf11a('0x3b')]=_[_0xf11a('0x39')](_0x4de448[_0xf11a('0x3a')],qs[_0xf11a('0x3c')](_0x400309[_0xf11a('0x37')][_0xf11a('0x3c')]));_0x11b513['attributes']=_0x11b513[_0xf11a('0x3b')][_0xf11a('0x3d')]?_0x11b513[_0xf11a('0x3b')]:_0x4de448[_0xf11a('0x3a')];if(!_0x400309[_0xf11a('0x37')]['hasOwnProperty'](_0xf11a('0x3e'))){_0x11b513[_0xf11a('0x1f')]=qs[_0xf11a('0x1f')](_0x400309[_0xf11a('0x37')][_0xf11a('0x1f')]);_0x11b513['offset']=qs[_0xf11a('0x1e')](_0x400309[_0xf11a('0x37')][_0xf11a('0x1e')]);}_0x11b513['order']=qs[_0xf11a('0x3f')](_0x400309['query']['sort']);_0x11b513[_0xf11a('0x40')]=qs[_0xf11a('0x38')](_[_0xf11a('0x41')](_0x400309['query'],_0x4de448[_0xf11a('0x38')]),_0x12b847);if(_0x400309[_0xf11a('0x37')][_0xf11a('0x42')]){_0x11b513['where']=_[_0xf11a('0x43')](_0x11b513['where'],{'$or':_[_0xf11a('0x31')](_0x12b847,function(_0x67e37e){if(_0x67e37e['type']!==_0xf11a('0x44')){var _0x121d30={};_0x121d30[_0x67e37e[_0xf11a('0x2e')]]={'$like':'%'+_0x400309[_0xf11a('0x37')][_0xf11a('0x42')]+'%'};return _0x121d30;}})});}_0x11b513=_[_0xf11a('0x43')]({},_0x11b513,_0x400309['options']);var _0x46704e={'where':_0x11b513[_0xf11a('0x40')]};return db[_0xf11a('0x32')][_0xf11a('0x21')](_0x46704e)[_0xf11a('0x28')](function(_0x194480){_0x15c868['count']=_0x194480;if(_0x400309[_0xf11a('0x37')]['includeAll']){_0x11b513[_0xf11a('0x45')]=[{'all':!![]}];}return db[_0xf11a('0x32')][_0xf11a('0x46')](_0x11b513);})['then'](function(_0x5f59c3){_0x15c868['rows']=_0x5f59c3;return _0x15c868;})[_0xf11a('0x28')](respondWithFilteredResult(_0x21267,_0x11b513))[_0xf11a('0x47')](handleError(_0x21267,null));};exports[_0xf11a('0x48')]=function(_0x867a5e,_0x504042){var _0x288e17={'raw':!![],'where':{'id':_0x867a5e['params']['id']}},_0x20ed97={};_0x20ed97['model']=_[_0xf11a('0x49')](db['CmContactHasItem'][_0xf11a('0x33')]);_0x20ed97['query']=_[_0xf11a('0x49')](_0x867a5e['query']);_0x20ed97[_0xf11a('0x38')]=_[_0xf11a('0x39')](_0x20ed97[_0xf11a('0x3a')],_0x20ed97[_0xf11a('0x37')]);_0x288e17['attributes']=_[_0xf11a('0x39')](_0x20ed97[_0xf11a('0x3a')],qs[_0xf11a('0x3c')](_0x867a5e[_0xf11a('0x37')][_0xf11a('0x3c')]));_0x288e17[_0xf11a('0x3b')]=_0x288e17[_0xf11a('0x3b')]['length']?_0x288e17[_0xf11a('0x3b')]:_0x20ed97[_0xf11a('0x3a')];if(_0x867a5e[_0xf11a('0x37')][_0xf11a('0x4a')]){_0x288e17[_0xf11a('0x45')]=[{'all':!![]}];}_0x288e17=_[_0xf11a('0x43')]({},_0x288e17,_0x867a5e[_0xf11a('0x4b')]);return db[_0xf11a('0x32')]['find'](_0x288e17)[_0xf11a('0x28')](handleEntityNotFound(_0x504042,null))['then'](respondWithResult(_0x504042,null))[_0xf11a('0x47')](handleError(_0x504042,null));};exports['create']=function(_0x4dff0a,_0x5a219c){return db[_0xf11a('0x32')]['create'](_0x4dff0a[_0xf11a('0x4c')],{})['then'](function(_0x4ab8cf){var _0x50e207=_0x4dff0a[_0xf11a('0x4d')]['get']({'plain':!![]});if(!_0x50e207)throw new Error(_0xf11a('0x4e'));if(_0x50e207[_0xf11a('0x4f')]===_0xf11a('0x4d')){var _0x3ca767=_0x4ab8cf['get']({'plain':!![]});var _0x5b9ea1=_0xf11a('0x2b');return db[_0xf11a('0x50')][_0xf11a('0x51')]({'where':{'name':_0x5b9ea1,'userProfileId':_0x50e207[_0xf11a('0x52')]},'raw':!![]})[_0xf11a('0x28')](function(_0x5a40d7){if(_0x5a40d7&&_0x5a40d7[_0xf11a('0x53')]===0x0){return db['UserProfileResource'][_0xf11a('0x54')]({'name':_0x3ca767['name'],'resourceId':_0x3ca767['id'],'type':_0x5a40d7['name'],'sectionId':_0x5a40d7['id']},{})['then'](function(){return _0x4ab8cf;});}else{return _0x4ab8cf;}})['catch'](function(_0x17ae6f){logger[_0xf11a('0x2d')](_0xf11a('0x55'),_0x17ae6f);throw _0x17ae6f;});}return _0x4ab8cf;})[_0xf11a('0x28')](respondWithResult(_0x5a219c,0xc9))[_0xf11a('0x47')](handleError(_0x5a219c,null));};exports[_0xf11a('0x27')]=function(_0x3d5463,_0x4a7fdb){if(_0x3d5463[_0xf11a('0x4c')]['id']){delete _0x3d5463[_0xf11a('0x4c')]['id'];}return db[_0xf11a('0x32')][_0xf11a('0x51')]({'where':{'id':_0x3d5463[_0xf11a('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a7fdb,null))['then'](saveUpdates(_0x3d5463[_0xf11a('0x4c')],null))[_0xf11a('0x28')](respondWithResult(_0x4a7fdb,null))[_0xf11a('0x47')](handleError(_0x4a7fdb,null));};exports['destroy']=function(_0x59c6e6,_0x2f65c8){return db[_0xf11a('0x32')][_0xf11a('0x51')]({'where':{'id':_0x59c6e6['params']['id']}})[_0xf11a('0x28')](handleEntityNotFound(_0x2f65c8,null))['then'](removeEntity(_0x2f65c8,null))['catch'](handleError(_0x2f65c8,null));}; \ No newline at end of file +var _0xfc86=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','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','sendStatus','status','json','offset','undefined','count','apply','reject','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','map','CmContactHasItem','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','catch','create','user','role','UserProfileSection'];(function(_0x2119fe,_0x527848){var _0x57e9be=function(_0xbe38a2){while(--_0xbe38a2){_0x2119fe['push'](_0x2119fe['shift']());}};_0x57e9be(++_0x527848);}(_0xfc86,0x195));var _0x6fc8=function(_0x4965d1,_0xb546d4){_0x4965d1=_0x4965d1-0x0;var _0x59e849=_0xfc86[_0x4965d1];return _0x59e849;};'use strict';var emlformat=require(_0x6fc8('0x0'));var rimraf=require(_0x6fc8('0x1'));var zipdir=require(_0x6fc8('0x2'));var jsonpatch=require(_0x6fc8('0x3'));var rp=require(_0x6fc8('0x4'));var moment=require(_0x6fc8('0x5'));var BPromise=require(_0x6fc8('0x6'));var Mustache=require(_0x6fc8('0x7'));var util=require(_0x6fc8('0x8'));var path=require('path');var sox=require(_0x6fc8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fc8('0xa'));var _=require('lodash');var squel=require(_0x6fc8('0xb'));var crypto=require(_0x6fc8('0xc'));var jsforce=require(_0x6fc8('0xd'));var deskjs=require(_0x6fc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6fc8('0xf'));var Papa=require(_0x6fc8('0x10'));var Redis=require(_0x6fc8('0x11'));var authService=require(_0x6fc8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6fc8('0x13'));var hardwareService=require(_0x6fc8('0x14'));var logger=require(_0x6fc8('0x15'))('api');var utils=require(_0x6fc8('0x16'));var config=require(_0x6fc8('0x17'));var licenseUtil=require(_0x6fc8('0x18'));var db=require(_0x6fc8('0x19'))['db'];function respondWithStatusCode(_0xeb0280,_0x521d5d){_0x521d5d=_0x521d5d||0xcc;return function(_0x176f6e){if(_0x176f6e){return _0xeb0280[_0x6fc8('0x1a')](_0x521d5d);}return _0xeb0280[_0x6fc8('0x1b')](_0x521d5d)['end']();};}function respondWithResult(_0x57b5ca,_0x35d382){_0x35d382=_0x35d382||0xc8;return function(_0x5e4c8a){if(_0x5e4c8a){return _0x57b5ca[_0x6fc8('0x1b')](_0x35d382)[_0x6fc8('0x1c')](_0x5e4c8a);}};}function respondWithFilteredResult(_0x2662fa,_0x1a2858){return function(_0x416659){if(_0x416659){var _0x21ffd9=typeof _0x1a2858[_0x6fc8('0x1d')]===_0x6fc8('0x1e')&&typeof _0x1a2858['limit']===_0x6fc8('0x1e');var _0x97a716=_0x416659[_0x6fc8('0x1f')];var _0x3e9547=_0x21ffd9?0x0:_0x1a2858['offset'];var _0x1af89a=_0x21ffd9?_0x416659[_0x6fc8('0x1f')]:_0x1a2858['offset']+_0x1a2858['limit'];var _0xfc212b;if(_0x1af89a>=_0x97a716){_0x1af89a=_0x97a716;_0xfc212b=0xc8;}else{_0xfc212b=0xce;}_0x2662fa[_0x6fc8('0x1b')](_0xfc212b);return _0x2662fa['set']('Content-Range',_0x3e9547+'-'+_0x1af89a+'/'+_0x97a716)[_0x6fc8('0x1c')](_0x416659);}return null;};}function patchUpdates(_0x2919f2){return function(_0x36a1cf){try{jsonpatch[_0x6fc8('0x20')](_0x36a1cf,_0x2919f2,!![]);}catch(_0xd4266c){return BPromise[_0x6fc8('0x21')](_0xd4266c);}return _0x36a1cf['save']();};}function saveUpdates(_0xd4ad8f,_0x567273){return function(_0x25f1af){if(_0x25f1af){return _0x25f1af['update'](_0xd4ad8f)[_0x6fc8('0x22')](function(_0xc67f6c){return _0xc67f6c;});}return null;};}function removeEntity(_0x19b652,_0x293ccf){return function(_0x22ae5c){if(_0x22ae5c){return _0x22ae5c[_0x6fc8('0x23')]()['then'](function(){var _0x157cd2=_0x22ae5c[_0x6fc8('0x24')]({'plain':!![]});var _0x5b56b4=_0x6fc8('0x25');return db[_0x6fc8('0x26')][_0x6fc8('0x23')]({'where':{'type':_0x5b56b4,'resourceId':_0x157cd2['id']}})[_0x6fc8('0x22')](function(){return _0x22ae5c;});})[_0x6fc8('0x22')](function(){_0x19b652[_0x6fc8('0x1b')](0xcc)[_0x6fc8('0x27')]();});}};}function handleEntityNotFound(_0x622e8b,_0x12e39b){return function(_0x54c31b){if(!_0x54c31b){_0x622e8b[_0x6fc8('0x1a')](0x194);}return _0x54c31b;};}function handleError(_0x48adcf,_0x56f5d0){_0x56f5d0=_0x56f5d0||0x1f4;return function(_0xac5817){logger[_0x6fc8('0x28')](_0xac5817[_0x6fc8('0x29')]);if(_0xac5817[_0x6fc8('0x2a')]){delete _0xac5817[_0x6fc8('0x2a')];}_0x48adcf[_0x6fc8('0x1b')](_0x56f5d0)['send'](_0xac5817);};}exports['index']=function(_0x4b3fa4,_0x254dd6){var _0x4440d3={},_0x24ab59={},_0xf54d47={'count':0x0,'rows':[]};var _0x4ccf8f=_[_0x6fc8('0x2b')](db[_0x6fc8('0x2c')][_0x6fc8('0x2d')],function(_0x4d3671){return{'name':_0x4d3671[_0x6fc8('0x2e')],'type':_0x4d3671['type'][_0x6fc8('0x2f')]};});_0x24ab59['model']=_[_0x6fc8('0x2b')](_0x4ccf8f,_0x6fc8('0x2a'));_0x24ab59['query']=_['keys'](_0x4b3fa4[_0x6fc8('0x30')]);_0x24ab59[_0x6fc8('0x31')]=_[_0x6fc8('0x32')](_0x24ab59[_0x6fc8('0x33')],_0x24ab59['query']);_0x4440d3[_0x6fc8('0x34')]=_[_0x6fc8('0x32')](_0x24ab59[_0x6fc8('0x33')],qs['fields'](_0x4b3fa4['query'][_0x6fc8('0x35')]));_0x4440d3[_0x6fc8('0x34')]=_0x4440d3[_0x6fc8('0x34')][_0x6fc8('0x36')]?_0x4440d3[_0x6fc8('0x34')]:_0x24ab59[_0x6fc8('0x33')];if(!_0x4b3fa4[_0x6fc8('0x30')]['hasOwnProperty'](_0x6fc8('0x37'))){_0x4440d3['limit']=qs['limit'](_0x4b3fa4[_0x6fc8('0x30')]['limit']);_0x4440d3['offset']=qs[_0x6fc8('0x1d')](_0x4b3fa4[_0x6fc8('0x30')][_0x6fc8('0x1d')]);}_0x4440d3['order']=qs['sort'](_0x4b3fa4[_0x6fc8('0x30')][_0x6fc8('0x38')]);_0x4440d3[_0x6fc8('0x39')]=qs[_0x6fc8('0x31')](_[_0x6fc8('0x3a')](_0x4b3fa4['query'],_0x24ab59['filters']),_0x4ccf8f);if(_0x4b3fa4[_0x6fc8('0x30')][_0x6fc8('0x3b')]){_0x4440d3[_0x6fc8('0x39')]=_[_0x6fc8('0x3c')](_0x4440d3[_0x6fc8('0x39')],{'$or':_['map'](_0x4ccf8f,function(_0x5aaba4){if(_0x5aaba4[_0x6fc8('0x3d')]!==_0x6fc8('0x3e')){var _0x33613f={};_0x33613f[_0x5aaba4[_0x6fc8('0x2a')]]={'$like':'%'+_0x4b3fa4[_0x6fc8('0x30')][_0x6fc8('0x3b')]+'%'};return _0x33613f;}})});}_0x4440d3=_[_0x6fc8('0x3c')]({},_0x4440d3,_0x4b3fa4[_0x6fc8('0x3f')]);var _0x1d2d80={'where':_0x4440d3[_0x6fc8('0x39')]};return db['CmContactHasItem'][_0x6fc8('0x1f')](_0x1d2d80)[_0x6fc8('0x22')](function(_0x28f546){_0xf54d47[_0x6fc8('0x1f')]=_0x28f546;if(_0x4b3fa4[_0x6fc8('0x30')][_0x6fc8('0x40')]){_0x4440d3[_0x6fc8('0x41')]=[{'all':!![]}];}return db[_0x6fc8('0x2c')]['findAll'](_0x4440d3);})[_0x6fc8('0x22')](function(_0x1193b1){_0xf54d47[_0x6fc8('0x42')]=_0x1193b1;return _0xf54d47;})[_0x6fc8('0x22')](respondWithFilteredResult(_0x254dd6,_0x4440d3))['catch'](handleError(_0x254dd6,null));};exports[_0x6fc8('0x43')]=function(_0x3e2109,_0x7ee1fe){var _0x5452c2={'raw':!![],'where':{'id':_0x3e2109[_0x6fc8('0x44')]['id']}},_0x2feaa1={};_0x2feaa1['model']=_['keys'](db[_0x6fc8('0x2c')]['rawAttributes']);_0x2feaa1['query']=_[_0x6fc8('0x45')](_0x3e2109[_0x6fc8('0x30')]);_0x2feaa1['filters']=_[_0x6fc8('0x32')](_0x2feaa1[_0x6fc8('0x33')],_0x2feaa1[_0x6fc8('0x30')]);_0x5452c2[_0x6fc8('0x34')]=_['intersection'](_0x2feaa1['model'],qs['fields'](_0x3e2109[_0x6fc8('0x30')][_0x6fc8('0x35')]));_0x5452c2['attributes']=_0x5452c2[_0x6fc8('0x34')][_0x6fc8('0x36')]?_0x5452c2[_0x6fc8('0x34')]:_0x2feaa1[_0x6fc8('0x33')];if(_0x3e2109[_0x6fc8('0x30')][_0x6fc8('0x40')]){_0x5452c2[_0x6fc8('0x41')]=[{'all':!![]}];}_0x5452c2=_[_0x6fc8('0x3c')]({},_0x5452c2,_0x3e2109[_0x6fc8('0x3f')]);return db['CmContactHasItem']['find'](_0x5452c2)[_0x6fc8('0x22')](handleEntityNotFound(_0x7ee1fe,null))['then'](respondWithResult(_0x7ee1fe,null))[_0x6fc8('0x46')](handleError(_0x7ee1fe,null));};exports['create']=function(_0x1c808c,_0x4703a5){return db[_0x6fc8('0x2c')][_0x6fc8('0x47')](_0x1c808c['body'],{})[_0x6fc8('0x22')](function(_0x4c2873){var _0x58958c=_0x1c808c[_0x6fc8('0x48')][_0x6fc8('0x24')]({'plain':!![]});if(!_0x58958c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58958c[_0x6fc8('0x49')]===_0x6fc8('0x48')){var _0x4de812=_0x4c2873[_0x6fc8('0x24')]({'plain':!![]});var _0x262d75=_0x6fc8('0x25');return db[_0x6fc8('0x4a')]['find']({'where':{'name':_0x262d75,'userProfileId':_0x58958c['userProfileId']},'raw':!![]})[_0x6fc8('0x22')](function(_0x440fb8){if(_0x440fb8&&_0x440fb8[_0x6fc8('0x4b')]===0x0){return db[_0x6fc8('0x26')][_0x6fc8('0x47')]({'name':_0x4de812[_0x6fc8('0x2a')],'resourceId':_0x4de812['id'],'type':_0x440fb8['name'],'sectionId':_0x440fb8['id']},{})['then'](function(){return _0x4c2873;});}else{return _0x4c2873;}})['catch'](function(_0x2f5249){logger[_0x6fc8('0x28')](_0x6fc8('0x4c'),_0x2f5249);throw _0x2f5249;});}return _0x4c2873;})[_0x6fc8('0x22')](respondWithResult(_0x4703a5,0xc9))[_0x6fc8('0x46')](handleError(_0x4703a5,null));};exports[_0x6fc8('0x4d')]=function(_0x33b7ba,_0x211e0a){if(_0x33b7ba['body']['id']){delete _0x33b7ba[_0x6fc8('0x4e')]['id'];}return db['CmContactHasItem'][_0x6fc8('0x4f')]({'where':{'id':_0x33b7ba[_0x6fc8('0x44')]['id']}})[_0x6fc8('0x22')](handleEntityNotFound(_0x211e0a,null))[_0x6fc8('0x22')](saveUpdates(_0x33b7ba[_0x6fc8('0x4e')],null))[_0x6fc8('0x22')](respondWithResult(_0x211e0a,null))[_0x6fc8('0x46')](handleError(_0x211e0a,null));};exports[_0x6fc8('0x23')]=function(_0x417ec0,_0x5eb0bb){return db[_0x6fc8('0x2c')]['find']({'where':{'id':_0x417ec0[_0x6fc8('0x44')]['id']}})[_0x6fc8('0x22')](handleEntityNotFound(_0x5eb0bb,null))[_0x6fc8('0x22')](removeEntity(_0x5eb0bb,null))[_0x6fc8('0x46')](handleError(_0x5eb0bb,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 18a131c..25da313 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 _0x2c38=['cm_contact_has_items','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem'];(function(_0x121b17,_0x3f519b){var _0x2e587a=function(_0x388752){while(--_0x388752){_0x121b17['push'](_0x121b17['shift']());}};_0x2e587a(++_0x3f519b);}(_0x2c38,0x109));var _0x82c3=function(_0x3575ed,_0x3294bb){_0x3575ed=_0x3575ed-0x0;var _0x36cb29=_0x2c38[_0x3575ed];return _0x36cb29;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82c3('0x2'));var BPromise=require(_0x82c3('0x3'));var rp=require(_0x82c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var attributes=require(_0x82c3('0x7'));module[_0x82c3('0x8')]=function(_0x72ba87,_0x1c760f){return _0x72ba87['define'](_0x82c3('0x9'),attributes,{'tableName':_0x82c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccdf=['lodash','util','api','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','cm_contact_has_items'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xccdf,0xbe));var _0xfccd=function(_0x4379a9,_0x438079){_0x4379a9=_0x4379a9-0x0;var _0xe72685=_0xccdf[_0x4379a9];return _0xe72685;};'use strict';var _=require(_0xfccd('0x0'));var util=require(_0xfccd('0x1'));var logger=require('../../config/logger')(_0xfccd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfccd('0x3'));var fs=require('fs');var path=require(_0xfccd('0x4'));var rimraf=require('rimraf');var config=require(_0xfccd('0x5'));var attributes=require(_0xfccd('0x6'));module[_0xfccd('0x7')]=function(_0x9485cf,_0x523c54){return _0x9485cf[_0xfccd('0x8')]('CmContactHasItem',attributes,{'tableName':_0xfccd('0x9'),'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 b943147..6a6250d 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 _0x5cb0=['info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0x43f4c2,_0x1055c1){var _0x4bd654=function(_0x529e52){while(--_0x529e52){_0x43f4c2['push'](_0x43f4c2['shift']());}};_0x4bd654(++_0x1055c1);}(_0x5cb0,0x106));var _0x05cb=function(_0x2b9cbc,_0x4209b0){_0x2b9cbc=_0x2b9cbc-0x0;var _0xc91b75=_0x5cb0[_0x2b9cbc];return _0xc91b75;};'use strict';var _=require(_0x05cb('0x0'));var util=require(_0x05cb('0x1'));var moment=require(_0x05cb('0x2'));var BPromise=require(_0x05cb('0x3'));var rs=require(_0x05cb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05cb('0x6'));var config=require(_0x05cb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x05cb('0x8')][_0x05cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14dd9a,_0x4830cd,_0x580d4a){return new BPromise(function(_0x5137f8,_0x177645){return client[_0x05cb('0xa')](_0x14dd9a,_0x580d4a)['then'](function(_0x14edf0){logger[_0x05cb('0xb')](_0x05cb('0xc'),_0x4830cd,'request\x20sent');logger[_0x05cb('0xd')](_0x05cb('0xe'),_0x4830cd,_0x05cb('0xf'),JSON['stringify'](_0x14edf0));if(_0x14edf0[_0x05cb('0x10')]){if(_0x14edf0['error'][_0x05cb('0x11')]===0x1f4){logger[_0x05cb('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x4830cd,_0x14edf0['error'][_0x05cb('0x12')]);return _0x177645(_0x14edf0['error']['message']);}logger[_0x05cb('0x10')](_0x05cb('0xc'),_0x4830cd,_0x14edf0['error']['message']);return _0x5137f8(_0x14edf0[_0x05cb('0x10')][_0x05cb('0x12')]);}else{logger[_0x05cb('0xb')](_0x05cb('0xc'),_0x4830cd,'request\x20sent');_0x5137f8(_0x14edf0[_0x05cb('0x13')][_0x05cb('0x12')]);}})[_0x05cb('0x14')](function(_0x113832){logger[_0x05cb('0x10')](_0x05cb('0xc'),_0x4830cd,_0x113832);_0x177645(_0x113832);});});} \ No newline at end of file +var _0x5c31=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x5c31,0x130));var _0x15c3=function(_0x58a7e6,_0x20d575){_0x58a7e6=_0x58a7e6-0x0;var _0x3b69f2=_0x5c31[_0x58a7e6];return _0x3b69f2;};'use strict';var _=require(_0x15c3('0x0'));var util=require(_0x15c3('0x1'));var moment=require(_0x15c3('0x2'));var BPromise=require(_0x15c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c3('0x4'));var db=require(_0x15c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15c3('0x6'))('rpc');var config=require(_0x15c3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x15c3('0x8')][_0x15c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x79575b,_0x8da928,_0x2fcc37){return new BPromise(function(_0x3ad415,_0x1a40f0){return client['request'](_0x79575b,_0x2fcc37)[_0x15c3('0xa')](function(_0x4e94fe){logger[_0x15c3('0xb')](_0x15c3('0xc'),_0x8da928,_0x15c3('0xd'));logger[_0x15c3('0xe')](_0x15c3('0xf'),_0x8da928,'request\x20sent',JSON[_0x15c3('0x10')](_0x4e94fe));if(_0x4e94fe[_0x15c3('0x11')]){if(_0x4e94fe[_0x15c3('0x11')]['code']===0x1f4){logger[_0x15c3('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x8da928,_0x4e94fe[_0x15c3('0x11')][_0x15c3('0x12')]);return _0x1a40f0(_0x4e94fe[_0x15c3('0x11')][_0x15c3('0x12')]);}logger[_0x15c3('0x11')](_0x15c3('0xc'),_0x8da928,_0x4e94fe['error'][_0x15c3('0x12')]);return _0x3ad415(_0x4e94fe['error']['message']);}else{logger[_0x15c3('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x8da928,_0x15c3('0xd'));_0x3ad415(_0x4e94fe[_0x15c3('0x13')][_0x15c3('0x12')]);}})[_0x15c3('0x14')](function(_0x22837b){logger[_0x15c3('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x8da928,_0x22837b);_0x1a40f0(_0x22837b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4e34ca1..a1e7756 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 _0x0630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32f0e0,_0x29f539){var _0x50fe85=function(_0x3aae04){while(--_0x3aae04){_0x32f0e0['push'](_0x32f0e0['shift']());}};_0x50fe85(++_0x29f539);}(_0x0630,0xde));var _0x0063=function(_0x271e89,_0x288cbf){_0x271e89=_0x271e89-0x0;var _0x4d5750=_0x0630[_0x271e89];return _0x4d5750;};'use strict';var multer=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var path=require(_0x0063('0x2'));var timeout=require(_0x0063('0x3'));var express=require(_0x0063('0x4'));var router=express[_0x0063('0x5')]();var fs_extra=require(_0x0063('0x6'));var auth=require(_0x0063('0x7'));var interaction=require(_0x0063('0x8'));var config=require(_0x0063('0x9'));var controller=require('./cmContactHasItem.controller');router[_0x0063('0xa')]('/',auth['isAuthenticated'](),controller[_0x0063('0xb')]);router['get']('/:id',auth[_0x0063('0xc')](),controller['show']);router[_0x0063('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0063('0xe'),auth[_0x0063('0xc')](),controller[_0x0063('0xf')]);router[_0x0063('0x10')](_0x0063('0xe'),auth['isAuthenticated'](),controller[_0x0063('0x11')]);module[_0x0063('0x12')]=router; \ No newline at end of file +var _0x0e8f=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58b9aa,_0x17ffeb){var _0x55503b=function(_0x469024){while(--_0x469024){_0x58b9aa['push'](_0x58b9aa['shift']());}};_0x55503b(++_0x17ffeb);}(_0x0e8f,0x1c5));var _0xf0e8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x0e8f[_0x40220a];return _0x3903cc;};'use strict';var multer=require('multer');var util=require(_0xf0e8('0x0'));var path=require('path');var timeout=require(_0xf0e8('0x1'));var express=require('express');var router=express[_0xf0e8('0x2')]();var fs_extra=require(_0xf0e8('0x3'));var auth=require(_0xf0e8('0x4'));var interaction=require(_0xf0e8('0x5'));var config=require(_0xf0e8('0x6'));var controller=require(_0xf0e8('0x7'));router[_0xf0e8('0x8')]('/',auth[_0xf0e8('0x9')](),controller[_0xf0e8('0xa')]);router[_0xf0e8('0x8')](_0xf0e8('0xb'),auth[_0xf0e8('0x9')](),controller[_0xf0e8('0xc')]);router[_0xf0e8('0xd')]('/',auth['isAuthenticated'](),controller[_0xf0e8('0xe')]);router[_0xf0e8('0xf')](_0xf0e8('0xb'),auth['isAuthenticated'](),controller[_0xf0e8('0x10')]);router[_0xf0e8('0x11')](_0xf0e8('0xb'),auth[_0xf0e8('0x9')](),controller[_0xf0e8('0x12')]);module[_0xf0e8('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 e742ac6..9c52898 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 _0x2d3e=['BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','setDataValue','alias','getDataValue','name','STRING','TEXT','type','select','values'];(function(_0x2825ae,_0x47550e){var _0x4601fe=function(_0x5c2346){while(--_0x5c2346){_0x2825ae['push'](_0x2825ae['shift']());}};_0x4601fe(++_0x47550e);}(_0x2d3e,0x14c));var _0xe2d3=function(_0x47698f,_0x416d75){_0x47698f=_0x47698f-0x0;var _0x1b73b0=_0x2d3e[_0x47698f];return _0x1b73b0;};'use strict';var Sequelize=require(_0xe2d3('0x0'));var _=require(_0xe2d3('0x1'));module[_0xe2d3('0x2')]={'name':{'type':Sequelize[_0xe2d3('0x3')],'get':function(_0x55e8a2){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3b4ab9){this[_0xe2d3('0x4')](_0xe2d3('0x5'),_0x3b4ab9?_0x3b4ab9:this[_0xe2d3('0x6')](_0xe2d3('0x7')));}},'type':{'type':Sequelize[_0xe2d3('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0xe2d3('0x9')]('long'),'get':function(){if(this['getDataValue'](_0xe2d3('0xa'))===_0xe2d3('0xb')){return JSON['parse'](this[_0xe2d3('0x6')](_0xe2d3('0xc')));}else{return this['getDataValue'](_0xe2d3('0xc'));}},'set':function(_0x2f39b5){if(Array['isArray'](_0x2f39b5)){this[_0xe2d3('0x4')](_0xe2d3('0xc'),JSON['stringify'](_0x2f39b5));}else{this[_0xe2d3('0x4')](_0xe2d3('0xc'),_0x2f39b5);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe2d3('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe2d3('0xe')]('voice')}}; \ No newline at end of file +var _0x2b3e=['type','parse','values','isArray','setDataValue','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT'];(function(_0x62e313,_0xff2c7){var _0x3bf2f7=function(_0x186a54){while(--_0x186a54){_0x62e313['push'](_0x62e313['shift']());}};_0x3bf2f7(++_0xff2c7);}(_0x2b3e,0xc9));var _0xe2b3=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2b3e[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xe2b3('0x0'));var _=require(_0xe2b3('0x1'));module[_0xe2b3('0x2')]={'name':{'type':Sequelize[_0xe2b3('0x3')],'get':function(_0x37f5e3){return this[_0xe2b3('0x4')](_0xe2b3('0x5'));}},'alias':{'type':Sequelize[_0xe2b3('0x6')],'allowNull':![],'set':function(_0x105f36){this['setDataValue'](_0xe2b3('0x5'),_0x105f36?_0x105f36:this['getDataValue'](_0xe2b3('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xe2b3('0x8')]('long'),'get':function(){if(this[_0xe2b3('0x4')](_0xe2b3('0x9'))==='select'){return JSON[_0xe2b3('0xa')](this[_0xe2b3('0x4')]('values'));}else{return this[_0xe2b3('0x4')](_0xe2b3('0xb'));}},'set':function(_0x2cd640){if(Array[_0xe2b3('0xc')](_0x2cd640)){this[_0xe2b3('0xd')](_0xe2b3('0xb'),JSON['stringify'](_0x2cd640));}else{this[_0xe2b3('0xd')]('values',_0x2cd640);}}},'required':{'type':Sequelize[_0xe2b3('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe2b3('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c7adf69..0b2575c 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 _0x09a7=['findAll','rows','catch','show','params','includeAll','find','body','create','sequelize','transaction','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x168272,_0x1a6e2c){var _0x178fa3=function(_0x474037){while(--_0x474037){_0x168272['push'](_0x168272['shift']());}};_0x178fa3(++_0x1a6e2c);}(_0x09a7,0x176));var _0x709a=function(_0x26ac57,_0x3b5ea6){_0x26ac57=_0x26ac57-0x0;var _0x4ca455=_0x09a7[_0x26ac57];return _0x4ca455;};'use strict';var emlformat=require(_0x709a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x709a('0x1'));var jsonpatch=require(_0x709a('0x2'));var rp=require(_0x709a('0x3'));var moment=require(_0x709a('0x4'));var BPromise=require(_0x709a('0x5'));var Mustache=require(_0x709a('0x6'));var util=require(_0x709a('0x7'));var path=require(_0x709a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x709a('0x9'));var fs=require('fs');var fs_extra=require(_0x709a('0xa'));var _=require(_0x709a('0xb'));var squel=require(_0x709a('0xc'));var crypto=require(_0x709a('0xd'));var jsforce=require(_0x709a('0xe'));var deskjs=require(_0x709a('0xf'));var toCsv=require(_0x709a('0x10'));var querystring=require(_0x709a('0x11'));var Papa=require(_0x709a('0x12'));var Redis=require(_0x709a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x709a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x709a('0x15'))(_0x709a('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x709a('0x17'));var db=require(_0x709a('0x18'))['db'];function respondWithStatusCode(_0x4321c6,_0xabd59f){_0xabd59f=_0xabd59f||0xcc;return function(_0x4c9fa1){if(_0x4c9fa1){return _0x4321c6[_0x709a('0x19')](_0xabd59f);}return _0x4321c6[_0x709a('0x1a')](_0xabd59f)[_0x709a('0x1b')]();};}function respondWithResult(_0x3febfd,_0x591463){_0x591463=_0x591463||0xc8;return function(_0x22d13a){if(_0x22d13a){return _0x3febfd['status'](_0x591463)[_0x709a('0x1c')](_0x22d13a);}};}function respondWithFilteredResult(_0xe8c7eb,_0x5730e4){return function(_0x5825f3){if(_0x5825f3){var _0x4ffe89=typeof _0x5730e4[_0x709a('0x1d')]===_0x709a('0x1e')&&typeof _0x5730e4[_0x709a('0x1f')]===_0x709a('0x1e');var _0x3ca366=_0x5825f3[_0x709a('0x20')];var _0x16d739=_0x4ffe89?0x0:_0x5730e4[_0x709a('0x1d')];var _0x234f06=_0x4ffe89?_0x5825f3[_0x709a('0x20')]:_0x5730e4[_0x709a('0x1d')]+_0x5730e4['limit'];var _0xfcb93c;if(_0x234f06>=_0x3ca366){_0x234f06=_0x3ca366;_0xfcb93c=0xc8;}else{_0xfcb93c=0xce;}_0xe8c7eb[_0x709a('0x1a')](_0xfcb93c);return _0xe8c7eb['set'](_0x709a('0x21'),_0x16d739+'-'+_0x234f06+'/'+_0x3ca366)['json'](_0x5825f3);}return null;};}function patchUpdates(_0x2d0740){return function(_0x2950f6){try{jsonpatch[_0x709a('0x22')](_0x2950f6,_0x2d0740,!![]);}catch(_0x1f21e8){return BPromise['reject'](_0x1f21e8);}return _0x2950f6[_0x709a('0x23')]();};}function saveUpdates(_0x24ee36,_0x5d558b){return function(_0x26fc24){if(_0x26fc24){return _0x26fc24[_0x709a('0x24')](_0x24ee36)[_0x709a('0x25')](function(_0x2c3882){return _0x2c3882;});}return null;};}function removeEntity(_0x3ff44f,_0x5ec2c8){return function(_0x1026f1){if(_0x1026f1){return _0x1026f1[_0x709a('0x26')]()['then'](function(){_0x3ff44f['status'](0xcc)[_0x709a('0x1b')]();});}};}function handleEntityNotFound(_0x2c2926,_0x406f25){return function(_0x38f8e0){if(!_0x38f8e0){_0x2c2926[_0x709a('0x19')](0x194);}return _0x38f8e0;};}function handleError(_0x21e4b6,_0x510c58){_0x510c58=_0x510c58||0x1f4;return function(_0xd2edd0){logger['error'](_0xd2edd0[_0x709a('0x27')]);if(_0xd2edd0[_0x709a('0x28')]){delete _0xd2edd0[_0x709a('0x28')];}_0x21e4b6[_0x709a('0x1a')](_0x510c58)[_0x709a('0x29')](_0xd2edd0);};}exports['index']=function(_0x125502,_0x573db3){var _0x3d626a={},_0x1c7974={},_0x352e77={'count':0x0,'rows':[]};var _0x4e11e2=_[_0x709a('0x2a')](db[_0x709a('0x2b')][_0x709a('0x2c')],function(_0x5c1c49){return{'name':_0x5c1c49[_0x709a('0x2d')],'type':_0x5c1c49[_0x709a('0x2e')][_0x709a('0x2f')]};});_0x1c7974[_0x709a('0x30')]=_['differenceBy'](_[_0x709a('0x2a')](_0x4e11e2,_0x709a('0x28')),[_0x709a('0x28')]);_0x1c7974[_0x709a('0x31')]=_[_0x709a('0x32')](_0x125502['query']);_0x1c7974[_0x709a('0x33')]=_['intersection'](_0x1c7974[_0x709a('0x30')],_0x1c7974[_0x709a('0x31')]);_0x3d626a[_0x709a('0x34')]=_[_0x709a('0x35')](_0x1c7974[_0x709a('0x30')],qs['fields'](_0x125502[_0x709a('0x31')][_0x709a('0x36')]));_0x3d626a[_0x709a('0x34')]=_0x3d626a[_0x709a('0x34')][_0x709a('0x37')]?_0x3d626a[_0x709a('0x34')]:_0x1c7974['model'];if(!_0x125502[_0x709a('0x31')][_0x709a('0x38')]('nolimit')){_0x3d626a['limit']=qs[_0x709a('0x1f')](_0x125502[_0x709a('0x31')][_0x709a('0x1f')]);_0x3d626a[_0x709a('0x1d')]=qs['offset'](_0x125502[_0x709a('0x31')][_0x709a('0x1d')]);}_0x3d626a[_0x709a('0x39')]=qs['sort'](_0x125502['query'][_0x709a('0x3a')]);_0x3d626a[_0x709a('0x3b')]=qs[_0x709a('0x33')](_[_0x709a('0x3c')](_0x125502[_0x709a('0x31')],_0x1c7974[_0x709a('0x33')]),_0x4e11e2);if(_0x125502[_0x709a('0x31')][_0x709a('0x3d')]){_0x3d626a[_0x709a('0x3b')]=_[_0x709a('0x3e')](_0x3d626a[_0x709a('0x3b')],{'$or':_[_0x709a('0x2a')](_0x4e11e2,function(_0x48746f){if(_0x48746f[_0x709a('0x2e')]!==_0x709a('0x3f')){var _0x37a252={};_0x37a252[_0x48746f[_0x709a('0x28')]]={'$like':'%'+_0x125502[_0x709a('0x31')][_0x709a('0x3d')]+'%'};return _0x37a252;}})});}_0x3d626a=_[_0x709a('0x3e')]({},_0x3d626a,_0x125502[_0x709a('0x40')]);var _0x32a5be={'where':_0x3d626a[_0x709a('0x3b')]};return db[_0x709a('0x2b')][_0x709a('0x20')](_0x32a5be)[_0x709a('0x25')](function(_0x1685d0){_0x352e77[_0x709a('0x20')]=_0x1685d0;if(_0x125502['query']['includeAll']){_0x3d626a[_0x709a('0x41')]=[{'all':!![]}];}return db[_0x709a('0x2b')][_0x709a('0x42')](_0x3d626a);})[_0x709a('0x25')](function(_0x5e670c){_0x352e77[_0x709a('0x43')]=_0x5e670c;return _0x352e77;})[_0x709a('0x25')](respondWithFilteredResult(_0x573db3,_0x3d626a))[_0x709a('0x44')](handleError(_0x573db3,null));};exports[_0x709a('0x45')]=function(_0x4db7b2,_0x3afd32){var _0x540803={'raw':!![],'where':{'id':_0x4db7b2[_0x709a('0x46')]['id']}},_0x5fd786={};_0x5fd786[_0x709a('0x30')]=_[_0x709a('0x32')](db[_0x709a('0x2b')][_0x709a('0x2c')]);_0x5fd786['query']=_[_0x709a('0x32')](_0x4db7b2[_0x709a('0x31')]);_0x5fd786[_0x709a('0x33')]=_[_0x709a('0x35')](_0x5fd786[_0x709a('0x30')],_0x5fd786[_0x709a('0x31')]);_0x540803[_0x709a('0x34')]=_[_0x709a('0x35')](_0x5fd786[_0x709a('0x30')],qs[_0x709a('0x36')](_0x4db7b2[_0x709a('0x31')]['fields']));_0x540803['attributes']=_0x540803[_0x709a('0x34')][_0x709a('0x37')]?_0x540803['attributes']:_0x5fd786[_0x709a('0x30')];if(_0x4db7b2[_0x709a('0x31')][_0x709a('0x47')]){_0x540803[_0x709a('0x41')]=[{'all':!![]}];}_0x540803=_[_0x709a('0x3e')]({},_0x540803,_0x4db7b2[_0x709a('0x40')]);return db[_0x709a('0x2b')][_0x709a('0x48')](_0x540803)['then'](handleEntityNotFound(_0x3afd32,null))[_0x709a('0x25')](respondWithResult(_0x3afd32,null))[_0x709a('0x44')](handleError(_0x3afd32,null));};exports['update']=function(_0x1adf38,_0x4f82a7){if(_0x1adf38[_0x709a('0x49')]['id']){delete _0x1adf38[_0x709a('0x49')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x1adf38[_0x709a('0x46')]['id']}})[_0x709a('0x25')](handleEntityNotFound(_0x4f82a7,null))[_0x709a('0x25')](saveUpdates(_0x1adf38[_0x709a('0x49')],null))[_0x709a('0x25')](respondWithResult(_0x4f82a7,null))['catch'](handleError(_0x4f82a7,null));};exports['destroy']=function(_0x5ab8f8,_0x515cc3){return db[_0x709a('0x2b')][_0x709a('0x48')]({'where':{'id':_0x5ab8f8[_0x709a('0x46')]['id']}})[_0x709a('0x25')](handleEntityNotFound(_0x515cc3,null))[_0x709a('0x25')](removeEntity(_0x515cc3,null))[_0x709a('0x44')](handleError(_0x515cc3,null));};exports[_0x709a('0x4a')]=function(_0x4815c7,_0x237b96){var _0x35395e;return db[_0x709a('0x4b')][_0x709a('0x4c')](function(_0x52c3c5){return db[_0x709a('0x2b')][_0x709a('0x4a')](_0x4815c7[_0x709a('0x49')],{'transaction':_0x52c3c5})['then'](function(_0x313fb4){_0x35395e=_0x313fb4;var _0x5c9e9e={'type':db[_0x709a('0x4d')][_0x709a('0x4e')],'transaction':_0x52c3c5};switch(_0x4815c7[_0x709a('0x49')]['type']){case'text':_0x5c9e9e['type']=db[_0x709a('0x4d')][_0x709a('0x4e')];break;case _0x709a('0x4f'):_0x5c9e9e[_0x709a('0x2e')]=db[_0x709a('0x4d')]['INTEGER'];break;case _0x709a('0x50'):_0x5c9e9e['type']=db['Sequelize'][_0x709a('0x51')];_0x5c9e9e[_0x709a('0x52')]=![];break;default:}return db[_0x709a('0x4b')][_0x709a('0x53')][_0x709a('0x54')](_0x709a('0x55'),util[_0x709a('0x56')](_0x709a('0x57'),_0x35395e['id']),_0x5c9e9e);})['then'](function(){return _0x35395e;});})[_0x709a('0x25')](respondWithResult(_0x237b96,0xc9))['catch'](handleError(_0x237b96,null));}; \ No newline at end of file +var _0x2137=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','update','body','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x2137,0x83));var _0x7213=function(_0xb37185,_0x3ec508){_0xb37185=_0xb37185-0x0;var _0x575b45=_0x2137[_0xb37185];return _0x575b45;};'use strict';var emlformat=require(_0x7213('0x0'));var rimraf=require(_0x7213('0x1'));var zipdir=require(_0x7213('0x2'));var jsonpatch=require(_0x7213('0x3'));var rp=require(_0x7213('0x4'));var moment=require(_0x7213('0x5'));var BPromise=require(_0x7213('0x6'));var Mustache=require(_0x7213('0x7'));var util=require(_0x7213('0x8'));var path=require(_0x7213('0x9'));var sox=require(_0x7213('0xa'));var csv=require('to-csv');var ejs=require(_0x7213('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7213('0xc'));var squel=require('squel');var crypto=require(_0x7213('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7213('0xe'));var querystring=require(_0x7213('0xf'));var Papa=require('papaparse');var Redis=require(_0x7213('0x10'));var authService=require(_0x7213('0x11'));var qs=require(_0x7213('0x12'));var as=require(_0x7213('0x13'));var hardwareService=require(_0x7213('0x14'));var logger=require(_0x7213('0x15'))(_0x7213('0x16'));var utils=require(_0x7213('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7213('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f32f9,_0x328570){_0x328570=_0x328570||0xcc;return function(_0x1a6b81){if(_0x1a6b81){return _0x1f32f9[_0x7213('0x19')](_0x328570);}return _0x1f32f9[_0x7213('0x1a')](_0x328570)[_0x7213('0x1b')]();};}function respondWithResult(_0x16d403,_0x1984c9){_0x1984c9=_0x1984c9||0xc8;return function(_0x1f19f7){if(_0x1f19f7){return _0x16d403['status'](_0x1984c9)['json'](_0x1f19f7);}};}function respondWithFilteredResult(_0x179222,_0x4e9e55){return function(_0x1163ae){if(_0x1163ae){var _0xfbbca0=typeof _0x4e9e55[_0x7213('0x1c')]===_0x7213('0x1d')&&typeof _0x4e9e55[_0x7213('0x1e')]===_0x7213('0x1d');var _0x5279b3=_0x1163ae[_0x7213('0x1f')];var _0x52b077=_0xfbbca0?0x0:_0x4e9e55[_0x7213('0x1c')];var _0x36b314=_0xfbbca0?_0x1163ae[_0x7213('0x1f')]:_0x4e9e55[_0x7213('0x1c')]+_0x4e9e55[_0x7213('0x1e')];var _0x39b02f;if(_0x36b314>=_0x5279b3){_0x36b314=_0x5279b3;_0x39b02f=0xc8;}else{_0x39b02f=0xce;}_0x179222[_0x7213('0x1a')](_0x39b02f);return _0x179222[_0x7213('0x20')](_0x7213('0x21'),_0x52b077+'-'+_0x36b314+'/'+_0x5279b3)[_0x7213('0x22')](_0x1163ae);}return null;};}function patchUpdates(_0x21dd71){return function(_0x25531d){try{jsonpatch['apply'](_0x25531d,_0x21dd71,!![]);}catch(_0x177b95){return BPromise['reject'](_0x177b95);}return _0x25531d[_0x7213('0x23')]();};}function saveUpdates(_0x1aac68,_0x15963d){return function(_0x2684e4){if(_0x2684e4){return _0x2684e4['update'](_0x1aac68)[_0x7213('0x24')](function(_0x5a5c33){return _0x5a5c33;});}return null;};}function removeEntity(_0x46c03f,_0x334f8a){return function(_0x396e49){if(_0x396e49){return _0x396e49[_0x7213('0x25')]()[_0x7213('0x24')](function(){_0x46c03f[_0x7213('0x1a')](0xcc)[_0x7213('0x1b')]();});}};}function handleEntityNotFound(_0x6c4e9,_0x443466){return function(_0x3bb89e){if(!_0x3bb89e){_0x6c4e9[_0x7213('0x19')](0x194);}return _0x3bb89e;};}function handleError(_0x305e65,_0x353671){_0x353671=_0x353671||0x1f4;return function(_0x28edfe){logger[_0x7213('0x26')](_0x28edfe[_0x7213('0x27')]);if(_0x28edfe[_0x7213('0x28')]){delete _0x28edfe[_0x7213('0x28')];}_0x305e65[_0x7213('0x1a')](_0x353671)[_0x7213('0x29')](_0x28edfe);};}exports[_0x7213('0x2a')]=function(_0x5f3b51,_0x4e0359){var _0x21cde6={},_0x21552c={},_0x2e753b={'count':0x0,'rows':[]};var _0x256e4a=_['map'](db[_0x7213('0x2b')][_0x7213('0x2c')],function(_0x505cf6){return{'name':_0x505cf6[_0x7213('0x2d')],'type':_0x505cf6[_0x7213('0x2e')][_0x7213('0x2f')]};});_0x21552c[_0x7213('0x30')]=_['differenceBy'](_[_0x7213('0x31')](_0x256e4a,_0x7213('0x28')),[_0x7213('0x28')]);_0x21552c[_0x7213('0x32')]=_[_0x7213('0x33')](_0x5f3b51[_0x7213('0x32')]);_0x21552c[_0x7213('0x34')]=_['intersection'](_0x21552c[_0x7213('0x30')],_0x21552c['query']);_0x21cde6[_0x7213('0x35')]=_[_0x7213('0x36')](_0x21552c[_0x7213('0x30')],qs['fields'](_0x5f3b51[_0x7213('0x32')][_0x7213('0x37')]));_0x21cde6[_0x7213('0x35')]=_0x21cde6[_0x7213('0x35')][_0x7213('0x38')]?_0x21cde6[_0x7213('0x35')]:_0x21552c[_0x7213('0x30')];if(!_0x5f3b51[_0x7213('0x32')][_0x7213('0x39')](_0x7213('0x3a'))){_0x21cde6['limit']=qs[_0x7213('0x1e')](_0x5f3b51[_0x7213('0x32')][_0x7213('0x1e')]);_0x21cde6['offset']=qs['offset'](_0x5f3b51['query'][_0x7213('0x1c')]);}_0x21cde6[_0x7213('0x3b')]=qs[_0x7213('0x3c')](_0x5f3b51[_0x7213('0x32')][_0x7213('0x3c')]);_0x21cde6[_0x7213('0x3d')]=qs[_0x7213('0x34')](_[_0x7213('0x3e')](_0x5f3b51['query'],_0x21552c[_0x7213('0x34')]),_0x256e4a);if(_0x5f3b51[_0x7213('0x32')][_0x7213('0x3f')]){_0x21cde6['where']=_[_0x7213('0x40')](_0x21cde6['where'],{'$or':_[_0x7213('0x31')](_0x256e4a,function(_0x2b14fb){if(_0x2b14fb['type']!==_0x7213('0x41')){var _0x5df143={};_0x5df143[_0x2b14fb[_0x7213('0x28')]]={'$like':'%'+_0x5f3b51['query'][_0x7213('0x3f')]+'%'};return _0x5df143;}})});}_0x21cde6=_['merge']({},_0x21cde6,_0x5f3b51['options']);var _0x271f35={'where':_0x21cde6['where']};return db['CmCustomField']['count'](_0x271f35)[_0x7213('0x24')](function(_0x15fef7){_0x2e753b[_0x7213('0x1f')]=_0x15fef7;if(_0x5f3b51[_0x7213('0x32')]['includeAll']){_0x21cde6[_0x7213('0x42')]=[{'all':!![]}];}return db[_0x7213('0x2b')][_0x7213('0x43')](_0x21cde6);})['then'](function(_0x27fd4d){_0x2e753b[_0x7213('0x44')]=_0x27fd4d;return _0x2e753b;})['then'](respondWithFilteredResult(_0x4e0359,_0x21cde6))['catch'](handleError(_0x4e0359,null));};exports[_0x7213('0x45')]=function(_0x4b3260,_0x54bb4b){var _0x5d3dcb={'raw':!![],'where':{'id':_0x4b3260[_0x7213('0x46')]['id']}},_0x2a173b={};_0x2a173b['model']=_[_0x7213('0x33')](db[_0x7213('0x2b')][_0x7213('0x2c')]);_0x2a173b[_0x7213('0x32')]=_[_0x7213('0x33')](_0x4b3260['query']);_0x2a173b[_0x7213('0x34')]=_['intersection'](_0x2a173b[_0x7213('0x30')],_0x2a173b[_0x7213('0x32')]);_0x5d3dcb['attributes']=_[_0x7213('0x36')](_0x2a173b[_0x7213('0x30')],qs[_0x7213('0x37')](_0x4b3260[_0x7213('0x32')][_0x7213('0x37')]));_0x5d3dcb[_0x7213('0x35')]=_0x5d3dcb[_0x7213('0x35')][_0x7213('0x38')]?_0x5d3dcb['attributes']:_0x2a173b['model'];if(_0x4b3260[_0x7213('0x32')][_0x7213('0x47')]){_0x5d3dcb[_0x7213('0x42')]=[{'all':!![]}];}_0x5d3dcb=_['merge']({},_0x5d3dcb,_0x4b3260[_0x7213('0x48')]);return db[_0x7213('0x2b')][_0x7213('0x49')](_0x5d3dcb)[_0x7213('0x24')](handleEntityNotFound(_0x54bb4b,null))[_0x7213('0x24')](respondWithResult(_0x54bb4b,null))[_0x7213('0x4a')](handleError(_0x54bb4b,null));};exports[_0x7213('0x4b')]=function(_0x2e0eb8,_0x2d0855){if(_0x2e0eb8[_0x7213('0x4c')]['id']){delete _0x2e0eb8[_0x7213('0x4c')]['id'];}return db[_0x7213('0x2b')]['find']({'where':{'id':_0x2e0eb8[_0x7213('0x46')]['id']}})[_0x7213('0x24')](handleEntityNotFound(_0x2d0855,null))[_0x7213('0x24')](saveUpdates(_0x2e0eb8[_0x7213('0x4c')],null))[_0x7213('0x24')](respondWithResult(_0x2d0855,null))[_0x7213('0x4a')](handleError(_0x2d0855,null));};exports['destroy']=function(_0x16fc8e,_0x33c011){return db[_0x7213('0x2b')][_0x7213('0x49')]({'where':{'id':_0x16fc8e['params']['id']}})[_0x7213('0x24')](handleEntityNotFound(_0x33c011,null))[_0x7213('0x24')](removeEntity(_0x33c011,null))[_0x7213('0x4a')](handleError(_0x33c011,null));};exports['create']=function(_0x5af44c,_0x49f6d0){var _0x341998;return db[_0x7213('0x4d')][_0x7213('0x4e')](function(_0x32f258){return db[_0x7213('0x2b')][_0x7213('0x4f')](_0x5af44c['body'],{'transaction':_0x32f258})[_0x7213('0x24')](function(_0x2ee904){_0x341998=_0x2ee904;var _0xa6e2f1={'type':db[_0x7213('0x50')][_0x7213('0x51')],'transaction':_0x32f258};switch(_0x5af44c['body'][_0x7213('0x2e')]){case _0x7213('0x52'):_0xa6e2f1[_0x7213('0x2e')]=db['Sequelize'][_0x7213('0x51')];break;case _0x7213('0x53'):_0xa6e2f1[_0x7213('0x2e')]=db['Sequelize'][_0x7213('0x54')];break;case'switch':_0xa6e2f1[_0x7213('0x2e')]=db[_0x7213('0x50')][_0x7213('0x55')];_0xa6e2f1[_0x7213('0x56')]=![];break;default:}return db[_0x7213('0x4d')][_0x7213('0x57')][_0x7213('0x58')](_0x7213('0x59'),util['format'](_0x7213('0x5a'),_0x341998['id']),_0xa6e2f1);})[_0x7213('0x24')](function(){return _0x341998;});})[_0x7213('0x24')](respondWithResult(_0x49f6d0,0xc9))['catch'](handleError(_0x49f6d0,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3029b04..2c7352e 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 _0x79c3=['request-promise','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','moment'];(function(_0x28e9d4,_0x2dcb17){var _0x3e9390=function(_0x50dde8){while(--_0x50dde8){_0x28e9d4['push'](_0x28e9d4['shift']());}};_0x3e9390(++_0x2dcb17);}(_0x79c3,0x9c));var _0x379c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x79c3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x379c('0x0'));var util=require(_0x379c('0x1'));var logger=require(_0x379c('0x2'))('api');var moment=require(_0x379c('0x3'));var BPromise=require('bluebird');var rp=require(_0x379c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379c('0x5'));var attributes=require(_0x379c('0x6'));module[_0x379c('0x7')]=function(_0x26c02a,_0x1ca193){return _0x26c02a[_0x379c('0x8')](_0x379c('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf30=['path','rimraf','../../config/environment','define','CmCustomField','cm_custom_fields','api','bluebird','request-promise'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0xaf30,0x1da));var _0x0af3=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xaf30[_0x2ade6c];return _0x2cb372;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0af3('0x0'));var moment=require('moment');var BPromise=require(_0x0af3('0x1'));var rp=require(_0x0af3('0x2'));var fs=require('fs');var path=require(_0x0af3('0x3'));var rimraf=require(_0x0af3('0x4'));var config=require(_0x0af3('0x5'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x2557ed,_0x51bc1c){return _0x2557ed[_0x0af3('0x6')](_0x0af3('0x7'),attributes,{'tableName':_0x0af3('0x8'),'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 060cd3c..32b65b6 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 _0x7659=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','util'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x7659,0xc7));var _0x9765=function(_0x30c5fa,_0x432824){_0x30c5fa=_0x30c5fa-0x0;var _0x5aa188=_0x7659[_0x30c5fa];return _0x5aa188;};'use strict';var _=require('lodash');var util=require(_0x9765('0x0'));var moment=require(_0x9765('0x1'));var BPromise=require(_0x9765('0x2'));var rs=require(_0x9765('0x3'));var fs=require('fs');var Redis=require(_0x9765('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9765('0x5'));var logger=require('../../config/logger')(_0x9765('0x6'));var config=require(_0x9765('0x7'));var jayson=require(_0x9765('0x8'));var client=jayson[_0x9765('0x9')][_0x9765('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x571aa1,_0x2529d6,_0x333f9d){return new BPromise(function(_0x4ee19b,_0x34ed9d){return client[_0x9765('0xb')](_0x571aa1,_0x333f9d)[_0x9765('0xc')](function(_0x4cf69c){logger[_0x9765('0xd')](_0x9765('0xe'),_0x2529d6,_0x9765('0xf'));logger[_0x9765('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2529d6,_0x9765('0xf'),JSON[_0x9765('0x11')](_0x4cf69c));if(_0x4cf69c[_0x9765('0x12')]){if(_0x4cf69c['error']['code']===0x1f4){logger[_0x9765('0x12')](_0x9765('0xe'),_0x2529d6,_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);return _0x34ed9d(_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);}logger['error'](_0x9765('0xe'),_0x2529d6,_0x4cf69c[_0x9765('0x12')][_0x9765('0x13')]);return _0x4ee19b(_0x4cf69c['error'][_0x9765('0x13')]);}else{logger['info'](_0x9765('0xe'),_0x2529d6,_0x9765('0xf'));_0x4ee19b(_0x4cf69c['result'][_0x9765('0x13')]);}})['catch'](function(_0x5eee31){logger[_0x9765('0x12')](_0x9765('0xe'),_0x2529d6,_0x5eee31);_0x34ed9d(_0x5eee31);});});} \ No newline at end of file +var _0x56b9=['ioredis','rpc','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4f4874,_0x1a1322){var _0x21a95a=function(_0x4b68a2){while(--_0x4b68a2){_0x4f4874['push'](_0x4f4874['shift']());}};_0x21a95a(++_0x1a1322);}(_0x56b9,0x1de));var _0x956b=function(_0x28b301,_0x1dd9f9){_0x28b301=_0x28b301-0x0;var _0x4febe0=_0x56b9[_0x28b301];return _0x4febe0;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var moment=require(_0x956b('0x2'));var BPromise=require(_0x956b('0x3'));var rs=require(_0x956b('0x4'));var fs=require('fs');var Redis=require(_0x956b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x956b('0x6'));var config=require(_0x956b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x956b('0x8')][_0x956b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c68a9,_0x41bbd0,_0x3e3d08){return new BPromise(function(_0xbaa1f9,_0x8af136){return client[_0x956b('0xa')](_0x2c68a9,_0x3e3d08)[_0x956b('0xb')](function(_0x45f4a6){logger[_0x956b('0xc')](_0x956b('0xd'),_0x41bbd0,_0x956b('0xe'));logger['debug'](_0x956b('0xf'),_0x41bbd0,'request\x20sent',JSON['stringify'](_0x45f4a6));if(_0x45f4a6[_0x956b('0x10')]){if(_0x45f4a6[_0x956b('0x10')][_0x956b('0x11')]===0x1f4){logger[_0x956b('0x10')](_0x956b('0xd'),_0x41bbd0,_0x45f4a6[_0x956b('0x10')]['message']);return _0x8af136(_0x45f4a6[_0x956b('0x10')][_0x956b('0x12')]);}logger[_0x956b('0x10')](_0x956b('0xd'),_0x41bbd0,_0x45f4a6[_0x956b('0x10')][_0x956b('0x12')]);return _0xbaa1f9(_0x45f4a6[_0x956b('0x10')][_0x956b('0x12')]);}else{logger[_0x956b('0xc')](_0x956b('0xd'),_0x41bbd0,_0x956b('0xe'));_0xbaa1f9(_0x45f4a6[_0x956b('0x13')][_0x956b('0x12')]);}})[_0x956b('0x14')](function(_0x13b60b){logger[_0x956b('0x10')](_0x956b('0xd'),_0x41bbd0,_0x13b60b);_0x8af136(_0x13b60b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 34ffe2b..96437ae 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 _0x03e2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x2cbf22,_0x674af7){var _0x228403=function(_0x39156c){while(--_0x39156c){_0x2cbf22['push'](_0x2cbf22['shift']());}};_0x228403(++_0x674af7);}(_0x03e2,0x119));var _0x203e=function(_0x1a0738,_0x584dc5){_0x1a0738=_0x1a0738-0x0;var _0x4f9ef3=_0x03e2[_0x1a0738];return _0x4f9ef3;};'use strict';var multer=require('multer');var util=require(_0x203e('0x0'));var path=require(_0x203e('0x1'));var timeout=require(_0x203e('0x2'));var express=require(_0x203e('0x3'));var router=express[_0x203e('0x4')]();var fs_extra=require(_0x203e('0x5'));var auth=require(_0x203e('0x6'));var interaction=require(_0x203e('0x7'));var config=require(_0x203e('0x8'));var controller=require('./cmCustomField.controller');router[_0x203e('0x9')]('/',auth[_0x203e('0xa')](),controller['index']);router[_0x203e('0x9')](_0x203e('0xb'),auth['isAuthenticated'](),controller[_0x203e('0xc')]);router[_0x203e('0xd')]('/',auth[_0x203e('0xa')](),controller['create']);router[_0x203e('0xe')](_0x203e('0xb'),auth[_0x203e('0xa')](),controller[_0x203e('0xf')]);router[_0x203e('0x10')]('/:id',auth[_0x203e('0xa')](),controller[_0x203e('0x11')]);module[_0x203e('0x12')]=router; \ No newline at end of file +var _0x9c5a=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','post','create','put','isAuthenticated','update','destroy'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x52e77d,_0x3c4663){_0x52e77d=_0x52e77d-0x0;var _0x5b46e6=_0x9c5a[_0x52e77d];return _0x5b46e6;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./cmCustomField.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0xb')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/:id',auth[_0xa9c5('0xe')](),controller[_0xa9c5('0xf')]);router['delete']('/:id',auth[_0xa9c5('0xe')](),controller[_0xa9c5('0x10')]);module[_0xa9c5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index fbf8246..5e54852 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 _0x8b84=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING','format'];(function(_0x193096,_0x1a2447){var _0x3b3308=function(_0x5a8ae7){while(--_0x5a8ae7){_0x193096['push'](_0x193096['shift']());}};_0x3b3308(++_0x1a2447);}(_0x8b84,0x196));var _0x48b8=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8b84[_0x13b02f];return _0x12e9a6;};'use strict';var moment=require(_0x48b8('0x0'));var Sequelize=require(_0x48b8('0x1'));module['exports']={'phone':{'type':Sequelize[_0x48b8('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x48b8('0x3')](_0x48b8('0x4'))},'countbusyretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x48b8('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x48b8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x48b8('0x7')]},'priority':{'type':Sequelize[_0x48b8('0x5')](0x2)[_0x48b8('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x48b8('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x48b8('0x5')],'unique':_0x48b8('0x9')},'ListId':{'type':Sequelize[_0x48b8('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x48b8('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x48b8('0x5')],'unique':_0x48b8('0x9')},'CampaignId':{'type':Sequelize[_0x48b8('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x48b8('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x48b8('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x48b8('0x7')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x2d9d=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x1fcf36,_0x3f2539){var _0x44491f=function(_0x206816){while(--_0x206816){_0x1fcf36['push'](_0x1fcf36['shift']());}};_0x44491f(++_0x3f2539);}(_0x2d9d,0x165));var _0xd2d9=function(_0x83d0ad,_0x36efe7){_0x83d0ad=_0x83d0ad-0x0;var _0x5077aa=_0x2d9d[_0x83d0ad];return _0x5077aa;};'use strict';var moment=require(_0xd2d9('0x0'));var Sequelize=require(_0xd2d9('0x1'));module[_0xd2d9('0x2')]={'phone':{'type':Sequelize[_0xd2d9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xd2d9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd2d9('0x5')],'defaultValue':moment()[_0xd2d9('0x6')](_0xd2d9('0x7'))},'countbusyretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd2d9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd2d9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd2d9('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd2d9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd2d9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd2d9('0x8')],'unique':_0xd2d9('0xa')},'ListId':{'type':Sequelize[_0xd2d9('0x8')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xd2d9('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xd2d9('0x8')],'unique':_0xd2d9('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd2d9('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd2d9('0x8')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xd2d9('0x5')],'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 722c41e..8d81e02 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 _0x3c94=['describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','format','phone','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','CmCompany','Company','CmList','Queue','dialActive','transaction','UPDATE','Contact','getOpenContacts','preview','YYYY-MM-DD\x20HH:mm:ss','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','name','send','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','intersection','filters','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x42d956,_0x506ccb){var _0x22c3fe=function(_0x32f22d){while(--_0x32f22d){_0x42d956['push'](_0x42d956['shift']());}};_0x22c3fe(++_0x506ccb);}(_0x3c94,0xcd));var _0x43c9=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0x3c94[_0x579baf];return _0x4c601a;};'use strict';var moment=require(_0x43c9('0x0'));var _=require(_0x43c9('0x1'));var qs=require(_0x43c9('0x2'));var logger=require(_0x43c9('0x3'))(_0x43c9('0x4'));var shared=require(_0x43c9('0x5'));var db=require(_0x43c9('0x6'))['db'];function respondWithResult(_0x18159f,_0x170a0d){_0x170a0d=_0x170a0d||0xc8;return function(_0x44fc3){if(_0x44fc3){return _0x18159f[_0x43c9('0x7')](_0x170a0d)[_0x43c9('0x8')](_0x44fc3);}};}function respondWithFilteredResult(_0x4fdfc2,_0x39c220){return function(_0xf03007){if(_0xf03007){var _0x695b4f=typeof _0x39c220[_0x43c9('0x9')]===_0x43c9('0xa')&&typeof _0x39c220[_0x43c9('0xb')]===_0x43c9('0xa');var _0x4725aa=_0xf03007[_0x43c9('0xc')];var _0x4b113f=_0x695b4f?0x0:_0x39c220[_0x43c9('0x9')];var _0x18a5c9=_0x695b4f?_0xf03007[_0x43c9('0xc')]:_0x39c220[_0x43c9('0x9')]+_0x39c220[_0x43c9('0xb')];var _0x6ff1f9;if(_0x18a5c9>=_0x4725aa){_0x18a5c9=_0x4725aa;_0x6ff1f9=0xc8;}else{_0x6ff1f9=0xce;}_0x4fdfc2[_0x43c9('0x7')](_0x6ff1f9);return _0x4fdfc2[_0x43c9('0xd')](_0x43c9('0xe'),_0x4b113f+'-'+_0x18a5c9+'/'+_0x4725aa)[_0x43c9('0x8')](_0xf03007);}return null;};}function saveUpdates(_0x62bb3b,_0x31faa1){return function(_0x11fe24){if(_0x11fe24){return _0x11fe24[_0x43c9('0xf')](_0x62bb3b)[_0x43c9('0x10')](function(_0x45546d){return _0x45546d;});}return null;};}function handleEntityNotFound(_0x275b2b,_0x569fa9){return function(_0x37932f){if(!_0x37932f){_0x275b2b[_0x43c9('0x11')](0x194);}return _0x37932f;};}function handleError(_0x398b37,_0xe02707){_0xe02707=_0xe02707||0x1f4;return function(_0x3f908d){logger['error'](_0x3f908d['stack']);if(_0x3f908d[_0x43c9('0x12')]){delete _0x3f908d[_0x43c9('0x12')];}_0x398b37[_0x43c9('0x7')](_0xe02707)[_0x43c9('0x13')](_0x3f908d);};}exports['index']=function(_0x1d63cf,_0x1da149){var _0x38fe46={},_0x22bf3d={},_0xc14827={'count':0x0,'rows':[]};var _0x2ab239=_[_0x43c9('0x14')](db[_0x43c9('0x15')][_0x43c9('0x16')],function(_0x2a7b78){return{'name':_0x2a7b78[_0x43c9('0x17')],'type':_0x2a7b78['type'][_0x43c9('0x18')]};});_0x22bf3d[_0x43c9('0x19')]=_[_0x43c9('0x14')](_0x2ab239,'name');_0x22bf3d[_0x43c9('0x1a')]=_[_0x43c9('0x1b')](_0x1d63cf[_0x43c9('0x1a')]);_0x22bf3d['filters']=_[_0x43c9('0x1c')](_0x22bf3d[_0x43c9('0x19')],_0x22bf3d[_0x43c9('0x1a')]);_0x22bf3d['filters']=_['concat'](_0x22bf3d[_0x43c9('0x1d')],[_0x43c9('0x1e'),_0x43c9('0x1f'),'$gt',_0x43c9('0x20'),_0x43c9('0x21'),_0x43c9('0x22'),_0x43c9('0x23'),_0x43c9('0x24'),'$not',_0x43c9('0x25'),_0x43c9('0x26'),_0x43c9('0x27'),_0x43c9('0x28'),_0x43c9('0x29'),_0x43c9('0x2a'),_0x43c9('0x2b'),_0x43c9('0x2c'),_0x43c9('0x29'),_0x43c9('0x2d'),'$contains',_0x43c9('0x2e'),_0x43c9('0x2f')]);_0x38fe46[_0x43c9('0x30')]=_['intersection'](_0x22bf3d[_0x43c9('0x19')],qs[_0x43c9('0x31')](_0x1d63cf['query'][_0x43c9('0x31')]));_0x38fe46['attributes']=_0x38fe46[_0x43c9('0x30')][_0x43c9('0x32')]?_0x38fe46[_0x43c9('0x30')]:_0x22bf3d[_0x43c9('0x19')];if(!_0x1d63cf['query'][_0x43c9('0x33')](_0x43c9('0x34'))){_0x38fe46[_0x43c9('0xb')]=qs['limit'](_0x1d63cf[_0x43c9('0x1a')]['limit']);_0x38fe46[_0x43c9('0x9')]=qs[_0x43c9('0x9')](_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x9')]);}_0x38fe46['order']=qs[_0x43c9('0x35')](_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x35')]);_0x38fe46[_0x43c9('0x36')]=qs['filters'](_[_0x43c9('0x37')](_0x1d63cf[_0x43c9('0x1a')],_0x22bf3d[_0x43c9('0x1d')]),_0x2ab239);if(_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x38')]){_0x38fe46[_0x43c9('0x36')]=_[_0x43c9('0x39')](_0x38fe46[_0x43c9('0x36')],{'$or':_['map'](_0x2ab239,function(_0x1923bf){if(_0x1923bf[_0x43c9('0x3a')]!==_0x43c9('0x3b')){var _0x2a4302={};_0x2a4302[_0x1923bf[_0x43c9('0x12')]]={'$like':'%'+_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x38')]+'%'};return _0x2a4302;}})});}_0x38fe46=_[_0x43c9('0x39')]({},_0x38fe46,_0x1d63cf[_0x43c9('0x3c')]);var _0x4a62b2={'where':_0x38fe46[_0x43c9('0x36')]};return db['CmHopper'][_0x43c9('0xc')](_0x4a62b2)[_0x43c9('0x10')](function(_0x2d4700){_0xc14827[_0x43c9('0xc')]=_0x2d4700;if(_0x1d63cf[_0x43c9('0x1a')][_0x43c9('0x3d')]){_0x38fe46[_0x43c9('0x3e')]=[{'all':!![]}];}return db[_0x43c9('0x15')][_0x43c9('0x3f')](_0x38fe46);})['then'](function(_0x3e6b15){_0xc14827[_0x43c9('0x40')]=_0x3e6b15;return _0xc14827;})['then'](respondWithFilteredResult(_0x1da149,_0x38fe46))[_0x43c9('0x41')](handleError(_0x1da149,null));};exports[_0x43c9('0x42')]=function(_0x309fea,_0x52c316){var _0xb01a6e={'raw':!![],'where':{'id':_0x309fea[_0x43c9('0x43')]['id']}},_0x33f293={};_0x33f293[_0x43c9('0x19')]=_[_0x43c9('0x1b')](db[_0x43c9('0x15')][_0x43c9('0x16')]);_0x33f293[_0x43c9('0x1a')]=_[_0x43c9('0x1b')](_0x309fea[_0x43c9('0x1a')]);_0x33f293[_0x43c9('0x1d')]=_[_0x43c9('0x1c')](_0x33f293['model'],_0x33f293[_0x43c9('0x1a')]);_0xb01a6e[_0x43c9('0x30')]=_[_0x43c9('0x1c')](_0x33f293[_0x43c9('0x19')],qs['fields'](_0x309fea[_0x43c9('0x1a')][_0x43c9('0x31')]));_0xb01a6e['attributes']=_0xb01a6e[_0x43c9('0x30')][_0x43c9('0x32')]?_0xb01a6e[_0x43c9('0x30')]:_0x33f293[_0x43c9('0x19')];if(_0x309fea[_0x43c9('0x1a')][_0x43c9('0x3d')]){_0xb01a6e[_0x43c9('0x3e')]=[{'all':!![]}];}_0xb01a6e=_[_0x43c9('0x39')]({},_0xb01a6e,_0x309fea[_0x43c9('0x3c')]);return db['CmHopper'][_0x43c9('0x44')](_0xb01a6e)['then'](handleEntityNotFound(_0x52c316,null))[_0x43c9('0x10')](respondWithResult(_0x52c316,null))[_0x43c9('0x41')](handleError(_0x52c316,null));};exports[_0x43c9('0x45')]=function(_0x45de19,_0x55e0df){return db[_0x43c9('0x15')][_0x43c9('0x45')](_0x45de19['body'],{})[_0x43c9('0x10')](respondWithResult(_0x55e0df,0xc9))[_0x43c9('0x41')](handleError(_0x55e0df,null));};exports['update']=function(_0x16a020,_0x1ca85f){if(_0x16a020[_0x43c9('0x46')]['id']){delete _0x16a020['body']['id'];}return db[_0x43c9('0x15')]['find']({'where':{'id':_0x16a020['params']['id']}})[_0x43c9('0x10')](handleEntityNotFound(_0x1ca85f,null))[_0x43c9('0x10')](saveUpdates(_0x16a020[_0x43c9('0x46')],null))[_0x43c9('0x10')](respondWithResult(_0x1ca85f,null))[_0x43c9('0x41')](handleError(_0x1ca85f,null));};exports[_0x43c9('0x47')]=function(_0x1f966e,_0x31c766){return db[_0x43c9('0x15')][_0x43c9('0x47')]()[_0x43c9('0x10')](respondWithResult(_0x31c766,null))[_0x43c9('0x41')](handleError(_0x31c766,null));};exports[_0x43c9('0x48')]=function(_0x5082e9,_0xc57086){var _0x204068;var _0x4deed0=_0x5082e9[_0x43c9('0x43')]['id'];return db[_0x43c9('0x15')][_0x43c9('0x44')]({'where':{'id':_0x5082e9[_0x43c9('0x43')]['id']}})[_0x43c9('0x10')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x10')](function(_0x21adfe){if(_0x21adfe){return _0x21adfe[_0x43c9('0x48')]()[_0x43c9('0x10')](function(_0x508b62){return _0x508b62;});}})[_0x43c9('0x10')](function(_0x34c4c6){_0x204068=_0x34c4c6;if(_0x34c4c6){if(_0x34c4c6[_0x43c9('0x49')]||_0x34c4c6[_0x43c9('0x4a')]){return db[_0x34c4c6[_0x43c9('0x49')]?_0x43c9('0x4b'):'Campaign'][_0x43c9('0x44')]({'where':{'id':_0x34c4c6[_0x43c9('0x49')]?_0x34c4c6[_0x43c9('0x49')]:_0x34c4c6[_0x43c9('0x4a')]},'attributes':['id',_0x43c9('0x12')],'raw':!![]});}}})[_0x43c9('0x10')](function(_0x2439b3){var _0x6c638={};if(_0x2439b3){_['merge'](_0x6c638,_[_0x43c9('0x4c')](_0x204068['dataValues'],[_0x43c9('0x4d'),_0x43c9('0x4e'),'id']));_0x6c638[_0x43c9('0x4f')]=0x15;_0x6c638[_0x43c9('0x50')]='deleted';_0x6c638['campaign']=_0x2439b3['name'];_0x6c638[_0x43c9('0x51')]=_0x5082e9[_0x43c9('0x52')][_0x43c9('0x12')];_0x6c638[_0x43c9('0x53')]=_0x5082e9[_0x43c9('0x52')]['id'];_0x6c638[_0x43c9('0x54')]=!![];_0x6c638[_0x43c9('0x55')]=moment()[_0x43c9('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x6c638['calleridnum']=_0x204068[_0x43c9('0x57')];_0x6c638[_0x43c9('0x58')]=_0x204068['VoiceQueueId']?'queue':_0x43c9('0x59');return db[_0x43c9('0x5a')][_0x43c9('0x44')]({'where':{'id':_0x6c638['ContactId']},'attributes':[_0x43c9('0x5b'),_0x43c9('0x5c')]})[_0x43c9('0x10')](function(_0x3bb411){if(!_[_0x43c9('0x5d')](_0xc57086)&&!_[_0x43c9('0x5d')](_0x3bb411[_0x43c9('0x5b')])){_0x6c638[_0x43c9('0x5e')]=_0x3bb411[_0x43c9('0x5b')];if(!_[_0x43c9('0x5d')](_0x3bb411['lastName'])){_0x6c638[_0x43c9('0x5e')]+='\x20'+_0x3bb411[_0x43c9('0x5c')];}}})[_0x43c9('0x5f')](function(){return db[_0x43c9('0x60')][_0x43c9('0x45')](_0x6c638);});}})[_0x43c9('0x10')](function(_0x51938e){return db[_0x43c9('0x61')][_0x43c9('0x48')]({'where':{'CmHopperId':_0x4deed0}});})[_0x43c9('0x10')](function(){return _0xc57086[_0x43c9('0x7')](0xcc)[_0x43c9('0x62')]();})[_0x43c9('0x41')](handleError(_0xc57086,null));};exports[_0x43c9('0x63')]=function(_0x4b4b93,_0xd7f56b){var _0x4d4bf4=[];return db[_0x43c9('0x5a')][_0x43c9('0x47')]()[_0x43c9('0x10')](function(_0x4dc6a1){_0x4d4bf4=_['keys'](_0x4dc6a1);return _0x4b4b93[_0x43c9('0x52')][_0x43c9('0x64')]({'where':{'type':_0x43c9('0x65'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x43c9('0x66'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x43c9('0x10')](function(_0x2ad37f){if(_0x2ad37f&&_0x2ad37f['length']){return db[_0x43c9('0x67')]['transaction'](function(_0x186038){var _0x6e13f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x43c9('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2ad37f,'id')},'$or':[{'UserId':null},{'UserId':_0x4b4b93['user']['id']}]};var _0x2658b8={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ad37f)[_0x43c9('0x38')]([_0x43c9('0x68'),0x0])[_0x43c9('0x14')]('id')[_0x43c9('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x4b4b93[_0x43c9('0x52')]['id']}]};var _0x1a4da5={'$or':[_0x6e13f,_0x2658b8]};var _0x27d0ca=[];if(_0x4b4b93[_0x43c9('0x46')]['direction']&&_0x4b4b93[_0x43c9('0x46')]['direction']===_0x43c9('0x6a')){if(!_[_0x43c9('0x6b')](_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')])){_0x1a4da5['id']={'$in':_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')]};}_0x27d0ca=[[_0x43c9('0x6d'),_0x43c9('0x6e')],[_0x43c9('0x6f'),_0x2ad37f[0x0][_0x43c9('0x66')]===_0x43c9('0x6e')?_0x43c9('0x70'):'ASC'],db[_0x43c9('0x67')][_0x43c9('0x71')](_0x43c9('0x72')),['id',_0x43c9('0x70')]];}else{if(!_[_0x43c9('0x6b')](_0x4b4b93[_0x43c9('0x46')][_0x43c9('0x6c')])){_0x1a4da5['id']={'$notIn':_0x4b4b93['body'][_0x43c9('0x6c')]};}_0x27d0ca=[[_0x43c9('0x6d'),'DESC'],[_0x43c9('0x6f'),_0x2ad37f[0x0][_0x43c9('0x66')]],db[_0x43c9('0x67')][_0x43c9('0x71')](_0x43c9('0x73')),['id',_0x43c9('0x6e')]];}return db[_0x43c9('0x15')][_0x43c9('0x74')]({'attributes':['id','scheduledat',_0x43c9('0x57'),_0x43c9('0x75')],'where':_0x1a4da5,'order':_0x27d0ca,'transaction':_0x186038,'lock':_0x186038[_0x43c9('0x76')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x4d4bf4,'include':[{'model':db[_0x43c9('0x77')],'as':_0x43c9('0x78'),'attributes':['id','name']}]},{'model':db[_0x43c9('0x79')],'as':'List','attributes':['id',_0x43c9('0x12')]},{'model':db[_0x43c9('0x4b')],'as':_0x43c9('0x7a'),'attributes':['id',_0x43c9('0x12'),_0x43c9('0x7b')]}]})[_0x43c9('0x10')](function(_0x3a9aba){if(_0x3a9aba){return _0x3a9aba[_0x43c9('0xf')]({'UserId':_0x4b4b93['user']['id']},{'transaction':_0x186038});}});});}})[_0x43c9('0x10')](handleEntityNotFound(_0xd7f56b,null))[_0x43c9('0x10')](respondWithResult(_0xd7f56b,null))[_0x43c9('0x41')](handleError(_0xd7f56b,null));};exports['getPreviewRecall']=function(_0x329dd2,_0x52612a,_0x566b51){var _0x3df13b=[];var _0x40151f=_0x329dd2['params']['id'];var _0x113297=_0x329dd2['user']['id'];return db['CmContact'][_0x43c9('0x47')]()['then'](function(_0x1624c9){_0x3df13b=_[_0x43c9('0x1b')](_0x1624c9);return db['sequelize'][_0x43c9('0x7c')](function(_0x4b00ce){const _0x3e8a54={'id':_0x40151f};return db[_0x43c9('0x15')]['findOne']({'attributes':['id','scheduledat','recallme'],'where':_0x3e8a54,'transaction':_0x4b00ce,'lock':_0x4b00ce[_0x43c9('0x76')][_0x43c9('0x7d')],'include':[{'model':db[_0x43c9('0x5a')],'as':_0x43c9('0x7e'),'attributes':_0x3df13b,'include':[{'model':db[_0x43c9('0x77')],'as':'Company','attributes':['id',_0x43c9('0x12')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0x43c9('0x4b')],'as':_0x43c9('0x7a'),'attributes':['id',_0x43c9('0x12'),_0x43c9('0x7b')]}]})[_0x43c9('0x10')](function(_0x44e538){if(_0x44e538){return _0x44e538[_0x43c9('0xf')]({'UserId':_0x113297},{'transaction':_0x4b00ce});}});});})['then'](handleEntityNotFound(_0x52612a,null))['then'](respondWithResult(_0x52612a,null))[_0x43c9('0x41')](handleError(_0x52612a,null));};exports[_0x43c9('0x7f')]=function(_0x11cb72,_0x170f84){return _0x11cb72[_0x43c9('0x52')][_0x43c9('0x64')]({'where':{'type':_0x43c9('0x65'),'dialActive':!![],'dialMethod':_0x43c9('0x80')},'attributes':['id'],'raw':!![]})[_0x43c9('0x10')](function(_0x341f60){if(_0x341f60&&_0x341f60[_0x43c9('0x32')]){return db['CmHopper'][_0x43c9('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x43c9('0x56')](_0x43c9('0x81'))},'VoiceQueueId':{'$in':_['map'](_0x341f60,'id')},'$or':[{'UserId':null},{'UserId':_0x11cb72[_0x43c9('0x52')]['id']}]}});}return 0x0;})[_0x43c9('0x10')](function(_0x135ab1){if(!_['isNil'](_0x135ab1)&&_[_0x43c9('0x82')](_0x135ab1)){return _0x170f84[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')]({'contacts':_0x135ab1});}else{logger[_0x43c9('0x83')](_0x43c9('0x84'),_0x43c9('0x7f'),0x194,_0x43c9('0x85'));_0x170f84['sendStatus'](0x194);}})[_0x43c9('0x41')](handleError(_0x170f84,null));};exports['getTimezones']=function(_0x49a536,_0x3a99c7){var _0x5e5cc2=shared[_0x43c9('0x86')];var _0xe80086=[];_[_0x43c9('0x14')](_0x5e5cc2,function(_0x48ade5){_0xe80086[_0x43c9('0x87')]({'id':_0x48ade5['name'],'name':_0x48ade5[_0x43c9('0x12')],'utcOffset':_0x48ade5[_0x43c9('0x88')]});});return _0x3a99c7[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')]({'tz':_0xe80086});};exports[_0x43c9('0x89')]=function(_0x3d80f0,_0x28e816){var _0x1ecfbe=shared[_0x43c9('0x86')];var _0x21acd5={};if(!_[_0x43c9('0x5d')](_0x1ecfbe[_0x3d80f0[_0x43c9('0x46')]['id']]))_0x21acd5=_0x1ecfbe[_0x3d80f0[_0x43c9('0x46')]['id']];return _0x28e816[_0x43c9('0x7')](0xc8)[_0x43c9('0x8')](_0x21acd5);}; \ No newline at end of file +var _0xbeea=['phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','end','getPreview','CmContact','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','List','dialActive','update','CmCompany','Queue','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','limit','count','Content-Range','sendStatus','error','stack','name','send','rawAttributes','type','key','model','map','keys','filters','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','query','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmHopper','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','omit','createdAt','updatedAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum'];(function(_0x51e045,_0x7174ce){var _0x515df2=function(_0x3f1ce2){while(--_0x3f1ce2){_0x51e045['push'](_0x51e045['shift']());}};_0x515df2(++_0x7174ce);}(_0xbeea,0xb1));var _0xabee=function(_0x3212b7,_0x55d9ef){_0x3212b7=_0x3212b7-0x0;var _0x513bc2=_0xbeea[_0x3212b7];return _0x513bc2;};'use strict';var moment=require(_0xabee('0x0'));var _=require('lodash');var qs=require(_0xabee('0x1'));var logger=require(_0xabee('0x2'))(_0xabee('0x3'));var shared=require('../../config/environment');var db=require(_0xabee('0x4'))['db'];function respondWithResult(_0x59e264,_0x58afa7){_0x58afa7=_0x58afa7||0xc8;return function(_0x33571e){if(_0x33571e){return _0x59e264[_0xabee('0x5')](_0x58afa7)[_0xabee('0x6')](_0x33571e);}};}function respondWithFilteredResult(_0x1ea258,_0x58c9ef){return function(_0x5bb218){if(_0x5bb218){var _0x238317=typeof _0x58c9ef[_0xabee('0x7')]==='undefined'&&typeof _0x58c9ef[_0xabee('0x8')]==='undefined';var _0x14a78d=_0x5bb218[_0xabee('0x9')];var _0x2a1c06=_0x238317?0x0:_0x58c9ef[_0xabee('0x7')];var _0x33a862=_0x238317?_0x5bb218[_0xabee('0x9')]:_0x58c9ef['offset']+_0x58c9ef[_0xabee('0x8')];var _0x3bbb18;if(_0x33a862>=_0x14a78d){_0x33a862=_0x14a78d;_0x3bbb18=0xc8;}else{_0x3bbb18=0xce;}_0x1ea258[_0xabee('0x5')](_0x3bbb18);return _0x1ea258['set'](_0xabee('0xa'),_0x2a1c06+'-'+_0x33a862+'/'+_0x14a78d)[_0xabee('0x6')](_0x5bb218);}return null;};}function saveUpdates(_0x16d6a5,_0x49fb73){return function(_0x5915a1){if(_0x5915a1){return _0x5915a1['update'](_0x16d6a5)['then'](function(_0x57abc2){return _0x57abc2;});}return null;};}function handleEntityNotFound(_0x113c5c,_0x370a4e){return function(_0x38ba29){if(!_0x38ba29){_0x113c5c[_0xabee('0xb')](0x194);}return _0x38ba29;};}function handleError(_0x38cf66,_0x5e94ff){_0x5e94ff=_0x5e94ff||0x1f4;return function(_0x177670){logger[_0xabee('0xc')](_0x177670[_0xabee('0xd')]);if(_0x177670[_0xabee('0xe')]){delete _0x177670[_0xabee('0xe')];}_0x38cf66[_0xabee('0x5')](_0x5e94ff)[_0xabee('0xf')](_0x177670);};}exports['index']=function(_0x33e3c0,_0x112bb9){var _0x447ed3={},_0x471b24={},_0x150bdb={'count':0x0,'rows':[]};var _0xcf2973=_['map'](db['CmHopper'][_0xabee('0x10')],function(_0x593923){return{'name':_0x593923['fieldName'],'type':_0x593923[_0xabee('0x11')][_0xabee('0x12')]};});_0x471b24[_0xabee('0x13')]=_[_0xabee('0x14')](_0xcf2973,_0xabee('0xe'));_0x471b24['query']=_[_0xabee('0x15')](_0x33e3c0['query']);_0x471b24['filters']=_['intersection'](_0x471b24[_0xabee('0x13')],_0x471b24['query']);_0x471b24[_0xabee('0x16')]=_[_0xabee('0x17')](_0x471b24[_0xabee('0x16')],[_0xabee('0x18'),_0xabee('0x19'),_0xabee('0x1a'),_0xabee('0x1b'),'$lt',_0xabee('0x1c'),_0xabee('0x1d'),_0xabee('0x1e'),_0xabee('0x1f'),'$between',_0xabee('0x20'),_0xabee('0x21'),'$notIn',_0xabee('0x22'),_0xabee('0x23'),_0xabee('0x24'),_0xabee('0x25'),'$like',_0xabee('0x26'),_0xabee('0x27'),_0xabee('0x28'),_0xabee('0x29')]);_0x447ed3[_0xabee('0x2a')]=_[_0xabee('0x2b')](_0x471b24[_0xabee('0x13')],qs[_0xabee('0x2c')](_0x33e3c0[_0xabee('0x2d')]['fields']));_0x447ed3[_0xabee('0x2a')]=_0x447ed3['attributes'][_0xabee('0x2e')]?_0x447ed3[_0xabee('0x2a')]:_0x471b24[_0xabee('0x13')];if(!_0x33e3c0[_0xabee('0x2d')]['hasOwnProperty'](_0xabee('0x2f'))){_0x447ed3['limit']=qs[_0xabee('0x8')](_0x33e3c0['query'][_0xabee('0x8')]);_0x447ed3['offset']=qs['offset'](_0x33e3c0[_0xabee('0x2d')][_0xabee('0x7')]);}_0x447ed3[_0xabee('0x30')]=qs[_0xabee('0x31')](_0x33e3c0[_0xabee('0x2d')][_0xabee('0x31')]);_0x447ed3[_0xabee('0x32')]=qs[_0xabee('0x16')](_['pick'](_0x33e3c0[_0xabee('0x2d')],_0x471b24[_0xabee('0x16')]),_0xcf2973);if(_0x33e3c0[_0xabee('0x2d')][_0xabee('0x33')]){_0x447ed3[_0xabee('0x32')]=_[_0xabee('0x34')](_0x447ed3[_0xabee('0x32')],{'$or':_[_0xabee('0x14')](_0xcf2973,function(_0x41c4a3){if(_0x41c4a3[_0xabee('0x11')]!==_0xabee('0x35')){var _0x3112fd={};_0x3112fd[_0x41c4a3[_0xabee('0xe')]]={'$like':'%'+_0x33e3c0[_0xabee('0x2d')][_0xabee('0x33')]+'%'};return _0x3112fd;}})});}_0x447ed3=_[_0xabee('0x34')]({},_0x447ed3,_0x33e3c0[_0xabee('0x36')]);var _0x491279={'where':_0x447ed3['where']};return db[_0xabee('0x37')][_0xabee('0x9')](_0x491279)[_0xabee('0x38')](function(_0x153c0b){_0x150bdb['count']=_0x153c0b;if(_0x33e3c0[_0xabee('0x2d')][_0xabee('0x39')]){_0x447ed3[_0xabee('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0xabee('0x3b')](_0x447ed3);})['then'](function(_0x186333){_0x150bdb[_0xabee('0x3c')]=_0x186333;return _0x150bdb;})[_0xabee('0x38')](respondWithFilteredResult(_0x112bb9,_0x447ed3))[_0xabee('0x3d')](handleError(_0x112bb9,null));};exports['show']=function(_0x48d6ca,_0x417281){var _0xb76b1d={'raw':!![],'where':{'id':_0x48d6ca[_0xabee('0x3e')]['id']}},_0xa2ae67={};_0xa2ae67[_0xabee('0x13')]=_['keys'](db[_0xabee('0x37')][_0xabee('0x10')]);_0xa2ae67['query']=_[_0xabee('0x15')](_0x48d6ca[_0xabee('0x2d')]);_0xa2ae67['filters']=_[_0xabee('0x2b')](_0xa2ae67[_0xabee('0x13')],_0xa2ae67[_0xabee('0x2d')]);_0xb76b1d[_0xabee('0x2a')]=_[_0xabee('0x2b')](_0xa2ae67[_0xabee('0x13')],qs[_0xabee('0x2c')](_0x48d6ca['query'][_0xabee('0x2c')]));_0xb76b1d[_0xabee('0x2a')]=_0xb76b1d[_0xabee('0x2a')]['length']?_0xb76b1d[_0xabee('0x2a')]:_0xa2ae67[_0xabee('0x13')];if(_0x48d6ca['query'][_0xabee('0x39')]){_0xb76b1d[_0xabee('0x3a')]=[{'all':!![]}];}_0xb76b1d=_['merge']({},_0xb76b1d,_0x48d6ca[_0xabee('0x36')]);return db[_0xabee('0x37')][_0xabee('0x3f')](_0xb76b1d)[_0xabee('0x38')](handleEntityNotFound(_0x417281,null))[_0xabee('0x38')](respondWithResult(_0x417281,null))[_0xabee('0x3d')](handleError(_0x417281,null));};exports[_0xabee('0x40')]=function(_0x5a5fa7,_0x2aa2f0){return db[_0xabee('0x37')][_0xabee('0x40')](_0x5a5fa7['body'],{})[_0xabee('0x38')](respondWithResult(_0x2aa2f0,0xc9))[_0xabee('0x3d')](handleError(_0x2aa2f0,null));};exports['update']=function(_0x57c65c,_0x4b458f){if(_0x57c65c[_0xabee('0x41')]['id']){delete _0x57c65c[_0xabee('0x41')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x57c65c[_0xabee('0x3e')]['id']}})[_0xabee('0x38')](handleEntityNotFound(_0x4b458f,null))[_0xabee('0x38')](saveUpdates(_0x57c65c[_0xabee('0x41')],null))[_0xabee('0x38')](respondWithResult(_0x4b458f,null))[_0xabee('0x3d')](handleError(_0x4b458f,null));};exports[_0xabee('0x42')]=function(_0x307d34,_0xfb2b6f){return db[_0xabee('0x37')][_0xabee('0x42')]()[_0xabee('0x38')](respondWithResult(_0xfb2b6f,null))[_0xabee('0x3d')](handleError(_0xfb2b6f,null));};exports[_0xabee('0x43')]=function(_0x3e277d,_0x252f60){var _0x1b5cf2;var _0x34dca8=_0x3e277d['params']['id'];return db[_0xabee('0x37')][_0xabee('0x3f')]({'where':{'id':_0x3e277d['params']['id']}})['then'](handleEntityNotFound(_0x252f60,null))[_0xabee('0x38')](function(_0x3ecfff){if(_0x3ecfff){return _0x3ecfff[_0xabee('0x43')]()[_0xabee('0x38')](function(_0xe2433f){return _0xe2433f;});}})[_0xabee('0x38')](function(_0x37e589){_0x1b5cf2=_0x37e589;if(_0x37e589){if(_0x37e589['VoiceQueueId']||_0x37e589[_0xabee('0x44')]){return db[_0x37e589['VoiceQueueId']?_0xabee('0x45'):_0xabee('0x46')]['find']({'where':{'id':_0x37e589[_0xabee('0x47')]?_0x37e589[_0xabee('0x47')]:_0x37e589[_0xabee('0x44')]},'attributes':['id','name'],'raw':!![]});}}})[_0xabee('0x38')](function(_0x4f36a4){var _0x1fc0da={};if(_0x4f36a4){_[_0xabee('0x34')](_0x1fc0da,_[_0xabee('0x48')](_0x1b5cf2['dataValues'],[_0xabee('0x49'),_0xabee('0x4a'),'id']));_0x1fc0da[_0xabee('0x4b')]=0x15;_0x1fc0da['statedesc']=_0xabee('0x4c');_0x1fc0da[_0xabee('0x4d')]=_0x4f36a4[_0xabee('0xe')];_0x1fc0da[_0xabee('0x4e')]=_0x3e277d['user'][_0xabee('0xe')];_0x1fc0da[_0xabee('0x4f')]=_0x3e277d[_0xabee('0x50')]['id'];_0x1fc0da['deleted']=!![];_0x1fc0da[_0xabee('0x51')]=moment()[_0xabee('0x52')](_0xabee('0x53'));_0x1fc0da[_0xabee('0x54')]=_0x1b5cf2[_0xabee('0x55')];_0x1fc0da[_0xabee('0x56')]=_0x1b5cf2[_0xabee('0x47')]?_0xabee('0x57'):_0xabee('0x58');return db['CmContact']['find']({'where':{'id':_0x1fc0da[_0xabee('0x59')]},'attributes':[_0xabee('0x5a'),_0xabee('0x5b')]})[_0xabee('0x38')](function(_0x30f70c){if(!_[_0xabee('0x5c')](_0x252f60)&&!_['isNil'](_0x30f70c[_0xabee('0x5a')])){_0x1fc0da[_0xabee('0x5d')]=_0x30f70c[_0xabee('0x5a')];if(!_['isNil'](_0x30f70c['lastName'])){_0x1fc0da[_0xabee('0x5d')]+='\x20'+_0x30f70c['lastName'];}}})['finally'](function(){return db['CmHopperFinal'][_0xabee('0x40')](_0x1fc0da);});}})['then'](function(_0x449530){return db['CmHopperAdditionalPhone'][_0xabee('0x43')]({'where':{'CmHopperId':_0x34dca8}});})['then'](function(){return _0x252f60[_0xabee('0x5')](0xcc)[_0xabee('0x5e')]();})[_0xabee('0x3d')](handleError(_0x252f60,null));};exports[_0xabee('0x5f')]=function(_0x553cfb,_0xc4a70d){var _0x5d52fd=[];return db[_0xabee('0x60')][_0xabee('0x42')]()[_0xabee('0x38')](function(_0x3a41cd){_0x5d52fd=_[_0xabee('0x15')](_0x3a41cd);return _0x553cfb[_0xabee('0x50')][_0xabee('0x61')]({'where':{'type':_0xabee('0x62'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xabee('0x63'),_0xabee('0x64')],'raw':!![]});})['then'](function(_0x1d9fc3){if(_0x1d9fc3&&_0x1d9fc3['length']){return db[_0xabee('0x65')][_0xabee('0x66')](function(_0x230d3a){var _0x3d4fef={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xabee('0x53'))},'VoiceQueueId':{'$in':_[_0xabee('0x14')](_0x1d9fc3,'id')},'$or':[{'UserId':null},{'UserId':_0x553cfb[_0xabee('0x50')]['id']}]};var _0x47a0d2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1d9fc3)[_0xabee('0x33')]([_0xabee('0x64'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x553cfb[_0xabee('0x50')]['id']}]};var _0x1e0082={'$or':[_0x3d4fef,_0x47a0d2]};var _0x4a7bef=[];if(_0x553cfb[_0xabee('0x41')]['direction']&&_0x553cfb[_0xabee('0x41')][_0xabee('0x67')]==='prev'){if(!_[_0xabee('0x68')](_0x553cfb[_0xabee('0x41')][_0xabee('0x69')])){_0x1e0082['id']={'$in':_0x553cfb[_0xabee('0x41')][_0xabee('0x69')]};}_0x4a7bef=[[_0xabee('0x6a'),'ASC'],[_0xabee('0x6b'),_0x1d9fc3[0x0][_0xabee('0x63')]===_0xabee('0x6c')?_0xabee('0x6d'):'ASC'],db[_0xabee('0x65')][_0xabee('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xabee('0x6d')]];}else{if(!_[_0xabee('0x68')](_0x553cfb[_0xabee('0x41')]['hopperIds'])){_0x1e0082['id']={'$notIn':_0x553cfb[_0xabee('0x41')][_0xabee('0x69')]};}_0x4a7bef=[[_0xabee('0x6a'),_0xabee('0x6d')],['scheduledAt',_0x1d9fc3[0x0][_0xabee('0x63')]],db['sequelize'][_0xabee('0x6e')](_0xabee('0x6f')),['id',_0xabee('0x6c')]];}return db[_0xabee('0x37')][_0xabee('0x70')]({'attributes':['id',_0xabee('0x71'),_0xabee('0x55'),'recallme'],'where':_0x1e0082,'order':_0x4a7bef,'transaction':_0x230d3a,'lock':_0x230d3a[_0xabee('0x72')]['UPDATE'],'include':[{'model':db[_0xabee('0x60')],'as':_0xabee('0x73'),'attributes':_0x5d52fd,'include':[{'model':db['CmCompany'],'as':_0xabee('0x74'),'attributes':['id',_0xabee('0xe')]}]},{'model':db['CmList'],'as':_0xabee('0x75'),'attributes':['id',_0xabee('0xe')]},{'model':db[_0xabee('0x45')],'as':'Queue','attributes':['id',_0xabee('0xe'),_0xabee('0x76')]}]})['then'](function(_0x446f9b){if(_0x446f9b){return _0x446f9b[_0xabee('0x77')]({'UserId':_0x553cfb['user']['id']},{'transaction':_0x230d3a});}});});}})[_0xabee('0x38')](handleEntityNotFound(_0xc4a70d,null))[_0xabee('0x38')](respondWithResult(_0xc4a70d,null))[_0xabee('0x3d')](handleError(_0xc4a70d,null));};exports['getPreviewRecall']=function(_0x5e4e68,_0x2e2c08,_0xfc581){var _0x112861=[];var _0x19d112=_0x5e4e68[_0xabee('0x3e')]['id'];var _0x3a9913=_0x5e4e68[_0xabee('0x50')]['id'];return db[_0xabee('0x60')][_0xabee('0x42')]()[_0xabee('0x38')](function(_0x414f81){_0x112861=_[_0xabee('0x15')](_0x414f81);return db['sequelize']['transaction'](function(_0x22f073){const _0x43af53={'id':_0x19d112};return db[_0xabee('0x37')]['findOne']({'attributes':['id',_0xabee('0x71'),'recallme'],'where':_0x43af53,'transaction':_0x22f073,'lock':_0x22f073[_0xabee('0x72')]['UPDATE'],'include':[{'model':db[_0xabee('0x60')],'as':_0xabee('0x73'),'attributes':_0x112861,'include':[{'model':db[_0xabee('0x78')],'as':_0xabee('0x74'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xabee('0x75'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0xabee('0x79'),'attributes':['id',_0xabee('0xe'),_0xabee('0x76')]}]})[_0xabee('0x38')](function(_0x235463){if(_0x235463){return _0x235463[_0xabee('0x77')]({'UserId':_0x3a9913},{'transaction':_0x22f073});}});});})[_0xabee('0x38')](handleEntityNotFound(_0x2e2c08,null))['then'](respondWithResult(_0x2e2c08,null))['catch'](handleError(_0x2e2c08,null));};exports[_0xabee('0x7a')]=function(_0x398870,_0x5c49e6){return _0x398870[_0xabee('0x50')][_0xabee('0x61')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xabee('0x7b')},'attributes':['id'],'raw':!![]})[_0xabee('0x38')](function(_0x5eb87b){if(_0x5eb87b&&_0x5eb87b[_0xabee('0x2e')]){return db['CmHopper'][_0xabee('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xabee('0x52')](_0xabee('0x53'))},'VoiceQueueId':{'$in':_[_0xabee('0x14')](_0x5eb87b,'id')},'$or':[{'UserId':null},{'UserId':_0x398870[_0xabee('0x50')]['id']}]}});}return 0x0;})[_0xabee('0x38')](function(_0xe8c89d){if(!_[_0xabee('0x5c')](_0xe8c89d)&&_[_0xabee('0x7c')](_0xe8c89d)){return _0x5c49e6[_0xabee('0x5')](0xc8)[_0xabee('0x6')]({'contacts':_0xe8c89d});}else{logger[_0xabee('0xc')](_0xabee('0x7d'),'getOpenContacts',0x194,_0xabee('0x7e'));_0x5c49e6[_0xabee('0xb')](0x194);}})[_0xabee('0x3d')](handleError(_0x5c49e6,null));};exports['getTimezones']=function(_0x4d72b9,_0x5ed061){var _0x56b37d=shared[_0xabee('0x7f')];var _0x1a6a66=[];_[_0xabee('0x14')](_0x56b37d,function(_0x4433b8){_0x1a6a66[_0xabee('0x80')]({'id':_0x4433b8[_0xabee('0xe')],'name':_0x4433b8[_0xabee('0xe')],'utcOffset':_0x4433b8[_0xabee('0x81')]});});return _0x5ed061[_0xabee('0x5')](0xc8)['json']({'tz':_0x1a6a66});};exports[_0xabee('0x82')]=function(_0x529640,_0x191634){var _0x50a6db=shared['timezones'];var _0x3ded8f={};if(!_[_0xabee('0x5c')](_0x50a6db[_0x529640[_0xabee('0x41')]['id']]))_0x3ded8f=_0x50a6db[_0x529640[_0xabee('0x41')]['id']];return _0x191634['status'](0xc8)[_0xabee('0x6')](_0x3ded8f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a021fb0..bf4643c 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x53ec,0x192));var _0xc53e=function(_0x1b857f,_0x286e31){_0x1b857f=_0x1b857f-0x0;var _0x5582e9=_0x53ec[_0x1b857f];return _0x5582e9;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','bluebird','request-promise','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xc')]},{'name':_0xb71a('0xd'),'fields':[_0xb71a('0xd')]},{'name':_0xb71a('0xe'),'fields':[_0xb71a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0d7db75..45a0dfa 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 _0x3c8b=['COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','util','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','attributes','then','debug','stringify','catch','error','message','ShowCmHopper','model','info','body','CreateCmHopper','update','UpdateCmHopper','active','DestroyCmHopper','sequelize','transaction','order','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x39996a,_0x1b42f3){_0x39996a=_0x39996a-0x0;var _0x118f51=_0x3c8b[_0x39996a];return _0x118f51;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var moment=require('moment');var BPromise=require(_0xb3c8('0x1'));var db=require(_0xb3c8('0x2'))['db'];var logger=require(_0xb3c8('0x3'))('rpc');exports[_0xb3c8('0x4')]=function(_0x4691d0){var _0x3bc283=this;return new Promise(function(_0x45e091,_0x41b492){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'raw':_0x4691d0[_0xb3c8('0x7')]?_0x4691d0['options'][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x4691d0['options']?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x4691d0['options']?_0x4691d0['options']['attributes']||null:null,'limit':_0x4691d0[_0xb3c8('0x7')]?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'include':_0x4691d0['options']?_0x4691d0[_0xb3c8('0x7')][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x4691d0[_0xb3c8('0x7')]['include'],function(_0x1048ae){return{'model':db[_0x1048ae['model']],'as':_0x1048ae['as'],'attributes':_0x1048ae[_0xb3c8('0xd')],'include':_0x1048ae['include']?_[_0xb3c8('0xc')](_0x1048ae[_0xb3c8('0xb')],function(_0x34d866){return{'model':db[_0x34d866['model']],'as':_0x34d866['as'],'attributes':_0x34d866['attributes'],'include':_0x34d866[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x34d866[_0xb3c8('0xb')],function(_0x48a430){return{'model':db[_0x48a430['model']],'as':_0x48a430['as'],'attributes':_0x48a430[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x124ab6){logger['info'](_0xb3c8('0x4'),_0x4691d0);logger[_0xb3c8('0xf')](_0xb3c8('0x4'),_0x4691d0,JSON[_0xb3c8('0x10')](_0x124ab6));_0x45e091(_0x124ab6);})[_0xb3c8('0x11')](function(_0x98399d){logger[_0xb3c8('0x12')](_0xb3c8('0x4'),_0x98399d[_0xb3c8('0x13')],_0x4691d0);_0x41b492(_0x3bc283['error'](0x1f4,_0x98399d['message']));});});};exports[_0xb3c8('0x14')]=function(_0x5390cc){var _0x4d4bda=this;return new Promise(function(_0x433549,_0x4df53e){return db[_0xb3c8('0x5')]['find']({'raw':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x5390cc[_0xb3c8('0x7')]?_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x7')]['attributes']||null:null,'include':_0x5390cc[_0xb3c8('0x7')]?_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x5390cc[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x27c593){return{'model':db[_0x27c593[_0xb3c8('0x15')]],'as':_0x27c593['as'],'attributes':_0x27c593[_0xb3c8('0xd')],'include':_0x27c593['include']?_[_0xb3c8('0xc')](_0x27c593['include'],function(_0x1765b9){return{'model':db[_0x1765b9[_0xb3c8('0x15')]],'as':_0x1765b9['as'],'attributes':_0x1765b9[_0xb3c8('0xd')],'include':_0x1765b9[_0xb3c8('0xb')]?_['map'](_0x1765b9[_0xb3c8('0xb')],function(_0x657ae1){return{'model':db[_0x657ae1[_0xb3c8('0x15')]],'as':_0x657ae1['as'],'attributes':_0x657ae1[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x24de08){logger[_0xb3c8('0x16')]('ShowCmHopper',_0x5390cc);logger[_0xb3c8('0xf')](_0xb3c8('0x14'),_0x5390cc,JSON['stringify'](_0x24de08));_0x433549(_0x24de08);})[_0xb3c8('0x11')](function(_0xdc197e){logger[_0xb3c8('0x12')](_0xb3c8('0x14'),_0xdc197e[_0xb3c8('0x13')],_0x5390cc);_0x4df53e(_0x4d4bda[_0xb3c8('0x12')](0x1f4,_0xdc197e[_0xb3c8('0x13')]));});});};exports['CreateCmHopper']=function(_0x30ee51){var _0x29eb72=this;return new Promise(function(_0x31691e,_0x320e3f){return db[_0xb3c8('0x5')]['create'](_0x30ee51[_0xb3c8('0x17')],{'raw':_0x30ee51[_0xb3c8('0x7')]?_0x30ee51[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![]})[_0xb3c8('0xe')](function(_0x255409){logger[_0xb3c8('0x16')](_0xb3c8('0x18'),_0x30ee51);logger[_0xb3c8('0xf')]('CreateCmHopper',_0x30ee51,JSON[_0xb3c8('0x10')](_0x255409));_0x31691e(_0x255409);})['catch'](function(_0x33e1eb){logger[_0xb3c8('0x12')](_0xb3c8('0x18'),_0x33e1eb[_0xb3c8('0x13')],_0x30ee51);_0x320e3f(_0x29eb72[_0xb3c8('0x12')](0x1f4,_0x33e1eb[_0xb3c8('0x13')]));});});};exports['UpdateCmHopper']=function(_0x1fe1bb){var _0x4a7c9d=this;return new Promise(function(_0x3e825d,_0xbccb32){return db[_0xb3c8('0x5')][_0xb3c8('0x19')](_0x1fe1bb['body'],{'raw':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x1fe1bb['options']?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0xd')]||null:null,'limit':_0x1fe1bb[_0xb3c8('0x7')]?_0x1fe1bb[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null})['then'](function(_0x4bcac9){logger[_0xb3c8('0x16')](_0xb3c8('0x1a'),_0x1fe1bb);logger[_0xb3c8('0x16')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb3c8('0x10')](_0x1fe1bb['options'][_0xb3c8('0x9')]),_0x1fe1bb[_0xb3c8('0x17')][_0xb3c8('0x1b')]);logger['debug'](_0xb3c8('0x1a'),_0x1fe1bb,JSON[_0xb3c8('0x10')](_0x4bcac9));_0x3e825d(_0x4bcac9);})[_0xb3c8('0x11')](function(_0x24cdf4){logger[_0xb3c8('0x12')](_0xb3c8('0x1a'),_0x24cdf4[_0xb3c8('0x13')],_0x1fe1bb);_0xbccb32(_0x4a7c9d[_0xb3c8('0x12')](0x1f4,_0x24cdf4[_0xb3c8('0x13')]));});});};exports[_0xb3c8('0x1c')]=function(_0x4f97af){var _0x3dbfe1=this;return new Promise(function(_0x102cd8,_0xb4aab3){return db[_0xb3c8('0x5')]['destroy']({'where':_0x4f97af['options']?_0x4f97af[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null})[_0xb3c8('0xe')](function(_0x59d5e2){logger[_0xb3c8('0x16')](_0xb3c8('0x1c'),_0x4f97af);logger[_0xb3c8('0xf')](_0xb3c8('0x1c'),_0x4f97af,JSON[_0xb3c8('0x10')](_0x59d5e2));_0x102cd8(_0x59d5e2);})['catch'](function(_0x350583){logger[_0xb3c8('0x12')](_0xb3c8('0x1c'),_0x350583['message'],_0x4f97af);_0xb4aab3(_0x3dbfe1['error'](0x1f4,_0x350583[_0xb3c8('0x13')]));});});};exports['GetContactDialer']=function(_0xba8c6c){var _0xe3af73=this;return new Promise(function(_0x46cb74,_0x395ed9){return db['CmContact']['describe']()[_0xb3c8('0xe')](function(_0x29010c){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x51b6e3){return db['CmHopper']['findAll']({'where':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')]['attributes']||null:null,'limit':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'order':_0xba8c6c[_0xb3c8('0x7')]?_0xba8c6c[_0xb3c8('0x7')][_0xb3c8('0x1f')]||null:null,'transaction':_0x51b6e3,'lock':_0x51b6e3[_0xb3c8('0x20')][_0xb3c8('0x21')],'include':[{'model':db[_0xb3c8('0x22')],'as':'Contact','attributes':_[_0xb3c8('0x23')](_0x29010c)},{'model':db[_0xb3c8('0x24')],'as':_0xb3c8('0x25'),'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x27')]}]})['then'](function(_0x3da4a3){var _0x53e414=[];var _0x21f072=[];for(var _0xd67544=0x0;_0xd67544<_0x3da4a3[_0xb3c8('0x28')];_0xd67544+=0x1){var _0xf742b5=_0x3da4a3[_0xd67544][_0xb3c8('0x29')];if(_0xf742b5===null){_0x53e414[_0xb3c8('0x2a')](_0x3da4a3[_0xd67544][_0xb3c8('0x19')](_0xba8c6c[_0xb3c8('0x17')],{'transaction':_0x51b6e3}));}else if(!_0x21f072[_0xb3c8('0x2b')](_0xf742b5)){_0x21f072[_0xb3c8('0x2a')](_0xf742b5);_0x53e414[_0xb3c8('0x2a')](_0x3da4a3[_0xd67544][_0xb3c8('0x19')](_0xba8c6c['body'],{'transaction':_0x51b6e3}));}}return BPromise[_0xb3c8('0x2c')](_0x53e414);});})[_0xb3c8('0xe')](function(_0x189bc0){logger[_0xb3c8('0x16')]('GetContactDialer',_0xba8c6c);if(_0x189bc0[_0xb3c8('0x28')]>0x0){logger['info'](_0xb3c8('0x2d'),_0x189bc0[0x0][_0xb3c8('0x2e')]['id'],_0x189bc0[0x0]['dataValues'][_0xb3c8('0x2f')],_0x189bc0[0x0]['dataValues'][_0xb3c8('0x1b')]);}logger[_0xb3c8('0xf')](_0xb3c8('0x30'),_0xba8c6c,JSON[_0xb3c8('0x10')](_0x189bc0));_0x46cb74(_0x189bc0);})[_0xb3c8('0x11')](function(_0x195224){logger[_0xb3c8('0x12')](_0xb3c8('0x30'),_0x195224['message'],_0xba8c6c);_0x395ed9(_0xe3af73[_0xb3c8('0x12')](0x1f4,_0x195224[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x31')]=function(_0x2cf96d){var _0x319aea=this;return new Promise(function(_0x116d30,_0x2f19bc){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x495955){return db[_0xb3c8('0x32')][_0xb3c8('0x33')](_0x2cf96d['body'],{'raw':_0x2cf96d[_0xb3c8('0x7')]?_0x2cf96d[_0xb3c8('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0x495955})[_0xb3c8('0xe')](function(){logger[_0xb3c8('0x16')](_0xb3c8('0x34'),JSON[_0xb3c8('0x10')](_0x2cf96d[_0xb3c8('0x7')]['where']),_0x2cf96d[_0xb3c8('0x7')][_0xb3c8('0x9')][_0xb3c8('0x1b')]);return db[_0xb3c8('0x5')][_0xb3c8('0x35')]({'where':_0x2cf96d[_0xb3c8('0x7')]?_0x2cf96d[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'transaction':_0x495955});});})[_0xb3c8('0xe')](function(_0xf3311d){logger[_0xb3c8('0x16')](_0xb3c8('0x31'),_0x2cf96d);logger[_0xb3c8('0xf')](_0xb3c8('0x31'),_0x2cf96d,JSON[_0xb3c8('0x10')](_0xf3311d));_0x116d30(_0xf3311d);})[_0xb3c8('0x11')](function(_0x528474){logger[_0xb3c8('0x12')](_0xb3c8('0x31'),_0x528474[_0xb3c8('0x13')],_0x2cf96d);_0x2f19bc(_0x319aea['error'](0x1f4,_0x528474['message']));});});};exports[_0xb3c8('0x36')]=function(_0x2b3856){var _0x955807=this;return new Promise(function(_0x92c13a,_0x2c51dd){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'raw':_0x2b3856[_0xb3c8('0x7')]?_0x2b3856['options'][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x2b3856['options']?_0x2b3856['options'][_0xb3c8('0x9')]||null:null,'attributes':[[db[_0xb3c8('0x1d')]['fn'](_0xb3c8('0x37'),db[_0xb3c8('0x1d')]['fn']('IF',db[_0xb3c8('0x1d')][_0xb3c8('0x38')](_0xb3c8('0x39')+util[_0xb3c8('0x3a')]('\x22%s\x22',moment()[_0xb3c8('0x3a')](_0xb3c8('0x3b')))+'\x20,\x201,\x20null'))),_0xb3c8('0x3c')]]})['then'](function(_0x22f843){logger[_0xb3c8('0x16')](_0xb3c8('0x36'),_0x2b3856);logger['debug']('CountReScheduled',_0x2b3856,JSON['stringify'](_0x22f843));_0x92c13a(_0x22f843);})[_0xb3c8('0x11')](function(_0x100fd2){logger[_0xb3c8('0x12')]('CountReScheduled',_0x100fd2['message'],_0x2b3856);_0x2c51dd(_0x955807[_0xb3c8('0x12')](0x1f4,_0x100fd2[_0xb3c8('0x13')]));});});};exports[_0xb3c8('0x3d')]=function(_0x8376a3){var _0x387c38=this;return new Promise(function(_0x10273b,_0x45996a){return db[_0xb3c8('0x22')]['describe']()[_0xb3c8('0xe')](function(){return db['sequelize']['transaction'](function(_0x334400){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'where':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0x9')]||null:null,'attributes':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')]['attributes']||null:null,'limit':0x1,'order':_0x8376a3[_0xb3c8('0x7')]?_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0x1f')]||null:null,'group':db[_0xb3c8('0x5')][_0xb3c8('0x29')],'transaction':_0x334400,'lock':_0x334400[_0xb3c8('0x20')][_0xb3c8('0x21')],'include':_0x8376a3['options']?_0x8376a3['options'][_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x8376a3[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x57257d){return{'model':db[_0x57257d[_0xb3c8('0x15')]],'as':_0x57257d['as'],'attributes':_0x57257d[_0xb3c8('0xd')],'include':_0x57257d[_0xb3c8('0xb')]?_['map'](_0x57257d['include'],function(_0x23fb94){return{'model':db[_0x23fb94[_0xb3c8('0x15')]],'as':_0x23fb94['as'],'attributes':_0x23fb94[_0xb3c8('0xd')],'include':_0x23fb94[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x23fb94['include'],function(_0x3c1bef){return{'model':db[_0x3c1bef[_0xb3c8('0x15')]],'as':_0x3c1bef['as'],'attributes':_0x3c1bef[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cd743){var _0x54b139=[];for(var _0x1a3d43=0x0;_0x1a3d43<_0x2cd743[_0xb3c8('0x28')];_0x1a3d43+=0x1){_0x54b139[_0xb3c8('0x2a')](_0x2cd743[_0x1a3d43][_0xb3c8('0x19')](_0x8376a3[_0xb3c8('0x17')],{'transaction':_0x334400}));}return BPromise[_0xb3c8('0x2c')](_0x54b139);});})[_0xb3c8('0xe')](function(_0x1509cb){logger[_0xb3c8('0x16')](_0xb3c8('0x3d'),_0x8376a3);logger[_0xb3c8('0xf')]('GetContactRecallMe',_0x8376a3,JSON[_0xb3c8('0x10')](_0x1509cb));_0x10273b(_0x1509cb);})['catch'](function(_0x1ecb2d){logger['error'](_0xb3c8('0x3d'),_0x1ecb2d[_0xb3c8('0x13')],_0x8376a3);_0x45996a(_0x387c38[_0xb3c8('0x12')](0x1f4,_0x1ecb2d[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x3e')]=function(_0x41562c){var _0x1fe40e=this;return new Promise(function(_0x422993,_0x354f84){db[_0xb3c8('0x22')]['describe']()[_0xb3c8('0xe')](function(_0x5257a6){return db['CmHopper']['findAll']({'raw':_0x41562c['options']?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0x8')]===undefined?!![]:![]:!![],'where':_0x41562c[_0xb3c8('0x7')]?_0x41562c['options']['where']||null:null,'attributes':_0x41562c[_0xb3c8('0x7')]?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xd')]||null:null,'limit':_0x41562c[_0xb3c8('0x7')]?_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xa')]||null:null,'include':_0x41562c[_0xb3c8('0x7')]?_0x41562c['options']['include']?_[_0xb3c8('0xc')](_0x41562c[_0xb3c8('0x7')][_0xb3c8('0xb')],function(_0x36db3a){return{'model':db[_0x36db3a[_0xb3c8('0x15')]],'as':_0x36db3a['as'],'attributes':_0x36db3a['as']===_0xb3c8('0x3f')?_['keys'](_0x5257a6):_0x36db3a[_0xb3c8('0xd')],'include':_0x36db3a['include']?_[_0xb3c8('0xc')](_0x36db3a[_0xb3c8('0xb')],function(_0x42e40c){return{'model':db[_0x42e40c[_0xb3c8('0x15')]],'as':_0x42e40c['as'],'attributes':_0x42e40c[_0xb3c8('0xd')],'include':_0x42e40c[_0xb3c8('0xb')]?_[_0xb3c8('0xc')](_0x42e40c['include'],function(_0x2235f5){return{'model':db[_0x2235f5[_0xb3c8('0x15')]],'as':_0x2235f5['as'],'attributes':_0x2235f5[_0xb3c8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x1ad01a){logger[_0xb3c8('0x16')](_0xb3c8('0x4'),_0x41562c);logger[_0xb3c8('0xf')](_0xb3c8('0x4'),_0x41562c,JSON[_0xb3c8('0x10')](_0x1ad01a));_0x422993(_0x1ad01a);})[_0xb3c8('0x11')](function(_0x76fda1){logger[_0xb3c8('0x12')]('GetCmHopper',_0x76fda1['message'],_0x41562c);_0x354f84(_0x1fe40e[_0xb3c8('0x12')](0x1f4,_0x76fda1['message']));});});});};exports[_0xb3c8('0x40')]=function(_0x433a0d){var _0x3e7e5a=this;return new Promise(function(_0x13789c,_0x3fca4f){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x433a0d[_0xb3c8('0x7')][_0xb3c8('0x9')][_0xb3c8('0x41')]},'attributes':['id',_0xb3c8('0x42')],'order':[['id','DESC']]})[_0xb3c8('0xe')](function(_0x5bdb6b){logger[_0xb3c8('0x16')](_0xb3c8('0x43'),_0x433a0d);logger['debug'](_0xb3c8('0x43'),_0x433a0d,JSON['stringify'](_0x5bdb6b));_0x13789c(_0x5bdb6b);})['catch'](function(_0x5107dc){logger[_0xb3c8('0x12')](_0xb3c8('0x43'),_0x5107dc[_0xb3c8('0x13')],_0x433a0d);_0x3fca4f(_0x3e7e5a[_0xb3c8('0x12')](0x1f4,_0x5107dc['message']));});});};exports[_0xb3c8('0x44')]=function(_0x21f58e){var _0x58550a=this;return new Promise(function(_0x309f07,_0x4ac1fa){return db[_0xb3c8('0x1d')][_0xb3c8('0x1e')](function(_0x7601d6){var _0x598418=_0x21f58e[_0xb3c8('0x7')]&&_0x21f58e[_0xb3c8('0x7')][_0xb3c8('0x9')]?_0x21f58e[_0xb3c8('0x7')]['where']:{};return db['CmHopper'][_0xb3c8('0x19')](_0x21f58e['body'],{'where':_0x598418,'transaction':_0x7601d6})['then'](function(_0x2bd086){logger[_0xb3c8('0x16')](_0xb3c8('0x44'),_0x21f58e);logger[_0xb3c8('0xf')](_0xb3c8('0x44'),_0x21f58e,JSON[_0xb3c8('0x10')](_0x2bd086));_0x309f07(_0x2bd086);})[_0xb3c8('0x11')](function(_0x2f973a){logger[_0xb3c8('0x12')](_0xb3c8('0x44'),_0x2f973a[_0xb3c8('0x13')],_0x21f58e);_0x4ac1fa(_0x58550a[_0xb3c8('0x12')](0x1f4,_0x2f973a[_0xb3c8('0x13')]));});});});};exports[_0xb3c8('0x45')]=function(_0x1dd1c7){var _0x545c73=this;var _0x4e8723=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')]['voiceQueueIds'];var _0x58c949=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')][_0xb3c8('0x46')];var _0x1bed72=_0x1dd1c7[_0xb3c8('0x17')][_0xb3c8('0x9')]['availableAgentsIds'];return new Promise(function(_0x4ea664,_0x258721){return db[_0xb3c8('0x5')][_0xb3c8('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e8723},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xb3c8('0x38')](_0xb3c8('0x47')+_0x58c949+'\x20MINUTE'),'$gt':db[_0xb3c8('0x1d')]['literal'](_0xb3c8('0x48'))}},'UserId':{'$in':_0x1bed72}},'include':[{'model':db[_0xb3c8('0x22')],'as':_0xb3c8('0x3f')},{'model':db[_0xb3c8('0x24')],'as':_0xb3c8('0x25'),'attributes':['id',_0xb3c8('0x26'),_0xb3c8('0x27')]},{'model':db[_0xb3c8('0x49')],'as':_0xb3c8('0x4a')}]})[_0xb3c8('0xe')](function(_0x48cd37){if(_0x48cd37[_0xb3c8('0x28')]>0x0){return db[_0xb3c8('0x1d')]['transaction'](function(_0x1db0c0){return db[_0xb3c8('0x5')][_0xb3c8('0x19')]({'recallmeNotifiedDate':db[_0xb3c8('0x1d')]['literal'](_0xb3c8('0x48'))},{'where':{'id':{'$in':_[_0xb3c8('0xc')](_0x48cd37,'id')}},'transaction':_0x1db0c0})['then'](function(){_0x4ea664(_0x48cd37);})['catch'](function(_0x1798ba){logger[_0xb3c8('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x1798ba[_0xb3c8('0x13')],_0x1dd1c7);_0x258721(_0x545c73['error'](0x1f4,_0x1798ba[_0xb3c8('0x13')]));});})[_0xb3c8('0x11')](function(_0xd6364e){logger[_0xb3c8('0x12')](_0xb3c8('0x45'),_0xd6364e[_0xb3c8('0x13')],_0x1dd1c7);_0x258721(_0x545c73[_0xb3c8('0x12')](0x1f4,_0xd6364e['message']));});}else{_0x4ea664(_0x48cd37);}});});}; \ No newline at end of file +var _0xe51e=['raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','find','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','sequelize','transaction','order','LOCK','UPDATE','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','CmContact','describe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','lodash','util','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options'];(function(_0x1338a1,_0x48c226){var _0x39b9e6=function(_0x514e43){while(--_0x514e43){_0x1338a1['push'](_0x1338a1['shift']());}};_0x39b9e6(++_0x48c226);}(_0xe51e,0x1d1));var _0xee51=function(_0x131c4c,_0xbc3adf){_0x131c4c=_0x131c4c-0x0;var _0x2acc6a=_0xe51e[_0x131c4c];return _0x2acc6a;};'use strict';var _=require(_0xee51('0x0'));var util=require(_0xee51('0x1'));var moment=require(_0xee51('0x2'));var BPromise=require(_0xee51('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xee51('0x4'))('rpc');exports[_0xee51('0x5')]=function(_0x315d6d){var _0x423653=this;return new Promise(function(_0x343273,_0xa9f645){return db[_0xee51('0x6')][_0xee51('0x7')]({'raw':_0x315d6d[_0xee51('0x8')]?_0x315d6d[_0xee51('0x8')][_0xee51('0x9')]===undefined?!![]:![]:!![],'where':_0x315d6d['options']?_0x315d6d[_0xee51('0x8')][_0xee51('0xa')]||null:null,'attributes':_0x315d6d[_0xee51('0x8')]?_0x315d6d[_0xee51('0x8')][_0xee51('0xb')]||null:null,'limit':_0x315d6d[_0xee51('0x8')]?_0x315d6d[_0xee51('0x8')][_0xee51('0xc')]||null:null,'include':_0x315d6d[_0xee51('0x8')]?_0x315d6d[_0xee51('0x8')][_0xee51('0xd')]?_[_0xee51('0xe')](_0x315d6d[_0xee51('0x8')][_0xee51('0xd')],function(_0x1b4f91){return{'model':db[_0x1b4f91[_0xee51('0xf')]],'as':_0x1b4f91['as'],'attributes':_0x1b4f91[_0xee51('0xb')],'include':_0x1b4f91[_0xee51('0xd')]?_[_0xee51('0xe')](_0x1b4f91[_0xee51('0xd')],function(_0x35d3e1){return{'model':db[_0x35d3e1[_0xee51('0xf')]],'as':_0x35d3e1['as'],'attributes':_0x35d3e1['attributes'],'include':_0x35d3e1[_0xee51('0xd')]?_['map'](_0x35d3e1[_0xee51('0xd')],function(_0x61961){return{'model':db[_0x61961[_0xee51('0xf')]],'as':_0x61961['as'],'attributes':_0x61961[_0xee51('0xb')]};}):[]};}):[]};}):[]:[]})[_0xee51('0x10')](function(_0x3702ee){logger[_0xee51('0x11')](_0xee51('0x5'),_0x315d6d);logger[_0xee51('0x12')]('GetCmHopper',_0x315d6d,JSON[_0xee51('0x13')](_0x3702ee));_0x343273(_0x3702ee);})[_0xee51('0x14')](function(_0x436034){logger[_0xee51('0x15')]('GetCmHopper',_0x436034[_0xee51('0x16')],_0x315d6d);_0xa9f645(_0x423653[_0xee51('0x15')](0x1f4,_0x436034[_0xee51('0x16')]));});});};exports['ShowCmHopper']=function(_0xb0a6b){var _0x292d07=this;return new Promise(function(_0x471479,_0x5cfd4e){return db[_0xee51('0x6')][_0xee51('0x17')]({'raw':_0xb0a6b[_0xee51('0x8')]?_0xb0a6b[_0xee51('0x8')][_0xee51('0x9')]===undefined?!![]:![]:!![],'where':_0xb0a6b[_0xee51('0x8')]?_0xb0a6b[_0xee51('0x8')][_0xee51('0xa')]||null:null,'attributes':_0xb0a6b[_0xee51('0x8')]?_0xb0a6b[_0xee51('0x8')][_0xee51('0xb')]||null:null,'include':_0xb0a6b['options']?_0xb0a6b[_0xee51('0x8')]['include']?_[_0xee51('0xe')](_0xb0a6b[_0xee51('0x8')][_0xee51('0xd')],function(_0x3a952c){return{'model':db[_0x3a952c[_0xee51('0xf')]],'as':_0x3a952c['as'],'attributes':_0x3a952c[_0xee51('0xb')],'include':_0x3a952c[_0xee51('0xd')]?_['map'](_0x3a952c[_0xee51('0xd')],function(_0x366bcf){return{'model':db[_0x366bcf['model']],'as':_0x366bcf['as'],'attributes':_0x366bcf[_0xee51('0xb')],'include':_0x366bcf['include']?_['map'](_0x366bcf[_0xee51('0xd')],function(_0x512375){return{'model':db[_0x512375['model']],'as':_0x512375['as'],'attributes':_0x512375[_0xee51('0xb')]};}):[]};}):[]};}):[]:[]})[_0xee51('0x10')](function(_0x42ce77){logger[_0xee51('0x11')]('ShowCmHopper',_0xb0a6b);logger['debug'](_0xee51('0x18'),_0xb0a6b,JSON[_0xee51('0x13')](_0x42ce77));_0x471479(_0x42ce77);})[_0xee51('0x14')](function(_0x47e5bc){logger[_0xee51('0x15')]('ShowCmHopper',_0x47e5bc[_0xee51('0x16')],_0xb0a6b);_0x5cfd4e(_0x292d07[_0xee51('0x15')](0x1f4,_0x47e5bc[_0xee51('0x16')]));});});};exports[_0xee51('0x19')]=function(_0x2affe1){var _0xa63076=this;return new Promise(function(_0x3e1848,_0x152fe9){return db['CmHopper'][_0xee51('0x1a')](_0x2affe1[_0xee51('0x1b')],{'raw':_0x2affe1[_0xee51('0x8')]?_0x2affe1[_0xee51('0x8')][_0xee51('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x41cc95){logger[_0xee51('0x11')](_0xee51('0x19'),_0x2affe1);logger[_0xee51('0x12')](_0xee51('0x19'),_0x2affe1,JSON[_0xee51('0x13')](_0x41cc95));_0x3e1848(_0x41cc95);})[_0xee51('0x14')](function(_0x204ed8){logger['error'](_0xee51('0x19'),_0x204ed8[_0xee51('0x16')],_0x2affe1);_0x152fe9(_0xa63076[_0xee51('0x15')](0x1f4,_0x204ed8['message']));});});};exports[_0xee51('0x1c')]=function(_0x59b9fb){var _0x2f340f=this;return new Promise(function(_0x2d6a0a,_0x39ba39){return db[_0xee51('0x6')][_0xee51('0x1d')](_0x59b9fb[_0xee51('0x1b')],{'raw':_0x59b9fb[_0xee51('0x8')]?_0x59b9fb[_0xee51('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b9fb[_0xee51('0x8')]?_0x59b9fb[_0xee51('0x8')][_0xee51('0xa')]||null:null,'attributes':_0x59b9fb['options']?_0x59b9fb['options'][_0xee51('0xb')]||null:null,'limit':_0x59b9fb[_0xee51('0x8')]?_0x59b9fb['options'][_0xee51('0xc')]||null:null})[_0xee51('0x10')](function(_0x3f94fb){logger[_0xee51('0x11')](_0xee51('0x1c'),_0x59b9fb);logger[_0xee51('0x11')](_0xee51('0x1e'),JSON[_0xee51('0x13')](_0x59b9fb['options'][_0xee51('0xa')]),_0x59b9fb[_0xee51('0x1b')][_0xee51('0x1f')]);logger[_0xee51('0x12')]('UpdateCmHopper',_0x59b9fb,JSON[_0xee51('0x13')](_0x3f94fb));_0x2d6a0a(_0x3f94fb);})[_0xee51('0x14')](function(_0x478906){logger[_0xee51('0x15')](_0xee51('0x1c'),_0x478906['message'],_0x59b9fb);_0x39ba39(_0x2f340f['error'](0x1f4,_0x478906[_0xee51('0x16')]));});});};exports[_0xee51('0x20')]=function(_0x5cc365){var _0x2e91a7=this;return new Promise(function(_0x34bc4c,_0x19ae53){return db['CmHopper']['destroy']({'where':_0x5cc365['options']?_0x5cc365[_0xee51('0x8')][_0xee51('0xa')]||null:null})[_0xee51('0x10')](function(_0x995db9){logger[_0xee51('0x11')]('DestroyCmHopper',_0x5cc365);logger[_0xee51('0x12')](_0xee51('0x20'),_0x5cc365,JSON['stringify'](_0x995db9));_0x34bc4c(_0x995db9);})[_0xee51('0x14')](function(_0x94d488){logger['error'](_0xee51('0x20'),_0x94d488[_0xee51('0x16')],_0x5cc365);_0x19ae53(_0x2e91a7[_0xee51('0x15')](0x1f4,_0x94d488[_0xee51('0x16')]));});});};exports['GetContactDialer']=function(_0x27c3aa){var _0x5ca2af=this;return new Promise(function(_0x3f2985,_0x337b9f){return db['CmContact']['describe']()[_0xee51('0x10')](function(_0x2525a9){return db[_0xee51('0x21')][_0xee51('0x22')](function(_0xcf4823){return db[_0xee51('0x6')][_0xee51('0x7')]({'where':_0x27c3aa['options']?_0x27c3aa[_0xee51('0x8')][_0xee51('0xa')]||null:null,'attributes':_0x27c3aa[_0xee51('0x8')]?_0x27c3aa['options'][_0xee51('0xb')]||null:null,'limit':_0x27c3aa[_0xee51('0x8')]?_0x27c3aa['options'][_0xee51('0xc')]||null:null,'order':_0x27c3aa['options']?_0x27c3aa[_0xee51('0x8')][_0xee51('0x23')]||null:null,'transaction':_0xcf4823,'lock':_0xcf4823[_0xee51('0x24')][_0xee51('0x25')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0xee51('0x26')](_0x2525a9)},{'model':db[_0xee51('0x27')],'as':_0xee51('0x28'),'attributes':['id','name',_0xee51('0x29')]}]})[_0xee51('0x10')](function(_0x510eb4){var _0x3a75d6=[];var _0x36240c=[];for(var _0x5e8495=0x0;_0x5e8495<_0x510eb4[_0xee51('0x2a')];_0x5e8495+=0x1){var _0xede690=_0x510eb4[_0x5e8495][_0xee51('0x2b')];if(_0xede690===null){_0x3a75d6[_0xee51('0x2c')](_0x510eb4[_0x5e8495][_0xee51('0x1d')](_0x27c3aa[_0xee51('0x1b')],{'transaction':_0xcf4823}));}else if(!_0x36240c[_0xee51('0x2d')](_0xede690)){_0x36240c['push'](_0xede690);_0x3a75d6[_0xee51('0x2c')](_0x510eb4[_0x5e8495][_0xee51('0x1d')](_0x27c3aa[_0xee51('0x1b')],{'transaction':_0xcf4823}));}}return BPromise[_0xee51('0x2e')](_0x3a75d6);});})['then'](function(_0x1dfa87){logger['info'](_0xee51('0x2f'),_0x27c3aa);if(_0x1dfa87[_0xee51('0x2a')]>0x0){logger[_0xee51('0x11')](_0xee51('0x30'),_0x1dfa87[0x0][_0xee51('0x31')]['id'],_0x1dfa87[0x0]['dataValues']['ContactId'],_0x1dfa87[0x0][_0xee51('0x31')][_0xee51('0x1f')]);}logger[_0xee51('0x12')](_0xee51('0x2f'),_0x27c3aa,JSON[_0xee51('0x13')](_0x1dfa87));_0x3f2985(_0x1dfa87);})['catch'](function(_0x5a7222){logger['error'](_0xee51('0x2f'),_0x5a7222[_0xee51('0x16')],_0x27c3aa);_0x337b9f(_0x5ca2af['error'](0x1f4,_0x5a7222[_0xee51('0x16')]));});});});};exports[_0xee51('0x32')]=function(_0x38035b){var _0x22d426=this;return new Promise(function(_0x189bb9,_0x1690c1){return db[_0xee51('0x21')][_0xee51('0x22')](function(_0x3ddce1){return db[_0xee51('0x33')]['create'](_0x38035b[_0xee51('0x1b')],{'raw':_0x38035b['options']?_0x38035b[_0xee51('0x8')][_0xee51('0x9')]===undefined?!![]:![]:!![],'transaction':_0x3ddce1})[_0xee51('0x10')](function(){logger['info'](_0xee51('0x34'),JSON[_0xee51('0x13')](_0x38035b[_0xee51('0x8')]['where']),_0x38035b[_0xee51('0x8')][_0xee51('0xa')][_0xee51('0x1f')]);return db[_0xee51('0x6')][_0xee51('0x35')]({'where':_0x38035b['options']?_0x38035b[_0xee51('0x8')][_0xee51('0xa')]||null:null,'transaction':_0x3ddce1});});})['then'](function(_0xf21309){logger[_0xee51('0x11')](_0xee51('0x32'),_0x38035b);logger['debug'](_0xee51('0x32'),_0x38035b,JSON[_0xee51('0x13')](_0xf21309));_0x189bb9(_0xf21309);})['catch'](function(_0x35b0a2){logger[_0xee51('0x15')]('MoveContactManagedDialer',_0x35b0a2[_0xee51('0x16')],_0x38035b);_0x1690c1(_0x22d426[_0xee51('0x15')](0x1f4,_0x35b0a2['message']));});});};exports['CountReScheduled']=function(_0x326236){var _0x454581=this;return new Promise(function(_0x153544,_0x656acb){return db[_0xee51('0x6')][_0xee51('0x7')]({'raw':_0x326236['options']?_0x326236[_0xee51('0x8')][_0xee51('0x9')]===undefined?!![]:![]:!![],'where':_0x326236[_0xee51('0x8')]?_0x326236[_0xee51('0x8')][_0xee51('0xa')]||null:null,'attributes':[[db[_0xee51('0x21')]['fn']('COUNT',db[_0xee51('0x21')]['fn']('IF',db[_0xee51('0x21')][_0xee51('0x36')]('`scheduledat`\x20>=\x20'+util['format'](_0xee51('0x37'),moment()[_0xee51('0x38')](_0xee51('0x39')))+_0xee51('0x3a')))),_0xee51('0x3b')]]})[_0xee51('0x10')](function(_0x2ddb50){logger['info'](_0xee51('0x3c'),_0x326236);logger['debug'](_0xee51('0x3c'),_0x326236,JSON[_0xee51('0x13')](_0x2ddb50));_0x153544(_0x2ddb50);})[_0xee51('0x14')](function(_0x259979){logger[_0xee51('0x15')](_0xee51('0x3c'),_0x259979[_0xee51('0x16')],_0x326236);_0x656acb(_0x454581[_0xee51('0x15')](0x1f4,_0x259979[_0xee51('0x16')]));});});};exports[_0xee51('0x3d')]=function(_0x38e92f){var _0x1bf115=this;return new Promise(function(_0x2ff1a6,_0x2fdf57){return db[_0xee51('0x3e')][_0xee51('0x3f')]()['then'](function(){return db['sequelize'][_0xee51('0x22')](function(_0x572f3d){return db[_0xee51('0x6')][_0xee51('0x7')]({'where':_0x38e92f['options']?_0x38e92f[_0xee51('0x8')]['where']||null:null,'attributes':_0x38e92f['options']?_0x38e92f[_0xee51('0x8')][_0xee51('0xb')]||null:null,'limit':0x1,'order':_0x38e92f[_0xee51('0x8')]?_0x38e92f[_0xee51('0x8')]['order']||null:null,'group':db[_0xee51('0x6')][_0xee51('0x2b')],'transaction':_0x572f3d,'lock':_0x572f3d[_0xee51('0x24')][_0xee51('0x25')],'include':_0x38e92f[_0xee51('0x8')]?_0x38e92f[_0xee51('0x8')][_0xee51('0xd')]?_[_0xee51('0xe')](_0x38e92f['options'][_0xee51('0xd')],function(_0x2b1535){return{'model':db[_0x2b1535[_0xee51('0xf')]],'as':_0x2b1535['as'],'attributes':_0x2b1535['attributes'],'include':_0x2b1535[_0xee51('0xd')]?_['map'](_0x2b1535[_0xee51('0xd')],function(_0x4261d2){return{'model':db[_0x4261d2[_0xee51('0xf')]],'as':_0x4261d2['as'],'attributes':_0x4261d2[_0xee51('0xb')],'include':_0x4261d2[_0xee51('0xd')]?_[_0xee51('0xe')](_0x4261d2[_0xee51('0xd')],function(_0x3bdea5){return{'model':db[_0x3bdea5[_0xee51('0xf')]],'as':_0x3bdea5['as'],'attributes':_0x3bdea5['attributes']};}):[]};}):[]};}):[]:[]})[_0xee51('0x10')](function(_0x4dc769){var _0x1e0fc1=[];for(var _0x48aceb=0x0;_0x48aceb<_0x4dc769[_0xee51('0x2a')];_0x48aceb+=0x1){_0x1e0fc1[_0xee51('0x2c')](_0x4dc769[_0x48aceb][_0xee51('0x1d')](_0x38e92f['body'],{'transaction':_0x572f3d}));}return BPromise[_0xee51('0x2e')](_0x1e0fc1);});})['then'](function(_0x258a43){logger['info'](_0xee51('0x3d'),_0x38e92f);logger['debug'](_0xee51('0x3d'),_0x38e92f,JSON[_0xee51('0x13')](_0x258a43));_0x2ff1a6(_0x258a43);})[_0xee51('0x14')](function(_0x1c196a){logger[_0xee51('0x15')](_0xee51('0x3d'),_0x1c196a[_0xee51('0x16')],_0x38e92f);_0x2fdf57(_0x1bf115['error'](0x1f4,_0x1c196a[_0xee51('0x16')]));});});});};exports[_0xee51('0x40')]=function(_0x576a11){var _0x126d67=this;return new Promise(function(_0x5148b6,_0x274d3e){db[_0xee51('0x3e')][_0xee51('0x3f')]()['then'](function(_0x32c327){return db[_0xee51('0x6')]['findAll']({'raw':_0x576a11[_0xee51('0x8')]?_0x576a11['options']['raw']===undefined?!![]:![]:!![],'where':_0x576a11[_0xee51('0x8')]?_0x576a11['options'][_0xee51('0xa')]||null:null,'attributes':_0x576a11[_0xee51('0x8')]?_0x576a11[_0xee51('0x8')][_0xee51('0xb')]||null:null,'limit':_0x576a11[_0xee51('0x8')]?_0x576a11[_0xee51('0x8')][_0xee51('0xc')]||null:null,'include':_0x576a11[_0xee51('0x8')]?_0x576a11[_0xee51('0x8')][_0xee51('0xd')]?_['map'](_0x576a11[_0xee51('0x8')][_0xee51('0xd')],function(_0x302d45){return{'model':db[_0x302d45[_0xee51('0xf')]],'as':_0x302d45['as'],'attributes':_0x302d45['as']===_0xee51('0x41')?_[_0xee51('0x26')](_0x32c327):_0x302d45[_0xee51('0xb')],'include':_0x302d45[_0xee51('0xd')]?_[_0xee51('0xe')](_0x302d45[_0xee51('0xd')],function(_0x2104e6){return{'model':db[_0x2104e6[_0xee51('0xf')]],'as':_0x2104e6['as'],'attributes':_0x2104e6[_0xee51('0xb')],'include':_0x2104e6[_0xee51('0xd')]?_[_0xee51('0xe')](_0x2104e6[_0xee51('0xd')],function(_0x44c245){return{'model':db[_0x44c245[_0xee51('0xf')]],'as':_0x44c245['as'],'attributes':_0x44c245[_0xee51('0xb')]};}):[]};}):[]};}):[]:[]})[_0xee51('0x10')](function(_0x52e211){logger['info'](_0xee51('0x5'),_0x576a11);logger[_0xee51('0x12')](_0xee51('0x5'),_0x576a11,JSON[_0xee51('0x13')](_0x52e211));_0x5148b6(_0x52e211);})['catch'](function(_0x45026f){logger[_0xee51('0x15')](_0xee51('0x5'),_0x45026f[_0xee51('0x16')],_0x576a11);_0x274d3e(_0x126d67[_0xee51('0x15')](0x1f4,_0x45026f[_0xee51('0x16')]));});});});};exports[_0xee51('0x42')]=function(_0x2ba3f2){var _0xbc15d2=this;return new Promise(function(_0xb69f45,_0x17f7a9){return db[_0xee51('0x3e')][_0xee51('0x43')]({'raw':!![],'where':{'phone':_0x2ba3f2[_0xee51('0x8')][_0xee51('0xa')][_0xee51('0x44')]},'attributes':['id',_0xee51('0x45')],'order':[['id','DESC']]})[_0xee51('0x10')](function(_0x32a69f){logger[_0xee51('0x11')](_0xee51('0x46'),_0x2ba3f2);logger['debug'](_0xee51('0x46'),_0x2ba3f2,JSON[_0xee51('0x13')](_0x32a69f));_0xb69f45(_0x32a69f);})[_0xee51('0x14')](function(_0x48c366){logger[_0xee51('0x15')](_0xee51('0x46'),_0x48c366[_0xee51('0x16')],_0x2ba3f2);_0x17f7a9(_0xbc15d2[_0xee51('0x15')](0x1f4,_0x48c366['message']));});});};exports[_0xee51('0x47')]=function(_0x170fd9){var _0x3f81ed=this;return new Promise(function(_0x5ab1ad,_0x32ef23){return db[_0xee51('0x21')][_0xee51('0x22')](function(_0x232916){var _0x92d12c=_0x170fd9['options']&&_0x170fd9['options'][_0xee51('0xa')]?_0x170fd9[_0xee51('0x8')][_0xee51('0xa')]:{};return db[_0xee51('0x6')][_0xee51('0x1d')](_0x170fd9[_0xee51('0x1b')],{'where':_0x92d12c,'transaction':_0x232916})[_0xee51('0x10')](function(_0x5b5b29){logger[_0xee51('0x11')](_0xee51('0x47'),_0x170fd9);logger[_0xee51('0x12')](_0xee51('0x47'),_0x170fd9,JSON['stringify'](_0x5b5b29));_0x5ab1ad(_0x5b5b29);})[_0xee51('0x14')](function(_0x3fccc7){logger['error']('ResetActiveCalls',_0x3fccc7[_0xee51('0x16')],_0x170fd9);_0x32ef23(_0x3f81ed[_0xee51('0x15')](0x1f4,_0x3fccc7['message']));});});});};exports[_0xee51('0x48')]=function(_0x9154e1){var _0x164193=this;var _0x394820=_0x9154e1[_0xee51('0x1b')]['where']['voiceQueueIds'];var _0x4e3b84=_0x9154e1[_0xee51('0x1b')]['where'][_0xee51('0x49')];var _0xa70feb=_0x9154e1[_0xee51('0x1b')][_0xee51('0xa')][_0xee51('0x4a')];return new Promise(function(_0xcf8d99,_0x4acf8a){return db['CmHopper'][_0xee51('0x7')]({'where':{'voiceQueueId':{'$in':_0x394820},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xee51('0x4b')+_0x4e3b84+_0xee51('0x4c')),'$gt':db[_0xee51('0x21')]['literal'](_0xee51('0x4d'))}},'UserId':{'$in':_0xa70feb}},'include':[{'model':db['CmContact'],'as':_0xee51('0x41')},{'model':db[_0xee51('0x27')],'as':'Agent','attributes':['id',_0xee51('0x4e'),_0xee51('0x29')]},{'model':db['CmList'],'as':'List'}]})[_0xee51('0x10')](function(_0x2c3d95){if(_0x2c3d95['length']>0x0){return db[_0xee51('0x21')][_0xee51('0x22')](function(_0x439545){return db['CmHopper'][_0xee51('0x1d')]({'recallmeNotifiedDate':db[_0xee51('0x21')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x2c3d95,'id')}},'transaction':_0x439545})[_0xee51('0x10')](function(){_0xcf8d99(_0x2c3d95);})['catch'](function(_0x58f48c){logger[_0xee51('0x15')](_0xee51('0x48'),_0x58f48c[_0xee51('0x16')],_0x9154e1);_0x4acf8a(_0x164193[_0xee51('0x15')](0x1f4,_0x58f48c[_0xee51('0x16')]));});})[_0xee51('0x14')](function(_0x5e53e8){logger[_0xee51('0x15')](_0xee51('0x48'),_0x5e53e8['message'],_0x9154e1);_0x4acf8a(_0x164193['error'](0x1f4,_0x5e53e8[_0xee51('0x16')]));});}else{_0xcf8d99(_0x2c3d95);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f6bc570..655562f 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 _0x1f83=['getPreview','/timezone','getTimezone','put','delete','destroy','exports','../../components/auth/service','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview'];(function(_0x26bb7d,_0x476b43){var _0x14f17f=function(_0x1b5ccb){while(--_0x1b5ccb){_0x26bb7d['push'](_0x26bb7d['shift']());}};_0x14f17f(++_0x476b43);}(_0x1f83,0xa1));var _0x31f8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1f83[_0x3ab51d];return _0x29a04e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x31f8('0x0'));var controller=require('./cmHopper.controller');router[_0x31f8('0x1')]('/',auth['isAuthenticated'](),controller[_0x31f8('0x2')]);router[_0x31f8('0x1')](_0x31f8('0x3'),auth[_0x31f8('0x4')](),controller['describe']);router[_0x31f8('0x1')](_0x31f8('0x5'),auth['isAuthenticated'](),controller[_0x31f8('0x6')]);router[_0x31f8('0x1')](_0x31f8('0x7'),auth[_0x31f8('0x4')](),controller[_0x31f8('0x8')]);router[_0x31f8('0x1')](_0x31f8('0x9'),auth[_0x31f8('0x4')](),controller[_0x31f8('0xa')]);router[_0x31f8('0x1')](_0x31f8('0xb'),auth['isAuthenticated'](),controller[_0x31f8('0xc')]);router[_0x31f8('0xd')]('/',auth[_0x31f8('0x4')](),controller['create']);router[_0x31f8('0xd')](_0x31f8('0xe'),auth[_0x31f8('0x4')](),controller[_0x31f8('0xf')]);router['post'](_0x31f8('0x10'),auth[_0x31f8('0x4')](),controller[_0x31f8('0x11')]);router[_0x31f8('0x12')](_0x31f8('0x9'),auth[_0x31f8('0x4')](),controller['update']);router[_0x31f8('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x31f8('0x14')]);module[_0x31f8('0x15')]=router; \ No newline at end of file +var _0x1234=['put','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview'];(function(_0x14fd9c,_0x36d9ce){var _0xdd854f=function(_0x5730bc){while(--_0x5730bc){_0x14fd9c['push'](_0x14fd9c['shift']());}};_0xdd854f(++_0x36d9ce);}(_0x1234,0xc1));var _0x4123=function(_0x3c689f,_0x11da6a){_0x3c689f=_0x3c689f-0x0;var _0x4189fb=_0x1234[_0x3c689f];return _0x4189fb;};'use strict';var express=require(_0x4123('0x0'));var router=express[_0x4123('0x1')]();var auth=require(_0x4123('0x2'));var controller=require(_0x4123('0x3'));router[_0x4123('0x4')]('/',auth[_0x4123('0x5')](),controller['index']);router[_0x4123('0x4')]('/describe',auth[_0x4123('0x5')](),controller[_0x4123('0x6')]);router[_0x4123('0x4')](_0x4123('0x7'),auth[_0x4123('0x5')](),controller['getOpenContacts']);router['get'](_0x4123('0x8'),auth[_0x4123('0x5')](),controller[_0x4123('0x9')]);router['get'](_0x4123('0xa'),auth[_0x4123('0x5')](),controller[_0x4123('0xb')]);router[_0x4123('0x4')](_0x4123('0xc'),auth[_0x4123('0x5')](),controller[_0x4123('0xd')]);router[_0x4123('0xe')]('/',auth[_0x4123('0x5')](),controller[_0x4123('0xf')]);router[_0x4123('0xe')](_0x4123('0x10'),auth[_0x4123('0x5')](),controller['getPreview']);router['post']('/timezone',auth[_0x4123('0x5')](),controller['getTimezone']);router[_0x4123('0x11')](_0x4123('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4123('0x12')](_0x4123('0xa'),auth[_0x4123('0x5')](),controller[_0x4123('0x13')]);module[_0x4123('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 9a35f27..1582440 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 _0xa448=['moment','sequelize','STRING','INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1007d9,_0x2ca7a2){var _0x3515d3=function(_0x14730f){while(--_0x14730f){_0x1007d9['push'](_0x1007d9['shift']());}};_0x3515d3(++_0x2ca7a2);}(_0xa448,0x7e));var _0x8a44=function(_0x3ded30,_0xd630ad){_0x3ded30=_0x3ded30-0x0;var _0x471895=_0xa448[_0x3ded30];return _0x471895;};'use strict';var moment=require(_0x8a44('0x0'));var Sequelize=require(_0x8a44('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8a44('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8a44('0x4')],'defaultValue':moment()[_0x8a44('0x5')](_0x8a44('0x6'))},'countbusyretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a44('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9f43=['STRING','DATE','format','INTEGER','sequelize','exports'];(function(_0x371e38,_0x75590d){var _0x45bbcc=function(_0x1bc960){while(--_0x1bc960){_0x371e38['push'](_0x371e38['shift']());}};_0x45bbcc(++_0x75590d);}(_0x9f43,0x184));var _0x39f4=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0x9f43[_0xcd5a3d];return _0xd43207;};'use strict';var moment=require('moment');var Sequelize=require(_0x39f4('0x0'));module[_0x39f4('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x39f4('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x39f4('0x3')],'defaultValue':moment()[_0x39f4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39f4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39f4('0x5')],'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 153a077..f48ce04 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 _0x9402=['stack','name','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','include','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','UserProfileResource'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x9402,0x165));var _0x2940=function(_0x402c13,_0x3da1a4){_0x402c13=_0x402c13-0x0;var _0x19662f=_0x9402[_0x402c13];return _0x19662f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2940('0x0'));var jsonpatch=require(_0x2940('0x1'));var rp=require(_0x2940('0x2'));var moment=require(_0x2940('0x3'));var BPromise=require(_0x2940('0x4'));var Mustache=require(_0x2940('0x5'));var util=require('util');var path=require(_0x2940('0x6'));var sox=require(_0x2940('0x7'));var csv=require(_0x2940('0x8'));var ejs=require(_0x2940('0x9'));var fs=require('fs');var fs_extra=require(_0x2940('0xa'));var _=require(_0x2940('0xb'));var squel=require(_0x2940('0xc'));var crypto=require(_0x2940('0xd'));var jsforce=require(_0x2940('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2940('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2940('0xf'));var qs=require(_0x2940('0x10'));var as=require(_0x2940('0x11'));var hardwareService=require(_0x2940('0x12'));var logger=require('../../config/logger')(_0x2940('0x13'));var utils=require(_0x2940('0x14'));var config=require(_0x2940('0x15'));var licenseUtil=require(_0x2940('0x16'));var db=require(_0x2940('0x17'))['db'];function respondWithStatusCode(_0x54c395,_0x2bef7e){_0x2bef7e=_0x2bef7e||0xcc;return function(_0x13a733){if(_0x13a733){return _0x54c395[_0x2940('0x18')](_0x2bef7e);}return _0x54c395['status'](_0x2bef7e)[_0x2940('0x19')]();};}function respondWithResult(_0x1aa1fb,_0x575647){_0x575647=_0x575647||0xc8;return function(_0x5f947){if(_0x5f947){return _0x1aa1fb[_0x2940('0x1a')](_0x575647)[_0x2940('0x1b')](_0x5f947);}};}function respondWithFilteredResult(_0x437efc,_0x20bec0){return function(_0x3967d0){if(_0x3967d0){var _0xec21f2=typeof _0x20bec0[_0x2940('0x1c')]==='undefined'&&typeof _0x20bec0[_0x2940('0x1d')]===_0x2940('0x1e');var _0x5ee0ea=_0x3967d0[_0x2940('0x1f')];var _0x2adc01=_0xec21f2?0x0:_0x20bec0[_0x2940('0x1c')];var _0x3e116f=_0xec21f2?_0x3967d0[_0x2940('0x1f')]:_0x20bec0[_0x2940('0x1c')]+_0x20bec0[_0x2940('0x1d')];var _0x52106d;if(_0x3e116f>=_0x5ee0ea){_0x3e116f=_0x5ee0ea;_0x52106d=0xc8;}else{_0x52106d=0xce;}_0x437efc[_0x2940('0x1a')](_0x52106d);return _0x437efc['set'](_0x2940('0x20'),_0x2adc01+'-'+_0x3e116f+'/'+_0x5ee0ea)['json'](_0x3967d0);}return null;};}function patchUpdates(_0x38dd40){return function(_0x526aa8){try{jsonpatch['apply'](_0x526aa8,_0x38dd40,!![]);}catch(_0xf9d66e){return BPromise['reject'](_0xf9d66e);}return _0x526aa8[_0x2940('0x21')]();};}function saveUpdates(_0x5177df,_0x44bca5){return function(_0x1101c6){if(_0x1101c6){return _0x1101c6[_0x2940('0x22')](_0x5177df)[_0x2940('0x23')](function(_0x44486f){return _0x44486f;});}return null;};}function removeEntity(_0x2895a3,_0xbb80b4){return function(_0x3201ea){if(_0x3201ea){return _0x3201ea[_0x2940('0x24')]()[_0x2940('0x23')](function(){var _0x2f406c=_0x3201ea['get']({'plain':!![]});var _0x273617='CmHopperAdditionalPhones';return db[_0x2940('0x25')]['destroy']({'where':{'type':_0x273617,'resourceId':_0x2f406c['id']}})[_0x2940('0x23')](function(){return _0x3201ea;});})['then'](function(){_0x2895a3['status'](0xcc)[_0x2940('0x19')]();});}};}function handleEntityNotFound(_0x3d7a0d,_0x46b041){return function(_0x8d22ae){if(!_0x8d22ae){_0x3d7a0d[_0x2940('0x18')](0x194);}return _0x8d22ae;};}function handleError(_0x4d3baa,_0x4b97c8){_0x4b97c8=_0x4b97c8||0x1f4;return function(_0x327550){logger['error'](_0x327550[_0x2940('0x26')]);if(_0x327550[_0x2940('0x27')]){delete _0x327550[_0x2940('0x27')];}_0x4d3baa[_0x2940('0x1a')](_0x4b97c8)['send'](_0x327550);};}exports['index']=function(_0x518294,_0x324bef){var _0x5992ca={},_0x425c03={},_0x5c0ee2={'count':0x0,'rows':[]};var _0x54ac39=_[_0x2940('0x28')](db[_0x2940('0x29')]['rawAttributes'],function(_0xfc4a60){return{'name':_0xfc4a60[_0x2940('0x2a')],'type':_0xfc4a60[_0x2940('0x2b')][_0x2940('0x2c')]};});_0x425c03[_0x2940('0x2d')]=_[_0x2940('0x28')](_0x54ac39,_0x2940('0x27'));_0x425c03[_0x2940('0x2e')]=_['keys'](_0x518294[_0x2940('0x2e')]);_0x425c03[_0x2940('0x2f')]=_[_0x2940('0x30')](_0x425c03['model'],_0x425c03[_0x2940('0x2e')]);_0x5992ca['attributes']=_['intersection'](_0x425c03[_0x2940('0x2d')],qs[_0x2940('0x31')](_0x518294[_0x2940('0x2e')][_0x2940('0x31')]));_0x5992ca[_0x2940('0x32')]=_0x5992ca[_0x2940('0x32')][_0x2940('0x33')]?_0x5992ca[_0x2940('0x32')]:_0x425c03[_0x2940('0x2d')];if(!_0x518294['query'][_0x2940('0x34')](_0x2940('0x35'))){_0x5992ca[_0x2940('0x1d')]=qs[_0x2940('0x1d')](_0x518294[_0x2940('0x2e')][_0x2940('0x1d')]);_0x5992ca[_0x2940('0x1c')]=qs['offset'](_0x518294['query']['offset']);}_0x5992ca[_0x2940('0x36')]=qs[_0x2940('0x37')](_0x518294['query'][_0x2940('0x37')]);_0x5992ca[_0x2940('0x38')]=qs[_0x2940('0x2f')](_[_0x2940('0x39')](_0x518294[_0x2940('0x2e')],_0x425c03[_0x2940('0x2f')]),_0x54ac39);if(_0x518294[_0x2940('0x2e')][_0x2940('0x3a')]){_0x5992ca[_0x2940('0x38')]=_['merge'](_0x5992ca[_0x2940('0x38')],{'$or':_[_0x2940('0x28')](_0x54ac39,function(_0x561b2c){if(_0x561b2c[_0x2940('0x2b')]!==_0x2940('0x3b')){var _0x52aad7={};_0x52aad7[_0x561b2c['name']]={'$like':'%'+_0x518294['query'][_0x2940('0x3a')]+'%'};return _0x52aad7;}})});}_0x5992ca=_['merge']({},_0x5992ca,_0x518294[_0x2940('0x3c')]);var _0x530d76={'where':_0x5992ca['where']};return db[_0x2940('0x29')][_0x2940('0x1f')](_0x530d76)['then'](function(_0x58b3ad){_0x5c0ee2[_0x2940('0x1f')]=_0x58b3ad;if(_0x518294[_0x2940('0x2e')]['includeAll']){_0x5992ca['include']=[{'all':!![]}];}return db[_0x2940('0x29')][_0x2940('0x3d')](_0x5992ca);})[_0x2940('0x23')](function(_0x35f017){_0x5c0ee2[_0x2940('0x3e')]=_0x35f017;return _0x5c0ee2;})['then'](respondWithFilteredResult(_0x324bef,_0x5992ca))[_0x2940('0x3f')](handleError(_0x324bef,null));};exports[_0x2940('0x40')]=function(_0x4bb98f,_0x2ee7ea){var _0x390e0f={'raw':!![],'where':{'id':_0x4bb98f[_0x2940('0x41')]['id']}},_0x506122={};_0x506122['model']=_[_0x2940('0x42')](db[_0x2940('0x29')][_0x2940('0x43')]);_0x506122[_0x2940('0x2e')]=_['keys'](_0x4bb98f[_0x2940('0x2e')]);_0x506122[_0x2940('0x2f')]=_[_0x2940('0x30')](_0x506122[_0x2940('0x2d')],_0x506122['query']);_0x390e0f[_0x2940('0x32')]=_[_0x2940('0x30')](_0x506122['model'],qs['fields'](_0x4bb98f['query'][_0x2940('0x31')]));_0x390e0f[_0x2940('0x32')]=_0x390e0f[_0x2940('0x32')][_0x2940('0x33')]?_0x390e0f[_0x2940('0x32')]:_0x506122[_0x2940('0x2d')];if(_0x4bb98f[_0x2940('0x2e')]['includeAll']){_0x390e0f[_0x2940('0x44')]=[{'all':!![]}];}_0x390e0f=_[_0x2940('0x45')]({},_0x390e0f,_0x4bb98f[_0x2940('0x3c')]);return db[_0x2940('0x29')]['find'](_0x390e0f)['then'](handleEntityNotFound(_0x2ee7ea,null))[_0x2940('0x23')](respondWithResult(_0x2ee7ea,null))[_0x2940('0x3f')](handleError(_0x2ee7ea,null));};exports[_0x2940('0x46')]=function(_0x20e0e8,_0x1f85ea){return db[_0x2940('0x29')][_0x2940('0x46')](_0x20e0e8[_0x2940('0x47')],{})['then'](function(_0x1dbd6a){var _0x9a95a=_0x20e0e8['user']['get']({'plain':!![]});if(!_0x9a95a)throw new Error(_0x2940('0x48'));if(_0x9a95a['role']==='user'){var _0x554294=_0x1dbd6a['get']({'plain':!![]});var _0x2a1c48=_0x2940('0x49');return db[_0x2940('0x4a')]['find']({'where':{'name':_0x2a1c48,'userProfileId':_0x9a95a[_0x2940('0x4b')]},'raw':!![]})['then'](function(_0x4e7163){if(_0x4e7163&&_0x4e7163['autoAssociation']===0x0){return db[_0x2940('0x25')][_0x2940('0x46')]({'name':_0x554294[_0x2940('0x27')],'resourceId':_0x554294['id'],'type':_0x4e7163[_0x2940('0x27')],'sectionId':_0x4e7163['id']},{})[_0x2940('0x23')](function(){return _0x1dbd6a;});}else{return _0x1dbd6a;}})['catch'](function(_0x42c8d3){logger[_0x2940('0x4c')](_0x2940('0x4d'),_0x42c8d3);throw _0x42c8d3;});}return _0x1dbd6a;})[_0x2940('0x23')](respondWithResult(_0x1f85ea,0xc9))[_0x2940('0x3f')](handleError(_0x1f85ea,null));};exports[_0x2940('0x22')]=function(_0x42c902,_0xf75b40){if(_0x42c902[_0x2940('0x47')]['id']){delete _0x42c902[_0x2940('0x47')]['id'];}return db[_0x2940('0x29')][_0x2940('0x4e')]({'where':{'id':_0x42c902[_0x2940('0x41')]['id']}})[_0x2940('0x23')](handleEntityNotFound(_0xf75b40,null))['then'](saveUpdates(_0x42c902['body'],null))[_0x2940('0x23')](respondWithResult(_0xf75b40,null))[_0x2940('0x3f')](handleError(_0xf75b40,null));};exports['destroy']=function(_0x358bfc,_0x129944){return db['CmHopperAdditionalPhone'][_0x2940('0x4e')]({'where':{'id':_0x358bfc['params']['id']}})[_0x2940('0x23')](handleEntityNotFound(_0x129944,null))[_0x2940('0x23')](removeEntity(_0x129944,null))['catch'](handleError(_0x129944,null));}; \ No newline at end of file +var _0xa4e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','includeAll','rows','catch','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5dedba,_0x579dfb){var _0x214fba=function(_0x3555aa){while(--_0x3555aa){_0x5dedba['push'](_0x5dedba['shift']());}};_0x214fba(++_0x579dfb);}(_0xa4e9,0x185));var _0x9a4e=function(_0x32abf8,_0x3e0374){_0x32abf8=_0x32abf8-0x0;var _0x20bcdf=_0xa4e9[_0x32abf8];return _0x20bcdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a4e('0x0'));var zipdir=require(_0x9a4e('0x1'));var jsonpatch=require(_0x9a4e('0x2'));var rp=require(_0x9a4e('0x3'));var moment=require(_0x9a4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9a4e('0x5'));var util=require(_0x9a4e('0x6'));var path=require(_0x9a4e('0x7'));var sox=require('sox');var csv=require(_0x9a4e('0x8'));var ejs=require(_0x9a4e('0x9'));var fs=require('fs');var fs_extra=require(_0x9a4e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a4e('0xb'));var jsforce=require(_0x9a4e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9a4e('0x8'));var querystring=require(_0x9a4e('0xd'));var Papa=require(_0x9a4e('0xe'));var Redis=require(_0x9a4e('0xf'));var authService=require(_0x9a4e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a4e('0x11'));var hardwareService=require(_0x9a4e('0x12'));var logger=require(_0x9a4e('0x13'))('api');var utils=require(_0x9a4e('0x14'));var config=require(_0x9a4e('0x15'));var licenseUtil=require(_0x9a4e('0x16'));var db=require(_0x9a4e('0x17'))['db'];function respondWithStatusCode(_0x27476e,_0x17abf4){_0x17abf4=_0x17abf4||0xcc;return function(_0x2e1ece){if(_0x2e1ece){return _0x27476e[_0x9a4e('0x18')](_0x17abf4);}return _0x27476e[_0x9a4e('0x19')](_0x17abf4)[_0x9a4e('0x1a')]();};}function respondWithResult(_0xecc2e3,_0x4130f9){_0x4130f9=_0x4130f9||0xc8;return function(_0x13c685){if(_0x13c685){return _0xecc2e3[_0x9a4e('0x19')](_0x4130f9)[_0x9a4e('0x1b')](_0x13c685);}};}function respondWithFilteredResult(_0x4750c2,_0x4123ad){return function(_0x279dac){if(_0x279dac){var _0x3328b4=typeof _0x4123ad[_0x9a4e('0x1c')]===_0x9a4e('0x1d')&&typeof _0x4123ad[_0x9a4e('0x1e')]==='undefined';var _0x55f32c=_0x279dac[_0x9a4e('0x1f')];var _0x5784d0=_0x3328b4?0x0:_0x4123ad[_0x9a4e('0x1c')];var _0x31d239=_0x3328b4?_0x279dac['count']:_0x4123ad['offset']+_0x4123ad[_0x9a4e('0x1e')];var _0x32a22;if(_0x31d239>=_0x55f32c){_0x31d239=_0x55f32c;_0x32a22=0xc8;}else{_0x32a22=0xce;}_0x4750c2[_0x9a4e('0x19')](_0x32a22);return _0x4750c2[_0x9a4e('0x20')](_0x9a4e('0x21'),_0x5784d0+'-'+_0x31d239+'/'+_0x55f32c)['json'](_0x279dac);}return null;};}function patchUpdates(_0x25059c){return function(_0x3a447f){try{jsonpatch[_0x9a4e('0x22')](_0x3a447f,_0x25059c,!![]);}catch(_0x184980){return BPromise['reject'](_0x184980);}return _0x3a447f[_0x9a4e('0x23')]();};}function saveUpdates(_0x1927e3,_0x14f26d){return function(_0x28b364){if(_0x28b364){return _0x28b364['update'](_0x1927e3)[_0x9a4e('0x24')](function(_0x23b916){return _0x23b916;});}return null;};}function removeEntity(_0x2dd7f8,_0x2a0dde){return function(_0x511596){if(_0x511596){return _0x511596[_0x9a4e('0x25')]()[_0x9a4e('0x24')](function(){var _0x59b5d0=_0x511596[_0x9a4e('0x26')]({'plain':!![]});var _0x2b8acc=_0x9a4e('0x27');return db[_0x9a4e('0x28')][_0x9a4e('0x25')]({'where':{'type':_0x2b8acc,'resourceId':_0x59b5d0['id']}})[_0x9a4e('0x24')](function(){return _0x511596;});})[_0x9a4e('0x24')](function(){_0x2dd7f8['status'](0xcc)[_0x9a4e('0x1a')]();});}};}function handleEntityNotFound(_0x23b096,_0x25c49f){return function(_0x4a6cc2){if(!_0x4a6cc2){_0x23b096[_0x9a4e('0x18')](0x194);}return _0x4a6cc2;};}function handleError(_0x22b2bc,_0x15efc7){_0x15efc7=_0x15efc7||0x1f4;return function(_0x1acd97){logger[_0x9a4e('0x29')](_0x1acd97[_0x9a4e('0x2a')]);if(_0x1acd97['name']){delete _0x1acd97[_0x9a4e('0x2b')];}_0x22b2bc['status'](_0x15efc7)[_0x9a4e('0x2c')](_0x1acd97);};}exports[_0x9a4e('0x2d')]=function(_0x1fa91d,_0x49c0ef){var _0x4d728f={},_0x18b060={},_0x15747a={'count':0x0,'rows':[]};var _0x4949f1=_['map'](db[_0x9a4e('0x2e')]['rawAttributes'],function(_0x209000){return{'name':_0x209000[_0x9a4e('0x2f')],'type':_0x209000[_0x9a4e('0x30')][_0x9a4e('0x31')]};});_0x18b060[_0x9a4e('0x32')]=_['map'](_0x4949f1,_0x9a4e('0x2b'));_0x18b060[_0x9a4e('0x33')]=_['keys'](_0x1fa91d[_0x9a4e('0x33')]);_0x18b060['filters']=_[_0x9a4e('0x34')](_0x18b060[_0x9a4e('0x32')],_0x18b060['query']);_0x4d728f[_0x9a4e('0x35')]=_[_0x9a4e('0x34')](_0x18b060[_0x9a4e('0x32')],qs[_0x9a4e('0x36')](_0x1fa91d['query'][_0x9a4e('0x36')]));_0x4d728f[_0x9a4e('0x35')]=_0x4d728f[_0x9a4e('0x35')][_0x9a4e('0x37')]?_0x4d728f[_0x9a4e('0x35')]:_0x18b060[_0x9a4e('0x32')];if(!_0x1fa91d[_0x9a4e('0x33')][_0x9a4e('0x38')]('nolimit')){_0x4d728f[_0x9a4e('0x1e')]=qs['limit'](_0x1fa91d[_0x9a4e('0x33')][_0x9a4e('0x1e')]);_0x4d728f[_0x9a4e('0x1c')]=qs['offset'](_0x1fa91d[_0x9a4e('0x33')]['offset']);}_0x4d728f[_0x9a4e('0x39')]=qs[_0x9a4e('0x3a')](_0x1fa91d[_0x9a4e('0x33')]['sort']);_0x4d728f[_0x9a4e('0x3b')]=qs['filters'](_[_0x9a4e('0x3c')](_0x1fa91d[_0x9a4e('0x33')],_0x18b060[_0x9a4e('0x3d')]),_0x4949f1);if(_0x1fa91d['query'][_0x9a4e('0x3e')]){_0x4d728f[_0x9a4e('0x3b')]=_[_0x9a4e('0x3f')](_0x4d728f[_0x9a4e('0x3b')],{'$or':_[_0x9a4e('0x40')](_0x4949f1,function(_0x300a9b){if(_0x300a9b['type']!==_0x9a4e('0x41')){var _0x2bca06={};_0x2bca06[_0x300a9b[_0x9a4e('0x2b')]]={'$like':'%'+_0x1fa91d[_0x9a4e('0x33')][_0x9a4e('0x3e')]+'%'};return _0x2bca06;}})});}_0x4d728f=_[_0x9a4e('0x3f')]({},_0x4d728f,_0x1fa91d[_0x9a4e('0x42')]);var _0x17c403={'where':_0x4d728f[_0x9a4e('0x3b')]};return db[_0x9a4e('0x2e')][_0x9a4e('0x1f')](_0x17c403)[_0x9a4e('0x24')](function(_0x1bb386){_0x15747a[_0x9a4e('0x1f')]=_0x1bb386;if(_0x1fa91d[_0x9a4e('0x33')][_0x9a4e('0x43')]){_0x4d728f['include']=[{'all':!![]}];}return db[_0x9a4e('0x2e')]['findAll'](_0x4d728f);})[_0x9a4e('0x24')](function(_0x27d452){_0x15747a[_0x9a4e('0x44')]=_0x27d452;return _0x15747a;})['then'](respondWithFilteredResult(_0x49c0ef,_0x4d728f))[_0x9a4e('0x45')](handleError(_0x49c0ef,null));};exports[_0x9a4e('0x46')]=function(_0x14b96b,_0x1c5b9b){var _0x1825bb={'raw':!![],'where':{'id':_0x14b96b[_0x9a4e('0x47')]['id']}},_0x54d0d4={};_0x54d0d4[_0x9a4e('0x32')]=_[_0x9a4e('0x48')](db[_0x9a4e('0x2e')]['rawAttributes']);_0x54d0d4[_0x9a4e('0x33')]=_[_0x9a4e('0x48')](_0x14b96b[_0x9a4e('0x33')]);_0x54d0d4[_0x9a4e('0x3d')]=_[_0x9a4e('0x34')](_0x54d0d4['model'],_0x54d0d4[_0x9a4e('0x33')]);_0x1825bb['attributes']=_['intersection'](_0x54d0d4[_0x9a4e('0x32')],qs['fields'](_0x14b96b[_0x9a4e('0x33')][_0x9a4e('0x36')]));_0x1825bb[_0x9a4e('0x35')]=_0x1825bb[_0x9a4e('0x35')][_0x9a4e('0x37')]?_0x1825bb[_0x9a4e('0x35')]:_0x54d0d4['model'];if(_0x14b96b['query'][_0x9a4e('0x43')]){_0x1825bb[_0x9a4e('0x49')]=[{'all':!![]}];}_0x1825bb=_['merge']({},_0x1825bb,_0x14b96b['options']);return db[_0x9a4e('0x2e')][_0x9a4e('0x4a')](_0x1825bb)['then'](handleEntityNotFound(_0x1c5b9b,null))[_0x9a4e('0x24')](respondWithResult(_0x1c5b9b,null))[_0x9a4e('0x45')](handleError(_0x1c5b9b,null));};exports[_0x9a4e('0x4b')]=function(_0x24c594,_0x5f4b21){return db['CmHopperAdditionalPhone']['create'](_0x24c594[_0x9a4e('0x4c')],{})[_0x9a4e('0x24')](function(_0xc466ab){var _0x15345e=_0x24c594['user'][_0x9a4e('0x26')]({'plain':!![]});if(!_0x15345e)throw new Error(_0x9a4e('0x4d'));if(_0x15345e['role']==='user'){var _0x11288f=_0xc466ab[_0x9a4e('0x26')]({'plain':!![]});var _0x3ac77b='CmHopperAdditionalPhones';return db[_0x9a4e('0x4e')]['find']({'where':{'name':_0x3ac77b,'userProfileId':_0x15345e[_0x9a4e('0x4f')]},'raw':!![]})[_0x9a4e('0x24')](function(_0x48fcd7){if(_0x48fcd7&&_0x48fcd7[_0x9a4e('0x50')]===0x0){return db[_0x9a4e('0x28')][_0x9a4e('0x4b')]({'name':_0x11288f[_0x9a4e('0x2b')],'resourceId':_0x11288f['id'],'type':_0x48fcd7['name'],'sectionId':_0x48fcd7['id']},{})[_0x9a4e('0x24')](function(){return _0xc466ab;});}else{return _0xc466ab;}})['catch'](function(_0x469bcf){logger[_0x9a4e('0x29')](_0x9a4e('0x51'),_0x469bcf);throw _0x469bcf;});}return _0xc466ab;})[_0x9a4e('0x24')](respondWithResult(_0x5f4b21,0xc9))['catch'](handleError(_0x5f4b21,null));};exports[_0x9a4e('0x52')]=function(_0x2ce218,_0x5df7e4){if(_0x2ce218[_0x9a4e('0x4c')]['id']){delete _0x2ce218['body']['id'];}return db[_0x9a4e('0x2e')][_0x9a4e('0x4a')]({'where':{'id':_0x2ce218[_0x9a4e('0x47')]['id']}})[_0x9a4e('0x24')](handleEntityNotFound(_0x5df7e4,null))['then'](saveUpdates(_0x2ce218[_0x9a4e('0x4c')],null))['then'](respondWithResult(_0x5df7e4,null))[_0x9a4e('0x45')](handleError(_0x5df7e4,null));};exports[_0x9a4e('0x25')]=function(_0x42c709,_0x3dd9d7){return db[_0x9a4e('0x2e')][_0x9a4e('0x4a')]({'where':{'id':_0x42c709['params']['id']}})[_0x9a4e('0x24')](handleEntityNotFound(_0x3dd9d7,null))['then'](removeEntity(_0x3dd9d7,null))['catch'](handleError(_0x3dd9d7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 85a1fb8..e5d3434 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 _0x337e=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x27dc6d,_0x2091e2){var _0x1cd394=function(_0x24660c){while(--_0x24660c){_0x27dc6d['push'](_0x27dc6d['shift']());}};_0x1cd394(++_0x2091e2);}(_0x337e,0x179));var _0xe337=function(_0x1b9d38,_0x51e834){_0x1b9d38=_0x1b9d38-0x0;var _0x582a3d=_0x337e[_0x1b9d38];return _0x582a3d;};'use strict';var _=require(_0xe337('0x0'));var util=require('util');var logger=require(_0xe337('0x1'))(_0xe337('0x2'));var moment=require(_0xe337('0x3'));var BPromise=require(_0xe337('0x4'));var rp=require(_0xe337('0x5'));var fs=require('fs');var path=require(_0xe337('0x6'));var rimraf=require('rimraf');var config=require(_0xe337('0x7'));var attributes=require(_0xe337('0x8'));module[_0xe337('0x9')]=function(_0x33e56e,_0x56f8a4){return _0x33e56e['define'](_0xe337('0xa'),attributes,{'tableName':_0xe337('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x036b=['CmHopperAdditionalPhone','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x036b,0x145));var _0xb036=function(_0x4cb231,_0x3d3c5b){_0x4cb231=_0x4cb231-0x0;var _0x4d5063=_0x036b[_0x4cb231];return _0x4d5063;};'use strict';var _=require(_0xb036('0x0'));var util=require(_0xb036('0x1'));var logger=require(_0xb036('0x2'))('api');var moment=require(_0xb036('0x3'));var BPromise=require(_0xb036('0x4'));var rp=require(_0xb036('0x5'));var fs=require('fs');var path=require(_0xb036('0x6'));var rimraf=require(_0xb036('0x7'));var config=require('../../config/environment');var attributes=require(_0xb036('0x8'));module[_0xb036('0x9')]=function(_0x166b1d,_0x1bb536){return _0x166b1d[_0xb036('0xa')](_0xb036('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 27bede7..696095f 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 _0xdbc7=['countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','OrderBy','countnosuchnumberretry','catch','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','ASC','countbusyretry'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdbc7,0x1c5));var _0x7dbc=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xdbc7[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x7dbc('0x0'));var util=require(_0x7dbc('0x1'));var moment=require(_0x7dbc('0x2'));var BPromise=require(_0x7dbc('0x3'));var rs=require(_0x7dbc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dbc('0x5'))['db'];var utils=require(_0x7dbc('0x6'));var logger=require(_0x7dbc('0x7'))(_0x7dbc('0x8'));var config=require(_0x7dbc('0x9'));var jayson=require(_0x7dbc('0xa'));var client=jayson[_0x7dbc('0xb')][_0x7dbc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22b6dd,_0x354aac,_0x1f994b){return new BPromise(function(_0x23edac,_0x48123f){return client[_0x7dbc('0xd')](_0x22b6dd,_0x1f994b)['then'](function(_0x54cfa0){logger['info'](_0x7dbc('0xe'),_0x354aac,_0x7dbc('0xf'));logger[_0x7dbc('0x10')](_0x7dbc('0x11'),_0x354aac,_0x7dbc('0xf'),JSON[_0x7dbc('0x12')](_0x54cfa0));if(_0x54cfa0[_0x7dbc('0x13')]){if(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x14')]===0x1f4){logger[_0x7dbc('0x13')](_0x7dbc('0xe'),_0x354aac,_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);return _0x48123f(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);}logger[_0x7dbc('0x13')](_0x7dbc('0xe'),_0x354aac,_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);return _0x23edac(_0x54cfa0[_0x7dbc('0x13')][_0x7dbc('0x15')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x354aac,_0x7dbc('0xf'));_0x23edac(_0x54cfa0[_0x7dbc('0x16')][_0x7dbc('0x15')]);}})['catch'](function(_0xb1b07){logger['error'](_0x7dbc('0xe'),_0x354aac,_0xb1b07);_0x48123f(_0xb1b07);});});}exports[_0x7dbc('0x17')]=function(_0x5f20ae){var _0x4a6792=this;return new Promise(function(_0x59659e,_0x3a63d4){return db[_0x7dbc('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1a')],'ListId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1b')],'VoiceQueueId':_0x5f20ae['body']['VoiceQueueId']===undefined?null:_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1c')],'CampaignId':_0x5f20ae[_0x7dbc('0x19')][_0x7dbc('0x1d')]===undefined?null:_0x5f20ae['body'][_0x7dbc('0x1d')]}})[_0x7dbc('0x1e')](function(_0x180baf){if(_0x180baf!=null){return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x180baf['id'],'OrderBy':{'$gt':_0x180baf['OrderBy']}},'order':[['OrderBy',_0x7dbc('0x21')]]})[_0x7dbc('0x1e')](function(_0x21e7b7){var _0x4e96d7=0x0;if(_0x21e7b7){if(_0x21e7b7[_0x7dbc('0x22')]+_0x21e7b7[_0x7dbc('0x23')]+_0x21e7b7[_0x7dbc('0x24')]+_0x21e7b7['countnosuchnumberretry']+_0x21e7b7[_0x7dbc('0x25')]+_0x21e7b7[_0x7dbc('0x26')]+_0x21e7b7[_0x7dbc('0x27')]+_0x21e7b7[_0x7dbc('0x28')]<_0x5f20ae[_0x7dbc('0x29')][_0x7dbc('0x2a')])_0x4e96d7=0x1;_0x59659e({'additional':_0x4e96d7});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x180baf['id']},'order':[[_0x7dbc('0x2b'),_0x7dbc('0x21')]]})['then'](function(_0x4a5a15){var _0x181575=0x0;if(_0x4a5a15){if(_0x4a5a15[_0x7dbc('0x22')]+_0x4a5a15['countcongestionretry']+_0x4a5a15[_0x7dbc('0x24')]+_0x4a5a15[_0x7dbc('0x2c')]+_0x4a5a15[_0x7dbc('0x25')]+_0x4a5a15[_0x7dbc('0x26')]+_0x4a5a15['countmachineretry']+_0x4a5a15[_0x7dbc('0x28')]<_0x5f20ae[_0x7dbc('0x29')][_0x7dbc('0x2a')])_0x181575=0x1;_0x59659e({'additional':_0x181575});}else{_0x59659e({'additional':0x0});}})['catch'](function(_0x55dfdf){logger[_0x7dbc('0x13')]('VerifyAdditionalPhones',_0x55dfdf[_0x7dbc('0x15')]);_0x3a63d4(_0x4a6792[_0x7dbc('0x13')](0x1f4,_0x55dfdf[_0x7dbc('0x15')]));});}})[_0x7dbc('0x2d')](function(_0x282830){logger['error'](_0x7dbc('0x17'),_0x282830[_0x7dbc('0x15')]);_0x3a63d4(_0x4a6792[_0x7dbc('0x13')](0x1f4,_0x282830[_0x7dbc('0x15')]));});}else _0x59659e({'additional':0x0});});});};exports[_0x7dbc('0x2e')]=function(_0x2fce6b){var _0x1dfc69=this;return new Promise(function(_0x3859ea,_0x6c70fa){return db['CmHopper'][_0x7dbc('0x20')]({'raw':!![],'where':{'ContactId':_0x2fce6b['body'][_0x7dbc('0x1a')],'ListId':_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1b')],'VoiceQueueId':_0x2fce6b['body'][_0x7dbc('0x1c')]===undefined?null:_0x2fce6b['body'][_0x7dbc('0x1c')],'CampaignId':_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1d')]===undefined?null:_0x2fce6b[_0x7dbc('0x19')][_0x7dbc('0x1d')]}})['then'](function(_0x5ba227){if(_0x5ba227!=null){return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x5ba227['id'],'OrderBy':{'$gte':_0x5ba227[_0x7dbc('0x2b')]}},'order':[[_0x7dbc('0x2b'),_0x7dbc('0x21')]]})[_0x7dbc('0x1e')](function(_0x13e41a){if(_0x13e41a)return activateAdditionalPhone(_0x5ba227,_0x2fce6b[_0x7dbc('0x19')],_0x13e41a,_0x2fce6b[_0x7dbc('0x2f')],_0x2fce6b[_0x7dbc('0x30')])[_0x7dbc('0x1e')](function(_0x2adbfa){_0x3859ea(_0x2adbfa);});else{return db[_0x7dbc('0x1f')][_0x7dbc('0x20')]({'raw':!![],'where':{'CmHopperId':_0x5ba227['id']},'order':[[_0x7dbc('0x2b'),'ASC']]})[_0x7dbc('0x1e')](function(_0x19e791){if(_0x19e791)return activateAdditionalPhone(_0x5ba227,_0x2fce6b[_0x7dbc('0x19')],_0x19e791,_0x2fce6b[_0x7dbc('0x2f')],_0x2fce6b[_0x7dbc('0x30')])[_0x7dbc('0x1e')](function(_0x19c057){_0x3859ea(_0x19c057);});else{_0x3859ea({'id':_0x5ba227['id'],'phone':''});}})[_0x7dbc('0x2d')](function(_0x1aea7b){logger['error'](_0x7dbc('0x17'),_0x1aea7b[_0x7dbc('0x15')]);_0x6c70fa(_0x1dfc69[_0x7dbc('0x13')](0x1f4,_0x1aea7b[_0x7dbc('0x15')]));});}})[_0x7dbc('0x2d')](function(_0x349159){logger['error']('VerifyAdditionalPhones',_0x349159[_0x7dbc('0x15')]);_0x6c70fa(_0x1dfc69[_0x7dbc('0x13')](0x1f4,_0x349159[_0x7dbc('0x15')]));});}else _0x3859ea(0x1);});});};function activateAdditionalPhone(_0x269b7a,_0x4ae26c,_0x31a023,_0x129289,_0x53ee86){return new Promise(function(_0x1543f6,_0x3583d7){var _0x36c0dd;if(_[_0x7dbc('0x31')](_0x31a023[_0x7dbc('0x32')])){_0x31a023[_0x7dbc('0x32')]=moment();}if(moment()>moment(_0x31a023[_0x7dbc('0x32')])){_0x36c0dd=moment()[_0x7dbc('0x33')](_0x53ee86||0x3,'minutes');}else{if(_0x31a023[_0x7dbc('0x2b')]==0x0){_0x36c0dd=moment(_0x31a023[_0x7dbc('0x32')]);}else{_0x36c0dd=moment()['add'](_0x53ee86||0x3,'minutes');}}if(_[_0x7dbc('0x31')](_0x36c0dd)){_0x36c0dd=moment()[_0x7dbc('0x33')](_0x53ee86||0x3,_0x7dbc('0x34'));}var _0x3eacbb={'phone':_0x269b7a[_0x7dbc('0x35')],'active':0x0,'OrderBy':_[_0x7dbc('0x31')](_0x269b7a['OrderBy'])?0x0:_0x269b7a[_0x7dbc('0x2b')],'scheduledat':moment()[_0x7dbc('0x33')](_0x129289||0x1,_0x7dbc('0x34')),'countbusyretry':_0x4ae26c[_0x7dbc('0x22')],'countcongestionretry':_0x4ae26c[_0x7dbc('0x23')],'countnoanswerretry':_0x4ae26c[_0x7dbc('0x24')],'countnosuchnumberretry':_0x4ae26c['countnosuchnumberretry'],'countdropretry':_0x4ae26c['countdropretry'],'countabandonedretry':_0x4ae26c['countabandonedretry'],'countmachineretry':_0x4ae26c['countmachineretry'],'countagentrejectretry':_0x4ae26c['countagentrejectretry'],'createdAt':_0x4ae26c[_0x7dbc('0x36')],'updatedAt':_0x4ae26c[_0x7dbc('0x37')]};var _0x50e746={'CmHopperId':_0x269b7a['id'],'phone':_0x31a023['phone'],'active':0x0,'OrderBy':_[_0x7dbc('0x31')](_0x31a023[_0x7dbc('0x2b')])?0x0:_0x31a023['OrderBy'],'scheduledat':_0x36c0dd,'countbusyretry':_0x31a023[_0x7dbc('0x22')],'countcongestionretry':_0x31a023[_0x7dbc('0x23')],'countnoanswerretry':_0x31a023['countnoanswerretry'],'countnosuchnumberretry':_0x31a023['countnosuchnumberretry'],'countdropretry':_0x31a023[_0x7dbc('0x25')],'countabandonedretry':_0x31a023['countabandonedretry'],'countmachineretry':_0x31a023[_0x7dbc('0x27')],'countagentrejectretry':_0x31a023['countagentrejectretry'],'createdAt':_0x31a023[_0x7dbc('0x36')],'updatedAt':_0x31a023[_0x7dbc('0x37')]};return db[_0x7dbc('0x38')]['transaction'](function(_0x4c8616){return db[_0x7dbc('0x1f')][_0x7dbc('0x39')](_0x3eacbb,{'where':{'id':_0x31a023['id']}},{'transaction':_0x4c8616})['then'](function(){return db[_0x7dbc('0x18')][_0x7dbc('0x39')](_0x50e746,{'where':{'id':_0x269b7a['id']}},{'transaction':_0x4c8616});});})[_0x7dbc('0x1e')](function(_0x3d23a3){_0x1543f6({'id':_0x269b7a['id'],'phone':_0x31a023['phone']});})[_0x7dbc('0x2d')](function(_0x35c354){logger[_0x7dbc('0x13')](_0x7dbc('0x3a'),_0x35c354[_0x7dbc('0x15')]);_0x3583d7({'error':_0x35c354[_0x7dbc('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x1ac4f7){var _0x8a2a10=this;return new Promise(function(_0x1ac6c3,_0x44060a){return db[_0x7dbc('0x18')][_0x7dbc('0x39')](_0x1ac4f7['body'][_0x7dbc('0x3b')],{'where':{'id':_0x1ac4f7[_0x7dbc('0x19')]['id']}})['then'](function(_0x1d428e){_0x1ac6c3(_0x1d428e);})[_0x7dbc('0x2d')](function(_0x1389d1){logger['error'](_0x7dbc('0x3c'),_0x1389d1[_0x7dbc('0x15')]);_0x44060a(_0x8a2a10['error'](0x1f4,_0x1389d1[_0x7dbc('0x15')]));});});}; \ No newline at end of file +var _0x6223=['CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','countbusyretry','countdropretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','sequelize','update','phone','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId'];(function(_0xbdfc7,_0x133ebf){var _0x1c86d1=function(_0x2cc649){while(--_0x2cc649){_0xbdfc7['push'](_0xbdfc7['shift']());}};_0x1c86d1(++_0x133ebf);}(_0x6223,0xc5));var _0x3622=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x6223[_0x1de43c];return _0x296d3e;};'use strict';var _=require(_0x3622('0x0'));var util=require(_0x3622('0x1'));var moment=require('moment');var BPromise=require(_0x3622('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3622('0x3'))['db'];var utils=require(_0x3622('0x4'));var logger=require(_0x3622('0x5'))('rpc');var config=require(_0x3622('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3622('0x7')][_0x3622('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x363655,_0x551391,_0x24c660){return new BPromise(function(_0x522994,_0x2de8ff){return client['request'](_0x363655,_0x24c660)[_0x3622('0x9')](function(_0x3a2e9a){logger[_0x3622('0xa')](_0x3622('0xb'),_0x551391,_0x3622('0xc'));logger['debug'](_0x3622('0xd'),_0x551391,'request\x20sent',JSON[_0x3622('0xe')](_0x3a2e9a));if(_0x3a2e9a[_0x3622('0xf')]){if(_0x3a2e9a[_0x3622('0xf')][_0x3622('0x10')]===0x1f4){logger[_0x3622('0xf')](_0x3622('0xb'),_0x551391,_0x3a2e9a[_0x3622('0xf')][_0x3622('0x11')]);return _0x2de8ff(_0x3a2e9a['error'][_0x3622('0x11')]);}logger['error'](_0x3622('0xb'),_0x551391,_0x3a2e9a[_0x3622('0xf')][_0x3622('0x11')]);return _0x522994(_0x3a2e9a[_0x3622('0xf')][_0x3622('0x11')]);}else{logger[_0x3622('0xa')](_0x3622('0xb'),_0x551391,_0x3622('0xc'));_0x522994(_0x3a2e9a[_0x3622('0x12')]['message']);}})[_0x3622('0x13')](function(_0x23643a){logger[_0x3622('0xf')](_0x3622('0xb'),_0x551391,_0x23643a);_0x2de8ff(_0x23643a);});});}exports[_0x3622('0x14')]=function(_0xc4e463){var _0x1379eb=this;return new Promise(function(_0x34ca6e,_0x159085){return db[_0x3622('0x15')][_0x3622('0x16')]({'raw':!![],'where':{'ContactId':_0xc4e463['body'][_0x3622('0x17')],'ListId':_0xc4e463[_0x3622('0x18')][_0x3622('0x19')],'VoiceQueueId':_0xc4e463[_0x3622('0x18')][_0x3622('0x1a')]===undefined?null:_0xc4e463['body'][_0x3622('0x1a')],'CampaignId':_0xc4e463[_0x3622('0x18')][_0x3622('0x1b')]===undefined?null:_0xc4e463['body']['CampaignId']}})[_0x3622('0x9')](function(_0xe9d132){if(_0xe9d132!=null){return db['CmHopperAdditionalPhone'][_0x3622('0x16')]({'raw':!![],'where':{'CmHopperId':_0xe9d132['id'],'OrderBy':{'$gt':_0xe9d132[_0x3622('0x1c')]}},'order':[[_0x3622('0x1c'),_0x3622('0x1d')]]})[_0x3622('0x9')](function(_0x5f9f74){var _0x37918a=0x0;if(_0x5f9f74){if(_0x5f9f74['countbusyretry']+_0x5f9f74[_0x3622('0x1e')]+_0x5f9f74[_0x3622('0x1f')]+_0x5f9f74[_0x3622('0x20')]+_0x5f9f74['countdropretry']+_0x5f9f74[_0x3622('0x21')]+_0x5f9f74[_0x3622('0x22')]+_0x5f9f74[_0x3622('0x23')]<_0xc4e463[_0x3622('0x24')]['dialGlobalMaxRetry'])_0x37918a=0x1;_0x34ca6e({'additional':_0x37918a});}else{return db[_0x3622('0x25')][_0x3622('0x16')]({'raw':!![],'where':{'CmHopperId':_0xe9d132['id']},'order':[[_0x3622('0x1c'),_0x3622('0x1d')]]})['then'](function(_0x234d65){var _0x435cba=0x0;if(_0x234d65){if(_0x234d65[_0x3622('0x26')]+_0x234d65[_0x3622('0x1e')]+_0x234d65[_0x3622('0x1f')]+_0x234d65['countnosuchnumberretry']+_0x234d65[_0x3622('0x27')]+_0x234d65[_0x3622('0x21')]+_0x234d65[_0x3622('0x22')]+_0x234d65[_0x3622('0x23')]<_0xc4e463['entity'][_0x3622('0x28')])_0x435cba=0x1;_0x34ca6e({'additional':_0x435cba});}else{_0x34ca6e({'additional':0x0});}})[_0x3622('0x13')](function(_0x3c5ee0){logger[_0x3622('0xf')](_0x3622('0x14'),_0x3c5ee0[_0x3622('0x11')]);_0x159085(_0x1379eb['error'](0x1f4,_0x3c5ee0[_0x3622('0x11')]));});}})[_0x3622('0x13')](function(_0x2b83cb){logger['error'](_0x3622('0x14'),_0x2b83cb[_0x3622('0x11')]);_0x159085(_0x1379eb['error'](0x1f4,_0x2b83cb[_0x3622('0x11')]));});}else _0x34ca6e({'additional':0x0});});});};exports[_0x3622('0x29')]=function(_0x5e2f3f){var _0x4bca3b=this;return new Promise(function(_0x5092f6,_0x434316){return db[_0x3622('0x15')][_0x3622('0x16')]({'raw':!![],'where':{'ContactId':_0x5e2f3f['body'][_0x3622('0x17')],'ListId':_0x5e2f3f[_0x3622('0x18')]['ListId'],'VoiceQueueId':_0x5e2f3f[_0x3622('0x18')][_0x3622('0x1a')]===undefined?null:_0x5e2f3f[_0x3622('0x18')][_0x3622('0x1a')],'CampaignId':_0x5e2f3f[_0x3622('0x18')]['CampaignId']===undefined?null:_0x5e2f3f[_0x3622('0x18')][_0x3622('0x1b')]}})['then'](function(_0x301b26){if(_0x301b26!=null){return db[_0x3622('0x25')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x301b26['id'],'OrderBy':{'$gte':_0x301b26[_0x3622('0x1c')]}},'order':[[_0x3622('0x1c'),'ASC']]})[_0x3622('0x9')](function(_0x2789af){if(_0x2789af)return activateAdditionalPhone(_0x301b26,_0x5e2f3f[_0x3622('0x18')],_0x2789af,_0x5e2f3f[_0x3622('0x2a')],_0x5e2f3f[_0x3622('0x2b')])[_0x3622('0x9')](function(_0x90a98b){_0x5092f6(_0x90a98b);});else{return db[_0x3622('0x25')][_0x3622('0x16')]({'raw':!![],'where':{'CmHopperId':_0x301b26['id']},'order':[[_0x3622('0x1c'),_0x3622('0x1d')]]})[_0x3622('0x9')](function(_0x27134f){if(_0x27134f)return activateAdditionalPhone(_0x301b26,_0x5e2f3f[_0x3622('0x18')],_0x27134f,_0x5e2f3f[_0x3622('0x2a')],_0x5e2f3f[_0x3622('0x2b')])[_0x3622('0x9')](function(_0x48fee4){_0x5092f6(_0x48fee4);});else{_0x5092f6({'id':_0x301b26['id'],'phone':''});}})[_0x3622('0x13')](function(_0x411799){logger['error']('VerifyAdditionalPhones',_0x411799[_0x3622('0x11')]);_0x434316(_0x4bca3b[_0x3622('0xf')](0x1f4,_0x411799[_0x3622('0x11')]));});}})[_0x3622('0x13')](function(_0x1a58a4){logger[_0x3622('0xf')]('VerifyAdditionalPhones',_0x1a58a4[_0x3622('0x11')]);_0x434316(_0x4bca3b[_0x3622('0xf')](0x1f4,_0x1a58a4[_0x3622('0x11')]));});}else _0x5092f6(0x1);});});};function activateAdditionalPhone(_0x55951b,_0x2b1178,_0x56cc7a,_0x4153e1,_0x384022){return new Promise(function(_0x4bc132,_0x237a4e){var _0x365224;if(_[_0x3622('0x2c')](_0x56cc7a[_0x3622('0x2d')])){_0x56cc7a[_0x3622('0x2d')]=moment();}if(moment()>moment(_0x56cc7a[_0x3622('0x2d')])){_0x365224=moment()[_0x3622('0x2e')](_0x384022||0x3,_0x3622('0x2f'));}else{if(_0x56cc7a[_0x3622('0x1c')]==0x0){_0x365224=moment(_0x56cc7a['scheduledat']);}else{_0x365224=moment()[_0x3622('0x2e')](_0x384022||0x3,_0x3622('0x2f'));}}if(_[_0x3622('0x2c')](_0x365224)){_0x365224=moment()['add'](_0x384022||0x3,_0x3622('0x2f'));}var _0x19e245={'phone':_0x55951b['phone'],'active':0x0,'OrderBy':_[_0x3622('0x2c')](_0x55951b[_0x3622('0x1c')])?0x0:_0x55951b[_0x3622('0x1c')],'scheduledat':moment()[_0x3622('0x2e')](_0x4153e1||0x1,_0x3622('0x2f')),'countbusyretry':_0x2b1178[_0x3622('0x26')],'countcongestionretry':_0x2b1178[_0x3622('0x1e')],'countnoanswerretry':_0x2b1178[_0x3622('0x1f')],'countnosuchnumberretry':_0x2b1178[_0x3622('0x20')],'countdropretry':_0x2b1178[_0x3622('0x27')],'countabandonedretry':_0x2b1178[_0x3622('0x21')],'countmachineretry':_0x2b1178[_0x3622('0x22')],'countagentrejectretry':_0x2b1178[_0x3622('0x23')],'createdAt':_0x2b1178[_0x3622('0x30')],'updatedAt':_0x2b1178[_0x3622('0x31')]};var _0x2cbadf={'CmHopperId':_0x55951b['id'],'phone':_0x56cc7a['phone'],'active':0x0,'OrderBy':_[_0x3622('0x2c')](_0x56cc7a[_0x3622('0x1c')])?0x0:_0x56cc7a[_0x3622('0x1c')],'scheduledat':_0x365224,'countbusyretry':_0x56cc7a[_0x3622('0x26')],'countcongestionretry':_0x56cc7a[_0x3622('0x1e')],'countnoanswerretry':_0x56cc7a['countnoanswerretry'],'countnosuchnumberretry':_0x56cc7a[_0x3622('0x20')],'countdropretry':_0x56cc7a[_0x3622('0x27')],'countabandonedretry':_0x56cc7a[_0x3622('0x21')],'countmachineretry':_0x56cc7a[_0x3622('0x22')],'countagentrejectretry':_0x56cc7a[_0x3622('0x23')],'createdAt':_0x56cc7a['createdAt'],'updatedAt':_0x56cc7a[_0x3622('0x31')]};return db[_0x3622('0x32')]['transaction'](function(_0x176e0d){return db['CmHopperAdditionalPhone']['update'](_0x19e245,{'where':{'id':_0x56cc7a['id']}},{'transaction':_0x176e0d})[_0x3622('0x9')](function(){return db[_0x3622('0x15')][_0x3622('0x33')](_0x2cbadf,{'where':{'id':_0x55951b['id']}},{'transaction':_0x176e0d});});})[_0x3622('0x9')](function(_0x55d511){_0x4bc132({'id':_0x55951b['id'],'phone':_0x56cc7a[_0x3622('0x34')]});})['catch'](function(_0x58da97){logger[_0x3622('0xf')](_0x3622('0x35'),_0x58da97['message']);_0x237a4e({'error':_0x58da97['message']});});});}exports[_0x3622('0x36')]=function(_0x404a49){var _0x450954=this;return new Promise(function(_0x57256d,_0x38e461){return db['CmHopper'][_0x3622('0x33')](_0x404a49['body'][_0x3622('0x37')],{'where':{'id':_0x404a49[_0x3622('0x18')]['id']}})['then'](function(_0x3a9a88){_0x57256d(_0x3a9a88);})['catch'](function(_0x1b2b0c){logger[_0x3622('0xf')](_0x3622('0x36'),_0x1b2b0c[_0x3622('0x11')]);_0x38e461(_0x450954[_0x3622('0xf')](0x1f4,_0x1b2b0c[_0x3622('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index de36918..64a9e63 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 _0x3149=['/:id','isAuthenticated','show','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index'];(function(_0x367c41,_0x101f42){var _0x451270=function(_0x2fcbb3){while(--_0x2fcbb3){_0x367c41['push'](_0x367c41['shift']());}};_0x451270(++_0x101f42);}(_0x3149,0x181));var _0x9314=function(_0x13a9f5,_0x570c70){_0x13a9f5=_0x13a9f5-0x0;var _0xa1860a=_0x3149[_0x13a9f5];return _0xa1860a;};'use strict';var multer=require(_0x9314('0x0'));var util=require('util');var path=require(_0x9314('0x1'));var timeout=require(_0x9314('0x2'));var express=require(_0x9314('0x3'));var router=express[_0x9314('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9314('0x5'));var interaction=require(_0x9314('0x6'));var config=require(_0x9314('0x7'));var controller=require(_0x9314('0x8'));router[_0x9314('0x9')]('/',auth['isAuthenticated'](),controller[_0x9314('0xa')]);router[_0x9314('0x9')](_0x9314('0xb'),auth[_0x9314('0xc')](),controller[_0x9314('0xd')]);router['post']('/',auth[_0x9314('0xc')](),controller['create']);router[_0x9314('0xe')]('/:id',auth[_0x9314('0xc')](),controller[_0x9314('0xf')]);router['delete'](_0x9314('0xb'),auth['isAuthenticated'](),controller[_0x9314('0x10')]);module[_0x9314('0x11')]=router; \ No newline at end of file +var _0x6459=['fs-extra','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x1774f2,_0x4da78e){var _0x38273c=function(_0x3d164e){while(--_0x3d164e){_0x1774f2['push'](_0x1774f2['shift']());}};_0x38273c(++_0x4da78e);}(_0x6459,0x6e));var _0x9645=function(_0x327a23,_0x21eef4){_0x327a23=_0x327a23-0x0;var _0x3d9c65=_0x6459[_0x327a23];return _0x3d9c65;};'use strict';var multer=require('multer');var util=require(_0x9645('0x0'));var path=require('path');var timeout=require(_0x9645('0x1'));var express=require(_0x9645('0x2'));var router=express[_0x9645('0x3')]();var fs_extra=require(_0x9645('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9645('0x5'));var config=require(_0x9645('0x6'));var controller=require(_0x9645('0x7'));router[_0x9645('0x8')]('/',auth[_0x9645('0x9')](),controller[_0x9645('0xa')]);router[_0x9645('0x8')](_0x9645('0xb'),auth[_0x9645('0x9')](),controller['show']);router[_0x9645('0xc')]('/',auth[_0x9645('0x9')](),controller[_0x9645('0xd')]);router[_0x9645('0xe')](_0x9645('0xb'),auth['isAuthenticated'](),controller[_0x9645('0xf')]);router[_0x9645('0x10')](_0x9645('0xb'),auth[_0x9645('0x9')](),controller[_0x9645('0x11')]);module[_0x9645('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 22d11b9..31c897a 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 _0xe367=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe367,0x116));var _0x7e36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe367[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x7e36('0x0'));var Sequelize=require(_0x7e36('0x1'));module[_0x7e36('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')},'ListId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7e36('0x3')],'unique':_0x7e36('0x4')}}; \ No newline at end of file +var _0x8893=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x46b0f7,_0x1e73f0){var _0x104a3e=function(_0x12491f){while(--_0x12491f){_0x46b0f7['push'](_0x46b0f7['shift']());}};_0x104a3e(++_0x1e73f0);}(_0x8893,0x1a8));var _0x3889=function(_0x507c64,_0x5c7b96){_0x507c64=_0x507c64-0x0;var _0x2d83e1=_0x8893[_0x507c64];return _0x2d83e1;};'use strict';var moment=require(_0x3889('0x0'));var Sequelize=require(_0x3889('0x1'));module[_0x3889('0x2')]={'phone':{'type':Sequelize[_0x3889('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3889('0x4')],'unique':_0x3889('0x5')},'ListId':{'type':Sequelize[_0x3889('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3889('0x4')],'unique':_0x3889('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8cd0e98..64628f4 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 _0xb329=['params','merge','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb329,0x119));var _0x9b32=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xb329[_0x4eaa4c];return _0x15aec6;};'use strict';var emlformat=require(_0x9b32('0x0'));var rimraf=require(_0x9b32('0x1'));var zipdir=require(_0x9b32('0x2'));var jsonpatch=require(_0x9b32('0x3'));var rp=require(_0x9b32('0x4'));var moment=require(_0x9b32('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9b32('0x6'));var path=require('path');var sox=require(_0x9b32('0x7'));var csv=require(_0x9b32('0x8'));var ejs=require(_0x9b32('0x9'));var fs=require('fs');var fs_extra=require(_0x9b32('0xa'));var _=require(_0x9b32('0xb'));var squel=require(_0x9b32('0xc'));var crypto=require(_0x9b32('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b32('0x8'));var querystring=require(_0x9b32('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b32('0xf'));var qs=require(_0x9b32('0x10'));var as=require(_0x9b32('0x11'));var hardwareService=require(_0x9b32('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9b32('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b32('0x14'))['db'];function respondWithStatusCode(_0x4e5539,_0x2f7d61){_0x2f7d61=_0x2f7d61||0xcc;return function(_0x132a41){if(_0x132a41){return _0x4e5539[_0x9b32('0x15')](_0x2f7d61);}return _0x4e5539[_0x9b32('0x16')](_0x2f7d61)['end']();};}function respondWithResult(_0x1dc1ae,_0x5597d1){_0x5597d1=_0x5597d1||0xc8;return function(_0x48c105){if(_0x48c105){return _0x1dc1ae[_0x9b32('0x16')](_0x5597d1)[_0x9b32('0x17')](_0x48c105);}};}function respondWithFilteredResult(_0x2124e1,_0x1402f7){return function(_0x2dce8c){if(_0x2dce8c){var _0x4a0720=typeof _0x1402f7[_0x9b32('0x18')]===_0x9b32('0x19')&&typeof _0x1402f7[_0x9b32('0x1a')]===_0x9b32('0x19');var _0x1da61a=_0x2dce8c[_0x9b32('0x1b')];var _0x4c7018=_0x4a0720?0x0:_0x1402f7['offset'];var _0x5d0648=_0x4a0720?_0x2dce8c[_0x9b32('0x1b')]:_0x1402f7[_0x9b32('0x18')]+_0x1402f7[_0x9b32('0x1a')];var _0x142861;if(_0x5d0648>=_0x1da61a){_0x5d0648=_0x1da61a;_0x142861=0xc8;}else{_0x142861=0xce;}_0x2124e1[_0x9b32('0x16')](_0x142861);return _0x2124e1[_0x9b32('0x1c')](_0x9b32('0x1d'),_0x4c7018+'-'+_0x5d0648+'/'+_0x1da61a)[_0x9b32('0x17')](_0x2dce8c);}return null;};}function patchUpdates(_0x307c15){return function(_0x14bae8){try{jsonpatch[_0x9b32('0x1e')](_0x14bae8,_0x307c15,!![]);}catch(_0x32e5f4){return BPromise[_0x9b32('0x1f')](_0x32e5f4);}return _0x14bae8['save']();};}function saveUpdates(_0x335d1f,_0x1b5c71){return function(_0x1ac8a1){if(_0x1ac8a1){return _0x1ac8a1[_0x9b32('0x20')](_0x335d1f)[_0x9b32('0x21')](function(_0x4da9c8){return _0x4da9c8;});}return null;};}function removeEntity(_0x70c0af,_0x25fc31){return function(_0x869d47){if(_0x869d47){return _0x869d47[_0x9b32('0x22')]()[_0x9b32('0x21')](function(){_0x70c0af[_0x9b32('0x16')](0xcc)[_0x9b32('0x23')]();});}};}function handleEntityNotFound(_0x4747ff,_0x593cd7){return function(_0x52b34e){if(!_0x52b34e){_0x4747ff[_0x9b32('0x15')](0x194);}return _0x52b34e;};}function handleError(_0x5f7d54,_0xbcfb59){_0xbcfb59=_0xbcfb59||0x1f4;return function(_0x1f5314){logger[_0x9b32('0x24')](_0x1f5314[_0x9b32('0x25')]);if(_0x1f5314[_0x9b32('0x26')]){delete _0x1f5314[_0x9b32('0x26')];}_0x5f7d54[_0x9b32('0x16')](_0xbcfb59)[_0x9b32('0x27')](_0x1f5314);};}exports[_0x9b32('0x28')]=function(_0x49bca2,_0xaf461){var _0x5b0a95={},_0x32ca0f={},_0x24c579={'count':0x0,'rows':[]};var _0x5b12e0=_[_0x9b32('0x29')](db['CmHopperBlack']['rawAttributes'],function(_0x58503a){return{'name':_0x58503a['fieldName'],'type':_0x58503a[_0x9b32('0x2a')][_0x9b32('0x2b')]};});_0x32ca0f[_0x9b32('0x2c')]=_['map'](_0x5b12e0,'name');_0x32ca0f[_0x9b32('0x2d')]=_[_0x9b32('0x2e')](_0x49bca2[_0x9b32('0x2d')]);_0x32ca0f[_0x9b32('0x2f')]=_[_0x9b32('0x30')](_0x32ca0f[_0x9b32('0x2c')],_0x32ca0f['query']);_0x5b0a95[_0x9b32('0x31')]=_[_0x9b32('0x30')](_0x32ca0f[_0x9b32('0x2c')],qs[_0x9b32('0x32')](_0x49bca2['query']['fields']));_0x5b0a95['attributes']=_0x5b0a95['attributes'][_0x9b32('0x33')]?_0x5b0a95['attributes']:_0x32ca0f[_0x9b32('0x2c')];if(!_0x49bca2[_0x9b32('0x2d')]['hasOwnProperty'](_0x9b32('0x34'))){_0x5b0a95[_0x9b32('0x1a')]=qs[_0x9b32('0x1a')](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x1a')]);_0x5b0a95[_0x9b32('0x18')]=qs['offset'](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x18')]);}_0x5b0a95['order']=qs[_0x9b32('0x35')](_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x35')]);_0x5b0a95['where']=qs[_0x9b32('0x2f')](_['pick'](_0x49bca2[_0x9b32('0x2d')],_0x32ca0f[_0x9b32('0x2f')]),_0x5b12e0);if(_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x36')]){_0x5b0a95[_0x9b32('0x37')]=_['merge'](_0x5b0a95[_0x9b32('0x37')],{'$or':_[_0x9b32('0x29')](_0x5b12e0,function(_0x28437c){if(_0x28437c[_0x9b32('0x2a')]!=='VIRTUAL'){var _0x375539={};_0x375539[_0x28437c[_0x9b32('0x26')]]={'$like':'%'+_0x49bca2[_0x9b32('0x2d')]['filter']+'%'};return _0x375539;}})});}_0x5b0a95=_['merge']({},_0x5b0a95,_0x49bca2[_0x9b32('0x38')]);var _0x203034={'where':_0x5b0a95['where']};return db[_0x9b32('0x39')]['count'](_0x203034)[_0x9b32('0x21')](function(_0x357ccd){_0x24c579[_0x9b32('0x1b')]=_0x357ccd;if(_0x49bca2[_0x9b32('0x2d')][_0x9b32('0x3a')]){_0x5b0a95[_0x9b32('0x3b')]=[{'all':!![]}];}return db[_0x9b32('0x39')][_0x9b32('0x3c')](_0x5b0a95);})[_0x9b32('0x21')](function(_0x10290b){_0x24c579[_0x9b32('0x3d')]=_0x10290b;return _0x24c579;})[_0x9b32('0x21')](respondWithFilteredResult(_0xaf461,_0x5b0a95))[_0x9b32('0x3e')](handleError(_0xaf461,null));};exports[_0x9b32('0x3f')]=function(_0x2ecafb,_0x11956f){var _0x1fd44b={'raw':!![],'where':{'id':_0x2ecafb[_0x9b32('0x40')]['id']}},_0x32bf29={};_0x32bf29[_0x9b32('0x2c')]=_[_0x9b32('0x2e')](db[_0x9b32('0x39')]['rawAttributes']);_0x32bf29[_0x9b32('0x2d')]=_[_0x9b32('0x2e')](_0x2ecafb['query']);_0x32bf29[_0x9b32('0x2f')]=_[_0x9b32('0x30')](_0x32bf29[_0x9b32('0x2c')],_0x32bf29['query']);_0x1fd44b[_0x9b32('0x31')]=_['intersection'](_0x32bf29[_0x9b32('0x2c')],qs[_0x9b32('0x32')](_0x2ecafb['query'][_0x9b32('0x32')]));_0x1fd44b[_0x9b32('0x31')]=_0x1fd44b['attributes'][_0x9b32('0x33')]?_0x1fd44b[_0x9b32('0x31')]:_0x32bf29[_0x9b32('0x2c')];if(_0x2ecafb[_0x9b32('0x2d')][_0x9b32('0x3a')]){_0x1fd44b[_0x9b32('0x3b')]=[{'all':!![]}];}_0x1fd44b=_[_0x9b32('0x41')]({},_0x1fd44b,_0x2ecafb[_0x9b32('0x38')]);return db[_0x9b32('0x39')][_0x9b32('0x42')](_0x1fd44b)[_0x9b32('0x21')](handleEntityNotFound(_0x11956f,null))[_0x9b32('0x21')](respondWithResult(_0x11956f,null))[_0x9b32('0x3e')](handleError(_0x11956f,null));};exports[_0x9b32('0x20')]=function(_0x33151a,_0x2ba506){if(_0x33151a[_0x9b32('0x43')]['id']){delete _0x33151a[_0x9b32('0x43')]['id'];}return db[_0x9b32('0x39')][_0x9b32('0x42')]({'where':{'id':_0x33151a[_0x9b32('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ba506,null))[_0x9b32('0x21')](saveUpdates(_0x33151a['body'],null))['then'](respondWithResult(_0x2ba506,null))[_0x9b32('0x3e')](handleError(_0x2ba506,null));};exports[_0x9b32('0x22')]=function(_0x3ff304,_0x116c42){return db[_0x9b32('0x39')][_0x9b32('0x42')]({'where':{'id':_0x3ff304['params']['id']}})[_0x9b32('0x21')](handleEntityNotFound(_0x116c42,null))[_0x9b32('0x21')](removeEntity(_0x116c42,null))[_0x9b32('0x3e')](handleError(_0x116c42,null));};exports['describe']=function(_0x5d0a19,_0xd21ed4){return db['CmHopperBlack'][_0x9b32('0x44')]()['then'](respondWithResult(_0xd21ed4,null))[_0x9b32('0x3e')](handleError(_0xd21ed4,null));}; \ No newline at end of file +var _0x6a2c=['to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','find','body','describe','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x5bd263,_0xce4369){var _0x1400ec=function(_0x28887a){while(--_0x28887a){_0x5bd263['push'](_0x5bd263['shift']());}};_0x1400ec(++_0xce4369);}(_0x6a2c,0xd1));var _0xc6a2=function(_0x3d341f,_0x2c5aef){_0x3d341f=_0x3d341f-0x0;var _0x446533=_0x6a2c[_0x3d341f];return _0x446533;};'use strict';var emlformat=require(_0xc6a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6a2('0x1'));var rp=require(_0xc6a2('0x2'));var moment=require(_0xc6a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6a2('0x4'));var util=require('util');var path=require(_0xc6a2('0x5'));var sox=require(_0xc6a2('0x6'));var csv=require(_0xc6a2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6a2('0x8'));var _=require(_0xc6a2('0x9'));var squel=require(_0xc6a2('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6a2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc6a2('0x7'));var querystring=require(_0xc6a2('0xc'));var Papa=require(_0xc6a2('0xd'));var Redis=require(_0xc6a2('0xe'));var authService=require(_0xc6a2('0xf'));var qs=require(_0xc6a2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6a2('0x11'));var utils=require(_0xc6a2('0x12'));var config=require(_0xc6a2('0x13'));var licenseUtil=require(_0xc6a2('0x14'));var db=require(_0xc6a2('0x15'))['db'];function respondWithStatusCode(_0x19eb82,_0x338850){_0x338850=_0x338850||0xcc;return function(_0x4e0797){if(_0x4e0797){return _0x19eb82['sendStatus'](_0x338850);}return _0x19eb82[_0xc6a2('0x16')](_0x338850)[_0xc6a2('0x17')]();};}function respondWithResult(_0x3b6bc8,_0xf8f004){_0xf8f004=_0xf8f004||0xc8;return function(_0x18ee9a){if(_0x18ee9a){return _0x3b6bc8[_0xc6a2('0x16')](_0xf8f004)['json'](_0x18ee9a);}};}function respondWithFilteredResult(_0xa44efe,_0x2c2046){return function(_0x5153d4){if(_0x5153d4){var _0x5da4c9=typeof _0x2c2046[_0xc6a2('0x18')]===_0xc6a2('0x19')&&typeof _0x2c2046[_0xc6a2('0x1a')]===_0xc6a2('0x19');var _0x1f61e0=_0x5153d4[_0xc6a2('0x1b')];var _0x4dc4f8=_0x5da4c9?0x0:_0x2c2046[_0xc6a2('0x18')];var _0x25cdab=_0x5da4c9?_0x5153d4['count']:_0x2c2046[_0xc6a2('0x18')]+_0x2c2046[_0xc6a2('0x1a')];var _0x5425c2;if(_0x25cdab>=_0x1f61e0){_0x25cdab=_0x1f61e0;_0x5425c2=0xc8;}else{_0x5425c2=0xce;}_0xa44efe[_0xc6a2('0x16')](_0x5425c2);return _0xa44efe[_0xc6a2('0x1c')](_0xc6a2('0x1d'),_0x4dc4f8+'-'+_0x25cdab+'/'+_0x1f61e0)[_0xc6a2('0x1e')](_0x5153d4);}return null;};}function patchUpdates(_0x4be42c){return function(_0x27b452){try{jsonpatch[_0xc6a2('0x1f')](_0x27b452,_0x4be42c,!![]);}catch(_0x332315){return BPromise[_0xc6a2('0x20')](_0x332315);}return _0x27b452['save']();};}function saveUpdates(_0x3b7136,_0x265200){return function(_0x2df798){if(_0x2df798){return _0x2df798[_0xc6a2('0x21')](_0x3b7136)['then'](function(_0x7669e){return _0x7669e;});}return null;};}function removeEntity(_0x20f2ce,_0x6a7e7b){return function(_0x105b7f){if(_0x105b7f){return _0x105b7f[_0xc6a2('0x22')]()[_0xc6a2('0x23')](function(){_0x20f2ce[_0xc6a2('0x16')](0xcc)[_0xc6a2('0x17')]();});}};}function handleEntityNotFound(_0x5b006a,_0x3be414){return function(_0x17e0e1){if(!_0x17e0e1){_0x5b006a['sendStatus'](0x194);}return _0x17e0e1;};}function handleError(_0x2a28b1,_0x4f6c86){_0x4f6c86=_0x4f6c86||0x1f4;return function(_0x318188){logger['error'](_0x318188[_0xc6a2('0x24')]);if(_0x318188[_0xc6a2('0x25')]){delete _0x318188[_0xc6a2('0x25')];}_0x2a28b1[_0xc6a2('0x16')](_0x4f6c86)[_0xc6a2('0x26')](_0x318188);};}exports['index']=function(_0x5d6496,_0x179497){var _0x3addd7={},_0x4f3e8f={},_0x4302ba={'count':0x0,'rows':[]};var _0x488bc0=_['map'](db[_0xc6a2('0x27')][_0xc6a2('0x28')],function(_0x3d4913){return{'name':_0x3d4913[_0xc6a2('0x29')],'type':_0x3d4913[_0xc6a2('0x2a')][_0xc6a2('0x2b')]};});_0x4f3e8f[_0xc6a2('0x2c')]=_[_0xc6a2('0x2d')](_0x488bc0,_0xc6a2('0x25'));_0x4f3e8f['query']=_[_0xc6a2('0x2e')](_0x5d6496[_0xc6a2('0x2f')]);_0x4f3e8f[_0xc6a2('0x30')]=_[_0xc6a2('0x31')](_0x4f3e8f[_0xc6a2('0x2c')],_0x4f3e8f[_0xc6a2('0x2f')]);_0x3addd7['attributes']=_[_0xc6a2('0x31')](_0x4f3e8f['model'],qs[_0xc6a2('0x32')](_0x5d6496[_0xc6a2('0x2f')][_0xc6a2('0x32')]));_0x3addd7[_0xc6a2('0x33')]=_0x3addd7[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x3addd7[_0xc6a2('0x33')]:_0x4f3e8f[_0xc6a2('0x2c')];if(!_0x5d6496['query'][_0xc6a2('0x35')](_0xc6a2('0x36'))){_0x3addd7['limit']=qs[_0xc6a2('0x1a')](_0x5d6496[_0xc6a2('0x2f')][_0xc6a2('0x1a')]);_0x3addd7[_0xc6a2('0x18')]=qs['offset'](_0x5d6496[_0xc6a2('0x2f')][_0xc6a2('0x18')]);}_0x3addd7[_0xc6a2('0x37')]=qs[_0xc6a2('0x38')](_0x5d6496[_0xc6a2('0x2f')]['sort']);_0x3addd7['where']=qs[_0xc6a2('0x30')](_[_0xc6a2('0x39')](_0x5d6496['query'],_0x4f3e8f[_0xc6a2('0x30')]),_0x488bc0);if(_0x5d6496['query']['filter']){_0x3addd7[_0xc6a2('0x3a')]=_[_0xc6a2('0x3b')](_0x3addd7[_0xc6a2('0x3a')],{'$or':_[_0xc6a2('0x2d')](_0x488bc0,function(_0x13e316){if(_0x13e316[_0xc6a2('0x2a')]!==_0xc6a2('0x3c')){var _0xa15a42={};_0xa15a42[_0x13e316[_0xc6a2('0x25')]]={'$like':'%'+_0x5d6496[_0xc6a2('0x2f')][_0xc6a2('0x3d')]+'%'};return _0xa15a42;}})});}_0x3addd7=_['merge']({},_0x3addd7,_0x5d6496[_0xc6a2('0x3e')]);var _0xeef360={'where':_0x3addd7[_0xc6a2('0x3a')]};return db[_0xc6a2('0x27')]['count'](_0xeef360)[_0xc6a2('0x23')](function(_0x199bfd){_0x4302ba[_0xc6a2('0x1b')]=_0x199bfd;if(_0x5d6496[_0xc6a2('0x2f')]['includeAll']){_0x3addd7[_0xc6a2('0x3f')]=[{'all':!![]}];}return db[_0xc6a2('0x27')][_0xc6a2('0x40')](_0x3addd7);})[_0xc6a2('0x23')](function(_0xa24a7a){_0x4302ba[_0xc6a2('0x41')]=_0xa24a7a;return _0x4302ba;})[_0xc6a2('0x23')](respondWithFilteredResult(_0x179497,_0x3addd7))[_0xc6a2('0x42')](handleError(_0x179497,null));};exports[_0xc6a2('0x43')]=function(_0x3fdd8c,_0x20721b){var _0x152a3f={'raw':!![],'where':{'id':_0x3fdd8c[_0xc6a2('0x44')]['id']}},_0x838e80={};_0x838e80['model']=_[_0xc6a2('0x2e')](db['CmHopperBlack'][_0xc6a2('0x28')]);_0x838e80[_0xc6a2('0x2f')]=_[_0xc6a2('0x2e')](_0x3fdd8c[_0xc6a2('0x2f')]);_0x838e80[_0xc6a2('0x30')]=_['intersection'](_0x838e80[_0xc6a2('0x2c')],_0x838e80[_0xc6a2('0x2f')]);_0x152a3f[_0xc6a2('0x33')]=_['intersection'](_0x838e80[_0xc6a2('0x2c')],qs[_0xc6a2('0x32')](_0x3fdd8c[_0xc6a2('0x2f')][_0xc6a2('0x32')]));_0x152a3f[_0xc6a2('0x33')]=_0x152a3f[_0xc6a2('0x33')][_0xc6a2('0x34')]?_0x152a3f[_0xc6a2('0x33')]:_0x838e80[_0xc6a2('0x2c')];if(_0x3fdd8c[_0xc6a2('0x2f')]['includeAll']){_0x152a3f[_0xc6a2('0x3f')]=[{'all':!![]}];}_0x152a3f=_[_0xc6a2('0x3b')]({},_0x152a3f,_0x3fdd8c[_0xc6a2('0x3e')]);return db[_0xc6a2('0x27')][_0xc6a2('0x45')](_0x152a3f)['then'](handleEntityNotFound(_0x20721b,null))[_0xc6a2('0x23')](respondWithResult(_0x20721b,null))[_0xc6a2('0x42')](handleError(_0x20721b,null));};exports[_0xc6a2('0x21')]=function(_0x35f9fd,_0x5d65a8){if(_0x35f9fd[_0xc6a2('0x46')]['id']){delete _0x35f9fd[_0xc6a2('0x46')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x35f9fd[_0xc6a2('0x44')]['id']}})[_0xc6a2('0x23')](handleEntityNotFound(_0x5d65a8,null))[_0xc6a2('0x23')](saveUpdates(_0x35f9fd[_0xc6a2('0x46')],null))['then'](respondWithResult(_0x5d65a8,null))['catch'](handleError(_0x5d65a8,null));};exports['destroy']=function(_0xb4aa49,_0x23db39){return db[_0xc6a2('0x27')][_0xc6a2('0x45')]({'where':{'id':_0xb4aa49['params']['id']}})[_0xc6a2('0x23')](handleEntityNotFound(_0x23db39,null))[_0xc6a2('0x23')](removeEntity(_0x23db39,null))['catch'](handleError(_0x23db39,null));};exports[_0xc6a2('0x47')]=function(_0x59ad13,_0x33f30c){return db['CmHopperBlack'][_0xc6a2('0x47')]()[_0xc6a2('0x23')](respondWithResult(_0x33f30c,null))[_0xc6a2('0x42')](handleError(_0x33f30c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 9fc7f73..e32c88f 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 _0x61fa=['bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x492b15,_0x1757e2){var _0x5325a0=function(_0x740fcc){while(--_0x740fcc){_0x492b15['push'](_0x492b15['shift']());}};_0x5325a0(++_0x1757e2);}(_0x61fa,0x1d7));var _0xa61f=function(_0x55fa10,_0x555718){_0x55fa10=_0x55fa10-0x0;var _0x4155ca=_0x61fa[_0x55fa10];return _0x4155ca;};'use strict';var _=require(_0xa61f('0x0'));var util=require(_0xa61f('0x1'));var logger=require(_0xa61f('0x2'))(_0xa61f('0x3'));var moment=require(_0xa61f('0x4'));var BPromise=require(_0xa61f('0x5'));var rp=require(_0xa61f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa61f('0x7'));var config=require(_0xa61f('0x8'));var attributes=require(_0xa61f('0x9'));module[_0xa61f('0xa')]=function(_0x2f0452,_0x3b1ae8){return _0x2f0452[_0xa61f('0xb')](_0xa61f('0xc'),attributes,{'tableName':_0xa61f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd3c=['exports','define','cm_hopper_black','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x58203c,_0x53106d){var _0x1f23f7=function(_0x319287){while(--_0x319287){_0x58203c['push'](_0x58203c['shift']());}};_0x1f23f7(++_0x53106d);}(_0xfd3c,0xb3));var _0xcfd3=function(_0x3a12a1,_0x545bd6){_0x3a12a1=_0x3a12a1-0x0;var _0x33d12e=_0xfd3c[_0x3a12a1];return _0x33d12e;};'use strict';var _=require('lodash');var util=require(_0xcfd3('0x0'));var logger=require(_0xcfd3('0x1'))('api');var moment=require(_0xcfd3('0x2'));var BPromise=require('bluebird');var rp=require(_0xcfd3('0x3'));var fs=require('fs');var path=require(_0xcfd3('0x4'));var rimraf=require(_0xcfd3('0x5'));var config=require(_0xcfd3('0x6'));var attributes=require(_0xcfd3('0x7'));module[_0xcfd3('0x8')]=function(_0x1bf7ac,_0x46a1c1){return _0x1bf7ac[_0xcfd3('0x9')]('CmHopperBlack',attributes,{'tableName':_0xcfd3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index ede6556..2df64c7 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 _0x2eb6=['../../config/logger','rpc','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll','options','where','attributes','map','include','model','then','CmHopperBlack','update','body','limit','UpdateCmHopperBlack','debug','destroy','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fd57e,_0x154b79){var _0x782aa7=function(_0x22ba64){while(--_0x22ba64){_0x4fd57e['push'](_0x4fd57e['shift']());}};_0x782aa7(++_0x154b79);}(_0x2eb6,0xb7));var _0x62eb=function(_0x55c81e,_0x522143){_0x55c81e=_0x55c81e-0x0;var _0x2f1ffc=_0x2eb6[_0x55c81e];return _0x2f1ffc;};'use strict';var _=require(_0x62eb('0x0'));var util=require(_0x62eb('0x1'));var moment=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62eb('0x4'));var db=require(_0x62eb('0x5'))['db'];var utils=require(_0x62eb('0x6'));var logger=require(_0x62eb('0x7'))(_0x62eb('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x62eb('0x9')][_0x62eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ad0f0,_0x29ff77,_0xdc8448){return new BPromise(function(_0x50d33e,_0x528bdd){return client[_0x62eb('0xb')](_0x2ad0f0,_0xdc8448)['then'](function(_0x37348d){logger[_0x62eb('0xc')](_0x62eb('0xd'),_0x29ff77,_0x62eb('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x29ff77,_0x62eb('0xe'),JSON[_0x62eb('0xf')](_0x37348d));if(_0x37348d[_0x62eb('0x10')]){if(_0x37348d[_0x62eb('0x10')][_0x62eb('0x11')]===0x1f4){logger['error'](_0x62eb('0xd'),_0x29ff77,_0x37348d[_0x62eb('0x10')][_0x62eb('0x12')]);return _0x528bdd(_0x37348d[_0x62eb('0x10')][_0x62eb('0x12')]);}logger[_0x62eb('0x10')](_0x62eb('0xd'),_0x29ff77,_0x37348d['error'][_0x62eb('0x12')]);return _0x50d33e(_0x37348d[_0x62eb('0x10')]['message']);}else{logger['info'](_0x62eb('0xd'),_0x29ff77,_0x62eb('0xe'));_0x50d33e(_0x37348d[_0x62eb('0x13')]['message']);}})[_0x62eb('0x14')](function(_0x1cf65a){logger[_0x62eb('0x10')](_0x62eb('0xd'),_0x29ff77,_0x1cf65a);_0x528bdd(_0x1cf65a);});});}exports[_0x62eb('0x15')]=function(_0x264084){var _0x331abc=this;return new Promise(function(_0xd766b,_0x3cca84){return db['CmHopperBlack'][_0x62eb('0x16')]({'raw':_0x264084[_0x62eb('0x17')]?_0x264084['options']['raw']===undefined?!![]:![]:!![],'where':_0x264084['options']?_0x264084[_0x62eb('0x17')][_0x62eb('0x18')]||null:null,'attributes':_0x264084[_0x62eb('0x17')]?_0x264084[_0x62eb('0x17')][_0x62eb('0x19')]||null:null,'limit':_0x264084['options']?_0x264084['options']['limit']||null:null,'include':_0x264084['options']?_0x264084[_0x62eb('0x17')]['include']?_[_0x62eb('0x1a')](_0x264084[_0x62eb('0x17')][_0x62eb('0x1b')],function(_0x47b71a){return{'model':db[_0x47b71a[_0x62eb('0x1c')]],'as':_0x47b71a['as'],'attributes':_0x47b71a[_0x62eb('0x19')],'include':_0x47b71a[_0x62eb('0x1b')]?_['map'](_0x47b71a['include'],function(_0x35b7aa){return{'model':db[_0x35b7aa[_0x62eb('0x1c')]],'as':_0x35b7aa['as'],'attributes':_0x35b7aa[_0x62eb('0x19')],'include':_0x35b7aa[_0x62eb('0x1b')]?_[_0x62eb('0x1a')](_0x35b7aa[_0x62eb('0x1b')],function(_0x168393){return{'model':db[_0x168393[_0x62eb('0x1c')]],'as':_0x168393['as'],'attributes':_0x168393[_0x62eb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x62eb('0x1d')](function(_0x4eb0d0){logger[_0x62eb('0xc')](_0x62eb('0x15'),_0x264084);logger['debug']('GetCmHopperBlack',_0x264084,JSON['stringify'](_0x4eb0d0));_0xd766b(_0x4eb0d0);})['catch'](function(_0x324941){logger['error'](_0x62eb('0x15'),_0x324941[_0x62eb('0x12')],_0x264084);_0x3cca84(_0x331abc['error'](0x1f4,_0x324941[_0x62eb('0x12')]));});});};exports['UpdateCmHopperBlack']=function(_0x4902e5){var _0x55e98a=this;return new Promise(function(_0x15b11b,_0x51b8bb){return db[_0x62eb('0x1e')][_0x62eb('0x1f')](_0x4902e5[_0x62eb('0x20')],{'raw':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')][_0x62eb('0x18')]||null:null,'attributes':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')]['attributes']||null:null,'limit':_0x4902e5[_0x62eb('0x17')]?_0x4902e5[_0x62eb('0x17')][_0x62eb('0x21')]||null:null})[_0x62eb('0x1d')](function(_0x1e8482){logger[_0x62eb('0xc')](_0x62eb('0x22'),_0x4902e5);logger[_0x62eb('0x23')](_0x62eb('0x22'),_0x4902e5,JSON['stringify'](_0x1e8482));_0x15b11b(_0x1e8482);})[_0x62eb('0x14')](function(_0x4349b6){logger[_0x62eb('0x10')](_0x62eb('0x22'),_0x4349b6[_0x62eb('0x12')],_0x4902e5);_0x51b8bb(_0x55e98a['error'](0x1f4,_0x4349b6[_0x62eb('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x459983){var _0x5e63cb=this;return new Promise(function(_0x3805a7,_0xb2a46a){return db[_0x62eb('0x1e')][_0x62eb('0x24')]({'where':_0x459983['options']?_0x459983[_0x62eb('0x17')][_0x62eb('0x18')]||null:null})[_0x62eb('0x1d')](function(_0x52d1ad){logger['info'](_0x62eb('0x25'),_0x459983);logger[_0x62eb('0x23')](_0x62eb('0x25'),_0x459983,JSON[_0x62eb('0xf')](_0x52d1ad));_0x3805a7(_0x52d1ad);})[_0x62eb('0x14')](function(_0x53446e){logger[_0x62eb('0x10')]('DestroyCmHopperBlack',_0x53446e[_0x62eb('0x12')],_0x459983);_0xb2a46a(_0x5e63cb[_0x62eb('0x10')](0x1f4,_0x53446e[_0x62eb('0x12')]));});});}; \ No newline at end of file +var _0x9d16=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','CmHopperBlack','options','raw','attributes','include','map','model','then','GetCmHopperBlack','UpdateCmHopperBlack','update','body','where','destroy','DestroyCmHopperBlack','debug','lodash','util'];(function(_0x6d51e6,_0x353c16){var _0x5e001c=function(_0x47e86f){while(--_0x47e86f){_0x6d51e6['push'](_0x6d51e6['shift']());}};_0x5e001c(++_0x353c16);}(_0x9d16,0x92));var _0x69d1=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x9d16[_0x46a38b];return _0x346e75;};'use strict';var _=require(_0x69d1('0x0'));var util=require(_0x69d1('0x1'));var moment=require(_0x69d1('0x2'));var BPromise=require(_0x69d1('0x3'));var rs=require(_0x69d1('0x4'));var fs=require('fs');var Redis=require(_0x69d1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69d1('0x6'))(_0x69d1('0x7'));var config=require(_0x69d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69d1('0x9')][_0x69d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb9d7,_0x3458a8,_0x58d248){return new BPromise(function(_0x55f523,_0x2eaf6c){return client['request'](_0x4cb9d7,_0x58d248)['then'](function(_0x4e7e9c){logger[_0x69d1('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x3458a8,_0x69d1('0xc'));logger['debug'](_0x69d1('0xd'),_0x3458a8,_0x69d1('0xc'),JSON[_0x69d1('0xe')](_0x4e7e9c));if(_0x4e7e9c[_0x69d1('0xf')]){if(_0x4e7e9c[_0x69d1('0xf')][_0x69d1('0x10')]===0x1f4){logger[_0x69d1('0xf')](_0x69d1('0x11'),_0x3458a8,_0x4e7e9c['error']['message']);return _0x2eaf6c(_0x4e7e9c[_0x69d1('0xf')][_0x69d1('0x12')]);}logger[_0x69d1('0xf')](_0x69d1('0x11'),_0x3458a8,_0x4e7e9c[_0x69d1('0xf')][_0x69d1('0x12')]);return _0x55f523(_0x4e7e9c['error'][_0x69d1('0x12')]);}else{logger[_0x69d1('0xb')](_0x69d1('0x11'),_0x3458a8,_0x69d1('0xc'));_0x55f523(_0x4e7e9c[_0x69d1('0x13')][_0x69d1('0x12')]);}})[_0x69d1('0x14')](function(_0x1bed63){logger['error'](_0x69d1('0x11'),_0x3458a8,_0x1bed63);_0x2eaf6c(_0x1bed63);});});}exports['GetCmHopperBlack']=function(_0x38be4b){var _0x25db07=this;return new Promise(function(_0x5e59c4,_0x2ece49){return db[_0x69d1('0x15')]['findAll']({'raw':_0x38be4b[_0x69d1('0x16')]?_0x38be4b['options'][_0x69d1('0x17')]===undefined?!![]:![]:!![],'where':_0x38be4b[_0x69d1('0x16')]?_0x38be4b[_0x69d1('0x16')]['where']||null:null,'attributes':_0x38be4b[_0x69d1('0x16')]?_0x38be4b[_0x69d1('0x16')][_0x69d1('0x18')]||null:null,'limit':_0x38be4b['options']?_0x38be4b['options']['limit']||null:null,'include':_0x38be4b['options']?_0x38be4b[_0x69d1('0x16')][_0x69d1('0x19')]?_[_0x69d1('0x1a')](_0x38be4b['options']['include'],function(_0x254ebf){return{'model':db[_0x254ebf[_0x69d1('0x1b')]],'as':_0x254ebf['as'],'attributes':_0x254ebf[_0x69d1('0x18')],'include':_0x254ebf[_0x69d1('0x19')]?_[_0x69d1('0x1a')](_0x254ebf[_0x69d1('0x19')],function(_0x47a8bd){return{'model':db[_0x47a8bd[_0x69d1('0x1b')]],'as':_0x47a8bd['as'],'attributes':_0x47a8bd[_0x69d1('0x18')],'include':_0x47a8bd['include']?_[_0x69d1('0x1a')](_0x47a8bd['include'],function(_0x5e0538){return{'model':db[_0x5e0538[_0x69d1('0x1b')]],'as':_0x5e0538['as'],'attributes':_0x5e0538[_0x69d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x69d1('0x1c')](function(_0xa206af){logger[_0x69d1('0xb')](_0x69d1('0x1d'),_0x38be4b);logger['debug'](_0x69d1('0x1d'),_0x38be4b,JSON[_0x69d1('0xe')](_0xa206af));_0x5e59c4(_0xa206af);})['catch'](function(_0x4b29cc){logger[_0x69d1('0xf')](_0x69d1('0x1d'),_0x4b29cc[_0x69d1('0x12')],_0x38be4b);_0x2ece49(_0x25db07[_0x69d1('0xf')](0x1f4,_0x4b29cc[_0x69d1('0x12')]));});});};exports[_0x69d1('0x1e')]=function(_0x5d037a){var _0x14e720=this;return new Promise(function(_0x3f9913,_0x45a44d){return db['CmHopperBlack'][_0x69d1('0x1f')](_0x5d037a[_0x69d1('0x20')],{'raw':_0x5d037a['options']?_0x5d037a['options'][_0x69d1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d037a[_0x69d1('0x16')]?_0x5d037a[_0x69d1('0x16')][_0x69d1('0x21')]||null:null,'attributes':_0x5d037a[_0x69d1('0x16')]?_0x5d037a[_0x69d1('0x16')][_0x69d1('0x18')]||null:null,'limit':_0x5d037a['options']?_0x5d037a[_0x69d1('0x16')]['limit']||null:null})[_0x69d1('0x1c')](function(_0x3a1ee3){logger[_0x69d1('0xb')](_0x69d1('0x1e'),_0x5d037a);logger['debug']('UpdateCmHopperBlack',_0x5d037a,JSON[_0x69d1('0xe')](_0x3a1ee3));_0x3f9913(_0x3a1ee3);})['catch'](function(_0x98942){logger['error']('UpdateCmHopperBlack',_0x98942['message'],_0x5d037a);_0x45a44d(_0x14e720[_0x69d1('0xf')](0x1f4,_0x98942[_0x69d1('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x9e32a7){var _0x27d7d6=this;return new Promise(function(_0x85892f,_0x2b6c8b){return db['CmHopperBlack'][_0x69d1('0x22')]({'where':_0x9e32a7[_0x69d1('0x16')]?_0x9e32a7[_0x69d1('0x16')][_0x69d1('0x21')]||null:null})['then'](function(_0x2ff727){logger[_0x69d1('0xb')](_0x69d1('0x23'),_0x9e32a7);logger[_0x69d1('0x24')](_0x69d1('0x23'),_0x9e32a7,JSON['stringify'](_0x2ff727));_0x85892f(_0x2ff727);})[_0x69d1('0x14')](function(_0x1ee585){logger[_0x69d1('0xf')](_0x69d1('0x23'),_0x1ee585[_0x69d1('0x12')],_0x9e32a7);_0x2b6c8b(_0x27d7d6['error'](0x1f4,_0x1ee585['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bf3762b..7d4881a 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 _0x53ec=['../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x53ec,0x192));var _0xc53e=function(_0x9b14ee,_0x574340){_0x9b14ee=_0x9b14ee-0x0;var _0xc3fa3c=_0x53ec[_0x9b14ee];return _0xc3fa3c;};'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')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb11=['show','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xfb11[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller['update']);router[_0x1fb1('0xf')]('/:id',auth[_0x1fb1('0x7')](),controller['destroy']);module[_0x1fb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 57ac547..f944dda 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 _0x331f=['exports','DATE','INTEGER','STRING','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x10bf39,_0x3cd4bc){var _0x2ccd63=function(_0x24cf85){while(--_0x24cf85){_0x10bf39['push'](_0x10bf39['shift']());}};_0x2ccd63(++_0x3cd4bc);}(_0x331f,0x1b8));var _0xf331=function(_0x3c04bb,_0x171aee){_0x3c04bb=_0x3c04bb-0x0;var _0x57070e=_0x331f[_0x3c04bb];return _0x57070e;};'use strict';var Sequelize=require(_0xf331('0x0'));var moment=require(_0xf331('0x1'));module[_0xf331('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf331('0x3')]},'countbusyretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf331('0x5')]},'originatecalleridnum':{'type':Sequelize[_0xf331('0x5')]},'originatecalleridname':{'type':Sequelize[_0xf331('0x5')]},'calleridnum':{'type':Sequelize[_0xf331('0x5')]},'calleridname':{'type':Sequelize[_0xf331('0x5')]},'starttime':{'type':Sequelize[_0xf331('0x3')]},'responsetime':{'type':Sequelize[_0xf331('0x3')]},'answertime':{'type':Sequelize[_0xf331('0x3')]},'droptime':{'type':Sequelize[_0xf331('0x3')]},'endtime':{'type':Sequelize[_0xf331('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf331('0x5')]},'campaign':{'type':Sequelize[_0xf331('0x5')]},'campaigntype':{'type':Sequelize[_0xf331('0x5')]},'membername':{'type':Sequelize[_0xf331('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf331('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4af28c){var _0x297c18=this[_0xf331('0x6')](_0xf331('0x7'));if(_0x297c18&&_0x4af28c){this[_0xf331('0x8')](_0xf331('0x9'),moment(_0x4af28c)[_0xf331('0xa')](moment(_0x297c18),_0xf331('0xb')));}}},'amd':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf331('0x3')]},'callback':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf331('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf331('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf331('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xf331('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf331('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2a71=['sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','diff','seconds','BOOLEAN'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x2a71,0xc6));var _0x12a7=function(_0x5edfba,_0x1dbfe3){_0x5edfba=_0x5edfba-0x0;var _0x45432a=_0x2a71[_0x5edfba];return _0x45432a;};'use strict';var Sequelize=require(_0x12a7('0x0'));var moment=require(_0x12a7('0x1'));module[_0x12a7('0x2')]={'state':{'type':Sequelize[_0x12a7('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x12a7('0x4')]},'countbusyretry':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x12a7('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x12a7('0x5')]},'originatecalleridname':{'type':Sequelize[_0x12a7('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x12a7('0x5')]},'starttime':{'type':Sequelize[_0x12a7('0x4')]},'responsetime':{'type':Sequelize[_0x12a7('0x4')]},'answertime':{'type':Sequelize[_0x12a7('0x4')]},'droptime':{'type':Sequelize[_0x12a7('0x4')]},'endtime':{'type':Sequelize[_0x12a7('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x12a7('0x5')]},'campaign':{'type':Sequelize[_0x12a7('0x5')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x12a7('0x5')]},'disposition':{'type':Sequelize[_0x12a7('0x5')]},'secondDisposition':{'type':Sequelize[_0x12a7('0x5')]},'thirdDisposition':{'type':Sequelize[_0x12a7('0x5')]},'dispositionat':{'type':Sequelize[_0x12a7('0x4')],'set':function(_0x49a73d){var _0x3650e5=this['getDataValue'](_0x12a7('0x6'));if(_0x3650e5&&_0x49a73d){this[_0x12a7('0x7')]('followuptime',moment(_0x49a73d)[_0x12a7('0x8')](moment(_0x3650e5),_0x12a7('0x9')));}}},'amd':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x12a7('0x4')]},'callback':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x12a7('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x12a7('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x12a7('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x12a7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x12a7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 ce751b6..2f0d42a 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 _0x31f0=['sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ListId','createdAt','select','field','ANY_VALUE(calleridnum)','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','ContactId','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','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','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x31f0,0xb7));var _0x031f=function(_0x5669c9,_0x19cd09){_0x5669c9=_0x5669c9-0x0;var _0x313174=_0x31f0[_0x5669c9];return _0x313174;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}exports[_0x031f('0x2a')]=function(_0xb6ed6c,_0xaf5bea){var _0xfaa36={},_0x301bd2={},_0x52b544={'count':0x0,'rows':[]};var _0x1f62eb=_[_0x031f('0x2b')](db[_0x031f('0x2c')][_0x031f('0x2d')],function(_0x428ec4){return{'name':_0x428ec4[_0x031f('0x2e')],'type':_0x428ec4[_0x031f('0x2f')][_0x031f('0x30')]};});_0x301bd2[_0x031f('0x31')]=_[_0x031f('0x2b')](_0x1f62eb,_0x031f('0x28'));_0x301bd2['query']=_[_0x031f('0x32')](_0xb6ed6c[_0x031f('0x33')]);_0x301bd2[_0x031f('0x34')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],_0x301bd2[_0x031f('0x33')]);_0xfaa36[_0x031f('0x36')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],qs[_0x031f('0x37')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x37')]));_0xfaa36[_0x031f('0x36')]=_0xfaa36['attributes'][_0x031f('0x38')]?_0xfaa36[_0x031f('0x36')]:_0x301bd2['model'];if(!_0xb6ed6c[_0x031f('0x33')][_0x031f('0x39')]('nolimit')){_0xfaa36[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x1c')]);_0xfaa36['offset']=qs['offset'](_0xb6ed6c[_0x031f('0x33')]['offset']);}_0xfaa36[_0x031f('0x3a')]=qs[_0x031f('0x3b')](_0xb6ed6c[_0x031f('0x33')]['sort']);_0xfaa36['where']=qs[_0x031f('0x34')](_['pick'](_0xb6ed6c['query'],_0x301bd2[_0x031f('0x34')]),_0x1f62eb);if(_0xb6ed6c[_0x031f('0x33')][_0x031f('0x3c')]){_0xfaa36[_0x031f('0x3d')]=_[_0x031f('0x3e')](_0xfaa36[_0x031f('0x3d')],{'$or':_[_0x031f('0x2b')](_0x1f62eb,function(_0x55c85f){if(_0x55c85f[_0x031f('0x2f')]!==_0x031f('0x3f')){var _0xb3b188={};_0xb3b188[_0x55c85f[_0x031f('0x28')]]={'$like':'%'+_0xb6ed6c['query'][_0x031f('0x3c')]+'%'};return _0xb3b188;}})});}_0xfaa36=_[_0x031f('0x3e')]({},_0xfaa36,_0xb6ed6c[_0x031f('0x40')]);var _0x5895f6={'where':_0xfaa36[_0x031f('0x3d')]};return db[_0x031f('0x2c')]['count'](_0x5895f6)[_0x031f('0x26')](function(_0x268dc7){_0x52b544['count']=_0x268dc7;if(_0xb6ed6c['query'][_0x031f('0x41')]){_0xfaa36[_0x031f('0x42')]=[{'all':!![]}];}return db[_0x031f('0x2c')][_0x031f('0x43')](_0xfaa36);})[_0x031f('0x26')](function(_0xf0fb95){_0x52b544[_0x031f('0x44')]=_0xf0fb95;return _0x52b544;})['then'](respondWithFilteredResult(_0xaf5bea,_0xfaa36))[_0x031f('0x45')](handleError(_0xaf5bea,null));};exports[_0x031f('0x46')]=function(_0x4d701e,_0x12279a){var _0x505e93={'raw':!![],'where':{'id':_0x4d701e[_0x031f('0x47')]['id']}},_0x456a98={};_0x456a98['model']=_[_0x031f('0x32')](db[_0x031f('0x2c')][_0x031f('0x2d')]);_0x456a98['query']=_[_0x031f('0x32')](_0x4d701e[_0x031f('0x33')]);_0x456a98[_0x031f('0x34')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],_0x456a98[_0x031f('0x33')]);_0x505e93[_0x031f('0x36')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],qs['fields'](_0x4d701e[_0x031f('0x33')][_0x031f('0x37')]));_0x505e93[_0x031f('0x36')]=_0x505e93[_0x031f('0x36')][_0x031f('0x38')]?_0x505e93[_0x031f('0x36')]:_0x456a98[_0x031f('0x31')];if(_0x4d701e[_0x031f('0x33')][_0x031f('0x41')]){_0x505e93['include']=[{'all':!![]}];}_0x505e93=_[_0x031f('0x3e')]({},_0x505e93,_0x4d701e['options']);return db['CmHopperFinal'][_0x031f('0x48')](_0x505e93)[_0x031f('0x26')](handleEntityNotFound(_0x12279a,null))[_0x031f('0x26')](respondWithResult(_0x12279a,null))[_0x031f('0x45')](handleError(_0x12279a,null));};exports[_0x031f('0x49')]=function(_0x553f01,_0x309642){return db[_0x031f('0x2c')][_0x031f('0x49')]()['then'](respondWithResult(_0x309642,null))[_0x031f('0x45')](handleError(_0x309642,null));};exports[_0x031f('0x24')]=function(_0x2dba78,_0x318829){if(_0x2dba78[_0x031f('0x4a')][_0x031f('0x4b')]){delete _0x2dba78['body']['uniqueid'];}return db[_0x031f('0x2c')]['find']({'where':{'uniqueid':_0x2dba78[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x318829,null))['then'](saveUpdates(_0x2dba78[_0x031f('0x4a')],null))['then'](respondWithResult(_0x318829,null))['catch'](handleError(_0x318829,null));};exports[_0x031f('0x4c')]=function(_0x48ca85,_0x16bade,_0x57e9dc){return db[_0x031f('0x2c')][_0x031f('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x48ca85['params']['id']},'attributes':[[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x4f')))),'noSuchContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0x031f('0x51')],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x52')))),'busyContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x54')))),_0x031f('0x55')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x56')))),_0x031f('0x57')],[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x16bade,null))[_0x031f('0x26')](respondWithResult(_0x16bade,null))['catch'](handleError(_0x16bade,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4b5db9,_0x4e2d0d,_0x9f76f3){return db[_0x031f('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5db9[_0x031f('0x47')]['id']},'attributes':[[db[_0x031f('0x4d')]['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x4f')))),_0x031f('0x5a')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')]['literal'](_0x031f('0x5b')))),'noAnswerContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x031f('0x52')))),_0x031f('0x5c')],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db['sequelize']['fn']('IF',db[_0x031f('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x031f('0x53')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x5d')))),_0x031f('0x5e')],[db['sequelize']['fn']('COUNT',db[_0x031f('0x4d')]['fn']('IF',db['sequelize'][_0x031f('0x50')](_0x031f('0x54')))),'abandonedContacts'],[db[_0x031f('0x4d')]['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x031f('0x4e'),db[_0x031f('0x4d')]['fn']('IF',db[_0x031f('0x4d')][_0x031f('0x50')](_0x031f('0x58')))),_0x031f('0x59')]]})[_0x031f('0x26')](handleEntityNotFound(_0x4e2d0d,null))['then'](respondWithResult(_0x4e2d0d,null))['catch'](handleError(_0x4e2d0d,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5ddf46,_0x2e3582,_0x14b33e){return db[_0x031f('0x5f')]['find']({'where':{'id':_0x5ddf46[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x2e3582,null))['then'](function(_0x76253){var _0x2c15f4;if(_0x76253){_0x2c15f4=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))[_0x031f('0x63')]([_0x031f('0x64'),'scheduledAt','ContactId',_0x031f('0x65'),'VoiceQueueId',_0x031f('0x66'),'updatedAt'],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')[_0x031f('0x68')](_0x031f('0x6c'),_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x6d'),'VoiceQueueId')['field'](_0x031f('0x6e'),_0x031f('0x66'))['field'](_0x031f('0x6e'),'updatedAt')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46['params']['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x73'),_0x5ddf46['body'][_0x031f('0x74')][_0x031f('0x72')]())['where'](_0x031f('0x75'))[_0x031f('0x3d')](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')]('cm_hopper')[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id']['toString']()))['where'](_0x031f('0x76'),squel['select']()['field'](_0x031f('0x77'))[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x71'),_0x5ddf46[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))['toString']();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x2c15f4);}return[];})[_0x031f('0x26')](respondWithResult(_0x2e3582,null))[_0x031f('0x45')](handleError(_0x2e3582,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x6970f5,_0x5329c2,_0x4a40ad){return db[_0x031f('0x7b')][_0x031f('0x48')]({'where':{'id':_0x6970f5['params']['id']}})['then'](handleEntityNotFound(_0x5329c2,null))[_0x031f('0x26')](function(_0x62016){var _0x1c4561;if(_0x62016){_0x1c4561=squel[_0x031f('0x60')]()[_0x031f('0x61')](_0x031f('0x62'))['fromQuery']([_0x031f('0x64'),_0x031f('0x6a'),'ContactId',_0x031f('0x65'),_0x031f('0x7c'),_0x031f('0x66'),_0x031f('0x7d')],squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x69'),'phone')[_0x031f('0x68')]('NOW()',_0x031f('0x6a'))[_0x031f('0x68')](_0x031f('0x6b'),'ContactId')['field']('ANY_VALUE(ListId)',_0x031f('0x65'))[_0x031f('0x68')](_0x031f('0x7e'),_0x031f('0x7c'))[_0x031f('0x68')](_0x031f('0x6e'),_0x031f('0x66'))['field']('NOW()',_0x031f('0x7d'))[_0x031f('0x6f')]('cm_hopper_final')[_0x031f('0x3d')]('CampaignId\x20=\x20?',_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())['where'](_0x031f('0x73'),_0x6970f5[_0x031f('0x4a')]['state'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x75'))['where'](_0x031f('0x76'),squel[_0x031f('0x67')]()[_0x031f('0x68')](_0x031f('0x64'))[_0x031f('0x6f')](_0x031f('0x62'))['where'](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]()))[_0x031f('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x031f('0x67')]()[_0x031f('0x68')]('calleridnum')[_0x031f('0x6f')](_0x031f('0x70'))[_0x031f('0x3d')](_0x031f('0x7f'),_0x6970f5[_0x031f('0x47')]['id'][_0x031f('0x72')]())[_0x031f('0x3d')](_0x031f('0x78')))[_0x031f('0x79')](_0x031f('0x7a')))[_0x031f('0x72')]();return db[_0x031f('0x4d')][_0x031f('0x33')](_0x1c4561);}return[];})[_0x031f('0x26')](respondWithResult(_0x5329c2,null))[_0x031f('0x45')](handleError(_0x5329c2,null));};exports['checkContactHopper']=function(_0x1b8494,_0x4368d6,_0xa0c51f){return db[_0x031f('0x80')][_0x031f('0x81')]({'where':{'VoiceQueueId':_0x1b8494[_0x031f('0x4a')]['VoiceQueueId'],'CampaignId':_0x1b8494['body']['CampaignId'],'ContactId':_0x1b8494[_0x031f('0x4a')][_0x031f('0x7a')]}})['then'](handleEntityNotFound(_0x4368d6,null))[_0x031f('0x26')](function(_0x303cfa){if(_0x303cfa){return _0x303cfa;}return null;})[_0x031f('0x26')](respondWithResult(_0x4368d6,null))[_0x031f('0x45')](handleError(_0x4368d6,null));}; \ No newline at end of file +var _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x53a11c,_0x393441){var _0x2680d5=function(_0xd3d1e2){while(--_0xd3d1e2){_0x53a11c['push'](_0x53a11c['shift']());}};_0x2680d5(++_0x393441);}(_0x90b1,0x1bb));var _0x190b=function(_0xa89d9c,_0x375f83){_0xa89d9c=_0xa89d9c-0x0;var _0x2cfe5e=_0x90b1[_0xa89d9c];return _0x2cfe5e;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 33565f3..45b87ab 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 _0xb934=['calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','CmHopperFinal','cm_hopper_final'];(function(_0x53c370,_0x50d593){var _0xf2ab09=function(_0x3ac148){while(--_0x3ac148){_0x53c370['push'](_0x53c370['shift']());}};_0xf2ab09(++_0x50d593);}(_0xb934,0x136));var _0x4b93=function(_0x5035bb,_0x412987){_0x5035bb=_0x5035bb-0x0;var _0x3a3ad4=_0xb934[_0x5035bb];return _0x3a3ad4;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var logger=require(_0x4b93('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4b93('0x3'));var rp=require(_0x4b93('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b93('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x4b93('0x6')]=function(_0x13a438,_0x403949){return _0x13a438['define'](_0x4b93('0x7'),attributes,{'tableName':_0x4b93('0x8'),'paranoid':![],'indexes':[{'name':_0x4b93('0x9'),'fields':['calleridnum']},{'name':_0x4b93('0xa'),'fields':[_0x4b93('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde93=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x24441b,_0x5dedf6){var _0x4e1427=function(_0x4f1bfd){while(--_0x4f1bfd){_0x24441b['push'](_0x24441b['shift']());}};_0x4e1427(++_0x5dedf6);}(_0xde93,0x193));var _0x3de9=function(_0x9efe0,_0x1e7272){_0x9efe0=_0x9efe0-0x0;var _0x232a0f=_0xde93[_0x9efe0];return _0x232a0f;};'use strict';var _=require(_0x3de9('0x0'));var util=require(_0x3de9('0x1'));var logger=require(_0x3de9('0x2'))(_0x3de9('0x3'));var moment=require(_0x3de9('0x4'));var BPromise=require(_0x3de9('0x5'));var rp=require(_0x3de9('0x6'));var fs=require('fs');var path=require(_0x3de9('0x7'));var rimraf=require('rimraf');var config=require(_0x3de9('0x8'));var attributes=require(_0x3de9('0x9'));module[_0x3de9('0xa')]=function(_0x5d27c4,_0xfee6a9){return _0x5d27c4[_0x3de9('0xb')]('CmHopperFinal',attributes,{'tableName':_0x3de9('0xc'),'paranoid':![],'indexes':[{'name':_0x3de9('0xd'),'fields':['calleridnum']},{'name':_0x3de9('0xe'),'fields':[_0x3de9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 76f454d..f190d0a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x10445f,_0x2dc1a6){var _0x5c74f7=function(_0x4e3b8a){while(--_0x4e3b8a){_0x10445f['push'](_0x10445f['shift']());}};_0x5c74f7(++_0x2dc1a6);}(_0x7a54,0x106));var _0x47a5=function(_0x440ddd,_0x22ac49){_0x440ddd=_0x440ddd-0x0;var _0x22a37a=_0x7a54[_0x440ddd];return _0x22a37a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3af5c4,_0xb73682){var _0x3c9fa7=function(_0x10ba82){while(--_0x10ba82){_0x3af5c4['push'](_0x3af5c4['shift']());}};_0x3c9fa7(++_0xb73682);}(_0xb10b,0x12a));var _0xbb10=function(_0x361026,_0x2375e2){_0x361026=_0x361026-0x0;var _0x37028e=_0xb10b[_0x361026];return _0x37028e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e68b692..3268397 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 _0xb271=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x266062,_0x142489){var _0x415647=function(_0xeac22c){while(--_0xeac22c){_0x266062['push'](_0x266062['shift']());}};_0x415647(++_0x142489);}(_0xb271,0xf6));var _0x1b27=function(_0x374fae,_0x3e1595){_0x374fae=_0x374fae-0x0;var _0x55b675=_0xb271[_0x374fae];return _0x55b675;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b27('0x0'));var timeout=require(_0x1b27('0x1'));var express=require(_0x1b27('0x2'));var router=express[_0x1b27('0x3')]();var fs_extra=require(_0x1b27('0x4'));var auth=require(_0x1b27('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b27('0x6'));router[_0x1b27('0x7')]('/',auth[_0x1b27('0x8')](),controller[_0x1b27('0x9')]);router[_0x1b27('0x7')](_0x1b27('0xa'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xb')]);router[_0x1b27('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1b27('0xc')]);router[_0x1b27('0x7')]('/voice/queue/countAttributes/:id',auth[_0x1b27('0x8')](),controller[_0x1b27('0xd')]);router[_0x1b27('0x7')](_0x1b27('0xe'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xf')]);router[_0x1b27('0x10')](_0x1b27('0x11'),auth[_0x1b27('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1b27('0x10')](_0x1b27('0x12'),auth[_0x1b27('0x8')](),controller[_0x1b27('0x13')]);router[_0x1b27('0x10')]('/checkContactHopper',auth[_0x1b27('0x8')](),controller[_0x1b27('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x1b27('0x15')]=router; \ No newline at end of file +var _0xaaee=['../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x223ca8,_0x2300bc){var _0x4acccb=function(_0x2ae845){while(--_0x2ae845){_0x223ca8['push'](_0x223ca8['shift']());}};_0x4acccb(++_0x2300bc);}(_0xaaee,0xa9));var _0xeaae=function(_0x13b885,_0x151515){_0x13b885=_0x13b885-0x0;var _0x94433a=_0xaaee[_0x13b885];return _0x94433a;};'use strict';var multer=require(_0xeaae('0x0'));var util=require('util');var path=require(_0xeaae('0x1'));var timeout=require(_0xeaae('0x2'));var express=require('express');var router=express[_0xeaae('0x3')]();var fs_extra=require(_0xeaae('0x4'));var auth=require(_0xeaae('0x5'));var interaction=require(_0xeaae('0x6'));var config=require('../../config/environment');var controller=require(_0xeaae('0x7'));router[_0xeaae('0x8')]('/',auth[_0xeaae('0x9')](),controller[_0xeaae('0xa')]);router[_0xeaae('0x8')](_0xeaae('0xb'),auth['isAuthenticated'](),controller[_0xeaae('0xc')]);router[_0xeaae('0x8')](_0xeaae('0xd'),auth[_0xeaae('0x9')](),controller[_0xeaae('0xe')]);router[_0xeaae('0x8')](_0xeaae('0xf'),auth[_0xeaae('0x9')](),controller[_0xeaae('0x10')]);router['get'](_0xeaae('0x11'),auth[_0xeaae('0x9')](),controller[_0xeaae('0x12')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xeaae('0x9')](),controller[_0xeaae('0x13')]);router[_0xeaae('0x14')]('/voice/campaign/moveContacts/:id',auth[_0xeaae('0x9')](),controller[_0xeaae('0x15')]);router[_0xeaae('0x14')](_0xeaae('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xeaae('0x17')](_0xeaae('0xd'),auth[_0xeaae('0x9')](),controller[_0xeaae('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index d13a9ff..040df8e 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 _0x1c01=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x39d185,_0x170cfc){var _0x19643c=function(_0x5d2197){while(--_0x5d2197){_0x39d185['push'](_0x39d185['shift']());}};_0x19643c(++_0x170cfc);}(_0x1c01,0x190));var _0x11c0=function(_0x2c27b2,_0x4b8209){_0x2c27b2=_0x2c27b2-0x0;var _0xb5306a=_0x1c01[_0x2c27b2];return _0xb5306a;};'use strict';var Sequelize=require(_0x11c0('0x0'));module[_0x11c0('0x1')]={'state':{'type':Sequelize[_0x11c0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x11c0('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x11c0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x11c0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x11c0('0x3')]},'calleridnum':{'type':Sequelize[_0x11c0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x11c0('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x11c0('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11c0('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11c0('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x11c0('0x3')]},'membername':{'type':Sequelize[_0x11c0('0x3')]},'reason':{'type':Sequelize[_0x11c0('0x3')]},'amd':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x11c0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x11c0('0x4')]},'recallme':{'type':Sequelize[_0x11c0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x11c0('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x11c0('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x11c0('0x3')]}}; \ No newline at end of file +var _0x7298=['DATE','STRING','BOOLEAN','sequelize','INTEGER'];(function(_0x1dfb23,_0x244353){var _0x176e75=function(_0x19c936){while(--_0x19c936){_0x1dfb23['push'](_0x1dfb23['shift']());}};_0x176e75(++_0x244353);}(_0x7298,0x12f));var _0x8729=function(_0x9f3df1,_0x8a3272){_0x9f3df1=_0x9f3df1-0x0;var _0x4ee49f=_0x7298[_0x9f3df1];return _0x4ee49f;};'use strict';var Sequelize=require(_0x8729('0x0'));module['exports']={'state':{'type':Sequelize[_0x8729('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8729('0x2')]},'countbusyretry':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8729('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8729('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8729('0x3')]},'calleridnum':{'type':Sequelize[_0x8729('0x3')]},'calleridname':{'type':Sequelize[_0x8729('0x3')]},'starttime':{'type':Sequelize[_0x8729('0x2')]},'responsetime':{'type':Sequelize[_0x8729('0x2')]},'answertime':{'type':Sequelize[_0x8729('0x2')]},'droptime':{'type':Sequelize[_0x8729('0x2')]},'endtime':{'type':Sequelize[_0x8729('0x2')]},'ringtime':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8729('0x3')]},'campaigntype':{'type':Sequelize[_0x8729('0x3')]},'membername':{'type':Sequelize[_0x8729('0x3')]},'reason':{'type':Sequelize[_0x8729('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8729('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8729('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8729('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8729('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8729('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8729('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 88fa436..9d128d3 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 _0x78eb=['params','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','CmHopperHistory','includeAll','include','findAll','rows'];(function(_0x513300,_0x73c54b){var _0x142826=function(_0x2e1ad6){while(--_0x2e1ad6){_0x513300['push'](_0x513300['shift']());}};_0x142826(++_0x73c54b);}(_0x78eb,0xa4));var _0xb78e=function(_0x85100d,_0x26d703){_0x85100d=_0x85100d-0x0;var _0x5886b2=_0x78eb[_0x85100d];return _0x5886b2;};'use strict';var emlformat=require(_0xb78e('0x0'));var rimraf=require(_0xb78e('0x1'));var zipdir=require(_0xb78e('0x2'));var jsonpatch=require(_0xb78e('0x3'));var rp=require(_0xb78e('0x4'));var moment=require(_0xb78e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb78e('0x6'));var util=require(_0xb78e('0x7'));var path=require(_0xb78e('0x8'));var sox=require(_0xb78e('0x9'));var csv=require(_0xb78e('0xa'));var ejs=require(_0xb78e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb78e('0xc'));var squel=require(_0xb78e('0xd'));var crypto=require(_0xb78e('0xe'));var jsforce=require(_0xb78e('0xf'));var deskjs=require(_0xb78e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb78e('0x11'));var Papa=require(_0xb78e('0x12'));var Redis=require(_0xb78e('0x13'));var authService=require(_0xb78e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb78e('0x15'))(_0xb78e('0x16'));var utils=require(_0xb78e('0x17'));var config=require(_0xb78e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb78e('0x19'))['db'];function respondWithStatusCode(_0x3182ed,_0x12fe25){_0x12fe25=_0x12fe25||0xcc;return function(_0x13ee3){if(_0x13ee3){return _0x3182ed[_0xb78e('0x1a')](_0x12fe25);}return _0x3182ed[_0xb78e('0x1b')](_0x12fe25)[_0xb78e('0x1c')]();};}function respondWithResult(_0x229410,_0x2c48be){_0x2c48be=_0x2c48be||0xc8;return function(_0x394709){if(_0x394709){return _0x229410['status'](_0x2c48be)[_0xb78e('0x1d')](_0x394709);}};}function respondWithFilteredResult(_0xf944dd,_0x109862){return function(_0x2ab32a){if(_0x2ab32a){var _0x4f7248=typeof _0x109862['offset']===_0xb78e('0x1e')&&typeof _0x109862[_0xb78e('0x1f')]===_0xb78e('0x1e');var _0x323ee9=_0x2ab32a[_0xb78e('0x20')];var _0x3a14e0=_0x4f7248?0x0:_0x109862[_0xb78e('0x21')];var _0x2bd401=_0x4f7248?_0x2ab32a[_0xb78e('0x20')]:_0x109862[_0xb78e('0x21')]+_0x109862[_0xb78e('0x1f')];var _0x259a8b;if(_0x2bd401>=_0x323ee9){_0x2bd401=_0x323ee9;_0x259a8b=0xc8;}else{_0x259a8b=0xce;}_0xf944dd[_0xb78e('0x1b')](_0x259a8b);return _0xf944dd[_0xb78e('0x22')](_0xb78e('0x23'),_0x3a14e0+'-'+_0x2bd401+'/'+_0x323ee9)[_0xb78e('0x1d')](_0x2ab32a);}return null;};}function patchUpdates(_0x2fd4ab){return function(_0x532338){try{jsonpatch[_0xb78e('0x24')](_0x532338,_0x2fd4ab,!![]);}catch(_0x310435){return BPromise['reject'](_0x310435);}return _0x532338[_0xb78e('0x25')]();};}function saveUpdates(_0x4608a7,_0x4e755a){return function(_0x57cde3){if(_0x57cde3){return _0x57cde3['update'](_0x4608a7)[_0xb78e('0x26')](function(_0x362439){return _0x362439;});}return null;};}function removeEntity(_0x52a6b3,_0x4943c0){return function(_0x231f5f){if(_0x231f5f){return _0x231f5f[_0xb78e('0x27')]()['then'](function(){_0x52a6b3[_0xb78e('0x1b')](0xcc)[_0xb78e('0x1c')]();});}};}function handleEntityNotFound(_0xc12fc4,_0x5d5340){return function(_0x45ee1e){if(!_0x45ee1e){_0xc12fc4[_0xb78e('0x1a')](0x194);}return _0x45ee1e;};}function handleError(_0x520f85,_0x24863a){_0x24863a=_0x24863a||0x1f4;return function(_0x26cdcb){logger[_0xb78e('0x28')](_0x26cdcb['stack']);if(_0x26cdcb[_0xb78e('0x29')]){delete _0x26cdcb[_0xb78e('0x29')];}_0x520f85['status'](_0x24863a)[_0xb78e('0x2a')](_0x26cdcb);};}exports['index']=function(_0x59c03f,_0x37200b){var _0x49f918={},_0x9db0c1={},_0x3d051e={'count':0x0,'rows':[]};var _0x2f0303=_['map'](db['CmHopperHistory'][_0xb78e('0x2b')],function(_0x4bbccd){return{'name':_0x4bbccd[_0xb78e('0x2c')],'type':_0x4bbccd[_0xb78e('0x2d')][_0xb78e('0x2e')]};});_0x9db0c1[_0xb78e('0x2f')]=_[_0xb78e('0x30')](_0x2f0303,'name');_0x9db0c1[_0xb78e('0x31')]=_[_0xb78e('0x32')](_0x59c03f[_0xb78e('0x31')]);_0x9db0c1[_0xb78e('0x33')]=_[_0xb78e('0x34')](_0x9db0c1[_0xb78e('0x2f')],_0x9db0c1[_0xb78e('0x31')]);_0x49f918[_0xb78e('0x35')]=_['intersection'](_0x9db0c1[_0xb78e('0x2f')],qs[_0xb78e('0x36')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x36')]));_0x49f918[_0xb78e('0x35')]=_0x49f918['attributes'][_0xb78e('0x37')]?_0x49f918[_0xb78e('0x35')]:_0x9db0c1[_0xb78e('0x2f')];if(!_0x59c03f['query'][_0xb78e('0x38')](_0xb78e('0x39'))){_0x49f918[_0xb78e('0x1f')]=qs[_0xb78e('0x1f')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x1f')]);_0x49f918[_0xb78e('0x21')]=qs[_0xb78e('0x21')](_0x59c03f[_0xb78e('0x31')][_0xb78e('0x21')]);}_0x49f918[_0xb78e('0x3a')]=qs[_0xb78e('0x3b')](_0x59c03f['query'][_0xb78e('0x3b')]);_0x49f918[_0xb78e('0x3c')]=qs[_0xb78e('0x33')](_[_0xb78e('0x3d')](_0x59c03f[_0xb78e('0x31')],_0x9db0c1[_0xb78e('0x33')]),_0x2f0303);if(_0x59c03f[_0xb78e('0x31')]['filter']){_0x49f918[_0xb78e('0x3c')]=_[_0xb78e('0x3e')](_0x49f918[_0xb78e('0x3c')],{'$or':_['map'](_0x2f0303,function(_0x193dcf){if(_0x193dcf[_0xb78e('0x2d')]!=='VIRTUAL'){var _0x3fdaad={};_0x3fdaad[_0x193dcf['name']]={'$like':'%'+_0x59c03f['query'][_0xb78e('0x3f')]+'%'};return _0x3fdaad;}})});}_0x49f918=_[_0xb78e('0x3e')]({},_0x49f918,_0x59c03f[_0xb78e('0x40')]);var _0x52fbab={'where':_0x49f918['where']};return db[_0xb78e('0x41')]['count'](_0x52fbab)['then'](function(_0x57162b){_0x3d051e[_0xb78e('0x20')]=_0x57162b;if(_0x59c03f[_0xb78e('0x31')][_0xb78e('0x42')]){_0x49f918[_0xb78e('0x43')]=[{'all':!![]}];}return db[_0xb78e('0x41')][_0xb78e('0x44')](_0x49f918);})[_0xb78e('0x26')](function(_0x4606d5){_0x3d051e[_0xb78e('0x45')]=_0x4606d5;return _0x3d051e;})['then'](respondWithFilteredResult(_0x37200b,_0x49f918))['catch'](handleError(_0x37200b,null));};exports['show']=function(_0xcecf59,_0x43a0e6){var _0x223cef={'raw':!![],'where':{'id':_0xcecf59[_0xb78e('0x46')]['id']}},_0x2ed18b={};_0x2ed18b[_0xb78e('0x2f')]=_[_0xb78e('0x32')](db[_0xb78e('0x41')][_0xb78e('0x2b')]);_0x2ed18b[_0xb78e('0x31')]=_[_0xb78e('0x32')](_0xcecf59[_0xb78e('0x31')]);_0x2ed18b[_0xb78e('0x33')]=_[_0xb78e('0x34')](_0x2ed18b[_0xb78e('0x2f')],_0x2ed18b[_0xb78e('0x31')]);_0x223cef['attributes']=_['intersection'](_0x2ed18b[_0xb78e('0x2f')],qs[_0xb78e('0x36')](_0xcecf59['query']['fields']));_0x223cef[_0xb78e('0x35')]=_0x223cef[_0xb78e('0x35')][_0xb78e('0x37')]?_0x223cef['attributes']:_0x2ed18b[_0xb78e('0x2f')];if(_0xcecf59['query']['includeAll']){_0x223cef['include']=[{'all':!![]}];}_0x223cef=_[_0xb78e('0x3e')]({},_0x223cef,_0xcecf59['options']);return db[_0xb78e('0x41')][_0xb78e('0x47')](_0x223cef)[_0xb78e('0x26')](handleEntityNotFound(_0x43a0e6,null))[_0xb78e('0x26')](respondWithResult(_0x43a0e6,null))[_0xb78e('0x48')](handleError(_0x43a0e6,null));};exports['create']=function(_0x500805,_0x18395a){return db[_0xb78e('0x41')][_0xb78e('0x49')](_0x500805['body'],{})[_0xb78e('0x26')](respondWithResult(_0x18395a,0xc9))[_0xb78e('0x48')](handleError(_0x18395a,null));};exports[_0xb78e('0x4a')]=function(_0x277c36,_0x417bb1){return db[_0xb78e('0x41')][_0xb78e('0x4a')]()['then'](respondWithResult(_0x417bb1,null))[_0xb78e('0x48')](handleError(_0x417bb1,null));};exports[_0xb78e('0x4b')]=function(_0x22b47c,_0x4502d0){if(_0x22b47c[_0xb78e('0x4c')][_0xb78e('0x4d')]){delete _0x22b47c[_0xb78e('0x4c')][_0xb78e('0x4d')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x22b47c[_0xb78e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4502d0,null))[_0xb78e('0x26')](saveUpdates(_0x22b47c['body'],null))[_0xb78e('0x26')](respondWithResult(_0x4502d0,null))[_0xb78e('0x48')](handleError(_0x4502d0,null));}; \ No newline at end of file +var _0x3499=['create','body','describe','update','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','length','find','catch'];(function(_0x40e609,_0x4e4b74){var _0xf46928=function(_0xed016c){while(--_0xed016c){_0x40e609['push'](_0x40e609['shift']());}};_0xf46928(++_0x4e4b74);}(_0x3499,0x1cd));var _0x9349=function(_0x2bf6be,_0x5b23f1){_0x2bf6be=_0x2bf6be-0x0;var _0x532ef4=_0x3499[_0x2bf6be];return _0x532ef4;};'use strict';var emlformat=require(_0x9349('0x0'));var rimraf=require(_0x9349('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9349('0x2'));var rp=require(_0x9349('0x3'));var moment=require(_0x9349('0x4'));var BPromise=require(_0x9349('0x5'));var Mustache=require(_0x9349('0x6'));var util=require(_0x9349('0x7'));var path=require('path');var sox=require(_0x9349('0x8'));var csv=require(_0x9349('0x9'));var ejs=require(_0x9349('0xa'));var fs=require('fs');var fs_extra=require(_0x9349('0xb'));var _=require(_0x9349('0xc'));var squel=require(_0x9349('0xd'));var crypto=require(_0x9349('0xe'));var jsforce=require(_0x9349('0xf'));var deskjs=require(_0x9349('0x10'));var toCsv=require(_0x9349('0x9'));var querystring=require(_0x9349('0x11'));var Papa=require('papaparse');var Redis=require(_0x9349('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9349('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9349('0x14'));var utils=require(_0x9349('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9349('0x16'));var db=require(_0x9349('0x17'))['db'];function respondWithStatusCode(_0x3259e4,_0x3dfb31){_0x3dfb31=_0x3dfb31||0xcc;return function(_0x4ebd2e){if(_0x4ebd2e){return _0x3259e4[_0x9349('0x18')](_0x3dfb31);}return _0x3259e4['status'](_0x3dfb31)[_0x9349('0x19')]();};}function respondWithResult(_0x3df8b1,_0x16a336){_0x16a336=_0x16a336||0xc8;return function(_0xbecda1){if(_0xbecda1){return _0x3df8b1[_0x9349('0x1a')](_0x16a336)[_0x9349('0x1b')](_0xbecda1);}};}function respondWithFilteredResult(_0x5d5c7d,_0x4431a8){return function(_0x148fcb){if(_0x148fcb){var _0x376b12=typeof _0x4431a8[_0x9349('0x1c')]===_0x9349('0x1d')&&typeof _0x4431a8['limit']===_0x9349('0x1d');var _0xf4937a=_0x148fcb[_0x9349('0x1e')];var _0x1c9d7c=_0x376b12?0x0:_0x4431a8[_0x9349('0x1c')];var _0x132572=_0x376b12?_0x148fcb['count']:_0x4431a8[_0x9349('0x1c')]+_0x4431a8[_0x9349('0x1f')];var _0x51ea1f;if(_0x132572>=_0xf4937a){_0x132572=_0xf4937a;_0x51ea1f=0xc8;}else{_0x51ea1f=0xce;}_0x5d5c7d[_0x9349('0x1a')](_0x51ea1f);return _0x5d5c7d[_0x9349('0x20')](_0x9349('0x21'),_0x1c9d7c+'-'+_0x132572+'/'+_0xf4937a)[_0x9349('0x1b')](_0x148fcb);}return null;};}function patchUpdates(_0x5bd254){return function(_0xd9ce2d){try{jsonpatch[_0x9349('0x22')](_0xd9ce2d,_0x5bd254,!![]);}catch(_0x5e3822){return BPromise[_0x9349('0x23')](_0x5e3822);}return _0xd9ce2d[_0x9349('0x24')]();};}function saveUpdates(_0x591f5f,_0x523eb5){return function(_0x17ac98){if(_0x17ac98){return _0x17ac98['update'](_0x591f5f)[_0x9349('0x25')](function(_0x45939f){return _0x45939f;});}return null;};}function removeEntity(_0x3708f0,_0x1d587c){return function(_0x3225d5){if(_0x3225d5){return _0x3225d5[_0x9349('0x26')]()['then'](function(){_0x3708f0['status'](0xcc)[_0x9349('0x19')]();});}};}function handleEntityNotFound(_0x4ce628,_0x54fac8){return function(_0x8eff99){if(!_0x8eff99){_0x4ce628[_0x9349('0x18')](0x194);}return _0x8eff99;};}function handleError(_0x3aea41,_0x4f2d1b){_0x4f2d1b=_0x4f2d1b||0x1f4;return function(_0x410a2c){logger[_0x9349('0x27')](_0x410a2c[_0x9349('0x28')]);if(_0x410a2c[_0x9349('0x29')]){delete _0x410a2c[_0x9349('0x29')];}_0x3aea41[_0x9349('0x1a')](_0x4f2d1b)['send'](_0x410a2c);};}exports['index']=function(_0x373f2a,_0x5cbe13){var _0x3bb161={},_0x29e578={},_0x115b62={'count':0x0,'rows':[]};var _0x4dea09=_[_0x9349('0x2a')](db[_0x9349('0x2b')][_0x9349('0x2c')],function(_0x37387a){return{'name':_0x37387a[_0x9349('0x2d')],'type':_0x37387a[_0x9349('0x2e')]['key']};});_0x29e578[_0x9349('0x2f')]=_['map'](_0x4dea09,_0x9349('0x29'));_0x29e578[_0x9349('0x30')]=_[_0x9349('0x31')](_0x373f2a['query']);_0x29e578[_0x9349('0x32')]=_[_0x9349('0x33')](_0x29e578[_0x9349('0x2f')],_0x29e578[_0x9349('0x30')]);_0x3bb161['attributes']=_['intersection'](_0x29e578[_0x9349('0x2f')],qs[_0x9349('0x34')](_0x373f2a['query'][_0x9349('0x34')]));_0x3bb161['attributes']=_0x3bb161[_0x9349('0x35')]['length']?_0x3bb161[_0x9349('0x35')]:_0x29e578['model'];if(!_0x373f2a['query'][_0x9349('0x36')](_0x9349('0x37'))){_0x3bb161['limit']=qs[_0x9349('0x1f')](_0x373f2a['query'][_0x9349('0x1f')]);_0x3bb161['offset']=qs[_0x9349('0x1c')](_0x373f2a[_0x9349('0x30')][_0x9349('0x1c')]);}_0x3bb161['order']=qs[_0x9349('0x38')](_0x373f2a[_0x9349('0x30')]['sort']);_0x3bb161[_0x9349('0x39')]=qs['filters'](_[_0x9349('0x3a')](_0x373f2a[_0x9349('0x30')],_0x29e578[_0x9349('0x32')]),_0x4dea09);if(_0x373f2a[_0x9349('0x30')][_0x9349('0x3b')]){_0x3bb161[_0x9349('0x39')]=_['merge'](_0x3bb161[_0x9349('0x39')],{'$or':_[_0x9349('0x2a')](_0x4dea09,function(_0xdcef23){if(_0xdcef23[_0x9349('0x2e')]!==_0x9349('0x3c')){var _0x2b9ad2={};_0x2b9ad2[_0xdcef23[_0x9349('0x29')]]={'$like':'%'+_0x373f2a[_0x9349('0x30')]['filter']+'%'};return _0x2b9ad2;}})});}_0x3bb161=_[_0x9349('0x3d')]({},_0x3bb161,_0x373f2a['options']);var _0x4476b3={'where':_0x3bb161['where']};return db[_0x9349('0x2b')][_0x9349('0x1e')](_0x4476b3)['then'](function(_0xd09b39){_0x115b62[_0x9349('0x1e')]=_0xd09b39;if(_0x373f2a[_0x9349('0x30')][_0x9349('0x3e')]){_0x3bb161[_0x9349('0x3f')]=[{'all':!![]}];}return db[_0x9349('0x2b')][_0x9349('0x40')](_0x3bb161);})['then'](function(_0x17d1f0){_0x115b62[_0x9349('0x41')]=_0x17d1f0;return _0x115b62;})[_0x9349('0x25')](respondWithFilteredResult(_0x5cbe13,_0x3bb161))['catch'](handleError(_0x5cbe13,null));};exports[_0x9349('0x42')]=function(_0x3e58c6,_0x4a7460){var _0x5f1aa5={'raw':!![],'where':{'id':_0x3e58c6[_0x9349('0x43')]['id']}},_0x5d4468={};_0x5d4468[_0x9349('0x2f')]=_['keys'](db[_0x9349('0x2b')][_0x9349('0x2c')]);_0x5d4468['query']=_[_0x9349('0x31')](_0x3e58c6[_0x9349('0x30')]);_0x5d4468[_0x9349('0x32')]=_['intersection'](_0x5d4468[_0x9349('0x2f')],_0x5d4468[_0x9349('0x30')]);_0x5f1aa5['attributes']=_[_0x9349('0x33')](_0x5d4468[_0x9349('0x2f')],qs[_0x9349('0x34')](_0x3e58c6['query'][_0x9349('0x34')]));_0x5f1aa5[_0x9349('0x35')]=_0x5f1aa5[_0x9349('0x35')][_0x9349('0x44')]?_0x5f1aa5[_0x9349('0x35')]:_0x5d4468[_0x9349('0x2f')];if(_0x3e58c6['query'][_0x9349('0x3e')]){_0x5f1aa5['include']=[{'all':!![]}];}_0x5f1aa5=_[_0x9349('0x3d')]({},_0x5f1aa5,_0x3e58c6['options']);return db['CmHopperHistory'][_0x9349('0x45')](_0x5f1aa5)['then'](handleEntityNotFound(_0x4a7460,null))['then'](respondWithResult(_0x4a7460,null))[_0x9349('0x46')](handleError(_0x4a7460,null));};exports[_0x9349('0x47')]=function(_0x2147b1,_0x5070d7){return db[_0x9349('0x2b')]['create'](_0x2147b1[_0x9349('0x48')],{})[_0x9349('0x25')](respondWithResult(_0x5070d7,0xc9))['catch'](handleError(_0x5070d7,null));};exports['describe']=function(_0x3331ee,_0x3ea594){return db[_0x9349('0x2b')][_0x9349('0x49')]()[_0x9349('0x25')](respondWithResult(_0x3ea594,null))[_0x9349('0x46')](handleError(_0x3ea594,null));};exports[_0x9349('0x4a')]=function(_0x1b8312,_0x325560){if(_0x1b8312[_0x9349('0x48')][_0x9349('0x4b')]){delete _0x1b8312[_0x9349('0x48')][_0x9349('0x4b')];}return db[_0x9349('0x2b')][_0x9349('0x45')]({'where':{'uniqueid':_0x1b8312[_0x9349('0x43')]['id']}})['then'](handleEntityNotFound(_0x325560,null))[_0x9349('0x25')](saveUpdates(_0x1b8312[_0x9349('0x48')],null))[_0x9349('0x25')](respondWithResult(_0x325560,null))[_0x9349('0x46')](handleError(_0x325560,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 60e19e1..85dcf07 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 _0xe558=['rimraf','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5bdf88,_0xe67737){var _0x261864=function(_0x3b36b2){while(--_0x3b36b2){_0x5bdf88['push'](_0x5bdf88['shift']());}};_0x261864(++_0xe67737);}(_0xe558,0x70));var _0x8e55=function(_0x60831,_0x1df549){_0x60831=_0x60831-0x0;var _0x81e704=_0xe558[_0x60831];return _0x81e704;};'use strict';var _=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var logger=require(_0x8e55('0x2'))(_0x8e55('0x3'));var moment=require(_0x8e55('0x4'));var BPromise=require(_0x8e55('0x5'));var rp=require(_0x8e55('0x6'));var fs=require('fs');var path=require(_0x8e55('0x7'));var rimraf=require(_0x8e55('0x8'));var config=require('../../config/environment');var attributes=require(_0x8e55('0x9'));module[_0x8e55('0xa')]=function(_0x34d4ec,_0x3dff04){return _0x34d4ec[_0x8e55('0xb')](_0x8e55('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x8e55('0xd'),'fields':[_0x8e55('0xd')]},{'name':'uniqueid','fields':[_0x8e55('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x553a=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird','rimraf'];(function(_0x4b5eb3,_0x2f810d){var _0x330a65=function(_0x451ff4){while(--_0x451ff4){_0x4b5eb3['push'](_0x4b5eb3['shift']());}};_0x330a65(++_0x2f810d);}(_0x553a,0x192));var _0xa553=function(_0xd8face,_0x4ef518){_0xd8face=_0xd8face-0x0;var _0x38d98d=_0x553a[_0xd8face];return _0x38d98d;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var logger=require('../../config/logger')(_0xa553('0x1'));var moment=require(_0xa553('0x2'));var BPromise=require(_0xa553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa553('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xa553('0x5')]=function(_0x53190d,_0x5ddf5e){return _0x53190d[_0xa553('0x6')](_0xa553('0x7'),attributes,{'tableName':_0xa553('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa553('0x9')]},{'name':'uniqueid','fields':[_0xa553('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index da5e99c..3b79468 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 _0xd9dc=['options','raw','stringify','catch','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body'];(function(_0x5b0aec,_0x5f0fd0){var _0x59c564=function(_0x4adbf2){while(--_0x4adbf2){_0x5b0aec['push'](_0x5b0aec['shift']());}};_0x59c564(++_0x5f0fd0);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x4d6338,_0x2b44bb){_0x4d6338=_0x4d6338-0x0;var _0xbb9b7c=_0xd9dc[_0x4d6338];return _0xbb9b7c;};'use strict';var _=require('lodash');var util=require(_0xcd9d('0x0'));var moment=require(_0xcd9d('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd9d('0x2'));var fs=require('fs');var Redis=require(_0xcd9d('0x3'));var db=require(_0xcd9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd9d('0x5'))(_0xcd9d('0x6'));var config=require(_0xcd9d('0x7'));var jayson=require(_0xcd9d('0x8'));var client=jayson[_0xcd9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288482,_0x425858,_0x1d8770){return new BPromise(function(_0x285e75,_0x45130c){return client['request'](_0x288482,_0x1d8770)[_0xcd9d('0xa')](function(_0x114a7c){logger[_0xcd9d('0xb')](_0xcd9d('0xc'),_0x425858,_0xcd9d('0xd'));logger[_0xcd9d('0xe')](_0xcd9d('0xf'),_0x425858,_0xcd9d('0xd'),JSON['stringify'](_0x114a7c));if(_0x114a7c[_0xcd9d('0x10')]){if(_0x114a7c['error'][_0xcd9d('0x11')]===0x1f4){logger['error'](_0xcd9d('0xc'),_0x425858,_0x114a7c[_0xcd9d('0x10')][_0xcd9d('0x12')]);return _0x45130c(_0x114a7c['error'][_0xcd9d('0x12')]);}logger['error'](_0xcd9d('0xc'),_0x425858,_0x114a7c[_0xcd9d('0x10')][_0xcd9d('0x12')]);return _0x285e75(_0x114a7c['error'][_0xcd9d('0x12')]);}else{logger[_0xcd9d('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x425858,_0xcd9d('0xd'));_0x285e75(_0x114a7c['result'][_0xcd9d('0x12')]);}})['catch'](function(_0x3e5e23){logger[_0xcd9d('0x10')](_0xcd9d('0xc'),_0x425858,_0x3e5e23);_0x45130c(_0x3e5e23);});});}exports[_0xcd9d('0x13')]=function(_0x438169){var _0x4381e2=this;return new Promise(function(_0x24959b,_0x3c544d){return db[_0xcd9d('0x14')][_0xcd9d('0x15')](_0x438169[_0xcd9d('0x16')],{'raw':_0x438169['options']?_0x438169[_0xcd9d('0x17')][_0xcd9d('0x18')]===undefined?!![]:![]:!![]})[_0xcd9d('0xa')](function(_0x594bd8){logger[_0xcd9d('0xb')](_0xcd9d('0x13'),_0x438169);logger[_0xcd9d('0xe')](_0xcd9d('0x13'),_0x438169,JSON[_0xcd9d('0x19')](_0x594bd8));_0x24959b(_0x594bd8);})[_0xcd9d('0x1a')](function(_0x1e7d4d){logger[_0xcd9d('0x10')]('CreateCmHopperHistory',_0x1e7d4d['message'],_0x438169);_0x3c544d(_0x4381e2[_0xcd9d('0x10')](0x1f4,_0x1e7d4d[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x1b')]=function(_0x474bb4){var _0x58b632=this;return new Promise(function(_0x73420,_0x2ecff5){return db[_0xcd9d('0x14')][_0xcd9d('0x1c')]({'raw':_0x474bb4[_0xcd9d('0x17')]?_0x474bb4[_0xcd9d('0x17')][_0xcd9d('0x18')]===undefined?!![]:![]:!![],'where':_0x474bb4[_0xcd9d('0x17')]?_0x474bb4[_0xcd9d('0x17')][_0xcd9d('0x1d')]||null:null,'attributes':[[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['col']('id')),_0xcd9d('0x20')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0xcd9d('0x22')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x23')))),_0xcd9d('0x24')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xcd9d('0x25')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x26'),db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xcd9d('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xcd9d('0x26'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xcd9d('0xa')](function(_0x8e354c){logger[_0xcd9d('0xb')]('AvgHandleTime',_0x474bb4);logger[_0xcd9d('0xe')](_0xcd9d('0x1b'),_0x474bb4,JSON[_0xcd9d('0x19')](_0x8e354c));_0x73420(_0x8e354c);})[_0xcd9d('0x1a')](function(_0x37314d){logger[_0xcd9d('0x10')](_0xcd9d('0x1b'),_0x37314d[_0xcd9d('0x12')],_0x474bb4);_0x2ecff5(_0x58b632[_0xcd9d('0x10')](0x1f4,_0x37314d[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x28')]=function(_0x3a815d){var _0x52cb2c=this;return new Promise(function(_0x2f6eff,_0x383c1d){return db['CmHopperHistory']['findAll']({'raw':_0x3a815d[_0xcd9d('0x17')]?_0x3a815d['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a815d[_0xcd9d('0x17')]?_0x3a815d[_0xcd9d('0x17')][_0xcd9d('0x1d')]||null:null,'attributes':[[_0xcd9d('0x29'),'name'],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x2a')))),_0xcd9d('0x2b')],[db['sequelize']['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize'][_0xcd9d('0x21')](_0xcd9d('0x2c')))),_0xcd9d('0x2d')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x2e')))),_0xcd9d('0x2f')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x30')))),_0xcd9d('0x31')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x32')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x33')))),_0xcd9d('0x34')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x35')))),_0xcd9d('0x36')],[db[_0xcd9d('0x1e')]['fn']('COUNT',db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x37')))),_0xcd9d('0x38')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db['sequelize'][_0xcd9d('0x21')](_0xcd9d('0x39')))),_0xcd9d('0x3a')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x3b')))),_0xcd9d('0x3c')],[db[_0xcd9d('0x1e')]['fn'](_0xcd9d('0x1f'),db['sequelize']['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')](_0xcd9d('0x3d')))),_0xcd9d('0x3a')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')][_0xcd9d('0x21')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xcd9d('0x3e')]],'group':[_0xcd9d('0x29')]})[_0xcd9d('0xa')](function(_0x425e86){logger[_0xcd9d('0xb')]('GetVoiceQueueHopperHistory',_0x3a815d);logger[_0xcd9d('0xe')](_0xcd9d('0x28'),_0x3a815d,JSON['stringify'](_0x425e86));_0x2f6eff(_0x425e86);})[_0xcd9d('0x1a')](function(_0x3c3d0e){logger['error'](_0xcd9d('0x28'),_0x3c3d0e[_0xcd9d('0x12')],_0x3a815d);_0x383c1d(_0x52cb2c[_0xcd9d('0x10')](0x1f4,_0x3c3d0e[_0xcd9d('0x12')]));});});};exports[_0xcd9d('0x3f')]=function(_0x1db78c){var _0x5ebe93=this;return new Promise(function(_0x5eb7b4,_0x58264e){return db[_0xcd9d('0x14')][_0xcd9d('0x1c')]({'raw':_0x1db78c[_0xcd9d('0x17')]?_0x1db78c['options'][_0xcd9d('0x18')]===undefined?!![]:![]:!![],'where':_0x1db78c[_0xcd9d('0x17')]?_0x1db78c['options'][_0xcd9d('0x1d')]||null:null,'attributes':[[_0xcd9d('0x29'),_0xcd9d('0x40')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['col']('id')),_0xcd9d('0x41')],[db['sequelize']['fn'](_0xcd9d('0x1f'),db[_0xcd9d('0x1e')]['fn']('IF',db[_0xcd9d('0x1e')]['literal'](_0xcd9d('0x2e')))),_0xcd9d('0x42')]],'group':[_0xcd9d('0x29')]})[_0xcd9d('0xa')](function(_0xbd5461){logger[_0xcd9d('0xb')](_0xcd9d('0x3f'),_0x1db78c);logger[_0xcd9d('0xe')](_0xcd9d('0x3f'),_0x1db78c,JSON['stringify'](_0xbd5461));_0x5eb7b4(_0xbd5461);})[_0xcd9d('0x1a')](function(_0x28c759){logger[_0xcd9d('0x10')]('GetCampaignHopperHistory',_0x28c759[_0xcd9d('0x12')],_0x1db78c);_0x58264e(_0x5ebe93[_0xcd9d('0x10')](0x1f4,_0x28c759[_0xcd9d('0x12')]));});});}; \ No newline at end of file +var _0xa47d=['`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','catch','AvgHandleTime','findAll','where','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','sequelize','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa47d,0xe7));var _0xda47=function(_0x5f1624,_0xe336e4){_0x5f1624=_0x5f1624-0x0;var _0x1b6459=_0xa47d[_0x5f1624];return _0x1b6459;};'use strict';var _=require(_0xda47('0x0'));var util=require(_0xda47('0x1'));var moment=require(_0xda47('0x2'));var BPromise=require(_0xda47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda47('0x4'));var db=require(_0xda47('0x5'))['db'];var utils=require(_0xda47('0x6'));var logger=require(_0xda47('0x7'))(_0xda47('0x8'));var config=require('../../config/environment');var jayson=require(_0xda47('0x9'));var client=jayson[_0xda47('0xa')][_0xda47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x163ccc,_0x3c2769,_0x5f4c8d){return new BPromise(function(_0x22f8e0,_0xb9272f){return client[_0xda47('0xc')](_0x163ccc,_0x5f4c8d)[_0xda47('0xd')](function(_0x45a68e){logger['info'](_0xda47('0xe'),_0x3c2769,_0xda47('0xf'));logger[_0xda47('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c2769,_0xda47('0xf'),JSON[_0xda47('0x11')](_0x45a68e));if(_0x45a68e[_0xda47('0x12')]){if(_0x45a68e[_0xda47('0x12')]['code']===0x1f4){logger[_0xda47('0x12')](_0xda47('0xe'),_0x3c2769,_0x45a68e[_0xda47('0x12')][_0xda47('0x13')]);return _0xb9272f(_0x45a68e[_0xda47('0x12')]['message']);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3c2769,_0x45a68e[_0xda47('0x12')]['message']);return _0x22f8e0(_0x45a68e[_0xda47('0x12')][_0xda47('0x13')]);}else{logger[_0xda47('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x3c2769,_0xda47('0xf'));_0x22f8e0(_0x45a68e[_0xda47('0x15')][_0xda47('0x13')]);}})['catch'](function(_0x442aec){logger[_0xda47('0x12')](_0xda47('0xe'),_0x3c2769,_0x442aec);_0xb9272f(_0x442aec);});});}exports[_0xda47('0x16')]=function(_0x5da4d7){var _0x298550=this;return new Promise(function(_0x3acdbd,_0x518c89){return db[_0xda47('0x17')][_0xda47('0x18')](_0x5da4d7['body'],{'raw':_0x5da4d7[_0xda47('0x19')]?_0x5da4d7[_0xda47('0x19')][_0xda47('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x279165){logger[_0xda47('0x14')](_0xda47('0x16'),_0x5da4d7);logger['debug'](_0xda47('0x16'),_0x5da4d7,JSON['stringify'](_0x279165));_0x3acdbd(_0x279165);})[_0xda47('0x1b')](function(_0xdcb6c3){logger[_0xda47('0x12')](_0xda47('0x16'),_0xdcb6c3[_0xda47('0x13')],_0x5da4d7);_0x518c89(_0x298550[_0xda47('0x12')](0x1f4,_0xdcb6c3[_0xda47('0x13')]));});});};exports[_0xda47('0x1c')]=function(_0xa4d46f){var _0x33e33d=this;return new Promise(function(_0x39e67a,_0x4422c7){return db['CmHopperHistory'][_0xda47('0x1d')]({'raw':_0xa4d46f[_0xda47('0x19')]?_0xa4d46f[_0xda47('0x19')][_0xda47('0x1a')]===undefined?!![]:![]:!![],'where':_0xa4d46f[_0xda47('0x19')]?_0xa4d46f['options'][_0xda47('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0xda47('0x1f')]('id')),_0xda47('0x20')],[db['sequelize']['fn'](_0xda47('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xda47('0x22')](_0xda47('0x23')))),_0xda47('0x24')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0xda47('0x26')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db['sequelize']['literal'](_0xda47('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xda47('0x25')]['fn'](_0xda47('0x28'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x29')))),_0xda47('0x2a')],[db[_0xda47('0x25')]['fn']('AVG',db[_0xda47('0x25')]['fn']('IF',db['sequelize'][_0xda47('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xda47('0x2b')]]})[_0xda47('0xd')](function(_0x4e4777){logger[_0xda47('0x14')](_0xda47('0x1c'),_0xa4d46f);logger[_0xda47('0x10')]('AvgHandleTime',_0xa4d46f,JSON[_0xda47('0x11')](_0x4e4777));_0x39e67a(_0x4e4777);})[_0xda47('0x1b')](function(_0x18ba17){logger['error'](_0xda47('0x1c'),_0x18ba17[_0xda47('0x13')],_0xa4d46f);_0x4422c7(_0x33e33d[_0xda47('0x12')](0x1f4,_0x18ba17['message']));});});};exports[_0xda47('0x2c')]=function(_0x598cd7){var _0x457637=this;return new Promise(function(_0x522338,_0xa9a224){return db[_0xda47('0x17')][_0xda47('0x1d')]({'raw':_0x598cd7[_0xda47('0x19')]?_0x598cd7[_0xda47('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x598cd7[_0xda47('0x19')]?_0x598cd7[_0xda47('0x19')][_0xda47('0x1e')]||null:null,'attributes':[[_0xda47('0x2d'),_0xda47('0x2e')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xda47('0x22')](_0xda47('0x2f')))),_0xda47('0x30')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x31')))),_0xda47('0x32')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db['sequelize']['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xda47('0x33')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')]('`state`\x20=\x205,\x201,\x20null'))),_0xda47('0x34')],[db['sequelize']['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db['sequelize'][_0xda47('0x22')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0xda47('0x25')]['fn']('COUNT',db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')]['literal'](_0xda47('0x35')))),_0xda47('0x36')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x38')))),_0xda47('0x39')],[db[_0xda47('0x25')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xda47('0x22')](_0xda47('0x3a')))),_0xda47('0x3b')],[db[_0xda47('0x25')]['fn']('COUNT',db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')]['literal'](_0xda47('0x3d')))),_0xda47('0x3e')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')]['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x3f')))),_0xda47('0x40')],[db['sequelize']['fn'](_0xda47('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xda47('0x22')](_0xda47('0x41')))),_0xda47('0x42')]],'group':['campaign']})[_0xda47('0xd')](function(_0x34f54a){logger[_0xda47('0x14')](_0xda47('0x2c'),_0x598cd7);logger[_0xda47('0x10')](_0xda47('0x2c'),_0x598cd7,JSON[_0xda47('0x11')](_0x34f54a));_0x522338(_0x34f54a);})[_0xda47('0x1b')](function(_0x114888){logger[_0xda47('0x12')]('GetVoiceQueueHopperHistory',_0x114888[_0xda47('0x13')],_0x598cd7);_0xa9a224(_0x457637['error'](0x1f4,_0x114888['message']));});});};exports[_0xda47('0x43')]=function(_0x68188){var _0x215e0e=this;return new Promise(function(_0x3d14bb,_0x38be10){return db[_0xda47('0x17')][_0xda47('0x1d')]({'raw':_0x68188[_0xda47('0x19')]?_0x68188[_0xda47('0x19')][_0xda47('0x1a')]===undefined?!![]:![]:!![],'where':_0x68188['options']?_0x68188[_0xda47('0x19')]['where']||null:null,'attributes':[['campaign',_0xda47('0x2e')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db[_0xda47('0x25')][_0xda47('0x1f')]('id')),_0xda47('0x44')],[db[_0xda47('0x25')]['fn'](_0xda47('0x21'),db['sequelize']['fn']('IF',db[_0xda47('0x25')][_0xda47('0x22')](_0xda47('0x23')))),_0xda47('0x45')]],'group':[_0xda47('0x2d')]})[_0xda47('0xd')](function(_0x237c2a){logger['info'](_0xda47('0x43'),_0x68188);logger[_0xda47('0x10')](_0xda47('0x43'),_0x68188,JSON[_0xda47('0x11')](_0x237c2a));_0x3d14bb(_0x237c2a);})[_0xda47('0x1b')](function(_0x8a4c5){logger['error'](_0xda47('0x43'),_0x8a4c5[_0xda47('0x13')],_0x68188);_0x38be10(_0x215e0e[_0xda47('0x12')](0x1f4,_0x8a4c5[_0xda47('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e9a9d0b..53fc5cb 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 _0xbb3f=['/:id','create','put','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','describe'];(function(_0x4d886a,_0x1980d3){var _0x3fa895=function(_0x3731f8){while(--_0x3731f8){_0x4d886a['push'](_0x4d886a['shift']());}};_0x3fa895(++_0x1980d3);}(_0xbb3f,0x153));var _0xfbb3=function(_0x2941ff,_0x5e720f){_0x2941ff=_0x2941ff-0x0;var _0x2f6f05=_0xbb3f[_0x2941ff];return _0x2f6f05;};'use strict';var multer=require('multer');var util=require(_0xfbb3('0x0'));var path=require('path');var timeout=require(_0xfbb3('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfbb3('0x2'));var interaction=require(_0xfbb3('0x3'));var config=require('../../config/environment');var controller=require(_0xfbb3('0x4'));router[_0xfbb3('0x5')]('/',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0x7')]);router[_0xfbb3('0x5')]('/describe',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0x8')]);router[_0xfbb3('0x5')](_0xfbb3('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfbb3('0x6')](),controller[_0xfbb3('0xa')]);router[_0xfbb3('0xb')]('/:id',auth[_0xfbb3('0x6')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x555f=['index','/describe','describe','/:id','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x2d1905,_0x515b36){var _0x5b7538=function(_0x47eb13){while(--_0x47eb13){_0x2d1905['push'](_0x2d1905['shift']());}};_0x5b7538(++_0x515b36);}(_0x555f,0x18d));var _0xf555=function(_0x529870,_0x975245){_0x529870=_0x529870-0x0;var _0x39435f=_0x555f[_0x529870];return _0x39435f;};'use strict';var multer=require('multer');var util=require(_0xf555('0x0'));var path=require('path');var timeout=require(_0xf555('0x1'));var express=require(_0xf555('0x2'));var router=express[_0xf555('0x3')]();var fs_extra=require(_0xf555('0x4'));var auth=require(_0xf555('0x5'));var interaction=require(_0xf555('0x6'));var config=require(_0xf555('0x7'));var controller=require(_0xf555('0x8'));router[_0xf555('0x9')]('/',auth[_0xf555('0xa')](),controller[_0xf555('0xb')]);router[_0xf555('0x9')](_0xf555('0xc'),auth[_0xf555('0xa')](),controller[_0xf555('0xd')]);router[_0xf555('0x9')](_0xf555('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf555('0xa')](),controller['create']);router[_0xf555('0xf')](_0xf555('0xe'),auth['isAuthenticated'](),controller[_0xf555('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 853c99e..7f5d591 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 _0xde6c=['STRING','sequelize','exports','name'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0xde6c,0x119));var _0xcde6=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xde6c[_0xab9f3d];return _0x5283bf;};'use strict';var Sequelize=require(_0xcde6('0x0'));module[_0xcde6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcde6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcde6('0x3')]},'dialPrefix':{'type':Sequelize[_0xcde6('0x3')]}}; \ No newline at end of file +var _0x2fed=['sequelize','exports','STRING','name'];(function(_0x4b754b,_0x4500a9){var _0x1d34ba=function(_0x47d74d){while(--_0x47d74d){_0x4b754b['push'](_0x4b754b['shift']());}};_0x1d34ba(++_0x4500a9);}(_0x2fed,0x7c));var _0xd2fe=function(_0x860e78,_0x5d8295){_0x860e78=_0x860e78-0x0;var _0x106a03=_0x2fed[_0x860e78];return _0x106a03;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'name':{'type':Sequelize[_0xd2fe('0x2')],'unique':_0xd2fe('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd2fe('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 771dcaa..c781116 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 _0x481f=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','end','stack','name','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','includeAll','removeDispositions','ids','CmContact','isArray','tags','join','push','omit','success','dataValues','message','CustomFields','concat','format','raw','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','customField_','field','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','sequelize','queryInterface','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','rimraf'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0x481f,0x1ea));var _0xf481=function(_0x2a4428,_0xd1f091){_0x2a4428=_0x2a4428-0x0;var _0x44b336=_0x481f[_0x2a4428];return _0x44b336;};'use strict';var emlformat=require(_0xf481('0x0'));var rimraf=require(_0xf481('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf481('0x2'));var rp=require(_0xf481('0x3'));var moment=require(_0xf481('0x4'));var BPromise=require(_0xf481('0x5'));var Mustache=require('mustache');var util=require(_0xf481('0x6'));var path=require(_0xf481('0x7'));var sox=require(_0xf481('0x8'));var csv=require(_0xf481('0x9'));var ejs=require(_0xf481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf481('0xb'));var squel=require(_0xf481('0xc'));var crypto=require(_0xf481('0xd'));var jsforce=require(_0xf481('0xe'));var deskjs=require(_0xf481('0xf'));var toCsv=require(_0xf481('0x9'));var querystring=require(_0xf481('0x10'));var Papa=require(_0xf481('0x11'));var Redis=require(_0xf481('0x12'));var authService=require(_0xf481('0x13'));var qs=require(_0xf481('0x14'));var as=require(_0xf481('0x15'));var hardwareService=require(_0xf481('0x16'));var logger=require(_0xf481('0x17'))(_0xf481('0x18'));var utils=require(_0xf481('0x19'));var config=require(_0xf481('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf481('0x1b'))['db'];var csv_results;config[_0xf481('0x1c')]=_[_0xf481('0x1d')](config[_0xf481('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf481('0x1c')]));require(_0xf481('0x1e'))[_0xf481('0x1f')](socket);function respondWithStatusCode(_0x106bd3,_0x51d5a5){_0x51d5a5=_0x51d5a5||0xcc;return function(_0x4fa933){if(_0x4fa933){return _0x106bd3[_0xf481('0x20')](_0x51d5a5);}return _0x106bd3[_0xf481('0x21')](_0x51d5a5)['end']();};}function respondWithResult(_0x1ec062,_0x38c562){_0x38c562=_0x38c562||0xc8;return function(_0x2c853f){if(_0x2c853f){return _0x1ec062[_0xf481('0x21')](_0x38c562)['json'](_0x2c853f);}};}function respondWithFilteredResult(_0x59ef1b,_0x5e7f74){return function(_0x55e0f2){if(_0x55e0f2){var _0x51064a=typeof _0x5e7f74[_0xf481('0x22')]===_0xf481('0x23')&&typeof _0x5e7f74[_0xf481('0x24')]===_0xf481('0x23');var _0x3a4aa4=_0x55e0f2[_0xf481('0x25')];var _0x1f0d8d=_0x51064a?0x0:_0x5e7f74['offset'];var _0xb5e777=_0x51064a?_0x55e0f2[_0xf481('0x25')]:_0x5e7f74[_0xf481('0x22')]+_0x5e7f74[_0xf481('0x24')];var _0x5ade48;if(_0xb5e777>=_0x3a4aa4){_0xb5e777=_0x3a4aa4;_0x5ade48=0xc8;}else{_0x5ade48=0xce;}_0x59ef1b['status'](_0x5ade48);return _0x59ef1b[_0xf481('0x26')]('Content-Range',_0x1f0d8d+'-'+_0xb5e777+'/'+_0x3a4aa4)[_0xf481('0x27')](_0x55e0f2);}return null;};}function patchUpdates(_0x3375d0){return function(_0x4d0f5e){try{jsonpatch[_0xf481('0x28')](_0x4d0f5e,_0x3375d0,!![]);}catch(_0xfc66b0){return BPromise[_0xf481('0x29')](_0xfc66b0);}return _0x4d0f5e[_0xf481('0x2a')]();};}function saveUpdates(_0x42b37b,_0x256604){return function(_0x283447){if(_0x283447){return _0x283447[_0xf481('0x2b')](_0x42b37b)[_0xf481('0x2c')](function(_0x3612c4){return _0x3612c4;});}return null;};}function removeEntity(_0x319f0d,_0x1dad36){return function(_0x25576b){if(_0x25576b){return _0x25576b[_0xf481('0x2d')]()[_0xf481('0x2c')](function(){var _0x451ef7=_0x25576b[_0xf481('0x2e')]({'plain':!![]});var _0x2678e8=_0xf481('0x2f');return db[_0xf481('0x30')]['destroy']({'where':{'type':_0x2678e8,'resourceId':_0x451ef7['id']}})[_0xf481('0x2c')](function(){return _0x25576b;});})[_0xf481('0x2c')](function(){_0x319f0d[_0xf481('0x21')](0xcc)[_0xf481('0x31')]();});}};}function handleEntityNotFound(_0x531630,_0x774f75){return function(_0x4662a4){if(!_0x4662a4){_0x531630[_0xf481('0x20')](0x194);}return _0x4662a4;};}function handleError(_0x2e9168,_0x54b56f){_0x54b56f=_0x54b56f||0x1f4;return function(_0x4bb3f8){logger['error'](_0x4bb3f8[_0xf481('0x32')]);if(_0x4bb3f8[_0xf481('0x33')]){delete _0x4bb3f8[_0xf481('0x33')];}_0x2e9168[_0xf481('0x21')](_0x54b56f)['send'](_0x4bb3f8);};}exports['index']=function(_0x4e7b3f,_0x1965ca){var _0xbcbda1={},_0x4b46a2={},_0x5f22b4={'count':0x0,'rows':[]};var _0x27fc19=_[_0xf481('0x34')](db[_0xf481('0x35')][_0xf481('0x36')],function(_0x11a84e){return{'name':_0x11a84e[_0xf481('0x37')],'type':_0x11a84e[_0xf481('0x38')][_0xf481('0x39')]};});_0x4b46a2[_0xf481('0x3a')]=_[_0xf481('0x34')](_0x27fc19,_0xf481('0x33'));_0x4b46a2[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x4e7b3f[_0xf481('0x3b')]);_0x4b46a2[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4b46a2[_0xf481('0x3a')],_0x4b46a2['query']);_0xbcbda1[_0xf481('0x3f')]=_[_0xf481('0x3e')](_0x4b46a2[_0xf481('0x3a')],qs['fields'](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x40')]));_0xbcbda1[_0xf481('0x3f')]=_0xbcbda1[_0xf481('0x3f')]['length']?_0xbcbda1[_0xf481('0x3f')]:_0x4b46a2['model'];if(!_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x41')](_0xf481('0x42'))){_0xbcbda1[_0xf481('0x24')]=qs[_0xf481('0x24')](_0x4e7b3f['query'][_0xf481('0x24')]);_0xbcbda1['offset']=qs[_0xf481('0x22')](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x22')]);}_0xbcbda1[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x44')]);_0xbcbda1[_0xf481('0x45')]=qs[_0xf481('0x3d')](_[_0xf481('0x46')](_0x4e7b3f['query'],_0x4b46a2['filters']),_0x27fc19);if(_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x47')]){_0xbcbda1[_0xf481('0x45')]=_[_0xf481('0x48')](_0xbcbda1[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0x27fc19,function(_0x3c5629){if(_0x3c5629[_0xf481('0x38')]!==_0xf481('0x49')){var _0x327902={};_0x327902[_0x3c5629[_0xf481('0x33')]]={'$like':'%'+_0x4e7b3f[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x327902;}})});}_0xbcbda1=_[_0xf481('0x48')]({},_0xbcbda1,_0x4e7b3f[_0xf481('0x4a')]);var _0x607170={'where':_0xbcbda1['where']};return db[_0xf481('0x35')][_0xf481('0x25')](_0x607170)['then'](function(_0x359940){_0x5f22b4[_0xf481('0x25')]=_0x359940;if(_0x4e7b3f[_0xf481('0x3b')]['includeAll']){_0xbcbda1[_0xf481('0x4b')]=[{'all':!![]}];}return db[_0xf481('0x35')][_0xf481('0x4c')](_0xbcbda1);})[_0xf481('0x2c')](function(_0x4b08ce){_0x5f22b4[_0xf481('0x4d')]=_0x4b08ce;return _0x5f22b4;})[_0xf481('0x2c')](respondWithFilteredResult(_0x1965ca,_0xbcbda1))[_0xf481('0x4e')](handleError(_0x1965ca,null));};exports[_0xf481('0x4f')]=function(_0x55eb92,_0x628961){var _0x276a2f={'raw':![],'where':{'id':_0x55eb92[_0xf481('0x50')]['id']}},_0x279b15={};_0x279b15[_0xf481('0x3a')]=_['keys'](db[_0xf481('0x35')][_0xf481('0x36')]);_0x279b15['query']=_[_0xf481('0x3c')](_0x55eb92[_0xf481('0x3b')]);_0x279b15['filters']=_[_0xf481('0x3e')](_0x279b15[_0xf481('0x3a')],_0x279b15[_0xf481('0x3b')]);_0x276a2f[_0xf481('0x3f')]=_['intersection'](_0x279b15[_0xf481('0x3a')],qs[_0xf481('0x40')](_0x55eb92[_0xf481('0x3b')][_0xf481('0x40')]));_0x276a2f[_0xf481('0x3f')]=_0x276a2f['attributes'][_0xf481('0x51')]?_0x276a2f[_0xf481('0x3f')]:_0x279b15[_0xf481('0x3a')];if(_0x55eb92[_0xf481('0x3b')]['includeAll']){_0x276a2f[_0xf481('0x4b')]=[{'all':!![]}];}_0x276a2f=_[_0xf481('0x48')]({},_0x276a2f,_0x55eb92[_0xf481('0x4a')]);return db['CmList'][_0xf481('0x52')](_0x276a2f)[_0xf481('0x2c')](handleEntityNotFound(_0x628961,null))['then'](respondWithResult(_0x628961,null))[_0xf481('0x4e')](handleError(_0x628961,null));};exports['create']=function(_0x19726f,_0xcae7fa){return db[_0xf481('0x35')]['create'](_0x19726f[_0xf481('0x53')],{})[_0xf481('0x2c')](function(_0x5eff89){var _0x4b3f61=_0x19726f[_0xf481('0x54')]['get']({'plain':!![]});if(!_0x4b3f61)throw new Error(_0xf481('0x55'));if(_0x4b3f61[_0xf481('0x56')]===_0xf481('0x54')){var _0x3384ab=_0x5eff89[_0xf481('0x2e')]({'plain':!![]});var _0x1c2e03=_0xf481('0x2f');return db[_0xf481('0x57')][_0xf481('0x52')]({'where':{'name':_0x1c2e03,'userProfileId':_0x4b3f61[_0xf481('0x58')]},'raw':!![]})[_0xf481('0x2c')](function(_0x5c8b2a){if(_0x5c8b2a&&_0x5c8b2a[_0xf481('0x59')]===0x0){return db[_0xf481('0x30')][_0xf481('0x5a')]({'name':_0x3384ab['name'],'resourceId':_0x3384ab['id'],'type':_0x5c8b2a['name'],'sectionId':_0x5c8b2a['id']},{})[_0xf481('0x2c')](function(){return _0x5eff89;});}else{return _0x5eff89;}})[_0xf481('0x4e')](function(_0x5483be){logger[_0xf481('0x5b')](_0xf481('0x5c'),_0x5483be);throw _0x5483be;});}return _0x5eff89;})[_0xf481('0x2c')](respondWithResult(_0xcae7fa,0xc9))['catch'](handleError(_0xcae7fa,null));};exports[_0xf481('0x2b')]=function(_0x3a084f,_0x3f5c0a){if(_0x3a084f[_0xf481('0x53')]['id']){delete _0x3a084f[_0xf481('0x53')]['id'];}return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x3a084f[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x3f5c0a,null))[_0xf481('0x2c')](saveUpdates(_0x3a084f[_0xf481('0x53')],null))['then'](respondWithResult(_0x3f5c0a,null))[_0xf481('0x4e')](handleError(_0x3f5c0a,null));};exports[_0xf481('0x2d')]=function(_0x25b743,_0x5a7e74){return db[_0xf481('0x35')]['find']({'where':{'id':_0x25b743[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x5a7e74,null))[_0xf481('0x2c')](removeEntity(_0x5a7e74,null))['catch'](handleError(_0x5a7e74,null));};exports['describe']=function(_0x228ef4,_0x374591){return db[_0xf481('0x35')][_0xf481('0x5d')]()[_0xf481('0x2c')](respondWithResult(_0x374591,null))[_0xf481('0x4e')](handleError(_0x374591,null));};exports[_0xf481('0x5e')]=function(_0xb0ee1b,_0x56d04a,_0x2eb609){if(_0xb0ee1b[_0xf481('0x53')]['id']){delete _0xb0ee1b[_0xf481('0x53')]['id'];}return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0xb0ee1b[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x56d04a,null))[_0xf481('0x2c')](function(_0x3c1c2c){if(_0x3c1c2c){_0xb0ee1b[_0xf481('0x53')][_0xf481('0x5f')]=_0x3c1c2c['id'];return db[_0xf481('0x60')][_0xf481('0x5a')](_0xb0ee1b[_0xf481('0x53')]);}})[_0xf481('0x2c')](respondWithResult(_0x56d04a,null))[_0xf481('0x4e')](handleError(_0x56d04a,null));};exports[_0xf481('0x61')]=function(_0x5b44cf,_0x303f62,_0x363cca){var _0x241658={'raw':![],'where':{}};var _0x5278be={};var _0x539e7b={'count':0x0,'rows':[]};return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x5b44cf[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x303f62,null))['then'](function(_0x2f6091){if(_0x2f6091){_0x5278be['model']=_[_0xf481('0x3c')](db[_0xf481('0x60')][_0xf481('0x36')]);_0x5278be[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x5b44cf[_0xf481('0x3b')]);_0x5278be['filters']=_[_0xf481('0x3e')](_0x5278be['model'],_0x5278be[_0xf481('0x3b')]);_0x241658[_0xf481('0x3f')]=_['intersection'](_0x5278be['model'],qs[_0xf481('0x40')](_0x5b44cf[_0xf481('0x3b')][_0xf481('0x40')]));_0x241658['attributes']=_0x241658[_0xf481('0x3f')]['length']?_0x241658[_0xf481('0x3f')]:_0x5278be[_0xf481('0x3a')];if(!_0x5b44cf['query'][_0xf481('0x41')]('nolimit')){_0x241658[_0xf481('0x24')]=qs[_0xf481('0x24')](_0x5b44cf['query']['limit']);_0x241658[_0xf481('0x22')]=qs['offset'](_0x5b44cf['query'][_0xf481('0x22')]);}_0x241658[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x5b44cf['query'][_0xf481('0x44')]);_0x241658[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x5b44cf[_0xf481('0x3b')],_0x5278be[_0xf481('0x3d')]));_0x241658[_0xf481('0x45')][_0xf481('0x5f')]=_0x2f6091['id'];if(_0x5b44cf['query'][_0xf481('0x47')]){_0x241658['where']=_[_0xf481('0x48')](_0x241658[_0xf481('0x45')],{'$or':_['map'](_0x241658[_0xf481('0x3f')],function(_0x5c5ea0){var _0x4b299f={};_0x4b299f[_0x5c5ea0]={'$like':'%'+_0x5b44cf[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x4b299f;})});}_0x241658=_[_0xf481('0x48')]({},_0x241658,_0x5b44cf['options']);return db[_0xf481('0x60')][_0xf481('0x25')]({'where':_0x241658[_0xf481('0x45')]})[_0xf481('0x2c')](function(_0x38d5ce){_0x539e7b[_0xf481('0x25')]=_0x38d5ce;if(_0x5b44cf[_0xf481('0x3b')][_0xf481('0x63')]){_0x241658['include']=[{'all':!![]}];}return db[_0xf481('0x60')][_0xf481('0x4c')](_0x241658);})[_0xf481('0x2c')](function(_0x50b192){_0x539e7b[_0xf481('0x4d')]=_0x50b192;return _0x539e7b;});}})[_0xf481('0x2c')](respondWithFilteredResult(_0x303f62,_0x241658))[_0xf481('0x4e')](handleError(_0x303f62,null));};exports[_0xf481('0x64')]=function(_0x30f97e,_0x2d657e,_0x39b202){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x30f97e[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x2d657e,null))['then'](function(_0x76aa99){if(_0x76aa99){return _0x76aa99[_0xf481('0x64')](_0x30f97e['query'][_0xf481('0x65')]);}})[_0xf481('0x2c')](respondWithStatusCode(_0x2d657e,null))[_0xf481('0x4e')](handleError(_0x2d657e,null));};exports['addContacts']=function(_0x298793,_0x137055,_0x13a51d){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x298793['params']['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x137055,null))[_0xf481('0x2c')](function(_0x47c4dd){if(_0x47c4dd){var _0x25053b=[];var _0x7d0f28={'success':[],'errors':[]};return db[_0xf481('0x66')][_0xf481('0x5d')]()['then'](function(_0x12511e){if(_0x298793[_0xf481('0x53')]['tags']&&_[_0xf481('0x67')](_0x298793[_0xf481('0x53')]['tags'])){if(_0x298793[_0xf481('0x53')][_0xf481('0x68')][_0xf481('0x51')]){_0x298793[_0xf481('0x53')]['tags']=_0x298793[_0xf481('0x53')][_0xf481('0x68')][_0xf481('0x69')](';')+';';}else{_0x298793[_0xf481('0x53')][_0xf481('0x68')]=null;}}else{_0x298793[_0xf481('0x53')][_0xf481('0x68')]=null;}if(_0x298793[_0xf481('0x53')]&&_[_0xf481('0x67')](_0x298793[_0xf481('0x53')])){for(var _0x5035dd=0x0;_0x5035dd<_0x298793[_0xf481('0x53')]['length'];_0x5035dd+=0x1){_0x298793[_0xf481('0x53')][_0x5035dd]['ListId']=_0x298793[_0xf481('0x50')]['id'];_0x25053b[_0xf481('0x6a')](_0x298793[_0xf481('0x53')][_0x5035dd]);}return BPromise['each'](_0x25053b,function(_0x49339d){return db[_0xf481('0x66')][_0xf481('0x5a')](_[_0xf481('0x6b')](_0x49339d,[_0xf481('0x65'),'id'])||{},{'fields':_['keys'](_0x12511e),'raw':!![]})['then'](function(_0x1c7626){_0x7d0f28[_0xf481('0x6c')][_0xf481('0x6a')](_0x1c7626[_0xf481('0x6d')]);})['catch'](function(_0x4e0f8a){_0x7d0f28['errors'][_0xf481('0x6a')]({'data':_0x49339d,'error':_0x4e0f8a[_0xf481('0x6e')]});});})[_0xf481('0x2c')](function(_0x408447){return _0x7d0f28;})[_0xf481('0x4e')](function(_0x3b4ce4){return _0x3b4ce4;});}else{_0x137055[_0xf481('0x21')](0x190)[_0xf481('0x27')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xf481('0x2c')](respondWithResult(_0x137055,null))[_0xf481('0x4e')](handleError(_0x137055,null));};exports['getContacts']=function(_0x181f2c,_0xd1e9f8,_0x51f9ae){var _0x7ab9ed;return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x181f2c[_0xf481('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xf481('0x6f')}]})[_0xf481('0x2c')](handleEntityNotFound(_0xd1e9f8,null))[_0xf481('0x2c')](function(_0x55d7f7){if(_0x55d7f7){_0x7ab9ed=_0x55d7f7;return db[_0xf481('0x66')]['rawAttributes'];}})['then'](function(_0x4d1a58){if(_0x4d1a58){var _0x38df59={};var _0x4f55f7={};_0x4f55f7[_0xf481('0x3a')]=_[_0xf481('0x70')](_[_0xf481('0x3c')](_0x4d1a58),_[_0xf481('0x34')](_0x7ab9ed[_0xf481('0x6f')],function(_0x291230){return util[_0xf481('0x71')]('cf_%d',_0x291230['id']);}));_0x4f55f7[_0xf481('0x3b')]=_['keys'](_0x181f2c['query']);_0x4f55f7[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4f55f7[_0xf481('0x3a')],_0x4f55f7[_0xf481('0x3b')]);_0x38df59['attributes']=_[_0xf481('0x3e')](_0x4f55f7[_0xf481('0x3a')],qs[_0xf481('0x40')](_0x181f2c['query']['fields']));_0x38df59['attributes']=_0x38df59[_0xf481('0x3f')][_0xf481('0x51')]?_0x38df59[_0xf481('0x3f')]:_0x4f55f7[_0xf481('0x3a')];if(!_0x181f2c[_0xf481('0x3b')][_0xf481('0x41')](_0xf481('0x42'))){_0x38df59[_0xf481('0x24')]=qs['limit'](_0x181f2c[_0xf481('0x3b')]['limit']);_0x38df59[_0xf481('0x22')]=qs['offset'](_0x181f2c[_0xf481('0x3b')][_0xf481('0x22')]);}_0x38df59[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x181f2c[_0xf481('0x3b')][_0xf481('0x44')]);_0x38df59[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x181f2c[_0xf481('0x3b')],_0x4f55f7['filters']));_0x38df59[_0xf481('0x72')]=!![];if(_0x181f2c[_0xf481('0x3b')][_0xf481('0x47')]){_0x38df59[_0xf481('0x45')]=_[_0xf481('0x48')](_0x38df59[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0x38df59['attributes'],function(_0x30bc8a){var _0x554d74={};_0x554d74[_0x30bc8a]={'$like':'%'+_0x181f2c[_0xf481('0x3b')]['filter']+'%'};return _0x554d74;})});}_0x38df59=_[_0xf481('0x48')]({},_0x38df59,_0x181f2c[_0xf481('0x4a')]);return _0x7ab9ed['getContacts'](_0x38df59);}})[_0xf481('0x2c')](respondWithResult(_0xd1e9f8,null))[_0xf481('0x4e')](handleError(_0xd1e9f8,null));};exports['getContactsCsv']=function(_0x407197,_0x4c8b5a,_0x570c5a){var _0x399a33;var _0x5b0647;var _0x129d80;var _0x3e65ae=_0x407197[_0xf481('0x50')]['id'];csv_results=[];return db[_0xf481('0x73')][_0xf481('0x4c')]({'attributes':['id',_0xf481('0x33')],'raw':!![],'order':[_0xf481('0x74')]})[_0xf481('0x2c')](function(_0x5182b3){_0x399a33=_0x5182b3;var _0x51fbca=_[_0xf481('0x3c')](db[_0xf481('0x66')][_0xf481('0x36')]);return db[_0xf481('0x75')]['findAll']({'raw':!![],'attributes':['id',_0xf481('0x76')]})['then'](function(_0x1c076e){_0x5b0647=_0x1c076e;var _0x25a10c=squel[_0xf481('0x77')]()[_0xf481('0x40')](_0x51fbca)[_0xf481('0x78')](_0xf481('0x79'),'c')['where'](_0xf481('0x7a'),_0x3e65ae)[_0xf481('0x45')](_0xf481('0x7b'))[_0xf481('0x7c')]();for(var _0x5ac2a9=0x0;_0x5ac2a9<_0x5b0647[_0xf481('0x51')];_0x5ac2a9++){_0x25a10c['field']('c.cf_'+_0x5b0647[_0x5ac2a9]['id'],_0xf481('0x7d')+_0x5b0647[_0x5ac2a9][_0xf481('0x76')]);}for(var _0x5ac2a9=0x0;_0x5ac2a9<_0x399a33[_0xf481('0x51')];_0x5ac2a9++){_0x25a10c[_0xf481('0x7e')](squel[_0xf481('0x77')]()[_0xf481('0x7e')](_0xf481('0x7f'))[_0xf481('0x78')](_0xf481('0x80'))[_0xf481('0x45')]('ItemTypeId\x20=\x20?',_0x399a33[_0x5ac2a9]['id'])['where'](_0xf481('0x81')),_0xf481('0x82')+_0x399a33[_0x5ac2a9][_0xf481('0x33')]);_0x25a10c['field'](squel['select']()[_0xf481('0x7e')](_0xf481('0x83'))['from']('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x399a33[_0x5ac2a9]['id'])[_0xf481('0x45')](_0xf481('0x81')),_0xf481('0x84')+_0x399a33[_0x5ac2a9][_0xf481('0x33')]);}var _0x4a5ae0=[];_0x4a5ae0[_0xf481('0x6a')](_0x25a10c[_0xf481('0x85')]());BPromise[_0xf481('0x86')](_0x4a5ae0,handleQuery)[_0xf481('0x2c')](function(_0x59cf7c){handleQuery(_0x25a10c[_0xf481('0x85')]());var _0x6ed2a3=csv_results[0x0];if(!_['isEmpty'](_0x6ed2a3)){var _0x4a85fa=toCsv(_0x6ed2a3);var _0x4669cf=Date[_0xf481('0x87')]();fs[_0xf481('0x88')](util[_0xf481('0x71')](_0xf481('0x89'),_0x3e65ae,_0x4669cf),_0x4a85fa);_0x4c8b5a[_0xf481('0x8a')]('Content-disposition',_0xf481('0x8b')+util['format'](_0xf481('0x8c'),_0x3e65ae,_0x4669cf));_0x4c8b5a['setHeader']('Content-type',_0xf481('0x8d'));return _0x4c8b5a['download'](util['format'](_0xf481('0x89'),_0x3e65ae,_0x4669cf));}else{return _0x4c8b5a[_0xf481('0x20')](0xcc);}});});});};exports[_0xf481('0x8e')]=function(_0x310026,_0x2973fc,_0x11a0c8){var _0x470259;delete _0x310026[_0xf481('0x53')]['id'];return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x310026['params']['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x2973fc,null))[_0xf481('0x2c')](function(_0x2ca6af){if(_0x2ca6af){return db['sequelize'][_0xf481('0x8f')](function(_0x3a8a8f){return db[_0xf481('0x75')][_0xf481('0x5a')](_0x310026[_0xf481('0x53')],{'transaction':_0x3a8a8f})[_0xf481('0x2c')](function(_0x2caa36){_0x470259=_0x2caa36;return _0x2ca6af['addCustomFields'](_0x2caa36,{'transaction':_0x3a8a8f});})[_0xf481('0x2c')](function(){var _0x15b6fc={'type':db[_0xf481('0x90')]['TEXT'],'transaction':_0x3a8a8f};switch(_0x310026[_0xf481('0x53')][_0xf481('0x38')]){case'text':_0x15b6fc[_0xf481('0x38')]=db[_0xf481('0x90')][_0xf481('0x91')];break;case _0xf481('0x92'):_0x15b6fc[_0xf481('0x38')]=db[_0xf481('0x90')][_0xf481('0x93')];break;case'switch':_0x15b6fc['type']=db[_0xf481('0x90')][_0xf481('0x94')];_0x15b6fc['defaultValue']=![];break;default:}return db[_0xf481('0x95')][_0xf481('0x96')]['addColumn'](_0xf481('0x79'),util[_0xf481('0x71')](_0xf481('0x97'),_0x470259['id']),_0x15b6fc);})[_0xf481('0x2c')](function(){return _0x470259;});});}})[_0xf481('0x2c')](respondWithResult(_0x2973fc,null))[_0xf481('0x4e')](handleError(_0x2973fc,null));};exports[_0xf481('0x98')]=function(_0x48cbac,_0x34937d,_0x19f2fa){var _0x27fec8={};var _0x39af2c={};var _0x5c35e0;var _0x3ddb01;return db['CmList']['findOne']({'where':{'id':_0x48cbac[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x34937d,null))[_0xf481('0x2c')](function(_0x11d916){if(_0x11d916){_0x5c35e0=_0x11d916;_0x39af2c['model']=_[_0xf481('0x3c')](db[_0xf481('0x75')]['rawAttributes']);_0x39af2c[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x48cbac['query']);_0x39af2c[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x39af2c['model'],_0x39af2c['query']);_0x27fec8[_0xf481('0x3f')]=_['intersection'](_0x39af2c['model'],qs[_0xf481('0x40')](_0x48cbac[_0xf481('0x3b')][_0xf481('0x40')]));_0x27fec8['attributes']=_0x27fec8[_0xf481('0x3f')]['length']?_0x27fec8[_0xf481('0x3f')]:_0x39af2c['model'];_0x27fec8[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x48cbac['query'][_0xf481('0x44')]);_0x27fec8[_0xf481('0x45')]=qs['filters'](_[_0xf481('0x46')](_0x48cbac[_0xf481('0x3b')],_0x39af2c[_0xf481('0x3d')]));_0x27fec8[_0xf481('0x45')]=_[_0xf481('0x48')](_0x27fec8[_0xf481('0x45')],{'$or':[{'ListId':_0x11d916['id']},{'ListId':null}]});if(_0x48cbac[_0xf481('0x3b')][_0xf481('0x47')]){_0x27fec8[_0xf481('0x45')]=_[_0xf481('0x48')](_0x27fec8['where'],{'$or':_[_0xf481('0x34')](_0x27fec8[_0xf481('0x3f')],function(_0x96f30c){var _0x39acbc={};_0x39acbc[_0x96f30c]={'$like':'%'+_0x48cbac[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x39acbc;})});}_0x27fec8=_[_0xf481('0x48')]({},_0x27fec8,_0x48cbac[_0xf481('0x4a')]);return db[_0xf481('0x75')]['findAndCountAll'](_0x27fec8);}})[_0xf481('0x2c')](respondWithResult(_0x34937d,null))[_0xf481('0x4e')](handleError(_0x34937d,null));};exports[_0xf481('0x99')]=function(_0x29ec0b,_0x2a5bf1){return db[_0xf481('0x75')][_0xf481('0x9a')]({'where':{'ListId':null}})[_0xf481('0x2c')](handleEntityNotFound(_0x2a5bf1,null))[_0xf481('0x2c')](function(_0x233363){return _0x233363;})[_0xf481('0x2c')](respondWithResult(_0x2a5bf1,null))[_0xf481('0x4e')](handleError(_0x2a5bf1,null));};exports[_0xf481('0x9b')]=function(_0x16aa5c,_0x211098,_0x1bf1ed){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x16aa5c['params']['id']}})['then'](handleEntityNotFound(_0x211098,null))[_0xf481('0x2c')](function(_0x526bd7){if(_0x526bd7){return _0x526bd7[_0xf481('0x9b')](_0x16aa5c[_0xf481('0x53')]['ids'],_[_0xf481('0x6b')](_0x16aa5c[_0xf481('0x53')],['ids','id'])||{})[_0xf481('0x9c')](function(_0x56e23b){for(var _0x52be31=0x0;_0x52be31<_0x16aa5c[_0xf481('0x53')][_0xf481('0x65')][_0xf481('0x51')];_0x52be31+=0x1){socket[_0xf481('0x9d')](_0xf481('0x9e'),{'UserId':Number(_0x16aa5c[_0xf481('0x53')]['ids'][_0x52be31]),'CmListId':Number(_0x16aa5c[_0xf481('0x50')]['id'])});}return _0x56e23b;});}})[_0xf481('0x2c')](respondWithResult(_0x211098,null))[_0xf481('0x4e')](handleError(_0x211098,null));};exports['removeAgents']=function(_0x534283,_0xfd7067,_0x44e61b){return db[_0xf481('0x35')][_0xf481('0x52')]({'where':{'id':_0x534283['params']['id']}})['then'](handleEntityNotFound(_0xfd7067,null))[_0xf481('0x2c')](function(_0x91ba99){if(_0x91ba99){return _0x91ba99[_0xf481('0x9f')](_0x534283['query']['ids'])['then'](function(){if(_[_0xf481('0x67')](_0x534283[_0xf481('0x3b')][_0xf481('0x65')])){for(var _0x4e7e5e=0x0;_0x4e7e5e<_0x534283[_0xf481('0x3b')][_0xf481('0x65')][_0xf481('0x51')];_0x4e7e5e+=0x1){socket[_0xf481('0x9d')](_0xf481('0xa0'),{'UserId':Number(_0x534283[_0xf481('0x3b')][_0xf481('0x65')][_0x4e7e5e]),'CmListId':Number(_0x534283['params']['id'])});}}else{socket[_0xf481('0x9d')](_0xf481('0xa0'),{'UserId':Number(_0x534283['query'][_0xf481('0x65')]),'CmListId':Number(_0x534283[_0xf481('0x50')]['id'])});}});}})[_0xf481('0x2c')](respondWithStatusCode(_0xfd7067,null))[_0xf481('0x4e')](handleError(_0xfd7067,null));};exports[_0xf481('0xa1')]=function(_0x17e88f,_0x42123d,_0xdb5f7e){var _0xff43e={};var _0x4cf8e6={};var _0x21c2a0;var _0x2286d0;return db[_0xf481('0x35')][_0xf481('0x62')]({'where':{'id':_0x17e88f[_0xf481('0x50')]['id']}})[_0xf481('0x2c')](handleEntityNotFound(_0x42123d,null))['then'](function(_0x4fb59e){if(_0x4fb59e){_0x21c2a0=_0x4fb59e;_0x4cf8e6['model']=_[_0xf481('0x3c')](db[_0xf481('0xa2')][_0xf481('0x36')]);_0x4cf8e6[_0xf481('0x3b')]=_[_0xf481('0x3c')](_0x17e88f[_0xf481('0x3b')]);_0x4cf8e6[_0xf481('0x3d')]=_[_0xf481('0x3e')](_0x4cf8e6[_0xf481('0x3a')],_0x4cf8e6[_0xf481('0x3b')]);_0xff43e['attributes']=_['intersection'](_0x4cf8e6['model'],qs[_0xf481('0x40')](_0x17e88f[_0xf481('0x3b')][_0xf481('0x40')]));_0xff43e[_0xf481('0x3f')]=_0xff43e[_0xf481('0x3f')]['length']?_0xff43e['attributes']:_0x4cf8e6['model'];_0xff43e[_0xf481('0x43')]=qs[_0xf481('0x44')](_0x17e88f['query'][_0xf481('0x44')]);_0xff43e[_0xf481('0x45')]=qs[_0xf481('0x3d')](_[_0xf481('0x46')](_0x17e88f[_0xf481('0x3b')],_0x4cf8e6[_0xf481('0x3d')]));if(_0x17e88f[_0xf481('0x3b')][_0xf481('0x47')]){_0xff43e[_0xf481('0x45')]=_[_0xf481('0x48')](_0xff43e[_0xf481('0x45')],{'$or':_[_0xf481('0x34')](_0xff43e['attributes'],function(_0x41c1d1){var _0x26ca63={};_0x26ca63[_0x41c1d1]={'$like':'%'+_0x17e88f[_0xf481('0x3b')][_0xf481('0x47')]+'%'};return _0x26ca63;})});}_0xff43e=_['merge']({},_0xff43e,_0x17e88f[_0xf481('0x4a')]);return _0x21c2a0[_0xf481('0xa1')](_0xff43e);}})['then'](function(_0x264897){if(_0x264897){_0x2286d0=_0x264897['length'];if(!_0x17e88f[_0xf481('0x3b')]['hasOwnProperty'](_0xf481('0x42'))){_0xff43e[_0xf481('0x24')]=qs['limit'](_0x17e88f[_0xf481('0x3b')][_0xf481('0x24')]);_0xff43e[_0xf481('0x22')]=qs[_0xf481('0x22')](_0x17e88f[_0xf481('0x3b')][_0xf481('0x22')]);}return _0x21c2a0['getAgents'](_0xff43e);}})[_0xf481('0x2c')](function(_0x177752){if(_0x177752){return _0x177752?{'count':_0x2286d0,'rows':_0x177752}:null;}})[_0xf481('0x2c')](respondWithResult(_0x42123d,null))[_0xf481('0x4e')](handleError(_0x42123d,null));};function handleQuery(_0x14152d){logger[_0xf481('0xa3')](_0x14152d);return db['sequelize']['query'](_0x14152d)[_0xf481('0x9c')](function(_0x40f64a){csv_results[_0xf481('0x6a')](_0x40f64a);})[_0xf481('0x4e')](function(_0x3f444b){logger[_0xf481('0x5b')](_0x3f444b[_0xf481('0x6e')]);});} \ No newline at end of file +var _0x15e6=['get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','ListId','Disposition','findOne','removeDispositions','ids','addContacts','CmContact','describe','tags','isArray','join','push','success','dataValues','errors','getContacts','format','cf_%d','nolimit','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','each','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','queryInterface','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','rimraf','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy'];(function(_0xb040c,_0x4e0bd6){var _0x1aa9ff=function(_0x4ee302){while(--_0x4ee302){_0xb040c['push'](_0xb040c['shift']());}};_0x1aa9ff(++_0x4e0bd6);}(_0x15e6,0x115));var _0x615e=function(_0x3186aa,_0x34c21e){_0x3186aa=_0x3186aa-0x0;var _0x2d8c36=_0x15e6[_0x3186aa];return _0x2d8c36;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x615e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x615e('0x1'));var BPromise=require(_0x615e('0x2'));var Mustache=require(_0x615e('0x3'));var util=require(_0x615e('0x4'));var path=require(_0x615e('0x5'));var sox=require('sox');var csv=require(_0x615e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x615e('0x7'));var squel=require(_0x615e('0x8'));var crypto=require(_0x615e('0x9'));var jsforce=require(_0x615e('0xa'));var deskjs=require(_0x615e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x615e('0xc'));var Papa=require(_0x615e('0xd'));var Redis=require(_0x615e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x615e('0xf'));var as=require(_0x615e('0x10'));var hardwareService=require(_0x615e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x615e('0x12'));var config=require(_0x615e('0x13'));var licenseUtil=require(_0x615e('0x14'));var db=require(_0x615e('0x15'))['db'];var csv_results;config[_0x615e('0x16')]=_[_0x615e('0x17')](config[_0x615e('0x16')],{'host':_0x615e('0x18'),'port':0x18eb});var socket=require(_0x615e('0x19'))(new Redis(config[_0x615e('0x16')]));require(_0x615e('0x1a'))[_0x615e('0x1b')](socket);function respondWithStatusCode(_0x321c61,_0x5720ee){_0x5720ee=_0x5720ee||0xcc;return function(_0x263490){if(_0x263490){return _0x321c61[_0x615e('0x1c')](_0x5720ee);}return _0x321c61['status'](_0x5720ee)[_0x615e('0x1d')]();};}function respondWithResult(_0xaab993,_0x54e107){_0x54e107=_0x54e107||0xc8;return function(_0xdd40c6){if(_0xdd40c6){return _0xaab993[_0x615e('0x1e')](_0x54e107)[_0x615e('0x1f')](_0xdd40c6);}};}function respondWithFilteredResult(_0x264784,_0x3f3cf5){return function(_0xa4094d){if(_0xa4094d){var _0x207bee=typeof _0x3f3cf5[_0x615e('0x20')]===_0x615e('0x21')&&typeof _0x3f3cf5[_0x615e('0x22')]===_0x615e('0x21');var _0x1d7a7e=_0xa4094d['count'];var _0x1d6393=_0x207bee?0x0:_0x3f3cf5[_0x615e('0x20')];var _0x5adca8=_0x207bee?_0xa4094d[_0x615e('0x23')]:_0x3f3cf5[_0x615e('0x20')]+_0x3f3cf5[_0x615e('0x22')];var _0x564d58;if(_0x5adca8>=_0x1d7a7e){_0x5adca8=_0x1d7a7e;_0x564d58=0xc8;}else{_0x564d58=0xce;}_0x264784[_0x615e('0x1e')](_0x564d58);return _0x264784['set']('Content-Range',_0x1d6393+'-'+_0x5adca8+'/'+_0x1d7a7e)['json'](_0xa4094d);}return null;};}function patchUpdates(_0x330aef){return function(_0x2bc9a3){try{jsonpatch[_0x615e('0x24')](_0x2bc9a3,_0x330aef,!![]);}catch(_0x5487e7){return BPromise[_0x615e('0x25')](_0x5487e7);}return _0x2bc9a3[_0x615e('0x26')]();};}function saveUpdates(_0x750217,_0x364662){return function(_0x2137ef){if(_0x2137ef){return _0x2137ef['update'](_0x750217)[_0x615e('0x27')](function(_0xd287){return _0xd287;});}return null;};}function removeEntity(_0x3a5c25,_0x21fdcf){return function(_0x1bb63f){if(_0x1bb63f){return _0x1bb63f[_0x615e('0x28')]()[_0x615e('0x27')](function(){var _0x123502=_0x1bb63f[_0x615e('0x29')]({'plain':!![]});var _0x34dcca='Lists';return db[_0x615e('0x2a')][_0x615e('0x28')]({'where':{'type':_0x34dcca,'resourceId':_0x123502['id']}})[_0x615e('0x27')](function(){return _0x1bb63f;});})[_0x615e('0x27')](function(){_0x3a5c25[_0x615e('0x1e')](0xcc)[_0x615e('0x1d')]();});}};}function handleEntityNotFound(_0x4b545b,_0x16e074){return function(_0x2f9a36){if(!_0x2f9a36){_0x4b545b['sendStatus'](0x194);}return _0x2f9a36;};}function handleError(_0x392aa4,_0x1711f4){_0x1711f4=_0x1711f4||0x1f4;return function(_0x5eb0ad){logger[_0x615e('0x2b')](_0x5eb0ad[_0x615e('0x2c')]);if(_0x5eb0ad[_0x615e('0x2d')]){delete _0x5eb0ad[_0x615e('0x2d')];}_0x392aa4[_0x615e('0x1e')](_0x1711f4)[_0x615e('0x2e')](_0x5eb0ad);};}exports[_0x615e('0x2f')]=function(_0x34fbda,_0x57866d){var _0x4502c7={},_0xca939={},_0x29fb37={'count':0x0,'rows':[]};var _0x595c8e=_[_0x615e('0x30')](db[_0x615e('0x31')][_0x615e('0x32')],function(_0x30c286){return{'name':_0x30c286[_0x615e('0x33')],'type':_0x30c286['type'][_0x615e('0x34')]};});_0xca939[_0x615e('0x35')]=_[_0x615e('0x30')](_0x595c8e,_0x615e('0x2d'));_0xca939[_0x615e('0x36')]=_['keys'](_0x34fbda[_0x615e('0x36')]);_0xca939[_0x615e('0x37')]=_[_0x615e('0x38')](_0xca939['model'],_0xca939[_0x615e('0x36')]);_0x4502c7[_0x615e('0x39')]=_[_0x615e('0x38')](_0xca939[_0x615e('0x35')],qs[_0x615e('0x3a')](_0x34fbda[_0x615e('0x36')][_0x615e('0x3a')]));_0x4502c7['attributes']=_0x4502c7[_0x615e('0x39')][_0x615e('0x3b')]?_0x4502c7[_0x615e('0x39')]:_0xca939['model'];if(!_0x34fbda[_0x615e('0x36')][_0x615e('0x3c')]('nolimit')){_0x4502c7[_0x615e('0x22')]=qs[_0x615e('0x22')](_0x34fbda['query'][_0x615e('0x22')]);_0x4502c7[_0x615e('0x20')]=qs[_0x615e('0x20')](_0x34fbda[_0x615e('0x36')][_0x615e('0x20')]);}_0x4502c7[_0x615e('0x3d')]=qs[_0x615e('0x3e')](_0x34fbda['query'][_0x615e('0x3e')]);_0x4502c7[_0x615e('0x3f')]=qs['filters'](_[_0x615e('0x40')](_0x34fbda[_0x615e('0x36')],_0xca939['filters']),_0x595c8e);if(_0x34fbda['query']['filter']){_0x4502c7[_0x615e('0x3f')]=_[_0x615e('0x41')](_0x4502c7[_0x615e('0x3f')],{'$or':_[_0x615e('0x30')](_0x595c8e,function(_0x1d4a39){if(_0x1d4a39[_0x615e('0x42')]!==_0x615e('0x43')){var _0x4db1f2={};_0x4db1f2[_0x1d4a39[_0x615e('0x2d')]]={'$like':'%'+_0x34fbda[_0x615e('0x36')][_0x615e('0x44')]+'%'};return _0x4db1f2;}})});}_0x4502c7=_[_0x615e('0x41')]({},_0x4502c7,_0x34fbda[_0x615e('0x45')]);var _0x3a7945={'where':_0x4502c7[_0x615e('0x3f')]};return db[_0x615e('0x31')][_0x615e('0x23')](_0x3a7945)[_0x615e('0x27')](function(_0x49fbfd){_0x29fb37[_0x615e('0x23')]=_0x49fbfd;if(_0x34fbda[_0x615e('0x36')][_0x615e('0x46')]){_0x4502c7[_0x615e('0x47')]=[{'all':!![]}];}return db[_0x615e('0x31')][_0x615e('0x48')](_0x4502c7);})['then'](function(_0x12a23e){_0x29fb37[_0x615e('0x49')]=_0x12a23e;return _0x29fb37;})[_0x615e('0x27')](respondWithFilteredResult(_0x57866d,_0x4502c7))[_0x615e('0x4a')](handleError(_0x57866d,null));};exports[_0x615e('0x4b')]=function(_0x4d02a1,_0x211c99){var _0x157dc3={'raw':![],'where':{'id':_0x4d02a1[_0x615e('0x4c')]['id']}},_0x1e14ce={};_0x1e14ce[_0x615e('0x35')]=_['keys'](db[_0x615e('0x31')]['rawAttributes']);_0x1e14ce[_0x615e('0x36')]=_[_0x615e('0x4d')](_0x4d02a1[_0x615e('0x36')]);_0x1e14ce[_0x615e('0x37')]=_[_0x615e('0x38')](_0x1e14ce[_0x615e('0x35')],_0x1e14ce[_0x615e('0x36')]);_0x157dc3[_0x615e('0x39')]=_[_0x615e('0x38')](_0x1e14ce[_0x615e('0x35')],qs[_0x615e('0x3a')](_0x4d02a1[_0x615e('0x36')][_0x615e('0x3a')]));_0x157dc3[_0x615e('0x39')]=_0x157dc3[_0x615e('0x39')][_0x615e('0x3b')]?_0x157dc3['attributes']:_0x1e14ce[_0x615e('0x35')];if(_0x4d02a1[_0x615e('0x36')]['includeAll']){_0x157dc3[_0x615e('0x47')]=[{'all':!![]}];}_0x157dc3=_[_0x615e('0x41')]({},_0x157dc3,_0x4d02a1[_0x615e('0x45')]);return db['CmList']['find'](_0x157dc3)[_0x615e('0x27')](handleEntityNotFound(_0x211c99,null))['then'](respondWithResult(_0x211c99,null))[_0x615e('0x4a')](handleError(_0x211c99,null));};exports['create']=function(_0x257eca,_0x5ed778){return db[_0x615e('0x31')][_0x615e('0x4e')](_0x257eca['body'],{})[_0x615e('0x27')](function(_0xc8a00){var _0x34e757=_0x257eca[_0x615e('0x4f')]['get']({'plain':!![]});if(!_0x34e757)throw new Error(_0x615e('0x50'));if(_0x34e757[_0x615e('0x51')]===_0x615e('0x4f')){var _0x272fed=_0xc8a00['get']({'plain':!![]});var _0x1cd07d=_0x615e('0x52');return db['UserProfileSection'][_0x615e('0x53')]({'where':{'name':_0x1cd07d,'userProfileId':_0x34e757[_0x615e('0x54')]},'raw':!![]})['then'](function(_0x47188b){if(_0x47188b&&_0x47188b[_0x615e('0x55')]===0x0){return db[_0x615e('0x2a')][_0x615e('0x4e')]({'name':_0x272fed[_0x615e('0x2d')],'resourceId':_0x272fed['id'],'type':_0x47188b[_0x615e('0x2d')],'sectionId':_0x47188b['id']},{})[_0x615e('0x27')](function(){return _0xc8a00;});}else{return _0xc8a00;}})[_0x615e('0x4a')](function(_0x29a235){logger[_0x615e('0x2b')](_0x615e('0x56'),_0x29a235);throw _0x29a235;});}return _0xc8a00;})[_0x615e('0x27')](respondWithResult(_0x5ed778,0xc9))[_0x615e('0x4a')](handleError(_0x5ed778,null));};exports[_0x615e('0x57')]=function(_0x47f8c4,_0x1ad478){if(_0x47f8c4[_0x615e('0x58')]['id']){delete _0x47f8c4[_0x615e('0x58')]['id'];}return db['CmList'][_0x615e('0x53')]({'where':{'id':_0x47f8c4[_0x615e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ad478,null))[_0x615e('0x27')](saveUpdates(_0x47f8c4[_0x615e('0x58')],null))[_0x615e('0x27')](respondWithResult(_0x1ad478,null))['catch'](handleError(_0x1ad478,null));};exports['destroy']=function(_0x553215,_0x1c719a){return db[_0x615e('0x31')][_0x615e('0x53')]({'where':{'id':_0x553215['params']['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x1c719a,null))[_0x615e('0x27')](removeEntity(_0x1c719a,null))['catch'](handleError(_0x1c719a,null));};exports['describe']=function(_0x50aa4b,_0x5a0801){return db[_0x615e('0x31')]['describe']()[_0x615e('0x27')](respondWithResult(_0x5a0801,null))[_0x615e('0x4a')](handleError(_0x5a0801,null));};exports['addDisposition']=function(_0x5e0570,_0x485457,_0x4c2046){if(_0x5e0570[_0x615e('0x58')]['id']){delete _0x5e0570[_0x615e('0x58')]['id'];}return db[_0x615e('0x31')][_0x615e('0x53')]({'where':{'id':_0x5e0570[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x485457,null))[_0x615e('0x27')](function(_0x3fa771){if(_0x3fa771){_0x5e0570[_0x615e('0x58')][_0x615e('0x59')]=_0x3fa771['id'];return db[_0x615e('0x5a')]['create'](_0x5e0570[_0x615e('0x58')]);}})[_0x615e('0x27')](respondWithResult(_0x485457,null))['catch'](handleError(_0x485457,null));};exports['getDispositions']=function(_0xc71f8f,_0x300063,_0x96aeb4){var _0x10ee12={'raw':![],'where':{}};var _0x361a08={};var _0x2a928d={'count':0x0,'rows':[]};return db[_0x615e('0x31')][_0x615e('0x5b')]({'where':{'id':_0xc71f8f['params']['id']}})['then'](handleEntityNotFound(_0x300063,null))['then'](function(_0x2c3982){if(_0x2c3982){_0x361a08[_0x615e('0x35')]=_[_0x615e('0x4d')](db[_0x615e('0x5a')][_0x615e('0x32')]);_0x361a08[_0x615e('0x36')]=_[_0x615e('0x4d')](_0xc71f8f[_0x615e('0x36')]);_0x361a08[_0x615e('0x37')]=_[_0x615e('0x38')](_0x361a08[_0x615e('0x35')],_0x361a08['query']);_0x10ee12[_0x615e('0x39')]=_[_0x615e('0x38')](_0x361a08['model'],qs[_0x615e('0x3a')](_0xc71f8f['query'][_0x615e('0x3a')]));_0x10ee12[_0x615e('0x39')]=_0x10ee12['attributes'][_0x615e('0x3b')]?_0x10ee12['attributes']:_0x361a08[_0x615e('0x35')];if(!_0xc71f8f['query'][_0x615e('0x3c')]('nolimit')){_0x10ee12[_0x615e('0x22')]=qs[_0x615e('0x22')](_0xc71f8f[_0x615e('0x36')]['limit']);_0x10ee12['offset']=qs[_0x615e('0x20')](_0xc71f8f[_0x615e('0x36')]['offset']);}_0x10ee12[_0x615e('0x3d')]=qs[_0x615e('0x3e')](_0xc71f8f['query']['sort']);_0x10ee12[_0x615e('0x3f')]=qs['filters'](_[_0x615e('0x40')](_0xc71f8f[_0x615e('0x36')],_0x361a08['filters']));_0x10ee12['where'][_0x615e('0x59')]=_0x2c3982['id'];if(_0xc71f8f[_0x615e('0x36')][_0x615e('0x44')]){_0x10ee12['where']=_[_0x615e('0x41')](_0x10ee12[_0x615e('0x3f')],{'$or':_[_0x615e('0x30')](_0x10ee12[_0x615e('0x39')],function(_0x15b00f){var _0x15c98c={};_0x15c98c[_0x15b00f]={'$like':'%'+_0xc71f8f[_0x615e('0x36')][_0x615e('0x44')]+'%'};return _0x15c98c;})});}_0x10ee12=_[_0x615e('0x41')]({},_0x10ee12,_0xc71f8f['options']);return db[_0x615e('0x5a')][_0x615e('0x23')]({'where':_0x10ee12[_0x615e('0x3f')]})[_0x615e('0x27')](function(_0x50e2e3){_0x2a928d['count']=_0x50e2e3;if(_0xc71f8f[_0x615e('0x36')][_0x615e('0x46')]){_0x10ee12[_0x615e('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x615e('0x48')](_0x10ee12);})['then'](function(_0x2405b0){_0x2a928d['rows']=_0x2405b0;return _0x2a928d;});}})[_0x615e('0x27')](respondWithFilteredResult(_0x300063,_0x10ee12))[_0x615e('0x4a')](handleError(_0x300063,null));};exports['removeDispositions']=function(_0x290ae9,_0x30ca4b,_0xda7d2c){return db[_0x615e('0x31')][_0x615e('0x53')]({'where':{'id':_0x290ae9['params']['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x30ca4b,null))[_0x615e('0x27')](function(_0x1d535e){if(_0x1d535e){return _0x1d535e[_0x615e('0x5c')](_0x290ae9[_0x615e('0x36')][_0x615e('0x5d')]);}})[_0x615e('0x27')](respondWithStatusCode(_0x30ca4b,null))['catch'](handleError(_0x30ca4b,null));};exports[_0x615e('0x5e')]=function(_0x1d802a,_0x27ca74,_0x32685d){return db[_0x615e('0x31')]['find']({'where':{'id':_0x1d802a[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x27ca74,null))[_0x615e('0x27')](function(_0x18fc1d){if(_0x18fc1d){var _0x53c1f5=[];var _0x44a3e8={'success':[],'errors':[]};return db[_0x615e('0x5f')][_0x615e('0x60')]()[_0x615e('0x27')](function(_0xe16c41){if(_0x1d802a[_0x615e('0x58')][_0x615e('0x61')]&&_[_0x615e('0x62')](_0x1d802a['body'][_0x615e('0x61')])){if(_0x1d802a['body']['tags'][_0x615e('0x3b')]){_0x1d802a[_0x615e('0x58')][_0x615e('0x61')]=_0x1d802a[_0x615e('0x58')][_0x615e('0x61')][_0x615e('0x63')](';')+';';}else{_0x1d802a['body'][_0x615e('0x61')]=null;}}else{_0x1d802a[_0x615e('0x58')]['tags']=null;}if(_0x1d802a[_0x615e('0x58')]&&_[_0x615e('0x62')](_0x1d802a[_0x615e('0x58')])){for(var _0x23f176=0x0;_0x23f176<_0x1d802a[_0x615e('0x58')][_0x615e('0x3b')];_0x23f176+=0x1){_0x1d802a['body'][_0x23f176][_0x615e('0x59')]=_0x1d802a[_0x615e('0x4c')]['id'];_0x53c1f5[_0x615e('0x64')](_0x1d802a[_0x615e('0x58')][_0x23f176]);}return BPromise['each'](_0x53c1f5,function(_0x4fad27){return db[_0x615e('0x5f')][_0x615e('0x4e')](_['omit'](_0x4fad27,[_0x615e('0x5d'),'id'])||{},{'fields':_[_0x615e('0x4d')](_0xe16c41),'raw':!![]})[_0x615e('0x27')](function(_0x36d8c9){_0x44a3e8[_0x615e('0x65')][_0x615e('0x64')](_0x36d8c9[_0x615e('0x66')]);})[_0x615e('0x4a')](function(_0x51ee9f){_0x44a3e8[_0x615e('0x67')][_0x615e('0x64')]({'data':_0x4fad27,'error':_0x51ee9f['message']});});})[_0x615e('0x27')](function(_0x3113ed){return _0x44a3e8;})[_0x615e('0x4a')](function(_0x308b71){return _0x308b71;});}else{_0x27ca74[_0x615e('0x1e')](0x190)[_0x615e('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x27ca74,null))[_0x615e('0x4a')](handleError(_0x27ca74,null));};exports[_0x615e('0x68')]=function(_0x4cc962,_0x32f4fb,_0x110d50){var _0x93ba9d;return db[_0x615e('0x31')][_0x615e('0x53')]({'where':{'id':_0x4cc962[_0x615e('0x4c')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x615e('0x27')](handleEntityNotFound(_0x32f4fb,null))[_0x615e('0x27')](function(_0x2c8ce2){if(_0x2c8ce2){_0x93ba9d=_0x2c8ce2;return db[_0x615e('0x5f')]['rawAttributes'];}})['then'](function(_0x8f799a){if(_0x8f799a){var _0x2ce96f={};var _0x5600b4={};_0x5600b4['model']=_['concat'](_[_0x615e('0x4d')](_0x8f799a),_[_0x615e('0x30')](_0x93ba9d['CustomFields'],function(_0x1195f4){return util[_0x615e('0x69')](_0x615e('0x6a'),_0x1195f4['id']);}));_0x5600b4['query']=_[_0x615e('0x4d')](_0x4cc962['query']);_0x5600b4[_0x615e('0x37')]=_['intersection'](_0x5600b4[_0x615e('0x35')],_0x5600b4[_0x615e('0x36')]);_0x2ce96f[_0x615e('0x39')]=_[_0x615e('0x38')](_0x5600b4['model'],qs[_0x615e('0x3a')](_0x4cc962['query']['fields']));_0x2ce96f[_0x615e('0x39')]=_0x2ce96f[_0x615e('0x39')][_0x615e('0x3b')]?_0x2ce96f[_0x615e('0x39')]:_0x5600b4[_0x615e('0x35')];if(!_0x4cc962[_0x615e('0x36')][_0x615e('0x3c')](_0x615e('0x6b'))){_0x2ce96f[_0x615e('0x22')]=qs[_0x615e('0x22')](_0x4cc962[_0x615e('0x36')][_0x615e('0x22')]);_0x2ce96f[_0x615e('0x20')]=qs[_0x615e('0x20')](_0x4cc962[_0x615e('0x36')][_0x615e('0x20')]);}_0x2ce96f[_0x615e('0x3d')]=qs['sort'](_0x4cc962[_0x615e('0x36')][_0x615e('0x3e')]);_0x2ce96f[_0x615e('0x3f')]=qs[_0x615e('0x37')](_['pick'](_0x4cc962[_0x615e('0x36')],_0x5600b4[_0x615e('0x37')]));_0x2ce96f[_0x615e('0x6c')]=!![];if(_0x4cc962[_0x615e('0x36')][_0x615e('0x44')]){_0x2ce96f[_0x615e('0x3f')]=_[_0x615e('0x41')](_0x2ce96f['where'],{'$or':_[_0x615e('0x30')](_0x2ce96f[_0x615e('0x39')],function(_0xa91d95){var _0x34027b={};_0x34027b[_0xa91d95]={'$like':'%'+_0x4cc962['query'][_0x615e('0x44')]+'%'};return _0x34027b;})});}_0x2ce96f=_[_0x615e('0x41')]({},_0x2ce96f,_0x4cc962[_0x615e('0x45')]);return _0x93ba9d[_0x615e('0x68')](_0x2ce96f);}})['then'](respondWithResult(_0x32f4fb,null))[_0x615e('0x4a')](handleError(_0x32f4fb,null));};exports[_0x615e('0x6d')]=function(_0x2a7058,_0x366e0a,_0x30dc6f){var _0x5718ee;var _0x4d2b6a;var _0x2ce28f;var _0x54f05f=_0x2a7058['params']['id'];csv_results=[];return db[_0x615e('0x6e')][_0x615e('0x48')]({'attributes':['id',_0x615e('0x2d')],'raw':!![],'order':[_0x615e('0x6f')]})[_0x615e('0x27')](function(_0x402bc5){_0x5718ee=_0x402bc5;var _0x57f3fc=_[_0x615e('0x4d')](db[_0x615e('0x5f')][_0x615e('0x32')]);return db[_0x615e('0x70')][_0x615e('0x48')]({'raw':!![],'attributes':['id',_0x615e('0x71')]})[_0x615e('0x27')](function(_0x48009b){_0x4d2b6a=_0x48009b;var _0x6372d=squel[_0x615e('0x72')]()[_0x615e('0x3a')](_0x57f3fc)[_0x615e('0x73')](_0x615e('0x74'),'c')[_0x615e('0x3f')](_0x615e('0x75'),_0x54f05f)['where'](_0x615e('0x76'))['distinct']();for(var _0x42ed9b=0x0;_0x42ed9b<_0x4d2b6a[_0x615e('0x3b')];_0x42ed9b++){_0x6372d[_0x615e('0x77')](_0x615e('0x78')+_0x4d2b6a[_0x42ed9b]['id'],_0x615e('0x79')+_0x4d2b6a[_0x42ed9b][_0x615e('0x71')]);}for(var _0x42ed9b=0x0;_0x42ed9b<_0x5718ee[_0x615e('0x3b')];_0x42ed9b++){_0x6372d[_0x615e('0x77')](squel[_0x615e('0x72')]()[_0x615e('0x77')](_0x615e('0x7a'))[_0x615e('0x73')]('cm_contact_has_items')[_0x615e('0x3f')](_0x615e('0x7b'),_0x5718ee[_0x42ed9b]['id'])[_0x615e('0x3f')](_0x615e('0x7c')),'additionalPhone_'+_0x5718ee[_0x42ed9b][_0x615e('0x2d')]);_0x6372d[_0x615e('0x77')](squel[_0x615e('0x72')]()['field'](_0x615e('0x7d'))[_0x615e('0x73')]('cm_contact_has_items')[_0x615e('0x3f')](_0x615e('0x7b'),_0x5718ee[_0x42ed9b]['id'])[_0x615e('0x3f')](_0x615e('0x7c')),'description_additionalPhone_'+_0x5718ee[_0x42ed9b][_0x615e('0x2d')]);}var _0x53eefc=[];_0x53eefc[_0x615e('0x64')](_0x6372d[_0x615e('0x7e')]());BPromise[_0x615e('0x7f')](_0x53eefc,handleQuery)[_0x615e('0x27')](function(_0x4a9ede){handleQuery(_0x6372d[_0x615e('0x7e')]());var _0xbc9e2f=csv_results[0x0];if(!_[_0x615e('0x80')](_0xbc9e2f)){var _0x1025ad=toCsv(_0xbc9e2f);var _0x12bdde=Date[_0x615e('0x81')]();fs[_0x615e('0x82')](util['format'](_0x615e('0x83'),_0x54f05f,_0x12bdde),_0x1025ad);_0x366e0a[_0x615e('0x84')](_0x615e('0x85'),'attachment;\x20filename='+util['format']('list_%d_%s.csv',_0x54f05f,_0x12bdde));_0x366e0a[_0x615e('0x84')](_0x615e('0x86'),_0x615e('0x87'));return _0x366e0a[_0x615e('0x88')](util['format'](_0x615e('0x83'),_0x54f05f,_0x12bdde));}else{return _0x366e0a['sendStatus'](0xcc);}});});});};exports[_0x615e('0x89')]=function(_0x259390,_0x36cfe4,_0x26825e){var _0x44b36f;delete _0x259390['body']['id'];return db[_0x615e('0x31')][_0x615e('0x5b')]({'where':{'id':_0x259390[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x36cfe4,null))['then'](function(_0x53ccc0){if(_0x53ccc0){return db[_0x615e('0x8a')][_0x615e('0x8b')](function(_0x42486f){return db[_0x615e('0x70')]['create'](_0x259390['body'],{'transaction':_0x42486f})[_0x615e('0x27')](function(_0x238077){_0x44b36f=_0x238077;return _0x53ccc0[_0x615e('0x8c')](_0x238077,{'transaction':_0x42486f});})[_0x615e('0x27')](function(){var _0x440564={'type':db[_0x615e('0x8d')][_0x615e('0x8e')],'transaction':_0x42486f};switch(_0x259390[_0x615e('0x58')]['type']){case _0x615e('0x8f'):_0x440564[_0x615e('0x42')]=db[_0x615e('0x8d')]['TEXT'];break;case'number':_0x440564[_0x615e('0x42')]=db['Sequelize'][_0x615e('0x90')];break;case'switch':_0x440564[_0x615e('0x42')]=db['Sequelize'][_0x615e('0x91')];_0x440564[_0x615e('0x92')]=![];break;default:}return db[_0x615e('0x8a')][_0x615e('0x93')]['addColumn'](_0x615e('0x74'),util[_0x615e('0x69')]('cf_%s',_0x44b36f['id']),_0x440564);})[_0x615e('0x27')](function(){return _0x44b36f;});});}})['then'](respondWithResult(_0x36cfe4,null))[_0x615e('0x4a')](handleError(_0x36cfe4,null));};exports[_0x615e('0x94')]=function(_0x425867,_0x3da939,_0x3e9d10){var _0x2df851={};var _0x4c8c6b={};var _0x2d7ad0;var _0x70fd59;return db['CmList'][_0x615e('0x5b')]({'where':{'id':_0x425867[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x3da939,null))[_0x615e('0x27')](function(_0x5e31e9){if(_0x5e31e9){_0x2d7ad0=_0x5e31e9;_0x4c8c6b[_0x615e('0x35')]=_[_0x615e('0x4d')](db[_0x615e('0x70')][_0x615e('0x32')]);_0x4c8c6b[_0x615e('0x36')]=_[_0x615e('0x4d')](_0x425867['query']);_0x4c8c6b[_0x615e('0x37')]=_[_0x615e('0x38')](_0x4c8c6b[_0x615e('0x35')],_0x4c8c6b[_0x615e('0x36')]);_0x2df851[_0x615e('0x39')]=_[_0x615e('0x38')](_0x4c8c6b[_0x615e('0x35')],qs[_0x615e('0x3a')](_0x425867[_0x615e('0x36')][_0x615e('0x3a')]));_0x2df851[_0x615e('0x39')]=_0x2df851[_0x615e('0x39')][_0x615e('0x3b')]?_0x2df851['attributes']:_0x4c8c6b[_0x615e('0x35')];_0x2df851[_0x615e('0x3d')]=qs['sort'](_0x425867[_0x615e('0x36')][_0x615e('0x3e')]);_0x2df851[_0x615e('0x3f')]=qs['filters'](_[_0x615e('0x40')](_0x425867[_0x615e('0x36')],_0x4c8c6b[_0x615e('0x37')]));_0x2df851['where']=_['merge'](_0x2df851[_0x615e('0x3f')],{'$or':[{'ListId':_0x5e31e9['id']},{'ListId':null}]});if(_0x425867[_0x615e('0x36')][_0x615e('0x44')]){_0x2df851[_0x615e('0x3f')]=_[_0x615e('0x41')](_0x2df851[_0x615e('0x3f')],{'$or':_['map'](_0x2df851[_0x615e('0x39')],function(_0xcd45e4){var _0x283ec1={};_0x283ec1[_0xcd45e4]={'$like':'%'+_0x425867[_0x615e('0x36')][_0x615e('0x44')]+'%'};return _0x283ec1;})});}_0x2df851=_[_0x615e('0x41')]({},_0x2df851,_0x425867[_0x615e('0x45')]);return db[_0x615e('0x70')][_0x615e('0x95')](_0x2df851);}})[_0x615e('0x27')](respondWithResult(_0x3da939,null))[_0x615e('0x4a')](handleError(_0x3da939,null));};exports[_0x615e('0x96')]=function(_0x130d2a,_0x368689){return db['CmCustomField'][_0x615e('0x95')]({'where':{'ListId':null}})[_0x615e('0x27')](handleEntityNotFound(_0x368689,null))[_0x615e('0x27')](function(_0x278184){return _0x278184;})[_0x615e('0x27')](respondWithResult(_0x368689,null))[_0x615e('0x4a')](handleError(_0x368689,null));};exports[_0x615e('0x97')]=function(_0x4ccc4b,_0x2d95ea,_0x316e47){return db[_0x615e('0x31')][_0x615e('0x53')]({'where':{'id':_0x4ccc4b[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x2d95ea,null))[_0x615e('0x27')](function(_0x4be493){if(_0x4be493){return _0x4be493[_0x615e('0x97')](_0x4ccc4b[_0x615e('0x58')][_0x615e('0x5d')],_[_0x615e('0x98')](_0x4ccc4b[_0x615e('0x58')],[_0x615e('0x5d'),'id'])||{})[_0x615e('0x99')](function(_0x4603c5){for(var _0x53fe55=0x0;_0x53fe55<_0x4ccc4b['body']['ids'][_0x615e('0x3b')];_0x53fe55+=0x1){socket['emit'](_0x615e('0x9a'),{'UserId':Number(_0x4ccc4b[_0x615e('0x58')][_0x615e('0x5d')][_0x53fe55]),'CmListId':Number(_0x4ccc4b[_0x615e('0x4c')]['id'])});}return _0x4603c5;});}})[_0x615e('0x27')](respondWithResult(_0x2d95ea,null))['catch'](handleError(_0x2d95ea,null));};exports['removeAgents']=function(_0x3c73df,_0x55c38c,_0x5c0d3a){return db['CmList'][_0x615e('0x53')]({'where':{'id':_0x3c73df[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x55c38c,null))[_0x615e('0x27')](function(_0x2b0f00){if(_0x2b0f00){return _0x2b0f00[_0x615e('0x9b')](_0x3c73df[_0x615e('0x36')][_0x615e('0x5d')])[_0x615e('0x27')](function(){if(_[_0x615e('0x62')](_0x3c73df[_0x615e('0x36')][_0x615e('0x5d')])){for(var _0x19ab5c=0x0;_0x19ab5c<_0x3c73df['query'][_0x615e('0x5d')][_0x615e('0x3b')];_0x19ab5c+=0x1){socket[_0x615e('0x9c')](_0x615e('0x9d'),{'UserId':Number(_0x3c73df[_0x615e('0x36')][_0x615e('0x5d')][_0x19ab5c]),'CmListId':Number(_0x3c73df[_0x615e('0x4c')]['id'])});}}else{socket[_0x615e('0x9c')]('userCmList:remove',{'UserId':Number(_0x3c73df['query'][_0x615e('0x5d')]),'CmListId':Number(_0x3c73df['params']['id'])});}});}})['then'](respondWithStatusCode(_0x55c38c,null))['catch'](handleError(_0x55c38c,null));};exports['getAgents']=function(_0x552814,_0x1819cc,_0x45dede){var _0x1b07f={};var _0x2b3063={};var _0x3b88d7;var _0x37d03b;return db['CmList']['findOne']({'where':{'id':_0x552814[_0x615e('0x4c')]['id']}})[_0x615e('0x27')](handleEntityNotFound(_0x1819cc,null))[_0x615e('0x27')](function(_0x4e7150){if(_0x4e7150){_0x3b88d7=_0x4e7150;_0x2b3063['model']=_[_0x615e('0x4d')](db['User'][_0x615e('0x32')]);_0x2b3063[_0x615e('0x36')]=_['keys'](_0x552814['query']);_0x2b3063[_0x615e('0x37')]=_['intersection'](_0x2b3063[_0x615e('0x35')],_0x2b3063[_0x615e('0x36')]);_0x1b07f[_0x615e('0x39')]=_[_0x615e('0x38')](_0x2b3063['model'],qs[_0x615e('0x3a')](_0x552814['query'][_0x615e('0x3a')]));_0x1b07f[_0x615e('0x39')]=_0x1b07f['attributes'][_0x615e('0x3b')]?_0x1b07f['attributes']:_0x2b3063[_0x615e('0x35')];_0x1b07f['order']=qs[_0x615e('0x3e')](_0x552814[_0x615e('0x36')][_0x615e('0x3e')]);_0x1b07f[_0x615e('0x3f')]=qs[_0x615e('0x37')](_[_0x615e('0x40')](_0x552814['query'],_0x2b3063[_0x615e('0x37')]));if(_0x552814['query'][_0x615e('0x44')]){_0x1b07f[_0x615e('0x3f')]=_[_0x615e('0x41')](_0x1b07f['where'],{'$or':_[_0x615e('0x30')](_0x1b07f[_0x615e('0x39')],function(_0x299d4b){var _0x4f61d2={};_0x4f61d2[_0x299d4b]={'$like':'%'+_0x552814[_0x615e('0x36')]['filter']+'%'};return _0x4f61d2;})});}_0x1b07f=_[_0x615e('0x41')]({},_0x1b07f,_0x552814[_0x615e('0x45')]);return _0x3b88d7[_0x615e('0x9e')](_0x1b07f);}})['then'](function(_0x40f649){if(_0x40f649){_0x37d03b=_0x40f649['length'];if(!_0x552814[_0x615e('0x36')][_0x615e('0x3c')](_0x615e('0x6b'))){_0x1b07f[_0x615e('0x22')]=qs[_0x615e('0x22')](_0x552814[_0x615e('0x36')][_0x615e('0x22')]);_0x1b07f[_0x615e('0x20')]=qs[_0x615e('0x20')](_0x552814['query'][_0x615e('0x20')]);}return _0x3b88d7['getAgents'](_0x1b07f);}})[_0x615e('0x27')](function(_0x538407){if(_0x538407){return _0x538407?{'count':_0x37d03b,'rows':_0x538407}:null;}})[_0x615e('0x27')](respondWithResult(_0x1819cc,null))[_0x615e('0x4a')](handleError(_0x1819cc,null));};function handleQuery(_0x234bee){logger['info'](_0x234bee);return db['sequelize']['query'](_0x234bee)['spread'](function(_0x2e45b9){csv_results[_0x615e('0x64')](_0x2e45b9);})[_0x615e('0x4a')](function(_0xa80fbd){logger[_0x615e('0x2b')](_0xa80fbd['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cac474c..dc6612f 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x339c23,_0x541ff6){var _0x5bf134=function(_0x46c91d){while(--_0x46c91d){_0x339c23['push'](_0x339c23['shift']());}};_0x5bf134(++_0x541ff6);}(_0x814b,0x1a2));var _0xb814=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x814b[_0x5bd626];return _0x2661ca;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0x814b,0x1a2));var _0xb814=function(_0x188945,_0x2aafa5){_0x188945=_0x188945-0x0;var _0x4959c2=_0x814b[_0x188945];return _0x4959c2;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index eb0ca28..17d77af 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 _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x4d7f56,_0x441449){var _0x386fb2=function(_0x439d47){while(--_0x439d47){_0x4d7f56['push'](_0x4d7f56['shift']());}};_0x386fb2(++_0x441449);}(_0x3c81,0x102));var _0x13c8=function(_0x2814d5,_0x5afdf0){_0x2814d5=_0x2814d5-0x0;var _0x39ce11=_0x3c81[_0x2814d5];return _0x39ce11;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('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(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb58b=['CmList','cm_lists','util','../../config/logger','api','bluebird','request-promise','rimraf','./cmList.attributes','exports','define'];(function(_0x150792,_0x187824){var _0x5f2974=function(_0x2791d5){while(--_0x2791d5){_0x150792['push'](_0x150792['shift']());}};_0x5f2974(++_0x187824);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3334d3,_0x231fa5){_0x3334d3=_0x3334d3-0x0;var _0x3991e9=_0xb58b[_0x3334d3];return _0x3991e9;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('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 a05a6cd..4cc9ae8 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 _0x1103=['socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x4292a6,_0x793564){var _0x2a1133=function(_0x212c6c){while(--_0x212c6c){_0x4292a6['push'](_0x4292a6['shift']());}};_0x2a1133(++_0x793564);}(_0x1103,0xf8));var _0x3110=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1103[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3110('0x0'));var moment=require(_0x3110('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3110('0x2'))['db'];var utils=require(_0x3110('0x3'));var logger=require(_0x3110('0x4'))(_0x3110('0x5'));var config=require(_0x3110('0x6'));var jayson=require(_0x3110('0x7'));var client=jayson[_0x3110('0x8')][_0x3110('0x9')]({'port':0x232a});config[_0x3110('0xa')]=_['defaults'](config[_0x3110('0xa')],{'host':_0x3110('0xb'),'port':0x18eb});var socket=require(_0x3110('0xc'))(new Redis(config[_0x3110('0xa')]));require(_0x3110('0xd'))[_0x3110('0xe')](socket);function respondWithRpcPromise(_0x49d951,_0x161bd4,_0x24db9e){return new BPromise(function(_0x531678,_0x2d4e07){return client['request'](_0x49d951,_0x24db9e)[_0x3110('0xf')](function(_0x52c60c){logger[_0x3110('0x10')](_0x3110('0x11'),_0x161bd4,_0x3110('0x12'));logger[_0x3110('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x161bd4,_0x3110('0x12'),JSON[_0x3110('0x14')](_0x52c60c));if(_0x52c60c[_0x3110('0x15')]){if(_0x52c60c[_0x3110('0x15')][_0x3110('0x16')]===0x1f4){logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x52c60c['error'][_0x3110('0x17')]);return _0x2d4e07(_0x52c60c[_0x3110('0x15')][_0x3110('0x17')]);}logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x52c60c[_0x3110('0x15')][_0x3110('0x17')]);return _0x531678(_0x52c60c['error']['message']);}else{logger[_0x3110('0x10')]('CmList,\x20%s,\x20%s',_0x161bd4,_0x3110('0x12'));_0x531678(_0x52c60c[_0x3110('0x18')][_0x3110('0x17')]);}})[_0x3110('0x19')](function(_0x414e87){logger[_0x3110('0x15')](_0x3110('0x11'),_0x161bd4,_0x414e87);_0x2d4e07(_0x414e87);});});} \ No newline at end of file +var _0x2799=['result','catch','lodash','util','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message'];(function(_0x447629,_0x4747f0){var _0x122f8b=function(_0x276ac9){while(--_0x276ac9){_0x447629['push'](_0x447629['shift']());}};_0x122f8b(++_0x4747f0);}(_0x2799,0xda));var _0x9279=function(_0x30d8c0,_0x3957b9){_0x30d8c0=_0x30d8c0-0x0;var _0x46945c=_0x2799[_0x30d8c0];return _0x46945c;};'use strict';var _=require(_0x9279('0x0'));var util=require(_0x9279('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9279('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9279('0x3'));var logger=require('../../config/logger')(_0x9279('0x4'));var config=require('../../config/environment');var jayson=require(_0x9279('0x5'));var client=jayson[_0x9279('0x6')][_0x9279('0x7')]({'port':0x232a});config[_0x9279('0x8')]=_[_0x9279('0x9')](config[_0x9279('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9279('0xa'))(new Redis(config[_0x9279('0x8')]));require(_0x9279('0xb'))[_0x9279('0xc')](socket);function respondWithRpcPromise(_0x551b62,_0x5a837e,_0x379b3e){return new BPromise(function(_0x500dcc,_0x6d3d29){return client[_0x9279('0xd')](_0x551b62,_0x379b3e)[_0x9279('0xe')](function(_0x3c0198){logger['info']('CmList,\x20%s,\x20%s',_0x5a837e,_0x9279('0xf'));logger[_0x9279('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x5a837e,'request\x20sent',JSON[_0x9279('0x11')](_0x3c0198));if(_0x3c0198['error']){if(_0x3c0198[_0x9279('0x12')][_0x9279('0x13')]===0x1f4){logger[_0x9279('0x12')](_0x9279('0x14'),_0x5a837e,_0x3c0198[_0x9279('0x12')]['message']);return _0x6d3d29(_0x3c0198['error'][_0x9279('0x15')]);}logger[_0x9279('0x12')]('CmList,\x20%s,\x20%s',_0x5a837e,_0x3c0198[_0x9279('0x12')][_0x9279('0x15')]);return _0x500dcc(_0x3c0198['error'][_0x9279('0x15')]);}else{logger['info'](_0x9279('0x14'),_0x5a837e,_0x9279('0xf'));_0x500dcc(_0x3c0198[_0x9279('0x16')][_0x9279('0x15')]);}})[_0x9279('0x17')](function(_0x4818aa){logger['error']('CmList,\x20%s,\x20%s',_0x5a837e,_0x4818aa);_0x6d3d29(_0x4818aa);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 666ca15..31e9ccb 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 _0x1838=['emit','register','length','remove','update'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1838,0xb7));var _0x8183=function(_0x43795b,_0x174d6c){_0x43795b=_0x43795b-0x0;var _0x2a0df7=_0x1838[_0x43795b];return _0x2a0df7;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x8183('0x0'),_0x8183('0x1')];function createListener(_0x4e6b59,_0xc4bdc6){return function(_0x3256e7){_0xc4bdc6[_0x8183('0x2')](_0x4e6b59,_0x3256e7);};}function removeListener(_0x423efe,_0x340f8c){return function(){CmListEvents['removeListener'](_0x423efe,_0x340f8c);};}exports[_0x8183('0x3')]=function(_0x1d55dc){for(var _0x4b6468=0x0,_0x37b38d=events[_0x8183('0x4')];_0x4b6468<_0x37b38d;_0x4b6468++){var _0x5aa06c=events[_0x4b6468];var _0x598c9a=createListener('cmList:'+_0x5aa06c,_0x1d55dc);CmListEvents['on'](_0x5aa06c,_0x598c9a);}}; \ No newline at end of file +var _0x39a0=['save','update','removeListener','length','./cmList.events'];(function(_0x1d7bdc,_0x16c868){var _0x11cb46=function(_0x2f979b){while(--_0x2f979b){_0x1d7bdc['push'](_0x1d7bdc['shift']());}};_0x11cb46(++_0x16c868);}(_0x39a0,0x1da));var _0x039a=function(_0x4511b1,_0x45a31c){_0x4511b1=_0x4511b1-0x0;var _0x38fec=_0x39a0[_0x4511b1];return _0x38fec;};'use strict';var CmListEvents=require(_0x039a('0x0'));var events=[_0x039a('0x1'),'remove',_0x039a('0x2')];function createListener(_0x4bfd22,_0x5538b){return function(_0x532b48){_0x5538b['emit'](_0x4bfd22,_0x532b48);};}function removeListener(_0x1a6d43,_0x5a4957){return function(){CmListEvents[_0x039a('0x3')](_0x1a6d43,_0x5a4957);};}exports['register']=function(_0x3f939a){for(var _0x161277=0x0,_0x1c3a13=events[_0x039a('0x4')];_0x161277<_0x1c3a13;_0x161277++){var _0xe1581=events[_0x161277];var _0x37c826=createListener('cmList:'+_0xe1581,_0x3f939a);CmListEvents['on'](_0xe1581,_0x37c826);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 05c33dc..dfe1ee4 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 _0x8dd9=['post','create','addDisposition','addContacts','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/global_fields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x8dd9,0x16b));var _0x98dd=function(_0xecad50,_0x463809){_0xecad50=_0xecad50-0x0;var _0x5cba84=_0x8dd9[_0xecad50];return _0x5cba84;};'use strict';var multer=require(_0x98dd('0x0'));var util=require(_0x98dd('0x1'));var path=require(_0x98dd('0x2'));var timeout=require('connect-timeout');var express=require(_0x98dd('0x3'));var router=express[_0x98dd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x98dd('0x5'));var config=require(_0x98dd('0x6'));var controller=require(_0x98dd('0x7'));router['get']('/',auth[_0x98dd('0x8')](),controller[_0x98dd('0x9')]);router[_0x98dd('0xa')]('/describe',auth[_0x98dd('0x8')](),controller['describe']);router['get'](_0x98dd('0xb'),auth[_0x98dd('0x8')](),controller['getGlobalCustomFields']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x98dd('0xc')]);router[_0x98dd('0xa')](_0x98dd('0xd'),auth[_0x98dd('0x8')](),controller[_0x98dd('0xe')]);router[_0x98dd('0xa')](_0x98dd('0xf'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x10')]);router[_0x98dd('0xa')](_0x98dd('0x11'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x12')]);router[_0x98dd('0xa')](_0x98dd('0x13'),auth['isAuthenticated'](),controller[_0x98dd('0x14')]);router[_0x98dd('0xa')](_0x98dd('0x15'),auth[_0x98dd('0x8')](),controller['getAgents']);router[_0x98dd('0x16')]('/',auth['isAuthenticated'](),controller[_0x98dd('0x17')]);router[_0x98dd('0x16')](_0x98dd('0xd'),auth['isAuthenticated'](),controller[_0x98dd('0x18')]);router[_0x98dd('0x16')](_0x98dd('0xf'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x19')]);router[_0x98dd('0x16')](_0x98dd('0x13'),auth[_0x98dd('0x8')](),controller['addCustomField']);router['post'](_0x98dd('0x15'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1a')]);router[_0x98dd('0x1b')](_0x98dd('0x1c'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1d')]);router[_0x98dd('0x1e')](_0x98dd('0x1c'),auth[_0x98dd('0x8')](),controller[_0x98dd('0x1f')]);router['delete'](_0x98dd('0xd'),auth['isAuthenticated'](),controller[_0x98dd('0x20')]);router[_0x98dd('0x1e')]('/:id/users',auth[_0x98dd('0x8')](),controller[_0x98dd('0x21')]);module[_0x98dd('0x22')]=router; \ No newline at end of file +var _0xb433=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','update','delete'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xb433,0x19b));var _0x3b43=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0xb433[_0x3ddb4e];return _0x16202e;};'use strict';var multer=require(_0x3b43('0x0'));var util=require(_0x3b43('0x1'));var path=require(_0x3b43('0x2'));var timeout=require(_0x3b43('0x3'));var express=require(_0x3b43('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b43('0x5'));var interaction=require(_0x3b43('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x3b43('0x7')]('/',auth[_0x3b43('0x8')](),controller[_0x3b43('0x9')]);router[_0x3b43('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x3b43('0xa')]);router[_0x3b43('0x7')](_0x3b43('0xb'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x3b43('0x7')](_0x3b43('0xc'),auth[_0x3b43('0x8')](),controller[_0x3b43('0xd')]);router[_0x3b43('0x7')](_0x3b43('0xe'),auth[_0x3b43('0x8')](),controller[_0x3b43('0xf')]);router['get'](_0x3b43('0x10'),auth[_0x3b43('0x8')](),controller[_0x3b43('0x11')]);router[_0x3b43('0x7')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x3b43('0x12')]);router['get'](_0x3b43('0x13'),auth[_0x3b43('0x8')](),controller[_0x3b43('0x14')]);router[_0x3b43('0x7')](_0x3b43('0x15'),auth[_0x3b43('0x8')](),controller[_0x3b43('0x16')]);router[_0x3b43('0x17')]('/',auth[_0x3b43('0x8')](),controller[_0x3b43('0x18')]);router[_0x3b43('0x17')](_0x3b43('0xe'),auth[_0x3b43('0x8')](),controller['addDisposition']);router['post']('/:id/contacts',auth[_0x3b43('0x8')](),controller[_0x3b43('0x19')]);router['post'](_0x3b43('0x13'),auth[_0x3b43('0x8')](),controller[_0x3b43('0x1a')]);router[_0x3b43('0x17')](_0x3b43('0x15'),auth['isAuthenticated'](),controller[_0x3b43('0x1b')]);router[_0x3b43('0x1c')]('/:id',auth[_0x3b43('0x8')](),controller[_0x3b43('0x1d')]);router[_0x3b43('0x1e')](_0x3b43('0xc'),auth['isAuthenticated'](),controller[_0x3b43('0x1f')]);router[_0x3b43('0x1e')](_0x3b43('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x3b43('0x1e')](_0x3b43('0x15'),auth[_0x3b43('0x8')](),controller[_0x3b43('0x20')]);module[_0x3b43('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index af00773..fb89bcc 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 _0x0da9=['STRING','sequelize','exports','getDataValue','field'];(function(_0x53d7eb,_0x5ca99a){var _0x2002de=function(_0x365b6c){while(--_0x365b6c){_0x53d7eb['push'](_0x53d7eb['shift']());}};_0x2002de(++_0x5ca99a);}(_0x0da9,0xfb));var _0x90da=function(_0x7ea9e0,_0x3e2a22){_0x7ea9e0=_0x7ea9e0-0x0;var _0x191073=_0x0da9[_0x7ea9e0];return _0x191073;};'use strict';var Sequelize=require(_0x90da('0x0'));module[_0x90da('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x228564){return this[_0x90da('0x2')](_0x90da('0x3'));}},'field':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x90da('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x79aa=['exports','getDataValue','STRING'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x79aa,0x1e0));var _0xa79a=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0x79aa[_0x339d45];return _0x5e4a60;};'use strict';var Sequelize=require('sequelize');module[_0xa79a('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x22d358){return this[_0xa79a('0x1')]('field');}},'field':{'type':Sequelize[_0xa79a('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xa79a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 091caf1..076f0f6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5f2dc4,_0x4c81a6){var _0x5b7333=function(_0x2ef0df){while(--_0x2ef0df){_0x5f2dc4['push'](_0x5f2dc4['shift']());}};_0x5b7333(++_0x4c81a6);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x30c0ae,_0xc2bf92){var _0x56c1b2=function(_0x2a79e6){while(--_0x2a79e6){_0x30c0ae['push'](_0x30c0ae['shift']());}};_0x56c1b2(++_0xc2bf92);}(_0x7a54,0x106));var _0x47a5=function(_0x553402,_0x4e2d10){_0x553402=_0x553402-0x0;var _0x1f4861=_0x7a54[_0x553402];return _0x1f4861;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 1b502b2..33744ea 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 _0x3ed0=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash','util'];(function(_0x451492,_0x6272fb){var _0x163af3=function(_0x37be32){while(--_0x37be32){_0x451492['push'](_0x451492['shift']());}};_0x163af3(++_0x6272fb);}(_0x3ed0,0x136));var _0x03ed=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x3ed0[_0x3d2e4b];return _0x509e78;};'use strict';var _=require(_0x03ed('0x0'));var util=require(_0x03ed('0x1'));var logger=require(_0x03ed('0x2'))('api');var moment=require(_0x03ed('0x3'));var BPromise=require(_0x03ed('0x4'));var rp=require(_0x03ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03ed('0x6'));var config=require(_0x03ed('0x7'));var attributes=require(_0x03ed('0x8'));module[_0x03ed('0x9')]=function(_0x315caf,_0x1fcae9){return _0x315caf[_0x03ed('0xa')](_0x03ed('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1c8=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xf1c8,0xf1));var _0x8f1c=function(_0x2ddcdd,_0x599f0d){_0x2ddcdd=_0x2ddcdd-0x0;var _0x18a1fa=_0xf1c8[_0x2ddcdd];return _0x18a1fa;};'use strict';var _=require(_0x8f1c('0x0'));var util=require(_0x8f1c('0x1'));var logger=require(_0x8f1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8f1c('0x3'));var rp=require(_0x8f1c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f1c('0x5'));var config=require(_0x8f1c('0x6'));var attributes=require(_0x8f1c('0x7'));module['exports']=function(_0xef0b87,_0x3e118c){return _0xef0b87[_0x8f1c('0x8')](_0x8f1c('0x9'),attributes,{'tableName':_0x8f1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 1e1a14d..d128e8e 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 _0x7d38=['debug','Condition,\x20%s,\x20%s,\x20%s','error','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x23463d,_0x2606e5){var _0x576a24=function(_0x3809fe){while(--_0x3809fe){_0x23463d['push'](_0x23463d['shift']());}};_0x576a24(++_0x2606e5);}(_0x7d38,0x8b));var _0x87d3=function(_0x2e6b0f,_0x1ff96d){_0x2e6b0f=_0x2e6b0f-0x0;var _0x49d011=_0x7d38[_0x2e6b0f];return _0x49d011;};'use strict';var _=require(_0x87d3('0x0'));var util=require(_0x87d3('0x1'));var moment=require(_0x87d3('0x2'));var BPromise=require(_0x87d3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87d3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d3('0x5'));var logger=require(_0x87d3('0x6'))(_0x87d3('0x7'));var config=require('../../config/environment');var jayson=require(_0x87d3('0x8'));var client=jayson['client'][_0x87d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19b185,_0x6eb5fa,_0x55e73b){return new BPromise(function(_0x4b45c8,_0x160174){return client[_0x87d3('0xa')](_0x19b185,_0x55e73b)['then'](function(_0x50f82d){logger[_0x87d3('0xb')]('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x87d3('0xc'));logger[_0x87d3('0xd')](_0x87d3('0xe'),_0x6eb5fa,_0x87d3('0xc'),JSON['stringify'](_0x50f82d));if(_0x50f82d[_0x87d3('0xf')]){if(_0x50f82d['error']['code']===0x1f4){logger[_0x87d3('0xf')]('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x50f82d[_0x87d3('0xf')][_0x87d3('0x10')]);return _0x160174(_0x50f82d[_0x87d3('0xf')]['message']);}logger[_0x87d3('0xf')](_0x87d3('0x11'),_0x6eb5fa,_0x50f82d['error'][_0x87d3('0x10')]);return _0x4b45c8(_0x50f82d['error']['message']);}else{logger[_0x87d3('0xb')](_0x87d3('0x11'),_0x6eb5fa,_0x87d3('0xc'));_0x4b45c8(_0x50f82d[_0x87d3('0x12')][_0x87d3('0x10')]);}})['catch'](function(_0x417f52){logger['error']('Condition,\x20%s,\x20%s',_0x6eb5fa,_0x417f52);_0x160174(_0x417f52);});});} \ No newline at end of file +var _0x95d3=['Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request\x20sent','debug','stringify','error','code'];(function(_0x345afa,_0x532793){var _0x3e3d6b=function(_0x3924b1){while(--_0x3924b1){_0x345afa['push'](_0x345afa['shift']());}};_0x3e3d6b(++_0x532793);}(_0x95d3,0xe1));var _0x395d=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x95d3[_0x1bd323];return _0x13097b;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x395d('0x2'));var fs=require('fs');var Redis=require(_0x395d('0x3'));var db=require(_0x395d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x395d('0x5'))(_0x395d('0x6'));var config=require(_0x395d('0x7'));var jayson=require(_0x395d('0x8'));var client=jayson['client'][_0x395d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52b4de,_0x4e9449,_0x179192){return new BPromise(function(_0xf2170a,_0x15ce78){return client['request'](_0x52b4de,_0x179192)['then'](function(_0x543922){logger['info']('Condition,\x20%s,\x20%s',_0x4e9449,_0x395d('0xa'));logger[_0x395d('0xb')]('Condition,\x20%s,\x20%s,\x20%s',_0x4e9449,_0x395d('0xa'),JSON[_0x395d('0xc')](_0x543922));if(_0x543922[_0x395d('0xd')]){if(_0x543922['error'][_0x395d('0xe')]===0x1f4){logger[_0x395d('0xd')](_0x395d('0xf'),_0x4e9449,_0x543922[_0x395d('0xd')][_0x395d('0x10')]);return _0x15ce78(_0x543922[_0x395d('0xd')]['message']);}logger[_0x395d('0xd')](_0x395d('0xf'),_0x4e9449,_0x543922[_0x395d('0xd')][_0x395d('0x10')]);return _0xf2170a(_0x543922[_0x395d('0xd')][_0x395d('0x10')]);}else{logger[_0x395d('0x11')](_0x395d('0xf'),_0x4e9449,_0x395d('0xa'));_0xf2170a(_0x543922[_0x395d('0x12')][_0x395d('0x10')]);}})[_0x395d('0x13')](function(_0x1a2e28){logger[_0x395d('0xd')](_0x395d('0xf'),_0x4e9449,_0x1a2e28);_0x15ce78(_0x1a2e28);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index be46963..47efca2 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 _0xcd12=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xcd12,0x150));var _0x2cd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd12[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2cd1('0x0'));var path=require('path');var timeout=require(_0x2cd1('0x1'));var express=require(_0x2cd1('0x2'));var router=express[_0x2cd1('0x3')]();var fs_extra=require(_0x2cd1('0x4'));var auth=require(_0x2cd1('0x5'));var interaction=require(_0x2cd1('0x6'));var config=require(_0x2cd1('0x7'));var controller=require(_0x2cd1('0x8'));router[_0x2cd1('0x9')]('/:id',auth[_0x2cd1('0xa')](),controller[_0x2cd1('0xb')]);router[_0x2cd1('0xc')](_0x2cd1('0xd'),auth[_0x2cd1('0xa')](),controller[_0x2cd1('0xe')]);module[_0x2cd1('0xf')]=router; \ No newline at end of file +var _0x19a5=['put','/:id','isAuthenticated','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2108cc,_0x1c5fed){var _0x49bb58=function(_0x37797a){while(--_0x37797a){_0x2108cc['push'](_0x2108cc['shift']());}};_0x49bb58(++_0x1c5fed);}(_0x19a5,0x1f4));var _0x519a=function(_0x51aea3,_0x421b1b){_0x51aea3=_0x51aea3-0x0;var _0x3447f3=_0x19a5[_0x51aea3];return _0x3447f3;};'use strict';var multer=require('multer');var util=require(_0x519a('0x0'));var path=require(_0x519a('0x1'));var timeout=require(_0x519a('0x2'));var express=require(_0x519a('0x3'));var router=express[_0x519a('0x4')]();var fs_extra=require(_0x519a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x519a('0x6'));var controller=require('./condition.controller');router[_0x519a('0x7')](_0x519a('0x8'),auth[_0x519a('0x9')](),controller[_0x519a('0xa')]);router[_0x519a('0xb')](_0x519a('0x8'),auth[_0x519a('0x9')](),controller[_0x519a('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 9e993fe..e543f92 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 _0x6149=['sequelize','exports','STRING','name','INTEGER'];(function(_0x1b89ba,_0x550bed){var _0x1b14b8=function(_0x354465){while(--_0x354465){_0x1b89ba['push'](_0x1b89ba['shift']());}};_0x1b14b8(++_0x550bed);}(_0x6149,0xaa));var _0x9614=function(_0x4d24f5,_0x2b0651){_0x4d24f5=_0x4d24f5-0x0;var _0x517ae3=_0x6149[_0x4d24f5];return _0x517ae3;};'use strict';var Sequelize=require(_0x9614('0x0'));module[_0x9614('0x1')]={'name':{'type':Sequelize[_0x9614('0x2')],'allowNull':![],'unique':_0x9614('0x3')},'OrderBy':{'type':Sequelize[_0x9614('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9614('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9e42=['STRING','name','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9e42,0x6e));var _0x29e4=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x9e42[_0x1e500e];return _0x10dc5e;};'use strict';var Sequelize=require(_0x29e4('0x0'));module['exports']={'name':{'type':Sequelize[_0x29e4('0x1')],'allowNull':![],'unique':_0x29e4('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x29e4('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 76693c1..d92d81a 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 _0xe511=['save','update','then','get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','body','destroy','CmContactHasItem','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range'];(function(_0x52acb,_0x19c7c1){var _0x3c4226=function(_0x317772){while(--_0x317772){_0x52acb['push'](_0x52acb['shift']());}};_0x3c4226(++_0x19c7c1);}(_0xe511,0x16f));var _0x1e51=function(_0x3cb300,_0x4d7a99){_0x3cb300=_0x3cb300-0x0;var _0x3e0cd9=_0xe511[_0x3cb300];return _0x3e0cd9;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':!![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x22')]=function(_0x213edb,_0x177b63){if(_0x213edb[_0x1e51('0x4d')]['id']){delete _0x213edb['body']['id'];}return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x213edb['params']['id']}})['then'](handleEntityNotFound(_0x177b63,null))[_0x1e51('0x23')](saveUpdates(_0x213edb[_0x1e51('0x4d')],null))[_0x1e51('0x23')](respondWithResult(_0x177b63,null))['catch'](handleError(_0x177b63,null));};exports[_0x1e51('0x4e')]=function(_0x133576,_0x36c981){return db['ContactItemType'][_0x1e51('0x46')]({'where':{'id':_0x133576[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x36c981,null))['then'](db[_0x1e51('0x4f')][_0x1e51('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x133576[_0x1e51('0x45')]['id']}}))[_0x1e51('0x23')](removeEntity(_0x36c981,null))[_0x1e51('0x4c')](handleError(_0x36c981,null));}; \ No newline at end of file +var _0x8e3f=['model','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','error','name','send','map','ContactItemType','fieldName','query','keys','filters','attributes','intersection'];(function(_0x1743e4,_0x4c4e0c){var _0x46112e=function(_0x30fef1){while(--_0x30fef1){_0x1743e4['push'](_0x1743e4['shift']());}};_0x46112e(++_0x4c4e0c);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){var _0x512a83=_0x2dc856[_0xf8e3('0x2a')]({'plain':!![]});var _0x2fc674=_0xf8e3('0x2b');return db[_0xf8e3('0x2c')][_0xf8e3('0x28')]({'where':{'type':_0x2fc674,'resourceId':_0x512a83['id']}})[_0xf8e3('0x29')](function(){return _0x2dc856;});})[_0xf8e3('0x29')](function(){_0x225a1b[_0xf8e3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x356e0a,_0x3d5a27){return function(_0x12ebd2){if(!_0x12ebd2){_0x356e0a[_0xf8e3('0x1a')](0x194);}return _0x12ebd2;};}function handleError(_0x15b28c,_0x14cb5a){_0x14cb5a=_0x14cb5a||0x1f4;return function(_0x16485e){logger[_0xf8e3('0x2d')](_0x16485e['stack']);if(_0x16485e[_0xf8e3('0x2e')]){delete _0x16485e[_0xf8e3('0x2e')];}_0x15b28c[_0xf8e3('0x1c')](_0x14cb5a)[_0xf8e3('0x2f')](_0x16485e);};}exports['index']=function(_0x2e507c,_0x10cf28){var _0x40f64d={},_0x45df49={},_0x33f208={'count':0x0,'rows':[]};var _0x46c85d=_[_0xf8e3('0x30')](db[_0xf8e3('0x31')]['rawAttributes'],function(_0x2c07bf){return{'name':_0x2c07bf[_0xf8e3('0x32')],'type':_0x2c07bf['type']['key']};});_0x45df49['model']=_[_0xf8e3('0x30')](_0x46c85d,'name');_0x45df49[_0xf8e3('0x33')]=_[_0xf8e3('0x34')](_0x2e507c[_0xf8e3('0x33')]);_0x45df49[_0xf8e3('0x35')]=_['intersection'](_0x45df49['model'],_0x45df49[_0xf8e3('0x33')]);_0x40f64d[_0xf8e3('0x36')]=_[_0xf8e3('0x37')](_0x45df49[_0xf8e3('0x38')],qs[_0xf8e3('0x39')](_0x2e507c[_0xf8e3('0x33')]['fields']));_0x40f64d[_0xf8e3('0x36')]=_0x40f64d['attributes']['length']?_0x40f64d[_0xf8e3('0x36')]:_0x45df49[_0xf8e3('0x38')];if(!_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x3a')]('nolimit')){_0x40f64d['limit']=qs[_0xf8e3('0x1e')](_0x2e507c[_0xf8e3('0x33')]['limit']);_0x40f64d[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x20')]);}_0x40f64d['order']=qs['sort'](_0x2e507c['query'][_0xf8e3('0x3b')]);_0x40f64d[_0xf8e3('0x3c')]=qs[_0xf8e3('0x35')](_[_0xf8e3('0x3d')](_0x2e507c['query'],_0x45df49[_0xf8e3('0x35')]),_0x46c85d);if(_0x2e507c['query'][_0xf8e3('0x3e')]){_0x40f64d[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x40f64d[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x30')](_0x46c85d,function(_0x34a6ba){if(_0x34a6ba[_0xf8e3('0x40')]!==_0xf8e3('0x41')){var _0x17c9b1={};_0x17c9b1[_0x34a6ba['name']]={'$like':'%'+_0x2e507c[_0xf8e3('0x33')]['filter']+'%'};return _0x17c9b1;}})});}_0x40f64d=_[_0xf8e3('0x3f')]({},_0x40f64d,_0x2e507c[_0xf8e3('0x42')]);var _0x322128={'where':_0x40f64d[_0xf8e3('0x3c')]};return db[_0xf8e3('0x31')][_0xf8e3('0x1f')](_0x322128)[_0xf8e3('0x29')](function(_0x2f05b7){_0x33f208['count']=_0x2f05b7;if(_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x43')]){_0x40f64d[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x31')][_0xf8e3('0x45')](_0x40f64d);})[_0xf8e3('0x29')](function(_0x792190){_0x33f208[_0xf8e3('0x46')]=_0x792190;return _0x33f208;})['then'](respondWithFilteredResult(_0x10cf28,_0x40f64d))['catch'](handleError(_0x10cf28,null));};exports['show']=function(_0x30fecf,_0x3d3ea5){var _0x5056bc={'raw':!![],'where':{'id':_0x30fecf['params']['id']}},_0x181908={};_0x181908[_0xf8e3('0x38')]=_[_0xf8e3('0x34')](db['ContactItemType'][_0xf8e3('0x47')]);_0x181908['query']=_[_0xf8e3('0x34')](_0x30fecf[_0xf8e3('0x33')]);_0x181908['filters']=_[_0xf8e3('0x37')](_0x181908[_0xf8e3('0x38')],_0x181908[_0xf8e3('0x33')]);_0x5056bc[_0xf8e3('0x36')]=_['intersection'](_0x181908['model'],qs['fields'](_0x30fecf[_0xf8e3('0x33')][_0xf8e3('0x39')]));_0x5056bc[_0xf8e3('0x36')]=_0x5056bc['attributes'][_0xf8e3('0x48')]?_0x5056bc['attributes']:_0x181908[_0xf8e3('0x38')];if(_0x30fecf[_0xf8e3('0x33')]['includeAll']){_0x5056bc['include']=[{'all':!![]}];}_0x5056bc=_[_0xf8e3('0x3f')]({},_0x5056bc,_0x30fecf[_0xf8e3('0x42')]);return db[_0xf8e3('0x31')][_0xf8e3('0x49')](_0x5056bc)[_0xf8e3('0x29')](handleEntityNotFound(_0x3d3ea5,null))[_0xf8e3('0x29')](respondWithResult(_0x3d3ea5,null))[_0xf8e3('0x4a')](handleError(_0x3d3ea5,null));};exports[_0xf8e3('0x4b')]=function(_0xdc2430,_0x81898e){return db[_0xf8e3('0x31')]['create'](_0xdc2430[_0xf8e3('0x4c')],{})[_0xf8e3('0x29')](function(_0x20195b){var _0x458188=_0xdc2430[_0xf8e3('0x4d')][_0xf8e3('0x2a')]({'plain':!![]});if(!_0x458188)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x458188[_0xf8e3('0x4e')]===_0xf8e3('0x4d')){var _0x39caae=_0x20195b[_0xf8e3('0x2a')]({'plain':!![]});var _0x2ee5fb=_0xf8e3('0x2b');return db['UserProfileSection'][_0xf8e3('0x49')]({'where':{'name':_0x2ee5fb,'userProfileId':_0x458188[_0xf8e3('0x4f')]},'raw':!![]})[_0xf8e3('0x29')](function(_0x252c4d){if(_0x252c4d&&_0x252c4d[_0xf8e3('0x50')]===0x0){return db[_0xf8e3('0x2c')]['create']({'name':_0x39caae[_0xf8e3('0x2e')],'resourceId':_0x39caae['id'],'type':_0x252c4d[_0xf8e3('0x2e')],'sectionId':_0x252c4d['id']},{})[_0xf8e3('0x29')](function(){return _0x20195b;});}else{return _0x20195b;}})[_0xf8e3('0x4a')](function(_0x452b00){logger['error'](_0xf8e3('0x51'),_0x452b00);throw _0x452b00;});}return _0x20195b;})[_0xf8e3('0x29')](respondWithResult(_0x81898e,0xc9))[_0xf8e3('0x4a')](handleError(_0x81898e,null));};exports['update']=function(_0x5b78e6,_0x371dfe){if(_0x5b78e6[_0xf8e3('0x4c')]['id']){delete _0x5b78e6[_0xf8e3('0x4c')]['id'];}return db[_0xf8e3('0x31')]['find']({'where':{'id':_0x5b78e6[_0xf8e3('0x52')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x371dfe,null))['then'](saveUpdates(_0x5b78e6['body'],null))[_0xf8e3('0x29')](respondWithResult(_0x371dfe,null))[_0xf8e3('0x4a')](handleError(_0x371dfe,null));};exports[_0xf8e3('0x28')]=function(_0x505477,_0x5579cb){return db['ContactItemType'][_0xf8e3('0x49')]({'where':{'id':_0x505477[_0xf8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x5579cb,null))['then'](db['CmContactHasItem'][_0xf8e3('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x505477[_0xf8e3('0x52')]['id']}}))['then'](removeEntity(_0x5579cb,null))[_0xf8e3('0x4a')](handleError(_0x5579cb,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 57f928e..af1c2d2 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 _0x7920=['path','rimraf','../../config/environment','exports','define','lodash','util','request-promise'];(function(_0xaa7a74,_0x389361){var _0xa11920=function(_0x5dafe5){while(--_0x5dafe5){_0xaa7a74['push'](_0xaa7a74['shift']());}};_0xa11920(++_0x389361);}(_0x7920,0x195));var _0x0792=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7920[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0792('0x0'));var util=require(_0x0792('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0792('0x2'));var fs=require('fs');var path=require(_0x0792('0x3'));var rimraf=require(_0x0792('0x4'));var config=require(_0x0792('0x5'));var attributes=require('./contactItemType.attributes');module[_0x0792('0x6')]=function(_0x2fd288,_0x44cd27){return _0x2fd288[_0x0792('0x7')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd352=['api','bluebird','request-promise','rimraf','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x301e23,_0x8e8a58){var _0x2f8c71=function(_0x305e0a){while(--_0x305e0a){_0x301e23['push'](_0x301e23['shift']());}};_0x2f8c71(++_0x8e8a58);}(_0xd352,0x13c));var _0x2d35=function(_0x208f6c,_0xc2b367){_0x208f6c=_0x208f6c-0x0;var _0x40e7e2=_0xd352[_0x208f6c];return _0x40e7e2;};'use strict';var _=require(_0x2d35('0x0'));var util=require(_0x2d35('0x1'));var logger=require(_0x2d35('0x2'))(_0x2d35('0x3'));var moment=require('moment');var BPromise=require(_0x2d35('0x4'));var rp=require(_0x2d35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d35('0x6'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x2d35('0x7')]=function(_0x50ab82,_0x1e8f18){return _0x50ab82[_0x2d35('0x8')](_0x2d35('0x9'),attributes,{'tableName':_0x2d35('0xa'),'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 db57103..856a6c9 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 _0xdcb9=['rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x35b627,_0x255bb4){var _0x393751=function(_0x5e4f00){while(--_0x5e4f00){_0x35b627['push'](_0x35b627['shift']());}};_0x393751(++_0x255bb4);}(_0xdcb9,0xa7));var _0x9dcb=function(_0xdbc03e,_0x5aea54){_0xdbc03e=_0xdbc03e-0x0;var _0x37d688=_0xdcb9[_0xdbc03e];return _0x37d688;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var moment=require(_0x9dcb('0x1'));var BPromise=require(_0x9dcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9dcb('0x4'));var config=require(_0x9dcb('0x5'));var jayson=require(_0x9dcb('0x6'));var client=jayson[_0x9dcb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a364f,_0x542073,_0x25f844){return new BPromise(function(_0x578700,_0x11c535){return client[_0x9dcb('0x8')](_0x1a364f,_0x25f844)['then'](function(_0x133d87){logger['info']('ContactItemType,\x20%s,\x20%s',_0x542073,_0x9dcb('0x9'));logger[_0x9dcb('0xa')](_0x9dcb('0xb'),_0x542073,'request\x20sent',JSON[_0x9dcb('0xc')](_0x133d87));if(_0x133d87[_0x9dcb('0xd')]){if(_0x133d87[_0x9dcb('0xd')]['code']===0x1f4){logger[_0x9dcb('0xd')](_0x9dcb('0xe'),_0x542073,_0x133d87[_0x9dcb('0xd')][_0x9dcb('0xf')]);return _0x11c535(_0x133d87[_0x9dcb('0xd')][_0x9dcb('0xf')]);}logger[_0x9dcb('0xd')](_0x9dcb('0xe'),_0x542073,_0x133d87[_0x9dcb('0xd')]['message']);return _0x578700(_0x133d87[_0x9dcb('0xd')]['message']);}else{logger[_0x9dcb('0x10')]('ContactItemType,\x20%s,\x20%s',_0x542073,_0x9dcb('0x9'));_0x578700(_0x133d87[_0x9dcb('0x11')][_0x9dcb('0xf')]);}})[_0x9dcb('0x12')](function(_0x16608d){logger[_0x9dcb('0xd')]('ContactItemType,\x20%s,\x20%s',_0x542073,_0x16608d);_0x11c535(_0x16608d);});});} \ No newline at end of file +var _0x2126=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x23cf85,_0x35f4fe){var _0x46ef91=function(_0x39e688){while(--_0x39e688){_0x23cf85['push'](_0x23cf85['shift']());}};_0x46ef91(++_0x35f4fe);}(_0x2126,0xe4));var _0x6212=function(_0x12a890,_0x4f3cb5){_0x12a890=_0x12a890-0x0;var _0x1a79ef=_0x2126[_0x12a890];return _0x1a79ef;};'use strict';var _=require('lodash');var util=require(_0x6212('0x0'));var moment=require(_0x6212('0x1'));var BPromise=require(_0x6212('0x2'));var rs=require(_0x6212('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6212('0x4'))['db'];var utils=require(_0x6212('0x5'));var logger=require(_0x6212('0x6'))(_0x6212('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6212('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdcca05,_0x3a4b27,_0x4f05a8){return new BPromise(function(_0x2e0878,_0x3bbefb){return client[_0x6212('0x9')](_0xdcca05,_0x4f05a8)[_0x6212('0xa')](function(_0x1c045b){logger[_0x6212('0xb')](_0x6212('0xc'),_0x3a4b27,_0x6212('0xd'));logger[_0x6212('0xe')](_0x6212('0xf'),_0x3a4b27,_0x6212('0xd'),JSON[_0x6212('0x10')](_0x1c045b));if(_0x1c045b[_0x6212('0x11')]){if(_0x1c045b[_0x6212('0x11')]['code']===0x1f4){logger[_0x6212('0x11')](_0x6212('0xc'),_0x3a4b27,_0x1c045b[_0x6212('0x11')][_0x6212('0x12')]);return _0x3bbefb(_0x1c045b[_0x6212('0x11')][_0x6212('0x12')]);}logger[_0x6212('0x11')](_0x6212('0xc'),_0x3a4b27,_0x1c045b[_0x6212('0x11')][_0x6212('0x12')]);return _0x2e0878(_0x1c045b[_0x6212('0x11')][_0x6212('0x12')]);}else{logger['info'](_0x6212('0xc'),_0x3a4b27,_0x6212('0xd'));_0x2e0878(_0x1c045b[_0x6212('0x13')]['message']);}})['catch'](function(_0x3c1d8b){logger[_0x6212('0x11')](_0x6212('0xc'),_0x3a4b27,_0x3c1d8b);_0x3bbefb(_0x3c1d8b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e007cad..14f9408 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 _0xbab2=['/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x4d8be0,_0x612288){var _0x43ffdd=function(_0x28e69f){while(--_0x28e69f){_0x4d8be0['push'](_0x4d8be0['shift']());}};_0x43ffdd(++_0x612288);}(_0xbab2,0xbb));var _0x2bab=function(_0xf759a4,_0x1c0a4b){_0xf759a4=_0xf759a4-0x0;var _0x4220dc=_0xbab2[_0xf759a4];return _0x4220dc;};'use strict';var multer=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var path=require(_0x2bab('0x2'));var timeout=require(_0x2bab('0x3'));var express=require('express');var router=express[_0x2bab('0x4')]();var fs_extra=require(_0x2bab('0x5'));var auth=require(_0x2bab('0x6'));var interaction=require(_0x2bab('0x7'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0x2bab('0x8')]('/',auth[_0x2bab('0x9')](),controller[_0x2bab('0xa')]);router[_0x2bab('0x8')](_0x2bab('0xb'),auth[_0x2bab('0x9')](),controller[_0x2bab('0xc')]);router[_0x2bab('0xd')]('/',auth['isAuthenticated'](),controller[_0x2bab('0xe')]);router[_0x2bab('0xf')]('/:id',auth[_0x2bab('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2bab('0x9')](),controller[_0x2bab('0x10')]);module[_0x2bab('0x11')]=router; \ No newline at end of file +var _0xd80e=['/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0xa29077,_0x447ab1){var _0x589c53=function(_0xb1248d){while(--_0xb1248d){_0xa29077['push'](_0xa29077['shift']());}};_0x589c53(++_0x447ab1);}(_0xd80e,0x13a));var _0xed80=function(_0x218927,_0x365ae5){_0x218927=_0x218927-0x0;var _0x13c3bd=_0xd80e[_0x218927];return _0x13c3bd;};'use strict';var multer=require(_0xed80('0x0'));var util=require(_0xed80('0x1'));var path=require(_0xed80('0x2'));var timeout=require(_0xed80('0x3'));var express=require(_0xed80('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed80('0x5'));var config=require(_0xed80('0x6'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0xed80('0x7')](),controller[_0xed80('0x8')]);router[_0xed80('0x9')](_0xed80('0xa'),auth[_0xed80('0x7')](),controller[_0xed80('0xb')]);router[_0xed80('0xc')]('/',auth[_0xed80('0x7')](),controller[_0xed80('0xd')]);router[_0xed80('0xe')](_0xed80('0xa'),auth[_0xed80('0x7')](),controller[_0xed80('0xf')]);router['delete'](_0xed80('0xa'),auth[_0xed80('0x7')](),controller[_0xed80('0x10')]);module[_0xed80('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 4af37b6..19cc7a6 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 _0x2032=['name','exports','STRING'];(function(_0x513606,_0x1c0003){var _0x4e32a3=function(_0xabcacf){while(--_0xabcacf){_0x513606['push'](_0x513606['shift']());}};_0x4e32a3(++_0x1c0003);}(_0x2032,0xd9));var _0x2203=function(_0x195483,_0x43e1fd){_0x195483=_0x195483-0x0;var _0xcd84fc=_0x2032[_0x195483];return _0xcd84fc;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x36f57a,_0x3c98b9){var _0x212b95=function(_0x1a8d2e){while(--_0x1a8d2e){_0x36f57a['push'](_0x36f57a['shift']());}};_0x212b95(++_0x3c98b9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 075fecf..cc783a1 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 _0x70a4=['attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','findOne','filter','getItems','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','map','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','Dashboard','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter'];(function(_0x761fcf,_0x2e5fe7){var _0x46bc5e=function(_0x58c774){while(--_0x58c774){_0x761fcf['push'](_0x761fcf['shift']());}};_0x46bc5e(++_0x2e5fe7);}(_0x70a4,0x9a));var _0x470a=function(_0x45387f,_0x5c6a0b){_0x45387f=_0x45387f-0x0;var _0x240983=_0x70a4[_0x45387f];return _0x240983;};'use strict';var emlformat=require(_0x470a('0x0'));var rimraf=require(_0x470a('0x1'));var zipdir=require(_0x470a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x470a('0x3'));var BPromise=require(_0x470a('0x4'));var Mustache=require(_0x470a('0x5'));var util=require('util');var path=require(_0x470a('0x6'));var sox=require(_0x470a('0x7'));var csv=require(_0x470a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x470a('0x9'));var crypto=require('crypto');var jsforce=require(_0x470a('0xa'));var deskjs=require(_0x470a('0xb'));var toCsv=require(_0x470a('0x8'));var querystring=require(_0x470a('0xc'));var Papa=require(_0x470a('0xd'));var Redis=require(_0x470a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x470a('0xf'));var as=require(_0x470a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x470a('0x11'))(_0x470a('0x12'));var utils=require('../../config/utils');var config=require(_0x470a('0x13'));var licenseUtil=require(_0x470a('0x14'));var db=require(_0x470a('0x15'))['db'];config[_0x470a('0x16')]=_[_0x470a('0x17')](config[_0x470a('0x16')],{'host':_0x470a('0x18'),'port':0x18eb});var socket=require(_0x470a('0x19'))(new Redis(config['redis']));require(_0x470a('0x1a'))['register'](socket);function respondWithStatusCode(_0x267399,_0x116a8d){_0x116a8d=_0x116a8d||0xcc;return function(_0xb78e01){if(_0xb78e01){return _0x267399[_0x470a('0x1b')](_0x116a8d);}return _0x267399[_0x470a('0x1c')](_0x116a8d)[_0x470a('0x1d')]();};}function respondWithResult(_0x29e17b,_0x43bf55){_0x43bf55=_0x43bf55||0xc8;return function(_0x3b0eb2){if(_0x3b0eb2){return _0x29e17b['status'](_0x43bf55)[_0x470a('0x1e')](_0x3b0eb2);}};}function respondWithFilteredResult(_0xdf9304,_0x2ea14a){return function(_0x301e29){if(_0x301e29){var _0x1061a8=typeof _0x2ea14a['offset']===_0x470a('0x1f')&&typeof _0x2ea14a[_0x470a('0x20')]===_0x470a('0x1f');var _0x1b1569=_0x301e29[_0x470a('0x21')];var _0x430e0d=_0x1061a8?0x0:_0x2ea14a[_0x470a('0x22')];var _0x4d27e3=_0x1061a8?_0x301e29[_0x470a('0x21')]:_0x2ea14a['offset']+_0x2ea14a[_0x470a('0x20')];var _0x1a81e2;if(_0x4d27e3>=_0x1b1569){_0x4d27e3=_0x1b1569;_0x1a81e2=0xc8;}else{_0x1a81e2=0xce;}_0xdf9304[_0x470a('0x1c')](_0x1a81e2);return _0xdf9304[_0x470a('0x23')](_0x470a('0x24'),_0x430e0d+'-'+_0x4d27e3+'/'+_0x1b1569)[_0x470a('0x1e')](_0x301e29);}return null;};}function patchUpdates(_0x54a897){return function(_0x1e8ae0){try{jsonpatch[_0x470a('0x25')](_0x1e8ae0,_0x54a897,!![]);}catch(_0x1da4e1){return BPromise[_0x470a('0x26')](_0x1da4e1);}return _0x1e8ae0[_0x470a('0x27')]();};}function saveUpdates(_0x4cd214,_0x1e2824){return function(_0x4b9558){if(_0x4b9558){return _0x4b9558['update'](_0x4cd214)[_0x470a('0x28')](function(_0x521b99){return _0x521b99;});}return null;};}function removeEntity(_0x2eac00,_0x4da46f){return function(_0x3925da){if(_0x3925da){return _0x3925da[_0x470a('0x29')]()['then'](function(){var _0x1f4cb5=_0x3925da[_0x470a('0x2a')]({'plain':!![]});var _0x33bfea='CustomDashboards';return db[_0x470a('0x2b')]['destroy']({'where':{'type':_0x33bfea,'resourceId':_0x1f4cb5['id']}})['then'](function(){return _0x3925da;});})[_0x470a('0x28')](function(){_0x2eac00['status'](0xcc)[_0x470a('0x1d')]();});}};}function handleEntityNotFound(_0x257a89,_0x889071){return function(_0x3c9658){if(!_0x3c9658){_0x257a89[_0x470a('0x1b')](0x194);}return _0x3c9658;};}function handleError(_0x4b36db,_0x3835cd){_0x3835cd=_0x3835cd||0x1f4;return function(_0x2fc1c6){logger[_0x470a('0x2c')](_0x2fc1c6['stack']);if(_0x2fc1c6[_0x470a('0x2d')]){delete _0x2fc1c6['name'];}_0x4b36db[_0x470a('0x1c')](_0x3835cd)[_0x470a('0x2e')](_0x2fc1c6);};}exports[_0x470a('0x2f')]=function(_0x403e38,_0x5660a2){var _0x441f33={},_0x30ef97={},_0x86bc83={'count':0x0,'rows':[]};var _0x25f1af=_[_0x470a('0x30')](db['Dashboard']['rawAttributes'],function(_0x3f965c){return{'name':_0x3f965c['fieldName'],'type':_0x3f965c[_0x470a('0x31')][_0x470a('0x32')]};});_0x30ef97[_0x470a('0x33')]=_[_0x470a('0x30')](_0x25f1af,_0x470a('0x2d'));_0x30ef97[_0x470a('0x34')]=_[_0x470a('0x35')](_0x403e38[_0x470a('0x34')]);_0x30ef97[_0x470a('0x36')]=_['intersection'](_0x30ef97[_0x470a('0x33')],_0x30ef97['query']);_0x441f33['attributes']=_['intersection'](_0x30ef97[_0x470a('0x33')],qs[_0x470a('0x37')](_0x403e38[_0x470a('0x34')][_0x470a('0x37')]));_0x441f33[_0x470a('0x38')]=_0x441f33[_0x470a('0x38')][_0x470a('0x39')]?_0x441f33[_0x470a('0x38')]:_0x30ef97['model'];if(!_0x403e38[_0x470a('0x34')][_0x470a('0x3a')](_0x470a('0x3b'))){_0x441f33[_0x470a('0x20')]=qs[_0x470a('0x20')](_0x403e38[_0x470a('0x34')][_0x470a('0x20')]);_0x441f33[_0x470a('0x22')]=qs['offset'](_0x403e38[_0x470a('0x34')]['offset']);}_0x441f33[_0x470a('0x3c')]=qs[_0x470a('0x3d')](_0x403e38['query'][_0x470a('0x3d')]);_0x441f33[_0x470a('0x3e')]=qs[_0x470a('0x36')](_[_0x470a('0x3f')](_0x403e38[_0x470a('0x34')],_0x30ef97[_0x470a('0x36')]),_0x25f1af);if(_0x403e38[_0x470a('0x34')]['filter']){_0x441f33['where']=_['merge'](_0x441f33[_0x470a('0x3e')],{'$or':_[_0x470a('0x30')](_0x25f1af,function(_0x4b182e){if(_0x4b182e[_0x470a('0x31')]!==_0x470a('0x40')){var _0x12b7c0={};_0x12b7c0[_0x4b182e['name']]={'$like':'%'+_0x403e38[_0x470a('0x34')]['filter']+'%'};return _0x12b7c0;}})});}_0x441f33=_[_0x470a('0x41')]({},_0x441f33,_0x403e38[_0x470a('0x42')]);var _0x32a352={'where':_0x441f33[_0x470a('0x3e')]};return db[_0x470a('0x43')][_0x470a('0x21')](_0x32a352)['then'](function(_0x36c83c){_0x86bc83[_0x470a('0x21')]=_0x36c83c;if(_0x403e38[_0x470a('0x34')][_0x470a('0x44')]){_0x441f33[_0x470a('0x45')]=[{'all':!![]}];}return db[_0x470a('0x43')][_0x470a('0x46')](_0x441f33);})[_0x470a('0x28')](function(_0x57a566){_0x86bc83[_0x470a('0x47')]=_0x57a566;return _0x86bc83;})[_0x470a('0x28')](respondWithFilteredResult(_0x5660a2,_0x441f33))[_0x470a('0x48')](handleError(_0x5660a2,null));};exports['show']=function(_0x1753ba,_0x251ee6){var _0x437e7a={'raw':![],'where':{'id':_0x1753ba[_0x470a('0x49')]['id']}},_0x2c6dc4={};_0x2c6dc4[_0x470a('0x33')]=_[_0x470a('0x35')](db[_0x470a('0x43')][_0x470a('0x4a')]);_0x2c6dc4[_0x470a('0x34')]=_[_0x470a('0x35')](_0x1753ba[_0x470a('0x34')]);_0x2c6dc4[_0x470a('0x36')]=_[_0x470a('0x4b')](_0x2c6dc4['model'],_0x2c6dc4[_0x470a('0x34')]);_0x437e7a[_0x470a('0x38')]=_['intersection'](_0x2c6dc4[_0x470a('0x33')],qs[_0x470a('0x37')](_0x1753ba['query'][_0x470a('0x37')]));_0x437e7a[_0x470a('0x38')]=_0x437e7a[_0x470a('0x38')][_0x470a('0x39')]?_0x437e7a['attributes']:_0x2c6dc4[_0x470a('0x33')];if(_0x1753ba[_0x470a('0x34')]['includeAll']){_0x437e7a[_0x470a('0x45')]=[{'all':!![]}];}_0x437e7a=_['merge']({},_0x437e7a,_0x1753ba[_0x470a('0x42')]);return db[_0x470a('0x43')][_0x470a('0x4c')](_0x437e7a)[_0x470a('0x28')](handleEntityNotFound(_0x251ee6,null))[_0x470a('0x28')](respondWithResult(_0x251ee6,null))[_0x470a('0x48')](handleError(_0x251ee6,null));};exports[_0x470a('0x4d')]=function(_0x3fdde7,_0x3b9ff7){return db[_0x470a('0x43')][_0x470a('0x4d')](_0x3fdde7[_0x470a('0x4e')],{})[_0x470a('0x28')](function(_0x49bb06){var _0x15c352=_0x3fdde7[_0x470a('0x4f')][_0x470a('0x2a')]({'plain':!![]});if(!_0x15c352)throw new Error(_0x470a('0x50'));if(_0x15c352[_0x470a('0x51')]===_0x470a('0x4f')){var _0x47e81c=_0x49bb06[_0x470a('0x2a')]({'plain':!![]});var _0x32c1ea=_0x470a('0x52');return db['UserProfileSection'][_0x470a('0x4c')]({'where':{'name':_0x32c1ea,'userProfileId':_0x15c352[_0x470a('0x53')]},'raw':!![]})['then'](function(_0x5eac35){if(_0x5eac35&&_0x5eac35[_0x470a('0x54')]===0x0){return db[_0x470a('0x2b')][_0x470a('0x4d')]({'name':_0x47e81c[_0x470a('0x2d')],'resourceId':_0x47e81c['id'],'type':_0x5eac35[_0x470a('0x2d')],'sectionId':_0x5eac35['id']},{})[_0x470a('0x28')](function(){return _0x49bb06;});}else{return _0x49bb06;}})[_0x470a('0x48')](function(_0x32ac77){logger[_0x470a('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32ac77);throw _0x32ac77;});}return _0x49bb06;})[_0x470a('0x28')](respondWithResult(_0x3b9ff7,0xc9))[_0x470a('0x48')](handleError(_0x3b9ff7,null));};exports[_0x470a('0x55')]=function(_0x26d2f9,_0x49e4a1){var _0x2a3fb7={'where':{'id':_0x26d2f9[_0x470a('0x49')]['id']}},_0x2c329a={};_0x2c329a[_0x470a('0x33')]=_[_0x470a('0x35')](db[_0x470a('0x43')]['rawAttributes']);_0x2a3fb7[_0x470a('0x38')]=_[_0x470a('0x4b')](_0x2c329a[_0x470a('0x33')],qs[_0x470a('0x37')](_0x26d2f9[_0x470a('0x34')][_0x470a('0x37')]));_0x2a3fb7[_0x470a('0x38')]=_0x2a3fb7[_0x470a('0x38')][_0x470a('0x39')]?_0x2a3fb7['attributes']:_0x2c329a['model'];if(_0x26d2f9['query']['includeAll']){_0x2a3fb7['include']=[{'all':!![]}];}_0x2a3fb7=_[_0x470a('0x41')]({},_0x2a3fb7,_0x26d2f9[_0x470a('0x42')]);return db['Dashboard'][_0x470a('0x4c')](_0x2a3fb7)[_0x470a('0x28')](handleEntityNotFound(_0x49e4a1,null))[_0x470a('0x28')](function(_0x331f9d){if(_0x331f9d){var _0x3c87bc=_0x331f9d[_0x470a('0x2a')]({'plain':!![]});_0x3c87bc=qs[_0x470a('0x56')](_0x3c87bc,['id',_0x470a('0x57'),_0x470a('0x58')]);_0x26d2f9[_0x470a('0x4e')]=_[_0x470a('0x56')](_0x26d2f9[_0x470a('0x4e')],['id',_0x470a('0x57'),_0x470a('0x58')]);return db['Dashboard'][_0x470a('0x4d')](_[_0x470a('0x41')](_0x3c87bc,_0x26d2f9[_0x470a('0x4e')]),{'include':_0x26d2f9[_0x470a('0x34')][_0x470a('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x292cf7){var _0x14d061=_0x26d2f9[_0x470a('0x4f')][_0x470a('0x2a')]({'plain':!![]});if(!_0x14d061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14d061[_0x470a('0x51')]===_0x470a('0x4f')){var _0x3bc617=_0x292cf7[_0x470a('0x2a')]({'plain':!![]});var _0x1cfd6b='CustomDashboards';return db[_0x470a('0x59')][_0x470a('0x4c')]({'where':{'name':_0x1cfd6b,'userProfileId':_0x14d061[_0x470a('0x53')]},'raw':!![]})[_0x470a('0x28')](function(_0x53f0cf){if(_0x53f0cf&&_0x53f0cf[_0x470a('0x54')]===0x0){return db['UserProfileResource'][_0x470a('0x4d')]({'name':_0x3bc617[_0x470a('0x2d')],'resourceId':_0x3bc617['id'],'type':_0x53f0cf[_0x470a('0x2d')],'sectionId':_0x53f0cf['id']},{})['then'](function(){return _0x292cf7;});}else{return _0x292cf7;}})[_0x470a('0x48')](function(_0x5e2487){logger['error'](_0x470a('0x5a'),_0x5e2487);throw _0x5e2487;});}return _0x292cf7;});}})[_0x470a('0x28')](respondWithResult(_0x49e4a1,0xc9))[_0x470a('0x48')](handleError(_0x49e4a1,null));};exports[_0x470a('0x5b')]=function(_0x4c6f88,_0x2edcad){if(_0x4c6f88['body']['id']){delete _0x4c6f88[_0x470a('0x4e')]['id'];}return db[_0x470a('0x43')][_0x470a('0x4c')]({'where':{'id':_0x4c6f88[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x2edcad,null))['then'](saveUpdates(_0x4c6f88[_0x470a('0x4e')],null))['then'](respondWithResult(_0x2edcad,null))[_0x470a('0x48')](handleError(_0x2edcad,null));};exports[_0x470a('0x29')]=function(_0x3d3afe,_0xfd5c14){return db[_0x470a('0x43')][_0x470a('0x4c')]({'where':{'id':_0x3d3afe[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0xfd5c14,null))[_0x470a('0x28')](removeEntity(_0xfd5c14,null))['catch'](handleError(_0xfd5c14,null));};function widgetAttributes(_0x2fa4f8){try{switch(_0x2fa4f8[_0x470a('0x31')]){case _0x470a('0x5c'):return[{'name':_0x470a('0x5d'),'value':_0x2fa4f8['attrUrl']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||'https://'}];case _0x470a('0x60'):return[{'name':_0x470a('0x61'),'value':_0x2fa4f8[_0x470a('0x61')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x470a('0x62'),'value':_0x2fa4f8[_0x470a('0x62')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8['attrs'][0x0][_0x470a('0x5f')]:undefined)||_0x470a('0x63')},{'name':'attrTimezone','value':_0x2fa4f8[_0x470a('0x64')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||_0x470a('0x65')},{'name':_0x470a('0x66'),'value':_0x2fa4f8['attrFontSize']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x2]?_0x2fa4f8[_0x470a('0x5e')][0x2][_0x470a('0x5f')]:undefined)||0xc}];case _0x470a('0x67'):return[{'name':_0x470a('0x68'),'value':_0x2fa4f8[_0x470a('0x68')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x5f')]:undefined)||_0x470a('0x69')},{'name':'attrVoiceQueues','value':_0x2fa4f8[_0x470a('0x6a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||[]},{'name':_0x470a('0x66'),'value':_0x2fa4f8[_0x470a('0x66')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x2]?_0x2fa4f8['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x470a('0x6b'),'value':_0x2fa4f8[_0x470a('0x6b')]||(_0x2fa4f8['attrs']&&_0x2fa4f8['attrs'][0x3]?_0x2fa4f8[_0x470a('0x5e')][0x3][_0x470a('0x5f')]:undefined)||_0x470a('0x6c')},{'name':'attrEmailAccounts','value':_0x2fa4f8['attrEmailAccounts']||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x4]?_0x2fa4f8[_0x470a('0x5e')][0x4]['value']:undefined)||''},{'name':_0x470a('0x6d'),'value':_0x2fa4f8[_0x470a('0x6d')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x5]?_0x2fa4f8[_0x470a('0x5e')][0x5]['value']:undefined)||''},{'name':_0x470a('0x6e'),'value':_0x2fa4f8[_0x470a('0x6e')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x6]?_0x2fa4f8[_0x470a('0x5e')][0x6][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6f'),'value':_0x2fa4f8[_0x470a('0x6f')]||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x7]?_0x2fa4f8['attrs'][0x7][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x70'),'value':_0x2fa4f8[_0x470a('0x70')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x8]?_0x2fa4f8[_0x470a('0x5e')][0x8][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x71'),'value':_0x2fa4f8['attrChatWebsites']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x9]?_0x2fa4f8[_0x470a('0x5e')][0x9][_0x470a('0x5f')]:undefined)||''}];case'multibar-chart':case _0x470a('0x72'):return[{'name':_0x470a('0x73'),'value':_0x2fa4f8['attrSerie1']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x470a('0x74'),'value':_0x2fa4f8[_0x470a('0x74')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||null},{'name':_0x470a('0x75'),'value':_0x2fa4f8[_0x470a('0x75')]||(_0x2fa4f8['attrs']&&_0x2fa4f8['attrs'][0x2]?_0x2fa4f8['attrs'][0x2]['value']:undefined)||null},{'name':_0x470a('0x6a'),'value':_0x2fa4f8[_0x470a('0x6a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x3]?_0x2fa4f8['attrs'][0x3][_0x470a('0x5f')]:undefined)||[]},{'name':_0x470a('0x6b'),'value':_0x2fa4f8[_0x470a('0x6b')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x4]?_0x2fa4f8[_0x470a('0x5e')][0x4][_0x470a('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2fa4f8[_0x470a('0x76')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x5]?_0x2fa4f8[_0x470a('0x5e')][0x5][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6d'),'value':_0x2fa4f8[_0x470a('0x6d')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x6]?_0x2fa4f8[_0x470a('0x5e')][0x6][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6e'),'value':_0x2fa4f8[_0x470a('0x6e')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x7]?_0x2fa4f8[_0x470a('0x5e')][0x7][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x6f'),'value':_0x2fa4f8[_0x470a('0x6f')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x8]?_0x2fa4f8['attrs'][0x8][_0x470a('0x5f')]:undefined)||''},{'name':_0x470a('0x70'),'value':_0x2fa4f8['attrWhatsappAccounts']||(_0x2fa4f8['attrs']&&_0x2fa4f8[_0x470a('0x5e')][0x9]?_0x2fa4f8['attrs'][0x9]['value']:undefined)||''},{'name':_0x470a('0x71'),'value':_0x2fa4f8[_0x470a('0x71')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0xa]?_0x2fa4f8[_0x470a('0x5e')][0xa][_0x470a('0x5f')]:undefined)||''}];case _0x470a('0x77'):return[{'name':_0x470a('0x78'),'type':_0x2fa4f8[_0x470a('0x79')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x0]?_0x2fa4f8[_0x470a('0x5e')][0x0][_0x470a('0x31')]:undefined)||null,'value':_0x2fa4f8[_0x470a('0x78')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8['attrs'][0x0]?_0x2fa4f8['attrs'][0x0]['value']:undefined)||null},{'name':_0x470a('0x7a'),'value':_0x2fa4f8[_0x470a('0x7a')]||(_0x2fa4f8[_0x470a('0x5e')]&&_0x2fa4f8[_0x470a('0x5e')][0x1]?_0x2fa4f8[_0x470a('0x5e')][0x1][_0x470a('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x56ca33){logger[_0x470a('0x2c')]('widgetAttributes:\x20%s',JSON[_0x470a('0x7b')](_0x56ca33));return[];}}exports['addItem']=function(_0x59e008,_0x191fe7,_0x226875){if(_0x59e008[_0x470a('0x4e')]['id']){delete _0x59e008['body']['id'];}return db[_0x470a('0x43')]['find']({'where':{'id':_0x59e008[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x191fe7,null))[_0x470a('0x28')](function(_0xe965cf){if(_0xe965cf){_0x59e008[_0x470a('0x4e')][_0x470a('0x7c')]=_0xe965cf['id'];_0x59e008[_0x470a('0x4e')][_0x470a('0x5e')]=widgetAttributes(_0x59e008[_0x470a('0x4e')]);return db[_0x470a('0x7d')][_0x470a('0x4d')](_0x59e008['body']);}})[_0x470a('0x28')](respondWithResult(_0x191fe7,null))[_0x470a('0x48')](handleError(_0x191fe7,null));};exports['getItems']=function(_0x4f0025,_0x38ecd7,_0x376006){var _0x42845a={};var _0x51cf2a={};var _0xf52dd1;var _0x3b1855;return db[_0x470a('0x43')][_0x470a('0x7e')]({'where':{'id':_0x4f0025[_0x470a('0x49')]['id']}})[_0x470a('0x28')](handleEntityNotFound(_0x38ecd7,null))[_0x470a('0x28')](function(_0x48c5f3){if(_0x48c5f3){_0xf52dd1=_0x48c5f3;_0x51cf2a[_0x470a('0x33')]=_['keys'](db['DashboardItem'][_0x470a('0x4a')]);_0x51cf2a['query']=_[_0x470a('0x35')](_0x4f0025[_0x470a('0x34')]);_0x51cf2a[_0x470a('0x36')]=_[_0x470a('0x4b')](_0x51cf2a[_0x470a('0x33')],_0x51cf2a[_0x470a('0x34')]);_0x42845a[_0x470a('0x38')]=_['intersection'](_0x51cf2a[_0x470a('0x33')],qs[_0x470a('0x37')](_0x4f0025[_0x470a('0x34')][_0x470a('0x37')]));_0x42845a['attributes']=_0x42845a[_0x470a('0x38')][_0x470a('0x39')]?_0x42845a['attributes']:_0x51cf2a['model'];_0x42845a[_0x470a('0x3c')]=qs[_0x470a('0x3d')](_0x4f0025[_0x470a('0x34')][_0x470a('0x3d')]);_0x42845a[_0x470a('0x3e')]=qs[_0x470a('0x36')](_[_0x470a('0x3f')](_0x4f0025[_0x470a('0x34')],_0x51cf2a[_0x470a('0x36')]));if(_0x4f0025[_0x470a('0x34')][_0x470a('0x7f')]){_0x42845a[_0x470a('0x3e')]=_['merge'](_0x42845a[_0x470a('0x3e')],{'$or':_[_0x470a('0x30')](_0x42845a[_0x470a('0x38')],function(_0x3d82e8){var _0x1b106f={};_0x1b106f[_0x3d82e8]={'$like':'%'+_0x4f0025[_0x470a('0x34')]['filter']+'%'};return _0x1b106f;})});}_0x42845a=_['merge']({},_0x42845a,_0x4f0025[_0x470a('0x42')]);return _0xf52dd1['getItems'](_0x42845a);}})[_0x470a('0x28')](function(_0x3d0917){if(_0x3d0917){_0x3b1855=_0x3d0917[_0x470a('0x39')];if(!_0x4f0025[_0x470a('0x34')][_0x470a('0x3a')](_0x470a('0x3b'))){_0x42845a[_0x470a('0x20')]=qs[_0x470a('0x20')](_0x4f0025[_0x470a('0x34')][_0x470a('0x20')]);_0x42845a[_0x470a('0x22')]=qs[_0x470a('0x22')](_0x4f0025[_0x470a('0x34')][_0x470a('0x22')]);}return _0xf52dd1[_0x470a('0x80')](_0x42845a);}})[_0x470a('0x28')](function(_0x2beb66){if(_0x2beb66){return _0x2beb66?{'count':_0x3b1855,'rows':_0x2beb66}:null;}})['then'](respondWithResult(_0x38ecd7,null))[_0x470a('0x48')](handleError(_0x38ecd7,null));}; \ No newline at end of file +var _0x0f49=['VIRTUAL','filter','merge','includeAll','include','Dashboard','findAll','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','userProfileId','autoAssociation','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','attrWhatsappAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','findOne','pick','options','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','model','order','sort','where'];(function(_0x43b6f2,_0x2e19a7){var _0x5ce986=function(_0xba8eea){while(--_0xba8eea){_0x43b6f2['push'](_0x43b6f2['shift']());}};_0x5ce986(++_0x2e19a7);}(_0x0f49,0x14d));var _0x90f4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0f49[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0x90f4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90f4('0x1'));var jsonpatch=require(_0x90f4('0x2'));var rp=require(_0x90f4('0x3'));var moment=require('moment');var BPromise=require(_0x90f4('0x4'));var Mustache=require(_0x90f4('0x5'));var util=require('util');var path=require(_0x90f4('0x6'));var sox=require('sox');var csv=require(_0x90f4('0x7'));var ejs=require(_0x90f4('0x8'));var fs=require('fs');var fs_extra=require(_0x90f4('0x9'));var _=require(_0x90f4('0xa'));var squel=require(_0x90f4('0xb'));var crypto=require(_0x90f4('0xc'));var jsforce=require(_0x90f4('0xd'));var deskjs=require(_0x90f4('0xe'));var toCsv=require(_0x90f4('0x7'));var querystring=require(_0x90f4('0xf'));var Papa=require(_0x90f4('0x10'));var Redis=require(_0x90f4('0x11'));var authService=require(_0x90f4('0x12'));var qs=require(_0x90f4('0x13'));var as=require(_0x90f4('0x14'));var hardwareService=require(_0x90f4('0x15'));var logger=require(_0x90f4('0x16'))(_0x90f4('0x17'));var utils=require(_0x90f4('0x18'));var config=require(_0x90f4('0x19'));var licenseUtil=require(_0x90f4('0x1a'));var db=require(_0x90f4('0x1b'))['db'];config[_0x90f4('0x1c')]=_[_0x90f4('0x1d')](config[_0x90f4('0x1c')],{'host':_0x90f4('0x1e'),'port':0x18eb});var socket=require(_0x90f4('0x1f'))(new Redis(config[_0x90f4('0x1c')]));require(_0x90f4('0x20'))[_0x90f4('0x21')](socket);function respondWithStatusCode(_0x573c18,_0x5741e8){_0x5741e8=_0x5741e8||0xcc;return function(_0x227b5b){if(_0x227b5b){return _0x573c18['sendStatus'](_0x5741e8);}return _0x573c18['status'](_0x5741e8)[_0x90f4('0x22')]();};}function respondWithResult(_0xed9b09,_0x41f9c5){_0x41f9c5=_0x41f9c5||0xc8;return function(_0x1bd41c){if(_0x1bd41c){return _0xed9b09[_0x90f4('0x23')](_0x41f9c5)[_0x90f4('0x24')](_0x1bd41c);}};}function respondWithFilteredResult(_0x513923,_0x4ca796){return function(_0x321a27){if(_0x321a27){var _0x431d29=typeof _0x4ca796[_0x90f4('0x25')]===_0x90f4('0x26')&&typeof _0x4ca796[_0x90f4('0x27')]===_0x90f4('0x26');var _0x1705f4=_0x321a27[_0x90f4('0x28')];var _0x13cf61=_0x431d29?0x0:_0x4ca796[_0x90f4('0x25')];var _0x51c5fb=_0x431d29?_0x321a27[_0x90f4('0x28')]:_0x4ca796[_0x90f4('0x25')]+_0x4ca796['limit'];var _0xce62f6;if(_0x51c5fb>=_0x1705f4){_0x51c5fb=_0x1705f4;_0xce62f6=0xc8;}else{_0xce62f6=0xce;}_0x513923[_0x90f4('0x23')](_0xce62f6);return _0x513923[_0x90f4('0x29')](_0x90f4('0x2a'),_0x13cf61+'-'+_0x51c5fb+'/'+_0x1705f4)['json'](_0x321a27);}return null;};}function patchUpdates(_0x4eda04){return function(_0x5ecbbc){try{jsonpatch[_0x90f4('0x2b')](_0x5ecbbc,_0x4eda04,!![]);}catch(_0x3317ba){return BPromise['reject'](_0x3317ba);}return _0x5ecbbc[_0x90f4('0x2c')]();};}function saveUpdates(_0x10d43e,_0xe62da5){return function(_0x2c9e44){if(_0x2c9e44){return _0x2c9e44[_0x90f4('0x2d')](_0x10d43e)[_0x90f4('0x2e')](function(_0x38aa3a){return _0x38aa3a;});}return null;};}function removeEntity(_0x5a0f77,_0x5183eb){return function(_0x33b409){if(_0x33b409){return _0x33b409[_0x90f4('0x2f')]()['then'](function(){var _0x515e55=_0x33b409['get']({'plain':!![]});var _0x32548e='CustomDashboards';return db[_0x90f4('0x30')][_0x90f4('0x2f')]({'where':{'type':_0x32548e,'resourceId':_0x515e55['id']}})['then'](function(){return _0x33b409;});})[_0x90f4('0x2e')](function(){_0x5a0f77[_0x90f4('0x23')](0xcc)[_0x90f4('0x22')]();});}};}function handleEntityNotFound(_0x5d187b,_0x10abb0){return function(_0x15da53){if(!_0x15da53){_0x5d187b[_0x90f4('0x31')](0x194);}return _0x15da53;};}function handleError(_0x3f1491,_0x21b1ff){_0x21b1ff=_0x21b1ff||0x1f4;return function(_0x27662f){logger[_0x90f4('0x32')](_0x27662f['stack']);if(_0x27662f[_0x90f4('0x33')]){delete _0x27662f[_0x90f4('0x33')];}_0x3f1491['status'](_0x21b1ff)[_0x90f4('0x34')](_0x27662f);};}exports[_0x90f4('0x35')]=function(_0x250c5a,_0x7ddcef){var _0x545b80={},_0xfa1676={},_0x56e8f7={'count':0x0,'rows':[]};var _0x5c8029=_[_0x90f4('0x36')](db['Dashboard'][_0x90f4('0x37')],function(_0x4e5478){return{'name':_0x4e5478[_0x90f4('0x38')],'type':_0x4e5478[_0x90f4('0x39')][_0x90f4('0x3a')]};});_0xfa1676['model']=_['map'](_0x5c8029,'name');_0xfa1676[_0x90f4('0x3b')]=_[_0x90f4('0x3c')](_0x250c5a[_0x90f4('0x3b')]);_0xfa1676[_0x90f4('0x3d')]=_[_0x90f4('0x3e')](_0xfa1676['model'],_0xfa1676['query']);_0x545b80['attributes']=_[_0x90f4('0x3e')](_0xfa1676['model'],qs['fields'](_0x250c5a['query'][_0x90f4('0x3f')]));_0x545b80[_0x90f4('0x40')]=_0x545b80['attributes']['length']?_0x545b80[_0x90f4('0x40')]:_0xfa1676[_0x90f4('0x41')];if(!_0x250c5a['query']['hasOwnProperty']('nolimit')){_0x545b80[_0x90f4('0x27')]=qs[_0x90f4('0x27')](_0x250c5a[_0x90f4('0x3b')][_0x90f4('0x27')]);_0x545b80[_0x90f4('0x25')]=qs['offset'](_0x250c5a[_0x90f4('0x3b')][_0x90f4('0x25')]);}_0x545b80[_0x90f4('0x42')]=qs[_0x90f4('0x43')](_0x250c5a[_0x90f4('0x3b')][_0x90f4('0x43')]);_0x545b80['where']=qs[_0x90f4('0x3d')](_['pick'](_0x250c5a['query'],_0xfa1676['filters']),_0x5c8029);if(_0x250c5a[_0x90f4('0x3b')]['filter']){_0x545b80[_0x90f4('0x44')]=_['merge'](_0x545b80[_0x90f4('0x44')],{'$or':_[_0x90f4('0x36')](_0x5c8029,function(_0x218182){if(_0x218182[_0x90f4('0x39')]!==_0x90f4('0x45')){var _0x39af0d={};_0x39af0d[_0x218182['name']]={'$like':'%'+_0x250c5a[_0x90f4('0x3b')][_0x90f4('0x46')]+'%'};return _0x39af0d;}})});}_0x545b80=_[_0x90f4('0x47')]({},_0x545b80,_0x250c5a['options']);var _0x2e9ebf={'where':_0x545b80[_0x90f4('0x44')]};return db['Dashboard'][_0x90f4('0x28')](_0x2e9ebf)['then'](function(_0x340e1b){_0x56e8f7[_0x90f4('0x28')]=_0x340e1b;if(_0x250c5a[_0x90f4('0x3b')][_0x90f4('0x48')]){_0x545b80[_0x90f4('0x49')]=[{'all':!![]}];}return db[_0x90f4('0x4a')][_0x90f4('0x4b')](_0x545b80);})[_0x90f4('0x2e')](function(_0x292f0c){_0x56e8f7['rows']=_0x292f0c;return _0x56e8f7;})[_0x90f4('0x2e')](respondWithFilteredResult(_0x7ddcef,_0x545b80))[_0x90f4('0x4c')](handleError(_0x7ddcef,null));};exports['show']=function(_0x8d6bc,_0x39b4ea){var _0x366f4f={'raw':![],'where':{'id':_0x8d6bc[_0x90f4('0x4d')]['id']}},_0x1158ba={};_0x1158ba[_0x90f4('0x41')]=_[_0x90f4('0x3c')](db[_0x90f4('0x4a')]['rawAttributes']);_0x1158ba[_0x90f4('0x3b')]=_[_0x90f4('0x3c')](_0x8d6bc[_0x90f4('0x3b')]);_0x1158ba[_0x90f4('0x3d')]=_[_0x90f4('0x3e')](_0x1158ba['model'],_0x1158ba['query']);_0x366f4f[_0x90f4('0x40')]=_['intersection'](_0x1158ba['model'],qs[_0x90f4('0x3f')](_0x8d6bc['query'][_0x90f4('0x3f')]));_0x366f4f[_0x90f4('0x40')]=_0x366f4f[_0x90f4('0x40')][_0x90f4('0x4e')]?_0x366f4f[_0x90f4('0x40')]:_0x1158ba[_0x90f4('0x41')];if(_0x8d6bc['query']['includeAll']){_0x366f4f['include']=[{'all':!![]}];}_0x366f4f=_[_0x90f4('0x47')]({},_0x366f4f,_0x8d6bc['options']);return db[_0x90f4('0x4a')][_0x90f4('0x4f')](_0x366f4f)[_0x90f4('0x2e')](handleEntityNotFound(_0x39b4ea,null))[_0x90f4('0x2e')](respondWithResult(_0x39b4ea,null))[_0x90f4('0x4c')](handleError(_0x39b4ea,null));};exports[_0x90f4('0x50')]=function(_0x25a685,_0x36fbb4){return db['Dashboard'][_0x90f4('0x50')](_0x25a685[_0x90f4('0x51')],{})[_0x90f4('0x2e')](function(_0x535bb5){var _0x523995=_0x25a685[_0x90f4('0x52')][_0x90f4('0x53')]({'plain':!![]});if(!_0x523995)throw new Error(_0x90f4('0x54'));if(_0x523995[_0x90f4('0x55')]===_0x90f4('0x52')){var _0x3f921f=_0x535bb5[_0x90f4('0x53')]({'plain':!![]});var _0x4318e7=_0x90f4('0x56');return db[_0x90f4('0x57')][_0x90f4('0x4f')]({'where':{'name':_0x4318e7,'userProfileId':_0x523995['userProfileId']},'raw':!![]})['then'](function(_0xb0e997){if(_0xb0e997&&_0xb0e997['autoAssociation']===0x0){return db[_0x90f4('0x30')]['create']({'name':_0x3f921f[_0x90f4('0x33')],'resourceId':_0x3f921f['id'],'type':_0xb0e997['name'],'sectionId':_0xb0e997['id']},{})[_0x90f4('0x2e')](function(){return _0x535bb5;});}else{return _0x535bb5;}})[_0x90f4('0x4c')](function(_0x266852){logger[_0x90f4('0x32')](_0x90f4('0x58'),_0x266852);throw _0x266852;});}return _0x535bb5;})[_0x90f4('0x2e')](respondWithResult(_0x36fbb4,0xc9))[_0x90f4('0x4c')](handleError(_0x36fbb4,null));};exports[_0x90f4('0x59')]=function(_0x37e0ac,_0x4dba6a){var _0x2fd518={'where':{'id':_0x37e0ac[_0x90f4('0x4d')]['id']}},_0x152f7b={};_0x152f7b[_0x90f4('0x41')]=_[_0x90f4('0x3c')](db[_0x90f4('0x4a')]['rawAttributes']);_0x2fd518[_0x90f4('0x40')]=_['intersection'](_0x152f7b[_0x90f4('0x41')],qs[_0x90f4('0x3f')](_0x37e0ac[_0x90f4('0x3b')][_0x90f4('0x3f')]));_0x2fd518[_0x90f4('0x40')]=_0x2fd518['attributes'][_0x90f4('0x4e')]?_0x2fd518[_0x90f4('0x40')]:_0x152f7b[_0x90f4('0x41')];if(_0x37e0ac['query'][_0x90f4('0x48')]){_0x2fd518[_0x90f4('0x49')]=[{'all':!![]}];}_0x2fd518=_[_0x90f4('0x47')]({},_0x2fd518,_0x37e0ac['options']);return db[_0x90f4('0x4a')][_0x90f4('0x4f')](_0x2fd518)[_0x90f4('0x2e')](handleEntityNotFound(_0x4dba6a,null))[_0x90f4('0x2e')](function(_0x3ec06e){if(_0x3ec06e){var _0x1f3dbd=_0x3ec06e[_0x90f4('0x53')]({'plain':!![]});_0x1f3dbd=qs['omit'](_0x1f3dbd,['id',_0x90f4('0x5a'),'updatedAt']);_0x37e0ac[_0x90f4('0x51')]=_[_0x90f4('0x5b')](_0x37e0ac[_0x90f4('0x51')],['id',_0x90f4('0x5a'),'updatedAt']);return db[_0x90f4('0x4a')][_0x90f4('0x50')](_['merge'](_0x1f3dbd,_0x37e0ac[_0x90f4('0x51')]),{'include':_0x37e0ac['query'][_0x90f4('0x48')]?[{'all':!![]}]:undefined})[_0x90f4('0x2e')](function(_0x36f539){var _0x567753=_0x37e0ac[_0x90f4('0x52')][_0x90f4('0x53')]({'plain':!![]});if(!_0x567753)throw new Error(_0x90f4('0x54'));if(_0x567753['role']==='user'){var _0x1ddf68=_0x36f539[_0x90f4('0x53')]({'plain':!![]});var _0x49c4ac=_0x90f4('0x56');return db['UserProfileSection'][_0x90f4('0x4f')]({'where':{'name':_0x49c4ac,'userProfileId':_0x567753[_0x90f4('0x5c')]},'raw':!![]})[_0x90f4('0x2e')](function(_0x3c0152){if(_0x3c0152&&_0x3c0152[_0x90f4('0x5d')]===0x0){return db[_0x90f4('0x30')][_0x90f4('0x50')]({'name':_0x1ddf68[_0x90f4('0x33')],'resourceId':_0x1ddf68['id'],'type':_0x3c0152[_0x90f4('0x33')],'sectionId':_0x3c0152['id']},{})['then'](function(){return _0x36f539;});}else{return _0x36f539;}})[_0x90f4('0x4c')](function(_0x252ae7){logger[_0x90f4('0x32')](_0x90f4('0x58'),_0x252ae7);throw _0x252ae7;});}return _0x36f539;});}})['then'](respondWithResult(_0x4dba6a,0xc9))[_0x90f4('0x4c')](handleError(_0x4dba6a,null));};exports[_0x90f4('0x2d')]=function(_0x2938ea,_0x187406){if(_0x2938ea[_0x90f4('0x51')]['id']){delete _0x2938ea['body']['id'];}return db[_0x90f4('0x4a')][_0x90f4('0x4f')]({'where':{'id':_0x2938ea[_0x90f4('0x4d')]['id']}})[_0x90f4('0x2e')](handleEntityNotFound(_0x187406,null))[_0x90f4('0x2e')](saveUpdates(_0x2938ea[_0x90f4('0x51')],null))['then'](respondWithResult(_0x187406,null))[_0x90f4('0x4c')](handleError(_0x187406,null));};exports[_0x90f4('0x2f')]=function(_0x3db183,_0x5503f8){return db[_0x90f4('0x4a')][_0x90f4('0x4f')]({'where':{'id':_0x3db183[_0x90f4('0x4d')]['id']}})[_0x90f4('0x2e')](handleEntityNotFound(_0x5503f8,null))['then'](removeEntity(_0x5503f8,null))[_0x90f4('0x4c')](handleError(_0x5503f8,null));};function widgetAttributes(_0x538ad8){try{switch(_0x538ad8['type']){case _0x90f4('0x5e'):return[{'name':'attrUrl','value':_0x538ad8[_0x90f4('0x5f')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8[_0x90f4('0x60')][0x0][_0x90f4('0x61')]:undefined)||'https://'}];case'custom':return[{'name':_0x90f4('0x62'),'value':_0x538ad8['attrPath']||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8[_0x90f4('0x60')][0x0][_0x90f4('0x61')]:undefined)||''}];case _0x90f4('0x63'):return[{'name':_0x90f4('0x64'),'value':_0x538ad8['attrHourFormat']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8[_0x90f4('0x60')][0x0][_0x90f4('0x61')]:undefined)||_0x90f4('0x65')},{'name':_0x90f4('0x66'),'value':_0x538ad8[_0x90f4('0x66')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x1]?_0x538ad8[_0x90f4('0x60')][0x1][_0x90f4('0x61')]:undefined)||'0.00'},{'name':_0x90f4('0x67'),'value':_0x538ad8[_0x90f4('0x67')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x2]?_0x538ad8[_0x90f4('0x60')][0x2][_0x90f4('0x61')]:undefined)||0xc}];case _0x90f4('0x68'):return[{'name':_0x90f4('0x69'),'value':_0x538ad8[_0x90f4('0x69')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8['attrs'][0x0][_0x90f4('0x61')]:undefined)||_0x90f4('0x6a')},{'name':_0x90f4('0x6b'),'value':_0x538ad8[_0x90f4('0x6b')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x1]?_0x538ad8[_0x90f4('0x60')][0x1][_0x90f4('0x61')]:undefined)||[]},{'name':_0x90f4('0x67'),'value':_0x538ad8[_0x90f4('0x67')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x2]?_0x538ad8[_0x90f4('0x60')][0x2]['value']:undefined)||0x14},{'name':_0x90f4('0x6c'),'value':_0x538ad8[_0x90f4('0x6c')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x3]?_0x538ad8[_0x90f4('0x60')][0x3][_0x90f4('0x61')]:undefined)||_0x90f4('0x6d')},{'name':_0x90f4('0x6e'),'value':_0x538ad8['attrEmailAccounts']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8['attrs'][0x4]?_0x538ad8[_0x90f4('0x60')][0x4]['value']:undefined)||''},{'name':_0x90f4('0x6f'),'value':_0x538ad8[_0x90f4('0x6f')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x5]?_0x538ad8['attrs'][0x5][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x70'),'value':_0x538ad8[_0x90f4('0x70')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8['attrs'][0x6]?_0x538ad8['attrs'][0x6][_0x90f4('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x538ad8['attrOpenchannelAccounts']||(_0x538ad8['attrs']&&_0x538ad8['attrs'][0x7]?_0x538ad8[_0x90f4('0x60')][0x7][_0x90f4('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x538ad8['attrWhatsappAccounts']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x8]?_0x538ad8[_0x90f4('0x60')][0x8][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x71'),'value':_0x538ad8[_0x90f4('0x71')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x9]?_0x538ad8['attrs'][0x9]['value']:undefined)||''}];case _0x90f4('0x72'):case _0x90f4('0x73'):return[{'name':_0x90f4('0x74'),'value':_0x538ad8[_0x90f4('0x74')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8['attrs'][0x0][_0x90f4('0x61')]:undefined)||_0x90f4('0x6a')},{'name':_0x90f4('0x75'),'value':_0x538ad8['attrSerie2']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x1]?_0x538ad8[_0x90f4('0x60')][0x1][_0x90f4('0x61')]:undefined)||null},{'name':_0x90f4('0x76'),'value':_0x538ad8['attrSerie3']||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x2]?_0x538ad8[_0x90f4('0x60')][0x2][_0x90f4('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x538ad8['attrVoiceQueues']||(_0x538ad8['attrs']&&_0x538ad8['attrs'][0x3]?_0x538ad8['attrs'][0x3][_0x90f4('0x61')]:undefined)||[]},{'name':'attrChannel','value':_0x538ad8[_0x90f4('0x6c')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x4]?_0x538ad8[_0x90f4('0x60')][0x4][_0x90f4('0x61')]:undefined)||'voice'},{'name':_0x90f4('0x6e'),'value':_0x538ad8['attrEmailAccounts']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8['attrs'][0x5]?_0x538ad8[_0x90f4('0x60')][0x5]['value']:undefined)||''},{'name':_0x90f4('0x6f'),'value':_0x538ad8[_0x90f4('0x6f')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x6]?_0x538ad8[_0x90f4('0x60')][0x6][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x70'),'value':_0x538ad8['attrSmsAccounts']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8['attrs'][0x7]?_0x538ad8[_0x90f4('0x60')][0x7][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x77'),'value':_0x538ad8[_0x90f4('0x77')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x8]?_0x538ad8[_0x90f4('0x60')][0x8][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x78'),'value':_0x538ad8[_0x90f4('0x78')]||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x9]?_0x538ad8['attrs'][0x9][_0x90f4('0x61')]:undefined)||''},{'name':_0x90f4('0x71'),'value':_0x538ad8[_0x90f4('0x71')]||(_0x538ad8['attrs']&&_0x538ad8['attrs'][0xa]?_0x538ad8[_0x90f4('0x60')][0xa][_0x90f4('0x61')]:undefined)||''}];case _0x90f4('0x79'):return[{'name':'attrReport','type':_0x538ad8[_0x90f4('0x7a')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8[_0x90f4('0x60')][0x0][_0x90f4('0x39')]:undefined)||null,'value':_0x538ad8[_0x90f4('0x7b')]||(_0x538ad8['attrs']&&_0x538ad8[_0x90f4('0x60')][0x0]?_0x538ad8[_0x90f4('0x60')][0x0][_0x90f4('0x61')]:undefined)||null},{'name':_0x90f4('0x7c'),'value':_0x538ad8['attrRefresh']||(_0x538ad8[_0x90f4('0x60')]&&_0x538ad8[_0x90f4('0x60')][0x1]?_0x538ad8[_0x90f4('0x60')][0x1][_0x90f4('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x4b645c){logger[_0x90f4('0x32')](_0x90f4('0x7d'),JSON['stringify'](_0x4b645c));return[];}}exports[_0x90f4('0x7e')]=function(_0xcb2e91,_0x549233,_0xeade5){if(_0xcb2e91[_0x90f4('0x51')]['id']){delete _0xcb2e91[_0x90f4('0x51')]['id'];}return db[_0x90f4('0x4a')]['find']({'where':{'id':_0xcb2e91[_0x90f4('0x4d')]['id']}})[_0x90f4('0x2e')](handleEntityNotFound(_0x549233,null))[_0x90f4('0x2e')](function(_0x5f09c4){if(_0x5f09c4){_0xcb2e91['body']['DashboardId']=_0x5f09c4['id'];_0xcb2e91[_0x90f4('0x51')]['attrs']=widgetAttributes(_0xcb2e91[_0x90f4('0x51')]);return db[_0x90f4('0x7f')][_0x90f4('0x50')](_0xcb2e91[_0x90f4('0x51')]);}})[_0x90f4('0x2e')](respondWithResult(_0x549233,null))[_0x90f4('0x4c')](handleError(_0x549233,null));};exports[_0x90f4('0x80')]=function(_0x18dc94,_0x545081,_0x39d81e){var _0x184be3={};var _0x46656a={};var _0x2c5278;var _0x2b1f3d;return db[_0x90f4('0x4a')][_0x90f4('0x81')]({'where':{'id':_0x18dc94[_0x90f4('0x4d')]['id']}})[_0x90f4('0x2e')](handleEntityNotFound(_0x545081,null))[_0x90f4('0x2e')](function(_0x2cd603){if(_0x2cd603){_0x2c5278=_0x2cd603;_0x46656a[_0x90f4('0x41')]=_[_0x90f4('0x3c')](db[_0x90f4('0x7f')][_0x90f4('0x37')]);_0x46656a[_0x90f4('0x3b')]=_['keys'](_0x18dc94['query']);_0x46656a['filters']=_[_0x90f4('0x3e')](_0x46656a[_0x90f4('0x41')],_0x46656a[_0x90f4('0x3b')]);_0x184be3[_0x90f4('0x40')]=_[_0x90f4('0x3e')](_0x46656a[_0x90f4('0x41')],qs[_0x90f4('0x3f')](_0x18dc94[_0x90f4('0x3b')][_0x90f4('0x3f')]));_0x184be3[_0x90f4('0x40')]=_0x184be3['attributes'][_0x90f4('0x4e')]?_0x184be3['attributes']:_0x46656a[_0x90f4('0x41')];_0x184be3[_0x90f4('0x42')]=qs[_0x90f4('0x43')](_0x18dc94['query'][_0x90f4('0x43')]);_0x184be3[_0x90f4('0x44')]=qs[_0x90f4('0x3d')](_[_0x90f4('0x82')](_0x18dc94[_0x90f4('0x3b')],_0x46656a[_0x90f4('0x3d')]));if(_0x18dc94[_0x90f4('0x3b')][_0x90f4('0x46')]){_0x184be3['where']=_[_0x90f4('0x47')](_0x184be3['where'],{'$or':_['map'](_0x184be3[_0x90f4('0x40')],function(_0x52c6e8){var _0x8a7476={};_0x8a7476[_0x52c6e8]={'$like':'%'+_0x18dc94[_0x90f4('0x3b')][_0x90f4('0x46')]+'%'};return _0x8a7476;})});}_0x184be3=_[_0x90f4('0x47')]({},_0x184be3,_0x18dc94[_0x90f4('0x83')]);return _0x2c5278['getItems'](_0x184be3);}})[_0x90f4('0x2e')](function(_0x4cad96){if(_0x4cad96){_0x2b1f3d=_0x4cad96[_0x90f4('0x4e')];if(!_0x18dc94[_0x90f4('0x3b')][_0x90f4('0x84')](_0x90f4('0x85'))){_0x184be3[_0x90f4('0x27')]=qs['limit'](_0x18dc94['query'][_0x90f4('0x27')]);_0x184be3[_0x90f4('0x25')]=qs[_0x90f4('0x25')](_0x18dc94['query'][_0x90f4('0x25')]);}return _0x2c5278['getItems'](_0x184be3);}})['then'](function(_0x329685){if(_0x329685){return _0x329685?{'count':_0x2b1f3d,'rows':_0x329685}:null;}})[_0x90f4('0x2e')](respondWithResult(_0x545081,null))[_0x90f4('0x4c')](handleError(_0x545081,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e21cf62..1343d87 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 _0x70c8=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x1869e6,_0x51a581){var _0x2742b9=function(_0x153561){while(--_0x153561){_0x1869e6['push'](_0x1869e6['shift']());}};_0x2742b9(++_0x51a581);}(_0x70c8,0x7d));var _0x870c=function(_0x2db2e7,_0xff9a99){_0x2db2e7=_0x2db2e7-0x0;var _0xb321cd=_0x70c8[_0x2db2e7];return _0xb321cd;};'use strict';var EventEmitter=require(_0x870c('0x0'));var Dashboard=require(_0x870c('0x1'))['db'][_0x870c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x870c('0x3')](0x0);var events={'afterCreate':_0x870c('0x4'),'afterUpdate':_0x870c('0x5'),'afterDestroy':_0x870c('0x6')};function emitEvent(_0x3740dc){return function(_0x3c45b9,_0x59ba7a,_0x1b300b){DashboardEvents[_0x870c('0x7')](_0x3740dc+':'+_0x3c45b9['id'],_0x3c45b9);DashboardEvents['emit'](_0x3740dc,_0x3c45b9);_0x1b300b(null);};}for(var e in events){if(events[_0x870c('0x8')](e)){var event=events[e];Dashboard[_0x870c('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x2f4a=['events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2f4a[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xa2f4('0x0'));var Dashboard=require(_0xa2f4('0x1'))['db'][_0xa2f4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa2f4('0x3')](0x0);var events={'afterCreate':_0xa2f4('0x4'),'afterUpdate':_0xa2f4('0x5'),'afterDestroy':_0xa2f4('0x6')};function emitEvent(_0x17ea32){return function(_0x3ba23a,_0x24aaf4,_0x4b22d6){DashboardEvents[_0xa2f4('0x7')](_0x17ea32+':'+_0x3ba23a['id'],_0x3ba23a);DashboardEvents[_0xa2f4('0x7')](_0x17ea32,_0x3ba23a);_0x4b22d6(null);};}for(var e in events){if(events[_0xa2f4('0x8')](e)){var event=events[e];Dashboard[_0xa2f4('0x9')](e,emitEvent(event));}}module[_0xa2f4('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7fef24a..bcafb15 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 _0xc00a=['util','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','define','Dashboard','lodash'];(function(_0x43071b,_0x1ce820){var _0x5553ff=function(_0x1727b4){while(--_0x1727b4){_0x43071b['push'](_0x43071b['shift']());}};_0x5553ff(++_0x1ce820);}(_0xc00a,0x1f3));var _0xac00=function(_0x12b859,_0x40804e){_0x12b859=_0x12b859-0x0;var _0x867976=_0xc00a[_0x12b859];return _0x867976;};'use strict';var _=require(_0xac00('0x0'));var util=require(_0xac00('0x1'));var logger=require('../../config/logger')(_0xac00('0x2'));var moment=require(_0xac00('0x3'));var BPromise=require(_0xac00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac00('0x5'));var rimraf=require('rimraf');var config=require(_0xac00('0x6'));var attributes=require(_0xac00('0x7'));module['exports']=function(_0x1487dd,_0x1344d0){return _0x1487dd[_0xac00('0x8')](_0xac00('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34eb=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards'];(function(_0x5f288e,_0x5227fa){var _0x5bcc88=function(_0xe4b2b2){while(--_0xe4b2b2){_0x5f288e['push'](_0x5f288e['shift']());}};_0x5bcc88(++_0x5227fa);}(_0x34eb,0x180));var _0xb34e=function(_0x2522c4,_0x360c6c){_0x2522c4=_0x2522c4-0x0;var _0x44bba6=_0x34eb[_0x2522c4];return _0x44bba6;};'use strict';var _=require(_0xb34e('0x0'));var util=require(_0xb34e('0x1'));var logger=require(_0xb34e('0x2'))(_0xb34e('0x3'));var moment=require('moment');var BPromise=require(_0xb34e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb34e('0x5'));var rimraf=require(_0xb34e('0x6'));var config=require(_0xb34e('0x7'));var attributes=require(_0xb34e('0x8'));module[_0xb34e('0x9')]=function(_0x18651f,_0x471943){return _0x18651f['define'](_0xb34e('0xa'),attributes,{'tableName':_0xb34e('0xb'),'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 c0c3b06..41b42a6 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 _0x6334=['then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request'];(function(_0x26c8e0,_0x1eb33d){var _0x1de4d4=function(_0x67fae4){while(--_0x67fae4){_0x26c8e0['push'](_0x26c8e0['shift']());}};_0x1de4d4(++_0x1eb33d);}(_0x6334,0x119));var _0x4633=function(_0x872f6f,_0x5efe7b){_0x872f6f=_0x872f6f-0x0;var _0x59a5f4=_0x6334[_0x872f6f];return _0x59a5f4;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});config['redis']=_[_0x4633('0xd')](config['redis'],{'host':_0x4633('0xe'),'port':0x18eb});var socket=require(_0x4633('0xf'))(new Redis(config['redis']));require(_0x4633('0x10'))[_0x4633('0x11')](socket);function respondWithRpcPromise(_0x4018ba,_0x591266,_0x45a590){return new BPromise(function(_0x2f07fa,_0x5157a7){return client[_0x4633('0x12')](_0x4018ba,_0x45a590)[_0x4633('0x13')](function(_0x42fe10){logger[_0x4633('0x14')]('Dashboard,\x20%s,\x20%s',_0x591266,_0x4633('0x15'));logger[_0x4633('0x16')](_0x4633('0x17'),_0x591266,'request\x20sent',JSON['stringify'](_0x42fe10));if(_0x42fe10['error']){if(_0x42fe10[_0x4633('0x18')][_0x4633('0x19')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x591266,_0x42fe10[_0x4633('0x18')]['message']);return _0x5157a7(_0x42fe10[_0x4633('0x18')][_0x4633('0x1a')]);}logger[_0x4633('0x18')](_0x4633('0x1b'),_0x591266,_0x42fe10['error'][_0x4633('0x1a')]);return _0x2f07fa(_0x42fe10[_0x4633('0x18')][_0x4633('0x1a')]);}else{logger['info'](_0x4633('0x1b'),_0x591266,_0x4633('0x15'));_0x2f07fa(_0x42fe10[_0x4633('0x1c')][_0x4633('0x1a')]);}})[_0x4633('0x1d')](function(_0x5953b8){logger[_0x4633('0x18')](_0x4633('0x1b'),_0x591266,_0x5953b8);_0x5157a7(_0x5953b8);});});} \ No newline at end of file +var _0xa0c1=['rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xa0c1,0x1c6));var _0x1a0c=function(_0x17e303,_0x2b2680){_0x17e303=_0x17e303-0x0;var _0x5554f9=_0xa0c1[_0x17e303];return _0x5554f9;};'use strict';var _=require(_0x1a0c('0x0'));var util=require('util');var moment=require(_0x1a0c('0x1'));var BPromise=require('bluebird');var rs=require(_0x1a0c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a0c('0x3'));var logger=require(_0x1a0c('0x4'))(_0x1a0c('0x5'));var config=require(_0x1a0c('0x6'));var jayson=require(_0x1a0c('0x7'));var client=jayson[_0x1a0c('0x8')][_0x1a0c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x1a0c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a0c('0xb')]));require(_0x1a0c('0xc'))[_0x1a0c('0xd')](socket);function respondWithRpcPromise(_0x3bd13c,_0x28eb67,_0x5467e6){return new BPromise(function(_0x3315db,_0x5f363c){return client[_0x1a0c('0xe')](_0x3bd13c,_0x5467e6)[_0x1a0c('0xf')](function(_0xd4dec4){logger[_0x1a0c('0x10')]('Dashboard,\x20%s,\x20%s',_0x28eb67,_0x1a0c('0x11'));logger[_0x1a0c('0x12')](_0x1a0c('0x13'),_0x28eb67,_0x1a0c('0x11'),JSON[_0x1a0c('0x14')](_0xd4dec4));if(_0xd4dec4[_0x1a0c('0x15')]){if(_0xd4dec4[_0x1a0c('0x15')][_0x1a0c('0x16')]===0x1f4){logger[_0x1a0c('0x15')]('Dashboard,\x20%s,\x20%s',_0x28eb67,_0xd4dec4[_0x1a0c('0x15')][_0x1a0c('0x17')]);return _0x5f363c(_0xd4dec4[_0x1a0c('0x15')][_0x1a0c('0x17')]);}logger[_0x1a0c('0x15')]('Dashboard,\x20%s,\x20%s',_0x28eb67,_0xd4dec4['error']['message']);return _0x3315db(_0xd4dec4[_0x1a0c('0x15')][_0x1a0c('0x17')]);}else{logger[_0x1a0c('0x10')](_0x1a0c('0x18'),_0x28eb67,_0x1a0c('0x11'));_0x3315db(_0xd4dec4[_0x1a0c('0x19')][_0x1a0c('0x17')]);}})[_0x1a0c('0x1a')](function(_0x29e772){logger[_0x1a0c('0x15')](_0x1a0c('0x18'),_0x28eb67,_0x29e772);_0x5f363c(_0x29e772);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9657490..4851f2c 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 _0xdae4=['save','update','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x20d5d3,_0x23693a){var _0x2f0a5a=function(_0x3002ee){while(--_0x3002ee){_0x20d5d3['push'](_0x20d5d3['shift']());}};_0x2f0a5a(++_0x23693a);}(_0xdae4,0x77));var _0x4dae=function(_0x7f3ee7,_0x5705e7){_0x7f3ee7=_0x7f3ee7-0x0;var _0x54dc76=_0xdae4[_0x7f3ee7];return _0x54dc76;};'use strict';var DashboardEvents=require(_0x4dae('0x0'));var events=[_0x4dae('0x1'),'remove',_0x4dae('0x2')];function createListener(_0x5b744d,_0x48148c){return function(_0x4031a2){_0x48148c[_0x4dae('0x3')](_0x5b744d,_0x4031a2);};}function removeListener(_0x47412e,_0xc5ce28){return function(){DashboardEvents[_0x4dae('0x4')](_0x47412e,_0xc5ce28);};}exports[_0x4dae('0x5')]=function(_0x5426fd){for(var _0x4fa078=0x0,_0x57b860=events[_0x4dae('0x6')];_0x4fa078<_0x57b860;_0x4fa078++){var _0x568485=events[_0x4fa078];var _0x1a4e45=createListener(_0x4dae('0x7')+_0x568485,_0x5426fd);DashboardEvents['on'](_0x568485,_0x1a4e45);}}; \ No newline at end of file +var _0x507d=['emit','length','./dashboard.events','remove'];(function(_0x57db4c,_0x8f9084){var _0x1758f2=function(_0x141a33){while(--_0x141a33){_0x57db4c['push'](_0x57db4c['shift']());}};_0x1758f2(++_0x8f9084);}(_0x507d,0x172));var _0xd507=function(_0xcb11fe,_0x7fe058){_0xcb11fe=_0xcb11fe-0x0;var _0x22da50=_0x507d[_0xcb11fe];return _0x22da50;};'use strict';var DashboardEvents=require(_0xd507('0x0'));var events=['save',_0xd507('0x1'),'update'];function createListener(_0x10b7e8,_0x221c04){return function(_0x13a997){_0x221c04[_0xd507('0x2')](_0x10b7e8,_0x13a997);};}function removeListener(_0x35748f,_0x2a68cc){return function(){DashboardEvents['removeListener'](_0x35748f,_0x2a68cc);};}exports['register']=function(_0x5b233b){for(var _0x37df91=0x0,_0xfc5310=events[_0xd507('0x3')];_0x37df91<_0xfc5310;_0x37df91++){var _0x15f62a=events[_0x37df91];var _0x2ab0db=createListener('dashboard:'+_0x15f62a,_0x5b233b);DashboardEvents['on'](_0x15f62a,_0x2ab0db);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d2516ee..199250f 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 _0xca16=['index','show','/:id/items','getItems','post','create','clone','put','/:id','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0xca16,0xd2));var _0x6ca1=function(_0x5cc572,_0x4feeb2){_0x5cc572=_0x5cc572-0x0;var _0x394365=_0xca16[_0x5cc572];return _0x394365;};'use strict';var multer=require(_0x6ca1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca1('0x1'));var express=require('express');var router=express[_0x6ca1('0x2')]();var fs_extra=require(_0x6ca1('0x3'));var auth=require(_0x6ca1('0x4'));var interaction=require(_0x6ca1('0x5'));var config=require(_0x6ca1('0x6'));var controller=require(_0x6ca1('0x7'));router[_0x6ca1('0x8')]('/',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xa')]);router['get']('/:id',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xb')]);router[_0x6ca1('0x8')](_0x6ca1('0xc'),auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xd')]);router[_0x6ca1('0xe')]('/',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0xf')]);router[_0x6ca1('0xe')]('/:id/clone',auth[_0x6ca1('0x9')](),controller[_0x6ca1('0x10')]);router[_0x6ca1('0xe')]('/:id/items',auth[_0x6ca1('0x9')](),controller['addItem']);router[_0x6ca1('0x11')](_0x6ca1('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x6ca1('0x13')](_0x6ca1('0x12'),auth[_0x6ca1('0x9')](),controller[_0x6ca1('0x14')]);module[_0x6ca1('0x15')]=router; \ No newline at end of file +var _0xe612=['Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','clone','put','update','delete','destroy','exports','util','path','express'];(function(_0x241e61,_0x51e5ea){var _0x409de4=function(_0x1ccc72){while(--_0x1ccc72){_0x241e61['push'](_0x241e61['shift']());}};_0x409de4(++_0x51e5ea);}(_0xe612,0x66));var _0x2e61=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xe612[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x2e61('0x0'));var path=require(_0x2e61('0x1'));var timeout=require('connect-timeout');var express=require(_0x2e61('0x2'));var router=express[_0x2e61('0x3')]();var fs_extra=require(_0x2e61('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2e61('0x5'));var config=require(_0x2e61('0x6'));var controller=require(_0x2e61('0x7'));router[_0x2e61('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2e61('0x8')](_0x2e61('0x9'),auth[_0x2e61('0xa')](),controller['show']);router[_0x2e61('0x8')](_0x2e61('0xb'),auth[_0x2e61('0xa')](),controller[_0x2e61('0xc')]);router[_0x2e61('0xd')]('/',auth[_0x2e61('0xa')](),controller[_0x2e61('0xe')]);router[_0x2e61('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0x2e61('0xf')]);router['post'](_0x2e61('0xb'),auth[_0x2e61('0xa')](),controller['addItem']);router[_0x2e61('0x10')](_0x2e61('0x9'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x11')]);router[_0x2e61('0x12')](_0x2e61('0x9'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x13')]);module[_0x2e61('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index eb2303f..70265f7 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 _0xf494=['squel','lodash','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','sequelize'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xf494,0x1c6));var _0x4f49=function(_0x446eac,_0x29f115){_0x446eac=_0x446eac-0x0;var _0x2d0614=_0xf494[_0x446eac];return _0x2d0614;};'use strict';var Sequelize=require(_0x4f49('0x0'));var squel=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));module['exports']={'title':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4f49('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5')),'get':function(){try{return JSON[_0x4f49('0x6')](this[_0x4f49('0x7')](_0x4f49('0x8')));}catch(_0x790e8b){return[];}},'set':function(_0xc5e778){try{this[_0x4f49('0x9')](_0x4f49('0x8'),JSON['stringify'](_0xc5e778));}catch(_0x58e9a0){this[_0x4f49('0x9')](_0x4f49('0x8'),JSON[_0x4f49('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4f49('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4f49('0xb')]},'col':{'type':Sequelize[_0x4f49('0xb')]},'background':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4f49('0x3')],'allowNull':![],'defaultValue':_0x4f49('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x4f49('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x1623,0xab));var _0x3162=function(_0x3efa2d,_0x29bbc6){_0x3efa2d=_0x3efa2d-0x0;var _0x32e59b=_0x1623[_0x3efa2d];return _0x32e59b;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('0x8')],'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 1ef2bbf..db70d95 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 _0xc963=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','model','keys','DashboardItem','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','params','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc963,0x17f));var _0x3c96=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xc963[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require(_0x3c96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c96('0x1'));var rp=require(_0x3c96('0x2'));var moment=require(_0x3c96('0x3'));var BPromise=require(_0x3c96('0x4'));var Mustache=require(_0x3c96('0x5'));var util=require('util');var path=require(_0x3c96('0x6'));var sox=require(_0x3c96('0x7'));var csv=require(_0x3c96('0x8'));var ejs=require(_0x3c96('0x9'));var fs=require('fs');var fs_extra=require(_0x3c96('0xa'));var _=require('lodash');var squel=require(_0x3c96('0xb'));var crypto=require(_0x3c96('0xc'));var jsforce=require(_0x3c96('0xd'));var deskjs=require(_0x3c96('0xe'));var toCsv=require(_0x3c96('0x8'));var querystring=require(_0x3c96('0xf'));var Papa=require(_0x3c96('0x10'));var Redis=require(_0x3c96('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3c96('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c96('0x13'));var logger=require(_0x3c96('0x14'))('api');var utils=require(_0x3c96('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c96('0x16'))['db'];config[_0x3c96('0x17')]=_[_0x3c96('0x18')](config[_0x3c96('0x17')],{'host':_0x3c96('0x19'),'port':0x18eb});var socket=require(_0x3c96('0x1a'))(new Redis(config[_0x3c96('0x17')]));require(_0x3c96('0x1b'))[_0x3c96('0x1c')](socket);function respondWithStatusCode(_0xd79802,_0x4637b0){_0x4637b0=_0x4637b0||0xcc;return function(_0x10ea6d){if(_0x10ea6d){return _0xd79802[_0x3c96('0x1d')](_0x4637b0);}return _0xd79802[_0x3c96('0x1e')](_0x4637b0)['end']();};}function respondWithResult(_0x3720a3,_0x1bc526){_0x1bc526=_0x1bc526||0xc8;return function(_0x5bfb66){if(_0x5bfb66){return _0x3720a3[_0x3c96('0x1e')](_0x1bc526)[_0x3c96('0x1f')](_0x5bfb66);}};}function respondWithFilteredResult(_0x3ba1e4,_0xa10667){return function(_0x4cc321){if(_0x4cc321){var _0x4a3600=typeof _0xa10667[_0x3c96('0x20')]===_0x3c96('0x21')&&typeof _0xa10667[_0x3c96('0x22')]===_0x3c96('0x21');var _0xc4a84d=_0x4cc321[_0x3c96('0x23')];var _0x15aa1d=_0x4a3600?0x0:_0xa10667[_0x3c96('0x20')];var _0x4eca85=_0x4a3600?_0x4cc321[_0x3c96('0x23')]:_0xa10667[_0x3c96('0x20')]+_0xa10667[_0x3c96('0x22')];var _0x3daaf8;if(_0x4eca85>=_0xc4a84d){_0x4eca85=_0xc4a84d;_0x3daaf8=0xc8;}else{_0x3daaf8=0xce;}_0x3ba1e4[_0x3c96('0x1e')](_0x3daaf8);return _0x3ba1e4[_0x3c96('0x24')]('Content-Range',_0x15aa1d+'-'+_0x4eca85+'/'+_0xc4a84d)[_0x3c96('0x1f')](_0x4cc321);}return null;};}function patchUpdates(_0x2bc43d){return function(_0x51bebb){try{jsonpatch[_0x3c96('0x25')](_0x51bebb,_0x2bc43d,!![]);}catch(_0x2e6aed){return BPromise[_0x3c96('0x26')](_0x2e6aed);}return _0x51bebb[_0x3c96('0x27')]();};}function saveUpdates(_0x24c88d,_0x4f91cb){return function(_0x4f2e0){if(_0x4f2e0){return _0x4f2e0[_0x3c96('0x28')](_0x24c88d)[_0x3c96('0x29')](function(_0x3a95f7){return _0x3a95f7;});}return null;};}function removeEntity(_0x446c10,_0x3d8900){return function(_0x1771d9){if(_0x1771d9){return _0x1771d9[_0x3c96('0x2a')]()[_0x3c96('0x29')](function(){_0x446c10['status'](0xcc)[_0x3c96('0x2b')]();});}};}function handleEntityNotFound(_0x48f72d,_0x30180b){return function(_0x521350){if(!_0x521350){_0x48f72d['sendStatus'](0x194);}return _0x521350;};}function handleError(_0x253cf0,_0x3a237e){_0x3a237e=_0x3a237e||0x1f4;return function(_0x76c23c){logger[_0x3c96('0x2c')](_0x76c23c[_0x3c96('0x2d')]);if(_0x76c23c[_0x3c96('0x2e')]){delete _0x76c23c[_0x3c96('0x2e')];}_0x253cf0[_0x3c96('0x1e')](_0x3a237e)[_0x3c96('0x2f')](_0x76c23c);};}exports[_0x3c96('0x30')]=function(_0x7a44ed,_0x1a64e7){var _0xebaa9e={'raw':![],'where':{'id':_0x7a44ed['params']['id']}},_0x369170={};_0x369170[_0x3c96('0x31')]=_[_0x3c96('0x32')](db[_0x3c96('0x33')]['rawAttributes']);_0x369170[_0x3c96('0x34')]=_[_0x3c96('0x32')](_0x7a44ed['query']);_0x369170[_0x3c96('0x35')]=_[_0x3c96('0x36')](_0x369170['model'],_0x369170[_0x3c96('0x34')]);_0xebaa9e[_0x3c96('0x37')]=_[_0x3c96('0x36')](_0x369170[_0x3c96('0x31')],qs[_0x3c96('0x38')](_0x7a44ed[_0x3c96('0x34')][_0x3c96('0x38')]));_0xebaa9e[_0x3c96('0x37')]=_0xebaa9e[_0x3c96('0x37')]['length']?_0xebaa9e[_0x3c96('0x37')]:_0x369170[_0x3c96('0x31')];if(_0x7a44ed[_0x3c96('0x34')][_0x3c96('0x39')]){_0xebaa9e[_0x3c96('0x3a')]=[{'all':!![]}];}_0xebaa9e=_[_0x3c96('0x3b')]({},_0xebaa9e,_0x7a44ed[_0x3c96('0x3c')]);return db['DashboardItem'][_0x3c96('0x3d')](_0xebaa9e)[_0x3c96('0x29')](handleEntityNotFound(_0x1a64e7,null))[_0x3c96('0x29')](respondWithResult(_0x1a64e7,null))[_0x3c96('0x3e')](handleError(_0x1a64e7,null));};exports[_0x3c96('0x2a')]=function(_0x31556e,_0x1ea7a8){return db[_0x3c96('0x33')][_0x3c96('0x3d')]({'where':{'id':_0x31556e[_0x3c96('0x3f')]['id']}})[_0x3c96('0x29')](handleEntityNotFound(_0x1ea7a8,null))[_0x3c96('0x29')](removeEntity(_0x1ea7a8,null))['catch'](handleError(_0x1ea7a8,null));};function widgetAttributes(_0x2ed687){try{switch(_0x2ed687['type']){case _0x3c96('0x40'):return[{'name':_0x3c96('0x41'),'value':_0x2ed687[_0x3c96('0x41')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x44')}];case'custom':return[{'name':_0x3c96('0x45'),'value':_0x2ed687[_0x3c96('0x45')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||''}];case _0x3c96('0x46'):return[{'name':_0x3c96('0x47'),'value':_0x2ed687['attrHourFormat']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687['attrs'][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x48')},{'name':_0x3c96('0x49'),'value':_0x2ed687[_0x3c96('0x49')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x1]?_0x2ed687['attrs'][0x1][_0x3c96('0x43')]:undefined)||_0x3c96('0x4a')},{'name':_0x3c96('0x4b'),'value':_0x2ed687['attrFontSize']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x3c96('0x4c'),'value':_0x2ed687['attrMetric']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||_0x3c96('0x4d')},{'name':'attrVoiceQueues','value':_0x2ed687[_0x3c96('0x4e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x1]?_0x2ed687[_0x3c96('0x42')][0x1][_0x3c96('0x43')]:undefined)||[]},{'name':_0x3c96('0x4b'),'value':_0x2ed687[_0x3c96('0x4b')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||0x14},{'name':_0x3c96('0x4f'),'value':_0x2ed687[_0x3c96('0x4f')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x3]?_0x2ed687[_0x3c96('0x42')][0x3][_0x3c96('0x43')]:undefined)||'voice'},{'name':_0x3c96('0x50'),'value':_0x2ed687[_0x3c96('0x50')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x4]?_0x2ed687['attrs'][0x4][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x51'),'value':_0x2ed687['attrFaxAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x5]?_0x2ed687[_0x3c96('0x42')][0x5][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x52'),'value':_0x2ed687[_0x3c96('0x52')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x6]?_0x2ed687[_0x3c96('0x42')][0x6][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x53'),'value':_0x2ed687['attrOpenchannelAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x7]?_0x2ed687[_0x3c96('0x42')][0x7][_0x3c96('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2ed687[_0x3c96('0x54')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x8]?_0x2ed687[_0x3c96('0x42')][0x8][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x55'),'value':_0x2ed687[_0x3c96('0x55')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x9]?_0x2ed687['attrs'][0x9]['value']:undefined)||''}];case _0x3c96('0x56'):case'pie-chart':return[{'name':_0x3c96('0x57'),'value':_0x2ed687[_0x3c96('0x57')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||'total'},{'name':_0x3c96('0x58'),'value':_0x2ed687['attrSerie2']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x1]?_0x2ed687[_0x3c96('0x42')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2ed687[_0x3c96('0x59')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x2]?_0x2ed687['attrs'][0x2][_0x3c96('0x43')]:undefined)||null},{'name':_0x3c96('0x4e'),'value':_0x2ed687[_0x3c96('0x4e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x3]?_0x2ed687[_0x3c96('0x42')][0x3][_0x3c96('0x43')]:undefined)||[]},{'name':_0x3c96('0x4f'),'value':_0x2ed687[_0x3c96('0x4f')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x4]?_0x2ed687[_0x3c96('0x42')][0x4][_0x3c96('0x43')]:undefined)||_0x3c96('0x5a')},{'name':_0x3c96('0x50'),'value':_0x2ed687[_0x3c96('0x50')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x5]?_0x2ed687['attrs'][0x5]['value']:undefined)||''},{'name':_0x3c96('0x51'),'value':_0x2ed687[_0x3c96('0x51')]||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x6]?_0x2ed687[_0x3c96('0x42')][0x6]['value']:undefined)||''},{'name':_0x3c96('0x52'),'value':_0x2ed687[_0x3c96('0x52')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x7]?_0x2ed687[_0x3c96('0x42')][0x7][_0x3c96('0x43')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2ed687['attrOpenchannelAccounts']||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0x8]?_0x2ed687[_0x3c96('0x42')][0x8][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x54'),'value':_0x2ed687['attrWhatsappAccounts']||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x9]?_0x2ed687[_0x3c96('0x42')][0x9][_0x3c96('0x43')]:undefined)||''},{'name':_0x3c96('0x55'),'value':_0x2ed687['attrChatWebsites']||(_0x2ed687['attrs']&&_0x2ed687[_0x3c96('0x42')][0xa]?_0x2ed687[_0x3c96('0x42')][0xa][_0x3c96('0x43')]:undefined)||''}];case'web-report':return[{'name':_0x3c96('0x5b'),'type':_0x2ed687[_0x3c96('0x5c')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x5d')]:undefined)||null,'value':_0x2ed687[_0x3c96('0x5b')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687[_0x3c96('0x42')][0x0]?_0x2ed687[_0x3c96('0x42')][0x0][_0x3c96('0x43')]:undefined)||null},{'name':_0x3c96('0x5e'),'value':_0x2ed687[_0x3c96('0x5e')]||(_0x2ed687[_0x3c96('0x42')]&&_0x2ed687['attrs'][0x1]?_0x2ed687[_0x3c96('0x42')][0x1][_0x3c96('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x3823a6){logger['error'](_0x3c96('0x5f'),JSON['stringify'](_0x3823a6));return[];}}exports[_0x3c96('0x60')]=function(_0x585cb3,_0x276e00){if(_0x585cb3[_0x3c96('0x61')]){_0x585cb3[_0x3c96('0x61')][_0x3c96('0x42')]=widgetAttributes(_0x585cb3['body']);}return db[_0x3c96('0x33')][_0x3c96('0x60')](_0x585cb3['body'],{})['then'](respondWithResult(_0x276e00,0xc9))[_0x3c96('0x3e')](handleError(_0x276e00,null));};exports[_0x3c96('0x28')]=function(_0x7afe73,_0x53442d){if(_0x7afe73[_0x3c96('0x61')]['id']){delete _0x7afe73['body']['id'];}_0x7afe73[_0x3c96('0x61')][_0x3c96('0x42')]=widgetAttributes(_0x7afe73[_0x3c96('0x61')]);return db[_0x3c96('0x33')]['find']({'where':{'id':_0x7afe73[_0x3c96('0x3f')]['id']}})[_0x3c96('0x29')](handleEntityNotFound(_0x53442d,null))['then'](saveUpdates(_0x7afe73[_0x3c96('0x61')],null))[_0x3c96('0x29')](respondWithResult(_0x53442d,null))['catch'](handleError(_0x53442d,null));}; \ No newline at end of file +var _0xaee6=['moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4ef178,_0x301012){var _0xc1e428=function(_0x531207){while(--_0x531207){_0x4ef178['push'](_0x4ef178['shift']());}};_0xc1e428(++_0x301012);}(_0xaee6,0x187));var _0x6aee=function(_0xcfe8f9,_0x34a093){_0xcfe8f9=_0xcfe8f9-0x0;var _0x37b36f=_0xaee6[_0xcfe8f9];return _0x37b36f;};'use strict';var emlformat=require(_0x6aee('0x0'));var rimraf=require(_0x6aee('0x1'));var zipdir=require(_0x6aee('0x2'));var jsonpatch=require(_0x6aee('0x3'));var rp=require(_0x6aee('0x4'));var moment=require(_0x6aee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6aee('0x6'));var util=require(_0x6aee('0x7'));var path=require(_0x6aee('0x8'));var sox=require('sox');var csv=require(_0x6aee('0x9'));var ejs=require(_0x6aee('0xa'));var fs=require('fs');var fs_extra=require(_0x6aee('0xb'));var _=require(_0x6aee('0xc'));var squel=require(_0x6aee('0xd'));var crypto=require(_0x6aee('0xe'));var jsforce=require(_0x6aee('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6aee('0x10'));var Papa=require('papaparse');var Redis=require(_0x6aee('0x11'));var authService=require(_0x6aee('0x12'));var qs=require(_0x6aee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aee('0x14'));var logger=require(_0x6aee('0x15'))(_0x6aee('0x16'));var utils=require(_0x6aee('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6aee('0x18'));var db=require('../../mysqldb')['db'];config[_0x6aee('0x19')]=_[_0x6aee('0x1a')](config[_0x6aee('0x19')],{'host':_0x6aee('0x1b'),'port':0x18eb});var socket=require(_0x6aee('0x1c'))(new Redis(config['redis']));require(_0x6aee('0x1d'))[_0x6aee('0x1e')](socket);function respondWithStatusCode(_0x5a7fc5,_0x54ac80){_0x54ac80=_0x54ac80||0xcc;return function(_0x3179e3){if(_0x3179e3){return _0x5a7fc5[_0x6aee('0x1f')](_0x54ac80);}return _0x5a7fc5[_0x6aee('0x20')](_0x54ac80)[_0x6aee('0x21')]();};}function respondWithResult(_0x16cc61,_0x257c0b){_0x257c0b=_0x257c0b||0xc8;return function(_0x1c0235){if(_0x1c0235){return _0x16cc61[_0x6aee('0x20')](_0x257c0b)['json'](_0x1c0235);}};}function respondWithFilteredResult(_0x124794,_0x2d89f7){return function(_0x511486){if(_0x511486){var _0x2c6e26=typeof _0x2d89f7[_0x6aee('0x22')]==='undefined'&&typeof _0x2d89f7[_0x6aee('0x23')]===_0x6aee('0x24');var _0x39a9c1=_0x511486[_0x6aee('0x25')];var _0x340eae=_0x2c6e26?0x0:_0x2d89f7[_0x6aee('0x22')];var _0xf94d0d=_0x2c6e26?_0x511486['count']:_0x2d89f7[_0x6aee('0x22')]+_0x2d89f7['limit'];var _0x495ec5;if(_0xf94d0d>=_0x39a9c1){_0xf94d0d=_0x39a9c1;_0x495ec5=0xc8;}else{_0x495ec5=0xce;}_0x124794[_0x6aee('0x20')](_0x495ec5);return _0x124794[_0x6aee('0x26')](_0x6aee('0x27'),_0x340eae+'-'+_0xf94d0d+'/'+_0x39a9c1)[_0x6aee('0x28')](_0x511486);}return null;};}function patchUpdates(_0x2f9a08){return function(_0x4207cf){try{jsonpatch[_0x6aee('0x29')](_0x4207cf,_0x2f9a08,!![]);}catch(_0x1ffa47){return BPromise['reject'](_0x1ffa47);}return _0x4207cf[_0x6aee('0x2a')]();};}function saveUpdates(_0x511ea6,_0x4e0504){return function(_0x5fbffb){if(_0x5fbffb){return _0x5fbffb[_0x6aee('0x2b')](_0x511ea6)['then'](function(_0x3445b1){return _0x3445b1;});}return null;};}function removeEntity(_0x166dcd,_0x56716f){return function(_0x286297){if(_0x286297){return _0x286297[_0x6aee('0x2c')]()[_0x6aee('0x2d')](function(){_0x166dcd[_0x6aee('0x20')](0xcc)[_0x6aee('0x21')]();});}};}function handleEntityNotFound(_0x321c55,_0x411149){return function(_0x34f448){if(!_0x34f448){_0x321c55[_0x6aee('0x1f')](0x194);}return _0x34f448;};}function handleError(_0x1916b7,_0x9418f0){_0x9418f0=_0x9418f0||0x1f4;return function(_0x3376d1){logger[_0x6aee('0x2e')](_0x3376d1[_0x6aee('0x2f')]);if(_0x3376d1[_0x6aee('0x30')]){delete _0x3376d1[_0x6aee('0x30')];}_0x1916b7['status'](_0x9418f0)['send'](_0x3376d1);};}exports[_0x6aee('0x31')]=function(_0x43983b,_0x2822b9){var _0x30428e={'raw':![],'where':{'id':_0x43983b[_0x6aee('0x32')]['id']}},_0x4a2c8f={};_0x4a2c8f['model']=_[_0x6aee('0x33')](db[_0x6aee('0x34')][_0x6aee('0x35')]);_0x4a2c8f[_0x6aee('0x36')]=_[_0x6aee('0x33')](_0x43983b[_0x6aee('0x36')]);_0x4a2c8f[_0x6aee('0x37')]=_[_0x6aee('0x38')](_0x4a2c8f[_0x6aee('0x39')],_0x4a2c8f[_0x6aee('0x36')]);_0x30428e[_0x6aee('0x3a')]=_[_0x6aee('0x38')](_0x4a2c8f[_0x6aee('0x39')],qs['fields'](_0x43983b[_0x6aee('0x36')][_0x6aee('0x3b')]));_0x30428e[_0x6aee('0x3a')]=_0x30428e[_0x6aee('0x3a')][_0x6aee('0x3c')]?_0x30428e[_0x6aee('0x3a')]:_0x4a2c8f[_0x6aee('0x39')];if(_0x43983b[_0x6aee('0x36')]['includeAll']){_0x30428e[_0x6aee('0x3d')]=[{'all':!![]}];}_0x30428e=_[_0x6aee('0x3e')]({},_0x30428e,_0x43983b[_0x6aee('0x3f')]);return db[_0x6aee('0x34')][_0x6aee('0x40')](_0x30428e)[_0x6aee('0x2d')](handleEntityNotFound(_0x2822b9,null))[_0x6aee('0x2d')](respondWithResult(_0x2822b9,null))[_0x6aee('0x41')](handleError(_0x2822b9,null));};exports[_0x6aee('0x2c')]=function(_0x228f09,_0x39d74a){return db['DashboardItem']['find']({'where':{'id':_0x228f09[_0x6aee('0x32')]['id']}})['then'](handleEntityNotFound(_0x39d74a,null))['then'](removeEntity(_0x39d74a,null))[_0x6aee('0x41')](handleError(_0x39d74a,null));};function widgetAttributes(_0x37b2cd){try{switch(_0x37b2cd[_0x6aee('0x42')]){case'iframe':return[{'name':_0x6aee('0x43'),'value':_0x37b2cd[_0x6aee('0x43')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd['attrs'][0x0][_0x6aee('0x45')]:undefined)||_0x6aee('0x46')}];case _0x6aee('0x47'):return[{'name':_0x6aee('0x48'),'value':_0x37b2cd[_0x6aee('0x48')]||(_0x37b2cd['attrs']&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x45')]:undefined)||''}];case _0x6aee('0x49'):return[{'name':_0x6aee('0x4a'),'value':_0x37b2cd['attrHourFormat']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd['attrs'][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x45')]:undefined)||_0x6aee('0x4b')},{'name':_0x6aee('0x4c'),'value':_0x37b2cd[_0x6aee('0x4c')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd['attrs'][0x1]?_0x37b2cd['attrs'][0x1][_0x6aee('0x45')]:undefined)||'0.00'},{'name':_0x6aee('0x4d'),'value':_0x37b2cd[_0x6aee('0x4d')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x2]?_0x37b2cd['attrs'][0x2][_0x6aee('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0x6aee('0x4e'),'value':_0x37b2cd['attrMetric']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x45')]:undefined)||_0x6aee('0x4f')},{'name':_0x6aee('0x50'),'value':_0x37b2cd[_0x6aee('0x50')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd['attrs'][0x1]?_0x37b2cd[_0x6aee('0x44')][0x1][_0x6aee('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x37b2cd['attrFontSize']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x2]?_0x37b2cd['attrs'][0x2][_0x6aee('0x45')]:undefined)||0x14},{'name':'attrChannel','value':_0x37b2cd[_0x6aee('0x51')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x3]?_0x37b2cd[_0x6aee('0x44')][0x3]['value']:undefined)||'voice'},{'name':_0x6aee('0x52'),'value':_0x37b2cd[_0x6aee('0x52')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x4]?_0x37b2cd['attrs'][0x4][_0x6aee('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x37b2cd[_0x6aee('0x53')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x5]?_0x37b2cd[_0x6aee('0x44')][0x5]['value']:undefined)||''},{'name':_0x6aee('0x54'),'value':_0x37b2cd[_0x6aee('0x54')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x6]?_0x37b2cd[_0x6aee('0x44')][0x6][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x55'),'value':_0x37b2cd[_0x6aee('0x55')]||(_0x37b2cd['attrs']&&_0x37b2cd[_0x6aee('0x44')][0x7]?_0x37b2cd[_0x6aee('0x44')][0x7]['value']:undefined)||''},{'name':_0x6aee('0x56'),'value':_0x37b2cd[_0x6aee('0x56')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x8]?_0x37b2cd['attrs'][0x8]['value']:undefined)||''},{'name':_0x6aee('0x57'),'value':_0x37b2cd[_0x6aee('0x57')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x9]?_0x37b2cd['attrs'][0x9][_0x6aee('0x45')]:undefined)||''}];case'multibar-chart':case _0x6aee('0x58'):return[{'name':'attrSerie1','value':_0x37b2cd[_0x6aee('0x59')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x45')]:undefined)||_0x6aee('0x4f')},{'name':_0x6aee('0x5a'),'value':_0x37b2cd[_0x6aee('0x5a')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x1]?_0x37b2cd['attrs'][0x1][_0x6aee('0x45')]:undefined)||null},{'name':_0x6aee('0x5b'),'value':_0x37b2cd[_0x6aee('0x5b')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd['attrs'][0x2]?_0x37b2cd['attrs'][0x2][_0x6aee('0x45')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x37b2cd[_0x6aee('0x50')]||(_0x37b2cd['attrs']&&_0x37b2cd[_0x6aee('0x44')][0x3]?_0x37b2cd[_0x6aee('0x44')][0x3][_0x6aee('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x37b2cd['attrChannel']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd['attrs'][0x4]?_0x37b2cd['attrs'][0x4][_0x6aee('0x45')]:undefined)||_0x6aee('0x5c')},{'name':_0x6aee('0x52'),'value':_0x37b2cd[_0x6aee('0x52')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x5]?_0x37b2cd[_0x6aee('0x44')][0x5][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x53'),'value':_0x37b2cd['attrFaxAccounts']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x6]?_0x37b2cd[_0x6aee('0x44')][0x6][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x54'),'value':_0x37b2cd[_0x6aee('0x54')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x7]?_0x37b2cd[_0x6aee('0x44')][0x7][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x55'),'value':_0x37b2cd['attrOpenchannelAccounts']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x8]?_0x37b2cd[_0x6aee('0x44')][0x8][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x56'),'value':_0x37b2cd[_0x6aee('0x56')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x9]?_0x37b2cd[_0x6aee('0x44')][0x9][_0x6aee('0x45')]:undefined)||''},{'name':_0x6aee('0x57'),'value':_0x37b2cd[_0x6aee('0x57')]||(_0x37b2cd['attrs']&&_0x37b2cd['attrs'][0xa]?_0x37b2cd[_0x6aee('0x44')][0xa][_0x6aee('0x45')]:undefined)||''}];case'web-report':return[{'name':_0x6aee('0x5d'),'type':_0x37b2cd[_0x6aee('0x5e')]||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x42')]:undefined)||null,'value':_0x37b2cd['attrReport']||(_0x37b2cd['attrs']&&_0x37b2cd[_0x6aee('0x44')][0x0]?_0x37b2cd[_0x6aee('0x44')][0x0][_0x6aee('0x45')]:undefined)||null},{'name':_0x6aee('0x5f'),'value':_0x37b2cd['attrRefresh']||(_0x37b2cd[_0x6aee('0x44')]&&_0x37b2cd[_0x6aee('0x44')][0x1]?_0x37b2cd[_0x6aee('0x44')][0x1][_0x6aee('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x44ce45){logger[_0x6aee('0x2e')](_0x6aee('0x60'),JSON['stringify'](_0x44ce45));return[];}}exports[_0x6aee('0x61')]=function(_0x1d4b5d,_0x49fe10){if(_0x1d4b5d[_0x6aee('0x62')]){_0x1d4b5d[_0x6aee('0x62')][_0x6aee('0x44')]=widgetAttributes(_0x1d4b5d['body']);}return db[_0x6aee('0x34')][_0x6aee('0x61')](_0x1d4b5d[_0x6aee('0x62')],{})[_0x6aee('0x2d')](respondWithResult(_0x49fe10,0xc9))[_0x6aee('0x41')](handleError(_0x49fe10,null));};exports[_0x6aee('0x2b')]=function(_0x26e464,_0x2a72df){if(_0x26e464[_0x6aee('0x62')]['id']){delete _0x26e464[_0x6aee('0x62')]['id'];}_0x26e464[_0x6aee('0x62')][_0x6aee('0x44')]=widgetAttributes(_0x26e464[_0x6aee('0x62')]);return db[_0x6aee('0x34')][_0x6aee('0x40')]({'where':{'id':_0x26e464['params']['id']}})[_0x6aee('0x2d')](handleEntityNotFound(_0x2a72df,null))['then'](saveUpdates(_0x26e464[_0x6aee('0x62')],null))[_0x6aee('0x2d')](respondWithResult(_0x2a72df,null))['catch'](handleError(_0x2a72df,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 54d8185..dc9a829 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 _0xbd5f=['DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0xbd5f,0xce));var _0xfbd5=function(_0x474e07,_0x223d57){_0x474e07=_0x474e07-0x0;var _0x53f32b=_0xbd5f[_0x474e07];return _0x53f32b;};'use strict';var EventEmitter=require(_0xfbd5('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xfbd5('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfbd5('0x2')](0x0);var events={'afterCreate':_0xfbd5('0x3'),'afterUpdate':_0xfbd5('0x4'),'afterDestroy':_0xfbd5('0x5')};function emitEvent(_0x31d1af){return function(_0x57b814,_0x995667,_0x131798){DashboardItemEvents[_0xfbd5('0x6')](_0x31d1af+':'+_0x57b814['id'],_0x57b814);DashboardItemEvents[_0xfbd5('0x6')](_0x31d1af,_0x57b814);_0x131798(null);};}for(var e in events){if(events[_0xfbd5('0x7')](e)){var event=events[e];DashboardItem[_0xfbd5('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xa304=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x1515e6,_0x5b8cb8){var _0xebf047=function(_0xcc143a){while(--_0xcc143a){_0x1515e6['push'](_0x1515e6['shift']());}};_0xebf047(++_0x5b8cb8);}(_0xa304,0x164));var _0x4a30=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0xa304[_0x57975f];return _0x4793b8;};'use strict';var EventEmitter=require(_0x4a30('0x0'));var DashboardItem=require(_0x4a30('0x1'))['db'][_0x4a30('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4a30('0x3')](0x0);var events={'afterCreate':_0x4a30('0x4'),'afterUpdate':_0x4a30('0x5'),'afterDestroy':_0x4a30('0x6')};function emitEvent(_0x5ba8c3){return function(_0x25cadf,_0x33ec5b,_0x37a61d){DashboardItemEvents[_0x4a30('0x7')](_0x5ba8c3+':'+_0x25cadf['id'],_0x25cadf);DashboardItemEvents[_0x4a30('0x7')](_0x5ba8c3,_0x25cadf);_0x37a61d(null);};}for(var e in events){if(events[_0x4a30('0x8')](e)){var event=events[e];DashboardItem[_0x4a30('0x9')](e,emitEvent(event));}}module[_0x4a30('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ff509c4..9ef83ff 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 _0x67f0=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x67f0,0x1b0));var _0x067f=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x67f0[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x067f('0x0'));var util=require(_0x067f('0x1'));var logger=require(_0x067f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x067f('0x3'));var rp=require(_0x067f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x067f('0x5'));var config=require(_0x067f('0x6'));var attributes=require(_0x067f('0x7'));module[_0x067f('0x8')]=function(_0x2d64d9,_0x5f1c12){return _0x2d64d9[_0x067f('0x9')](_0x067f('0xa'),attributes,{'tableName':_0x067f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaae2=['request-promise','path','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2c3aa4,_0x42e5a6){var _0x426125=function(_0x505b7d){while(--_0x505b7d){_0x2c3aa4['push'](_0x2c3aa4['shift']());}};_0x426125(++_0x42e5a6);}(_0xaae2,0x1a8));var _0x2aae=function(_0x378400,_0x52b245){_0x378400=_0x378400-0x0;var _0x1857a2=_0xaae2[_0x378400];return _0x1857a2;};'use strict';var _=require(_0x2aae('0x0'));var util=require(_0x2aae('0x1'));var logger=require(_0x2aae('0x2'))('api');var moment=require(_0x2aae('0x3'));var BPromise=require(_0x2aae('0x4'));var rp=require(_0x2aae('0x5'));var fs=require('fs');var path=require(_0x2aae('0x6'));var rimraf=require('rimraf');var config=require(_0x2aae('0x7'));var attributes=require(_0x2aae('0x8'));module[_0x2aae('0x9')]=function(_0x112157,_0x5d11cd){return _0x112157['define'](_0x2aae('0xa'),attributes,{'tableName':'dashboard_items','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 faf0314..09be2e6 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 _0x2be1=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2be1,0x1ab));var _0x12be=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x2be1[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x12be('0x0'));var moment=require(_0x12be('0x1'));var BPromise=require(_0x12be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x12be('0x3'));var db=require(_0x12be('0x4'))['db'];var utils=require(_0x12be('0x5'));var logger=require(_0x12be('0x6'))('rpc');var config=require(_0x12be('0x7'));var jayson=require(_0x12be('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x12be('0x9')]=_[_0x12be('0xa')](config[_0x12be('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x12be('0xb'))(new Redis(config[_0x12be('0x9')]));require('./dashboardItem.socket')[_0x12be('0xc')](socket);function respondWithRpcPromise(_0x3fa93e,_0xae8939,_0x554e01){return new BPromise(function(_0x473f0a,_0x2040ae){return client[_0x12be('0xd')](_0x3fa93e,_0x554e01)[_0x12be('0xe')](function(_0x484efa){logger[_0x12be('0xf')](_0x12be('0x10'),_0xae8939,'request\x20sent');logger[_0x12be('0x11')](_0x12be('0x12'),_0xae8939,_0x12be('0x13'),JSON[_0x12be('0x14')](_0x484efa));if(_0x484efa['error']){if(_0x484efa['error']['code']===0x1f4){logger[_0x12be('0x15')](_0x12be('0x10'),_0xae8939,_0x484efa['error'][_0x12be('0x16')]);return _0x2040ae(_0x484efa[_0x12be('0x15')]['message']);}logger[_0x12be('0x15')]('DashboardItem,\x20%s,\x20%s',_0xae8939,_0x484efa['error'][_0x12be('0x16')]);return _0x473f0a(_0x484efa[_0x12be('0x15')][_0x12be('0x16')]);}else{logger[_0x12be('0xf')](_0x12be('0x10'),_0xae8939,'request\x20sent');_0x473f0a(_0x484efa[_0x12be('0x17')][_0x12be('0x16')]);}})[_0x12be('0x18')](function(_0x508f33){logger[_0x12be('0x15')]('DashboardItem,\x20%s,\x20%s',_0xae8939,_0x508f33);_0x2040ae(_0x508f33);});});} \ No newline at end of file +var _0x2e2c=['error','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x549cad,_0xc32566){var _0x5a9eed=function(_0x553000){while(--_0x553000){_0x549cad['push'](_0x549cad['shift']());}};_0x5a9eed(++_0xc32566);}(_0x2e2c,0xb9));var _0xc2e2=function(_0x1f75e8,_0x7fa97f){_0x1f75e8=_0x1f75e8-0x0;var _0x120699=_0x2e2c[_0x1f75e8];return _0x120699;};'use strict';var _=require(_0xc2e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc2e2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2e2('0x2'));var db=require(_0xc2e2('0x3'))['db'];var utils=require(_0xc2e2('0x4'));var logger=require(_0xc2e2('0x5'))(_0xc2e2('0x6'));var config=require(_0xc2e2('0x7'));var jayson=require(_0xc2e2('0x8'));var client=jayson[_0xc2e2('0x9')][_0xc2e2('0xa')]({'port':0x232a});config[_0xc2e2('0xb')]=_['defaults'](config[_0xc2e2('0xb')],{'host':_0xc2e2('0xc'),'port':0x18eb});var socket=require(_0xc2e2('0xd'))(new Redis(config['redis']));require(_0xc2e2('0xe'))[_0xc2e2('0xf')](socket);function respondWithRpcPromise(_0xf532dc,_0x256746,_0x20c726){return new BPromise(function(_0x587987,_0x1634cc){return client['request'](_0xf532dc,_0x20c726)[_0xc2e2('0x10')](function(_0x46e4eb){logger[_0xc2e2('0x11')](_0xc2e2('0x12'),_0x256746,'request\x20sent');logger[_0xc2e2('0x13')](_0xc2e2('0x14'),_0x256746,_0xc2e2('0x15'),JSON[_0xc2e2('0x16')](_0x46e4eb));if(_0x46e4eb['error']){if(_0x46e4eb[_0xc2e2('0x17')]['code']===0x1f4){logger['error'](_0xc2e2('0x12'),_0x256746,_0x46e4eb['error']['message']);return _0x1634cc(_0x46e4eb['error']['message']);}logger[_0xc2e2('0x17')](_0xc2e2('0x12'),_0x256746,_0x46e4eb['error'][_0xc2e2('0x18')]);return _0x587987(_0x46e4eb['error'][_0xc2e2('0x18')]);}else{logger['info'](_0xc2e2('0x12'),_0x256746,_0xc2e2('0x15'));_0x587987(_0x46e4eb['result'][_0xc2e2('0x18')]);}})[_0xc2e2('0x19')](function(_0x321bbf){logger['error'](_0xc2e2('0x12'),_0x256746,_0x321bbf);_0x1634cc(_0x321bbf);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 75a6fb6..2c17237 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 _0xa46a=['save','remove','register','length','./dashboardItem.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa46a,0x185));var _0xaa46=function(_0x49e454,_0x22328f){_0x49e454=_0x49e454-0x0;var _0x21d045=_0xa46a[_0x49e454];return _0x21d045;};'use strict';var DashboardItemEvents=require(_0xaa46('0x0'));var events=[_0xaa46('0x1'),_0xaa46('0x2'),'update'];function createListener(_0x149443,_0x15b07c){return function(_0x21fa9f){_0x15b07c['emit'](_0x149443,_0x21fa9f);};}function removeListener(_0x47456d,_0x292c57){return function(){DashboardItemEvents['removeListener'](_0x47456d,_0x292c57);};}exports[_0xaa46('0x3')]=function(_0xa1409d){for(var _0xca7842=0x0,_0x488fb5=events[_0xaa46('0x4')];_0xca7842<_0x488fb5;_0xca7842++){var _0x25d18e=events[_0xca7842];var _0x4aca2a=createListener('dashboardItem:'+_0x25d18e,_0xa1409d);DashboardItemEvents['on'](_0x25d18e,_0x4aca2a);}}; \ No newline at end of file +var _0x06fb=['removeListener','register','length','dashboardItem:','remove','update','emit'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x06fb,0x1bd));var _0xb06f=function(_0xf12573,_0x5b1e09){_0xf12573=_0xf12573-0x0;var _0x52036a=_0x06fb[_0xf12573];return _0x52036a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xb06f('0x0'),_0xb06f('0x1')];function createListener(_0x27ae97,_0x5581d3){return function(_0x51ed40){_0x5581d3[_0xb06f('0x2')](_0x27ae97,_0x51ed40);};}function removeListener(_0x5c17b8,_0x315207){return function(){DashboardItemEvents[_0xb06f('0x3')](_0x5c17b8,_0x315207);};}exports[_0xb06f('0x4')]=function(_0x52bb75){for(var _0x55434b=0x0,_0x103842=events[_0xb06f('0x5')];_0x55434b<_0x103842;_0x55434b++){var _0x143ed0=events[_0x55434b];var _0x507cc8=createListener(_0xb06f('0x6')+_0x143ed0,_0x52bb75);DashboardItemEvents['on'](_0x143ed0,_0x507cc8);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 64c8fe5..ff9c225 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 _0x2fb3=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2a553f,_0x4c9c9c){var _0x22813b=function(_0x536a6f){while(--_0x536a6f){_0x2a553f['push'](_0x2a553f['shift']());}};_0x22813b(++_0x4c9c9c);}(_0x2fb3,0x1ac));var _0x32fb=function(_0x234d61,_0x4db79d){_0x234d61=_0x234d61-0x0;var _0x736d50=_0x2fb3[_0x234d61];return _0x736d50;};'use strict';var multer=require(_0x32fb('0x0'));var util=require(_0x32fb('0x1'));var path=require(_0x32fb('0x2'));var timeout=require(_0x32fb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x32fb('0x4'));var auth=require(_0x32fb('0x5'));var interaction=require(_0x32fb('0x6'));var config=require(_0x32fb('0x7'));var controller=require(_0x32fb('0x8'));router[_0x32fb('0x9')](_0x32fb('0xa'),auth[_0x32fb('0xb')](),controller[_0x32fb('0xc')]);router['post']('/',auth[_0x32fb('0xb')](),controller['create']);router['put'](_0x32fb('0xa'),auth[_0x32fb('0xb')](),controller[_0x32fb('0xd')]);router['delete']('/:id',auth[_0x32fb('0xb')](),controller['destroy']);module[_0x32fb('0xe')]=router; \ No newline at end of file +var _0xd414=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x535c2b,_0x13368b){var _0x347f9d=function(_0x1c3b4d){while(--_0x1c3b4d){_0x535c2b['push'](_0x535c2b['shift']());}};_0x347f9d(++_0x13368b);}(_0xd414,0x117));var _0x4d41=function(_0x20151d,_0x1f2c1c){_0x20151d=_0x20151d-0x0;var _0x19cf44=_0xd414[_0x20151d];return _0x19cf44;};'use strict';var multer=require(_0x4d41('0x0'));var util=require(_0x4d41('0x1'));var path=require(_0x4d41('0x2'));var timeout=require(_0x4d41('0x3'));var express=require('express');var router=express[_0x4d41('0x4')]();var fs_extra=require(_0x4d41('0x5'));var auth=require(_0x4d41('0x6'));var interaction=require(_0x4d41('0x7'));var config=require(_0x4d41('0x8'));var controller=require(_0x4d41('0x9'));router[_0x4d41('0xa')](_0x4d41('0xb'),auth[_0x4d41('0xc')](),controller[_0x4d41('0xd')]);router[_0x4d41('0xe')]('/',auth[_0x4d41('0xc')](),controller['create']);router[_0x4d41('0xf')](_0x4d41('0xb'),auth[_0x4d41('0xc')](),controller[_0x4d41('0x10')]);router[_0x4d41('0x11')]('/:id',auth[_0x4d41('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 71f63cc..78adc04 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 _0x75c1=['second','third','STRING','sequelize','exports','first'];(function(_0x2c9b38,_0x32bf30){var _0x511531=function(_0x2b7ade){while(--_0x2b7ade){_0x2c9b38['push'](_0x2c9b38['shift']());}};_0x511531(++_0x32bf30);}(_0x75c1,0x105));var _0x175c=function(_0x1e3386,_0x2e9745){_0x1e3386=_0x1e3386-0x0;var _0x5eb847=_0x75c1[_0x1e3386];return _0x5eb847;};'use strict';var Sequelize=require(_0x175c('0x0'));module[_0x175c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x175c('0x2'),_0x175c('0x3'),_0x175c('0x4')),'allowNull':![],'defaultValue':_0x175c('0x2')},'description':{'type':Sequelize[_0x175c('0x5')]}}; \ No newline at end of file +var _0xeda2=['STRING','ENUM','first','third','sequelize'];(function(_0x591708,_0x585cb5){var _0x38f07a=function(_0x367b2f){while(--_0x367b2f){_0x591708['push'](_0x591708['shift']());}};_0x38f07a(++_0x585cb5);}(_0xeda2,0x1a8));var _0x2eda=function(_0x20ba6d,_0x256177){_0x20ba6d=_0x20ba6d-0x0;var _0x338188=_0xeda2[_0x20ba6d];return _0x338188;};'use strict';var Sequelize=require(_0x2eda('0x0'));module['exports']={'name':{'type':Sequelize[_0x2eda('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2eda('0x2')](_0x2eda('0x3'),'second',_0x2eda('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ba6ed46..dadf01d 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 _0x4330=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4330,0x13d));var _0x0433=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x4330[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x0433('0x0'));var rimraf=require(_0x0433('0x1'));var zipdir=require(_0x0433('0x2'));var jsonpatch=require(_0x0433('0x3'));var rp=require(_0x0433('0x4'));var moment=require(_0x0433('0x5'));var BPromise=require(_0x0433('0x6'));var Mustache=require(_0x0433('0x7'));var util=require(_0x0433('0x8'));var path=require(_0x0433('0x9'));var sox=require(_0x0433('0xa'));var csv=require(_0x0433('0xb'));var ejs=require(_0x0433('0xc'));var fs=require('fs');var fs_extra=require(_0x0433('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0433('0xe'));var jsforce=require(_0x0433('0xf'));var deskjs=require(_0x0433('0x10'));var toCsv=require(_0x0433('0xb'));var querystring=require(_0x0433('0x11'));var Papa=require('papaparse');var Redis=require(_0x0433('0x12'));var authService=require(_0x0433('0x13'));var qs=require(_0x0433('0x14'));var as=require(_0x0433('0x15'));var hardwareService=require(_0x0433('0x16'));var logger=require(_0x0433('0x17'))('api');var utils=require(_0x0433('0x18'));var config=require(_0x0433('0x19'));var licenseUtil=require(_0x0433('0x1a'));var db=require(_0x0433('0x1b'))['db'];function respondWithStatusCode(_0x49a14e,_0x5a1edc){_0x5a1edc=_0x5a1edc||0xcc;return function(_0x5b629e){if(_0x5b629e){return _0x49a14e[_0x0433('0x1c')](_0x5a1edc);}return _0x49a14e[_0x0433('0x1d')](_0x5a1edc)[_0x0433('0x1e')]();};}function respondWithResult(_0x562a4e,_0x2203f4){_0x2203f4=_0x2203f4||0xc8;return function(_0x219cde){if(_0x219cde){return _0x562a4e[_0x0433('0x1d')](_0x2203f4)[_0x0433('0x1f')](_0x219cde);}};}function respondWithFilteredResult(_0x3cb569,_0x343c5a){return function(_0x10ab77){if(_0x10ab77){var _0x3cf0e8=typeof _0x343c5a[_0x0433('0x20')]===_0x0433('0x21')&&typeof _0x343c5a[_0x0433('0x22')]===_0x0433('0x21');var _0x4ab561=_0x10ab77[_0x0433('0x23')];var _0x5accf5=_0x3cf0e8?0x0:_0x343c5a['offset'];var _0x2dccbc=_0x3cf0e8?_0x10ab77[_0x0433('0x23')]:_0x343c5a[_0x0433('0x20')]+_0x343c5a['limit'];var _0x11002e;if(_0x2dccbc>=_0x4ab561){_0x2dccbc=_0x4ab561;_0x11002e=0xc8;}else{_0x11002e=0xce;}_0x3cb569[_0x0433('0x1d')](_0x11002e);return _0x3cb569[_0x0433('0x24')](_0x0433('0x25'),_0x5accf5+'-'+_0x2dccbc+'/'+_0x4ab561)['json'](_0x10ab77);}return null;};}function patchUpdates(_0x3e09cd){return function(_0x30bca5){try{jsonpatch[_0x0433('0x26')](_0x30bca5,_0x3e09cd,!![]);}catch(_0x38d1d4){return BPromise[_0x0433('0x27')](_0x38d1d4);}return _0x30bca5['save']();};}function saveUpdates(_0x5048a1,_0x55bdba){return function(_0x7577b0){if(_0x7577b0){return _0x7577b0[_0x0433('0x28')](_0x5048a1)[_0x0433('0x29')](function(_0x272b91){return _0x272b91;});}return null;};}function removeEntity(_0x956d,_0x32e035){return function(_0x36bd8b){if(_0x36bd8b){return _0x36bd8b[_0x0433('0x2a')]()[_0x0433('0x29')](function(){var _0x24f1e2=_0x36bd8b[_0x0433('0x2b')]({'plain':!![]});var _0x5007a9=_0x0433('0x2c');return db[_0x0433('0x2d')]['destroy']({'where':{'type':_0x5007a9,'resourceId':_0x24f1e2['id']}})['then'](function(){return _0x36bd8b;});})[_0x0433('0x29')](function(){_0x956d[_0x0433('0x1d')](0xcc)[_0x0433('0x1e')]();});}};}function handleEntityNotFound(_0x2237da,_0x14cf16){return function(_0x18b840){if(!_0x18b840){_0x2237da[_0x0433('0x1c')](0x194);}return _0x18b840;};}function handleError(_0x2d08cf,_0x3b6f39){_0x3b6f39=_0x3b6f39||0x1f4;return function(_0x3ae499){logger['error'](_0x3ae499[_0x0433('0x2e')]);if(_0x3ae499[_0x0433('0x2f')]){delete _0x3ae499[_0x0433('0x2f')];}_0x2d08cf['status'](_0x3b6f39)[_0x0433('0x30')](_0x3ae499);};}exports[_0x0433('0x31')]=function(_0x3df239,_0x2d47b8){var _0x338c4e={},_0xc2aa92={},_0x115c72={'count':0x0,'rows':[]};var _0x18dc44=_[_0x0433('0x32')](db[_0x0433('0x33')][_0x0433('0x34')],function(_0x21da5d){return{'name':_0x21da5d[_0x0433('0x35')],'type':_0x21da5d[_0x0433('0x36')][_0x0433('0x37')]};});_0xc2aa92[_0x0433('0x38')]=_['map'](_0x18dc44,_0x0433('0x2f'));_0xc2aa92['query']=_[_0x0433('0x39')](_0x3df239[_0x0433('0x3a')]);_0xc2aa92[_0x0433('0x3b')]=_['intersection'](_0xc2aa92[_0x0433('0x38')],_0xc2aa92[_0x0433('0x3a')]);_0x338c4e['attributes']=_[_0x0433('0x3c')](_0xc2aa92['model'],qs['fields'](_0x3df239[_0x0433('0x3a')][_0x0433('0x3d')]));_0x338c4e['attributes']=_0x338c4e['attributes'][_0x0433('0x3e')]?_0x338c4e[_0x0433('0x3f')]:_0xc2aa92[_0x0433('0x38')];if(!_0x3df239[_0x0433('0x3a')]['hasOwnProperty']('nolimit')){_0x338c4e[_0x0433('0x22')]=qs[_0x0433('0x22')](_0x3df239[_0x0433('0x3a')][_0x0433('0x22')]);_0x338c4e['offset']=qs[_0x0433('0x20')](_0x3df239[_0x0433('0x3a')][_0x0433('0x20')]);}_0x338c4e['order']=qs[_0x0433('0x40')](_0x3df239[_0x0433('0x3a')][_0x0433('0x40')]);_0x338c4e[_0x0433('0x41')]=qs[_0x0433('0x3b')](_[_0x0433('0x42')](_0x3df239[_0x0433('0x3a')],_0xc2aa92['filters']),_0x18dc44);if(_0x3df239[_0x0433('0x3a')][_0x0433('0x43')]){_0x338c4e[_0x0433('0x41')]=_['merge'](_0x338c4e[_0x0433('0x41')],{'$or':_[_0x0433('0x32')](_0x18dc44,function(_0x30851b){if(_0x30851b['type']!=='VIRTUAL'){var _0x192f5c={};_0x192f5c[_0x30851b['name']]={'$like':'%'+_0x3df239[_0x0433('0x3a')][_0x0433('0x43')]+'%'};return _0x192f5c;}})});}_0x338c4e=_[_0x0433('0x44')]({},_0x338c4e,_0x3df239['options']);var _0x4f45e5={'where':_0x338c4e[_0x0433('0x41')]};return db[_0x0433('0x33')][_0x0433('0x23')](_0x4f45e5)[_0x0433('0x29')](function(_0xd628b7){_0x115c72[_0x0433('0x23')]=_0xd628b7;if(_0x3df239[_0x0433('0x3a')]['includeAll']){_0x338c4e[_0x0433('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x0433('0x46')](_0x338c4e);})[_0x0433('0x29')](function(_0x582187){_0x115c72[_0x0433('0x47')]=_0x582187;return _0x115c72;})[_0x0433('0x29')](respondWithFilteredResult(_0x2d47b8,_0x338c4e))[_0x0433('0x48')](handleError(_0x2d47b8,null));};exports[_0x0433('0x49')]=function(_0x4ac64b,_0x5c0a49){var _0x232f28={'raw':!![],'where':{'id':_0x4ac64b[_0x0433('0x4a')]['id']}},_0x1ac739={};_0x1ac739[_0x0433('0x38')]=_[_0x0433('0x39')](db[_0x0433('0x33')][_0x0433('0x34')]);_0x1ac739['query']=_['keys'](_0x4ac64b[_0x0433('0x3a')]);_0x1ac739[_0x0433('0x3b')]=_[_0x0433('0x3c')](_0x1ac739['model'],_0x1ac739[_0x0433('0x3a')]);_0x232f28[_0x0433('0x3f')]=_[_0x0433('0x3c')](_0x1ac739[_0x0433('0x38')],qs['fields'](_0x4ac64b['query'][_0x0433('0x3d')]));_0x232f28[_0x0433('0x3f')]=_0x232f28[_0x0433('0x3f')][_0x0433('0x3e')]?_0x232f28[_0x0433('0x3f')]:_0x1ac739[_0x0433('0x38')];if(_0x4ac64b[_0x0433('0x3a')][_0x0433('0x4b')]){_0x232f28[_0x0433('0x45')]=[{'all':!![]}];}_0x232f28=_[_0x0433('0x44')]({},_0x232f28,_0x4ac64b[_0x0433('0x4c')]);return db['Disposition']['find'](_0x232f28)[_0x0433('0x29')](handleEntityNotFound(_0x5c0a49,null))[_0x0433('0x29')](respondWithResult(_0x5c0a49,null))[_0x0433('0x48')](handleError(_0x5c0a49,null));};exports['create']=function(_0x3df294,_0x58fbc4){return db[_0x0433('0x33')][_0x0433('0x4d')](_0x3df294[_0x0433('0x4e')],{})[_0x0433('0x29')](function(_0xcb250d){var _0x464248=_0x3df294[_0x0433('0x4f')]['get']({'plain':!![]});if(!_0x464248)throw new Error(_0x0433('0x50'));if(_0x464248[_0x0433('0x51')]===_0x0433('0x4f')){var _0x1c82cc=_0xcb250d[_0x0433('0x2b')]({'plain':!![]});var _0x7d7b66=_0x0433('0x2c');return db[_0x0433('0x52')][_0x0433('0x53')]({'where':{'name':_0x7d7b66,'userProfileId':_0x464248['userProfileId']},'raw':!![]})[_0x0433('0x29')](function(_0x1f5a70){if(_0x1f5a70&&_0x1f5a70['autoAssociation']===0x0){return db[_0x0433('0x2d')][_0x0433('0x4d')]({'name':_0x1c82cc['name'],'resourceId':_0x1c82cc['id'],'type':_0x1f5a70['name'],'sectionId':_0x1f5a70['id']},{})[_0x0433('0x29')](function(){return _0xcb250d;});}else{return _0xcb250d;}})['catch'](function(_0x5afb79){logger[_0x0433('0x54')](_0x0433('0x55'),_0x5afb79);throw _0x5afb79;});}return _0xcb250d;})[_0x0433('0x29')](respondWithResult(_0x58fbc4,0xc9))[_0x0433('0x48')](handleError(_0x58fbc4,null));};exports[_0x0433('0x28')]=function(_0x137960,_0x131a48){if(_0x137960['body']['id']){delete _0x137960[_0x0433('0x4e')]['id'];}return db[_0x0433('0x33')][_0x0433('0x53')]({'where':{'id':_0x137960[_0x0433('0x4a')]['id']}})[_0x0433('0x29')](handleEntityNotFound(_0x131a48,null))[_0x0433('0x29')](saveUpdates(_0x137960[_0x0433('0x4e')],null))['then'](respondWithResult(_0x131a48,null))[_0x0433('0x48')](handleError(_0x131a48,null));};exports[_0x0433('0x2a')]=function(_0x113c13,_0xb31d86){return db[_0x0433('0x33')]['find']({'where':{'id':_0x113c13[_0x0433('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb31d86,null))['then'](removeEntity(_0xb31d86,null))[_0x0433('0x48')](handleError(_0xb31d86,null));}; \ No newline at end of file +var _0xfa9f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','destroy','then','error','stack','name','index','map','Disposition','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x5026b1,_0x14fda3){var _0x522c61=function(_0x25b829){while(--_0x25b829){_0x5026b1['push'](_0x5026b1['shift']());}};_0x522c61(++_0x14fda3);}(_0xfa9f,0x93));var _0xffa9=function(_0x923ab6,_0x200ec5){_0x923ab6=_0x923ab6-0x0;var _0x484752=_0xfa9f[_0x923ab6];return _0x484752;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffa9('0x0'));var zipdir=require(_0xffa9('0x1'));var jsonpatch=require(_0xffa9('0x2'));var rp=require(_0xffa9('0x3'));var moment=require(_0xffa9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xffa9('0x5'));var util=require('util');var path=require(_0xffa9('0x6'));var sox=require(_0xffa9('0x7'));var csv=require('to-csv');var ejs=require(_0xffa9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffa9('0x9'));var crypto=require(_0xffa9('0xa'));var jsforce=require(_0xffa9('0xb'));var deskjs=require(_0xffa9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xffa9('0xd'));var Papa=require(_0xffa9('0xe'));var Redis=require(_0xffa9('0xf'));var authService=require(_0xffa9('0x10'));var qs=require(_0xffa9('0x11'));var as=require(_0xffa9('0x12'));var hardwareService=require(_0xffa9('0x13'));var logger=require(_0xffa9('0x14'))(_0xffa9('0x15'));var utils=require(_0xffa9('0x16'));var config=require(_0xffa9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xffa9('0x18'))['db'];function respondWithStatusCode(_0x21ac24,_0x23b3f9){_0x23b3f9=_0x23b3f9||0xcc;return function(_0x231aad){if(_0x231aad){return _0x21ac24[_0xffa9('0x19')](_0x23b3f9);}return _0x21ac24[_0xffa9('0x1a')](_0x23b3f9)[_0xffa9('0x1b')]();};}function respondWithResult(_0x3242de,_0x83f455){_0x83f455=_0x83f455||0xc8;return function(_0x3dd57f){if(_0x3dd57f){return _0x3242de['status'](_0x83f455)[_0xffa9('0x1c')](_0x3dd57f);}};}function respondWithFilteredResult(_0x53401b,_0x6e09fe){return function(_0x13bee9){if(_0x13bee9){var _0x54cae8=typeof _0x6e09fe[_0xffa9('0x1d')]===_0xffa9('0x1e')&&typeof _0x6e09fe[_0xffa9('0x1f')]==='undefined';var _0x3ef1bb=_0x13bee9[_0xffa9('0x20')];var _0x3cd552=_0x54cae8?0x0:_0x6e09fe[_0xffa9('0x1d')];var _0x4fbe1c=_0x54cae8?_0x13bee9[_0xffa9('0x20')]:_0x6e09fe['offset']+_0x6e09fe[_0xffa9('0x1f')];var _0x19bec8;if(_0x4fbe1c>=_0x3ef1bb){_0x4fbe1c=_0x3ef1bb;_0x19bec8=0xc8;}else{_0x19bec8=0xce;}_0x53401b[_0xffa9('0x1a')](_0x19bec8);return _0x53401b[_0xffa9('0x21')](_0xffa9('0x22'),_0x3cd552+'-'+_0x4fbe1c+'/'+_0x3ef1bb)[_0xffa9('0x1c')](_0x13bee9);}return null;};}function patchUpdates(_0x52ab3c){return function(_0x11fe72){try{jsonpatch[_0xffa9('0x23')](_0x11fe72,_0x52ab3c,!![]);}catch(_0x41eb49){return BPromise[_0xffa9('0x24')](_0x41eb49);}return _0x11fe72[_0xffa9('0x25')]();};}function saveUpdates(_0x2c9c20,_0x3c2842){return function(_0x24218a){if(_0x24218a){return _0x24218a[_0xffa9('0x26')](_0x2c9c20)['then'](function(_0x55ab54){return _0x55ab54;});}return null;};}function removeEntity(_0x30c13b,_0x19655d){return function(_0x2230ef){if(_0x2230ef){return _0x2230ef['destroy']()['then'](function(){var _0x314231=_0x2230ef[_0xffa9('0x27')]({'plain':!![]});var _0xb22ae3='Dispositions';return db['UserProfileResource'][_0xffa9('0x28')]({'where':{'type':_0xb22ae3,'resourceId':_0x314231['id']}})['then'](function(){return _0x2230ef;});})[_0xffa9('0x29')](function(){_0x30c13b[_0xffa9('0x1a')](0xcc)[_0xffa9('0x1b')]();});}};}function handleEntityNotFound(_0x331606,_0x415fcd){return function(_0x1aa814){if(!_0x1aa814){_0x331606[_0xffa9('0x19')](0x194);}return _0x1aa814;};}function handleError(_0x5d1df6,_0x23e449){_0x23e449=_0x23e449||0x1f4;return function(_0x430dbe){logger[_0xffa9('0x2a')](_0x430dbe[_0xffa9('0x2b')]);if(_0x430dbe[_0xffa9('0x2c')]){delete _0x430dbe[_0xffa9('0x2c')];}_0x5d1df6['status'](_0x23e449)['send'](_0x430dbe);};}exports[_0xffa9('0x2d')]=function(_0x3484f6,_0x3b01fe){var _0x45a8a4={},_0xd353c4={},_0x1a8703={'count':0x0,'rows':[]};var _0x70cf75=_[_0xffa9('0x2e')](db[_0xffa9('0x2f')]['rawAttributes'],function(_0x3f938f){return{'name':_0x3f938f[_0xffa9('0x30')],'type':_0x3f938f[_0xffa9('0x31')]['key']};});_0xd353c4[_0xffa9('0x32')]=_[_0xffa9('0x2e')](_0x70cf75,_0xffa9('0x2c'));_0xd353c4['query']=_[_0xffa9('0x33')](_0x3484f6[_0xffa9('0x34')]);_0xd353c4[_0xffa9('0x35')]=_['intersection'](_0xd353c4[_0xffa9('0x32')],_0xd353c4['query']);_0x45a8a4['attributes']=_[_0xffa9('0x36')](_0xd353c4['model'],qs[_0xffa9('0x37')](_0x3484f6[_0xffa9('0x34')][_0xffa9('0x37')]));_0x45a8a4[_0xffa9('0x38')]=_0x45a8a4[_0xffa9('0x38')]['length']?_0x45a8a4[_0xffa9('0x38')]:_0xd353c4['model'];if(!_0x3484f6['query'][_0xffa9('0x39')]('nolimit')){_0x45a8a4[_0xffa9('0x1f')]=qs[_0xffa9('0x1f')](_0x3484f6['query']['limit']);_0x45a8a4[_0xffa9('0x1d')]=qs['offset'](_0x3484f6[_0xffa9('0x34')][_0xffa9('0x1d')]);}_0x45a8a4['order']=qs['sort'](_0x3484f6['query']['sort']);_0x45a8a4[_0xffa9('0x3a')]=qs[_0xffa9('0x35')](_[_0xffa9('0x3b')](_0x3484f6['query'],_0xd353c4[_0xffa9('0x35')]),_0x70cf75);if(_0x3484f6[_0xffa9('0x34')][_0xffa9('0x3c')]){_0x45a8a4[_0xffa9('0x3a')]=_[_0xffa9('0x3d')](_0x45a8a4['where'],{'$or':_['map'](_0x70cf75,function(_0x28fe9b){if(_0x28fe9b[_0xffa9('0x31')]!==_0xffa9('0x3e')){var _0x30db81={};_0x30db81[_0x28fe9b['name']]={'$like':'%'+_0x3484f6[_0xffa9('0x34')][_0xffa9('0x3c')]+'%'};return _0x30db81;}})});}_0x45a8a4=_['merge']({},_0x45a8a4,_0x3484f6[_0xffa9('0x3f')]);var _0x17f5ca={'where':_0x45a8a4[_0xffa9('0x3a')]};return db['Disposition']['count'](_0x17f5ca)[_0xffa9('0x29')](function(_0x14cb1){_0x1a8703[_0xffa9('0x20')]=_0x14cb1;if(_0x3484f6[_0xffa9('0x34')]['includeAll']){_0x45a8a4[_0xffa9('0x40')]=[{'all':!![]}];}return db[_0xffa9('0x2f')][_0xffa9('0x41')](_0x45a8a4);})[_0xffa9('0x29')](function(_0x2d3500){_0x1a8703[_0xffa9('0x42')]=_0x2d3500;return _0x1a8703;})[_0xffa9('0x29')](respondWithFilteredResult(_0x3b01fe,_0x45a8a4))[_0xffa9('0x43')](handleError(_0x3b01fe,null));};exports[_0xffa9('0x44')]=function(_0x3823a6,_0x1a1baa){var _0x26c8d8={'raw':!![],'where':{'id':_0x3823a6[_0xffa9('0x45')]['id']}},_0x32645e={};_0x32645e[_0xffa9('0x32')]=_['keys'](db['Disposition'][_0xffa9('0x46')]);_0x32645e[_0xffa9('0x34')]=_[_0xffa9('0x33')](_0x3823a6[_0xffa9('0x34')]);_0x32645e[_0xffa9('0x35')]=_[_0xffa9('0x36')](_0x32645e['model'],_0x32645e[_0xffa9('0x34')]);_0x26c8d8[_0xffa9('0x38')]=_['intersection'](_0x32645e['model'],qs[_0xffa9('0x37')](_0x3823a6[_0xffa9('0x34')][_0xffa9('0x37')]));_0x26c8d8['attributes']=_0x26c8d8['attributes']['length']?_0x26c8d8[_0xffa9('0x38')]:_0x32645e[_0xffa9('0x32')];if(_0x3823a6[_0xffa9('0x34')][_0xffa9('0x47')]){_0x26c8d8[_0xffa9('0x40')]=[{'all':!![]}];}_0x26c8d8=_[_0xffa9('0x3d')]({},_0x26c8d8,_0x3823a6[_0xffa9('0x3f')]);return db['Disposition'][_0xffa9('0x48')](_0x26c8d8)[_0xffa9('0x29')](handleEntityNotFound(_0x1a1baa,null))[_0xffa9('0x29')](respondWithResult(_0x1a1baa,null))[_0xffa9('0x43')](handleError(_0x1a1baa,null));};exports[_0xffa9('0x49')]=function(_0x413777,_0x497bf6){return db[_0xffa9('0x2f')]['create'](_0x413777[_0xffa9('0x4a')],{})[_0xffa9('0x29')](function(_0x2240a0){var _0x1141cc=_0x413777[_0xffa9('0x4b')][_0xffa9('0x27')]({'plain':!![]});if(!_0x1141cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1141cc['role']==='user'){var _0xa12120=_0x2240a0[_0xffa9('0x27')]({'plain':!![]});var _0x4e7a7a=_0xffa9('0x4c');return db[_0xffa9('0x4d')][_0xffa9('0x48')]({'where':{'name':_0x4e7a7a,'userProfileId':_0x1141cc[_0xffa9('0x4e')]},'raw':!![]})[_0xffa9('0x29')](function(_0x25e518){if(_0x25e518&&_0x25e518[_0xffa9('0x4f')]===0x0){return db[_0xffa9('0x50')][_0xffa9('0x49')]({'name':_0xa12120[_0xffa9('0x2c')],'resourceId':_0xa12120['id'],'type':_0x25e518['name'],'sectionId':_0x25e518['id']},{})[_0xffa9('0x29')](function(){return _0x2240a0;});}else{return _0x2240a0;}})[_0xffa9('0x43')](function(_0x1bdd0f){logger[_0xffa9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bdd0f);throw _0x1bdd0f;});}return _0x2240a0;})[_0xffa9('0x29')](respondWithResult(_0x497bf6,0xc9))[_0xffa9('0x43')](handleError(_0x497bf6,null));};exports[_0xffa9('0x26')]=function(_0x4d36d3,_0x1cb567){if(_0x4d36d3[_0xffa9('0x4a')]['id']){delete _0x4d36d3['body']['id'];}return db['Disposition'][_0xffa9('0x48')]({'where':{'id':_0x4d36d3[_0xffa9('0x45')]['id']}})[_0xffa9('0x29')](handleEntityNotFound(_0x1cb567,null))[_0xffa9('0x29')](saveUpdates(_0x4d36d3[_0xffa9('0x4a')],null))['then'](respondWithResult(_0x1cb567,null))['catch'](handleError(_0x1cb567,null));};exports['destroy']=function(_0x1ef45f,_0x2974af){return db[_0xffa9('0x2f')][_0xffa9('0x48')]({'where':{'id':_0x1ef45f[_0xffa9('0x45')]['id']}})[_0xffa9('0x29')](handleEntityNotFound(_0x2974af,null))['then'](removeEntity(_0x2974af,null))[_0xffa9('0x43')](handleError(_0x2974af,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 530ee57..5468d78 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 _0x0068=['name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name_chat','ChatWebsiteId','name_mail','name'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0x0068,0x14c));var _0x8006=function(_0x4064b9,_0x11a61c){_0x4064b9=_0x4064b9-0x0;var _0x2e28d6=_0x0068[_0x4064b9];return _0x2e28d6;};'use strict';var _=require(_0x8006('0x0'));var util=require('util');var logger=require(_0x8006('0x1'))('api');var moment=require(_0x8006('0x2'));var BPromise=require(_0x8006('0x3'));var rp=require(_0x8006('0x4'));var fs=require('fs');var path=require(_0x8006('0x5'));var rimraf=require(_0x8006('0x6'));var config=require(_0x8006('0x7'));var attributes=require(_0x8006('0x8'));module[_0x8006('0x9')]=function(_0x5e1149,_0x4086d6){return _0x5e1149[_0x8006('0xa')](_0x8006('0xb'),attributes,{'tableName':_0x8006('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8006('0xd'),'fields':['name','ListId']},{'unique':!![],'name':_0x8006('0xe'),'fields':['name',_0x8006('0xf')]},{'unique':!![],'name':_0x8006('0x10'),'fields':[_0x8006('0x11'),'MailAccountId']},{'unique':!![],'name':_0x8006('0x12'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x8006('0x13'),'fields':['name',_0x8006('0x14')]},{'unique':!![],'name':_0x8006('0x15'),'fields':[_0x8006('0x11'),_0x8006('0x16')]},{'unique':!![],'name':_0x8006('0x17'),'fields':[_0x8006('0x11'),_0x8006('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb4f=['exports','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x5b37c2,_0x48b36e){var _0x35ceb8=function(_0x4a37ce){while(--_0x4a37ce){_0x5b37c2['push'](_0x5b37c2['shift']());}};_0x35ceb8(++_0x48b36e);}(_0xdb4f,0x159));var _0xfdb4=function(_0x548e1d,_0x3534d3){_0x548e1d=_0x548e1d-0x0;var _0x398584=_0xdb4f[_0x548e1d];return _0x398584;};'use strict';var _=require(_0xfdb4('0x0'));var util=require(_0xfdb4('0x1'));var logger=require('../../config/logger')(_0xfdb4('0x2'));var moment=require(_0xfdb4('0x3'));var BPromise=require(_0xfdb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdb4('0x5'));var rimraf=require('rimraf');var config=require(_0xfdb4('0x6'));var attributes=require('./disposition.attributes');module[_0xfdb4('0x7')]=function(_0x30f634,_0x287ddb){return _0x30f634['define'](_0xfdb4('0x8'),attributes,{'tableName':_0xfdb4('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xfdb4('0xa'),'fields':[_0xfdb4('0xb'),'ListId']},{'unique':!![],'name':_0xfdb4('0xc'),'fields':[_0xfdb4('0xb'),_0xfdb4('0xd')]},{'unique':!![],'name':_0xfdb4('0xe'),'fields':[_0xfdb4('0xb'),_0xfdb4('0xf')]},{'unique':!![],'name':_0xfdb4('0x10'),'fields':[_0xfdb4('0xb'),_0xfdb4('0x11')]},{'unique':!![],'name':_0xfdb4('0x12'),'fields':[_0xfdb4('0xb'),_0xfdb4('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xfdb4('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0xfdb4('0x14'),'fields':[_0xfdb4('0xb'),_0xfdb4('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 0a1023a..0cd44b3 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(_0x56443e,_0x5320f6){var _0x29b28d=function(_0x3adfbc){while(--_0x3adfbc){_0x56443e['push'](_0x56443e['shift']());}};_0x29b28d(++_0x5320f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x3762df,_0x2dbf6b){var _0x37f705=function(_0x41a930){while(--_0x41a930){_0x3762df['push'](_0x3762df['shift']());}};_0x37f705(++_0x2dbf6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 d85b4c1..dfa6f39 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 _0x3d35=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4c7266,_0x4d10c4){var _0x415107=function(_0x4e1067){while(--_0x4e1067){_0x4c7266['push'](_0x4c7266['shift']());}};_0x415107(++_0x4d10c4);}(_0x3d35,0x1ef));var _0x53d3=function(_0x15f426,_0x3eaae4){_0x15f426=_0x15f426-0x0;var _0x1318e6=_0x3d35[_0x15f426];return _0x1318e6;};'use strict';var multer=require('multer');var util=require(_0x53d3('0x0'));var path=require(_0x53d3('0x1'));var timeout=require(_0x53d3('0x2'));var express=require(_0x53d3('0x3'));var router=express[_0x53d3('0x4')]();var fs_extra=require(_0x53d3('0x5'));var auth=require(_0x53d3('0x6'));var interaction=require(_0x53d3('0x7'));var config=require(_0x53d3('0x8'));var controller=require(_0x53d3('0x9'));router[_0x53d3('0xa')]('/',auth[_0x53d3('0xb')](),controller[_0x53d3('0xc')]);router[_0x53d3('0xa')]('/:id',auth[_0x53d3('0xb')](),controller[_0x53d3('0xd')]);router['post']('/',auth[_0x53d3('0xb')](),controller[_0x53d3('0xe')]);router['put'](_0x53d3('0xf'),auth['isAuthenticated'](),controller[_0x53d3('0x10')]);router[_0x53d3('0x11')](_0x53d3('0xf'),auth[_0x53d3('0xb')](),controller[_0x53d3('0x12')]);module[_0x53d3('0x13')]=router; \ No newline at end of file +var _0x0e60=['fs-extra','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x0e60,0xa6));var _0x00e6=function(_0x420711,_0x470223){_0x420711=_0x420711-0x0;var _0x4aee7d=_0x0e60[_0x420711];return _0x4aee7d;};'use strict';var multer=require(_0x00e6('0x0'));var util=require(_0x00e6('0x1'));var path=require(_0x00e6('0x2'));var timeout=require(_0x00e6('0x3'));var express=require(_0x00e6('0x4'));var router=express['Router']();var fs_extra=require(_0x00e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x00e6('0x6'));var config=require('../../config/environment');var controller=require(_0x00e6('0x7'));router[_0x00e6('0x8')]('/',auth[_0x00e6('0x9')](),controller[_0x00e6('0xa')]);router[_0x00e6('0x8')](_0x00e6('0xb'),auth[_0x00e6('0x9')](),controller['show']);router[_0x00e6('0xc')]('/',auth['isAuthenticated'](),controller[_0x00e6('0xd')]);router[_0x00e6('0xe')]('/:id',auth[_0x00e6('0x9')](),controller[_0x00e6('0xf')]);router[_0x00e6('0x10')]('/:id',auth[_0x00e6('0x9')](),controller[_0x00e6('0x11')]);module[_0x00e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dd4aecf..b22d5d4 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 _0x41fe=['2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x41fe,0xd1));var _0xe41f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x41fe[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xe41f('0x0'));module[_0xe41f('0x1')]={'name':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe41f('0x2')]},'ecm':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0x4'),'no'),'defaultValue':_0xe41f('0x4')},'headerinfo':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':_0xe41f('0x5')},'localstationid':{'type':Sequelize[_0xe41f('0x2')],'unique':_0xe41f('0x6')},'minrate':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0x7'),_0xe41f('0x8'),_0xe41f('0x9'),_0xe41f('0xa'),_0xe41f('0xb'),'14400'),'defaultValue':_0xe41f('0x8')},'maxrate':{'type':Sequelize[_0xe41f('0x3')]('2400',_0xe41f('0x8'),'7200','9600','12000',_0xe41f('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe41f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe41f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe41f('0x3')](_0xe41f('0xe'),_0xe41f('0xf'),_0xe41f('0x10'),_0xe41f('0x11')),'defaultValue':_0xe41f('0xe')},'key':{'type':Sequelize[_0xe41f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe41f('0x12');}},'notificationSound':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe41f('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe41f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe41f('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe41f('0x14'),'set':function(_0x5e59e2){if(!_0x5e59e2)this['setDataValue'](_0xe41f('0x15'),null);this[_0xe41f('0x16')](_0xe41f('0x17'),_0x5e59e2);}}}; \ No newline at end of file +var _0x81c6=['INTEGER','SIP','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','setDataValue','mandatoryDispositionPauseId','exports','yes','STRING','localstationid','ENUM','2400','7200','9600','4800','14400','v17,v27,v29'];(function(_0x201e79,_0x1f443b){var _0x4a04d6=function(_0x4c8d0e){while(--_0x4c8d0e){_0x201e79['push'](_0x201e79['shift']());}};_0x4a04d6(++_0x1f443b);}(_0x81c6,0x1d5));var _0x681c=function(_0x45ce30,_0x2b5ec7){_0x45ce30=_0x45ce30-0x0;var _0x2eeafb=_0x81c6[_0x45ce30];return _0x2eeafb;};'use strict';var Sequelize=require('sequelize');module[_0x681c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x681c('0x1'),'no'),'defaultValue':_0x681c('0x1')},'headerinfo':{'type':Sequelize[_0x681c('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x681c('0x2')],'unique':_0x681c('0x3')},'minrate':{'type':Sequelize[_0x681c('0x4')](_0x681c('0x5'),'4800',_0x681c('0x6'),_0x681c('0x7'),'12000','14400'),'defaultValue':_0x681c('0x8')},'maxrate':{'type':Sequelize[_0x681c('0x4')](_0x681c('0x5'),'4800','7200',_0x681c('0x7'),'12000',_0x681c('0x9')),'defaultValue':_0x681c('0x9')},'modem':{'type':Sequelize[_0x681c('0x2')],'defaultValue':_0x681c('0xa')},'gateway':{'type':Sequelize['STRING'],'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[_0x681c('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x681c('0x4')](_0x681c('0xc'),'IAX',_0x681c('0xd'),'KHOMP'),'defaultValue':_0x681c('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x681c('0xe')],'defaultValue':function(){return _0x681c('0xf');}},'notificationSound':{'type':Sequelize[_0x681c('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x681c('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x681c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x681c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x681c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x681c('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x681c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x681c('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x681c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x681c('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf3c042){if(!_0xf3c042)this[_0x681c('0x12')](_0x681c('0x13'),null);this[_0x681c('0x12')]('mandatoryDisposition',_0xf3c042);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 61fa53c..6c624b5 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 _0x4e3d=['info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','localhost','./faxAccount.socket','register','jayson/promise','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','catch','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','order','sort','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','addAccountApplications','VoiceExtension','createdAt','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax'];(function(_0x75aad9,_0x4433f3){var _0x461c58=function(_0x3482f6){while(--_0x3482f6){_0x75aad9['push'](_0x75aad9['shift']());}};_0x461c58(++_0x4433f3);}(_0x4e3d,0x174));var _0xd4e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4e3d[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xd4e3('0x0'));var rimraf=require(_0xd4e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4e3('0x2'));var moment=require(_0xd4e3('0x3'));var BPromise=require(_0xd4e3('0x4'));var Mustache=require(_0xd4e3('0x5'));var util=require(_0xd4e3('0x6'));var path=require(_0xd4e3('0x7'));var sox=require(_0xd4e3('0x8'));var csv=require(_0xd4e3('0x9'));var ejs=require(_0xd4e3('0xa'));var fs=require('fs');var fs_extra=require(_0xd4e3('0xb'));var _=require(_0xd4e3('0xc'));var squel=require('squel');var crypto=require(_0xd4e3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd4e3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd4e3('0xf'));var Papa=require(_0xd4e3('0x10'));var Redis=require(_0xd4e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd4e3('0x12'));var as=require(_0xd4e3('0x13'));var hardwareService=require(_0xd4e3('0x14'));var logger=require(_0xd4e3('0x15'))(_0xd4e3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd4e3('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4e3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd4e3('0x19'))[_0xd4e3('0x1a')](socket);var jayson=require(_0xd4e3('0x1b'));var client=jayson[_0xd4e3('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xd4e3('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de6fb,_0x1e0787,_0x3182f0,_0x42d6ba){return new BPromise(function(_0x671820,_0x3a6c1e){var _0x264350=_0x42d6ba||client;return _0x264350[_0xd4e3('0x1d')](_0x2de6fb,_0x3182f0)[_0xd4e3('0x1e')](function(_0x140174){logger['info'](_0xd4e3('0x1f'),_0x1e0787,_0xd4e3('0x20'));logger['debug'](_0xd4e3('0x21'),_0x1e0787,_0xd4e3('0x20'),JSON['stringify'](_0x140174));if(_0x140174[_0xd4e3('0x22')]){if(_0x140174[_0xd4e3('0x22')]['code']===0x1f4){logger['error'](_0xd4e3('0x1f'),_0x1e0787,_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);return _0x3a6c1e(_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);}logger[_0xd4e3('0x22')](_0xd4e3('0x1f'),_0x1e0787,_0x140174['error'][_0xd4e3('0x23')]);return _0x671820(_0x140174[_0xd4e3('0x22')][_0xd4e3('0x23')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1e0787,_0xd4e3('0x20'));_0x671820(_0x140174['result'][_0xd4e3('0x23')]);}})['catch'](function(_0x57d0c1){logger[_0xd4e3('0x22')](_0xd4e3('0x1f'),_0x1e0787,_0x57d0c1);_0x3a6c1e(_0x57d0c1);});});}function respondWithStatusCode(_0x12bb19,_0x498879){_0x498879=_0x498879||0xcc;return function(_0x46c5ac){if(_0x46c5ac){return _0x12bb19[_0xd4e3('0x24')](_0x498879);}return _0x12bb19[_0xd4e3('0x25')](_0x498879)['end']();};}function respondWithResult(_0x22eca1,_0x18c5cf){_0x18c5cf=_0x18c5cf||0xc8;return function(_0x15aa50){if(_0x15aa50){return _0x22eca1[_0xd4e3('0x25')](_0x18c5cf)[_0xd4e3('0x26')](_0x15aa50);}};}function respondWithFilteredResult(_0x5aeead,_0x596b5e){return function(_0x3644ae){if(_0x3644ae){var _0xef03f1=typeof _0x596b5e[_0xd4e3('0x27')]===_0xd4e3('0x28')&&typeof _0x596b5e[_0xd4e3('0x29')]===_0xd4e3('0x28');var _0x129bd0=_0x3644ae[_0xd4e3('0x2a')];var _0x15e454=_0xef03f1?0x0:_0x596b5e['offset'];var _0x57b3d2=_0xef03f1?_0x3644ae[_0xd4e3('0x2a')]:_0x596b5e[_0xd4e3('0x27')]+_0x596b5e['limit'];var _0x57d733;if(_0x57b3d2>=_0x129bd0){_0x57b3d2=_0x129bd0;_0x57d733=0xc8;}else{_0x57d733=0xce;}_0x5aeead[_0xd4e3('0x25')](_0x57d733);return _0x5aeead[_0xd4e3('0x2b')]('Content-Range',_0x15e454+'-'+_0x57b3d2+'/'+_0x129bd0)[_0xd4e3('0x26')](_0x3644ae);}return null;};}function patchUpdates(_0x51dde3){return function(_0xeb6c50){try{jsonpatch[_0xd4e3('0x2c')](_0xeb6c50,_0x51dde3,!![]);}catch(_0x337666){return BPromise['reject'](_0x337666);}return _0xeb6c50[_0xd4e3('0x2d')]();};}function saveUpdates(_0x5e84b5,_0x1378e7){return function(_0x16991b){if(_0x16991b){return _0x16991b[_0xd4e3('0x2e')](_0x5e84b5)['then'](function(_0x3a9681){return _0x3a9681;});}return null;};}function removeEntity(_0x448c8c,_0x1407f4){return function(_0x258621){if(_0x258621){return _0x258621[_0xd4e3('0x2f')]()[_0xd4e3('0x1e')](function(){var _0x4816f8=_0x258621[_0xd4e3('0x30')]({'plain':!![]});var _0x4f5f90='FaxAccounts';return db[_0xd4e3('0x31')]['destroy']({'where':{'type':_0x4f5f90,'resourceId':_0x4816f8['id']}})[_0xd4e3('0x1e')](function(){return _0x258621;});})[_0xd4e3('0x1e')](function(){_0x448c8c['status'](0xcc)[_0xd4e3('0x32')]();});}};}function handleEntityNotFound(_0x4340be,_0x45e7c0){return function(_0xa7a838){if(!_0xa7a838){_0x4340be[_0xd4e3('0x24')](0x194);}return _0xa7a838;};}function handleError(_0x3fcdec,_0x2cf747){_0x2cf747=_0x2cf747||0x1f4;return function(_0x5c88f9){logger[_0xd4e3('0x22')](_0x5c88f9[_0xd4e3('0x33')]);if(_0x5c88f9[_0xd4e3('0x34')]){delete _0x5c88f9['name'];}_0x3fcdec[_0xd4e3('0x25')](_0x2cf747)[_0xd4e3('0x35')](_0x5c88f9);};}exports[_0xd4e3('0x36')]=function(_0x203f64,_0x4d7787){var _0x1707e6={'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]},_0x6985fe={},_0x225ab7={'count':0x0,'rows':[]};var _0x212d84=_[_0xd4e3('0x39')](db[_0xd4e3('0x3a')][_0xd4e3('0x3b')],function(_0x58c191){return{'name':_0x58c191['fieldName'],'type':_0x58c191['type'][_0xd4e3('0x3c')]};});_0x6985fe['model']=_['map'](_0x212d84,_0xd4e3('0x34'));_0x6985fe[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x203f64[_0xd4e3('0x3d')]);_0x6985fe[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x6985fe[_0xd4e3('0x41')],_0x6985fe[_0xd4e3('0x3d')]);_0x1707e6[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x6985fe[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x203f64['query'][_0xd4e3('0x43')]));_0x1707e6[_0xd4e3('0x42')]=_0x1707e6[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x1707e6[_0xd4e3('0x42')]:_0x6985fe[_0xd4e3('0x41')];if(!_0x203f64[_0xd4e3('0x3d')]['hasOwnProperty'](_0xd4e3('0x45'))){_0x1707e6[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x203f64[_0xd4e3('0x3d')]['limit']);_0x1707e6[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x203f64['query'][_0xd4e3('0x27')]);}_0x1707e6['order']=qs['sort'](_0x203f64['query']['sort']);_0x1707e6[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x203f64[_0xd4e3('0x3d')],_0x6985fe[_0xd4e3('0x3f')]),_0x212d84);if(_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x1707e6[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x1707e6[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x212d84,function(_0x176369){if(_0x176369[_0xd4e3('0x4a')]!==_0xd4e3('0x4b')){var _0x580274={};_0x580274[_0x176369['name']]={'$like':'%'+_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x580274;}})});}_0x1707e6=_[_0xd4e3('0x49')]({},_0x1707e6,_0x203f64[_0xd4e3('0x4c')]);var _0x44f3c7={'where':_0x1707e6[_0xd4e3('0x46')]};return db[_0xd4e3('0x3a')][_0xd4e3('0x2a')](_0x44f3c7)[_0xd4e3('0x1e')](function(_0x5e29ee){_0x225ab7['count']=_0x5e29ee;if(_0x203f64[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x1707e6[_0xd4e3('0x4e')]=[{'all':!![]}];}return db['FaxAccount'][_0xd4e3('0x4f')](_0x1707e6);})[_0xd4e3('0x1e')](function(_0x3f23a2){_0x225ab7[_0xd4e3('0x50')]=_0x3f23a2;return _0x225ab7;})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x4d7787,_0x1707e6))['catch'](handleError(_0x4d7787,null));};exports[_0xd4e3('0x51')]=function(_0xc7b656,_0x436682){var _0x56f581={'raw':![],'where':{'id':_0xc7b656[_0xd4e3('0x52')]['id']},'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]},_0x522683={};_0x522683[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x3a')][_0xd4e3('0x3b')]);_0x522683[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0xc7b656['query']);_0x522683[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x522683[_0xd4e3('0x41')],_0x522683['query']);_0x56f581[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x522683[_0xd4e3('0x41')],qs['fields'](_0xc7b656[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x56f581[_0xd4e3('0x42')]=_0x56f581[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x56f581[_0xd4e3('0x42')]:_0x522683['model'];if(_0xc7b656['query'][_0xd4e3('0x4d')]){_0x56f581['include']=[{'all':!![]}];}_0x56f581=_[_0xd4e3('0x49')]({},_0x56f581,_0xc7b656[_0xd4e3('0x4c')]);return db[_0xd4e3('0x3a')][_0xd4e3('0x53')](_0x56f581)[_0xd4e3('0x1e')](handleEntityNotFound(_0x436682,null))[_0xd4e3('0x1e')](respondWithResult(_0x436682,null))['catch'](handleError(_0x436682,null));};exports['create']=function(_0x58baac,_0x25487e){return db[_0xd4e3('0x3a')][_0xd4e3('0x54')](_0x58baac[_0xd4e3('0x55')],{})['then'](function(_0x298ab1){var _0xd2d46f=_0x58baac[_0xd4e3('0x56')][_0xd4e3('0x30')]({'plain':!![]});if(!_0xd2d46f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd2d46f['role']===_0xd4e3('0x56')){var _0x7caa0a=_0x298ab1[_0xd4e3('0x30')]({'plain':!![]});var _0x334043=_0xd4e3('0x57');return db[_0xd4e3('0x58')][_0xd4e3('0x53')]({'where':{'name':_0x334043,'userProfileId':_0xd2d46f[_0xd4e3('0x59')]},'raw':!![]})[_0xd4e3('0x1e')](function(_0x13ae87){if(_0x13ae87&&_0x13ae87[_0xd4e3('0x5a')]===0x0){return db[_0xd4e3('0x31')]['create']({'name':_0x7caa0a[_0xd4e3('0x34')],'resourceId':_0x7caa0a['id'],'type':_0x13ae87[_0xd4e3('0x34')],'sectionId':_0x13ae87['id']},{})[_0xd4e3('0x1e')](function(){return _0x298ab1;});}else{return _0x298ab1;}})[_0xd4e3('0x5b')](function(_0x29315a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29315a);throw _0x29315a;});}return _0x298ab1;})[_0xd4e3('0x1e')](respondWithResult(_0x25487e,0xc9))[_0xd4e3('0x5b')](handleError(_0x25487e,null));};exports['update']=function(_0x680a2d,_0x4ec56e){if(_0x680a2d[_0xd4e3('0x55')]['id']){delete _0x680a2d['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x680a2d[_0xd4e3('0x52')]['id']},'include':[{'model':db[_0xd4e3('0x37')],'as':_0xd4e3('0x38')}]})[_0xd4e3('0x1e')](handleEntityNotFound(_0x4ec56e,null))[_0xd4e3('0x1e')](saveUpdates(_0x680a2d[_0xd4e3('0x55')],null))[_0xd4e3('0x1e')](respondWithResult(_0x4ec56e,null))['catch'](handleError(_0x4ec56e,null));};exports[_0xd4e3('0x2f')]=function(_0x451d79,_0x5e1789){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x451d79[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x5e1789,null))['then'](removeEntity(_0x5e1789,null))[_0xd4e3('0x5b')](handleError(_0x5e1789,null));};exports[_0xd4e3('0x5c')]=function(_0x4cd869,_0x2e4ed6){return db[_0xd4e3('0x3a')]['describe']()['then'](respondWithResult(_0x2e4ed6,null))['catch'](handleError(_0x2e4ed6,null));};exports[_0xd4e3('0x5d')]=function(_0x1b09a1,_0x1052cf,_0x21275e){if(_0x1b09a1[_0xd4e3('0x55')]['id']){delete _0x1b09a1['body']['id'];}return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x1b09a1[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x1052cf,null))[_0xd4e3('0x1e')](function(_0x294e30){if(_0x294e30){_0x1b09a1[_0xd4e3('0x55')][_0xd4e3('0x5e')]=_0x294e30['id'];return db[_0xd4e3('0x5f')][_0xd4e3('0x54')](_0x1b09a1[_0xd4e3('0x55')]);}})[_0xd4e3('0x1e')](respondWithResult(_0x1052cf,null))['catch'](handleError(_0x1052cf,null));};exports['getDispositions']=function(_0x40592e,_0x4e58c9,_0x57e71b){var _0x179015={'raw':![],'where':{}};var _0x167812={};var _0x635569={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x40592e[_0xd4e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e58c9,null))[_0xd4e3('0x1e')](function(_0x5abd86){if(_0x5abd86){_0x167812['model']=_['keys'](db[_0xd4e3('0x5f')]['rawAttributes']);_0x167812['query']=_[_0xd4e3('0x3e')](_0x40592e[_0xd4e3('0x3d')]);_0x167812[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x167812[_0xd4e3('0x41')],_0x167812[_0xd4e3('0x3d')]);_0x179015[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x167812[_0xd4e3('0x41')],qs['fields'](_0x40592e[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x179015[_0xd4e3('0x42')]=_0x179015['attributes']['length']?_0x179015['attributes']:_0x167812[_0xd4e3('0x41')];if(!_0x40592e['query'][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x179015[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x40592e[_0xd4e3('0x3d')]['limit']);_0x179015[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x40592e[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x179015[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x40592e[_0xd4e3('0x3d')]['sort']);_0x179015[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x40592e[_0xd4e3('0x3d')],_0x167812['filters']));_0x179015[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x5abd86['id'];if(_0x40592e[_0xd4e3('0x3d')]['filter']){_0x179015[_0xd4e3('0x46')]=_['merge'](_0x179015[_0xd4e3('0x46')],{'$or':_['map'](_0x179015[_0xd4e3('0x42')],function(_0x4129c0){var _0x4e36c0={};_0x4e36c0[_0x4129c0]={'$like':'%'+_0x40592e[_0xd4e3('0x3d')]['filter']+'%'};return _0x4e36c0;})});}_0x179015=_[_0xd4e3('0x49')]({},_0x179015,_0x40592e[_0xd4e3('0x4c')]);return db[_0xd4e3('0x5f')]['count']({'where':_0x179015[_0xd4e3('0x46')]})[_0xd4e3('0x1e')](function(_0x45b829){_0x635569[_0xd4e3('0x2a')]=_0x45b829;if(_0x40592e[_0xd4e3('0x3d')]['includeAll']){_0x179015[_0xd4e3('0x4e')]=[{'all':!![]}];}return db[_0xd4e3('0x5f')][_0xd4e3('0x4f')](_0x179015);})[_0xd4e3('0x1e')](function(_0x3e14f9){_0x635569[_0xd4e3('0x50')]=_0x3e14f9;return _0x635569;});}})['then'](respondWithFilteredResult(_0x4e58c9,_0x179015))[_0xd4e3('0x5b')](handleError(_0x4e58c9,null));};exports[_0xd4e3('0x63')]=function(_0x32026e,_0xc9a7d6,_0x442f3f){return db['FaxAccount'][_0xd4e3('0x53')]({'where':{'id':_0x32026e[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0xc9a7d6,null))[_0xd4e3('0x1e')](function(_0x454739){if(_0x454739){return _0x454739['removeDispositions'](_0x32026e[_0xd4e3('0x3d')][_0xd4e3('0x64')]);}})['then'](respondWithStatusCode(_0xc9a7d6,null))[_0xd4e3('0x5b')](handleError(_0xc9a7d6,null));};exports[_0xd4e3('0x65')]=function(_0x25c039,_0x3663b5,_0x34c051){if(_0x25c039['body']['id']){delete _0x25c039[_0xd4e3('0x55')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x25c039[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x3663b5,null))[_0xd4e3('0x1e')](function(_0x2ba94c){if(_0x2ba94c){_0x25c039['body'][_0xd4e3('0x5e')]=_0x2ba94c['id'];return db['CannedAnswer'][_0xd4e3('0x54')](_0x25c039['body']);}})[_0xd4e3('0x1e')](respondWithResult(_0x3663b5,null))['catch'](handleError(_0x3663b5,null));};exports['getAnswers']=function(_0x3fb7fb,_0x18111e,_0x5c9b8a){var _0x5b4951={'raw':![],'where':{}};var _0x55b69f={};var _0x26a9ee={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x3fb7fb[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x18111e,null))[_0xd4e3('0x1e')](function(_0x3c50cb){if(_0x3c50cb){_0x55b69f[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x67')][_0xd4e3('0x3b')]);_0x55b69f[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x3fb7fb[_0xd4e3('0x3d')]);_0x55b69f[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x55b69f['model'],_0x55b69f[_0xd4e3('0x3d')]);_0x5b4951[_0xd4e3('0x42')]=_['intersection'](_0x55b69f['model'],qs[_0xd4e3('0x43')](_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x5b4951[_0xd4e3('0x42')]=_0x5b4951[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x5b4951['attributes']:_0x55b69f['model'];if(!_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x5b4951[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x3fb7fb['query']['limit']);_0x5b4951[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x5b4951[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x3fb7fb['query'][_0xd4e3('0x62')]);_0x5b4951[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_['pick'](_0x3fb7fb[_0xd4e3('0x3d')],_0x55b69f[_0xd4e3('0x3f')]));_0x5b4951[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x3c50cb['id'];if(_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x5b4951['where']=_[_0xd4e3('0x49')](_0x5b4951[_0xd4e3('0x46')],{'$or':_['map'](_0x5b4951['attributes'],function(_0x490a6f){var _0x10c81e={};_0x10c81e[_0x490a6f]={'$like':'%'+_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x10c81e;})});}_0x5b4951=_[_0xd4e3('0x49')]({},_0x5b4951,_0x3fb7fb[_0xd4e3('0x4c')]);return db[_0xd4e3('0x67')]['count']({'where':_0x5b4951['where']})[_0xd4e3('0x1e')](function(_0x3d388c){_0x26a9ee[_0xd4e3('0x2a')]=_0x3d388c;if(_0x3fb7fb[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x5b4951[_0xd4e3('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd4e3('0x4f')](_0x5b4951);})[_0xd4e3('0x1e')](function(_0xc992f3){_0x26a9ee[_0xd4e3('0x50')]=_0xc992f3;return _0x26a9ee;});}})['then'](respondWithFilteredResult(_0x18111e,_0x5b4951))[_0xd4e3('0x5b')](handleError(_0x18111e,null));};exports[_0xd4e3('0x68')]=function(_0x4624ca,_0x2b425a,_0x5640a2){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x4624ca[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x2b425a,null))[_0xd4e3('0x1e')](function(_0x42fec9){if(_0x42fec9){return _0x42fec9[_0xd4e3('0x68')](_0x4624ca['query'][_0xd4e3('0x64')]);}})[_0xd4e3('0x1e')](respondWithStatusCode(_0x2b425a,null))['catch'](handleError(_0x2b425a,null));};exports['addInteraction']=function(_0x32b6ff,_0x2fdb73,_0x12f847){return db['FaxInteraction']['find']({'where':{'id':_0x32b6ff['params']['id']}})['then'](handleEntityNotFound(_0x2fdb73,null))[_0xd4e3('0x1e')](function(_0x4ac26d){if(_0x4ac26d){return _0x4ac26d['addInteraction'](_0x32b6ff['body'][_0xd4e3('0x64')],_[_0xd4e3('0x69')](_0x32b6ff[_0xd4e3('0x55')],[_0xd4e3('0x64'),'id'])||{});}})[_0xd4e3('0x1e')](respondWithResult(_0x2fdb73,null))[_0xd4e3('0x5b')](handleError(_0x2fdb73,null));};exports[_0xd4e3('0x6a')]=function(_0x2761ea,_0x28dfcc,_0x25dee5){var _0x2b589a={'raw':![],'where':{}};var _0x88f87a={};var _0xdd0ea1={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x2761ea[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x28dfcc,null))[_0xd4e3('0x1e')](function(_0x1e3fa7){if(_0x1e3fa7){_0x88f87a[_0xd4e3('0x41')]=_[_0xd4e3('0x3e')](db[_0xd4e3('0x6b')][_0xd4e3('0x3b')]);_0x88f87a[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x2761ea[_0xd4e3('0x3d')]);_0x88f87a[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x88f87a['model'],_0x88f87a[_0xd4e3('0x3d')]);_0x2b589a[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x88f87a[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x2761ea['query']['fields']));_0x2b589a[_0xd4e3('0x42')]=_0x2b589a[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2b589a[_0xd4e3('0x42')]:_0x88f87a[_0xd4e3('0x41')];if(!_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x60')]('nolimit')){_0x2b589a[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x29')]);_0x2b589a['offset']=qs[_0xd4e3('0x27')](_0x2761ea['query'][_0xd4e3('0x27')]);}_0x2b589a['order']=qs[_0xd4e3('0x62')](_0x2761ea[_0xd4e3('0x3d')]['sort']);_0x2b589a['where']=qs['filters'](_[_0xd4e3('0x47')](_0x2761ea[_0xd4e3('0x3d')],_0x88f87a[_0xd4e3('0x3f')]));_0x2b589a[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x1e3fa7['id'];if(_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x48')]){_0x2b589a['where']=_[_0xd4e3('0x49')](_0x2b589a['where'],{'$or':_[_0xd4e3('0x39')](_0x2b589a[_0xd4e3('0x42')],function(_0x229489){var _0x4d056c={};_0x4d056c[_0x229489]={'$like':'%'+_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x4d056c;})});}_0x2b589a=_[_0xd4e3('0x49')]({},_0x2b589a,_0x2761ea[_0xd4e3('0x4c')]);return db[_0xd4e3('0x6b')][_0xd4e3('0x2a')]({'where':_0x2b589a[_0xd4e3('0x46')]})[_0xd4e3('0x1e')](function(_0x8587e8){_0xdd0ea1[_0xd4e3('0x2a')]=_0x8587e8;if(_0x2761ea[_0xd4e3('0x3d')]['includeAll']){_0x2b589a[_0xd4e3('0x4e')]=[{'model':db[_0xd4e3('0x6c')],'as':'Contact','required':![]},{'model':db[_0xd4e3('0x6d')],'as':_0xd4e3('0x6e'),'attributes':[_0xd4e3('0x34'),'fullname',_0xd4e3('0x6f')],'required':![]},{'model':db[_0xd4e3('0x70')],'as':'Tags','attributes':['id',_0xd4e3('0x34'),_0xd4e3('0x71')],'where':_0x2761ea[_0xd4e3('0x3d')]['tag']?{'id':_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x72')]}:undefined,'required':_0x2761ea[_0xd4e3('0x3d')][_0xd4e3('0x72')]?!![]:![]}];}return db[_0xd4e3('0x6b')][_0xd4e3('0x4f')](_0x2b589a);})[_0xd4e3('0x1e')](function(_0x359d13){_0xdd0ea1[_0xd4e3('0x50')]=_0x359d13;return _0xdd0ea1;});}})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x28dfcc,_0x2b589a))[_0xd4e3('0x5b')](handleError(_0x28dfcc,null));};exports[_0xd4e3('0x73')]=function(_0x233ec8,_0x3efb0d){var _0x34ade4=_0x233ec8[_0xd4e3('0x52')]['id'];var _0x367ed3=_0x233ec8[_0xd4e3('0x55')];var _0x1bafc5=0xc8;var _0x1c355c=null;return db[_0xd4e3('0x74')][_0xd4e3('0x75')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x39798d){return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x34ade4},'transaction':_0x39798d})['then'](function(_0x2781c4){if(_0x2781c4){return db['FaxApplication'][_0xd4e3('0x2f')]({'where':{'FaxAccountId':_0x34ade4},'transaction':_0x39798d})[_0xd4e3('0x1e')](function(){var _0x24ae55=_['map'](_0x367ed3,function(_0x40a001){_0x40a001[_0xd4e3('0x5e')]=_0x34ade4;return _0x40a001;});return db[_0xd4e3('0x76')][_0xd4e3('0x77')](_0x24ae55,{'transaction':_0x39798d});});}else{_0x1bafc5=0x194;_0x1c355c=[];}});})[_0xd4e3('0x1e')](function(){if(_0x1bafc5!==0x194){return db[_0xd4e3('0x76')][_0xd4e3('0x78')]({'where':{'FaxAccountId':_0x34ade4},'order':_0xd4e3('0x79')})[_0xd4e3('0x1e')](function(_0x3e3e7f){_0x1c355c=_0x3e3e7f;});}})['catch'](function(_0x5e05dc){_0x1bafc5=0x1f4;logger['error'](_0x5e05dc[_0xd4e3('0x33')]);if(_0x5e05dc['name']){delete _0x5e05dc[_0xd4e3('0x34')];}_0x1c355c=_0x5e05dc;})['finally'](function(){if(_0x1c355c===null){_0x3efb0d[_0xd4e3('0x24')](_0x1bafc5);}else{if(_0x1bafc5===0x1f4){_0x3efb0d[_0xd4e3('0x25')](_0x1bafc5)[_0xd4e3('0x35')](_0x1c355c);}else{_0x3efb0d[_0xd4e3('0x25')](_0x1bafc5)[_0xd4e3('0x26')](_0x1c355c);}}});};exports[_0xd4e3('0x7a')]=function(_0x33aa84,_0x580ad5,_0x23a078){var _0x151982={};var _0x5ce5b4={};var _0x1df233;var _0x32b89b;return db[_0xd4e3('0x3a')]['findOne']({'where':{'id':_0x33aa84[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x580ad5,null))[_0xd4e3('0x1e')](function(_0x1970aa){if(_0x1970aa){_0x1df233=_0x1970aa;_0x5ce5b4[_0xd4e3('0x41')]=_['keys'](db[_0xd4e3('0x76')]['rawAttributes']);_0x5ce5b4[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x33aa84[_0xd4e3('0x3d')]);_0x5ce5b4[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x5ce5b4[_0xd4e3('0x41')],_0x5ce5b4['query']);_0x151982[_0xd4e3('0x42')]=_['intersection'](_0x5ce5b4[_0xd4e3('0x41')],qs['fields'](_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x151982[_0xd4e3('0x42')]=_0x151982[_0xd4e3('0x42')]['length']?_0x151982['attributes']:_0x5ce5b4[_0xd4e3('0x41')];_0x151982[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x62')]);_0x151982[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_['pick'](_0x33aa84['query'],_0x5ce5b4[_0xd4e3('0x3f')]));if(_0x33aa84[_0xd4e3('0x3d')]['filter']){_0x151982[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x151982[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x151982[_0xd4e3('0x42')],function(_0x53c065){var _0x21e855={};_0x21e855[_0x53c065]={'$like':'%'+_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x48')]+'%'};return _0x21e855;})});}_0x151982=_['merge']({},_0x151982,_0x33aa84[_0xd4e3('0x4c')]);return _0x1df233['getApplications'](_0x151982);}})[_0xd4e3('0x1e')](function(_0x16aa7a){if(_0x16aa7a){_0x32b89b=_0x16aa7a[_0xd4e3('0x44')];if(!_0x33aa84[_0xd4e3('0x3d')][_0xd4e3('0x60')](_0xd4e3('0x45'))){_0x151982[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x33aa84[_0xd4e3('0x3d')]['limit']);_0x151982[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x33aa84['query']['offset']);}return _0x1df233[_0xd4e3('0x7a')](_0x151982);}})[_0xd4e3('0x1e')](function(_0x5cf249){if(_0x5cf249){return _0x5cf249?{'count':_0x32b89b,'rows':_0x5cf249}:null;}})[_0xd4e3('0x1e')](respondWithResult(_0x580ad5,null))[_0xd4e3('0x5b')](handleError(_0x580ad5,null));};function Extension(_0xd5d85,_0x577575,_0x11ab7b,_0x32a0db){this['context']=_0xd4e3('0x7b');this[_0xd4e3('0x7c')]=_0xd5d85[_0xd4e3('0x7d')];this[_0xd4e3('0x7e')]=_0x32a0db;this[_0xd4e3('0x4a')]='system';this[_0xd4e3('0x7f')]=_0xd4e3('0x80');this[_0xd4e3('0x5e')]=_0xd5d85['id'];this[_0xd4e3('0x79')]=_0x577575;this[_0xd4e3('0x81')]=_0x11ab7b;}function createExtensionsReciveFax(_0xb6d284){var _0x2746a2=0x1;var _0x58802c=[];_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'',_0xd4e3('0x83')));_0x2746a2+=0x1;_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,_0xd4e3('0x84'),_0xd4e3('0x85')));_0x2746a2+=0x1;for(var _0x4e75b9 in _0xb6d284){if(_0xb6d284['hasOwnProperty'](_0x4e75b9)&&(_0x4e75b9==='ecm'||_0x4e75b9===_0xd4e3('0x7d')||_0x4e75b9===_0xd4e3('0x86')||_0x4e75b9===_0xd4e3('0x87')||_0x4e75b9===_0xd4e3('0x88')||_0x4e75b9===_0xd4e3('0x89')||_0x4e75b9==='minrate'||_0x4e75b9===_0xd4e3('0x8a')||_0x4e75b9===_0xd4e3('0x8b'))){_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'FAXOPT('+_0x4e75b9+')='+_0xb6d284[_0x4e75b9],_0xd4e3('0x85')));_0x2746a2+=0x1;}}_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'6','Wait'));_0x2746a2+=0x1;_0x58802c[_0xd4e3('0x82')](new Extension(_0xb6d284,_0x2746a2,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x2746a2=0x0;return _0x58802c;}exports[_0xd4e3('0x8c')]=function(_0x4a8516,_0x4c750b,_0x4f4e66){var _0x4dd495;return db[_0xd4e3('0x74')]['transaction'](function(_0x40386b){return db[_0xd4e3('0x3a')][_0xd4e3('0x54')](_0x4a8516[_0xd4e3('0x55')],{'transaction':_0x40386b})['then'](function(_0x1aa1fd){_0x4dd495=_0x1aa1fd['get']({'plain':!![]});return db['VoiceExtension'][_0xd4e3('0x77')](createExtensionsReciveFax(_0x4dd495),{'transaction':_0x40386b});});})[_0xd4e3('0x1e')](function(){return _0x4dd495;})[_0xd4e3('0x1e')](respondWithResult(_0x4c750b,null))[_0xd4e3('0x5b')](handleError(_0x4c750b,null));};exports['updateAccountApplications']=function(_0x322ffb,_0x646d00,_0x2ccada){var _0x81778f;return db[_0xd4e3('0x74')]['transaction'](function(_0x105ea6){return db['FaxAccount'][_0xd4e3('0x2e')](_0x322ffb[_0xd4e3('0x55')],{'where':{'id':_0x322ffb['body']['id']},'transaction':_0x105ea6})[_0xd4e3('0x1e')](function(_0x4ab9d3){return db[_0xd4e3('0x8d')][_0xd4e3('0x2f')]({'where':{'FaxAccountId':_0x322ffb[_0xd4e3('0x55')]['id']},'transaction':_0x105ea6})[_0xd4e3('0x1e')](function(_0x425087){return db[_0xd4e3('0x8d')][_0xd4e3('0x77')](createExtensionsReciveFax(_['omit'](_0x322ffb[_0xd4e3('0x55')],['tech',_0xd4e3('0x3c'),_0xd4e3('0x8e'),_0xd4e3('0x8f'),'TrunkId',_0xd4e3('0x90')])),{'transaction':_0x105ea6});});});})[_0xd4e3('0x1e')](function(){return db['FaxAccount']['findById'](_0x322ffb[_0xd4e3('0x55')]['id']);})['then'](respondWithResult(_0x646d00,null))[_0xd4e3('0x5b')](handleError(_0x646d00,null));};exports[_0xd4e3('0x91')]=function(_0x35a1ab,_0x902e87,_0x2c6156){var _0x2f6873={'raw':!![],'where':{}};var _0x4371c6={};var _0x241039={'count':0x0,'rows':[]};return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x35a1ab[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x902e87,null))[_0xd4e3('0x1e')](function(_0x363b1e){if(_0x363b1e){_0x4371c6[_0xd4e3('0x41')]=_[_0xd4e3('0x3e')](db[_0xd4e3('0x92')][_0xd4e3('0x3b')]);_0x4371c6[_0xd4e3('0x3d')]=_['keys'](_0x35a1ab[_0xd4e3('0x3d')]);_0x4371c6[_0xd4e3('0x3f')]=_['intersection'](_0x4371c6[_0xd4e3('0x41')],_0x4371c6[_0xd4e3('0x3d')]);_0x2f6873['attributes']=_[_0xd4e3('0x40')](_0x4371c6[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x43')]));_0x2f6873['attributes']=_0x2f6873[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2f6873[_0xd4e3('0x42')]:_0x4371c6[_0xd4e3('0x41')];if(!_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x60')]('nolimit')){_0x2f6873[_0xd4e3('0x29')]=qs[_0xd4e3('0x29')](_0x35a1ab[_0xd4e3('0x3d')]['limit']);_0x2f6873['offset']=qs[_0xd4e3('0x27')](_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}_0x2f6873[_0xd4e3('0x61')]=qs[_0xd4e3('0x62')](_0x35a1ab[_0xd4e3('0x3d')]['sort']);_0x2f6873[_0xd4e3('0x46')]=qs['filters'](_['pick'](_0x35a1ab['query'],_0x4371c6['filters']));_0x2f6873[_0xd4e3('0x46')][_0xd4e3('0x5e')]=_0x363b1e['id'];if(_0x35a1ab['query'][_0xd4e3('0x48')]){_0x2f6873[_0xd4e3('0x46')]=_['merge'](_0x2f6873['where'],{'$or':_['map'](_0x2f6873[_0xd4e3('0x42')],function(_0x5d5338){var _0x14ca7c={};_0x14ca7c[_0x5d5338]={'$like':'%'+_0x35a1ab[_0xd4e3('0x3d')]['filter']+'%'};return _0x14ca7c;})});}if(_0x35a1ab['query'][_0xd4e3('0x93')]){var _0x6556a6=_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x93')][_0xd4e3('0x94')](',');var _0x1a27ba={};_0x1a27ba[_0x6556a6[0x0]]={'$gte':moment(_0x6556a6[0x1])[_0xd4e3('0x95')](_0xd4e3('0x96'))};_0x2f6873[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x2f6873[_0xd4e3('0x46')],_0x1a27ba);}_0x2f6873=_['merge']({},_0x2f6873,_0x35a1ab[_0xd4e3('0x4c')]);return db[_0xd4e3('0x92')][_0xd4e3('0x2a')]({'where':_0x2f6873[_0xd4e3('0x46')]})['then'](function(_0x331e5a){_0x241039[_0xd4e3('0x2a')]=_0x331e5a;if(_0x35a1ab[_0xd4e3('0x3d')][_0xd4e3('0x4d')]){_0x2f6873[_0xd4e3('0x4e')]=[{'all':!![]}];}return db[_0xd4e3('0x92')][_0xd4e3('0x4f')](_0x2f6873);})['then'](function(_0x528601){_0x241039[_0xd4e3('0x50')]=_0x528601;return _0x241039;});}})[_0xd4e3('0x1e')](respondWithFilteredResult(_0x902e87,_0x2f6873))[_0xd4e3('0x5b')](handleError(_0x902e87,null));};exports[_0xd4e3('0x35')]=function(_0x3179e8,_0x47b412,_0x3f3ad4){var _0x5c6fdb,_0x38c352={},_0x54c15f;if(_0x3179e8[_0xd4e3('0x55')]['to']){_0x54c15f=_0x3179e8[_0xd4e3('0x55')]['to'][0x0];}return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x3179e8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd4e3('0x6c')],'as':_0xd4e3('0x97'),'where':{'fax':_0x54c15f},'limit':0x1,'order':[[_0xd4e3('0x8f'),_0xd4e3('0x98')]]}]}]})[_0xd4e3('0x1e')](handleEntityNotFound(_0x47b412,null))[_0xd4e3('0x1e')](function(_0x3cf845){_0x5c6fdb=_0x3cf845;if(_0x3179e8['body']['attachments']&&_0x3179e8[_0xd4e3('0x55')]['attachments'][_0xd4e3('0x44')]){for(var _0x114bb8=0x0;_0x114bb8<_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0xd4e3('0x44')];_0x114bb8+=0x1){_0x3179e8[_0xd4e3('0x55')]['attachments'][_0x114bb8]={'filename':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0x114bb8]['name'],'id':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][_0x114bb8]['id'],'path':path[_0xd4e3('0x9a')](config[_0xd4e3('0x9b')],_0xd4e3('0x9c'),_0x3179e8[_0xd4e3('0x55')]['attachments'][_0x114bb8][_0xd4e3('0x9d')])};}}return respondWithRpcPromise(_0xd4e3('0x9e'),_0xd4e3('0x9e'),{'FaxAccountId':_['isNil'](_0x3179e8[_0xd4e3('0x52')]['id'])?undefined:_0x3179e8[_0xd4e3('0x52')]['id'],'path':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')])?undefined:_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')],'fax':_['isNil'](_0x3179e8[_0xd4e3('0x55')]['to'][0x0])?undefined:_0x3179e8['body']['to'][0x0]},client9002);})[_0xd4e3('0x1e')](function(){if(_0x5c6fdb){if(_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0xa0')])){_0x3179e8[_0xd4e3('0x55')]['from']=util[_0xd4e3('0x95')](_0xd4e3('0xa1'),_0x5c6fdb['name'],_0x5c6fdb[_0xd4e3('0xa2')]);}if(_0x5c6fdb[_0xd4e3('0xa3')]){if(_0x5c6fdb['List'][_0xd4e3('0x97')][_0xd4e3('0x44')]){return _0x5c6fdb[_0xd4e3('0xa3')][_0xd4e3('0x97')][0x0];}else{return db[_0xd4e3('0x6c')]['create'](_[_0xd4e3('0xa4')](_0x3179e8[_0xd4e3('0x55')],{'firstName':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'phone':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'fax':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'ListId':_0x5c6fdb[_0xd4e3('0x90')]}));}}else{throw new Error(_0xd4e3('0xa5'));}}else{throw new Error(_0xd4e3('0xa6'));}})[_0xd4e3('0x1e')](function(_0x5a2ea0){if(_0x5a2ea0){return db[_0xd4e3('0x6b')][_0xd4e3('0x53')]({'where':{'ContactId':_0x5a2ea0['id'],'closed':![],'FaxAccountId':_0x5c6fdb['id']}})[_0xd4e3('0x1e')](function(_0xfb28f2){if(_0xfb28f2){return[_0xfb28f2,![]];}return db[_0xd4e3('0x6b')][_0xd4e3('0x54')]({'UserId':_0x3179e8['user']['id'],'ContactId':_0x5a2ea0['id'],'FaxAccountId':_0x5c6fdb['id'],'fax':_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'firstMsgDirection':_0xd4e3('0xa7'),'Messages':[_[_0xd4e3('0x49')](_0x3179e8[_0xd4e3('0x55')],{'read':![],'body':_0x3179e8[_0xd4e3('0x55')]['attachments'][0x0][_0xd4e3('0xa8')],'FaxAccountId':_0x5c6fdb['id'],'UserId':_0x3179e8[_0xd4e3('0x56')]['id'],'ContactId':_0x5a2ea0['id'],'AttachmentId':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['id']})]},{'include':[{'model':db[_0xd4e3('0x92')],'as':_0xd4e3('0xa9')}]})[_0xd4e3('0x1e')](function(_0x54fa8a){return[_0x54fa8a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd4e3('0xaa')](function(_0x2ca292,_0x5461f0){if(_0x5461f0){return _0x2ca292;}return db[_0xd4e3('0x92')][_0xd4e3('0x54')]({'direction':_0xd4e3('0xa7'),'read':![],'body':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0xa8')],'FaxAccountId':_0x5c6fdb['id'],'FaxInteractionId':_0x2ca292['id'],'UserId':_0x3179e8[_0xd4e3('0x56')]['id'],'ContactId':_0x2ca292[_0xd4e3('0xab')],'AttachmentId':_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['id']})[_0xd4e3('0x1e')](function(_0x34223a){_0x2ca292[_0xd4e3('0xac')][_0xd4e3('0xa9')]=[];_0x2ca292[_0xd4e3('0xac')]['Messages'][_0xd4e3('0x82')](_0x34223a[_0xd4e3('0xac')]);return _0x2ca292;});})[_0xd4e3('0x1e')](function(_0x1a1cba){respondWithRpcPromise(_0xd4e3('0xad'),_0xd4e3('0xad'),{'FaxAccountId':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x52')]['id'])?undefined:_0x3179e8[_0xd4e3('0x52')]['id'],'path':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0]['path'])?undefined:_0x3179e8[_0xd4e3('0x55')][_0xd4e3('0x99')][0x0][_0xd4e3('0x7')],'fax':_[_0xd4e3('0x9f')](_0x3179e8[_0xd4e3('0x55')]['to'][0x0])?undefined:_0x3179e8[_0xd4e3('0x55')]['to'][0x0],'AttachmentId':_0x3179e8['body'][_0xd4e3('0x99')][0x0]['id']},client9002)[_0xd4e3('0x1e')](function(_0x15f17c){logger[_0xd4e3('0xae')](_0xd4e3('0xaf'),_0x15f17c);})[_0xd4e3('0x5b')](function(_0x3aaf11){logger[_0xd4e3('0xae')](_0xd4e3('0xaf'),_0x3aaf11);});return _0x1a1cba;})[_0xd4e3('0x1e')](respondWithResult(_0x47b412,null))[_0xd4e3('0x5b')](handleError(_0x47b412,null));};exports['addAgents']=function(_0x5b0c81,_0x2d02de,_0x4ea5be){return db['FaxAccount'][_0xd4e3('0x53')]({'where':{'id':_0x5b0c81['params']['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x2d02de,null))[_0xd4e3('0x1e')](function(_0x29e519){if(_0x29e519){return _0x29e519[_0xd4e3('0xb0')](_0x5b0c81['body'][_0xd4e3('0x64')],_[_0xd4e3('0x69')](_0x5b0c81[_0xd4e3('0x55')],[_0xd4e3('0x64'),'id'])||{})[_0xd4e3('0xaa')](function(_0x13427d){for(var _0x755ac=0x0;_0x755ac<_0x5b0c81['body'][_0xd4e3('0x64')][_0xd4e3('0x44')];_0x755ac+=0x1){socket[_0xd4e3('0xb1')](_0xd4e3('0xb2'),{'UserId':Number(_0x5b0c81[_0xd4e3('0x55')][_0xd4e3('0x64')][_0x755ac]),'FaxAccountId':Number(_0x5b0c81['params']['id'])});}return _0x13427d;});}})[_0xd4e3('0x1e')](respondWithResult(_0x2d02de,null))[_0xd4e3('0x5b')](handleError(_0x2d02de,null));};exports[_0xd4e3('0xb3')]=function(_0x1a9b62,_0x18f371,_0x2b5767){return db[_0xd4e3('0x3a')][_0xd4e3('0x53')]({'where':{'id':_0x1a9b62[_0xd4e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x18f371,null))[_0xd4e3('0x1e')](function(_0x3b5ee6){if(_0x3b5ee6){return _0x3b5ee6[_0xd4e3('0xb3')](_0x1a9b62['query']['ids'])[_0xd4e3('0x1e')](function(){if(_['isArray'](_0x1a9b62[_0xd4e3('0x3d')][_0xd4e3('0x64')])){for(var _0x407b60=0x0;_0x407b60<_0x1a9b62['query']['ids'][_0xd4e3('0x44')];_0x407b60+=0x1){socket[_0xd4e3('0xb1')](_0xd4e3('0xb4'),{'UserId':Number(_0x1a9b62['query']['ids'][_0x407b60]),'FaxAccountId':Number(_0x1a9b62['params']['id'])});}}else{socket[_0xd4e3('0xb1')]('userFaxAccount:remove',{'UserId':Number(_0x1a9b62[_0xd4e3('0x3d')]['ids']),'FaxAccountId':Number(_0x1a9b62[_0xd4e3('0x52')]['id'])});}});}})[_0xd4e3('0x1e')](respondWithStatusCode(_0x18f371,null))[_0xd4e3('0x5b')](handleError(_0x18f371,null));};exports[_0xd4e3('0xb5')]=function(_0x8bb7ff,_0x105ad0,_0x476551){var _0x2991b1={};var _0x567ec3={};var _0x1a4310;var _0x2d8842;return db[_0xd4e3('0x3a')][_0xd4e3('0x66')]({'where':{'id':_0x8bb7ff[_0xd4e3('0x52')]['id']}})[_0xd4e3('0x1e')](handleEntityNotFound(_0x105ad0,null))[_0xd4e3('0x1e')](function(_0xd9c6f6){if(_0xd9c6f6){_0x1a4310=_0xd9c6f6;_0x567ec3['model']=_['keys'](db[_0xd4e3('0x6d')][_0xd4e3('0x3b')]);_0x567ec3[_0xd4e3('0x3d')]=_[_0xd4e3('0x3e')](_0x8bb7ff[_0xd4e3('0x3d')]);_0x567ec3[_0xd4e3('0x3f')]=_[_0xd4e3('0x40')](_0x567ec3[_0xd4e3('0x41')],_0x567ec3['query']);_0x2991b1[_0xd4e3('0x42')]=_[_0xd4e3('0x40')](_0x567ec3[_0xd4e3('0x41')],qs[_0xd4e3('0x43')](_0x8bb7ff['query'][_0xd4e3('0x43')]));_0x2991b1[_0xd4e3('0x42')]=_0x2991b1[_0xd4e3('0x42')][_0xd4e3('0x44')]?_0x2991b1['attributes']:_0x567ec3[_0xd4e3('0x41')];_0x2991b1['order']=qs[_0xd4e3('0x62')](_0x8bb7ff[_0xd4e3('0x3d')][_0xd4e3('0x62')]);_0x2991b1[_0xd4e3('0x46')]=qs[_0xd4e3('0x3f')](_[_0xd4e3('0x47')](_0x8bb7ff['query'],_0x567ec3[_0xd4e3('0x3f')]));if(_0x8bb7ff['query'][_0xd4e3('0x48')]){_0x2991b1[_0xd4e3('0x46')]=_[_0xd4e3('0x49')](_0x2991b1[_0xd4e3('0x46')],{'$or':_[_0xd4e3('0x39')](_0x2991b1['attributes'],function(_0x26815){var _0x5ab369={};_0x5ab369[_0x26815]={'$like':'%'+_0x8bb7ff[_0xd4e3('0x3d')]['filter']+'%'};return _0x5ab369;})});}_0x2991b1=_[_0xd4e3('0x49')]({},_0x2991b1,_0x8bb7ff[_0xd4e3('0x4c')]);return _0x1a4310[_0xd4e3('0xb5')](_0x2991b1);}})[_0xd4e3('0x1e')](function(_0x5a414b){if(_0x5a414b){_0x2d8842=_0x5a414b['length'];if(!_0x8bb7ff['query']['hasOwnProperty'](_0xd4e3('0x45'))){_0x2991b1['limit']=qs['limit'](_0x8bb7ff['query'][_0xd4e3('0x29')]);_0x2991b1[_0xd4e3('0x27')]=qs[_0xd4e3('0x27')](_0x8bb7ff[_0xd4e3('0x3d')][_0xd4e3('0x27')]);}return _0x1a4310[_0xd4e3('0xb5')](_0x2991b1);}})[_0xd4e3('0x1e')](function(_0x32ba68){if(_0x32ba68){return _0x32ba68?{'count':_0x2d8842,'rows':_0x32ba68}:null;}})[_0xd4e3('0x1e')](respondWithResult(_0x105ad0,null))['catch'](handleError(_0x105ad0,null));}; \ No newline at end of file +var _0x846c=['client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','status','end','json','offset','count','limit','set','Content-Range','reject','update','destroy','UserProfileResource','sendStatus','stack','name','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','includeAll','include','rows','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','User','Tags','color','tag','findAll','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','send','getApplications','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','Messages','spread','out','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','./faxAccount.socket'];(function(_0x9f67b1,_0x3d3b54){var _0x4b8ea5=function(_0x3e6323){while(--_0x3e6323){_0x9f67b1['push'](_0x9f67b1['shift']());}};_0x4b8ea5(++_0x3d3b54);}(_0x846c,0xa3));var _0xc846=function(_0x8cb129,_0x1cb9d2){_0x8cb129=_0x8cb129-0x0;var _0x46ac7e=_0x846c[_0x8cb129];return _0x46ac7e;};'use strict';var emlformat=require(_0xc846('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc846('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc846('0x2'));var Mustache=require('mustache');var util=require(_0xc846('0x3'));var path=require(_0xc846('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc846('0x5'));var fs=require('fs');var fs_extra=require(_0xc846('0x6'));var _=require(_0xc846('0x7'));var squel=require('squel');var crypto=require(_0xc846('0x8'));var jsforce=require(_0xc846('0x9'));var deskjs=require(_0xc846('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc846('0xb'));var Papa=require(_0xc846('0xc'));var Redis=require(_0xc846('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc846('0xe'));var as=require(_0xc846('0xf'));var hardwareService=require(_0xc846('0x10'));var logger=require('../../config/logger')(_0xc846('0x11'));var utils=require(_0xc846('0x12'));var config=require(_0xc846('0x13'));var licenseUtil=require(_0xc846('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc846('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc846('0x16'))(new Redis(config['redis']));require(_0xc846('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc846('0x18')][_0xc846('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xc846('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x193120,_0x476ab6,_0x578385,_0x5052e7){return new BPromise(function(_0x488e42,_0x4f7391){var _0x410a34=_0x5052e7||client;return _0x410a34[_0xc846('0x1a')](_0x193120,_0x578385)[_0xc846('0x1b')](function(_0x1bc621){logger['info'](_0xc846('0x1c'),_0x476ab6,_0xc846('0x1d'));logger[_0xc846('0x1e')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x476ab6,_0xc846('0x1d'),JSON['stringify'](_0x1bc621));if(_0x1bc621[_0xc846('0x1f')]){if(_0x1bc621[_0xc846('0x1f')]['code']===0x1f4){logger[_0xc846('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x476ab6,_0x1bc621[_0xc846('0x1f')][_0xc846('0x20')]);return _0x4f7391(_0x1bc621[_0xc846('0x1f')]['message']);}logger[_0xc846('0x1f')](_0xc846('0x1c'),_0x476ab6,_0x1bc621[_0xc846('0x1f')][_0xc846('0x20')]);return _0x488e42(_0x1bc621[_0xc846('0x1f')][_0xc846('0x20')]);}else{logger[_0xc846('0x21')](_0xc846('0x1c'),_0x476ab6,'request\x20sent');_0x488e42(_0x1bc621[_0xc846('0x22')][_0xc846('0x20')]);}})[_0xc846('0x23')](function(_0x1ca29a){logger[_0xc846('0x1f')](_0xc846('0x1c'),_0x476ab6,_0x1ca29a);_0x4f7391(_0x1ca29a);});});}function respondWithStatusCode(_0x53a915,_0x46fa45){_0x46fa45=_0x46fa45||0xcc;return function(_0x4ae54f){if(_0x4ae54f){return _0x53a915['sendStatus'](_0x46fa45);}return _0x53a915[_0xc846('0x24')](_0x46fa45)[_0xc846('0x25')]();};}function respondWithResult(_0x358cd1,_0x6d5b62){_0x6d5b62=_0x6d5b62||0xc8;return function(_0x3e35a1){if(_0x3e35a1){return _0x358cd1[_0xc846('0x24')](_0x6d5b62)[_0xc846('0x26')](_0x3e35a1);}};}function respondWithFilteredResult(_0x552fd7,_0xd316f7){return function(_0x265cef){if(_0x265cef){var _0x419d10=typeof _0xd316f7[_0xc846('0x27')]==='undefined'&&typeof _0xd316f7['limit']==='undefined';var _0x2f755b=_0x265cef[_0xc846('0x28')];var _0x5c3055=_0x419d10?0x0:_0xd316f7[_0xc846('0x27')];var _0x1f99fe=_0x419d10?_0x265cef[_0xc846('0x28')]:_0xd316f7[_0xc846('0x27')]+_0xd316f7[_0xc846('0x29')];var _0x469e9c;if(_0x1f99fe>=_0x2f755b){_0x1f99fe=_0x2f755b;_0x469e9c=0xc8;}else{_0x469e9c=0xce;}_0x552fd7['status'](_0x469e9c);return _0x552fd7[_0xc846('0x2a')](_0xc846('0x2b'),_0x5c3055+'-'+_0x1f99fe+'/'+_0x2f755b)[_0xc846('0x26')](_0x265cef);}return null;};}function patchUpdates(_0x1e9ce8){return function(_0x591d88){try{jsonpatch['apply'](_0x591d88,_0x1e9ce8,!![]);}catch(_0x5dabd5){return BPromise[_0xc846('0x2c')](_0x5dabd5);}return _0x591d88['save']();};}function saveUpdates(_0x52055c,_0x26a46d){return function(_0x47a2a5){if(_0x47a2a5){return _0x47a2a5[_0xc846('0x2d')](_0x52055c)[_0xc846('0x1b')](function(_0x95497){return _0x95497;});}return null;};}function removeEntity(_0x63dda5,_0x42fa65){return function(_0xf96b0c){if(_0xf96b0c){return _0xf96b0c[_0xc846('0x2e')]()['then'](function(){var _0x313c9c=_0xf96b0c['get']({'plain':!![]});var _0x273669='FaxAccounts';return db[_0xc846('0x2f')][_0xc846('0x2e')]({'where':{'type':_0x273669,'resourceId':_0x313c9c['id']}})[_0xc846('0x1b')](function(){return _0xf96b0c;});})[_0xc846('0x1b')](function(){_0x63dda5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2153c2,_0x3b4971){return function(_0x578cbc){if(!_0x578cbc){_0x2153c2[_0xc846('0x30')](0x194);}return _0x578cbc;};}function handleError(_0x578096,_0x2ea9b5){_0x2ea9b5=_0x2ea9b5||0x1f4;return function(_0x495edb){logger['error'](_0x495edb[_0xc846('0x31')]);if(_0x495edb[_0xc846('0x32')]){delete _0x495edb[_0xc846('0x32')];}_0x578096[_0xc846('0x24')](_0x2ea9b5)['send'](_0x495edb);};}exports['index']=function(_0x55a3bb,_0x5e5476){var _0x4a8d65={'include':[{'model':db[_0xc846('0x33')],'as':_0xc846('0x34')}]},_0x207325={},_0x4bce35={'count':0x0,'rows':[]};var _0x510dde=_['map'](db[_0xc846('0x35')][_0xc846('0x36')],function(_0x548e3b){return{'name':_0x548e3b['fieldName'],'type':_0x548e3b['type'][_0xc846('0x37')]};});_0x207325['model']=_['map'](_0x510dde,_0xc846('0x32'));_0x207325['query']=_[_0xc846('0x38')](_0x55a3bb[_0xc846('0x39')]);_0x207325[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x207325[_0xc846('0x3c')],_0x207325['query']);_0x4a8d65[_0xc846('0x3d')]=_[_0xc846('0x3b')](_0x207325['model'],qs['fields'](_0x55a3bb[_0xc846('0x39')][_0xc846('0x3e')]));_0x4a8d65['attributes']=_0x4a8d65[_0xc846('0x3d')][_0xc846('0x3f')]?_0x4a8d65[_0xc846('0x3d')]:_0x207325[_0xc846('0x3c')];if(!_0x55a3bb[_0xc846('0x39')][_0xc846('0x40')](_0xc846('0x41'))){_0x4a8d65[_0xc846('0x29')]=qs[_0xc846('0x29')](_0x55a3bb['query'][_0xc846('0x29')]);_0x4a8d65[_0xc846('0x27')]=qs[_0xc846('0x27')](_0x55a3bb[_0xc846('0x39')][_0xc846('0x27')]);}_0x4a8d65[_0xc846('0x42')]=qs['sort'](_0x55a3bb[_0xc846('0x39')][_0xc846('0x43')]);_0x4a8d65[_0xc846('0x44')]=qs[_0xc846('0x3a')](_[_0xc846('0x45')](_0x55a3bb[_0xc846('0x39')],_0x207325[_0xc846('0x3a')]),_0x510dde);if(_0x55a3bb[_0xc846('0x39')][_0xc846('0x46')]){_0x4a8d65[_0xc846('0x44')]=_[_0xc846('0x47')](_0x4a8d65['where'],{'$or':_[_0xc846('0x48')](_0x510dde,function(_0x172238){if(_0x172238[_0xc846('0x49')]!=='VIRTUAL'){var _0x59697e={};_0x59697e[_0x172238[_0xc846('0x32')]]={'$like':'%'+_0x55a3bb['query'][_0xc846('0x46')]+'%'};return _0x59697e;}})});}_0x4a8d65=_['merge']({},_0x4a8d65,_0x55a3bb['options']);var _0x44e92c={'where':_0x4a8d65[_0xc846('0x44')]};return db[_0xc846('0x35')][_0xc846('0x28')](_0x44e92c)[_0xc846('0x1b')](function(_0x2a9f6f){_0x4bce35[_0xc846('0x28')]=_0x2a9f6f;if(_0x55a3bb[_0xc846('0x39')][_0xc846('0x4a')]){_0x4a8d65[_0xc846('0x4b')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x4a8d65);})[_0xc846('0x1b')](function(_0x103983){_0x4bce35[_0xc846('0x4c')]=_0x103983;return _0x4bce35;})[_0xc846('0x1b')](respondWithFilteredResult(_0x5e5476,_0x4a8d65))[_0xc846('0x23')](handleError(_0x5e5476,null));};exports[_0xc846('0x4d')]=function(_0x2243ec,_0x54d915){var _0x6c774d={'raw':![],'where':{'id':_0x2243ec[_0xc846('0x4e')]['id']},'include':[{'model':db[_0xc846('0x33')],'as':_0xc846('0x34')}]},_0x1944ac={};_0x1944ac['model']=_[_0xc846('0x38')](db[_0xc846('0x35')][_0xc846('0x36')]);_0x1944ac[_0xc846('0x39')]=_[_0xc846('0x38')](_0x2243ec['query']);_0x1944ac[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x1944ac[_0xc846('0x3c')],_0x1944ac[_0xc846('0x39')]);_0x6c774d[_0xc846('0x3d')]=_[_0xc846('0x3b')](_0x1944ac[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x2243ec[_0xc846('0x39')][_0xc846('0x3e')]));_0x6c774d['attributes']=_0x6c774d[_0xc846('0x3d')][_0xc846('0x3f')]?_0x6c774d[_0xc846('0x3d')]:_0x1944ac['model'];if(_0x2243ec[_0xc846('0x39')][_0xc846('0x4a')]){_0x6c774d[_0xc846('0x4b')]=[{'all':!![]}];}_0x6c774d=_[_0xc846('0x47')]({},_0x6c774d,_0x2243ec[_0xc846('0x4f')]);return db[_0xc846('0x35')][_0xc846('0x50')](_0x6c774d)[_0xc846('0x1b')](handleEntityNotFound(_0x54d915,null))[_0xc846('0x1b')](respondWithResult(_0x54d915,null))['catch'](handleError(_0x54d915,null));};exports['create']=function(_0x3396f3,_0x45fbe4){return db[_0xc846('0x35')][_0xc846('0x51')](_0x3396f3['body'],{})['then'](function(_0x53527f){var _0x16ca0f=_0x3396f3[_0xc846('0x52')][_0xc846('0x53')]({'plain':!![]});if(!_0x16ca0f)throw new Error(_0xc846('0x54'));if(_0x16ca0f[_0xc846('0x55')]==='user'){var _0x2c68b2=_0x53527f[_0xc846('0x53')]({'plain':!![]});var _0x4dfcf2=_0xc846('0x56');return db[_0xc846('0x57')]['find']({'where':{'name':_0x4dfcf2,'userProfileId':_0x16ca0f[_0xc846('0x58')]},'raw':!![]})['then'](function(_0x481bfd){if(_0x481bfd&&_0x481bfd[_0xc846('0x59')]===0x0){return db[_0xc846('0x2f')][_0xc846('0x51')]({'name':_0x2c68b2[_0xc846('0x32')],'resourceId':_0x2c68b2['id'],'type':_0x481bfd[_0xc846('0x32')],'sectionId':_0x481bfd['id']},{})[_0xc846('0x1b')](function(){return _0x53527f;});}else{return _0x53527f;}})[_0xc846('0x23')](function(_0x143e42){logger[_0xc846('0x1f')](_0xc846('0x5a'),_0x143e42);throw _0x143e42;});}return _0x53527f;})['then'](respondWithResult(_0x45fbe4,0xc9))[_0xc846('0x23')](handleError(_0x45fbe4,null));};exports[_0xc846('0x2d')]=function(_0xede12f,_0x3294af){if(_0xede12f[_0xc846('0x5b')]['id']){delete _0xede12f['body']['id'];}return db['FaxAccount'][_0xc846('0x50')]({'where':{'id':_0xede12f[_0xc846('0x4e')]['id']},'include':[{'model':db[_0xc846('0x33')],'as':_0xc846('0x34')}]})[_0xc846('0x1b')](handleEntityNotFound(_0x3294af,null))[_0xc846('0x1b')](saveUpdates(_0xede12f['body'],null))[_0xc846('0x1b')](respondWithResult(_0x3294af,null))['catch'](handleError(_0x3294af,null));};exports[_0xc846('0x2e')]=function(_0x4c09b4,_0x1630cd){return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0x4c09b4['params']['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x1630cd,null))['then'](removeEntity(_0x1630cd,null))[_0xc846('0x23')](handleError(_0x1630cd,null));};exports[_0xc846('0x5c')]=function(_0x4290b4,_0x159c7d){return db[_0xc846('0x35')][_0xc846('0x5c')]()[_0xc846('0x1b')](respondWithResult(_0x159c7d,null))[_0xc846('0x23')](handleError(_0x159c7d,null));};exports[_0xc846('0x5d')]=function(_0xf10fe9,_0x23f356,_0x3a4546){if(_0xf10fe9[_0xc846('0x5b')]['id']){delete _0xf10fe9[_0xc846('0x5b')]['id'];}return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0xf10fe9[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x23f356,null))[_0xc846('0x1b')](function(_0x4603b6){if(_0x4603b6){_0xf10fe9[_0xc846('0x5b')][_0xc846('0x5e')]=_0x4603b6['id'];return db[_0xc846('0x5f')][_0xc846('0x51')](_0xf10fe9[_0xc846('0x5b')]);}})[_0xc846('0x1b')](respondWithResult(_0x23f356,null))[_0xc846('0x23')](handleError(_0x23f356,null));};exports[_0xc846('0x60')]=function(_0x509b89,_0x20ed4e,_0x2ecbb2){var _0x28f13f={'raw':![],'where':{}};var _0x19f4ff={};var _0x407e81={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x509b89[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x20ed4e,null))['then'](function(_0x52687a){if(_0x52687a){_0x19f4ff[_0xc846('0x3c')]=_[_0xc846('0x38')](db[_0xc846('0x5f')][_0xc846('0x36')]);_0x19f4ff[_0xc846('0x39')]=_['keys'](_0x509b89['query']);_0x19f4ff['filters']=_[_0xc846('0x3b')](_0x19f4ff[_0xc846('0x3c')],_0x19f4ff[_0xc846('0x39')]);_0x28f13f[_0xc846('0x3d')]=_[_0xc846('0x3b')](_0x19f4ff[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x509b89[_0xc846('0x39')][_0xc846('0x3e')]));_0x28f13f[_0xc846('0x3d')]=_0x28f13f[_0xc846('0x3d')][_0xc846('0x3f')]?_0x28f13f[_0xc846('0x3d')]:_0x19f4ff[_0xc846('0x3c')];if(!_0x509b89[_0xc846('0x39')][_0xc846('0x40')](_0xc846('0x41'))){_0x28f13f[_0xc846('0x29')]=qs['limit'](_0x509b89[_0xc846('0x39')][_0xc846('0x29')]);_0x28f13f[_0xc846('0x27')]=qs[_0xc846('0x27')](_0x509b89['query'][_0xc846('0x27')]);}_0x28f13f[_0xc846('0x42')]=qs[_0xc846('0x43')](_0x509b89[_0xc846('0x39')][_0xc846('0x43')]);_0x28f13f[_0xc846('0x44')]=qs['filters'](_[_0xc846('0x45')](_0x509b89[_0xc846('0x39')],_0x19f4ff[_0xc846('0x3a')]));_0x28f13f[_0xc846('0x44')][_0xc846('0x5e')]=_0x52687a['id'];if(_0x509b89[_0xc846('0x39')]['filter']){_0x28f13f[_0xc846('0x44')]=_[_0xc846('0x47')](_0x28f13f[_0xc846('0x44')],{'$or':_[_0xc846('0x48')](_0x28f13f[_0xc846('0x3d')],function(_0x3b0929){var _0x531c61={};_0x531c61[_0x3b0929]={'$like':'%'+_0x509b89['query'][_0xc846('0x46')]+'%'};return _0x531c61;})});}_0x28f13f=_[_0xc846('0x47')]({},_0x28f13f,_0x509b89['options']);return db[_0xc846('0x5f')][_0xc846('0x28')]({'where':_0x28f13f['where']})[_0xc846('0x1b')](function(_0xd7eab){_0x407e81['count']=_0xd7eab;if(_0x509b89[_0xc846('0x39')][_0xc846('0x4a')]){_0x28f13f[_0xc846('0x4b')]=[{'all':!![]}];}return db[_0xc846('0x5f')]['findAll'](_0x28f13f);})[_0xc846('0x1b')](function(_0x460fc8){_0x407e81[_0xc846('0x4c')]=_0x460fc8;return _0x407e81;});}})[_0xc846('0x1b')](respondWithFilteredResult(_0x20ed4e,_0x28f13f))[_0xc846('0x23')](handleError(_0x20ed4e,null));};exports[_0xc846('0x61')]=function(_0x255549,_0x490904,_0xde828c){return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0x255549[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x490904,null))[_0xc846('0x1b')](function(_0x22e84c){if(_0x22e84c){return _0x22e84c[_0xc846('0x61')](_0x255549[_0xc846('0x39')][_0xc846('0x62')]);}})[_0xc846('0x1b')](respondWithStatusCode(_0x490904,null))['catch'](handleError(_0x490904,null));};exports['addAnswer']=function(_0x1d2075,_0x2e69c0,_0x4ca06f){if(_0x1d2075['body']['id']){delete _0x1d2075[_0xc846('0x5b')]['id'];}return db['FaxAccount'][_0xc846('0x50')]({'where':{'id':_0x1d2075[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x2e69c0,null))['then'](function(_0x480734){if(_0x480734){_0x1d2075['body'][_0xc846('0x5e')]=_0x480734['id'];return db[_0xc846('0x63')][_0xc846('0x51')](_0x1d2075['body']);}})[_0xc846('0x1b')](respondWithResult(_0x2e69c0,null))['catch'](handleError(_0x2e69c0,null));};exports[_0xc846('0x64')]=function(_0x1471f7,_0x27e4a5,_0x47ae2e){var _0x21fc16={'raw':![],'where':{}};var _0x271f1e={};var _0x547bf3={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1471f7[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x27e4a5,null))[_0xc846('0x1b')](function(_0x561a9e){if(_0x561a9e){_0x271f1e[_0xc846('0x3c')]=_['keys'](db[_0xc846('0x63')]['rawAttributes']);_0x271f1e[_0xc846('0x39')]=_['keys'](_0x1471f7[_0xc846('0x39')]);_0x271f1e[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x271f1e[_0xc846('0x3c')],_0x271f1e[_0xc846('0x39')]);_0x21fc16[_0xc846('0x3d')]=_[_0xc846('0x3b')](_0x271f1e[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x1471f7[_0xc846('0x39')]['fields']));_0x21fc16[_0xc846('0x3d')]=_0x21fc16[_0xc846('0x3d')][_0xc846('0x3f')]?_0x21fc16[_0xc846('0x3d')]:_0x271f1e[_0xc846('0x3c')];if(!_0x1471f7[_0xc846('0x39')][_0xc846('0x40')]('nolimit')){_0x21fc16[_0xc846('0x29')]=qs[_0xc846('0x29')](_0x1471f7[_0xc846('0x39')]['limit']);_0x21fc16[_0xc846('0x27')]=qs[_0xc846('0x27')](_0x1471f7[_0xc846('0x39')]['offset']);}_0x21fc16['order']=qs[_0xc846('0x43')](_0x1471f7[_0xc846('0x39')][_0xc846('0x43')]);_0x21fc16[_0xc846('0x44')]=qs[_0xc846('0x3a')](_[_0xc846('0x45')](_0x1471f7[_0xc846('0x39')],_0x271f1e[_0xc846('0x3a')]));_0x21fc16[_0xc846('0x44')][_0xc846('0x5e')]=_0x561a9e['id'];if(_0x1471f7[_0xc846('0x39')]['filter']){_0x21fc16[_0xc846('0x44')]=_[_0xc846('0x47')](_0x21fc16[_0xc846('0x44')],{'$or':_[_0xc846('0x48')](_0x21fc16['attributes'],function(_0x2bf917){var _0x13ddaa={};_0x13ddaa[_0x2bf917]={'$like':'%'+_0x1471f7['query'][_0xc846('0x46')]+'%'};return _0x13ddaa;})});}_0x21fc16=_[_0xc846('0x47')]({},_0x21fc16,_0x1471f7[_0xc846('0x4f')]);return db[_0xc846('0x63')][_0xc846('0x28')]({'where':_0x21fc16[_0xc846('0x44')]})['then'](function(_0x5ea0b9){_0x547bf3['count']=_0x5ea0b9;if(_0x1471f7['query']['includeAll']){_0x21fc16['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x21fc16);})['then'](function(_0x286bfb){_0x547bf3[_0xc846('0x4c')]=_0x286bfb;return _0x547bf3;});}})[_0xc846('0x1b')](respondWithFilteredResult(_0x27e4a5,_0x21fc16))['catch'](handleError(_0x27e4a5,null));};exports[_0xc846('0x65')]=function(_0x232182,_0x355b8e,_0x4487db){return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0x232182['params']['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x355b8e,null))[_0xc846('0x1b')](function(_0x45c56b){if(_0x45c56b){return _0x45c56b['removeAnswers'](_0x232182['query']['ids']);}})[_0xc846('0x1b')](respondWithStatusCode(_0x355b8e,null))[_0xc846('0x23')](handleError(_0x355b8e,null));};exports[_0xc846('0x66')]=function(_0x648997,_0x51857a,_0x3e6da7){return db[_0xc846('0x67')][_0xc846('0x50')]({'where':{'id':_0x648997[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x51857a,null))[_0xc846('0x1b')](function(_0x5445b1){if(_0x5445b1){return _0x5445b1['addInteraction'](_0x648997[_0xc846('0x5b')][_0xc846('0x62')],_[_0xc846('0x68')](_0x648997[_0xc846('0x5b')],[_0xc846('0x62'),'id'])||{});}})['then'](respondWithResult(_0x51857a,null))[_0xc846('0x23')](handleError(_0x51857a,null));};exports[_0xc846('0x69')]=function(_0x31759c,_0x96e606,_0x4f65c2){var _0x7e2d3f={'raw':![],'where':{}};var _0x1c95ac={};var _0x3c69f8={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc846('0x6a')]({'where':{'id':_0x31759c[_0xc846('0x4e')]['id']}})['then'](handleEntityNotFound(_0x96e606,null))[_0xc846('0x1b')](function(_0x19ac4d){if(_0x19ac4d){_0x1c95ac[_0xc846('0x3c')]=_[_0xc846('0x38')](db[_0xc846('0x67')][_0xc846('0x36')]);_0x1c95ac[_0xc846('0x39')]=_[_0xc846('0x38')](_0x31759c[_0xc846('0x39')]);_0x1c95ac[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x1c95ac[_0xc846('0x3c')],_0x1c95ac[_0xc846('0x39')]);_0x7e2d3f['attributes']=_[_0xc846('0x3b')](_0x1c95ac[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x31759c[_0xc846('0x39')][_0xc846('0x3e')]));_0x7e2d3f['attributes']=_0x7e2d3f['attributes'][_0xc846('0x3f')]?_0x7e2d3f[_0xc846('0x3d')]:_0x1c95ac[_0xc846('0x3c')];if(!_0x31759c[_0xc846('0x39')][_0xc846('0x40')](_0xc846('0x41'))){_0x7e2d3f[_0xc846('0x29')]=qs[_0xc846('0x29')](_0x31759c[_0xc846('0x39')][_0xc846('0x29')]);_0x7e2d3f[_0xc846('0x27')]=qs[_0xc846('0x27')](_0x31759c[_0xc846('0x39')][_0xc846('0x27')]);}_0x7e2d3f[_0xc846('0x42')]=qs[_0xc846('0x43')](_0x31759c[_0xc846('0x39')][_0xc846('0x43')]);_0x7e2d3f[_0xc846('0x44')]=qs['filters'](_['pick'](_0x31759c[_0xc846('0x39')],_0x1c95ac[_0xc846('0x3a')]));_0x7e2d3f[_0xc846('0x44')][_0xc846('0x5e')]=_0x19ac4d['id'];if(_0x31759c['query'][_0xc846('0x46')]){_0x7e2d3f[_0xc846('0x44')]=_[_0xc846('0x47')](_0x7e2d3f[_0xc846('0x44')],{'$or':_['map'](_0x7e2d3f[_0xc846('0x3d')],function(_0xdf27dc){var _0x597391={};_0x597391[_0xdf27dc]={'$like':'%'+_0x31759c[_0xc846('0x39')][_0xc846('0x46')]+'%'};return _0x597391;})});}_0x7e2d3f=_[_0xc846('0x47')]({},_0x7e2d3f,_0x31759c['options']);return db[_0xc846('0x67')][_0xc846('0x28')]({'where':_0x7e2d3f[_0xc846('0x44')]})[_0xc846('0x1b')](function(_0x4aa40f){_0x3c69f8['count']=_0x4aa40f;if(_0x31759c['query'][_0xc846('0x4a')]){_0x7e2d3f['include']=[{'model':db[_0xc846('0x6b')],'as':_0xc846('0x6c'),'required':![]},{'model':db[_0xc846('0x6d')],'as':'Owner','attributes':[_0xc846('0x32'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0xc846('0x6e'),'attributes':['id',_0xc846('0x32'),_0xc846('0x6f')],'where':_0x31759c['query'][_0xc846('0x70')]?{'id':_0x31759c[_0xc846('0x39')][_0xc846('0x70')]}:undefined,'required':_0x31759c[_0xc846('0x39')][_0xc846('0x70')]?!![]:![]}];}return db[_0xc846('0x67')][_0xc846('0x71')](_0x7e2d3f);})['then'](function(_0xcb86aa){_0x3c69f8['rows']=_0xcb86aa;return _0x3c69f8;});}})[_0xc846('0x1b')](respondWithFilteredResult(_0x96e606,_0x7e2d3f))[_0xc846('0x23')](handleError(_0x96e606,null));};exports['addApplications']=function(_0x4e2b72,_0x2c59a3){var _0x4acae8=_0x4e2b72[_0xc846('0x4e')]['id'];var _0x2384f9=_0x4e2b72[_0xc846('0x5b')];var _0x47f5d3=0xc8;var _0x355540=null;return db[_0xc846('0x72')][_0xc846('0x73')]({'isolationLevel':db[_0xc846('0x72')][_0xc846('0x74')]['ISOLATION_LEVELS'][_0xc846('0x75')]},function(_0x2b206b){return db[_0xc846('0x35')][_0xc846('0x6a')]({'where':{'id':_0x4acae8},'transaction':_0x2b206b})['then'](function(_0x4c9a70){if(_0x4c9a70){return db[_0xc846('0x76')][_0xc846('0x2e')]({'where':{'FaxAccountId':_0x4acae8},'transaction':_0x2b206b})[_0xc846('0x1b')](function(){var _0x47b99d=_['map'](_0x2384f9,function(_0x3a095e){_0x3a095e['FaxAccountId']=_0x4acae8;return _0x3a095e;});return db[_0xc846('0x76')]['bulkCreate'](_0x47b99d,{'transaction':_0x2b206b});});}else{_0x47f5d3=0x194;_0x355540=[];}});})[_0xc846('0x1b')](function(){if(_0x47f5d3!==0x194){return db['FaxApplication'][_0xc846('0x77')]({'where':{'FaxAccountId':_0x4acae8},'order':_0xc846('0x78')})['then'](function(_0x5b4e03){_0x355540=_0x5b4e03;});}})[_0xc846('0x23')](function(_0x1306f8){_0x47f5d3=0x1f4;logger[_0xc846('0x1f')](_0x1306f8['stack']);if(_0x1306f8[_0xc846('0x32')]){delete _0x1306f8['name'];}_0x355540=_0x1306f8;})[_0xc846('0x79')](function(){if(_0x355540===null){_0x2c59a3['sendStatus'](_0x47f5d3);}else{if(_0x47f5d3===0x1f4){_0x2c59a3['status'](_0x47f5d3)[_0xc846('0x7a')](_0x355540);}else{_0x2c59a3[_0xc846('0x24')](_0x47f5d3)[_0xc846('0x26')](_0x355540);}}});};exports[_0xc846('0x7b')]=function(_0x44201a,_0x40b499,_0x110a44){var _0x1bda0d={};var _0x49d5be={};var _0x2bfb00;var _0x5e82e7;return db[_0xc846('0x35')][_0xc846('0x6a')]({'where':{'id':_0x44201a[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x40b499,null))['then'](function(_0x454a0c){if(_0x454a0c){_0x2bfb00=_0x454a0c;_0x49d5be[_0xc846('0x3c')]=_[_0xc846('0x38')](db['FaxApplication'][_0xc846('0x36')]);_0x49d5be[_0xc846('0x39')]=_[_0xc846('0x38')](_0x44201a[_0xc846('0x39')]);_0x49d5be[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x49d5be[_0xc846('0x3c')],_0x49d5be[_0xc846('0x39')]);_0x1bda0d[_0xc846('0x3d')]=_[_0xc846('0x3b')](_0x49d5be[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x44201a[_0xc846('0x39')][_0xc846('0x3e')]));_0x1bda0d[_0xc846('0x3d')]=_0x1bda0d['attributes'][_0xc846('0x3f')]?_0x1bda0d[_0xc846('0x3d')]:_0x49d5be['model'];_0x1bda0d[_0xc846('0x42')]=qs[_0xc846('0x43')](_0x44201a['query'][_0xc846('0x43')]);_0x1bda0d[_0xc846('0x44')]=qs['filters'](_[_0xc846('0x45')](_0x44201a['query'],_0x49d5be[_0xc846('0x3a')]));if(_0x44201a[_0xc846('0x39')][_0xc846('0x46')]){_0x1bda0d[_0xc846('0x44')]=_[_0xc846('0x47')](_0x1bda0d['where'],{'$or':_[_0xc846('0x48')](_0x1bda0d[_0xc846('0x3d')],function(_0x2a8d98){var _0x4771ab={};_0x4771ab[_0x2a8d98]={'$like':'%'+_0x44201a[_0xc846('0x39')][_0xc846('0x46')]+'%'};return _0x4771ab;})});}_0x1bda0d=_['merge']({},_0x1bda0d,_0x44201a[_0xc846('0x4f')]);return _0x2bfb00[_0xc846('0x7b')](_0x1bda0d);}})[_0xc846('0x1b')](function(_0x493bf1){if(_0x493bf1){_0x5e82e7=_0x493bf1['length'];if(!_0x44201a[_0xc846('0x39')]['hasOwnProperty'](_0xc846('0x41'))){_0x1bda0d[_0xc846('0x29')]=qs['limit'](_0x44201a[_0xc846('0x39')][_0xc846('0x29')]);_0x1bda0d['offset']=qs[_0xc846('0x27')](_0x44201a['query'][_0xc846('0x27')]);}return _0x2bfb00[_0xc846('0x7b')](_0x1bda0d);}})[_0xc846('0x1b')](function(_0x27f148){if(_0x27f148){return _0x27f148?{'count':_0x5e82e7,'rows':_0x27f148}:null;}})[_0xc846('0x1b')](respondWithResult(_0x40b499,null))['catch'](handleError(_0x40b499,null));};function Extension(_0x50eb04,_0x21e60b,_0xb2331d,_0x46cb41){this['context']=_0xc846('0x7c');this[_0xc846('0x7d')]=_0x50eb04[_0xc846('0x7e')];this[_0xc846('0x7f')]=_0x46cb41;this[_0xc846('0x49')]=_0xc846('0x80');this['description']=_0xc846('0x81');this['FaxAccountId']=_0x50eb04['id'];this[_0xc846('0x78')]=_0x21e60b;this[_0xc846('0x82')]=_0xb2331d;}function createExtensionsReciveFax(_0x1ac448){var _0x27b636=0x1;var _0x379077=[];_0x379077[_0xc846('0x83')](new Extension(_0x1ac448,_0x27b636,'',_0xc846('0x84')));_0x27b636+=0x1;_0x379077['push'](new Extension(_0x1ac448,_0x27b636,'CDR(type)=inbound-fax',_0xc846('0x85')));_0x27b636+=0x1;for(var _0x33cefd in _0x1ac448){if(_0x1ac448[_0xc846('0x40')](_0x33cefd)&&(_0x33cefd===_0xc846('0x86')||_0x33cefd==='localstationid'||_0x33cefd===_0xc846('0x87')||_0x33cefd===_0xc846('0x88')||_0x33cefd===_0xc846('0x89')||_0x33cefd===_0xc846('0x8a')||_0x33cefd===_0xc846('0x8b')||_0x33cefd===_0xc846('0x8c')||_0x33cefd===_0xc846('0x8d'))){_0x379077[_0xc846('0x83')](new Extension(_0x1ac448,_0x27b636,_0xc846('0x8e')+_0x33cefd+')='+_0x1ac448[_0x33cefd],_0xc846('0x85')));_0x27b636+=0x1;}}_0x379077[_0xc846('0x83')](new Extension(_0x1ac448,_0x27b636,'6',_0xc846('0x8f')));_0x27b636+=0x1;_0x379077['push'](new Extension(_0x1ac448,_0x27b636,_0xc846('0x90'),_0xc846('0x91')));_0x27b636=0x0;return _0x379077;}exports[_0xc846('0x92')]=function(_0x2f0c37,_0x247a00,_0x310463){var _0x3a7f76;return db[_0xc846('0x72')][_0xc846('0x73')](function(_0x540e10){return db[_0xc846('0x35')][_0xc846('0x51')](_0x2f0c37[_0xc846('0x5b')],{'transaction':_0x540e10})[_0xc846('0x1b')](function(_0x2f9b42){_0x3a7f76=_0x2f9b42[_0xc846('0x53')]({'plain':!![]});return db['VoiceExtension'][_0xc846('0x93')](createExtensionsReciveFax(_0x3a7f76),{'transaction':_0x540e10});});})['then'](function(){return _0x3a7f76;})[_0xc846('0x1b')](respondWithResult(_0x247a00,null))[_0xc846('0x23')](handleError(_0x247a00,null));};exports[_0xc846('0x94')]=function(_0x25de07,_0x31eb8a,_0x2ce752){var _0x1f3f73;return db['sequelize'][_0xc846('0x73')](function(_0x2916a1){return db['FaxAccount']['update'](_0x25de07[_0xc846('0x5b')],{'where':{'id':_0x25de07[_0xc846('0x5b')]['id']},'transaction':_0x2916a1})[_0xc846('0x1b')](function(_0x516672){return db[_0xc846('0x95')][_0xc846('0x2e')]({'where':{'FaxAccountId':_0x25de07[_0xc846('0x5b')]['id']},'transaction':_0x2916a1})[_0xc846('0x1b')](function(_0x4a47c5){return db[_0xc846('0x95')][_0xc846('0x93')](createExtensionsReciveFax(_['omit'](_0x25de07[_0xc846('0x5b')],[_0xc846('0x96'),_0xc846('0x37'),_0xc846('0x97'),_0xc846('0x98'),_0xc846('0x99'),_0xc846('0x9a')])),{'transaction':_0x2916a1});});});})['then'](function(){return db[_0xc846('0x35')][_0xc846('0x9b')](_0x25de07[_0xc846('0x5b')]['id']);})[_0xc846('0x1b')](respondWithResult(_0x31eb8a,null))[_0xc846('0x23')](handleError(_0x31eb8a,null));};exports['getMessages']=function(_0x3349e9,_0x5a97d9,_0x473b4d){var _0x212f64={'raw':!![],'where':{}};var _0x3998b9={};var _0x25463a={'count':0x0,'rows':[]};return db[_0xc846('0x35')]['findOne']({'where':{'id':_0x3349e9[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x5a97d9,null))[_0xc846('0x1b')](function(_0x3bf0bb){if(_0x3bf0bb){_0x3998b9[_0xc846('0x3c')]=_[_0xc846('0x38')](db[_0xc846('0x9c')][_0xc846('0x36')]);_0x3998b9[_0xc846('0x39')]=_[_0xc846('0x38')](_0x3349e9[_0xc846('0x39')]);_0x3998b9['filters']=_[_0xc846('0x3b')](_0x3998b9[_0xc846('0x3c')],_0x3998b9[_0xc846('0x39')]);_0x212f64[_0xc846('0x3d')]=_['intersection'](_0x3998b9[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x3349e9[_0xc846('0x39')][_0xc846('0x3e')]));_0x212f64[_0xc846('0x3d')]=_0x212f64['attributes']['length']?_0x212f64['attributes']:_0x3998b9[_0xc846('0x3c')];if(!_0x3349e9[_0xc846('0x39')][_0xc846('0x40')]('nolimit')){_0x212f64['limit']=qs[_0xc846('0x29')](_0x3349e9[_0xc846('0x39')][_0xc846('0x29')]);_0x212f64[_0xc846('0x27')]=qs[_0xc846('0x27')](_0x3349e9[_0xc846('0x39')]['offset']);}_0x212f64[_0xc846('0x42')]=qs[_0xc846('0x43')](_0x3349e9[_0xc846('0x39')][_0xc846('0x43')]);_0x212f64[_0xc846('0x44')]=qs[_0xc846('0x3a')](_[_0xc846('0x45')](_0x3349e9[_0xc846('0x39')],_0x3998b9['filters']));_0x212f64[_0xc846('0x44')][_0xc846('0x5e')]=_0x3bf0bb['id'];if(_0x3349e9['query'][_0xc846('0x46')]){_0x212f64['where']=_[_0xc846('0x47')](_0x212f64[_0xc846('0x44')],{'$or':_[_0xc846('0x48')](_0x212f64[_0xc846('0x3d')],function(_0x2a0427){var _0x5e58cb={};_0x5e58cb[_0x2a0427]={'$like':'%'+_0x3349e9[_0xc846('0x39')][_0xc846('0x46')]+'%'};return _0x5e58cb;})});}if(_0x3349e9[_0xc846('0x39')][_0xc846('0x9d')]){var _0x464080=_0x3349e9[_0xc846('0x39')]['$gte'][_0xc846('0x9e')](',');var _0x17963c={};_0x17963c[_0x464080[0x0]]={'$gte':moment(_0x464080[0x1])[_0xc846('0x9f')](_0xc846('0xa0'))};_0x212f64[_0xc846('0x44')]=_[_0xc846('0x47')](_0x212f64['where'],_0x17963c);}_0x212f64=_[_0xc846('0x47')]({},_0x212f64,_0x3349e9[_0xc846('0x4f')]);return db[_0xc846('0x9c')][_0xc846('0x28')]({'where':_0x212f64[_0xc846('0x44')]})[_0xc846('0x1b')](function(_0x54b263){_0x25463a[_0xc846('0x28')]=_0x54b263;if(_0x3349e9[_0xc846('0x39')][_0xc846('0x4a')]){_0x212f64[_0xc846('0x4b')]=[{'all':!![]}];}return db[_0xc846('0x9c')][_0xc846('0x71')](_0x212f64);})[_0xc846('0x1b')](function(_0xab2a5){_0x25463a[_0xc846('0x4c')]=_0xab2a5;return _0x25463a;});}})[_0xc846('0x1b')](respondWithFilteredResult(_0x5a97d9,_0x212f64))[_0xc846('0x23')](handleError(_0x5a97d9,null));};exports[_0xc846('0x7a')]=function(_0x4228b7,_0x5ad94b,_0x1e3b48){var _0x4e8889,_0x14bd83={},_0x5eb00a;if(_0x4228b7[_0xc846('0x5b')]['to']){_0x5eb00a=_0x4228b7[_0xc846('0x5b')]['to'][0x0];}return db[_0xc846('0x35')]['find']({'where':{'id':_0x4228b7[_0xc846('0x4e')]['id']},'include':[{'model':db['CmList'],'as':_0xc846('0xa1'),'include':[{'model':db[_0xc846('0x6b')],'as':_0xc846('0xa2'),'where':{'fax':_0x5eb00a},'limit':0x1,'order':[['updatedAt',_0xc846('0xa3')]]}]}]})[_0xc846('0x1b')](handleEntityNotFound(_0x5ad94b,null))[_0xc846('0x1b')](function(_0x424224){_0x4e8889=_0x424224;if(_0x4228b7['body'][_0xc846('0xa4')]&&_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0xc846('0x3f')]){for(var _0x4dcd61=0x0;_0x4dcd61<_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0xc846('0x3f')];_0x4dcd61+=0x1){_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0x4dcd61]={'filename':_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0x4dcd61][_0xc846('0x32')],'id':_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0x4dcd61]['id'],'path':path[_0xc846('0xa5')](config[_0xc846('0xa6')],_0xc846('0xa7'),_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][_0x4dcd61][_0xc846('0xa8')])};}}return respondWithRpcPromise(_0xc846('0xa9'),_0xc846('0xa9'),{'FaxAccountId':_[_0xc846('0xaa')](_0x4228b7[_0xc846('0x4e')]['id'])?undefined:_0x4228b7[_0xc846('0x4e')]['id'],'path':_[_0xc846('0xaa')](_0x4228b7['body'][_0xc846('0xa4')][0x0]['path'])?undefined:_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][0x0]['path'],'fax':_['isNil'](_0x4228b7[_0xc846('0x5b')]['to'][0x0])?undefined:_0x4228b7[_0xc846('0x5b')]['to'][0x0]},client9002);})[_0xc846('0x1b')](function(){if(_0x4e8889){if(_['isNil'](_0x4228b7[_0xc846('0x5b')]['from'])){_0x4228b7[_0xc846('0x5b')][_0xc846('0xab')]=util[_0xc846('0x9f')](_0xc846('0xac'),_0x4e8889['name'],_0x4e8889['fax']);}if(_0x4e8889[_0xc846('0xa1')]){if(_0x4e8889[_0xc846('0xa1')][_0xc846('0xa2')][_0xc846('0x3f')]){return _0x4e8889[_0xc846('0xa1')][_0xc846('0xa2')][0x0];}else{return db[_0xc846('0x6b')][_0xc846('0x51')](_[_0xc846('0x15')](_0x4228b7[_0xc846('0x5b')],{'firstName':_0x4228b7[_0xc846('0x5b')]['to'][0x0],'phone':_0x4228b7[_0xc846('0x5b')]['to'][0x0],'fax':_0x4228b7['body']['to'][0x0],'ListId':_0x4e8889[_0xc846('0x9a')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc846('0xad'));}})[_0xc846('0x1b')](function(_0x457712){if(_0x457712){return db[_0xc846('0x67')][_0xc846('0x50')]({'where':{'ContactId':_0x457712['id'],'closed':![],'FaxAccountId':_0x4e8889['id']}})[_0xc846('0x1b')](function(_0x41f779){if(_0x41f779){return[_0x41f779,![]];}return db['FaxInteraction']['create']({'UserId':_0x4228b7['user']['id'],'ContactId':_0x457712['id'],'FaxAccountId':_0x4e8889['id'],'fax':_0x4228b7[_0xc846('0x5b')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xc846('0x47')](_0x4228b7[_0xc846('0x5b')],{'read':![],'body':_0x4228b7[_0xc846('0x5b')]['attachments'][0x0]['filename'],'FaxAccountId':_0x4e8889['id'],'UserId':_0x4228b7[_0xc846('0x52')]['id'],'ContactId':_0x457712['id'],'AttachmentId':_0x4228b7['body'][_0xc846('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xc846('0x9c')],'as':_0xc846('0xae')}]})[_0xc846('0x1b')](function(_0x534d10){return[_0x534d10,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc846('0xaf')](function(_0x525762,_0x23df42){if(_0x23df42){return _0x525762;}return db['FaxMessage'][_0xc846('0x51')]({'direction':_0xc846('0xb0'),'read':![],'body':_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][0x0][_0xc846('0xb1')],'FaxAccountId':_0x4e8889['id'],'FaxInteractionId':_0x525762['id'],'UserId':_0x4228b7['user']['id'],'ContactId':_0x525762['ContactId'],'AttachmentId':_0x4228b7['body'][_0xc846('0xa4')][0x0]['id']})[_0xc846('0x1b')](function(_0x2d8c25){_0x525762[_0xc846('0xb2')][_0xc846('0xae')]=[];_0x525762[_0xc846('0xb2')][_0xc846('0xae')][_0xc846('0x83')](_0x2d8c25['dataValues']);return _0x525762;});})['then'](function(_0x279185){respondWithRpcPromise(_0xc846('0xb3'),'SendFax',{'FaxAccountId':_[_0xc846('0xaa')](_0x4228b7[_0xc846('0x4e')]['id'])?undefined:_0x4228b7[_0xc846('0x4e')]['id'],'path':_['isNil'](_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][0x0][_0xc846('0x4')])?undefined:_0x4228b7[_0xc846('0x5b')][_0xc846('0xa4')][0x0][_0xc846('0x4')],'fax':_['isNil'](_0x4228b7['body']['to'][0x0])?undefined:_0x4228b7['body']['to'][0x0],'AttachmentId':_0x4228b7['body']['attachments'][0x0]['id']},client9002)[_0xc846('0x1b')](function(_0x38cb7d){logger[_0xc846('0x21')](_0xc846('0xb4'),_0x38cb7d);})['catch'](function(_0x42e5c5){logger[_0xc846('0x21')](_0xc846('0xb4'),_0x42e5c5);});return _0x279185;})[_0xc846('0x1b')](respondWithResult(_0x5ad94b,null))[_0xc846('0x23')](handleError(_0x5ad94b,null));};exports[_0xc846('0xb5')]=function(_0x163a23,_0x45c906,_0x4e00bb){return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0x163a23['params']['id']}})['then'](handleEntityNotFound(_0x45c906,null))[_0xc846('0x1b')](function(_0x36d841){if(_0x36d841){return _0x36d841[_0xc846('0xb5')](_0x163a23[_0xc846('0x5b')]['ids'],_[_0xc846('0x68')](_0x163a23[_0xc846('0x5b')],[_0xc846('0x62'),'id'])||{})[_0xc846('0xaf')](function(_0x324513){for(var _0x131d76=0x0;_0x131d76<_0x163a23[_0xc846('0x5b')][_0xc846('0x62')][_0xc846('0x3f')];_0x131d76+=0x1){socket[_0xc846('0xb6')](_0xc846('0xb7'),{'UserId':Number(_0x163a23[_0xc846('0x5b')]['ids'][_0x131d76]),'FaxAccountId':Number(_0x163a23[_0xc846('0x4e')]['id'])});}return _0x324513;});}})[_0xc846('0x1b')](respondWithResult(_0x45c906,null))['catch'](handleError(_0x45c906,null));};exports[_0xc846('0xb8')]=function(_0xfcc2ed,_0x9d4bd7,_0x2f28df){return db[_0xc846('0x35')][_0xc846('0x50')]({'where':{'id':_0xfcc2ed[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x9d4bd7,null))[_0xc846('0x1b')](function(_0xfb5178){if(_0xfb5178){return _0xfb5178[_0xc846('0xb8')](_0xfcc2ed[_0xc846('0x39')][_0xc846('0x62')])[_0xc846('0x1b')](function(){if(_['isArray'](_0xfcc2ed['query'][_0xc846('0x62')])){for(var _0x4937f4=0x0;_0x4937f4<_0xfcc2ed['query'][_0xc846('0x62')][_0xc846('0x3f')];_0x4937f4+=0x1){socket['emit'](_0xc846('0xb9'),{'UserId':Number(_0xfcc2ed[_0xc846('0x39')][_0xc846('0x62')][_0x4937f4]),'FaxAccountId':Number(_0xfcc2ed['params']['id'])});}}else{socket[_0xc846('0xb6')](_0xc846('0xb9'),{'UserId':Number(_0xfcc2ed['query'][_0xc846('0x62')]),'FaxAccountId':Number(_0xfcc2ed[_0xc846('0x4e')]['id'])});}});}})[_0xc846('0x1b')](respondWithStatusCode(_0x9d4bd7,null))[_0xc846('0x23')](handleError(_0x9d4bd7,null));};exports['getAgents']=function(_0x18d3df,_0x3752de,_0x2c5bb0){var _0x2ccc57={};var _0x14f5a7={};var _0x212bf0;var _0x491440;return db[_0xc846('0x35')][_0xc846('0x6a')]({'where':{'id':_0x18d3df[_0xc846('0x4e')]['id']}})[_0xc846('0x1b')](handleEntityNotFound(_0x3752de,null))[_0xc846('0x1b')](function(_0x220ae3){if(_0x220ae3){_0x212bf0=_0x220ae3;_0x14f5a7[_0xc846('0x3c')]=_[_0xc846('0x38')](db[_0xc846('0x6d')]['rawAttributes']);_0x14f5a7[_0xc846('0x39')]=_[_0xc846('0x38')](_0x18d3df[_0xc846('0x39')]);_0x14f5a7[_0xc846('0x3a')]=_[_0xc846('0x3b')](_0x14f5a7['model'],_0x14f5a7[_0xc846('0x39')]);_0x2ccc57['attributes']=_[_0xc846('0x3b')](_0x14f5a7[_0xc846('0x3c')],qs[_0xc846('0x3e')](_0x18d3df[_0xc846('0x39')][_0xc846('0x3e')]));_0x2ccc57[_0xc846('0x3d')]=_0x2ccc57[_0xc846('0x3d')][_0xc846('0x3f')]?_0x2ccc57['attributes']:_0x14f5a7[_0xc846('0x3c')];_0x2ccc57[_0xc846('0x42')]=qs[_0xc846('0x43')](_0x18d3df[_0xc846('0x39')][_0xc846('0x43')]);_0x2ccc57[_0xc846('0x44')]=qs[_0xc846('0x3a')](_[_0xc846('0x45')](_0x18d3df[_0xc846('0x39')],_0x14f5a7[_0xc846('0x3a')]));if(_0x18d3df[_0xc846('0x39')]['filter']){_0x2ccc57[_0xc846('0x44')]=_[_0xc846('0x47')](_0x2ccc57['where'],{'$or':_['map'](_0x2ccc57[_0xc846('0x3d')],function(_0x246d85){var _0x44cf00={};_0x44cf00[_0x246d85]={'$like':'%'+_0x18d3df['query']['filter']+'%'};return _0x44cf00;})});}_0x2ccc57=_[_0xc846('0x47')]({},_0x2ccc57,_0x18d3df[_0xc846('0x4f')]);return _0x212bf0[_0xc846('0xba')](_0x2ccc57);}})['then'](function(_0x178335){if(_0x178335){_0x491440=_0x178335[_0xc846('0x3f')];if(!_0x18d3df['query'][_0xc846('0x40')](_0xc846('0x41'))){_0x2ccc57['limit']=qs[_0xc846('0x29')](_0x18d3df['query'][_0xc846('0x29')]);_0x2ccc57[_0xc846('0x27')]=qs['offset'](_0x18d3df['query'][_0xc846('0x27')]);}return _0x212bf0[_0xc846('0xba')](_0x2ccc57);}})[_0xc846('0x1b')](function(_0x1237fe){if(_0x1237fe){return _0x1237fe?{'count':_0x491440,'rows':_0x1237fe}:null;}})[_0xc846('0x1b')](respondWithResult(_0x3752de,null))[_0xc846('0x23')](handleError(_0x3752de,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5725c99..c053a9e 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 _0x53f7=['setMaxListeners','save','update','emit','hook','exports','events','FaxAccount'];(function(_0x58df3b,_0x182132){var _0x1c82d6=function(_0x48b1a2){while(--_0x48b1a2){_0x58df3b['push'](_0x58df3b['shift']());}};_0x1c82d6(++_0x182132);}(_0x53f7,0x126));var _0x753f=function(_0x56e80c,_0xd0f2eb){_0x56e80c=_0x56e80c-0x0;var _0x2ece80=_0x53f7[_0x56e80c];return _0x2ece80;};'use strict';var EventEmitter=require(_0x753f('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x753f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x753f('0x2')](0x0);var events={'afterCreate':_0x753f('0x3'),'afterUpdate':_0x753f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41785e){return function(_0x1daa6c,_0x2e3c28,_0x498a55){FaxAccountEvents[_0x753f('0x5')](_0x41785e+':'+_0x1daa6c['id'],_0x1daa6c);FaxAccountEvents[_0x753f('0x5')](_0x41785e,_0x1daa6c);_0x498a55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x753f('0x6')](e,emitEvent(event));}}module[_0x753f('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xa16e=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount'];(function(_0x43c672,_0x4a574c){var _0x34b826=function(_0x50e200){while(--_0x50e200){_0x43c672['push'](_0x43c672['shift']());}};_0x34b826(++_0x4a574c);}(_0xa16e,0x1dd));var _0xea16=function(_0x4e338d,_0x537096){_0x4e338d=_0x4e338d-0x0;var _0x197d00=_0xa16e[_0x4e338d];return _0x197d00;};'use strict';var EventEmitter=require(_0xea16('0x0'));var FaxAccount=require(_0xea16('0x1'))['db'][_0xea16('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea16('0x3'),'afterUpdate':_0xea16('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e853e){return function(_0x19dd14,_0x2de1dc,_0x1fff42){FaxAccountEvents[_0xea16('0x5')](_0x3e853e+':'+_0x19dd14['id'],_0x19dd14);FaxAccountEvents['emit'](_0x3e853e,_0x19dd14);_0x1fff42(null);};}for(var e in events){if(events[_0xea16('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xea16('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5b66819..ca4447e 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 _0xa6d0=['request-promise','path','rimraf','../../config/environment','define','FaxAccount','lodash','../../config/logger','api'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xa6d0,0x192));var _0x0a6d=function(_0x233e66,_0x4063b7){_0x233e66=_0x233e66-0x0;var _0x144bf2=_0xa6d0[_0x233e66];return _0x144bf2;};'use strict';var _=require(_0x0a6d('0x0'));var util=require('util');var logger=require(_0x0a6d('0x1'))(_0x0a6d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a6d('0x3'));var fs=require('fs');var path=require(_0x0a6d('0x4'));var rimraf=require(_0x0a6d('0x5'));var config=require(_0x0a6d('0x6'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x580997,_0x28e2f3){return _0x580997[_0x0a6d('0x7')](_0x0a6d('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b60=['fax_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0x9b60,0x9d));var _0x09b6=function(_0x3dab1a,_0x4be8fd){_0x3dab1a=_0x3dab1a-0x0;var _0x314340=_0x9b60[_0x3dab1a];return _0x314340;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x09b6('0x0'))(_0x09b6('0x1'));var moment=require(_0x09b6('0x2'));var BPromise=require(_0x09b6('0x3'));var rp=require(_0x09b6('0x4'));var fs=require('fs');var path=require(_0x09b6('0x5'));var rimraf=require(_0x09b6('0x6'));var config=require(_0x09b6('0x7'));var attributes=require(_0x09b6('0x8'));module['exports']=function(_0x1294ad,_0x382137){return _0x1294ad[_0x09b6('0x9')](_0x09b6('0xa'),attributes,{'tableName':_0x09b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index a653d33..2d7bd92 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 _0x2cdc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','limit','map','include','model','attributes','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','ValidationError','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','CmList','CmContact','DESC','FaxApplication','Applications','get','applications','list','List','orderBy','priority','asc','Contacts','from','find','create','Contact\x20not\x20found','spread','push','unmanaged','created','interaction','FaxMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','queueId','FaxQueue','name','queue','waitForTheAssignedQueue','Start','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2cdc,0xbd));var _0xc2cd=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x2cdc[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xc2cd('0x0'));var util=require(_0xc2cd('0x1'));var moment=require(_0xc2cd('0x2'));var BPromise=require(_0xc2cd('0x3'));var rs=require(_0xc2cd('0x4'));var fs=require('fs');var Redis=require(_0xc2cd('0x5'));var db=require(_0xc2cd('0x6'))['db'];var utils=require(_0xc2cd('0x7'));var logger=require(_0xc2cd('0x8'))(_0xc2cd('0x9'));var config=require(_0xc2cd('0xa'));var jayson=require(_0xc2cd('0xb'));var client=jayson[_0xc2cd('0xc')]['http']({'port':0x232c});config[_0xc2cd('0xd')]=_['defaults'](config[_0xc2cd('0xd')],{'host':_0xc2cd('0xe'),'port':0x18eb});var socket=require(_0xc2cd('0xf'))(new Redis(config['redis']));require(_0xc2cd('0x10'))['register'](socket);function respondWithRpcPromise(_0x50b46c,_0x4d794c,_0x18e25e){return new BPromise(function(_0x702e02,_0x3fb4c7){return client[_0xc2cd('0x11')](_0x50b46c,_0x18e25e)[_0xc2cd('0x12')](function(_0x21a6ec){logger[_0xc2cd('0x13')]('FaxAccount,\x20%s,\x20%s',_0x4d794c,'request\x20sent');logger[_0xc2cd('0x14')](_0xc2cd('0x15'),_0x4d794c,_0xc2cd('0x16'),JSON['stringify'](_0x21a6ec));if(_0x21a6ec[_0xc2cd('0x17')]){if(_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x18')]===0x1f4){logger[_0xc2cd('0x17')](_0xc2cd('0x19'),_0x4d794c,_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);return _0x3fb4c7(_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);}logger['error'](_0xc2cd('0x19'),_0x4d794c,_0x21a6ec[_0xc2cd('0x17')][_0xc2cd('0x1a')]);return _0x702e02(_0x21a6ec[_0xc2cd('0x17')]['message']);}else{logger[_0xc2cd('0x13')](_0xc2cd('0x19'),_0x4d794c,'request\x20sent');_0x702e02(_0x21a6ec[_0xc2cd('0x1b')][_0xc2cd('0x1a')]);}})[_0xc2cd('0x1c')](function(_0x2a46f7){logger[_0xc2cd('0x17')](_0xc2cd('0x19'),_0x4d794c,_0x2a46f7);_0x3fb4c7(_0x2a46f7);});});}exports['GetFaxAccount']=function(_0x466921){var _0x4cc9ce=this;return new Promise(function(_0xb8a44,_0x32ed19){return db['FaxAccount'][_0xc2cd('0x1d')]({'raw':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x20')]||null:null,'attributes':_0x466921[_0xc2cd('0x1e')]?_0x466921['options']['attributes']||null:null,'limit':_0x466921[_0xc2cd('0x1e')]?_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x21')]||null:null,'include':_0x466921[_0xc2cd('0x1e')]?_0x466921['options']['include']?_[_0xc2cd('0x22')](_0x466921[_0xc2cd('0x1e')][_0xc2cd('0x23')],function(_0x462de1){return{'model':db[_0x462de1[_0xc2cd('0x24')]],'as':_0x462de1['as'],'attributes':_0x462de1['attributes'],'include':_0x462de1['include']?_['map'](_0x462de1[_0xc2cd('0x23')],function(_0x429f0a){return{'model':db[_0x429f0a[_0xc2cd('0x24')]],'as':_0x429f0a['as'],'attributes':_0x429f0a[_0xc2cd('0x25')],'include':_0x429f0a['include']?_[_0xc2cd('0x22')](_0x429f0a[_0xc2cd('0x23')],function(_0x44378c){return{'model':db[_0x44378c['model']],'as':_0x44378c['as'],'attributes':_0x44378c[_0xc2cd('0x25')]};}):[]};}):[]};}):[]:[]})[_0xc2cd('0x12')](function(_0x5947b8){logger[_0xc2cd('0x13')](_0xc2cd('0x26'),_0x466921);logger[_0xc2cd('0x14')]('GetFaxAccount',_0x466921,JSON[_0xc2cd('0x27')](_0x5947b8));_0xb8a44(_0x5947b8);})[_0xc2cd('0x1c')](function(_0x4d3638){logger[_0xc2cd('0x17')](_0xc2cd('0x26'),_0x4d3638[_0xc2cd('0x1a')],_0x466921);_0x32ed19(_0x4cc9ce[_0xc2cd('0x17')](0x1f4,_0x4d3638[_0xc2cd('0x1a')]));});});};exports[_0xc2cd('0x28')]=function(_0x48e0f9,_0x59c6d1,_0x1b0b8e){var _0x25a71c=this;return new Promise(function(_0x5efd4d,_0xbb7cd7){var _0x5effba={'body':_0x48e0f9[_0xc2cd('0x29')],'channel':_0xc2cd('0x2a')};var _0x73b17d=[];var _0x503e90=[];var _0x4390f9={};return db['CmContact'][_0xc2cd('0x2b')]()[_0xc2cd('0x12')](function(_0xd6b188){if(!_0xd6b188){throw new db[(_0xc2cd('0x2c'))]['ValidationError'](_0xc2cd('0x2d'));}_0x73b17d=_[_0xc2cd('0x2e')](_[_0xc2cd('0x2f')](_0xd6b188),[_0xc2cd('0x30'),_0xc2cd('0x31')]);_0x503e90=_[_0xc2cd('0x2e')](_[_0xc2cd('0x2f')](_0xd6b188),[_0xc2cd('0x30'),_0xc2cd('0x31'),_0xc2cd('0x32'),_0xc2cd('0x33')]);if(_0x48e0f9[_0xc2cd('0x29')]['id']){delete _0x48e0f9['body']['id'];}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')]['from'])){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))](_0xc2cd('0x36'));}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x29')])||_0x48e0f9['body'][_0xc2cd('0x29')]===''){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc2cd('0x34')](_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x37')])){throw new db[(_0xc2cd('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x503e90);}if(!_[_0xc2cd('0x38')](_0x503e90,_0x48e0f9['body']['mapKey'])){throw new db[(_0xc2cd('0x2c'))][(_0xc2cd('0x35'))](_0xc2cd('0x39')+_0x503e90);}_0x4390f9[_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x37')]]=_0x48e0f9['body']['from'];})[_0xc2cd('0x12')](function(){return db[_0xc2cd('0x3a')]['find']({'where':{'id':_0x48e0f9[_0xc2cd('0x3b')]['id']},'include':[{'model':db[_0xc2cd('0x3c')],'as':'List','include':[{'model':db[_0xc2cd('0x3d')],'as':'Contacts','where':_0x4390f9,'limit':0x1,'order':[[_0xc2cd('0x31'),_0xc2cd('0x3e')]]}]},{'model':db[_0xc2cd('0x3f')],'as':_0xc2cd('0x40')}]});})['then'](function(_0xec797c){if(_0xec797c&&_0xec797c['List']){var _0x1b7c57=_0xec797c[_0xc2cd('0x41')]({'plain':!![]});_0x5effba[_0xc2cd('0x3b')]=_0x1b7c57;_0x5effba[_0xc2cd('0x42')]=_0x1b7c57[_0xc2cd('0x40')];_0x5effba[_0xc2cd('0x43')]=_0x1b7c57[_0xc2cd('0x44')];_0x5effba[_0xc2cd('0x42')]=_[_0xc2cd('0x45')](_0x5effba[_0xc2cd('0x42')],[_0xc2cd('0x46')],[_0xc2cd('0x47')]);if(_0x5effba[_0xc2cd('0x3b')]['Applications']){delete _0x5effba[_0xc2cd('0x3b')]['Applications'];}if(_0x5effba[_0xc2cd('0x3b')]['List']&&_0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x44')]['Contacts']['length']){return _0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x44')][_0xc2cd('0x48')][0x0];}var _0x2c931a=_['defaults'](_0x48e0f9[_0xc2cd('0x29')],{'firstName':_0x48e0f9['body'][_0xc2cd('0x49')],'ListId':_0x1b7c57[_0xc2cd('0x33')]});_0x2c931a[_0x48e0f9['body'][_0xc2cd('0x37')]]=_0x48e0f9[_0xc2cd('0x29')]['from'];return db['CmContact']['create'](_0x2c931a,{'fields':_0x73b17d,'raw':!![]});}})[_0xc2cd('0x12')](function(_0x176ca1){_0x5effba['contact']=_0x176ca1;if(_0x176ca1){var _0x4b3855={'ContactId':_0x176ca1['id'],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id'],'fax':_0x176ca1[_0xc2cd('0x2a')]};return db['FaxInteraction'][_0xc2cd('0x4a')]({'where':{'ContactId':_0x176ca1['id'],'closed':![],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id']}})[_0xc2cd('0x12')](function(_0x348558){if(_0x348558){return[_0x348558,![]];}return db['FaxInteraction'][_0xc2cd('0x4b')](_0x4b3855)[_0xc2cd('0x12')](function(_0x530814){return[_0x530814,!![]];});});}else{throw new Error(_0xc2cd('0x4c'));}})[_0xc2cd('0x4d')](function(_0x436a4d,_0x5caed1){var _0x5092f0=_0x436a4d[_0xc2cd('0x41')]({'plain':!![]});if(_0x5caed1){if(_0x5effba[_0xc2cd('0x3b')]['autoclose']){_0x5effba[_0xc2cd('0x42')][_0xc2cd('0x4e')]({'id':0x0,'priority':_0x5effba[_0xc2cd('0x42')]['length']+0x1,'app':'close','appdata':_0xc2cd('0x4f'),'interval':'*,*,*,*'});}_0x5092f0[_0xc2cd('0x50')]=!![];}else{_0x5092f0['created']=![];}_0x5effba[_0xc2cd('0x51')]=_0x5092f0;return db[_0xc2cd('0x52')][_0xc2cd('0x4b')]({'body':_0x48e0f9[_0xc2cd('0x29')][_0xc2cd('0x29')],'FaxAccountId':_0x48e0f9[_0xc2cd('0x3b')]['id'],'FaxInteractionId':_0x436a4d['id'],'direction':'in','ContactId':_0x436a4d['ContactId'],'AttachmentId':_0x48e0f9['body'][_0xc2cd('0x53')]});})[_0xc2cd('0x12')](function(_0x5608fe){_0x5effba[_0xc2cd('0x1a')]=_0x5608fe;if(!_0x5effba['interaction'][_0xc2cd('0x54')])return;return db[_0xc2cd('0x55')]['find']({'attributes':['id','name'],'where':{'id':_0x5effba['interaction'][_0xc2cd('0x54')]}});})[_0xc2cd('0x12')](function(_0xba542){if(_0xba542){_0x5effba[_0xc2cd('0x42')][_0xc2cd('0x56')]({'id':0x0,'priority':0x0,'app':_0xc2cd('0x57'),'appdata':_0xba542['name']+','+(_0x5effba['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc2cd('0x58')});}if(!_0x5effba[_0xc2cd('0x51')][_0xc2cd('0x59')])return;return db[_0xc2cd('0x5a')]['find']({'attributes':['id',_0xc2cd('0x5b')],'where':{'id':_0x5effba['interaction'][_0xc2cd('0x59')]}});})[_0xc2cd('0x12')](function(_0x3c32db){if(_0x3c32db){_0x5effba['applications'][_0xc2cd('0x56')]({'id':0x0,'priority':0x1,'app':_0xc2cd('0x5c'),'appdata':_0x3c32db[_0xc2cd('0x5b')]+','+(_0x5effba[_0xc2cd('0x3b')][_0xc2cd('0x5d')]||0x12c),'interval':_0xc2cd('0x58')});}return respondWithRpcPromise(_0xc2cd('0x5e'),'startRouting',_0x5effba);})[_0xc2cd('0x12')](function(_0x2f7355){_0x5efd4d(_0x2f7355);})[_0xc2cd('0x1c')](function(_0x42473f){_0xbb7cd7(_0x25a71c[_0xc2cd('0x17')](0x1f4,_0x42473f[_0xc2cd('0x1a')]));});});}; \ No newline at end of file +var _0x9424=['create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','name','queueId','FaxQueue','waitForTheAssignedQueue','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','FaxAccount','findAll','options','where','attributes','limit','include','map','model','then','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','Applications','get','applications','list','orderBy','priority','asc','length','ListId'];(function(_0x5b6567,_0x40cc8f){var _0x2c4919=function(_0x4adec8){while(--_0x4adec8){_0x5b6567['push'](_0x5b6567['shift']());}};_0x2c4919(++_0x40cc8f);}(_0x9424,0x1c8));var _0x4942=function(_0x5dc7ba,_0x2f2d47){_0x5dc7ba=_0x5dc7ba-0x0;var _0x4fdb4b=_0x9424[_0x5dc7ba];return _0x4fdb4b;};'use strict';var _=require(_0x4942('0x0'));var util=require(_0x4942('0x1'));var moment=require('moment');var BPromise=require(_0x4942('0x2'));var rs=require(_0x4942('0x3'));var fs=require('fs');var Redis=require(_0x4942('0x4'));var db=require(_0x4942('0x5'))['db'];var utils=require(_0x4942('0x6'));var logger=require(_0x4942('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4942('0x8')]({'port':0x232c});config['redis']=_[_0x4942('0x9')](config[_0x4942('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4942('0xb'))(new Redis(config['redis']));require(_0x4942('0xc'))[_0x4942('0xd')](socket);function respondWithRpcPromise(_0x34e34c,_0x57ca4,_0x591849){return new BPromise(function(_0x5b1582,_0x5964cd){return client['request'](_0x34e34c,_0x591849)['then'](function(_0x2738af){logger[_0x4942('0xe')](_0x4942('0xf'),_0x57ca4,_0x4942('0x10'));logger[_0x4942('0x11')](_0x4942('0x12'),_0x57ca4,_0x4942('0x10'),JSON[_0x4942('0x13')](_0x2738af));if(_0x2738af[_0x4942('0x14')]){if(_0x2738af['error']['code']===0x1f4){logger[_0x4942('0x14')](_0x4942('0xf'),_0x57ca4,_0x2738af[_0x4942('0x14')]['message']);return _0x5964cd(_0x2738af[_0x4942('0x14')][_0x4942('0x15')]);}logger[_0x4942('0x14')](_0x4942('0xf'),_0x57ca4,_0x2738af[_0x4942('0x14')]['message']);return _0x5b1582(_0x2738af[_0x4942('0x14')][_0x4942('0x15')]);}else{logger[_0x4942('0xe')](_0x4942('0xf'),_0x57ca4,_0x4942('0x10'));_0x5b1582(_0x2738af['result'][_0x4942('0x15')]);}})[_0x4942('0x16')](function(_0x84d0e3){logger[_0x4942('0x14')](_0x4942('0xf'),_0x57ca4,_0x84d0e3);_0x5964cd(_0x84d0e3);});});}exports['GetFaxAccount']=function(_0x2b5dfb){var _0x226eae=this;return new Promise(function(_0x41ee98,_0x21fcf8){return db[_0x4942('0x17')][_0x4942('0x18')]({'raw':_0x2b5dfb[_0x4942('0x19')]?_0x2b5dfb[_0x4942('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2b5dfb[_0x4942('0x19')]?_0x2b5dfb['options'][_0x4942('0x1a')]||null:null,'attributes':_0x2b5dfb['options']?_0x2b5dfb[_0x4942('0x19')][_0x4942('0x1b')]||null:null,'limit':_0x2b5dfb['options']?_0x2b5dfb['options'][_0x4942('0x1c')]||null:null,'include':_0x2b5dfb['options']?_0x2b5dfb[_0x4942('0x19')][_0x4942('0x1d')]?_[_0x4942('0x1e')](_0x2b5dfb[_0x4942('0x19')][_0x4942('0x1d')],function(_0x1522a0){return{'model':db[_0x1522a0[_0x4942('0x1f')]],'as':_0x1522a0['as'],'attributes':_0x1522a0['attributes'],'include':_0x1522a0['include']?_['map'](_0x1522a0[_0x4942('0x1d')],function(_0x5a160b){return{'model':db[_0x5a160b[_0x4942('0x1f')]],'as':_0x5a160b['as'],'attributes':_0x5a160b[_0x4942('0x1b')],'include':_0x5a160b[_0x4942('0x1d')]?_['map'](_0x5a160b[_0x4942('0x1d')],function(_0x4a39e8){return{'model':db[_0x4a39e8['model']],'as':_0x4a39e8['as'],'attributes':_0x4a39e8[_0x4942('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4942('0x20')](function(_0x45d966){logger['info'](_0x4942('0x21'),_0x2b5dfb);logger['debug']('GetFaxAccount',_0x2b5dfb,JSON[_0x4942('0x13')](_0x45d966));_0x41ee98(_0x45d966);})[_0x4942('0x16')](function(_0x16151a){logger[_0x4942('0x14')](_0x4942('0x21'),_0x16151a[_0x4942('0x15')],_0x2b5dfb);_0x21fcf8(_0x226eae[_0x4942('0x14')](0x1f4,_0x16151a['message']));});});};exports[_0x4942('0x22')]=function(_0x3b15a9,_0x13c70d,_0x1ccbf7){var _0x30b156=this;return new Promise(function(_0xe6a61f,_0x13e001){var _0x1705dd={'body':_0x3b15a9[_0x4942('0x23')],'channel':_0x4942('0x24')};var _0x481fdf=[];var _0x32e985=[];var _0x41b407={};return db[_0x4942('0x25')][_0x4942('0x26')]()[_0x4942('0x20')](function(_0x2dbc40){if(!_0x2dbc40){throw new db['Sequelize']['ValidationError'](_0x4942('0x27'));}_0x481fdf=_[_0x4942('0x28')](_['keys'](_0x2dbc40),[_0x4942('0x29'),'updatedAt']);_0x32e985=_[_0x4942('0x28')](_['keys'](_0x2dbc40),[_0x4942('0x29'),_0x4942('0x2a'),_0x4942('0x2b'),'ListId']);if(_0x3b15a9[_0x4942('0x23')]['id']){delete _0x3b15a9[_0x4942('0x23')]['id'];}if(_[_0x4942('0x2c')](_0x3b15a9['body'][_0x4942('0x2d')])){throw new db[(_0x4942('0x2e'))][(_0x4942('0x2f'))](_0x4942('0x30'));}if(_['isNil'](_0x3b15a9['body']['body'])||_0x3b15a9['body'][_0x4942('0x23')]===''){throw new db[(_0x4942('0x2e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3b15a9[_0x4942('0x23')]['mapKey'])){throw new db['Sequelize'][(_0x4942('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32e985);}if(!_[_0x4942('0x31')](_0x32e985,_0x3b15a9[_0x4942('0x23')][_0x4942('0x32')])){throw new db['Sequelize'][(_0x4942('0x2f'))](_0x4942('0x33')+_0x32e985);}_0x41b407[_0x3b15a9[_0x4942('0x23')][_0x4942('0x32')]]=_0x3b15a9[_0x4942('0x23')][_0x4942('0x2d')];})[_0x4942('0x20')](function(){return db[_0x4942('0x17')][_0x4942('0x34')]({'where':{'id':_0x3b15a9[_0x4942('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0x4942('0x36'),'include':[{'model':db['CmContact'],'as':_0x4942('0x37'),'where':_0x41b407,'limit':0x1,'order':[[_0x4942('0x2a'),_0x4942('0x38')]]}]},{'model':db['FaxApplication'],'as':_0x4942('0x39')}]});})[_0x4942('0x20')](function(_0x26efb0){if(_0x26efb0&&_0x26efb0[_0x4942('0x36')]){var _0x49b227=_0x26efb0[_0x4942('0x3a')]({'plain':!![]});_0x1705dd['account']=_0x49b227;_0x1705dd[_0x4942('0x3b')]=_0x49b227[_0x4942('0x39')];_0x1705dd[_0x4942('0x3c')]=_0x49b227[_0x4942('0x36')];_0x1705dd[_0x4942('0x3b')]=_[_0x4942('0x3d')](_0x1705dd[_0x4942('0x3b')],[_0x4942('0x3e')],[_0x4942('0x3f')]);if(_0x1705dd[_0x4942('0x35')][_0x4942('0x39')]){delete _0x1705dd[_0x4942('0x35')]['Applications'];}if(_0x1705dd['account']['List']&&_0x1705dd[_0x4942('0x35')][_0x4942('0x36')][_0x4942('0x37')][_0x4942('0x40')]){return _0x1705dd[_0x4942('0x35')][_0x4942('0x36')]['Contacts'][0x0];}var _0x574641=_[_0x4942('0x9')](_0x3b15a9['body'],{'firstName':_0x3b15a9[_0x4942('0x23')][_0x4942('0x2d')],'ListId':_0x49b227[_0x4942('0x41')]});_0x574641[_0x3b15a9[_0x4942('0x23')][_0x4942('0x32')]]=_0x3b15a9[_0x4942('0x23')][_0x4942('0x2d')];return db[_0x4942('0x25')][_0x4942('0x42')](_0x574641,{'fields':_0x481fdf,'raw':!![]});}})['then'](function(_0x4c56bf){_0x1705dd[_0x4942('0x43')]=_0x4c56bf;if(_0x4c56bf){var _0x2ce784={'ContactId':_0x4c56bf['id'],'FaxAccountId':_0x3b15a9['account']['id'],'fax':_0x4c56bf[_0x4942('0x24')]};return db[_0x4942('0x44')]['find']({'where':{'ContactId':_0x4c56bf['id'],'closed':![],'FaxAccountId':_0x3b15a9['account']['id']}})['then'](function(_0x17f803){if(_0x17f803){return[_0x17f803,![]];}return db['FaxInteraction'][_0x4942('0x42')](_0x2ce784)[_0x4942('0x20')](function(_0x3b6f7b){return[_0x3b6f7b,!![]];});});}else{throw new Error(_0x4942('0x45'));}})[_0x4942('0x46')](function(_0x568e94,_0x39bcd0){var _0x32ab73=_0x568e94[_0x4942('0x3a')]({'plain':!![]});if(_0x39bcd0){if(_0x1705dd[_0x4942('0x35')][_0x4942('0x47')]){_0x1705dd[_0x4942('0x3b')][_0x4942('0x48')]({'id':0x0,'priority':_0x1705dd['applications'][_0x4942('0x40')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x4942('0x49')});}_0x32ab73['created']=!![];}else{_0x32ab73['created']=![];}_0x1705dd[_0x4942('0x4a')]=_0x32ab73;return db[_0x4942('0x4b')]['create']({'body':_0x3b15a9[_0x4942('0x23')][_0x4942('0x23')],'FaxAccountId':_0x3b15a9[_0x4942('0x35')]['id'],'FaxInteractionId':_0x568e94['id'],'direction':'in','ContactId':_0x568e94[_0x4942('0x4c')],'AttachmentId':_0x3b15a9[_0x4942('0x23')][_0x4942('0x4d')]});})['then'](function(_0x20d216){_0x1705dd[_0x4942('0x15')]=_0x20d216;if(!_0x1705dd[_0x4942('0x4a')][_0x4942('0x4e')])return;return db[_0x4942('0x4f')]['find']({'attributes':['id','name'],'where':{'id':_0x1705dd[_0x4942('0x4a')][_0x4942('0x4e')]}});})['then'](function(_0x12f318){if(_0x12f318){_0x1705dd[_0x4942('0x3b')][_0x4942('0x50')]({'id':0x0,'priority':0x0,'app':_0x4942('0x51'),'appdata':_0x12f318[_0x4942('0x52')]+','+(_0x1705dd[_0x4942('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0x4942('0x49')});}if(!_0x1705dd['interaction'][_0x4942('0x53')])return;return db[_0x4942('0x54')][_0x4942('0x34')]({'attributes':['id','name'],'where':{'id':_0x1705dd['interaction'][_0x4942('0x53')]}});})['then'](function(_0x32f737){if(_0x32f737){_0x1705dd[_0x4942('0x3b')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x32f737['name']+','+(_0x1705dd[_0x4942('0x35')][_0x4942('0x55')]||0x12c),'interval':_0x4942('0x49')});}return respondWithRpcPromise('Start',_0x4942('0x56'),_0x1705dd);})[_0x4942('0x20')](function(_0x1b8c82){_0xe6a61f(_0x1b8c82);})[_0x4942('0x16')](function(_0x514399){_0x13e001(_0x30b156[_0x4942('0x14')](0x1f4,_0x514399['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 5bd06f1..e3725bb 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 _0xa8d2=['remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x503df1,_0x2c0fcd){var _0x2ae00e=function(_0x3b54ca){while(--_0x3b54ca){_0x503df1['push'](_0x503df1['shift']());}};_0x2ae00e(++_0x2c0fcd);}(_0xa8d2,0x178));var _0x2a8d=function(_0x5b7005,_0x3d864d){_0x5b7005=_0x5b7005-0x0;var _0x5dc9a3=_0xa8d2[_0x5b7005];return _0x5dc9a3;};'use strict';var FaxAccountEvents=require(_0x2a8d('0x0'));var events=[_0x2a8d('0x1'),_0x2a8d('0x2'),_0x2a8d('0x3')];function createListener(_0x4eca25,_0x198b0b){return function(_0x565f95){_0x198b0b[_0x2a8d('0x4')](_0x4eca25,_0x565f95);};}function removeListener(_0x293d01,_0x1a0702){return function(){FaxAccountEvents[_0x2a8d('0x5')](_0x293d01,_0x1a0702);};}exports[_0x2a8d('0x6')]=function(_0x2d29d9){for(var _0x3cfda2=0x0,_0x3dac22=events[_0x2a8d('0x7')];_0x3cfda2<_0x3dac22;_0x3cfda2++){var _0x46b19f=events[_0x3cfda2];var _0x275de4=createListener(_0x2a8d('0x8')+_0x46b19f,_0x2d29d9);FaxAccountEvents['on'](_0x46b19f,_0x275de4);}}; \ No newline at end of file +var _0x63ec=['update','removeListener','register','faxAccount:','./faxAccount.events','save','remove'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x63ec,0x1b6));var _0xc63e=function(_0x24f938,_0x32f0a1){_0x24f938=_0x24f938-0x0;var _0x45775a=_0x63ec[_0x24f938];return _0x45775a;};'use strict';var FaxAccountEvents=require(_0xc63e('0x0'));var events=[_0xc63e('0x1'),_0xc63e('0x2'),_0xc63e('0x3')];function createListener(_0x4323a3,_0x5443cb){return function(_0x35c2d6){_0x5443cb['emit'](_0x4323a3,_0x35c2d6);};}function removeListener(_0x46d1c9,_0x3a2c7d){return function(){FaxAccountEvents[_0xc63e('0x4')](_0x46d1c9,_0x3a2c7d);};}exports[_0xc63e('0x5')]=function(_0x5a506b){for(var _0x5301bd=0x0,_0x47c1cb=events['length'];_0x5301bd<_0x47c1cb;_0x5301bd++){var _0x53ae80=events[_0x5301bd];var _0x3a3856=createListener(_0xc63e('0x6')+_0x53ae80,_0x5a506b);FaxAccountEvents['on'](_0x53ae80,_0x3a3856);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3f3bbc4..9f8bf1f 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 _0xb36e=['multer','util','path','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','exports'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xb36e,0x140));var _0xeb36=function(_0xe4486c,_0x454251){_0xe4486c=_0xe4486c-0x0;var _0x517b1a=_0xb36e[_0xe4486c];return _0x517b1a;};'use strict';var multer=require(_0xeb36('0x0'));var util=require(_0xeb36('0x1'));var path=require(_0xeb36('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeb36('0x3'));var interaction=require(_0xeb36('0x4'));var config=require('../../config/environment');var controller=require(_0xeb36('0x5'));router[_0xeb36('0x6')]('/',auth[_0xeb36('0x7')](),controller[_0xeb36('0x8')]);router[_0xeb36('0x6')]('/describe',auth[_0xeb36('0x7')](),controller[_0xeb36('0x9')]);router['get'](_0xeb36('0xa'),auth[_0xeb36('0x7')](),controller[_0xeb36('0xb')]);router[_0xeb36('0x6')](_0xeb36('0xc'),auth['isAuthenticated'](),controller[_0xeb36('0xd')]);router['get'](_0xeb36('0xe'),auth[_0xeb36('0x7')](),controller[_0xeb36('0xf')]);router[_0xeb36('0x6')](_0xeb36('0x10'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x11')]);router[_0xeb36('0x6')](_0xeb36('0x12'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x13')]);router[_0xeb36('0x6')](_0xeb36('0x14'),auth['isAuthenticated'](),controller[_0xeb36('0x15')]);router[_0xeb36('0x6')](_0xeb36('0x16'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x17')]);router[_0xeb36('0x18')]('/',auth[_0xeb36('0x7')](),controller[_0xeb36('0x19')]);router[_0xeb36('0x18')](_0xeb36('0xc'),auth[_0xeb36('0x7')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xeb36('0x7')](),controller[_0xeb36('0x1a')]);router['post'](_0xeb36('0x10'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1b')]);router[_0xeb36('0x18')](_0xeb36('0x12'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1c')]);router[_0xeb36('0x18')](_0xeb36('0x1d'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x1e')]);router['post'](_0xeb36('0x1f'),auth[_0xeb36('0x7')](),controller['updateAccountApplications']);router[_0xeb36('0x18')](_0xeb36('0x20'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x21')]);router[_0xeb36('0x18')](_0xeb36('0x16'),auth[_0xeb36('0x7')](),controller[_0xeb36('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xeb36('0x23')]);router[_0xeb36('0x24')](_0xeb36('0xa'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xeb36('0x25')]);router[_0xeb36('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xeb36('0x26')]);router[_0xeb36('0x24')](_0xeb36('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeb36('0x27')]=router; \ No newline at end of file +var _0x3dbf=['show','/:id/dispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/messages','addDisposition','addAnswer','post','addInteraction','/:id/applications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x3719ec,_0x4638c2){var _0x53af3a=function(_0xd55f21){while(--_0xd55f21){_0x3719ec['push'](_0x3719ec['shift']());}};_0x53af3a(++_0x4638c2);}(_0x3dbf,0x13f));var _0xf3db=function(_0x34ddf1,_0x494e77){_0x34ddf1=_0x34ddf1-0x0;var _0x264cd6=_0x3dbf[_0x34ddf1];return _0x264cd6;};'use strict';var multer=require(_0xf3db('0x0'));var util=require('util');var path=require(_0xf3db('0x1'));var timeout=require(_0xf3db('0x2'));var express=require(_0xf3db('0x3'));var router=express[_0xf3db('0x4')]();var fs_extra=require(_0xf3db('0x5'));var auth=require(_0xf3db('0x6'));var interaction=require(_0xf3db('0x7'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xf3db('0x8')]('/',auth['isAuthenticated'](),controller[_0xf3db('0x9')]);router[_0xf3db('0x8')](_0xf3db('0xa'),auth['isAuthenticated'](),controller[_0xf3db('0xb')]);router[_0xf3db('0x8')](_0xf3db('0xc'),auth[_0xf3db('0xd')](),controller[_0xf3db('0xe')]);router[_0xf3db('0x8')](_0xf3db('0xf'),auth[_0xf3db('0xd')](),controller['getDispositions']);router[_0xf3db('0x8')](_0xf3db('0x10'),auth['isAuthenticated'](),controller[_0xf3db('0x11')]);router[_0xf3db('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf3db('0x12')]);router[_0xf3db('0x8')]('/:id/applications',auth[_0xf3db('0xd')](),controller['getApplications']);router[_0xf3db('0x8')](_0xf3db('0x13'),auth[_0xf3db('0xd')](),controller['getMessages']);router[_0xf3db('0x8')]('/:id/users',auth[_0xf3db('0xd')](),controller['getAgents']);router['post']('/',auth[_0xf3db('0xd')](),controller['create']);router['post']('/:id/dispositions',auth[_0xf3db('0xd')](),controller[_0xf3db('0x14')]);router['post'](_0xf3db('0x10'),auth[_0xf3db('0xd')](),controller[_0xf3db('0x15')]);router[_0xf3db('0x16')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xf3db('0x17')]);router[_0xf3db('0x16')](_0xf3db('0x18'),auth[_0xf3db('0xd')](),controller['addApplications']);router[_0xf3db('0x16')]('/addaccountapplications',auth[_0xf3db('0xd')](),controller['addAccountApplications']);router[_0xf3db('0x16')]('/updateaccountapplications',auth['isAuthenticated'](),controller[_0xf3db('0x19')]);router[_0xf3db('0x16')](_0xf3db('0x1a'),auth['isAuthenticated'](),controller[_0xf3db('0x1b')]);router[_0xf3db('0x16')]('/:id/users',auth[_0xf3db('0xd')](),controller[_0xf3db('0x1c')]);router[_0xf3db('0x1d')](_0xf3db('0xc'),auth[_0xf3db('0xd')](),controller[_0xf3db('0x1e')]);router[_0xf3db('0x1f')]('/:id',auth[_0xf3db('0xd')](),controller['destroy']);router[_0xf3db('0x1f')]('/:id/dispositions',auth[_0xf3db('0xd')](),controller[_0xf3db('0x20')]);router['delete']('/:id/canned_answers',auth[_0xf3db('0xd')](),controller[_0xf3db('0x21')]);router['delete'](_0xf3db('0x22'),auth[_0xf3db('0xd')](),controller[_0xf3db('0x23')]);module[_0xf3db('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 998d797..ef6fa9d 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 _0x0f86=['TEXT','sequelize','INTEGER','noop'];(function(_0x4183a3,_0x2a0f1f){var _0x44c7aa=function(_0x444a74){while(--_0x444a74){_0x4183a3['push'](_0x4183a3['shift']());}};_0x44c7aa(++_0x2a0f1f);}(_0x0f86,0x195));var _0x60f8=function(_0xf9119c,_0x5b1579){_0xf9119c=_0xf9119c-0x0;var _0xf87f3a=_0x0f86[_0xf9119c];return _0xf87f3a;};'use strict';var Sequelize=require(_0x60f8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x60f8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x60f8('0x2')},'appdata':{'type':Sequelize[_0x60f8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9862=['INTEGER','STRING','TEXT','exports'];(function(_0x531390,_0x201c5b){var _0x3a302a=function(_0x1c3d9d){while(--_0x1c3d9d){_0x531390['push'](_0x531390['shift']());}};_0x3a302a(++_0x201c5b);}(_0x9862,0x1c3));var _0x2986=function(_0x29544e,_0x5e225b){_0x29544e=_0x29544e-0x0;var _0x751d37=_0x9862[_0x29544e];return _0x751d37;};'use strict';var Sequelize=require('sequelize');module[_0x2986('0x0')]={'priority':{'type':Sequelize[_0x2986('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x2986('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2986('0x3')]()},'description':{'type':Sequelize[_0x2986('0x2')]},'interval':{'type':Sequelize[_0x2986('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5e6b5aa..78f93c6 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 _0xfd71=['catch','show','rawAttributes','includeAll','include','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','options','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd71,0x163));var _0x1fd7=function(_0xa92013,_0x3b2577){_0xa92013=_0xa92013-0x0;var _0x49fdfa=_0xfd71[_0xa92013];return _0x49fdfa;};'use strict';var emlformat=require(_0x1fd7('0x0'));var rimraf=require(_0x1fd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fd7('0x2'));var rp=require(_0x1fd7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fd7('0x4'));var util=require(_0x1fd7('0x5'));var path=require('path');var sox=require(_0x1fd7('0x6'));var csv=require(_0x1fd7('0x7'));var ejs=require(_0x1fd7('0x8'));var fs=require('fs');var fs_extra=require(_0x1fd7('0x9'));var _=require(_0x1fd7('0xa'));var squel=require(_0x1fd7('0xb'));var crypto=require(_0x1fd7('0xc'));var jsforce=require(_0x1fd7('0xd'));var deskjs=require(_0x1fd7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1fd7('0xf'));var authService=require(_0x1fd7('0x10'));var qs=require(_0x1fd7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fd7('0x12'))(_0x1fd7('0x13'));var utils=require('../../config/utils');var config=require(_0x1fd7('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x129313,_0x2842c9){_0x2842c9=_0x2842c9||0xcc;return function(_0x3fcb89){if(_0x3fcb89){return _0x129313['sendStatus'](_0x2842c9);}return _0x129313[_0x1fd7('0x15')](_0x2842c9)[_0x1fd7('0x16')]();};}function respondWithResult(_0x42ec8e,_0x17ca8a){_0x17ca8a=_0x17ca8a||0xc8;return function(_0x2ba8b2){if(_0x2ba8b2){return _0x42ec8e[_0x1fd7('0x15')](_0x17ca8a)['json'](_0x2ba8b2);}};}function respondWithFilteredResult(_0x15166a,_0x2dae21){return function(_0x2f5785){if(_0x2f5785){var _0x6af74a=typeof _0x2dae21[_0x1fd7('0x17')]===_0x1fd7('0x18')&&typeof _0x2dae21[_0x1fd7('0x19')]===_0x1fd7('0x18');var _0x226c87=_0x2f5785[_0x1fd7('0x1a')];var _0x12d67b=_0x6af74a?0x0:_0x2dae21['offset'];var _0x1e96ea=_0x6af74a?_0x2f5785[_0x1fd7('0x1a')]:_0x2dae21[_0x1fd7('0x17')]+_0x2dae21[_0x1fd7('0x19')];var _0x3008d2;if(_0x1e96ea>=_0x226c87){_0x1e96ea=_0x226c87;_0x3008d2=0xc8;}else{_0x3008d2=0xce;}_0x15166a['status'](_0x3008d2);return _0x15166a[_0x1fd7('0x1b')](_0x1fd7('0x1c'),_0x12d67b+'-'+_0x1e96ea+'/'+_0x226c87)[_0x1fd7('0x1d')](_0x2f5785);}return null;};}function patchUpdates(_0x219847){return function(_0x196caf){try{jsonpatch['apply'](_0x196caf,_0x219847,!![]);}catch(_0x23a252){return BPromise[_0x1fd7('0x1e')](_0x23a252);}return _0x196caf[_0x1fd7('0x1f')]();};}function saveUpdates(_0x2b48b7,_0x497e1c){return function(_0x17a6fd){if(_0x17a6fd){return _0x17a6fd['update'](_0x2b48b7)[_0x1fd7('0x20')](function(_0xe8893){return _0xe8893;});}return null;};}function removeEntity(_0x4c2aea,_0x27b765){return function(_0x8f44a3){if(_0x8f44a3){return _0x8f44a3[_0x1fd7('0x21')]()[_0x1fd7('0x20')](function(){_0x4c2aea[_0x1fd7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d3b8,_0x48c881){return function(_0x540cba){if(!_0x540cba){_0x43d3b8[_0x1fd7('0x22')](0x194);}return _0x540cba;};}function handleError(_0x5b50aa,_0x269c92){_0x269c92=_0x269c92||0x1f4;return function(_0x39b39a){logger[_0x1fd7('0x23')](_0x39b39a[_0x1fd7('0x24')]);if(_0x39b39a['name']){delete _0x39b39a[_0x1fd7('0x25')];}_0x5b50aa[_0x1fd7('0x15')](_0x269c92)['send'](_0x39b39a);};}exports[_0x1fd7('0x26')]=function(_0x8087cd,_0x4d843c){var _0x2d2358={},_0x5cfe47={},_0x3b698b={'count':0x0,'rows':[]};var _0x586f3b=_['map'](db[_0x1fd7('0x27')]['rawAttributes'],function(_0x21cbc3){return{'name':_0x21cbc3['fieldName'],'type':_0x21cbc3[_0x1fd7('0x28')][_0x1fd7('0x29')]};});_0x5cfe47[_0x1fd7('0x2a')]=_['map'](_0x586f3b,'name');_0x5cfe47[_0x1fd7('0x2b')]=_[_0x1fd7('0x2c')](_0x8087cd[_0x1fd7('0x2b')]);_0x5cfe47[_0x1fd7('0x2d')]=_[_0x1fd7('0x2e')](_0x5cfe47['model'],_0x5cfe47[_0x1fd7('0x2b')]);_0x2d2358[_0x1fd7('0x2f')]=_[_0x1fd7('0x2e')](_0x5cfe47[_0x1fd7('0x2a')],qs[_0x1fd7('0x30')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x30')]));_0x2d2358[_0x1fd7('0x2f')]=_0x2d2358[_0x1fd7('0x2f')][_0x1fd7('0x31')]?_0x2d2358[_0x1fd7('0x2f')]:_0x5cfe47['model'];if(!_0x8087cd[_0x1fd7('0x2b')]['hasOwnProperty'](_0x1fd7('0x32'))){_0x2d2358['limit']=qs[_0x1fd7('0x19')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x19')]);_0x2d2358['offset']=qs[_0x1fd7('0x17')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x17')]);}_0x2d2358[_0x1fd7('0x33')]=qs[_0x1fd7('0x34')](_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x34')]);_0x2d2358[_0x1fd7('0x35')]=qs[_0x1fd7('0x2d')](_['pick'](_0x8087cd[_0x1fd7('0x2b')],_0x5cfe47['filters']),_0x586f3b);if(_0x8087cd[_0x1fd7('0x2b')][_0x1fd7('0x36')]){_0x2d2358[_0x1fd7('0x35')]=_[_0x1fd7('0x37')](_0x2d2358[_0x1fd7('0x35')],{'$or':_[_0x1fd7('0x38')](_0x586f3b,function(_0x4b1e60){if(_0x4b1e60[_0x1fd7('0x28')]!=='VIRTUAL'){var _0x34c222={};_0x34c222[_0x4b1e60['name']]={'$like':'%'+_0x8087cd[_0x1fd7('0x2b')]['filter']+'%'};return _0x34c222;}})});}_0x2d2358=_['merge']({},_0x2d2358,_0x8087cd[_0x1fd7('0x39')]);var _0x14efa2={'where':_0x2d2358['where']};return db[_0x1fd7('0x27')][_0x1fd7('0x1a')](_0x14efa2)[_0x1fd7('0x20')](function(_0x3fd66d){_0x3b698b[_0x1fd7('0x1a')]=_0x3fd66d;if(_0x8087cd[_0x1fd7('0x2b')]['includeAll']){_0x2d2358['include']=[{'all':!![]}];}return db[_0x1fd7('0x27')][_0x1fd7('0x3a')](_0x2d2358);})[_0x1fd7('0x20')](function(_0x848a61){_0x3b698b['rows']=_0x848a61;return _0x3b698b;})[_0x1fd7('0x20')](respondWithFilteredResult(_0x4d843c,_0x2d2358))[_0x1fd7('0x3b')](handleError(_0x4d843c,null));};exports[_0x1fd7('0x3c')]=function(_0x24e52e,_0x113818){var _0x118ca0={'raw':!![],'where':{'id':_0x24e52e['params']['id']}},_0x350800={};_0x350800[_0x1fd7('0x2a')]=_['keys'](db['FaxApplication'][_0x1fd7('0x3d')]);_0x350800[_0x1fd7('0x2b')]=_[_0x1fd7('0x2c')](_0x24e52e['query']);_0x350800[_0x1fd7('0x2d')]=_[_0x1fd7('0x2e')](_0x350800['model'],_0x350800[_0x1fd7('0x2b')]);_0x118ca0[_0x1fd7('0x2f')]=_[_0x1fd7('0x2e')](_0x350800[_0x1fd7('0x2a')],qs[_0x1fd7('0x30')](_0x24e52e[_0x1fd7('0x2b')][_0x1fd7('0x30')]));_0x118ca0['attributes']=_0x118ca0[_0x1fd7('0x2f')][_0x1fd7('0x31')]?_0x118ca0['attributes']:_0x350800['model'];if(_0x24e52e['query'][_0x1fd7('0x3e')]){_0x118ca0[_0x1fd7('0x3f')]=[{'all':!![]}];}_0x118ca0=_['merge']({},_0x118ca0,_0x24e52e[_0x1fd7('0x39')]);return db['FaxApplication'][_0x1fd7('0x40')](_0x118ca0)[_0x1fd7('0x20')](handleEntityNotFound(_0x113818,null))[_0x1fd7('0x20')](respondWithResult(_0x113818,null))[_0x1fd7('0x3b')](handleError(_0x113818,null));};exports[_0x1fd7('0x41')]=function(_0x4946d8,_0x43e650){return db[_0x1fd7('0x27')][_0x1fd7('0x41')](_0x4946d8[_0x1fd7('0x42')],{})[_0x1fd7('0x20')](respondWithResult(_0x43e650,0xc9))[_0x1fd7('0x3b')](handleError(_0x43e650,null));};exports[_0x1fd7('0x43')]=function(_0x250846,_0x3f5e67){if(_0x250846[_0x1fd7('0x42')]['id']){delete _0x250846[_0x1fd7('0x42')]['id'];}return db[_0x1fd7('0x27')]['find']({'where':{'id':_0x250846[_0x1fd7('0x44')]['id']}})[_0x1fd7('0x20')](handleEntityNotFound(_0x3f5e67,null))[_0x1fd7('0x20')](saveUpdates(_0x250846[_0x1fd7('0x42')],null))[_0x1fd7('0x20')](respondWithResult(_0x3f5e67,null))[_0x1fd7('0x3b')](handleError(_0x3f5e67,null));};exports[_0x1fd7('0x21')]=function(_0x50905a,_0xab0bc9){return db[_0x1fd7('0x27')][_0x1fd7('0x40')]({'where':{'id':_0x50905a[_0x1fd7('0x44')]['id']}})[_0x1fd7('0x20')](handleEntityNotFound(_0xab0bc9,null))[_0x1fd7('0x20')](removeEntity(_0xab0bc9,null))['catch'](handleError(_0xab0bc9,null));}; \ No newline at end of file +var _0xe0bf=['moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','sendStatus','error','name','index','map','FaxApplication','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe0bf,0x90));var _0xfe0b=function(_0x3144c8,_0x3fe1a2){_0x3144c8=_0x3144c8-0x0;var _0x1468f0=_0xe0bf[_0x3144c8];return _0x1468f0;};'use strict';var emlformat=require(_0xfe0b('0x0'));var rimraf=require(_0xfe0b('0x1'));var zipdir=require(_0xfe0b('0x2'));var jsonpatch=require(_0xfe0b('0x3'));var rp=require('request-promise');var moment=require(_0xfe0b('0x4'));var BPromise=require(_0xfe0b('0x5'));var Mustache=require('mustache');var util=require(_0xfe0b('0x6'));var path=require(_0xfe0b('0x7'));var sox=require(_0xfe0b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe0b('0x9'));var _=require(_0xfe0b('0xa'));var squel=require(_0xfe0b('0xb'));var crypto=require(_0xfe0b('0xc'));var jsforce=require(_0xfe0b('0xd'));var deskjs=require(_0xfe0b('0xe'));var toCsv=require(_0xfe0b('0xf'));var querystring=require('querystring');var Papa=require(_0xfe0b('0x10'));var Redis=require(_0xfe0b('0x11'));var authService=require(_0xfe0b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe0b('0x13'));var logger=require(_0xfe0b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfe0b('0x15'));var licenseUtil=require(_0xfe0b('0x16'));var db=require(_0xfe0b('0x17'))['db'];function respondWithStatusCode(_0x2add02,_0x5b48d9){_0x5b48d9=_0x5b48d9||0xcc;return function(_0x7e8998){if(_0x7e8998){return _0x2add02['sendStatus'](_0x5b48d9);}return _0x2add02[_0xfe0b('0x18')](_0x5b48d9)[_0xfe0b('0x19')]();};}function respondWithResult(_0x438e2a,_0xf21537){_0xf21537=_0xf21537||0xc8;return function(_0xfefba0){if(_0xfefba0){return _0x438e2a[_0xfe0b('0x18')](_0xf21537)[_0xfe0b('0x1a')](_0xfefba0);}};}function respondWithFilteredResult(_0x2dc5b3,_0x5e2896){return function(_0x2acf4c){if(_0x2acf4c){var _0x56231a=typeof _0x5e2896[_0xfe0b('0x1b')]===_0xfe0b('0x1c')&&typeof _0x5e2896[_0xfe0b('0x1d')]==='undefined';var _0x1167bb=_0x2acf4c['count'];var _0x4ff596=_0x56231a?0x0:_0x5e2896[_0xfe0b('0x1b')];var _0x208112=_0x56231a?_0x2acf4c['count']:_0x5e2896[_0xfe0b('0x1b')]+_0x5e2896[_0xfe0b('0x1d')];var _0x56a053;if(_0x208112>=_0x1167bb){_0x208112=_0x1167bb;_0x56a053=0xc8;}else{_0x56a053=0xce;}_0x2dc5b3[_0xfe0b('0x18')](_0x56a053);return _0x2dc5b3['set'](_0xfe0b('0x1e'),_0x4ff596+'-'+_0x208112+'/'+_0x1167bb)[_0xfe0b('0x1a')](_0x2acf4c);}return null;};}function patchUpdates(_0x47e7b6){return function(_0x46010e){try{jsonpatch['apply'](_0x46010e,_0x47e7b6,!![]);}catch(_0x572857){return BPromise[_0xfe0b('0x1f')](_0x572857);}return _0x46010e[_0xfe0b('0x20')]();};}function saveUpdates(_0x248850,_0x2ef6be){return function(_0x2a653e){if(_0x2a653e){return _0x2a653e[_0xfe0b('0x21')](_0x248850)[_0xfe0b('0x22')](function(_0x5e9a7c){return _0x5e9a7c;});}return null;};}function removeEntity(_0x19e1cd,_0xdc4e3d){return function(_0x571f9b){if(_0x571f9b){return _0x571f9b['destroy']()[_0xfe0b('0x22')](function(){_0x19e1cd[_0xfe0b('0x18')](0xcc)[_0xfe0b('0x19')]();});}};}function handleEntityNotFound(_0x137028,_0x4bb809){return function(_0x19e7c8){if(!_0x19e7c8){_0x137028[_0xfe0b('0x23')](0x194);}return _0x19e7c8;};}function handleError(_0x5bf8a5,_0x9c993){_0x9c993=_0x9c993||0x1f4;return function(_0x2ebaa5){logger[_0xfe0b('0x24')](_0x2ebaa5['stack']);if(_0x2ebaa5[_0xfe0b('0x25')]){delete _0x2ebaa5['name'];}_0x5bf8a5[_0xfe0b('0x18')](_0x9c993)['send'](_0x2ebaa5);};}exports[_0xfe0b('0x26')]=function(_0x45b1a5,_0x379331){var _0x1d0200={},_0x2e0281={},_0x1ec08d={'count':0x0,'rows':[]};var _0x2e3db5=_[_0xfe0b('0x27')](db[_0xfe0b('0x28')][_0xfe0b('0x29')],function(_0x54ee5e){return{'name':_0x54ee5e[_0xfe0b('0x2a')],'type':_0x54ee5e['type']['key']};});_0x2e0281[_0xfe0b('0x2b')]=_[_0xfe0b('0x27')](_0x2e3db5,_0xfe0b('0x25'));_0x2e0281[_0xfe0b('0x2c')]=_['keys'](_0x45b1a5[_0xfe0b('0x2c')]);_0x2e0281['filters']=_[_0xfe0b('0x2d')](_0x2e0281[_0xfe0b('0x2b')],_0x2e0281['query']);_0x1d0200[_0xfe0b('0x2e')]=_[_0xfe0b('0x2d')](_0x2e0281[_0xfe0b('0x2b')],qs[_0xfe0b('0x2f')](_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x2f')]));_0x1d0200[_0xfe0b('0x2e')]=_0x1d0200[_0xfe0b('0x2e')][_0xfe0b('0x30')]?_0x1d0200['attributes']:_0x2e0281[_0xfe0b('0x2b')];if(!_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x31')](_0xfe0b('0x32'))){_0x1d0200['limit']=qs[_0xfe0b('0x1d')](_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x1d')]);_0x1d0200['offset']=qs[_0xfe0b('0x1b')](_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x1b')]);}_0x1d0200[_0xfe0b('0x33')]=qs[_0xfe0b('0x34')](_0x45b1a5['query'][_0xfe0b('0x34')]);_0x1d0200[_0xfe0b('0x35')]=qs[_0xfe0b('0x36')](_[_0xfe0b('0x37')](_0x45b1a5[_0xfe0b('0x2c')],_0x2e0281[_0xfe0b('0x36')]),_0x2e3db5);if(_0x45b1a5[_0xfe0b('0x2c')]['filter']){_0x1d0200[_0xfe0b('0x35')]=_['merge'](_0x1d0200[_0xfe0b('0x35')],{'$or':_[_0xfe0b('0x27')](_0x2e3db5,function(_0x2db5e6){if(_0x2db5e6[_0xfe0b('0x38')]!==_0xfe0b('0x39')){var _0x1d3b2a={};_0x1d3b2a[_0x2db5e6[_0xfe0b('0x25')]]={'$like':'%'+_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x3a')]+'%'};return _0x1d3b2a;}})});}_0x1d0200=_[_0xfe0b('0x3b')]({},_0x1d0200,_0x45b1a5[_0xfe0b('0x3c')]);var _0x41d247={'where':_0x1d0200[_0xfe0b('0x35')]};return db[_0xfe0b('0x28')][_0xfe0b('0x3d')](_0x41d247)[_0xfe0b('0x22')](function(_0x4d6476){_0x1ec08d[_0xfe0b('0x3d')]=_0x4d6476;if(_0x45b1a5[_0xfe0b('0x2c')][_0xfe0b('0x3e')]){_0x1d0200[_0xfe0b('0x3f')]=[{'all':!![]}];}return db[_0xfe0b('0x28')][_0xfe0b('0x40')](_0x1d0200);})[_0xfe0b('0x22')](function(_0x4f3361){_0x1ec08d[_0xfe0b('0x41')]=_0x4f3361;return _0x1ec08d;})[_0xfe0b('0x22')](respondWithFilteredResult(_0x379331,_0x1d0200))[_0xfe0b('0x42')](handleError(_0x379331,null));};exports[_0xfe0b('0x43')]=function(_0x3b571c,_0x2b0181){var _0x4ed893={'raw':!![],'where':{'id':_0x3b571c[_0xfe0b('0x44')]['id']}},_0x11424b={};_0x11424b['model']=_[_0xfe0b('0x45')](db[_0xfe0b('0x28')]['rawAttributes']);_0x11424b[_0xfe0b('0x2c')]=_[_0xfe0b('0x45')](_0x3b571c['query']);_0x11424b[_0xfe0b('0x36')]=_[_0xfe0b('0x2d')](_0x11424b['model'],_0x11424b[_0xfe0b('0x2c')]);_0x4ed893['attributes']=_['intersection'](_0x11424b['model'],qs['fields'](_0x3b571c[_0xfe0b('0x2c')][_0xfe0b('0x2f')]));_0x4ed893[_0xfe0b('0x2e')]=_0x4ed893[_0xfe0b('0x2e')]['length']?_0x4ed893[_0xfe0b('0x2e')]:_0x11424b[_0xfe0b('0x2b')];if(_0x3b571c['query'][_0xfe0b('0x3e')]){_0x4ed893['include']=[{'all':!![]}];}_0x4ed893=_[_0xfe0b('0x3b')]({},_0x4ed893,_0x3b571c['options']);return db[_0xfe0b('0x28')]['find'](_0x4ed893)[_0xfe0b('0x22')](handleEntityNotFound(_0x2b0181,null))['then'](respondWithResult(_0x2b0181,null))[_0xfe0b('0x42')](handleError(_0x2b0181,null));};exports[_0xfe0b('0x46')]=function(_0x1b12a7,_0x404713){return db[_0xfe0b('0x28')]['create'](_0x1b12a7[_0xfe0b('0x47')],{})[_0xfe0b('0x22')](respondWithResult(_0x404713,0xc9))[_0xfe0b('0x42')](handleError(_0x404713,null));};exports[_0xfe0b('0x21')]=function(_0x2aa1d8,_0x12a657){if(_0x2aa1d8['body']['id']){delete _0x2aa1d8[_0xfe0b('0x47')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x2aa1d8[_0xfe0b('0x44')]['id']}})[_0xfe0b('0x22')](handleEntityNotFound(_0x12a657,null))[_0xfe0b('0x22')](saveUpdates(_0x2aa1d8[_0xfe0b('0x47')],null))[_0xfe0b('0x22')](respondWithResult(_0x12a657,null))[_0xfe0b('0x42')](handleError(_0x12a657,null));};exports[_0xfe0b('0x48')]=function(_0x102977,_0x165885){return db['FaxApplication'][_0xfe0b('0x49')]({'where':{'id':_0x102977[_0xfe0b('0x44')]['id']}})[_0xfe0b('0x22')](handleEntityNotFound(_0x165885,null))[_0xfe0b('0x22')](removeEntity(_0x165885,null))['catch'](handleError(_0x165885,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 75b5388..fe6f031 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 _0x61f6=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x56c78f,_0x541845){var _0x143dbe=function(_0x55134b){while(--_0x55134b){_0x56c78f['push'](_0x56c78f['shift']());}};_0x143dbe(++_0x541845);}(_0x61f6,0x151));var _0x661f=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x61f6[_0xf72786];return _0x113f3e;};'use strict';var _=require(_0x661f('0x0'));var util=require('util');var logger=require(_0x661f('0x1'))(_0x661f('0x2'));var moment=require(_0x661f('0x3'));var BPromise=require(_0x661f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x661f('0x5'));var rimraf=require('rimraf');var config=require(_0x661f('0x6'));var attributes=require(_0x661f('0x7'));module[_0x661f('0x8')]=function(_0x293153,_0x50ba3d){return _0x293153[_0x661f('0x9')](_0x661f('0xa'),attributes,{'tableName':_0x661f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x661f('0xc'),'collate':_0x661f('0xd')});}; \ No newline at end of file +var _0xc065=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc065,0x180));var _0x5c06=function(_0xf26547,_0x17824f){_0xf26547=_0xf26547-0x0;var _0x2c68e3=_0xc065[_0xf26547];return _0x2c68e3;};'use strict';var _=require('lodash');var util=require(_0x5c06('0x0'));var logger=require(_0x5c06('0x1'))(_0x5c06('0x2'));var moment=require(_0x5c06('0x3'));var BPromise=require(_0x5c06('0x4'));var rp=require(_0x5c06('0x5'));var fs=require('fs');var path=require(_0x5c06('0x6'));var rimraf=require('rimraf');var config=require(_0x5c06('0x7'));var attributes=require(_0x5c06('0x8'));module[_0x5c06('0x9')]=function(_0x38a110,_0x469d31){return _0x38a110[_0x5c06('0xa')](_0x5c06('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5c06('0xc'),'collate':_0x5c06('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0adaf3f..10fd436 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 _0x1a1c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','util'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x399cb5,_0x3f7202){_0x399cb5=_0x399cb5-0x0;var _0x57ec09=_0x1a1c[_0x399cb5];return _0x57ec09;};'use strict';var _=require(_0xc1a1('0x0'));var util=require(_0xc1a1('0x1'));var moment=require(_0xc1a1('0x2'));var BPromise=require(_0xc1a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1a1('0x4'));var db=require(_0xc1a1('0x5'))['db'];var utils=require(_0xc1a1('0x6'));var logger=require(_0xc1a1('0x7'))(_0xc1a1('0x8'));var config=require(_0xc1a1('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc1a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x161761,_0xca636,_0x576214){return new BPromise(function(_0x41ce8a,_0x126025){return client[_0xc1a1('0xb')](_0x161761,_0x576214)['then'](function(_0x416e91){logger[_0xc1a1('0xc')]('FaxApplication,\x20%s,\x20%s',_0xca636,_0xc1a1('0xd'));logger[_0xc1a1('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xca636,'request\x20sent',JSON[_0xc1a1('0xf')](_0x416e91));if(_0x416e91[_0xc1a1('0x10')]){if(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x11')]===0x1f4){logger[_0xc1a1('0x10')](_0xc1a1('0x12'),_0xca636,_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);return _0x126025(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);}logger[_0xc1a1('0x10')](_0xc1a1('0x12'),_0xca636,_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);return _0x41ce8a(_0x416e91[_0xc1a1('0x10')][_0xc1a1('0x13')]);}else{logger[_0xc1a1('0xc')](_0xc1a1('0x12'),_0xca636,_0xc1a1('0xd'));_0x41ce8a(_0x416e91[_0xc1a1('0x14')][_0xc1a1('0x13')]);}})[_0xc1a1('0x15')](function(_0x3f35a9){logger['error'](_0xc1a1('0x12'),_0xca636,_0x3f35a9);_0x126025(_0x3f35a9);});});}exports[_0xc1a1('0x16')]=function(_0x22baaf){var _0x193c83=this;return new Promise(function(_0x9653dd,_0x336bd1){return db[_0xc1a1('0x17')][_0xc1a1('0x18')](_0x22baaf[_0xc1a1('0x19')],{'raw':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1c')]||null:null,'attributes':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf[_0xc1a1('0x1a')][_0xc1a1('0x1d')]||null:null,'limit':_0x22baaf[_0xc1a1('0x1a')]?_0x22baaf['options'][_0xc1a1('0x1e')]||null:null})[_0xc1a1('0x1f')](function(_0x5ce696){logger[_0xc1a1('0xc')](_0xc1a1('0x16'),_0x22baaf);logger[_0xc1a1('0xe')](_0xc1a1('0x16'),_0x22baaf,JSON[_0xc1a1('0xf')](_0x5ce696));_0x9653dd(_0x5ce696);})[_0xc1a1('0x15')](function(_0x6bce1c){logger[_0xc1a1('0x10')](_0xc1a1('0x16'),_0x6bce1c[_0xc1a1('0x13')],_0x22baaf);_0x336bd1(_0x193c83[_0xc1a1('0x10')](0x1f4,_0x6bce1c[_0xc1a1('0x13')]));});});}; \ No newline at end of file +var _0xea4a=['FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication','update','body','options','raw','where','UpdateFaxApplication','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug'];(function(_0xb2dab9,_0x2f6f99){var _0x10c6ae=function(_0x40bd7b){while(--_0x40bd7b){_0xb2dab9['push'](_0xb2dab9['shift']());}};_0x10c6ae(++_0x2f6f99);}(_0xea4a,0x10a));var _0xaea4=function(_0x1d4e9e,_0x554638){_0x1d4e9e=_0x1d4e9e-0x0;var _0x57961d=_0xea4a[_0x1d4e9e];return _0x57961d;};'use strict';var _=require(_0xaea4('0x0'));var util=require(_0xaea4('0x1'));var moment=require(_0xaea4('0x2'));var BPromise=require('bluebird');var rs=require(_0xaea4('0x3'));var fs=require('fs');var Redis=require(_0xaea4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaea4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xaea4('0x6'));var jayson=require(_0xaea4('0x7'));var client=jayson[_0xaea4('0x8')][_0xaea4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25b822,_0x113876,_0x9423e0){return new BPromise(function(_0x51088c,_0x14917c){return client['request'](_0x25b822,_0x9423e0)[_0xaea4('0xa')](function(_0x3397d5){logger[_0xaea4('0xb')](_0xaea4('0xc'),_0x113876,'request\x20sent');logger[_0xaea4('0xd')](_0xaea4('0xe'),_0x113876,_0xaea4('0xf'),JSON[_0xaea4('0x10')](_0x3397d5));if(_0x3397d5[_0xaea4('0x11')]){if(_0x3397d5[_0xaea4('0x11')][_0xaea4('0x12')]===0x1f4){logger[_0xaea4('0x11')](_0xaea4('0xc'),_0x113876,_0x3397d5[_0xaea4('0x11')][_0xaea4('0x13')]);return _0x14917c(_0x3397d5[_0xaea4('0x11')]['message']);}logger[_0xaea4('0x11')](_0xaea4('0xc'),_0x113876,_0x3397d5['error']['message']);return _0x51088c(_0x3397d5[_0xaea4('0x11')][_0xaea4('0x13')]);}else{logger[_0xaea4('0xb')](_0xaea4('0xc'),_0x113876,_0xaea4('0xf'));_0x51088c(_0x3397d5['result'][_0xaea4('0x13')]);}})['catch'](function(_0x3dd46f){logger[_0xaea4('0x11')](_0xaea4('0xc'),_0x113876,_0x3dd46f);_0x14917c(_0x3dd46f);});});}exports['UpdateFaxApplication']=function(_0x55b45a){var _0xa3ba71=this;return new Promise(function(_0xff801d,_0x44e03c){return db[_0xaea4('0x14')][_0xaea4('0x15')](_0x55b45a[_0xaea4('0x16')],{'raw':_0x55b45a['options']?_0x55b45a[_0xaea4('0x17')][_0xaea4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55b45a[_0xaea4('0x17')]?_0x55b45a['options'][_0xaea4('0x19')]||null:null,'attributes':_0x55b45a[_0xaea4('0x17')]?_0x55b45a[_0xaea4('0x17')]['attributes']||null:null,'limit':_0x55b45a[_0xaea4('0x17')]?_0x55b45a['options']['limit']||null:null})['then'](function(_0x4fed76){logger[_0xaea4('0xb')]('UpdateFaxApplication',_0x55b45a);logger['debug'](_0xaea4('0x1a'),_0x55b45a,JSON[_0xaea4('0x10')](_0x4fed76));_0xff801d(_0x4fed76);})[_0xaea4('0x1b')](function(_0x23df55){logger['error'](_0xaea4('0x1a'),_0x23df55[_0xaea4('0x13')],_0x55b45a);_0x44e03c(_0xa3ba71[_0xaea4('0x11')](0x1f4,_0x23df55['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b0f4d02..dad38f2 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x227d36,_0x2adbc0){var _0x48cf8f=function(_0x5c16b2){while(--_0x5c16b2){_0x227d36['push'](_0x227d36['shift']());}};_0x48cf8f(++_0x2adbc0);}(_0x4024,0x89));var _0x4402=function(_0x542d66,_0x48f89a){_0x542d66=_0x542d66-0x0;var _0x5e0b13=_0x4024[_0x542d66];return _0x5e0b13;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0x6324=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x3e0053,_0x27c44a){var _0x2373ef=function(_0x2a0bcc){while(--_0x2a0bcc){_0x3e0053['push'](_0x3e0053['shift']());}};_0x2373ef(++_0x27c44a);}(_0x6324,0x142));var _0x4632=function(_0xd0baae,_0x3020f4){_0xd0baae=_0xd0baae-0x0;var _0x538549=_0x6324[_0xd0baae];return _0x538549;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./faxApplication.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0xb')]('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4632('0xe')]);router[_0x4632('0xf')](_0x4632('0x10'),auth[_0x4632('0x8')](),controller[_0x4632('0x11')]);module[_0x4632('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5ca889b..e244d0c 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 _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7b84,0x17c));var _0x47b8=function(_0x4e50ff,_0x5ed966){_0x4e50ff=_0x4e50ff-0x0;var _0x384a9f=_0x7b84[_0x4e50ff];return _0x384a9f;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file +var _0x430c=['ENUM','out','INTEGER','sequelize','DATE','STRING'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0x430c,0x1a1));var _0xc430=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x430c[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc430('0x1')]},'disposition':{'type':Sequelize[_0xc430('0x2')]},'secondDisposition':{'type':Sequelize[_0xc430('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xc430('0x3')]('in',_0xc430('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc430('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc430('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 6e5f369..6decd64 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 _0x4c38=['log','err','sendStatus','zip-dir','moment','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','catch','show','params','model','keys','query','intersection','attributes','fields','length','include','find','create','body','describe','addMessage','FaxMessage','ids','findOne','filters','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','format','options','includeAll','rows','addTags','setTags','omit','Tag','findAll','color','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4c38,0x13b));var _0x84c3=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0x4c38[_0x20025e];return _0x4a5ac4;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x84c3('0x0'));var moment=require(_0x84c3('0x1'));var BPromise=require(_0x84c3('0x2'));var util=require(_0x84c3('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x84c3('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0x84c3('0x5'));var logger=require(_0x84c3('0x6'))(_0x84c3('0x7'));var config=require(_0x84c3('0x8'));var db=require(_0x84c3('0x9'))['db'];config['redis']=_[_0x84c3('0xa')](config[_0x84c3('0xb')],{'host':_0x84c3('0xc'),'port':0x18eb});var socket=require(_0x84c3('0xd'))(new Redis(config[_0x84c3('0xb')]));require(_0x84c3('0xe'))[_0x84c3('0xf')](socket);function respondWithStatusCode(_0xe89d1,_0x46639d){_0x46639d=_0x46639d||0xcc;return function(_0x59d33b){if(_0x59d33b){return _0xe89d1['sendStatus'](_0x46639d);}return _0xe89d1[_0x84c3('0x10')](_0x46639d)[_0x84c3('0x11')]();};}function respondWithResult(_0x137578,_0x182dd9){_0x182dd9=_0x182dd9||0xc8;return function(_0x51d360){if(_0x51d360){return _0x137578[_0x84c3('0x10')](_0x182dd9)[_0x84c3('0x12')](_0x51d360);}};}function respondWithFilteredResult(_0x12ffcd,_0x4bf401){return function(_0x5acc96){if(_0x5acc96){var _0x37fe2a=typeof _0x4bf401[_0x84c3('0x13')]===_0x84c3('0x14')&&typeof _0x4bf401[_0x84c3('0x15')]===_0x84c3('0x14');var _0x1d511e=_0x5acc96[_0x84c3('0x16')];var _0x2db34a=_0x37fe2a?0x0:_0x4bf401[_0x84c3('0x13')];var _0x4db3d0=_0x37fe2a?_0x5acc96[_0x84c3('0x16')]:_0x4bf401['offset']+_0x4bf401[_0x84c3('0x15')];var _0x248778;if(_0x4db3d0>=_0x1d511e){_0x4db3d0=_0x1d511e;_0x248778=0xc8;}else{_0x248778=0xce;}_0x12ffcd[_0x84c3('0x10')](_0x248778);return _0x12ffcd[_0x84c3('0x17')](_0x84c3('0x18'),_0x2db34a+'-'+_0x4db3d0+'/'+_0x1d511e)[_0x84c3('0x12')](_0x5acc96);}return null;};}function saveUpdates(_0x51db99){return function(_0x4cdd77){if(_0x4cdd77){return _0x4cdd77[_0x84c3('0x19')](_0x51db99)['then'](function(_0x5745ad){return _0x5745ad;});}return null;};}function removeEntity(_0x2d6b7e){return function(_0x1a92ea){if(_0x1a92ea){return _0x1a92ea[_0x84c3('0x1a')]()[_0x84c3('0x1b')](function(){_0x2d6b7e[_0x84c3('0x10')](0xcc)[_0x84c3('0x11')]();});}};}function handleEntityNotFound(_0x58e44e){return function(_0x203424){if(!_0x203424){_0x58e44e['sendStatus'](0x194);}return _0x203424;};}function handleError(_0x62f551,_0x51501f){_0x51501f=_0x51501f||0x1f4;return function(_0x226ddb){logger[_0x84c3('0x1c')](_0x226ddb[_0x84c3('0x1d')]);if(_0x226ddb[_0x84c3('0x1e')]){delete _0x226ddb['name'];}_0x62f551[_0x84c3('0x10')](_0x51501f)[_0x84c3('0x1f')](_0x226ddb);};}exports[_0x84c3('0x20')]=function(_0x5245d2,_0x557624){var _0x39b5ca={};var _0x3a23c4=_['map'](db[_0x84c3('0x21')][_0x84c3('0x22')],function(_0x2241e3){return{'name':_0x2241e3['fieldName'],'type':_0x2241e3[_0x84c3('0x23')][_0x84c3('0x24')]};});_0x39b5ca=qs['getOptions'](_0x3a23c4,_0x5245d2);return interaction['findAll']('fax',_0x5245d2['query'],_0x5245d2['user'],_0x39b5ca,_0x3a23c4)[_0x84c3('0x1b')](respondWithFilteredResult(_0x557624,_0x39b5ca))[_0x84c3('0x25')](handleError(_0x557624,null));};exports[_0x84c3('0x26')]=function(_0x5d7630,_0x257980){var _0x36bb7f={'raw':![],'where':{'id':_0x5d7630[_0x84c3('0x27')]['id']}},_0x57e04d={};_0x57e04d[_0x84c3('0x28')]=_[_0x84c3('0x29')](db['FaxInteraction'][_0x84c3('0x22')]);_0x57e04d[_0x84c3('0x2a')]=_[_0x84c3('0x29')](_0x5d7630[_0x84c3('0x2a')]);_0x57e04d['filters']=_[_0x84c3('0x2b')](_0x57e04d[_0x84c3('0x28')],_0x57e04d[_0x84c3('0x2a')]);_0x36bb7f[_0x84c3('0x2c')]=_[_0x84c3('0x2b')](_0x57e04d[_0x84c3('0x28')],qs[_0x84c3('0x2d')](_0x5d7630[_0x84c3('0x2a')][_0x84c3('0x2d')]));_0x36bb7f[_0x84c3('0x2c')]=_0x36bb7f['attributes'][_0x84c3('0x2e')]?_0x36bb7f[_0x84c3('0x2c')]:_0x57e04d[_0x84c3('0x28')];if(_0x5d7630[_0x84c3('0x2a')]['includeAll']){_0x36bb7f[_0x84c3('0x2f')]=[{'all':!![]}];}_0x36bb7f=_['merge']({},_0x36bb7f,_0x5d7630['options']);return db[_0x84c3('0x21')][_0x84c3('0x30')](_0x36bb7f)['then'](handleEntityNotFound(_0x257980,null))[_0x84c3('0x1b')](respondWithResult(_0x257980,null))['catch'](handleError(_0x257980,null));};exports['create']=function(_0x42133f,_0x4cf9d3){return db[_0x84c3('0x21')][_0x84c3('0x31')](_0x42133f['body'],{})[_0x84c3('0x1b')](respondWithResult(_0x4cf9d3,0xc9))['catch'](handleError(_0x4cf9d3,null));};exports['update']=function(_0x1ba93d,_0x41b226){if(_0x1ba93d[_0x84c3('0x32')]['id']){delete _0x1ba93d[_0x84c3('0x32')]['id'];}return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x1ba93d[_0x84c3('0x27')]['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x41b226,null))[_0x84c3('0x1b')](saveUpdates(_0x1ba93d[_0x84c3('0x32')],null))[_0x84c3('0x1b')](respondWithResult(_0x41b226,null))[_0x84c3('0x25')](handleError(_0x41b226,null));};exports[_0x84c3('0x1a')]=function(_0x5c5f2b,_0x4dc0e8){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x5c5f2b[_0x84c3('0x27')]['id']}})['then'](handleEntityNotFound(_0x4dc0e8,null))['then'](removeEntity(_0x4dc0e8,null))[_0x84c3('0x25')](handleError(_0x4dc0e8,null));};exports[_0x84c3('0x33')]=function(_0x3c9d88,_0x789f7){return db[_0x84c3('0x21')][_0x84c3('0x33')]()[_0x84c3('0x1b')](respondWithResult(_0x789f7,null))[_0x84c3('0x25')](handleError(_0x789f7,null));};exports[_0x84c3('0x34')]=function(_0x188e32,_0x2f0758){return db[_0x84c3('0x35')][_0x84c3('0x30')]({'where':{'id':_0x188e32[_0x84c3('0x27')]['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x2f0758,null))['then'](function(_0x50a27b){if(_0x50a27b){return _0x50a27b[_0x84c3('0x34')](_0x188e32['body'][_0x84c3('0x36')],_['omit'](_0x188e32[_0x84c3('0x32')],[_0x84c3('0x36'),'id'])||{});}})[_0x84c3('0x1b')](respondWithResult(_0x2f0758,null))[_0x84c3('0x25')](handleError(_0x2f0758,null));};exports['getMessages']=function(_0x2f6d00,_0x23236a){var _0x497bc1={'raw':![],'where':{}};var _0x2ce0e7={};var _0x2037f5={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x84c3('0x37')]({'where':{'id':_0x2f6d00['params']['id']}})[_0x84c3('0x1b')](handleEntityNotFound(_0x23236a,null))[_0x84c3('0x1b')](function(_0x257ae4){if(_0x257ae4){_0x2ce0e7['model']=_[_0x84c3('0x29')](db['FaxMessage'][_0x84c3('0x22')]);_0x2ce0e7[_0x84c3('0x2a')]=_['keys'](_0x2f6d00['query']);_0x2ce0e7[_0x84c3('0x38')]=_[_0x84c3('0x2b')](_0x2ce0e7['model'],_0x2ce0e7[_0x84c3('0x2a')]);_0x497bc1['attributes']=_[_0x84c3('0x2b')](_0x2ce0e7[_0x84c3('0x28')],qs[_0x84c3('0x2d')](_0x2f6d00['query']['fields']));_0x497bc1[_0x84c3('0x2c')]=_0x497bc1[_0x84c3('0x2c')][_0x84c3('0x2e')]?_0x497bc1['attributes']:_0x2ce0e7[_0x84c3('0x28')];if(!_0x2f6d00[_0x84c3('0x2a')]['hasOwnProperty'](_0x84c3('0x39'))){_0x497bc1['limit']=qs[_0x84c3('0x15')](_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x15')]);_0x497bc1['offset']=qs[_0x84c3('0x13')](_0x2f6d00['query']['offset']);}_0x497bc1[_0x84c3('0x3a')]=qs[_0x84c3('0x3b')](_0x2f6d00[_0x84c3('0x2a')]['sort']);_0x497bc1[_0x84c3('0x3c')]=qs['filters'](_[_0x84c3('0x3d')](_0x2f6d00['query'],_0x2ce0e7['filters']));_0x497bc1[_0x84c3('0x3c')][_0x84c3('0x3e')]=_0x257ae4['id'];if(_0x2f6d00['query'][_0x84c3('0x3f')]){_0x497bc1[_0x84c3('0x3c')]=_[_0x84c3('0x40')](_0x497bc1[_0x84c3('0x3c')],{'$or':_[_0x84c3('0x41')](_0x497bc1[_0x84c3('0x2c')],function(_0x598111){var _0x3e4f36={};_0x3e4f36[_0x598111]={'$like':'%'+_0x2f6d00[_0x84c3('0x2a')]['filter']+'%'};return _0x3e4f36;})});}if(_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x42')]){var _0x21cfd6=_0x2f6d00[_0x84c3('0x2a')]['$gte'][_0x84c3('0x43')](',');var _0x454239={};_0x454239[_0x21cfd6[0x0]]={'$gte':moment(_0x21cfd6[0x1])[_0x84c3('0x44')]('YYYY-MM-DD\x20HH:mm:ss')};_0x497bc1['where']=_[_0x84c3('0x40')](_0x497bc1[_0x84c3('0x3c')],_0x454239);}_0x497bc1=_[_0x84c3('0x40')]({},_0x497bc1,_0x2f6d00[_0x84c3('0x45')]);return db['FaxMessage'][_0x84c3('0x16')]({'where':_0x497bc1['where']})[_0x84c3('0x1b')](function(_0xd3bc89){_0x2037f5[_0x84c3('0x16')]=_0xd3bc89;if(_0x2f6d00[_0x84c3('0x2a')][_0x84c3('0x46')]){_0x497bc1[_0x84c3('0x2f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x497bc1);})[_0x84c3('0x1b')](function(_0x564ee0){_0x2037f5[_0x84c3('0x47')]=_0x564ee0;return _0x2037f5;});}})['then'](respondWithFilteredResult(_0x23236a,_0x497bc1))[_0x84c3('0x25')](handleError(_0x23236a,null));};exports[_0x84c3('0x48')]=function(_0xe241e3,_0x41cb11){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0xe241e3[_0x84c3('0x27')]['id']}})['then'](handleEntityNotFound(_0x41cb11,null))[_0x84c3('0x1b')](function(_0x1f9b96){if(_0x1f9b96){return _0x1f9b96[_0x84c3('0x49')](_0xe241e3['body']['ids'],_[_0x84c3('0x4a')](_0xe241e3[_0x84c3('0x32')],['ids','id'])||{})['spread'](function(){return db[_0x84c3('0x4b')][_0x84c3('0x4c')]({'attributes':['id',_0x84c3('0x1e'),_0x84c3('0x4d')],'where':{'id':_0xe241e3[_0x84c3('0x32')][_0x84c3('0x36')]}});})[_0x84c3('0x1b')](function(_0x35c187){socket[_0x84c3('0x4e')](_0x84c3('0x4f'),{'id':Number(_0xe241e3[_0x84c3('0x27')]['id']),'tags':_0x35c187||[]});return{'id':Number(_0xe241e3['params']['id']),'tags':_0x35c187||[]};});}})[_0x84c3('0x1b')](respondWithResult(_0x41cb11,null))[_0x84c3('0x25')](handleError(_0x41cb11,null));};exports[_0x84c3('0x50')]=function(_0x2eb148,_0x238643){return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x2eb148['params']['id']}})['then'](handleEntityNotFound(_0x238643,null))[_0x84c3('0x1b')](function(_0x2fa5e2){if(_0x2fa5e2){return _0x2fa5e2[_0x84c3('0x50')](_0x2eb148[_0x84c3('0x2a')][_0x84c3('0x36')]);}})[_0x84c3('0x1b')](respondWithStatusCode(_0x238643,null))[_0x84c3('0x25')](handleError(_0x238643,null));};exports['download']=function(_0x3390db,_0x33e447){var _0x5fd841=moment()['unix']()[_0x84c3('0x51')]();var _0x33d882=path[_0x84c3('0x52')](config[_0x84c3('0x53')],_0x84c3('0x54'),'files','tmp');var _0x1e755f=path['join'](config['root'],'server',_0x84c3('0x55'),_0x84c3('0x56'));var _0x48e12f=path[_0x84c3('0x52')](_0x33d882,_0x5fd841);var _0x1d1ff0=util[_0x84c3('0x44')](_0x84c3('0x57'),_0x3390db[_0x84c3('0x27')]['id'],_0x5fd841);var _0x19ce5b=path[_0x84c3('0x52')](_0x33d882,_0x1d1ff0);var _0x4621bf=[];_0x4621bf[_0x84c3('0x58')]({'model':db['Attachment'],'as':_0x84c3('0x59'),'raw':!![]});var _0x5387ec=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x84c3('0x32'),_0x84c3('0x5a')],'include':_0x4621bf}];return db[_0x84c3('0x21')][_0x84c3('0x30')]({'where':{'id':_0x3390db[_0x84c3('0x27')]['id']},'include':_0x5387ec})[_0x84c3('0x1b')](handleEntityNotFound(_0x33e447,null))[_0x84c3('0x1b')](function(_0xcc1189){if(_0xcc1189&&_0xcc1189['Messages']){var _0x462fc6=_0xcc1189[_0x84c3('0x5b')]({'plain':!![]});fs[_0x84c3('0x5c')](_0x48e12f);for(var _0x13dc16=0x0;_0x13dc16<_0x462fc6[_0x84c3('0x5d')][_0x84c3('0x2e')];_0x13dc16++){var _0x576486=_0x462fc6[_0x84c3('0x5d')][_0x13dc16]['Attachment'];if(_0x576486){var _0x37f343=path[_0x84c3('0x52')](_0x1e755f,_0x576486['basename']);if(fs[_0x84c3('0x5e')](_0x37f343)){fs[_0x84c3('0x5f')](_0x37f343)[_0x84c3('0x60')](fs[_0x84c3('0x61')](path[_0x84c3('0x52')](_0x48e12f,_0x576486[_0x84c3('0x62')])));}}}return BPromise[_0x84c3('0x63')]()['then'](function(){return new BPromise(function(_0x4dbcde,_0x4bc604){zipdir(_0x48e12f,{'saveTo':_0x19ce5b},function(_0x1c2f79,_0x3d6a2d){if(_0x1c2f79)return _0x4bc604(_0x1c2f79);return _0x4dbcde(_0x3d6a2d);});})[_0x84c3('0x1b')](function(){return new BPromise(function(_0x4d7b7a,_0x3cb3f5){rimraf(_0x48e12f,function(_0x60759d){if(_0x60759d)_0x3cb3f5(_0x60759d);return _0x4d7b7a();});});})[_0x84c3('0x1b')](function(){return _0x33e447[_0x84c3('0x64')](_0x19ce5b,_0x1d1ff0,function(_0x5e6f06){if(_0x5e6f06){console[_0x84c3('0x65')](_0x84c3('0x66'),_0x5e6f06);}else{fs['unlinkSync'](_0x19ce5b);}});});});}else{return _0x33e447[_0x84c3('0x67')](0xc8);}})[_0x84c3('0x25')](handleError(_0x33e447,null));}; \ No newline at end of file +var _0xd585=['$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','createReadStream','pipe','basename','resolve','log','err','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','update','then','destroy','error','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','catch','show','params','model','query','keys','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','filters','order','sort','where','FaxInteractionId','filter'];(function(_0x27a1e0,_0x3ff2cb){var _0x1ca624=function(_0x435802){while(--_0x435802){_0x27a1e0['push'](_0x27a1e0['shift']());}};_0x1ca624(++_0x3ff2cb);}(_0xd585,0xf3));var _0x5d58=function(_0x2c5322,_0x203341){_0x2c5322=_0x2c5322-0x0;var _0x5c19a2=_0xd585[_0x2c5322];return _0x5c19a2;};'use strict';var rimraf=require(_0x5d58('0x0'));var zipdir=require(_0x5d58('0x1'));var moment=require(_0x5d58('0x2'));var BPromise=require(_0x5d58('0x3'));var util=require('util');var path=require(_0x5d58('0x4'));var fs=require('fs');var _=require(_0x5d58('0x5'));var Redis=require(_0x5d58('0x6'));var interaction=require(_0x5d58('0x7'));var qs=require(_0x5d58('0x8'));var logger=require(_0x5d58('0x9'))('api');var config=require('../../config/environment');var db=require(_0x5d58('0xa'))['db'];config['redis']=_[_0x5d58('0xb')](config[_0x5d58('0xc')],{'host':_0x5d58('0xd'),'port':0x18eb});var socket=require(_0x5d58('0xe'))(new Redis(config[_0x5d58('0xc')]));require(_0x5d58('0xf'))[_0x5d58('0x10')](socket);function respondWithStatusCode(_0x5d09a2,_0x4e8e67){_0x4e8e67=_0x4e8e67||0xcc;return function(_0x1c4a0b){if(_0x1c4a0b){return _0x5d09a2[_0x5d58('0x11')](_0x4e8e67);}return _0x5d09a2['status'](_0x4e8e67)[_0x5d58('0x12')]();};}function respondWithResult(_0x54a3a2,_0x3b099d){_0x3b099d=_0x3b099d||0xc8;return function(_0x3ed781){if(_0x3ed781){return _0x54a3a2[_0x5d58('0x13')](_0x3b099d)[_0x5d58('0x14')](_0x3ed781);}};}function respondWithFilteredResult(_0x201eba,_0x4e951d){return function(_0x115e5c){if(_0x115e5c){var _0x5c1fef=typeof _0x4e951d[_0x5d58('0x15')]===_0x5d58('0x16')&&typeof _0x4e951d['limit']===_0x5d58('0x16');var _0x5ba9f1=_0x115e5c[_0x5d58('0x17')];var _0x13bd1e=_0x5c1fef?0x0:_0x4e951d['offset'];var _0x2dcb13=_0x5c1fef?_0x115e5c[_0x5d58('0x17')]:_0x4e951d[_0x5d58('0x15')]+_0x4e951d[_0x5d58('0x18')];var _0x5b9403;if(_0x2dcb13>=_0x5ba9f1){_0x2dcb13=_0x5ba9f1;_0x5b9403=0xc8;}else{_0x5b9403=0xce;}_0x201eba['status'](_0x5b9403);return _0x201eba[_0x5d58('0x19')]('Content-Range',_0x13bd1e+'-'+_0x2dcb13+'/'+_0x5ba9f1)['json'](_0x115e5c);}return null;};}function saveUpdates(_0x2758d1){return function(_0x3d769b){if(_0x3d769b){return _0x3d769b[_0x5d58('0x1a')](_0x2758d1)[_0x5d58('0x1b')](function(_0x3b5f4e){return _0x3b5f4e;});}return null;};}function removeEntity(_0x2c7ed3){return function(_0x16a222){if(_0x16a222){return _0x16a222[_0x5d58('0x1c')]()[_0x5d58('0x1b')](function(){_0x2c7ed3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cddd2){return function(_0x4b82d7){if(!_0x4b82d7){_0x4cddd2['sendStatus'](0x194);}return _0x4b82d7;};}function handleError(_0x12e47f,_0x39cd76){_0x39cd76=_0x39cd76||0x1f4;return function(_0x4e509b){logger[_0x5d58('0x1d')](_0x4e509b['stack']);if(_0x4e509b[_0x5d58('0x1e')]){delete _0x4e509b[_0x5d58('0x1e')];}_0x12e47f[_0x5d58('0x13')](_0x39cd76)[_0x5d58('0x1f')](_0x4e509b);};}exports[_0x5d58('0x20')]=function(_0x30b7ae,_0x511af5){var _0x9b8a2f={};var _0x13c798=_[_0x5d58('0x21')](db[_0x5d58('0x22')][_0x5d58('0x23')],function(_0x17823e){return{'name':_0x17823e[_0x5d58('0x24')],'type':_0x17823e[_0x5d58('0x25')][_0x5d58('0x26')]};});_0x9b8a2f=qs[_0x5d58('0x27')](_0x13c798,_0x30b7ae);return interaction['findAll'](_0x5d58('0x28'),_0x30b7ae['query'],_0x30b7ae['user'],_0x9b8a2f,_0x13c798)[_0x5d58('0x1b')](respondWithFilteredResult(_0x511af5,_0x9b8a2f))[_0x5d58('0x29')](handleError(_0x511af5,null));};exports[_0x5d58('0x2a')]=function(_0x2ef4eb,_0x3db686){var _0x5addec={'raw':![],'where':{'id':_0x2ef4eb[_0x5d58('0x2b')]['id']}},_0x1f9c7e={};_0x1f9c7e[_0x5d58('0x2c')]=_['keys'](db[_0x5d58('0x22')][_0x5d58('0x23')]);_0x1f9c7e[_0x5d58('0x2d')]=_[_0x5d58('0x2e')](_0x2ef4eb['query']);_0x1f9c7e['filters']=_[_0x5d58('0x2f')](_0x1f9c7e['model'],_0x1f9c7e[_0x5d58('0x2d')]);_0x5addec[_0x5d58('0x30')]=_[_0x5d58('0x2f')](_0x1f9c7e['model'],qs[_0x5d58('0x31')](_0x2ef4eb[_0x5d58('0x2d')][_0x5d58('0x31')]));_0x5addec[_0x5d58('0x30')]=_0x5addec[_0x5d58('0x30')][_0x5d58('0x32')]?_0x5addec[_0x5d58('0x30')]:_0x1f9c7e[_0x5d58('0x2c')];if(_0x2ef4eb[_0x5d58('0x2d')]['includeAll']){_0x5addec[_0x5d58('0x33')]=[{'all':!![]}];}_0x5addec=_[_0x5d58('0x34')]({},_0x5addec,_0x2ef4eb[_0x5d58('0x35')]);return db[_0x5d58('0x22')][_0x5d58('0x36')](_0x5addec)['then'](handleEntityNotFound(_0x3db686,null))[_0x5d58('0x1b')](respondWithResult(_0x3db686,null))[_0x5d58('0x29')](handleError(_0x3db686,null));};exports['create']=function(_0x2ed127,_0xa92194){return db[_0x5d58('0x22')][_0x5d58('0x37')](_0x2ed127[_0x5d58('0x38')],{})[_0x5d58('0x1b')](respondWithResult(_0xa92194,0xc9))['catch'](handleError(_0xa92194,null));};exports['update']=function(_0x343d7d,_0x125714){if(_0x343d7d[_0x5d58('0x38')]['id']){delete _0x343d7d[_0x5d58('0x38')]['id'];}return db[_0x5d58('0x22')][_0x5d58('0x36')]({'where':{'id':_0x343d7d['params']['id']}})[_0x5d58('0x1b')](handleEntityNotFound(_0x125714,null))['then'](saveUpdates(_0x343d7d[_0x5d58('0x38')],null))['then'](respondWithResult(_0x125714,null))['catch'](handleError(_0x125714,null));};exports[_0x5d58('0x1c')]=function(_0x1ea214,_0x175c46){return db[_0x5d58('0x22')][_0x5d58('0x36')]({'where':{'id':_0x1ea214[_0x5d58('0x2b')]['id']}})['then'](handleEntityNotFound(_0x175c46,null))[_0x5d58('0x1b')](removeEntity(_0x175c46,null))[_0x5d58('0x29')](handleError(_0x175c46,null));};exports[_0x5d58('0x39')]=function(_0x2cbd8d,_0x406faf){return db[_0x5d58('0x22')][_0x5d58('0x39')]()[_0x5d58('0x1b')](respondWithResult(_0x406faf,null))['catch'](handleError(_0x406faf,null));};exports[_0x5d58('0x3a')]=function(_0xbde261,_0x373e56){return db[_0x5d58('0x3b')][_0x5d58('0x36')]({'where':{'id':_0xbde261['params']['id']}})[_0x5d58('0x1b')](handleEntityNotFound(_0x373e56,null))['then'](function(_0x80688b){if(_0x80688b){return _0x80688b[_0x5d58('0x3a')](_0xbde261[_0x5d58('0x38')][_0x5d58('0x3c')],_[_0x5d58('0x3d')](_0xbde261[_0x5d58('0x38')],[_0x5d58('0x3c'),'id'])||{});}})[_0x5d58('0x1b')](respondWithResult(_0x373e56,null))[_0x5d58('0x29')](handleError(_0x373e56,null));};exports['getMessages']=function(_0x47bba9,_0x2a17d4){var _0x2d86c0={'raw':![],'where':{}};var _0x17a51e={};var _0x4386f2={'count':0x0,'rows':[]};return db[_0x5d58('0x22')][_0x5d58('0x3e')]({'where':{'id':_0x47bba9[_0x5d58('0x2b')]['id']}})[_0x5d58('0x1b')](handleEntityNotFound(_0x2a17d4,null))[_0x5d58('0x1b')](function(_0x399375){if(_0x399375){_0x17a51e['model']=_['keys'](db[_0x5d58('0x3b')][_0x5d58('0x23')]);_0x17a51e['query']=_[_0x5d58('0x2e')](_0x47bba9['query']);_0x17a51e[_0x5d58('0x3f')]=_[_0x5d58('0x2f')](_0x17a51e[_0x5d58('0x2c')],_0x17a51e[_0x5d58('0x2d')]);_0x2d86c0[_0x5d58('0x30')]=_[_0x5d58('0x2f')](_0x17a51e[_0x5d58('0x2c')],qs['fields'](_0x47bba9['query'][_0x5d58('0x31')]));_0x2d86c0[_0x5d58('0x30')]=_0x2d86c0[_0x5d58('0x30')][_0x5d58('0x32')]?_0x2d86c0[_0x5d58('0x30')]:_0x17a51e[_0x5d58('0x2c')];if(!_0x47bba9[_0x5d58('0x2d')]['hasOwnProperty']('nolimit')){_0x2d86c0['limit']=qs['limit'](_0x47bba9['query']['limit']);_0x2d86c0[_0x5d58('0x15')]=qs['offset'](_0x47bba9[_0x5d58('0x2d')][_0x5d58('0x15')]);}_0x2d86c0[_0x5d58('0x40')]=qs[_0x5d58('0x41')](_0x47bba9[_0x5d58('0x2d')][_0x5d58('0x41')]);_0x2d86c0['where']=qs['filters'](_['pick'](_0x47bba9[_0x5d58('0x2d')],_0x17a51e['filters']));_0x2d86c0[_0x5d58('0x42')][_0x5d58('0x43')]=_0x399375['id'];if(_0x47bba9[_0x5d58('0x2d')][_0x5d58('0x44')]){_0x2d86c0['where']=_[_0x5d58('0x34')](_0x2d86c0[_0x5d58('0x42')],{'$or':_[_0x5d58('0x21')](_0x2d86c0[_0x5d58('0x30')],function(_0x13c5bc){var _0x524663={};_0x524663[_0x13c5bc]={'$like':'%'+_0x47bba9[_0x5d58('0x2d')][_0x5d58('0x44')]+'%'};return _0x524663;})});}if(_0x47bba9[_0x5d58('0x2d')][_0x5d58('0x45')]){var _0x105897=_0x47bba9['query'][_0x5d58('0x45')]['split'](',');var _0x319cf9={};_0x319cf9[_0x105897[0x0]]={'$gte':moment(_0x105897[0x1])[_0x5d58('0x46')](_0x5d58('0x47'))};_0x2d86c0['where']=_[_0x5d58('0x34')](_0x2d86c0[_0x5d58('0x42')],_0x319cf9);}_0x2d86c0=_[_0x5d58('0x34')]({},_0x2d86c0,_0x47bba9[_0x5d58('0x35')]);return db['FaxMessage'][_0x5d58('0x17')]({'where':_0x2d86c0[_0x5d58('0x42')]})[_0x5d58('0x1b')](function(_0x41047f){_0x4386f2['count']=_0x41047f;if(_0x47bba9['query'][_0x5d58('0x48')]){_0x2d86c0[_0x5d58('0x33')]=[{'all':!![]}];}return db[_0x5d58('0x3b')][_0x5d58('0x49')](_0x2d86c0);})[_0x5d58('0x1b')](function(_0x5cb873){_0x4386f2[_0x5d58('0x4a')]=_0x5cb873;return _0x4386f2;});}})[_0x5d58('0x1b')](respondWithFilteredResult(_0x2a17d4,_0x2d86c0))[_0x5d58('0x29')](handleError(_0x2a17d4,null));};exports[_0x5d58('0x4b')]=function(_0x5d9a49,_0x4f22aa){return db[_0x5d58('0x22')][_0x5d58('0x36')]({'where':{'id':_0x5d9a49[_0x5d58('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4f22aa,null))[_0x5d58('0x1b')](function(_0x2c59f3){if(_0x2c59f3){return _0x2c59f3[_0x5d58('0x4c')](_0x5d9a49[_0x5d58('0x38')][_0x5d58('0x3c')],_[_0x5d58('0x3d')](_0x5d9a49[_0x5d58('0x38')],[_0x5d58('0x3c'),'id'])||{})[_0x5d58('0x4d')](function(){return db[_0x5d58('0x4e')][_0x5d58('0x49')]({'attributes':['id',_0x5d58('0x1e'),_0x5d58('0x4f')],'where':{'id':_0x5d9a49['body'][_0x5d58('0x3c')]}});})[_0x5d58('0x1b')](function(_0x45ca9c){socket[_0x5d58('0x50')](_0x5d58('0x51'),{'id':Number(_0x5d9a49[_0x5d58('0x2b')]['id']),'tags':_0x45ca9c||[]});return{'id':Number(_0x5d9a49[_0x5d58('0x2b')]['id']),'tags':_0x45ca9c||[]};});}})[_0x5d58('0x1b')](respondWithResult(_0x4f22aa,null))[_0x5d58('0x29')](handleError(_0x4f22aa,null));};exports[_0x5d58('0x52')]=function(_0x59181b,_0xb8440c){return db[_0x5d58('0x22')][_0x5d58('0x36')]({'where':{'id':_0x59181b[_0x5d58('0x2b')]['id']}})[_0x5d58('0x1b')](handleEntityNotFound(_0xb8440c,null))[_0x5d58('0x1b')](function(_0x13ece5){if(_0x13ece5){return _0x13ece5[_0x5d58('0x52')](_0x59181b[_0x5d58('0x2d')][_0x5d58('0x3c')]);}})[_0x5d58('0x1b')](respondWithStatusCode(_0xb8440c,null))[_0x5d58('0x29')](handleError(_0xb8440c,null));};exports[_0x5d58('0x53')]=function(_0x5a12c2,_0x4e6d7f){var _0x398f5c=moment()[_0x5d58('0x54')]()[_0x5d58('0x55')]();var _0x5cddee=path[_0x5d58('0x56')](config[_0x5d58('0x57')],_0x5d58('0x58'),_0x5d58('0x59'),_0x5d58('0x5a'));var _0x11b760=path['join'](config[_0x5d58('0x57')],_0x5d58('0x58'),_0x5d58('0x59'),_0x5d58('0x5b'));var _0x22d910=path['join'](_0x5cddee,_0x398f5c);var _0x3775e7=util[_0x5d58('0x46')](_0x5d58('0x5c'),_0x5a12c2[_0x5d58('0x2b')]['id'],_0x398f5c);var _0x5c0fc7=path[_0x5d58('0x56')](_0x5cddee,_0x3775e7);var _0x32854e=[];_0x32854e[_0x5d58('0x5d')]({'model':db[_0x5d58('0x5e')],'as':'Attachment','raw':!![]});var _0x4161df=[{'model':db['FaxMessage'],'as':_0x5d58('0x5f'),'attributes':['id',_0x5d58('0x38'),_0x5d58('0x60')],'include':_0x32854e}];return db[_0x5d58('0x22')][_0x5d58('0x36')]({'where':{'id':_0x5a12c2[_0x5d58('0x2b')]['id']},'include':_0x4161df})[_0x5d58('0x1b')](handleEntityNotFound(_0x4e6d7f,null))[_0x5d58('0x1b')](function(_0x516ed3){if(_0x516ed3&&_0x516ed3[_0x5d58('0x5f')]){var _0x1eda17=_0x516ed3[_0x5d58('0x61')]({'plain':!![]});fs['mkdirSync'](_0x22d910);for(var _0x26c2c7=0x0;_0x26c2c7<_0x1eda17[_0x5d58('0x5f')]['length'];_0x26c2c7++){var _0x3956d3=_0x1eda17[_0x5d58('0x5f')][_0x26c2c7]['Attachment'];if(_0x3956d3){var _0x12019c=path[_0x5d58('0x56')](_0x11b760,_0x3956d3['basename']);if(fs['existsSync'](_0x12019c)){fs[_0x5d58('0x62')](_0x12019c)[_0x5d58('0x63')](fs['createWriteStream'](path[_0x5d58('0x56')](_0x22d910,_0x3956d3[_0x5d58('0x64')])));}}}return BPromise[_0x5d58('0x65')]()[_0x5d58('0x1b')](function(){return new BPromise(function(_0x226729,_0x599a2b){zipdir(_0x22d910,{'saveTo':_0x5c0fc7},function(_0x322b2c,_0x27134f){if(_0x322b2c)return _0x599a2b(_0x322b2c);return _0x226729(_0x27134f);});})[_0x5d58('0x1b')](function(){return new BPromise(function(_0x1f2c79,_0x2021ee){rimraf(_0x22d910,function(_0x526058){if(_0x526058)_0x2021ee(_0x526058);return _0x1f2c79();});});})['then'](function(){return _0x4e6d7f['download'](_0x5c0fc7,_0x3775e7,function(_0x6fbd20){if(_0x6fbd20){console[_0x5d58('0x66')](_0x5d58('0x67'),_0x6fbd20);}else{fs['unlinkSync'](_0x5c0fc7);}});});});}else{return _0x4e6d7f[_0x5d58('0x11')](0xc8);}})[_0x5d58('0x29')](handleError(_0x4e6d7f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 7b043c3..9be471f 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 _0x2416=['events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','exports'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0x2416,0xdd));var _0x6241=function(_0x1c10a6,_0x31caac){_0x1c10a6=_0x1c10a6-0x0;var _0x59b95c=_0x2416[_0x1c10a6];return _0x59b95c;};'use strict';var EventEmitter=require(_0x6241('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x6241('0x1')];var FaxMessage=require(_0x6241('0x2'))['db'][_0x6241('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6241('0x4')](0x0);var events={'afterCreate':_0x6241('0x5'),'afterUpdate':_0x6241('0x6'),'afterDestroy':_0x6241('0x7')};function emitEvent(_0x914da9){return function(_0x934053,_0x458872,_0x402049){_0x934053[_0x6241('0x8')]({'attributes':['id'],'raw':!![]})[_0x6241('0x9')](function(_0x41c3f6){_0x934053[_0x6241('0xa')](_0x6241('0xb'),_0x41c3f6['map'](function(_0x302e85){return{'id':_0x302e85['id']};}));return FaxMessage[_0x6241('0xc')]({'where':{'FaxInteractionId':_0x934053['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6241('0x9')](function(_0xcfe6d2){_0x934053['setDataValue']('unreadMessages',_0xcfe6d2[_0x6241('0xd')]);FaxInteractionEvents[_0x6241('0xe')](_0x914da9+':'+_0x934053['id'],_0x934053);FaxInteractionEvents[_0x6241('0xe')](_0x914da9,_0x934053);_0x402049(null);})['catch'](_0x402049(null));};}for(var e in events){if(events[_0x6241('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6241('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x4d9b=['length','emit','catch','hasOwnProperty','exports','events','FaxInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','Users','map','unreadMessages'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x4d9b,0x165));var _0xb4d9=function(_0x1a4861,_0x510d80){_0x1a4861=_0x1a4861-0x0;var _0x55c004=_0x4d9b[_0x1a4861];return _0x55c004;};'use strict';var EventEmitter=require(_0xb4d9('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb4d9('0x1')];var FaxMessage=require(_0xb4d9('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb4d9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4d9('0x4'),'afterDestroy':_0xb4d9('0x5')};function emitEvent(_0x381925){return function(_0x300d37,_0x4fb2ae,_0xabeb6f){_0x300d37[_0xb4d9('0x6')]({'attributes':['id'],'raw':!![]})[_0xb4d9('0x7')](function(_0x4e058b){_0x300d37['setDataValue'](_0xb4d9('0x8'),_0x4e058b[_0xb4d9('0x9')](function(_0x4e216b){return{'id':_0x4e216b['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x300d37['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4a262d){_0x300d37['setDataValue'](_0xb4d9('0xa'),_0x4a262d[_0xb4d9('0xb')]);FaxInteractionEvents[_0xb4d9('0xc')](_0x381925+':'+_0x300d37['id'],_0x300d37);FaxInteractionEvents[_0xb4d9('0xc')](_0x381925,_0x300d37);_0xabeb6f(null);})[_0xb4d9('0xd')](_0xabeb6f(null));};}for(var e in events){if(events[_0xb4d9('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb4d9('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index d3c029f..eb990c0 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 _0x3d3d=['path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','format','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2a9212,_0x25b0b6){var _0xefda72=function(_0x7b6286){while(--_0x7b6286){_0x2a9212['push'](_0x2a9212['shift']());}};_0xefda72(++_0x25b0b6);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd3d3('0x0'));var logger=require(_0xd3d3('0x1'))('api');var moment=require(_0xd3d3('0x2'));var BPromise=require(_0xd3d3('0x3'));var rp=require(_0xd3d3('0x4'));var fs=require('fs');var path=require(_0xd3d3('0x5'));var rimraf=require(_0xd3d3('0x6'));var config=require(_0xd3d3('0x7'));var attributes=require(_0xd3d3('0x8'));module[_0xd3d3('0x9')]=function(_0x2d36ba,_0x1e9338){return _0x2d36ba['define'](_0xd3d3('0xa'),attributes,{'tableName':_0xd3d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fe58e,_0x2ed96f,_0x578050){if(_0x3fe58e[_0xd3d3('0xc')](_0xd3d3('0xd'))){_0x3fe58e[_0xd3d3('0xe')]=moment()[_0xd3d3('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x578050(null,_0x3fe58e);}}});}; \ No newline at end of file +var _0x41d0=['../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x31b7d7,_0x3de9ed){var _0x3a376e=function(_0x5d451){while(--_0x5d451){_0x31b7d7['push'](_0x31b7d7['shift']());}};_0x3a376e(++_0x3de9ed);}(_0x41d0,0x1c6));var _0x041d=function(_0x20c757,_0xf1f53b){_0x20c757=_0x20c757-0x0;var _0x2720f3=_0x41d0[_0x20c757];return _0x2720f3;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var logger=require(_0x041d('0x2'))(_0x041d('0x3'));var moment=require('moment');var BPromise=require(_0x041d('0x4'));var rp=require(_0x041d('0x5'));var fs=require('fs');var path=require(_0x041d('0x6'));var rimraf=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var attributes=require(_0x041d('0x9'));module[_0x041d('0xa')]=function(_0x14907f,_0x196419){return _0x14907f['define'](_0x041d('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xae8b94,_0x584adf,_0xd7e3b6){if(_0xae8b94[_0x041d('0xc')]('closed')){_0xae8b94['closedAt']=moment()['format'](_0x041d('0xd'));}_0xd7e3b6(null,_0xae8b94);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 019a5dc..7446334 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 _0xbd1e=['update','body','options','raw','where','limit','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction'];(function(_0x225a53,_0x591ff9){var _0x36626c=function(_0x587bc7){while(--_0x587bc7){_0x225a53['push'](_0x225a53['shift']());}};_0x36626c(++_0x591ff9);}(_0xbd1e,0x1bc));var _0xebd1=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0xbd1e[_0x587dd0];return _0x56f153;};'use strict';var _=require('lodash');var util=require(_0xebd1('0x0'));var moment=require('moment');var BPromise=require(_0xebd1('0x1'));var rs=require(_0xebd1('0x2'));var fs=require('fs');var Redis=require(_0xebd1('0x3'));var db=require(_0xebd1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xebd1('0x5'))(_0xebd1('0x6'));var config=require(_0xebd1('0x7'));var jayson=require(_0xebd1('0x8'));var client=jayson[_0xebd1('0x9')][_0xebd1('0xa')]({'port':0x232a});config[_0xebd1('0xb')]=_[_0xebd1('0xc')](config[_0xebd1('0xb')],{'host':_0xebd1('0xd'),'port':0x18eb});var socket=require(_0xebd1('0xe'))(new Redis(config[_0xebd1('0xb')]));require(_0xebd1('0xf'))[_0xebd1('0x10')](socket);function respondWithRpcPromise(_0x4f7677,_0x114e30,_0xcd9a5c){return new BPromise(function(_0x415b3d,_0x1da275){return client['request'](_0x4f7677,_0xcd9a5c)[_0xebd1('0x11')](function(_0x2ae775){logger[_0xebd1('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x114e30,_0xebd1('0x13'));logger['debug'](_0xebd1('0x14'),_0x114e30,_0xebd1('0x13'),JSON[_0xebd1('0x15')](_0x2ae775));if(_0x2ae775[_0xebd1('0x16')]){if(_0x2ae775[_0xebd1('0x16')][_0xebd1('0x17')]===0x1f4){logger['error'](_0xebd1('0x18'),_0x114e30,_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);return _0x1da275(_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);}logger[_0xebd1('0x16')](_0xebd1('0x18'),_0x114e30,_0x2ae775[_0xebd1('0x16')][_0xebd1('0x19')]);return _0x415b3d(_0x2ae775['error']['message']);}else{logger[_0xebd1('0x12')](_0xebd1('0x18'),_0x114e30,_0xebd1('0x13'));_0x415b3d(_0x2ae775[_0xebd1('0x1a')][_0xebd1('0x19')]);}})[_0xebd1('0x1b')](function(_0xa5b8a0){logger[_0xebd1('0x16')](_0xebd1('0x18'),_0x114e30,_0xa5b8a0);_0x1da275(_0xa5b8a0);});});}exports[_0xebd1('0x1c')]=function(_0x261ec3){var _0x564676=this;return new Promise(function(_0x23d486,_0x3a3776){return db['FaxInteraction'][_0xebd1('0x1d')](_0x261ec3[_0xebd1('0x1e')],{'raw':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x261ec3['options']?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x21')]||null:null,'attributes':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')]['attributes']||null:null,'limit':_0x261ec3[_0xebd1('0x1f')]?_0x261ec3[_0xebd1('0x1f')][_0xebd1('0x22')]||null:null})['then'](function(_0x3ed286){logger[_0xebd1('0x12')](_0xebd1('0x1c'),_0x261ec3);logger['debug'](_0xebd1('0x1c'),_0x261ec3,JSON[_0xebd1('0x15')](_0x3ed286));_0x23d486(_0x3ed286);})[_0xebd1('0x1b')](function(_0x34f07e){logger[_0xebd1('0x16')](_0xebd1('0x1c'),_0x34f07e[_0xebd1('0x19')],_0x261ec3);_0x3a3776(_0x564676[_0xebd1('0x16')](0x1f4,_0x34f07e['message']));});});};exports[_0xebd1('0x23')]=function(_0x1086b2){return new Promise(function(_0x1db4b4,_0x3a290c){return db[_0xebd1('0x24')]['find']({'where':_0x1086b2[_0xebd1('0x1f')]?_0x1086b2['options']['where']||null:null})[_0xebd1('0x11')](function(_0x30e5be){if(_0x30e5be){return _0x30e5be[_0xebd1('0x25')](_0x1086b2['body'][_0xebd1('0x26')],_[_0xebd1('0x27')](_0x1086b2[_0xebd1('0x1e')],[_0xebd1('0x26'),'id'])||{});}})[_0xebd1('0x28')](function(_0x2a0f71){logger[_0xebd1('0x12')](_0xebd1('0x29'),_0x1086b2);logger[_0xebd1('0x2a')](_0xebd1('0x29'),_0x1086b2,JSON[_0xebd1('0x15')](_0x2a0f71));_0x1db4b4(_0x2a0f71);})[_0xebd1('0x1b')](function(_0x5cd969){logger[_0xebd1('0x16')](_0xebd1('0x29'),_0x5cd969[_0xebd1('0x19')],_0x1086b2);_0x3a290c(_this['error'](0x1f4,_0x5cd969[_0xebd1('0x19')]));});});}; \ No newline at end of file +var _0xec21=['where','attributes','limit','stringify','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction','update','body','options'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xec21,0x199));var _0x1ec2=function(_0x722360,_0x217e4f){_0x722360=_0x722360-0x0;var _0x39590f=_0xec21[_0x722360];return _0x39590f;};'use strict';var _=require(_0x1ec2('0x0'));var util=require(_0x1ec2('0x1'));var moment=require(_0x1ec2('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ec2('0x3'));var fs=require('fs');var Redis=require(_0x1ec2('0x4'));var db=require(_0x1ec2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1ec2('0x6'));var config=require(_0x1ec2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1ec2('0x8')]({'port':0x232a});config[_0x1ec2('0x9')]=_[_0x1ec2('0xa')](config['redis'],{'host':_0x1ec2('0xb'),'port':0x18eb});var socket=require(_0x1ec2('0xc'))(new Redis(config['redis']));require(_0x1ec2('0xd'))[_0x1ec2('0xe')](socket);function respondWithRpcPromise(_0x82149f,_0x47becd,_0x526627){return new BPromise(function(_0x41f472,_0x2ee878){return client[_0x1ec2('0xf')](_0x82149f,_0x526627)[_0x1ec2('0x10')](function(_0x1042be){logger[_0x1ec2('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x47becd,_0x1ec2('0x12'));logger[_0x1ec2('0x13')](_0x1ec2('0x14'),_0x47becd,_0x1ec2('0x12'),JSON['stringify'](_0x1042be));if(_0x1042be[_0x1ec2('0x15')]){if(_0x1042be[_0x1ec2('0x15')][_0x1ec2('0x16')]===0x1f4){logger[_0x1ec2('0x15')](_0x1ec2('0x17'),_0x47becd,_0x1042be[_0x1ec2('0x15')][_0x1ec2('0x18')]);return _0x2ee878(_0x1042be['error'][_0x1ec2('0x18')]);}logger[_0x1ec2('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x47becd,_0x1042be[_0x1ec2('0x15')][_0x1ec2('0x18')]);return _0x41f472(_0x1042be[_0x1ec2('0x15')][_0x1ec2('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x47becd,_0x1ec2('0x12'));_0x41f472(_0x1042be[_0x1ec2('0x19')][_0x1ec2('0x18')]);}})[_0x1ec2('0x1a')](function(_0x55e8ea){logger['error'](_0x1ec2('0x17'),_0x47becd,_0x55e8ea);_0x2ee878(_0x55e8ea);});});}exports[_0x1ec2('0x1b')]=function(_0xa9420d){var _0x5b9e90=this;return new Promise(function(_0x39b365,_0x5471be){return db['FaxInteraction'][_0x1ec2('0x1c')](_0xa9420d[_0x1ec2('0x1d')],{'raw':_0xa9420d['options']?_0xa9420d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9420d[_0x1ec2('0x1e')]?_0xa9420d[_0x1ec2('0x1e')][_0x1ec2('0x1f')]||null:null,'attributes':_0xa9420d[_0x1ec2('0x1e')]?_0xa9420d[_0x1ec2('0x1e')][_0x1ec2('0x20')]||null:null,'limit':_0xa9420d['options']?_0xa9420d[_0x1ec2('0x1e')][_0x1ec2('0x21')]||null:null})[_0x1ec2('0x10')](function(_0x4acd8a){logger[_0x1ec2('0x11')]('UpdateFaxInteraction',_0xa9420d);logger['debug']('UpdateFaxInteraction',_0xa9420d,JSON[_0x1ec2('0x22')](_0x4acd8a));_0x39b365(_0x4acd8a);})['catch'](function(_0x556d7f){logger[_0x1ec2('0x15')](_0x1ec2('0x1b'),_0x556d7f[_0x1ec2('0x18')],_0xa9420d);_0x5471be(_0x5b9e90[_0x1ec2('0x15')](0x1f4,_0x556d7f[_0x1ec2('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x45a286){return new Promise(function(_0x459e04,_0x26344b){return db['FaxInteraction']['find']({'where':_0x45a286[_0x1ec2('0x1e')]?_0x45a286[_0x1ec2('0x1e')][_0x1ec2('0x1f')]||null:null})[_0x1ec2('0x10')](function(_0x3fe368){if(_0x3fe368){return _0x3fe368[_0x1ec2('0x23')](_0x45a286['body'][_0x1ec2('0x24')],_[_0x1ec2('0x25')](_0x45a286[_0x1ec2('0x1d')],[_0x1ec2('0x24'),'id'])||{});}})[_0x1ec2('0x26')](function(_0x161910){logger[_0x1ec2('0x11')]('AddTags',_0x45a286);logger[_0x1ec2('0x13')]('AddTags',_0x45a286,JSON[_0x1ec2('0x22')](_0x161910));_0x459e04(_0x161910);})[_0x1ec2('0x1a')](function(_0x34151d){logger[_0x1ec2('0x15')](_0x1ec2('0x27'),_0x34151d[_0x1ec2('0x18')],_0x45a286);_0x26344b(_this[_0x1ec2('0x15')](0x1f4,_0x34151d[_0x1ec2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4261076..02e4bfc 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 _0x85ed=['save','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x85ed,0x1df));var _0xd85e=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x85ed[_0x2a7b8e];return _0x29b5c8;};'use strict';var FaxInteractionEvents=require(_0xd85e('0x0'));var events=[_0xd85e('0x1'),'remove',_0xd85e('0x2')];function createListener(_0x4e7d7b,_0x26f1a5){return function(_0x3fcadf){_0x26f1a5[_0xd85e('0x3')](_0x4e7d7b,_0x3fcadf);};}function removeListener(_0x52b7b4,_0x138055){return function(){FaxInteractionEvents[_0xd85e('0x4')](_0x52b7b4,_0x138055);};}exports[_0xd85e('0x5')]=function(_0x11573a){for(var _0x55ecbb=0x0,_0x178807=events[_0xd85e('0x6')];_0x55ecbb<_0x178807;_0x55ecbb++){var _0x12122d=events[_0x55ecbb];var _0x15a5f2=createListener(_0xd85e('0x7')+_0x12122d,_0x11573a);FaxInteractionEvents['on'](_0x12122d,_0x15a5f2);}}; \ No newline at end of file +var _0x201d=['register','length','faxInteraction:','remove','emit','removeListener'];(function(_0x1a0169,_0x8d3584){var _0x37e535=function(_0x2cb860){while(--_0x2cb860){_0x1a0169['push'](_0x1a0169['shift']());}};_0x37e535(++_0x8d3584);}(_0x201d,0x111));var _0xd201=function(_0x395c34,_0x1473a7){_0x395c34=_0x395c34-0x0;var _0x627729=_0x201d[_0x395c34];return _0x627729;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xd201('0x0'),'update'];function createListener(_0x2c186a,_0xb766fc){return function(_0x4d9cc6){_0xb766fc[_0xd201('0x1')](_0x2c186a,_0x4d9cc6);};}function removeListener(_0x480516,_0x395a9b){return function(){FaxInteractionEvents[_0xd201('0x2')](_0x480516,_0x395a9b);};}exports[_0xd201('0x3')]=function(_0x1f99d3){for(var _0x3c4ca2=0x0,_0x54290d=events[_0xd201('0x4')];_0x3c4ca2<_0x54290d;_0x3c4ca2++){var _0x31c40f=events[_0x3c4ca2];var _0x420a5a=createListener(_0xd201('0x5')+_0x31c40f,_0x1f99d3);FaxInteractionEvents['on'](_0x31c40f,_0x420a5a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2b05a4c..1149e31 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 _0xe0f0=['../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:destroy','destroy','delete','/:id/tags','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xe0f0,0x9e));var _0x0e0f=function(_0x17f4c8,_0x3aa345){_0x17f4c8=_0x17f4c8-0x0;var _0x288b47=_0xe0f0[_0x17f4c8];return _0x288b47;};'use strict';var multer=require(_0x0e0f('0x0'));var util=require(_0x0e0f('0x1'));var path=require('path');var timeout=require(_0x0e0f('0x2'));var express=require(_0x0e0f('0x3'));var router=express[_0x0e0f('0x4')]();var fs_extra=require(_0x0e0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e0f('0x6'));var config=require(_0x0e0f('0x7'));var controller=require(_0x0e0f('0x8'));router['get']('/',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0xa')]);router[_0x0e0f('0xb')](_0x0e0f('0xc'),auth['isAuthenticated'](),controller[_0x0e0f('0xd')]);router[_0x0e0f('0xb')](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0xf')]);router[_0x0e0f('0xb')](_0x0e0f('0x10'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x11')]);router['get'](_0x0e0f('0x12'),auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x13')]);router[_0x0e0f('0x14')]('/',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x15')]);router['post']('/:id/messages',auth[_0x0e0f('0x9')](),controller[_0x0e0f('0x16')]);router[_0x0e0f('0x14')]('/:id/tags',auth[_0x0e0f('0x9')](),interaction['tracked'](_0x0e0f('0x17'),_0x0e0f('0x18')),controller[_0x0e0f('0x19')]);router[_0x0e0f('0x1a')](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),interaction[_0x0e0f('0x1b')](_0x0e0f('0x17'),'faxinteraction:update'),controller['update']);router['delete'](_0x0e0f('0xe'),auth[_0x0e0f('0x9')](),interaction['tracked'](_0x0e0f('0x17'),_0x0e0f('0x1c')),controller[_0x0e0f('0x1d')]);router[_0x0e0f('0x1e')](_0x0e0f('0x1f'),auth['isAuthenticated'](),controller[_0x0e0f('0x20')]);module['exports']=router; \ No newline at end of file +var _0xa1ad=['addTags','update','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','post','tracked','fax','faxinteraction:addtags'];(function(_0x2caa25,_0x5dec3c){var _0x25d386=function(_0x144f54){while(--_0x144f54){_0x2caa25['push'](_0x2caa25['shift']());}};_0x25d386(++_0x5dec3c);}(_0xa1ad,0x98));var _0xda1a=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xa1ad[_0x2e2681];return _0x368a64;};'use strict';var multer=require(_0xda1a('0x0'));var util=require('util');var path=require(_0xda1a('0x1'));var timeout=require(_0xda1a('0x2'));var express=require(_0xda1a('0x3'));var router=express[_0xda1a('0x4')]();var fs_extra=require(_0xda1a('0x5'));var auth=require(_0xda1a('0x6'));var interaction=require(_0xda1a('0x7'));var config=require(_0xda1a('0x8'));var controller=require(_0xda1a('0x9'));router[_0xda1a('0xa')]('/',auth[_0xda1a('0xb')](),controller['index']);router[_0xda1a('0xa')](_0xda1a('0xc'),auth[_0xda1a('0xb')](),controller[_0xda1a('0xd')]);router[_0xda1a('0xa')](_0xda1a('0xe'),auth[_0xda1a('0xb')](),controller[_0xda1a('0xf')]);router[_0xda1a('0xa')](_0xda1a('0x10'),auth[_0xda1a('0xb')](),controller['getMessages']);router[_0xda1a('0xa')](_0xda1a('0x11'),auth[_0xda1a('0xb')](),controller['download']);router[_0xda1a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xda1a('0x12')](_0xda1a('0x10'),auth[_0xda1a('0xb')](),controller['addMessage']);router[_0xda1a('0x12')]('/:id/tags',auth[_0xda1a('0xb')](),interaction[_0xda1a('0x13')](_0xda1a('0x14'),_0xda1a('0x15')),controller[_0xda1a('0x16')]);router['put'](_0xda1a('0xe'),auth[_0xda1a('0xb')](),interaction[_0xda1a('0x13')]('fax','faxinteraction:update'),controller[_0xda1a('0x17')]);router['delete'](_0xda1a('0xe'),auth[_0xda1a('0xb')](),interaction[_0xda1a('0x13')](_0xda1a('0x14'),'faxinteraction:destroy'),controller[_0xda1a('0x18')]);router[_0xda1a('0x19')](_0xda1a('0x1a'),auth['isAuthenticated'](),controller[_0xda1a('0x1b')]);module[_0xda1a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index fb5a44c..13b6955 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 _0x8b7c=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8b7c,0x119));var _0xc8b7=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x8b7c[_0x2bf466];return _0x856885;};'use strict';var Sequelize=require(_0xc8b7('0x0'));module[_0xc8b7('0x1')]={'body':{'type':Sequelize[_0xc8b7('0x2')](_0xc8b7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc8b7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc8b7('0x5')]('in',_0xc8b7('0x6')),'defaultValue':_0xc8b7('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xc8b7('0x7')]}}; \ No newline at end of file +var _0xdad2=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x399b91,_0x4c3278){var _0x4a39b2=function(_0x12dcdc){while(--_0x12dcdc){_0x399b91['push'](_0x399b91['shift']());}};_0x4a39b2(++_0x4c3278);}(_0xdad2,0x14c));var _0x2dad=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdad2[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x2dad('0x0')]={'body':{'type':Sequelize[_0x2dad('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2dad('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2dad('0x3')]('in',_0x2dad('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2dad('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2dad('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8d6584a..8c40433 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 _0xbedf=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','find','describe','fax-interactions','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','update','isNil','read1stAt','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','ContactId','sequelize','QueryTypes','contact','email','internal','interface','channel','motionChannel','accept','acceptmessage','reject','fax','FaxInteractionId','interaction','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','User','fullname','event','EventManager','create','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xbedf,0x164));var _0xfbed=function(_0x32ff1d,_0x3e29bb){_0x32ff1d=_0x32ff1d-0x0;var _0x50489e=_0xbedf[_0x32ff1d];return _0x50489e;};'use strict';var emlformat=require(_0xfbed('0x0'));var rimraf=require(_0xfbed('0x1'));var zipdir=require(_0xfbed('0x2'));var jsonpatch=require(_0xfbed('0x3'));var rp=require(_0xfbed('0x4'));var moment=require(_0xfbed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfbed('0x6'));var util=require(_0xfbed('0x7'));var path=require(_0xfbed('0x8'));var sox=require('sox');var csv=require(_0xfbed('0x9'));var ejs=require(_0xfbed('0xa'));var fs=require('fs');var fs_extra=require(_0xfbed('0xb'));var _=require(_0xfbed('0xc'));var squel=require('squel');var crypto=require(_0xfbed('0xd'));var jsforce=require(_0xfbed('0xe'));var deskjs=require(_0xfbed('0xf'));var toCsv=require(_0xfbed('0x9'));var querystring=require(_0xfbed('0x10'));var Papa=require(_0xfbed('0x11'));var Redis=require(_0xfbed('0x12'));var authService=require(_0xfbed('0x13'));var qs=require(_0xfbed('0x14'));var as=require(_0xfbed('0x15'));var hardwareService=require(_0xfbed('0x16'));var logger=require(_0xfbed('0x17'))(_0xfbed('0x18'));var utils=require('../../config/utils');var config=require(_0xfbed('0x19'));var licenseUtil=require(_0xfbed('0x1a'));var db=require('../../mysqldb')['db'];config[_0xfbed('0x1b')]=_['defaults'](config['redis'],{'host':_0xfbed('0x1c'),'port':0x18eb});var socket=require(_0xfbed('0x1d'))(new Redis(config[_0xfbed('0x1b')]));require(_0xfbed('0x1e'))[_0xfbed('0x1f')](socket);var jayson=require(_0xfbed('0x20'));var client=jayson[_0xfbed('0x21')][_0xfbed('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xfbed('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4e2e8b,_0x2126ef,_0x2e7733,_0x53ec63){return new BPromise(function(_0x536498,_0x272f8f){var _0x11ff12=_0x53ec63||client;return _0x11ff12['request'](_0x4e2e8b,_0x2e7733)['then'](function(_0x3efbbd){logger['info'](_0xfbed('0x23'),_0x2126ef,_0xfbed('0x24'));logger[_0xfbed('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2126ef,_0xfbed('0x24'),JSON[_0xfbed('0x26')](_0x3efbbd));if(_0x3efbbd[_0xfbed('0x27')]){if(_0x3efbbd[_0xfbed('0x27')][_0xfbed('0x28')]===0x1f4){logger[_0xfbed('0x27')]('FaxMessage,\x20%s,\x20%s',_0x2126ef,_0x3efbbd['error'][_0xfbed('0x29')]);return _0x272f8f(_0x3efbbd['error'][_0xfbed('0x29')]);}logger[_0xfbed('0x27')](_0xfbed('0x23'),_0x2126ef,_0x3efbbd['error'][_0xfbed('0x29')]);return _0x536498(_0x3efbbd[_0xfbed('0x27')][_0xfbed('0x29')]);}else{logger['info'](_0xfbed('0x23'),_0x2126ef,_0xfbed('0x24'));_0x536498(_0x3efbbd[_0xfbed('0x2a')]['message']);}})[_0xfbed('0x2b')](function(_0x1c17b2){logger[_0xfbed('0x27')](_0xfbed('0x23'),_0x2126ef,_0x1c17b2);_0x272f8f(_0x1c17b2);});});}function respondWithStatusCode(_0x3453c8,_0x3bcd14){_0x3bcd14=_0x3bcd14||0xcc;return function(_0x56b5fd){if(_0x56b5fd){return _0x3453c8[_0xfbed('0x2c')](_0x3bcd14);}return _0x3453c8['status'](_0x3bcd14)['end']();};}function respondWithResult(_0x52e06b,_0x2bd8fa){_0x2bd8fa=_0x2bd8fa||0xc8;return function(_0x574228){if(_0x574228){return _0x52e06b[_0xfbed('0x2d')](_0x2bd8fa)[_0xfbed('0x2e')](_0x574228);}};}function respondWithFilteredResult(_0x1c81ac,_0x4be3e6){return function(_0x447230){if(_0x447230){var _0x2dbb33=typeof _0x4be3e6[_0xfbed('0x2f')]==='undefined'&&typeof _0x4be3e6[_0xfbed('0x30')]==='undefined';var _0x15b0f1=_0x447230['count'];var _0x2d7e39=_0x2dbb33?0x0:_0x4be3e6[_0xfbed('0x2f')];var _0x5bfd68=_0x2dbb33?_0x447230[_0xfbed('0x31')]:_0x4be3e6[_0xfbed('0x2f')]+_0x4be3e6[_0xfbed('0x30')];var _0x357f1e;if(_0x5bfd68>=_0x15b0f1){_0x5bfd68=_0x15b0f1;_0x357f1e=0xc8;}else{_0x357f1e=0xce;}_0x1c81ac[_0xfbed('0x2d')](_0x357f1e);return _0x1c81ac[_0xfbed('0x32')](_0xfbed('0x33'),_0x2d7e39+'-'+_0x5bfd68+'/'+_0x15b0f1)['json'](_0x447230);}return null;};}function patchUpdates(_0x13b66d){return function(_0x5795d5){try{jsonpatch[_0xfbed('0x34')](_0x5795d5,_0x13b66d,!![]);}catch(_0x104b99){return BPromise['reject'](_0x104b99);}return _0x5795d5[_0xfbed('0x35')]();};}function saveUpdates(_0x36d777,_0x16d3cf){return function(_0x1dc6e3){if(_0x1dc6e3){return _0x1dc6e3['update'](_0x36d777)[_0xfbed('0x36')](function(_0x113d7f){return _0x113d7f;});}return null;};}function removeEntity(_0xce5c3d,_0x1cac36){return function(_0x4cff42){if(_0x4cff42){return _0x4cff42[_0xfbed('0x37')]()[_0xfbed('0x36')](function(){_0xce5c3d[_0xfbed('0x2d')](0xcc)[_0xfbed('0x38')]();});}};}function handleEntityNotFound(_0xf4b321,_0x4953a6){return function(_0x32321a){if(!_0x32321a){_0xf4b321[_0xfbed('0x2c')](0x194);}return _0x32321a;};}function handleError(_0x54ec00,_0x40d496){_0x40d496=_0x40d496||0x1f4;return function(_0x344b97){logger[_0xfbed('0x27')](_0x344b97[_0xfbed('0x39')]);if(_0x344b97[_0xfbed('0x3a')]){delete _0x344b97['name'];}_0x54ec00[_0xfbed('0x2d')](_0x40d496)[_0xfbed('0x3b')](_0x344b97);};}exports[_0xfbed('0x3c')]=function(_0x3111b9,_0x19195b){var _0x35ae2b={},_0x53f36d={},_0x19f1eb={'count':0x0,'rows':[]};var _0x2511e0=_[_0xfbed('0x3d')](db[_0xfbed('0x3e')][_0xfbed('0x3f')],function(_0xef2fba){return{'name':_0xef2fba[_0xfbed('0x40')],'type':_0xef2fba[_0xfbed('0x41')][_0xfbed('0x42')]};});_0x53f36d[_0xfbed('0x43')]=_[_0xfbed('0x3d')](_0x2511e0,_0xfbed('0x3a'));_0x53f36d[_0xfbed('0x44')]=_[_0xfbed('0x45')](_0x3111b9[_0xfbed('0x44')]);_0x53f36d[_0xfbed('0x46')]=_[_0xfbed('0x47')](_0x53f36d[_0xfbed('0x43')],_0x53f36d[_0xfbed('0x44')]);_0x35ae2b[_0xfbed('0x48')]=_[_0xfbed('0x47')](_0x53f36d['model'],qs[_0xfbed('0x49')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x49')]));_0x35ae2b[_0xfbed('0x48')]=_0x35ae2b[_0xfbed('0x48')][_0xfbed('0x4a')]?_0x35ae2b[_0xfbed('0x48')]:_0x53f36d[_0xfbed('0x43')];if(!_0x3111b9[_0xfbed('0x44')][_0xfbed('0x4b')]('nolimit')){_0x35ae2b[_0xfbed('0x30')]=qs[_0xfbed('0x30')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x30')]);_0x35ae2b[_0xfbed('0x2f')]=qs[_0xfbed('0x2f')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x2f')]);}_0x35ae2b[_0xfbed('0x4c')]=qs[_0xfbed('0x4d')](_0x3111b9[_0xfbed('0x44')][_0xfbed('0x4d')]);_0x35ae2b[_0xfbed('0x4e')]=qs[_0xfbed('0x46')](_[_0xfbed('0x4f')](_0x3111b9[_0xfbed('0x44')],_0x53f36d[_0xfbed('0x46')]),_0x2511e0);if(_0x3111b9[_0xfbed('0x44')][_0xfbed('0x50')]){_0x35ae2b['where']=_[_0xfbed('0x51')](_0x35ae2b['where'],{'$or':_[_0xfbed('0x3d')](_0x2511e0,function(_0x3c3437){if(_0x3c3437[_0xfbed('0x41')]!==_0xfbed('0x52')){var _0x59b470={};_0x59b470[_0x3c3437['name']]={'$like':'%'+_0x3111b9['query'][_0xfbed('0x50')]+'%'};return _0x59b470;}})});}_0x35ae2b=_[_0xfbed('0x51')]({},_0x35ae2b,_0x3111b9[_0xfbed('0x53')]);var _0x57da41={'where':_0x35ae2b[_0xfbed('0x4e')]};return db[_0xfbed('0x3e')]['count'](_0x57da41)[_0xfbed('0x36')](function(_0xe3591){_0x19f1eb['count']=_0xe3591;if(_0x3111b9['query'][_0xfbed('0x54')]){_0x35ae2b['include']=[{'all':!![]}];}return db[_0xfbed('0x3e')]['findAll'](_0x35ae2b);})['then'](function(_0x459781){_0x19f1eb[_0xfbed('0x55')]=_0x459781;return _0x19f1eb;})[_0xfbed('0x36')](respondWithFilteredResult(_0x19195b,_0x35ae2b))[_0xfbed('0x2b')](handleError(_0x19195b,null));};exports['show']=function(_0x51a07d,_0x222e1d){var _0x5dce46={'raw':!![],'where':{'id':_0x51a07d[_0xfbed('0x56')]['id']}},_0x4131df={};_0x4131df[_0xfbed('0x43')]=_[_0xfbed('0x45')](db['FaxMessage'][_0xfbed('0x3f')]);_0x4131df[_0xfbed('0x44')]=_['keys'](_0x51a07d[_0xfbed('0x44')]);_0x4131df['filters']=_[_0xfbed('0x47')](_0x4131df[_0xfbed('0x43')],_0x4131df[_0xfbed('0x44')]);_0x5dce46[_0xfbed('0x48')]=_['intersection'](_0x4131df['model'],qs[_0xfbed('0x49')](_0x51a07d[_0xfbed('0x44')]['fields']));_0x5dce46[_0xfbed('0x48')]=_0x5dce46['attributes'][_0xfbed('0x4a')]?_0x5dce46['attributes']:_0x4131df[_0xfbed('0x43')];if(_0x51a07d['query'][_0xfbed('0x54')]){_0x5dce46['include']=[{'all':!![]}];}_0x5dce46=_[_0xfbed('0x51')]({},_0x5dce46,_0x51a07d[_0xfbed('0x53')]);return db[_0xfbed('0x3e')][_0xfbed('0x57')](_0x5dce46)[_0xfbed('0x36')](handleEntityNotFound(_0x222e1d,null))[_0xfbed('0x36')](respondWithResult(_0x222e1d,null))['catch'](handleError(_0x222e1d,null));};exports['update']=function(_0xda6647,_0x2311a6){if(_0xda6647['body']['id']){delete _0xda6647['body']['id'];}return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0xda6647[_0xfbed('0x56')]['id']}})[_0xfbed('0x36')](handleEntityNotFound(_0x2311a6,null))[_0xfbed('0x36')](saveUpdates(_0xda6647['body'],null))[_0xfbed('0x36')](respondWithResult(_0x2311a6,null))[_0xfbed('0x2b')](handleError(_0x2311a6,null));};exports[_0xfbed('0x37')]=function(_0x2376e6,_0x3a7bd6){return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x2376e6['params']['id']}})[_0xfbed('0x36')](handleEntityNotFound(_0x3a7bd6,null))[_0xfbed('0x36')](removeEntity(_0x3a7bd6,null))['catch'](handleError(_0x3a7bd6,null));};exports[_0xfbed('0x58')]=function(_0x1773fa,_0xa6a1e2){return db[_0xfbed('0x3e')]['describe']()[_0xfbed('0x36')](respondWithResult(_0xa6a1e2,null))[_0xfbed('0x2b')](handleError(_0xa6a1e2,null));};var interaction_log=require(_0xfbed('0x17'))(_0xfbed('0x59'));exports['accept']=function(_0x2706d8,_0x56f112,_0x343866){var _0x27e248={'agent':{},'channel':'fax'};if(_0x2706d8[_0xfbed('0x5a')]['id']){delete _0x2706d8[_0xfbed('0x5a')]['id'];}_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5b')]=!![];_0x2706d8['body'][_0xfbed('0x5c')]=moment()[_0xfbed('0x5d')](_0xfbed('0x5e'));_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')]=_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')]||_0x2706d8[_0xfbed('0x60')]['id'];_0x27e248[_0xfbed('0x61')]['id']=_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')];return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x2706d8[_0xfbed('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x56f112,null))['then'](saveUpdates(_0x2706d8[_0xfbed('0x5a')],null))[_0xfbed('0x36')](function(_0x3b3b96){if(_0x3b3b96){_0x27e248[_0xfbed('0x29')]=_0x3b3b96[_0xfbed('0x62')]({'plain':!![]});return db[_0xfbed('0x63')][_0xfbed('0x57')]({'where':{'id':_0x3b3b96['FaxInteractionId']}});}return null;})[_0xfbed('0x36')](handleEntityNotFound(_0x56f112,null))['then'](function(_0x4223bf){if(_0x4223bf){return _0x4223bf[_0xfbed('0x64')]({'UserId':_0x2706d8['body'][_0xfbed('0x5f')],'read1stAt':_[_0xfbed('0x65')](_0x4223bf[_0xfbed('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x298dfc){if(_0x298dfc){_0x27e248['interaction']=_0x298dfc[_0xfbed('0x62')]({'plain':!![]});interaction_log[_0xfbed('0x67')](_0xfbed('0x68'),_0x2706d8[_0xfbed('0x60')]['id'],_0x2706d8[_0xfbed('0x60')][_0xfbed('0x3a')],_0x2706d8[_0xfbed('0x60')]['role'],_0x27e248['interaction']['id'],_0x2706d8['body']?JSON[_0xfbed('0x26')](_0x2706d8[_0xfbed('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xfbed('0x69'),_0x27e248);}return null;})[_0xfbed('0x36')](function(_0x5eab25){var _0xbf5720='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5eab25[_0xfbed('0x29')][_0xfbed('0x6a')];return db[_0xfbed('0x6b')][_0xfbed('0x44')](_0xbf5720,{'type':db['Sequelize'][_0xfbed('0x6c')]['SELECT'],'raw':!![]})[_0xfbed('0x36')](function(_0x276e59){return _0x276e59;});})['then'](function(_0x2a8f9d){if(_0x2a8f9d){_0x27e248[_0xfbed('0x29')][_0xfbed('0x6d')]=_0x2a8f9d[0x0];if(!_0x2706d8[_0xfbed('0x5a')][_0xfbed('0x5f')])return;return db['User'][_0xfbed('0x57')]({'where':{'id':_0x2706d8['body'][_0xfbed('0x5f')],'role':_0xfbed('0x61')},'attributes':['id',_0xfbed('0x3a'),'fullname',_0xfbed('0x6e'),_0xfbed('0x6f')],'raw':!![]});}return null;})[_0xfbed('0x36')](function(_0x17d5a0){if(!_0x17d5a0)return null;_0x27e248[_0xfbed('0x29')][_0xfbed('0x61')]=_0x17d5a0;return _0x27e248;})['then'](function(_0x1f3741){if(_0x1f3741){if(_0x2706d8[_0xfbed('0x5a')]['manual']){_0x27e248[_0xfbed('0x29')][_0xfbed('0x70')]=util[_0xfbed('0x5d')]('SIP/%s',_0x2706d8[_0xfbed('0x60')][_0xfbed('0x3a')]);_0x27e248[_0xfbed('0x29')][_0xfbed('0x71')]=_0x27e248[_0xfbed('0x71')];_0x27e248[_0xfbed('0x29')][_0xfbed('0x72')]=_0x27e248['channel'];_0x27e248[_0xfbed('0x29')]['event']=_0xfbed('0x73');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xfbed('0x74'),'message':_0x27e248[_0xfbed('0x29')]},client9002)[_0xfbed('0x36')](function(){return _0x27e248;});}return _0x27e248;}return null;})['then'](respondWithResult(_0x56f112,null))[_0xfbed('0x2b')](handleError(_0x56f112,null));};var interaction_log=require(_0xfbed('0x17'))(_0xfbed('0x59'));exports[_0xfbed('0x75')]=function(_0x481b85,_0x182d9d,_0x3ed87a){var _0x254a84={'agent':{},'channel':_0xfbed('0x76')};if(_0x481b85[_0xfbed('0x5a')]['id']){delete _0x481b85[_0xfbed('0x5a')]['id'];}_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')]=_0x481b85['body']['UserId']||_0x481b85['user']['id'];_0x254a84[_0xfbed('0x61')]['id']=_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')];return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x481b85[_0xfbed('0x56')]['id'],'UserId':null}})[_0xfbed('0x36')](handleEntityNotFound(_0x182d9d,null))[_0xfbed('0x36')](function(_0xd87794){if(_0xd87794){_0x254a84[_0xfbed('0x29')]=_0xd87794['get']({'plain':!![]});return db[_0xfbed('0x63')][_0xfbed('0x57')]({'where':{'id':_0xd87794[_0xfbed('0x77')]}});}return null;})[_0xfbed('0x36')](handleEntityNotFound(_0x182d9d,null))[_0xfbed('0x36')](function(_0x1f332d){if(_0x1f332d){_0x254a84[_0xfbed('0x78')]=_0x1f332d['get']({'plain':!![]});interaction_log[_0xfbed('0x67')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x481b85[_0xfbed('0x60')]['id'],_0x481b85[_0xfbed('0x60')]['name'],_0x481b85['user'][_0xfbed('0x79')],_0x254a84[_0xfbed('0x78')]['id'],_0x481b85[_0xfbed('0x5a')]?JSON[_0xfbed('0x26')](_0x481b85['body']):_0xfbed('0x7a'));return respondWithRpcPromise(_0xfbed('0x7b'),_0xfbed('0x7c'),_0x254a84);}return null;})[_0xfbed('0x36')](function(_0x45e056){var _0x6d3d0b=_0xfbed('0x7d')+_0x45e056[_0xfbed('0x29')][_0xfbed('0x6a')];return db['sequelize'][_0xfbed('0x44')](_0x6d3d0b,{'type':db['Sequelize'][_0xfbed('0x6c')][_0xfbed('0x7e')],'raw':!![]})[_0xfbed('0x36')](function(_0x5765b9){return _0x5765b9;});})[_0xfbed('0x36')](function(_0x4e462f){if(_0x4e462f){_0x254a84[_0xfbed('0x29')][_0xfbed('0x6d')]=_0x4e462f[0x0];if(!_0x481b85[_0xfbed('0x5a')][_0xfbed('0x5f')])return;return db[_0xfbed('0x7f')]['find']({'where':{'id':_0x481b85['body'][_0xfbed('0x5f')],'role':_0xfbed('0x61')},'attributes':['id','name',_0xfbed('0x80'),_0xfbed('0x6e'),'internal'],'raw':!![]});}return null;})[_0xfbed('0x36')](function(_0x528738){if(!_0x528738)return null;_0x254a84['message']['agent']=_0x528738;return _0x254a84;})['then'](function(_0x4797a7){if(_0x4797a7){_0x4797a7[_0xfbed('0x29')]['interface']=util[_0xfbed('0x5d')]('SIP/%s',_0x481b85[_0xfbed('0x60')][_0xfbed('0x3a')]);_0x4797a7[_0xfbed('0x29')][_0xfbed('0x71')]=_0x254a84[_0xfbed('0x71')];_0x4797a7[_0xfbed('0x29')][_0xfbed('0x72')]=_0x254a84['channel'];_0x4797a7['message'][_0xfbed('0x81')]=_0xfbed('0x75');respondWithRpcPromise(_0xfbed('0x82'),_0xfbed('0x82'),{'event':'rejectmessage','message':_0x4797a7[_0xfbed('0x29')]},client9002);return _0x254a84;}return null;})[_0xfbed('0x36')](respondWithResult(_0x182d9d,null))['catch'](handleError(_0x182d9d,null));};exports[_0xfbed('0x83')]=function(_0x2a0376,_0x3aa2d4){var _0x5e5db8;return db[_0xfbed('0x3e')][_0xfbed('0x83')](_0x2a0376[_0xfbed('0x5a')],{})[_0xfbed('0x36')](function(_0x5b0f4a){_0x5e5db8=_0x5b0f4a;return db['CmContact']['findOne']({'where':{'id':_0x5e5db8[_0xfbed('0x6a')]}});})[_0xfbed('0x36')](function(_0x27d010){if(_[_0xfbed('0x65')](_0x27d010)){return;}else{_0x5e5db8[_0xfbed('0x76')]=_0x27d010['fax'];return db['Attachment'][_0xfbed('0x84')]({'where':{'id':_0x5e5db8['AttachmentId']}});}})[_0xfbed('0x36')](function(_0x3b577f){return respondWithRpcPromise(_0xfbed('0x85'),_0xfbed('0x85'),{'FaxAccountId':_['isNil'](_0x2a0376[_0xfbed('0x5a')])?undefined:_0x2a0376[_0xfbed('0x5a')][_0xfbed('0x86')],'path':_[_0xfbed('0x65')](_0x3b577f)?undefined:util['format'](_0xfbed('0x87'),_0x3b577f[_0xfbed('0x88')]),'fax':_[_0xfbed('0x65')](_0x5e5db8[_0xfbed('0x76')])?undefined:_0x5e5db8[_0xfbed('0x76')],'AttachmentId':_0x5e5db8[_0xfbed('0x89')]},client9002);})['then'](respondWithResult(_0x3aa2d4,0xc9))[_0xfbed('0x2b')](handleError(_0x3aa2d4,null));};exports[_0xfbed('0x8a')]=function(_0x5ed38f,_0x56794d){var _0x2836cd=path['join'](config[_0xfbed('0x8b')],_0xfbed('0x8c'),_0xfbed('0x8d'),_0xfbed('0x8e'));return db[_0xfbed('0x3e')][_0xfbed('0x57')]({'where':{'id':_0x5ed38f['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x56794d,null))[_0xfbed('0x36')](function(_0x560b7e){if(_0x560b7e){return _0x56794d[_0xfbed('0x8a')](path['join'](_0x2836cd,_0x560b7e[_0xfbed('0x8f')][_0xfbed('0x88')]));}})[_0xfbed('0x2b')](handleError(_0x56794d,null));}; \ No newline at end of file +var _0xf646=['join','root','files','attachments','download','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','FaxMessage','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','keys','rawAttributes','fields','includeAll','find','body','params','describe','accept','fax','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','interface','rejectmessage','create','CmContact','isNil','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xf646,0x133));var _0x6f64=function(_0x4af4cb,_0xce17b0){_0x4af4cb=_0x4af4cb-0x0;var _0x575f8f=_0xf646[_0x4af4cb];return _0x575f8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f64('0x0'));var zipdir=require(_0x6f64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f64('0x2'));var BPromise=require(_0x6f64('0x3'));var Mustache=require(_0x6f64('0x4'));var util=require(_0x6f64('0x5'));var path=require(_0x6f64('0x6'));var sox=require('sox');var csv=require(_0x6f64('0x7'));var ejs=require(_0x6f64('0x8'));var fs=require('fs');var fs_extra=require(_0x6f64('0x9'));var _=require(_0x6f64('0xa'));var squel=require(_0x6f64('0xb'));var crypto=require(_0x6f64('0xc'));var jsforce=require(_0x6f64('0xd'));var deskjs=require(_0x6f64('0xe'));var toCsv=require(_0x6f64('0x7'));var querystring=require(_0x6f64('0xf'));var Papa=require(_0x6f64('0x10'));var Redis=require(_0x6f64('0x11'));var authService=require(_0x6f64('0x12'));var qs=require(_0x6f64('0x13'));var as=require(_0x6f64('0x14'));var hardwareService=require(_0x6f64('0x15'));var logger=require(_0x6f64('0x16'))(_0x6f64('0x17'));var utils=require(_0x6f64('0x18'));var config=require(_0x6f64('0x19'));var licenseUtil=require(_0x6f64('0x1a'));var db=require(_0x6f64('0x1b'))['db'];config['redis']=_[_0x6f64('0x1c')](config[_0x6f64('0x1d')],{'host':_0x6f64('0x1e'),'port':0x18eb});var socket=require(_0x6f64('0x1f'))(new Redis(config['redis']));require(_0x6f64('0x20'))[_0x6f64('0x21')](socket);var jayson=require(_0x6f64('0x22'));var client=jayson[_0x6f64('0x23')][_0x6f64('0x24')]({'port':0x232c});var client9002=jayson[_0x6f64('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6f2341,_0x2e7277,_0x2fd1a8,_0x38ed89){return new BPromise(function(_0x153167,_0x9d0ec4){var _0x426abe=_0x38ed89||client;return _0x426abe[_0x6f64('0x25')](_0x6f2341,_0x2fd1a8)[_0x6f64('0x26')](function(_0x327fa5){logger[_0x6f64('0x27')](_0x6f64('0x28'),_0x2e7277,'request\x20sent');logger['debug'](_0x6f64('0x29'),_0x2e7277,_0x6f64('0x2a'),JSON['stringify'](_0x327fa5));if(_0x327fa5['error']){if(_0x327fa5[_0x6f64('0x2b')][_0x6f64('0x2c')]===0x1f4){logger[_0x6f64('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x2e7277,_0x327fa5[_0x6f64('0x2b')][_0x6f64('0x2d')]);return _0x9d0ec4(_0x327fa5[_0x6f64('0x2b')][_0x6f64('0x2d')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x2e7277,_0x327fa5[_0x6f64('0x2b')][_0x6f64('0x2d')]);return _0x153167(_0x327fa5[_0x6f64('0x2b')][_0x6f64('0x2d')]);}else{logger[_0x6f64('0x27')](_0x6f64('0x28'),_0x2e7277,_0x6f64('0x2a'));_0x153167(_0x327fa5[_0x6f64('0x2e')][_0x6f64('0x2d')]);}})[_0x6f64('0x2f')](function(_0x3d1019){logger['error'](_0x6f64('0x28'),_0x2e7277,_0x3d1019);_0x9d0ec4(_0x3d1019);});});}function respondWithStatusCode(_0x4cb593,_0x2e9a83){_0x2e9a83=_0x2e9a83||0xcc;return function(_0x4c8406){if(_0x4c8406){return _0x4cb593[_0x6f64('0x30')](_0x2e9a83);}return _0x4cb593[_0x6f64('0x31')](_0x2e9a83)[_0x6f64('0x32')]();};}function respondWithResult(_0x15ced4,_0x2715e1){_0x2715e1=_0x2715e1||0xc8;return function(_0x2c47fc){if(_0x2c47fc){return _0x15ced4['status'](_0x2715e1)[_0x6f64('0x33')](_0x2c47fc);}};}function respondWithFilteredResult(_0xa239df,_0x1ebe8e){return function(_0xd97c42){if(_0xd97c42){var _0x4022c8=typeof _0x1ebe8e[_0x6f64('0x34')]==='undefined'&&typeof _0x1ebe8e[_0x6f64('0x35')]==='undefined';var _0x3e956f=_0xd97c42['count'];var _0x2409c7=_0x4022c8?0x0:_0x1ebe8e[_0x6f64('0x34')];var _0x33f658=_0x4022c8?_0xd97c42[_0x6f64('0x36')]:_0x1ebe8e[_0x6f64('0x34')]+_0x1ebe8e[_0x6f64('0x35')];var _0xfdc6a0;if(_0x33f658>=_0x3e956f){_0x33f658=_0x3e956f;_0xfdc6a0=0xc8;}else{_0xfdc6a0=0xce;}_0xa239df[_0x6f64('0x31')](_0xfdc6a0);return _0xa239df[_0x6f64('0x37')](_0x6f64('0x38'),_0x2409c7+'-'+_0x33f658+'/'+_0x3e956f)[_0x6f64('0x33')](_0xd97c42);}return null;};}function patchUpdates(_0x110345){return function(_0x1cbb3b){try{jsonpatch[_0x6f64('0x39')](_0x1cbb3b,_0x110345,!![]);}catch(_0x5ed3de){return BPromise[_0x6f64('0x3a')](_0x5ed3de);}return _0x1cbb3b['save']();};}function saveUpdates(_0x2713d9,_0x5548df){return function(_0x275831){if(_0x275831){return _0x275831[_0x6f64('0x3b')](_0x2713d9)[_0x6f64('0x26')](function(_0x151834){return _0x151834;});}return null;};}function removeEntity(_0x35b667,_0xe00621){return function(_0x483e17){if(_0x483e17){return _0x483e17[_0x6f64('0x3c')]()[_0x6f64('0x26')](function(){_0x35b667[_0x6f64('0x31')](0xcc)[_0x6f64('0x32')]();});}};}function handleEntityNotFound(_0xf27d3c,_0x1a19df){return function(_0x18fb37){if(!_0x18fb37){_0xf27d3c['sendStatus'](0x194);}return _0x18fb37;};}function handleError(_0x5333fc,_0x3b1bd9){_0x3b1bd9=_0x3b1bd9||0x1f4;return function(_0x41f5d4){logger['error'](_0x41f5d4[_0x6f64('0x3d')]);if(_0x41f5d4[_0x6f64('0x3e')]){delete _0x41f5d4['name'];}_0x5333fc[_0x6f64('0x31')](_0x3b1bd9)['send'](_0x41f5d4);};}exports[_0x6f64('0x3f')]=function(_0x47a1d5,_0x1dc496){var _0x48002c={},_0x461d7b={},_0x43cb9f={'count':0x0,'rows':[]};var _0x2b2583=_[_0x6f64('0x40')](db[_0x6f64('0x41')]['rawAttributes'],function(_0x4e1698){return{'name':_0x4e1698[_0x6f64('0x42')],'type':_0x4e1698['type'][_0x6f64('0x43')]};});_0x461d7b[_0x6f64('0x44')]=_[_0x6f64('0x40')](_0x2b2583,'name');_0x461d7b['query']=_['keys'](_0x47a1d5[_0x6f64('0x45')]);_0x461d7b[_0x6f64('0x46')]=_[_0x6f64('0x47')](_0x461d7b['model'],_0x461d7b[_0x6f64('0x45')]);_0x48002c[_0x6f64('0x48')]=_[_0x6f64('0x47')](_0x461d7b[_0x6f64('0x44')],qs['fields'](_0x47a1d5[_0x6f64('0x45')]['fields']));_0x48002c[_0x6f64('0x48')]=_0x48002c[_0x6f64('0x48')][_0x6f64('0x49')]?_0x48002c[_0x6f64('0x48')]:_0x461d7b[_0x6f64('0x44')];if(!_0x47a1d5[_0x6f64('0x45')][_0x6f64('0x4a')](_0x6f64('0x4b'))){_0x48002c[_0x6f64('0x35')]=qs[_0x6f64('0x35')](_0x47a1d5[_0x6f64('0x45')][_0x6f64('0x35')]);_0x48002c[_0x6f64('0x34')]=qs['offset'](_0x47a1d5[_0x6f64('0x45')][_0x6f64('0x34')]);}_0x48002c['order']=qs['sort'](_0x47a1d5[_0x6f64('0x45')][_0x6f64('0x4c')]);_0x48002c[_0x6f64('0x4d')]=qs['filters'](_[_0x6f64('0x4e')](_0x47a1d5[_0x6f64('0x45')],_0x461d7b[_0x6f64('0x46')]),_0x2b2583);if(_0x47a1d5[_0x6f64('0x45')][_0x6f64('0x4f')]){_0x48002c[_0x6f64('0x4d')]=_['merge'](_0x48002c[_0x6f64('0x4d')],{'$or':_['map'](_0x2b2583,function(_0x19593d){if(_0x19593d[_0x6f64('0x50')]!==_0x6f64('0x51')){var _0x431848={};_0x431848[_0x19593d['name']]={'$like':'%'+_0x47a1d5[_0x6f64('0x45')]['filter']+'%'};return _0x431848;}})});}_0x48002c=_[_0x6f64('0x52')]({},_0x48002c,_0x47a1d5[_0x6f64('0x53')]);var _0x206074={'where':_0x48002c[_0x6f64('0x4d')]};return db['FaxMessage']['count'](_0x206074)[_0x6f64('0x26')](function(_0x4dff5b){_0x43cb9f[_0x6f64('0x36')]=_0x4dff5b;if(_0x47a1d5[_0x6f64('0x45')]['includeAll']){_0x48002c[_0x6f64('0x54')]=[{'all':!![]}];}return db[_0x6f64('0x41')][_0x6f64('0x55')](_0x48002c);})[_0x6f64('0x26')](function(_0x55db55){_0x43cb9f[_0x6f64('0x56')]=_0x55db55;return _0x43cb9f;})[_0x6f64('0x26')](respondWithFilteredResult(_0x1dc496,_0x48002c))[_0x6f64('0x2f')](handleError(_0x1dc496,null));};exports[_0x6f64('0x57')]=function(_0x4778c2,_0x2ee551){var _0x1e74f8={'raw':!![],'where':{'id':_0x4778c2['params']['id']}},_0x4597dd={};_0x4597dd[_0x6f64('0x44')]=_[_0x6f64('0x58')](db[_0x6f64('0x41')][_0x6f64('0x59')]);_0x4597dd[_0x6f64('0x45')]=_['keys'](_0x4778c2[_0x6f64('0x45')]);_0x4597dd[_0x6f64('0x46')]=_[_0x6f64('0x47')](_0x4597dd['model'],_0x4597dd[_0x6f64('0x45')]);_0x1e74f8['attributes']=_[_0x6f64('0x47')](_0x4597dd['model'],qs[_0x6f64('0x5a')](_0x4778c2[_0x6f64('0x45')][_0x6f64('0x5a')]));_0x1e74f8['attributes']=_0x1e74f8[_0x6f64('0x48')][_0x6f64('0x49')]?_0x1e74f8[_0x6f64('0x48')]:_0x4597dd[_0x6f64('0x44')];if(_0x4778c2[_0x6f64('0x45')][_0x6f64('0x5b')]){_0x1e74f8[_0x6f64('0x54')]=[{'all':!![]}];}_0x1e74f8=_[_0x6f64('0x52')]({},_0x1e74f8,_0x4778c2[_0x6f64('0x53')]);return db[_0x6f64('0x41')][_0x6f64('0x5c')](_0x1e74f8)[_0x6f64('0x26')](handleEntityNotFound(_0x2ee551,null))['then'](respondWithResult(_0x2ee551,null))[_0x6f64('0x2f')](handleError(_0x2ee551,null));};exports[_0x6f64('0x3b')]=function(_0x5bacec,_0x15a8e5){if(_0x5bacec[_0x6f64('0x5d')]['id']){delete _0x5bacec[_0x6f64('0x5d')]['id'];}return db[_0x6f64('0x41')][_0x6f64('0x5c')]({'where':{'id':_0x5bacec['params']['id']}})['then'](handleEntityNotFound(_0x15a8e5,null))[_0x6f64('0x26')](saveUpdates(_0x5bacec[_0x6f64('0x5d')],null))[_0x6f64('0x26')](respondWithResult(_0x15a8e5,null))[_0x6f64('0x2f')](handleError(_0x15a8e5,null));};exports[_0x6f64('0x3c')]=function(_0x2d443d,_0x222340){return db[_0x6f64('0x41')][_0x6f64('0x5c')]({'where':{'id':_0x2d443d[_0x6f64('0x5e')]['id']}})[_0x6f64('0x26')](handleEntityNotFound(_0x222340,null))['then'](removeEntity(_0x222340,null))[_0x6f64('0x2f')](handleError(_0x222340,null));};exports[_0x6f64('0x5f')]=function(_0x149692,_0x589c17){return db['FaxMessage'][_0x6f64('0x5f')]()[_0x6f64('0x26')](respondWithResult(_0x589c17,null))[_0x6f64('0x2f')](handleError(_0x589c17,null));};var interaction_log=require(_0x6f64('0x16'))('fax-interactions');exports[_0x6f64('0x60')]=function(_0xccf6f8,_0x1aacfb,_0x4c7ac2){var _0x5671ba={'agent':{},'channel':_0x6f64('0x61')};if(_0xccf6f8[_0x6f64('0x5d')]['id']){delete _0xccf6f8[_0x6f64('0x5d')]['id'];}_0xccf6f8['body']['read']=!![];_0xccf6f8[_0x6f64('0x5d')]['readAt']=moment()['format'](_0x6f64('0x62'));_0xccf6f8[_0x6f64('0x5d')]['UserId']=_0xccf6f8[_0x6f64('0x5d')][_0x6f64('0x63')]||_0xccf6f8[_0x6f64('0x64')]['id'];_0x5671ba[_0x6f64('0x65')]['id']=_0xccf6f8['body'][_0x6f64('0x63')];return db[_0x6f64('0x41')][_0x6f64('0x5c')]({'where':{'id':_0xccf6f8[_0x6f64('0x5e')]['id'],'UserId':null}})[_0x6f64('0x26')](handleEntityNotFound(_0x1aacfb,null))[_0x6f64('0x26')](saveUpdates(_0xccf6f8[_0x6f64('0x5d')],null))[_0x6f64('0x26')](function(_0x4a9192){if(_0x4a9192){_0x5671ba[_0x6f64('0x2d')]=_0x4a9192[_0x6f64('0x66')]({'plain':!![]});return db[_0x6f64('0x67')][_0x6f64('0x5c')]({'where':{'id':_0x4a9192[_0x6f64('0x68')]}});}return null;})[_0x6f64('0x26')](handleEntityNotFound(_0x1aacfb,null))[_0x6f64('0x26')](function(_0x5bfd3a){if(_0x5bfd3a){return _0x5bfd3a[_0x6f64('0x3b')]({'UserId':_0xccf6f8[_0x6f64('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x5bfd3a[_0x6f64('0x69')])?moment()[_0x6f64('0x6a')](_0x6f64('0x62')):undefined});}return null;})[_0x6f64('0x26')](function(_0x20c7aa){if(_0x20c7aa){_0x5671ba[_0x6f64('0x6b')]=_0x20c7aa[_0x6f64('0x66')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xccf6f8['user']['id'],_0xccf6f8[_0x6f64('0x64')][_0x6f64('0x3e')],_0xccf6f8[_0x6f64('0x64')]['role'],_0x5671ba[_0x6f64('0x6b')]['id'],_0xccf6f8[_0x6f64('0x5d')]?JSON[_0x6f64('0x6c')](_0xccf6f8[_0x6f64('0x5d')]):_0x6f64('0x6d'));return respondWithRpcPromise(_0x6f64('0x6e'),_0x6f64('0x6f'),_0x5671ba);}return null;})['then'](function(_0x3f0a20){var _0x393d4e=_0x6f64('0x70')+_0x3f0a20['message'][_0x6f64('0x71')];return db[_0x6f64('0x72')][_0x6f64('0x45')](_0x393d4e,{'type':db[_0x6f64('0x73')][_0x6f64('0x74')][_0x6f64('0x75')],'raw':!![]})[_0x6f64('0x26')](function(_0x461690){return _0x461690;});})[_0x6f64('0x26')](function(_0x21c0c4){if(_0x21c0c4){_0x5671ba[_0x6f64('0x2d')][_0x6f64('0x76')]=_0x21c0c4[0x0];if(!_0xccf6f8[_0x6f64('0x5d')]['UserId'])return;return db['User']['find']({'where':{'id':_0xccf6f8['body']['UserId'],'role':_0x6f64('0x65')},'attributes':['id',_0x6f64('0x3e'),_0x6f64('0x77'),_0x6f64('0x78'),_0x6f64('0x79')],'raw':!![]});}return null;})['then'](function(_0x3b6ab0){if(!_0x3b6ab0)return null;_0x5671ba[_0x6f64('0x2d')][_0x6f64('0x65')]=_0x3b6ab0;return _0x5671ba;})[_0x6f64('0x26')](function(_0x257daf){if(_0x257daf){if(_0xccf6f8[_0x6f64('0x5d')][_0x6f64('0x7a')]){_0x5671ba['message']['interface']=util[_0x6f64('0x6a')](_0x6f64('0x7b'),_0xccf6f8['user']['name']);_0x5671ba[_0x6f64('0x2d')][_0x6f64('0x7c')]=_0x5671ba[_0x6f64('0x7c')];_0x5671ba[_0x6f64('0x2d')][_0x6f64('0x7d')]=_0x5671ba['channel'];_0x5671ba[_0x6f64('0x2d')][_0x6f64('0x7e')]='accept';return respondWithRpcPromise('EventManager',_0x6f64('0x7f'),{'event':'acceptmessage','message':_0x5671ba[_0x6f64('0x2d')]},client9002)[_0x6f64('0x26')](function(){return _0x5671ba;});}return _0x5671ba;}return null;})[_0x6f64('0x26')](respondWithResult(_0x1aacfb,null))[_0x6f64('0x2f')](handleError(_0x1aacfb,null));};var interaction_log=require(_0x6f64('0x16'))(_0x6f64('0x80'));exports[_0x6f64('0x3a')]=function(_0x45c434,_0x54c703,_0x133aae){var _0x3aace5={'agent':{},'channel':_0x6f64('0x61')};if(_0x45c434[_0x6f64('0x5d')]['id']){delete _0x45c434[_0x6f64('0x5d')]['id'];}_0x45c434['body'][_0x6f64('0x63')]=_0x45c434[_0x6f64('0x5d')][_0x6f64('0x63')]||_0x45c434[_0x6f64('0x64')]['id'];_0x3aace5[_0x6f64('0x65')]['id']=_0x45c434['body']['UserId'];return db[_0x6f64('0x41')][_0x6f64('0x5c')]({'where':{'id':_0x45c434[_0x6f64('0x5e')]['id'],'UserId':null}})[_0x6f64('0x26')](handleEntityNotFound(_0x54c703,null))['then'](function(_0x5a06c8){if(_0x5a06c8){_0x3aace5[_0x6f64('0x2d')]=_0x5a06c8['get']({'plain':!![]});return db[_0x6f64('0x67')][_0x6f64('0x5c')]({'where':{'id':_0x5a06c8[_0x6f64('0x68')]}});}return null;})[_0x6f64('0x26')](handleEntityNotFound(_0x54c703,null))['then'](function(_0x1d555){if(_0x1d555){_0x3aace5[_0x6f64('0x6b')]=_0x1d555[_0x6f64('0x66')]({'plain':!![]});interaction_log['info'](_0x6f64('0x81'),_0x45c434[_0x6f64('0x64')]['id'],_0x45c434['user'][_0x6f64('0x3e')],_0x45c434[_0x6f64('0x64')][_0x6f64('0x82')],_0x3aace5[_0x6f64('0x6b')]['id'],_0x45c434[_0x6f64('0x5d')]?JSON[_0x6f64('0x6c')](_0x45c434[_0x6f64('0x5d')]):_0x6f64('0x6d'));return respondWithRpcPromise(_0x6f64('0x83'),_0x6f64('0x84'),_0x3aace5);}return null;})['then'](function(_0x6d470a){var _0x119e66=_0x6f64('0x70')+_0x6d470a[_0x6f64('0x2d')][_0x6f64('0x71')];return db[_0x6f64('0x72')][_0x6f64('0x45')](_0x119e66,{'type':db['Sequelize']['QueryTypes'][_0x6f64('0x75')],'raw':!![]})[_0x6f64('0x26')](function(_0x41bdce){return _0x41bdce;});})[_0x6f64('0x26')](function(_0xa51e3d){if(_0xa51e3d){_0x3aace5[_0x6f64('0x2d')][_0x6f64('0x76')]=_0xa51e3d[0x0];if(!_0x45c434[_0x6f64('0x5d')][_0x6f64('0x63')])return;return db[_0x6f64('0x85')][_0x6f64('0x5c')]({'where':{'id':_0x45c434[_0x6f64('0x5d')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0x6f64('0x78'),'internal'],'raw':!![]});}return null;})[_0x6f64('0x26')](function(_0xa0084e){if(!_0xa0084e)return null;_0x3aace5[_0x6f64('0x2d')][_0x6f64('0x65')]=_0xa0084e;return _0x3aace5;})[_0x6f64('0x26')](function(_0x4a496f){if(_0x4a496f){_0x4a496f[_0x6f64('0x2d')][_0x6f64('0x86')]=util[_0x6f64('0x6a')](_0x6f64('0x7b'),_0x45c434['user']['name']);_0x4a496f[_0x6f64('0x2d')]['channel']=_0x3aace5[_0x6f64('0x7c')];_0x4a496f[_0x6f64('0x2d')][_0x6f64('0x7d')]=_0x3aace5['channel'];_0x4a496f['message']['event']=_0x6f64('0x3a');respondWithRpcPromise(_0x6f64('0x7f'),_0x6f64('0x7f'),{'event':_0x6f64('0x87'),'message':_0x4a496f['message']},client9002);return _0x3aace5;}return null;})[_0x6f64('0x26')](respondWithResult(_0x54c703,null))['catch'](handleError(_0x54c703,null));};exports[_0x6f64('0x88')]=function(_0x474fb8,_0x4e99cf){var _0x7f8f61;return db[_0x6f64('0x41')][_0x6f64('0x88')](_0x474fb8['body'],{})[_0x6f64('0x26')](function(_0x2ffea8){_0x7f8f61=_0x2ffea8;return db[_0x6f64('0x89')]['findOne']({'where':{'id':_0x7f8f61[_0x6f64('0x71')]}});})['then'](function(_0x5295f7){if(_[_0x6f64('0x8a')](_0x5295f7)){return;}else{_0x7f8f61[_0x6f64('0x61')]=_0x5295f7[_0x6f64('0x61')];return db[_0x6f64('0x8b')][_0x6f64('0x8c')]({'where':{'id':_0x7f8f61[_0x6f64('0x8d')]}});}})[_0x6f64('0x26')](function(_0xc5240d){return respondWithRpcPromise(_0x6f64('0x8e'),'SendFax',{'FaxAccountId':_[_0x6f64('0x8a')](_0x474fb8[_0x6f64('0x5d')])?undefined:_0x474fb8[_0x6f64('0x5d')][_0x6f64('0x8f')],'path':_[_0x6f64('0x8a')](_0xc5240d)?undefined:util['format'](_0x6f64('0x90'),_0xc5240d[_0x6f64('0x91')]),'fax':_['isNil'](_0x7f8f61['fax'])?undefined:_0x7f8f61[_0x6f64('0x61')],'AttachmentId':_0x7f8f61[_0x6f64('0x8d')]},client9002);})[_0x6f64('0x26')](respondWithResult(_0x4e99cf,0xc9))['catch'](handleError(_0x4e99cf,null));};exports['download']=function(_0x13d8ac,_0x2ce0ff){var _0x56f2dc=path[_0x6f64('0x92')](config[_0x6f64('0x93')],'server',_0x6f64('0x94'),_0x6f64('0x95'));return db[_0x6f64('0x41')]['find']({'where':{'id':_0x13d8ac[_0x6f64('0x5e')]['id']},'include':[{'model':db['Attachment'],'as':_0x6f64('0x8b')}]})[_0x6f64('0x26')](handleEntityNotFound(_0x2ce0ff,null))[_0x6f64('0x26')](function(_0x5767f7){if(_0x5767f7){return _0x2ce0ff[_0x6f64('0x96')](path[_0x6f64('0x92')](_0x56f2dc,_0x5767f7[_0x6f64('0x8b')][_0x6f64('0x91')]));}})[_0x6f64('0x2f')](handleError(_0x2ce0ff,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 525204a..a0d72ed 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 _0x6132=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x34528b,_0x52583d){var _0x400919=function(_0x42d60f){while(--_0x42d60f){_0x34528b['push'](_0x34528b['shift']());}};_0x400919(++_0x52583d);}(_0x6132,0x13a));var _0x2613=function(_0x49fba7,_0x37d4d5){_0x49fba7=_0x49fba7-0x0;var _0xbbbc8e=_0x6132[_0x49fba7];return _0xbbbc8e;};'use strict';var EventEmitter=require(_0x2613('0x0'));var FaxMessage=require(_0x2613('0x1'))['db'][_0x2613('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2613('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2613('0x4'),'afterDestroy':_0x2613('0x5')};function emitEvent(_0x2890f9){return function(_0x35c979,_0x555746,_0x8d00d8){FaxMessageEvents['emit'](_0x2890f9+':'+_0x35c979['id'],_0x35c979);FaxMessageEvents['emit'](_0x2890f9,_0x35c979);_0x8d00d8(null);};}for(var e in events){if(events[_0x2613('0x6')](e)){var event=events[e];FaxMessage[_0x2613('0x7')](e,emitEvent(event));}}module[_0x2613('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xb7de=['hook','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0xb7de,0xc7));var _0xeb7d=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xb7de[_0x28947d];return _0x12d2ee;};'use strict';var EventEmitter=require(_0xeb7d('0x0'));var FaxMessage=require(_0xeb7d('0x1'))['db'][_0xeb7d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb7d('0x3'),'afterUpdate':_0xeb7d('0x4'),'afterDestroy':_0xeb7d('0x5')};function emitEvent(_0x219063){return function(_0x6b96c8,_0x57a908,_0x16d106){FaxMessageEvents[_0xeb7d('0x6')](_0x219063+':'+_0x6b96c8['id'],_0x6b96c8);FaxMessageEvents[_0xeb7d('0x6')](_0x219063,_0x6b96c8);_0x16d106(null);};}for(var e in events){if(events[_0xeb7d('0x7')](e)){var event=events[e];FaxMessage[_0xeb7d('0x8')](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 4c6a268..b05e432 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 _0xb4c3=['catch','utf8mb4','lodash','../../config/logger','api','moment','bluebird','path','./faxMessage.attributes','exports','define','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update'];(function(_0x14ce33,_0x46699d){var _0x10e50e=function(_0x12b8b2){while(--_0x12b8b2){_0x14ce33['push'](_0x14ce33['shift']());}};_0x10e50e(++_0x46699d);}(_0xb4c3,0x7a));var _0x3b4c=function(_0x256798,_0x5cca6f){_0x256798=_0x256798-0x0;var _0x10c175=_0xb4c3[_0x256798];return _0x10c175;};'use strict';var _=require(_0x3b4c('0x0'));var util=require('util');var logger=require(_0x3b4c('0x1'))(_0x3b4c('0x2'));var moment=require(_0x3b4c('0x3'));var BPromise=require(_0x3b4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b4c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b4c('0x6'));module[_0x3b4c('0x7')]=function(_0x15224d,_0x365a46){return _0x15224d[_0x3b4c('0x8')]('FaxMessage',attributes,{'tableName':_0x3b4c('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x3b4c('0xa')],'type':_0x3b4c('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c1dcc,_0x19f489,_0x550fd3){var _0x4b90cc=_0x15224d['models'];var _0x55c390=_0x3c1dcc[_0x3b4c('0xc')]({'plain':!![]});if(_0x55c390[_0x3b4c('0xd')]['toLowerCase']()==='in'||_0x55c390[_0x3b4c('0xd')][_0x3b4c('0xe')]()===_0x3b4c('0xf')&&!_0x55c390['secret']&&!_[_0x3b4c('0x10')](_0x55c390[_0x3b4c('0x11')])){_0x4b90cc[_0x3b4c('0x12')][_0x3b4c('0x13')]({'where':{'id':_0x55c390[_0x3b4c('0x14')]}})['then'](function(_0x406a74){if(_0x406a74){_0x406a74[_0x3b4c('0x15')]({'lastMsgAt':_0x55c390['createdAt'],'lastMsgDirection':_0x55c390['direction'][_0x3b4c('0xe')]()});}})[_0x3b4c('0x16')](function(_0x4e1bd9){console['error'](_0x4e1bd9);});}_0x550fd3();}},'charset':_0x3b4c('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x868a=['out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','models','get','direction','toLowerCase'];(function(_0x39be3b,_0x4c094e){var _0x393f48=function(_0x520452){while(--_0x520452){_0x39be3b['push'](_0x39be3b['shift']());}};_0x393f48(++_0x4c094e);}(_0x868a,0x141));var _0xa868=function(_0x21a313,_0x563671){_0x21a313=_0x21a313-0x0;var _0x1a66bd=_0x868a[_0x21a313];return _0x1a66bd;};'use strict';var _=require(_0xa868('0x0'));var util=require(_0xa868('0x1'));var logger=require(_0xa868('0x2'))(_0xa868('0x3'));var moment=require(_0xa868('0x4'));var BPromise=require(_0xa868('0x5'));var rp=require(_0xa868('0x6'));var fs=require('fs');var path=require(_0xa868('0x7'));var rimraf=require(_0xa868('0x8'));var config=require(_0xa868('0x9'));var attributes=require(_0xa868('0xa'));module[_0xa868('0xb')]=function(_0x68895a,_0x29617d){return _0x68895a[_0xa868('0xc')](_0xa868('0xd'),attributes,{'tableName':_0xa868('0xe'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xa868('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xeda36d,_0xe0c6c3,_0xbb5653){var _0x3d5006=_0x68895a[_0xa868('0x10')];var _0x441f24=_0xeda36d[_0xa868('0x11')]({'plain':!![]});if(_0x441f24[_0xa868('0x12')][_0xa868('0x13')]()==='in'||_0x441f24['direction'][_0xa868('0x13')]()===_0xa868('0x14')&&!_0x441f24[_0xa868('0x15')]&&!_['isNil'](_0x441f24['UserId'])){_0x3d5006[_0xa868('0x16')][_0xa868('0x17')]({'where':{'id':_0x441f24[_0xa868('0x18')]}})[_0xa868('0x19')](function(_0x26ff7b){if(_0x26ff7b){_0x26ff7b[_0xa868('0x1a')]({'lastMsgAt':_0x441f24['createdAt'],'lastMsgDirection':_0x441f24[_0xa868('0x12')][_0xa868('0x13')]()});}})[_0xa868('0x1b')](function(_0x373555){console[_0xa868('0x1c')](_0x373555);});}_0xbb5653();}},'charset':_0xa868('0x1d'),'collate':_0xa868('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 745384a..f66255a 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 _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x5bdebe,_0x4b317d){var _0x59f511=function(_0x5aa117){while(--_0x5aa117){_0x5bdebe['push'](_0x5bdebe['shift']());}};_0x59f511(++_0x4b317d);}(_0x4c4e,0x152));var _0xe4c4=function(_0xcecaa9,_0x460b08){_0xcecaa9=_0xcecaa9-0x0;var _0xc2a7cb=_0x4c4e[_0xcecaa9];return _0xc2a7cb;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file +var _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1375c9,_0x3b691c){var _0x5c2b15=function(_0x3704eb){while(--_0x3704eb){_0x1375c9['push'](_0x1375c9['shift']());}};_0x5c2b15(++_0x3b691c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5ac7d7,_0x109040){_0x5ac7d7=_0x5ac7d7-0x0;var _0x23955f=_0xf3cd[_0x5ac7d7];return _0x23955f;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3b1c784..f49f0bb 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 _0x3a20=['save','update','register','faxMessage:'];(function(_0x332b2c,_0x526aec){var _0x24e2b8=function(_0x5b35e0){while(--_0x5b35e0){_0x332b2c['push'](_0x332b2c['shift']());}};_0x24e2b8(++_0x526aec);}(_0x3a20,0xd0));var _0x03a2=function(_0x19054c,_0x4e0287){_0x19054c=_0x19054c-0x0;var _0xfaa27=_0x3a20[_0x19054c];return _0xfaa27;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x03a2('0x0'),'remove',_0x03a2('0x1')];function createListener(_0x546a49,_0xb8442){return function(_0x525720){_0xb8442['emit'](_0x546a49,_0x525720);};}function removeListener(_0x48afbd,_0x1bc8b4){return function(){FaxMessageEvents['removeListener'](_0x48afbd,_0x1bc8b4);};}exports[_0x03a2('0x2')]=function(_0x1d066d){for(var _0x5c275d=0x0,_0x1f124f=events['length'];_0x5c275d<_0x1f124f;_0x5c275d++){var _0x1e43c1=events[_0x5c275d];var _0x1e1a86=createListener(_0x03a2('0x3')+_0x1e43c1,_0x1d066d);FaxMessageEvents['on'](_0x1e43c1,_0x1e1a86);}}; \ No newline at end of file +var _0x08bf=['./faxMessage.events','remove','update','emit','register','length'];(function(_0x2a4af6,_0x242a55){var _0x3f8898=function(_0x5c5ece){while(--_0x5c5ece){_0x2a4af6['push'](_0x2a4af6['shift']());}};_0x3f8898(++_0x242a55);}(_0x08bf,0x1da));var _0xf08b=function(_0x445b37,_0x50278d){_0x445b37=_0x445b37-0x0;var _0x39ed9b=_0x08bf[_0x445b37];return _0x39ed9b;};'use strict';var FaxMessageEvents=require(_0xf08b('0x0'));var events=['save',_0xf08b('0x1'),_0xf08b('0x2')];function createListener(_0x5e8376,_0x2561dc){return function(_0x11e9cb){_0x2561dc[_0xf08b('0x3')](_0x5e8376,_0x11e9cb);};}function removeListener(_0x1a7013,_0x23f1f5){return function(){FaxMessageEvents['removeListener'](_0x1a7013,_0x23f1f5);};}exports[_0xf08b('0x4')]=function(_0x3e0cf1){for(var _0x1e18eb=0x0,_0x1f85d5=events[_0xf08b('0x5')];_0x1e18eb<_0x1f85d5;_0x1e18eb++){var _0x2d8c13=events[_0x1e18eb];var _0x40a928=createListener('faxMessage:'+_0x2d8c13,_0x3e0cf1);FaxMessageEvents['on'](_0x2d8c13,_0x40a928);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 037dc0c..31dc7bc 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 _0xc788=['describe','/:id','show','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc788,0xc4));var _0x8c78=function(_0x50a19b,_0x80c4d0){_0x50a19b=_0x50a19b-0x0;var _0x19b42d=_0xc788[_0x50a19b];return _0x19b42d;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var fs_extra=require(_0x8c78('0x4'));var auth=require(_0x8c78('0x5'));var interaction=require(_0x8c78('0x6'));var config=require(_0x8c78('0x7'));var controller=require('./faxMessage.controller');router[_0x8c78('0x8')]('/',auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0x8')](_0x8c78('0xb'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0x8')](_0x8c78('0xd'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);router[_0x8c78('0x8')]('/:id/download',auth[_0x8c78('0x9')](),controller['download']);router[_0x8c78('0xf')]('/',auth[_0x8c78('0x9')](),interaction['tracked'](_0x8c78('0x10'),_0x8c78('0x11')),controller['create']);router[_0x8c78('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8c78('0x13')]);router[_0x8c78('0x12')](_0x8c78('0x14'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x15')]);router[_0x8c78('0x12')](_0x8c78('0x16'),auth[_0x8c78('0x9')](),controller[_0x8c78('0x17')]);router[_0x8c78('0x18')]('/:id',auth[_0x8c78('0x9')](),controller[_0x8c78('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa5fa=['accept','/:id/reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','faxmessage:create','create','put'];(function(_0x33f545,_0x53e357){var _0x212439=function(_0x36c6c8){while(--_0x36c6c8){_0x33f545['push'](_0x33f545['shift']());}};_0x212439(++_0x53e357);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x337a7a,_0x5f3233){_0x337a7a=_0x337a7a-0x0;var _0x1f72db=_0xa5fa[_0x337a7a];return _0x1f72db;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var fs_extra=require(_0xaa5f('0x4'));var auth=require(_0xaa5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa5f('0x6'));var controller=require(_0xaa5f('0x7'));router[_0xaa5f('0x8')]('/',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xa')]);router[_0xaa5f('0x8')](_0xaa5f('0xb'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0xc')]);router[_0xaa5f('0x8')](_0xaa5f('0xd'),auth['isAuthenticated'](),controller[_0xaa5f('0xe')]);router[_0xaa5f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xaa5f('0xf')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xaa5f('0x10')]('fax',_0xaa5f('0x11')),controller[_0xaa5f('0x12')]);router[_0xaa5f('0x13')](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller['update']);router[_0xaa5f('0x13')]('/:id/accept',auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x14')]);router[_0xaa5f('0x13')](_0xaa5f('0x15'),auth[_0xaa5f('0x9')](),controller['reject']);router['delete'](_0xaa5f('0xd'),auth[_0xaa5f('0x9')](),controller[_0xaa5f('0x16')]);module[_0xaa5f('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 859ddc3..4f5cb0d 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 _0xdedd=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x423eb1,_0x566da4){var _0x2b01e3=function(_0x409cdd){while(--_0x409cdd){_0x423eb1['push'](_0x423eb1['shift']());}};_0x2b01e3(++_0x566da4);}(_0xdedd,0x1a1));var _0xdded=function(_0x2962c6,_0x1214c0){_0x2962c6=_0x2962c6-0x0;var _0x423e8a=_0xdedd[_0x2962c6];return _0x423e8a;};'use strict';var Sequelize=require(_0xdded('0x0'));module[_0xdded('0x1')]={'name':{'type':Sequelize[_0xdded('0x2')],'unique':_0xdded('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdded('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdded('0x5')](_0xdded('0x6'),_0xdded('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x54cc=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x54cc,0xa0));var _0xc54c=function(_0x93de64,_0x503114){_0x93de64=_0x93de64-0x0;var _0x1489c=_0x54cc[_0x93de64];return _0x1489c;};'use strict';var Sequelize=require(_0xc54c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc54c('0x1')],'unique':_0xc54c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xc54c('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc54c('0x4')]('rrmemory',_0xc54c('0x5'),_0xc54c('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc54c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 9c73b15..fc27453 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 _0x3837=['redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','UserId','%s/%s','faxPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','sequelize','each','findOrCreate','forEach','emit','removeTeams','findAll','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','getAgents','util','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3837,0x1d1));var _0x7383=function(_0x1bcf95,_0x2dc284){_0x1bcf95=_0x1bcf95-0x0;var _0x6affd0=_0x3837[_0x1bcf95];return _0x6affd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x7383('0x0'));var _=require('lodash');var squel=require(_0x7383('0x1'));var Redis=require('ioredis');var qs=require(_0x7383('0x2'));var logger=require(_0x7383('0x3'))(_0x7383('0x4'));var config=require(_0x7383('0x5'));var db=require(_0x7383('0x6'))['db'];config['redis']=_['defaults'](config[_0x7383('0x7')],{'host':_0x7383('0x8'),'port':0x18eb});var socket=require(_0x7383('0x9'))(new Redis(config[_0x7383('0x7')]));require(_0x7383('0xa'))[_0x7383('0xb')](socket);function respondWithStatusCode(_0x1dc05a,_0x4b3303){_0x4b3303=_0x4b3303||0xcc;return function(_0x922b0){if(_0x922b0){return _0x1dc05a[_0x7383('0xc')](_0x4b3303);}return _0x1dc05a[_0x7383('0xd')](_0x4b3303)[_0x7383('0xe')]();};}function respondWithResult(_0x3d2d47,_0x2dcdc9){_0x2dcdc9=_0x2dcdc9||0xc8;return function(_0x19f134){if(_0x19f134){return _0x3d2d47['status'](_0x2dcdc9)[_0x7383('0xf')](_0x19f134);}};}function respondWithFilteredResult(_0x5ba02f,_0x1d2221){return function(_0x3c29dc){if(_0x3c29dc){var _0x3f135b=typeof _0x1d2221[_0x7383('0x10')]===_0x7383('0x11')&&typeof _0x1d2221[_0x7383('0x12')]===_0x7383('0x11');var _0x24be15=_0x3c29dc[_0x7383('0x13')];var _0x5b018f=_0x3f135b?0x0:_0x1d2221[_0x7383('0x10')];var _0x3a2c78=_0x3f135b?_0x3c29dc[_0x7383('0x13')]:_0x1d2221[_0x7383('0x10')]+_0x1d2221['limit'];var _0x566949;if(_0x3a2c78>=_0x24be15){_0x3a2c78=_0x24be15;_0x566949=0xc8;}else{_0x566949=0xce;}_0x5ba02f['status'](_0x566949);return _0x5ba02f['set'](_0x7383('0x14'),_0x5b018f+'-'+_0x3a2c78+'/'+_0x24be15)[_0x7383('0xf')](_0x3c29dc);}return null;};}function saveUpdates(_0x320cf5){return function(_0x5ae49f){if(_0x5ae49f){return _0x5ae49f[_0x7383('0x15')](_0x320cf5)['then'](function(_0x1cf7bb){return _0x1cf7bb;});}return null;};}function removeEntity(_0x2db022){return function(_0x1c7645){if(_0x1c7645){return _0x1c7645[_0x7383('0x16')]()[_0x7383('0x17')](function(){var _0x29cab0=_0x1c7645[_0x7383('0x18')]({'plain':!![]});var _0xc491c1=_0x7383('0x19');return db[_0x7383('0x1a')]['destroy']({'where':{'type':_0xc491c1,'resourceId':_0x29cab0['id']}})[_0x7383('0x17')](function(){return _0x1c7645;});})[_0x7383('0x17')](function(){_0x2db022[_0x7383('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183ccb){return function(_0xff5467){if(!_0xff5467){_0x183ccb['sendStatus'](0x194);}return _0xff5467;};}function handleError(_0x316204,_0x57420d){_0x57420d=_0x57420d||0x1f4;return function(_0x1e2e79){logger[_0x7383('0x1b')](_0x1e2e79['stack']);if(_0x1e2e79[_0x7383('0x1c')]){delete _0x1e2e79[_0x7383('0x1c')];}_0x316204[_0x7383('0xd')](_0x57420d)[_0x7383('0x1d')](_0x1e2e79);};}exports[_0x7383('0x1e')]=function(_0x523525,_0x313cb0){var _0x5eaf6a={};var _0x4c3e40={'count':0x0,'rows':[]};var _0x388964=_[_0x7383('0x1f')](db[_0x7383('0x20')][_0x7383('0x21')],function(_0x4a1840){return{'name':_0x4a1840[_0x7383('0x22')],'type':_0x4a1840['type'][_0x7383('0x23')]};});_0x5eaf6a=qs[_0x7383('0x24')](_0x388964,_0x523525);var _0x15717e={'where':_0x5eaf6a[_0x7383('0x25')]};return db[_0x7383('0x20')][_0x7383('0x13')](_0x15717e)[_0x7383('0x17')](function(_0x43f7a5){_0x4c3e40[_0x7383('0x13')]=_0x43f7a5;_0x5eaf6a[_0x7383('0x26')]=qs['include'](_0x523525[_0x7383('0x27')]);return db[_0x7383('0x20')]['findAll'](_0x5eaf6a);})['then'](function(_0x4bdff3){_0x4c3e40[_0x7383('0x28')]=_0x4bdff3;return _0x4c3e40;})[_0x7383('0x17')](respondWithFilteredResult(_0x313cb0,_0x5eaf6a))[_0x7383('0x29')](handleError(_0x313cb0,null));};exports[_0x7383('0x2a')]=function(_0x2a61d7,_0x265298){var _0x1cb868={'raw':!![],'where':{'id':_0x2a61d7[_0x7383('0x2b')]['id']}},_0x8b3817={};_0x8b3817[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x20')][_0x7383('0x21')]);_0x8b3817[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x2a61d7[_0x7383('0x27')]);_0x8b3817[_0x7383('0x2e')]=_[_0x7383('0x2f')](_0x8b3817[_0x7383('0x2c')],_0x8b3817[_0x7383('0x27')]);_0x1cb868['attributes']=_[_0x7383('0x2f')](_0x8b3817[_0x7383('0x2c')],qs['fields'](_0x2a61d7[_0x7383('0x27')][_0x7383('0x30')]));_0x1cb868[_0x7383('0x31')]=_0x1cb868[_0x7383('0x31')][_0x7383('0x32')]?_0x1cb868['attributes']:_0x8b3817[_0x7383('0x2c')];if(_0x2a61d7[_0x7383('0x27')][_0x7383('0x33')]){_0x1cb868[_0x7383('0x26')]=[{'all':!![]}];}_0x1cb868=_[_0x7383('0x34')]({},_0x1cb868,_0x2a61d7[_0x7383('0x35')]);return db[_0x7383('0x20')]['find'](_0x1cb868)['then'](handleEntityNotFound(_0x265298,null))['then'](respondWithResult(_0x265298,null))[_0x7383('0x29')](handleError(_0x265298,null));};exports[_0x7383('0x36')]=function(_0x212d5b,_0x3d71dc){return db[_0x7383('0x20')][_0x7383('0x36')](_0x212d5b[_0x7383('0x37')],{})[_0x7383('0x17')](function(_0x320cde){var _0x4f307a=_0x212d5b[_0x7383('0x38')][_0x7383('0x18')]({'plain':!![]});if(!_0x4f307a)throw new Error(_0x7383('0x39'));if(_0x4f307a[_0x7383('0x3a')]===_0x7383('0x38')){var _0x34f585=_0x320cde['get']({'plain':!![]});var _0x32a9a7='FaxQueues';return db['UserProfileSection'][_0x7383('0x3b')]({'where':{'name':_0x32a9a7,'userProfileId':_0x4f307a[_0x7383('0x3c')]},'raw':!![]})[_0x7383('0x17')](function(_0x3f14a6){if(_0x3f14a6&&_0x3f14a6[_0x7383('0x3d')]===0x0){return db['UserProfileResource']['create']({'name':_0x34f585[_0x7383('0x1c')],'resourceId':_0x34f585['id'],'type':_0x3f14a6[_0x7383('0x1c')],'sectionId':_0x3f14a6['id']},{})['then'](function(){return _0x320cde;});}else{return _0x320cde;}})['catch'](function(_0x271cd5){logger[_0x7383('0x1b')](_0x7383('0x3e'),_0x271cd5);throw _0x271cd5;});}return _0x320cde;})[_0x7383('0x17')](respondWithResult(_0x3d71dc,0xc9))[_0x7383('0x29')](handleError(_0x3d71dc,null));};exports['update']=function(_0x141728,_0x5d9085){if(_0x141728[_0x7383('0x37')]['id']){delete _0x141728[_0x7383('0x37')]['id'];}return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x141728['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x5d9085,null))[_0x7383('0x17')](saveUpdates(_0x141728[_0x7383('0x37')],null))[_0x7383('0x17')](respondWithResult(_0x5d9085,null))['catch'](handleError(_0x5d9085,null));};exports[_0x7383('0x16')]=function(_0x308a0f,_0xf5e74d){return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x308a0f[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0xf5e74d,null))[_0x7383('0x17')](removeEntity(_0xf5e74d,null))[_0x7383('0x29')](handleError(_0xf5e74d,null));};exports[_0x7383('0x3f')]=function(_0x3efb4e,_0x2ca610){return db[_0x7383('0x20')]['describe']()[_0x7383('0x17')](respondWithResult(_0x2ca610,null))['catch'](handleError(_0x2ca610,null));};exports[_0x7383('0x40')]=function(_0x322af1,_0x40b29a){var _0x577526={'raw':!![],'where':{}},_0x163343={},_0x2c0e53;return db['FaxQueue'][_0x7383('0x41')]({'where':{'id':_0x322af1['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x40b29a,null))['then'](function(_0x39fe70){if(_0x39fe70){_0x2c0e53=_0x39fe70['get']({'plain':!![]});_0x163343[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x42')]['rawAttributes']);_0x163343[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x322af1[_0x7383('0x27')]);_0x163343['filters']=_['intersection'](_0x163343[_0x7383('0x2c')],_0x163343[_0x7383('0x27')]);_0x577526[_0x7383('0x31')]=_[_0x7383('0x2f')](_0x163343[_0x7383('0x2c')],qs[_0x7383('0x30')](_0x322af1[_0x7383('0x27')][_0x7383('0x30')]));_0x577526[_0x7383('0x31')]=_0x577526[_0x7383('0x31')]['length']?_0x577526[_0x7383('0x31')]:_0x163343[_0x7383('0x2c')];if(!_0x322af1[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x577526['limit']=qs[_0x7383('0x12')](_0x322af1[_0x7383('0x27')]['limit']);_0x577526[_0x7383('0x10')]=qs[_0x7383('0x10')](_0x322af1[_0x7383('0x27')][_0x7383('0x10')]);}_0x577526[_0x7383('0x45')]=qs[_0x7383('0x46')](_0x322af1[_0x7383('0x27')][_0x7383('0x46')]);_0x577526[_0x7383('0x25')]=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x322af1[_0x7383('0x27')],_0x163343[_0x7383('0x2e')]));_0x577526[_0x7383('0x25')]['FaxQueueId']=_0x39fe70['id'];if(_0x322af1[_0x7383('0x27')]['filter']){_0x577526[_0x7383('0x25')]=_[_0x7383('0x34')](_0x577526['where'],{'$or':_[_0x7383('0x1f')](_0x577526[_0x7383('0x31')],function(_0x1188c8){var _0x56abd5={};_0x56abd5[_0x1188c8]={'$like':'%'+_0x322af1[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x56abd5;})});}_0x577526=_[_0x7383('0x34')]({},_0x577526,_0x322af1['options']);return db[_0x7383('0x42')]['findAll'](_0x577526);}})[_0x7383('0x17')](function(_0x5b3431){if(_0x5b3431){return db[_0x7383('0x49')][_0x7383('0x4a')]({'where':{'id':_[_0x7383('0x1f')](_0x5b3431,_0x7383('0x4b')),'role':'agent'},'attributes':['id',_0x7383('0x1c'),'faxPause','updatedAt','createdAt']});}})[_0x7383('0x17')](function(_0x3c00b7){if(_0x3c00b7){return{'count':_0x3c00b7[_0x7383('0x13')],'rows':_[_0x7383('0x1f')](_0x3c00b7[_0x7383('0x28')],function(_0xb3cc23){return{'membername':_0xb3cc23[_0x7383('0x1c')],'UserId':_0xb3cc23['id'],'queue_name':_0x2c0e53['name'],'FaxQueueId':_0x2c0e53['id'],'interface':util['format'](_0x7383('0x4c'),'SIP',_0xb3cc23[_0x7383('0x1c')]),'penalty':0x0,'paused':_0xb3cc23[_0x7383('0x4d')],'createdAt':_0xb3cc23[_0x7383('0x4e')],'updatedAt':_0xb3cc23['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x40b29a,_0x577526))[_0x7383('0x29')](handleError(_0x40b29a,null));};exports[_0x7383('0x4f')]=function(_0x36dee6,_0x2796b7){var _0x3965f8={};var _0x2d888f={};var _0x1676f8;var _0x397b41;return db['FaxQueue'][_0x7383('0x41')]({'where':{'id':_0x36dee6[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x2796b7,null))[_0x7383('0x17')](function(_0x35d228){if(_0x35d228){_0x1676f8=_0x35d228;_0x2d888f[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x50')][_0x7383('0x21')]);_0x2d888f[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x36dee6[_0x7383('0x27')]);_0x2d888f[_0x7383('0x2e')]=_[_0x7383('0x2f')](_0x2d888f['model'],_0x2d888f[_0x7383('0x27')]);_0x3965f8[_0x7383('0x31')]=_[_0x7383('0x2f')](_0x2d888f[_0x7383('0x2c')],qs[_0x7383('0x30')](_0x36dee6[_0x7383('0x27')][_0x7383('0x30')]));_0x3965f8[_0x7383('0x31')]=_0x3965f8['attributes'][_0x7383('0x32')]?_0x3965f8[_0x7383('0x31')]:_0x2d888f['model'];_0x3965f8[_0x7383('0x45')]=qs[_0x7383('0x46')](_0x36dee6[_0x7383('0x27')][_0x7383('0x46')]);_0x3965f8['where']=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x36dee6['query'],_0x2d888f[_0x7383('0x2e')]));if(_0x36dee6[_0x7383('0x27')][_0x7383('0x48')]){_0x3965f8['where']=_[_0x7383('0x34')](_0x3965f8[_0x7383('0x25')],{'$or':_[_0x7383('0x1f')](_0x3965f8[_0x7383('0x31')],function(_0x44578c){var _0x1c00f8={};_0x1c00f8[_0x44578c]={'$like':'%'+_0x36dee6[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x1c00f8;})});}_0x3965f8=_[_0x7383('0x34')]({},_0x3965f8,_0x36dee6['options']);return _0x1676f8[_0x7383('0x4f')](_0x3965f8);}})[_0x7383('0x17')](function(_0x15aab7){if(_0x15aab7){_0x397b41=_0x15aab7['length'];if(!_0x36dee6[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x3965f8[_0x7383('0x12')]=qs[_0x7383('0x12')](_0x36dee6['query']['limit']);_0x3965f8['offset']=qs['offset'](_0x36dee6[_0x7383('0x27')][_0x7383('0x10')]);}return _0x1676f8[_0x7383('0x4f')](_0x3965f8);}})[_0x7383('0x17')](function(_0x44de91){if(_0x44de91){return _0x44de91?{'count':_0x397b41,'rows':_0x44de91}:null;}})[_0x7383('0x17')](respondWithResult(_0x2796b7,null))['catch'](handleError(_0x2796b7,null));};exports[_0x7383('0x51')]=function(_0x3b777c,_0x2b032f){var _0x3dd528=_0x3b777c[_0x7383('0x37')][_0x7383('0x52')];return db[_0x7383('0x50')]['findAll']({'where':{'id':_0x3dd528},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7383('0x1c'),_0x7383('0x53'),_0x7383('0x54'),'interface'],'raw':!![]}]})[_0x7383('0x17')](function(_0x234f3b){if(_0x234f3b){var _0x333d72=_['flatMap'](_0x234f3b,function(_0x351c8a){var _0x34d614=_0x351c8a[_0x7383('0x18')]({'plain':!![]});return _0x34d614['Agents'];});return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x3b777c[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](function(_0x3633ae){return db[_0x7383('0x55')]['transaction'](function(_0x3d6aa7){return _0x3633ae[_0x7383('0x51')](_0x3dd528,{'transaction':_0x3d6aa7})['then'](function(){return BPromise[_0x7383('0x56')](_0x333d72,function(_0x438028){return db['UserFaxQueue'][_0x7383('0x57')]({'where':{'UserId':_0x438028['id'],'FaxQueueId':_0x3b777c[_0x7383('0x2b')]['id']},'transaction':_0x3d6aa7});});})[_0x7383('0x17')](function(){_0x333d72[_0x7383('0x58')](function(_0x3f7130){socket[_0x7383('0x59')]('userFaxQueue:save',{'UserId':_0x3f7130['id'],'FaxQueueId':_0x3633ae['id']});});});});});}})['then'](respondWithStatusCode(_0x2b032f,null))[_0x7383('0x29')](handleError(_0x2b032f,null));};exports[_0x7383('0x5a')]=function(_0x39be07,_0x1102be){return db[_0x7383('0x50')][_0x7383('0x5b')]({'where':{'id':_0x39be07[_0x7383('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7383('0x49')],'as':_0x7383('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x7383('0x17')](handleEntityNotFound(_0x1102be,null))['then'](function(_0x3b444a){var _0x1c5f94=_[_0x7383('0x1f')](_0x3b444a,'id');var _0x3b569f=[];var _0x165841=[];var _0x2b4804=squel[_0x7383('0x5d')]();_0x2b4804[_0x7383('0x5e')](_0x7383('0x5f'))[_0x7383('0x60')](_0x7383('0x61'),'tq')[_0x7383('0x62')]('user_has_teams','ut',_0x7383('0x63'))[_0x7383('0x25')](_0x7383('0x64'),_0x39be07[_0x7383('0x2b')]['id']);for(var _0x407a06=0x0;_0x407a06<_0x3b444a[_0x7383('0x32')];_0x407a06+=0x1){let _0x1ddbbb=_0x3b444a[_0x407a06];for(var _0x164008=0x0;_0x164008<_0x1ddbbb['Agents'][_0x7383('0x32')];_0x164008+=0x1){let _0x37ed30=_0x1ddbbb['Agents'][_0x164008];var _0x18da01=_0x2b4804[_0x7383('0x65')]();_0x18da01['where']('ut.UserId\x20=\x20?',_0x37ed30['id']);_0x165841[_0x7383('0x66')](db[_0x7383('0x55')]['query'](_0x18da01['toString'](),{'type':db[_0x7383('0x55')][_0x7383('0x67')][_0x7383('0x68')]})['then'](function(_0x5b17a9){if(_0x5b17a9[_0x7383('0x32')]===0x1){return _0x37ed30['id'];}else{var _0x5543d8=_['every'](_[_0x7383('0x1f')](_0x5b17a9,_0x7383('0x69')),function(_0x4d9afb){return _[_0x7383('0x6a')](_0x1c5f94,_0x4d9afb);});if(_0x5543d8){return _0x37ed30['id'];}}}));}}return BPromise[_0x7383('0x6b')](_0x165841)[_0x7383('0x17')](function(_0x2b3b1d){_0x3b569f=_(_0x3b569f)['union'](_0x2b3b1d)[_0x7383('0x6c')]()[_0x7383('0x6d')]();return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x39be07[_0x7383('0x2b')]['id']}})['then'](function(_0x187555){return db[_0x7383('0x55')][_0x7383('0x6e')](function(_0x3c3fde){return _0x187555[_0x7383('0x5a')](_0x39be07[_0x7383('0x27')][_0x7383('0x52')],{'transaction':_0x3c3fde})[_0x7383('0x17')](function(){if(!_[_0x7383('0x6f')](_0x3b569f)){return _0x187555[_0x7383('0x70')](_0x3b569f,{'transaction':_0x3c3fde});}})[_0x7383('0x17')](function(){_0x3b569f[_0x7383('0x58')](function(_0x126d7b){socket['emit'](_0x7383('0x71'),{'UserId':_0x126d7b,'FaxQueueId':_0x187555['id']});});});});});});})[_0x7383('0x17')](respondWithStatusCode(_0x1102be,null))['catch'](handleError(_0x1102be,null));};exports[_0x7383('0x72')]=function(_0x3d5f5c,_0xafcae){return db['FaxQueue']['find']({'where':{'id':_0x3d5f5c[_0x7383('0x2b')]['id']}})[_0x7383('0x17')](handleEntityNotFound(_0xafcae,null))[_0x7383('0x17')](function(_0x150ea6){if(_0x150ea6){return _0x150ea6[_0x7383('0x72')](_0x3d5f5c[_0x7383('0x37')][_0x7383('0x52')],_[_0x7383('0x73')](_0x3d5f5c[_0x7383('0x37')],[_0x7383('0x52'),'id'])||{})[_0x7383('0x74')](function(_0x29e347){for(var _0x4c635b=0x0;_0x4c635b<_0x3d5f5c[_0x7383('0x37')][_0x7383('0x52')][_0x7383('0x32')];_0x4c635b+=0x1){socket[_0x7383('0x59')]('userFaxQueue:save',{'UserId':Number(_0x3d5f5c[_0x7383('0x37')]['ids'][_0x4c635b]),'FaxQueueId':Number(_0x3d5f5c[_0x7383('0x2b')]['id'])});}return _0x29e347;});}})[_0x7383('0x17')](respondWithResult(_0xafcae,null))[_0x7383('0x29')](handleError(_0xafcae,null));};exports[_0x7383('0x70')]=function(_0x9974d3,_0x66aef3){return db[_0x7383('0x20')][_0x7383('0x3b')]({'where':{'id':_0x9974d3['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x66aef3,null))['then'](function(_0x1cbd71){if(_0x1cbd71){return _0x1cbd71[_0x7383('0x70')](_0x9974d3['query'][_0x7383('0x52')])[_0x7383('0x17')](function(){if(_['isArray'](_0x9974d3['query'][_0x7383('0x52')])){for(var _0xd40792=0x0;_0xd40792<_0x9974d3[_0x7383('0x27')][_0x7383('0x52')]['length'];_0xd40792+=0x1){socket[_0x7383('0x59')](_0x7383('0x71'),{'UserId':Number(_0x9974d3['query']['ids'][_0xd40792]),'FaxQueueId':Number(_0x9974d3[_0x7383('0x2b')]['id'])});}}else{socket['emit'](_0x7383('0x71'),{'UserId':Number(_0x9974d3[_0x7383('0x27')][_0x7383('0x52')]),'FaxQueueId':Number(_0x9974d3[_0x7383('0x2b')]['id'])});}});}})[_0x7383('0x17')](respondWithStatusCode(_0x66aef3,null))['catch'](handleError(_0x66aef3,null));};exports['getAgents']=function(_0x50f878,_0x431647){var _0x17f379={};var _0x3a0f3b={};var _0x516b2c;var _0x280634;return db[_0x7383('0x20')][_0x7383('0x41')]({'where':{'id':_0x50f878['params']['id']}})[_0x7383('0x17')](handleEntityNotFound(_0x431647,null))[_0x7383('0x17')](function(_0x488515){if(_0x488515){_0x516b2c=_0x488515;_0x3a0f3b[_0x7383('0x2c')]=_[_0x7383('0x2d')](db[_0x7383('0x49')]['rawAttributes']);_0x3a0f3b[_0x7383('0x27')]=_[_0x7383('0x2d')](_0x50f878['query']);_0x3a0f3b['filters']=_[_0x7383('0x2f')](_0x3a0f3b[_0x7383('0x2c')],_0x3a0f3b['query']);_0x17f379[_0x7383('0x31')]=_['intersection'](_0x3a0f3b[_0x7383('0x2c')],qs['fields'](_0x50f878['query'][_0x7383('0x30')]));_0x17f379['attributes']=_0x17f379[_0x7383('0x31')][_0x7383('0x32')]?_0x17f379[_0x7383('0x31')]:_0x3a0f3b[_0x7383('0x2c')];_0x17f379[_0x7383('0x45')]=qs['sort'](_0x50f878[_0x7383('0x27')]['sort']);_0x17f379[_0x7383('0x25')]=qs[_0x7383('0x2e')](_[_0x7383('0x47')](_0x50f878[_0x7383('0x27')],_0x3a0f3b[_0x7383('0x2e')]));if(_0x50f878[_0x7383('0x27')]['filter']){_0x17f379[_0x7383('0x25')]=_['merge'](_0x17f379[_0x7383('0x25')],{'$or':_['map'](_0x17f379[_0x7383('0x31')],function(_0x25eb8a){var _0x1b9ffb={};_0x1b9ffb[_0x25eb8a]={'$like':'%'+_0x50f878[_0x7383('0x27')][_0x7383('0x48')]+'%'};return _0x1b9ffb;})});}_0x17f379=_[_0x7383('0x34')]({},_0x17f379,_0x50f878[_0x7383('0x35')]);return _0x516b2c['getAgents'](_0x17f379);}})[_0x7383('0x17')](function(_0x5ea04b){if(_0x5ea04b){_0x280634=_0x5ea04b['length'];if(!_0x50f878[_0x7383('0x27')][_0x7383('0x43')](_0x7383('0x44'))){_0x17f379['limit']=qs[_0x7383('0x12')](_0x50f878[_0x7383('0x27')][_0x7383('0x12')]);_0x17f379['offset']=qs['offset'](_0x50f878[_0x7383('0x27')][_0x7383('0x10')]);}return _0x516b2c[_0x7383('0x75')](_0x17f379);}})[_0x7383('0x17')](function(_0x466319){if(_0x466319){return _0x466319?{'count':_0x280634,'rows':_0x466319}:null;}})[_0x7383('0x17')](respondWithResult(_0x431647,null))[_0x7383('0x29')](handleError(_0x431647,null));}; \ No newline at end of file +var _0xfb67=['offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','name','index','map','FaxQueue','rawAttributes','fieldName','key','getOptions','include','rows','catch','show','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','order','sort','where','pick','FaxQueueId','filter','merge','UserFaxQueue','findAll','findAndCountAll','UserId','agent','faxPause','updatedAt','%s/%s','SIP','Team','getTeams','hasOwnProperty','addTeams','User','Agents','voicePause','flatMap','sequelize','emit','userFaxQueue:save','removeTeams','ids','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json'];(function(_0x16a992,_0x4dd40a){var _0x3010c9=function(_0xf57651){while(--_0xf57651){_0x16a992['push'](_0x16a992['shift']());}};_0x3010c9(++_0x4dd40a);}(_0xfb67,0xdd));var _0x7fb6=function(_0x471b91,_0xa094dd){_0x471b91=_0x471b91-0x0;var _0x11f25e=_0xfb67[_0x471b91];return _0x11f25e;};'use strict';var BPromise=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var _=require(_0x7fb6('0x2'));var squel=require(_0x7fb6('0x3'));var Redis=require(_0x7fb6('0x4'));var qs=require(_0x7fb6('0x5'));var logger=require(_0x7fb6('0x6'))('api');var config=require(_0x7fb6('0x7'));var db=require(_0x7fb6('0x8'))['db'];config[_0x7fb6('0x9')]=_[_0x7fb6('0xa')](config[_0x7fb6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fb6('0xb'))(new Redis(config[_0x7fb6('0x9')]));require(_0x7fb6('0xc'))['register'](socket);function respondWithStatusCode(_0x168ebb,_0x696959){_0x696959=_0x696959||0xcc;return function(_0x5103bc){if(_0x5103bc){return _0x168ebb[_0x7fb6('0xd')](_0x696959);}return _0x168ebb[_0x7fb6('0xe')](_0x696959)[_0x7fb6('0xf')]();};}function respondWithResult(_0x55e8a0,_0x25473f){_0x25473f=_0x25473f||0xc8;return function(_0x539c7a){if(_0x539c7a){return _0x55e8a0[_0x7fb6('0xe')](_0x25473f)[_0x7fb6('0x10')](_0x539c7a);}};}function respondWithFilteredResult(_0x973821,_0x3f1569){return function(_0x584517){if(_0x584517){var _0x457196=typeof _0x3f1569[_0x7fb6('0x11')]===_0x7fb6('0x12')&&typeof _0x3f1569['limit']==='undefined';var _0x555e0a=_0x584517['count'];var _0x4fe18e=_0x457196?0x0:_0x3f1569['offset'];var _0x2e8b7c=_0x457196?_0x584517[_0x7fb6('0x13')]:_0x3f1569['offset']+_0x3f1569[_0x7fb6('0x14')];var _0x3e4441;if(_0x2e8b7c>=_0x555e0a){_0x2e8b7c=_0x555e0a;_0x3e4441=0xc8;}else{_0x3e4441=0xce;}_0x973821[_0x7fb6('0xe')](_0x3e4441);return _0x973821[_0x7fb6('0x15')](_0x7fb6('0x16'),_0x4fe18e+'-'+_0x2e8b7c+'/'+_0x555e0a)[_0x7fb6('0x10')](_0x584517);}return null;};}function saveUpdates(_0x3e89c7){return function(_0x33fb18){if(_0x33fb18){return _0x33fb18[_0x7fb6('0x17')](_0x3e89c7)[_0x7fb6('0x18')](function(_0x3ef701){return _0x3ef701;});}return null;};}function removeEntity(_0x2f8b0a){return function(_0x5de506){if(_0x5de506){return _0x5de506[_0x7fb6('0x19')]()[_0x7fb6('0x18')](function(){var _0x234226=_0x5de506[_0x7fb6('0x1a')]({'plain':!![]});var _0x1cfbaa=_0x7fb6('0x1b');return db[_0x7fb6('0x1c')]['destroy']({'where':{'type':_0x1cfbaa,'resourceId':_0x234226['id']}})['then'](function(){return _0x5de506;});})[_0x7fb6('0x18')](function(){_0x2f8b0a[_0x7fb6('0xe')](0xcc)[_0x7fb6('0xf')]();});}};}function handleEntityNotFound(_0x4060c2){return function(_0x5ceef5){if(!_0x5ceef5){_0x4060c2[_0x7fb6('0xd')](0x194);}return _0x5ceef5;};}function handleError(_0x13ad95,_0x490749){_0x490749=_0x490749||0x1f4;return function(_0x189d11){logger['error'](_0x189d11['stack']);if(_0x189d11[_0x7fb6('0x1d')]){delete _0x189d11['name'];}_0x13ad95['status'](_0x490749)['send'](_0x189d11);};}exports[_0x7fb6('0x1e')]=function(_0x51eea5,_0x1f7f92){var _0x4a9866={};var _0x3566a1={'count':0x0,'rows':[]};var _0xc60290=_[_0x7fb6('0x1f')](db[_0x7fb6('0x20')][_0x7fb6('0x21')],function(_0x4c9b90){return{'name':_0x4c9b90[_0x7fb6('0x22')],'type':_0x4c9b90['type'][_0x7fb6('0x23')]};});_0x4a9866=qs[_0x7fb6('0x24')](_0xc60290,_0x51eea5);var _0x578453={'where':_0x4a9866['where']};return db['FaxQueue'][_0x7fb6('0x13')](_0x578453)[_0x7fb6('0x18')](function(_0x35e18f){_0x3566a1[_0x7fb6('0x13')]=_0x35e18f;_0x4a9866[_0x7fb6('0x25')]=qs[_0x7fb6('0x25')](_0x51eea5['query']);return db[_0x7fb6('0x20')]['findAll'](_0x4a9866);})[_0x7fb6('0x18')](function(_0xa114d5){_0x3566a1[_0x7fb6('0x26')]=_0xa114d5;return _0x3566a1;})[_0x7fb6('0x18')](respondWithFilteredResult(_0x1f7f92,_0x4a9866))[_0x7fb6('0x27')](handleError(_0x1f7f92,null));};exports[_0x7fb6('0x28')]=function(_0x39e0c5,_0x4f101b){var _0x188899={'raw':!![],'where':{'id':_0x39e0c5[_0x7fb6('0x29')]['id']}},_0x511a32={};_0x511a32[_0x7fb6('0x2a')]=_[_0x7fb6('0x2b')](db[_0x7fb6('0x20')][_0x7fb6('0x21')]);_0x511a32[_0x7fb6('0x2c')]=_[_0x7fb6('0x2b')](_0x39e0c5[_0x7fb6('0x2c')]);_0x511a32[_0x7fb6('0x2d')]=_['intersection'](_0x511a32[_0x7fb6('0x2a')],_0x511a32[_0x7fb6('0x2c')]);_0x188899[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x511a32['model'],qs['fields'](_0x39e0c5[_0x7fb6('0x2c')][_0x7fb6('0x30')]));_0x188899[_0x7fb6('0x2e')]=_0x188899[_0x7fb6('0x2e')][_0x7fb6('0x31')]?_0x188899['attributes']:_0x511a32[_0x7fb6('0x2a')];if(_0x39e0c5[_0x7fb6('0x2c')][_0x7fb6('0x32')]){_0x188899[_0x7fb6('0x25')]=[{'all':!![]}];}_0x188899=_['merge']({},_0x188899,_0x39e0c5[_0x7fb6('0x33')]);return db[_0x7fb6('0x20')]['find'](_0x188899)[_0x7fb6('0x18')](handleEntityNotFound(_0x4f101b,null))['then'](respondWithResult(_0x4f101b,null))[_0x7fb6('0x27')](handleError(_0x4f101b,null));};exports['create']=function(_0xdc9375,_0x48ec94){return db[_0x7fb6('0x20')][_0x7fb6('0x34')](_0xdc9375[_0x7fb6('0x35')],{})[_0x7fb6('0x18')](function(_0x40a850){var _0x39edfe=_0xdc9375['user']['get']({'plain':!![]});if(!_0x39edfe)throw new Error(_0x7fb6('0x36'));if(_0x39edfe[_0x7fb6('0x37')]===_0x7fb6('0x38')){var _0xa14677=_0x40a850['get']({'plain':!![]});var _0x546008=_0x7fb6('0x1b');return db['UserProfileSection'][_0x7fb6('0x39')]({'where':{'name':_0x546008,'userProfileId':_0x39edfe[_0x7fb6('0x3a')]},'raw':!![]})[_0x7fb6('0x18')](function(_0x33828c){if(_0x33828c&&_0x33828c[_0x7fb6('0x3b')]===0x0){return db[_0x7fb6('0x1c')][_0x7fb6('0x34')]({'name':_0xa14677[_0x7fb6('0x1d')],'resourceId':_0xa14677['id'],'type':_0x33828c['name'],'sectionId':_0x33828c['id']},{})['then'](function(){return _0x40a850;});}else{return _0x40a850;}})[_0x7fb6('0x27')](function(_0x543de3){logger[_0x7fb6('0x3c')](_0x7fb6('0x3d'),_0x543de3);throw _0x543de3;});}return _0x40a850;})[_0x7fb6('0x18')](respondWithResult(_0x48ec94,0xc9))[_0x7fb6('0x27')](handleError(_0x48ec94,null));};exports[_0x7fb6('0x17')]=function(_0x3b77ba,_0x1dbfb8){if(_0x3b77ba[_0x7fb6('0x35')]['id']){delete _0x3b77ba['body']['id'];}return db['FaxQueue'][_0x7fb6('0x39')]({'where':{'id':_0x3b77ba['params']['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x1dbfb8,null))['then'](saveUpdates(_0x3b77ba[_0x7fb6('0x35')],null))[_0x7fb6('0x18')](respondWithResult(_0x1dbfb8,null))['catch'](handleError(_0x1dbfb8,null));};exports[_0x7fb6('0x19')]=function(_0x2e3bea,_0x30aeee){return db[_0x7fb6('0x20')][_0x7fb6('0x39')]({'where':{'id':_0x2e3bea[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x30aeee,null))[_0x7fb6('0x18')](removeEntity(_0x30aeee,null))[_0x7fb6('0x27')](handleError(_0x30aeee,null));};exports['describe']=function(_0xd593a5,_0x4f1011){return db[_0x7fb6('0x20')][_0x7fb6('0x3e')]()['then'](respondWithResult(_0x4f1011,null))[_0x7fb6('0x27')](handleError(_0x4f1011,null));};exports[_0x7fb6('0x3f')]=function(_0x2c2d90,_0x4e952f){var _0x3179af={'raw':!![],'where':{}},_0x4e8501={},_0x328c1a;return db[_0x7fb6('0x20')][_0x7fb6('0x40')]({'where':{'id':_0x2c2d90[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x4e952f,null))[_0x7fb6('0x18')](function(_0x35210f){if(_0x35210f){_0x328c1a=_0x35210f[_0x7fb6('0x1a')]({'plain':!![]});_0x4e8501['model']=_[_0x7fb6('0x2b')](db['UserFaxQueue'][_0x7fb6('0x21')]);_0x4e8501['query']=_[_0x7fb6('0x2b')](_0x2c2d90['query']);_0x4e8501[_0x7fb6('0x2d')]=_[_0x7fb6('0x2f')](_0x4e8501['model'],_0x4e8501[_0x7fb6('0x2c')]);_0x3179af[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x4e8501[_0x7fb6('0x2a')],qs[_0x7fb6('0x30')](_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x30')]));_0x3179af[_0x7fb6('0x2e')]=_0x3179af[_0x7fb6('0x2e')][_0x7fb6('0x31')]?_0x3179af[_0x7fb6('0x2e')]:_0x4e8501[_0x7fb6('0x2a')];if(!_0x2c2d90['query']['hasOwnProperty'](_0x7fb6('0x41'))){_0x3179af['limit']=qs[_0x7fb6('0x14')](_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x14')]);_0x3179af[_0x7fb6('0x11')]=qs['offset'](_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x11')]);}_0x3179af[_0x7fb6('0x42')]=qs['sort'](_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x43')]);_0x3179af[_0x7fb6('0x44')]=qs['filters'](_[_0x7fb6('0x45')](_0x2c2d90['query'],_0x4e8501[_0x7fb6('0x2d')]));_0x3179af[_0x7fb6('0x44')][_0x7fb6('0x46')]=_0x35210f['id'];if(_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x47')]){_0x3179af['where']=_[_0x7fb6('0x48')](_0x3179af[_0x7fb6('0x44')],{'$or':_[_0x7fb6('0x1f')](_0x3179af[_0x7fb6('0x2e')],function(_0x36f403){var _0x57dbd7={};_0x57dbd7[_0x36f403]={'$like':'%'+_0x2c2d90[_0x7fb6('0x2c')][_0x7fb6('0x47')]+'%'};return _0x57dbd7;})});}_0x3179af=_[_0x7fb6('0x48')]({},_0x3179af,_0x2c2d90['options']);return db[_0x7fb6('0x49')][_0x7fb6('0x4a')](_0x3179af);}})[_0x7fb6('0x18')](function(_0xfeec1c){if(_0xfeec1c){return db['User'][_0x7fb6('0x4b')]({'where':{'id':_['map'](_0xfeec1c,_0x7fb6('0x4c')),'role':_0x7fb6('0x4d')},'attributes':['id',_0x7fb6('0x1d'),_0x7fb6('0x4e'),_0x7fb6('0x4f'),'createdAt']});}})[_0x7fb6('0x18')](function(_0x4727cf){if(_0x4727cf){return{'count':_0x4727cf['count'],'rows':_[_0x7fb6('0x1f')](_0x4727cf[_0x7fb6('0x26')],function(_0x4dc5b3){return{'membername':_0x4dc5b3[_0x7fb6('0x1d')],'UserId':_0x4dc5b3['id'],'queue_name':_0x328c1a[_0x7fb6('0x1d')],'FaxQueueId':_0x328c1a['id'],'interface':util['format'](_0x7fb6('0x50'),_0x7fb6('0x51'),_0x4dc5b3[_0x7fb6('0x1d')]),'penalty':0x0,'paused':_0x4dc5b3[_0x7fb6('0x4e')],'createdAt':_0x4dc5b3['createdAt'],'updatedAt':_0x4dc5b3[_0x7fb6('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7fb6('0x18')](respondWithFilteredResult(_0x4e952f,_0x3179af))['catch'](handleError(_0x4e952f,null));};exports['getTeams']=function(_0x127719,_0x10cbc7){var _0x3f4734={};var _0x5e50db={};var _0x314a65;var _0x3d3aaf;return db[_0x7fb6('0x20')][_0x7fb6('0x40')]({'where':{'id':_0x127719[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x10cbc7,null))[_0x7fb6('0x18')](function(_0x35e9c8){if(_0x35e9c8){_0x314a65=_0x35e9c8;_0x5e50db[_0x7fb6('0x2a')]=_[_0x7fb6('0x2b')](db[_0x7fb6('0x52')][_0x7fb6('0x21')]);_0x5e50db[_0x7fb6('0x2c')]=_[_0x7fb6('0x2b')](_0x127719[_0x7fb6('0x2c')]);_0x5e50db[_0x7fb6('0x2d')]=_['intersection'](_0x5e50db[_0x7fb6('0x2a')],_0x5e50db[_0x7fb6('0x2c')]);_0x3f4734[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x5e50db[_0x7fb6('0x2a')],qs[_0x7fb6('0x30')](_0x127719['query'][_0x7fb6('0x30')]));_0x3f4734[_0x7fb6('0x2e')]=_0x3f4734[_0x7fb6('0x2e')][_0x7fb6('0x31')]?_0x3f4734[_0x7fb6('0x2e')]:_0x5e50db['model'];_0x3f4734[_0x7fb6('0x42')]=qs[_0x7fb6('0x43')](_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x43')]);_0x3f4734['where']=qs[_0x7fb6('0x2d')](_[_0x7fb6('0x45')](_0x127719[_0x7fb6('0x2c')],_0x5e50db[_0x7fb6('0x2d')]));if(_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x47')]){_0x3f4734[_0x7fb6('0x44')]=_['merge'](_0x3f4734[_0x7fb6('0x44')],{'$or':_[_0x7fb6('0x1f')](_0x3f4734[_0x7fb6('0x2e')],function(_0x3336a0){var _0x46cf28={};_0x46cf28[_0x3336a0]={'$like':'%'+_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x47')]+'%'};return _0x46cf28;})});}_0x3f4734=_[_0x7fb6('0x48')]({},_0x3f4734,_0x127719[_0x7fb6('0x33')]);return _0x314a65[_0x7fb6('0x53')](_0x3f4734);}})['then'](function(_0x582b0e){if(_0x582b0e){_0x3d3aaf=_0x582b0e[_0x7fb6('0x31')];if(!_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x54')](_0x7fb6('0x41'))){_0x3f4734[_0x7fb6('0x14')]=qs[_0x7fb6('0x14')](_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x14')]);_0x3f4734[_0x7fb6('0x11')]=qs[_0x7fb6('0x11')](_0x127719[_0x7fb6('0x2c')][_0x7fb6('0x11')]);}return _0x314a65[_0x7fb6('0x53')](_0x3f4734);}})[_0x7fb6('0x18')](function(_0x3d22f9){if(_0x3d22f9){return _0x3d22f9?{'count':_0x3d3aaf,'rows':_0x3d22f9}:null;}})['then'](respondWithResult(_0x10cbc7,null))[_0x7fb6('0x27')](handleError(_0x10cbc7,null));};exports[_0x7fb6('0x55')]=function(_0x290200,_0xb1dd45){var _0x59806f=_0x290200['body']['ids'];return db[_0x7fb6('0x52')][_0x7fb6('0x4a')]({'where':{'id':_0x59806f},'attributes':['id'],'include':[{'model':db[_0x7fb6('0x56')],'as':_0x7fb6('0x57'),'attributes':['id',_0x7fb6('0x1d'),'online',_0x7fb6('0x58'),'interface'],'raw':!![]}]})[_0x7fb6('0x18')](function(_0xfd043b){if(_0xfd043b){var _0x30ad2c=_[_0x7fb6('0x59')](_0xfd043b,function(_0x1181ef){var _0x28b740=_0x1181ef['get']({'plain':!![]});return _0x28b740[_0x7fb6('0x57')];});return db['FaxQueue'][_0x7fb6('0x39')]({'where':{'id':_0x290200[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](function(_0x3d2f09){return db[_0x7fb6('0x5a')]['transaction'](function(_0x40fb9b){return _0x3d2f09[_0x7fb6('0x55')](_0x59806f,{'transaction':_0x40fb9b})[_0x7fb6('0x18')](function(){return BPromise['each'](_0x30ad2c,function(_0xfcb0e8){return db[_0x7fb6('0x49')]['findOrCreate']({'where':{'UserId':_0xfcb0e8['id'],'FaxQueueId':_0x290200[_0x7fb6('0x29')]['id']},'transaction':_0x40fb9b});});})[_0x7fb6('0x18')](function(){_0x30ad2c['forEach'](function(_0x489a0e){socket[_0x7fb6('0x5b')](_0x7fb6('0x5c'),{'UserId':_0x489a0e['id'],'FaxQueueId':_0x3d2f09['id']});});});});});}})['then'](respondWithStatusCode(_0xb1dd45,null))[_0x7fb6('0x27')](handleError(_0xb1dd45,null));};exports[_0x7fb6('0x5d')]=function(_0x1818c5,_0x4503ff){return db[_0x7fb6('0x52')][_0x7fb6('0x4a')]({'where':{'id':_0x1818c5[_0x7fb6('0x2c')][_0x7fb6('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x7fb6('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4503ff,null))['then'](function(_0x2780a9){var _0x340b48=_[_0x7fb6('0x1f')](_0x2780a9,'id');var _0x3a89eb=[];var _0x1391c1=[];var _0x28df2d=squel[_0x7fb6('0x5f')]();_0x28df2d[_0x7fb6('0x60')]('tq.TeamId')[_0x7fb6('0x61')](_0x7fb6('0x62'),'tq')[_0x7fb6('0x63')](_0x7fb6('0x64'),'ut',_0x7fb6('0x65'))[_0x7fb6('0x44')](_0x7fb6('0x66'),_0x1818c5[_0x7fb6('0x29')]['id']);for(var _0x3a5ac4=0x0;_0x3a5ac4<_0x2780a9[_0x7fb6('0x31')];_0x3a5ac4+=0x1){let _0x2be84a=_0x2780a9[_0x3a5ac4];for(var _0x527558=0x0;_0x527558<_0x2be84a[_0x7fb6('0x57')][_0x7fb6('0x31')];_0x527558+=0x1){let _0x42945e=_0x2be84a[_0x7fb6('0x57')][_0x527558];var _0x49f401=_0x28df2d['clone']();_0x49f401[_0x7fb6('0x44')](_0x7fb6('0x67'),_0x42945e['id']);_0x1391c1[_0x7fb6('0x68')](db[_0x7fb6('0x5a')][_0x7fb6('0x2c')](_0x49f401[_0x7fb6('0x69')](),{'type':db['sequelize'][_0x7fb6('0x6a')]['SELECT']})[_0x7fb6('0x18')](function(_0x1d4870){if(_0x1d4870[_0x7fb6('0x31')]===0x1){return _0x42945e['id'];}else{var _0x5b5079=_[_0x7fb6('0x6b')](_[_0x7fb6('0x1f')](_0x1d4870,'TeamId'),function(_0x1e2e2d){return _['includes'](_0x340b48,_0x1e2e2d);});if(_0x5b5079){return _0x42945e['id'];}}}));}}return BPromise[_0x7fb6('0x6c')](_0x1391c1)[_0x7fb6('0x18')](function(_0x5c4741){_0x3a89eb=_(_0x3a89eb)[_0x7fb6('0x6d')](_0x5c4741)[_0x7fb6('0x6e')]()[_0x7fb6('0x6f')]();return db['FaxQueue'][_0x7fb6('0x39')]({'where':{'id':_0x1818c5['params']['id']}})['then'](function(_0x2039c9){return db['sequelize']['transaction'](function(_0x286398){return _0x2039c9[_0x7fb6('0x5d')](_0x1818c5[_0x7fb6('0x2c')][_0x7fb6('0x5e')],{'transaction':_0x286398})[_0x7fb6('0x18')](function(){if(!_[_0x7fb6('0x70')](_0x3a89eb)){return _0x2039c9[_0x7fb6('0x71')](_0x3a89eb,{'transaction':_0x286398});}})[_0x7fb6('0x18')](function(){_0x3a89eb[_0x7fb6('0x72')](function(_0x222336){socket[_0x7fb6('0x5b')](_0x7fb6('0x73'),{'UserId':_0x222336,'FaxQueueId':_0x2039c9['id']});});});});});});})[_0x7fb6('0x18')](respondWithStatusCode(_0x4503ff,null))[_0x7fb6('0x27')](handleError(_0x4503ff,null));};exports[_0x7fb6('0x74')]=function(_0x3af6d5,_0x29f66c){return db[_0x7fb6('0x20')]['find']({'where':{'id':_0x3af6d5[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x29f66c,null))[_0x7fb6('0x18')](function(_0x5ccb6f){if(_0x5ccb6f){return _0x5ccb6f['addAgents'](_0x3af6d5[_0x7fb6('0x35')][_0x7fb6('0x5e')],_['omit'](_0x3af6d5[_0x7fb6('0x35')],[_0x7fb6('0x5e'),'id'])||{})[_0x7fb6('0x75')](function(_0xa412d9){for(var _0x200857=0x0;_0x200857<_0x3af6d5['body'][_0x7fb6('0x5e')][_0x7fb6('0x31')];_0x200857+=0x1){socket[_0x7fb6('0x5b')](_0x7fb6('0x5c'),{'UserId':Number(_0x3af6d5['body'][_0x7fb6('0x5e')][_0x200857]),'FaxQueueId':Number(_0x3af6d5[_0x7fb6('0x29')]['id'])});}return _0xa412d9;});}})[_0x7fb6('0x18')](respondWithResult(_0x29f66c,null))[_0x7fb6('0x27')](handleError(_0x29f66c,null));};exports['removeAgents']=function(_0x4b94ad,_0x1242bd){return db[_0x7fb6('0x20')][_0x7fb6('0x39')]({'where':{'id':_0x4b94ad[_0x7fb6('0x29')]['id']}})[_0x7fb6('0x18')](handleEntityNotFound(_0x1242bd,null))[_0x7fb6('0x18')](function(_0x713ebc){if(_0x713ebc){return _0x713ebc[_0x7fb6('0x71')](_0x4b94ad[_0x7fb6('0x2c')][_0x7fb6('0x5e')])[_0x7fb6('0x18')](function(){if(_['isArray'](_0x4b94ad[_0x7fb6('0x2c')][_0x7fb6('0x5e')])){for(var _0xe53ab3=0x0;_0xe53ab3<_0x4b94ad[_0x7fb6('0x2c')][_0x7fb6('0x5e')]['length'];_0xe53ab3+=0x1){socket[_0x7fb6('0x5b')](_0x7fb6('0x73'),{'UserId':Number(_0x4b94ad[_0x7fb6('0x2c')][_0x7fb6('0x5e')][_0xe53ab3]),'FaxQueueId':Number(_0x4b94ad[_0x7fb6('0x29')]['id'])});}}else{socket[_0x7fb6('0x5b')](_0x7fb6('0x73'),{'UserId':Number(_0x4b94ad[_0x7fb6('0x2c')]['ids']),'FaxQueueId':Number(_0x4b94ad[_0x7fb6('0x29')]['id'])});}});}})[_0x7fb6('0x18')](respondWithStatusCode(_0x1242bd,null))[_0x7fb6('0x27')](handleError(_0x1242bd,null));};exports[_0x7fb6('0x76')]=function(_0x1b18ac,_0x2c227d){var _0x504a76={};var _0x1a524a={};var _0x3b5aec;var _0x4ee5c1;return db[_0x7fb6('0x20')]['findOne']({'where':{'id':_0x1b18ac[_0x7fb6('0x29')]['id']}})['then'](handleEntityNotFound(_0x2c227d,null))[_0x7fb6('0x18')](function(_0x1164b9){if(_0x1164b9){_0x3b5aec=_0x1164b9;_0x1a524a['model']=_['keys'](db[_0x7fb6('0x56')][_0x7fb6('0x21')]);_0x1a524a['query']=_[_0x7fb6('0x2b')](_0x1b18ac[_0x7fb6('0x2c')]);_0x1a524a[_0x7fb6('0x2d')]=_[_0x7fb6('0x2f')](_0x1a524a['model'],_0x1a524a['query']);_0x504a76[_0x7fb6('0x2e')]=_[_0x7fb6('0x2f')](_0x1a524a['model'],qs['fields'](_0x1b18ac['query'][_0x7fb6('0x30')]));_0x504a76[_0x7fb6('0x2e')]=_0x504a76[_0x7fb6('0x2e')][_0x7fb6('0x31')]?_0x504a76['attributes']:_0x1a524a['model'];_0x504a76[_0x7fb6('0x42')]=qs[_0x7fb6('0x43')](_0x1b18ac[_0x7fb6('0x2c')]['sort']);_0x504a76[_0x7fb6('0x44')]=qs['filters'](_[_0x7fb6('0x45')](_0x1b18ac[_0x7fb6('0x2c')],_0x1a524a[_0x7fb6('0x2d')]));if(_0x1b18ac[_0x7fb6('0x2c')][_0x7fb6('0x47')]){_0x504a76[_0x7fb6('0x44')]=_[_0x7fb6('0x48')](_0x504a76[_0x7fb6('0x44')],{'$or':_[_0x7fb6('0x1f')](_0x504a76[_0x7fb6('0x2e')],function(_0x3f4d92){var _0x26ee59={};_0x26ee59[_0x3f4d92]={'$like':'%'+_0x1b18ac[_0x7fb6('0x2c')][_0x7fb6('0x47')]+'%'};return _0x26ee59;})});}_0x504a76=_[_0x7fb6('0x48')]({},_0x504a76,_0x1b18ac[_0x7fb6('0x33')]);return _0x3b5aec[_0x7fb6('0x76')](_0x504a76);}})[_0x7fb6('0x18')](function(_0x573c14){if(_0x573c14){_0x4ee5c1=_0x573c14[_0x7fb6('0x31')];if(!_0x1b18ac[_0x7fb6('0x2c')][_0x7fb6('0x54')](_0x7fb6('0x41'))){_0x504a76[_0x7fb6('0x14')]=qs[_0x7fb6('0x14')](_0x1b18ac[_0x7fb6('0x2c')][_0x7fb6('0x14')]);_0x504a76['offset']=qs[_0x7fb6('0x11')](_0x1b18ac[_0x7fb6('0x2c')]['offset']);}return _0x3b5aec['getAgents'](_0x504a76);}})[_0x7fb6('0x18')](function(_0xad2405){if(_0xad2405){return _0xad2405?{'count':_0x4ee5c1,'rows':_0xad2405}:null;}})[_0x7fb6('0x18')](respondWithResult(_0x2c227d,null))['catch'](handleError(_0x2c227d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a5999f4..fc11961 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 _0x7303=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x500a85,_0x355900){var _0xa10cee=function(_0x49dada){while(--_0x49dada){_0x500a85['push'](_0x500a85['shift']());}};_0xa10cee(++_0x355900);}(_0x7303,0x17f));var _0x3730=function(_0x57dbf2,_0xc07a4e){_0x57dbf2=_0x57dbf2-0x0;var _0x587ce2=_0x7303[_0x57dbf2];return _0x587ce2;};'use strict';var EventEmitter=require(_0x3730('0x0'));var FaxQueue=require(_0x3730('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3730('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3730('0x3'),'afterDestroy':_0x3730('0x4')};function emitEvent(_0x164050){return function(_0x20da5a,_0x297675,_0x4c3e83){FaxQueueEvents[_0x3730('0x5')](_0x164050+':'+_0x20da5a['id'],_0x20da5a);FaxQueueEvents[_0x3730('0x5')](_0x164050,_0x20da5a);_0x4c3e83(null);};}for(var e in events){if(events[_0x3730('0x6')](e)){var event=events[e];FaxQueue[_0x3730('0x7')](e,emitEvent(event));}}module[_0x3730('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x6842=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','FaxQueue'];(function(_0x3e6f80,_0x37a9bb){var _0x5db877=function(_0x1f2814){while(--_0x1f2814){_0x3e6f80['push'](_0x3e6f80['shift']());}};_0x5db877(++_0x37a9bb);}(_0x6842,0x1ce));var _0x2684=function(_0x321bf7,_0x298f75){_0x321bf7=_0x321bf7-0x0;var _0x59fc1f=_0x6842[_0x321bf7];return _0x59fc1f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x2684('0x0'))['db'][_0x2684('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2684('0x2')](0x0);var events={'afterCreate':_0x2684('0x3'),'afterUpdate':_0x2684('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e658e){return function(_0x459326,_0x2019a2,_0x5462c1){FaxQueueEvents['emit'](_0x3e658e+':'+_0x459326['id'],_0x459326);FaxQueueEvents[_0x2684('0x5')](_0x3e658e,_0x459326);_0x5462c1(null);};}for(var e in events){if(events[_0x2684('0x6')](e)){var event=events[e];FaxQueue[_0x2684('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 e5b25c8..2403562 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 _0xe369=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe369,0x153));var _0x9e36=function(_0x1716b9,_0x43319c){_0x1716b9=_0x1716b9-0x0;var _0x2da359=_0xe369[_0x1716b9];return _0x2da359;};'use strict';var _=require(_0x9e36('0x0'));var util=require(_0x9e36('0x1'));var logger=require(_0x9e36('0x2'))(_0x9e36('0x3'));var moment=require(_0x9e36('0x4'));var BPromise=require(_0x9e36('0x5'));var rp=require(_0x9e36('0x6'));var fs=require('fs');var path=require(_0x9e36('0x7'));var rimraf=require(_0x9e36('0x8'));var config=require(_0x9e36('0x9'));var attributes=require('./faxQueue.attributes');module[_0x9e36('0xa')]=function(_0x2871ed,_0x1a1ab4){return _0x2871ed[_0x9e36('0xb')](_0x9e36('0xc'),attributes,{'tableName':_0x9e36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb061=['../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ca5e4,_0x3290c5){var _0x13f3c1=function(_0x5e991c){while(--_0x5e991c){_0x3ca5e4['push'](_0x3ca5e4['shift']());}};_0x13f3c1(++_0x3290c5);}(_0xb061,0x10a));var _0x1b06=function(_0x134c9b,_0x2b4738){_0x134c9b=_0x134c9b-0x0;var _0x33f38e=_0xb061[_0x134c9b];return _0x33f38e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1b06('0x0'))(_0x1b06('0x1'));var moment=require(_0x1b06('0x2'));var BPromise=require(_0x1b06('0x3'));var rp=require(_0x1b06('0x4'));var fs=require('fs');var path=require(_0x1b06('0x5'));var rimraf=require(_0x1b06('0x6'));var config=require(_0x1b06('0x7'));var attributes=require(_0x1b06('0x8'));module[_0x1b06('0x9')]=function(_0x39c8f8,_0x3285b6){return _0x39c8f8[_0x1b06('0xa')](_0x1b06('0xb'),attributes,{'tableName':_0x1b06('0xc'),'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 928f420..46bae03 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 _0xfed6=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','FaxQueue','options','raw','where','attributes','limit','include','map','model','catch','GetFaxQueue','ShowFaxQueue','find','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxQueue.socket','register','request'];(function(_0x1884bb,_0x81af41){var _0xf2176d=function(_0x5181ab){while(--_0x5181ab){_0x1884bb['push'](_0x1884bb['shift']());}};_0xf2176d(++_0x81af41);}(_0xfed6,0xb7));var _0x6fed=function(_0x10427a,_0x1dfe34){_0x10427a=_0x10427a-0x0;var _0x45e8e2=_0xfed6[_0x10427a];return _0x45e8e2;};'use strict';var _=require(_0x6fed('0x0'));var util=require('util');var moment=require(_0x6fed('0x1'));var BPromise=require(_0x6fed('0x2'));var rs=require(_0x6fed('0x3'));var fs=require('fs');var Redis=require(_0x6fed('0x4'));var db=require(_0x6fed('0x5'))['db'];var utils=require(_0x6fed('0x6'));var logger=require('../../config/logger')(_0x6fed('0x7'));var config=require(_0x6fed('0x8'));var jayson=require(_0x6fed('0x9'));var client=jayson[_0x6fed('0xa')][_0x6fed('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6fed('0xc')],{'host':_0x6fed('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6fed('0xc')]));require(_0x6fed('0xe'))[_0x6fed('0xf')](socket);function respondWithRpcPromise(_0x5e96ad,_0x1fe62e,_0xaf327c){return new BPromise(function(_0x2c9738,_0x3ac557){return client[_0x6fed('0x10')](_0x5e96ad,_0xaf327c)[_0x6fed('0x11')](function(_0x45786b){logger[_0x6fed('0x12')](_0x6fed('0x13'),_0x1fe62e,_0x6fed('0x14'));logger['debug'](_0x6fed('0x15'),_0x1fe62e,'request\x20sent',JSON['stringify'](_0x45786b));if(_0x45786b['error']){if(_0x45786b[_0x6fed('0x16')]['code']===0x1f4){logger[_0x6fed('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1fe62e,_0x45786b[_0x6fed('0x16')]['message']);return _0x3ac557(_0x45786b[_0x6fed('0x16')][_0x6fed('0x17')]);}logger[_0x6fed('0x16')](_0x6fed('0x13'),_0x1fe62e,_0x45786b['error'][_0x6fed('0x17')]);return _0x2c9738(_0x45786b['error']['message']);}else{logger[_0x6fed('0x12')](_0x6fed('0x13'),_0x1fe62e,_0x6fed('0x14'));_0x2c9738(_0x45786b[_0x6fed('0x18')][_0x6fed('0x17')]);}})['catch'](function(_0x2a548b){logger[_0x6fed('0x16')]('FaxQueue,\x20%s,\x20%s',_0x1fe62e,_0x2a548b);_0x3ac557(_0x2a548b);});});}exports['GetFaxQueue']=function(_0xb7b090){var _0x202267=this;return new Promise(function(_0x12d08e,_0x53bb7c){return db[_0x6fed('0x19')]['findAll']({'raw':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090['options'][_0x6fed('0x1b')]===undefined?!![]:![]:!![],'where':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090['options'][_0x6fed('0x1c')]||null:null,'attributes':_0xb7b090['options']?_0xb7b090['options'][_0x6fed('0x1d')]||null:null,'limit':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1e')]||null:null,'include':_0xb7b090[_0x6fed('0x1a')]?_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0xb7b090[_0x6fed('0x1a')][_0x6fed('0x1f')],function(_0x239c97){return{'model':db[_0x239c97[_0x6fed('0x21')]],'as':_0x239c97['as'],'attributes':_0x239c97[_0x6fed('0x1d')],'include':_0x239c97[_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x239c97[_0x6fed('0x1f')],function(_0x3ee2ee){return{'model':db[_0x3ee2ee[_0x6fed('0x21')]],'as':_0x3ee2ee['as'],'attributes':_0x3ee2ee[_0x6fed('0x1d')],'include':_0x3ee2ee[_0x6fed('0x1f')]?_['map'](_0x3ee2ee[_0x6fed('0x1f')],function(_0x1bd024){return{'model':db[_0x1bd024[_0x6fed('0x21')]],'as':_0x1bd024['as'],'attributes':_0x1bd024['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fed('0x11')](function(_0x4c1465){logger[_0x6fed('0x12')]('GetFaxQueue',_0xb7b090);logger['debug']('GetFaxQueue',_0xb7b090,JSON['stringify'](_0x4c1465));_0x12d08e(_0x4c1465);})[_0x6fed('0x22')](function(_0x891cdd){logger[_0x6fed('0x16')](_0x6fed('0x23'),_0x891cdd[_0x6fed('0x17')],_0xb7b090);_0x53bb7c(_0x202267['error'](0x1f4,_0x891cdd[_0x6fed('0x17')]));});});};exports[_0x6fed('0x24')]=function(_0x422f45){var _0xef23af=this;return new Promise(function(_0x5f2152,_0x954c96){return db[_0x6fed('0x19')][_0x6fed('0x25')]({'raw':_0x422f45[_0x6fed('0x1a')]?_0x422f45[_0x6fed('0x1a')][_0x6fed('0x1b')]===undefined?!![]:![]:!![],'where':_0x422f45['options']?_0x422f45[_0x6fed('0x1a')]['where']||null:null,'attributes':_0x422f45['options']?_0x422f45['options'][_0x6fed('0x1d')]||null:null,'include':_0x422f45[_0x6fed('0x1a')]?_0x422f45['options'][_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x422f45['options'][_0x6fed('0x1f')],function(_0x5ae87a){return{'model':db[_0x5ae87a[_0x6fed('0x21')]],'as':_0x5ae87a['as'],'attributes':_0x5ae87a[_0x6fed('0x1d')],'include':_0x5ae87a[_0x6fed('0x1f')]?_[_0x6fed('0x20')](_0x5ae87a[_0x6fed('0x1f')],function(_0x1e885){return{'model':db[_0x1e885[_0x6fed('0x21')]],'as':_0x1e885['as'],'attributes':_0x1e885[_0x6fed('0x1d')],'include':_0x1e885['include']?_[_0x6fed('0x20')](_0x1e885['include'],function(_0xe17b2e){return{'model':db[_0xe17b2e[_0x6fed('0x21')]],'as':_0xe17b2e['as'],'attributes':_0xe17b2e[_0x6fed('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19f2a1){logger[_0x6fed('0x12')]('ShowFaxQueue',_0x422f45);logger[_0x6fed('0x26')](_0x6fed('0x24'),_0x422f45,JSON[_0x6fed('0x27')](_0x19f2a1));_0x5f2152(_0x19f2a1);})['catch'](function(_0x51f7ba){logger[_0x6fed('0x16')](_0x6fed('0x24'),_0x51f7ba[_0x6fed('0x17')],_0x422f45);_0x954c96(_0xef23af['error'](0x1f4,_0x51f7ba[_0x6fed('0x17')]));});});}; \ No newline at end of file +var _0x4dd8=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','map','include','model','stringify','ShowFaxQueue','raw','util','moment','bluebird','ioredis'];(function(_0x14de41,_0x36cf16){var _0x523bd4=function(_0x1ee3e1){while(--_0x1ee3e1){_0x14de41['push'](_0x14de41['shift']());}};_0x523bd4(++_0x36cf16);}(_0x4dd8,0xc4));var _0x84dd=function(_0x538342,_0x8c5a9d){_0x538342=_0x538342-0x0;var _0x15ef61=_0x4dd8[_0x538342];return _0x15ef61;};'use strict';var _=require('lodash');var util=require(_0x84dd('0x0'));var moment=require(_0x84dd('0x1'));var BPromise=require(_0x84dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84dd('0x3'));var db=require(_0x84dd('0x4'))['db'];var utils=require(_0x84dd('0x5'));var logger=require(_0x84dd('0x6'))(_0x84dd('0x7'));var config=require('../../config/environment');var jayson=require(_0x84dd('0x8'));var client=jayson[_0x84dd('0x9')][_0x84dd('0xa')]({'port':0x232a});config[_0x84dd('0xb')]=_[_0x84dd('0xc')](config[_0x84dd('0xb')],{'host':_0x84dd('0xd'),'port':0x18eb});var socket=require(_0x84dd('0xe'))(new Redis(config[_0x84dd('0xb')]));require(_0x84dd('0xf'))[_0x84dd('0x10')](socket);function respondWithRpcPromise(_0x1c81e2,_0x5cee93,_0x12ae31){return new BPromise(function(_0xc8f7d3,_0x3f95da){return client[_0x84dd('0x11')](_0x1c81e2,_0x12ae31)[_0x84dd('0x12')](function(_0x56e7e8){logger[_0x84dd('0x13')](_0x84dd('0x14'),_0x5cee93,_0x84dd('0x15'));logger[_0x84dd('0x16')](_0x84dd('0x17'),_0x5cee93,'request\x20sent',JSON['stringify'](_0x56e7e8));if(_0x56e7e8[_0x84dd('0x18')]){if(_0x56e7e8[_0x84dd('0x18')]['code']===0x1f4){logger[_0x84dd('0x18')](_0x84dd('0x14'),_0x5cee93,_0x56e7e8[_0x84dd('0x18')][_0x84dd('0x19')]);return _0x3f95da(_0x56e7e8[_0x84dd('0x18')][_0x84dd('0x19')]);}logger[_0x84dd('0x18')]('FaxQueue,\x20%s,\x20%s',_0x5cee93,_0x56e7e8['error'][_0x84dd('0x19')]);return _0xc8f7d3(_0x56e7e8[_0x84dd('0x18')]['message']);}else{logger['info'](_0x84dd('0x14'),_0x5cee93,_0x84dd('0x15'));_0xc8f7d3(_0x56e7e8[_0x84dd('0x1a')][_0x84dd('0x19')]);}})[_0x84dd('0x1b')](function(_0x44c85b){logger[_0x84dd('0x18')](_0x84dd('0x14'),_0x5cee93,_0x44c85b);_0x3f95da(_0x44c85b);});});}exports[_0x84dd('0x1c')]=function(_0x243509){var _0xca1d50=this;return new Promise(function(_0x4a6623,_0x3af5af){return db[_0x84dd('0x1d')][_0x84dd('0x1e')]({'raw':_0x243509[_0x84dd('0x1f')]?_0x243509['options']['raw']===undefined?!![]:![]:!![],'where':_0x243509[_0x84dd('0x1f')]?_0x243509[_0x84dd('0x1f')][_0x84dd('0x20')]||null:null,'attributes':_0x243509[_0x84dd('0x1f')]?_0x243509['options'][_0x84dd('0x21')]||null:null,'limit':_0x243509['options']?_0x243509[_0x84dd('0x1f')]['limit']||null:null,'include':_0x243509[_0x84dd('0x1f')]?_0x243509[_0x84dd('0x1f')]['include']?_[_0x84dd('0x22')](_0x243509[_0x84dd('0x1f')][_0x84dd('0x23')],function(_0xaf4dbd){return{'model':db[_0xaf4dbd['model']],'as':_0xaf4dbd['as'],'attributes':_0xaf4dbd[_0x84dd('0x21')],'include':_0xaf4dbd[_0x84dd('0x23')]?_[_0x84dd('0x22')](_0xaf4dbd['include'],function(_0x24db43){return{'model':db[_0x24db43['model']],'as':_0x24db43['as'],'attributes':_0x24db43[_0x84dd('0x21')],'include':_0x24db43[_0x84dd('0x23')]?_['map'](_0x24db43[_0x84dd('0x23')],function(_0x23837e){return{'model':db[_0x23837e[_0x84dd('0x24')]],'as':_0x23837e['as'],'attributes':_0x23837e[_0x84dd('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30566a){logger['info']('GetFaxQueue',_0x243509);logger['debug'](_0x84dd('0x1c'),_0x243509,JSON[_0x84dd('0x25')](_0x30566a));_0x4a6623(_0x30566a);})[_0x84dd('0x1b')](function(_0x306bf9){logger['error']('GetFaxQueue',_0x306bf9[_0x84dd('0x19')],_0x243509);_0x3af5af(_0xca1d50[_0x84dd('0x18')](0x1f4,_0x306bf9[_0x84dd('0x19')]));});});};exports[_0x84dd('0x26')]=function(_0x2c92f7){var _0x236c79=this;return new Promise(function(_0x5b581a,_0x4fb29e){return db[_0x84dd('0x1d')]['find']({'raw':_0x2c92f7[_0x84dd('0x1f')]?_0x2c92f7['options'][_0x84dd('0x27')]===undefined?!![]:![]:!![],'where':_0x2c92f7[_0x84dd('0x1f')]?_0x2c92f7[_0x84dd('0x1f')]['where']||null:null,'attributes':_0x2c92f7['options']?_0x2c92f7[_0x84dd('0x1f')][_0x84dd('0x21')]||null:null,'include':_0x2c92f7['options']?_0x2c92f7[_0x84dd('0x1f')][_0x84dd('0x23')]?_[_0x84dd('0x22')](_0x2c92f7['options'][_0x84dd('0x23')],function(_0x411e98){return{'model':db[_0x411e98[_0x84dd('0x24')]],'as':_0x411e98['as'],'attributes':_0x411e98[_0x84dd('0x21')],'include':_0x411e98['include']?_[_0x84dd('0x22')](_0x411e98[_0x84dd('0x23')],function(_0x528c24){return{'model':db[_0x528c24[_0x84dd('0x24')]],'as':_0x528c24['as'],'attributes':_0x528c24[_0x84dd('0x21')],'include':_0x528c24[_0x84dd('0x23')]?_['map'](_0x528c24[_0x84dd('0x23')],function(_0x5a3cec){return{'model':db[_0x5a3cec['model']],'as':_0x5a3cec['as'],'attributes':_0x5a3cec[_0x84dd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x84dd('0x12')](function(_0x5a2b55){logger[_0x84dd('0x13')](_0x84dd('0x26'),_0x2c92f7);logger[_0x84dd('0x16')](_0x84dd('0x26'),_0x2c92f7,JSON[_0x84dd('0x25')](_0x5a2b55));_0x5b581a(_0x5a2b55);})[_0x84dd('0x1b')](function(_0x46fb53){logger[_0x84dd('0x18')](_0x84dd('0x26'),_0x46fb53['message'],_0x2c92f7);_0x4fb29e(_0x236c79['error'](0x1f4,_0x46fb53[_0x84dd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index db5f2c1..60560bd 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 _0x1fa3=['remove','update','removeListener','register','./faxQueue.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1fa3,0xc4));var _0x31fa=function(_0x52c13d,_0x5e31c4){_0x52c13d=_0x52c13d-0x0;var _0x5a7aad=_0x1fa3[_0x52c13d];return _0x5a7aad;};'use strict';var FaxQueueEvents=require(_0x31fa('0x0'));var events=[_0x31fa('0x1'),_0x31fa('0x2'),_0x31fa('0x3')];function createListener(_0x53b172,_0xeb1d3e){return function(_0x46ee1a){_0xeb1d3e['emit'](_0x53b172,_0x46ee1a);};}function removeListener(_0x519060,_0x49815c){return function(){FaxQueueEvents[_0x31fa('0x4')](_0x519060,_0x49815c);};}exports[_0x31fa('0x5')]=function(_0x28f6bc){for(var _0x4fb10a=0x0,_0x2619f3=events['length'];_0x4fb10a<_0x2619f3;_0x4fb10a++){var _0x256b76=events[_0x4fb10a];var _0x34f073=createListener('faxQueue:'+_0x256b76,_0x28f6bc);FaxQueueEvents['on'](_0x256b76,_0x34f073);}}; \ No newline at end of file +var _0x448a=['removeListener','register','length','save','remove','emit'];(function(_0x2db055,_0x5bde11){var _0xb2f3a4=function(_0x4719b8){while(--_0x4719b8){_0x2db055['push'](_0x2db055['shift']());}};_0xb2f3a4(++_0x5bde11);}(_0x448a,0x1ef));var _0xa448=function(_0x1df153,_0x7e3e2b){_0x1df153=_0x1df153-0x0;var _0x2e8ae4=_0x448a[_0x1df153];return _0x2e8ae4;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xa448('0x0'),_0xa448('0x1'),'update'];function createListener(_0x3f08b0,_0x47909c){return function(_0x5ea7f4){_0x47909c[_0xa448('0x2')](_0x3f08b0,_0x5ea7f4);};}function removeListener(_0x3206fd,_0x57e1ea){return function(){FaxQueueEvents[_0xa448('0x3')](_0x3206fd,_0x57e1ea);};}exports[_0xa448('0x4')]=function(_0x343b79){for(var _0x2c16e3=0x0,_0x12b0e2=events[_0xa448('0x5')];_0x2c16e3<_0x12b0e2;_0x2c16e3++){var _0x1ec2d8=events[_0x2c16e3];var _0x54bdb0=createListener('faxQueue:'+_0x1ec2d8,_0x343b79);FaxQueueEvents['on'](_0x1ec2d8,_0x54bdb0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 12b4c11..1753279 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 _0x3914=['../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','isAuthenticated','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x27d9e7,_0x24c4ad){var _0x3f371e=function(_0x142ec2){while(--_0x142ec2){_0x27d9e7['push'](_0x27d9e7['shift']());}};_0x3f371e(++_0x24c4ad);}(_0x3914,0xeb));var _0x4391=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x3914[_0x34eb31];return _0x254994;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var fs_extra=require(_0x4391('0x4'));var auth=require(_0x4391('0x5'));var interaction=require(_0x4391('0x6'));var config=require('../../config/environment');var controller=require(_0x4391('0x7'));router[_0x4391('0x8')]('/',auth['isAuthenticated'](),controller[_0x4391('0x9')]);router['get'](_0x4391('0xa'),auth['isAuthenticated'](),controller[_0x4391('0xb')]);router[_0x4391('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4391('0xc')]);router[_0x4391('0x8')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0xe')]);router[_0x4391('0x8')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller['getTeams']);router[_0x4391('0x8')](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x12')]);router[_0x4391('0x13')]('/',auth[_0x4391('0x10')](),controller[_0x4391('0x14')]);router[_0x4391('0x13')]('/:id/teams',auth[_0x4391('0x10')](),controller[_0x4391('0x15')]);router[_0x4391('0x13')](_0x4391('0x11'),auth['isAuthenticated'](),controller[_0x4391('0x16')]);router['put'](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x18')]);router[_0x4391('0x19')](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x1a')]);router[_0x4391('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4391('0x1b')]);router['delete'](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x1c')]);module[_0x4391('0x1d')]=router; \ No newline at end of file +var _0x7409=['get','index','/describe','describe','/:id','show','/:id/members','isAuthenticated','getTeams','/:id/teams','post','addAgents','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x7409,0x6e));var _0x9740=function(_0x43fe43,_0x40a903){_0x43fe43=_0x43fe43-0x0;var _0x3f5541=_0x7409[_0x43fe43];return _0x3f5541;};'use strict';var multer=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var path=require('path');var timeout=require(_0x9740('0x2'));var express=require(_0x9740('0x3'));var router=express[_0x9740('0x4')]();var fs_extra=require(_0x9740('0x5'));var auth=require(_0x9740('0x6'));var interaction=require(_0x9740('0x7'));var config=require(_0x9740('0x8'));var controller=require(_0x9740('0x9'));router[_0x9740('0xa')]('/',auth['isAuthenticated'](),controller[_0x9740('0xb')]);router[_0x9740('0xa')](_0x9740('0xc'),auth['isAuthenticated'](),controller[_0x9740('0xd')]);router[_0x9740('0xa')](_0x9740('0xe'),auth['isAuthenticated'](),controller[_0x9740('0xf')]);router['get'](_0x9740('0x10'),auth[_0x9740('0x11')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x9740('0x11')](),controller[_0x9740('0x12')]);router[_0x9740('0xa')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9740('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9740('0x14')]('/:id/users',auth[_0x9740('0x11')](),controller[_0x9740('0x15')]);router[_0x9740('0x16')](_0x9740('0xe'),auth['isAuthenticated'](),controller[_0x9740('0x17')]);router['delete'](_0x9740('0xe'),auth[_0x9740('0x11')](),controller[_0x9740('0x18')]);router[_0x9740('0x19')](_0x9740('0x13'),auth[_0x9740('0x11')](),controller[_0x9740('0x1a')]);router[_0x9740('0x19')](_0x9740('0x1b'),auth['isAuthenticated'](),controller[_0x9740('0x1c')]);module[_0x9740('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 0d411e5..9bb4f54 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 _0xb4c7=['moment','sequelize','exports','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb4c7,0x19c));var _0x7b4c=function(_0xf2f8a2,_0x580880){_0xf2f8a2=_0xf2f8a2-0x0;var _0x10b046=_0xb4c7[_0xf2f8a2];return _0x10b046;};'use strict';var moment=require(_0x7b4c('0x0'));var Sequelize=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7b4c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf4e6=['DATE','moment','sequelize','STRING'];(function(_0x301b7a,_0x55fdd0){var _0x1e2fab=function(_0x1d87d1){while(--_0x1d87d1){_0x301b7a['push'](_0x301b7a['shift']());}};_0x1e2fab(++_0x55fdd0);}(_0xf4e6,0x9d));var _0x6f4e=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xf4e6[_0xf26c2e];return _0x46ecb4;};'use strict';var moment=require(_0x6f4e('0x0'));var Sequelize=require(_0x6f4e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6f4e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6f4e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6f4e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6f4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7782306..be6a8cf 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 _0x8d97=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x15e2ae,_0x5f2abb){var _0x47e5ec=function(_0x45e7f1){while(--_0x45e7f1){_0x15e2ae['push'](_0x15e2ae['shift']());}};_0x47e5ec(++_0x5f2abb);}(_0x8d97,0x82));var _0x78d9=function(_0x3eeae0,_0xbdd72){_0x3eeae0=_0x3eeae0-0x0;var _0x231f77=_0x8d97[_0x3eeae0];return _0x231f77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78d9('0x0'));var zipdir=require(_0x78d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x78d9('0x2'));var moment=require(_0x78d9('0x3'));var BPromise=require(_0x78d9('0x4'));var Mustache=require(_0x78d9('0x5'));var util=require(_0x78d9('0x6'));var path=require('path');var sox=require(_0x78d9('0x7'));var csv=require(_0x78d9('0x8'));var ejs=require(_0x78d9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x78d9('0xa'));var jsforce=require(_0x78d9('0xb'));var deskjs=require(_0x78d9('0xc'));var toCsv=require(_0x78d9('0x8'));var querystring=require(_0x78d9('0xd'));var Papa=require(_0x78d9('0xe'));var Redis=require('ioredis');var authService=require(_0x78d9('0xf'));var qs=require(_0x78d9('0x10'));var as=require(_0x78d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78d9('0x12'));var utils=require(_0x78d9('0x13'));var config=require(_0x78d9('0x14'));var licenseUtil=require(_0x78d9('0x15'));var db=require(_0x78d9('0x16'))['db'];function respondWithStatusCode(_0x22d36f,_0x528746){_0x528746=_0x528746||0xcc;return function(_0x8186eb){if(_0x8186eb){return _0x22d36f[_0x78d9('0x17')](_0x528746);}return _0x22d36f[_0x78d9('0x18')](_0x528746)[_0x78d9('0x19')]();};}function respondWithResult(_0x1db1b1,_0x2928a8){_0x2928a8=_0x2928a8||0xc8;return function(_0x2b27a9){if(_0x2b27a9){return _0x1db1b1[_0x78d9('0x18')](_0x2928a8)[_0x78d9('0x1a')](_0x2b27a9);}};}function respondWithFilteredResult(_0x21cee0,_0x826882){return function(_0x38aa28){if(_0x38aa28){var _0x45934d=typeof _0x826882[_0x78d9('0x1b')]===_0x78d9('0x1c')&&typeof _0x826882[_0x78d9('0x1d')]===_0x78d9('0x1c');var _0x5e8122=_0x38aa28[_0x78d9('0x1e')];var _0x3b4dde=_0x45934d?0x0:_0x826882[_0x78d9('0x1b')];var _0x8d0153=_0x45934d?_0x38aa28[_0x78d9('0x1e')]:_0x826882[_0x78d9('0x1b')]+_0x826882[_0x78d9('0x1d')];var _0x2969fa;if(_0x8d0153>=_0x5e8122){_0x8d0153=_0x5e8122;_0x2969fa=0xc8;}else{_0x2969fa=0xce;}_0x21cee0[_0x78d9('0x18')](_0x2969fa);return _0x21cee0[_0x78d9('0x1f')](_0x78d9('0x20'),_0x3b4dde+'-'+_0x8d0153+'/'+_0x5e8122)[_0x78d9('0x1a')](_0x38aa28);}return null;};}function patchUpdates(_0x36bcf9){return function(_0x148e30){try{jsonpatch[_0x78d9('0x21')](_0x148e30,_0x36bcf9,!![]);}catch(_0x1d8d3c){return BPromise['reject'](_0x1d8d3c);}return _0x148e30[_0x78d9('0x22')]();};}function saveUpdates(_0x4285d4,_0x24d236){return function(_0x18bb18){if(_0x18bb18){return _0x18bb18['update'](_0x4285d4)[_0x78d9('0x23')](function(_0x41f732){return _0x41f732;});}return null;};}function removeEntity(_0x45b6f6,_0x51549d){return function(_0x51c4ce){if(_0x51c4ce){return _0x51c4ce[_0x78d9('0x24')]()['then'](function(){_0x45b6f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b7e1,_0x1fa9a1){return function(_0x361a5e){if(!_0x361a5e){_0x28b7e1[_0x78d9('0x17')](0x194);}return _0x361a5e;};}function handleError(_0x18f58d,_0x17db22){_0x17db22=_0x17db22||0x1f4;return function(_0x4e87cf){logger[_0x78d9('0x25')](_0x4e87cf['stack']);if(_0x4e87cf[_0x78d9('0x26')]){delete _0x4e87cf[_0x78d9('0x26')];}_0x18f58d[_0x78d9('0x18')](_0x17db22)['send'](_0x4e87cf);};}exports[_0x78d9('0x27')]=function(_0x337816,_0x59b9d2){var _0x47f189={},_0x55617c={},_0x4fce54={'count':0x0,'rows':[]};var _0x1e4f67=_[_0x78d9('0x28')](db[_0x78d9('0x29')][_0x78d9('0x2a')],function(_0x40a789){return{'name':_0x40a789[_0x78d9('0x2b')],'type':_0x40a789[_0x78d9('0x2c')][_0x78d9('0x2d')]};});_0x55617c[_0x78d9('0x2e')]=_[_0x78d9('0x28')](_0x1e4f67,'name');_0x55617c[_0x78d9('0x2f')]=_['keys'](_0x337816['query']);_0x55617c[_0x78d9('0x30')]=_[_0x78d9('0x31')](_0x55617c[_0x78d9('0x2e')],_0x55617c[_0x78d9('0x2f')]);_0x47f189[_0x78d9('0x32')]=_[_0x78d9('0x31')](_0x55617c[_0x78d9('0x2e')],qs['fields'](_0x337816[_0x78d9('0x2f')][_0x78d9('0x33')]));_0x47f189[_0x78d9('0x32')]=_0x47f189[_0x78d9('0x32')]['length']?_0x47f189[_0x78d9('0x32')]:_0x55617c['model'];if(!_0x337816['query']['hasOwnProperty']('nolimit')){_0x47f189[_0x78d9('0x1d')]=qs[_0x78d9('0x1d')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x1d')]);_0x47f189[_0x78d9('0x1b')]=qs[_0x78d9('0x1b')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x1b')]);}_0x47f189[_0x78d9('0x34')]=qs[_0x78d9('0x35')](_0x337816[_0x78d9('0x2f')][_0x78d9('0x35')]);_0x47f189[_0x78d9('0x36')]=qs[_0x78d9('0x30')](_[_0x78d9('0x37')](_0x337816[_0x78d9('0x2f')],_0x55617c[_0x78d9('0x30')]),_0x1e4f67);if(_0x337816[_0x78d9('0x2f')]['filter']){_0x47f189['where']=_[_0x78d9('0x38')](_0x47f189[_0x78d9('0x36')],{'$or':_[_0x78d9('0x28')](_0x1e4f67,function(_0x390ecb){if(_0x390ecb[_0x78d9('0x2c')]!==_0x78d9('0x39')){var _0x48e07c={};_0x48e07c[_0x390ecb[_0x78d9('0x26')]]={'$like':'%'+_0x337816[_0x78d9('0x2f')][_0x78d9('0x3a')]+'%'};return _0x48e07c;}})});}_0x47f189=_[_0x78d9('0x38')]({},_0x47f189,_0x337816[_0x78d9('0x3b')]);var _0x5f58ba={'where':_0x47f189[_0x78d9('0x36')]};return db[_0x78d9('0x29')][_0x78d9('0x1e')](_0x5f58ba)[_0x78d9('0x23')](function(_0x50f765){_0x4fce54[_0x78d9('0x1e')]=_0x50f765;if(_0x337816[_0x78d9('0x2f')][_0x78d9('0x3c')]){_0x47f189[_0x78d9('0x3d')]=[{'all':!![]}];}return db[_0x78d9('0x29')][_0x78d9('0x3e')](_0x47f189);})[_0x78d9('0x23')](function(_0x381ed5){_0x4fce54[_0x78d9('0x3f')]=_0x381ed5;return _0x4fce54;})['then'](respondWithFilteredResult(_0x59b9d2,_0x47f189))[_0x78d9('0x40')](handleError(_0x59b9d2,null));};exports[_0x78d9('0x41')]=function(_0x5c7854,_0xc4e054){var _0x2ddb1e={'raw':!![],'where':{'id':_0x5c7854[_0x78d9('0x42')]['id']}},_0x2d4c80={};_0x2d4c80[_0x78d9('0x2e')]=_[_0x78d9('0x43')](db[_0x78d9('0x29')][_0x78d9('0x2a')]);_0x2d4c80['query']=_['keys'](_0x5c7854[_0x78d9('0x2f')]);_0x2d4c80[_0x78d9('0x30')]=_['intersection'](_0x2d4c80[_0x78d9('0x2e')],_0x2d4c80[_0x78d9('0x2f')]);_0x2ddb1e[_0x78d9('0x32')]=_[_0x78d9('0x31')](_0x2d4c80[_0x78d9('0x2e')],qs[_0x78d9('0x33')](_0x5c7854[_0x78d9('0x2f')][_0x78d9('0x33')]));_0x2ddb1e[_0x78d9('0x32')]=_0x2ddb1e[_0x78d9('0x32')]['length']?_0x2ddb1e[_0x78d9('0x32')]:_0x2d4c80[_0x78d9('0x2e')];if(_0x5c7854[_0x78d9('0x2f')][_0x78d9('0x3c')]){_0x2ddb1e[_0x78d9('0x3d')]=[{'all':!![]}];}_0x2ddb1e=_['merge']({},_0x2ddb1e,_0x5c7854['options']);return db[_0x78d9('0x29')][_0x78d9('0x44')](_0x2ddb1e)['then'](handleEntityNotFound(_0xc4e054,null))['then'](respondWithResult(_0xc4e054,null))[_0x78d9('0x40')](handleError(_0xc4e054,null));};exports['create']=function(_0x21495f,_0x62dd38){return db[_0x78d9('0x29')][_0x78d9('0x45')](_0x21495f[_0x78d9('0x46')],{})[_0x78d9('0x23')](respondWithResult(_0x62dd38,0xc9))[_0x78d9('0x40')](handleError(_0x62dd38,null));};exports[_0x78d9('0x47')]=function(_0x404a60,_0x3cec0a){if(_0x404a60[_0x78d9('0x46')]['id']){delete _0x404a60['body']['id'];}return db[_0x78d9('0x29')]['find']({'where':{'id':_0x404a60[_0x78d9('0x42')]['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x3cec0a,null))[_0x78d9('0x23')](saveUpdates(_0x404a60[_0x78d9('0x46')],null))['then'](respondWithResult(_0x3cec0a,null))[_0x78d9('0x40')](handleError(_0x3cec0a,null));};exports['destroy']=function(_0x4923fa,_0x579c3b){return db[_0x78d9('0x29')][_0x78d9('0x44')]({'where':{'id':_0x4923fa[_0x78d9('0x42')]['id']}})[_0x78d9('0x23')](handleEntityNotFound(_0x579c3b,null))[_0x78d9('0x23')](removeEntity(_0x579c3b,null))['catch'](handleError(_0x579c3b,null));};exports[_0x78d9('0x48')]=function(_0x5c15d5,_0x351d4a){return db[_0x78d9('0x29')][_0x78d9('0x48')]()[_0x78d9('0x23')](respondWithResult(_0x351d4a,null))['catch'](handleError(_0x351d4a,null));}; \ No newline at end of file +var _0x4853=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','limit','offset','order','sort','pick','filter','where','VIRTUAL','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2a85e2,_0x50f46d){var _0x5d7c38=function(_0x3f9fb3){while(--_0x3f9fb3){_0x2a85e2['push'](_0x2a85e2['shift']());}};_0x5d7c38(++_0x50f46d);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3485('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3485('0x1'));var rp=require(_0x3485('0x2'));var moment=require(_0x3485('0x3'));var BPromise=require(_0x3485('0x4'));var Mustache=require(_0x3485('0x5'));var util=require(_0x3485('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3485('0x7'));var fs=require('fs');var fs_extra=require(_0x3485('0x8'));var _=require(_0x3485('0x9'));var squel=require(_0x3485('0xa'));var crypto=require(_0x3485('0xb'));var jsforce=require(_0x3485('0xc'));var deskjs=require(_0x3485('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3485('0xe'));var Papa=require(_0x3485('0xf'));var Redis=require(_0x3485('0x10'));var authService=require(_0x3485('0x11'));var qs=require(_0x3485('0x12'));var as=require(_0x3485('0x13'));var hardwareService=require(_0x3485('0x14'));var logger=require(_0x3485('0x15'))(_0x3485('0x16'));var utils=require('../../config/utils');var config=require(_0x3485('0x17'));var licenseUtil=require(_0x3485('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560988,_0x3c0427){_0x3c0427=_0x3c0427||0xcc;return function(_0x41c8f2){if(_0x41c8f2){return _0x560988[_0x3485('0x19')](_0x3c0427);}return _0x560988['status'](_0x3c0427)['end']();};}function respondWithResult(_0x4dcbd8,_0x4b5214){_0x4b5214=_0x4b5214||0xc8;return function(_0x492a46){if(_0x492a46){return _0x4dcbd8[_0x3485('0x1a')](_0x4b5214)[_0x3485('0x1b')](_0x492a46);}};}function respondWithFilteredResult(_0xa43d7,_0x5e792d){return function(_0x3c12af){if(_0x3c12af){var _0x5e1143=typeof _0x5e792d['offset']===_0x3485('0x1c')&&typeof _0x5e792d['limit']===_0x3485('0x1c');var _0x306d08=_0x3c12af[_0x3485('0x1d')];var _0x444c00=_0x5e1143?0x0:_0x5e792d['offset'];var _0x585f8a=_0x5e1143?_0x3c12af['count']:_0x5e792d['offset']+_0x5e792d['limit'];var _0xf87f15;if(_0x585f8a>=_0x306d08){_0x585f8a=_0x306d08;_0xf87f15=0xc8;}else{_0xf87f15=0xce;}_0xa43d7[_0x3485('0x1a')](_0xf87f15);return _0xa43d7[_0x3485('0x1e')](_0x3485('0x1f'),_0x444c00+'-'+_0x585f8a+'/'+_0x306d08)[_0x3485('0x1b')](_0x3c12af);}return null;};}function patchUpdates(_0x13477b){return function(_0x2365f0){try{jsonpatch[_0x3485('0x20')](_0x2365f0,_0x13477b,!![]);}catch(_0x1a12c7){return BPromise[_0x3485('0x21')](_0x1a12c7);}return _0x2365f0[_0x3485('0x22')]();};}function saveUpdates(_0x4b085d,_0x531b93){return function(_0x52de69){if(_0x52de69){return _0x52de69['update'](_0x4b085d)[_0x3485('0x23')](function(_0x98440b){return _0x98440b;});}return null;};}function removeEntity(_0x182954,_0x2c846d){return function(_0x1a433f){if(_0x1a433f){return _0x1a433f[_0x3485('0x24')]()[_0x3485('0x23')](function(){_0x182954[_0x3485('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba1190,_0x29c1ec){return function(_0x9829f2){if(!_0x9829f2){_0xba1190[_0x3485('0x19')](0x194);}return _0x9829f2;};}function handleError(_0x1633db,_0x300668){_0x300668=_0x300668||0x1f4;return function(_0x495402){logger[_0x3485('0x25')](_0x495402[_0x3485('0x26')]);if(_0x495402[_0x3485('0x27')]){delete _0x495402[_0x3485('0x27')];}_0x1633db[_0x3485('0x1a')](_0x300668)[_0x3485('0x28')](_0x495402);};}exports['index']=function(_0x3410e1,_0x3308bf){var _0x3cc604={},_0x1d77d4={},_0x2481b1={'count':0x0,'rows':[]};var _0x5273b0=_[_0x3485('0x29')](db['FaxQueueReport'][_0x3485('0x2a')],function(_0x1d21f1){return{'name':_0x1d21f1['fieldName'],'type':_0x1d21f1[_0x3485('0x2b')][_0x3485('0x2c')]};});_0x1d77d4[_0x3485('0x2d')]=_[_0x3485('0x29')](_0x5273b0,'name');_0x1d77d4['query']=_[_0x3485('0x2e')](_0x3410e1['query']);_0x1d77d4[_0x3485('0x2f')]=_[_0x3485('0x30')](_0x1d77d4['model'],_0x1d77d4[_0x3485('0x31')]);_0x3cc604[_0x3485('0x32')]=_[_0x3485('0x30')](_0x1d77d4[_0x3485('0x2d')],qs[_0x3485('0x33')](_0x3410e1[_0x3485('0x31')]['fields']));_0x3cc604[_0x3485('0x32')]=_0x3cc604['attributes'][_0x3485('0x34')]?_0x3cc604[_0x3485('0x32')]:_0x1d77d4[_0x3485('0x2d')];if(!_0x3410e1[_0x3485('0x31')]['hasOwnProperty']('nolimit')){_0x3cc604[_0x3485('0x35')]=qs[_0x3485('0x35')](_0x3410e1[_0x3485('0x31')]['limit']);_0x3cc604[_0x3485('0x36')]=qs[_0x3485('0x36')](_0x3410e1[_0x3485('0x31')]['offset']);}_0x3cc604[_0x3485('0x37')]=qs['sort'](_0x3410e1['query'][_0x3485('0x38')]);_0x3cc604['where']=qs[_0x3485('0x2f')](_[_0x3485('0x39')](_0x3410e1[_0x3485('0x31')],_0x1d77d4[_0x3485('0x2f')]),_0x5273b0);if(_0x3410e1[_0x3485('0x31')][_0x3485('0x3a')]){_0x3cc604[_0x3485('0x3b')]=_['merge'](_0x3cc604[_0x3485('0x3b')],{'$or':_[_0x3485('0x29')](_0x5273b0,function(_0x5825a4){if(_0x5825a4['type']!==_0x3485('0x3c')){var _0x1aae3f={};_0x1aae3f[_0x5825a4[_0x3485('0x27')]]={'$like':'%'+_0x3410e1[_0x3485('0x31')][_0x3485('0x3a')]+'%'};return _0x1aae3f;}})});}_0x3cc604=_[_0x3485('0x3d')]({},_0x3cc604,_0x3410e1[_0x3485('0x3e')]);var _0x1717ea={'where':_0x3cc604[_0x3485('0x3b')]};return db[_0x3485('0x3f')][_0x3485('0x1d')](_0x1717ea)['then'](function(_0x516a4e){_0x2481b1['count']=_0x516a4e;if(_0x3410e1[_0x3485('0x31')][_0x3485('0x40')]){_0x3cc604[_0x3485('0x41')]=[{'all':!![]}];}return db[_0x3485('0x3f')][_0x3485('0x42')](_0x3cc604);})[_0x3485('0x23')](function(_0x570efa){_0x2481b1[_0x3485('0x43')]=_0x570efa;return _0x2481b1;})['then'](respondWithFilteredResult(_0x3308bf,_0x3cc604))[_0x3485('0x44')](handleError(_0x3308bf,null));};exports[_0x3485('0x45')]=function(_0x45ee16,_0x49ad4a){var _0x29c216={'raw':!![],'where':{'id':_0x45ee16[_0x3485('0x46')]['id']}},_0x168ea2={};_0x168ea2[_0x3485('0x2d')]=_[_0x3485('0x2e')](db['FaxQueueReport'][_0x3485('0x2a')]);_0x168ea2[_0x3485('0x31')]=_['keys'](_0x45ee16[_0x3485('0x31')]);_0x168ea2['filters']=_[_0x3485('0x30')](_0x168ea2[_0x3485('0x2d')],_0x168ea2[_0x3485('0x31')]);_0x29c216[_0x3485('0x32')]=_['intersection'](_0x168ea2[_0x3485('0x2d')],qs[_0x3485('0x33')](_0x45ee16['query']['fields']));_0x29c216[_0x3485('0x32')]=_0x29c216[_0x3485('0x32')]['length']?_0x29c216[_0x3485('0x32')]:_0x168ea2[_0x3485('0x2d')];if(_0x45ee16[_0x3485('0x31')][_0x3485('0x40')]){_0x29c216[_0x3485('0x41')]=[{'all':!![]}];}_0x29c216=_[_0x3485('0x3d')]({},_0x29c216,_0x45ee16[_0x3485('0x3e')]);return db[_0x3485('0x3f')][_0x3485('0x47')](_0x29c216)[_0x3485('0x23')](handleEntityNotFound(_0x49ad4a,null))['then'](respondWithResult(_0x49ad4a,null))[_0x3485('0x44')](handleError(_0x49ad4a,null));};exports[_0x3485('0x48')]=function(_0x784730,_0x10530b){return db['FaxQueueReport'][_0x3485('0x48')](_0x784730[_0x3485('0x49')],{})['then'](respondWithResult(_0x10530b,0xc9))[_0x3485('0x44')](handleError(_0x10530b,null));};exports[_0x3485('0x4a')]=function(_0x349afe,_0x31e254){if(_0x349afe[_0x3485('0x49')]['id']){delete _0x349afe[_0x3485('0x49')]['id'];}return db['FaxQueueReport'][_0x3485('0x47')]({'where':{'id':_0x349afe[_0x3485('0x46')]['id']}})['then'](handleEntityNotFound(_0x31e254,null))[_0x3485('0x23')](saveUpdates(_0x349afe['body'],null))[_0x3485('0x23')](respondWithResult(_0x31e254,null))[_0x3485('0x44')](handleError(_0x31e254,null));};exports['destroy']=function(_0x46f5af,_0x3f7433){return db['FaxQueueReport']['find']({'where':{'id':_0x46f5af[_0x3485('0x46')]['id']}})[_0x3485('0x23')](handleEntityNotFound(_0x3f7433,null))[_0x3485('0x23')](removeEntity(_0x3f7433,null))['catch'](handleError(_0x3f7433,null));};exports[_0x3485('0x4b')]=function(_0x1de47c,_0x24dbe8){return db['FaxQueueReport'][_0x3485('0x4b')]()['then'](respondWithResult(_0x24dbe8,null))[_0x3485('0x44')](handleError(_0x24dbe8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 8c908a4..0cad99e 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24a6fe,_0x387ad5){var _0x56f7fa=function(_0x5ca1a0){while(--_0x5ca1a0){_0x24a6fe['push'](_0x24a6fe['shift']());}};_0x56f7fa(++_0x387ad5);}(_0x4975,0x86));var _0x5497=function(_0x4fac74,_0x5454a9){_0x4fac74=_0x4fac74-0x0;var _0x213483=_0x4975[_0x4fac74];return _0x213483;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x327f66,_0x188d77){var _0x31f70a=function(_0x125d9f){while(--_0x125d9f){_0x327f66['push'](_0x327f66['shift']());}};_0x31f70a(++_0x188d77);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x5fc3[_0x3b16e1];return _0x311d1b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 87cd395..65fbbf7 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 _0xd535=['error','code','FaxQueueReport,\x20%s,\x20%s','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','UpdateFaxQueueReport','update','where','attributes','limit','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd535,0x134));var _0x5d53=function(_0x3e8e9e,_0x20e530){_0x3e8e9e=_0x3e8e9e-0x0;var _0xb4ee22=_0xd535[_0x3e8e9e];return _0xb4ee22;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5d53('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d53('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d53('0x2'))(_0x5d53('0x3'));var config=require(_0x5d53('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d53('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2b3d58,_0x4138b4,_0x39d8ff){return new BPromise(function(_0x41a7fd,_0x2a7836){return client[_0x5d53('0x6')](_0x2b3d58,_0x39d8ff)[_0x5d53('0x7')](function(_0x26cf43){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4138b4,_0x5d53('0x8'));logger[_0x5d53('0x9')](_0x5d53('0xa'),_0x4138b4,_0x5d53('0x8'),JSON['stringify'](_0x26cf43));if(_0x26cf43[_0x5d53('0xb')]){if(_0x26cf43[_0x5d53('0xb')][_0x5d53('0xc')]===0x1f4){logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x26cf43[_0x5d53('0xb')][_0x5d53('0xe')]);return _0x2a7836(_0x26cf43['error'][_0x5d53('0xe')]);}logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x26cf43[_0x5d53('0xb')][_0x5d53('0xe')]);return _0x41a7fd(_0x26cf43[_0x5d53('0xb')]['message']);}else{logger[_0x5d53('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4138b4,_0x5d53('0x8'));_0x41a7fd(_0x26cf43['result'][_0x5d53('0xe')]);}})['catch'](function(_0x3f4505){logger[_0x5d53('0xb')](_0x5d53('0xd'),_0x4138b4,_0x3f4505);_0x2a7836(_0x3f4505);});});}exports[_0x5d53('0x10')]=function(_0x17b6f8){var _0x111036=this;return new Promise(function(_0x1010fb,_0x161dc3){return db[_0x5d53('0x11')][_0x5d53('0x12')](_0x17b6f8[_0x5d53('0x13')],{'raw':_0x17b6f8[_0x5d53('0x14')]?_0x17b6f8[_0x5d53('0x14')][_0x5d53('0x15')]===undefined?!![]:![]:!![]})[_0x5d53('0x7')](function(_0x431c89){logger['info']('CreateFaxQueueReport',_0x17b6f8);logger[_0x5d53('0x9')](_0x5d53('0x10'),_0x17b6f8,JSON[_0x5d53('0x16')](_0x431c89));_0x1010fb(_0x431c89);})[_0x5d53('0x17')](function(_0x2fe496){logger[_0x5d53('0xb')](_0x5d53('0x10'),_0x2fe496[_0x5d53('0xe')],_0x17b6f8);_0x161dc3(_0x111036[_0x5d53('0xb')](0x1f4,_0x2fe496[_0x5d53('0xe')]));});});};exports[_0x5d53('0x18')]=function(_0x16aa60){var _0x544162=this;return new Promise(function(_0x2a9239,_0x3597da){return db[_0x5d53('0x11')][_0x5d53('0x19')](_0x16aa60[_0x5d53('0x13')],{'raw':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1a')]||null:null,'attributes':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1b')]||null:null,'limit':_0x16aa60[_0x5d53('0x14')]?_0x16aa60[_0x5d53('0x14')][_0x5d53('0x1c')]||null:null})[_0x5d53('0x7')](function(_0x2e421d){logger[_0x5d53('0xf')]('UpdateFaxQueueReport',_0x16aa60);logger['debug'](_0x5d53('0x18'),_0x16aa60,JSON[_0x5d53('0x16')](_0x2e421d));_0x2a9239(_0x2e421d);})[_0x5d53('0x17')](function(_0x47bea0){logger[_0x5d53('0xb')](_0x5d53('0x18'),_0x47bea0[_0x5d53('0xe')],_0x16aa60);_0x3597da(_0x544162['error'](0x1f4,_0x47bea0[_0x5d53('0xe')]));});});}; \ No newline at end of file +var _0xd92f=['raw','stringify','catch','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xd92f,0xb6));var _0xfd92=function(_0x92d61,_0x292830){_0x92d61=_0x92d61-0x0;var _0x5739a0=_0xd92f[_0x92d61];return _0x5739a0;};'use strict';var _=require(_0xfd92('0x0'));var util=require(_0xfd92('0x1'));var moment=require(_0xfd92('0x2'));var BPromise=require(_0xfd92('0x3'));var rs=require(_0xfd92('0x4'));var fs=require('fs');var Redis=require(_0xfd92('0x5'));var db=require(_0xfd92('0x6'))['db'];var utils=require(_0xfd92('0x7'));var logger=require(_0xfd92('0x8'))(_0xfd92('0x9'));var config=require(_0xfd92('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfd92('0xb')][_0xfd92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a0d70,_0x4dba91,_0x129086){return new BPromise(function(_0x1a6378,_0x3809ca){return client[_0xfd92('0xd')](_0x3a0d70,_0x129086)[_0xfd92('0xe')](function(_0x5eb919){logger[_0xfd92('0xf')](_0xfd92('0x10'),_0x4dba91,_0xfd92('0x11'));logger[_0xfd92('0x12')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4dba91,'request\x20sent',JSON['stringify'](_0x5eb919));if(_0x5eb919['error']){if(_0x5eb919['error'][_0xfd92('0x13')]===0x1f4){logger[_0xfd92('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x4dba91,_0x5eb919[_0xfd92('0x14')][_0xfd92('0x15')]);return _0x3809ca(_0x5eb919[_0xfd92('0x14')][_0xfd92('0x15')]);}logger[_0xfd92('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x4dba91,_0x5eb919[_0xfd92('0x14')]['message']);return _0x1a6378(_0x5eb919[_0xfd92('0x14')][_0xfd92('0x15')]);}else{logger[_0xfd92('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4dba91,_0xfd92('0x11'));_0x1a6378(_0x5eb919[_0xfd92('0x16')][_0xfd92('0x15')]);}})['catch'](function(_0x27b97a){logger[_0xfd92('0x14')](_0xfd92('0x10'),_0x4dba91,_0x27b97a);_0x3809ca(_0x27b97a);});});}exports[_0xfd92('0x17')]=function(_0x2cc818){var _0x191d8c=this;return new Promise(function(_0xdc0361,_0xef840a){return db[_0xfd92('0x18')][_0xfd92('0x19')](_0x2cc818[_0xfd92('0x1a')],{'raw':_0x2cc818[_0xfd92('0x1b')]?_0x2cc818[_0xfd92('0x1b')][_0xfd92('0x1c')]===undefined?!![]:![]:!![]})[_0xfd92('0xe')](function(_0x44668e){logger[_0xfd92('0xf')](_0xfd92('0x17'),_0x2cc818);logger[_0xfd92('0x12')](_0xfd92('0x17'),_0x2cc818,JSON[_0xfd92('0x1d')](_0x44668e));_0xdc0361(_0x44668e);})[_0xfd92('0x1e')](function(_0x52113b){logger[_0xfd92('0x14')](_0xfd92('0x17'),_0x52113b[_0xfd92('0x15')],_0x2cc818);_0xef840a(_0x191d8c[_0xfd92('0x14')](0x1f4,_0x52113b[_0xfd92('0x15')]));});});};exports[_0xfd92('0x1f')]=function(_0x2c34d1){var _0x4e9f27=this;return new Promise(function(_0x57dd05,_0x5d9907){return db['FaxQueueReport'][_0xfd92('0x20')](_0x2c34d1[_0xfd92('0x1a')],{'raw':_0x2c34d1['options']?_0x2c34d1['options'][_0xfd92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c34d1[_0xfd92('0x1b')]?_0x2c34d1['options']['where']||null:null,'attributes':_0x2c34d1['options']?_0x2c34d1['options'][_0xfd92('0x21')]||null:null,'limit':_0x2c34d1[_0xfd92('0x1b')]?_0x2c34d1[_0xfd92('0x1b')][_0xfd92('0x22')]||null:null})[_0xfd92('0xe')](function(_0x471470){logger[_0xfd92('0xf')](_0xfd92('0x1f'),_0x2c34d1);logger[_0xfd92('0x12')](_0xfd92('0x1f'),_0x2c34d1,JSON[_0xfd92('0x1d')](_0x471470));_0x57dd05(_0x471470);})[_0xfd92('0x1e')](function(_0x2eea5c){logger[_0xfd92('0x14')]('UpdateFaxQueueReport',_0x2eea5c[_0xfd92('0x15')],_0x2c34d1);_0x5d9907(_0x4e9f27[_0xfd92('0x14')](0x1f4,_0x2eea5c[_0xfd92('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b9a0c5f..c233597 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 _0xc468=['/describe','/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0xf58718,_0x33541a){var _0x5aea10=function(_0x16f386){while(--_0x16f386){_0xf58718['push'](_0xf58718['shift']());}};_0x5aea10(++_0x33541a);}(_0xc468,0xcf));var _0x8c46=function(_0x29613b,_0x4ecc1c){_0x29613b=_0x29613b-0x0;var _0x200b13=_0xc468[_0x29613b];return _0x200b13;};'use strict';var multer=require(_0x8c46('0x0'));var util=require(_0x8c46('0x1'));var path=require(_0x8c46('0x2'));var timeout=require(_0x8c46('0x3'));var express=require(_0x8c46('0x4'));var router=express[_0x8c46('0x5')]();var fs_extra=require(_0x8c46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8c46('0x7'));var config=require(_0x8c46('0x8'));var controller=require(_0x8c46('0x9'));router[_0x8c46('0xa')]('/',auth[_0x8c46('0xb')](),controller[_0x8c46('0xc')]);router[_0x8c46('0xa')](_0x8c46('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x8c46('0xa')](_0x8c46('0xe'),auth[_0x8c46('0xb')](),controller[_0x8c46('0xf')]);router['post']('/',auth[_0x8c46('0xb')](),controller['create']);router[_0x8c46('0x10')](_0x8c46('0xe'),auth[_0x8c46('0xb')](),controller[_0x8c46('0x11')]);router['delete'](_0x8c46('0xe'),auth['isAuthenticated'](),controller[_0x8c46('0x12')]);module[_0x8c46('0x13')]=router; \ No newline at end of file +var _0xb51a=['describe','/:id','post','put','update','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x52311c,_0xbde387){var _0x544008=function(_0x17fcd4){while(--_0x17fcd4){_0x52311c['push'](_0x52311c['shift']());}};_0x544008(++_0xbde387);}(_0xb51a,0x6c));var _0xab51=function(_0x287c11,_0x4dee27){_0x287c11=_0x287c11-0x0;var _0x1e8872=_0xb51a[_0x287c11];return _0x1e8872;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xab51('0x0'));var express=require(_0xab51('0x1'));var router=express['Router']();var fs_extra=require(_0xab51('0x2'));var auth=require(_0xab51('0x3'));var interaction=require(_0xab51('0x4'));var config=require(_0xab51('0x5'));var controller=require(_0xab51('0x6'));router[_0xab51('0x7')]('/',auth['isAuthenticated'](),controller[_0xab51('0x8')]);router[_0xab51('0x7')](_0xab51('0x9'),auth[_0xab51('0xa')](),controller[_0xab51('0xb')]);router[_0xab51('0x7')](_0xab51('0xc'),auth[_0xab51('0xa')](),controller['show']);router[_0xab51('0xd')]('/',auth[_0xab51('0xa')](),controller['create']);router[_0xab51('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xab51('0xf')]);router['delete'](_0xab51('0xc'),auth['isAuthenticated'](),controller[_0xab51('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 2e8cf75..63f3ae6 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x428cd4,_0x2fe3ff){var _0x208cdb=function(_0x2a7662){while(--_0x2a7662){_0x428cd4['push'](_0x428cd4['shift']());}};_0x208cdb(++_0x2fe3ff);}(_0x008c,0x188));var _0xc008=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0x008c[_0x59e862];return _0x1a25ee;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x23d561,_0x410839){var _0x2e083b=function(_0x4d5e87){while(--_0x4d5e87){_0x23d561['push'](_0x23d561['shift']());}};_0x2e083b(++_0x410839);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cec8c,_0x3f6c1d){_0x3cec8c=_0x3cec8c-0x0;var _0x38032e=_0xcb91[_0x3cec8c];return _0x38032e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 49c9f63..723e7f9 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 _0x1356=['offset','undefined','limit','count','set','Content-Range','apply','save','then','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxTransferReport','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4a9d04,_0x1e6666){var _0x47a604=function(_0x270623){while(--_0x270623){_0x4a9d04['push'](_0x4a9d04['shift']());}};_0x47a604(++_0x1e6666);}(_0x1356,0x19d));var _0x6135=function(_0x2a74f4,_0x5e93c4){_0x2a74f4=_0x2a74f4-0x0;var _0x394917=_0x1356[_0x2a74f4];return _0x394917;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6135('0x0'));var jsonpatch=require(_0x6135('0x1'));var rp=require(_0x6135('0x2'));var moment=require(_0x6135('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6135('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6135('0x5'));var csv=require(_0x6135('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6135('0x7'));var _=require(_0x6135('0x8'));var squel=require(_0x6135('0x9'));var crypto=require(_0x6135('0xa'));var jsforce=require(_0x6135('0xb'));var deskjs=require(_0x6135('0xc'));var toCsv=require(_0x6135('0x6'));var querystring=require('querystring');var Papa=require(_0x6135('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6135('0xe'));var hardwareService=require(_0x6135('0xf'));var logger=require(_0x6135('0x10'))(_0x6135('0x11'));var utils=require('../../config/utils');var config=require(_0x6135('0x12'));var licenseUtil=require(_0x6135('0x13'));var db=require(_0x6135('0x14'))['db'];function respondWithStatusCode(_0x480955,_0x54af16){_0x54af16=_0x54af16||0xcc;return function(_0x1f5143){if(_0x1f5143){return _0x480955[_0x6135('0x15')](_0x54af16);}return _0x480955[_0x6135('0x16')](_0x54af16)[_0x6135('0x17')]();};}function respondWithResult(_0x38575f,_0x17c23d){_0x17c23d=_0x17c23d||0xc8;return function(_0x4065a7){if(_0x4065a7){return _0x38575f['status'](_0x17c23d)[_0x6135('0x18')](_0x4065a7);}};}function respondWithFilteredResult(_0x146292,_0xd7e407){return function(_0x1dee5b){if(_0x1dee5b){var _0x37d1b0=typeof _0xd7e407[_0x6135('0x19')]===_0x6135('0x1a')&&typeof _0xd7e407[_0x6135('0x1b')]==='undefined';var _0x48eb63=_0x1dee5b[_0x6135('0x1c')];var _0x115b11=_0x37d1b0?0x0:_0xd7e407[_0x6135('0x19')];var _0x528dc5=_0x37d1b0?_0x1dee5b[_0x6135('0x1c')]:_0xd7e407[_0x6135('0x19')]+_0xd7e407[_0x6135('0x1b')];var _0x2c2c75;if(_0x528dc5>=_0x48eb63){_0x528dc5=_0x48eb63;_0x2c2c75=0xc8;}else{_0x2c2c75=0xce;}_0x146292[_0x6135('0x16')](_0x2c2c75);return _0x146292[_0x6135('0x1d')](_0x6135('0x1e'),_0x115b11+'-'+_0x528dc5+'/'+_0x48eb63)[_0x6135('0x18')](_0x1dee5b);}return null;};}function patchUpdates(_0x42218b){return function(_0xcab579){try{jsonpatch[_0x6135('0x1f')](_0xcab579,_0x42218b,!![]);}catch(_0x1d3029){return BPromise['reject'](_0x1d3029);}return _0xcab579[_0x6135('0x20')]();};}function saveUpdates(_0x53459b,_0x3e3164){return function(_0x6d82cb){if(_0x6d82cb){return _0x6d82cb['update'](_0x53459b)[_0x6135('0x21')](function(_0x140be5){return _0x140be5;});}return null;};}function removeEntity(_0x30cd71,_0x4ba410){return function(_0x21db13){if(_0x21db13){return _0x21db13['destroy']()['then'](function(){_0x30cd71[_0x6135('0x16')](0xcc)[_0x6135('0x17')]();});}};}function handleEntityNotFound(_0x4ce4b6,_0x117da0){return function(_0x1bc6f8){if(!_0x1bc6f8){_0x4ce4b6[_0x6135('0x15')](0x194);}return _0x1bc6f8;};}function handleError(_0x268a58,_0x26650a){_0x26650a=_0x26650a||0x1f4;return function(_0x27b944){logger['error'](_0x27b944['stack']);if(_0x27b944[_0x6135('0x22')]){delete _0x27b944[_0x6135('0x22')];}_0x268a58[_0x6135('0x16')](_0x26650a)[_0x6135('0x23')](_0x27b944);};}exports[_0x6135('0x24')]=function(_0x233a0a,_0x4516f2){var _0x628a6d={},_0x46ed6e={},_0xaa449b={'count':0x0,'rows':[]};var _0x17d245=_['map'](db['FaxTransferReport'][_0x6135('0x25')],function(_0x8691ad){return{'name':_0x8691ad[_0x6135('0x26')],'type':_0x8691ad[_0x6135('0x27')][_0x6135('0x28')]};});_0x46ed6e['model']=_[_0x6135('0x29')](_0x17d245,_0x6135('0x22'));_0x46ed6e['query']=_['keys'](_0x233a0a[_0x6135('0x2a')]);_0x46ed6e[_0x6135('0x2b')]=_[_0x6135('0x2c')](_0x46ed6e[_0x6135('0x2d')],_0x46ed6e[_0x6135('0x2a')]);_0x628a6d[_0x6135('0x2e')]=_['intersection'](_0x46ed6e['model'],qs[_0x6135('0x2f')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x2f')]));_0x628a6d[_0x6135('0x2e')]=_0x628a6d[_0x6135('0x2e')][_0x6135('0x30')]?_0x628a6d[_0x6135('0x2e')]:_0x46ed6e['model'];if(!_0x233a0a['query'][_0x6135('0x31')](_0x6135('0x32'))){_0x628a6d[_0x6135('0x1b')]=qs['limit'](_0x233a0a[_0x6135('0x2a')]['limit']);_0x628a6d[_0x6135('0x19')]=qs[_0x6135('0x19')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x19')]);}_0x628a6d[_0x6135('0x33')]=qs[_0x6135('0x34')](_0x233a0a[_0x6135('0x2a')][_0x6135('0x34')]);_0x628a6d[_0x6135('0x35')]=qs[_0x6135('0x2b')](_['pick'](_0x233a0a[_0x6135('0x2a')],_0x46ed6e[_0x6135('0x2b')]),_0x17d245);if(_0x233a0a[_0x6135('0x2a')][_0x6135('0x36')]){_0x628a6d[_0x6135('0x35')]=_[_0x6135('0x37')](_0x628a6d[_0x6135('0x35')],{'$or':_[_0x6135('0x29')](_0x17d245,function(_0x313b71){if(_0x313b71[_0x6135('0x27')]!==_0x6135('0x38')){var _0xbe4921={};_0xbe4921[_0x313b71[_0x6135('0x22')]]={'$like':'%'+_0x233a0a[_0x6135('0x2a')]['filter']+'%'};return _0xbe4921;}})});}_0x628a6d=_[_0x6135('0x37')]({},_0x628a6d,_0x233a0a[_0x6135('0x39')]);var _0x500b5c={'where':_0x628a6d[_0x6135('0x35')]};return db[_0x6135('0x3a')]['count'](_0x500b5c)[_0x6135('0x21')](function(_0x324211){_0xaa449b[_0x6135('0x1c')]=_0x324211;if(_0x233a0a[_0x6135('0x2a')]['includeAll']){_0x628a6d['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x6135('0x3b')](_0x628a6d);})['then'](function(_0x4f9852){_0xaa449b[_0x6135('0x3c')]=_0x4f9852;return _0xaa449b;})['then'](respondWithFilteredResult(_0x4516f2,_0x628a6d))[_0x6135('0x3d')](handleError(_0x4516f2,null));};exports[_0x6135('0x3e')]=function(_0x5e8c89,_0x2309f8){var _0x4aa6ef={'raw':!![],'where':{'id':_0x5e8c89[_0x6135('0x3f')]['id']}},_0x3dab04={};_0x3dab04[_0x6135('0x2d')]=_[_0x6135('0x40')](db[_0x6135('0x3a')][_0x6135('0x25')]);_0x3dab04[_0x6135('0x2a')]=_[_0x6135('0x40')](_0x5e8c89[_0x6135('0x2a')]);_0x3dab04[_0x6135('0x2b')]=_[_0x6135('0x2c')](_0x3dab04[_0x6135('0x2d')],_0x3dab04[_0x6135('0x2a')]);_0x4aa6ef[_0x6135('0x2e')]=_[_0x6135('0x2c')](_0x3dab04[_0x6135('0x2d')],qs[_0x6135('0x2f')](_0x5e8c89[_0x6135('0x2a')][_0x6135('0x2f')]));_0x4aa6ef['attributes']=_0x4aa6ef[_0x6135('0x2e')]['length']?_0x4aa6ef[_0x6135('0x2e')]:_0x3dab04[_0x6135('0x2d')];if(_0x5e8c89[_0x6135('0x2a')][_0x6135('0x41')]){_0x4aa6ef[_0x6135('0x42')]=[{'all':!![]}];}_0x4aa6ef=_[_0x6135('0x37')]({},_0x4aa6ef,_0x5e8c89[_0x6135('0x39')]);return db['FaxTransferReport'][_0x6135('0x43')](_0x4aa6ef)[_0x6135('0x21')](handleEntityNotFound(_0x2309f8,null))[_0x6135('0x21')](respondWithResult(_0x2309f8,null))[_0x6135('0x3d')](handleError(_0x2309f8,null));};exports[_0x6135('0x44')]=function(_0x4dd9ce,_0x5cf647){return db[_0x6135('0x3a')][_0x6135('0x44')](_0x4dd9ce[_0x6135('0x45')],{})['then'](respondWithResult(_0x5cf647,0xc9))[_0x6135('0x3d')](handleError(_0x5cf647,null));};exports[_0x6135('0x46')]=function(_0x490916,_0x21538b){if(_0x490916[_0x6135('0x45')]['id']){delete _0x490916[_0x6135('0x45')]['id'];}return db[_0x6135('0x3a')][_0x6135('0x43')]({'where':{'id':_0x490916['params']['id']}})[_0x6135('0x21')](handleEntityNotFound(_0x21538b,null))[_0x6135('0x21')](saveUpdates(_0x490916[_0x6135('0x45')],null))[_0x6135('0x21')](respondWithResult(_0x21538b,null))[_0x6135('0x3d')](handleError(_0x21538b,null));};exports[_0x6135('0x47')]=function(_0x14cf4c,_0x1cb976){return db['FaxTransferReport'][_0x6135('0x43')]({'where':{'id':_0x14cf4c[_0x6135('0x3f')]['id']}})[_0x6135('0x21')](handleEntityNotFound(_0x1cb976,null))[_0x6135('0x21')](removeEntity(_0x1cb976,null))[_0x6135('0x3d')](handleError(_0x1cb976,null));};exports[_0x6135('0x48')]=function(_0x4a4790,_0x3004f3){return db[_0x6135('0x3a')]['describe']()[_0x6135('0x21')](respondWithResult(_0x3004f3,null))[_0x6135('0x3d')](handleError(_0x3004f3,null));}; \ No newline at end of file +var _0x9185=['ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','FaxTransferReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','fast-json-patch','moment','util','path','to-csv'];(function(_0x51733c,_0x448082){var _0x5f50f9=function(_0x20a479){while(--_0x20a479){_0x51733c['push'](_0x51733c['shift']());}};_0x5f50f9(++_0x448082);}(_0x9185,0xcc));var _0x5918=function(_0x5b7e20,_0x17cfec){_0x5b7e20=_0x5b7e20-0x0;var _0x57eddf=_0x9185[_0x5b7e20];return _0x57eddf;};'use strict';var emlformat=require(_0x5918('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5918('0x1'));var rp=require('request-promise');var moment=require(_0x5918('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5918('0x3'));var path=require(_0x5918('0x4'));var sox=require('sox');var csv=require(_0x5918('0x5'));var ejs=require(_0x5918('0x6'));var fs=require('fs');var fs_extra=require(_0x5918('0x7'));var _=require('lodash');var squel=require(_0x5918('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5918('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5918('0xa'));var Redis=require(_0x5918('0xb'));var authService=require(_0x5918('0xc'));var qs=require(_0x5918('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5918('0xe'));var logger=require(_0x5918('0xf'))(_0x5918('0x10'));var utils=require(_0x5918('0x11'));var config=require(_0x5918('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5918('0x13'))['db'];function respondWithStatusCode(_0x175f18,_0x40b25e){_0x40b25e=_0x40b25e||0xcc;return function(_0x4547b4){if(_0x4547b4){return _0x175f18[_0x5918('0x14')](_0x40b25e);}return _0x175f18[_0x5918('0x15')](_0x40b25e)[_0x5918('0x16')]();};}function respondWithResult(_0x10168e,_0x4aa0b4){_0x4aa0b4=_0x4aa0b4||0xc8;return function(_0x2cb2b6){if(_0x2cb2b6){return _0x10168e[_0x5918('0x15')](_0x4aa0b4)[_0x5918('0x17')](_0x2cb2b6);}};}function respondWithFilteredResult(_0x1a7430,_0x2e3ecc){return function(_0x2a4bb0){if(_0x2a4bb0){var _0x3adaaa=typeof _0x2e3ecc[_0x5918('0x18')]==='undefined'&&typeof _0x2e3ecc[_0x5918('0x19')]===_0x5918('0x1a');var _0x7b934d=_0x2a4bb0[_0x5918('0x1b')];var _0x11dc78=_0x3adaaa?0x0:_0x2e3ecc[_0x5918('0x18')];var _0xd35461=_0x3adaaa?_0x2a4bb0[_0x5918('0x1b')]:_0x2e3ecc[_0x5918('0x18')]+_0x2e3ecc[_0x5918('0x19')];var _0x23f24f;if(_0xd35461>=_0x7b934d){_0xd35461=_0x7b934d;_0x23f24f=0xc8;}else{_0x23f24f=0xce;}_0x1a7430['status'](_0x23f24f);return _0x1a7430[_0x5918('0x1c')](_0x5918('0x1d'),_0x11dc78+'-'+_0xd35461+'/'+_0x7b934d)[_0x5918('0x17')](_0x2a4bb0);}return null;};}function patchUpdates(_0x321913){return function(_0x168356){try{jsonpatch[_0x5918('0x1e')](_0x168356,_0x321913,!![]);}catch(_0x2271cf){return BPromise[_0x5918('0x1f')](_0x2271cf);}return _0x168356['save']();};}function saveUpdates(_0x4108e4,_0x279ada){return function(_0x271065){if(_0x271065){return _0x271065[_0x5918('0x20')](_0x4108e4)[_0x5918('0x21')](function(_0x164f66){return _0x164f66;});}return null;};}function removeEntity(_0x20b5d7,_0x1df252){return function(_0x553ba7){if(_0x553ba7){return _0x553ba7[_0x5918('0x22')]()['then'](function(){_0x20b5d7[_0x5918('0x15')](0xcc)[_0x5918('0x16')]();});}};}function handleEntityNotFound(_0x2d9637,_0x4d618d){return function(_0x121e5e){if(!_0x121e5e){_0x2d9637[_0x5918('0x14')](0x194);}return _0x121e5e;};}function handleError(_0x512d54,_0x81982e){_0x81982e=_0x81982e||0x1f4;return function(_0x561ae0){logger[_0x5918('0x23')](_0x561ae0['stack']);if(_0x561ae0[_0x5918('0x24')]){delete _0x561ae0[_0x5918('0x24')];}_0x512d54[_0x5918('0x15')](_0x81982e)[_0x5918('0x25')](_0x561ae0);};}exports['index']=function(_0x448364,_0x137d1f){var _0x658ad3={},_0x58b934={},_0x4f311b={'count':0x0,'rows':[]};var _0x37a2b9=_[_0x5918('0x26')](db[_0x5918('0x27')][_0x5918('0x28')],function(_0x31022e){return{'name':_0x31022e[_0x5918('0x29')],'type':_0x31022e['type']['key']};});_0x58b934[_0x5918('0x2a')]=_[_0x5918('0x26')](_0x37a2b9,'name');_0x58b934[_0x5918('0x2b')]=_['keys'](_0x448364['query']);_0x58b934[_0x5918('0x2c')]=_[_0x5918('0x2d')](_0x58b934['model'],_0x58b934[_0x5918('0x2b')]);_0x658ad3[_0x5918('0x2e')]=_[_0x5918('0x2d')](_0x58b934[_0x5918('0x2a')],qs[_0x5918('0x2f')](_0x448364[_0x5918('0x2b')]['fields']));_0x658ad3[_0x5918('0x2e')]=_0x658ad3[_0x5918('0x2e')][_0x5918('0x30')]?_0x658ad3[_0x5918('0x2e')]:_0x58b934['model'];if(!_0x448364[_0x5918('0x2b')][_0x5918('0x31')]('nolimit')){_0x658ad3[_0x5918('0x19')]=qs[_0x5918('0x19')](_0x448364[_0x5918('0x2b')]['limit']);_0x658ad3[_0x5918('0x18')]=qs[_0x5918('0x18')](_0x448364[_0x5918('0x2b')][_0x5918('0x18')]);}_0x658ad3[_0x5918('0x32')]=qs[_0x5918('0x33')](_0x448364[_0x5918('0x2b')]['sort']);_0x658ad3[_0x5918('0x34')]=qs[_0x5918('0x2c')](_[_0x5918('0x35')](_0x448364['query'],_0x58b934['filters']),_0x37a2b9);if(_0x448364[_0x5918('0x2b')]['filter']){_0x658ad3[_0x5918('0x34')]=_[_0x5918('0x36')](_0x658ad3[_0x5918('0x34')],{'$or':_[_0x5918('0x26')](_0x37a2b9,function(_0x266821){if(_0x266821[_0x5918('0x37')]!=='VIRTUAL'){var _0x3a58a3={};_0x3a58a3[_0x266821[_0x5918('0x24')]]={'$like':'%'+_0x448364[_0x5918('0x2b')][_0x5918('0x38')]+'%'};return _0x3a58a3;}})});}_0x658ad3=_[_0x5918('0x36')]({},_0x658ad3,_0x448364[_0x5918('0x39')]);var _0x5b2063={'where':_0x658ad3['where']};return db[_0x5918('0x27')][_0x5918('0x1b')](_0x5b2063)[_0x5918('0x21')](function(_0x368cb4){_0x4f311b[_0x5918('0x1b')]=_0x368cb4;if(_0x448364[_0x5918('0x2b')]['includeAll']){_0x658ad3[_0x5918('0x3a')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x5918('0x3b')](_0x658ad3);})[_0x5918('0x21')](function(_0x1bbcef){_0x4f311b[_0x5918('0x3c')]=_0x1bbcef;return _0x4f311b;})['then'](respondWithFilteredResult(_0x137d1f,_0x658ad3))[_0x5918('0x3d')](handleError(_0x137d1f,null));};exports[_0x5918('0x3e')]=function(_0x4b41b5,_0x199633){var _0x4fa6c6={'raw':!![],'where':{'id':_0x4b41b5[_0x5918('0x3f')]['id']}},_0xfe07f7={};_0xfe07f7['model']=_[_0x5918('0x40')](db[_0x5918('0x27')][_0x5918('0x28')]);_0xfe07f7[_0x5918('0x2b')]=_[_0x5918('0x40')](_0x4b41b5[_0x5918('0x2b')]);_0xfe07f7['filters']=_['intersection'](_0xfe07f7[_0x5918('0x2a')],_0xfe07f7[_0x5918('0x2b')]);_0x4fa6c6[_0x5918('0x2e')]=_['intersection'](_0xfe07f7[_0x5918('0x2a')],qs[_0x5918('0x2f')](_0x4b41b5[_0x5918('0x2b')][_0x5918('0x2f')]));_0x4fa6c6[_0x5918('0x2e')]=_0x4fa6c6['attributes'][_0x5918('0x30')]?_0x4fa6c6[_0x5918('0x2e')]:_0xfe07f7[_0x5918('0x2a')];if(_0x4b41b5['query'][_0x5918('0x41')]){_0x4fa6c6[_0x5918('0x3a')]=[{'all':!![]}];}_0x4fa6c6=_['merge']({},_0x4fa6c6,_0x4b41b5[_0x5918('0x39')]);return db[_0x5918('0x27')][_0x5918('0x42')](_0x4fa6c6)[_0x5918('0x21')](handleEntityNotFound(_0x199633,null))[_0x5918('0x21')](respondWithResult(_0x199633,null))[_0x5918('0x3d')](handleError(_0x199633,null));};exports[_0x5918('0x43')]=function(_0x29699d,_0xfe8aa5){return db[_0x5918('0x27')]['create'](_0x29699d[_0x5918('0x44')],{})['then'](respondWithResult(_0xfe8aa5,0xc9))[_0x5918('0x3d')](handleError(_0xfe8aa5,null));};exports[_0x5918('0x20')]=function(_0x932f9e,_0x330c90){if(_0x932f9e[_0x5918('0x44')]['id']){delete _0x932f9e[_0x5918('0x44')]['id'];}return db[_0x5918('0x27')][_0x5918('0x42')]({'where':{'id':_0x932f9e[_0x5918('0x3f')]['id']}})['then'](handleEntityNotFound(_0x330c90,null))[_0x5918('0x21')](saveUpdates(_0x932f9e['body'],null))[_0x5918('0x21')](respondWithResult(_0x330c90,null))[_0x5918('0x3d')](handleError(_0x330c90,null));};exports[_0x5918('0x22')]=function(_0x456bff,_0x98c3d1){return db[_0x5918('0x27')]['find']({'where':{'id':_0x456bff[_0x5918('0x3f')]['id']}})[_0x5918('0x21')](handleEntityNotFound(_0x98c3d1,null))['then'](removeEntity(_0x98c3d1,null))[_0x5918('0x3d')](handleError(_0x98c3d1,null));};exports[_0x5918('0x45')]=function(_0x52d187,_0x46f719){return db['FaxTransferReport'][_0x5918('0x45')]()[_0x5918('0x21')](respondWithResult(_0x46f719,null))['catch'](handleError(_0x46f719,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7cc2488..4e182ec 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 _0xe34f=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','moment','bluebird'];(function(_0x15f892,_0x2139c3){var _0x188630=function(_0x591c79){while(--_0x591c79){_0x15f892['push'](_0x15f892['shift']());}};_0x188630(++_0x2139c3);}(_0xe34f,0xbc));var _0xfe34=function(_0x4f3b87,_0x388c4a){_0x4f3b87=_0x4f3b87-0x0;var _0x5a8062=_0xe34f[_0x4f3b87];return _0x5a8062;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe34('0x0'));var BPromise=require(_0xfe34('0x1'));var rp=require(_0xfe34('0x2'));var fs=require('fs');var path=require(_0xfe34('0x3'));var rimraf=require(_0xfe34('0x4'));var config=require(_0xfe34('0x5'));var attributes=require(_0xfe34('0x6'));module['exports']=function(_0x1a3c2b,_0x24e8cb){return _0x1a3c2b[_0xfe34('0x7')](_0xfe34('0x8'),attributes,{'tableName':_0xfe34('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['define','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports'];(function(_0x5b1e75,_0x14a20f){var _0x3b7fe5=function(_0x1aa7cb){while(--_0x1aa7cb){_0x5b1e75['push'](_0x5b1e75['shift']());}};_0x3b7fe5(++_0x14a20f);}(_0x1261,0xc6));var _0x1126=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x1261[_0xcfe8cc];return _0x55ac53;};'use strict';var _=require(_0x1126('0x0'));var util=require('util');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('../../config/environment');var attributes=require(_0x1126('0x8'));module[_0x1126('0x9')]=function(_0x5af698,_0x487a7f){return _0x5af698[_0x1126('0xa')]('FaxTransferReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1034ef6..2f08e71 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 _0x7223=['error','code','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d18c3,_0x2c5378){var _0x2ce341=function(_0x5db4a6){while(--_0x5db4a6){_0x1d18c3['push'](_0x1d18c3['shift']());}};_0x2ce341(++_0x2c5378);}(_0x7223,0x18c));var _0x3722=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7223[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x3722('0x0'));var util=require(_0x3722('0x1'));var moment=require('moment');var BPromise=require(_0x3722('0x2'));var rs=require(_0x3722('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3722('0x4'))['db'];var utils=require(_0x3722('0x5'));var logger=require(_0x3722('0x6'))(_0x3722('0x7'));var config=require(_0x3722('0x8'));var jayson=require(_0x3722('0x9'));var client=jayson[_0x3722('0xa')][_0x3722('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282747,_0x5eb448,_0x5ee11c){return new BPromise(function(_0x3e8a25,_0x27308f){return client[_0x3722('0xc')](_0x282747,_0x5ee11c)['then'](function(_0x11c690){logger['info'](_0x3722('0xd'),_0x5eb448,_0x3722('0xe'));logger[_0x3722('0xf')](_0x3722('0x10'),_0x5eb448,_0x3722('0xe'),JSON[_0x3722('0x11')](_0x11c690));if(_0x11c690[_0x3722('0x12')]){if(_0x11c690[_0x3722('0x12')][_0x3722('0x13')]===0x1f4){logger[_0x3722('0x12')](_0x3722('0xd'),_0x5eb448,_0x11c690[_0x3722('0x12')][_0x3722('0x14')]);return _0x27308f(_0x11c690[_0x3722('0x12')]['message']);}logger[_0x3722('0x12')](_0x3722('0xd'),_0x5eb448,_0x11c690[_0x3722('0x12')][_0x3722('0x14')]);return _0x3e8a25(_0x11c690['error'][_0x3722('0x14')]);}else{logger[_0x3722('0x15')](_0x3722('0xd'),_0x5eb448,_0x3722('0xe'));_0x3e8a25(_0x11c690[_0x3722('0x16')][_0x3722('0x14')]);}})['catch'](function(_0x36ab1b){logger[_0x3722('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5eb448,_0x36ab1b);_0x27308f(_0x36ab1b);});});} \ No newline at end of file +var _0xfb38=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x34d440,_0x5e69ee){var _0x3e5044=function(_0x3152f6){while(--_0x3152f6){_0x34d440['push'](_0x34d440['shift']());}};_0x3e5044(++_0x5e69ee);}(_0xfb38,0x1c8));var _0x8fb3=function(_0xf351f3,_0x4a90f4){_0xf351f3=_0xf351f3-0x0;var _0x21d574=_0xfb38[_0xf351f3];return _0x21d574;};'use strict';var _=require(_0x8fb3('0x0'));var util=require(_0x8fb3('0x1'));var moment=require(_0x8fb3('0x2'));var BPromise=require(_0x8fb3('0x3'));var rs=require(_0x8fb3('0x4'));var fs=require('fs');var Redis=require(_0x8fb3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fb3('0x6'));var logger=require(_0x8fb3('0x7'))(_0x8fb3('0x8'));var config=require(_0x8fb3('0x9'));var jayson=require(_0x8fb3('0xa'));var client=jayson[_0x8fb3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41294e,_0x392ae2,_0x4cd5b2){return new BPromise(function(_0x134d12,_0x2caae5){return client['request'](_0x41294e,_0x4cd5b2)[_0x8fb3('0xc')](function(_0x599d66){logger[_0x8fb3('0xd')](_0x8fb3('0xe'),_0x392ae2,_0x8fb3('0xf'));logger[_0x8fb3('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x392ae2,_0x8fb3('0xf'),JSON['stringify'](_0x599d66));if(_0x599d66[_0x8fb3('0x11')]){if(_0x599d66[_0x8fb3('0x11')][_0x8fb3('0x12')]===0x1f4){logger['error'](_0x8fb3('0xe'),_0x392ae2,_0x599d66['error']['message']);return _0x2caae5(_0x599d66[_0x8fb3('0x11')][_0x8fb3('0x13')]);}logger[_0x8fb3('0x11')](_0x8fb3('0xe'),_0x392ae2,_0x599d66[_0x8fb3('0x11')][_0x8fb3('0x13')]);return _0x134d12(_0x599d66['error'][_0x8fb3('0x13')]);}else{logger[_0x8fb3('0xd')](_0x8fb3('0xe'),_0x392ae2,'request\x20sent');_0x134d12(_0x599d66['result'][_0x8fb3('0x13')]);}})[_0x8fb3('0x14')](function(_0x55f4da){logger['error'](_0x8fb3('0xe'),_0x392ae2,_0x55f4da);_0x2caae5(_0x55f4da);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index cbaa12b..b1c5b02 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 _0x456d=['put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x369ee0,_0x57a15c){var _0x493a06=function(_0x570aaf){while(--_0x570aaf){_0x369ee0['push'](_0x369ee0['shift']());}};_0x493a06(++_0x57a15c);}(_0x456d,0x97));var _0xd456=function(_0x118af1,_0x2cdca2){_0x118af1=_0x118af1-0x0;var _0x4d1955=_0x456d[_0x118af1];return _0x4d1955;};'use strict';var multer=require('multer');var util=require(_0xd456('0x0'));var path=require('path');var timeout=require(_0xd456('0x1'));var express=require(_0xd456('0x2'));var router=express[_0xd456('0x3')]();var fs_extra=require(_0xd456('0x4'));var auth=require(_0xd456('0x5'));var interaction=require(_0xd456('0x6'));var config=require('../../config/environment');var controller=require(_0xd456('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd456('0x8')]);router[_0xd456('0x9')](_0xd456('0xa'),auth['isAuthenticated'](),controller[_0xd456('0xb')]);router[_0xd456('0x9')](_0xd456('0xc'),auth[_0xd456('0xd')](),controller[_0xd456('0xe')]);router[_0xd456('0xf')]('/',auth[_0xd456('0xd')](),controller[_0xd456('0x10')]);router[_0xd456('0x11')]('/:id',auth[_0xd456('0xd')](),controller[_0xd456('0x12')]);router[_0xd456('0x13')](_0xd456('0xc'),auth[_0xd456('0xd')](),controller[_0xd456('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa67c=['../../components/interaction/service','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xa67c,0x79));var _0xca67=function(_0x22bd1b,_0x4c7d93){_0x22bd1b=_0x22bd1b-0x0;var _0x34a973=_0xa67c[_0x22bd1b];return _0x34a973;};'use strict';var multer=require('multer');var util=require(_0xca67('0x0'));var path=require(_0xca67('0x1'));var timeout=require(_0xca67('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xca67('0x3'));var auth=require(_0xca67('0x4'));var interaction=require(_0xca67('0x5'));var config=require('../../config/environment');var controller=require(_0xca67('0x6'));router[_0xca67('0x7')]('/',auth['isAuthenticated'](),controller[_0xca67('0x8')]);router[_0xca67('0x7')](_0xca67('0x9'),auth[_0xca67('0xa')](),controller[_0xca67('0xb')]);router[_0xca67('0x7')](_0xca67('0xc'),auth['isAuthenticated'](),controller[_0xca67('0xd')]);router['post']('/',auth[_0xca67('0xa')](),controller[_0xca67('0xe')]);router['put']('/:id',auth[_0xca67('0xa')](),controller[_0xca67('0xf')]);router['delete']('/:id',auth[_0xca67('0xa')](),controller[_0xca67('0x10')]);module[_0xca67('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1b506c4..55ed9d3 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 _0x62b4=['/:id/configurations','getConfigurations','post','addConfiguration','put','update','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2e7d01,_0x5777be){var _0x5b0265=function(_0x3ee6b9){while(--_0x3ee6b9){_0x2e7d01['push'](_0x2e7d01['shift']());}};_0x5b0265(++_0x5777be);}(_0x62b4,0xd0));var _0x462b=function(_0x348d2e,_0x2b7b9b){_0x348d2e=_0x348d2e-0x0;var _0x143ca5=_0x62b4[_0x348d2e];return _0x143ca5;};'use strict';var multer=require('multer');var util=require(_0x462b('0x0'));var path=require('path');var timeout=require(_0x462b('0x1'));var express=require('express');var router=express[_0x462b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x462b('0x3'));var interaction=require(_0x462b('0x4'));var config=require(_0x462b('0x5'));var controller=require(_0x462b('0x6'));router['get']('/',auth[_0x462b('0x7')](),controller[_0x462b('0x8')]);router[_0x462b('0x9')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0xb')]);router[_0x462b('0x9')](_0x462b('0xc'),auth[_0x462b('0x7')](),controller[_0x462b('0xd')]);router[_0x462b('0x9')]('/:id/fields',auth[_0x462b('0x7')](),controller['getFields']);router[_0x462b('0xe')]('/',auth[_0x462b('0x7')](),controller['create']);router['post'](_0x462b('0xc'),auth[_0x462b('0x7')](),controller[_0x462b('0xf')]);router[_0x462b('0x10')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0x11')]);router[_0x462b('0x12')](_0x462b('0xa'),auth[_0x462b('0x7')](),controller[_0x462b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9e27=['/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations'];(function(_0x336d02,_0x1eef46){var _0x2c83fc=function(_0x3aa74b){while(--_0x3aa74b){_0x336d02['push'](_0x336d02['shift']());}};_0x2c83fc(++_0x1eef46);}(_0x9e27,0x15c));var _0x79e2=function(_0xfe1760,_0x2331a9){_0xfe1760=_0xfe1760-0x0;var _0x4e244d=_0x9e27[_0xfe1760];return _0x4e244d;};'use strict';var multer=require(_0x79e2('0x0'));var util=require('util');var path=require(_0x79e2('0x1'));var timeout=require(_0x79e2('0x2'));var express=require('express');var router=express[_0x79e2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x79e2('0x4'));var config=require(_0x79e2('0x5'));var controller=require(_0x79e2('0x6'));router[_0x79e2('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x79e2('0x8'),auth[_0x79e2('0x9')](),controller[_0x79e2('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x79e2('0xb')]);router['get'](_0x79e2('0xc'),auth[_0x79e2('0x9')](),controller['getFields']);router[_0x79e2('0xd')]('/',auth[_0x79e2('0x9')](),controller[_0x79e2('0xe')]);router['post'](_0x79e2('0xf'),auth[_0x79e2('0x9')](),controller[_0x79e2('0x10')]);router[_0x79e2('0x11')](_0x79e2('0x8'),auth[_0x79e2('0x9')](),controller['update']);router[_0x79e2('0x12')](_0x79e2('0x8'),auth['isAuthenticated'](),controller[_0x79e2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ea2a46b..985443d 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 _0x9862=['integrationTab','STRING','ENUM','basic'];(function(_0x4abd58,_0x523c62){var _0x3608a8=function(_0xa5878){while(--_0xa5878){_0x4abd58['push'](_0x4abd58['shift']());}};_0x3608a8(++_0x523c62);}(_0x9862,0x151));var _0x2986=function(_0x517a82,_0x2c4dde){_0x517a82=_0x517a82-0x0;var _0x8fd0d2=_0x9862[_0x517a82];return _0x8fd0d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2986('0x0')]},'description':{'type':Sequelize[_0x2986('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2986('0x0')]},'authType':{'type':Sequelize[_0x2986('0x1')]('basic'),'defaultValue':_0x2986('0x2')},'password':{'type':Sequelize[_0x2986('0x0')]},'consumerKey':{'type':Sequelize[_0x2986('0x0')]},'consumerSecret':{'type':Sequelize[_0x2986('0x0')]},'token':{'type':Sequelize[_0x2986('0x0')]},'tokenSecret':{'type':Sequelize[_0x2986('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x2986('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x1199=['newTab','exports','STRING','ENUM','basic','integrationTab'];(function(_0x1d4360,_0x4f4af9){var _0x78f351=function(_0x5027b1){while(--_0x5027b1){_0x1d4360['push'](_0x1d4360['shift']());}};_0x78f351(++_0x4f4af9);}(_0x1199,0x19f));var _0x9119=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x1199[_0x49ca6b];return _0x1d957f;};'use strict';var Sequelize=require('sequelize');module[_0x9119('0x0')]={'name':{'type':Sequelize[_0x9119('0x1')]},'description':{'type':Sequelize[_0x9119('0x1')]},'username':{'type':Sequelize[_0x9119('0x1')]},'remoteUri':{'type':Sequelize[_0x9119('0x1')]},'authType':{'type':Sequelize[_0x9119('0x2')](_0x9119('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x9119('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x9119('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x9119('0x1')]},'serverUrl':{'type':Sequelize[_0x9119('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9119('0x2')](_0x9119('0x4'),_0x9119('0x5')),'defaultValue':_0x9119('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b96d441..f0ea2b5 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 _0x5088=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','filters','attributes','intersection','model','nolimit','order','sort','where','filter','merge','includeAll','rows','show','keys','fields','length','include','options','find','catch','create','update','body','destroy','params','getConfigurations','findOne','pick','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x182255,_0x25f595){var _0x3528f9=function(_0x508c1b){while(--_0x508c1b){_0x182255['push'](_0x182255['shift']());}};_0x3528f9(++_0x25f595);}(_0x5088,0x1bd));var _0x8508=function(_0x19a7f6,_0x3abadc){_0x19a7f6=_0x19a7f6-0x0;var _0x5831b8=_0x5088[_0x19a7f6];return _0x5831b8;};'use strict';var emlformat=require(_0x8508('0x0'));var rimraf=require(_0x8508('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8508('0x2'));var rp=require(_0x8508('0x3'));var moment=require(_0x8508('0x4'));var BPromise=require(_0x8508('0x5'));var Mustache=require(_0x8508('0x6'));var util=require(_0x8508('0x7'));var path=require(_0x8508('0x8'));var sox=require(_0x8508('0x9'));var csv=require(_0x8508('0xa'));var ejs=require(_0x8508('0xb'));var fs=require('fs');var fs_extra=require(_0x8508('0xc'));var _=require(_0x8508('0xd'));var squel=require(_0x8508('0xe'));var crypto=require(_0x8508('0xf'));var jsforce=require(_0x8508('0x10'));var deskjs=require(_0x8508('0x11'));var toCsv=require(_0x8508('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8508('0x12'));var qs=require(_0x8508('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8508('0x14'));var logger=require(_0x8508('0x15'))(_0x8508('0x16'));var utils=require(_0x8508('0x17'));var config=require(_0x8508('0x18'));var licenseUtil=require(_0x8508('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8508('0x1a'));function respondWithStatusCode(_0x2c59fc,_0x793be1){_0x793be1=_0x793be1||0xcc;return function(_0x53c4dc){if(_0x53c4dc){return _0x2c59fc[_0x8508('0x1b')](_0x793be1);}return _0x2c59fc[_0x8508('0x1c')](_0x793be1)[_0x8508('0x1d')]();};}function respondWithResult(_0x1b9ff4,_0x126385){_0x126385=_0x126385||0xc8;return function(_0x1136a8){if(_0x1136a8){return _0x1b9ff4[_0x8508('0x1c')](_0x126385)[_0x8508('0x1e')](_0x1136a8);}};}function respondWithFilteredResult(_0x589003,_0x407d06){return function(_0xef780e){if(_0xef780e){var _0x62327a=typeof _0x407d06[_0x8508('0x1f')]===_0x8508('0x20')&&typeof _0x407d06[_0x8508('0x21')]===_0x8508('0x20');var _0x5aff6c=_0xef780e['count'];var _0x453fbd=_0x62327a?0x0:_0x407d06['offset'];var _0x1a288d=_0x62327a?_0xef780e[_0x8508('0x22')]:_0x407d06[_0x8508('0x1f')]+_0x407d06[_0x8508('0x21')];var _0x206f2d;if(_0x1a288d>=_0x5aff6c){_0x1a288d=_0x5aff6c;_0x206f2d=0xc8;}else{_0x206f2d=0xce;}_0x589003['status'](_0x206f2d);return _0x589003[_0x8508('0x23')]('Content-Range',_0x453fbd+'-'+_0x1a288d+'/'+_0x5aff6c)[_0x8508('0x1e')](_0xef780e);}return null;};}function patchUpdates(_0x134a86){return function(_0xaf77e4){try{jsonpatch[_0x8508('0x24')](_0xaf77e4,_0x134a86,!![]);}catch(_0x53841b){return BPromise[_0x8508('0x25')](_0x53841b);}return _0xaf77e4[_0x8508('0x26')]();};}function saveUpdates(_0x347aed,_0xf673c0){return function(_0x5e2b66){if(_0x5e2b66){return _0x5e2b66['update'](_0x347aed)[_0x8508('0x27')](function(_0xbfc43b){return _0xbfc43b;});}return null;};}function removeEntity(_0x3f546b,_0x59366c){return function(_0x16a92a){if(_0x16a92a){return _0x16a92a['destroy']()[_0x8508('0x27')](function(){_0x3f546b['status'](0xcc)[_0x8508('0x1d')]();});}};}function handleEntityNotFound(_0x4670d1,_0x112698){return function(_0x1c5090){if(!_0x1c5090){_0x4670d1[_0x8508('0x1b')](0x194);}return _0x1c5090;};}function handleError(_0x49e8e7,_0x88220e){_0x88220e=_0x88220e||0x1f4;return function(_0x285516){logger[_0x8508('0x28')](_0x285516[_0x8508('0x29')]);if(_0x285516['name']){delete _0x285516[_0x8508('0x2a')];}_0x49e8e7[_0x8508('0x1c')](_0x88220e)[_0x8508('0x2b')](_0x285516);};}exports[_0x8508('0x2c')]=function(_0x206429,_0x5cea3b){var _0x348739={},_0x304b8e={},_0x2554d2={'count':0x0,'rows':[]};var _0x1598e6=_[_0x8508('0x2d')](db[_0x8508('0x2e')][_0x8508('0x2f')],function(_0x483415){return{'name':_0x483415['fieldName'],'type':_0x483415[_0x8508('0x30')][_0x8508('0x31')]};});_0x304b8e['model']=_['map'](_0x1598e6,_0x8508('0x2a'));_0x304b8e['query']=_['keys'](_0x206429[_0x8508('0x32')]);_0x304b8e[_0x8508('0x33')]=_['intersection'](_0x304b8e['model'],_0x304b8e[_0x8508('0x32')]);_0x348739[_0x8508('0x34')]=_[_0x8508('0x35')](_0x304b8e['model'],qs['fields'](_0x206429[_0x8508('0x32')]['fields']));_0x348739[_0x8508('0x34')]=_0x348739[_0x8508('0x34')]['length']?_0x348739['attributes']:_0x304b8e[_0x8508('0x36')];if(!_0x206429[_0x8508('0x32')]['hasOwnProperty'](_0x8508('0x37'))){_0x348739[_0x8508('0x21')]=qs[_0x8508('0x21')](_0x206429[_0x8508('0x32')][_0x8508('0x21')]);_0x348739[_0x8508('0x1f')]=qs[_0x8508('0x1f')](_0x206429['query'][_0x8508('0x1f')]);}_0x348739[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x206429['query']['sort']);_0x348739[_0x8508('0x3a')]=qs[_0x8508('0x33')](_['pick'](_0x206429[_0x8508('0x32')],_0x304b8e['filters']),_0x1598e6);if(_0x206429[_0x8508('0x32')][_0x8508('0x3b')]){_0x348739[_0x8508('0x3a')]=_[_0x8508('0x3c')](_0x348739[_0x8508('0x3a')],{'$or':_[_0x8508('0x2d')](_0x1598e6,function(_0x536768){if(_0x536768[_0x8508('0x30')]!=='VIRTUAL'){var _0x3ee25e={};_0x3ee25e[_0x536768[_0x8508('0x2a')]]={'$like':'%'+_0x206429[_0x8508('0x32')]['filter']+'%'};return _0x3ee25e;}})});}_0x348739=_[_0x8508('0x3c')]({},_0x348739,_0x206429['options']);var _0x2be83a={'where':_0x348739[_0x8508('0x3a')]};return db['DeskAccount'][_0x8508('0x22')](_0x2be83a)['then'](function(_0x41a47a){_0x2554d2[_0x8508('0x22')]=_0x41a47a;if(_0x206429['query'][_0x8508('0x3d')]){_0x348739['include']=[{'all':!![]}];}return db[_0x8508('0x2e')]['findAll'](_0x348739);})[_0x8508('0x27')](function(_0x21a5c6){_0x2554d2[_0x8508('0x3e')]=_0x21a5c6;return _0x2554d2;})[_0x8508('0x27')](respondWithFilteredResult(_0x5cea3b,_0x348739))['catch'](handleError(_0x5cea3b,null));};exports[_0x8508('0x3f')]=function(_0x41b90b,_0x182aaf){var _0x39b556={'raw':![],'where':{'id':_0x41b90b['params']['id']}},_0x22c94b={};_0x22c94b[_0x8508('0x36')]=_[_0x8508('0x40')](db['DeskAccount']['rawAttributes']);_0x22c94b['query']=_[_0x8508('0x40')](_0x41b90b['query']);_0x22c94b[_0x8508('0x33')]=_[_0x8508('0x35')](_0x22c94b[_0x8508('0x36')],_0x22c94b['query']);_0x39b556[_0x8508('0x34')]=_[_0x8508('0x35')](_0x22c94b[_0x8508('0x36')],qs[_0x8508('0x41')](_0x41b90b[_0x8508('0x32')][_0x8508('0x41')]));_0x39b556[_0x8508('0x34')]=_0x39b556[_0x8508('0x34')][_0x8508('0x42')]?_0x39b556['attributes']:_0x22c94b['model'];if(_0x41b90b[_0x8508('0x32')][_0x8508('0x3d')]){_0x39b556[_0x8508('0x43')]=[{'all':!![]}];}_0x39b556=_[_0x8508('0x3c')]({},_0x39b556,_0x41b90b[_0x8508('0x44')]);return db[_0x8508('0x2e')][_0x8508('0x45')](_0x39b556)[_0x8508('0x27')](handleEntityNotFound(_0x182aaf,null))[_0x8508('0x27')](respondWithResult(_0x182aaf,null))[_0x8508('0x46')](handleError(_0x182aaf,null));};exports['create']=function(_0x55cf56,_0x2bb9e0){return db['DeskAccount'][_0x8508('0x47')](_0x55cf56['body'],{})[_0x8508('0x27')](respondWithResult(_0x2bb9e0,0xc9))[_0x8508('0x46')](handleError(_0x2bb9e0,null));};exports[_0x8508('0x48')]=function(_0x931ccb,_0x1cf62a){if(_0x931ccb[_0x8508('0x49')]['id']){delete _0x931ccb[_0x8508('0x49')]['id'];}return db['DeskAccount'][_0x8508('0x45')]({'where':{'id':_0x931ccb['params']['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x1cf62a,null))[_0x8508('0x27')](saveUpdates(_0x931ccb['body'],null))[_0x8508('0x27')](respondWithResult(_0x1cf62a,null))[_0x8508('0x46')](handleError(_0x1cf62a,null));};exports[_0x8508('0x4a')]=function(_0x3a08a1,_0x5dfc76){return db[_0x8508('0x2e')]['find']({'where':{'id':_0x3a08a1[_0x8508('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5dfc76,null))[_0x8508('0x27')](removeEntity(_0x5dfc76,null))[_0x8508('0x46')](handleError(_0x5dfc76,null));};exports[_0x8508('0x4c')]=function(_0x3ee189,_0x40aca2,_0x2bb3b4){var _0x20835c={};var _0xbcb1ac={};var _0x287812;var _0x867c81;return db['DeskAccount'][_0x8508('0x4d')]({'where':{'id':_0x3ee189[_0x8508('0x4b')]['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x40aca2,null))['then'](function(_0x23faa1){if(_0x23faa1){_0x287812=_0x23faa1;_0xbcb1ac[_0x8508('0x36')]=_[_0x8508('0x40')](db['DeskConfiguration'][_0x8508('0x2f')]);_0xbcb1ac[_0x8508('0x32')]=_['keys'](_0x3ee189['query']);_0xbcb1ac['filters']=_[_0x8508('0x35')](_0xbcb1ac[_0x8508('0x36')],_0xbcb1ac[_0x8508('0x32')]);_0x20835c[_0x8508('0x34')]=_[_0x8508('0x35')](_0xbcb1ac[_0x8508('0x36')],qs[_0x8508('0x41')](_0x3ee189[_0x8508('0x32')]['fields']));_0x20835c[_0x8508('0x34')]=_0x20835c[_0x8508('0x34')][_0x8508('0x42')]?_0x20835c[_0x8508('0x34')]:_0xbcb1ac[_0x8508('0x36')];_0x20835c[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x3ee189[_0x8508('0x32')]['sort']);_0x20835c[_0x8508('0x3a')]=qs[_0x8508('0x33')](_[_0x8508('0x4e')](_0x3ee189['query'],_0xbcb1ac[_0x8508('0x33')]));if(_0x3ee189[_0x8508('0x32')][_0x8508('0x3b')]){_0x20835c['where']=_['merge'](_0x20835c[_0x8508('0x3a')],{'$or':_['map'](_0x20835c[_0x8508('0x34')],function(_0x1e996c){var _0x1e2b96={};_0x1e2b96[_0x1e996c]={'$like':'%'+_0x3ee189[_0x8508('0x32')][_0x8508('0x3b')]+'%'};return _0x1e2b96;})});}_0x20835c=_[_0x8508('0x3c')]({},_0x20835c,_0x3ee189[_0x8508('0x44')]);return _0x287812[_0x8508('0x4c')](_0x20835c);}})[_0x8508('0x27')](function(_0x419bbf){if(_0x419bbf){_0x867c81=_0x419bbf['length'];if(!_0x3ee189[_0x8508('0x32')][_0x8508('0x4f')]('nolimit')){_0x20835c[_0x8508('0x21')]=qs[_0x8508('0x21')](_0x3ee189[_0x8508('0x32')]['limit']);_0x20835c[_0x8508('0x1f')]=qs['offset'](_0x3ee189[_0x8508('0x32')]['offset']);}return _0x287812['getConfigurations'](_0x20835c);}})[_0x8508('0x27')](function(_0x514956){if(_0x514956){return _0x514956?{'count':_0x867c81,'rows':_0x514956}:null;}})['then'](respondWithResult(_0x40aca2,null))[_0x8508('0x46')](handleError(_0x40aca2,null));};exports['addConfiguration']=function(_0x451a60,_0x39541c,_0x2dba22){if(_0x451a60[_0x8508('0x49')]['id']){delete _0x451a60[_0x8508('0x49')]['id'];}return db[_0x8508('0x2e')][_0x8508('0x4d')]({'where':{'id':_0x451a60[_0x8508('0x4b')]['id']}})[_0x8508('0x27')](handleEntityNotFound(_0x39541c,null))[_0x8508('0x27')](function(_0x2eb8dc){if(_0x2eb8dc){_0x451a60[_0x8508('0x49')][_0x8508('0x50')]=_0x2eb8dc['id'];_0x451a60[_0x8508('0x49')][_0x8508('0x51')]=integrations[_0x8508('0x52')](_0x451a60[_0x8508('0x49')][_0x8508('0x53')],_0x451a60[_0x8508('0x49')][_0x8508('0x30')]);_0x451a60[_0x8508('0x49')][_0x8508('0x54')]=integrations['getDescriptions'](_0x451a60[_0x8508('0x49')][_0x8508('0x53')],_0x451a60[_0x8508('0x49')][_0x8508('0x30')]);return db[_0x8508('0x55')]['create'](_0x451a60[_0x8508('0x49')],{'include':[{'model':db[_0x8508('0x56')],'as':_0x8508('0x51')},{'model':db[_0x8508('0x56')],'as':'Descriptions'}]});}return null;})[_0x8508('0x27')](respondWithResult(_0x39541c,null))[_0x8508('0x46')](handleError(_0x39541c,null));};exports[_0x8508('0x57')]=function(_0x36a07f,_0x2da11c,_0x56273e){var _0x5277a2=[{'name':'priority','label':_0x8508('0x58'),'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 _0x24893a='';return db['DeskAccount']['findOne']({'where':{'id':_0x36a07f[_0x8508('0x4b')]['id']},'attributes':['id','remoteUri',_0x8508('0x59'),_0x8508('0x5a'),_0x8508('0x5b'),'consumerKey',_0x8508('0x5c'),_0x8508('0x5d'),_0x8508('0x5e')]})[_0x8508('0x27')](handleEntityNotFound(_0x2da11c,null))[_0x8508('0x27')](function(_0x21123f){if(_0x21123f){_0x24893a=_0x21123f['remoteUri'];var _0x3d59d5=_0x24893a['slice'](-0x1);if(_0x3d59d5==='/'){_0x24893a=_0x24893a[_0x8508('0x5f')](0x0,_0x24893a['lastIndexOf'](_0x3d59d5));}var _0x45a46d={'method':_0x8508('0x60'),'uri':util[_0x8508('0x61')](_0x8508('0x62'),_0x24893a),'headers':{'Content-Type':_0x8508('0x63'),'Accept':'application/json'},'json':!![]};if(_0x21123f[_0x8508('0x59')]===_0x8508('0x64')){_0x45a46d[_0x8508('0x65')][_0x8508('0x66')]=util['format']('Basic\x20%s',new Buffer(util[_0x8508('0x61')](_0x8508('0x67'),_0x21123f['username'],_0x21123f[_0x8508('0x5b')]))[_0x8508('0x68')](_0x8508('0x69')));}return rp(_0x45a46d)[_0x8508('0x27')](function(_0x29b3f5){return _0x5277a2[_0x8508('0x6a')](_[_0x8508('0x2d')](_0x29b3f5[_0x8508('0x6b')][_0x8508('0x6c')],function(_0x4264f4){return{'id':_0x4264f4[_0x8508('0x2a')],'name':_0x4264f4[_0x8508('0x2a')],'type':_0x4264f4[_0x8508('0x30')],'active':_0x4264f4['active'],'label':_0x4264f4[_0x8508('0x6d')],'custom':!![]};}));});}})['then'](function(_0x56006a){return{'count':_0x56006a[_0x8508('0x42')],'rows':_0x56006a};})[_0x8508('0x27')](respondWithResult(_0x2da11c,null))[_0x8508('0x46')](function(_0x594c84){var _0x7035e7=_0x36a07f['query'][_0x8508('0x6e')]?0x1f4:_0x594c84[_0x8508('0x6f')]||0x1f4;logger[_0x8508('0x28')](_0x8508('0x70'),_0x8508('0x57'),_0x7035e7,JSON['stringify'](_0x594c84));delete _0x594c84['name'];if(_0x7035e7===0x191){_0x7035e7=0x190;}_0x2da11c[_0x8508('0x1c')](_0x7035e7)[_0x8508('0x2b')](_0x36a07f[_0x8508('0x32')][_0x8508('0x6e')]?{'message':_0x8508('0x71'),'statusCode':_0x594c84[_0x8508('0x6f')]}:_0x594c84);});}; \ No newline at end of file +var _0x7437=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','DeskAccount','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','params','getConfigurations','DeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','Descriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','tokenSecret','slice','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','format','toString','base64','concat','_embedded','entries','active','test','statusCode','stringify','Wrong\x20credentials'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x7437,0x15c));var _0x7743=function(_0x1cc294,_0x5d677d){_0x1cc294=_0x1cc294-0x0;var _0x9af5f=_0x7437[_0x1cc294];return _0x9af5f;};'use strict';var emlformat=require(_0x7743('0x0'));var rimraf=require(_0x7743('0x1'));var zipdir=require(_0x7743('0x2'));var jsonpatch=require(_0x7743('0x3'));var rp=require(_0x7743('0x4'));var moment=require(_0x7743('0x5'));var BPromise=require(_0x7743('0x6'));var Mustache=require(_0x7743('0x7'));var util=require(_0x7743('0x8'));var path=require(_0x7743('0x9'));var sox=require(_0x7743('0xa'));var csv=require(_0x7743('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7743('0xc'));var _=require(_0x7743('0xd'));var squel=require(_0x7743('0xe'));var crypto=require(_0x7743('0xf'));var jsforce=require(_0x7743('0x10'));var deskjs=require(_0x7743('0x11'));var toCsv=require(_0x7743('0xb'));var querystring=require('querystring');var Papa=require(_0x7743('0x12'));var Redis=require(_0x7743('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7743('0x14'));var as=require(_0x7743('0x15'));var hardwareService=require(_0x7743('0x16'));var logger=require(_0x7743('0x17'))(_0x7743('0x18'));var utils=require(_0x7743('0x19'));var config=require(_0x7743('0x1a'));var licenseUtil=require(_0x7743('0x1b'));var db=require(_0x7743('0x1c'))['db'];var integrations=require(_0x7743('0x1d'));function respondWithStatusCode(_0x46b075,_0x1331e7){_0x1331e7=_0x1331e7||0xcc;return function(_0x397161){if(_0x397161){return _0x46b075[_0x7743('0x1e')](_0x1331e7);}return _0x46b075['status'](_0x1331e7)['end']();};}function respondWithResult(_0x5ced32,_0x31d5b8){_0x31d5b8=_0x31d5b8||0xc8;return function(_0x1fe841){if(_0x1fe841){return _0x5ced32[_0x7743('0x1f')](_0x31d5b8)[_0x7743('0x20')](_0x1fe841);}};}function respondWithFilteredResult(_0x1ac7b6,_0x479f8a){return function(_0x2d252f){if(_0x2d252f){var _0x5e2123=typeof _0x479f8a[_0x7743('0x21')]===_0x7743('0x22')&&typeof _0x479f8a[_0x7743('0x23')]===_0x7743('0x22');var _0x438bd1=_0x2d252f[_0x7743('0x24')];var _0x2ddf2a=_0x5e2123?0x0:_0x479f8a[_0x7743('0x21')];var _0x594dc1=_0x5e2123?_0x2d252f['count']:_0x479f8a[_0x7743('0x21')]+_0x479f8a[_0x7743('0x23')];var _0x46eb00;if(_0x594dc1>=_0x438bd1){_0x594dc1=_0x438bd1;_0x46eb00=0xc8;}else{_0x46eb00=0xce;}_0x1ac7b6[_0x7743('0x1f')](_0x46eb00);return _0x1ac7b6[_0x7743('0x25')](_0x7743('0x26'),_0x2ddf2a+'-'+_0x594dc1+'/'+_0x438bd1)[_0x7743('0x20')](_0x2d252f);}return null;};}function patchUpdates(_0xc75bdf){return function(_0x51e2a7){try{jsonpatch[_0x7743('0x27')](_0x51e2a7,_0xc75bdf,!![]);}catch(_0x401175){return BPromise[_0x7743('0x28')](_0x401175);}return _0x51e2a7[_0x7743('0x29')]();};}function saveUpdates(_0x28da86,_0x48b4dc){return function(_0x54124){if(_0x54124){return _0x54124[_0x7743('0x2a')](_0x28da86)[_0x7743('0x2b')](function(_0x549b92){return _0x549b92;});}return null;};}function removeEntity(_0x461b60,_0x5dd6ff){return function(_0x64f4d4){if(_0x64f4d4){return _0x64f4d4[_0x7743('0x2c')]()['then'](function(){_0x461b60['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x563e87,_0xf65a54){return function(_0xd86c65){if(!_0xd86c65){_0x563e87[_0x7743('0x1e')](0x194);}return _0xd86c65;};}function handleError(_0x4d5965,_0x56d457){_0x56d457=_0x56d457||0x1f4;return function(_0xf15ddb){logger[_0x7743('0x2d')](_0xf15ddb[_0x7743('0x2e')]);if(_0xf15ddb['name']){delete _0xf15ddb[_0x7743('0x2f')];}_0x4d5965[_0x7743('0x1f')](_0x56d457)[_0x7743('0x30')](_0xf15ddb);};}exports['index']=function(_0x559a4e,_0x399dc2){var _0x379421={},_0xf1c0ac={},_0x3ca809={'count':0x0,'rows':[]};var _0x388922=_[_0x7743('0x31')](db[_0x7743('0x32')]['rawAttributes'],function(_0x2a17cd){return{'name':_0x2a17cd['fieldName'],'type':_0x2a17cd[_0x7743('0x33')]['key']};});_0xf1c0ac[_0x7743('0x34')]=_[_0x7743('0x31')](_0x388922,_0x7743('0x2f'));_0xf1c0ac[_0x7743('0x35')]=_[_0x7743('0x36')](_0x559a4e['query']);_0xf1c0ac[_0x7743('0x37')]=_['intersection'](_0xf1c0ac['model'],_0xf1c0ac['query']);_0x379421['attributes']=_[_0x7743('0x38')](_0xf1c0ac['model'],qs['fields'](_0x559a4e[_0x7743('0x35')][_0x7743('0x39')]));_0x379421['attributes']=_0x379421[_0x7743('0x3a')][_0x7743('0x3b')]?_0x379421[_0x7743('0x3a')]:_0xf1c0ac['model'];if(!_0x559a4e[_0x7743('0x35')][_0x7743('0x3c')](_0x7743('0x3d'))){_0x379421[_0x7743('0x23')]=qs[_0x7743('0x23')](_0x559a4e[_0x7743('0x35')]['limit']);_0x379421[_0x7743('0x21')]=qs[_0x7743('0x21')](_0x559a4e[_0x7743('0x35')][_0x7743('0x21')]);}_0x379421['order']=qs['sort'](_0x559a4e[_0x7743('0x35')][_0x7743('0x3e')]);_0x379421[_0x7743('0x3f')]=qs[_0x7743('0x37')](_[_0x7743('0x40')](_0x559a4e[_0x7743('0x35')],_0xf1c0ac[_0x7743('0x37')]),_0x388922);if(_0x559a4e['query'][_0x7743('0x41')]){_0x379421['where']=_[_0x7743('0x42')](_0x379421[_0x7743('0x3f')],{'$or':_[_0x7743('0x31')](_0x388922,function(_0x1dda2c){if(_0x1dda2c[_0x7743('0x33')]!==_0x7743('0x43')){var _0x2aa8d1={};_0x2aa8d1[_0x1dda2c['name']]={'$like':'%'+_0x559a4e[_0x7743('0x35')][_0x7743('0x41')]+'%'};return _0x2aa8d1;}})});}_0x379421=_[_0x7743('0x42')]({},_0x379421,_0x559a4e[_0x7743('0x44')]);var _0x410c06={'where':_0x379421[_0x7743('0x3f')]};return db[_0x7743('0x32')][_0x7743('0x24')](_0x410c06)['then'](function(_0x8295a4){_0x3ca809[_0x7743('0x24')]=_0x8295a4;if(_0x559a4e['query'][_0x7743('0x45')]){_0x379421[_0x7743('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x7743('0x47')](_0x379421);})['then'](function(_0x543e71){_0x3ca809[_0x7743('0x48')]=_0x543e71;return _0x3ca809;})[_0x7743('0x2b')](respondWithFilteredResult(_0x399dc2,_0x379421))[_0x7743('0x49')](handleError(_0x399dc2,null));};exports[_0x7743('0x4a')]=function(_0x48e287,_0x531783){var _0x562b9d={'raw':![],'where':{'id':_0x48e287['params']['id']}},_0x461c4e={};_0x461c4e[_0x7743('0x34')]=_[_0x7743('0x36')](db['DeskAccount'][_0x7743('0x4b')]);_0x461c4e[_0x7743('0x35')]=_[_0x7743('0x36')](_0x48e287[_0x7743('0x35')]);_0x461c4e[_0x7743('0x37')]=_[_0x7743('0x38')](_0x461c4e[_0x7743('0x34')],_0x461c4e[_0x7743('0x35')]);_0x562b9d[_0x7743('0x3a')]=_[_0x7743('0x38')](_0x461c4e[_0x7743('0x34')],qs[_0x7743('0x39')](_0x48e287[_0x7743('0x35')][_0x7743('0x39')]));_0x562b9d[_0x7743('0x3a')]=_0x562b9d[_0x7743('0x3a')][_0x7743('0x3b')]?_0x562b9d[_0x7743('0x3a')]:_0x461c4e[_0x7743('0x34')];if(_0x48e287[_0x7743('0x35')]['includeAll']){_0x562b9d[_0x7743('0x46')]=[{'all':!![]}];}_0x562b9d=_[_0x7743('0x42')]({},_0x562b9d,_0x48e287['options']);return db[_0x7743('0x32')]['find'](_0x562b9d)[_0x7743('0x2b')](handleEntityNotFound(_0x531783,null))[_0x7743('0x2b')](respondWithResult(_0x531783,null))[_0x7743('0x49')](handleError(_0x531783,null));};exports[_0x7743('0x4c')]=function(_0x58fa40,_0x29446c){return db[_0x7743('0x32')]['create'](_0x58fa40['body'],{})[_0x7743('0x2b')](respondWithResult(_0x29446c,0xc9))[_0x7743('0x49')](handleError(_0x29446c,null));};exports[_0x7743('0x2a')]=function(_0x425e1f,_0x35f07a){if(_0x425e1f['body']['id']){delete _0x425e1f[_0x7743('0x4d')]['id'];}return db['DeskAccount'][_0x7743('0x4e')]({'where':{'id':_0x425e1f['params']['id']}})[_0x7743('0x2b')](handleEntityNotFound(_0x35f07a,null))[_0x7743('0x2b')](saveUpdates(_0x425e1f[_0x7743('0x4d')],null))[_0x7743('0x2b')](respondWithResult(_0x35f07a,null))[_0x7743('0x49')](handleError(_0x35f07a,null));};exports[_0x7743('0x2c')]=function(_0xd6e984,_0x8dc017){return db['DeskAccount'][_0x7743('0x4e')]({'where':{'id':_0xd6e984[_0x7743('0x4f')]['id']}})[_0x7743('0x2b')](handleEntityNotFound(_0x8dc017,null))[_0x7743('0x2b')](removeEntity(_0x8dc017,null))[_0x7743('0x49')](handleError(_0x8dc017,null));};exports[_0x7743('0x50')]=function(_0x304d02,_0x9e8851,_0x5bf849){var _0x3d8079={};var _0x3b899e={};var _0x1d7f24;var _0x45a0b4;return db[_0x7743('0x32')]['findOne']({'where':{'id':_0x304d02[_0x7743('0x4f')]['id']}})['then'](handleEntityNotFound(_0x9e8851,null))['then'](function(_0x3afad1){if(_0x3afad1){_0x1d7f24=_0x3afad1;_0x3b899e[_0x7743('0x34')]=_[_0x7743('0x36')](db[_0x7743('0x51')][_0x7743('0x4b')]);_0x3b899e[_0x7743('0x35')]=_[_0x7743('0x36')](_0x304d02[_0x7743('0x35')]);_0x3b899e[_0x7743('0x37')]=_['intersection'](_0x3b899e[_0x7743('0x34')],_0x3b899e['query']);_0x3d8079[_0x7743('0x3a')]=_[_0x7743('0x38')](_0x3b899e[_0x7743('0x34')],qs[_0x7743('0x39')](_0x304d02['query'][_0x7743('0x39')]));_0x3d8079['attributes']=_0x3d8079['attributes'][_0x7743('0x3b')]?_0x3d8079[_0x7743('0x3a')]:_0x3b899e[_0x7743('0x34')];_0x3d8079[_0x7743('0x52')]=qs[_0x7743('0x3e')](_0x304d02[_0x7743('0x35')][_0x7743('0x3e')]);_0x3d8079['where']=qs[_0x7743('0x37')](_[_0x7743('0x40')](_0x304d02[_0x7743('0x35')],_0x3b899e['filters']));if(_0x304d02[_0x7743('0x35')][_0x7743('0x41')]){_0x3d8079['where']=_[_0x7743('0x42')](_0x3d8079[_0x7743('0x3f')],{'$or':_[_0x7743('0x31')](_0x3d8079['attributes'],function(_0x77d802){var _0x3ec8b4={};_0x3ec8b4[_0x77d802]={'$like':'%'+_0x304d02[_0x7743('0x35')]['filter']+'%'};return _0x3ec8b4;})});}_0x3d8079=_[_0x7743('0x42')]({},_0x3d8079,_0x304d02['options']);return _0x1d7f24[_0x7743('0x50')](_0x3d8079);}})[_0x7743('0x2b')](function(_0x35c27e){if(_0x35c27e){_0x45a0b4=_0x35c27e[_0x7743('0x3b')];if(!_0x304d02['query'][_0x7743('0x3c')](_0x7743('0x3d'))){_0x3d8079[_0x7743('0x23')]=qs['limit'](_0x304d02['query']['limit']);_0x3d8079['offset']=qs[_0x7743('0x21')](_0x304d02[_0x7743('0x35')][_0x7743('0x21')]);}return _0x1d7f24['getConfigurations'](_0x3d8079);}})[_0x7743('0x2b')](function(_0x10aec7){if(_0x10aec7){return _0x10aec7?{'count':_0x45a0b4,'rows':_0x10aec7}:null;}})['then'](respondWithResult(_0x9e8851,null))[_0x7743('0x49')](handleError(_0x9e8851,null));};exports[_0x7743('0x53')]=function(_0x2ba64c,_0x1fd3c3,_0x26ced5){if(_0x2ba64c[_0x7743('0x4d')]['id']){delete _0x2ba64c[_0x7743('0x4d')]['id'];}return db[_0x7743('0x32')][_0x7743('0x54')]({'where':{'id':_0x2ba64c[_0x7743('0x4f')]['id']}})[_0x7743('0x2b')](handleEntityNotFound(_0x1fd3c3,null))['then'](function(_0x6e0851){if(_0x6e0851){_0x2ba64c['body'][_0x7743('0x55')]=_0x6e0851['id'];_0x2ba64c[_0x7743('0x4d')][_0x7743('0x56')]=integrations['getSubjects'](_0x2ba64c[_0x7743('0x4d')]['channel'],_0x2ba64c[_0x7743('0x4d')][_0x7743('0x33')]);_0x2ba64c[_0x7743('0x4d')][_0x7743('0x57')]=integrations['getDescriptions'](_0x2ba64c[_0x7743('0x4d')]['channel'],_0x2ba64c[_0x7743('0x4d')][_0x7743('0x33')]);return db[_0x7743('0x51')]['create'](_0x2ba64c[_0x7743('0x4d')],{'include':[{'model':db[_0x7743('0x58')],'as':_0x7743('0x56')},{'model':db['DeskField'],'as':_0x7743('0x57')}]});}return null;})[_0x7743('0x2b')](respondWithResult(_0x1fd3c3,null))['catch'](handleError(_0x1fd3c3,null));};exports[_0x7743('0x59')]=function(_0xcf218e,_0x534b0c,_0x1f3c39){var _0x412fb0=[{'name':_0x7743('0x5a'),'label':_0x7743('0x5a'),'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 _0x3973ce='';return db['DeskAccount'][_0x7743('0x54')]({'where':{'id':_0xcf218e[_0x7743('0x4f')]['id']},'attributes':['id','remoteUri',_0x7743('0x5b'),_0x7743('0x5c'),_0x7743('0x5d'),'consumerKey',_0x7743('0x5e'),'token',_0x7743('0x5f')]})[_0x7743('0x2b')](handleEntityNotFound(_0x534b0c,null))['then'](function(_0x11b11){if(_0x11b11){_0x3973ce=_0x11b11['remoteUri'];var _0x43c09a=_0x3973ce[_0x7743('0x60')](-0x1);if(_0x43c09a==='/'){_0x3973ce=_0x3973ce['substring'](0x0,_0x3973ce[_0x7743('0x61')](_0x43c09a));}var _0x4beb77={'method':_0x7743('0x62'),'uri':util['format'](_0x7743('0x63'),_0x3973ce),'headers':{'Content-Type':'application/json','Accept':_0x7743('0x64')},'json':!![]};if(_0x11b11[_0x7743('0x5b')]===_0x7743('0x65')){_0x4beb77[_0x7743('0x66')][_0x7743('0x67')]=util['format'](_0x7743('0x68'),new Buffer(util[_0x7743('0x69')]('%s:%s',_0x11b11[_0x7743('0x5c')],_0x11b11[_0x7743('0x5d')]))[_0x7743('0x6a')](_0x7743('0x6b')));}return rp(_0x4beb77)[_0x7743('0x2b')](function(_0x2a058c){return _0x412fb0[_0x7743('0x6c')](_[_0x7743('0x31')](_0x2a058c[_0x7743('0x6d')][_0x7743('0x6e')],function(_0x58c20c){return{'id':_0x58c20c[_0x7743('0x2f')],'name':_0x58c20c[_0x7743('0x2f')],'type':_0x58c20c[_0x7743('0x33')],'active':_0x58c20c[_0x7743('0x6f')],'label':_0x58c20c['label'],'custom':!![]};}));});}})[_0x7743('0x2b')](function(_0x1fad35){return{'count':_0x1fad35['length'],'rows':_0x1fad35};})[_0x7743('0x2b')](respondWithResult(_0x534b0c,null))[_0x7743('0x49')](function(_0x860b9){var _0x168098=_0xcf218e['query'][_0x7743('0x70')]?0x1f4:_0x860b9[_0x7743('0x71')]||0x1f4;logger[_0x7743('0x2d')]('getFields,\x20%s,\x20%s,\x20%s',_0x7743('0x59'),_0x168098,JSON[_0x7743('0x72')](_0x860b9));delete _0x860b9[_0x7743('0x2f')];if(_0x168098===0x191){_0x168098=0x190;}_0x534b0c[_0x7743('0x1f')](_0x168098)[_0x7743('0x30')](_0xcf218e[_0x7743('0x35')][_0x7743('0x70')]?{'message':_0x7743('0x73'),'statusCode':_0x860b9[_0x7743('0x71')]}:_0x860b9);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cb36a41..9054b66 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 _0xb46b=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5f1d4c,_0x513301){var _0x234479=function(_0x594d37){while(--_0x594d37){_0x5f1d4c['push'](_0x5f1d4c['shift']());}};_0x234479(++_0x513301);}(_0xb46b,0xd8));var _0xbb46=function(_0x5882d8,_0x29dde4){_0x5882d8=_0x5882d8-0x0;var _0x5a4c71=_0xb46b[_0x5882d8];return _0x5a4c71;};'use strict';var _=require(_0xbb46('0x0'));var util=require('util');var logger=require(_0xbb46('0x1'))(_0xbb46('0x2'));var moment=require(_0xbb46('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb46('0x4'));var fs=require('fs');var path=require(_0xbb46('0x5'));var rimraf=require(_0xbb46('0x6'));var config=require(_0xbb46('0x7'));var attributes=require(_0xbb46('0x8'));var integrations=require(_0xbb46('0x9'));module[_0xbb46('0xa')]=function(_0x3aee3b,_0x55391f){return _0x3aee3b['define'](_0xbb46('0xb'),attributes,{'tableName':_0xbb46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf53=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x5f12c9,_0x999e31){var _0x53cbaf=function(_0x2a47c7){while(--_0x2a47c7){_0x5f12c9['push'](_0x5f12c9['shift']());}};_0x53cbaf(++_0x999e31);}(_0xaf53,0x1cc));var _0x3af5=function(_0x4fc2b8,_0x588951){_0x4fc2b8=_0x4fc2b8-0x0;var _0x344115=_0xaf53[_0x4fc2b8];return _0x344115;};'use strict';var _=require(_0x3af5('0x0'));var util=require('util');var logger=require(_0x3af5('0x1'))('api');var moment=require(_0x3af5('0x2'));var BPromise=require(_0x3af5('0x3'));var rp=require(_0x3af5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3af5('0x5'));var config=require(_0x3af5('0x6'));var attributes=require(_0x3af5('0x7'));var integrations=require(_0x3af5('0x8'));module[_0x3af5('0x9')]=function(_0x4375a7,_0x13c340){return _0x4375a7[_0x3af5('0xa')](_0x3af5('0xb'),attributes,{'tableName':_0x3af5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 35ec3cb..db0bbd0 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 _0xe964=['code','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe964,0x1b7));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e96('0x0'));var util=require(_0x4e96('0x1'));var moment=require('moment');var BPromise=require(_0x4e96('0x2'));var rs=require(_0x4e96('0x3'));var fs=require('fs');var Redis=require(_0x4e96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e96('0x5'));var logger=require(_0x4e96('0x6'))('rpc');var config=require(_0x4e96('0x7'));var jayson=require(_0x4e96('0x8'));var client=jayson[_0x4e96('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x410bd4,_0xcabfb0,_0x159780){return new BPromise(function(_0x4da030,_0x520e6d){return client['request'](_0x410bd4,_0x159780)['then'](function(_0x56b951){logger[_0x4e96('0xa')]('DeskAccount,\x20%s,\x20%s',_0xcabfb0,_0x4e96('0xb'));logger[_0x4e96('0xc')](_0x4e96('0xd'),_0xcabfb0,_0x4e96('0xb'),JSON[_0x4e96('0xe')](_0x56b951));if(_0x56b951[_0x4e96('0xf')]){if(_0x56b951[_0x4e96('0xf')][_0x4e96('0x10')]===0x1f4){logger[_0x4e96('0xf')](_0x4e96('0x11'),_0xcabfb0,_0x56b951[_0x4e96('0xf')][_0x4e96('0x12')]);return _0x520e6d(_0x56b951['error'][_0x4e96('0x12')]);}logger[_0x4e96('0xf')](_0x4e96('0x11'),_0xcabfb0,_0x56b951[_0x4e96('0xf')][_0x4e96('0x12')]);return _0x4da030(_0x56b951['error'][_0x4e96('0x12')]);}else{logger[_0x4e96('0xa')](_0x4e96('0x11'),_0xcabfb0,'request\x20sent');_0x4da030(_0x56b951[_0x4e96('0x13')][_0x4e96('0x12')]);}})[_0x4e96('0x14')](function(_0x35ee1f){logger['error']('DeskAccount,\x20%s,\x20%s',_0xcabfb0,_0x35ee1f);_0x520e6d(_0x35ee1f);});});}exports['GetDeskAccount']=function(_0x332f1d){var _0x288130=this;return new Promise(function(_0x1539d7,_0x4a5b98){return db[_0x4e96('0x15')][_0x4e96('0x16')]({'raw':_0x332f1d[_0x4e96('0x17')]?_0x332f1d['options'][_0x4e96('0x18')]===undefined?!![]:![]:!![],'where':_0x332f1d['options']?_0x332f1d[_0x4e96('0x17')][_0x4e96('0x19')]||null:null,'attributes':_0x332f1d[_0x4e96('0x17')]?_0x332f1d['options'][_0x4e96('0x1a')]||null:null,'limit':_0x332f1d[_0x4e96('0x17')]?_0x332f1d[_0x4e96('0x17')][_0x4e96('0x1b')]||null:null,'include':_0x332f1d['options']?_0x332f1d['options']['include']?_[_0x4e96('0x1c')](_0x332f1d[_0x4e96('0x17')][_0x4e96('0x1d')],function(_0x4272c5){return{'model':db[_0x4272c5[_0x4e96('0x1e')]],'as':_0x4272c5['as'],'attributes':_0x4272c5[_0x4e96('0x1a')],'include':_0x4272c5['include']?_[_0x4e96('0x1c')](_0x4272c5[_0x4e96('0x1d')],function(_0x17b434){return{'model':db[_0x17b434[_0x4e96('0x1e')]],'as':_0x17b434['as'],'attributes':_0x17b434[_0x4e96('0x1a')],'include':_0x17b434[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x17b434['include'],function(_0x3537bb){return{'model':db[_0x3537bb['model']],'as':_0x3537bb['as'],'attributes':_0x3537bb[_0x4e96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4e96('0x1f')](function(_0x218d7b){logger[_0x4e96('0xa')](_0x4e96('0x20'),_0x332f1d);logger['debug']('GetDeskAccount',_0x332f1d,JSON[_0x4e96('0xe')](_0x218d7b));_0x1539d7(_0x218d7b);})[_0x4e96('0x14')](function(_0x503b21){logger[_0x4e96('0xf')]('GetDeskAccount',_0x503b21[_0x4e96('0x12')],_0x332f1d);_0x4a5b98(_0x288130['error'](0x1f4,_0x503b21[_0x4e96('0x12')]));});});};exports[_0x4e96('0x21')]=function(_0x198bc2){var _0x5d3292=this;return new Promise(function(_0x36dcbf,_0x140251){return db[_0x4e96('0x15')][_0x4e96('0x22')]({'raw':_0x198bc2['options']?_0x198bc2[_0x4e96('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x198bc2[_0x4e96('0x17')]?_0x198bc2[_0x4e96('0x17')][_0x4e96('0x19')]||null:null,'attributes':_0x198bc2[_0x4e96('0x17')]?_0x198bc2['options'][_0x4e96('0x1a')]||null:null,'include':_0x198bc2[_0x4e96('0x17')]?_0x198bc2[_0x4e96('0x17')][_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x198bc2['options'][_0x4e96('0x1d')],function(_0x251c8e){return{'model':db[_0x251c8e['model']],'as':_0x251c8e['as'],'attributes':_0x251c8e['attributes'],'include':_0x251c8e[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x251c8e[_0x4e96('0x1d')],function(_0x5b8afe){return{'model':db[_0x5b8afe[_0x4e96('0x1e')]],'as':_0x5b8afe['as'],'attributes':_0x5b8afe[_0x4e96('0x1a')],'include':_0x5b8afe[_0x4e96('0x1d')]?_[_0x4e96('0x1c')](_0x5b8afe[_0x4e96('0x1d')],function(_0x24236a){return{'model':db[_0x24236a[_0x4e96('0x1e')]],'as':_0x24236a['as'],'attributes':_0x24236a['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e96('0x1f')](function(_0x21f362){logger[_0x4e96('0xa')](_0x4e96('0x21'),_0x198bc2);logger[_0x4e96('0xc')](_0x4e96('0x21'),_0x198bc2,JSON[_0x4e96('0xe')](_0x21f362));_0x36dcbf(_0x21f362);})[_0x4e96('0x14')](function(_0x281865){logger['error'](_0x4e96('0x21'),_0x281865['message'],_0x198bc2);_0x140251(_0x5d3292[_0x4e96('0xf')](0x1f4,_0x281865[_0x4e96('0x12')]));});});}; \ No newline at end of file +var _0x01ce=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount','debug','DeskAccount','find','ShowDeskAccount','lodash','moment','bluebird'];(function(_0x105e71,_0x4d78ef){var _0x4ed467=function(_0x42c0da){while(--_0x42c0da){_0x105e71['push'](_0x105e71['shift']());}};_0x4ed467(++_0x4d78ef);}(_0x01ce,0x125));var _0xe01c=function(_0x5f41ce,_0x3cdebf){_0x5f41ce=_0x5f41ce-0x0;var _0x5ad089=_0x01ce[_0x5f41ce];return _0x5ad089;};'use strict';var _=require(_0xe01c('0x0'));var util=require('util');var moment=require(_0xe01c('0x1'));var BPromise=require(_0xe01c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe01c('0x3'));var db=require(_0xe01c('0x4'))['db'];var utils=require(_0xe01c('0x5'));var logger=require(_0xe01c('0x6'))(_0xe01c('0x7'));var config=require(_0xe01c('0x8'));var jayson=require(_0xe01c('0x9'));var client=jayson[_0xe01c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3966a2,_0x2a4baa,_0x506580){return new BPromise(function(_0x4244b9,_0x5ea1b6){return client[_0xe01c('0xb')](_0x3966a2,_0x506580)[_0xe01c('0xc')](function(_0x5c30c9){logger[_0xe01c('0xd')](_0xe01c('0xe'),_0x2a4baa,_0xe01c('0xf'));logger['debug'](_0xe01c('0x10'),_0x2a4baa,_0xe01c('0xf'),JSON[_0xe01c('0x11')](_0x5c30c9));if(_0x5c30c9['error']){if(_0x5c30c9[_0xe01c('0x12')][_0xe01c('0x13')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x2a4baa,_0x5c30c9['error'][_0xe01c('0x14')]);return _0x5ea1b6(_0x5c30c9[_0xe01c('0x12')][_0xe01c('0x14')]);}logger[_0xe01c('0x12')](_0xe01c('0xe'),_0x2a4baa,_0x5c30c9[_0xe01c('0x12')]['message']);return _0x4244b9(_0x5c30c9['error'][_0xe01c('0x14')]);}else{logger[_0xe01c('0xd')](_0xe01c('0xe'),_0x2a4baa,_0xe01c('0xf'));_0x4244b9(_0x5c30c9[_0xe01c('0x15')]['message']);}})[_0xe01c('0x16')](function(_0x51a917){logger[_0xe01c('0x12')](_0xe01c('0xe'),_0x2a4baa,_0x51a917);_0x5ea1b6(_0x51a917);});});}exports['GetDeskAccount']=function(_0x440f1a){var _0x243b40=this;return new Promise(function(_0x3d5ff9,_0x40a9a9){return db['DeskAccount'][_0xe01c('0x17')]({'raw':_0x440f1a[_0xe01c('0x18')]?_0x440f1a[_0xe01c('0x18')][_0xe01c('0x19')]===undefined?!![]:![]:!![],'where':_0x440f1a[_0xe01c('0x18')]?_0x440f1a['options'][_0xe01c('0x1a')]||null:null,'attributes':_0x440f1a[_0xe01c('0x18')]?_0x440f1a['options'][_0xe01c('0x1b')]||null:null,'limit':_0x440f1a[_0xe01c('0x18')]?_0x440f1a[_0xe01c('0x18')][_0xe01c('0x1c')]||null:null,'include':_0x440f1a[_0xe01c('0x18')]?_0x440f1a[_0xe01c('0x18')][_0xe01c('0x1d')]?_[_0xe01c('0x1e')](_0x440f1a[_0xe01c('0x18')][_0xe01c('0x1d')],function(_0x40535e){return{'model':db[_0x40535e[_0xe01c('0x1f')]],'as':_0x40535e['as'],'attributes':_0x40535e['attributes'],'include':_0x40535e['include']?_['map'](_0x40535e[_0xe01c('0x1d')],function(_0x260c9f){return{'model':db[_0x260c9f[_0xe01c('0x1f')]],'as':_0x260c9f['as'],'attributes':_0x260c9f[_0xe01c('0x1b')],'include':_0x260c9f[_0xe01c('0x1d')]?_['map'](_0x260c9f[_0xe01c('0x1d')],function(_0x3e05e0){return{'model':db[_0x3e05e0['model']],'as':_0x3e05e0['as'],'attributes':_0x3e05e0[_0xe01c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe01c('0xc')](function(_0x3d68fe){logger[_0xe01c('0xd')](_0xe01c('0x20'),_0x440f1a);logger[_0xe01c('0x21')](_0xe01c('0x20'),_0x440f1a,JSON[_0xe01c('0x11')](_0x3d68fe));_0x3d5ff9(_0x3d68fe);})[_0xe01c('0x16')](function(_0x110fa5){logger['error'](_0xe01c('0x20'),_0x110fa5[_0xe01c('0x14')],_0x440f1a);_0x40a9a9(_0x243b40['error'](0x1f4,_0x110fa5['message']));});});};exports['ShowDeskAccount']=function(_0x47f4a5){var _0x328e3c=this;return new Promise(function(_0x1acf37,_0x17a7bb){return db[_0xe01c('0x22')][_0xe01c('0x23')]({'raw':_0x47f4a5[_0xe01c('0x18')]?_0x47f4a5[_0xe01c('0x18')][_0xe01c('0x19')]===undefined?!![]:![]:!![],'where':_0x47f4a5['options']?_0x47f4a5['options'][_0xe01c('0x1a')]||null:null,'attributes':_0x47f4a5[_0xe01c('0x18')]?_0x47f4a5[_0xe01c('0x18')][_0xe01c('0x1b')]||null:null,'include':_0x47f4a5['options']?_0x47f4a5[_0xe01c('0x18')]['include']?_[_0xe01c('0x1e')](_0x47f4a5[_0xe01c('0x18')][_0xe01c('0x1d')],function(_0x47fdbc){return{'model':db[_0x47fdbc['model']],'as':_0x47fdbc['as'],'attributes':_0x47fdbc[_0xe01c('0x1b')],'include':_0x47fdbc[_0xe01c('0x1d')]?_[_0xe01c('0x1e')](_0x47fdbc[_0xe01c('0x1d')],function(_0x22c6ee){return{'model':db[_0x22c6ee[_0xe01c('0x1f')]],'as':_0x22c6ee['as'],'attributes':_0x22c6ee[_0xe01c('0x1b')],'include':_0x22c6ee[_0xe01c('0x1d')]?_[_0xe01c('0x1e')](_0x22c6ee[_0xe01c('0x1d')],function(_0x4c9b96){return{'model':db[_0x4c9b96[_0xe01c('0x1f')]],'as':_0x4c9b96['as'],'attributes':_0x4c9b96[_0xe01c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe01c('0xc')](function(_0x532c90){logger[_0xe01c('0xd')](_0xe01c('0x24'),_0x47f4a5);logger['debug'](_0xe01c('0x24'),_0x47f4a5,JSON[_0xe01c('0x11')](_0x532c90));_0x1acf37(_0x532c90);})['catch'](function(_0x39be2f){logger[_0xe01c('0x12')]('ShowDeskAccount',_0x39be2f[_0xe01c('0x14')],_0x47f4a5);_0x17a7bb(_0x328e3c[_0xe01c('0x12')](0x1f4,_0x39be2f[_0xe01c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 96dc900..2f971b2 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x436308,_0x4e2aad){var _0x6731d1=function(_0x196149){while(--_0x196149){_0x436308['push'](_0x436308['shift']());}};_0x6731d1(++_0x4e2aad);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x100591,_0x1c4e6c){var _0x157cbb=function(_0x53db7a){while(--_0x53db7a){_0x100591['push'](_0x100591['shift']());}};_0x157cbb(++_0x1c4e6c);}(_0x008c,0x188));var _0xc008=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x008c[_0x56fb33];return _0x435ee4;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c0e43bb..2c9a180 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 _0xe269=['exports','STRING'];(function(_0x2203bc,_0x466d2e){var _0x353abd=function(_0x3e4443){while(--_0x3e4443){_0x2203bc['push'](_0x2203bc['shift']());}};_0x353abd(++_0x466d2e);}(_0xe269,0x18a));var _0x9e26=function(_0x3aa578,_0x90d825){_0x3aa578=_0x3aa578-0x0;var _0x3cf051=_0xe269[_0x3aa578];return _0x3cf051;};'use strict';var Sequelize=require('sequelize');module[_0x9e26('0x0')]={'name':{'type':Sequelize[_0x9e26('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9e0b=['STRING','sequelize','exports'];(function(_0x277f13,_0x1d9114){var _0x591716=function(_0x4c1f7a){while(--_0x4c1f7a){_0x277f13['push'](_0x277f13['shift']());}};_0x591716(++_0x1d9114);}(_0x9e0b,0x175));var _0xb9e0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9e0b[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0xb9e0('0x0'));module[_0xb9e0('0x1')]={'name':{'type':Sequelize[_0xb9e0('0x2')]},'description':{'type':Sequelize[_0xb9e0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 742f1a1..d13a630 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 _0x5838=['ids','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','getFields','findOne','DeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags'];(function(_0x2df1f2,_0x58d388){var _0x38652b=function(_0x18e322){while(--_0x18e322){_0x2df1f2['push'](_0x2df1f2['shift']());}};_0x38652b(++_0x58d388);}(_0x5838,0xa9));var _0x8583=function(_0xf6824f,_0x26021d){_0xf6824f=_0xf6824f-0x0;var _0x117fde=_0x5838[_0xf6824f];return _0x117fde;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8583('0x0'));var zipdir=require(_0x8583('0x1'));var jsonpatch=require(_0x8583('0x2'));var rp=require('request-promise');var moment=require(_0x8583('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8583('0x4'));var util=require(_0x8583('0x5'));var path=require('path');var sox=require(_0x8583('0x6'));var csv=require(_0x8583('0x7'));var ejs=require(_0x8583('0x8'));var fs=require('fs');var fs_extra=require(_0x8583('0x9'));var _=require(_0x8583('0xa'));var squel=require(_0x8583('0xb'));var crypto=require(_0x8583('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8583('0xd'));var toCsv=require(_0x8583('0x7'));var querystring=require(_0x8583('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8583('0xf'));var qs=require(_0x8583('0x10'));var as=require(_0x8583('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8583('0x12'))(_0x8583('0x13'));var utils=require(_0x8583('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8583('0x15'));var db=require(_0x8583('0x16'))['db'];function respondWithStatusCode(_0x2e25e2,_0x2bf4fd){_0x2bf4fd=_0x2bf4fd||0xcc;return function(_0x4be3f7){if(_0x4be3f7){return _0x2e25e2[_0x8583('0x17')](_0x2bf4fd);}return _0x2e25e2[_0x8583('0x18')](_0x2bf4fd)[_0x8583('0x19')]();};}function respondWithResult(_0x2a32f0,_0x45ff9e){_0x45ff9e=_0x45ff9e||0xc8;return function(_0x5844ee){if(_0x5844ee){return _0x2a32f0[_0x8583('0x18')](_0x45ff9e)['json'](_0x5844ee);}};}function respondWithFilteredResult(_0x229736,_0x3352ae){return function(_0x578634){if(_0x578634){var _0x47c7cd=typeof _0x3352ae[_0x8583('0x1a')]===_0x8583('0x1b')&&typeof _0x3352ae[_0x8583('0x1c')]===_0x8583('0x1b');var _0xc90f1=_0x578634[_0x8583('0x1d')];var _0x16e88c=_0x47c7cd?0x0:_0x3352ae[_0x8583('0x1a')];var _0x2d5c4a=_0x47c7cd?_0x578634[_0x8583('0x1d')]:_0x3352ae[_0x8583('0x1a')]+_0x3352ae[_0x8583('0x1c')];var _0x1c289b;if(_0x2d5c4a>=_0xc90f1){_0x2d5c4a=_0xc90f1;_0x1c289b=0xc8;}else{_0x1c289b=0xce;}_0x229736['status'](_0x1c289b);return _0x229736['set']('Content-Range',_0x16e88c+'-'+_0x2d5c4a+'/'+_0xc90f1)[_0x8583('0x1e')](_0x578634);}return null;};}function patchUpdates(_0x2d4108){return function(_0x32f3e2){try{jsonpatch[_0x8583('0x1f')](_0x32f3e2,_0x2d4108,!![]);}catch(_0x4316c6){return BPromise[_0x8583('0x20')](_0x4316c6);}return _0x32f3e2[_0x8583('0x21')]();};}function saveUpdates(_0x26ff30,_0x4fdec2){return function(_0x3bed9a){if(_0x3bed9a){return _0x3bed9a[_0x8583('0x22')](_0x26ff30)[_0x8583('0x23')](function(_0x51f7a1){return _0x51f7a1;});}return null;};}function removeEntity(_0x457f44,_0x2aadab){return function(_0x1e6967){if(_0x1e6967){return _0x1e6967[_0x8583('0x24')]()[_0x8583('0x23')](function(){_0x457f44['status'](0xcc)[_0x8583('0x19')]();});}};}function handleEntityNotFound(_0x113cee,_0x52a52a){return function(_0x10ea20){if(!_0x10ea20){_0x113cee[_0x8583('0x17')](0x194);}return _0x10ea20;};}function handleError(_0x41f637,_0x44f434){_0x44f434=_0x44f434||0x1f4;return function(_0x4caeb4){logger[_0x8583('0x25')](_0x4caeb4[_0x8583('0x26')]);if(_0x4caeb4[_0x8583('0x27')]){delete _0x4caeb4[_0x8583('0x27')];}_0x41f637['status'](_0x44f434)[_0x8583('0x28')](_0x4caeb4);};}exports[_0x8583('0x29')]=function(_0x44c814,_0x556a2b){var _0x502ea2={},_0x43dc65={},_0xbdcd64={'count':0x0,'rows':[]};var _0x1ece61=_[_0x8583('0x2a')](db[_0x8583('0x2b')][_0x8583('0x2c')],function(_0x28b46f){return{'name':_0x28b46f[_0x8583('0x2d')],'type':_0x28b46f[_0x8583('0x2e')][_0x8583('0x2f')]};});_0x43dc65[_0x8583('0x30')]=_[_0x8583('0x2a')](_0x1ece61,'name');_0x43dc65['query']=_['keys'](_0x44c814[_0x8583('0x31')]);_0x43dc65[_0x8583('0x32')]=_[_0x8583('0x33')](_0x43dc65['model'],_0x43dc65['query']);_0x502ea2[_0x8583('0x34')]=_[_0x8583('0x33')](_0x43dc65[_0x8583('0x30')],qs['fields'](_0x44c814['query']['fields']));_0x502ea2[_0x8583('0x34')]=_0x502ea2[_0x8583('0x34')][_0x8583('0x35')]?_0x502ea2[_0x8583('0x34')]:_0x43dc65['model'];if(!_0x44c814[_0x8583('0x31')]['hasOwnProperty'](_0x8583('0x36'))){_0x502ea2[_0x8583('0x1c')]=qs['limit'](_0x44c814[_0x8583('0x31')][_0x8583('0x1c')]);_0x502ea2[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x44c814[_0x8583('0x31')][_0x8583('0x1a')]);}_0x502ea2[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x44c814[_0x8583('0x31')][_0x8583('0x38')]);_0x502ea2[_0x8583('0x39')]=qs['filters'](_['pick'](_0x44c814['query'],_0x43dc65[_0x8583('0x32')]),_0x1ece61);if(_0x44c814['query'][_0x8583('0x3a')]){_0x502ea2[_0x8583('0x39')]=_['merge'](_0x502ea2[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x1ece61,function(_0x2a5fa2){if(_0x2a5fa2['type']!==_0x8583('0x3b')){var _0x2bb19a={};_0x2bb19a[_0x2a5fa2[_0x8583('0x27')]]={'$like':'%'+_0x44c814[_0x8583('0x31')]['filter']+'%'};return _0x2bb19a;}})});}_0x502ea2=_[_0x8583('0x3c')]({},_0x502ea2,_0x44c814[_0x8583('0x3d')]);var _0x2da5aa={'where':_0x502ea2[_0x8583('0x39')]};return db[_0x8583('0x2b')][_0x8583('0x1d')](_0x2da5aa)['then'](function(_0x380d3f){_0xbdcd64[_0x8583('0x1d')]=_0x380d3f;if(_0x44c814[_0x8583('0x31')][_0x8583('0x3e')]){_0x502ea2[_0x8583('0x3f')]=[{'all':!![]}];}return db[_0x8583('0x2b')][_0x8583('0x40')](_0x502ea2);})[_0x8583('0x23')](function(_0x41e8fe){_0xbdcd64[_0x8583('0x41')]=_0x41e8fe;return _0xbdcd64;})['then'](respondWithFilteredResult(_0x556a2b,_0x502ea2))[_0x8583('0x42')](handleError(_0x556a2b,null));};exports[_0x8583('0x43')]=function(_0x350590,_0x3236e6){var _0x5a3a07={'raw':![],'where':{'id':_0x350590[_0x8583('0x44')]['id']}},_0xd0c58c={};_0xd0c58c[_0x8583('0x30')]=_['keys'](db['DeskConfiguration'][_0x8583('0x2c')]);_0xd0c58c[_0x8583('0x31')]=_[_0x8583('0x45')](_0x350590[_0x8583('0x31')]);_0xd0c58c['filters']=_[_0x8583('0x33')](_0xd0c58c[_0x8583('0x30')],_0xd0c58c[_0x8583('0x31')]);_0x5a3a07[_0x8583('0x34')]=_[_0x8583('0x33')](_0xd0c58c['model'],qs[_0x8583('0x46')](_0x350590[_0x8583('0x31')][_0x8583('0x46')]));_0x5a3a07['attributes']=_0x5a3a07[_0x8583('0x34')][_0x8583('0x35')]?_0x5a3a07[_0x8583('0x34')]:_0xd0c58c[_0x8583('0x30')];if(_0x350590[_0x8583('0x31')][_0x8583('0x3e')]){_0x5a3a07[_0x8583('0x3f')]=[{'all':!![]}];}_0x5a3a07=_[_0x8583('0x3c')]({},_0x5a3a07,_0x350590['options']);return db[_0x8583('0x2b')][_0x8583('0x47')](_0x5a3a07)[_0x8583('0x23')](handleEntityNotFound(_0x3236e6,null))['then'](respondWithResult(_0x3236e6,null))[_0x8583('0x42')](handleError(_0x3236e6,null));};exports[_0x8583('0x48')]=function(_0x33f6f1,_0x4cf63c){return db[_0x8583('0x2b')][_0x8583('0x48')](_0x33f6f1[_0x8583('0x49')],{})['then'](respondWithResult(_0x4cf63c,0xc9))[_0x8583('0x42')](handleError(_0x4cf63c,null));};exports['update']=function(_0x1871b7,_0x1e72d3){if(_0x1871b7[_0x8583('0x49')]['id']){delete _0x1871b7['body']['id'];}return db[_0x8583('0x2b')][_0x8583('0x47')]({'where':{'id':_0x1871b7[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x1e72d3,null))[_0x8583('0x23')](saveUpdates(_0x1871b7[_0x8583('0x49')],null))['then'](respondWithResult(_0x1e72d3,null))[_0x8583('0x42')](handleError(_0x1e72d3,null));};exports[_0x8583('0x24')]=function(_0x46ca56,_0x204ed2){return db[_0x8583('0x2b')]['find']({'where':{'id':_0x46ca56['params']['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x204ed2,null))[_0x8583('0x23')](removeEntity(_0x204ed2,null))['catch'](handleError(_0x204ed2,null));};exports[_0x8583('0x4a')]=function(_0x17fb88,_0x23edcf,_0x2f6a67){var _0x595268={};var _0x2c42cd={};var _0x137251;var _0x160014;return db[_0x8583('0x2b')][_0x8583('0x4b')]({'where':{'id':_0x17fb88[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x23edcf,null))[_0x8583('0x23')](function(_0x237d6b){if(_0x237d6b){_0x137251=_0x237d6b;_0x2c42cd[_0x8583('0x30')]=_[_0x8583('0x45')](db[_0x8583('0x4c')][_0x8583('0x2c')]);_0x2c42cd[_0x8583('0x31')]=_[_0x8583('0x45')](_0x17fb88[_0x8583('0x31')]);_0x2c42cd[_0x8583('0x32')]=_['intersection'](_0x2c42cd['model'],_0x2c42cd['query']);_0x595268[_0x8583('0x34')]=_[_0x8583('0x33')](_0x2c42cd[_0x8583('0x30')],qs['fields'](_0x17fb88[_0x8583('0x31')][_0x8583('0x46')]));_0x595268[_0x8583('0x34')]=_0x595268['attributes'][_0x8583('0x35')]?_0x595268[_0x8583('0x34')]:_0x2c42cd[_0x8583('0x30')];_0x595268[_0x8583('0x37')]=qs['sort'](_0x17fb88[_0x8583('0x31')]['sort']);_0x595268[_0x8583('0x39')]=qs['filters'](_[_0x8583('0x4d')](_0x17fb88[_0x8583('0x31')],_0x2c42cd[_0x8583('0x32')]));if(_0x17fb88['query'][_0x8583('0x3a')]){_0x595268[_0x8583('0x39')]=_[_0x8583('0x3c')](_0x595268['where'],{'$or':_[_0x8583('0x2a')](_0x595268['attributes'],function(_0x49393d){var _0x4ac9f0={};_0x4ac9f0[_0x49393d]={'$like':'%'+_0x17fb88['query'][_0x8583('0x3a')]+'%'};return _0x4ac9f0;})});}_0x595268=_[_0x8583('0x3c')]({},_0x595268,_0x17fb88[_0x8583('0x3d')]);return _0x137251[_0x8583('0x4a')](_0x595268);}})['then'](function(_0x549ce7){if(_0x549ce7){_0x160014=_0x549ce7['length'];if(!_0x17fb88[_0x8583('0x31')][_0x8583('0x4e')](_0x8583('0x36'))){_0x595268[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x17fb88[_0x8583('0x31')]['limit']);_0x595268[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x17fb88[_0x8583('0x31')]['offset']);}return _0x137251['getFields'](_0x595268);}})[_0x8583('0x23')](function(_0xa6bf34){if(_0xa6bf34){return _0xa6bf34?{'count':_0x160014,'rows':_0xa6bf34}:null;}})[_0x8583('0x23')](respondWithResult(_0x23edcf,null))[_0x8583('0x42')](handleError(_0x23edcf,null));};exports[_0x8583('0x4f')]=function(_0x1d0d2e,_0x4dc4e3,_0xbd6cf6){var _0x661e62={};var _0x33dc8a={};var _0x5398e9;var _0x1b249e;return db['DeskConfiguration'][_0x8583('0x4b')]({'where':{'id':_0x1d0d2e[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x4dc4e3,null))[_0x8583('0x23')](function(_0x5e361d){if(_0x5e361d){_0x5398e9=_0x5e361d;_0x33dc8a[_0x8583('0x30')]=_[_0x8583('0x45')](db['DeskField'][_0x8583('0x2c')]);_0x33dc8a[_0x8583('0x31')]=_[_0x8583('0x45')](_0x1d0d2e[_0x8583('0x31')]);_0x33dc8a[_0x8583('0x32')]=_[_0x8583('0x33')](_0x33dc8a[_0x8583('0x30')],_0x33dc8a[_0x8583('0x31')]);_0x661e62[_0x8583('0x34')]=_[_0x8583('0x33')](_0x33dc8a['model'],qs[_0x8583('0x46')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x46')]));_0x661e62[_0x8583('0x34')]=_0x661e62[_0x8583('0x34')][_0x8583('0x35')]?_0x661e62[_0x8583('0x34')]:_0x33dc8a['model'];_0x661e62['order']=qs[_0x8583('0x38')](_0x1d0d2e['query'][_0x8583('0x38')]);_0x661e62['where']=qs[_0x8583('0x32')](_[_0x8583('0x4d')](_0x1d0d2e[_0x8583('0x31')],_0x33dc8a[_0x8583('0x32')]));if(_0x1d0d2e['query'][_0x8583('0x3a')]){_0x661e62['where']=_[_0x8583('0x3c')](_0x661e62[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x661e62['attributes'],function(_0x416b02){var _0x2217e9={};_0x2217e9[_0x416b02]={'$like':'%'+_0x1d0d2e[_0x8583('0x31')][_0x8583('0x3a')]+'%'};return _0x2217e9;})});}_0x661e62=_[_0x8583('0x3c')]({},_0x661e62,_0x1d0d2e['options']);return _0x5398e9['getSubjects'](_0x661e62);}})[_0x8583('0x23')](function(_0x36cdd3){if(_0x36cdd3){_0x1b249e=_0x36cdd3[_0x8583('0x35')];if(!_0x1d0d2e[_0x8583('0x31')][_0x8583('0x4e')]('nolimit')){_0x661e62[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x1c')]);_0x661e62[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x1d0d2e[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x5398e9[_0x8583('0x4f')](_0x661e62);}})['then'](function(_0x333f60){if(_0x333f60){return _0x333f60?{'count':_0x1b249e,'rows':_0x333f60}:null;}})[_0x8583('0x23')](respondWithResult(_0x4dc4e3,null))[_0x8583('0x42')](handleError(_0x4dc4e3,null));};exports[_0x8583('0x50')]=function(_0x537c73,_0x2193f5,_0x3c66f1){var _0x5437e1={};var _0x4fb7dc={};var _0x5e3c82;var _0x5ba09e;return db[_0x8583('0x2b')]['findOne']({'where':{'id':_0x537c73[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x2193f5,null))[_0x8583('0x23')](function(_0x117766){if(_0x117766){_0x5e3c82=_0x117766;_0x4fb7dc[_0x8583('0x30')]=_[_0x8583('0x45')](db[_0x8583('0x4c')][_0x8583('0x2c')]);_0x4fb7dc[_0x8583('0x31')]=_[_0x8583('0x45')](_0x537c73['query']);_0x4fb7dc[_0x8583('0x32')]=_['intersection'](_0x4fb7dc['model'],_0x4fb7dc['query']);_0x5437e1[_0x8583('0x34')]=_[_0x8583('0x33')](_0x4fb7dc[_0x8583('0x30')],qs[_0x8583('0x46')](_0x537c73['query']['fields']));_0x5437e1[_0x8583('0x34')]=_0x5437e1[_0x8583('0x34')]['length']?_0x5437e1[_0x8583('0x34')]:_0x4fb7dc['model'];_0x5437e1[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x537c73[_0x8583('0x31')][_0x8583('0x38')]);_0x5437e1[_0x8583('0x39')]=qs[_0x8583('0x32')](_['pick'](_0x537c73['query'],_0x4fb7dc[_0x8583('0x32')]));if(_0x537c73[_0x8583('0x31')]['filter']){_0x5437e1['where']=_['merge'](_0x5437e1[_0x8583('0x39')],{'$or':_[_0x8583('0x2a')](_0x5437e1[_0x8583('0x34')],function(_0x39591a){var _0x5cadfc={};_0x5cadfc[_0x39591a]={'$like':'%'+_0x537c73[_0x8583('0x31')]['filter']+'%'};return _0x5cadfc;})});}_0x5437e1=_['merge']({},_0x5437e1,_0x537c73['options']);return _0x5e3c82[_0x8583('0x50')](_0x5437e1);}})[_0x8583('0x23')](function(_0x50f5f0){if(_0x50f5f0){_0x5ba09e=_0x50f5f0[_0x8583('0x35')];if(!_0x537c73[_0x8583('0x31')]['hasOwnProperty'](_0x8583('0x36'))){_0x5437e1[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x537c73['query']['limit']);_0x5437e1['offset']=qs['offset'](_0x537c73[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x5e3c82[_0x8583('0x50')](_0x5437e1);}})[_0x8583('0x23')](function(_0x18f379){if(_0x18f379){return _0x18f379?{'count':_0x5ba09e,'rows':_0x18f379}:null;}})[_0x8583('0x23')](respondWithResult(_0x2193f5,null))['catch'](handleError(_0x2193f5,null));};exports[_0x8583('0x51')]=function(_0x2e4c3b,_0x2d1a56,_0x119eea){var _0x576dbe={};var _0x3a0105={};var _0x433ec1;var _0x28dd02;return db[_0x8583('0x2b')][_0x8583('0x4b')]({'where':{'id':_0x2e4c3b[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x2d1a56,null))['then'](function(_0x24947b){if(_0x24947b){_0x433ec1=_0x24947b;_0x3a0105['model']=_[_0x8583('0x45')](db['Tag'][_0x8583('0x2c')]);_0x3a0105[_0x8583('0x31')]=_[_0x8583('0x45')](_0x2e4c3b[_0x8583('0x31')]);_0x3a0105[_0x8583('0x32')]=_[_0x8583('0x33')](_0x3a0105['model'],_0x3a0105[_0x8583('0x31')]);_0x576dbe[_0x8583('0x34')]=_['intersection'](_0x3a0105[_0x8583('0x30')],qs['fields'](_0x2e4c3b['query'][_0x8583('0x46')]));_0x576dbe[_0x8583('0x34')]=_0x576dbe[_0x8583('0x34')][_0x8583('0x35')]?_0x576dbe[_0x8583('0x34')]:_0x3a0105[_0x8583('0x30')];_0x576dbe[_0x8583('0x37')]=qs[_0x8583('0x38')](_0x2e4c3b[_0x8583('0x31')]['sort']);_0x576dbe['where']=qs['filters'](_[_0x8583('0x4d')](_0x2e4c3b[_0x8583('0x31')],_0x3a0105[_0x8583('0x32')]));if(_0x2e4c3b[_0x8583('0x31')][_0x8583('0x3a')]){_0x576dbe[_0x8583('0x39')]=_[_0x8583('0x3c')](_0x576dbe['where'],{'$or':_[_0x8583('0x2a')](_0x576dbe['attributes'],function(_0x145721){var _0xa6487c={};_0xa6487c[_0x145721]={'$like':'%'+_0x2e4c3b[_0x8583('0x31')][_0x8583('0x3a')]+'%'};return _0xa6487c;})});}_0x576dbe=_[_0x8583('0x3c')]({},_0x576dbe,_0x2e4c3b[_0x8583('0x3d')]);return _0x433ec1[_0x8583('0x51')](_0x576dbe);}})[_0x8583('0x23')](function(_0x30b43d){if(_0x30b43d){_0x28dd02=_0x30b43d[_0x8583('0x35')];if(!_0x2e4c3b[_0x8583('0x31')][_0x8583('0x4e')](_0x8583('0x36'))){_0x576dbe[_0x8583('0x1c')]=qs[_0x8583('0x1c')](_0x2e4c3b[_0x8583('0x31')]['limit']);_0x576dbe[_0x8583('0x1a')]=qs[_0x8583('0x1a')](_0x2e4c3b[_0x8583('0x31')][_0x8583('0x1a')]);}return _0x433ec1[_0x8583('0x51')](_0x576dbe);}})[_0x8583('0x23')](function(_0x456179){if(_0x456179){return _0x456179?{'count':_0x28dd02,'rows':_0x456179}:null;}})['then'](respondWithResult(_0x2d1a56,null))[_0x8583('0x42')](handleError(_0x2d1a56,null));};exports['setTags']=function(_0x48709c,_0x559c4e,_0x354ae0){if(_0x48709c['body']['id']){delete _0x48709c[_0x8583('0x49')]['id'];}return db['DeskConfiguration'][_0x8583('0x4b')]({'where':{'id':_0x48709c[_0x8583('0x44')]['id']}})[_0x8583('0x23')](handleEntityNotFound(_0x559c4e,null))['then'](function(_0x380600){if(_0x380600){return _0x380600[_0x8583('0x52')](_0x48709c[_0x8583('0x49')][_0x8583('0x53')]||[]);}return null;})['then'](respondWithResult(_0x559c4e,null))[_0x8583('0x42')](handleError(_0x559c4e,null));}; \ No newline at end of file +var _0x9b84=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','rawAttributes','length','include','find','body','getFields','findOne','DeskField','map','hasOwnProperty','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','DeskConfiguration','fieldName','type','key','query','filters','intersection','model','fields','attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9b84,0x1c3));var _0x49b8=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x9b84[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require(_0x49b8('0x0'));var rimraf=require(_0x49b8('0x1'));var zipdir=require(_0x49b8('0x2'));var jsonpatch=require(_0x49b8('0x3'));var rp=require(_0x49b8('0x4'));var moment=require(_0x49b8('0x5'));var BPromise=require(_0x49b8('0x6'));var Mustache=require('mustache');var util=require(_0x49b8('0x7'));var path=require('path');var sox=require(_0x49b8('0x8'));var csv=require(_0x49b8('0x9'));var ejs=require(_0x49b8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49b8('0xb'));var squel=require(_0x49b8('0xc'));var crypto=require(_0x49b8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x49b8('0xe'));var toCsv=require(_0x49b8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x49b8('0xf'));var authService=require(_0x49b8('0x10'));var qs=require(_0x49b8('0x11'));var as=require(_0x49b8('0x12'));var hardwareService=require(_0x49b8('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x49b8('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x49b8('0x15'))['db'];function respondWithStatusCode(_0x4c8d7a,_0xfe33dc){_0xfe33dc=_0xfe33dc||0xcc;return function(_0x32c72d){if(_0x32c72d){return _0x4c8d7a[_0x49b8('0x16')](_0xfe33dc);}return _0x4c8d7a[_0x49b8('0x17')](_0xfe33dc)[_0x49b8('0x18')]();};}function respondWithResult(_0x33d93c,_0x3756cc){_0x3756cc=_0x3756cc||0xc8;return function(_0x5bc21a){if(_0x5bc21a){return _0x33d93c[_0x49b8('0x17')](_0x3756cc)[_0x49b8('0x19')](_0x5bc21a);}};}function respondWithFilteredResult(_0x947b8d,_0x134437){return function(_0x1218f1){if(_0x1218f1){var _0x9df190=typeof _0x134437[_0x49b8('0x1a')]===_0x49b8('0x1b')&&typeof _0x134437[_0x49b8('0x1c')]==='undefined';var _0x19119a=_0x1218f1[_0x49b8('0x1d')];var _0x319e6=_0x9df190?0x0:_0x134437[_0x49b8('0x1a')];var _0x587ea6=_0x9df190?_0x1218f1[_0x49b8('0x1d')]:_0x134437[_0x49b8('0x1a')]+_0x134437['limit'];var _0x27de94;if(_0x587ea6>=_0x19119a){_0x587ea6=_0x19119a;_0x27de94=0xc8;}else{_0x27de94=0xce;}_0x947b8d[_0x49b8('0x17')](_0x27de94);return _0x947b8d[_0x49b8('0x1e')](_0x49b8('0x1f'),_0x319e6+'-'+_0x587ea6+'/'+_0x19119a)[_0x49b8('0x19')](_0x1218f1);}return null;};}function patchUpdates(_0x5420e1){return function(_0x1ff0a9){try{jsonpatch[_0x49b8('0x20')](_0x1ff0a9,_0x5420e1,!![]);}catch(_0x1b4900){return BPromise[_0x49b8('0x21')](_0x1b4900);}return _0x1ff0a9[_0x49b8('0x22')]();};}function saveUpdates(_0x4ba837,_0x2c70aa){return function(_0x55a38b){if(_0x55a38b){return _0x55a38b[_0x49b8('0x23')](_0x4ba837)['then'](function(_0x288327){return _0x288327;});}return null;};}function removeEntity(_0x1393a6,_0x11826b){return function(_0xce61f3){if(_0xce61f3){return _0xce61f3[_0x49b8('0x24')]()[_0x49b8('0x25')](function(){_0x1393a6[_0x49b8('0x17')](0xcc)[_0x49b8('0x18')]();});}};}function handleEntityNotFound(_0x3e44ee,_0x31a902){return function(_0x20b09c){if(!_0x20b09c){_0x3e44ee[_0x49b8('0x16')](0x194);}return _0x20b09c;};}function handleError(_0x270365,_0x5723bb){_0x5723bb=_0x5723bb||0x1f4;return function(_0x56d137){logger[_0x49b8('0x26')](_0x56d137[_0x49b8('0x27')]);if(_0x56d137['name']){delete _0x56d137[_0x49b8('0x28')];}_0x270365[_0x49b8('0x17')](_0x5723bb)[_0x49b8('0x29')](_0x56d137);};}exports[_0x49b8('0x2a')]=function(_0x4a3b76,_0x36fb50){var _0x5be0da={},_0x21c62a={},_0xbc4abb={'count':0x0,'rows':[]};var _0x5e5a03=_['map'](db[_0x49b8('0x2b')]['rawAttributes'],function(_0x2f9067){return{'name':_0x2f9067[_0x49b8('0x2c')],'type':_0x2f9067[_0x49b8('0x2d')][_0x49b8('0x2e')]};});_0x21c62a['model']=_['map'](_0x5e5a03,_0x49b8('0x28'));_0x21c62a[_0x49b8('0x2f')]=_['keys'](_0x4a3b76['query']);_0x21c62a[_0x49b8('0x30')]=_[_0x49b8('0x31')](_0x21c62a[_0x49b8('0x32')],_0x21c62a[_0x49b8('0x2f')]);_0x5be0da['attributes']=_[_0x49b8('0x31')](_0x21c62a[_0x49b8('0x32')],qs['fields'](_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x33')]));_0x5be0da[_0x49b8('0x34')]=_0x5be0da[_0x49b8('0x34')]['length']?_0x5be0da[_0x49b8('0x34')]:_0x21c62a[_0x49b8('0x32')];if(!_0x4a3b76[_0x49b8('0x2f')]['hasOwnProperty']('nolimit')){_0x5be0da[_0x49b8('0x1c')]=qs[_0x49b8('0x1c')](_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x1c')]);_0x5be0da[_0x49b8('0x1a')]=qs[_0x49b8('0x1a')](_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x1a')]);}_0x5be0da[_0x49b8('0x35')]=qs[_0x49b8('0x36')](_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x36')]);_0x5be0da[_0x49b8('0x37')]=qs['filters'](_[_0x49b8('0x38')](_0x4a3b76[_0x49b8('0x2f')],_0x21c62a[_0x49b8('0x30')]),_0x5e5a03);if(_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x39')]){_0x5be0da['where']=_[_0x49b8('0x3a')](_0x5be0da[_0x49b8('0x37')],{'$or':_['map'](_0x5e5a03,function(_0x4a0c07){if(_0x4a0c07['type']!==_0x49b8('0x3b')){var _0x3b4c82={};_0x3b4c82[_0x4a0c07[_0x49b8('0x28')]]={'$like':'%'+_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x39')]+'%'};return _0x3b4c82;}})});}_0x5be0da=_[_0x49b8('0x3a')]({},_0x5be0da,_0x4a3b76[_0x49b8('0x3c')]);var _0x4d7f7f={'where':_0x5be0da[_0x49b8('0x37')]};return db[_0x49b8('0x2b')]['count'](_0x4d7f7f)[_0x49b8('0x25')](function(_0x403c0f){_0xbc4abb['count']=_0x403c0f;if(_0x4a3b76[_0x49b8('0x2f')][_0x49b8('0x3d')]){_0x5be0da['include']=[{'all':!![]}];}return db[_0x49b8('0x2b')][_0x49b8('0x3e')](_0x5be0da);})['then'](function(_0xfd23d1){_0xbc4abb['rows']=_0xfd23d1;return _0xbc4abb;})[_0x49b8('0x25')](respondWithFilteredResult(_0x36fb50,_0x5be0da))[_0x49b8('0x3f')](handleError(_0x36fb50,null));};exports[_0x49b8('0x40')]=function(_0x17d25f,_0x2309b1){var _0x2288b9={'raw':![],'where':{'id':_0x17d25f[_0x49b8('0x41')]['id']}},_0x16e2e7={};_0x16e2e7[_0x49b8('0x32')]=_[_0x49b8('0x42')](db[_0x49b8('0x2b')][_0x49b8('0x43')]);_0x16e2e7[_0x49b8('0x2f')]=_[_0x49b8('0x42')](_0x17d25f[_0x49b8('0x2f')]);_0x16e2e7[_0x49b8('0x30')]=_['intersection'](_0x16e2e7[_0x49b8('0x32')],_0x16e2e7[_0x49b8('0x2f')]);_0x2288b9[_0x49b8('0x34')]=_[_0x49b8('0x31')](_0x16e2e7[_0x49b8('0x32')],qs[_0x49b8('0x33')](_0x17d25f[_0x49b8('0x2f')][_0x49b8('0x33')]));_0x2288b9[_0x49b8('0x34')]=_0x2288b9['attributes'][_0x49b8('0x44')]?_0x2288b9['attributes']:_0x16e2e7[_0x49b8('0x32')];if(_0x17d25f[_0x49b8('0x2f')][_0x49b8('0x3d')]){_0x2288b9[_0x49b8('0x45')]=[{'all':!![]}];}_0x2288b9=_[_0x49b8('0x3a')]({},_0x2288b9,_0x17d25f[_0x49b8('0x3c')]);return db['DeskConfiguration'][_0x49b8('0x46')](_0x2288b9)[_0x49b8('0x25')](handleEntityNotFound(_0x2309b1,null))[_0x49b8('0x25')](respondWithResult(_0x2309b1,null))['catch'](handleError(_0x2309b1,null));};exports['create']=function(_0x8da7e3,_0x92cf56){return db['DeskConfiguration']['create'](_0x8da7e3[_0x49b8('0x47')],{})[_0x49b8('0x25')](respondWithResult(_0x92cf56,0xc9))['catch'](handleError(_0x92cf56,null));};exports[_0x49b8('0x23')]=function(_0x3e4d04,_0x43f6db){if(_0x3e4d04['body']['id']){delete _0x3e4d04[_0x49b8('0x47')]['id'];}return db[_0x49b8('0x2b')][_0x49b8('0x46')]({'where':{'id':_0x3e4d04[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x43f6db,null))[_0x49b8('0x25')](saveUpdates(_0x3e4d04[_0x49b8('0x47')],null))[_0x49b8('0x25')](respondWithResult(_0x43f6db,null))[_0x49b8('0x3f')](handleError(_0x43f6db,null));};exports[_0x49b8('0x24')]=function(_0x5dee8f,_0x55baa2){return db[_0x49b8('0x2b')][_0x49b8('0x46')]({'where':{'id':_0x5dee8f[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x55baa2,null))[_0x49b8('0x25')](removeEntity(_0x55baa2,null))[_0x49b8('0x3f')](handleError(_0x55baa2,null));};exports[_0x49b8('0x48')]=function(_0x22bf36,_0x2d309f,_0x5e89aa){var _0x33ef50={};var _0x267136={};var _0x471de0;var _0xc5ac0a;return db[_0x49b8('0x2b')][_0x49b8('0x49')]({'where':{'id':_0x22bf36[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x2d309f,null))['then'](function(_0x4858bf){if(_0x4858bf){_0x471de0=_0x4858bf;_0x267136['model']=_['keys'](db[_0x49b8('0x4a')][_0x49b8('0x43')]);_0x267136[_0x49b8('0x2f')]=_['keys'](_0x22bf36[_0x49b8('0x2f')]);_0x267136['filters']=_[_0x49b8('0x31')](_0x267136['model'],_0x267136[_0x49b8('0x2f')]);_0x33ef50[_0x49b8('0x34')]=_['intersection'](_0x267136['model'],qs[_0x49b8('0x33')](_0x22bf36[_0x49b8('0x2f')]['fields']));_0x33ef50[_0x49b8('0x34')]=_0x33ef50[_0x49b8('0x34')]['length']?_0x33ef50[_0x49b8('0x34')]:_0x267136[_0x49b8('0x32')];_0x33ef50[_0x49b8('0x35')]=qs['sort'](_0x22bf36[_0x49b8('0x2f')][_0x49b8('0x36')]);_0x33ef50[_0x49b8('0x37')]=qs[_0x49b8('0x30')](_[_0x49b8('0x38')](_0x22bf36['query'],_0x267136[_0x49b8('0x30')]));if(_0x22bf36['query']['filter']){_0x33ef50[_0x49b8('0x37')]=_[_0x49b8('0x3a')](_0x33ef50[_0x49b8('0x37')],{'$or':_[_0x49b8('0x4b')](_0x33ef50[_0x49b8('0x34')],function(_0x52ede9){var _0x43f94c={};_0x43f94c[_0x52ede9]={'$like':'%'+_0x22bf36[_0x49b8('0x2f')][_0x49b8('0x39')]+'%'};return _0x43f94c;})});}_0x33ef50=_['merge']({},_0x33ef50,_0x22bf36[_0x49b8('0x3c')]);return _0x471de0[_0x49b8('0x48')](_0x33ef50);}})['then'](function(_0x3906e4){if(_0x3906e4){_0xc5ac0a=_0x3906e4[_0x49b8('0x44')];if(!_0x22bf36[_0x49b8('0x2f')][_0x49b8('0x4c')]('nolimit')){_0x33ef50[_0x49b8('0x1c')]=qs[_0x49b8('0x1c')](_0x22bf36[_0x49b8('0x2f')][_0x49b8('0x1c')]);_0x33ef50[_0x49b8('0x1a')]=qs[_0x49b8('0x1a')](_0x22bf36['query'][_0x49b8('0x1a')]);}return _0x471de0['getFields'](_0x33ef50);}})[_0x49b8('0x25')](function(_0x5c9d0e){if(_0x5c9d0e){return _0x5c9d0e?{'count':_0xc5ac0a,'rows':_0x5c9d0e}:null;}})[_0x49b8('0x25')](respondWithResult(_0x2d309f,null))[_0x49b8('0x3f')](handleError(_0x2d309f,null));};exports[_0x49b8('0x4d')]=function(_0x5137d7,_0x16167f,_0x1e9414){var _0x323357={};var _0x538f65={};var _0xcc3bdb;var _0x14b99c;return db[_0x49b8('0x2b')][_0x49b8('0x49')]({'where':{'id':_0x5137d7[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x16167f,null))['then'](function(_0x3834c5){if(_0x3834c5){_0xcc3bdb=_0x3834c5;_0x538f65[_0x49b8('0x32')]=_['keys'](db[_0x49b8('0x4a')][_0x49b8('0x43')]);_0x538f65[_0x49b8('0x2f')]=_[_0x49b8('0x42')](_0x5137d7[_0x49b8('0x2f')]);_0x538f65['filters']=_[_0x49b8('0x31')](_0x538f65[_0x49b8('0x32')],_0x538f65[_0x49b8('0x2f')]);_0x323357[_0x49b8('0x34')]=_[_0x49b8('0x31')](_0x538f65['model'],qs['fields'](_0x5137d7[_0x49b8('0x2f')][_0x49b8('0x33')]));_0x323357['attributes']=_0x323357[_0x49b8('0x34')][_0x49b8('0x44')]?_0x323357[_0x49b8('0x34')]:_0x538f65[_0x49b8('0x32')];_0x323357['order']=qs[_0x49b8('0x36')](_0x5137d7[_0x49b8('0x2f')][_0x49b8('0x36')]);_0x323357[_0x49b8('0x37')]=qs['filters'](_[_0x49b8('0x38')](_0x5137d7[_0x49b8('0x2f')],_0x538f65['filters']));if(_0x5137d7[_0x49b8('0x2f')][_0x49b8('0x39')]){_0x323357[_0x49b8('0x37')]=_[_0x49b8('0x3a')](_0x323357[_0x49b8('0x37')],{'$or':_[_0x49b8('0x4b')](_0x323357[_0x49b8('0x34')],function(_0x823d10){var _0x2e5763={};_0x2e5763[_0x823d10]={'$like':'%'+_0x5137d7['query']['filter']+'%'};return _0x2e5763;})});}_0x323357=_['merge']({},_0x323357,_0x5137d7[_0x49b8('0x3c')]);return _0xcc3bdb[_0x49b8('0x4d')](_0x323357);}})[_0x49b8('0x25')](function(_0x145b01){if(_0x145b01){_0x14b99c=_0x145b01[_0x49b8('0x44')];if(!_0x5137d7['query'][_0x49b8('0x4c')](_0x49b8('0x4e'))){_0x323357[_0x49b8('0x1c')]=qs['limit'](_0x5137d7[_0x49b8('0x2f')][_0x49b8('0x1c')]);_0x323357[_0x49b8('0x1a')]=qs[_0x49b8('0x1a')](_0x5137d7['query'][_0x49b8('0x1a')]);}return _0xcc3bdb[_0x49b8('0x4d')](_0x323357);}})[_0x49b8('0x25')](function(_0xfa5015){if(_0xfa5015){return _0xfa5015?{'count':_0x14b99c,'rows':_0xfa5015}:null;}})[_0x49b8('0x25')](respondWithResult(_0x16167f,null))['catch'](handleError(_0x16167f,null));};exports[_0x49b8('0x4f')]=function(_0x5240bf,_0x1878fb,_0x3e23b1){var _0x1f1c08={};var _0x8839b1={};var _0x58c78a;var _0x588d45;return db['DeskConfiguration']['findOne']({'where':{'id':_0x5240bf[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x1878fb,null))[_0x49b8('0x25')](function(_0x20a903){if(_0x20a903){_0x58c78a=_0x20a903;_0x8839b1[_0x49b8('0x32')]=_[_0x49b8('0x42')](db[_0x49b8('0x4a')][_0x49b8('0x43')]);_0x8839b1[_0x49b8('0x2f')]=_[_0x49b8('0x42')](_0x5240bf[_0x49b8('0x2f')]);_0x8839b1[_0x49b8('0x30')]=_[_0x49b8('0x31')](_0x8839b1['model'],_0x8839b1[_0x49b8('0x2f')]);_0x1f1c08[_0x49b8('0x34')]=_[_0x49b8('0x31')](_0x8839b1['model'],qs[_0x49b8('0x33')](_0x5240bf[_0x49b8('0x2f')][_0x49b8('0x33')]));_0x1f1c08[_0x49b8('0x34')]=_0x1f1c08[_0x49b8('0x34')][_0x49b8('0x44')]?_0x1f1c08[_0x49b8('0x34')]:_0x8839b1['model'];_0x1f1c08[_0x49b8('0x35')]=qs[_0x49b8('0x36')](_0x5240bf[_0x49b8('0x2f')][_0x49b8('0x36')]);_0x1f1c08[_0x49b8('0x37')]=qs['filters'](_[_0x49b8('0x38')](_0x5240bf[_0x49b8('0x2f')],_0x8839b1['filters']));if(_0x5240bf[_0x49b8('0x2f')][_0x49b8('0x39')]){_0x1f1c08[_0x49b8('0x37')]=_[_0x49b8('0x3a')](_0x1f1c08[_0x49b8('0x37')],{'$or':_[_0x49b8('0x4b')](_0x1f1c08[_0x49b8('0x34')],function(_0x377fef){var _0x878250={};_0x878250[_0x377fef]={'$like':'%'+_0x5240bf['query'][_0x49b8('0x39')]+'%'};return _0x878250;})});}_0x1f1c08=_['merge']({},_0x1f1c08,_0x5240bf[_0x49b8('0x3c')]);return _0x58c78a[_0x49b8('0x4f')](_0x1f1c08);}})[_0x49b8('0x25')](function(_0x5bbbde){if(_0x5bbbde){_0x588d45=_0x5bbbde['length'];if(!_0x5240bf[_0x49b8('0x2f')][_0x49b8('0x4c')](_0x49b8('0x4e'))){_0x1f1c08[_0x49b8('0x1c')]=qs[_0x49b8('0x1c')](_0x5240bf[_0x49b8('0x2f')]['limit']);_0x1f1c08[_0x49b8('0x1a')]=qs[_0x49b8('0x1a')](_0x5240bf['query'][_0x49b8('0x1a')]);}return _0x58c78a['getDescriptions'](_0x1f1c08);}})[_0x49b8('0x25')](function(_0x3cb2f2){if(_0x3cb2f2){return _0x3cb2f2?{'count':_0x588d45,'rows':_0x3cb2f2}:null;}})[_0x49b8('0x25')](respondWithResult(_0x1878fb,null))['catch'](handleError(_0x1878fb,null));};exports[_0x49b8('0x50')]=function(_0x420250,_0x449e81,_0x52c223){var _0x178b1b={};var _0x348a40={};var _0x19ea35;var _0x3be5e7;return db[_0x49b8('0x2b')][_0x49b8('0x49')]({'where':{'id':_0x420250[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x449e81,null))[_0x49b8('0x25')](function(_0x1f5f63){if(_0x1f5f63){_0x19ea35=_0x1f5f63;_0x348a40['model']=_[_0x49b8('0x42')](db[_0x49b8('0x51')][_0x49b8('0x43')]);_0x348a40[_0x49b8('0x2f')]=_[_0x49b8('0x42')](_0x420250[_0x49b8('0x2f')]);_0x348a40[_0x49b8('0x30')]=_[_0x49b8('0x31')](_0x348a40['model'],_0x348a40[_0x49b8('0x2f')]);_0x178b1b['attributes']=_[_0x49b8('0x31')](_0x348a40['model'],qs[_0x49b8('0x33')](_0x420250[_0x49b8('0x2f')][_0x49b8('0x33')]));_0x178b1b[_0x49b8('0x34')]=_0x178b1b['attributes']['length']?_0x178b1b['attributes']:_0x348a40[_0x49b8('0x32')];_0x178b1b[_0x49b8('0x35')]=qs['sort'](_0x420250['query']['sort']);_0x178b1b[_0x49b8('0x37')]=qs[_0x49b8('0x30')](_[_0x49b8('0x38')](_0x420250[_0x49b8('0x2f')],_0x348a40[_0x49b8('0x30')]));if(_0x420250['query'][_0x49b8('0x39')]){_0x178b1b['where']=_[_0x49b8('0x3a')](_0x178b1b['where'],{'$or':_['map'](_0x178b1b[_0x49b8('0x34')],function(_0x5d7a19){var _0x68d1be={};_0x68d1be[_0x5d7a19]={'$like':'%'+_0x420250[_0x49b8('0x2f')][_0x49b8('0x39')]+'%'};return _0x68d1be;})});}_0x178b1b=_[_0x49b8('0x3a')]({},_0x178b1b,_0x420250[_0x49b8('0x3c')]);return _0x19ea35[_0x49b8('0x50')](_0x178b1b);}})[_0x49b8('0x25')](function(_0x10df35){if(_0x10df35){_0x3be5e7=_0x10df35[_0x49b8('0x44')];if(!_0x420250[_0x49b8('0x2f')]['hasOwnProperty'](_0x49b8('0x4e'))){_0x178b1b[_0x49b8('0x1c')]=qs[_0x49b8('0x1c')](_0x420250[_0x49b8('0x2f')][_0x49b8('0x1c')]);_0x178b1b[_0x49b8('0x1a')]=qs[_0x49b8('0x1a')](_0x420250[_0x49b8('0x2f')][_0x49b8('0x1a')]);}return _0x19ea35[_0x49b8('0x50')](_0x178b1b);}})[_0x49b8('0x25')](function(_0x344b0f){if(_0x344b0f){return _0x344b0f?{'count':_0x3be5e7,'rows':_0x344b0f}:null;}})[_0x49b8('0x25')](respondWithResult(_0x449e81,null))[_0x49b8('0x3f')](handleError(_0x449e81,null));};exports[_0x49b8('0x52')]=function(_0x3b125d,_0x20b077,_0x2b6c5e){if(_0x3b125d[_0x49b8('0x47')]['id']){delete _0x3b125d[_0x49b8('0x47')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x3b125d[_0x49b8('0x41')]['id']}})[_0x49b8('0x25')](handleEntityNotFound(_0x20b077,null))[_0x49b8('0x25')](function(_0x4c7fef){if(_0x4c7fef){return _0x4c7fef[_0x49b8('0x52')](_0x3b125d[_0x49b8('0x47')][_0x49b8('0x53')]||[]);}return null;})['then'](respondWithResult(_0x20b077,null))[_0x49b8('0x3f')](handleError(_0x20b077,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cbf5cdd..813d642 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 _0xef24=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x5ba549,_0x425afd){var _0x36e3a1=function(_0x464308){while(--_0x464308){_0x5ba549['push'](_0x5ba549['shift']());}};_0x36e3a1(++_0x425afd);}(_0xef24,0x188));var _0x4ef2=function(_0x32c5e4,_0x1e05e9){_0x32c5e4=_0x32c5e4-0x0;var _0x3f4e0a=_0xef24[_0x32c5e4];return _0x3f4e0a;};'use strict';var _=require(_0x4ef2('0x0'));var util=require(_0x4ef2('0x1'));var logger=require(_0x4ef2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ef2('0x3'));var rp=require(_0x4ef2('0x4'));var fs=require('fs');var path=require(_0x4ef2('0x5'));var rimraf=require(_0x4ef2('0x6'));var config=require(_0x4ef2('0x7'));var attributes=require(_0x4ef2('0x8'));module[_0x4ef2('0x9')]=function(_0x52919c,_0x42acba){return _0x52919c[_0x4ef2('0xa')](_0x4ef2('0xb'),attributes,{'tableName':_0x4ef2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5492=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5492,0xf8));var _0x2549=function(_0x2ba56d,_0x8c6dda){_0x2ba56d=_0x2ba56d-0x0;var _0x281e23=_0x5492[_0x2ba56d];return _0x281e23;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2549('0x0'))(_0x2549('0x1'));var moment=require('moment');var BPromise=require(_0x2549('0x2'));var rp=require(_0x2549('0x3'));var fs=require('fs');var path=require(_0x2549('0x4'));var rimraf=require(_0x2549('0x5'));var config=require(_0x2549('0x6'));var attributes=require(_0x2549('0x7'));module[_0x2549('0x8')]=function(_0x152f44,_0x181994){return _0x152f44[_0x2549('0x9')](_0x2549('0xa'),attributes,{'tableName':_0x2549('0xb'),'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 62952b8..73df755 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 _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x22d2ff,_0x56a793){var _0x4a50b6=function(_0x54512c){while(--_0x54512c){_0x22d2ff['push'](_0x22d2ff['shift']());}};_0x4a50b6(++_0x56a793);}(_0x7d25,0x8a));var _0x57d2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7d25[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('DeskConfiguration,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file +var _0xa817=['../../config/environment','jayson/promise','http','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55a6ef,_0x5c5100){var _0x29d32f=function(_0x1cff0f){while(--_0x1cff0f){_0x55a6ef['push'](_0x55a6ef['shift']());}};_0x29d32f(++_0x5c5100);}(_0xa817,0x7b));var _0x7a81=function(_0x5b7266,_0x3d6f37){_0x5b7266=_0x5b7266-0x0;var _0x911fc1=_0xa817[_0x5b7266];return _0x911fc1;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var moment=require(_0x7a81('0x2'));var BPromise=require(_0x7a81('0x3'));var rs=require(_0x7a81('0x4'));var fs=require('fs');var Redis=require(_0x7a81('0x5'));var db=require(_0x7a81('0x6'))['db'];var utils=require(_0x7a81('0x7'));var logger=require(_0x7a81('0x8'))('rpc');var config=require(_0x7a81('0x9'));var jayson=require(_0x7a81('0xa'));var client=jayson['client'][_0x7a81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35c35a,_0x3ab25c,_0x705d4e){return new BPromise(function(_0x1869fb,_0x18f6f6){return client['request'](_0x35c35a,_0x705d4e)[_0x7a81('0xc')](function(_0x5b3b66){logger['info'](_0x7a81('0xd'),_0x3ab25c,'request\x20sent');logger[_0x7a81('0xe')](_0x7a81('0xf'),_0x3ab25c,_0x7a81('0x10'),JSON[_0x7a81('0x11')](_0x5b3b66));if(_0x5b3b66[_0x7a81('0x12')]){if(_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x13')]===0x1f4){logger['error'](_0x7a81('0xd'),_0x3ab25c,_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x14')]);return _0x18f6f6(_0x5b3b66['error'][_0x7a81('0x14')]);}logger[_0x7a81('0x12')](_0x7a81('0xd'),_0x3ab25c,_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x14')]);return _0x1869fb(_0x5b3b66[_0x7a81('0x12')]['message']);}else{logger['info'](_0x7a81('0xd'),_0x3ab25c,_0x7a81('0x10'));_0x1869fb(_0x5b3b66['result'][_0x7a81('0x14')]);}})[_0x7a81('0x15')](function(_0x179afd){logger[_0x7a81('0x12')](_0x7a81('0xd'),_0x3ab25c,_0x179afd);_0x18f6f6(_0x179afd);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 97ddb1d..0d47967 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 _0x53aa=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x4ce996,_0x501313){var _0x2631fd=function(_0x45183e){while(--_0x45183e){_0x4ce996['push'](_0x4ce996['shift']());}};_0x2631fd(++_0x501313);}(_0x53aa,0x167));var _0xa53a=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x53aa[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0xa53a('0x0'));var util=require(_0xa53a('0x1'));var path=require(_0xa53a('0x2'));var timeout=require(_0xa53a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa53a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa53a('0x5'));var config=require(_0xa53a('0x6'));var controller=require(_0xa53a('0x7'));router[_0xa53a('0x8')]('/',auth[_0xa53a('0x9')](),controller['index']);router[_0xa53a('0x8')](_0xa53a('0xa'),auth['isAuthenticated'](),controller[_0xa53a('0xb')]);router[_0xa53a('0xc')]('/',auth[_0xa53a('0x9')](),controller['create']);router[_0xa53a('0xd')]('/:id',auth[_0xa53a('0x9')](),controller[_0xa53a('0xe')]);router[_0xa53a('0xf')](_0xa53a('0xa'),auth[_0xa53a('0x9')](),controller[_0xa53a('0x10')]);module[_0xa53a('0x11')]=router; \ No newline at end of file +var _0x8952=['/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x1da983,_0x37683){var _0x55ea62=function(_0x2425bf){while(--_0x2425bf){_0x1da983['push'](_0x1da983['shift']());}};_0x55ea62(++_0x37683);}(_0x8952,0x17e));var _0x2895=function(_0x4d5204,_0x2cf3b3){_0x4d5204=_0x4d5204-0x0;var _0x566b76=_0x8952[_0x4d5204];return _0x566b76;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2895('0x5'));var interaction=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var controller=require('./intDeskField.controller');router[_0x2895('0x8')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xa')]);router['get']('/:id',auth[_0x2895('0x9')](),controller[_0x2895('0xb')]);router[_0x2895('0xc')]('/',auth[_0x2895('0x9')](),controller[_0x2895('0xd')]);router['put'](_0x2895('0xe'),auth['isAuthenticated'](),controller[_0x2895('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2895('0x10')]);module[_0x2895('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b2af087..8e18d67 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 _0x6f0a=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist'];(function(_0x9b62e2,_0x37050f){var _0x5be40e=function(_0x1db62a){while(--_0x1db62a){_0x9b62e2['push'](_0x9b62e2['shift']());}};_0x5be40e(++_0x37050f);}(_0x6f0a,0x174));var _0xa6f0=function(_0x1b7171,_0x533d9a){_0x1b7171=_0x1b7171-0x0;var _0x3c3db2=_0x6f0a[_0x1b7171];return _0x3c3db2;};'use strict';var Sequelize=require(_0xa6f0('0x0'));module[_0xa6f0('0x1')]={'type':{'type':Sequelize[_0xa6f0('0x2')](_0xa6f0('0x3'),'variable',_0xa6f0('0x4'),'keyValue',_0xa6f0('0x5')),'defaultValue':_0xa6f0('0x3')},'content':{'type':Sequelize[_0xa6f0('0x6')]},'key':{'type':Sequelize[_0xa6f0('0x6')]},'keyType':{'type':Sequelize[_0xa6f0('0x2')](_0xa6f0('0x3'),_0xa6f0('0x7'),_0xa6f0('0x4'))},'keyContent':{'type':Sequelize[_0xa6f0('0x6')]},'idField':{'type':Sequelize[_0xa6f0('0x6')]},'nameField':{'type':Sequelize[_0xa6f0('0x6')]},'customField':{'type':Sequelize[_0xa6f0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6f0('0x6')]}}; \ No newline at end of file +var _0xf44e=['variable','customVariable','exports','keyValue','picklist','string','STRING'];(function(_0x8dcacd,_0x38707e){var _0x5e3c24=function(_0x403a3c){while(--_0x403a3c){_0x8dcacd['push'](_0x8dcacd['shift']());}};_0x5e3c24(++_0x38707e);}(_0xf44e,0x128));var _0xef44=function(_0x211bf0,_0x1abfac){_0x211bf0=_0x211bf0-0x0;var _0x3b6cf2=_0xf44e[_0x211bf0];return _0x3b6cf2;};'use strict';var Sequelize=require('sequelize');module[_0xef44('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable',_0xef44('0x1'),_0xef44('0x2')),'defaultValue':_0xef44('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xef44('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xef44('0x5'),_0xef44('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xef44('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 87c99fd..a2bbaea 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 _0x1a28=['save','update','then','destroy','error','stack','name','index','map','type','key','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','DeskField','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x59cffb,_0x354149){var _0x11958c=function(_0x3a6337){while(--_0x3a6337){_0x59cffb['push'](_0x59cffb['shift']());}};_0x11958c(++_0x354149);}(_0x1a28,0x10e));var _0x81a2=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x1a28[_0x1ccbcc];return _0x1e873f;};'use strict';var emlformat=require(_0x81a2('0x0'));var rimraf=require(_0x81a2('0x1'));var zipdir=require(_0x81a2('0x2'));var jsonpatch=require(_0x81a2('0x3'));var rp=require(_0x81a2('0x4'));var moment=require(_0x81a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81a2('0x6'));var path=require(_0x81a2('0x7'));var sox=require(_0x81a2('0x8'));var csv=require('to-csv');var ejs=require(_0x81a2('0x9'));var fs=require('fs');var fs_extra=require(_0x81a2('0xa'));var _=require('lodash');var squel=require(_0x81a2('0xb'));var crypto=require(_0x81a2('0xc'));var jsforce=require(_0x81a2('0xd'));var deskjs=require(_0x81a2('0xe'));var toCsv=require(_0x81a2('0xf'));var querystring=require(_0x81a2('0x10'));var Papa=require(_0x81a2('0x11'));var Redis=require(_0x81a2('0x12'));var authService=require(_0x81a2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x81a2('0x14'));var hardwareService=require(_0x81a2('0x15'));var logger=require(_0x81a2('0x16'))(_0x81a2('0x17'));var utils=require(_0x81a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x81a2('0x19'));var db=require(_0x81a2('0x1a'))['db'];function respondWithStatusCode(_0x56aa38,_0x1d17ce){_0x1d17ce=_0x1d17ce||0xcc;return function(_0xad98fa){if(_0xad98fa){return _0x56aa38[_0x81a2('0x1b')](_0x1d17ce);}return _0x56aa38[_0x81a2('0x1c')](_0x1d17ce)[_0x81a2('0x1d')]();};}function respondWithResult(_0x47ce61,_0xce799f){_0xce799f=_0xce799f||0xc8;return function(_0x58ce36){if(_0x58ce36){return _0x47ce61[_0x81a2('0x1c')](_0xce799f)[_0x81a2('0x1e')](_0x58ce36);}};}function respondWithFilteredResult(_0x5887a7,_0x24a2eb){return function(_0x5117a3){if(_0x5117a3){var _0x233c0b=typeof _0x24a2eb[_0x81a2('0x1f')]===_0x81a2('0x20')&&typeof _0x24a2eb[_0x81a2('0x21')]===_0x81a2('0x20');var _0x3b39b2=_0x5117a3[_0x81a2('0x22')];var _0xcad181=_0x233c0b?0x0:_0x24a2eb['offset'];var _0x17b111=_0x233c0b?_0x5117a3[_0x81a2('0x22')]:_0x24a2eb[_0x81a2('0x1f')]+_0x24a2eb[_0x81a2('0x21')];var _0x1ac02e;if(_0x17b111>=_0x3b39b2){_0x17b111=_0x3b39b2;_0x1ac02e=0xc8;}else{_0x1ac02e=0xce;}_0x5887a7[_0x81a2('0x1c')](_0x1ac02e);return _0x5887a7[_0x81a2('0x23')](_0x81a2('0x24'),_0xcad181+'-'+_0x17b111+'/'+_0x3b39b2)[_0x81a2('0x1e')](_0x5117a3);}return null;};}function patchUpdates(_0x36c992){return function(_0x5e1436){try{jsonpatch[_0x81a2('0x25')](_0x5e1436,_0x36c992,!![]);}catch(_0x547f96){return BPromise['reject'](_0x547f96);}return _0x5e1436[_0x81a2('0x26')]();};}function saveUpdates(_0x1e7ee3,_0x5aff98){return function(_0x251605){if(_0x251605){return _0x251605[_0x81a2('0x27')](_0x1e7ee3)[_0x81a2('0x28')](function(_0x1b08d8){return _0x1b08d8;});}return null;};}function removeEntity(_0x44f4db,_0x2055e2){return function(_0x1e64e1){if(_0x1e64e1){return _0x1e64e1[_0x81a2('0x29')]()[_0x81a2('0x28')](function(){_0x44f4db[_0x81a2('0x1c')](0xcc)[_0x81a2('0x1d')]();});}};}function handleEntityNotFound(_0x51e8be,_0x3378e4){return function(_0x5ea3fe){if(!_0x5ea3fe){_0x51e8be[_0x81a2('0x1b')](0x194);}return _0x5ea3fe;};}function handleError(_0x1bedab,_0x468e8b){_0x468e8b=_0x468e8b||0x1f4;return function(_0x31dfa8){logger[_0x81a2('0x2a')](_0x31dfa8[_0x81a2('0x2b')]);if(_0x31dfa8['name']){delete _0x31dfa8[_0x81a2('0x2c')];}_0x1bedab['status'](_0x468e8b)['send'](_0x31dfa8);};}exports[_0x81a2('0x2d')]=function(_0x333bb6,_0x5d3824){var _0x20ac9c={},_0x52f468={},_0x36ab50={'count':0x0,'rows':[]};var _0x5df693=_[_0x81a2('0x2e')](db['DeskField']['rawAttributes'],function(_0x474312){return{'name':_0x474312['fieldName'],'type':_0x474312[_0x81a2('0x2f')][_0x81a2('0x30')]};});_0x52f468['model']=_['map'](_0x5df693,_0x81a2('0x2c'));_0x52f468['query']=_['keys'](_0x333bb6['query']);_0x52f468[_0x81a2('0x31')]=_[_0x81a2('0x32')](_0x52f468[_0x81a2('0x33')],_0x52f468[_0x81a2('0x34')]);_0x20ac9c[_0x81a2('0x35')]=_[_0x81a2('0x32')](_0x52f468[_0x81a2('0x33')],qs[_0x81a2('0x36')](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x36')]));_0x20ac9c[_0x81a2('0x35')]=_0x20ac9c[_0x81a2('0x35')][_0x81a2('0x37')]?_0x20ac9c['attributes']:_0x52f468[_0x81a2('0x33')];if(!_0x333bb6[_0x81a2('0x34')][_0x81a2('0x38')](_0x81a2('0x39'))){_0x20ac9c[_0x81a2('0x21')]=qs['limit'](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x21')]);_0x20ac9c[_0x81a2('0x1f')]=qs[_0x81a2('0x1f')](_0x333bb6[_0x81a2('0x34')][_0x81a2('0x1f')]);}_0x20ac9c[_0x81a2('0x3a')]=qs[_0x81a2('0x3b')](_0x333bb6['query'][_0x81a2('0x3b')]);_0x20ac9c[_0x81a2('0x3c')]=qs['filters'](_[_0x81a2('0x3d')](_0x333bb6[_0x81a2('0x34')],_0x52f468['filters']),_0x5df693);if(_0x333bb6[_0x81a2('0x34')][_0x81a2('0x3e')]){_0x20ac9c[_0x81a2('0x3c')]=_['merge'](_0x20ac9c[_0x81a2('0x3c')],{'$or':_[_0x81a2('0x2e')](_0x5df693,function(_0x2a75bf){if(_0x2a75bf[_0x81a2('0x2f')]!==_0x81a2('0x3f')){var _0x32eb76={};_0x32eb76[_0x2a75bf[_0x81a2('0x2c')]]={'$like':'%'+_0x333bb6['query']['filter']+'%'};return _0x32eb76;}})});}_0x20ac9c=_[_0x81a2('0x40')]({},_0x20ac9c,_0x333bb6['options']);var _0x374e43={'where':_0x20ac9c['where']};return db[_0x81a2('0x41')]['count'](_0x374e43)['then'](function(_0x48ea83){_0x36ab50['count']=_0x48ea83;if(_0x333bb6[_0x81a2('0x34')]['includeAll']){_0x20ac9c[_0x81a2('0x42')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x20ac9c);})[_0x81a2('0x28')](function(_0x5dcbb1){_0x36ab50[_0x81a2('0x43')]=_0x5dcbb1;return _0x36ab50;})[_0x81a2('0x28')](respondWithFilteredResult(_0x5d3824,_0x20ac9c))[_0x81a2('0x44')](handleError(_0x5d3824,null));};exports[_0x81a2('0x45')]=function(_0x1ef49c,_0x26d149){var _0x4b17ff={'raw':!![],'where':{'id':_0x1ef49c[_0x81a2('0x46')]['id']}},_0x3f0098={};_0x3f0098['model']=_[_0x81a2('0x47')](db[_0x81a2('0x41')][_0x81a2('0x48')]);_0x3f0098[_0x81a2('0x34')]=_[_0x81a2('0x47')](_0x1ef49c[_0x81a2('0x34')]);_0x3f0098[_0x81a2('0x31')]=_[_0x81a2('0x32')](_0x3f0098['model'],_0x3f0098[_0x81a2('0x34')]);_0x4b17ff[_0x81a2('0x35')]=_[_0x81a2('0x32')](_0x3f0098[_0x81a2('0x33')],qs[_0x81a2('0x36')](_0x1ef49c[_0x81a2('0x34')]['fields']));_0x4b17ff['attributes']=_0x4b17ff[_0x81a2('0x35')][_0x81a2('0x37')]?_0x4b17ff[_0x81a2('0x35')]:_0x3f0098['model'];if(_0x1ef49c[_0x81a2('0x34')][_0x81a2('0x49')]){_0x4b17ff[_0x81a2('0x42')]=[{'all':!![]}];}_0x4b17ff=_[_0x81a2('0x40')]({},_0x4b17ff,_0x1ef49c['options']);return db[_0x81a2('0x41')][_0x81a2('0x4a')](_0x4b17ff)[_0x81a2('0x28')](handleEntityNotFound(_0x26d149,null))[_0x81a2('0x28')](respondWithResult(_0x26d149,null))[_0x81a2('0x44')](handleError(_0x26d149,null));};exports[_0x81a2('0x4b')]=function(_0x421d22,_0x2c7215){return db['DeskField'][_0x81a2('0x4b')](_0x421d22['body'],{})[_0x81a2('0x28')](respondWithResult(_0x2c7215,0xc9))['catch'](handleError(_0x2c7215,null));};exports[_0x81a2('0x27')]=function(_0xa4761b,_0x57eb3f){if(_0xa4761b[_0x81a2('0x4c')]['id']){delete _0xa4761b[_0x81a2('0x4c')]['id'];}return db[_0x81a2('0x41')][_0x81a2('0x4a')]({'where':{'id':_0xa4761b[_0x81a2('0x46')]['id']}})[_0x81a2('0x28')](handleEntityNotFound(_0x57eb3f,null))[_0x81a2('0x28')](saveUpdates(_0xa4761b[_0x81a2('0x4c')],null))[_0x81a2('0x28')](respondWithResult(_0x57eb3f,null))[_0x81a2('0x44')](handleError(_0x57eb3f,null));};exports[_0x81a2('0x29')]=function(_0x56ff0f,_0x20395d){return db[_0x81a2('0x41')][_0x81a2('0x4a')]({'where':{'id':_0x56ff0f[_0x81a2('0x46')]['id']}})[_0x81a2('0x28')](handleEntityNotFound(_0x20395d,null))[_0x81a2('0x28')](removeEntity(_0x20395d,null))[_0x81a2('0x44')](handleError(_0x20395d,null));}; \ No newline at end of file +var _0x0755=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','map','DeskField','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','findAll','show','params','includeAll','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x593f0e,_0x3555e7){var _0x116f30=function(_0x4df802){while(--_0x4df802){_0x593f0e['push'](_0x593f0e['shift']());}};_0x116f30(++_0x3555e7);}(_0x0755,0x7c));var _0x5075=function(_0x1cfb46,_0xf2adf0){_0x1cfb46=_0x1cfb46-0x0;var _0x4b490b=_0x0755[_0x1cfb46];return _0x4b490b;};'use strict';var emlformat=require(_0x5075('0x0'));var rimraf=require(_0x5075('0x1'));var zipdir=require(_0x5075('0x2'));var jsonpatch=require(_0x5075('0x3'));var rp=require(_0x5075('0x4'));var moment=require(_0x5075('0x5'));var BPromise=require(_0x5075('0x6'));var Mustache=require(_0x5075('0x7'));var util=require(_0x5075('0x8'));var path=require(_0x5075('0x9'));var sox=require('sox');var csv=require(_0x5075('0xa'));var ejs=require(_0x5075('0xb'));var fs=require('fs');var fs_extra=require(_0x5075('0xc'));var _=require(_0x5075('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5075('0xe'));var toCsv=require(_0x5075('0xa'));var querystring=require('querystring');var Papa=require(_0x5075('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5075('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5075('0x11'))(_0x5075('0x12'));var utils=require(_0x5075('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5075('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c5e3,_0x1a131e){_0x1a131e=_0x1a131e||0xcc;return function(_0x413cec){if(_0x413cec){return _0x11c5e3[_0x5075('0x15')](_0x1a131e);}return _0x11c5e3[_0x5075('0x16')](_0x1a131e)[_0x5075('0x17')]();};}function respondWithResult(_0x92710a,_0x32b1a1){_0x32b1a1=_0x32b1a1||0xc8;return function(_0x339420){if(_0x339420){return _0x92710a[_0x5075('0x16')](_0x32b1a1)[_0x5075('0x18')](_0x339420);}};}function respondWithFilteredResult(_0x13e267,_0x4235cd){return function(_0x49ff22){if(_0x49ff22){var _0x128a1b=typeof _0x4235cd[_0x5075('0x19')]===_0x5075('0x1a')&&typeof _0x4235cd[_0x5075('0x1b')]===_0x5075('0x1a');var _0x57fedb=_0x49ff22[_0x5075('0x1c')];var _0xc8b69a=_0x128a1b?0x0:_0x4235cd['offset'];var _0x2159a8=_0x128a1b?_0x49ff22[_0x5075('0x1c')]:_0x4235cd[_0x5075('0x19')]+_0x4235cd[_0x5075('0x1b')];var _0x53232c;if(_0x2159a8>=_0x57fedb){_0x2159a8=_0x57fedb;_0x53232c=0xc8;}else{_0x53232c=0xce;}_0x13e267[_0x5075('0x16')](_0x53232c);return _0x13e267['set'](_0x5075('0x1d'),_0xc8b69a+'-'+_0x2159a8+'/'+_0x57fedb)['json'](_0x49ff22);}return null;};}function patchUpdates(_0x17382e){return function(_0x545364){try{jsonpatch[_0x5075('0x1e')](_0x545364,_0x17382e,!![]);}catch(_0x4c65c7){return BPromise[_0x5075('0x1f')](_0x4c65c7);}return _0x545364[_0x5075('0x20')]();};}function saveUpdates(_0x5ea539,_0x530244){return function(_0x510d4e){if(_0x510d4e){return _0x510d4e[_0x5075('0x21')](_0x5ea539)[_0x5075('0x22')](function(_0xd48fad){return _0xd48fad;});}return null;};}function removeEntity(_0x396c08,_0x1d7758){return function(_0x4e2c16){if(_0x4e2c16){return _0x4e2c16[_0x5075('0x23')]()[_0x5075('0x22')](function(){_0x396c08[_0x5075('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f16cc,_0x212438){return function(_0x57fcb5){if(!_0x57fcb5){_0x1f16cc[_0x5075('0x15')](0x194);}return _0x57fcb5;};}function handleError(_0x3b178d,_0x1340ea){_0x1340ea=_0x1340ea||0x1f4;return function(_0x38a4ea){logger['error'](_0x38a4ea['stack']);if(_0x38a4ea['name']){delete _0x38a4ea[_0x5075('0x24')];}_0x3b178d[_0x5075('0x16')](_0x1340ea)['send'](_0x38a4ea);};}exports[_0x5075('0x25')]=function(_0x36dbf7,_0x444c06){var _0x4efb14={},_0x264777={},_0x514349={'count':0x0,'rows':[]};var _0x5d3a5c=_[_0x5075('0x26')](db[_0x5075('0x27')][_0x5075('0x28')],function(_0x1102cc){return{'name':_0x1102cc['fieldName'],'type':_0x1102cc[_0x5075('0x29')][_0x5075('0x2a')]};});_0x264777[_0x5075('0x2b')]=_['map'](_0x5d3a5c,_0x5075('0x24'));_0x264777[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x36dbf7[_0x5075('0x2c')]);_0x264777['filters']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],_0x264777[_0x5075('0x2c')]);_0x4efb14['attributes']=_[_0x5075('0x2e')](_0x264777[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x36dbf7[_0x5075('0x2c')][_0x5075('0x2f')]));_0x4efb14['attributes']=_0x4efb14[_0x5075('0x30')][_0x5075('0x31')]?_0x4efb14['attributes']:_0x264777[_0x5075('0x2b')];if(!_0x36dbf7['query']['hasOwnProperty']('nolimit')){_0x4efb14[_0x5075('0x1b')]=qs[_0x5075('0x1b')](_0x36dbf7[_0x5075('0x2c')]['limit']);_0x4efb14[_0x5075('0x19')]=qs['offset'](_0x36dbf7['query'][_0x5075('0x19')]);}_0x4efb14['order']=qs[_0x5075('0x32')](_0x36dbf7[_0x5075('0x2c')]['sort']);_0x4efb14[_0x5075('0x33')]=qs[_0x5075('0x34')](_[_0x5075('0x35')](_0x36dbf7['query'],_0x264777[_0x5075('0x34')]),_0x5d3a5c);if(_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]){_0x4efb14[_0x5075('0x33')]=_[_0x5075('0x37')](_0x4efb14[_0x5075('0x33')],{'$or':_[_0x5075('0x26')](_0x5d3a5c,function(_0x1f230a){if(_0x1f230a[_0x5075('0x29')]!=='VIRTUAL'){var _0x4c9568={};_0x4c9568[_0x1f230a[_0x5075('0x24')]]={'$like':'%'+_0x36dbf7[_0x5075('0x2c')][_0x5075('0x36')]+'%'};return _0x4c9568;}})});}_0x4efb14=_[_0x5075('0x37')]({},_0x4efb14,_0x36dbf7['options']);var _0x63b935={'where':_0x4efb14[_0x5075('0x33')]};return db[_0x5075('0x27')][_0x5075('0x1c')](_0x63b935)[_0x5075('0x22')](function(_0xbb29e8){_0x514349[_0x5075('0x1c')]=_0xbb29e8;if(_0x36dbf7['query']['includeAll']){_0x4efb14['include']=[{'all':!![]}];}return db['DeskField'][_0x5075('0x38')](_0x4efb14);})[_0x5075('0x22')](function(_0x12f169){_0x514349['rows']=_0x12f169;return _0x514349;})[_0x5075('0x22')](respondWithFilteredResult(_0x444c06,_0x4efb14))['catch'](handleError(_0x444c06,null));};exports[_0x5075('0x39')]=function(_0x1e5a34,_0x1f9165){var _0x2afa26={'raw':!![],'where':{'id':_0x1e5a34[_0x5075('0x3a')]['id']}},_0x42d4b4={};_0x42d4b4['model']=_[_0x5075('0x2d')](db[_0x5075('0x27')][_0x5075('0x28')]);_0x42d4b4[_0x5075('0x2c')]=_[_0x5075('0x2d')](_0x1e5a34['query']);_0x42d4b4[_0x5075('0x34')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],_0x42d4b4['query']);_0x2afa26[_0x5075('0x30')]=_[_0x5075('0x2e')](_0x42d4b4[_0x5075('0x2b')],qs[_0x5075('0x2f')](_0x1e5a34[_0x5075('0x2c')][_0x5075('0x2f')]));_0x2afa26[_0x5075('0x30')]=_0x2afa26[_0x5075('0x30')][_0x5075('0x31')]?_0x2afa26[_0x5075('0x30')]:_0x42d4b4[_0x5075('0x2b')];if(_0x1e5a34[_0x5075('0x2c')][_0x5075('0x3b')]){_0x2afa26['include']=[{'all':!![]}];}_0x2afa26=_['merge']({},_0x2afa26,_0x1e5a34[_0x5075('0x3c')]);return db['DeskField']['find'](_0x2afa26)[_0x5075('0x22')](handleEntityNotFound(_0x1f9165,null))[_0x5075('0x22')](respondWithResult(_0x1f9165,null))[_0x5075('0x3d')](handleError(_0x1f9165,null));};exports['create']=function(_0x49b9a0,_0x35f55d){return db['DeskField'][_0x5075('0x3e')](_0x49b9a0['body'],{})['then'](respondWithResult(_0x35f55d,0xc9))[_0x5075('0x3d')](handleError(_0x35f55d,null));};exports[_0x5075('0x21')]=function(_0x137e67,_0x3cbcf5){if(_0x137e67['body']['id']){delete _0x137e67[_0x5075('0x3f')]['id'];}return db[_0x5075('0x27')][_0x5075('0x40')]({'where':{'id':_0x137e67[_0x5075('0x3a')]['id']}})[_0x5075('0x22')](handleEntityNotFound(_0x3cbcf5,null))[_0x5075('0x22')](saveUpdates(_0x137e67[_0x5075('0x3f')],null))['then'](respondWithResult(_0x3cbcf5,null))[_0x5075('0x3d')](handleError(_0x3cbcf5,null));};exports['destroy']=function(_0x4d386c,_0x4113e7){return db['DeskField']['find']({'where':{'id':_0x4d386c['params']['id']}})['then'](handleEntityNotFound(_0x4113e7,null))[_0x5075('0x22')](removeEntity(_0x4113e7,null))[_0x5075('0x3d')](handleError(_0x4113e7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index efc9d0b..06c4ed1 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 _0xbc61=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1870ba,_0x397d1e){var _0x255779=function(_0x16cdb5){while(--_0x16cdb5){_0x1870ba['push'](_0x1870ba['shift']());}};_0x255779(++_0x397d1e);}(_0xbc61,0xa2));var _0x1bc6=function(_0x441b78,_0x4a5ee5){_0x441b78=_0x441b78-0x0;var _0x3816df=_0xbc61[_0x441b78];return _0x3816df;};'use strict';var _=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var logger=require(_0x1bc6('0x2'))(_0x1bc6('0x3'));var moment=require(_0x1bc6('0x4'));var BPromise=require(_0x1bc6('0x5'));var rp=require(_0x1bc6('0x6'));var fs=require('fs');var path=require(_0x1bc6('0x7'));var rimraf=require(_0x1bc6('0x8'));var config=require(_0x1bc6('0x9'));var attributes=require(_0x1bc6('0xa'));module['exports']=function(_0x221e1b,_0x1e9bad){return _0x221e1b[_0x1bc6('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97cf=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util'];(function(_0xf70f56,_0x20d05b){var _0xdf9780=function(_0x379d22){while(--_0x379d22){_0xf70f56['push'](_0xf70f56['shift']());}};_0xdf9780(++_0x20d05b);}(_0x97cf,0x11b));var _0xf97c=function(_0x25e3d3,_0x1d2882){_0x25e3d3=_0x25e3d3-0x0;var _0x42ad83=_0x97cf[_0x25e3d3];return _0x42ad83;};'use strict';var _=require(_0xf97c('0x0'));var util=require(_0xf97c('0x1'));var logger=require(_0xf97c('0x2'))(_0xf97c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf97c('0x4'));var fs=require('fs');var path=require(_0xf97c('0x5'));var rimraf=require(_0xf97c('0x6'));var config=require(_0xf97c('0x7'));var attributes=require(_0xf97c('0x8'));module[_0xf97c('0x9')]=function(_0x57016e,_0x4feee7){return _0x57016e[_0xf97c('0xa')](_0xf97c('0xb'),attributes,{'tableName':_0xf97c('0xc'),'paranoid':![],'indexes':[{'name':_0xf97c('0xd'),'fields':['idField',_0xf97c('0xe')],'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 20cc2de..07b70d5 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 _0x8c79=['then','info','DeskField,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c79,0x148));var _0x98c7=function(_0xf4050f,_0xefc6bb){_0xf4050f=_0xf4050f-0x0;var _0x42baab=_0x8c79[_0xf4050f];return _0x42baab;};'use strict';var _=require(_0x98c7('0x0'));var util=require(_0x98c7('0x1'));var moment=require(_0x98c7('0x2'));var BPromise=require(_0x98c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98c7('0x4'));var db=require(_0x98c7('0x5'))['db'];var utils=require(_0x98c7('0x6'));var logger=require(_0x98c7('0x7'))('rpc');var config=require(_0x98c7('0x8'));var jayson=require(_0x98c7('0x9'));var client=jayson[_0x98c7('0xa')][_0x98c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ea3eb,_0x466a2b,_0x3f563c){return new BPromise(function(_0x421241,_0x24f9f7){return client['request'](_0x1ea3eb,_0x3f563c)[_0x98c7('0xc')](function(_0x3e810c){logger[_0x98c7('0xd')](_0x98c7('0xe'),_0x466a2b,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x466a2b,'request\x20sent',JSON['stringify'](_0x3e810c));if(_0x3e810c['error']){if(_0x3e810c[_0x98c7('0xf')]['code']===0x1f4){logger[_0x98c7('0xf')](_0x98c7('0xe'),_0x466a2b,_0x3e810c[_0x98c7('0xf')][_0x98c7('0x10')]);return _0x24f9f7(_0x3e810c[_0x98c7('0xf')][_0x98c7('0x10')]);}logger[_0x98c7('0xf')](_0x98c7('0xe'),_0x466a2b,_0x3e810c['error']['message']);return _0x421241(_0x3e810c[_0x98c7('0xf')]['message']);}else{logger['info'](_0x98c7('0xe'),_0x466a2b,_0x98c7('0x11'));_0x421241(_0x3e810c[_0x98c7('0x12')][_0x98c7('0x10')]);}})[_0x98c7('0x13')](function(_0x4780aa){logger[_0x98c7('0xf')]('DeskField,\x20%s,\x20%s',_0x466a2b,_0x4780aa);_0x24f9f7(_0x4780aa);});});} \ No newline at end of file +var _0x4e4c=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x4e4c,0x1e8));var _0xc4e4=function(_0x2d9540,_0x3a5c73){_0x2d9540=_0x2d9540-0x0;var _0x41a70b=_0x4e4c[_0x2d9540];return _0x41a70b;};'use strict';var _=require(_0xc4e4('0x0'));var util=require(_0xc4e4('0x1'));var moment=require(_0xc4e4('0x2'));var BPromise=require(_0xc4e4('0x3'));var rs=require(_0xc4e4('0x4'));var fs=require('fs');var Redis=require(_0xc4e4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4e4('0x6'));var logger=require(_0xc4e4('0x7'))('rpc');var config=require(_0xc4e4('0x8'));var jayson=require(_0xc4e4('0x9'));var client=jayson[_0xc4e4('0xa')][_0xc4e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d0916,_0x2b23c4,_0x3df1ea){return new BPromise(function(_0xe9cc9c,_0x69766f){return client['request'](_0x3d0916,_0x3df1ea)['then'](function(_0x14ee9e){logger['info'](_0xc4e4('0xc'),_0x2b23c4,'request\x20sent');logger[_0xc4e4('0xd')](_0xc4e4('0xe'),_0x2b23c4,_0xc4e4('0xf'),JSON['stringify'](_0x14ee9e));if(_0x14ee9e[_0xc4e4('0x10')]){if(_0x14ee9e[_0xc4e4('0x10')][_0xc4e4('0x11')]===0x1f4){logger['error'](_0xc4e4('0xc'),_0x2b23c4,_0x14ee9e[_0xc4e4('0x10')]['message']);return _0x69766f(_0x14ee9e[_0xc4e4('0x10')][_0xc4e4('0x12')]);}logger[_0xc4e4('0x10')](_0xc4e4('0xc'),_0x2b23c4,_0x14ee9e[_0xc4e4('0x10')][_0xc4e4('0x12')]);return _0xe9cc9c(_0x14ee9e['error'][_0xc4e4('0x12')]);}else{logger[_0xc4e4('0x13')]('DeskField,\x20%s,\x20%s',_0x2b23c4,_0xc4e4('0xf'));_0xe9cc9c(_0x14ee9e[_0xc4e4('0x14')][_0xc4e4('0x12')]);}})[_0xc4e4('0x15')](function(_0x372f42){logger[_0xc4e4('0x10')]('DeskField,\x20%s,\x20%s',_0x2b23c4,_0x372f42);_0x69766f(_0x372f42);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 008f4f2..a3c4e63 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 _0xb88a=['post','create','/:id/configurations','addConfiguration','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x385af7,_0x12c0a3){var _0x4d67c9=function(_0x53021e){while(--_0x53021e){_0x385af7['push'](_0x385af7['shift']());}};_0x4d67c9(++_0x12c0a3);}(_0xb88a,0xf6));var _0xab88=function(_0x2b7acb,_0x401bba){_0x2b7acb=_0x2b7acb-0x0;var _0x487379=_0xb88a[_0x2b7acb];return _0x487379;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab88('0x0'));var timeout=require('connect-timeout');var express=require(_0xab88('0x1'));var router=express['Router']();var fs_extra=require(_0xab88('0x2'));var auth=require(_0xab88('0x3'));var interaction=require(_0xab88('0x4'));var config=require(_0xab88('0x5'));var controller=require('./intDynamics365Account.controller');router[_0xab88('0x6')]('/',auth['isAuthenticated'](),controller[_0xab88('0x7')]);router['get'](_0xab88('0x8'),auth[_0xab88('0x9')](),controller[_0xab88('0xa')]);router['get']('/:id/configurations',auth[_0xab88('0x9')](),controller[_0xab88('0xb')]);router[_0xab88('0x6')](_0xab88('0xc'),auth['isAuthenticated'](),controller[_0xab88('0xd')]);router[_0xab88('0xe')]('/',auth[_0xab88('0x9')](),controller[_0xab88('0xf')]);router[_0xab88('0xe')](_0xab88('0x10'),auth[_0xab88('0x9')](),controller[_0xab88('0x11')]);router['put'](_0xab88('0x8'),auth[_0xab88('0x9')](),controller['update']);router['delete'](_0xab88('0x8'),auth['isAuthenticated'](),controller[_0xab88('0x12')]);module[_0xab88('0x13')]=router; \ No newline at end of file +var _0x4141=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','update','destroy','multer','util'];(function(_0x19e262,_0x5e3384){var _0x1e42d1=function(_0x4d18c6){while(--_0x4d18c6){_0x19e262['push'](_0x19e262['shift']());}};_0x1e42d1(++_0x5e3384);}(_0x4141,0x11e));var _0x1414=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4141[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x1414('0x0'));var util=require(_0x1414('0x1'));var path=require(_0x1414('0x2'));var timeout=require(_0x1414('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1414('0x4'));var auth=require(_0x1414('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1414('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x1414('0x7')]('/',auth[_0x1414('0x8')](),controller[_0x1414('0x9')]);router[_0x1414('0x7')](_0x1414('0xa'),auth[_0x1414('0x8')](),controller[_0x1414('0xb')]);router[_0x1414('0x7')](_0x1414('0xc'),auth[_0x1414('0x8')](),controller[_0x1414('0xd')]);router['get']('/:id/fields',auth[_0x1414('0x8')](),controller['getFields']);router['post']('/',auth[_0x1414('0x8')](),controller['create']);router[_0x1414('0xe')](_0x1414('0xc'),auth[_0x1414('0x8')](),controller[_0x1414('0xf')]);router['put'](_0x1414('0xa'),auth[_0x1414('0x8')](),controller[_0x1414('0x10')]);router['delete'](_0x1414('0xa'),auth[_0x1414('0x8')](),controller[_0x1414('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 228ee55..a14b569 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 _0xfdb3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1fbded,_0x56d312){var _0x23099a=function(_0xdf14b2){while(--_0xdf14b2){_0x1fbded['push'](_0x1fbded['shift']());}};_0x23099a(++_0x56d312);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x131e61,_0x264acb){_0x131e61=_0x131e61-0x0;var _0x4e0d94=_0xfdb3[_0x131e61];return _0x4e0d94;};'use strict';var Sequelize=require(_0x3fdb('0x0'));module[_0x3fdb('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fdb('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3fdb('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3fdb('0x2')]},'serverUrl':{'type':Sequelize[_0x3fdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3fdb('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3fdb('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x72a2=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x72a2,0x161));var _0x272a=function(_0x3147c2,_0x13fdcd){_0x3147c2=_0x3147c2-0x0;var _0x170832=_0x72a2[_0x3147c2];return _0x170832;};'use strict';var Sequelize=require('sequelize');module[_0x272a('0x0')]={'name':{'type':Sequelize[_0x272a('0x1')]},'username':{'type':Sequelize[_0x272a('0x1')]},'password':{'type':Sequelize[_0x272a('0x1')]},'remoteUri':{'type':Sequelize[_0x272a('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x272a('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x272a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'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 186e553..78bd13e 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 _0x8d75=['contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','stack','name','send','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','ticketType','incident','Incident','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname'];(function(_0x3f033f,_0x3b1d1e){var _0x24c9fe=function(_0x1d21f1){while(--_0x1d21f1){_0x3f033f['push'](_0x3f033f['shift']());}};_0x24c9fe(++_0x3b1d1e);}(_0x8d75,0x6d));var _0x58d7=function(_0x2a9106,_0x1f7758){_0x2a9106=_0x2a9106-0x0;var _0x4a0f3a=_0x8d75[_0x2a9106];return _0x4a0f3a;};'use strict';var rp=require(_0x58d7('0x0'));var util=require(_0x58d7('0x1'));var _=require(_0x58d7('0x2'));var qs=require(_0x58d7('0x3'));var logger=require(_0x58d7('0x4'))(_0x58d7('0x5'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0xe35e20,_0x130b89){_0x130b89=_0x130b89||0xc8;return function(_0x27bbaa){if(_0x27bbaa){return _0xe35e20[_0x58d7('0x6')](_0x130b89)[_0x58d7('0x7')](_0x27bbaa);}};}function respondWithFilteredResult(_0x48ded1,_0x4b665a){return function(_0x2b1c42){if(_0x2b1c42){var _0x27281c=typeof _0x4b665a[_0x58d7('0x8')]==='undefined'&&typeof _0x4b665a['limit']===_0x58d7('0x9');var _0x4f0875=_0x2b1c42[_0x58d7('0xa')];var _0x17e183=_0x27281c?0x0:_0x4b665a[_0x58d7('0x8')];var _0x466ca5=_0x27281c?_0x2b1c42[_0x58d7('0xa')]:_0x4b665a[_0x58d7('0x8')]+_0x4b665a[_0x58d7('0xb')];var _0x10b0e5;if(_0x466ca5>=_0x4f0875){_0x466ca5=_0x4f0875;_0x10b0e5=0xc8;}else{_0x10b0e5=0xce;}_0x48ded1[_0x58d7('0x6')](_0x10b0e5);return _0x48ded1[_0x58d7('0xc')](_0x58d7('0xd'),_0x17e183+'-'+_0x466ca5+'/'+_0x4f0875)[_0x58d7('0x7')](_0x2b1c42);}return null;};}function saveUpdates(_0x17bb67){return function(_0x5c5ce7){if(_0x5c5ce7){return _0x5c5ce7[_0x58d7('0xe')](_0x17bb67)[_0x58d7('0xf')](function(_0x21df66){return _0x21df66;});}return null;};}function removeEntity(_0x1d5b20){return function(_0x29c5d4){if(_0x29c5d4){return _0x29c5d4[_0x58d7('0x10')]()['then'](function(){_0x1d5b20[_0x58d7('0x6')](0xcc)[_0x58d7('0x11')]();});}};}function handleEntityNotFound(_0x1e76d6){return function(_0x4be04e){if(!_0x4be04e){_0x1e76d6['sendStatus'](0x194);}return _0x4be04e;};}function handleError(_0x4551a9,_0x36665a){_0x36665a=_0x36665a||0x1f4;return function(_0x3a53dd){logger['error'](_0x3a53dd[_0x58d7('0x12')]);if(_0x3a53dd[_0x58d7('0x13')]){delete _0x3a53dd[_0x58d7('0x13')];}_0x4551a9[_0x58d7('0x6')](_0x36665a)[_0x58d7('0x14')](_0x3a53dd);};}exports['index']=function(_0x42654c,_0x30d2aa){var _0x1cbfab={},_0x57f038={},_0x3e07ca={'count':0x0,'rows':[]};var _0x4b8db4=_[_0x58d7('0x15')](db['Dynamics365Account'][_0x58d7('0x16')],function(_0x438b62){return{'name':_0x438b62['fieldName'],'type':_0x438b62[_0x58d7('0x17')]['key']};});_0x57f038[_0x58d7('0x18')]=_['map'](_0x4b8db4,_0x58d7('0x13'));_0x57f038['query']=_['keys'](_0x42654c[_0x58d7('0x19')]);_0x57f038[_0x58d7('0x1a')]=_['intersection'](_0x57f038[_0x58d7('0x18')],_0x57f038[_0x58d7('0x19')]);_0x1cbfab[_0x58d7('0x1b')]=_[_0x58d7('0x1c')](_0x57f038[_0x58d7('0x18')],qs['fields'](_0x42654c[_0x58d7('0x19')][_0x58d7('0x1d')]));_0x1cbfab[_0x58d7('0x1b')]=_0x1cbfab[_0x58d7('0x1b')][_0x58d7('0x1e')]?_0x1cbfab['attributes']:_0x57f038[_0x58d7('0x18')];if(!_0x42654c[_0x58d7('0x19')][_0x58d7('0x1f')](_0x58d7('0x20'))){_0x1cbfab[_0x58d7('0xb')]=qs[_0x58d7('0xb')](_0x42654c[_0x58d7('0x19')][_0x58d7('0xb')]);_0x1cbfab['offset']=qs[_0x58d7('0x8')](_0x42654c['query'][_0x58d7('0x8')]);}_0x1cbfab[_0x58d7('0x21')]=qs[_0x58d7('0x22')](_0x42654c[_0x58d7('0x19')][_0x58d7('0x22')]);_0x1cbfab[_0x58d7('0x23')]=qs[_0x58d7('0x1a')](_[_0x58d7('0x24')](_0x42654c[_0x58d7('0x19')],_0x57f038[_0x58d7('0x1a')]),_0x4b8db4);if(_0x42654c[_0x58d7('0x19')][_0x58d7('0x25')]){_0x1cbfab[_0x58d7('0x23')]=_[_0x58d7('0x26')](_0x1cbfab['where'],{'$or':_[_0x58d7('0x15')](_0x4b8db4,function(_0x25f038){if(_0x25f038[_0x58d7('0x17')]!==_0x58d7('0x27')){var _0x40093b={};_0x40093b[_0x25f038[_0x58d7('0x13')]]={'$like':'%'+_0x42654c[_0x58d7('0x19')][_0x58d7('0x25')]+'%'};return _0x40093b;}})});}_0x1cbfab=_[_0x58d7('0x26')]({},_0x1cbfab,_0x42654c[_0x58d7('0x28')]);var _0x34a543={'where':_0x1cbfab[_0x58d7('0x23')]};return db[_0x58d7('0x29')][_0x58d7('0xa')](_0x34a543)[_0x58d7('0xf')](function(_0x468524){_0x3e07ca[_0x58d7('0xa')]=_0x468524;if(_0x42654c[_0x58d7('0x19')]['includeAll']){_0x1cbfab[_0x58d7('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x58d7('0x2b')](_0x1cbfab);})[_0x58d7('0xf')](function(_0x397e1f){_0x3e07ca[_0x58d7('0x2c')]=_0x397e1f;return _0x3e07ca;})[_0x58d7('0xf')](respondWithFilteredResult(_0x30d2aa,_0x1cbfab))[_0x58d7('0x2d')](handleError(_0x30d2aa,null));};exports[_0x58d7('0x2e')]=function(_0x470784,_0x44519b){var _0x392a2b={'raw':![],'where':{'id':_0x470784[_0x58d7('0x2f')]['id']}},_0x247813={};_0x247813[_0x58d7('0x18')]=_[_0x58d7('0x30')](db['Dynamics365Account'][_0x58d7('0x16')]);_0x247813['query']=_[_0x58d7('0x30')](_0x470784[_0x58d7('0x19')]);_0x247813[_0x58d7('0x1a')]=_[_0x58d7('0x1c')](_0x247813[_0x58d7('0x18')],_0x247813[_0x58d7('0x19')]);_0x392a2b[_0x58d7('0x1b')]=_[_0x58d7('0x1c')](_0x247813[_0x58d7('0x18')],qs[_0x58d7('0x1d')](_0x470784['query']['fields']));_0x392a2b['attributes']=_0x392a2b[_0x58d7('0x1b')]['length']?_0x392a2b[_0x58d7('0x1b')]:_0x247813[_0x58d7('0x18')];if(_0x470784['query'][_0x58d7('0x31')]){_0x392a2b['include']=[{'all':!![]}];}_0x392a2b=_[_0x58d7('0x26')]({},_0x392a2b,_0x470784[_0x58d7('0x28')]);return db[_0x58d7('0x29')][_0x58d7('0x32')](_0x392a2b)['then'](handleEntityNotFound(_0x44519b,null))[_0x58d7('0xf')](respondWithResult(_0x44519b,null))[_0x58d7('0x2d')](handleError(_0x44519b,null));};exports[_0x58d7('0x33')]=function(_0x145ddb,_0x1242f6){return db[_0x58d7('0x29')][_0x58d7('0x33')](_0x145ddb['body'],{})[_0x58d7('0xf')](respondWithResult(_0x1242f6,0xc9))['catch'](handleError(_0x1242f6,null));};exports['update']=function(_0x234ee1,_0x4f42e2){if(_0x234ee1[_0x58d7('0x34')]['id']){delete _0x234ee1[_0x58d7('0x34')]['id'];}return db[_0x58d7('0x29')][_0x58d7('0x32')]({'where':{'id':_0x234ee1['params']['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x4f42e2,null))[_0x58d7('0xf')](saveUpdates(_0x234ee1[_0x58d7('0x34')],null))[_0x58d7('0xf')](respondWithResult(_0x4f42e2,null))[_0x58d7('0x2d')](handleError(_0x4f42e2,null));};exports[_0x58d7('0x10')]=function(_0x59a044,_0x3a768b){return db[_0x58d7('0x29')][_0x58d7('0x32')]({'where':{'id':_0x59a044[_0x58d7('0x2f')]['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x3a768b,null))[_0x58d7('0xf')](removeEntity(_0x3a768b,null))[_0x58d7('0x2d')](handleError(_0x3a768b,null));};exports[_0x58d7('0x35')]=function(_0x40529e,_0x1caba3){var _0x1fc618={};var _0x38eb64={};var _0x5fe406;var _0x5aff7e;return db[_0x58d7('0x29')]['findOne']({'where':{'id':_0x40529e[_0x58d7('0x2f')]['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x1caba3,null))[_0x58d7('0xf')](function(_0x7c0ecf){if(_0x7c0ecf){_0x5fe406=_0x7c0ecf;_0x38eb64[_0x58d7('0x18')]=_[_0x58d7('0x30')](db[_0x58d7('0x36')][_0x58d7('0x16')]);_0x38eb64[_0x58d7('0x19')]=_[_0x58d7('0x30')](_0x40529e['query']);_0x38eb64[_0x58d7('0x1a')]=_['intersection'](_0x38eb64[_0x58d7('0x18')],_0x38eb64[_0x58d7('0x19')]);_0x1fc618['attributes']=_[_0x58d7('0x1c')](_0x38eb64['model'],qs[_0x58d7('0x1d')](_0x40529e['query'][_0x58d7('0x1d')]));_0x1fc618[_0x58d7('0x1b')]=_0x1fc618[_0x58d7('0x1b')][_0x58d7('0x1e')]?_0x1fc618['attributes']:_0x38eb64[_0x58d7('0x18')];_0x1fc618[_0x58d7('0x21')]=qs[_0x58d7('0x22')](_0x40529e[_0x58d7('0x19')][_0x58d7('0x22')]);_0x1fc618['where']=qs[_0x58d7('0x1a')](_['pick'](_0x40529e[_0x58d7('0x19')],_0x38eb64[_0x58d7('0x1a')]));if(_0x40529e[_0x58d7('0x19')][_0x58d7('0x25')]){_0x1fc618[_0x58d7('0x23')]=_[_0x58d7('0x26')](_0x1fc618['where'],{'$or':_['map'](_0x1fc618[_0x58d7('0x1b')],function(_0x2fb7e0){var _0x4218fa={};_0x4218fa[_0x2fb7e0]={'$like':'%'+_0x40529e[_0x58d7('0x19')][_0x58d7('0x25')]+'%'};return _0x4218fa;})});}_0x1fc618=_[_0x58d7('0x26')]({},_0x1fc618,_0x40529e[_0x58d7('0x28')]);return _0x5fe406[_0x58d7('0x35')](_0x1fc618);}})[_0x58d7('0xf')](function(_0xe38247){if(_0xe38247){_0x5aff7e=_0xe38247['length'];if(!_0x40529e['query'][_0x58d7('0x1f')]('nolimit')){_0x1fc618[_0x58d7('0xb')]=qs[_0x58d7('0xb')](_0x40529e[_0x58d7('0x19')]['limit']);_0x1fc618[_0x58d7('0x8')]=qs[_0x58d7('0x8')](_0x40529e[_0x58d7('0x19')][_0x58d7('0x8')]);}return _0x5fe406[_0x58d7('0x35')](_0x1fc618);}})['then'](function(_0x5af2a9){if(_0x5af2a9){return _0x5af2a9?{'count':_0x5aff7e,'rows':_0x5af2a9}:null;}})[_0x58d7('0xf')](respondWithResult(_0x1caba3,null))[_0x58d7('0x2d')](handleError(_0x1caba3,null));};exports['addConfiguration']=function(_0x4651ed,_0x1a5bd8){if(_0x4651ed[_0x58d7('0x34')]['id']){delete _0x4651ed[_0x58d7('0x34')]['id'];}return db[_0x58d7('0x29')][_0x58d7('0x37')]({'where':{'id':_0x4651ed['params']['id']}})[_0x58d7('0xf')](handleEntityNotFound(_0x1a5bd8,null))['then'](function(_0x1669d0){if(_0x1669d0){_0x4651ed[_0x58d7('0x34')][_0x58d7('0x38')]=_0x1669d0['id'];_0x4651ed[_0x58d7('0x34')][_0x58d7('0x39')]=integrations[_0x58d7('0x3a')](_0x4651ed[_0x58d7('0x34')]['channel'],_0x4651ed['body'][_0x58d7('0x17')]);_0x4651ed['body']['Descriptions']=integrations[_0x58d7('0x3b')](_0x4651ed[_0x58d7('0x34')]['channel'],_0x4651ed[_0x58d7('0x34')]['type']);return db['Dynamics365Configuration'][_0x58d7('0x33')](_0x4651ed[_0x58d7('0x34')],{'include':[{'model':db[_0x58d7('0x3c')],'as':_0x58d7('0x39')},{'model':db[_0x58d7('0x3c')],'as':_0x58d7('0x3d')}]});}return null;})[_0x58d7('0xf')](respondWithResult(_0x1a5bd8,null))[_0x58d7('0x2d')](handleError(_0x1a5bd8,null));};function sanitizeRemoteUri(_0x550182){var _0x390f6a=_0x550182[_0x58d7('0x3e')](-0x1);if(_0x390f6a==='/')return _0x550182[_0x58d7('0x3f')](0x0,_0x550182[_0x58d7('0x40')](_0x390f6a));return _0x550182;}function getWebApiUrl(_0x3ab0bd){return util['format'](_0x58d7('0x41'),_0x3ab0bd);}exports['getFields']=function(_0x1cf2bf,_0x5aa92f){var _0x14f9f0=_0x1cf2bf[_0x58d7('0x19')][_0x58d7('0x42')];var _0x5021cc=_0x14f9f0===_0x58d7('0x43')?_0x58d7('0x44'):'PhoneCall';var _0x555ce7='';var _0x236264='';var _0x180ec9='';var _0x3c6c9e='';var _0x13b706='';var _0x4abac1='';var _0x40cf57='';var _0x4be2f9='';var _0x127118=['title',_0x58d7('0x45'),_0x58d7('0x46'),_0x58d7('0x47'),_0x58d7('0x48'),_0x58d7('0x49'),_0x58d7('0x4a'),'regardingobjectid',_0x58d7('0x4b'),'phonecall_activity_parties'];var _0x3d4052=[_0x58d7('0x4c'),_0x58d7('0x4d'),_0x58d7('0x4e'),_0x58d7('0x4f'),_0x58d7('0x50'),_0x58d7('0x51'),_0x58d7('0x52'),_0x58d7('0x53'),_0x58d7('0x54'),'createdbyexternalpartyyominame',_0x58d7('0x55'),_0x58d7('0x56'),'createdon',_0x58d7('0x57'),_0x58d7('0x58'),_0x58d7('0x59'),_0x58d7('0x5a'),_0x58d7('0x5b'),'emailaddress',_0x58d7('0x5c'),_0x58d7('0x5d'),_0x58d7('0x5e'),_0x58d7('0x5f'),'exchangerate',_0x58d7('0x60'),_0x58d7('0x61'),_0x58d7('0x62'),'influencescore',_0x58d7('0x63'),_0x58d7('0x64'),'masteridname',_0x58d7('0x65'),'modifiedbyexternalpartyyominame',_0x58d7('0x66'),_0x58d7('0x67'),_0x58d7('0x68'),_0x58d7('0x69'),'modifiedonbehalfbyyominame',_0x58d7('0x6a'),'msdyn_iotalertname',_0x58d7('0x6b'),_0x58d7('0x6c'),_0x58d7('0x6d'),'owneridname',_0x58d7('0x6e'),_0x58d7('0x6f'),_0x58d7('0x70'),_0x58d7('0x71'),_0x58d7('0x72'),_0x58d7('0x73'),_0x58d7('0x74'),_0x58d7('0x75'),_0x58d7('0x76'),_0x58d7('0x77'),_0x58d7('0x78'),_0x58d7('0x79'),_0x58d7('0x7a'),_0x58d7('0x7b'),_0x58d7('0x7c'),_0x58d7('0x7d'),'socialprofileidname','statecode','statuscode',_0x58d7('0x7e'),_0x58d7('0x7f'),_0x58d7('0x80'),_0x58d7('0x81'),'traversedpath',_0x58d7('0x82'),'versionnumber'];var _0x425206=_0x127118['concat'](_0x3d4052);return db[_0x58d7('0x29')]['findOne']({'where':{'id':_0x1cf2bf['params']['id']},'attributes':['id',_0x58d7('0x83'),_0x58d7('0x84'),_0x58d7('0x85'),_0x58d7('0x86'),'clientId',_0x58d7('0x87'),_0x58d7('0x88')],'include':[{'model':db['CloudProvider'],'as':_0x58d7('0x89'),'attributes':['id','data5',_0x58d7('0x8a')]}]})['then'](handleEntityNotFound(_0x5aa92f,null))[_0x58d7('0xf')](function(_0x3ba204){if(_0x3ba204){if(_0x3ba204[_0x58d7('0x88')]){_0x3ba204[_0x58d7('0x8b')]=_0x3ba204[_0x58d7('0x89')]['data5'];_0x4be2f9=sanitizeRemoteUri(_0x3ba204[_0x58d7('0x89')][_0x58d7('0x8a')]);_0x40cf57=getWebApiUrl(_0x4be2f9);return _0x3ba204;}_0x4be2f9=sanitizeRemoteUri(_0x3ba204[_0x58d7('0x85')]);_0x40cf57=getWebApiUrl(_0x4be2f9);var _0x28491d={'method':_0x58d7('0x8c'),'uri':_0x58d7('0x8d')+_0x3ba204['tenantId']+_0x58d7('0x8e'),'form':{'client_id':_0x3ba204[_0x58d7('0x8f')],'resource':_0x4be2f9,'username':_0x3ba204['username'],'password':_0x3ba204['password'],'grant_type':_0x58d7('0x84'),'client_secret':_0x3ba204[_0x58d7('0x87')]},'json':!![]};return rp(_0x28491d);}})[_0x58d7('0xf')](function(_0x2a8135){_0x4abac1=_0x2a8135[_0x58d7('0x8b')];var _0x3ff9da={'method':_0x58d7('0x90'),'uri':encodeURI(_0x40cf57+_0x58d7('0x91')+_0x5021cc+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4abac1,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x3ff9da);})['then'](function(_0x35582a){var _0xa77f89=_0x35582a[_0x58d7('0x93')][0x0];var _0x5ef4ec=_0xa77f89[_0x58d7('0x94')];var _0x3b8501={'method':_0x58d7('0x90'),'uri':_0x40cf57+_0x58d7('0x95')+_0x5ef4ec+_0x58d7('0x96'),'headers':{'Authorization':_0x58d7('0x97')+_0x4abac1,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x3b8501);})[_0x58d7('0xf')](function(_0x4399b3){_0x555ce7=_0x4399b3;_0x236264=_0x555ce7[_0x58d7('0x98')];_0x236264=_[_0x58d7('0x99')](_0x236264,function(_0x5f388f){return!_0x425206[_0x58d7('0x9a')](_0x5f388f[_0x58d7('0x9b')]);});var _0x41fe0a=[];var _0x12465b=[];_0x236264[_0x58d7('0x9c')](function(_0x2a139d){if(_0x2a139d['@odata.type']){var _0x515d0f=_0x2a139d['@odata.type']['substring'](_0x2a139d[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x515d0f===_0x58d7('0x9e')){_0x41fe0a['push'](getSelectList(_0x40cf57,_0x14f9f0,_0x12465b,_0x555ce7[_0x58d7('0x94')],_0x2a139d[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x41fe0a);})[_0x58d7('0xf')](function(_0x16be0e){_0x180ec9=_0x16be0e[0x0];var _0x4ae741=[];var _0x51b0=[];_0x236264[_0x58d7('0x9c')](function(_0x3e8ffe){if(!_[_0x58d7('0xa0')](_0x3e8ffe['@odata.type'])){var _0x487b57=_0x3e8ffe['@odata.type'][_0x58d7('0x3f')](_0x3e8ffe[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x487b57===_0x58d7('0xa1')){_0x4ae741[_0x58d7('0xa2')](getBooleanList(_0x40cf57,_0x14f9f0,_0x51b0,_0x555ce7[_0x58d7('0x94')],_0x3e8ffe[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x4ae741);})[_0x58d7('0xf')](function(_0xf92242){_0x3c6c9e=_0xf92242[0x0];var _0x265f87=[];var _0x110ad6=[];_0x236264['forEach'](function(_0x14d1d0){if(_0x14d1d0[_0x58d7('0x9d')]){var _0x40fab3=_0x14d1d0[_0x58d7('0x9d')][_0x58d7('0x3f')](_0x14d1d0[_0x58d7('0x9d')][_0x58d7('0x40')]('.')+0x1);if(_0x40fab3===_0x58d7('0xa3')||_0x40fab3===_0x58d7('0xa4')||_0x40fab3===_0x58d7('0xa5')||_0x40fab3===_0x58d7('0xa6')||_0x40fab3===_0x58d7('0xa7')||_0x40fab3===_0x58d7('0xa8')||_0x40fab3===_0x58d7('0xa9')||_0x40fab3==='EntityNameAttributeMetadata'||_0x40fab3===_0x58d7('0xaa')||_0x40fab3===_0x58d7('0xab')){_0x265f87['push'](getInputList(_0x40cf57,_0x14f9f0,_0x40fab3,_0x110ad6,_0x555ce7[_0x58d7('0x94')],_0x14d1d0[_0x58d7('0x94')],_0x4abac1));}}});return Promise[_0x58d7('0x9f')](_0x265f87);})['then'](function(_0x4ad9e5){_0x13b706=_0x4ad9e5[0x0];var _0x5106dd=_0x180ec9['concat'](_0x3c6c9e)[_0x58d7('0xac')](_0x13b706);var _0x574192={'count':_0x5106dd[_0x58d7('0x1e')],'rows':_0x5106dd};return _0x574192;})[_0x58d7('0xf')](respondWithResult(_0x5aa92f,null))[_0x58d7('0x2d')](function(_0x3af695){var _0x7f50e7=_0x1cf2bf['query'][_0x58d7('0xad')]?0x1f4:_0x3af695[_0x58d7('0xae')]||0x1f4;logger[_0x58d7('0xaf')](_0x3af695[_0x58d7('0x12')]);delete _0x3af695[_0x58d7('0x13')];if(_0x7f50e7===0x191){_0x7f50e7=0x190;}_0x5aa92f[_0x58d7('0x6')](_0x7f50e7)['send'](_0x1cf2bf[_0x58d7('0x19')]['test']?{'message':_0x58d7('0xb0'),'statusCode':_0x3af695[_0x58d7('0xae')]}:_0x3af695);});};function getSelectList(_0x1f1034,_0x2b3fe4,_0x45f06e,_0x5d635c,_0x481790,_0x4e8ff6){var _0x96c19={'method':_0x58d7('0x90'),'uri':_0x1f1034+_0x58d7('0x95')+_0x5d635c+_0x58d7('0xb1')+_0x481790+_0x58d7('0xb2')+_0x58d7('0xb3'),'headers':{'Authorization':_0x58d7('0x97')+_0x4e8ff6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x96c19)[_0x58d7('0xf')](function(_0x1b54f9){var _0x47cb51=[];var _0x2d84e7=_0x1b54f9[_0x58d7('0xb4')][_0x58d7('0xb5')];_0x2d84e7['forEach'](function(_0x5caa0f){_0x47cb51[_0x58d7('0xa2')]({'name':_0x5caa0f[_0x58d7('0xb6')]['UserLocalizedLabel'][_0x58d7('0xb6')],'value':String(_0x5caa0f[_0x58d7('0xb7')])});});var _0xfb6815={'id':_0x2b3fe4+'_'+_0x1b54f9[_0x58d7('0x9b')],'name':_0x1b54f9[_0x58d7('0xb8')][_0x58d7('0xb9')][_0x58d7('0xb6')],'custom':![],'options':_0x47cb51};_0x45f06e[_0x58d7('0xa2')](_0xfb6815);return _0x45f06e;});}function getBooleanList(_0x1850a9,_0x312901,_0x9b1eb1,_0x180f35,_0xf99aa9,_0x49cc88){var _0x1109e9={'method':_0x58d7('0x90'),'uri':_0x1850a9+_0x58d7('0x95')+_0x180f35+_0x58d7('0xb1')+_0xf99aa9+_0x58d7('0xba'),'headers':{'Authorization':_0x58d7('0x97')+_0x49cc88,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x1109e9)[_0x58d7('0xf')](function(_0x256171){var _0x3666f6=[];_0x3666f6[_0x58d7('0xa2')]({'name':_0x256171[_0x58d7('0xb4')][_0x58d7('0xbb')]['Label'][_0x58d7('0xb9')][_0x58d7('0xb6')],'value':_0x58d7('0xbc')},{'name':_0x256171[_0x58d7('0xb4')][_0x58d7('0xbd')]['Label']['UserLocalizedLabel'][_0x58d7('0xb6')],'value':_0x58d7('0xbe')});var _0x21acac={'id':_0x312901+'_'+_0x256171['LogicalName'],'name':_0x256171[_0x58d7('0xb8')][_0x58d7('0xb9')]['Label'],'custom':![],'options':_0x3666f6};_0x9b1eb1[_0x58d7('0xa2')](_0x21acac);return _0x9b1eb1;});}function getInputList(_0x259f9a,_0xceabb9,_0x4edf65,_0x1246d6,_0x32ca8e,_0x1a1397,_0x3653eb){var _0x55614f={'method':'GET','uri':_0x259f9a+_0x58d7('0x95')+_0x32ca8e+_0x58d7('0xb1')+_0x1a1397+')/Microsoft.Dynamics.CRM.'+_0x4edf65+_0x58d7('0xbf'),'headers':{'Authorization':_0x58d7('0x97')+_0x3653eb,'If-None-Match':null,'OData-Version':_0x58d7('0x92')},'json':!![]};return rp(_0x55614f)['then'](function(_0x2512f5){var _0x551c12={'id':_0xceabb9+'_'+_0x2512f5[_0x58d7('0x9b')],'name':_0x2512f5[_0x58d7('0xb8')][_0x58d7('0xb9')]?_0x2512f5[_0x58d7('0xb8')][_0x58d7('0xb9')][_0x58d7('0xb6')]:_0x2512f5['LogicalName'],'custom':![],'options':[]};_0x1246d6['push'](_0x551c12);return _0x1246d6;});} \ No newline at end of file +var _0x2fc8=['filter','merge','options','includeAll','include','Dynamics365Account','rows','catch','show','params','find','create','body','getConfigurations','findOne','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','description','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responsiblecontactidname','responsiblecontactidyominame','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','push','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../config/logger','api','json','offset','limit','count','status','set','update','destroy','then','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x2fc8,0x14a));var _0x82fc=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x2fc8[_0x30ae5e];return _0x1f2e93;};'use strict';var rp=require('request-promise');var util=require(_0x82fc('0x0'));var _=require(_0x82fc('0x1'));var qs=require(_0x82fc('0x2'));var logger=require(_0x82fc('0x3'))(_0x82fc('0x4'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x5c5c75,_0x2e7507){_0x2e7507=_0x2e7507||0xc8;return function(_0x24ab71){if(_0x24ab71){return _0x5c5c75['status'](_0x2e7507)[_0x82fc('0x5')](_0x24ab71);}};}function respondWithFilteredResult(_0x5b6068,_0x1f6590){return function(_0x12540d){if(_0x12540d){var _0xd9d510=typeof _0x1f6590[_0x82fc('0x6')]==='undefined'&&typeof _0x1f6590[_0x82fc('0x7')]==='undefined';var _0x50f121=_0x12540d[_0x82fc('0x8')];var _0x4b8968=_0xd9d510?0x0:_0x1f6590[_0x82fc('0x6')];var _0x2d0ed8=_0xd9d510?_0x12540d[_0x82fc('0x8')]:_0x1f6590[_0x82fc('0x6')]+_0x1f6590[_0x82fc('0x7')];var _0x47f27d;if(_0x2d0ed8>=_0x50f121){_0x2d0ed8=_0x50f121;_0x47f27d=0xc8;}else{_0x47f27d=0xce;}_0x5b6068[_0x82fc('0x9')](_0x47f27d);return _0x5b6068[_0x82fc('0xa')]('Content-Range',_0x4b8968+'-'+_0x2d0ed8+'/'+_0x50f121)[_0x82fc('0x5')](_0x12540d);}return null;};}function saveUpdates(_0x334b2c){return function(_0x2c03a2){if(_0x2c03a2){return _0x2c03a2[_0x82fc('0xb')](_0x334b2c)['then'](function(_0x1f97dc){return _0x1f97dc;});}return null;};}function removeEntity(_0x41fa31){return function(_0x1ace45){if(_0x1ace45){return _0x1ace45[_0x82fc('0xc')]()[_0x82fc('0xd')](function(){_0x41fa31[_0x82fc('0x9')](0xcc)[_0x82fc('0xe')]();});}};}function handleEntityNotFound(_0x5a004f){return function(_0x2fe11d){if(!_0x2fe11d){_0x5a004f[_0x82fc('0xf')](0x194);}return _0x2fe11d;};}function handleError(_0x422bac,_0x28b3fb){_0x28b3fb=_0x28b3fb||0x1f4;return function(_0x3c3444){logger[_0x82fc('0x10')](_0x3c3444[_0x82fc('0x11')]);if(_0x3c3444[_0x82fc('0x12')]){delete _0x3c3444[_0x82fc('0x12')];}_0x422bac[_0x82fc('0x9')](_0x28b3fb)['send'](_0x3c3444);};}exports[_0x82fc('0x13')]=function(_0x515176,_0x42b526){var _0x29357a={},_0x2bc403={},_0x5c2d1e={'count':0x0,'rows':[]};var _0x1598a8=_['map'](db['Dynamics365Account'][_0x82fc('0x14')],function(_0x3c5e34){return{'name':_0x3c5e34[_0x82fc('0x15')],'type':_0x3c5e34[_0x82fc('0x16')][_0x82fc('0x17')]};});_0x2bc403[_0x82fc('0x18')]=_[_0x82fc('0x19')](_0x1598a8,'name');_0x2bc403['query']=_[_0x82fc('0x1a')](_0x515176[_0x82fc('0x1b')]);_0x2bc403[_0x82fc('0x1c')]=_[_0x82fc('0x1d')](_0x2bc403['model'],_0x2bc403[_0x82fc('0x1b')]);_0x29357a[_0x82fc('0x1e')]=_['intersection'](_0x2bc403[_0x82fc('0x18')],qs[_0x82fc('0x1f')](_0x515176[_0x82fc('0x1b')]['fields']));_0x29357a['attributes']=_0x29357a[_0x82fc('0x1e')][_0x82fc('0x20')]?_0x29357a['attributes']:_0x2bc403[_0x82fc('0x18')];if(!_0x515176['query'][_0x82fc('0x21')](_0x82fc('0x22'))){_0x29357a['limit']=qs['limit'](_0x515176[_0x82fc('0x1b')][_0x82fc('0x7')]);_0x29357a[_0x82fc('0x6')]=qs[_0x82fc('0x6')](_0x515176['query']['offset']);}_0x29357a[_0x82fc('0x23')]=qs['sort'](_0x515176[_0x82fc('0x1b')][_0x82fc('0x24')]);_0x29357a[_0x82fc('0x25')]=qs['filters'](_['pick'](_0x515176[_0x82fc('0x1b')],_0x2bc403['filters']),_0x1598a8);if(_0x515176['query'][_0x82fc('0x26')]){_0x29357a[_0x82fc('0x25')]=_[_0x82fc('0x27')](_0x29357a[_0x82fc('0x25')],{'$or':_[_0x82fc('0x19')](_0x1598a8,function(_0x58f302){if(_0x58f302['type']!=='VIRTUAL'){var _0x1de0c1={};_0x1de0c1[_0x58f302[_0x82fc('0x12')]]={'$like':'%'+_0x515176[_0x82fc('0x1b')][_0x82fc('0x26')]+'%'};return _0x1de0c1;}})});}_0x29357a=_['merge']({},_0x29357a,_0x515176[_0x82fc('0x28')]);var _0x491b2a={'where':_0x29357a[_0x82fc('0x25')]};return db['Dynamics365Account']['count'](_0x491b2a)['then'](function(_0x51b763){_0x5c2d1e[_0x82fc('0x8')]=_0x51b763;if(_0x515176[_0x82fc('0x1b')][_0x82fc('0x29')]){_0x29357a[_0x82fc('0x2a')]=[{'all':!![]}];}return db[_0x82fc('0x2b')]['findAll'](_0x29357a);})['then'](function(_0x5a1b96){_0x5c2d1e[_0x82fc('0x2c')]=_0x5a1b96;return _0x5c2d1e;})[_0x82fc('0xd')](respondWithFilteredResult(_0x42b526,_0x29357a))[_0x82fc('0x2d')](handleError(_0x42b526,null));};exports[_0x82fc('0x2e')]=function(_0x474968,_0x118b2e){var _0x4c9eca={'raw':![],'where':{'id':_0x474968[_0x82fc('0x2f')]['id']}},_0x183afd={};_0x183afd[_0x82fc('0x18')]=_['keys'](db[_0x82fc('0x2b')][_0x82fc('0x14')]);_0x183afd[_0x82fc('0x1b')]=_[_0x82fc('0x1a')](_0x474968[_0x82fc('0x1b')]);_0x183afd['filters']=_['intersection'](_0x183afd['model'],_0x183afd[_0x82fc('0x1b')]);_0x4c9eca['attributes']=_[_0x82fc('0x1d')](_0x183afd['model'],qs['fields'](_0x474968['query'][_0x82fc('0x1f')]));_0x4c9eca[_0x82fc('0x1e')]=_0x4c9eca[_0x82fc('0x1e')][_0x82fc('0x20')]?_0x4c9eca[_0x82fc('0x1e')]:_0x183afd['model'];if(_0x474968[_0x82fc('0x1b')][_0x82fc('0x29')]){_0x4c9eca[_0x82fc('0x2a')]=[{'all':!![]}];}_0x4c9eca=_[_0x82fc('0x27')]({},_0x4c9eca,_0x474968['options']);return db['Dynamics365Account'][_0x82fc('0x30')](_0x4c9eca)[_0x82fc('0xd')](handleEntityNotFound(_0x118b2e,null))[_0x82fc('0xd')](respondWithResult(_0x118b2e,null))['catch'](handleError(_0x118b2e,null));};exports[_0x82fc('0x31')]=function(_0x2e5dc6,_0x405c5f){return db[_0x82fc('0x2b')]['create'](_0x2e5dc6['body'],{})['then'](respondWithResult(_0x405c5f,0xc9))[_0x82fc('0x2d')](handleError(_0x405c5f,null));};exports[_0x82fc('0xb')]=function(_0x54df01,_0x3a4b74){if(_0x54df01[_0x82fc('0x32')]['id']){delete _0x54df01['body']['id'];}return db[_0x82fc('0x2b')]['find']({'where':{'id':_0x54df01[_0x82fc('0x2f')]['id']}})[_0x82fc('0xd')](handleEntityNotFound(_0x3a4b74,null))['then'](saveUpdates(_0x54df01[_0x82fc('0x32')],null))[_0x82fc('0xd')](respondWithResult(_0x3a4b74,null))['catch'](handleError(_0x3a4b74,null));};exports['destroy']=function(_0x350872,_0x172b9f){return db[_0x82fc('0x2b')][_0x82fc('0x30')]({'where':{'id':_0x350872[_0x82fc('0x2f')]['id']}})[_0x82fc('0xd')](handleEntityNotFound(_0x172b9f,null))[_0x82fc('0xd')](removeEntity(_0x172b9f,null))['catch'](handleError(_0x172b9f,null));};exports[_0x82fc('0x33')]=function(_0x18397c,_0x535dfd){var _0x52532a={};var _0x1f7e17={};var _0x41adf7;var _0x2c7c91;return db[_0x82fc('0x2b')][_0x82fc('0x34')]({'where':{'id':_0x18397c[_0x82fc('0x2f')]['id']}})[_0x82fc('0xd')](handleEntityNotFound(_0x535dfd,null))[_0x82fc('0xd')](function(_0x116848){if(_0x116848){_0x41adf7=_0x116848;_0x1f7e17[_0x82fc('0x18')]=_[_0x82fc('0x1a')](db['Dynamics365Configuration']['rawAttributes']);_0x1f7e17[_0x82fc('0x1b')]=_['keys'](_0x18397c[_0x82fc('0x1b')]);_0x1f7e17[_0x82fc('0x1c')]=_['intersection'](_0x1f7e17[_0x82fc('0x18')],_0x1f7e17['query']);_0x52532a[_0x82fc('0x1e')]=_[_0x82fc('0x1d')](_0x1f7e17[_0x82fc('0x18')],qs['fields'](_0x18397c[_0x82fc('0x1b')][_0x82fc('0x1f')]));_0x52532a['attributes']=_0x52532a[_0x82fc('0x1e')]['length']?_0x52532a[_0x82fc('0x1e')]:_0x1f7e17[_0x82fc('0x18')];_0x52532a[_0x82fc('0x23')]=qs['sort'](_0x18397c[_0x82fc('0x1b')][_0x82fc('0x24')]);_0x52532a[_0x82fc('0x25')]=qs['filters'](_[_0x82fc('0x35')](_0x18397c[_0x82fc('0x1b')],_0x1f7e17[_0x82fc('0x1c')]));if(_0x18397c[_0x82fc('0x1b')][_0x82fc('0x26')]){_0x52532a[_0x82fc('0x25')]=_[_0x82fc('0x27')](_0x52532a[_0x82fc('0x25')],{'$or':_[_0x82fc('0x19')](_0x52532a[_0x82fc('0x1e')],function(_0x4637d8){var _0x13fead={};_0x13fead[_0x4637d8]={'$like':'%'+_0x18397c[_0x82fc('0x1b')][_0x82fc('0x26')]+'%'};return _0x13fead;})});}_0x52532a=_['merge']({},_0x52532a,_0x18397c[_0x82fc('0x28')]);return _0x41adf7[_0x82fc('0x33')](_0x52532a);}})[_0x82fc('0xd')](function(_0x294f2d){if(_0x294f2d){_0x2c7c91=_0x294f2d[_0x82fc('0x20')];if(!_0x18397c[_0x82fc('0x1b')]['hasOwnProperty'](_0x82fc('0x22'))){_0x52532a['limit']=qs[_0x82fc('0x7')](_0x18397c[_0x82fc('0x1b')][_0x82fc('0x7')]);_0x52532a[_0x82fc('0x6')]=qs[_0x82fc('0x6')](_0x18397c[_0x82fc('0x1b')][_0x82fc('0x6')]);}return _0x41adf7[_0x82fc('0x33')](_0x52532a);}})[_0x82fc('0xd')](function(_0x1656d7){if(_0x1656d7){return _0x1656d7?{'count':_0x2c7c91,'rows':_0x1656d7}:null;}})[_0x82fc('0xd')](respondWithResult(_0x535dfd,null))[_0x82fc('0x2d')](handleError(_0x535dfd,null));};exports[_0x82fc('0x36')]=function(_0x58e381,_0x4a5f4a){if(_0x58e381['body']['id']){delete _0x58e381[_0x82fc('0x32')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x58e381[_0x82fc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x4a5f4a,null))[_0x82fc('0xd')](function(_0x1325f8){if(_0x1325f8){_0x58e381[_0x82fc('0x32')][_0x82fc('0x37')]=_0x1325f8['id'];_0x58e381[_0x82fc('0x32')]['Subjects']=integrations[_0x82fc('0x38')](_0x58e381[_0x82fc('0x32')][_0x82fc('0x39')],_0x58e381['body']['type']);_0x58e381[_0x82fc('0x32')][_0x82fc('0x3a')]=integrations[_0x82fc('0x3b')](_0x58e381[_0x82fc('0x32')][_0x82fc('0x39')],_0x58e381[_0x82fc('0x32')][_0x82fc('0x16')]);return db[_0x82fc('0x3c')][_0x82fc('0x31')](_0x58e381['body'],{'include':[{'model':db[_0x82fc('0x3d')],'as':_0x82fc('0x3e')},{'model':db['Dynamics365Field'],'as':_0x82fc('0x3a')}]});}return null;})['then'](respondWithResult(_0x4a5f4a,null))[_0x82fc('0x2d')](handleError(_0x4a5f4a,null));};function sanitizeRemoteUri(_0x1b3688){var _0x2e461e=_0x1b3688[_0x82fc('0x3f')](-0x1);if(_0x2e461e==='/')return _0x1b3688[_0x82fc('0x40')](0x0,_0x1b3688[_0x82fc('0x41')](_0x2e461e));return _0x1b3688;}function getWebApiUrl(_0x4c0bd3){return util[_0x82fc('0x42')](_0x82fc('0x43'),_0x4c0bd3);}exports[_0x82fc('0x44')]=function(_0x452c27,_0x553175){var _0x3fcddc=_0x452c27['query']['ticketType'];var _0x4d1df6=_0x3fcddc===_0x82fc('0x45')?_0x82fc('0x46'):_0x82fc('0x47');var _0xf26dac='';var _0x1ec66c='';var _0xc8d6ce='';var _0x4b7b0e='';var _0x49672f='';var _0x5835cf='';var _0x17c194='';var _0x57c733='';var _0x51604a=['title',_0x82fc('0x48'),'customerid',_0x82fc('0x49'),_0x82fc('0x4a'),'subject',_0x82fc('0x4b'),_0x82fc('0x4c'),_0x82fc('0x4d'),_0x82fc('0x4e')];var _0x17d27e=[_0x82fc('0x4f'),_0x82fc('0x50'),_0x82fc('0x51'),_0x82fc('0x52'),_0x82fc('0x53'),_0x82fc('0x54'),_0x82fc('0x55'),'contractidname','createdbyexternalpartyname',_0x82fc('0x56'),_0x82fc('0x57'),_0x82fc('0x58'),_0x82fc('0x59'),_0x82fc('0x5a'),_0x82fc('0x5b'),_0x82fc('0x5c'),'customeridtype','customeridyominame',_0x82fc('0x5d'),_0x82fc('0x5e'),_0x82fc('0x5f'),_0x82fc('0x60'),'escalatedon',_0x82fc('0x61'),_0x82fc('0x62'),_0x82fc('0x63'),'importsequencenumber',_0x82fc('0x64'),_0x82fc('0x65'),_0x82fc('0x66'),_0x82fc('0x67'),'modifiedbyexternalpartyname',_0x82fc('0x68'),_0x82fc('0x69'),_0x82fc('0x6a'),'modifiedon',_0x82fc('0x6b'),_0x82fc('0x6c'),'msdyn_incidenttypename',_0x82fc('0x6d'),'numberofchildincidents',_0x82fc('0x6e'),_0x82fc('0x6f'),_0x82fc('0x70'),_0x82fc('0x71'),_0x82fc('0x72'),'parentcaseidname',_0x82fc('0x73'),_0x82fc('0x74'),_0x82fc('0x75'),_0x82fc('0x76'),'productserialnumber',_0x82fc('0x77'),'resolvebykpiidname','responseby',_0x82fc('0x78'),_0x82fc('0x79'),'sentimentvalue','slainvokedidname',_0x82fc('0x7a'),_0x82fc('0x7b'),_0x82fc('0x7c'),_0x82fc('0x7d'),_0x82fc('0x7e'),_0x82fc('0x7f'),_0x82fc('0x80'),'transactioncurrencyidname','traversedpath',_0x82fc('0x81'),'versionnumber'];var _0x47e41f=_0x51604a[_0x82fc('0x82')](_0x17d27e);return db['Dynamics365Account'][_0x82fc('0x34')]({'where':{'id':_0x452c27[_0x82fc('0x2f')]['id']},'attributes':['id',_0x82fc('0x83'),_0x82fc('0x84'),_0x82fc('0x85'),_0x82fc('0x86'),_0x82fc('0x87'),_0x82fc('0x88'),_0x82fc('0x89')],'include':[{'model':db[_0x82fc('0x8a')],'as':'CloudProvider','attributes':['id',_0x82fc('0x8b'),_0x82fc('0x8c')]}]})[_0x82fc('0xd')](handleEntityNotFound(_0x553175,null))[_0x82fc('0xd')](function(_0x31dd08){if(_0x31dd08){if(_0x31dd08[_0x82fc('0x89')]){_0x31dd08['access_token']=_0x31dd08[_0x82fc('0x8a')][_0x82fc('0x8b')];_0x57c733=sanitizeRemoteUri(_0x31dd08[_0x82fc('0x8a')][_0x82fc('0x8c')]);_0x17c194=getWebApiUrl(_0x57c733);return _0x31dd08;}_0x57c733=sanitizeRemoteUri(_0x31dd08[_0x82fc('0x85')]);_0x17c194=getWebApiUrl(_0x57c733);var _0x14098d={'method':'POST','uri':_0x82fc('0x8d')+_0x31dd08[_0x82fc('0x86')]+'/oauth2/token','form':{'client_id':_0x31dd08[_0x82fc('0x87')],'resource':_0x57c733,'username':_0x31dd08[_0x82fc('0x83')],'password':_0x31dd08[_0x82fc('0x84')],'grant_type':_0x82fc('0x84'),'client_secret':_0x31dd08[_0x82fc('0x88')]},'json':!![]};return rp(_0x14098d);}})['then'](function(_0x2c9996){_0x5835cf=_0x2c9996[_0x82fc('0x8e')];var _0x184060={'method':_0x82fc('0x8f'),'uri':encodeURI(_0x17c194+_0x82fc('0x90')+_0x4d1df6+'\x27'),'headers':{'Authorization':_0x82fc('0x91')+_0x5835cf,'If-None-Match':null,'OData-Version':_0x82fc('0x92')},'json':!![]};return rp(_0x184060);})[_0x82fc('0xd')](function(_0x422180){var _0x4c07b5=_0x422180['value'][0x0];var _0x54b616=_0x4c07b5['MetadataId'];var _0x5d3f6d={'method':_0x82fc('0x8f'),'uri':_0x17c194+_0x82fc('0x93')+_0x54b616+_0x82fc('0x94'),'headers':{'Authorization':_0x82fc('0x91')+_0x5835cf,'If-None-Match':null,'OData-Version':_0x82fc('0x92')},'json':!![]};return rp(_0x5d3f6d);})[_0x82fc('0xd')](function(_0x22c4df){_0xf26dac=_0x22c4df;_0x1ec66c=_0xf26dac[_0x82fc('0x95')];_0x1ec66c=_[_0x82fc('0x96')](_0x1ec66c,function(_0x570a6f){return!_0x47e41f[_0x82fc('0x97')](_0x570a6f[_0x82fc('0x98')]);});var _0x4fd8e2=[];var _0x460cbb=[];_0x1ec66c['forEach'](function(_0x3795ca){if(_0x3795ca[_0x82fc('0x99')]){var _0x58a91a=_0x3795ca['@odata.type'][_0x82fc('0x40')](_0x3795ca[_0x82fc('0x99')][_0x82fc('0x41')]('.')+0x1);if(_0x58a91a==='PicklistAttributeMetadata'){_0x4fd8e2['push'](getSelectList(_0x17c194,_0x3fcddc,_0x460cbb,_0xf26dac[_0x82fc('0x9a')],_0x3795ca['MetadataId'],_0x5835cf));}}});return Promise[_0x82fc('0x9b')](_0x4fd8e2);})[_0x82fc('0xd')](function(_0x3416a1){_0xc8d6ce=_0x3416a1[0x0];var _0x49fe49=[];var _0x138536=[];_0x1ec66c[_0x82fc('0x9c')](function(_0xe2b1f3){if(!_[_0x82fc('0x9d')](_0xe2b1f3[_0x82fc('0x99')])){var _0xf37e13=_0xe2b1f3[_0x82fc('0x99')][_0x82fc('0x40')](_0xe2b1f3[_0x82fc('0x99')][_0x82fc('0x41')]('.')+0x1);if(_0xf37e13===_0x82fc('0x9e')){_0x49fe49['push'](getBooleanList(_0x17c194,_0x3fcddc,_0x138536,_0xf26dac[_0x82fc('0x9a')],_0xe2b1f3[_0x82fc('0x9a')],_0x5835cf));}}});return Promise[_0x82fc('0x9b')](_0x49fe49);})[_0x82fc('0xd')](function(_0x505e28){_0x4b7b0e=_0x505e28[0x0];var _0x49d669=[];var _0x2d97f7=[];_0x1ec66c[_0x82fc('0x9c')](function(_0x51bc03){if(_0x51bc03[_0x82fc('0x99')]){var _0x5ab4bc=_0x51bc03[_0x82fc('0x99')][_0x82fc('0x40')](_0x51bc03['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ab4bc===_0x82fc('0x9f')||_0x5ab4bc===_0x82fc('0xa0')||_0x5ab4bc===_0x82fc('0xa1')||_0x5ab4bc===_0x82fc('0xa2')||_0x5ab4bc===_0x82fc('0xa3')||_0x5ab4bc===_0x82fc('0xa4')||_0x5ab4bc===_0x82fc('0xa5')||_0x5ab4bc==='EntityNameAttributeMetadata'||_0x5ab4bc==='StateAttributeMetadata'||_0x5ab4bc===_0x82fc('0xa6')){_0x49d669['push'](getInputList(_0x17c194,_0x3fcddc,_0x5ab4bc,_0x2d97f7,_0xf26dac[_0x82fc('0x9a')],_0x51bc03['MetadataId'],_0x5835cf));}}});return Promise[_0x82fc('0x9b')](_0x49d669);})[_0x82fc('0xd')](function(_0x1ffba8){_0x49672f=_0x1ffba8[0x0];var _0x980aca=_0xc8d6ce[_0x82fc('0x82')](_0x4b7b0e)[_0x82fc('0x82')](_0x49672f);var _0x3c3f85={'count':_0x980aca[_0x82fc('0x20')],'rows':_0x980aca};return _0x3c3f85;})[_0x82fc('0xd')](respondWithResult(_0x553175,null))[_0x82fc('0x2d')](function(_0x46d99a){var _0x511da2=_0x452c27[_0x82fc('0x1b')][_0x82fc('0xa7')]?0x1f4:_0x46d99a[_0x82fc('0xa8')]||0x1f4;logger[_0x82fc('0x10')](_0x46d99a[_0x82fc('0x11')]);delete _0x46d99a['name'];if(_0x511da2===0x191){_0x511da2=0x190;}_0x553175[_0x82fc('0x9')](_0x511da2)[_0x82fc('0xa9')](_0x452c27['query'][_0x82fc('0xa7')]?{'message':_0x82fc('0xaa'),'statusCode':_0x46d99a[_0x82fc('0xa8')]}:_0x46d99a);});};function getSelectList(_0x366a56,_0x1badad,_0x3e1c4b,_0x378a90,_0x2b83dc,_0xb90f85){var _0x255217={'method':_0x82fc('0x8f'),'uri':_0x366a56+_0x82fc('0x93')+_0x378a90+_0x82fc('0xab')+_0x2b83dc+_0x82fc('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x82fc('0x91')+_0xb90f85,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x255217)['then'](function(_0x5dd318){var _0x21617d=[];var _0x31339d=_0x5dd318[_0x82fc('0xad')]['Options'];_0x31339d[_0x82fc('0x9c')](function(_0x4903e1){_0x21617d[_0x82fc('0xae')]({'name':_0x4903e1[_0x82fc('0xaf')]['UserLocalizedLabel']['Label'],'value':String(_0x4903e1[_0x82fc('0xb0')])});});var _0x21a2fd={'id':_0x1badad+'_'+_0x5dd318[_0x82fc('0x98')],'name':_0x5dd318[_0x82fc('0xb1')][_0x82fc('0xb2')][_0x82fc('0xaf')],'custom':![],'options':_0x21617d};_0x3e1c4b['push'](_0x21a2fd);return _0x3e1c4b;});}function getBooleanList(_0x1801bc,_0x389b2f,_0x24a632,_0x3b6238,_0x46dc24,_0x29cd67){var _0x5372da={'method':'GET','uri':_0x1801bc+_0x82fc('0x93')+_0x3b6238+')/Attributes('+_0x46dc24+_0x82fc('0xb3'),'headers':{'Authorization':_0x82fc('0x91')+_0x29cd67,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5372da)[_0x82fc('0xd')](function(_0x3f7918){var _0x51aa8d=[];_0x51aa8d['push']({'name':_0x3f7918[_0x82fc('0xad')][_0x82fc('0xb4')][_0x82fc('0xaf')][_0x82fc('0xb2')][_0x82fc('0xaf')],'value':_0x82fc('0xb5')},{'name':_0x3f7918[_0x82fc('0xad')]['FalseOption'][_0x82fc('0xaf')][_0x82fc('0xb2')][_0x82fc('0xaf')],'value':_0x82fc('0xb6')});var _0x20d2a2={'id':_0x389b2f+'_'+_0x3f7918[_0x82fc('0x98')],'name':_0x3f7918[_0x82fc('0xb1')]['UserLocalizedLabel'][_0x82fc('0xaf')],'custom':![],'options':_0x51aa8d};_0x24a632[_0x82fc('0xae')](_0x20d2a2);return _0x24a632;});}function getInputList(_0x3ab48b,_0x56cbf4,_0x5610bf,_0x2bd764,_0x504665,_0x4ec12c,_0x1eb701){var _0x107342={'method':_0x82fc('0x8f'),'uri':_0x3ab48b+_0x82fc('0x93')+_0x504665+_0x82fc('0xab')+_0x4ec12c+_0x82fc('0xb7')+_0x5610bf+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x1eb701,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x107342)[_0x82fc('0xd')](function(_0x4493fe){var _0x1df6a3={'id':_0x56cbf4+'_'+_0x4493fe['LogicalName'],'name':_0x4493fe['DisplayName'][_0x82fc('0xb2')]?_0x4493fe[_0x82fc('0xb1')]['UserLocalizedLabel'][_0x82fc('0xaf')]:_0x4493fe[_0x82fc('0x98')],'custom':![],'options':[]};_0x2bd764[_0x82fc('0xae')](_0x1df6a3);return _0x2bd764;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e9f24bb..6b96bd2 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(_0x5ab6ba,_0x136067){var _0x4619be=function(_0x2a4e60){while(--_0x2a4e60){_0x5ab6ba['push'](_0x5ab6ba['shift']());}};_0x4619be(++_0x136067);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 7ed7908..c5d8a91 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 _0xeaf8=['stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','limit','include','map','model','attributes','debug','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x6daaf1,_0x31b49e){var _0x357b68=function(_0x1926c2){while(--_0x1926c2){_0x6daaf1['push'](_0x6daaf1['shift']());}};_0x357b68(++_0x31b49e);}(_0xeaf8,0xed));var _0x8eaf=function(_0x335df6,_0x315516){_0x335df6=_0x335df6-0x0;var _0x402351=_0xeaf8[_0x335df6];return _0x402351;};'use strict';var _=require(_0x8eaf('0x0'));var util=require(_0x8eaf('0x1'));var moment=require(_0x8eaf('0x2'));var BPromise=require(_0x8eaf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8eaf('0x4'));var db=require(_0x8eaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8eaf('0x6'));var config=require(_0x8eaf('0x7'));var jayson=require(_0x8eaf('0x8'));var client=jayson[_0x8eaf('0x9')][_0x8eaf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25a5f2,_0x22d11b,_0x46edab){return new BPromise(function(_0x5f1a8e,_0x599e98){return client['request'](_0x25a5f2,_0x46edab)[_0x8eaf('0xb')](function(_0x384289){logger[_0x8eaf('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x8eaf('0xd'));logger['debug'](_0x8eaf('0xe'),_0x22d11b,_0x8eaf('0xd'),JSON[_0x8eaf('0xf')](_0x384289));if(_0x384289[_0x8eaf('0x10')]){if(_0x384289[_0x8eaf('0x10')][_0x8eaf('0x11')]===0x1f4){logger[_0x8eaf('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x384289['error']['message']);return _0x599e98(_0x384289['error'][_0x8eaf('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x384289[_0x8eaf('0x10')][_0x8eaf('0x12')]);return _0x5f1a8e(_0x384289[_0x8eaf('0x10')][_0x8eaf('0x12')]);}else{logger['info'](_0x8eaf('0x13'),_0x22d11b,_0x8eaf('0xd'));_0x5f1a8e(_0x384289[_0x8eaf('0x14')][_0x8eaf('0x12')]);}})[_0x8eaf('0x15')](function(_0x596814){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x22d11b,_0x596814);_0x599e98(_0x596814);});});}exports[_0x8eaf('0x16')]=function(_0x4fe13e){var _0x125717=this;return new Promise(function(_0xbbc0a,_0x54e326){return db[_0x8eaf('0x17')][_0x8eaf('0x18')]({'raw':_0x4fe13e['options']?_0x4fe13e[_0x8eaf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4fe13e['options']?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1a')]||null:null,'attributes':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')]['attributes']||null:null,'limit':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1b')]||null:null,'include':_0x4fe13e[_0x8eaf('0x19')]?_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x4fe13e[_0x8eaf('0x19')][_0x8eaf('0x1c')],function(_0x4ead91){return{'model':db[_0x4ead91['model']],'as':_0x4ead91['as'],'attributes':_0x4ead91['attributes'],'include':_0x4ead91[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x4ead91[_0x8eaf('0x1c')],function(_0x3bbcf3){return{'model':db[_0x3bbcf3[_0x8eaf('0x1e')]],'as':_0x3bbcf3['as'],'attributes':_0x3bbcf3[_0x8eaf('0x1f')],'include':_0x3bbcf3[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x3bbcf3[_0x8eaf('0x1c')],function(_0x29d56a){return{'model':db[_0x29d56a[_0x8eaf('0x1e')]],'as':_0x29d56a['as'],'attributes':_0x29d56a[_0x8eaf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8eaf('0xb')](function(_0x2bcdac){logger[_0x8eaf('0xc')]('GetDynamics365Account',_0x4fe13e);logger[_0x8eaf('0x20')](_0x8eaf('0x16'),_0x4fe13e,JSON[_0x8eaf('0xf')](_0x2bcdac));_0xbbc0a(_0x2bcdac);})[_0x8eaf('0x15')](function(_0x3875cc){logger['error'](_0x8eaf('0x16'),_0x3875cc[_0x8eaf('0x12')],_0x4fe13e);_0x54e326(_0x125717[_0x8eaf('0x10')](0x1f4,_0x3875cc['message']));});});};exports[_0x8eaf('0x21')]=function(_0x20314d){var _0x389fb1=this;return new Promise(function(_0x4378ef,_0x1725c3){return db[_0x8eaf('0x17')][_0x8eaf('0x22')]({'raw':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x23')]===undefined?!![]:![]:!![],'where':_0x20314d['options']?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1a')]||null:null,'attributes':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1f')]||null:null,'include':_0x20314d[_0x8eaf('0x19')]?_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x20314d[_0x8eaf('0x19')][_0x8eaf('0x1c')],function(_0x35ce08){return{'model':db[_0x35ce08[_0x8eaf('0x1e')]],'as':_0x35ce08['as'],'attributes':_0x35ce08[_0x8eaf('0x1f')],'include':_0x35ce08[_0x8eaf('0x1c')]?_['map'](_0x35ce08[_0x8eaf('0x1c')],function(_0x5078eb){return{'model':db[_0x5078eb[_0x8eaf('0x1e')]],'as':_0x5078eb['as'],'attributes':_0x5078eb[_0x8eaf('0x1f')],'include':_0x5078eb[_0x8eaf('0x1c')]?_[_0x8eaf('0x1d')](_0x5078eb[_0x8eaf('0x1c')],function(_0x2f7262){return{'model':db[_0x2f7262[_0x8eaf('0x1e')]],'as':_0x2f7262['as'],'attributes':_0x2f7262[_0x8eaf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d6186){logger[_0x8eaf('0xc')](_0x8eaf('0x21'),_0x20314d);logger['debug']('ShowDynamics365Account',_0x20314d,JSON[_0x8eaf('0xf')](_0x2d6186));_0x4378ef(_0x2d6186);})['catch'](function(_0x4b8f33){logger[_0x8eaf('0x10')](_0x8eaf('0x21'),_0x4b8f33['message'],_0x20314d);_0x1725c3(_0x389fb1[_0x8eaf('0x10')](0x1f4,_0x4b8f33[_0x8eaf('0x12')]));});});}; \ No newline at end of file +var _0x57b5=['where','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','map','include','model','catch','ShowDynamics365Account'];(function(_0x4d7912,_0x468bde){var _0x5969c2=function(_0x4fab39){while(--_0x4fab39){_0x4d7912['push'](_0x4d7912['shift']());}};_0x5969c2(++_0x468bde);}(_0x57b5,0x1bc));var _0x557b=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x57b5[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require('lodash');var util=require(_0x557b('0x0'));var moment=require(_0x557b('0x1'));var BPromise=require(_0x557b('0x2'));var rs=require(_0x557b('0x3'));var fs=require('fs');var Redis=require(_0x557b('0x4'));var db=require(_0x557b('0x5'))['db'];var utils=require(_0x557b('0x6'));var logger=require(_0x557b('0x7'))('rpc');var config=require(_0x557b('0x8'));var jayson=require(_0x557b('0x9'));var client=jayson[_0x557b('0xa')][_0x557b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b9177,_0x325736,_0x229fd5){return new BPromise(function(_0x47611e,_0xa04062){return client['request'](_0x1b9177,_0x229fd5)[_0x557b('0xc')](function(_0x3895a2){logger['info'](_0x557b('0xd'),_0x325736,'request\x20sent');logger[_0x557b('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x325736,_0x557b('0xf'),JSON[_0x557b('0x10')](_0x3895a2));if(_0x3895a2[_0x557b('0x11')]){if(_0x3895a2[_0x557b('0x11')][_0x557b('0x12')]===0x1f4){logger['error'](_0x557b('0xd'),_0x325736,_0x3895a2[_0x557b('0x11')][_0x557b('0x13')]);return _0xa04062(_0x3895a2[_0x557b('0x11')][_0x557b('0x13')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x325736,_0x3895a2[_0x557b('0x11')]['message']);return _0x47611e(_0x3895a2[_0x557b('0x11')][_0x557b('0x13')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x325736,_0x557b('0xf'));_0x47611e(_0x3895a2['result']['message']);}})['catch'](function(_0x2ee76b){logger['error'](_0x557b('0xd'),_0x325736,_0x2ee76b);_0xa04062(_0x2ee76b);});});}exports[_0x557b('0x14')]=function(_0x439c73){var _0x174917=this;return new Promise(function(_0x6e11b7,_0x3d7a41){return db[_0x557b('0x15')][_0x557b('0x16')]({'raw':_0x439c73[_0x557b('0x17')]?_0x439c73[_0x557b('0x17')][_0x557b('0x18')]===undefined?!![]:![]:!![],'where':_0x439c73['options']?_0x439c73[_0x557b('0x17')]['where']||null:null,'attributes':_0x439c73[_0x557b('0x17')]?_0x439c73[_0x557b('0x17')][_0x557b('0x19')]||null:null,'limit':_0x439c73[_0x557b('0x17')]?_0x439c73[_0x557b('0x17')][_0x557b('0x1a')]||null:null,'include':_0x439c73[_0x557b('0x17')]?_0x439c73[_0x557b('0x17')]['include']?_[_0x557b('0x1b')](_0x439c73['options'][_0x557b('0x1c')],function(_0x207daf){return{'model':db[_0x207daf[_0x557b('0x1d')]],'as':_0x207daf['as'],'attributes':_0x207daf[_0x557b('0x19')],'include':_0x207daf[_0x557b('0x1c')]?_[_0x557b('0x1b')](_0x207daf[_0x557b('0x1c')],function(_0x583902){return{'model':db[_0x583902['model']],'as':_0x583902['as'],'attributes':_0x583902[_0x557b('0x19')],'include':_0x583902[_0x557b('0x1c')]?_['map'](_0x583902[_0x557b('0x1c')],function(_0x43e3e0){return{'model':db[_0x43e3e0[_0x557b('0x1d')]],'as':_0x43e3e0['as'],'attributes':_0x43e3e0[_0x557b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x557b('0xc')](function(_0x14860c){logger['info']('GetDynamics365Account',_0x439c73);logger[_0x557b('0xe')](_0x557b('0x14'),_0x439c73,JSON[_0x557b('0x10')](_0x14860c));_0x6e11b7(_0x14860c);})[_0x557b('0x1e')](function(_0x164d51){logger[_0x557b('0x11')](_0x557b('0x14'),_0x164d51[_0x557b('0x13')],_0x439c73);_0x3d7a41(_0x174917['error'](0x1f4,_0x164d51[_0x557b('0x13')]));});});};exports[_0x557b('0x1f')]=function(_0xb34a22){var _0x3acfda=this;return new Promise(function(_0x3290ed,_0x4c6d7c){return db[_0x557b('0x15')]['find']({'raw':_0xb34a22['options']?_0xb34a22[_0x557b('0x17')][_0x557b('0x18')]===undefined?!![]:![]:!![],'where':_0xb34a22[_0x557b('0x17')]?_0xb34a22[_0x557b('0x17')][_0x557b('0x20')]||null:null,'attributes':_0xb34a22['options']?_0xb34a22[_0x557b('0x17')][_0x557b('0x19')]||null:null,'include':_0xb34a22[_0x557b('0x17')]?_0xb34a22['options']['include']?_[_0x557b('0x1b')](_0xb34a22[_0x557b('0x17')][_0x557b('0x1c')],function(_0x47f1ce){return{'model':db[_0x47f1ce['model']],'as':_0x47f1ce['as'],'attributes':_0x47f1ce['attributes'],'include':_0x47f1ce[_0x557b('0x1c')]?_[_0x557b('0x1b')](_0x47f1ce[_0x557b('0x1c')],function(_0x107375){return{'model':db[_0x107375['model']],'as':_0x107375['as'],'attributes':_0x107375[_0x557b('0x19')],'include':_0x107375[_0x557b('0x1c')]?_[_0x557b('0x1b')](_0x107375[_0x557b('0x1c')],function(_0x4c3874){return{'model':db[_0x4c3874[_0x557b('0x1d')]],'as':_0x4c3874['as'],'attributes':_0x4c3874['attributes']};}):[]};}):[]};}):[]:[]})[_0x557b('0xc')](function(_0x283d66){logger[_0x557b('0x21')](_0x557b('0x1f'),_0xb34a22);logger[_0x557b('0xe')](_0x557b('0x1f'),_0xb34a22,JSON[_0x557b('0x10')](_0x283d66));_0x3290ed(_0x283d66);})[_0x557b('0x1e')](function(_0x3affca){logger[_0x557b('0x11')](_0x557b('0x1f'),_0x3affca[_0x557b('0x13')],_0xb34a22);_0x4c6d7c(_0x3acfda[_0x557b('0x11')](0x1f4,_0x3affca[_0x557b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index c798f64..998bb1f 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 _0x02a7=['getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','/:id','isAuthenticated','getFields','get'];(function(_0xbe81f3,_0xe85e69){var _0x2b67c3=function(_0x5b988b){while(--_0x5b988b){_0xbe81f3['push'](_0xbe81f3['shift']());}};_0x2b67c3(++_0xe85e69);}(_0x02a7,0x1a6));var _0x702a=function(_0xe84df0,_0x591f72){_0xe84df0=_0xe84df0-0x0;var _0x110852=_0x02a7[_0xe84df0];return _0x110852;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require(_0x702a('0x1'));var timeout=require(_0x702a('0x2'));var express=require(_0x702a('0x3'));var router=express[_0x702a('0x4')]();var fs_extra=require(_0x702a('0x5'));var auth=require(_0x702a('0x6'));var interaction=require(_0x702a('0x7'));var config=require(_0x702a('0x8'));var controller=require(_0x702a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x702a('0xa')]);router['get'](_0x702a('0xb'),auth[_0x702a('0xc')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x702a('0xd')]);router[_0x702a('0xe')]('/:id/subjects',auth[_0x702a('0xc')](),controller[_0x702a('0xf')]);router[_0x702a('0xe')](_0x702a('0x10'),auth[_0x702a('0xc')](),controller[_0x702a('0x11')]);router[_0x702a('0x12')]('/',auth[_0x702a('0xc')](),controller['create']);router[_0x702a('0x13')](_0x702a('0xb'),auth[_0x702a('0xc')](),controller[_0x702a('0x14')]);router['delete'](_0x702a('0xb'),auth[_0x702a('0xc')](),controller[_0x702a('0x15')]);module[_0x702a('0x16')]=router; \ No newline at end of file +var _0x11d3=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2199a0,_0x3891da){var _0x3684aa=function(_0x1f08e4){while(--_0x1f08e4){_0x2199a0['push'](_0x2199a0['shift']());}};_0x3684aa(++_0x3891da);}(_0x11d3,0x1ac));var _0x311d=function(_0x4b0388,_0x3749fb){_0x4b0388=_0x4b0388-0x0;var _0x5c3406=_0x11d3[_0x4b0388];return _0x5c3406;};'use strict';var multer=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var path=require(_0x311d('0x2'));var timeout=require(_0x311d('0x3'));var express=require(_0x311d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x311d('0x5'));var interaction=require(_0x311d('0x6'));var config=require(_0x311d('0x7'));var controller=require(_0x311d('0x8'));router[_0x311d('0x9')]('/',auth[_0x311d('0xa')](),controller[_0x311d('0xb')]);router[_0x311d('0x9')](_0x311d('0xc'),auth['isAuthenticated'](),controller[_0x311d('0xd')]);router[_0x311d('0x9')](_0x311d('0xe'),auth[_0x311d('0xa')](),controller['getFields']);router[_0x311d('0x9')](_0x311d('0xf'),auth[_0x311d('0xa')](),controller[_0x311d('0x10')]);router['get'](_0x311d('0x11'),auth[_0x311d('0xa')](),controller[_0x311d('0x12')]);router[_0x311d('0x13')]('/',auth[_0x311d('0xa')](),controller[_0x311d('0x14')]);router[_0x311d('0x15')](_0x311d('0xc'),auth[_0x311d('0xa')](),controller[_0x311d('0x16')]);router[_0x311d('0x17')](_0x311d('0xc'),auth[_0x311d('0xa')](),controller[_0x311d('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 42bc53b..2776256 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 _0xde95=['ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0xde95,0x1ad));var _0x5de9=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xde95[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0x5de9('0x0'));module[_0x5de9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5de9('0x2')]},'ticketType':{'type':Sequelize[_0x5de9('0x3')](_0x5de9('0x4'),_0x5de9('0x5')),'defaultValue':_0x5de9('0x4')},'moduleCreate':{'type':Sequelize[_0x5de9('0x3')](_0x5de9('0x6'),_0x5de9('0x7')),'defaultValue':_0x5de9('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5de9('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc54d=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x4af138,_0x300b82){var _0x15f3e4=function(_0x51684f){while(--_0x51684f){_0x4af138['push'](_0x4af138['shift']());}};_0x15f3e4(++_0x300b82);}(_0xc54d,0xca));var _0xdc54=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0xc54d[_0x34e46d];return _0x1cc6aa;};'use strict';var Sequelize=require(_0xdc54('0x0'));module[_0xdc54('0x1')]={'name':{'type':Sequelize[_0xdc54('0x2')]},'description':{'type':Sequelize[_0xdc54('0x2')]},'ticketType':{'type':Sequelize[_0xdc54('0x3')](_0xdc54('0x4'),_0xdc54('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xdc54('0x3')](_0xdc54('0x6'),_0xdc54('0x7')),'defaultValue':_0xdc54('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xdc54('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xdc54('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4afe732..c1363f8 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 _0xe4c5=['end','status','json','undefined','offset','count','reject','save','then','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','include','rows','catch','show','params','keys','includeAll','options','find','create','body','update','destroy','getFields','length','order','getSubjects','findOne','Dynamics365Field','hasOwnProperty','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x39853d,_0x2501bf){var _0x5864ca=function(_0xbc99d5){while(--_0xbc99d5){_0x39853d['push'](_0x39853d['shift']());}};_0x5864ca(++_0x2501bf);}(_0xe4c5,0x11b));var _0x5e4c=function(_0x24c886,_0x67c5c0){_0x24c886=_0x24c886-0x0;var _0x3f1c8b=_0xe4c5[_0x24c886];return _0x3f1c8b;};'use strict';var emlformat=require(_0x5e4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5e4c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5e4c('0x2'));var Mustache=require(_0x5e4c('0x3'));var util=require('util');var path=require(_0x5e4c('0x4'));var sox=require('sox');var csv=require(_0x5e4c('0x5'));var ejs=require(_0x5e4c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e4c('0x7'));var squel=require('squel');var crypto=require(_0x5e4c('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e4c('0x5'));var querystring=require(_0x5e4c('0x9'));var Papa=require(_0x5e4c('0xa'));var Redis=require(_0x5e4c('0xb'));var authService=require(_0x5e4c('0xc'));var qs=require(_0x5e4c('0xd'));var as=require(_0x5e4c('0xe'));var hardwareService=require(_0x5e4c('0xf'));var logger=require(_0x5e4c('0x10'))(_0x5e4c('0x11'));var utils=require(_0x5e4c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5e4c('0x13'));var db=require(_0x5e4c('0x14'))['db'];function respondWithStatusCode(_0x1b109f,_0x25bfdb){_0x25bfdb=_0x25bfdb||0xcc;return function(_0x471af6){if(_0x471af6){return _0x1b109f['sendStatus'](_0x25bfdb);}return _0x1b109f['status'](_0x25bfdb)[_0x5e4c('0x15')]();};}function respondWithResult(_0x3daabe,_0x1a6623){_0x1a6623=_0x1a6623||0xc8;return function(_0x1baf40){if(_0x1baf40){return _0x3daabe[_0x5e4c('0x16')](_0x1a6623)[_0x5e4c('0x17')](_0x1baf40);}};}function respondWithFilteredResult(_0x40d3c4,_0x19003f){return function(_0x4d17d3){if(_0x4d17d3){var _0x221b46=typeof _0x19003f['offset']===_0x5e4c('0x18')&&typeof _0x19003f['limit']===_0x5e4c('0x18');var _0x1c327e=_0x4d17d3['count'];var _0x4bc168=_0x221b46?0x0:_0x19003f[_0x5e4c('0x19')];var _0x4e318c=_0x221b46?_0x4d17d3[_0x5e4c('0x1a')]:_0x19003f['offset']+_0x19003f['limit'];var _0x55e100;if(_0x4e318c>=_0x1c327e){_0x4e318c=_0x1c327e;_0x55e100=0xc8;}else{_0x55e100=0xce;}_0x40d3c4[_0x5e4c('0x16')](_0x55e100);return _0x40d3c4['set']('Content-Range',_0x4bc168+'-'+_0x4e318c+'/'+_0x1c327e)['json'](_0x4d17d3);}return null;};}function patchUpdates(_0x23d838){return function(_0x4ae561){try{jsonpatch['apply'](_0x4ae561,_0x23d838,!![]);}catch(_0x5ab268){return BPromise[_0x5e4c('0x1b')](_0x5ab268);}return _0x4ae561[_0x5e4c('0x1c')]();};}function saveUpdates(_0x5b8a6a,_0x4623b3){return function(_0x5ba482){if(_0x5ba482){return _0x5ba482['update'](_0x5b8a6a)[_0x5e4c('0x1d')](function(_0x4cd436){return _0x4cd436;});}return null;};}function removeEntity(_0x1156ea,_0x28630a){return function(_0x51886c){if(_0x51886c){return _0x51886c['destroy']()[_0x5e4c('0x1d')](function(){_0x1156ea[_0x5e4c('0x16')](0xcc)[_0x5e4c('0x15')]();});}};}function handleEntityNotFound(_0x577bb1,_0x40d795){return function(_0x5e0744){if(!_0x5e0744){_0x577bb1[_0x5e4c('0x1e')](0x194);}return _0x5e0744;};}function handleError(_0x29fee0,_0x482f2e){_0x482f2e=_0x482f2e||0x1f4;return function(_0x48b331){logger['error'](_0x48b331[_0x5e4c('0x1f')]);if(_0x48b331[_0x5e4c('0x20')]){delete _0x48b331[_0x5e4c('0x20')];}_0x29fee0[_0x5e4c('0x16')](_0x482f2e)[_0x5e4c('0x21')](_0x48b331);};}exports[_0x5e4c('0x22')]=function(_0xe10d46,_0x316fae){var _0x525bdd={},_0x1c379a={},_0xa824db={'count':0x0,'rows':[]};var _0x279354=_['map'](db[_0x5e4c('0x23')][_0x5e4c('0x24')],function(_0x8ae35f){return{'name':_0x8ae35f[_0x5e4c('0x25')],'type':_0x8ae35f[_0x5e4c('0x26')][_0x5e4c('0x27')]};});_0x1c379a[_0x5e4c('0x28')]=_[_0x5e4c('0x29')](_0x279354,'name');_0x1c379a['query']=_['keys'](_0xe10d46[_0x5e4c('0x2a')]);_0x1c379a[_0x5e4c('0x2b')]=_[_0x5e4c('0x2c')](_0x1c379a[_0x5e4c('0x28')],_0x1c379a[_0x5e4c('0x2a')]);_0x525bdd['attributes']=_[_0x5e4c('0x2c')](_0x1c379a[_0x5e4c('0x28')],qs[_0x5e4c('0x2d')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x525bdd[_0x5e4c('0x2e')]=_0x525bdd[_0x5e4c('0x2e')]['length']?_0x525bdd[_0x5e4c('0x2e')]:_0x1c379a[_0x5e4c('0x28')];if(!_0xe10d46['query']['hasOwnProperty'](_0x5e4c('0x2f'))){_0x525bdd['limit']=qs['limit'](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x30')]);_0x525bdd['offset']=qs[_0x5e4c('0x19')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}_0x525bdd['order']=qs[_0x5e4c('0x31')](_0xe10d46[_0x5e4c('0x2a')][_0x5e4c('0x31')]);_0x525bdd['where']=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0xe10d46[_0x5e4c('0x2a')],_0x1c379a['filters']),_0x279354);if(_0xe10d46['query'][_0x5e4c('0x33')]){_0x525bdd[_0x5e4c('0x34')]=_['merge'](_0x525bdd[_0x5e4c('0x34')],{'$or':_['map'](_0x279354,function(_0x34f6ed){if(_0x34f6ed[_0x5e4c('0x26')]!==_0x5e4c('0x35')){var _0x515652={};_0x515652[_0x34f6ed[_0x5e4c('0x20')]]={'$like':'%'+_0xe10d46['query'][_0x5e4c('0x33')]+'%'};return _0x515652;}})});}_0x525bdd=_[_0x5e4c('0x36')]({},_0x525bdd,_0xe10d46['options']);var _0x1dc897={'where':_0x525bdd['where']};return db['Dynamics365Configuration'][_0x5e4c('0x1a')](_0x1dc897)[_0x5e4c('0x1d')](function(_0x5a3e72){_0xa824db[_0x5e4c('0x1a')]=_0x5a3e72;if(_0xe10d46[_0x5e4c('0x2a')]['includeAll']){_0x525bdd[_0x5e4c('0x37')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x525bdd);})[_0x5e4c('0x1d')](function(_0x51a033){_0xa824db[_0x5e4c('0x38')]=_0x51a033;return _0xa824db;})[_0x5e4c('0x1d')](respondWithFilteredResult(_0x316fae,_0x525bdd))[_0x5e4c('0x39')](handleError(_0x316fae,null));};exports[_0x5e4c('0x3a')]=function(_0x3dd32a,_0x50a2ae){var _0x56e030={'raw':![],'where':{'id':_0x3dd32a[_0x5e4c('0x3b')]['id']}},_0x3fa116={};_0x3fa116['model']=_[_0x5e4c('0x3c')](db['Dynamics365Configuration'][_0x5e4c('0x24')]);_0x3fa116['query']=_[_0x5e4c('0x3c')](_0x3dd32a['query']);_0x3fa116['filters']=_[_0x5e4c('0x2c')](_0x3fa116['model'],_0x3fa116[_0x5e4c('0x2a')]);_0x56e030[_0x5e4c('0x2e')]=_[_0x5e4c('0x2c')](_0x3fa116['model'],qs['fields'](_0x3dd32a[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x56e030[_0x5e4c('0x2e')]=_0x56e030[_0x5e4c('0x2e')]['length']?_0x56e030[_0x5e4c('0x2e')]:_0x3fa116[_0x5e4c('0x28')];if(_0x3dd32a['query'][_0x5e4c('0x3d')]){_0x56e030[_0x5e4c('0x37')]=[{'all':!![]}];}_0x56e030=_[_0x5e4c('0x36')]({},_0x56e030,_0x3dd32a[_0x5e4c('0x3e')]);return db[_0x5e4c('0x23')][_0x5e4c('0x3f')](_0x56e030)[_0x5e4c('0x1d')](handleEntityNotFound(_0x50a2ae,null))['then'](respondWithResult(_0x50a2ae,null))[_0x5e4c('0x39')](handleError(_0x50a2ae,null));};exports[_0x5e4c('0x40')]=function(_0x3bbc27,_0x2bc4bc){return db[_0x5e4c('0x23')][_0x5e4c('0x40')](_0x3bbc27[_0x5e4c('0x41')],{})[_0x5e4c('0x1d')](respondWithResult(_0x2bc4bc,0xc9))[_0x5e4c('0x39')](handleError(_0x2bc4bc,null));};exports[_0x5e4c('0x42')]=function(_0x4555b4,_0x318022){if(_0x4555b4['body']['id']){delete _0x4555b4[_0x5e4c('0x41')]['id'];}return db['Dynamics365Configuration'][_0x5e4c('0x3f')]({'where':{'id':_0x4555b4[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x318022,null))[_0x5e4c('0x1d')](saveUpdates(_0x4555b4['body'],null))['then'](respondWithResult(_0x318022,null))[_0x5e4c('0x39')](handleError(_0x318022,null));};exports[_0x5e4c('0x43')]=function(_0x500382,_0x5b8705){return db[_0x5e4c('0x23')][_0x5e4c('0x3f')]({'where':{'id':_0x500382[_0x5e4c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5b8705,null))[_0x5e4c('0x1d')](removeEntity(_0x5b8705,null))[_0x5e4c('0x39')](handleError(_0x5b8705,null));};exports[_0x5e4c('0x44')]=function(_0x15ae8c,_0x2968e5,_0x1a7f49){var _0x34b16f={};var _0x36b87a={};var _0x4e5898;var _0x289f8e;return db[_0x5e4c('0x23')]['findOne']({'where':{'id':_0x15ae8c['params']['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x2968e5,null))[_0x5e4c('0x1d')](function(_0xe5b876){if(_0xe5b876){_0x4e5898=_0xe5b876;_0x36b87a['model']=_[_0x5e4c('0x3c')](db['Dynamics365Field']['rawAttributes']);_0x36b87a[_0x5e4c('0x2a')]=_[_0x5e4c('0x3c')](_0x15ae8c[_0x5e4c('0x2a')]);_0x36b87a[_0x5e4c('0x2b')]=_[_0x5e4c('0x2c')](_0x36b87a['model'],_0x36b87a[_0x5e4c('0x2a')]);_0x34b16f['attributes']=_[_0x5e4c('0x2c')](_0x36b87a[_0x5e4c('0x28')],qs[_0x5e4c('0x2d')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x34b16f[_0x5e4c('0x2e')]=_0x34b16f[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x34b16f[_0x5e4c('0x2e')]:_0x36b87a[_0x5e4c('0x28')];_0x34b16f[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x31')]);_0x34b16f['where']=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0x15ae8c[_0x5e4c('0x2a')],_0x36b87a[_0x5e4c('0x2b')]));if(_0x15ae8c[_0x5e4c('0x2a')]['filter']){_0x34b16f[_0x5e4c('0x34')]=_['merge'](_0x34b16f[_0x5e4c('0x34')],{'$or':_[_0x5e4c('0x29')](_0x34b16f[_0x5e4c('0x2e')],function(_0x2324cc){var _0x22d579={};_0x22d579[_0x2324cc]={'$like':'%'+_0x15ae8c[_0x5e4c('0x2a')]['filter']+'%'};return _0x22d579;})});}_0x34b16f=_[_0x5e4c('0x36')]({},_0x34b16f,_0x15ae8c[_0x5e4c('0x3e')]);return _0x4e5898['getFields'](_0x34b16f);}})[_0x5e4c('0x1d')](function(_0x29baea){if(_0x29baea){_0x289f8e=_0x29baea[_0x5e4c('0x45')];if(!_0x15ae8c[_0x5e4c('0x2a')]['hasOwnProperty']('nolimit')){_0x34b16f['limit']=qs[_0x5e4c('0x30')](_0x15ae8c[_0x5e4c('0x2a')]['limit']);_0x34b16f[_0x5e4c('0x19')]=qs[_0x5e4c('0x19')](_0x15ae8c[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}return _0x4e5898[_0x5e4c('0x44')](_0x34b16f);}})['then'](function(_0x33a8c7){if(_0x33a8c7){return _0x33a8c7?{'count':_0x289f8e,'rows':_0x33a8c7}:null;}})['then'](respondWithResult(_0x2968e5,null))['catch'](handleError(_0x2968e5,null));};exports[_0x5e4c('0x47')]=function(_0x1ab08f,_0x2c1c2e,_0x257857){var _0x38643b={};var _0x3ec05f={};var _0x3f8232;var _0x7075af;return db['Dynamics365Configuration'][_0x5e4c('0x48')]({'where':{'id':_0x1ab08f[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x2c1c2e,null))[_0x5e4c('0x1d')](function(_0x128c53){if(_0x128c53){_0x3f8232=_0x128c53;_0x3ec05f['model']=_[_0x5e4c('0x3c')](db[_0x5e4c('0x49')]['rawAttributes']);_0x3ec05f[_0x5e4c('0x2a')]=_[_0x5e4c('0x3c')](_0x1ab08f[_0x5e4c('0x2a')]);_0x3ec05f[_0x5e4c('0x2b')]=_['intersection'](_0x3ec05f[_0x5e4c('0x28')],_0x3ec05f['query']);_0x38643b[_0x5e4c('0x2e')]=_['intersection'](_0x3ec05f['model'],qs[_0x5e4c('0x2d')](_0x1ab08f[_0x5e4c('0x2a')]['fields']));_0x38643b[_0x5e4c('0x2e')]=_0x38643b[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x38643b['attributes']:_0x3ec05f[_0x5e4c('0x28')];_0x38643b[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x1ab08f[_0x5e4c('0x2a')]['sort']);_0x38643b[_0x5e4c('0x34')]=qs[_0x5e4c('0x2b')](_[_0x5e4c('0x32')](_0x1ab08f['query'],_0x3ec05f['filters']));if(_0x1ab08f['query'][_0x5e4c('0x33')]){_0x38643b[_0x5e4c('0x34')]=_[_0x5e4c('0x36')](_0x38643b[_0x5e4c('0x34')],{'$or':_[_0x5e4c('0x29')](_0x38643b[_0x5e4c('0x2e')],function(_0x29bbfc){var _0x3c214c={};_0x3c214c[_0x29bbfc]={'$like':'%'+_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x33')]+'%'};return _0x3c214c;})});}_0x38643b=_[_0x5e4c('0x36')]({},_0x38643b,_0x1ab08f['options']);return _0x3f8232[_0x5e4c('0x47')](_0x38643b);}})['then'](function(_0x8cee10){if(_0x8cee10){_0x7075af=_0x8cee10[_0x5e4c('0x45')];if(!_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x4a')]('nolimit')){_0x38643b['limit']=qs[_0x5e4c('0x30')](_0x1ab08f[_0x5e4c('0x2a')][_0x5e4c('0x30')]);_0x38643b[_0x5e4c('0x19')]=qs['offset'](_0x1ab08f[_0x5e4c('0x2a')]['offset']);}return _0x3f8232[_0x5e4c('0x47')](_0x38643b);}})[_0x5e4c('0x1d')](function(_0x461109){if(_0x461109){return _0x461109?{'count':_0x7075af,'rows':_0x461109}:null;}})[_0x5e4c('0x1d')](respondWithResult(_0x2c1c2e,null))[_0x5e4c('0x39')](handleError(_0x2c1c2e,null));};exports['getDescriptions']=function(_0x4c1327,_0x55bf68,_0x409c13){var _0x3ff4a2={};var _0xec9791={};var _0x495428;var _0xbe8186;return db[_0x5e4c('0x23')][_0x5e4c('0x48')]({'where':{'id':_0x4c1327[_0x5e4c('0x3b')]['id']}})[_0x5e4c('0x1d')](handleEntityNotFound(_0x55bf68,null))[_0x5e4c('0x1d')](function(_0xe930f7){if(_0xe930f7){_0x495428=_0xe930f7;_0xec9791[_0x5e4c('0x28')]=_[_0x5e4c('0x3c')](db[_0x5e4c('0x49')][_0x5e4c('0x24')]);_0xec9791['query']=_[_0x5e4c('0x3c')](_0x4c1327['query']);_0xec9791['filters']=_[_0x5e4c('0x2c')](_0xec9791[_0x5e4c('0x28')],_0xec9791['query']);_0x3ff4a2[_0x5e4c('0x2e')]=_[_0x5e4c('0x2c')](_0xec9791['model'],qs[_0x5e4c('0x2d')](_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x2d')]));_0x3ff4a2[_0x5e4c('0x2e')]=_0x3ff4a2[_0x5e4c('0x2e')][_0x5e4c('0x45')]?_0x3ff4a2['attributes']:_0xec9791['model'];_0x3ff4a2[_0x5e4c('0x46')]=qs[_0x5e4c('0x31')](_0x4c1327[_0x5e4c('0x2a')]['sort']);_0x3ff4a2[_0x5e4c('0x34')]=qs['filters'](_[_0x5e4c('0x32')](_0x4c1327[_0x5e4c('0x2a')],_0xec9791[_0x5e4c('0x2b')]));if(_0x4c1327['query']['filter']){_0x3ff4a2[_0x5e4c('0x34')]=_[_0x5e4c('0x36')](_0x3ff4a2['where'],{'$or':_[_0x5e4c('0x29')](_0x3ff4a2[_0x5e4c('0x2e')],function(_0xf433a0){var _0x422721={};_0x422721[_0xf433a0]={'$like':'%'+_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x33')]+'%'};return _0x422721;})});}_0x3ff4a2=_[_0x5e4c('0x36')]({},_0x3ff4a2,_0x4c1327[_0x5e4c('0x3e')]);return _0x495428[_0x5e4c('0x4b')](_0x3ff4a2);}})['then'](function(_0x34f92a){if(_0x34f92a){_0xbe8186=_0x34f92a[_0x5e4c('0x45')];if(!_0x4c1327[_0x5e4c('0x2a')]['hasOwnProperty'](_0x5e4c('0x2f'))){_0x3ff4a2['limit']=qs['limit'](_0x4c1327['query'][_0x5e4c('0x30')]);_0x3ff4a2[_0x5e4c('0x19')]=qs[_0x5e4c('0x19')](_0x4c1327[_0x5e4c('0x2a')][_0x5e4c('0x19')]);}return _0x495428[_0x5e4c('0x4b')](_0x3ff4a2);}})[_0x5e4c('0x1d')](function(_0x3b0ff5){if(_0x3b0ff5){return _0x3b0ff5?{'count':_0xbe8186,'rows':_0x3b0ff5}:null;}})[_0x5e4c('0x1d')](respondWithResult(_0x55bf68,null))['catch'](handleError(_0x55bf68,null));}; \ No newline at end of file +var _0x3ac1=['ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','destroy','getFields','findOne','Dynamics365Field','options','getSubjects','hasOwnProperty','getDescriptions','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ac1,0x188));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x13ac('0x0'));var jsonpatch=require(_0x13ac('0x1'));var rp=require('request-promise');var moment=require(_0x13ac('0x2'));var BPromise=require(_0x13ac('0x3'));var Mustache=require(_0x13ac('0x4'));var util=require(_0x13ac('0x5'));var path=require(_0x13ac('0x6'));var sox=require(_0x13ac('0x7'));var csv=require('to-csv');var ejs=require(_0x13ac('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13ac('0x9'));var squel=require(_0x13ac('0xa'));var crypto=require('crypto');var jsforce=require(_0x13ac('0xb'));var deskjs=require(_0x13ac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x13ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x13ac('0xe'));var authService=require(_0x13ac('0xf'));var qs=require(_0x13ac('0x10'));var as=require(_0x13ac('0x11'));var hardwareService=require(_0x13ac('0x12'));var logger=require(_0x13ac('0x13'))(_0x13ac('0x14'));var utils=require(_0x13ac('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x13ac('0x16'))['db'];function respondWithStatusCode(_0x7658ca,_0xe7f637){_0xe7f637=_0xe7f637||0xcc;return function(_0x13fd19){if(_0x13fd19){return _0x7658ca['sendStatus'](_0xe7f637);}return _0x7658ca[_0x13ac('0x17')](_0xe7f637)[_0x13ac('0x18')]();};}function respondWithResult(_0x33b4c5,_0x5e83f1){_0x5e83f1=_0x5e83f1||0xc8;return function(_0x4da2ca){if(_0x4da2ca){return _0x33b4c5[_0x13ac('0x17')](_0x5e83f1)[_0x13ac('0x19')](_0x4da2ca);}};}function respondWithFilteredResult(_0x4bb70d,_0x12ac63){return function(_0x944da8){if(_0x944da8){var _0x48c195=typeof _0x12ac63[_0x13ac('0x1a')]===_0x13ac('0x1b')&&typeof _0x12ac63[_0x13ac('0x1c')]==='undefined';var _0x5945f6=_0x944da8[_0x13ac('0x1d')];var _0x4c755b=_0x48c195?0x0:_0x12ac63['offset'];var _0x57a01e=_0x48c195?_0x944da8[_0x13ac('0x1d')]:_0x12ac63[_0x13ac('0x1a')]+_0x12ac63[_0x13ac('0x1c')];var _0x4e995e;if(_0x57a01e>=_0x5945f6){_0x57a01e=_0x5945f6;_0x4e995e=0xc8;}else{_0x4e995e=0xce;}_0x4bb70d[_0x13ac('0x17')](_0x4e995e);return _0x4bb70d['set'](_0x13ac('0x1e'),_0x4c755b+'-'+_0x57a01e+'/'+_0x5945f6)[_0x13ac('0x19')](_0x944da8);}return null;};}function patchUpdates(_0x2cc99c){return function(_0x222aa1){try{jsonpatch[_0x13ac('0x1f')](_0x222aa1,_0x2cc99c,!![]);}catch(_0x1bf50b){return BPromise['reject'](_0x1bf50b);}return _0x222aa1[_0x13ac('0x20')]();};}function saveUpdates(_0x56c47c,_0x81a21f){return function(_0x2b62a2){if(_0x2b62a2){return _0x2b62a2[_0x13ac('0x21')](_0x56c47c)['then'](function(_0x6b49ce){return _0x6b49ce;});}return null;};}function removeEntity(_0x2262fd,_0x1d4d14){return function(_0x339c47){if(_0x339c47){return _0x339c47['destroy']()[_0x13ac('0x22')](function(){_0x2262fd[_0x13ac('0x17')](0xcc)[_0x13ac('0x18')]();});}};}function handleEntityNotFound(_0x46a7bc,_0xd9e6c1){return function(_0xdb5be){if(!_0xdb5be){_0x46a7bc[_0x13ac('0x23')](0x194);}return _0xdb5be;};}function handleError(_0x1d417a,_0x2e265d){_0x2e265d=_0x2e265d||0x1f4;return function(_0xbcdd0b){logger[_0x13ac('0x24')](_0xbcdd0b[_0x13ac('0x25')]);if(_0xbcdd0b[_0x13ac('0x26')]){delete _0xbcdd0b['name'];}_0x1d417a['status'](_0x2e265d)[_0x13ac('0x27')](_0xbcdd0b);};}exports[_0x13ac('0x28')]=function(_0x3f2782,_0x2f84f6){var _0x4f63bd={},_0x29b86b={},_0xc96cbe={'count':0x0,'rows':[]};var _0x437d9e=_[_0x13ac('0x29')](db[_0x13ac('0x2a')][_0x13ac('0x2b')],function(_0x2ffce2){return{'name':_0x2ffce2[_0x13ac('0x2c')],'type':_0x2ffce2[_0x13ac('0x2d')][_0x13ac('0x2e')]};});_0x29b86b[_0x13ac('0x2f')]=_[_0x13ac('0x29')](_0x437d9e,'name');_0x29b86b[_0x13ac('0x30')]=_[_0x13ac('0x31')](_0x3f2782[_0x13ac('0x30')]);_0x29b86b[_0x13ac('0x32')]=_[_0x13ac('0x33')](_0x29b86b['model'],_0x29b86b[_0x13ac('0x30')]);_0x4f63bd[_0x13ac('0x34')]=_[_0x13ac('0x33')](_0x29b86b['model'],qs[_0x13ac('0x35')](_0x3f2782[_0x13ac('0x30')][_0x13ac('0x35')]));_0x4f63bd[_0x13ac('0x34')]=_0x4f63bd[_0x13ac('0x34')]['length']?_0x4f63bd[_0x13ac('0x34')]:_0x29b86b['model'];if(!_0x3f2782['query']['hasOwnProperty'](_0x13ac('0x36'))){_0x4f63bd[_0x13ac('0x1c')]=qs[_0x13ac('0x1c')](_0x3f2782[_0x13ac('0x30')][_0x13ac('0x1c')]);_0x4f63bd[_0x13ac('0x1a')]=qs[_0x13ac('0x1a')](_0x3f2782[_0x13ac('0x30')][_0x13ac('0x1a')]);}_0x4f63bd[_0x13ac('0x37')]=qs[_0x13ac('0x38')](_0x3f2782[_0x13ac('0x30')][_0x13ac('0x38')]);_0x4f63bd[_0x13ac('0x39')]=qs[_0x13ac('0x32')](_[_0x13ac('0x3a')](_0x3f2782['query'],_0x29b86b['filters']),_0x437d9e);if(_0x3f2782[_0x13ac('0x30')][_0x13ac('0x3b')]){_0x4f63bd['where']=_[_0x13ac('0x3c')](_0x4f63bd[_0x13ac('0x39')],{'$or':_['map'](_0x437d9e,function(_0x1a2944){if(_0x1a2944[_0x13ac('0x2d')]!==_0x13ac('0x3d')){var _0x4fc289={};_0x4fc289[_0x1a2944[_0x13ac('0x26')]]={'$like':'%'+_0x3f2782[_0x13ac('0x30')][_0x13ac('0x3b')]+'%'};return _0x4fc289;}})});}_0x4f63bd=_['merge']({},_0x4f63bd,_0x3f2782['options']);var _0xa2d8be={'where':_0x4f63bd[_0x13ac('0x39')]};return db[_0x13ac('0x2a')][_0x13ac('0x1d')](_0xa2d8be)[_0x13ac('0x22')](function(_0xe5e7af){_0xc96cbe['count']=_0xe5e7af;if(_0x3f2782[_0x13ac('0x30')][_0x13ac('0x3e')]){_0x4f63bd[_0x13ac('0x3f')]=[{'all':!![]}];}return db[_0x13ac('0x2a')][_0x13ac('0x40')](_0x4f63bd);})[_0x13ac('0x22')](function(_0x5a27a6){_0xc96cbe['rows']=_0x5a27a6;return _0xc96cbe;})['then'](respondWithFilteredResult(_0x2f84f6,_0x4f63bd))[_0x13ac('0x41')](handleError(_0x2f84f6,null));};exports[_0x13ac('0x42')]=function(_0x54e35b,_0x4ec5b1){var _0x12a71d={'raw':![],'where':{'id':_0x54e35b[_0x13ac('0x43')]['id']}},_0xca09f6={};_0xca09f6[_0x13ac('0x2f')]=_[_0x13ac('0x31')](db[_0x13ac('0x2a')][_0x13ac('0x2b')]);_0xca09f6['query']=_[_0x13ac('0x31')](_0x54e35b[_0x13ac('0x30')]);_0xca09f6[_0x13ac('0x32')]=_[_0x13ac('0x33')](_0xca09f6[_0x13ac('0x2f')],_0xca09f6[_0x13ac('0x30')]);_0x12a71d[_0x13ac('0x34')]=_[_0x13ac('0x33')](_0xca09f6['model'],qs['fields'](_0x54e35b[_0x13ac('0x30')][_0x13ac('0x35')]));_0x12a71d[_0x13ac('0x34')]=_0x12a71d[_0x13ac('0x34')][_0x13ac('0x44')]?_0x12a71d[_0x13ac('0x34')]:_0xca09f6[_0x13ac('0x2f')];if(_0x54e35b['query'][_0x13ac('0x3e')]){_0x12a71d['include']=[{'all':!![]}];}_0x12a71d=_[_0x13ac('0x3c')]({},_0x12a71d,_0x54e35b['options']);return db[_0x13ac('0x2a')][_0x13ac('0x45')](_0x12a71d)[_0x13ac('0x22')](handleEntityNotFound(_0x4ec5b1,null))['then'](respondWithResult(_0x4ec5b1,null))[_0x13ac('0x41')](handleError(_0x4ec5b1,null));};exports['create']=function(_0x381942,_0x2c25b9){return db['Dynamics365Configuration'][_0x13ac('0x46')](_0x381942[_0x13ac('0x47')],{})[_0x13ac('0x22')](respondWithResult(_0x2c25b9,0xc9))[_0x13ac('0x41')](handleError(_0x2c25b9,null));};exports[_0x13ac('0x21')]=function(_0x35f5f3,_0x124178){if(_0x35f5f3[_0x13ac('0x47')]['id']){delete _0x35f5f3[_0x13ac('0x47')]['id'];}return db[_0x13ac('0x2a')]['find']({'where':{'id':_0x35f5f3['params']['id']}})[_0x13ac('0x22')](handleEntityNotFound(_0x124178,null))[_0x13ac('0x22')](saveUpdates(_0x35f5f3[_0x13ac('0x47')],null))[_0x13ac('0x22')](respondWithResult(_0x124178,null))['catch'](handleError(_0x124178,null));};exports[_0x13ac('0x48')]=function(_0x1eab7b,_0x34706f){return db[_0x13ac('0x2a')]['find']({'where':{'id':_0x1eab7b['params']['id']}})[_0x13ac('0x22')](handleEntityNotFound(_0x34706f,null))['then'](removeEntity(_0x34706f,null))['catch'](handleError(_0x34706f,null));};exports[_0x13ac('0x49')]=function(_0x3b8621,_0x20066c,_0x3bf770){var _0xeef654={};var _0x16efd3={};var _0x1d2d81;var _0x468749;return db[_0x13ac('0x2a')][_0x13ac('0x4a')]({'where':{'id':_0x3b8621[_0x13ac('0x43')]['id']}})[_0x13ac('0x22')](handleEntityNotFound(_0x20066c,null))[_0x13ac('0x22')](function(_0x1b59c6){if(_0x1b59c6){_0x1d2d81=_0x1b59c6;_0x16efd3[_0x13ac('0x2f')]=_[_0x13ac('0x31')](db[_0x13ac('0x4b')]['rawAttributes']);_0x16efd3[_0x13ac('0x30')]=_['keys'](_0x3b8621[_0x13ac('0x30')]);_0x16efd3['filters']=_[_0x13ac('0x33')](_0x16efd3[_0x13ac('0x2f')],_0x16efd3[_0x13ac('0x30')]);_0xeef654[_0x13ac('0x34')]=_[_0x13ac('0x33')](_0x16efd3[_0x13ac('0x2f')],qs[_0x13ac('0x35')](_0x3b8621['query'][_0x13ac('0x35')]));_0xeef654[_0x13ac('0x34')]=_0xeef654['attributes'][_0x13ac('0x44')]?_0xeef654['attributes']:_0x16efd3[_0x13ac('0x2f')];_0xeef654['order']=qs[_0x13ac('0x38')](_0x3b8621[_0x13ac('0x30')][_0x13ac('0x38')]);_0xeef654[_0x13ac('0x39')]=qs[_0x13ac('0x32')](_[_0x13ac('0x3a')](_0x3b8621[_0x13ac('0x30')],_0x16efd3[_0x13ac('0x32')]));if(_0x3b8621[_0x13ac('0x30')]['filter']){_0xeef654[_0x13ac('0x39')]=_[_0x13ac('0x3c')](_0xeef654[_0x13ac('0x39')],{'$or':_[_0x13ac('0x29')](_0xeef654[_0x13ac('0x34')],function(_0x19a169){var _0x4db785={};_0x4db785[_0x19a169]={'$like':'%'+_0x3b8621[_0x13ac('0x30')]['filter']+'%'};return _0x4db785;})});}_0xeef654=_[_0x13ac('0x3c')]({},_0xeef654,_0x3b8621[_0x13ac('0x4c')]);return _0x1d2d81[_0x13ac('0x49')](_0xeef654);}})['then'](function(_0x4157c2){if(_0x4157c2){_0x468749=_0x4157c2[_0x13ac('0x44')];if(!_0x3b8621['query']['hasOwnProperty']('nolimit')){_0xeef654[_0x13ac('0x1c')]=qs[_0x13ac('0x1c')](_0x3b8621[_0x13ac('0x30')]['limit']);_0xeef654[_0x13ac('0x1a')]=qs[_0x13ac('0x1a')](_0x3b8621['query'][_0x13ac('0x1a')]);}return _0x1d2d81[_0x13ac('0x49')](_0xeef654);}})[_0x13ac('0x22')](function(_0x55da0e){if(_0x55da0e){return _0x55da0e?{'count':_0x468749,'rows':_0x55da0e}:null;}})[_0x13ac('0x22')](respondWithResult(_0x20066c,null))[_0x13ac('0x41')](handleError(_0x20066c,null));};exports['getSubjects']=function(_0x36c77e,_0x5d1176,_0x48f072){var _0x4ed076={};var _0x45bd22={};var _0x2bb6a8;var _0x2ddea7;return db[_0x13ac('0x2a')][_0x13ac('0x4a')]({'where':{'id':_0x36c77e[_0x13ac('0x43')]['id']}})[_0x13ac('0x22')](handleEntityNotFound(_0x5d1176,null))[_0x13ac('0x22')](function(_0x577168){if(_0x577168){_0x2bb6a8=_0x577168;_0x45bd22[_0x13ac('0x2f')]=_['keys'](db[_0x13ac('0x4b')][_0x13ac('0x2b')]);_0x45bd22['query']=_[_0x13ac('0x31')](_0x36c77e[_0x13ac('0x30')]);_0x45bd22[_0x13ac('0x32')]=_['intersection'](_0x45bd22['model'],_0x45bd22[_0x13ac('0x30')]);_0x4ed076[_0x13ac('0x34')]=_[_0x13ac('0x33')](_0x45bd22['model'],qs[_0x13ac('0x35')](_0x36c77e[_0x13ac('0x30')][_0x13ac('0x35')]));_0x4ed076[_0x13ac('0x34')]=_0x4ed076[_0x13ac('0x34')]['length']?_0x4ed076[_0x13ac('0x34')]:_0x45bd22[_0x13ac('0x2f')];_0x4ed076[_0x13ac('0x37')]=qs['sort'](_0x36c77e[_0x13ac('0x30')][_0x13ac('0x38')]);_0x4ed076[_0x13ac('0x39')]=qs[_0x13ac('0x32')](_[_0x13ac('0x3a')](_0x36c77e['query'],_0x45bd22[_0x13ac('0x32')]));if(_0x36c77e[_0x13ac('0x30')][_0x13ac('0x3b')]){_0x4ed076[_0x13ac('0x39')]=_[_0x13ac('0x3c')](_0x4ed076[_0x13ac('0x39')],{'$or':_[_0x13ac('0x29')](_0x4ed076[_0x13ac('0x34')],function(_0x2c8e95){var _0x4c6895={};_0x4c6895[_0x2c8e95]={'$like':'%'+_0x36c77e[_0x13ac('0x30')][_0x13ac('0x3b')]+'%'};return _0x4c6895;})});}_0x4ed076=_[_0x13ac('0x3c')]({},_0x4ed076,_0x36c77e[_0x13ac('0x4c')]);return _0x2bb6a8[_0x13ac('0x4d')](_0x4ed076);}})[_0x13ac('0x22')](function(_0x3501f5){if(_0x3501f5){_0x2ddea7=_0x3501f5[_0x13ac('0x44')];if(!_0x36c77e[_0x13ac('0x30')][_0x13ac('0x4e')](_0x13ac('0x36'))){_0x4ed076[_0x13ac('0x1c')]=qs[_0x13ac('0x1c')](_0x36c77e[_0x13ac('0x30')][_0x13ac('0x1c')]);_0x4ed076[_0x13ac('0x1a')]=qs[_0x13ac('0x1a')](_0x36c77e['query'][_0x13ac('0x1a')]);}return _0x2bb6a8['getSubjects'](_0x4ed076);}})[_0x13ac('0x22')](function(_0x190ec5){if(_0x190ec5){return _0x190ec5?{'count':_0x2ddea7,'rows':_0x190ec5}:null;}})[_0x13ac('0x22')](respondWithResult(_0x5d1176,null))[_0x13ac('0x41')](handleError(_0x5d1176,null));};exports[_0x13ac('0x4f')]=function(_0x2e386b,_0x560019,_0x2d975e){var _0x17ecf5={};var _0x5396b2={};var _0x3e6bab;var _0x5a0b75;return db['Dynamics365Configuration'][_0x13ac('0x4a')]({'where':{'id':_0x2e386b[_0x13ac('0x43')]['id']}})[_0x13ac('0x22')](handleEntityNotFound(_0x560019,null))['then'](function(_0x4b4bb3){if(_0x4b4bb3){_0x3e6bab=_0x4b4bb3;_0x5396b2[_0x13ac('0x2f')]=_['keys'](db[_0x13ac('0x4b')][_0x13ac('0x2b')]);_0x5396b2[_0x13ac('0x30')]=_[_0x13ac('0x31')](_0x2e386b[_0x13ac('0x30')]);_0x5396b2[_0x13ac('0x32')]=_['intersection'](_0x5396b2[_0x13ac('0x2f')],_0x5396b2[_0x13ac('0x30')]);_0x17ecf5[_0x13ac('0x34')]=_[_0x13ac('0x33')](_0x5396b2[_0x13ac('0x2f')],qs['fields'](_0x2e386b['query'][_0x13ac('0x35')]));_0x17ecf5[_0x13ac('0x34')]=_0x17ecf5[_0x13ac('0x34')][_0x13ac('0x44')]?_0x17ecf5[_0x13ac('0x34')]:_0x5396b2[_0x13ac('0x2f')];_0x17ecf5[_0x13ac('0x37')]=qs['sort'](_0x2e386b['query'][_0x13ac('0x38')]);_0x17ecf5['where']=qs[_0x13ac('0x32')](_[_0x13ac('0x3a')](_0x2e386b[_0x13ac('0x30')],_0x5396b2[_0x13ac('0x32')]));if(_0x2e386b[_0x13ac('0x30')][_0x13ac('0x3b')]){_0x17ecf5['where']=_[_0x13ac('0x3c')](_0x17ecf5[_0x13ac('0x39')],{'$or':_[_0x13ac('0x29')](_0x17ecf5[_0x13ac('0x34')],function(_0x3c4450){var _0x25012b={};_0x25012b[_0x3c4450]={'$like':'%'+_0x2e386b['query'][_0x13ac('0x3b')]+'%'};return _0x25012b;})});}_0x17ecf5=_[_0x13ac('0x3c')]({},_0x17ecf5,_0x2e386b['options']);return _0x3e6bab[_0x13ac('0x4f')](_0x17ecf5);}})[_0x13ac('0x22')](function(_0x169855){if(_0x169855){_0x5a0b75=_0x169855['length'];if(!_0x2e386b[_0x13ac('0x30')][_0x13ac('0x4e')](_0x13ac('0x36'))){_0x17ecf5[_0x13ac('0x1c')]=qs[_0x13ac('0x1c')](_0x2e386b[_0x13ac('0x30')][_0x13ac('0x1c')]);_0x17ecf5[_0x13ac('0x1a')]=qs[_0x13ac('0x1a')](_0x2e386b[_0x13ac('0x30')][_0x13ac('0x1a')]);}return _0x3e6bab[_0x13ac('0x4f')](_0x17ecf5);}})[_0x13ac('0x22')](function(_0x4cd139){if(_0x4cd139){return _0x4cd139?{'count':_0x5a0b75,'rows':_0x4cd139}:null;}})[_0x13ac('0x22')](respondWithResult(_0x560019,null))[_0x13ac('0x41')](handleError(_0x560019,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e2f5e11..55c6c25 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 _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x14d6ac,_0x4649ce){var _0x164cfc=function(_0x30684c){while(--_0x30684c){_0x14d6ac['push'](_0x14d6ac['shift']());}};_0x164cfc(++_0x4649ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x008c,0x188));var _0xc008=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x008c[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'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 df9dde5..6292a00 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 _0xd7e8=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x41f5a5,_0x3edbfa){var _0xe96838=function(_0x2cbfe5){while(--_0x2cbfe5){_0x41f5a5['push'](_0x41f5a5['shift']());}};_0xe96838(++_0x3edbfa);}(_0xd7e8,0x10e));var _0x8d7e=function(_0x52a4ba,_0x5baa19){_0x52a4ba=_0x52a4ba-0x0;var _0x257aee=_0xd7e8[_0x52a4ba];return _0x257aee;};'use strict';var _=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var moment=require(_0x8d7e('0x2'));var BPromise=require(_0x8d7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d7e('0x4'));var db=require(_0x8d7e('0x5'))['db'];var utils=require(_0x8d7e('0x6'));var logger=require(_0x8d7e('0x7'))(_0x8d7e('0x8'));var config=require(_0x8d7e('0x9'));var jayson=require(_0x8d7e('0xa'));var client=jayson[_0x8d7e('0xb')][_0x8d7e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x178723,_0x134d66,_0xfa1cc7){return new BPromise(function(_0x26f03b,_0x5206c5){return client[_0x8d7e('0xd')](_0x178723,_0xfa1cc7)[_0x8d7e('0xe')](function(_0x301bd6){logger[_0x8d7e('0xf')](_0x8d7e('0x10'),_0x134d66,_0x8d7e('0x11'));logger['debug'](_0x8d7e('0x12'),_0x134d66,'request\x20sent',JSON[_0x8d7e('0x13')](_0x301bd6));if(_0x301bd6[_0x8d7e('0x14')]){if(_0x301bd6['error'][_0x8d7e('0x15')]===0x1f4){logger[_0x8d7e('0x14')](_0x8d7e('0x10'),_0x134d66,_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);return _0x5206c5(_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);}logger[_0x8d7e('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x134d66,_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);return _0x26f03b(_0x301bd6[_0x8d7e('0x14')][_0x8d7e('0x16')]);}else{logger[_0x8d7e('0xf')](_0x8d7e('0x10'),_0x134d66,'request\x20sent');_0x26f03b(_0x301bd6['result'][_0x8d7e('0x16')]);}})[_0x8d7e('0x17')](function(_0x4c42bf){logger[_0x8d7e('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x134d66,_0x4c42bf);_0x5206c5(_0x4c42bf);});});} \ No newline at end of file +var _0x47ed=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x330075,_0x2c9fe7){var _0x487a73=function(_0x128d52){while(--_0x128d52){_0x330075['push'](_0x330075['shift']());}};_0x487a73(++_0x2c9fe7);}(_0x47ed,0x64));var _0xd47e=function(_0x5ba5c7,_0x1caf61){_0x5ba5c7=_0x5ba5c7-0x0;var _0x574a48=_0x47ed[_0x5ba5c7];return _0x574a48;};'use strict';var _=require(_0xd47e('0x0'));var util=require(_0xd47e('0x1'));var moment=require(_0xd47e('0x2'));var BPromise=require(_0xd47e('0x3'));var rs=require(_0xd47e('0x4'));var fs=require('fs');var Redis=require(_0xd47e('0x5'));var db=require(_0xd47e('0x6'))['db'];var utils=require(_0xd47e('0x7'));var logger=require(_0xd47e('0x8'))(_0xd47e('0x9'));var config=require('../../config/environment');var jayson=require(_0xd47e('0xa'));var client=jayson[_0xd47e('0xb')][_0xd47e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc317e5,_0x2370e5,_0x4a960b){return new BPromise(function(_0x11810a,_0x5ee3b5){return client[_0xd47e('0xd')](_0xc317e5,_0x4a960b)[_0xd47e('0xe')](function(_0x1d96c1){logger[_0xd47e('0xf')](_0xd47e('0x10'),_0x2370e5,_0xd47e('0x11'));logger['debug'](_0xd47e('0x12'),_0x2370e5,_0xd47e('0x11'),JSON[_0xd47e('0x13')](_0x1d96c1));if(_0x1d96c1[_0xd47e('0x14')]){if(_0x1d96c1[_0xd47e('0x14')]['code']===0x1f4){logger[_0xd47e('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2370e5,_0x1d96c1[_0xd47e('0x14')][_0xd47e('0x15')]);return _0x5ee3b5(_0x1d96c1[_0xd47e('0x14')]['message']);}logger[_0xd47e('0x14')](_0xd47e('0x10'),_0x2370e5,_0x1d96c1['error'][_0xd47e('0x15')]);return _0x11810a(_0x1d96c1[_0xd47e('0x14')]['message']);}else{logger['info'](_0xd47e('0x10'),_0x2370e5,'request\x20sent');_0x11810a(_0x1d96c1['result']['message']);}})[_0xd47e('0x16')](function(_0x293b90){logger[_0xd47e('0x14')](_0xd47e('0x10'),_0x2370e5,_0x293b90);_0x5ee3b5(_0x293b90);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 83cf37e..44c5f74 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 _0x91e7=['get','/:id','isAuthenticated','show','post','create','delete','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x91e7,0xe9));var _0x791e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x91e7[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x791e('0x0'));var express=require('express');var router=express[_0x791e('0x1')]();var fs_extra=require(_0x791e('0x2'));var auth=require(_0x791e('0x3'));var interaction=require(_0x791e('0x4'));var config=require(_0x791e('0x5'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x791e('0x6')]);router[_0x791e('0x7')](_0x791e('0x8'),auth[_0x791e('0x9')](),controller[_0x791e('0xa')]);router[_0x791e('0xb')]('/',auth['isAuthenticated'](),controller[_0x791e('0xc')]);router['put'](_0x791e('0x8'),auth[_0x791e('0x9')](),controller['update']);router[_0x791e('0xd')]('/:id',auth[_0x791e('0x9')](),controller[_0x791e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x467a=['isAuthenticated','index','/:id','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get'];(function(_0x385b88,_0xda8af1){var _0x575370=function(_0x592f85){while(--_0x592f85){_0x385b88['push'](_0x385b88['shift']());}};_0x575370(++_0xda8af1);}(_0x467a,0x98));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa467('0x0'));var util=require(_0xa467('0x1'));var path=require('path');var timeout=require(_0xa467('0x2'));var express=require(_0xa467('0x3'));var router=express[_0xa467('0x4')]();var fs_extra=require(_0xa467('0x5'));var auth=require(_0xa467('0x6'));var interaction=require(_0xa467('0x7'));var config=require('../../config/environment');var controller=require(_0xa467('0x8'));router[_0xa467('0x9')]('/',auth[_0xa467('0xa')](),controller[_0xa467('0xb')]);router[_0xa467('0x9')](_0xa467('0xc'),auth[_0xa467('0xa')](),controller['show']);router['post']('/',auth[_0xa467('0xa')](),controller[_0xa467('0xd')]);router[_0xa467('0xe')](_0xa467('0xc'),auth[_0xa467('0xa')](),controller[_0xa467('0xf')]);router['delete'](_0xa467('0xc'),auth['isAuthenticated'](),controller[_0xa467('0x10')]);module[_0xa467('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 46bd300..564a526 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 _0xdf22=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xdf22,0x137));var _0x2df2=function(_0x522235,_0x3eb711){_0x522235=_0x522235-0x0;var _0x2a62ad=_0xdf22[_0x522235];return _0x2a62ad;};'use strict';var Sequelize=require('sequelize');module[_0x2df2('0x0')]={'type':{'type':Sequelize[_0x2df2('0x1')](_0x2df2('0x2'),'variable',_0x2df2('0x3'),_0x2df2('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2df2('0x5')]},'key':{'type':Sequelize[_0x2df2('0x5')]},'keyType':{'type':Sequelize[_0x2df2('0x1')](_0x2df2('0x2'),_0x2df2('0x6'),_0x2df2('0x3'))},'keyContent':{'type':Sequelize[_0x2df2('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2df2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2df2('0x5')]}}; \ No newline at end of file +var _0x6b78=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','picklist'];(function(_0x37fa7b,_0x3a900f){var _0x3558d8=function(_0x495803){while(--_0x495803){_0x37fa7b['push'](_0x37fa7b['shift']());}};_0x3558d8(++_0x3a900f);}(_0x6b78,0x67));var _0x86b7=function(_0x1ada19,_0x2bc492){_0x1ada19=_0x1ada19-0x0;var _0x15764b=_0x6b78[_0x1ada19];return _0x15764b;};'use strict';var Sequelize=require(_0x86b7('0x0'));module[_0x86b7('0x1')]={'type':{'type':Sequelize[_0x86b7('0x2')]('string',_0x86b7('0x3'),'customVariable','keyValue',_0x86b7('0x4')),'defaultValue':_0x86b7('0x5')},'content':{'type':Sequelize[_0x86b7('0x6')]},'key':{'type':Sequelize[_0x86b7('0x6')]},'keyType':{'type':Sequelize[_0x86b7('0x2')]('string',_0x86b7('0x3'),_0x86b7('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x86b7('0x6')]},'nameField':{'type':Sequelize[_0x86b7('0x6')]},'customField':{'type':Sequelize[_0x86b7('0x8')],'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 0f5a6cc..8c2b47b 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 _0x2071=['util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','catch','show','params','includeAll','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x5a59c3,_0x93d2e6){var _0x3f2855=function(_0xf24c82){while(--_0xf24c82){_0x5a59c3['push'](_0x5a59c3['shift']());}};_0x3f2855(++_0x93d2e6);}(_0x2071,0x1c2));var _0x1207=function(_0x573c9e,_0xd4ab71){_0x573c9e=_0x573c9e-0x0;var _0x5d0714=_0x2071[_0x573c9e];return _0x5d0714;};'use strict';var emlformat=require(_0x1207('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1207('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1207('0x2'));var moment=require(_0x1207('0x3'));var BPromise=require(_0x1207('0x4'));var Mustache=require(_0x1207('0x5'));var util=require(_0x1207('0x6'));var path=require(_0x1207('0x7'));var sox=require(_0x1207('0x8'));var csv=require('to-csv');var ejs=require(_0x1207('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1207('0xa'));var squel=require(_0x1207('0xb'));var crypto=require('crypto');var jsforce=require(_0x1207('0xc'));var deskjs=require(_0x1207('0xd'));var toCsv=require(_0x1207('0xe'));var querystring=require(_0x1207('0xf'));var Papa=require(_0x1207('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1207('0x11'));var hardwareService=require(_0x1207('0x12'));var logger=require(_0x1207('0x13'))(_0x1207('0x14'));var utils=require(_0x1207('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1207('0x16'));var db=require(_0x1207('0x17'))['db'];function respondWithStatusCode(_0x4baee1,_0x1e1b65){_0x1e1b65=_0x1e1b65||0xcc;return function(_0x27e8a7){if(_0x27e8a7){return _0x4baee1[_0x1207('0x18')](_0x1e1b65);}return _0x4baee1[_0x1207('0x19')](_0x1e1b65)[_0x1207('0x1a')]();};}function respondWithResult(_0x2108bd,_0x1a0cba){_0x1a0cba=_0x1a0cba||0xc8;return function(_0x31aa75){if(_0x31aa75){return _0x2108bd['status'](_0x1a0cba)[_0x1207('0x1b')](_0x31aa75);}};}function respondWithFilteredResult(_0x3e64c1,_0x4db4ee){return function(_0x55c057){if(_0x55c057){var _0xdc8d5=typeof _0x4db4ee[_0x1207('0x1c')]===_0x1207('0x1d')&&typeof _0x4db4ee[_0x1207('0x1e')]===_0x1207('0x1d');var _0x1f4185=_0x55c057['count'];var _0x22d5e2=_0xdc8d5?0x0:_0x4db4ee[_0x1207('0x1c')];var _0x318ce7=_0xdc8d5?_0x55c057[_0x1207('0x1f')]:_0x4db4ee['offset']+_0x4db4ee[_0x1207('0x1e')];var _0x5671ae;if(_0x318ce7>=_0x1f4185){_0x318ce7=_0x1f4185;_0x5671ae=0xc8;}else{_0x5671ae=0xce;}_0x3e64c1[_0x1207('0x19')](_0x5671ae);return _0x3e64c1[_0x1207('0x20')](_0x1207('0x21'),_0x22d5e2+'-'+_0x318ce7+'/'+_0x1f4185)['json'](_0x55c057);}return null;};}function patchUpdates(_0x11265e){return function(_0x38ece7){try{jsonpatch[_0x1207('0x22')](_0x38ece7,_0x11265e,!![]);}catch(_0x8687c){return BPromise[_0x1207('0x23')](_0x8687c);}return _0x38ece7[_0x1207('0x24')]();};}function saveUpdates(_0x2c3b20,_0x22793c){return function(_0x3bb6cd){if(_0x3bb6cd){return _0x3bb6cd[_0x1207('0x25')](_0x2c3b20)[_0x1207('0x26')](function(_0x53c814){return _0x53c814;});}return null;};}function removeEntity(_0x452bb1,_0x17196a){return function(_0x3e37e1){if(_0x3e37e1){return _0x3e37e1[_0x1207('0x27')]()[_0x1207('0x26')](function(){_0x452bb1[_0x1207('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b131f,_0x46334f){return function(_0x4c43fc){if(!_0x4c43fc){_0x3b131f[_0x1207('0x18')](0x194);}return _0x4c43fc;};}function handleError(_0x3f4161,_0x29864a){_0x29864a=_0x29864a||0x1f4;return function(_0x11faf6){logger[_0x1207('0x28')](_0x11faf6['stack']);if(_0x11faf6[_0x1207('0x29')]){delete _0x11faf6['name'];}_0x3f4161['status'](_0x29864a)[_0x1207('0x2a')](_0x11faf6);};}exports['index']=function(_0x94c623,_0x1f7214){var _0x2a2d46={},_0xaea33d={},_0x254955={'count':0x0,'rows':[]};var _0x212b34=_[_0x1207('0x2b')](db[_0x1207('0x2c')][_0x1207('0x2d')],function(_0x3969ba){return{'name':_0x3969ba[_0x1207('0x2e')],'type':_0x3969ba[_0x1207('0x2f')][_0x1207('0x30')]};});_0xaea33d['model']=_['map'](_0x212b34,_0x1207('0x29'));_0xaea33d[_0x1207('0x31')]=_[_0x1207('0x32')](_0x94c623['query']);_0xaea33d['filters']=_[_0x1207('0x33')](_0xaea33d[_0x1207('0x34')],_0xaea33d['query']);_0x2a2d46[_0x1207('0x35')]=_[_0x1207('0x33')](_0xaea33d['model'],qs[_0x1207('0x36')](_0x94c623['query'][_0x1207('0x36')]));_0x2a2d46[_0x1207('0x35')]=_0x2a2d46[_0x1207('0x35')][_0x1207('0x37')]?_0x2a2d46[_0x1207('0x35')]:_0xaea33d[_0x1207('0x34')];if(!_0x94c623[_0x1207('0x31')][_0x1207('0x38')](_0x1207('0x39'))){_0x2a2d46[_0x1207('0x1e')]=qs['limit'](_0x94c623[_0x1207('0x31')][_0x1207('0x1e')]);_0x2a2d46[_0x1207('0x1c')]=qs[_0x1207('0x1c')](_0x94c623['query'][_0x1207('0x1c')]);}_0x2a2d46[_0x1207('0x3a')]=qs[_0x1207('0x3b')](_0x94c623[_0x1207('0x31')]['sort']);_0x2a2d46[_0x1207('0x3c')]=qs[_0x1207('0x3d')](_[_0x1207('0x3e')](_0x94c623[_0x1207('0x31')],_0xaea33d[_0x1207('0x3d')]),_0x212b34);if(_0x94c623['query']['filter']){_0x2a2d46[_0x1207('0x3c')]=_[_0x1207('0x3f')](_0x2a2d46[_0x1207('0x3c')],{'$or':_['map'](_0x212b34,function(_0x18d111){if(_0x18d111[_0x1207('0x2f')]!==_0x1207('0x40')){var _0x314e04={};_0x314e04[_0x18d111[_0x1207('0x29')]]={'$like':'%'+_0x94c623['query'][_0x1207('0x41')]+'%'};return _0x314e04;}})});}_0x2a2d46=_['merge']({},_0x2a2d46,_0x94c623['options']);var _0xa797a={'where':_0x2a2d46[_0x1207('0x3c')]};return db[_0x1207('0x2c')][_0x1207('0x1f')](_0xa797a)[_0x1207('0x26')](function(_0x37d5df){_0x254955['count']=_0x37d5df;if(_0x94c623[_0x1207('0x31')]['includeAll']){_0x2a2d46[_0x1207('0x42')]=[{'all':!![]}];}return db[_0x1207('0x2c')][_0x1207('0x43')](_0x2a2d46);})[_0x1207('0x26')](function(_0x4051d7){_0x254955['rows']=_0x4051d7;return _0x254955;})['then'](respondWithFilteredResult(_0x1f7214,_0x2a2d46))[_0x1207('0x44')](handleError(_0x1f7214,null));};exports[_0x1207('0x45')]=function(_0x544958,_0x2c94a1){var _0x10135a={'raw':!![],'where':{'id':_0x544958[_0x1207('0x46')]['id']}},_0x2ac612={};_0x2ac612['model']=_['keys'](db[_0x1207('0x2c')]['rawAttributes']);_0x2ac612['query']=_[_0x1207('0x32')](_0x544958[_0x1207('0x31')]);_0x2ac612['filters']=_['intersection'](_0x2ac612[_0x1207('0x34')],_0x2ac612[_0x1207('0x31')]);_0x10135a['attributes']=_[_0x1207('0x33')](_0x2ac612[_0x1207('0x34')],qs['fields'](_0x544958[_0x1207('0x31')][_0x1207('0x36')]));_0x10135a['attributes']=_0x10135a[_0x1207('0x35')][_0x1207('0x37')]?_0x10135a[_0x1207('0x35')]:_0x2ac612[_0x1207('0x34')];if(_0x544958[_0x1207('0x31')][_0x1207('0x47')]){_0x10135a[_0x1207('0x42')]=[{'all':!![]}];}_0x10135a=_[_0x1207('0x3f')]({},_0x10135a,_0x544958[_0x1207('0x48')]);return db[_0x1207('0x2c')][_0x1207('0x49')](_0x10135a)['then'](handleEntityNotFound(_0x2c94a1,null))[_0x1207('0x26')](respondWithResult(_0x2c94a1,null))['catch'](handleError(_0x2c94a1,null));};exports[_0x1207('0x4a')]=function(_0x236a8f,_0x98e26d){return db[_0x1207('0x2c')][_0x1207('0x4a')](_0x236a8f[_0x1207('0x4b')],{})['then'](respondWithResult(_0x98e26d,0xc9))['catch'](handleError(_0x98e26d,null));};exports[_0x1207('0x25')]=function(_0x269853,_0xd4447c){if(_0x269853[_0x1207('0x4b')]['id']){delete _0x269853[_0x1207('0x4b')]['id'];}return db[_0x1207('0x2c')]['find']({'where':{'id':_0x269853[_0x1207('0x46')]['id']}})[_0x1207('0x26')](handleEntityNotFound(_0xd4447c,null))[_0x1207('0x26')](saveUpdates(_0x269853[_0x1207('0x4b')],null))[_0x1207('0x26')](respondWithResult(_0xd4447c,null))[_0x1207('0x44')](handleError(_0xd4447c,null));};exports[_0x1207('0x27')]=function(_0x4f5e26,_0x180721){return db['Dynamics365Field']['find']({'where':{'id':_0x4f5e26[_0x1207('0x46')]['id']}})[_0x1207('0x26')](handleEntityNotFound(_0x180721,null))[_0x1207('0x26')](removeEntity(_0x180721,null))[_0x1207('0x44')](handleError(_0x180721,null));}; \ No newline at end of file +var _0xf917=['include','findAll','rows','catch','show','params','includeAll','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','type','VIRTUAL','options','where'];(function(_0x1d8a3a,_0x248892){var _0x18bb68=function(_0x13e40a){while(--_0x13e40a){_0x1d8a3a['push'](_0x1d8a3a['shift']());}};_0x18bb68(++_0x248892);}(_0xf917,0x12f));var _0x7f91=function(_0xee1b2e,_0x34f7bd){_0xee1b2e=_0xee1b2e-0x0;var _0x5bf13c=_0xf917[_0xee1b2e];return _0x5bf13c;};'use strict';var emlformat=require(_0x7f91('0x0'));var rimraf=require(_0x7f91('0x1'));var zipdir=require(_0x7f91('0x2'));var jsonpatch=require(_0x7f91('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f91('0x4'));var util=require(_0x7f91('0x5'));var path=require('path');var sox=require(_0x7f91('0x6'));var csv=require(_0x7f91('0x7'));var ejs=require(_0x7f91('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f91('0x9'));var squel=require(_0x7f91('0xa'));var crypto=require(_0x7f91('0xb'));var jsforce=require(_0x7f91('0xc'));var deskjs=require(_0x7f91('0xd'));var toCsv=require(_0x7f91('0x7'));var querystring=require(_0x7f91('0xe'));var Papa=require(_0x7f91('0xf'));var Redis=require(_0x7f91('0x10'));var authService=require(_0x7f91('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f91('0x12'));var hardwareService=require(_0x7f91('0x13'));var logger=require(_0x7f91('0x14'))(_0x7f91('0x15'));var utils=require(_0x7f91('0x16'));var config=require(_0x7f91('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f91('0x18'))['db'];function respondWithStatusCode(_0x3673ce,_0x4019c0){_0x4019c0=_0x4019c0||0xcc;return function(_0x59913e){if(_0x59913e){return _0x3673ce[_0x7f91('0x19')](_0x4019c0);}return _0x3673ce['status'](_0x4019c0)[_0x7f91('0x1a')]();};}function respondWithResult(_0x82ecb4,_0x10834f){_0x10834f=_0x10834f||0xc8;return function(_0x3730b4){if(_0x3730b4){return _0x82ecb4['status'](_0x10834f)[_0x7f91('0x1b')](_0x3730b4);}};}function respondWithFilteredResult(_0x3cc29e,_0x4edb7f){return function(_0x5c0b35){if(_0x5c0b35){var _0x88ab07=typeof _0x4edb7f[_0x7f91('0x1c')]===_0x7f91('0x1d')&&typeof _0x4edb7f[_0x7f91('0x1e')]===_0x7f91('0x1d');var _0x53d58e=_0x5c0b35[_0x7f91('0x1f')];var _0xe668e=_0x88ab07?0x0:_0x4edb7f[_0x7f91('0x1c')];var _0x249761=_0x88ab07?_0x5c0b35[_0x7f91('0x1f')]:_0x4edb7f[_0x7f91('0x1c')]+_0x4edb7f[_0x7f91('0x1e')];var _0x588228;if(_0x249761>=_0x53d58e){_0x249761=_0x53d58e;_0x588228=0xc8;}else{_0x588228=0xce;}_0x3cc29e[_0x7f91('0x20')](_0x588228);return _0x3cc29e[_0x7f91('0x21')](_0x7f91('0x22'),_0xe668e+'-'+_0x249761+'/'+_0x53d58e)[_0x7f91('0x1b')](_0x5c0b35);}return null;};}function patchUpdates(_0x5733d7){return function(_0x5052c9){try{jsonpatch['apply'](_0x5052c9,_0x5733d7,!![]);}catch(_0x4b6e8e){return BPromise['reject'](_0x4b6e8e);}return _0x5052c9[_0x7f91('0x23')]();};}function saveUpdates(_0x28095a,_0x551d37){return function(_0x17d925){if(_0x17d925){return _0x17d925[_0x7f91('0x24')](_0x28095a)[_0x7f91('0x25')](function(_0x52f4b0){return _0x52f4b0;});}return null;};}function removeEntity(_0x9a23ec,_0x4eeeca){return function(_0x2b4b02){if(_0x2b4b02){return _0x2b4b02['destroy']()[_0x7f91('0x25')](function(){_0x9a23ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3861dd,_0x435556){return function(_0x3e054b){if(!_0x3e054b){_0x3861dd[_0x7f91('0x19')](0x194);}return _0x3e054b;};}function handleError(_0x6ee801,_0x10502f){_0x10502f=_0x10502f||0x1f4;return function(_0x3da416){logger[_0x7f91('0x26')](_0x3da416[_0x7f91('0x27')]);if(_0x3da416['name']){delete _0x3da416[_0x7f91('0x28')];}_0x6ee801['status'](_0x10502f)[_0x7f91('0x29')](_0x3da416);};}exports[_0x7f91('0x2a')]=function(_0x350f4d,_0x39c7c7){var _0x2fe782={},_0x24c74b={},_0x216678={'count':0x0,'rows':[]};var _0x342c21=_[_0x7f91('0x2b')](db[_0x7f91('0x2c')][_0x7f91('0x2d')],function(_0x29c2c1){return{'name':_0x29c2c1[_0x7f91('0x2e')],'type':_0x29c2c1['type']['key']};});_0x24c74b[_0x7f91('0x2f')]=_[_0x7f91('0x2b')](_0x342c21,_0x7f91('0x28'));_0x24c74b['query']=_[_0x7f91('0x30')](_0x350f4d[_0x7f91('0x31')]);_0x24c74b[_0x7f91('0x32')]=_[_0x7f91('0x33')](_0x24c74b[_0x7f91('0x2f')],_0x24c74b['query']);_0x2fe782[_0x7f91('0x34')]=_['intersection'](_0x24c74b['model'],qs[_0x7f91('0x35')](_0x350f4d[_0x7f91('0x31')][_0x7f91('0x35')]));_0x2fe782[_0x7f91('0x34')]=_0x2fe782['attributes'][_0x7f91('0x36')]?_0x2fe782['attributes']:_0x24c74b['model'];if(!_0x350f4d[_0x7f91('0x31')]['hasOwnProperty'](_0x7f91('0x37'))){_0x2fe782['limit']=qs[_0x7f91('0x1e')](_0x350f4d[_0x7f91('0x31')][_0x7f91('0x1e')]);_0x2fe782[_0x7f91('0x1c')]=qs[_0x7f91('0x1c')](_0x350f4d[_0x7f91('0x31')][_0x7f91('0x1c')]);}_0x2fe782['order']=qs[_0x7f91('0x38')](_0x350f4d[_0x7f91('0x31')][_0x7f91('0x38')]);_0x2fe782['where']=qs['filters'](_[_0x7f91('0x39')](_0x350f4d[_0x7f91('0x31')],_0x24c74b['filters']),_0x342c21);if(_0x350f4d[_0x7f91('0x31')]['filter']){_0x2fe782['where']=_['merge'](_0x2fe782['where'],{'$or':_[_0x7f91('0x2b')](_0x342c21,function(_0x14d37b){if(_0x14d37b[_0x7f91('0x3a')]!==_0x7f91('0x3b')){var _0x497498={};_0x497498[_0x14d37b[_0x7f91('0x28')]]={'$like':'%'+_0x350f4d['query']['filter']+'%'};return _0x497498;}})});}_0x2fe782=_['merge']({},_0x2fe782,_0x350f4d[_0x7f91('0x3c')]);var _0x339caa={'where':_0x2fe782[_0x7f91('0x3d')]};return db[_0x7f91('0x2c')][_0x7f91('0x1f')](_0x339caa)[_0x7f91('0x25')](function(_0x5a3b65){_0x216678['count']=_0x5a3b65;if(_0x350f4d[_0x7f91('0x31')]['includeAll']){_0x2fe782[_0x7f91('0x3e')]=[{'all':!![]}];}return db[_0x7f91('0x2c')][_0x7f91('0x3f')](_0x2fe782);})[_0x7f91('0x25')](function(_0xd20f4){_0x216678[_0x7f91('0x40')]=_0xd20f4;return _0x216678;})[_0x7f91('0x25')](respondWithFilteredResult(_0x39c7c7,_0x2fe782))[_0x7f91('0x41')](handleError(_0x39c7c7,null));};exports[_0x7f91('0x42')]=function(_0x232712,_0x39c0ae){var _0x29a1ad={'raw':!![],'where':{'id':_0x232712[_0x7f91('0x43')]['id']}},_0x370ba4={};_0x370ba4['model']=_[_0x7f91('0x30')](db[_0x7f91('0x2c')][_0x7f91('0x2d')]);_0x370ba4[_0x7f91('0x31')]=_['keys'](_0x232712[_0x7f91('0x31')]);_0x370ba4['filters']=_[_0x7f91('0x33')](_0x370ba4['model'],_0x370ba4[_0x7f91('0x31')]);_0x29a1ad[_0x7f91('0x34')]=_['intersection'](_0x370ba4[_0x7f91('0x2f')],qs[_0x7f91('0x35')](_0x232712[_0x7f91('0x31')][_0x7f91('0x35')]));_0x29a1ad[_0x7f91('0x34')]=_0x29a1ad[_0x7f91('0x34')][_0x7f91('0x36')]?_0x29a1ad[_0x7f91('0x34')]:_0x370ba4[_0x7f91('0x2f')];if(_0x232712[_0x7f91('0x31')][_0x7f91('0x44')]){_0x29a1ad[_0x7f91('0x3e')]=[{'all':!![]}];}_0x29a1ad=_[_0x7f91('0x45')]({},_0x29a1ad,_0x232712['options']);return db[_0x7f91('0x2c')]['find'](_0x29a1ad)[_0x7f91('0x25')](handleEntityNotFound(_0x39c0ae,null))[_0x7f91('0x25')](respondWithResult(_0x39c0ae,null))['catch'](handleError(_0x39c0ae,null));};exports[_0x7f91('0x46')]=function(_0xa64e54,_0x57e254){return db['Dynamics365Field']['create'](_0xa64e54[_0x7f91('0x47')],{})['then'](respondWithResult(_0x57e254,0xc9))['catch'](handleError(_0x57e254,null));};exports[_0x7f91('0x24')]=function(_0x181d95,_0x539686){if(_0x181d95[_0x7f91('0x47')]['id']){delete _0x181d95[_0x7f91('0x47')]['id'];}return db[_0x7f91('0x2c')][_0x7f91('0x48')]({'where':{'id':_0x181d95[_0x7f91('0x43')]['id']}})[_0x7f91('0x25')](handleEntityNotFound(_0x539686,null))[_0x7f91('0x25')](saveUpdates(_0x181d95['body'],null))[_0x7f91('0x25')](respondWithResult(_0x539686,null))[_0x7f91('0x41')](handleError(_0x539686,null));};exports['destroy']=function(_0x94540f,_0x315060){return db['Dynamics365Field'][_0x7f91('0x48')]({'where':{'id':_0x94540f['params']['id']}})[_0x7f91('0x25')](handleEntityNotFound(_0x315060,null))[_0x7f91('0x25')](removeEntity(_0x315060,null))[_0x7f91('0x41')](handleError(_0x315060,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a3c03aa..ccd5cba 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 _0xd921=['moment','bluebird','request-promise','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x3736f7,_0xe2b1b4){var _0x4d1960=function(_0x4cb074){while(--_0x4cb074){_0x3736f7['push'](_0x3736f7['shift']());}};_0x4d1960(++_0xe2b1b4);}(_0xd921,0x8c));var _0x1d92=function(_0x39b60d,_0x362130){_0x39b60d=_0x39b60d-0x0;var _0x415dfe=_0xd921[_0x39b60d];return _0x415dfe;};'use strict';var _=require(_0x1d92('0x0'));var util=require('util');var logger=require(_0x1d92('0x1'))(_0x1d92('0x2'));var moment=require(_0x1d92('0x3'));var BPromise=require(_0x1d92('0x4'));var rp=require(_0x1d92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d92('0x6'));module[_0x1d92('0x7')]=function(_0x33d2b8,_0x3dcd70){return _0x33d2b8['define'](_0x1d92('0x8'),attributes,{'tableName':_0x1d92('0x9'),'paranoid':![],'indexes':[{'name':_0x1d92('0xa'),'fields':[_0x1d92('0xb'),_0x1d92('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb96a=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api'];(function(_0x7d29f1,_0x2125b5){var _0x3064aa=function(_0x3e9d04){while(--_0x3e9d04){_0x7d29f1['push'](_0x7d29f1['shift']());}};_0x3064aa(++_0x2125b5);}(_0xb96a,0x1dd));var _0xab96=function(_0x5a95ac,_0x945efe){_0x5a95ac=_0x5a95ac-0x0;var _0x4a241a=_0xb96a[_0x5a95ac];return _0x4a241a;};'use strict';var _=require(_0xab96('0x0'));var util=require(_0xab96('0x1'));var logger=require(_0xab96('0x2'))(_0xab96('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab96('0x4'));var fs=require('fs');var path=require(_0xab96('0x5'));var rimraf=require(_0xab96('0x6'));var config=require(_0xab96('0x7'));var attributes=require(_0xab96('0x8'));module[_0xab96('0x9')]=function(_0x2bb635,_0x8f9eb9){return _0x2bb635[_0xab96('0xa')]('Dynamics365Field',attributes,{'tableName':_0xab96('0xb'),'paranoid':![],'indexes':[{'name':_0xab96('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 369b152..75fbe47 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 _0x4a8d=['Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info'];(function(_0x35fcb7,_0x3734c0){var _0x30f28a=function(_0x1da8bd){while(--_0x1da8bd){_0x35fcb7['push'](_0x35fcb7['shift']());}};_0x30f28a(++_0x3734c0);}(_0x4a8d,0xd0));var _0xd4a8=function(_0x4e5ded,_0x3897b){_0x4e5ded=_0x4e5ded-0x0;var _0x1e2999=_0x4a8d[_0x4e5ded];return _0x1e2999;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4a8('0x0'));var BPromise=require(_0xd4a8('0x1'));var rs=require(_0xd4a8('0x2'));var fs=require('fs');var Redis=require(_0xd4a8('0x3'));var db=require(_0xd4a8('0x4'))['db'];var utils=require(_0xd4a8('0x5'));var logger=require(_0xd4a8('0x6'))('rpc');var config=require(_0xd4a8('0x7'));var jayson=require(_0xd4a8('0x8'));var client=jayson[_0xd4a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4adb83,_0x544519,_0x354873){return new BPromise(function(_0x18bd9e,_0x2f816d){return client[_0xd4a8('0xa')](_0x4adb83,_0x354873)['then'](function(_0x500a1d){logger[_0xd4a8('0xb')](_0xd4a8('0xc'),_0x544519,_0xd4a8('0xd'));logger[_0xd4a8('0xe')](_0xd4a8('0xf'),_0x544519,'request\x20sent',JSON['stringify'](_0x500a1d));if(_0x500a1d['error']){if(_0x500a1d[_0xd4a8('0x10')]['code']===0x1f4){logger[_0xd4a8('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0x500a1d['error']['message']);return _0x2f816d(_0x500a1d['error'][_0xd4a8('0x11')]);}logger[_0xd4a8('0x10')](_0xd4a8('0xc'),_0x544519,_0x500a1d[_0xd4a8('0x10')][_0xd4a8('0x11')]);return _0x18bd9e(_0x500a1d[_0xd4a8('0x10')][_0xd4a8('0x11')]);}else{logger[_0xd4a8('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0xd4a8('0xd'));_0x18bd9e(_0x500a1d[_0xd4a8('0x12')][_0xd4a8('0x11')]);}})[_0xd4a8('0x13')](function(_0x430ef3){logger[_0xd4a8('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x544519,_0x430ef3);_0x2f816d(_0x430ef3);});});} \ No newline at end of file +var _0xaa58=['../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x40bc7d,_0x2ed7c4){var _0x11a274=function(_0x4589b6){while(--_0x4589b6){_0x40bc7d['push'](_0x40bc7d['shift']());}};_0x11a274(++_0x2ed7c4);}(_0xaa58,0x11f));var _0x8aa5=function(_0x1e59b7,_0x2ec1b5){_0x1e59b7=_0x1e59b7-0x0;var _0x18f52c=_0xaa58[_0x1e59b7];return _0x18f52c;};'use strict';var _=require('lodash');var util=require(_0x8aa5('0x0'));var moment=require(_0x8aa5('0x1'));var BPromise=require(_0x8aa5('0x2'));var rs=require(_0x8aa5('0x3'));var fs=require('fs');var Redis=require(_0x8aa5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8aa5('0x5'));var logger=require(_0x8aa5('0x6'))('rpc');var config=require(_0x8aa5('0x7'));var jayson=require(_0x8aa5('0x8'));var client=jayson['client'][_0x8aa5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42e62f,_0x15475a,_0x42e950){return new BPromise(function(_0x33fca5,_0x1e39b5){return client[_0x8aa5('0xa')](_0x42e62f,_0x42e950)[_0x8aa5('0xb')](function(_0x4321be){logger[_0x8aa5('0xc')](_0x8aa5('0xd'),_0x15475a,_0x8aa5('0xe'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x15475a,_0x8aa5('0xe'),JSON[_0x8aa5('0xf')](_0x4321be));if(_0x4321be[_0x8aa5('0x10')]){if(_0x4321be['error'][_0x8aa5('0x11')]===0x1f4){logger['error'](_0x8aa5('0xd'),_0x15475a,_0x4321be['error'][_0x8aa5('0x12')]);return _0x1e39b5(_0x4321be[_0x8aa5('0x10')][_0x8aa5('0x12')]);}logger[_0x8aa5('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x15475a,_0x4321be[_0x8aa5('0x10')]['message']);return _0x33fca5(_0x4321be[_0x8aa5('0x10')][_0x8aa5('0x12')]);}else{logger[_0x8aa5('0xc')](_0x8aa5('0xd'),_0x15475a,_0x8aa5('0xe'));_0x33fca5(_0x4321be[_0x8aa5('0x13')][_0x8aa5('0x12')]);}})[_0x8aa5('0x14')](function(_0x35e68f){logger[_0x8aa5('0x10')](_0x8aa5('0xd'),_0x15475a,_0x35e68f);_0x1e39b5(_0x35e68f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6caf9fe..7d91497 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 _0xe151=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0xbca703,_0x28bbae){var _0x427143=function(_0x159e05){while(--_0x159e05){_0xbca703['push'](_0xbca703['shift']());}};_0x427143(++_0x28bbae);}(_0xe151,0x67));var _0x1e15=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0xe151[_0x4be3e7];return _0x4d44a0;};'use strict';var multer=require(_0x1e15('0x0'));var util=require('util');var path=require(_0x1e15('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e15('0x2')]();var fs_extra=require(_0x1e15('0x3'));var auth=require(_0x1e15('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1e15('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x1e15('0x6')]('/',auth[_0x1e15('0x7')](),controller[_0x1e15('0x8')]);router[_0x1e15('0x6')](_0x1e15('0x9'),auth[_0x1e15('0x7')](),controller[_0x1e15('0xa')]);router[_0x1e15('0x6')](_0x1e15('0xb'),auth[_0x1e15('0x7')](),controller['getConfigurations']);router[_0x1e15('0x6')](_0x1e15('0xc'),auth[_0x1e15('0x7')](),controller[_0x1e15('0xd')]);router[_0x1e15('0xe')]('/',auth[_0x1e15('0x7')](),controller[_0x1e15('0xf')]);router[_0x1e15('0xe')](_0x1e15('0xb'),auth[_0x1e15('0x7')](),controller[_0x1e15('0x10')]);router[_0x1e15('0x11')]('/:id',auth[_0x1e15('0x7')](),controller[_0x1e15('0x12')]);router[_0x1e15('0x13')](_0x1e15('0x9'),auth['isAuthenticated'](),controller[_0x1e15('0x14')]);module[_0x1e15('0x15')]=router; \ No newline at end of file +var _0xaeb6=['getFields','post','/:id/configurations','put','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields'];(function(_0x45a3d3,_0x168455){var _0x589c83=function(_0x529853){while(--_0x529853){_0x45a3d3['push'](_0x45a3d3['shift']());}};_0x589c83(++_0x168455);}(_0xaeb6,0x1a9));var _0x6aeb=function(_0x4be31a,_0xc12132){_0x4be31a=_0x4be31a-0x0;var _0x1321dc=_0xaeb6[_0x4be31a];return _0x1321dc;};'use strict';var multer=require(_0x6aeb('0x0'));var util=require(_0x6aeb('0x1'));var path=require(_0x6aeb('0x2'));var timeout=require('connect-timeout');var express=require(_0x6aeb('0x3'));var router=express[_0x6aeb('0x4')]();var fs_extra=require(_0x6aeb('0x5'));var auth=require(_0x6aeb('0x6'));var interaction=require(_0x6aeb('0x7'));var config=require(_0x6aeb('0x8'));var controller=require(_0x6aeb('0x9'));router[_0x6aeb('0xa')]('/',auth[_0x6aeb('0xb')](),controller['index']);router[_0x6aeb('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6aeb('0xc')]);router[_0x6aeb('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x6aeb('0xd')]);router[_0x6aeb('0xa')](_0x6aeb('0xe'),auth[_0x6aeb('0xb')](),controller[_0x6aeb('0xf')]);router[_0x6aeb('0x10')]('/',auth[_0x6aeb('0xb')](),controller['create']);router[_0x6aeb('0x10')](_0x6aeb('0x11'),auth[_0x6aeb('0xb')](),controller['addConfiguration']);router[_0x6aeb('0x12')](_0x6aeb('0x13'),auth[_0x6aeb('0xb')](),controller['update']);router['delete'](_0x6aeb('0x13'),auth[_0x6aeb('0xb')](),controller[_0x6aeb('0x14')]);module[_0x6aeb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b9f778e..1f79ebc 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 _0x3423=['username','remoteUri','STRING'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')]},'description':{'type':Sequelize[_0x3342('0x0')]},'username':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x1')},'apiKey':{'type':Sequelize[_0x3342('0x0')]},'remoteUri':{'type':Sequelize[_0x3342('0x0')],'unique':_0x3342('0x2')},'serverUrl':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x24fe48,_0x10e97e){var _0x51e7d5=function(_0x5826c1){while(--_0x5826c1){_0x24fe48['push'](_0x24fe48['shift']());}};_0x51e7d5(++_0x10e97e);}(_0x32b6,0x1d1));var _0x632b=function(_0x2ef7a9,_0x483d5b){_0x2ef7a9=_0x2ef7a9-0x0;var _0x1375ff=_0x32b6[_0x2ef7a9];return _0x1375ff;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 50f3529..9461d89 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 _0xab3a=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','remoteUri','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xab3a,0x1d3));var _0xaab3=function(_0x2fd02e,_0x8ebcc5){_0x2fd02e=_0x2fd02e-0x0;var _0x4d7f54=_0xab3a[_0x2fd02e];return _0x4d7f54;};'use strict';var emlformat=require(_0xaab3('0x0'));var rimraf=require(_0xaab3('0x1'));var zipdir=require(_0xaab3('0x2'));var jsonpatch=require(_0xaab3('0x3'));var rp=require(_0xaab3('0x4'));var moment=require(_0xaab3('0x5'));var BPromise=require(_0xaab3('0x6'));var Mustache=require(_0xaab3('0x7'));var util=require(_0xaab3('0x8'));var path=require(_0xaab3('0x9'));var sox=require(_0xaab3('0xa'));var csv=require(_0xaab3('0xb'));var ejs=require(_0xaab3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaab3('0xd'));var crypto=require(_0xaab3('0xe'));var jsforce=require(_0xaab3('0xf'));var deskjs=require(_0xaab3('0x10'));var toCsv=require(_0xaab3('0xb'));var querystring=require(_0xaab3('0x11'));var Papa=require(_0xaab3('0x12'));var Redis=require(_0xaab3('0x13'));var authService=require(_0xaab3('0x14'));var qs=require(_0xaab3('0x15'));var as=require(_0xaab3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaab3('0x17'));var utils=require(_0xaab3('0x18'));var config=require(_0xaab3('0x19'));var licenseUtil=require(_0xaab3('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xaab3('0x1b'));function respondWithStatusCode(_0x536fd2,_0x1be7b2){_0x1be7b2=_0x1be7b2||0xcc;return function(_0x517cb3){if(_0x517cb3){return _0x536fd2[_0xaab3('0x1c')](_0x1be7b2);}return _0x536fd2[_0xaab3('0x1d')](_0x1be7b2)[_0xaab3('0x1e')]();};}function respondWithResult(_0x553449,_0x43ca09){_0x43ca09=_0x43ca09||0xc8;return function(_0x42b5a1){if(_0x42b5a1){return _0x553449['status'](_0x43ca09)[_0xaab3('0x1f')](_0x42b5a1);}};}function respondWithFilteredResult(_0xcc28ed,_0x2aea7a){return function(_0x5dbe3e){if(_0x5dbe3e){var _0x4f3f96=typeof _0x2aea7a['offset']==='undefined'&&typeof _0x2aea7a[_0xaab3('0x20')]===_0xaab3('0x21');var _0x21bae7=_0x5dbe3e['count'];var _0x3052a5=_0x4f3f96?0x0:_0x2aea7a[_0xaab3('0x22')];var _0x3a06f2=_0x4f3f96?_0x5dbe3e[_0xaab3('0x23')]:_0x2aea7a[_0xaab3('0x22')]+_0x2aea7a[_0xaab3('0x20')];var _0x4649e0;if(_0x3a06f2>=_0x21bae7){_0x3a06f2=_0x21bae7;_0x4649e0=0xc8;}else{_0x4649e0=0xce;}_0xcc28ed['status'](_0x4649e0);return _0xcc28ed[_0xaab3('0x24')](_0xaab3('0x25'),_0x3052a5+'-'+_0x3a06f2+'/'+_0x21bae7)[_0xaab3('0x1f')](_0x5dbe3e);}return null;};}function patchUpdates(_0x3588a9){return function(_0xbd23c2){try{jsonpatch['apply'](_0xbd23c2,_0x3588a9,!![]);}catch(_0x5ac359){return BPromise['reject'](_0x5ac359);}return _0xbd23c2['save']();};}function saveUpdates(_0x5d7bf6,_0x1fa934){return function(_0x1bef55){if(_0x1bef55){return _0x1bef55[_0xaab3('0x26')](_0x5d7bf6)[_0xaab3('0x27')](function(_0xaebe3e){return _0xaebe3e;});}return null;};}function removeEntity(_0x1816ab,_0x3c552f){return function(_0xa8e660){if(_0xa8e660){return _0xa8e660[_0xaab3('0x28')]()[_0xaab3('0x27')](function(){_0x1816ab[_0xaab3('0x1d')](0xcc)[_0xaab3('0x1e')]();});}};}function handleEntityNotFound(_0x1199c1,_0x4dd8fe){return function(_0x1b2ee6){if(!_0x1b2ee6){_0x1199c1['sendStatus'](0x194);}return _0x1b2ee6;};}function handleError(_0x28eaff,_0x2904f8){_0x2904f8=_0x2904f8||0x1f4;return function(_0x5c9bd7){logger[_0xaab3('0x29')](_0x5c9bd7[_0xaab3('0x2a')]);if(_0x5c9bd7[_0xaab3('0x2b')]){delete _0x5c9bd7['name'];}_0x28eaff['status'](_0x2904f8)[_0xaab3('0x2c')](_0x5c9bd7);};}exports[_0xaab3('0x2d')]=function(_0x2738ea,_0x4a7558){var _0x168eb0={},_0x21e0d9={},_0x15f8e2={'count':0x0,'rows':[]};var _0x33901e=_[_0xaab3('0x2e')](db[_0xaab3('0x2f')][_0xaab3('0x30')],function(_0x42d22c){return{'name':_0x42d22c[_0xaab3('0x31')],'type':_0x42d22c[_0xaab3('0x32')][_0xaab3('0x33')]};});_0x21e0d9[_0xaab3('0x34')]=_[_0xaab3('0x2e')](_0x33901e,_0xaab3('0x2b'));_0x21e0d9['query']=_[_0xaab3('0x35')](_0x2738ea[_0xaab3('0x36')]);_0x21e0d9[_0xaab3('0x37')]=_[_0xaab3('0x38')](_0x21e0d9[_0xaab3('0x34')],_0x21e0d9[_0xaab3('0x36')]);_0x168eb0['attributes']=_[_0xaab3('0x38')](_0x21e0d9['model'],qs['fields'](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x39')]));_0x168eb0['attributes']=_0x168eb0['attributes'][_0xaab3('0x3a')]?_0x168eb0[_0xaab3('0x3b')]:_0x21e0d9[_0xaab3('0x34')];if(!_0x2738ea['query'][_0xaab3('0x3c')](_0xaab3('0x3d'))){_0x168eb0[_0xaab3('0x20')]=qs['limit'](_0x2738ea['query'][_0xaab3('0x20')]);_0x168eb0[_0xaab3('0x22')]=qs[_0xaab3('0x22')](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x22')]);}_0x168eb0[_0xaab3('0x3e')]=qs['sort'](_0x2738ea[_0xaab3('0x36')][_0xaab3('0x3f')]);_0x168eb0[_0xaab3('0x40')]=qs['filters'](_[_0xaab3('0x41')](_0x2738ea[_0xaab3('0x36')],_0x21e0d9[_0xaab3('0x37')]),_0x33901e);if(_0x2738ea[_0xaab3('0x36')][_0xaab3('0x42')]){_0x168eb0[_0xaab3('0x40')]=_['merge'](_0x168eb0['where'],{'$or':_[_0xaab3('0x2e')](_0x33901e,function(_0xaa8326){if(_0xaa8326['type']!=='VIRTUAL'){var _0x132ac7={};_0x132ac7[_0xaa8326[_0xaab3('0x2b')]]={'$like':'%'+_0x2738ea['query'][_0xaab3('0x42')]+'%'};return _0x132ac7;}})});}_0x168eb0=_[_0xaab3('0x43')]({},_0x168eb0,_0x2738ea[_0xaab3('0x44')]);var _0x3006e0={'where':_0x168eb0['where']};return db[_0xaab3('0x2f')][_0xaab3('0x23')](_0x3006e0)['then'](function(_0xc2186d){_0x15f8e2['count']=_0xc2186d;if(_0x2738ea[_0xaab3('0x36')][_0xaab3('0x45')]){_0x168eb0[_0xaab3('0x46')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xaab3('0x47')](_0x168eb0);})[_0xaab3('0x27')](function(_0x2d1fbb){_0x15f8e2['rows']=_0x2d1fbb;return _0x15f8e2;})[_0xaab3('0x27')](respondWithFilteredResult(_0x4a7558,_0x168eb0))[_0xaab3('0x48')](handleError(_0x4a7558,null));};exports[_0xaab3('0x49')]=function(_0x2786e2,_0x2277a9){var _0x2e57cf={'raw':![],'where':{'id':_0x2786e2[_0xaab3('0x4a')]['id']}},_0x4a1d46={};_0x4a1d46[_0xaab3('0x34')]=_[_0xaab3('0x35')](db[_0xaab3('0x2f')][_0xaab3('0x30')]);_0x4a1d46[_0xaab3('0x36')]=_[_0xaab3('0x35')](_0x2786e2[_0xaab3('0x36')]);_0x4a1d46[_0xaab3('0x37')]=_[_0xaab3('0x38')](_0x4a1d46[_0xaab3('0x34')],_0x4a1d46[_0xaab3('0x36')]);_0x2e57cf['attributes']=_[_0xaab3('0x38')](_0x4a1d46[_0xaab3('0x34')],qs[_0xaab3('0x39')](_0x2786e2[_0xaab3('0x36')]['fields']));_0x2e57cf[_0xaab3('0x3b')]=_0x2e57cf[_0xaab3('0x3b')][_0xaab3('0x3a')]?_0x2e57cf['attributes']:_0x4a1d46['model'];if(_0x2786e2['query'][_0xaab3('0x45')]){_0x2e57cf[_0xaab3('0x46')]=[{'all':!![]}];}_0x2e57cf=_['merge']({},_0x2e57cf,_0x2786e2[_0xaab3('0x44')]);return db[_0xaab3('0x2f')][_0xaab3('0x4b')](_0x2e57cf)[_0xaab3('0x27')](handleEntityNotFound(_0x2277a9,null))[_0xaab3('0x27')](respondWithResult(_0x2277a9,null))[_0xaab3('0x48')](handleError(_0x2277a9,null));};exports[_0xaab3('0x4c')]=function(_0x15ff7d,_0x4ce820){return db[_0xaab3('0x2f')][_0xaab3('0x4c')](_0x15ff7d[_0xaab3('0x4d')],{})[_0xaab3('0x27')](respondWithResult(_0x4ce820,0xc9))[_0xaab3('0x48')](handleError(_0x4ce820,null));};exports['update']=function(_0x2a774e,_0x5b7d33){if(_0x2a774e['body']['id']){delete _0x2a774e['body']['id'];}return db['FreshdeskAccount'][_0xaab3('0x4b')]({'where':{'id':_0x2a774e[_0xaab3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5b7d33,null))[_0xaab3('0x27')](saveUpdates(_0x2a774e[_0xaab3('0x4d')],null))[_0xaab3('0x27')](respondWithResult(_0x5b7d33,null))[_0xaab3('0x48')](handleError(_0x5b7d33,null));};exports['destroy']=function(_0x27962d,_0x3454cc){return db[_0xaab3('0x2f')][_0xaab3('0x4b')]({'where':{'id':_0x27962d['params']['id']}})[_0xaab3('0x27')](handleEntityNotFound(_0x3454cc,null))[_0xaab3('0x27')](removeEntity(_0x3454cc,null))[_0xaab3('0x48')](handleError(_0x3454cc,null));};exports[_0xaab3('0x4e')]=function(_0x15b533,_0x38536c,_0x29e19a){var _0xbf901f={};var _0x37ebfb={};var _0x19e8f1;var _0x58e304;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x15b533[_0xaab3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38536c,null))[_0xaab3('0x27')](function(_0x3cf171){if(_0x3cf171){_0x19e8f1=_0x3cf171;_0x37ebfb[_0xaab3('0x34')]=_[_0xaab3('0x35')](db[_0xaab3('0x4f')][_0xaab3('0x30')]);_0x37ebfb[_0xaab3('0x36')]=_[_0xaab3('0x35')](_0x15b533['query']);_0x37ebfb['filters']=_[_0xaab3('0x38')](_0x37ebfb[_0xaab3('0x34')],_0x37ebfb[_0xaab3('0x36')]);_0xbf901f[_0xaab3('0x3b')]=_['intersection'](_0x37ebfb[_0xaab3('0x34')],qs[_0xaab3('0x39')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x39')]));_0xbf901f[_0xaab3('0x3b')]=_0xbf901f[_0xaab3('0x3b')]['length']?_0xbf901f['attributes']:_0x37ebfb['model'];_0xbf901f[_0xaab3('0x3e')]=qs[_0xaab3('0x3f')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x3f')]);_0xbf901f[_0xaab3('0x40')]=qs[_0xaab3('0x37')](_['pick'](_0x15b533[_0xaab3('0x36')],_0x37ebfb[_0xaab3('0x37')]));if(_0x15b533[_0xaab3('0x36')][_0xaab3('0x42')]){_0xbf901f[_0xaab3('0x40')]=_[_0xaab3('0x43')](_0xbf901f[_0xaab3('0x40')],{'$or':_[_0xaab3('0x2e')](_0xbf901f['attributes'],function(_0x5b3e1a){var _0x59a165={};_0x59a165[_0x5b3e1a]={'$like':'%'+_0x15b533[_0xaab3('0x36')][_0xaab3('0x42')]+'%'};return _0x59a165;})});}_0xbf901f=_[_0xaab3('0x43')]({},_0xbf901f,_0x15b533[_0xaab3('0x44')]);return _0x19e8f1[_0xaab3('0x4e')](_0xbf901f);}})[_0xaab3('0x27')](function(_0x5c801d){if(_0x5c801d){_0x58e304=_0x5c801d[_0xaab3('0x3a')];if(!_0x15b533[_0xaab3('0x36')][_0xaab3('0x3c')](_0xaab3('0x3d'))){_0xbf901f[_0xaab3('0x20')]=qs[_0xaab3('0x20')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x20')]);_0xbf901f[_0xaab3('0x22')]=qs[_0xaab3('0x22')](_0x15b533[_0xaab3('0x36')][_0xaab3('0x22')]);}return _0x19e8f1['getConfigurations'](_0xbf901f);}})[_0xaab3('0x27')](function(_0x4230c1){if(_0x4230c1){return _0x4230c1?{'count':_0x58e304,'rows':_0x4230c1}:null;}})[_0xaab3('0x27')](respondWithResult(_0x38536c,null))['catch'](handleError(_0x38536c,null));};exports[_0xaab3('0x50')]=function(_0x13885d,_0x4faf63,_0x449a8a){if(_0x13885d[_0xaab3('0x4d')]['id']){delete _0x13885d['body']['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x13885d[_0xaab3('0x4a')]['id']}})[_0xaab3('0x27')](handleEntityNotFound(_0x4faf63,null))[_0xaab3('0x27')](function(_0x33a1b9){if(_0x33a1b9){_0x13885d[_0xaab3('0x4d')][_0xaab3('0x51')]=_0x33a1b9['id'];_0x13885d[_0xaab3('0x4d')]['Subjects']=integrations[_0xaab3('0x52')](_0x13885d[_0xaab3('0x4d')]['channel'],_0x13885d[_0xaab3('0x4d')][_0xaab3('0x32')]);_0x13885d[_0xaab3('0x4d')][_0xaab3('0x53')]=integrations[_0xaab3('0x54')](_0x13885d[_0xaab3('0x4d')][_0xaab3('0x55')],_0x13885d[_0xaab3('0x4d')]['type']);return db['FreshdeskConfiguration'][_0xaab3('0x4c')](_0x13885d[_0xaab3('0x4d')],{'include':[{'model':db[_0xaab3('0x56')],'as':_0xaab3('0x57')},{'model':db[_0xaab3('0x56')],'as':_0xaab3('0x53')}]});}return null;})[_0xaab3('0x27')](respondWithResult(_0x4faf63,null))['catch'](handleError(_0x4faf63,null));};exports[_0xaab3('0x58')]=function(_0x13ebc3,_0x21da6d,_0x2fc7fe){var _0xc2061f='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x13ebc3[_0xaab3('0x4a')]['id']},'attributes':['id','remoteUri','apiKey']})[_0xaab3('0x27')](handleEntityNotFound(_0x21da6d,null))[_0xaab3('0x27')](function(_0x4b4d65){if(_0x4b4d65){_0xc2061f=_0x4b4d65[_0xaab3('0x59')];var _0x4b8c7d=_0xc2061f[_0xaab3('0x5a')](-0x1);if(_0x4b8c7d==='/'){_0xc2061f=_0xc2061f[_0xaab3('0x5b')](0x0,_0xc2061f['lastIndexOf'](_0x4b8c7d));}return rp({'method':_0xaab3('0x5c'),'uri':util[_0xaab3('0x5d')](_0xaab3('0x5e'),_0xc2061f,_0xaab3('0x5f')),'headers':{'Authorization':util[_0xaab3('0x5d')](_0xaab3('0x60'),new Buffer(util[_0xaab3('0x5d')](_0xaab3('0x61'),_0x4b4d65[_0xaab3('0x62')]))[_0xaab3('0x63')](_0xaab3('0x64')))},'json':!![]});}})['then'](function(_0xf8a125){if(_0xf8a125){var _0x492827=[_0xaab3('0x65'),'subject',_0xaab3('0x66'),_0xaab3('0x67'),_0xaab3('0x1d'),_0xaab3('0x68'),_0xaab3('0x69'),_0xaab3('0x6a'),_0xaab3('0x6b'),'group',_0xaab3('0x6c')];_['remove'](_0xf8a125,function(_0x2fcb0d){return _0x492827[_0xaab3('0x6d')](_0x2fcb0d['name'])||!_0x2fcb0d[_0xaab3('0x6e')]&&_0x2fcb0d['type']!==_0xaab3('0x6f')&&_0x2fcb0d['type']!==_0xaab3('0x70');});return{'count':_0xf8a125[_0xaab3('0x3a')],'rows':_[_0xaab3('0x2e')](_0xf8a125,function(_0x179ef0){return{'id':_0x179ef0[_0xaab3('0x2b')],'name':_0x179ef0[_0xaab3('0x71')],'custom':!_0x179ef0[_0xaab3('0x6e')],'options':_0x179ef0['choices']?_[_0xaab3('0x2e')](_0x179ef0[_0xaab3('0x72')],function(_0x1592dc){return{'name':_['capitalize'](_0x1592dc),'value':_0x1592dc};}):[]};})};}})[_0xaab3('0x27')](respondWithResult(_0x21da6d,null))['catch'](function(_0x574adb){var _0x1bcd8b=_0x13ebc3['query'][_0xaab3('0x73')]?0x1f4:_0x574adb[_0xaab3('0x74')]||0x1f4;logger[_0xaab3('0x29')](_0xaab3('0x75'),'getFields',_0x1bcd8b,JSON[_0xaab3('0x76')](_0x574adb));delete _0x574adb[_0xaab3('0x2b')];if(_0x1bcd8b===0x191){_0x1bcd8b=0x190;}_0x21da6d[_0xaab3('0x1d')](_0x1bcd8b)[_0xaab3('0x2c')](_0x13ebc3[_0xaab3('0x36')][_0xaab3('0x73')]?{'message':_0xaab3('0x77'),'statusCode':_0x574adb[_0xaab3('0x74')]}:_0x574adb);});}; \ No newline at end of file +var _0x4de7=['format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','then','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshdeskField','Subjects','getFields','slice','substring','lastIndexOf','GET'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x4de7,0x1f3));var _0x74de=function(_0x5acb82,_0x4bada3){_0x5acb82=_0x5acb82-0x0;var _0x48d8f8=_0x4de7[_0x5acb82];return _0x48d8f8;};'use strict';var emlformat=require(_0x74de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74de('0x1'));var jsonpatch=require(_0x74de('0x2'));var rp=require(_0x74de('0x3'));var moment=require(_0x74de('0x4'));var BPromise=require(_0x74de('0x5'));var Mustache=require('mustache');var util=require(_0x74de('0x6'));var path=require(_0x74de('0x7'));var sox=require(_0x74de('0x8'));var csv=require('to-csv');var ejs=require(_0x74de('0x9'));var fs=require('fs');var fs_extra=require(_0x74de('0xa'));var _=require(_0x74de('0xb'));var squel=require(_0x74de('0xc'));var crypto=require(_0x74de('0xd'));var jsforce=require(_0x74de('0xe'));var deskjs=require(_0x74de('0xf'));var toCsv=require(_0x74de('0x10'));var querystring=require(_0x74de('0x11'));var Papa=require(_0x74de('0x12'));var Redis=require('ioredis');var authService=require(_0x74de('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x74de('0x14'));var hardwareService=require(_0x74de('0x15'));var logger=require('../../config/logger')(_0x74de('0x16'));var utils=require(_0x74de('0x17'));var config=require(_0x74de('0x18'));var licenseUtil=require(_0x74de('0x19'));var db=require(_0x74de('0x1a'))['db'];var integrations=require(_0x74de('0x1b'));function respondWithStatusCode(_0x4ee614,_0x26f408){_0x26f408=_0x26f408||0xcc;return function(_0x4e66c0){if(_0x4e66c0){return _0x4ee614[_0x74de('0x1c')](_0x26f408);}return _0x4ee614[_0x74de('0x1d')](_0x26f408)[_0x74de('0x1e')]();};}function respondWithResult(_0x4ecd59,_0x35da91){_0x35da91=_0x35da91||0xc8;return function(_0x20b6f7){if(_0x20b6f7){return _0x4ecd59['status'](_0x35da91)[_0x74de('0x1f')](_0x20b6f7);}};}function respondWithFilteredResult(_0x3d3fee,_0x3dff38){return function(_0x431d99){if(_0x431d99){var _0x380c9c=typeof _0x3dff38[_0x74de('0x20')]===_0x74de('0x21')&&typeof _0x3dff38['limit']==='undefined';var _0x5c4732=_0x431d99[_0x74de('0x22')];var _0x20d524=_0x380c9c?0x0:_0x3dff38[_0x74de('0x20')];var _0x1e49a0=_0x380c9c?_0x431d99[_0x74de('0x22')]:_0x3dff38['offset']+_0x3dff38[_0x74de('0x23')];var _0x31872f;if(_0x1e49a0>=_0x5c4732){_0x1e49a0=_0x5c4732;_0x31872f=0xc8;}else{_0x31872f=0xce;}_0x3d3fee[_0x74de('0x1d')](_0x31872f);return _0x3d3fee['set'](_0x74de('0x24'),_0x20d524+'-'+_0x1e49a0+'/'+_0x5c4732)[_0x74de('0x1f')](_0x431d99);}return null;};}function patchUpdates(_0x439578){return function(_0x9ba11){try{jsonpatch['apply'](_0x9ba11,_0x439578,!![]);}catch(_0x52d825){return BPromise['reject'](_0x52d825);}return _0x9ba11['save']();};}function saveUpdates(_0x13c314,_0x3f7a12){return function(_0x57edf1){if(_0x57edf1){return _0x57edf1['update'](_0x13c314)[_0x74de('0x25')](function(_0x4032e1){return _0x4032e1;});}return null;};}function removeEntity(_0x44cdc4,_0x512047){return function(_0x5ad04f){if(_0x5ad04f){return _0x5ad04f['destroy']()['then'](function(){_0x44cdc4[_0x74de('0x1d')](0xcc)[_0x74de('0x1e')]();});}};}function handleEntityNotFound(_0x36b4f8,_0x3806e9){return function(_0x4f6029){if(!_0x4f6029){_0x36b4f8[_0x74de('0x1c')](0x194);}return _0x4f6029;};}function handleError(_0x37626b,_0x3bb092){_0x3bb092=_0x3bb092||0x1f4;return function(_0x10203a){logger[_0x74de('0x26')](_0x10203a[_0x74de('0x27')]);if(_0x10203a[_0x74de('0x28')]){delete _0x10203a[_0x74de('0x28')];}_0x37626b[_0x74de('0x1d')](_0x3bb092)[_0x74de('0x29')](_0x10203a);};}exports[_0x74de('0x2a')]=function(_0x542e96,_0x547d39){var _0x1d3504={},_0x15fe1b={},_0x31147f={'count':0x0,'rows':[]};var _0x5766e2=_[_0x74de('0x2b')](db[_0x74de('0x2c')]['rawAttributes'],function(_0x1cd58b){return{'name':_0x1cd58b[_0x74de('0x2d')],'type':_0x1cd58b[_0x74de('0x2e')]['key']};});_0x15fe1b[_0x74de('0x2f')]=_[_0x74de('0x2b')](_0x5766e2,_0x74de('0x28'));_0x15fe1b[_0x74de('0x30')]=_[_0x74de('0x31')](_0x542e96[_0x74de('0x30')]);_0x15fe1b[_0x74de('0x32')]=_['intersection'](_0x15fe1b['model'],_0x15fe1b[_0x74de('0x30')]);_0x1d3504[_0x74de('0x33')]=_[_0x74de('0x34')](_0x15fe1b[_0x74de('0x2f')],qs[_0x74de('0x35')](_0x542e96[_0x74de('0x30')][_0x74de('0x35')]));_0x1d3504['attributes']=_0x1d3504[_0x74de('0x33')]['length']?_0x1d3504['attributes']:_0x15fe1b[_0x74de('0x2f')];if(!_0x542e96['query'][_0x74de('0x36')](_0x74de('0x37'))){_0x1d3504[_0x74de('0x23')]=qs['limit'](_0x542e96[_0x74de('0x30')][_0x74de('0x23')]);_0x1d3504['offset']=qs['offset'](_0x542e96[_0x74de('0x30')][_0x74de('0x20')]);}_0x1d3504['order']=qs[_0x74de('0x38')](_0x542e96[_0x74de('0x30')]['sort']);_0x1d3504[_0x74de('0x39')]=qs[_0x74de('0x32')](_[_0x74de('0x3a')](_0x542e96[_0x74de('0x30')],_0x15fe1b['filters']),_0x5766e2);if(_0x542e96[_0x74de('0x30')]['filter']){_0x1d3504[_0x74de('0x39')]=_[_0x74de('0x3b')](_0x1d3504['where'],{'$or':_[_0x74de('0x2b')](_0x5766e2,function(_0x563d3b){if(_0x563d3b['type']!==_0x74de('0x3c')){var _0x1edcac={};_0x1edcac[_0x563d3b['name']]={'$like':'%'+_0x542e96[_0x74de('0x30')][_0x74de('0x3d')]+'%'};return _0x1edcac;}})});}_0x1d3504=_[_0x74de('0x3b')]({},_0x1d3504,_0x542e96['options']);var _0x595fca={'where':_0x1d3504[_0x74de('0x39')]};return db[_0x74de('0x2c')][_0x74de('0x22')](_0x595fca)[_0x74de('0x25')](function(_0x1315c3){_0x31147f[_0x74de('0x22')]=_0x1315c3;if(_0x542e96[_0x74de('0x30')][_0x74de('0x3e')]){_0x1d3504[_0x74de('0x3f')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1d3504);})['then'](function(_0x3c0574){_0x31147f[_0x74de('0x40')]=_0x3c0574;return _0x31147f;})[_0x74de('0x25')](respondWithFilteredResult(_0x547d39,_0x1d3504))[_0x74de('0x41')](handleError(_0x547d39,null));};exports[_0x74de('0x42')]=function(_0x472581,_0x1160c3){var _0x46812e={'raw':![],'where':{'id':_0x472581[_0x74de('0x43')]['id']}},_0x8261b6={};_0x8261b6[_0x74de('0x2f')]=_[_0x74de('0x31')](db['FreshdeskAccount'][_0x74de('0x44')]);_0x8261b6[_0x74de('0x30')]=_[_0x74de('0x31')](_0x472581[_0x74de('0x30')]);_0x8261b6[_0x74de('0x32')]=_[_0x74de('0x34')](_0x8261b6[_0x74de('0x2f')],_0x8261b6[_0x74de('0x30')]);_0x46812e[_0x74de('0x33')]=_['intersection'](_0x8261b6[_0x74de('0x2f')],qs[_0x74de('0x35')](_0x472581[_0x74de('0x30')][_0x74de('0x35')]));_0x46812e[_0x74de('0x33')]=_0x46812e[_0x74de('0x33')]['length']?_0x46812e['attributes']:_0x8261b6['model'];if(_0x472581[_0x74de('0x30')][_0x74de('0x3e')]){_0x46812e['include']=[{'all':!![]}];}_0x46812e=_['merge']({},_0x46812e,_0x472581[_0x74de('0x45')]);return db['FreshdeskAccount'][_0x74de('0x46')](_0x46812e)[_0x74de('0x25')](handleEntityNotFound(_0x1160c3,null))[_0x74de('0x25')](respondWithResult(_0x1160c3,null))['catch'](handleError(_0x1160c3,null));};exports[_0x74de('0x47')]=function(_0x132ed9,_0x193012){return db[_0x74de('0x2c')][_0x74de('0x47')](_0x132ed9[_0x74de('0x48')],{})[_0x74de('0x25')](respondWithResult(_0x193012,0xc9))[_0x74de('0x41')](handleError(_0x193012,null));};exports['update']=function(_0x364043,_0x1f105a){if(_0x364043['body']['id']){delete _0x364043[_0x74de('0x48')]['id'];}return db[_0x74de('0x2c')][_0x74de('0x46')]({'where':{'id':_0x364043[_0x74de('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f105a,null))['then'](saveUpdates(_0x364043['body'],null))[_0x74de('0x25')](respondWithResult(_0x1f105a,null))[_0x74de('0x41')](handleError(_0x1f105a,null));};exports[_0x74de('0x49')]=function(_0xc245c6,_0x2ef9c3){return db[_0x74de('0x2c')][_0x74de('0x46')]({'where':{'id':_0xc245c6[_0x74de('0x43')]['id']}})[_0x74de('0x25')](handleEntityNotFound(_0x2ef9c3,null))['then'](removeEntity(_0x2ef9c3,null))[_0x74de('0x41')](handleError(_0x2ef9c3,null));};exports[_0x74de('0x4a')]=function(_0x86b4cd,_0x425f02,_0x1a0561){var _0x45223b={};var _0x1c028f={};var _0xc7f622;var _0x1706d2;return db[_0x74de('0x2c')][_0x74de('0x4b')]({'where':{'id':_0x86b4cd['params']['id']}})['then'](handleEntityNotFound(_0x425f02,null))[_0x74de('0x25')](function(_0x45a03c){if(_0x45a03c){_0xc7f622=_0x45a03c;_0x1c028f['model']=_[_0x74de('0x31')](db[_0x74de('0x4c')][_0x74de('0x44')]);_0x1c028f[_0x74de('0x30')]=_[_0x74de('0x31')](_0x86b4cd[_0x74de('0x30')]);_0x1c028f[_0x74de('0x32')]=_[_0x74de('0x34')](_0x1c028f[_0x74de('0x2f')],_0x1c028f[_0x74de('0x30')]);_0x45223b[_0x74de('0x33')]=_[_0x74de('0x34')](_0x1c028f[_0x74de('0x2f')],qs[_0x74de('0x35')](_0x86b4cd[_0x74de('0x30')]['fields']));_0x45223b[_0x74de('0x33')]=_0x45223b[_0x74de('0x33')]['length']?_0x45223b[_0x74de('0x33')]:_0x1c028f[_0x74de('0x2f')];_0x45223b[_0x74de('0x4d')]=qs[_0x74de('0x38')](_0x86b4cd[_0x74de('0x30')]['sort']);_0x45223b[_0x74de('0x39')]=qs[_0x74de('0x32')](_[_0x74de('0x3a')](_0x86b4cd[_0x74de('0x30')],_0x1c028f[_0x74de('0x32')]));if(_0x86b4cd['query'][_0x74de('0x3d')]){_0x45223b[_0x74de('0x39')]=_[_0x74de('0x3b')](_0x45223b['where'],{'$or':_[_0x74de('0x2b')](_0x45223b['attributes'],function(_0x55cd35){var _0x7dcaae={};_0x7dcaae[_0x55cd35]={'$like':'%'+_0x86b4cd[_0x74de('0x30')][_0x74de('0x3d')]+'%'};return _0x7dcaae;})});}_0x45223b=_['merge']({},_0x45223b,_0x86b4cd[_0x74de('0x45')]);return _0xc7f622[_0x74de('0x4a')](_0x45223b);}})[_0x74de('0x25')](function(_0x45f909){if(_0x45f909){_0x1706d2=_0x45f909[_0x74de('0x4e')];if(!_0x86b4cd['query'][_0x74de('0x36')](_0x74de('0x37'))){_0x45223b[_0x74de('0x23')]=qs['limit'](_0x86b4cd['query'][_0x74de('0x23')]);_0x45223b[_0x74de('0x20')]=qs[_0x74de('0x20')](_0x86b4cd['query'][_0x74de('0x20')]);}return _0xc7f622[_0x74de('0x4a')](_0x45223b);}})[_0x74de('0x25')](function(_0x5850bf){if(_0x5850bf){return _0x5850bf?{'count':_0x1706d2,'rows':_0x5850bf}:null;}})[_0x74de('0x25')](respondWithResult(_0x425f02,null))['catch'](handleError(_0x425f02,null));};exports[_0x74de('0x4f')]=function(_0x38c6a5,_0x130f51,_0x687183){if(_0x38c6a5[_0x74de('0x48')]['id']){delete _0x38c6a5[_0x74de('0x48')]['id'];}return db['FreshdeskAccount'][_0x74de('0x4b')]({'where':{'id':_0x38c6a5[_0x74de('0x43')]['id']}})['then'](handleEntityNotFound(_0x130f51,null))[_0x74de('0x25')](function(_0x2e2d6c){if(_0x2e2d6c){_0x38c6a5[_0x74de('0x48')][_0x74de('0x50')]=_0x2e2d6c['id'];_0x38c6a5[_0x74de('0x48')]['Subjects']=integrations[_0x74de('0x51')](_0x38c6a5[_0x74de('0x48')][_0x74de('0x52')],_0x38c6a5[_0x74de('0x48')][_0x74de('0x2e')]);_0x38c6a5[_0x74de('0x48')][_0x74de('0x53')]=integrations['getDescriptions'](_0x38c6a5['body'][_0x74de('0x52')],_0x38c6a5[_0x74de('0x48')][_0x74de('0x2e')]);return db[_0x74de('0x4c')][_0x74de('0x47')](_0x38c6a5[_0x74de('0x48')],{'include':[{'model':db[_0x74de('0x54')],'as':_0x74de('0x55')},{'model':db[_0x74de('0x54')],'as':'Descriptions'}]});}return null;})[_0x74de('0x25')](respondWithResult(_0x130f51,null))[_0x74de('0x41')](handleError(_0x130f51,null));};exports[_0x74de('0x56')]=function(_0x119609,_0x159357,_0x5b060f){var _0x4f84cd='';return db[_0x74de('0x2c')][_0x74de('0x4b')]({'where':{'id':_0x119609[_0x74de('0x43')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x74de('0x25')](handleEntityNotFound(_0x159357,null))['then'](function(_0x37e12e){if(_0x37e12e){_0x4f84cd=_0x37e12e['remoteUri'];var _0x561dc4=_0x4f84cd[_0x74de('0x57')](-0x1);if(_0x561dc4==='/'){_0x4f84cd=_0x4f84cd[_0x74de('0x58')](0x0,_0x4f84cd[_0x74de('0x59')](_0x561dc4));}return rp({'method':_0x74de('0x5a'),'uri':util[_0x74de('0x5b')](_0x74de('0x5c'),_0x4f84cd,_0x74de('0x5d')),'headers':{'Authorization':util['format'](_0x74de('0x5e'),new Buffer(util[_0x74de('0x5b')](_0x74de('0x5f'),_0x37e12e[_0x74de('0x60')]))[_0x74de('0x61')]('base64'))},'json':!![]});}})[_0x74de('0x25')](function(_0x3f84fc){if(_0x3f84fc){var _0x2fb49f=[_0x74de('0x62'),_0x74de('0x63'),_0x74de('0x64'),_0x74de('0x65'),_0x74de('0x1d'),_0x74de('0x66'),_0x74de('0x67'),_0x74de('0x68'),_0x74de('0x69'),_0x74de('0x67'),_0x74de('0x6a')];_[_0x74de('0x6b')](_0x3f84fc,function(_0x41e14e){return _0x2fb49f[_0x74de('0x6c')](_0x41e14e[_0x74de('0x28')])||!_0x41e14e[_0x74de('0x6d')]&&_0x41e14e[_0x74de('0x2e')]!==_0x74de('0x6e')&&_0x41e14e['type']!==_0x74de('0x6f');});return{'count':_0x3f84fc[_0x74de('0x4e')],'rows':_[_0x74de('0x2b')](_0x3f84fc,function(_0x53c646){return{'id':_0x53c646[_0x74de('0x28')],'name':_0x53c646[_0x74de('0x70')],'custom':!_0x53c646[_0x74de('0x6d')],'options':_0x53c646[_0x74de('0x71')]?_[_0x74de('0x2b')](_0x53c646['choices'],function(_0x5e20bf){return{'name':_['capitalize'](_0x5e20bf),'value':_0x5e20bf};}):[]};})};}})[_0x74de('0x25')](respondWithResult(_0x159357,null))['catch'](function(_0x4fb7bc){var _0x277427=_0x119609[_0x74de('0x30')][_0x74de('0x72')]?0x1f4:_0x4fb7bc[_0x74de('0x73')]||0x1f4;logger[_0x74de('0x26')](_0x74de('0x74'),_0x74de('0x56'),_0x277427,JSON['stringify'](_0x4fb7bc));delete _0x4fb7bc[_0x74de('0x28')];if(_0x277427===0x191){_0x277427=0x190;}_0x159357[_0x74de('0x1d')](_0x277427)['send'](_0x119609[_0x74de('0x30')]['test']?{'message':_0x74de('0x75'),'statusCode':_0x4fb7bc['statusCode']}:_0x4fb7bc);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 572a396..c75c768 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 _0xbbb2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api'];(function(_0x50f648,_0x3e3cbd){var _0x1b7bec=function(_0x140ddb){while(--_0x140ddb){_0x50f648['push'](_0x50f648['shift']());}};_0x1b7bec(++_0x3e3cbd);}(_0xbbb2,0x99));var _0x2bbb=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xbbb2[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x2bbb('0x0'));var util=require('util');var logger=require(_0x2bbb('0x1'))(_0x2bbb('0x2'));var moment=require(_0x2bbb('0x3'));var BPromise=require(_0x2bbb('0x4'));var rp=require(_0x2bbb('0x5'));var fs=require('fs');var path=require(_0x2bbb('0x6'));var rimraf=require(_0x2bbb('0x7'));var config=require(_0x2bbb('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x2bbb('0x9'));module[_0x2bbb('0xa')]=function(_0x639844,_0x26de95){return _0x639844[_0x2bbb('0xb')](_0x2bbb('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc881=['api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0xc881,0x1e7));var _0x1c88=function(_0xe1f858,_0xb86c44){_0xe1f858=_0xe1f858-0x0;var _0x367af6=_0xc881[_0xe1f858];return _0x367af6;};'use strict';var _=require(_0x1c88('0x0'));var util=require(_0x1c88('0x1'));var logger=require(_0x1c88('0x2'))(_0x1c88('0x3'));var moment=require(_0x1c88('0x4'));var BPromise=require(_0x1c88('0x5'));var rp=require(_0x1c88('0x6'));var fs=require('fs');var path=require(_0x1c88('0x7'));var rimraf=require(_0x1c88('0x8'));var config=require('../../config/environment');var attributes=require(_0x1c88('0x9'));var integrations=require(_0x1c88('0xa'));module[_0x1c88('0xb')]=function(_0x4a5cef,_0xf859af){return _0x4a5cef['define'](_0x1c88('0xc'),attributes,{'tableName':_0x1c88('0xd'),'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 7960f9d..6549bba 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 _0x3478=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount','options','raw','where','attributes','limit','map','include','model','then','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','util','moment','bluebird'];(function(_0x1b2f5c,_0x425490){var _0x4b2ea5=function(_0x1a8346){while(--_0x1a8346){_0x1b2f5c['push'](_0x1b2f5c['shift']());}};_0x4b2ea5(++_0x425490);}(_0x3478,0x10d));var _0x8347=function(_0xf8fe2f,_0x494dcd){_0xf8fe2f=_0xf8fe2f-0x0;var _0x478e05=_0x3478[_0xf8fe2f];return _0x478e05;};'use strict';var _=require('lodash');var util=require(_0x8347('0x0'));var moment=require(_0x8347('0x1'));var BPromise=require(_0x8347('0x2'));var rs=require(_0x8347('0x3'));var fs=require('fs');var Redis=require(_0x8347('0x4'));var db=require(_0x8347('0x5'))['db'];var utils=require(_0x8347('0x6'));var logger=require(_0x8347('0x7'))(_0x8347('0x8'));var config=require('../../config/environment');var jayson=require(_0x8347('0x9'));var client=jayson[_0x8347('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x228e44,_0x28edd9,_0x4e8e7b){return new BPromise(function(_0x503141,_0x1ed48c){return client['request'](_0x228e44,_0x4e8e7b)['then'](function(_0x1b7516){logger[_0x8347('0xb')](_0x8347('0xc'),_0x28edd9,_0x8347('0xd'));logger[_0x8347('0xe')](_0x8347('0xf'),_0x28edd9,_0x8347('0xd'),JSON[_0x8347('0x10')](_0x1b7516));if(_0x1b7516[_0x8347('0x11')]){if(_0x1b7516[_0x8347('0x11')][_0x8347('0x12')]===0x1f4){logger['error'](_0x8347('0xc'),_0x28edd9,_0x1b7516['error'][_0x8347('0x13')]);return _0x1ed48c(_0x1b7516[_0x8347('0x11')][_0x8347('0x13')]);}logger[_0x8347('0x11')](_0x8347('0xc'),_0x28edd9,_0x1b7516[_0x8347('0x11')]['message']);return _0x503141(_0x1b7516[_0x8347('0x11')][_0x8347('0x13')]);}else{logger[_0x8347('0xb')](_0x8347('0xc'),_0x28edd9,_0x8347('0xd'));_0x503141(_0x1b7516['result']['message']);}})['catch'](function(_0x35d507){logger[_0x8347('0x11')](_0x8347('0xc'),_0x28edd9,_0x35d507);_0x1ed48c(_0x35d507);});});}exports['GetFreshdeskAccount']=function(_0x351ece){var _0xd23f1d=this;return new Promise(function(_0x8d0d64,_0x2dbcb6){return db[_0x8347('0x14')]['findAll']({'raw':_0x351ece[_0x8347('0x15')]?_0x351ece['options'][_0x8347('0x16')]===undefined?!![]:![]:!![],'where':_0x351ece['options']?_0x351ece[_0x8347('0x15')][_0x8347('0x17')]||null:null,'attributes':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')][_0x8347('0x18')]||null:null,'limit':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')][_0x8347('0x19')]||null:null,'include':_0x351ece[_0x8347('0x15')]?_0x351ece[_0x8347('0x15')]['include']?_[_0x8347('0x1a')](_0x351ece[_0x8347('0x15')][_0x8347('0x1b')],function(_0x5081bf){return{'model':db[_0x5081bf[_0x8347('0x1c')]],'as':_0x5081bf['as'],'attributes':_0x5081bf[_0x8347('0x18')],'include':_0x5081bf[_0x8347('0x1b')]?_['map'](_0x5081bf[_0x8347('0x1b')],function(_0x507832){return{'model':db[_0x507832[_0x8347('0x1c')]],'as':_0x507832['as'],'attributes':_0x507832[_0x8347('0x18')],'include':_0x507832[_0x8347('0x1b')]?_['map'](_0x507832[_0x8347('0x1b')],function(_0x3c5167){return{'model':db[_0x3c5167[_0x8347('0x1c')]],'as':_0x3c5167['as'],'attributes':_0x3c5167[_0x8347('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x1d')](function(_0x288320){logger[_0x8347('0xb')](_0x8347('0x1e'),_0x351ece);logger[_0x8347('0xe')](_0x8347('0x1e'),_0x351ece,JSON[_0x8347('0x10')](_0x288320));_0x8d0d64(_0x288320);})[_0x8347('0x1f')](function(_0x1975e2){logger[_0x8347('0x11')](_0x8347('0x1e'),_0x1975e2[_0x8347('0x13')],_0x351ece);_0x2dbcb6(_0xd23f1d[_0x8347('0x11')](0x1f4,_0x1975e2[_0x8347('0x13')]));});});};exports[_0x8347('0x20')]=function(_0xdb2f39){var _0x33b625=this;return new Promise(function(_0x40f32a,_0x4bfa6e){return db['FreshdeskAccount'][_0x8347('0x21')]({'raw':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39['options'][_0x8347('0x16')]===undefined?!![]:![]:!![],'where':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39['options'][_0x8347('0x17')]||null:null,'attributes':_0xdb2f39[_0x8347('0x15')]?_0xdb2f39[_0x8347('0x15')]['attributes']||null:null,'include':_0xdb2f39['options']?_0xdb2f39[_0x8347('0x15')][_0x8347('0x1b')]?_[_0x8347('0x1a')](_0xdb2f39[_0x8347('0x15')][_0x8347('0x1b')],function(_0x22d42c){return{'model':db[_0x22d42c[_0x8347('0x1c')]],'as':_0x22d42c['as'],'attributes':_0x22d42c['attributes'],'include':_0x22d42c['include']?_['map'](_0x22d42c['include'],function(_0x44652d){return{'model':db[_0x44652d[_0x8347('0x1c')]],'as':_0x44652d['as'],'attributes':_0x44652d[_0x8347('0x18')],'include':_0x44652d['include']?_[_0x8347('0x1a')](_0x44652d[_0x8347('0x1b')],function(_0x113e89){return{'model':db[_0x113e89['model']],'as':_0x113e89['as'],'attributes':_0x113e89[_0x8347('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8347('0x1d')](function(_0x80f2c6){logger['info']('ShowFreshdeskAccount',_0xdb2f39);logger['debug']('ShowFreshdeskAccount',_0xdb2f39,JSON[_0x8347('0x10')](_0x80f2c6));_0x40f32a(_0x80f2c6);})[_0x8347('0x1f')](function(_0x5add46){logger[_0x8347('0x11')](_0x8347('0x20'),_0x5add46['message'],_0xdb2f39);_0x4bfa6e(_0x33b625[_0x8347('0x11')](0x1f4,_0x5add46[_0x8347('0x13')]));});});}; \ No newline at end of file +var _0x8796=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','info','stringify','ShowFreshdeskAccount','FreshdeskAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x2c8b7a,_0x483fe0){var _0x1c1cf9=function(_0x464bcf){while(--_0x464bcf){_0x2c8b7a['push'](_0x2c8b7a['shift']());}};_0x1c1cf9(++_0x483fe0);}(_0x8796,0x11b));var _0x6879=function(_0x59d17d,_0x2deaca){_0x59d17d=_0x59d17d-0x0;var _0x301d3f=_0x8796[_0x59d17d];return _0x301d3f;};'use strict';var _=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var moment=require(_0x6879('0x2'));var BPromise=require(_0x6879('0x3'));var rs=require(_0x6879('0x4'));var fs=require('fs');var Redis=require(_0x6879('0x5'));var db=require(_0x6879('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6879('0x7'))(_0x6879('0x8'));var config=require(_0x6879('0x9'));var jayson=require(_0x6879('0xa'));var client=jayson[_0x6879('0xb')][_0x6879('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x550b84,_0x36e268,_0x24c1e2){return new BPromise(function(_0x373755,_0x350006){return client[_0x6879('0xd')](_0x550b84,_0x24c1e2)[_0x6879('0xe')](function(_0xd6e429){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36e268,_0x6879('0xf'));logger[_0x6879('0x10')](_0x6879('0x11'),_0x36e268,'request\x20sent',JSON['stringify'](_0xd6e429));if(_0xd6e429[_0x6879('0x12')]){if(_0xd6e429[_0x6879('0x12')][_0x6879('0x13')]===0x1f4){logger[_0x6879('0x12')](_0x6879('0x14'),_0x36e268,_0xd6e429[_0x6879('0x12')][_0x6879('0x15')]);return _0x350006(_0xd6e429[_0x6879('0x12')]['message']);}logger[_0x6879('0x12')](_0x6879('0x14'),_0x36e268,_0xd6e429['error'][_0x6879('0x15')]);return _0x373755(_0xd6e429[_0x6879('0x12')][_0x6879('0x15')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36e268,_0x6879('0xf'));_0x373755(_0xd6e429['result'][_0x6879('0x15')]);}})[_0x6879('0x16')](function(_0x247d4b){logger[_0x6879('0x12')](_0x6879('0x14'),_0x36e268,_0x247d4b);_0x350006(_0x247d4b);});});}exports[_0x6879('0x17')]=function(_0x2c8d6f){var _0x4a58b3=this;return new Promise(function(_0x332cd3,_0x20d671){return db['FreshdeskAccount']['findAll']({'raw':_0x2c8d6f['options']?_0x2c8d6f[_0x6879('0x18')][_0x6879('0x19')]===undefined?!![]:![]:!![],'where':_0x2c8d6f[_0x6879('0x18')]?_0x2c8d6f['options'][_0x6879('0x1a')]||null:null,'attributes':_0x2c8d6f[_0x6879('0x18')]?_0x2c8d6f[_0x6879('0x18')][_0x6879('0x1b')]||null:null,'limit':_0x2c8d6f['options']?_0x2c8d6f[_0x6879('0x18')][_0x6879('0x1c')]||null:null,'include':_0x2c8d6f[_0x6879('0x18')]?_0x2c8d6f[_0x6879('0x18')][_0x6879('0x1d')]?_[_0x6879('0x1e')](_0x2c8d6f[_0x6879('0x18')][_0x6879('0x1d')],function(_0x5d8bdb){return{'model':db[_0x5d8bdb[_0x6879('0x1f')]],'as':_0x5d8bdb['as'],'attributes':_0x5d8bdb[_0x6879('0x1b')],'include':_0x5d8bdb[_0x6879('0x1d')]?_[_0x6879('0x1e')](_0x5d8bdb[_0x6879('0x1d')],function(_0x1be62e){return{'model':db[_0x1be62e[_0x6879('0x1f')]],'as':_0x1be62e['as'],'attributes':_0x1be62e[_0x6879('0x1b')],'include':_0x1be62e[_0x6879('0x1d')]?_[_0x6879('0x1e')](_0x1be62e[_0x6879('0x1d')],function(_0x1e9abc){return{'model':db[_0x1e9abc[_0x6879('0x1f')]],'as':_0x1e9abc['as'],'attributes':_0x1e9abc['attributes']};}):[]};}):[]};}):[]:[]})[_0x6879('0xe')](function(_0x57edb4){logger[_0x6879('0x20')](_0x6879('0x17'),_0x2c8d6f);logger[_0x6879('0x10')]('GetFreshdeskAccount',_0x2c8d6f,JSON[_0x6879('0x21')](_0x57edb4));_0x332cd3(_0x57edb4);})[_0x6879('0x16')](function(_0x284721){logger[_0x6879('0x12')](_0x6879('0x17'),_0x284721['message'],_0x2c8d6f);_0x20d671(_0x4a58b3['error'](0x1f4,_0x284721[_0x6879('0x15')]));});});};exports[_0x6879('0x22')]=function(_0xb8d5c1){var _0x37975f=this;return new Promise(function(_0x2ab7f4,_0x250d3b){return db[_0x6879('0x23')]['find']({'raw':_0xb8d5c1[_0x6879('0x18')]?_0xb8d5c1[_0x6879('0x18')][_0x6879('0x19')]===undefined?!![]:![]:!![],'where':_0xb8d5c1[_0x6879('0x18')]?_0xb8d5c1[_0x6879('0x18')][_0x6879('0x1a')]||null:null,'attributes':_0xb8d5c1[_0x6879('0x18')]?_0xb8d5c1[_0x6879('0x18')][_0x6879('0x1b')]||null:null,'include':_0xb8d5c1[_0x6879('0x18')]?_0xb8d5c1['options'][_0x6879('0x1d')]?_[_0x6879('0x1e')](_0xb8d5c1[_0x6879('0x18')][_0x6879('0x1d')],function(_0x5569f6){return{'model':db[_0x5569f6[_0x6879('0x1f')]],'as':_0x5569f6['as'],'attributes':_0x5569f6[_0x6879('0x1b')],'include':_0x5569f6[_0x6879('0x1d')]?_[_0x6879('0x1e')](_0x5569f6['include'],function(_0x4e24c1){return{'model':db[_0x4e24c1[_0x6879('0x1f')]],'as':_0x4e24c1['as'],'attributes':_0x4e24c1[_0x6879('0x1b')],'include':_0x4e24c1['include']?_['map'](_0x4e24c1[_0x6879('0x1d')],function(_0x5a3dc0){return{'model':db[_0x5a3dc0[_0x6879('0x1f')]],'as':_0x5a3dc0['as'],'attributes':_0x5a3dc0[_0x6879('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6879('0xe')](function(_0xa829d4){logger[_0x6879('0x20')]('ShowFreshdeskAccount',_0xb8d5c1);logger[_0x6879('0x10')]('ShowFreshdeskAccount',_0xb8d5c1,JSON[_0x6879('0x21')](_0xa829d4));_0x2ab7f4(_0xa829d4);})[_0x6879('0x16')](function(_0x48156){logger[_0x6879('0x12')]('ShowFreshdeskAccount',_0x48156[_0x6879('0x15')],_0xb8d5c1);_0x250d3b(_0x37975f[_0x6879('0x12')](0x1f4,_0x48156[_0x6879('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 34dc5c8..42f54b5 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 _0xccb7=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xccb7,0xf9));var _0x7ccb=function(_0x373e5d,_0x3818f6){_0x373e5d=_0x373e5d-0x0;var _0x3d5694=_0xccb7[_0x373e5d];return _0x3d5694;};'use strict';var multer=require('multer');var util=require(_0x7ccb('0x0'));var path=require(_0x7ccb('0x1'));var timeout=require(_0x7ccb('0x2'));var express=require(_0x7ccb('0x3'));var router=express[_0x7ccb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7ccb('0x5'));var interaction=require(_0x7ccb('0x6'));var config=require(_0x7ccb('0x7'));var controller=require(_0x7ccb('0x8'));router[_0x7ccb('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ccb('0xa')]);router['get'](_0x7ccb('0xb'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0xd')]);router[_0x7ccb('0x9')](_0x7ccb('0xe'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0xf')]);router[_0x7ccb('0x9')](_0x7ccb('0x10'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x11')]);router[_0x7ccb('0x9')]('/:id/descriptions',auth[_0x7ccb('0xc')](),controller['getDescriptions']);router[_0x7ccb('0x9')](_0x7ccb('0x12'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x13')]);router[_0x7ccb('0x14')]('/',auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x15')]);router[_0x7ccb('0x14')]('/:id/tags',auth[_0x7ccb('0xc')](),controller['setTags']);router[_0x7ccb('0x16')](_0x7ccb('0xb'),auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x17')]);router[_0x7ccb('0x18')]('/:id',auth[_0x7ccb('0xc')](),controller[_0x7ccb('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa6fc=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','/:id/tags','post','create','put','update','delete'];(function(_0x2fb0e5,_0x45e57a){var _0x584d1f=function(_0x551080){while(--_0x551080){_0x2fb0e5['push'](_0x2fb0e5['shift']());}};_0x584d1f(++_0x45e57a);}(_0xa6fc,0x160));var _0xca6f=function(_0x4c9f96,_0x3bb74a){_0x4c9f96=_0x4c9f96-0x0;var _0x5b54e4=_0xa6fc[_0x4c9f96];return _0x5b54e4;};'use strict';var multer=require(_0xca6f('0x0'));var util=require(_0xca6f('0x1'));var path=require(_0xca6f('0x2'));var timeout=require(_0xca6f('0x3'));var express=require(_0xca6f('0x4'));var router=express[_0xca6f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xca6f('0x6'));var interaction=require(_0xca6f('0x7'));var config=require(_0xca6f('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xca6f('0x9')]('/',auth[_0xca6f('0xa')](),controller[_0xca6f('0xb')]);router['get'](_0xca6f('0xc'),auth[_0xca6f('0xa')](),controller[_0xca6f('0xd')]);router[_0xca6f('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xca6f('0xe')]);router[_0xca6f('0x9')](_0xca6f('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xca6f('0x9')](_0xca6f('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0xca6f('0x11'),auth[_0xca6f('0xa')](),controller['getTags']);router[_0xca6f('0x12')]('/',auth[_0xca6f('0xa')](),controller[_0xca6f('0x13')]);router[_0xca6f('0x12')](_0xca6f('0x11'),auth[_0xca6f('0xa')](),controller['setTags']);router[_0xca6f('0x14')](_0xca6f('0xc'),auth[_0xca6f('0xa')](),controller[_0xca6f('0x15')]);router[_0xca6f('0x16')]('/:id',auth[_0xca6f('0xa')](),controller[_0xca6f('0x17')]);module[_0xca6f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 7a85d23..e5e4e43 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 _0xb740=['sequelize','exports','STRING'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0xb740,0x9c));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0b74('0x0'));module[_0x0b74('0x1')]={'name':{'type':Sequelize[_0x0b74('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9e0=['STRING','sequelize'];(function(_0x4c8090,_0x20678a){var _0x2d9f59=function(_0x32258c){while(--_0x32258c){_0x4c8090['push'](_0x4c8090['shift']());}};_0x2d9f59(++_0x20678a);}(_0xf9e0,0x125));var _0x0f9e=function(_0x4245fd,_0x108988){_0x4245fd=_0x4245fd-0x0;var _0x3fdf5e=_0xf9e0[_0x4245fd];return _0x3fdf5e;};'use strict';var Sequelize=require(_0x0f9e('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f9e('0x1')]},'description':{'type':Sequelize[_0x0f9e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 374eda8..af2655c 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 _0x8fae=['options','includeAll','include','rows','params','catch','create','body','find','intersection','order','getFields','nolimit','getSubjects','findOne','getDescriptions','FreshdeskField','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','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','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0x8fae,0x10d));var _0xe8fa=function(_0x4fd5bc,_0x56f503){_0x4fd5bc=_0x4fd5bc-0x0;var _0x6b69d7=_0x8fae[_0x4fd5bc];return _0x6b69d7;};'use strict';var emlformat=require(_0xe8fa('0x0'));var rimraf=require(_0xe8fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8fa('0x2'));var rp=require(_0xe8fa('0x3'));var moment=require(_0xe8fa('0x4'));var BPromise=require(_0xe8fa('0x5'));var Mustache=require('mustache');var util=require(_0xe8fa('0x6'));var path=require(_0xe8fa('0x7'));var sox=require(_0xe8fa('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8fa('0x9'));var _=require(_0xe8fa('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe8fa('0xb'));var deskjs=require(_0xe8fa('0xc'));var toCsv=require(_0xe8fa('0xd'));var querystring=require(_0xe8fa('0xe'));var Papa=require(_0xe8fa('0xf'));var Redis=require(_0xe8fa('0x10'));var authService=require(_0xe8fa('0x11'));var qs=require(_0xe8fa('0x12'));var as=require(_0xe8fa('0x13'));var hardwareService=require(_0xe8fa('0x14'));var logger=require(_0xe8fa('0x15'))(_0xe8fa('0x16'));var utils=require('../../config/utils');var config=require(_0xe8fa('0x17'));var licenseUtil=require(_0xe8fa('0x18'));var db=require(_0xe8fa('0x19'))['db'];function respondWithStatusCode(_0x13d18a,_0x4298d3){_0x4298d3=_0x4298d3||0xcc;return function(_0x5dc11c){if(_0x5dc11c){return _0x13d18a['sendStatus'](_0x4298d3);}return _0x13d18a['status'](_0x4298d3)['end']();};}function respondWithResult(_0x3ef98e,_0x4e4cad){_0x4e4cad=_0x4e4cad||0xc8;return function(_0x5b8a68){if(_0x5b8a68){return _0x3ef98e[_0xe8fa('0x1a')](_0x4e4cad)[_0xe8fa('0x1b')](_0x5b8a68);}};}function respondWithFilteredResult(_0x7765d1,_0x4efe9c){return function(_0xddd7fd){if(_0xddd7fd){var _0x5cedc5=typeof _0x4efe9c[_0xe8fa('0x1c')]===_0xe8fa('0x1d')&&typeof _0x4efe9c[_0xe8fa('0x1e')]===_0xe8fa('0x1d');var _0x367db0=_0xddd7fd[_0xe8fa('0x1f')];var _0x4b74e1=_0x5cedc5?0x0:_0x4efe9c[_0xe8fa('0x1c')];var _0xdb271f=_0x5cedc5?_0xddd7fd[_0xe8fa('0x1f')]:_0x4efe9c[_0xe8fa('0x1c')]+_0x4efe9c[_0xe8fa('0x1e')];var _0x4473d0;if(_0xdb271f>=_0x367db0){_0xdb271f=_0x367db0;_0x4473d0=0xc8;}else{_0x4473d0=0xce;}_0x7765d1[_0xe8fa('0x1a')](_0x4473d0);return _0x7765d1[_0xe8fa('0x20')]('Content-Range',_0x4b74e1+'-'+_0xdb271f+'/'+_0x367db0)[_0xe8fa('0x1b')](_0xddd7fd);}return null;};}function patchUpdates(_0x3c33de){return function(_0x3130f4){try{jsonpatch[_0xe8fa('0x21')](_0x3130f4,_0x3c33de,!![]);}catch(_0x4ae66a){return BPromise['reject'](_0x4ae66a);}return _0x3130f4[_0xe8fa('0x22')]();};}function saveUpdates(_0x19d52e,_0x366b86){return function(_0x13bc6c){if(_0x13bc6c){return _0x13bc6c[_0xe8fa('0x23')](_0x19d52e)[_0xe8fa('0x24')](function(_0x3f864d){return _0x3f864d;});}return null;};}function removeEntity(_0x1af7ac,_0xf65226){return function(_0x2b49e2){if(_0x2b49e2){return _0x2b49e2[_0xe8fa('0x25')]()[_0xe8fa('0x24')](function(){_0x1af7ac[_0xe8fa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d170b,_0x4f3b49){return function(_0x7a9652){if(!_0x7a9652){_0x1d170b[_0xe8fa('0x26')](0x194);}return _0x7a9652;};}function handleError(_0x299651,_0x282da0){_0x282da0=_0x282da0||0x1f4;return function(_0x2e3cd0){logger[_0xe8fa('0x27')](_0x2e3cd0[_0xe8fa('0x28')]);if(_0x2e3cd0['name']){delete _0x2e3cd0['name'];}_0x299651['status'](_0x282da0)[_0xe8fa('0x29')](_0x2e3cd0);};}exports['index']=function(_0x1c1a90,_0x202049){var _0x50f84f={},_0xa692b3={},_0xc21834={'count':0x0,'rows':[]};var _0x5479d4=_[_0xe8fa('0x2a')](db[_0xe8fa('0x2b')][_0xe8fa('0x2c')],function(_0x188652){return{'name':_0x188652[_0xe8fa('0x2d')],'type':_0x188652['type'][_0xe8fa('0x2e')]};});_0xa692b3[_0xe8fa('0x2f')]=_[_0xe8fa('0x2a')](_0x5479d4,_0xe8fa('0x30'));_0xa692b3[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x1c1a90['query']);_0xa692b3['filters']=_['intersection'](_0xa692b3[_0xe8fa('0x2f')],_0xa692b3[_0xe8fa('0x31')]);_0x50f84f[_0xe8fa('0x33')]=_['intersection'](_0xa692b3[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x50f84f[_0xe8fa('0x33')]=_0x50f84f[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0x50f84f['attributes']:_0xa692b3[_0xe8fa('0x2f')];if(!_0x1c1a90['query'][_0xe8fa('0x36')]('nolimit')){_0x50f84f[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x1c1a90['query'][_0xe8fa('0x1e')]);_0x50f84f['offset']=qs[_0xe8fa('0x1c')](_0x1c1a90['query'][_0xe8fa('0x1c')]);}_0x50f84f['order']=qs[_0xe8fa('0x37')](_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x50f84f[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x1c1a90[_0xe8fa('0x31')],_0xa692b3[_0xe8fa('0x39')]),_0x5479d4);if(_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x50f84f[_0xe8fa('0x38')]=_['merge'](_0x50f84f[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x5479d4,function(_0x43a891){if(_0x43a891[_0xe8fa('0x3c')]!==_0xe8fa('0x3d')){var _0x546ca5={};_0x546ca5[_0x43a891[_0xe8fa('0x30')]]={'$like':'%'+_0x1c1a90['query'][_0xe8fa('0x3b')]+'%'};return _0x546ca5;}})});}_0x50f84f=_[_0xe8fa('0x3e')]({},_0x50f84f,_0x1c1a90[_0xe8fa('0x3f')]);var _0x38984b={'where':_0x50f84f[_0xe8fa('0x38')]};return db[_0xe8fa('0x2b')][_0xe8fa('0x1f')](_0x38984b)['then'](function(_0x5b9399){_0xc21834['count']=_0x5b9399;if(_0x1c1a90[_0xe8fa('0x31')][_0xe8fa('0x40')]){_0x50f84f[_0xe8fa('0x41')]=[{'all':!![]}];}return db[_0xe8fa('0x2b')]['findAll'](_0x50f84f);})[_0xe8fa('0x24')](function(_0x21ff92){_0xc21834[_0xe8fa('0x42')]=_0x21ff92;return _0xc21834;})[_0xe8fa('0x24')](respondWithFilteredResult(_0x202049,_0x50f84f))['catch'](handleError(_0x202049,null));};exports['show']=function(_0x3acdce,_0xe70bac){var _0x10e322={'raw':![],'where':{'id':_0x3acdce[_0xe8fa('0x43')]['id']}},_0x592d69={};_0x592d69[_0xe8fa('0x2f')]=_['keys'](db[_0xe8fa('0x2b')][_0xe8fa('0x2c')]);_0x592d69[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x3acdce[_0xe8fa('0x31')]);_0x592d69[_0xe8fa('0x39')]=_['intersection'](_0x592d69[_0xe8fa('0x2f')],_0x592d69['query']);_0x10e322['attributes']=_['intersection'](_0x592d69['model'],qs[_0xe8fa('0x34')](_0x3acdce['query'][_0xe8fa('0x34')]));_0x10e322[_0xe8fa('0x33')]=_0x10e322[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0x10e322['attributes']:_0x592d69[_0xe8fa('0x2f')];if(_0x3acdce[_0xe8fa('0x31')][_0xe8fa('0x40')]){_0x10e322[_0xe8fa('0x41')]=[{'all':!![]}];}_0x10e322=_[_0xe8fa('0x3e')]({},_0x10e322,_0x3acdce[_0xe8fa('0x3f')]);return db['FreshdeskConfiguration']['find'](_0x10e322)[_0xe8fa('0x24')](handleEntityNotFound(_0xe70bac,null))['then'](respondWithResult(_0xe70bac,null))[_0xe8fa('0x44')](handleError(_0xe70bac,null));};exports[_0xe8fa('0x45')]=function(_0x57a0f3,_0x3c7d22){return db[_0xe8fa('0x2b')][_0xe8fa('0x45')](_0x57a0f3[_0xe8fa('0x46')],{})[_0xe8fa('0x24')](respondWithResult(_0x3c7d22,0xc9))[_0xe8fa('0x44')](handleError(_0x3c7d22,null));};exports[_0xe8fa('0x23')]=function(_0x52083c,_0x5be19c){if(_0x52083c['body']['id']){delete _0x52083c[_0xe8fa('0x46')]['id'];}return db[_0xe8fa('0x2b')][_0xe8fa('0x47')]({'where':{'id':_0x52083c[_0xe8fa('0x43')]['id']}})['then'](handleEntityNotFound(_0x5be19c,null))[_0xe8fa('0x24')](saveUpdates(_0x52083c['body'],null))[_0xe8fa('0x24')](respondWithResult(_0x5be19c,null))[_0xe8fa('0x44')](handleError(_0x5be19c,null));};exports['destroy']=function(_0x5c320c,_0xfd1336){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5c320c[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0xfd1336,null))[_0xe8fa('0x24')](removeEntity(_0xfd1336,null))[_0xe8fa('0x44')](handleError(_0xfd1336,null));};exports['getFields']=function(_0x2d9b1d,_0xd194b6,_0x528bea){var _0x2b9f62={};var _0x118fb6={};var _0x1abbc2;var _0x2f98e4;return db[_0xe8fa('0x2b')]['findOne']({'where':{'id':_0x2d9b1d[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0xd194b6,null))[_0xe8fa('0x24')](function(_0x14c77a){if(_0x14c77a){_0x1abbc2=_0x14c77a;_0x118fb6[_0xe8fa('0x2f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x118fb6['query']=_[_0xe8fa('0x32')](_0x2d9b1d[_0xe8fa('0x31')]);_0x118fb6[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x118fb6[_0xe8fa('0x2f')],_0x118fb6[_0xe8fa('0x31')]);_0x2b9f62[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x118fb6[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x2b9f62[_0xe8fa('0x33')]=_0x2b9f62['attributes']['length']?_0x2b9f62[_0xe8fa('0x33')]:_0x118fb6[_0xe8fa('0x2f')];_0x2b9f62[_0xe8fa('0x49')]=qs[_0xe8fa('0x37')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x2b9f62[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x2d9b1d[_0xe8fa('0x31')],_0x118fb6[_0xe8fa('0x39')]));if(_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x2b9f62['where']=_[_0xe8fa('0x3e')](_0x2b9f62[_0xe8fa('0x38')],{'$or':_['map'](_0x2b9f62[_0xe8fa('0x33')],function(_0x187148){var _0x156d8b={};_0x156d8b[_0x187148]={'$like':'%'+_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x156d8b;})});}_0x2b9f62=_['merge']({},_0x2b9f62,_0x2d9b1d['options']);return _0x1abbc2[_0xe8fa('0x4a')](_0x2b9f62);}})['then'](function(_0x20e6c9){if(_0x20e6c9){_0x2f98e4=_0x20e6c9[_0xe8fa('0x35')];if(!_0x2d9b1d[_0xe8fa('0x31')]['hasOwnProperty'](_0xe8fa('0x4b'))){_0x2b9f62[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x2d9b1d[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x2b9f62[_0xe8fa('0x1c')]=qs[_0xe8fa('0x1c')](_0x2d9b1d[_0xe8fa('0x31')]['offset']);}return _0x1abbc2['getFields'](_0x2b9f62);}})[_0xe8fa('0x24')](function(_0x3dab64){if(_0x3dab64){return _0x3dab64?{'count':_0x2f98e4,'rows':_0x3dab64}:null;}})['then'](respondWithResult(_0xd194b6,null))[_0xe8fa('0x44')](handleError(_0xd194b6,null));};exports[_0xe8fa('0x4c')]=function(_0x1d7369,_0x1cd9cc,_0x42e8f2){var _0x40409a={};var _0xde20b4={};var _0x3443f8;var _0x1376c6;return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x1d7369[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x1cd9cc,null))[_0xe8fa('0x24')](function(_0x415f9b){if(_0x415f9b){_0x3443f8=_0x415f9b;_0xde20b4[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db['FreshdeskField'][_0xe8fa('0x2c')]);_0xde20b4['query']=_[_0xe8fa('0x32')](_0x1d7369['query']);_0xde20b4[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0xde20b4[_0xe8fa('0x2f')],_0xde20b4[_0xe8fa('0x31')]);_0x40409a[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0xde20b4['model'],qs[_0xe8fa('0x34')](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x40409a[_0xe8fa('0x33')]=_0x40409a[_0xe8fa('0x33')]['length']?_0x40409a[_0xe8fa('0x33')]:_0xde20b4[_0xe8fa('0x2f')];_0x40409a[_0xe8fa('0x49')]=qs['sort'](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x40409a[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_['pick'](_0x1d7369[_0xe8fa('0x31')],_0xde20b4[_0xe8fa('0x39')]));if(_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0x40409a[_0xe8fa('0x38')]=_[_0xe8fa('0x3e')](_0x40409a[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x40409a['attributes'],function(_0xf8ea77){var _0x338e5e={};_0x338e5e[_0xf8ea77]={'$like':'%'+_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x338e5e;})});}_0x40409a=_[_0xe8fa('0x3e')]({},_0x40409a,_0x1d7369[_0xe8fa('0x3f')]);return _0x3443f8[_0xe8fa('0x4c')](_0x40409a);}})[_0xe8fa('0x24')](function(_0x1512c0){if(_0x1512c0){_0x1376c6=_0x1512c0[_0xe8fa('0x35')];if(!_0x1d7369[_0xe8fa('0x31')]['hasOwnProperty'](_0xe8fa('0x4b'))){_0x40409a[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x1d7369[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x40409a[_0xe8fa('0x1c')]=qs[_0xe8fa('0x1c')](_0x1d7369['query']['offset']);}return _0x3443f8[_0xe8fa('0x4c')](_0x40409a);}})[_0xe8fa('0x24')](function(_0x3e28ac){if(_0x3e28ac){return _0x3e28ac?{'count':_0x1376c6,'rows':_0x3e28ac}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x1cd9cc,null))[_0xe8fa('0x44')](handleError(_0x1cd9cc,null));};exports[_0xe8fa('0x4e')]=function(_0x3ea2ad,_0x4844fe,_0x12aa94){var _0x26fde1={};var _0x56705f={};var _0x53804d;var _0x29362c;return db[_0xe8fa('0x2b')]['findOne']({'where':{'id':_0x3ea2ad[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x4844fe,null))[_0xe8fa('0x24')](function(_0x48c02e){if(_0x48c02e){_0x53804d=_0x48c02e;_0x56705f[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db[_0xe8fa('0x4f')]['rawAttributes']);_0x56705f[_0xe8fa('0x31')]=_[_0xe8fa('0x32')](_0x3ea2ad[_0xe8fa('0x31')]);_0x56705f[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x56705f[_0xe8fa('0x2f')],_0x56705f['query']);_0x26fde1[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x56705f[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0x26fde1[_0xe8fa('0x33')]=_0x26fde1[_0xe8fa('0x33')]['length']?_0x26fde1[_0xe8fa('0x33')]:_0x56705f[_0xe8fa('0x2f')];_0x26fde1['order']=qs['sort'](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x37')]);_0x26fde1['where']=qs['filters'](_[_0xe8fa('0x3a')](_0x3ea2ad[_0xe8fa('0x31')],_0x56705f[_0xe8fa('0x39')]));if(_0x3ea2ad[_0xe8fa('0x31')]['filter']){_0x26fde1[_0xe8fa('0x38')]=_[_0xe8fa('0x3e')](_0x26fde1[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0x26fde1[_0xe8fa('0x33')],function(_0x110ad0){var _0x2190b2={};_0x2190b2[_0x110ad0]={'$like':'%'+_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x2190b2;})});}_0x26fde1=_[_0xe8fa('0x3e')]({},_0x26fde1,_0x3ea2ad[_0xe8fa('0x3f')]);return _0x53804d['getDescriptions'](_0x26fde1);}})[_0xe8fa('0x24')](function(_0x4dac52){if(_0x4dac52){_0x29362c=_0x4dac52[_0xe8fa('0x35')];if(!_0x3ea2ad['query'][_0xe8fa('0x36')](_0xe8fa('0x4b'))){_0x26fde1[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x1e')]);_0x26fde1['offset']=qs[_0xe8fa('0x1c')](_0x3ea2ad[_0xe8fa('0x31')][_0xe8fa('0x1c')]);}return _0x53804d[_0xe8fa('0x4e')](_0x26fde1);}})[_0xe8fa('0x24')](function(_0x566607){if(_0x566607){return _0x566607?{'count':_0x29362c,'rows':_0x566607}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x4844fe,null))[_0xe8fa('0x44')](handleError(_0x4844fe,null));};exports[_0xe8fa('0x50')]=function(_0x11265e,_0x555d23,_0x1944ba){var _0xa22d4={};var _0x24072c={};var _0x379da5;var _0x518b35;return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x11265e[_0xe8fa('0x43')]['id']}})['then'](handleEntityNotFound(_0x555d23,null))[_0xe8fa('0x24')](function(_0x37b79f){if(_0x37b79f){_0x379da5=_0x37b79f;_0x24072c[_0xe8fa('0x2f')]=_[_0xe8fa('0x32')](db[_0xe8fa('0x51')][_0xe8fa('0x2c')]);_0x24072c['query']=_[_0xe8fa('0x32')](_0x11265e['query']);_0x24072c[_0xe8fa('0x39')]=_[_0xe8fa('0x48')](_0x24072c[_0xe8fa('0x2f')],_0x24072c[_0xe8fa('0x31')]);_0xa22d4[_0xe8fa('0x33')]=_[_0xe8fa('0x48')](_0x24072c[_0xe8fa('0x2f')],qs[_0xe8fa('0x34')](_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x34')]));_0xa22d4[_0xe8fa('0x33')]=_0xa22d4[_0xe8fa('0x33')][_0xe8fa('0x35')]?_0xa22d4[_0xe8fa('0x33')]:_0x24072c[_0xe8fa('0x2f')];_0xa22d4[_0xe8fa('0x49')]=qs[_0xe8fa('0x37')](_0x11265e['query'][_0xe8fa('0x37')]);_0xa22d4[_0xe8fa('0x38')]=qs[_0xe8fa('0x39')](_[_0xe8fa('0x3a')](_0x11265e['query'],_0x24072c[_0xe8fa('0x39')]));if(_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x3b')]){_0xa22d4['where']=_[_0xe8fa('0x3e')](_0xa22d4[_0xe8fa('0x38')],{'$or':_[_0xe8fa('0x2a')](_0xa22d4['attributes'],function(_0xfc5753){var _0x4c49fd={};_0x4c49fd[_0xfc5753]={'$like':'%'+_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x3b')]+'%'};return _0x4c49fd;})});}_0xa22d4=_[_0xe8fa('0x3e')]({},_0xa22d4,_0x11265e['options']);return _0x379da5[_0xe8fa('0x50')](_0xa22d4);}})[_0xe8fa('0x24')](function(_0x2e4dab){if(_0x2e4dab){_0x518b35=_0x2e4dab[_0xe8fa('0x35')];if(!_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x36')]('nolimit')){_0xa22d4[_0xe8fa('0x1e')]=qs[_0xe8fa('0x1e')](_0x11265e['query'][_0xe8fa('0x1e')]);_0xa22d4[_0xe8fa('0x1c')]=qs['offset'](_0x11265e[_0xe8fa('0x31')][_0xe8fa('0x1c')]);}return _0x379da5[_0xe8fa('0x50')](_0xa22d4);}})[_0xe8fa('0x24')](function(_0x4355b8){if(_0x4355b8){return _0x4355b8?{'count':_0x518b35,'rows':_0x4355b8}:null;}})[_0xe8fa('0x24')](respondWithResult(_0x555d23,null))['catch'](handleError(_0x555d23,null));};exports[_0xe8fa('0x52')]=function(_0x577172,_0x35e3a0,_0x18221a){if(_0x577172[_0xe8fa('0x46')]['id']){delete _0x577172[_0xe8fa('0x46')]['id'];}return db[_0xe8fa('0x2b')][_0xe8fa('0x4d')]({'where':{'id':_0x577172[_0xe8fa('0x43')]['id']}})[_0xe8fa('0x24')](handleEntityNotFound(_0x35e3a0,null))['then'](function(_0x4ca780){if(_0x4ca780){return _0x4ca780[_0xe8fa('0x52')](_0x577172['body']['ids']||[]);}return null;})[_0xe8fa('0x24')](respondWithResult(_0x35e3a0,null))[_0xe8fa('0x44')](handleError(_0x35e3a0,null));}; \ No newline at end of file +var _0x9821=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','query','keys','model'];(function(_0x508c75,_0x2052b5){var _0x2571eb=function(_0x4ea664){while(--_0x4ea664){_0x508c75['push'](_0x508c75['shift']());}};_0x2571eb(++_0x2052b5);}(_0x9821,0x75));var _0x1982=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x9821[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x1982('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1982('0x1'));var rp=require(_0x1982('0x2'));var moment=require(_0x1982('0x3'));var BPromise=require(_0x1982('0x4'));var Mustache=require(_0x1982('0x5'));var util=require(_0x1982('0x6'));var path=require(_0x1982('0x7'));var sox=require('sox');var csv=require(_0x1982('0x8'));var ejs=require(_0x1982('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1982('0xa'));var squel=require(_0x1982('0xb'));var crypto=require(_0x1982('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1982('0xd'));var toCsv=require(_0x1982('0x8'));var querystring=require(_0x1982('0xe'));var Papa=require('papaparse');var Redis=require(_0x1982('0xf'));var authService=require(_0x1982('0x10'));var qs=require(_0x1982('0x11'));var as=require(_0x1982('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1982('0x13'));var utils=require(_0x1982('0x14'));var config=require(_0x1982('0x15'));var licenseUtil=require(_0x1982('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a7290,_0x33896b){_0x33896b=_0x33896b||0xcc;return function(_0x48eae1){if(_0x48eae1){return _0x2a7290[_0x1982('0x17')](_0x33896b);}return _0x2a7290[_0x1982('0x18')](_0x33896b)[_0x1982('0x19')]();};}function respondWithResult(_0x457695,_0x34e062){_0x34e062=_0x34e062||0xc8;return function(_0x45f8f4){if(_0x45f8f4){return _0x457695['status'](_0x34e062)[_0x1982('0x1a')](_0x45f8f4);}};}function respondWithFilteredResult(_0x343257,_0xafd5fe){return function(_0x130993){if(_0x130993){var _0x3f46d7=typeof _0xafd5fe['offset']===_0x1982('0x1b')&&typeof _0xafd5fe[_0x1982('0x1c')]===_0x1982('0x1b');var _0x2cce08=_0x130993[_0x1982('0x1d')];var _0x5b3637=_0x3f46d7?0x0:_0xafd5fe[_0x1982('0x1e')];var _0x3eb92a=_0x3f46d7?_0x130993[_0x1982('0x1d')]:_0xafd5fe[_0x1982('0x1e')]+_0xafd5fe[_0x1982('0x1c')];var _0x558a93;if(_0x3eb92a>=_0x2cce08){_0x3eb92a=_0x2cce08;_0x558a93=0xc8;}else{_0x558a93=0xce;}_0x343257[_0x1982('0x18')](_0x558a93);return _0x343257[_0x1982('0x1f')](_0x1982('0x20'),_0x5b3637+'-'+_0x3eb92a+'/'+_0x2cce08)['json'](_0x130993);}return null;};}function patchUpdates(_0x1a08a4){return function(_0x277db8){try{jsonpatch[_0x1982('0x21')](_0x277db8,_0x1a08a4,!![]);}catch(_0x3f39d1){return BPromise[_0x1982('0x22')](_0x3f39d1);}return _0x277db8[_0x1982('0x23')]();};}function saveUpdates(_0x2329c5,_0x2aad34){return function(_0x57cb8e){if(_0x57cb8e){return _0x57cb8e[_0x1982('0x24')](_0x2329c5)[_0x1982('0x25')](function(_0x25f7fe){return _0x25f7fe;});}return null;};}function removeEntity(_0x491096,_0x39eadd){return function(_0x3dc705){if(_0x3dc705){return _0x3dc705[_0x1982('0x26')]()['then'](function(){_0x491096[_0x1982('0x18')](0xcc)[_0x1982('0x19')]();});}};}function handleEntityNotFound(_0x20e9e5,_0x3e24fa){return function(_0x5a340b){if(!_0x5a340b){_0x20e9e5['sendStatus'](0x194);}return _0x5a340b;};}function handleError(_0x3c1ca2,_0x49ace7){_0x49ace7=_0x49ace7||0x1f4;return function(_0x21d514){logger['error'](_0x21d514[_0x1982('0x27')]);if(_0x21d514[_0x1982('0x28')]){delete _0x21d514['name'];}_0x3c1ca2[_0x1982('0x18')](_0x49ace7)[_0x1982('0x29')](_0x21d514);};}exports[_0x1982('0x2a')]=function(_0x112883,_0x1f0cd3){var _0x1cf459={},_0x5cd789={},_0x2a453e={'count':0x0,'rows':[]};var _0x5b5062=_[_0x1982('0x2b')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x569e57){return{'name':_0x569e57[_0x1982('0x2c')],'type':_0x569e57['type'][_0x1982('0x2d')]};});_0x5cd789['model']=_[_0x1982('0x2b')](_0x5b5062,_0x1982('0x28'));_0x5cd789[_0x1982('0x2e')]=_[_0x1982('0x2f')](_0x112883['query']);_0x5cd789['filters']=_['intersection'](_0x5cd789[_0x1982('0x30')],_0x5cd789['query']);_0x1cf459['attributes']=_[_0x1982('0x31')](_0x5cd789[_0x1982('0x30')],qs[_0x1982('0x32')](_0x112883['query'][_0x1982('0x32')]));_0x1cf459['attributes']=_0x1cf459[_0x1982('0x33')][_0x1982('0x34')]?_0x1cf459['attributes']:_0x5cd789[_0x1982('0x30')];if(!_0x112883[_0x1982('0x2e')][_0x1982('0x35')](_0x1982('0x36'))){_0x1cf459['limit']=qs['limit'](_0x112883[_0x1982('0x2e')][_0x1982('0x1c')]);_0x1cf459[_0x1982('0x1e')]=qs[_0x1982('0x1e')](_0x112883[_0x1982('0x2e')][_0x1982('0x1e')]);}_0x1cf459[_0x1982('0x37')]=qs[_0x1982('0x38')](_0x112883['query']['sort']);_0x1cf459[_0x1982('0x39')]=qs[_0x1982('0x3a')](_[_0x1982('0x3b')](_0x112883[_0x1982('0x2e')],_0x5cd789[_0x1982('0x3a')]),_0x5b5062);if(_0x112883[_0x1982('0x2e')][_0x1982('0x3c')]){_0x1cf459['where']=_[_0x1982('0x3d')](_0x1cf459[_0x1982('0x39')],{'$or':_['map'](_0x5b5062,function(_0x537827){if(_0x537827[_0x1982('0x3e')]!==_0x1982('0x3f')){var _0x18a3ef={};_0x18a3ef[_0x537827[_0x1982('0x28')]]={'$like':'%'+_0x112883[_0x1982('0x2e')][_0x1982('0x3c')]+'%'};return _0x18a3ef;}})});}_0x1cf459=_[_0x1982('0x3d')]({},_0x1cf459,_0x112883[_0x1982('0x40')]);var _0x309f74={'where':_0x1cf459[_0x1982('0x39')]};return db[_0x1982('0x41')][_0x1982('0x1d')](_0x309f74)['then'](function(_0x3cc5de){_0x2a453e[_0x1982('0x1d')]=_0x3cc5de;if(_0x112883[_0x1982('0x2e')][_0x1982('0x42')]){_0x1cf459[_0x1982('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x1982('0x44')](_0x1cf459);})[_0x1982('0x25')](function(_0x24c72d){_0x2a453e['rows']=_0x24c72d;return _0x2a453e;})[_0x1982('0x25')](respondWithFilteredResult(_0x1f0cd3,_0x1cf459))[_0x1982('0x45')](handleError(_0x1f0cd3,null));};exports[_0x1982('0x46')]=function(_0xccb179,_0x34da95){var _0x413177={'raw':![],'where':{'id':_0xccb179[_0x1982('0x47')]['id']}},_0x5c22ed={};_0x5c22ed[_0x1982('0x30')]=_[_0x1982('0x2f')](db['FreshdeskConfiguration'][_0x1982('0x48')]);_0x5c22ed[_0x1982('0x2e')]=_[_0x1982('0x2f')](_0xccb179[_0x1982('0x2e')]);_0x5c22ed[_0x1982('0x3a')]=_[_0x1982('0x31')](_0x5c22ed['model'],_0x5c22ed[_0x1982('0x2e')]);_0x413177[_0x1982('0x33')]=_[_0x1982('0x31')](_0x5c22ed[_0x1982('0x30')],qs[_0x1982('0x32')](_0xccb179[_0x1982('0x2e')][_0x1982('0x32')]));_0x413177[_0x1982('0x33')]=_0x413177[_0x1982('0x33')][_0x1982('0x34')]?_0x413177[_0x1982('0x33')]:_0x5c22ed[_0x1982('0x30')];if(_0xccb179[_0x1982('0x2e')]['includeAll']){_0x413177[_0x1982('0x43')]=[{'all':!![]}];}_0x413177=_['merge']({},_0x413177,_0xccb179['options']);return db['FreshdeskConfiguration'][_0x1982('0x49')](_0x413177)[_0x1982('0x25')](handleEntityNotFound(_0x34da95,null))['then'](respondWithResult(_0x34da95,null))[_0x1982('0x45')](handleError(_0x34da95,null));};exports['create']=function(_0x36d2df,_0x13cf0f){return db[_0x1982('0x41')][_0x1982('0x4a')](_0x36d2df[_0x1982('0x4b')],{})[_0x1982('0x25')](respondWithResult(_0x13cf0f,0xc9))[_0x1982('0x45')](handleError(_0x13cf0f,null));};exports['update']=function(_0x3093a5,_0x111017){if(_0x3093a5[_0x1982('0x4b')]['id']){delete _0x3093a5[_0x1982('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x1982('0x49')]({'where':{'id':_0x3093a5[_0x1982('0x47')]['id']}})[_0x1982('0x25')](handleEntityNotFound(_0x111017,null))[_0x1982('0x25')](saveUpdates(_0x3093a5[_0x1982('0x4b')],null))['then'](respondWithResult(_0x111017,null))[_0x1982('0x45')](handleError(_0x111017,null));};exports[_0x1982('0x26')]=function(_0x51a411,_0x15baa9){return db[_0x1982('0x41')][_0x1982('0x49')]({'where':{'id':_0x51a411['params']['id']}})[_0x1982('0x25')](handleEntityNotFound(_0x15baa9,null))[_0x1982('0x25')](removeEntity(_0x15baa9,null))['catch'](handleError(_0x15baa9,null));};exports['getFields']=function(_0x5d2050,_0x2f4dac,_0x4dd78d){var _0x5108ac={};var _0xb1288b={};var _0x47f9e6;var _0x278076;return db[_0x1982('0x41')]['findOne']({'where':{'id':_0x5d2050['params']['id']}})['then'](handleEntityNotFound(_0x2f4dac,null))[_0x1982('0x25')](function(_0x15e3a6){if(_0x15e3a6){_0x47f9e6=_0x15e3a6;_0xb1288b[_0x1982('0x30')]=_[_0x1982('0x2f')](db['FreshdeskField']['rawAttributes']);_0xb1288b['query']=_[_0x1982('0x2f')](_0x5d2050['query']);_0xb1288b['filters']=_[_0x1982('0x31')](_0xb1288b[_0x1982('0x30')],_0xb1288b[_0x1982('0x2e')]);_0x5108ac[_0x1982('0x33')]=_['intersection'](_0xb1288b[_0x1982('0x30')],qs[_0x1982('0x32')](_0x5d2050[_0x1982('0x2e')][_0x1982('0x32')]));_0x5108ac[_0x1982('0x33')]=_0x5108ac[_0x1982('0x33')]['length']?_0x5108ac['attributes']:_0xb1288b[_0x1982('0x30')];_0x5108ac[_0x1982('0x37')]=qs[_0x1982('0x38')](_0x5d2050[_0x1982('0x2e')]['sort']);_0x5108ac[_0x1982('0x39')]=qs[_0x1982('0x3a')](_['pick'](_0x5d2050[_0x1982('0x2e')],_0xb1288b[_0x1982('0x3a')]));if(_0x5d2050[_0x1982('0x2e')][_0x1982('0x3c')]){_0x5108ac['where']=_[_0x1982('0x3d')](_0x5108ac[_0x1982('0x39')],{'$or':_['map'](_0x5108ac[_0x1982('0x33')],function(_0x1e9225){var _0x20b61d={};_0x20b61d[_0x1e9225]={'$like':'%'+_0x5d2050[_0x1982('0x2e')][_0x1982('0x3c')]+'%'};return _0x20b61d;})});}_0x5108ac=_[_0x1982('0x3d')]({},_0x5108ac,_0x5d2050[_0x1982('0x40')]);return _0x47f9e6[_0x1982('0x4c')](_0x5108ac);}})['then'](function(_0xa02853){if(_0xa02853){_0x278076=_0xa02853['length'];if(!_0x5d2050[_0x1982('0x2e')]['hasOwnProperty'](_0x1982('0x36'))){_0x5108ac[_0x1982('0x1c')]=qs[_0x1982('0x1c')](_0x5d2050[_0x1982('0x2e')][_0x1982('0x1c')]);_0x5108ac[_0x1982('0x1e')]=qs['offset'](_0x5d2050[_0x1982('0x2e')]['offset']);}return _0x47f9e6[_0x1982('0x4c')](_0x5108ac);}})[_0x1982('0x25')](function(_0x585d6b){if(_0x585d6b){return _0x585d6b?{'count':_0x278076,'rows':_0x585d6b}:null;}})['then'](respondWithResult(_0x2f4dac,null))[_0x1982('0x45')](handleError(_0x2f4dac,null));};exports['getSubjects']=function(_0x11a37a,_0x4faeaa,_0x3fbc0d){var _0x11756f={};var _0x29b49d={};var _0x6a11e2;var _0x2db4e8;return db[_0x1982('0x41')]['findOne']({'where':{'id':_0x11a37a[_0x1982('0x47')]['id']}})[_0x1982('0x25')](handleEntityNotFound(_0x4faeaa,null))['then'](function(_0x200b92){if(_0x200b92){_0x6a11e2=_0x200b92;_0x29b49d[_0x1982('0x30')]=_[_0x1982('0x2f')](db['FreshdeskField']['rawAttributes']);_0x29b49d[_0x1982('0x2e')]=_[_0x1982('0x2f')](_0x11a37a[_0x1982('0x2e')]);_0x29b49d[_0x1982('0x3a')]=_[_0x1982('0x31')](_0x29b49d[_0x1982('0x30')],_0x29b49d[_0x1982('0x2e')]);_0x11756f['attributes']=_[_0x1982('0x31')](_0x29b49d[_0x1982('0x30')],qs['fields'](_0x11a37a[_0x1982('0x2e')][_0x1982('0x32')]));_0x11756f[_0x1982('0x33')]=_0x11756f[_0x1982('0x33')][_0x1982('0x34')]?_0x11756f[_0x1982('0x33')]:_0x29b49d['model'];_0x11756f[_0x1982('0x37')]=qs[_0x1982('0x38')](_0x11a37a['query'][_0x1982('0x38')]);_0x11756f[_0x1982('0x39')]=qs[_0x1982('0x3a')](_[_0x1982('0x3b')](_0x11a37a['query'],_0x29b49d['filters']));if(_0x11a37a[_0x1982('0x2e')][_0x1982('0x3c')]){_0x11756f[_0x1982('0x39')]=_['merge'](_0x11756f['where'],{'$or':_[_0x1982('0x2b')](_0x11756f[_0x1982('0x33')],function(_0x50ff54){var _0x2f3218={};_0x2f3218[_0x50ff54]={'$like':'%'+_0x11a37a[_0x1982('0x2e')][_0x1982('0x3c')]+'%'};return _0x2f3218;})});}_0x11756f=_[_0x1982('0x3d')]({},_0x11756f,_0x11a37a[_0x1982('0x40')]);return _0x6a11e2[_0x1982('0x4d')](_0x11756f);}})[_0x1982('0x25')](function(_0x161b2d){if(_0x161b2d){_0x2db4e8=_0x161b2d[_0x1982('0x34')];if(!_0x11a37a[_0x1982('0x2e')][_0x1982('0x35')](_0x1982('0x36'))){_0x11756f[_0x1982('0x1c')]=qs[_0x1982('0x1c')](_0x11a37a['query'][_0x1982('0x1c')]);_0x11756f[_0x1982('0x1e')]=qs['offset'](_0x11a37a[_0x1982('0x2e')]['offset']);}return _0x6a11e2[_0x1982('0x4d')](_0x11756f);}})[_0x1982('0x25')](function(_0x1ebe89){if(_0x1ebe89){return _0x1ebe89?{'count':_0x2db4e8,'rows':_0x1ebe89}:null;}})[_0x1982('0x25')](respondWithResult(_0x4faeaa,null))[_0x1982('0x45')](handleError(_0x4faeaa,null));};exports[_0x1982('0x4e')]=function(_0x5c42c0,_0x3dc8fb,_0x410c80){var _0x55b33a={};var _0x56e9a5={};var _0x41c233;var _0x196867;return db[_0x1982('0x41')]['findOne']({'where':{'id':_0x5c42c0['params']['id']}})['then'](handleEntityNotFound(_0x3dc8fb,null))['then'](function(_0x3e1c87){if(_0x3e1c87){_0x41c233=_0x3e1c87;_0x56e9a5[_0x1982('0x30')]=_[_0x1982('0x2f')](db['FreshdeskField']['rawAttributes']);_0x56e9a5[_0x1982('0x2e')]=_[_0x1982('0x2f')](_0x5c42c0[_0x1982('0x2e')]);_0x56e9a5[_0x1982('0x3a')]=_['intersection'](_0x56e9a5[_0x1982('0x30')],_0x56e9a5[_0x1982('0x2e')]);_0x55b33a['attributes']=_[_0x1982('0x31')](_0x56e9a5['model'],qs[_0x1982('0x32')](_0x5c42c0[_0x1982('0x2e')][_0x1982('0x32')]));_0x55b33a[_0x1982('0x33')]=_0x55b33a[_0x1982('0x33')]['length']?_0x55b33a['attributes']:_0x56e9a5[_0x1982('0x30')];_0x55b33a['order']=qs[_0x1982('0x38')](_0x5c42c0[_0x1982('0x2e')][_0x1982('0x38')]);_0x55b33a['where']=qs[_0x1982('0x3a')](_['pick'](_0x5c42c0['query'],_0x56e9a5[_0x1982('0x3a')]));if(_0x5c42c0[_0x1982('0x2e')][_0x1982('0x3c')]){_0x55b33a[_0x1982('0x39')]=_['merge'](_0x55b33a[_0x1982('0x39')],{'$or':_['map'](_0x55b33a[_0x1982('0x33')],function(_0x541428){var _0x1efbd2={};_0x1efbd2[_0x541428]={'$like':'%'+_0x5c42c0['query'][_0x1982('0x3c')]+'%'};return _0x1efbd2;})});}_0x55b33a=_[_0x1982('0x3d')]({},_0x55b33a,_0x5c42c0[_0x1982('0x40')]);return _0x41c233[_0x1982('0x4e')](_0x55b33a);}})['then'](function(_0x1400a0){if(_0x1400a0){_0x196867=_0x1400a0[_0x1982('0x34')];if(!_0x5c42c0[_0x1982('0x2e')][_0x1982('0x35')](_0x1982('0x36'))){_0x55b33a[_0x1982('0x1c')]=qs[_0x1982('0x1c')](_0x5c42c0[_0x1982('0x2e')][_0x1982('0x1c')]);_0x55b33a['offset']=qs['offset'](_0x5c42c0[_0x1982('0x2e')][_0x1982('0x1e')]);}return _0x41c233[_0x1982('0x4e')](_0x55b33a);}})[_0x1982('0x25')](function(_0x1b7099){if(_0x1b7099){return _0x1b7099?{'count':_0x196867,'rows':_0x1b7099}:null;}})['then'](respondWithResult(_0x3dc8fb,null))[_0x1982('0x45')](handleError(_0x3dc8fb,null));};exports[_0x1982('0x4f')]=function(_0x366362,_0x37571d,_0x4f1b08){var _0x49ce08={};var _0x1080fa={};var _0x324c3e;var _0x227414;return db[_0x1982('0x41')]['findOne']({'where':{'id':_0x366362[_0x1982('0x47')]['id']}})['then'](handleEntityNotFound(_0x37571d,null))[_0x1982('0x25')](function(_0x48bd54){if(_0x48bd54){_0x324c3e=_0x48bd54;_0x1080fa['model']=_[_0x1982('0x2f')](db[_0x1982('0x50')][_0x1982('0x48')]);_0x1080fa[_0x1982('0x2e')]=_[_0x1982('0x2f')](_0x366362[_0x1982('0x2e')]);_0x1080fa['filters']=_['intersection'](_0x1080fa['model'],_0x1080fa[_0x1982('0x2e')]);_0x49ce08[_0x1982('0x33')]=_['intersection'](_0x1080fa[_0x1982('0x30')],qs['fields'](_0x366362['query'][_0x1982('0x32')]));_0x49ce08[_0x1982('0x33')]=_0x49ce08[_0x1982('0x33')][_0x1982('0x34')]?_0x49ce08[_0x1982('0x33')]:_0x1080fa['model'];_0x49ce08[_0x1982('0x37')]=qs['sort'](_0x366362[_0x1982('0x2e')]['sort']);_0x49ce08[_0x1982('0x39')]=qs[_0x1982('0x3a')](_[_0x1982('0x3b')](_0x366362[_0x1982('0x2e')],_0x1080fa[_0x1982('0x3a')]));if(_0x366362['query']['filter']){_0x49ce08['where']=_['merge'](_0x49ce08['where'],{'$or':_[_0x1982('0x2b')](_0x49ce08[_0x1982('0x33')],function(_0x5bebe9){var _0x4bb90f={};_0x4bb90f[_0x5bebe9]={'$like':'%'+_0x366362[_0x1982('0x2e')]['filter']+'%'};return _0x4bb90f;})});}_0x49ce08=_[_0x1982('0x3d')]({},_0x49ce08,_0x366362[_0x1982('0x40')]);return _0x324c3e[_0x1982('0x4f')](_0x49ce08);}})[_0x1982('0x25')](function(_0x3f50b8){if(_0x3f50b8){_0x227414=_0x3f50b8[_0x1982('0x34')];if(!_0x366362[_0x1982('0x2e')][_0x1982('0x35')]('nolimit')){_0x49ce08[_0x1982('0x1c')]=qs[_0x1982('0x1c')](_0x366362[_0x1982('0x2e')]['limit']);_0x49ce08['offset']=qs[_0x1982('0x1e')](_0x366362[_0x1982('0x2e')][_0x1982('0x1e')]);}return _0x324c3e[_0x1982('0x4f')](_0x49ce08);}})[_0x1982('0x25')](function(_0x1b4af0){if(_0x1b4af0){return _0x1b4af0?{'count':_0x227414,'rows':_0x1b4af0}:null;}})[_0x1982('0x25')](respondWithResult(_0x37571d,null))[_0x1982('0x45')](handleError(_0x37571d,null));};exports[_0x1982('0x51')]=function(_0x34d654,_0x3c53da,_0x32bde1){if(_0x34d654['body']['id']){delete _0x34d654[_0x1982('0x4b')]['id'];}return db[_0x1982('0x41')][_0x1982('0x52')]({'where':{'id':_0x34d654[_0x1982('0x47')]['id']}})[_0x1982('0x25')](handleEntityNotFound(_0x3c53da,null))[_0x1982('0x25')](function(_0xcbd395){if(_0xcbd395){return _0xcbd395['setTags'](_0x34d654[_0x1982('0x4b')]['ids']||[]);}return null;})[_0x1982('0x25')](respondWithResult(_0x3c53da,null))['catch'](handleError(_0x3c53da,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index e05e102..7f4a7e5 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 _0x4fbd=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x4fbd,0x1bd));var _0xd4fb=function(_0x5a1140,_0x3d5d11){_0x5a1140=_0x5a1140-0x0;var _0x14f1c9=_0x4fbd[_0x5a1140];return _0x14f1c9;};'use strict';var _=require('lodash');var util=require(_0xd4fb('0x0'));var logger=require(_0xd4fb('0x1'))(_0xd4fb('0x2'));var moment=require(_0xd4fb('0x3'));var BPromise=require(_0xd4fb('0x4'));var rp=require(_0xd4fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4fb('0x6'));module[_0xd4fb('0x7')]=function(_0x4c3af1,_0x365a2e){return _0x4c3af1[_0xd4fb('0x8')](_0xd4fb('0x9'),attributes,{'tableName':_0xd4fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae52=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x403f5f,_0x283f67){var _0x15b1cd=function(_0x238cab){while(--_0x238cab){_0x403f5f['push'](_0x403f5f['shift']());}};_0x15b1cd(++_0x283f67);}(_0xae52,0xbb));var _0x2ae5=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xae52[_0x35b18a];return _0x4db1bd;};'use strict';var _=require(_0x2ae5('0x0'));var util=require(_0x2ae5('0x1'));var logger=require(_0x2ae5('0x2'))('api');var moment=require(_0x2ae5('0x3'));var BPromise=require(_0x2ae5('0x4'));var rp=require(_0x2ae5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ae5('0x6'));var config=require(_0x2ae5('0x7'));var attributes=require(_0x2ae5('0x8'));module[_0x2ae5('0x9')]=function(_0xa921c9,_0x1cf43c){return _0xa921c9[_0x2ae5('0xa')](_0x2ae5('0xb'),attributes,{'tableName':_0x2ae5('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 7342723..3c6f260 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 _0xc440=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0xc440,0x1c7));var _0x0c44=function(_0x5bc7d7,_0x315f09){_0x5bc7d7=_0x5bc7d7-0x0;var _0x483195=_0xc440[_0x5bc7d7];return _0x483195;};'use strict';var _=require(_0x0c44('0x0'));var util=require(_0x0c44('0x1'));var moment=require(_0x0c44('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c44('0x3'));var db=require(_0x0c44('0x4'))['db'];var utils=require(_0x0c44('0x5'));var logger=require(_0x0c44('0x6'))(_0x0c44('0x7'));var config=require(_0x0c44('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0c44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10fbbf,_0x39323d,_0xbf0a2b){return new BPromise(function(_0x5f39b2,_0x1b3b62){return client[_0x0c44('0xa')](_0x10fbbf,_0xbf0a2b)[_0x0c44('0xb')](function(_0x4d4839){logger[_0x0c44('0xc')](_0x0c44('0xd'),_0x39323d,_0x0c44('0xe'));logger['debug'](_0x0c44('0xf'),_0x39323d,'request\x20sent',JSON[_0x0c44('0x10')](_0x4d4839));if(_0x4d4839[_0x0c44('0x11')]){if(_0x4d4839[_0x0c44('0x11')][_0x0c44('0x12')]===0x1f4){logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);return _0x1b3b62(_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);}logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x4d4839[_0x0c44('0x11')][_0x0c44('0x13')]);return _0x5f39b2(_0x4d4839[_0x0c44('0x11')]['message']);}else{logger[_0x0c44('0xc')](_0x0c44('0xd'),_0x39323d,_0x0c44('0xe'));_0x5f39b2(_0x4d4839['result']['message']);}})['catch'](function(_0x504d96){logger[_0x0c44('0x11')](_0x0c44('0xd'),_0x39323d,_0x504d96);_0x1b3b62(_0x504d96);});});} \ No newline at end of file +var _0x60d0=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x60d0,0x1f4));var _0x060d=function(_0x52f76a,_0x21913f){_0x52f76a=_0x52f76a-0x0;var _0x5a7b7f=_0x60d0[_0x52f76a];return _0x5a7b7f;};'use strict';var _=require(_0x060d('0x0'));var util=require('util');var moment=require(_0x060d('0x1'));var BPromise=require(_0x060d('0x2'));var rs=require(_0x060d('0x3'));var fs=require('fs');var Redis=require(_0x060d('0x4'));var db=require(_0x060d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x060d('0x6'))(_0x060d('0x7'));var config=require(_0x060d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x060d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2827ac,_0xefc455,_0x2c4ff9){return new BPromise(function(_0xe632c9,_0x6b397c){return client['request'](_0x2827ac,_0x2c4ff9)[_0x060d('0xa')](function(_0x3293a5){logger[_0x060d('0xb')](_0x060d('0xc'),_0xefc455,_0x060d('0xd'));logger[_0x060d('0xe')](_0x060d('0xf'),_0xefc455,_0x060d('0xd'),JSON['stringify'](_0x3293a5));if(_0x3293a5[_0x060d('0x10')]){if(_0x3293a5['error'][_0x060d('0x11')]===0x1f4){logger[_0x060d('0x10')](_0x060d('0xc'),_0xefc455,_0x3293a5[_0x060d('0x10')][_0x060d('0x12')]);return _0x6b397c(_0x3293a5[_0x060d('0x10')][_0x060d('0x12')]);}logger[_0x060d('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xefc455,_0x3293a5[_0x060d('0x10')][_0x060d('0x12')]);return _0xe632c9(_0x3293a5['error']['message']);}else{logger[_0x060d('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xefc455,'request\x20sent');_0xe632c9(_0x3293a5[_0x060d('0x13')][_0x060d('0x12')]);}})[_0x060d('0x14')](function(_0x5188b0){logger[_0x060d('0x10')](_0x060d('0xc'),_0xefc455,_0x5188b0);_0x6b397c(_0x5188b0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f153267..0064e63 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 _0x7271=['./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x7271,0xc0));var _0x1727=function(_0xa6f8ea,_0x51cd0e){_0xa6f8ea=_0xa6f8ea-0x0;var _0x4a3097=_0x7271[_0xa6f8ea];return _0x4a3097;};'use strict';var multer=require('multer');var util=require(_0x1727('0x0'));var path=require(_0x1727('0x1'));var timeout=require(_0x1727('0x2'));var express=require('express');var router=express[_0x1727('0x3')]();var fs_extra=require(_0x1727('0x4'));var auth=require(_0x1727('0x5'));var interaction=require(_0x1727('0x6'));var config=require(_0x1727('0x7'));var controller=require(_0x1727('0x8'));router[_0x1727('0x9')]('/',auth['isAuthenticated'](),controller[_0x1727('0xa')]);router[_0x1727('0x9')](_0x1727('0xb'),auth[_0x1727('0xc')](),controller[_0x1727('0xd')]);router[_0x1727('0xe')]('/',auth[_0x1727('0xc')](),controller[_0x1727('0xf')]);router[_0x1727('0x10')]('/:id',auth[_0x1727('0xc')](),controller[_0x1727('0x11')]);router['delete'](_0x1727('0xb'),auth['isAuthenticated'](),controller[_0x1727('0x12')]);module[_0x1727('0x13')]=router; \ No newline at end of file +var _0x2b20=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x2b20,0x1ae));var _0x02b2=function(_0x1d1dbc,_0xe41f1c){_0x1d1dbc=_0x1d1dbc-0x0;var _0x4959ac=_0x2b20[_0x1d1dbc];return _0x4959ac;};'use strict';var multer=require(_0x02b2('0x0'));var util=require(_0x02b2('0x1'));var path=require(_0x02b2('0x2'));var timeout=require('connect-timeout');var express=require(_0x02b2('0x3'));var router=express[_0x02b2('0x4')]();var fs_extra=require(_0x02b2('0x5'));var auth=require(_0x02b2('0x6'));var interaction=require(_0x02b2('0x7'));var config=require(_0x02b2('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x02b2('0x9')]('/',auth[_0x02b2('0xa')](),controller[_0x02b2('0xb')]);router[_0x02b2('0x9')](_0x02b2('0xc'),auth[_0x02b2('0xa')](),controller[_0x02b2('0xd')]);router[_0x02b2('0xe')]('/',auth[_0x02b2('0xa')](),controller[_0x02b2('0xf')]);router[_0x02b2('0x10')](_0x02b2('0xc'),auth[_0x02b2('0xa')](),controller[_0x02b2('0x11')]);router[_0x02b2('0x12')](_0x02b2('0xc'),auth[_0x02b2('0xa')](),controller['destroy']);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 4d48725..a41e2c3 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 _0xb404=['BOOLEAN','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x3ed71b,_0x4f5514){var _0x15804f=function(_0x474dd8){while(--_0x474dd8){_0x3ed71b['push'](_0x3ed71b['shift']());}};_0x15804f(++_0x4f5514);}(_0xb404,0x1cc));var _0x4b40=function(_0x2b8b8d,_0x51e866){_0x2b8b8d=_0x2b8b8d-0x0;var _0x391af6=_0xb404[_0x2b8b8d];return _0x391af6;};'use strict';var Sequelize=require('sequelize');module[_0x4b40('0x0')]={'type':{'type':Sequelize['ENUM'](_0x4b40('0x1'),_0x4b40('0x2'),_0x4b40('0x3'),_0x4b40('0x4'),_0x4b40('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4b40('0x6')]},'keyType':{'type':Sequelize[_0x4b40('0x7')]('string',_0x4b40('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x4b40('0x6')]},'idField':{'type':Sequelize[_0x4b40('0x6')]},'nameField':{'type':Sequelize[_0x4b40('0x6')]},'customField':{'type':Sequelize[_0x4b40('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b40('0x6')]}}; \ No newline at end of file +var _0x9dee=['string','variable','customVariable','keyValue','picklist','STRING','exports','ENUM'];(function(_0x330012,_0x41f3e1){var _0x1c0d27=function(_0x4e5c2f){while(--_0x4e5c2f){_0x330012['push'](_0x330012['shift']());}};_0x1c0d27(++_0x41f3e1);}(_0x9dee,0x15e));var _0xe9de=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x9dee[_0x5a7e3c];return _0x59252b;};'use strict';var Sequelize=require('sequelize');module[_0xe9de('0x0')]={'type':{'type':Sequelize[_0xe9de('0x1')](_0xe9de('0x2'),_0xe9de('0x3'),_0xe9de('0x4'),_0xe9de('0x5'),_0xe9de('0x6')),'defaultValue':_0xe9de('0x2')},'content':{'type':Sequelize[_0xe9de('0x7')]},'key':{'type':Sequelize[_0xe9de('0x7')]},'keyType':{'type':Sequelize[_0xe9de('0x1')]('string',_0xe9de('0x3'),_0xe9de('0x4'))},'keyContent':{'type':Sequelize[_0xe9de('0x7')]},'idField':{'type':Sequelize[_0xe9de('0x7')]},'nameField':{'type':Sequelize[_0xe9de('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe9de('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 9953ce4..49e2197 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 _0xb9a7=['merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','create','body','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','stack','map','FreshdeskField','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb9a7[_0x1928c9];return _0x51b5fb;};'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(){_0x35aca7['status'](0xcc)[_0x7b9a('0x15')]();});}};}function handleEntityNotFound(_0x23219e,_0x5809f5){return function(_0x39b7ec){if(!_0x39b7ec){_0x23219e['sendStatus'](0x194);}return _0x39b7ec;};}function handleError(_0x31eb67,_0x3091ab){_0x3091ab=_0x3091ab||0x1f4;return function(_0x4c2271){logger['error'](_0x4c2271[_0x7b9a('0x20')]);if(_0x4c2271['name']){delete _0x4c2271['name'];}_0x31eb67[_0x7b9a('0x14')](_0x3091ab)['send'](_0x4c2271);};}exports['index']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={},_0x314b6d={},_0x4fee38={'count':0x0,'rows':[]};var _0x1553ae=_[_0x7b9a('0x21')](db[_0x7b9a('0x22')]['rawAttributes'],function(_0x45ccf5){return{'name':_0x45ccf5[_0x7b9a('0x23')],'type':_0x45ccf5[_0x7b9a('0x24')][_0x7b9a('0x25')]};});_0x314b6d[_0x7b9a('0x26')]=_[_0x7b9a('0x21')](_0x1553ae,'name');_0x314b6d['query']=_[_0x7b9a('0x27')](_0x3847b4[_0x7b9a('0x28')]);_0x314b6d[_0x7b9a('0x29')]=_['intersection'](_0x314b6d[_0x7b9a('0x26')],_0x314b6d[_0x7b9a('0x28')]);_0x5c89b6['attributes']=_['intersection'](_0x314b6d[_0x7b9a('0x26')],qs[_0x7b9a('0x2a')](_0x3847b4['query'][_0x7b9a('0x2a')]));_0x5c89b6[_0x7b9a('0x2b')]=_0x5c89b6[_0x7b9a('0x2b')][_0x7b9a('0x2c')]?_0x5c89b6[_0x7b9a('0x2b')]:_0x314b6d['model'];if(!_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x2d')](_0x7b9a('0x2e'))){_0x5c89b6[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x3847b4[_0x7b9a('0x28')]['limit']);_0x5c89b6['offset']=qs[_0x7b9a('0x17')](_0x3847b4[_0x7b9a('0x28')]['offset']);}_0x5c89b6[_0x7b9a('0x2f')]=qs[_0x7b9a('0x30')](_0x3847b4[_0x7b9a('0x28')]['sort']);_0x5c89b6[_0x7b9a('0x31')]=qs[_0x7b9a('0x29')](_['pick'](_0x3847b4['query'],_0x314b6d[_0x7b9a('0x29')]),_0x1553ae);if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]){_0x5c89b6[_0x7b9a('0x31')]=_[_0x7b9a('0x33')](_0x5c89b6[_0x7b9a('0x31')],{'$or':_[_0x7b9a('0x21')](_0x1553ae,function(_0x380f4b){if(_0x380f4b['type']!==_0x7b9a('0x34')){var _0x5ac175={};_0x5ac175[_0x380f4b[_0x7b9a('0x35')]]={'$like':'%'+_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x32')]+'%'};return _0x5ac175;}})});}_0x5c89b6=_[_0x7b9a('0x33')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x36')]);var _0x89951b={'where':_0x5c89b6['where']};return db[_0x7b9a('0x22')][_0x7b9a('0x19')](_0x89951b)[_0x7b9a('0x1e')](function(_0x1bc1f0){_0x4fee38['count']=_0x1bc1f0;if(_0x3847b4[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x5c89b6[_0x7b9a('0x38')]=[{'all':!![]}];}return db[_0x7b9a('0x22')]['findAll'](_0x5c89b6);})[_0x7b9a('0x1e')](function(_0x53d89a){_0x4fee38[_0x7b9a('0x39')]=_0x53d89a;return _0x4fee38;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x4d5880,_0x5c89b6))[_0x7b9a('0x3a')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x3b')]=function(_0x43fad0,_0x41f541){var _0x56e274={'raw':!![],'where':{'id':_0x43fad0[_0x7b9a('0x3c')]['id']}},_0x33edc6={};_0x33edc6[_0x7b9a('0x26')]=_['keys'](db['FreshdeskField'][_0x7b9a('0x3d')]);_0x33edc6[_0x7b9a('0x28')]=_[_0x7b9a('0x27')](_0x43fad0[_0x7b9a('0x28')]);_0x33edc6[_0x7b9a('0x29')]=_[_0x7b9a('0x3e')](_0x33edc6['model'],_0x33edc6['query']);_0x56e274['attributes']=_[_0x7b9a('0x3e')](_0x33edc6[_0x7b9a('0x26')],qs['fields'](_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x2a')]));_0x56e274[_0x7b9a('0x2b')]=_0x56e274['attributes'][_0x7b9a('0x2c')]?_0x56e274['attributes']:_0x33edc6[_0x7b9a('0x26')];if(_0x43fad0[_0x7b9a('0x28')][_0x7b9a('0x37')]){_0x56e274[_0x7b9a('0x38')]=[{'all':!![]}];}_0x56e274=_[_0x7b9a('0x33')]({},_0x56e274,_0x43fad0['options']);return db[_0x7b9a('0x22')]['find'](_0x56e274)[_0x7b9a('0x1e')](handleEntityNotFound(_0x41f541,null))['then'](respondWithResult(_0x41f541,null))['catch'](handleError(_0x41f541,null));};exports[_0x7b9a('0x3f')]=function(_0x3727ef,_0x717d08){return db[_0x7b9a('0x22')][_0x7b9a('0x3f')](_0x3727ef[_0x7b9a('0x40')],{})[_0x7b9a('0x1e')](respondWithResult(_0x717d08,0xc9))[_0x7b9a('0x3a')](handleError(_0x717d08,null));};exports[_0x7b9a('0x1d')]=function(_0x5088c7,_0x1d7957){if(_0x5088c7[_0x7b9a('0x40')]['id']){delete _0x5088c7['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x5088c7[_0x7b9a('0x3c')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1d7957,null))[_0x7b9a('0x1e')](saveUpdates(_0x5088c7[_0x7b9a('0x40')],null))['then'](respondWithResult(_0x1d7957,null))[_0x7b9a('0x3a')](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1f')]=function(_0x287dea,_0x33b200){return db[_0x7b9a('0x22')]['find']({'where':{'id':_0x287dea[_0x7b9a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33b200,null))[_0x7b9a('0x1e')](removeEntity(_0x33b200,null))[_0x7b9a('0x3a')](handleError(_0x33b200,null));}; \ No newline at end of file +var _0x153f=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x1312a2,_0x30e0f2){var _0x1ddc92=function(_0x36ef02){while(--_0x36ef02){_0x1312a2['push'](_0x1312a2['shift']());}};_0x1ddc92(++_0x30e0f2);}(_0x153f,0x15b));var _0xf153=function(_0x364d5c,_0x2a542d){_0x364d5c=_0x364d5c-0x0;var _0x5aa7f6=_0x153f[_0x364d5c];return _0x5aa7f6;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={},_0x339e96={},_0x258976={'count':0x0,'rows':[]};var _0x441436=_[_0xf153('0x2d')](db[_0xf153('0x2e')][_0xf153('0x2f')],function(_0x13b541){return{'name':_0x13b541[_0xf153('0x30')],'type':_0x13b541['type'][_0xf153('0x31')]};});_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2d')](_0x441436,_0xf153('0x2b'));_0x339e96['query']=_['keys'](_0x10295e[_0xf153('0x33')]);_0x339e96['filters']=_['intersection'](_0x339e96[_0xf153('0x32')],_0x339e96['query']);_0x2b9a9c[_0xf153('0x34')]=_['intersection'](_0x339e96[_0xf153('0x32')],qs[_0xf153('0x35')](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c[_0xf153('0x34')]=_0x2b9a9c[_0xf153('0x34')][_0xf153('0x36')]?_0x2b9a9c[_0xf153('0x34')]:_0x339e96[_0xf153('0x32')];if(!_0x10295e['query'][_0xf153('0x37')]('nolimit')){_0x2b9a9c[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x10295e[_0xf153('0x33')][_0xf153('0x20')]);_0x2b9a9c[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x10295e['query'][_0xf153('0x1f')]);}_0x2b9a9c[_0xf153('0x38')]=qs[_0xf153('0x39')](_0x10295e['query'][_0xf153('0x39')]);_0x2b9a9c[_0xf153('0x3a')]=qs[_0xf153('0x3b')](_[_0xf153('0x3c')](_0x10295e[_0xf153('0x33')],_0x339e96[_0xf153('0x3b')]),_0x441436);if(_0x10295e['query'][_0xf153('0x3d')]){_0x2b9a9c[_0xf153('0x3a')]=_['merge'](_0x2b9a9c[_0xf153('0x3a')],{'$or':_[_0xf153('0x2d')](_0x441436,function(_0x357666){if(_0x357666[_0xf153('0x3e')]!==_0xf153('0x3f')){var _0x42360a={};_0x42360a[_0x357666[_0xf153('0x2b')]]={'$like':'%'+_0x10295e['query'][_0xf153('0x3d')]+'%'};return _0x42360a;}})});}_0x2b9a9c=_[_0xf153('0x40')]({},_0x2b9a9c,_0x10295e[_0xf153('0x41')]);var _0x352e7c={'where':_0x2b9a9c[_0xf153('0x3a')]};return db[_0xf153('0x2e')]['count'](_0x352e7c)['then'](function(_0xa3922b){_0x258976['count']=_0xa3922b;if(_0x10295e[_0xf153('0x33')][_0xf153('0x42')]){_0x2b9a9c[_0xf153('0x43')]=[{'all':!![]}];}return db[_0xf153('0x2e')][_0xf153('0x44')](_0x2b9a9c);})[_0xf153('0x27')](function(_0x5599e5){_0x258976['rows']=_0x5599e5;return _0x258976;})[_0xf153('0x27')](respondWithFilteredResult(_0x261ac0,_0x2b9a9c))[_0xf153('0x45')](handleError(_0x261ac0,null));};exports['show']=function(_0x21529a,_0x1c77a6){var _0x1edf65={'raw':!![],'where':{'id':_0x21529a[_0xf153('0x46')]['id']}},_0x3a9cb2={};_0x3a9cb2[_0xf153('0x32')]=_[_0xf153('0x47')](db[_0xf153('0x2e')][_0xf153('0x2f')]);_0x3a9cb2[_0xf153('0x33')]=_[_0xf153('0x47')](_0x21529a[_0xf153('0x33')]);_0x3a9cb2['filters']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],_0x3a9cb2[_0xf153('0x33')]);_0x1edf65['attributes']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],qs['fields'](_0x21529a[_0xf153('0x33')]['fields']));_0x1edf65[_0xf153('0x34')]=_0x1edf65[_0xf153('0x34')][_0xf153('0x36')]?_0x1edf65['attributes']:_0x3a9cb2[_0xf153('0x32')];if(_0x21529a[_0xf153('0x33')][_0xf153('0x42')]){_0x1edf65[_0xf153('0x43')]=[{'all':!![]}];}_0x1edf65=_[_0xf153('0x40')]({},_0x1edf65,_0x21529a['options']);return db[_0xf153('0x2e')][_0xf153('0x49')](_0x1edf65)['then'](handleEntityNotFound(_0x1c77a6,null))[_0xf153('0x27')](respondWithResult(_0x1c77a6,null))[_0xf153('0x45')](handleError(_0x1c77a6,null));};exports[_0xf153('0x4a')]=function(_0x5599a6,_0x657403){return db[_0xf153('0x2e')][_0xf153('0x4a')](_0x5599a6[_0xf153('0x4b')],{})[_0xf153('0x27')](respondWithResult(_0x657403,0xc9))[_0xf153('0x45')](handleError(_0x657403,null));};exports[_0xf153('0x26')]=function(_0x33e48,_0x3b91ed){if(_0x33e48['body']['id']){delete _0x33e48[_0xf153('0x4b')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x33e48['params']['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x3b91ed,null))[_0xf153('0x27')](saveUpdates(_0x33e48['body'],null))[_0xf153('0x27')](respondWithResult(_0x3b91ed,null))[_0xf153('0x45')](handleError(_0x3b91ed,null));};exports['destroy']=function(_0x3f1ecb,_0xe6e023){return db[_0xf153('0x2e')][_0xf153('0x49')]({'where':{'id':_0x3f1ecb[_0xf153('0x46')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0xe6e023,null))['then'](removeEntity(_0xe6e023,null))[_0xf153('0x45')](handleError(_0xe6e023,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0f8482f..5cc27c1 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 _0xc715=['./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f2aaf,_0x108c2a){var _0x147986=function(_0x39986e){while(--_0x39986e){_0x1f2aaf['push'](_0x1f2aaf['shift']());}};_0x147986(++_0x108c2a);}(_0xc715,0x18f));var _0x5c71=function(_0x3f816c,_0x51ed7c){_0x3f816c=_0x3f816c-0x0;var _0x55f2dd=_0xc715[_0x3f816c];return _0x55f2dd;};'use strict';var _=require('lodash');var util=require(_0x5c71('0x0'));var logger=require(_0x5c71('0x1'))(_0x5c71('0x2'));var moment=require(_0x5c71('0x3'));var BPromise=require(_0x5c71('0x4'));var rp=require(_0x5c71('0x5'));var fs=require('fs');var path=require(_0x5c71('0x6'));var rimraf=require(_0x5c71('0x7'));var config=require(_0x5c71('0x8'));var attributes=require(_0x5c71('0x9'));module[_0x5c71('0xa')]=function(_0x4fbd70,_0xef132b){return _0x4fbd70[_0x5c71('0xb')](_0x5c71('0xc'),attributes,{'tableName':_0x5c71('0xd'),'paranoid':![],'indexes':[{'name':_0x5c71('0xe'),'fields':[_0x5c71('0xf'),_0x5c71('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cb=['bluebird','path','rimraf','exports','define','int_freshdesk_fields','idField','util','api'];(function(_0x141510,_0x284c16){var _0x3296cd=function(_0x5b1859){while(--_0x5b1859){_0x141510['push'](_0x141510['shift']());}};_0x3296cd(++_0x284c16);}(_0xf2cb,0x130));var _0xbf2c=function(_0x4e3337,_0x1c82b1){_0x4e3337=_0x4e3337-0x0;var _0x307c43=_0xf2cb[_0x4e3337];return _0x307c43;};'use strict';var _=require('lodash');var util=require(_0xbf2c('0x0'));var logger=require('../../config/logger')(_0xbf2c('0x1'));var moment=require('moment');var BPromise=require(_0xbf2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf2c('0x3'));var rimraf=require(_0xbf2c('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xbf2c('0x5')]=function(_0x46d282,_0x1fc371){return _0x46d282[_0xbf2c('0x6')]('FreshdeskField',attributes,{'tableName':_0xbf2c('0x7'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xbf2c('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 50dc3c1..e09f3cd 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 _0xa296=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x45a85e,_0x292dd7){var _0x4c85b7=function(_0x10059f){while(--_0x10059f){_0x45a85e['push'](_0x45a85e['shift']());}};_0x4c85b7(++_0x292dd7);}(_0xa296,0x1cb));var _0x6a29=function(_0x3c62ab,_0x33f23d){_0x3c62ab=_0x3c62ab-0x0;var _0x536970=_0xa296[_0x3c62ab];return _0x536970;};'use strict';var _=require('lodash');var util=require(_0x6a29('0x0'));var moment=require(_0x6a29('0x1'));var BPromise=require(_0x6a29('0x2'));var rs=require(_0x6a29('0x3'));var fs=require('fs');var Redis=require(_0x6a29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a29('0x5'));var logger=require(_0x6a29('0x6'))(_0x6a29('0x7'));var config=require(_0x6a29('0x8'));var jayson=require(_0x6a29('0x9'));var client=jayson['client'][_0x6a29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409dbb,_0x57957e,_0x1bb9fb){return new BPromise(function(_0x277f90,_0x37c3cd){return client['request'](_0x409dbb,_0x1bb9fb)[_0x6a29('0xb')](function(_0x4ed7f5){logger[_0x6a29('0xc')](_0x6a29('0xd'),_0x57957e,_0x6a29('0xe'));logger[_0x6a29('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x57957e,'request\x20sent',JSON['stringify'](_0x4ed7f5));if(_0x4ed7f5[_0x6a29('0x10')]){if(_0x4ed7f5['error'][_0x6a29('0x11')]===0x1f4){logger[_0x6a29('0x10')](_0x6a29('0xd'),_0x57957e,_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);return _0x37c3cd(_0x4ed7f5['error'][_0x6a29('0x12')]);}logger[_0x6a29('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x57957e,_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);return _0x277f90(_0x4ed7f5[_0x6a29('0x10')][_0x6a29('0x12')]);}else{logger[_0x6a29('0xc')](_0x6a29('0xd'),_0x57957e,_0x6a29('0xe'));_0x277f90(_0x4ed7f5[_0x6a29('0x13')][_0x6a29('0x12')]);}})[_0x6a29('0x14')](function(_0x376ea7){logger[_0x6a29('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x57957e,_0x376ea7);_0x37c3cd(_0x376ea7);});});} \ No newline at end of file +var _0xde30=['../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','../../mysqldb','rpc'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xde30,0x13e));var _0x0de3=function(_0x535055,_0x563a1b){_0x535055=_0x535055-0x0;var _0x3d01da=_0xde30[_0x535055];return _0x3d01da;};'use strict';var _=require(_0x0de3('0x0'));var util=require(_0x0de3('0x1'));var moment=require(_0x0de3('0x2'));var BPromise=require(_0x0de3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0de3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0de3('0x5'));var config=require(_0x0de3('0x6'));var jayson=require(_0x0de3('0x7'));var client=jayson[_0x0de3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dedb1,_0x29e367,_0x27b053){return new BPromise(function(_0x590707,_0x1f74a4){return client[_0x0de3('0x9')](_0x1dedb1,_0x27b053)[_0x0de3('0xa')](function(_0x4011e3){logger[_0x0de3('0xb')](_0x0de3('0xc'),_0x29e367,_0x0de3('0xd'));logger['debug'](_0x0de3('0xe'),_0x29e367,_0x0de3('0xd'),JSON['stringify'](_0x4011e3));if(_0x4011e3[_0x0de3('0xf')]){if(_0x4011e3[_0x0de3('0xf')]['code']===0x1f4){logger[_0x0de3('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x29e367,_0x4011e3['error'][_0x0de3('0x10')]);return _0x1f74a4(_0x4011e3[_0x0de3('0xf')]['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x29e367,_0x4011e3[_0x0de3('0xf')]['message']);return _0x590707(_0x4011e3['error'][_0x0de3('0x10')]);}else{logger['info'](_0x0de3('0xc'),_0x29e367,_0x0de3('0xd'));_0x590707(_0x4011e3[_0x0de3('0x11')][_0x0de3('0x10')]);}})['catch'](function(_0x3e24dd){logger[_0x0de3('0xf')](_0x0de3('0xc'),_0x29e367,_0x3e24dd);_0x1f74a4(_0x3e24dd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 74992e4..41b7ffa 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 _0xde2c=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x18d91e,_0xcb6fa1){var _0x4229de=function(_0x27401c){while(--_0x27401c){_0x18d91e['push'](_0x18d91e['shift']());}};_0x4229de(++_0xcb6fa1);}(_0xde2c,0x7f));var _0xcde2=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xde2c[_0x1e6db3];return _0x1de886;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id/configurations',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcde2('0x12')](_0xcde2('0x13'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x14')]);router[_0xcde2('0x15')](_0xcde2('0xd'),auth['isAuthenticated'](),controller[_0xcde2('0x16')]);router['delete'](_0xcde2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xcde2('0x17')]=router; \ No newline at end of file +var _0x6c76=['getConfigurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations'];(function(_0x87d60b,_0x2b44ad){var _0x52173d=function(_0x2a5173){while(--_0x2a5173){_0x87d60b['push'](_0x87d60b['shift']());}};_0x52173d(++_0x2b44ad);}(_0x6c76,0x184));var _0x66c7=function(_0x2e3c94,_0x58c0d6){_0x2e3c94=_0x2e3c94-0x0;var _0x1af52b=_0x6c76[_0x2e3c94];return _0x1af52b;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['getFields']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xd')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xf')]);router['put'](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);module[_0x66c7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 8c5464f..db9126f 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 _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x30efad,_0x245cc4){var _0x3505a4=function(_0x107ce1){while(--_0x107ce1){_0x30efad['push'](_0x30efad['shift']());}};_0x3505a4(++_0x245cc4);}(_0x9582,0x95));var _0x2958=function(_0xf24dd8,_0x468ca3){_0xf24dd8=_0xf24dd8-0x0;var _0x423215=_0x9582[_0xf24dd8];return _0x423215;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['remoteUri','sequelize','STRING'];(function(_0x2b6fa1,_0x4f1c58){var _0x117931=function(_0x3adc25){while(--_0x3adc25){_0x2b6fa1['push'](_0x2b6fa1['shift']());}};_0x117931(++_0x4f1c58);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c763e,_0x4654de){_0x2c763e=_0x2c763e-0x0;var _0x53b5b8=_0xb10b[_0x2c763e];return _0x53b5b8;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize[_0xbb10('0x1')]},'username':{'type':Sequelize[_0xbb10('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xbb10('0x1')]},'remoteUri':{'type':Sequelize[_0xbb10('0x1')],'unique':_0xbb10('0x2')},'serverUrl':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3f99f29..67bfdee 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 _0xfbd5=['body','params','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','FreshsalesAccount','findAll','rows','catch','show','includeAll','include','find','create'];(function(_0x233d82,_0x5ef2c4){var _0x5586cb=function(_0x6642fe){while(--_0x6642fe){_0x233d82['push'](_0x233d82['shift']());}};_0x5586cb(++_0x5ef2c4);}(_0xfbd5,0x8a));var _0x5fbd=function(_0x3302e6,_0x4df139){_0x3302e6=_0x3302e6-0x0;var _0x2aa3fe=_0xfbd5[_0x3302e6];return _0x2aa3fe;};'use strict';var emlformat=require(_0x5fbd('0x0'));var rimraf=require(_0x5fbd('0x1'));var zipdir=require(_0x5fbd('0x2'));var jsonpatch=require(_0x5fbd('0x3'));var rp=require('request-promise');var moment=require(_0x5fbd('0x4'));var BPromise=require(_0x5fbd('0x5'));var Mustache=require(_0x5fbd('0x6'));var util=require(_0x5fbd('0x7'));var path=require('path');var sox=require(_0x5fbd('0x8'));var csv=require(_0x5fbd('0x9'));var ejs=require(_0x5fbd('0xa'));var fs=require('fs');var fs_extra=require(_0x5fbd('0xb'));var _=require(_0x5fbd('0xc'));var squel=require(_0x5fbd('0xd'));var crypto=require(_0x5fbd('0xe'));var jsforce=require(_0x5fbd('0xf'));var deskjs=require(_0x5fbd('0x10'));var toCsv=require(_0x5fbd('0x9'));var querystring=require(_0x5fbd('0x11'));var Papa=require('papaparse');var Redis=require(_0x5fbd('0x12'));var authService=require(_0x5fbd('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5fbd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fbd('0x15'))(_0x5fbd('0x16'));var utils=require(_0x5fbd('0x17'));var config=require(_0x5fbd('0x18'));var licenseUtil=require(_0x5fbd('0x19'));var db=require(_0x5fbd('0x1a'))['db'];var integrations=require(_0x5fbd('0x1b'));function respondWithStatusCode(_0x40b9c7,_0xf75df5){_0xf75df5=_0xf75df5||0xcc;return function(_0x245400){if(_0x245400){return _0x40b9c7[_0x5fbd('0x1c')](_0xf75df5);}return _0x40b9c7[_0x5fbd('0x1d')](_0xf75df5)[_0x5fbd('0x1e')]();};}function respondWithResult(_0x1763df,_0x27613a){_0x27613a=_0x27613a||0xc8;return function(_0x59b7c6){if(_0x59b7c6){return _0x1763df[_0x5fbd('0x1d')](_0x27613a)[_0x5fbd('0x1f')](_0x59b7c6);}};}function respondWithFilteredResult(_0x23c116,_0x55d84b){return function(_0x25348b){if(_0x25348b){var _0x128564=typeof _0x55d84b[_0x5fbd('0x20')]==='undefined'&&typeof _0x55d84b[_0x5fbd('0x21')]===_0x5fbd('0x22');var _0x193da8=_0x25348b[_0x5fbd('0x23')];var _0x1f7ad5=_0x128564?0x0:_0x55d84b[_0x5fbd('0x20')];var _0x104ecf=_0x128564?_0x25348b[_0x5fbd('0x23')]:_0x55d84b[_0x5fbd('0x20')]+_0x55d84b['limit'];var _0x27c6e8;if(_0x104ecf>=_0x193da8){_0x104ecf=_0x193da8;_0x27c6e8=0xc8;}else{_0x27c6e8=0xce;}_0x23c116['status'](_0x27c6e8);return _0x23c116['set'](_0x5fbd('0x24'),_0x1f7ad5+'-'+_0x104ecf+'/'+_0x193da8)['json'](_0x25348b);}return null;};}function patchUpdates(_0x1da134){return function(_0x8c168d){try{jsonpatch[_0x5fbd('0x25')](_0x8c168d,_0x1da134,!![]);}catch(_0xb36f9c){return BPromise[_0x5fbd('0x26')](_0xb36f9c);}return _0x8c168d[_0x5fbd('0x27')]();};}function saveUpdates(_0x174d45,_0x434120){return function(_0x312d16){if(_0x312d16){return _0x312d16[_0x5fbd('0x28')](_0x174d45)[_0x5fbd('0x29')](function(_0x30315b){return _0x30315b;});}return null;};}function removeEntity(_0x510495,_0x175cd8){return function(_0x293eb7){if(_0x293eb7){return _0x293eb7[_0x5fbd('0x2a')]()['then'](function(){_0x510495[_0x5fbd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56474c,_0x51ab1f){return function(_0x22fe8a){if(!_0x22fe8a){_0x56474c[_0x5fbd('0x1c')](0x194);}return _0x22fe8a;};}function handleError(_0x430a83,_0x5cffed){_0x5cffed=_0x5cffed||0x1f4;return function(_0x476f76){logger['error'](_0x476f76[_0x5fbd('0x2b')]);if(_0x476f76[_0x5fbd('0x2c')]){delete _0x476f76[_0x5fbd('0x2c')];}_0x430a83[_0x5fbd('0x1d')](_0x5cffed)['send'](_0x476f76);};}exports[_0x5fbd('0x2d')]=function(_0x4ba4d0,_0x23d134){var _0x70c40f={},_0x3cf1a2={},_0x540504={'count':0x0,'rows':[]};var _0x5ce2f5=_[_0x5fbd('0x2e')](db['FreshsalesAccount'][_0x5fbd('0x2f')],function(_0x1c378b){return{'name':_0x1c378b[_0x5fbd('0x30')],'type':_0x1c378b['type'][_0x5fbd('0x31')]};});_0x3cf1a2[_0x5fbd('0x32')]=_['map'](_0x5ce2f5,'name');_0x3cf1a2['query']=_[_0x5fbd('0x33')](_0x4ba4d0[_0x5fbd('0x34')]);_0x3cf1a2['filters']=_[_0x5fbd('0x35')](_0x3cf1a2[_0x5fbd('0x32')],_0x3cf1a2[_0x5fbd('0x34')]);_0x70c40f['attributes']=_[_0x5fbd('0x35')](_0x3cf1a2[_0x5fbd('0x32')],qs[_0x5fbd('0x36')](_0x4ba4d0[_0x5fbd('0x34')]['fields']));_0x70c40f[_0x5fbd('0x37')]=_0x70c40f[_0x5fbd('0x37')][_0x5fbd('0x38')]?_0x70c40f[_0x5fbd('0x37')]:_0x3cf1a2['model'];if(!_0x4ba4d0[_0x5fbd('0x34')]['hasOwnProperty'](_0x5fbd('0x39'))){_0x70c40f[_0x5fbd('0x21')]=qs[_0x5fbd('0x21')](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x21')]);_0x70c40f[_0x5fbd('0x20')]=qs['offset'](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x20')]);}_0x70c40f[_0x5fbd('0x3a')]=qs[_0x5fbd('0x3b')](_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3b')]);_0x70c40f[_0x5fbd('0x3c')]=qs[_0x5fbd('0x3d')](_['pick'](_0x4ba4d0['query'],_0x3cf1a2[_0x5fbd('0x3d')]),_0x5ce2f5);if(_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3e')]){_0x70c40f[_0x5fbd('0x3c')]=_[_0x5fbd('0x3f')](_0x70c40f[_0x5fbd('0x3c')],{'$or':_[_0x5fbd('0x2e')](_0x5ce2f5,function(_0x28fef5){if(_0x28fef5[_0x5fbd('0x40')]!==_0x5fbd('0x41')){var _0xbcbf43={};_0xbcbf43[_0x28fef5[_0x5fbd('0x2c')]]={'$like':'%'+_0x4ba4d0[_0x5fbd('0x34')][_0x5fbd('0x3e')]+'%'};return _0xbcbf43;}})});}_0x70c40f=_[_0x5fbd('0x3f')]({},_0x70c40f,_0x4ba4d0[_0x5fbd('0x42')]);var _0x2e79e3={'where':_0x70c40f[_0x5fbd('0x3c')]};return db[_0x5fbd('0x43')]['count'](_0x2e79e3)[_0x5fbd('0x29')](function(_0x2c6075){_0x540504['count']=_0x2c6075;if(_0x4ba4d0[_0x5fbd('0x34')]['includeAll']){_0x70c40f['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5fbd('0x44')](_0x70c40f);})[_0x5fbd('0x29')](function(_0x2e23fe){_0x540504[_0x5fbd('0x45')]=_0x2e23fe;return _0x540504;})[_0x5fbd('0x29')](respondWithFilteredResult(_0x23d134,_0x70c40f))[_0x5fbd('0x46')](handleError(_0x23d134,null));};exports[_0x5fbd('0x47')]=function(_0x51a91b,_0x37a4f6){var _0x6b0284={'raw':![],'where':{'id':_0x51a91b['params']['id']}},_0x52f49a={};_0x52f49a['model']=_['keys'](db[_0x5fbd('0x43')][_0x5fbd('0x2f')]);_0x52f49a[_0x5fbd('0x34')]=_[_0x5fbd('0x33')](_0x51a91b['query']);_0x52f49a[_0x5fbd('0x3d')]=_[_0x5fbd('0x35')](_0x52f49a[_0x5fbd('0x32')],_0x52f49a[_0x5fbd('0x34')]);_0x6b0284[_0x5fbd('0x37')]=_[_0x5fbd('0x35')](_0x52f49a[_0x5fbd('0x32')],qs[_0x5fbd('0x36')](_0x51a91b[_0x5fbd('0x34')][_0x5fbd('0x36')]));_0x6b0284[_0x5fbd('0x37')]=_0x6b0284[_0x5fbd('0x37')][_0x5fbd('0x38')]?_0x6b0284['attributes']:_0x52f49a[_0x5fbd('0x32')];if(_0x51a91b['query'][_0x5fbd('0x48')]){_0x6b0284[_0x5fbd('0x49')]=[{'all':!![]}];}_0x6b0284=_[_0x5fbd('0x3f')]({},_0x6b0284,_0x51a91b[_0x5fbd('0x42')]);return db[_0x5fbd('0x43')][_0x5fbd('0x4a')](_0x6b0284)[_0x5fbd('0x29')](handleEntityNotFound(_0x37a4f6,null))[_0x5fbd('0x29')](respondWithResult(_0x37a4f6,null))[_0x5fbd('0x46')](handleError(_0x37a4f6,null));};exports['create']=function(_0x20c88a,_0x300199){return db[_0x5fbd('0x43')][_0x5fbd('0x4b')](_0x20c88a['body'],{})[_0x5fbd('0x29')](respondWithResult(_0x300199,0xc9))['catch'](handleError(_0x300199,null));};exports[_0x5fbd('0x28')]=function(_0x418f01,_0x36fcc6){if(_0x418f01['body']['id']){delete _0x418f01[_0x5fbd('0x4c')]['id'];}return db['FreshsalesAccount'][_0x5fbd('0x4a')]({'where':{'id':_0x418f01[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x36fcc6,null))['then'](saveUpdates(_0x418f01[_0x5fbd('0x4c')],null))[_0x5fbd('0x29')](respondWithResult(_0x36fcc6,null))[_0x5fbd('0x46')](handleError(_0x36fcc6,null));};exports['destroy']=function(_0x41c2ac,_0x5eeeb8){return db['FreshsalesAccount'][_0x5fbd('0x4a')]({'where':{'id':_0x41c2ac[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x5eeeb8,null))[_0x5fbd('0x29')](removeEntity(_0x5eeeb8,null))[_0x5fbd('0x46')](handleError(_0x5eeeb8,null));};exports[_0x5fbd('0x4e')]=function(_0x32ccb4,_0x2a3386,_0x410607){var _0x38a35d={};var _0x35dc5f={};var _0x49fc30;var _0x2ebd30;return db['FreshsalesAccount'][_0x5fbd('0x4f')]({'where':{'id':_0x32ccb4[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x2a3386,null))[_0x5fbd('0x29')](function(_0x3fd4ce){if(_0x3fd4ce){_0x49fc30=_0x3fd4ce;_0x35dc5f[_0x5fbd('0x32')]=_[_0x5fbd('0x33')](db[_0x5fbd('0x50')][_0x5fbd('0x2f')]);_0x35dc5f[_0x5fbd('0x34')]=_['keys'](_0x32ccb4['query']);_0x35dc5f[_0x5fbd('0x3d')]=_[_0x5fbd('0x35')](_0x35dc5f[_0x5fbd('0x32')],_0x35dc5f[_0x5fbd('0x34')]);_0x38a35d['attributes']=_[_0x5fbd('0x35')](_0x35dc5f[_0x5fbd('0x32')],qs['fields'](_0x32ccb4['query'][_0x5fbd('0x36')]));_0x38a35d[_0x5fbd('0x37')]=_0x38a35d['attributes'][_0x5fbd('0x38')]?_0x38a35d[_0x5fbd('0x37')]:_0x35dc5f[_0x5fbd('0x32')];_0x38a35d[_0x5fbd('0x3a')]=qs[_0x5fbd('0x3b')](_0x32ccb4[_0x5fbd('0x34')]['sort']);_0x38a35d[_0x5fbd('0x3c')]=qs[_0x5fbd('0x3d')](_['pick'](_0x32ccb4['query'],_0x35dc5f['filters']));if(_0x32ccb4['query'][_0x5fbd('0x3e')]){_0x38a35d['where']=_['merge'](_0x38a35d['where'],{'$or':_[_0x5fbd('0x2e')](_0x38a35d['attributes'],function(_0x5eef9d){var _0xc079b9={};_0xc079b9[_0x5eef9d]={'$like':'%'+_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x3e')]+'%'};return _0xc079b9;})});}_0x38a35d=_['merge']({},_0x38a35d,_0x32ccb4[_0x5fbd('0x42')]);return _0x49fc30[_0x5fbd('0x4e')](_0x38a35d);}})[_0x5fbd('0x29')](function(_0x5416de){if(_0x5416de){_0x2ebd30=_0x5416de[_0x5fbd('0x38')];if(!_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x51')](_0x5fbd('0x39'))){_0x38a35d[_0x5fbd('0x21')]=qs['limit'](_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x21')]);_0x38a35d[_0x5fbd('0x20')]=qs[_0x5fbd('0x20')](_0x32ccb4[_0x5fbd('0x34')][_0x5fbd('0x20')]);}return _0x49fc30[_0x5fbd('0x4e')](_0x38a35d);}})[_0x5fbd('0x29')](function(_0x56123d){if(_0x56123d){return _0x56123d?{'count':_0x2ebd30,'rows':_0x56123d}:null;}})['then'](respondWithResult(_0x2a3386,null))[_0x5fbd('0x46')](handleError(_0x2a3386,null));};exports[_0x5fbd('0x52')]=function(_0x2c2a7b,_0x3d9971,_0x5bb243){if(_0x2c2a7b[_0x5fbd('0x4c')]['id']){delete _0x2c2a7b['body']['id'];}return db[_0x5fbd('0x43')][_0x5fbd('0x4f')]({'where':{'id':_0x2c2a7b[_0x5fbd('0x4d')]['id']}})[_0x5fbd('0x29')](handleEntityNotFound(_0x3d9971,null))[_0x5fbd('0x29')](function(_0x569942){if(_0x569942){_0x2c2a7b[_0x5fbd('0x4c')]['AccountId']=_0x569942['id'];_0x2c2a7b['body'][_0x5fbd('0x53')]=integrations[_0x5fbd('0x54')](_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x55')],_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x40')]);_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x56')]=integrations[_0x5fbd('0x57')](_0x2c2a7b[_0x5fbd('0x4c')]['channel'],_0x2c2a7b[_0x5fbd('0x4c')][_0x5fbd('0x40')]);return db[_0x5fbd('0x50')]['create'](_0x2c2a7b[_0x5fbd('0x4c')],{'include':[{'model':db[_0x5fbd('0x58')],'as':_0x5fbd('0x53')},{'model':db['FreshsalesField'],'as':_0x5fbd('0x56')}]});}return null;})[_0x5fbd('0x29')](respondWithResult(_0x3d9971,null))[_0x5fbd('0x46')](handleError(_0x3d9971,null));};exports['getFields']=function(_0x3a2782,_0x212e46,_0x4959bb){var _0x50c5e0='';var _0x5ca612='';return db['FreshsalesAccount'][_0x5fbd('0x4f')]({'where':{'id':_0x3a2782['params']['id']},'attributes':['id',_0x5fbd('0x59'),_0x5fbd('0x5a'),_0x5fbd('0x5b')]})[_0x5fbd('0x29')](handleEntityNotFound(_0x212e46,null))[_0x5fbd('0x29')](function(_0x23234){if(_0x23234){_0x5ca612=_0x23234[_0x5fbd('0x59')];_0x50c5e0=_0x23234[_0x5fbd('0x5a')];var _0x39cdcf=_0x23234[_0x5fbd('0x5a')][_0x5fbd('0x5c')](-0x1);if(_0x39cdcf==='/'){_0x50c5e0=_0x50c5e0[_0x5fbd('0x5d')](0x0,_0x50c5e0[_0x5fbd('0x5e')](_0x39cdcf));}return rp({'method':_0x5fbd('0x5f'),'uri':util['format'](_0x5fbd('0x60'),_0x50c5e0,_0x5fbd('0x61')),'headers':{'Authorization':_0x5fbd('0x62')+_0x23234[_0x5fbd('0x5b')]},'json':!![]});}})[_0x5fbd('0x29')](function(_0x5522da){if(_0x5522da){var _0x64b3b4=_0x5522da[_0x5fbd('0x63')];var _0x128bd9=![];var _0x44daff=null;for(_0x44daff=0x0;_0x44daff<_0x64b3b4[_0x5fbd('0x38')];_0x44daff++){if(_0x64b3b4[_0x44daff][_0x5fbd('0x64')]===_0x5ca612){_0x128bd9=!![];}}if(_0x128bd9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5fbd('0x65')});}}})[_0x5fbd('0x29')](respondWithResult(_0x212e46,null))[_0x5fbd('0x46')](function(_0x526bfc){var _0x59c765=_0x3a2782[_0x5fbd('0x34')]['test']?0x1f4:_0x526bfc[_0x5fbd('0x66')]||0x1f4;logger['error'](_0x5fbd('0x67'),_0x5fbd('0x68'),_0x59c765,JSON[_0x5fbd('0x69')](_0x526bfc));delete _0x526bfc[_0x5fbd('0x2c')];if(_0x59c765===0x191){_0x59c765=0x190;}_0x212e46['status'](_0x59c765)['send'](_0x3a2782['query']['test']?{'message':_0x5fbd('0x6a'),'statusCode':_0x526bfc['statusCode']}:_0x526bfc);});}; \ No newline at end of file +var _0x749e=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','options','include','rows','params','includeAll','find','create','catch','update','body','getConfigurations','findOne','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','substring','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','FreshsalesAccount','rawAttributes','fieldName','type','key'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x749e,0x1bf));var _0xe749=function(_0x53d8cb,_0x2fa602){_0x53d8cb=_0x53d8cb-0x0;var _0x44c5cd=_0x749e[_0x53d8cb];return _0x44c5cd;};'use strict';var emlformat=require(_0xe749('0x0'));var rimraf=require(_0xe749('0x1'));var zipdir=require(_0xe749('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe749('0x3'));var moment=require('moment');var BPromise=require(_0xe749('0x4'));var Mustache=require(_0xe749('0x5'));var util=require(_0xe749('0x6'));var path=require('path');var sox=require(_0xe749('0x7'));var csv=require(_0xe749('0x8'));var ejs=require(_0xe749('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe749('0xa'));var squel=require(_0xe749('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe749('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe749('0xd'));var Papa=require('papaparse');var Redis=require(_0xe749('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe749('0xf'));var as=require(_0xe749('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe749('0x11'))('api');var utils=require(_0xe749('0x12'));var config=require(_0xe749('0x13'));var licenseUtil=require(_0xe749('0x14'));var db=require(_0xe749('0x15'))['db'];var integrations=require(_0xe749('0x16'));function respondWithStatusCode(_0x58e99e,_0x2643a5){_0x2643a5=_0x2643a5||0xcc;return function(_0x3a1984){if(_0x3a1984){return _0x58e99e['sendStatus'](_0x2643a5);}return _0x58e99e[_0xe749('0x17')](_0x2643a5)[_0xe749('0x18')]();};}function respondWithResult(_0x2c4886,_0x25064c){_0x25064c=_0x25064c||0xc8;return function(_0x5e57c0){if(_0x5e57c0){return _0x2c4886['status'](_0x25064c)[_0xe749('0x19')](_0x5e57c0);}};}function respondWithFilteredResult(_0x2a264e,_0xa7068){return function(_0x198e68){if(_0x198e68){var _0x315b20=typeof _0xa7068['offset']===_0xe749('0x1a')&&typeof _0xa7068[_0xe749('0x1b')]===_0xe749('0x1a');var _0x28b2cc=_0x198e68['count'];var _0x4a41fb=_0x315b20?0x0:_0xa7068['offset'];var _0x17c1af=_0x315b20?_0x198e68[_0xe749('0x1c')]:_0xa7068['offset']+_0xa7068['limit'];var _0x4c6c21;if(_0x17c1af>=_0x28b2cc){_0x17c1af=_0x28b2cc;_0x4c6c21=0xc8;}else{_0x4c6c21=0xce;}_0x2a264e[_0xe749('0x17')](_0x4c6c21);return _0x2a264e[_0xe749('0x1d')]('Content-Range',_0x4a41fb+'-'+_0x17c1af+'/'+_0x28b2cc)['json'](_0x198e68);}return null;};}function patchUpdates(_0x4c7391){return function(_0x1e9eeb){try{jsonpatch[_0xe749('0x1e')](_0x1e9eeb,_0x4c7391,!![]);}catch(_0x1bc6ea){return BPromise[_0xe749('0x1f')](_0x1bc6ea);}return _0x1e9eeb[_0xe749('0x20')]();};}function saveUpdates(_0x36897d,_0x3cdea9){return function(_0x42226d){if(_0x42226d){return _0x42226d['update'](_0x36897d)[_0xe749('0x21')](function(_0x50b02e){return _0x50b02e;});}return null;};}function removeEntity(_0x15c8e8,_0xbc9fde){return function(_0x5d874a){if(_0x5d874a){return _0x5d874a[_0xe749('0x22')]()[_0xe749('0x21')](function(){_0x15c8e8['status'](0xcc)[_0xe749('0x18')]();});}};}function handleEntityNotFound(_0x1592ba,_0x27ab03){return function(_0x4ebf9f){if(!_0x4ebf9f){_0x1592ba['sendStatus'](0x194);}return _0x4ebf9f;};}function handleError(_0x571fd6,_0xc976cd){_0xc976cd=_0xc976cd||0x1f4;return function(_0x1576d9){logger[_0xe749('0x23')](_0x1576d9[_0xe749('0x24')]);if(_0x1576d9[_0xe749('0x25')]){delete _0x1576d9[_0xe749('0x25')];}_0x571fd6['status'](_0xc976cd)['send'](_0x1576d9);};}exports['index']=function(_0x5c265a,_0x1e8475){var _0x37182c={},_0x1376a2={},_0x123284={'count':0x0,'rows':[]};var _0x465b52=_['map'](db[_0xe749('0x26')][_0xe749('0x27')],function(_0x4c1abb){return{'name':_0x4c1abb[_0xe749('0x28')],'type':_0x4c1abb[_0xe749('0x29')][_0xe749('0x2a')]};});_0x1376a2[_0xe749('0x2b')]=_[_0xe749('0x2c')](_0x465b52,_0xe749('0x25'));_0x1376a2[_0xe749('0x2d')]=_[_0xe749('0x2e')](_0x5c265a[_0xe749('0x2d')]);_0x1376a2[_0xe749('0x2f')]=_[_0xe749('0x30')](_0x1376a2[_0xe749('0x2b')],_0x1376a2[_0xe749('0x2d')]);_0x37182c[_0xe749('0x31')]=_[_0xe749('0x30')](_0x1376a2[_0xe749('0x2b')],qs[_0xe749('0x32')](_0x5c265a['query'][_0xe749('0x32')]));_0x37182c[_0xe749('0x31')]=_0x37182c[_0xe749('0x31')][_0xe749('0x33')]?_0x37182c['attributes']:_0x1376a2['model'];if(!_0x5c265a[_0xe749('0x2d')][_0xe749('0x34')]('nolimit')){_0x37182c['limit']=qs[_0xe749('0x1b')](_0x5c265a[_0xe749('0x2d')][_0xe749('0x1b')]);_0x37182c[_0xe749('0x35')]=qs[_0xe749('0x35')](_0x5c265a[_0xe749('0x2d')]['offset']);}_0x37182c[_0xe749('0x36')]=qs[_0xe749('0x37')](_0x5c265a[_0xe749('0x2d')][_0xe749('0x37')]);_0x37182c['where']=qs[_0xe749('0x2f')](_[_0xe749('0x38')](_0x5c265a['query'],_0x1376a2[_0xe749('0x2f')]),_0x465b52);if(_0x5c265a[_0xe749('0x2d')][_0xe749('0x39')]){_0x37182c[_0xe749('0x3a')]=_[_0xe749('0x3b')](_0x37182c[_0xe749('0x3a')],{'$or':_[_0xe749('0x2c')](_0x465b52,function(_0x184245){if(_0x184245['type']!=='VIRTUAL'){var _0x32db62={};_0x32db62[_0x184245['name']]={'$like':'%'+_0x5c265a[_0xe749('0x2d')][_0xe749('0x39')]+'%'};return _0x32db62;}})});}_0x37182c=_[_0xe749('0x3b')]({},_0x37182c,_0x5c265a[_0xe749('0x3c')]);var _0x103949={'where':_0x37182c[_0xe749('0x3a')]};return db[_0xe749('0x26')]['count'](_0x103949)['then'](function(_0x116931){_0x123284[_0xe749('0x1c')]=_0x116931;if(_0x5c265a[_0xe749('0x2d')]['includeAll']){_0x37182c[_0xe749('0x3d')]=[{'all':!![]}];}return db[_0xe749('0x26')]['findAll'](_0x37182c);})[_0xe749('0x21')](function(_0xa090e6){_0x123284[_0xe749('0x3e')]=_0xa090e6;return _0x123284;})[_0xe749('0x21')](respondWithFilteredResult(_0x1e8475,_0x37182c))['catch'](handleError(_0x1e8475,null));};exports['show']=function(_0x4e61bd,_0x25008d){var _0x682277={'raw':![],'where':{'id':_0x4e61bd[_0xe749('0x3f')]['id']}},_0x598774={};_0x598774[_0xe749('0x2b')]=_['keys'](db[_0xe749('0x26')][_0xe749('0x27')]);_0x598774[_0xe749('0x2d')]=_['keys'](_0x4e61bd[_0xe749('0x2d')]);_0x598774[_0xe749('0x2f')]=_['intersection'](_0x598774[_0xe749('0x2b')],_0x598774['query']);_0x682277[_0xe749('0x31')]=_['intersection'](_0x598774[_0xe749('0x2b')],qs[_0xe749('0x32')](_0x4e61bd[_0xe749('0x2d')]['fields']));_0x682277[_0xe749('0x31')]=_0x682277[_0xe749('0x31')][_0xe749('0x33')]?_0x682277[_0xe749('0x31')]:_0x598774[_0xe749('0x2b')];if(_0x4e61bd[_0xe749('0x2d')][_0xe749('0x40')]){_0x682277[_0xe749('0x3d')]=[{'all':!![]}];}_0x682277=_[_0xe749('0x3b')]({},_0x682277,_0x4e61bd[_0xe749('0x3c')]);return db[_0xe749('0x26')][_0xe749('0x41')](_0x682277)[_0xe749('0x21')](handleEntityNotFound(_0x25008d,null))[_0xe749('0x21')](respondWithResult(_0x25008d,null))['catch'](handleError(_0x25008d,null));};exports[_0xe749('0x42')]=function(_0x4ba7d0,_0x276a28){return db[_0xe749('0x26')]['create'](_0x4ba7d0['body'],{})[_0xe749('0x21')](respondWithResult(_0x276a28,0xc9))[_0xe749('0x43')](handleError(_0x276a28,null));};exports[_0xe749('0x44')]=function(_0x555ab7,_0x29bdde){if(_0x555ab7[_0xe749('0x45')]['id']){delete _0x555ab7[_0xe749('0x45')]['id'];}return db[_0xe749('0x26')]['find']({'where':{'id':_0x555ab7['params']['id']}})[_0xe749('0x21')](handleEntityNotFound(_0x29bdde,null))['then'](saveUpdates(_0x555ab7['body'],null))[_0xe749('0x21')](respondWithResult(_0x29bdde,null))[_0xe749('0x43')](handleError(_0x29bdde,null));};exports[_0xe749('0x22')]=function(_0x3949e1,_0x3d1b82){return db[_0xe749('0x26')][_0xe749('0x41')]({'where':{'id':_0x3949e1[_0xe749('0x3f')]['id']}})[_0xe749('0x21')](handleEntityNotFound(_0x3d1b82,null))[_0xe749('0x21')](removeEntity(_0x3d1b82,null))[_0xe749('0x43')](handleError(_0x3d1b82,null));};exports[_0xe749('0x46')]=function(_0x1478d1,_0x160f48,_0xd1da4){var _0x56bbf6={};var _0x4d640e={};var _0x1cf369;var _0x1e9e61;return db[_0xe749('0x26')][_0xe749('0x47')]({'where':{'id':_0x1478d1[_0xe749('0x3f')]['id']}})['then'](handleEntityNotFound(_0x160f48,null))['then'](function(_0xdb6f60){if(_0xdb6f60){_0x1cf369=_0xdb6f60;_0x4d640e['model']=_[_0xe749('0x2e')](db['FreshsalesConfiguration'][_0xe749('0x27')]);_0x4d640e[_0xe749('0x2d')]=_[_0xe749('0x2e')](_0x1478d1[_0xe749('0x2d')]);_0x4d640e[_0xe749('0x2f')]=_[_0xe749('0x30')](_0x4d640e[_0xe749('0x2b')],_0x4d640e['query']);_0x56bbf6['attributes']=_[_0xe749('0x30')](_0x4d640e[_0xe749('0x2b')],qs[_0xe749('0x32')](_0x1478d1[_0xe749('0x2d')]['fields']));_0x56bbf6[_0xe749('0x31')]=_0x56bbf6[_0xe749('0x31')][_0xe749('0x33')]?_0x56bbf6[_0xe749('0x31')]:_0x4d640e[_0xe749('0x2b')];_0x56bbf6[_0xe749('0x36')]=qs[_0xe749('0x37')](_0x1478d1[_0xe749('0x2d')][_0xe749('0x37')]);_0x56bbf6[_0xe749('0x3a')]=qs[_0xe749('0x2f')](_['pick'](_0x1478d1[_0xe749('0x2d')],_0x4d640e[_0xe749('0x2f')]));if(_0x1478d1[_0xe749('0x2d')][_0xe749('0x39')]){_0x56bbf6[_0xe749('0x3a')]=_[_0xe749('0x3b')](_0x56bbf6['where'],{'$or':_['map'](_0x56bbf6[_0xe749('0x31')],function(_0x557981){var _0x35abca={};_0x35abca[_0x557981]={'$like':'%'+_0x1478d1[_0xe749('0x2d')][_0xe749('0x39')]+'%'};return _0x35abca;})});}_0x56bbf6=_['merge']({},_0x56bbf6,_0x1478d1['options']);return _0x1cf369['getConfigurations'](_0x56bbf6);}})['then'](function(_0x2abeac){if(_0x2abeac){_0x1e9e61=_0x2abeac['length'];if(!_0x1478d1[_0xe749('0x2d')][_0xe749('0x34')](_0xe749('0x48'))){_0x56bbf6[_0xe749('0x1b')]=qs[_0xe749('0x1b')](_0x1478d1[_0xe749('0x2d')]['limit']);_0x56bbf6['offset']=qs[_0xe749('0x35')](_0x1478d1[_0xe749('0x2d')][_0xe749('0x35')]);}return _0x1cf369[_0xe749('0x46')](_0x56bbf6);}})[_0xe749('0x21')](function(_0x5a7d1e){if(_0x5a7d1e){return _0x5a7d1e?{'count':_0x1e9e61,'rows':_0x5a7d1e}:null;}})[_0xe749('0x21')](respondWithResult(_0x160f48,null))[_0xe749('0x43')](handleError(_0x160f48,null));};exports[_0xe749('0x49')]=function(_0x5c841c,_0x58fb7b,_0x3e3fdd){if(_0x5c841c[_0xe749('0x45')]['id']){delete _0x5c841c['body']['id'];}return db[_0xe749('0x26')]['findOne']({'where':{'id':_0x5c841c[_0xe749('0x3f')]['id']}})['then'](handleEntityNotFound(_0x58fb7b,null))[_0xe749('0x21')](function(_0xe2d413){if(_0xe2d413){_0x5c841c[_0xe749('0x45')]['AccountId']=_0xe2d413['id'];_0x5c841c[_0xe749('0x45')][_0xe749('0x4a')]=integrations[_0xe749('0x4b')](_0x5c841c[_0xe749('0x45')]['channel'],_0x5c841c[_0xe749('0x45')][_0xe749('0x29')]);_0x5c841c[_0xe749('0x45')][_0xe749('0x4c')]=integrations[_0xe749('0x4d')](_0x5c841c[_0xe749('0x45')][_0xe749('0x4e')],_0x5c841c[_0xe749('0x45')]['type']);return db[_0xe749('0x4f')][_0xe749('0x42')](_0x5c841c[_0xe749('0x45')],{'include':[{'model':db[_0xe749('0x50')],'as':_0xe749('0x4a')},{'model':db['FreshsalesField'],'as':_0xe749('0x4c')}]});}return null;})[_0xe749('0x21')](respondWithResult(_0x58fb7b,null))['catch'](handleError(_0x58fb7b,null));};exports[_0xe749('0x51')]=function(_0x377a3a,_0x2140ff,_0x25964a){var _0x277e69='';var _0x3284a6='';return db[_0xe749('0x26')][_0xe749('0x47')]({'where':{'id':_0x377a3a['params']['id']},'attributes':['id',_0xe749('0x52'),_0xe749('0x53'),'apiKey']})[_0xe749('0x21')](handleEntityNotFound(_0x2140ff,null))[_0xe749('0x21')](function(_0x323c0a){if(_0x323c0a){_0x3284a6=_0x323c0a['username'];_0x277e69=_0x323c0a['remoteUri'];var _0x4478d3=_0x323c0a[_0xe749('0x53')]['slice'](-0x1);if(_0x4478d3==='/'){_0x277e69=_0x277e69[_0xe749('0x54')](0x0,_0x277e69['lastIndexOf'](_0x4478d3));}return rp({'method':_0xe749('0x55'),'uri':util['format'](_0xe749('0x56'),_0x277e69,_0xe749('0x57')),'headers':{'Authorization':_0xe749('0x58')+_0x323c0a[_0xe749('0x59')]},'json':!![]});}})[_0xe749('0x21')](function(_0x10fc1f){if(_0x10fc1f){var _0x4a5b4b=_0x10fc1f['users'];var _0x2fd662=![];var _0x296159=null;for(_0x296159=0x0;_0x296159<_0x4a5b4b[_0xe749('0x33')];_0x296159++){if(_0x4a5b4b[_0x296159][_0xe749('0x5a')]===_0x3284a6){_0x2fd662=!![];}}if(_0x2fd662){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xe749('0x5b')});}}})[_0xe749('0x21')](respondWithResult(_0x2140ff,null))[_0xe749('0x43')](function(_0x301ec2){var _0x4009b1=_0x377a3a[_0xe749('0x2d')]['test']?0x1f4:_0x301ec2[_0xe749('0x5c')]||0x1f4;logger[_0xe749('0x23')](_0xe749('0x5d'),_0xe749('0x51'),_0x4009b1,JSON[_0xe749('0x5e')](_0x301ec2));delete _0x301ec2[_0xe749('0x25')];if(_0x4009b1===0x191){_0x4009b1=0x190;}_0x2140ff[_0xe749('0x17')](_0x4009b1)[_0xe749('0x5f')](_0x377a3a['query'][_0xe749('0x60')]?{'message':_0xe749('0x61'),'statusCode':_0x301ec2[_0xe749('0x5c')]}:_0x301ec2);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 28d83a0..77cc15e 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 _0x8aad=['FreshsalesAccount','int_freshsales_accounts','lodash','util','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x3c8103,_0x2a4125){var _0x16496f=function(_0x5617b0){while(--_0x5617b0){_0x3c8103['push'](_0x3c8103['shift']());}};_0x16496f(++_0x2a4125);}(_0x8aad,0x146));var _0xd8aa=function(_0x24cbbb,_0x409a54){_0x24cbbb=_0x24cbbb-0x0;var _0x1c280b=_0x8aad[_0x24cbbb];return _0x1c280b;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require('../../config/logger')(_0xd8aa('0x2'));var moment=require('moment');var BPromise=require(_0xd8aa('0x3'));var rp=require(_0xd8aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8aa('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd8aa('0x6')]=function(_0x43ddeb,_0x16ea12){return _0x43ddeb['define'](_0xd8aa('0x7'),attributes,{'tableName':_0xd8aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9582=['bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment'];(function(_0x26139e,_0x3f6e8a){var _0x33253b=function(_0x332509){while(--_0x332509){_0x26139e['push'](_0x26139e['shift']());}};_0x33253b(++_0x3f6e8a);}(_0x9582,0x95));var _0x2958=function(_0x14a27a,_0x4bb236){_0x14a27a=_0x14a27a-0x0;var _0x55eac2=_0x9582[_0x14a27a];return _0x55eac2;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));var integrations=require(_0x2958('0xa'));module[_0x2958('0xb')]=function(_0x88ffaa,_0x309525){return _0x88ffaa[_0x2958('0xc')](_0x2958('0xd'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 6ca6764..dd882ea 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 _0x2da6=['info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FreshsalesAccount','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x4ecc5c,_0x2e4b91){var _0x44748e=function(_0x6085f6){while(--_0x6085f6){_0x4ecc5c['push'](_0x4ecc5c['shift']());}};_0x44748e(++_0x2e4b91);}(_0x2da6,0x1dd));var _0x62da=function(_0xa9e6f,_0x3b8b04){_0xa9e6f=_0xa9e6f-0x0;var _0xa7d4e4=_0x2da6[_0xa9e6f];return _0xa7d4e4;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['GetFreshsalesAccount']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['findAll']({'raw':_0xa7050b[_0x62da('0x19')]?_0xa7050b['options'][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1b')]||null:null,'attributes':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1c')]||null:null,'limit':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')]['limit']||null:null,'include':_0xa7050b[_0x62da('0x19')]?_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')]?_[_0x62da('0x1e')](_0xa7050b[_0x62da('0x19')][_0x62da('0x1d')],function(_0x24298a){return{'model':db[_0x24298a['model']],'as':_0x24298a['as'],'attributes':_0x24298a['attributes'],'include':_0x24298a['include']?_[_0x62da('0x1e')](_0x24298a[_0x62da('0x1d')],function(_0x14897c){return{'model':db[_0x14897c[_0x62da('0x1f')]],'as':_0x14897c['as'],'attributes':_0x14897c['attributes'],'include':_0x14897c[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x14897c['include'],function(_0x3ccf96){return{'model':db[_0x3ccf96[_0x62da('0x1f')]],'as':_0x3ccf96['as'],'attributes':_0x3ccf96[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41de3a){logger[_0x62da('0xd')](_0x62da('0x20'),_0xa7050b);logger['debug']('GetFreshsalesAccount',_0xa7050b,JSON[_0x62da('0x12')](_0x41de3a));_0x4d6482(_0x41de3a);})[_0x62da('0x17')](function(_0x220ffc){logger['error'](_0x62da('0x20'),_0x220ffc[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x220ffc[_0x62da('0x15')]));});});};exports[_0x62da('0x21')]=function(_0x1cf765){var _0x592c6c=this;return new Promise(function(_0xbe398f,_0x4f71bc){return db[_0x62da('0x18')][_0x62da('0x22')]({'raw':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cf765[_0x62da('0x19')]?_0x1cf765['options'][_0x62da('0x1b')]||null:null,'attributes':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')]['attributes']||null:null,'include':_0x1cf765[_0x62da('0x19')]?_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')]?_['map'](_0x1cf765[_0x62da('0x19')][_0x62da('0x1d')],function(_0x55eda7){return{'model':db[_0x55eda7[_0x62da('0x1f')]],'as':_0x55eda7['as'],'attributes':_0x55eda7[_0x62da('0x1c')],'include':_0x55eda7['include']?_[_0x62da('0x1e')](_0x55eda7[_0x62da('0x1d')],function(_0x11bf73){return{'model':db[_0x11bf73[_0x62da('0x1f')]],'as':_0x11bf73['as'],'attributes':_0x11bf73[_0x62da('0x1c')],'include':_0x11bf73[_0x62da('0x1d')]?_[_0x62da('0x1e')](_0x11bf73[_0x62da('0x1d')],function(_0x2f1115){return{'model':db[_0x2f1115[_0x62da('0x1f')]],'as':_0x2f1115['as'],'attributes':_0x2f1115[_0x62da('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x62da('0xc')](function(_0x3057f6){logger[_0x62da('0xd')](_0x62da('0x21'),_0x1cf765);logger[_0x62da('0xf')](_0x62da('0x21'),_0x1cf765,JSON['stringify'](_0x3057f6));_0xbe398f(_0x3057f6);})[_0x62da('0x17')](function(_0x5e9295){logger[_0x62da('0x13')](_0x62da('0x21'),_0x5e9295[_0x62da('0x15')],_0x1cf765);_0x4f71bc(_0x592c6c['error'](0x1f4,_0x5e9295[_0x62da('0x15')]));});});}; \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','debug','stringify','ShowFreshsalesAccount','find','lodash'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x66fa,0x117));var _0xa66f=function(_0xb78d89,_0x2b7a30){_0xb78d89=_0xb78d89-0x0;var _0x1394af=_0x66fa[_0xb78d89];return _0x1394af;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['GetFreshsalesAccount']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')]({'raw':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x18')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'limit':_0x1cbe64[_0xa66f('0x16')]?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1a')]||null:null,'include':_0x1cbe64['options']?_0x1cbe64[_0xa66f('0x16')][_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0x1cbe64[_0xa66f('0x16')]['include'],function(_0x337602){return{'model':db[_0x337602[_0xa66f('0x1d')]],'as':_0x337602['as'],'attributes':_0x337602[_0xa66f('0x19')],'include':_0x337602[_0xa66f('0x1b')]?_['map'](_0x337602['include'],function(_0xed98b9){return{'model':db[_0xed98b9['model']],'as':_0xed98b9['as'],'attributes':_0xed98b9[_0xa66f('0x19')],'include':_0xed98b9[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xed98b9['include'],function(_0x4683c7){return{'model':db[_0x4683c7[_0xa66f('0x1d')]],'as':_0x4683c7['as'],'attributes':_0x4683c7[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x17c103){logger[_0xa66f('0xc')](_0xa66f('0x1e'),_0x1cbe64);logger[_0xa66f('0x1f')](_0xa66f('0x1e'),_0x1cbe64,JSON[_0xa66f('0x20')](_0x17c103));_0x4a28d4(_0x17c103);})[_0xa66f('0x13')](function(_0x63650b){logger[_0xa66f('0xf')](_0xa66f('0x1e'),_0x63650b['message'],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x63650b[_0xa66f('0x12')]));});});};exports[_0xa66f('0x21')]=function(_0x55f309){var _0x44c79a=this;return new Promise(function(_0x2de5f3,_0x4cd7f2){return db[_0xa66f('0x14')][_0xa66f('0x22')]({'raw':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x17')]===undefined?!![]:![]:!![],'where':_0x55f309['options']?_0x55f309[_0xa66f('0x16')]['where']||null:null,'attributes':_0x55f309[_0xa66f('0x16')]?_0x55f309[_0xa66f('0x16')][_0xa66f('0x19')]||null:null,'include':_0x55f309['options']?_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')]?_['map'](_0x55f309[_0xa66f('0x16')][_0xa66f('0x1b')],function(_0xba9457){return{'model':db[_0xba9457[_0xa66f('0x1d')]],'as':_0xba9457['as'],'attributes':_0xba9457[_0xa66f('0x19')],'include':_0xba9457[_0xa66f('0x1b')]?_[_0xa66f('0x1c')](_0xba9457[_0xa66f('0x1b')],function(_0x35ef27){return{'model':db[_0x35ef27[_0xa66f('0x1d')]],'as':_0x35ef27['as'],'attributes':_0x35ef27['attributes'],'include':_0x35ef27[_0xa66f('0x1b')]?_['map'](_0x35ef27[_0xa66f('0x1b')],function(_0x46f6cc){return{'model':db[_0x46f6cc[_0xa66f('0x1d')]],'as':_0x46f6cc['as'],'attributes':_0x46f6cc[_0xa66f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa66f('0xb')](function(_0x201432){logger[_0xa66f('0xc')](_0xa66f('0x21'),_0x55f309);logger['debug'](_0xa66f('0x21'),_0x55f309,JSON['stringify'](_0x201432));_0x2de5f3(_0x201432);})[_0xa66f('0x13')](function(_0x45eeb8){logger[_0xa66f('0xf')]('ShowFreshsalesAccount',_0x45eeb8['message'],_0x55f309);_0x4cd7f2(_0x44c79a[_0xa66f('0xf')](0x1f4,_0x45eeb8[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f993eb7..f3e162b 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 _0xe6c9=['isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/fields','post','create','put','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xe6c9,0x132));var _0x9e6c=function(_0x8b2437,_0x279ccd){_0x8b2437=_0x8b2437-0x0;var _0x3b6271=_0xe6c9[_0x8b2437];return _0x3b6271;};'use strict';var multer=require(_0x9e6c('0x0'));var util=require(_0x9e6c('0x1'));var path=require(_0x9e6c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e6c('0x3'));var router=express[_0x9e6c('0x4')]();var fs_extra=require(_0x9e6c('0x5'));var auth=require(_0x9e6c('0x6'));var interaction=require(_0x9e6c('0x7'));var config=require('../../config/environment');var controller=require(_0x9e6c('0x8'));router['get']('/',auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xa')]);router[_0x9e6c('0xb')](_0x9e6c('0xc'),auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xd')]);router[_0x9e6c('0xb')](_0x9e6c('0xe'),auth[_0x9e6c('0x9')](),controller[_0x9e6c('0xf')]);router[_0x9e6c('0xb')]('/:id/descriptions',auth[_0x9e6c('0x9')](),controller['getDescriptions']);router[_0x9e6c('0xb')](_0x9e6c('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x9e6c('0x11')]('/',auth[_0x9e6c('0x9')](),controller[_0x9e6c('0x12')]);router[_0x9e6c('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9e6c('0x14')](_0x9e6c('0xc'),auth[_0x9e6c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fcf=['./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fcf,0x1e6));var _0xf5fc=function(_0x15b910,_0x3bfc3f){_0x15b910=_0x15b910-0x0;var _0x4cf029=_0x5fcf[_0x15b910];return _0x4cf029;};'use strict';var multer=require(_0xf5fc('0x0'));var util=require(_0xf5fc('0x1'));var path=require('path');var timeout=require(_0xf5fc('0x2'));var express=require(_0xf5fc('0x3'));var router=express[_0xf5fc('0x4')]();var fs_extra=require(_0xf5fc('0x5'));var auth=require(_0xf5fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf5fc('0x7'));var controller=require(_0xf5fc('0x8'));router[_0xf5fc('0x9')]('/',auth[_0xf5fc('0xa')](),controller[_0xf5fc('0xb')]);router[_0xf5fc('0x9')](_0xf5fc('0xc'),auth['isAuthenticated'](),controller[_0xf5fc('0xd')]);router[_0xf5fc('0x9')](_0xf5fc('0xe'),auth[_0xf5fc('0xa')](),controller[_0xf5fc('0xf')]);router[_0xf5fc('0x9')](_0xf5fc('0x10'),auth[_0xf5fc('0xa')](),controller[_0xf5fc('0x11')]);router[_0xf5fc('0x9')](_0xf5fc('0x12'),auth['isAuthenticated'](),controller[_0xf5fc('0x13')]);router[_0xf5fc('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf5fc('0x15')](_0xf5fc('0xc'),auth[_0xf5fc('0xa')](),controller[_0xf5fc('0x16')]);router[_0xf5fc('0x17')](_0xf5fc('0xc'),auth[_0xf5fc('0xa')](),controller[_0xf5fc('0x18')]);module[_0xf5fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 429603b..730d2c6 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 _0x0362=['exports','STRING','sequelize'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x0362,0xb6));var _0x2036=function(_0x373078,_0x5a8aa2){_0x373078=_0x373078-0x0;var _0x2ef60c=_0x0362[_0x373078];return _0x2ef60c;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'name':{'type':Sequelize[_0x2036('0x2')]},'description':{'type':Sequelize[_0x2036('0x2')]}}; \ No newline at end of file +var _0xba44=['STRING','sequelize','exports'];(function(_0x3d2bad,_0x58d20c){var _0x2e5ae6=function(_0x465959){while(--_0x465959){_0x3d2bad['push'](_0x3d2bad['shift']());}};_0x2e5ae6(++_0x58d20c);}(_0xba44,0xe8));var _0x4ba4=function(_0x4a942d,_0xad19b){_0x4a942d=_0x4a942d-0x0;var _0xb363cb=_0xba44[_0x4a942d];return _0xb363cb;};'use strict';var Sequelize=require(_0x4ba4('0x0'));module[_0x4ba4('0x1')]={'name':{'type':Sequelize[_0x4ba4('0x2')]},'description':{'type':Sequelize[_0x4ba4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b1fcf0a..fc95da9 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 _0x5e0e=['offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getSubjects','findOne','FreshsalesField','order','nolimit','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x421446,_0x19af26){var _0x40e2a6=function(_0x254616){while(--_0x254616){_0x421446['push'](_0x421446['shift']());}};_0x40e2a6(++_0x19af26);}(_0x5e0e,0x89));var _0xe5e0=function(_0x21a173,_0x1f6b9a){_0x21a173=_0x21a173-0x0;var _0x244d96=_0x5e0e[_0x21a173];return _0x244d96;};'use strict';var emlformat=require(_0xe5e0('0x0'));var rimraf=require(_0xe5e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5e0('0x2'));var rp=require(_0xe5e0('0x3'));var moment=require(_0xe5e0('0x4'));var BPromise=require(_0xe5e0('0x5'));var Mustache=require(_0xe5e0('0x6'));var util=require('util');var path=require(_0xe5e0('0x7'));var sox=require('sox');var csv=require(_0xe5e0('0x8'));var ejs=require(_0xe5e0('0x9'));var fs=require('fs');var fs_extra=require(_0xe5e0('0xa'));var _=require(_0xe5e0('0xb'));var squel=require(_0xe5e0('0xc'));var crypto=require(_0xe5e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe5e0('0xe'));var toCsv=require(_0xe5e0('0x8'));var querystring=require('querystring');var Papa=require(_0xe5e0('0xf'));var Redis=require(_0xe5e0('0x10'));var authService=require(_0xe5e0('0x11'));var qs=require(_0xe5e0('0x12'));var as=require(_0xe5e0('0x13'));var hardwareService=require(_0xe5e0('0x14'));var logger=require(_0xe5e0('0x15'))(_0xe5e0('0x16'));var utils=require(_0xe5e0('0x17'));var config=require(_0xe5e0('0x18'));var licenseUtil=require(_0xe5e0('0x19'));var db=require(_0xe5e0('0x1a'))['db'];function respondWithStatusCode(_0x25fd2,_0x529189){_0x529189=_0x529189||0xcc;return function(_0x5cabeb){if(_0x5cabeb){return _0x25fd2[_0xe5e0('0x1b')](_0x529189);}return _0x25fd2[_0xe5e0('0x1c')](_0x529189)[_0xe5e0('0x1d')]();};}function respondWithResult(_0x3baab3,_0x5e3a4d){_0x5e3a4d=_0x5e3a4d||0xc8;return function(_0x14043b){if(_0x14043b){return _0x3baab3[_0xe5e0('0x1c')](_0x5e3a4d)[_0xe5e0('0x1e')](_0x14043b);}};}function respondWithFilteredResult(_0x153860,_0x21db75){return function(_0x309b84){if(_0x309b84){var _0x1fe911=typeof _0x21db75[_0xe5e0('0x1f')]===_0xe5e0('0x20')&&typeof _0x21db75['limit']===_0xe5e0('0x20');var _0x57de88=_0x309b84[_0xe5e0('0x21')];var _0x4e7353=_0x1fe911?0x0:_0x21db75[_0xe5e0('0x1f')];var _0x150c3a=_0x1fe911?_0x309b84['count']:_0x21db75[_0xe5e0('0x1f')]+_0x21db75['limit'];var _0xa81bd4;if(_0x150c3a>=_0x57de88){_0x150c3a=_0x57de88;_0xa81bd4=0xc8;}else{_0xa81bd4=0xce;}_0x153860[_0xe5e0('0x1c')](_0xa81bd4);return _0x153860[_0xe5e0('0x22')](_0xe5e0('0x23'),_0x4e7353+'-'+_0x150c3a+'/'+_0x57de88)[_0xe5e0('0x1e')](_0x309b84);}return null;};}function patchUpdates(_0x10d6aa){return function(_0x2b422d){try{jsonpatch[_0xe5e0('0x24')](_0x2b422d,_0x10d6aa,!![]);}catch(_0x10a195){return BPromise[_0xe5e0('0x25')](_0x10a195);}return _0x2b422d[_0xe5e0('0x26')]();};}function saveUpdates(_0x2de764,_0x331ae1){return function(_0x4cd0ca){if(_0x4cd0ca){return _0x4cd0ca['update'](_0x2de764)[_0xe5e0('0x27')](function(_0x228368){return _0x228368;});}return null;};}function removeEntity(_0x1db371,_0x62f2be){return function(_0x3596ca){if(_0x3596ca){return _0x3596ca[_0xe5e0('0x28')]()[_0xe5e0('0x27')](function(){_0x1db371['status'](0xcc)[_0xe5e0('0x1d')]();});}};}function handleEntityNotFound(_0x5df2be,_0x332c4e){return function(_0x6f21de){if(!_0x6f21de){_0x5df2be[_0xe5e0('0x1b')](0x194);}return _0x6f21de;};}function handleError(_0x478078,_0x32d39a){_0x32d39a=_0x32d39a||0x1f4;return function(_0x4867f2){logger['error'](_0x4867f2[_0xe5e0('0x29')]);if(_0x4867f2['name']){delete _0x4867f2[_0xe5e0('0x2a')];}_0x478078[_0xe5e0('0x1c')](_0x32d39a)[_0xe5e0('0x2b')](_0x4867f2);};}exports[_0xe5e0('0x2c')]=function(_0x462b3b,_0x198b94){var _0x5ad4ad={},_0x398df7={},_0x57a362={'count':0x0,'rows':[]};var _0x3b80f0=_[_0xe5e0('0x2d')](db[_0xe5e0('0x2e')]['rawAttributes'],function(_0x1d7cb4){return{'name':_0x1d7cb4[_0xe5e0('0x2f')],'type':_0x1d7cb4[_0xe5e0('0x30')][_0xe5e0('0x31')]};});_0x398df7[_0xe5e0('0x32')]=_['map'](_0x3b80f0,_0xe5e0('0x2a'));_0x398df7[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x462b3b[_0xe5e0('0x33')]);_0x398df7['filters']=_[_0xe5e0('0x35')](_0x398df7[_0xe5e0('0x32')],_0x398df7[_0xe5e0('0x33')]);_0x5ad4ad[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x398df7[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x5ad4ad[_0xe5e0('0x36')]=_0x5ad4ad[_0xe5e0('0x36')][_0xe5e0('0x38')]?_0x5ad4ad[_0xe5e0('0x36')]:_0x398df7[_0xe5e0('0x32')];if(!_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x39')]('nolimit')){_0x5ad4ad['limit']=qs[_0xe5e0('0x3a')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x5ad4ad['offset']=qs[_0xe5e0('0x1f')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}_0x5ad4ad['order']=qs[_0xe5e0('0x3b')](_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x5ad4ad[_0xe5e0('0x3c')]=qs['filters'](_[_0xe5e0('0x3d')](_0x462b3b['query'],_0x398df7[_0xe5e0('0x3e')]),_0x3b80f0);if(_0x462b3b['query'][_0xe5e0('0x3f')]){_0x5ad4ad['where']=_[_0xe5e0('0x40')](_0x5ad4ad[_0xe5e0('0x3c')],{'$or':_['map'](_0x3b80f0,function(_0x2c6b9c){if(_0x2c6b9c[_0xe5e0('0x30')]!==_0xe5e0('0x41')){var _0x10ad9b={};_0x10ad9b[_0x2c6b9c[_0xe5e0('0x2a')]]={'$like':'%'+_0x462b3b[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x10ad9b;}})});}_0x5ad4ad=_[_0xe5e0('0x40')]({},_0x5ad4ad,_0x462b3b[_0xe5e0('0x42')]);var _0x1e7711={'where':_0x5ad4ad[_0xe5e0('0x3c')]};return db['FreshsalesConfiguration'][_0xe5e0('0x21')](_0x1e7711)[_0xe5e0('0x27')](function(_0x2a585f){_0x57a362[_0xe5e0('0x21')]=_0x2a585f;if(_0x462b3b[_0xe5e0('0x33')]['includeAll']){_0x5ad4ad[_0xe5e0('0x43')]=[{'all':!![]}];}return db[_0xe5e0('0x2e')][_0xe5e0('0x44')](_0x5ad4ad);})[_0xe5e0('0x27')](function(_0x4e7ed5){_0x57a362[_0xe5e0('0x45')]=_0x4e7ed5;return _0x57a362;})[_0xe5e0('0x27')](respondWithFilteredResult(_0x198b94,_0x5ad4ad))[_0xe5e0('0x46')](handleError(_0x198b94,null));};exports[_0xe5e0('0x47')]=function(_0x157089,_0x47dcd4){var _0x353749={'raw':![],'where':{'id':_0x157089['params']['id']}},_0x5484fe={};_0x5484fe[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db[_0xe5e0('0x2e')][_0xe5e0('0x48')]);_0x5484fe[_0xe5e0('0x33')]=_['keys'](_0x157089[_0xe5e0('0x33')]);_0x5484fe[_0xe5e0('0x3e')]=_['intersection'](_0x5484fe['model'],_0x5484fe[_0xe5e0('0x33')]);_0x353749[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x5484fe[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x157089['query'][_0xe5e0('0x37')]));_0x353749[_0xe5e0('0x36')]=_0x353749[_0xe5e0('0x36')]['length']?_0x353749[_0xe5e0('0x36')]:_0x5484fe[_0xe5e0('0x32')];if(_0x157089[_0xe5e0('0x33')]['includeAll']){_0x353749['include']=[{'all':!![]}];}_0x353749=_[_0xe5e0('0x40')]({},_0x353749,_0x157089['options']);return db[_0xe5e0('0x2e')][_0xe5e0('0x49')](_0x353749)[_0xe5e0('0x27')](handleEntityNotFound(_0x47dcd4,null))[_0xe5e0('0x27')](respondWithResult(_0x47dcd4,null))[_0xe5e0('0x46')](handleError(_0x47dcd4,null));};exports[_0xe5e0('0x4a')]=function(_0x38fd91,_0x87972d){return db['FreshsalesConfiguration']['create'](_0x38fd91['body'],{})[_0xe5e0('0x27')](respondWithResult(_0x87972d,0xc9))['catch'](handleError(_0x87972d,null));};exports['update']=function(_0x596d11,_0x577d92){if(_0x596d11['body']['id']){delete _0x596d11[_0xe5e0('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xe5e0('0x49')]({'where':{'id':_0x596d11['params']['id']}})['then'](handleEntityNotFound(_0x577d92,null))[_0xe5e0('0x27')](saveUpdates(_0x596d11[_0xe5e0('0x4b')],null))['then'](respondWithResult(_0x577d92,null))['catch'](handleError(_0x577d92,null));};exports['destroy']=function(_0x17f89a,_0x1096c7){return db[_0xe5e0('0x2e')][_0xe5e0('0x49')]({'where':{'id':_0x17f89a[_0xe5e0('0x4c')]['id']}})[_0xe5e0('0x27')](handleEntityNotFound(_0x1096c7,null))[_0xe5e0('0x27')](removeEntity(_0x1096c7,null))['catch'](handleError(_0x1096c7,null));};exports[_0xe5e0('0x4d')]=function(_0x1354c1,_0x4ba674,_0xd4c85e){var _0x296862={};var _0x4f07c1={};var _0x2eadd3;var _0x38f1e9;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x1354c1[_0xe5e0('0x4c')]['id']}})[_0xe5e0('0x27')](handleEntityNotFound(_0x4ba674,null))['then'](function(_0x207b2b){if(_0x207b2b){_0x2eadd3=_0x207b2b;_0x4f07c1[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db[_0xe5e0('0x4f')][_0xe5e0('0x48')]);_0x4f07c1['query']=_[_0xe5e0('0x34')](_0x1354c1[_0xe5e0('0x33')]);_0x4f07c1['filters']=_[_0xe5e0('0x35')](_0x4f07c1[_0xe5e0('0x32')],_0x4f07c1[_0xe5e0('0x33')]);_0x296862[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x4f07c1[_0xe5e0('0x32')],qs[_0xe5e0('0x37')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x296862[_0xe5e0('0x36')]=_0x296862['attributes'][_0xe5e0('0x38')]?_0x296862[_0xe5e0('0x36')]:_0x4f07c1['model'];_0x296862[_0xe5e0('0x50')]=qs[_0xe5e0('0x3b')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x296862[_0xe5e0('0x3c')]=qs[_0xe5e0('0x3e')](_[_0xe5e0('0x3d')](_0x1354c1[_0xe5e0('0x33')],_0x4f07c1[_0xe5e0('0x3e')]));if(_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3f')]){_0x296862[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x296862[_0xe5e0('0x3c')],{'$or':_[_0xe5e0('0x2d')](_0x296862[_0xe5e0('0x36')],function(_0x429d0f){var _0x47adbc={};_0x47adbc[_0x429d0f]={'$like':'%'+_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x47adbc;})});}_0x296862=_[_0xe5e0('0x40')]({},_0x296862,_0x1354c1['options']);return _0x2eadd3[_0xe5e0('0x4d')](_0x296862);}})[_0xe5e0('0x27')](function(_0x260f0c){if(_0x260f0c){_0x38f1e9=_0x260f0c[_0xe5e0('0x38')];if(!_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x39')](_0xe5e0('0x51'))){_0x296862[_0xe5e0('0x3a')]=qs[_0xe5e0('0x3a')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x296862['offset']=qs[_0xe5e0('0x1f')](_0x1354c1[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}return _0x2eadd3[_0xe5e0('0x4d')](_0x296862);}})[_0xe5e0('0x27')](function(_0x5b15fc){if(_0x5b15fc){return _0x5b15fc?{'count':_0x38f1e9,'rows':_0x5b15fc}:null;}})[_0xe5e0('0x27')](respondWithResult(_0x4ba674,null))['catch'](handleError(_0x4ba674,null));};exports[_0xe5e0('0x52')]=function(_0x1b47f1,_0x50fb0c,_0x40bec4){var _0x34998d={};var _0x596990={};var _0x14431a;var _0x312293;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x1b47f1[_0xe5e0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50fb0c,null))[_0xe5e0('0x27')](function(_0x4eac9a){if(_0x4eac9a){_0x14431a=_0x4eac9a;_0x596990[_0xe5e0('0x32')]=_['keys'](db[_0xe5e0('0x4f')][_0xe5e0('0x48')]);_0x596990[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x1b47f1[_0xe5e0('0x33')]);_0x596990[_0xe5e0('0x3e')]=_[_0xe5e0('0x35')](_0x596990[_0xe5e0('0x32')],_0x596990['query']);_0x34998d[_0xe5e0('0x36')]=_[_0xe5e0('0x35')](_0x596990[_0xe5e0('0x32')],qs['fields'](_0x1b47f1[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x34998d[_0xe5e0('0x36')]=_0x34998d['attributes']['length']?_0x34998d[_0xe5e0('0x36')]:_0x596990[_0xe5e0('0x32')];_0x34998d[_0xe5e0('0x50')]=qs[_0xe5e0('0x3b')](_0x1b47f1['query'][_0xe5e0('0x3b')]);_0x34998d['where']=qs['filters'](_['pick'](_0x1b47f1[_0xe5e0('0x33')],_0x596990[_0xe5e0('0x3e')]));if(_0x1b47f1['query'][_0xe5e0('0x3f')]){_0x34998d[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x34998d[_0xe5e0('0x3c')],{'$or':_[_0xe5e0('0x2d')](_0x34998d[_0xe5e0('0x36')],function(_0x1e3281){var _0x105b24={};_0x105b24[_0x1e3281]={'$like':'%'+_0x1b47f1['query'][_0xe5e0('0x3f')]+'%'};return _0x105b24;})});}_0x34998d=_[_0xe5e0('0x40')]({},_0x34998d,_0x1b47f1[_0xe5e0('0x42')]);return _0x14431a['getDescriptions'](_0x34998d);}})[_0xe5e0('0x27')](function(_0xb30b78){if(_0xb30b78){_0x312293=_0xb30b78['length'];if(!_0x1b47f1['query']['hasOwnProperty'](_0xe5e0('0x51'))){_0x34998d[_0xe5e0('0x3a')]=qs[_0xe5e0('0x3a')](_0x1b47f1[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x34998d[_0xe5e0('0x1f')]=qs[_0xe5e0('0x1f')](_0x1b47f1[_0xe5e0('0x33')]['offset']);}return _0x14431a['getDescriptions'](_0x34998d);}})[_0xe5e0('0x27')](function(_0x5a471d){if(_0x5a471d){return _0x5a471d?{'count':_0x312293,'rows':_0x5a471d}:null;}})['then'](respondWithResult(_0x50fb0c,null))['catch'](handleError(_0x50fb0c,null));};exports['getFields']=function(_0x4e99b7,_0x1abad4,_0x5404de){var _0x348cee={};var _0x2cb38f={};var _0x2babf1;var _0x5bbc6b;return db[_0xe5e0('0x2e')][_0xe5e0('0x4e')]({'where':{'id':_0x4e99b7[_0xe5e0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1abad4,null))[_0xe5e0('0x27')](function(_0x16c2ce){if(_0x16c2ce){_0x2babf1=_0x16c2ce;_0x2cb38f[_0xe5e0('0x32')]=_[_0xe5e0('0x34')](db['FreshsalesField'][_0xe5e0('0x48')]);_0x2cb38f[_0xe5e0('0x33')]=_[_0xe5e0('0x34')](_0x4e99b7['query']);_0x2cb38f[_0xe5e0('0x3e')]=_[_0xe5e0('0x35')](_0x2cb38f[_0xe5e0('0x32')],_0x2cb38f[_0xe5e0('0x33')]);_0x348cee[_0xe5e0('0x36')]=_['intersection'](_0x2cb38f[_0xe5e0('0x32')],qs['fields'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x37')]));_0x348cee[_0xe5e0('0x36')]=_0x348cee['attributes']['length']?_0x348cee[_0xe5e0('0x36')]:_0x2cb38f['model'];_0x348cee[_0xe5e0('0x50')]=qs['sort'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3b')]);_0x348cee[_0xe5e0('0x3c')]=qs[_0xe5e0('0x3e')](_[_0xe5e0('0x3d')](_0x4e99b7['query'],_0x2cb38f[_0xe5e0('0x3e')]));if(_0x4e99b7[_0xe5e0('0x33')]['filter']){_0x348cee[_0xe5e0('0x3c')]=_[_0xe5e0('0x40')](_0x348cee[_0xe5e0('0x3c')],{'$or':_['map'](_0x348cee['attributes'],function(_0x348d94){var _0x2b23da={};_0x2b23da[_0x348d94]={'$like':'%'+_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3f')]+'%'};return _0x2b23da;})});}_0x348cee=_[_0xe5e0('0x40')]({},_0x348cee,_0x4e99b7[_0xe5e0('0x42')]);return _0x2babf1[_0xe5e0('0x53')](_0x348cee);}})[_0xe5e0('0x27')](function(_0x521be7){if(_0x521be7){_0x5bbc6b=_0x521be7[_0xe5e0('0x38')];if(!_0x4e99b7['query'][_0xe5e0('0x39')]('nolimit')){_0x348cee['limit']=qs[_0xe5e0('0x3a')](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x3a')]);_0x348cee[_0xe5e0('0x1f')]=qs['offset'](_0x4e99b7[_0xe5e0('0x33')][_0xe5e0('0x1f')]);}return _0x2babf1['getFields'](_0x348cee);}})[_0xe5e0('0x27')](function(_0x4f8b7f){if(_0x4f8b7f){return _0x4f8b7f?{'count':_0x5bbc6b,'rows':_0x4f8b7f}:null;}})[_0xe5e0('0x27')](respondWithResult(_0x1abad4,null))[_0xe5e0('0x46')](handleError(_0x1abad4,null));}; \ No newline at end of file +var _0xb430=['catch','params','keys','length','create','body','find','getSubjects','findOne','FreshsalesField','options','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','FreshsalesConfiguration','includeAll','include','rows'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xb430,0xab));var _0x0b43=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xb430[_0xbb091];return _0x467a04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b43('0x0'));var zipdir=require(_0x0b43('0x1'));var jsonpatch=require(_0x0b43('0x2'));var rp=require(_0x0b43('0x3'));var moment=require(_0x0b43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0b43('0x5'));var util=require(_0x0b43('0x6'));var path=require('path');var sox=require(_0x0b43('0x7'));var csv=require('to-csv');var ejs=require(_0x0b43('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b43('0x9'));var squel=require('squel');var crypto=require(_0x0b43('0xa'));var jsforce=require(_0x0b43('0xb'));var deskjs=require(_0x0b43('0xc'));var toCsv=require(_0x0b43('0xd'));var querystring=require(_0x0b43('0xe'));var Papa=require(_0x0b43('0xf'));var Redis=require('ioredis');var authService=require(_0x0b43('0x10'));var qs=require(_0x0b43('0x11'));var as=require(_0x0b43('0x12'));var hardwareService=require(_0x0b43('0x13'));var logger=require(_0x0b43('0x14'))(_0x0b43('0x15'));var utils=require(_0x0b43('0x16'));var config=require(_0x0b43('0x17'));var licenseUtil=require(_0x0b43('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cde2,_0x3f377c){_0x3f377c=_0x3f377c||0xcc;return function(_0x2aac55){if(_0x2aac55){return _0x1cde2[_0x0b43('0x19')](_0x3f377c);}return _0x1cde2[_0x0b43('0x1a')](_0x3f377c)[_0x0b43('0x1b')]();};}function respondWithResult(_0x2eb126,_0x54ad36){_0x54ad36=_0x54ad36||0xc8;return function(_0x4ff4e3){if(_0x4ff4e3){return _0x2eb126[_0x0b43('0x1a')](_0x54ad36)[_0x0b43('0x1c')](_0x4ff4e3);}};}function respondWithFilteredResult(_0x3139ab,_0x10a5aa){return function(_0x234a62){if(_0x234a62){var _0x2018f0=typeof _0x10a5aa[_0x0b43('0x1d')]===_0x0b43('0x1e')&&typeof _0x10a5aa[_0x0b43('0x1f')]===_0x0b43('0x1e');var _0x14c7fd=_0x234a62[_0x0b43('0x20')];var _0x588805=_0x2018f0?0x0:_0x10a5aa[_0x0b43('0x1d')];var _0x46da19=_0x2018f0?_0x234a62[_0x0b43('0x20')]:_0x10a5aa['offset']+_0x10a5aa[_0x0b43('0x1f')];var _0x14936b;if(_0x46da19>=_0x14c7fd){_0x46da19=_0x14c7fd;_0x14936b=0xc8;}else{_0x14936b=0xce;}_0x3139ab[_0x0b43('0x1a')](_0x14936b);return _0x3139ab[_0x0b43('0x21')](_0x0b43('0x22'),_0x588805+'-'+_0x46da19+'/'+_0x14c7fd)[_0x0b43('0x1c')](_0x234a62);}return null;};}function patchUpdates(_0x5836fd){return function(_0x373511){try{jsonpatch[_0x0b43('0x23')](_0x373511,_0x5836fd,!![]);}catch(_0x3349bb){return BPromise[_0x0b43('0x24')](_0x3349bb);}return _0x373511[_0x0b43('0x25')]();};}function saveUpdates(_0x419552,_0x54b320){return function(_0x14fd41){if(_0x14fd41){return _0x14fd41[_0x0b43('0x26')](_0x419552)[_0x0b43('0x27')](function(_0x115a56){return _0x115a56;});}return null;};}function removeEntity(_0xf1df1a,_0x5ed244){return function(_0x3755e3){if(_0x3755e3){return _0x3755e3[_0x0b43('0x28')]()[_0x0b43('0x27')](function(){_0xf1df1a[_0x0b43('0x1a')](0xcc)[_0x0b43('0x1b')]();});}};}function handleEntityNotFound(_0x3b08dd,_0x2a3bd7){return function(_0x8ff07e){if(!_0x8ff07e){_0x3b08dd[_0x0b43('0x19')](0x194);}return _0x8ff07e;};}function handleError(_0x2dfce9,_0x3a5b0c){_0x3a5b0c=_0x3a5b0c||0x1f4;return function(_0x3cbf1d){logger['error'](_0x3cbf1d['stack']);if(_0x3cbf1d[_0x0b43('0x29')]){delete _0x3cbf1d[_0x0b43('0x29')];}_0x2dfce9[_0x0b43('0x1a')](_0x3a5b0c)[_0x0b43('0x2a')](_0x3cbf1d);};}exports[_0x0b43('0x2b')]=function(_0x54d8ac,_0x386910){var _0x50d3fd={},_0x498c4c={},_0x54c6cd={'count':0x0,'rows':[]};var _0x45fc97=_[_0x0b43('0x2c')](db['FreshsalesConfiguration'][_0x0b43('0x2d')],function(_0x10b9ee){return{'name':_0x10b9ee[_0x0b43('0x2e')],'type':_0x10b9ee[_0x0b43('0x2f')]['key']};});_0x498c4c[_0x0b43('0x30')]=_[_0x0b43('0x2c')](_0x45fc97,_0x0b43('0x29'));_0x498c4c['query']=_['keys'](_0x54d8ac[_0x0b43('0x31')]);_0x498c4c[_0x0b43('0x32')]=_[_0x0b43('0x33')](_0x498c4c[_0x0b43('0x30')],_0x498c4c[_0x0b43('0x31')]);_0x50d3fd[_0x0b43('0x34')]=_[_0x0b43('0x33')](_0x498c4c['model'],qs['fields'](_0x54d8ac[_0x0b43('0x31')][_0x0b43('0x35')]));_0x50d3fd[_0x0b43('0x34')]=_0x50d3fd[_0x0b43('0x34')]['length']?_0x50d3fd[_0x0b43('0x34')]:_0x498c4c[_0x0b43('0x30')];if(!_0x54d8ac[_0x0b43('0x31')][_0x0b43('0x36')](_0x0b43('0x37'))){_0x50d3fd['limit']=qs[_0x0b43('0x1f')](_0x54d8ac['query'][_0x0b43('0x1f')]);_0x50d3fd[_0x0b43('0x1d')]=qs[_0x0b43('0x1d')](_0x54d8ac[_0x0b43('0x31')]['offset']);}_0x50d3fd[_0x0b43('0x38')]=qs[_0x0b43('0x39')](_0x54d8ac['query'][_0x0b43('0x39')]);_0x50d3fd[_0x0b43('0x3a')]=qs[_0x0b43('0x32')](_[_0x0b43('0x3b')](_0x54d8ac[_0x0b43('0x31')],_0x498c4c[_0x0b43('0x32')]),_0x45fc97);if(_0x54d8ac[_0x0b43('0x31')][_0x0b43('0x3c')]){_0x50d3fd['where']=_[_0x0b43('0x3d')](_0x50d3fd[_0x0b43('0x3a')],{'$or':_['map'](_0x45fc97,function(_0xd3ac2d){if(_0xd3ac2d[_0x0b43('0x2f')]!=='VIRTUAL'){var _0x7d31bf={};_0x7d31bf[_0xd3ac2d[_0x0b43('0x29')]]={'$like':'%'+_0x54d8ac[_0x0b43('0x31')]['filter']+'%'};return _0x7d31bf;}})});}_0x50d3fd=_['merge']({},_0x50d3fd,_0x54d8ac['options']);var _0x3f0e3c={'where':_0x50d3fd['where']};return db[_0x0b43('0x3e')][_0x0b43('0x20')](_0x3f0e3c)['then'](function(_0x1fc100){_0x54c6cd[_0x0b43('0x20')]=_0x1fc100;if(_0x54d8ac[_0x0b43('0x31')][_0x0b43('0x3f')]){_0x50d3fd[_0x0b43('0x40')]=[{'all':!![]}];}return db[_0x0b43('0x3e')]['findAll'](_0x50d3fd);})[_0x0b43('0x27')](function(_0x402077){_0x54c6cd[_0x0b43('0x41')]=_0x402077;return _0x54c6cd;})[_0x0b43('0x27')](respondWithFilteredResult(_0x386910,_0x50d3fd))[_0x0b43('0x42')](handleError(_0x386910,null));};exports['show']=function(_0x1d14b7,_0x3aa762){var _0x5a57b2={'raw':![],'where':{'id':_0x1d14b7[_0x0b43('0x43')]['id']}},_0x4d5c65={};_0x4d5c65[_0x0b43('0x30')]=_[_0x0b43('0x44')](db[_0x0b43('0x3e')][_0x0b43('0x2d')]);_0x4d5c65[_0x0b43('0x31')]=_[_0x0b43('0x44')](_0x1d14b7[_0x0b43('0x31')]);_0x4d5c65[_0x0b43('0x32')]=_[_0x0b43('0x33')](_0x4d5c65[_0x0b43('0x30')],_0x4d5c65[_0x0b43('0x31')]);_0x5a57b2[_0x0b43('0x34')]=_['intersection'](_0x4d5c65[_0x0b43('0x30')],qs[_0x0b43('0x35')](_0x1d14b7[_0x0b43('0x31')][_0x0b43('0x35')]));_0x5a57b2[_0x0b43('0x34')]=_0x5a57b2[_0x0b43('0x34')][_0x0b43('0x45')]?_0x5a57b2['attributes']:_0x4d5c65[_0x0b43('0x30')];if(_0x1d14b7[_0x0b43('0x31')][_0x0b43('0x3f')]){_0x5a57b2[_0x0b43('0x40')]=[{'all':!![]}];}_0x5a57b2=_[_0x0b43('0x3d')]({},_0x5a57b2,_0x1d14b7['options']);return db[_0x0b43('0x3e')]['find'](_0x5a57b2)[_0x0b43('0x27')](handleEntityNotFound(_0x3aa762,null))['then'](respondWithResult(_0x3aa762,null))[_0x0b43('0x42')](handleError(_0x3aa762,null));};exports[_0x0b43('0x46')]=function(_0x26d2ed,_0x23b3fe){return db[_0x0b43('0x3e')][_0x0b43('0x46')](_0x26d2ed[_0x0b43('0x47')],{})[_0x0b43('0x27')](respondWithResult(_0x23b3fe,0xc9))[_0x0b43('0x42')](handleError(_0x23b3fe,null));};exports[_0x0b43('0x26')]=function(_0x4ccc45,_0x524329){if(_0x4ccc45[_0x0b43('0x47')]['id']){delete _0x4ccc45[_0x0b43('0x47')]['id'];}return db[_0x0b43('0x3e')]['find']({'where':{'id':_0x4ccc45[_0x0b43('0x43')]['id']}})[_0x0b43('0x27')](handleEntityNotFound(_0x524329,null))['then'](saveUpdates(_0x4ccc45['body'],null))[_0x0b43('0x27')](respondWithResult(_0x524329,null))[_0x0b43('0x42')](handleError(_0x524329,null));};exports[_0x0b43('0x28')]=function(_0x37f0fb,_0x5a1c44){return db[_0x0b43('0x3e')][_0x0b43('0x48')]({'where':{'id':_0x37f0fb[_0x0b43('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a1c44,null))[_0x0b43('0x27')](removeEntity(_0x5a1c44,null))['catch'](handleError(_0x5a1c44,null));};exports[_0x0b43('0x49')]=function(_0x25ec00,_0xc39145,_0x118af1){var _0x1e2caa={};var _0x2b963e={};var _0x482b61;var _0x196f3e;return db[_0x0b43('0x3e')][_0x0b43('0x4a')]({'where':{'id':_0x25ec00[_0x0b43('0x43')]['id']}})['then'](handleEntityNotFound(_0xc39145,null))[_0x0b43('0x27')](function(_0x284d91){if(_0x284d91){_0x482b61=_0x284d91;_0x2b963e[_0x0b43('0x30')]=_[_0x0b43('0x44')](db[_0x0b43('0x4b')][_0x0b43('0x2d')]);_0x2b963e[_0x0b43('0x31')]=_[_0x0b43('0x44')](_0x25ec00['query']);_0x2b963e[_0x0b43('0x32')]=_[_0x0b43('0x33')](_0x2b963e[_0x0b43('0x30')],_0x2b963e[_0x0b43('0x31')]);_0x1e2caa['attributes']=_[_0x0b43('0x33')](_0x2b963e[_0x0b43('0x30')],qs[_0x0b43('0x35')](_0x25ec00[_0x0b43('0x31')][_0x0b43('0x35')]));_0x1e2caa[_0x0b43('0x34')]=_0x1e2caa[_0x0b43('0x34')][_0x0b43('0x45')]?_0x1e2caa[_0x0b43('0x34')]:_0x2b963e[_0x0b43('0x30')];_0x1e2caa[_0x0b43('0x38')]=qs[_0x0b43('0x39')](_0x25ec00[_0x0b43('0x31')][_0x0b43('0x39')]);_0x1e2caa[_0x0b43('0x3a')]=qs['filters'](_[_0x0b43('0x3b')](_0x25ec00[_0x0b43('0x31')],_0x2b963e[_0x0b43('0x32')]));if(_0x25ec00[_0x0b43('0x31')][_0x0b43('0x3c')]){_0x1e2caa['where']=_[_0x0b43('0x3d')](_0x1e2caa[_0x0b43('0x3a')],{'$or':_[_0x0b43('0x2c')](_0x1e2caa[_0x0b43('0x34')],function(_0x448fa8){var _0x4ee73d={};_0x4ee73d[_0x448fa8]={'$like':'%'+_0x25ec00[_0x0b43('0x31')][_0x0b43('0x3c')]+'%'};return _0x4ee73d;})});}_0x1e2caa=_[_0x0b43('0x3d')]({},_0x1e2caa,_0x25ec00[_0x0b43('0x4c')]);return _0x482b61[_0x0b43('0x49')](_0x1e2caa);}})[_0x0b43('0x27')](function(_0x236d1a){if(_0x236d1a){_0x196f3e=_0x236d1a[_0x0b43('0x45')];if(!_0x25ec00[_0x0b43('0x31')][_0x0b43('0x36')](_0x0b43('0x37'))){_0x1e2caa[_0x0b43('0x1f')]=qs[_0x0b43('0x1f')](_0x25ec00[_0x0b43('0x31')][_0x0b43('0x1f')]);_0x1e2caa['offset']=qs[_0x0b43('0x1d')](_0x25ec00['query'][_0x0b43('0x1d')]);}return _0x482b61[_0x0b43('0x49')](_0x1e2caa);}})[_0x0b43('0x27')](function(_0x562ede){if(_0x562ede){return _0x562ede?{'count':_0x196f3e,'rows':_0x562ede}:null;}})['then'](respondWithResult(_0xc39145,null))[_0x0b43('0x42')](handleError(_0xc39145,null));};exports[_0x0b43('0x4d')]=function(_0x91f72f,_0x3ab558,_0x89b442){var _0x57f979={};var _0x4a8efc={};var _0x1c556a;var _0x17c3e4;return db['FreshsalesConfiguration'][_0x0b43('0x4a')]({'where':{'id':_0x91f72f['params']['id']}})[_0x0b43('0x27')](handleEntityNotFound(_0x3ab558,null))[_0x0b43('0x27')](function(_0x451826){if(_0x451826){_0x1c556a=_0x451826;_0x4a8efc[_0x0b43('0x30')]=_[_0x0b43('0x44')](db[_0x0b43('0x4b')][_0x0b43('0x2d')]);_0x4a8efc['query']=_[_0x0b43('0x44')](_0x91f72f[_0x0b43('0x31')]);_0x4a8efc[_0x0b43('0x32')]=_[_0x0b43('0x33')](_0x4a8efc[_0x0b43('0x30')],_0x4a8efc['query']);_0x57f979[_0x0b43('0x34')]=_[_0x0b43('0x33')](_0x4a8efc[_0x0b43('0x30')],qs[_0x0b43('0x35')](_0x91f72f[_0x0b43('0x31')][_0x0b43('0x35')]));_0x57f979[_0x0b43('0x34')]=_0x57f979[_0x0b43('0x34')][_0x0b43('0x45')]?_0x57f979[_0x0b43('0x34')]:_0x4a8efc['model'];_0x57f979['order']=qs[_0x0b43('0x39')](_0x91f72f['query'][_0x0b43('0x39')]);_0x57f979[_0x0b43('0x3a')]=qs['filters'](_[_0x0b43('0x3b')](_0x91f72f[_0x0b43('0x31')],_0x4a8efc[_0x0b43('0x32')]));if(_0x91f72f['query']['filter']){_0x57f979['where']=_[_0x0b43('0x3d')](_0x57f979['where'],{'$or':_[_0x0b43('0x2c')](_0x57f979[_0x0b43('0x34')],function(_0x1f9562){var _0x460c62={};_0x460c62[_0x1f9562]={'$like':'%'+_0x91f72f[_0x0b43('0x31')]['filter']+'%'};return _0x460c62;})});}_0x57f979=_[_0x0b43('0x3d')]({},_0x57f979,_0x91f72f[_0x0b43('0x4c')]);return _0x1c556a[_0x0b43('0x4d')](_0x57f979);}})[_0x0b43('0x27')](function(_0x22181b){if(_0x22181b){_0x17c3e4=_0x22181b[_0x0b43('0x45')];if(!_0x91f72f[_0x0b43('0x31')]['hasOwnProperty'](_0x0b43('0x37'))){_0x57f979[_0x0b43('0x1f')]=qs[_0x0b43('0x1f')](_0x91f72f[_0x0b43('0x31')][_0x0b43('0x1f')]);_0x57f979['offset']=qs[_0x0b43('0x1d')](_0x91f72f['query']['offset']);}return _0x1c556a[_0x0b43('0x4d')](_0x57f979);}})[_0x0b43('0x27')](function(_0x556439){if(_0x556439){return _0x556439?{'count':_0x17c3e4,'rows':_0x556439}:null;}})['then'](respondWithResult(_0x3ab558,null))[_0x0b43('0x42')](handleError(_0x3ab558,null));};exports[_0x0b43('0x4e')]=function(_0x40af06,_0x5af022,_0x5c5628){var _0x2ba793={};var _0xbbb0e5={};var _0x4cbd06;var _0xa7bf35;return db[_0x0b43('0x3e')]['findOne']({'where':{'id':_0x40af06[_0x0b43('0x43')]['id']}})[_0x0b43('0x27')](handleEntityNotFound(_0x5af022,null))['then'](function(_0x550c19){if(_0x550c19){_0x4cbd06=_0x550c19;_0xbbb0e5[_0x0b43('0x30')]=_[_0x0b43('0x44')](db['FreshsalesField']['rawAttributes']);_0xbbb0e5[_0x0b43('0x31')]=_[_0x0b43('0x44')](_0x40af06[_0x0b43('0x31')]);_0xbbb0e5[_0x0b43('0x32')]=_[_0x0b43('0x33')](_0xbbb0e5[_0x0b43('0x30')],_0xbbb0e5[_0x0b43('0x31')]);_0x2ba793[_0x0b43('0x34')]=_[_0x0b43('0x33')](_0xbbb0e5[_0x0b43('0x30')],qs[_0x0b43('0x35')](_0x40af06[_0x0b43('0x31')][_0x0b43('0x35')]));_0x2ba793[_0x0b43('0x34')]=_0x2ba793['attributes'][_0x0b43('0x45')]?_0x2ba793[_0x0b43('0x34')]:_0xbbb0e5[_0x0b43('0x30')];_0x2ba793[_0x0b43('0x38')]=qs[_0x0b43('0x39')](_0x40af06[_0x0b43('0x31')][_0x0b43('0x39')]);_0x2ba793[_0x0b43('0x3a')]=qs[_0x0b43('0x32')](_['pick'](_0x40af06[_0x0b43('0x31')],_0xbbb0e5[_0x0b43('0x32')]));if(_0x40af06[_0x0b43('0x31')][_0x0b43('0x3c')]){_0x2ba793[_0x0b43('0x3a')]=_[_0x0b43('0x3d')](_0x2ba793[_0x0b43('0x3a')],{'$or':_[_0x0b43('0x2c')](_0x2ba793[_0x0b43('0x34')],function(_0x4c8acb){var _0x5c3573={};_0x5c3573[_0x4c8acb]={'$like':'%'+_0x40af06[_0x0b43('0x31')][_0x0b43('0x3c')]+'%'};return _0x5c3573;})});}_0x2ba793=_[_0x0b43('0x3d')]({},_0x2ba793,_0x40af06[_0x0b43('0x4c')]);return _0x4cbd06[_0x0b43('0x4e')](_0x2ba793);}})['then'](function(_0x2d60f4){if(_0x2d60f4){_0xa7bf35=_0x2d60f4[_0x0b43('0x45')];if(!_0x40af06[_0x0b43('0x31')]['hasOwnProperty'](_0x0b43('0x37'))){_0x2ba793['limit']=qs['limit'](_0x40af06[_0x0b43('0x31')][_0x0b43('0x1f')]);_0x2ba793[_0x0b43('0x1d')]=qs['offset'](_0x40af06['query'][_0x0b43('0x1d')]);}return _0x4cbd06[_0x0b43('0x4e')](_0x2ba793);}})[_0x0b43('0x27')](function(_0x3a564d){if(_0x3a564d){return _0x3a564d?{'count':_0xa7bf35,'rows':_0x3a564d}:null;}})[_0x0b43('0x27')](respondWithResult(_0x5af022,null))[_0x0b43('0x42')](handleError(_0x5af022,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3a7627e..51db1c0 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 _0x7f3a=['int_freshsales_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x3c51cf,_0x3924f6){var _0x23e61a=function(_0x415691){while(--_0x415691){_0x3c51cf['push'](_0x3c51cf['shift']());}};_0x23e61a(++_0x3924f6);}(_0x7f3a,0xf8));var _0xa7f3=function(_0x3c5d42,_0x49ecb7){_0x3c5d42=_0x3c5d42-0x0;var _0x5802e5=_0x7f3a[_0x3c5d42];return _0x5802e5;};'use strict';var _=require(_0xa7f3('0x0'));var util=require('util');var logger=require(_0xa7f3('0x1'))(_0xa7f3('0x2'));var moment=require(_0xa7f3('0x3'));var BPromise=require(_0xa7f3('0x4'));var rp=require(_0xa7f3('0x5'));var fs=require('fs');var path=require(_0xa7f3('0x6'));var rimraf=require('rimraf');var config=require(_0xa7f3('0x7'));var attributes=require(_0xa7f3('0x8'));module[_0xa7f3('0x9')]=function(_0xd21808,_0x40bc5d){return _0xd21808[_0xa7f3('0xa')](_0xa7f3('0xb'),attributes,{'tableName':_0xa7f3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f58=['../../config/logger','moment','bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x3e5570,_0x1ff35e){var _0x4834d9=function(_0xd8e25b){while(--_0xd8e25b){_0x3e5570['push'](_0x3e5570['shift']());}};_0x4834d9(++_0x1ff35e);}(_0x0f58,0x1de));var _0x80f5=function(_0x5c41d5,_0xa8e8c3){_0x5c41d5=_0x5c41d5-0x0;var _0x2c4858=_0x0f58[_0x5c41d5];return _0x2c4858;};'use strict';var _=require(_0x80f5('0x0'));var util=require(_0x80f5('0x1'));var logger=require(_0x80f5('0x2'))('api');var moment=require(_0x80f5('0x3'));var BPromise=require(_0x80f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80f5('0x5'));var rimraf=require('rimraf');var config=require(_0x80f5('0x6'));var attributes=require(_0x80f5('0x7'));module[_0x80f5('0x8')]=function(_0x452bc2,_0x2f09f4){return _0x452bc2[_0x80f5('0x9')](_0x80f5('0xa'),attributes,{'tableName':_0x80f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 17ee6b6..053da5c 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 _0x73b1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1831ac,_0x31bae8){var _0x311ddd=function(_0x30ff52){while(--_0x30ff52){_0x1831ac['push'](_0x1831ac['shift']());}};_0x311ddd(++_0x31bae8);}(_0x73b1,0x9d));var _0x173b=function(_0x3546a6,_0x239442){_0x3546a6=_0x3546a6-0x0;var _0x52594c=_0x73b1[_0x3546a6];return _0x52594c;};'use strict';var _=require(_0x173b('0x0'));var util=require(_0x173b('0x1'));var moment=require(_0x173b('0x2'));var BPromise=require(_0x173b('0x3'));var rs=require(_0x173b('0x4'));var fs=require('fs');var Redis=require(_0x173b('0x5'));var db=require(_0x173b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x173b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x173b('0x8')][_0x173b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b840b,_0x4019e5,_0x477a23){return new BPromise(function(_0x3bfb5d,_0xc4b221){return client['request'](_0x2b840b,_0x477a23)['then'](function(_0x5cbcc2){logger[_0x173b('0xa')](_0x173b('0xb'),_0x4019e5,_0x173b('0xc'));logger[_0x173b('0xd')](_0x173b('0xe'),_0x4019e5,_0x173b('0xc'),JSON[_0x173b('0xf')](_0x5cbcc2));if(_0x5cbcc2[_0x173b('0x10')]){if(_0x5cbcc2['error']['code']===0x1f4){logger['error'](_0x173b('0xb'),_0x4019e5,_0x5cbcc2[_0x173b('0x10')][_0x173b('0x11')]);return _0xc4b221(_0x5cbcc2['error'][_0x173b('0x11')]);}logger['error'](_0x173b('0xb'),_0x4019e5,_0x5cbcc2['error'][_0x173b('0x11')]);return _0x3bfb5d(_0x5cbcc2[_0x173b('0x10')][_0x173b('0x11')]);}else{logger[_0x173b('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4019e5,_0x173b('0xc'));_0x3bfb5d(_0x5cbcc2[_0x173b('0x12')][_0x173b('0x11')]);}})[_0x173b('0x13')](function(_0x154948){logger[_0x173b('0x10')](_0x173b('0xb'),_0x4019e5,_0x154948);_0xc4b221(_0x154948);});});} \ No newline at end of file +var _0x43bc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','info','result','lodash','util','moment'];(function(_0xef81d1,_0x169461){var _0x25acc9=function(_0x168fde){while(--_0x168fde){_0xef81d1['push'](_0xef81d1['shift']());}};_0x25acc9(++_0x169461);}(_0x43bc,0x11d));var _0xc43b=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x43bc[_0x72895a];return _0x5226d5;};'use strict';var _=require(_0xc43b('0x0'));var util=require(_0xc43b('0x1'));var moment=require(_0xc43b('0x2'));var BPromise=require(_0xc43b('0x3'));var rs=require(_0xc43b('0x4'));var fs=require('fs');var Redis=require(_0xc43b('0x5'));var db=require(_0xc43b('0x6'))['db'];var utils=require(_0xc43b('0x7'));var logger=require(_0xc43b('0x8'))(_0xc43b('0x9'));var config=require(_0xc43b('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc43b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9c68,_0x4fdce9,_0x105685){return new BPromise(function(_0x275b8a,_0x3031b2){return client[_0xc43b('0xc')](_0x4b9c68,_0x105685)[_0xc43b('0xd')](function(_0x594bf2){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4fdce9,_0xc43b('0xe'));logger[_0xc43b('0xf')](_0xc43b('0x10'),_0x4fdce9,_0xc43b('0xe'),JSON[_0xc43b('0x11')](_0x594bf2));if(_0x594bf2[_0xc43b('0x12')]){if(_0x594bf2[_0xc43b('0x12')][_0xc43b('0x13')]===0x1f4){logger[_0xc43b('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4fdce9,_0x594bf2['error']['message']);return _0x3031b2(_0x594bf2[_0xc43b('0x12')][_0xc43b('0x14')]);}logger[_0xc43b('0x12')](_0xc43b('0x15'),_0x4fdce9,_0x594bf2['error'][_0xc43b('0x14')]);return _0x275b8a(_0x594bf2[_0xc43b('0x12')][_0xc43b('0x14')]);}else{logger[_0xc43b('0x16')](_0xc43b('0x15'),_0x4fdce9,'request\x20sent');_0x275b8a(_0x594bf2[_0xc43b('0x17')][_0xc43b('0x14')]);}})['catch'](function(_0x20a243){logger[_0xc43b('0x12')](_0xc43b('0x15'),_0x4fdce9,_0x20a243);_0x3031b2(_0x20a243);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d2e73e9..0de0de5 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 _0xe14d=['../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0xe14d,0x1ee));var _0xde14=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xe14d[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/:id',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0xd')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller['update']);router[_0xde14('0x11')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller[_0xde14('0x12')]);module[_0xde14('0x13')]=router; \ No newline at end of file +var _0x149c=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x1a2566,_0x2ed939){var _0x15649b=function(_0x54ffc4){while(--_0x54ffc4){_0x1a2566['push'](_0x1a2566['shift']());}};_0x15649b(++_0x2ed939);}(_0x149c,0x143));var _0xc149=function(_0x349e83,_0x3b04af){_0x349e83=_0x349e83-0x0;var _0x24ecb3=_0x149c[_0x349e83];return _0x24ecb3;};'use strict';var multer=require(_0xc149('0x0'));var util=require('util');var path=require(_0xc149('0x1'));var timeout=require(_0xc149('0x2'));var express=require(_0xc149('0x3'));var router=express['Router']();var fs_extra=require(_0xc149('0x4'));var auth=require(_0xc149('0x5'));var interaction=require(_0xc149('0x6'));var config=require(_0xc149('0x7'));var controller=require(_0xc149('0x8'));router[_0xc149('0x9')]('/',auth[_0xc149('0xa')](),controller['index']);router['get'](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0xc')]);router[_0xc149('0xd')]('/',auth[_0xc149('0xa')](),controller[_0xc149('0xe')]);router[_0xc149('0xf')](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0x10')]);router[_0xc149('0x11')](_0xc149('0xb'),auth[_0xc149('0xa')](),controller[_0xc149('0x12')]);module[_0xc149('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e3a5535..ec25d1a 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 _0x41e1=['sequelize','exports','ENUM','picklist','string','STRING','variable','customVariable'];(function(_0xf64789,_0x55bdfa){var _0x3622f1=function(_0x799d4f){while(--_0x799d4f){_0xf64789['push'](_0xf64789['shift']());}};_0x3622f1(++_0x55bdfa);}(_0x41e1,0x160));var _0x141e=function(_0x3cdcd4,_0x54cc78){_0x3cdcd4=_0x3cdcd4-0x0;var _0x548523=_0x41e1[_0x3cdcd4];return _0x548523;};'use strict';var Sequelize=require(_0x141e('0x0'));module[_0x141e('0x1')]={'type':{'type':Sequelize[_0x141e('0x2')]('string','variable','customVariable','keyValue',_0x141e('0x3')),'defaultValue':_0x141e('0x4')},'content':{'type':Sequelize[_0x141e('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x141e('0x4'),_0x141e('0x6'),_0x141e('0x7'))},'keyContent':{'type':Sequelize[_0x141e('0x5')]},'idField':{'type':Sequelize[_0x141e('0x5')]},'nameField':{'type':Sequelize[_0x141e('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x141e('0x5')]}}; \ No newline at end of file +var _0x7199=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0xdb65cb,_0x4cf4a9){var _0x5287ec=function(_0x3f5a0b){while(--_0x3f5a0b){_0xdb65cb['push'](_0xdb65cb['shift']());}};_0x5287ec(++_0x4cf4a9);}(_0x7199,0x1c5));var _0x9719=function(_0x100ce6,_0x188859){_0x100ce6=_0x100ce6-0x0;var _0x3d3b5f=_0x7199[_0x100ce6];return _0x3d3b5f;};'use strict';var Sequelize=require(_0x9719('0x0'));module[_0x9719('0x1')]={'type':{'type':Sequelize[_0x9719('0x2')](_0x9719('0x3'),_0x9719('0x4'),_0x9719('0x5'),'keyValue',_0x9719('0x6')),'defaultValue':_0x9719('0x3')},'content':{'type':Sequelize[_0x9719('0x7')]},'key':{'type':Sequelize[_0x9719('0x7')]},'keyType':{'type':Sequelize[_0x9719('0x2')]('string',_0x9719('0x4'),_0x9719('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9719('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9719('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 69e2fef..b275469 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 _0xde83=['VIRTUAL','options','FreshsalesField','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','destroy','error','name','index','map','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge'];(function(_0x24f8f1,_0x40f25c){var _0x5c0440=function(_0x1aad2e){while(--_0x1aad2e){_0x24f8f1['push'](_0x24f8f1['shift']());}};_0x5c0440(++_0x40f25c);}(_0xde83,0x166));var _0x3de8=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xde83[_0x1e4150];return _0x1ce3ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3de8('0x0'));var zipdir=require(_0x3de8('0x1'));var jsonpatch=require(_0x3de8('0x2'));var rp=require(_0x3de8('0x3'));var moment=require(_0x3de8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3de8('0x5'));var path=require(_0x3de8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3de8('0x7'));var _=require(_0x3de8('0x8'));var squel=require(_0x3de8('0x9'));var crypto=require(_0x3de8('0xa'));var jsforce=require(_0x3de8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3de8('0xc'));var querystring=require(_0x3de8('0xd'));var Papa=require(_0x3de8('0xe'));var Redis=require(_0x3de8('0xf'));var authService=require(_0x3de8('0x10'));var qs=require(_0x3de8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3de8('0x12'))(_0x3de8('0x13'));var utils=require(_0x3de8('0x14'));var config=require(_0x3de8('0x15'));var licenseUtil=require(_0x3de8('0x16'));var db=require(_0x3de8('0x17'))['db'];function respondWithStatusCode(_0x9d89ec,_0x477762){_0x477762=_0x477762||0xcc;return function(_0x1c25b6){if(_0x1c25b6){return _0x9d89ec[_0x3de8('0x18')](_0x477762);}return _0x9d89ec[_0x3de8('0x19')](_0x477762)[_0x3de8('0x1a')]();};}function respondWithResult(_0x346b4b,_0x4adfac){_0x4adfac=_0x4adfac||0xc8;return function(_0x54983d){if(_0x54983d){return _0x346b4b[_0x3de8('0x19')](_0x4adfac)[_0x3de8('0x1b')](_0x54983d);}};}function respondWithFilteredResult(_0x5565b0,_0xb3c954){return function(_0x47eca7){if(_0x47eca7){var _0x4b366a=typeof _0xb3c954[_0x3de8('0x1c')]==='undefined'&&typeof _0xb3c954[_0x3de8('0x1d')]===_0x3de8('0x1e');var _0x3dbd21=_0x47eca7[_0x3de8('0x1f')];var _0xae5c94=_0x4b366a?0x0:_0xb3c954[_0x3de8('0x1c')];var _0x34c53b=_0x4b366a?_0x47eca7[_0x3de8('0x1f')]:_0xb3c954[_0x3de8('0x1c')]+_0xb3c954[_0x3de8('0x1d')];var _0x15e697;if(_0x34c53b>=_0x3dbd21){_0x34c53b=_0x3dbd21;_0x15e697=0xc8;}else{_0x15e697=0xce;}_0x5565b0[_0x3de8('0x19')](_0x15e697);return _0x5565b0['set']('Content-Range',_0xae5c94+'-'+_0x34c53b+'/'+_0x3dbd21)['json'](_0x47eca7);}return null;};}function patchUpdates(_0x2e6814){return function(_0x4aaf57){try{jsonpatch[_0x3de8('0x20')](_0x4aaf57,_0x2e6814,!![]);}catch(_0x33919d){return BPromise[_0x3de8('0x21')](_0x33919d);}return _0x4aaf57[_0x3de8('0x22')]();};}function saveUpdates(_0x5eb876,_0x187b7d){return function(_0x311c73){if(_0x311c73){return _0x311c73['update'](_0x5eb876)[_0x3de8('0x23')](function(_0x5c13e7){return _0x5c13e7;});}return null;};}function removeEntity(_0x32105b,_0x53b0b2){return function(_0x559923){if(_0x559923){return _0x559923[_0x3de8('0x24')]()['then'](function(){_0x32105b[_0x3de8('0x19')](0xcc)[_0x3de8('0x1a')]();});}};}function handleEntityNotFound(_0x197c1d,_0x2e5aea){return function(_0x3af3f1){if(!_0x3af3f1){_0x197c1d['sendStatus'](0x194);}return _0x3af3f1;};}function handleError(_0x4caf5a,_0x1b5011){_0x1b5011=_0x1b5011||0x1f4;return function(_0x559a70){logger[_0x3de8('0x25')](_0x559a70['stack']);if(_0x559a70[_0x3de8('0x26')]){delete _0x559a70[_0x3de8('0x26')];}_0x4caf5a[_0x3de8('0x19')](_0x1b5011)['send'](_0x559a70);};}exports[_0x3de8('0x27')]=function(_0x2e7818,_0x429858){var _0x4be506={},_0xdc9c8b={},_0x3408c9={'count':0x0,'rows':[]};var _0x5a6664=_[_0x3de8('0x28')](db['FreshsalesField']['rawAttributes'],function(_0x4e7b6b){return{'name':_0x4e7b6b['fieldName'],'type':_0x4e7b6b[_0x3de8('0x29')]['key']};});_0xdc9c8b[_0x3de8('0x2a')]=_[_0x3de8('0x28')](_0x5a6664,_0x3de8('0x26'));_0xdc9c8b['query']=_[_0x3de8('0x2b')](_0x2e7818['query']);_0xdc9c8b[_0x3de8('0x2c')]=_[_0x3de8('0x2d')](_0xdc9c8b[_0x3de8('0x2a')],_0xdc9c8b[_0x3de8('0x2e')]);_0x4be506[_0x3de8('0x2f')]=_['intersection'](_0xdc9c8b[_0x3de8('0x2a')],qs[_0x3de8('0x30')](_0x2e7818[_0x3de8('0x2e')][_0x3de8('0x30')]));_0x4be506['attributes']=_0x4be506[_0x3de8('0x2f')][_0x3de8('0x31')]?_0x4be506[_0x3de8('0x2f')]:_0xdc9c8b['model'];if(!_0x2e7818[_0x3de8('0x2e')]['hasOwnProperty'](_0x3de8('0x32'))){_0x4be506[_0x3de8('0x1d')]=qs[_0x3de8('0x1d')](_0x2e7818[_0x3de8('0x2e')]['limit']);_0x4be506[_0x3de8('0x1c')]=qs[_0x3de8('0x1c')](_0x2e7818[_0x3de8('0x2e')]['offset']);}_0x4be506[_0x3de8('0x33')]=qs[_0x3de8('0x34')](_0x2e7818[_0x3de8('0x2e')][_0x3de8('0x34')]);_0x4be506[_0x3de8('0x35')]=qs[_0x3de8('0x2c')](_[_0x3de8('0x36')](_0x2e7818[_0x3de8('0x2e')],_0xdc9c8b[_0x3de8('0x2c')]),_0x5a6664);if(_0x2e7818[_0x3de8('0x2e')]['filter']){_0x4be506[_0x3de8('0x35')]=_[_0x3de8('0x37')](_0x4be506[_0x3de8('0x35')],{'$or':_[_0x3de8('0x28')](_0x5a6664,function(_0x10b52c){if(_0x10b52c[_0x3de8('0x29')]!==_0x3de8('0x38')){var _0x47a7f2={};_0x47a7f2[_0x10b52c[_0x3de8('0x26')]]={'$like':'%'+_0x2e7818[_0x3de8('0x2e')]['filter']+'%'};return _0x47a7f2;}})});}_0x4be506=_[_0x3de8('0x37')]({},_0x4be506,_0x2e7818[_0x3de8('0x39')]);var _0x148ee4={'where':_0x4be506[_0x3de8('0x35')]};return db[_0x3de8('0x3a')][_0x3de8('0x1f')](_0x148ee4)[_0x3de8('0x23')](function(_0x1b365f){_0x3408c9['count']=_0x1b365f;if(_0x2e7818[_0x3de8('0x2e')]['includeAll']){_0x4be506[_0x3de8('0x3b')]=[{'all':!![]}];}return db[_0x3de8('0x3a')][_0x3de8('0x3c')](_0x4be506);})[_0x3de8('0x23')](function(_0x2eb0f8){_0x3408c9['rows']=_0x2eb0f8;return _0x3408c9;})['then'](respondWithFilteredResult(_0x429858,_0x4be506))[_0x3de8('0x3d')](handleError(_0x429858,null));};exports['show']=function(_0x3d0a52,_0x3b2043){var _0x2c3e32={'raw':!![],'where':{'id':_0x3d0a52[_0x3de8('0x3e')]['id']}},_0x54c0d3={};_0x54c0d3['model']=_[_0x3de8('0x2b')](db[_0x3de8('0x3a')][_0x3de8('0x3f')]);_0x54c0d3['query']=_[_0x3de8('0x2b')](_0x3d0a52['query']);_0x54c0d3['filters']=_[_0x3de8('0x2d')](_0x54c0d3['model'],_0x54c0d3['query']);_0x2c3e32[_0x3de8('0x2f')]=_['intersection'](_0x54c0d3[_0x3de8('0x2a')],qs['fields'](_0x3d0a52[_0x3de8('0x2e')][_0x3de8('0x30')]));_0x2c3e32[_0x3de8('0x2f')]=_0x2c3e32[_0x3de8('0x2f')][_0x3de8('0x31')]?_0x2c3e32[_0x3de8('0x2f')]:_0x54c0d3['model'];if(_0x3d0a52[_0x3de8('0x2e')][_0x3de8('0x40')]){_0x2c3e32[_0x3de8('0x3b')]=[{'all':!![]}];}_0x2c3e32=_[_0x3de8('0x37')]({},_0x2c3e32,_0x3d0a52[_0x3de8('0x39')]);return db[_0x3de8('0x3a')][_0x3de8('0x41')](_0x2c3e32)[_0x3de8('0x23')](handleEntityNotFound(_0x3b2043,null))[_0x3de8('0x23')](respondWithResult(_0x3b2043,null))['catch'](handleError(_0x3b2043,null));};exports[_0x3de8('0x42')]=function(_0xe10284,_0x53837b){return db[_0x3de8('0x3a')][_0x3de8('0x42')](_0xe10284[_0x3de8('0x43')],{})[_0x3de8('0x23')](respondWithResult(_0x53837b,0xc9))['catch'](handleError(_0x53837b,null));};exports[_0x3de8('0x44')]=function(_0xc7d16,_0x13b1f0){if(_0xc7d16['body']['id']){delete _0xc7d16[_0x3de8('0x43')]['id'];}return db[_0x3de8('0x3a')][_0x3de8('0x41')]({'where':{'id':_0xc7d16[_0x3de8('0x3e')]['id']}})[_0x3de8('0x23')](handleEntityNotFound(_0x13b1f0,null))['then'](saveUpdates(_0xc7d16[_0x3de8('0x43')],null))[_0x3de8('0x23')](respondWithResult(_0x13b1f0,null))[_0x3de8('0x3d')](handleError(_0x13b1f0,null));};exports['destroy']=function(_0x5e2108,_0x2261ec){return db[_0x3de8('0x3a')][_0x3de8('0x41')]({'where':{'id':_0x5e2108[_0x3de8('0x3e')]['id']}})[_0x3de8('0x23')](handleEntityNotFound(_0x2261ec,null))[_0x3de8('0x23')](removeEntity(_0x2261ec,null))[_0x3de8('0x3d')](handleError(_0x2261ec,null));}; \ No newline at end of file +var _0x4f6c=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','fields','length','catch','create','body','params','find','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xb507e2,_0x20102a){var _0x119105=function(_0x5ce76e){while(--_0x5ce76e){_0xb507e2['push'](_0xb507e2['shift']());}};_0x119105(++_0x20102a);}(_0x4f6c,0xd1));var _0xc4f6=function(_0x4bda2d,_0x2d7268){_0x4bda2d=_0x4bda2d-0x0;var _0x25960c=_0x4f6c[_0x4bda2d];return _0x25960c;};'use strict';var emlformat=require(_0xc4f6('0x0'));var rimraf=require(_0xc4f6('0x1'));var zipdir=require(_0xc4f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4f6('0x3'));var moment=require('moment');var BPromise=require(_0xc4f6('0x4'));var Mustache=require('mustache');var util=require(_0xc4f6('0x5'));var path=require(_0xc4f6('0x6'));var sox=require(_0xc4f6('0x7'));var csv=require(_0xc4f6('0x8'));var ejs=require(_0xc4f6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4f6('0xa'));var _=require(_0xc4f6('0xb'));var squel=require(_0xc4f6('0xc'));var crypto=require(_0xc4f6('0xd'));var jsforce=require(_0xc4f6('0xe'));var deskjs=require(_0xc4f6('0xf'));var toCsv=require(_0xc4f6('0x8'));var querystring=require(_0xc4f6('0x10'));var Papa=require(_0xc4f6('0x11'));var Redis=require(_0xc4f6('0x12'));var authService=require(_0xc4f6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc4f6('0x14'));var hardwareService=require(_0xc4f6('0x15'));var logger=require(_0xc4f6('0x16'))(_0xc4f6('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4f6('0x18'));var db=require(_0xc4f6('0x19'))['db'];function respondWithStatusCode(_0xad2695,_0x385de6){_0x385de6=_0x385de6||0xcc;return function(_0x15827e){if(_0x15827e){return _0xad2695[_0xc4f6('0x1a')](_0x385de6);}return _0xad2695[_0xc4f6('0x1b')](_0x385de6)[_0xc4f6('0x1c')]();};}function respondWithResult(_0x3d30d0,_0x1b72ea){_0x1b72ea=_0x1b72ea||0xc8;return function(_0x63ede7){if(_0x63ede7){return _0x3d30d0[_0xc4f6('0x1b')](_0x1b72ea)['json'](_0x63ede7);}};}function respondWithFilteredResult(_0x5807e3,_0x5bdf2f){return function(_0x4f0027){if(_0x4f0027){var _0x2cd1b5=typeof _0x5bdf2f[_0xc4f6('0x1d')]===_0xc4f6('0x1e')&&typeof _0x5bdf2f[_0xc4f6('0x1f')]==='undefined';var _0x5bee39=_0x4f0027[_0xc4f6('0x20')];var _0x17352e=_0x2cd1b5?0x0:_0x5bdf2f[_0xc4f6('0x1d')];var _0x116767=_0x2cd1b5?_0x4f0027['count']:_0x5bdf2f['offset']+_0x5bdf2f[_0xc4f6('0x1f')];var _0x47fefd;if(_0x116767>=_0x5bee39){_0x116767=_0x5bee39;_0x47fefd=0xc8;}else{_0x47fefd=0xce;}_0x5807e3[_0xc4f6('0x1b')](_0x47fefd);return _0x5807e3['set'](_0xc4f6('0x21'),_0x17352e+'-'+_0x116767+'/'+_0x5bee39)['json'](_0x4f0027);}return null;};}function patchUpdates(_0x3d32be){return function(_0x5edcc5){try{jsonpatch['apply'](_0x5edcc5,_0x3d32be,!![]);}catch(_0x2b9237){return BPromise['reject'](_0x2b9237);}return _0x5edcc5[_0xc4f6('0x22')]();};}function saveUpdates(_0x1d079c,_0x1381be){return function(_0x16c103){if(_0x16c103){return _0x16c103[_0xc4f6('0x23')](_0x1d079c)[_0xc4f6('0x24')](function(_0x4f3548){return _0x4f3548;});}return null;};}function removeEntity(_0x608ee3,_0x38b056){return function(_0x3ff9c3){if(_0x3ff9c3){return _0x3ff9c3[_0xc4f6('0x25')]()['then'](function(){_0x608ee3['status'](0xcc)[_0xc4f6('0x1c')]();});}};}function handleEntityNotFound(_0x5c28f9,_0x59850b){return function(_0x142463){if(!_0x142463){_0x5c28f9[_0xc4f6('0x1a')](0x194);}return _0x142463;};}function handleError(_0x50d0b0,_0x290193){_0x290193=_0x290193||0x1f4;return function(_0x3196d5){logger[_0xc4f6('0x26')](_0x3196d5[_0xc4f6('0x27')]);if(_0x3196d5[_0xc4f6('0x28')]){delete _0x3196d5['name'];}_0x50d0b0[_0xc4f6('0x1b')](_0x290193)[_0xc4f6('0x29')](_0x3196d5);};}exports['index']=function(_0x27bcc6,_0x2366cf){var _0x5396ba={},_0x3ebff6={},_0x4b1869={'count':0x0,'rows':[]};var _0x34527b=_[_0xc4f6('0x2a')](db[_0xc4f6('0x2b')][_0xc4f6('0x2c')],function(_0x21d223){return{'name':_0x21d223[_0xc4f6('0x2d')],'type':_0x21d223[_0xc4f6('0x2e')][_0xc4f6('0x2f')]};});_0x3ebff6[_0xc4f6('0x30')]=_['map'](_0x34527b,_0xc4f6('0x28'));_0x3ebff6[_0xc4f6('0x31')]=_['keys'](_0x27bcc6[_0xc4f6('0x31')]);_0x3ebff6['filters']=_[_0xc4f6('0x32')](_0x3ebff6[_0xc4f6('0x30')],_0x3ebff6[_0xc4f6('0x31')]);_0x5396ba[_0xc4f6('0x33')]=_[_0xc4f6('0x32')](_0x3ebff6[_0xc4f6('0x30')],qs['fields'](_0x27bcc6[_0xc4f6('0x31')]['fields']));_0x5396ba[_0xc4f6('0x33')]=_0x5396ba[_0xc4f6('0x33')]['length']?_0x5396ba[_0xc4f6('0x33')]:_0x3ebff6['model'];if(!_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x34')](_0xc4f6('0x35'))){_0x5396ba['limit']=qs[_0xc4f6('0x1f')](_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x1f')]);_0x5396ba[_0xc4f6('0x1d')]=qs[_0xc4f6('0x1d')](_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x1d')]);}_0x5396ba[_0xc4f6('0x36')]=qs[_0xc4f6('0x37')](_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x37')]);_0x5396ba[_0xc4f6('0x38')]=qs[_0xc4f6('0x39')](_[_0xc4f6('0x3a')](_0x27bcc6['query'],_0x3ebff6[_0xc4f6('0x39')]),_0x34527b);if(_0x27bcc6[_0xc4f6('0x31')]['filter']){_0x5396ba[_0xc4f6('0x38')]=_[_0xc4f6('0x3b')](_0x5396ba[_0xc4f6('0x38')],{'$or':_[_0xc4f6('0x2a')](_0x34527b,function(_0x3c7dfa){if(_0x3c7dfa[_0xc4f6('0x2e')]!==_0xc4f6('0x3c')){var _0x11c26f={};_0x11c26f[_0x3c7dfa['name']]={'$like':'%'+_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x3d')]+'%'};return _0x11c26f;}})});}_0x5396ba=_['merge']({},_0x5396ba,_0x27bcc6[_0xc4f6('0x3e')]);var _0x142010={'where':_0x5396ba[_0xc4f6('0x38')]};return db['FreshsalesField'][_0xc4f6('0x20')](_0x142010)[_0xc4f6('0x24')](function(_0x140bd7){_0x4b1869[_0xc4f6('0x20')]=_0x140bd7;if(_0x27bcc6[_0xc4f6('0x31')][_0xc4f6('0x3f')]){_0x5396ba[_0xc4f6('0x40')]=[{'all':!![]}];}return db[_0xc4f6('0x2b')][_0xc4f6('0x41')](_0x5396ba);})[_0xc4f6('0x24')](function(_0x30c670){_0x4b1869[_0xc4f6('0x42')]=_0x30c670;return _0x4b1869;})[_0xc4f6('0x24')](respondWithFilteredResult(_0x2366cf,_0x5396ba))['catch'](handleError(_0x2366cf,null));};exports[_0xc4f6('0x43')]=function(_0x8124d2,_0x247772){var _0x5c9efd={'raw':!![],'where':{'id':_0x8124d2['params']['id']}},_0x1cec36={};_0x1cec36['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x1cec36[_0xc4f6('0x31')]=_[_0xc4f6('0x44')](_0x8124d2[_0xc4f6('0x31')]);_0x1cec36[_0xc4f6('0x39')]=_[_0xc4f6('0x32')](_0x1cec36[_0xc4f6('0x30')],_0x1cec36[_0xc4f6('0x31')]);_0x5c9efd[_0xc4f6('0x33')]=_[_0xc4f6('0x32')](_0x1cec36[_0xc4f6('0x30')],qs[_0xc4f6('0x45')](_0x8124d2[_0xc4f6('0x31')][_0xc4f6('0x45')]));_0x5c9efd[_0xc4f6('0x33')]=_0x5c9efd[_0xc4f6('0x33')][_0xc4f6('0x46')]?_0x5c9efd[_0xc4f6('0x33')]:_0x1cec36[_0xc4f6('0x30')];if(_0x8124d2[_0xc4f6('0x31')][_0xc4f6('0x3f')]){_0x5c9efd['include']=[{'all':!![]}];}_0x5c9efd=_[_0xc4f6('0x3b')]({},_0x5c9efd,_0x8124d2[_0xc4f6('0x3e')]);return db[_0xc4f6('0x2b')]['find'](_0x5c9efd)[_0xc4f6('0x24')](handleEntityNotFound(_0x247772,null))[_0xc4f6('0x24')](respondWithResult(_0x247772,null))[_0xc4f6('0x47')](handleError(_0x247772,null));};exports[_0xc4f6('0x48')]=function(_0x57efa3,_0x4f75d2){return db[_0xc4f6('0x2b')]['create'](_0x57efa3[_0xc4f6('0x49')],{})[_0xc4f6('0x24')](respondWithResult(_0x4f75d2,0xc9))[_0xc4f6('0x47')](handleError(_0x4f75d2,null));};exports[_0xc4f6('0x23')]=function(_0x4350f8,_0xa88303){if(_0x4350f8['body']['id']){delete _0x4350f8[_0xc4f6('0x49')]['id'];}return db[_0xc4f6('0x2b')]['find']({'where':{'id':_0x4350f8[_0xc4f6('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa88303,null))[_0xc4f6('0x24')](saveUpdates(_0x4350f8['body'],null))[_0xc4f6('0x24')](respondWithResult(_0xa88303,null))[_0xc4f6('0x47')](handleError(_0xa88303,null));};exports[_0xc4f6('0x25')]=function(_0x5c14ed,_0x5f4f1d){return db[_0xc4f6('0x2b')][_0xc4f6('0x4b')]({'where':{'id':_0x5c14ed[_0xc4f6('0x4a')]['id']}})[_0xc4f6('0x24')](handleEntityNotFound(_0x5f4f1d,null))['then'](removeEntity(_0x5f4f1d,null))[_0xc4f6('0x47')](handleError(_0x5f4f1d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index a2e9c25..17e8df3 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 _0x50a5=['FieldId','lodash','util','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x58a440,_0x2b62a9){var _0x40ff4b=function(_0x56edf5){while(--_0x56edf5){_0x58a440['push'](_0x58a440['shift']());}};_0x40ff4b(++_0x2b62a9);}(_0x50a5,0xd1));var _0x550a=function(_0xa6f336,_0x1a06d9){_0xa6f336=_0xa6f336-0x0;var _0x56aafd=_0x50a5[_0xa6f336];return _0x56aafd;};'use strict';var _=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x550a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var attributes=require(_0x550a('0x5'));module[_0x550a('0x6')]=function(_0x402f66,_0x3b3c29){return _0x402f66[_0x550a('0x7')](_0x550a('0x8'),attributes,{'tableName':_0x550a('0x9'),'paranoid':![],'indexes':[{'name':_0x550a('0xa'),'fields':[_0x550a('0xb'),_0x550a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d7=['../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','util','bluebird','request-promise','path'];(function(_0xe4f2a2,_0x412d97){var _0x30905f=function(_0xea5a70){while(--_0xea5a70){_0xe4f2a2['push'](_0xe4f2a2['shift']());}};_0x30905f(++_0x412d97);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x30a956,_0x11222e){_0x30a956=_0x30a956-0x0;var _0x2ac17d=_0xe1d7[_0x30a956];return _0x2ac17d;};'use strict';var _=require('lodash');var util=require(_0x7e1d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7e1d('0x1'));var rp=require(_0x7e1d('0x2'));var fs=require('fs');var path=require(_0x7e1d('0x3'));var rimraf=require('rimraf');var config=require(_0x7e1d('0x4'));var attributes=require(_0x7e1d('0x5'));module[_0x7e1d('0x6')]=function(_0x4e9e2d,_0x467d6e){return _0x4e9e2d['define'](_0x7e1d('0x7'),attributes,{'tableName':_0x7e1d('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x7e1d('0x9'),_0x7e1d('0xa')],'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 5cf3ea0..753527e 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 _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xacf4,0xe7));var _0x4acf=function(_0x28259f,_0x4f7913){_0x28259f=_0x28259f-0x0;var _0x3d4d2b=_0xacf4[_0x28259f];return _0x3d4d2b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5beec9,_0x5551de){var _0x20d488=function(_0xde0c66){while(--_0xde0c66){_0x5beec9['push'](_0x5beec9['shift']());}};_0x20d488(++_0x5551de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc4aa[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 2385d74..6fb6597 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4429b8,_0x3ddb75){var _0x22b43d=function(_0x195d8a){while(--_0x195d8a){_0x4429b8['push'](_0x4429b8['shift']());}};_0x22b43d(++_0x3ddb75);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x40d112,_0x18f3dc){var _0x1450f2=function(_0x7c8b){while(--_0x7c8b){_0x40d112['push'](_0x40d112['shift']());}};_0x1450f2(++_0x18f3dc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 02deb37..df1b38d 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 _0xb0b3=['exports','STRING','integrationTab','sequelize'];(function(_0x4abda0,_0xfbd7d){var _0x5de5a5=function(_0xbb0894){while(--_0xbb0894){_0x4abda0['push'](_0x4abda0['shift']());}};_0x5de5a5(++_0xfbd7d);}(_0xb0b3,0x1bf));var _0x3b0b=function(_0x41d0c4,_0x18f17f){_0x41d0c4=_0x41d0c4-0x0;var _0x213b7d=_0xb0b3[_0x41d0c4];return _0x213b7d;};'use strict';var Sequelize=require(_0x3b0b('0x0'));module[_0x3b0b('0x1')]={'name':{'type':Sequelize[_0x3b0b('0x2')]},'description':{'type':Sequelize[_0x3b0b('0x2')]},'username':{'type':Sequelize[_0x3b0b('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3b0b('0x2')]},'password':{'type':Sequelize[_0x3b0b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3b0b('0x2')]},'securityToken':{'type':Sequelize[_0x3b0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3b0b('0x3'),'newTab'),'defaultValue':_0x3b0b('0x3')}}; \ No newline at end of file +var _0x4e39=['STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x1bbb5a,_0x186179){var _0x4e27af=function(_0x3aa53d){while(--_0x3aa53d){_0x1bbb5a['push'](_0x1bbb5a['shift']());}};_0x4e27af(++_0x186179);}(_0x4e39,0x95));var _0x94e3=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x4e39[_0x1fc4e2];return _0x2ba184;};'use strict';var Sequelize=require(_0x94e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x94e3('0x1')]},'username':{'type':Sequelize[_0x94e3('0x1')],'unique':_0x94e3('0x2')},'remoteUri':{'type':Sequelize[_0x94e3('0x1')]},'password':{'type':Sequelize[_0x94e3('0x1')]},'clientId':{'type':Sequelize[_0x94e3('0x1')]},'clientSecret':{'type':Sequelize[_0x94e3('0x1')]},'securityToken':{'type':Sequelize[_0x94e3('0x1')]},'serverUrl':{'type':Sequelize[_0x94e3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x94e3('0x3')](_0x94e3('0x4'),_0x94e3('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 9b2f3a9..de3baf2 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 _0x4950=['model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','SalesforceAccount','includeAll','catch','show','params','fields','options','create','body','find','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Subjects','getFields','findOne','remoteUri','clientSecret','password','slice','substring','lastIndexOf','Connection','clientId','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','Subject','string','int','picklist','boolean','remove','includes','label','picklistValues','value','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','save','update','then','destroy','end','sendStatus','error','stack','name','rawAttributes','fieldName','key'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4950,0x12f));var _0x0495=function(_0x458832,_0x10b8cf){_0x458832=_0x458832-0x0;var _0x56f6c5=_0x4950[_0x458832];return _0x56f6c5;};'use strict';var emlformat=require(_0x0495('0x0'));var rimraf=require(_0x0495('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0495('0x2'));var BPromise=require(_0x0495('0x3'));var Mustache=require('mustache');var util=require(_0x0495('0x4'));var path=require(_0x0495('0x5'));var sox=require(_0x0495('0x6'));var csv=require(_0x0495('0x7'));var ejs=require(_0x0495('0x8'));var fs=require('fs');var fs_extra=require(_0x0495('0x9'));var _=require(_0x0495('0xa'));var squel=require(_0x0495('0xb'));var crypto=require(_0x0495('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0495('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0495('0xe'));var authService=require(_0x0495('0xf'));var qs=require(_0x0495('0x10'));var as=require(_0x0495('0x11'));var hardwareService=require(_0x0495('0x12'));var logger=require(_0x0495('0x13'))(_0x0495('0x14'));var utils=require(_0x0495('0x15'));var config=require(_0x0495('0x16'));var licenseUtil=require(_0x0495('0x17'));var db=require(_0x0495('0x18'))['db'];var integrations=require(_0x0495('0x19'));function respondWithStatusCode(_0xe5812,_0x3945ea){_0x3945ea=_0x3945ea||0xcc;return function(_0x4d2539){if(_0x4d2539){return _0xe5812['sendStatus'](_0x3945ea);}return _0xe5812[_0x0495('0x1a')](_0x3945ea)['end']();};}function respondWithResult(_0x11d7d7,_0x592fac){_0x592fac=_0x592fac||0xc8;return function(_0x47ad99){if(_0x47ad99){return _0x11d7d7[_0x0495('0x1a')](_0x592fac)[_0x0495('0x1b')](_0x47ad99);}};}function respondWithFilteredResult(_0x4dd12c,_0x478391){return function(_0x199467){if(_0x199467){var _0xf99cfc=typeof _0x478391[_0x0495('0x1c')]==='undefined'&&typeof _0x478391[_0x0495('0x1d')]===_0x0495('0x1e');var _0x4ea8ef=_0x199467[_0x0495('0x1f')];var _0x2dc2c9=_0xf99cfc?0x0:_0x478391[_0x0495('0x1c')];var _0x3e406c=_0xf99cfc?_0x199467['count']:_0x478391[_0x0495('0x1c')]+_0x478391[_0x0495('0x1d')];var _0x13c64c;if(_0x3e406c>=_0x4ea8ef){_0x3e406c=_0x4ea8ef;_0x13c64c=0xc8;}else{_0x13c64c=0xce;}_0x4dd12c[_0x0495('0x1a')](_0x13c64c);return _0x4dd12c[_0x0495('0x20')]('Content-Range',_0x2dc2c9+'-'+_0x3e406c+'/'+_0x4ea8ef)[_0x0495('0x1b')](_0x199467);}return null;};}function patchUpdates(_0x54f43b){return function(_0x165e29){try{jsonpatch['apply'](_0x165e29,_0x54f43b,!![]);}catch(_0x1442e9){return BPromise['reject'](_0x1442e9);}return _0x165e29[_0x0495('0x21')]();};}function saveUpdates(_0x57366b,_0x5d2738){return function(_0x3aa3cb){if(_0x3aa3cb){return _0x3aa3cb[_0x0495('0x22')](_0x57366b)[_0x0495('0x23')](function(_0x3bfe7f){return _0x3bfe7f;});}return null;};}function removeEntity(_0x33be6f,_0x3d3d47){return function(_0x50073e){if(_0x50073e){return _0x50073e[_0x0495('0x24')]()[_0x0495('0x23')](function(){_0x33be6f[_0x0495('0x1a')](0xcc)[_0x0495('0x25')]();});}};}function handleEntityNotFound(_0x30c045,_0x16f7bd){return function(_0xccfbea){if(!_0xccfbea){_0x30c045[_0x0495('0x26')](0x194);}return _0xccfbea;};}function handleError(_0x3de204,_0x437d59){_0x437d59=_0x437d59||0x1f4;return function(_0x116d24){logger[_0x0495('0x27')](_0x116d24[_0x0495('0x28')]);if(_0x116d24[_0x0495('0x29')]){delete _0x116d24['name'];}_0x3de204[_0x0495('0x1a')](_0x437d59)['send'](_0x116d24);};}exports['index']=function(_0x50ee6d,_0x40f05d){var _0x55fd7b={},_0x214355={},_0xad9933={'count':0x0,'rows':[]};var _0x5b2d0c=_['map'](db['SalesforceAccount'][_0x0495('0x2a')],function(_0x470c49){return{'name':_0x470c49[_0x0495('0x2b')],'type':_0x470c49['type'][_0x0495('0x2c')]};});_0x214355[_0x0495('0x2d')]=_[_0x0495('0x2e')](_0x5b2d0c,_0x0495('0x29'));_0x214355[_0x0495('0x2f')]=_[_0x0495('0x30')](_0x50ee6d['query']);_0x214355[_0x0495('0x31')]=_[_0x0495('0x32')](_0x214355[_0x0495('0x2d')],_0x214355[_0x0495('0x2f')]);_0x55fd7b[_0x0495('0x33')]=_[_0x0495('0x32')](_0x214355[_0x0495('0x2d')],qs['fields'](_0x50ee6d['query']['fields']));_0x55fd7b['attributes']=_0x55fd7b[_0x0495('0x33')][_0x0495('0x34')]?_0x55fd7b[_0x0495('0x33')]:_0x214355[_0x0495('0x2d')];if(!_0x50ee6d[_0x0495('0x2f')][_0x0495('0x35')](_0x0495('0x36'))){_0x55fd7b[_0x0495('0x1d')]=qs[_0x0495('0x1d')](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x1d')]);_0x55fd7b[_0x0495('0x1c')]=qs[_0x0495('0x1c')](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x1c')]);}_0x55fd7b[_0x0495('0x37')]=qs['sort'](_0x50ee6d[_0x0495('0x2f')][_0x0495('0x38')]);_0x55fd7b[_0x0495('0x39')]=qs[_0x0495('0x31')](_[_0x0495('0x3a')](_0x50ee6d[_0x0495('0x2f')],_0x214355[_0x0495('0x31')]),_0x5b2d0c);if(_0x50ee6d['query'][_0x0495('0x3b')]){_0x55fd7b[_0x0495('0x39')]=_['merge'](_0x55fd7b[_0x0495('0x39')],{'$or':_[_0x0495('0x2e')](_0x5b2d0c,function(_0xfdc39d){if(_0xfdc39d[_0x0495('0x3c')]!=='VIRTUAL'){var _0x2eec2b={};_0x2eec2b[_0xfdc39d[_0x0495('0x29')]]={'$like':'%'+_0x50ee6d[_0x0495('0x2f')]['filter']+'%'};return _0x2eec2b;}})});}_0x55fd7b=_[_0x0495('0x3d')]({},_0x55fd7b,_0x50ee6d['options']);var _0x8b40ed={'where':_0x55fd7b[_0x0495('0x39')]};return db[_0x0495('0x3e')]['count'](_0x8b40ed)['then'](function(_0x3517f9){_0xad9933['count']=_0x3517f9;if(_0x50ee6d[_0x0495('0x2f')][_0x0495('0x3f')]){_0x55fd7b['include']=[{'all':!![]}];}return db[_0x0495('0x3e')]['findAll'](_0x55fd7b);})['then'](function(_0x391c4d){_0xad9933['rows']=_0x391c4d;return _0xad9933;})[_0x0495('0x23')](respondWithFilteredResult(_0x40f05d,_0x55fd7b))[_0x0495('0x40')](handleError(_0x40f05d,null));};exports[_0x0495('0x41')]=function(_0x138938,_0x285e9d){var _0x40f607={'raw':![],'where':{'id':_0x138938[_0x0495('0x42')]['id']}},_0x59fc7d={};_0x59fc7d[_0x0495('0x2d')]=_['keys'](db['SalesforceAccount'][_0x0495('0x2a')]);_0x59fc7d['query']=_[_0x0495('0x30')](_0x138938['query']);_0x59fc7d['filters']=_[_0x0495('0x32')](_0x59fc7d[_0x0495('0x2d')],_0x59fc7d[_0x0495('0x2f')]);_0x40f607[_0x0495('0x33')]=_[_0x0495('0x32')](_0x59fc7d[_0x0495('0x2d')],qs[_0x0495('0x43')](_0x138938['query'][_0x0495('0x43')]));_0x40f607[_0x0495('0x33')]=_0x40f607[_0x0495('0x33')]['length']?_0x40f607['attributes']:_0x59fc7d[_0x0495('0x2d')];if(_0x138938['query'][_0x0495('0x3f')]){_0x40f607['include']=[{'all':!![]}];}_0x40f607=_[_0x0495('0x3d')]({},_0x40f607,_0x138938[_0x0495('0x44')]);return db[_0x0495('0x3e')]['find'](_0x40f607)[_0x0495('0x23')](handleEntityNotFound(_0x285e9d,null))[_0x0495('0x23')](respondWithResult(_0x285e9d,null))[_0x0495('0x40')](handleError(_0x285e9d,null));};exports[_0x0495('0x45')]=function(_0x572fcd,_0x274b70){return db[_0x0495('0x3e')][_0x0495('0x45')](_0x572fcd['body'],{})[_0x0495('0x23')](respondWithResult(_0x274b70,0xc9))['catch'](handleError(_0x274b70,null));};exports[_0x0495('0x22')]=function(_0x2b6050,_0x11ed92){if(_0x2b6050[_0x0495('0x46')]['id']){delete _0x2b6050['body']['id'];}return db[_0x0495('0x3e')][_0x0495('0x47')]({'where':{'id':_0x2b6050['params']['id']}})[_0x0495('0x23')](handleEntityNotFound(_0x11ed92,null))['then'](saveUpdates(_0x2b6050[_0x0495('0x46')],null))[_0x0495('0x23')](respondWithResult(_0x11ed92,null))[_0x0495('0x40')](handleError(_0x11ed92,null));};exports[_0x0495('0x24')]=function(_0x56dd5b,_0xe117fd){return db[_0x0495('0x3e')]['find']({'where':{'id':_0x56dd5b[_0x0495('0x42')]['id']}})[_0x0495('0x23')](handleEntityNotFound(_0xe117fd,null))[_0x0495('0x23')](removeEntity(_0xe117fd,null))[_0x0495('0x40')](handleError(_0xe117fd,null));};exports[_0x0495('0x48')]=function(_0x128439,_0x36492f,_0x1bc0be){var _0x41e504={};var _0x134fc9={};var _0x1c1e1e;var _0x5c174b;return db[_0x0495('0x3e')]['findOne']({'where':{'id':_0x128439[_0x0495('0x42')]['id']}})[_0x0495('0x23')](handleEntityNotFound(_0x36492f,null))['then'](function(_0x7fa088){if(_0x7fa088){_0x1c1e1e=_0x7fa088;_0x134fc9[_0x0495('0x2d')]=_[_0x0495('0x30')](db['SalesforceConfiguration'][_0x0495('0x2a')]);_0x134fc9[_0x0495('0x2f')]=_[_0x0495('0x30')](_0x128439[_0x0495('0x2f')]);_0x134fc9[_0x0495('0x31')]=_[_0x0495('0x32')](_0x134fc9[_0x0495('0x2d')],_0x134fc9[_0x0495('0x2f')]);_0x41e504[_0x0495('0x33')]=_['intersection'](_0x134fc9['model'],qs[_0x0495('0x43')](_0x128439[_0x0495('0x2f')][_0x0495('0x43')]));_0x41e504['attributes']=_0x41e504[_0x0495('0x33')][_0x0495('0x34')]?_0x41e504[_0x0495('0x33')]:_0x134fc9[_0x0495('0x2d')];_0x41e504[_0x0495('0x37')]=qs[_0x0495('0x38')](_0x128439[_0x0495('0x2f')][_0x0495('0x38')]);_0x41e504['where']=qs[_0x0495('0x31')](_[_0x0495('0x3a')](_0x128439[_0x0495('0x2f')],_0x134fc9['filters']));if(_0x128439[_0x0495('0x2f')][_0x0495('0x3b')]){_0x41e504['where']=_[_0x0495('0x3d')](_0x41e504[_0x0495('0x39')],{'$or':_[_0x0495('0x2e')](_0x41e504[_0x0495('0x33')],function(_0x111379){var _0x1a6410={};_0x1a6410[_0x111379]={'$like':'%'+_0x128439[_0x0495('0x2f')][_0x0495('0x3b')]+'%'};return _0x1a6410;})});}_0x41e504=_[_0x0495('0x3d')]({},_0x41e504,_0x128439['options']);return _0x1c1e1e[_0x0495('0x48')](_0x41e504);}})['then'](function(_0x45059a){if(_0x45059a){_0x5c174b=_0x45059a[_0x0495('0x34')];if(!_0x128439[_0x0495('0x2f')][_0x0495('0x35')](_0x0495('0x36'))){_0x41e504[_0x0495('0x1d')]=qs[_0x0495('0x1d')](_0x128439[_0x0495('0x2f')]['limit']);_0x41e504['offset']=qs['offset'](_0x128439['query'][_0x0495('0x1c')]);}return _0x1c1e1e['getConfigurations'](_0x41e504);}})['then'](function(_0x474ba4){if(_0x474ba4){return _0x474ba4?{'count':_0x5c174b,'rows':_0x474ba4}:null;}})[_0x0495('0x23')](respondWithResult(_0x36492f,null))['catch'](handleError(_0x36492f,null));};exports[_0x0495('0x49')]=function(_0x490144,_0xf37682,_0x223cf6){if(_0x490144[_0x0495('0x46')]['id']){delete _0x490144['body']['id'];}return db[_0x0495('0x3e')]['findOne']({'where':{'id':_0x490144['params']['id']}})[_0x0495('0x23')](handleEntityNotFound(_0xf37682,null))[_0x0495('0x23')](function(_0x48e8fb){if(_0x48e8fb){_0x490144[_0x0495('0x46')][_0x0495('0x4a')]=_0x48e8fb['id'];_0x490144[_0x0495('0x46')]['Subjects']=integrations[_0x0495('0x4b')](_0x490144[_0x0495('0x46')][_0x0495('0x4c')],_0x490144[_0x0495('0x46')][_0x0495('0x3c')]);_0x490144['body'][_0x0495('0x4d')]=integrations[_0x0495('0x4e')](_0x490144[_0x0495('0x46')]['channel'],_0x490144['body']['type']);return db[_0x0495('0x4f')][_0x0495('0x45')](_0x490144['body'],{'include':[{'model':db[_0x0495('0x50')],'as':_0x0495('0x51')},{'model':db[_0x0495('0x50')],'as':_0x0495('0x4d')}]});}return null;})[_0x0495('0x23')](respondWithResult(_0xf37682,null))['catch'](handleError(_0xf37682,null));};exports[_0x0495('0x52')]=function(_0x146fc7,_0x19e1a0,_0x4503e6){var _0x889b4;var _0x9e6b45='';var _0x12ae44='Task';return db[_0x0495('0x3e')][_0x0495('0x53')]({'where':{'id':_0x146fc7[_0x0495('0x42')]['id']},'attributes':['id',_0x0495('0x54'),'clientId',_0x0495('0x55'),'username',_0x0495('0x56'),'securityToken']})[_0x0495('0x23')](handleEntityNotFound(_0x19e1a0,null))[_0x0495('0x23')](function(_0x164027){if(_0x164027){_0x9e6b45=_0x164027['remoteUri'];var _0x5cd25f=_0x9e6b45[_0x0495('0x57')](-0x1);if(_0x5cd25f==='/'){_0x9e6b45=_0x9e6b45[_0x0495('0x58')](0x0,_0x9e6b45[_0x0495('0x59')](_0x5cd25f));}_0x889b4=new jsforce[(_0x0495('0x5a'))]({'oauth2':{'loginUrl':_0x9e6b45,'clientId':_0x164027[_0x0495('0x5b')],'clientSecret':_0x164027[_0x0495('0x55')]}});return _0x889b4['login'](_0x164027['username'],_0x164027[_0x0495('0x56')][_0x0495('0x5c')](_0x164027[_0x0495('0x5d')]));}})[_0x0495('0x23')](function(_0x3cc9c5){if(_0x3cc9c5){if(!_[_0x0495('0x5e')](_0x146fc7[_0x0495('0x2f')][_0x0495('0x5f')])){_0x12ae44=_0x146fc7[_0x0495('0x2f')]['ticketType'];}return _0x889b4[_0x0495('0x60')](_0x12ae44)[_0x0495('0x61')]();}})[_0x0495('0x23')](function(_0x1efc3c){var _0x2d1e0f=[_0x0495('0x62'),'ActivityDate','IsReminderSet','IsRecurrence',_0x0495('0x63'),'Description'];var _0x4b0025=[_0x0495('0x64'),_0x0495('0x65'),_0x0495('0x66'),_0x0495('0x67'),'email','textarea','phone'];if(_0x1efc3c){_[_0x0495('0x68')](_0x1efc3c[_0x0495('0x43')],function(_0x5c55cb){return _0x2d1e0f[_0x0495('0x69')](_0x5c55cb[_0x0495('0x29')])||!_0x4b0025[_0x0495('0x69')](_0x5c55cb['type']);});return{'count':_0x1efc3c[_0x0495('0x43')][_0x0495('0x34')],'rows':_[_0x0495('0x2e')](_0x1efc3c[_0x0495('0x43')],function(_0x4c9d0e){return{'id':_0x4c9d0e[_0x0495('0x29')],'name':_0x4c9d0e[_0x0495('0x6a')],'custom':_0x4c9d0e['custom'],'options':_0x4c9d0e['picklistValues']['length']>0x0?_[_0x0495('0x2e')](_0x4c9d0e[_0x0495('0x6b')],function(_0x4fa208){return{'name':_0x4fa208[_0x0495('0x6a')],'value':_0x4fa208[_0x0495('0x6c')]};}):_0x4c9d0e[_0x0495('0x3c')]==_0x0495('0x67')?[{'name':'True','value':'true'},{'name':_0x0495('0x6d'),'value':'false'}]:[]};})};}})[_0x0495('0x23')](respondWithResult(_0x19e1a0,null))['catch'](function(_0x224f58){var _0x196256=_0x146fc7[_0x0495('0x2f')][_0x0495('0x6e')]?0x1f4:_0x224f58[_0x0495('0x6f')]||0x1f4;logger[_0x0495('0x27')](_0x0495('0x70'),'getFields',_0x196256,JSON[_0x0495('0x71')](_0x224f58));delete _0x224f58[_0x0495('0x29')];if(_0x196256===0x191){_0x196256=0x190;}_0x19e1a0[_0x0495('0x1a')](_0x196256)[_0x0495('0x72')](_0x146fc7[_0x0495('0x2f')]['test']?{'message':_0x0495('0x73'),'statusCode':_0x224f58[_0x0495('0x6f')]}:_0x224f58);});}; \ No newline at end of file +var _0x03fc=['label','custom','picklistValues','value','True','true','False','test','statusCode','stringify','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','findOne','order','getConfigurations','hasOwnProperty','AccountId','Subjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','lastIndexOf','Connection','username','concat','ticketType','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','boolean','email','phone','remove','includes'];(function(_0x1b5324,_0x2bffcb){var _0x1bdc89=function(_0x4cd29e){while(--_0x4cd29e){_0x1b5324['push'](_0x1b5324['shift']());}};_0x1bdc89(++_0x2bffcb);}(_0x03fc,0x1e6));var _0xc03f=function(_0x10c778,_0x58ef9e){_0x10c778=_0x10c778-0x0;var _0x4e9fb2=_0x03fc[_0x10c778];return _0x4e9fb2;};'use strict';var emlformat=require(_0xc03f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc03f('0x1'));var rp=require('request-promise');var moment=require(_0xc03f('0x2'));var BPromise=require(_0xc03f('0x3'));var Mustache=require(_0xc03f('0x4'));var util=require(_0xc03f('0x5'));var path=require(_0xc03f('0x6'));var sox=require(_0xc03f('0x7'));var csv=require(_0xc03f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc03f('0x9'));var _=require(_0xc03f('0xa'));var squel=require('squel');var crypto=require(_0xc03f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc03f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc03f('0xd'));var Papa=require(_0xc03f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc03f('0xf'));var as=require(_0xc03f('0x10'));var hardwareService=require(_0xc03f('0x11'));var logger=require(_0xc03f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc03f('0x13'));var licenseUtil=require(_0xc03f('0x14'));var db=require(_0xc03f('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56fc8a,_0x33ef17){_0x33ef17=_0x33ef17||0xcc;return function(_0x4ee777){if(_0x4ee777){return _0x56fc8a['sendStatus'](_0x33ef17);}return _0x56fc8a[_0xc03f('0x16')](_0x33ef17)[_0xc03f('0x17')]();};}function respondWithResult(_0x55f9d4,_0x35a8b6){_0x35a8b6=_0x35a8b6||0xc8;return function(_0x413530){if(_0x413530){return _0x55f9d4[_0xc03f('0x16')](_0x35a8b6)['json'](_0x413530);}};}function respondWithFilteredResult(_0x217a54,_0x1bd58c){return function(_0x46e2c8){if(_0x46e2c8){var _0x3c4525=typeof _0x1bd58c[_0xc03f('0x18')]===_0xc03f('0x19')&&typeof _0x1bd58c[_0xc03f('0x1a')]===_0xc03f('0x19');var _0x5467c3=_0x46e2c8[_0xc03f('0x1b')];var _0x1520ac=_0x3c4525?0x0:_0x1bd58c[_0xc03f('0x18')];var _0x3066fe=_0x3c4525?_0x46e2c8['count']:_0x1bd58c['offset']+_0x1bd58c['limit'];var _0x923bdc;if(_0x3066fe>=_0x5467c3){_0x3066fe=_0x5467c3;_0x923bdc=0xc8;}else{_0x923bdc=0xce;}_0x217a54['status'](_0x923bdc);return _0x217a54[_0xc03f('0x1c')](_0xc03f('0x1d'),_0x1520ac+'-'+_0x3066fe+'/'+_0x5467c3)[_0xc03f('0x1e')](_0x46e2c8);}return null;};}function patchUpdates(_0x1ba93f){return function(_0x16adc2){try{jsonpatch['apply'](_0x16adc2,_0x1ba93f,!![]);}catch(_0x12b669){return BPromise[_0xc03f('0x1f')](_0x12b669);}return _0x16adc2[_0xc03f('0x20')]();};}function saveUpdates(_0xed2ac8,_0x45376c){return function(_0xd209c0){if(_0xd209c0){return _0xd209c0[_0xc03f('0x21')](_0xed2ac8)[_0xc03f('0x22')](function(_0x598a42){return _0x598a42;});}return null;};}function removeEntity(_0x17e966,_0x44e84c){return function(_0x52d610){if(_0x52d610){return _0x52d610[_0xc03f('0x23')]()[_0xc03f('0x22')](function(){_0x17e966[_0xc03f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e380,_0x4503cc){return function(_0x11a467){if(!_0x11a467){_0x13e380['sendStatus'](0x194);}return _0x11a467;};}function handleError(_0x102f52,_0x42375c){_0x42375c=_0x42375c||0x1f4;return function(_0x499681){logger[_0xc03f('0x24')](_0x499681[_0xc03f('0x25')]);if(_0x499681[_0xc03f('0x26')]){delete _0x499681[_0xc03f('0x26')];}_0x102f52['status'](_0x42375c)[_0xc03f('0x27')](_0x499681);};}exports[_0xc03f('0x28')]=function(_0x31a9a0,_0xeb3945){var _0x10e7c1={},_0x1ed332={},_0x2d036e={'count':0x0,'rows':[]};var _0x57e81d=_[_0xc03f('0x29')](db[_0xc03f('0x2a')][_0xc03f('0x2b')],function(_0x503205){return{'name':_0x503205[_0xc03f('0x2c')],'type':_0x503205[_0xc03f('0x2d')][_0xc03f('0x2e')]};});_0x1ed332[_0xc03f('0x2f')]=_[_0xc03f('0x29')](_0x57e81d,_0xc03f('0x26'));_0x1ed332[_0xc03f('0x30')]=_[_0xc03f('0x31')](_0x31a9a0[_0xc03f('0x30')]);_0x1ed332[_0xc03f('0x32')]=_['intersection'](_0x1ed332[_0xc03f('0x2f')],_0x1ed332['query']);_0x10e7c1[_0xc03f('0x33')]=_[_0xc03f('0x34')](_0x1ed332[_0xc03f('0x2f')],qs['fields'](_0x31a9a0[_0xc03f('0x30')][_0xc03f('0x35')]));_0x10e7c1[_0xc03f('0x33')]=_0x10e7c1[_0xc03f('0x33')][_0xc03f('0x36')]?_0x10e7c1['attributes']:_0x1ed332['model'];if(!_0x31a9a0[_0xc03f('0x30')]['hasOwnProperty'](_0xc03f('0x37'))){_0x10e7c1[_0xc03f('0x1a')]=qs[_0xc03f('0x1a')](_0x31a9a0['query']['limit']);_0x10e7c1['offset']=qs[_0xc03f('0x18')](_0x31a9a0['query'][_0xc03f('0x18')]);}_0x10e7c1['order']=qs[_0xc03f('0x38')](_0x31a9a0[_0xc03f('0x30')][_0xc03f('0x38')]);_0x10e7c1['where']=qs[_0xc03f('0x32')](_[_0xc03f('0x39')](_0x31a9a0['query'],_0x1ed332[_0xc03f('0x32')]),_0x57e81d);if(_0x31a9a0['query'][_0xc03f('0x3a')]){_0x10e7c1[_0xc03f('0x3b')]=_[_0xc03f('0x3c')](_0x10e7c1['where'],{'$or':_[_0xc03f('0x29')](_0x57e81d,function(_0xb58f41){if(_0xb58f41[_0xc03f('0x2d')]!==_0xc03f('0x3d')){var _0x5cfcd0={};_0x5cfcd0[_0xb58f41[_0xc03f('0x26')]]={'$like':'%'+_0x31a9a0['query'][_0xc03f('0x3a')]+'%'};return _0x5cfcd0;}})});}_0x10e7c1=_[_0xc03f('0x3c')]({},_0x10e7c1,_0x31a9a0[_0xc03f('0x3e')]);var _0x50a987={'where':_0x10e7c1['where']};return db[_0xc03f('0x2a')][_0xc03f('0x1b')](_0x50a987)[_0xc03f('0x22')](function(_0x44d5de){_0x2d036e['count']=_0x44d5de;if(_0x31a9a0[_0xc03f('0x30')][_0xc03f('0x3f')]){_0x10e7c1['include']=[{'all':!![]}];}return db[_0xc03f('0x2a')]['findAll'](_0x10e7c1);})[_0xc03f('0x22')](function(_0x3e17e6){_0x2d036e[_0xc03f('0x40')]=_0x3e17e6;return _0x2d036e;})[_0xc03f('0x22')](respondWithFilteredResult(_0xeb3945,_0x10e7c1))[_0xc03f('0x41')](handleError(_0xeb3945,null));};exports[_0xc03f('0x42')]=function(_0x5cfb1b,_0x130b65){var _0x304953={'raw':![],'where':{'id':_0x5cfb1b[_0xc03f('0x43')]['id']}},_0x3ef716={};_0x3ef716[_0xc03f('0x2f')]=_[_0xc03f('0x31')](db['SalesforceAccount'][_0xc03f('0x2b')]);_0x3ef716['query']=_['keys'](_0x5cfb1b['query']);_0x3ef716[_0xc03f('0x32')]=_[_0xc03f('0x34')](_0x3ef716[_0xc03f('0x2f')],_0x3ef716[_0xc03f('0x30')]);_0x304953[_0xc03f('0x33')]=_[_0xc03f('0x34')](_0x3ef716[_0xc03f('0x2f')],qs[_0xc03f('0x35')](_0x5cfb1b[_0xc03f('0x30')][_0xc03f('0x35')]));_0x304953[_0xc03f('0x33')]=_0x304953[_0xc03f('0x33')][_0xc03f('0x36')]?_0x304953[_0xc03f('0x33')]:_0x3ef716[_0xc03f('0x2f')];if(_0x5cfb1b['query'][_0xc03f('0x3f')]){_0x304953[_0xc03f('0x44')]=[{'all':!![]}];}_0x304953=_[_0xc03f('0x3c')]({},_0x304953,_0x5cfb1b['options']);return db['SalesforceAccount'][_0xc03f('0x45')](_0x304953)[_0xc03f('0x22')](handleEntityNotFound(_0x130b65,null))[_0xc03f('0x22')](respondWithResult(_0x130b65,null))[_0xc03f('0x41')](handleError(_0x130b65,null));};exports[_0xc03f('0x46')]=function(_0x2e2cd9,_0x36593d){return db[_0xc03f('0x2a')][_0xc03f('0x46')](_0x2e2cd9[_0xc03f('0x47')],{})[_0xc03f('0x22')](respondWithResult(_0x36593d,0xc9))[_0xc03f('0x41')](handleError(_0x36593d,null));};exports[_0xc03f('0x21')]=function(_0x2aa97d,_0x2c4714){if(_0x2aa97d['body']['id']){delete _0x2aa97d[_0xc03f('0x47')]['id'];}return db[_0xc03f('0x2a')][_0xc03f('0x45')]({'where':{'id':_0x2aa97d[_0xc03f('0x43')]['id']}})[_0xc03f('0x22')](handleEntityNotFound(_0x2c4714,null))[_0xc03f('0x22')](saveUpdates(_0x2aa97d['body'],null))[_0xc03f('0x22')](respondWithResult(_0x2c4714,null))[_0xc03f('0x41')](handleError(_0x2c4714,null));};exports[_0xc03f('0x23')]=function(_0x50b8fd,_0x5696f0){return db[_0xc03f('0x2a')]['find']({'where':{'id':_0x50b8fd[_0xc03f('0x43')]['id']}})[_0xc03f('0x22')](handleEntityNotFound(_0x5696f0,null))[_0xc03f('0x22')](removeEntity(_0x5696f0,null))[_0xc03f('0x41')](handleError(_0x5696f0,null));};exports['getConfigurations']=function(_0xbc42c8,_0x1aab28,_0x57ad07){var _0x5ca2de={};var _0x1e5940={};var _0x2da41e;var _0x26cc5a;return db[_0xc03f('0x2a')][_0xc03f('0x48')]({'where':{'id':_0xbc42c8[_0xc03f('0x43')]['id']}})[_0xc03f('0x22')](handleEntityNotFound(_0x1aab28,null))[_0xc03f('0x22')](function(_0x1e6bbe){if(_0x1e6bbe){_0x2da41e=_0x1e6bbe;_0x1e5940[_0xc03f('0x2f')]=_[_0xc03f('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x1e5940['query']=_[_0xc03f('0x31')](_0xbc42c8['query']);_0x1e5940['filters']=_[_0xc03f('0x34')](_0x1e5940[_0xc03f('0x2f')],_0x1e5940['query']);_0x5ca2de[_0xc03f('0x33')]=_['intersection'](_0x1e5940[_0xc03f('0x2f')],qs[_0xc03f('0x35')](_0xbc42c8['query']['fields']));_0x5ca2de['attributes']=_0x5ca2de[_0xc03f('0x33')][_0xc03f('0x36')]?_0x5ca2de[_0xc03f('0x33')]:_0x1e5940[_0xc03f('0x2f')];_0x5ca2de[_0xc03f('0x49')]=qs[_0xc03f('0x38')](_0xbc42c8['query'][_0xc03f('0x38')]);_0x5ca2de[_0xc03f('0x3b')]=qs[_0xc03f('0x32')](_[_0xc03f('0x39')](_0xbc42c8[_0xc03f('0x30')],_0x1e5940['filters']));if(_0xbc42c8[_0xc03f('0x30')]['filter']){_0x5ca2de[_0xc03f('0x3b')]=_[_0xc03f('0x3c')](_0x5ca2de[_0xc03f('0x3b')],{'$or':_[_0xc03f('0x29')](_0x5ca2de[_0xc03f('0x33')],function(_0xfeb3b9){var _0xc3bc2d={};_0xc3bc2d[_0xfeb3b9]={'$like':'%'+_0xbc42c8[_0xc03f('0x30')][_0xc03f('0x3a')]+'%'};return _0xc3bc2d;})});}_0x5ca2de=_[_0xc03f('0x3c')]({},_0x5ca2de,_0xbc42c8[_0xc03f('0x3e')]);return _0x2da41e[_0xc03f('0x4a')](_0x5ca2de);}})[_0xc03f('0x22')](function(_0x1931c2){if(_0x1931c2){_0x26cc5a=_0x1931c2['length'];if(!_0xbc42c8[_0xc03f('0x30')][_0xc03f('0x4b')]('nolimit')){_0x5ca2de[_0xc03f('0x1a')]=qs['limit'](_0xbc42c8[_0xc03f('0x30')][_0xc03f('0x1a')]);_0x5ca2de['offset']=qs[_0xc03f('0x18')](_0xbc42c8[_0xc03f('0x30')]['offset']);}return _0x2da41e[_0xc03f('0x4a')](_0x5ca2de);}})[_0xc03f('0x22')](function(_0x3ac4cc){if(_0x3ac4cc){return _0x3ac4cc?{'count':_0x26cc5a,'rows':_0x3ac4cc}:null;}})['then'](respondWithResult(_0x1aab28,null))[_0xc03f('0x41')](handleError(_0x1aab28,null));};exports['addConfiguration']=function(_0x13dfb7,_0x31b4cd,_0x227a1e){if(_0x13dfb7[_0xc03f('0x47')]['id']){delete _0x13dfb7[_0xc03f('0x47')]['id'];}return db[_0xc03f('0x2a')][_0xc03f('0x48')]({'where':{'id':_0x13dfb7[_0xc03f('0x43')]['id']}})[_0xc03f('0x22')](handleEntityNotFound(_0x31b4cd,null))['then'](function(_0x54cca3){if(_0x54cca3){_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x4c')]=_0x54cca3['id'];_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x4d')]=integrations['getSubjects'](_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x4e')],_0x13dfb7['body'][_0xc03f('0x2d')]);_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x4f')]=integrations['getDescriptions'](_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x4e')],_0x13dfb7[_0xc03f('0x47')][_0xc03f('0x2d')]);return db[_0xc03f('0x50')][_0xc03f('0x46')](_0x13dfb7[_0xc03f('0x47')],{'include':[{'model':db[_0xc03f('0x51')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xc03f('0x4f')}]});}return null;})[_0xc03f('0x22')](respondWithResult(_0x31b4cd,null))['catch'](handleError(_0x31b4cd,null));};exports[_0xc03f('0x52')]=function(_0xb3775e,_0x367afa,_0x2e27e6){var _0x4678fa;var _0x158cf0='';var _0x250eaf=_0xc03f('0x53');return db[_0xc03f('0x2a')][_0xc03f('0x48')]({'where':{'id':_0xb3775e[_0xc03f('0x43')]['id']},'attributes':['id',_0xc03f('0x54'),_0xc03f('0x55'),_0xc03f('0x56'),'username',_0xc03f('0x57'),_0xc03f('0x58')]})['then'](handleEntityNotFound(_0x367afa,null))[_0xc03f('0x22')](function(_0x488560){if(_0x488560){_0x158cf0=_0x488560[_0xc03f('0x54')];var _0x55228a=_0x158cf0[_0xc03f('0x59')](-0x1);if(_0x55228a==='/'){_0x158cf0=_0x158cf0[_0xc03f('0x5a')](0x0,_0x158cf0[_0xc03f('0x5b')](_0x55228a));}_0x4678fa=new jsforce[(_0xc03f('0x5c'))]({'oauth2':{'loginUrl':_0x158cf0,'clientId':_0x488560['clientId'],'clientSecret':_0x488560['clientSecret']}});return _0x4678fa['login'](_0x488560[_0xc03f('0x5d')],_0x488560[_0xc03f('0x57')][_0xc03f('0x5e')](_0x488560[_0xc03f('0x58')]));}})[_0xc03f('0x22')](function(_0x256d81){if(_0x256d81){if(!_['isNil'](_0xb3775e[_0xc03f('0x30')][_0xc03f('0x5f')])){_0x250eaf=_0xb3775e[_0xc03f('0x30')]['ticketType'];}return _0x4678fa['sobject'](_0x250eaf)[_0xc03f('0x60')]();}})[_0xc03f('0x22')](function(_0x20ca7c){var _0x549d4c=['OwnerId',_0xc03f('0x61'),_0xc03f('0x62'),_0xc03f('0x63'),_0xc03f('0x64'),_0xc03f('0x65')];var _0x2b90c2=[_0xc03f('0x66'),_0xc03f('0x67'),'picklist',_0xc03f('0x68'),_0xc03f('0x69'),'textarea',_0xc03f('0x6a')];if(_0x20ca7c){_[_0xc03f('0x6b')](_0x20ca7c[_0xc03f('0x35')],function(_0x58cab3){return _0x549d4c[_0xc03f('0x6c')](_0x58cab3[_0xc03f('0x26')])||!_0x2b90c2[_0xc03f('0x6c')](_0x58cab3[_0xc03f('0x2d')]);});return{'count':_0x20ca7c['fields'][_0xc03f('0x36')],'rows':_['map'](_0x20ca7c['fields'],function(_0x91cc63){return{'id':_0x91cc63['name'],'name':_0x91cc63[_0xc03f('0x6d')],'custom':_0x91cc63[_0xc03f('0x6e')],'options':_0x91cc63[_0xc03f('0x6f')][_0xc03f('0x36')]>0x0?_[_0xc03f('0x29')](_0x91cc63[_0xc03f('0x6f')],function(_0x40f4c5){return{'name':_0x40f4c5[_0xc03f('0x6d')],'value':_0x40f4c5[_0xc03f('0x70')]};}):_0x91cc63[_0xc03f('0x2d')]==_0xc03f('0x68')?[{'name':_0xc03f('0x71'),'value':_0xc03f('0x72')},{'name':_0xc03f('0x73'),'value':'false'}]:[]};})};}})[_0xc03f('0x22')](respondWithResult(_0x367afa,null))['catch'](function(_0x3cc24b){var _0x1755f0=_0xb3775e['query'][_0xc03f('0x74')]?0x1f4:_0x3cc24b[_0xc03f('0x75')]||0x1f4;logger[_0xc03f('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1755f0,JSON[_0xc03f('0x76')](_0x3cc24b));delete _0x3cc24b[_0xc03f('0x26')];if(_0x1755f0===0x191){_0x1755f0=0x190;}_0x367afa[_0xc03f('0x16')](_0x1755f0)['send'](_0xb3775e[_0xc03f('0x30')][_0xc03f('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x3cc24b[_0xc03f('0x75')]}:_0x3cc24b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6dc7a3d..2f500cc 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 _0x0a9f=['../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x1aeb39,_0x2e8404){var _0x439790=function(_0x199911){while(--_0x199911){_0x1aeb39['push'](_0x1aeb39['shift']());}};_0x439790(++_0x2e8404);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x984097,_0x18e5bf){_0x984097=_0x984097-0x0;var _0x557b33=_0x0a9f[_0x984097];return _0x557b33;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var logger=require(_0xf0a9('0x2'))(_0xf0a9('0x3'));var moment=require(_0xf0a9('0x4'));var BPromise=require(_0xf0a9('0x5'));var rp=require(_0xf0a9('0x6'));var fs=require('fs');var path=require(_0xf0a9('0x7'));var rimraf=require(_0xf0a9('0x8'));var config=require(_0xf0a9('0x9'));var attributes=require(_0xf0a9('0xa'));var integrations=require(_0xf0a9('0xb'));module['exports']=function(_0x24471f,_0x59adba){return _0x24471f[_0xf0a9('0xc')](_0xf0a9('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83f1=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x955935,_0x5a117c){var _0x50d4e0=function(_0x2e1984){while(--_0x2e1984){_0x955935['push'](_0x955935['shift']());}};_0x50d4e0(++_0x5a117c);}(_0x83f1,0x1cc));var _0x183f=function(_0x137f03,_0x3c1b7d){_0x137f03=_0x137f03-0x0;var _0x32cedc=_0x83f1[_0x137f03];return _0x32cedc;};'use strict';var _=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var logger=require(_0x183f('0x2'))(_0x183f('0x3'));var moment=require(_0x183f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x183f('0x5'));var rimraf=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var attributes=require(_0x183f('0x8'));var integrations=require(_0x183f('0x9'));module['exports']=function(_0x5c1cbd,_0xf702f5){return _0x5c1cbd[_0x183f('0xa')]('SalesforceAccount',attributes,{'tableName':_0x183f('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 8efeb6e..c564dde 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 _0x156d=['request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','limit','include','model','attributes','info','find','map','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x332748,_0x11c199){var _0x3e1563=function(_0x209186){while(--_0x209186){_0x332748['push'](_0x332748['shift']());}};_0x3e1563(++_0x11c199);}(_0x156d,0x162));var _0xd156=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x156d[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd156('0x0'));var BPromise=require(_0xd156('0x1'));var rs=require(_0xd156('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd156('0x3'));var logger=require(_0xd156('0x4'))(_0xd156('0x5'));var config=require(_0xd156('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd156('0x7')][_0xd156('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x145bb1,_0x1a60e3,_0x2c1acf){return new BPromise(function(_0x57f77e,_0x273275){return client[_0xd156('0x9')](_0x145bb1,_0x2c1acf)[_0xd156('0xa')](function(_0x13418a){logger['info'](_0xd156('0xb'),_0x1a60e3,_0xd156('0xc'));logger[_0xd156('0xd')](_0xd156('0xe'),_0x1a60e3,_0xd156('0xc'),JSON[_0xd156('0xf')](_0x13418a));if(_0x13418a[_0xd156('0x10')]){if(_0x13418a['error'][_0xd156('0x11')]===0x1f4){logger['error'](_0xd156('0xb'),_0x1a60e3,_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);return _0x273275(_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);}logger[_0xd156('0x10')](_0xd156('0xb'),_0x1a60e3,_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);return _0x57f77e(_0x13418a[_0xd156('0x10')][_0xd156('0x12')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1a60e3,'request\x20sent');_0x57f77e(_0x13418a[_0xd156('0x13')][_0xd156('0x12')]);}})[_0xd156('0x14')](function(_0x2c2ef3){logger['error'](_0xd156('0xb'),_0x1a60e3,_0x2c2ef3);_0x273275(_0x2c2ef3);});});}exports[_0xd156('0x15')]=function(_0x265b5e){var _0x551352=this;return new Promise(function(_0x39008e,_0x2ae101){return db[_0xd156('0x16')][_0xd156('0x17')]({'raw':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x19')]===undefined?!![]:![]:!![],'where':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')]['where']||null:null,'attributes':_0x265b5e[_0xd156('0x18')]?_0x265b5e['options']['attributes']||null:null,'limit':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x1a')]||null:null,'include':_0x265b5e[_0xd156('0x18')]?_0x265b5e[_0xd156('0x18')][_0xd156('0x1b')]?_['map'](_0x265b5e[_0xd156('0x18')][_0xd156('0x1b')],function(_0x34042d){return{'model':db[_0x34042d['model']],'as':_0x34042d['as'],'attributes':_0x34042d['attributes'],'include':_0x34042d['include']?_['map'](_0x34042d[_0xd156('0x1b')],function(_0x1b4923){return{'model':db[_0x1b4923[_0xd156('0x1c')]],'as':_0x1b4923['as'],'attributes':_0x1b4923[_0xd156('0x1d')],'include':_0x1b4923[_0xd156('0x1b')]?_['map'](_0x1b4923[_0xd156('0x1b')],function(_0x491e21){return{'model':db[_0x491e21[_0xd156('0x1c')]],'as':_0x491e21['as'],'attributes':_0x491e21[_0xd156('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a8ec2){logger[_0xd156('0x1e')]('GetSalesforceAccount',_0x265b5e);logger['debug'](_0xd156('0x15'),_0x265b5e,JSON[_0xd156('0xf')](_0x4a8ec2));_0x39008e(_0x4a8ec2);})[_0xd156('0x14')](function(_0x3253b0){logger[_0xd156('0x10')]('GetSalesforceAccount',_0x3253b0[_0xd156('0x12')],_0x265b5e);_0x2ae101(_0x551352[_0xd156('0x10')](0x1f4,_0x3253b0[_0xd156('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x164716){var _0x5c1715=this;return new Promise(function(_0x891eb9,_0x2c7604){return db[_0xd156('0x16')][_0xd156('0x1f')]({'raw':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x19')]===undefined?!![]:![]:!![],'where':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')]['where']||null:null,'attributes':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x1d')]||null:null,'include':_0x164716[_0xd156('0x18')]?_0x164716[_0xd156('0x18')][_0xd156('0x1b')]?_[_0xd156('0x20')](_0x164716['options'][_0xd156('0x1b')],function(_0x5f3046){return{'model':db[_0x5f3046[_0xd156('0x1c')]],'as':_0x5f3046['as'],'attributes':_0x5f3046[_0xd156('0x1d')],'include':_0x5f3046['include']?_[_0xd156('0x20')](_0x5f3046[_0xd156('0x1b')],function(_0x2471e4){return{'model':db[_0x2471e4[_0xd156('0x1c')]],'as':_0x2471e4['as'],'attributes':_0x2471e4[_0xd156('0x1d')],'include':_0x2471e4[_0xd156('0x1b')]?_[_0xd156('0x20')](_0x2471e4[_0xd156('0x1b')],function(_0x16fe53){return{'model':db[_0x16fe53[_0xd156('0x1c')]],'as':_0x16fe53['as'],'attributes':_0x16fe53['attributes']};}):[]};}):[]};}):[]:[]})[_0xd156('0xa')](function(_0x114dce){logger[_0xd156('0x1e')]('ShowSalesforceAccount',_0x164716);logger[_0xd156('0xd')]('ShowSalesforceAccount',_0x164716,JSON[_0xd156('0xf')](_0x114dce));_0x891eb9(_0x114dce);})[_0xd156('0x14')](function(_0x26b443){logger['error']('ShowSalesforceAccount',_0x26b443[_0xd156('0x12')],_0x164716);_0x2c7604(_0x5c1715[_0xd156('0x10')](0x1f4,_0x26b443[_0xd156('0x12')]));});});}; \ No newline at end of file +var _0x300d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','stringify','ShowSalesforceAccount','lodash','util','moment'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0x300d,0x173));var _0xd300=function(_0x42f8dc,_0xf9a6ad){_0x42f8dc=_0x42f8dc-0x0;var _0x203735=_0x300d[_0x42f8dc];return _0x203735;};'use strict';var _=require(_0xd300('0x0'));var util=require(_0xd300('0x1'));var moment=require(_0xd300('0x2'));var BPromise=require('bluebird');var rs=require(_0xd300('0x3'));var fs=require('fs');var Redis=require(_0xd300('0x4'));var db=require(_0xd300('0x5'))['db'];var utils=require(_0xd300('0x6'));var logger=require(_0xd300('0x7'))(_0xd300('0x8'));var config=require('../../config/environment');var jayson=require(_0xd300('0x9'));var client=jayson['client'][_0xd300('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x153b0d,_0x1776de,_0x21f55d){return new BPromise(function(_0x5b6fec,_0x55ad54){return client[_0xd300('0xb')](_0x153b0d,_0x21f55d)[_0xd300('0xc')](function(_0x53ad41){logger[_0xd300('0xd')](_0xd300('0xe'),_0x1776de,_0xd300('0xf'));logger[_0xd300('0x10')](_0xd300('0x11'),_0x1776de,_0xd300('0xf'),JSON['stringify'](_0x53ad41));if(_0x53ad41['error']){if(_0x53ad41['error'][_0xd300('0x12')]===0x1f4){logger['error'](_0xd300('0xe'),_0x1776de,_0x53ad41[_0xd300('0x13')][_0xd300('0x14')]);return _0x55ad54(_0x53ad41[_0xd300('0x13')][_0xd300('0x14')]);}logger[_0xd300('0x13')](_0xd300('0xe'),_0x1776de,_0x53ad41[_0xd300('0x13')][_0xd300('0x14')]);return _0x5b6fec(_0x53ad41['error'][_0xd300('0x14')]);}else{logger[_0xd300('0xd')](_0xd300('0xe'),_0x1776de,_0xd300('0xf'));_0x5b6fec(_0x53ad41['result'][_0xd300('0x14')]);}})['catch'](function(_0x4f9f84){logger[_0xd300('0x13')](_0xd300('0xe'),_0x1776de,_0x4f9f84);_0x55ad54(_0x4f9f84);});});}exports['GetSalesforceAccount']=function(_0x2d5c61){var _0x49dd45=this;return new Promise(function(_0x75b1b9,_0xe849fd){return db[_0xd300('0x15')][_0xd300('0x16')]({'raw':_0x2d5c61[_0xd300('0x17')]?_0x2d5c61[_0xd300('0x17')][_0xd300('0x18')]===undefined?!![]:![]:!![],'where':_0x2d5c61[_0xd300('0x17')]?_0x2d5c61['options'][_0xd300('0x19')]||null:null,'attributes':_0x2d5c61['options']?_0x2d5c61[_0xd300('0x17')][_0xd300('0x1a')]||null:null,'limit':_0x2d5c61[_0xd300('0x17')]?_0x2d5c61[_0xd300('0x17')][_0xd300('0x1b')]||null:null,'include':_0x2d5c61[_0xd300('0x17')]?_0x2d5c61['options']['include']?_[_0xd300('0x1c')](_0x2d5c61[_0xd300('0x17')][_0xd300('0x1d')],function(_0x2d05a1){return{'model':db[_0x2d05a1[_0xd300('0x1e')]],'as':_0x2d05a1['as'],'attributes':_0x2d05a1[_0xd300('0x1a')],'include':_0x2d05a1[_0xd300('0x1d')]?_[_0xd300('0x1c')](_0x2d05a1['include'],function(_0x2062b9){return{'model':db[_0x2062b9[_0xd300('0x1e')]],'as':_0x2062b9['as'],'attributes':_0x2062b9[_0xd300('0x1a')],'include':_0x2062b9['include']?_[_0xd300('0x1c')](_0x2062b9[_0xd300('0x1d')],function(_0x23c82d){return{'model':db[_0x23c82d[_0xd300('0x1e')]],'as':_0x23c82d['as'],'attributes':_0x23c82d[_0xd300('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd300('0xc')](function(_0x5cbb7f){logger['info'](_0xd300('0x1f'),_0x2d5c61);logger[_0xd300('0x10')](_0xd300('0x1f'),_0x2d5c61,JSON[_0xd300('0x20')](_0x5cbb7f));_0x75b1b9(_0x5cbb7f);})['catch'](function(_0x52f51c){logger[_0xd300('0x13')](_0xd300('0x1f'),_0x52f51c[_0xd300('0x14')],_0x2d5c61);_0xe849fd(_0x49dd45[_0xd300('0x13')](0x1f4,_0x52f51c['message']));});});};exports['ShowSalesforceAccount']=function(_0x48e633){var _0x7cf6e4=this;return new Promise(function(_0x4ae117,_0x3ad80f){return db[_0xd300('0x15')]['find']({'raw':_0x48e633['options']?_0x48e633['options'][_0xd300('0x18')]===undefined?!![]:![]:!![],'where':_0x48e633[_0xd300('0x17')]?_0x48e633[_0xd300('0x17')][_0xd300('0x19')]||null:null,'attributes':_0x48e633[_0xd300('0x17')]?_0x48e633[_0xd300('0x17')]['attributes']||null:null,'include':_0x48e633[_0xd300('0x17')]?_0x48e633['options'][_0xd300('0x1d')]?_['map'](_0x48e633['options'][_0xd300('0x1d')],function(_0x52b98c){return{'model':db[_0x52b98c[_0xd300('0x1e')]],'as':_0x52b98c['as'],'attributes':_0x52b98c['attributes'],'include':_0x52b98c[_0xd300('0x1d')]?_[_0xd300('0x1c')](_0x52b98c[_0xd300('0x1d')],function(_0x34416a){return{'model':db[_0x34416a[_0xd300('0x1e')]],'as':_0x34416a['as'],'attributes':_0x34416a[_0xd300('0x1a')],'include':_0x34416a[_0xd300('0x1d')]?_[_0xd300('0x1c')](_0x34416a[_0xd300('0x1d')],function(_0x3afea2){return{'model':db[_0x3afea2[_0xd300('0x1e')]],'as':_0x3afea2['as'],'attributes':_0x3afea2['attributes']};}):[]};}):[]};}):[]:[]})[_0xd300('0xc')](function(_0x5c0fbc){logger['info'](_0xd300('0x21'),_0x48e633);logger['debug']('ShowSalesforceAccount',_0x48e633,JSON[_0xd300('0x20')](_0x5c0fbc));_0x4ae117(_0x5c0fbc);})['catch'](function(_0x39f696){logger['error'](_0xd300('0x21'),_0x39f696[_0xd300('0x14')],_0x48e633);_0x3ad80f(_0x7cf6e4[_0xd300('0x13')](0x1f4,_0x39f696[_0xd300('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 59fbf2e..c6a9468 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x29947b,_0x547eae){var _0x44cb43=function(_0x111eb9){while(--_0x111eb9){_0x29947b['push'](_0x29947b['shift']());}};_0x44cb43(++_0x547eae);}(_0x7a54,0x106));var _0x47a5=function(_0x3879f2,_0x1be3d5){_0x3879f2=_0x3879f2-0x0;var _0x11469b=_0x7a54[_0x3879f2];return _0x11469b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +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(_0x5871d1,_0x1aade1){var _0x378ad6=function(_0x67baf0){while(--_0x67baf0){_0x5871d1['push'](_0x5871d1['shift']());}};_0x378ad6(++_0x1aade1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'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 2a81cd9..ea9c610 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 _0x5305=['ENUM','Task','account_contact_lead','contact_lead','nothing','contact','lead','account','exports','STRING'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5305,0x9e));var _0x5530=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5305[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x5530('0x0')]={'name':{'type':Sequelize[_0x5530('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5530('0x2')]('Task','Case'),'defaultValue':_0x5530('0x3')},'moduleSearch':{'type':Sequelize[_0x5530('0x2')]('contact_lead','contact','lead',_0x5530('0x4'),'account'),'defaultValue':_0x5530('0x5')},'moduleCreate':{'type':Sequelize[_0x5530('0x2')](_0x5530('0x6'),_0x5530('0x7'),_0x5530('0x8'),_0x5530('0x9')),'defaultValue':_0x5530('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x5530('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x5530('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x5530('0x1')]}}; \ No newline at end of file +var _0x68b7=['Case','Task','contact','lead','account_contact_lead','account','contact_lead','nothing','sequelize','STRING','ENUM'];(function(_0x4344f4,_0x38603f){var _0x19d54f=function(_0x2da622){while(--_0x2da622){_0x4344f4['push'](_0x4344f4['shift']());}};_0x19d54f(++_0x38603f);}(_0x68b7,0x8c));var _0x768b=function(_0x2b672f,_0x2faf6a){_0x2b672f=_0x2b672f-0x0;var _0x289e65=_0x68b7[_0x2b672f];return _0x289e65;};'use strict';var Sequelize=require(_0x768b('0x0'));module['exports']={'name':{'type':Sequelize[_0x768b('0x1')]},'description':{'type':Sequelize[_0x768b('0x1')]},'ticketType':{'type':Sequelize[_0x768b('0x2')]('Task',_0x768b('0x3')),'defaultValue':_0x768b('0x4')},'moduleSearch':{'type':Sequelize[_0x768b('0x2')]('contact_lead',_0x768b('0x5'),_0x768b('0x6'),_0x768b('0x7'),_0x768b('0x8')),'defaultValue':_0x768b('0x9')},'moduleCreate':{'type':Sequelize[_0x768b('0x2')](_0x768b('0xa'),'contact',_0x768b('0x6'),'account'),'defaultValue':_0x768b('0x6')},'leadId':{'type':Sequelize[_0x768b('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x768b('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x768b('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x768b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0d2d447..7f66120 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 _0x2737=['then','destroy','sendStatus','error','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','SalesforceField','getSubjects','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update'];(function(_0x5aedfc,_0x1fbae5){var _0x532de4=function(_0x11655b){while(--_0x11655b){_0x5aedfc['push'](_0x5aedfc['shift']());}};_0x532de4(++_0x1fbae5);}(_0x2737,0x11d));var _0x7273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2737[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7273('0x0'));var zipdir=require(_0x7273('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7273('0x2'));var moment=require(_0x7273('0x3'));var BPromise=require(_0x7273('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7273('0x5'));var sox=require('sox');var csv=require(_0x7273('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7273('0x7'));var _=require(_0x7273('0x8'));var squel=require('squel');var crypto=require(_0x7273('0x9'));var jsforce=require(_0x7273('0xa'));var deskjs=require(_0x7273('0xb'));var toCsv=require(_0x7273('0x6'));var querystring=require(_0x7273('0xc'));var Papa=require('papaparse');var Redis=require(_0x7273('0xd'));var authService=require(_0x7273('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7273('0xf'));var hardwareService=require(_0x7273('0x10'));var logger=require(_0x7273('0x11'))(_0x7273('0x12'));var utils=require(_0x7273('0x13'));var config=require(_0x7273('0x14'));var licenseUtil=require(_0x7273('0x15'));var db=require(_0x7273('0x16'))['db'];function respondWithStatusCode(_0x2d9695,_0x4d5ef8){_0x4d5ef8=_0x4d5ef8||0xcc;return function(_0xe302ca){if(_0xe302ca){return _0x2d9695['sendStatus'](_0x4d5ef8);}return _0x2d9695[_0x7273('0x17')](_0x4d5ef8)[_0x7273('0x18')]();};}function respondWithResult(_0x19d73c,_0x381fd1){_0x381fd1=_0x381fd1||0xc8;return function(_0x33400d){if(_0x33400d){return _0x19d73c[_0x7273('0x17')](_0x381fd1)['json'](_0x33400d);}};}function respondWithFilteredResult(_0x1ff7a8,_0x7fdb3){return function(_0x1de177){if(_0x1de177){var _0x568e8e=typeof _0x7fdb3[_0x7273('0x19')]===_0x7273('0x1a')&&typeof _0x7fdb3['limit']==='undefined';var _0x228453=_0x1de177[_0x7273('0x1b')];var _0x59167f=_0x568e8e?0x0:_0x7fdb3['offset'];var _0x29da25=_0x568e8e?_0x1de177['count']:_0x7fdb3[_0x7273('0x19')]+_0x7fdb3[_0x7273('0x1c')];var _0x659c71;if(_0x29da25>=_0x228453){_0x29da25=_0x228453;_0x659c71=0xc8;}else{_0x659c71=0xce;}_0x1ff7a8[_0x7273('0x17')](_0x659c71);return _0x1ff7a8[_0x7273('0x1d')](_0x7273('0x1e'),_0x59167f+'-'+_0x29da25+'/'+_0x228453)[_0x7273('0x1f')](_0x1de177);}return null;};}function patchUpdates(_0x309199){return function(_0x3f1374){try{jsonpatch['apply'](_0x3f1374,_0x309199,!![]);}catch(_0xd27787){return BPromise[_0x7273('0x20')](_0xd27787);}return _0x3f1374[_0x7273('0x21')]();};}function saveUpdates(_0x20c403,_0x51ad71){return function(_0x4a5c73){if(_0x4a5c73){return _0x4a5c73[_0x7273('0x22')](_0x20c403)[_0x7273('0x23')](function(_0x10cdea){return _0x10cdea;});}return null;};}function removeEntity(_0x30170d,_0x5a175b){return function(_0x15054a){if(_0x15054a){return _0x15054a[_0x7273('0x24')]()[_0x7273('0x23')](function(){_0x30170d['status'](0xcc)[_0x7273('0x18')]();});}};}function handleEntityNotFound(_0x4bff6c,_0x4ad832){return function(_0x147652){if(!_0x147652){_0x4bff6c[_0x7273('0x25')](0x194);}return _0x147652;};}function handleError(_0x2a4434,_0x407bbd){_0x407bbd=_0x407bbd||0x1f4;return function(_0x326b3c){logger[_0x7273('0x26')](_0x326b3c['stack']);if(_0x326b3c[_0x7273('0x27')]){delete _0x326b3c[_0x7273('0x27')];}_0x2a4434['status'](_0x407bbd)['send'](_0x326b3c);};}exports[_0x7273('0x28')]=function(_0x39fe75,_0x2f73bb){var _0x3642a3={},_0x49ae98={},_0x1730fd={'count':0x0,'rows':[]};var _0x5e55c1=_[_0x7273('0x29')](db[_0x7273('0x2a')][_0x7273('0x2b')],function(_0x4e3126){return{'name':_0x4e3126[_0x7273('0x2c')],'type':_0x4e3126['type'][_0x7273('0x2d')]};});_0x49ae98['model']=_[_0x7273('0x29')](_0x5e55c1,_0x7273('0x27'));_0x49ae98['query']=_[_0x7273('0x2e')](_0x39fe75[_0x7273('0x2f')]);_0x49ae98['filters']=_[_0x7273('0x30')](_0x49ae98[_0x7273('0x31')],_0x49ae98[_0x7273('0x2f')]);_0x3642a3[_0x7273('0x32')]=_[_0x7273('0x30')](_0x49ae98[_0x7273('0x31')],qs[_0x7273('0x33')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x33')]));_0x3642a3[_0x7273('0x32')]=_0x3642a3[_0x7273('0x32')][_0x7273('0x34')]?_0x3642a3[_0x7273('0x32')]:_0x49ae98[_0x7273('0x31')];if(!_0x39fe75[_0x7273('0x2f')][_0x7273('0x35')](_0x7273('0x36'))){_0x3642a3[_0x7273('0x1c')]=qs[_0x7273('0x1c')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x1c')]);_0x3642a3[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x39fe75[_0x7273('0x2f')][_0x7273('0x19')]);}_0x3642a3['order']=qs[_0x7273('0x37')](_0x39fe75[_0x7273('0x2f')]['sort']);_0x3642a3['where']=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x39fe75[_0x7273('0x2f')],_0x49ae98[_0x7273('0x38')]),_0x5e55c1);if(_0x39fe75[_0x7273('0x2f')][_0x7273('0x3a')]){_0x3642a3[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x3642a3[_0x7273('0x3b')],{'$or':_['map'](_0x5e55c1,function(_0x4af636){if(_0x4af636[_0x7273('0x3d')]!==_0x7273('0x3e')){var _0x28f8a6={};_0x28f8a6[_0x4af636['name']]={'$like':'%'+_0x39fe75['query'][_0x7273('0x3a')]+'%'};return _0x28f8a6;}})});}_0x3642a3=_[_0x7273('0x3c')]({},_0x3642a3,_0x39fe75[_0x7273('0x3f')]);var _0x385f0f={'where':_0x3642a3[_0x7273('0x3b')]};return db[_0x7273('0x2a')][_0x7273('0x1b')](_0x385f0f)[_0x7273('0x23')](function(_0x14e83e){_0x1730fd['count']=_0x14e83e;if(_0x39fe75[_0x7273('0x2f')][_0x7273('0x40')]){_0x3642a3[_0x7273('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7273('0x42')](_0x3642a3);})[_0x7273('0x23')](function(_0x3b3505){_0x1730fd[_0x7273('0x43')]=_0x3b3505;return _0x1730fd;})[_0x7273('0x23')](respondWithFilteredResult(_0x2f73bb,_0x3642a3))[_0x7273('0x44')](handleError(_0x2f73bb,null));};exports[_0x7273('0x45')]=function(_0x5f1195,_0x93a769){var _0x10bb84={'raw':![],'where':{'id':_0x5f1195['params']['id']}},_0x3829c2={};_0x3829c2[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x2a')][_0x7273('0x2b')]);_0x3829c2[_0x7273('0x2f')]=_['keys'](_0x5f1195['query']);_0x3829c2[_0x7273('0x38')]=_[_0x7273('0x30')](_0x3829c2[_0x7273('0x31')],_0x3829c2[_0x7273('0x2f')]);_0x10bb84[_0x7273('0x32')]=_['intersection'](_0x3829c2[_0x7273('0x31')],qs[_0x7273('0x33')](_0x5f1195['query'][_0x7273('0x33')]));_0x10bb84[_0x7273('0x32')]=_0x10bb84[_0x7273('0x32')]['length']?_0x10bb84[_0x7273('0x32')]:_0x3829c2['model'];if(_0x5f1195[_0x7273('0x2f')][_0x7273('0x40')]){_0x10bb84[_0x7273('0x41')]=[{'all':!![]}];}_0x10bb84=_[_0x7273('0x3c')]({},_0x10bb84,_0x5f1195[_0x7273('0x3f')]);return db[_0x7273('0x2a')][_0x7273('0x46')](_0x10bb84)['then'](handleEntityNotFound(_0x93a769,null))['then'](respondWithResult(_0x93a769,null))['catch'](handleError(_0x93a769,null));};exports['create']=function(_0x281ecb,_0x1f6959){return db[_0x7273('0x2a')][_0x7273('0x47')](_0x281ecb[_0x7273('0x48')],{})[_0x7273('0x23')](respondWithResult(_0x1f6959,0xc9))[_0x7273('0x44')](handleError(_0x1f6959,null));};exports[_0x7273('0x22')]=function(_0x22e3dc,_0x37ae23){if(_0x22e3dc[_0x7273('0x48')]['id']){delete _0x22e3dc[_0x7273('0x48')]['id'];}return db[_0x7273('0x2a')]['find']({'where':{'id':_0x22e3dc[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x37ae23,null))[_0x7273('0x23')](saveUpdates(_0x22e3dc[_0x7273('0x48')],null))[_0x7273('0x23')](respondWithResult(_0x37ae23,null))[_0x7273('0x44')](handleError(_0x37ae23,null));};exports['destroy']=function(_0x31ebbd,_0x53b572){return db['SalesforceConfiguration']['find']({'where':{'id':_0x31ebbd[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x53b572,null))['then'](removeEntity(_0x53b572,null))[_0x7273('0x44')](handleError(_0x53b572,null));};exports[_0x7273('0x4a')]=function(_0x87bba,_0xe8d1c0,_0x58f847){var _0x60ae4={};var _0x42ed54={};var _0x4a3989;var _0x272ae7;return db['SalesforceConfiguration'][_0x7273('0x4b')]({'where':{'id':_0x87bba[_0x7273('0x49')]['id']}})['then'](handleEntityNotFound(_0xe8d1c0,null))[_0x7273('0x23')](function(_0x33fd72){if(_0x33fd72){_0x4a3989=_0x33fd72;_0x42ed54[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x42ed54[_0x7273('0x2f')]=_[_0x7273('0x2e')](_0x87bba['query']);_0x42ed54[_0x7273('0x38')]=_[_0x7273('0x30')](_0x42ed54[_0x7273('0x31')],_0x42ed54[_0x7273('0x2f')]);_0x60ae4[_0x7273('0x32')]=_['intersection'](_0x42ed54['model'],qs[_0x7273('0x33')](_0x87bba['query'][_0x7273('0x33')]));_0x60ae4[_0x7273('0x32')]=_0x60ae4[_0x7273('0x32')][_0x7273('0x34')]?_0x60ae4[_0x7273('0x32')]:_0x42ed54[_0x7273('0x31')];_0x60ae4['order']=qs[_0x7273('0x37')](_0x87bba[_0x7273('0x2f')][_0x7273('0x37')]);_0x60ae4[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x87bba['query'],_0x42ed54[_0x7273('0x38')]));if(_0x87bba[_0x7273('0x2f')][_0x7273('0x3a')]){_0x60ae4[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x60ae4[_0x7273('0x3b')],{'$or':_['map'](_0x60ae4[_0x7273('0x32')],function(_0x1c59ea){var _0x498602={};_0x498602[_0x1c59ea]={'$like':'%'+_0x87bba[_0x7273('0x2f')][_0x7273('0x3a')]+'%'};return _0x498602;})});}_0x60ae4=_[_0x7273('0x3c')]({},_0x60ae4,_0x87bba[_0x7273('0x3f')]);return _0x4a3989[_0x7273('0x4a')](_0x60ae4);}})['then'](function(_0x466663){if(_0x466663){_0x272ae7=_0x466663[_0x7273('0x34')];if(!_0x87bba[_0x7273('0x2f')][_0x7273('0x35')](_0x7273('0x36'))){_0x60ae4[_0x7273('0x1c')]=qs['limit'](_0x87bba['query'][_0x7273('0x1c')]);_0x60ae4['offset']=qs[_0x7273('0x19')](_0x87bba[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x4a3989['getFields'](_0x60ae4);}})['then'](function(_0x3b1d57){if(_0x3b1d57){return _0x3b1d57?{'count':_0x272ae7,'rows':_0x3b1d57}:null;}})[_0x7273('0x23')](respondWithResult(_0xe8d1c0,null))[_0x7273('0x44')](handleError(_0xe8d1c0,null));};exports[_0x7273('0x4d')]=function(_0x3ec670,_0x26fe09,_0x29c8a7){var _0x15babe={};var _0x14e7d1={};var _0x10c183;var _0x225654;return db[_0x7273('0x2a')][_0x7273('0x4b')]({'where':{'id':_0x3ec670[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x26fe09,null))[_0x7273('0x23')](function(_0x99760c){if(_0x99760c){_0x10c183=_0x99760c;_0x14e7d1['model']=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x14e7d1[_0x7273('0x2f')]=_['keys'](_0x3ec670[_0x7273('0x2f')]);_0x14e7d1[_0x7273('0x38')]=_['intersection'](_0x14e7d1[_0x7273('0x31')],_0x14e7d1[_0x7273('0x2f')]);_0x15babe[_0x7273('0x32')]=_[_0x7273('0x30')](_0x14e7d1[_0x7273('0x31')],qs[_0x7273('0x33')](_0x3ec670[_0x7273('0x2f')][_0x7273('0x33')]));_0x15babe[_0x7273('0x32')]=_0x15babe[_0x7273('0x32')][_0x7273('0x34')]?_0x15babe[_0x7273('0x32')]:_0x14e7d1[_0x7273('0x31')];_0x15babe[_0x7273('0x4e')]=qs[_0x7273('0x37')](_0x3ec670[_0x7273('0x2f')]['sort']);_0x15babe[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x3ec670[_0x7273('0x2f')],_0x14e7d1['filters']));if(_0x3ec670[_0x7273('0x2f')][_0x7273('0x3a')]){_0x15babe[_0x7273('0x3b')]=_[_0x7273('0x3c')](_0x15babe['where'],{'$or':_[_0x7273('0x29')](_0x15babe[_0x7273('0x32')],function(_0x50a7b4){var _0x37ef9d={};_0x37ef9d[_0x50a7b4]={'$like':'%'+_0x3ec670['query'][_0x7273('0x3a')]+'%'};return _0x37ef9d;})});}_0x15babe=_[_0x7273('0x3c')]({},_0x15babe,_0x3ec670[_0x7273('0x3f')]);return _0x10c183[_0x7273('0x4d')](_0x15babe);}})[_0x7273('0x23')](function(_0x20d3d1){if(_0x20d3d1){_0x225654=_0x20d3d1[_0x7273('0x34')];if(!_0x3ec670['query']['hasOwnProperty'](_0x7273('0x36'))){_0x15babe['limit']=qs[_0x7273('0x1c')](_0x3ec670['query'][_0x7273('0x1c')]);_0x15babe[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x3ec670[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x10c183[_0x7273('0x4d')](_0x15babe);}})[_0x7273('0x23')](function(_0x32487d){if(_0x32487d){return _0x32487d?{'count':_0x225654,'rows':_0x32487d}:null;}})[_0x7273('0x23')](respondWithResult(_0x26fe09,null))['catch'](handleError(_0x26fe09,null));};exports[_0x7273('0x4f')]=function(_0x16d17c,_0x4a6219,_0x1b14d1){var _0x47ce05={};var _0x36b3c8={};var _0x1198bb;var _0x5df196;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x16d17c[_0x7273('0x49')]['id']}})[_0x7273('0x23')](handleEntityNotFound(_0x4a6219,null))[_0x7273('0x23')](function(_0x51930e){if(_0x51930e){_0x1198bb=_0x51930e;_0x36b3c8[_0x7273('0x31')]=_[_0x7273('0x2e')](db[_0x7273('0x4c')][_0x7273('0x2b')]);_0x36b3c8[_0x7273('0x2f')]=_[_0x7273('0x2e')](_0x16d17c[_0x7273('0x2f')]);_0x36b3c8['filters']=_[_0x7273('0x30')](_0x36b3c8[_0x7273('0x31')],_0x36b3c8[_0x7273('0x2f')]);_0x47ce05[_0x7273('0x32')]=_[_0x7273('0x30')](_0x36b3c8[_0x7273('0x31')],qs[_0x7273('0x33')](_0x16d17c[_0x7273('0x2f')][_0x7273('0x33')]));_0x47ce05[_0x7273('0x32')]=_0x47ce05[_0x7273('0x32')][_0x7273('0x34')]?_0x47ce05[_0x7273('0x32')]:_0x36b3c8[_0x7273('0x31')];_0x47ce05['order']=qs['sort'](_0x16d17c[_0x7273('0x2f')][_0x7273('0x37')]);_0x47ce05[_0x7273('0x3b')]=qs[_0x7273('0x38')](_[_0x7273('0x39')](_0x16d17c[_0x7273('0x2f')],_0x36b3c8['filters']));if(_0x16d17c[_0x7273('0x2f')][_0x7273('0x3a')]){_0x47ce05['where']=_[_0x7273('0x3c')](_0x47ce05[_0x7273('0x3b')],{'$or':_[_0x7273('0x29')](_0x47ce05['attributes'],function(_0x1aa841){var _0x518bc2={};_0x518bc2[_0x1aa841]={'$like':'%'+_0x16d17c[_0x7273('0x2f')][_0x7273('0x3a')]+'%'};return _0x518bc2;})});}_0x47ce05=_[_0x7273('0x3c')]({},_0x47ce05,_0x16d17c[_0x7273('0x3f')]);return _0x1198bb[_0x7273('0x4f')](_0x47ce05);}})[_0x7273('0x23')](function(_0x4d49f6){if(_0x4d49f6){_0x5df196=_0x4d49f6[_0x7273('0x34')];if(!_0x16d17c[_0x7273('0x2f')][_0x7273('0x35')]('nolimit')){_0x47ce05[_0x7273('0x1c')]=qs['limit'](_0x16d17c[_0x7273('0x2f')][_0x7273('0x1c')]);_0x47ce05[_0x7273('0x19')]=qs[_0x7273('0x19')](_0x16d17c[_0x7273('0x2f')][_0x7273('0x19')]);}return _0x1198bb[_0x7273('0x4f')](_0x47ce05);}})['then'](function(_0x4be20b){if(_0x4be20b){return _0x4be20b?{'count':_0x5df196,'rows':_0x4be20b}:null;}})[_0x7273('0x23')](respondWithResult(_0x4a6219,null))[_0x7273('0x44')](handleError(_0x4a6219,null));}; \ No newline at end of file +var _0x0136=['intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','then','rawAttributes','fields','includeAll','catch','create','body','params','find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','SalesforceConfiguration','fieldName','type','key','query','keys','filters'];(function(_0x3a82b3,_0x383e8b){var _0x38b311=function(_0x5a38ee){while(--_0x5a38ee){_0x3a82b3['push'](_0x3a82b3['shift']());}};_0x38b311(++_0x383e8b);}(_0x0136,0x19a));var _0x6013=function(_0x1198ac,_0x5d1695){_0x1198ac=_0x1198ac-0x0;var _0x3f2b70=_0x0136[_0x1198ac];return _0x3f2b70;};'use strict';var emlformat=require(_0x6013('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6013('0x1'));var jsonpatch=require(_0x6013('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6013('0x3'));var path=require(_0x6013('0x4'));var sox=require(_0x6013('0x5'));var csv=require(_0x6013('0x6'));var ejs=require(_0x6013('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6013('0x8'));var squel=require(_0x6013('0x9'));var crypto=require('crypto');var jsforce=require(_0x6013('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6013('0x6'));var querystring=require(_0x6013('0xb'));var Papa=require(_0x6013('0xc'));var Redis=require('ioredis');var authService=require(_0x6013('0xd'));var qs=require(_0x6013('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6013('0xf'));var logger=require(_0x6013('0x10'))(_0x6013('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6013('0x12'));var db=require(_0x6013('0x13'))['db'];function respondWithStatusCode(_0x428ca9,_0x131710){_0x131710=_0x131710||0xcc;return function(_0xf107db){if(_0xf107db){return _0x428ca9[_0x6013('0x14')](_0x131710);}return _0x428ca9[_0x6013('0x15')](_0x131710)[_0x6013('0x16')]();};}function respondWithResult(_0x4316d6,_0x3f0d03){_0x3f0d03=_0x3f0d03||0xc8;return function(_0x4829a5){if(_0x4829a5){return _0x4316d6[_0x6013('0x15')](_0x3f0d03)['json'](_0x4829a5);}};}function respondWithFilteredResult(_0x5df54f,_0x286856){return function(_0x4575df){if(_0x4575df){var _0x1ea228=typeof _0x286856[_0x6013('0x17')]==='undefined'&&typeof _0x286856[_0x6013('0x18')]===_0x6013('0x19');var _0x500304=_0x4575df[_0x6013('0x1a')];var _0x3e15b6=_0x1ea228?0x0:_0x286856[_0x6013('0x17')];var _0x2d4e89=_0x1ea228?_0x4575df[_0x6013('0x1a')]:_0x286856[_0x6013('0x17')]+_0x286856['limit'];var _0x3a89fd;if(_0x2d4e89>=_0x500304){_0x2d4e89=_0x500304;_0x3a89fd=0xc8;}else{_0x3a89fd=0xce;}_0x5df54f[_0x6013('0x15')](_0x3a89fd);return _0x5df54f[_0x6013('0x1b')](_0x6013('0x1c'),_0x3e15b6+'-'+_0x2d4e89+'/'+_0x500304)['json'](_0x4575df);}return null;};}function patchUpdates(_0x190c62){return function(_0x125de7){try{jsonpatch[_0x6013('0x1d')](_0x125de7,_0x190c62,!![]);}catch(_0x4d3450){return BPromise['reject'](_0x4d3450);}return _0x125de7[_0x6013('0x1e')]();};}function saveUpdates(_0x44a7d5,_0x14c537){return function(_0x54b509){if(_0x54b509){return _0x54b509[_0x6013('0x1f')](_0x44a7d5)['then'](function(_0xf12c87){return _0xf12c87;});}return null;};}function removeEntity(_0x48d13f,_0x159e8a){return function(_0x1aff68){if(_0x1aff68){return _0x1aff68[_0x6013('0x20')]()['then'](function(){_0x48d13f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb449,_0x51e3c7){return function(_0x2b62b7){if(!_0x2b62b7){_0x2eb449[_0x6013('0x14')](0x194);}return _0x2b62b7;};}function handleError(_0x33967a,_0x2cf95b){_0x2cf95b=_0x2cf95b||0x1f4;return function(_0x3197b9){logger[_0x6013('0x21')](_0x3197b9[_0x6013('0x22')]);if(_0x3197b9[_0x6013('0x23')]){delete _0x3197b9[_0x6013('0x23')];}_0x33967a[_0x6013('0x15')](_0x2cf95b)[_0x6013('0x24')](_0x3197b9);};}exports[_0x6013('0x25')]=function(_0x2d4ede,_0x5a8223){var _0x29ef4a={},_0x2e6cec={},_0x146f99={'count':0x0,'rows':[]};var _0x89ca06=_[_0x6013('0x26')](db[_0x6013('0x27')]['rawAttributes'],function(_0x194653){return{'name':_0x194653[_0x6013('0x28')],'type':_0x194653[_0x6013('0x29')][_0x6013('0x2a')]};});_0x2e6cec['model']=_[_0x6013('0x26')](_0x89ca06,_0x6013('0x23'));_0x2e6cec[_0x6013('0x2b')]=_[_0x6013('0x2c')](_0x2d4ede[_0x6013('0x2b')]);_0x2e6cec[_0x6013('0x2d')]=_[_0x6013('0x2e')](_0x2e6cec[_0x6013('0x2f')],_0x2e6cec['query']);_0x29ef4a[_0x6013('0x30')]=_[_0x6013('0x2e')](_0x2e6cec[_0x6013('0x2f')],qs['fields'](_0x2d4ede['query']['fields']));_0x29ef4a[_0x6013('0x30')]=_0x29ef4a[_0x6013('0x30')][_0x6013('0x31')]?_0x29ef4a[_0x6013('0x30')]:_0x2e6cec['model'];if(!_0x2d4ede['query'][_0x6013('0x32')](_0x6013('0x33'))){_0x29ef4a['limit']=qs['limit'](_0x2d4ede['query'][_0x6013('0x18')]);_0x29ef4a[_0x6013('0x17')]=qs[_0x6013('0x17')](_0x2d4ede[_0x6013('0x2b')][_0x6013('0x17')]);}_0x29ef4a[_0x6013('0x34')]=qs['sort'](_0x2d4ede[_0x6013('0x2b')][_0x6013('0x35')]);_0x29ef4a[_0x6013('0x36')]=qs[_0x6013('0x2d')](_[_0x6013('0x37')](_0x2d4ede[_0x6013('0x2b')],_0x2e6cec[_0x6013('0x2d')]),_0x89ca06);if(_0x2d4ede[_0x6013('0x2b')][_0x6013('0x38')]){_0x29ef4a[_0x6013('0x36')]=_[_0x6013('0x39')](_0x29ef4a[_0x6013('0x36')],{'$or':_[_0x6013('0x26')](_0x89ca06,function(_0x3d76fe){if(_0x3d76fe['type']!==_0x6013('0x3a')){var _0x2165e8={};_0x2165e8[_0x3d76fe['name']]={'$like':'%'+_0x2d4ede[_0x6013('0x2b')][_0x6013('0x38')]+'%'};return _0x2165e8;}})});}_0x29ef4a=_[_0x6013('0x39')]({},_0x29ef4a,_0x2d4ede[_0x6013('0x3b')]);var _0x2224c0={'where':_0x29ef4a[_0x6013('0x36')]};return db[_0x6013('0x27')]['count'](_0x2224c0)['then'](function(_0x38c999){_0x146f99[_0x6013('0x1a')]=_0x38c999;if(_0x2d4ede[_0x6013('0x2b')]['includeAll']){_0x29ef4a[_0x6013('0x3c')]=[{'all':!![]}];}return db[_0x6013('0x27')][_0x6013('0x3d')](_0x29ef4a);})[_0x6013('0x3e')](function(_0x3ced49){_0x146f99['rows']=_0x3ced49;return _0x146f99;})['then'](respondWithFilteredResult(_0x5a8223,_0x29ef4a))['catch'](handleError(_0x5a8223,null));};exports['show']=function(_0x3c8fdb,_0x2528aa){var _0x464802={'raw':![],'where':{'id':_0x3c8fdb['params']['id']}},_0x111462={};_0x111462[_0x6013('0x2f')]=_[_0x6013('0x2c')](db[_0x6013('0x27')][_0x6013('0x3f')]);_0x111462[_0x6013('0x2b')]=_[_0x6013('0x2c')](_0x3c8fdb['query']);_0x111462[_0x6013('0x2d')]=_[_0x6013('0x2e')](_0x111462[_0x6013('0x2f')],_0x111462[_0x6013('0x2b')]);_0x464802[_0x6013('0x30')]=_[_0x6013('0x2e')](_0x111462[_0x6013('0x2f')],qs[_0x6013('0x40')](_0x3c8fdb[_0x6013('0x2b')][_0x6013('0x40')]));_0x464802[_0x6013('0x30')]=_0x464802[_0x6013('0x30')][_0x6013('0x31')]?_0x464802[_0x6013('0x30')]:_0x111462[_0x6013('0x2f')];if(_0x3c8fdb[_0x6013('0x2b')][_0x6013('0x41')]){_0x464802[_0x6013('0x3c')]=[{'all':!![]}];}_0x464802=_[_0x6013('0x39')]({},_0x464802,_0x3c8fdb[_0x6013('0x3b')]);return db[_0x6013('0x27')]['find'](_0x464802)[_0x6013('0x3e')](handleEntityNotFound(_0x2528aa,null))[_0x6013('0x3e')](respondWithResult(_0x2528aa,null))[_0x6013('0x42')](handleError(_0x2528aa,null));};exports[_0x6013('0x43')]=function(_0x293035,_0x52e468){return db['SalesforceConfiguration']['create'](_0x293035[_0x6013('0x44')],{})[_0x6013('0x3e')](respondWithResult(_0x52e468,0xc9))[_0x6013('0x42')](handleError(_0x52e468,null));};exports['update']=function(_0x1ff89e,_0x563931){if(_0x1ff89e[_0x6013('0x44')]['id']){delete _0x1ff89e[_0x6013('0x44')]['id'];}return db[_0x6013('0x27')]['find']({'where':{'id':_0x1ff89e[_0x6013('0x45')]['id']}})[_0x6013('0x3e')](handleEntityNotFound(_0x563931,null))['then'](saveUpdates(_0x1ff89e[_0x6013('0x44')],null))['then'](respondWithResult(_0x563931,null))[_0x6013('0x42')](handleError(_0x563931,null));};exports[_0x6013('0x20')]=function(_0x30920c,_0xacd51d){return db[_0x6013('0x27')][_0x6013('0x46')]({'where':{'id':_0x30920c[_0x6013('0x45')]['id']}})['then'](handleEntityNotFound(_0xacd51d,null))[_0x6013('0x3e')](removeEntity(_0xacd51d,null))[_0x6013('0x42')](handleError(_0xacd51d,null));};exports[_0x6013('0x47')]=function(_0x38f811,_0x4a0ad3,_0x2f3700){var _0x3069b3={};var _0x2c85d2={};var _0x5d60b0;var _0x166b64;return db[_0x6013('0x27')][_0x6013('0x48')]({'where':{'id':_0x38f811[_0x6013('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a0ad3,null))[_0x6013('0x3e')](function(_0xb98dcb){if(_0xb98dcb){_0x5d60b0=_0xb98dcb;_0x2c85d2[_0x6013('0x2f')]=_[_0x6013('0x2c')](db[_0x6013('0x49')]['rawAttributes']);_0x2c85d2[_0x6013('0x2b')]=_[_0x6013('0x2c')](_0x38f811['query']);_0x2c85d2[_0x6013('0x2d')]=_[_0x6013('0x2e')](_0x2c85d2[_0x6013('0x2f')],_0x2c85d2[_0x6013('0x2b')]);_0x3069b3[_0x6013('0x30')]=_['intersection'](_0x2c85d2[_0x6013('0x2f')],qs[_0x6013('0x40')](_0x38f811['query'][_0x6013('0x40')]));_0x3069b3[_0x6013('0x30')]=_0x3069b3[_0x6013('0x30')][_0x6013('0x31')]?_0x3069b3[_0x6013('0x30')]:_0x2c85d2[_0x6013('0x2f')];_0x3069b3[_0x6013('0x34')]=qs[_0x6013('0x35')](_0x38f811[_0x6013('0x2b')][_0x6013('0x35')]);_0x3069b3[_0x6013('0x36')]=qs['filters'](_[_0x6013('0x37')](_0x38f811[_0x6013('0x2b')],_0x2c85d2[_0x6013('0x2d')]));if(_0x38f811[_0x6013('0x2b')]['filter']){_0x3069b3[_0x6013('0x36')]=_[_0x6013('0x39')](_0x3069b3[_0x6013('0x36')],{'$or':_[_0x6013('0x26')](_0x3069b3['attributes'],function(_0x146c24){var _0x43030c={};_0x43030c[_0x146c24]={'$like':'%'+_0x38f811[_0x6013('0x2b')][_0x6013('0x38')]+'%'};return _0x43030c;})});}_0x3069b3=_[_0x6013('0x39')]({},_0x3069b3,_0x38f811['options']);return _0x5d60b0[_0x6013('0x47')](_0x3069b3);}})[_0x6013('0x3e')](function(_0x5f1d1f){if(_0x5f1d1f){_0x166b64=_0x5f1d1f['length'];if(!_0x38f811[_0x6013('0x2b')][_0x6013('0x32')](_0x6013('0x33'))){_0x3069b3[_0x6013('0x18')]=qs[_0x6013('0x18')](_0x38f811[_0x6013('0x2b')][_0x6013('0x18')]);_0x3069b3[_0x6013('0x17')]=qs['offset'](_0x38f811[_0x6013('0x2b')]['offset']);}return _0x5d60b0[_0x6013('0x47')](_0x3069b3);}})[_0x6013('0x3e')](function(_0x17c654){if(_0x17c654){return _0x17c654?{'count':_0x166b64,'rows':_0x17c654}:null;}})['then'](respondWithResult(_0x4a0ad3,null))[_0x6013('0x42')](handleError(_0x4a0ad3,null));};exports[_0x6013('0x4a')]=function(_0x532558,_0x36a4e6,_0x1e477a){var _0xaa0402={};var _0xf175cf={};var _0x5f1859;var _0x16d09f;return db[_0x6013('0x27')]['findOne']({'where':{'id':_0x532558[_0x6013('0x45')]['id']}})[_0x6013('0x3e')](handleEntityNotFound(_0x36a4e6,null))[_0x6013('0x3e')](function(_0x5e969b){if(_0x5e969b){_0x5f1859=_0x5e969b;_0xf175cf['model']=_[_0x6013('0x2c')](db[_0x6013('0x49')][_0x6013('0x3f')]);_0xf175cf[_0x6013('0x2b')]=_['keys'](_0x532558['query']);_0xf175cf[_0x6013('0x2d')]=_[_0x6013('0x2e')](_0xf175cf['model'],_0xf175cf[_0x6013('0x2b')]);_0xaa0402[_0x6013('0x30')]=_[_0x6013('0x2e')](_0xf175cf[_0x6013('0x2f')],qs[_0x6013('0x40')](_0x532558[_0x6013('0x2b')][_0x6013('0x40')]));_0xaa0402['attributes']=_0xaa0402['attributes'][_0x6013('0x31')]?_0xaa0402[_0x6013('0x30')]:_0xf175cf[_0x6013('0x2f')];_0xaa0402[_0x6013('0x34')]=qs['sort'](_0x532558[_0x6013('0x2b')][_0x6013('0x35')]);_0xaa0402[_0x6013('0x36')]=qs[_0x6013('0x2d')](_[_0x6013('0x37')](_0x532558['query'],_0xf175cf[_0x6013('0x2d')]));if(_0x532558[_0x6013('0x2b')][_0x6013('0x38')]){_0xaa0402[_0x6013('0x36')]=_[_0x6013('0x39')](_0xaa0402[_0x6013('0x36')],{'$or':_['map'](_0xaa0402['attributes'],function(_0x2ef9a7){var _0xccd15d={};_0xccd15d[_0x2ef9a7]={'$like':'%'+_0x532558[_0x6013('0x2b')][_0x6013('0x38')]+'%'};return _0xccd15d;})});}_0xaa0402=_[_0x6013('0x39')]({},_0xaa0402,_0x532558[_0x6013('0x3b')]);return _0x5f1859[_0x6013('0x4a')](_0xaa0402);}})[_0x6013('0x3e')](function(_0x311c91){if(_0x311c91){_0x16d09f=_0x311c91[_0x6013('0x31')];if(!_0x532558[_0x6013('0x2b')][_0x6013('0x32')](_0x6013('0x33'))){_0xaa0402[_0x6013('0x18')]=qs[_0x6013('0x18')](_0x532558['query'][_0x6013('0x18')]);_0xaa0402['offset']=qs['offset'](_0x532558[_0x6013('0x2b')][_0x6013('0x17')]);}return _0x5f1859['getSubjects'](_0xaa0402);}})[_0x6013('0x3e')](function(_0x8db370){if(_0x8db370){return _0x8db370?{'count':_0x16d09f,'rows':_0x8db370}:null;}})['then'](respondWithResult(_0x36a4e6,null))[_0x6013('0x42')](handleError(_0x36a4e6,null));};exports[_0x6013('0x4b')]=function(_0x200716,_0x4ff00d,_0x3fa379){var _0x209989={};var _0x30f3e8={};var _0x17803e;var _0x40ccf6;return db[_0x6013('0x27')]['findOne']({'where':{'id':_0x200716['params']['id']}})[_0x6013('0x3e')](handleEntityNotFound(_0x4ff00d,null))['then'](function(_0x26e2ea){if(_0x26e2ea){_0x17803e=_0x26e2ea;_0x30f3e8[_0x6013('0x2f')]=_['keys'](db[_0x6013('0x49')][_0x6013('0x3f')]);_0x30f3e8[_0x6013('0x2b')]=_[_0x6013('0x2c')](_0x200716['query']);_0x30f3e8['filters']=_[_0x6013('0x2e')](_0x30f3e8['model'],_0x30f3e8[_0x6013('0x2b')]);_0x209989[_0x6013('0x30')]=_['intersection'](_0x30f3e8['model'],qs['fields'](_0x200716['query'][_0x6013('0x40')]));_0x209989[_0x6013('0x30')]=_0x209989[_0x6013('0x30')][_0x6013('0x31')]?_0x209989[_0x6013('0x30')]:_0x30f3e8[_0x6013('0x2f')];_0x209989[_0x6013('0x34')]=qs[_0x6013('0x35')](_0x200716[_0x6013('0x2b')][_0x6013('0x35')]);_0x209989[_0x6013('0x36')]=qs[_0x6013('0x2d')](_[_0x6013('0x37')](_0x200716['query'],_0x30f3e8['filters']));if(_0x200716[_0x6013('0x2b')][_0x6013('0x38')]){_0x209989['where']=_['merge'](_0x209989['where'],{'$or':_[_0x6013('0x26')](_0x209989[_0x6013('0x30')],function(_0x1ff941){var _0x57d904={};_0x57d904[_0x1ff941]={'$like':'%'+_0x200716[_0x6013('0x2b')][_0x6013('0x38')]+'%'};return _0x57d904;})});}_0x209989=_[_0x6013('0x39')]({},_0x209989,_0x200716[_0x6013('0x3b')]);return _0x17803e['getDescriptions'](_0x209989);}})['then'](function(_0x39939a){if(_0x39939a){_0x40ccf6=_0x39939a['length'];if(!_0x200716['query'][_0x6013('0x32')](_0x6013('0x33'))){_0x209989[_0x6013('0x18')]=qs['limit'](_0x200716[_0x6013('0x2b')][_0x6013('0x18')]);_0x209989[_0x6013('0x17')]=qs[_0x6013('0x17')](_0x200716[_0x6013('0x2b')]['offset']);}return _0x17803e[_0x6013('0x4b')](_0x209989);}})[_0x6013('0x3e')](function(_0x10cbf6){if(_0x10cbf6){return _0x10cbf6?{'count':_0x40ccf6,'rows':_0x10cbf6}:null;}})[_0x6013('0x3e')](respondWithResult(_0x4ff00d,null))['catch'](handleError(_0x4ff00d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index c7fe146..c84a0a6 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 _0xb43c=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','SalesforceConfiguration'];(function(_0x2bd491,_0x51cdb1){var _0x2889c2=function(_0x55f343){while(--_0x55f343){_0x2bd491['push'](_0x2bd491['shift']());}};_0x2889c2(++_0x51cdb1);}(_0xb43c,0x104));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcb43('0x0'));var util=require(_0xcb43('0x1'));var logger=require('../../config/logger')(_0xcb43('0x2'));var moment=require(_0xcb43('0x3'));var BPromise=require(_0xcb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb43('0x5'));var rimraf=require(_0xcb43('0x6'));var config=require(_0xcb43('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x2bb846,_0xe2e529){return _0x2bb846[_0xcb43('0x8')](_0xcb43('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06ee=['api','moment','bluebird','path','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','../../config/logger'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x06ee,0xbb));var _0xe06e=function(_0x373d89,_0x3512bb){_0x373d89=_0x373d89-0x0;var _0x372432=_0x06ee[_0x373d89];return _0x372432;};'use strict';var _=require(_0xe06e('0x0'));var util=require('util');var logger=require(_0xe06e('0x1'))(_0xe06e('0x2'));var moment=require(_0xe06e('0x3'));var BPromise=require(_0xe06e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe06e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe06e('0x6'));module[_0xe06e('0x7')]=function(_0x1e4549,_0x5c4685){return _0x1e4549['define']('SalesforceConfiguration',attributes,{'tableName':_0xe06e('0x8'),'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 3088232..d282dd5 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 _0x1e01=['ioredis','../../mysqldb','../../config/environment','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x455bbf,_0x487eb1){var _0x31cc6a=function(_0x510dd8){while(--_0x510dd8){_0x455bbf['push'](_0x455bbf['shift']());}};_0x31cc6a(++_0x487eb1);}(_0x1e01,0xba));var _0x11e0=function(_0x45ec62,_0x11f807){_0x45ec62=_0x45ec62-0x0;var _0xcb5773=_0x1e01[_0x45ec62];return _0xcb5773;};'use strict';var _=require(_0x11e0('0x0'));var util=require(_0x11e0('0x1'));var moment=require(_0x11e0('0x2'));var BPromise=require(_0x11e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11e0('0x4'));var db=require(_0x11e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x11e0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x11e0('0x7')][_0x11e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b529a,_0x3e30aa,_0x53578c){return new BPromise(function(_0x1f67fb,_0x3b64db){return client['request'](_0x3b529a,_0x53578c)['then'](function(_0x4e7391){logger[_0x11e0('0x9')](_0x11e0('0xa'),_0x3e30aa,_0x11e0('0xb'));logger[_0x11e0('0xc')](_0x11e0('0xd'),_0x3e30aa,'request\x20sent',JSON[_0x11e0('0xe')](_0x4e7391));if(_0x4e7391['error']){if(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x10')]===0x1f4){logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x4e7391['error'][_0x11e0('0x11')]);return _0x3b64db(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x11')]);}logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x4e7391[_0x11e0('0xf')]['message']);return _0x1f67fb(_0x4e7391[_0x11e0('0xf')][_0x11e0('0x11')]);}else{logger['info'](_0x11e0('0xa'),_0x3e30aa,_0x11e0('0xb'));_0x1f67fb(_0x4e7391['result'][_0x11e0('0x11')]);}})[_0x11e0('0x12')](function(_0x26bc11){logger[_0x11e0('0xf')](_0x11e0('0xa'),_0x3e30aa,_0x26bc11);_0x3b64db(_0x26bc11);});});} \ No newline at end of file +var _0x9761=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x82031d,_0x379e32){var _0x28608e=function(_0x2011c1){while(--_0x2011c1){_0x82031d['push'](_0x82031d['shift']());}};_0x28608e(++_0x379e32);}(_0x9761,0x8a));var _0x1976=function(_0x43ac48,_0x5026bb){_0x43ac48=_0x43ac48-0x0;var _0x40e095=_0x9761[_0x43ac48];return _0x40e095;};'use strict';var _=require(_0x1976('0x0'));var util=require(_0x1976('0x1'));var moment=require(_0x1976('0x2'));var BPromise=require('bluebird');var rs=require(_0x1976('0x3'));var fs=require('fs');var Redis=require(_0x1976('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1976('0x5'));var logger=require('../../config/logger')(_0x1976('0x6'));var config=require(_0x1976('0x7'));var jayson=require(_0x1976('0x8'));var client=jayson[_0x1976('0x9')][_0x1976('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cb134,_0x15c558,_0x421b0d){return new BPromise(function(_0xa9e2bf,_0x4c3140){return client[_0x1976('0xb')](_0x4cb134,_0x421b0d)[_0x1976('0xc')](function(_0x41411e){logger[_0x1976('0xd')](_0x1976('0xe'),_0x15c558,_0x1976('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x15c558,'request\x20sent',JSON[_0x1976('0x10')](_0x41411e));if(_0x41411e['error']){if(_0x41411e[_0x1976('0x11')][_0x1976('0x12')]===0x1f4){logger[_0x1976('0x11')](_0x1976('0xe'),_0x15c558,_0x41411e[_0x1976('0x11')][_0x1976('0x13')]);return _0x4c3140(_0x41411e['error'][_0x1976('0x13')]);}logger[_0x1976('0x11')](_0x1976('0xe'),_0x15c558,_0x41411e['error'][_0x1976('0x13')]);return _0xa9e2bf(_0x41411e[_0x1976('0x11')][_0x1976('0x13')]);}else{logger[_0x1976('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x15c558,_0x1976('0xf'));_0xa9e2bf(_0x41411e[_0x1976('0x14')][_0x1976('0x13')]);}})[_0x1976('0x15')](function(_0x3de45d){logger[_0x1976('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x15c558,_0x3de45d);_0x4c3140(_0x3de45d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7d18758..b18dceb 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 _0x31ce=['./intSalesforceField.controller','isAuthenticated','index','get','/:id','create','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37ad7a,_0x3d016b){var _0x2d5fa7=function(_0x10ed2e){while(--_0x10ed2e){_0x37ad7a['push'](_0x37ad7a['shift']());}};_0x2d5fa7(++_0x3d016b);}(_0x31ce,0x1aa));var _0xe31c=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x31ce[_0x7a319d];return _0x5c6b4e;};'use strict';var multer=require('multer');var util=require(_0xe31c('0x0'));var path=require('path');var timeout=require(_0xe31c('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe31c('0x2'));var auth=require(_0xe31c('0x3'));var interaction=require(_0xe31c('0x4'));var config=require(_0xe31c('0x5'));var controller=require(_0xe31c('0x6'));router['get']('/',auth[_0xe31c('0x7')](),controller[_0xe31c('0x8')]);router[_0xe31c('0x9')](_0xe31c('0xa'),auth[_0xe31c('0x7')](),controller['show']);router['post']('/',auth[_0xe31c('0x7')](),controller[_0xe31c('0xb')]);router[_0xe31c('0xc')](_0xe31c('0xa'),auth['isAuthenticated'](),controller[_0xe31c('0xd')]);router[_0xe31c('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe31c('0xf')]=router; \ No newline at end of file +var _0x55da=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x38338b,_0x2abdbe){var _0x16bc12=function(_0xe5773a){while(--_0xe5773a){_0x38338b['push'](_0x38338b['shift']());}};_0x16bc12(++_0x2abdbe);}(_0x55da,0xbb));var _0xa55d=function(_0x3cbccf,_0x5ecadc){_0x3cbccf=_0x3cbccf-0x0;var _0x541a7b=_0x55da[_0x3cbccf];return _0x541a7b;};'use strict';var multer=require(_0xa55d('0x0'));var util=require(_0xa55d('0x1'));var path=require(_0xa55d('0x2'));var timeout=require(_0xa55d('0x3'));var express=require(_0xa55d('0x4'));var router=express[_0xa55d('0x5')]();var fs_extra=require(_0xa55d('0x6'));var auth=require(_0xa55d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa55d('0x8'));var controller=require('./intSalesforceField.controller');router[_0xa55d('0x9')]('/',auth[_0xa55d('0xa')](),controller['index']);router[_0xa55d('0x9')](_0xa55d('0xb'),auth['isAuthenticated'](),controller[_0xa55d('0xc')]);router[_0xa55d('0xd')]('/',auth[_0xa55d('0xa')](),controller[_0xa55d('0xe')]);router[_0xa55d('0xf')](_0xa55d('0xb'),auth[_0xa55d('0xa')](),controller[_0xa55d('0x10')]);router['delete'](_0xa55d('0xb'),auth[_0xa55d('0xa')](),controller[_0xa55d('0x11')]);module[_0xa55d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 1be7829..2463835 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 _0x0dfe=['keyValue','picklist','STRING','variable','sequelize','exports','ENUM','string','customVariable'];(function(_0x5b8da7,_0x31be6b){var _0x2a1518=function(_0x426715){while(--_0x426715){_0x5b8da7['push'](_0x5b8da7['shift']());}};_0x2a1518(++_0x31be6b);}(_0x0dfe,0x124));var _0xe0df=function(_0x2fec41,_0x196204){_0x2fec41=_0x2fec41-0x0;var _0x471c1d=_0x0dfe[_0x2fec41];return _0x471c1d;};'use strict';var Sequelize=require(_0xe0df('0x0'));module[_0xe0df('0x1')]={'type':{'type':Sequelize[_0xe0df('0x2')](_0xe0df('0x3'),'variable',_0xe0df('0x4'),_0xe0df('0x5'),_0xe0df('0x6')),'defaultValue':_0xe0df('0x3')},'content':{'type':Sequelize[_0xe0df('0x7')]},'key':{'type':Sequelize[_0xe0df('0x7')]},'keyType':{'type':Sequelize[_0xe0df('0x2')]('string',_0xe0df('0x8'),_0xe0df('0x4'))},'keyContent':{'type':Sequelize[_0xe0df('0x7')]},'idField':{'type':Sequelize[_0xe0df('0x7')]},'variableName':{'type':Sequelize[_0xe0df('0x7')]}}; \ No newline at end of file +var _0xaddb=['customVariable','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x202686,_0x5c3908){var _0x35ade5=function(_0x4b8ed0){while(--_0x4b8ed0){_0x202686['push'](_0x202686['shift']());}};_0x35ade5(++_0x5c3908);}(_0xaddb,0x144));var _0xbadd=function(_0x41c0a0,_0x31fe7f){_0x41c0a0=_0x41c0a0-0x0;var _0x5264a5=_0xaddb[_0x41c0a0];return _0x5264a5;};'use strict';var Sequelize=require(_0xbadd('0x0'));module[_0xbadd('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbadd('0x2'),_0xbadd('0x3'),_0xbadd('0x4'),'keyValue',_0xbadd('0x5')),'defaultValue':_0xbadd('0x2')},'content':{'type':Sequelize[_0xbadd('0x6')]},'key':{'type':Sequelize[_0xbadd('0x6')]},'keyType':{'type':Sequelize[_0xbadd('0x7')](_0xbadd('0x2'),_0xbadd('0x3'),_0xbadd('0x4'))},'keyContent':{'type':Sequelize[_0xbadd('0x6')]},'idField':{'type':Sequelize[_0xbadd('0x6')]},'variableName':{'type':Sequelize[_0xbadd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 4600c6a..cae1b4f 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 _0x3e2b=['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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','save','update','then','destroy','end','stack','name','send','index','map','SalesforceField','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0xac4f72,_0x3e8646){var _0x1ce861=function(_0x1d3403){while(--_0x1d3403){_0xac4f72['push'](_0xac4f72['shift']());}};_0x1ce861(++_0x3e8646);}(_0x3e2b,0xd3));var _0xb3e2=function(_0x10b0cc,_0x2f3482){_0x10b0cc=_0x10b0cc-0x0;var _0x41638c=_0x3e2b[_0x10b0cc];return _0x41638c;};'use strict';var emlformat=require(_0xb3e2('0x0'));var rimraf=require(_0xb3e2('0x1'));var zipdir=require(_0xb3e2('0x2'));var jsonpatch=require(_0xb3e2('0x3'));var rp=require('request-promise');var moment=require(_0xb3e2('0x4'));var BPromise=require(_0xb3e2('0x5'));var Mustache=require('mustache');var util=require(_0xb3e2('0x6'));var path=require(_0xb3e2('0x7'));var sox=require(_0xb3e2('0x8'));var csv=require(_0xb3e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3e2('0xa'));var _=require(_0xb3e2('0xb'));var squel=require('squel');var crypto=require(_0xb3e2('0xc'));var jsforce=require(_0xb3e2('0xd'));var deskjs=require(_0xb3e2('0xe'));var toCsv=require(_0xb3e2('0x9'));var querystring=require(_0xb3e2('0xf'));var Papa=require(_0xb3e2('0x10'));var Redis=require(_0xb3e2('0x11'));var authService=require(_0xb3e2('0x12'));var qs=require(_0xb3e2('0x13'));var as=require(_0xb3e2('0x14'));var hardwareService=require(_0xb3e2('0x15'));var logger=require(_0xb3e2('0x16'))('api');var utils=require(_0xb3e2('0x17'));var config=require(_0xb3e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3e2('0x19'))['db'];function respondWithStatusCode(_0x297720,_0x4acac3){_0x4acac3=_0x4acac3||0xcc;return function(_0x5e9be3){if(_0x5e9be3){return _0x297720[_0xb3e2('0x1a')](_0x4acac3);}return _0x297720['status'](_0x4acac3)['end']();};}function respondWithResult(_0x4d4688,_0x582eb8){_0x582eb8=_0x582eb8||0xc8;return function(_0x4ddb25){if(_0x4ddb25){return _0x4d4688[_0xb3e2('0x1b')](_0x582eb8)[_0xb3e2('0x1c')](_0x4ddb25);}};}function respondWithFilteredResult(_0x9eed7c,_0x48f6d5){return function(_0xd629fe){if(_0xd629fe){var _0x361e79=typeof _0x48f6d5[_0xb3e2('0x1d')]===_0xb3e2('0x1e')&&typeof _0x48f6d5[_0xb3e2('0x1f')]===_0xb3e2('0x1e');var _0x56b9d3=_0xd629fe['count'];var _0x40812b=_0x361e79?0x0:_0x48f6d5[_0xb3e2('0x1d')];var _0x249305=_0x361e79?_0xd629fe['count']:_0x48f6d5[_0xb3e2('0x1d')]+_0x48f6d5[_0xb3e2('0x1f')];var _0x44b6c9;if(_0x249305>=_0x56b9d3){_0x249305=_0x56b9d3;_0x44b6c9=0xc8;}else{_0x44b6c9=0xce;}_0x9eed7c[_0xb3e2('0x1b')](_0x44b6c9);return _0x9eed7c['set'](_0xb3e2('0x20'),_0x40812b+'-'+_0x249305+'/'+_0x56b9d3)[_0xb3e2('0x1c')](_0xd629fe);}return null;};}function patchUpdates(_0x23f108){return function(_0x3633bb){try{jsonpatch[_0xb3e2('0x21')](_0x3633bb,_0x23f108,!![]);}catch(_0x1b7473){return BPromise['reject'](_0x1b7473);}return _0x3633bb[_0xb3e2('0x22')]();};}function saveUpdates(_0x9abdd2,_0x26b06c){return function(_0x193519){if(_0x193519){return _0x193519[_0xb3e2('0x23')](_0x9abdd2)[_0xb3e2('0x24')](function(_0x29b24f){return _0x29b24f;});}return null;};}function removeEntity(_0x4080c6,_0x197f19){return function(_0x734cf2){if(_0x734cf2){return _0x734cf2[_0xb3e2('0x25')]()['then'](function(){_0x4080c6[_0xb3e2('0x1b')](0xcc)[_0xb3e2('0x26')]();});}};}function handleEntityNotFound(_0x669cee,_0x2b34d8){return function(_0x2ed433){if(!_0x2ed433){_0x669cee[_0xb3e2('0x1a')](0x194);}return _0x2ed433;};}function handleError(_0x2b8240,_0xb5165c){_0xb5165c=_0xb5165c||0x1f4;return function(_0x2d13f2){logger['error'](_0x2d13f2[_0xb3e2('0x27')]);if(_0x2d13f2[_0xb3e2('0x28')]){delete _0x2d13f2[_0xb3e2('0x28')];}_0x2b8240[_0xb3e2('0x1b')](_0xb5165c)[_0xb3e2('0x29')](_0x2d13f2);};}exports[_0xb3e2('0x2a')]=function(_0xd22786,_0x317790){var _0x26a0ec={},_0x4058a3={},_0x494478={'count':0x0,'rows':[]};var _0xbb0337=_[_0xb3e2('0x2b')](db[_0xb3e2('0x2c')][_0xb3e2('0x2d')],function(_0x2dd96d){return{'name':_0x2dd96d['fieldName'],'type':_0x2dd96d[_0xb3e2('0x2e')]['key']};});_0x4058a3['model']=_[_0xb3e2('0x2b')](_0xbb0337,_0xb3e2('0x28'));_0x4058a3[_0xb3e2('0x2f')]=_['keys'](_0xd22786[_0xb3e2('0x2f')]);_0x4058a3[_0xb3e2('0x30')]=_[_0xb3e2('0x31')](_0x4058a3['model'],_0x4058a3['query']);_0x26a0ec['attributes']=_[_0xb3e2('0x31')](_0x4058a3[_0xb3e2('0x32')],qs[_0xb3e2('0x33')](_0xd22786['query'][_0xb3e2('0x33')]));_0x26a0ec[_0xb3e2('0x34')]=_0x26a0ec[_0xb3e2('0x34')][_0xb3e2('0x35')]?_0x26a0ec['attributes']:_0x4058a3[_0xb3e2('0x32')];if(!_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x36')](_0xb3e2('0x37'))){_0x26a0ec[_0xb3e2('0x1f')]=qs[_0xb3e2('0x1f')](_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x1f')]);_0x26a0ec[_0xb3e2('0x1d')]=qs[_0xb3e2('0x1d')](_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x1d')]);}_0x26a0ec[_0xb3e2('0x38')]=qs[_0xb3e2('0x39')](_0xd22786['query'][_0xb3e2('0x39')]);_0x26a0ec[_0xb3e2('0x3a')]=qs['filters'](_['pick'](_0xd22786[_0xb3e2('0x2f')],_0x4058a3[_0xb3e2('0x30')]),_0xbb0337);if(_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x3b')]){_0x26a0ec[_0xb3e2('0x3a')]=_[_0xb3e2('0x3c')](_0x26a0ec['where'],{'$or':_[_0xb3e2('0x2b')](_0xbb0337,function(_0x15f54a){if(_0x15f54a[_0xb3e2('0x2e')]!==_0xb3e2('0x3d')){var _0x4184a2={};_0x4184a2[_0x15f54a['name']]={'$like':'%'+_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x3b')]+'%'};return _0x4184a2;}})});}_0x26a0ec=_[_0xb3e2('0x3c')]({},_0x26a0ec,_0xd22786[_0xb3e2('0x3e')]);var _0x324396={'where':_0x26a0ec['where']};return db[_0xb3e2('0x2c')][_0xb3e2('0x3f')](_0x324396)['then'](function(_0x5af8ed){_0x494478['count']=_0x5af8ed;if(_0xd22786[_0xb3e2('0x2f')][_0xb3e2('0x40')]){_0x26a0ec['include']=[{'all':!![]}];}return db[_0xb3e2('0x2c')][_0xb3e2('0x41')](_0x26a0ec);})[_0xb3e2('0x24')](function(_0x24f1cc){_0x494478[_0xb3e2('0x42')]=_0x24f1cc;return _0x494478;})[_0xb3e2('0x24')](respondWithFilteredResult(_0x317790,_0x26a0ec))[_0xb3e2('0x43')](handleError(_0x317790,null));};exports[_0xb3e2('0x44')]=function(_0x25f9d8,_0x4a74bd){var _0x49a0c2={'raw':!![],'where':{'id':_0x25f9d8[_0xb3e2('0x45')]['id']}},_0x94cbc8={};_0x94cbc8[_0xb3e2('0x32')]=_[_0xb3e2('0x46')](db[_0xb3e2('0x2c')][_0xb3e2('0x2d')]);_0x94cbc8[_0xb3e2('0x2f')]=_[_0xb3e2('0x46')](_0x25f9d8[_0xb3e2('0x2f')]);_0x94cbc8[_0xb3e2('0x30')]=_['intersection'](_0x94cbc8[_0xb3e2('0x32')],_0x94cbc8['query']);_0x49a0c2[_0xb3e2('0x34')]=_['intersection'](_0x94cbc8[_0xb3e2('0x32')],qs[_0xb3e2('0x33')](_0x25f9d8[_0xb3e2('0x2f')][_0xb3e2('0x33')]));_0x49a0c2[_0xb3e2('0x34')]=_0x49a0c2[_0xb3e2('0x34')][_0xb3e2('0x35')]?_0x49a0c2[_0xb3e2('0x34')]:_0x94cbc8[_0xb3e2('0x32')];if(_0x25f9d8['query']['includeAll']){_0x49a0c2['include']=[{'all':!![]}];}_0x49a0c2=_[_0xb3e2('0x3c')]({},_0x49a0c2,_0x25f9d8[_0xb3e2('0x3e')]);return db[_0xb3e2('0x2c')]['find'](_0x49a0c2)[_0xb3e2('0x24')](handleEntityNotFound(_0x4a74bd,null))[_0xb3e2('0x24')](respondWithResult(_0x4a74bd,null))[_0xb3e2('0x43')](handleError(_0x4a74bd,null));};exports['create']=function(_0x759302,_0x446476){return db[_0xb3e2('0x2c')][_0xb3e2('0x47')](_0x759302[_0xb3e2('0x48')],{})['then'](respondWithResult(_0x446476,0xc9))[_0xb3e2('0x43')](handleError(_0x446476,null));};exports[_0xb3e2('0x23')]=function(_0x18d382,_0x3c3f6a){if(_0x18d382['body']['id']){delete _0x18d382[_0xb3e2('0x48')]['id'];}return db[_0xb3e2('0x2c')][_0xb3e2('0x49')]({'where':{'id':_0x18d382[_0xb3e2('0x45')]['id']}})[_0xb3e2('0x24')](handleEntityNotFound(_0x3c3f6a,null))[_0xb3e2('0x24')](saveUpdates(_0x18d382['body'],null))[_0xb3e2('0x24')](respondWithResult(_0x3c3f6a,null))[_0xb3e2('0x43')](handleError(_0x3c3f6a,null));};exports['destroy']=function(_0x3cc43a,_0x90447d){return db['SalesforceField']['find']({'where':{'id':_0x3cc43a[_0xb3e2('0x45')]['id']}})[_0xb3e2('0x24')](handleEntityNotFound(_0x90447d,null))['then'](removeEntity(_0x90447d,null))[_0xb3e2('0x43')](handleError(_0x90447d,null));}; \ No newline at end of file +var _0xc9d6=['type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','SalesforceField','include','rows','catch','show','params','keys','intersection','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xc9d6,0x1e9));var _0x6c9d=function(_0x5eb768,_0x2eecfd){_0x5eb768=_0x5eb768-0x0;var _0x44b323=_0xc9d6[_0x5eb768];return _0x44b323;};'use strict';var emlformat=require(_0x6c9d('0x0'));var rimraf=require(_0x6c9d('0x1'));var zipdir=require(_0x6c9d('0x2'));var jsonpatch=require(_0x6c9d('0x3'));var rp=require(_0x6c9d('0x4'));var moment=require(_0x6c9d('0x5'));var BPromise=require(_0x6c9d('0x6'));var Mustache=require(_0x6c9d('0x7'));var util=require(_0x6c9d('0x8'));var path=require('path');var sox=require(_0x6c9d('0x9'));var csv=require('to-csv');var ejs=require(_0x6c9d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c9d('0xb'));var squel=require(_0x6c9d('0xc'));var crypto=require(_0x6c9d('0xd'));var jsforce=require(_0x6c9d('0xe'));var deskjs=require(_0x6c9d('0xf'));var toCsv=require(_0x6c9d('0x10'));var querystring=require(_0x6c9d('0x11'));var Papa=require(_0x6c9d('0x12'));var Redis=require(_0x6c9d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6c9d('0x14'));var as=require(_0x6c9d('0x15'));var hardwareService=require(_0x6c9d('0x16'));var logger=require(_0x6c9d('0x17'))(_0x6c9d('0x18'));var utils=require(_0x6c9d('0x19'));var config=require(_0x6c9d('0x1a'));var licenseUtil=require(_0x6c9d('0x1b'));var db=require(_0x6c9d('0x1c'))['db'];function respondWithStatusCode(_0x9d2108,_0x33c935){_0x33c935=_0x33c935||0xcc;return function(_0x36d41b){if(_0x36d41b){return _0x9d2108['sendStatus'](_0x33c935);}return _0x9d2108['status'](_0x33c935)[_0x6c9d('0x1d')]();};}function respondWithResult(_0x48fcd8,_0x543f20){_0x543f20=_0x543f20||0xc8;return function(_0x33cbf9){if(_0x33cbf9){return _0x48fcd8[_0x6c9d('0x1e')](_0x543f20)['json'](_0x33cbf9);}};}function respondWithFilteredResult(_0x23be3d,_0x9b71de){return function(_0x3bb815){if(_0x3bb815){var _0x4dedb3=typeof _0x9b71de[_0x6c9d('0x1f')]===_0x6c9d('0x20')&&typeof _0x9b71de[_0x6c9d('0x21')]===_0x6c9d('0x20');var _0x4745b9=_0x3bb815[_0x6c9d('0x22')];var _0x7bde95=_0x4dedb3?0x0:_0x9b71de['offset'];var _0x8d94e4=_0x4dedb3?_0x3bb815['count']:_0x9b71de[_0x6c9d('0x1f')]+_0x9b71de[_0x6c9d('0x21')];var _0x4f433e;if(_0x8d94e4>=_0x4745b9){_0x8d94e4=_0x4745b9;_0x4f433e=0xc8;}else{_0x4f433e=0xce;}_0x23be3d[_0x6c9d('0x1e')](_0x4f433e);return _0x23be3d[_0x6c9d('0x23')]('Content-Range',_0x7bde95+'-'+_0x8d94e4+'/'+_0x4745b9)[_0x6c9d('0x24')](_0x3bb815);}return null;};}function patchUpdates(_0x855f07){return function(_0x14073d){try{jsonpatch[_0x6c9d('0x25')](_0x14073d,_0x855f07,!![]);}catch(_0xe1dc75){return BPromise[_0x6c9d('0x26')](_0xe1dc75);}return _0x14073d[_0x6c9d('0x27')]();};}function saveUpdates(_0x4f0a7c,_0x3e577d){return function(_0x1bbfad){if(_0x1bbfad){return _0x1bbfad[_0x6c9d('0x28')](_0x4f0a7c)[_0x6c9d('0x29')](function(_0x108884){return _0x108884;});}return null;};}function removeEntity(_0x3f53c8,_0x1a795b){return function(_0x53cd86){if(_0x53cd86){return _0x53cd86[_0x6c9d('0x2a')]()[_0x6c9d('0x29')](function(){_0x3f53c8[_0x6c9d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5655f9,_0x1d18d8){return function(_0x32fd85){if(!_0x32fd85){_0x5655f9[_0x6c9d('0x2b')](0x194);}return _0x32fd85;};}function handleError(_0x3eea5d,_0x384ee3){_0x384ee3=_0x384ee3||0x1f4;return function(_0x5b5b0d){logger[_0x6c9d('0x2c')](_0x5b5b0d['stack']);if(_0x5b5b0d['name']){delete _0x5b5b0d[_0x6c9d('0x2d')];}_0x3eea5d['status'](_0x384ee3)[_0x6c9d('0x2e')](_0x5b5b0d);};}exports[_0x6c9d('0x2f')]=function(_0x222ebc,_0x5b11c8){var _0x20d9e7={},_0x199aa0={},_0x1c6968={'count':0x0,'rows':[]};var _0x381366=_['map'](db['SalesforceField'][_0x6c9d('0x30')],function(_0x143184){return{'name':_0x143184[_0x6c9d('0x31')],'type':_0x143184[_0x6c9d('0x32')][_0x6c9d('0x33')]};});_0x199aa0[_0x6c9d('0x34')]=_[_0x6c9d('0x35')](_0x381366,_0x6c9d('0x2d'));_0x199aa0[_0x6c9d('0x36')]=_['keys'](_0x222ebc[_0x6c9d('0x36')]);_0x199aa0[_0x6c9d('0x37')]=_['intersection'](_0x199aa0[_0x6c9d('0x34')],_0x199aa0[_0x6c9d('0x36')]);_0x20d9e7[_0x6c9d('0x38')]=_['intersection'](_0x199aa0[_0x6c9d('0x34')],qs[_0x6c9d('0x39')](_0x222ebc['query'][_0x6c9d('0x39')]));_0x20d9e7[_0x6c9d('0x38')]=_0x20d9e7[_0x6c9d('0x38')][_0x6c9d('0x3a')]?_0x20d9e7[_0x6c9d('0x38')]:_0x199aa0['model'];if(!_0x222ebc[_0x6c9d('0x36')][_0x6c9d('0x3b')]('nolimit')){_0x20d9e7['limit']=qs['limit'](_0x222ebc[_0x6c9d('0x36')][_0x6c9d('0x21')]);_0x20d9e7[_0x6c9d('0x1f')]=qs[_0x6c9d('0x1f')](_0x222ebc[_0x6c9d('0x36')][_0x6c9d('0x1f')]);}_0x20d9e7[_0x6c9d('0x3c')]=qs[_0x6c9d('0x3d')](_0x222ebc[_0x6c9d('0x36')]['sort']);_0x20d9e7['where']=qs['filters'](_[_0x6c9d('0x3e')](_0x222ebc[_0x6c9d('0x36')],_0x199aa0[_0x6c9d('0x37')]),_0x381366);if(_0x222ebc[_0x6c9d('0x36')][_0x6c9d('0x3f')]){_0x20d9e7[_0x6c9d('0x40')]=_[_0x6c9d('0x41')](_0x20d9e7[_0x6c9d('0x40')],{'$or':_['map'](_0x381366,function(_0x220dc1){if(_0x220dc1[_0x6c9d('0x32')]!=='VIRTUAL'){var _0x2b70d0={};_0x2b70d0[_0x220dc1['name']]={'$like':'%'+_0x222ebc[_0x6c9d('0x36')][_0x6c9d('0x3f')]+'%'};return _0x2b70d0;}})});}_0x20d9e7=_['merge']({},_0x20d9e7,_0x222ebc[_0x6c9d('0x42')]);var _0x14c58f={'where':_0x20d9e7[_0x6c9d('0x40')]};return db[_0x6c9d('0x43')][_0x6c9d('0x22')](_0x14c58f)[_0x6c9d('0x29')](function(_0x37de7f){_0x1c6968[_0x6c9d('0x22')]=_0x37de7f;if(_0x222ebc[_0x6c9d('0x36')]['includeAll']){_0x20d9e7[_0x6c9d('0x44')]=[{'all':!![]}];}return db[_0x6c9d('0x43')]['findAll'](_0x20d9e7);})['then'](function(_0x1d6fbe){_0x1c6968[_0x6c9d('0x45')]=_0x1d6fbe;return _0x1c6968;})['then'](respondWithFilteredResult(_0x5b11c8,_0x20d9e7))[_0x6c9d('0x46')](handleError(_0x5b11c8,null));};exports[_0x6c9d('0x47')]=function(_0x1a163c,_0x5b1bed){var _0x3ba740={'raw':!![],'where':{'id':_0x1a163c[_0x6c9d('0x48')]['id']}},_0x3e7382={};_0x3e7382['model']=_[_0x6c9d('0x49')](db[_0x6c9d('0x43')][_0x6c9d('0x30')]);_0x3e7382[_0x6c9d('0x36')]=_[_0x6c9d('0x49')](_0x1a163c[_0x6c9d('0x36')]);_0x3e7382[_0x6c9d('0x37')]=_[_0x6c9d('0x4a')](_0x3e7382[_0x6c9d('0x34')],_0x3e7382[_0x6c9d('0x36')]);_0x3ba740[_0x6c9d('0x38')]=_[_0x6c9d('0x4a')](_0x3e7382[_0x6c9d('0x34')],qs[_0x6c9d('0x39')](_0x1a163c[_0x6c9d('0x36')]['fields']));_0x3ba740[_0x6c9d('0x38')]=_0x3ba740[_0x6c9d('0x38')][_0x6c9d('0x3a')]?_0x3ba740[_0x6c9d('0x38')]:_0x3e7382[_0x6c9d('0x34')];if(_0x1a163c[_0x6c9d('0x36')]['includeAll']){_0x3ba740[_0x6c9d('0x44')]=[{'all':!![]}];}_0x3ba740=_['merge']({},_0x3ba740,_0x1a163c['options']);return db['SalesforceField']['find'](_0x3ba740)['then'](handleEntityNotFound(_0x5b1bed,null))[_0x6c9d('0x29')](respondWithResult(_0x5b1bed,null))['catch'](handleError(_0x5b1bed,null));};exports[_0x6c9d('0x4b')]=function(_0x2fcc41,_0x287780){return db[_0x6c9d('0x43')]['create'](_0x2fcc41[_0x6c9d('0x4c')],{})['then'](respondWithResult(_0x287780,0xc9))[_0x6c9d('0x46')](handleError(_0x287780,null));};exports[_0x6c9d('0x28')]=function(_0x2cf59e,_0x589279){if(_0x2cf59e[_0x6c9d('0x4c')]['id']){delete _0x2cf59e[_0x6c9d('0x4c')]['id'];}return db[_0x6c9d('0x43')]['find']({'where':{'id':_0x2cf59e[_0x6c9d('0x48')]['id']}})[_0x6c9d('0x29')](handleEntityNotFound(_0x589279,null))['then'](saveUpdates(_0x2cf59e[_0x6c9d('0x4c')],null))[_0x6c9d('0x29')](respondWithResult(_0x589279,null))[_0x6c9d('0x46')](handleError(_0x589279,null));};exports['destroy']=function(_0x537533,_0x1af6bc){return db[_0x6c9d('0x43')]['find']({'where':{'id':_0x537533[_0x6c9d('0x48')]['id']}})[_0x6c9d('0x29')](handleEntityNotFound(_0x1af6bc,null))[_0x6c9d('0x29')](removeEntity(_0x1af6bc,null))[_0x6c9d('0x46')](handleError(_0x1af6bc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 396fa60..b2d5189 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 _0x9406=['request-promise','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x2d17b0,_0x773ed4){var _0x3af5be=function(_0x3b7704){while(--_0x3b7704){_0x2d17b0['push'](_0x2d17b0['shift']());}};_0x3af5be(++_0x773ed4);}(_0x9406,0x1cf));var _0x6940=function(_0x31d91a,_0x53be16){_0x31d91a=_0x31d91a-0x0;var _0x25f005=_0x9406[_0x31d91a];return _0x25f005;};'use strict';var _=require(_0x6940('0x0'));var util=require(_0x6940('0x1'));var logger=require(_0x6940('0x2'))(_0x6940('0x3'));var moment=require('moment');var BPromise=require(_0x6940('0x4'));var rp=require(_0x6940('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6940('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x6940('0x7')]=function(_0x208e76,_0x2d199c){return _0x208e76[_0x6940('0x8')]('SalesforceField',attributes,{'tableName':_0x6940('0x9'),'paranoid':![],'indexes':[{'name':_0x6940('0xa'),'fields':[_0x6940('0xb'),_0x6940('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c00=['../../config/logger','api','moment','bluebird','request-promise','./intSalesforceField.attributes','define','salesforce_unique_index','idField','lodash'];(function(_0x2c3085,_0x4fc831){var _0x197c2e=function(_0x287fed){while(--_0x287fed){_0x2c3085['push'](_0x2c3085['shift']());}};_0x197c2e(++_0x4fc831);}(_0x2c00,0x1a3));var _0x02c0=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x2c00[_0x7abd7];return _0x3a2577;};'use strict';var _=require(_0x02c0('0x0'));var util=require('util');var logger=require(_0x02c0('0x1'))(_0x02c0('0x2'));var moment=require(_0x02c0('0x3'));var BPromise=require(_0x02c0('0x4'));var rp=require(_0x02c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x02c0('0x6'));module['exports']=function(_0x329e3c,_0x31a425){return _0x329e3c[_0x02c0('0x7')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x02c0('0x8'),'fields':[_0x02c0('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index aeeb0de..33a55f2 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 _0x4583=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x38b6a9,_0x4506aa){var _0x4888bb=function(_0x138c24){while(--_0x138c24){_0x38b6a9['push'](_0x38b6a9['shift']());}};_0x4888bb(++_0x4506aa);}(_0x4583,0x79));var _0x3458=function(_0x349bb4,_0x16f67a){_0x349bb4=_0x349bb4-0x0;var _0x14c8d1=_0x4583[_0x349bb4];return _0x14c8d1;};'use strict';var _=require(_0x3458('0x0'));var util=require('util');var moment=require(_0x3458('0x1'));var BPromise=require('bluebird');var rs=require(_0x3458('0x2'));var fs=require('fs');var Redis=require(_0x3458('0x3'));var db=require(_0x3458('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3458('0x5'));var config=require(_0x3458('0x6'));var jayson=require(_0x3458('0x7'));var client=jayson[_0x3458('0x8')][_0x3458('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x359651,_0x405042,_0x55f67){return new BPromise(function(_0x5059ba,_0x22b833){return client[_0x3458('0xa')](_0x359651,_0x55f67)[_0x3458('0xb')](function(_0x3bb03f){logger[_0x3458('0xc')](_0x3458('0xd'),_0x405042,_0x3458('0xe'));logger[_0x3458('0xf')](_0x3458('0x10'),_0x405042,_0x3458('0xe'),JSON['stringify'](_0x3bb03f));if(_0x3bb03f['error']){if(_0x3bb03f[_0x3458('0x11')][_0x3458('0x12')]===0x1f4){logger['error'](_0x3458('0xd'),_0x405042,_0x3bb03f[_0x3458('0x11')][_0x3458('0x13')]);return _0x22b833(_0x3bb03f[_0x3458('0x11')]['message']);}logger[_0x3458('0x11')](_0x3458('0xd'),_0x405042,_0x3bb03f[_0x3458('0x11')][_0x3458('0x13')]);return _0x5059ba(_0x3bb03f[_0x3458('0x11')]['message']);}else{logger['info'](_0x3458('0xd'),_0x405042,_0x3458('0xe'));_0x5059ba(_0x3bb03f['result'][_0x3458('0x13')]);}})[_0x3458('0x14')](function(_0x419f27){logger[_0x3458('0x11')]('SalesforceField,\x20%s,\x20%s',_0x405042,_0x419f27);_0x22b833(_0x419f27);});});} \ No newline at end of file +var _0x6391=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x6391,0x124));var _0x1639=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x6391[_0x55ff79];return _0x579067;};'use strict';var _=require(_0x1639('0x0'));var util=require(_0x1639('0x1'));var moment=require(_0x1639('0x2'));var BPromise=require(_0x1639('0x3'));var rs=require(_0x1639('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1639('0x5'));var logger=require(_0x1639('0x6'))(_0x1639('0x7'));var config=require('../../config/environment');var jayson=require(_0x1639('0x8'));var client=jayson[_0x1639('0x9')][_0x1639('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e92cd,_0x367731,_0x25e19f){return new BPromise(function(_0x13682f,_0x48557a){return client[_0x1639('0xb')](_0x2e92cd,_0x25e19f)[_0x1639('0xc')](function(_0x14de9b){logger[_0x1639('0xd')](_0x1639('0xe'),_0x367731,_0x1639('0xf'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x367731,_0x1639('0xf'),JSON[_0x1639('0x10')](_0x14de9b));if(_0x14de9b[_0x1639('0x11')]){if(_0x14de9b['error'][_0x1639('0x12')]===0x1f4){logger[_0x1639('0x11')]('SalesforceField,\x20%s,\x20%s',_0x367731,_0x14de9b[_0x1639('0x11')][_0x1639('0x13')]);return _0x48557a(_0x14de9b[_0x1639('0x11')][_0x1639('0x13')]);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x367731,_0x14de9b['error'][_0x1639('0x13')]);return _0x13682f(_0x14de9b['error']['message']);}else{logger[_0x1639('0xd')]('SalesforceField,\x20%s,\x20%s',_0x367731,'request\x20sent');_0x13682f(_0x14de9b[_0x1639('0x14')][_0x1639('0x13')]);}})[_0x1639('0x15')](function(_0x46e19b){logger[_0x1639('0x11')](_0x1639('0xe'),_0x367731,_0x46e19b);_0x48557a(_0x46e19b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5cdce93..00ed93e 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 _0xed7a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x43624a,_0x226995){var _0x4c34a0=function(_0x2d6c6e){while(--_0x2d6c6e){_0x43624a['push'](_0x43624a['shift']());}};_0x4c34a0(++_0x226995);}(_0xed7a,0x9f));var _0xaed7=function(_0x17bf4c,_0x43408b){_0x17bf4c=_0x17bf4c-0x0;var _0x3c1a9a=_0xed7a[_0x17bf4c];return _0x3c1a9a;};'use strict';var multer=require(_0xaed7('0x0'));var util=require(_0xaed7('0x1'));var path=require('path');var timeout=require(_0xaed7('0x2'));var express=require(_0xaed7('0x3'));var router=express[_0xaed7('0x4')]();var fs_extra=require(_0xaed7('0x5'));var auth=require(_0xaed7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaed7('0x7'));var controller=require(_0xaed7('0x8'));router[_0xaed7('0x9')]('/',auth['isAuthenticated'](),controller[_0xaed7('0xa')]);router[_0xaed7('0x9')]('/:id',auth[_0xaed7('0xb')](),controller['show']);router['get'](_0xaed7('0xc'),auth[_0xaed7('0xb')](),controller[_0xaed7('0xd')]);router[_0xaed7('0x9')](_0xaed7('0xe'),auth[_0xaed7('0xb')](),controller['getFields']);router[_0xaed7('0xf')]('/',auth[_0xaed7('0xb')](),controller[_0xaed7('0x10')]);router['post'](_0xaed7('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xaed7('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaed7('0x12')]);router[_0xaed7('0x13')](_0xaed7('0x14'),auth[_0xaed7('0xb')](),controller[_0xaed7('0x15')]);module[_0xaed7('0x16')]=router; \ No newline at end of file +var _0x1177=['/:id','isAuthenticated','/:id/configurations','get','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','index'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x1177,0x10b));var _0x7117=function(_0x212cf2,_0x15e1f3){_0x212cf2=_0x212cf2-0x0;var _0x276211=_0x1177[_0x212cf2];return _0x276211;};'use strict';var multer=require('multer');var util=require(_0x7117('0x0'));var path=require(_0x7117('0x1'));var timeout=require(_0x7117('0x2'));var express=require('express');var router=express[_0x7117('0x3')]();var fs_extra=require(_0x7117('0x4'));var auth=require(_0x7117('0x5'));var interaction=require(_0x7117('0x6'));var config=require('../../config/environment');var controller=require(_0x7117('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7117('0x8')]);router['get'](_0x7117('0x9'),auth[_0x7117('0xa')](),controller['show']);router['get'](_0x7117('0xb'),auth[_0x7117('0xa')](),controller['getConfigurations']);router[_0x7117('0xc')](_0x7117('0xd'),auth[_0x7117('0xa')](),controller[_0x7117('0xe')]);router[_0x7117('0xf')]('/',auth[_0x7117('0xa')](),controller[_0x7117('0x10')]);router[_0x7117('0xf')](_0x7117('0xb'),auth[_0x7117('0xa')](),controller[_0x7117('0x11')]);router[_0x7117('0x12')](_0x7117('0x9'),auth['isAuthenticated'](),controller[_0x7117('0x13')]);router[_0x7117('0x14')](_0x7117('0x9'),auth[_0x7117('0xa')](),controller[_0x7117('0x15')]);module[_0x7117('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ecc2dd3..f14c47c 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 _0xe69b=['sequelize','exports','STRING','remoteUri'];(function(_0x5c715f,_0x1f34fc){var _0x5c3c46=function(_0x28b7ff){while(--_0x28b7ff){_0x5c715f['push'](_0x5c715f['shift']());}};_0x5c3c46(++_0x1f34fc);}(_0xe69b,0x188));var _0xbe69=function(_0x5e1516,_0x1e47fb){_0x5e1516=_0x5e1516-0x0;var _0x2033f1=_0xe69b[_0x5e1516];return _0x2033f1;};'use strict';var Sequelize=require(_0xbe69('0x0'));module[_0xbe69('0x1')]={'name':{'type':Sequelize[_0xbe69('0x2')]},'description':{'type':Sequelize[_0xbe69('0x2')]},'username':{'type':Sequelize[_0xbe69('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xbe69('0x2')]},'email':{'type':Sequelize[_0xbe69('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xbe69('0x3')},'serverUrl':{'type':Sequelize[_0xbe69('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x97cb=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1ca561,_0x20b458){var _0x5e137c=function(_0xbb0974){while(--_0xbb0974){_0x1ca561['push'](_0x1ca561['shift']());}};_0x5e137c(++_0x20b458);}(_0x97cb,0x1db));var _0xb97c=function(_0x2b9dd9,_0x11fa58){_0x2b9dd9=_0x2b9dd9-0x0;var _0x3a60d1=_0x97cb[_0x2b9dd9];return _0x3a60d1;};'use strict';var Sequelize=require(_0xb97c('0x0'));module[_0xb97c('0x1')]={'name':{'type':Sequelize[_0xb97c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb97c('0x2')],'unique':_0xb97c('0x3')},'password':{'type':Sequelize[_0xb97c('0x2')]},'email':{'type':Sequelize[_0xb97c('0x2')]},'remoteUri':{'type':Sequelize[_0xb97c('0x2')],'unique':_0xb97c('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index bd08451..7e8e8bb 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 _0x90a0=['work_start','assignment_group','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','problem_id','reassignment_count','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','email','remoteUri','serverUrl','slice','lastIndexOf','format','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','internalType','label','push','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','forEach','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','map','merge','options','ServicenowAccount','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','nolimit','addConfiguration','AccountId','channel','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','delivery_task'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x90a0,0x1a0));var _0x090a=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x90a0[_0xfcbcb8];return _0x1b1f97;};'use strict';var emlformat=require(_0x090a('0x0'));var rimraf=require(_0x090a('0x1'));var zipdir=require(_0x090a('0x2'));var jsonpatch=require(_0x090a('0x3'));var rp=require(_0x090a('0x4'));var moment=require(_0x090a('0x5'));var BPromise=require(_0x090a('0x6'));var Mustache=require(_0x090a('0x7'));var util=require(_0x090a('0x8'));var path=require(_0x090a('0x9'));var sox=require(_0x090a('0xa'));var csv=require(_0x090a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x090a('0xc'));var _=require(_0x090a('0xd'));var squel=require(_0x090a('0xe'));var crypto=require(_0x090a('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x090a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x090a('0x11'));var qs=require(_0x090a('0x12'));var as=require(_0x090a('0x13'));var hardwareService=require(_0x090a('0x14'));var logger=require(_0x090a('0x15'))(_0x090a('0x16'));var utils=require(_0x090a('0x17'));var config=require(_0x090a('0x18'));var licenseUtil=require(_0x090a('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a30bf,_0x4af287){_0x4af287=_0x4af287||0xcc;return function(_0x11e576){if(_0x11e576){return _0x5a30bf[_0x090a('0x1a')](_0x4af287);}return _0x5a30bf[_0x090a('0x1b')](_0x4af287)['end']();};}function respondWithResult(_0x1fce2f,_0x434236){_0x434236=_0x434236||0xc8;return function(_0x295db6){if(_0x295db6){return _0x1fce2f[_0x090a('0x1b')](_0x434236)[_0x090a('0x1c')](_0x295db6);}};}function respondWithFilteredResult(_0x57f39a,_0x4f5578){return function(_0x11ff44){if(_0x11ff44){var _0x5e4f3b=typeof _0x4f5578[_0x090a('0x1d')]==='undefined'&&typeof _0x4f5578[_0x090a('0x1e')]===_0x090a('0x1f');var _0x17c325=_0x11ff44[_0x090a('0x20')];var _0x59f65d=_0x5e4f3b?0x0:_0x4f5578[_0x090a('0x1d')];var _0x9623d4=_0x5e4f3b?_0x11ff44[_0x090a('0x20')]:_0x4f5578[_0x090a('0x1d')]+_0x4f5578['limit'];var _0x5bb75d;if(_0x9623d4>=_0x17c325){_0x9623d4=_0x17c325;_0x5bb75d=0xc8;}else{_0x5bb75d=0xce;}_0x57f39a[_0x090a('0x1b')](_0x5bb75d);return _0x57f39a[_0x090a('0x21')](_0x090a('0x22'),_0x59f65d+'-'+_0x9623d4+'/'+_0x17c325)['json'](_0x11ff44);}return null;};}function patchUpdates(_0x3b1cf3){return function(_0x2d4f39){try{jsonpatch[_0x090a('0x23')](_0x2d4f39,_0x3b1cf3,!![]);}catch(_0x508c22){return BPromise[_0x090a('0x24')](_0x508c22);}return _0x2d4f39['save']();};}function saveUpdates(_0xe4c60c,_0x12a708){return function(_0x557d05){if(_0x557d05){return _0x557d05[_0x090a('0x25')](_0xe4c60c)[_0x090a('0x26')](function(_0x5d5f2c){return _0x5d5f2c;});}return null;};}function removeEntity(_0x421686,_0x17b602){return function(_0x58f4e6){if(_0x58f4e6){return _0x58f4e6[_0x090a('0x27')]()[_0x090a('0x26')](function(){_0x421686[_0x090a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x63670c,_0x4ad4c0){return function(_0x406ee8){if(!_0x406ee8){_0x63670c[_0x090a('0x1a')](0x194);}return _0x406ee8;};}function handleError(_0xf8bdf2,_0x12c61f){_0x12c61f=_0x12c61f||0x1f4;return function(_0x21740c){logger[_0x090a('0x28')](_0x21740c[_0x090a('0x29')]);if(_0x21740c[_0x090a('0x2a')]){delete _0x21740c['name'];}_0xf8bdf2[_0x090a('0x1b')](_0x12c61f)[_0x090a('0x2b')](_0x21740c);};}exports[_0x090a('0x2c')]=function(_0x5cc8a5,_0x41c015){var _0x337229={},_0x407b16={},_0xb7cfbc={'count':0x0,'rows':[]};var _0x5415be=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x4fc3f7){return{'name':_0x4fc3f7[_0x090a('0x2d')],'type':_0x4fc3f7[_0x090a('0x2e')][_0x090a('0x2f')]};});_0x407b16['model']=_['map'](_0x5415be,'name');_0x407b16['query']=_['keys'](_0x5cc8a5[_0x090a('0x30')]);_0x407b16[_0x090a('0x31')]=_[_0x090a('0x32')](_0x407b16[_0x090a('0x33')],_0x407b16[_0x090a('0x30')]);_0x337229['attributes']=_[_0x090a('0x32')](_0x407b16[_0x090a('0x33')],qs['fields'](_0x5cc8a5[_0x090a('0x30')][_0x090a('0x34')]));_0x337229[_0x090a('0x35')]=_0x337229[_0x090a('0x35')][_0x090a('0x36')]?_0x337229[_0x090a('0x35')]:_0x407b16[_0x090a('0x33')];if(!_0x5cc8a5[_0x090a('0x30')][_0x090a('0x37')]('nolimit')){_0x337229[_0x090a('0x1e')]=qs['limit'](_0x5cc8a5['query'][_0x090a('0x1e')]);_0x337229[_0x090a('0x1d')]=qs[_0x090a('0x1d')](_0x5cc8a5[_0x090a('0x30')][_0x090a('0x1d')]);}_0x337229[_0x090a('0x38')]=qs[_0x090a('0x39')](_0x5cc8a5[_0x090a('0x30')]['sort']);_0x337229[_0x090a('0x3a')]=qs[_0x090a('0x31')](_[_0x090a('0x3b')](_0x5cc8a5[_0x090a('0x30')],_0x407b16[_0x090a('0x31')]),_0x5415be);if(_0x5cc8a5[_0x090a('0x30')]['filter']){_0x337229[_0x090a('0x3a')]=_['merge'](_0x337229[_0x090a('0x3a')],{'$or':_[_0x090a('0x3c')](_0x5415be,function(_0x13a3c8){if(_0x13a3c8[_0x090a('0x2e')]!=='VIRTUAL'){var _0x4cb91d={};_0x4cb91d[_0x13a3c8['name']]={'$like':'%'+_0x5cc8a5[_0x090a('0x30')]['filter']+'%'};return _0x4cb91d;}})});}_0x337229=_[_0x090a('0x3d')]({},_0x337229,_0x5cc8a5[_0x090a('0x3e')]);var _0x24c373={'where':_0x337229[_0x090a('0x3a')]};return db['ServicenowAccount']['count'](_0x24c373)[_0x090a('0x26')](function(_0x1c92dc){_0xb7cfbc[_0x090a('0x20')]=_0x1c92dc;if(_0x5cc8a5[_0x090a('0x30')]['includeAll']){_0x337229['include']=[{'all':!![]}];}return db[_0x090a('0x3f')][_0x090a('0x40')](_0x337229);})[_0x090a('0x26')](function(_0x38d0c4){_0xb7cfbc[_0x090a('0x41')]=_0x38d0c4;return _0xb7cfbc;})['then'](respondWithFilteredResult(_0x41c015,_0x337229))[_0x090a('0x42')](handleError(_0x41c015,null));};exports[_0x090a('0x43')]=function(_0x53889c,_0x5d542c){var _0x5b88b6={'raw':![],'where':{'id':_0x53889c['params']['id']}},_0x32ad62={};_0x32ad62[_0x090a('0x33')]=_[_0x090a('0x44')](db[_0x090a('0x3f')]['rawAttributes']);_0x32ad62[_0x090a('0x30')]=_[_0x090a('0x44')](_0x53889c['query']);_0x32ad62['filters']=_['intersection'](_0x32ad62[_0x090a('0x33')],_0x32ad62[_0x090a('0x30')]);_0x5b88b6[_0x090a('0x35')]=_[_0x090a('0x32')](_0x32ad62[_0x090a('0x33')],qs['fields'](_0x53889c[_0x090a('0x30')][_0x090a('0x34')]));_0x5b88b6[_0x090a('0x35')]=_0x5b88b6[_0x090a('0x35')][_0x090a('0x36')]?_0x5b88b6['attributes']:_0x32ad62[_0x090a('0x33')];if(_0x53889c['query'][_0x090a('0x45')]){_0x5b88b6[_0x090a('0x46')]=[{'all':!![]}];}_0x5b88b6=_[_0x090a('0x3d')]({},_0x5b88b6,_0x53889c[_0x090a('0x3e')]);return db[_0x090a('0x3f')][_0x090a('0x47')](_0x5b88b6)[_0x090a('0x26')](handleEntityNotFound(_0x5d542c,null))[_0x090a('0x26')](respondWithResult(_0x5d542c,null))[_0x090a('0x42')](handleError(_0x5d542c,null));};exports[_0x090a('0x48')]=function(_0x5c9e87,_0x1cf91a){return db[_0x090a('0x3f')][_0x090a('0x48')](_0x5c9e87['body'],{})[_0x090a('0x26')](respondWithResult(_0x1cf91a,0xc9))['catch'](handleError(_0x1cf91a,null));};exports[_0x090a('0x25')]=function(_0x49e8c6,_0x512cc6){if(_0x49e8c6[_0x090a('0x49')]['id']){delete _0x49e8c6['body']['id'];}return db['ServicenowAccount'][_0x090a('0x47')]({'where':{'id':_0x49e8c6['params']['id']}})['then'](handleEntityNotFound(_0x512cc6,null))[_0x090a('0x26')](saveUpdates(_0x49e8c6['body'],null))[_0x090a('0x26')](respondWithResult(_0x512cc6,null))['catch'](handleError(_0x512cc6,null));};exports[_0x090a('0x27')]=function(_0x1505fd,_0x160c56){return db[_0x090a('0x3f')][_0x090a('0x47')]({'where':{'id':_0x1505fd[_0x090a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x160c56,null))[_0x090a('0x26')](removeEntity(_0x160c56,null))[_0x090a('0x42')](handleError(_0x160c56,null));};exports[_0x090a('0x4b')]=function(_0x13f670,_0x4866b4,_0x2b52b7){var _0x485427={};var _0x48d44e={};var _0x20341b;var _0x320ae2;return db[_0x090a('0x3f')][_0x090a('0x4c')]({'where':{'id':_0x13f670[_0x090a('0x4a')]['id']}})[_0x090a('0x26')](handleEntityNotFound(_0x4866b4,null))[_0x090a('0x26')](function(_0x1725fa){if(_0x1725fa){_0x20341b=_0x1725fa;_0x48d44e[_0x090a('0x33')]=_[_0x090a('0x44')](db[_0x090a('0x4d')][_0x090a('0x4e')]);_0x48d44e[_0x090a('0x30')]=_[_0x090a('0x44')](_0x13f670[_0x090a('0x30')]);_0x48d44e['filters']=_['intersection'](_0x48d44e[_0x090a('0x33')],_0x48d44e[_0x090a('0x30')]);_0x485427[_0x090a('0x35')]=_[_0x090a('0x32')](_0x48d44e[_0x090a('0x33')],qs['fields'](_0x13f670[_0x090a('0x30')][_0x090a('0x34')]));_0x485427['attributes']=_0x485427[_0x090a('0x35')][_0x090a('0x36')]?_0x485427[_0x090a('0x35')]:_0x48d44e[_0x090a('0x33')];_0x485427[_0x090a('0x38')]=qs[_0x090a('0x39')](_0x13f670[_0x090a('0x30')][_0x090a('0x39')]);_0x485427[_0x090a('0x3a')]=qs['filters'](_[_0x090a('0x3b')](_0x13f670[_0x090a('0x30')],_0x48d44e[_0x090a('0x31')]));if(_0x13f670[_0x090a('0x30')]['filter']){_0x485427['where']=_['merge'](_0x485427[_0x090a('0x3a')],{'$or':_['map'](_0x485427[_0x090a('0x35')],function(_0x30524e){var _0x51103d={};_0x51103d[_0x30524e]={'$like':'%'+_0x13f670[_0x090a('0x30')]['filter']+'%'};return _0x51103d;})});}_0x485427=_[_0x090a('0x3d')]({},_0x485427,_0x13f670[_0x090a('0x3e')]);return _0x20341b[_0x090a('0x4b')](_0x485427);}})[_0x090a('0x26')](function(_0x13c36c){if(_0x13c36c){_0x320ae2=_0x13c36c[_0x090a('0x36')];if(!_0x13f670['query'][_0x090a('0x37')](_0x090a('0x4f'))){_0x485427[_0x090a('0x1e')]=qs[_0x090a('0x1e')](_0x13f670[_0x090a('0x30')][_0x090a('0x1e')]);_0x485427[_0x090a('0x1d')]=qs[_0x090a('0x1d')](_0x13f670['query'][_0x090a('0x1d')]);}return _0x20341b[_0x090a('0x4b')](_0x485427);}})[_0x090a('0x26')](function(_0x3ed7df){if(_0x3ed7df){return _0x3ed7df?{'count':_0x320ae2,'rows':_0x3ed7df}:null;}})[_0x090a('0x26')](respondWithResult(_0x4866b4,null))[_0x090a('0x42')](handleError(_0x4866b4,null));};exports[_0x090a('0x50')]=function(_0x38fe12,_0x2a10b1,_0x422c0c){if(_0x38fe12['body']['id']){delete _0x38fe12[_0x090a('0x49')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x38fe12[_0x090a('0x4a')]['id']}})[_0x090a('0x26')](handleEntityNotFound(_0x2a10b1,null))[_0x090a('0x26')](function(_0x4471ec){if(_0x4471ec){_0x38fe12[_0x090a('0x49')][_0x090a('0x51')]=_0x4471ec['id'];_0x38fe12[_0x090a('0x49')]['Subjects']=integrations['getSubjects'](_0x38fe12[_0x090a('0x49')][_0x090a('0x52')],_0x38fe12[_0x090a('0x49')]['type']);_0x38fe12[_0x090a('0x49')]['Descriptions']=integrations[_0x090a('0x53')](_0x38fe12['body'][_0x090a('0x52')],_0x38fe12['body']['type']);return db[_0x090a('0x4d')]['create'](_0x38fe12[_0x090a('0x49')],{'include':[{'model':db[_0x090a('0x54')],'as':_0x090a('0x55')},{'model':db[_0x090a('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2a10b1,null))[_0x090a('0x42')](handleError(_0x2a10b1,null));};exports[_0x090a('0x56')]=function(_0x4463a8,_0x5a2b30,_0x3329b1){var _0x5c9107=[_0x090a('0x57'),_0x090a('0x58'),_0x090a('0x59'),_0x090a('0x5a'),_0x090a('0x5b'),_0x090a('0x5c'),'incident_state',_0x090a('0x5d'),_0x090a('0x5e')];var _0x309c9f=[_0x090a('0x5f'),_0x090a('0x57'),_0x090a('0x60'),_0x090a('0x61'),_0x090a('0x62'),_0x090a('0x63'),_0x090a('0x64'),_0x090a('0x58'),_0x090a('0x65'),_0x090a('0x66'),_0x090a('0x67'),'sys_updated_by',_0x090a('0x68'),_0x090a('0x69'),'sys_created_on',_0x090a('0x6a'),_0x090a('0x6b'),_0x090a('0x6c'),'knowledge',_0x090a('0x38'),'calendar_stc','closed_at',_0x090a('0x6d'),_0x090a('0x6e'),_0x090a('0x6f'),'active',_0x090a('0x70'),_0x090a('0x71'),'priority',_0x090a('0x72'),'rfc','time_worked','expected_start',_0x090a('0x73'),_0x090a('0x74'),'group_list',_0x090a('0x75'),_0x090a('0x76'),_0x090a('0x77'),'caller_id',_0x090a('0x78'),_0x090a('0x5a'),_0x090a('0x79'),_0x090a('0x7a'),'close_code','correlation_display',_0x090a('0x7b'),_0x090a('0x7c'),_0x090a('0x7d'),'business_stc','additional_assignee_list',_0x090a('0x7e'),_0x090a('0x7f'),_0x090a('0x5c'),_0x090a('0x80'),'close_notes',_0x090a('0x81'),_0x090a('0x82'),_0x090a('0x83'),'sys_id',_0x090a('0x84'),_0x090a('0x85'),_0x090a('0x86'),'urgency',_0x090a('0x87'),'company',_0x090a('0x88'),'activity_due',_0x090a('0x89'),_0x090a('0x5d'),_0x090a('0x8a'),'sla_due',_0x090a('0x8b'),_0x090a('0x8c'),_0x090a('0x8d'),_0x090a('0x8e'),_0x090a('0x8f'),_0x090a('0x90'),'escalation',_0x090a('0x91'),_0x090a('0x92'),_0x090a('0x93'),'category'];var _0x556241='';var _0x42435f='';var _0x76f459=[];var _0x52f26d='';var _0x555a7f='';var _0x29568d=[];var _0x678bec='';var _0xed6533='';var _0x208394={};var _0x5cf1ab='';return db[_0x090a('0x3f')][_0x090a('0x4c')]({'where':{'id':_0x4463a8[_0x090a('0x4a')]['id']},'attributes':['id',_0x090a('0x94'),'password',_0x090a('0x95'),_0x090a('0x96'),_0x090a('0x97')]})[_0x090a('0x26')](handleEntityNotFound(_0x5a2b30,null))[_0x090a('0x26')](function(_0x5b23d2){if(_0x5b23d2){_0x5cf1ab=_0x5b23d2[_0x090a('0x96')];var _0x4bd7a1=_0x5cf1ab[_0x090a('0x98')](-0x1);if(_0x4bd7a1==='/'){_0x5cf1ab=_0x5cf1ab['substring'](0x0,_0x5cf1ab[_0x090a('0x99')](_0x4bd7a1));}_0xed6533=util['format']('%s/api/now/doc/table/schema/',_0x5cf1ab);_0x678bec=util[_0x090a('0x9a')]('%s/api/now/table/',_0x5cf1ab);_0x208394={'user':_0x5b23d2['username'],'pass':_0x5b23d2[_0x090a('0x9b')]};var _0x340e52={'method':_0x090a('0x9c'),'uri':_0xed6533+_0x090a('0x9d'),'auth':_0x208394,'json':!![]};return rp(_0x340e52);}})[_0x090a('0x26')](function(_0x3ade6b){if(_0x3ade6b[_0x090a('0x9e')][_0x090a('0x36')]>0x0){_0x556241=_0x3ade6b[_0x090a('0x9e')];}console[_0x090a('0x9f')](_0x090a('0xa0'),_0x556241);_0x29568d=[];_0x42435f=Object[_0x090a('0xa1')]([],_0x556241);_['remove'](_0x42435f,function(_0x41def2){return!_0x5c9107['includes'](_0x41def2[_0x090a('0x2a')]);});_0x42435f['forEach'](function(_0x25c0a2){var _0xc000eb=createFieldObject(_0x678bec,_0x208394,_0x25c0a2[_0x090a('0xa2')],_0x25c0a2[_0x090a('0x2a')],_0x25c0a2[_0x090a('0xa3')],![]);_0x29568d[_0x090a('0xa4')](_0xc000eb);});return Promise['all'](_0x29568d);})[_0x090a('0x26')](function(_0x293fe3){_0x76f459=_0x293fe3;_0x52f26d=Object[_0x090a('0xa1')]([],_0x556241);console[_0x090a('0x9f')]('TCL:\x20_object',_0x556241);_['remove'](_0x52f26d,function(_0x489d7b){return _0x309c9f[_0x090a('0xa5')](_0x489d7b[_0x090a('0x2a')]);});console[_0x090a('0x9f')](_0x090a('0xa6'),_0x52f26d);_0x29568d=[];_0x52f26d['forEach'](function(_0x36fc12){var _0x2b2740=createFieldObject(_0x678bec,_0x208394,_0x36fc12[_0x090a('0xa2')],_0x36fc12[_0x090a('0x2a')],_0x36fc12[_0x090a('0xa3')],!![]);_0x29568d[_0x090a('0xa4')](_0x2b2740);});return Promise[_0x090a('0xa7')](_0x29568d);})[_0x090a('0x26')](function(_0x1b76e1){_0x555a7f=_0x1b76e1;var _0x23b34e=_0x76f459[_0x090a('0xa8')](_0x555a7f);return{'count':_0x23b34e['length'],'rows':_0x23b34e};})[_0x090a('0x26')](respondWithResult(_0x5a2b30,null))[_0x090a('0x42')](function(_0x3510f4){console['log'](_0x090a('0xa9')+_0x3510f4);var _0x5a32c1=_0x4463a8[_0x090a('0x30')]['test']?0x1f4:_0x3510f4[_0x090a('0xaa')]||0x1f4;logger['error'](_0x3510f4[_0x090a('0x29')]);delete _0x3510f4[_0x090a('0x2a')];if(_0x5a32c1===0x191){_0x5a32c1=0x190;}_0x5a2b30[_0x090a('0x1b')](_0x5a32c1)[_0x090a('0x2b')](_0x4463a8[_0x090a('0x30')][_0x090a('0xab')]?{'message':_0x090a('0xac'),'statusCode':_0x3510f4['statusCode']}:_0x3510f4);});};function createFieldObject(_0x34a921,_0x598aff,_0x196d7b,_0x2f7abd,_0x51e3a1,_0xf703dd){return new Promise(function(_0x4900b3,_0x4a7a42){var _0x3ee093={'id':_0x2f7abd,'name':_0x51e3a1,'custom':_0xf703dd};if(_0x196d7b==='boolean'){_0x3ee093[_0x090a('0x3e')]=[{'name':_0x090a('0xad'),'value':_0x090a('0xae')},{'name':_0x090a('0xaf'),'value':_0x090a('0xb0')}];_0x4900b3(_0x3ee093);}else{var _0x2d320d={'method':_0x090a('0x9c'),'uri':_0x34a921+'sys_choice?sysparm_query=name=incident^element='+_0x2f7abd,'auth':_0x598aff,'json':!![]};return rp(_0x2d320d)[_0x090a('0x26')](function(_0xc8daaa){var _0x159f27=[];if(_0xc8daaa[_0x090a('0x9e')]['length']>0x0){_0xc8daaa[_0x090a('0x9e')][_0x090a('0xb1')](function(_0x54a3d7){if(_0x54a3d7[_0x090a('0xb2')]===_0x090a('0xb0')){var _0x39a26e={'name':_0x54a3d7[_0x090a('0xa3')],'value':_0x54a3d7[_0x090a('0xb3')]};_0x159f27[_0x090a('0xa4')](_0x39a26e);}});}_0x3ee093[_0x090a('0x3e')]=_0x159f27;if(_0x3ee093[_0x090a('0x3e')][_0x090a('0x36')]>0x0){_0x4900b3(_0x3ee093);}else{if(_0xf703dd==![]){_0x4900b3();}else{_0x4900b3(_0x3ee093);}}});}});} \ No newline at end of file +var _0xc1b5=['hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','filter','includeAll','include','show','params','length','find','catch','create','body','findOne','ServicenowConfiguration','order','options','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','active','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','close_notes','follow_up','sys_id','contact_type','reopened_by','urgency','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','ServiceNow\x20error:\x20','statusCode','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x54ee20,_0x1c2fa7){var _0x4ce8ac=function(_0x4a577e){while(--_0x4a577e){_0x54ee20['push'](_0x54ee20['shift']());}};_0x4ce8ac(++_0x1c2fa7);}(_0xc1b5,0x1e4));var _0x5c1b=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0xc1b5[_0x179e11];return _0x549f04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c1b('0x0'));var zipdir=require(_0x5c1b('0x1'));var jsonpatch=require(_0x5c1b('0x2'));var rp=require(_0x5c1b('0x3'));var moment=require(_0x5c1b('0x4'));var BPromise=require(_0x5c1b('0x5'));var Mustache=require(_0x5c1b('0x6'));var util=require(_0x5c1b('0x7'));var path=require(_0x5c1b('0x8'));var sox=require(_0x5c1b('0x9'));var csv=require('to-csv');var ejs=require(_0x5c1b('0xa'));var fs=require('fs');var fs_extra=require(_0x5c1b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c1b('0xc'));var jsforce=require(_0x5c1b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c1b('0xe'));var querystring=require(_0x5c1b('0xf'));var Papa=require(_0x5c1b('0x10'));var Redis=require(_0x5c1b('0x11'));var authService=require(_0x5c1b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c1b('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5c1b('0x14'));var config=require(_0x5c1b('0x15'));var licenseUtil=require(_0x5c1b('0x16'));var db=require(_0x5c1b('0x17'))['db'];var integrations=require(_0x5c1b('0x18'));function respondWithStatusCode(_0x173317,_0x513896){_0x513896=_0x513896||0xcc;return function(_0x3219c0){if(_0x3219c0){return _0x173317[_0x5c1b('0x19')](_0x513896);}return _0x173317[_0x5c1b('0x1a')](_0x513896)[_0x5c1b('0x1b')]();};}function respondWithResult(_0x4b7ed8,_0x1a78b5){_0x1a78b5=_0x1a78b5||0xc8;return function(_0x21a604){if(_0x21a604){return _0x4b7ed8[_0x5c1b('0x1a')](_0x1a78b5)[_0x5c1b('0x1c')](_0x21a604);}};}function respondWithFilteredResult(_0x535ad5,_0x3a8d31){return function(_0x549b6f){if(_0x549b6f){var _0x3e2ae3=typeof _0x3a8d31[_0x5c1b('0x1d')]===_0x5c1b('0x1e')&&typeof _0x3a8d31[_0x5c1b('0x1f')]===_0x5c1b('0x1e');var _0x45ee1d=_0x549b6f['count'];var _0x2b1525=_0x3e2ae3?0x0:_0x3a8d31[_0x5c1b('0x1d')];var _0x4268c9=_0x3e2ae3?_0x549b6f[_0x5c1b('0x20')]:_0x3a8d31[_0x5c1b('0x1d')]+_0x3a8d31[_0x5c1b('0x1f')];var _0x4f6823;if(_0x4268c9>=_0x45ee1d){_0x4268c9=_0x45ee1d;_0x4f6823=0xc8;}else{_0x4f6823=0xce;}_0x535ad5[_0x5c1b('0x1a')](_0x4f6823);return _0x535ad5[_0x5c1b('0x21')](_0x5c1b('0x22'),_0x2b1525+'-'+_0x4268c9+'/'+_0x45ee1d)['json'](_0x549b6f);}return null;};}function patchUpdates(_0x45e008){return function(_0x4e4061){try{jsonpatch['apply'](_0x4e4061,_0x45e008,!![]);}catch(_0x4aa3c0){return BPromise[_0x5c1b('0x23')](_0x4aa3c0);}return _0x4e4061['save']();};}function saveUpdates(_0x125b13,_0x4d92e7){return function(_0x561026){if(_0x561026){return _0x561026[_0x5c1b('0x24')](_0x125b13)[_0x5c1b('0x25')](function(_0x10663d){return _0x10663d;});}return null;};}function removeEntity(_0x313727,_0x3b350a){return function(_0x4bd752){if(_0x4bd752){return _0x4bd752[_0x5c1b('0x26')]()[_0x5c1b('0x25')](function(){_0x313727['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb37cee,_0x2a9492){return function(_0x3b4ac5){if(!_0x3b4ac5){_0xb37cee[_0x5c1b('0x19')](0x194);}return _0x3b4ac5;};}function handleError(_0x415eeb,_0x3bd032){_0x3bd032=_0x3bd032||0x1f4;return function(_0x40e406){logger[_0x5c1b('0x27')](_0x40e406[_0x5c1b('0x28')]);if(_0x40e406[_0x5c1b('0x29')]){delete _0x40e406[_0x5c1b('0x29')];}_0x415eeb['status'](_0x3bd032)[_0x5c1b('0x2a')](_0x40e406);};}exports[_0x5c1b('0x2b')]=function(_0x8c87bc,_0x5ef3f8){var _0x2fada6={},_0x2a0007={},_0x245fce={'count':0x0,'rows':[]};var _0x3f26a8=_['map'](db[_0x5c1b('0x2c')][_0x5c1b('0x2d')],function(_0xb026cc){return{'name':_0xb026cc[_0x5c1b('0x2e')],'type':_0xb026cc[_0x5c1b('0x2f')][_0x5c1b('0x30')]};});_0x2a0007[_0x5c1b('0x31')]=_['map'](_0x3f26a8,_0x5c1b('0x29'));_0x2a0007[_0x5c1b('0x32')]=_[_0x5c1b('0x33')](_0x8c87bc[_0x5c1b('0x32')]);_0x2a0007[_0x5c1b('0x34')]=_[_0x5c1b('0x35')](_0x2a0007['model'],_0x2a0007[_0x5c1b('0x32')]);_0x2fada6[_0x5c1b('0x36')]=_[_0x5c1b('0x35')](_0x2a0007[_0x5c1b('0x31')],qs['fields'](_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x37')]));_0x2fada6[_0x5c1b('0x36')]=_0x2fada6[_0x5c1b('0x36')]['length']?_0x2fada6[_0x5c1b('0x36')]:_0x2a0007[_0x5c1b('0x31')];if(!_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x38')](_0x5c1b('0x39'))){_0x2fada6['limit']=qs[_0x5c1b('0x1f')](_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x1f')]);_0x2fada6['offset']=qs['offset'](_0x8c87bc['query'][_0x5c1b('0x1d')]);}_0x2fada6['order']=qs[_0x5c1b('0x3a')](_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x3a')]);_0x2fada6['where']=qs[_0x5c1b('0x34')](_[_0x5c1b('0x3b')](_0x8c87bc[_0x5c1b('0x32')],_0x2a0007[_0x5c1b('0x34')]),_0x3f26a8);if(_0x8c87bc[_0x5c1b('0x32')]['filter']){_0x2fada6[_0x5c1b('0x3c')]=_[_0x5c1b('0x3d')](_0x2fada6[_0x5c1b('0x3c')],{'$or':_[_0x5c1b('0x3e')](_0x3f26a8,function(_0x5a8e5a){if(_0x5a8e5a[_0x5c1b('0x2f')]!==_0x5c1b('0x3f')){var _0x5a848a={};_0x5a848a[_0x5a8e5a[_0x5c1b('0x29')]]={'$like':'%'+_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x40')]+'%'};return _0x5a848a;}})});}_0x2fada6=_['merge']({},_0x2fada6,_0x8c87bc['options']);var _0x2b62f8={'where':_0x2fada6[_0x5c1b('0x3c')]};return db[_0x5c1b('0x2c')][_0x5c1b('0x20')](_0x2b62f8)[_0x5c1b('0x25')](function(_0x6196ec){_0x245fce[_0x5c1b('0x20')]=_0x6196ec;if(_0x8c87bc[_0x5c1b('0x32')][_0x5c1b('0x41')]){_0x2fada6[_0x5c1b('0x42')]=[{'all':!![]}];}return db[_0x5c1b('0x2c')]['findAll'](_0x2fada6);})[_0x5c1b('0x25')](function(_0x3a8d1f){_0x245fce['rows']=_0x3a8d1f;return _0x245fce;})['then'](respondWithFilteredResult(_0x5ef3f8,_0x2fada6))['catch'](handleError(_0x5ef3f8,null));};exports[_0x5c1b('0x43')]=function(_0x28d827,_0x5addc2){var _0x319e10={'raw':![],'where':{'id':_0x28d827[_0x5c1b('0x44')]['id']}},_0x3904e6={};_0x3904e6[_0x5c1b('0x31')]=_['keys'](db[_0x5c1b('0x2c')][_0x5c1b('0x2d')]);_0x3904e6[_0x5c1b('0x32')]=_[_0x5c1b('0x33')](_0x28d827['query']);_0x3904e6[_0x5c1b('0x34')]=_['intersection'](_0x3904e6[_0x5c1b('0x31')],_0x3904e6[_0x5c1b('0x32')]);_0x319e10[_0x5c1b('0x36')]=_[_0x5c1b('0x35')](_0x3904e6[_0x5c1b('0x31')],qs[_0x5c1b('0x37')](_0x28d827[_0x5c1b('0x32')][_0x5c1b('0x37')]));_0x319e10['attributes']=_0x319e10[_0x5c1b('0x36')][_0x5c1b('0x45')]?_0x319e10[_0x5c1b('0x36')]:_0x3904e6[_0x5c1b('0x31')];if(_0x28d827[_0x5c1b('0x32')][_0x5c1b('0x41')]){_0x319e10[_0x5c1b('0x42')]=[{'all':!![]}];}_0x319e10=_[_0x5c1b('0x3d')]({},_0x319e10,_0x28d827['options']);return db[_0x5c1b('0x2c')][_0x5c1b('0x46')](_0x319e10)[_0x5c1b('0x25')](handleEntityNotFound(_0x5addc2,null))['then'](respondWithResult(_0x5addc2,null))[_0x5c1b('0x47')](handleError(_0x5addc2,null));};exports[_0x5c1b('0x48')]=function(_0x5875d7,_0x3b9547){return db[_0x5c1b('0x2c')][_0x5c1b('0x48')](_0x5875d7[_0x5c1b('0x49')],{})[_0x5c1b('0x25')](respondWithResult(_0x3b9547,0xc9))[_0x5c1b('0x47')](handleError(_0x3b9547,null));};exports['update']=function(_0x33e4d9,_0x254278){if(_0x33e4d9[_0x5c1b('0x49')]['id']){delete _0x33e4d9[_0x5c1b('0x49')]['id'];}return db[_0x5c1b('0x2c')][_0x5c1b('0x46')]({'where':{'id':_0x33e4d9[_0x5c1b('0x44')]['id']}})[_0x5c1b('0x25')](handleEntityNotFound(_0x254278,null))[_0x5c1b('0x25')](saveUpdates(_0x33e4d9[_0x5c1b('0x49')],null))['then'](respondWithResult(_0x254278,null))[_0x5c1b('0x47')](handleError(_0x254278,null));};exports['destroy']=function(_0x32bf55,_0x38f502){return db[_0x5c1b('0x2c')]['find']({'where':{'id':_0x32bf55[_0x5c1b('0x44')]['id']}})[_0x5c1b('0x25')](handleEntityNotFound(_0x38f502,null))[_0x5c1b('0x25')](removeEntity(_0x38f502,null))[_0x5c1b('0x47')](handleError(_0x38f502,null));};exports['getConfigurations']=function(_0x422f8b,_0x2424f1,_0x239890){var _0x599eb0={};var _0x3e2bb3={};var _0x149fc0;var _0x553806;return db[_0x5c1b('0x2c')][_0x5c1b('0x4a')]({'where':{'id':_0x422f8b['params']['id']}})[_0x5c1b('0x25')](handleEntityNotFound(_0x2424f1,null))[_0x5c1b('0x25')](function(_0x44fde4){if(_0x44fde4){_0x149fc0=_0x44fde4;_0x3e2bb3[_0x5c1b('0x31')]=_[_0x5c1b('0x33')](db[_0x5c1b('0x4b')][_0x5c1b('0x2d')]);_0x3e2bb3['query']=_[_0x5c1b('0x33')](_0x422f8b[_0x5c1b('0x32')]);_0x3e2bb3[_0x5c1b('0x34')]=_['intersection'](_0x3e2bb3[_0x5c1b('0x31')],_0x3e2bb3[_0x5c1b('0x32')]);_0x599eb0['attributes']=_[_0x5c1b('0x35')](_0x3e2bb3[_0x5c1b('0x31')],qs[_0x5c1b('0x37')](_0x422f8b[_0x5c1b('0x32')][_0x5c1b('0x37')]));_0x599eb0[_0x5c1b('0x36')]=_0x599eb0[_0x5c1b('0x36')][_0x5c1b('0x45')]?_0x599eb0[_0x5c1b('0x36')]:_0x3e2bb3['model'];_0x599eb0[_0x5c1b('0x4c')]=qs[_0x5c1b('0x3a')](_0x422f8b[_0x5c1b('0x32')][_0x5c1b('0x3a')]);_0x599eb0[_0x5c1b('0x3c')]=qs['filters'](_[_0x5c1b('0x3b')](_0x422f8b[_0x5c1b('0x32')],_0x3e2bb3[_0x5c1b('0x34')]));if(_0x422f8b[_0x5c1b('0x32')][_0x5c1b('0x40')]){_0x599eb0[_0x5c1b('0x3c')]=_[_0x5c1b('0x3d')](_0x599eb0[_0x5c1b('0x3c')],{'$or':_['map'](_0x599eb0[_0x5c1b('0x36')],function(_0x228b35){var _0x5f3a35={};_0x5f3a35[_0x228b35]={'$like':'%'+_0x422f8b[_0x5c1b('0x32')][_0x5c1b('0x40')]+'%'};return _0x5f3a35;})});}_0x599eb0=_[_0x5c1b('0x3d')]({},_0x599eb0,_0x422f8b[_0x5c1b('0x4d')]);return _0x149fc0[_0x5c1b('0x4e')](_0x599eb0);}})[_0x5c1b('0x25')](function(_0x2effdd){if(_0x2effdd){_0x553806=_0x2effdd[_0x5c1b('0x45')];if(!_0x422f8b['query'][_0x5c1b('0x38')](_0x5c1b('0x39'))){_0x599eb0[_0x5c1b('0x1f')]=qs[_0x5c1b('0x1f')](_0x422f8b['query'][_0x5c1b('0x1f')]);_0x599eb0['offset']=qs['offset'](_0x422f8b['query'][_0x5c1b('0x1d')]);}return _0x149fc0['getConfigurations'](_0x599eb0);}})[_0x5c1b('0x25')](function(_0x13dcca){if(_0x13dcca){return _0x13dcca?{'count':_0x553806,'rows':_0x13dcca}:null;}})['then'](respondWithResult(_0x2424f1,null))[_0x5c1b('0x47')](handleError(_0x2424f1,null));};exports[_0x5c1b('0x4f')]=function(_0x207767,_0x2dc3ee,_0x50d1d2){if(_0x207767[_0x5c1b('0x49')]['id']){delete _0x207767[_0x5c1b('0x49')]['id'];}return db['ServicenowAccount'][_0x5c1b('0x4a')]({'where':{'id':_0x207767[_0x5c1b('0x44')]['id']}})[_0x5c1b('0x25')](handleEntityNotFound(_0x2dc3ee,null))[_0x5c1b('0x25')](function(_0x11ba0a){if(_0x11ba0a){_0x207767[_0x5c1b('0x49')][_0x5c1b('0x50')]=_0x11ba0a['id'];_0x207767[_0x5c1b('0x49')][_0x5c1b('0x51')]=integrations['getSubjects'](_0x207767[_0x5c1b('0x49')][_0x5c1b('0x52')],_0x207767[_0x5c1b('0x49')]['type']);_0x207767[_0x5c1b('0x49')]['Descriptions']=integrations[_0x5c1b('0x53')](_0x207767[_0x5c1b('0x49')][_0x5c1b('0x52')],_0x207767[_0x5c1b('0x49')][_0x5c1b('0x2f')]);return db[_0x5c1b('0x4b')]['create'](_0x207767['body'],{'include':[{'model':db[_0x5c1b('0x54')],'as':_0x5c1b('0x51')},{'model':db[_0x5c1b('0x54')],'as':_0x5c1b('0x55')}]});}return null;})[_0x5c1b('0x25')](respondWithResult(_0x2dc3ee,null))[_0x5c1b('0x47')](handleError(_0x2dc3ee,null));};exports[_0x5c1b('0x56')]=function(_0x34a577,_0x4c6f99,_0x4166ee){var _0x2ec101=['made_sla',_0x5c1b('0x57'),_0x5c1b('0x58'),_0x5c1b('0x59'),_0x5c1b('0x5a'),_0x5c1b('0x5b'),_0x5c1b('0x5c'),'severity',_0x5c1b('0x5d')];var _0x3e9177=[_0x5c1b('0x5e'),_0x5c1b('0x5f'),_0x5c1b('0x60'),'watch_list',_0x5c1b('0x61'),_0x5c1b('0x62'),_0x5c1b('0x63'),'hold_reason',_0x5c1b('0x64'),_0x5c1b('0x65'),_0x5c1b('0x66'),'sys_updated_by',_0x5c1b('0x67'),_0x5c1b('0x68'),_0x5c1b('0x69'),_0x5c1b('0x6a'),_0x5c1b('0x6b'),'sys_created_by','knowledge',_0x5c1b('0x4c'),_0x5c1b('0x6c'),'closed_at',_0x5c1b('0x6d'),_0x5c1b('0x6e'),'impact',_0x5c1b('0x6f'),'work_notes_list',_0x5c1b('0x70'),_0x5c1b('0x71'),'sys_domain_path',_0x5c1b('0x72'),_0x5c1b('0x73'),_0x5c1b('0x74'),_0x5c1b('0x75'),_0x5c1b('0x76'),'group_list',_0x5c1b('0x77'),_0x5c1b('0x78'),'resolved_at',_0x5c1b('0x79'),_0x5c1b('0x7a'),'subcategory','work_notes',_0x5c1b('0x7b'),'close_code',_0x5c1b('0x7c'),_0x5c1b('0x7d'),_0x5c1b('0x7e'),'assignment_group','business_stc',_0x5c1b('0x7f'),'description','calendar_duration','notify','sys_class_name',_0x5c1b('0x80'),'closed_by',_0x5c1b('0x81'),'parent_incident',_0x5c1b('0x82'),_0x5c1b('0x83'),_0x5c1b('0x84'),_0x5c1b('0x5c'),_0x5c1b('0x85'),'problem_id','company','reassignment_count',_0x5c1b('0x86'),_0x5c1b('0x87'),_0x5c1b('0x88'),_0x5c1b('0x89'),_0x5c1b('0x8a'),_0x5c1b('0x8b'),_0x5c1b('0x8c'),_0x5c1b('0x8d'),_0x5c1b('0x8e'),_0x5c1b('0x8f'),_0x5c1b('0x90'),_0x5c1b('0x91'),_0x5c1b('0x92'),_0x5c1b('0x93'),_0x5c1b('0x94'),'category'];var _0x19ff1c='';var _0x144125='';var _0x44a28a=[];var _0x4c1034='';var _0x553d7b='';var _0xe001ac=[];var _0x327843='';var _0xbd86b8='';var _0x57bf7b={};var _0x1e8ac1='';return db[_0x5c1b('0x2c')][_0x5c1b('0x4a')]({'where':{'id':_0x34a577['params']['id']},'attributes':['id',_0x5c1b('0x95'),_0x5c1b('0x96'),_0x5c1b('0x97'),_0x5c1b('0x98'),_0x5c1b('0x99')]})['then'](handleEntityNotFound(_0x4c6f99,null))[_0x5c1b('0x25')](function(_0x409dd6){if(_0x409dd6){_0x1e8ac1=_0x409dd6[_0x5c1b('0x98')];var _0xcc2292=_0x1e8ac1['slice'](-0x1);if(_0xcc2292==='/'){_0x1e8ac1=_0x1e8ac1['substring'](0x0,_0x1e8ac1['lastIndexOf'](_0xcc2292));}_0xbd86b8=util[_0x5c1b('0x9a')](_0x5c1b('0x9b'),_0x1e8ac1);_0x327843=util[_0x5c1b('0x9a')](_0x5c1b('0x9c'),_0x1e8ac1);_0x57bf7b={'user':_0x409dd6[_0x5c1b('0x95')],'pass':_0x409dd6[_0x5c1b('0x96')]};var _0xdd46a7={'method':_0x5c1b('0x9d'),'uri':_0xbd86b8+_0x5c1b('0x9e'),'auth':_0x57bf7b,'json':!![]};return rp(_0xdd46a7);}})['then'](function(_0x32e408){if(_0x32e408[_0x5c1b('0x9f')][_0x5c1b('0x45')]>0x0){_0x19ff1c=_0x32e408['result'];}console[_0x5c1b('0xa0')](_0x5c1b('0xa1'),_0x19ff1c);_0xe001ac=[];_0x144125=Object[_0x5c1b('0xa2')]([],_0x19ff1c);_[_0x5c1b('0xa3')](_0x144125,function(_0x1627a9){return!_0x2ec101[_0x5c1b('0xa4')](_0x1627a9[_0x5c1b('0x29')]);});_0x144125[_0x5c1b('0xa5')](function(_0x36362e){var _0x1cca95=createFieldObject(_0x327843,_0x57bf7b,_0x36362e[_0x5c1b('0xa6')],_0x36362e['name'],_0x36362e[_0x5c1b('0xa7')],![]);_0xe001ac[_0x5c1b('0xa8')](_0x1cca95);});return Promise['all'](_0xe001ac);})[_0x5c1b('0x25')](function(_0x35c257){_0x44a28a=_0x35c257;_0x4c1034=Object[_0x5c1b('0xa2')]([],_0x19ff1c);console[_0x5c1b('0xa0')](_0x5c1b('0xa9'),_0x19ff1c);_[_0x5c1b('0xa3')](_0x4c1034,function(_0xaa55c6){return _0x3e9177[_0x5c1b('0xa4')](_0xaa55c6[_0x5c1b('0x29')]);});console[_0x5c1b('0xa0')](_0x5c1b('0xaa'),_0x4c1034);_0xe001ac=[];_0x4c1034[_0x5c1b('0xa5')](function(_0x2f7441){var _0x8d5ed9=createFieldObject(_0x327843,_0x57bf7b,_0x2f7441[_0x5c1b('0xa6')],_0x2f7441['name'],_0x2f7441[_0x5c1b('0xa7')],!![]);_0xe001ac['push'](_0x8d5ed9);});return Promise[_0x5c1b('0xab')](_0xe001ac);})[_0x5c1b('0x25')](function(_0x2a311d){_0x553d7b=_0x2a311d;var _0xe8a270=_0x44a28a['concat'](_0x553d7b);return{'count':_0xe8a270[_0x5c1b('0x45')],'rows':_0xe8a270};})[_0x5c1b('0x25')](respondWithResult(_0x4c6f99,null))['catch'](function(_0x262113){console[_0x5c1b('0xa0')](_0x5c1b('0xac')+_0x262113);var _0x1002eb=_0x34a577[_0x5c1b('0x32')]['test']?0x1f4:_0x262113[_0x5c1b('0xad')]||0x1f4;logger[_0x5c1b('0x27')](_0x262113[_0x5c1b('0x28')]);delete _0x262113['name'];if(_0x1002eb===0x191){_0x1002eb=0x190;}_0x4c6f99[_0x5c1b('0x1a')](_0x1002eb)[_0x5c1b('0x2a')](_0x34a577[_0x5c1b('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x262113[_0x5c1b('0xad')]}:_0x262113);});};function createFieldObject(_0x2e3017,_0x3ec16f,_0x27c99e,_0x44ac6e,_0x3b13c4,_0x519c46){return new Promise(function(_0x34d874,_0x3baef5){var _0xca9d00={'id':_0x44ac6e,'name':_0x3b13c4,'custom':_0x519c46};if(_0x27c99e===_0x5c1b('0xae')){_0xca9d00[_0x5c1b('0x4d')]=[{'name':'True','value':'true'},{'name':_0x5c1b('0xaf'),'value':_0x5c1b('0xb0')}];_0x34d874(_0xca9d00);}else{var _0x25a463={'method':_0x5c1b('0x9d'),'uri':_0x2e3017+_0x5c1b('0xb1')+_0x44ac6e,'auth':_0x3ec16f,'json':!![]};return rp(_0x25a463)[_0x5c1b('0x25')](function(_0xe8802){var _0x7472c1=[];if(_0xe8802['result'][_0x5c1b('0x45')]>0x0){_0xe8802[_0x5c1b('0x9f')]['forEach'](function(_0x6f137e){if(_0x6f137e[_0x5c1b('0xb2')]===_0x5c1b('0xb0')){var _0x1601d9={'name':_0x6f137e[_0x5c1b('0xa7')],'value':_0x6f137e[_0x5c1b('0xb3')]};_0x7472c1['push'](_0x1601d9);}});}_0xca9d00[_0x5c1b('0x4d')]=_0x7472c1;if(_0xca9d00['options'][_0x5c1b('0x45')]>0x0){_0x34d874(_0xca9d00);}else{if(_0x519c46==![]){_0x34d874();}else{_0x34d874(_0xca9d00);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f0fe16f..04bd9ab 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 _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0xbb193c,_0x3aec46){var _0x40b7f5=function(_0x36b3e9){while(--_0x36b3e9){_0xbb193c['push'](_0xbb193c['shift']());}};_0x40b7f5(++_0x3aec46);}(_0xa630,0xbe));var _0x0a63=function(_0x4fd404,_0x286ba0){_0x4fd404=_0x4fd404-0x0;var _0x3a7983=_0xa630[_0x4fd404];return _0x3a7983;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x23d426,_0x52b818){var _0x35f6f0=function(_0x3eb16a){while(--_0x3eb16a){_0x23d426['push'](_0x23d426['shift']());}};_0x35f6f0(++_0x52b818);}(_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'));var integrations=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'int_servicenow_accounts','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 5e5eec9..aa6638e 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 _0x9db3=['code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','catch','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9db3,0xde));var _0x39db=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9db3[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x39db('0x0'));var util=require(_0x39db('0x1'));var moment=require(_0x39db('0x2'));var BPromise=require(_0x39db('0x3'));var rs=require(_0x39db('0x4'));var fs=require('fs');var Redis=require(_0x39db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x39db('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x39db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17915f,_0x312906,_0x2188d2){return new BPromise(function(_0x219c26,_0x44f94e){return client[_0x39db('0x8')](_0x17915f,_0x2188d2)[_0x39db('0x9')](function(_0x173a29){logger[_0x39db('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x312906,'request\x20sent');logger[_0x39db('0xb')](_0x39db('0xc'),_0x312906,_0x39db('0xd'),JSON[_0x39db('0xe')](_0x173a29));if(_0x173a29[_0x39db('0xf')]){if(_0x173a29['error'][_0x39db('0x10')]===0x1f4){logger['error'](_0x39db('0x11'),_0x312906,_0x173a29[_0x39db('0xf')][_0x39db('0x12')]);return _0x44f94e(_0x173a29[_0x39db('0xf')][_0x39db('0x12')]);}logger[_0x39db('0xf')](_0x39db('0x11'),_0x312906,_0x173a29[_0x39db('0xf')]['message']);return _0x219c26(_0x173a29['error'][_0x39db('0x12')]);}else{logger['info'](_0x39db('0x11'),_0x312906,_0x39db('0xd'));_0x219c26(_0x173a29[_0x39db('0x13')][_0x39db('0x12')]);}})['catch'](function(_0x526198){logger[_0x39db('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x312906,_0x526198);_0x44f94e(_0x526198);});});}exports[_0x39db('0x14')]=function(_0x2f28a8){var _0x2653fc=this;return new Promise(function(_0x221794,_0x281e87){return db['ServicenowAccount'][_0x39db('0x15')]({'raw':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x17')]===undefined?!![]:![]:!![],'where':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options']['where']||null:null,'attributes':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x18')]||null:null,'limit':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8[_0x39db('0x16')][_0x39db('0x19')]||null:null,'include':_0x2f28a8[_0x39db('0x16')]?_0x2f28a8['options'][_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x2f28a8[_0x39db('0x16')][_0x39db('0x1a')],function(_0x51cde6){return{'model':db[_0x51cde6[_0x39db('0x1c')]],'as':_0x51cde6['as'],'attributes':_0x51cde6[_0x39db('0x18')],'include':_0x51cde6[_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x51cde6['include'],function(_0x556948){return{'model':db[_0x556948[_0x39db('0x1c')]],'as':_0x556948['as'],'attributes':_0x556948[_0x39db('0x18')],'include':_0x556948[_0x39db('0x1a')]?_['map'](_0x556948[_0x39db('0x1a')],function(_0x17ca00){return{'model':db[_0x17ca00[_0x39db('0x1c')]],'as':_0x17ca00['as'],'attributes':_0x17ca00['attributes']};}):[]};}):[]};}):[]:[]})[_0x39db('0x9')](function(_0x43f1ab){logger['info'](_0x39db('0x14'),_0x2f28a8);logger[_0x39db('0xb')](_0x39db('0x14'),_0x2f28a8,JSON[_0x39db('0xe')](_0x43f1ab));_0x221794(_0x43f1ab);})[_0x39db('0x1d')](function(_0x3fc259){logger[_0x39db('0xf')](_0x39db('0x14'),_0x3fc259[_0x39db('0x12')],_0x2f28a8);_0x281e87(_0x2653fc['error'](0x1f4,_0x3fc259['message']));});});};exports[_0x39db('0x1e')]=function(_0x494c08){var _0x1c6fe5=this;return new Promise(function(_0x178423,_0x207a72){return db[_0x39db('0x1f')][_0x39db('0x20')]({'raw':_0x494c08[_0x39db('0x16')]?_0x494c08[_0x39db('0x16')][_0x39db('0x17')]===undefined?!![]:![]:!![],'where':_0x494c08[_0x39db('0x16')]?_0x494c08[_0x39db('0x16')][_0x39db('0x21')]||null:null,'attributes':_0x494c08['options']?_0x494c08[_0x39db('0x16')][_0x39db('0x18')]||null:null,'include':_0x494c08['options']?_0x494c08[_0x39db('0x16')]['include']?_[_0x39db('0x1b')](_0x494c08['options'][_0x39db('0x1a')],function(_0x1273f1){return{'model':db[_0x1273f1[_0x39db('0x1c')]],'as':_0x1273f1['as'],'attributes':_0x1273f1[_0x39db('0x18')],'include':_0x1273f1[_0x39db('0x1a')]?_[_0x39db('0x1b')](_0x1273f1['include'],function(_0x31270c){return{'model':db[_0x31270c[_0x39db('0x1c')]],'as':_0x31270c['as'],'attributes':_0x31270c[_0x39db('0x18')],'include':_0x31270c['include']?_[_0x39db('0x1b')](_0x31270c[_0x39db('0x1a')],function(_0x803902){return{'model':db[_0x803902['model']],'as':_0x803902['as'],'attributes':_0x803902[_0x39db('0x18')]};}):[]};}):[]};}):[]:[]})[_0x39db('0x9')](function(_0x17b15a){logger[_0x39db('0xa')](_0x39db('0x1e'),_0x494c08);logger[_0x39db('0xb')]('ShowServicenowAccount',_0x494c08,JSON[_0x39db('0xe')](_0x17b15a));_0x178423(_0x17b15a);})['catch'](function(_0x59530d){logger[_0x39db('0xf')](_0x39db('0x1e'),_0x59530d['message'],_0x494c08);_0x207a72(_0x1c6fe5[_0x39db('0xf')](0x1f4,_0x59530d['message']));});});}; \ No newline at end of file +var _0x6bee=['ShowServicenowAccount','raw','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','ServicenowAccount','findAll','options','where','attributes','include','model','map','then','GetServicenowAccount','catch'];(function(_0x5ca360,_0x52bd82){var _0x48ccc0=function(_0x1fc0de){while(--_0x1fc0de){_0x5ca360['push'](_0x5ca360['shift']());}};_0x48ccc0(++_0x52bd82);}(_0x6bee,0x1e2));var _0xe6be=function(_0x40e6a6,_0x4bfd4c){_0x40e6a6=_0x40e6a6-0x0;var _0x10805d=_0x6bee[_0x40e6a6];return _0x10805d;};'use strict';var _=require('lodash');var util=require(_0xe6be('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6be('0x1'));var db=require(_0xe6be('0x2'))['db'];var utils=require(_0xe6be('0x3'));var logger=require(_0xe6be('0x4'))(_0xe6be('0x5'));var config=require(_0xe6be('0x6'));var jayson=require(_0xe6be('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36bc18,_0x2e2a4f,_0x264964){return new BPromise(function(_0x1169df,_0x3fe020){return client[_0xe6be('0x8')](_0x36bc18,_0x264964)['then'](function(_0x212acb){logger[_0xe6be('0x9')](_0xe6be('0xa'),_0x2e2a4f,'request\x20sent');logger[_0xe6be('0xb')](_0xe6be('0xc'),_0x2e2a4f,_0xe6be('0xd'),JSON['stringify'](_0x212acb));if(_0x212acb['error']){if(_0x212acb[_0xe6be('0xe')]['code']===0x1f4){logger['error'](_0xe6be('0xa'),_0x2e2a4f,_0x212acb[_0xe6be('0xe')][_0xe6be('0xf')]);return _0x3fe020(_0x212acb[_0xe6be('0xe')][_0xe6be('0xf')]);}logger[_0xe6be('0xe')](_0xe6be('0xa'),_0x2e2a4f,_0x212acb[_0xe6be('0xe')]['message']);return _0x1169df(_0x212acb[_0xe6be('0xe')][_0xe6be('0xf')]);}else{logger[_0xe6be('0x9')]('ServicenowAccount,\x20%s,\x20%s',_0x2e2a4f,_0xe6be('0xd'));_0x1169df(_0x212acb[_0xe6be('0x10')]['message']);}})['catch'](function(_0x230276){logger[_0xe6be('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x2e2a4f,_0x230276);_0x3fe020(_0x230276);});});}exports['GetServicenowAccount']=function(_0x171516){var _0x871a29=this;return new Promise(function(_0x3ede53,_0x1f7722){return db[_0xe6be('0x11')][_0xe6be('0x12')]({'raw':_0x171516['options']?_0x171516[_0xe6be('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x171516[_0xe6be('0x13')]?_0x171516[_0xe6be('0x13')][_0xe6be('0x14')]||null:null,'attributes':_0x171516[_0xe6be('0x13')]?_0x171516[_0xe6be('0x13')][_0xe6be('0x15')]||null:null,'limit':_0x171516[_0xe6be('0x13')]?_0x171516['options']['limit']||null:null,'include':_0x171516[_0xe6be('0x13')]?_0x171516[_0xe6be('0x13')][_0xe6be('0x16')]?_['map'](_0x171516[_0xe6be('0x13')][_0xe6be('0x16')],function(_0x13b78d){return{'model':db[_0x13b78d[_0xe6be('0x17')]],'as':_0x13b78d['as'],'attributes':_0x13b78d[_0xe6be('0x15')],'include':_0x13b78d[_0xe6be('0x16')]?_['map'](_0x13b78d[_0xe6be('0x16')],function(_0x52e61d){return{'model':db[_0x52e61d[_0xe6be('0x17')]],'as':_0x52e61d['as'],'attributes':_0x52e61d[_0xe6be('0x15')],'include':_0x52e61d['include']?_[_0xe6be('0x18')](_0x52e61d[_0xe6be('0x16')],function(_0x556c6f){return{'model':db[_0x556c6f['model']],'as':_0x556c6f['as'],'attributes':_0x556c6f[_0xe6be('0x15')]};}):[]};}):[]};}):[]:[]})[_0xe6be('0x19')](function(_0x2ab00b){logger[_0xe6be('0x9')](_0xe6be('0x1a'),_0x171516);logger[_0xe6be('0xb')](_0xe6be('0x1a'),_0x171516,JSON['stringify'](_0x2ab00b));_0x3ede53(_0x2ab00b);})[_0xe6be('0x1b')](function(_0x9b99c0){logger[_0xe6be('0xe')](_0xe6be('0x1a'),_0x9b99c0['message'],_0x171516);_0x1f7722(_0x871a29['error'](0x1f4,_0x9b99c0[_0xe6be('0xf')]));});});};exports[_0xe6be('0x1c')]=function(_0x39d1e1){var _0x53d54f=this;return new Promise(function(_0x48ff54,_0x557e50){return db['ServicenowAccount']['find']({'raw':_0x39d1e1[_0xe6be('0x13')]?_0x39d1e1[_0xe6be('0x13')][_0xe6be('0x1d')]===undefined?!![]:![]:!![],'where':_0x39d1e1[_0xe6be('0x13')]?_0x39d1e1[_0xe6be('0x13')][_0xe6be('0x14')]||null:null,'attributes':_0x39d1e1[_0xe6be('0x13')]?_0x39d1e1[_0xe6be('0x13')][_0xe6be('0x15')]||null:null,'include':_0x39d1e1['options']?_0x39d1e1['options'][_0xe6be('0x16')]?_['map'](_0x39d1e1['options']['include'],function(_0x5261a8){return{'model':db[_0x5261a8['model']],'as':_0x5261a8['as'],'attributes':_0x5261a8[_0xe6be('0x15')],'include':_0x5261a8[_0xe6be('0x16')]?_[_0xe6be('0x18')](_0x5261a8[_0xe6be('0x16')],function(_0xd1c429){return{'model':db[_0xd1c429[_0xe6be('0x17')]],'as':_0xd1c429['as'],'attributes':_0xd1c429[_0xe6be('0x15')],'include':_0xd1c429[_0xe6be('0x16')]?_[_0xe6be('0x18')](_0xd1c429[_0xe6be('0x16')],function(_0x115fea){return{'model':db[_0x115fea[_0xe6be('0x17')]],'as':_0x115fea['as'],'attributes':_0x115fea[_0xe6be('0x15')]};}):[]};}):[]};}):[]:[]})[_0xe6be('0x19')](function(_0x2ee787){logger['info'](_0xe6be('0x1c'),_0x39d1e1);logger['debug']('ShowServicenowAccount',_0x39d1e1,JSON['stringify'](_0x2ee787));_0x48ff54(_0x2ee787);})[_0xe6be('0x1b')](function(_0x3fcb02){logger['error'](_0xe6be('0x1c'),_0x3fcb02[_0xe6be('0xf')],_0x39d1e1);_0x557e50(_0x53d54f['error'](0x1f4,_0x3fcb02[_0xe6be('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3023330..e94b3e7 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 _0x60e7=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','getDescriptions','post','create'];(function(_0x2a05d7,_0x2a381f){var _0x22feae=function(_0x487042){while(--_0x487042){_0x2a05d7['push'](_0x2a05d7['shift']());}};_0x22feae(++_0x2a381f);}(_0x60e7,0x76));var _0x760e=function(_0x22e953,_0x10a297){_0x22e953=_0x22e953-0x0;var _0x2d4bdc=_0x60e7[_0x22e953];return _0x2d4bdc;};'use strict';var multer=require(_0x760e('0x0'));var util=require(_0x760e('0x1'));var path=require(_0x760e('0x2'));var timeout=require(_0x760e('0x3'));var express=require(_0x760e('0x4'));var router=express[_0x760e('0x5')]();var fs_extra=require(_0x760e('0x6'));var auth=require(_0x760e('0x7'));var interaction=require(_0x760e('0x8'));var config=require('../../config/environment');var controller=require(_0x760e('0x9'));router['get']('/',auth[_0x760e('0xa')](),controller[_0x760e('0xb')]);router[_0x760e('0xc')](_0x760e('0xd'),auth[_0x760e('0xa')](),controller[_0x760e('0xe')]);router[_0x760e('0xc')](_0x760e('0xf'),auth[_0x760e('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x760e('0xa')](),controller[_0x760e('0x10')]);router[_0x760e('0xc')]('/:id/descriptions',auth[_0x760e('0xa')](),controller[_0x760e('0x11')]);router[_0x760e('0x12')]('/',auth['isAuthenticated'](),controller[_0x760e('0x13')]);router[_0x760e('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x760e('0x15')](_0x760e('0xd'),auth['isAuthenticated'](),controller[_0x760e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2043=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/descriptions','getDescriptions'];(function(_0x189131,_0x3f064b){var _0x3902b0=function(_0x7cce3f){while(--_0x7cce3f){_0x189131['push'](_0x189131['shift']());}};_0x3902b0(++_0x3f064b);}(_0x2043,0x133));var _0x3204=function(_0x28b965,_0x3efc90){_0x28b965=_0x28b965-0x0;var _0x5ab606=_0x2043[_0x28b965];return _0x5ab606;};'use strict';var multer=require(_0x3204('0x0'));var util=require('util');var path=require(_0x3204('0x1'));var timeout=require(_0x3204('0x2'));var express=require(_0x3204('0x3'));var router=express[_0x3204('0x4')]();var fs_extra=require(_0x3204('0x5'));var auth=require(_0x3204('0x6'));var interaction=require(_0x3204('0x7'));var config=require(_0x3204('0x8'));var controller=require(_0x3204('0x9'));router[_0x3204('0xa')]('/',auth['isAuthenticated'](),controller[_0x3204('0xb')]);router['get'](_0x3204('0xc'),auth[_0x3204('0xd')](),controller[_0x3204('0xe')]);router[_0x3204('0xa')](_0x3204('0xf'),auth[_0x3204('0xd')](),controller['getFields']);router[_0x3204('0xa')]('/:id/subjects',auth[_0x3204('0xd')](),controller['getSubjects']);router[_0x3204('0xa')](_0x3204('0x10'),auth[_0x3204('0xd')](),controller[_0x3204('0x11')]);router[_0x3204('0x12')]('/',auth[_0x3204('0xd')](),controller[_0x3204('0x13')]);router[_0x3204('0x14')](_0x3204('0xc'),auth[_0x3204('0xd')](),controller[_0x3204('0x15')]);router[_0x3204('0x16')](_0x3204('0xc'),auth[_0x3204('0xd')](),controller[_0x3204('0x17')]);module[_0x3204('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 208cef9..e6632f7 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 _0x6256=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6256,0xf1));var _0x6625=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x6256[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x6625('0x0'));module[_0x6625('0x1')]={'name':{'type':Sequelize[_0x6625('0x2')]},'description':{'type':Sequelize[_0x6625('0x2')]}}; \ No newline at end of file +var _0xa05c=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa05c,0xf0));var _0xca05=function(_0x56c3f1,_0x4ae97b){_0x56c3f1=_0x56c3f1-0x0;var _0x27d3b2=_0xa05c[_0x56c3f1];return _0x27d3b2;};'use strict';var Sequelize=require(_0xca05('0x0'));module[_0xca05('0x1')]={'name':{'type':Sequelize[_0xca05('0x2')]},'description':{'type':Sequelize[_0xca05('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7061b08..f5d5e7b 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 _0x68c8=['getSubjects','getDescriptions','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','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','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','include','ServicenowConfiguration','findAll','rows','show','params','includeAll','options','find','create','body','catch','destroy','findOne','ServicenowField','order','getFields'];(function(_0xab1ddd,_0x4e1df2){var _0x2daaba=function(_0xbd2a02){while(--_0xbd2a02){_0xab1ddd['push'](_0xab1ddd['shift']());}};_0x2daaba(++_0x4e1df2);}(_0x68c8,0x1b0));var _0x868c=function(_0x16fd74,_0x42fabb){_0x16fd74=_0x16fd74-0x0;var _0x1a10f6=_0x68c8[_0x16fd74];return _0x1a10f6;};'use strict';var emlformat=require(_0x868c('0x0'));var rimraf=require(_0x868c('0x1'));var zipdir=require(_0x868c('0x2'));var jsonpatch=require(_0x868c('0x3'));var rp=require(_0x868c('0x4'));var moment=require(_0x868c('0x5'));var BPromise=require(_0x868c('0x6'));var Mustache=require(_0x868c('0x7'));var util=require('util');var path=require(_0x868c('0x8'));var sox=require(_0x868c('0x9'));var csv=require(_0x868c('0xa'));var ejs=require(_0x868c('0xb'));var fs=require('fs');var fs_extra=require(_0x868c('0xc'));var _=require(_0x868c('0xd'));var squel=require('squel');var crypto=require(_0x868c('0xe'));var jsforce=require(_0x868c('0xf'));var deskjs=require(_0x868c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x868c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x868c('0x12'));var qs=require(_0x868c('0x13'));var as=require(_0x868c('0x14'));var hardwareService=require(_0x868c('0x15'));var logger=require(_0x868c('0x16'))(_0x868c('0x17'));var utils=require(_0x868c('0x18'));var config=require(_0x868c('0x19'));var licenseUtil=require(_0x868c('0x1a'));var db=require(_0x868c('0x1b'))['db'];function respondWithStatusCode(_0x231433,_0x5b2e4a){_0x5b2e4a=_0x5b2e4a||0xcc;return function(_0x14d5e5){if(_0x14d5e5){return _0x231433[_0x868c('0x1c')](_0x5b2e4a);}return _0x231433[_0x868c('0x1d')](_0x5b2e4a)[_0x868c('0x1e')]();};}function respondWithResult(_0x240331,_0x12a358){_0x12a358=_0x12a358||0xc8;return function(_0x14ab48){if(_0x14ab48){return _0x240331['status'](_0x12a358)[_0x868c('0x1f')](_0x14ab48);}};}function respondWithFilteredResult(_0x224fc0,_0x4c2bd4){return function(_0x510ebf){if(_0x510ebf){var _0x5e3293=typeof _0x4c2bd4[_0x868c('0x20')]===_0x868c('0x21')&&typeof _0x4c2bd4[_0x868c('0x22')]===_0x868c('0x21');var _0x4e2a28=_0x510ebf['count'];var _0x3a295a=_0x5e3293?0x0:_0x4c2bd4['offset'];var _0x22bc59=_0x5e3293?_0x510ebf[_0x868c('0x23')]:_0x4c2bd4[_0x868c('0x20')]+_0x4c2bd4[_0x868c('0x22')];var _0x203bbb;if(_0x22bc59>=_0x4e2a28){_0x22bc59=_0x4e2a28;_0x203bbb=0xc8;}else{_0x203bbb=0xce;}_0x224fc0[_0x868c('0x1d')](_0x203bbb);return _0x224fc0[_0x868c('0x24')](_0x868c('0x25'),_0x3a295a+'-'+_0x22bc59+'/'+_0x4e2a28)[_0x868c('0x1f')](_0x510ebf);}return null;};}function patchUpdates(_0x4cac44){return function(_0x124325){try{jsonpatch[_0x868c('0x26')](_0x124325,_0x4cac44,!![]);}catch(_0x197b32){return BPromise['reject'](_0x197b32);}return _0x124325[_0x868c('0x27')]();};}function saveUpdates(_0x1d4788,_0x3190ba){return function(_0x41a058){if(_0x41a058){return _0x41a058[_0x868c('0x28')](_0x1d4788)[_0x868c('0x29')](function(_0x3fea1f){return _0x3fea1f;});}return null;};}function removeEntity(_0x9e6a41,_0x39a529){return function(_0x395a19){if(_0x395a19){return _0x395a19['destroy']()['then'](function(){_0x9e6a41[_0x868c('0x1d')](0xcc)[_0x868c('0x1e')]();});}};}function handleEntityNotFound(_0x18667c,_0x3ccac3){return function(_0x29dec7){if(!_0x29dec7){_0x18667c['sendStatus'](0x194);}return _0x29dec7;};}function handleError(_0x2149ca,_0x3fbb2e){_0x3fbb2e=_0x3fbb2e||0x1f4;return function(_0xf07e04){logger[_0x868c('0x2a')](_0xf07e04[_0x868c('0x2b')]);if(_0xf07e04['name']){delete _0xf07e04[_0x868c('0x2c')];}_0x2149ca['status'](_0x3fbb2e)[_0x868c('0x2d')](_0xf07e04);};}exports[_0x868c('0x2e')]=function(_0x223ba3,_0x3e55b1){var _0x46c457={},_0x5eafd7={},_0x21cb3c={'count':0x0,'rows':[]};var _0x5491e8=_[_0x868c('0x2f')](db['ServicenowConfiguration'][_0x868c('0x30')],function(_0x1bab49){return{'name':_0x1bab49[_0x868c('0x31')],'type':_0x1bab49['type']['key']};});_0x5eafd7['model']=_['map'](_0x5491e8,_0x868c('0x2c'));_0x5eafd7['query']=_[_0x868c('0x32')](_0x223ba3[_0x868c('0x33')]);_0x5eafd7[_0x868c('0x34')]=_[_0x868c('0x35')](_0x5eafd7[_0x868c('0x36')],_0x5eafd7[_0x868c('0x33')]);_0x46c457[_0x868c('0x37')]=_['intersection'](_0x5eafd7[_0x868c('0x36')],qs[_0x868c('0x38')](_0x223ba3['query'][_0x868c('0x38')]));_0x46c457[_0x868c('0x37')]=_0x46c457[_0x868c('0x37')][_0x868c('0x39')]?_0x46c457[_0x868c('0x37')]:_0x5eafd7['model'];if(!_0x223ba3[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x46c457[_0x868c('0x22')]=qs['limit'](_0x223ba3[_0x868c('0x33')][_0x868c('0x22')]);_0x46c457['offset']=qs['offset'](_0x223ba3['query'][_0x868c('0x20')]);}_0x46c457['order']=qs[_0x868c('0x3c')](_0x223ba3[_0x868c('0x33')]['sort']);_0x46c457[_0x868c('0x3d')]=qs[_0x868c('0x34')](_[_0x868c('0x3e')](_0x223ba3[_0x868c('0x33')],_0x5eafd7[_0x868c('0x34')]),_0x5491e8);if(_0x223ba3[_0x868c('0x33')]['filter']){_0x46c457[_0x868c('0x3d')]=_['merge'](_0x46c457[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x5491e8,function(_0x4ae044){if(_0x4ae044[_0x868c('0x3f')]!==_0x868c('0x40')){var _0x473241={};_0x473241[_0x4ae044['name']]={'$like':'%'+_0x223ba3[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x473241;}})});}_0x46c457=_[_0x868c('0x42')]({},_0x46c457,_0x223ba3['options']);var _0x59022f={'where':_0x46c457[_0x868c('0x3d')]};return db['ServicenowConfiguration'][_0x868c('0x23')](_0x59022f)[_0x868c('0x29')](function(_0x4466d4){_0x21cb3c[_0x868c('0x23')]=_0x4466d4;if(_0x223ba3[_0x868c('0x33')]['includeAll']){_0x46c457[_0x868c('0x43')]=[{'all':!![]}];}return db[_0x868c('0x44')][_0x868c('0x45')](_0x46c457);})[_0x868c('0x29')](function(_0x3b7df6){_0x21cb3c[_0x868c('0x46')]=_0x3b7df6;return _0x21cb3c;})[_0x868c('0x29')](respondWithFilteredResult(_0x3e55b1,_0x46c457))['catch'](handleError(_0x3e55b1,null));};exports[_0x868c('0x47')]=function(_0x1d8f97,_0x1388c9){var _0x4c35c4={'raw':![],'where':{'id':_0x1d8f97[_0x868c('0x48')]['id']}},_0x281a7f={};_0x281a7f['model']=_[_0x868c('0x32')](db[_0x868c('0x44')][_0x868c('0x30')]);_0x281a7f['query']=_[_0x868c('0x32')](_0x1d8f97[_0x868c('0x33')]);_0x281a7f[_0x868c('0x34')]=_[_0x868c('0x35')](_0x281a7f['model'],_0x281a7f[_0x868c('0x33')]);_0x4c35c4[_0x868c('0x37')]=_[_0x868c('0x35')](_0x281a7f[_0x868c('0x36')],qs['fields'](_0x1d8f97['query'][_0x868c('0x38')]));_0x4c35c4['attributes']=_0x4c35c4[_0x868c('0x37')][_0x868c('0x39')]?_0x4c35c4[_0x868c('0x37')]:_0x281a7f[_0x868c('0x36')];if(_0x1d8f97[_0x868c('0x33')][_0x868c('0x49')]){_0x4c35c4[_0x868c('0x43')]=[{'all':!![]}];}_0x4c35c4=_[_0x868c('0x42')]({},_0x4c35c4,_0x1d8f97[_0x868c('0x4a')]);return db['ServicenowConfiguration'][_0x868c('0x4b')](_0x4c35c4)[_0x868c('0x29')](handleEntityNotFound(_0x1388c9,null))[_0x868c('0x29')](respondWithResult(_0x1388c9,null))['catch'](handleError(_0x1388c9,null));};exports[_0x868c('0x4c')]=function(_0x5029da,_0x597508){return db[_0x868c('0x44')]['create'](_0x5029da[_0x868c('0x4d')],{})[_0x868c('0x29')](respondWithResult(_0x597508,0xc9))[_0x868c('0x4e')](handleError(_0x597508,null));};exports['update']=function(_0x3733a1,_0x46d348){if(_0x3733a1[_0x868c('0x4d')]['id']){delete _0x3733a1['body']['id'];}return db[_0x868c('0x44')]['find']({'where':{'id':_0x3733a1[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x46d348,null))[_0x868c('0x29')](saveUpdates(_0x3733a1['body'],null))[_0x868c('0x29')](respondWithResult(_0x46d348,null))['catch'](handleError(_0x46d348,null));};exports[_0x868c('0x4f')]=function(_0x3254c3,_0x24ad20){return db[_0x868c('0x44')][_0x868c('0x4b')]({'where':{'id':_0x3254c3['params']['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x24ad20,null))[_0x868c('0x29')](removeEntity(_0x24ad20,null))[_0x868c('0x4e')](handleError(_0x24ad20,null));};exports['getFields']=function(_0x443ffd,_0x58185c,_0xd3de36){var _0x2a6fa5={};var _0x46c18b={};var _0x4ce23d;var _0xb8bdbb;return db['ServicenowConfiguration'][_0x868c('0x50')]({'where':{'id':_0x443ffd[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x58185c,null))[_0x868c('0x29')](function(_0x382d62){if(_0x382d62){_0x4ce23d=_0x382d62;_0x46c18b['model']=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x46c18b[_0x868c('0x33')]=_[_0x868c('0x32')](_0x443ffd[_0x868c('0x33')]);_0x46c18b[_0x868c('0x34')]=_[_0x868c('0x35')](_0x46c18b[_0x868c('0x36')],_0x46c18b[_0x868c('0x33')]);_0x2a6fa5[_0x868c('0x37')]=_[_0x868c('0x35')](_0x46c18b[_0x868c('0x36')],qs[_0x868c('0x38')](_0x443ffd['query'][_0x868c('0x38')]));_0x2a6fa5['attributes']=_0x2a6fa5[_0x868c('0x37')]['length']?_0x2a6fa5[_0x868c('0x37')]:_0x46c18b[_0x868c('0x36')];_0x2a6fa5[_0x868c('0x52')]=qs['sort'](_0x443ffd[_0x868c('0x33')]['sort']);_0x2a6fa5[_0x868c('0x3d')]=qs['filters'](_[_0x868c('0x3e')](_0x443ffd[_0x868c('0x33')],_0x46c18b[_0x868c('0x34')]));if(_0x443ffd[_0x868c('0x33')][_0x868c('0x41')]){_0x2a6fa5[_0x868c('0x3d')]=_[_0x868c('0x42')](_0x2a6fa5[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x2a6fa5['attributes'],function(_0x854455){var _0x3aa899={};_0x3aa899[_0x854455]={'$like':'%'+_0x443ffd[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x3aa899;})});}_0x2a6fa5=_['merge']({},_0x2a6fa5,_0x443ffd[_0x868c('0x4a')]);return _0x4ce23d[_0x868c('0x53')](_0x2a6fa5);}})['then'](function(_0x2b43b6){if(_0x2b43b6){_0xb8bdbb=_0x2b43b6['length'];if(!_0x443ffd[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x2a6fa5['limit']=qs['limit'](_0x443ffd['query'][_0x868c('0x22')]);_0x2a6fa5[_0x868c('0x20')]=qs['offset'](_0x443ffd[_0x868c('0x33')][_0x868c('0x20')]);}return _0x4ce23d[_0x868c('0x53')](_0x2a6fa5);}})[_0x868c('0x29')](function(_0x1ce8fa){if(_0x1ce8fa){return _0x1ce8fa?{'count':_0xb8bdbb,'rows':_0x1ce8fa}:null;}})[_0x868c('0x29')](respondWithResult(_0x58185c,null))['catch'](handleError(_0x58185c,null));};exports[_0x868c('0x54')]=function(_0x4cc598,_0x63f041,_0x3b7aca){var _0x32c0af={};var _0x4c7054={};var _0x30e7ba;var _0x32dd81;return db[_0x868c('0x44')][_0x868c('0x50')]({'where':{'id':_0x4cc598['params']['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x63f041,null))['then'](function(_0x4328d2){if(_0x4328d2){_0x30e7ba=_0x4328d2;_0x4c7054[_0x868c('0x36')]=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x4c7054[_0x868c('0x33')]=_[_0x868c('0x32')](_0x4cc598[_0x868c('0x33')]);_0x4c7054[_0x868c('0x34')]=_[_0x868c('0x35')](_0x4c7054['model'],_0x4c7054[_0x868c('0x33')]);_0x32c0af[_0x868c('0x37')]=_['intersection'](_0x4c7054[_0x868c('0x36')],qs[_0x868c('0x38')](_0x4cc598['query'][_0x868c('0x38')]));_0x32c0af[_0x868c('0x37')]=_0x32c0af[_0x868c('0x37')]['length']?_0x32c0af['attributes']:_0x4c7054[_0x868c('0x36')];_0x32c0af[_0x868c('0x52')]=qs[_0x868c('0x3c')](_0x4cc598['query'][_0x868c('0x3c')]);_0x32c0af[_0x868c('0x3d')]=qs[_0x868c('0x34')](_[_0x868c('0x3e')](_0x4cc598[_0x868c('0x33')],_0x4c7054['filters']));if(_0x4cc598[_0x868c('0x33')][_0x868c('0x41')]){_0x32c0af[_0x868c('0x3d')]=_[_0x868c('0x42')](_0x32c0af[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x32c0af[_0x868c('0x37')],function(_0x10aaec){var _0x1be99c={};_0x1be99c[_0x10aaec]={'$like':'%'+_0x4cc598[_0x868c('0x33')]['filter']+'%'};return _0x1be99c;})});}_0x32c0af=_[_0x868c('0x42')]({},_0x32c0af,_0x4cc598[_0x868c('0x4a')]);return _0x30e7ba[_0x868c('0x54')](_0x32c0af);}})[_0x868c('0x29')](function(_0x57abfa){if(_0x57abfa){_0x32dd81=_0x57abfa[_0x868c('0x39')];if(!_0x4cc598[_0x868c('0x33')][_0x868c('0x3a')](_0x868c('0x3b'))){_0x32c0af[_0x868c('0x22')]=qs[_0x868c('0x22')](_0x4cc598['query'][_0x868c('0x22')]);_0x32c0af['offset']=qs[_0x868c('0x20')](_0x4cc598[_0x868c('0x33')][_0x868c('0x20')]);}return _0x30e7ba[_0x868c('0x54')](_0x32c0af);}})[_0x868c('0x29')](function(_0x57f138){if(_0x57f138){return _0x57f138?{'count':_0x32dd81,'rows':_0x57f138}:null;}})[_0x868c('0x29')](respondWithResult(_0x63f041,null))[_0x868c('0x4e')](handleError(_0x63f041,null));};exports[_0x868c('0x55')]=function(_0x47b6ff,_0x3b6389,_0x634f3a){var _0x2e541a={};var _0x49f61d={};var _0x579cf1;var _0x426a12;return db[_0x868c('0x44')][_0x868c('0x50')]({'where':{'id':_0x47b6ff[_0x868c('0x48')]['id']}})[_0x868c('0x29')](handleEntityNotFound(_0x3b6389,null))[_0x868c('0x29')](function(_0x58a0c3){if(_0x58a0c3){_0x579cf1=_0x58a0c3;_0x49f61d['model']=_[_0x868c('0x32')](db[_0x868c('0x51')][_0x868c('0x30')]);_0x49f61d[_0x868c('0x33')]=_[_0x868c('0x32')](_0x47b6ff[_0x868c('0x33')]);_0x49f61d[_0x868c('0x34')]=_[_0x868c('0x35')](_0x49f61d['model'],_0x49f61d[_0x868c('0x33')]);_0x2e541a[_0x868c('0x37')]=_[_0x868c('0x35')](_0x49f61d[_0x868c('0x36')],qs[_0x868c('0x38')](_0x47b6ff[_0x868c('0x33')]['fields']));_0x2e541a[_0x868c('0x37')]=_0x2e541a[_0x868c('0x37')][_0x868c('0x39')]?_0x2e541a[_0x868c('0x37')]:_0x49f61d[_0x868c('0x36')];_0x2e541a[_0x868c('0x52')]=qs[_0x868c('0x3c')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x3c')]);_0x2e541a['where']=qs['filters'](_['pick'](_0x47b6ff[_0x868c('0x33')],_0x49f61d['filters']));if(_0x47b6ff[_0x868c('0x33')]['filter']){_0x2e541a['where']=_['merge'](_0x2e541a[_0x868c('0x3d')],{'$or':_[_0x868c('0x2f')](_0x2e541a[_0x868c('0x37')],function(_0x498676){var _0x54b7f7={};_0x54b7f7[_0x498676]={'$like':'%'+_0x47b6ff[_0x868c('0x33')][_0x868c('0x41')]+'%'};return _0x54b7f7;})});}_0x2e541a=_[_0x868c('0x42')]({},_0x2e541a,_0x47b6ff[_0x868c('0x4a')]);return _0x579cf1[_0x868c('0x55')](_0x2e541a);}})[_0x868c('0x29')](function(_0xb53ac8){if(_0xb53ac8){_0x426a12=_0xb53ac8['length'];if(!_0x47b6ff[_0x868c('0x33')]['hasOwnProperty']('nolimit')){_0x2e541a['limit']=qs[_0x868c('0x22')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x22')]);_0x2e541a[_0x868c('0x20')]=qs[_0x868c('0x20')](_0x47b6ff[_0x868c('0x33')][_0x868c('0x20')]);}return _0x579cf1['getDescriptions'](_0x2e541a);}})[_0x868c('0x29')](function(_0x564510){if(_0x564510){return _0x564510?{'count':_0x426a12,'rows':_0x564510}:null;}})[_0x868c('0x29')](respondWithResult(_0x3b6389,null))[_0x868c('0x4e')](handleError(_0x3b6389,null));}; \ No newline at end of file +var _0x5c92=['intersection','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','findAll','then','catch','show','includeAll','include','find','create','body','update','params','getFields','ServicenowField','order','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','name','send','index','map','ServicenowConfiguration','rawAttributes','type','model','keys','query','filters'];(function(_0x22ef0e,_0xb5a30e){var _0x38d34a=function(_0x7eab93){while(--_0x7eab93){_0x22ef0e['push'](_0x22ef0e['shift']());}};_0x38d34a(++_0xb5a30e);}(_0x5c92,0x1b8));var _0x25c9=function(_0x53b01f,_0x19b7fa){_0x53b01f=_0x53b01f-0x0;var _0x447dea=_0x5c92[_0x53b01f];return _0x447dea;};'use strict';var emlformat=require(_0x25c9('0x0'));var rimraf=require(_0x25c9('0x1'));var zipdir=require(_0x25c9('0x2'));var jsonpatch=require(_0x25c9('0x3'));var rp=require(_0x25c9('0x4'));var moment=require(_0x25c9('0x5'));var BPromise=require(_0x25c9('0x6'));var Mustache=require(_0x25c9('0x7'));var util=require(_0x25c9('0x8'));var path=require(_0x25c9('0x9'));var sox=require(_0x25c9('0xa'));var csv=require(_0x25c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25c9('0xc'));var _=require(_0x25c9('0xd'));var squel=require(_0x25c9('0xe'));var crypto=require(_0x25c9('0xf'));var jsforce=require(_0x25c9('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25c9('0x11'));var Papa=require(_0x25c9('0x12'));var Redis=require(_0x25c9('0x13'));var authService=require(_0x25c9('0x14'));var qs=require(_0x25c9('0x15'));var as=require(_0x25c9('0x16'));var hardwareService=require(_0x25c9('0x17'));var logger=require(_0x25c9('0x18'))(_0x25c9('0x19'));var utils=require('../../config/utils');var config=require(_0x25c9('0x1a'));var licenseUtil=require(_0x25c9('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285023,_0x32c41f){_0x32c41f=_0x32c41f||0xcc;return function(_0x3d299a){if(_0x3d299a){return _0x285023[_0x25c9('0x1c')](_0x32c41f);}return _0x285023[_0x25c9('0x1d')](_0x32c41f)[_0x25c9('0x1e')]();};}function respondWithResult(_0x324983,_0x48cd46){_0x48cd46=_0x48cd46||0xc8;return function(_0x590910){if(_0x590910){return _0x324983[_0x25c9('0x1d')](_0x48cd46)[_0x25c9('0x1f')](_0x590910);}};}function respondWithFilteredResult(_0xeb2f26,_0x39d717){return function(_0x4ea501){if(_0x4ea501){var _0x29424e=typeof _0x39d717[_0x25c9('0x20')]==='undefined'&&typeof _0x39d717[_0x25c9('0x21')]===_0x25c9('0x22');var _0x2bcd30=_0x4ea501['count'];var _0x395eee=_0x29424e?0x0:_0x39d717[_0x25c9('0x20')];var _0x60fd6a=_0x29424e?_0x4ea501[_0x25c9('0x23')]:_0x39d717[_0x25c9('0x20')]+_0x39d717[_0x25c9('0x21')];var _0x322cbd;if(_0x60fd6a>=_0x2bcd30){_0x60fd6a=_0x2bcd30;_0x322cbd=0xc8;}else{_0x322cbd=0xce;}_0xeb2f26['status'](_0x322cbd);return _0xeb2f26[_0x25c9('0x24')](_0x25c9('0x25'),_0x395eee+'-'+_0x60fd6a+'/'+_0x2bcd30)['json'](_0x4ea501);}return null;};}function patchUpdates(_0x34745f){return function(_0x4fa735){try{jsonpatch[_0x25c9('0x26')](_0x4fa735,_0x34745f,!![]);}catch(_0x552938){return BPromise[_0x25c9('0x27')](_0x552938);}return _0x4fa735['save']();};}function saveUpdates(_0x41bf5a,_0x513ea3){return function(_0x48ed25){if(_0x48ed25){return _0x48ed25['update'](_0x41bf5a)['then'](function(_0x10ac2a){return _0x10ac2a;});}return null;};}function removeEntity(_0x102329,_0x274a65){return function(_0x483d13){if(_0x483d13){return _0x483d13[_0x25c9('0x28')]()['then'](function(){_0x102329[_0x25c9('0x1d')](0xcc)[_0x25c9('0x1e')]();});}};}function handleEntityNotFound(_0x1e2a62,_0xe63eb1){return function(_0x49895f){if(!_0x49895f){_0x1e2a62['sendStatus'](0x194);}return _0x49895f;};}function handleError(_0x26c67b,_0x4224ed){_0x4224ed=_0x4224ed||0x1f4;return function(_0x19cea2){logger['error'](_0x19cea2['stack']);if(_0x19cea2[_0x25c9('0x29')]){delete _0x19cea2[_0x25c9('0x29')];}_0x26c67b['status'](_0x4224ed)[_0x25c9('0x2a')](_0x19cea2);};}exports[_0x25c9('0x2b')]=function(_0x54612a,_0x2801f7){var _0x4a0a16={},_0x3579f2={},_0x46c06e={'count':0x0,'rows':[]};var _0x18b129=_[_0x25c9('0x2c')](db[_0x25c9('0x2d')][_0x25c9('0x2e')],function(_0x390541){return{'name':_0x390541['fieldName'],'type':_0x390541[_0x25c9('0x2f')]['key']};});_0x3579f2[_0x25c9('0x30')]=_[_0x25c9('0x2c')](_0x18b129,_0x25c9('0x29'));_0x3579f2['query']=_[_0x25c9('0x31')](_0x54612a[_0x25c9('0x32')]);_0x3579f2[_0x25c9('0x33')]=_[_0x25c9('0x34')](_0x3579f2[_0x25c9('0x30')],_0x3579f2[_0x25c9('0x32')]);_0x4a0a16[_0x25c9('0x35')]=_[_0x25c9('0x34')](_0x3579f2['model'],qs[_0x25c9('0x36')](_0x54612a[_0x25c9('0x32')][_0x25c9('0x36')]));_0x4a0a16['attributes']=_0x4a0a16['attributes'][_0x25c9('0x37')]?_0x4a0a16[_0x25c9('0x35')]:_0x3579f2[_0x25c9('0x30')];if(!_0x54612a[_0x25c9('0x32')][_0x25c9('0x38')]('nolimit')){_0x4a0a16[_0x25c9('0x21')]=qs['limit'](_0x54612a[_0x25c9('0x32')][_0x25c9('0x21')]);_0x4a0a16[_0x25c9('0x20')]=qs[_0x25c9('0x20')](_0x54612a[_0x25c9('0x32')][_0x25c9('0x20')]);}_0x4a0a16['order']=qs[_0x25c9('0x39')](_0x54612a['query'][_0x25c9('0x39')]);_0x4a0a16['where']=qs[_0x25c9('0x33')](_[_0x25c9('0x3a')](_0x54612a[_0x25c9('0x32')],_0x3579f2[_0x25c9('0x33')]),_0x18b129);if(_0x54612a[_0x25c9('0x32')]['filter']){_0x4a0a16[_0x25c9('0x3b')]=_[_0x25c9('0x3c')](_0x4a0a16['where'],{'$or':_[_0x25c9('0x2c')](_0x18b129,function(_0x9dfcfe){if(_0x9dfcfe[_0x25c9('0x2f')]!==_0x25c9('0x3d')){var _0x967cef={};_0x967cef[_0x9dfcfe['name']]={'$like':'%'+_0x54612a[_0x25c9('0x32')][_0x25c9('0x3e')]+'%'};return _0x967cef;}})});}_0x4a0a16=_['merge']({},_0x4a0a16,_0x54612a[_0x25c9('0x3f')]);var _0x20bb37={'where':_0x4a0a16[_0x25c9('0x3b')]};return db[_0x25c9('0x2d')][_0x25c9('0x23')](_0x20bb37)['then'](function(_0x372eaf){_0x46c06e['count']=_0x372eaf;if(_0x54612a[_0x25c9('0x32')]['includeAll']){_0x4a0a16['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x25c9('0x40')](_0x4a0a16);})[_0x25c9('0x41')](function(_0x2d23f2){_0x46c06e['rows']=_0x2d23f2;return _0x46c06e;})[_0x25c9('0x41')](respondWithFilteredResult(_0x2801f7,_0x4a0a16))[_0x25c9('0x42')](handleError(_0x2801f7,null));};exports[_0x25c9('0x43')]=function(_0x5e5ca1,_0x36e2cb){var _0x42afb8={'raw':![],'where':{'id':_0x5e5ca1['params']['id']}},_0x5c6c01={};_0x5c6c01[_0x25c9('0x30')]=_[_0x25c9('0x31')](db[_0x25c9('0x2d')]['rawAttributes']);_0x5c6c01[_0x25c9('0x32')]=_['keys'](_0x5e5ca1[_0x25c9('0x32')]);_0x5c6c01[_0x25c9('0x33')]=_[_0x25c9('0x34')](_0x5c6c01[_0x25c9('0x30')],_0x5c6c01[_0x25c9('0x32')]);_0x42afb8[_0x25c9('0x35')]=_[_0x25c9('0x34')](_0x5c6c01['model'],qs[_0x25c9('0x36')](_0x5e5ca1[_0x25c9('0x32')][_0x25c9('0x36')]));_0x42afb8[_0x25c9('0x35')]=_0x42afb8[_0x25c9('0x35')][_0x25c9('0x37')]?_0x42afb8[_0x25c9('0x35')]:_0x5c6c01[_0x25c9('0x30')];if(_0x5e5ca1[_0x25c9('0x32')][_0x25c9('0x44')]){_0x42afb8[_0x25c9('0x45')]=[{'all':!![]}];}_0x42afb8=_[_0x25c9('0x3c')]({},_0x42afb8,_0x5e5ca1[_0x25c9('0x3f')]);return db[_0x25c9('0x2d')][_0x25c9('0x46')](_0x42afb8)[_0x25c9('0x41')](handleEntityNotFound(_0x36e2cb,null))[_0x25c9('0x41')](respondWithResult(_0x36e2cb,null))[_0x25c9('0x42')](handleError(_0x36e2cb,null));};exports['create']=function(_0x41d991,_0x46fbcb){return db['ServicenowConfiguration'][_0x25c9('0x47')](_0x41d991[_0x25c9('0x48')],{})[_0x25c9('0x41')](respondWithResult(_0x46fbcb,0xc9))[_0x25c9('0x42')](handleError(_0x46fbcb,null));};exports[_0x25c9('0x49')]=function(_0xfd3fee,_0x37068f){if(_0xfd3fee['body']['id']){delete _0xfd3fee[_0x25c9('0x48')]['id'];}return db[_0x25c9('0x2d')][_0x25c9('0x46')]({'where':{'id':_0xfd3fee[_0x25c9('0x4a')]['id']}})[_0x25c9('0x41')](handleEntityNotFound(_0x37068f,null))['then'](saveUpdates(_0xfd3fee['body'],null))[_0x25c9('0x41')](respondWithResult(_0x37068f,null))['catch'](handleError(_0x37068f,null));};exports[_0x25c9('0x28')]=function(_0x42b194,_0x496876){return db[_0x25c9('0x2d')][_0x25c9('0x46')]({'where':{'id':_0x42b194[_0x25c9('0x4a')]['id']}})[_0x25c9('0x41')](handleEntityNotFound(_0x496876,null))['then'](removeEntity(_0x496876,null))[_0x25c9('0x42')](handleError(_0x496876,null));};exports[_0x25c9('0x4b')]=function(_0x363d54,_0x4af4cc,_0x4bc0d0){var _0x7a6ccf={};var _0x3de1f5={};var _0x387dc8;var _0x2e1325;return db[_0x25c9('0x2d')]['findOne']({'where':{'id':_0x363d54[_0x25c9('0x4a')]['id']}})[_0x25c9('0x41')](handleEntityNotFound(_0x4af4cc,null))[_0x25c9('0x41')](function(_0x2ab972){if(_0x2ab972){_0x387dc8=_0x2ab972;_0x3de1f5[_0x25c9('0x30')]=_[_0x25c9('0x31')](db[_0x25c9('0x4c')][_0x25c9('0x2e')]);_0x3de1f5[_0x25c9('0x32')]=_['keys'](_0x363d54[_0x25c9('0x32')]);_0x3de1f5['filters']=_[_0x25c9('0x34')](_0x3de1f5[_0x25c9('0x30')],_0x3de1f5[_0x25c9('0x32')]);_0x7a6ccf[_0x25c9('0x35')]=_[_0x25c9('0x34')](_0x3de1f5[_0x25c9('0x30')],qs[_0x25c9('0x36')](_0x363d54[_0x25c9('0x32')]['fields']));_0x7a6ccf[_0x25c9('0x35')]=_0x7a6ccf['attributes'][_0x25c9('0x37')]?_0x7a6ccf[_0x25c9('0x35')]:_0x3de1f5[_0x25c9('0x30')];_0x7a6ccf[_0x25c9('0x4d')]=qs['sort'](_0x363d54[_0x25c9('0x32')][_0x25c9('0x39')]);_0x7a6ccf['where']=qs['filters'](_[_0x25c9('0x3a')](_0x363d54[_0x25c9('0x32')],_0x3de1f5[_0x25c9('0x33')]));if(_0x363d54[_0x25c9('0x32')][_0x25c9('0x3e')]){_0x7a6ccf[_0x25c9('0x3b')]=_[_0x25c9('0x3c')](_0x7a6ccf[_0x25c9('0x3b')],{'$or':_[_0x25c9('0x2c')](_0x7a6ccf[_0x25c9('0x35')],function(_0x265a02){var _0xe24c81={};_0xe24c81[_0x265a02]={'$like':'%'+_0x363d54['query'][_0x25c9('0x3e')]+'%'};return _0xe24c81;})});}_0x7a6ccf=_['merge']({},_0x7a6ccf,_0x363d54['options']);return _0x387dc8[_0x25c9('0x4b')](_0x7a6ccf);}})[_0x25c9('0x41')](function(_0x2cfe5e){if(_0x2cfe5e){_0x2e1325=_0x2cfe5e[_0x25c9('0x37')];if(!_0x363d54[_0x25c9('0x32')][_0x25c9('0x38')](_0x25c9('0x4e'))){_0x7a6ccf[_0x25c9('0x21')]=qs[_0x25c9('0x21')](_0x363d54[_0x25c9('0x32')][_0x25c9('0x21')]);_0x7a6ccf[_0x25c9('0x20')]=qs[_0x25c9('0x20')](_0x363d54[_0x25c9('0x32')]['offset']);}return _0x387dc8[_0x25c9('0x4b')](_0x7a6ccf);}})[_0x25c9('0x41')](function(_0x42b946){if(_0x42b946){return _0x42b946?{'count':_0x2e1325,'rows':_0x42b946}:null;}})[_0x25c9('0x41')](respondWithResult(_0x4af4cc,null))['catch'](handleError(_0x4af4cc,null));};exports['getSubjects']=function(_0x5ba348,_0xc88c7a,_0x38bb45){var _0x58763e={};var _0x2e00dc={};var _0x253f5d;var _0x4c952f;return db['ServicenowConfiguration'][_0x25c9('0x4f')]({'where':{'id':_0x5ba348[_0x25c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc88c7a,null))[_0x25c9('0x41')](function(_0x5281b0){if(_0x5281b0){_0x253f5d=_0x5281b0;_0x2e00dc[_0x25c9('0x30')]=_['keys'](db[_0x25c9('0x4c')][_0x25c9('0x2e')]);_0x2e00dc[_0x25c9('0x32')]=_[_0x25c9('0x31')](_0x5ba348[_0x25c9('0x32')]);_0x2e00dc[_0x25c9('0x33')]=_[_0x25c9('0x34')](_0x2e00dc[_0x25c9('0x30')],_0x2e00dc['query']);_0x58763e['attributes']=_[_0x25c9('0x34')](_0x2e00dc[_0x25c9('0x30')],qs[_0x25c9('0x36')](_0x5ba348[_0x25c9('0x32')][_0x25c9('0x36')]));_0x58763e[_0x25c9('0x35')]=_0x58763e[_0x25c9('0x35')]['length']?_0x58763e[_0x25c9('0x35')]:_0x2e00dc[_0x25c9('0x30')];_0x58763e[_0x25c9('0x4d')]=qs['sort'](_0x5ba348[_0x25c9('0x32')][_0x25c9('0x39')]);_0x58763e[_0x25c9('0x3b')]=qs[_0x25c9('0x33')](_['pick'](_0x5ba348[_0x25c9('0x32')],_0x2e00dc[_0x25c9('0x33')]));if(_0x5ba348[_0x25c9('0x32')][_0x25c9('0x3e')]){_0x58763e[_0x25c9('0x3b')]=_['merge'](_0x58763e[_0x25c9('0x3b')],{'$or':_['map'](_0x58763e[_0x25c9('0x35')],function(_0x349025){var _0x1adafd={};_0x1adafd[_0x349025]={'$like':'%'+_0x5ba348['query'][_0x25c9('0x3e')]+'%'};return _0x1adafd;})});}_0x58763e=_[_0x25c9('0x3c')]({},_0x58763e,_0x5ba348[_0x25c9('0x3f')]);return _0x253f5d[_0x25c9('0x50')](_0x58763e);}})[_0x25c9('0x41')](function(_0x5396b3){if(_0x5396b3){_0x4c952f=_0x5396b3[_0x25c9('0x37')];if(!_0x5ba348['query'][_0x25c9('0x38')](_0x25c9('0x4e'))){_0x58763e['limit']=qs[_0x25c9('0x21')](_0x5ba348['query']['limit']);_0x58763e['offset']=qs[_0x25c9('0x20')](_0x5ba348['query'][_0x25c9('0x20')]);}return _0x253f5d[_0x25c9('0x50')](_0x58763e);}})['then'](function(_0x37072d){if(_0x37072d){return _0x37072d?{'count':_0x4c952f,'rows':_0x37072d}:null;}})[_0x25c9('0x41')](respondWithResult(_0xc88c7a,null))[_0x25c9('0x42')](handleError(_0xc88c7a,null));};exports[_0x25c9('0x51')]=function(_0x4ddf27,_0x11c08e,_0x15a7a1){var _0xddb0e8={};var _0x3f750c={};var _0x38f003;var _0x444e00;return db[_0x25c9('0x2d')][_0x25c9('0x4f')]({'where':{'id':_0x4ddf27['params']['id']}})[_0x25c9('0x41')](handleEntityNotFound(_0x11c08e,null))['then'](function(_0xa2f67a){if(_0xa2f67a){_0x38f003=_0xa2f67a;_0x3f750c[_0x25c9('0x30')]=_[_0x25c9('0x31')](db[_0x25c9('0x4c')]['rawAttributes']);_0x3f750c[_0x25c9('0x32')]=_[_0x25c9('0x31')](_0x4ddf27[_0x25c9('0x32')]);_0x3f750c['filters']=_[_0x25c9('0x34')](_0x3f750c[_0x25c9('0x30')],_0x3f750c['query']);_0xddb0e8[_0x25c9('0x35')]=_[_0x25c9('0x34')](_0x3f750c[_0x25c9('0x30')],qs['fields'](_0x4ddf27[_0x25c9('0x32')]['fields']));_0xddb0e8[_0x25c9('0x35')]=_0xddb0e8[_0x25c9('0x35')][_0x25c9('0x37')]?_0xddb0e8['attributes']:_0x3f750c[_0x25c9('0x30')];_0xddb0e8[_0x25c9('0x4d')]=qs[_0x25c9('0x39')](_0x4ddf27[_0x25c9('0x32')][_0x25c9('0x39')]);_0xddb0e8[_0x25c9('0x3b')]=qs[_0x25c9('0x33')](_[_0x25c9('0x3a')](_0x4ddf27[_0x25c9('0x32')],_0x3f750c[_0x25c9('0x33')]));if(_0x4ddf27[_0x25c9('0x32')][_0x25c9('0x3e')]){_0xddb0e8['where']=_['merge'](_0xddb0e8['where'],{'$or':_[_0x25c9('0x2c')](_0xddb0e8['attributes'],function(_0x47b721){var _0x43c753={};_0x43c753[_0x47b721]={'$like':'%'+_0x4ddf27['query']['filter']+'%'};return _0x43c753;})});}_0xddb0e8=_[_0x25c9('0x3c')]({},_0xddb0e8,_0x4ddf27[_0x25c9('0x3f')]);return _0x38f003[_0x25c9('0x51')](_0xddb0e8);}})[_0x25c9('0x41')](function(_0xcea361){if(_0xcea361){_0x444e00=_0xcea361[_0x25c9('0x37')];if(!_0x4ddf27[_0x25c9('0x32')]['hasOwnProperty'](_0x25c9('0x4e'))){_0xddb0e8[_0x25c9('0x21')]=qs[_0x25c9('0x21')](_0x4ddf27[_0x25c9('0x32')][_0x25c9('0x21')]);_0xddb0e8['offset']=qs[_0x25c9('0x20')](_0x4ddf27[_0x25c9('0x32')][_0x25c9('0x20')]);}return _0x38f003[_0x25c9('0x51')](_0xddb0e8);}})[_0x25c9('0x41')](function(_0x29c9f5){if(_0x29c9f5){return _0x29c9f5?{'count':_0x444e00,'rows':_0x29c9f5}:null;}})[_0x25c9('0x41')](respondWithResult(_0x11c08e,null))[_0x25c9('0x42')](handleError(_0x11c08e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9da3c7c..022d96e 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 _0x6215=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x243575,_0xef6324){var _0x5ae7b2=function(_0x5f79){while(--_0x5f79){_0x243575['push'](_0x243575['shift']());}};_0x5ae7b2(++_0xef6324);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var logger=require(_0x5621('0x2'))('api');var moment=require(_0x5621('0x3'));var BPromise=require(_0x5621('0x4'));var rp=require(_0x5621('0x5'));var fs=require('fs');var path=require(_0x5621('0x6'));var rimraf=require(_0x5621('0x7'));var config=require(_0x5621('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x52f3c6,_0x5ae3af){return _0x52f3c6[_0x5621('0x9')](_0x5621('0xa'),attributes,{'tableName':_0x5621('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19c3=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x19c3,0xf9));var _0x319c=function(_0x11c464,_0x2819a6){_0x11c464=_0x11c464-0x0;var _0xeff37c=_0x19c3[_0x11c464];return _0xeff37c;};'use strict';var _=require(_0x319c('0x0'));var util=require('util');var logger=require(_0x319c('0x1'))(_0x319c('0x2'));var moment=require('moment');var BPromise=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var fs=require('fs');var path=require(_0x319c('0x5'));var rimraf=require(_0x319c('0x6'));var config=require(_0x319c('0x7'));var attributes=require(_0x319c('0x8'));module['exports']=function(_0x20f77e,_0x53a1de){return _0x20f77e[_0x319c('0x9')](_0x319c('0xa'),attributes,{'tableName':_0x319c('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 52b0a4d..020a09a 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 _0xb522=['../../config/environment','jayson/promise','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ee47f,_0x312d0e){var _0x32bda9=function(_0x3e6775){while(--_0x3e6775){_0x2ee47f['push'](_0x2ee47f['shift']());}};_0x32bda9(++_0x312d0e);}(_0xb522,0x15e));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2b52('0x0'));var util=require(_0x2b52('0x1'));var moment=require(_0x2b52('0x2'));var BPromise=require(_0x2b52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b52('0x4'))['db'];var utils=require(_0x2b52('0x5'));var logger=require(_0x2b52('0x6'))('rpc');var config=require(_0x2b52('0x7'));var jayson=require(_0x2b52('0x8'));var client=jayson[_0x2b52('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d4b56,_0x5a268a,_0xe4927b){return new BPromise(function(_0x32607c,_0x2c9ef2){return client[_0x2b52('0xa')](_0x2d4b56,_0xe4927b)['then'](function(_0x431ba){logger[_0x2b52('0xb')](_0x2b52('0xc'),_0x5a268a,_0x2b52('0xd'));logger[_0x2b52('0xe')](_0x2b52('0xf'),_0x5a268a,_0x2b52('0xd'),JSON[_0x2b52('0x10')](_0x431ba));if(_0x431ba[_0x2b52('0x11')]){if(_0x431ba[_0x2b52('0x11')][_0x2b52('0x12')]===0x1f4){logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);return _0x2c9ef2(_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);}logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x431ba['error'][_0x2b52('0x13')]);return _0x32607c(_0x431ba[_0x2b52('0x11')][_0x2b52('0x13')]);}else{logger[_0x2b52('0xb')](_0x2b52('0xc'),_0x5a268a,_0x2b52('0xd'));_0x32607c(_0x431ba['result'][_0x2b52('0x13')]);}})[_0x2b52('0x14')](function(_0x18e2ae){logger[_0x2b52('0x11')](_0x2b52('0xc'),_0x5a268a,_0x18e2ae);_0x2c9ef2(_0x18e2ae);});});} \ No newline at end of file +var _0x3b61=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b61,0x67));var _0x13b6=function(_0x3ba721,_0x5b8f13){_0x3ba721=_0x3ba721-0x0;var _0x3a3244=_0x3b61[_0x3ba721];return _0x3a3244;};'use strict';var _=require(_0x13b6('0x0'));var util=require(_0x13b6('0x1'));var moment=require(_0x13b6('0x2'));var BPromise=require(_0x13b6('0x3'));var rs=require(_0x13b6('0x4'));var fs=require('fs');var Redis=require(_0x13b6('0x5'));var db=require(_0x13b6('0x6'))['db'];var utils=require(_0x13b6('0x7'));var logger=require('../../config/logger')(_0x13b6('0x8'));var config=require(_0x13b6('0x9'));var jayson=require(_0x13b6('0xa'));var client=jayson['client'][_0x13b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7d8b81,_0x3add79,_0x476887){return new BPromise(function(_0x4927aa,_0x5b2b9a){return client[_0x13b6('0xc')](_0x7d8b81,_0x476887)[_0x13b6('0xd')](function(_0x58688f){logger[_0x13b6('0xe')](_0x13b6('0xf'),_0x3add79,_0x13b6('0x10'));logger[_0x13b6('0x11')](_0x13b6('0x12'),_0x3add79,_0x13b6('0x10'),JSON[_0x13b6('0x13')](_0x58688f));if(_0x58688f[_0x13b6('0x14')]){if(_0x58688f[_0x13b6('0x14')][_0x13b6('0x15')]===0x1f4){logger[_0x13b6('0x14')](_0x13b6('0xf'),_0x3add79,_0x58688f['error']['message']);return _0x5b2b9a(_0x58688f[_0x13b6('0x14')][_0x13b6('0x16')]);}logger[_0x13b6('0x14')](_0x13b6('0xf'),_0x3add79,_0x58688f[_0x13b6('0x14')][_0x13b6('0x16')]);return _0x4927aa(_0x58688f[_0x13b6('0x14')][_0x13b6('0x16')]);}else{logger[_0x13b6('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3add79,_0x13b6('0x10'));_0x4927aa(_0x58688f[_0x13b6('0x17')][_0x13b6('0x16')]);}})[_0x13b6('0x18')](function(_0x5f5454){logger[_0x13b6('0x14')](_0x13b6('0xf'),_0x3add79,_0x5f5454);_0x5b2b9a(_0x5f5454);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index a36e885..bf9912b 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 _0x772c=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x772c,0xdf));var _0xc772=function(_0x1b5660,_0x10c2d9){_0x1b5660=_0x1b5660-0x0;var _0x43218c=_0x772c[_0x1b5660];return _0x43218c;};'use strict';var multer=require(_0xc772('0x0'));var util=require(_0xc772('0x1'));var path=require(_0xc772('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc772('0x3')]();var fs_extra=require(_0xc772('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc772('0x5'));var config=require(_0xc772('0x6'));var controller=require(_0xc772('0x7'));router[_0xc772('0x8')]('/',auth[_0xc772('0x9')](),controller[_0xc772('0xa')]);router[_0xc772('0x8')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller[_0xc772('0xc')]);router[_0xc772('0xd')]('/',auth[_0xc772('0x9')](),controller[_0xc772('0xe')]);router[_0xc772('0xf')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller['update']);router[_0xc772('0x10')](_0xc772('0xb'),auth[_0xc772('0x9')](),controller[_0xc772('0x11')]);module[_0xc772('0x12')]=router; \ No newline at end of file +var _0x99a5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99a5,0x1da));var _0x599a=function(_0x20265,_0x1195e){_0x20265=_0x20265-0x0;var _0x1e0068=_0x99a5[_0x20265];return _0x1e0068;};'use strict';var multer=require('multer');var util=require(_0x599a('0x0'));var path=require(_0x599a('0x1'));var timeout=require(_0x599a('0x2'));var express=require(_0x599a('0x3'));var router=express[_0x599a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x599a('0x5'));var interaction=require(_0x599a('0x6'));var config=require('../../config/environment');var controller=require(_0x599a('0x7'));router[_0x599a('0x8')]('/',auth[_0x599a('0x9')](),controller['index']);router[_0x599a('0x8')](_0x599a('0xa'),auth[_0x599a('0x9')](),controller['show']);router[_0x599a('0xb')]('/',auth['isAuthenticated'](),controller[_0x599a('0xc')]);router[_0x599a('0xd')](_0x599a('0xa'),auth[_0x599a('0x9')](),controller['update']);router[_0x599a('0xe')]('/:id',auth[_0x599a('0x9')](),controller[_0x599a('0xf')]);module[_0x599a('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 8b3f8e5..5f3a7b2 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 _0x12b3=['string','customVariable','picklist','STRING','ENUM','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x12b3,0x11f));var _0x312b=function(_0x1d754e,_0x48e912){_0x1d754e=_0x1d754e-0x0;var _0x551a3c=_0x12b3[_0x1d754e];return _0x551a3c;};'use strict';var Sequelize=require(_0x312b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x312b('0x1'),'variable',_0x312b('0x2'),'keyValue',_0x312b('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x312b('0x4')]},'key':{'type':Sequelize[_0x312b('0x4')]},'keyType':{'type':Sequelize[_0x312b('0x5')](_0x312b('0x1'),'variable',_0x312b('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x312b('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02d1=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5a26ab,_0x4fffc3){var _0x1d1a70=function(_0x14eae3){while(--_0x14eae3){_0x5a26ab['push'](_0x5a26ab['shift']());}};_0x1d1a70(++_0x4fffc3);}(_0x02d1,0x117));var _0x102d=function(_0x292387,_0xb1443d){_0x292387=_0x292387-0x0;var _0x137477=_0x02d1[_0x292387];return _0x137477;};'use strict';var Sequelize=require(_0x102d('0x0'));module[_0x102d('0x1')]={'type':{'type':Sequelize[_0x102d('0x2')](_0x102d('0x3'),_0x102d('0x4'),_0x102d('0x5'),_0x102d('0x6'),_0x102d('0x7')),'defaultValue':_0x102d('0x3')},'content':{'type':Sequelize[_0x102d('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x102d('0x2')]('string',_0x102d('0x4'),_0x102d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x102d('0x8')]},'nameField':{'type':Sequelize[_0x102d('0x8')]},'customField':{'type':Sequelize[_0x102d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x102d('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 44763b4..509e7b0 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 _0xab7e=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowField','include','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xab7e,0x1ea));var _0xeab7=function(_0x41a45d,_0x1e61c3){_0x41a45d=_0x41a45d-0x0;var _0x24b1d6=_0xab7e[_0x41a45d];return _0x24b1d6;};'use strict';var emlformat=require(_0xeab7('0x0'));var rimraf=require(_0xeab7('0x1'));var zipdir=require(_0xeab7('0x2'));var jsonpatch=require(_0xeab7('0x3'));var rp=require(_0xeab7('0x4'));var moment=require('moment');var BPromise=require(_0xeab7('0x5'));var Mustache=require(_0xeab7('0x6'));var util=require(_0xeab7('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeab7('0x8'));var fs=require('fs');var fs_extra=require(_0xeab7('0x9'));var _=require(_0xeab7('0xa'));var squel=require(_0xeab7('0xb'));var crypto=require(_0xeab7('0xc'));var jsforce=require(_0xeab7('0xd'));var deskjs=require(_0xeab7('0xe'));var toCsv=require(_0xeab7('0xf'));var querystring=require('querystring');var Papa=require(_0xeab7('0x10'));var Redis=require(_0xeab7('0x11'));var authService=require(_0xeab7('0x12'));var qs=require(_0xeab7('0x13'));var as=require(_0xeab7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeab7('0x15'));var utils=require('../../config/utils');var config=require(_0xeab7('0x16'));var licenseUtil=require(_0xeab7('0x17'));var db=require(_0xeab7('0x18'))['db'];function respondWithStatusCode(_0x290e35,_0x2ec619){_0x2ec619=_0x2ec619||0xcc;return function(_0x56d481){if(_0x56d481){return _0x290e35[_0xeab7('0x19')](_0x2ec619);}return _0x290e35[_0xeab7('0x1a')](_0x2ec619)[_0xeab7('0x1b')]();};}function respondWithResult(_0xe30643,_0x291839){_0x291839=_0x291839||0xc8;return function(_0x53c2cd){if(_0x53c2cd){return _0xe30643[_0xeab7('0x1a')](_0x291839)[_0xeab7('0x1c')](_0x53c2cd);}};}function respondWithFilteredResult(_0x59f3fa,_0x578c2b){return function(_0x14b3e1){if(_0x14b3e1){var _0x14402e=typeof _0x578c2b[_0xeab7('0x1d')]===_0xeab7('0x1e')&&typeof _0x578c2b['limit']===_0xeab7('0x1e');var _0x597420=_0x14b3e1[_0xeab7('0x1f')];var _0x2d2e18=_0x14402e?0x0:_0x578c2b['offset'];var _0x182883=_0x14402e?_0x14b3e1[_0xeab7('0x1f')]:_0x578c2b[_0xeab7('0x1d')]+_0x578c2b['limit'];var _0x1fc119;if(_0x182883>=_0x597420){_0x182883=_0x597420;_0x1fc119=0xc8;}else{_0x1fc119=0xce;}_0x59f3fa[_0xeab7('0x1a')](_0x1fc119);return _0x59f3fa['set'](_0xeab7('0x20'),_0x2d2e18+'-'+_0x182883+'/'+_0x597420)[_0xeab7('0x1c')](_0x14b3e1);}return null;};}function patchUpdates(_0x440131){return function(_0x752596){try{jsonpatch[_0xeab7('0x21')](_0x752596,_0x440131,!![]);}catch(_0x2ae826){return BPromise['reject'](_0x2ae826);}return _0x752596['save']();};}function saveUpdates(_0x412d6d,_0x2655bf){return function(_0xbdcc34){if(_0xbdcc34){return _0xbdcc34[_0xeab7('0x22')](_0x412d6d)[_0xeab7('0x23')](function(_0x8ec1c0){return _0x8ec1c0;});}return null;};}function removeEntity(_0x59b9c4,_0x2f44e7){return function(_0x5c4e33){if(_0x5c4e33){return _0x5c4e33['destroy']()[_0xeab7('0x23')](function(){_0x59b9c4[_0xeab7('0x1a')](0xcc)[_0xeab7('0x1b')]();});}};}function handleEntityNotFound(_0x1710b0,_0x4ecf44){return function(_0x19e1ac){if(!_0x19e1ac){_0x1710b0[_0xeab7('0x19')](0x194);}return _0x19e1ac;};}function handleError(_0x500658,_0x416516){_0x416516=_0x416516||0x1f4;return function(_0x450400){logger[_0xeab7('0x24')](_0x450400[_0xeab7('0x25')]);if(_0x450400['name']){delete _0x450400['name'];}_0x500658['status'](_0x416516)[_0xeab7('0x26')](_0x450400);};}exports[_0xeab7('0x27')]=function(_0x20acda,_0x5e09d3){var _0x1fd506={},_0x3862b9={},_0x10ac00={'count':0x0,'rows':[]};var _0xebb245=_[_0xeab7('0x28')](db['ServicenowField'][_0xeab7('0x29')],function(_0x2278b4){return{'name':_0x2278b4[_0xeab7('0x2a')],'type':_0x2278b4[_0xeab7('0x2b')][_0xeab7('0x2c')]};});_0x3862b9[_0xeab7('0x2d')]=_[_0xeab7('0x28')](_0xebb245,_0xeab7('0x2e'));_0x3862b9[_0xeab7('0x2f')]=_[_0xeab7('0x30')](_0x20acda[_0xeab7('0x2f')]);_0x3862b9[_0xeab7('0x31')]=_[_0xeab7('0x32')](_0x3862b9[_0xeab7('0x2d')],_0x3862b9[_0xeab7('0x2f')]);_0x1fd506['attributes']=_['intersection'](_0x3862b9[_0xeab7('0x2d')],qs[_0xeab7('0x33')](_0x20acda['query'][_0xeab7('0x33')]));_0x1fd506[_0xeab7('0x34')]=_0x1fd506[_0xeab7('0x34')][_0xeab7('0x35')]?_0x1fd506[_0xeab7('0x34')]:_0x3862b9['model'];if(!_0x20acda[_0xeab7('0x2f')][_0xeab7('0x36')](_0xeab7('0x37'))){_0x1fd506[_0xeab7('0x38')]=qs[_0xeab7('0x38')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x38')]);_0x1fd506[_0xeab7('0x1d')]=qs[_0xeab7('0x1d')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x1d')]);}_0x1fd506[_0xeab7('0x39')]=qs[_0xeab7('0x3a')](_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3a')]);_0x1fd506['where']=qs['filters'](_[_0xeab7('0x3b')](_0x20acda[_0xeab7('0x2f')],_0x3862b9[_0xeab7('0x31')]),_0xebb245);if(_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3c')]){_0x1fd506[_0xeab7('0x3d')]=_[_0xeab7('0x3e')](_0x1fd506[_0xeab7('0x3d')],{'$or':_['map'](_0xebb245,function(_0x57c866){if(_0x57c866[_0xeab7('0x2b')]!==_0xeab7('0x3f')){var _0x59fe58={};_0x59fe58[_0x57c866[_0xeab7('0x2e')]]={'$like':'%'+_0x20acda[_0xeab7('0x2f')][_0xeab7('0x3c')]+'%'};return _0x59fe58;}})});}_0x1fd506=_[_0xeab7('0x3e')]({},_0x1fd506,_0x20acda[_0xeab7('0x40')]);var _0x412584={'where':_0x1fd506[_0xeab7('0x3d')]};return db[_0xeab7('0x41')][_0xeab7('0x1f')](_0x412584)[_0xeab7('0x23')](function(_0x1c685f){_0x10ac00[_0xeab7('0x1f')]=_0x1c685f;if(_0x20acda[_0xeab7('0x2f')]['includeAll']){_0x1fd506[_0xeab7('0x42')]=[{'all':!![]}];}return db[_0xeab7('0x41')]['findAll'](_0x1fd506);})['then'](function(_0x5dc050){_0x10ac00['rows']=_0x5dc050;return _0x10ac00;})[_0xeab7('0x23')](respondWithFilteredResult(_0x5e09d3,_0x1fd506))['catch'](handleError(_0x5e09d3,null));};exports['show']=function(_0x4ab27a,_0x1c11c8){var _0x1fce61={'raw':!![],'where':{'id':_0x4ab27a[_0xeab7('0x43')]['id']}},_0x42b1b3={};_0x42b1b3[_0xeab7('0x2d')]=_[_0xeab7('0x30')](db[_0xeab7('0x41')][_0xeab7('0x29')]);_0x42b1b3['query']=_['keys'](_0x4ab27a['query']);_0x42b1b3[_0xeab7('0x31')]=_[_0xeab7('0x32')](_0x42b1b3['model'],_0x42b1b3[_0xeab7('0x2f')]);_0x1fce61['attributes']=_[_0xeab7('0x32')](_0x42b1b3['model'],qs['fields'](_0x4ab27a[_0xeab7('0x2f')]['fields']));_0x1fce61[_0xeab7('0x34')]=_0x1fce61[_0xeab7('0x34')][_0xeab7('0x35')]?_0x1fce61[_0xeab7('0x34')]:_0x42b1b3[_0xeab7('0x2d')];if(_0x4ab27a['query']['includeAll']){_0x1fce61[_0xeab7('0x42')]=[{'all':!![]}];}_0x1fce61=_[_0xeab7('0x3e')]({},_0x1fce61,_0x4ab27a[_0xeab7('0x40')]);return db[_0xeab7('0x41')][_0xeab7('0x44')](_0x1fce61)[_0xeab7('0x23')](handleEntityNotFound(_0x1c11c8,null))['then'](respondWithResult(_0x1c11c8,null))[_0xeab7('0x45')](handleError(_0x1c11c8,null));};exports[_0xeab7('0x46')]=function(_0x3c8d10,_0x4069c8){return db[_0xeab7('0x41')][_0xeab7('0x46')](_0x3c8d10[_0xeab7('0x47')],{})['then'](respondWithResult(_0x4069c8,0xc9))['catch'](handleError(_0x4069c8,null));};exports['update']=function(_0x252ed4,_0x22e5b5){if(_0x252ed4[_0xeab7('0x47')]['id']){delete _0x252ed4['body']['id'];}return db[_0xeab7('0x41')][_0xeab7('0x44')]({'where':{'id':_0x252ed4[_0xeab7('0x43')]['id']}})[_0xeab7('0x23')](handleEntityNotFound(_0x22e5b5,null))['then'](saveUpdates(_0x252ed4['body'],null))[_0xeab7('0x23')](respondWithResult(_0x22e5b5,null))[_0xeab7('0x45')](handleError(_0x22e5b5,null));};exports[_0xeab7('0x48')]=function(_0x5abf53,_0x484452){return db[_0xeab7('0x41')][_0xeab7('0x44')]({'where':{'id':_0x5abf53['params']['id']}})[_0xeab7('0x23')](handleEntityNotFound(_0x484452,null))[_0xeab7('0x23')](removeEntity(_0x484452,null))[_0xeab7('0x45')](handleError(_0x484452,null));}; \ No newline at end of file +var _0x71da=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','catch','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x4b2135,_0x3c5dc6){var _0x410766=function(_0x4405b4){while(--_0x4405b4){_0x4b2135['push'](_0x4b2135['shift']());}};_0x410766(++_0x3c5dc6);}(_0x71da,0x175));var _0xa71d=function(_0x1b5e26,_0x453ef6){_0x1b5e26=_0x1b5e26-0x0;var _0x246191=_0x71da[_0x1b5e26];return _0x246191;};'use strict';var emlformat=require(_0xa71d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa71d('0x1'));var jsonpatch=require(_0xa71d('0x2'));var rp=require(_0xa71d('0x3'));var moment=require('moment');var BPromise=require(_0xa71d('0x4'));var Mustache=require('mustache');var util=require(_0xa71d('0x5'));var path=require(_0xa71d('0x6'));var sox=require(_0xa71d('0x7'));var csv=require(_0xa71d('0x8'));var ejs=require(_0xa71d('0x9'));var fs=require('fs');var fs_extra=require(_0xa71d('0xa'));var _=require(_0xa71d('0xb'));var squel=require(_0xa71d('0xc'));var crypto=require(_0xa71d('0xd'));var jsforce=require(_0xa71d('0xe'));var deskjs=require(_0xa71d('0xf'));var toCsv=require(_0xa71d('0x8'));var querystring=require(_0xa71d('0x10'));var Papa=require(_0xa71d('0x11'));var Redis=require(_0xa71d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa71d('0x13'));var as=require(_0xa71d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa71d('0x15'));var utils=require(_0xa71d('0x16'));var config=require(_0xa71d('0x17'));var licenseUtil=require(_0xa71d('0x18'));var db=require(_0xa71d('0x19'))['db'];function respondWithStatusCode(_0x2a64ab,_0x338c38){_0x338c38=_0x338c38||0xcc;return function(_0x685677){if(_0x685677){return _0x2a64ab[_0xa71d('0x1a')](_0x338c38);}return _0x2a64ab[_0xa71d('0x1b')](_0x338c38)['end']();};}function respondWithResult(_0x114aba,_0xfa1d1a){_0xfa1d1a=_0xfa1d1a||0xc8;return function(_0x5be266){if(_0x5be266){return _0x114aba[_0xa71d('0x1b')](_0xfa1d1a)[_0xa71d('0x1c')](_0x5be266);}};}function respondWithFilteredResult(_0x450e9e,_0x596edd){return function(_0x1d87c5){if(_0x1d87c5){var _0x1fc148=typeof _0x596edd[_0xa71d('0x1d')]===_0xa71d('0x1e')&&typeof _0x596edd[_0xa71d('0x1f')]==='undefined';var _0x272ea0=_0x1d87c5[_0xa71d('0x20')];var _0x230820=_0x1fc148?0x0:_0x596edd['offset'];var _0x2a3809=_0x1fc148?_0x1d87c5[_0xa71d('0x20')]:_0x596edd['offset']+_0x596edd['limit'];var _0x369fe0;if(_0x2a3809>=_0x272ea0){_0x2a3809=_0x272ea0;_0x369fe0=0xc8;}else{_0x369fe0=0xce;}_0x450e9e[_0xa71d('0x1b')](_0x369fe0);return _0x450e9e[_0xa71d('0x21')](_0xa71d('0x22'),_0x230820+'-'+_0x2a3809+'/'+_0x272ea0)[_0xa71d('0x1c')](_0x1d87c5);}return null;};}function patchUpdates(_0x49b5de){return function(_0x4387fb){try{jsonpatch[_0xa71d('0x23')](_0x4387fb,_0x49b5de,!![]);}catch(_0x154e0f){return BPromise[_0xa71d('0x24')](_0x154e0f);}return _0x4387fb[_0xa71d('0x25')]();};}function saveUpdates(_0x1d672e,_0x473c6d){return function(_0x247d9f){if(_0x247d9f){return _0x247d9f['update'](_0x1d672e)[_0xa71d('0x26')](function(_0x343253){return _0x343253;});}return null;};}function removeEntity(_0x49b560,_0x52f24d){return function(_0x174178){if(_0x174178){return _0x174178[_0xa71d('0x27')]()['then'](function(){_0x49b560[_0xa71d('0x1b')](0xcc)[_0xa71d('0x28')]();});}};}function handleEntityNotFound(_0x598ee2,_0x3e947d){return function(_0x266fa4){if(!_0x266fa4){_0x598ee2[_0xa71d('0x1a')](0x194);}return _0x266fa4;};}function handleError(_0x10a119,_0x28a3b1){_0x28a3b1=_0x28a3b1||0x1f4;return function(_0x128fbc){logger[_0xa71d('0x29')](_0x128fbc[_0xa71d('0x2a')]);if(_0x128fbc[_0xa71d('0x2b')]){delete _0x128fbc[_0xa71d('0x2b')];}_0x10a119[_0xa71d('0x1b')](_0x28a3b1)[_0xa71d('0x2c')](_0x128fbc);};}exports[_0xa71d('0x2d')]=function(_0x1f9859,_0x3ca7ba){var _0x11ee83={},_0x1f497e={},_0xfd3666={'count':0x0,'rows':[]};var _0x4118d6=_[_0xa71d('0x2e')](db[_0xa71d('0x2f')][_0xa71d('0x30')],function(_0x41a069){return{'name':_0x41a069[_0xa71d('0x31')],'type':_0x41a069[_0xa71d('0x32')][_0xa71d('0x33')]};});_0x1f497e[_0xa71d('0x34')]=_[_0xa71d('0x2e')](_0x4118d6,_0xa71d('0x2b'));_0x1f497e['query']=_['keys'](_0x1f9859[_0xa71d('0x35')]);_0x1f497e[_0xa71d('0x36')]=_[_0xa71d('0x37')](_0x1f497e[_0xa71d('0x34')],_0x1f497e[_0xa71d('0x35')]);_0x11ee83[_0xa71d('0x38')]=_['intersection'](_0x1f497e['model'],qs[_0xa71d('0x39')](_0x1f9859[_0xa71d('0x35')][_0xa71d('0x39')]));_0x11ee83['attributes']=_0x11ee83['attributes'][_0xa71d('0x3a')]?_0x11ee83[_0xa71d('0x38')]:_0x1f497e[_0xa71d('0x34')];if(!_0x1f9859[_0xa71d('0x35')][_0xa71d('0x3b')](_0xa71d('0x3c'))){_0x11ee83[_0xa71d('0x1f')]=qs['limit'](_0x1f9859[_0xa71d('0x35')][_0xa71d('0x1f')]);_0x11ee83[_0xa71d('0x1d')]=qs[_0xa71d('0x1d')](_0x1f9859[_0xa71d('0x35')][_0xa71d('0x1d')]);}_0x11ee83[_0xa71d('0x3d')]=qs[_0xa71d('0x3e')](_0x1f9859[_0xa71d('0x35')][_0xa71d('0x3e')]);_0x11ee83['where']=qs[_0xa71d('0x36')](_[_0xa71d('0x3f')](_0x1f9859['query'],_0x1f497e['filters']),_0x4118d6);if(_0x1f9859['query']['filter']){_0x11ee83[_0xa71d('0x40')]=_[_0xa71d('0x41')](_0x11ee83['where'],{'$or':_[_0xa71d('0x2e')](_0x4118d6,function(_0x561c0a){if(_0x561c0a[_0xa71d('0x32')]!==_0xa71d('0x42')){var _0x26637f={};_0x26637f[_0x561c0a[_0xa71d('0x2b')]]={'$like':'%'+_0x1f9859['query'][_0xa71d('0x43')]+'%'};return _0x26637f;}})});}_0x11ee83=_[_0xa71d('0x41')]({},_0x11ee83,_0x1f9859[_0xa71d('0x44')]);var _0x552506={'where':_0x11ee83[_0xa71d('0x40')]};return db[_0xa71d('0x2f')][_0xa71d('0x20')](_0x552506)[_0xa71d('0x26')](function(_0x55b6f1){_0xfd3666[_0xa71d('0x20')]=_0x55b6f1;if(_0x1f9859[_0xa71d('0x35')][_0xa71d('0x45')]){_0x11ee83[_0xa71d('0x46')]=[{'all':!![]}];}return db[_0xa71d('0x2f')][_0xa71d('0x47')](_0x11ee83);})['then'](function(_0x156371){_0xfd3666[_0xa71d('0x48')]=_0x156371;return _0xfd3666;})['then'](respondWithFilteredResult(_0x3ca7ba,_0x11ee83))['catch'](handleError(_0x3ca7ba,null));};exports['show']=function(_0x30bcd1,_0x3eea39){var _0x80ff40={'raw':!![],'where':{'id':_0x30bcd1['params']['id']}},_0x1aeda5={};_0x1aeda5[_0xa71d('0x34')]=_['keys'](db[_0xa71d('0x2f')][_0xa71d('0x30')]);_0x1aeda5[_0xa71d('0x35')]=_['keys'](_0x30bcd1[_0xa71d('0x35')]);_0x1aeda5[_0xa71d('0x36')]=_[_0xa71d('0x37')](_0x1aeda5['model'],_0x1aeda5[_0xa71d('0x35')]);_0x80ff40[_0xa71d('0x38')]=_[_0xa71d('0x37')](_0x1aeda5[_0xa71d('0x34')],qs[_0xa71d('0x39')](_0x30bcd1[_0xa71d('0x35')]['fields']));_0x80ff40['attributes']=_0x80ff40['attributes']['length']?_0x80ff40[_0xa71d('0x38')]:_0x1aeda5[_0xa71d('0x34')];if(_0x30bcd1[_0xa71d('0x35')]['includeAll']){_0x80ff40['include']=[{'all':!![]}];}_0x80ff40=_[_0xa71d('0x41')]({},_0x80ff40,_0x30bcd1[_0xa71d('0x44')]);return db['ServicenowField'][_0xa71d('0x49')](_0x80ff40)[_0xa71d('0x26')](handleEntityNotFound(_0x3eea39,null))['then'](respondWithResult(_0x3eea39,null))[_0xa71d('0x4a')](handleError(_0x3eea39,null));};exports[_0xa71d('0x4b')]=function(_0x584c81,_0x233289){return db[_0xa71d('0x2f')][_0xa71d('0x4b')](_0x584c81[_0xa71d('0x4c')],{})['then'](respondWithResult(_0x233289,0xc9))[_0xa71d('0x4a')](handleError(_0x233289,null));};exports[_0xa71d('0x4d')]=function(_0x3be52c,_0x215ef9){if(_0x3be52c['body']['id']){delete _0x3be52c[_0xa71d('0x4c')]['id'];}return db[_0xa71d('0x2f')][_0xa71d('0x49')]({'where':{'id':_0x3be52c[_0xa71d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x215ef9,null))['then'](saveUpdates(_0x3be52c[_0xa71d('0x4c')],null))[_0xa71d('0x26')](respondWithResult(_0x215ef9,null))[_0xa71d('0x4a')](handleError(_0x215ef9,null));};exports[_0xa71d('0x27')]=function(_0x56501c,_0x5d1ba5){return db[_0xa71d('0x2f')][_0xa71d('0x49')]({'where':{'id':_0x56501c[_0xa71d('0x4e')]['id']}})[_0xa71d('0x26')](handleEntityNotFound(_0x5d1ba5,null))['then'](removeEntity(_0x5d1ba5,null))[_0xa71d('0x4a')](handleError(_0x5d1ba5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 59d5e4d..dfeb0d9 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 _0xeded=['define','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x1260e8,_0x5b993f){var _0x5ed0d9=function(_0x3c0b78){while(--_0x3c0b78){_0x1260e8['push'](_0x1260e8['shift']());}};_0x5ed0d9(++_0x5b993f);}(_0xeded,0xd6));var _0xdede=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeded[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdede('0x0'));var util=require(_0xdede('0x1'));var logger=require(_0xdede('0x2'))(_0xdede('0x3'));var moment=require(_0xdede('0x4'));var BPromise=require(_0xdede('0x5'));var rp=require(_0xdede('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdede('0x7'));var attributes=require(_0xdede('0x8'));module[_0xdede('0x9')]=function(_0x35e689,_0x5f3c45){return _0x35e689[_0xdede('0xa')]('ServicenowField',attributes,{'tableName':_0xdede('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xdede('0xc'),_0xdede('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2a=['ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','path','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a2a,0x83));var _0xa3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa3a2('0x0'));var logger=require(_0xa3a2('0x1'))('api');var moment=require(_0xa3a2('0x2'));var BPromise=require(_0xa3a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3a2('0x4'));var rimraf=require('rimraf');var config=require(_0xa3a2('0x5'));var attributes=require(_0xa3a2('0x6'));module[_0xa3a2('0x7')]=function(_0x155e0e,_0x538e74){return _0x155e0e[_0xa3a2('0x8')](_0xa3a2('0x9'),attributes,{'tableName':_0xa3a2('0xa'),'paranoid':![],'indexes':[{'name':_0xa3a2('0xb'),'fields':[_0xa3a2('0xc'),_0xa3a2('0xd')],'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 723aecb..1d6de92 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x143b28,_0x3ecf8a){var _0x87cf5c=function(_0xe4be0){while(--_0xe4be0){_0x143b28['push'](_0x143b28['shift']());}};_0x87cf5c(++_0x3ecf8a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0x0713=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x564961,_0x3a3880){var _0x5b7fac=function(_0x50e56f){while(--_0x50e56f){_0x564961['push'](_0x564961['shift']());}};_0x5b7fac(++_0x3a3880);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bf80c74..2a0371b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa9041,_0x5eb3d2){var _0x101e90=function(_0x10a9db){while(--_0x10a9db){_0xa9041['push'](_0xa9041['shift']());}};_0x101e90(++_0x5eb3d2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0xc680ec,_0x497082){var _0x3cd17b=function(_0x1b6287){while(--_0x1b6287){_0xc680ec['push'](_0xc680ec['shift']());}};_0x3cd17b(++_0x497082);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 7fc6913..52ad58a 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(_0x3b2e30,_0x1981f2){var _0x3a083a=function(_0x3658dd){while(--_0x3658dd){_0x3b2e30['push'](_0x3b2e30['shift']());}};_0x3a083a(++_0x1981f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x1b7f84,_0x14a243){var _0x9ba1f6=function(_0x4ba11d){while(--_0x4ba11d){_0x1b7f84['push'](_0x1b7f84['shift']());}};_0x9ba1f6(++_0x14a243);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b0a670f..aa5cca4 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 _0xb23a=['limit','count','set','Content-Range','json','apply','save','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','show','params','find','catch','create','body','update','findOne','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','get_module_fields','Calls','remove','includes','label','endsWith','values','value','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x108a9e,_0x127671){var _0x1fd4b6=function(_0x2cf277){while(--_0x2cf277){_0x108a9e['push'](_0x108a9e['shift']());}};_0x1fd4b6(++_0x127671);}(_0xb23a,0xcf));var _0xab23=function(_0xcc06bb,_0x5a4d98){_0xcc06bb=_0xcc06bb-0x0;var _0x33e773=_0xb23a[_0xcc06bb];return _0x33e773;};'use strict';var emlformat=require(_0xab23('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xab23('0x1'));var rp=require(_0xab23('0x2'));var moment=require(_0xab23('0x3'));var BPromise=require(_0xab23('0x4'));var Mustache=require(_0xab23('0x5'));var util=require(_0xab23('0x6'));var path=require(_0xab23('0x7'));var sox=require(_0xab23('0x8'));var csv=require(_0xab23('0x9'));var ejs=require(_0xab23('0xa'));var fs=require('fs');var fs_extra=require(_0xab23('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xab23('0xc'));var jsforce=require(_0xab23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xab23('0x9'));var querystring=require(_0xab23('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab23('0xf'));var qs=require(_0xab23('0x10'));var as=require(_0xab23('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xab23('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xab23('0x13'));var licenseUtil=require(_0xab23('0x14'));var db=require(_0xab23('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2c3c9e,_0x2c7a57){_0x2c7a57=_0x2c7a57||0xcc;return function(_0x20db2c){if(_0x20db2c){return _0x2c3c9e[_0xab23('0x16')](_0x2c7a57);}return _0x2c3c9e['status'](_0x2c7a57)[_0xab23('0x17')]();};}function respondWithResult(_0x4b60a6,_0xa30c57){_0xa30c57=_0xa30c57||0xc8;return function(_0xf023bd){if(_0xf023bd){return _0x4b60a6[_0xab23('0x18')](_0xa30c57)['json'](_0xf023bd);}};}function respondWithFilteredResult(_0x51b2b6,_0x3c13b2){return function(_0x37136c){if(_0x37136c){var _0x1e1c36=typeof _0x3c13b2[_0xab23('0x19')]===_0xab23('0x1a')&&typeof _0x3c13b2[_0xab23('0x1b')]==='undefined';var _0x3ba515=_0x37136c[_0xab23('0x1c')];var _0x2f242a=_0x1e1c36?0x0:_0x3c13b2[_0xab23('0x19')];var _0x3a4ebe=_0x1e1c36?_0x37136c[_0xab23('0x1c')]:_0x3c13b2[_0xab23('0x19')]+_0x3c13b2['limit'];var _0x245800;if(_0x3a4ebe>=_0x3ba515){_0x3a4ebe=_0x3ba515;_0x245800=0xc8;}else{_0x245800=0xce;}_0x51b2b6['status'](_0x245800);return _0x51b2b6[_0xab23('0x1d')](_0xab23('0x1e'),_0x2f242a+'-'+_0x3a4ebe+'/'+_0x3ba515)[_0xab23('0x1f')](_0x37136c);}return null;};}function patchUpdates(_0x3f2308){return function(_0x1ba266){try{jsonpatch[_0xab23('0x20')](_0x1ba266,_0x3f2308,!![]);}catch(_0x1d42aa){return BPromise['reject'](_0x1d42aa);}return _0x1ba266[_0xab23('0x21')]();};}function saveUpdates(_0x50382a,_0x353af0){return function(_0x6c1e53){if(_0x6c1e53){return _0x6c1e53['update'](_0x50382a)['then'](function(_0x531083){return _0x531083;});}return null;};}function removeEntity(_0x375bc4,_0x2fb9d9){return function(_0x31a1ad){if(_0x31a1ad){return _0x31a1ad[_0xab23('0x22')]()['then'](function(){_0x375bc4[_0xab23('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4c7e,_0x22c865){return function(_0x2cee72){if(!_0x2cee72){_0x3c4c7e['sendStatus'](0x194);}return _0x2cee72;};}function handleError(_0x5a9e6f,_0x18b848){_0x18b848=_0x18b848||0x1f4;return function(_0xf7278d){logger[_0xab23('0x23')](_0xf7278d[_0xab23('0x24')]);if(_0xf7278d[_0xab23('0x25')]){delete _0xf7278d[_0xab23('0x25')];}_0x5a9e6f[_0xab23('0x18')](_0x18b848)['send'](_0xf7278d);};}exports[_0xab23('0x26')]=function(_0x5e5c51,_0x127d6e){var _0x24166b={},_0x10fa7={},_0x3cbc18={'count':0x0,'rows':[]};var _0x446881=_[_0xab23('0x27')](db[_0xab23('0x28')][_0xab23('0x29')],function(_0x2e610b){return{'name':_0x2e610b[_0xab23('0x2a')],'type':_0x2e610b['type'][_0xab23('0x2b')]};});_0x10fa7[_0xab23('0x2c')]=_[_0xab23('0x27')](_0x446881,_0xab23('0x25'));_0x10fa7['query']=_[_0xab23('0x2d')](_0x5e5c51[_0xab23('0x2e')]);_0x10fa7['filters']=_[_0xab23('0x2f')](_0x10fa7[_0xab23('0x2c')],_0x10fa7[_0xab23('0x2e')]);_0x24166b[_0xab23('0x30')]=_[_0xab23('0x2f')](_0x10fa7[_0xab23('0x2c')],qs[_0xab23('0x31')](_0x5e5c51[_0xab23('0x2e')][_0xab23('0x31')]));_0x24166b[_0xab23('0x30')]=_0x24166b[_0xab23('0x30')][_0xab23('0x32')]?_0x24166b[_0xab23('0x30')]:_0x10fa7[_0xab23('0x2c')];if(!_0x5e5c51[_0xab23('0x2e')][_0xab23('0x33')](_0xab23('0x34'))){_0x24166b[_0xab23('0x1b')]=qs['limit'](_0x5e5c51['query'][_0xab23('0x1b')]);_0x24166b[_0xab23('0x19')]=qs['offset'](_0x5e5c51['query']['offset']);}_0x24166b[_0xab23('0x35')]=qs[_0xab23('0x36')](_0x5e5c51[_0xab23('0x2e')][_0xab23('0x36')]);_0x24166b[_0xab23('0x37')]=qs[_0xab23('0x38')](_[_0xab23('0x39')](_0x5e5c51['query'],_0x10fa7[_0xab23('0x38')]),_0x446881);if(_0x5e5c51['query'][_0xab23('0x3a')]){_0x24166b['where']=_[_0xab23('0x3b')](_0x24166b[_0xab23('0x37')],{'$or':_[_0xab23('0x27')](_0x446881,function(_0x39451a){if(_0x39451a[_0xab23('0x3c')]!==_0xab23('0x3d')){var _0x5cdedb={};_0x5cdedb[_0x39451a[_0xab23('0x25')]]={'$like':'%'+_0x5e5c51[_0xab23('0x2e')][_0xab23('0x3a')]+'%'};return _0x5cdedb;}})});}_0x24166b=_[_0xab23('0x3b')]({},_0x24166b,_0x5e5c51[_0xab23('0x3e')]);var _0x1163ef={'where':_0x24166b['where']};return db[_0xab23('0x28')]['count'](_0x1163ef)[_0xab23('0x3f')](function(_0x299620){_0x3cbc18[_0xab23('0x1c')]=_0x299620;if(_0x5e5c51['query'][_0xab23('0x40')]){_0x24166b[_0xab23('0x41')]=[{'all':!![]}];}return db[_0xab23('0x28')]['findAll'](_0x24166b);})[_0xab23('0x3f')](function(_0x144f2){_0x3cbc18[_0xab23('0x42')]=_0x144f2;return _0x3cbc18;})[_0xab23('0x3f')](respondWithFilteredResult(_0x127d6e,_0x24166b))['catch'](handleError(_0x127d6e,null));};exports[_0xab23('0x43')]=function(_0x5ca4e7,_0xea2de9){var _0xb4710a={'raw':![],'where':{'id':_0x5ca4e7[_0xab23('0x44')]['id']}},_0x9300cb={};_0x9300cb[_0xab23('0x2c')]=_['keys'](db[_0xab23('0x28')][_0xab23('0x29')]);_0x9300cb[_0xab23('0x2e')]=_['keys'](_0x5ca4e7[_0xab23('0x2e')]);_0x9300cb[_0xab23('0x38')]=_[_0xab23('0x2f')](_0x9300cb[_0xab23('0x2c')],_0x9300cb[_0xab23('0x2e')]);_0xb4710a['attributes']=_['intersection'](_0x9300cb['model'],qs['fields'](_0x5ca4e7[_0xab23('0x2e')][_0xab23('0x31')]));_0xb4710a[_0xab23('0x30')]=_0xb4710a[_0xab23('0x30')][_0xab23('0x32')]?_0xb4710a[_0xab23('0x30')]:_0x9300cb[_0xab23('0x2c')];if(_0x5ca4e7['query'][_0xab23('0x40')]){_0xb4710a[_0xab23('0x41')]=[{'all':!![]}];}_0xb4710a=_[_0xab23('0x3b')]({},_0xb4710a,_0x5ca4e7[_0xab23('0x3e')]);return db[_0xab23('0x28')][_0xab23('0x45')](_0xb4710a)['then'](handleEntityNotFound(_0xea2de9,null))[_0xab23('0x3f')](respondWithResult(_0xea2de9,null))[_0xab23('0x46')](handleError(_0xea2de9,null));};exports[_0xab23('0x47')]=function(_0x17984d,_0x15451d){return db['SugarcrmAccount']['create'](_0x17984d[_0xab23('0x48')],{})[_0xab23('0x3f')](respondWithResult(_0x15451d,0xc9))[_0xab23('0x46')](handleError(_0x15451d,null));};exports[_0xab23('0x49')]=function(_0x324170,_0x51d8e3){if(_0x324170['body']['id']){delete _0x324170[_0xab23('0x48')]['id'];}return db['SugarcrmAccount'][_0xab23('0x45')]({'where':{'id':_0x324170[_0xab23('0x44')]['id']}})[_0xab23('0x3f')](handleEntityNotFound(_0x51d8e3,null))['then'](saveUpdates(_0x324170['body'],null))['then'](respondWithResult(_0x51d8e3,null))[_0xab23('0x46')](handleError(_0x51d8e3,null));};exports['destroy']=function(_0x1cd2ac,_0x55e483){return db[_0xab23('0x28')][_0xab23('0x45')]({'where':{'id':_0x1cd2ac[_0xab23('0x44')]['id']}})[_0xab23('0x3f')](handleEntityNotFound(_0x55e483,null))[_0xab23('0x3f')](removeEntity(_0x55e483,null))[_0xab23('0x46')](handleError(_0x55e483,null));};exports['getConfigurations']=function(_0x2f5ef7,_0x42ab3b,_0x3908aa){var _0x2e431d={};var _0x566e8f={};var _0x194b0e;var _0x5d275a;return db[_0xab23('0x28')][_0xab23('0x4a')]({'where':{'id':_0x2f5ef7['params']['id']}})['then'](handleEntityNotFound(_0x42ab3b,null))[_0xab23('0x3f')](function(_0x1bad61){if(_0x1bad61){_0x194b0e=_0x1bad61;_0x566e8f['model']=_[_0xab23('0x2d')](db['SugarcrmConfiguration']['rawAttributes']);_0x566e8f[_0xab23('0x2e')]=_['keys'](_0x2f5ef7['query']);_0x566e8f[_0xab23('0x38')]=_[_0xab23('0x2f')](_0x566e8f[_0xab23('0x2c')],_0x566e8f[_0xab23('0x2e')]);_0x2e431d[_0xab23('0x30')]=_[_0xab23('0x2f')](_0x566e8f[_0xab23('0x2c')],qs[_0xab23('0x31')](_0x2f5ef7['query'][_0xab23('0x31')]));_0x2e431d['attributes']=_0x2e431d[_0xab23('0x30')][_0xab23('0x32')]?_0x2e431d[_0xab23('0x30')]:_0x566e8f['model'];_0x2e431d[_0xab23('0x35')]=qs['sort'](_0x2f5ef7['query'][_0xab23('0x36')]);_0x2e431d[_0xab23('0x37')]=qs['filters'](_[_0xab23('0x39')](_0x2f5ef7[_0xab23('0x2e')],_0x566e8f['filters']));if(_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x3a')]){_0x2e431d[_0xab23('0x37')]=_[_0xab23('0x3b')](_0x2e431d['where'],{'$or':_[_0xab23('0x27')](_0x2e431d[_0xab23('0x30')],function(_0xcf280f){var _0x49df22={};_0x49df22[_0xcf280f]={'$like':'%'+_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x3a')]+'%'};return _0x49df22;})});}_0x2e431d=_['merge']({},_0x2e431d,_0x2f5ef7[_0xab23('0x3e')]);return _0x194b0e[_0xab23('0x4b')](_0x2e431d);}})[_0xab23('0x3f')](function(_0x5d81d8){if(_0x5d81d8){_0x5d275a=_0x5d81d8[_0xab23('0x32')];if(!_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x33')]('nolimit')){_0x2e431d['limit']=qs['limit'](_0x2f5ef7[_0xab23('0x2e')][_0xab23('0x1b')]);_0x2e431d[_0xab23('0x19')]=qs['offset'](_0x2f5ef7[_0xab23('0x2e')]['offset']);}return _0x194b0e[_0xab23('0x4b')](_0x2e431d);}})[_0xab23('0x3f')](function(_0x4a8583){if(_0x4a8583){return _0x4a8583?{'count':_0x5d275a,'rows':_0x4a8583}:null;}})[_0xab23('0x3f')](respondWithResult(_0x42ab3b,null))[_0xab23('0x46')](handleError(_0x42ab3b,null));};exports['addConfiguration']=function(_0x56737c,_0x2d97b2,_0x1ef4b9){if(_0x56737c[_0xab23('0x48')]['id']){delete _0x56737c[_0xab23('0x48')]['id'];}return db['SugarcrmAccount'][_0xab23('0x4a')]({'where':{'id':_0x56737c[_0xab23('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d97b2,null))['then'](function(_0x970dd){if(_0x970dd){_0x56737c['body'][_0xab23('0x4c')]=_0x970dd['id'];_0x56737c[_0xab23('0x48')][_0xab23('0x4d')]=integrations['getSubjects'](_0x56737c[_0xab23('0x48')][_0xab23('0x4e')],_0x56737c[_0xab23('0x48')][_0xab23('0x3c')]);_0x56737c['body'][_0xab23('0x4f')]=integrations[_0xab23('0x50')](_0x56737c[_0xab23('0x48')]['channel'],_0x56737c[_0xab23('0x48')][_0xab23('0x3c')]);return db[_0xab23('0x51')]['create'](_0x56737c[_0xab23('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0xab23('0x4d')},{'model':db[_0xab23('0x52')],'as':_0xab23('0x4f')}]});}return null;})['then'](respondWithResult(_0x2d97b2,null))[_0xab23('0x46')](handleError(_0x2d97b2,null));};exports[_0xab23('0x53')]=function(_0x568eef,_0x55fb0d,_0x465456){var _0x3a14b5='';var _0x2e3a8b=['id',_0xab23('0x25'),'assigned_user_id',_0xab23('0x54'),'description',_0xab23('0x55'),_0xab23('0x56'),_0xab23('0x57'),'parent_id',_0xab23('0x58'),_0xab23('0x59'),_0xab23('0x5a')];return db[_0xab23('0x28')]['findOne']({'where':{'id':_0x568eef[_0xab23('0x44')]['id']},'attributes':['id',_0xab23('0x5b'),_0xab23('0x5c'),_0xab23('0x5d')]})[_0xab23('0x3f')](handleEntityNotFound(_0x55fb0d,null))[_0xab23('0x3f')](function(_0x41550b){if(_0x41550b){_0x3a14b5=_0x41550b[_0xab23('0x5d')];var _0x3adf81=_0x3a14b5[_0xab23('0x5e')](-0x1);if(_0x3adf81==='/'){_0x3a14b5=_0x3a14b5['substring'](0x0,_0x3a14b5[_0xab23('0x5f')](_0x3adf81));}return rp({'method':_0xab23('0x60'),'uri':util[_0xab23('0x61')](_0xab23('0x62'),_0x3a14b5,_0xab23('0x63')),'json':!![],'form':{'method':_0xab23('0x64'),'input_type':_0xab23('0x65'),'response_type':_0xab23('0x65'),'rest_data':JSON[_0xab23('0x66')]({'user_auth':{'user_name':_0x41550b['username'],'password':_0x41550b[_0xab23('0x5c')],'encryption':_0xab23('0x67')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xab23('0x3f')](function(_0x44dec4){if(_0x44dec4&&_0x44dec4[_0xab23('0x25')]!==_0xab23('0x68')&&_0x44dec4[_0xab23('0x25')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x3a14b5,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xab23('0x69'),'input_type':_0xab23('0x65'),'response_type':_0xab23('0x65'),'rest_data':JSON['stringify']({'session':_0x44dec4['id'],'module_name':_0xab23('0x6a')})}})[_0xab23('0x3f')](function(_0x10131e){if(_0x10131e){var _0x19c28c=_['values'](_0x10131e['module_fields']);_[_0xab23('0x6b')](_0x19c28c,function(_0x4049a0){return _0x2e3a8b[_0xab23('0x6c')](_0x4049a0[_0xab23('0x25')]);});return{'count':_0x19c28c['length'],'rows':_[_0xab23('0x27')](_0x19c28c,function(_0x2e28c9){return{'id':_0x2e28c9['name'],'name':_0x2e28c9[_0xab23('0x6d')],'custom':_[_0xab23('0x6e')](_0x2e28c9['name'],'_c')?!![]:![],'options':_0x2e28c9[_0xab23('0x3e')]?_['map'](_[_0xab23('0x6f')](_0x2e28c9[_0xab23('0x3e')]),function(_0x37ba01){return{'name':_0x37ba01[_0xab23('0x70')],'value':_0x37ba01[_0xab23('0x25')]};}):[]};})};}})[_0xab23('0x3f')](respondWithResult(_0x55fb0d,null))[_0xab23('0x46')](function(_0x44bd19){var _0x1079b2=_0x568eef[_0xab23('0x2e')]['test']?0x1f4:_0x44bd19['statusCode']||0x1f4;logger['error'](_0xab23('0x71'),_0xab23('0x53'),_0x1079b2,JSON[_0xab23('0x66')](_0x44bd19));delete _0x44bd19[_0xab23('0x25')];if(_0x1079b2===0x191){_0x1079b2=0x190;}_0x55fb0d[_0xab23('0x18')](_0x1079b2)[_0xab23('0x72')](_0x568eef[_0xab23('0x2e')][_0xab23('0x73')]?{'message':_0xab23('0x74'),'statusCode':_0x44bd19['statusCode']}:_0x44bd19);});}else{var _0x24257c=0x1f4;_0x55fb0d[_0xab23('0x18')](_0x24257c)[_0xab23('0x72')]({'message':_0xab23('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xfd36=['json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','includeAll','rows','catch','show','params','include','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','filter','options','AccountId','getSubjects','type','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','POST','get_module_fields','values','module_fields','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x586ac8,_0x200fd1){var _0x11ba48=function(_0x2cb8ec){while(--_0x2cb8ec){_0x586ac8['push'](_0x586ac8['shift']());}};_0x11ba48(++_0x200fd1);}(_0xfd36,0xc4));var _0x6fd3=function(_0x2fbfa8,_0x46d72f){_0x2fbfa8=_0x2fbfa8-0x0;var _0x1ce726=_0xfd36[_0x2fbfa8];return _0x1ce726;};'use strict';var emlformat=require(_0x6fd3('0x0'));var rimraf=require(_0x6fd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fd3('0x2'));var rp=require(_0x6fd3('0x3'));var moment=require(_0x6fd3('0x4'));var BPromise=require(_0x6fd3('0x5'));var Mustache=require(_0x6fd3('0x6'));var util=require(_0x6fd3('0x7'));var path=require(_0x6fd3('0x8'));var sox=require(_0x6fd3('0x9'));var csv=require(_0x6fd3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fd3('0xb'));var _=require('lodash');var squel=require(_0x6fd3('0xc'));var crypto=require(_0x6fd3('0xd'));var jsforce=require(_0x6fd3('0xe'));var deskjs=require(_0x6fd3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6fd3('0x10'));var Papa=require('papaparse');var Redis=require(_0x6fd3('0x11'));var authService=require(_0x6fd3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6fd3('0x13'));var hardwareService=require(_0x6fd3('0x14'));var logger=require(_0x6fd3('0x15'))('api');var utils=require(_0x6fd3('0x16'));var config=require(_0x6fd3('0x17'));var licenseUtil=require(_0x6fd3('0x18'));var db=require(_0x6fd3('0x19'))['db'];var integrations=require(_0x6fd3('0x1a'));function respondWithStatusCode(_0x48a420,_0x4d3036){_0x4d3036=_0x4d3036||0xcc;return function(_0x488f3b){if(_0x488f3b){return _0x48a420[_0x6fd3('0x1b')](_0x4d3036);}return _0x48a420['status'](_0x4d3036)[_0x6fd3('0x1c')]();};}function respondWithResult(_0x5b1055,_0x49dd7b){_0x49dd7b=_0x49dd7b||0xc8;return function(_0x5a2f99){if(_0x5a2f99){return _0x5b1055[_0x6fd3('0x1d')](_0x49dd7b)[_0x6fd3('0x1e')](_0x5a2f99);}};}function respondWithFilteredResult(_0x12a15f,_0x1e987b){return function(_0x473c58){if(_0x473c58){var _0x5ec3a3=typeof _0x1e987b[_0x6fd3('0x1f')]==='undefined'&&typeof _0x1e987b['limit']==='undefined';var _0x3df77a=_0x473c58[_0x6fd3('0x20')];var _0x3227e6=_0x5ec3a3?0x0:_0x1e987b[_0x6fd3('0x1f')];var _0x2c6f55=_0x5ec3a3?_0x473c58['count']:_0x1e987b[_0x6fd3('0x1f')]+_0x1e987b['limit'];var _0xdeaf20;if(_0x2c6f55>=_0x3df77a){_0x2c6f55=_0x3df77a;_0xdeaf20=0xc8;}else{_0xdeaf20=0xce;}_0x12a15f[_0x6fd3('0x1d')](_0xdeaf20);return _0x12a15f[_0x6fd3('0x21')](_0x6fd3('0x22'),_0x3227e6+'-'+_0x2c6f55+'/'+_0x3df77a)[_0x6fd3('0x1e')](_0x473c58);}return null;};}function patchUpdates(_0x11bbc6){return function(_0x50b615){try{jsonpatch[_0x6fd3('0x23')](_0x50b615,_0x11bbc6,!![]);}catch(_0x286e53){return BPromise[_0x6fd3('0x24')](_0x286e53);}return _0x50b615[_0x6fd3('0x25')]();};}function saveUpdates(_0x3f0dff,_0xf78826){return function(_0x1e3432){if(_0x1e3432){return _0x1e3432[_0x6fd3('0x26')](_0x3f0dff)[_0x6fd3('0x27')](function(_0x33a762){return _0x33a762;});}return null;};}function removeEntity(_0x443091,_0x564289){return function(_0x1b1d7b){if(_0x1b1d7b){return _0x1b1d7b[_0x6fd3('0x28')]()[_0x6fd3('0x27')](function(){_0x443091[_0x6fd3('0x1d')](0xcc)[_0x6fd3('0x1c')]();});}};}function handleEntityNotFound(_0x2bcf0d,_0xe1567){return function(_0x156d1f){if(!_0x156d1f){_0x2bcf0d[_0x6fd3('0x1b')](0x194);}return _0x156d1f;};}function handleError(_0x3a005a,_0x3c977a){_0x3c977a=_0x3c977a||0x1f4;return function(_0x588a36){logger[_0x6fd3('0x29')](_0x588a36['stack']);if(_0x588a36['name']){delete _0x588a36[_0x6fd3('0x2a')];}_0x3a005a[_0x6fd3('0x1d')](_0x3c977a)['send'](_0x588a36);};}exports['index']=function(_0x516889,_0x3c9906){var _0x26618c={},_0x1771cb={},_0x8d07ec={'count':0x0,'rows':[]};var _0x5ddafd=_[_0x6fd3('0x2b')](db[_0x6fd3('0x2c')][_0x6fd3('0x2d')],function(_0x5d8083){return{'name':_0x5d8083[_0x6fd3('0x2e')],'type':_0x5d8083['type'][_0x6fd3('0x2f')]};});_0x1771cb[_0x6fd3('0x30')]=_[_0x6fd3('0x2b')](_0x5ddafd,_0x6fd3('0x2a'));_0x1771cb['query']=_[_0x6fd3('0x31')](_0x516889[_0x6fd3('0x32')]);_0x1771cb[_0x6fd3('0x33')]=_[_0x6fd3('0x34')](_0x1771cb[_0x6fd3('0x30')],_0x1771cb[_0x6fd3('0x32')]);_0x26618c[_0x6fd3('0x35')]=_[_0x6fd3('0x34')](_0x1771cb[_0x6fd3('0x30')],qs[_0x6fd3('0x36')](_0x516889[_0x6fd3('0x32')][_0x6fd3('0x36')]));_0x26618c[_0x6fd3('0x35')]=_0x26618c[_0x6fd3('0x35')][_0x6fd3('0x37')]?_0x26618c['attributes']:_0x1771cb[_0x6fd3('0x30')];if(!_0x516889[_0x6fd3('0x32')][_0x6fd3('0x38')](_0x6fd3('0x39'))){_0x26618c['limit']=qs['limit'](_0x516889['query'][_0x6fd3('0x3a')]);_0x26618c[_0x6fd3('0x1f')]=qs[_0x6fd3('0x1f')](_0x516889[_0x6fd3('0x32')][_0x6fd3('0x1f')]);}_0x26618c[_0x6fd3('0x3b')]=qs[_0x6fd3('0x3c')](_0x516889[_0x6fd3('0x32')][_0x6fd3('0x3c')]);_0x26618c['where']=qs['filters'](_[_0x6fd3('0x3d')](_0x516889[_0x6fd3('0x32')],_0x1771cb[_0x6fd3('0x33')]),_0x5ddafd);if(_0x516889[_0x6fd3('0x32')]['filter']){_0x26618c[_0x6fd3('0x3e')]=_[_0x6fd3('0x3f')](_0x26618c['where'],{'$or':_['map'](_0x5ddafd,function(_0x13d63f){if(_0x13d63f['type']!==_0x6fd3('0x40')){var _0x53c58d={};_0x53c58d[_0x13d63f['name']]={'$like':'%'+_0x516889[_0x6fd3('0x32')]['filter']+'%'};return _0x53c58d;}})});}_0x26618c=_[_0x6fd3('0x3f')]({},_0x26618c,_0x516889['options']);var _0x20de06={'where':_0x26618c[_0x6fd3('0x3e')]};return db['SugarcrmAccount']['count'](_0x20de06)['then'](function(_0x5b3889){_0x8d07ec[_0x6fd3('0x20')]=_0x5b3889;if(_0x516889[_0x6fd3('0x32')][_0x6fd3('0x41')]){_0x26618c['include']=[{'all':!![]}];}return db[_0x6fd3('0x2c')]['findAll'](_0x26618c);})[_0x6fd3('0x27')](function(_0x3f731f){_0x8d07ec[_0x6fd3('0x42')]=_0x3f731f;return _0x8d07ec;})['then'](respondWithFilteredResult(_0x3c9906,_0x26618c))[_0x6fd3('0x43')](handleError(_0x3c9906,null));};exports[_0x6fd3('0x44')]=function(_0x30d1cc,_0x5b6b12){var _0xc68624={'raw':![],'where':{'id':_0x30d1cc[_0x6fd3('0x45')]['id']}},_0x3a6088={};_0x3a6088[_0x6fd3('0x30')]=_['keys'](db[_0x6fd3('0x2c')][_0x6fd3('0x2d')]);_0x3a6088[_0x6fd3('0x32')]=_[_0x6fd3('0x31')](_0x30d1cc['query']);_0x3a6088[_0x6fd3('0x33')]=_['intersection'](_0x3a6088[_0x6fd3('0x30')],_0x3a6088[_0x6fd3('0x32')]);_0xc68624['attributes']=_[_0x6fd3('0x34')](_0x3a6088[_0x6fd3('0x30')],qs['fields'](_0x30d1cc[_0x6fd3('0x32')][_0x6fd3('0x36')]));_0xc68624[_0x6fd3('0x35')]=_0xc68624[_0x6fd3('0x35')]['length']?_0xc68624[_0x6fd3('0x35')]:_0x3a6088[_0x6fd3('0x30')];if(_0x30d1cc[_0x6fd3('0x32')]['includeAll']){_0xc68624[_0x6fd3('0x46')]=[{'all':!![]}];}_0xc68624=_[_0x6fd3('0x3f')]({},_0xc68624,_0x30d1cc['options']);return db[_0x6fd3('0x2c')]['find'](_0xc68624)[_0x6fd3('0x27')](handleEntityNotFound(_0x5b6b12,null))[_0x6fd3('0x27')](respondWithResult(_0x5b6b12,null))['catch'](handleError(_0x5b6b12,null));};exports[_0x6fd3('0x47')]=function(_0x3b5c56,_0x35a1fd){return db['SugarcrmAccount'][_0x6fd3('0x47')](_0x3b5c56[_0x6fd3('0x48')],{})['then'](respondWithResult(_0x35a1fd,0xc9))['catch'](handleError(_0x35a1fd,null));};exports['update']=function(_0x3be9b1,_0x2395ae){if(_0x3be9b1[_0x6fd3('0x48')]['id']){delete _0x3be9b1[_0x6fd3('0x48')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x3be9b1[_0x6fd3('0x45')]['id']}})[_0x6fd3('0x27')](handleEntityNotFound(_0x2395ae,null))[_0x6fd3('0x27')](saveUpdates(_0x3be9b1[_0x6fd3('0x48')],null))[_0x6fd3('0x27')](respondWithResult(_0x2395ae,null))[_0x6fd3('0x43')](handleError(_0x2395ae,null));};exports[_0x6fd3('0x28')]=function(_0x2d518e,_0x3c6ad8){return db['SugarcrmAccount'][_0x6fd3('0x49')]({'where':{'id':_0x2d518e[_0x6fd3('0x45')]['id']}})[_0x6fd3('0x27')](handleEntityNotFound(_0x3c6ad8,null))[_0x6fd3('0x27')](removeEntity(_0x3c6ad8,null))[_0x6fd3('0x43')](handleError(_0x3c6ad8,null));};exports[_0x6fd3('0x4a')]=function(_0x52b75c,_0x2aabda,_0xf91ec0){var _0x4b02b0={};var _0x1cf31c={};var _0x995220;var _0x453631;return db[_0x6fd3('0x2c')][_0x6fd3('0x4b')]({'where':{'id':_0x52b75c[_0x6fd3('0x45')]['id']}})[_0x6fd3('0x27')](handleEntityNotFound(_0x2aabda,null))['then'](function(_0x320b4c){if(_0x320b4c){_0x995220=_0x320b4c;_0x1cf31c[_0x6fd3('0x30')]=_[_0x6fd3('0x31')](db[_0x6fd3('0x4c')][_0x6fd3('0x2d')]);_0x1cf31c[_0x6fd3('0x32')]=_['keys'](_0x52b75c['query']);_0x1cf31c[_0x6fd3('0x33')]=_['intersection'](_0x1cf31c['model'],_0x1cf31c[_0x6fd3('0x32')]);_0x4b02b0['attributes']=_[_0x6fd3('0x34')](_0x1cf31c['model'],qs['fields'](_0x52b75c[_0x6fd3('0x32')]['fields']));_0x4b02b0['attributes']=_0x4b02b0[_0x6fd3('0x35')]['length']?_0x4b02b0[_0x6fd3('0x35')]:_0x1cf31c[_0x6fd3('0x30')];_0x4b02b0[_0x6fd3('0x3b')]=qs['sort'](_0x52b75c[_0x6fd3('0x32')][_0x6fd3('0x3c')]);_0x4b02b0[_0x6fd3('0x3e')]=qs[_0x6fd3('0x33')](_['pick'](_0x52b75c[_0x6fd3('0x32')],_0x1cf31c[_0x6fd3('0x33')]));if(_0x52b75c['query'][_0x6fd3('0x4d')]){_0x4b02b0['where']=_['merge'](_0x4b02b0['where'],{'$or':_['map'](_0x4b02b0['attributes'],function(_0x192e6b){var _0x1afaaa={};_0x1afaaa[_0x192e6b]={'$like':'%'+_0x52b75c['query'][_0x6fd3('0x4d')]+'%'};return _0x1afaaa;})});}_0x4b02b0=_['merge']({},_0x4b02b0,_0x52b75c[_0x6fd3('0x4e')]);return _0x995220[_0x6fd3('0x4a')](_0x4b02b0);}})[_0x6fd3('0x27')](function(_0x1606a2){if(_0x1606a2){_0x453631=_0x1606a2[_0x6fd3('0x37')];if(!_0x52b75c[_0x6fd3('0x32')][_0x6fd3('0x38')](_0x6fd3('0x39'))){_0x4b02b0[_0x6fd3('0x3a')]=qs[_0x6fd3('0x3a')](_0x52b75c[_0x6fd3('0x32')]['limit']);_0x4b02b0['offset']=qs['offset'](_0x52b75c[_0x6fd3('0x32')][_0x6fd3('0x1f')]);}return _0x995220[_0x6fd3('0x4a')](_0x4b02b0);}})[_0x6fd3('0x27')](function(_0x23f32a){if(_0x23f32a){return _0x23f32a?{'count':_0x453631,'rows':_0x23f32a}:null;}})[_0x6fd3('0x27')](respondWithResult(_0x2aabda,null))[_0x6fd3('0x43')](handleError(_0x2aabda,null));};exports['addConfiguration']=function(_0x13ba20,_0x3df2dc,_0x130c41){if(_0x13ba20[_0x6fd3('0x48')]['id']){delete _0x13ba20[_0x6fd3('0x48')]['id'];}return db['SugarcrmAccount'][_0x6fd3('0x4b')]({'where':{'id':_0x13ba20[_0x6fd3('0x45')]['id']}})[_0x6fd3('0x27')](handleEntityNotFound(_0x3df2dc,null))[_0x6fd3('0x27')](function(_0x553cf1){if(_0x553cf1){_0x13ba20[_0x6fd3('0x48')][_0x6fd3('0x4f')]=_0x553cf1['id'];_0x13ba20[_0x6fd3('0x48')]['Subjects']=integrations[_0x6fd3('0x50')](_0x13ba20[_0x6fd3('0x48')]['channel'],_0x13ba20[_0x6fd3('0x48')][_0x6fd3('0x51')]);_0x13ba20[_0x6fd3('0x48')][_0x6fd3('0x52')]=integrations[_0x6fd3('0x53')](_0x13ba20[_0x6fd3('0x48')]['channel'],_0x13ba20['body'][_0x6fd3('0x51')]);return db[_0x6fd3('0x4c')][_0x6fd3('0x47')](_0x13ba20['body'],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x6fd3('0x54')],'as':'Descriptions'}]});}return null;})[_0x6fd3('0x27')](respondWithResult(_0x3df2dc,null))['catch'](handleError(_0x3df2dc,null));};exports[_0x6fd3('0x55')]=function(_0x5a50be,_0x297690,_0xd39c42){var _0x4ee291='';var _0x27cb31=['id','name','assigned_user_id',_0x6fd3('0x56'),'description','date_start',_0x6fd3('0x57'),'duration_minutes',_0x6fd3('0x58'),'parent_type',_0x6fd3('0x59'),_0x6fd3('0x5a')];return db[_0x6fd3('0x2c')][_0x6fd3('0x4b')]({'where':{'id':_0x5a50be[_0x6fd3('0x45')]['id']},'attributes':['id',_0x6fd3('0x5b'),_0x6fd3('0x5c'),_0x6fd3('0x5d')]})[_0x6fd3('0x27')](handleEntityNotFound(_0x297690,null))['then'](function(_0x1531fe){if(_0x1531fe){_0x4ee291=_0x1531fe[_0x6fd3('0x5d')];var _0x511f3c=_0x4ee291['slice'](-0x1);if(_0x511f3c==='/'){_0x4ee291=_0x4ee291[_0x6fd3('0x5e')](0x0,_0x4ee291[_0x6fd3('0x5f')](_0x511f3c));}return rp({'method':'POST','uri':util[_0x6fd3('0x60')](_0x6fd3('0x61'),_0x4ee291,_0x6fd3('0x62')),'json':!![],'form':{'method':_0x6fd3('0x63'),'input_type':_0x6fd3('0x64'),'response_type':_0x6fd3('0x64'),'rest_data':JSON[_0x6fd3('0x65')]({'user_auth':{'user_name':_0x1531fe[_0x6fd3('0x5b')],'password':_0x1531fe[_0x6fd3('0x5c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x6fd3('0x27')](function(_0x324d98){if(_0x324d98&&_0x324d98[_0x6fd3('0x2a')]!=='Invalid\x20Login'&&_0x324d98[_0x6fd3('0x2a')]!=='Password\x20Expired'){return rp({'method':_0x6fd3('0x66'),'uri':util['format']('%s%s',_0x4ee291,_0x6fd3('0x62')),'json':!![],'form':{'method':_0x6fd3('0x67'),'input_type':_0x6fd3('0x64'),'response_type':_0x6fd3('0x64'),'rest_data':JSON['stringify']({'session':_0x324d98['id'],'module_name':'Calls'})}})[_0x6fd3('0x27')](function(_0x1e8500){if(_0x1e8500){var _0x5a5f0b=_[_0x6fd3('0x68')](_0x1e8500[_0x6fd3('0x69')]);_['remove'](_0x5a5f0b,function(_0x618c42){return _0x27cb31['includes'](_0x618c42[_0x6fd3('0x2a')]);});return{'count':_0x5a5f0b[_0x6fd3('0x37')],'rows':_[_0x6fd3('0x2b')](_0x5a5f0b,function(_0x518ee1){return{'id':_0x518ee1[_0x6fd3('0x2a')],'name':_0x518ee1[_0x6fd3('0x6a')],'custom':_[_0x6fd3('0x6b')](_0x518ee1[_0x6fd3('0x2a')],'_c')?!![]:![],'options':_0x518ee1['options']?_['map'](_[_0x6fd3('0x68')](_0x518ee1[_0x6fd3('0x4e')]),function(_0x283a8d){return{'name':_0x283a8d[_0x6fd3('0x6c')],'value':_0x283a8d[_0x6fd3('0x2a')]};}):[]};})};}})[_0x6fd3('0x27')](respondWithResult(_0x297690,null))[_0x6fd3('0x43')](function(_0x1adcf8){var _0x36f2ad=_0x5a50be[_0x6fd3('0x32')][_0x6fd3('0x6d')]?0x1f4:_0x1adcf8['statusCode']||0x1f4;logger[_0x6fd3('0x29')](_0x6fd3('0x6e'),_0x6fd3('0x55'),_0x36f2ad,JSON['stringify'](_0x1adcf8));delete _0x1adcf8['name'];if(_0x36f2ad===0x191){_0x36f2ad=0x190;}_0x297690['status'](_0x36f2ad)['send'](_0x5a50be[_0x6fd3('0x32')][_0x6fd3('0x6d')]?{'message':_0x6fd3('0x6f'),'statusCode':_0x1adcf8['statusCode']}:_0x1adcf8);});}else{var _0x8e2922=0x1f4;_0x297690[_0x6fd3('0x1d')](_0x8e2922)[_0x6fd3('0x70')]({'message':_0x6fd3('0x6f'),'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 e5403fd..06c9bbe 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 _0xc4af=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment'];(function(_0x5e7da7,_0x138f0f){var _0x4c5f09=function(_0x578c31){while(--_0x578c31){_0x5e7da7['push'](_0x5e7da7['shift']());}};_0x4c5f09(++_0x138f0f);}(_0xc4af,0x88));var _0xfc4a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc4af[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xfc4a('0x0'));var util=require('util');var logger=require(_0xfc4a('0x1'))(_0xfc4a('0x2'));var moment=require(_0xfc4a('0x3'));var BPromise=require(_0xfc4a('0x4'));var rp=require(_0xfc4a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc4a('0x6'));var config=require(_0xfc4a('0x7'));var attributes=require(_0xfc4a('0x8'));var integrations=require(_0xfc4a('0x9'));module[_0xfc4a('0xa')]=function(_0x4049ce,_0x3e92b5){return _0x4049ce[_0xfc4a('0xb')](_0xfc4a('0xc'),attributes,{'tableName':_0xfc4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68b1=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xa0982d,_0x43f6fa){var _0x59c7d4=function(_0x48397b){while(--_0x48397b){_0xa0982d['push'](_0xa0982d['shift']());}};_0x59c7d4(++_0x43f6fa);}(_0x68b1,0x13a));var _0x168b=function(_0x10ba8b,_0x2a6e99){_0x10ba8b=_0x10ba8b-0x0;var _0x640078=_0x68b1[_0x10ba8b];return _0x640078;};'use strict';var _=require(_0x168b('0x0'));var util=require(_0x168b('0x1'));var logger=require(_0x168b('0x2'))(_0x168b('0x3'));var moment=require(_0x168b('0x4'));var BPromise=require(_0x168b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x168b('0x6'));var config=require(_0x168b('0x7'));var attributes=require(_0x168b('0x8'));var integrations=require(_0x168b('0x9'));module[_0x168b('0xa')]=function(_0x379652,_0x4c78bd){return _0x379652[_0x168b('0xb')](_0x168b('0xc'),attributes,{'tableName':_0x168b('0xd'),'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 7fff1c9..431b25e 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 _0xafd4=['util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','find','ShowSugarcrmAccount','lodash'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xafd4,0x17f));var _0x4afd=function(_0x114a62,_0x16e596){_0x114a62=_0x114a62-0x0;var _0x394695=_0xafd4[_0x114a62];return _0x394695;};'use strict';var _=require(_0x4afd('0x0'));var util=require(_0x4afd('0x1'));var moment=require(_0x4afd('0x2'));var BPromise=require('bluebird');var rs=require(_0x4afd('0x3'));var fs=require('fs');var Redis=require(_0x4afd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4afd('0x5'));var logger=require('../../config/logger')(_0x4afd('0x6'));var config=require(_0x4afd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4afd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x266fec,_0x4f115d,_0x309cac){return new BPromise(function(_0x18f66d,_0xb11a82){return client['request'](_0x266fec,_0x309cac)['then'](function(_0x47394e){logger[_0x4afd('0x9')](_0x4afd('0xa'),_0x4f115d,'request\x20sent');logger['debug'](_0x4afd('0xb'),_0x4f115d,'request\x20sent',JSON['stringify'](_0x47394e));if(_0x47394e[_0x4afd('0xc')]){if(_0x47394e['error'][_0x4afd('0xd')]===0x1f4){logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);return _0xb11a82(_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);}logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);return _0x18f66d(_0x47394e[_0x4afd('0xc')][_0x4afd('0xe')]);}else{logger[_0x4afd('0x9')](_0x4afd('0xa'),_0x4f115d,'request\x20sent');_0x18f66d(_0x47394e[_0x4afd('0xf')][_0x4afd('0xe')]);}})[_0x4afd('0x10')](function(_0x51db8c){logger[_0x4afd('0xc')](_0x4afd('0xa'),_0x4f115d,_0x51db8c);_0xb11a82(_0x51db8c);});});}exports[_0x4afd('0x11')]=function(_0xdfb38e){var _0x1e97ac=this;return new Promise(function(_0x926f41,_0x610c3c){return db[_0x4afd('0x12')]['findAll']({'raw':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e['options'][_0x4afd('0x14')]===undefined?!![]:![]:!![],'where':_0xdfb38e['options']?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x15')]||null:null,'attributes':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x16')]||null:null,'limit':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x17')]||null:null,'include':_0xdfb38e[_0x4afd('0x13')]?_0xdfb38e[_0x4afd('0x13')][_0x4afd('0x18')]?_[_0x4afd('0x19')](_0xdfb38e['options'][_0x4afd('0x18')],function(_0x334514){return{'model':db[_0x334514['model']],'as':_0x334514['as'],'attributes':_0x334514[_0x4afd('0x16')],'include':_0x334514[_0x4afd('0x18')]?_[_0x4afd('0x19')](_0x334514[_0x4afd('0x18')],function(_0x1d24b6){return{'model':db[_0x1d24b6[_0x4afd('0x1a')]],'as':_0x1d24b6['as'],'attributes':_0x1d24b6[_0x4afd('0x16')],'include':_0x1d24b6[_0x4afd('0x18')]?_['map'](_0x1d24b6[_0x4afd('0x18')],function(_0x32403d){return{'model':db[_0x32403d['model']],'as':_0x32403d['as'],'attributes':_0x32403d[_0x4afd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4afd('0x1b')](function(_0x4316f9){logger[_0x4afd('0x9')](_0x4afd('0x11'),_0xdfb38e);logger[_0x4afd('0x1c')]('GetSugarcrmAccount',_0xdfb38e,JSON[_0x4afd('0x1d')](_0x4316f9));_0x926f41(_0x4316f9);})[_0x4afd('0x10')](function(_0x236943){logger[_0x4afd('0xc')]('GetSugarcrmAccount',_0x236943[_0x4afd('0xe')],_0xdfb38e);_0x610c3c(_0x1e97ac[_0x4afd('0xc')](0x1f4,_0x236943[_0x4afd('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0xdd56f8){var _0x360e8b=this;return new Promise(function(_0x567742,_0x16c3c3){return db['SugarcrmAccount'][_0x4afd('0x1e')]({'raw':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8['options'][_0x4afd('0x14')]===undefined?!![]:![]:!![],'where':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['where']||null:null,'attributes':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['attributes']||null:null,'include':_0xdd56f8[_0x4afd('0x13')]?_0xdd56f8[_0x4afd('0x13')]['include']?_[_0x4afd('0x19')](_0xdd56f8[_0x4afd('0x13')][_0x4afd('0x18')],function(_0x2123ad){return{'model':db[_0x2123ad[_0x4afd('0x1a')]],'as':_0x2123ad['as'],'attributes':_0x2123ad[_0x4afd('0x16')],'include':_0x2123ad['include']?_[_0x4afd('0x19')](_0x2123ad[_0x4afd('0x18')],function(_0x59de04){return{'model':db[_0x59de04[_0x4afd('0x1a')]],'as':_0x59de04['as'],'attributes':_0x59de04[_0x4afd('0x16')],'include':_0x59de04['include']?_[_0x4afd('0x19')](_0x59de04['include'],function(_0x50860a){return{'model':db[_0x50860a[_0x4afd('0x1a')]],'as':_0x50860a['as'],'attributes':_0x50860a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfaa2f8){logger[_0x4afd('0x9')](_0x4afd('0x1f'),_0xdd56f8);logger[_0x4afd('0x1c')](_0x4afd('0x1f'),_0xdd56f8,JSON[_0x4afd('0x1d')](_0xfaa2f8));_0x567742(_0xfaa2f8);})['catch'](function(_0x2febb9){logger[_0x4afd('0xc')]('ShowSugarcrmAccount',_0x2febb9['message'],_0xdd56f8);_0x16c3c3(_0x360e8b[_0x4afd('0xc')](0x1f4,_0x2febb9[_0x4afd('0xe')]));});});}; \ No newline at end of file +var _0x5321=['include','map','debug','ShowSugarcrmAccount','find','raw','model','lodash','util','moment','ioredis','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit'];(function(_0x525609,_0x46bf98){var _0x5b4430=function(_0x138a35){while(--_0x138a35){_0x525609['push'](_0x525609['shift']());}};_0x5b4430(++_0x46bf98);}(_0x5321,0x1c1));var _0x1532=function(_0x3c424b,_0x16e533){_0x3c424b=_0x3c424b-0x0;var _0x37e01c=_0x5321[_0x3c424b];return _0x37e01c;};'use strict';var _=require(_0x1532('0x0'));var util=require(_0x1532('0x1'));var moment=require(_0x1532('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1532('0x3'));var db=require(_0x1532('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1532('0x5'));var client=jayson[_0x1532('0x6')][_0x1532('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20634e,_0x49e4d7,_0x1e7b61){return new BPromise(function(_0x68f7d7,_0x26673a){return client[_0x1532('0x8')](_0x20634e,_0x1e7b61)[_0x1532('0x9')](function(_0x5b053f){logger['info'](_0x1532('0xa'),_0x49e4d7,_0x1532('0xb'));logger['debug'](_0x1532('0xc'),_0x49e4d7,_0x1532('0xb'),JSON[_0x1532('0xd')](_0x5b053f));if(_0x5b053f['error']){if(_0x5b053f['error'][_0x1532('0xe')]===0x1f4){logger[_0x1532('0xf')](_0x1532('0xa'),_0x49e4d7,_0x5b053f[_0x1532('0xf')][_0x1532('0x10')]);return _0x26673a(_0x5b053f[_0x1532('0xf')]['message']);}logger[_0x1532('0xf')](_0x1532('0xa'),_0x49e4d7,_0x5b053f[_0x1532('0xf')][_0x1532('0x10')]);return _0x68f7d7(_0x5b053f['error'][_0x1532('0x10')]);}else{logger[_0x1532('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x49e4d7,_0x1532('0xb'));_0x68f7d7(_0x5b053f[_0x1532('0x12')][_0x1532('0x10')]);}})[_0x1532('0x13')](function(_0x611675){logger[_0x1532('0xf')](_0x1532('0xa'),_0x49e4d7,_0x611675);_0x26673a(_0x611675);});});}exports[_0x1532('0x14')]=function(_0x1c078d){var _0x569d78=this;return new Promise(function(_0x31f9c1,_0x478168){return db[_0x1532('0x15')][_0x1532('0x16')]({'raw':_0x1c078d['options']?_0x1c078d[_0x1532('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1c078d[_0x1532('0x17')]?_0x1c078d[_0x1532('0x17')][_0x1532('0x18')]||null:null,'attributes':_0x1c078d[_0x1532('0x17')]?_0x1c078d['options'][_0x1532('0x19')]||null:null,'limit':_0x1c078d[_0x1532('0x17')]?_0x1c078d[_0x1532('0x17')][_0x1532('0x1a')]||null:null,'include':_0x1c078d['options']?_0x1c078d[_0x1532('0x17')][_0x1532('0x1b')]?_[_0x1532('0x1c')](_0x1c078d[_0x1532('0x17')][_0x1532('0x1b')],function(_0x21b08c){return{'model':db[_0x21b08c['model']],'as':_0x21b08c['as'],'attributes':_0x21b08c['attributes'],'include':_0x21b08c[_0x1532('0x1b')]?_['map'](_0x21b08c['include'],function(_0x14ce3b){return{'model':db[_0x14ce3b['model']],'as':_0x14ce3b['as'],'attributes':_0x14ce3b[_0x1532('0x19')],'include':_0x14ce3b['include']?_[_0x1532('0x1c')](_0x14ce3b[_0x1532('0x1b')],function(_0x360bef){return{'model':db[_0x360bef['model']],'as':_0x360bef['as'],'attributes':_0x360bef[_0x1532('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20e8a0){logger[_0x1532('0x11')](_0x1532('0x14'),_0x1c078d);logger[_0x1532('0x1d')]('GetSugarcrmAccount',_0x1c078d,JSON[_0x1532('0xd')](_0x20e8a0));_0x31f9c1(_0x20e8a0);})[_0x1532('0x13')](function(_0x37a2e8){logger[_0x1532('0xf')](_0x1532('0x14'),_0x37a2e8[_0x1532('0x10')],_0x1c078d);_0x478168(_0x569d78['error'](0x1f4,_0x37a2e8['message']));});});};exports[_0x1532('0x1e')]=function(_0x29d482){var _0x49cb83=this;return new Promise(function(_0xd00ab,_0x5640ad){return db[_0x1532('0x15')][_0x1532('0x1f')]({'raw':_0x29d482[_0x1532('0x17')]?_0x29d482[_0x1532('0x17')][_0x1532('0x20')]===undefined?!![]:![]:!![],'where':_0x29d482[_0x1532('0x17')]?_0x29d482[_0x1532('0x17')][_0x1532('0x18')]||null:null,'attributes':_0x29d482['options']?_0x29d482['options'][_0x1532('0x19')]||null:null,'include':_0x29d482[_0x1532('0x17')]?_0x29d482[_0x1532('0x17')][_0x1532('0x1b')]?_[_0x1532('0x1c')](_0x29d482[_0x1532('0x17')][_0x1532('0x1b')],function(_0x1e5ce7){return{'model':db[_0x1e5ce7[_0x1532('0x21')]],'as':_0x1e5ce7['as'],'attributes':_0x1e5ce7[_0x1532('0x19')],'include':_0x1e5ce7[_0x1532('0x1b')]?_[_0x1532('0x1c')](_0x1e5ce7[_0x1532('0x1b')],function(_0xa381ae){return{'model':db[_0xa381ae[_0x1532('0x21')]],'as':_0xa381ae['as'],'attributes':_0xa381ae[_0x1532('0x19')],'include':_0xa381ae['include']?_[_0x1532('0x1c')](_0xa381ae[_0x1532('0x1b')],function(_0x5cdae0){return{'model':db[_0x5cdae0[_0x1532('0x21')]],'as':_0x5cdae0['as'],'attributes':_0x5cdae0[_0x1532('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12ab4d){logger[_0x1532('0x11')](_0x1532('0x1e'),_0x29d482);logger[_0x1532('0x1d')](_0x1532('0x1e'),_0x29d482,JSON[_0x1532('0xd')](_0x12ab4d));_0xd00ab(_0x12ab4d);})[_0x1532('0x13')](function(_0x1b329b){logger['error'](_0x1532('0x1e'),_0x1b329b['message'],_0x29d482);_0x5640ad(_0x49cb83[_0x1532('0xf')](0x1f4,_0x1b329b['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 25a0ca4..8c74609 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 _0x465b=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x465b,0x187));var _0xb465=function(_0x29481b,_0x3110d2){_0x29481b=_0x29481b-0x0;var _0x558d3e=_0x465b[_0x29481b];return _0x558d3e;};'use strict';var multer=require(_0xb465('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb465('0x1'));var express=require(_0xb465('0x2'));var router=express[_0xb465('0x3')]();var fs_extra=require(_0xb465('0x4'));var auth=require(_0xb465('0x5'));var interaction=require(_0xb465('0x6'));var config=require(_0xb465('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xb465('0x8')](),controller[_0xb465('0x9')]);router['get'](_0xb465('0xa'),auth[_0xb465('0x8')](),controller[_0xb465('0xb')]);router[_0xb465('0xc')](_0xb465('0xd'),auth[_0xb465('0x8')](),controller[_0xb465('0xe')]);router[_0xb465('0xc')]('/:id/subjects',auth[_0xb465('0x8')](),controller['getSubjects']);router['get'](_0xb465('0xf'),auth['isAuthenticated'](),controller[_0xb465('0x10')]);router[_0xb465('0x11')]('/',auth[_0xb465('0x8')](),controller[_0xb465('0x12')]);router[_0xb465('0x13')](_0xb465('0xa'),auth[_0xb465('0x8')](),controller['update']);router['delete'](_0xb465('0xa'),auth[_0xb465('0x8')](),controller[_0xb465('0x14')]);module[_0xb465('0x15')]=router; \ No newline at end of file +var _0xcb47=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/descriptions','create','delete','destroy','multer'];(function(_0x32b54b,_0x3a2566){var _0x199f12=function(_0x4b1b21){while(--_0x4b1b21){_0x32b54b['push'](_0x32b54b['shift']());}};_0x199f12(++_0x3a2566);}(_0xcb47,0x168));var _0x7cb4=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xcb47[_0x37e845];return _0x59e55b;};'use strict';var multer=require(_0x7cb4('0x0'));var util=require(_0x7cb4('0x1'));var path=require('path');var timeout=require(_0x7cb4('0x2'));var express=require(_0x7cb4('0x3'));var router=express[_0x7cb4('0x4')]();var fs_extra=require(_0x7cb4('0x5'));var auth=require(_0x7cb4('0x6'));var interaction=require(_0x7cb4('0x7'));var config=require(_0x7cb4('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7cb4('0x9')]('/',auth[_0x7cb4('0xa')](),controller[_0x7cb4('0xb')]);router[_0x7cb4('0x9')]('/:id',auth[_0x7cb4('0xa')](),controller[_0x7cb4('0xc')]);router[_0x7cb4('0x9')](_0x7cb4('0xd'),auth['isAuthenticated'](),controller[_0x7cb4('0xe')]);router[_0x7cb4('0x9')]('/:id/subjects',auth[_0x7cb4('0xa')](),controller['getSubjects']);router['get'](_0x7cb4('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x7cb4('0xa')](),controller[_0x7cb4('0x10')]);router['put']('/:id',auth[_0x7cb4('0xa')](),controller['update']);router[_0x7cb4('0x11')]('/:id',auth[_0x7cb4('0xa')](),controller[_0x7cb4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 75ce722..60ce959 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 _0xbca8=['exports','STRING','sequelize'];(function(_0x524e5e,_0x4b0590){var _0xe7a0fe=function(_0x39558d){while(--_0x39558d){_0x524e5e['push'](_0x524e5e['shift']());}};_0xe7a0fe(++_0x4b0590);}(_0xbca8,0x191));var _0x8bca=function(_0x1e35f2,_0x5f4559){_0x1e35f2=_0x1e35f2-0x0;var _0x711264=_0xbca8[_0x1e35f2];return _0x711264;};'use strict';var Sequelize=require(_0x8bca('0x0'));module[_0x8bca('0x1')]={'name':{'type':Sequelize[_0x8bca('0x2')]},'description':{'type':Sequelize[_0x8bca('0x2')]}}; \ No newline at end of file +var _0xb556=['exports','STRING','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb556,0x191));var _0x6b55=function(_0x58ed43,_0x388d61){_0x58ed43=_0x58ed43-0x0;var _0x419f94=_0xb556[_0x58ed43];return _0x419f94;};'use strict';var Sequelize=require(_0x6b55('0x0'));module[_0x6b55('0x1')]={'name':{'type':Sequelize[_0x6b55('0x2')]},'description':{'type':Sequelize[_0x6b55('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 30e749e..e69d7ec 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 _0xfaf1=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','include','find','create','body','destroy','getFields','findOne','SugarcrmField','rawAttributes','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','fieldName','type','key','query','keys'];(function(_0x31a6b1,_0x7c3be1){var _0x8c77f5=function(_0x35b0d7){while(--_0x35b0d7){_0x31a6b1['push'](_0x31a6b1['shift']());}};_0x8c77f5(++_0x7c3be1);}(_0xfaf1,0x118));var _0x1faf=function(_0x2f9fcf,_0x410581){_0x2f9fcf=_0x2f9fcf-0x0;var _0x49b38f=_0xfaf1[_0x2f9fcf];return _0x49b38f;};'use strict';var emlformat=require(_0x1faf('0x0'));var rimraf=require(_0x1faf('0x1'));var zipdir=require(_0x1faf('0x2'));var jsonpatch=require(_0x1faf('0x3'));var rp=require(_0x1faf('0x4'));var moment=require(_0x1faf('0x5'));var BPromise=require(_0x1faf('0x6'));var Mustache=require('mustache');var util=require(_0x1faf('0x7'));var path=require('path');var sox=require(_0x1faf('0x8'));var csv=require(_0x1faf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1faf('0xa'));var _=require(_0x1faf('0xb'));var squel=require(_0x1faf('0xc'));var crypto=require(_0x1faf('0xd'));var jsforce=require(_0x1faf('0xe'));var deskjs=require(_0x1faf('0xf'));var toCsv=require(_0x1faf('0x9'));var querystring=require(_0x1faf('0x10'));var Papa=require(_0x1faf('0x11'));var Redis=require(_0x1faf('0x12'));var authService=require(_0x1faf('0x13'));var qs=require(_0x1faf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1faf('0x15'));var logger=require(_0x1faf('0x16'))(_0x1faf('0x17'));var utils=require(_0x1faf('0x18'));var config=require(_0x1faf('0x19'));var licenseUtil=require(_0x1faf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e0c1e,_0x4f6060){_0x4f6060=_0x4f6060||0xcc;return function(_0x55bfc3){if(_0x55bfc3){return _0x1e0c1e['sendStatus'](_0x4f6060);}return _0x1e0c1e[_0x1faf('0x1b')](_0x4f6060)[_0x1faf('0x1c')]();};}function respondWithResult(_0x2c2ae9,_0x164268){_0x164268=_0x164268||0xc8;return function(_0x90f818){if(_0x90f818){return _0x2c2ae9['status'](_0x164268)[_0x1faf('0x1d')](_0x90f818);}};}function respondWithFilteredResult(_0x52bdc2,_0x10a991){return function(_0x10b94f){if(_0x10b94f){var _0x191819=typeof _0x10a991[_0x1faf('0x1e')]===_0x1faf('0x1f')&&typeof _0x10a991[_0x1faf('0x20')]===_0x1faf('0x1f');var _0x20c5f2=_0x10b94f[_0x1faf('0x21')];var _0x2abff1=_0x191819?0x0:_0x10a991[_0x1faf('0x1e')];var _0x40d83f=_0x191819?_0x10b94f[_0x1faf('0x21')]:_0x10a991[_0x1faf('0x1e')]+_0x10a991[_0x1faf('0x20')];var _0x1f9220;if(_0x40d83f>=_0x20c5f2){_0x40d83f=_0x20c5f2;_0x1f9220=0xc8;}else{_0x1f9220=0xce;}_0x52bdc2[_0x1faf('0x1b')](_0x1f9220);return _0x52bdc2[_0x1faf('0x22')](_0x1faf('0x23'),_0x2abff1+'-'+_0x40d83f+'/'+_0x20c5f2)[_0x1faf('0x1d')](_0x10b94f);}return null;};}function patchUpdates(_0x560055){return function(_0x4648f1){try{jsonpatch[_0x1faf('0x24')](_0x4648f1,_0x560055,!![]);}catch(_0x91599f){return BPromise[_0x1faf('0x25')](_0x91599f);}return _0x4648f1['save']();};}function saveUpdates(_0x39c6df,_0x6ab052){return function(_0x46d82d){if(_0x46d82d){return _0x46d82d[_0x1faf('0x26')](_0x39c6df)[_0x1faf('0x27')](function(_0x2dcd12){return _0x2dcd12;});}return null;};}function removeEntity(_0x1f874c,_0x5afb95){return function(_0x3ac777){if(_0x3ac777){return _0x3ac777['destroy']()['then'](function(){_0x1f874c[_0x1faf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1202d2,_0x38b186){return function(_0x28f734){if(!_0x28f734){_0x1202d2[_0x1faf('0x28')](0x194);}return _0x28f734;};}function handleError(_0x1cd13c,_0x155a98){_0x155a98=_0x155a98||0x1f4;return function(_0x2e4fb4){logger[_0x1faf('0x29')](_0x2e4fb4[_0x1faf('0x2a')]);if(_0x2e4fb4[_0x1faf('0x2b')]){delete _0x2e4fb4[_0x1faf('0x2b')];}_0x1cd13c[_0x1faf('0x1b')](_0x155a98)['send'](_0x2e4fb4);};}exports[_0x1faf('0x2c')]=function(_0x153875,_0x4db0dc){var _0x2e03b4={},_0x4b00c7={},_0x952230={'count':0x0,'rows':[]};var _0x13aec8=_[_0x1faf('0x2d')](db[_0x1faf('0x2e')]['rawAttributes'],function(_0x332b52){return{'name':_0x332b52[_0x1faf('0x2f')],'type':_0x332b52[_0x1faf('0x30')][_0x1faf('0x31')]};});_0x4b00c7['model']=_[_0x1faf('0x2d')](_0x13aec8,_0x1faf('0x2b'));_0x4b00c7[_0x1faf('0x32')]=_[_0x1faf('0x33')](_0x153875[_0x1faf('0x32')]);_0x4b00c7[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0x4b00c7[_0x1faf('0x36')],_0x4b00c7[_0x1faf('0x32')]);_0x2e03b4['attributes']=_[_0x1faf('0x35')](_0x4b00c7['model'],qs[_0x1faf('0x37')](_0x153875[_0x1faf('0x32')][_0x1faf('0x37')]));_0x2e03b4[_0x1faf('0x38')]=_0x2e03b4[_0x1faf('0x38')][_0x1faf('0x39')]?_0x2e03b4[_0x1faf('0x38')]:_0x4b00c7[_0x1faf('0x36')];if(!_0x153875[_0x1faf('0x32')][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x2e03b4['limit']=qs[_0x1faf('0x20')](_0x153875[_0x1faf('0x32')]['limit']);_0x2e03b4[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x153875['query']['offset']);}_0x2e03b4[_0x1faf('0x3c')]=qs['sort'](_0x153875['query']['sort']);_0x2e03b4[_0x1faf('0x3d')]=qs['filters'](_[_0x1faf('0x3e')](_0x153875[_0x1faf('0x32')],_0x4b00c7[_0x1faf('0x34')]),_0x13aec8);if(_0x153875[_0x1faf('0x32')][_0x1faf('0x3f')]){_0x2e03b4[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x2e03b4['where'],{'$or':_[_0x1faf('0x2d')](_0x13aec8,function(_0x1c8530){if(_0x1c8530[_0x1faf('0x30')]!==_0x1faf('0x41')){var _0x278892={};_0x278892[_0x1c8530[_0x1faf('0x2b')]]={'$like':'%'+_0x153875[_0x1faf('0x32')][_0x1faf('0x3f')]+'%'};return _0x278892;}})});}_0x2e03b4=_[_0x1faf('0x40')]({},_0x2e03b4,_0x153875[_0x1faf('0x42')]);var _0x18affe={'where':_0x2e03b4[_0x1faf('0x3d')]};return db[_0x1faf('0x2e')][_0x1faf('0x21')](_0x18affe)[_0x1faf('0x27')](function(_0x3f1664){_0x952230['count']=_0x3f1664;if(_0x153875[_0x1faf('0x32')]['includeAll']){_0x2e03b4['include']=[{'all':!![]}];}return db[_0x1faf('0x2e')][_0x1faf('0x43')](_0x2e03b4);})[_0x1faf('0x27')](function(_0x2f4f72){_0x952230[_0x1faf('0x44')]=_0x2f4f72;return _0x952230;})['then'](respondWithFilteredResult(_0x4db0dc,_0x2e03b4))[_0x1faf('0x45')](handleError(_0x4db0dc,null));};exports['show']=function(_0x1716a0,_0x10cb4e){var _0x1011ad={'raw':![],'where':{'id':_0x1716a0[_0x1faf('0x46')]['id']}},_0x35a27f={};_0x35a27f[_0x1faf('0x36')]=_[_0x1faf('0x33')](db[_0x1faf('0x2e')]['rawAttributes']);_0x35a27f[_0x1faf('0x32')]=_['keys'](_0x1716a0[_0x1faf('0x32')]);_0x35a27f['filters']=_['intersection'](_0x35a27f['model'],_0x35a27f[_0x1faf('0x32')]);_0x1011ad[_0x1faf('0x38')]=_['intersection'](_0x35a27f['model'],qs[_0x1faf('0x37')](_0x1716a0['query'][_0x1faf('0x37')]));_0x1011ad[_0x1faf('0x38')]=_0x1011ad[_0x1faf('0x38')]['length']?_0x1011ad[_0x1faf('0x38')]:_0x35a27f['model'];if(_0x1716a0[_0x1faf('0x32')]['includeAll']){_0x1011ad[_0x1faf('0x47')]=[{'all':!![]}];}_0x1011ad=_[_0x1faf('0x40')]({},_0x1011ad,_0x1716a0[_0x1faf('0x42')]);return db[_0x1faf('0x2e')][_0x1faf('0x48')](_0x1011ad)['then'](handleEntityNotFound(_0x10cb4e,null))['then'](respondWithResult(_0x10cb4e,null))[_0x1faf('0x45')](handleError(_0x10cb4e,null));};exports['create']=function(_0x3e6909,_0x533c90){return db[_0x1faf('0x2e')][_0x1faf('0x49')](_0x3e6909[_0x1faf('0x4a')],{})[_0x1faf('0x27')](respondWithResult(_0x533c90,0xc9))[_0x1faf('0x45')](handleError(_0x533c90,null));};exports[_0x1faf('0x26')]=function(_0x120004,_0x6091b6){if(_0x120004[_0x1faf('0x4a')]['id']){delete _0x120004['body']['id'];}return db[_0x1faf('0x2e')][_0x1faf('0x48')]({'where':{'id':_0x120004[_0x1faf('0x46')]['id']}})['then'](handleEntityNotFound(_0x6091b6,null))[_0x1faf('0x27')](saveUpdates(_0x120004[_0x1faf('0x4a')],null))['then'](respondWithResult(_0x6091b6,null))[_0x1faf('0x45')](handleError(_0x6091b6,null));};exports[_0x1faf('0x4b')]=function(_0x3f145d,_0x2c2eca){return db['SugarcrmConfiguration'][_0x1faf('0x48')]({'where':{'id':_0x3f145d[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x2c2eca,null))[_0x1faf('0x27')](removeEntity(_0x2c2eca,null))['catch'](handleError(_0x2c2eca,null));};exports[_0x1faf('0x4c')]=function(_0x44898f,_0x2811e4,_0x90b8){var _0x1e6a9b={};var _0xbfb3b7={};var _0x4e3a7c;var _0x3b007f;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x44898f[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x2811e4,null))[_0x1faf('0x27')](function(_0x381b08){if(_0x381b08){_0x4e3a7c=_0x381b08;_0xbfb3b7['model']=_[_0x1faf('0x33')](db[_0x1faf('0x4e')][_0x1faf('0x4f')]);_0xbfb3b7[_0x1faf('0x32')]=_[_0x1faf('0x33')](_0x44898f[_0x1faf('0x32')]);_0xbfb3b7[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0xbfb3b7[_0x1faf('0x36')],_0xbfb3b7[_0x1faf('0x32')]);_0x1e6a9b[_0x1faf('0x38')]=_[_0x1faf('0x35')](_0xbfb3b7[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x44898f[_0x1faf('0x32')][_0x1faf('0x37')]));_0x1e6a9b[_0x1faf('0x38')]=_0x1e6a9b[_0x1faf('0x38')][_0x1faf('0x39')]?_0x1e6a9b[_0x1faf('0x38')]:_0xbfb3b7[_0x1faf('0x36')];_0x1e6a9b[_0x1faf('0x3c')]=qs['sort'](_0x44898f[_0x1faf('0x32')][_0x1faf('0x50')]);_0x1e6a9b[_0x1faf('0x3d')]=qs[_0x1faf('0x34')](_[_0x1faf('0x3e')](_0x44898f[_0x1faf('0x32')],_0xbfb3b7[_0x1faf('0x34')]));if(_0x44898f[_0x1faf('0x32')]['filter']){_0x1e6a9b[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x1e6a9b[_0x1faf('0x3d')],{'$or':_[_0x1faf('0x2d')](_0x1e6a9b['attributes'],function(_0x2e56eb){var _0xa4d75e={};_0xa4d75e[_0x2e56eb]={'$like':'%'+_0x44898f['query'][_0x1faf('0x3f')]+'%'};return _0xa4d75e;})});}_0x1e6a9b=_['merge']({},_0x1e6a9b,_0x44898f['options']);return _0x4e3a7c[_0x1faf('0x4c')](_0x1e6a9b);}})[_0x1faf('0x27')](function(_0x55252b){if(_0x55252b){_0x3b007f=_0x55252b[_0x1faf('0x39')];if(!_0x44898f[_0x1faf('0x32')][_0x1faf('0x3a')]('nolimit')){_0x1e6a9b[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x44898f['query'][_0x1faf('0x20')]);_0x1e6a9b[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x44898f['query'][_0x1faf('0x1e')]);}return _0x4e3a7c[_0x1faf('0x4c')](_0x1e6a9b);}})[_0x1faf('0x27')](function(_0x3763b9){if(_0x3763b9){return _0x3763b9?{'count':_0x3b007f,'rows':_0x3763b9}:null;}})['then'](respondWithResult(_0x2811e4,null))[_0x1faf('0x45')](handleError(_0x2811e4,null));};exports['getSubjects']=function(_0x3e7a95,_0x290ee5,_0x3ec0ec){var _0x1274b1={};var _0x585d29={};var _0x148d87;var _0x2df297;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x3e7a95[_0x1faf('0x46')]['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x290ee5,null))[_0x1faf('0x27')](function(_0x2b7bfd){if(_0x2b7bfd){_0x148d87=_0x2b7bfd;_0x585d29['model']=_[_0x1faf('0x33')](db['SugarcrmField'][_0x1faf('0x4f')]);_0x585d29['query']=_[_0x1faf('0x33')](_0x3e7a95[_0x1faf('0x32')]);_0x585d29[_0x1faf('0x34')]=_[_0x1faf('0x35')](_0x585d29[_0x1faf('0x36')],_0x585d29[_0x1faf('0x32')]);_0x1274b1[_0x1faf('0x38')]=_[_0x1faf('0x35')](_0x585d29[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x37')]));_0x1274b1['attributes']=_0x1274b1['attributes'][_0x1faf('0x39')]?_0x1274b1['attributes']:_0x585d29[_0x1faf('0x36')];_0x1274b1[_0x1faf('0x3c')]=qs[_0x1faf('0x50')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x50')]);_0x1274b1[_0x1faf('0x3d')]=qs[_0x1faf('0x34')](_['pick'](_0x3e7a95[_0x1faf('0x32')],_0x585d29[_0x1faf('0x34')]));if(_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x3f')]){_0x1274b1[_0x1faf('0x3d')]=_['merge'](_0x1274b1['where'],{'$or':_['map'](_0x1274b1['attributes'],function(_0x1dc280){var _0x43769c={};_0x43769c[_0x1dc280]={'$like':'%'+_0x3e7a95['query']['filter']+'%'};return _0x43769c;})});}_0x1274b1=_[_0x1faf('0x40')]({},_0x1274b1,_0x3e7a95[_0x1faf('0x42')]);return _0x148d87[_0x1faf('0x51')](_0x1274b1);}})[_0x1faf('0x27')](function(_0x1c84fa){if(_0x1c84fa){_0x2df297=_0x1c84fa['length'];if(!_0x3e7a95['query'][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x1274b1[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x3e7a95['query'][_0x1faf('0x20')]);_0x1274b1[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x3e7a95[_0x1faf('0x32')][_0x1faf('0x1e')]);}return _0x148d87[_0x1faf('0x51')](_0x1274b1);}})[_0x1faf('0x27')](function(_0x2f9d53){if(_0x2f9d53){return _0x2f9d53?{'count':_0x2df297,'rows':_0x2f9d53}:null;}})['then'](respondWithResult(_0x290ee5,null))[_0x1faf('0x45')](handleError(_0x290ee5,null));};exports[_0x1faf('0x52')]=function(_0x29a618,_0x43392b,_0x300bbe){var _0x439eb5={};var _0x33e10d={};var _0x2d8969;var _0x41fd62;return db[_0x1faf('0x2e')][_0x1faf('0x4d')]({'where':{'id':_0x29a618['params']['id']}})[_0x1faf('0x27')](handleEntityNotFound(_0x43392b,null))['then'](function(_0x22249e){if(_0x22249e){_0x2d8969=_0x22249e;_0x33e10d['model']=_[_0x1faf('0x33')](db['SugarcrmField'][_0x1faf('0x4f')]);_0x33e10d[_0x1faf('0x32')]=_['keys'](_0x29a618[_0x1faf('0x32')]);_0x33e10d['filters']=_['intersection'](_0x33e10d[_0x1faf('0x36')],_0x33e10d[_0x1faf('0x32')]);_0x439eb5[_0x1faf('0x38')]=_['intersection'](_0x33e10d[_0x1faf('0x36')],qs[_0x1faf('0x37')](_0x29a618['query'][_0x1faf('0x37')]));_0x439eb5[_0x1faf('0x38')]=_0x439eb5['attributes'][_0x1faf('0x39')]?_0x439eb5['attributes']:_0x33e10d['model'];_0x439eb5[_0x1faf('0x3c')]=qs[_0x1faf('0x50')](_0x29a618[_0x1faf('0x32')][_0x1faf('0x50')]);_0x439eb5[_0x1faf('0x3d')]=qs['filters'](_[_0x1faf('0x3e')](_0x29a618[_0x1faf('0x32')],_0x33e10d[_0x1faf('0x34')]));if(_0x29a618['query'][_0x1faf('0x3f')]){_0x439eb5[_0x1faf('0x3d')]=_[_0x1faf('0x40')](_0x439eb5['where'],{'$or':_[_0x1faf('0x2d')](_0x439eb5[_0x1faf('0x38')],function(_0x4f2559){var _0x3ebebb={};_0x3ebebb[_0x4f2559]={'$like':'%'+_0x29a618[_0x1faf('0x32')][_0x1faf('0x3f')]+'%'};return _0x3ebebb;})});}_0x439eb5=_['merge']({},_0x439eb5,_0x29a618[_0x1faf('0x42')]);return _0x2d8969[_0x1faf('0x52')](_0x439eb5);}})[_0x1faf('0x27')](function(_0x51496e){if(_0x51496e){_0x41fd62=_0x51496e[_0x1faf('0x39')];if(!_0x29a618[_0x1faf('0x32')][_0x1faf('0x3a')](_0x1faf('0x3b'))){_0x439eb5[_0x1faf('0x20')]=qs[_0x1faf('0x20')](_0x29a618[_0x1faf('0x32')]['limit']);_0x439eb5[_0x1faf('0x1e')]=qs[_0x1faf('0x1e')](_0x29a618[_0x1faf('0x32')]['offset']);}return _0x2d8969[_0x1faf('0x52')](_0x439eb5);}})[_0x1faf('0x27')](function(_0x349f70){if(_0x349f70){return _0x349f70?{'count':_0x41fd62,'rows':_0x349f70}:null;}})[_0x1faf('0x27')](respondWithResult(_0x43392b,null))[_0x1faf('0x45')](handleError(_0x43392b,null));}; \ No newline at end of file +var _0xfcc7=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','getFields','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0xf804da,_0x16c754){var _0x176b30=function(_0x5f07da){while(--_0x5f07da){_0xf804da['push'](_0xf804da['shift']());}};_0x176b30(++_0x16c754);}(_0xfcc7,0xd8));var _0x7fcc=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0xfcc7[_0x3df517];return _0x25ddd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fcc('0x0'));var zipdir=require(_0x7fcc('0x1'));var jsonpatch=require(_0x7fcc('0x2'));var rp=require(_0x7fcc('0x3'));var moment=require(_0x7fcc('0x4'));var BPromise=require(_0x7fcc('0x5'));var Mustache=require(_0x7fcc('0x6'));var util=require(_0x7fcc('0x7'));var path=require('path');var sox=require(_0x7fcc('0x8'));var csv=require(_0x7fcc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7fcc('0xa'));var _=require(_0x7fcc('0xb'));var squel=require(_0x7fcc('0xc'));var crypto=require('crypto');var jsforce=require(_0x7fcc('0xd'));var deskjs=require(_0x7fcc('0xe'));var toCsv=require(_0x7fcc('0x9'));var querystring=require(_0x7fcc('0xf'));var Papa=require(_0x7fcc('0x10'));var Redis=require(_0x7fcc('0x11'));var authService=require(_0x7fcc('0x12'));var qs=require(_0x7fcc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fcc('0x14'));var logger=require('../../config/logger')(_0x7fcc('0x15'));var utils=require(_0x7fcc('0x16'));var config=require(_0x7fcc('0x17'));var licenseUtil=require(_0x7fcc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c545b,_0x4063df){_0x4063df=_0x4063df||0xcc;return function(_0x540519){if(_0x540519){return _0x3c545b[_0x7fcc('0x19')](_0x4063df);}return _0x3c545b['status'](_0x4063df)[_0x7fcc('0x1a')]();};}function respondWithResult(_0xa4190a,_0x39a30d){_0x39a30d=_0x39a30d||0xc8;return function(_0x29d386){if(_0x29d386){return _0xa4190a[_0x7fcc('0x1b')](_0x39a30d)[_0x7fcc('0x1c')](_0x29d386);}};}function respondWithFilteredResult(_0x19bb18,_0x39e5ff){return function(_0x279f8c){if(_0x279f8c){var _0x16fe05=typeof _0x39e5ff['offset']===_0x7fcc('0x1d')&&typeof _0x39e5ff[_0x7fcc('0x1e')]===_0x7fcc('0x1d');var _0x24ab8c=_0x279f8c[_0x7fcc('0x1f')];var _0x4eec30=_0x16fe05?0x0:_0x39e5ff['offset'];var _0x2faaaf=_0x16fe05?_0x279f8c[_0x7fcc('0x1f')]:_0x39e5ff[_0x7fcc('0x20')]+_0x39e5ff['limit'];var _0x106fae;if(_0x2faaaf>=_0x24ab8c){_0x2faaaf=_0x24ab8c;_0x106fae=0xc8;}else{_0x106fae=0xce;}_0x19bb18[_0x7fcc('0x1b')](_0x106fae);return _0x19bb18['set'](_0x7fcc('0x21'),_0x4eec30+'-'+_0x2faaaf+'/'+_0x24ab8c)['json'](_0x279f8c);}return null;};}function patchUpdates(_0x4bf63f){return function(_0x38fb08){try{jsonpatch[_0x7fcc('0x22')](_0x38fb08,_0x4bf63f,!![]);}catch(_0x14e3c5){return BPromise[_0x7fcc('0x23')](_0x14e3c5);}return _0x38fb08['save']();};}function saveUpdates(_0x7abb9e,_0xf77e2d){return function(_0x282b7d){if(_0x282b7d){return _0x282b7d[_0x7fcc('0x24')](_0x7abb9e)[_0x7fcc('0x25')](function(_0x21086d){return _0x21086d;});}return null;};}function removeEntity(_0x3ff324,_0x3805b6){return function(_0x3fab17){if(_0x3fab17){return _0x3fab17[_0x7fcc('0x26')]()[_0x7fcc('0x25')](function(){_0x3ff324[_0x7fcc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31b1ac,_0x30158f){return function(_0x50abc1){if(!_0x50abc1){_0x31b1ac[_0x7fcc('0x19')](0x194);}return _0x50abc1;};}function handleError(_0x44f19a,_0x510ba5){_0x510ba5=_0x510ba5||0x1f4;return function(_0x5b3f76){logger['error'](_0x5b3f76[_0x7fcc('0x27')]);if(_0x5b3f76['name']){delete _0x5b3f76[_0x7fcc('0x28')];}_0x44f19a[_0x7fcc('0x1b')](_0x510ba5)['send'](_0x5b3f76);};}exports[_0x7fcc('0x29')]=function(_0xc3275,_0x29dcdc){var _0x13ac32={},_0x5750e7={},_0x4e6183={'count':0x0,'rows':[]};var _0x2a40d9=_['map'](db[_0x7fcc('0x2a')][_0x7fcc('0x2b')],function(_0x21dbdb){return{'name':_0x21dbdb[_0x7fcc('0x2c')],'type':_0x21dbdb[_0x7fcc('0x2d')]['key']};});_0x5750e7[_0x7fcc('0x2e')]=_[_0x7fcc('0x2f')](_0x2a40d9,_0x7fcc('0x28'));_0x5750e7['query']=_[_0x7fcc('0x30')](_0xc3275[_0x7fcc('0x31')]);_0x5750e7['filters']=_[_0x7fcc('0x32')](_0x5750e7['model'],_0x5750e7['query']);_0x13ac32[_0x7fcc('0x33')]=_['intersection'](_0x5750e7[_0x7fcc('0x2e')],qs[_0x7fcc('0x34')](_0xc3275[_0x7fcc('0x31')]['fields']));_0x13ac32[_0x7fcc('0x33')]=_0x13ac32[_0x7fcc('0x33')][_0x7fcc('0x35')]?_0x13ac32[_0x7fcc('0x33')]:_0x5750e7['model'];if(!_0xc3275[_0x7fcc('0x31')][_0x7fcc('0x36')](_0x7fcc('0x37'))){_0x13ac32['limit']=qs[_0x7fcc('0x1e')](_0xc3275[_0x7fcc('0x31')][_0x7fcc('0x1e')]);_0x13ac32['offset']=qs[_0x7fcc('0x20')](_0xc3275['query'][_0x7fcc('0x20')]);}_0x13ac32[_0x7fcc('0x38')]=qs[_0x7fcc('0x39')](_0xc3275['query'][_0x7fcc('0x39')]);_0x13ac32[_0x7fcc('0x3a')]=qs[_0x7fcc('0x3b')](_[_0x7fcc('0x3c')](_0xc3275[_0x7fcc('0x31')],_0x5750e7[_0x7fcc('0x3b')]),_0x2a40d9);if(_0xc3275[_0x7fcc('0x31')][_0x7fcc('0x3d')]){_0x13ac32[_0x7fcc('0x3a')]=_[_0x7fcc('0x3e')](_0x13ac32[_0x7fcc('0x3a')],{'$or':_['map'](_0x2a40d9,function(_0x4e4319){if(_0x4e4319['type']!==_0x7fcc('0x3f')){var _0x22d36e={};_0x22d36e[_0x4e4319['name']]={'$like':'%'+_0xc3275[_0x7fcc('0x31')][_0x7fcc('0x3d')]+'%'};return _0x22d36e;}})});}_0x13ac32=_[_0x7fcc('0x3e')]({},_0x13ac32,_0xc3275[_0x7fcc('0x40')]);var _0x4c0be3={'where':_0x13ac32[_0x7fcc('0x3a')]};return db['SugarcrmConfiguration'][_0x7fcc('0x1f')](_0x4c0be3)[_0x7fcc('0x25')](function(_0xed84c5){_0x4e6183[_0x7fcc('0x1f')]=_0xed84c5;if(_0xc3275[_0x7fcc('0x31')][_0x7fcc('0x41')]){_0x13ac32['include']=[{'all':!![]}];}return db[_0x7fcc('0x2a')][_0x7fcc('0x42')](_0x13ac32);})[_0x7fcc('0x25')](function(_0x2463ce){_0x4e6183[_0x7fcc('0x43')]=_0x2463ce;return _0x4e6183;})['then'](respondWithFilteredResult(_0x29dcdc,_0x13ac32))[_0x7fcc('0x44')](handleError(_0x29dcdc,null));};exports[_0x7fcc('0x45')]=function(_0x202a05,_0x1699da){var _0x4dfbab={'raw':![],'where':{'id':_0x202a05[_0x7fcc('0x46')]['id']}},_0x4b8214={};_0x4b8214[_0x7fcc('0x2e')]=_['keys'](db[_0x7fcc('0x2a')][_0x7fcc('0x2b')]);_0x4b8214[_0x7fcc('0x31')]=_['keys'](_0x202a05['query']);_0x4b8214['filters']=_[_0x7fcc('0x32')](_0x4b8214[_0x7fcc('0x2e')],_0x4b8214['query']);_0x4dfbab['attributes']=_[_0x7fcc('0x32')](_0x4b8214[_0x7fcc('0x2e')],qs[_0x7fcc('0x34')](_0x202a05[_0x7fcc('0x31')][_0x7fcc('0x34')]));_0x4dfbab['attributes']=_0x4dfbab[_0x7fcc('0x33')]['length']?_0x4dfbab[_0x7fcc('0x33')]:_0x4b8214[_0x7fcc('0x2e')];if(_0x202a05[_0x7fcc('0x31')]['includeAll']){_0x4dfbab[_0x7fcc('0x47')]=[{'all':!![]}];}_0x4dfbab=_['merge']({},_0x4dfbab,_0x202a05['options']);return db[_0x7fcc('0x2a')]['find'](_0x4dfbab)['then'](handleEntityNotFound(_0x1699da,null))['then'](respondWithResult(_0x1699da,null))[_0x7fcc('0x44')](handleError(_0x1699da,null));};exports[_0x7fcc('0x48')]=function(_0x21cfce,_0x10de08){return db[_0x7fcc('0x2a')][_0x7fcc('0x48')](_0x21cfce[_0x7fcc('0x49')],{})['then'](respondWithResult(_0x10de08,0xc9))[_0x7fcc('0x44')](handleError(_0x10de08,null));};exports[_0x7fcc('0x24')]=function(_0x5613ba,_0xee6a56){if(_0x5613ba[_0x7fcc('0x49')]['id']){delete _0x5613ba[_0x7fcc('0x49')]['id'];}return db[_0x7fcc('0x2a')]['find']({'where':{'id':_0x5613ba[_0x7fcc('0x46')]['id']}})[_0x7fcc('0x25')](handleEntityNotFound(_0xee6a56,null))[_0x7fcc('0x25')](saveUpdates(_0x5613ba[_0x7fcc('0x49')],null))[_0x7fcc('0x25')](respondWithResult(_0xee6a56,null))[_0x7fcc('0x44')](handleError(_0xee6a56,null));};exports[_0x7fcc('0x26')]=function(_0x23dcef,_0x69ff72){return db[_0x7fcc('0x2a')]['find']({'where':{'id':_0x23dcef[_0x7fcc('0x46')]['id']}})['then'](handleEntityNotFound(_0x69ff72,null))[_0x7fcc('0x25')](removeEntity(_0x69ff72,null))[_0x7fcc('0x44')](handleError(_0x69ff72,null));};exports[_0x7fcc('0x4a')]=function(_0x5d70f1,_0x32d32c,_0x713ee8){var _0x223f09={};var _0x1af789={};var _0x3d718c;var _0x46c153;return db[_0x7fcc('0x2a')]['findOne']({'where':{'id':_0x5d70f1[_0x7fcc('0x46')]['id']}})['then'](handleEntityNotFound(_0x32d32c,null))['then'](function(_0x3c7f6e){if(_0x3c7f6e){_0x3d718c=_0x3c7f6e;_0x1af789['model']=_['keys'](db[_0x7fcc('0x4b')][_0x7fcc('0x2b')]);_0x1af789['query']=_[_0x7fcc('0x30')](_0x5d70f1[_0x7fcc('0x31')]);_0x1af789[_0x7fcc('0x3b')]=_[_0x7fcc('0x32')](_0x1af789['model'],_0x1af789[_0x7fcc('0x31')]);_0x223f09['attributes']=_[_0x7fcc('0x32')](_0x1af789[_0x7fcc('0x2e')],qs['fields'](_0x5d70f1[_0x7fcc('0x31')][_0x7fcc('0x34')]));_0x223f09[_0x7fcc('0x33')]=_0x223f09[_0x7fcc('0x33')][_0x7fcc('0x35')]?_0x223f09[_0x7fcc('0x33')]:_0x1af789[_0x7fcc('0x2e')];_0x223f09[_0x7fcc('0x38')]=qs['sort'](_0x5d70f1[_0x7fcc('0x31')][_0x7fcc('0x39')]);_0x223f09[_0x7fcc('0x3a')]=qs[_0x7fcc('0x3b')](_[_0x7fcc('0x3c')](_0x5d70f1[_0x7fcc('0x31')],_0x1af789[_0x7fcc('0x3b')]));if(_0x5d70f1[_0x7fcc('0x31')]['filter']){_0x223f09[_0x7fcc('0x3a')]=_[_0x7fcc('0x3e')](_0x223f09[_0x7fcc('0x3a')],{'$or':_[_0x7fcc('0x2f')](_0x223f09[_0x7fcc('0x33')],function(_0x1b452c){var _0x21e033={};_0x21e033[_0x1b452c]={'$like':'%'+_0x5d70f1[_0x7fcc('0x31')][_0x7fcc('0x3d')]+'%'};return _0x21e033;})});}_0x223f09=_[_0x7fcc('0x3e')]({},_0x223f09,_0x5d70f1[_0x7fcc('0x40')]);return _0x3d718c['getFields'](_0x223f09);}})['then'](function(_0x54d691){if(_0x54d691){_0x46c153=_0x54d691[_0x7fcc('0x35')];if(!_0x5d70f1[_0x7fcc('0x31')][_0x7fcc('0x36')]('nolimit')){_0x223f09[_0x7fcc('0x1e')]=qs['limit'](_0x5d70f1['query']['limit']);_0x223f09['offset']=qs[_0x7fcc('0x20')](_0x5d70f1[_0x7fcc('0x31')][_0x7fcc('0x20')]);}return _0x3d718c[_0x7fcc('0x4a')](_0x223f09);}})[_0x7fcc('0x25')](function(_0x22caa0){if(_0x22caa0){return _0x22caa0?{'count':_0x46c153,'rows':_0x22caa0}:null;}})[_0x7fcc('0x25')](respondWithResult(_0x32d32c,null))[_0x7fcc('0x44')](handleError(_0x32d32c,null));};exports[_0x7fcc('0x4c')]=function(_0x843236,_0x413bf8,_0x346527){var _0x16b1d7={};var _0x5bb79f={};var _0x12416e;var _0x36436e;return db[_0x7fcc('0x2a')]['findOne']({'where':{'id':_0x843236[_0x7fcc('0x46')]['id']}})[_0x7fcc('0x25')](handleEntityNotFound(_0x413bf8,null))[_0x7fcc('0x25')](function(_0x3cb7f7){if(_0x3cb7f7){_0x12416e=_0x3cb7f7;_0x5bb79f[_0x7fcc('0x2e')]=_['keys'](db['SugarcrmField'][_0x7fcc('0x2b')]);_0x5bb79f['query']=_[_0x7fcc('0x30')](_0x843236['query']);_0x5bb79f[_0x7fcc('0x3b')]=_[_0x7fcc('0x32')](_0x5bb79f[_0x7fcc('0x2e')],_0x5bb79f[_0x7fcc('0x31')]);_0x16b1d7[_0x7fcc('0x33')]=_[_0x7fcc('0x32')](_0x5bb79f[_0x7fcc('0x2e')],qs[_0x7fcc('0x34')](_0x843236[_0x7fcc('0x31')]['fields']));_0x16b1d7[_0x7fcc('0x33')]=_0x16b1d7[_0x7fcc('0x33')][_0x7fcc('0x35')]?_0x16b1d7[_0x7fcc('0x33')]:_0x5bb79f[_0x7fcc('0x2e')];_0x16b1d7[_0x7fcc('0x38')]=qs[_0x7fcc('0x39')](_0x843236['query'][_0x7fcc('0x39')]);_0x16b1d7[_0x7fcc('0x3a')]=qs['filters'](_['pick'](_0x843236[_0x7fcc('0x31')],_0x5bb79f['filters']));if(_0x843236[_0x7fcc('0x31')]['filter']){_0x16b1d7['where']=_[_0x7fcc('0x3e')](_0x16b1d7[_0x7fcc('0x3a')],{'$or':_[_0x7fcc('0x2f')](_0x16b1d7[_0x7fcc('0x33')],function(_0x10428c){var _0x3724e6={};_0x3724e6[_0x10428c]={'$like':'%'+_0x843236['query'][_0x7fcc('0x3d')]+'%'};return _0x3724e6;})});}_0x16b1d7=_[_0x7fcc('0x3e')]({},_0x16b1d7,_0x843236['options']);return _0x12416e['getSubjects'](_0x16b1d7);}})[_0x7fcc('0x25')](function(_0xca2bf2){if(_0xca2bf2){_0x36436e=_0xca2bf2['length'];if(!_0x843236[_0x7fcc('0x31')][_0x7fcc('0x36')]('nolimit')){_0x16b1d7[_0x7fcc('0x1e')]=qs[_0x7fcc('0x1e')](_0x843236[_0x7fcc('0x31')][_0x7fcc('0x1e')]);_0x16b1d7[_0x7fcc('0x20')]=qs['offset'](_0x843236[_0x7fcc('0x31')][_0x7fcc('0x20')]);}return _0x12416e[_0x7fcc('0x4c')](_0x16b1d7);}})[_0x7fcc('0x25')](function(_0x47ed56){if(_0x47ed56){return _0x47ed56?{'count':_0x36436e,'rows':_0x47ed56}:null;}})[_0x7fcc('0x25')](respondWithResult(_0x413bf8,null))[_0x7fcc('0x44')](handleError(_0x413bf8,null));};exports[_0x7fcc('0x4d')]=function(_0x3a8a5f,_0x1061e6,_0x263530){var _0x3d589d={};var _0x3a0f3c={};var _0x1a82c4;var _0x5b8aaa;return db[_0x7fcc('0x2a')]['findOne']({'where':{'id':_0x3a8a5f[_0x7fcc('0x46')]['id']}})[_0x7fcc('0x25')](handleEntityNotFound(_0x1061e6,null))['then'](function(_0xf3dc5f){if(_0xf3dc5f){_0x1a82c4=_0xf3dc5f;_0x3a0f3c[_0x7fcc('0x2e')]=_[_0x7fcc('0x30')](db[_0x7fcc('0x4b')][_0x7fcc('0x2b')]);_0x3a0f3c[_0x7fcc('0x31')]=_[_0x7fcc('0x30')](_0x3a8a5f[_0x7fcc('0x31')]);_0x3a0f3c[_0x7fcc('0x3b')]=_[_0x7fcc('0x32')](_0x3a0f3c[_0x7fcc('0x2e')],_0x3a0f3c[_0x7fcc('0x31')]);_0x3d589d[_0x7fcc('0x33')]=_[_0x7fcc('0x32')](_0x3a0f3c[_0x7fcc('0x2e')],qs[_0x7fcc('0x34')](_0x3a8a5f[_0x7fcc('0x31')][_0x7fcc('0x34')]));_0x3d589d[_0x7fcc('0x33')]=_0x3d589d[_0x7fcc('0x33')][_0x7fcc('0x35')]?_0x3d589d['attributes']:_0x3a0f3c[_0x7fcc('0x2e')];_0x3d589d[_0x7fcc('0x38')]=qs[_0x7fcc('0x39')](_0x3a8a5f[_0x7fcc('0x31')]['sort']);_0x3d589d['where']=qs[_0x7fcc('0x3b')](_[_0x7fcc('0x3c')](_0x3a8a5f[_0x7fcc('0x31')],_0x3a0f3c[_0x7fcc('0x3b')]));if(_0x3a8a5f[_0x7fcc('0x31')]['filter']){_0x3d589d['where']=_[_0x7fcc('0x3e')](_0x3d589d['where'],{'$or':_[_0x7fcc('0x2f')](_0x3d589d[_0x7fcc('0x33')],function(_0x9c286){var _0x180233={};_0x180233[_0x9c286]={'$like':'%'+_0x3a8a5f[_0x7fcc('0x31')][_0x7fcc('0x3d')]+'%'};return _0x180233;})});}_0x3d589d=_[_0x7fcc('0x3e')]({},_0x3d589d,_0x3a8a5f['options']);return _0x1a82c4[_0x7fcc('0x4d')](_0x3d589d);}})[_0x7fcc('0x25')](function(_0x238a24){if(_0x238a24){_0x5b8aaa=_0x238a24['length'];if(!_0x3a8a5f['query'][_0x7fcc('0x36')](_0x7fcc('0x37'))){_0x3d589d[_0x7fcc('0x1e')]=qs[_0x7fcc('0x1e')](_0x3a8a5f[_0x7fcc('0x31')][_0x7fcc('0x1e')]);_0x3d589d[_0x7fcc('0x20')]=qs[_0x7fcc('0x20')](_0x3a8a5f[_0x7fcc('0x31')][_0x7fcc('0x20')]);}return _0x1a82c4[_0x7fcc('0x4d')](_0x3d589d);}})['then'](function(_0x5978c8){if(_0x5978c8){return _0x5978c8?{'count':_0x5b8aaa,'rows':_0x5978c8}:null;}})[_0x7fcc('0x25')](respondWithResult(_0x1061e6,null))['catch'](handleError(_0x1061e6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4a065a8..8eab766 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 _0x4bdb=['request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3eaab9,_0x59b460){var _0x4f224a=function(_0x263987){while(--_0x263987){_0x3eaab9['push'](_0x3eaab9['shift']());}};_0x4f224a(++_0x59b460);}(_0x4bdb,0xcd));var _0xb4bd=function(_0x149d62,_0x149e74){_0x149d62=_0x149d62-0x0;var _0x535fba=_0x4bdb[_0x149d62];return _0x535fba;};'use strict';var _=require(_0xb4bd('0x0'));var util=require(_0xb4bd('0x1'));var logger=require(_0xb4bd('0x2'))(_0xb4bd('0x3'));var moment=require('moment');var BPromise=require(_0xb4bd('0x4'));var rp=require(_0xb4bd('0x5'));var fs=require('fs');var path=require(_0xb4bd('0x6'));var rimraf=require(_0xb4bd('0x7'));var config=require(_0xb4bd('0x8'));var attributes=require(_0xb4bd('0x9'));module[_0xb4bd('0xa')]=function(_0x40a091,_0x4fc433){return _0x40a091[_0xb4bd('0xb')](_0xb4bd('0xc'),attributes,{'tableName':_0xb4bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf956=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2be08f,_0x240421){var _0x189a61=function(_0x4c563d){while(--_0x4c563d){_0x2be08f['push'](_0x2be08f['shift']());}};_0x189a61(++_0x240421);}(_0xf956,0x1e7));var _0x6f95=function(_0x302b4f,_0x282144){_0x302b4f=_0x302b4f-0x0;var _0x3e5155=_0xf956[_0x302b4f];return _0x3e5155;};'use strict';var _=require(_0x6f95('0x0'));var util=require('util');var logger=require(_0x6f95('0x1'))(_0x6f95('0x2'));var moment=require(_0x6f95('0x3'));var BPromise=require(_0x6f95('0x4'));var rp=require(_0x6f95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f95('0x6'));var config=require(_0x6f95('0x7'));var attributes=require(_0x6f95('0x8'));module[_0x6f95('0x9')]=function(_0x59f843,_0x1e5d7e){return _0x59f843[_0x6f95('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x6f95('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 af6f029..f126a16 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 _0x70ca=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','info','catch','lodash','util','moment','bluebird'];(function(_0x443b3b,_0x1e2a2a){var _0x120b80=function(_0x469d68){while(--_0x469d68){_0x443b3b['push'](_0x443b3b['shift']());}};_0x120b80(++_0x1e2a2a);}(_0x70ca,0x1c4));var _0xa70c=function(_0x5cd8ae,_0x5358eb){_0x5cd8ae=_0x5cd8ae-0x0;var _0x5f0a91=_0x70ca[_0x5cd8ae];return _0x5f0a91;};'use strict';var _=require(_0xa70c('0x0'));var util=require(_0xa70c('0x1'));var moment=require(_0xa70c('0x2'));var BPromise=require(_0xa70c('0x3'));var rs=require(_0xa70c('0x4'));var fs=require('fs');var Redis=require(_0xa70c('0x5'));var db=require(_0xa70c('0x6'))['db'];var utils=require(_0xa70c('0x7'));var logger=require(_0xa70c('0x8'))(_0xa70c('0x9'));var config=require(_0xa70c('0xa'));var jayson=require(_0xa70c('0xb'));var client=jayson['client'][_0xa70c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e39aa,_0x509df2,_0x52663d){return new BPromise(function(_0x29b1f4,_0x3aaec8){return client[_0xa70c('0xd')](_0x4e39aa,_0x52663d)[_0xa70c('0xe')](function(_0x4ee378){logger['info'](_0xa70c('0xf'),_0x509df2,_0xa70c('0x10'));logger[_0xa70c('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x509df2,_0xa70c('0x10'),JSON[_0xa70c('0x12')](_0x4ee378));if(_0x4ee378['error']){if(_0x4ee378['error'][_0xa70c('0x13')]===0x1f4){logger['error'](_0xa70c('0xf'),_0x509df2,_0x4ee378['error'][_0xa70c('0x14')]);return _0x3aaec8(_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x509df2,_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);return _0x29b1f4(_0x4ee378[_0xa70c('0x15')][_0xa70c('0x14')]);}else{logger[_0xa70c('0x16')](_0xa70c('0xf'),_0x509df2,'request\x20sent');_0x29b1f4(_0x4ee378['result'][_0xa70c('0x14')]);}})[_0xa70c('0x17')](function(_0x1312b9){logger[_0xa70c('0x15')](_0xa70c('0xf'),_0x509df2,_0x1312b9);_0x3aaec8(_0x1312b9);});});} \ No newline at end of file +var _0x5c3f=['code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1a47d6,_0x2b79ca){var _0x12740d=function(_0xbc7316){while(--_0xbc7316){_0x1a47d6['push'](_0x1a47d6['shift']());}};_0x12740d(++_0x2b79ca);}(_0x5c3f,0xcb));var _0xf5c3=function(_0x433fc2,_0x28db30){_0x433fc2=_0x433fc2-0x0;var _0x2742c9=_0x5c3f[_0x433fc2];return _0x2742c9;};'use strict';var _=require(_0xf5c3('0x0'));var util=require('util');var moment=require(_0xf5c3('0x1'));var BPromise=require(_0xf5c3('0x2'));var rs=require(_0xf5c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5c3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5c3('0x5'))('rpc');var config=require(_0xf5c3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5c3('0x7')][_0xf5c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490502,_0x49ee3d,_0x347df6){return new BPromise(function(_0xcb2ae1,_0x4a1d99){return client[_0xf5c3('0x9')](_0x490502,_0x347df6)[_0xf5c3('0xa')](function(_0x480144){logger[_0xf5c3('0xb')](_0xf5c3('0xc'),_0x49ee3d,_0xf5c3('0xd'));logger[_0xf5c3('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x49ee3d,_0xf5c3('0xd'),JSON[_0xf5c3('0xf')](_0x480144));if(_0x480144[_0xf5c3('0x10')]){if(_0x480144[_0xf5c3('0x10')][_0xf5c3('0x11')]===0x1f4){logger[_0xf5c3('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x49ee3d,_0x480144[_0xf5c3('0x10')]['message']);return _0x4a1d99(_0x480144['error']['message']);}logger[_0xf5c3('0x10')](_0xf5c3('0xc'),_0x49ee3d,_0x480144['error'][_0xf5c3('0x12')]);return _0xcb2ae1(_0x480144[_0xf5c3('0x10')][_0xf5c3('0x12')]);}else{logger['info'](_0xf5c3('0xc'),_0x49ee3d,_0xf5c3('0xd'));_0xcb2ae1(_0x480144[_0xf5c3('0x13')][_0xf5c3('0x12')]);}})['catch'](function(_0x258969){logger[_0xf5c3('0x10')](_0xf5c3('0xc'),_0x49ee3d,_0x258969);_0x4a1d99(_0x258969);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 44ced13..8e7d41d 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 _0xe2e5=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x2a4ddc,_0x4d5fe7){var _0x2c0bef=function(_0x375359){while(--_0x375359){_0x2a4ddc['push'](_0x2a4ddc['shift']());}};_0x2c0bef(++_0x4d5fe7);}(_0xe2e5,0xab));var _0x5e2e=function(_0x19f40c,_0x28e0da){_0x19f40c=_0x19f40c-0x0;var _0x3c86d0=_0xe2e5[_0x19f40c];return _0x3c86d0;};'use strict';var multer=require(_0x5e2e('0x0'));var util=require(_0x5e2e('0x1'));var path=require('path');var timeout=require(_0x5e2e('0x2'));var express=require(_0x5e2e('0x3'));var router=express[_0x5e2e('0x4')]();var fs_extra=require(_0x5e2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5e2e('0x6'));var config=require(_0x5e2e('0x7'));var controller=require(_0x5e2e('0x8'));router[_0x5e2e('0x9')]('/',auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xb')]);router[_0x5e2e('0x9')](_0x5e2e('0xc'),auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xd')]);router[_0x5e2e('0xe')]('/',auth[_0x5e2e('0xa')](),controller[_0x5e2e('0xf')]);router['put'](_0x5e2e('0xc'),auth[_0x5e2e('0xa')](),controller[_0x5e2e('0x10')]);router[_0x5e2e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5e2e('0x12')]);module[_0x5e2e('0x13')]=router; \ No newline at end of file +var _0xc40f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xc40f,0x137));var _0xfc40=function(_0x4bc532,_0x42f9c5){_0x4bc532=_0x4bc532-0x0;var _0x2b20f1=_0xc40f[_0x4bc532];return _0x2b20f1;};'use strict';var multer=require(_0xfc40('0x0'));var util=require('util');var path=require(_0xfc40('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc40('0x2'));var router=express[_0xfc40('0x3')]();var fs_extra=require(_0xfc40('0x4'));var auth=require(_0xfc40('0x5'));var interaction=require(_0xfc40('0x6'));var config=require(_0xfc40('0x7'));var controller=require(_0xfc40('0x8'));router[_0xfc40('0x9')]('/',auth[_0xfc40('0xa')](),controller[_0xfc40('0xb')]);router[_0xfc40('0x9')](_0xfc40('0xc'),auth[_0xfc40('0xa')](),controller[_0xfc40('0xd')]);router[_0xfc40('0xe')]('/',auth['isAuthenticated'](),controller[_0xfc40('0xf')]);router[_0xfc40('0x10')](_0xfc40('0xc'),auth[_0xfc40('0xa')](),controller[_0xfc40('0x11')]);router[_0xfc40('0x12')](_0xfc40('0xc'),auth[_0xfc40('0xa')](),controller[_0xfc40('0x13')]);module[_0xfc40('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index c9bde42..f6356e5 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 _0x12e3=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x440af8,_0x59a284){var _0x1483f0=function(_0x50c24e){while(--_0x50c24e){_0x440af8['push'](_0x440af8['shift']());}};_0x1483f0(++_0x59a284);}(_0x12e3,0x18a));var _0x312e=function(_0x202eec,_0x47c96f){_0x202eec=_0x202eec-0x0;var _0x3808d1=_0x12e3[_0x202eec];return _0x3808d1;};'use strict';var Sequelize=require(_0x312e('0x0'));module[_0x312e('0x1')]={'type':{'type':Sequelize[_0x312e('0x2')](_0x312e('0x3'),'variable',_0x312e('0x4'),_0x312e('0x5'),_0x312e('0x6')),'defaultValue':_0x312e('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x312e('0x7')]},'keyType':{'type':Sequelize[_0x312e('0x2')](_0x312e('0x3'),_0x312e('0x8'),_0x312e('0x4'))},'keyContent':{'type':Sequelize[_0x312e('0x7')]},'idField':{'type':Sequelize[_0x312e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x312e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x312e('0x7')]}}; \ No newline at end of file +var _0x4778=['ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x4778,0x7c));var _0x8477=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x4778[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x8477('0x0'));module[_0x8477('0x1')]={'type':{'type':Sequelize[_0x8477('0x2')]('string','variable',_0x8477('0x3'),'keyValue',_0x8477('0x4')),'defaultValue':_0x8477('0x5')},'content':{'type':Sequelize[_0x8477('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8477('0x2')](_0x8477('0x5'),_0x8477('0x7'),_0x8477('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8477('0x6')]},'nameField':{'type':Sequelize[_0x8477('0x6')]},'customField':{'type':Sequelize[_0x8477('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4800f02..a320db4 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 _0x743a=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3f171c,_0x1cad10){var _0x3c09d7=function(_0x1c0d2e){while(--_0x1c0d2e){_0x3f171c['push'](_0x3f171c['shift']());}};_0x3c09d7(++_0x1cad10);}(_0x743a,0x1ee));var _0xa743=function(_0x2db247,_0x1d5ee1){_0x2db247=_0x2db247-0x0;var _0x1f1b98=_0x743a[_0x2db247];return _0x1f1b98;};'use strict';var emlformat=require(_0xa743('0x0'));var rimraf=require(_0xa743('0x1'));var zipdir=require(_0xa743('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa743('0x3'));var Mustache=require(_0xa743('0x4'));var util=require(_0xa743('0x5'));var path=require(_0xa743('0x6'));var sox=require(_0xa743('0x7'));var csv=require(_0xa743('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa743('0x9'));var _=require(_0xa743('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa743('0xb'));var deskjs=require(_0xa743('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa743('0xd'));var Papa=require('papaparse');var Redis=require(_0xa743('0xe'));var authService=require(_0xa743('0xf'));var qs=require(_0xa743('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa743('0x11'));var logger=require('../../config/logger')(_0xa743('0x12'));var utils=require('../../config/utils');var config=require(_0xa743('0x13'));var licenseUtil=require(_0xa743('0x14'));var db=require(_0xa743('0x15'))['db'];function respondWithStatusCode(_0x1fcd49,_0x29d97d){_0x29d97d=_0x29d97d||0xcc;return function(_0x3e0d8b){if(_0x3e0d8b){return _0x1fcd49[_0xa743('0x16')](_0x29d97d);}return _0x1fcd49[_0xa743('0x17')](_0x29d97d)['end']();};}function respondWithResult(_0xed1a4f,_0x5c6bf3){_0x5c6bf3=_0x5c6bf3||0xc8;return function(_0x5e086b){if(_0x5e086b){return _0xed1a4f['status'](_0x5c6bf3)['json'](_0x5e086b);}};}function respondWithFilteredResult(_0x10e97c,_0xc0d56b){return function(_0x411fa8){if(_0x411fa8){var _0x19dc93=typeof _0xc0d56b[_0xa743('0x18')]===_0xa743('0x19')&&typeof _0xc0d56b[_0xa743('0x1a')]==='undefined';var _0x346ee4=_0x411fa8[_0xa743('0x1b')];var _0x5d9298=_0x19dc93?0x0:_0xc0d56b[_0xa743('0x18')];var _0x1b1247=_0x19dc93?_0x411fa8[_0xa743('0x1b')]:_0xc0d56b[_0xa743('0x18')]+_0xc0d56b[_0xa743('0x1a')];var _0x58cbe0;if(_0x1b1247>=_0x346ee4){_0x1b1247=_0x346ee4;_0x58cbe0=0xc8;}else{_0x58cbe0=0xce;}_0x10e97c['status'](_0x58cbe0);return _0x10e97c[_0xa743('0x1c')](_0xa743('0x1d'),_0x5d9298+'-'+_0x1b1247+'/'+_0x346ee4)[_0xa743('0x1e')](_0x411fa8);}return null;};}function patchUpdates(_0x253bb2){return function(_0x261c4a){try{jsonpatch[_0xa743('0x1f')](_0x261c4a,_0x253bb2,!![]);}catch(_0x14682c){return BPromise[_0xa743('0x20')](_0x14682c);}return _0x261c4a['save']();};}function saveUpdates(_0x440b1a,_0x2a4df6){return function(_0xc3f0c){if(_0xc3f0c){return _0xc3f0c[_0xa743('0x21')](_0x440b1a)[_0xa743('0x22')](function(_0x58fd64){return _0x58fd64;});}return null;};}function removeEntity(_0xe1f7d5,_0x144e2d){return function(_0x3f6211){if(_0x3f6211){return _0x3f6211[_0xa743('0x23')]()[_0xa743('0x22')](function(){_0xe1f7d5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x590943,_0x202e80){return function(_0x50325a){if(!_0x50325a){_0x590943[_0xa743('0x16')](0x194);}return _0x50325a;};}function handleError(_0x1137ed,_0x2b7e7c){_0x2b7e7c=_0x2b7e7c||0x1f4;return function(_0x263f0f){logger[_0xa743('0x24')](_0x263f0f['stack']);if(_0x263f0f[_0xa743('0x25')]){delete _0x263f0f[_0xa743('0x25')];}_0x1137ed['status'](_0x2b7e7c)['send'](_0x263f0f);};}exports[_0xa743('0x26')]=function(_0x2d0684,_0x3424dc){var _0x5bd557={},_0x537c00={},_0x37b33b={'count':0x0,'rows':[]};var _0x21d72b=_[_0xa743('0x27')](db[_0xa743('0x28')][_0xa743('0x29')],function(_0x118a8a){return{'name':_0x118a8a[_0xa743('0x2a')],'type':_0x118a8a[_0xa743('0x2b')][_0xa743('0x2c')]};});_0x537c00[_0xa743('0x2d')]=_['map'](_0x21d72b,_0xa743('0x25'));_0x537c00[_0xa743('0x2e')]=_[_0xa743('0x2f')](_0x2d0684[_0xa743('0x2e')]);_0x537c00['filters']=_[_0xa743('0x30')](_0x537c00[_0xa743('0x2d')],_0x537c00['query']);_0x5bd557[_0xa743('0x31')]=_[_0xa743('0x30')](_0x537c00[_0xa743('0x2d')],qs[_0xa743('0x32')](_0x2d0684['query']['fields']));_0x5bd557[_0xa743('0x31')]=_0x5bd557[_0xa743('0x31')][_0xa743('0x33')]?_0x5bd557[_0xa743('0x31')]:_0x537c00[_0xa743('0x2d')];if(!_0x2d0684[_0xa743('0x2e')][_0xa743('0x34')](_0xa743('0x35'))){_0x5bd557[_0xa743('0x1a')]=qs[_0xa743('0x1a')](_0x2d0684[_0xa743('0x2e')]['limit']);_0x5bd557[_0xa743('0x18')]=qs[_0xa743('0x18')](_0x2d0684[_0xa743('0x2e')][_0xa743('0x18')]);}_0x5bd557[_0xa743('0x36')]=qs[_0xa743('0x37')](_0x2d0684[_0xa743('0x2e')][_0xa743('0x37')]);_0x5bd557[_0xa743('0x38')]=qs[_0xa743('0x39')](_[_0xa743('0x3a')](_0x2d0684[_0xa743('0x2e')],_0x537c00[_0xa743('0x39')]),_0x21d72b);if(_0x2d0684[_0xa743('0x2e')]['filter']){_0x5bd557['where']=_[_0xa743('0x3b')](_0x5bd557['where'],{'$or':_[_0xa743('0x27')](_0x21d72b,function(_0x6d43a0){if(_0x6d43a0[_0xa743('0x2b')]!==_0xa743('0x3c')){var _0x2cc12d={};_0x2cc12d[_0x6d43a0[_0xa743('0x25')]]={'$like':'%'+_0x2d0684['query'][_0xa743('0x3d')]+'%'};return _0x2cc12d;}})});}_0x5bd557=_[_0xa743('0x3b')]({},_0x5bd557,_0x2d0684[_0xa743('0x3e')]);var _0x379dae={'where':_0x5bd557[_0xa743('0x38')]};return db[_0xa743('0x28')][_0xa743('0x1b')](_0x379dae)['then'](function(_0x50ee9a){_0x37b33b[_0xa743('0x1b')]=_0x50ee9a;if(_0x2d0684[_0xa743('0x2e')][_0xa743('0x3f')]){_0x5bd557[_0xa743('0x40')]=[{'all':!![]}];}return db[_0xa743('0x28')][_0xa743('0x41')](_0x5bd557);})[_0xa743('0x22')](function(_0x3abf32){_0x37b33b[_0xa743('0x42')]=_0x3abf32;return _0x37b33b;})[_0xa743('0x22')](respondWithFilteredResult(_0x3424dc,_0x5bd557))[_0xa743('0x43')](handleError(_0x3424dc,null));};exports[_0xa743('0x44')]=function(_0x1cb6da,_0x2ad26a){var _0x254292={'raw':!![],'where':{'id':_0x1cb6da[_0xa743('0x45')]['id']}},_0x5a78d8={};_0x5a78d8[_0xa743('0x2d')]=_[_0xa743('0x2f')](db['SugarcrmField']['rawAttributes']);_0x5a78d8[_0xa743('0x2e')]=_[_0xa743('0x2f')](_0x1cb6da[_0xa743('0x2e')]);_0x5a78d8[_0xa743('0x39')]=_[_0xa743('0x30')](_0x5a78d8['model'],_0x5a78d8[_0xa743('0x2e')]);_0x254292[_0xa743('0x31')]=_[_0xa743('0x30')](_0x5a78d8[_0xa743('0x2d')],qs[_0xa743('0x32')](_0x1cb6da[_0xa743('0x2e')][_0xa743('0x32')]));_0x254292[_0xa743('0x31')]=_0x254292[_0xa743('0x31')]['length']?_0x254292['attributes']:_0x5a78d8['model'];if(_0x1cb6da['query'][_0xa743('0x3f')]){_0x254292['include']=[{'all':!![]}];}_0x254292=_[_0xa743('0x3b')]({},_0x254292,_0x1cb6da['options']);return db['SugarcrmField'][_0xa743('0x46')](_0x254292)[_0xa743('0x22')](handleEntityNotFound(_0x2ad26a,null))[_0xa743('0x22')](respondWithResult(_0x2ad26a,null))['catch'](handleError(_0x2ad26a,null));};exports['create']=function(_0x126ccb,_0x2a98a4){return db[_0xa743('0x28')][_0xa743('0x47')](_0x126ccb[_0xa743('0x48')],{})['then'](respondWithResult(_0x2a98a4,0xc9))[_0xa743('0x43')](handleError(_0x2a98a4,null));};exports[_0xa743('0x21')]=function(_0x133965,_0x5c0380){if(_0x133965[_0xa743('0x48')]['id']){delete _0x133965['body']['id'];}return db[_0xa743('0x28')][_0xa743('0x46')]({'where':{'id':_0x133965[_0xa743('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c0380,null))['then'](saveUpdates(_0x133965[_0xa743('0x48')],null))[_0xa743('0x22')](respondWithResult(_0x5c0380,null))[_0xa743('0x43')](handleError(_0x5c0380,null));};exports['destroy']=function(_0x40f033,_0x4a1862){return db[_0xa743('0x28')][_0xa743('0x46')]({'where':{'id':_0x40f033['params']['id']}})[_0xa743('0x22')](handleEntityNotFound(_0x4a1862,null))[_0xa743('0x22')](removeEntity(_0x4a1862,null))[_0xa743('0x43')](handleError(_0x4a1862,null));}; \ No newline at end of file +var _0xcd28=['includeAll','include','rows','catch','show','params','filters','length','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','update','then','destroy','end','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','limit','sort','where','filter','merge','options'];(function(_0x5d85e2,_0x17871d){var _0x1305d0=function(_0x643db8){while(--_0x643db8){_0x5d85e2['push'](_0x5d85e2['shift']());}};_0x1305d0(++_0x17871d);}(_0xcd28,0x127));var _0x8cd2=function(_0xdc6129,_0x3e2c41){_0xdc6129=_0xdc6129-0x0;var _0x12ba61=_0xcd28[_0xdc6129];return _0x12ba61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cd2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cd2('0x1'));var rp=require(_0x8cd2('0x2'));var moment=require(_0x8cd2('0x3'));var BPromise=require(_0x8cd2('0x4'));var Mustache=require(_0x8cd2('0x5'));var util=require(_0x8cd2('0x6'));var path=require(_0x8cd2('0x7'));var sox=require(_0x8cd2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cd2('0x9'));var squel=require(_0x8cd2('0xa'));var crypto=require(_0x8cd2('0xb'));var jsforce=require(_0x8cd2('0xc'));var deskjs=require(_0x8cd2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cd2('0xe'));var Papa=require(_0x8cd2('0xf'));var Redis=require(_0x8cd2('0x10'));var authService=require(_0x8cd2('0x11'));var qs=require(_0x8cd2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cd2('0x13'));var utils=require(_0x8cd2('0x14'));var config=require(_0x8cd2('0x15'));var licenseUtil=require(_0x8cd2('0x16'));var db=require(_0x8cd2('0x17'))['db'];function respondWithStatusCode(_0x1a48cf,_0x338175){_0x338175=_0x338175||0xcc;return function(_0x9af484){if(_0x9af484){return _0x1a48cf[_0x8cd2('0x18')](_0x338175);}return _0x1a48cf[_0x8cd2('0x19')](_0x338175)['end']();};}function respondWithResult(_0x20f6cc,_0x4cccce){_0x4cccce=_0x4cccce||0xc8;return function(_0x368053){if(_0x368053){return _0x20f6cc[_0x8cd2('0x19')](_0x4cccce)[_0x8cd2('0x1a')](_0x368053);}};}function respondWithFilteredResult(_0xb2d714,_0xb14a8f){return function(_0x543a36){if(_0x543a36){var _0x23e1fa=typeof _0xb14a8f[_0x8cd2('0x1b')]===_0x8cd2('0x1c')&&typeof _0xb14a8f['limit']===_0x8cd2('0x1c');var _0x12e285=_0x543a36[_0x8cd2('0x1d')];var _0x113fc4=_0x23e1fa?0x0:_0xb14a8f[_0x8cd2('0x1b')];var _0x3f09a9=_0x23e1fa?_0x543a36[_0x8cd2('0x1d')]:_0xb14a8f[_0x8cd2('0x1b')]+_0xb14a8f['limit'];var _0x4ab31c;if(_0x3f09a9>=_0x12e285){_0x3f09a9=_0x12e285;_0x4ab31c=0xc8;}else{_0x4ab31c=0xce;}_0xb2d714[_0x8cd2('0x19')](_0x4ab31c);return _0xb2d714[_0x8cd2('0x1e')]('Content-Range',_0x113fc4+'-'+_0x3f09a9+'/'+_0x12e285)[_0x8cd2('0x1a')](_0x543a36);}return null;};}function patchUpdates(_0x1482bc){return function(_0xc3abf4){try{jsonpatch[_0x8cd2('0x1f')](_0xc3abf4,_0x1482bc,!![]);}catch(_0x23b44d){return BPromise['reject'](_0x23b44d);}return _0xc3abf4[_0x8cd2('0x20')]();};}function saveUpdates(_0x32a261,_0x440edf){return function(_0x3b9d56){if(_0x3b9d56){return _0x3b9d56[_0x8cd2('0x21')](_0x32a261)[_0x8cd2('0x22')](function(_0x2ec134){return _0x2ec134;});}return null;};}function removeEntity(_0x1d4715,_0x49a16f){return function(_0xd3a80e){if(_0xd3a80e){return _0xd3a80e[_0x8cd2('0x23')]()[_0x8cd2('0x22')](function(){_0x1d4715['status'](0xcc)[_0x8cd2('0x24')]();});}};}function handleEntityNotFound(_0x3a7102,_0x2ede66){return function(_0x55ebe2){if(!_0x55ebe2){_0x3a7102[_0x8cd2('0x18')](0x194);}return _0x55ebe2;};}function handleError(_0x2445c4,_0xf2d8b4){_0xf2d8b4=_0xf2d8b4||0x1f4;return function(_0x1853d4){logger[_0x8cd2('0x25')](_0x1853d4['stack']);if(_0x1853d4['name']){delete _0x1853d4[_0x8cd2('0x26')];}_0x2445c4[_0x8cd2('0x19')](_0xf2d8b4)[_0x8cd2('0x27')](_0x1853d4);};}exports[_0x8cd2('0x28')]=function(_0x1e3bbd,_0xab4ea2){var _0x3a5bf0={},_0x3edf43={},_0x3410aa={'count':0x0,'rows':[]};var _0x16173c=_[_0x8cd2('0x29')](db[_0x8cd2('0x2a')][_0x8cd2('0x2b')],function(_0x54bba7){return{'name':_0x54bba7[_0x8cd2('0x2c')],'type':_0x54bba7[_0x8cd2('0x2d')][_0x8cd2('0x2e')]};});_0x3edf43[_0x8cd2('0x2f')]=_[_0x8cd2('0x29')](_0x16173c,_0x8cd2('0x26'));_0x3edf43[_0x8cd2('0x30')]=_[_0x8cd2('0x31')](_0x1e3bbd[_0x8cd2('0x30')]);_0x3edf43['filters']=_[_0x8cd2('0x32')](_0x3edf43[_0x8cd2('0x2f')],_0x3edf43['query']);_0x3a5bf0['attributes']=_[_0x8cd2('0x32')](_0x3edf43[_0x8cd2('0x2f')],qs['fields'](_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x33')]));_0x3a5bf0[_0x8cd2('0x34')]=_0x3a5bf0[_0x8cd2('0x34')]['length']?_0x3a5bf0[_0x8cd2('0x34')]:_0x3edf43['model'];if(!_0x1e3bbd[_0x8cd2('0x30')]['hasOwnProperty'](_0x8cd2('0x35'))){_0x3a5bf0[_0x8cd2('0x36')]=qs[_0x8cd2('0x36')](_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x36')]);_0x3a5bf0[_0x8cd2('0x1b')]=qs[_0x8cd2('0x1b')](_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x1b')]);}_0x3a5bf0['order']=qs['sort'](_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x37')]);_0x3a5bf0[_0x8cd2('0x38')]=qs['filters'](_['pick'](_0x1e3bbd['query'],_0x3edf43['filters']),_0x16173c);if(_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x39')]){_0x3a5bf0['where']=_[_0x8cd2('0x3a')](_0x3a5bf0[_0x8cd2('0x38')],{'$or':_['map'](_0x16173c,function(_0x5b67f0){if(_0x5b67f0[_0x8cd2('0x2d')]!=='VIRTUAL'){var _0x3e3a71={};_0x3e3a71[_0x5b67f0['name']]={'$like':'%'+_0x1e3bbd[_0x8cd2('0x30')][_0x8cd2('0x39')]+'%'};return _0x3e3a71;}})});}_0x3a5bf0=_[_0x8cd2('0x3a')]({},_0x3a5bf0,_0x1e3bbd[_0x8cd2('0x3b')]);var _0x2f59eb={'where':_0x3a5bf0[_0x8cd2('0x38')]};return db[_0x8cd2('0x2a')]['count'](_0x2f59eb)[_0x8cd2('0x22')](function(_0x526e92){_0x3410aa[_0x8cd2('0x1d')]=_0x526e92;if(_0x1e3bbd['query'][_0x8cd2('0x3c')]){_0x3a5bf0[_0x8cd2('0x3d')]=[{'all':!![]}];}return db[_0x8cd2('0x2a')]['findAll'](_0x3a5bf0);})[_0x8cd2('0x22')](function(_0x2b895d){_0x3410aa[_0x8cd2('0x3e')]=_0x2b895d;return _0x3410aa;})[_0x8cd2('0x22')](respondWithFilteredResult(_0xab4ea2,_0x3a5bf0))[_0x8cd2('0x3f')](handleError(_0xab4ea2,null));};exports[_0x8cd2('0x40')]=function(_0x3b2179,_0x7c93ca){var _0x331b70={'raw':!![],'where':{'id':_0x3b2179[_0x8cd2('0x41')]['id']}},_0x4bb083={};_0x4bb083['model']=_[_0x8cd2('0x31')](db['SugarcrmField'][_0x8cd2('0x2b')]);_0x4bb083['query']=_[_0x8cd2('0x31')](_0x3b2179[_0x8cd2('0x30')]);_0x4bb083[_0x8cd2('0x42')]=_[_0x8cd2('0x32')](_0x4bb083[_0x8cd2('0x2f')],_0x4bb083[_0x8cd2('0x30')]);_0x331b70[_0x8cd2('0x34')]=_[_0x8cd2('0x32')](_0x4bb083['model'],qs[_0x8cd2('0x33')](_0x3b2179[_0x8cd2('0x30')][_0x8cd2('0x33')]));_0x331b70['attributes']=_0x331b70[_0x8cd2('0x34')][_0x8cd2('0x43')]?_0x331b70[_0x8cd2('0x34')]:_0x4bb083[_0x8cd2('0x2f')];if(_0x3b2179[_0x8cd2('0x30')]['includeAll']){_0x331b70[_0x8cd2('0x3d')]=[{'all':!![]}];}_0x331b70=_[_0x8cd2('0x3a')]({},_0x331b70,_0x3b2179[_0x8cd2('0x3b')]);return db['SugarcrmField'][_0x8cd2('0x44')](_0x331b70)[_0x8cd2('0x22')](handleEntityNotFound(_0x7c93ca,null))[_0x8cd2('0x22')](respondWithResult(_0x7c93ca,null))['catch'](handleError(_0x7c93ca,null));};exports[_0x8cd2('0x45')]=function(_0x17abbf,_0x5d09f7){return db[_0x8cd2('0x2a')][_0x8cd2('0x45')](_0x17abbf['body'],{})[_0x8cd2('0x22')](respondWithResult(_0x5d09f7,0xc9))[_0x8cd2('0x3f')](handleError(_0x5d09f7,null));};exports[_0x8cd2('0x21')]=function(_0x4f7203,_0x38ee1e){if(_0x4f7203['body']['id']){delete _0x4f7203['body']['id'];}return db[_0x8cd2('0x2a')][_0x8cd2('0x44')]({'where':{'id':_0x4f7203[_0x8cd2('0x41')]['id']}})['then'](handleEntityNotFound(_0x38ee1e,null))[_0x8cd2('0x22')](saveUpdates(_0x4f7203[_0x8cd2('0x46')],null))[_0x8cd2('0x22')](respondWithResult(_0x38ee1e,null))[_0x8cd2('0x3f')](handleError(_0x38ee1e,null));};exports[_0x8cd2('0x23')]=function(_0x57c7fd,_0x996ef1){return db[_0x8cd2('0x2a')][_0x8cd2('0x44')]({'where':{'id':_0x57c7fd[_0x8cd2('0x41')]['id']}})['then'](handleEntityNotFound(_0x996ef1,null))[_0x8cd2('0x22')](removeEntity(_0x996ef1,null))[_0x8cd2('0x3f')](handleError(_0x996ef1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e16de6f..5b394be 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 _0xb15b=['../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf'];(function(_0x4937b2,_0x2599cf){var _0x8da2fb=function(_0x1c875f){while(--_0x1c875f){_0x4937b2['push'](_0x4937b2['shift']());}};_0x8da2fb(++_0x2599cf);}(_0xb15b,0x1a7));var _0xbb15=function(_0x4ba3c5,_0xd48a2e){_0x4ba3c5=_0x4ba3c5-0x0;var _0x104563=_0xb15b[_0x4ba3c5];return _0x104563;};'use strict';var _=require(_0xbb15('0x0'));var util=require(_0xbb15('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbb15('0x2'));var BPromise=require(_0xbb15('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb15('0x4'));var rimraf=require(_0xbb15('0x5'));var config=require(_0xbb15('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xbb15('0x7')]=function(_0x1e0088,_0x12c255){return _0x1e0088[_0xbb15('0x8')]('SugarcrmField',attributes,{'tableName':_0xbb15('0x9'),'paranoid':![],'indexes':[{'name':_0xbb15('0xa'),'fields':[_0xbb15('0xb'),_0xbb15('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ff0=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x43a6cd,_0x503d1a){var _0x5acb36=function(_0x2dd95e){while(--_0x2dd95e){_0x43a6cd['push'](_0x43a6cd['shift']());}};_0x5acb36(++_0x503d1a);}(_0x0ff0,0xff));var _0x00ff=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0x0ff0[_0x5ec9db];return _0xfc7061;};'use strict';var _=require(_0x00ff('0x0'));var util=require(_0x00ff('0x1'));var logger=require(_0x00ff('0x2'))('api');var moment=require(_0x00ff('0x3'));var BPromise=require(_0x00ff('0x4'));var rp=require(_0x00ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00ff('0x6'));var config=require(_0x00ff('0x7'));var attributes=require(_0x00ff('0x8'));module[_0x00ff('0x9')]=function(_0x587c66,_0x373c2f){return _0x587c66[_0x00ff('0xa')](_0x00ff('0xb'),attributes,{'tableName':_0x00ff('0xc'),'paranoid':![],'indexes':[{'name':_0x00ff('0xd'),'fields':[_0x00ff('0xe'),_0x00ff('0xf')],'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 bc861ea..495ddf4 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 _0xd358=['util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x523027,_0x4179ef){var _0xe69a94=function(_0x3b03dc){while(--_0x3b03dc){_0x523027['push'](_0x523027['shift']());}};_0xe69a94(++_0x4179ef);}(_0xd358,0x1e2));var _0x8d35=function(_0x2ed887,_0xf65537){_0x2ed887=_0x2ed887-0x0;var _0x5626b7=_0xd358[_0x2ed887];return _0x5626b7;};'use strict';var _=require(_0x8d35('0x0'));var util=require(_0x8d35('0x1'));var moment=require('moment');var BPromise=require(_0x8d35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d35('0x3'));var db=require(_0x8d35('0x4'))['db'];var utils=require(_0x8d35('0x5'));var logger=require('../../config/logger')(_0x8d35('0x6'));var config=require(_0x8d35('0x7'));var jayson=require(_0x8d35('0x8'));var client=jayson[_0x8d35('0x9')][_0x8d35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x128de7,_0x2e3190,_0xaa0383){return new BPromise(function(_0x5242aa,_0x1ff55d){return client['request'](_0x128de7,_0xaa0383)['then'](function(_0x25e48f){logger['info'](_0x8d35('0xb'),_0x2e3190,_0x8d35('0xc'));logger[_0x8d35('0xd')](_0x8d35('0xe'),_0x2e3190,'request\x20sent',JSON['stringify'](_0x25e48f));if(_0x25e48f[_0x8d35('0xf')]){if(_0x25e48f['error'][_0x8d35('0x10')]===0x1f4){logger[_0x8d35('0xf')](_0x8d35('0xb'),_0x2e3190,_0x25e48f[_0x8d35('0xf')][_0x8d35('0x11')]);return _0x1ff55d(_0x25e48f[_0x8d35('0xf')]['message']);}logger['error'](_0x8d35('0xb'),_0x2e3190,_0x25e48f[_0x8d35('0xf')][_0x8d35('0x11')]);return _0x5242aa(_0x25e48f[_0x8d35('0xf')]['message']);}else{logger[_0x8d35('0x12')](_0x8d35('0xb'),_0x2e3190,'request\x20sent');_0x5242aa(_0x25e48f[_0x8d35('0x13')]['message']);}})[_0x8d35('0x14')](function(_0x414662){logger[_0x8d35('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x2e3190,_0x414662);_0x1ff55d(_0x414662);});});} \ No newline at end of file +var _0x6d38=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x130e28,_0x2a818c){var _0x53fde5=function(_0x35697e){while(--_0x35697e){_0x130e28['push'](_0x130e28['shift']());}};_0x53fde5(++_0x2a818c);}(_0x6d38,0x190));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x86d3('0x0'));var util=require(_0x86d3('0x1'));var moment=require(_0x86d3('0x2'));var BPromise=require(_0x86d3('0x3'));var rs=require(_0x86d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x5'))['db'];var utils=require(_0x86d3('0x6'));var logger=require(_0x86d3('0x7'))(_0x86d3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x9')][_0x86d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd5a611,_0x11604c,_0xecf85c){return new BPromise(function(_0x381db0,_0x100179){return client['request'](_0xd5a611,_0xecf85c)[_0x86d3('0xb')](function(_0x34e500){logger[_0x86d3('0xc')](_0x86d3('0xd'),_0x11604c,_0x86d3('0xe'));logger[_0x86d3('0xf')](_0x86d3('0x10'),_0x11604c,_0x86d3('0xe'),JSON[_0x86d3('0x11')](_0x34e500));if(_0x34e500['error']){if(_0x34e500[_0x86d3('0x12')][_0x86d3('0x13')]===0x1f4){logger['error'](_0x86d3('0xd'),_0x11604c,_0x34e500[_0x86d3('0x12')]['message']);return _0x100179(_0x34e500[_0x86d3('0x12')][_0x86d3('0x14')]);}logger['error'](_0x86d3('0xd'),_0x11604c,_0x34e500[_0x86d3('0x12')][_0x86d3('0x14')]);return _0x381db0(_0x34e500['error']['message']);}else{logger[_0x86d3('0xc')](_0x86d3('0xd'),_0x11604c,_0x86d3('0xe'));_0x381db0(_0x34e500[_0x86d3('0x15')][_0x86d3('0x14')]);}})[_0x86d3('0x16')](function(_0x5f02c3){logger['error'](_0x86d3('0xd'),_0x11604c,_0x5f02c3);_0x100179(_0x5f02c3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index cf2a77d..772bce7 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 _0x7b83=['./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','create','addConfiguration','/:id','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x22d218,_0x391757){var _0x7102c4=function(_0x53d987){while(--_0x53d987){_0x22d218['push'](_0x22d218['shift']());}};_0x7102c4(++_0x391757);}(_0x7b83,0xa1));var _0x37b8=function(_0x5c9f9c,_0x2193ed){_0x5c9f9c=_0x5c9f9c-0x0;var _0x20350a=_0x7b83[_0x5c9f9c];return _0x20350a;};'use strict';var multer=require(_0x37b8('0x0'));var util=require(_0x37b8('0x1'));var path=require(_0x37b8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x37b8('0x3')]();var fs_extra=require(_0x37b8('0x4'));var auth=require(_0x37b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x37b8('0x6'));var controller=require(_0x37b8('0x7'));router[_0x37b8('0x8')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xa')]);router[_0x37b8('0x8')]('/:id',auth[_0x37b8('0x9')](),controller[_0x37b8('0xb')]);router['get'](_0x37b8('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x37b8('0x9')](),controller[_0x37b8('0xd')]);router[_0x37b8('0xe')]('/',auth[_0x37b8('0x9')](),controller[_0x37b8('0xf')]);router['post'](_0x37b8('0xc'),auth['isAuthenticated'](),controller[_0x37b8('0x10')]);router['put'](_0x37b8('0x11'),auth[_0x37b8('0x9')](),controller[_0x37b8('0x12')]);router[_0x37b8('0x13')](_0x37b8('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x37b8('0x14')]=router; \ No newline at end of file +var _0xc31d=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x5398db,_0xd69970){var _0x7aeb65=function(_0x2536d4){while(--_0x2536d4){_0x5398db['push'](_0x5398db['shift']());}};_0x7aeb65(++_0xd69970);}(_0xc31d,0x124));var _0xdc31=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xc31d[_0x43d16c];return _0x208cce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdc31('0x0'));var timeout=require(_0xdc31('0x1'));var express=require('express');var router=express[_0xdc31('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdc31('0x3'));var interaction=require(_0xdc31('0x4'));var config=require(_0xdc31('0x5'));var controller=require(_0xdc31('0x6'));router[_0xdc31('0x7')]('/',auth[_0xdc31('0x8')](),controller[_0xdc31('0x9')]);router[_0xdc31('0x7')](_0xdc31('0xa'),auth[_0xdc31('0x8')](),controller['show']);router[_0xdc31('0x7')](_0xdc31('0xb'),auth[_0xdc31('0x8')](),controller[_0xdc31('0xc')]);router['get'](_0xdc31('0xd'),auth[_0xdc31('0x8')](),controller['getFields']);router[_0xdc31('0xe')]('/',auth[_0xdc31('0x8')](),controller['create']);router[_0xdc31('0xe')](_0xdc31('0xb'),auth[_0xdc31('0x8')](),controller[_0xdc31('0xf')]);router['put'](_0xdc31('0xa'),auth['isAuthenticated'](),controller[_0xdc31('0x10')]);router[_0xdc31('0x11')](_0xdc31('0xa'),auth[_0xdc31('0x8')](),controller[_0xdc31('0x12')]);module[_0xdc31('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index d25fcb8..f782d61 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 _0x6da4=['STRING','HelpDesk','sequelize','exports'];(function(_0x5bccd3,_0x4e2b7b){var _0x322dbc=function(_0x2f7b82){while(--_0x2f7b82){_0x5bccd3['push'](_0x5bccd3['shift']());}};_0x322dbc(++_0x4e2b7b);}(_0x6da4,0x116));var _0x46da=function(_0x3a25cf,_0x198b88){_0x3a25cf=_0x3a25cf-0x0;var _0x379207=_0x6da4[_0x3a25cf];return _0x379207;};'use strict';var Sequelize=require(_0x46da('0x0'));module[_0x46da('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x46da('0x2')]},'username':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x46da('0x3')},'remoteUri':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x46da('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x339f=['HelpDesk','exports','STRING'];(function(_0x501a08,_0x5da337){var _0x5b08d0=function(_0x3d228a){while(--_0x3d228a){_0x501a08['push'](_0x501a08['shift']());}};_0x5b08d0(++_0x5da337);}(_0x339f,0x15a));var _0xf339=function(_0x3c1573,_0x463df1){_0x3c1573=_0x3c1573-0x0;var _0x7d8839=_0x339f[_0x3c1573];return _0x7d8839;};'use strict';var Sequelize=require('sequelize');module[_0xf339('0x0')]={'name':{'type':Sequelize[_0xf339('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf339('0x1')],'allowNull':![],'defaultValue':_0xf339('0x2')},'remoteUri':{'type':Sequelize[_0xf339('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf339('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7482cf2..0ce7b16 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 _0x3d53=['catch','create','body','getConfigurations','findOne','VtigerConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','POST','login','token','success','describe','result','sessionName','autogenerated','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','error','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','count','set','Content-Range','apply','reject','update','destroy','then','end','sendStatus','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d53,0xae));var _0x33d5=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x3d53[_0x349148];return _0x2f2b0f;};'use strict';var emlformat=require(_0x33d5('0x0'));var rimraf=require(_0x33d5('0x1'));var zipdir=require(_0x33d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x33d5('0x4'));var util=require(_0x33d5('0x5'));var path=require(_0x33d5('0x6'));var sox=require('sox');var csv=require(_0x33d5('0x7'));var ejs=require(_0x33d5('0x8'));var fs=require('fs');var fs_extra=require(_0x33d5('0x9'));var _=require(_0x33d5('0xa'));var squel=require(_0x33d5('0xb'));var crypto=require(_0x33d5('0xc'));var jsforce=require(_0x33d5('0xd'));var deskjs=require(_0x33d5('0xe'));var toCsv=require(_0x33d5('0x7'));var querystring=require('querystring');var Papa=require(_0x33d5('0xf'));var Redis=require('ioredis');var authService=require(_0x33d5('0x10'));var qs=require(_0x33d5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33d5('0x12'));var logger=require(_0x33d5('0x13'))('api');var utils=require(_0x33d5('0x14'));var config=require(_0x33d5('0x15'));var licenseUtil=require(_0x33d5('0x16'));var db=require(_0x33d5('0x17'))['db'];var integrations=require(_0x33d5('0x18'));function respondWithStatusCode(_0x2745cc,_0x277acb){_0x277acb=_0x277acb||0xcc;return function(_0x1fa7ec){if(_0x1fa7ec){return _0x2745cc['sendStatus'](_0x277acb);}return _0x2745cc[_0x33d5('0x19')](_0x277acb)['end']();};}function respondWithResult(_0x1252e9,_0x259b66){_0x259b66=_0x259b66||0xc8;return function(_0x58388e){if(_0x58388e){return _0x1252e9[_0x33d5('0x19')](_0x259b66)[_0x33d5('0x1a')](_0x58388e);}};}function respondWithFilteredResult(_0x382a3f,_0x2c37dc){return function(_0x50f86c){if(_0x50f86c){var _0x422ad4=typeof _0x2c37dc[_0x33d5('0x1b')]==='undefined'&&typeof _0x2c37dc['limit']==='undefined';var _0x27df43=_0x50f86c[_0x33d5('0x1c')];var _0x2f659c=_0x422ad4?0x0:_0x2c37dc[_0x33d5('0x1b')];var _0x3bc7b5=_0x422ad4?_0x50f86c[_0x33d5('0x1c')]:_0x2c37dc[_0x33d5('0x1b')]+_0x2c37dc['limit'];var _0x44d186;if(_0x3bc7b5>=_0x27df43){_0x3bc7b5=_0x27df43;_0x44d186=0xc8;}else{_0x44d186=0xce;}_0x382a3f[_0x33d5('0x19')](_0x44d186);return _0x382a3f[_0x33d5('0x1d')](_0x33d5('0x1e'),_0x2f659c+'-'+_0x3bc7b5+'/'+_0x27df43)[_0x33d5('0x1a')](_0x50f86c);}return null;};}function patchUpdates(_0x27531f){return function(_0x256cbc){try{jsonpatch[_0x33d5('0x1f')](_0x256cbc,_0x27531f,!![]);}catch(_0x54385c){return BPromise[_0x33d5('0x20')](_0x54385c);}return _0x256cbc['save']();};}function saveUpdates(_0x25d49a,_0x2fbfa6){return function(_0x209665){if(_0x209665){return _0x209665[_0x33d5('0x21')](_0x25d49a)['then'](function(_0x19245b){return _0x19245b;});}return null;};}function removeEntity(_0x177ded,_0x53ab4c){return function(_0x24356e){if(_0x24356e){return _0x24356e[_0x33d5('0x22')]()[_0x33d5('0x23')](function(){_0x177ded['status'](0xcc)[_0x33d5('0x24')]();});}};}function handleEntityNotFound(_0x5871f6,_0x434708){return function(_0x37bac9){if(!_0x37bac9){_0x5871f6[_0x33d5('0x25')](0x194);}return _0x37bac9;};}function handleError(_0x3cfffb,_0x41ecdf){_0x41ecdf=_0x41ecdf||0x1f4;return function(_0x3a9c52){logger['error'](_0x3a9c52[_0x33d5('0x26')]);if(_0x3a9c52[_0x33d5('0x27')]){delete _0x3a9c52['name'];}_0x3cfffb[_0x33d5('0x19')](_0x41ecdf)[_0x33d5('0x28')](_0x3a9c52);};}exports[_0x33d5('0x29')]=function(_0xd43a55,_0x5c0c43){var _0x5259d1={},_0x414e41={},_0xc2ef95={'count':0x0,'rows':[]};var _0x55ae0d=_['map'](db[_0x33d5('0x2a')][_0x33d5('0x2b')],function(_0x41c4a8){return{'name':_0x41c4a8[_0x33d5('0x2c')],'type':_0x41c4a8[_0x33d5('0x2d')][_0x33d5('0x2e')]};});_0x414e41[_0x33d5('0x2f')]=_['map'](_0x55ae0d,_0x33d5('0x27'));_0x414e41['query']=_[_0x33d5('0x30')](_0xd43a55['query']);_0x414e41[_0x33d5('0x31')]=_[_0x33d5('0x32')](_0x414e41[_0x33d5('0x2f')],_0x414e41[_0x33d5('0x33')]);_0x5259d1[_0x33d5('0x34')]=_[_0x33d5('0x32')](_0x414e41[_0x33d5('0x2f')],qs[_0x33d5('0x35')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x35')]));_0x5259d1[_0x33d5('0x34')]=_0x5259d1['attributes'][_0x33d5('0x36')]?_0x5259d1[_0x33d5('0x34')]:_0x414e41['model'];if(!_0xd43a55[_0x33d5('0x33')][_0x33d5('0x37')](_0x33d5('0x38'))){_0x5259d1[_0x33d5('0x39')]=qs[_0x33d5('0x39')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x39')]);_0x5259d1[_0x33d5('0x1b')]=qs[_0x33d5('0x1b')](_0xd43a55[_0x33d5('0x33')][_0x33d5('0x1b')]);}_0x5259d1['order']=qs['sort'](_0xd43a55['query'][_0x33d5('0x3a')]);_0x5259d1['where']=qs[_0x33d5('0x31')](_[_0x33d5('0x3b')](_0xd43a55[_0x33d5('0x33')],_0x414e41[_0x33d5('0x31')]),_0x55ae0d);if(_0xd43a55['query']['filter']){_0x5259d1['where']=_['merge'](_0x5259d1[_0x33d5('0x3c')],{'$or':_[_0x33d5('0x3d')](_0x55ae0d,function(_0x46698d){if(_0x46698d[_0x33d5('0x2d')]!==_0x33d5('0x3e')){var _0x2647e2={};_0x2647e2[_0x46698d[_0x33d5('0x27')]]={'$like':'%'+_0xd43a55['query']['filter']+'%'};return _0x2647e2;}})});}_0x5259d1=_['merge']({},_0x5259d1,_0xd43a55[_0x33d5('0x3f')]);var _0x263a68={'where':_0x5259d1[_0x33d5('0x3c')]};return db[_0x33d5('0x2a')][_0x33d5('0x1c')](_0x263a68)[_0x33d5('0x23')](function(_0x1030e5){_0xc2ef95[_0x33d5('0x1c')]=_0x1030e5;if(_0xd43a55[_0x33d5('0x33')][_0x33d5('0x40')]){_0x5259d1[_0x33d5('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0x33d5('0x42')](_0x5259d1);})[_0x33d5('0x23')](function(_0xbe203e){_0xc2ef95[_0x33d5('0x43')]=_0xbe203e;return _0xc2ef95;})[_0x33d5('0x23')](respondWithFilteredResult(_0x5c0c43,_0x5259d1))['catch'](handleError(_0x5c0c43,null));};exports[_0x33d5('0x44')]=function(_0x40a9a2,_0x5080cc){var _0xcf77af={'raw':![],'where':{'id':_0x40a9a2[_0x33d5('0x45')]['id']}},_0x24e2dc={};_0x24e2dc[_0x33d5('0x2f')]=_[_0x33d5('0x30')](db[_0x33d5('0x2a')][_0x33d5('0x2b')]);_0x24e2dc['query']=_[_0x33d5('0x30')](_0x40a9a2[_0x33d5('0x33')]);_0x24e2dc['filters']=_[_0x33d5('0x32')](_0x24e2dc['model'],_0x24e2dc[_0x33d5('0x33')]);_0xcf77af['attributes']=_[_0x33d5('0x32')](_0x24e2dc[_0x33d5('0x2f')],qs['fields'](_0x40a9a2['query'][_0x33d5('0x35')]));_0xcf77af[_0x33d5('0x34')]=_0xcf77af[_0x33d5('0x34')][_0x33d5('0x36')]?_0xcf77af[_0x33d5('0x34')]:_0x24e2dc['model'];if(_0x40a9a2[_0x33d5('0x33')][_0x33d5('0x40')]){_0xcf77af[_0x33d5('0x41')]=[{'all':!![]}];}_0xcf77af=_[_0x33d5('0x46')]({},_0xcf77af,_0x40a9a2[_0x33d5('0x3f')]);return db[_0x33d5('0x2a')][_0x33d5('0x47')](_0xcf77af)['then'](handleEntityNotFound(_0x5080cc,null))[_0x33d5('0x23')](respondWithResult(_0x5080cc,null))[_0x33d5('0x48')](handleError(_0x5080cc,null));};exports['create']=function(_0x3d6cd2,_0x176060){return db['VtigerAccount'][_0x33d5('0x49')](_0x3d6cd2[_0x33d5('0x4a')],{})[_0x33d5('0x23')](respondWithResult(_0x176060,0xc9))[_0x33d5('0x48')](handleError(_0x176060,null));};exports[_0x33d5('0x21')]=function(_0x3e0a03,_0x2b4154){if(_0x3e0a03[_0x33d5('0x4a')]['id']){delete _0x3e0a03[_0x33d5('0x4a')]['id'];}return db['VtigerAccount'][_0x33d5('0x47')]({'where':{'id':_0x3e0a03[_0x33d5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b4154,null))[_0x33d5('0x23')](saveUpdates(_0x3e0a03[_0x33d5('0x4a')],null))[_0x33d5('0x23')](respondWithResult(_0x2b4154,null))[_0x33d5('0x48')](handleError(_0x2b4154,null));};exports[_0x33d5('0x22')]=function(_0x333ca1,_0x3d01c0){return db['VtigerAccount']['find']({'where':{'id':_0x333ca1[_0x33d5('0x45')]['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x3d01c0,null))['then'](removeEntity(_0x3d01c0,null))[_0x33d5('0x48')](handleError(_0x3d01c0,null));};exports[_0x33d5('0x4b')]=function(_0x480517,_0x445a3d,_0x4d6d4b){var _0x20ba5e={};var _0x5dcba9={};var _0x514b61;var _0x15aed3;return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x480517['params']['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x445a3d,null))[_0x33d5('0x23')](function(_0x109f6b){if(_0x109f6b){_0x514b61=_0x109f6b;_0x5dcba9[_0x33d5('0x2f')]=_[_0x33d5('0x30')](db[_0x33d5('0x4d')]['rawAttributes']);_0x5dcba9[_0x33d5('0x33')]=_['keys'](_0x480517[_0x33d5('0x33')]);_0x5dcba9[_0x33d5('0x31')]=_[_0x33d5('0x32')](_0x5dcba9['model'],_0x5dcba9[_0x33d5('0x33')]);_0x20ba5e[_0x33d5('0x34')]=_['intersection'](_0x5dcba9['model'],qs['fields'](_0x480517['query'][_0x33d5('0x35')]));_0x20ba5e['attributes']=_0x20ba5e[_0x33d5('0x34')][_0x33d5('0x36')]?_0x20ba5e['attributes']:_0x5dcba9['model'];_0x20ba5e[_0x33d5('0x4e')]=qs[_0x33d5('0x3a')](_0x480517[_0x33d5('0x33')][_0x33d5('0x3a')]);_0x20ba5e[_0x33d5('0x3c')]=qs[_0x33d5('0x31')](_[_0x33d5('0x3b')](_0x480517['query'],_0x5dcba9['filters']));if(_0x480517[_0x33d5('0x33')][_0x33d5('0x4f')]){_0x20ba5e[_0x33d5('0x3c')]=_[_0x33d5('0x46')](_0x20ba5e[_0x33d5('0x3c')],{'$or':_[_0x33d5('0x3d')](_0x20ba5e[_0x33d5('0x34')],function(_0x498552){var _0x21280e={};_0x21280e[_0x498552]={'$like':'%'+_0x480517[_0x33d5('0x33')][_0x33d5('0x4f')]+'%'};return _0x21280e;})});}_0x20ba5e=_[_0x33d5('0x46')]({},_0x20ba5e,_0x480517['options']);return _0x514b61[_0x33d5('0x4b')](_0x20ba5e);}})[_0x33d5('0x23')](function(_0x21165a){if(_0x21165a){_0x15aed3=_0x21165a[_0x33d5('0x36')];if(!_0x480517['query'][_0x33d5('0x37')](_0x33d5('0x38'))){_0x20ba5e[_0x33d5('0x39')]=qs[_0x33d5('0x39')](_0x480517['query'][_0x33d5('0x39')]);_0x20ba5e['offset']=qs[_0x33d5('0x1b')](_0x480517['query'][_0x33d5('0x1b')]);}return _0x514b61[_0x33d5('0x4b')](_0x20ba5e);}})[_0x33d5('0x23')](function(_0x43bd8a){if(_0x43bd8a){return _0x43bd8a?{'count':_0x15aed3,'rows':_0x43bd8a}:null;}})['then'](respondWithResult(_0x445a3d,null))[_0x33d5('0x48')](handleError(_0x445a3d,null));};exports[_0x33d5('0x50')]=function(_0x52c6f3,_0x3631c5,_0x55097d){if(_0x52c6f3['body']['id']){delete _0x52c6f3[_0x33d5('0x4a')]['id'];}return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x52c6f3['params']['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x3631c5,null))['then'](function(_0x5e4b04){if(_0x5e4b04){_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x51')]=_0x5e4b04['id'];_0x52c6f3['body'][_0x33d5('0x52')]=integrations[_0x33d5('0x53')](_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x54')],_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x2d')]);_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x55')]=integrations['getDescriptions'](_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x54')],_0x52c6f3[_0x33d5('0x4a')][_0x33d5('0x2d')]);return db[_0x33d5('0x4d')][_0x33d5('0x49')](_0x52c6f3[_0x33d5('0x4a')],{'include':[{'model':db[_0x33d5('0x56')],'as':_0x33d5('0x52')},{'model':db['VtigerField'],'as':_0x33d5('0x55')}]});}return null;})[_0x33d5('0x23')](respondWithResult(_0x3631c5,null))[_0x33d5('0x48')](handleError(_0x3631c5,null));};var md5=require(_0x33d5('0x57'));exports[_0x33d5('0x58')]=function(_0x32b8a3,_0x33befc,_0x54c39a){var _0x1a09f2=null;var _0x267ed3=null;var _0x5d4cad=null;var _0x208c0e=null;var _0x47354d='';return db[_0x33d5('0x2a')][_0x33d5('0x4c')]({'where':{'id':_0x32b8a3[_0x33d5('0x45')]['id']},'attributes':['id',_0x33d5('0x27'),_0x33d5('0x59'),'description',_0x33d5('0x5a'),_0x33d5('0x5b'),_0x33d5('0x5c'),_0x33d5('0x5d')]})['then'](handleEntityNotFound(_0x33befc,null))[_0x33d5('0x23')](function(_0x25e8f7){if(_0x25e8f7){_0x1a09f2=_0x25e8f7[_0x33d5('0x59')];_0x267ed3=_0x25e8f7['accessKey'];_0x5d4cad=_0x25e8f7['moduleName'];_0x47354d=_0x25e8f7[_0x33d5('0x5b')];var _0x2512fb=_0x47354d[_0x33d5('0x5e')](-0x1);if(_0x2512fb==='/'){_0x47354d=_0x47354d[_0x33d5('0x5f')](0x0,_0x47354d[_0x33d5('0x60')](_0x2512fb));}_0x208c0e=util[_0x33d5('0x61')](_0x33d5('0x62'),_0x47354d);var _0xc7f7ed={'method':'GET','uri':_0x208c0e,'qs':{'operation':'getchallenge','username':_0x25e8f7[_0x33d5('0x59')]},'json':!![]};return rp(_0xc7f7ed);}})[_0x33d5('0x23')](function(_0x2ee65c){if(_0x2ee65c['success']){var _0x807ee6={'method':_0x33d5('0x63'),'uri':_0x208c0e,'form':{'operation':_0x33d5('0x64'),'username':_0x1a09f2,'accessKey':md5(_0x2ee65c['result'][_0x33d5('0x65')]+_0x267ed3)},'json':!![]};return rp(_0x807ee6);}})[_0x33d5('0x23')](function(_0x3a1601){if(_0x3a1601[_0x33d5('0x66')]){var _0x335bcc={'method':'GET','uri':_0x208c0e,'qs':{'operation':_0x33d5('0x67'),'username':_0x1a09f2,'sessionName':_0x3a1601[_0x33d5('0x68')][_0x33d5('0x69')],'elementType':_0x5d4cad},'json':!![]};return rp(_0x335bcc);}})[_0x33d5('0x23')](function(_0x3b9287){if(_0x3b9287[_0x33d5('0x66')]){var _0x551bc4=[_0x33d5('0x6a'),'reference',_0x33d5('0x6b')];_['remove'](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x4ba864){return _0x551bc4[_0x33d5('0x6c')](_0x4ba864[_0x33d5('0x2d')][_0x33d5('0x27')]);});_[_0x33d5('0x6d')](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x1ff16b){return _0x1ff16b[_0x33d5('0x6e')]===_0x33d5('0x6f');});return{'count':_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')][_0x33d5('0x36')],'rows':_[_0x33d5('0x3d')](_0x3b9287[_0x33d5('0x68')][_0x33d5('0x35')],function(_0x5d2483){return{'id':_0x5d2483[_0x33d5('0x27')],'name':_0x5d2483[_0x33d5('0x70')],'custom':_[_0x33d5('0x71')](_0x5d2483[_0x33d5('0x27')],_0x33d5('0x72'))?!![]:![],'options':_0x5d2483[_0x33d5('0x2d')]['name']===_0x33d5('0x73')&&_0x5d2483['type'][_0x33d5('0x74')][_0x33d5('0x36')]>0x0?_[_0x33d5('0x3d')](_0x5d2483[_0x33d5('0x2d')][_0x33d5('0x74')],function(_0x23823f){return{'name':_0x23823f['label'],'value':_0x23823f['value']};}):[]};})};}})[_0x33d5('0x23')](respondWithResult(_0x33befc,null))[_0x33d5('0x48')](function(_0x4c3156){console[_0x33d5('0x75')](_0x33d5('0x76')+_0x4c3156);var _0x9eaee3=_0x32b8a3[_0x33d5('0x33')][_0x33d5('0x77')]?0x1f4:_0x4c3156['statusCode']||0x1f4;logger[_0x33d5('0x78')]('getFields,\x20%s,\x20%s,\x20%s',_0x33d5('0x58'),_0x9eaee3,JSON['stringify'](_0x4c3156));delete _0x4c3156['name'];if(_0x9eaee3===0x191){_0x9eaee3=0x190;}_0x33befc['status'](_0x9eaee3)[_0x33d5('0x28')](_0x32b8a3[_0x33d5('0x33')]['test']?{'message':_0x33d5('0x79'),'statusCode':_0x4c3156[_0x33d5('0x7a')]}:_0x4c3156);});}; \ No newline at end of file +var _0x57ef=['startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','keys','find','create','body','update','params','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','getDescriptions','channel','VtigerConfiguration','VtigerField','Descriptions','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','owner','editable','false','label'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x57ef,0x16e));var _0xf57e=function(_0x277d59,_0x3fd4bb){_0x277d59=_0x277d59-0x0;var _0x3418bf=_0x57ef[_0x277d59];return _0x3418bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf57e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf57e('0x1'));var rp=require(_0xf57e('0x2'));var moment=require(_0xf57e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf57e('0x4'));var util=require(_0xf57e('0x5'));var path=require(_0xf57e('0x6'));var sox=require(_0xf57e('0x7'));var csv=require(_0xf57e('0x8'));var ejs=require(_0xf57e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf57e('0xa'));var squel=require(_0xf57e('0xb'));var crypto=require(_0xf57e('0xc'));var jsforce=require(_0xf57e('0xd'));var deskjs=require(_0xf57e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf57e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf57e('0x10'));var authService=require(_0xf57e('0x11'));var qs=require(_0xf57e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57e('0x13'))(_0xf57e('0x14'));var utils=require(_0xf57e('0x15'));var config=require(_0xf57e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf57e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b5c44,_0x474fc3){_0x474fc3=_0x474fc3||0xcc;return function(_0x4cb299){if(_0x4cb299){return _0x1b5c44['sendStatus'](_0x474fc3);}return _0x1b5c44[_0xf57e('0x18')](_0x474fc3)['end']();};}function respondWithResult(_0x2cd3a6,_0x213f64){_0x213f64=_0x213f64||0xc8;return function(_0x6936a6){if(_0x6936a6){return _0x2cd3a6[_0xf57e('0x18')](_0x213f64)[_0xf57e('0x19')](_0x6936a6);}};}function respondWithFilteredResult(_0x577314,_0x169354){return function(_0x103352){if(_0x103352){var _0x51bed0=typeof _0x169354[_0xf57e('0x1a')]===_0xf57e('0x1b')&&typeof _0x169354['limit']===_0xf57e('0x1b');var _0x22f2ba=_0x103352[_0xf57e('0x1c')];var _0x30233c=_0x51bed0?0x0:_0x169354[_0xf57e('0x1a')];var _0x3cdb0c=_0x51bed0?_0x103352[_0xf57e('0x1c')]:_0x169354[_0xf57e('0x1a')]+_0x169354[_0xf57e('0x1d')];var _0x6331a5;if(_0x3cdb0c>=_0x22f2ba){_0x3cdb0c=_0x22f2ba;_0x6331a5=0xc8;}else{_0x6331a5=0xce;}_0x577314[_0xf57e('0x18')](_0x6331a5);return _0x577314[_0xf57e('0x1e')](_0xf57e('0x1f'),_0x30233c+'-'+_0x3cdb0c+'/'+_0x22f2ba)[_0xf57e('0x19')](_0x103352);}return null;};}function patchUpdates(_0x565e9c){return function(_0x404e76){try{jsonpatch['apply'](_0x404e76,_0x565e9c,!![]);}catch(_0xc313dc){return BPromise['reject'](_0xc313dc);}return _0x404e76['save']();};}function saveUpdates(_0x1fee37,_0x4f9b50){return function(_0x3ec113){if(_0x3ec113){return _0x3ec113['update'](_0x1fee37)[_0xf57e('0x20')](function(_0x1173ea){return _0x1173ea;});}return null;};}function removeEntity(_0x5f3aed,_0x50f716){return function(_0x2d5115){if(_0x2d5115){return _0x2d5115[_0xf57e('0x21')]()[_0xf57e('0x20')](function(){_0x5f3aed['status'](0xcc)[_0xf57e('0x22')]();});}};}function handleEntityNotFound(_0x3b8711,_0x12396a){return function(_0xd1200c){if(!_0xd1200c){_0x3b8711[_0xf57e('0x23')](0x194);}return _0xd1200c;};}function handleError(_0x270d1f,_0xebf942){_0xebf942=_0xebf942||0x1f4;return function(_0x252f6c){logger[_0xf57e('0x24')](_0x252f6c[_0xf57e('0x25')]);if(_0x252f6c[_0xf57e('0x26')]){delete _0x252f6c[_0xf57e('0x26')];}_0x270d1f['status'](_0xebf942)['send'](_0x252f6c);};}exports[_0xf57e('0x27')]=function(_0x26f7f1,_0x2df42e){var _0x5728b8={},_0x4e8038={},_0xc8b82f={'count':0x0,'rows':[]};var _0xe4aa79=_[_0xf57e('0x28')](db[_0xf57e('0x29')][_0xf57e('0x2a')],function(_0x10aca5){return{'name':_0x10aca5[_0xf57e('0x2b')],'type':_0x10aca5[_0xf57e('0x2c')][_0xf57e('0x2d')]};});_0x4e8038['model']=_[_0xf57e('0x28')](_0xe4aa79,_0xf57e('0x26'));_0x4e8038[_0xf57e('0x2e')]=_['keys'](_0x26f7f1[_0xf57e('0x2e')]);_0x4e8038[_0xf57e('0x2f')]=_['intersection'](_0x4e8038[_0xf57e('0x30')],_0x4e8038[_0xf57e('0x2e')]);_0x5728b8['attributes']=_[_0xf57e('0x31')](_0x4e8038['model'],qs[_0xf57e('0x32')](_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x32')]));_0x5728b8['attributes']=_0x5728b8['attributes'][_0xf57e('0x33')]?_0x5728b8[_0xf57e('0x34')]:_0x4e8038[_0xf57e('0x30')];if(!_0x26f7f1['query'][_0xf57e('0x35')]('nolimit')){_0x5728b8[_0xf57e('0x1d')]=qs[_0xf57e('0x1d')](_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x1d')]);_0x5728b8[_0xf57e('0x1a')]=qs[_0xf57e('0x1a')](_0x26f7f1[_0xf57e('0x2e')]['offset']);}_0x5728b8[_0xf57e('0x36')]=qs[_0xf57e('0x37')](_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x37')]);_0x5728b8[_0xf57e('0x38')]=qs[_0xf57e('0x2f')](_[_0xf57e('0x39')](_0x26f7f1['query'],_0x4e8038[_0xf57e('0x2f')]),_0xe4aa79);if(_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x3a')]){_0x5728b8['where']=_[_0xf57e('0x3b')](_0x5728b8[_0xf57e('0x38')],{'$or':_[_0xf57e('0x28')](_0xe4aa79,function(_0x376fef){if(_0x376fef['type']!=='VIRTUAL'){var _0x497b0c={};_0x497b0c[_0x376fef[_0xf57e('0x26')]]={'$like':'%'+_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x3a')]+'%'};return _0x497b0c;}})});}_0x5728b8=_[_0xf57e('0x3b')]({},_0x5728b8,_0x26f7f1[_0xf57e('0x3c')]);var _0x2915be={'where':_0x5728b8['where']};return db[_0xf57e('0x29')][_0xf57e('0x1c')](_0x2915be)[_0xf57e('0x20')](function(_0x34c403){_0xc8b82f[_0xf57e('0x1c')]=_0x34c403;if(_0x26f7f1[_0xf57e('0x2e')][_0xf57e('0x3d')]){_0x5728b8[_0xf57e('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0xf57e('0x3f')](_0x5728b8);})['then'](function(_0x53875f){_0xc8b82f['rows']=_0x53875f;return _0xc8b82f;})[_0xf57e('0x20')](respondWithFilteredResult(_0x2df42e,_0x5728b8))[_0xf57e('0x40')](handleError(_0x2df42e,null));};exports['show']=function(_0x35376c,_0x5b04e7){var _0xe3bdc2={'raw':![],'where':{'id':_0x35376c['params']['id']}},_0x21ef96={};_0x21ef96[_0xf57e('0x30')]=_[_0xf57e('0x41')](db[_0xf57e('0x29')][_0xf57e('0x2a')]);_0x21ef96['query']=_['keys'](_0x35376c[_0xf57e('0x2e')]);_0x21ef96[_0xf57e('0x2f')]=_['intersection'](_0x21ef96[_0xf57e('0x30')],_0x21ef96['query']);_0xe3bdc2[_0xf57e('0x34')]=_[_0xf57e('0x31')](_0x21ef96[_0xf57e('0x30')],qs[_0xf57e('0x32')](_0x35376c['query'][_0xf57e('0x32')]));_0xe3bdc2['attributes']=_0xe3bdc2[_0xf57e('0x34')][_0xf57e('0x33')]?_0xe3bdc2[_0xf57e('0x34')]:_0x21ef96[_0xf57e('0x30')];if(_0x35376c['query'][_0xf57e('0x3d')]){_0xe3bdc2[_0xf57e('0x3e')]=[{'all':!![]}];}_0xe3bdc2=_[_0xf57e('0x3b')]({},_0xe3bdc2,_0x35376c[_0xf57e('0x3c')]);return db['VtigerAccount'][_0xf57e('0x42')](_0xe3bdc2)[_0xf57e('0x20')](handleEntityNotFound(_0x5b04e7,null))[_0xf57e('0x20')](respondWithResult(_0x5b04e7,null))[_0xf57e('0x40')](handleError(_0x5b04e7,null));};exports[_0xf57e('0x43')]=function(_0x3977d6,_0xe0326f){return db['VtigerAccount']['create'](_0x3977d6[_0xf57e('0x44')],{})[_0xf57e('0x20')](respondWithResult(_0xe0326f,0xc9))[_0xf57e('0x40')](handleError(_0xe0326f,null));};exports[_0xf57e('0x45')]=function(_0x10fc05,_0x54faba){if(_0x10fc05['body']['id']){delete _0x10fc05[_0xf57e('0x44')]['id'];}return db[_0xf57e('0x29')][_0xf57e('0x42')]({'where':{'id':_0x10fc05[_0xf57e('0x46')]['id']}})[_0xf57e('0x20')](handleEntityNotFound(_0x54faba,null))[_0xf57e('0x20')](saveUpdates(_0x10fc05[_0xf57e('0x44')],null))[_0xf57e('0x20')](respondWithResult(_0x54faba,null))[_0xf57e('0x40')](handleError(_0x54faba,null));};exports[_0xf57e('0x21')]=function(_0x2bde0e,_0x16afb2){return db[_0xf57e('0x29')][_0xf57e('0x42')]({'where':{'id':_0x2bde0e['params']['id']}})[_0xf57e('0x20')](handleEntityNotFound(_0x16afb2,null))['then'](removeEntity(_0x16afb2,null))[_0xf57e('0x40')](handleError(_0x16afb2,null));};exports[_0xf57e('0x47')]=function(_0x2f55de,_0x2df562,_0xaa97a){var _0x32e155={};var _0x535a08={};var _0x54c8db;var _0x3ca7be;return db[_0xf57e('0x29')][_0xf57e('0x48')]({'where':{'id':_0x2f55de[_0xf57e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2df562,null))['then'](function(_0x5e7ca4){if(_0x5e7ca4){_0x54c8db=_0x5e7ca4;_0x535a08[_0xf57e('0x30')]=_[_0xf57e('0x41')](db['VtigerConfiguration'][_0xf57e('0x2a')]);_0x535a08[_0xf57e('0x2e')]=_['keys'](_0x2f55de[_0xf57e('0x2e')]);_0x535a08[_0xf57e('0x2f')]=_['intersection'](_0x535a08[_0xf57e('0x30')],_0x535a08['query']);_0x32e155[_0xf57e('0x34')]=_[_0xf57e('0x31')](_0x535a08[_0xf57e('0x30')],qs['fields'](_0x2f55de['query'][_0xf57e('0x32')]));_0x32e155[_0xf57e('0x34')]=_0x32e155['attributes'][_0xf57e('0x33')]?_0x32e155[_0xf57e('0x34')]:_0x535a08[_0xf57e('0x30')];_0x32e155[_0xf57e('0x36')]=qs['sort'](_0x2f55de[_0xf57e('0x2e')]['sort']);_0x32e155[_0xf57e('0x38')]=qs[_0xf57e('0x2f')](_['pick'](_0x2f55de[_0xf57e('0x2e')],_0x535a08[_0xf57e('0x2f')]));if(_0x2f55de[_0xf57e('0x2e')][_0xf57e('0x3a')]){_0x32e155[_0xf57e('0x38')]=_[_0xf57e('0x3b')](_0x32e155[_0xf57e('0x38')],{'$or':_[_0xf57e('0x28')](_0x32e155[_0xf57e('0x34')],function(_0x1af444){var _0x4a7c23={};_0x4a7c23[_0x1af444]={'$like':'%'+_0x2f55de['query'][_0xf57e('0x3a')]+'%'};return _0x4a7c23;})});}_0x32e155=_[_0xf57e('0x3b')]({},_0x32e155,_0x2f55de[_0xf57e('0x3c')]);return _0x54c8db['getConfigurations'](_0x32e155);}})['then'](function(_0x216ec1){if(_0x216ec1){_0x3ca7be=_0x216ec1[_0xf57e('0x33')];if(!_0x2f55de[_0xf57e('0x2e')]['hasOwnProperty']('nolimit')){_0x32e155[_0xf57e('0x1d')]=qs[_0xf57e('0x1d')](_0x2f55de[_0xf57e('0x2e')][_0xf57e('0x1d')]);_0x32e155[_0xf57e('0x1a')]=qs[_0xf57e('0x1a')](_0x2f55de[_0xf57e('0x2e')][_0xf57e('0x1a')]);}return _0x54c8db[_0xf57e('0x47')](_0x32e155);}})['then'](function(_0x46d805){if(_0x46d805){return _0x46d805?{'count':_0x3ca7be,'rows':_0x46d805}:null;}})[_0xf57e('0x20')](respondWithResult(_0x2df562,null))['catch'](handleError(_0x2df562,null));};exports[_0xf57e('0x49')]=function(_0x36f2fc,_0x40b2e7,_0x170eb4){if(_0x36f2fc['body']['id']){delete _0x36f2fc['body']['id'];}return db[_0xf57e('0x29')][_0xf57e('0x48')]({'where':{'id':_0x36f2fc[_0xf57e('0x46')]['id']}})[_0xf57e('0x20')](handleEntityNotFound(_0x40b2e7,null))[_0xf57e('0x20')](function(_0x292e5b){if(_0x292e5b){_0x36f2fc['body']['AccountId']=_0x292e5b['id'];_0x36f2fc['body'][_0xf57e('0x4a')]=integrations[_0xf57e('0x4b')](_0x36f2fc['body']['channel'],_0x36f2fc[_0xf57e('0x44')][_0xf57e('0x2c')]);_0x36f2fc[_0xf57e('0x44')]['Descriptions']=integrations[_0xf57e('0x4c')](_0x36f2fc[_0xf57e('0x44')][_0xf57e('0x4d')],_0x36f2fc[_0xf57e('0x44')][_0xf57e('0x2c')]);return db[_0xf57e('0x4e')][_0xf57e('0x43')](_0x36f2fc[_0xf57e('0x44')],{'include':[{'model':db[_0xf57e('0x4f')],'as':_0xf57e('0x4a')},{'model':db[_0xf57e('0x4f')],'as':_0xf57e('0x50')}]});}return null;})['then'](respondWithResult(_0x40b2e7,null))['catch'](handleError(_0x40b2e7,null));};var md5=require('md5');exports[_0xf57e('0x51')]=function(_0xf24601,_0x1bc9f3,_0x4c7549){var _0x48cfd6=null;var _0x3fb7ce=null;var _0x49079e=null;var _0x529091=null;var _0x5570d8='';return db[_0xf57e('0x29')][_0xf57e('0x48')]({'where':{'id':_0xf24601[_0xf57e('0x46')]['id']},'attributes':['id',_0xf57e('0x26'),_0xf57e('0x52'),_0xf57e('0x53'),_0xf57e('0x54'),'remoteUri','serverUrl',_0xf57e('0x55')]})[_0xf57e('0x20')](handleEntityNotFound(_0x1bc9f3,null))[_0xf57e('0x20')](function(_0x115dc8){if(_0x115dc8){_0x48cfd6=_0x115dc8['username'];_0x3fb7ce=_0x115dc8[_0xf57e('0x55')];_0x49079e=_0x115dc8['moduleName'];_0x5570d8=_0x115dc8[_0xf57e('0x56')];var _0x33a95f=_0x5570d8[_0xf57e('0x57')](-0x1);if(_0x33a95f==='/'){_0x5570d8=_0x5570d8[_0xf57e('0x58')](0x0,_0x5570d8[_0xf57e('0x59')](_0x33a95f));}_0x529091=util[_0xf57e('0x5a')](_0xf57e('0x5b'),_0x5570d8);var _0xe88698={'method':_0xf57e('0x5c'),'uri':_0x529091,'qs':{'operation':_0xf57e('0x5d'),'username':_0x115dc8[_0xf57e('0x52')]},'json':!![]};return rp(_0xe88698);}})[_0xf57e('0x20')](function(_0x58cdfa){if(_0x58cdfa[_0xf57e('0x5e')]){var _0x1e7cde={'method':_0xf57e('0x5f'),'uri':_0x529091,'form':{'operation':_0xf57e('0x60'),'username':_0x48cfd6,'accessKey':md5(_0x58cdfa[_0xf57e('0x61')][_0xf57e('0x62')]+_0x3fb7ce)},'json':!![]};return rp(_0x1e7cde);}})['then'](function(_0x4bccbc){if(_0x4bccbc[_0xf57e('0x5e')]){var _0x5a3b92={'method':_0xf57e('0x5c'),'uri':_0x529091,'qs':{'operation':_0xf57e('0x63'),'username':_0x48cfd6,'sessionName':_0x4bccbc[_0xf57e('0x61')][_0xf57e('0x64')],'elementType':_0x49079e},'json':!![]};return rp(_0x5a3b92);}})[_0xf57e('0x20')](function(_0x2e8a4c){if(_0x2e8a4c[_0xf57e('0x5e')]){var _0x30b007=[_0xf57e('0x65'),'reference',_0xf57e('0x66')];_['remove'](_0x2e8a4c[_0xf57e('0x61')][_0xf57e('0x32')],function(_0x9d1325){return _0x30b007['includes'](_0x9d1325[_0xf57e('0x2c')][_0xf57e('0x26')]);});_['remove'](_0x2e8a4c[_0xf57e('0x61')]['fields'],function(_0x38d9e4){return _0x38d9e4[_0xf57e('0x67')]===_0xf57e('0x68');});return{'count':_0x2e8a4c[_0xf57e('0x61')]['fields'][_0xf57e('0x33')],'rows':_[_0xf57e('0x28')](_0x2e8a4c[_0xf57e('0x61')][_0xf57e('0x32')],function(_0x1dae63){return{'id':_0x1dae63['name'],'name':_0x1dae63[_0xf57e('0x69')],'custom':_[_0xf57e('0x6a')](_0x1dae63[_0xf57e('0x26')],'cf_')?!![]:![],'options':_0x1dae63[_0xf57e('0x2c')][_0xf57e('0x26')]===_0xf57e('0x6b')&&_0x1dae63[_0xf57e('0x2c')][_0xf57e('0x6c')][_0xf57e('0x33')]>0x0?_[_0xf57e('0x28')](_0x1dae63[_0xf57e('0x2c')][_0xf57e('0x6c')],function(_0x29af80){return{'name':_0x29af80[_0xf57e('0x69')],'value':_0x29af80[_0xf57e('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x1bc9f3,null))[_0xf57e('0x40')](function(_0x1f105d){console[_0xf57e('0x6e')](_0xf57e('0x6f')+_0x1f105d);var _0x7ed779=_0xf24601[_0xf57e('0x2e')]['test']?0x1f4:_0x1f105d[_0xf57e('0x70')]||0x1f4;logger[_0xf57e('0x24')](_0xf57e('0x71'),_0xf57e('0x51'),_0x7ed779,JSON[_0xf57e('0x72')](_0x1f105d));delete _0x1f105d[_0xf57e('0x26')];if(_0x7ed779===0x191){_0x7ed779=0x190;}_0x1bc9f3[_0xf57e('0x18')](_0x7ed779)[_0xf57e('0x73')](_0xf24601[_0xf57e('0x2e')][_0xf57e('0x74')]?{'message':_0xf57e('0x75'),'statusCode':_0x1f105d[_0xf57e('0x70')]}:_0x1f105d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4d89903..7120c5e 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 _0xbf07=['../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','bluebird','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf07,0x17a));var _0x7bf0=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xbf07[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x7bf0('0x0'));var util=require('util');var logger=require(_0x7bf0('0x1'))(_0x7bf0('0x2'));var moment=require('moment');var BPromise=require(_0x7bf0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bf0('0x4'));var rimraf=require('rimraf');var config=require(_0x7bf0('0x5'));var attributes=require(_0x7bf0('0x6'));var integrations=require(_0x7bf0('0x7'));module['exports']=function(_0x218ce6,_0x40a20f){return _0x218ce6[_0x7bf0('0x8')](_0x7bf0('0x9'),attributes,{'tableName':_0x7bf0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c34=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x5c34,0x155));var _0x45c3=function(_0x3dcc3e,_0x1d4573){_0x3dcc3e=_0x3dcc3e-0x0;var _0x493631=_0x5c34[_0x3dcc3e];return _0x493631;};'use strict';var _=require('lodash');var util=require(_0x45c3('0x0'));var logger=require(_0x45c3('0x1'))('api');var moment=require(_0x45c3('0x2'));var BPromise=require(_0x45c3('0x3'));var rp=require(_0x45c3('0x4'));var fs=require('fs');var path=require(_0x45c3('0x5'));var rimraf=require('rimraf');var config=require(_0x45c3('0x6'));var attributes=require(_0x45c3('0x7'));var integrations=require(_0x45c3('0x8'));module[_0x45c3('0x9')]=function(_0x35a878,_0x445b6d){return _0x35a878[_0x45c3('0xa')](_0x45c3('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 502bbb5..5cbdb0f 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 _0xb62e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','include','model','map','attributes','then','find','ShowVtigerAccount','lodash','util','moment'];(function(_0x264e7f,_0x4b8f91){var _0x173e6e=function(_0x525cfc){while(--_0x525cfc){_0x264e7f['push'](_0x264e7f['shift']());}};_0x173e6e(++_0x4b8f91);}(_0xb62e,0x1de));var _0xeb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require(_0xeb62('0x6'));var logger=require(_0xeb62('0x7'))(_0xeb62('0x8'));var config=require(_0xeb62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb62('0xa')][_0xeb62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31f5ea,_0x5e0dc4,_0x2065a0){return new BPromise(function(_0xab7049,_0x1e10ae){return client[_0xeb62('0xc')](_0x31f5ea,_0x2065a0)['then'](function(_0x5cdef3){logger[_0xeb62('0xd')](_0xeb62('0xe'),_0x5e0dc4,_0xeb62('0xf'));logger[_0xeb62('0x10')](_0xeb62('0x11'),_0x5e0dc4,_0xeb62('0xf'),JSON[_0xeb62('0x12')](_0x5cdef3));if(_0x5cdef3[_0xeb62('0x13')]){if(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x14')]===0x1f4){logger['error'](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);return _0x1e10ae(_0x5cdef3[_0xeb62('0x13')]['message']);}logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x5cdef3[_0xeb62('0x13')]['message']);return _0xab7049(_0x5cdef3[_0xeb62('0x13')][_0xeb62('0x15')]);}else{logger[_0xeb62('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x5e0dc4,_0xeb62('0xf'));_0xab7049(_0x5cdef3[_0xeb62('0x16')][_0xeb62('0x15')]);}})[_0xeb62('0x17')](function(_0x3fb280){logger[_0xeb62('0x13')](_0xeb62('0xe'),_0x5e0dc4,_0x3fb280);_0x1e10ae(_0x3fb280);});});}exports[_0xeb62('0x18')]=function(_0x39b138){var _0x27fd84=this;return new Promise(function(_0x27efc8,_0x11d516){return db[_0xeb62('0x19')]['findAll']({'raw':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1b')]===undefined?!![]:![]:!![],'where':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1c')]||null:null,'attributes':_0x39b138[_0xeb62('0x1a')]?_0x39b138['options']['attributes']||null:null,'limit':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1d')]||null:null,'include':_0x39b138[_0xeb62('0x1a')]?_0x39b138[_0xeb62('0x1a')]['include']?_['map'](_0x39b138[_0xeb62('0x1a')][_0xeb62('0x1e')],function(_0x182781){return{'model':db[_0x182781[_0xeb62('0x1f')]],'as':_0x182781['as'],'attributes':_0x182781['attributes'],'include':_0x182781['include']?_[_0xeb62('0x20')](_0x182781['include'],function(_0x448327){return{'model':db[_0x448327['model']],'as':_0x448327['as'],'attributes':_0x448327[_0xeb62('0x21')],'include':_0x448327['include']?_[_0xeb62('0x20')](_0x448327[_0xeb62('0x1e')],function(_0x46d1bb){return{'model':db[_0x46d1bb['model']],'as':_0x46d1bb['as'],'attributes':_0x46d1bb[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x5222f4){logger[_0xeb62('0xd')](_0xeb62('0x18'),_0x39b138);logger[_0xeb62('0x10')]('GetVtigerAccount',_0x39b138,JSON[_0xeb62('0x12')](_0x5222f4));_0x27efc8(_0x5222f4);})[_0xeb62('0x17')](function(_0x57169a){logger[_0xeb62('0x13')](_0xeb62('0x18'),_0x57169a[_0xeb62('0x15')],_0x39b138);_0x11d516(_0x27fd84[_0xeb62('0x13')](0x1f4,_0x57169a[_0xeb62('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x4b58af){var _0x1248bb=this;return new Promise(function(_0x357cf4,_0x1607ef){return db[_0xeb62('0x19')][_0xeb62('0x23')]({'raw':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options']['where']||null:null,'attributes':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af[_0xeb62('0x1a')]['attributes']||null:null,'include':_0x4b58af[_0xeb62('0x1a')]?_0x4b58af['options'][_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0x4b58af['options'][_0xeb62('0x1e')],function(_0xe2589){return{'model':db[_0xe2589['model']],'as':_0xe2589['as'],'attributes':_0xe2589[_0xeb62('0x21')],'include':_0xe2589[_0xeb62('0x1e')]?_[_0xeb62('0x20')](_0xe2589[_0xeb62('0x1e')],function(_0x513dd8){return{'model':db[_0x513dd8[_0xeb62('0x1f')]],'as':_0x513dd8['as'],'attributes':_0x513dd8[_0xeb62('0x21')],'include':_0x513dd8['include']?_['map'](_0x513dd8[_0xeb62('0x1e')],function(_0x117d8c){return{'model':db[_0x117d8c['model']],'as':_0x117d8c['as'],'attributes':_0x117d8c[_0xeb62('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x22')](function(_0x11eadb){logger[_0xeb62('0xd')](_0xeb62('0x24'),_0x4b58af);logger[_0xeb62('0x10')](_0xeb62('0x24'),_0x4b58af,JSON['stringify'](_0x11eadb));_0x357cf4(_0x11eadb);})['catch'](function(_0x3306e3){logger[_0xeb62('0x13')](_0xeb62('0x24'),_0x3306e3[_0xeb62('0x15')],_0x4b58af);_0x1607ef(_0x1248bb['error'](0x1f4,_0x3306e3[_0xeb62('0x15')]));});});}; \ No newline at end of file +var _0x3f8c=['jayson/promise','client','http','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','where','attributes','limit','include','map','model','debug','catch','find','raw','ShowVtigerAccount','moment','bluebird','randomstring','ioredis'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x3f8c,0x104));var _0xc3f8=function(_0x50b367,_0x557048){_0x50b367=_0x50b367-0x0;var _0x32a1ff=_0x3f8c[_0x50b367];return _0x32a1ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')]({'raw':_0x2e7c0f['options']?_0x2e7c0f[_0xc3f8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x16')]||null:null,'attributes':_0x2e7c0f['options']?_0x2e7c0f['options'][_0xc3f8('0x17')]||null:null,'limit':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x18')]||null:null,'include':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f[_0xc3f8('0x15')][_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2e7c0f['options']['include'],function(_0x4b83f0){return{'model':db[_0x4b83f0[_0xc3f8('0x1b')]],'as':_0x4b83f0['as'],'attributes':_0x4b83f0['attributes'],'include':_0x4b83f0[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4b83f0['include'],function(_0x4569c2){return{'model':db[_0x4569c2[_0xc3f8('0x1b')]],'as':_0x4569c2['as'],'attributes':_0x4569c2[_0xc3f8('0x17')],'include':_0x4569c2[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x4569c2[_0xc3f8('0x19')],function(_0xf1d460){return{'model':db[_0xf1d460[_0xc3f8('0x1b')]],'as':_0xf1d460['as'],'attributes':_0xf1d460[_0xc3f8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x22c8e6){logger[_0xc3f8('0x9')](_0xc3f8('0x12'),_0x2e7c0f);logger[_0xc3f8('0x1c')]('GetVtigerAccount',_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x22c8e6));_0xb4ab67(_0x22c8e6);})[_0xc3f8('0x1d')](function(_0x218029){logger['error'](_0xc3f8('0x12'),_0x218029['message'],_0x2e7c0f);_0x47a185(_0x35500f[_0xc3f8('0xe')](0x1f4,_0x218029[_0xc3f8('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x48b32e){var _0x21a225=this;return new Promise(function(_0x25df65,_0xd32b09){return db[_0xc3f8('0x13')][_0xc3f8('0x1e')]({'raw':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['where']||null:null,'attributes':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x17')]||null:null,'include':_0x48b32e[_0xc3f8('0x15')]?_0x48b32e[_0xc3f8('0x15')]['include']?_['map'](_0x48b32e[_0xc3f8('0x15')][_0xc3f8('0x19')],function(_0x76ef00){return{'model':db[_0x76ef00[_0xc3f8('0x1b')]],'as':_0x76ef00['as'],'attributes':_0x76ef00[_0xc3f8('0x17')],'include':_0x76ef00['include']?_[_0xc3f8('0x1a')](_0x76ef00[_0xc3f8('0x19')],function(_0x2ba6aa){return{'model':db[_0x2ba6aa['model']],'as':_0x2ba6aa['as'],'attributes':_0x2ba6aa[_0xc3f8('0x17')],'include':_0x2ba6aa[_0xc3f8('0x19')]?_[_0xc3f8('0x1a')](_0x2ba6aa['include'],function(_0x21a725){return{'model':db[_0x21a725[_0xc3f8('0x1b')]],'as':_0x21a725['as'],'attributes':_0x21a725['attributes']};}):[]};}):[]};}):[]:[]})[_0xc3f8('0x8')](function(_0x84d5d2){logger[_0xc3f8('0x9')](_0xc3f8('0x20'),_0x48b32e);logger[_0xc3f8('0x1c')](_0xc3f8('0x20'),_0x48b32e,JSON['stringify'](_0x84d5d2));_0x25df65(_0x84d5d2);})[_0xc3f8('0x1d')](function(_0x2e4880){logger[_0xc3f8('0xe')](_0xc3f8('0x20'),_0x2e4880[_0xc3f8('0x10')],_0x48b32e);_0xd32b09(_0x21a225['error'](0x1f4,_0x2e4880[_0xc3f8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7241109..2cb4eae 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 _0x614b=['update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x4ccbaf,_0x405225){var _0x2e49d9=function(_0x13d3af){while(--_0x13d3af){_0x4ccbaf['push'](_0x4ccbaf['shift']());}};_0x2e49d9(++_0x405225);}(_0x614b,0x179));var _0xb614=function(_0x2cb4cc,_0x1042c9){_0x2cb4cc=_0x2cb4cc-0x0;var _0x54bca9=_0x614b[_0x2cb4cc];return _0x54bca9;};'use strict';var multer=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var path=require(_0xb614('0x2'));var timeout=require(_0xb614('0x3'));var express=require(_0xb614('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb614('0x5'));var config=require(_0xb614('0x6'));var controller=require('./intVtigerConfiguration.controller');router[_0xb614('0x7')]('/',auth['isAuthenticated'](),controller[_0xb614('0x8')]);router[_0xb614('0x7')]('/:id',auth[_0xb614('0x9')](),controller['show']);router[_0xb614('0x7')](_0xb614('0xa'),auth[_0xb614('0x9')](),controller['getFields']);router[_0xb614('0x7')](_0xb614('0xb'),auth[_0xb614('0x9')](),controller[_0xb614('0xc')]);router['get'](_0xb614('0xd'),auth[_0xb614('0x9')](),controller[_0xb614('0xe')]);router[_0xb614('0xf')]('/',auth[_0xb614('0x9')](),controller[_0xb614('0x10')]);router[_0xb614('0x11')](_0xb614('0x12'),auth[_0xb614('0x9')](),controller[_0xb614('0x13')]);router[_0xb614('0x14')](_0xb614('0x12'),auth[_0xb614('0x9')](),controller[_0xb614('0x15')]);module['exports']=router; \ No newline at end of file +var _0x70a0=['/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x70a0,0x186));var _0x070a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x70a0[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x070a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x070a('0x1'));var router=express[_0x070a('0x2')]();var fs_extra=require(_0x070a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x070a('0x4'));var config=require(_0x070a('0x5'));var controller=require(_0x070a('0x6'));router[_0x070a('0x7')]('/',auth[_0x070a('0x8')](),controller[_0x070a('0x9')]);router[_0x070a('0x7')](_0x070a('0xa'),auth['isAuthenticated'](),controller[_0x070a('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x070a('0xc')]);router['get']('/:id/subjects',auth[_0x070a('0x8')](),controller[_0x070a('0xd')]);router[_0x070a('0x7')](_0x070a('0xe'),auth[_0x070a('0x8')](),controller[_0x070a('0xf')]);router[_0x070a('0x10')]('/',auth[_0x070a('0x8')](),controller['create']);router[_0x070a('0x11')](_0x070a('0xa'),auth[_0x070a('0x8')](),controller['update']);router[_0x070a('0x12')](_0x070a('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x070a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 93a7fac..61acb68 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 _0x1b41=['STRING','sequelize'];(function(_0x41e3e5,_0x441240){var _0x4b5b5c=function(_0x5b988a){while(--_0x5b988a){_0x41e3e5['push'](_0x41e3e5['shift']());}};_0x4b5b5c(++_0x441240);}(_0x1b41,0x161));var _0x11b4=function(_0x3541e4,_0x4dcf9a){_0x3541e4=_0x3541e4-0x0;var _0x3ca5d9=_0x1b41[_0x3541e4];return _0x3ca5d9;};'use strict';var Sequelize=require(_0x11b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x11b4('0x1')]},'description':{'type':Sequelize[_0x11b4('0x1')]}}; \ No newline at end of file +var _0xc2ba=['sequelize','exports','STRING'];(function(_0x2aa47b,_0x2d19f0){var _0x4b05d5=function(_0xe6e71){while(--_0xe6e71){_0x2aa47b['push'](_0x2aa47b['shift']());}};_0x4b05d5(++_0x2d19f0);}(_0xc2ba,0xbd));var _0xac2b=function(_0x211fac,_0x24ac07){_0x211fac=_0x211fac-0x0;var _0x8622cf=_0xc2ba[_0x211fac];return _0x8622cf;};'use strict';var Sequelize=require(_0xac2b('0x0'));module[_0xac2b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 44ff6dc..39483ad 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 _0x731f=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','getFields','findOne','VtigerField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','then','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model'];(function(_0x4fe870,_0x1c4346){var _0x3a47a1=function(_0x1d560c){while(--_0x1d560c){_0x4fe870['push'](_0x4fe870['shift']());}};_0x3a47a1(++_0x1c4346);}(_0x731f,0xc3));var _0xf731=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x731f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf731('0x0'));var rimraf=require(_0xf731('0x1'));var zipdir=require(_0xf731('0x2'));var jsonpatch=require(_0xf731('0x3'));var rp=require(_0xf731('0x4'));var moment=require(_0xf731('0x5'));var BPromise=require(_0xf731('0x6'));var Mustache=require(_0xf731('0x7'));var util=require('util');var path=require(_0xf731('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(_0xf731('0x9'));var squel=require(_0xf731('0xa'));var crypto=require('crypto');var jsforce=require(_0xf731('0xb'));var deskjs=require(_0xf731('0xc'));var toCsv=require(_0xf731('0xd'));var querystring=require(_0xf731('0xe'));var Papa=require(_0xf731('0xf'));var Redis=require(_0xf731('0x10'));var authService=require(_0xf731('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf731('0x12'));var logger=require(_0xf731('0x13'))(_0xf731('0x14'));var utils=require(_0xf731('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf731('0x16'));var db=require(_0xf731('0x17'))['db'];function respondWithStatusCode(_0x3e1815,_0x59cc33){_0x59cc33=_0x59cc33||0xcc;return function(_0x2a8272){if(_0x2a8272){return _0x3e1815[_0xf731('0x18')](_0x59cc33);}return _0x3e1815['status'](_0x59cc33)[_0xf731('0x19')]();};}function respondWithResult(_0x326dc8,_0x31aa9f){_0x31aa9f=_0x31aa9f||0xc8;return function(_0x2a9992){if(_0x2a9992){return _0x326dc8['status'](_0x31aa9f)[_0xf731('0x1a')](_0x2a9992);}};}function respondWithFilteredResult(_0x1ee818,_0x4e597f){return function(_0x2742a8){if(_0x2742a8){var _0x2eb274=typeof _0x4e597f[_0xf731('0x1b')]===_0xf731('0x1c')&&typeof _0x4e597f[_0xf731('0x1d')]==='undefined';var _0x5ba9a2=_0x2742a8[_0xf731('0x1e')];var _0x4d62fe=_0x2eb274?0x0:_0x4e597f[_0xf731('0x1b')];var _0x176538=_0x2eb274?_0x2742a8[_0xf731('0x1e')]:_0x4e597f['offset']+_0x4e597f['limit'];var _0x16fd77;if(_0x176538>=_0x5ba9a2){_0x176538=_0x5ba9a2;_0x16fd77=0xc8;}else{_0x16fd77=0xce;}_0x1ee818[_0xf731('0x1f')](_0x16fd77);return _0x1ee818['set'](_0xf731('0x20'),_0x4d62fe+'-'+_0x176538+'/'+_0x5ba9a2)['json'](_0x2742a8);}return null;};}function patchUpdates(_0x39e180){return function(_0x371f18){try{jsonpatch[_0xf731('0x21')](_0x371f18,_0x39e180,!![]);}catch(_0x4a2892){return BPromise[_0xf731('0x22')](_0x4a2892);}return _0x371f18[_0xf731('0x23')]();};}function saveUpdates(_0x44b6dd,_0x15d471){return function(_0x5d4239){if(_0x5d4239){return _0x5d4239['update'](_0x44b6dd)[_0xf731('0x24')](function(_0x473075){return _0x473075;});}return null;};}function removeEntity(_0xcd2927,_0x3abce6){return function(_0x2d852a){if(_0x2d852a){return _0x2d852a['destroy']()['then'](function(){_0xcd2927['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x549f45,_0x4961d6){return function(_0x5c4e2d){if(!_0x5c4e2d){_0x549f45['sendStatus'](0x194);}return _0x5c4e2d;};}function handleError(_0x369053,_0x29fabb){_0x29fabb=_0x29fabb||0x1f4;return function(_0x26a133){logger[_0xf731('0x25')](_0x26a133[_0xf731('0x26')]);if(_0x26a133[_0xf731('0x27')]){delete _0x26a133['name'];}_0x369053[_0xf731('0x1f')](_0x29fabb)['send'](_0x26a133);};}exports[_0xf731('0x28')]=function(_0x298d32,_0x86ab19){var _0x496c2e={},_0xecba96={},_0x8bff57={'count':0x0,'rows':[]};var _0x147ca8=_[_0xf731('0x29')](db[_0xf731('0x2a')][_0xf731('0x2b')],function(_0x2e9774){return{'name':_0x2e9774[_0xf731('0x2c')],'type':_0x2e9774[_0xf731('0x2d')][_0xf731('0x2e')]};});_0xecba96[_0xf731('0x2f')]=_[_0xf731('0x29')](_0x147ca8,_0xf731('0x27'));_0xecba96['query']=_[_0xf731('0x30')](_0x298d32[_0xf731('0x31')]);_0xecba96[_0xf731('0x32')]=_[_0xf731('0x33')](_0xecba96['model'],_0xecba96['query']);_0x496c2e[_0xf731('0x34')]=_[_0xf731('0x33')](_0xecba96[_0xf731('0x2f')],qs['fields'](_0x298d32['query'][_0xf731('0x35')]));_0x496c2e[_0xf731('0x34')]=_0x496c2e[_0xf731('0x34')][_0xf731('0x36')]?_0x496c2e[_0xf731('0x34')]:_0xecba96[_0xf731('0x2f')];if(!_0x298d32[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x496c2e[_0xf731('0x1d')]=qs[_0xf731('0x1d')](_0x298d32[_0xf731('0x31')][_0xf731('0x1d')]);_0x496c2e[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x298d32[_0xf731('0x31')][_0xf731('0x1b')]);}_0x496c2e[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x298d32[_0xf731('0x31')][_0xf731('0x3a')]);_0x496c2e[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x298d32[_0xf731('0x31')],_0xecba96[_0xf731('0x32')]),_0x147ca8);if(_0x298d32[_0xf731('0x31')]['filter']){_0x496c2e[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x496c2e[_0xf731('0x3b')],{'$or':_[_0xf731('0x29')](_0x147ca8,function(_0x1491b2){if(_0x1491b2[_0xf731('0x2d')]!=='VIRTUAL'){var _0x4f0b20={};_0x4f0b20[_0x1491b2[_0xf731('0x27')]]={'$like':'%'+_0x298d32[_0xf731('0x31')]['filter']+'%'};return _0x4f0b20;}})});}_0x496c2e=_[_0xf731('0x3d')]({},_0x496c2e,_0x298d32[_0xf731('0x3e')]);var _0x4cf07c={'where':_0x496c2e[_0xf731('0x3b')]};return db[_0xf731('0x2a')][_0xf731('0x1e')](_0x4cf07c)[_0xf731('0x24')](function(_0x298328){_0x8bff57[_0xf731('0x1e')]=_0x298328;if(_0x298d32[_0xf731('0x31')]['includeAll']){_0x496c2e[_0xf731('0x3f')]=[{'all':!![]}];}return db[_0xf731('0x2a')][_0xf731('0x40')](_0x496c2e);})[_0xf731('0x24')](function(_0x443b74){_0x8bff57[_0xf731('0x41')]=_0x443b74;return _0x8bff57;})['then'](respondWithFilteredResult(_0x86ab19,_0x496c2e))[_0xf731('0x42')](handleError(_0x86ab19,null));};exports[_0xf731('0x43')]=function(_0x582ad6,_0x51c399){var _0x46dd99={'raw':![],'where':{'id':_0x582ad6[_0xf731('0x44')]['id']}},_0x4d81e8={};_0x4d81e8[_0xf731('0x2f')]=_[_0xf731('0x30')](db['VtigerConfiguration'][_0xf731('0x2b')]);_0x4d81e8[_0xf731('0x31')]=_[_0xf731('0x30')](_0x582ad6[_0xf731('0x31')]);_0x4d81e8[_0xf731('0x32')]=_[_0xf731('0x33')](_0x4d81e8[_0xf731('0x2f')],_0x4d81e8['query']);_0x46dd99[_0xf731('0x34')]=_[_0xf731('0x33')](_0x4d81e8[_0xf731('0x2f')],qs[_0xf731('0x35')](_0x582ad6['query']['fields']));_0x46dd99[_0xf731('0x34')]=_0x46dd99[_0xf731('0x34')][_0xf731('0x36')]?_0x46dd99[_0xf731('0x34')]:_0x4d81e8[_0xf731('0x2f')];if(_0x582ad6[_0xf731('0x31')][_0xf731('0x45')]){_0x46dd99[_0xf731('0x3f')]=[{'all':!![]}];}_0x46dd99=_[_0xf731('0x3d')]({},_0x46dd99,_0x582ad6['options']);return db[_0xf731('0x2a')][_0xf731('0x46')](_0x46dd99)[_0xf731('0x24')](handleEntityNotFound(_0x51c399,null))[_0xf731('0x24')](respondWithResult(_0x51c399,null))[_0xf731('0x42')](handleError(_0x51c399,null));};exports[_0xf731('0x47')]=function(_0x23b5bc,_0x3326eb){return db[_0xf731('0x2a')]['create'](_0x23b5bc[_0xf731('0x48')],{})[_0xf731('0x24')](respondWithResult(_0x3326eb,0xc9))[_0xf731('0x42')](handleError(_0x3326eb,null));};exports[_0xf731('0x49')]=function(_0x360127,_0x5c0d97){if(_0x360127[_0xf731('0x48')]['id']){delete _0x360127[_0xf731('0x48')]['id'];}return db[_0xf731('0x2a')]['find']({'where':{'id':_0x360127[_0xf731('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c0d97,null))[_0xf731('0x24')](saveUpdates(_0x360127[_0xf731('0x48')],null))[_0xf731('0x24')](respondWithResult(_0x5c0d97,null))[_0xf731('0x42')](handleError(_0x5c0d97,null));};exports[_0xf731('0x4a')]=function(_0x1a0e19,_0x519d24){return db[_0xf731('0x2a')][_0xf731('0x46')]({'where':{'id':_0x1a0e19[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x519d24,null))[_0xf731('0x24')](removeEntity(_0x519d24,null))[_0xf731('0x42')](handleError(_0x519d24,null));};exports[_0xf731('0x4b')]=function(_0x80bbb3,_0x24d9de,_0x4fb292){var _0x21c10f={};var _0x4c4ba3={};var _0x2b17b6;var _0x1a16b3;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x80bbb3[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x24d9de,null))[_0xf731('0x24')](function(_0x96288e){if(_0x96288e){_0x2b17b6=_0x96288e;_0x4c4ba3['model']=_[_0xf731('0x30')](db[_0xf731('0x4d')][_0xf731('0x2b')]);_0x4c4ba3[_0xf731('0x31')]=_[_0xf731('0x30')](_0x80bbb3[_0xf731('0x31')]);_0x4c4ba3[_0xf731('0x32')]=_[_0xf731('0x33')](_0x4c4ba3[_0xf731('0x2f')],_0x4c4ba3[_0xf731('0x31')]);_0x21c10f['attributes']=_[_0xf731('0x33')](_0x4c4ba3['model'],qs[_0xf731('0x35')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x35')]));_0x21c10f[_0xf731('0x34')]=_0x21c10f['attributes'][_0xf731('0x36')]?_0x21c10f[_0xf731('0x34')]:_0x4c4ba3[_0xf731('0x2f')];_0x21c10f[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x3a')]);_0x21c10f[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x80bbb3[_0xf731('0x31')],_0x4c4ba3[_0xf731('0x32')]));if(_0x80bbb3[_0xf731('0x31')][_0xf731('0x4e')]){_0x21c10f[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x21c10f[_0xf731('0x3b')],{'$or':_['map'](_0x21c10f[_0xf731('0x34')],function(_0x59ed1a){var _0x585eb8={};_0x585eb8[_0x59ed1a]={'$like':'%'+_0x80bbb3[_0xf731('0x31')]['filter']+'%'};return _0x585eb8;})});}_0x21c10f=_[_0xf731('0x3d')]({},_0x21c10f,_0x80bbb3[_0xf731('0x3e')]);return _0x2b17b6[_0xf731('0x4b')](_0x21c10f);}})[_0xf731('0x24')](function(_0x5beffa){if(_0x5beffa){_0x1a16b3=_0x5beffa[_0xf731('0x36')];if(!_0x80bbb3[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x21c10f[_0xf731('0x1d')]=qs[_0xf731('0x1d')](_0x80bbb3['query'][_0xf731('0x1d')]);_0x21c10f['offset']=qs[_0xf731('0x1b')](_0x80bbb3[_0xf731('0x31')][_0xf731('0x1b')]);}return _0x2b17b6[_0xf731('0x4b')](_0x21c10f);}})[_0xf731('0x24')](function(_0x4f911b){if(_0x4f911b){return _0x4f911b?{'count':_0x1a16b3,'rows':_0x4f911b}:null;}})['then'](respondWithResult(_0x24d9de,null))[_0xf731('0x42')](handleError(_0x24d9de,null));};exports[_0xf731('0x4f')]=function(_0x2b3422,_0x30f76f,_0x1671d4){var _0x11c9e9={};var _0x337903={};var _0x33e9c6;var _0x5367cc;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x2b3422[_0xf731('0x44')]['id']}})[_0xf731('0x24')](handleEntityNotFound(_0x30f76f,null))[_0xf731('0x24')](function(_0x2d11aa){if(_0x2d11aa){_0x33e9c6=_0x2d11aa;_0x337903[_0xf731('0x2f')]=_[_0xf731('0x30')](db[_0xf731('0x4d')]['rawAttributes']);_0x337903[_0xf731('0x31')]=_[_0xf731('0x30')](_0x2b3422[_0xf731('0x31')]);_0x337903['filters']=_['intersection'](_0x337903[_0xf731('0x2f')],_0x337903['query']);_0x11c9e9[_0xf731('0x34')]=_[_0xf731('0x33')](_0x337903['model'],qs[_0xf731('0x35')](_0x2b3422[_0xf731('0x31')][_0xf731('0x35')]));_0x11c9e9[_0xf731('0x34')]=_0x11c9e9['attributes'][_0xf731('0x36')]?_0x11c9e9[_0xf731('0x34')]:_0x337903[_0xf731('0x2f')];_0x11c9e9[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x2b3422[_0xf731('0x31')][_0xf731('0x3a')]);_0x11c9e9['where']=qs[_0xf731('0x32')](_['pick'](_0x2b3422[_0xf731('0x31')],_0x337903[_0xf731('0x32')]));if(_0x2b3422[_0xf731('0x31')]['filter']){_0x11c9e9[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x11c9e9[_0xf731('0x3b')],{'$or':_['map'](_0x11c9e9['attributes'],function(_0x1789ce){var _0x54d4e3={};_0x54d4e3[_0x1789ce]={'$like':'%'+_0x2b3422[_0xf731('0x31')][_0xf731('0x4e')]+'%'};return _0x54d4e3;})});}_0x11c9e9=_[_0xf731('0x3d')]({},_0x11c9e9,_0x2b3422[_0xf731('0x3e')]);return _0x33e9c6[_0xf731('0x4f')](_0x11c9e9);}})[_0xf731('0x24')](function(_0xcda418){if(_0xcda418){_0x5367cc=_0xcda418[_0xf731('0x36')];if(!_0x2b3422[_0xf731('0x31')][_0xf731('0x37')](_0xf731('0x38'))){_0x11c9e9[_0xf731('0x1d')]=qs['limit'](_0x2b3422['query']['limit']);_0x11c9e9[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x2b3422[_0xf731('0x31')][_0xf731('0x1b')]);}return _0x33e9c6[_0xf731('0x4f')](_0x11c9e9);}})[_0xf731('0x24')](function(_0x29f674){if(_0x29f674){return _0x29f674?{'count':_0x5367cc,'rows':_0x29f674}:null;}})['then'](respondWithResult(_0x30f76f,null))[_0xf731('0x42')](handleError(_0x30f76f,null));};exports[_0xf731('0x50')]=function(_0x3de8f4,_0x4c2ad6,_0x7bc359){var _0x5e8b8b={};var _0x56dd0c={};var _0xdae656;var _0xfc620b;return db[_0xf731('0x2a')][_0xf731('0x4c')]({'where':{'id':_0x3de8f4[_0xf731('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c2ad6,null))[_0xf731('0x24')](function(_0x15ff1d){if(_0x15ff1d){_0xdae656=_0x15ff1d;_0x56dd0c[_0xf731('0x2f')]=_[_0xf731('0x30')](db['VtigerField'][_0xf731('0x2b')]);_0x56dd0c[_0xf731('0x31')]=_['keys'](_0x3de8f4[_0xf731('0x31')]);_0x56dd0c[_0xf731('0x32')]=_[_0xf731('0x33')](_0x56dd0c[_0xf731('0x2f')],_0x56dd0c['query']);_0x5e8b8b[_0xf731('0x34')]=_['intersection'](_0x56dd0c[_0xf731('0x2f')],qs[_0xf731('0x35')](_0x3de8f4[_0xf731('0x31')]['fields']));_0x5e8b8b[_0xf731('0x34')]=_0x5e8b8b[_0xf731('0x34')][_0xf731('0x36')]?_0x5e8b8b[_0xf731('0x34')]:_0x56dd0c['model'];_0x5e8b8b[_0xf731('0x39')]=qs[_0xf731('0x3a')](_0x3de8f4[_0xf731('0x31')]['sort']);_0x5e8b8b[_0xf731('0x3b')]=qs[_0xf731('0x32')](_[_0xf731('0x3c')](_0x3de8f4['query'],_0x56dd0c[_0xf731('0x32')]));if(_0x3de8f4[_0xf731('0x31')][_0xf731('0x4e')]){_0x5e8b8b[_0xf731('0x3b')]=_[_0xf731('0x3d')](_0x5e8b8b[_0xf731('0x3b')],{'$or':_[_0xf731('0x29')](_0x5e8b8b['attributes'],function(_0x1216b3){var _0x54809e={};_0x54809e[_0x1216b3]={'$like':'%'+_0x3de8f4[_0xf731('0x31')][_0xf731('0x4e')]+'%'};return _0x54809e;})});}_0x5e8b8b=_[_0xf731('0x3d')]({},_0x5e8b8b,_0x3de8f4[_0xf731('0x3e')]);return _0xdae656[_0xf731('0x50')](_0x5e8b8b);}})['then'](function(_0x401aac){if(_0x401aac){_0xfc620b=_0x401aac[_0xf731('0x36')];if(!_0x3de8f4['query'][_0xf731('0x37')](_0xf731('0x38'))){_0x5e8b8b['limit']=qs['limit'](_0x3de8f4[_0xf731('0x31')][_0xf731('0x1d')]);_0x5e8b8b[_0xf731('0x1b')]=qs[_0xf731('0x1b')](_0x3de8f4[_0xf731('0x31')][_0xf731('0x1b')]);}return _0xdae656[_0xf731('0x50')](_0x5e8b8b);}})[_0xf731('0x24')](function(_0x37f71b){if(_0x37f71b){return _0x37f71b?{'count':_0xfc620b,'rows':_0x37f71b}:null;}})['then'](respondWithResult(_0x4c2ad6,null))['catch'](handleError(_0x4c2ad6,null));}; \ No newline at end of file +var _0x69b0=['sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','then','error','stack','name','send','index','VtigerConfiguration','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','include','find','create','body','update','params','destroy','getFields','findOne','VtigerField','rawAttributes','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','fs-extra','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'];(function(_0x1658c6,_0x12e1fe){var _0x5353a2=function(_0xd00d63){while(--_0xd00d63){_0x1658c6['push'](_0x1658c6['shift']());}};_0x5353a2(++_0x12e1fe);}(_0x69b0,0x170));var _0x069b=function(_0x3c6b20,_0x315702){_0x3c6b20=_0x3c6b20-0x0;var _0x5d6849=_0x69b0[_0x3c6b20];return _0x5d6849;};'use strict';var emlformat=require(_0x069b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x069b('0x1'));var jsonpatch=require(_0x069b('0x2'));var rp=require(_0x069b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x069b('0x4'));var util=require(_0x069b('0x5'));var path=require('path');var sox=require(_0x069b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x069b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x069b('0x8'));var jsforce=require(_0x069b('0x9'));var deskjs=require(_0x069b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x069b('0xb'));var Papa=require('papaparse');var Redis=require(_0x069b('0xc'));var authService=require(_0x069b('0xd'));var qs=require(_0x069b('0xe'));var as=require(_0x069b('0xf'));var hardwareService=require(_0x069b('0x10'));var logger=require(_0x069b('0x11'))(_0x069b('0x12'));var utils=require('../../config/utils');var config=require(_0x069b('0x13'));var licenseUtil=require(_0x069b('0x14'));var db=require(_0x069b('0x15'))['db'];function respondWithStatusCode(_0x58863b,_0x2d7cd3){_0x2d7cd3=_0x2d7cd3||0xcc;return function(_0x1dc072){if(_0x1dc072){return _0x58863b[_0x069b('0x16')](_0x2d7cd3);}return _0x58863b['status'](_0x2d7cd3)[_0x069b('0x17')]();};}function respondWithResult(_0x2919e,_0x151dee){_0x151dee=_0x151dee||0xc8;return function(_0x10d6f9){if(_0x10d6f9){return _0x2919e['status'](_0x151dee)[_0x069b('0x18')](_0x10d6f9);}};}function respondWithFilteredResult(_0x57e253,_0x19e029){return function(_0x29766d){if(_0x29766d){var _0x52de45=typeof _0x19e029[_0x069b('0x19')]===_0x069b('0x1a')&&typeof _0x19e029[_0x069b('0x1b')]===_0x069b('0x1a');var _0x2df77c=_0x29766d[_0x069b('0x1c')];var _0x239ffe=_0x52de45?0x0:_0x19e029[_0x069b('0x19')];var _0xc7a5a5=_0x52de45?_0x29766d[_0x069b('0x1c')]:_0x19e029['offset']+_0x19e029[_0x069b('0x1b')];var _0x14dcb3;if(_0xc7a5a5>=_0x2df77c){_0xc7a5a5=_0x2df77c;_0x14dcb3=0xc8;}else{_0x14dcb3=0xce;}_0x57e253[_0x069b('0x1d')](_0x14dcb3);return _0x57e253[_0x069b('0x1e')]('Content-Range',_0x239ffe+'-'+_0xc7a5a5+'/'+_0x2df77c)[_0x069b('0x18')](_0x29766d);}return null;};}function patchUpdates(_0x1838cb){return function(_0x3457e5){try{jsonpatch[_0x069b('0x1f')](_0x3457e5,_0x1838cb,!![]);}catch(_0xa2440c){return BPromise['reject'](_0xa2440c);}return _0x3457e5[_0x069b('0x20')]();};}function saveUpdates(_0x79c5a0,_0x582558){return function(_0x13bb45){if(_0x13bb45){return _0x13bb45['update'](_0x79c5a0)[_0x069b('0x21')](function(_0x1653bd){return _0x1653bd;});}return null;};}function removeEntity(_0x913437,_0x527b50){return function(_0x175aae){if(_0x175aae){return _0x175aae['destroy']()[_0x069b('0x21')](function(){_0x913437[_0x069b('0x1d')](0xcc)[_0x069b('0x17')]();});}};}function handleEntityNotFound(_0x53cbab,_0x1e6314){return function(_0x53440c){if(!_0x53440c){_0x53cbab['sendStatus'](0x194);}return _0x53440c;};}function handleError(_0x3c76ee,_0x2fc129){_0x2fc129=_0x2fc129||0x1f4;return function(_0x2e9fb3){logger[_0x069b('0x22')](_0x2e9fb3[_0x069b('0x23')]);if(_0x2e9fb3[_0x069b('0x24')]){delete _0x2e9fb3['name'];}_0x3c76ee['status'](_0x2fc129)[_0x069b('0x25')](_0x2e9fb3);};}exports[_0x069b('0x26')]=function(_0x19c4ae,_0x2ca49e){var _0x4edaec={},_0x1b5d52={},_0x394dec={'count':0x0,'rows':[]};var _0x2308ca=_['map'](db[_0x069b('0x27')]['rawAttributes'],function(_0x3c372e){return{'name':_0x3c372e[_0x069b('0x28')],'type':_0x3c372e[_0x069b('0x29')][_0x069b('0x2a')]};});_0x1b5d52[_0x069b('0x2b')]=_[_0x069b('0x2c')](_0x2308ca,'name');_0x1b5d52[_0x069b('0x2d')]=_[_0x069b('0x2e')](_0x19c4ae[_0x069b('0x2d')]);_0x1b5d52[_0x069b('0x2f')]=_['intersection'](_0x1b5d52[_0x069b('0x2b')],_0x1b5d52[_0x069b('0x2d')]);_0x4edaec[_0x069b('0x30')]=_[_0x069b('0x31')](_0x1b5d52[_0x069b('0x2b')],qs['fields'](_0x19c4ae['query'][_0x069b('0x32')]));_0x4edaec[_0x069b('0x30')]=_0x4edaec[_0x069b('0x30')][_0x069b('0x33')]?_0x4edaec[_0x069b('0x30')]:_0x1b5d52[_0x069b('0x2b')];if(!_0x19c4ae[_0x069b('0x2d')]['hasOwnProperty']('nolimit')){_0x4edaec['limit']=qs[_0x069b('0x1b')](_0x19c4ae[_0x069b('0x2d')][_0x069b('0x1b')]);_0x4edaec['offset']=qs[_0x069b('0x19')](_0x19c4ae[_0x069b('0x2d')][_0x069b('0x19')]);}_0x4edaec[_0x069b('0x34')]=qs[_0x069b('0x35')](_0x19c4ae['query'][_0x069b('0x35')]);_0x4edaec[_0x069b('0x36')]=qs['filters'](_[_0x069b('0x37')](_0x19c4ae['query'],_0x1b5d52[_0x069b('0x2f')]),_0x2308ca);if(_0x19c4ae[_0x069b('0x2d')]['filter']){_0x4edaec[_0x069b('0x36')]=_[_0x069b('0x38')](_0x4edaec['where'],{'$or':_[_0x069b('0x2c')](_0x2308ca,function(_0xd6fca4){if(_0xd6fca4[_0x069b('0x29')]!==_0x069b('0x39')){var _0x14f387={};_0x14f387[_0xd6fca4[_0x069b('0x24')]]={'$like':'%'+_0x19c4ae[_0x069b('0x2d')][_0x069b('0x3a')]+'%'};return _0x14f387;}})});}_0x4edaec=_[_0x069b('0x38')]({},_0x4edaec,_0x19c4ae[_0x069b('0x3b')]);var _0x5c128a={'where':_0x4edaec['where']};return db[_0x069b('0x27')]['count'](_0x5c128a)[_0x069b('0x21')](function(_0x43b421){_0x394dec[_0x069b('0x1c')]=_0x43b421;if(_0x19c4ae[_0x069b('0x2d')][_0x069b('0x3c')]){_0x4edaec['include']=[{'all':!![]}];}return db[_0x069b('0x27')]['findAll'](_0x4edaec);})['then'](function(_0x133dfc){_0x394dec[_0x069b('0x3d')]=_0x133dfc;return _0x394dec;})[_0x069b('0x21')](respondWithFilteredResult(_0x2ca49e,_0x4edaec))[_0x069b('0x3e')](handleError(_0x2ca49e,null));};exports['show']=function(_0x1d6e20,_0x269182){var _0x5569e5={'raw':![],'where':{'id':_0x1d6e20['params']['id']}},_0x1ffacf={};_0x1ffacf[_0x069b('0x2b')]=_[_0x069b('0x2e')](db[_0x069b('0x27')]['rawAttributes']);_0x1ffacf[_0x069b('0x2d')]=_[_0x069b('0x2e')](_0x1d6e20[_0x069b('0x2d')]);_0x1ffacf[_0x069b('0x2f')]=_[_0x069b('0x31')](_0x1ffacf['model'],_0x1ffacf[_0x069b('0x2d')]);_0x5569e5[_0x069b('0x30')]=_['intersection'](_0x1ffacf[_0x069b('0x2b')],qs['fields'](_0x1d6e20[_0x069b('0x2d')][_0x069b('0x32')]));_0x5569e5[_0x069b('0x30')]=_0x5569e5[_0x069b('0x30')]['length']?_0x5569e5[_0x069b('0x30')]:_0x1ffacf[_0x069b('0x2b')];if(_0x1d6e20['query'][_0x069b('0x3c')]){_0x5569e5[_0x069b('0x3f')]=[{'all':!![]}];}_0x5569e5=_[_0x069b('0x38')]({},_0x5569e5,_0x1d6e20[_0x069b('0x3b')]);return db['VtigerConfiguration'][_0x069b('0x40')](_0x5569e5)[_0x069b('0x21')](handleEntityNotFound(_0x269182,null))[_0x069b('0x21')](respondWithResult(_0x269182,null))['catch'](handleError(_0x269182,null));};exports[_0x069b('0x41')]=function(_0x501cd4,_0x55f4d2){return db[_0x069b('0x27')]['create'](_0x501cd4[_0x069b('0x42')],{})['then'](respondWithResult(_0x55f4d2,0xc9))[_0x069b('0x3e')](handleError(_0x55f4d2,null));};exports[_0x069b('0x43')]=function(_0x411d81,_0x384342){if(_0x411d81['body']['id']){delete _0x411d81[_0x069b('0x42')]['id'];}return db[_0x069b('0x27')]['find']({'where':{'id':_0x411d81[_0x069b('0x44')]['id']}})[_0x069b('0x21')](handleEntityNotFound(_0x384342,null))[_0x069b('0x21')](saveUpdates(_0x411d81[_0x069b('0x42')],null))['then'](respondWithResult(_0x384342,null))[_0x069b('0x3e')](handleError(_0x384342,null));};exports[_0x069b('0x45')]=function(_0x16f487,_0xf9e25d){return db[_0x069b('0x27')]['find']({'where':{'id':_0x16f487['params']['id']}})[_0x069b('0x21')](handleEntityNotFound(_0xf9e25d,null))[_0x069b('0x21')](removeEntity(_0xf9e25d,null))[_0x069b('0x3e')](handleError(_0xf9e25d,null));};exports[_0x069b('0x46')]=function(_0x24cc31,_0x97d81,_0x4eea3d){var _0x33735b={};var _0x5dadba={};var _0x23312c;var _0x96a396;return db['VtigerConfiguration'][_0x069b('0x47')]({'where':{'id':_0x24cc31[_0x069b('0x44')]['id']}})[_0x069b('0x21')](handleEntityNotFound(_0x97d81,null))[_0x069b('0x21')](function(_0x3d6650){if(_0x3d6650){_0x23312c=_0x3d6650;_0x5dadba['model']=_['keys'](db[_0x069b('0x48')][_0x069b('0x49')]);_0x5dadba[_0x069b('0x2d')]=_[_0x069b('0x2e')](_0x24cc31[_0x069b('0x2d')]);_0x5dadba[_0x069b('0x2f')]=_[_0x069b('0x31')](_0x5dadba[_0x069b('0x2b')],_0x5dadba['query']);_0x33735b[_0x069b('0x30')]=_['intersection'](_0x5dadba[_0x069b('0x2b')],qs[_0x069b('0x32')](_0x24cc31[_0x069b('0x2d')][_0x069b('0x32')]));_0x33735b[_0x069b('0x30')]=_0x33735b[_0x069b('0x30')][_0x069b('0x33')]?_0x33735b[_0x069b('0x30')]:_0x5dadba[_0x069b('0x2b')];_0x33735b['order']=qs[_0x069b('0x35')](_0x24cc31[_0x069b('0x2d')][_0x069b('0x35')]);_0x33735b['where']=qs[_0x069b('0x2f')](_[_0x069b('0x37')](_0x24cc31[_0x069b('0x2d')],_0x5dadba[_0x069b('0x2f')]));if(_0x24cc31[_0x069b('0x2d')][_0x069b('0x3a')]){_0x33735b[_0x069b('0x36')]=_['merge'](_0x33735b[_0x069b('0x36')],{'$or':_[_0x069b('0x2c')](_0x33735b[_0x069b('0x30')],function(_0x2a4afb){var _0x64757f={};_0x64757f[_0x2a4afb]={'$like':'%'+_0x24cc31[_0x069b('0x2d')][_0x069b('0x3a')]+'%'};return _0x64757f;})});}_0x33735b=_['merge']({},_0x33735b,_0x24cc31[_0x069b('0x3b')]);return _0x23312c[_0x069b('0x46')](_0x33735b);}})['then'](function(_0x571183){if(_0x571183){_0x96a396=_0x571183[_0x069b('0x33')];if(!_0x24cc31[_0x069b('0x2d')]['hasOwnProperty'](_0x069b('0x4a'))){_0x33735b[_0x069b('0x1b')]=qs[_0x069b('0x1b')](_0x24cc31['query'][_0x069b('0x1b')]);_0x33735b['offset']=qs['offset'](_0x24cc31[_0x069b('0x2d')][_0x069b('0x19')]);}return _0x23312c[_0x069b('0x46')](_0x33735b);}})[_0x069b('0x21')](function(_0x339891){if(_0x339891){return _0x339891?{'count':_0x96a396,'rows':_0x339891}:null;}})[_0x069b('0x21')](respondWithResult(_0x97d81,null))['catch'](handleError(_0x97d81,null));};exports[_0x069b('0x4b')]=function(_0x6c0659,_0x5e16b2,_0x524129){var _0x27dfe7={};var _0x304bf6={};var _0x5d220c;var _0x3b47f6;return db[_0x069b('0x27')][_0x069b('0x47')]({'where':{'id':_0x6c0659[_0x069b('0x44')]['id']}})[_0x069b('0x21')](handleEntityNotFound(_0x5e16b2,null))[_0x069b('0x21')](function(_0x23f590){if(_0x23f590){_0x5d220c=_0x23f590;_0x304bf6[_0x069b('0x2b')]=_['keys'](db[_0x069b('0x48')][_0x069b('0x49')]);_0x304bf6[_0x069b('0x2d')]=_[_0x069b('0x2e')](_0x6c0659[_0x069b('0x2d')]);_0x304bf6['filters']=_['intersection'](_0x304bf6[_0x069b('0x2b')],_0x304bf6[_0x069b('0x2d')]);_0x27dfe7[_0x069b('0x30')]=_[_0x069b('0x31')](_0x304bf6[_0x069b('0x2b')],qs[_0x069b('0x32')](_0x6c0659[_0x069b('0x2d')][_0x069b('0x32')]));_0x27dfe7['attributes']=_0x27dfe7['attributes'][_0x069b('0x33')]?_0x27dfe7[_0x069b('0x30')]:_0x304bf6['model'];_0x27dfe7['order']=qs[_0x069b('0x35')](_0x6c0659[_0x069b('0x2d')][_0x069b('0x35')]);_0x27dfe7[_0x069b('0x36')]=qs[_0x069b('0x2f')](_[_0x069b('0x37')](_0x6c0659[_0x069b('0x2d')],_0x304bf6['filters']));if(_0x6c0659[_0x069b('0x2d')]['filter']){_0x27dfe7[_0x069b('0x36')]=_['merge'](_0x27dfe7['where'],{'$or':_[_0x069b('0x2c')](_0x27dfe7[_0x069b('0x30')],function(_0x28708a){var _0x2b91a1={};_0x2b91a1[_0x28708a]={'$like':'%'+_0x6c0659[_0x069b('0x2d')]['filter']+'%'};return _0x2b91a1;})});}_0x27dfe7=_[_0x069b('0x38')]({},_0x27dfe7,_0x6c0659[_0x069b('0x3b')]);return _0x5d220c['getSubjects'](_0x27dfe7);}})['then'](function(_0x637744){if(_0x637744){_0x3b47f6=_0x637744[_0x069b('0x33')];if(!_0x6c0659['query'][_0x069b('0x4c')](_0x069b('0x4a'))){_0x27dfe7[_0x069b('0x1b')]=qs[_0x069b('0x1b')](_0x6c0659['query'][_0x069b('0x1b')]);_0x27dfe7['offset']=qs[_0x069b('0x19')](_0x6c0659[_0x069b('0x2d')]['offset']);}return _0x5d220c['getSubjects'](_0x27dfe7);}})[_0x069b('0x21')](function(_0x43a8ee){if(_0x43a8ee){return _0x43a8ee?{'count':_0x3b47f6,'rows':_0x43a8ee}:null;}})[_0x069b('0x21')](respondWithResult(_0x5e16b2,null))[_0x069b('0x3e')](handleError(_0x5e16b2,null));};exports[_0x069b('0x4d')]=function(_0x5556a1,_0x54b74a,_0x384b1d){var _0xf125dd={};var _0x49dd9d={};var _0x4dc045;var _0x500902;return db[_0x069b('0x27')][_0x069b('0x47')]({'where':{'id':_0x5556a1[_0x069b('0x44')]['id']}})[_0x069b('0x21')](handleEntityNotFound(_0x54b74a,null))[_0x069b('0x21')](function(_0x1f0ace){if(_0x1f0ace){_0x4dc045=_0x1f0ace;_0x49dd9d[_0x069b('0x2b')]=_[_0x069b('0x2e')](db[_0x069b('0x48')][_0x069b('0x49')]);_0x49dd9d[_0x069b('0x2d')]=_[_0x069b('0x2e')](_0x5556a1['query']);_0x49dd9d[_0x069b('0x2f')]=_['intersection'](_0x49dd9d['model'],_0x49dd9d['query']);_0xf125dd[_0x069b('0x30')]=_[_0x069b('0x31')](_0x49dd9d['model'],qs[_0x069b('0x32')](_0x5556a1[_0x069b('0x2d')][_0x069b('0x32')]));_0xf125dd['attributes']=_0xf125dd[_0x069b('0x30')][_0x069b('0x33')]?_0xf125dd[_0x069b('0x30')]:_0x49dd9d[_0x069b('0x2b')];_0xf125dd[_0x069b('0x34')]=qs[_0x069b('0x35')](_0x5556a1['query']['sort']);_0xf125dd['where']=qs[_0x069b('0x2f')](_[_0x069b('0x37')](_0x5556a1[_0x069b('0x2d')],_0x49dd9d['filters']));if(_0x5556a1['query']['filter']){_0xf125dd[_0x069b('0x36')]=_[_0x069b('0x38')](_0xf125dd[_0x069b('0x36')],{'$or':_[_0x069b('0x2c')](_0xf125dd[_0x069b('0x30')],function(_0x401532){var _0x1847e2={};_0x1847e2[_0x401532]={'$like':'%'+_0x5556a1[_0x069b('0x2d')][_0x069b('0x3a')]+'%'};return _0x1847e2;})});}_0xf125dd=_['merge']({},_0xf125dd,_0x5556a1[_0x069b('0x3b')]);return _0x4dc045[_0x069b('0x4d')](_0xf125dd);}})[_0x069b('0x21')](function(_0x280142){if(_0x280142){_0x500902=_0x280142[_0x069b('0x33')];if(!_0x5556a1[_0x069b('0x2d')][_0x069b('0x4c')](_0x069b('0x4a'))){_0xf125dd[_0x069b('0x1b')]=qs['limit'](_0x5556a1['query'][_0x069b('0x1b')]);_0xf125dd[_0x069b('0x19')]=qs['offset'](_0x5556a1[_0x069b('0x2d')][_0x069b('0x19')]);}return _0x4dc045[_0x069b('0x4d')](_0xf125dd);}})[_0x069b('0x21')](function(_0x51e1f6){if(_0x51e1f6){return _0x51e1f6?{'count':_0x500902,'rows':_0x51e1f6}:null;}})['then'](respondWithResult(_0x54b74a,null))[_0x069b('0x3e')](handleError(_0x54b74a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1e794f2..9ce33b2 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 _0x65f6=['VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define'];(function(_0x56fcdd,_0xd2662f){var _0xf5674=function(_0x36313e){while(--_0x36313e){_0x56fcdd['push'](_0x56fcdd['shift']());}};_0xf5674(++_0xd2662f);}(_0x65f6,0x147));var _0x665f=function(_0x4cd6e2,_0x31cf56){_0x4cd6e2=_0x4cd6e2-0x0;var _0x3a310b=_0x65f6[_0x4cd6e2];return _0x3a310b;};'use strict';var _=require('lodash');var util=require(_0x665f('0x0'));var logger=require(_0x665f('0x1'))(_0x665f('0x2'));var moment=require(_0x665f('0x3'));var BPromise=require(_0x665f('0x4'));var rp=require(_0x665f('0x5'));var fs=require('fs');var path=require(_0x665f('0x6'));var rimraf=require(_0x665f('0x7'));var config=require(_0x665f('0x8'));var attributes=require(_0x665f('0x9'));module['exports']=function(_0x2f9270,_0x2cfda7){return _0x2f9270[_0x665f('0xa')](_0x665f('0xb'),attributes,{'tableName':_0x665f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6e2=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x451c0a,_0x46c5e2){var _0x3fcdc2=function(_0x497adf){while(--_0x497adf){_0x451c0a['push'](_0x451c0a['shift']());}};_0x3fcdc2(++_0x46c5e2);}(_0xb6e2,0x154));var _0x2b6e=function(_0x32c049,_0x17ca70){_0x32c049=_0x32c049-0x0;var _0x3c68a7=_0xb6e2[_0x32c049];return _0x3c68a7;};'use strict';var _=require(_0x2b6e('0x0'));var util=require(_0x2b6e('0x1'));var logger=require(_0x2b6e('0x2'))(_0x2b6e('0x3'));var moment=require(_0x2b6e('0x4'));var BPromise=require(_0x2b6e('0x5'));var rp=require(_0x2b6e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b6e('0x7'));var config=require(_0x2b6e('0x8'));var attributes=require(_0x2b6e('0x9'));module[_0x2b6e('0xa')]=function(_0x514052,_0x2bbc0f){return _0x514052[_0x2b6e('0xb')](_0x2b6e('0xc'),attributes,{'tableName':_0x2b6e('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 6b5e646..ab2ae40 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 _0x9860=['message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x9860,0xc9));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0986('0x0'));var util=require(_0x0986('0x1'));var moment=require(_0x0986('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0986('0x3'))['db'];var utils=require(_0x0986('0x4'));var logger=require(_0x0986('0x5'))(_0x0986('0x6'));var config=require('../../config/environment');var jayson=require(_0x0986('0x7'));var client=jayson[_0x0986('0x8')][_0x0986('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392fbf,_0x1ce179,_0x19d9a4){return new BPromise(function(_0xdccdee,_0xb542f4){return client[_0x0986('0xa')](_0x392fbf,_0x19d9a4)[_0x0986('0xb')](function(_0x1b4c32){logger[_0x0986('0xc')](_0x0986('0xd'),_0x1ce179,_0x0986('0xe'));logger[_0x0986('0xf')](_0x0986('0x10'),_0x1ce179,_0x0986('0xe'),JSON[_0x0986('0x11')](_0x1b4c32));if(_0x1b4c32[_0x0986('0x12')]){if(_0x1b4c32[_0x0986('0x12')]['code']===0x1f4){logger[_0x0986('0x12')](_0x0986('0xd'),_0x1ce179,_0x1b4c32['error']['message']);return _0xb542f4(_0x1b4c32[_0x0986('0x12')][_0x0986('0x13')]);}logger[_0x0986('0x12')](_0x0986('0xd'),_0x1ce179,_0x1b4c32[_0x0986('0x12')][_0x0986('0x13')]);return _0xdccdee(_0x1b4c32[_0x0986('0x12')]['message']);}else{logger[_0x0986('0xc')](_0x0986('0xd'),_0x1ce179,_0x0986('0xe'));_0xdccdee(_0x1b4c32[_0x0986('0x14')]['message']);}})[_0x0986('0x15')](function(_0x1e6f20){logger['error'](_0x0986('0xd'),_0x1ce179,_0x1e6f20);_0xb542f4(_0x1e6f20);});});} \ No newline at end of file +var _0x442a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','randomstring','ioredis'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x442a,0xa5));var _0xa442=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x442a[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0xa442('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa442('0x1'));var fs=require('fs');var Redis=require(_0xa442('0x2'));var db=require(_0xa442('0x3'))['db'];var utils=require(_0xa442('0x4'));var logger=require(_0xa442('0x5'))(_0xa442('0x6'));var config=require(_0xa442('0x7'));var jayson=require(_0xa442('0x8'));var client=jayson[_0xa442('0x9')][_0xa442('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xea009c,_0x330fc7,_0x1b50e7){return new BPromise(function(_0x29f3b4,_0xb8a1e2){return client['request'](_0xea009c,_0x1b50e7)[_0xa442('0xb')](function(_0x1da3e9){logger[_0xa442('0xc')](_0xa442('0xd'),_0x330fc7,'request\x20sent');logger['debug'](_0xa442('0xe'),_0x330fc7,_0xa442('0xf'),JSON['stringify'](_0x1da3e9));if(_0x1da3e9[_0xa442('0x10')]){if(_0x1da3e9[_0xa442('0x10')][_0xa442('0x11')]===0x1f4){logger['error'](_0xa442('0xd'),_0x330fc7,_0x1da3e9[_0xa442('0x10')][_0xa442('0x12')]);return _0xb8a1e2(_0x1da3e9['error']['message']);}logger['error'](_0xa442('0xd'),_0x330fc7,_0x1da3e9['error'][_0xa442('0x12')]);return _0x29f3b4(_0x1da3e9[_0xa442('0x10')][_0xa442('0x12')]);}else{logger[_0xa442('0xc')](_0xa442('0xd'),_0x330fc7,_0xa442('0xf'));_0x29f3b4(_0x1da3e9[_0xa442('0x13')]['message']);}})[_0xa442('0x14')](function(_0x1d0b20){logger['error'](_0xa442('0xd'),_0x330fc7,_0x1d0b20);_0xb8a1e2(_0x1d0b20);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3b5af6b..e9bb832 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 _0x5008=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','./intVtigerField.controller','get','/:id','show','post','isAuthenticated','create'];(function(_0x19f05d,_0x58819d){var _0x5e98b8=function(_0x467442){while(--_0x467442){_0x19f05d['push'](_0x19f05d['shift']());}};_0x5e98b8(++_0x58819d);}(_0x5008,0xaf));var _0x8500=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x5008[_0x126fb9];return _0xc8a3b1;};'use strict';var multer=require(_0x8500('0x0'));var util=require(_0x8500('0x1'));var path=require(_0x8500('0x2'));var timeout=require(_0x8500('0x3'));var express=require('express');var router=express[_0x8500('0x4')]();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(_0x8500('0x5'));router[_0x8500('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8500('0x6')](_0x8500('0x7'),auth['isAuthenticated'](),controller[_0x8500('0x8')]);router[_0x8500('0x9')]('/',auth[_0x8500('0xa')](),controller[_0x8500('0xb')]);router[_0x8500('0xc')](_0x8500('0x7'),auth[_0x8500('0xa')](),controller[_0x8500('0xd')]);router[_0x8500('0xe')](_0x8500('0x7'),auth[_0x8500('0xa')](),controller[_0x8500('0xf')]);module[_0x8500('0x10')]=router; \ No newline at end of file +var _0x7176=['create','put','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x3a5478,_0x414e34){var _0x756779=function(_0x1334b8){while(--_0x1334b8){_0x3a5478['push'](_0x3a5478['shift']());}};_0x756779(++_0x414e34);}(_0x7176,0x16d));var _0x6717=function(_0x45ad64,_0x81693c){_0x45ad64=_0x45ad64-0x0;var _0x37ecc8=_0x7176[_0x45ad64];return _0x37ecc8;};'use strict';var multer=require(_0x6717('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6717('0x1'));var express=require(_0x6717('0x2'));var router=express['Router']();var fs_extra=require(_0x6717('0x3'));var auth=require(_0x6717('0x4'));var interaction=require(_0x6717('0x5'));var config=require('../../config/environment');var controller=require(_0x6717('0x6'));router['get']('/',auth[_0x6717('0x7')](),controller[_0x6717('0x8')]);router[_0x6717('0x9')](_0x6717('0xa'),auth[_0x6717('0x7')](),controller[_0x6717('0xb')]);router[_0x6717('0xc')]('/',auth[_0x6717('0x7')](),controller[_0x6717('0xd')]);router[_0x6717('0xe')](_0x6717('0xa'),auth[_0x6717('0x7')](),controller['update']);router[_0x6717('0xf')]('/:id',auth[_0x6717('0x7')](),controller[_0x6717('0x10')]);module[_0x6717('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9a70c90..f305976 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 _0x86c8=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','variable'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0x86c8,0x19b));var _0x886c=function(_0x204fa6,_0x285516){_0x204fa6=_0x204fa6-0x0;var _0x37664b=_0x86c8[_0x204fa6];return _0x37664b;};'use strict';var Sequelize=require('sequelize');module[_0x886c('0x0')]={'type':{'type':Sequelize[_0x886c('0x1')]('string',_0x886c('0x2'),_0x886c('0x3'),_0x886c('0x4'),_0x886c('0x5')),'defaultValue':_0x886c('0x6')},'content':{'type':Sequelize[_0x886c('0x7')]},'key':{'type':Sequelize[_0x886c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x886c('0x6'),'variable',_0x886c('0x3'))},'keyContent':{'type':Sequelize[_0x886c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x886c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x886c('0x7')]}}; \ No newline at end of file +var _0x57f1=['customVariable','sequelize','exports','ENUM','keyValue','picklist','string','STRING','variable'];(function(_0x16e49e,_0x175785){var _0x31469e=function(_0x1906a6){while(--_0x1906a6){_0x16e49e['push'](_0x16e49e['shift']());}};_0x31469e(++_0x175785);}(_0x57f1,0x118));var _0x157f=function(_0x238f1e,_0x4e1c09){_0x238f1e=_0x238f1e-0x0;var _0x271ba6=_0x57f1[_0x238f1e];return _0x271ba6;};'use strict';var Sequelize=require(_0x157f('0x0'));module[_0x157f('0x1')]={'type':{'type':Sequelize[_0x157f('0x2')]('string','variable','customVariable',_0x157f('0x3'),_0x157f('0x4')),'defaultValue':_0x157f('0x5')},'content':{'type':Sequelize[_0x157f('0x6')]},'key':{'type':Sequelize[_0x157f('0x6')]},'keyType':{'type':Sequelize[_0x157f('0x2')](_0x157f('0x5'),_0x157f('0x7'),_0x157f('0x8'))},'keyContent':{'type':Sequelize[_0x157f('0x6')]},'idField':{'type':Sequelize[_0x157f('0x6')]},'nameField':{'type':Sequelize[_0x157f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 26f27ad..7ff1efb 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 _0x1c21=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x1c21,0xd3));var _0x11c2=function(_0x40bcb3,_0x5bc065){_0x40bcb3=_0x40bcb3-0x0;var _0x2e3e95=_0x1c21[_0x40bcb3];return _0x2e3e95;};'use strict';var emlformat=require(_0x11c2('0x0'));var rimraf=require(_0x11c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11c2('0x2'));var rp=require(_0x11c2('0x3'));var moment=require(_0x11c2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x11c2('0x5'));var util=require(_0x11c2('0x6'));var path=require(_0x11c2('0x7'));var sox=require(_0x11c2('0x8'));var csv=require(_0x11c2('0x9'));var ejs=require(_0x11c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11c2('0xb'));var squel=require(_0x11c2('0xc'));var crypto=require(_0x11c2('0xd'));var jsforce=require(_0x11c2('0xe'));var deskjs=require(_0x11c2('0xf'));var toCsv=require(_0x11c2('0x9'));var querystring=require(_0x11c2('0x10'));var Papa=require('papaparse');var Redis=require(_0x11c2('0x11'));var authService=require(_0x11c2('0x12'));var qs=require(_0x11c2('0x13'));var as=require(_0x11c2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11c2('0x15'));var utils=require(_0x11c2('0x16'));var config=require(_0x11c2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x11c2('0x18'))['db'];function respondWithStatusCode(_0x2b172a,_0x361cb4){_0x361cb4=_0x361cb4||0xcc;return function(_0x22a07d){if(_0x22a07d){return _0x2b172a[_0x11c2('0x19')](_0x361cb4);}return _0x2b172a[_0x11c2('0x1a')](_0x361cb4)['end']();};}function respondWithResult(_0x368a89,_0x258ff4){_0x258ff4=_0x258ff4||0xc8;return function(_0x34d2d8){if(_0x34d2d8){return _0x368a89[_0x11c2('0x1a')](_0x258ff4)[_0x11c2('0x1b')](_0x34d2d8);}};}function respondWithFilteredResult(_0x172d62,_0x3bcf54){return function(_0x54392f){if(_0x54392f){var _0x4de02b=typeof _0x3bcf54['offset']===_0x11c2('0x1c')&&typeof _0x3bcf54[_0x11c2('0x1d')]===_0x11c2('0x1c');var _0x2e01e3=_0x54392f[_0x11c2('0x1e')];var _0xf28602=_0x4de02b?0x0:_0x3bcf54[_0x11c2('0x1f')];var _0x4ca230=_0x4de02b?_0x54392f[_0x11c2('0x1e')]:_0x3bcf54['offset']+_0x3bcf54[_0x11c2('0x1d')];var _0x71b971;if(_0x4ca230>=_0x2e01e3){_0x4ca230=_0x2e01e3;_0x71b971=0xc8;}else{_0x71b971=0xce;}_0x172d62['status'](_0x71b971);return _0x172d62['set'](_0x11c2('0x20'),_0xf28602+'-'+_0x4ca230+'/'+_0x2e01e3)[_0x11c2('0x1b')](_0x54392f);}return null;};}function patchUpdates(_0x2de6a7){return function(_0x143287){try{jsonpatch[_0x11c2('0x21')](_0x143287,_0x2de6a7,!![]);}catch(_0xd9e8bb){return BPromise['reject'](_0xd9e8bb);}return _0x143287[_0x11c2('0x22')]();};}function saveUpdates(_0x50de1f,_0x28c472){return function(_0x501fb9){if(_0x501fb9){return _0x501fb9[_0x11c2('0x23')](_0x50de1f)[_0x11c2('0x24')](function(_0x527774){return _0x527774;});}return null;};}function removeEntity(_0x9569f7,_0x108311){return function(_0x55f2b3){if(_0x55f2b3){return _0x55f2b3[_0x11c2('0x25')]()[_0x11c2('0x24')](function(){_0x9569f7[_0x11c2('0x1a')](0xcc)[_0x11c2('0x26')]();});}};}function handleEntityNotFound(_0x5583f2,_0x4cb7e2){return function(_0x51ff24){if(!_0x51ff24){_0x5583f2['sendStatus'](0x194);}return _0x51ff24;};}function handleError(_0x3bc92c,_0x483ebc){_0x483ebc=_0x483ebc||0x1f4;return function(_0x48e424){logger[_0x11c2('0x27')](_0x48e424[_0x11c2('0x28')]);if(_0x48e424[_0x11c2('0x29')]){delete _0x48e424[_0x11c2('0x29')];}_0x3bc92c[_0x11c2('0x1a')](_0x483ebc)['send'](_0x48e424);};}exports[_0x11c2('0x2a')]=function(_0x19aaa1,_0x242779){var _0x22fa52={},_0x4c5431={},_0x46bcdb={'count':0x0,'rows':[]};var _0x2cf71a=_[_0x11c2('0x2b')](db[_0x11c2('0x2c')][_0x11c2('0x2d')],function(_0x224afc){return{'name':_0x224afc[_0x11c2('0x2e')],'type':_0x224afc[_0x11c2('0x2f')][_0x11c2('0x30')]};});_0x4c5431[_0x11c2('0x31')]=_['map'](_0x2cf71a,_0x11c2('0x29'));_0x4c5431[_0x11c2('0x32')]=_[_0x11c2('0x33')](_0x19aaa1[_0x11c2('0x32')]);_0x4c5431[_0x11c2('0x34')]=_[_0x11c2('0x35')](_0x4c5431[_0x11c2('0x31')],_0x4c5431[_0x11c2('0x32')]);_0x22fa52[_0x11c2('0x36')]=_['intersection'](_0x4c5431[_0x11c2('0x31')],qs[_0x11c2('0x37')](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x37')]));_0x22fa52['attributes']=_0x22fa52[_0x11c2('0x36')][_0x11c2('0x38')]?_0x22fa52[_0x11c2('0x36')]:_0x4c5431['model'];if(!_0x19aaa1[_0x11c2('0x32')]['hasOwnProperty']('nolimit')){_0x22fa52[_0x11c2('0x1d')]=qs[_0x11c2('0x1d')](_0x19aaa1[_0x11c2('0x32')]['limit']);_0x22fa52[_0x11c2('0x1f')]=qs['offset'](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x1f')]);}_0x22fa52[_0x11c2('0x39')]=qs[_0x11c2('0x3a')](_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3a')]);_0x22fa52[_0x11c2('0x3b')]=qs[_0x11c2('0x34')](_[_0x11c2('0x3c')](_0x19aaa1['query'],_0x4c5431[_0x11c2('0x34')]),_0x2cf71a);if(_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3d')]){_0x22fa52['where']=_[_0x11c2('0x3e')](_0x22fa52[_0x11c2('0x3b')],{'$or':_[_0x11c2('0x2b')](_0x2cf71a,function(_0x51bde0){if(_0x51bde0[_0x11c2('0x2f')]!==_0x11c2('0x3f')){var _0x2d512d={};_0x2d512d[_0x51bde0[_0x11c2('0x29')]]={'$like':'%'+_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x3d')]+'%'};return _0x2d512d;}})});}_0x22fa52=_[_0x11c2('0x3e')]({},_0x22fa52,_0x19aaa1['options']);var _0x1e2a6d={'where':_0x22fa52[_0x11c2('0x3b')]};return db[_0x11c2('0x2c')]['count'](_0x1e2a6d)[_0x11c2('0x24')](function(_0x429118){_0x46bcdb[_0x11c2('0x1e')]=_0x429118;if(_0x19aaa1[_0x11c2('0x32')][_0x11c2('0x40')]){_0x22fa52[_0x11c2('0x41')]=[{'all':!![]}];}return db[_0x11c2('0x2c')][_0x11c2('0x42')](_0x22fa52);})['then'](function(_0x47bd36){_0x46bcdb[_0x11c2('0x43')]=_0x47bd36;return _0x46bcdb;})[_0x11c2('0x24')](respondWithFilteredResult(_0x242779,_0x22fa52))[_0x11c2('0x44')](handleError(_0x242779,null));};exports[_0x11c2('0x45')]=function(_0x363df7,_0x2c0677){var _0x2b0284={'raw':!![],'where':{'id':_0x363df7[_0x11c2('0x46')]['id']}},_0x4909a1={};_0x4909a1[_0x11c2('0x31')]=_[_0x11c2('0x33')](db[_0x11c2('0x2c')][_0x11c2('0x2d')]);_0x4909a1[_0x11c2('0x32')]=_['keys'](_0x363df7[_0x11c2('0x32')]);_0x4909a1[_0x11c2('0x34')]=_[_0x11c2('0x35')](_0x4909a1[_0x11c2('0x31')],_0x4909a1[_0x11c2('0x32')]);_0x2b0284[_0x11c2('0x36')]=_[_0x11c2('0x35')](_0x4909a1[_0x11c2('0x31')],qs['fields'](_0x363df7[_0x11c2('0x32')][_0x11c2('0x37')]));_0x2b0284[_0x11c2('0x36')]=_0x2b0284[_0x11c2('0x36')][_0x11c2('0x38')]?_0x2b0284[_0x11c2('0x36')]:_0x4909a1[_0x11c2('0x31')];if(_0x363df7[_0x11c2('0x32')]['includeAll']){_0x2b0284[_0x11c2('0x41')]=[{'all':!![]}];}_0x2b0284=_[_0x11c2('0x3e')]({},_0x2b0284,_0x363df7[_0x11c2('0x47')]);return db[_0x11c2('0x2c')][_0x11c2('0x48')](_0x2b0284)[_0x11c2('0x24')](handleEntityNotFound(_0x2c0677,null))[_0x11c2('0x24')](respondWithResult(_0x2c0677,null))[_0x11c2('0x44')](handleError(_0x2c0677,null));};exports[_0x11c2('0x49')]=function(_0x3af1b2,_0x2ec237){return db[_0x11c2('0x2c')][_0x11c2('0x49')](_0x3af1b2[_0x11c2('0x4a')],{})[_0x11c2('0x24')](respondWithResult(_0x2ec237,0xc9))[_0x11c2('0x44')](handleError(_0x2ec237,null));};exports[_0x11c2('0x23')]=function(_0x232a27,_0x26d7e9){if(_0x232a27[_0x11c2('0x4a')]['id']){delete _0x232a27[_0x11c2('0x4a')]['id'];}return db[_0x11c2('0x2c')][_0x11c2('0x48')]({'where':{'id':_0x232a27[_0x11c2('0x46')]['id']}})[_0x11c2('0x24')](handleEntityNotFound(_0x26d7e9,null))['then'](saveUpdates(_0x232a27['body'],null))[_0x11c2('0x24')](respondWithResult(_0x26d7e9,null))[_0x11c2('0x44')](handleError(_0x26d7e9,null));};exports['destroy']=function(_0x51ffd9,_0x350efd){return db[_0x11c2('0x2c')][_0x11c2('0x48')]({'where':{'id':_0x51ffd9['params']['id']}})[_0x11c2('0x24')](handleEntityNotFound(_0x350efd,null))[_0x11c2('0x24')](removeEntity(_0x350efd,null))['catch'](handleError(_0x350efd,null));}; \ No newline at end of file +var _0x7085=['rawAttributes','include','create','body','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','VtigerField','includeAll','rows','catch','show','params'];(function(_0x3435e7,_0x634049){var _0xcf8a56=function(_0x116396){while(--_0x116396){_0x3435e7['push'](_0x3435e7['shift']());}};_0xcf8a56(++_0x634049);}(_0x7085,0x177));var _0x5708=function(_0x5ebcda,_0x5aaa0a){_0x5ebcda=_0x5ebcda-0x0;var _0x179c8e=_0x7085[_0x5ebcda];return _0x179c8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5708('0x0'));var zipdir=require(_0x5708('0x1'));var jsonpatch=require(_0x5708('0x2'));var rp=require('request-promise');var moment=require(_0x5708('0x3'));var BPromise=require(_0x5708('0x4'));var Mustache=require(_0x5708('0x5'));var util=require(_0x5708('0x6'));var path=require(_0x5708('0x7'));var sox=require(_0x5708('0x8'));var csv=require(_0x5708('0x9'));var ejs=require(_0x5708('0xa'));var fs=require('fs');var fs_extra=require(_0x5708('0xb'));var _=require(_0x5708('0xc'));var squel=require(_0x5708('0xd'));var crypto=require(_0x5708('0xe'));var jsforce=require(_0x5708('0xf'));var deskjs=require(_0x5708('0x10'));var toCsv=require(_0x5708('0x9'));var querystring=require(_0x5708('0x11'));var Papa=require('papaparse');var Redis=require(_0x5708('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5708('0x13'));var as=require(_0x5708('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5708('0x15'))(_0x5708('0x16'));var utils=require(_0x5708('0x17'));var config=require(_0x5708('0x18'));var licenseUtil=require(_0x5708('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e23db,_0x417e0c){_0x417e0c=_0x417e0c||0xcc;return function(_0x30ea69){if(_0x30ea69){return _0x3e23db[_0x5708('0x1a')](_0x417e0c);}return _0x3e23db[_0x5708('0x1b')](_0x417e0c)[_0x5708('0x1c')]();};}function respondWithResult(_0x2ea05d,_0x477654){_0x477654=_0x477654||0xc8;return function(_0x3632c6){if(_0x3632c6){return _0x2ea05d[_0x5708('0x1b')](_0x477654)[_0x5708('0x1d')](_0x3632c6);}};}function respondWithFilteredResult(_0x314151,_0xeb9885){return function(_0x30f3f7){if(_0x30f3f7){var _0x2a5458=typeof _0xeb9885[_0x5708('0x1e')]===_0x5708('0x1f')&&typeof _0xeb9885[_0x5708('0x20')]==='undefined';var _0x4dfcc4=_0x30f3f7[_0x5708('0x21')];var _0x222b34=_0x2a5458?0x0:_0xeb9885[_0x5708('0x1e')];var _0x4650a4=_0x2a5458?_0x30f3f7['count']:_0xeb9885['offset']+_0xeb9885[_0x5708('0x20')];var _0x54b25c;if(_0x4650a4>=_0x4dfcc4){_0x4650a4=_0x4dfcc4;_0x54b25c=0xc8;}else{_0x54b25c=0xce;}_0x314151[_0x5708('0x1b')](_0x54b25c);return _0x314151[_0x5708('0x22')](_0x5708('0x23'),_0x222b34+'-'+_0x4650a4+'/'+_0x4dfcc4)[_0x5708('0x1d')](_0x30f3f7);}return null;};}function patchUpdates(_0x3e0d1f){return function(_0xfd6de1){try{jsonpatch[_0x5708('0x24')](_0xfd6de1,_0x3e0d1f,!![]);}catch(_0x1c8e78){return BPromise['reject'](_0x1c8e78);}return _0xfd6de1[_0x5708('0x25')]();};}function saveUpdates(_0x2f637e,_0x4beadf){return function(_0x1f188f){if(_0x1f188f){return _0x1f188f[_0x5708('0x26')](_0x2f637e)[_0x5708('0x27')](function(_0x41cd6d){return _0x41cd6d;});}return null;};}function removeEntity(_0xc80c9b,_0x1c0415){return function(_0x8c87a6){if(_0x8c87a6){return _0x8c87a6['destroy']()[_0x5708('0x27')](function(){_0xc80c9b[_0x5708('0x1b')](0xcc)[_0x5708('0x1c')]();});}};}function handleEntityNotFound(_0x2865b2,_0x15b293){return function(_0xc575df){if(!_0xc575df){_0x2865b2[_0x5708('0x1a')](0x194);}return _0xc575df;};}function handleError(_0x2d9e36,_0x54044d){_0x54044d=_0x54044d||0x1f4;return function(_0x1db3d0){logger[_0x5708('0x28')](_0x1db3d0[_0x5708('0x29')]);if(_0x1db3d0['name']){delete _0x1db3d0[_0x5708('0x2a')];}_0x2d9e36[_0x5708('0x1b')](_0x54044d)['send'](_0x1db3d0);};}exports[_0x5708('0x2b')]=function(_0x496240,_0x4810bd){var _0x2b20ec={},_0x406167={},_0x35291e={'count':0x0,'rows':[]};var _0x35987d=_[_0x5708('0x2c')](db['VtigerField']['rawAttributes'],function(_0x1ca08e){return{'name':_0x1ca08e['fieldName'],'type':_0x1ca08e[_0x5708('0x2d')][_0x5708('0x2e')]};});_0x406167[_0x5708('0x2f')]=_[_0x5708('0x2c')](_0x35987d,_0x5708('0x2a'));_0x406167[_0x5708('0x30')]=_[_0x5708('0x31')](_0x496240[_0x5708('0x30')]);_0x406167[_0x5708('0x32')]=_['intersection'](_0x406167[_0x5708('0x2f')],_0x406167[_0x5708('0x30')]);_0x2b20ec['attributes']=_[_0x5708('0x33')](_0x406167['model'],qs[_0x5708('0x34')](_0x496240['query'][_0x5708('0x34')]));_0x2b20ec[_0x5708('0x35')]=_0x2b20ec[_0x5708('0x35')][_0x5708('0x36')]?_0x2b20ec['attributes']:_0x406167[_0x5708('0x2f')];if(!_0x496240[_0x5708('0x30')]['hasOwnProperty'](_0x5708('0x37'))){_0x2b20ec[_0x5708('0x20')]=qs[_0x5708('0x20')](_0x496240[_0x5708('0x30')][_0x5708('0x20')]);_0x2b20ec[_0x5708('0x1e')]=qs[_0x5708('0x1e')](_0x496240[_0x5708('0x30')]['offset']);}_0x2b20ec['order']=qs[_0x5708('0x38')](_0x496240[_0x5708('0x30')][_0x5708('0x38')]);_0x2b20ec['where']=qs[_0x5708('0x32')](_[_0x5708('0x39')](_0x496240['query'],_0x406167[_0x5708('0x32')]),_0x35987d);if(_0x496240['query']['filter']){_0x2b20ec[_0x5708('0x3a')]=_[_0x5708('0x3b')](_0x2b20ec[_0x5708('0x3a')],{'$or':_[_0x5708('0x2c')](_0x35987d,function(_0x58ec28){if(_0x58ec28['type']!==_0x5708('0x3c')){var _0x4ec1f6={};_0x4ec1f6[_0x58ec28[_0x5708('0x2a')]]={'$like':'%'+_0x496240[_0x5708('0x30')][_0x5708('0x3d')]+'%'};return _0x4ec1f6;}})});}_0x2b20ec=_[_0x5708('0x3b')]({},_0x2b20ec,_0x496240[_0x5708('0x3e')]);var _0x252caf={'where':_0x2b20ec[_0x5708('0x3a')]};return db[_0x5708('0x3f')][_0x5708('0x21')](_0x252caf)[_0x5708('0x27')](function(_0x3ee927){_0x35291e[_0x5708('0x21')]=_0x3ee927;if(_0x496240[_0x5708('0x30')][_0x5708('0x40')]){_0x2b20ec['include']=[{'all':!![]}];}return db[_0x5708('0x3f')]['findAll'](_0x2b20ec);})[_0x5708('0x27')](function(_0x5e33ec){_0x35291e[_0x5708('0x41')]=_0x5e33ec;return _0x35291e;})[_0x5708('0x27')](respondWithFilteredResult(_0x4810bd,_0x2b20ec))[_0x5708('0x42')](handleError(_0x4810bd,null));};exports[_0x5708('0x43')]=function(_0xc9e735,_0x58af0b){var _0x53535e={'raw':!![],'where':{'id':_0xc9e735[_0x5708('0x44')]['id']}},_0x1e9940={};_0x1e9940['model']=_['keys'](db['VtigerField'][_0x5708('0x45')]);_0x1e9940['query']=_['keys'](_0xc9e735[_0x5708('0x30')]);_0x1e9940[_0x5708('0x32')]=_['intersection'](_0x1e9940[_0x5708('0x2f')],_0x1e9940['query']);_0x53535e[_0x5708('0x35')]=_[_0x5708('0x33')](_0x1e9940['model'],qs[_0x5708('0x34')](_0xc9e735[_0x5708('0x30')][_0x5708('0x34')]));_0x53535e[_0x5708('0x35')]=_0x53535e[_0x5708('0x35')][_0x5708('0x36')]?_0x53535e['attributes']:_0x1e9940['model'];if(_0xc9e735['query'][_0x5708('0x40')]){_0x53535e[_0x5708('0x46')]=[{'all':!![]}];}_0x53535e=_[_0x5708('0x3b')]({},_0x53535e,_0xc9e735['options']);return db[_0x5708('0x3f')]['find'](_0x53535e)['then'](handleEntityNotFound(_0x58af0b,null))[_0x5708('0x27')](respondWithResult(_0x58af0b,null))['catch'](handleError(_0x58af0b,null));};exports[_0x5708('0x47')]=function(_0x18af29,_0x5834bb){return db['VtigerField'][_0x5708('0x47')](_0x18af29[_0x5708('0x48')],{})[_0x5708('0x27')](respondWithResult(_0x5834bb,0xc9))[_0x5708('0x42')](handleError(_0x5834bb,null));};exports[_0x5708('0x26')]=function(_0x243245,_0x291c71){if(_0x243245[_0x5708('0x48')]['id']){delete _0x243245[_0x5708('0x48')]['id'];}return db['VtigerField'][_0x5708('0x49')]({'where':{'id':_0x243245[_0x5708('0x44')]['id']}})[_0x5708('0x27')](handleEntityNotFound(_0x291c71,null))[_0x5708('0x27')](saveUpdates(_0x243245[_0x5708('0x48')],null))[_0x5708('0x27')](respondWithResult(_0x291c71,null))[_0x5708('0x42')](handleError(_0x291c71,null));};exports['destroy']=function(_0x3a31ee,_0x1da792){return db[_0x5708('0x3f')]['find']({'where':{'id':_0x3a31ee['params']['id']}})[_0x5708('0x27')](handleEntityNotFound(_0x1da792,null))[_0x5708('0x27')](removeEntity(_0x1da792,null))['catch'](handleError(_0x1da792,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index f438f20..4771858 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 _0x58fc=['path','rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x413036,_0x5774f2){var _0x22c01b=function(_0x1d8016){while(--_0x1d8016){_0x413036['push'](_0x413036['shift']());}};_0x22c01b(++_0x5774f2);}(_0x58fc,0x15a));var _0xc58f=function(_0x330cdf,_0x18f3e4){_0x330cdf=_0x330cdf-0x0;var _0xf77c48=_0x58fc[_0x330cdf];return _0xf77c48;};'use strict';var _=require(_0xc58f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc58f('0x1'));var moment=require(_0xc58f('0x2'));var BPromise=require('bluebird');var rp=require(_0xc58f('0x3'));var fs=require('fs');var path=require(_0xc58f('0x4'));var rimraf=require(_0xc58f('0x5'));var config=require(_0xc58f('0x6'));var attributes=require(_0xc58f('0x7'));module['exports']=function(_0x1a55fb,_0x241106){return _0x1a55fb[_0xc58f('0x8')](_0xc58f('0x9'),attributes,{'tableName':_0xc58f('0xa'),'paranoid':![],'indexes':[{'name':_0xc58f('0xb'),'fields':[_0xc58f('0xc'),_0xc58f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86d0=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x14219a,_0x20e763){var _0x24847f=function(_0x24166a){while(--_0x24166a){_0x14219a['push'](_0x14219a['shift']());}};_0x24847f(++_0x20e763);}(_0x86d0,0x8a));var _0x086d=function(_0x151732,_0x82b764){_0x151732=_0x151732-0x0;var _0x1cda86=_0x86d0[_0x151732];return _0x1cda86;};'use strict';var _=require(_0x086d('0x0'));var util=require(_0x086d('0x1'));var logger=require(_0x086d('0x2'))(_0x086d('0x3'));var moment=require(_0x086d('0x4'));var BPromise=require(_0x086d('0x5'));var rp=require(_0x086d('0x6'));var fs=require('fs');var path=require(_0x086d('0x7'));var rimraf=require(_0x086d('0x8'));var config=require(_0x086d('0x9'));var attributes=require(_0x086d('0xa'));module[_0x086d('0xb')]=function(_0x344573,_0x2e86fd){return _0x344573['define'](_0x086d('0xc'),attributes,{'tableName':_0x086d('0xd'),'paranoid':![],'indexes':[{'name':_0x086d('0xe'),'fields':[_0x086d('0xf'),_0x086d('0x10')],'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 217402d..fad1531 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 _0x2db9=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x10e9e8,_0x3aa59e){var _0x13251e=function(_0x4c34ec){while(--_0x4c34ec){_0x10e9e8['push'](_0x10e9e8['shift']());}};_0x13251e(++_0x3aa59e);}(_0x2db9,0xad));var _0x92db=function(_0x48d7ee,_0x1574fc){_0x48d7ee=_0x48d7ee-0x0;var _0x20fc81=_0x2db9[_0x48d7ee];return _0x20fc81;};'use strict';var _=require(_0x92db('0x0'));var util=require(_0x92db('0x1'));var moment=require(_0x92db('0x2'));var BPromise=require('bluebird');var rs=require(_0x92db('0x3'));var fs=require('fs');var Redis=require(_0x92db('0x4'));var db=require(_0x92db('0x5'))['db'];var utils=require(_0x92db('0x6'));var logger=require(_0x92db('0x7'))(_0x92db('0x8'));var config=require(_0x92db('0x9'));var jayson=require(_0x92db('0xa'));var client=jayson[_0x92db('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b8f3,_0x20851b,_0xec0783){return new BPromise(function(_0x48780c,_0x9c5a4f){return client[_0x92db('0xc')](_0x27b8f3,_0xec0783)[_0x92db('0xd')](function(_0x53fec3){logger['info'](_0x92db('0xe'),_0x20851b,_0x92db('0xf'));logger[_0x92db('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x20851b,'request\x20sent',JSON[_0x92db('0x11')](_0x53fec3));if(_0x53fec3[_0x92db('0x12')]){if(_0x53fec3[_0x92db('0x12')][_0x92db('0x13')]===0x1f4){logger[_0x92db('0x12')]('VtigerField,\x20%s,\x20%s',_0x20851b,_0x53fec3[_0x92db('0x12')]['message']);return _0x9c5a4f(_0x53fec3[_0x92db('0x12')][_0x92db('0x14')]);}logger['error'](_0x92db('0xe'),_0x20851b,_0x53fec3[_0x92db('0x12')]['message']);return _0x48780c(_0x53fec3[_0x92db('0x12')][_0x92db('0x14')]);}else{logger[_0x92db('0x15')](_0x92db('0xe'),_0x20851b,_0x92db('0xf'));_0x48780c(_0x53fec3[_0x92db('0x16')][_0x92db('0x14')]);}})[_0x92db('0x17')](function(_0x393e23){logger['error'](_0x92db('0xe'),_0x20851b,_0x393e23);_0x9c5a4f(_0x393e23);});});} \ No newline at end of file +var _0x12f1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','randomstring'];(function(_0x1997be,_0x361f95){var _0x2ced17=function(_0x306f4a){while(--_0x306f4a){_0x1997be['push'](_0x1997be['shift']());}};_0x2ced17(++_0x361f95);}(_0x12f1,0x14e));var _0x112f=function(_0x2cad07,_0xdfa252){_0x2cad07=_0x2cad07-0x0;var _0x46b8ad=_0x12f1[_0x2cad07];return _0x46b8ad;};'use strict';var _=require(_0x112f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x112f('0x1'));var fs=require('fs');var Redis=require(_0x112f('0x2'));var db=require(_0x112f('0x3'))['db'];var utils=require(_0x112f('0x4'));var logger=require(_0x112f('0x5'))(_0x112f('0x6'));var config=require(_0x112f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x112f('0x8')][_0x112f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x104639,_0x413a6c,_0x5c02a1){return new BPromise(function(_0x20a6e4,_0x293af1){return client[_0x112f('0xa')](_0x104639,_0x5c02a1)[_0x112f('0xb')](function(_0x33dc30){logger[_0x112f('0xc')]('VtigerField,\x20%s,\x20%s',_0x413a6c,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x413a6c,_0x112f('0xd'),JSON[_0x112f('0xe')](_0x33dc30));if(_0x33dc30['error']){if(_0x33dc30[_0x112f('0xf')][_0x112f('0x10')]===0x1f4){logger[_0x112f('0xf')](_0x112f('0x11'),_0x413a6c,_0x33dc30[_0x112f('0xf')][_0x112f('0x12')]);return _0x293af1(_0x33dc30['error'][_0x112f('0x12')]);}logger[_0x112f('0xf')](_0x112f('0x11'),_0x413a6c,_0x33dc30[_0x112f('0xf')][_0x112f('0x12')]);return _0x20a6e4(_0x33dc30[_0x112f('0xf')][_0x112f('0x12')]);}else{logger[_0x112f('0xc')]('VtigerField,\x20%s,\x20%s',_0x413a6c,_0x112f('0xd'));_0x20a6e4(_0x33dc30[_0x112f('0x13')][_0x112f('0x12')]);}})[_0x112f('0x14')](function(_0x5cfb19){logger[_0x112f('0xf')](_0x112f('0x11'),_0x413a6c,_0x5cfb19);_0x293af1(_0x5cfb19);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 68b3475..038cfb3 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 _0xe6c0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe6c0,0x88));var _0x0e6c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xe6c0[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x0e6c('0x0'));var path=require(_0x0e6c('0x1'));var timeout=require(_0x0e6c('0x2'));var express=require('express');var router=express[_0x0e6c('0x3')]();var fs_extra=require(_0x0e6c('0x4'));var auth=require(_0x0e6c('0x5'));var interaction=require(_0x0e6c('0x6'));var config=require(_0x0e6c('0x7'));var controller=require(_0x0e6c('0x8'));router[_0x0e6c('0x9')]('/',auth[_0x0e6c('0xa')](),controller[_0x0e6c('0xb')]);router[_0x0e6c('0x9')]('/:id',auth[_0x0e6c('0xa')](),controller['show']);router[_0x0e6c('0x9')](_0x0e6c('0xc'),auth[_0x0e6c('0xa')](),controller['getConfigurations']);router[_0x0e6c('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0e6c('0xd')]('/',auth[_0x0e6c('0xa')](),controller['create']);router['post'](_0x0e6c('0xc'),auth[_0x0e6c('0xa')](),controller[_0x0e6c('0xe')]);router[_0x0e6c('0xf')](_0x0e6c('0x10'),auth[_0x0e6c('0xa')](),controller['update']);router[_0x0e6c('0x11')](_0x0e6c('0x10'),auth['isAuthenticated'](),controller[_0x0e6c('0x12')]);module[_0x0e6c('0x13')]=router; \ No newline at end of file +var _0x9b97=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','exports'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x9b97,0x11e));var _0x79b9=function(_0x1824e9,_0x1eb46a){_0x1824e9=_0x1824e9-0x0;var _0xbd8445=_0x9b97[_0x1824e9];return _0xbd8445;};'use strict';var multer=require(_0x79b9('0x0'));var util=require('util');var path=require(_0x79b9('0x1'));var timeout=require(_0x79b9('0x2'));var express=require(_0x79b9('0x3'));var router=express[_0x79b9('0x4')]();var fs_extra=require(_0x79b9('0x5'));var auth=require(_0x79b9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b9('0x7'));router[_0x79b9('0x8')]('/',auth[_0x79b9('0x9')](),controller['index']);router[_0x79b9('0x8')](_0x79b9('0xa'),auth['isAuthenticated'](),controller[_0x79b9('0xb')]);router[_0x79b9('0x8')](_0x79b9('0xc'),auth[_0x79b9('0x9')](),controller[_0x79b9('0xd')]);router['get']('/:id/fields',auth[_0x79b9('0x9')](),controller[_0x79b9('0xe')]);router[_0x79b9('0xf')]('/',auth[_0x79b9('0x9')](),controller[_0x79b9('0x10')]);router[_0x79b9('0xf')](_0x79b9('0xc'),auth[_0x79b9('0x9')](),controller[_0x79b9('0x11')]);router[_0x79b9('0x12')](_0x79b9('0xa'),auth['isAuthenticated'](),controller[_0x79b9('0x13')]);router[_0x79b9('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x79b9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0b99d09..a06f1dd 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 _0x68fd=['token','integrationTab','newTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x144add,_0x5352a0){var _0x4e9376=function(_0x5c2b3d){while(--_0x5c2b3d){_0x144add['push'](_0x144add['shift']());}};_0x4e9376(++_0x5352a0);}(_0x68fd,0x1e9));var _0xd68f=function(_0x43a54b,_0x2d2560){_0x43a54b=_0x43a54b-0x0;var _0x6d5dcf=_0x68fd[_0x43a54b];return _0x6d5dcf;};'use strict';var Sequelize=require(_0xd68f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd68f('0x1')]},'description':{'type':Sequelize[_0xd68f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xd68f('0x2')},'password':{'type':Sequelize[_0xd68f('0x1')]},'token':{'type':Sequelize[_0xd68f('0x1')]},'remoteUri':{'type':Sequelize[_0xd68f('0x1')],'unique':_0xd68f('0x3')},'authType':{'type':Sequelize[_0xd68f('0x4')](_0xd68f('0x5'),_0xd68f('0x6')),'defaultValue':_0xd68f('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd68f('0x4')](_0xd68f('0x7'),_0xd68f('0x8')),'defaultValue':_0xd68f('0x7')}}; \ No newline at end of file +var _0x9ab8=['token','integrationTab','newTab','sequelize','exports','STRING','username','ENUM','password'];(function(_0x3214ca,_0x4053d7){var _0x4e756e=function(_0x3244f1){while(--_0x3244f1){_0x3214ca['push'](_0x3214ca['shift']());}};_0x4e756e(++_0x4053d7);}(_0x9ab8,0x81));var _0x89ab=function(_0x3cf411,_0x1fd3c2){_0x3cf411=_0x3cf411-0x0;var _0x50b85d=_0x9ab8[_0x3cf411];return _0x50b85d;};'use strict';var Sequelize=require(_0x89ab('0x0'));module[_0x89ab('0x1')]={'name':{'type':Sequelize[_0x89ab('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x89ab('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x89ab('0x2')]},'remoteUri':{'type':Sequelize[_0x89ab('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x5'),_0x89ab('0x6')),'defaultValue':_0x89ab('0x5')},'serverUrl':{'type':Sequelize[_0x89ab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x89ab('0x4')](_0x89ab('0x7'),_0x89ab('0x8')),'defaultValue':_0x89ab('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a185879..b4035ce 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 _0x04b8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','catch','keys','include','find','create','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x18c575,_0x38d6ce){var _0xea22b2=function(_0x30a41d){while(--_0x30a41d){_0x18c575['push'](_0x18c575['shift']());}};_0xea22b2(++_0x38d6ce);}(_0x04b8,0x159));var _0x804b=function(_0x2e7cb8,_0x282d99){_0x2e7cb8=_0x2e7cb8-0x0;var _0x89bfc6=_0x04b8[_0x2e7cb8];return _0x89bfc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x804b('0x18'));function respondWithStatusCode(_0x5303cc,_0x23ee57){_0x23ee57=_0x23ee57||0xcc;return function(_0x3a2702){if(_0x3a2702){return _0x5303cc[_0x804b('0x19')](_0x23ee57);}return _0x5303cc[_0x804b('0x1a')](_0x23ee57)['end']();};}function respondWithResult(_0x215825,_0x1b01a7){_0x1b01a7=_0x1b01a7||0xc8;return function(_0x274bb8){if(_0x274bb8){return _0x215825[_0x804b('0x1a')](_0x1b01a7)['json'](_0x274bb8);}};}function respondWithFilteredResult(_0x2fd593,_0x8ccbe0){return function(_0x5e1cfe){if(_0x5e1cfe){var _0x3c5986=typeof _0x8ccbe0['offset']===_0x804b('0x1b')&&typeof _0x8ccbe0[_0x804b('0x1c')]===_0x804b('0x1b');var _0x1760f8=_0x5e1cfe[_0x804b('0x1d')];var _0x5a0a82=_0x3c5986?0x0:_0x8ccbe0[_0x804b('0x1e')];var _0x50b4fe=_0x3c5986?_0x5e1cfe[_0x804b('0x1d')]:_0x8ccbe0[_0x804b('0x1e')]+_0x8ccbe0[_0x804b('0x1c')];var _0x469251;if(_0x50b4fe>=_0x1760f8){_0x50b4fe=_0x1760f8;_0x469251=0xc8;}else{_0x469251=0xce;}_0x2fd593['status'](_0x469251);return _0x2fd593[_0x804b('0x1f')](_0x804b('0x20'),_0x5a0a82+'-'+_0x50b4fe+'/'+_0x1760f8)[_0x804b('0x21')](_0x5e1cfe);}return null;};}function patchUpdates(_0x11eaf6){return function(_0x27844b){try{jsonpatch[_0x804b('0x22')](_0x27844b,_0x11eaf6,!![]);}catch(_0x3241a0){return BPromise[_0x804b('0x23')](_0x3241a0);}return _0x27844b[_0x804b('0x24')]();};}function saveUpdates(_0x2b7271,_0x1acc48){return function(_0x5a968b){if(_0x5a968b){return _0x5a968b[_0x804b('0x25')](_0x2b7271)[_0x804b('0x26')](function(_0x5585f8){return _0x5585f8;});}return null;};}function removeEntity(_0x44a921,_0x367024){return function(_0x115b8f){if(_0x115b8f){return _0x115b8f[_0x804b('0x27')]()[_0x804b('0x26')](function(){_0x44a921['status'](0xcc)[_0x804b('0x28')]();});}};}function handleEntityNotFound(_0x7d9c33,_0x4e7266){return function(_0x12b6a6){if(!_0x12b6a6){_0x7d9c33[_0x804b('0x19')](0x194);}return _0x12b6a6;};}function handleError(_0x1117a5,_0x27d5ec){_0x27d5ec=_0x27d5ec||0x1f4;return function(_0x2d88da){logger['error'](_0x2d88da[_0x804b('0x29')]);if(_0x2d88da[_0x804b('0x2a')]){delete _0x2d88da[_0x804b('0x2a')];}_0x1117a5[_0x804b('0x1a')](_0x27d5ec)[_0x804b('0x2b')](_0x2d88da);};}exports['index']=function(_0x3eb531,_0x2931ff){var _0x410871={},_0x5c7026={},_0x3dbd41={'count':0x0,'rows':[]};var _0x407357=_[_0x804b('0x2c')](db['ZendeskAccount'][_0x804b('0x2d')],function(_0x471c04){return{'name':_0x471c04['fieldName'],'type':_0x471c04[_0x804b('0x2e')][_0x804b('0x2f')]};});_0x5c7026[_0x804b('0x30')]=_[_0x804b('0x2c')](_0x407357,_0x804b('0x2a'));_0x5c7026[_0x804b('0x31')]=_['keys'](_0x3eb531[_0x804b('0x31')]);_0x5c7026[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],_0x5c7026[_0x804b('0x31')]);_0x410871[_0x804b('0x34')]=_[_0x804b('0x33')](_0x5c7026[_0x804b('0x30')],qs[_0x804b('0x35')](_0x3eb531[_0x804b('0x31')][_0x804b('0x35')]));_0x410871[_0x804b('0x34')]=_0x410871[_0x804b('0x34')][_0x804b('0x36')]?_0x410871[_0x804b('0x34')]:_0x5c7026[_0x804b('0x30')];if(!_0x3eb531[_0x804b('0x31')][_0x804b('0x37')](_0x804b('0x38'))){_0x410871[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3eb531[_0x804b('0x31')][_0x804b('0x1c')]);_0x410871[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3eb531['query']['offset']);}_0x410871['order']=qs[_0x804b('0x39')](_0x3eb531[_0x804b('0x31')][_0x804b('0x39')]);_0x410871['where']=qs['filters'](_['pick'](_0x3eb531[_0x804b('0x31')],_0x5c7026[_0x804b('0x32')]),_0x407357);if(_0x3eb531[_0x804b('0x31')][_0x804b('0x3a')]){_0x410871[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x410871[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x407357,function(_0x27ba88){if(_0x27ba88[_0x804b('0x2e')]!==_0x804b('0x3d')){var _0x22a3fa={};_0x22a3fa[_0x27ba88[_0x804b('0x2a')]]={'$like':'%'+_0x3eb531['query'][_0x804b('0x3a')]+'%'};return _0x22a3fa;}})});}_0x410871=_[_0x804b('0x3c')]({},_0x410871,_0x3eb531[_0x804b('0x3e')]);var _0x3d6d8a={'where':_0x410871[_0x804b('0x3b')]};return db['ZendeskAccount']['count'](_0x3d6d8a)[_0x804b('0x26')](function(_0x2afafd){_0x3dbd41[_0x804b('0x1d')]=_0x2afafd;if(_0x3eb531['query'][_0x804b('0x3f')]){_0x410871['include']=[{'all':!![]}];}return db[_0x804b('0x40')][_0x804b('0x41')](_0x410871);})[_0x804b('0x26')](function(_0x304710){_0x3dbd41[_0x804b('0x42')]=_0x304710;return _0x3dbd41;})[_0x804b('0x26')](respondWithFilteredResult(_0x2931ff,_0x410871))[_0x804b('0x43')](handleError(_0x2931ff,null));};exports['show']=function(_0x17972a,_0x1c0363){var _0x1dcec8={'raw':![],'where':{'id':_0x17972a['params']['id']}},_0x1d25f6={};_0x1d25f6[_0x804b('0x30')]=_[_0x804b('0x44')](db[_0x804b('0x40')][_0x804b('0x2d')]);_0x1d25f6[_0x804b('0x31')]=_[_0x804b('0x44')](_0x17972a[_0x804b('0x31')]);_0x1d25f6[_0x804b('0x32')]=_['intersection'](_0x1d25f6[_0x804b('0x30')],_0x1d25f6['query']);_0x1dcec8['attributes']=_['intersection'](_0x1d25f6[_0x804b('0x30')],qs['fields'](_0x17972a[_0x804b('0x31')][_0x804b('0x35')]));_0x1dcec8[_0x804b('0x34')]=_0x1dcec8[_0x804b('0x34')]['length']?_0x1dcec8[_0x804b('0x34')]:_0x1d25f6[_0x804b('0x30')];if(_0x17972a[_0x804b('0x31')]['includeAll']){_0x1dcec8[_0x804b('0x45')]=[{'all':!![]}];}_0x1dcec8=_[_0x804b('0x3c')]({},_0x1dcec8,_0x17972a[_0x804b('0x3e')]);return db['ZendeskAccount'][_0x804b('0x46')](_0x1dcec8)[_0x804b('0x26')](handleEntityNotFound(_0x1c0363,null))[_0x804b('0x26')](respondWithResult(_0x1c0363,null))[_0x804b('0x43')](handleError(_0x1c0363,null));};exports[_0x804b('0x47')]=function(_0x3a39f5,_0x392bc0){return db[_0x804b('0x40')][_0x804b('0x47')](_0x3a39f5[_0x804b('0x48')],{})[_0x804b('0x26')](respondWithResult(_0x392bc0,0xc9))[_0x804b('0x43')](handleError(_0x392bc0,null));};exports[_0x804b('0x25')]=function(_0x2c1796,_0x578e92){if(_0x2c1796['body']['id']){delete _0x2c1796[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x46')]({'where':{'id':_0x2c1796[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x578e92,null))['then'](saveUpdates(_0x2c1796[_0x804b('0x48')],null))[_0x804b('0x26')](respondWithResult(_0x578e92,null))[_0x804b('0x43')](handleError(_0x578e92,null));};exports[_0x804b('0x27')]=function(_0x47247c,_0x111e3f){return db['ZendeskAccount']['find']({'where':{'id':_0x47247c[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x111e3f,null))['then'](removeEntity(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x804b('0x4a')]=function(_0x3d56bb,_0x4a5068,_0x4efe2a){var _0x164c5d={};var _0x38c2c0={};var _0x54cc99;var _0x2756de;return db['ZendeskAccount'][_0x804b('0x4b')]({'where':{'id':_0x3d56bb['params']['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4a5068,null))[_0x804b('0x26')](function(_0x47c835){if(_0x47c835){_0x54cc99=_0x47c835;_0x38c2c0[_0x804b('0x30')]=_['keys'](db[_0x804b('0x4c')][_0x804b('0x2d')]);_0x38c2c0[_0x804b('0x31')]=_[_0x804b('0x44')](_0x3d56bb[_0x804b('0x31')]);_0x38c2c0[_0x804b('0x32')]=_[_0x804b('0x33')](_0x38c2c0[_0x804b('0x30')],_0x38c2c0[_0x804b('0x31')]);_0x164c5d[_0x804b('0x34')]=_['intersection'](_0x38c2c0['model'],qs[_0x804b('0x35')](_0x3d56bb['query']['fields']));_0x164c5d[_0x804b('0x34')]=_0x164c5d[_0x804b('0x34')][_0x804b('0x36')]?_0x164c5d[_0x804b('0x34')]:_0x38c2c0['model'];_0x164c5d['order']=qs[_0x804b('0x39')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x39')]);_0x164c5d[_0x804b('0x3b')]=qs[_0x804b('0x32')](_[_0x804b('0x4d')](_0x3d56bb[_0x804b('0x31')],_0x38c2c0[_0x804b('0x32')]));if(_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]){_0x164c5d[_0x804b('0x3b')]=_[_0x804b('0x3c')](_0x164c5d[_0x804b('0x3b')],{'$or':_[_0x804b('0x2c')](_0x164c5d[_0x804b('0x34')],function(_0x3d98a2){var _0x524291={};_0x524291[_0x3d98a2]={'$like':'%'+_0x3d56bb[_0x804b('0x31')][_0x804b('0x3a')]+'%'};return _0x524291;})});}_0x164c5d=_['merge']({},_0x164c5d,_0x3d56bb[_0x804b('0x3e')]);return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})[_0x804b('0x26')](function(_0x2576a4){if(_0x2576a4){_0x2756de=_0x2576a4['length'];if(!_0x3d56bb[_0x804b('0x31')][_0x804b('0x37')]('nolimit')){_0x164c5d[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x3d56bb[_0x804b('0x31')]['limit']);_0x164c5d[_0x804b('0x1e')]=qs[_0x804b('0x1e')](_0x3d56bb[_0x804b('0x31')][_0x804b('0x1e')]);}return _0x54cc99[_0x804b('0x4a')](_0x164c5d);}})['then'](function(_0xb08c4e){if(_0xb08c4e){return _0xb08c4e?{'count':_0x2756de,'rows':_0xb08c4e}:null;}})[_0x804b('0x26')](respondWithResult(_0x4a5068,null))[_0x804b('0x43')](handleError(_0x4a5068,null));};exports[_0x804b('0x4e')]=function(_0x5dcc63,_0x4f8a81,_0x183796){if(_0x5dcc63['body']['id']){delete _0x5dcc63[_0x804b('0x48')]['id'];}return db[_0x804b('0x40')][_0x804b('0x4b')]({'where':{'id':_0x5dcc63[_0x804b('0x49')]['id']}})[_0x804b('0x26')](handleEntityNotFound(_0x4f8a81,null))['then'](function(_0x27f06c){if(_0x27f06c){_0x5dcc63[_0x804b('0x48')][_0x804b('0x4f')]=_0x27f06c['id'];_0x5dcc63['body'][_0x804b('0x50')]=integrations[_0x804b('0x51')](_0x5dcc63['body'][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);_0x5dcc63[_0x804b('0x48')]['Descriptions']=integrations[_0x804b('0x53')](_0x5dcc63[_0x804b('0x48')][_0x804b('0x52')],_0x5dcc63['body'][_0x804b('0x2e')]);return db['ZendeskConfiguration'][_0x804b('0x47')](_0x5dcc63[_0x804b('0x48')],{'include':[{'model':db[_0x804b('0x54')],'as':_0x804b('0x50')},{'model':db['ZendeskField'],'as':_0x804b('0x55')}]});}return null;})[_0x804b('0x26')](respondWithResult(_0x4f8a81,null))[_0x804b('0x43')](handleError(_0x4f8a81,null));};exports[_0x804b('0x56')]=function(_0x17e21c,_0x1bb4ec,_0x5b3b79){var _0x39ed3c='';return db[_0x804b('0x40')]['findOne']({'where':{'id':_0x17e21c[_0x804b('0x49')]['id']},'attributes':['id',_0x804b('0x57'),_0x804b('0x58'),_0x804b('0x59'),'authType',_0x804b('0x5a')]})[_0x804b('0x26')](handleEntityNotFound(_0x1bb4ec,null))['then'](function(_0x2541cd){if(_0x2541cd){_0x39ed3c=_0x2541cd[_0x804b('0x5a')];var _0x549504=_0x39ed3c[_0x804b('0x5b')](-0x1);if(_0x549504==='/'){_0x39ed3c=_0x39ed3c['substring'](0x0,_0x39ed3c[_0x804b('0x5c')](_0x549504));}var _0x3e2813={'method':_0x804b('0x5d'),'uri':util[_0x804b('0x5e')](_0x804b('0x5f'),_0x39ed3c,_0x804b('0x60')),'json':!![]};switch(_0x2541cd[_0x804b('0x61')]){case'password':_0x3e2813[_0x804b('0x62')]={'Authorization':util['format'](_0x804b('0x63'),new Buffer(util[_0x804b('0x5e')](_0x804b('0x64'),_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x58')]))[_0x804b('0x65')](_0x804b('0x66')))};break;case _0x804b('0x59'):_0x3e2813[_0x804b('0x62')]={'Authorization':util[_0x804b('0x5e')](_0x804b('0x63'),new Buffer(util['format']('%s/token:%s',_0x2541cd[_0x804b('0x57')],_0x2541cd[_0x804b('0x59')]))[_0x804b('0x65')](_0x804b('0x66')))};break;default:throw new db['Sequelize'][(_0x804b('0x67'))](_0x804b('0x68'));}return rp(_0x3e2813);}})[_0x804b('0x26')](function(_0x3dda89){if(_0x3dda89){var _0x260419=[_0x804b('0x69'),_0x804b('0x6a'),_0x804b('0x6b'),_0x804b('0x6c')];_[_0x804b('0x6d')](_0x3dda89['ticket_fields'],function(_0x5a6661){return _0x260419[_0x804b('0x6e')](_0x5a6661[_0x804b('0x2e')]);});return{'count':_0x3dda89['ticket_fields'][_0x804b('0x36')],'rows':_[_0x804b('0x2c')](_0x3dda89['ticket_fields'],function(_0x345bf7){return{'id':_0x345bf7['id'],'name':_0x345bf7['position']>0x7?_0x345bf7['title']:_0x345bf7[_0x804b('0x2e')],'custom':_0x345bf7[_0x804b('0x6f')]>0x7?!![]:![],'options':_0x345bf7['system_field_options']?_0x345bf7['system_field_options']:_0x345bf7[_0x804b('0x70')]?_0x345bf7[_0x804b('0x70')]:[]};})};}})['then'](respondWithResult(_0x1bb4ec,null))[_0x804b('0x43')](function(_0x5e2756){var _0x42dfc3=_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?0x1f4:_0x5e2756['statusCode']||0x1f4;logger[_0x804b('0x72')](_0x804b('0x73'),_0x804b('0x56'),_0x42dfc3,JSON[_0x804b('0x74')](_0x5e2756));delete _0x5e2756[_0x804b('0x2a')];if(_0x42dfc3===0x191){_0x42dfc3=0x190;}_0x1bb4ec[_0x804b('0x1a')](_0x42dfc3)[_0x804b('0x2b')](_0x17e21c[_0x804b('0x31')][_0x804b('0x71')]?{'message':_0x804b('0x75'),'statusCode':_0x5e2756['statusCode']}:_0x5e2756);});}; \ No newline at end of file +var _0xa478=['ZendeskAccount','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','index','map'];(function(_0x36fe12,_0x19dc5b){var _0x1e5c91=function(_0x4063f4){while(--_0x4063f4){_0x36fe12['push'](_0x36fe12['shift']());}};_0x1e5c91(++_0x19dc5b);}(_0xa478,0x136));var _0x8a47=function(_0x477c0c,_0x48b400){_0x477c0c=_0x477c0c-0x0;var _0x37d540=_0xa478[_0x477c0c];return _0x37d540;};'use strict';var emlformat=require(_0x8a47('0x0'));var rimraf=require(_0x8a47('0x1'));var zipdir=require(_0x8a47('0x2'));var jsonpatch=require(_0x8a47('0x3'));var rp=require(_0x8a47('0x4'));var moment=require(_0x8a47('0x5'));var BPromise=require(_0x8a47('0x6'));var Mustache=require(_0x8a47('0x7'));var util=require(_0x8a47('0x8'));var path=require(_0x8a47('0x9'));var sox=require(_0x8a47('0xa'));var csv=require(_0x8a47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a47('0xc'));var _=require(_0x8a47('0xd'));var squel=require(_0x8a47('0xe'));var crypto=require(_0x8a47('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8a47('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8a47('0x11'));var Papa=require(_0x8a47('0x12'));var Redis=require(_0x8a47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x8a47('0x14'));var as=require(_0x8a47('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a47('0x16'))('api');var utils=require(_0x8a47('0x17'));var config=require(_0x8a47('0x18'));var licenseUtil=require(_0x8a47('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x59efc7,_0x36941a){_0x36941a=_0x36941a||0xcc;return function(_0x12539c){if(_0x12539c){return _0x59efc7['sendStatus'](_0x36941a);}return _0x59efc7[_0x8a47('0x1a')](_0x36941a)[_0x8a47('0x1b')]();};}function respondWithResult(_0x1a9a6f,_0x55985c){_0x55985c=_0x55985c||0xc8;return function(_0x1c23e3){if(_0x1c23e3){return _0x1a9a6f[_0x8a47('0x1a')](_0x55985c)[_0x8a47('0x1c')](_0x1c23e3);}};}function respondWithFilteredResult(_0x1c8488,_0x41bdaf){return function(_0x18f2be){if(_0x18f2be){var _0x26fd48=typeof _0x41bdaf[_0x8a47('0x1d')]===_0x8a47('0x1e')&&typeof _0x41bdaf['limit']===_0x8a47('0x1e');var _0x1d0b04=_0x18f2be[_0x8a47('0x1f')];var _0x5f5884=_0x26fd48?0x0:_0x41bdaf[_0x8a47('0x1d')];var _0x5c62eb=_0x26fd48?_0x18f2be['count']:_0x41bdaf[_0x8a47('0x1d')]+_0x41bdaf[_0x8a47('0x20')];var _0x158e0c;if(_0x5c62eb>=_0x1d0b04){_0x5c62eb=_0x1d0b04;_0x158e0c=0xc8;}else{_0x158e0c=0xce;}_0x1c8488[_0x8a47('0x1a')](_0x158e0c);return _0x1c8488[_0x8a47('0x21')](_0x8a47('0x22'),_0x5f5884+'-'+_0x5c62eb+'/'+_0x1d0b04)[_0x8a47('0x1c')](_0x18f2be);}return null;};}function patchUpdates(_0x1bbed6){return function(_0x2b88a7){try{jsonpatch[_0x8a47('0x23')](_0x2b88a7,_0x1bbed6,!![]);}catch(_0x54ce6a){return BPromise[_0x8a47('0x24')](_0x54ce6a);}return _0x2b88a7['save']();};}function saveUpdates(_0x289f28,_0x3d7993){return function(_0x36908d){if(_0x36908d){return _0x36908d[_0x8a47('0x25')](_0x289f28)['then'](function(_0x116b5e){return _0x116b5e;});}return null;};}function removeEntity(_0x5ae186,_0x50f6ba){return function(_0x4d71f4){if(_0x4d71f4){return _0x4d71f4['destroy']()[_0x8a47('0x26')](function(){_0x5ae186[_0x8a47('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bb0d4,_0xb4590d){return function(_0x42dae1){if(!_0x42dae1){_0x2bb0d4[_0x8a47('0x27')](0x194);}return _0x42dae1;};}function handleError(_0x44cf20,_0xd06be6){_0xd06be6=_0xd06be6||0x1f4;return function(_0x24a20b){logger['error'](_0x24a20b[_0x8a47('0x28')]);if(_0x24a20b['name']){delete _0x24a20b[_0x8a47('0x29')];}_0x44cf20[_0x8a47('0x1a')](_0xd06be6)['send'](_0x24a20b);};}exports[_0x8a47('0x2a')]=function(_0x526571,_0x4d5d32){var _0x12470a={},_0x9b51b8={},_0x1ddbcf={'count':0x0,'rows':[]};var _0x12f0b7=_[_0x8a47('0x2b')](db[_0x8a47('0x2c')]['rawAttributes'],function(_0x353576){return{'name':_0x353576['fieldName'],'type':_0x353576['type'][_0x8a47('0x2d')]};});_0x9b51b8[_0x8a47('0x2e')]=_[_0x8a47('0x2b')](_0x12f0b7,_0x8a47('0x29'));_0x9b51b8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x526571[_0x8a47('0x2f')]);_0x9b51b8[_0x8a47('0x31')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],_0x9b51b8['query']);_0x12470a[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x9b51b8[_0x8a47('0x2e')],qs['fields'](_0x526571[_0x8a47('0x2f')][_0x8a47('0x34')]));_0x12470a['attributes']=_0x12470a[_0x8a47('0x33')][_0x8a47('0x35')]?_0x12470a[_0x8a47('0x33')]:_0x9b51b8[_0x8a47('0x2e')];if(!_0x526571['query']['hasOwnProperty'](_0x8a47('0x36'))){_0x12470a[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x20')]);_0x12470a[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x526571['query']['offset']);}_0x12470a[_0x8a47('0x37')]=qs[_0x8a47('0x38')](_0x526571[_0x8a47('0x2f')][_0x8a47('0x38')]);_0x12470a[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x526571[_0x8a47('0x2f')],_0x9b51b8[_0x8a47('0x31')]),_0x12f0b7);if(_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0x12470a['where']=_[_0x8a47('0x3c')](_0x12470a['where'],{'$or':_['map'](_0x12f0b7,function(_0x544fe2){if(_0x544fe2['type']!=='VIRTUAL'){var _0x3edb2e={};_0x3edb2e[_0x544fe2[_0x8a47('0x29')]]={'$like':'%'+_0x526571[_0x8a47('0x2f')][_0x8a47('0x3b')]+'%'};return _0x3edb2e;}})});}_0x12470a=_[_0x8a47('0x3c')]({},_0x12470a,_0x526571[_0x8a47('0x3d')]);var _0x25c45b={'where':_0x12470a[_0x8a47('0x39')]};return db['ZendeskAccount']['count'](_0x25c45b)[_0x8a47('0x26')](function(_0x437b86){_0x1ddbcf[_0x8a47('0x1f')]=_0x437b86;if(_0x526571[_0x8a47('0x2f')]['includeAll']){_0x12470a[_0x8a47('0x3e')]=[{'all':!![]}];}return db[_0x8a47('0x2c')][_0x8a47('0x3f')](_0x12470a);})[_0x8a47('0x26')](function(_0x1ef057){_0x1ddbcf['rows']=_0x1ef057;return _0x1ddbcf;})[_0x8a47('0x26')](respondWithFilteredResult(_0x4d5d32,_0x12470a))[_0x8a47('0x40')](handleError(_0x4d5d32,null));};exports[_0x8a47('0x41')]=function(_0x5d23ed,_0x2b3874){var _0x2c70ea={'raw':![],'where':{'id':_0x5d23ed[_0x8a47('0x42')]['id']}},_0xf313ec={};_0xf313ec['model']=_[_0x8a47('0x30')](db[_0x8a47('0x2c')][_0x8a47('0x43')]);_0xf313ec[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x5d23ed[_0x8a47('0x2f')]);_0xf313ec['filters']=_['intersection'](_0xf313ec[_0x8a47('0x2e')],_0xf313ec[_0x8a47('0x2f')]);_0x2c70ea[_0x8a47('0x33')]=_['intersection'](_0xf313ec[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x5d23ed['query']['fields']));_0x2c70ea[_0x8a47('0x33')]=_0x2c70ea['attributes'][_0x8a47('0x35')]?_0x2c70ea[_0x8a47('0x33')]:_0xf313ec[_0x8a47('0x2e')];if(_0x5d23ed[_0x8a47('0x2f')][_0x8a47('0x44')]){_0x2c70ea[_0x8a47('0x3e')]=[{'all':!![]}];}_0x2c70ea=_['merge']({},_0x2c70ea,_0x5d23ed['options']);return db[_0x8a47('0x2c')][_0x8a47('0x45')](_0x2c70ea)[_0x8a47('0x26')](handleEntityNotFound(_0x2b3874,null))[_0x8a47('0x26')](respondWithResult(_0x2b3874,null))[_0x8a47('0x40')](handleError(_0x2b3874,null));};exports['create']=function(_0x4898d0,_0x17a755){return db['ZendeskAccount'][_0x8a47('0x46')](_0x4898d0[_0x8a47('0x47')],{})['then'](respondWithResult(_0x17a755,0xc9))[_0x8a47('0x40')](handleError(_0x17a755,null));};exports[_0x8a47('0x25')]=function(_0x14e22c,_0x108c7f){if(_0x14e22c[_0x8a47('0x47')]['id']){delete _0x14e22c[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0x14e22c['params']['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x108c7f,null))[_0x8a47('0x26')](saveUpdates(_0x14e22c[_0x8a47('0x47')],null))[_0x8a47('0x26')](respondWithResult(_0x108c7f,null))['catch'](handleError(_0x108c7f,null));};exports[_0x8a47('0x48')]=function(_0xa428dd,_0x24e123){return db[_0x8a47('0x2c')][_0x8a47('0x45')]({'where':{'id':_0xa428dd[_0x8a47('0x42')]['id']}})['then'](handleEntityNotFound(_0x24e123,null))['then'](removeEntity(_0x24e123,null))[_0x8a47('0x40')](handleError(_0x24e123,null));};exports['getConfigurations']=function(_0x1da8b7,_0x175023,_0x5a1b29){var _0xb05ed1={};var _0x4bf9a8={};var _0x315111;var _0x5c5577;return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x1da8b7[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x175023,null))[_0x8a47('0x26')](function(_0x144ce6){if(_0x144ce6){_0x315111=_0x144ce6;_0x4bf9a8[_0x8a47('0x2e')]=_[_0x8a47('0x30')](db[_0x8a47('0x49')][_0x8a47('0x43')]);_0x4bf9a8[_0x8a47('0x2f')]=_[_0x8a47('0x30')](_0x1da8b7[_0x8a47('0x2f')]);_0x4bf9a8['filters']=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],_0x4bf9a8['query']);_0xb05ed1[_0x8a47('0x33')]=_[_0x8a47('0x32')](_0x4bf9a8[_0x8a47('0x2e')],qs[_0x8a47('0x34')](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x34')]));_0xb05ed1[_0x8a47('0x33')]=_0xb05ed1[_0x8a47('0x33')][_0x8a47('0x35')]?_0xb05ed1[_0x8a47('0x33')]:_0x4bf9a8[_0x8a47('0x2e')];_0xb05ed1[_0x8a47('0x37')]=qs['sort'](_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x38')]);_0xb05ed1[_0x8a47('0x39')]=qs[_0x8a47('0x31')](_[_0x8a47('0x3a')](_0x1da8b7[_0x8a47('0x2f')],_0x4bf9a8[_0x8a47('0x31')]));if(_0x1da8b7[_0x8a47('0x2f')][_0x8a47('0x3b')]){_0xb05ed1[_0x8a47('0x39')]=_[_0x8a47('0x3c')](_0xb05ed1[_0x8a47('0x39')],{'$or':_[_0x8a47('0x2b')](_0xb05ed1[_0x8a47('0x33')],function(_0x2edcaf){var _0x7664a8={};_0x7664a8[_0x2edcaf]={'$like':'%'+_0x1da8b7['query'][_0x8a47('0x3b')]+'%'};return _0x7664a8;})});}_0xb05ed1=_['merge']({},_0xb05ed1,_0x1da8b7[_0x8a47('0x3d')]);return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x21fdb5){if(_0x21fdb5){_0x5c5577=_0x21fdb5[_0x8a47('0x35')];if(!_0x1da8b7[_0x8a47('0x2f')]['hasOwnProperty'](_0x8a47('0x36'))){_0xb05ed1[_0x8a47('0x20')]=qs[_0x8a47('0x20')](_0x1da8b7['query']['limit']);_0xb05ed1[_0x8a47('0x1d')]=qs[_0x8a47('0x1d')](_0x1da8b7['query'][_0x8a47('0x1d')]);}return _0x315111[_0x8a47('0x4a')](_0xb05ed1);}})[_0x8a47('0x26')](function(_0x17f20f){if(_0x17f20f){return _0x17f20f?{'count':_0x5c5577,'rows':_0x17f20f}:null;}})[_0x8a47('0x26')](respondWithResult(_0x175023,null))[_0x8a47('0x40')](handleError(_0x175023,null));};exports[_0x8a47('0x4b')]=function(_0x2932f1,_0x99848c,_0x1b834a){if(_0x2932f1[_0x8a47('0x47')]['id']){delete _0x2932f1[_0x8a47('0x47')]['id'];}return db[_0x8a47('0x2c')]['findOne']({'where':{'id':_0x2932f1[_0x8a47('0x42')]['id']}})[_0x8a47('0x26')](handleEntityNotFound(_0x99848c,null))[_0x8a47('0x26')](function(_0x13a002){if(_0x13a002){_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4c')]=_0x13a002['id'];_0x2932f1['body'][_0x8a47('0x4d')]=integrations['getSubjects'](_0x2932f1['body'][_0x8a47('0x4e')],_0x2932f1[_0x8a47('0x47')][_0x8a47('0x4f')]);_0x2932f1[_0x8a47('0x47')][_0x8a47('0x50')]=integrations[_0x8a47('0x51')](_0x2932f1['body']['channel'],_0x2932f1[_0x8a47('0x47')]['type']);return db[_0x8a47('0x49')][_0x8a47('0x46')](_0x2932f1[_0x8a47('0x47')],{'include':[{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x4d')},{'model':db[_0x8a47('0x52')],'as':_0x8a47('0x50')}]});}return null;})[_0x8a47('0x26')](respondWithResult(_0x99848c,null))['catch'](handleError(_0x99848c,null));};exports['getFields']=function(_0x435039,_0x131176,_0x2761bf){var _0x5d6ebc='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x435039[_0x8a47('0x42')]['id']},'attributes':['id','username',_0x8a47('0x53'),_0x8a47('0x54'),_0x8a47('0x55'),_0x8a47('0x56')]})['then'](handleEntityNotFound(_0x131176,null))[_0x8a47('0x26')](function(_0x55c590){if(_0x55c590){_0x5d6ebc=_0x55c590[_0x8a47('0x56')];var _0x430ee2=_0x5d6ebc[_0x8a47('0x57')](-0x1);if(_0x430ee2==='/'){_0x5d6ebc=_0x5d6ebc['substring'](0x0,_0x5d6ebc[_0x8a47('0x58')](_0x430ee2));}var _0x3f53ba={'method':'GET','uri':util[_0x8a47('0x59')](_0x8a47('0x5a'),_0x5d6ebc,_0x8a47('0x5b')),'json':!![]};switch(_0x55c590[_0x8a47('0x55')]){case _0x8a47('0x53'):_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util['format'](_0x8a47('0x5e'),_0x55c590[_0x8a47('0x5f')],_0x55c590['password']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;case'token':_0x3f53ba[_0x8a47('0x5c')]={'Authorization':util[_0x8a47('0x59')](_0x8a47('0x5d'),new Buffer(util[_0x8a47('0x59')](_0x8a47('0x62'),_0x55c590['username'],_0x55c590['token']))[_0x8a47('0x60')](_0x8a47('0x61')))};break;default:throw new db[(_0x8a47('0x63'))][(_0x8a47('0x64'))](_0x8a47('0x65'));}return rp(_0x3f53ba);}})[_0x8a47('0x26')](function(_0x34bb61){if(_0x34bb61){var _0x4845fa=[_0x8a47('0x66'),_0x8a47('0x67'),_0x8a47('0x68'),'assignee'];_[_0x8a47('0x69')](_0x34bb61[_0x8a47('0x5b')],function(_0xa2ea5c){return _0x4845fa[_0x8a47('0x6a')](_0xa2ea5c[_0x8a47('0x4f')]);});return{'count':_0x34bb61[_0x8a47('0x5b')][_0x8a47('0x35')],'rows':_[_0x8a47('0x2b')](_0x34bb61['ticket_fields'],function(_0x509e91){return{'id':_0x509e91['id'],'name':_0x509e91[_0x8a47('0x6b')]>0x7?_0x509e91[_0x8a47('0x6c')]:_0x509e91[_0x8a47('0x4f')],'custom':_0x509e91['position']>0x7?!![]:![],'options':_0x509e91[_0x8a47('0x6d')]?_0x509e91[_0x8a47('0x6d')]:_0x509e91[_0x8a47('0x6e')]?_0x509e91[_0x8a47('0x6e')]:[]};})};}})[_0x8a47('0x26')](respondWithResult(_0x131176,null))[_0x8a47('0x40')](function(_0x18def4){var _0x2a2379=_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?0x1f4:_0x18def4[_0x8a47('0x70')]||0x1f4;logger[_0x8a47('0x71')]('getFields,\x20%s,\x20%s,\x20%s',_0x8a47('0x72'),_0x2a2379,JSON[_0x8a47('0x73')](_0x18def4));delete _0x18def4[_0x8a47('0x29')];if(_0x2a2379===0x191){_0x2a2379=0x190;}_0x131176[_0x8a47('0x1a')](_0x2a2379)[_0x8a47('0x74')](_0x435039[_0x8a47('0x2f')][_0x8a47('0x6f')]?{'message':_0x8a47('0x75'),'statusCode':_0x18def4[_0x8a47('0x70')]}:_0x18def4);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0a4f282..91f573f 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 _0xafd8=['rimraf','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x61516f,_0x2b211d){var _0xd68d1c=function(_0x423116){while(--_0x423116){_0x61516f['push'](_0x61516f['shift']());}};_0xd68d1c(++_0x2b211d);}(_0xafd8,0x1b2));var _0x8afd=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0xafd8[_0xf64e53];return _0x1e185e;};'use strict';var _=require(_0x8afd('0x0'));var util=require(_0x8afd('0x1'));var logger=require(_0x8afd('0x2'))(_0x8afd('0x3'));var moment=require('moment');var BPromise=require(_0x8afd('0x4'));var rp=require(_0x8afd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8afd('0x6'));var config=require('../../config/environment');var attributes=require(_0x8afd('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5cdff2,_0x587697){return _0x5cdff2[_0x8afd('0x8')](_0x8afd('0x9'),attributes,{'tableName':_0x8afd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb09=['define','int_zendesk_accounts','lodash','util','moment','bluebird','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x379062,_0x13f012){var _0x4c9d32=function(_0x1b46c0){while(--_0x1b46c0){_0x379062['push'](_0x379062['shift']());}};_0x4c9d32(++_0x13f012);}(_0xcb09,0x1a0));var _0x9cb0=function(_0x3a4ecf,_0x4e9ebf){_0x3a4ecf=_0x3a4ecf-0x0;var _0x557965=_0xcb09[_0x3a4ecf];return _0x557965;};'use strict';var _=require(_0x9cb0('0x0'));var util=require(_0x9cb0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9cb0('0x2'));var BPromise=require(_0x9cb0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9cb0('0x4'));var integrations=require(_0x9cb0('0x5'));module[_0x9cb0('0x6')]=function(_0x513334,_0x559425){return _0x513334[_0x9cb0('0x7')]('ZendeskAccount',attributes,{'tableName':_0x9cb0('0x8'),'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 3733845..70775ce 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 _0x8535=['catch','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','map','model','include','then'];(function(_0x33bab1,_0xe53802){var _0x54b72e=function(_0xf4d7c8){while(--_0xf4d7c8){_0x33bab1['push'](_0x33bab1['shift']());}};_0x54b72e(++_0xe53802);}(_0x8535,0x97));var _0x5853=function(_0x19db3f,_0x39243c){_0x19db3f=_0x19db3f-0x0;var _0x362a10=_0x8535[_0x19db3f];return _0x362a10;};'use strict';var _=require(_0x5853('0x0'));var util=require(_0x5853('0x1'));var moment=require(_0x5853('0x2'));var BPromise=require(_0x5853('0x3'));var rs=require(_0x5853('0x4'));var fs=require('fs');var Redis=require(_0x5853('0x5'));var db=require(_0x5853('0x6'))['db'];var utils=require(_0x5853('0x7'));var logger=require(_0x5853('0x8'))(_0x5853('0x9'));var config=require(_0x5853('0xa'));var jayson=require(_0x5853('0xb'));var client=jayson[_0x5853('0xc')][_0x5853('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x6fdd6b,_0x201250,_0x230c1c){return new BPromise(function(_0xfbad44,_0xcf3fa3){return client['request'](_0x6fdd6b,_0x230c1c)['then'](function(_0x159b7e){logger['info'](_0x5853('0xe'),_0x201250,_0x5853('0xf'));logger[_0x5853('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x201250,_0x5853('0xf'),JSON[_0x5853('0x11')](_0x159b7e));if(_0x159b7e[_0x5853('0x12')]){if(_0x159b7e[_0x5853('0x12')][_0x5853('0x13')]===0x1f4){logger['error'](_0x5853('0xe'),_0x201250,_0x159b7e[_0x5853('0x12')]['message']);return _0xcf3fa3(_0x159b7e[_0x5853('0x12')][_0x5853('0x14')]);}logger[_0x5853('0x12')](_0x5853('0xe'),_0x201250,_0x159b7e['error'][_0x5853('0x14')]);return _0xfbad44(_0x159b7e['error']['message']);}else{logger[_0x5853('0x15')](_0x5853('0xe'),_0x201250,_0x5853('0xf'));_0xfbad44(_0x159b7e[_0x5853('0x16')][_0x5853('0x14')]);}})['catch'](function(_0x5cca10){logger[_0x5853('0x12')](_0x5853('0xe'),_0x201250,_0x5cca10);_0xcf3fa3(_0x5cca10);});});}exports[_0x5853('0x17')]=function(_0x3d0229){var _0x1e487b=this;return new Promise(function(_0xffbdce,_0x2b7d96){return db[_0x5853('0x18')]['findAll']({'raw':_0x3d0229[_0x5853('0x19')]?_0x3d0229['options'][_0x5853('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1b')]||null:null,'attributes':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1c')]||null:null,'limit':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')][_0x5853('0x1d')]||null:null,'include':_0x3d0229[_0x5853('0x19')]?_0x3d0229[_0x5853('0x19')]['include']?_[_0x5853('0x1e')](_0x3d0229[_0x5853('0x19')]['include'],function(_0x2dd518){return{'model':db[_0x2dd518[_0x5853('0x1f')]],'as':_0x2dd518['as'],'attributes':_0x2dd518['attributes'],'include':_0x2dd518[_0x5853('0x20')]?_['map'](_0x2dd518['include'],function(_0x12894a){return{'model':db[_0x12894a['model']],'as':_0x12894a['as'],'attributes':_0x12894a[_0x5853('0x1c')],'include':_0x12894a[_0x5853('0x20')]?_[_0x5853('0x1e')](_0x12894a['include'],function(_0x55a566){return{'model':db[_0x55a566[_0x5853('0x1f')]],'as':_0x55a566['as'],'attributes':_0x55a566[_0x5853('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5853('0x21')](function(_0x1cfe23){logger[_0x5853('0x15')](_0x5853('0x17'),_0x3d0229);logger['debug'](_0x5853('0x17'),_0x3d0229,JSON[_0x5853('0x11')](_0x1cfe23));_0xffbdce(_0x1cfe23);})[_0x5853('0x22')](function(_0x445166){logger[_0x5853('0x12')]('GetZendeskAccount',_0x445166[_0x5853('0x14')],_0x3d0229);_0x2b7d96(_0x1e487b[_0x5853('0x12')](0x1f4,_0x445166[_0x5853('0x14')]));});});};exports[_0x5853('0x23')]=function(_0x359a66){var _0x25e965=this;return new Promise(function(_0x24ec10,_0x1ad1e7){return db[_0x5853('0x18')][_0x5853('0x24')]({'raw':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1a')]===undefined?!![]:![]:!![],'where':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1b')]||null:null,'attributes':_0x359a66['options']?_0x359a66[_0x5853('0x19')][_0x5853('0x1c')]||null:null,'include':_0x359a66[_0x5853('0x19')]?_0x359a66[_0x5853('0x19')][_0x5853('0x20')]?_[_0x5853('0x1e')](_0x359a66[_0x5853('0x19')][_0x5853('0x20')],function(_0x607b84){return{'model':db[_0x607b84['model']],'as':_0x607b84['as'],'attributes':_0x607b84['attributes'],'include':_0x607b84[_0x5853('0x20')]?_['map'](_0x607b84[_0x5853('0x20')],function(_0x1511eb){return{'model':db[_0x1511eb[_0x5853('0x1f')]],'as':_0x1511eb['as'],'attributes':_0x1511eb[_0x5853('0x1c')],'include':_0x1511eb[_0x5853('0x20')]?_[_0x5853('0x1e')](_0x1511eb[_0x5853('0x20')],function(_0x4b7dcd){return{'model':db[_0x4b7dcd[_0x5853('0x1f')]],'as':_0x4b7dcd['as'],'attributes':_0x4b7dcd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5853('0x21')](function(_0x41f82e){logger[_0x5853('0x15')]('ShowZendeskAccount',_0x359a66);logger[_0x5853('0x10')]('ShowZendeskAccount',_0x359a66,JSON[_0x5853('0x11')](_0x41f82e));_0x24ec10(_0x41f82e);})[_0x5853('0x22')](function(_0x48f3f9){logger[_0x5853('0x12')](_0x5853('0x23'),_0x48f3f9[_0x5853('0x14')],_0x359a66);_0x1ad1e7(_0x25e965[_0x5853('0x12')](0x1f4,_0x48f3f9[_0x5853('0x14')]));});});}; \ No newline at end of file +var _0xbb6b=['request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowZendeskAccount','ZendeskAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x12e5d6,_0x5eca1e){var _0x5912d5=function(_0x564cbb){while(--_0x564cbb){_0x12e5d6['push'](_0x12e5d6['shift']());}};_0x5912d5(++_0x5eca1e);}(_0xbb6b,0xea));var _0xbbb6=function(_0x5c5260,_0x47a027){_0x5c5260=_0x5c5260-0x0;var _0x4330fc=_0xbb6b[_0x5c5260];return _0x4330fc;};'use strict';var _=require('lodash');var util=require(_0xbbb6('0x0'));var moment=require(_0xbbb6('0x1'));var BPromise=require('bluebird');var rs=require(_0xbbb6('0x2'));var fs=require('fs');var Redis=require(_0xbbb6('0x3'));var db=require(_0xbbb6('0x4'))['db'];var utils=require(_0xbbb6('0x5'));var logger=require(_0xbbb6('0x6'))(_0xbbb6('0x7'));var config=require(_0xbbb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbb6('0x9')][_0xbbb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3c3c,_0x23bb1a,_0x4d1b2c){return new BPromise(function(_0x2ecb9d,_0x5b5c6f){return client[_0xbbb6('0xb')](_0x5e3c3c,_0x4d1b2c)[_0xbbb6('0xc')](function(_0x297cb0){logger[_0xbbb6('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x23bb1a,_0xbbb6('0xe'));logger[_0xbbb6('0xf')](_0xbbb6('0x10'),_0x23bb1a,_0xbbb6('0xe'),JSON['stringify'](_0x297cb0));if(_0x297cb0[_0xbbb6('0x11')]){if(_0x297cb0[_0xbbb6('0x11')][_0xbbb6('0x12')]===0x1f4){logger['error'](_0xbbb6('0x13'),_0x23bb1a,_0x297cb0[_0xbbb6('0x11')][_0xbbb6('0x14')]);return _0x5b5c6f(_0x297cb0['error']['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x23bb1a,_0x297cb0['error'][_0xbbb6('0x14')]);return _0x2ecb9d(_0x297cb0[_0xbbb6('0x11')][_0xbbb6('0x14')]);}else{logger[_0xbbb6('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x23bb1a,_0xbbb6('0xe'));_0x2ecb9d(_0x297cb0[_0xbbb6('0x15')][_0xbbb6('0x14')]);}})[_0xbbb6('0x16')](function(_0x4989f6){logger[_0xbbb6('0x11')](_0xbbb6('0x13'),_0x23bb1a,_0x4989f6);_0x5b5c6f(_0x4989f6);});});}exports[_0xbbb6('0x17')]=function(_0xa17a76){var _0x546969=this;return new Promise(function(_0x92189a,_0x24d1cd){return db['ZendeskAccount'][_0xbbb6('0x18')]({'raw':_0xa17a76[_0xbbb6('0x19')]?_0xa17a76[_0xbbb6('0x19')][_0xbbb6('0x1a')]===undefined?!![]:![]:!![],'where':_0xa17a76[_0xbbb6('0x19')]?_0xa17a76['options']['where']||null:null,'attributes':_0xa17a76[_0xbbb6('0x19')]?_0xa17a76[_0xbbb6('0x19')][_0xbbb6('0x1b')]||null:null,'limit':_0xa17a76[_0xbbb6('0x19')]?_0xa17a76[_0xbbb6('0x19')][_0xbbb6('0x1c')]||null:null,'include':_0xa17a76[_0xbbb6('0x19')]?_0xa17a76[_0xbbb6('0x19')]['include']?_[_0xbbb6('0x1d')](_0xa17a76[_0xbbb6('0x19')][_0xbbb6('0x1e')],function(_0x397538){return{'model':db[_0x397538[_0xbbb6('0x1f')]],'as':_0x397538['as'],'attributes':_0x397538[_0xbbb6('0x1b')],'include':_0x397538[_0xbbb6('0x1e')]?_[_0xbbb6('0x1d')](_0x397538[_0xbbb6('0x1e')],function(_0x16e05d){return{'model':db[_0x16e05d[_0xbbb6('0x1f')]],'as':_0x16e05d['as'],'attributes':_0x16e05d[_0xbbb6('0x1b')],'include':_0x16e05d[_0xbbb6('0x1e')]?_[_0xbbb6('0x1d')](_0x16e05d[_0xbbb6('0x1e')],function(_0x42562c){return{'model':db[_0x42562c[_0xbbb6('0x1f')]],'as':_0x42562c['as'],'attributes':_0x42562c[_0xbbb6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbbb6('0xc')](function(_0x353dda){logger[_0xbbb6('0xd')]('GetZendeskAccount',_0xa17a76);logger[_0xbbb6('0xf')]('GetZendeskAccount',_0xa17a76,JSON[_0xbbb6('0x20')](_0x353dda));_0x92189a(_0x353dda);})[_0xbbb6('0x16')](function(_0x436d86){logger[_0xbbb6('0x11')](_0xbbb6('0x17'),_0x436d86[_0xbbb6('0x14')],_0xa17a76);_0x24d1cd(_0x546969[_0xbbb6('0x11')](0x1f4,_0x436d86[_0xbbb6('0x14')]));});});};exports[_0xbbb6('0x21')]=function(_0x3cdf21){var _0x396178=this;return new Promise(function(_0x2ace40,_0x5ef9e5){return db[_0xbbb6('0x22')]['find']({'raw':_0x3cdf21[_0xbbb6('0x19')]?_0x3cdf21[_0xbbb6('0x19')][_0xbbb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x3cdf21['options']?_0x3cdf21[_0xbbb6('0x19')]['where']||null:null,'attributes':_0x3cdf21[_0xbbb6('0x19')]?_0x3cdf21[_0xbbb6('0x19')][_0xbbb6('0x1b')]||null:null,'include':_0x3cdf21['options']?_0x3cdf21[_0xbbb6('0x19')][_0xbbb6('0x1e')]?_[_0xbbb6('0x1d')](_0x3cdf21[_0xbbb6('0x19')]['include'],function(_0x54986b){return{'model':db[_0x54986b[_0xbbb6('0x1f')]],'as':_0x54986b['as'],'attributes':_0x54986b[_0xbbb6('0x1b')],'include':_0x54986b[_0xbbb6('0x1e')]?_[_0xbbb6('0x1d')](_0x54986b[_0xbbb6('0x1e')],function(_0x193308){return{'model':db[_0x193308[_0xbbb6('0x1f')]],'as':_0x193308['as'],'attributes':_0x193308[_0xbbb6('0x1b')],'include':_0x193308[_0xbbb6('0x1e')]?_['map'](_0x193308[_0xbbb6('0x1e')],function(_0x5dc53b){return{'model':db[_0x5dc53b[_0xbbb6('0x1f')]],'as':_0x5dc53b['as'],'attributes':_0x5dc53b[_0xbbb6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbbb6('0xc')](function(_0x5dca55){logger[_0xbbb6('0xd')](_0xbbb6('0x21'),_0x3cdf21);logger[_0xbbb6('0xf')]('ShowZendeskAccount',_0x3cdf21,JSON['stringify'](_0x5dca55));_0x2ace40(_0x5dca55);})['catch'](function(_0x2f6a7b){logger[_0xbbb6('0x11')](_0xbbb6('0x21'),_0x2f6a7b[_0xbbb6('0x14')],_0x3cdf21);_0x5ef9e5(_0x396178['error'](0x1f4,_0x2f6a7b[_0xbbb6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index a4a9bc2..a2e6a4f 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 _0x757a=['index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','setTags','put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x59a63b,_0xa1c45b){var _0x571d9e=function(_0x26ca5e){while(--_0x26ca5e){_0x59a63b['push'](_0x59a63b['shift']());}};_0x571d9e(++_0xa1c45b);}(_0x757a,0xde));var _0xa757=function(_0x249d3f,_0x47d868){_0x249d3f=_0x249d3f-0x0;var _0x5c6035=_0x757a[_0x249d3f];return _0x5c6035;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['getFields']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0xa757('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa757('0x10')]);router[_0xa757('0x11')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0x12'),auth[_0xa757('0x9')](),controller[_0xa757('0x15')]);module[_0xa757('0x16')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x7268c7,_0x2a90c8){var _0x3f1caf=function(_0x2950a9){while(--_0x2950a9){_0x7268c7['push'](_0x7268c7['shift']());}};_0x3f1caf(++_0x2a90c8);}(_0x0bb5,0x148));var _0x50bb=function(_0x521fab,_0x13f4e9){_0x521fab=_0x521fab-0x0;var _0x4a40b8=_0x0bb5[_0x521fab];return _0x4a40b8;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index df2baf9..f7d484a 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 _0x8c2a=['sequelize','exports','STRING'];(function(_0x3f7b50,_0x4f96b7){var _0x51f680=function(_0xe3cab2){while(--_0xe3cab2){_0x3f7b50['push'](_0x3f7b50['shift']());}};_0x51f680(++_0x4f96b7);}(_0x8c2a,0xe1));var _0xa8c2=function(_0x133804,_0x46eafb){_0x133804=_0x133804-0x0;var _0x45b070=_0x8c2a[_0x133804];return _0x45b070;};'use strict';var Sequelize=require(_0xa8c2('0x0'));module[_0xa8c2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa8c2('0x2')]}}; \ No newline at end of file +var _0x1a3c=['STRING','sequelize'];(function(_0x1dd198,_0x1f9b2b){var _0x95ebb4=function(_0x137736){while(--_0x137736){_0x1dd198['push'](_0x1dd198['shift']());}};_0x95ebb4(++_0x1f9b2b);}(_0x1a3c,0xef));var _0xc1a3=function(_0x427815,_0x5800e4){_0x427815=_0x427815-0x0;var _0x7f52a3=_0x1a3c[_0x427815];return _0x7f52a3;};'use strict';var Sequelize=require(_0xc1a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xc1a3('0x1')]},'description':{'type':Sequelize[_0xc1a3('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 582278f..6816640 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 _0x9166=['ZendeskConfiguration','include','findAll','rows','catch','find','create','update','params','body','destroy','getFields','findOne','ZendeskField','options','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x254109,_0x47ef01){var _0x54ca42=function(_0x5ee74c){while(--_0x5ee74c){_0x254109['push'](_0x254109['shift']());}};_0x54ca42(++_0x47ef01);}(_0x9166,0x15e));var _0x6916=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x9166[_0x508685];return _0x976a76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6916('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6916('0x1'));var rp=require(_0x6916('0x2'));var moment=require('moment');var BPromise=require(_0x6916('0x3'));var Mustache=require(_0x6916('0x4'));var util=require(_0x6916('0x5'));var path=require('path');var sox=require(_0x6916('0x6'));var csv=require(_0x6916('0x7'));var ejs=require(_0x6916('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6916('0x9'));var squel=require(_0x6916('0xa'));var crypto=require('crypto');var jsforce=require(_0x6916('0xb'));var deskjs=require(_0x6916('0xc'));var toCsv=require(_0x6916('0x7'));var querystring=require(_0x6916('0xd'));var Papa=require(_0x6916('0xe'));var Redis=require(_0x6916('0xf'));var authService=require(_0x6916('0x10'));var qs=require(_0x6916('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6916('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x6916('0x13'));var config=require(_0x6916('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6916('0x15'))['db'];function respondWithStatusCode(_0x1fd7d6,_0x3c4907){_0x3c4907=_0x3c4907||0xcc;return function(_0x418281){if(_0x418281){return _0x1fd7d6[_0x6916('0x16')](_0x3c4907);}return _0x1fd7d6[_0x6916('0x17')](_0x3c4907)['end']();};}function respondWithResult(_0x16b794,_0x46c301){_0x46c301=_0x46c301||0xc8;return function(_0x7bda86){if(_0x7bda86){return _0x16b794[_0x6916('0x17')](_0x46c301)[_0x6916('0x18')](_0x7bda86);}};}function respondWithFilteredResult(_0x540f7d,_0x435d4e){return function(_0x1b156a){if(_0x1b156a){var _0x5e1d80=typeof _0x435d4e[_0x6916('0x19')]===_0x6916('0x1a')&&typeof _0x435d4e['limit']===_0x6916('0x1a');var _0x217923=_0x1b156a['count'];var _0xa1c712=_0x5e1d80?0x0:_0x435d4e[_0x6916('0x19')];var _0x3dcdae=_0x5e1d80?_0x1b156a[_0x6916('0x1b')]:_0x435d4e['offset']+_0x435d4e[_0x6916('0x1c')];var _0x4fd0c0;if(_0x3dcdae>=_0x217923){_0x3dcdae=_0x217923;_0x4fd0c0=0xc8;}else{_0x4fd0c0=0xce;}_0x540f7d[_0x6916('0x17')](_0x4fd0c0);return _0x540f7d[_0x6916('0x1d')](_0x6916('0x1e'),_0xa1c712+'-'+_0x3dcdae+'/'+_0x217923)['json'](_0x1b156a);}return null;};}function patchUpdates(_0x49903a){return function(_0x446d1b){try{jsonpatch[_0x6916('0x1f')](_0x446d1b,_0x49903a,!![]);}catch(_0x205481){return BPromise[_0x6916('0x20')](_0x205481);}return _0x446d1b[_0x6916('0x21')]();};}function saveUpdates(_0x4e8ab4,_0x1b7446){return function(_0x31d769){if(_0x31d769){return _0x31d769['update'](_0x4e8ab4)[_0x6916('0x22')](function(_0x3fde47){return _0x3fde47;});}return null;};}function removeEntity(_0x30d889,_0x10634d){return function(_0xa85b7e){if(_0xa85b7e){return _0xa85b7e['destroy']()[_0x6916('0x22')](function(){_0x30d889[_0x6916('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336f9e,_0x4368ae){return function(_0x4c21f5){if(!_0x4c21f5){_0x336f9e['sendStatus'](0x194);}return _0x4c21f5;};}function handleError(_0x365e51,_0x42b59d){_0x42b59d=_0x42b59d||0x1f4;return function(_0x55bf58){logger[_0x6916('0x23')](_0x55bf58[_0x6916('0x24')]);if(_0x55bf58['name']){delete _0x55bf58['name'];}_0x365e51[_0x6916('0x17')](_0x42b59d)[_0x6916('0x25')](_0x55bf58);};}exports[_0x6916('0x26')]=function(_0x23a7b0,_0x55f063){var _0x487122={},_0x4630ac={},_0x305b9a={'count':0x0,'rows':[]};var _0x1629a0=_[_0x6916('0x27')](db['ZendeskConfiguration'][_0x6916('0x28')],function(_0x763a69){return{'name':_0x763a69[_0x6916('0x29')],'type':_0x763a69[_0x6916('0x2a')][_0x6916('0x2b')]};});_0x4630ac[_0x6916('0x2c')]=_[_0x6916('0x27')](_0x1629a0,_0x6916('0x2d'));_0x4630ac[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x23a7b0[_0x6916('0x2e')]);_0x4630ac[_0x6916('0x30')]=_[_0x6916('0x31')](_0x4630ac['model'],_0x4630ac[_0x6916('0x2e')]);_0x487122[_0x6916('0x32')]=_['intersection'](_0x4630ac['model'],qs[_0x6916('0x33')](_0x23a7b0[_0x6916('0x2e')]['fields']));_0x487122[_0x6916('0x32')]=_0x487122[_0x6916('0x32')][_0x6916('0x34')]?_0x487122[_0x6916('0x32')]:_0x4630ac[_0x6916('0x2c')];if(!_0x23a7b0[_0x6916('0x2e')]['hasOwnProperty'](_0x6916('0x35'))){_0x487122[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x23a7b0[_0x6916('0x2e')][_0x6916('0x1c')]);_0x487122[_0x6916('0x19')]=qs['offset'](_0x23a7b0[_0x6916('0x2e')][_0x6916('0x19')]);}_0x487122[_0x6916('0x36')]=qs[_0x6916('0x37')](_0x23a7b0['query'][_0x6916('0x37')]);_0x487122['where']=qs['filters'](_[_0x6916('0x38')](_0x23a7b0[_0x6916('0x2e')],_0x4630ac['filters']),_0x1629a0);if(_0x23a7b0[_0x6916('0x2e')][_0x6916('0x39')]){_0x487122[_0x6916('0x3a')]=_['merge'](_0x487122['where'],{'$or':_[_0x6916('0x27')](_0x1629a0,function(_0x14df38){if(_0x14df38[_0x6916('0x2a')]!=='VIRTUAL'){var _0x1c47b3={};_0x1c47b3[_0x14df38[_0x6916('0x2d')]]={'$like':'%'+_0x23a7b0[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x1c47b3;}})});}_0x487122=_[_0x6916('0x3b')]({},_0x487122,_0x23a7b0['options']);var _0x332d92={'where':_0x487122['where']};return db[_0x6916('0x3c')][_0x6916('0x1b')](_0x332d92)[_0x6916('0x22')](function(_0x491f77){_0x305b9a[_0x6916('0x1b')]=_0x491f77;if(_0x23a7b0[_0x6916('0x2e')]['includeAll']){_0x487122[_0x6916('0x3d')]=[{'all':!![]}];}return db[_0x6916('0x3c')][_0x6916('0x3e')](_0x487122);})[_0x6916('0x22')](function(_0x4764b9){_0x305b9a[_0x6916('0x3f')]=_0x4764b9;return _0x305b9a;})[_0x6916('0x22')](respondWithFilteredResult(_0x55f063,_0x487122))[_0x6916('0x40')](handleError(_0x55f063,null));};exports['show']=function(_0x325c9e,_0x3c3c15){var _0x1d461a={'raw':![],'where':{'id':_0x325c9e['params']['id']}},_0x350107={};_0x350107[_0x6916('0x2c')]=_['keys'](db[_0x6916('0x3c')]['rawAttributes']);_0x350107[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x325c9e[_0x6916('0x2e')]);_0x350107[_0x6916('0x30')]=_[_0x6916('0x31')](_0x350107[_0x6916('0x2c')],_0x350107[_0x6916('0x2e')]);_0x1d461a[_0x6916('0x32')]=_['intersection'](_0x350107[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x325c9e[_0x6916('0x2e')][_0x6916('0x33')]));_0x1d461a[_0x6916('0x32')]=_0x1d461a[_0x6916('0x32')]['length']?_0x1d461a[_0x6916('0x32')]:_0x350107['model'];if(_0x325c9e[_0x6916('0x2e')]['includeAll']){_0x1d461a[_0x6916('0x3d')]=[{'all':!![]}];}_0x1d461a=_[_0x6916('0x3b')]({},_0x1d461a,_0x325c9e['options']);return db[_0x6916('0x3c')][_0x6916('0x41')](_0x1d461a)[_0x6916('0x22')](handleEntityNotFound(_0x3c3c15,null))['then'](respondWithResult(_0x3c3c15,null))[_0x6916('0x40')](handleError(_0x3c3c15,null));};exports[_0x6916('0x42')]=function(_0x2a33ec,_0x2bb834){return db[_0x6916('0x3c')]['create'](_0x2a33ec['body'],{})[_0x6916('0x22')](respondWithResult(_0x2bb834,0xc9))[_0x6916('0x40')](handleError(_0x2bb834,null));};exports[_0x6916('0x43')]=function(_0x5afcb1,_0x23fbeb){if(_0x5afcb1['body']['id']){delete _0x5afcb1['body']['id'];}return db[_0x6916('0x3c')][_0x6916('0x41')]({'where':{'id':_0x5afcb1[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x23fbeb,null))[_0x6916('0x22')](saveUpdates(_0x5afcb1[_0x6916('0x45')],null))[_0x6916('0x22')](respondWithResult(_0x23fbeb,null))[_0x6916('0x40')](handleError(_0x23fbeb,null));};exports[_0x6916('0x46')]=function(_0x5b2938,_0x1257db){return db[_0x6916('0x3c')][_0x6916('0x41')]({'where':{'id':_0x5b2938[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x1257db,null))[_0x6916('0x22')](removeEntity(_0x1257db,null))[_0x6916('0x40')](handleError(_0x1257db,null));};exports[_0x6916('0x47')]=function(_0x13f7c8,_0x391fdd,_0x230b3d){var _0x4f49ec={};var _0x33085a={};var _0xf272f5;var _0x5a7e41;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x13f7c8[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x391fdd,null))[_0x6916('0x22')](function(_0x8f1cf6){if(_0x8f1cf6){_0xf272f5=_0x8f1cf6;_0x33085a[_0x6916('0x2c')]=_['keys'](db[_0x6916('0x49')]['rawAttributes']);_0x33085a['query']=_[_0x6916('0x2f')](_0x13f7c8[_0x6916('0x2e')]);_0x33085a[_0x6916('0x30')]=_[_0x6916('0x31')](_0x33085a[_0x6916('0x2c')],_0x33085a[_0x6916('0x2e')]);_0x4f49ec[_0x6916('0x32')]=_['intersection'](_0x33085a[_0x6916('0x2c')],qs['fields'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x33')]));_0x4f49ec[_0x6916('0x32')]=_0x4f49ec['attributes'][_0x6916('0x34')]?_0x4f49ec[_0x6916('0x32')]:_0x33085a[_0x6916('0x2c')];_0x4f49ec['order']=qs['sort'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x37')]);_0x4f49ec['where']=qs['filters'](_[_0x6916('0x38')](_0x13f7c8[_0x6916('0x2e')],_0x33085a[_0x6916('0x30')]));if(_0x13f7c8[_0x6916('0x2e')]['filter']){_0x4f49ec['where']=_[_0x6916('0x3b')](_0x4f49ec[_0x6916('0x3a')],{'$or':_['map'](_0x4f49ec[_0x6916('0x32')],function(_0x232777){var _0x415fe0={};_0x415fe0[_0x232777]={'$like':'%'+_0x13f7c8[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x415fe0;})});}_0x4f49ec=_[_0x6916('0x3b')]({},_0x4f49ec,_0x13f7c8[_0x6916('0x4a')]);return _0xf272f5['getFields'](_0x4f49ec);}})[_0x6916('0x22')](function(_0x4c6d32){if(_0x4c6d32){_0x5a7e41=_0x4c6d32[_0x6916('0x34')];if(!_0x13f7c8[_0x6916('0x2e')][_0x6916('0x4b')](_0x6916('0x35'))){_0x4f49ec[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x1c')]);_0x4f49ec[_0x6916('0x19')]=qs['offset'](_0x13f7c8[_0x6916('0x2e')][_0x6916('0x19')]);}return _0xf272f5[_0x6916('0x47')](_0x4f49ec);}})['then'](function(_0x55991c){if(_0x55991c){return _0x55991c?{'count':_0x5a7e41,'rows':_0x55991c}:null;}})[_0x6916('0x22')](respondWithResult(_0x391fdd,null))[_0x6916('0x40')](handleError(_0x391fdd,null));};exports[_0x6916('0x4c')]=function(_0x26e8d2,_0xc58b6d,_0x3e82d0){var _0x2c7ee3={};var _0x5038fe={};var _0x1c651d;var _0x1715f9;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x26e8d2['params']['id']}})[_0x6916('0x22')](handleEntityNotFound(_0xc58b6d,null))[_0x6916('0x22')](function(_0x156255){if(_0x156255){_0x1c651d=_0x156255;_0x5038fe[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x49')][_0x6916('0x28')]);_0x5038fe['query']=_[_0x6916('0x2f')](_0x26e8d2[_0x6916('0x2e')]);_0x5038fe[_0x6916('0x30')]=_['intersection'](_0x5038fe[_0x6916('0x2c')],_0x5038fe[_0x6916('0x2e')]);_0x2c7ee3[_0x6916('0x32')]=_[_0x6916('0x31')](_0x5038fe[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x33')]));_0x2c7ee3[_0x6916('0x32')]=_0x2c7ee3['attributes'][_0x6916('0x34')]?_0x2c7ee3[_0x6916('0x32')]:_0x5038fe[_0x6916('0x2c')];_0x2c7ee3[_0x6916('0x36')]=qs[_0x6916('0x37')](_0x26e8d2['query'][_0x6916('0x37')]);_0x2c7ee3['where']=qs[_0x6916('0x30')](_['pick'](_0x26e8d2[_0x6916('0x2e')],_0x5038fe[_0x6916('0x30')]));if(_0x26e8d2['query'][_0x6916('0x39')]){_0x2c7ee3['where']=_[_0x6916('0x3b')](_0x2c7ee3[_0x6916('0x3a')],{'$or':_['map'](_0x2c7ee3[_0x6916('0x32')],function(_0x5e9f71){var _0x2b3f10={};_0x2b3f10[_0x5e9f71]={'$like':'%'+_0x26e8d2[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x2b3f10;})});}_0x2c7ee3=_['merge']({},_0x2c7ee3,_0x26e8d2['options']);return _0x1c651d['getSubjects'](_0x2c7ee3);}})[_0x6916('0x22')](function(_0x126b8b){if(_0x126b8b){_0x1715f9=_0x126b8b[_0x6916('0x34')];if(!_0x26e8d2[_0x6916('0x2e')]['hasOwnProperty'](_0x6916('0x35'))){_0x2c7ee3[_0x6916('0x1c')]=qs[_0x6916('0x1c')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x1c')]);_0x2c7ee3[_0x6916('0x19')]=qs[_0x6916('0x19')](_0x26e8d2[_0x6916('0x2e')][_0x6916('0x19')]);}return _0x1c651d['getSubjects'](_0x2c7ee3);}})[_0x6916('0x22')](function(_0x3caba6){if(_0x3caba6){return _0x3caba6?{'count':_0x1715f9,'rows':_0x3caba6}:null;}})['then'](respondWithResult(_0xc58b6d,null))['catch'](handleError(_0xc58b6d,null));};exports[_0x6916('0x4d')]=function(_0x12a8de,_0x2074cd,_0x39a51e){var _0x3a787d={};var _0x45217a={};var _0x52e200;var _0x669d84;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x12a8de[_0x6916('0x44')]['id']}})['then'](handleEntityNotFound(_0x2074cd,null))[_0x6916('0x22')](function(_0x570885){if(_0x570885){_0x52e200=_0x570885;_0x45217a[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x49')]['rawAttributes']);_0x45217a[_0x6916('0x2e')]=_['keys'](_0x12a8de[_0x6916('0x2e')]);_0x45217a['filters']=_['intersection'](_0x45217a[_0x6916('0x2c')],_0x45217a[_0x6916('0x2e')]);_0x3a787d[_0x6916('0x32')]=_[_0x6916('0x31')](_0x45217a[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x12a8de['query']['fields']));_0x3a787d[_0x6916('0x32')]=_0x3a787d[_0x6916('0x32')][_0x6916('0x34')]?_0x3a787d['attributes']:_0x45217a[_0x6916('0x2c')];_0x3a787d[_0x6916('0x36')]=qs['sort'](_0x12a8de['query'][_0x6916('0x37')]);_0x3a787d[_0x6916('0x3a')]=qs[_0x6916('0x30')](_[_0x6916('0x38')](_0x12a8de['query'],_0x45217a[_0x6916('0x30')]));if(_0x12a8de[_0x6916('0x2e')][_0x6916('0x39')]){_0x3a787d[_0x6916('0x3a')]=_['merge'](_0x3a787d[_0x6916('0x3a')],{'$or':_[_0x6916('0x27')](_0x3a787d['attributes'],function(_0x132987){var _0x180502={};_0x180502[_0x132987]={'$like':'%'+_0x12a8de[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x180502;})});}_0x3a787d=_[_0x6916('0x3b')]({},_0x3a787d,_0x12a8de['options']);return _0x52e200[_0x6916('0x4d')](_0x3a787d);}})[_0x6916('0x22')](function(_0x55916c){if(_0x55916c){_0x669d84=_0x55916c[_0x6916('0x34')];if(!_0x12a8de[_0x6916('0x2e')][_0x6916('0x4b')](_0x6916('0x35'))){_0x3a787d['limit']=qs[_0x6916('0x1c')](_0x12a8de['query'][_0x6916('0x1c')]);_0x3a787d['offset']=qs[_0x6916('0x19')](_0x12a8de['query'][_0x6916('0x19')]);}return _0x52e200['getDescriptions'](_0x3a787d);}})[_0x6916('0x22')](function(_0x103520){if(_0x103520){return _0x103520?{'count':_0x669d84,'rows':_0x103520}:null;}})[_0x6916('0x22')](respondWithResult(_0x2074cd,null))['catch'](handleError(_0x2074cd,null));};exports[_0x6916('0x4e')]=function(_0x23a2ba,_0x3331d1,_0x389f39){var _0x561fb5={};var _0xbdae2d={};var _0x896775;var _0x2bcd67;return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x23a2ba[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x3331d1,null))[_0x6916('0x22')](function(_0x429b62){if(_0x429b62){_0x896775=_0x429b62;_0xbdae2d[_0x6916('0x2c')]=_[_0x6916('0x2f')](db[_0x6916('0x4f')]['rawAttributes']);_0xbdae2d[_0x6916('0x2e')]=_[_0x6916('0x2f')](_0x23a2ba[_0x6916('0x2e')]);_0xbdae2d[_0x6916('0x30')]=_['intersection'](_0xbdae2d[_0x6916('0x2c')],_0xbdae2d['query']);_0x561fb5[_0x6916('0x32')]=_[_0x6916('0x31')](_0xbdae2d[_0x6916('0x2c')],qs[_0x6916('0x33')](_0x23a2ba[_0x6916('0x2e')][_0x6916('0x33')]));_0x561fb5['attributes']=_0x561fb5['attributes'][_0x6916('0x34')]?_0x561fb5[_0x6916('0x32')]:_0xbdae2d[_0x6916('0x2c')];_0x561fb5['order']=qs[_0x6916('0x37')](_0x23a2ba[_0x6916('0x2e')]['sort']);_0x561fb5[_0x6916('0x3a')]=qs[_0x6916('0x30')](_[_0x6916('0x38')](_0x23a2ba[_0x6916('0x2e')],_0xbdae2d[_0x6916('0x30')]));if(_0x23a2ba['query'][_0x6916('0x39')]){_0x561fb5[_0x6916('0x3a')]=_[_0x6916('0x3b')](_0x561fb5['where'],{'$or':_[_0x6916('0x27')](_0x561fb5['attributes'],function(_0x4fca32){var _0x32806e={};_0x32806e[_0x4fca32]={'$like':'%'+_0x23a2ba[_0x6916('0x2e')][_0x6916('0x39')]+'%'};return _0x32806e;})});}_0x561fb5=_[_0x6916('0x3b')]({},_0x561fb5,_0x23a2ba[_0x6916('0x4a')]);return _0x896775[_0x6916('0x4e')](_0x561fb5);}})[_0x6916('0x22')](function(_0x2f35aa){if(_0x2f35aa){_0x2bcd67=_0x2f35aa[_0x6916('0x34')];if(!_0x23a2ba['query'][_0x6916('0x4b')](_0x6916('0x35'))){_0x561fb5['limit']=qs[_0x6916('0x1c')](_0x23a2ba['query']['limit']);_0x561fb5[_0x6916('0x19')]=qs['offset'](_0x23a2ba[_0x6916('0x2e')][_0x6916('0x19')]);}return _0x896775[_0x6916('0x4e')](_0x561fb5);}})[_0x6916('0x22')](function(_0x30e47f){if(_0x30e47f){return _0x30e47f?{'count':_0x2bcd67,'rows':_0x30e47f}:null;}})[_0x6916('0x22')](respondWithResult(_0x3331d1,null))['catch'](handleError(_0x3331d1,null));};exports[_0x6916('0x50')]=function(_0x11c3ac,_0x3c749a,_0x58e964){if(_0x11c3ac['body']['id']){delete _0x11c3ac[_0x6916('0x45')]['id'];}return db[_0x6916('0x3c')][_0x6916('0x48')]({'where':{'id':_0x11c3ac[_0x6916('0x44')]['id']}})[_0x6916('0x22')](handleEntityNotFound(_0x3c749a,null))[_0x6916('0x22')](function(_0x15c4f3){if(_0x15c4f3){return _0x15c4f3['setTags'](_0x11c3ac[_0x6916('0x45')][_0x6916('0x51')]||[]);}return null;})[_0x6916('0x22')](respondWithResult(_0x3c749a,null))[_0x6916('0x40')](handleError(_0x3c749a,null));}; \ No newline at end of file +var _0x40ca=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','ZendeskConfiguration','fieldName','type','key','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','fields','create','body','update','find','getFields','ZendeskField','rawAttributes','length','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x4fdb29,_0x15f2eb){var _0x160a55=function(_0x24ec2b){while(--_0x24ec2b){_0x4fdb29['push'](_0x4fdb29['shift']());}};_0x160a55(++_0x15f2eb);}(_0x40ca,0xee));var _0xa40c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x40ca[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xa40c('0x0'));var rimraf=require(_0xa40c('0x1'));var zipdir=require(_0xa40c('0x2'));var jsonpatch=require(_0xa40c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa40c('0x4'));var Mustache=require(_0xa40c('0x5'));var util=require(_0xa40c('0x6'));var path=require(_0xa40c('0x7'));var sox=require(_0xa40c('0x8'));var csv=require('to-csv');var ejs=require(_0xa40c('0x9'));var fs=require('fs');var fs_extra=require(_0xa40c('0xa'));var _=require(_0xa40c('0xb'));var squel=require('squel');var crypto=require(_0xa40c('0xc'));var jsforce=require(_0xa40c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa40c('0xe'));var Papa=require(_0xa40c('0xf'));var Redis=require(_0xa40c('0x10'));var authService=require(_0xa40c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa40c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa40c('0x13'))(_0xa40c('0x14'));var utils=require(_0xa40c('0x15'));var config=require(_0xa40c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x145f09,_0x1a58a0){_0x1a58a0=_0x1a58a0||0xcc;return function(_0x5cf588){if(_0x5cf588){return _0x145f09[_0xa40c('0x17')](_0x1a58a0);}return _0x145f09['status'](_0x1a58a0)[_0xa40c('0x18')]();};}function respondWithResult(_0x5929df,_0x59d797){_0x59d797=_0x59d797||0xc8;return function(_0x4f1f30){if(_0x4f1f30){return _0x5929df[_0xa40c('0x19')](_0x59d797)[_0xa40c('0x1a')](_0x4f1f30);}};}function respondWithFilteredResult(_0x14c0d1,_0x26a4c7){return function(_0x2cd20c){if(_0x2cd20c){var _0xf4b320=typeof _0x26a4c7[_0xa40c('0x1b')]===_0xa40c('0x1c')&&typeof _0x26a4c7[_0xa40c('0x1d')]==='undefined';var _0x4548e5=_0x2cd20c[_0xa40c('0x1e')];var _0x4eb886=_0xf4b320?0x0:_0x26a4c7['offset'];var _0x1f8b64=_0xf4b320?_0x2cd20c[_0xa40c('0x1e')]:_0x26a4c7['offset']+_0x26a4c7[_0xa40c('0x1d')];var _0x482a26;if(_0x1f8b64>=_0x4548e5){_0x1f8b64=_0x4548e5;_0x482a26=0xc8;}else{_0x482a26=0xce;}_0x14c0d1['status'](_0x482a26);return _0x14c0d1[_0xa40c('0x1f')](_0xa40c('0x20'),_0x4eb886+'-'+_0x1f8b64+'/'+_0x4548e5)[_0xa40c('0x1a')](_0x2cd20c);}return null;};}function patchUpdates(_0x432d12){return function(_0x345b90){try{jsonpatch[_0xa40c('0x21')](_0x345b90,_0x432d12,!![]);}catch(_0x9d8c8a){return BPromise[_0xa40c('0x22')](_0x9d8c8a);}return _0x345b90[_0xa40c('0x23')]();};}function saveUpdates(_0x1c02c1,_0x55bcd2){return function(_0x406255){if(_0x406255){return _0x406255['update'](_0x1c02c1)[_0xa40c('0x24')](function(_0xa7e231){return _0xa7e231;});}return null;};}function removeEntity(_0x2eda4c,_0x3ca294){return function(_0x47f7b0){if(_0x47f7b0){return _0x47f7b0[_0xa40c('0x25')]()[_0xa40c('0x24')](function(){_0x2eda4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42e683,_0x1eed86){return function(_0x5da003){if(!_0x5da003){_0x42e683[_0xa40c('0x17')](0x194);}return _0x5da003;};}function handleError(_0x289da4,_0x4a0b54){_0x4a0b54=_0x4a0b54||0x1f4;return function(_0x3db1e1){logger[_0xa40c('0x26')](_0x3db1e1['stack']);if(_0x3db1e1[_0xa40c('0x27')]){delete _0x3db1e1[_0xa40c('0x27')];}_0x289da4[_0xa40c('0x19')](_0x4a0b54)[_0xa40c('0x28')](_0x3db1e1);};}exports['index']=function(_0x51ad29,_0x511a1c){var _0x1a0f58={},_0x4179c9={},_0x30576a={'count':0x0,'rows':[]};var _0xcf774c=_['map'](db[_0xa40c('0x29')]['rawAttributes'],function(_0x426757){return{'name':_0x426757[_0xa40c('0x2a')],'type':_0x426757[_0xa40c('0x2b')][_0xa40c('0x2c')]};});_0x4179c9[_0xa40c('0x2d')]=_[_0xa40c('0x2e')](_0xcf774c,_0xa40c('0x27'));_0x4179c9[_0xa40c('0x2f')]=_[_0xa40c('0x30')](_0x51ad29[_0xa40c('0x2f')]);_0x4179c9['filters']=_[_0xa40c('0x31')](_0x4179c9[_0xa40c('0x2d')],_0x4179c9[_0xa40c('0x2f')]);_0x1a0f58['attributes']=_['intersection'](_0x4179c9[_0xa40c('0x2d')],qs['fields'](_0x51ad29['query']['fields']));_0x1a0f58[_0xa40c('0x32')]=_0x1a0f58[_0xa40c('0x32')]['length']?_0x1a0f58['attributes']:_0x4179c9['model'];if(!_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x33')](_0xa40c('0x34'))){_0x1a0f58[_0xa40c('0x1d')]=qs['limit'](_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x1d')]);_0x1a0f58[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x1b')]);}_0x1a0f58[_0xa40c('0x35')]=qs[_0xa40c('0x36')](_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x36')]);_0x1a0f58['where']=qs[_0xa40c('0x37')](_['pick'](_0x51ad29[_0xa40c('0x2f')],_0x4179c9[_0xa40c('0x37')]),_0xcf774c);if(_0x51ad29[_0xa40c('0x2f')]['filter']){_0x1a0f58[_0xa40c('0x38')]=_[_0xa40c('0x39')](_0x1a0f58[_0xa40c('0x38')],{'$or':_['map'](_0xcf774c,function(_0x1d6ce3){if(_0x1d6ce3[_0xa40c('0x2b')]!==_0xa40c('0x3a')){var _0x20f817={};_0x20f817[_0x1d6ce3[_0xa40c('0x27')]]={'$like':'%'+_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x3b')]+'%'};return _0x20f817;}})});}_0x1a0f58=_['merge']({},_0x1a0f58,_0x51ad29[_0xa40c('0x3c')]);var _0x441a10={'where':_0x1a0f58[_0xa40c('0x38')]};return db[_0xa40c('0x29')][_0xa40c('0x1e')](_0x441a10)['then'](function(_0x115015){_0x30576a[_0xa40c('0x1e')]=_0x115015;if(_0x51ad29[_0xa40c('0x2f')][_0xa40c('0x3d')]){_0x1a0f58[_0xa40c('0x3e')]=[{'all':!![]}];}return db[_0xa40c('0x29')]['findAll'](_0x1a0f58);})[_0xa40c('0x24')](function(_0x7e9e1d){_0x30576a['rows']=_0x7e9e1d;return _0x30576a;})[_0xa40c('0x24')](respondWithFilteredResult(_0x511a1c,_0x1a0f58))[_0xa40c('0x3f')](handleError(_0x511a1c,null));};exports['show']=function(_0x3e95c9,_0x3b91cb){var _0x1cd6ec={'raw':![],'where':{'id':_0x3e95c9[_0xa40c('0x40')]['id']}},_0x884fe2={};_0x884fe2['model']=_[_0xa40c('0x30')](db[_0xa40c('0x29')]['rawAttributes']);_0x884fe2[_0xa40c('0x2f')]=_['keys'](_0x3e95c9['query']);_0x884fe2[_0xa40c('0x37')]=_[_0xa40c('0x31')](_0x884fe2['model'],_0x884fe2[_0xa40c('0x2f')]);_0x1cd6ec[_0xa40c('0x32')]=_['intersection'](_0x884fe2[_0xa40c('0x2d')],qs[_0xa40c('0x41')](_0x3e95c9['query'][_0xa40c('0x41')]));_0x1cd6ec['attributes']=_0x1cd6ec[_0xa40c('0x32')]['length']?_0x1cd6ec['attributes']:_0x884fe2['model'];if(_0x3e95c9[_0xa40c('0x2f')][_0xa40c('0x3d')]){_0x1cd6ec['include']=[{'all':!![]}];}_0x1cd6ec=_[_0xa40c('0x39')]({},_0x1cd6ec,_0x3e95c9[_0xa40c('0x3c')]);return db[_0xa40c('0x29')]['find'](_0x1cd6ec)[_0xa40c('0x24')](handleEntityNotFound(_0x3b91cb,null))['then'](respondWithResult(_0x3b91cb,null))['catch'](handleError(_0x3b91cb,null));};exports[_0xa40c('0x42')]=function(_0x192ac7,_0x1fa625){return db['ZendeskConfiguration'][_0xa40c('0x42')](_0x192ac7[_0xa40c('0x43')],{})[_0xa40c('0x24')](respondWithResult(_0x1fa625,0xc9))[_0xa40c('0x3f')](handleError(_0x1fa625,null));};exports[_0xa40c('0x44')]=function(_0x51b280,_0x444080){if(_0x51b280[_0xa40c('0x43')]['id']){delete _0x51b280['body']['id'];}return db[_0xa40c('0x29')][_0xa40c('0x45')]({'where':{'id':_0x51b280[_0xa40c('0x40')]['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x444080,null))[_0xa40c('0x24')](saveUpdates(_0x51b280[_0xa40c('0x43')],null))[_0xa40c('0x24')](respondWithResult(_0x444080,null))['catch'](handleError(_0x444080,null));};exports[_0xa40c('0x25')]=function(_0x32451e,_0x5524e1){return db['ZendeskConfiguration'][_0xa40c('0x45')]({'where':{'id':_0x32451e[_0xa40c('0x40')]['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x5524e1,null))[_0xa40c('0x24')](removeEntity(_0x5524e1,null))[_0xa40c('0x3f')](handleError(_0x5524e1,null));};exports[_0xa40c('0x46')]=function(_0x937bef,_0x133703,_0x4017e8){var _0x5ebfaf={};var _0x18c304={};var _0x5242f2;var _0x5ca9f6;return db[_0xa40c('0x29')]['findOne']({'where':{'id':_0x937bef['params']['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x133703,null))[_0xa40c('0x24')](function(_0x332565){if(_0x332565){_0x5242f2=_0x332565;_0x18c304[_0xa40c('0x2d')]=_[_0xa40c('0x30')](db[_0xa40c('0x47')][_0xa40c('0x48')]);_0x18c304[_0xa40c('0x2f')]=_['keys'](_0x937bef[_0xa40c('0x2f')]);_0x18c304[_0xa40c('0x37')]=_[_0xa40c('0x31')](_0x18c304[_0xa40c('0x2d')],_0x18c304[_0xa40c('0x2f')]);_0x5ebfaf[_0xa40c('0x32')]=_[_0xa40c('0x31')](_0x18c304[_0xa40c('0x2d')],qs['fields'](_0x937bef['query'][_0xa40c('0x41')]));_0x5ebfaf[_0xa40c('0x32')]=_0x5ebfaf[_0xa40c('0x32')][_0xa40c('0x49')]?_0x5ebfaf[_0xa40c('0x32')]:_0x18c304[_0xa40c('0x2d')];_0x5ebfaf[_0xa40c('0x35')]=qs[_0xa40c('0x36')](_0x937bef[_0xa40c('0x2f')][_0xa40c('0x36')]);_0x5ebfaf['where']=qs[_0xa40c('0x37')](_[_0xa40c('0x4a')](_0x937bef['query'],_0x18c304[_0xa40c('0x37')]));if(_0x937bef['query']['filter']){_0x5ebfaf[_0xa40c('0x38')]=_[_0xa40c('0x39')](_0x5ebfaf[_0xa40c('0x38')],{'$or':_[_0xa40c('0x2e')](_0x5ebfaf[_0xa40c('0x32')],function(_0x544129){var _0x590055={};_0x590055[_0x544129]={'$like':'%'+_0x937bef[_0xa40c('0x2f')][_0xa40c('0x3b')]+'%'};return _0x590055;})});}_0x5ebfaf=_[_0xa40c('0x39')]({},_0x5ebfaf,_0x937bef[_0xa40c('0x3c')]);return _0x5242f2['getFields'](_0x5ebfaf);}})[_0xa40c('0x24')](function(_0x543fc7){if(_0x543fc7){_0x5ca9f6=_0x543fc7[_0xa40c('0x49')];if(!_0x937bef[_0xa40c('0x2f')][_0xa40c('0x33')](_0xa40c('0x34'))){_0x5ebfaf[_0xa40c('0x1d')]=qs['limit'](_0x937bef[_0xa40c('0x2f')][_0xa40c('0x1d')]);_0x5ebfaf[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x937bef[_0xa40c('0x2f')]['offset']);}return _0x5242f2[_0xa40c('0x46')](_0x5ebfaf);}})['then'](function(_0x5e39a6){if(_0x5e39a6){return _0x5e39a6?{'count':_0x5ca9f6,'rows':_0x5e39a6}:null;}})[_0xa40c('0x24')](respondWithResult(_0x133703,null))[_0xa40c('0x3f')](handleError(_0x133703,null));};exports[_0xa40c('0x4b')]=function(_0x265508,_0x10d7f8,_0x419a40){var _0x1aa510={};var _0x5d79fc={};var _0x214793;var _0x37bc05;return db[_0xa40c('0x29')][_0xa40c('0x4c')]({'where':{'id':_0x265508[_0xa40c('0x40')]['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x10d7f8,null))['then'](function(_0x3f2c29){if(_0x3f2c29){_0x214793=_0x3f2c29;_0x5d79fc[_0xa40c('0x2d')]=_[_0xa40c('0x30')](db[_0xa40c('0x47')]['rawAttributes']);_0x5d79fc[_0xa40c('0x2f')]=_[_0xa40c('0x30')](_0x265508[_0xa40c('0x2f')]);_0x5d79fc[_0xa40c('0x37')]=_[_0xa40c('0x31')](_0x5d79fc['model'],_0x5d79fc[_0xa40c('0x2f')]);_0x1aa510['attributes']=_[_0xa40c('0x31')](_0x5d79fc['model'],qs[_0xa40c('0x41')](_0x265508['query']['fields']));_0x1aa510[_0xa40c('0x32')]=_0x1aa510[_0xa40c('0x32')][_0xa40c('0x49')]?_0x1aa510[_0xa40c('0x32')]:_0x5d79fc[_0xa40c('0x2d')];_0x1aa510['order']=qs[_0xa40c('0x36')](_0x265508['query'][_0xa40c('0x36')]);_0x1aa510['where']=qs[_0xa40c('0x37')](_[_0xa40c('0x4a')](_0x265508[_0xa40c('0x2f')],_0x5d79fc[_0xa40c('0x37')]));if(_0x265508[_0xa40c('0x2f')]['filter']){_0x1aa510['where']=_[_0xa40c('0x39')](_0x1aa510['where'],{'$or':_[_0xa40c('0x2e')](_0x1aa510[_0xa40c('0x32')],function(_0x11a1d8){var _0x20cb1c={};_0x20cb1c[_0x11a1d8]={'$like':'%'+_0x265508[_0xa40c('0x2f')][_0xa40c('0x3b')]+'%'};return _0x20cb1c;})});}_0x1aa510=_[_0xa40c('0x39')]({},_0x1aa510,_0x265508['options']);return _0x214793['getSubjects'](_0x1aa510);}})[_0xa40c('0x24')](function(_0xda7c2f){if(_0xda7c2f){_0x37bc05=_0xda7c2f['length'];if(!_0x265508['query'][_0xa40c('0x33')](_0xa40c('0x34'))){_0x1aa510[_0xa40c('0x1d')]=qs['limit'](_0x265508['query'][_0xa40c('0x1d')]);_0x1aa510[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x265508[_0xa40c('0x2f')]['offset']);}return _0x214793[_0xa40c('0x4b')](_0x1aa510);}})[_0xa40c('0x24')](function(_0x2a78ac){if(_0x2a78ac){return _0x2a78ac?{'count':_0x37bc05,'rows':_0x2a78ac}:null;}})[_0xa40c('0x24')](respondWithResult(_0x10d7f8,null))[_0xa40c('0x3f')](handleError(_0x10d7f8,null));};exports[_0xa40c('0x4d')]=function(_0x30c7b2,_0x48c5a8,_0x259802){var _0x574b98={};var _0x2afefc={};var _0x702e59;var _0x154765;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x30c7b2[_0xa40c('0x40')]['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x48c5a8,null))[_0xa40c('0x24')](function(_0x4b69bf){if(_0x4b69bf){_0x702e59=_0x4b69bf;_0x2afefc[_0xa40c('0x2d')]=_[_0xa40c('0x30')](db[_0xa40c('0x47')][_0xa40c('0x48')]);_0x2afefc[_0xa40c('0x2f')]=_[_0xa40c('0x30')](_0x30c7b2[_0xa40c('0x2f')]);_0x2afefc[_0xa40c('0x37')]=_['intersection'](_0x2afefc[_0xa40c('0x2d')],_0x2afefc[_0xa40c('0x2f')]);_0x574b98[_0xa40c('0x32')]=_[_0xa40c('0x31')](_0x2afefc['model'],qs['fields'](_0x30c7b2[_0xa40c('0x2f')][_0xa40c('0x41')]));_0x574b98[_0xa40c('0x32')]=_0x574b98[_0xa40c('0x32')]['length']?_0x574b98[_0xa40c('0x32')]:_0x2afefc[_0xa40c('0x2d')];_0x574b98[_0xa40c('0x35')]=qs[_0xa40c('0x36')](_0x30c7b2['query'][_0xa40c('0x36')]);_0x574b98[_0xa40c('0x38')]=qs['filters'](_[_0xa40c('0x4a')](_0x30c7b2[_0xa40c('0x2f')],_0x2afefc['filters']));if(_0x30c7b2[_0xa40c('0x2f')][_0xa40c('0x3b')]){_0x574b98[_0xa40c('0x38')]=_['merge'](_0x574b98[_0xa40c('0x38')],{'$or':_['map'](_0x574b98[_0xa40c('0x32')],function(_0x2f04db){var _0x3553a2={};_0x3553a2[_0x2f04db]={'$like':'%'+_0x30c7b2[_0xa40c('0x2f')][_0xa40c('0x3b')]+'%'};return _0x3553a2;})});}_0x574b98=_[_0xa40c('0x39')]({},_0x574b98,_0x30c7b2['options']);return _0x702e59['getDescriptions'](_0x574b98);}})[_0xa40c('0x24')](function(_0x1bb196){if(_0x1bb196){_0x154765=_0x1bb196['length'];if(!_0x30c7b2[_0xa40c('0x2f')][_0xa40c('0x33')]('nolimit')){_0x574b98[_0xa40c('0x1d')]=qs['limit'](_0x30c7b2[_0xa40c('0x2f')][_0xa40c('0x1d')]);_0x574b98[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x30c7b2['query'][_0xa40c('0x1b')]);}return _0x702e59[_0xa40c('0x4d')](_0x574b98);}})[_0xa40c('0x24')](function(_0x24f019){if(_0x24f019){return _0x24f019?{'count':_0x154765,'rows':_0x24f019}:null;}})['then'](respondWithResult(_0x48c5a8,null))[_0xa40c('0x3f')](handleError(_0x48c5a8,null));};exports[_0xa40c('0x4e')]=function(_0x3d94bd,_0x3cf938,_0x422159){var _0x57fe73={};var _0x1fa16c={};var _0x1eda89;var _0x66ca19;return db['ZendeskConfiguration'][_0xa40c('0x4c')]({'where':{'id':_0x3d94bd[_0xa40c('0x40')]['id']}})['then'](handleEntityNotFound(_0x3cf938,null))[_0xa40c('0x24')](function(_0x3767f4){if(_0x3767f4){_0x1eda89=_0x3767f4;_0x1fa16c[_0xa40c('0x2d')]=_[_0xa40c('0x30')](db[_0xa40c('0x4f')]['rawAttributes']);_0x1fa16c[_0xa40c('0x2f')]=_['keys'](_0x3d94bd[_0xa40c('0x2f')]);_0x1fa16c[_0xa40c('0x37')]=_['intersection'](_0x1fa16c['model'],_0x1fa16c[_0xa40c('0x2f')]);_0x57fe73[_0xa40c('0x32')]=_[_0xa40c('0x31')](_0x1fa16c[_0xa40c('0x2d')],qs[_0xa40c('0x41')](_0x3d94bd[_0xa40c('0x2f')][_0xa40c('0x41')]));_0x57fe73['attributes']=_0x57fe73[_0xa40c('0x32')][_0xa40c('0x49')]?_0x57fe73[_0xa40c('0x32')]:_0x1fa16c[_0xa40c('0x2d')];_0x57fe73[_0xa40c('0x35')]=qs[_0xa40c('0x36')](_0x3d94bd[_0xa40c('0x2f')][_0xa40c('0x36')]);_0x57fe73['where']=qs[_0xa40c('0x37')](_[_0xa40c('0x4a')](_0x3d94bd[_0xa40c('0x2f')],_0x1fa16c[_0xa40c('0x37')]));if(_0x3d94bd['query'][_0xa40c('0x3b')]){_0x57fe73[_0xa40c('0x38')]=_['merge'](_0x57fe73[_0xa40c('0x38')],{'$or':_['map'](_0x57fe73[_0xa40c('0x32')],function(_0x85676){var _0x20f8cd={};_0x20f8cd[_0x85676]={'$like':'%'+_0x3d94bd['query'][_0xa40c('0x3b')]+'%'};return _0x20f8cd;})});}_0x57fe73=_[_0xa40c('0x39')]({},_0x57fe73,_0x3d94bd['options']);return _0x1eda89[_0xa40c('0x4e')](_0x57fe73);}})['then'](function(_0x32736a){if(_0x32736a){_0x66ca19=_0x32736a[_0xa40c('0x49')];if(!_0x3d94bd[_0xa40c('0x2f')]['hasOwnProperty'](_0xa40c('0x34'))){_0x57fe73[_0xa40c('0x1d')]=qs[_0xa40c('0x1d')](_0x3d94bd[_0xa40c('0x2f')][_0xa40c('0x1d')]);_0x57fe73[_0xa40c('0x1b')]=qs[_0xa40c('0x1b')](_0x3d94bd[_0xa40c('0x2f')][_0xa40c('0x1b')]);}return _0x1eda89[_0xa40c('0x4e')](_0x57fe73);}})[_0xa40c('0x24')](function(_0x49704a){if(_0x49704a){return _0x49704a?{'count':_0x66ca19,'rows':_0x49704a}:null;}})['then'](respondWithResult(_0x3cf938,null))['catch'](handleError(_0x3cf938,null));};exports[_0xa40c('0x50')]=function(_0xff271e,_0x1e7aa6,_0x17309f){if(_0xff271e['body']['id']){delete _0xff271e[_0xa40c('0x43')]['id'];}return db[_0xa40c('0x29')][_0xa40c('0x4c')]({'where':{'id':_0xff271e['params']['id']}})[_0xa40c('0x24')](handleEntityNotFound(_0x1e7aa6,null))[_0xa40c('0x24')](function(_0x331697){if(_0x331697){return _0x331697['setTags'](_0xff271e[_0xa40c('0x43')]['ids']||[]);}return null;})[_0xa40c('0x24')](respondWithResult(_0x1e7aa6,null))[_0xa40c('0x3f')](handleError(_0x1e7aa6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 724e537..10c90ee 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 _0x1399=['ZendeskConfiguration','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x1397d8,_0x275efb){var _0x2f9108=function(_0x577847){while(--_0x577847){_0x1397d8['push'](_0x1397d8['shift']());}};_0x2f9108(++_0x275efb);}(_0x1399,0x16c));var _0x9139=function(_0x5b7786,_0xe47b5c){_0x5b7786=_0x5b7786-0x0;var _0x5882ab=_0x1399[_0x5b7786];return _0x5882ab;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var logger=require('../../config/logger')(_0x9139('0x2'));var moment=require('moment');var BPromise=require(_0x9139('0x3'));var rp=require(_0x9139('0x4'));var fs=require('fs');var path=require(_0x9139('0x5'));var rimraf=require(_0x9139('0x6'));var config=require(_0x9139('0x7'));var attributes=require(_0x9139('0x8'));module['exports']=function(_0x54af2d,_0x8f086b){return _0x54af2d[_0x9139('0x9')](_0x9139('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x2a81f5,_0x54f6fe){var _0x44ccfd=function(_0x5b5cb2){while(--_0x5b5cb2){_0x2a81f5['push'](_0x2a81f5['shift']());}};_0x44ccfd(++_0x54f6fe);}(_0xcf66,0x71));var _0x6cf6=function(_0x4fe03f,_0x52937c){_0x4fe03f=_0x4fe03f-0x0;var _0x2d4de1=_0xcf66[_0x4fe03f];return _0x2d4de1;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 6d90f5f..f493860 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 _0x171c=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x1e8718,_0x3341f2){var _0x341c46=function(_0x294877){while(--_0x294877){_0x1e8718['push'](_0x1e8718['shift']());}};_0x341c46(++_0x3341f2);}(_0x171c,0x138));var _0xc171=function(_0x151686,_0x380a64){_0x151686=_0x151686-0x0;var _0x341937=_0x171c[_0x151686];return _0x341937;};'use strict';var _=require(_0xc171('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc171('0x1'));var fs=require('fs');var Redis=require(_0xc171('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc171('0x3'));var logger=require('../../config/logger')(_0xc171('0x4'));var config=require(_0xc171('0x5'));var jayson=require(_0xc171('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4198e6,_0x2c2c69,_0x5e2705){return new BPromise(function(_0x1c09e5,_0x50d975){return client[_0xc171('0x7')](_0x4198e6,_0x5e2705)[_0xc171('0x8')](function(_0x1c5192){logger[_0xc171('0x9')](_0xc171('0xa'),_0x2c2c69,_0xc171('0xb'));logger[_0xc171('0xc')](_0xc171('0xd'),_0x2c2c69,'request\x20sent',JSON[_0xc171('0xe')](_0x1c5192));if(_0x1c5192['error']){if(_0x1c5192['error'][_0xc171('0xf')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2c2c69,_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);return _0x50d975(_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);}logger[_0xc171('0x10')](_0xc171('0xa'),_0x2c2c69,_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);return _0x1c09e5(_0x1c5192[_0xc171('0x10')][_0xc171('0x11')]);}else{logger[_0xc171('0x9')](_0xc171('0xa'),_0x2c2c69,_0xc171('0xb'));_0x1c09e5(_0x1c5192[_0xc171('0x12')][_0xc171('0x11')]);}})[_0xc171('0x13')](function(_0x5a459a){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x2c2c69,_0x5a459a);_0x50d975(_0x5a459a);});});} \ No newline at end of file +var _0x7bb8=['request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x32f38b,_0x1b4fc7){var _0x15ec9b=function(_0x1331da){while(--_0x1331da){_0x32f38b['push'](_0x32f38b['shift']());}};_0x15ec9b(++_0x1b4fc7);}(_0x7bb8,0x1cb));var _0x87bb=function(_0x1c1750,_0x12ec2e){_0x1c1750=_0x1c1750-0x0;var _0x3fcfaf=_0x7bb8[_0x1c1750];return _0x3fcfaf;};'use strict';var _=require(_0x87bb('0x0'));var util=require(_0x87bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x87bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x87bb('0x4'))(_0x87bb('0x5'));var config=require(_0x87bb('0x6'));var jayson=require(_0x87bb('0x7'));var client=jayson[_0x87bb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9f70,_0x3ff8d3,_0x44a616){return new BPromise(function(_0x4dc2c0,_0x4e26a4){return client[_0x87bb('0x9')](_0xd9f70,_0x44a616)['then'](function(_0x71c064){logger[_0x87bb('0xa')](_0x87bb('0xb'),_0x3ff8d3,_0x87bb('0xc'));logger[_0x87bb('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3ff8d3,_0x87bb('0xc'),JSON[_0x87bb('0xe')](_0x71c064));if(_0x71c064['error']){if(_0x71c064[_0x87bb('0xf')][_0x87bb('0x10')]===0x1f4){logger[_0x87bb('0xf')](_0x87bb('0xb'),_0x3ff8d3,_0x71c064['error'][_0x87bb('0x11')]);return _0x4e26a4(_0x71c064[_0x87bb('0xf')]['message']);}logger[_0x87bb('0xf')](_0x87bb('0xb'),_0x3ff8d3,_0x71c064[_0x87bb('0xf')][_0x87bb('0x11')]);return _0x4dc2c0(_0x71c064['error'][_0x87bb('0x11')]);}else{logger['info'](_0x87bb('0xb'),_0x3ff8d3,_0x87bb('0xc'));_0x4dc2c0(_0x71c064['result'][_0x87bb('0x11')]);}})['catch'](function(_0x3403ab){logger['error'](_0x87bb('0xb'),_0x3ff8d3,_0x3403ab);_0x4e26a4(_0x3403ab);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index e48145e..b15fe32 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 _0x5878=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x54bb25,_0x57eb28){var _0x3ec411=function(_0x17f4ae){while(--_0x17f4ae){_0x54bb25['push'](_0x54bb25['shift']());}};_0x3ec411(++_0x57eb28);}(_0x5878,0x189));var _0x8587=function(_0x45f4dd,_0x4bd47c){_0x45f4dd=_0x45f4dd-0x0;var _0x4dd916=_0x5878[_0x45f4dd];return _0x4dd916;};'use strict';var multer=require(_0x8587('0x0'));var util=require(_0x8587('0x1'));var path=require(_0x8587('0x2'));var timeout=require(_0x8587('0x3'));var express=require(_0x8587('0x4'));var router=express[_0x8587('0x5')]();var fs_extra=require(_0x8587('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8587('0x7'));var config=require(_0x8587('0x8'));var controller=require('./intZendeskField.controller');router[_0x8587('0x9')]('/',auth[_0x8587('0xa')](),controller['index']);router[_0x8587('0x9')](_0x8587('0xb'),auth[_0x8587('0xa')](),controller['show']);router[_0x8587('0xc')]('/',auth[_0x8587('0xa')](),controller[_0x8587('0xd')]);router['put'](_0x8587('0xb'),auth['isAuthenticated'](),controller[_0x8587('0xe')]);router[_0x8587('0xf')](_0x8587('0xb'),auth[_0x8587('0xa')](),controller[_0x8587('0x10')]);module[_0x8587('0x11')]=router; \ No newline at end of file +var _0x839c=['/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated'];(function(_0x4df0b1,_0x5f1a48){var _0x150816=function(_0x52d099){while(--_0x52d099){_0x4df0b1['push'](_0x4df0b1['shift']());}};_0x150816(++_0x5f1a48);}(_0x839c,0x18f));var _0xc839=function(_0x4e1205,_0xb52446){_0x4e1205=_0x4e1205-0x0;var _0x180e0b=_0x839c[_0x4e1205];return _0x180e0b;};'use strict';var multer=require('multer');var util=require(_0xc839('0x0'));var path=require('path');var timeout=require(_0xc839('0x1'));var express=require('express');var router=express[_0xc839('0x2')]();var fs_extra=require(_0xc839('0x3'));var auth=require(_0xc839('0x4'));var interaction=require(_0xc839('0x5'));var config=require('../../config/environment');var controller=require(_0xc839('0x6'));router[_0xc839('0x7')]('/',auth[_0xc839('0x8')](),controller['index']);router[_0xc839('0x7')](_0xc839('0x9'),auth[_0xc839('0x8')](),controller[_0xc839('0xa')]);router['post']('/',auth[_0xc839('0x8')](),controller[_0xc839('0xb')]);router[_0xc839('0xc')](_0xc839('0x9'),auth[_0xc839('0x8')](),controller[_0xc839('0xd')]);router[_0xc839('0xe')](_0xc839('0x9'),auth[_0xc839('0x8')](),controller[_0xc839('0xf')]);module[_0xc839('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index cbdb4d2..30472d8 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 _0x4b26=['BOOLEAN','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x3b7f76,_0xa1383a){var _0x4c0956=function(_0x55d6b4){while(--_0x55d6b4){_0x3b7f76['push'](_0x3b7f76['shift']());}};_0x4c0956(++_0xa1383a);}(_0x4b26,0xd9));var _0x64b2=function(_0x2d0e92,_0x3f8cec){_0x2d0e92=_0x2d0e92-0x0;var _0x1a0cf2=_0x4b26[_0x2d0e92];return _0x1a0cf2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x64b2('0x0')](_0x64b2('0x1'),'variable',_0x64b2('0x2'),_0x64b2('0x3'),_0x64b2('0x4')),'defaultValue':_0x64b2('0x1')},'content':{'type':Sequelize[_0x64b2('0x5')]},'key':{'type':Sequelize[_0x64b2('0x5')]},'keyType':{'type':Sequelize[_0x64b2('0x0')](_0x64b2('0x1'),_0x64b2('0x6'),_0x64b2('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x64b2('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x64b2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64b2('0x5')]}}; \ No newline at end of file +var _0xef4e=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xef4e,0x72));var _0xeef4=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0xef4e[_0x2f42d3];return _0x25a67e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xeef4('0x0')](_0xeef4('0x1'),_0xeef4('0x2'),_0xeef4('0x3'),_0xeef4('0x4'),_0xeef4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeef4('0x6')]},'key':{'type':Sequelize[_0xeef4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xeef4('0x1'),'variable',_0xeef4('0x3'))},'keyContent':{'type':Sequelize[_0xeef4('0x6')]},'idField':{'type':Sequelize[_0xeef4('0x6')]},'nameField':{'type':Sequelize[_0xeef4('0x6')]},'customField':{'type':Sequelize[_0xeef4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index db07567..68d9726 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 _0xeec6=['count','set','json','apply','reject','update','then','destroy','error','stack','name','send','map','ZendeskField','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0xeec6,0x1aa));var _0x6eec=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xeec6[_0x16539a];return _0x200796;};'use strict';var emlformat=require(_0x6eec('0x0'));var rimraf=require(_0x6eec('0x1'));var zipdir=require(_0x6eec('0x2'));var jsonpatch=require(_0x6eec('0x3'));var rp=require(_0x6eec('0x4'));var moment=require(_0x6eec('0x5'));var BPromise=require(_0x6eec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6eec('0x7'));var csv=require('to-csv');var ejs=require(_0x6eec('0x8'));var fs=require('fs');var fs_extra=require(_0x6eec('0x9'));var _=require(_0x6eec('0xa'));var squel=require(_0x6eec('0xb'));var crypto=require(_0x6eec('0xc'));var jsforce=require(_0x6eec('0xd'));var deskjs=require(_0x6eec('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6eec('0xf'));var Redis=require(_0x6eec('0x10'));var authService=require(_0x6eec('0x11'));var qs=require(_0x6eec('0x12'));var as=require(_0x6eec('0x13'));var hardwareService=require(_0x6eec('0x14'));var logger=require(_0x6eec('0x15'))(_0x6eec('0x16'));var utils=require('../../config/utils');var config=require(_0x6eec('0x17'));var licenseUtil=require(_0x6eec('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e4ff,_0x2d505f){_0x2d505f=_0x2d505f||0xcc;return function(_0x4c7833){if(_0x4c7833){return _0x19e4ff[_0x6eec('0x19')](_0x2d505f);}return _0x19e4ff[_0x6eec('0x1a')](_0x2d505f)[_0x6eec('0x1b')]();};}function respondWithResult(_0x4c3290,_0x431d1d){_0x431d1d=_0x431d1d||0xc8;return function(_0x551654){if(_0x551654){return _0x4c3290[_0x6eec('0x1a')](_0x431d1d)['json'](_0x551654);}};}function respondWithFilteredResult(_0x5c5e29,_0x20396e){return function(_0x513dca){if(_0x513dca){var _0x35f3fa=typeof _0x20396e[_0x6eec('0x1c')]===_0x6eec('0x1d')&&typeof _0x20396e['limit']===_0x6eec('0x1d');var _0x25e6a9=_0x513dca[_0x6eec('0x1e')];var _0x51040d=_0x35f3fa?0x0:_0x20396e['offset'];var _0x58f2e3=_0x35f3fa?_0x513dca[_0x6eec('0x1e')]:_0x20396e['offset']+_0x20396e['limit'];var _0x31d62a;if(_0x58f2e3>=_0x25e6a9){_0x58f2e3=_0x25e6a9;_0x31d62a=0xc8;}else{_0x31d62a=0xce;}_0x5c5e29[_0x6eec('0x1a')](_0x31d62a);return _0x5c5e29[_0x6eec('0x1f')]('Content-Range',_0x51040d+'-'+_0x58f2e3+'/'+_0x25e6a9)[_0x6eec('0x20')](_0x513dca);}return null;};}function patchUpdates(_0x43ef37){return function(_0x4497d6){try{jsonpatch[_0x6eec('0x21')](_0x4497d6,_0x43ef37,!![]);}catch(_0x233338){return BPromise[_0x6eec('0x22')](_0x233338);}return _0x4497d6['save']();};}function saveUpdates(_0x332b04,_0xabcf59){return function(_0x26ddf2){if(_0x26ddf2){return _0x26ddf2[_0x6eec('0x23')](_0x332b04)[_0x6eec('0x24')](function(_0x3bc419){return _0x3bc419;});}return null;};}function removeEntity(_0x5a4bee,_0x2e4fb0){return function(_0x4216fa){if(_0x4216fa){return _0x4216fa[_0x6eec('0x25')]()[_0x6eec('0x24')](function(){_0x5a4bee[_0x6eec('0x1a')](0xcc)[_0x6eec('0x1b')]();});}};}function handleEntityNotFound(_0x6bc300,_0x8bc91a){return function(_0x121ef7){if(!_0x121ef7){_0x6bc300[_0x6eec('0x19')](0x194);}return _0x121ef7;};}function handleError(_0x99c549,_0x5eb67f){_0x5eb67f=_0x5eb67f||0x1f4;return function(_0x507c70){logger[_0x6eec('0x26')](_0x507c70[_0x6eec('0x27')]);if(_0x507c70[_0x6eec('0x28')]){delete _0x507c70[_0x6eec('0x28')];}_0x99c549[_0x6eec('0x1a')](_0x5eb67f)[_0x6eec('0x29')](_0x507c70);};}exports['index']=function(_0x285a18,_0x433961){var _0x240786={},_0x2e9ac4={},_0x40f78e={'count':0x0,'rows':[]};var _0x2772cc=_[_0x6eec('0x2a')](db[_0x6eec('0x2b')]['rawAttributes'],function(_0x364db7){return{'name':_0x364db7[_0x6eec('0x2c')],'type':_0x364db7[_0x6eec('0x2d')]['key']};});_0x2e9ac4[_0x6eec('0x2e')]=_[_0x6eec('0x2a')](_0x2772cc,_0x6eec('0x28'));_0x2e9ac4[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x285a18[_0x6eec('0x2f')]);_0x2e9ac4['filters']=_['intersection'](_0x2e9ac4['model'],_0x2e9ac4[_0x6eec('0x2f')]);_0x240786['attributes']=_[_0x6eec('0x31')](_0x2e9ac4[_0x6eec('0x2e')],qs['fields'](_0x285a18['query']['fields']));_0x240786[_0x6eec('0x32')]=_0x240786[_0x6eec('0x32')][_0x6eec('0x33')]?_0x240786[_0x6eec('0x32')]:_0x2e9ac4[_0x6eec('0x2e')];if(!_0x285a18[_0x6eec('0x2f')][_0x6eec('0x34')](_0x6eec('0x35'))){_0x240786[_0x6eec('0x36')]=qs[_0x6eec('0x36')](_0x285a18[_0x6eec('0x2f')]['limit']);_0x240786[_0x6eec('0x1c')]=qs[_0x6eec('0x1c')](_0x285a18[_0x6eec('0x2f')][_0x6eec('0x1c')]);}_0x240786[_0x6eec('0x37')]=qs[_0x6eec('0x38')](_0x285a18[_0x6eec('0x2f')][_0x6eec('0x38')]);_0x240786['where']=qs[_0x6eec('0x39')](_[_0x6eec('0x3a')](_0x285a18['query'],_0x2e9ac4[_0x6eec('0x39')]),_0x2772cc);if(_0x285a18[_0x6eec('0x2f')][_0x6eec('0x3b')]){_0x240786['where']=_[_0x6eec('0x3c')](_0x240786[_0x6eec('0x3d')],{'$or':_[_0x6eec('0x2a')](_0x2772cc,function(_0x2da32c){if(_0x2da32c[_0x6eec('0x2d')]!==_0x6eec('0x3e')){var _0x32603f={};_0x32603f[_0x2da32c[_0x6eec('0x28')]]={'$like':'%'+_0x285a18[_0x6eec('0x2f')]['filter']+'%'};return _0x32603f;}})});}_0x240786=_[_0x6eec('0x3c')]({},_0x240786,_0x285a18[_0x6eec('0x3f')]);var _0x359a88={'where':_0x240786[_0x6eec('0x3d')]};return db['ZendeskField'][_0x6eec('0x1e')](_0x359a88)[_0x6eec('0x24')](function(_0x26bedf){_0x40f78e[_0x6eec('0x1e')]=_0x26bedf;if(_0x285a18[_0x6eec('0x2f')][_0x6eec('0x40')]){_0x240786[_0x6eec('0x41')]=[{'all':!![]}];}return db[_0x6eec('0x2b')][_0x6eec('0x42')](_0x240786);})[_0x6eec('0x24')](function(_0x2470ee){_0x40f78e[_0x6eec('0x43')]=_0x2470ee;return _0x40f78e;})[_0x6eec('0x24')](respondWithFilteredResult(_0x433961,_0x240786))[_0x6eec('0x44')](handleError(_0x433961,null));};exports[_0x6eec('0x45')]=function(_0x20dcd1,_0x56faea){var _0x4d82ed={'raw':!![],'where':{'id':_0x20dcd1['params']['id']}},_0x52f30a={};_0x52f30a[_0x6eec('0x2e')]=_[_0x6eec('0x30')](db[_0x6eec('0x2b')][_0x6eec('0x46')]);_0x52f30a[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x20dcd1[_0x6eec('0x2f')]);_0x52f30a['filters']=_['intersection'](_0x52f30a[_0x6eec('0x2e')],_0x52f30a[_0x6eec('0x2f')]);_0x4d82ed[_0x6eec('0x32')]=_[_0x6eec('0x31')](_0x52f30a[_0x6eec('0x2e')],qs[_0x6eec('0x47')](_0x20dcd1[_0x6eec('0x2f')][_0x6eec('0x47')]));_0x4d82ed[_0x6eec('0x32')]=_0x4d82ed['attributes'][_0x6eec('0x33')]?_0x4d82ed[_0x6eec('0x32')]:_0x52f30a[_0x6eec('0x2e')];if(_0x20dcd1[_0x6eec('0x2f')][_0x6eec('0x40')]){_0x4d82ed[_0x6eec('0x41')]=[{'all':!![]}];}_0x4d82ed=_[_0x6eec('0x3c')]({},_0x4d82ed,_0x20dcd1['options']);return db[_0x6eec('0x2b')][_0x6eec('0x48')](_0x4d82ed)['then'](handleEntityNotFound(_0x56faea,null))[_0x6eec('0x24')](respondWithResult(_0x56faea,null))[_0x6eec('0x44')](handleError(_0x56faea,null));};exports[_0x6eec('0x49')]=function(_0x5abb41,_0x71ba1){return db[_0x6eec('0x2b')]['create'](_0x5abb41[_0x6eec('0x4a')],{})['then'](respondWithResult(_0x71ba1,0xc9))[_0x6eec('0x44')](handleError(_0x71ba1,null));};exports[_0x6eec('0x23')]=function(_0x35e020,_0x5a8182){if(_0x35e020['body']['id']){delete _0x35e020[_0x6eec('0x4a')]['id'];}return db[_0x6eec('0x2b')]['find']({'where':{'id':_0x35e020[_0x6eec('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a8182,null))[_0x6eec('0x24')](saveUpdates(_0x35e020[_0x6eec('0x4a')],null))[_0x6eec('0x24')](respondWithResult(_0x5a8182,null))[_0x6eec('0x44')](handleError(_0x5a8182,null));};exports['destroy']=function(_0x54d409,_0x38a13a){return db[_0x6eec('0x2b')][_0x6eec('0x48')]({'where':{'id':_0x54d409[_0x6eec('0x4b')]['id']}})[_0x6eec('0x24')](handleEntityNotFound(_0x38a13a,null))[_0x6eec('0x24')](removeEntity(_0x38a13a,null))[_0x6eec('0x44')](handleError(_0x38a13a,null));}; \ No newline at end of file +var _0xc6d8=['params','find','create','body','update','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','then','includeAll','include','findAll','catch','show'];(function(_0x2f133c,_0x2d0ee7){var _0x17fe82=function(_0x42cd77){while(--_0x42cd77){_0x2f133c['push'](_0x2f133c['shift']());}};_0x17fe82(++_0x2d0ee7);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x301075,_0x33b785){_0x301075=_0x301075-0x0;var _0x1a04c5=_0xc6d8[_0x301075];return _0x1a04c5;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a9c4,_0x490b46){return function(_0x23c893){if(!_0x23c893){_0x15a9c4[_0x8c6d('0x16')](0x194);}return _0x23c893;};}function handleError(_0x353ba5,_0x2b6d18){_0x2b6d18=_0x2b6d18||0x1f4;return function(_0x1e6755){logger[_0x8c6d('0x22')](_0x1e6755[_0x8c6d('0x23')]);if(_0x1e6755[_0x8c6d('0x24')]){delete _0x1e6755[_0x8c6d('0x24')];}_0x353ba5['status'](_0x2b6d18)['send'](_0x1e6755);};}exports[_0x8c6d('0x25')]=function(_0x93a094,_0xfc6000){var _0x42a7db={},_0x370626={},_0x316ca7={'count':0x0,'rows':[]};var _0x2bc94a=_[_0x8c6d('0x26')](db[_0x8c6d('0x27')][_0x8c6d('0x28')],function(_0x3375dd){return{'name':_0x3375dd[_0x8c6d('0x29')],'type':_0x3375dd['type'][_0x8c6d('0x2a')]};});_0x370626[_0x8c6d('0x2b')]=_[_0x8c6d('0x26')](_0x2bc94a,_0x8c6d('0x24'));_0x370626[_0x8c6d('0x2c')]=_[_0x8c6d('0x2d')](_0x93a094[_0x8c6d('0x2c')]);_0x370626[_0x8c6d('0x2e')]=_[_0x8c6d('0x2f')](_0x370626['model'],_0x370626[_0x8c6d('0x2c')]);_0x42a7db['attributes']=_[_0x8c6d('0x2f')](_0x370626[_0x8c6d('0x2b')],qs[_0x8c6d('0x30')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x30')]));_0x42a7db[_0x8c6d('0x31')]=_0x42a7db['attributes']['length']?_0x42a7db[_0x8c6d('0x31')]:_0x370626[_0x8c6d('0x2b')];if(!_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x32')]('nolimit')){_0x42a7db[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x1c')]);_0x42a7db[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x93a094['query'][_0x8c6d('0x19')]);}_0x42a7db[_0x8c6d('0x33')]=qs[_0x8c6d('0x34')](_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x34')]);_0x42a7db[_0x8c6d('0x35')]=qs[_0x8c6d('0x2e')](_[_0x8c6d('0x36')](_0x93a094[_0x8c6d('0x2c')],_0x370626[_0x8c6d('0x2e')]),_0x2bc94a);if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x37')]){_0x42a7db['where']=_[_0x8c6d('0x38')](_0x42a7db[_0x8c6d('0x35')],{'$or':_[_0x8c6d('0x26')](_0x2bc94a,function(_0x454e96){if(_0x454e96[_0x8c6d('0x39')]!=='VIRTUAL'){var _0x26027f={};_0x26027f[_0x454e96[_0x8c6d('0x24')]]={'$like':'%'+_0x93a094['query'][_0x8c6d('0x37')]+'%'};return _0x26027f;}})});}_0x42a7db=_[_0x8c6d('0x38')]({},_0x42a7db,_0x93a094[_0x8c6d('0x3a')]);var _0x4869dc={'where':_0x42a7db[_0x8c6d('0x35')]};return db[_0x8c6d('0x27')][_0x8c6d('0x1b')](_0x4869dc)[_0x8c6d('0x3b')](function(_0x2f54a2){_0x316ca7[_0x8c6d('0x1b')]=_0x2f54a2;if(_0x93a094[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x42a7db[_0x8c6d('0x3d')]=[{'all':!![]}];}return db[_0x8c6d('0x27')][_0x8c6d('0x3e')](_0x42a7db);})['then'](function(_0x58af06){_0x316ca7['rows']=_0x58af06;return _0x316ca7;})[_0x8c6d('0x3b')](respondWithFilteredResult(_0xfc6000,_0x42a7db))[_0x8c6d('0x3f')](handleError(_0xfc6000,null));};exports[_0x8c6d('0x40')]=function(_0x3d69c3,_0x3409eb){var _0x546f04={'raw':!![],'where':{'id':_0x3d69c3[_0x8c6d('0x41')]['id']}},_0x274d01={};_0x274d01[_0x8c6d('0x2b')]=_['keys'](db[_0x8c6d('0x27')][_0x8c6d('0x28')]);_0x274d01['query']=_['keys'](_0x3d69c3['query']);_0x274d01['filters']=_['intersection'](_0x274d01[_0x8c6d('0x2b')],_0x274d01[_0x8c6d('0x2c')]);_0x546f04[_0x8c6d('0x31')]=_[_0x8c6d('0x2f')](_0x274d01[_0x8c6d('0x2b')],qs['fields'](_0x3d69c3['query']['fields']));_0x546f04['attributes']=_0x546f04[_0x8c6d('0x31')]['length']?_0x546f04[_0x8c6d('0x31')]:_0x274d01[_0x8c6d('0x2b')];if(_0x3d69c3[_0x8c6d('0x2c')][_0x8c6d('0x3c')]){_0x546f04[_0x8c6d('0x3d')]=[{'all':!![]}];}_0x546f04=_[_0x8c6d('0x38')]({},_0x546f04,_0x3d69c3['options']);return db[_0x8c6d('0x27')][_0x8c6d('0x42')](_0x546f04)['then'](handleEntityNotFound(_0x3409eb,null))[_0x8c6d('0x3b')](respondWithResult(_0x3409eb,null))[_0x8c6d('0x3f')](handleError(_0x3409eb,null));};exports['create']=function(_0x2fd4ea,_0xb6e94){return db[_0x8c6d('0x27')][_0x8c6d('0x43')](_0x2fd4ea[_0x8c6d('0x44')],{})[_0x8c6d('0x3b')](respondWithResult(_0xb6e94,0xc9))[_0x8c6d('0x3f')](handleError(_0xb6e94,null));};exports[_0x8c6d('0x45')]=function(_0x1f1609,_0x1d6c29){if(_0x1f1609[_0x8c6d('0x44')]['id']){delete _0x1f1609[_0x8c6d('0x44')]['id'];}return db[_0x8c6d('0x27')][_0x8c6d('0x42')]({'where':{'id':_0x1f1609[_0x8c6d('0x41')]['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x1d6c29,null))['then'](saveUpdates(_0x1f1609['body'],null))['then'](respondWithResult(_0x1d6c29,null))[_0x8c6d('0x3f')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x21')]=function(_0x4919b8,_0x574b08){return db['ZendeskField'][_0x8c6d('0x42')]({'where':{'id':_0x4919b8['params']['id']}})[_0x8c6d('0x3b')](handleEntityNotFound(_0x574b08,null))[_0x8c6d('0x3b')](removeEntity(_0x574b08,null))[_0x8c6d('0x3f')](handleError(_0x574b08,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f703259..8e3c263 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 _0x161b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','zendesk_unique_index','idField','FieldId'];(function(_0x52d427,_0x2e369c){var _0x44fe58=function(_0x50c5d5){while(--_0x50c5d5){_0x52d427['push'](_0x52d427['shift']());}};_0x44fe58(++_0x2e369c);}(_0x161b,0xf7));var _0xb161=function(_0x4519cb,_0x33699e){_0x4519cb=_0x4519cb-0x0;var _0x2d99ab=_0x161b[_0x4519cb];return _0x2d99ab;};'use strict';var _=require(_0xb161('0x0'));var util=require(_0xb161('0x1'));var logger=require(_0xb161('0x2'))(_0xb161('0x3'));var moment=require(_0xb161('0x4'));var BPromise=require(_0xb161('0x5'));var rp=require(_0xb161('0x6'));var fs=require('fs');var path=require(_0xb161('0x7'));var rimraf=require('rimraf');var config=require(_0xb161('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xb161('0x9')]=function(_0x548d9f,_0x1f70d9){return _0x548d9f['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xb161('0xa'),'fields':[_0xb161('0xb'),_0xb161('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba79=['request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','bluebird'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0xba79,0x11b));var _0x9ba7=function(_0x5a3d49,_0x24b21a){_0x5a3d49=_0x5a3d49-0x0;var _0x4d5c23=_0xba79[_0x5a3d49];return _0x4d5c23;};'use strict';var _=require('lodash');var util=require(_0x9ba7('0x0'));var logger=require(_0x9ba7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9ba7('0x2'));var rp=require(_0x9ba7('0x3'));var fs=require('fs');var path=require(_0x9ba7('0x4'));var rimraf=require('rimraf');var config=require(_0x9ba7('0x5'));var attributes=require(_0x9ba7('0x6'));module[_0x9ba7('0x7')]=function(_0x4be21a,_0x409014){return _0x4be21a['define'](_0x9ba7('0x8'),attributes,{'tableName':_0x9ba7('0x9'),'paranoid':![],'indexes':[{'name':_0x9ba7('0xa'),'fields':[_0x9ba7('0xb'),_0x9ba7('0xc')],'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 cd35137..cf47b45 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 _0x5357=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5357,0xdf));var _0x7535=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x5357[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7535('0x0'));var BPromise=require('bluebird');var rs=require(_0x7535('0x1'));var fs=require('fs');var Redis=require(_0x7535('0x2'));var db=require(_0x7535('0x3'))['db'];var utils=require(_0x7535('0x4'));var logger=require(_0x7535('0x5'))('rpc');var config=require(_0x7535('0x6'));var jayson=require(_0x7535('0x7'));var client=jayson['client'][_0x7535('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x438c6c,_0x365732,_0x35b853){return new BPromise(function(_0x5af7b4,_0x3477e5){return client[_0x7535('0x9')](_0x438c6c,_0x35b853)[_0x7535('0xa')](function(_0x4fb434){logger[_0x7535('0xb')](_0x7535('0xc'),_0x365732,_0x7535('0xd'));logger[_0x7535('0xe')](_0x7535('0xf'),_0x365732,_0x7535('0xd'),JSON[_0x7535('0x10')](_0x4fb434));if(_0x4fb434[_0x7535('0x11')]){if(_0x4fb434['error'][_0x7535('0x12')]===0x1f4){logger[_0x7535('0x11')]('ZendeskField,\x20%s,\x20%s',_0x365732,_0x4fb434[_0x7535('0x11')][_0x7535('0x13')]);return _0x3477e5(_0x4fb434[_0x7535('0x11')]['message']);}logger[_0x7535('0x11')](_0x7535('0xc'),_0x365732,_0x4fb434['error'][_0x7535('0x13')]);return _0x5af7b4(_0x4fb434[_0x7535('0x11')][_0x7535('0x13')]);}else{logger[_0x7535('0xb')](_0x7535('0xc'),_0x365732,'request\x20sent');_0x5af7b4(_0x4fb434['result']['message']);}})[_0x7535('0x14')](function(_0x5780ce){logger[_0x7535('0x11')](_0x7535('0xc'),_0x365732,_0x5780ce);_0x3477e5(_0x5780ce);});});} \ No newline at end of file +var _0x03d9=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x03d9,0xc3));var _0x903d=function(_0x1f7147,_0x6b1d94){_0x1f7147=_0x1f7147-0x0;var _0x517aff=_0x03d9[_0x1f7147];return _0x517aff;};'use strict';var _=require(_0x903d('0x0'));var util=require(_0x903d('0x1'));var moment=require(_0x903d('0x2'));var BPromise=require(_0x903d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x903d('0x4'));var db=require(_0x903d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x903d('0x6'))(_0x903d('0x7'));var config=require(_0x903d('0x8'));var jayson=require(_0x903d('0x9'));var client=jayson[_0x903d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10a07b,_0x390e9f,_0x5197c0){return new BPromise(function(_0x167097,_0x390205){return client['request'](_0x10a07b,_0x5197c0)[_0x903d('0xb')](function(_0x59033f){logger[_0x903d('0xc')]('ZendeskField,\x20%s,\x20%s',_0x390e9f,_0x903d('0xd'));logger[_0x903d('0xe')](_0x903d('0xf'),_0x390e9f,_0x903d('0xd'),JSON[_0x903d('0x10')](_0x59033f));if(_0x59033f['error']){if(_0x59033f[_0x903d('0x11')]['code']===0x1f4){logger[_0x903d('0x11')](_0x903d('0x12'),_0x390e9f,_0x59033f[_0x903d('0x11')][_0x903d('0x13')]);return _0x390205(_0x59033f['error'][_0x903d('0x13')]);}logger[_0x903d('0x11')](_0x903d('0x12'),_0x390e9f,_0x59033f[_0x903d('0x11')][_0x903d('0x13')]);return _0x167097(_0x59033f[_0x903d('0x11')][_0x903d('0x13')]);}else{logger[_0x903d('0xc')](_0x903d('0x12'),_0x390e9f,_0x903d('0xd'));_0x167097(_0x59033f[_0x903d('0x14')][_0x903d('0x13')]);}})['catch'](function(_0x56f989){logger[_0x903d('0x11')]('ZendeskField,\x20%s,\x20%s',_0x390e9f,_0x56f989);_0x390205(_0x56f989);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b2b1777..67a24a5 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 _0x3bef=['getConfigurations','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0xd1ffd3,_0x974111){var _0x50c827=function(_0x419abb){while(--_0x419abb){_0xd1ffd3['push'](_0xd1ffd3['shift']());}};_0x50c827(++_0x974111);}(_0x3bef,0xf9));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf3be('0x0'));var util=require(_0xf3be('0x1'));var path=require('path');var timeout=require(_0xf3be('0x2'));var express=require(_0xf3be('0x3'));var router=express[_0xf3be('0x4')]();var fs_extra=require(_0xf3be('0x5'));var auth=require(_0xf3be('0x6'));var interaction=require(_0xf3be('0x7'));var config=require(_0xf3be('0x8'));var controller=require(_0xf3be('0x9'));router[_0xf3be('0xa')]('/',auth[_0xf3be('0xb')](),controller[_0xf3be('0xc')]);router[_0xf3be('0xa')](_0xf3be('0xd'),auth[_0xf3be('0xb')](),controller['show']);router[_0xf3be('0xa')](_0xf3be('0xe'),auth['isAuthenticated'](),controller[_0xf3be('0xf')]);router[_0xf3be('0xa')]('/:id/fields',auth[_0xf3be('0xb')](),controller['getFields']);router[_0xf3be('0x10')]('/',auth[_0xf3be('0xb')](),controller[_0xf3be('0x11')]);router['post'](_0xf3be('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xf3be('0xd'),auth['isAuthenticated'](),controller[_0xf3be('0x12')]);router[_0xf3be('0x13')](_0xf3be('0xd'),auth[_0xf3be('0xb')](),controller[_0xf3be('0x14')]);module[_0xf3be('0x15')]=router; \ No newline at end of file +var _0x9968=['../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x152edd,_0x38a8c0){var _0x117e79=function(_0x56b0ce){while(--_0x56b0ce){_0x152edd['push'](_0x152edd['shift']());}};_0x117e79(++_0x38a8c0);}(_0x9968,0x72));var _0x8996=function(_0x2c1ca7,_0x507071){_0x2c1ca7=_0x2c1ca7-0x0;var _0x4fcf15=_0x9968[_0x2c1ca7];return _0x4fcf15;};'use strict';var multer=require(_0x8996('0x0'));var util=require(_0x8996('0x1'));var path=require(_0x8996('0x2'));var timeout=require(_0x8996('0x3'));var express=require('express');var router=express[_0x8996('0x4')]();var fs_extra=require(_0x8996('0x5'));var auth=require(_0x8996('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8996('0x7'));var controller=require(_0x8996('0x8'));router[_0x8996('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8996('0x9')](_0x8996('0xa'),auth[_0x8996('0xb')](),controller[_0x8996('0xc')]);router[_0x8996('0x9')](_0x8996('0xd'),auth[_0x8996('0xb')](),controller[_0x8996('0xe')]);router[_0x8996('0x9')](_0x8996('0xf'),auth['isAuthenticated'](),controller[_0x8996('0x10')]);router[_0x8996('0x11')]('/',auth['isAuthenticated'](),controller[_0x8996('0x12')]);router[_0x8996('0x11')](_0x8996('0xd'),auth[_0x8996('0xb')](),controller[_0x8996('0x13')]);router[_0x8996('0x14')](_0x8996('0xa'),auth['isAuthenticated'](),controller[_0x8996('0x15')]);router[_0x8996('0x16')](_0x8996('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x8996('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f906d79..bbcf0b0 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 _0xa8a8=['exports','STRING','sequelize'];(function(_0x36fc39,_0x3c168b){var _0x477f3e=function(_0x5d5051){while(--_0x5d5051){_0x36fc39['push'](_0x36fc39['shift']());}};_0x477f3e(++_0x3c168b);}(_0xa8a8,0xec));var _0x8a8a=function(_0x115f39,_0x308277){_0x115f39=_0x115f39-0x0;var _0x36bb30=_0xa8a8[_0x115f39];return _0x36bb30;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x5eb704,_0x3886d3){var _0x386be7=function(_0x2aee4e){while(--_0x2aee4e){_0x5eb704['push'](_0x5eb704['shift']());}};_0x386be7(++_0x3886d3);}(_0x99e9,0xb4));var _0x999e=function(_0x2b9c0c,_0x4678a3){_0x2b9c0c=_0x2b9c0c-0x0;var _0xd8577b=_0x99e9[_0x2b9c0c];return _0xd8577b;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d196271..cc07bb1 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 _0xadfc=['response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','ZohoAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','ZohoConfiguration','sort','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','channel','create','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x4a7bac,_0x1a8719){var _0x284a73=function(_0x19afeb){while(--_0x19afeb){_0x4a7bac['push'](_0x4a7bac['shift']());}};_0x284a73(++_0x1a8719);}(_0xadfc,0x9a));var _0xcadf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xadfc[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xcadf('0x0'));var rimraf=require(_0xcadf('0x1'));var zipdir=require(_0xcadf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcadf('0x3'));var moment=require(_0xcadf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcadf('0x5'));var util=require(_0xcadf('0x6'));var path=require(_0xcadf('0x7'));var sox=require('sox');var csv=require(_0xcadf('0x8'));var ejs=require(_0xcadf('0x9'));var fs=require('fs');var fs_extra=require(_0xcadf('0xa'));var _=require(_0xcadf('0xb'));var squel=require(_0xcadf('0xc'));var crypto=require(_0xcadf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcadf('0xe'));var toCsv=require(_0xcadf('0x8'));var querystring=require(_0xcadf('0xf'));var Papa=require(_0xcadf('0x10'));var Redis=require(_0xcadf('0x11'));var authService=require(_0xcadf('0x12'));var qs=require(_0xcadf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcadf('0x14'));var logger=require('../../config/logger')(_0xcadf('0x15'));var utils=require(_0xcadf('0x16'));var config=require(_0xcadf('0x17'));var licenseUtil=require(_0xcadf('0x18'));var db=require(_0xcadf('0x19'))['db'];var integrations=require(_0xcadf('0x1a'));function respondWithStatusCode(_0x3b27c5,_0x12c209){_0x12c209=_0x12c209||0xcc;return function(_0x6f1793){if(_0x6f1793){return _0x3b27c5['sendStatus'](_0x12c209);}return _0x3b27c5[_0xcadf('0x1b')](_0x12c209)[_0xcadf('0x1c')]();};}function respondWithResult(_0xb60041,_0x4a9a6d){_0x4a9a6d=_0x4a9a6d||0xc8;return function(_0x111143){if(_0x111143){return _0xb60041[_0xcadf('0x1b')](_0x4a9a6d)[_0xcadf('0x1d')](_0x111143);}};}function respondWithFilteredResult(_0x25853d,_0xd88201){return function(_0x51b68f){if(_0x51b68f){var _0x2dca75=typeof _0xd88201['offset']===_0xcadf('0x1e')&&typeof _0xd88201['limit']==='undefined';var _0x5f40b1=_0x51b68f[_0xcadf('0x1f')];var _0x349067=_0x2dca75?0x0:_0xd88201['offset'];var _0x4dccf7=_0x2dca75?_0x51b68f[_0xcadf('0x1f')]:_0xd88201['offset']+_0xd88201[_0xcadf('0x20')];var _0x3eb846;if(_0x4dccf7>=_0x5f40b1){_0x4dccf7=_0x5f40b1;_0x3eb846=0xc8;}else{_0x3eb846=0xce;}_0x25853d['status'](_0x3eb846);return _0x25853d[_0xcadf('0x21')](_0xcadf('0x22'),_0x349067+'-'+_0x4dccf7+'/'+_0x5f40b1)[_0xcadf('0x1d')](_0x51b68f);}return null;};}function patchUpdates(_0x4f508d){return function(_0x183fab){try{jsonpatch[_0xcadf('0x23')](_0x183fab,_0x4f508d,!![]);}catch(_0x124a7d){return BPromise[_0xcadf('0x24')](_0x124a7d);}return _0x183fab[_0xcadf('0x25')]();};}function saveUpdates(_0x1d8e87,_0x2bd9dc){return function(_0x4d48cb){if(_0x4d48cb){return _0x4d48cb[_0xcadf('0x26')](_0x1d8e87)['then'](function(_0x2913f){return _0x2913f;});}return null;};}function removeEntity(_0x8f84de,_0x35722e){return function(_0x4d894c){if(_0x4d894c){return _0x4d894c[_0xcadf('0x27')]()[_0xcadf('0x28')](function(){_0x8f84de[_0xcadf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe5402a,_0x5e751b){return function(_0x531acf){if(!_0x531acf){_0xe5402a[_0xcadf('0x29')](0x194);}return _0x531acf;};}function handleError(_0x17dfc8,_0x56853e){_0x56853e=_0x56853e||0x1f4;return function(_0x925985){logger[_0xcadf('0x2a')](_0x925985[_0xcadf('0x2b')]);if(_0x925985['name']){delete _0x925985[_0xcadf('0x2c')];}_0x17dfc8['status'](_0x56853e)[_0xcadf('0x2d')](_0x925985);};}exports['index']=function(_0x3e0222,_0x4f4d99){var _0x3a5cf9={},_0x189d90={},_0x1df177={'count':0x0,'rows':[]};var _0x2c01e9=_['map'](db[_0xcadf('0x2e')][_0xcadf('0x2f')],function(_0x2668cb){return{'name':_0x2668cb[_0xcadf('0x30')],'type':_0x2668cb[_0xcadf('0x31')][_0xcadf('0x32')]};});_0x189d90[_0xcadf('0x33')]=_[_0xcadf('0x34')](_0x2c01e9,'name');_0x189d90['query']=_[_0xcadf('0x35')](_0x3e0222[_0xcadf('0x36')]);_0x189d90[_0xcadf('0x37')]=_['intersection'](_0x189d90['model'],_0x189d90['query']);_0x3a5cf9[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x189d90[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3a')]));_0x3a5cf9[_0xcadf('0x38')]=_0x3a5cf9[_0xcadf('0x38')][_0xcadf('0x3b')]?_0x3a5cf9['attributes']:_0x189d90[_0xcadf('0x33')];if(!_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3c')](_0xcadf('0x3d'))){_0x3a5cf9[_0xcadf('0x20')]=qs['limit'](_0x3e0222[_0xcadf('0x36')]['limit']);_0x3a5cf9[_0xcadf('0x3e')]=qs[_0xcadf('0x3e')](_0x3e0222[_0xcadf('0x36')][_0xcadf('0x3e')]);}_0x3a5cf9[_0xcadf('0x3f')]=qs['sort'](_0x3e0222[_0xcadf('0x36')]['sort']);_0x3a5cf9[_0xcadf('0x40')]=qs[_0xcadf('0x37')](_[_0xcadf('0x41')](_0x3e0222[_0xcadf('0x36')],_0x189d90[_0xcadf('0x37')]),_0x2c01e9);if(_0x3e0222[_0xcadf('0x36')][_0xcadf('0x42')]){_0x3a5cf9['where']=_[_0xcadf('0x43')](_0x3a5cf9[_0xcadf('0x40')],{'$or':_[_0xcadf('0x34')](_0x2c01e9,function(_0x10b09b){if(_0x10b09b[_0xcadf('0x31')]!==_0xcadf('0x44')){var _0x505444={};_0x505444[_0x10b09b[_0xcadf('0x2c')]]={'$like':'%'+_0x3e0222[_0xcadf('0x36')][_0xcadf('0x42')]+'%'};return _0x505444;}})});}_0x3a5cf9=_[_0xcadf('0x43')]({},_0x3a5cf9,_0x3e0222[_0xcadf('0x45')]);var _0x292c9a={'where':_0x3a5cf9[_0xcadf('0x40')]};return db[_0xcadf('0x2e')]['count'](_0x292c9a)[_0xcadf('0x28')](function(_0x1123e3){_0x1df177[_0xcadf('0x1f')]=_0x1123e3;if(_0x3e0222[_0xcadf('0x36')][_0xcadf('0x46')]){_0x3a5cf9[_0xcadf('0x47')]=[{'all':!![]}];}return db[_0xcadf('0x2e')][_0xcadf('0x48')](_0x3a5cf9);})[_0xcadf('0x28')](function(_0x39587b){_0x1df177[_0xcadf('0x49')]=_0x39587b;return _0x1df177;})[_0xcadf('0x28')](respondWithFilteredResult(_0x4f4d99,_0x3a5cf9))[_0xcadf('0x4a')](handleError(_0x4f4d99,null));};exports['show']=function(_0x234150,_0x587648){var _0x5d0008={'raw':![],'where':{'id':_0x234150[_0xcadf('0x4b')]['id']}},_0x30f853={};_0x30f853[_0xcadf('0x33')]=_['keys'](db[_0xcadf('0x2e')][_0xcadf('0x2f')]);_0x30f853[_0xcadf('0x36')]=_['keys'](_0x234150[_0xcadf('0x36')]);_0x30f853[_0xcadf('0x37')]=_['intersection'](_0x30f853[_0xcadf('0x33')],_0x30f853[_0xcadf('0x36')]);_0x5d0008[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x30f853[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x234150[_0xcadf('0x36')][_0xcadf('0x3a')]));_0x5d0008[_0xcadf('0x38')]=_0x5d0008['attributes'][_0xcadf('0x3b')]?_0x5d0008[_0xcadf('0x38')]:_0x30f853[_0xcadf('0x33')];if(_0x234150['query'][_0xcadf('0x46')]){_0x5d0008[_0xcadf('0x47')]=[{'all':!![]}];}_0x5d0008=_['merge']({},_0x5d0008,_0x234150[_0xcadf('0x45')]);return db[_0xcadf('0x2e')][_0xcadf('0x4c')](_0x5d0008)[_0xcadf('0x28')](handleEntityNotFound(_0x587648,null))[_0xcadf('0x28')](respondWithResult(_0x587648,null))[_0xcadf('0x4a')](handleError(_0x587648,null));};exports['create']=function(_0x4835b3,_0x1b6c21){return db[_0xcadf('0x2e')]['create'](_0x4835b3[_0xcadf('0x4d')],{})[_0xcadf('0x28')](respondWithResult(_0x1b6c21,0xc9))[_0xcadf('0x4a')](handleError(_0x1b6c21,null));};exports[_0xcadf('0x26')]=function(_0x8fcdb2,_0x160b17){if(_0x8fcdb2[_0xcadf('0x4d')]['id']){delete _0x8fcdb2[_0xcadf('0x4d')]['id'];}return db['ZohoAccount'][_0xcadf('0x4c')]({'where':{'id':_0x8fcdb2[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x160b17,null))[_0xcadf('0x28')](saveUpdates(_0x8fcdb2[_0xcadf('0x4d')],null))[_0xcadf('0x28')](respondWithResult(_0x160b17,null))[_0xcadf('0x4a')](handleError(_0x160b17,null));};exports['destroy']=function(_0x5eaee0,_0x2e9202){return db[_0xcadf('0x2e')][_0xcadf('0x4c')]({'where':{'id':_0x5eaee0[_0xcadf('0x4b')]['id']}})[_0xcadf('0x28')](handleEntityNotFound(_0x2e9202,null))[_0xcadf('0x28')](removeEntity(_0x2e9202,null))[_0xcadf('0x4a')](handleError(_0x2e9202,null));};exports['getConfigurations']=function(_0x18ec4c,_0x41b064,_0x4742d9){var _0x1e1b63={};var _0x403f8e={};var _0x3db1b3;var _0x521e31;return db[_0xcadf('0x2e')]['findOne']({'where':{'id':_0x18ec4c[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41b064,null))['then'](function(_0x35b4e2){if(_0x35b4e2){_0x3db1b3=_0x35b4e2;_0x403f8e[_0xcadf('0x33')]=_[_0xcadf('0x35')](db[_0xcadf('0x4e')][_0xcadf('0x2f')]);_0x403f8e['query']=_[_0xcadf('0x35')](_0x18ec4c[_0xcadf('0x36')]);_0x403f8e[_0xcadf('0x37')]=_['intersection'](_0x403f8e['model'],_0x403f8e[_0xcadf('0x36')]);_0x1e1b63[_0xcadf('0x38')]=_[_0xcadf('0x39')](_0x403f8e[_0xcadf('0x33')],qs[_0xcadf('0x3a')](_0x18ec4c['query']['fields']));_0x1e1b63[_0xcadf('0x38')]=_0x1e1b63[_0xcadf('0x38')][_0xcadf('0x3b')]?_0x1e1b63['attributes']:_0x403f8e[_0xcadf('0x33')];_0x1e1b63['order']=qs[_0xcadf('0x4f')](_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x4f')]);_0x1e1b63[_0xcadf('0x40')]=qs[_0xcadf('0x37')](_[_0xcadf('0x41')](_0x18ec4c[_0xcadf('0x36')],_0x403f8e[_0xcadf('0x37')]));if(_0x18ec4c['query'][_0xcadf('0x42')]){_0x1e1b63[_0xcadf('0x40')]=_[_0xcadf('0x43')](_0x1e1b63['where'],{'$or':_[_0xcadf('0x34')](_0x1e1b63[_0xcadf('0x38')],function(_0x17bdc0){var _0x4d7536={};_0x4d7536[_0x17bdc0]={'$like':'%'+_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x42')]+'%'};return _0x4d7536;})});}_0x1e1b63=_[_0xcadf('0x43')]({},_0x1e1b63,_0x18ec4c[_0xcadf('0x45')]);return _0x3db1b3[_0xcadf('0x50')](_0x1e1b63);}})[_0xcadf('0x28')](function(_0x3eef6c){if(_0x3eef6c){_0x521e31=_0x3eef6c[_0xcadf('0x3b')];if(!_0x18ec4c[_0xcadf('0x36')]['hasOwnProperty']('nolimit')){_0x1e1b63[_0xcadf('0x20')]=qs[_0xcadf('0x20')](_0x18ec4c[_0xcadf('0x36')][_0xcadf('0x20')]);_0x1e1b63[_0xcadf('0x3e')]=qs['offset'](_0x18ec4c['query']['offset']);}return _0x3db1b3[_0xcadf('0x50')](_0x1e1b63);}})['then'](function(_0x99b6bf){if(_0x99b6bf){return _0x99b6bf?{'count':_0x521e31,'rows':_0x99b6bf}:null;}})[_0xcadf('0x28')](respondWithResult(_0x41b064,null))[_0xcadf('0x4a')](handleError(_0x41b064,null));};exports[_0xcadf('0x51')]=function(_0x4c0e85,_0x48709d,_0x274fa7){if(_0x4c0e85[_0xcadf('0x4d')]['id']){delete _0x4c0e85[_0xcadf('0x4d')]['id'];}return db[_0xcadf('0x2e')]['findOne']({'where':{'id':_0x4c0e85[_0xcadf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48709d,null))['then'](function(_0x4ac036){if(_0x4ac036){_0x4c0e85[_0xcadf('0x4d')]['AccountId']=_0x4ac036['id'];_0x4c0e85['body'][_0xcadf('0x52')]=integrations[_0xcadf('0x53')](_0x4c0e85[_0xcadf('0x4d')]['channel'],_0x4c0e85[_0xcadf('0x4d')]['type']);_0x4c0e85[_0xcadf('0x4d')][_0xcadf('0x54')]=integrations['getDescriptions'](_0x4c0e85['body'][_0xcadf('0x55')],_0x4c0e85[_0xcadf('0x4d')][_0xcadf('0x31')]);return db[_0xcadf('0x4e')][_0xcadf('0x56')](_0x4c0e85['body'],{'include':[{'model':db['ZohoField'],'as':_0xcadf('0x52')},{'model':db[_0xcadf('0x57')],'as':_0xcadf('0x54')}]});}return null;})['then'](respondWithResult(_0x48709d,null))['catch'](handleError(_0x48709d,null));};function getAccessToken(_0xf024f5){return new Promise(function(_0x5a3b58,_0x1d8194){var _0x141cd4;switch(_0xf024f5[_0xcadf('0x58')]){case'US':_0x141cd4='https://accounts.zoho.com';break;case'AU':_0x141cd4='https://accounts.zoho.com.au';break;case'EU':_0x141cd4=_0xcadf('0x59');break;case'IN':_0x141cd4=_0xcadf('0x5a');break;case'CN':_0x141cd4=_0xcadf('0x5b');break;default:_0x141cd4=_0xcadf('0x59');break;}var _0x2927b2={'method':_0xcadf('0x5c'),'uri':_0x141cd4+_0xcadf('0x5d'),'qs':{'refresh_token':_0xf024f5[_0xcadf('0x5e')],'client_id':_0xf024f5['clientId'],'client_secret':_0xf024f5[_0xcadf('0x5f')],'grant_type':_0xcadf('0x60')},'json':!![]};return rp(_0x2927b2)[_0xcadf('0x28')](function(_0x5c5433){if(_0x5c5433[_0xcadf('0x61')]){_0x5a3b58(_0x5c5433[_0xcadf('0x61')]);}else{_0x1d8194(_0xcadf('0x62'));}})['catch'](function(_0x237b5c){_0x1d8194(_0x237b5c);});});}exports[_0xcadf('0x63')]=function(_0x3dbd16,_0x284535,_0x18f886){var _0x5e94f6,_0x25c046,_0x3d4114,_0x149650,_0x1aa0c5;return db['ZohoAccount']['findOne']({'where':{'id':_0x3dbd16[_0xcadf('0x4b')]['id']},'attributes':['id',_0xcadf('0x64'),_0xcadf('0x58'),_0xcadf('0x65'),_0xcadf('0x5f'),_0xcadf('0x66'),'code',_0xcadf('0x5e')]})[_0xcadf('0x28')](handleEntityNotFound(_0x284535,null))[_0xcadf('0x28')](function(_0x2a10e7){_0x1aa0c5=_0x2a10e7;_0x5e94f6=_0x1aa0c5[_0xcadf('0x64')];_0x25c046=_0x5e94f6===_0xcadf('0x67')?'eu':'com';_0x3d4114=_0x1aa0c5[_0xcadf('0x66')];var _0x2cd4cf=_0x3d4114[_0xcadf('0x68')](-0x1);if(_0x2cd4cf==='/'||_0x2cd4cf==='\x5c'||_0x2cd4cf===':'){_0x3d4114=_0x3d4114[_0xcadf('0x69')](0x0,_0x3d4114[_0xcadf('0x6a')](_0x2cd4cf));}if(!_0x1aa0c5[_0xcadf('0x5e')]){throw new Error(_0xcadf('0x6b'));}return getAccessToken(_0x1aa0c5);})['then'](function(_0x1292c8){if(_0x1292c8){return rp({'method':_0xcadf('0x6c'),'uri':util['format'](_0xcadf('0x6d'),_0x25c046),'qs':{'module':_0xcadf('0x6e')},'headers':{'Authorization':_0xcadf('0x6f')+_0x1292c8},'json':!![]});}})[_0xcadf('0x28')](function(_0x5e7b12){if(_0x5e7b12){if(_0x5e7b12[_0xcadf('0x70')]&&_0x5e7b12['response'][_0xcadf('0x2a')]){throw new Error(_0x5e7b12[_0xcadf('0x70')][_0xcadf('0x2a')][_0xcadf('0x71')]);}var _0x1b4761=[];var _0x5cbe61=[];var _0x30d216=[_0xcadf('0x72'),_0xcadf('0x73'),_0xcadf('0x74'),_0xcadf('0x75'),_0xcadf('0x76'),'Call_Result','Call_Start_Time',_0xcadf('0x77')];_0x5cbe61=_[_0xcadf('0x78')](_0x5e7b12['fields'],function(_0x25ac3f){return _0x30d216[_0xcadf('0x79')](_0x25ac3f[_0xcadf('0x7a')]);});for(var _0x34d8cf=0x0;_0x34d8cf<_0x5cbe61[_0xcadf('0x3b')];_0x34d8cf++){if(_0x5cbe61[_0x34d8cf][_0xcadf('0x7b')]===![]){_0x1b4761[_0xcadf('0x7c')]({'id':_0x5cbe61[_0x34d8cf]['id'],'name':_0x5cbe61[_0x34d8cf][_0xcadf('0x7d')],'custom':_0x5cbe61[_0x34d8cf]['custom_field'],'options':_0x5cbe61[_0x34d8cf][_0xcadf('0x7e')]==='picklist'&&_0x5cbe61[_0x34d8cf]['pick_list_values'][_0xcadf('0x3b')]>-0x1?_[_0xcadf('0x34')](_0x5cbe61[_0x34d8cf][_0xcadf('0x7f')],function(_0x13c38b){return{'name':_0x13c38b,'value':_0x13c38b};}):[]});}}return{'count':_0x1b4761[_0xcadf('0x3b')],'rows':_0x1b4761};}else{return{'count':0x0,'rows':[]};}})[_0xcadf('0x28')](respondWithResult(_0x284535,null))['catch'](function(_0x4b22e8){var _0x338dcc=_0x3dbd16[_0xcadf('0x36')][_0xcadf('0x80')]?0x1f4:_0x4b22e8[_0xcadf('0x81')]||0x1f4;logger[_0xcadf('0x2a')](_0xcadf('0x82'),_0xcadf('0x63'),_0x338dcc,JSON[_0xcadf('0x83')](_0x4b22e8));delete _0x4b22e8[_0xcadf('0x2c')];if(_0x338dcc===0x191){_0x338dcc=0x190;}_0x284535['status'](_0x338dcc)[_0xcadf('0x2d')](_0x3dbd16['query']['test']?{'message':_0xcadf('0x84'),'statusCode':_0x4b22e8[_0xcadf('0x81')]}:_0x4b22e8);});}; \ No newline at end of file +var _0x7784=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','clientSecret','serverUrl','code','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x429364,_0x536a4c){var _0x37a298=function(_0x5a99d5){while(--_0x5a99d5){_0x429364['push'](_0x429364['shift']());}};_0x37a298(++_0x536a4c);}(_0x7784,0xc7));var _0x4778=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7784[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4778('0x0'));var zipdir=require(_0x4778('0x1'));var jsonpatch=require(_0x4778('0x2'));var rp=require(_0x4778('0x3'));var moment=require('moment');var BPromise=require(_0x4778('0x4'));var Mustache=require(_0x4778('0x5'));var util=require(_0x4778('0x6'));var path=require(_0x4778('0x7'));var sox=require('sox');var csv=require(_0x4778('0x8'));var ejs=require(_0x4778('0x9'));var fs=require('fs');var fs_extra=require(_0x4778('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4778('0xb'));var jsforce=require(_0x4778('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4778('0x8'));var querystring=require(_0x4778('0xd'));var Papa=require('papaparse');var Redis=require(_0x4778('0xe'));var authService=require(_0x4778('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4778('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4778('0x11'))(_0x4778('0x12'));var utils=require(_0x4778('0x13'));var config=require(_0x4778('0x14'));var licenseUtil=require(_0x4778('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4778('0x16'));function respondWithStatusCode(_0x5c62a5,_0x19b7b3){_0x19b7b3=_0x19b7b3||0xcc;return function(_0x43c9d1){if(_0x43c9d1){return _0x5c62a5[_0x4778('0x17')](_0x19b7b3);}return _0x5c62a5[_0x4778('0x18')](_0x19b7b3)[_0x4778('0x19')]();};}function respondWithResult(_0x3efe64,_0xf82c45){_0xf82c45=_0xf82c45||0xc8;return function(_0x2a3164){if(_0x2a3164){return _0x3efe64[_0x4778('0x18')](_0xf82c45)[_0x4778('0x1a')](_0x2a3164);}};}function respondWithFilteredResult(_0x20f204,_0xc4ef68){return function(_0x32284a){if(_0x32284a){var _0x311858=typeof _0xc4ef68['offset']===_0x4778('0x1b')&&typeof _0xc4ef68[_0x4778('0x1c')]===_0x4778('0x1b');var _0x2dc410=_0x32284a[_0x4778('0x1d')];var _0x362ece=_0x311858?0x0:_0xc4ef68[_0x4778('0x1e')];var _0xb4bf36=_0x311858?_0x32284a[_0x4778('0x1d')]:_0xc4ef68['offset']+_0xc4ef68[_0x4778('0x1c')];var _0x2f0e0a;if(_0xb4bf36>=_0x2dc410){_0xb4bf36=_0x2dc410;_0x2f0e0a=0xc8;}else{_0x2f0e0a=0xce;}_0x20f204[_0x4778('0x18')](_0x2f0e0a);return _0x20f204[_0x4778('0x1f')](_0x4778('0x20'),_0x362ece+'-'+_0xb4bf36+'/'+_0x2dc410)[_0x4778('0x1a')](_0x32284a);}return null;};}function patchUpdates(_0x4bbaec){return function(_0x71f3a4){try{jsonpatch[_0x4778('0x21')](_0x71f3a4,_0x4bbaec,!![]);}catch(_0x37a0e9){return BPromise[_0x4778('0x22')](_0x37a0e9);}return _0x71f3a4['save']();};}function saveUpdates(_0x5c70d3,_0xca59e0){return function(_0x5d5d2f){if(_0x5d5d2f){return _0x5d5d2f[_0x4778('0x23')](_0x5c70d3)[_0x4778('0x24')](function(_0x30a32f){return _0x30a32f;});}return null;};}function removeEntity(_0xcabd4b,_0x4213e2){return function(_0x3d29c7){if(_0x3d29c7){return _0x3d29c7['destroy']()[_0x4778('0x24')](function(){_0xcabd4b['status'](0xcc)[_0x4778('0x19')]();});}};}function handleEntityNotFound(_0x45097,_0x1d0500){return function(_0x22dd5a){if(!_0x22dd5a){_0x45097[_0x4778('0x17')](0x194);}return _0x22dd5a;};}function handleError(_0x38eaab,_0x2eafb0){_0x2eafb0=_0x2eafb0||0x1f4;return function(_0x372efa){logger[_0x4778('0x25')](_0x372efa['stack']);if(_0x372efa[_0x4778('0x26')]){delete _0x372efa[_0x4778('0x26')];}_0x38eaab[_0x4778('0x18')](_0x2eafb0)[_0x4778('0x27')](_0x372efa);};}exports['index']=function(_0x9b1349,_0x42026f){var _0xa668e2={},_0x48c463={},_0x4489be={'count':0x0,'rows':[]};var _0x267a6a=_[_0x4778('0x28')](db[_0x4778('0x29')][_0x4778('0x2a')],function(_0x263bc2){return{'name':_0x263bc2[_0x4778('0x2b')],'type':_0x263bc2[_0x4778('0x2c')][_0x4778('0x2d')]};});_0x48c463[_0x4778('0x2e')]=_[_0x4778('0x28')](_0x267a6a,'name');_0x48c463['query']=_[_0x4778('0x2f')](_0x9b1349[_0x4778('0x30')]);_0x48c463[_0x4778('0x31')]=_[_0x4778('0x32')](_0x48c463[_0x4778('0x2e')],_0x48c463[_0x4778('0x30')]);_0xa668e2[_0x4778('0x33')]=_['intersection'](_0x48c463['model'],qs[_0x4778('0x34')](_0x9b1349['query'][_0x4778('0x34')]));_0xa668e2[_0x4778('0x33')]=_0xa668e2[_0x4778('0x33')][_0x4778('0x35')]?_0xa668e2['attributes']:_0x48c463[_0x4778('0x2e')];if(!_0x9b1349[_0x4778('0x30')]['hasOwnProperty'](_0x4778('0x36'))){_0xa668e2['limit']=qs[_0x4778('0x1c')](_0x9b1349[_0x4778('0x30')]['limit']);_0xa668e2[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x9b1349[_0x4778('0x30')][_0x4778('0x1e')]);}_0xa668e2[_0x4778('0x37')]=qs[_0x4778('0x38')](_0x9b1349['query'][_0x4778('0x38')]);_0xa668e2[_0x4778('0x39')]=qs[_0x4778('0x31')](_[_0x4778('0x3a')](_0x9b1349[_0x4778('0x30')],_0x48c463[_0x4778('0x31')]),_0x267a6a);if(_0x9b1349[_0x4778('0x30')][_0x4778('0x3b')]){_0xa668e2[_0x4778('0x39')]=_[_0x4778('0x3c')](_0xa668e2['where'],{'$or':_['map'](_0x267a6a,function(_0x2d1bcd){if(_0x2d1bcd[_0x4778('0x2c')]!==_0x4778('0x3d')){var _0xdc279e={};_0xdc279e[_0x2d1bcd['name']]={'$like':'%'+_0x9b1349[_0x4778('0x30')][_0x4778('0x3b')]+'%'};return _0xdc279e;}})});}_0xa668e2=_[_0x4778('0x3c')]({},_0xa668e2,_0x9b1349[_0x4778('0x3e')]);var _0x4838dd={'where':_0xa668e2[_0x4778('0x39')]};return db[_0x4778('0x29')][_0x4778('0x1d')](_0x4838dd)[_0x4778('0x24')](function(_0x59c05c){_0x4489be[_0x4778('0x1d')]=_0x59c05c;if(_0x9b1349[_0x4778('0x30')][_0x4778('0x3f')]){_0xa668e2[_0x4778('0x40')]=[{'all':!![]}];}return db[_0x4778('0x29')]['findAll'](_0xa668e2);})[_0x4778('0x24')](function(_0x369ecf){_0x4489be[_0x4778('0x41')]=_0x369ecf;return _0x4489be;})[_0x4778('0x24')](respondWithFilteredResult(_0x42026f,_0xa668e2))[_0x4778('0x42')](handleError(_0x42026f,null));};exports[_0x4778('0x43')]=function(_0x324791,_0x5cf74a){var _0x304228={'raw':![],'where':{'id':_0x324791[_0x4778('0x44')]['id']}},_0x397dd1={};_0x397dd1['model']=_[_0x4778('0x2f')](db[_0x4778('0x29')][_0x4778('0x2a')]);_0x397dd1[_0x4778('0x30')]=_[_0x4778('0x2f')](_0x324791[_0x4778('0x30')]);_0x397dd1['filters']=_[_0x4778('0x32')](_0x397dd1['model'],_0x397dd1[_0x4778('0x30')]);_0x304228[_0x4778('0x33')]=_['intersection'](_0x397dd1[_0x4778('0x2e')],qs[_0x4778('0x34')](_0x324791[_0x4778('0x30')][_0x4778('0x34')]));_0x304228['attributes']=_0x304228[_0x4778('0x33')][_0x4778('0x35')]?_0x304228[_0x4778('0x33')]:_0x397dd1[_0x4778('0x2e')];if(_0x324791[_0x4778('0x30')][_0x4778('0x3f')]){_0x304228[_0x4778('0x40')]=[{'all':!![]}];}_0x304228=_[_0x4778('0x3c')]({},_0x304228,_0x324791['options']);return db[_0x4778('0x29')][_0x4778('0x45')](_0x304228)[_0x4778('0x24')](handleEntityNotFound(_0x5cf74a,null))[_0x4778('0x24')](respondWithResult(_0x5cf74a,null))[_0x4778('0x42')](handleError(_0x5cf74a,null));};exports[_0x4778('0x46')]=function(_0xa65033,_0x565cc7){return db[_0x4778('0x29')][_0x4778('0x46')](_0xa65033[_0x4778('0x47')],{})['then'](respondWithResult(_0x565cc7,0xc9))['catch'](handleError(_0x565cc7,null));};exports[_0x4778('0x23')]=function(_0x380e2d,_0x6685ca){if(_0x380e2d[_0x4778('0x47')]['id']){delete _0x380e2d[_0x4778('0x47')]['id'];}return db[_0x4778('0x29')][_0x4778('0x45')]({'where':{'id':_0x380e2d[_0x4778('0x44')]['id']}})['then'](handleEntityNotFound(_0x6685ca,null))[_0x4778('0x24')](saveUpdates(_0x380e2d[_0x4778('0x47')],null))[_0x4778('0x24')](respondWithResult(_0x6685ca,null))[_0x4778('0x42')](handleError(_0x6685ca,null));};exports['destroy']=function(_0x1fee97,_0x312aff){return db[_0x4778('0x29')]['find']({'where':{'id':_0x1fee97['params']['id']}})[_0x4778('0x24')](handleEntityNotFound(_0x312aff,null))[_0x4778('0x24')](removeEntity(_0x312aff,null))[_0x4778('0x42')](handleError(_0x312aff,null));};exports[_0x4778('0x48')]=function(_0x10b7d7,_0xab6d60,_0x3b67dd){var _0x1826a6={};var _0x4512b5={};var _0x36c6c6;var _0x3f26c7;return db[_0x4778('0x29')][_0x4778('0x49')]({'where':{'id':_0x10b7d7['params']['id']}})[_0x4778('0x24')](handleEntityNotFound(_0xab6d60,null))[_0x4778('0x24')](function(_0xf92640){if(_0xf92640){_0x36c6c6=_0xf92640;_0x4512b5[_0x4778('0x2e')]=_[_0x4778('0x2f')](db[_0x4778('0x4a')][_0x4778('0x2a')]);_0x4512b5[_0x4778('0x30')]=_['keys'](_0x10b7d7['query']);_0x4512b5[_0x4778('0x31')]=_[_0x4778('0x32')](_0x4512b5[_0x4778('0x2e')],_0x4512b5[_0x4778('0x30')]);_0x1826a6[_0x4778('0x33')]=_['intersection'](_0x4512b5[_0x4778('0x2e')],qs[_0x4778('0x34')](_0x10b7d7[_0x4778('0x30')][_0x4778('0x34')]));_0x1826a6[_0x4778('0x33')]=_0x1826a6['attributes'][_0x4778('0x35')]?_0x1826a6[_0x4778('0x33')]:_0x4512b5[_0x4778('0x2e')];_0x1826a6[_0x4778('0x37')]=qs[_0x4778('0x38')](_0x10b7d7[_0x4778('0x30')]['sort']);_0x1826a6[_0x4778('0x39')]=qs[_0x4778('0x31')](_[_0x4778('0x3a')](_0x10b7d7['query'],_0x4512b5[_0x4778('0x31')]));if(_0x10b7d7[_0x4778('0x30')][_0x4778('0x3b')]){_0x1826a6[_0x4778('0x39')]=_[_0x4778('0x3c')](_0x1826a6[_0x4778('0x39')],{'$or':_[_0x4778('0x28')](_0x1826a6['attributes'],function(_0x137882){var _0x29edf8={};_0x29edf8[_0x137882]={'$like':'%'+_0x10b7d7[_0x4778('0x30')][_0x4778('0x3b')]+'%'};return _0x29edf8;})});}_0x1826a6=_['merge']({},_0x1826a6,_0x10b7d7[_0x4778('0x3e')]);return _0x36c6c6['getConfigurations'](_0x1826a6);}})[_0x4778('0x24')](function(_0x346e87){if(_0x346e87){_0x3f26c7=_0x346e87[_0x4778('0x35')];if(!_0x10b7d7[_0x4778('0x30')][_0x4778('0x4b')]('nolimit')){_0x1826a6[_0x4778('0x1c')]=qs[_0x4778('0x1c')](_0x10b7d7['query'][_0x4778('0x1c')]);_0x1826a6[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x10b7d7[_0x4778('0x30')][_0x4778('0x1e')]);}return _0x36c6c6[_0x4778('0x48')](_0x1826a6);}})[_0x4778('0x24')](function(_0x403178){if(_0x403178){return _0x403178?{'count':_0x3f26c7,'rows':_0x403178}:null;}})[_0x4778('0x24')](respondWithResult(_0xab6d60,null))['catch'](handleError(_0xab6d60,null));};exports['addConfiguration']=function(_0x3f225a,_0x158254,_0x35189e){if(_0x3f225a[_0x4778('0x47')]['id']){delete _0x3f225a[_0x4778('0x47')]['id'];}return db['ZohoAccount'][_0x4778('0x49')]({'where':{'id':_0x3f225a[_0x4778('0x44')]['id']}})[_0x4778('0x24')](handleEntityNotFound(_0x158254,null))[_0x4778('0x24')](function(_0x1d14fd){if(_0x1d14fd){_0x3f225a[_0x4778('0x47')][_0x4778('0x4c')]=_0x1d14fd['id'];_0x3f225a[_0x4778('0x47')]['Subjects']=integrations[_0x4778('0x4d')](_0x3f225a[_0x4778('0x47')][_0x4778('0x4e')],_0x3f225a[_0x4778('0x47')][_0x4778('0x2c')]);_0x3f225a[_0x4778('0x47')][_0x4778('0x4f')]=integrations[_0x4778('0x50')](_0x3f225a[_0x4778('0x47')][_0x4778('0x4e')],_0x3f225a[_0x4778('0x47')]['type']);return db['ZohoConfiguration']['create'](_0x3f225a[_0x4778('0x47')],{'include':[{'model':db[_0x4778('0x51')],'as':'Subjects'},{'model':db[_0x4778('0x51')],'as':_0x4778('0x4f')}]});}return null;})[_0x4778('0x24')](respondWithResult(_0x158254,null))[_0x4778('0x42')](handleError(_0x158254,null));};function getAccessToken(_0x413129){return new Promise(function(_0x57e1d2,_0x1023f9){var _0x8add57;switch(_0x413129['zone']){case'US':_0x8add57=_0x4778('0x52');break;case'AU':_0x8add57=_0x4778('0x53');break;case'EU':_0x8add57='https://accounts.zoho.eu';break;case'IN':_0x8add57=_0x4778('0x54');break;case'CN':_0x8add57=_0x4778('0x55');break;default:_0x8add57=_0x4778('0x56');break;}var _0x2fe304={'method':_0x4778('0x57'),'uri':_0x8add57+'/oauth/v2/token','qs':{'refresh_token':_0x413129[_0x4778('0x58')],'client_id':_0x413129[_0x4778('0x59')],'client_secret':_0x413129['clientSecret'],'grant_type':_0x4778('0x5a')},'json':!![]};return rp(_0x2fe304)['then'](function(_0xc47420){if(_0xc47420[_0x4778('0x5b')]){_0x57e1d2(_0xc47420['access_token']);}else{_0x1023f9(_0x4778('0x5c'));}})[_0x4778('0x42')](function(_0x5c189c){_0x1023f9(_0x5c189c);});});}exports['getFields']=function(_0x800d6a,_0xa896ae,_0x512fe0){var _0x80ece8,_0x514b37,_0x3cf1f2,_0x2140e2,_0x1390e1;return db[_0x4778('0x29')][_0x4778('0x49')]({'where':{'id':_0x800d6a[_0x4778('0x44')]['id']},'attributes':['id',_0x4778('0x5d'),_0x4778('0x5e'),'clientId',_0x4778('0x5f'),_0x4778('0x60'),_0x4778('0x61'),'refreshToken']})[_0x4778('0x24')](handleEntityNotFound(_0xa896ae,null))['then'](function(_0x126636){_0x1390e1=_0x126636;_0x80ece8=_0x1390e1[_0x4778('0x5d')];_0x514b37=_0x80ece8===_0x4778('0x62')?'eu':_0x4778('0x63');_0x3cf1f2=_0x1390e1[_0x4778('0x60')];var _0x39e2a3=_0x3cf1f2[_0x4778('0x64')](-0x1);if(_0x39e2a3==='/'||_0x39e2a3==='\x5c'||_0x39e2a3===':'){_0x3cf1f2=_0x3cf1f2['substring'](0x0,_0x3cf1f2['lastIndexOf'](_0x39e2a3));}if(!_0x1390e1[_0x4778('0x58')]){throw new Error(_0x4778('0x65'));}return getAccessToken(_0x1390e1);})[_0x4778('0x24')](function(_0x5621d7){if(_0x5621d7){return rp({'method':_0x4778('0x66'),'uri':util[_0x4778('0x67')](_0x4778('0x68'),_0x514b37),'qs':{'module':_0x4778('0x69')},'headers':{'Authorization':_0x4778('0x6a')+_0x5621d7},'json':!![]});}})['then'](function(_0x2391eb){if(_0x2391eb){if(_0x2391eb[_0x4778('0x6b')]&&_0x2391eb[_0x4778('0x6b')][_0x4778('0x25')]){throw new Error(_0x2391eb[_0x4778('0x6b')][_0x4778('0x25')][_0x4778('0x6c')]);}var _0x4ef5e2=[];var _0xf62260=[];var _0x3950ee=[_0x4778('0x6d'),_0x4778('0x6e'),_0x4778('0x6f'),_0x4778('0x70'),'Call_Duration','Call_Result',_0x4778('0x71'),'Call_Type'];_0xf62260=_[_0x4778('0x72')](_0x2391eb[_0x4778('0x34')],function(_0x2775c0){return _0x3950ee[_0x4778('0x73')](_0x2775c0['api_name']);});for(var _0x4fd82=0x0;_0x4fd82<_0xf62260[_0x4778('0x35')];_0x4fd82++){if(_0xf62260[_0x4fd82][_0x4778('0x74')]===![]){_0x4ef5e2[_0x4778('0x75')]({'id':_0xf62260[_0x4fd82]['id'],'name':_0xf62260[_0x4fd82][_0x4778('0x76')],'custom':_0xf62260[_0x4fd82][_0x4778('0x77')],'options':_0xf62260[_0x4fd82][_0x4778('0x78')]==='picklist'&&_0xf62260[_0x4fd82][_0x4778('0x79')][_0x4778('0x35')]>-0x1?_[_0x4778('0x28')](_0xf62260[_0x4fd82][_0x4778('0x79')],function(_0xdfd0ee){return{'name':_0xdfd0ee,'value':_0xdfd0ee};}):[]});}}return{'count':_0x4ef5e2[_0x4778('0x35')],'rows':_0x4ef5e2};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xa896ae,null))[_0x4778('0x42')](function(_0x3659a8){var _0x2e7c1c=_0x800d6a[_0x4778('0x30')][_0x4778('0x7a')]?0x1f4:_0x3659a8[_0x4778('0x7b')]||0x1f4;logger[_0x4778('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x4778('0x7c'),_0x2e7c1c,JSON[_0x4778('0x7d')](_0x3659a8));delete _0x3659a8['name'];if(_0x2e7c1c===0x191){_0x2e7c1c=0x190;}_0xa896ae[_0x4778('0x18')](_0x2e7c1c)[_0x4778('0x27')](_0x800d6a[_0x4778('0x30')]['test']?{'message':_0x4778('0x7e'),'statusCode':_0x3659a8[_0x4778('0x7b')]}:_0x3659a8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 499aff9..8b7c426 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 _0x6e9a=['host','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','then','parse','refresh_token','refreshToken','info','format','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','serverUrl','lastIndexOf','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x6e9a,0x1dc));var _0xa6e9=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x6e9a[_0x1f43f4];return _0x5435b7;};'use strict';var _=require(_0xa6e9('0x0'));var util=require('util');var logger=require(_0xa6e9('0x1'))(_0xa6e9('0x2'));var moment=require(_0xa6e9('0x3'));var BPromise=require(_0xa6e9('0x4'));var rp=require(_0xa6e9('0x5'));var fs=require('fs');var path=require(_0xa6e9('0x6'));var rimraf=require(_0xa6e9('0x7'));var config=require(_0xa6e9('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa6e9('0x9'));module['exports']=function(_0x4cf853,_0x1cad2e){return _0x4cf853['define'](_0xa6e9('0xa'),attributes,{'tableName':_0xa6e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9ea0ed,_0x11eba3,_0x17c18b){if(_0x9ea0ed[_0xa6e9('0xc')]('zone')||_0x9ea0ed[_0xa6e9('0xc')]('serverUrl')||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0xd'))||_0x9ea0ed['changed'](_0xa6e9('0xe'))||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0xf'))||_0x9ea0ed[_0xa6e9('0xc')](_0xa6e9('0x10'))){var _0x8a4980,_0x27a556;_0x8a4980=_0x9ea0ed['serverUrl'];var _0x4ceb60=_0x8a4980[_0xa6e9('0x11')](-0x1);if(_0x4ceb60==='/'||_0x4ceb60==='\x5c'||_0x4ceb60===':'){_0x8a4980=_0x8a4980[_0xa6e9('0x12')](0x0,_0x8a4980['lastIndexOf'](_0x4ceb60));}switch(_0x9ea0ed[_0xa6e9('0x13')]){case'US':_0x27a556=_0xa6e9('0x14');break;case'AU':_0x27a556=_0xa6e9('0x15');break;case'IN':_0x27a556=_0xa6e9('0x16');break;case'CN':_0x27a556=_0xa6e9('0x17');break;default:_0x27a556=_0xa6e9('0x18');break;}var _0x332b1c={'method':'POST','uri':_0x27a556+_0xa6e9('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x9ea0ed[_0xa6e9('0xd')],'client_secret':_0x9ea0ed[_0xa6e9('0xe')],'redirect_uri':_0x9ea0ed['serverUrl'],'code':_0x9ea0ed[_0xa6e9('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x332b1c)[_0xa6e9('0x1a')](function(_0x2456f9){var _0x13e9b5=JSON[_0xa6e9('0x1b')](_0x2456f9);if(_0x13e9b5[_0xa6e9('0x1c')]){_0x9ea0ed[_0xa6e9('0x1d')]=_0x13e9b5[_0xa6e9('0x1c')];logger[_0xa6e9('0x1e')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9ea0ed['name'],_0x9ea0ed['id']));}else{logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9ea0ed['name'],_0x9ea0ed['id']),util['inspect'](_0x13e9b5,{'showHidden':![],'depth':null}));}return _0x17c18b(null,_0x11eba3);})[_0xa6e9('0x21')](function(_0x14de34){logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')](_0xa6e9('0x22'),_0x9ea0ed[_0xa6e9('0x23')],_0x9ea0ed['id']),util[_0xa6e9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x17c18b(_0x14de34);});}else{return _0x17c18b(null,_0x11eba3);}},'beforeUpdate':function(_0x5a423f,_0x4f0136,_0x32cf02){if(_0x5a423f['changed']('zone')||_0x5a423f['changed']('serverUrl')||_0x5a423f['changed'](_0xa6e9('0xd'))||_0x5a423f['changed'](_0xa6e9('0xe'))||_0x5a423f[_0xa6e9('0xc')](_0xa6e9('0xf'))||_0x5a423f[_0xa6e9('0xc')](_0xa6e9('0x10'))){var _0x35fd89,_0x219d5f;_0x35fd89=_0x5a423f[_0xa6e9('0x25')];var _0x17542e=_0x35fd89[_0xa6e9('0x11')](-0x1);if(_0x17542e==='/'||_0x17542e==='\x5c'||_0x17542e===':'){_0x35fd89=_0x35fd89[_0xa6e9('0x12')](0x0,_0x35fd89[_0xa6e9('0x26')](_0x17542e));}switch(_0x5a423f[_0xa6e9('0x13')]){case'US':_0x219d5f=_0xa6e9('0x14');break;case'AU':_0x219d5f='https://accounts.zoho.com.au';break;case'IN':_0x219d5f=_0xa6e9('0x16');break;case'CN':_0x219d5f=_0xa6e9('0x17');break;default:_0x219d5f=_0xa6e9('0x18');break;}var _0x52d79f={'method':'POST','uri':_0x219d5f+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x5a423f[_0xa6e9('0xd')],'client_secret':_0x5a423f[_0xa6e9('0xe')],'redirect_uri':_0x5a423f[_0xa6e9('0x25')],'code':_0x5a423f[_0xa6e9('0xf')]},'headers':{'Content-Type':_0xa6e9('0x27')}};return rp(_0x52d79f)[_0xa6e9('0x1a')](function(_0x1f8a64){var _0x2245b7=JSON[_0xa6e9('0x1b')](_0x1f8a64);if(_0x2245b7[_0xa6e9('0x1c')]){_0x5a423f[_0xa6e9('0x1d')]=_0x2245b7['refresh_token'];logger[_0xa6e9('0x1e')](util[_0xa6e9('0x1f')](_0xa6e9('0x28'),_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']));}else{logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')](_0xa6e9('0x22'),_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']),util[_0xa6e9('0x24')](_0x2245b7,{'showHidden':![],'depth':null}));}return _0x32cf02(null,_0x4f0136);})[_0xa6e9('0x21')](function(_0x5e8386){logger[_0xa6e9('0x20')](util[_0xa6e9('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5a423f[_0xa6e9('0x23')],_0x5a423f['id']),util[_0xa6e9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x32cf02(_0x5e8386);});}else{return _0x32cf02(null,_0x4f0136);}}}});}; \ No newline at end of file +var _0x2b4e=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','host','slice','substring','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','info','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoAccount','changed','zone','clientId','code','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','authorization_code','clientSecret','serverUrl','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2b4e,0x132));var _0xe2b4=function(_0x30123b,_0x2b155d){_0x30123b=_0x30123b-0x0;var _0x24eb6f=_0x2b4e[_0x30123b];return _0x24eb6f;};'use strict';var _=require(_0xe2b4('0x0'));var util=require(_0xe2b4('0x1'));var logger=require('../../config/logger')(_0xe2b4('0x2'));var moment=require(_0xe2b4('0x3'));var BPromise=require(_0xe2b4('0x4'));var rp=require(_0xe2b4('0x5'));var fs=require('fs');var path=require(_0xe2b4('0x6'));var rimraf=require(_0xe2b4('0x7'));var config=require(_0xe2b4('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe2b4('0x9')]=function(_0x47110b,_0x3b9519){return _0x47110b[_0xe2b4('0xa')](_0xe2b4('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x138b40,_0x3f3ba4,_0x1123c2){if(_0x138b40[_0xe2b4('0xc')](_0xe2b4('0xd'))||_0x138b40[_0xe2b4('0xc')]('serverUrl')||_0x138b40[_0xe2b4('0xc')](_0xe2b4('0xe'))||_0x138b40['changed']('clientSecret')||_0x138b40['changed'](_0xe2b4('0xf'))||_0x138b40[_0xe2b4('0xc')]('host')){var _0x477899,_0x2155f9;_0x477899=_0x138b40['serverUrl'];var _0x4ec911=_0x477899['slice'](-0x1);if(_0x4ec911==='/'||_0x4ec911==='\x5c'||_0x4ec911===':'){_0x477899=_0x477899['substring'](0x0,_0x477899[_0xe2b4('0x10')](_0x4ec911));}switch(_0x138b40['zone']){case'US':_0x2155f9=_0xe2b4('0x11');break;case'AU':_0x2155f9=_0xe2b4('0x12');break;case'IN':_0x2155f9='https://accounts.zoho.in';break;case'CN':_0x2155f9=_0xe2b4('0x13');break;default:_0x2155f9='https://accounts.zoho.eu';break;}var _0x2b6798={'method':'POST','uri':_0x2155f9+'/oauth/v2/token','form':{'grant_type':_0xe2b4('0x14'),'client_id':_0x138b40[_0xe2b4('0xe')],'client_secret':_0x138b40[_0xe2b4('0x15')],'redirect_uri':_0x138b40[_0xe2b4('0x16')],'code':_0x138b40['code']},'headers':{'Content-Type':_0xe2b4('0x17')}};return rp(_0x2b6798)[_0xe2b4('0x18')](function(_0x268c28){var _0x4e60b8=JSON[_0xe2b4('0x19')](_0x268c28);if(_0x4e60b8[_0xe2b4('0x1a')]){_0x138b40['refreshToken']=_0x4e60b8[_0xe2b4('0x1a')];logger['info'](util[_0xe2b4('0x1b')](_0xe2b4('0x1c'),_0x138b40['name'],_0x138b40['id']));}else{logger[_0xe2b4('0x1d')](util['format'](_0xe2b4('0x1e'),_0x138b40[_0xe2b4('0x1f')],_0x138b40['id']),util[_0xe2b4('0x20')](_0x4e60b8,{'showHidden':![],'depth':null}));}return _0x1123c2(null,_0x3f3ba4);})[_0xe2b4('0x21')](function(_0x1ed132){logger[_0xe2b4('0x1d')](util[_0xe2b4('0x1b')](_0xe2b4('0x1e'),_0x138b40[_0xe2b4('0x1f')],_0x138b40['id']),util[_0xe2b4('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x1123c2(_0x1ed132);});}else{return _0x1123c2(null,_0x3f3ba4);}},'beforeUpdate':function(_0x326068,_0x2f6fd3,_0x1c9c33){if(_0x326068[_0xe2b4('0xc')](_0xe2b4('0xd'))||_0x326068[_0xe2b4('0xc')](_0xe2b4('0x16'))||_0x326068[_0xe2b4('0xc')](_0xe2b4('0xe'))||_0x326068['changed'](_0xe2b4('0x15'))||_0x326068[_0xe2b4('0xc')](_0xe2b4('0xf'))||_0x326068['changed'](_0xe2b4('0x22'))){var _0x1fca8f,_0x5bcb1f;_0x1fca8f=_0x326068['serverUrl'];var _0x406dce=_0x1fca8f[_0xe2b4('0x23')](-0x1);if(_0x406dce==='/'||_0x406dce==='\x5c'||_0x406dce===':'){_0x1fca8f=_0x1fca8f[_0xe2b4('0x24')](0x0,_0x1fca8f[_0xe2b4('0x10')](_0x406dce));}switch(_0x326068[_0xe2b4('0xd')]){case'US':_0x5bcb1f=_0xe2b4('0x11');break;case'AU':_0x5bcb1f='https://accounts.zoho.com.au';break;case'IN':_0x5bcb1f=_0xe2b4('0x25');break;case'CN':_0x5bcb1f=_0xe2b4('0x13');break;default:_0x5bcb1f=_0xe2b4('0x26');break;}var _0x36b428={'method':_0xe2b4('0x27'),'uri':_0x5bcb1f+_0xe2b4('0x28'),'form':{'grant_type':_0xe2b4('0x14'),'client_id':_0x326068[_0xe2b4('0xe')],'client_secret':_0x326068[_0xe2b4('0x15')],'redirect_uri':_0x326068[_0xe2b4('0x16')],'code':_0x326068[_0xe2b4('0xf')]},'headers':{'Content-Type':_0xe2b4('0x17')}};return rp(_0x36b428)[_0xe2b4('0x18')](function(_0x4dd5eb){var _0x12c7e4=JSON['parse'](_0x4dd5eb);if(_0x12c7e4[_0xe2b4('0x1a')]){_0x326068['refreshToken']=_0x12c7e4[_0xe2b4('0x1a')];logger[_0xe2b4('0x29')](util[_0xe2b4('0x1b')](_0xe2b4('0x1c'),_0x326068[_0xe2b4('0x1f')],_0x326068['id']));}else{logger[_0xe2b4('0x1d')](util[_0xe2b4('0x1b')](_0xe2b4('0x1e'),_0x326068[_0xe2b4('0x1f')],_0x326068['id']),util[_0xe2b4('0x20')](_0x12c7e4,{'showHidden':![],'depth':null}));}return _0x1c9c33(null,_0x2f6fd3);})['catch'](function(_0x169a03){logger[_0xe2b4('0x1d')](util[_0xe2b4('0x1b')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x326068[_0xe2b4('0x1f')],_0x326068['id']),util[_0xe2b4('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x1c9c33(_0x169a03);});}else{return _0x1c9c33(null,_0x2f6fd3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a9d15f2..fc3c982 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 _0xbe2c=['result','catch','ZohoAccount','findAll','options','where','attributes','include','map','model','then','GetZohoAccount','debug','ShowZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x24484e,_0x2c4b25){var _0x6f55c6=function(_0x21139c){while(--_0x21139c){_0x24484e['push'](_0x24484e['shift']());}};_0x6f55c6(++_0x2c4b25);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x47738e,_0x483014){_0x47738e=_0x47738e-0x0;var _0x2eec0d=_0xbe2c[_0x47738e];return _0x2eec0d;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var moment=require('moment');var BPromise=require(_0xcbe2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe2('0x3'));var db=require(_0xcbe2('0x4'))['db'];var utils=require(_0xcbe2('0x5'));var logger=require(_0xcbe2('0x6'))(_0xcbe2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbe2('0x8'));var client=jayson[_0xcbe2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0389,_0x3eb920,_0x1c28ab){return new BPromise(function(_0x294a61,_0x21233e){return client['request'](_0x2c0389,_0x1c28ab)['then'](function(_0xb7fe3c){logger[_0xcbe2('0xa')](_0xcbe2('0xb'),_0x3eb920,_0xcbe2('0xc'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'),JSON[_0xcbe2('0xd')](_0xb7fe3c));if(_0xb7fe3c[_0xcbe2('0xe')]){if(_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0xf')]===0x1f4){logger[_0xcbe2('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xb7fe3c[_0xcbe2('0xe')][_0xcbe2('0x10')]);return _0x21233e(_0xb7fe3c['error'][_0xcbe2('0x10')]);}logger['error'](_0xcbe2('0xb'),_0x3eb920,_0xb7fe3c['error'][_0xcbe2('0x10')]);return _0x294a61(_0xb7fe3c['error']['message']);}else{logger[_0xcbe2('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x3eb920,_0xcbe2('0xc'));_0x294a61(_0xb7fe3c[_0xcbe2('0x11')][_0xcbe2('0x10')]);}})[_0xcbe2('0x12')](function(_0x40dc0f){logger[_0xcbe2('0xe')](_0xcbe2('0xb'),_0x3eb920,_0x40dc0f);_0x21233e(_0x40dc0f);});});}exports['GetZohoAccount']=function(_0xb968ac){var _0x5acacd=this;return new Promise(function(_0x1c09cb,_0xff2918){return db[_0xcbe2('0x13')][_0xcbe2('0x14')]({'raw':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0xb968ac['options']?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x16')]||null:null,'attributes':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac['options'][_0xcbe2('0x17')]||null:null,'limit':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')]['limit']||null:null,'include':_0xb968ac[_0xcbe2('0x15')]?_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0xb968ac[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x2f1e25){return{'model':db[_0x2f1e25[_0xcbe2('0x1a')]],'as':_0x2f1e25['as'],'attributes':_0x2f1e25['attributes'],'include':_0x2f1e25[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x2f1e25['include'],function(_0x40039f){return{'model':db[_0x40039f[_0xcbe2('0x1a')]],'as':_0x40039f['as'],'attributes':_0x40039f[_0xcbe2('0x17')],'include':_0x40039f[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x40039f['include'],function(_0xbc5aab){return{'model':db[_0xbc5aab[_0xcbe2('0x1a')]],'as':_0xbc5aab['as'],'attributes':_0xbc5aab['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbe2('0x1b')](function(_0x5ad2e9){logger[_0xcbe2('0xa')](_0xcbe2('0x1c'),_0xb968ac);logger[_0xcbe2('0x1d')](_0xcbe2('0x1c'),_0xb968ac,JSON['stringify'](_0x5ad2e9));_0x1c09cb(_0x5ad2e9);})[_0xcbe2('0x12')](function(_0x37eb8b){logger['error'](_0xcbe2('0x1c'),_0x37eb8b[_0xcbe2('0x10')],_0xb968ac);_0xff2918(_0x5acacd[_0xcbe2('0xe')](0x1f4,_0x37eb8b[_0xcbe2('0x10')]));});});};exports[_0xcbe2('0x1e')]=function(_0x3cffd1){var _0x3744f3=this;return new Promise(function(_0x8824fc,_0x39ab14){return db[_0xcbe2('0x13')][_0xcbe2('0x1f')]({'raw':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')]['where']||null:null,'attributes':_0x3cffd1['options']?_0x3cffd1[_0xcbe2('0x15')]['attributes']||null:null,'include':_0x3cffd1[_0xcbe2('0x15')]?_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x3cffd1[_0xcbe2('0x15')][_0xcbe2('0x18')],function(_0x183953){return{'model':db[_0x183953['model']],'as':_0x183953['as'],'attributes':_0x183953[_0xcbe2('0x17')],'include':_0x183953['include']?_['map'](_0x183953[_0xcbe2('0x18')],function(_0x4bd628){return{'model':db[_0x4bd628[_0xcbe2('0x1a')]],'as':_0x4bd628['as'],'attributes':_0x4bd628['attributes'],'include':_0x4bd628[_0xcbe2('0x18')]?_[_0xcbe2('0x19')](_0x4bd628['include'],function(_0x97be46){return{'model':db[_0x97be46['model']],'as':_0x97be46['as'],'attributes':_0x97be46[_0xcbe2('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9023){logger[_0xcbe2('0xa')]('ShowZohoAccount',_0x3cffd1);logger['debug'](_0xcbe2('0x1e'),_0x3cffd1,JSON['stringify'](_0x5e9023));_0x8824fc(_0x5e9023);})[_0xcbe2('0x12')](function(_0xc0cc08){logger[_0xcbe2('0xe')]('ShowZohoAccount',_0xc0cc08[_0xcbe2('0x10')],_0x3cffd1);_0x39ab14(_0x3744f3[_0xcbe2('0xe')](0x1f4,_0xc0cc08['message']));});});}; \ No newline at end of file +var _0xb366=['GetZohoAccount','ShowZohoAccount','ZohoAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','findAll','options','where','attributes','limit','include','model','map'];(function(_0x1a8195,_0x3cccb2){var _0x39ee86=function(_0x103e24){while(--_0x103e24){_0x1a8195['push'](_0x1a8195['shift']());}};_0x39ee86(++_0x3cccb2);}(_0xb366,0xa4));var _0x6b36=function(_0x1bd5dd,_0x2a88f5){_0x1bd5dd=_0x1bd5dd-0x0;var _0x404c81=_0xb366[_0x1bd5dd];return _0x404c81;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var moment=require(_0x6b36('0x1'));var BPromise=require(_0x6b36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b36('0x3'));var db=require(_0x6b36('0x4'))['db'];var utils=require(_0x6b36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b36('0x6'));var client=jayson[_0x6b36('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3997c0,_0x4fe38c,_0x4c6f4c){return new BPromise(function(_0x301a30,_0xee898a){return client[_0x6b36('0x8')](_0x3997c0,_0x4c6f4c)[_0x6b36('0x9')](function(_0x49c125){logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');logger[_0x6b36('0xc')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x4fe38c,_0x6b36('0xd'),JSON[_0x6b36('0xe')](_0x49c125));if(_0x49c125[_0x6b36('0xf')]){if(_0x49c125[_0x6b36('0xf')][_0x6b36('0x10')]===0x1f4){logger[_0x6b36('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4fe38c,_0x49c125[_0x6b36('0xf')][_0x6b36('0x11')]);return _0xee898a(_0x49c125['error'][_0x6b36('0x11')]);}logger['error'](_0x6b36('0xb'),_0x4fe38c,_0x49c125['error']['message']);return _0x301a30(_0x49c125['error'][_0x6b36('0x11')]);}else{logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');_0x301a30(_0x49c125[_0x6b36('0x12')]['message']);}})[_0x6b36('0x13')](function(_0xf7b45a){logger[_0x6b36('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x4fe38c,_0xf7b45a);_0xee898a(_0xf7b45a);});});}exports['GetZohoAccount']=function(_0x17c969){var _0x51e103=this;return new Promise(function(_0x41334a,_0x2864bb){return db['ZohoAccount'][_0x6b36('0x14')]({'raw':_0x17c969['options']?_0x17c969[_0x6b36('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x17c969[_0x6b36('0x15')]?_0x17c969[_0x6b36('0x15')][_0x6b36('0x16')]||null:null,'attributes':_0x17c969[_0x6b36('0x15')]?_0x17c969[_0x6b36('0x15')][_0x6b36('0x17')]||null:null,'limit':_0x17c969[_0x6b36('0x15')]?_0x17c969[_0x6b36('0x15')][_0x6b36('0x18')]||null:null,'include':_0x17c969[_0x6b36('0x15')]?_0x17c969[_0x6b36('0x15')][_0x6b36('0x19')]?_['map'](_0x17c969[_0x6b36('0x15')][_0x6b36('0x19')],function(_0x514c0d){return{'model':db[_0x514c0d[_0x6b36('0x1a')]],'as':_0x514c0d['as'],'attributes':_0x514c0d['attributes'],'include':_0x514c0d[_0x6b36('0x19')]?_['map'](_0x514c0d['include'],function(_0x5b00d1){return{'model':db[_0x5b00d1[_0x6b36('0x1a')]],'as':_0x5b00d1['as'],'attributes':_0x5b00d1[_0x6b36('0x17')],'include':_0x5b00d1[_0x6b36('0x19')]?_[_0x6b36('0x1b')](_0x5b00d1[_0x6b36('0x19')],function(_0x33d343){return{'model':db[_0x33d343[_0x6b36('0x1a')]],'as':_0x33d343['as'],'attributes':_0x33d343[_0x6b36('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa79dc){logger[_0x6b36('0xa')]('GetZohoAccount',_0x17c969);logger[_0x6b36('0xc')](_0x6b36('0x1c'),_0x17c969,JSON['stringify'](_0xaa79dc));_0x41334a(_0xaa79dc);})[_0x6b36('0x13')](function(_0x111655){logger[_0x6b36('0xf')](_0x6b36('0x1c'),_0x111655[_0x6b36('0x11')],_0x17c969);_0x2864bb(_0x51e103[_0x6b36('0xf')](0x1f4,_0x111655[_0x6b36('0x11')]));});});};exports[_0x6b36('0x1d')]=function(_0x2ec52a){var _0x4470f4=this;return new Promise(function(_0x4bac74,_0x2ef2ae){return db[_0x6b36('0x1e')][_0x6b36('0x1f')]({'raw':_0x2ec52a[_0x6b36('0x15')]?_0x2ec52a['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ec52a[_0x6b36('0x15')]?_0x2ec52a['options'][_0x6b36('0x16')]||null:null,'attributes':_0x2ec52a[_0x6b36('0x15')]?_0x2ec52a[_0x6b36('0x15')][_0x6b36('0x17')]||null:null,'include':_0x2ec52a[_0x6b36('0x15')]?_0x2ec52a[_0x6b36('0x15')][_0x6b36('0x19')]?_[_0x6b36('0x1b')](_0x2ec52a[_0x6b36('0x15')][_0x6b36('0x19')],function(_0xe4c6b5){return{'model':db[_0xe4c6b5['model']],'as':_0xe4c6b5['as'],'attributes':_0xe4c6b5['attributes'],'include':_0xe4c6b5[_0x6b36('0x19')]?_[_0x6b36('0x1b')](_0xe4c6b5[_0x6b36('0x19')],function(_0x1f87cf){return{'model':db[_0x1f87cf[_0x6b36('0x1a')]],'as':_0x1f87cf['as'],'attributes':_0x1f87cf['attributes'],'include':_0x1f87cf['include']?_[_0x6b36('0x1b')](_0x1f87cf[_0x6b36('0x19')],function(_0x198ce0){return{'model':db[_0x198ce0['model']],'as':_0x198ce0['as'],'attributes':_0x198ce0[_0x6b36('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6b36('0x9')](function(_0x5258e0){logger[_0x6b36('0xa')](_0x6b36('0x1d'),_0x2ec52a);logger['debug'](_0x6b36('0x1d'),_0x2ec52a,JSON[_0x6b36('0xe')](_0x5258e0));_0x4bac74(_0x5258e0);})[_0x6b36('0x13')](function(_0x203d63){logger['error'](_0x6b36('0x1d'),_0x203d63[_0x6b36('0x11')],_0x2ec52a);_0x2ef2ae(_0x4470f4[_0x6b36('0xf')](0x1f4,_0x203d63[_0x6b36('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 872fb82..56f6b64 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 _0xc577=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getFields'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0xc577,0x8c));var _0x7c57=function(_0x5afa42,_0x30a006){_0x5afa42=_0x5afa42-0x0;var _0x10e567=_0xc577[_0x5afa42];return _0x10e567;};'use strict';var multer=require(_0x7c57('0x0'));var util=require(_0x7c57('0x1'));var path=require(_0x7c57('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c57('0x3'));var router=express[_0x7c57('0x4')]();var fs_extra=require(_0x7c57('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c57('0x6'));var config=require(_0x7c57('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x7c57('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c57('0x9')]);router['get'](_0x7c57('0xa'),auth[_0x7c57('0xb')](),controller[_0x7c57('0xc')]);router[_0x7c57('0x8')]('/:id/fields',auth[_0x7c57('0xb')](),controller[_0x7c57('0xd')]);router[_0x7c57('0x8')](_0x7c57('0xe'),auth[_0x7c57('0xb')](),controller[_0x7c57('0xf')]);router[_0x7c57('0x8')](_0x7c57('0x10'),auth[_0x7c57('0xb')](),controller[_0x7c57('0x11')]);router['post']('/',auth[_0x7c57('0xb')](),controller['create']);router[_0x7c57('0x12')](_0x7c57('0xa'),auth['isAuthenticated'](),controller[_0x7c57('0x13')]);router[_0x7c57('0x14')](_0x7c57('0xa'),auth[_0x7c57('0xb')](),controller['destroy']);module[_0x7c57('0x15')]=router; \ No newline at end of file +var _0x265f=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x2f3782,_0x150f14){var _0x40a8c4=function(_0x1cdc87){while(--_0x1cdc87){_0x2f3782['push'](_0x2f3782['shift']());}};_0x40a8c4(++_0x150f14);}(_0x265f,0x18a));var _0xf265=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0x265f[_0x4e28c0];return _0x4039d4;};'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('express');var router=express[_0xf265('0x4')]();var fs_extra=require(_0xf265('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf265('0x6'));var config=require(_0xf265('0x7'));var controller=require(_0xf265('0x8'));router[_0xf265('0x9')]('/',auth[_0xf265('0xa')](),controller[_0xf265('0xb')]);router[_0xf265('0x9')](_0xf265('0xc'),auth[_0xf265('0xa')](),controller[_0xf265('0xd')]);router['get'](_0xf265('0xe'),auth[_0xf265('0xa')](),controller[_0xf265('0xf')]);router[_0xf265('0x9')](_0xf265('0x10'),auth[_0xf265('0xa')](),controller[_0xf265('0x11')]);router[_0xf265('0x9')](_0xf265('0x12'),auth[_0xf265('0xa')](),controller[_0xf265('0x13')]);router[_0xf265('0x14')]('/',auth[_0xf265('0xa')](),controller[_0xf265('0x15')]);router[_0xf265('0x16')](_0xf265('0xc'),auth[_0xf265('0xa')](),controller[_0xf265('0x17')]);router['delete'](_0xf265('0xc'),auth[_0xf265('0xa')](),controller[_0xf265('0x18')]);module[_0xf265('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index bf5fec0..c08633b 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 _0x9581=['nothing','contact_lead','exports','ENUM','lead','contact'];(function(_0x9efdf2,_0xeee8c2){var _0x2fa260=function(_0x58d9c0){while(--_0x58d9c0){_0x9efdf2['push'](_0x9efdf2['shift']());}};_0x2fa260(++_0xeee8c2);}(_0x9581,0x110));var _0x1958=function(_0x368f72,_0x32d0d7){_0x368f72=_0x368f72-0x0;var _0x16b632=_0x9581[_0x368f72];return _0x16b632;};'use strict';var Sequelize=require('sequelize');module[_0x1958('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x1958('0x1')](_0x1958('0x2'),_0x1958('0x3'),_0x1958('0x4')),'defaultValue':_0x1958('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x1958('0x5'),_0x1958('0x3'),_0x1958('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc878=['contact','STRING','ENUM','lead','nothing','contact_lead'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xc878,0x10f));var _0x8c87=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0xc878[_0x29ae80];return _0x5d6d71;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8c87('0x0')]},'moduleCreate':{'type':Sequelize[_0x8c87('0x1')](_0x8c87('0x2'),'contact',_0x8c87('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x8c87('0x1')](_0x8c87('0x4'),_0x8c87('0x5'),_0x8c87('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x8c87('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 48cdcff..b6ccdec 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 _0x5435=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZohoConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','pick','getFields','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3b9cd4,_0x516261){var _0x494a1e=function(_0x37d3c1){while(--_0x37d3c1){_0x3b9cd4['push'](_0x3b9cd4['shift']());}};_0x494a1e(++_0x516261);}(_0x5435,0x17f));var _0x5543=function(_0x416b88,_0x1b8e64){_0x416b88=_0x416b88-0x0;var _0x4e80a9=_0x5435[_0x416b88];return _0x4e80a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5543('0x0'));var zipdir=require(_0x5543('0x1'));var jsonpatch=require(_0x5543('0x2'));var rp=require('request-promise');var moment=require(_0x5543('0x3'));var BPromise=require(_0x5543('0x4'));var Mustache=require('mustache');var util=require(_0x5543('0x5'));var path=require(_0x5543('0x6'));var sox=require(_0x5543('0x7'));var csv=require(_0x5543('0x8'));var ejs=require(_0x5543('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5543('0xa'));var squel=require(_0x5543('0xb'));var crypto=require(_0x5543('0xc'));var jsforce=require(_0x5543('0xd'));var deskjs=require(_0x5543('0xe'));var toCsv=require(_0x5543('0x8'));var querystring=require(_0x5543('0xf'));var Papa=require(_0x5543('0x10'));var Redis=require(_0x5543('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5543('0x12'));var as=require(_0x5543('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5543('0x14'))(_0x5543('0x15'));var utils=require(_0x5543('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5543('0x17'));var db=require(_0x5543('0x18'))['db'];function respondWithStatusCode(_0x4d0de1,_0x7cf8b1){_0x7cf8b1=_0x7cf8b1||0xcc;return function(_0x55d1d1){if(_0x55d1d1){return _0x4d0de1['sendStatus'](_0x7cf8b1);}return _0x4d0de1[_0x5543('0x19')](_0x7cf8b1)['end']();};}function respondWithResult(_0x11232d,_0x344429){_0x344429=_0x344429||0xc8;return function(_0x94cec6){if(_0x94cec6){return _0x11232d[_0x5543('0x19')](_0x344429)['json'](_0x94cec6);}};}function respondWithFilteredResult(_0x406466,_0x27ec7d){return function(_0x3d69ad){if(_0x3d69ad){var _0x2d9312=typeof _0x27ec7d[_0x5543('0x1a')]==='undefined'&&typeof _0x27ec7d['limit']==='undefined';var _0x23e49d=_0x3d69ad[_0x5543('0x1b')];var _0x367d05=_0x2d9312?0x0:_0x27ec7d[_0x5543('0x1a')];var _0x32d98f=_0x2d9312?_0x3d69ad[_0x5543('0x1b')]:_0x27ec7d['offset']+_0x27ec7d[_0x5543('0x1c')];var _0x883709;if(_0x32d98f>=_0x23e49d){_0x32d98f=_0x23e49d;_0x883709=0xc8;}else{_0x883709=0xce;}_0x406466[_0x5543('0x19')](_0x883709);return _0x406466[_0x5543('0x1d')](_0x5543('0x1e'),_0x367d05+'-'+_0x32d98f+'/'+_0x23e49d)['json'](_0x3d69ad);}return null;};}function patchUpdates(_0x3bcb8f){return function(_0x1a06ea){try{jsonpatch[_0x5543('0x1f')](_0x1a06ea,_0x3bcb8f,!![]);}catch(_0x413224){return BPromise['reject'](_0x413224);}return _0x1a06ea[_0x5543('0x20')]();};}function saveUpdates(_0x2ebd0c,_0x35aaaa){return function(_0x1b51b8){if(_0x1b51b8){return _0x1b51b8[_0x5543('0x21')](_0x2ebd0c)[_0x5543('0x22')](function(_0x2671cf){return _0x2671cf;});}return null;};}function removeEntity(_0x5c2cd4,_0x237b5a){return function(_0x29f63d){if(_0x29f63d){return _0x29f63d[_0x5543('0x23')]()[_0x5543('0x22')](function(){_0x5c2cd4[_0x5543('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3cb1,_0x52c08e){return function(_0x352e13){if(!_0x352e13){_0x3f3cb1['sendStatus'](0x194);}return _0x352e13;};}function handleError(_0x5f5acc,_0x1e428d){_0x1e428d=_0x1e428d||0x1f4;return function(_0x364a1d){logger[_0x5543('0x24')](_0x364a1d[_0x5543('0x25')]);if(_0x364a1d[_0x5543('0x26')]){delete _0x364a1d[_0x5543('0x26')];}_0x5f5acc[_0x5543('0x19')](_0x1e428d)[_0x5543('0x27')](_0x364a1d);};}exports[_0x5543('0x28')]=function(_0xf0eca8,_0x44f333){var _0x1e6c05={},_0x12ec85={},_0x4106f6={'count':0x0,'rows':[]};var _0x261904=_[_0x5543('0x29')](db['ZohoConfiguration']['rawAttributes'],function(_0x1ba947){return{'name':_0x1ba947[_0x5543('0x2a')],'type':_0x1ba947[_0x5543('0x2b')][_0x5543('0x2c')]};});_0x12ec85[_0x5543('0x2d')]=_[_0x5543('0x29')](_0x261904,'name');_0x12ec85[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0xf0eca8[_0x5543('0x2e')]);_0x12ec85[_0x5543('0x30')]=_[_0x5543('0x31')](_0x12ec85[_0x5543('0x2d')],_0x12ec85['query']);_0x1e6c05[_0x5543('0x32')]=_['intersection'](_0x12ec85[_0x5543('0x2d')],qs['fields'](_0xf0eca8[_0x5543('0x2e')][_0x5543('0x33')]));_0x1e6c05[_0x5543('0x32')]=_0x1e6c05['attributes'][_0x5543('0x34')]?_0x1e6c05[_0x5543('0x32')]:_0x12ec85['model'];if(!_0xf0eca8[_0x5543('0x2e')][_0x5543('0x35')](_0x5543('0x36'))){_0x1e6c05[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0xf0eca8['query']['limit']);_0x1e6c05[_0x5543('0x1a')]=qs['offset'](_0xf0eca8['query'][_0x5543('0x1a')]);}_0x1e6c05[_0x5543('0x37')]=qs['sort'](_0xf0eca8['query'][_0x5543('0x38')]);_0x1e6c05[_0x5543('0x39')]=qs[_0x5543('0x30')](_['pick'](_0xf0eca8[_0x5543('0x2e')],_0x12ec85['filters']),_0x261904);if(_0xf0eca8[_0x5543('0x2e')][_0x5543('0x3a')]){_0x1e6c05[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x1e6c05[_0x5543('0x39')],{'$or':_['map'](_0x261904,function(_0xca2c71){if(_0xca2c71[_0x5543('0x2b')]!=='VIRTUAL'){var _0x2feb93={};_0x2feb93[_0xca2c71['name']]={'$like':'%'+_0xf0eca8[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x2feb93;}})});}_0x1e6c05=_[_0x5543('0x3b')]({},_0x1e6c05,_0xf0eca8[_0x5543('0x3c')]);var _0x3b9f2d={'where':_0x1e6c05[_0x5543('0x39')]};return db[_0x5543('0x3d')][_0x5543('0x1b')](_0x3b9f2d)['then'](function(_0x8c3cc3){_0x4106f6[_0x5543('0x1b')]=_0x8c3cc3;if(_0xf0eca8[_0x5543('0x2e')]['includeAll']){_0x1e6c05[_0x5543('0x3e')]=[{'all':!![]}];}return db[_0x5543('0x3d')][_0x5543('0x3f')](_0x1e6c05);})[_0x5543('0x22')](function(_0x38b01a){_0x4106f6[_0x5543('0x40')]=_0x38b01a;return _0x4106f6;})[_0x5543('0x22')](respondWithFilteredResult(_0x44f333,_0x1e6c05))[_0x5543('0x41')](handleError(_0x44f333,null));};exports[_0x5543('0x42')]=function(_0x516da8,_0x13e47a){var _0x5d9f91={'raw':![],'where':{'id':_0x516da8[_0x5543('0x43')]['id']}},_0x5b4454={};_0x5b4454[_0x5543('0x2d')]=_['keys'](db[_0x5543('0x3d')][_0x5543('0x44')]);_0x5b4454[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x516da8['query']);_0x5b4454['filters']=_['intersection'](_0x5b4454['model'],_0x5b4454[_0x5543('0x2e')]);_0x5d9f91[_0x5543('0x32')]=_[_0x5543('0x31')](_0x5b4454[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x516da8[_0x5543('0x2e')][_0x5543('0x33')]));_0x5d9f91[_0x5543('0x32')]=_0x5d9f91['attributes'][_0x5543('0x34')]?_0x5d9f91[_0x5543('0x32')]:_0x5b4454['model'];if(_0x516da8[_0x5543('0x2e')][_0x5543('0x45')]){_0x5d9f91[_0x5543('0x3e')]=[{'all':!![]}];}_0x5d9f91=_[_0x5543('0x3b')]({},_0x5d9f91,_0x516da8['options']);return db[_0x5543('0x3d')][_0x5543('0x46')](_0x5d9f91)[_0x5543('0x22')](handleEntityNotFound(_0x13e47a,null))['then'](respondWithResult(_0x13e47a,null))['catch'](handleError(_0x13e47a,null));};exports[_0x5543('0x47')]=function(_0x4d8921,_0x3b41df){return db['ZohoConfiguration'][_0x5543('0x47')](_0x4d8921[_0x5543('0x48')],{})[_0x5543('0x22')](respondWithResult(_0x3b41df,0xc9))[_0x5543('0x41')](handleError(_0x3b41df,null));};exports['update']=function(_0x3c7890,_0x152168){if(_0x3c7890['body']['id']){delete _0x3c7890[_0x5543('0x48')]['id'];}return db[_0x5543('0x3d')]['find']({'where':{'id':_0x3c7890['params']['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x152168,null))[_0x5543('0x22')](saveUpdates(_0x3c7890[_0x5543('0x48')],null))[_0x5543('0x22')](respondWithResult(_0x152168,null))[_0x5543('0x41')](handleError(_0x152168,null));};exports['destroy']=function(_0x123e1a,_0x3cce43){return db[_0x5543('0x3d')]['find']({'where':{'id':_0x123e1a[_0x5543('0x43')]['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x3cce43,null))['then'](removeEntity(_0x3cce43,null))[_0x5543('0x41')](handleError(_0x3cce43,null));};exports['getFields']=function(_0x254be5,_0x2fdb60,_0x50682c){var _0x398df0={};var _0x529078={};var _0x3e22c1;var _0x5f32fc;return db[_0x5543('0x3d')][_0x5543('0x49')]({'where':{'id':_0x254be5[_0x5543('0x43')]['id']}})[_0x5543('0x22')](handleEntityNotFound(_0x2fdb60,null))[_0x5543('0x22')](function(_0x3ef69f){if(_0x3ef69f){_0x3e22c1=_0x3ef69f;_0x529078['model']=_[_0x5543('0x2f')](db['ZohoField'][_0x5543('0x44')]);_0x529078[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x254be5[_0x5543('0x2e')]);_0x529078[_0x5543('0x30')]=_[_0x5543('0x31')](_0x529078['model'],_0x529078[_0x5543('0x2e')]);_0x398df0['attributes']=_[_0x5543('0x31')](_0x529078[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x254be5[_0x5543('0x2e')]['fields']));_0x398df0['attributes']=_0x398df0[_0x5543('0x32')][_0x5543('0x34')]?_0x398df0[_0x5543('0x32')]:_0x529078[_0x5543('0x2d')];_0x398df0[_0x5543('0x37')]=qs[_0x5543('0x38')](_0x254be5[_0x5543('0x2e')][_0x5543('0x38')]);_0x398df0['where']=qs[_0x5543('0x30')](_[_0x5543('0x4a')](_0x254be5['query'],_0x529078[_0x5543('0x30')]));if(_0x254be5[_0x5543('0x2e')][_0x5543('0x3a')]){_0x398df0[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x398df0[_0x5543('0x39')],{'$or':_['map'](_0x398df0[_0x5543('0x32')],function(_0x24c304){var _0x20df33={};_0x20df33[_0x24c304]={'$like':'%'+_0x254be5[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x20df33;})});}_0x398df0=_[_0x5543('0x3b')]({},_0x398df0,_0x254be5['options']);return _0x3e22c1[_0x5543('0x4b')](_0x398df0);}})[_0x5543('0x22')](function(_0x16a2c3){if(_0x16a2c3){_0x5f32fc=_0x16a2c3[_0x5543('0x34')];if(!_0x254be5[_0x5543('0x2e')][_0x5543('0x35')]('nolimit')){_0x398df0[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0x254be5[_0x5543('0x2e')][_0x5543('0x1c')]);_0x398df0[_0x5543('0x1a')]=qs[_0x5543('0x1a')](_0x254be5['query']['offset']);}return _0x3e22c1[_0x5543('0x4b')](_0x398df0);}})[_0x5543('0x22')](function(_0x3dd399){if(_0x3dd399){return _0x3dd399?{'count':_0x5f32fc,'rows':_0x3dd399}:null;}})[_0x5543('0x22')](respondWithResult(_0x2fdb60,null))['catch'](handleError(_0x2fdb60,null));};exports[_0x5543('0x4c')]=function(_0x1234b9,_0x2db13f,_0x4962d7){var _0x3803bf={};var _0x3e9a56={};var _0x1b9ae6;var _0x485b99;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1234b9['params']['id']}})['then'](handleEntityNotFound(_0x2db13f,null))[_0x5543('0x22')](function(_0x7aaabe){if(_0x7aaabe){_0x1b9ae6=_0x7aaabe;_0x3e9a56[_0x5543('0x2d')]=_[_0x5543('0x2f')](db[_0x5543('0x4d')][_0x5543('0x44')]);_0x3e9a56[_0x5543('0x2e')]=_[_0x5543('0x2f')](_0x1234b9['query']);_0x3e9a56[_0x5543('0x30')]=_[_0x5543('0x31')](_0x3e9a56[_0x5543('0x2d')],_0x3e9a56[_0x5543('0x2e')]);_0x3803bf['attributes']=_[_0x5543('0x31')](_0x3e9a56[_0x5543('0x2d')],qs[_0x5543('0x33')](_0x1234b9[_0x5543('0x2e')][_0x5543('0x33')]));_0x3803bf['attributes']=_0x3803bf['attributes']['length']?_0x3803bf['attributes']:_0x3e9a56[_0x5543('0x2d')];_0x3803bf[_0x5543('0x37')]=qs['sort'](_0x1234b9[_0x5543('0x2e')][_0x5543('0x38')]);_0x3803bf[_0x5543('0x39')]=qs['filters'](_['pick'](_0x1234b9[_0x5543('0x2e')],_0x3e9a56[_0x5543('0x30')]));if(_0x1234b9[_0x5543('0x2e')]['filter']){_0x3803bf[_0x5543('0x39')]=_[_0x5543('0x3b')](_0x3803bf[_0x5543('0x39')],{'$or':_[_0x5543('0x29')](_0x3803bf['attributes'],function(_0x1c371a){var _0x1dac59={};_0x1dac59[_0x1c371a]={'$like':'%'+_0x1234b9[_0x5543('0x2e')][_0x5543('0x3a')]+'%'};return _0x1dac59;})});}_0x3803bf=_[_0x5543('0x3b')]({},_0x3803bf,_0x1234b9[_0x5543('0x3c')]);return _0x1b9ae6[_0x5543('0x4c')](_0x3803bf);}})[_0x5543('0x22')](function(_0xb11ce3){if(_0xb11ce3){_0x485b99=_0xb11ce3[_0x5543('0x34')];if(!_0x1234b9[_0x5543('0x2e')][_0x5543('0x35')](_0x5543('0x36'))){_0x3803bf['limit']=qs['limit'](_0x1234b9['query'][_0x5543('0x1c')]);_0x3803bf['offset']=qs['offset'](_0x1234b9['query']['offset']);}return _0x1b9ae6['getSubjects'](_0x3803bf);}})[_0x5543('0x22')](function(_0x392933){if(_0x392933){return _0x392933?{'count':_0x485b99,'rows':_0x392933}:null;}})['then'](respondWithResult(_0x2db13f,null))[_0x5543('0x41')](handleError(_0x2db13f,null));};exports['getDescriptions']=function(_0x4643b6,_0x43aa37,_0x486a67){var _0x512edf={};var _0x2c98b9={};var _0x5198fa;var _0x469f99;return db[_0x5543('0x3d')][_0x5543('0x49')]({'where':{'id':_0x4643b6[_0x5543('0x43')]['id']}})['then'](handleEntityNotFound(_0x43aa37,null))[_0x5543('0x22')](function(_0x28ab0d){if(_0x28ab0d){_0x5198fa=_0x28ab0d;_0x2c98b9[_0x5543('0x2d')]=_[_0x5543('0x2f')](db[_0x5543('0x4d')][_0x5543('0x44')]);_0x2c98b9[_0x5543('0x2e')]=_['keys'](_0x4643b6['query']);_0x2c98b9[_0x5543('0x30')]=_[_0x5543('0x31')](_0x2c98b9[_0x5543('0x2d')],_0x2c98b9[_0x5543('0x2e')]);_0x512edf['attributes']=_['intersection'](_0x2c98b9[_0x5543('0x2d')],qs['fields'](_0x4643b6[_0x5543('0x2e')][_0x5543('0x33')]));_0x512edf['attributes']=_0x512edf[_0x5543('0x32')]['length']?_0x512edf['attributes']:_0x2c98b9[_0x5543('0x2d')];_0x512edf['order']=qs[_0x5543('0x38')](_0x4643b6['query'][_0x5543('0x38')]);_0x512edf[_0x5543('0x39')]=qs['filters'](_[_0x5543('0x4a')](_0x4643b6['query'],_0x2c98b9[_0x5543('0x30')]));if(_0x4643b6['query'][_0x5543('0x3a')]){_0x512edf['where']=_['merge'](_0x512edf[_0x5543('0x39')],{'$or':_[_0x5543('0x29')](_0x512edf[_0x5543('0x32')],function(_0x1cf635){var _0x4b8e20={};_0x4b8e20[_0x1cf635]={'$like':'%'+_0x4643b6['query'][_0x5543('0x3a')]+'%'};return _0x4b8e20;})});}_0x512edf=_[_0x5543('0x3b')]({},_0x512edf,_0x4643b6[_0x5543('0x3c')]);return _0x5198fa[_0x5543('0x4e')](_0x512edf);}})[_0x5543('0x22')](function(_0x4d25dd){if(_0x4d25dd){_0x469f99=_0x4d25dd[_0x5543('0x34')];if(!_0x4643b6['query'][_0x5543('0x35')](_0x5543('0x36'))){_0x512edf[_0x5543('0x1c')]=qs[_0x5543('0x1c')](_0x4643b6['query']['limit']);_0x512edf['offset']=qs['offset'](_0x4643b6[_0x5543('0x2e')][_0x5543('0x1a')]);}return _0x5198fa[_0x5543('0x4e')](_0x512edf);}})[_0x5543('0x22')](function(_0x4923c3){if(_0x4923c3){return _0x4923c3?{'count':_0x469f99,'rows':_0x4923c3}:null;}})[_0x5543('0x22')](respondWithResult(_0x43aa37,null))['catch'](handleError(_0x43aa37,null));}; \ No newline at end of file +var _0x39b6=['getFields','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','stack','name','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','keys','options','create','body','find','params','findOne','pick'];(function(_0x181c12,_0x42241d){var _0x219ffd=function(_0x2808aa){while(--_0x2808aa){_0x181c12['push'](_0x181c12['shift']());}};_0x219ffd(++_0x42241d);}(_0x39b6,0xa8));var _0x639b=function(_0xcbba50,_0x226afb){_0xcbba50=_0xcbba50-0x0;var _0x26db74=_0x39b6[_0xcbba50];return _0x26db74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x639b('0x0'));var zipdir=require(_0x639b('0x1'));var jsonpatch=require(_0x639b('0x2'));var rp=require(_0x639b('0x3'));var moment=require(_0x639b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x639b('0x5'));var util=require(_0x639b('0x6'));var path=require(_0x639b('0x7'));var sox=require(_0x639b('0x8'));var csv=require('to-csv');var ejs=require(_0x639b('0x9'));var fs=require('fs');var fs_extra=require(_0x639b('0xa'));var _=require(_0x639b('0xb'));var squel=require('squel');var crypto=require(_0x639b('0xc'));var jsforce=require(_0x639b('0xd'));var deskjs=require(_0x639b('0xe'));var toCsv=require(_0x639b('0xf'));var querystring=require(_0x639b('0x10'));var Papa=require('papaparse');var Redis=require(_0x639b('0x11'));var authService=require(_0x639b('0x12'));var qs=require(_0x639b('0x13'));var as=require(_0x639b('0x14'));var hardwareService=require(_0x639b('0x15'));var logger=require(_0x639b('0x16'))('api');var utils=require(_0x639b('0x17'));var config=require(_0x639b('0x18'));var licenseUtil=require(_0x639b('0x19'));var db=require(_0x639b('0x1a'))['db'];function respondWithStatusCode(_0x333953,_0x3cd3e3){_0x3cd3e3=_0x3cd3e3||0xcc;return function(_0x192680){if(_0x192680){return _0x333953[_0x639b('0x1b')](_0x3cd3e3);}return _0x333953[_0x639b('0x1c')](_0x3cd3e3)[_0x639b('0x1d')]();};}function respondWithResult(_0x35cc64,_0x2ddd10){_0x2ddd10=_0x2ddd10||0xc8;return function(_0x40a2a1){if(_0x40a2a1){return _0x35cc64[_0x639b('0x1c')](_0x2ddd10)[_0x639b('0x1e')](_0x40a2a1);}};}function respondWithFilteredResult(_0x253c66,_0x3295a8){return function(_0x1f88bb){if(_0x1f88bb){var _0xa14d1=typeof _0x3295a8[_0x639b('0x1f')]==='undefined'&&typeof _0x3295a8[_0x639b('0x20')]===_0x639b('0x21');var _0x72a8fa=_0x1f88bb[_0x639b('0x22')];var _0x446aef=_0xa14d1?0x0:_0x3295a8[_0x639b('0x1f')];var _0x2d40a3=_0xa14d1?_0x1f88bb[_0x639b('0x22')]:_0x3295a8[_0x639b('0x1f')]+_0x3295a8[_0x639b('0x20')];var _0x44093a;if(_0x2d40a3>=_0x72a8fa){_0x2d40a3=_0x72a8fa;_0x44093a=0xc8;}else{_0x44093a=0xce;}_0x253c66['status'](_0x44093a);return _0x253c66[_0x639b('0x23')](_0x639b('0x24'),_0x446aef+'-'+_0x2d40a3+'/'+_0x72a8fa)[_0x639b('0x1e')](_0x1f88bb);}return null;};}function patchUpdates(_0x4096a2){return function(_0x293a82){try{jsonpatch['apply'](_0x293a82,_0x4096a2,!![]);}catch(_0x27ae66){return BPromise[_0x639b('0x25')](_0x27ae66);}return _0x293a82[_0x639b('0x26')]();};}function saveUpdates(_0x4cf5de,_0x570e5d){return function(_0x2c9349){if(_0x2c9349){return _0x2c9349[_0x639b('0x27')](_0x4cf5de)['then'](function(_0x289273){return _0x289273;});}return null;};}function removeEntity(_0x35ee56,_0x4af103){return function(_0x502940){if(_0x502940){return _0x502940[_0x639b('0x28')]()[_0x639b('0x29')](function(){_0x35ee56[_0x639b('0x1c')](0xcc)[_0x639b('0x1d')]();});}};}function handleEntityNotFound(_0x195894,_0x2ef083){return function(_0x15925d){if(!_0x15925d){_0x195894[_0x639b('0x1b')](0x194);}return _0x15925d;};}function handleError(_0x29465c,_0x492e19){_0x492e19=_0x492e19||0x1f4;return function(_0x40a3f7){logger['error'](_0x40a3f7[_0x639b('0x2a')]);if(_0x40a3f7[_0x639b('0x2b')]){delete _0x40a3f7['name'];}_0x29465c['status'](_0x492e19)['send'](_0x40a3f7);};}exports['index']=function(_0x59ea77,_0x3863dd){var _0x22cc6b={},_0x33c6f7={},_0x37750e={'count':0x0,'rows':[]};var _0x3288d9=_['map'](db[_0x639b('0x2c')][_0x639b('0x2d')],function(_0x545726){return{'name':_0x545726[_0x639b('0x2e')],'type':_0x545726['type'][_0x639b('0x2f')]};});_0x33c6f7[_0x639b('0x30')]=_[_0x639b('0x31')](_0x3288d9,_0x639b('0x2b'));_0x33c6f7['query']=_['keys'](_0x59ea77[_0x639b('0x32')]);_0x33c6f7[_0x639b('0x33')]=_[_0x639b('0x34')](_0x33c6f7[_0x639b('0x30')],_0x33c6f7[_0x639b('0x32')]);_0x22cc6b[_0x639b('0x35')]=_[_0x639b('0x34')](_0x33c6f7[_0x639b('0x30')],qs[_0x639b('0x36')](_0x59ea77[_0x639b('0x32')][_0x639b('0x36')]));_0x22cc6b[_0x639b('0x35')]=_0x22cc6b[_0x639b('0x35')][_0x639b('0x37')]?_0x22cc6b['attributes']:_0x33c6f7[_0x639b('0x30')];if(!_0x59ea77[_0x639b('0x32')][_0x639b('0x38')](_0x639b('0x39'))){_0x22cc6b[_0x639b('0x20')]=qs[_0x639b('0x20')](_0x59ea77[_0x639b('0x32')][_0x639b('0x20')]);_0x22cc6b['offset']=qs[_0x639b('0x1f')](_0x59ea77[_0x639b('0x32')][_0x639b('0x1f')]);}_0x22cc6b[_0x639b('0x3a')]=qs[_0x639b('0x3b')](_0x59ea77[_0x639b('0x32')][_0x639b('0x3b')]);_0x22cc6b[_0x639b('0x3c')]=qs[_0x639b('0x33')](_['pick'](_0x59ea77[_0x639b('0x32')],_0x33c6f7[_0x639b('0x33')]),_0x3288d9);if(_0x59ea77[_0x639b('0x32')][_0x639b('0x3d')]){_0x22cc6b[_0x639b('0x3c')]=_[_0x639b('0x3e')](_0x22cc6b[_0x639b('0x3c')],{'$or':_[_0x639b('0x31')](_0x3288d9,function(_0x49457f){if(_0x49457f[_0x639b('0x3f')]!=='VIRTUAL'){var _0x5d151a={};_0x5d151a[_0x49457f[_0x639b('0x2b')]]={'$like':'%'+_0x59ea77[_0x639b('0x32')]['filter']+'%'};return _0x5d151a;}})});}_0x22cc6b=_[_0x639b('0x3e')]({},_0x22cc6b,_0x59ea77['options']);var _0x1d6245={'where':_0x22cc6b[_0x639b('0x3c')]};return db[_0x639b('0x2c')][_0x639b('0x22')](_0x1d6245)[_0x639b('0x29')](function(_0xfa2e0a){_0x37750e[_0x639b('0x22')]=_0xfa2e0a;if(_0x59ea77[_0x639b('0x32')][_0x639b('0x40')]){_0x22cc6b[_0x639b('0x41')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x639b('0x42')](_0x22cc6b);})[_0x639b('0x29')](function(_0x4bb803){_0x37750e[_0x639b('0x43')]=_0x4bb803;return _0x37750e;})[_0x639b('0x29')](respondWithFilteredResult(_0x3863dd,_0x22cc6b))[_0x639b('0x44')](handleError(_0x3863dd,null));};exports[_0x639b('0x45')]=function(_0x1cba6f,_0x4a9cfe){var _0x481562={'raw':![],'where':{'id':_0x1cba6f['params']['id']}},_0xc87108={};_0xc87108[_0x639b('0x30')]=_[_0x639b('0x46')](db['ZohoConfiguration'][_0x639b('0x2d')]);_0xc87108['query']=_[_0x639b('0x46')](_0x1cba6f[_0x639b('0x32')]);_0xc87108[_0x639b('0x33')]=_[_0x639b('0x34')](_0xc87108['model'],_0xc87108[_0x639b('0x32')]);_0x481562[_0x639b('0x35')]=_[_0x639b('0x34')](_0xc87108[_0x639b('0x30')],qs['fields'](_0x1cba6f[_0x639b('0x32')][_0x639b('0x36')]));_0x481562[_0x639b('0x35')]=_0x481562[_0x639b('0x35')][_0x639b('0x37')]?_0x481562[_0x639b('0x35')]:_0xc87108[_0x639b('0x30')];if(_0x1cba6f[_0x639b('0x32')][_0x639b('0x40')]){_0x481562['include']=[{'all':!![]}];}_0x481562=_[_0x639b('0x3e')]({},_0x481562,_0x1cba6f[_0x639b('0x47')]);return db[_0x639b('0x2c')]['find'](_0x481562)[_0x639b('0x29')](handleEntityNotFound(_0x4a9cfe,null))[_0x639b('0x29')](respondWithResult(_0x4a9cfe,null))[_0x639b('0x44')](handleError(_0x4a9cfe,null));};exports['create']=function(_0x386f45,_0x53c12e){return db[_0x639b('0x2c')][_0x639b('0x48')](_0x386f45[_0x639b('0x49')],{})[_0x639b('0x29')](respondWithResult(_0x53c12e,0xc9))['catch'](handleError(_0x53c12e,null));};exports[_0x639b('0x27')]=function(_0x259849,_0x3ba5cc){if(_0x259849[_0x639b('0x49')]['id']){delete _0x259849[_0x639b('0x49')]['id'];}return db[_0x639b('0x2c')][_0x639b('0x4a')]({'where':{'id':_0x259849[_0x639b('0x4b')]['id']}})[_0x639b('0x29')](handleEntityNotFound(_0x3ba5cc,null))[_0x639b('0x29')](saveUpdates(_0x259849['body'],null))['then'](respondWithResult(_0x3ba5cc,null))[_0x639b('0x44')](handleError(_0x3ba5cc,null));};exports[_0x639b('0x28')]=function(_0xb67802,_0x5790d2){return db[_0x639b('0x2c')][_0x639b('0x4a')]({'where':{'id':_0xb67802['params']['id']}})[_0x639b('0x29')](handleEntityNotFound(_0x5790d2,null))[_0x639b('0x29')](removeEntity(_0x5790d2,null))[_0x639b('0x44')](handleError(_0x5790d2,null));};exports['getFields']=function(_0x23a13c,_0x314b1c,_0x5da528){var _0x5b33b3={};var _0xcdda0={};var _0x285c78;var _0x360687;return db['ZohoConfiguration'][_0x639b('0x4c')]({'where':{'id':_0x23a13c[_0x639b('0x4b')]['id']}})[_0x639b('0x29')](handleEntityNotFound(_0x314b1c,null))[_0x639b('0x29')](function(_0xb6b9f5){if(_0xb6b9f5){_0x285c78=_0xb6b9f5;_0xcdda0['model']=_[_0x639b('0x46')](db['ZohoField'][_0x639b('0x2d')]);_0xcdda0[_0x639b('0x32')]=_[_0x639b('0x46')](_0x23a13c[_0x639b('0x32')]);_0xcdda0[_0x639b('0x33')]=_['intersection'](_0xcdda0[_0x639b('0x30')],_0xcdda0['query']);_0x5b33b3[_0x639b('0x35')]=_[_0x639b('0x34')](_0xcdda0[_0x639b('0x30')],qs[_0x639b('0x36')](_0x23a13c[_0x639b('0x32')][_0x639b('0x36')]));_0x5b33b3[_0x639b('0x35')]=_0x5b33b3[_0x639b('0x35')][_0x639b('0x37')]?_0x5b33b3[_0x639b('0x35')]:_0xcdda0[_0x639b('0x30')];_0x5b33b3[_0x639b('0x3a')]=qs[_0x639b('0x3b')](_0x23a13c[_0x639b('0x32')][_0x639b('0x3b')]);_0x5b33b3[_0x639b('0x3c')]=qs[_0x639b('0x33')](_[_0x639b('0x4d')](_0x23a13c[_0x639b('0x32')],_0xcdda0['filters']));if(_0x23a13c[_0x639b('0x32')][_0x639b('0x3d')]){_0x5b33b3[_0x639b('0x3c')]=_[_0x639b('0x3e')](_0x5b33b3[_0x639b('0x3c')],{'$or':_['map'](_0x5b33b3[_0x639b('0x35')],function(_0x5f0d4a){var _0x3995fc={};_0x3995fc[_0x5f0d4a]={'$like':'%'+_0x23a13c[_0x639b('0x32')][_0x639b('0x3d')]+'%'};return _0x3995fc;})});}_0x5b33b3=_[_0x639b('0x3e')]({},_0x5b33b3,_0x23a13c['options']);return _0x285c78[_0x639b('0x4e')](_0x5b33b3);}})[_0x639b('0x29')](function(_0x1fd2ba){if(_0x1fd2ba){_0x360687=_0x1fd2ba['length'];if(!_0x23a13c[_0x639b('0x32')][_0x639b('0x38')]('nolimit')){_0x5b33b3[_0x639b('0x20')]=qs[_0x639b('0x20')](_0x23a13c[_0x639b('0x32')][_0x639b('0x20')]);_0x5b33b3[_0x639b('0x1f')]=qs[_0x639b('0x1f')](_0x23a13c[_0x639b('0x32')][_0x639b('0x1f')]);}return _0x285c78[_0x639b('0x4e')](_0x5b33b3);}})['then'](function(_0x593ead){if(_0x593ead){return _0x593ead?{'count':_0x360687,'rows':_0x593ead}:null;}})['then'](respondWithResult(_0x314b1c,null))[_0x639b('0x44')](handleError(_0x314b1c,null));};exports['getSubjects']=function(_0x314e16,_0x5d8c8f,_0xffd888){var _0x37b695={};var _0x1e5d11={};var _0x4b13f0;var _0xacde09;return db[_0x639b('0x2c')][_0x639b('0x4c')]({'where':{'id':_0x314e16['params']['id']}})[_0x639b('0x29')](handleEntityNotFound(_0x5d8c8f,null))[_0x639b('0x29')](function(_0x24be3d){if(_0x24be3d){_0x4b13f0=_0x24be3d;_0x1e5d11[_0x639b('0x30')]=_[_0x639b('0x46')](db[_0x639b('0x4f')][_0x639b('0x2d')]);_0x1e5d11[_0x639b('0x32')]=_['keys'](_0x314e16[_0x639b('0x32')]);_0x1e5d11['filters']=_[_0x639b('0x34')](_0x1e5d11[_0x639b('0x30')],_0x1e5d11[_0x639b('0x32')]);_0x37b695[_0x639b('0x35')]=_['intersection'](_0x1e5d11[_0x639b('0x30')],qs[_0x639b('0x36')](_0x314e16['query']['fields']));_0x37b695[_0x639b('0x35')]=_0x37b695['attributes'][_0x639b('0x37')]?_0x37b695[_0x639b('0x35')]:_0x1e5d11['model'];_0x37b695['order']=qs[_0x639b('0x3b')](_0x314e16[_0x639b('0x32')][_0x639b('0x3b')]);_0x37b695[_0x639b('0x3c')]=qs[_0x639b('0x33')](_['pick'](_0x314e16[_0x639b('0x32')],_0x1e5d11[_0x639b('0x33')]));if(_0x314e16[_0x639b('0x32')][_0x639b('0x3d')]){_0x37b695['where']=_[_0x639b('0x3e')](_0x37b695['where'],{'$or':_[_0x639b('0x31')](_0x37b695[_0x639b('0x35')],function(_0x201067){var _0x44f20b={};_0x44f20b[_0x201067]={'$like':'%'+_0x314e16['query'][_0x639b('0x3d')]+'%'};return _0x44f20b;})});}_0x37b695=_['merge']({},_0x37b695,_0x314e16[_0x639b('0x47')]);return _0x4b13f0[_0x639b('0x50')](_0x37b695);}})[_0x639b('0x29')](function(_0x2361fd){if(_0x2361fd){_0xacde09=_0x2361fd[_0x639b('0x37')];if(!_0x314e16[_0x639b('0x32')]['hasOwnProperty'](_0x639b('0x39'))){_0x37b695['limit']=qs[_0x639b('0x20')](_0x314e16[_0x639b('0x32')][_0x639b('0x20')]);_0x37b695[_0x639b('0x1f')]=qs['offset'](_0x314e16[_0x639b('0x32')]['offset']);}return _0x4b13f0[_0x639b('0x50')](_0x37b695);}})['then'](function(_0x4611f2){if(_0x4611f2){return _0x4611f2?{'count':_0xacde09,'rows':_0x4611f2}:null;}})[_0x639b('0x29')](respondWithResult(_0x5d8c8f,null))[_0x639b('0x44')](handleError(_0x5d8c8f,null));};exports['getDescriptions']=function(_0x1ad8cc,_0x35750a,_0x2309f3){var _0xcfabd6={};var _0x162798={};var _0x1fe495;var _0x4fafd9;return db[_0x639b('0x2c')]['findOne']({'where':{'id':_0x1ad8cc[_0x639b('0x4b')]['id']}})[_0x639b('0x29')](handleEntityNotFound(_0x35750a,null))[_0x639b('0x29')](function(_0x5ecea3){if(_0x5ecea3){_0x1fe495=_0x5ecea3;_0x162798[_0x639b('0x30')]=_['keys'](db[_0x639b('0x4f')][_0x639b('0x2d')]);_0x162798[_0x639b('0x32')]=_[_0x639b('0x46')](_0x1ad8cc[_0x639b('0x32')]);_0x162798[_0x639b('0x33')]=_['intersection'](_0x162798['model'],_0x162798['query']);_0xcfabd6[_0x639b('0x35')]=_[_0x639b('0x34')](_0x162798[_0x639b('0x30')],qs[_0x639b('0x36')](_0x1ad8cc['query']['fields']));_0xcfabd6[_0x639b('0x35')]=_0xcfabd6[_0x639b('0x35')][_0x639b('0x37')]?_0xcfabd6[_0x639b('0x35')]:_0x162798[_0x639b('0x30')];_0xcfabd6['order']=qs['sort'](_0x1ad8cc[_0x639b('0x32')]['sort']);_0xcfabd6[_0x639b('0x3c')]=qs[_0x639b('0x33')](_[_0x639b('0x4d')](_0x1ad8cc[_0x639b('0x32')],_0x162798[_0x639b('0x33')]));if(_0x1ad8cc['query'][_0x639b('0x3d')]){_0xcfabd6[_0x639b('0x3c')]=_[_0x639b('0x3e')](_0xcfabd6[_0x639b('0x3c')],{'$or':_['map'](_0xcfabd6[_0x639b('0x35')],function(_0x136323){var _0x9315a8={};_0x9315a8[_0x136323]={'$like':'%'+_0x1ad8cc[_0x639b('0x32')][_0x639b('0x3d')]+'%'};return _0x9315a8;})});}_0xcfabd6=_[_0x639b('0x3e')]({},_0xcfabd6,_0x1ad8cc[_0x639b('0x47')]);return _0x1fe495[_0x639b('0x51')](_0xcfabd6);}})[_0x639b('0x29')](function(_0x2859fe){if(_0x2859fe){_0x4fafd9=_0x2859fe[_0x639b('0x37')];if(!_0x1ad8cc[_0x639b('0x32')][_0x639b('0x38')](_0x639b('0x39'))){_0xcfabd6['limit']=qs[_0x639b('0x20')](_0x1ad8cc[_0x639b('0x32')][_0x639b('0x20')]);_0xcfabd6['offset']=qs['offset'](_0x1ad8cc[_0x639b('0x32')][_0x639b('0x1f')]);}return _0x1fe495['getDescriptions'](_0xcfabd6);}})[_0x639b('0x29')](function(_0x93df21){if(_0x93df21){return _0x93df21?{'count':_0x4fafd9,'rows':_0x93df21}:null;}})[_0x639b('0x29')](respondWithResult(_0x35750a,null))[_0x639b('0x44')](handleError(_0x35750a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e77d983..4b7683a 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 _0xd11c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x1989cd,_0x49a8b6){var _0x5355bc=function(_0x194a5b){while(--_0x194a5b){_0x1989cd['push'](_0x1989cd['shift']());}};_0x5355bc(++_0x49a8b6);}(_0xd11c,0xbb));var _0xcd11=function(_0x594cb3,_0xe8116a){_0x594cb3=_0x594cb3-0x0;var _0x23f7a1=_0xd11c[_0x594cb3];return _0x23f7a1;};'use strict';var _=require(_0xcd11('0x0'));var util=require(_0xcd11('0x1'));var logger=require(_0xcd11('0x2'))(_0xcd11('0x3'));var moment=require(_0xcd11('0x4'));var BPromise=require(_0xcd11('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd11('0x6'));var rimraf=require(_0xcd11('0x7'));var config=require(_0xcd11('0x8'));var attributes=require(_0xcd11('0x9'));module[_0xcd11('0xa')]=function(_0x30adf6,_0x59dfdf){return _0x30adf6['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9004=['request-promise','path','rimraf','exports','define','int_zoho_configurations','util','api','moment','bluebird'];(function(_0x149942,_0x4be810){var _0x9e3739=function(_0x447f84){while(--_0x447f84){_0x149942['push'](_0x149942['shift']());}};_0x9e3739(++_0x4be810);}(_0x9004,0x146));var _0x4900=function(_0x2e0d9c,_0x26fdf0){_0x2e0d9c=_0x2e0d9c-0x0;var _0x5b4788=_0x9004[_0x2e0d9c];return _0x5b4788;};'use strict';var _=require('lodash');var util=require(_0x4900('0x0'));var logger=require('../../config/logger')(_0x4900('0x1'));var moment=require(_0x4900('0x2'));var BPromise=require(_0x4900('0x3'));var rp=require(_0x4900('0x4'));var fs=require('fs');var path=require(_0x4900('0x5'));var rimraf=require(_0x4900('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x4900('0x7')]=function(_0x504082,_0x424dc2){return _0x504082[_0x4900('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x4900('0x9'),'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 0c17eb1..683e851 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 _0x5dfd=['http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x5dfd,0x1c1));var _0xd5df=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5dfd[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xd5df('0x0'));var util=require(_0xd5df('0x1'));var moment=require('moment');var BPromise=require(_0xd5df('0x2'));var rs=require(_0xd5df('0x3'));var fs=require('fs');var Redis=require(_0xd5df('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5df('0x5'));var logger=require(_0xd5df('0x6'))(_0xd5df('0x7'));var config=require(_0xd5df('0x8'));var jayson=require(_0xd5df('0x9'));var client=jayson[_0xd5df('0xa')][_0xd5df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3265,_0xb3f96,_0x14b063){return new BPromise(function(_0x4e79a7,_0x269f45){return client['request'](_0x2e3265,_0x14b063)[_0xd5df('0xc')](function(_0x2f32e8){logger[_0xd5df('0xd')](_0xd5df('0xe'),_0xb3f96,_0xd5df('0xf'));logger['debug'](_0xd5df('0x10'),_0xb3f96,_0xd5df('0xf'),JSON[_0xd5df('0x11')](_0x2f32e8));if(_0x2f32e8[_0xd5df('0x12')]){if(_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x13')]===0x1f4){logger[_0xd5df('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0xb3f96,_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x14')]);return _0x269f45(_0x2f32e8['error']['message']);}logger[_0xd5df('0x12')](_0xd5df('0xe'),_0xb3f96,_0x2f32e8['error'][_0xd5df('0x14')]);return _0x4e79a7(_0x2f32e8[_0xd5df('0x12')][_0xd5df('0x14')]);}else{logger['info'](_0xd5df('0xe'),_0xb3f96,'request\x20sent');_0x4e79a7(_0x2f32e8[_0xd5df('0x15')][_0xd5df('0x14')]);}})[_0xd5df('0x16')](function(_0x403482){logger[_0xd5df('0x12')](_0xd5df('0xe'),_0xb3f96,_0x403482);_0x269f45(_0x403482);});});} \ No newline at end of file +var _0x3229=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x189bc2,_0x3a4812){var _0x49ab5c=function(_0x1d0fc2){while(--_0x1d0fc2){_0x189bc2['push'](_0x189bc2['shift']());}};_0x49ab5c(++_0x3a4812);}(_0x3229,0x110));var _0x9322=function(_0x25dec1,_0x58c00b){_0x25dec1=_0x25dec1-0x0;var _0x301121=_0x3229[_0x25dec1];return _0x301121;};'use strict';var _=require(_0x9322('0x0'));var util=require(_0x9322('0x1'));var moment=require(_0x9322('0x2'));var BPromise=require('bluebird');var rs=require(_0x9322('0x3'));var fs=require('fs');var Redis=require(_0x9322('0x4'));var db=require(_0x9322('0x5'))['db'];var utils=require(_0x9322('0x6'));var logger=require(_0x9322('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9322('0x8'));var client=jayson[_0x9322('0x9')][_0x9322('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5425e0,_0x149ee1,_0x33d64f){return new BPromise(function(_0x96d4cd,_0x181178){return client['request'](_0x5425e0,_0x33d64f)[_0x9322('0xb')](function(_0x2200e9){logger[_0x9322('0xc')](_0x9322('0xd'),_0x149ee1,_0x9322('0xe'));logger['debug'](_0x9322('0xf'),_0x149ee1,_0x9322('0xe'),JSON[_0x9322('0x10')](_0x2200e9));if(_0x2200e9[_0x9322('0x11')]){if(_0x2200e9[_0x9322('0x11')][_0x9322('0x12')]===0x1f4){logger[_0x9322('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x149ee1,_0x2200e9[_0x9322('0x11')][_0x9322('0x13')]);return _0x181178(_0x2200e9['error'][_0x9322('0x13')]);}logger[_0x9322('0x11')](_0x9322('0xd'),_0x149ee1,_0x2200e9['error'][_0x9322('0x13')]);return _0x96d4cd(_0x2200e9[_0x9322('0x11')][_0x9322('0x13')]);}else{logger['info'](_0x9322('0xd'),_0x149ee1,'request\x20sent');_0x96d4cd(_0x2200e9['result']['message']);}})[_0x9322('0x14')](function(_0xd30c11){logger[_0x9322('0x11')](_0x9322('0xd'),_0x149ee1,_0xd30c11);_0x181178(_0xd30c11);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9928e12..65cb3b4 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 _0x6489=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','post','put','update','/:id','destroy','exports','multer','util'];(function(_0x50f5ad,_0x4ddfbf){var _0x18b7b1=function(_0x285c6a){while(--_0x285c6a){_0x50f5ad['push'](_0x50f5ad['shift']());}};_0x18b7b1(++_0x4ddfbf);}(_0x6489,0xa8));var _0x9648=function(_0x35cc59,_0x56421c){_0x35cc59=_0x35cc59-0x0;var _0x570b33=_0x6489[_0x35cc59];return _0x570b33;};'use strict';var multer=require(_0x9648('0x0'));var util=require(_0x9648('0x1'));var path=require(_0x9648('0x2'));var timeout=require(_0x9648('0x3'));var express=require(_0x9648('0x4'));var router=express['Router']();var fs_extra=require(_0x9648('0x5'));var auth=require(_0x9648('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9648('0x7'));var controller=require(_0x9648('0x8'));router[_0x9648('0x9')]('/',auth[_0x9648('0xa')](),controller['index']);router[_0x9648('0x9')]('/:id',auth[_0x9648('0xa')](),controller['show']);router[_0x9648('0xb')]('/',auth[_0x9648('0xa')](),controller['create']);router[_0x9648('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9648('0xd')]);router['delete'](_0x9648('0xe'),auth['isAuthenticated'](),controller[_0x9648('0xf')]);module[_0x9648('0x10')]=router; \ No newline at end of file +var _0xa62d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x198cc0,_0x302ffd){var _0x468ad6=function(_0x24f7e1){while(--_0x24f7e1){_0x198cc0['push'](_0x198cc0['shift']());}};_0x468ad6(++_0x302ffd);}(_0xa62d,0x175));var _0xda62=function(_0x377385,_0x2d7c8d){_0x377385=_0x377385-0x0;var _0x58cd64=_0xa62d[_0x377385];return _0x58cd64;};'use strict';var multer=require(_0xda62('0x0'));var util=require(_0xda62('0x1'));var path=require(_0xda62('0x2'));var timeout=require(_0xda62('0x3'));var express=require(_0xda62('0x4'));var router=express[_0xda62('0x5')]();var fs_extra=require(_0xda62('0x6'));var auth=require(_0xda62('0x7'));var interaction=require(_0xda62('0x8'));var config=require(_0xda62('0x9'));var controller=require(_0xda62('0xa'));router[_0xda62('0xb')]('/',auth['isAuthenticated'](),controller[_0xda62('0xc')]);router[_0xda62('0xb')](_0xda62('0xd'),auth[_0xda62('0xe')](),controller[_0xda62('0xf')]);router[_0xda62('0x10')]('/',auth[_0xda62('0xe')](),controller['create']);router[_0xda62('0x11')](_0xda62('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xda62('0x12')](_0xda62('0xd'),auth[_0xda62('0xe')](),controller[_0xda62('0x13')]);module[_0xda62('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7719189..eccf316 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 _0xc310=['customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x541f9e,_0x1cd27d){var _0x158bb1=function(_0x4344fd){while(--_0x4344fd){_0x541f9e['push'](_0x541f9e['shift']());}};_0x158bb1(++_0x1cd27d);}(_0xc310,0x1c6));var _0x0c31=function(_0x3aca81,_0x1fe87f){_0x3aca81=_0x3aca81-0x0;var _0x14dfaf=_0xc310[_0x3aca81];return _0x14dfaf;};'use strict';var Sequelize=require(_0x0c31('0x0'));module[_0x0c31('0x1')]={'type':{'type':Sequelize[_0x0c31('0x2')](_0x0c31('0x3'),_0x0c31('0x4'),_0x0c31('0x5'),'keyValue',_0x0c31('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0c31('0x7')]},'key':{'type':Sequelize[_0x0c31('0x7')]},'keyType':{'type':Sequelize[_0x0c31('0x2')](_0x0c31('0x3'),_0x0c31('0x4'),_0x0c31('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0c31('0x7')]},'customField':{'type':Sequelize[_0x0c31('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c31('0x7')]}}; \ No newline at end of file +var _0x4ade=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x29e91c,_0x209fac){var _0x19bfcb=function(_0x26ed0f){while(--_0x26ed0f){_0x29e91c['push'](_0x29e91c['shift']());}};_0x19bfcb(++_0x209fac);}(_0x4ade,0x139));var _0xe4ad=function(_0x54870d,_0x52a1c0){_0x54870d=_0x54870d-0x0;var _0x466526=_0x4ade[_0x54870d];return _0x466526;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe4ad('0x0')](_0xe4ad('0x1'),_0xe4ad('0x2'),_0xe4ad('0x3'),_0xe4ad('0x4'),_0xe4ad('0x5')),'defaultValue':_0xe4ad('0x1')},'content':{'type':Sequelize[_0xe4ad('0x6')]},'key':{'type':Sequelize[_0xe4ad('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe4ad('0x2'),_0xe4ad('0x3'))},'keyContent':{'type':Sequelize[_0xe4ad('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe4ad('0x6')]},'customField':{'type':Sequelize[_0xe4ad('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2206bc9..2e085e4 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 _0xe1e9=['path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','type','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x12b266,_0x27b7f8){var _0x343f73=function(_0x2a01df){while(--_0x2a01df){_0x12b266['push'](_0x12b266['shift']());}};_0x343f73(++_0x27b7f8);}(_0xe1e9,0x10b));var _0x9e1e=function(_0x30e9c9,_0x4797a2){_0x30e9c9=_0x30e9c9-0x0;var _0x13b511=_0xe1e9[_0x30e9c9];return _0x13b511;};'use strict';var emlformat=require(_0x9e1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e1e('0x1'));var jsonpatch=require(_0x9e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e1e('0x3'));var Mustache=require(_0x9e1e('0x4'));var util=require('util');var path=require(_0x9e1e('0x5'));var sox=require(_0x9e1e('0x6'));var csv=require('to-csv');var ejs=require(_0x9e1e('0x7'));var fs=require('fs');var fs_extra=require(_0x9e1e('0x8'));var _=require(_0x9e1e('0x9'));var squel=require('squel');var crypto=require(_0x9e1e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9e1e('0xb'));var toCsv=require(_0x9e1e('0xc'));var querystring=require(_0x9e1e('0xd'));var Papa=require(_0x9e1e('0xe'));var Redis=require('ioredis');var authService=require(_0x9e1e('0xf'));var qs=require(_0x9e1e('0x10'));var as=require(_0x9e1e('0x11'));var hardwareService=require(_0x9e1e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9e1e('0x13'));var config=require(_0x9e1e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e1e('0x15'))['db'];function respondWithStatusCode(_0x4ee37a,_0x1626c5){_0x1626c5=_0x1626c5||0xcc;return function(_0x574662){if(_0x574662){return _0x4ee37a[_0x9e1e('0x16')](_0x1626c5);}return _0x4ee37a[_0x9e1e('0x17')](_0x1626c5)[_0x9e1e('0x18')]();};}function respondWithResult(_0x22ea0c,_0x7ea83d){_0x7ea83d=_0x7ea83d||0xc8;return function(_0x206498){if(_0x206498){return _0x22ea0c[_0x9e1e('0x17')](_0x7ea83d)[_0x9e1e('0x19')](_0x206498);}};}function respondWithFilteredResult(_0x15643b,_0x5ecf12){return function(_0x54b809){if(_0x54b809){var _0x4c5ba1=typeof _0x5ecf12[_0x9e1e('0x1a')]==='undefined'&&typeof _0x5ecf12[_0x9e1e('0x1b')]==='undefined';var _0x33a164=_0x54b809[_0x9e1e('0x1c')];var _0x51c3c0=_0x4c5ba1?0x0:_0x5ecf12['offset'];var _0x5c9148=_0x4c5ba1?_0x54b809[_0x9e1e('0x1c')]:_0x5ecf12[_0x9e1e('0x1a')]+_0x5ecf12[_0x9e1e('0x1b')];var _0x51e112;if(_0x5c9148>=_0x33a164){_0x5c9148=_0x33a164;_0x51e112=0xc8;}else{_0x51e112=0xce;}_0x15643b['status'](_0x51e112);return _0x15643b[_0x9e1e('0x1d')](_0x9e1e('0x1e'),_0x51c3c0+'-'+_0x5c9148+'/'+_0x33a164)[_0x9e1e('0x19')](_0x54b809);}return null;};}function patchUpdates(_0x406915){return function(_0x2230fa){try{jsonpatch['apply'](_0x2230fa,_0x406915,!![]);}catch(_0x4fac98){return BPromise[_0x9e1e('0x1f')](_0x4fac98);}return _0x2230fa[_0x9e1e('0x20')]();};}function saveUpdates(_0x41bcf6,_0x12d015){return function(_0x2e2338){if(_0x2e2338){return _0x2e2338[_0x9e1e('0x21')](_0x41bcf6)[_0x9e1e('0x22')](function(_0xd1e41c){return _0xd1e41c;});}return null;};}function removeEntity(_0x1531e5,_0x465076){return function(_0xad40ce){if(_0xad40ce){return _0xad40ce[_0x9e1e('0x23')]()[_0x9e1e('0x22')](function(){_0x1531e5[_0x9e1e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53178b,_0xdca92d){return function(_0x4e7852){if(!_0x4e7852){_0x53178b[_0x9e1e('0x16')](0x194);}return _0x4e7852;};}function handleError(_0x38ac32,_0x5ca751){_0x5ca751=_0x5ca751||0x1f4;return function(_0x28370c){logger[_0x9e1e('0x24')](_0x28370c[_0x9e1e('0x25')]);if(_0x28370c[_0x9e1e('0x26')]){delete _0x28370c[_0x9e1e('0x26')];}_0x38ac32[_0x9e1e('0x17')](_0x5ca751)['send'](_0x28370c);};}exports[_0x9e1e('0x27')]=function(_0x528fb1,_0x8f66ef){var _0x43a057={},_0x23f9d0={},_0x240e3b={'count':0x0,'rows':[]};var _0x4a6170=_[_0x9e1e('0x28')](db[_0x9e1e('0x29')][_0x9e1e('0x2a')],function(_0x488009){return{'name':_0x488009['fieldName'],'type':_0x488009[_0x9e1e('0x2b')]['key']};});_0x23f9d0['model']=_[_0x9e1e('0x28')](_0x4a6170,'name');_0x23f9d0[_0x9e1e('0x2c')]=_[_0x9e1e('0x2d')](_0x528fb1['query']);_0x23f9d0['filters']=_['intersection'](_0x23f9d0['model'],_0x23f9d0[_0x9e1e('0x2c')]);_0x43a057[_0x9e1e('0x2e')]=_[_0x9e1e('0x2f')](_0x23f9d0[_0x9e1e('0x30')],qs[_0x9e1e('0x31')](_0x528fb1['query'][_0x9e1e('0x31')]));_0x43a057[_0x9e1e('0x2e')]=_0x43a057[_0x9e1e('0x2e')][_0x9e1e('0x32')]?_0x43a057['attributes']:_0x23f9d0[_0x9e1e('0x30')];if(!_0x528fb1[_0x9e1e('0x2c')]['hasOwnProperty'](_0x9e1e('0x33'))){_0x43a057['limit']=qs[_0x9e1e('0x1b')](_0x528fb1[_0x9e1e('0x2c')][_0x9e1e('0x1b')]);_0x43a057[_0x9e1e('0x1a')]=qs['offset'](_0x528fb1[_0x9e1e('0x2c')]['offset']);}_0x43a057[_0x9e1e('0x34')]=qs[_0x9e1e('0x35')](_0x528fb1[_0x9e1e('0x2c')]['sort']);_0x43a057[_0x9e1e('0x36')]=qs['filters'](_[_0x9e1e('0x37')](_0x528fb1['query'],_0x23f9d0['filters']),_0x4a6170);if(_0x528fb1[_0x9e1e('0x2c')][_0x9e1e('0x38')]){_0x43a057[_0x9e1e('0x36')]=_['merge'](_0x43a057[_0x9e1e('0x36')],{'$or':_[_0x9e1e('0x28')](_0x4a6170,function(_0x23bc73){if(_0x23bc73['type']!=='VIRTUAL'){var _0x847418={};_0x847418[_0x23bc73[_0x9e1e('0x26')]]={'$like':'%'+_0x528fb1['query'][_0x9e1e('0x38')]+'%'};return _0x847418;}})});}_0x43a057=_[_0x9e1e('0x39')]({},_0x43a057,_0x528fb1[_0x9e1e('0x3a')]);var _0x1e6554={'where':_0x43a057['where']};return db[_0x9e1e('0x29')]['count'](_0x1e6554)[_0x9e1e('0x22')](function(_0x7715e1){_0x240e3b[_0x9e1e('0x1c')]=_0x7715e1;if(_0x528fb1['query']['includeAll']){_0x43a057[_0x9e1e('0x3b')]=[{'all':!![]}];}return db[_0x9e1e('0x29')][_0x9e1e('0x3c')](_0x43a057);})[_0x9e1e('0x22')](function(_0x29df26){_0x240e3b[_0x9e1e('0x3d')]=_0x29df26;return _0x240e3b;})[_0x9e1e('0x22')](respondWithFilteredResult(_0x8f66ef,_0x43a057))['catch'](handleError(_0x8f66ef,null));};exports[_0x9e1e('0x3e')]=function(_0x236c4b,_0x9778f1){var _0xe9b826={'raw':!![],'where':{'id':_0x236c4b[_0x9e1e('0x3f')]['id']}},_0x57e2da={};_0x57e2da[_0x9e1e('0x30')]=_[_0x9e1e('0x2d')](db[_0x9e1e('0x29')]['rawAttributes']);_0x57e2da[_0x9e1e('0x2c')]=_['keys'](_0x236c4b[_0x9e1e('0x2c')]);_0x57e2da['filters']=_[_0x9e1e('0x2f')](_0x57e2da[_0x9e1e('0x30')],_0x57e2da[_0x9e1e('0x2c')]);_0xe9b826[_0x9e1e('0x2e')]=_[_0x9e1e('0x2f')](_0x57e2da[_0x9e1e('0x30')],qs['fields'](_0x236c4b['query']['fields']));_0xe9b826[_0x9e1e('0x2e')]=_0xe9b826[_0x9e1e('0x2e')][_0x9e1e('0x32')]?_0xe9b826['attributes']:_0x57e2da[_0x9e1e('0x30')];if(_0x236c4b['query'][_0x9e1e('0x40')]){_0xe9b826[_0x9e1e('0x3b')]=[{'all':!![]}];}_0xe9b826=_['merge']({},_0xe9b826,_0x236c4b[_0x9e1e('0x3a')]);return db[_0x9e1e('0x29')]['find'](_0xe9b826)[_0x9e1e('0x22')](handleEntityNotFound(_0x9778f1,null))[_0x9e1e('0x22')](respondWithResult(_0x9778f1,null))[_0x9e1e('0x41')](handleError(_0x9778f1,null));};exports['create']=function(_0x5d24d7,_0x53e503){return db[_0x9e1e('0x29')][_0x9e1e('0x42')](_0x5d24d7['body'],{})[_0x9e1e('0x22')](respondWithResult(_0x53e503,0xc9))['catch'](handleError(_0x53e503,null));};exports[_0x9e1e('0x21')]=function(_0x26aa0c,_0x5c0c0b){if(_0x26aa0c[_0x9e1e('0x43')]['id']){delete _0x26aa0c[_0x9e1e('0x43')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x26aa0c[_0x9e1e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c0c0b,null))[_0x9e1e('0x22')](saveUpdates(_0x26aa0c['body'],null))[_0x9e1e('0x22')](respondWithResult(_0x5c0c0b,null))['catch'](handleError(_0x5c0c0b,null));};exports[_0x9e1e('0x23')]=function(_0x3bc69c,_0x1f0f73){return db[_0x9e1e('0x29')]['find']({'where':{'id':_0x3bc69c[_0x9e1e('0x3f')]['id']}})[_0x9e1e('0x22')](handleEntityNotFound(_0x1f0f73,null))['then'](removeEntity(_0x1f0f73,null))['catch'](handleError(_0x1f0f73,null));}; \ No newline at end of file +var _0x6beb=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','map','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','ZohoField','include','findAll','rows','catch','show','rawAttributes','intersection','includeAll','create','body','find','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x4ba037,_0x3dbb2f){var _0x523957=function(_0x271ce3){while(--_0x271ce3){_0x4ba037['push'](_0x4ba037['shift']());}};_0x523957(++_0x3dbb2f);}(_0x6beb,0x1b2));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xb6be('0x0'));var rimraf=require(_0xb6be('0x1'));var zipdir=require(_0xb6be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6be('0x3'));var moment=require(_0xb6be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb6be('0x5'));var util=require('util');var path=require(_0xb6be('0x6'));var sox=require(_0xb6be('0x7'));var csv=require(_0xb6be('0x8'));var ejs=require(_0xb6be('0x9'));var fs=require('fs');var fs_extra=require(_0xb6be('0xa'));var _=require(_0xb6be('0xb'));var squel=require(_0xb6be('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6be('0xd'));var deskjs=require(_0xb6be('0xe'));var toCsv=require(_0xb6be('0x8'));var querystring=require(_0xb6be('0xf'));var Papa=require(_0xb6be('0x10'));var Redis=require(_0xb6be('0x11'));var authService=require(_0xb6be('0x12'));var qs=require(_0xb6be('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6be('0x14'));var logger=require(_0xb6be('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb6be('0x16'));var licenseUtil=require(_0xb6be('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48c589,_0x459113){_0x459113=_0x459113||0xcc;return function(_0xa690fe){if(_0xa690fe){return _0x48c589[_0xb6be('0x18')](_0x459113);}return _0x48c589['status'](_0x459113)[_0xb6be('0x19')]();};}function respondWithResult(_0x35309f,_0x3d92ea){_0x3d92ea=_0x3d92ea||0xc8;return function(_0x525f39){if(_0x525f39){return _0x35309f[_0xb6be('0x1a')](_0x3d92ea)[_0xb6be('0x1b')](_0x525f39);}};}function respondWithFilteredResult(_0x31da68,_0x35e0d3){return function(_0xb8ca97){if(_0xb8ca97){var _0x335a70=typeof _0x35e0d3['offset']===_0xb6be('0x1c')&&typeof _0x35e0d3[_0xb6be('0x1d')]===_0xb6be('0x1c');var _0x169c65=_0xb8ca97[_0xb6be('0x1e')];var _0xed6014=_0x335a70?0x0:_0x35e0d3[_0xb6be('0x1f')];var _0x1304fb=_0x335a70?_0xb8ca97['count']:_0x35e0d3[_0xb6be('0x1f')]+_0x35e0d3[_0xb6be('0x1d')];var _0x12cd1f;if(_0x1304fb>=_0x169c65){_0x1304fb=_0x169c65;_0x12cd1f=0xc8;}else{_0x12cd1f=0xce;}_0x31da68[_0xb6be('0x1a')](_0x12cd1f);return _0x31da68[_0xb6be('0x20')](_0xb6be('0x21'),_0xed6014+'-'+_0x1304fb+'/'+_0x169c65)['json'](_0xb8ca97);}return null;};}function patchUpdates(_0x2e51fa){return function(_0x276bab){try{jsonpatch[_0xb6be('0x22')](_0x276bab,_0x2e51fa,!![]);}catch(_0x3760f4){return BPromise[_0xb6be('0x23')](_0x3760f4);}return _0x276bab['save']();};}function saveUpdates(_0x8c05d3,_0x430853){return function(_0x54a184){if(_0x54a184){return _0x54a184[_0xb6be('0x24')](_0x8c05d3)[_0xb6be('0x25')](function(_0x3ceb5e){return _0x3ceb5e;});}return null;};}function removeEntity(_0x2c5aac,_0xb02494){return function(_0x307848){if(_0x307848){return _0x307848['destroy']()['then'](function(){_0x2c5aac[_0xb6be('0x1a')](0xcc)[_0xb6be('0x19')]();});}};}function handleEntityNotFound(_0x2273b8,_0x3e158f){return function(_0x2e0324){if(!_0x2e0324){_0x2273b8[_0xb6be('0x18')](0x194);}return _0x2e0324;};}function handleError(_0x51ed5e,_0x12f517){_0x12f517=_0x12f517||0x1f4;return function(_0x50ec9a){logger[_0xb6be('0x26')](_0x50ec9a[_0xb6be('0x27')]);if(_0x50ec9a[_0xb6be('0x28')]){delete _0x50ec9a[_0xb6be('0x28')];}_0x51ed5e['status'](_0x12f517)['send'](_0x50ec9a);};}exports['index']=function(_0xc0763d,_0x1d4d66){var _0x236baa={},_0x543269={},_0x2b74c8={'count':0x0,'rows':[]};var _0x13204c=_[_0xb6be('0x29')](db['ZohoField']['rawAttributes'],function(_0x824e2){return{'name':_0x824e2[_0xb6be('0x2a')],'type':_0x824e2[_0xb6be('0x2b')][_0xb6be('0x2c')]};});_0x543269[_0xb6be('0x2d')]=_[_0xb6be('0x29')](_0x13204c,_0xb6be('0x28'));_0x543269[_0xb6be('0x2e')]=_[_0xb6be('0x2f')](_0xc0763d[_0xb6be('0x2e')]);_0x543269['filters']=_['intersection'](_0x543269['model'],_0x543269[_0xb6be('0x2e')]);_0x236baa['attributes']=_['intersection'](_0x543269[_0xb6be('0x2d')],qs[_0xb6be('0x30')](_0xc0763d['query'][_0xb6be('0x30')]));_0x236baa[_0xb6be('0x31')]=_0x236baa[_0xb6be('0x31')][_0xb6be('0x32')]?_0x236baa['attributes']:_0x543269[_0xb6be('0x2d')];if(!_0xc0763d[_0xb6be('0x2e')][_0xb6be('0x33')](_0xb6be('0x34'))){_0x236baa[_0xb6be('0x1d')]=qs[_0xb6be('0x1d')](_0xc0763d['query'][_0xb6be('0x1d')]);_0x236baa[_0xb6be('0x1f')]=qs['offset'](_0xc0763d[_0xb6be('0x2e')][_0xb6be('0x1f')]);}_0x236baa[_0xb6be('0x35')]=qs[_0xb6be('0x36')](_0xc0763d[_0xb6be('0x2e')][_0xb6be('0x36')]);_0x236baa[_0xb6be('0x37')]=qs[_0xb6be('0x38')](_[_0xb6be('0x39')](_0xc0763d[_0xb6be('0x2e')],_0x543269[_0xb6be('0x38')]),_0x13204c);if(_0xc0763d[_0xb6be('0x2e')][_0xb6be('0x3a')]){_0x236baa[_0xb6be('0x37')]=_['merge'](_0x236baa[_0xb6be('0x37')],{'$or':_[_0xb6be('0x29')](_0x13204c,function(_0x1c09c1){if(_0x1c09c1[_0xb6be('0x2b')]!=='VIRTUAL'){var _0x2584ec={};_0x2584ec[_0x1c09c1[_0xb6be('0x28')]]={'$like':'%'+_0xc0763d[_0xb6be('0x2e')][_0xb6be('0x3a')]+'%'};return _0x2584ec;}})});}_0x236baa=_[_0xb6be('0x3b')]({},_0x236baa,_0xc0763d['options']);var _0x428a4f={'where':_0x236baa[_0xb6be('0x37')]};return db[_0xb6be('0x3c')][_0xb6be('0x1e')](_0x428a4f)['then'](function(_0xfe30ae){_0x2b74c8[_0xb6be('0x1e')]=_0xfe30ae;if(_0xc0763d['query']['includeAll']){_0x236baa[_0xb6be('0x3d')]=[{'all':!![]}];}return db[_0xb6be('0x3c')][_0xb6be('0x3e')](_0x236baa);})[_0xb6be('0x25')](function(_0x4022ea){_0x2b74c8[_0xb6be('0x3f')]=_0x4022ea;return _0x2b74c8;})[_0xb6be('0x25')](respondWithFilteredResult(_0x1d4d66,_0x236baa))[_0xb6be('0x40')](handleError(_0x1d4d66,null));};exports[_0xb6be('0x41')]=function(_0x1b0ccf,_0x26fd60){var _0x34912d={'raw':!![],'where':{'id':_0x1b0ccf['params']['id']}},_0x501f12={};_0x501f12[_0xb6be('0x2d')]=_[_0xb6be('0x2f')](db[_0xb6be('0x3c')][_0xb6be('0x42')]);_0x501f12[_0xb6be('0x2e')]=_[_0xb6be('0x2f')](_0x1b0ccf[_0xb6be('0x2e')]);_0x501f12[_0xb6be('0x38')]=_[_0xb6be('0x43')](_0x501f12[_0xb6be('0x2d')],_0x501f12['query']);_0x34912d[_0xb6be('0x31')]=_[_0xb6be('0x43')](_0x501f12['model'],qs[_0xb6be('0x30')](_0x1b0ccf[_0xb6be('0x2e')][_0xb6be('0x30')]));_0x34912d[_0xb6be('0x31')]=_0x34912d[_0xb6be('0x31')]['length']?_0x34912d[_0xb6be('0x31')]:_0x501f12[_0xb6be('0x2d')];if(_0x1b0ccf['query'][_0xb6be('0x44')]){_0x34912d[_0xb6be('0x3d')]=[{'all':!![]}];}_0x34912d=_[_0xb6be('0x3b')]({},_0x34912d,_0x1b0ccf['options']);return db['ZohoField']['find'](_0x34912d)[_0xb6be('0x25')](handleEntityNotFound(_0x26fd60,null))[_0xb6be('0x25')](respondWithResult(_0x26fd60,null))[_0xb6be('0x40')](handleError(_0x26fd60,null));};exports[_0xb6be('0x45')]=function(_0x16dd11,_0x121e1d){return db[_0xb6be('0x3c')][_0xb6be('0x45')](_0x16dd11[_0xb6be('0x46')],{})[_0xb6be('0x25')](respondWithResult(_0x121e1d,0xc9))[_0xb6be('0x40')](handleError(_0x121e1d,null));};exports[_0xb6be('0x24')]=function(_0x534852,_0x1cd666){if(_0x534852[_0xb6be('0x46')]['id']){delete _0x534852['body']['id'];}return db[_0xb6be('0x3c')][_0xb6be('0x47')]({'where':{'id':_0x534852[_0xb6be('0x48')]['id']}})[_0xb6be('0x25')](handleEntityNotFound(_0x1cd666,null))['then'](saveUpdates(_0x534852['body'],null))['then'](respondWithResult(_0x1cd666,null))[_0xb6be('0x40')](handleError(_0x1cd666,null));};exports[_0xb6be('0x49')]=function(_0x5b79fe,_0x39cb12){return db[_0xb6be('0x3c')][_0xb6be('0x47')]({'where':{'id':_0x5b79fe['params']['id']}})[_0xb6be('0x25')](handleEntityNotFound(_0x39cb12,null))[_0xb6be('0x25')](removeEntity(_0x39cb12,null))[_0xb6be('0x40')](handleError(_0x39cb12,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 242d84f..86d001c 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 _0x7b84=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x205e3c,_0x534a13){var _0x58ec58=function(_0x1a1ece){while(--_0x1a1ece){_0x205e3c['push'](_0x205e3c['shift']());}};_0x58ec58(++_0x534a13);}(_0x7b84,0x17c));var _0x47b8=function(_0x88d00d,_0x337cdd){_0x88d00d=_0x88d00d-0x0;var _0x1641a1=_0x7b84[_0x88d00d];return _0x1641a1;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[{'name':_0x47b8('0xd'),'fields':[_0x47b8('0xe'),_0x47b8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['path','rimraf','../../config/environment','./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x1261[_0x1fc4e2];return _0x2ba184;};'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')]('ZohoField',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xd'),_0x1126('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 9ec99a7..13ff6ca 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 _0x13a6=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird'];(function(_0x58ba62,_0x252d9f){var _0x57628f=function(_0x5ba07b){while(--_0x5ba07b){_0x58ba62['push'](_0x58ba62['shift']());}};_0x57628f(++_0x252d9f);}(_0x13a6,0x90));var _0x613a=function(_0x1800d2,_0x41cdae){_0x1800d2=_0x1800d2-0x0;var _0x3b70ee=_0x13a6[_0x1800d2];return _0x3b70ee;};'use strict';var _=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var moment=require('moment');var BPromise=require(_0x613a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x613a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x613a('0x4'));var logger=require(_0x613a('0x5'))(_0x613a('0x6'));var config=require(_0x613a('0x7'));var jayson=require(_0x613a('0x8'));var client=jayson[_0x613a('0x9')][_0x613a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c116,_0x48d1dd,_0x4664f5){return new BPromise(function(_0x50e80c,_0x3df551){return client['request'](_0x13c116,_0x4664f5)[_0x613a('0xb')](function(_0x5356a4){logger['info'](_0x613a('0xc'),_0x48d1dd,_0x613a('0xd'));logger[_0x613a('0xe')](_0x613a('0xf'),_0x48d1dd,_0x613a('0xd'),JSON['stringify'](_0x5356a4));if(_0x5356a4[_0x613a('0x10')]){if(_0x5356a4[_0x613a('0x10')]['code']===0x1f4){logger[_0x613a('0x10')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x5356a4[_0x613a('0x10')]['message']);return _0x3df551(_0x5356a4[_0x613a('0x10')][_0x613a('0x11')]);}logger['error'](_0x613a('0xc'),_0x48d1dd,_0x5356a4[_0x613a('0x10')]['message']);return _0x50e80c(_0x5356a4[_0x613a('0x10')]['message']);}else{logger[_0x613a('0x12')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x613a('0xd'));_0x50e80c(_0x5356a4[_0x613a('0x13')][_0x613a('0x11')]);}})[_0x613a('0x14')](function(_0x384fc4){logger[_0x613a('0x10')]('ZohoField,\x20%s,\x20%s',_0x48d1dd,_0x384fc4);_0x3df551(_0x384fc4);});});} \ No newline at end of file +var _0x8e9f=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1f4b6f,_0xbb9dae){var _0x4ff4b0=function(_0x1a9ba9){while(--_0x1a9ba9){_0x1f4b6f['push'](_0x1f4b6f['shift']());}};_0x4ff4b0(++_0xbb9dae);}(_0x8e9f,0x171));var _0xf8e9=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x8e9f[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xf8e9('0x0'));var util=require(_0xf8e9('0x1'));var moment=require(_0xf8e9('0x2'));var BPromise=require(_0xf8e9('0x3'));var rs=require(_0xf8e9('0x4'));var fs=require('fs');var Redis=require(_0xf8e9('0x5'));var db=require(_0xf8e9('0x6'))['db'];var utils=require(_0xf8e9('0x7'));var logger=require(_0xf8e9('0x8'))(_0xf8e9('0x9'));var config=require(_0xf8e9('0xa'));var jayson=require(_0xf8e9('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cf765,_0x12617b,_0x436337){return new BPromise(function(_0x8523f8,_0x35d6b2){return client[_0xf8e9('0xc')](_0x3cf765,_0x436337)[_0xf8e9('0xd')](function(_0x4d6316){logger[_0xf8e9('0xe')]('ZohoField,\x20%s,\x20%s',_0x12617b,'request\x20sent');logger[_0xf8e9('0xf')](_0xf8e9('0x10'),_0x12617b,'request\x20sent',JSON[_0xf8e9('0x11')](_0x4d6316));if(_0x4d6316[_0xf8e9('0x12')]){if(_0x4d6316[_0xf8e9('0x12')][_0xf8e9('0x13')]===0x1f4){logger[_0xf8e9('0x12')](_0xf8e9('0x14'),_0x12617b,_0x4d6316[_0xf8e9('0x12')][_0xf8e9('0x15')]);return _0x35d6b2(_0x4d6316[_0xf8e9('0x12')]['message']);}logger[_0xf8e9('0x12')](_0xf8e9('0x14'),_0x12617b,_0x4d6316[_0xf8e9('0x12')]['message']);return _0x8523f8(_0x4d6316[_0xf8e9('0x12')][_0xf8e9('0x15')]);}else{logger[_0xf8e9('0xe')](_0xf8e9('0x14'),_0x12617b,_0xf8e9('0x16'));_0x8523f8(_0x4d6316[_0xf8e9('0x17')][_0xf8e9('0x15')]);}})['catch'](function(_0x106b12){logger[_0xf8e9('0x12')]('ZohoField,\x20%s,\x20%s',_0x12617b,_0x106b12);_0x35d6b2(_0x106b12);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 37a666b..29d79c7 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ba865,_0x110d26){var _0x35a964=function(_0x221267){while(--_0x221267){_0x1ba865['push'](_0x1ba865['shift']());}};_0x35a964(++_0x110d26);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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(_0x461563,_0x1dd4e9){var _0x281a3a=function(_0x36dd81){while(--_0x36dd81){_0x461563['push'](_0x461563['shift']());}};_0x281a3a(++_0x1dd4e9);}(_0xe706,0xa3));var _0x6e70=function(_0x363618,_0x5ebf3a){_0x363618=_0x363618-0x0;var _0x496dee=_0xe706[_0x363618];return _0x496dee;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4e41729..cd53270 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 _0xcf45=['sequelize','exports','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x10bae6,_0x41d85f){var _0x251123=function(_0x548886){while(--_0x548886){_0x10bae6['push'](_0x10bae6['shift']());}};_0x251123(++_0x41d85f);}(_0xcf45,0x168));var _0x5cf4=function(_0x4dd9dc,_0x38722f){_0x4dd9dc=_0x4dd9dc-0x0;var _0x9e067e=_0xcf45[_0x4dd9dc];return _0x9e067e;};'use strict';var Sequelize=require(_0x5cf4('0x0'));module[_0x5cf4('0x1')]={'name':{'type':Sequelize[_0x5cf4('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x5cf4('0x2')],'allowNull':![],'unique':_0x5cf4('0x3')},'main':{'type':Sequelize[_0x5cf4('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x5cf4('0x2')]},'path':{'type':Sequelize[_0x5cf4('0x2')]},'type':{'type':Sequelize[_0x5cf4('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5cf4('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x5cf4('0x2')]},'logo':{'type':Sequelize[_0x5cf4('0x2')]},'state':{'type':Sequelize[_0x5cf4('0x2')],'unique':_0x5cf4('0x5')},'description':{'type':Sequelize[_0x5cf4('0x2')]},'title':{'type':Sequelize[_0x5cf4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x87ae=['INTEGER','STRING','unique_name_and_version','app.js'];(function(_0xa64531,_0x48c65f){var _0x1b1f42=function(_0x78e575){while(--_0x78e575){_0xa64531['push'](_0xa64531['shift']());}};_0x1b1f42(++_0x48c65f);}(_0x87ae,0xf5));var _0xe87a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x87ae[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe87a('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe87a('0x1')},'main':{'type':Sequelize[_0xe87a('0x0')],'defaultValue':_0xe87a('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xe87a('0x0')]},'type':{'type':Sequelize[_0xe87a('0x0')]},'size':{'type':Sequelize[_0xe87a('0x3')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe87a('0x0')]},'state':{'type':Sequelize[_0xe87a('0x0')],'unique':'state'},'description':{'type':Sequelize[_0xe87a('0x0')]},'title':{'type':Sequelize[_0xe87a('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xe87a('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index acf47c2..9e42bbd 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 _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1623,0xab));var _0x3162=function(_0x3ba573,_0x18e144){_0x3ba573=_0x3ba573-0x0;var _0x1b35ca=_0x1623[_0x3ba573];return _0x1b35ca;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file +var _0x5496=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','Integration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5496,0x175));var _0x6549=function(_0x4183ff,_0x48ae29){_0x4183ff=_0x4183ff-0x0;var _0x20cd57=_0x5496[_0x4183ff];return _0x20cd57;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['Integration'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e9786ed..03be620 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 _0xe509=['../../config/environment','./integration.attributes','exports','define','integrations','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x31ddea,_0x40de6d){var _0x12539b=function(_0x1d353b){while(--_0x1d353b){_0x31ddea['push'](_0x31ddea['shift']());}};_0x12539b(++_0x40de6d);}(_0xe509,0x10d));var _0x9e50=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xe509[_0x53f0db];return _0xae0a5c;};'use strict';var _=require('lodash');var util=require(_0x9e50('0x0'));var logger=require('../../config/logger')(_0x9e50('0x1'));var moment=require(_0x9e50('0x2'));var BPromise=require(_0x9e50('0x3'));var rp=require(_0x9e50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e50('0x5'));var config=require(_0x9e50('0x6'));var attributes=require(_0x9e50('0x7'));module[_0x9e50('0x8')]=function(_0x4f76cd,_0x2f194b){return _0x4f76cd[_0x9e50('0x9')]('Integration',attributes,{'tableName':_0x9e50('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc020=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc020,0x152));var _0x0c02=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xc020[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require(_0x0c02('0x0'));var util=require(_0x0c02('0x1'));var logger=require(_0x0c02('0x2'))(_0x0c02('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0c02('0x4'));var fs=require('fs');var path=require(_0x0c02('0x5'));var rimraf=require(_0x0c02('0x6'));var config=require(_0x0c02('0x7'));var attributes=require(_0x0c02('0x8'));module[_0x0c02('0x9')]=function(_0x4ae1b3,_0x22c512){return _0x4ae1b3[_0x0c02('0xa')](_0x0c02('0xb'),attributes,{'tableName':_0x0c02('0xc'),'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 26227e9..dca5a7d 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\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(_0x3be0d7,_0x4f0a3e){var _0x18188a=function(_0x2868f1){while(--_0x2868f1){_0x3be0d7['push'](_0x3be0d7['shift']());}};_0x18188a(++_0x4f0a3e);}(_0x2542,0x169));var _0x2254=function(_0x51d3b9,_0x302432){_0x51d3b9=_0x51d3b9-0x0;var _0x17d110=_0x2542[_0x51d3b9];return _0x17d110;};'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 +var _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x327e1e,_0x18a30f){var _0x37032b=function(_0x2105a1){while(--_0x2105a1){_0x327e1e['push'](_0x327e1e['shift']());}};_0x37032b(++_0x18a30f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x45bf93,_0x3fbd44){_0x45bf93=_0x45bf93-0x0;var _0x396aeb=_0xdd4f[_0x45bf93];return _0x396aeb;};'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});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5228001..604d95c 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45f6ca,_0x2811ad){_0x45f6ca=_0x45f6ca-0x0;var _0x33d664=_0x5f2f[_0x45f6ca];return _0x33d664;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2604f3,_0x4fc9b3){var _0x223180=function(_0x246d8e){while(--_0x246d8e){_0x2604f3['push'](_0x2604f3['shift']());}};_0x223180(++_0x4fc9b3);}(_0x2ef3,0xba));var _0x32ef=function(_0x38afb5,_0x52833){_0x38afb5=_0x38afb5-0x0;var _0x13f312=_0x2ef3[_0x38afb5];return _0x13f312;};'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('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2d95cc9..e48beb5 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 _0x87d1=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x87d1,0x125));var _0x187d=function(_0x551e84,_0x292d8c){_0x551e84=_0x551e84-0x0;var _0x7ffe22=_0x87d1[_0x551e84];return _0x7ffe22;};'use strict';var Sequelize=require(_0x187d('0x0'));module[_0x187d('0x1')]={'integration':{'type':Sequelize[_0x187d('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x187d('0x2')]},'ticketId':{'type':Sequelize[_0x187d('0x2')]},'integrationId':{'type':Sequelize[_0x187d('0x3')]},'contacts':{'type':Sequelize[_0x187d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x187d('0x2')]},'interface':{'type':Sequelize[_0x187d('0x2')]},'membername':{'type':Sequelize[_0x187d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x187d('0x4')]},'agentconnectAt':{'type':Sequelize[_0x187d('0x4')]},'holdtime':{'type':Sequelize[_0x187d('0x3')]},'agentcomplete':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x187d('0x4')]},'talktime':{'type':Sequelize[_0x187d('0x3')]},'agentacw':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x187d('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x187d('0x4')]},'agentdump':{'type':Sequelize[_0x187d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x187d('0x4')]},'lastevent':{'type':Sequelize[_0x187d('0x2')]},'channel':{'type':Sequelize[_0x187d('0x2')]},'channelstate':{'type':Sequelize[_0x187d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x187d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x187d('0x2')]},'connectedlinename':{'type':Sequelize[_0x187d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x187d('0x2')]},'context':{'type':Sequelize[_0x187d('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x187d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x187d('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x187d('0x2')]},'destcalleridname':{'type':Sequelize[_0x187d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x187d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x187d('0x2')]},'destaccountcode':{'type':Sequelize[_0x187d('0x2')]},'destcontext':{'type':Sequelize[_0x187d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x187d('0x2')]},'destuniqueid':{'type':Sequelize[_0x187d('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x187d('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x187d('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x187d('0x2')]},'attachment':{'type':Sequelize[_0x187d('0x6')]},'html':{'type':Sequelize[_0x187d('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x187d('0x7')](_0x187d('0x8'),_0x187d('0x9'),_0x187d('0xa'),_0x187d('0xb'))},'url':{'type':Sequelize[_0x187d('0x2')]},'app':{'type':Sequelize[_0x187d('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x85f7=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x5e34d7,_0x53669c){var _0x4efa32=function(_0x485b5d){while(--_0x485b5d){_0x5e34d7['push'](_0x5e34d7['shift']());}};_0x4efa32(++_0x53669c);}(_0x85f7,0x136));var _0x785f=function(_0x5d739d,_0x95aac5){_0x5d739d=_0x5d739d-0x0;var _0x3239df=_0x85f7[_0x5d739d];return _0x3239df;};'use strict';var Sequelize=require(_0x785f('0x0'));module[_0x785f('0x1')]={'integration':{'type':Sequelize[_0x785f('0x2')]},'eventChannel':{'type':Sequelize[_0x785f('0x2')]},'exitStatus':{'type':Sequelize[_0x785f('0x2')]},'ticketId':{'type':Sequelize[_0x785f('0x2')]},'integrationId':{'type':Sequelize[_0x785f('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x785f('0x2')]},'calleridnum':{'type':Sequelize[_0x785f('0x2')]},'calleridname':{'type':Sequelize[_0x785f('0x2')]},'queue':{'type':Sequelize[_0x785f('0x2')]},'interface':{'type':Sequelize[_0x785f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x785f('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x785f('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x785f('0x4')]},'talktime':{'type':Sequelize[_0x785f('0x3')]},'agentacw':{'type':Sequelize[_0x785f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x785f('0x3')]},'reason':{'type':Sequelize[_0x785f('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x785f('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x785f('0x2')]},'channel':{'type':Sequelize[_0x785f('0x2')]},'channelstate':{'type':Sequelize[_0x785f('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x785f('0x2')]},'connectedlinename':{'type':Sequelize[_0x785f('0x2')]},'language':{'type':Sequelize[_0x785f('0x2')]},'accountcode':{'type':Sequelize[_0x785f('0x2')]},'context':{'type':Sequelize[_0x785f('0x2')]},'exten':{'type':Sequelize[_0x785f('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x785f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x785f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x785f('0x2')]},'destcalleridname':{'type':Sequelize[_0x785f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x785f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x785f('0x2')]},'destlanguage':{'type':Sequelize[_0x785f('0x2')]},'destaccountcode':{'type':Sequelize[_0x785f('0x2')]},'destcontext':{'type':Sequelize[_0x785f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x785f('0x2')]},'destuniqueid':{'type':Sequelize[_0x785f('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x785f('0x2')]},'subject':{'type':Sequelize[_0x785f('0x2')]},'from':{'type':Sequelize[_0x785f('0x2')]},'to':{'type':Sequelize[_0x785f('0x2')]},'cc':{'type':Sequelize[_0x785f('0x2')]},'attachment':{'type':Sequelize[_0x785f('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x785f('0x6')]},'status':{'type':Sequelize[_0x785f('0x7')](_0x785f('0x8'),'SENDING',_0x785f('0x9'),_0x785f('0xa'))},'url':{'type':Sequelize[_0x785f('0x2')]},'app':{'type':Sequelize[_0x785f('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x785f('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 4473474..171efe2 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 _0x9ba8=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','IntegrationReport','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service'];(function(_0x3bf04a,_0x56ed90){var _0x241e4b=function(_0x105e52){while(--_0x105e52){_0x3bf04a['push'](_0x3bf04a['shift']());}};_0x241e4b(++_0x56ed90);}(_0x9ba8,0x196));var _0x89ba=function(_0xbe048b,_0x2f8970){_0xbe048b=_0xbe048b-0x0;var _0x1d9099=_0x9ba8[_0xbe048b];return _0x1d9099;};'use strict';var emlformat=require(_0x89ba('0x0'));var rimraf=require(_0x89ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x89ba('0x2'));var moment=require(_0x89ba('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89ba('0x4'));var path=require(_0x89ba('0x5'));var sox=require(_0x89ba('0x6'));var csv=require(_0x89ba('0x7'));var ejs=require(_0x89ba('0x8'));var fs=require('fs');var fs_extra=require(_0x89ba('0x9'));var _=require('lodash');var squel=require(_0x89ba('0xa'));var crypto=require('crypto');var jsforce=require(_0x89ba('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89ba('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89ba('0xd'));var qs=require(_0x89ba('0xe'));var as=require(_0x89ba('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x89ba('0x10'));var utils=require(_0x89ba('0x11'));var config=require(_0x89ba('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x89ba('0x13'))['db'];function respondWithStatusCode(_0x535db5,_0x39a6ad){_0x39a6ad=_0x39a6ad||0xcc;return function(_0x2165bb){if(_0x2165bb){return _0x535db5[_0x89ba('0x14')](_0x39a6ad);}return _0x535db5[_0x89ba('0x15')](_0x39a6ad)[_0x89ba('0x16')]();};}function respondWithResult(_0x3e0a70,_0x2e994d){_0x2e994d=_0x2e994d||0xc8;return function(_0x5d8e71){if(_0x5d8e71){return _0x3e0a70[_0x89ba('0x15')](_0x2e994d)[_0x89ba('0x17')](_0x5d8e71);}};}function respondWithFilteredResult(_0xe584da,_0x57b18f){return function(_0x55a458){if(_0x55a458){var _0x83360b=typeof _0x57b18f['offset']==='undefined'&&typeof _0x57b18f['limit']==='undefined';var _0x315e8f=_0x55a458['count'];var _0x4fbcd6=_0x83360b?0x0:_0x57b18f['offset'];var _0x4a2fc3=_0x83360b?_0x55a458[_0x89ba('0x18')]:_0x57b18f[_0x89ba('0x19')]+_0x57b18f[_0x89ba('0x1a')];var _0x5b60b1;if(_0x4a2fc3>=_0x315e8f){_0x4a2fc3=_0x315e8f;_0x5b60b1=0xc8;}else{_0x5b60b1=0xce;}_0xe584da[_0x89ba('0x15')](_0x5b60b1);return _0xe584da[_0x89ba('0x1b')](_0x89ba('0x1c'),_0x4fbcd6+'-'+_0x4a2fc3+'/'+_0x315e8f)[_0x89ba('0x17')](_0x55a458);}return null;};}function patchUpdates(_0x3e80f7){return function(_0x2132ad){try{jsonpatch[_0x89ba('0x1d')](_0x2132ad,_0x3e80f7,!![]);}catch(_0x27945f){return BPromise[_0x89ba('0x1e')](_0x27945f);}return _0x2132ad[_0x89ba('0x1f')]();};}function saveUpdates(_0x471c82,_0x206781){return function(_0x3c511c){if(_0x3c511c){return _0x3c511c[_0x89ba('0x20')](_0x471c82)[_0x89ba('0x21')](function(_0xf9ffff){return _0xf9ffff;});}return null;};}function removeEntity(_0x5d8b24,_0x4103e8){return function(_0x3ff5f4){if(_0x3ff5f4){return _0x3ff5f4[_0x89ba('0x22')]()[_0x89ba('0x21')](function(){_0x5d8b24[_0x89ba('0x15')](0xcc)[_0x89ba('0x16')]();});}};}function handleEntityNotFound(_0xcd326c,_0x315f90){return function(_0x52e26f){if(!_0x52e26f){_0xcd326c[_0x89ba('0x14')](0x194);}return _0x52e26f;};}function handleError(_0x5902c2,_0xbce2eb){_0xbce2eb=_0xbce2eb||0x1f4;return function(_0x3bb5cc){logger[_0x89ba('0x23')](_0x3bb5cc[_0x89ba('0x24')]);if(_0x3bb5cc['name']){delete _0x3bb5cc['name'];}_0x5902c2['status'](_0xbce2eb)[_0x89ba('0x25')](_0x3bb5cc);};}exports[_0x89ba('0x26')]=function(_0x28a672,_0x28bbf7){var _0x3eb47e={},_0x1a0046={},_0x535a09={'count':0x0,'rows':[]};var _0xe72288=_['map'](db[_0x89ba('0x27')][_0x89ba('0x28')],function(_0x2ed293){return{'name':_0x2ed293['fieldName'],'type':_0x2ed293[_0x89ba('0x29')][_0x89ba('0x2a')]};});_0x1a0046[_0x89ba('0x2b')]=_[_0x89ba('0x2c')](_0xe72288,_0x89ba('0x2d'));_0x1a0046[_0x89ba('0x2e')]=_['keys'](_0x28a672[_0x89ba('0x2e')]);_0x1a0046[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x1a0046[_0x89ba('0x2b')],_0x1a0046[_0x89ba('0x2e')]);_0x3eb47e[_0x89ba('0x31')]=_[_0x89ba('0x30')](_0x1a0046[_0x89ba('0x2b')],qs['fields'](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x32')]));_0x3eb47e[_0x89ba('0x31')]=_0x3eb47e[_0x89ba('0x31')]['length']?_0x3eb47e[_0x89ba('0x31')]:_0x1a0046[_0x89ba('0x2b')];if(!_0x28a672['query'][_0x89ba('0x33')](_0x89ba('0x34'))){_0x3eb47e[_0x89ba('0x1a')]=qs[_0x89ba('0x1a')](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x1a')]);_0x3eb47e[_0x89ba('0x19')]=qs[_0x89ba('0x19')](_0x28a672[_0x89ba('0x2e')]['offset']);}_0x3eb47e[_0x89ba('0x35')]=qs[_0x89ba('0x36')](_0x28a672[_0x89ba('0x2e')][_0x89ba('0x36')]);_0x3eb47e['where']=qs[_0x89ba('0x2f')](_[_0x89ba('0x37')](_0x28a672[_0x89ba('0x2e')],_0x1a0046['filters']),_0xe72288);if(_0x28a672[_0x89ba('0x2e')][_0x89ba('0x38')]){_0x3eb47e[_0x89ba('0x39')]=_[_0x89ba('0x3a')](_0x3eb47e[_0x89ba('0x39')],{'$or':_[_0x89ba('0x2c')](_0xe72288,function(_0xc109a1){if(_0xc109a1[_0x89ba('0x29')]!==_0x89ba('0x3b')){var _0x5b3b02={};_0x5b3b02[_0xc109a1[_0x89ba('0x2d')]]={'$like':'%'+_0x28a672[_0x89ba('0x2e')]['filter']+'%'};return _0x5b3b02;}})});}_0x3eb47e=_[_0x89ba('0x3a')]({},_0x3eb47e,_0x28a672[_0x89ba('0x3c')]);var _0x2c612c={'where':_0x3eb47e[_0x89ba('0x39')]};return db[_0x89ba('0x27')][_0x89ba('0x18')](_0x2c612c)['then'](function(_0x36b815){_0x535a09[_0x89ba('0x18')]=_0x36b815;if(_0x28a672['query']['includeAll']){_0x3eb47e[_0x89ba('0x3d')]=[{'all':!![]}];}return db[_0x89ba('0x27')]['findAll'](_0x3eb47e);})[_0x89ba('0x21')](function(_0x2dc9bf){_0x535a09['rows']=_0x2dc9bf;return _0x535a09;})[_0x89ba('0x21')](respondWithFilteredResult(_0x28bbf7,_0x3eb47e))[_0x89ba('0x3e')](handleError(_0x28bbf7,null));};exports[_0x89ba('0x3f')]=function(_0x4b9184,_0x2bca95){var _0x5b3dde={'raw':![],'where':{'id':_0x4b9184['params']['id']}},_0x30b114={};_0x30b114[_0x89ba('0x2b')]=_['keys'](db['IntegrationReport'][_0x89ba('0x28')]);_0x30b114[_0x89ba('0x2e')]=_[_0x89ba('0x40')](_0x4b9184[_0x89ba('0x2e')]);_0x30b114[_0x89ba('0x2f')]=_[_0x89ba('0x30')](_0x30b114[_0x89ba('0x2b')],_0x30b114[_0x89ba('0x2e')]);_0x5b3dde['attributes']=_['intersection'](_0x30b114[_0x89ba('0x2b')],qs[_0x89ba('0x32')](_0x4b9184[_0x89ba('0x2e')]['fields']));_0x5b3dde[_0x89ba('0x31')]=_0x5b3dde['attributes']['length']?_0x5b3dde[_0x89ba('0x31')]:_0x30b114[_0x89ba('0x2b')];if(_0x4b9184[_0x89ba('0x2e')]['includeAll']){_0x5b3dde[_0x89ba('0x3d')]=[{'all':!![]}];}_0x5b3dde=_['merge']({},_0x5b3dde,_0x4b9184[_0x89ba('0x3c')]);return db[_0x89ba('0x27')][_0x89ba('0x41')](_0x5b3dde)[_0x89ba('0x21')](handleEntityNotFound(_0x2bca95,null))[_0x89ba('0x21')](respondWithResult(_0x2bca95,null))[_0x89ba('0x3e')](handleError(_0x2bca95,null));};exports['create']=function(_0x28ba61,_0x3f024b){return db[_0x89ba('0x27')][_0x89ba('0x42')](_0x28ba61[_0x89ba('0x43')],{})['then'](respondWithResult(_0x3f024b,0xc9))[_0x89ba('0x3e')](handleError(_0x3f024b,null));};exports[_0x89ba('0x20')]=function(_0x2a109e,_0x4f0e72){if(_0x2a109e[_0x89ba('0x43')]['id']){delete _0x2a109e[_0x89ba('0x43')]['id'];}return db['IntegrationReport'][_0x89ba('0x41')]({'where':{'id':_0x2a109e[_0x89ba('0x44')]['id']}})[_0x89ba('0x21')](handleEntityNotFound(_0x4f0e72,null))['then'](saveUpdates(_0x2a109e['body'],null))[_0x89ba('0x21')](respondWithResult(_0x4f0e72,null))['catch'](handleError(_0x4f0e72,null));};exports[_0x89ba('0x22')]=function(_0xb5433c,_0x3e93e4){return db[_0x89ba('0x27')][_0x89ba('0x41')]({'where':{'id':_0xb5433c['params']['id']}})['then'](handleEntityNotFound(_0x3e93e4,null))[_0x89ba('0x21')](removeEntity(_0x3e93e4,null))[_0x89ba('0x3e')](handleError(_0x3e93e4,null));};exports[_0x89ba('0x45')]=function(_0x51575e,_0x4235af){return db[_0x89ba('0x27')][_0x89ba('0x45')]()[_0x89ba('0x21')](respondWithResult(_0x4235af,null))[_0x89ba('0x3e')](handleError(_0x4235af,null));}; \ No newline at end of file +var _0x95f6=['options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','reject','save','update','then','end','error','stack','name','send','IntegrationReport','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL'];(function(_0x1dce49,_0x58d643){var _0x5164a3=function(_0x4be12a){while(--_0x4be12a){_0x1dce49['push'](_0x1dce49['shift']());}};_0x5164a3(++_0x58d643);}(_0x95f6,0x186));var _0x695f=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x95f6[_0x104e21];return _0x605b37;};'use strict';var emlformat=require(_0x695f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x695f('0x1'));var rp=require(_0x695f('0x2'));var moment=require(_0x695f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x695f('0x4'));var path=require(_0x695f('0x5'));var sox=require(_0x695f('0x6'));var csv=require(_0x695f('0x7'));var ejs=require(_0x695f('0x8'));var fs=require('fs');var fs_extra=require(_0x695f('0x9'));var _=require(_0x695f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x695f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x695f('0xc'));var Papa=require(_0x695f('0xd'));var Redis=require('ioredis');var authService=require(_0x695f('0xe'));var qs=require(_0x695f('0xf'));var as=require(_0x695f('0x10'));var hardwareService=require(_0x695f('0x11'));var logger=require(_0x695f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x695f('0x13'));var licenseUtil=require(_0x695f('0x14'));var db=require(_0x695f('0x15'))['db'];function respondWithStatusCode(_0x2a1392,_0x2f84f8){_0x2f84f8=_0x2f84f8||0xcc;return function(_0x57cc99){if(_0x57cc99){return _0x2a1392[_0x695f('0x16')](_0x2f84f8);}return _0x2a1392[_0x695f('0x17')](_0x2f84f8)['end']();};}function respondWithResult(_0x3ab35d,_0x4b25cd){_0x4b25cd=_0x4b25cd||0xc8;return function(_0x3de3be){if(_0x3de3be){return _0x3ab35d['status'](_0x4b25cd)['json'](_0x3de3be);}};}function respondWithFilteredResult(_0x379c47,_0x45ffd7){return function(_0x1ee8be){if(_0x1ee8be){var _0xc35a76=typeof _0x45ffd7[_0x695f('0x18')]==='undefined'&&typeof _0x45ffd7['limit']==='undefined';var _0x12c2e7=_0x1ee8be[_0x695f('0x19')];var _0x281e1d=_0xc35a76?0x0:_0x45ffd7[_0x695f('0x18')];var _0x14f7ab=_0xc35a76?_0x1ee8be[_0x695f('0x19')]:_0x45ffd7[_0x695f('0x18')]+_0x45ffd7[_0x695f('0x1a')];var _0x5290c6;if(_0x14f7ab>=_0x12c2e7){_0x14f7ab=_0x12c2e7;_0x5290c6=0xc8;}else{_0x5290c6=0xce;}_0x379c47['status'](_0x5290c6);return _0x379c47[_0x695f('0x1b')](_0x695f('0x1c'),_0x281e1d+'-'+_0x14f7ab+'/'+_0x12c2e7)[_0x695f('0x1d')](_0x1ee8be);}return null;};}function patchUpdates(_0x117a9e){return function(_0x37b3b4){try{jsonpatch['apply'](_0x37b3b4,_0x117a9e,!![]);}catch(_0x4ef279){return BPromise[_0x695f('0x1e')](_0x4ef279);}return _0x37b3b4[_0x695f('0x1f')]();};}function saveUpdates(_0x2adc98,_0x3c3c78){return function(_0x1032c4){if(_0x1032c4){return _0x1032c4[_0x695f('0x20')](_0x2adc98)[_0x695f('0x21')](function(_0x242ea3){return _0x242ea3;});}return null;};}function removeEntity(_0x12f6d8,_0x2d6228){return function(_0x2355fc){if(_0x2355fc){return _0x2355fc['destroy']()[_0x695f('0x21')](function(){_0x12f6d8[_0x695f('0x17')](0xcc)[_0x695f('0x22')]();});}};}function handleEntityNotFound(_0x526672,_0x574d7c){return function(_0x18c91e){if(!_0x18c91e){_0x526672[_0x695f('0x16')](0x194);}return _0x18c91e;};}function handleError(_0x3bb29a,_0x76347f){_0x76347f=_0x76347f||0x1f4;return function(_0x327cd9){logger[_0x695f('0x23')](_0x327cd9[_0x695f('0x24')]);if(_0x327cd9[_0x695f('0x25')]){delete _0x327cd9[_0x695f('0x25')];}_0x3bb29a[_0x695f('0x17')](_0x76347f)[_0x695f('0x26')](_0x327cd9);};}exports['index']=function(_0x34c35a,_0x1b3f99){var _0x155e35={},_0x7b9e6b={},_0x7940da={'count':0x0,'rows':[]};var _0x1ceb59=_['map'](db[_0x695f('0x27')]['rawAttributes'],function(_0x37fedf){return{'name':_0x37fedf[_0x695f('0x28')],'type':_0x37fedf[_0x695f('0x29')][_0x695f('0x2a')]};});_0x7b9e6b[_0x695f('0x2b')]=_[_0x695f('0x2c')](_0x1ceb59,_0x695f('0x25'));_0x7b9e6b[_0x695f('0x2d')]=_[_0x695f('0x2e')](_0x34c35a[_0x695f('0x2d')]);_0x7b9e6b[_0x695f('0x2f')]=_['intersection'](_0x7b9e6b[_0x695f('0x2b')],_0x7b9e6b[_0x695f('0x2d')]);_0x155e35[_0x695f('0x30')]=_['intersection'](_0x7b9e6b['model'],qs['fields'](_0x34c35a[_0x695f('0x2d')][_0x695f('0x31')]));_0x155e35[_0x695f('0x30')]=_0x155e35['attributes'][_0x695f('0x32')]?_0x155e35['attributes']:_0x7b9e6b[_0x695f('0x2b')];if(!_0x34c35a[_0x695f('0x2d')][_0x695f('0x33')](_0x695f('0x34'))){_0x155e35[_0x695f('0x1a')]=qs[_0x695f('0x1a')](_0x34c35a['query'][_0x695f('0x1a')]);_0x155e35[_0x695f('0x18')]=qs['offset'](_0x34c35a[_0x695f('0x2d')]['offset']);}_0x155e35[_0x695f('0x35')]=qs[_0x695f('0x36')](_0x34c35a[_0x695f('0x2d')][_0x695f('0x36')]);_0x155e35['where']=qs['filters'](_[_0x695f('0x37')](_0x34c35a[_0x695f('0x2d')],_0x7b9e6b[_0x695f('0x2f')]),_0x1ceb59);if(_0x34c35a[_0x695f('0x2d')][_0x695f('0x38')]){_0x155e35['where']=_[_0x695f('0x39')](_0x155e35[_0x695f('0x3a')],{'$or':_[_0x695f('0x2c')](_0x1ceb59,function(_0x596ded){if(_0x596ded[_0x695f('0x29')]!==_0x695f('0x3b')){var _0x45bbba={};_0x45bbba[_0x596ded[_0x695f('0x25')]]={'$like':'%'+_0x34c35a['query'][_0x695f('0x38')]+'%'};return _0x45bbba;}})});}_0x155e35=_[_0x695f('0x39')]({},_0x155e35,_0x34c35a[_0x695f('0x3c')]);var _0x2953f5={'where':_0x155e35[_0x695f('0x3a')]};return db[_0x695f('0x27')][_0x695f('0x19')](_0x2953f5)['then'](function(_0x1e7a82){_0x7940da[_0x695f('0x19')]=_0x1e7a82;if(_0x34c35a['query']['includeAll']){_0x155e35[_0x695f('0x3d')]=[{'all':!![]}];}return db[_0x695f('0x27')][_0x695f('0x3e')](_0x155e35);})[_0x695f('0x21')](function(_0x11b4a8){_0x7940da[_0x695f('0x3f')]=_0x11b4a8;return _0x7940da;})['then'](respondWithFilteredResult(_0x1b3f99,_0x155e35))[_0x695f('0x40')](handleError(_0x1b3f99,null));};exports[_0x695f('0x41')]=function(_0xf5aa9f,_0x4a855c){var _0x3e1a46={'raw':![],'where':{'id':_0xf5aa9f[_0x695f('0x42')]['id']}},_0x409df0={};_0x409df0[_0x695f('0x2b')]=_[_0x695f('0x2e')](db['IntegrationReport'][_0x695f('0x43')]);_0x409df0['query']=_[_0x695f('0x2e')](_0xf5aa9f[_0x695f('0x2d')]);_0x409df0['filters']=_[_0x695f('0x44')](_0x409df0['model'],_0x409df0[_0x695f('0x2d')]);_0x3e1a46[_0x695f('0x30')]=_[_0x695f('0x44')](_0x409df0[_0x695f('0x2b')],qs[_0x695f('0x31')](_0xf5aa9f[_0x695f('0x2d')]['fields']));_0x3e1a46[_0x695f('0x30')]=_0x3e1a46[_0x695f('0x30')]['length']?_0x3e1a46['attributes']:_0x409df0[_0x695f('0x2b')];if(_0xf5aa9f['query'][_0x695f('0x45')]){_0x3e1a46[_0x695f('0x3d')]=[{'all':!![]}];}_0x3e1a46=_['merge']({},_0x3e1a46,_0xf5aa9f[_0x695f('0x3c')]);return db[_0x695f('0x27')][_0x695f('0x46')](_0x3e1a46)[_0x695f('0x21')](handleEntityNotFound(_0x4a855c,null))[_0x695f('0x21')](respondWithResult(_0x4a855c,null))[_0x695f('0x40')](handleError(_0x4a855c,null));};exports[_0x695f('0x47')]=function(_0x40d6ec,_0x2ec4f1){return db['IntegrationReport'][_0x695f('0x47')](_0x40d6ec[_0x695f('0x48')],{})[_0x695f('0x21')](respondWithResult(_0x2ec4f1,0xc9))[_0x695f('0x40')](handleError(_0x2ec4f1,null));};exports[_0x695f('0x20')]=function(_0x32f039,_0xbdc650){if(_0x32f039[_0x695f('0x48')]['id']){delete _0x32f039['body']['id'];}return db[_0x695f('0x27')][_0x695f('0x46')]({'where':{'id':_0x32f039[_0x695f('0x42')]['id']}})['then'](handleEntityNotFound(_0xbdc650,null))[_0x695f('0x21')](saveUpdates(_0x32f039[_0x695f('0x48')],null))[_0x695f('0x21')](respondWithResult(_0xbdc650,null))[_0x695f('0x40')](handleError(_0xbdc650,null));};exports[_0x695f('0x49')]=function(_0x1515a9,_0x4201df){return db['IntegrationReport']['find']({'where':{'id':_0x1515a9[_0x695f('0x42')]['id']}})[_0x695f('0x21')](handleEntityNotFound(_0x4201df,null))[_0x695f('0x21')](removeEntity(_0x4201df,null))[_0x695f('0x40')](handleError(_0x4201df,null));};exports[_0x695f('0x4a')]=function(_0x406863,_0x2cf6e6){return db[_0x695f('0x27')][_0x695f('0x4a')]()[_0x695f('0x21')](respondWithResult(_0x2cf6e6,null))['catch'](handleError(_0x2cf6e6,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9c8e218..6831acd 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 _0x2ac7=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x15b3c3,_0x371043){var _0x4ffe85=function(_0xcba735){while(--_0xcba735){_0x15b3c3['push'](_0x15b3c3['shift']());}};_0x4ffe85(++_0x371043);}(_0x2ac7,0x12d));var _0x72ac=function(_0x388ce1,_0x40bd2a){_0x388ce1=_0x388ce1-0x0;var _0xd21ad8=_0x2ac7[_0x388ce1];return _0xd21ad8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x72ac('0x0'))(_0x72ac('0x1'));var moment=require(_0x72ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x72ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72ac('0x4'));var config=require(_0x72ac('0x5'));var attributes=require(_0x72ac('0x6'));module[_0x72ac('0x7')]=function(_0x21da8a,_0x5cc588){return _0x21da8a['define'](_0x72ac('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa912=['moment','bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api'];(function(_0x5599f5,_0x5dd190){var _0x5e44c7=function(_0x4dccb3){while(--_0x4dccb3){_0x5599f5['push'](_0x5599f5['shift']());}};_0x5e44c7(++_0x5dd190);}(_0xa912,0x71));var _0x2a91=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xa912[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x2a91('0x0'));var util=require(_0x2a91('0x1'));var logger=require(_0x2a91('0x2'))(_0x2a91('0x3'));var moment=require(_0x2a91('0x4'));var BPromise=require(_0x2a91('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a91('0x6'));var rimraf=require(_0x2a91('0x7'));var config=require(_0x2a91('0x8'));var attributes=require(_0x2a91('0x9'));module[_0x2a91('0xa')]=function(_0x36e53e,_0x4cbd6c){return _0x36e53e[_0x2a91('0xb')]('IntegrationReport',attributes,{'tableName':_0x2a91('0xc'),'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 72b679a..66ac7bd 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4eab8a,_0x124c87){var _0x49d966=function(_0x22ca75){while(--_0x22ca75){_0x4eab8a['push'](_0x4eab8a['shift']());}};_0x49d966(++_0x124c87);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _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(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d2b667d..e406837 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 _0xa2c8=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','update','delete','destroy','multer','util','path'];(function(_0x3e4e85,_0x3472c3){var _0x3102c6=function(_0xcff563){while(--_0xcff563){_0x3e4e85['push'](_0x3e4e85['shift']());}};_0x3102c6(++_0x3472c3);}(_0xa2c8,0x81));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var path=require(_0x8a2c('0x2'));var timeout=require(_0x8a2c('0x3'));var express=require('express');var router=express[_0x8a2c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8a2c('0x5'));var interaction=require(_0x8a2c('0x6'));var config=require(_0x8a2c('0x7'));var controller=require(_0x8a2c('0x8'));router[_0x8a2c('0x9')]('/',auth[_0x8a2c('0xa')](),controller['index']);router[_0x8a2c('0x9')](_0x8a2c('0xb'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0xc')]);router[_0x8a2c('0x9')](_0x8a2c('0xd'),auth[_0x8a2c('0xa')](),controller['getIntervals']);router[_0x8a2c('0xe')]('/',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0xf')]);router[_0x8a2c('0xe')](_0x8a2c('0xd'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x10')]);router['post']('/:id/sub_intervals/create_many',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x11')]);router[_0x8a2c('0x12')](_0x8a2c('0xb'),auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x13')]);router[_0x8a2c('0x14')]('/:id',auth[_0x8a2c('0xa')](),controller[_0x8a2c('0x15')]);module['exports']=router; \ No newline at end of file +var _0x52e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x477e6c,_0x54bbd6){var _0x331b9d=function(_0x4604b8){while(--_0x4604b8){_0x477e6c['push'](_0x477e6c['shift']());}};_0x331b9d(++_0x54bbd6);}(_0x52e3,0x159));var _0x352e=function(_0x2b68f4,_0x38f12b){_0x2b68f4=_0x2b68f4-0x0;var _0x332c0b=_0x52e3[_0x2b68f4];return _0x332c0b;};'use strict';var multer=require(_0x352e('0x0'));var util=require('util');var path=require(_0x352e('0x1'));var timeout=require(_0x352e('0x2'));var express=require('express');var router=express[_0x352e('0x3')]();var fs_extra=require(_0x352e('0x4'));var auth=require(_0x352e('0x5'));var interaction=require(_0x352e('0x6'));var config=require(_0x352e('0x7'));var controller=require(_0x352e('0x8'));router[_0x352e('0x9')]('/',auth[_0x352e('0xa')](),controller[_0x352e('0xb')]);router[_0x352e('0x9')](_0x352e('0xc'),auth['isAuthenticated'](),controller[_0x352e('0xd')]);router[_0x352e('0x9')](_0x352e('0xe'),auth['isAuthenticated'](),controller[_0x352e('0xf')]);router[_0x352e('0x10')]('/',auth[_0x352e('0xa')](),controller[_0x352e('0x11')]);router['post'](_0x352e('0xe'),auth[_0x352e('0xa')](),controller[_0x352e('0x12')]);router[_0x352e('0x10')](_0x352e('0x13'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x352e('0x14')](_0x352e('0xc'),auth[_0x352e('0xa')](),controller[_0x352e('0x15')]);router[_0x352e('0x16')](_0x352e('0xc'),auth[_0x352e('0xa')](),controller[_0x352e('0x17')]);module[_0x352e('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9335b79..6ef6c0a 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 _0x487b=['exports','STRING','sequelize'];(function(_0x37399f,_0x3d3291){var _0x309ed=function(_0x2ad399){while(--_0x2ad399){_0x37399f['push'](_0x37399f['shift']());}};_0x309ed(++_0x3d3291);}(_0x487b,0xc5));var _0xb487=function(_0x1ab202,_0x533c31){_0x1ab202=_0x1ab202-0x0;var _0x36a5ec=_0x487b[_0x1ab202];return _0x36a5ec;};'use strict';var Sequelize=require(_0xb487('0x0'));module[_0xb487('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb487('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3bdf=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bdf,0x1a9));var _0xf3bd=function(_0xf54624,_0x12ef28){_0xf54624=_0xf54624-0x0;var _0x10b06f=_0x3bdf[_0xf54624];return _0x10b06f;};'use strict';var Sequelize=require(_0xf3bd('0x0'));module[_0xf3bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf3bd('0x2')]},'interval':{'type':Sequelize[_0xf3bd('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f61ae5f..f4adf9d 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 _0x4d9c=['../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','map','Interval','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xfb825c,_0x54813b){var _0x5253e8=function(_0x4ef169){while(--_0x4ef169){_0xfb825c['push'](_0xfb825c['shift']());}};_0x5253e8(++_0x54813b);}(_0x4d9c,0xfc));var _0xc4d9=function(_0x2d0053,_0x1f3f53){_0x2d0053=_0x2d0053-0x0;var _0x4967cd=_0x4d9c[_0x2d0053];return _0x4967cd;};'use strict';var emlformat=require(_0xc4d9('0x0'));var rimraf=require(_0xc4d9('0x1'));var zipdir=require(_0xc4d9('0x2'));var jsonpatch=require(_0xc4d9('0x3'));var rp=require(_0xc4d9('0x4'));var moment=require(_0xc4d9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4d9('0x6'));var util=require(_0xc4d9('0x7'));var path=require(_0xc4d9('0x8'));var sox=require(_0xc4d9('0x9'));var csv=require(_0xc4d9('0xa'));var ejs=require(_0xc4d9('0xb'));var fs=require('fs');var fs_extra=require(_0xc4d9('0xc'));var _=require(_0xc4d9('0xd'));var squel=require(_0xc4d9('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc4d9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc4d9('0x10'));var Papa=require(_0xc4d9('0x11'));var Redis=require(_0xc4d9('0x12'));var authService=require(_0xc4d9('0x13'));var qs=require(_0xc4d9('0x14'));var as=require(_0xc4d9('0x15'));var hardwareService=require(_0xc4d9('0x16'));var logger=require('../../config/logger')(_0xc4d9('0x17'));var utils=require(_0xc4d9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc4d9('0x19'));var db=require(_0xc4d9('0x1a'))['db'];var extensions=require(_0xc4d9('0x1b'));function respondWithStatusCode(_0x241241,_0x3732f0){_0x3732f0=_0x3732f0||0xcc;return function(_0x5dfb18){if(_0x5dfb18){return _0x241241[_0xc4d9('0x1c')](_0x3732f0);}return _0x241241[_0xc4d9('0x1d')](_0x3732f0)[_0xc4d9('0x1e')]();};}function respondWithResult(_0x3af773,_0x586244){_0x586244=_0x586244||0xc8;return function(_0x14d251){if(_0x14d251){return _0x3af773[_0xc4d9('0x1d')](_0x586244)['json'](_0x14d251);}};}function respondWithFilteredResult(_0x84a0b2,_0x317189){return function(_0x54ccfa){if(_0x54ccfa){var _0x42369a=typeof _0x317189[_0xc4d9('0x1f')]===_0xc4d9('0x20')&&typeof _0x317189['limit']===_0xc4d9('0x20');var _0x2a5c50=_0x54ccfa[_0xc4d9('0x21')];var _0x4b6c26=_0x42369a?0x0:_0x317189[_0xc4d9('0x1f')];var _0xcdcf68=_0x42369a?_0x54ccfa['count']:_0x317189['offset']+_0x317189[_0xc4d9('0x22')];var _0x5cb775;if(_0xcdcf68>=_0x2a5c50){_0xcdcf68=_0x2a5c50;_0x5cb775=0xc8;}else{_0x5cb775=0xce;}_0x84a0b2[_0xc4d9('0x1d')](_0x5cb775);return _0x84a0b2[_0xc4d9('0x23')](_0xc4d9('0x24'),_0x4b6c26+'-'+_0xcdcf68+'/'+_0x2a5c50)[_0xc4d9('0x25')](_0x54ccfa);}return null;};}function patchUpdates(_0x2ebc69){return function(_0x218c52){try{jsonpatch[_0xc4d9('0x26')](_0x218c52,_0x2ebc69,!![]);}catch(_0x29e108){return BPromise[_0xc4d9('0x27')](_0x29e108);}return _0x218c52['save']();};}function saveUpdates(_0x3d7544,_0xbe1f89){return function(_0x35e59d){if(_0x35e59d){return _0x35e59d[_0xc4d9('0x28')](_0x3d7544)[_0xc4d9('0x29')](function(_0x358020){return _0x358020;});}return null;};}function removeEntity(_0x45f0b1,_0xf0d733){return function(_0x5ced01){if(_0x5ced01){return _0x5ced01[_0xc4d9('0x2a')]()[_0xc4d9('0x29')](function(){var _0x53f680=_0x5ced01[_0xc4d9('0x2b')]({'plain':!![]});var _0x2b393b='Intervals';return db[_0xc4d9('0x2c')][_0xc4d9('0x2a')]({'where':{'type':_0x2b393b,'resourceId':_0x53f680['id']}})[_0xc4d9('0x29')](function(){return _0x5ced01;});})['then'](function(){_0x45f0b1[_0xc4d9('0x1d')](0xcc)[_0xc4d9('0x1e')]();});}};}function handleEntityNotFound(_0x386ae5,_0x108938){return function(_0x11045c){if(!_0x11045c){_0x386ae5[_0xc4d9('0x1c')](0x194);}return _0x11045c;};}function handleError(_0x5e8336,_0x348e66){_0x348e66=_0x348e66||0x1f4;return function(_0x1eba86){logger[_0xc4d9('0x2d')](_0x1eba86[_0xc4d9('0x2e')]);if(_0x1eba86[_0xc4d9('0x2f')]){delete _0x1eba86[_0xc4d9('0x2f')];}_0x5e8336[_0xc4d9('0x1d')](_0x348e66)['send'](_0x1eba86);};}exports['index']=function(_0x521dc4,_0x291a58){var _0x165e58={},_0x369d94={},_0x385f34={'count':0x0,'rows':[]};var _0x293138=_[_0xc4d9('0x30')](db[_0xc4d9('0x31')]['rawAttributes'],function(_0x38887b){return{'name':_0x38887b[_0xc4d9('0x32')],'type':_0x38887b[_0xc4d9('0x33')][_0xc4d9('0x34')]};});_0x369d94['model']=_[_0xc4d9('0x30')](_0x293138,'name');_0x369d94[_0xc4d9('0x35')]=_[_0xc4d9('0x36')](_0x521dc4[_0xc4d9('0x35')]);_0x369d94['filters']=_[_0xc4d9('0x37')](_0x369d94[_0xc4d9('0x38')],_0x369d94['query']);_0x165e58[_0xc4d9('0x39')]=_[_0xc4d9('0x37')](_0x369d94[_0xc4d9('0x38')],qs['fields'](_0x521dc4['query'][_0xc4d9('0x3a')]));_0x165e58[_0xc4d9('0x39')]=_0x165e58['attributes'][_0xc4d9('0x3b')]?_0x165e58[_0xc4d9('0x39')]:_0x369d94[_0xc4d9('0x38')];if(!_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x3c')]('nolimit')){_0x165e58[_0xc4d9('0x22')]=qs[_0xc4d9('0x22')](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x22')]);_0x165e58[_0xc4d9('0x1f')]=qs['offset'](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x1f')]);}_0x165e58[_0xc4d9('0x3d')]=qs[_0xc4d9('0x3e')](_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x3e')]);_0x165e58[_0xc4d9('0x3f')]=qs['filters'](_[_0xc4d9('0x40')](_0x521dc4['query'],_0x369d94[_0xc4d9('0x41')]),_0x293138);if(_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x42')]){_0x165e58['where']=_[_0xc4d9('0x43')](_0x165e58[_0xc4d9('0x3f')],{'$or':_[_0xc4d9('0x30')](_0x293138,function(_0x33e64b){if(_0x33e64b[_0xc4d9('0x33')]!==_0xc4d9('0x44')){var _0x1c4be5={};_0x1c4be5[_0x33e64b[_0xc4d9('0x2f')]]={'$like':'%'+_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x42')]+'%'};return _0x1c4be5;}})});}_0x165e58=_[_0xc4d9('0x43')]({},_0x165e58,_0x521dc4[_0xc4d9('0x45')]);var _0x5f1ab6={'where':_0x165e58[_0xc4d9('0x3f')]};return db[_0xc4d9('0x31')][_0xc4d9('0x21')](_0x5f1ab6)['then'](function(_0x5128e4){_0x385f34['count']=_0x5128e4;if(_0x521dc4[_0xc4d9('0x35')][_0xc4d9('0x46')]){_0x165e58['include']=[{'all':!![]}];}return db['Interval'][_0xc4d9('0x47')](_0x165e58);})['then'](function(_0x54c651){_0x385f34[_0xc4d9('0x48')]=_0x54c651;return _0x385f34;})[_0xc4d9('0x29')](respondWithFilteredResult(_0x291a58,_0x165e58))[_0xc4d9('0x49')](handleError(_0x291a58,null));};exports[_0xc4d9('0x4a')]=function(_0x1ba62c,_0x1f8650){var _0x380560={'raw':!![],'where':{'id':_0x1ba62c[_0xc4d9('0x4b')]['id']}},_0x3e7ff8={};_0x3e7ff8[_0xc4d9('0x38')]=_[_0xc4d9('0x36')](db['Interval'][_0xc4d9('0x4c')]);_0x3e7ff8['query']=_[_0xc4d9('0x36')](_0x1ba62c['query']);_0x3e7ff8['filters']=_[_0xc4d9('0x37')](_0x3e7ff8[_0xc4d9('0x38')],_0x3e7ff8['query']);_0x380560[_0xc4d9('0x39')]=_[_0xc4d9('0x37')](_0x3e7ff8['model'],qs[_0xc4d9('0x3a')](_0x1ba62c[_0xc4d9('0x35')][_0xc4d9('0x3a')]));_0x380560[_0xc4d9('0x39')]=_0x380560[_0xc4d9('0x39')][_0xc4d9('0x3b')]?_0x380560[_0xc4d9('0x39')]:_0x3e7ff8['model'];if(_0x1ba62c[_0xc4d9('0x35')][_0xc4d9('0x46')]){_0x380560[_0xc4d9('0x4d')]=[{'all':!![]}];}_0x380560=_[_0xc4d9('0x43')]({},_0x380560,_0x1ba62c[_0xc4d9('0x45')]);return db['Interval'][_0xc4d9('0x4e')](_0x380560)[_0xc4d9('0x29')](handleEntityNotFound(_0x1f8650,null))['then'](respondWithResult(_0x1f8650,null))['catch'](handleError(_0x1f8650,null));};exports[_0xc4d9('0x4f')]=function(_0x576569,_0x2f969c){return db[_0xc4d9('0x31')][_0xc4d9('0x4f')](_0x576569[_0xc4d9('0x50')],{})['then'](function(_0x3cd186){var _0x536bbf=_0x576569[_0xc4d9('0x51')]['get']({'plain':!![]});if(!_0x536bbf)throw new Error(_0xc4d9('0x52'));if(_0x536bbf['role']===_0xc4d9('0x51')){var _0x5198df=_0x3cd186['get']({'plain':!![]});var _0x1aab27='Intervals';return db[_0xc4d9('0x53')][_0xc4d9('0x4e')]({'where':{'name':_0x1aab27,'userProfileId':_0x536bbf['userProfileId']},'raw':!![]})[_0xc4d9('0x29')](function(_0x128ac0){if(_0x128ac0&&_0x128ac0[_0xc4d9('0x54')]===0x0){return db['UserProfileResource'][_0xc4d9('0x4f')]({'name':_0x5198df[_0xc4d9('0x2f')],'resourceId':_0x5198df['id'],'type':_0x128ac0[_0xc4d9('0x2f')],'sectionId':_0x128ac0['id']},{})[_0xc4d9('0x29')](function(){return _0x3cd186;});}else{return _0x3cd186;}})[_0xc4d9('0x49')](function(_0x1bad89){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bad89);throw _0x1bad89;});}return _0x3cd186;})[_0xc4d9('0x29')](respondWithResult(_0x2f969c,0xc9))[_0xc4d9('0x49')](handleError(_0x2f969c,null));};exports[_0xc4d9('0x28')]=function(_0x49f994,_0x3ffc61){if(_0x49f994[_0xc4d9('0x50')]['id']){delete _0x49f994['body']['id'];}return db['Interval'][_0xc4d9('0x4e')]({'where':{'id':_0x49f994[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x3ffc61,null))[_0xc4d9('0x29')](saveUpdates(_0x49f994[_0xc4d9('0x50')],null))['then'](respondWithResult(_0x3ffc61,null))['catch'](handleError(_0x3ffc61,null));};exports[_0xc4d9('0x2a')]=function(_0x3ee5d7,_0x453539){return db[_0xc4d9('0x31')]['find']({'where':{'id':_0x3ee5d7['params']['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x453539,null))[_0xc4d9('0x29')](removeEntity(_0x453539,null))[_0xc4d9('0x49')](handleError(_0x453539,null));};exports['addInterval']=function(_0x2dd655,_0x91c740,_0x2f7a55){if(_0x2dd655['body']['id']){delete _0x2dd655['body']['id'];}return db[_0xc4d9('0x31')]['find']({'where':{'id':_0x2dd655[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0x91c740,null))[_0xc4d9('0x29')](function(_0x1c385e){if(_0x1c385e){_0x2dd655[_0xc4d9('0x50')][_0xc4d9('0x55')]=_0x1c385e['id'];return db[_0xc4d9('0x31')]['create'](_0x2dd655['body']);}})['then'](respondWithResult(_0x91c740,null))[_0xc4d9('0x49')](handleError(_0x91c740,null));};exports[_0xc4d9('0x56')]=function(_0x5f5a0b,_0x2d77e7,_0x2a2a27){var _0x4f8a28={};var _0x209970={};var _0xd75bd3;var _0xf04477;return db[_0xc4d9('0x31')][_0xc4d9('0x57')]({'where':{'id':_0x5f5a0b[_0xc4d9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d77e7,null))['then'](function(_0x3cf758){if(_0x3cf758){_0xd75bd3=_0x3cf758;_0x209970[_0xc4d9('0x38')]=_['keys'](db[_0xc4d9('0x31')][_0xc4d9('0x4c')]);_0x209970[_0xc4d9('0x35')]=_[_0xc4d9('0x36')](_0x5f5a0b[_0xc4d9('0x35')]);_0x209970['filters']=_['intersection'](_0x209970[_0xc4d9('0x38')],_0x209970[_0xc4d9('0x35')]);_0x4f8a28['attributes']=_[_0xc4d9('0x37')](_0x209970[_0xc4d9('0x38')],qs['fields'](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x3a')]));_0x4f8a28[_0xc4d9('0x39')]=_0x4f8a28[_0xc4d9('0x39')][_0xc4d9('0x3b')]?_0x4f8a28['attributes']:_0x209970['model'];_0x4f8a28['order']=qs[_0xc4d9('0x3e')](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x3e')]);_0x4f8a28[_0xc4d9('0x3f')]=qs[_0xc4d9('0x41')](_[_0xc4d9('0x40')](_0x5f5a0b[_0xc4d9('0x35')],_0x209970[_0xc4d9('0x41')]));if(_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x42')]){_0x4f8a28[_0xc4d9('0x3f')]=_[_0xc4d9('0x43')](_0x4f8a28[_0xc4d9('0x3f')],{'$or':_['map'](_0x4f8a28[_0xc4d9('0x39')],function(_0x219973){var _0x54f75f={};_0x54f75f[_0x219973]={'$like':'%'+_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x42')]+'%'};return _0x54f75f;})});}_0x4f8a28=_[_0xc4d9('0x43')]({},_0x4f8a28,_0x5f5a0b['options']);return _0xd75bd3[_0xc4d9('0x56')](_0x4f8a28);}})[_0xc4d9('0x29')](function(_0x2a7fa8){if(_0x2a7fa8){_0xf04477=_0x2a7fa8[_0xc4d9('0x3b')];if(!_0x5f5a0b['query'][_0xc4d9('0x3c')](_0xc4d9('0x58'))){_0x4f8a28[_0xc4d9('0x22')]=qs['limit'](_0x5f5a0b['query']['limit']);_0x4f8a28['offset']=qs[_0xc4d9('0x1f')](_0x5f5a0b[_0xc4d9('0x35')][_0xc4d9('0x1f')]);}return _0xd75bd3['getIntervals'](_0x4f8a28);}})['then'](function(_0x9e1749){if(_0x9e1749){return _0x9e1749?{'count':_0xf04477,'rows':_0x9e1749}:null;}})[_0xc4d9('0x29')](respondWithResult(_0x2d77e7,null))['catch'](handleError(_0x2d77e7,null));};exports[_0xc4d9('0x59')]=function(_0x201e18,_0xfcf5d9,_0x514422){return db[_0xc4d9('0x31')][_0xc4d9('0x57')]({'where':{'id':_0x201e18[_0xc4d9('0x4b')]['id']}})[_0xc4d9('0x29')](handleEntityNotFound(_0xfcf5d9,null))[_0xc4d9('0x29')](function(_0x2abe98){if(_0x2abe98){return db[_0xc4d9('0x5a')][_0xc4d9('0x5b')](function(_0x3fb3c5){return db[_0xc4d9('0x31')][_0xc4d9('0x2a')]({'where':{'IntervalId':_0x201e18[_0xc4d9('0x4b')]['id']},'transaction':_0x3fb3c5})[_0xc4d9('0x29')](function(_0x5399f5){var _0x46f8f1=_[_0xc4d9('0x30')](_0x201e18[_0xc4d9('0x50')],function(_0x484ab9){delete _0x484ab9['id'];_0x484ab9['IntervalId']=_0x201e18[_0xc4d9('0x4b')]['id'];return _0x484ab9;});return db[_0xc4d9('0x31')][_0xc4d9('0x5c')](_0x46f8f1,{'transaction':_0x3fb3c5});});})[_0xc4d9('0x29')](function(){return db[_0xc4d9('0x31')][_0xc4d9('0x47')]({'where':{'IntervalId':_0x201e18[_0xc4d9('0x4b')]['id']}});});}})[_0xc4d9('0x29')](respondWithResult(_0xfcf5d9,null))[_0xc4d9('0x49')](handleError(_0xfcf5d9,null));}; \ No newline at end of file +var _0x02b7=['fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','addInterval','IntervalId','getIntervals','findOne','nolimit','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2c61a2,_0x40fe37){var _0x28bf7c=function(_0x4afffe){while(--_0x4afffe){_0x2c61a2['push'](_0x2c61a2['shift']());}};_0x28bf7c(++_0x40fe37);}(_0x02b7,0x13e));var _0x702b=function(_0x151188,_0x2e00b5){_0x151188=_0x151188-0x0;var _0xf86c2b=_0x02b7[_0x151188];return _0xf86c2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x702b('0x0'));var zipdir=require(_0x702b('0x1'));var jsonpatch=require(_0x702b('0x2'));var rp=require(_0x702b('0x3'));var moment=require(_0x702b('0x4'));var BPromise=require(_0x702b('0x5'));var Mustache=require(_0x702b('0x6'));var util=require(_0x702b('0x7'));var path=require(_0x702b('0x8'));var sox=require('sox');var csv=require(_0x702b('0x9'));var ejs=require(_0x702b('0xa'));var fs=require('fs');var fs_extra=require(_0x702b('0xb'));var _=require(_0x702b('0xc'));var squel=require(_0x702b('0xd'));var crypto=require(_0x702b('0xe'));var jsforce=require(_0x702b('0xf'));var deskjs=require(_0x702b('0x10'));var toCsv=require(_0x702b('0x9'));var querystring=require(_0x702b('0x11'));var Papa=require(_0x702b('0x12'));var Redis=require(_0x702b('0x13'));var authService=require(_0x702b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x702b('0x15'));var hardwareService=require(_0x702b('0x16'));var logger=require(_0x702b('0x17'))(_0x702b('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x702b('0x19'));var db=require(_0x702b('0x1a'))['db'];var extensions=require(_0x702b('0x1b'));function respondWithStatusCode(_0x54ca3d,_0x21df0e){_0x21df0e=_0x21df0e||0xcc;return function(_0x238a5f){if(_0x238a5f){return _0x54ca3d[_0x702b('0x1c')](_0x21df0e);}return _0x54ca3d[_0x702b('0x1d')](_0x21df0e)[_0x702b('0x1e')]();};}function respondWithResult(_0x40803f,_0x4594ed){_0x4594ed=_0x4594ed||0xc8;return function(_0xa23d1c){if(_0xa23d1c){return _0x40803f[_0x702b('0x1d')](_0x4594ed)[_0x702b('0x1f')](_0xa23d1c);}};}function respondWithFilteredResult(_0x1bc1ae,_0x9bc6e4){return function(_0x37746c){if(_0x37746c){var _0x31cc47=typeof _0x9bc6e4[_0x702b('0x20')]==='undefined'&&typeof _0x9bc6e4[_0x702b('0x21')]==='undefined';var _0xe246ed=_0x37746c[_0x702b('0x22')];var _0x54accf=_0x31cc47?0x0:_0x9bc6e4[_0x702b('0x20')];var _0x11912f=_0x31cc47?_0x37746c['count']:_0x9bc6e4[_0x702b('0x20')]+_0x9bc6e4['limit'];var _0x3fe9f1;if(_0x11912f>=_0xe246ed){_0x11912f=_0xe246ed;_0x3fe9f1=0xc8;}else{_0x3fe9f1=0xce;}_0x1bc1ae['status'](_0x3fe9f1);return _0x1bc1ae[_0x702b('0x23')](_0x702b('0x24'),_0x54accf+'-'+_0x11912f+'/'+_0xe246ed)[_0x702b('0x1f')](_0x37746c);}return null;};}function patchUpdates(_0x306197){return function(_0x3b561b){try{jsonpatch[_0x702b('0x25')](_0x3b561b,_0x306197,!![]);}catch(_0x237648){return BPromise[_0x702b('0x26')](_0x237648);}return _0x3b561b[_0x702b('0x27')]();};}function saveUpdates(_0x2d4c12,_0x6a4dfd){return function(_0x2d436b){if(_0x2d436b){return _0x2d436b[_0x702b('0x28')](_0x2d4c12)['then'](function(_0x3159df){return _0x3159df;});}return null;};}function removeEntity(_0x1cc23d,_0x5bdad3){return function(_0x277747){if(_0x277747){return _0x277747[_0x702b('0x29')]()[_0x702b('0x2a')](function(){var _0x350308=_0x277747[_0x702b('0x2b')]({'plain':!![]});var _0x5c72e1=_0x702b('0x2c');return db['UserProfileResource'][_0x702b('0x29')]({'where':{'type':_0x5c72e1,'resourceId':_0x350308['id']}})['then'](function(){return _0x277747;});})['then'](function(){_0x1cc23d[_0x702b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208aff,_0x1196f5){return function(_0x18df0c){if(!_0x18df0c){_0x208aff[_0x702b('0x1c')](0x194);}return _0x18df0c;};}function handleError(_0x3451bc,_0x57e5a5){_0x57e5a5=_0x57e5a5||0x1f4;return function(_0x100f13){logger[_0x702b('0x2d')](_0x100f13[_0x702b('0x2e')]);if(_0x100f13[_0x702b('0x2f')]){delete _0x100f13[_0x702b('0x2f')];}_0x3451bc[_0x702b('0x1d')](_0x57e5a5)[_0x702b('0x30')](_0x100f13);};}exports[_0x702b('0x31')]=function(_0x5277bd,_0x31bb1f){var _0x54a6b0={},_0x5753={},_0x45e073={'count':0x0,'rows':[]};var _0x34c0a4=_[_0x702b('0x32')](db[_0x702b('0x33')][_0x702b('0x34')],function(_0x10a8b0){return{'name':_0x10a8b0[_0x702b('0x35')],'type':_0x10a8b0[_0x702b('0x36')][_0x702b('0x37')]};});_0x5753[_0x702b('0x38')]=_[_0x702b('0x32')](_0x34c0a4,'name');_0x5753[_0x702b('0x39')]=_[_0x702b('0x3a')](_0x5277bd[_0x702b('0x39')]);_0x5753[_0x702b('0x3b')]=_[_0x702b('0x3c')](_0x5753[_0x702b('0x38')],_0x5753[_0x702b('0x39')]);_0x54a6b0[_0x702b('0x3d')]=_[_0x702b('0x3c')](_0x5753[_0x702b('0x38')],qs['fields'](_0x5277bd[_0x702b('0x39')][_0x702b('0x3e')]));_0x54a6b0[_0x702b('0x3d')]=_0x54a6b0[_0x702b('0x3d')][_0x702b('0x3f')]?_0x54a6b0[_0x702b('0x3d')]:_0x5753[_0x702b('0x38')];if(!_0x5277bd['query'][_0x702b('0x40')]('nolimit')){_0x54a6b0['limit']=qs[_0x702b('0x21')](_0x5277bd[_0x702b('0x39')]['limit']);_0x54a6b0['offset']=qs['offset'](_0x5277bd[_0x702b('0x39')][_0x702b('0x20')]);}_0x54a6b0[_0x702b('0x41')]=qs[_0x702b('0x42')](_0x5277bd[_0x702b('0x39')][_0x702b('0x42')]);_0x54a6b0[_0x702b('0x43')]=qs[_0x702b('0x3b')](_[_0x702b('0x44')](_0x5277bd[_0x702b('0x39')],_0x5753[_0x702b('0x3b')]),_0x34c0a4);if(_0x5277bd[_0x702b('0x39')][_0x702b('0x45')]){_0x54a6b0['where']=_[_0x702b('0x46')](_0x54a6b0[_0x702b('0x43')],{'$or':_[_0x702b('0x32')](_0x34c0a4,function(_0x58d24d){if(_0x58d24d[_0x702b('0x36')]!==_0x702b('0x47')){var _0x3075ef={};_0x3075ef[_0x58d24d[_0x702b('0x2f')]]={'$like':'%'+_0x5277bd[_0x702b('0x39')][_0x702b('0x45')]+'%'};return _0x3075ef;}})});}_0x54a6b0=_['merge']({},_0x54a6b0,_0x5277bd[_0x702b('0x48')]);var _0x28d109={'where':_0x54a6b0[_0x702b('0x43')]};return db['Interval'][_0x702b('0x22')](_0x28d109)[_0x702b('0x2a')](function(_0x683a17){_0x45e073[_0x702b('0x22')]=_0x683a17;if(_0x5277bd[_0x702b('0x39')]['includeAll']){_0x54a6b0[_0x702b('0x49')]=[{'all':!![]}];}return db[_0x702b('0x33')][_0x702b('0x4a')](_0x54a6b0);})[_0x702b('0x2a')](function(_0x257bf5){_0x45e073['rows']=_0x257bf5;return _0x45e073;})[_0x702b('0x2a')](respondWithFilteredResult(_0x31bb1f,_0x54a6b0))[_0x702b('0x4b')](handleError(_0x31bb1f,null));};exports[_0x702b('0x4c')]=function(_0x30c8be,_0x19f898){var _0x4bf0c2={'raw':!![],'where':{'id':_0x30c8be[_0x702b('0x4d')]['id']}},_0x448096={};_0x448096[_0x702b('0x38')]=_[_0x702b('0x3a')](db[_0x702b('0x33')]['rawAttributes']);_0x448096['query']=_[_0x702b('0x3a')](_0x30c8be['query']);_0x448096[_0x702b('0x3b')]=_[_0x702b('0x3c')](_0x448096['model'],_0x448096[_0x702b('0x39')]);_0x4bf0c2[_0x702b('0x3d')]=_['intersection'](_0x448096['model'],qs[_0x702b('0x3e')](_0x30c8be[_0x702b('0x39')][_0x702b('0x3e')]));_0x4bf0c2[_0x702b('0x3d')]=_0x4bf0c2[_0x702b('0x3d')][_0x702b('0x3f')]?_0x4bf0c2['attributes']:_0x448096[_0x702b('0x38')];if(_0x30c8be['query'][_0x702b('0x4e')]){_0x4bf0c2['include']=[{'all':!![]}];}_0x4bf0c2=_[_0x702b('0x46')]({},_0x4bf0c2,_0x30c8be['options']);return db[_0x702b('0x33')][_0x702b('0x4f')](_0x4bf0c2)[_0x702b('0x2a')](handleEntityNotFound(_0x19f898,null))[_0x702b('0x2a')](respondWithResult(_0x19f898,null))[_0x702b('0x4b')](handleError(_0x19f898,null));};exports[_0x702b('0x50')]=function(_0x34d3ea,_0x1695f3){return db[_0x702b('0x33')][_0x702b('0x50')](_0x34d3ea['body'],{})[_0x702b('0x2a')](function(_0x13ed28){var _0x311aff=_0x34d3ea[_0x702b('0x51')][_0x702b('0x2b')]({'plain':!![]});if(!_0x311aff)throw new Error(_0x702b('0x52'));if(_0x311aff['role']===_0x702b('0x51')){var _0xcc1e01=_0x13ed28['get']({'plain':!![]});var _0x2c525b=_0x702b('0x2c');return db[_0x702b('0x53')]['find']({'where':{'name':_0x2c525b,'userProfileId':_0x311aff[_0x702b('0x54')]},'raw':!![]})[_0x702b('0x2a')](function(_0x154c48){if(_0x154c48&&_0x154c48[_0x702b('0x55')]===0x0){return db[_0x702b('0x56')][_0x702b('0x50')]({'name':_0xcc1e01[_0x702b('0x2f')],'resourceId':_0xcc1e01['id'],'type':_0x154c48[_0x702b('0x2f')],'sectionId':_0x154c48['id']},{})[_0x702b('0x2a')](function(){return _0x13ed28;});}else{return _0x13ed28;}})[_0x702b('0x4b')](function(_0x68c861){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x68c861);throw _0x68c861;});}return _0x13ed28;})['then'](respondWithResult(_0x1695f3,0xc9))['catch'](handleError(_0x1695f3,null));};exports[_0x702b('0x28')]=function(_0x41eba7,_0x185d69){if(_0x41eba7[_0x702b('0x57')]['id']){delete _0x41eba7[_0x702b('0x57')]['id'];}return db['Interval']['find']({'where':{'id':_0x41eba7[_0x702b('0x4d')]['id']}})[_0x702b('0x2a')](handleEntityNotFound(_0x185d69,null))[_0x702b('0x2a')](saveUpdates(_0x41eba7['body'],null))[_0x702b('0x2a')](respondWithResult(_0x185d69,null))[_0x702b('0x4b')](handleError(_0x185d69,null));};exports['destroy']=function(_0x19d355,_0x588459){return db[_0x702b('0x33')][_0x702b('0x4f')]({'where':{'id':_0x19d355[_0x702b('0x4d')]['id']}})[_0x702b('0x2a')](handleEntityNotFound(_0x588459,null))[_0x702b('0x2a')](removeEntity(_0x588459,null))[_0x702b('0x4b')](handleError(_0x588459,null));};exports[_0x702b('0x58')]=function(_0x22d637,_0x274076,_0x3db725){if(_0x22d637[_0x702b('0x57')]['id']){delete _0x22d637['body']['id'];}return db[_0x702b('0x33')][_0x702b('0x4f')]({'where':{'id':_0x22d637[_0x702b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x274076,null))['then'](function(_0x444a95){if(_0x444a95){_0x22d637[_0x702b('0x57')][_0x702b('0x59')]=_0x444a95['id'];return db[_0x702b('0x33')][_0x702b('0x50')](_0x22d637[_0x702b('0x57')]);}})['then'](respondWithResult(_0x274076,null))[_0x702b('0x4b')](handleError(_0x274076,null));};exports[_0x702b('0x5a')]=function(_0x1543d1,_0x2d1e1d,_0x1f5418){var _0x1280e8={};var _0x5eecb3={};var _0x39c723;var _0x5508b4;return db['Interval'][_0x702b('0x5b')]({'where':{'id':_0x1543d1['params']['id']}})[_0x702b('0x2a')](handleEntityNotFound(_0x2d1e1d,null))['then'](function(_0x49b90b){if(_0x49b90b){_0x39c723=_0x49b90b;_0x5eecb3[_0x702b('0x38')]=_['keys'](db[_0x702b('0x33')][_0x702b('0x34')]);_0x5eecb3[_0x702b('0x39')]=_[_0x702b('0x3a')](_0x1543d1[_0x702b('0x39')]);_0x5eecb3[_0x702b('0x3b')]=_[_0x702b('0x3c')](_0x5eecb3[_0x702b('0x38')],_0x5eecb3[_0x702b('0x39')]);_0x1280e8[_0x702b('0x3d')]=_[_0x702b('0x3c')](_0x5eecb3['model'],qs[_0x702b('0x3e')](_0x1543d1[_0x702b('0x39')][_0x702b('0x3e')]));_0x1280e8['attributes']=_0x1280e8[_0x702b('0x3d')][_0x702b('0x3f')]?_0x1280e8[_0x702b('0x3d')]:_0x5eecb3[_0x702b('0x38')];_0x1280e8[_0x702b('0x41')]=qs[_0x702b('0x42')](_0x1543d1[_0x702b('0x39')][_0x702b('0x42')]);_0x1280e8[_0x702b('0x43')]=qs[_0x702b('0x3b')](_[_0x702b('0x44')](_0x1543d1[_0x702b('0x39')],_0x5eecb3[_0x702b('0x3b')]));if(_0x1543d1[_0x702b('0x39')][_0x702b('0x45')]){_0x1280e8[_0x702b('0x43')]=_['merge'](_0x1280e8['where'],{'$or':_['map'](_0x1280e8['attributes'],function(_0x57a7a0){var _0x25aa28={};_0x25aa28[_0x57a7a0]={'$like':'%'+_0x1543d1[_0x702b('0x39')][_0x702b('0x45')]+'%'};return _0x25aa28;})});}_0x1280e8=_['merge']({},_0x1280e8,_0x1543d1[_0x702b('0x48')]);return _0x39c723[_0x702b('0x5a')](_0x1280e8);}})[_0x702b('0x2a')](function(_0xbf343){if(_0xbf343){_0x5508b4=_0xbf343['length'];if(!_0x1543d1[_0x702b('0x39')][_0x702b('0x40')](_0x702b('0x5c'))){_0x1280e8[_0x702b('0x21')]=qs[_0x702b('0x21')](_0x1543d1['query'][_0x702b('0x21')]);_0x1280e8[_0x702b('0x20')]=qs[_0x702b('0x20')](_0x1543d1['query'][_0x702b('0x20')]);}return _0x39c723[_0x702b('0x5a')](_0x1280e8);}})[_0x702b('0x2a')](function(_0x59fd55){if(_0x59fd55){return _0x59fd55?{'count':_0x5508b4,'rows':_0x59fd55}:null;}})['then'](respondWithResult(_0x2d1e1d,null))[_0x702b('0x4b')](handleError(_0x2d1e1d,null));};exports['addIntervals']=function(_0xe67a9a,_0x3e3a52,_0x184288){return db[_0x702b('0x33')][_0x702b('0x5b')]({'where':{'id':_0xe67a9a[_0x702b('0x4d')]['id']}})[_0x702b('0x2a')](handleEntityNotFound(_0x3e3a52,null))['then'](function(_0x48e759){if(_0x48e759){return db[_0x702b('0x5d')]['transaction'](function(_0x2f2576){return db['Interval'][_0x702b('0x29')]({'where':{'IntervalId':_0xe67a9a['params']['id']},'transaction':_0x2f2576})[_0x702b('0x2a')](function(_0x45ff59){var _0xd7a7ef=_['map'](_0xe67a9a[_0x702b('0x57')],function(_0x300c78){delete _0x300c78['id'];_0x300c78[_0x702b('0x59')]=_0xe67a9a[_0x702b('0x4d')]['id'];return _0x300c78;});return db['Interval'][_0x702b('0x5e')](_0xd7a7ef,{'transaction':_0x2f2576});});})[_0x702b('0x2a')](function(){return db[_0x702b('0x33')][_0x702b('0x4a')]({'where':{'IntervalId':_0xe67a9a[_0x702b('0x4d')]['id']}});});}})[_0x702b('0x2a')](respondWithResult(_0x3e3a52,null))['catch'](handleError(_0x3e3a52,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 5aef460..0c013fe 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 _0xc713=['exports','define','Interval','rewrite','interval','string','then','all','ifTime','reduce','./interval.attributes','../../utils/iftime'];(function(_0x57e033,_0x55114c){var _0x3e37e9=function(_0x3f59c2){while(--_0x3f59c2){_0x57e033['push'](_0x57e033['shift']());}};_0x3e37e9(++_0x55114c);}(_0xc713,0x6a));var _0x3c71=function(_0x519aab,_0x421210){_0x519aab=_0x519aab-0x0;var _0x4d2c36=_0xc713[_0x519aab];return _0x4d2c36;};'use strict';var attributes=require(_0x3c71('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x3c71('0x1'))['iftime'];module[_0x3c71('0x2')]=function(_0x4704d4){return _0x4704d4[_0x3c71('0x3')](_0x3c71('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c5a65){extensions[_0x3c71('0x5')](_0x4704d4,_0x1c5a65);},'afterBulkCreate':function(_0x51001a,_0x59f899,_0x44f6f3){_0x44f6f3();extensions[_0x3c71('0x5')](_0x4704d4,_0x51001a[0x0]);},'afterUpdate':function(_0x58c1ff){extensions[_0x3c71('0x5')](_0x4704d4,_0x58c1ff);},'afterDestroy':function(_0x4a668c){extensions[_0x3c71('0x5')](_0x4704d4,_0x4a668c);}},'instanceMethods':{'ifTime':function(_0x46326d=undefined,_0x3bd10f=new Date()){if(typeof this[_0x3c71('0x6')]===_0x3c71('0x7')){return iftime(this[_0x3c71('0x6')],_0x46326d,_0x3bd10f);}else{return this['getIntervals']()[_0x3c71('0x8')](function(_0x18db68){return Promise[_0x3c71('0x9')](_0x18db68['map'](function(_0x36e77c){return _0x36e77c[_0x3c71('0xa')](_0x46326d,_0x3bd10f);}));})[_0x3c71('0x8')](function(_0x27891c){return _0x27891c[_0x3c71('0xb')](function(_0x4d8abe,_0x16334a){return _0x4d8abe||_0x16334a;},![]);});}}}});}; \ No newline at end of file +var _0x471b=['all','ifTime','then','reduce','./interval.attributes','../../utils/iftime','iftime','define','Interval','rewrite','interval','string'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0x471b,0x70));var _0xb471=function(_0x7702a1,_0x4486d6){_0x7702a1=_0x7702a1-0x0;var _0x5518dc=_0x471b[_0x7702a1];return _0x5518dc;};'use strict';var attributes=require(_0xb471('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xb471('0x1'))[_0xb471('0x2')];module['exports']=function(_0x1ed63d){return _0x1ed63d[_0xb471('0x3')](_0xb471('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b45e8){extensions[_0xb471('0x5')](_0x1ed63d,_0x4b45e8);},'afterBulkCreate':function(_0x341725,_0x3062d6,_0x5c3565){_0x5c3565();extensions[_0xb471('0x5')](_0x1ed63d,_0x341725[0x0]);},'afterUpdate':function(_0x148e14){extensions[_0xb471('0x5')](_0x1ed63d,_0x148e14);},'afterDestroy':function(_0x3d0944){extensions[_0xb471('0x5')](_0x1ed63d,_0x3d0944);}},'instanceMethods':{'ifTime':function(_0x2f57ce=undefined,_0x1ddd86=new Date()){if(typeof this[_0xb471('0x6')]===_0xb471('0x7')){return iftime(this[_0xb471('0x6')],_0x2f57ce,_0x1ddd86);}else{return this['getIntervals']()['then'](function(_0x4c217d){return Promise[_0xb471('0x8')](_0x4c217d['map'](function(_0x22f1f6){return _0x22f1f6[_0xb471('0x9')](_0x2f57ce,_0x1ddd86);}));})[_0xb471('0xa')](function(_0x342b06){return _0x342b06[_0xb471('0xb')](function(_0x469a49,_0x395b9d){return _0x469a49||_0x395b9d;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index eca2642..7b523e3 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 _0xcc74=['all','reduce','format','name','join','findById','info','IntervalIftime','intervalIds','isArray','intervals','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','iftime','../../config/logger','findAll','options','raw','where','limit','include','map','model','attributes','then','GetInterval','stringify','catch','error','message','Interval','find','debug','ShowInterval'];(function(_0x441f97,_0x4d06b2){var _0x198aed=function(_0x3b222e){while(--_0x3b222e){_0x441f97['push'](_0x441f97['shift']());}};_0x198aed(++_0x4d06b2);}(_0xcc74,0xb5));var _0x4cc7=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xcc74[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x4cc7('0x0'));var util=require(_0x4cc7('0x1'));var db=require(_0x4cc7('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x4cc7('0x3')];var logger=require(_0x4cc7('0x4'))('rpc');exports['GetInterval']=function(_0x285b92){var _0x1e8f2a=this;return new Promise(function(_0x171b0d,_0x54d21c){return db['Interval'][_0x4cc7('0x5')]({'raw':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x7')]===undefined?!![]:![]:!![],'where':_0x285b92['options']?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x8')]||null:null,'attributes':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')]['attributes']||null:null,'limit':_0x285b92['options']?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0x9')]||null:null,'include':_0x285b92[_0x4cc7('0x6')]?_0x285b92[_0x4cc7('0x6')][_0x4cc7('0xa')]?_[_0x4cc7('0xb')](_0x285b92['options'][_0x4cc7('0xa')],function(_0x28bc7b){return{'model':db[_0x28bc7b[_0x4cc7('0xc')]],'as':_0x28bc7b['as'],'attributes':_0x28bc7b[_0x4cc7('0xd')],'include':_0x28bc7b[_0x4cc7('0xa')]?_['map'](_0x28bc7b[_0x4cc7('0xa')],function(_0x1ca663){return{'model':db[_0x1ca663[_0x4cc7('0xc')]],'as':_0x1ca663['as'],'attributes':_0x1ca663['attributes'],'include':_0x1ca663[_0x4cc7('0xa')]?_['map'](_0x1ca663[_0x4cc7('0xa')],function(_0x4f72ae){return{'model':db[_0x4f72ae[_0x4cc7('0xc')]],'as':_0x4f72ae['as'],'attributes':_0x4f72ae[_0x4cc7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4cc7('0xe')](function(_0x4b4105){logger['info'](_0x4cc7('0xf'),_0x285b92);logger['debug']('GetInterval',_0x285b92,JSON[_0x4cc7('0x10')](_0x4b4105));_0x171b0d(_0x4b4105);})[_0x4cc7('0x11')](function(_0x1a49e0){logger[_0x4cc7('0x12')](_0x4cc7('0xf'),_0x1a49e0[_0x4cc7('0x13')],_0x285b92);_0x54d21c(_0x1e8f2a[_0x4cc7('0x12')](0x1f4,_0x1a49e0[_0x4cc7('0x13')]));});});};exports['ShowInterval']=function(_0x45bec6){var _0x4e4546=this;return new Promise(function(_0x381627,_0x218187){return db[_0x4cc7('0x14')][_0x4cc7('0x15')]({'raw':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0x7')]===undefined?!![]:![]:!![],'where':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0x8')]||null:null,'attributes':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0xd')]||null:null,'include':_0x45bec6[_0x4cc7('0x6')]?_0x45bec6[_0x4cc7('0x6')][_0x4cc7('0xa')]?_['map'](_0x45bec6['options'][_0x4cc7('0xa')],function(_0x5b8efa){return{'model':db[_0x5b8efa[_0x4cc7('0xc')]],'as':_0x5b8efa['as'],'attributes':_0x5b8efa[_0x4cc7('0xd')],'include':_0x5b8efa[_0x4cc7('0xa')]?_['map'](_0x5b8efa[_0x4cc7('0xa')],function(_0x4f07b1){return{'model':db[_0x4f07b1[_0x4cc7('0xc')]],'as':_0x4f07b1['as'],'attributes':_0x4f07b1[_0x4cc7('0xd')],'include':_0x4f07b1[_0x4cc7('0xa')]?_['map'](_0x4f07b1['include'],function(_0xf3bbed){return{'model':db[_0xf3bbed['model']],'as':_0xf3bbed['as'],'attributes':_0xf3bbed[_0x4cc7('0xd')]};}):[]};}):[]};}):[]:[]})[_0x4cc7('0xe')](function(_0x1a1b57){logger['info']('ShowInterval',_0x45bec6);logger[_0x4cc7('0x16')](_0x4cc7('0x17'),_0x45bec6,JSON['stringify'](_0x1a1b57));_0x381627(_0x1a1b57);})[_0x4cc7('0x11')](function(_0x383adf){logger['error'](_0x4cc7('0x17'),_0x383adf[_0x4cc7('0x13')],_0x45bec6);_0x218187(_0x4e4546['error'](0x1f4,_0x383adf[_0x4cc7('0x13')]));});});};function checkArrayOfIntervals(_0x507cfb,_0x5410fe){var _0xcc6b1=[];return db['Interval'][_0x4cc7('0x5')]({'where':{'id':_0x507cfb}})[_0x4cc7('0xe')](function(_0x49b3b7){_0xcc6b1=_0x49b3b7;return Promise[_0x4cc7('0x18')](_0xcc6b1[_0x4cc7('0xb')](function(_0x952a0a){return _0x952a0a['ifTime'](_0x5410fe);}));})[_0x4cc7('0xe')](function(_0x4dd5f1){var _0x55b7e9=_0x4dd5f1[_0x4cc7('0x19')](function(_0x432a7f,_0x4069bf){return _0x432a7f||_0x4069bf;},![]);logger['info'](util[_0x4cc7('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xcc6b1[_0x4cc7('0xb')](function(_0x41a506){return _0x41a506[_0x4cc7('0x1b')];})[_0x4cc7('0x1c')](',\x20'),_0xcc6b1[_0x4cc7('0xb')](function(_0x38796d){return _0x38796d['id'];})['join'](',\x20')));return _0x55b7e9;});}function checkSingleInterval(_0xeff32c,_0x32ecd3){return db[_0x4cc7('0x14')][_0x4cc7('0x1d')](_0xeff32c)['then'](function(_0x5a0139){if(_0x5a0139){logger[_0x4cc7('0x1e')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x5a0139[_0x4cc7('0x1b')],_0x5a0139['id']));return _0x5a0139['ifTime'](_0x32ecd3);}});}exports[_0x4cc7('0x1f')]=function(_0x53cbb8){var _0xbead5c=_0x53cbb8[_0x4cc7('0x20')];var _0x48cf8b=Array[_0x4cc7('0x21')](_0x53cbb8[_0x4cc7('0x22')])?_0x53cbb8[_0x4cc7('0x22')]:typeof _0x53cbb8[_0x4cc7('0x22')]==='string'?[_0x53cbb8[_0x4cc7('0x22')]]:[];var _0x24fad6=_0x53cbb8[_0x4cc7('0x23')]||undefined;var _0x1c80d4=![];if(_0x48cf8b['length']){logger['info'](util['format'](_0x4cc7('0x24'),_0x48cf8b[_0x4cc7('0x1c')](';\x20')));}if(_0x24fad6){logger[_0x4cc7('0x1e')](util['format'](_0x4cc7('0x25'),_0x24fad6));}logger[_0x4cc7('0x16')](_0x4cc7('0x26'),_0x1c80d4);logger[_0x4cc7('0x27')](_0x4cc7('0x1f'),_0x53cbb8);return Promise[_0x4cc7('0x28')]()[_0x4cc7('0xe')](function(){if(Array['isArray'](_0xbead5c)){return checkArrayOfIntervals(_0xbead5c,_0x24fad6);}else if(_0xbead5c){return checkSingleInterval(_0xbead5c,_0x24fad6);}})['then'](function(_0xa0705a){var _0x47bc0c=_0x48cf8b[_0x4cc7('0x19')](function(_0x774350,_0x2108fd){return _0x774350||iftime(_0x2108fd,_0x24fad6);},![]);_0x1c80d4=_0xa0705a||_0x47bc0c;return _0x1c80d4;})['catch'](function(_0x51e685){logger[_0x4cc7('0x12')](_0x4cc7('0x1f'),_0x53cbb8,_0x51e685);throw this[_0x4cc7('0x12')](0x1f4,_0x51e685[_0x4cc7('0x13')]);});}; \ No newline at end of file +var _0x2a0e=['all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','../../mysqldb','../../utils/iftime','iftime','rpc','Interval','findAll','options','raw','attributes','limit','map','model','include','then','info','GetInterval','debug','stringify','catch','error','message','find','where','ShowInterval'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x2a0e,0x1c1));var _0xe2a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a0e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0xe2a0('0x0'))['db'];var iftime=require(_0xe2a0('0x1'))[_0xe2a0('0x2')];var logger=require('../../config/logger')(_0xe2a0('0x3'));exports['GetInterval']=function(_0x4f4188){var _0x1dc791=this;return new Promise(function(_0x159a70,_0x59eb0a){return db[_0xe2a0('0x4')][_0xe2a0('0x5')]({'raw':_0x4f4188['options']?_0x4f4188[_0xe2a0('0x6')][_0xe2a0('0x7')]===undefined?!![]:![]:!![],'where':_0x4f4188[_0xe2a0('0x6')]?_0x4f4188[_0xe2a0('0x6')]['where']||null:null,'attributes':_0x4f4188[_0xe2a0('0x6')]?_0x4f4188[_0xe2a0('0x6')][_0xe2a0('0x8')]||null:null,'limit':_0x4f4188['options']?_0x4f4188[_0xe2a0('0x6')][_0xe2a0('0x9')]||null:null,'include':_0x4f4188['options']?_0x4f4188[_0xe2a0('0x6')]['include']?_[_0xe2a0('0xa')](_0x4f4188[_0xe2a0('0x6')]['include'],function(_0x3caca8){return{'model':db[_0x3caca8[_0xe2a0('0xb')]],'as':_0x3caca8['as'],'attributes':_0x3caca8['attributes'],'include':_0x3caca8['include']?_['map'](_0x3caca8[_0xe2a0('0xc')],function(_0x3faf5c){return{'model':db[_0x3faf5c[_0xe2a0('0xb')]],'as':_0x3faf5c['as'],'attributes':_0x3faf5c[_0xe2a0('0x8')],'include':_0x3faf5c[_0xe2a0('0xc')]?_[_0xe2a0('0xa')](_0x3faf5c[_0xe2a0('0xc')],function(_0xe2ca32){return{'model':db[_0xe2ca32['model']],'as':_0xe2ca32['as'],'attributes':_0xe2ca32['attributes']};}):[]};}):[]};}):[]:[]})[_0xe2a0('0xd')](function(_0x5ba344){logger[_0xe2a0('0xe')](_0xe2a0('0xf'),_0x4f4188);logger[_0xe2a0('0x10')]('GetInterval',_0x4f4188,JSON[_0xe2a0('0x11')](_0x5ba344));_0x159a70(_0x5ba344);})[_0xe2a0('0x12')](function(_0x24a743){logger['error'](_0xe2a0('0xf'),_0x24a743['message'],_0x4f4188);_0x59eb0a(_0x1dc791[_0xe2a0('0x13')](0x1f4,_0x24a743[_0xe2a0('0x14')]));});});};exports['ShowInterval']=function(_0x11ceac){var _0x319a4b=this;return new Promise(function(_0x5077e9,_0x5c1173){return db['Interval'][_0xe2a0('0x15')]({'raw':_0x11ceac[_0xe2a0('0x6')]?_0x11ceac[_0xe2a0('0x6')][_0xe2a0('0x7')]===undefined?!![]:![]:!![],'where':_0x11ceac[_0xe2a0('0x6')]?_0x11ceac[_0xe2a0('0x6')][_0xe2a0('0x16')]||null:null,'attributes':_0x11ceac[_0xe2a0('0x6')]?_0x11ceac['options'][_0xe2a0('0x8')]||null:null,'include':_0x11ceac['options']?_0x11ceac['options'][_0xe2a0('0xc')]?_[_0xe2a0('0xa')](_0x11ceac[_0xe2a0('0x6')][_0xe2a0('0xc')],function(_0x2220ec){return{'model':db[_0x2220ec[_0xe2a0('0xb')]],'as':_0x2220ec['as'],'attributes':_0x2220ec[_0xe2a0('0x8')],'include':_0x2220ec['include']?_[_0xe2a0('0xa')](_0x2220ec['include'],function(_0x474076){return{'model':db[_0x474076[_0xe2a0('0xb')]],'as':_0x474076['as'],'attributes':_0x474076['attributes'],'include':_0x474076['include']?_[_0xe2a0('0xa')](_0x474076[_0xe2a0('0xc')],function(_0x68818e){return{'model':db[_0x68818e[_0xe2a0('0xb')]],'as':_0x68818e['as'],'attributes':_0x68818e[_0xe2a0('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32ef22){logger[_0xe2a0('0xe')](_0xe2a0('0x17'),_0x11ceac);logger['debug'](_0xe2a0('0x17'),_0x11ceac,JSON['stringify'](_0x32ef22));_0x5077e9(_0x32ef22);})[_0xe2a0('0x12')](function(_0x262fdf){logger[_0xe2a0('0x13')](_0xe2a0('0x17'),_0x262fdf['message'],_0x11ceac);_0x5c1173(_0x319a4b[_0xe2a0('0x13')](0x1f4,_0x262fdf[_0xe2a0('0x14')]));});});};function checkArrayOfIntervals(_0x203d49,_0x677b47){var _0x32dbf0=[];return db['Interval'][_0xe2a0('0x5')]({'where':{'id':_0x203d49}})[_0xe2a0('0xd')](function(_0x3b496e){_0x32dbf0=_0x3b496e;return Promise[_0xe2a0('0x18')](_0x32dbf0[_0xe2a0('0xa')](function(_0x246290){return _0x246290[_0xe2a0('0x19')](_0x677b47);}));})['then'](function(_0x1d9bac){var _0x49348=_0x1d9bac['reduce'](function(_0x56ef6d,_0x71b4c1){return _0x56ef6d||_0x71b4c1;},![]);logger['info'](util[_0xe2a0('0x1a')](_0xe2a0('0x1b'),_0x32dbf0[_0xe2a0('0xa')](function(_0x4a2188){return _0x4a2188[_0xe2a0('0x1c')];})[_0xe2a0('0x1d')](',\x20'),_0x32dbf0[_0xe2a0('0xa')](function(_0x4161cf){return _0x4161cf['id'];})[_0xe2a0('0x1d')](',\x20')));return _0x49348;});}function checkSingleInterval(_0x2739d2,_0x112faf){return db['Interval'][_0xe2a0('0x1e')](_0x2739d2)['then'](function(_0x53c499){if(_0x53c499){logger[_0xe2a0('0xe')](util['format'](_0xe2a0('0x1f'),_0x53c499[_0xe2a0('0x1c')],_0x53c499['id']));return _0x53c499[_0xe2a0('0x19')](_0x112faf);}});}exports[_0xe2a0('0x20')]=function(_0x220ec0){var _0x40c948=_0x220ec0[_0xe2a0('0x21')];var _0x11ec89=Array[_0xe2a0('0x22')](_0x220ec0[_0xe2a0('0x23')])?_0x220ec0[_0xe2a0('0x23')]:typeof _0x220ec0[_0xe2a0('0x23')]===_0xe2a0('0x24')?[_0x220ec0[_0xe2a0('0x23')]]:[];var _0x5a4bc8=_0x220ec0[_0xe2a0('0x25')]||undefined;var _0x1e8ad7=![];if(_0x11ec89[_0xe2a0('0x26')]){logger[_0xe2a0('0xe')](util[_0xe2a0('0x1a')](_0xe2a0('0x27'),_0x11ec89[_0xe2a0('0x1d')](';\x20')));}if(_0x5a4bc8){logger[_0xe2a0('0xe')](util[_0xe2a0('0x1a')](_0xe2a0('0x28'),_0x5a4bc8));}logger[_0xe2a0('0x10')](_0xe2a0('0x29'),_0x1e8ad7);logger['silly'](_0xe2a0('0x20'),_0x220ec0);return Promise[_0xe2a0('0x2a')]()['then'](function(){if(Array[_0xe2a0('0x22')](_0x40c948)){return checkArrayOfIntervals(_0x40c948,_0x5a4bc8);}else if(_0x40c948){return checkSingleInterval(_0x40c948,_0x5a4bc8);}})[_0xe2a0('0xd')](function(_0x8ec82c){var _0x47a4fb=_0x11ec89['reduce'](function(_0x27159f,_0xe9518){return _0x27159f||iftime(_0xe9518,_0x5a4bc8);},![]);_0x1e8ad7=_0x8ec82c||_0x47a4fb;return _0x1e8ad7;})[_0xe2a0('0x12')](function(_0x1e22e6){logger[_0xe2a0('0x13')](_0xe2a0('0x20'),_0x220ec0,_0x1e22e6);throw this[_0xe2a0('0x13')](0x1f4,_0x1e22e6[_0xe2a0('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 51e73cc..746d3d7 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(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x0b0e[_0x476c7];return _0x47ae56;};'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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x14c9a9,_0x216eee){var _0x39094f=function(_0x1386b9){while(--_0x1386b9){_0x14c9a9['push'](_0x14c9a9['shift']());}};_0x39094f(++_0x216eee);}(_0x2ef3,0xba));var _0x32ef=function(_0x8c84af,_0x3953e7){_0x8c84af=_0x8c84af-0x0;var _0x44c5e8=_0x2ef3[_0x8c84af];return _0x44c5e8;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a941670..ae45e56 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 _0xaf93=['oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','support','3eAmWpBVP0','MOTGUI','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x3f620b,_0x5ac7e8){var _0x1eb195=function(_0x4b147c){while(--_0x4b147c){_0x3f620b['push'](_0x3f620b['shift']());}};_0x1eb195(++_0x5ac7e8);}(_0xaf93,0x1aa));var _0x3af9=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xaf93[_0x1ca29f];return _0x576c3b;};'use strict';var BPromise=require(_0x3af9('0x0'));var https=require('https');var logger=require(_0x3af9('0x1'))('api');var USERNAME=_0x3af9('0x2');var PASSWORD=_0x3af9('0x3');function openIssue(_0x17dfe5,_0x58b1ba){var _0x563888={'fields':{'project':{'key':_0x17dfe5['key']||_0x3af9('0x4')},'summary':(_0x17dfe5['summary']||_0x3af9('0x5'))+_0x3af9('0x6')+_0x17dfe5['ip'],'description':_0x17dfe5[_0x3af9('0x7')]||JSON[_0x3af9('0x8')](_0x17dfe5),'issuetype':{'name':_0x17dfe5['issuetype']||_0x3af9('0x9')}}};_0x563888[_0x3af9('0xa')][_0x3af9('0xb')]=_0x17dfe5[_0x3af9('0xc')];_0x563888[_0x3af9('0xa')][_0x3af9('0xd')]=_0x17dfe5[_0x3af9('0xe')];_0x563888[_0x3af9('0xa')][_0x3af9('0xf')]=_0x17dfe5[_0x3af9('0x10')];_0x563888[_0x3af9('0xa')][_0x3af9('0x11')]=_0x17dfe5['name'];_0x563888[_0x3af9('0xa')][_0x3af9('0x12')]=_0x17dfe5[_0x3af9('0x13')];_0x563888['fields'][_0x3af9('0x14')]=_0x17dfe5['ip'];var _0x2fa263={'host':_0x3af9('0x15'),'port':0x1bb,'path':_0x3af9('0x16'),'method':_0x3af9('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x3af9('0x18'),'Authorization':_0x3af9('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x3af9('0x1a')](_0x3af9('0x1b'))}};var _0x234632=JSON['stringify'](_0x563888);var _0x1f86d9=https[_0x3af9('0x1c')](_0x2fa263,function(_0x314963){_0x314963[_0x3af9('0x1d')](_0x3af9('0x1e'));var _0x1387f2='';_0x314963['on'](_0x3af9('0x1f'),function(_0x6261ca){_0x1387f2+=_0x6261ca;});_0x314963['on'](_0x3af9('0x20'),function(){if(_0x58b1ba){return _0x58b1ba[_0x3af9('0x21')](_0x314963['statusCode'])[_0x3af9('0x22')](JSON[_0x3af9('0x23')](_0x1387f2));}});});_0x1f86d9['on'](_0x3af9('0x24'),function(_0x46b128){if(_0x58b1ba){return _0x58b1ba[_0x3af9('0x21')](0x1f4)[_0x3af9('0x22')]({'errors':[{'message':_0x3af9('0x25'),'type':_0x3af9('0x26')}]});}});_0x1f86d9['write'](_0x234632);_0x1f86d9[_0x3af9('0x20')]();}exports['openIssue']=openIssue;exports['send']=function(_0x32e0fe,_0x1ab822){_0x32e0fe[_0x3af9('0x27')]['ip']=_0x32e0fe[_0x3af9('0x28')]['x-forwarded-for']||_0x32e0fe[_0x3af9('0x29')][_0x3af9('0x2a')]||_0x32e0fe[_0x3af9('0x2b')][_0x3af9('0x2a')]||_0x32e0fe[_0x3af9('0x29')][_0x3af9('0x2b')][_0x3af9('0x2a')];return openIssue(_0x32e0fe['body'],_0x1ab822);}; \ No newline at end of file +var _0xef69=['customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','request','setEncoding','utf8','data','end','status','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','oldToken','newToken'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef69,0x114));var _0x9ef6=function(_0x4ba112,_0x25021c){_0x4ba112=_0x4ba112-0x0;var _0x7edcb9=_0xef69[_0x4ba112];return _0x7edcb9;};'use strict';var BPromise=require(_0x9ef6('0x0'));var https=require(_0x9ef6('0x1'));var logger=require(_0x9ef6('0x2'))('api');var USERNAME=_0x9ef6('0x3');var PASSWORD=_0x9ef6('0x4');function openIssue(_0x2c9cf4,_0x4959dc){var _0x3e6f5a={'fields':{'project':{'key':_0x2c9cf4[_0x9ef6('0x5')]||_0x9ef6('0x6')},'summary':(_0x2c9cf4[_0x9ef6('0x7')]||_0x9ef6('0x8'))+_0x9ef6('0x9')+_0x2c9cf4['ip'],'description':_0x2c9cf4[_0x9ef6('0xa')]||JSON[_0x9ef6('0xb')](_0x2c9cf4),'issuetype':{'name':_0x2c9cf4[_0x9ef6('0xc')]||_0x9ef6('0xd')}}};_0x3e6f5a[_0x9ef6('0xe')]['customfield_11500']=_0x2c9cf4[_0x9ef6('0xf')];_0x3e6f5a['fields']['customfield_11501']=_0x2c9cf4[_0x9ef6('0x10')];_0x3e6f5a[_0x9ef6('0xe')]['customfield_11502']=_0x2c9cf4[_0x9ef6('0x11')];_0x3e6f5a[_0x9ef6('0xe')][_0x9ef6('0x12')]=_0x2c9cf4[_0x9ef6('0x13')];_0x3e6f5a[_0x9ef6('0xe')]['customfield_11504']=_0x2c9cf4[_0x9ef6('0x14')];_0x3e6f5a['fields'][_0x9ef6('0x15')]=_0x2c9cf4['ip'];var _0x13cbbf={'host':_0x9ef6('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x9ef6('0x17'),'Authorization':_0x9ef6('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x9ef6('0x19')]('base64')}};var _0x1688f7=JSON[_0x9ef6('0xb')](_0x3e6f5a);var _0x109b22=https[_0x9ef6('0x1a')](_0x13cbbf,function(_0x52c927){_0x52c927[_0x9ef6('0x1b')](_0x9ef6('0x1c'));var _0x173302='';_0x52c927['on'](_0x9ef6('0x1d'),function(_0x93b91e){_0x173302+=_0x93b91e;});_0x52c927['on'](_0x9ef6('0x1e'),function(){if(_0x4959dc){return _0x4959dc[_0x9ef6('0x1f')](_0x52c927['statusCode'])[_0x9ef6('0x20')](JSON[_0x9ef6('0x21')](_0x173302));}});});_0x109b22['on']('error',function(_0x2e6eea){if(_0x4959dc){return _0x4959dc[_0x9ef6('0x1f')](0x1f4)['json']({'errors':[{'message':_0x9ef6('0x22'),'type':'api.jira'}]});}});_0x109b22[_0x9ef6('0x23')](_0x1688f7);_0x109b22[_0x9ef6('0x1e')]();}exports['openIssue']=openIssue;exports[_0x9ef6('0x24')]=function(_0x4daa46,_0x323a8c){_0x4daa46[_0x9ef6('0x25')]['ip']=_0x4daa46['headers'][_0x9ef6('0x26')]||_0x4daa46[_0x9ef6('0x27')][_0x9ef6('0x28')]||_0x4daa46[_0x9ef6('0x29')][_0x9ef6('0x28')]||_0x4daa46[_0x9ef6('0x27')]['socket'][_0x9ef6('0x28')];return openIssue(_0x4daa46['body'],_0x323a8c);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2ec1753..dfd4362 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 _0xee5b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x2fb2af,_0x150ee4){var _0x34899e=function(_0x4299e2){while(--_0x4299e2){_0x2fb2af['push'](_0x2fb2af['shift']());}};_0x34899e(++_0x150ee4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4afcdf,_0x34ef78){_0x4afcdf=_0x4afcdf-0x0;var _0x377dc0=_0xee5b[_0x4afcdf];return _0x377dc0;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0xb')]('/',auth[_0xbee5('0x8')](),controller['create']);router[_0xbee5('0xc')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0xe')]);router[_0xbee5('0xf')](_0xbee5('0xd'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x10')]);module[_0xbee5('0x11')]=router; \ No newline at end of file +var _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x15de3e,_0x547192){var _0x127d87=function(_0x25d999){while(--_0x25d999){_0x15de3e['push'](_0x15de3e['shift']());}};_0x127d87(++_0x547192);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4d376d,_0x303592){_0x4d376d=_0x4d376d-0x0;var _0x434aeb=_0x6f0d[_0x4d376d];return _0x434aeb;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e09c553..cde4b56 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0x566181,_0x593f8f){_0x566181=_0x566181-0x0;var _0x50525f=_0x7a54[_0x566181];return _0x50525f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x32d6b2,_0xa94486){_0x32d6b2=_0x32d6b2-0x0;var _0x1cbbc5=_0x7a54[_0x32d6b2];return _0x1cbbc5;};'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 f966d86..fb34a7b 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 _0x379e=['key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','JscriptyAnswerReport','rows','show','find','create','body','update','catch','params','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x379e,0x104));var _0xe379=function(_0x506857,_0x1d065e){_0x506857=_0x506857-0x0;var _0x122e94=_0x379e[_0x506857];return _0x122e94;};'use strict';var emlformat=require(_0xe379('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe379('0x1'));var moment=require(_0xe379('0x2'));var BPromise=require(_0xe379('0x3'));var Mustache=require(_0xe379('0x4'));var util=require(_0xe379('0x5'));var path=require(_0xe379('0x6'));var sox=require(_0xe379('0x7'));var csv=require('to-csv');var ejs=require(_0xe379('0x8'));var fs=require('fs');var fs_extra=require(_0xe379('0x9'));var _=require(_0xe379('0xa'));var squel=require(_0xe379('0xb'));var crypto=require(_0xe379('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe379('0xd'));var toCsv=require(_0xe379('0xe'));var querystring=require(_0xe379('0xf'));var Papa=require(_0xe379('0x10'));var Redis=require(_0xe379('0x11'));var authService=require(_0xe379('0x12'));var qs=require(_0xe379('0x13'));var as=require(_0xe379('0x14'));var hardwareService=require(_0xe379('0x15'));var logger=require('../../config/logger')(_0xe379('0x16'));var utils=require(_0xe379('0x17'));var config=require(_0xe379('0x18'));var licenseUtil=require(_0xe379('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6562,_0x2642a8){_0x2642a8=_0x2642a8||0xcc;return function(_0x45cf1a){if(_0x45cf1a){return _0x4c6562[_0xe379('0x1a')](_0x2642a8);}return _0x4c6562[_0xe379('0x1b')](_0x2642a8)[_0xe379('0x1c')]();};}function respondWithResult(_0x1ee8e0,_0x2a5b60){_0x2a5b60=_0x2a5b60||0xc8;return function(_0x70d82){if(_0x70d82){return _0x1ee8e0['status'](_0x2a5b60)[_0xe379('0x1d')](_0x70d82);}};}function respondWithFilteredResult(_0xab59c7,_0x20eaaf){return function(_0x105d7f){if(_0x105d7f){var _0x3d9351=typeof _0x20eaaf[_0xe379('0x1e')]==='undefined'&&typeof _0x20eaaf[_0xe379('0x1f')]==='undefined';var _0x2c2bd9=_0x105d7f['count'];var _0x150d92=_0x3d9351?0x0:_0x20eaaf[_0xe379('0x1e')];var _0xe4f3d1=_0x3d9351?_0x105d7f[_0xe379('0x20')]:_0x20eaaf['offset']+_0x20eaaf[_0xe379('0x1f')];var _0x260b2e;if(_0xe4f3d1>=_0x2c2bd9){_0xe4f3d1=_0x2c2bd9;_0x260b2e=0xc8;}else{_0x260b2e=0xce;}_0xab59c7[_0xe379('0x1b')](_0x260b2e);return _0xab59c7[_0xe379('0x21')](_0xe379('0x22'),_0x150d92+'-'+_0xe4f3d1+'/'+_0x2c2bd9)['json'](_0x105d7f);}return null;};}function patchUpdates(_0x2c749e){return function(_0x3a8d17){try{jsonpatch['apply'](_0x3a8d17,_0x2c749e,!![]);}catch(_0x39ec4d){return BPromise[_0xe379('0x23')](_0x39ec4d);}return _0x3a8d17[_0xe379('0x24')]();};}function saveUpdates(_0x2e946f,_0x32f43e){return function(_0x10b3c3){if(_0x10b3c3){return _0x10b3c3['update'](_0x2e946f)[_0xe379('0x25')](function(_0x32e16e){return _0x32e16e;});}return null;};}function removeEntity(_0x21e31b,_0x48b543){return function(_0x38236b){if(_0x38236b){return _0x38236b[_0xe379('0x26')]()['then'](function(){_0x21e31b[_0xe379('0x1b')](0xcc)[_0xe379('0x1c')]();});}};}function handleEntityNotFound(_0x4da256,_0x544bf3){return function(_0x22f596){if(!_0x22f596){_0x4da256[_0xe379('0x1a')](0x194);}return _0x22f596;};}function handleError(_0x26ba82,_0x4aa041){_0x4aa041=_0x4aa041||0x1f4;return function(_0x17ba51){logger[_0xe379('0x27')](_0x17ba51[_0xe379('0x28')]);if(_0x17ba51[_0xe379('0x29')]){delete _0x17ba51['name'];}_0x26ba82[_0xe379('0x1b')](_0x4aa041)[_0xe379('0x2a')](_0x17ba51);};}exports[_0xe379('0x2b')]=function(_0x50b0aa,_0x33037d){var _0x120239={},_0x5d9ca1={},_0x24c85d={'count':0x0,'rows':[]};var _0x528a44=_[_0xe379('0x2c')](db['JscriptyAnswerReport'][_0xe379('0x2d')],function(_0x214a0c){return{'name':_0x214a0c[_0xe379('0x2e')],'type':_0x214a0c[_0xe379('0x2f')][_0xe379('0x30')]};});_0x5d9ca1[_0xe379('0x31')]=_[_0xe379('0x2c')](_0x528a44,'name');_0x5d9ca1[_0xe379('0x32')]=_[_0xe379('0x33')](_0x50b0aa[_0xe379('0x32')]);_0x5d9ca1['filters']=_[_0xe379('0x34')](_0x5d9ca1['model'],_0x5d9ca1['query']);_0x120239[_0xe379('0x35')]=_[_0xe379('0x34')](_0x5d9ca1[_0xe379('0x31')],qs[_0xe379('0x36')](_0x50b0aa['query'][_0xe379('0x36')]));_0x120239[_0xe379('0x35')]=_0x120239['attributes'][_0xe379('0x37')]?_0x120239[_0xe379('0x35')]:_0x5d9ca1[_0xe379('0x31')];if(!_0x50b0aa[_0xe379('0x32')]['hasOwnProperty'](_0xe379('0x38'))){_0x120239['limit']=qs[_0xe379('0x1f')](_0x50b0aa[_0xe379('0x32')][_0xe379('0x1f')]);_0x120239[_0xe379('0x1e')]=qs[_0xe379('0x1e')](_0x50b0aa['query'][_0xe379('0x1e')]);}_0x120239['order']=qs[_0xe379('0x39')](_0x50b0aa[_0xe379('0x32')][_0xe379('0x39')]);_0x120239['where']=qs[_0xe379('0x3a')](_[_0xe379('0x3b')](_0x50b0aa[_0xe379('0x32')],_0x5d9ca1[_0xe379('0x3a')]),_0x528a44);if(_0x50b0aa['query'][_0xe379('0x3c')]){_0x120239['where']=_[_0xe379('0x3d')](_0x120239[_0xe379('0x3e')],{'$or':_[_0xe379('0x2c')](_0x528a44,function(_0x12e67e){if(_0x12e67e[_0xe379('0x2f')]!==_0xe379('0x3f')){var _0x56ebb7={};_0x56ebb7[_0x12e67e[_0xe379('0x29')]]={'$like':'%'+_0x50b0aa['query'][_0xe379('0x3c')]+'%'};return _0x56ebb7;}})});}_0x120239=_[_0xe379('0x3d')]({},_0x120239,_0x50b0aa[_0xe379('0x40')]);var _0x2e3eef={'where':_0x120239[_0xe379('0x3e')]};return db['JscriptyAnswerReport'][_0xe379('0x20')](_0x2e3eef)[_0xe379('0x25')](function(_0x59ba54){_0x24c85d['count']=_0x59ba54;if(_0x50b0aa['query'][_0xe379('0x41')]){_0x120239[_0xe379('0x42')]=[{'all':!![]}];}return db[_0xe379('0x43')]['findAll'](_0x120239);})[_0xe379('0x25')](function(_0x3089df){_0x24c85d[_0xe379('0x44')]=_0x3089df;return _0x24c85d;})[_0xe379('0x25')](respondWithFilteredResult(_0x33037d,_0x120239))['catch'](handleError(_0x33037d,null));};exports[_0xe379('0x45')]=function(_0x36ce8e,_0x3c6f5d){var _0x32ecbe={'raw':!![],'where':{'id':_0x36ce8e['params']['id']}},_0x48f0cc={};_0x48f0cc[_0xe379('0x31')]=_[_0xe379('0x33')](db[_0xe379('0x43')][_0xe379('0x2d')]);_0x48f0cc[_0xe379('0x32')]=_[_0xe379('0x33')](_0x36ce8e['query']);_0x48f0cc[_0xe379('0x3a')]=_['intersection'](_0x48f0cc[_0xe379('0x31')],_0x48f0cc[_0xe379('0x32')]);_0x32ecbe[_0xe379('0x35')]=_[_0xe379('0x34')](_0x48f0cc[_0xe379('0x31')],qs[_0xe379('0x36')](_0x36ce8e[_0xe379('0x32')][_0xe379('0x36')]));_0x32ecbe[_0xe379('0x35')]=_0x32ecbe[_0xe379('0x35')][_0xe379('0x37')]?_0x32ecbe[_0xe379('0x35')]:_0x48f0cc[_0xe379('0x31')];if(_0x36ce8e[_0xe379('0x32')][_0xe379('0x41')]){_0x32ecbe[_0xe379('0x42')]=[{'all':!![]}];}_0x32ecbe=_[_0xe379('0x3d')]({},_0x32ecbe,_0x36ce8e[_0xe379('0x40')]);return db[_0xe379('0x43')][_0xe379('0x46')](_0x32ecbe)[_0xe379('0x25')](handleEntityNotFound(_0x3c6f5d,null))[_0xe379('0x25')](respondWithResult(_0x3c6f5d,null))['catch'](handleError(_0x3c6f5d,null));};exports[_0xe379('0x47')]=function(_0x266bfe,_0x42a378){return db[_0xe379('0x43')][_0xe379('0x47')](_0x266bfe[_0xe379('0x48')],{})['then'](respondWithResult(_0x42a378,0xc9))['catch'](handleError(_0x42a378,null));};exports[_0xe379('0x49')]=function(_0x5db39f,_0x55b27b){if(_0x5db39f[_0xe379('0x48')]['id']){delete _0x5db39f[_0xe379('0x48')]['id'];}return db[_0xe379('0x43')][_0xe379('0x46')]({'where':{'id':_0x5db39f['params']['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x55b27b,null))[_0xe379('0x25')](saveUpdates(_0x5db39f['body'],null))[_0xe379('0x25')](respondWithResult(_0x55b27b,null))[_0xe379('0x4a')](handleError(_0x55b27b,null));};exports['destroy']=function(_0x4ac3eb,_0x3af1be){return db[_0xe379('0x43')]['find']({'where':{'id':_0x4ac3eb[_0xe379('0x4b')]['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x3af1be,null))[_0xe379('0x25')](removeEntity(_0x3af1be,null))[_0xe379('0x4a')](handleError(_0x3af1be,null));};exports[_0xe379('0x4c')]=function(_0x4a9c86,_0x337775){return db['JscriptyAnswerReport']['describe']()[_0xe379('0x25')](respondWithResult(_0x337775,null))[_0xe379('0x4a')](handleError(_0x337775,null));}; \ No newline at end of file +var _0xc474=['fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes'];(function(_0x3efda9,_0x50177c){var _0xe1b09=function(_0x1c543a){while(--_0x1c543a){_0x3efda9['push'](_0x3efda9['shift']());}};_0xe1b09(++_0x50177c);}(_0xc474,0xfc));var _0x4c47=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xc474[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require(_0x4c47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c47('0x3'));var moment=require(_0x4c47('0x4'));var BPromise=require(_0x4c47('0x5'));var Mustache=require(_0x4c47('0x6'));var util=require(_0x4c47('0x7'));var path=require(_0x4c47('0x8'));var sox=require(_0x4c47('0x9'));var csv=require(_0x4c47('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=typeof _0x78f26b['offset']==='undefined'&&typeof _0x78f26b['limit']===_0x4c47('0x1b');var _0x92a444=_0x16c7a9[_0x4c47('0x1c')];var _0x5727cf=_0xd162cc?0x0:_0x78f26b[_0x4c47('0x1d')];var _0x254dfc=_0xd162cc?_0x16c7a9[_0x4c47('0x1c')]:_0x78f26b[_0x4c47('0x1d')]+_0x78f26b['limit'];var _0x4cc984;if(_0x254dfc>=_0x92a444){_0x254dfc=_0x92a444;_0x4cc984=0xc8;}else{_0x4cc984=0xce;}_0xb53c24['status'](_0x4cc984);return _0xb53c24[_0x4c47('0x1e')](_0x4c47('0x1f'),_0x5727cf+'-'+_0x254dfc+'/'+_0x92a444)[_0x4c47('0x20')](_0x16c7a9);}return null;};}function patchUpdates(_0x3b156f){return function(_0x52de60){try{jsonpatch[_0x4c47('0x21')](_0x52de60,_0x3b156f,!![]);}catch(_0x27b61a){return BPromise[_0x4c47('0x22')](_0x27b61a);}return _0x52de60[_0x4c47('0x23')]();};}function saveUpdates(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['update'](_0x20950c)['then'](function(_0x1a575a){return _0x1a575a;});}return null;};}function removeEntity(_0x275a10,_0x4d110d){return function(_0x3037a2){if(_0x3037a2){return _0x3037a2['destroy']()[_0x4c47('0x24')](function(){_0x275a10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592469,_0x3bacc9){return function(_0x3bd199){if(!_0x3bd199){_0x592469[_0x4c47('0x25')](0x194);}return _0x3bd199;};}function handleError(_0x4eff26,_0x33f440){_0x33f440=_0x33f440||0x1f4;return function(_0x2c0367){logger[_0x4c47('0x26')](_0x2c0367[_0x4c47('0x27')]);if(_0x2c0367[_0x4c47('0x28')]){delete _0x2c0367[_0x4c47('0x28')];}_0x4eff26[_0x4c47('0x1a')](_0x33f440)[_0x4c47('0x29')](_0x2c0367);};}exports['index']=function(_0x36e82b,_0x344a7d){var _0x590b56={},_0x491638={},_0x3b977d={'count':0x0,'rows':[]};var _0x56c130=_['map'](db[_0x4c47('0x2a')][_0x4c47('0x2b')],function(_0x12462a){return{'name':_0x12462a[_0x4c47('0x2c')],'type':_0x12462a[_0x4c47('0x2d')]['key']};});_0x491638[_0x4c47('0x2e')]=_['map'](_0x56c130,_0x4c47('0x28'));_0x491638[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x36e82b['query']);_0x491638['filters']=_['intersection'](_0x491638['model'],_0x491638[_0x4c47('0x2f')]);_0x590b56[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x491638['model'],qs[_0x4c47('0x33')](_0x36e82b['query'][_0x4c47('0x33')]));_0x590b56[_0x4c47('0x31')]=_0x590b56[_0x4c47('0x31')][_0x4c47('0x34')]?_0x590b56[_0x4c47('0x31')]:_0x491638[_0x4c47('0x2e')];if(!_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x35')]('nolimit')){_0x590b56[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x590b56['offset']=qs['offset'](_0x36e82b['query'][_0x4c47('0x1d')]);}_0x590b56[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x36e82b['query']['sort']);_0x590b56['where']=qs['filters'](_[_0x4c47('0x39')](_0x36e82b[_0x4c47('0x2f')],_0x491638[_0x4c47('0x3a')]),_0x56c130);if(_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x3b')]){_0x590b56['where']=_[_0x4c47('0x3c')](_0x590b56[_0x4c47('0x3d')],{'$or':_['map'](_0x56c130,function(_0x1c309b){if(_0x1c309b[_0x4c47('0x2d')]!==_0x4c47('0x3e')){var _0x418098={};_0x418098[_0x1c309b[_0x4c47('0x28')]]={'$like':'%'+_0x36e82b['query'][_0x4c47('0x3b')]+'%'};return _0x418098;}})});}_0x590b56=_[_0x4c47('0x3c')]({},_0x590b56,_0x36e82b[_0x4c47('0x3f')]);var _0x291666={'where':_0x590b56[_0x4c47('0x3d')]};return db['JscriptyAnswerReport'][_0x4c47('0x1c')](_0x291666)[_0x4c47('0x24')](function(_0x5a7135){_0x3b977d[_0x4c47('0x1c')]=_0x5a7135;if(_0x36e82b['query'][_0x4c47('0x40')]){_0x590b56[_0x4c47('0x41')]=[{'all':!![]}];}return db[_0x4c47('0x2a')]['findAll'](_0x590b56);})['then'](function(_0x164105){_0x3b977d[_0x4c47('0x42')]=_0x164105;return _0x3b977d;})[_0x4c47('0x24')](respondWithFilteredResult(_0x344a7d,_0x590b56))['catch'](handleError(_0x344a7d,null));};exports[_0x4c47('0x43')]=function(_0x10669d,_0x40057e){var _0x5a0b1f={'raw':!![],'where':{'id':_0x10669d[_0x4c47('0x44')]['id']}},_0x274596={};_0x274596[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2a')][_0x4c47('0x2b')]);_0x274596[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x10669d[_0x4c47('0x2f')]);_0x274596[_0x4c47('0x3a')]=_['intersection'](_0x274596[_0x4c47('0x2e')],_0x274596[_0x4c47('0x2f')]);_0x5a0b1f['attributes']=_['intersection'](_0x274596[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x10669d['query'][_0x4c47('0x33')]));_0x5a0b1f[_0x4c47('0x31')]=_0x5a0b1f[_0x4c47('0x31')][_0x4c47('0x34')]?_0x5a0b1f[_0x4c47('0x31')]:_0x274596['model'];if(_0x10669d['query'][_0x4c47('0x40')]){_0x5a0b1f[_0x4c47('0x41')]=[{'all':!![]}];}_0x5a0b1f=_[_0x4c47('0x3c')]({},_0x5a0b1f,_0x10669d[_0x4c47('0x3f')]);return db[_0x4c47('0x2a')][_0x4c47('0x45')](_0x5a0b1f)[_0x4c47('0x24')](handleEntityNotFound(_0x40057e,null))['then'](respondWithResult(_0x40057e,null))[_0x4c47('0x46')](handleError(_0x40057e,null));};exports['create']=function(_0x40bbec,_0x460fef){return db[_0x4c47('0x2a')]['create'](_0x40bbec[_0x4c47('0x47')],{})[_0x4c47('0x24')](respondWithResult(_0x460fef,0xc9))[_0x4c47('0x46')](handleError(_0x460fef,null));};exports['update']=function(_0x125b18,_0x4ccb67){if(_0x125b18[_0x4c47('0x47')]['id']){delete _0x125b18['body']['id'];}return db[_0x4c47('0x2a')]['find']({'where':{'id':_0x125b18[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x4ccb67,null))[_0x4c47('0x24')](saveUpdates(_0x125b18[_0x4c47('0x47')],null))['then'](respondWithResult(_0x4ccb67,null))['catch'](handleError(_0x4ccb67,null));};exports[_0x4c47('0x48')]=function(_0x48ba62,_0x419ee3){return db[_0x4c47('0x2a')][_0x4c47('0x45')]({'where':{'id':_0x48ba62['params']['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x419ee3,null))[_0x4c47('0x24')](removeEntity(_0x419ee3,null))['catch'](handleError(_0x419ee3,null));};exports['describe']=function(_0x59d746,_0x479332){return db[_0x4c47('0x2a')][_0x4c47('0x49')]()[_0x4c47('0x24')](respondWithResult(_0x479332,null))[_0x4c47('0x46')](handleError(_0x479332,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7b12d1c..f0be8e2 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 _0x4af2=['JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2b36b0,_0x331282){var _0x3c0a23=function(_0x4b4b3e){while(--_0x4b4b3e){_0x2b36b0['push'](_0x2b36b0['shift']());}};_0x3c0a23(++_0x331282);}(_0x4af2,0x1ca));var _0x24af=function(_0x3b9c33,_0x2fde78){_0x3b9c33=_0x3b9c33-0x0;var _0x2101b7=_0x4af2[_0x3b9c33];return _0x2101b7;};'use strict';var _=require('lodash');var util=require(_0x24af('0x0'));var logger=require(_0x24af('0x1'))(_0x24af('0x2'));var moment=require(_0x24af('0x3'));var BPromise=require(_0x24af('0x4'));var rp=require(_0x24af('0x5'));var fs=require('fs');var path=require(_0x24af('0x6'));var rimraf=require('rimraf');var config=require(_0x24af('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x24af('0x8')]=function(_0x3d056a,_0x4c95f9){return _0x3d056a[_0x24af('0x9')](_0x24af('0xa'),attributes,{'tableName':_0x24af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe802=['report_jscripty_answers','util','../../config/logger','api','moment','path','../../config/environment','./jscriptyAnswerReport.attributes','JscriptyAnswerReport'];(function(_0x46b701,_0x3116eb){var _0x572fd8=function(_0x3b1568){while(--_0x3b1568){_0x46b701['push'](_0x46b701['shift']());}};_0x572fd8(++_0x3116eb);}(_0xe802,0x145));var _0x2e80=function(_0x446c56,_0x5a89ca){_0x446c56=_0x446c56-0x0;var _0x159d3c=_0xe802[_0x446c56];return _0x159d3c;};'use strict';var _=require('lodash');var util=require(_0x2e80('0x0'));var logger=require(_0x2e80('0x1'))(_0x2e80('0x2'));var moment=require(_0x2e80('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e80('0x4'));var rimraf=require('rimraf');var config=require(_0x2e80('0x5'));var attributes=require(_0x2e80('0x6'));module['exports']=function(_0x1d54d4,_0x33605d){return _0x1d54d4['define'](_0x2e80('0x7'),attributes,{'tableName':_0x2e80('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index a6592ae..e4c970e 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 _0x51fc=['stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21fbb1,_0x120f56){var _0x2f7b69=function(_0x37f84c){while(--_0x37f84c){_0x21fbb1['push'](_0x21fbb1['shift']());}};_0x2f7b69(++_0x120f56);}(_0x51fc,0x133));var _0xc51f=function(_0xcb56d2,_0x18c194){_0xcb56d2=_0xcb56d2-0x0;var _0x57bed4=_0x51fc[_0xcb56d2];return _0x57bed4;};'use strict';var _=require('lodash');var util=require(_0xc51f('0x0'));var moment=require('moment');var BPromise=require(_0xc51f('0x1'));var rs=require(_0xc51f('0x2'));var fs=require('fs');var Redis=require(_0xc51f('0x3'));var db=require(_0xc51f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc51f('0x5'))(_0xc51f('0x6'));var config=require(_0xc51f('0x7'));var jayson=require(_0xc51f('0x8'));var client=jayson['client'][_0xc51f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45747f,_0x566b0a,_0x962ae8){return new BPromise(function(_0x2d687c,_0x67f44b){return client['request'](_0x45747f,_0x962ae8)['then'](function(_0xc05f3){logger['info'](_0xc51f('0xa'),_0x566b0a,_0xc51f('0xb'));logger[_0xc51f('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x566b0a,_0xc51f('0xb'),JSON[_0xc51f('0xd')](_0xc05f3));if(_0xc05f3[_0xc51f('0xe')]){if(_0xc05f3[_0xc51f('0xe')][_0xc51f('0xf')]===0x1f4){logger['error'](_0xc51f('0xa'),_0x566b0a,_0xc05f3['error'][_0xc51f('0x10')]);return _0x67f44b(_0xc05f3['error'][_0xc51f('0x10')]);}logger[_0xc51f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x566b0a,_0xc05f3[_0xc51f('0xe')]['message']);return _0x2d687c(_0xc05f3['error']['message']);}else{logger[_0xc51f('0x11')](_0xc51f('0xa'),_0x566b0a,_0xc51f('0xb'));_0x2d687c(_0xc05f3[_0xc51f('0x12')][_0xc51f('0x10')]);}})[_0xc51f('0x13')](function(_0x5ae18f){logger[_0xc51f('0xe')](_0xc51f('0xa'),_0x566b0a,_0x5ae18f);_0x67f44b(_0x5ae18f);});});} \ No newline at end of file +var _0x0f67=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash'];(function(_0xae6934,_0x7ed065){var _0x4b388d=function(_0x59ea89){while(--_0x59ea89){_0xae6934['push'](_0xae6934['shift']());}};_0x4b388d(++_0x7ed065);}(_0x0f67,0x7d));var _0x70f6=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0x0f67[_0x420282];return _0x535480;};'use strict';var _=require(_0x70f6('0x0'));var util=require(_0x70f6('0x1'));var moment=require(_0x70f6('0x2'));var BPromise=require(_0x70f6('0x3'));var rs=require(_0x70f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70f6('0x5'))['db'];var utils=require(_0x70f6('0x6'));var logger=require(_0x70f6('0x7'))('rpc');var config=require(_0x70f6('0x8'));var jayson=require(_0x70f6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39dbc8,_0x21220d,_0x2dab2b){return new BPromise(function(_0x42395a,_0x4c1c21){return client[_0x70f6('0xa')](_0x39dbc8,_0x2dab2b)[_0x70f6('0xb')](function(_0x363124){logger[_0x70f6('0xc')](_0x70f6('0xd'),_0x21220d,_0x70f6('0xe'));logger[_0x70f6('0xf')](_0x70f6('0x10'),_0x21220d,_0x70f6('0xe'),JSON[_0x70f6('0x11')](_0x363124));if(_0x363124[_0x70f6('0x12')]){if(_0x363124[_0x70f6('0x12')]['code']===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x21220d,_0x363124[_0x70f6('0x12')][_0x70f6('0x13')]);return _0x4c1c21(_0x363124[_0x70f6('0x12')][_0x70f6('0x13')]);}logger['error'](_0x70f6('0xd'),_0x21220d,_0x363124[_0x70f6('0x12')][_0x70f6('0x13')]);return _0x42395a(_0x363124[_0x70f6('0x12')][_0x70f6('0x13')]);}else{logger['info'](_0x70f6('0xd'),_0x21220d,_0x70f6('0xe'));_0x42395a(_0x363124['result'][_0x70f6('0x13')]);}})[_0x70f6('0x14')](function(_0x5d01d4){logger['error'](_0x70f6('0xd'),_0x21220d,_0x5d01d4);_0x4c1c21(_0x5d01d4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e0dc6ce..ea6c4f3 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 _0xbf39=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','getSessions'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xbf39,0x16a));var _0x9bf3=function(_0x56aec9,_0x353b30){_0x56aec9=_0x56aec9-0x0;var _0x2ef374=_0xbf39[_0x56aec9];return _0x2ef374;};'use strict';var multer=require(_0x9bf3('0x0'));var util=require(_0x9bf3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9bf3('0x2'));var router=express[_0x9bf3('0x3')]();var fs_extra=require(_0x9bf3('0x4'));var auth=require(_0x9bf3('0x5'));var interaction=require(_0x9bf3('0x6'));var config=require('../../config/environment');var controller=require(_0x9bf3('0x7'));router[_0x9bf3('0x8')]('/',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xa')]);router[_0x9bf3('0x8')](_0x9bf3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x9bf3('0x8')]('/:id/sessions',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xc')]);router[_0x9bf3('0x8')](_0x9bf3('0xd'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0xe')]);router[_0x9bf3('0x8')](_0x9bf3('0xf'),auth['isAuthenticated'](),timeout(_0x9bf3('0x10')),controller[_0x9bf3('0x11')]);router['post']('/',auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x12')]);router[_0x9bf3('0x13')](_0x9bf3('0x14'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x15')]);router['put'](_0x9bf3('0xb'),auth[_0x9bf3('0x9')](),controller[_0x9bf3('0x16')]);router[_0x9bf3('0x17')](_0x9bf3('0xb'),auth[_0x9bf3('0x9')](),controller['destroy']);module[_0x9bf3('0x18')]=router; \ No newline at end of file +var _0xffe7=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','post','create','/:id/clone','put','delete'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0xffe7,0xd0));var _0x7ffe=function(_0x8c2c64,_0x54314f){_0x8c2c64=_0x8c2c64-0x0;var _0xd4185a=_0xffe7[_0x8c2c64];return _0xd4185a;};'use strict';var multer=require(_0x7ffe('0x0'));var util=require(_0x7ffe('0x1'));var path=require(_0x7ffe('0x2'));var timeout=require(_0x7ffe('0x3'));var express=require(_0x7ffe('0x4'));var router=express['Router']();var fs_extra=require(_0x7ffe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7ffe('0x6'));var config=require(_0x7ffe('0x7'));var controller=require('./jscriptyProject.controller');router[_0x7ffe('0x8')]('/',auth[_0x7ffe('0x9')](),controller[_0x7ffe('0xa')]);router['get'](_0x7ffe('0xb'),auth[_0x7ffe('0x9')](),controller[_0x7ffe('0xc')]);router[_0x7ffe('0x8')](_0x7ffe('0xd'),auth['isAuthenticated'](),controller[_0x7ffe('0xe')]);router['get'](_0x7ffe('0xf'),auth[_0x7ffe('0x9')](),controller[_0x7ffe('0x10')]);router[_0x7ffe('0x8')]('/:id/summary',auth[_0x7ffe('0x9')](),timeout('30s'),controller['getSummary']);router[_0x7ffe('0x11')]('/',auth[_0x7ffe('0x9')](),controller[_0x7ffe('0x12')]);router['post'](_0x7ffe('0x13'),auth[_0x7ffe('0x9')](),controller['clone']);router[_0x7ffe('0x14')](_0x7ffe('0xb'),auth[_0x7ffe('0x9')](),controller['update']);router[_0x7ffe('0x15')]('/:id',auth[_0x7ffe('0x9')](),controller['destroy']);module[_0x7ffe('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index db9c9ec..e79ec6b 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 _0x9db7=['TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','description','BOOLEAN','sequelize','lodash','exports','STRING','name'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x9db7,0xcb));var _0x79db=function(_0x270dda,_0x480f22){_0x270dda=_0x270dda-0x0;var _0x41b53b=_0x9db7[_0x270dda];return _0x41b53b;};'use strict';var Sequelize=require(_0x79db('0x0'));var _=require(_0x79db('0x1'));var util=require('util');module[_0x79db('0x2')]={'name':{'type':Sequelize[_0x79db('0x3')],'unique':_0x79db('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x79db('0x5')](_0x79db('0x6')),'set':function(_0x1dcbd1){if(_[_0x79db('0x7')](_0x1dcbd1)){this[_0x79db('0x8')](_0x79db('0x9'),JSON[_0x79db('0xa')](_0x1dcbd1));}else if(_[_0x79db('0xb')](_0x1dcbd1)){this[_0x79db('0x8')](_0x79db('0x9'),_0x1dcbd1);}else{this[_0x79db('0x8')]('formData',util[_0x79db('0xc')](_0x79db('0xd'),this['getDataValue']('name')||'',this['getDataValue'](_0x79db('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x79db('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc0e6=['stringify','isString','setDataValue','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','formData'];(function(_0x5ecb23,_0x3b4775){var _0x512741=function(_0x467397){while(--_0x467397){_0x5ecb23['push'](_0x5ecb23['shift']());}};_0x512741(++_0x3b4775);}(_0xc0e6,0x70));var _0x6c0e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc0e6[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x6c0e('0x0'));var _=require(_0x6c0e('0x1'));var util=require(_0x6c0e('0x2'));module['exports']={'name':{'type':Sequelize[_0x6c0e('0x3')],'unique':_0x6c0e('0x4')},'description':{'type':Sequelize[_0x6c0e('0x3')]},'formData':{'type':Sequelize[_0x6c0e('0x5')](_0x6c0e('0x6')),'set':function(_0x4b6a6c){if(_['isObjectLike'](_0x4b6a6c)){this['setDataValue'](_0x6c0e('0x7'),JSON[_0x6c0e('0x8')](_0x4b6a6c));}else if(_[_0x6c0e('0x9')](_0x4b6a6c)){this[_0x6c0e('0xa')](_0x6c0e('0x7'),_0x4b6a6c);}else{this[_0x6c0e('0xa')](_0x6c0e('0x7'),util[_0x6c0e('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x6c0e('0xc')](_0x6c0e('0x4'))||'',this[_0x6c0e('0xc')](_0x6c0e('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6c0e('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6c0e('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5d2c8cc..fa5b3c3 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 _0x2d58=['ProjectId','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','JscriptyProject','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','clone','omit','createdAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x2d58,0x186));var _0x82d5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d58[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x82d5('0x0'));var rimraf=require(_0x82d5('0x1'));var zipdir=require(_0x82d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82d5('0x3'));var moment=require('moment');var BPromise=require(_0x82d5('0x4'));var Mustache=require(_0x82d5('0x5'));var util=require(_0x82d5('0x6'));var path=require(_0x82d5('0x7'));var sox=require(_0x82d5('0x8'));var csv=require(_0x82d5('0x9'));var ejs=require(_0x82d5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82d5('0xb'));var squel=require(_0x82d5('0xc'));var crypto=require(_0x82d5('0xd'));var jsforce=require(_0x82d5('0xe'));var deskjs=require(_0x82d5('0xf'));var toCsv=require(_0x82d5('0x9'));var querystring=require(_0x82d5('0x10'));var Papa=require(_0x82d5('0x11'));var Redis=require(_0x82d5('0x12'));var authService=require(_0x82d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82d5('0x14'));var hardwareService=require(_0x82d5('0x15'));var logger=require(_0x82d5('0x16'))(_0x82d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82d5('0x18'));var db=require(_0x82d5('0x19'))['db'];function respondWithStatusCode(_0x549d85,_0x14ccdc){_0x14ccdc=_0x14ccdc||0xcc;return function(_0x5c2d84){if(_0x5c2d84){return _0x549d85[_0x82d5('0x1a')](_0x14ccdc);}return _0x549d85[_0x82d5('0x1b')](_0x14ccdc)[_0x82d5('0x1c')]();};}function respondWithResult(_0x265753,_0x201e56){_0x201e56=_0x201e56||0xc8;return function(_0x3f26ff){if(_0x3f26ff){return _0x265753[_0x82d5('0x1b')](_0x201e56)[_0x82d5('0x1d')](_0x3f26ff);}};}function respondWithFilteredResult(_0x4a18f0,_0x128c42){return function(_0x26caa1){if(_0x26caa1){var _0x5b0b6e=typeof _0x128c42[_0x82d5('0x1e')]===_0x82d5('0x1f')&&typeof _0x128c42[_0x82d5('0x20')]===_0x82d5('0x1f');var _0x2e6c2c=_0x26caa1['count'];var _0xe1ce36=_0x5b0b6e?0x0:_0x128c42[_0x82d5('0x1e')];var _0x13c6ed=_0x5b0b6e?_0x26caa1[_0x82d5('0x21')]:_0x128c42[_0x82d5('0x1e')]+_0x128c42[_0x82d5('0x20')];var _0x3505b8;if(_0x13c6ed>=_0x2e6c2c){_0x13c6ed=_0x2e6c2c;_0x3505b8=0xc8;}else{_0x3505b8=0xce;}_0x4a18f0['status'](_0x3505b8);return _0x4a18f0['set'](_0x82d5('0x22'),_0xe1ce36+'-'+_0x13c6ed+'/'+_0x2e6c2c)[_0x82d5('0x1d')](_0x26caa1);}return null;};}function patchUpdates(_0x45d203){return function(_0x4712db){try{jsonpatch[_0x82d5('0x23')](_0x4712db,_0x45d203,!![]);}catch(_0x27a2a4){return BPromise[_0x82d5('0x24')](_0x27a2a4);}return _0x4712db[_0x82d5('0x25')]();};}function saveUpdates(_0x579711,_0x423fe1){return function(_0x2d22ab){if(_0x2d22ab){return _0x2d22ab[_0x82d5('0x26')](_0x579711)[_0x82d5('0x27')](function(_0x54964c){return _0x54964c;});}return null;};}function removeEntity(_0x942fc,_0x59605b){return function(_0x47736d){if(_0x47736d){return _0x47736d[_0x82d5('0x28')]()[_0x82d5('0x27')](function(){var _0x1ec65d=_0x47736d[_0x82d5('0x29')]({'plain':!![]});var _0x41fb26='Projects';return db[_0x82d5('0x2a')]['destroy']({'where':{'type':_0x41fb26,'resourceId':_0x1ec65d['id']}})['then'](function(){return _0x47736d;});})[_0x82d5('0x27')](function(){_0x942fc['status'](0xcc)[_0x82d5('0x1c')]();});}};}function handleEntityNotFound(_0x22c156,_0x18eb16){return function(_0x5854be){if(!_0x5854be){_0x22c156[_0x82d5('0x1a')](0x194);}return _0x5854be;};}function handleError(_0x8f4ba7,_0x10e54d){_0x10e54d=_0x10e54d||0x1f4;return function(_0x4d6054){logger[_0x82d5('0x2b')](_0x4d6054['stack']);if(_0x4d6054[_0x82d5('0x2c')]){delete _0x4d6054[_0x82d5('0x2c')];}_0x8f4ba7[_0x82d5('0x1b')](_0x10e54d)['send'](_0x4d6054);};}exports[_0x82d5('0x2d')]=function(_0x5cf853,_0x199a63){var _0x375c26={},_0x181fd3={},_0x735e28={'count':0x0,'rows':[]};var _0x6ca339=_['map'](db[_0x82d5('0x2e')][_0x82d5('0x2f')],function(_0x34c5ff){return{'name':_0x34c5ff['fieldName'],'type':_0x34c5ff[_0x82d5('0x30')][_0x82d5('0x31')]};});_0x181fd3['model']=_[_0x82d5('0x32')](_0x6ca339,_0x82d5('0x2c'));_0x181fd3[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x5cf853['query']);_0x181fd3[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x181fd3[_0x82d5('0x37')],_0x181fd3[_0x82d5('0x33')]);_0x375c26[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x181fd3[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x5cf853['query']['fields']));_0x375c26[_0x82d5('0x38')]=_0x375c26[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x375c26[_0x82d5('0x38')]:_0x181fd3[_0x82d5('0x37')];if(!_0x5cf853[_0x82d5('0x33')][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x375c26[_0x82d5('0x20')]=qs[_0x82d5('0x20')](_0x5cf853[_0x82d5('0x33')][_0x82d5('0x20')]);_0x375c26[_0x82d5('0x1e')]=qs[_0x82d5('0x1e')](_0x5cf853['query'][_0x82d5('0x1e')]);}_0x375c26[_0x82d5('0x3d')]=qs[_0x82d5('0x3e')](_0x5cf853[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x375c26['where']=qs[_0x82d5('0x35')](_[_0x82d5('0x3f')](_0x5cf853[_0x82d5('0x33')],_0x181fd3['filters']),_0x6ca339);if(_0x5cf853[_0x82d5('0x33')][_0x82d5('0x40')]){_0x375c26[_0x82d5('0x41')]=_[_0x82d5('0x42')](_0x375c26[_0x82d5('0x41')],{'$or':_[_0x82d5('0x32')](_0x6ca339,function(_0x4c9d63){if(_0x4c9d63['type']!==_0x82d5('0x43')){var _0x52d84c={};_0x52d84c[_0x4c9d63[_0x82d5('0x2c')]]={'$like':'%'+_0x5cf853[_0x82d5('0x33')]['filter']+'%'};return _0x52d84c;}})});}_0x375c26=_[_0x82d5('0x42')]({},_0x375c26,_0x5cf853[_0x82d5('0x44')]);var _0x547e12={'where':_0x375c26[_0x82d5('0x41')]};return db[_0x82d5('0x2e')][_0x82d5('0x21')](_0x547e12)[_0x82d5('0x27')](function(_0x5e12d8){_0x735e28['count']=_0x5e12d8;if(_0x5cf853['query'][_0x82d5('0x45')]){_0x375c26[_0x82d5('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x375c26);})['then'](function(_0x17113a){_0x735e28[_0x82d5('0x47')]=_0x17113a;return _0x735e28;})[_0x82d5('0x27')](respondWithFilteredResult(_0x199a63,_0x375c26))[_0x82d5('0x48')](handleError(_0x199a63,null));};exports['show']=function(_0x5c2dc4,_0x28d151){var _0x5b7eeb={'raw':![],'where':{'id':_0x5c2dc4[_0x82d5('0x49')]['id']}},_0x3628a6={};_0x3628a6[_0x82d5('0x37')]=_['keys'](db[_0x82d5('0x2e')][_0x82d5('0x2f')]);_0x3628a6[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x5c2dc4[_0x82d5('0x33')]);_0x3628a6[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x3628a6['model'],_0x3628a6[_0x82d5('0x33')]);_0x5b7eeb['attributes']=_[_0x82d5('0x36')](_0x3628a6[_0x82d5('0x37')],qs['fields'](_0x5c2dc4[_0x82d5('0x33')][_0x82d5('0x39')]));_0x5b7eeb[_0x82d5('0x38')]=_0x5b7eeb[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x5b7eeb[_0x82d5('0x38')]:_0x3628a6[_0x82d5('0x37')];if(_0x5c2dc4['query']['includeAll']){_0x5b7eeb['include']=[{'all':!![]}];}_0x5b7eeb=_[_0x82d5('0x42')]({},_0x5b7eeb,_0x5c2dc4[_0x82d5('0x44')]);return db['JscriptyProject'][_0x82d5('0x4a')](_0x5b7eeb)[_0x82d5('0x27')](handleEntityNotFound(_0x28d151,null))['then'](respondWithResult(_0x28d151,null))['catch'](handleError(_0x28d151,null));};exports[_0x82d5('0x4b')]=function(_0xa890f,_0x4db992){return db[_0x82d5('0x2e')][_0x82d5('0x4b')](_0xa890f[_0x82d5('0x4c')],{})[_0x82d5('0x27')](function(_0x36316b){var _0x53c9a9=_0xa890f[_0x82d5('0x4d')][_0x82d5('0x29')]({'plain':!![]});if(!_0x53c9a9)throw new Error(_0x82d5('0x4e'));if(_0x53c9a9['role']===_0x82d5('0x4d')){var _0x3cea07=_0x36316b['get']({'plain':!![]});var _0x472e65=_0x82d5('0x4f');return db[_0x82d5('0x50')][_0x82d5('0x4a')]({'where':{'name':_0x472e65,'userProfileId':_0x53c9a9[_0x82d5('0x51')]},'raw':!![]})[_0x82d5('0x27')](function(_0x35a50b){if(_0x35a50b&&_0x35a50b['autoAssociation']===0x0){return db[_0x82d5('0x2a')]['create']({'name':_0x3cea07['name'],'resourceId':_0x3cea07['id'],'type':_0x35a50b[_0x82d5('0x2c')],'sectionId':_0x35a50b['id']},{})[_0x82d5('0x27')](function(){return _0x36316b;});}else{return _0x36316b;}})[_0x82d5('0x48')](function(_0x51299f){logger[_0x82d5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51299f);throw _0x51299f;});}return _0x36316b;})[_0x82d5('0x27')](respondWithResult(_0x4db992,0xc9))[_0x82d5('0x48')](handleError(_0x4db992,null));};exports[_0x82d5('0x52')]=function(_0x3318bd,_0x598013){var _0x98e76f={'where':{'id':_0x3318bd[_0x82d5('0x49')]['id']}},_0x521855={};_0x521855[_0x82d5('0x37')]=_[_0x82d5('0x34')](db['JscriptyProject'][_0x82d5('0x2f')]);_0x98e76f[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x521855['model'],qs['fields'](_0x3318bd['query'][_0x82d5('0x39')]));_0x98e76f[_0x82d5('0x38')]=_0x98e76f[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x98e76f[_0x82d5('0x38')]:_0x521855[_0x82d5('0x37')];if(_0x3318bd[_0x82d5('0x33')][_0x82d5('0x45')]){_0x98e76f['include']=[{'all':!![]}];}_0x98e76f=_[_0x82d5('0x42')]({},_0x98e76f,_0x3318bd[_0x82d5('0x44')]);return db[_0x82d5('0x2e')][_0x82d5('0x4a')](_0x98e76f)[_0x82d5('0x27')](handleEntityNotFound(_0x598013,null))[_0x82d5('0x27')](function(_0x15af57){if(_0x15af57){var _0x3ed2c1=_0x15af57[_0x82d5('0x29')]({'plain':!![]});_0x3ed2c1=qs[_0x82d5('0x53')](_0x3ed2c1,['id',_0x82d5('0x54'),'updatedAt']);_0x3318bd[_0x82d5('0x4c')]=_[_0x82d5('0x53')](_0x3318bd[_0x82d5('0x4c')],['id',_0x82d5('0x54'),'updatedAt']);return db[_0x82d5('0x2e')]['create'](_['merge'](_0x3ed2c1,_0x3318bd['body']),{'include':_0x3318bd[_0x82d5('0x33')][_0x82d5('0x45')]?[{'all':!![]}]:undefined})[_0x82d5('0x27')](function(_0x5daddf){var _0x2fb594=_0x3318bd['user'][_0x82d5('0x29')]({'plain':!![]});if(!_0x2fb594)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb594[_0x82d5('0x55')]===_0x82d5('0x4d')){var _0x3f65d1=_0x5daddf['get']({'plain':!![]});var _0x507d23=_0x82d5('0x4f');return db[_0x82d5('0x50')]['find']({'where':{'name':_0x507d23,'userProfileId':_0x2fb594['userProfileId']},'raw':!![]})[_0x82d5('0x27')](function(_0x440629){if(_0x440629&&_0x440629[_0x82d5('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f65d1['name'],'resourceId':_0x3f65d1['id'],'type':_0x440629[_0x82d5('0x2c')],'sectionId':_0x440629['id']},{})[_0x82d5('0x27')](function(){return _0x5daddf;});}else{return _0x5daddf;}})[_0x82d5('0x48')](function(_0x5dccb4){logger[_0x82d5('0x2b')](_0x82d5('0x57'),_0x5dccb4);throw _0x5dccb4;});}return _0x5daddf;});}})['then'](respondWithResult(_0x598013,0xc9))[_0x82d5('0x48')](handleError(_0x598013,null));};exports[_0x82d5('0x26')]=function(_0x25c243,_0x443675){if(_0x25c243[_0x82d5('0x4c')]['id']){delete _0x25c243[_0x82d5('0x4c')]['id'];}return db[_0x82d5('0x2e')]['find']({'where':{'id':_0x25c243[_0x82d5('0x49')]['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x443675,null))['then'](saveUpdates(_0x25c243[_0x82d5('0x4c')],null))[_0x82d5('0x27')](respondWithResult(_0x443675,null))[_0x82d5('0x48')](handleError(_0x443675,null));};exports['destroy']=function(_0xd88ea0,_0xa61a){return db[_0x82d5('0x2e')]['find']({'where':{'id':_0xd88ea0[_0x82d5('0x49')]['id']}})['then'](handleEntityNotFound(_0xa61a,null))[_0x82d5('0x27')](removeEntity(_0xa61a,null))[_0x82d5('0x48')](handleError(_0xa61a,null));};exports[_0x82d5('0x58')]=function(_0x27fd2b,_0x4f315a,_0x441a73){var _0x59890a={'raw':!![],'where':{}};var _0x1f1bc1={};var _0x28ba24={'count':0x0,'rows':[]};return db[_0x82d5('0x2e')][_0x82d5('0x59')]({'where':{'id':_0x27fd2b[_0x82d5('0x49')]['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x4f315a,null))[_0x82d5('0x27')](function(_0x205a60){if(_0x205a60){_0x1f1bc1['model']=_['keys'](db['JscriptySessionReport'][_0x82d5('0x2f')]);_0x1f1bc1['query']=_[_0x82d5('0x34')](_0x27fd2b['query']);_0x1f1bc1[_0x82d5('0x35')]=_['intersection'](_0x1f1bc1[_0x82d5('0x37')],_0x1f1bc1[_0x82d5('0x33')]);_0x59890a[_0x82d5('0x38')]=_[_0x82d5('0x36')](_0x1f1bc1[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x27fd2b['query'][_0x82d5('0x39')]));_0x59890a['attributes']=_0x59890a[_0x82d5('0x38')][_0x82d5('0x3a')]?_0x59890a['attributes']:_0x1f1bc1[_0x82d5('0x37')];if(!_0x27fd2b['query'][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x59890a['limit']=qs[_0x82d5('0x20')](_0x27fd2b['query'][_0x82d5('0x20')]);_0x59890a[_0x82d5('0x1e')]=qs[_0x82d5('0x1e')](_0x27fd2b[_0x82d5('0x33')]['offset']);}_0x59890a[_0x82d5('0x3d')]=qs[_0x82d5('0x3e')](_0x27fd2b[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x59890a['where']=qs[_0x82d5('0x35')](_['pick'](_0x27fd2b[_0x82d5('0x33')],_0x1f1bc1[_0x82d5('0x35')]));_0x59890a[_0x82d5('0x41')]['ProjectId']=_0x205a60['id'];if(_0x27fd2b['query'][_0x82d5('0x40')]){_0x59890a[_0x82d5('0x41')]=_[_0x82d5('0x42')](_0x59890a[_0x82d5('0x41')],{'$or':_['map'](_0x59890a['attributes'],function(_0x560049){var _0x5e8679={};_0x5e8679[_0x560049]={'$like':'%'+_0x27fd2b[_0x82d5('0x33')]['filter']+'%'};return _0x5e8679;})});}_0x59890a=_[_0x82d5('0x42')]({},_0x59890a,_0x27fd2b[_0x82d5('0x44')]);return db[_0x82d5('0x5a')][_0x82d5('0x21')]({'where':_0x59890a[_0x82d5('0x41')]})[_0x82d5('0x27')](function(_0x1c85e0){_0x28ba24['count']=_0x1c85e0;if(_0x27fd2b[_0x82d5('0x33')][_0x82d5('0x45')]){_0x59890a[_0x82d5('0x46')]=[{'all':!![]}];}return db[_0x82d5('0x5a')][_0x82d5('0x5b')](_0x59890a);})[_0x82d5('0x27')](function(_0x445d9f){_0x28ba24[_0x82d5('0x47')]=_0x445d9f;return _0x28ba24;});}})[_0x82d5('0x27')](respondWithFilteredResult(_0x4f315a,_0x59890a))[_0x82d5('0x48')](handleError(_0x4f315a,null));};exports[_0x82d5('0x5c')]=function(_0x37a0e3,_0x4bb5c0,_0x453b28){var _0x4340dd={'raw':!![],'where':{}};var _0x3f3ff6={};var _0x58e4b={'count':0x0,'rows':[]};return db[_0x82d5('0x2e')]['findOne']({'where':{'id':_0x37a0e3['params']['id']}})[_0x82d5('0x27')](handleEntityNotFound(_0x4bb5c0,null))[_0x82d5('0x27')](function(_0x1c339d){if(_0x1c339d){_0x3f3ff6[_0x82d5('0x37')]=_[_0x82d5('0x34')](db[_0x82d5('0x5d')][_0x82d5('0x2f')]);_0x3f3ff6[_0x82d5('0x33')]=_[_0x82d5('0x34')](_0x37a0e3[_0x82d5('0x33')]);_0x3f3ff6[_0x82d5('0x35')]=_[_0x82d5('0x36')](_0x3f3ff6[_0x82d5('0x37')],_0x3f3ff6[_0x82d5('0x33')]);_0x4340dd['attributes']=_[_0x82d5('0x36')](_0x3f3ff6[_0x82d5('0x37')],qs[_0x82d5('0x39')](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x39')]));_0x4340dd[_0x82d5('0x38')]=_0x4340dd[_0x82d5('0x38')]['length']?_0x4340dd['attributes']:_0x3f3ff6[_0x82d5('0x37')];if(!_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x3b')](_0x82d5('0x3c'))){_0x4340dd['limit']=qs['limit'](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x20')]);_0x4340dd['offset']=qs['offset'](_0x37a0e3[_0x82d5('0x33')]['offset']);}_0x4340dd[_0x82d5('0x3d')]=qs['sort'](_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x3e')]);_0x4340dd[_0x82d5('0x41')]=qs[_0x82d5('0x35')](_[_0x82d5('0x3f')](_0x37a0e3[_0x82d5('0x33')],_0x3f3ff6[_0x82d5('0x35')]));_0x4340dd['where'][_0x82d5('0x5e')]=_0x1c339d['id'];if(_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x40')]){_0x4340dd['where']=_['merge'](_0x4340dd[_0x82d5('0x41')],{'$or':_[_0x82d5('0x32')](_0x4340dd[_0x82d5('0x38')],function(_0x3b7e4c){var _0xd4134b={};_0xd4134b[_0x3b7e4c]={'$like':'%'+_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x40')]+'%'};return _0xd4134b;})});}_0x4340dd=_['merge']({},_0x4340dd,_0x37a0e3['options']);return db['JscriptyAnswerReport']['count']({'where':_0x4340dd[_0x82d5('0x41')]})[_0x82d5('0x27')](function(_0x52b490){_0x58e4b[_0x82d5('0x21')]=_0x52b490;if(_0x37a0e3[_0x82d5('0x33')][_0x82d5('0x45')]){_0x4340dd[_0x82d5('0x46')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4340dd);})[_0x82d5('0x27')](function(_0x126cad){_0x58e4b[_0x82d5('0x47')]=_0x126cad;return _0x58e4b;});}})[_0x82d5('0x27')](respondWithFilteredResult(_0x4bb5c0,_0x4340dd))[_0x82d5('0x48')](handleError(_0x4bb5c0,null));};function char(_0x18fe9e){return _0x82d5('0x5f')===typeof _0x18fe9e?String[_0x82d5('0x60')][_0x82d5('0x23')](null,arguments):_0x18fe9e;}function needsEncapsulation(_0x301565){return!!_0x301565&&(_0x301565[_0x82d5('0x61')]()['indexOf'](char(0xd))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0xa))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0x2c))>=0x0||_0x301565[_0x82d5('0x61')]()[_0x82d5('0x62')](char(0x22))>=0x0);}function encapsulate(_0x45526e){var _0x9f8417=char(0x22),_0x4ec5ca='\x5c'+char(0x22),_0x42206b=_0x45526e[_0x82d5('0x61')]()['replace'](new RegExp(_0x9f8417,'g'),_0x4ec5ca);return _0x9f8417+_0x42206b+_0x9f8417;}exports[_0x82d5('0x63')]=function(_0x2be3d6,_0x5d93f7,_0x4f1a3b){var _0x58c713,_0x28ff0f;var _0x101243={'where':{'ProjectId':_0x2be3d6['params']['id']}};if(_0x2be3d6[_0x82d5('0x33')][_0x82d5('0x64')]){_0x101243[_0x82d5('0x41')][_0x82d5('0x65')]=JSON['parse'](_0x2be3d6[_0x82d5('0x33')][_0x82d5('0x64')]);}return db[_0x82d5('0x5a')][_0x82d5('0x5b')](_0x101243)[_0x82d5('0x27')](handleEntityNotFound(_0x5d93f7,null))[_0x82d5('0x27')](function(_0x1f8a58){if(_0x1f8a58){_0x58c713=_0x1f8a58;return db[_0x82d5('0x66')][_0x82d5('0x5b')]({'where':{'SessionId':{'$in':_['map'](_0x58c713,'id')},'ProjectId':_0x2be3d6[_0x82d5('0x49')]['id']},'order':_0x82d5('0x67')});}})[_0x82d5('0x27')](handleEntityNotFound(_0x5d93f7,null))[_0x82d5('0x27')](function(_0x589ece){if(_0x589ece){_0x28ff0f=_0x589ece;var _0x29593b={};for(var _0x2dceca=0x0,_0x4ef58b=_0x28ff0f[_0x82d5('0x3a')];_0x2dceca<_0x4ef58b;_0x2dceca++){if(!_0x29593b[_0x82d5('0x3b')](_0x28ff0f[_0x2dceca][_0x82d5('0x68')])){_0x29593b[_0x28ff0f[_0x2dceca][_0x82d5('0x68')]]=needsEncapsulation(_0x28ff0f[_0x2dceca][_0x82d5('0x69')])?encapsulate(_0x28ff0f[_0x2dceca][_0x82d5('0x69')]):_0x28ff0f[_0x2dceca]['question'];}}var _0x44fc1f=[],_0x25398d={};for(var _0x3c1d21=0x0,_0x251609=_0x58c713['length'];_0x3c1d21<_0x251609;_0x3c1d21++){_0x25398d={'ProjectId':_0x2be3d6[_0x82d5('0x49')]['id'],'SessionId':_0x58c713[_0x3c1d21]['id'],'StartTime':moment(_0x58c713[_0x3c1d21][_0x82d5('0x65')])[_0x82d5('0x6a')](_0x82d5('0x6b'))};for(var _0x396dec=0x0,_0x3dfe57=_0x28ff0f[_0x82d5('0x3a')];_0x396dec<_0x3dfe57;_0x396dec++){if(_0x28ff0f[_0x396dec][_0x82d5('0x6c')]==_0x58c713[_0x3c1d21]['id']&&_0x29593b[_0x82d5('0x3b')](_0x28ff0f[_0x396dec][_0x82d5('0x68')])){_0x25398d[_0x29593b[_0x28ff0f[_0x396dec]['questionId']]]=_0x28ff0f[_0x396dec][_0x82d5('0x6d')];}}for(var _0x5caad4 in _0x29593b){if(!_0x25398d['hasOwnProperty'](_0x29593b[_0x5caad4])){_0x25398d[_0x29593b[_0x5caad4]]=null;}}_0x44fc1f['push'](_0x25398d);}return _0x44fc1f;}})[_0x82d5('0x27')](function(_0x17af8a){if(!_[_0x82d5('0x6e')](_0x17af8a)){var _0x4c8dc7=toCsv(_0x17af8a);var _0x307c62=Date[_0x82d5('0x6f')]();fs[_0x82d5('0x70')](util[_0x82d5('0x6a')](_0x82d5('0x71'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62),_0x4c8dc7);_0x5d93f7[_0x82d5('0x72')](_0x82d5('0x73'),_0x82d5('0x74')+util[_0x82d5('0x6a')](_0x82d5('0x75'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62));_0x5d93f7[_0x82d5('0x72')](_0x82d5('0x76'),_0x82d5('0x77'));return _0x5d93f7[_0x82d5('0x78')](util[_0x82d5('0x6a')](_0x82d5('0x71'),_0x2be3d6[_0x82d5('0x49')]['id'],_0x307c62));}else{return _0x5d93f7['sendStatus'](0xcc);}})[_0x82d5('0x48')](handleError(_0x5d93f7,null));}; \ No newline at end of file +var _0x3080=['question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','apply','reject','then','destroy','get','UserProfileResource','end','error','name','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','JscriptyProject','includeAll','include','findAll','show','params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','order','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId'];(function(_0x5ed696,_0x44c503){var _0x2c74f6=function(_0x4cede1){while(--_0x4cede1){_0x5ed696['push'](_0x5ed696['shift']());}};_0x2c74f6(++_0x44c503);}(_0x3080,0x1e6));var _0x0308=function(_0x55aa4,_0x218256){_0x55aa4=_0x55aa4-0x0;var _0x594174=_0x3080[_0x55aa4];return _0x594174;};'use strict';var emlformat=require(_0x0308('0x0'));var rimraf=require(_0x0308('0x1'));var zipdir=require(_0x0308('0x2'));var jsonpatch=require(_0x0308('0x3'));var rp=require('request-promise');var moment=require(_0x0308('0x4'));var BPromise=require(_0x0308('0x5'));var Mustache=require(_0x0308('0x6'));var util=require(_0x0308('0x7'));var path=require(_0x0308('0x8'));var sox=require(_0x0308('0x9'));var csv=require('to-csv');var ejs=require(_0x0308('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0308('0xb'));var squel=require(_0x0308('0xc'));var crypto=require(_0x0308('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0308('0xe'));var toCsv=require(_0x0308('0xf'));var querystring=require(_0x0308('0x10'));var Papa=require(_0x0308('0x11'));var Redis=require(_0x0308('0x12'));var authService=require(_0x0308('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0308('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0308('0x15'))(_0x0308('0x16'));var utils=require(_0x0308('0x17'));var config=require(_0x0308('0x18'));var licenseUtil=require(_0x0308('0x19'));var db=require(_0x0308('0x1a'))['db'];function respondWithStatusCode(_0x590d38,_0x52c884){_0x52c884=_0x52c884||0xcc;return function(_0x43d48f){if(_0x43d48f){return _0x590d38[_0x0308('0x1b')](_0x52c884);}return _0x590d38['status'](_0x52c884)['end']();};}function respondWithResult(_0x2cff66,_0x5da96e){_0x5da96e=_0x5da96e||0xc8;return function(_0xbc9ce4){if(_0xbc9ce4){return _0x2cff66[_0x0308('0x1c')](_0x5da96e)[_0x0308('0x1d')](_0xbc9ce4);}};}function respondWithFilteredResult(_0x34f0ec,_0x4460e9){return function(_0x4f50be){if(_0x4f50be){var _0x534526=typeof _0x4460e9['offset']==='undefined'&&typeof _0x4460e9[_0x0308('0x1e')]==='undefined';var _0xacc60=_0x4f50be['count'];var _0x367d93=_0x534526?0x0:_0x4460e9[_0x0308('0x1f')];var _0xc2ae04=_0x534526?_0x4f50be[_0x0308('0x20')]:_0x4460e9['offset']+_0x4460e9['limit'];var _0x4de58e;if(_0xc2ae04>=_0xacc60){_0xc2ae04=_0xacc60;_0x4de58e=0xc8;}else{_0x4de58e=0xce;}_0x34f0ec[_0x0308('0x1c')](_0x4de58e);return _0x34f0ec[_0x0308('0x21')](_0x0308('0x22'),_0x367d93+'-'+_0xc2ae04+'/'+_0xacc60)[_0x0308('0x1d')](_0x4f50be);}return null;};}function patchUpdates(_0xa6c0c2){return function(_0x28e04f){try{jsonpatch[_0x0308('0x23')](_0x28e04f,_0xa6c0c2,!![]);}catch(_0xc0ad8c){return BPromise[_0x0308('0x24')](_0xc0ad8c);}return _0x28e04f['save']();};}function saveUpdates(_0x54b20d,_0x16f736){return function(_0x2810d3){if(_0x2810d3){return _0x2810d3['update'](_0x54b20d)[_0x0308('0x25')](function(_0x48ee8c){return _0x48ee8c;});}return null;};}function removeEntity(_0x1d7eaf,_0x21f2f3){return function(_0x1791ff){if(_0x1791ff){return _0x1791ff[_0x0308('0x26')]()[_0x0308('0x25')](function(){var _0x234969=_0x1791ff[_0x0308('0x27')]({'plain':!![]});var _0x5e92dd='Projects';return db[_0x0308('0x28')][_0x0308('0x26')]({'where':{'type':_0x5e92dd,'resourceId':_0x234969['id']}})[_0x0308('0x25')](function(){return _0x1791ff;});})[_0x0308('0x25')](function(){_0x1d7eaf[_0x0308('0x1c')](0xcc)[_0x0308('0x29')]();});}};}function handleEntityNotFound(_0x1c85c6,_0x2cd5d2){return function(_0x3d75e2){if(!_0x3d75e2){_0x1c85c6[_0x0308('0x1b')](0x194);}return _0x3d75e2;};}function handleError(_0x26529b,_0x50a410){_0x50a410=_0x50a410||0x1f4;return function(_0x48d5d6){logger[_0x0308('0x2a')](_0x48d5d6['stack']);if(_0x48d5d6[_0x0308('0x2b')]){delete _0x48d5d6[_0x0308('0x2b')];}_0x26529b['status'](_0x50a410)['send'](_0x48d5d6);};}exports['index']=function(_0x31d487,_0x365018){var _0x552750={},_0x56c6ea={},_0x469cc4={'count':0x0,'rows':[]};var _0x2c3745=_[_0x0308('0x2c')](db['JscriptyProject'][_0x0308('0x2d')],function(_0x1163f3){return{'name':_0x1163f3[_0x0308('0x2e')],'type':_0x1163f3[_0x0308('0x2f')]['key']};});_0x56c6ea[_0x0308('0x30')]=_['map'](_0x2c3745,_0x0308('0x2b'));_0x56c6ea[_0x0308('0x31')]=_[_0x0308('0x32')](_0x31d487[_0x0308('0x31')]);_0x56c6ea['filters']=_['intersection'](_0x56c6ea[_0x0308('0x30')],_0x56c6ea['query']);_0x552750[_0x0308('0x33')]=_['intersection'](_0x56c6ea[_0x0308('0x30')],qs[_0x0308('0x34')](_0x31d487['query'][_0x0308('0x34')]));_0x552750[_0x0308('0x33')]=_0x552750[_0x0308('0x33')][_0x0308('0x35')]?_0x552750[_0x0308('0x33')]:_0x56c6ea[_0x0308('0x30')];if(!_0x31d487[_0x0308('0x31')][_0x0308('0x36')](_0x0308('0x37'))){_0x552750[_0x0308('0x1e')]=qs[_0x0308('0x1e')](_0x31d487[_0x0308('0x31')][_0x0308('0x1e')]);_0x552750['offset']=qs[_0x0308('0x1f')](_0x31d487[_0x0308('0x31')][_0x0308('0x1f')]);}_0x552750['order']=qs[_0x0308('0x38')](_0x31d487['query'][_0x0308('0x38')]);_0x552750['where']=qs[_0x0308('0x39')](_[_0x0308('0x3a')](_0x31d487[_0x0308('0x31')],_0x56c6ea[_0x0308('0x39')]),_0x2c3745);if(_0x31d487[_0x0308('0x31')]['filter']){_0x552750[_0x0308('0x3b')]=_['merge'](_0x552750[_0x0308('0x3b')],{'$or':_[_0x0308('0x2c')](_0x2c3745,function(_0x34b7d7){if(_0x34b7d7[_0x0308('0x2f')]!==_0x0308('0x3c')){var _0x366227={};_0x366227[_0x34b7d7[_0x0308('0x2b')]]={'$like':'%'+_0x31d487[_0x0308('0x31')][_0x0308('0x3d')]+'%'};return _0x366227;}})});}_0x552750=_[_0x0308('0x3e')]({},_0x552750,_0x31d487['options']);var _0x33d524={'where':_0x552750[_0x0308('0x3b')]};return db[_0x0308('0x3f')][_0x0308('0x20')](_0x33d524)['then'](function(_0x2536fd){_0x469cc4[_0x0308('0x20')]=_0x2536fd;if(_0x31d487[_0x0308('0x31')][_0x0308('0x40')]){_0x552750[_0x0308('0x41')]=[{'all':!![]}];}return db[_0x0308('0x3f')][_0x0308('0x42')](_0x552750);})['then'](function(_0x49ccab){_0x469cc4['rows']=_0x49ccab;return _0x469cc4;})[_0x0308('0x25')](respondWithFilteredResult(_0x365018,_0x552750))['catch'](handleError(_0x365018,null));};exports[_0x0308('0x43')]=function(_0x489104,_0x4ff35c){var _0x5be28d={'raw':![],'where':{'id':_0x489104[_0x0308('0x44')]['id']}},_0x28dfc1={};_0x28dfc1[_0x0308('0x30')]=_[_0x0308('0x32')](db['JscriptyProject'][_0x0308('0x2d')]);_0x28dfc1['query']=_[_0x0308('0x32')](_0x489104['query']);_0x28dfc1['filters']=_[_0x0308('0x45')](_0x28dfc1[_0x0308('0x30')],_0x28dfc1[_0x0308('0x31')]);_0x5be28d['attributes']=_['intersection'](_0x28dfc1[_0x0308('0x30')],qs[_0x0308('0x34')](_0x489104[_0x0308('0x31')]['fields']));_0x5be28d[_0x0308('0x33')]=_0x5be28d[_0x0308('0x33')][_0x0308('0x35')]?_0x5be28d['attributes']:_0x28dfc1[_0x0308('0x30')];if(_0x489104[_0x0308('0x31')][_0x0308('0x40')]){_0x5be28d['include']=[{'all':!![]}];}_0x5be28d=_[_0x0308('0x3e')]({},_0x5be28d,_0x489104[_0x0308('0x46')]);return db[_0x0308('0x3f')][_0x0308('0x47')](_0x5be28d)[_0x0308('0x25')](handleEntityNotFound(_0x4ff35c,null))['then'](respondWithResult(_0x4ff35c,null))['catch'](handleError(_0x4ff35c,null));};exports[_0x0308('0x48')]=function(_0x370e3b,_0x160285){return db['JscriptyProject'][_0x0308('0x48')](_0x370e3b[_0x0308('0x49')],{})[_0x0308('0x25')](function(_0x356172){var _0x2a552c=_0x370e3b[_0x0308('0x4a')][_0x0308('0x27')]({'plain':!![]});if(!_0x2a552c)throw new Error(_0x0308('0x4b'));if(_0x2a552c[_0x0308('0x4c')]===_0x0308('0x4a')){var _0x2d5868=_0x356172['get']({'plain':!![]});var _0x700e25='Projects';return db[_0x0308('0x4d')][_0x0308('0x47')]({'where':{'name':_0x700e25,'userProfileId':_0x2a552c[_0x0308('0x4e')]},'raw':!![]})['then'](function(_0xc0158a){if(_0xc0158a&&_0xc0158a[_0x0308('0x4f')]===0x0){return db[_0x0308('0x28')][_0x0308('0x48')]({'name':_0x2d5868['name'],'resourceId':_0x2d5868['id'],'type':_0xc0158a[_0x0308('0x2b')],'sectionId':_0xc0158a['id']},{})['then'](function(){return _0x356172;});}else{return _0x356172;}})[_0x0308('0x50')](function(_0x9f8ea){logger[_0x0308('0x2a')](_0x0308('0x51'),_0x9f8ea);throw _0x9f8ea;});}return _0x356172;})['then'](respondWithResult(_0x160285,0xc9))[_0x0308('0x50')](handleError(_0x160285,null));};exports[_0x0308('0x52')]=function(_0x4c3271,_0x702a6){var _0x325b0c={'where':{'id':_0x4c3271[_0x0308('0x44')]['id']}},_0x399721={};_0x399721[_0x0308('0x30')]=_[_0x0308('0x32')](db[_0x0308('0x3f')][_0x0308('0x2d')]);_0x325b0c[_0x0308('0x33')]=_[_0x0308('0x45')](_0x399721[_0x0308('0x30')],qs[_0x0308('0x34')](_0x4c3271['query']['fields']));_0x325b0c[_0x0308('0x33')]=_0x325b0c[_0x0308('0x33')][_0x0308('0x35')]?_0x325b0c[_0x0308('0x33')]:_0x399721[_0x0308('0x30')];if(_0x4c3271['query']['includeAll']){_0x325b0c[_0x0308('0x41')]=[{'all':!![]}];}_0x325b0c=_['merge']({},_0x325b0c,_0x4c3271[_0x0308('0x46')]);return db['JscriptyProject'][_0x0308('0x47')](_0x325b0c)[_0x0308('0x25')](handleEntityNotFound(_0x702a6,null))['then'](function(_0x582e16){if(_0x582e16){var _0x346d13=_0x582e16[_0x0308('0x27')]({'plain':!![]});_0x346d13=qs[_0x0308('0x53')](_0x346d13,['id',_0x0308('0x54'),_0x0308('0x55')]);_0x4c3271[_0x0308('0x49')]=_['omit'](_0x4c3271[_0x0308('0x49')],['id',_0x0308('0x54'),_0x0308('0x55')]);return db[_0x0308('0x3f')][_0x0308('0x48')](_[_0x0308('0x3e')](_0x346d13,_0x4c3271[_0x0308('0x49')]),{'include':_0x4c3271['query'][_0x0308('0x40')]?[{'all':!![]}]:undefined})[_0x0308('0x25')](function(_0x4607a4){var _0x3d7628=_0x4c3271['user']['get']({'plain':!![]});if(!_0x3d7628)throw new Error(_0x0308('0x4b'));if(_0x3d7628['role']===_0x0308('0x4a')){var _0x20ac25=_0x4607a4[_0x0308('0x27')]({'plain':!![]});var _0x2a2544='Projects';return db[_0x0308('0x4d')][_0x0308('0x47')]({'where':{'name':_0x2a2544,'userProfileId':_0x3d7628[_0x0308('0x4e')]},'raw':!![]})[_0x0308('0x25')](function(_0x49716c){if(_0x49716c&&_0x49716c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x20ac25[_0x0308('0x2b')],'resourceId':_0x20ac25['id'],'type':_0x49716c[_0x0308('0x2b')],'sectionId':_0x49716c['id']},{})[_0x0308('0x25')](function(){return _0x4607a4;});}else{return _0x4607a4;}})[_0x0308('0x50')](function(_0x52cfeb){logger[_0x0308('0x2a')](_0x0308('0x51'),_0x52cfeb);throw _0x52cfeb;});}return _0x4607a4;});}})[_0x0308('0x25')](respondWithResult(_0x702a6,0xc9))['catch'](handleError(_0x702a6,null));};exports[_0x0308('0x56')]=function(_0x253ead,_0xee77d6){if(_0x253ead['body']['id']){delete _0x253ead[_0x0308('0x49')]['id'];}return db[_0x0308('0x3f')][_0x0308('0x47')]({'where':{'id':_0x253ead[_0x0308('0x44')]['id']}})[_0x0308('0x25')](handleEntityNotFound(_0xee77d6,null))[_0x0308('0x25')](saveUpdates(_0x253ead[_0x0308('0x49')],null))[_0x0308('0x25')](respondWithResult(_0xee77d6,null))['catch'](handleError(_0xee77d6,null));};exports[_0x0308('0x26')]=function(_0xed4bd,_0x4c87a9){return db[_0x0308('0x3f')][_0x0308('0x47')]({'where':{'id':_0xed4bd[_0x0308('0x44')]['id']}})[_0x0308('0x25')](handleEntityNotFound(_0x4c87a9,null))['then'](removeEntity(_0x4c87a9,null))[_0x0308('0x50')](handleError(_0x4c87a9,null));};exports[_0x0308('0x57')]=function(_0x2274a7,_0x20cb94,_0xf13daf){var _0x1b645f={'raw':!![],'where':{}};var _0x1674ac={};var _0x8d826f={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0308('0x58')]({'where':{'id':_0x2274a7[_0x0308('0x44')]['id']}})[_0x0308('0x25')](handleEntityNotFound(_0x20cb94,null))[_0x0308('0x25')](function(_0x23a425){if(_0x23a425){_0x1674ac['model']=_[_0x0308('0x32')](db[_0x0308('0x59')][_0x0308('0x2d')]);_0x1674ac[_0x0308('0x31')]=_[_0x0308('0x32')](_0x2274a7['query']);_0x1674ac[_0x0308('0x39')]=_[_0x0308('0x45')](_0x1674ac['model'],_0x1674ac[_0x0308('0x31')]);_0x1b645f[_0x0308('0x33')]=_[_0x0308('0x45')](_0x1674ac[_0x0308('0x30')],qs[_0x0308('0x34')](_0x2274a7[_0x0308('0x31')][_0x0308('0x34')]));_0x1b645f[_0x0308('0x33')]=_0x1b645f[_0x0308('0x33')][_0x0308('0x35')]?_0x1b645f['attributes']:_0x1674ac['model'];if(!_0x2274a7['query'][_0x0308('0x36')]('nolimit')){_0x1b645f[_0x0308('0x1e')]=qs[_0x0308('0x1e')](_0x2274a7[_0x0308('0x31')][_0x0308('0x1e')]);_0x1b645f[_0x0308('0x1f')]=qs[_0x0308('0x1f')](_0x2274a7[_0x0308('0x31')]['offset']);}_0x1b645f[_0x0308('0x5a')]=qs[_0x0308('0x38')](_0x2274a7[_0x0308('0x31')]['sort']);_0x1b645f['where']=qs[_0x0308('0x39')](_[_0x0308('0x3a')](_0x2274a7[_0x0308('0x31')],_0x1674ac[_0x0308('0x39')]));_0x1b645f[_0x0308('0x3b')][_0x0308('0x5b')]=_0x23a425['id'];if(_0x2274a7[_0x0308('0x31')][_0x0308('0x3d')]){_0x1b645f[_0x0308('0x3b')]=_[_0x0308('0x3e')](_0x1b645f[_0x0308('0x3b')],{'$or':_[_0x0308('0x2c')](_0x1b645f[_0x0308('0x33')],function(_0x5a23ed){var _0x3cc46c={};_0x3cc46c[_0x5a23ed]={'$like':'%'+_0x2274a7[_0x0308('0x31')][_0x0308('0x3d')]+'%'};return _0x3cc46c;})});}_0x1b645f=_[_0x0308('0x3e')]({},_0x1b645f,_0x2274a7[_0x0308('0x46')]);return db[_0x0308('0x59')]['count']({'where':_0x1b645f[_0x0308('0x3b')]})[_0x0308('0x25')](function(_0x2f8a65){_0x8d826f[_0x0308('0x20')]=_0x2f8a65;if(_0x2274a7[_0x0308('0x31')][_0x0308('0x40')]){_0x1b645f['include']=[{'all':!![]}];}return db[_0x0308('0x59')][_0x0308('0x42')](_0x1b645f);})[_0x0308('0x25')](function(_0x48445e){_0x8d826f[_0x0308('0x5c')]=_0x48445e;return _0x8d826f;});}})[_0x0308('0x25')](respondWithFilteredResult(_0x20cb94,_0x1b645f))['catch'](handleError(_0x20cb94,null));};exports['getAnswers']=function(_0x49fa1f,_0x2a3ce4,_0x4e0aac){var _0x5bb148={'raw':!![],'where':{}};var _0x26b726={};var _0x1c0ef3={'count':0x0,'rows':[]};return db[_0x0308('0x3f')][_0x0308('0x58')]({'where':{'id':_0x49fa1f['params']['id']}})[_0x0308('0x25')](handleEntityNotFound(_0x2a3ce4,null))['then'](function(_0x591b23){if(_0x591b23){_0x26b726[_0x0308('0x30')]=_[_0x0308('0x32')](db['JscriptyAnswerReport']['rawAttributes']);_0x26b726['query']=_[_0x0308('0x32')](_0x49fa1f[_0x0308('0x31')]);_0x26b726[_0x0308('0x39')]=_['intersection'](_0x26b726[_0x0308('0x30')],_0x26b726[_0x0308('0x31')]);_0x5bb148[_0x0308('0x33')]=_['intersection'](_0x26b726[_0x0308('0x30')],qs[_0x0308('0x34')](_0x49fa1f[_0x0308('0x31')][_0x0308('0x34')]));_0x5bb148[_0x0308('0x33')]=_0x5bb148[_0x0308('0x33')][_0x0308('0x35')]?_0x5bb148[_0x0308('0x33')]:_0x26b726[_0x0308('0x30')];if(!_0x49fa1f[_0x0308('0x31')][_0x0308('0x36')](_0x0308('0x37'))){_0x5bb148[_0x0308('0x1e')]=qs[_0x0308('0x1e')](_0x49fa1f[_0x0308('0x31')][_0x0308('0x1e')]);_0x5bb148[_0x0308('0x1f')]=qs[_0x0308('0x1f')](_0x49fa1f[_0x0308('0x31')][_0x0308('0x1f')]);}_0x5bb148[_0x0308('0x5a')]=qs[_0x0308('0x38')](_0x49fa1f[_0x0308('0x31')][_0x0308('0x38')]);_0x5bb148[_0x0308('0x3b')]=qs[_0x0308('0x39')](_[_0x0308('0x3a')](_0x49fa1f['query'],_0x26b726[_0x0308('0x39')]));_0x5bb148[_0x0308('0x3b')][_0x0308('0x5b')]=_0x591b23['id'];if(_0x49fa1f[_0x0308('0x31')][_0x0308('0x3d')]){_0x5bb148['where']=_[_0x0308('0x3e')](_0x5bb148['where'],{'$or':_['map'](_0x5bb148[_0x0308('0x33')],function(_0x25be88){var _0x17d926={};_0x17d926[_0x25be88]={'$like':'%'+_0x49fa1f[_0x0308('0x31')]['filter']+'%'};return _0x17d926;})});}_0x5bb148=_['merge']({},_0x5bb148,_0x49fa1f[_0x0308('0x46')]);return db[_0x0308('0x5d')][_0x0308('0x20')]({'where':_0x5bb148[_0x0308('0x3b')]})['then'](function(_0x22bf7b){_0x1c0ef3['count']=_0x22bf7b;if(_0x49fa1f['query'][_0x0308('0x40')]){_0x5bb148[_0x0308('0x41')]=[{'all':!![]}];}return db[_0x0308('0x5d')][_0x0308('0x42')](_0x5bb148);})['then'](function(_0x12aef9){_0x1c0ef3[_0x0308('0x5c')]=_0x12aef9;return _0x1c0ef3;});}})[_0x0308('0x25')](respondWithFilteredResult(_0x2a3ce4,_0x5bb148))['catch'](handleError(_0x2a3ce4,null));};function char(_0x36b419){return _0x0308('0x5e')===typeof _0x36b419?String[_0x0308('0x5f')]['apply'](null,arguments):_0x36b419;}function needsEncapsulation(_0x1eb844){return!!_0x1eb844&&(_0x1eb844[_0x0308('0x60')]()[_0x0308('0x61')](char(0xd))>=0x0||_0x1eb844[_0x0308('0x60')]()[_0x0308('0x61')](char(0xa))>=0x0||_0x1eb844[_0x0308('0x60')]()['indexOf'](char(0x2c))>=0x0||_0x1eb844['toString']()[_0x0308('0x61')](char(0x22))>=0x0);}function encapsulate(_0x24762f){var _0xa74a11=char(0x22),_0x5382d6='\x5c'+char(0x22),_0x271204=_0x24762f[_0x0308('0x60')]()[_0x0308('0x62')](new RegExp(_0xa74a11,'g'),_0x5382d6);return _0xa74a11+_0x271204+_0xa74a11;}exports[_0x0308('0x63')]=function(_0x6b88ef,_0x34ca45,_0x4b662f){var _0x155e7c,_0x15eae9;var _0x22c8eb={'where':{'ProjectId':_0x6b88ef[_0x0308('0x44')]['id']}};if(_0x6b88ef[_0x0308('0x31')][_0x0308('0x64')]){_0x22c8eb[_0x0308('0x3b')]['starttime']=JSON[_0x0308('0x65')](_0x6b88ef[_0x0308('0x31')][_0x0308('0x64')]);}return db['JscriptySessionReport'][_0x0308('0x42')](_0x22c8eb)[_0x0308('0x25')](handleEntityNotFound(_0x34ca45,null))[_0x0308('0x25')](function(_0x6c4384){if(_0x6c4384){_0x155e7c=_0x6c4384;return db['JscriptyQuestionReport'][_0x0308('0x42')]({'where':{'SessionId':{'$in':_[_0x0308('0x2c')](_0x155e7c,'id')},'ProjectId':_0x6b88ef[_0x0308('0x44')]['id']},'order':_0x0308('0x66')});}})[_0x0308('0x25')](handleEntityNotFound(_0x34ca45,null))[_0x0308('0x25')](function(_0x5221b9){if(_0x5221b9){_0x15eae9=_0x5221b9;var _0x4d2f77={};for(var _0xa9f5c=0x0,_0x3edf27=_0x15eae9[_0x0308('0x35')];_0xa9f5c<_0x3edf27;_0xa9f5c++){if(!_0x4d2f77[_0x0308('0x36')](_0x15eae9[_0xa9f5c][_0x0308('0x67')])){_0x4d2f77[_0x15eae9[_0xa9f5c][_0x0308('0x67')]]=needsEncapsulation(_0x15eae9[_0xa9f5c]['question'])?encapsulate(_0x15eae9[_0xa9f5c][_0x0308('0x68')]):_0x15eae9[_0xa9f5c][_0x0308('0x68')];}}var _0x2b8c69=[],_0x408564={};for(var _0x5df5ff=0x0,_0x45cfc7=_0x155e7c[_0x0308('0x35')];_0x5df5ff<_0x45cfc7;_0x5df5ff++){_0x408564={'ProjectId':_0x6b88ef['params']['id'],'SessionId':_0x155e7c[_0x5df5ff]['id'],'StartTime':moment(_0x155e7c[_0x5df5ff][_0x0308('0x69')])[_0x0308('0x6a')](_0x0308('0x6b'))};for(var _0x4966a8=0x0,_0x80a356=_0x15eae9[_0x0308('0x35')];_0x4966a8<_0x80a356;_0x4966a8++){if(_0x15eae9[_0x4966a8][_0x0308('0x6c')]==_0x155e7c[_0x5df5ff]['id']&&_0x4d2f77[_0x0308('0x36')](_0x15eae9[_0x4966a8][_0x0308('0x67')])){_0x408564[_0x4d2f77[_0x15eae9[_0x4966a8][_0x0308('0x67')]]]=_0x15eae9[_0x4966a8][_0x0308('0x6d')];}}for(var _0x2e094a in _0x4d2f77){if(!_0x408564[_0x0308('0x36')](_0x4d2f77[_0x2e094a])){_0x408564[_0x4d2f77[_0x2e094a]]=null;}}_0x2b8c69[_0x0308('0x6e')](_0x408564);}return _0x2b8c69;}})[_0x0308('0x25')](function(_0x1a5c2e){if(!_['isEmpty'](_0x1a5c2e)){var _0x3cabbd=toCsv(_0x1a5c2e);var _0x5b22c0=Date['now']();fs['writeFileSync'](util[_0x0308('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6b88ef[_0x0308('0x44')]['id'],_0x5b22c0),_0x3cabbd);_0x34ca45[_0x0308('0x6f')](_0x0308('0x70'),_0x0308('0x71')+util[_0x0308('0x6a')](_0x0308('0x72'),_0x6b88ef['params']['id'],_0x5b22c0));_0x34ca45[_0x0308('0x6f')](_0x0308('0x73'),_0x0308('0x74'));return _0x34ca45[_0x0308('0x75')](util[_0x0308('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x6b88ef[_0x0308('0x44')]['id'],_0x5b22c0));}else{return _0x34ca45['sendStatus'](0xcc);}})['catch'](handleError(_0x34ca45,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 74c5448..9690983 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 _0x61a5=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','JscriptyProject','jscripty_projects'];(function(_0x4f5919,_0x131535){var _0x29dc08=function(_0x311acf){while(--_0x311acf){_0x4f5919['push'](_0x4f5919['shift']());}};_0x29dc08(++_0x131535);}(_0x61a5,0xf0));var _0x561a=function(_0x337ef8,_0x3971ab){_0x337ef8=_0x337ef8-0x0;var _0x585b75=_0x61a5[_0x337ef8];return _0x585b75;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var rp=require(_0x561a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x561a('0x8')]=function(_0x31f762,_0x24c89a){return _0x31f762[_0x561a('0x9')](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad3=['jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x155c9a,_0x401f72){var _0x2096a3=function(_0x40e997){while(--_0x40e997){_0x155c9a['push'](_0x155c9a['shift']());}};_0x2096a3(++_0x401f72);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x5ad3[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var logger=require(_0x35ad('0x2'))(_0x35ad('0x3'));var moment=require('moment');var BPromise=require(_0x35ad('0x4'));var rp=require(_0x35ad('0x5'));var fs=require('fs');var path=require(_0x35ad('0x6'));var rimraf=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var attributes=require(_0x35ad('0x9'));module[_0x35ad('0xa')]=function(_0x436dcb,_0x36c606){return _0x436dcb[_0x35ad('0xb')]('JscriptyProject',attributes,{'tableName':_0x35ad('0xc'),'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 6d82cee..064b9ee 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 _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5769b5,_0x3295f0){var _0x531f67=function(_0x47917a){while(--_0x47917a){_0x5769b5['push'](_0x5769b5['shift']());}};_0x531f67(++_0x3295f0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1a192e,_0x1f56b7){_0x1a192e=_0x1a192e-0x0;var _0x1fb017=_0x9bde[_0x1a192e];return _0x1fb017;};'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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x35e369,_0xaa0fc0){var _0x51ce9e=function(_0x1251e1){while(--_0x1251e1){_0x35e369['push'](_0x35e369['shift']());}};_0x51ce9e(++_0xaa0fc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index fca7f12..b8c494f 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 _0x5700=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x106e92,_0x20a61f){var _0xa8f2be=function(_0x1641d9){while(--_0x1641d9){_0x106e92['push'](_0x106e92['shift']());}};_0xa8f2be(++_0x20a61f);}(_0x5700,0x106));var _0x0570=function(_0x163484,_0x214258){_0x163484=_0x163484-0x0;var _0x22617e=_0x5700[_0x163484];return _0x22617e;};'use strict';var multer=require(_0x0570('0x0'));var util=require(_0x0570('0x1'));var path=require(_0x0570('0x2'));var timeout=require(_0x0570('0x3'));var express=require(_0x0570('0x4'));var router=express[_0x0570('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0570('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0570('0x7'));router[_0x0570('0x8')]('/',auth[_0x0570('0x9')](),controller['index']);router['get'](_0x0570('0xa'),auth[_0x0570('0x9')](),controller[_0x0570('0xb')]);router[_0x0570('0x8')](_0x0570('0xc'),auth[_0x0570('0x9')](),controller[_0x0570('0xd')]);router[_0x0570('0xe')]('/',auth[_0x0570('0x9')](),controller[_0x0570('0xf')]);router['put'](_0x0570('0xc'),auth[_0x0570('0x9')](),controller[_0x0570('0x10')]);router[_0x0570('0x11')](_0x0570('0xc'),auth['isAuthenticated'](),controller[_0x0570('0x12')]);module[_0x0570('0x13')]=router; \ No newline at end of file +var _0x208c=['create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x4a0168,_0x3b2717){var _0x58d873=function(_0x2bf116){while(--_0x2bf116){_0x4a0168['push'](_0x4a0168['shift']());}};_0x58d873(++_0x3b2717);}(_0x208c,0x9c));var _0xc208=function(_0x5dc2d5,_0x581064){_0x5dc2d5=_0x5dc2d5-0x0;var _0x52fdbc=_0x208c[_0x5dc2d5];return _0x52fdbc;};'use strict';var multer=require(_0xc208('0x0'));var util=require(_0xc208('0x1'));var path=require('path');var timeout=require(_0xc208('0x2'));var express=require(_0xc208('0x3'));var router=express[_0xc208('0x4')]();var fs_extra=require(_0xc208('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc208('0x6'));var config=require(_0xc208('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xc208('0x8')]('/',auth[_0xc208('0x9')](),controller[_0xc208('0xa')]);router[_0xc208('0x8')]('/describe',auth[_0xc208('0x9')](),controller[_0xc208('0xb')]);router[_0xc208('0x8')](_0xc208('0xc'),auth['isAuthenticated'](),controller[_0xc208('0xd')]);router[_0xc208('0xe')]('/',auth['isAuthenticated'](),controller[_0xc208('0xf')]);router['put'](_0xc208('0xc'),auth[_0xc208('0x9')](),controller[_0xc208('0x10')]);router[_0xc208('0x11')]('/:id',auth[_0xc208('0x9')](),controller['destroy']);module[_0xc208('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 3344ed3..be7f2d9 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x48742d,_0x3fdd2d){_0x48742d=_0x48742d-0x0;var _0xe8ba6d=_0x7a54[_0x48742d];return _0xe8ba6d;};'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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x985362,_0x2ddfab){_0x985362=_0x985362-0x0;var _0x516930=_0x7a54[_0x985362];return _0x516930;};'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 ebe47ce..2a2f88d 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 _0xcad5=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','includeAll','findAll','rows','catch','params','keys','include','options','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','intersection','attributes'];(function(_0x22fe75,_0x50d58a){var _0xbad35=function(_0x54b0c8){while(--_0x54b0c8){_0x22fe75['push'](_0x22fe75['shift']());}};_0xbad35(++_0x50d58a);}(_0xcad5,0x1cf));var _0x5cad=function(_0x204c69,_0x1d8dbe){_0x204c69=_0x204c69-0x0;var _0x5c03dd=_0xcad5[_0x204c69];return _0x5c03dd;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5cad('0x3'));var moment=require(_0x5cad('0x4'));var BPromise=require(_0x5cad('0x5'));var Mustache=require(_0x5cad('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5cad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cad('0x8'));var squel=require(_0x5cad('0x9'));var crypto=require(_0x5cad('0xa'));var jsforce=require(_0x5cad('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cad('0xc'));var Papa=require(_0x5cad('0xd'));var Redis=require(_0x5cad('0xe'));var authService=require(_0x5cad('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5cad('0x10'));var utils=require(_0x5cad('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x5cad('0x12'));var db=require(_0x5cad('0x13'))['db'];function respondWithStatusCode(_0x614fa9,_0xba2132){_0xba2132=_0xba2132||0xcc;return function(_0x13e1c5){if(_0x13e1c5){return _0x614fa9[_0x5cad('0x14')](_0xba2132);}return _0x614fa9[_0x5cad('0x15')](_0xba2132)[_0x5cad('0x16')]();};}function respondWithResult(_0x55d99c,_0x437633){_0x437633=_0x437633||0xc8;return function(_0x39e549){if(_0x39e549){return _0x55d99c[_0x5cad('0x15')](_0x437633)[_0x5cad('0x17')](_0x39e549);}};}function respondWithFilteredResult(_0x125ddc,_0x26eec5){return function(_0x46f7bf){if(_0x46f7bf){var _0x343623=typeof _0x26eec5[_0x5cad('0x18')]===_0x5cad('0x19')&&typeof _0x26eec5[_0x5cad('0x1a')]==='undefined';var _0x313166=_0x46f7bf[_0x5cad('0x1b')];var _0x21853e=_0x343623?0x0:_0x26eec5[_0x5cad('0x18')];var _0x18cf06=_0x343623?_0x46f7bf['count']:_0x26eec5[_0x5cad('0x18')]+_0x26eec5['limit'];var _0x104d01;if(_0x18cf06>=_0x313166){_0x18cf06=_0x313166;_0x104d01=0xc8;}else{_0x104d01=0xce;}_0x125ddc[_0x5cad('0x15')](_0x104d01);return _0x125ddc['set'](_0x5cad('0x1c'),_0x21853e+'-'+_0x18cf06+'/'+_0x313166)[_0x5cad('0x17')](_0x46f7bf);}return null;};}function patchUpdates(_0x3f6dc4){return function(_0x108aee){try{jsonpatch[_0x5cad('0x1d')](_0x108aee,_0x3f6dc4,!![]);}catch(_0x308939){return BPromise[_0x5cad('0x1e')](_0x308939);}return _0x108aee[_0x5cad('0x1f')]();};}function saveUpdates(_0x244b71,_0x4f55c7){return function(_0x5523af){if(_0x5523af){return _0x5523af[_0x5cad('0x20')](_0x244b71)['then'](function(_0x32ccdd){return _0x32ccdd;});}return null;};}function removeEntity(_0x25e145,_0x18df3c){return function(_0x3080dd){if(_0x3080dd){return _0x3080dd[_0x5cad('0x21')]()[_0x5cad('0x22')](function(){_0x25e145[_0x5cad('0x15')](0xcc)[_0x5cad('0x16')]();});}};}function handleEntityNotFound(_0x356c73,_0x34e398){return function(_0x125755){if(!_0x125755){_0x356c73[_0x5cad('0x14')](0x194);}return _0x125755;};}function handleError(_0x119e02,_0xaecd71){_0xaecd71=_0xaecd71||0x1f4;return function(_0x4fa905){logger[_0x5cad('0x23')](_0x4fa905[_0x5cad('0x24')]);if(_0x4fa905['name']){delete _0x4fa905['name'];}_0x119e02['status'](_0xaecd71)[_0x5cad('0x25')](_0x4fa905);};}exports[_0x5cad('0x26')]=function(_0x27c27d,_0x1f7597){var _0x40a70d={},_0x35a4cb={},_0x311dbc={'count':0x0,'rows':[]};var _0x5d1da5=_[_0x5cad('0x27')](db[_0x5cad('0x28')][_0x5cad('0x29')],function(_0x2b1aac){return{'name':_0x2b1aac[_0x5cad('0x2a')],'type':_0x2b1aac['type'][_0x5cad('0x2b')]};});_0x35a4cb[_0x5cad('0x2c')]=_[_0x5cad('0x27')](_0x5d1da5,'name');_0x35a4cb[_0x5cad('0x2d')]=_['keys'](_0x27c27d[_0x5cad('0x2d')]);_0x35a4cb['filters']=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],_0x35a4cb[_0x5cad('0x2d')]);_0x40a70d[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x35a4cb[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x27c27d['query'][_0x5cad('0x30')]));_0x40a70d['attributes']=_0x40a70d[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x40a70d[_0x5cad('0x2f')]:_0x35a4cb[_0x5cad('0x2c')];if(!_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x32')](_0x5cad('0x33'))){_0x40a70d[_0x5cad('0x1a')]=qs[_0x5cad('0x1a')](_0x27c27d[_0x5cad('0x2d')]['limit']);_0x40a70d[_0x5cad('0x18')]=qs['offset'](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x18')]);}_0x40a70d[_0x5cad('0x34')]=qs[_0x5cad('0x35')](_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x35')]);_0x40a70d[_0x5cad('0x36')]=qs[_0x5cad('0x37')](_[_0x5cad('0x38')](_0x27c27d[_0x5cad('0x2d')],_0x35a4cb[_0x5cad('0x37')]),_0x5d1da5);if(_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]){_0x40a70d['where']=_[_0x5cad('0x3a')](_0x40a70d['where'],{'$or':_['map'](_0x5d1da5,function(_0x5a21e1){if(_0x5a21e1[_0x5cad('0x3b')]!==_0x5cad('0x3c')){var _0x51a81c={};_0x51a81c[_0x5a21e1[_0x5cad('0x3d')]]={'$like':'%'+_0x27c27d[_0x5cad('0x2d')][_0x5cad('0x39')]+'%'};return _0x51a81c;}})});}_0x40a70d=_[_0x5cad('0x3a')]({},_0x40a70d,_0x27c27d['options']);var _0x257062={'where':_0x40a70d[_0x5cad('0x36')]};return db[_0x5cad('0x28')]['count'](_0x257062)[_0x5cad('0x22')](function(_0xb1e3f9){_0x311dbc[_0x5cad('0x1b')]=_0xb1e3f9;if(_0x27c27d['query'][_0x5cad('0x3e')]){_0x40a70d['include']=[{'all':!![]}];}return db[_0x5cad('0x28')][_0x5cad('0x3f')](_0x40a70d);})[_0x5cad('0x22')](function(_0xb8c97){_0x311dbc[_0x5cad('0x40')]=_0xb8c97;return _0x311dbc;})[_0x5cad('0x22')](respondWithFilteredResult(_0x1f7597,_0x40a70d))[_0x5cad('0x41')](handleError(_0x1f7597,null));};exports['show']=function(_0x219ca3,_0x2bac1e){var _0x424cb6={'raw':!![],'where':{'id':_0x219ca3[_0x5cad('0x42')]['id']}},_0x316300={};_0x316300[_0x5cad('0x2c')]=_['keys'](db[_0x5cad('0x28')][_0x5cad('0x29')]);_0x316300[_0x5cad('0x2d')]=_[_0x5cad('0x43')](_0x219ca3[_0x5cad('0x2d')]);_0x316300['filters']=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],_0x316300[_0x5cad('0x2d')]);_0x424cb6[_0x5cad('0x2f')]=_[_0x5cad('0x2e')](_0x316300[_0x5cad('0x2c')],qs[_0x5cad('0x30')](_0x219ca3['query'][_0x5cad('0x30')]));_0x424cb6[_0x5cad('0x2f')]=_0x424cb6[_0x5cad('0x2f')][_0x5cad('0x31')]?_0x424cb6[_0x5cad('0x2f')]:_0x316300['model'];if(_0x219ca3[_0x5cad('0x2d')][_0x5cad('0x3e')]){_0x424cb6[_0x5cad('0x44')]=[{'all':!![]}];}_0x424cb6=_['merge']({},_0x424cb6,_0x219ca3[_0x5cad('0x45')]);return db['JscriptyQuestionReport']['find'](_0x424cb6)['then'](handleEntityNotFound(_0x2bac1e,null))['then'](respondWithResult(_0x2bac1e,null))[_0x5cad('0x41')](handleError(_0x2bac1e,null));};exports['create']=function(_0x1efc57,_0x33ea29){return db[_0x5cad('0x28')]['create'](_0x1efc57[_0x5cad('0x46')],{})[_0x5cad('0x22')](respondWithResult(_0x33ea29,0xc9))[_0x5cad('0x41')](handleError(_0x33ea29,null));};exports['update']=function(_0x11d9ff,_0x50094b){if(_0x11d9ff[_0x5cad('0x46')]['id']){delete _0x11d9ff['body']['id'];}return db[_0x5cad('0x28')]['find']({'where':{'id':_0x11d9ff[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x50094b,null))[_0x5cad('0x22')](saveUpdates(_0x11d9ff['body'],null))[_0x5cad('0x22')](respondWithResult(_0x50094b,null))['catch'](handleError(_0x50094b,null));};exports[_0x5cad('0x21')]=function(_0xa8ebdc,_0x44716f){return db['JscriptyQuestionReport'][_0x5cad('0x47')]({'where':{'id':_0xa8ebdc[_0x5cad('0x42')]['id']}})[_0x5cad('0x22')](handleEntityNotFound(_0x44716f,null))[_0x5cad('0x22')](removeEntity(_0x44716f,null))[_0x5cad('0x41')](handleError(_0x44716f,null));};exports[_0x5cad('0x48')]=function(_0x216bcf,_0x43b1d3){return db['JscriptyQuestionReport'][_0x5cad('0x48')]()[_0x5cad('0x22')](respondWithResult(_0x43b1d3,null))['catch'](handleError(_0x43b1d3,null));}; \ No newline at end of file +var _0xe59d=['fields','sort','where','pick','filters','merge','map','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptyQuestionReport','fieldName','type','key','model','keys','query','intersection','attributes'];(function(_0x12ab04,_0x16a7ee){var _0x456277=function(_0x8cbffc){while(--_0x8cbffc){_0x12ab04['push'](_0x12ab04['shift']());}};_0x456277(++_0x16a7ee);}(_0xe59d,0x131));var _0xde59=function(_0x397396,_0x4f2b10){_0x397396=_0x397396-0x0;var _0x3c1c53=_0xe59d[_0x397396];return _0x3c1c53;};'use strict';var emlformat=require(_0xde59('0x0'));var rimraf=require(_0xde59('0x1'));var zipdir=require(_0xde59('0x2'));var jsonpatch=require(_0xde59('0x3'));var rp=require(_0xde59('0x4'));var moment=require(_0xde59('0x5'));var BPromise=require(_0xde59('0x6'));var Mustache=require(_0xde59('0x7'));var util=require(_0xde59('0x8'));var path=require(_0xde59('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xde59('0xa'));var crypto=require('crypto');var jsforce=require(_0xde59('0xb'));var deskjs=require(_0xde59('0xc'));var toCsv=require(_0xde59('0xd'));var querystring=require(_0xde59('0xe'));var Papa=require(_0xde59('0xf'));var Redis=require(_0xde59('0x10'));var authService=require(_0xde59('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xde59('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xde59('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xde59('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x500714,_0x504f00){_0x504f00=_0x504f00||0xcc;return function(_0x4b56dd){if(_0x4b56dd){return _0x500714[_0xde59('0x15')](_0x504f00);}return _0x500714[_0xde59('0x16')](_0x504f00)[_0xde59('0x17')]();};}function respondWithResult(_0x1d7a21,_0x562c50){_0x562c50=_0x562c50||0xc8;return function(_0x2c8f1a){if(_0x2c8f1a){return _0x1d7a21[_0xde59('0x16')](_0x562c50)['json'](_0x2c8f1a);}};}function respondWithFilteredResult(_0x15e561,_0x3e68a4){return function(_0x27719d){if(_0x27719d){var _0x2cfc6f=typeof _0x3e68a4['offset']===_0xde59('0x18')&&typeof _0x3e68a4['limit']===_0xde59('0x18');var _0x1bb646=_0x27719d[_0xde59('0x19')];var _0x34a75b=_0x2cfc6f?0x0:_0x3e68a4['offset'];var _0x5be9d0=_0x2cfc6f?_0x27719d[_0xde59('0x19')]:_0x3e68a4[_0xde59('0x1a')]+_0x3e68a4[_0xde59('0x1b')];var _0x5a1175;if(_0x5be9d0>=_0x1bb646){_0x5be9d0=_0x1bb646;_0x5a1175=0xc8;}else{_0x5a1175=0xce;}_0x15e561[_0xde59('0x16')](_0x5a1175);return _0x15e561[_0xde59('0x1c')](_0xde59('0x1d'),_0x34a75b+'-'+_0x5be9d0+'/'+_0x1bb646)[_0xde59('0x1e')](_0x27719d);}return null;};}function patchUpdates(_0x708018){return function(_0x4e7ffb){try{jsonpatch[_0xde59('0x1f')](_0x4e7ffb,_0x708018,!![]);}catch(_0x28080a){return BPromise[_0xde59('0x20')](_0x28080a);}return _0x4e7ffb[_0xde59('0x21')]();};}function saveUpdates(_0x49439d,_0x3a32f6){return function(_0x565478){if(_0x565478){return _0x565478[_0xde59('0x22')](_0x49439d)[_0xde59('0x23')](function(_0x4ac617){return _0x4ac617;});}return null;};}function removeEntity(_0x1f29d5,_0x44221c){return function(_0x40db40){if(_0x40db40){return _0x40db40[_0xde59('0x24')]()[_0xde59('0x23')](function(){_0x1f29d5[_0xde59('0x16')](0xcc)[_0xde59('0x17')]();});}};}function handleEntityNotFound(_0x4f034d,_0x16d56c){return function(_0x45939c){if(!_0x45939c){_0x4f034d[_0xde59('0x15')](0x194);}return _0x45939c;};}function handleError(_0x5a6d94,_0x207836){_0x207836=_0x207836||0x1f4;return function(_0x2796f7){logger['error'](_0x2796f7[_0xde59('0x25')]);if(_0x2796f7[_0xde59('0x26')]){delete _0x2796f7[_0xde59('0x26')];}_0x5a6d94[_0xde59('0x16')](_0x207836)[_0xde59('0x27')](_0x2796f7);};}exports[_0xde59('0x28')]=function(_0x313896,_0x1cdbec){var _0x32d0ab={},_0x3eaf44={},_0x50b700={'count':0x0,'rows':[]};var _0x4eb0cc=_['map'](db[_0xde59('0x29')]['rawAttributes'],function(_0xbc5f0c){return{'name':_0xbc5f0c[_0xde59('0x2a')],'type':_0xbc5f0c[_0xde59('0x2b')][_0xde59('0x2c')]};});_0x3eaf44[_0xde59('0x2d')]=_['map'](_0x4eb0cc,_0xde59('0x26'));_0x3eaf44['query']=_[_0xde59('0x2e')](_0x313896[_0xde59('0x2f')]);_0x3eaf44['filters']=_[_0xde59('0x30')](_0x3eaf44[_0xde59('0x2d')],_0x3eaf44[_0xde59('0x2f')]);_0x32d0ab[_0xde59('0x31')]=_[_0xde59('0x30')](_0x3eaf44['model'],qs[_0xde59('0x32')](_0x313896['query'][_0xde59('0x32')]));_0x32d0ab[_0xde59('0x31')]=_0x32d0ab[_0xde59('0x31')]['length']?_0x32d0ab[_0xde59('0x31')]:_0x3eaf44[_0xde59('0x2d')];if(!_0x313896['query']['hasOwnProperty']('nolimit')){_0x32d0ab[_0xde59('0x1b')]=qs[_0xde59('0x1b')](_0x313896['query'][_0xde59('0x1b')]);_0x32d0ab['offset']=qs[_0xde59('0x1a')](_0x313896['query'][_0xde59('0x1a')]);}_0x32d0ab['order']=qs[_0xde59('0x33')](_0x313896[_0xde59('0x2f')]['sort']);_0x32d0ab[_0xde59('0x34')]=qs['filters'](_[_0xde59('0x35')](_0x313896['query'],_0x3eaf44[_0xde59('0x36')]),_0x4eb0cc);if(_0x313896[_0xde59('0x2f')]['filter']){_0x32d0ab['where']=_[_0xde59('0x37')](_0x32d0ab[_0xde59('0x34')],{'$or':_[_0xde59('0x38')](_0x4eb0cc,function(_0x2a78dc){if(_0x2a78dc[_0xde59('0x2b')]!==_0xde59('0x39')){var _0x178721={};_0x178721[_0x2a78dc[_0xde59('0x26')]]={'$like':'%'+_0x313896[_0xde59('0x2f')][_0xde59('0x3a')]+'%'};return _0x178721;}})});}_0x32d0ab=_['merge']({},_0x32d0ab,_0x313896[_0xde59('0x3b')]);var _0x51e2cd={'where':_0x32d0ab['where']};return db[_0xde59('0x29')]['count'](_0x51e2cd)['then'](function(_0x127847){_0x50b700[_0xde59('0x19')]=_0x127847;if(_0x313896[_0xde59('0x2f')][_0xde59('0x3c')]){_0x32d0ab[_0xde59('0x3d')]=[{'all':!![]}];}return db[_0xde59('0x29')]['findAll'](_0x32d0ab);})[_0xde59('0x23')](function(_0x120804){_0x50b700[_0xde59('0x3e')]=_0x120804;return _0x50b700;})[_0xde59('0x23')](respondWithFilteredResult(_0x1cdbec,_0x32d0ab))[_0xde59('0x3f')](handleError(_0x1cdbec,null));};exports[_0xde59('0x40')]=function(_0x272185,_0x28a3dd){var _0x33179c={'raw':!![],'where':{'id':_0x272185[_0xde59('0x41')]['id']}},_0x26e9c8={};_0x26e9c8['model']=_[_0xde59('0x2e')](db['JscriptyQuestionReport'][_0xde59('0x42')]);_0x26e9c8[_0xde59('0x2f')]=_[_0xde59('0x2e')](_0x272185[_0xde59('0x2f')]);_0x26e9c8[_0xde59('0x36')]=_[_0xde59('0x30')](_0x26e9c8[_0xde59('0x2d')],_0x26e9c8['query']);_0x33179c[_0xde59('0x31')]=_['intersection'](_0x26e9c8[_0xde59('0x2d')],qs['fields'](_0x272185['query']['fields']));_0x33179c['attributes']=_0x33179c[_0xde59('0x31')]['length']?_0x33179c[_0xde59('0x31')]:_0x26e9c8[_0xde59('0x2d')];if(_0x272185[_0xde59('0x2f')][_0xde59('0x3c')]){_0x33179c[_0xde59('0x3d')]=[{'all':!![]}];}_0x33179c=_[_0xde59('0x37')]({},_0x33179c,_0x272185[_0xde59('0x3b')]);return db[_0xde59('0x29')][_0xde59('0x43')](_0x33179c)[_0xde59('0x23')](handleEntityNotFound(_0x28a3dd,null))[_0xde59('0x23')](respondWithResult(_0x28a3dd,null))[_0xde59('0x3f')](handleError(_0x28a3dd,null));};exports[_0xde59('0x44')]=function(_0x28bcf7,_0x53f136){return db[_0xde59('0x29')][_0xde59('0x44')](_0x28bcf7[_0xde59('0x45')],{})['then'](respondWithResult(_0x53f136,0xc9))[_0xde59('0x3f')](handleError(_0x53f136,null));};exports[_0xde59('0x22')]=function(_0x358f1b,_0x355a7a){if(_0x358f1b['body']['id']){delete _0x358f1b[_0xde59('0x45')]['id'];}return db[_0xde59('0x29')][_0xde59('0x43')]({'where':{'id':_0x358f1b[_0xde59('0x41')]['id']}})['then'](handleEntityNotFound(_0x355a7a,null))['then'](saveUpdates(_0x358f1b[_0xde59('0x45')],null))['then'](respondWithResult(_0x355a7a,null))['catch'](handleError(_0x355a7a,null));};exports['destroy']=function(_0x33acd5,_0x43d5f1){return db[_0xde59('0x29')]['find']({'where':{'id':_0x33acd5[_0xde59('0x41')]['id']}})[_0xde59('0x23')](handleEntityNotFound(_0x43d5f1,null))[_0xde59('0x23')](removeEntity(_0x43d5f1,null))[_0xde59('0x3f')](handleError(_0x43d5f1,null));};exports[_0xde59('0x46')]=function(_0x6c9b0f,_0x43040e){return db[_0xde59('0x29')][_0xde59('0x46')]()[_0xde59('0x23')](respondWithResult(_0x43040e,null))['catch'](handleError(_0x43040e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index dcd430b..1cc20e6 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 _0xe02f=['./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4169a4,_0xbba209){var _0x2ea881=function(_0x9556d0){while(--_0x9556d0){_0x4169a4['push'](_0x4169a4['shift']());}};_0x2ea881(++_0xbba209);}(_0xe02f,0x1b0));var _0xfe02=function(_0x5c2829,_0x2e1482){_0x5c2829=_0x5c2829-0x0;var _0x4d6544=_0xe02f[_0x5c2829];return _0x4d6544;};'use strict';var _=require(_0xfe02('0x0'));var util=require(_0xfe02('0x1'));var logger=require('../../config/logger')(_0xfe02('0x2'));var moment=require(_0xfe02('0x3'));var BPromise=require('bluebird');var rp=require(_0xfe02('0x4'));var fs=require('fs');var path=require(_0xfe02('0x5'));var rimraf=require(_0xfe02('0x6'));var config=require(_0xfe02('0x7'));var attributes=require(_0xfe02('0x8'));module['exports']=function(_0x3252ad,_0x3a5311){return _0x3252ad[_0xfe02('0x9')](_0xfe02('0xa'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ef5=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment'];(function(_0x230e44,_0x30918f){var _0x380c4f=function(_0x3645cb){while(--_0x3645cb){_0x230e44['push'](_0x230e44['shift']());}};_0x380c4f(++_0x30918f);}(_0x6ef5,0xc7));var _0x56ef=function(_0x1b74d3,_0x2ea533){_0x1b74d3=_0x1b74d3-0x0;var _0xedb746=_0x6ef5[_0x1b74d3];return _0xedb746;};'use strict';var _=require(_0x56ef('0x0'));var util=require(_0x56ef('0x1'));var logger=require(_0x56ef('0x2'))(_0x56ef('0x3'));var moment=require(_0x56ef('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ef('0x5'));var rimraf=require(_0x56ef('0x6'));var config=require(_0x56ef('0x7'));var attributes=require(_0x56ef('0x8'));module[_0x56ef('0x9')]=function(_0x511424,_0x58038f){return _0x511424['define'](_0x56ef('0xa'),attributes,{'tableName':_0x56ef('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 4559978..4e2cd38 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 _0xf993=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x514e2d,_0x53f950){var _0x50a599=function(_0x4b2738){while(--_0x4b2738){_0x514e2d['push'](_0x514e2d['shift']());}};_0x50a599(++_0x53f950);}(_0xf993,0x1b1));var _0x3f99=function(_0x31edd4,_0x47418b){_0x31edd4=_0x31edd4-0x0;var _0x3c10f1=_0xf993[_0x31edd4];return _0x3c10f1;};'use strict';var _=require(_0x3f99('0x0'));var util=require(_0x3f99('0x1'));var moment=require(_0x3f99('0x2'));var BPromise=require(_0x3f99('0x3'));var rs=require(_0x3f99('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f99('0x5'))['db'];var utils=require(_0x3f99('0x6'));var logger=require(_0x3f99('0x7'))(_0x3f99('0x8'));var config=require(_0x3f99('0x9'));var jayson=require(_0x3f99('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x379d41,_0xac3caa,_0x3ad6ad){return new BPromise(function(_0x5bc1ea,_0x164771){return client[_0x3f99('0xb')](_0x379d41,_0x3ad6ad)['then'](function(_0x2cbbfc){logger[_0x3f99('0xc')](_0x3f99('0xd'),_0xac3caa,_0x3f99('0xe'));logger[_0x3f99('0xf')](_0x3f99('0x10'),_0xac3caa,_0x3f99('0xe'),JSON[_0x3f99('0x11')](_0x2cbbfc));if(_0x2cbbfc[_0x3f99('0x12')]){if(_0x2cbbfc[_0x3f99('0x12')]['code']===0x1f4){logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);return _0x164771(_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);}logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x2cbbfc[_0x3f99('0x12')][_0x3f99('0x13')]);return _0x5bc1ea(_0x2cbbfc['error'][_0x3f99('0x13')]);}else{logger[_0x3f99('0xc')](_0x3f99('0xd'),_0xac3caa,_0x3f99('0xe'));_0x5bc1ea(_0x2cbbfc[_0x3f99('0x14')][_0x3f99('0x13')]);}})[_0x3f99('0x15')](function(_0x3b4eed){logger[_0x3f99('0x12')](_0x3f99('0xd'),_0xac3caa,_0x3b4eed);_0x164771(_0x3b4eed);});});} \ No newline at end of file +var _0xf3b3=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x42cdb8,_0x4456a5){var _0x121d39=function(_0x126051){while(--_0x126051){_0x42cdb8['push'](_0x42cdb8['shift']());}};_0x121d39(++_0x4456a5);}(_0xf3b3,0x95));var _0x3f3b=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xf3b3[_0x152121];return _0x592a85;};'use strict';var _=require(_0x3f3b('0x0'));var util=require(_0x3f3b('0x1'));var moment=require(_0x3f3b('0x2'));var BPromise=require(_0x3f3b('0x3'));var rs=require(_0x3f3b('0x4'));var fs=require('fs');var Redis=require(_0x3f3b('0x5'));var db=require(_0x3f3b('0x6'))['db'];var utils=require(_0x3f3b('0x7'));var logger=require('../../config/logger')(_0x3f3b('0x8'));var config=require(_0x3f3b('0x9'));var jayson=require(_0x3f3b('0xa'));var client=jayson[_0x3f3b('0xb')][_0x3f3b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x465ce2,_0x3d2f9c,_0x24f81f){return new BPromise(function(_0x59479a,_0x48f0ef){return client[_0x3f3b('0xd')](_0x465ce2,_0x24f81f)[_0x3f3b('0xe')](function(_0x1f342c){logger[_0x3f3b('0xf')](_0x3f3b('0x10'),_0x3d2f9c,_0x3f3b('0x11'));logger[_0x3f3b('0x12')](_0x3f3b('0x13'),_0x3d2f9c,'request\x20sent',JSON['stringify'](_0x1f342c));if(_0x1f342c[_0x3f3b('0x14')]){if(_0x1f342c[_0x3f3b('0x14')][_0x3f3b('0x15')]===0x1f4){logger[_0x3f3b('0x14')](_0x3f3b('0x10'),_0x3d2f9c,_0x1f342c[_0x3f3b('0x14')]['message']);return _0x48f0ef(_0x1f342c[_0x3f3b('0x14')][_0x3f3b('0x16')]);}logger[_0x3f3b('0x14')](_0x3f3b('0x10'),_0x3d2f9c,_0x1f342c[_0x3f3b('0x14')]['message']);return _0x59479a(_0x1f342c['error']['message']);}else{logger[_0x3f3b('0xf')](_0x3f3b('0x10'),_0x3d2f9c,_0x3f3b('0x11'));_0x59479a(_0x1f342c['result']['message']);}})[_0x3f3b('0x17')](function(_0x1c6e5e){logger[_0x3f3b('0x14')](_0x3f3b('0x10'),_0x3d2f9c,_0x1c6e5e);_0x48f0ef(_0x1c6e5e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 299158a..4c5284a 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 _0x1c4a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','getQuestions','post','create','put','/:id','destroy','util','path','connect-timeout'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x1c4a,0x19b));var _0xa1c4=function(_0x5f50b5,_0xa8db83){_0x5f50b5=_0x5f50b5-0x0;var _0x54c383=_0x1c4a[_0x5f50b5];return _0x54c383;};'use strict';var multer=require('multer');var util=require(_0xa1c4('0x0'));var path=require(_0xa1c4('0x1'));var timeout=require(_0xa1c4('0x2'));var express=require(_0xa1c4('0x3'));var router=express[_0xa1c4('0x4')]();var fs_extra=require(_0xa1c4('0x5'));var auth=require(_0xa1c4('0x6'));var interaction=require(_0xa1c4('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xa1c4('0x8')]('/',auth[_0xa1c4('0x9')](),controller['index']);router[_0xa1c4('0x8')](_0xa1c4('0xa'),auth['isAuthenticated'](),controller[_0xa1c4('0xb')]);router[_0xa1c4('0x8')]('/:id',auth[_0xa1c4('0x9')](),controller['show']);router[_0xa1c4('0x8')]('/:id/questions',auth[_0xa1c4('0x9')](),controller[_0xa1c4('0xc')]);router[_0xa1c4('0xd')]('/',auth[_0xa1c4('0x9')](),controller[_0xa1c4('0xe')]);router[_0xa1c4('0xf')](_0xa1c4('0x10'),auth[_0xa1c4('0x9')](),controller['update']);router['delete'](_0xa1c4('0x10'),auth[_0xa1c4('0x9')](),controller[_0xa1c4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0b6b=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x116d7e,_0xc58c9f){var _0xdf6eb8=function(_0x1d07e6){while(--_0x1d07e6){_0x116d7e['push'](_0x116d7e['shift']());}};_0xdf6eb8(++_0xc58c9f);}(_0x0b6b,0x150));var _0xb0b6=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x0b6b[_0x257495];return _0x3849aa;};'use strict';var multer=require(_0xb0b6('0x0'));var util=require('util');var path=require(_0xb0b6('0x1'));var timeout=require(_0xb0b6('0x2'));var express=require(_0xb0b6('0x3'));var router=express[_0xb0b6('0x4')]();var fs_extra=require(_0xb0b6('0x5'));var auth=require(_0xb0b6('0x6'));var interaction=require(_0xb0b6('0x7'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0xb0b6('0x8')]('/',auth[_0xb0b6('0x9')](),controller[_0xb0b6('0xa')]);router[_0xb0b6('0x8')]('/describe',auth[_0xb0b6('0x9')](),controller[_0xb0b6('0xb')]);router[_0xb0b6('0x8')](_0xb0b6('0xc'),auth[_0xb0b6('0x9')](),controller[_0xb0b6('0xd')]);router[_0xb0b6('0x8')](_0xb0b6('0xe'),auth[_0xb0b6('0x9')](),controller[_0xb0b6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb0b6('0x10')]('/:id',auth[_0xb0b6('0x9')](),controller[_0xb0b6('0x11')]);router['delete'](_0xb0b6('0xc'),auth[_0xb0b6('0x9')](),controller['destroy']);module[_0xb0b6('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index a043ea0..d1277bf 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 _0x9b0d=['exports','DATE','starttime','setDataValue','endtime','format','STRING','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x144b83,_0x4e6b29){_0x144b83=_0x144b83-0x0;var _0xdfdc5b=_0x9b0d[_0x144b83];return _0xdfdc5b;};'use strict';var moment=require('moment');var Sequelize=require(_0xd9b0('0x0'));module[_0xd9b0('0x1')]={'starttime':{'type':Sequelize[_0xd9b0('0x2')],'set':function(_0x464912){this['setDataValue'](_0xd9b0('0x3'),_0x464912);this[_0xd9b0('0x4')](_0xd9b0('0x5'),moment()[_0xd9b0('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xd9b0('0x2')]},'membername':{'type':Sequelize[_0xd9b0('0x7')]},'projectname':{'type':Sequelize[_0xd9b0('0x7')]},'queue':{'type':Sequelize[_0xd9b0('0x7')]},'uniqueid':{'type':Sequelize[_0xd9b0('0x7')]},'calleridname':{'type':Sequelize[_0xd9b0('0x7')]},'calleridnum':{'type':Sequelize[_0xd9b0('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7752=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','DATE','setDataValue'];(function(_0x25b1b7,_0x3cb5ce){var _0x135066=function(_0xf3b1e5){while(--_0xf3b1e5){_0x25b1b7['push'](_0x25b1b7['shift']());}};_0x135066(++_0x3cb5ce);}(_0x7752,0x92));var _0x2775=function(_0x4f9a29,_0x4d951e){_0x4f9a29=_0x4f9a29-0x0;var _0x16bd84=_0x7752[_0x4f9a29];return _0x16bd84;};'use strict';var moment=require(_0x2775('0x0'));var Sequelize=require(_0x2775('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x2775('0x2')],'set':function(_0x205003){this[_0x2775('0x3')](_0x2775('0x4'),_0x205003);this[_0x2775('0x3')](_0x2775('0x5'),moment()[_0x2775('0x6')](_0x2775('0x7')));}},'endtime':{'type':Sequelize[_0x2775('0x2')]},'membername':{'type':Sequelize[_0x2775('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2775('0x8')]},'calleridname':{'type':Sequelize[_0x2775('0x8')]},'calleridnum':{'type':Sequelize[_0x2775('0x8')]},'completed':{'type':Sequelize[_0x2775('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7d0004c..7193dbb 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 _0xf47b=['rows','show','params','rawAttributes','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf47b,0xa7));var _0xbf47=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf47b[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf47('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbf47('0x1'));var Mustache=require(_0xbf47('0x2'));var util=require(_0xbf47('0x3'));var path=require(_0xbf47('0x4'));var sox=require(_0xbf47('0x5'));var csv=require(_0xbf47('0x6'));var ejs=require(_0xbf47('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbf47('0x8'));var crypto=require(_0xbf47('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf47('0x6'));var querystring=require(_0xbf47('0xa'));var Papa=require(_0xbf47('0xb'));var Redis=require(_0xbf47('0xc'));var authService=require(_0xbf47('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf47('0xe'));var hardwareService=require(_0xbf47('0xf'));var logger=require('../../config/logger')(_0xbf47('0x10'));var utils=require(_0xbf47('0x11'));var config=require(_0xbf47('0x12'));var licenseUtil=require(_0xbf47('0x13'));var db=require(_0xbf47('0x14'))['db'];function respondWithStatusCode(_0x2c3636,_0x3c6521){_0x3c6521=_0x3c6521||0xcc;return function(_0x33f9c1){if(_0x33f9c1){return _0x2c3636[_0xbf47('0x15')](_0x3c6521);}return _0x2c3636[_0xbf47('0x16')](_0x3c6521)[_0xbf47('0x17')]();};}function respondWithResult(_0x1027f7,_0x385e9a){_0x385e9a=_0x385e9a||0xc8;return function(_0x14e1f7){if(_0x14e1f7){return _0x1027f7[_0xbf47('0x16')](_0x385e9a)[_0xbf47('0x18')](_0x14e1f7);}};}function respondWithFilteredResult(_0x33f453,_0x4d4fe3){return function(_0x12cd6c){if(_0x12cd6c){var _0x5c75b5=typeof _0x4d4fe3[_0xbf47('0x19')]===_0xbf47('0x1a')&&typeof _0x4d4fe3[_0xbf47('0x1b')]==='undefined';var _0x1c52e0=_0x12cd6c[_0xbf47('0x1c')];var _0x148d1c=_0x5c75b5?0x0:_0x4d4fe3['offset'];var _0x5e9b9d=_0x5c75b5?_0x12cd6c[_0xbf47('0x1c')]:_0x4d4fe3[_0xbf47('0x19')]+_0x4d4fe3[_0xbf47('0x1b')];var _0x37b1a2;if(_0x5e9b9d>=_0x1c52e0){_0x5e9b9d=_0x1c52e0;_0x37b1a2=0xc8;}else{_0x37b1a2=0xce;}_0x33f453[_0xbf47('0x16')](_0x37b1a2);return _0x33f453['set']('Content-Range',_0x148d1c+'-'+_0x5e9b9d+'/'+_0x1c52e0)['json'](_0x12cd6c);}return null;};}function patchUpdates(_0x1d7ddd){return function(_0x36377b){try{jsonpatch[_0xbf47('0x1d')](_0x36377b,_0x1d7ddd,!![]);}catch(_0x223e18){return BPromise[_0xbf47('0x1e')](_0x223e18);}return _0x36377b['save']();};}function saveUpdates(_0x2a2ba1,_0x42c419){return function(_0x5975a9){if(_0x5975a9){return _0x5975a9[_0xbf47('0x1f')](_0x2a2ba1)[_0xbf47('0x20')](function(_0x1dae8e){return _0x1dae8e;});}return null;};}function removeEntity(_0xe4da8a,_0x32c2ed){return function(_0x2625e3){if(_0x2625e3){return _0x2625e3[_0xbf47('0x21')]()['then'](function(){_0xe4da8a[_0xbf47('0x16')](0xcc)[_0xbf47('0x17')]();});}};}function handleEntityNotFound(_0x2dfaa2,_0x1eb243){return function(_0xcc8034){if(!_0xcc8034){_0x2dfaa2[_0xbf47('0x15')](0x194);}return _0xcc8034;};}function handleError(_0x4a2508,_0x4ab654){_0x4ab654=_0x4ab654||0x1f4;return function(_0x1bf524){logger[_0xbf47('0x22')](_0x1bf524[_0xbf47('0x23')]);if(_0x1bf524[_0xbf47('0x24')]){delete _0x1bf524[_0xbf47('0x24')];}_0x4a2508[_0xbf47('0x16')](_0x4ab654)[_0xbf47('0x25')](_0x1bf524);};}exports['index']=function(_0x1f8374,_0x2007f8){var _0x247511={},_0x23c807={},_0x1738b2={'count':0x0,'rows':[]};var _0x382dd5=_[_0xbf47('0x26')](db[_0xbf47('0x27')]['rawAttributes'],function(_0x2215ed){return{'name':_0x2215ed[_0xbf47('0x28')],'type':_0x2215ed[_0xbf47('0x29')][_0xbf47('0x2a')]};});_0x23c807[_0xbf47('0x2b')]=_[_0xbf47('0x26')](_0x382dd5,_0xbf47('0x24'));_0x23c807[_0xbf47('0x2c')]=_[_0xbf47('0x2d')](_0x1f8374[_0xbf47('0x2c')]);_0x23c807['filters']=_[_0xbf47('0x2e')](_0x23c807['model'],_0x23c807[_0xbf47('0x2c')]);_0x247511[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x23c807[_0xbf47('0x2b')],qs[_0xbf47('0x30')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x30')]));_0x247511[_0xbf47('0x2f')]=_0x247511[_0xbf47('0x2f')][_0xbf47('0x31')]?_0x247511['attributes']:_0x23c807['model'];if(!_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x32')](_0xbf47('0x33'))){_0x247511[_0xbf47('0x1b')]=qs[_0xbf47('0x1b')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x1b')]);_0x247511[_0xbf47('0x19')]=qs[_0xbf47('0x19')](_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x19')]);}_0x247511[_0xbf47('0x34')]=qs['sort'](_0x1f8374['query'][_0xbf47('0x35')]);_0x247511[_0xbf47('0x36')]=qs['filters'](_[_0xbf47('0x37')](_0x1f8374[_0xbf47('0x2c')],_0x23c807[_0xbf47('0x38')]),_0x382dd5);if(_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x39')]){_0x247511[_0xbf47('0x36')]=_['merge'](_0x247511[_0xbf47('0x36')],{'$or':_[_0xbf47('0x26')](_0x382dd5,function(_0x4269b3){if(_0x4269b3[_0xbf47('0x29')]!==_0xbf47('0x3a')){var _0x3a8f21={};_0x3a8f21[_0x4269b3[_0xbf47('0x24')]]={'$like':'%'+_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x39')]+'%'};return _0x3a8f21;}})});}_0x247511=_[_0xbf47('0x3b')]({},_0x247511,_0x1f8374[_0xbf47('0x3c')]);var _0x1e0327={'where':_0x247511[_0xbf47('0x36')]};return db[_0xbf47('0x27')]['count'](_0x1e0327)[_0xbf47('0x20')](function(_0x3c983d){_0x1738b2['count']=_0x3c983d;if(_0x1f8374[_0xbf47('0x2c')][_0xbf47('0x3d')]){_0x247511[_0xbf47('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbf47('0x3f')](_0x247511);})['then'](function(_0x187d8c){_0x1738b2[_0xbf47('0x40')]=_0x187d8c;return _0x1738b2;})[_0xbf47('0x20')](respondWithFilteredResult(_0x2007f8,_0x247511))['catch'](handleError(_0x2007f8,null));};exports[_0xbf47('0x41')]=function(_0x22b96e,_0x5de95c){var _0x352378={'raw':!![],'where':{'id':_0x22b96e[_0xbf47('0x42')]['id']}},_0x3650e3={};_0x3650e3[_0xbf47('0x2b')]=_[_0xbf47('0x2d')](db[_0xbf47('0x27')][_0xbf47('0x43')]);_0x3650e3[_0xbf47('0x2c')]=_[_0xbf47('0x2d')](_0x22b96e[_0xbf47('0x2c')]);_0x3650e3[_0xbf47('0x38')]=_[_0xbf47('0x2e')](_0x3650e3[_0xbf47('0x2b')],_0x3650e3[_0xbf47('0x2c')]);_0x352378[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x3650e3[_0xbf47('0x2b')],qs['fields'](_0x22b96e['query'][_0xbf47('0x30')]));_0x352378[_0xbf47('0x2f')]=_0x352378[_0xbf47('0x2f')][_0xbf47('0x31')]?_0x352378[_0xbf47('0x2f')]:_0x3650e3[_0xbf47('0x2b')];if(_0x22b96e['query']['includeAll']){_0x352378[_0xbf47('0x3e')]=[{'all':!![]}];}_0x352378=_['merge']({},_0x352378,_0x22b96e[_0xbf47('0x3c')]);return db[_0xbf47('0x27')][_0xbf47('0x44')](_0x352378)[_0xbf47('0x20')](handleEntityNotFound(_0x5de95c,null))[_0xbf47('0x20')](respondWithResult(_0x5de95c,null))[_0xbf47('0x45')](handleError(_0x5de95c,null));};exports[_0xbf47('0x46')]=function(_0x5743c3,_0x52bd67){return db[_0xbf47('0x27')][_0xbf47('0x46')](_0x5743c3[_0xbf47('0x47')],{})['then'](respondWithResult(_0x52bd67,0xc9))[_0xbf47('0x45')](handleError(_0x52bd67,null));};exports['update']=function(_0x18f368,_0x9817ea){if(_0x18f368[_0xbf47('0x47')]['id']){delete _0x18f368[_0xbf47('0x47')]['id'];}return db[_0xbf47('0x27')]['find']({'where':{'id':_0x18f368[_0xbf47('0x42')]['id']}})['then'](handleEntityNotFound(_0x9817ea,null))[_0xbf47('0x20')](saveUpdates(_0x18f368['body'],null))[_0xbf47('0x20')](respondWithResult(_0x9817ea,null))[_0xbf47('0x45')](handleError(_0x9817ea,null));};exports[_0xbf47('0x21')]=function(_0x1cf839,_0x3fd55d){return db[_0xbf47('0x27')][_0xbf47('0x44')]({'where':{'id':_0x1cf839[_0xbf47('0x42')]['id']}})[_0xbf47('0x20')](handleEntityNotFound(_0x3fd55d,null))[_0xbf47('0x20')](removeEntity(_0x3fd55d,null))[_0xbf47('0x45')](handleError(_0x3fd55d,null));};exports[_0xbf47('0x48')]=function(_0x27fa90,_0x16fa14){return db['JscriptySessionReport'][_0xbf47('0x48')]()[_0xbf47('0x20')](respondWithResult(_0x16fa14,null))['catch'](handleError(_0x16fa14,null));};exports[_0xbf47('0x49')]=function(_0x26b27e,_0x1cdbdc,_0x48dcec){var _0x4cc145={'raw':!![],'where':{}};var _0x31e1fe={};var _0x38c8d7={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xbf47('0x4a')]({'where':{'id':_0x26b27e[_0xbf47('0x42')]['id']}})[_0xbf47('0x20')](handleEntityNotFound(_0x1cdbdc,null))[_0xbf47('0x20')](function(_0x218cf9){if(_0x218cf9){_0x31e1fe[_0xbf47('0x2b')]=_[_0xbf47('0x2d')](db[_0xbf47('0x4b')][_0xbf47('0x43')]);_0x31e1fe[_0xbf47('0x2c')]=_['keys'](_0x26b27e['query']);_0x31e1fe[_0xbf47('0x38')]=_[_0xbf47('0x2e')](_0x31e1fe[_0xbf47('0x2b')],_0x31e1fe['query']);_0x4cc145[_0xbf47('0x2f')]=_[_0xbf47('0x2e')](_0x31e1fe[_0xbf47('0x2b')],qs[_0xbf47('0x30')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x30')]));_0x4cc145[_0xbf47('0x2f')]=_0x4cc145['attributes']['length']?_0x4cc145[_0xbf47('0x2f')]:_0x31e1fe[_0xbf47('0x2b')];if(!_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x32')](_0xbf47('0x33'))){_0x4cc145[_0xbf47('0x1b')]=qs[_0xbf47('0x1b')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x1b')]);_0x4cc145[_0xbf47('0x19')]=qs['offset'](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x19')]);}_0x4cc145[_0xbf47('0x34')]=qs[_0xbf47('0x35')](_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x35')]);_0x4cc145[_0xbf47('0x36')]=qs['filters'](_[_0xbf47('0x37')](_0x26b27e[_0xbf47('0x2c')],_0x31e1fe[_0xbf47('0x38')]));_0x4cc145[_0xbf47('0x36')][_0xbf47('0x4c')]=_0x218cf9['id'];if(_0x26b27e[_0xbf47('0x2c')]['filter']){_0x4cc145['where']=_[_0xbf47('0x3b')](_0x4cc145['where'],{'$or':_['map'](_0x4cc145['attributes'],function(_0x3899b3){var _0x8577eb={};_0x8577eb[_0x3899b3]={'$like':'%'+_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x39')]+'%'};return _0x8577eb;})});}_0x4cc145=_[_0xbf47('0x3b')]({},_0x4cc145,_0x26b27e['options']);return db[_0xbf47('0x4b')][_0xbf47('0x1c')]({'where':_0x4cc145[_0xbf47('0x36')]})['then'](function(_0x5a1644){_0x38c8d7['count']=_0x5a1644;if(_0x26b27e[_0xbf47('0x2c')][_0xbf47('0x3d')]){_0x4cc145['include']=[{'all':!![]}];}return db[_0xbf47('0x4b')]['findAll'](_0x4cc145);})['then'](function(_0x5137f0){_0x38c8d7[_0xbf47('0x40')]=_0x5137f0;return _0x38c8d7;});}})[_0xbf47('0x20')](respondWithFilteredResult(_0x1cdbdc,_0x4cc145))[_0xbf47('0x45')](handleError(_0x1cdbdc,null));}; \ No newline at end of file +var _0x3cd9=['VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where'];(function(_0x277b86,_0x3c24fa){var _0x1ba267=function(_0x34b825){while(--_0x34b825){_0x277b86['push'](_0x277b86['shift']());}};_0x1ba267(++_0x3c24fa);}(_0x3cd9,0x179));var _0x93cd=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x3cd9[_0xf10840];return _0x1fdf7e;};'use strict';var emlformat=require(_0x93cd('0x0'));var rimraf=require(_0x93cd('0x1'));var zipdir=require(_0x93cd('0x2'));var jsonpatch=require(_0x93cd('0x3'));var rp=require('request-promise');var moment=require(_0x93cd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x93cd('0x5'));var sox=require(_0x93cd('0x6'));var csv=require(_0x93cd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93cd('0x8'));var squel=require(_0x93cd('0x9'));var crypto=require('crypto');var jsforce=require(_0x93cd('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x93cd('0x7'));var querystring=require(_0x93cd('0xb'));var Papa=require('papaparse');var Redis=require(_0x93cd('0xc'));var authService=require(_0x93cd('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93cd('0xe'));var logger=require(_0x93cd('0xf'))(_0x93cd('0x10'));var utils=require('../../config/utils');var config=require(_0x93cd('0x11'));var licenseUtil=require(_0x93cd('0x12'));var db=require(_0x93cd('0x13'))['db'];function respondWithStatusCode(_0x4b5888,_0x3f5197){_0x3f5197=_0x3f5197||0xcc;return function(_0xa5ecd3){if(_0xa5ecd3){return _0x4b5888[_0x93cd('0x14')](_0x3f5197);}return _0x4b5888[_0x93cd('0x15')](_0x3f5197)[_0x93cd('0x16')]();};}function respondWithResult(_0x36baaf,_0x542813){_0x542813=_0x542813||0xc8;return function(_0x577246){if(_0x577246){return _0x36baaf[_0x93cd('0x15')](_0x542813)[_0x93cd('0x17')](_0x577246);}};}function respondWithFilteredResult(_0x33dbaf,_0x1c5ecc){return function(_0x4895f2){if(_0x4895f2){var _0x4e287b=typeof _0x1c5ecc[_0x93cd('0x18')]===_0x93cd('0x19')&&typeof _0x1c5ecc[_0x93cd('0x1a')]==='undefined';var _0x1f870c=_0x4895f2[_0x93cd('0x1b')];var _0x583aa9=_0x4e287b?0x0:_0x1c5ecc[_0x93cd('0x18')];var _0x5157df=_0x4e287b?_0x4895f2['count']:_0x1c5ecc[_0x93cd('0x18')]+_0x1c5ecc['limit'];var _0x46c801;if(_0x5157df>=_0x1f870c){_0x5157df=_0x1f870c;_0x46c801=0xc8;}else{_0x46c801=0xce;}_0x33dbaf[_0x93cd('0x15')](_0x46c801);return _0x33dbaf[_0x93cd('0x1c')](_0x93cd('0x1d'),_0x583aa9+'-'+_0x5157df+'/'+_0x1f870c)[_0x93cd('0x17')](_0x4895f2);}return null;};}function patchUpdates(_0x1fd1f9){return function(_0x363747){try{jsonpatch['apply'](_0x363747,_0x1fd1f9,!![]);}catch(_0x16a7ea){return BPromise[_0x93cd('0x1e')](_0x16a7ea);}return _0x363747['save']();};}function saveUpdates(_0x552142,_0x51b8c9){return function(_0x2c6e83){if(_0x2c6e83){return _0x2c6e83[_0x93cd('0x1f')](_0x552142)[_0x93cd('0x20')](function(_0x1e8eb7){return _0x1e8eb7;});}return null;};}function removeEntity(_0x3c7d79,_0x32b82e){return function(_0x18110e){if(_0x18110e){return _0x18110e['destroy']()[_0x93cd('0x20')](function(){_0x3c7d79['status'](0xcc)[_0x93cd('0x16')]();});}};}function handleEntityNotFound(_0xe19292,_0x325bb3){return function(_0x47460e){if(!_0x47460e){_0xe19292[_0x93cd('0x14')](0x194);}return _0x47460e;};}function handleError(_0x433190,_0x1c5b38){_0x1c5b38=_0x1c5b38||0x1f4;return function(_0x43deb5){logger['error'](_0x43deb5[_0x93cd('0x21')]);if(_0x43deb5[_0x93cd('0x22')]){delete _0x43deb5[_0x93cd('0x22')];}_0x433190[_0x93cd('0x15')](_0x1c5b38)[_0x93cd('0x23')](_0x43deb5);};}exports[_0x93cd('0x24')]=function(_0x454d13,_0x1f98fc){var _0x11a962={},_0x33d651={},_0x5dd6de={'count':0x0,'rows':[]};var _0x13f8e1=_[_0x93cd('0x25')](db[_0x93cd('0x26')][_0x93cd('0x27')],function(_0x34cdb6){return{'name':_0x34cdb6['fieldName'],'type':_0x34cdb6[_0x93cd('0x28')][_0x93cd('0x29')]};});_0x33d651[_0x93cd('0x2a')]=_[_0x93cd('0x25')](_0x13f8e1,_0x93cd('0x22'));_0x33d651[_0x93cd('0x2b')]=_['keys'](_0x454d13[_0x93cd('0x2b')]);_0x33d651[_0x93cd('0x2c')]=_['intersection'](_0x33d651[_0x93cd('0x2a')],_0x33d651[_0x93cd('0x2b')]);_0x11a962[_0x93cd('0x2d')]=_[_0x93cd('0x2e')](_0x33d651[_0x93cd('0x2a')],qs[_0x93cd('0x2f')](_0x454d13[_0x93cd('0x2b')][_0x93cd('0x2f')]));_0x11a962['attributes']=_0x11a962[_0x93cd('0x2d')][_0x93cd('0x30')]?_0x11a962[_0x93cd('0x2d')]:_0x33d651[_0x93cd('0x2a')];if(!_0x454d13[_0x93cd('0x2b')][_0x93cd('0x31')](_0x93cd('0x32'))){_0x11a962[_0x93cd('0x1a')]=qs[_0x93cd('0x1a')](_0x454d13['query'][_0x93cd('0x1a')]);_0x11a962[_0x93cd('0x18')]=qs['offset'](_0x454d13[_0x93cd('0x2b')]['offset']);}_0x11a962['order']=qs[_0x93cd('0x33')](_0x454d13[_0x93cd('0x2b')]['sort']);_0x11a962['where']=qs[_0x93cd('0x2c')](_[_0x93cd('0x34')](_0x454d13[_0x93cd('0x2b')],_0x33d651[_0x93cd('0x2c')]),_0x13f8e1);if(_0x454d13['query'][_0x93cd('0x35')]){_0x11a962[_0x93cd('0x36')]=_['merge'](_0x11a962[_0x93cd('0x36')],{'$or':_['map'](_0x13f8e1,function(_0x3ca9be){if(_0x3ca9be['type']!==_0x93cd('0x37')){var _0x57312a={};_0x57312a[_0x3ca9be[_0x93cd('0x22')]]={'$like':'%'+_0x454d13['query']['filter']+'%'};return _0x57312a;}})});}_0x11a962=_[_0x93cd('0x38')]({},_0x11a962,_0x454d13[_0x93cd('0x39')]);var _0x5820b9={'where':_0x11a962['where']};return db[_0x93cd('0x26')][_0x93cd('0x1b')](_0x5820b9)['then'](function(_0x9398b5){_0x5dd6de[_0x93cd('0x1b')]=_0x9398b5;if(_0x454d13['query'][_0x93cd('0x3a')]){_0x11a962['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x93cd('0x3b')](_0x11a962);})['then'](function(_0x80fa19){_0x5dd6de[_0x93cd('0x3c')]=_0x80fa19;return _0x5dd6de;})['then'](respondWithFilteredResult(_0x1f98fc,_0x11a962))[_0x93cd('0x3d')](handleError(_0x1f98fc,null));};exports[_0x93cd('0x3e')]=function(_0x2ea08a,_0xfcc642){var _0x6d93b4={'raw':!![],'where':{'id':_0x2ea08a[_0x93cd('0x3f')]['id']}},_0x24e122={};_0x24e122[_0x93cd('0x2a')]=_[_0x93cd('0x40')](db[_0x93cd('0x26')][_0x93cd('0x27')]);_0x24e122[_0x93cd('0x2b')]=_[_0x93cd('0x40')](_0x2ea08a[_0x93cd('0x2b')]);_0x24e122[_0x93cd('0x2c')]=_[_0x93cd('0x2e')](_0x24e122[_0x93cd('0x2a')],_0x24e122[_0x93cd('0x2b')]);_0x6d93b4[_0x93cd('0x2d')]=_[_0x93cd('0x2e')](_0x24e122['model'],qs[_0x93cd('0x2f')](_0x2ea08a[_0x93cd('0x2b')][_0x93cd('0x2f')]));_0x6d93b4['attributes']=_0x6d93b4['attributes'][_0x93cd('0x30')]?_0x6d93b4[_0x93cd('0x2d')]:_0x24e122[_0x93cd('0x2a')];if(_0x2ea08a['query'][_0x93cd('0x3a')]){_0x6d93b4[_0x93cd('0x41')]=[{'all':!![]}];}_0x6d93b4=_[_0x93cd('0x38')]({},_0x6d93b4,_0x2ea08a[_0x93cd('0x39')]);return db['JscriptySessionReport'][_0x93cd('0x42')](_0x6d93b4)[_0x93cd('0x20')](handleEntityNotFound(_0xfcc642,null))[_0x93cd('0x20')](respondWithResult(_0xfcc642,null))[_0x93cd('0x3d')](handleError(_0xfcc642,null));};exports[_0x93cd('0x43')]=function(_0x517cca,_0x137c81){return db[_0x93cd('0x26')][_0x93cd('0x43')](_0x517cca[_0x93cd('0x44')],{})['then'](respondWithResult(_0x137c81,0xc9))[_0x93cd('0x3d')](handleError(_0x137c81,null));};exports[_0x93cd('0x1f')]=function(_0x5c3e16,_0xabb8c8){if(_0x5c3e16[_0x93cd('0x44')]['id']){delete _0x5c3e16[_0x93cd('0x44')]['id'];}return db[_0x93cd('0x26')][_0x93cd('0x42')]({'where':{'id':_0x5c3e16[_0x93cd('0x3f')]['id']}})[_0x93cd('0x20')](handleEntityNotFound(_0xabb8c8,null))['then'](saveUpdates(_0x5c3e16[_0x93cd('0x44')],null))[_0x93cd('0x20')](respondWithResult(_0xabb8c8,null))[_0x93cd('0x3d')](handleError(_0xabb8c8,null));};exports['destroy']=function(_0x121ac3,_0x554a77){return db[_0x93cd('0x26')][_0x93cd('0x42')]({'where':{'id':_0x121ac3['params']['id']}})[_0x93cd('0x20')](handleEntityNotFound(_0x554a77,null))[_0x93cd('0x20')](removeEntity(_0x554a77,null))[_0x93cd('0x3d')](handleError(_0x554a77,null));};exports['describe']=function(_0x340bc7,_0x5cb291){return db[_0x93cd('0x26')][_0x93cd('0x45')]()[_0x93cd('0x20')](respondWithResult(_0x5cb291,null))['catch'](handleError(_0x5cb291,null));};exports['getQuestions']=function(_0x28a79e,_0x4b877b,_0x343845){var _0x343984={'raw':!![],'where':{}};var _0x44991b={};var _0x22a352={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x93cd('0x46')]({'where':{'id':_0x28a79e[_0x93cd('0x3f')]['id']}})[_0x93cd('0x20')](handleEntityNotFound(_0x4b877b,null))[_0x93cd('0x20')](function(_0x73d4bc){if(_0x73d4bc){_0x44991b[_0x93cd('0x2a')]=_[_0x93cd('0x40')](db[_0x93cd('0x47')][_0x93cd('0x27')]);_0x44991b[_0x93cd('0x2b')]=_[_0x93cd('0x40')](_0x28a79e['query']);_0x44991b['filters']=_[_0x93cd('0x2e')](_0x44991b[_0x93cd('0x2a')],_0x44991b[_0x93cd('0x2b')]);_0x343984[_0x93cd('0x2d')]=_[_0x93cd('0x2e')](_0x44991b[_0x93cd('0x2a')],qs[_0x93cd('0x2f')](_0x28a79e[_0x93cd('0x2b')]['fields']));_0x343984[_0x93cd('0x2d')]=_0x343984[_0x93cd('0x2d')][_0x93cd('0x30')]?_0x343984['attributes']:_0x44991b['model'];if(!_0x28a79e[_0x93cd('0x2b')][_0x93cd('0x31')](_0x93cd('0x32'))){_0x343984[_0x93cd('0x1a')]=qs[_0x93cd('0x1a')](_0x28a79e[_0x93cd('0x2b')][_0x93cd('0x1a')]);_0x343984[_0x93cd('0x18')]=qs[_0x93cd('0x18')](_0x28a79e[_0x93cd('0x2b')][_0x93cd('0x18')]);}_0x343984['order']=qs[_0x93cd('0x33')](_0x28a79e['query']['sort']);_0x343984[_0x93cd('0x36')]=qs[_0x93cd('0x2c')](_[_0x93cd('0x34')](_0x28a79e[_0x93cd('0x2b')],_0x44991b[_0x93cd('0x2c')]));_0x343984[_0x93cd('0x36')]['SessionId']=_0x73d4bc['id'];if(_0x28a79e[_0x93cd('0x2b')][_0x93cd('0x35')]){_0x343984[_0x93cd('0x36')]=_[_0x93cd('0x38')](_0x343984['where'],{'$or':_[_0x93cd('0x25')](_0x343984['attributes'],function(_0x49217b){var _0x535d93={};_0x535d93[_0x49217b]={'$like':'%'+_0x28a79e['query'][_0x93cd('0x35')]+'%'};return _0x535d93;})});}_0x343984=_['merge']({},_0x343984,_0x28a79e[_0x93cd('0x39')]);return db[_0x93cd('0x47')][_0x93cd('0x1b')]({'where':_0x343984[_0x93cd('0x36')]})[_0x93cd('0x20')](function(_0x18ca57){_0x22a352[_0x93cd('0x1b')]=_0x18ca57;if(_0x28a79e['query'][_0x93cd('0x3a')]){_0x343984[_0x93cd('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x93cd('0x3b')](_0x343984);})[_0x93cd('0x20')](function(_0x130a59){_0x22a352[_0x93cd('0x3c')]=_0x130a59;return _0x22a352;});}})[_0x93cd('0x20')](respondWithFilteredResult(_0x4b877b,_0x343984))[_0x93cd('0x3d')](handleError(_0x4b877b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0e6b75e..e6e8d1b 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 _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x373496,_0x4c8340){var _0x310579=function(_0x143215){while(--_0x143215){_0x373496['push'](_0x373496['shift']());}};_0x310579(++_0x4c8340);}(_0xb138,0x1dd));var _0x8b13=function(_0x452b6,_0x32473d){_0x452b6=_0x452b6-0x0;var _0x37605f=_0xb138[_0x452b6];return _0x37605f;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a8757,_0x4bafdf){var _0x350c00=function(_0x567a4d){while(--_0x567a4d){_0x2a8757['push'](_0x2a8757['shift']());}};_0x350c00(++_0x4bafdf);}(_0x4975,0x86));var _0x5497=function(_0x934d30,_0x1bda4d){_0x934d30=_0x934d30-0x0;var _0x45e0f8=_0x4975[_0x934d30];return _0x45e0f8;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0050cea..e2b8c70 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 _0x2da6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x2da6,0x1dd));var _0x62da=function(_0xbce6f6,_0x3a318a){_0xbce6f6=_0xbce6f6-0x0;var _0x24ff2e=_0x2da6[_0xbce6f6];return _0x24ff2e;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});} \ No newline at end of file +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4476c7,_0x48ed6d){var _0x2c47c5=function(_0x39ad83){while(--_0x39ad83){_0x4476c7['push'](_0x4476c7['shift']());}};_0x2c47c5(++_0x48ed6d);}(_0x33af,0xec));var _0xf33a=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x33af[_0x52598d];return _0x170309;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 0a8592b..822c49e 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 _0x2eb5=['/download_log_file','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update'];(function(_0x9bf8e3,_0x3d1853){var _0x25d637=function(_0xe054d3){while(--_0xe054d3){_0x9bf8e3['push'](_0x9bf8e3['shift']());}};_0x25d637(++_0x3d1853);}(_0x2eb5,0x1f0));var _0x52eb=function(_0x26bd26,_0x1ea668){_0x26bd26=_0x26bd26-0x0;var _0x487b2a=_0x2eb5[_0x26bd26];return _0x487b2a;};'use strict';var multer=require(_0x52eb('0x0'));var util=require(_0x52eb('0x1'));var path=require(_0x52eb('0x2'));var timeout=require(_0x52eb('0x3'));var express=require('express');var router=express[_0x52eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x52eb('0x5'));var interaction=require(_0x52eb('0x6'));var config=require(_0x52eb('0x7'));var controller=require(_0x52eb('0x8'));router[_0x52eb('0x9')]('/',controller['index']);router[_0x52eb('0xa')](_0x52eb('0xb'),auth[_0x52eb('0xc')](),controller[_0x52eb('0xd')]);router[_0x52eb('0x9')](_0x52eb('0xe'),auth[_0x52eb('0xc')](),controller['downloadLogFile']);module['exports']=router; \ No newline at end of file +var _0x7052=['isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./license.controller','index','put','/:id'];(function(_0x56b034,_0xb96f9b){var _0x25f338=function(_0x4134cd){while(--_0x4134cd){_0x56b034['push'](_0x56b034['shift']());}};_0x25f338(++_0xb96f9b);}(_0x7052,0x114));var _0x2705=function(_0x49a1a0,_0x48f776){_0x49a1a0=_0x49a1a0-0x0;var _0x518a4f=_0x7052[_0x49a1a0];return _0x518a4f;};'use strict';var multer=require(_0x2705('0x0'));var util=require('util');var path=require(_0x2705('0x1'));var timeout=require(_0x2705('0x2'));var express=require(_0x2705('0x3'));var router=express[_0x2705('0x4')]();var fs_extra=require(_0x2705('0x5'));var auth=require(_0x2705('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2705('0x7'));var controller=require(_0x2705('0x8'));router['get']('/',controller[_0x2705('0x9')]);router[_0x2705('0xa')](_0x2705('0xb'),auth[_0x2705('0xc')](),controller[_0x2705('0xd')]);router[_0x2705('0xe')](_0x2705('0xf'),auth['isAuthenticated'](),controller[_0x2705('0x10')]);module[_0x2705('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 03ca9e4..e13d942 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 _0x6a4c=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x56de3f,_0x3c430f){var _0x14e442=function(_0x336e8d){while(--_0x336e8d){_0x56de3f['push'](_0x56de3f['shift']());}};_0x14e442(++_0x3c430f);}(_0x6a4c,0x93));var _0xc6a4=function(_0x21fce2,_0x59a075){_0x21fce2=_0x21fce2-0x0;var _0x30f704=_0x6a4c[_0x21fce2];return _0x30f704;};'use strict';var Sequelize=require(_0xc6a4('0x0'));module[_0xc6a4('0x1')]={'license':{'type':Sequelize[_0xc6a4('0x2')]},'data1':{'type':Sequelize[_0xc6a4('0x3')]},'data2':{'type':Sequelize[_0xc6a4('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xc6a4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c83=['STRING','INTEGER','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c83,0x11f));var _0x33c8=function(_0x301778,_0xda3ce0){_0x301778=_0x301778-0x0;var _0x774ad5=_0x3c83[_0x301778];return _0x774ad5;};'use strict';var Sequelize=require('sequelize');module[_0x33c8('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x33c8('0x1')]},'data2':{'type':Sequelize[_0x33c8('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x33c8('0x2')],'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 04ed984..ade5393 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 _0x7433=['request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','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','limit','count','set','Content-Range','update','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','then','catch','body','params','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch'];(function(_0x33e393,_0x44ba2e){var _0x182281=function(_0x222c6b){while(--_0x222c6b){_0x33e393['push'](_0x33e393['shift']());}};_0x182281(++_0x44ba2e);}(_0x7433,0x1e7));var _0x3743=function(_0x3d7add,_0x37bdfe){_0x3d7add=_0x3d7add-0x0;var _0x55e63b=_0x7433[_0x3d7add];return _0x55e63b;};'use strict';var emlformat=require(_0x3743('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3743('0x1'));var jsonpatch=require(_0x3743('0x2'));var rp=require(_0x3743('0x3'));var moment=require('moment');var BPromise=require(_0x3743('0x4'));var Mustache=require(_0x3743('0x5'));var util=require(_0x3743('0x6'));var path=require(_0x3743('0x7'));var sox=require(_0x3743('0x8'));var csv=require('to-csv');var ejs=require(_0x3743('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3743('0xa'));var squel=require(_0x3743('0xb'));var crypto=require('crypto');var jsforce=require(_0x3743('0xc'));var deskjs=require(_0x3743('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3743('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3743('0xf'));var as=require(_0x3743('0x10'));var hardwareService=require(_0x3743('0x11'));var logger=require(_0x3743('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3743('0x13'));var licenseUtil=require(_0x3743('0x14'));var db=require(_0x3743('0x15'))['db'];function respondWithStatusCode(_0x3c7ce7,_0x374bb0){_0x374bb0=_0x374bb0||0xcc;return function(_0x33fb88){if(_0x33fb88){return _0x3c7ce7[_0x3743('0x16')](_0x374bb0);}return _0x3c7ce7[_0x3743('0x17')](_0x374bb0)[_0x3743('0x18')]();};}function respondWithResult(_0x54d297,_0x5da0e7){_0x5da0e7=_0x5da0e7||0xc8;return function(_0x1656d3){if(_0x1656d3){return _0x54d297[_0x3743('0x17')](_0x5da0e7)[_0x3743('0x19')](_0x1656d3);}};}function respondWithFilteredResult(_0x114d07,_0x3ea89b){return function(_0x3f0bb3){if(_0x3f0bb3){var _0x1ae62a=typeof _0x3ea89b[_0x3743('0x1a')]===_0x3743('0x1b')&&typeof _0x3ea89b[_0x3743('0x1c')]==='undefined';var _0x5e0d69=_0x3f0bb3[_0x3743('0x1d')];var _0x31227f=_0x1ae62a?0x0:_0x3ea89b[_0x3743('0x1a')];var _0x150615=_0x1ae62a?_0x3f0bb3['count']:_0x3ea89b['offset']+_0x3ea89b[_0x3743('0x1c')];var _0x30c426;if(_0x150615>=_0x5e0d69){_0x150615=_0x5e0d69;_0x30c426=0xc8;}else{_0x30c426=0xce;}_0x114d07[_0x3743('0x17')](_0x30c426);return _0x114d07[_0x3743('0x1e')](_0x3743('0x1f'),_0x31227f+'-'+_0x150615+'/'+_0x5e0d69)['json'](_0x3f0bb3);}return null;};}function patchUpdates(_0x347f87){return function(_0x5f48e7){try{jsonpatch['apply'](_0x5f48e7,_0x347f87,!![]);}catch(_0x44136c){return BPromise['reject'](_0x44136c);}return _0x5f48e7['save']();};}function saveUpdates(_0x20cad9,_0x8e6c59){return function(_0x96a803){if(_0x96a803){return _0x96a803[_0x3743('0x20')](_0x20cad9)['then'](function(_0x2c77ad){return _0x2c77ad;});}return null;};}function removeEntity(_0x3a5fcc,_0x3a56e5){return function(_0x1cf884){if(_0x1cf884){return _0x1cf884[_0x3743('0x21')]()['then'](function(){_0x3a5fcc[_0x3743('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31410f,_0x12dc09){return function(_0x94d42c){if(!_0x94d42c){_0x31410f[_0x3743('0x16')](0x194);}return _0x94d42c;};}function handleError(_0x34a9ff,_0x4beecd){_0x4beecd=_0x4beecd||0x1f4;return function(_0x40dc72){logger[_0x3743('0x22')](_0x40dc72[_0x3743('0x23')]);if(_0x40dc72[_0x3743('0x24')]){delete _0x40dc72[_0x3743('0x24')];}_0x34a9ff[_0x3743('0x17')](_0x4beecd)[_0x3743('0x25')](_0x40dc72);};}var utilLicense=require(_0x3743('0x14'));exports[_0x3743('0x26')]=function(_0x2d34f1,_0xc4a641){var _0x518525={'raw':!![],'where':{'id':0x1}},_0x13c55b={};_0x13c55b[_0x3743('0x27')]=_[_0x3743('0x28')](db[_0x3743('0x29')][_0x3743('0x2a')]);_0x13c55b[_0x3743('0x2b')]=_['keys'](_0x2d34f1[_0x3743('0x2b')]);_0x13c55b[_0x3743('0x2c')]=_[_0x3743('0x2d')](_0x13c55b[_0x3743('0x27')],_0x13c55b[_0x3743('0x2b')]);_0x518525['attributes']=_['intersection'](_0x13c55b[_0x3743('0x27')],qs[_0x3743('0x2e')](_0x2d34f1[_0x3743('0x2b')]['fields']));_0x518525[_0x3743('0x2f')]=_0x518525[_0x3743('0x2f')][_0x3743('0x30')]?_0x518525[_0x3743('0x2f')]:_0x13c55b[_0x3743('0x27')];_0x518525=_['merge']({},_0x518525,_0x2d34f1[_0x3743('0x31')]);return utilLicense[_0x3743('0x32')](_0x518525)[_0x3743('0x33')](respondWithResult(_0xc4a641,null))[_0x3743('0x34')](handleError(_0xc4a641,null));};exports[_0x3743('0x20')]=function(_0x4436cc,_0x13e4be){if(_0x4436cc[_0x3743('0x35')]['id']){delete _0x4436cc[_0x3743('0x35')]['id'];}return db[_0x3743('0x29')]['find']({'where':{'id':_0x4436cc[_0x3743('0x36')]['id']}})[_0x3743('0x33')](handleEntityNotFound(_0x13e4be,null))[_0x3743('0x33')](function(_0x282ab4){var _0x3d414c=_0x282ab4[_0x3743('0x37')]({'plain':!![]});return utilLicense[_0x3743('0x38')](_0x3d414c,_0x4436cc[_0x3743('0x35')][_0x3743('0x39')]);})[_0x3743('0x33')](function(_0x329757){if(!_0x329757[_0x3743('0x3a')]){return saveUpdates(_0x4436cc[_0x3743('0x35')],null);}return _0x329757;})[_0x3743('0x33')](respondWithResult(_0x13e4be,null))['catch'](handleError(_0x13e4be,null));};exports['downloadLogFile']=function(_0x3aeb58,_0xa4b7b3){var _0x104145=_0x3743('0x3b');var _0x3d8fe2=path[_0x3743('0x3c')](_0x3743('0x3d'),_0x3743('0x3e'),_0x3743('0x3f'),_0x104145);_0xa4b7b3[_0x3743('0x40')](_0x3743('0x41'),_0x3743('0x42')+_0x104145);_0xa4b7b3[_0x3743('0x1e')](_0x3743('0x43'),_0x3743('0x44'));_0xa4b7b3[_0x3743('0x45')](_0x3d8fe2);}; \ No newline at end of file +var _0xd589=['join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','catch','body','find','params','checkLicense','demo','downloadLogFile','license-info.log'];(function(_0x4379b5,_0x48d9ce){var _0x370d4f=function(_0x4ab2d1){while(--_0x4ab2d1){_0x4379b5['push'](_0x4379b5['shift']());}};_0x370d4f(++_0x48d9ce);}(_0xd589,0x132));var _0x9d58=function(_0x23a3cd,_0x17bea7){_0x23a3cd=_0x23a3cd-0x0;var _0x556568=_0xd589[_0x23a3cd];return _0x556568;};'use strict';var emlformat=require(_0x9d58('0x0'));var rimraf=require(_0x9d58('0x1'));var zipdir=require(_0x9d58('0x2'));var jsonpatch=require(_0x9d58('0x3'));var rp=require(_0x9d58('0x4'));var moment=require('moment');var BPromise=require(_0x9d58('0x5'));var Mustache=require(_0x9d58('0x6'));var util=require(_0x9d58('0x7'));var path=require(_0x9d58('0x8'));var sox=require('sox');var csv=require(_0x9d58('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d58('0xa'));var _=require('lodash');var squel=require(_0x9d58('0xb'));var crypto=require(_0x9d58('0xc'));var jsforce=require(_0x9d58('0xd'));var deskjs=require(_0x9d58('0xe'));var toCsv=require(_0x9d58('0x9'));var querystring=require(_0x9d58('0xf'));var Papa=require(_0x9d58('0x10'));var Redis=require(_0x9d58('0x11'));var authService=require(_0x9d58('0x12'));var qs=require(_0x9d58('0x13'));var as=require(_0x9d58('0x14'));var hardwareService=require(_0x9d58('0x15'));var logger=require(_0x9d58('0x16'))('api');var utils=require(_0x9d58('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9d58('0x18'));var db=require(_0x9d58('0x19'))['db'];function respondWithStatusCode(_0x9d3b10,_0x293349){_0x293349=_0x293349||0xcc;return function(_0x33a62b){if(_0x33a62b){return _0x9d3b10[_0x9d58('0x1a')](_0x293349);}return _0x9d3b10[_0x9d58('0x1b')](_0x293349)[_0x9d58('0x1c')]();};}function respondWithResult(_0x4e2d79,_0x12c8bb){_0x12c8bb=_0x12c8bb||0xc8;return function(_0x2f1954){if(_0x2f1954){return _0x4e2d79['status'](_0x12c8bb)['json'](_0x2f1954);}};}function respondWithFilteredResult(_0x237123,_0x189335){return function(_0x44deff){if(_0x44deff){var _0x4a0923=typeof _0x189335['offset']===_0x9d58('0x1d')&&typeof _0x189335['limit']===_0x9d58('0x1d');var _0x4e6b3e=_0x44deff[_0x9d58('0x1e')];var _0x39bdcc=_0x4a0923?0x0:_0x189335[_0x9d58('0x1f')];var _0x3ad693=_0x4a0923?_0x44deff['count']:_0x189335[_0x9d58('0x1f')]+_0x189335[_0x9d58('0x20')];var _0x40fc16;if(_0x3ad693>=_0x4e6b3e){_0x3ad693=_0x4e6b3e;_0x40fc16=0xc8;}else{_0x40fc16=0xce;}_0x237123[_0x9d58('0x1b')](_0x40fc16);return _0x237123[_0x9d58('0x21')](_0x9d58('0x22'),_0x39bdcc+'-'+_0x3ad693+'/'+_0x4e6b3e)[_0x9d58('0x23')](_0x44deff);}return null;};}function patchUpdates(_0x296d23){return function(_0x4d0552){try{jsonpatch[_0x9d58('0x24')](_0x4d0552,_0x296d23,!![]);}catch(_0x28f97c){return BPromise['reject'](_0x28f97c);}return _0x4d0552[_0x9d58('0x25')]();};}function saveUpdates(_0x22f95b,_0x2e532c){return function(_0x4acc19){if(_0x4acc19){return _0x4acc19['update'](_0x22f95b)[_0x9d58('0x26')](function(_0x18a763){return _0x18a763;});}return null;};}function removeEntity(_0x2c1eaf,_0x4539fb){return function(_0x238196){if(_0x238196){return _0x238196[_0x9d58('0x27')]()[_0x9d58('0x26')](function(){_0x2c1eaf[_0x9d58('0x1b')](0xcc)[_0x9d58('0x1c')]();});}};}function handleEntityNotFound(_0x1f1888,_0x275e59){return function(_0x4e198a){if(!_0x4e198a){_0x1f1888[_0x9d58('0x1a')](0x194);}return _0x4e198a;};}function handleError(_0x4b53de,_0xf1cdd4){_0xf1cdd4=_0xf1cdd4||0x1f4;return function(_0x5827d7){logger[_0x9d58('0x28')](_0x5827d7[_0x9d58('0x29')]);if(_0x5827d7[_0x9d58('0x2a')]){delete _0x5827d7[_0x9d58('0x2a')];}_0x4b53de[_0x9d58('0x1b')](_0xf1cdd4)['send'](_0x5827d7);};}var utilLicense=require(_0x9d58('0x18'));exports[_0x9d58('0x2b')]=function(_0x28eddb,_0x426225){var _0x77a0b9={'raw':!![],'where':{'id':0x1}},_0x2c9337={};_0x2c9337[_0x9d58('0x2c')]=_[_0x9d58('0x2d')](db[_0x9d58('0x2e')][_0x9d58('0x2f')]);_0x2c9337[_0x9d58('0x30')]=_[_0x9d58('0x2d')](_0x28eddb['query']);_0x2c9337[_0x9d58('0x31')]=_[_0x9d58('0x32')](_0x2c9337[_0x9d58('0x2c')],_0x2c9337[_0x9d58('0x30')]);_0x77a0b9[_0x9d58('0x33')]=_[_0x9d58('0x32')](_0x2c9337[_0x9d58('0x2c')],qs[_0x9d58('0x34')](_0x28eddb[_0x9d58('0x30')][_0x9d58('0x34')]));_0x77a0b9[_0x9d58('0x33')]=_0x77a0b9[_0x9d58('0x33')][_0x9d58('0x35')]?_0x77a0b9[_0x9d58('0x33')]:_0x2c9337[_0x9d58('0x2c')];_0x77a0b9=_[_0x9d58('0x36')]({},_0x77a0b9,_0x28eddb[_0x9d58('0x37')]);return utilLicense['getLicense'](_0x77a0b9)[_0x9d58('0x26')](respondWithResult(_0x426225,null))[_0x9d58('0x38')](handleError(_0x426225,null));};exports['update']=function(_0x1870b8,_0x3e8780){if(_0x1870b8[_0x9d58('0x39')]['id']){delete _0x1870b8[_0x9d58('0x39')]['id'];}return db['License'][_0x9d58('0x3a')]({'where':{'id':_0x1870b8[_0x9d58('0x3b')]['id']}})[_0x9d58('0x26')](handleEntityNotFound(_0x3e8780,null))[_0x9d58('0x26')](function(_0x186640){var _0x1fdd26=_0x186640['get']({'plain':!![]});return utilLicense[_0x9d58('0x3c')](_0x1fdd26,_0x1870b8['body']['key']);})[_0x9d58('0x26')](function(_0x3ae7a3){if(!_0x3ae7a3[_0x9d58('0x3d')]){return saveUpdates(_0x1870b8['body'],null);}return _0x3ae7a3;})[_0x9d58('0x26')](respondWithResult(_0x3e8780,null))[_0x9d58('0x38')](handleError(_0x3e8780,null));};exports[_0x9d58('0x3e')]=function(_0x1a7728,_0x404ffa){var _0x456b27=_0x9d58('0x3f');var _0x55e835=path[_0x9d58('0x40')](_0x9d58('0x41'),_0x9d58('0x42'),_0x9d58('0x43'),_0x456b27);_0x404ffa[_0x9d58('0x44')](_0x9d58('0x45'),_0x9d58('0x46')+_0x456b27);_0x404ffa[_0x9d58('0x21')](_0x9d58('0x47'),_0x9d58('0x48'));_0x404ffa[_0x9d58('0x49')](_0x55e835);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d19ff58..5d5d662 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 _0xbd42=['moment','bluebird','request-promise','define','License','license','util','../../config/logger','api'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0xbd42,0x1c8));var _0x2bd4=function(_0x5cd66b,_0x456626){_0x5cd66b=_0x5cd66b-0x0;var _0x212c9e=_0xbd42[_0x5cd66b];return _0x212c9e;};'use strict';var _=require('lodash');var util=require(_0x2bd4('0x0'));var logger=require(_0x2bd4('0x1'))(_0x2bd4('0x2'));var moment=require(_0x2bd4('0x3'));var BPromise=require(_0x2bd4('0x4'));var rp=require(_0x2bd4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x179d24,_0x239f0a){return _0x179d24[_0x2bd4('0x6')](_0x2bd4('0x7'),attributes,{'tableName':_0x2bd4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e7=['exports','define','License','license','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0x11a788,_0x21f4d7){var _0x51b23b=function(_0x478f65){while(--_0x478f65){_0x11a788['push'](_0x11a788['shift']());}};_0x51b23b(++_0x21f4d7);}(_0xa9e7,0x19a));var _0x7a9e=function(_0x44bf47,_0x23b58b){_0x44bf47=_0x44bf47-0x0;var _0x43c7e2=_0xa9e7[_0x44bf47];return _0x43c7e2;};'use strict';var _=require(_0x7a9e('0x0'));var util=require(_0x7a9e('0x1'));var logger=require('../../config/logger')(_0x7a9e('0x2'));var moment=require(_0x7a9e('0x3'));var BPromise=require(_0x7a9e('0x4'));var rp=require(_0x7a9e('0x5'));var fs=require('fs');var path=require(_0x7a9e('0x6'));var rimraf=require(_0x7a9e('0x7'));var config=require(_0x7a9e('0x8'));var attributes=require(_0x7a9e('0x9'));module[_0x7a9e('0xa')]=function(_0x33e018,_0x2eef37){return _0x33e018[_0x7a9e('0xb')](_0x7a9e('0xc'),attributes,{'tableName':_0x7a9e('0xd'),'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 ee6f68d..f041ca5 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 _0x2655=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x41fced,_0x151348){var _0x399570=function(_0x34168a){while(--_0x34168a){_0x41fced['push'](_0x41fced['shift']());}};_0x399570(++_0x151348);}(_0x2655,0x1c6));var _0x5265=function(_0x213b79,_0x445b0f){_0x213b79=_0x213b79-0x0;var _0x6f1880=_0x2655[_0x213b79];return _0x6f1880;};'use strict';var _=require(_0x5265('0x0'));var util=require(_0x5265('0x1'));var moment=require(_0x5265('0x2'));var BPromise=require(_0x5265('0x3'));var rs=require(_0x5265('0x4'));var fs=require('fs');var Redis=require(_0x5265('0x5'));var db=require(_0x5265('0x6'))['db'];var utils=require(_0x5265('0x7'));var logger=require(_0x5265('0x8'))(_0x5265('0x9'));var config=require(_0x5265('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5265('0xb')][_0x5265('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e6f23,_0xe87a5a,_0x4579fb){return new BPromise(function(_0x57f21f,_0x3ad3ae){return client[_0x5265('0xd')](_0x3e6f23,_0x4579fb)['then'](function(_0x5ee66a){logger['info'](_0x5265('0xe'),_0xe87a5a,_0x5265('0xf'));logger['debug'](_0x5265('0x10'),_0xe87a5a,_0x5265('0xf'),JSON[_0x5265('0x11')](_0x5ee66a));if(_0x5ee66a[_0x5265('0x12')]){if(_0x5ee66a[_0x5265('0x12')][_0x5265('0x13')]===0x1f4){logger[_0x5265('0x12')]('License,\x20%s,\x20%s',_0xe87a5a,_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);return _0x3ad3ae(_0x5ee66a[_0x5265('0x12')]['message']);}logger[_0x5265('0x12')](_0x5265('0xe'),_0xe87a5a,_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);return _0x57f21f(_0x5ee66a[_0x5265('0x12')][_0x5265('0x14')]);}else{logger[_0x5265('0x15')](_0x5265('0xe'),_0xe87a5a,_0x5265('0xf'));_0x57f21f(_0x5ee66a[_0x5265('0x16')][_0x5265('0x14')]);}})[_0x5265('0x17')](function(_0x1b08c7){logger[_0x5265('0x12')](_0x5265('0xe'),_0xe87a5a,_0x1b08c7);_0x3ad3ae(_0x1b08c7);});});} \ No newline at end of file +var _0x35f0=['stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x4fa343,_0x16afbc){var _0x51e87a=function(_0x59636c){while(--_0x59636c){_0x4fa343['push'](_0x4fa343['shift']());}};_0x51e87a(++_0x16afbc);}(_0x35f0,0xec));var _0x035f=function(_0x2f33f2,_0x500e2b){_0x2f33f2=_0x2f33f2-0x0;var _0xcac7a5=_0x35f0[_0x2f33f2];return _0xcac7a5;};'use strict';var _=require(_0x035f('0x0'));var util=require(_0x035f('0x1'));var moment=require(_0x035f('0x2'));var BPromise=require(_0x035f('0x3'));var rs=require(_0x035f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x035f('0x5'))(_0x035f('0x6'));var config=require(_0x035f('0x7'));var jayson=require(_0x035f('0x8'));var client=jayson[_0x035f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dbf3c,_0xbe73ce,_0x1b827c){return new BPromise(function(_0x39298b,_0xfcac4a){return client['request'](_0x5dbf3c,_0x1b827c)[_0x035f('0xa')](function(_0x4cc35d){logger[_0x035f('0xb')](_0x035f('0xc'),_0xbe73ce,_0x035f('0xd'));logger[_0x035f('0xe')](_0x035f('0xf'),_0xbe73ce,_0x035f('0xd'),JSON[_0x035f('0x10')](_0x4cc35d));if(_0x4cc35d['error']){if(_0x4cc35d['error'][_0x035f('0x11')]===0x1f4){logger[_0x035f('0x12')](_0x035f('0xc'),_0xbe73ce,_0x4cc35d[_0x035f('0x12')]['message']);return _0xfcac4a(_0x4cc35d[_0x035f('0x12')][_0x035f('0x13')]);}logger[_0x035f('0x12')](_0x035f('0xc'),_0xbe73ce,_0x4cc35d[_0x035f('0x12')]['message']);return _0x39298b(_0x4cc35d[_0x035f('0x12')][_0x035f('0x13')]);}else{logger[_0x035f('0xb')](_0x035f('0xc'),_0xbe73ce,_0x035f('0xd'));_0x39298b(_0x4cc35d['result'][_0x035f('0x13')]);}})[_0x035f('0x14')](function(_0x2af400){logger[_0x035f('0x12')](_0x035f('0xc'),_0xbe73ce,_0x2af400);_0xfcac4a(_0x2af400);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 60beb68..12825af 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 _0x0ba6=['describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x15185f,_0x2003a5){var _0x3c9c47=function(_0x2862f7){while(--_0x2862f7){_0x15185f['push'](_0x15185f['shift']());}};_0x3c9c47(++_0x2003a5);}(_0x0ba6,0x1df));var _0x60ba=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x0ba6[_0x409353];return _0x4f4b59;};'use strict';var multer=require(_0x60ba('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x60ba('0x1')]();var fs_extra=require(_0x60ba('0x2'));var auth=require(_0x60ba('0x3'));var interaction=require(_0x60ba('0x4'));var config=require(_0x60ba('0x5'));var controller=require(_0x60ba('0x6'));router[_0x60ba('0x7')]('/',auth[_0x60ba('0x8')](),controller[_0x60ba('0x9')]);router[_0x60ba('0x7')](_0x60ba('0xa'),auth['isAuthenticated'](),controller[_0x60ba('0xb')]);router[_0x60ba('0x7')](_0x60ba('0xc'),auth['isAuthenticated'](),controller[_0x60ba('0xd')]);router[_0x60ba('0x7')]('/:id/dispositions',auth[_0x60ba('0x8')](),controller[_0x60ba('0xe')]);router[_0x60ba('0x7')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x10')]);router['get'](_0x60ba('0x11'),auth[_0x60ba('0x8')](),controller['getImap']);router['get'](_0x60ba('0x12'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x13')]);router['get'](_0x60ba('0x14'),auth['isAuthenticated'](),controller[_0x60ba('0x15')]);router[_0x60ba('0x7')]('/:id/applications',auth[_0x60ba('0x8')](),controller[_0x60ba('0x16')]);router['get'](_0x60ba('0x17'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x18')]);router[_0x60ba('0x7')](_0x60ba('0x19'),auth['isAuthenticated'](),controller[_0x60ba('0x1a')]);router[_0x60ba('0x7')]('/:id/users',auth[_0x60ba('0x8')](),controller[_0x60ba('0x1b')]);router[_0x60ba('0x1c')](_0x60ba('0x1d'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x1e')]);router[_0x60ba('0x1c')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller[_0x60ba('0x20')]);router[_0x60ba('0x1c')](_0x60ba('0x11'),auth['isAuthenticated'](),controller[_0x60ba('0x21')]);router[_0x60ba('0x1c')](_0x60ba('0x12'),auth[_0x60ba('0x8')](),controller['addSmtp']);router[_0x60ba('0x1c')](_0x60ba('0x14'),auth['isAuthenticated'](),controller[_0x60ba('0x22')]);router[_0x60ba('0x1c')](_0x60ba('0x23'),auth['isAuthenticated'](),controller[_0x60ba('0x24')]);router[_0x60ba('0x1c')](_0x60ba('0x25'),auth['isAuthenticated'](),controller[_0x60ba('0x26')]);router[_0x60ba('0x1c')](_0x60ba('0x27'),auth['isAuthenticated'](),controller[_0x60ba('0x28')]);router[_0x60ba('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x60ba('0x2a')]);router[_0x60ba('0x2b')](_0x60ba('0x1d'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2c')]);router[_0x60ba('0x2b')](_0x60ba('0xf'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2d')]);router[_0x60ba('0x2b')](_0x60ba('0x11'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x2e')]);router[_0x60ba('0x2b')]('/:id/out_servers',auth[_0x60ba('0x8')](),controller[_0x60ba('0x2f')]);router[_0x60ba('0x2b')]('/:id',auth[_0x60ba('0x8')](),controller['destroy']);router[_0x60ba('0x2b')](_0x60ba('0x27'),auth[_0x60ba('0x8')](),controller[_0x60ba('0x30')]);module['exports']=router; \ No newline at end of file +var _0x7722=['describe','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/in_servers','addSmtp','/:id/interactions','addInteraction','/:id/send','addAgents','put','/:id','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x7722,0x17a));var _0x2772=function(_0x4af393,_0x4b6a2e){_0x4af393=_0x4af393-0x0;var _0x582dc3=_0x7722[_0x4af393];return _0x582dc3;};'use strict';var multer=require(_0x2772('0x0'));var util=require('util');var path=require(_0x2772('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2772('0x2')]();var fs_extra=require(_0x2772('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2772('0x4'));var config=require(_0x2772('0x5'));var controller=require(_0x2772('0x6'));router[_0x2772('0x7')]('/',auth[_0x2772('0x8')](),controller['index']);router['get']('/describe',auth[_0x2772('0x8')](),controller[_0x2772('0x9')]);router[_0x2772('0x7')]('/:id',auth[_0x2772('0x8')](),controller['show']);router[_0x2772('0x7')]('/:id/dispositions',auth[_0x2772('0x8')](),controller['getDispositions']);router[_0x2772('0x7')]('/:id/canned_answers',auth[_0x2772('0x8')](),controller[_0x2772('0xa')]);router[_0x2772('0x7')]('/:id/in_servers',auth[_0x2772('0x8')](),controller[_0x2772('0xb')]);router[_0x2772('0x7')](_0x2772('0xc'),auth[_0x2772('0x8')](),controller[_0x2772('0xd')]);router[_0x2772('0x7')]('/:id/interactions',auth[_0x2772('0x8')](),controller[_0x2772('0xe')]);router['get'](_0x2772('0xf'),auth[_0x2772('0x8')](),controller[_0x2772('0x10')]);router[_0x2772('0x7')](_0x2772('0x11'),auth[_0x2772('0x8')](),controller[_0x2772('0x12')]);router[_0x2772('0x7')]('/:id/verify',auth[_0x2772('0x8')](),controller[_0x2772('0x13')]);router[_0x2772('0x7')](_0x2772('0x14'),auth[_0x2772('0x8')](),controller[_0x2772('0x15')]);router[_0x2772('0x16')](_0x2772('0x17'),auth[_0x2772('0x8')](),controller[_0x2772('0x18')]);router[_0x2772('0x16')](_0x2772('0x19'),auth[_0x2772('0x8')](),controller[_0x2772('0x1a')]);router['post']('/',auth[_0x2772('0x8')](),controller['create']);router[_0x2772('0x16')](_0x2772('0x1b'),auth[_0x2772('0x8')](),controller['addImap']);router[_0x2772('0x16')]('/:id/out_servers',auth[_0x2772('0x8')](),controller[_0x2772('0x1c')]);router['post'](_0x2772('0x1d'),auth[_0x2772('0x8')](),controller[_0x2772('0x1e')]);router[_0x2772('0x16')]('/:id/applications',auth[_0x2772('0x8')](),controller['addApplications']);router[_0x2772('0x16')](_0x2772('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x2772('0x16')](_0x2772('0x14'),auth[_0x2772('0x8')](),controller[_0x2772('0x20')]);router[_0x2772('0x21')](_0x2772('0x22'),auth[_0x2772('0x8')](),controller['update']);router[_0x2772('0x23')]('/:id/dispositions',auth[_0x2772('0x8')](),controller[_0x2772('0x24')]);router['delete'](_0x2772('0x19'),auth[_0x2772('0x8')](),controller[_0x2772('0x25')]);router[_0x2772('0x23')]('/:id/in_servers',auth[_0x2772('0x8')](),controller[_0x2772('0x26')]);router[_0x2772('0x23')](_0x2772('0xc'),auth[_0x2772('0x8')](),controller[_0x2772('0x27')]);router[_0x2772('0x23')](_0x2772('0x22'),auth['isAuthenticated'](),controller[_0x2772('0x28')]);router[_0x2772('0x23')]('/:id/users',auth[_0x2772('0x8')](),controller[_0x2772('0x29')]);module[_0x2772('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4c941b7..6d9c036 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 _0x0655=['outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo'];(function(_0x4188a9,_0x2a7e0a){var _0x40a6a8=function(_0x2a6434){while(--_0x2a6434){_0x4188a9['push'](_0x4188a9['shift']());}};_0x40a6a8(++_0x2a7e0a);}(_0x0655,0xdf));var _0x5065=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0x0655[_0x222550];return _0x58ac61;};'use strict';var Sequelize=require(_0x5065('0x0'));module[_0x5065('0x1')]={'description':{'type':Sequelize[_0x5065('0x2')]},'name':{'type':Sequelize[_0x5065('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x5065('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5065('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5065('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5065('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5065('0x2')],'allowNull':![],'defaultValue':_0x5065('0x5')},'fontSize':{'type':Sequelize[_0x5065('0x6')](0x2)[_0x5065('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5065('0x4')],'defaultValue':function(){return _0x5065('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5065('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5065('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5065('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5065('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5065('0xa'),'set':function(_0x514894){if(!_0x514894)this[_0x5065('0xb')](_0x5065('0xc'),null);this['setDataValue'](_0x5065('0xd'),_0x514894);}},'provider':{'type':Sequelize[_0x5065('0xe')](_0x5065('0xf'),'hotmail',_0x5065('0x10'),_0x5065('0x11')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this['getDataValue'](_0x5065('0x12'));},'set':function(_0x1588eb){if(_0x1588eb===_0x5065('0x13'))_0x1588eb=null;return this[_0x5065('0xb')](_0x5065('0x12'),_0x1588eb);}}}; \ No newline at end of file +var _0x8a65=['provider','custom','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','gmail','outlook365','getDataValue'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x8a65,0x132));var _0x58a6=function(_0x58f911,_0x28ecb4){_0x58f911=_0x58f911-0x0;var _0x12b4ee=_0x8a65[_0x58f911];return _0x12b4ee;};'use strict';var Sequelize=require(_0x58a6('0x0'));module['exports']={'description':{'type':Sequelize[_0x58a6('0x1')]},'name':{'type':Sequelize[_0x58a6('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x58a6('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x58a6('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x58a6('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x58a6('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x58a6('0x1')],'allowNull':![],'defaultValue':_0x58a6('0x3')},'fontSize':{'type':Sequelize[_0x58a6('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x58a6('0x5')],'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[_0x58a6('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x58a6('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x58a6('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x58a6('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x58a6('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x58a6('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x58a6('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x58a6('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x58a6('0x7'),'set':function(_0x48eeae){if(!_0x48eeae)this['setDataValue'](_0x58a6('0x8'),null);this[_0x58a6('0x9')](_0x58a6('0xa'),_0x48eeae);}},'provider':{'type':Sequelize['ENUM'](_0x58a6('0xb'),'hotmail','yahoo',_0x58a6('0xc')),'defaultValue':null,'get':function(){if(!this[_0x58a6('0xd')](_0x58a6('0xe')))return _0x58a6('0xf');return this[_0x58a6('0xd')]('provider');},'set':function(_0x39c6d8){if(_0x39c6d8===_0x58a6('0xf'))_0x39c6d8=null;return this['setDataValue'](_0x58a6('0xe'),_0x39c6d8);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 46958bb..4aee5bf 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 _0xe9eb=['CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','MailAccount','includeAll','findAll','rows','show','params','MailServerOut','keys','include','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp.office365.com','user','username','password','modernAuthentication'];(function(_0x3025f2,_0x5a4a78){var _0x58aec9=function(_0x5c8826){while(--_0x5c8826){_0x3025f2['push'](_0x3025f2['shift']());}};_0x58aec9(++_0x5a4a78);}(_0xe9eb,0x8e));var _0xbe9e=function(_0x573f88,_0x1e0023){_0x573f88=_0x573f88-0x0;var _0x12acc0=_0xe9eb[_0x573f88];return _0x12acc0;};'use strict';var moment=require(_0xbe9e('0x0'));var BPromise=require(_0xbe9e('0x1'));var util=require('util');var path=require(_0xbe9e('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xbe9e('0x3'))(_0xbe9e('0x4'));var config=require(_0xbe9e('0x5'));var db=require('../../mysqldb')['db'];config[_0xbe9e('0x6')]=_['defaults'](config[_0xbe9e('0x6')],{'host':_0xbe9e('0x7'),'port':0x18eb});var socket=require(_0xbe9e('0x8'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xbe9e('0x9')](socket);var jayson=require(_0xbe9e('0xa'));var client=jayson[_0xbe9e('0xb')][_0xbe9e('0xc')]({'port':0x232b});function respondWithRpcPromise(_0x1c4ff0,_0x49b674,_0x4fb193,_0x3e32e8){return new BPromise(function(_0x678cd7,_0x1dee6d){var _0x27deb6=_0x3e32e8||client;return _0x27deb6[_0xbe9e('0xd')](_0x1c4ff0,_0x4fb193)[_0xbe9e('0xe')](function(_0x281a18){logger[_0xbe9e('0xf')](_0xbe9e('0x10'),_0x49b674,_0xbe9e('0x11'));logger[_0xbe9e('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x49b674,_0xbe9e('0x11'),JSON[_0xbe9e('0x13')](_0x281a18));if(_0x281a18[_0xbe9e('0x14')]){if(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x15')]===0x1f4){logger[_0xbe9e('0x14')]('MailAccount,\x20%s,\x20%s',_0x49b674,_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);return _0x1dee6d(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);}logger[_0xbe9e('0x14')](_0xbe9e('0x10'),_0x49b674,_0x281a18['error'][_0xbe9e('0x16')]);return _0x678cd7(_0x281a18[_0xbe9e('0x14')][_0xbe9e('0x16')]);}else{logger[_0xbe9e('0xf')](_0xbe9e('0x10'),_0x49b674,_0xbe9e('0x11'));_0x678cd7(_0x281a18[_0xbe9e('0x17')][_0xbe9e('0x16')]);}})[_0xbe9e('0x18')](function(_0x5e3a0f){logger[_0xbe9e('0x14')](_0xbe9e('0x10'),_0x49b674,_0x5e3a0f);_0x1dee6d(_0x5e3a0f);});});}function respondWithStatusCode(_0x4cf04d,_0x4b958a){_0x4b958a=_0x4b958a||0xcc;return function(_0x1e4a2){if(_0x1e4a2){return _0x4cf04d[_0xbe9e('0x19')](_0x4b958a);}return _0x4cf04d[_0xbe9e('0x1a')](_0x4b958a)[_0xbe9e('0x1b')]();};}function respondWithResult(_0x446268,_0x35c6ab){_0x35c6ab=_0x35c6ab||0xc8;return function(_0x37650a){if(_0x37650a){return _0x446268[_0xbe9e('0x1a')](_0x35c6ab)[_0xbe9e('0x1c')](_0x37650a);}};}function respondWithFilteredResult(_0x2e7445,_0x30c3d6){return function(_0x63e850){if(_0x63e850){var _0xb35892=typeof _0x30c3d6['offset']==='undefined'&&typeof _0x30c3d6[_0xbe9e('0x1d')]==='undefined';var _0x4e3170=_0x63e850[_0xbe9e('0x1e')];var _0x5d01bc=_0xb35892?0x0:_0x30c3d6['offset'];var _0x574dc7=_0xb35892?_0x63e850[_0xbe9e('0x1e')]:_0x30c3d6[_0xbe9e('0x1f')]+_0x30c3d6['limit'];var _0x3856d4;if(_0x574dc7>=_0x4e3170){_0x574dc7=_0x4e3170;_0x3856d4=0xc8;}else{_0x3856d4=0xce;}_0x2e7445[_0xbe9e('0x1a')](_0x3856d4);return _0x2e7445[_0xbe9e('0x20')](_0xbe9e('0x21'),_0x5d01bc+'-'+_0x574dc7+'/'+_0x4e3170)[_0xbe9e('0x1c')](_0x63e850);}return null;};}function saveUpdates(_0xbacf24){return function(_0x8ba130){if(_0x8ba130){return _0x8ba130[_0xbe9e('0x22')](_0xbacf24)['then'](function(_0x559491){return _0x559491;});}return null;};}function removeEntity(_0x3571c6){return function(_0x6059d){if(_0x6059d){return _0x6059d[_0xbe9e('0x23')]()[_0xbe9e('0xe')](function(){var _0xe29659=_0x6059d[_0xbe9e('0x24')]({'plain':!![]});var _0x404386=_0xbe9e('0x25');return db[_0xbe9e('0x26')]['destroy']({'where':{'type':_0x404386,'resourceId':_0xe29659['id']}})[_0xbe9e('0xe')](function(){return _0x6059d;});})[_0xbe9e('0xe')](function(){_0x3571c6[_0xbe9e('0x1a')](0xcc)[_0xbe9e('0x1b')]();});}};}function handleEntityNotFound(_0x19e3e1){return function(_0x119ddd){if(!_0x119ddd){_0x19e3e1['sendStatus'](0x194);}return _0x119ddd;};}function handleError(_0x12a171,_0x336760){_0x336760=_0x336760||0x1f4;return function(_0xd39a4d){logger[_0xbe9e('0x14')](_0xd39a4d[_0xbe9e('0x27')]);if(_0xd39a4d[_0xbe9e('0x28')]){delete _0xd39a4d[_0xbe9e('0x28')];}_0x12a171[_0xbe9e('0x1a')](_0x336760)[_0xbe9e('0x29')](_0xd39a4d);};}function getImapHost(_0x57c62e){switch(_0x57c62e){case _0xbe9e('0x2a'):return'imap.gmail.com';case _0xbe9e('0x2b'):return _0xbe9e('0x2c');case'hotmail':return'imap-mail.outlook.com';case _0xbe9e('0x2d'):return'outlook.office365.com';}throw new Error(_0xbe9e('0x2e'),_0x57c62e);}function getSmtpHost(_0x3b5cf5){switch(_0x3b5cf5){case _0xbe9e('0x2a'):return _0xbe9e('0x2f');case _0xbe9e('0x2b'):return _0xbe9e('0x30');case _0xbe9e('0x31'):return'smtp-mail.outlook.com';case _0xbe9e('0x2d'):return _0xbe9e('0x32');}throw new Error(_0xbe9e('0x2e'),_0x3b5cf5);}function getAuthenticationOptions(_0xe8d1a4,_0x2332db){var _0x372213={};var _0x2f97e1={};if(_0xe8d1a4){_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=_0x2332db[_0xbe9e('0x34')];_0x372213[_0xbe9e('0x35')]=_0x2f97e1['pass']=_0x2332db[_0xbe9e('0x35')];if(_0x2332db[_0xbe9e('0x36')]){_0x372213[_0xbe9e('0x36')]=_0x2f97e1[_0xbe9e('0x36')]=!![];_0x372213[_0xbe9e('0x37')]=_0x2f97e1[_0xbe9e('0x37')]=_0x2332db[_0xbe9e('0x37')];_0x372213[_0xbe9e('0x35')]=_0x2f97e1[_0xbe9e('0x38')]=null;}else{_0x372213[_0xbe9e('0x37')]=_0x2f97e1[_0xbe9e('0x37')]=null;}_0x372213[_0xbe9e('0x39')]=getImapHost(_0xe8d1a4);_0x372213['port']=0x3e1;_0x2f97e1[_0xbe9e('0x39')]=getSmtpHost(_0xe8d1a4);_0x2f97e1[_0xbe9e('0x3a')]=0x24b;_0x2f97e1[_0xbe9e('0x3b')]=![];_0x372213[_0xbe9e('0x3c')]=_0x2f97e1[_0xbe9e('0x3c')]=null;}else{if(_0x2332db[_0xbe9e('0x3d')]){_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=_0x2332db['username'];_0x372213['password']=_0x2f97e1[_0xbe9e('0x38')]=_0x2332db[_0xbe9e('0x35')];}else{_0x372213[_0xbe9e('0x3d')]=_0x2f97e1[_0xbe9e('0x3d')]=![];_0x372213[_0xbe9e('0x33')]=_0x2f97e1[_0xbe9e('0x33')]=null;_0x372213['password']=_0x2f97e1[_0xbe9e('0x38')]=null;}_0x372213[_0xbe9e('0x39')]=_0x2332db[_0xbe9e('0x3e')][_0xbe9e('0x39')];_0x372213[_0xbe9e('0x3a')]=_0x2332db[_0xbe9e('0x3e')][_0xbe9e('0x3a')];_0x2f97e1[_0xbe9e('0x39')]=_0x2332db[_0xbe9e('0x3f')]['host'];_0x2f97e1['port']=_0x2332db[_0xbe9e('0x3f')]['port'];}return{'Imap':_0x372213,'Smtp':_0x2f97e1};}exports['index']=function(_0x1d7a6d,_0xeb911f){var _0x432630={'include':[{'model':db[_0xbe9e('0x40')],'as':_0xbe9e('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xbe9e('0x41')],'as':_0xbe9e('0x42')}]},_0x15303c={},_0x21115e={'count':0x0,'rows':[]};var _0x29556e=_[_0xbe9e('0x43')](db['MailAccount'][_0xbe9e('0x44')],function(_0x582dcf){return{'name':_0x582dcf[_0xbe9e('0x45')],'type':_0x582dcf[_0xbe9e('0x46')][_0xbe9e('0x47')]};});_0x15303c[_0xbe9e('0x48')]=_[_0xbe9e('0x43')](_0x29556e,_0xbe9e('0x28'));_0x15303c[_0xbe9e('0x49')]=_['keys'](_0x1d7a6d[_0xbe9e('0x49')]);_0x15303c[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x15303c[_0xbe9e('0x48')],_0x15303c[_0xbe9e('0x49')]);_0x432630[_0xbe9e('0x4c')]=_['intersection'](_0x15303c[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x432630[_0xbe9e('0x4c')]=_0x432630[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x432630[_0xbe9e('0x4c')]:_0x15303c[_0xbe9e('0x48')];if(!_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x432630[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x1d7a6d[_0xbe9e('0x49')]['limit']);_0x432630[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x432630[_0xbe9e('0x51')]=qs['sort'](_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x432630['where']=qs['filters'](_['pick'](_0x1d7a6d['query'],_0x15303c[_0xbe9e('0x4a')]),_0x29556e);if(_0x1d7a6d['query']['filter']){_0x432630[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x432630[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x29556e,function(_0x39b326){if(_0x39b326[_0xbe9e('0x46')]!==_0xbe9e('0x55')){var _0x117bc5={};_0x117bc5[_0x39b326['name']]={'$like':'%'+_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x117bc5;}})});}_0x432630=_['merge']({},_0x432630,_0x1d7a6d[_0xbe9e('0x57')]);var _0x4c9d1e={'where':_0x432630[_0xbe9e('0x53')]};return db[_0xbe9e('0x58')][_0xbe9e('0x1e')](_0x4c9d1e)[_0xbe9e('0xe')](function(_0x5b8756){_0x21115e[_0xbe9e('0x1e')]=_0x5b8756;if(_0x1d7a6d[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x432630['include']=[{'all':!![]}];}return db[_0xbe9e('0x58')][_0xbe9e('0x5a')](_0x432630);})[_0xbe9e('0xe')](function(_0x359fe6){_0x21115e[_0xbe9e('0x5b')]=_0x359fe6;return _0x21115e;})[_0xbe9e('0xe')](respondWithFilteredResult(_0xeb911f,_0x432630))[_0xbe9e('0x18')](handleError(_0xeb911f,null));};exports[_0xbe9e('0x5c')]=function(_0x4dbc0f,_0x440d33){var _0x16657b={'raw':![],'where':{'id':_0x4dbc0f[_0xbe9e('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xbe9e('0x5e')],'as':'Smtp'},{'model':db[_0xbe9e('0x41')],'as':_0xbe9e('0x42')}]},_0x21605d={};_0x21605d[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['MailAccount'][_0xbe9e('0x44')]);_0x21605d[_0xbe9e('0x49')]=_['keys'](_0x4dbc0f[_0xbe9e('0x49')]);_0x21605d['filters']=_['intersection'](_0x21605d['model'],_0x21605d['query']);_0x16657b['attributes']=_[_0xbe9e('0x4b')](_0x21605d[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x4dbc0f[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x16657b[_0xbe9e('0x4c')]=_0x16657b[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x16657b['attributes']:_0x21605d[_0xbe9e('0x48')];if(_0x4dbc0f[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x16657b[_0xbe9e('0x60')]=[{'all':!![]}];}_0x16657b=_[_0xbe9e('0x54')]({},_0x16657b,_0x4dbc0f[_0xbe9e('0x57')]);return db['MailAccount']['find'](_0x16657b)[_0xbe9e('0xe')](handleEntityNotFound(_0x440d33,null))[_0xbe9e('0xe')](respondWithResult(_0x440d33,null))[_0xbe9e('0x18')](handleError(_0x440d33,null));};exports[_0xbe9e('0x22')]=function(_0x16a8be,_0x30fd7b){if(_0x16a8be[_0xbe9e('0x61')]['id']){delete _0x16a8be[_0xbe9e('0x61')]['id'];}var _0x300a4c=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x62')]===_0xbe9e('0x63')?null:_0x16a8be['body'][_0xbe9e('0x62')];var _0x4836ac=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')]||{};var _0x5ceeef=_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')]||{};if(_0x300a4c){_0x4836ac[_0xbe9e('0x39')]=getImapHost(_0x300a4c);_0x4836ac[_0xbe9e('0x3a')]=0x3e1;_0x5ceeef[_0xbe9e('0x39')]=getSmtpHost(_0x300a4c);_0x5ceeef['port']=0x24b;_0x5ceeef[_0xbe9e('0x3b')]=![];}if(_0x5ceeef[_0xbe9e('0x36')]){_0x5ceeef['secure']=![];}else{_0x5ceeef[_0xbe9e('0x37')]=null;}if(!_0x4836ac[_0xbe9e('0x36')])_0x4836ac['CloudProviderId']=null;_0x16a8be['body']['Imap']=_0x4836ac;_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')]=_0x5ceeef;return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x16a8be[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0x40')],'as':_0xbe9e('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xbe9e('0x42')}]})[_0xbe9e('0xe')](handleEntityNotFound(_0x30fd7b,null))[_0xbe9e('0xe')](function(_0x459a7f){if(!_0x459a7f)throw new Error(_0xbe9e('0x65'));if(_0x459a7f[_0xbe9e('0x3c')])delete _0x16a8be['body'][_0xbe9e('0x3e')];return _0x459a7f;})[_0xbe9e('0xe')](saveUpdates(_0x16a8be['body'],null))[_0xbe9e('0xe')](function(_0x604e5f){if(!_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')])return _0x604e5f;return db[_0xbe9e('0x40')][_0xbe9e('0x22')](_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3e')],{'where':{'MailAccountId':_0x604e5f['id']}})['then'](function(){return _0x604e5f;});})[_0xbe9e('0xe')](function(_0x492d3b){if(!_0x16a8be['body'][_0xbe9e('0x3f')])return _0x492d3b;return db[_0xbe9e('0x5e')][_0xbe9e('0x22')](_0x16a8be[_0xbe9e('0x61')][_0xbe9e('0x3f')],{'where':{'MailAccountId':_0x492d3b['id']}})[_0xbe9e('0xe')](function(){return _0x492d3b;});})[_0xbe9e('0xe')](respondWithResult(_0x30fd7b,null))[_0xbe9e('0x18')](handleError(_0x30fd7b,null));};exports[_0xbe9e('0x66')]=function(_0x3c2174,_0x1f32d4){return db['MailAccount'][_0xbe9e('0x66')]()[_0xbe9e('0xe')](respondWithResult(_0x1f32d4,null))[_0xbe9e('0x18')](handleError(_0x1f32d4,null));};exports['addDisposition']=function(_0x1e9f52,_0x3a7eb0){if(_0x1e9f52[_0xbe9e('0x61')]['id']){delete _0x1e9f52[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x1e9f52[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x3a7eb0,null))['then'](function(_0x3eb51f){if(_0x3eb51f){_0x1e9f52[_0xbe9e('0x61')]['MailAccountId']=_0x3eb51f['id'];return db[_0xbe9e('0x67')]['create'](_0x1e9f52['body']);}})[_0xbe9e('0xe')](respondWithResult(_0x3a7eb0,null))['catch'](handleError(_0x3a7eb0,null));};exports[_0xbe9e('0x68')]=function(_0x62692d,_0x30b9b4){var _0x32bf46={'raw':![],'where':{}};var _0x1fed9b={};var _0x5da76e={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x62692d['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x30b9b4,null))['then'](function(_0x1b2cb4){if(_0x1b2cb4){_0x1fed9b[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db[_0xbe9e('0x67')][_0xbe9e('0x44')]);_0x1fed9b[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x62692d[_0xbe9e('0x49')]);_0x1fed9b[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x1fed9b[_0xbe9e('0x48')],_0x1fed9b[_0xbe9e('0x49')]);_0x32bf46[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x1fed9b[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x32bf46[_0xbe9e('0x4c')]=_0x32bf46[_0xbe9e('0x4c')]['length']?_0x32bf46[_0xbe9e('0x4c')]:_0x1fed9b[_0xbe9e('0x48')];if(!_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x32bf46[_0xbe9e('0x1d')]=qs['limit'](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x32bf46[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x32bf46['order']=qs[_0xbe9e('0x52')](_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x32bf46['where']=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x62692d[_0xbe9e('0x49')],_0x1fed9b['filters']));_0x32bf46['where']['MailAccountId']=_0x1b2cb4['id'];if(_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x32bf46['where']=_[_0xbe9e('0x54')](_0x32bf46[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x32bf46[_0xbe9e('0x4c')],function(_0x2cdc79){var _0x1e4cce={};_0x1e4cce[_0x2cdc79]={'$like':'%'+_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x1e4cce;})});}_0x32bf46=_['merge']({},_0x32bf46,_0x62692d[_0xbe9e('0x57')]);return db['Disposition']['count']({'where':_0x32bf46[_0xbe9e('0x53')]})['then'](function(_0x40d65a){_0x5da76e[_0xbe9e('0x1e')]=_0x40d65a;if(_0x62692d[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x32bf46[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0x67')][_0xbe9e('0x5a')](_0x32bf46);})['then'](function(_0x1c2935){_0x5da76e[_0xbe9e('0x5b')]=_0x1c2935;return _0x5da76e;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0x30b9b4,_0x32bf46))[_0xbe9e('0x18')](handleError(_0x30b9b4,null));};exports['removeDispositions']=function(_0x3fbe19,_0x23e24a){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x3fbe19[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x23e24a,null))['then'](function(_0x181698){if(_0x181698){return _0x181698[_0xbe9e('0x6b')](_0x3fbe19[_0xbe9e('0x49')][_0xbe9e('0x6c')]);}})[_0xbe9e('0xe')](respondWithStatusCode(_0x23e24a,null))[_0xbe9e('0x18')](handleError(_0x23e24a,null));};exports[_0xbe9e('0x6d')]=function(_0x5667c8,_0x54a468){if(_0x5667c8[_0xbe9e('0x61')]['id']){delete _0x5667c8[_0xbe9e('0x61')]['id'];}return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x5667c8[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x54a468,null))['then'](function(_0x3a0084){if(_0x3a0084){_0x5667c8['body'][_0xbe9e('0x6e')]=_0x3a0084['id'];return db[_0xbe9e('0x6f')]['create'](_0x5667c8[_0xbe9e('0x61')]);}})[_0xbe9e('0xe')](respondWithResult(_0x54a468,null))['catch'](handleError(_0x54a468,null));};exports[_0xbe9e('0x70')]=function(_0x1a044e,_0x39ffd0){var _0x43ba4b={'raw':![],'where':{}};var _0x315a9d={};var _0x4f9a25={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x1a044e[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x39ffd0,null))[_0xbe9e('0xe')](function(_0x5adcf9){if(_0x5adcf9){_0x315a9d[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['CannedAnswer']['rawAttributes']);_0x315a9d[_0xbe9e('0x49')]=_['keys'](_0x1a044e[_0xbe9e('0x49')]);_0x315a9d['filters']=_[_0xbe9e('0x4b')](_0x315a9d[_0xbe9e('0x48')],_0x315a9d[_0xbe9e('0x49')]);_0x43ba4b[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x315a9d[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x1a044e['query'][_0xbe9e('0x4d')]));_0x43ba4b[_0xbe9e('0x4c')]=_0x43ba4b[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x43ba4b[_0xbe9e('0x4c')]:_0x315a9d[_0xbe9e('0x48')];if(!_0x1a044e[_0xbe9e('0x49')]['hasOwnProperty']('nolimit')){_0x43ba4b['limit']=qs[_0xbe9e('0x1d')](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x43ba4b[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x43ba4b[_0xbe9e('0x51')]=qs['sort'](_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x43ba4b[_0xbe9e('0x53')]=qs[_0xbe9e('0x4a')](_['pick'](_0x1a044e[_0xbe9e('0x49')],_0x315a9d[_0xbe9e('0x4a')]));_0x43ba4b[_0xbe9e('0x53')][_0xbe9e('0x6e')]=_0x5adcf9['id'];if(_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x43ba4b[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x43ba4b[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x43ba4b[_0xbe9e('0x4c')],function(_0x1e95d9){var _0x32280e={};_0x32280e[_0x1e95d9]={'$like':'%'+_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x32280e;})});}_0x43ba4b=_[_0xbe9e('0x54')]({},_0x43ba4b,_0x1a044e[_0xbe9e('0x57')]);return db['CannedAnswer'][_0xbe9e('0x1e')]({'where':_0x43ba4b[_0xbe9e('0x53')]})['then'](function(_0x2c9d54){_0x4f9a25[_0xbe9e('0x1e')]=_0x2c9d54;if(_0x1a044e[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x43ba4b[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0x6f')][_0xbe9e('0x5a')](_0x43ba4b);})[_0xbe9e('0xe')](function(_0x29bba3){_0x4f9a25[_0xbe9e('0x5b')]=_0x29bba3;return _0x4f9a25;});}})['then'](respondWithFilteredResult(_0x39ffd0,_0x43ba4b))[_0xbe9e('0x18')](handleError(_0x39ffd0,null));};exports[_0xbe9e('0x71')]=function(_0x8fd8cb,_0x2c2855){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x8fd8cb[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x2c2855,null))['then'](function(_0xe3f1b6){if(_0xe3f1b6){return _0xe3f1b6['removeAnswers'](_0x8fd8cb[_0xbe9e('0x49')][_0xbe9e('0x6c')]);}})[_0xbe9e('0xe')](respondWithStatusCode(_0x2c2855,null))[_0xbe9e('0x18')](handleError(_0x2c2855,null));};exports[_0xbe9e('0x72')]=function(_0x5d1748,_0x55e7f2){var _0x40db59={'name':_0x5d1748['body']['name'],'key':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x47')],'provider':_0x5d1748[_0xbe9e('0x61')]['provider']===_0xbe9e('0x63')?null:_0x5d1748[_0xbe9e('0x61')]['provider'],'email':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x73')],'ListId':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x74')],'active':!_[_0xbe9e('0x75')](_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x76')])?_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x76')]:!![],'description':_0x5d1748[_0xbe9e('0x61')][_0xbe9e('0x77')]||null};var _0x390ee0=getAuthenticationOptions(_0x40db59['provider'],_0x5d1748[_0xbe9e('0x61')]);_0x40db59[_0xbe9e('0x3e')]=_0x390ee0['Imap'];_0x40db59['Smtp']=_0x390ee0[_0xbe9e('0x3f')];return db['MailAccount'][_0xbe9e('0x72')](_0x40db59,{'include':[{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f')},{'model':db[_0xbe9e('0x40')],'as':'Imap'}]})[_0xbe9e('0xe')](function(_0x302b1f){var _0x4d56a4=_0x5d1748[_0xbe9e('0x33')]['get']({'plain':!![]});if(!_0x4d56a4)throw new Error(_0xbe9e('0x78'));if(_0x4d56a4[_0xbe9e('0x79')]===_0xbe9e('0x33')){var _0x28452f=_0x302b1f[_0xbe9e('0x24')]({'plain':!![]});return db[_0xbe9e('0x7a')]['find']({'where':{'name':_0xbe9e('0x25'),'userProfileId':_0x4d56a4[_0xbe9e('0x7b')]},'raw':!![]})['then'](function(_0x509168){if(_0x509168&&_0x509168[_0xbe9e('0x7c')]===0x0){return db[_0xbe9e('0x26')]['create']({'name':_0x28452f[_0xbe9e('0x28')],'resourceId':_0x28452f['id'],'type':_0x509168[_0xbe9e('0x28')],'sectionId':_0x509168['id']},{})[_0xbe9e('0xe')](function(){return _0x302b1f;});}else{return _0x302b1f;}})[_0xbe9e('0x18')](function(_0x30f8dc){logger['error'](_0xbe9e('0x7d'),_0x30f8dc);throw _0x30f8dc;});}return _0x302b1f;})['then'](respondWithResult(_0x55e7f2,0xc9))[_0xbe9e('0x18')](handleError(_0x55e7f2,null));};exports[_0xbe9e('0x7e')]=function(_0x57f6f1,_0x308bb3){return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x57f6f1[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x308bb3,null))[_0xbe9e('0xe')](function(_0x3d202b){if(_0x3d202b){return _0x3d202b['getImap']();}return null;})[_0xbe9e('0xe')](respondWithResult(_0x308bb3,null))['catch'](handleError(_0x308bb3,null));};exports[_0xbe9e('0x7f')]=function(_0x27bf02,_0x5cf80d){if(_0x27bf02[_0xbe9e('0x61')]['id']){delete _0x27bf02[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x27bf02['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x5cf80d,null))[_0xbe9e('0xe')](function(_0x572709){if(_0x572709){_0x27bf02[_0xbe9e('0x61')][_0xbe9e('0x6e')]=_0x572709['id'];return db[_0xbe9e('0x40')][_0xbe9e('0x72')](_0x27bf02[_0xbe9e('0x61')]);}})['then'](respondWithResult(_0x5cf80d,null))[_0xbe9e('0x18')](handleError(_0x5cf80d,null));};exports[_0xbe9e('0x80')]=function(_0x156546,_0x1a92d0){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x156546[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x1a92d0,null))['then'](function(_0x163d14){if(_0x163d14){return _0x163d14[_0xbe9e('0x81')](null);}return null;})[_0xbe9e('0xe')](respondWithStatusCode(_0x1a92d0,null))[_0xbe9e('0x18')](handleError(_0x1a92d0,null));};exports['getSmtp']=function(_0x5fa91a,_0x4b9529){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x5fa91a[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x4b9529,null))[_0xbe9e('0xe')](function(_0x5681be){if(_0x5681be){return _0x5681be[_0xbe9e('0x82')]();}return null;})['then'](respondWithResult(_0x4b9529,null))[_0xbe9e('0x18')](handleError(_0x4b9529,null));};exports[_0xbe9e('0x83')]=function(_0x46f9f0,_0x397fc9){if(_0x46f9f0['body']['id']){delete _0x46f9f0[_0xbe9e('0x61')]['id'];}return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x46f9f0['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x397fc9,null))['then'](function(_0x1f6a8a){if(_0x1f6a8a){_0x46f9f0['body'][_0xbe9e('0x6e')]=_0x1f6a8a['id'];return db[_0xbe9e('0x5e')]['create'](_0x46f9f0[_0xbe9e('0x61')]);}})['then'](respondWithResult(_0x397fc9,null))[_0xbe9e('0x18')](handleError(_0x397fc9,null));};exports[_0xbe9e('0x84')]=function(_0x514abe,_0x3824b5){return db['MailAccount'][_0xbe9e('0x69')]({'where':{'id':_0x514abe[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x3824b5,null))[_0xbe9e('0xe')](function(_0x12f922){if(_0x12f922){return _0x12f922[_0xbe9e('0x85')](null);}return null;})[_0xbe9e('0xe')](respondWithStatusCode(_0x3824b5,null))[_0xbe9e('0x18')](handleError(_0x3824b5,null));};exports['addInteraction']=function(_0xb8dc1,_0x57581f){return db[_0xbe9e('0x86')][_0xbe9e('0x64')]({'where':{'id':_0xb8dc1[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x57581f,null))[_0xbe9e('0xe')](function(_0x54e568){if(_0x54e568){return _0x54e568[_0xbe9e('0x87')](_0xb8dc1['body']['ids'],_[_0xbe9e('0x88')](_0xb8dc1[_0xbe9e('0x61')],[_0xbe9e('0x6c'),'id'])||{});}})[_0xbe9e('0xe')](respondWithResult(_0x57581f,null))[_0xbe9e('0x18')](handleError(_0x57581f,null));};exports['getInteractions']=function(_0x330307,_0xc31eef){var _0x48c799={'raw':![],'where':{}};var _0x6ccb1={};var _0x55bfa1={'count':0x0,'rows':[]};return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x330307[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0xc31eef,null))[_0xbe9e('0xe')](function(_0x11e29c){if(_0x11e29c){_0x6ccb1[_0xbe9e('0x48')]=_[_0xbe9e('0x5f')](db['MailInteraction']['rawAttributes']);_0x6ccb1['query']=_[_0xbe9e('0x5f')](_0x330307[_0xbe9e('0x49')]);_0x6ccb1[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x6ccb1[_0xbe9e('0x48')],_0x6ccb1['query']);_0x48c799[_0xbe9e('0x4c')]=_[_0xbe9e('0x4b')](_0x6ccb1[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x330307[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x48c799[_0xbe9e('0x4c')]=_0x48c799[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x48c799[_0xbe9e('0x4c')]:_0x6ccb1[_0xbe9e('0x48')];if(!_0x330307[_0xbe9e('0x49')]['hasOwnProperty']('nolimit')){_0x48c799['limit']=qs['limit'](_0x330307['query'][_0xbe9e('0x1d')]);_0x48c799[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x330307['query'][_0xbe9e('0x1f')]);}_0x48c799[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x330307['query'][_0xbe9e('0x52')]);_0x48c799[_0xbe9e('0x53')]=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x330307['query'],_0x6ccb1[_0xbe9e('0x4a')]));_0x48c799[_0xbe9e('0x53')]['MailAccountId']=_0x11e29c['id'];if(_0x330307[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x48c799[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x48c799[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x48c799['attributes'],function(_0x44c55f){var _0x3c840e={};_0x3c840e[_0x44c55f]={'$like':'%'+_0x330307['query']['filter']+'%'};return _0x3c840e;})});}_0x48c799=_[_0xbe9e('0x54')]({},_0x48c799,_0x330307[_0xbe9e('0x57')]);return db[_0xbe9e('0x86')]['count']({'where':_0x48c799[_0xbe9e('0x53')]})[_0xbe9e('0xe')](function(_0x3bcd4c){_0x55bfa1[_0xbe9e('0x1e')]=_0x3bcd4c;if(_0x330307[_0xbe9e('0x49')][_0xbe9e('0x59')]){_0x48c799['include']=[{'model':db[_0xbe9e('0x89')],'as':_0xbe9e('0x8a'),'required':![]},{'model':db[_0xbe9e('0x8b')],'as':_0xbe9e('0x8c'),'attributes':[_0xbe9e('0x28'),_0xbe9e('0x8d'),_0xbe9e('0x8e')],'required':![]},{'model':db['Tag'],'as':_0xbe9e('0x8f'),'attributes':['id','name',_0xbe9e('0x90')],'where':_0x330307[_0xbe9e('0x49')][_0xbe9e('0x91')]?{'id':_0x330307['query'][_0xbe9e('0x91')]}:undefined,'required':_0x330307[_0xbe9e('0x49')][_0xbe9e('0x91')]?!![]:![]}];}return db['MailInteraction'][_0xbe9e('0x5a')](_0x48c799);})['then'](function(_0x46a2de){_0x55bfa1['rows']=_0x46a2de;return _0x55bfa1;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0xc31eef,_0x48c799))[_0xbe9e('0x18')](handleError(_0xc31eef,null));};exports['addApplications']=function addApplications(_0x3b3cf5,_0x17e2a2){var _0x281c5e=_0x3b3cf5[_0xbe9e('0x5d')]['id'];var _0x49711d=_0x3b3cf5[_0xbe9e('0x61')];var _0x5baca1=0xc8;var _0x52a725=null;return db[_0xbe9e('0x92')]['transaction']({'isolationLevel':db[_0xbe9e('0x92')][_0xbe9e('0x93')][_0xbe9e('0x94')][_0xbe9e('0x95')]},function(_0x1184e0){return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x281c5e},'transaction':_0x1184e0})[_0xbe9e('0xe')](function(_0xc7e102){if(_0xc7e102){return db[_0xbe9e('0x96')][_0xbe9e('0x23')]({'where':{'MailAccountId':_0x281c5e},'transaction':_0x1184e0})[_0xbe9e('0xe')](function(){var _0x413280=_[_0xbe9e('0x43')](_0x49711d,function(_0x452621){_0x452621[_0xbe9e('0x6e')]=_0x281c5e;return _0x452621;});return db[_0xbe9e('0x96')][_0xbe9e('0x97')](_0x413280,{'transaction':_0x1184e0});});}else{_0x5baca1=0x194;_0x52a725=[];}});})[_0xbe9e('0xe')](function(){if(_0x5baca1!==0x194){return db['MailApplication'][_0xbe9e('0x98')]({'where':{'MailAccountId':_0x281c5e},'order':_0xbe9e('0x99')})[_0xbe9e('0xe')](function(_0x4d1a29){_0x52a725=_0x4d1a29;});}})[_0xbe9e('0x18')](function(_0x421378){_0x5baca1=0x1f4;logger[_0xbe9e('0x14')](_0x421378[_0xbe9e('0x27')]);if(_0x421378[_0xbe9e('0x28')]){delete _0x421378[_0xbe9e('0x28')];}_0x52a725=_0x421378;})['finally'](function(){if(_0x52a725===null){_0x17e2a2[_0xbe9e('0x19')](_0x5baca1);}else{if(_0x5baca1===0x1f4){_0x17e2a2[_0xbe9e('0x1a')](_0x5baca1)[_0xbe9e('0x29')](_0x52a725);}else{_0x17e2a2['status'](_0x5baca1)[_0xbe9e('0x1c')](_0x52a725);}}});};exports['getApplications']=function(_0x563eab,_0x63238f){var _0x39a771={};var _0x29a105={};var _0x4ccb9a;var _0x4871a7;return db[_0xbe9e('0x58')][_0xbe9e('0x69')]({'where':{'id':_0x563eab[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x63238f,null))[_0xbe9e('0xe')](function(_0xbd71b3){if(_0xbd71b3){_0x4ccb9a=_0xbd71b3;_0x29a105['model']=_[_0xbe9e('0x5f')](db[_0xbe9e('0x96')][_0xbe9e('0x44')]);_0x29a105[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x563eab[_0xbe9e('0x49')]);_0x29a105['filters']=_[_0xbe9e('0x4b')](_0x29a105['model'],_0x29a105['query']);_0x39a771['attributes']=_[_0xbe9e('0x4b')](_0x29a105[_0xbe9e('0x48')],qs['fields'](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x39a771[_0xbe9e('0x4c')]=_0x39a771[_0xbe9e('0x4c')][_0xbe9e('0x4e')]?_0x39a771[_0xbe9e('0x4c')]:_0x29a105['model'];_0x39a771['order']=qs[_0xbe9e('0x52')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x39a771['where']=qs['filters'](_[_0xbe9e('0x6a')](_0x563eab['query'],_0x29a105[_0xbe9e('0x4a')]));if(_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x39a771[_0xbe9e('0x53')]=_['merge'](_0x39a771['where'],{'$or':_[_0xbe9e('0x43')](_0x39a771[_0xbe9e('0x4c')],function(_0x4bcf3e){var _0xebaa5={};_0xebaa5[_0x4bcf3e]={'$like':'%'+_0x563eab['query'][_0xbe9e('0x56')]+'%'};return _0xebaa5;})});}_0x39a771=_[_0xbe9e('0x54')]({},_0x39a771,_0x563eab[_0xbe9e('0x57')]);return _0x4ccb9a[_0xbe9e('0x9a')](_0x39a771);}})[_0xbe9e('0xe')](function(_0x5d67f6){if(_0x5d67f6){_0x4871a7=_0x5d67f6[_0xbe9e('0x4e')];if(!_0x563eab['query'][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x39a771[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x39a771[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x563eab[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}return _0x4ccb9a['getApplications'](_0x39a771);}})[_0xbe9e('0xe')](function(_0x5efce1){if(_0x5efce1){return _0x5efce1?{'count':_0x4871a7,'rows':_0x5efce1}:null;}})[_0xbe9e('0xe')](respondWithResult(_0x63238f,null))[_0xbe9e('0x18')](handleError(_0x63238f,null));};exports[_0xbe9e('0x9b')]=function(_0x75de48,_0x30fbe1){var _0x50fbb0={'raw':!![],'where':{}};var _0x2469b4={};var _0x4622f8={'count':0x0,'rows':[]};return db['MailAccount'][_0xbe9e('0x69')]({'where':{'id':_0x75de48['params']['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x30fbe1,null))['then'](function(_0x4e58ef){if(_0x4e58ef){_0x2469b4[_0xbe9e('0x48')]=_['keys'](db['MailMessage'][_0xbe9e('0x44')]);_0x2469b4[_0xbe9e('0x49')]=_[_0xbe9e('0x5f')](_0x75de48[_0xbe9e('0x49')]);_0x2469b4[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x2469b4[_0xbe9e('0x48')],_0x2469b4[_0xbe9e('0x49')]);_0x50fbb0['attributes']=_[_0xbe9e('0x4b')](_0x2469b4[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x75de48['query'][_0xbe9e('0x4d')]));_0x50fbb0['attributes']=_0x50fbb0['attributes'][_0xbe9e('0x4e')]?_0x50fbb0[_0xbe9e('0x4c')]:_0x2469b4['model'];if(!_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x50fbb0[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x50fbb0['offset']=qs[_0xbe9e('0x1f')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}_0x50fbb0[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x52')]);_0x50fbb0[_0xbe9e('0x53')]=qs['filters'](_['pick'](_0x75de48[_0xbe9e('0x49')],_0x2469b4[_0xbe9e('0x4a')]));_0x50fbb0[_0xbe9e('0x53')][_0xbe9e('0x6e')]=_0x4e58ef['id'];if(_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x50fbb0[_0xbe9e('0x53')]=_['merge'](_0x50fbb0[_0xbe9e('0x53')],{'$or':_[_0xbe9e('0x43')](_0x50fbb0[_0xbe9e('0x4c')],function(_0x57d5bb){var _0x3cc349={};_0x3cc349[_0x57d5bb]={'$like':'%'+_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x56')]+'%'};return _0x3cc349;})});}if(_0x75de48['query'][_0xbe9e('0x9c')]){var _0x1baa6=_0x75de48[_0xbe9e('0x49')][_0xbe9e('0x9c')][_0xbe9e('0x9d')](',');var _0x11b665={};_0x11b665[_0x1baa6[0x0]]={'$gte':moment(_0x1baa6[0x1])[_0xbe9e('0x9e')](_0xbe9e('0x9f'))};_0x50fbb0[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x50fbb0[_0xbe9e('0x53')],_0x11b665);}_0x50fbb0=_[_0xbe9e('0x54')]({},_0x50fbb0,_0x75de48['options']);return db[_0xbe9e('0xa0')][_0xbe9e('0x1e')]({'where':_0x50fbb0[_0xbe9e('0x53')]})['then'](function(_0x1fc9cb){_0x4622f8[_0xbe9e('0x1e')]=_0x1fc9cb;if(_0x75de48['query'][_0xbe9e('0x59')]){_0x50fbb0[_0xbe9e('0x60')]=[{'all':!![]}];}return db[_0xbe9e('0xa0')][_0xbe9e('0x5a')](_0x50fbb0);})[_0xbe9e('0xe')](function(_0xf9fc40){if(_0x75de48[_0xbe9e('0x49')][_0xbe9e('0xa1')]===_0xbe9e('0xa2')){for(var _0x2a9e1e=0x0;_0x2a9e1e<_0xf9fc40[_0xbe9e('0x4e')];_0x2a9e1e++){_0xf9fc40[_0x2a9e1e]['body']=juice(_0xf9fc40[_0x2a9e1e][_0xbe9e('0x61')]);}}_0x4622f8[_0xbe9e('0x5b')]=_0xf9fc40;return _0x4622f8;});}})[_0xbe9e('0xe')](respondWithFilteredResult(_0x30fbe1,_0x50fbb0))[_0xbe9e('0x18')](handleError(_0x30fbe1,null));};exports[_0xbe9e('0x29')]=function(_0x90ffcb,_0x49d903){var _0x53b016,_0x3e19c2={},_0x16fb6d;if(_0x90ffcb[_0xbe9e('0x61')]['to']){_0x16fb6d=_0x90ffcb[_0xbe9e('0x61')]['to'][_0xbe9e('0x9d')](',')[0x0];}return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x90ffcb[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0xa3')],'as':_0xbe9e('0xa4'),'include':[{'model':db[_0xbe9e('0x89')],'as':'Contacts','where':{'email':_0x16fb6d},'limit':0x1,'order':[[_0xbe9e('0xa5'),_0xbe9e('0xa6')]]}]},{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f'),'raw':!![],'include':[{'model':db[_0xbe9e('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xbe9e('0xe')](handleEntityNotFound(_0x49d903,null))[_0xbe9e('0xe')](function(_0x3f72c4){if(!_0x3f72c4)return;_0x53b016=_0x3f72c4;if(!_0x3f72c4[_0xbe9e('0x3f')])throw new Error(_0xbe9e('0xa8'));if(_[_0xbe9e('0x75')](_0x90ffcb['body'][_0xbe9e('0xa9')])){_0x90ffcb[_0xbe9e('0x61')]['from']=util[_0xbe9e('0x9e')](_0xbe9e('0xaa'),_0x3f72c4[_0xbe9e('0x28')],_0x3f72c4[_0xbe9e('0x73')]||_0x3f72c4[_0xbe9e('0x3f')][_0xbe9e('0x33')]);}if(_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')]&&_0x90ffcb['body']['attachments']['length']){for(var _0x526860=0x0;_0x526860<_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')][_0xbe9e('0x4e')];_0x526860+=0x1){_0x90ffcb['body'][_0xbe9e('0xab')][_0x526860]={'filename':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xab')][_0x526860][_0xbe9e('0x28')],'path':path['join'](config[_0xbe9e('0xac')],_0xbe9e('0xad'),_0x90ffcb['body'][_0xbe9e('0xab')][_0x526860][_0xbe9e('0xae')])};}}var _0x4479cc=_0x3f72c4[_0xbe9e('0xaf')]();return respondWithRpcPromise(_0xbe9e('0xb0'),_0xbe9e('0xb1'),{'account':_0x4479cc,'message':_0x90ffcb[_0xbe9e('0x61')]});})['then'](function(_0x3ee81d){if(!_0x3ee81d)return;_0x3e19c2=_0x3ee81d;if(!_0x53b016[_0xbe9e('0xa4')])throw new Error(_0xbe9e('0xb2'));if(_0x53b016[_0xbe9e('0xa4')][_0xbe9e('0xb3')][_0xbe9e('0x4e')])return _0x53b016['List'][_0xbe9e('0xb3')][0x0];return db[_0xbe9e('0x89')][_0xbe9e('0x72')](_[_0xbe9e('0xb4')](_0x90ffcb[_0xbe9e('0x61')],{'firstName':_0x90ffcb['body']['to'],'email':_0x90ffcb[_0xbe9e('0x61')]['to'],'phone':_0x90ffcb[_0xbe9e('0x61')]['to'],'ListId':_0x53b016[_0xbe9e('0x74')]}));})[_0xbe9e('0xe')](function(_0x599597){if(!_0x599597)return;var _0x1e1dc8={'UserId':_0x90ffcb[_0xbe9e('0x33')]['id'],'ContactId':_0x599597['id'],'MailAccountId':_0x53b016['id'],'inReplyTo':_0x3e19c2[_0xbe9e('0xb5')],'to':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xa9')],'cc':_0x90ffcb[_0xbe9e('0x61')]['cc'],'subject':_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xb6')],'attach':_0x90ffcb[_0xbe9e('0x61')]['attach'],'firstMsgDirection':_0xbe9e('0xb7'),'lastMsgAt':moment()[_0xbe9e('0x9e')](_0xbe9e('0x9f')),'lastMsgDirection':'out','Messages':[_[_0xbe9e('0x54')](_0x90ffcb[_0xbe9e('0x61')],{'messageId':_0x3e19c2[_0xbe9e('0xb5')],'sentAt':moment()['format'](_0xbe9e('0x9f')),'read':!![],'MailAccountId':_0x53b016['id'],'UserId':_0x90ffcb[_0xbe9e('0x33')]['id'],'ContactId':_0x599597['id']})]};if(_0x90ffcb[_0xbe9e('0x61')][_0xbe9e('0xb8')]){_0x1e1dc8=_[_0xbe9e('0x54')](_0x1e1dc8,_0x90ffcb[_0xbe9e('0x61')]['Interaction']);}return db[_0xbe9e('0x86')][_0xbe9e('0x72')](_0x1e1dc8,{'include':[{'model':db[_0xbe9e('0xa0')],'as':'Messages'}]});})[_0xbe9e('0xe')](respondWithResult(_0x49d903,null))[_0xbe9e('0x18')](handleError(_0x49d903,null));};exports[_0xbe9e('0xb9')]=function(_0x4faaf6,_0xa9bf04){return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x4faaf6[_0xbe9e('0x5d')]['id']},'include':[{'model':db[_0xbe9e('0x5e')],'as':_0xbe9e('0x3f'),'raw':!![],'include':[{'model':db[_0xbe9e('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xbe9e('0xe')](handleEntityNotFound(_0xa9bf04,null))[_0xbe9e('0xe')](function(_0x107641){if(!_0x107641[_0xbe9e('0x3f')])return;var _0x409bb5=_0x107641[_0xbe9e('0xaf')]();return respondWithRpcPromise(_0xbe9e('0xba'),_0xbe9e('0xb9'),{'account':_0x409bb5});})['then'](respondWithResult(_0xa9bf04,null))[_0xbe9e('0x18')](handleError(_0xa9bf04,null));};exports[_0xbe9e('0x23')]=function(_0x168076,_0x403eb0){return db[_0xbe9e('0x58')][_0xbe9e('0x64')]({'where':{'id':_0x168076[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x403eb0,null))[_0xbe9e('0xe')](function(_0x4d997a){if(_0x4d997a&&_0x4d997a[_0xbe9e('0x3c')]){throw new db[(_0xbe9e('0xbb'))][(_0xbe9e('0xbc'))](_0xbe9e('0xbd'));}return _0x4d997a;})[_0xbe9e('0xe')](removeEntity(_0x403eb0,null))[_0xbe9e('0x18')](handleError(_0x403eb0,null));};exports['addAgents']=function(_0x159ddf,_0x1b2eba){return db['MailAccount'][_0xbe9e('0x64')]({'where':{'id':_0x159ddf[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x1b2eba,null))[_0xbe9e('0xe')](function(_0x54dc4b){if(_0x54dc4b){return _0x54dc4b[_0xbe9e('0xbe')](_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')],_[_0xbe9e('0x88')](_0x159ddf[_0xbe9e('0x61')],[_0xbe9e('0x6c'),'id'])||{})[_0xbe9e('0xbf')](function(_0xe721fa){for(var _0x3e088c=0x0;_0x3e088c<_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')]['length'];_0x3e088c+=0x1){socket[_0xbe9e('0xc0')](_0xbe9e('0xc1'),{'UserId':Number(_0x159ddf[_0xbe9e('0x61')][_0xbe9e('0x6c')][_0x3e088c]),'MailAccountId':Number(_0x159ddf[_0xbe9e('0x5d')]['id'])});}return _0xe721fa;});}})['then'](respondWithResult(_0x1b2eba,null))[_0xbe9e('0x18')](handleError(_0x1b2eba,null));};exports['removeAgents']=function(_0x3732f9,_0x43c4e8){return db[_0xbe9e('0x58')]['find']({'where':{'id':_0x3732f9[_0xbe9e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x43c4e8,null))[_0xbe9e('0xe')](function(_0x4d5bc9){if(_0x4d5bc9){return _0x4d5bc9['removeAgents'](_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')])[_0xbe9e('0xe')](function(){if(_[_0xbe9e('0xc2')](_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')])){for(var _0x8668a5=0x0;_0x8668a5<_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')][_0xbe9e('0x4e')];_0x8668a5+=0x1){socket[_0xbe9e('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')][_0x8668a5]),'MailAccountId':Number(_0x3732f9[_0xbe9e('0x5d')]['id'])});}}else{socket[_0xbe9e('0xc0')](_0xbe9e('0xc3'),{'UserId':Number(_0x3732f9[_0xbe9e('0x49')][_0xbe9e('0x6c')]),'MailAccountId':Number(_0x3732f9[_0xbe9e('0x5d')]['id'])});}});}})[_0xbe9e('0xe')](respondWithStatusCode(_0x43c4e8,null))['catch'](handleError(_0x43c4e8,null));};exports[_0xbe9e('0xc4')]=function(_0x5c165d,_0x5a59c0){var _0x3dfaff={};var _0x182ff3={};var _0x1e85b1;var _0x4f5ffc;return db[_0xbe9e('0x58')]['findOne']({'where':{'id':_0x5c165d[_0xbe9e('0x5d')]['id']}})[_0xbe9e('0xe')](handleEntityNotFound(_0x5a59c0,null))['then'](function(_0x190dce){if(_0x190dce){_0x1e85b1=_0x190dce;_0x182ff3['model']=_['keys'](db[_0xbe9e('0x8b')][_0xbe9e('0x44')]);_0x182ff3[_0xbe9e('0x49')]=_['keys'](_0x5c165d[_0xbe9e('0x49')]);_0x182ff3[_0xbe9e('0x4a')]=_[_0xbe9e('0x4b')](_0x182ff3[_0xbe9e('0x48')],_0x182ff3['query']);_0x3dfaff[_0xbe9e('0x4c')]=_['intersection'](_0x182ff3[_0xbe9e('0x48')],qs[_0xbe9e('0x4d')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x4d')]));_0x3dfaff[_0xbe9e('0x4c')]=_0x3dfaff['attributes'][_0xbe9e('0x4e')]?_0x3dfaff[_0xbe9e('0x4c')]:_0x182ff3[_0xbe9e('0x48')];_0x3dfaff[_0xbe9e('0x51')]=qs[_0xbe9e('0x52')](_0x5c165d[_0xbe9e('0x49')]['sort']);_0x3dfaff['where']=qs[_0xbe9e('0x4a')](_[_0xbe9e('0x6a')](_0x5c165d['query'],_0x182ff3[_0xbe9e('0x4a')]));if(_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x56')]){_0x3dfaff[_0xbe9e('0x53')]=_[_0xbe9e('0x54')](_0x3dfaff['where'],{'$or':_[_0xbe9e('0x43')](_0x3dfaff['attributes'],function(_0x2efc9f){var _0x111f9a={};_0x111f9a[_0x2efc9f]={'$like':'%'+_0x5c165d['query']['filter']+'%'};return _0x111f9a;})});}_0x3dfaff=_[_0xbe9e('0x54')]({},_0x3dfaff,_0x5c165d['options']);return _0x1e85b1['getAgents'](_0x3dfaff);}})[_0xbe9e('0xe')](function(_0x2822d3){if(_0x2822d3){_0x4f5ffc=_0x2822d3[_0xbe9e('0x4e')];if(!_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x4f')](_0xbe9e('0x50'))){_0x3dfaff[_0xbe9e('0x1d')]=qs[_0xbe9e('0x1d')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x1d')]);_0x3dfaff[_0xbe9e('0x1f')]=qs[_0xbe9e('0x1f')](_0x5c165d[_0xbe9e('0x49')][_0xbe9e('0x1f')]);}return _0x1e85b1[_0xbe9e('0xc4')](_0x3dfaff);}})[_0xbe9e('0xe')](function(_0x1fbb67){if(_0x1fbb67){return _0x1fbb67?{'count':_0x4f5ffc,'rows':_0x1fbb67}:null;}})[_0xbe9e('0xe')](respondWithResult(_0x5a59c0,null))[_0xbe9e('0x18')](handleError(_0x5a59c0,null));}; \ No newline at end of file +var _0xec24=['filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','body','custom','provider','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addInteraction','MailInteraction','omit','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','CmContact','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','then','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5ed17b,_0x35d63d){var _0x5e99a2=function(_0x1fe2f0){while(--_0x1fe2f0){_0x5ed17b['push'](_0x5ed17b['shift']());}};_0x5e99a2(++_0x35d63d);}(_0xec24,0x12e));var _0x4ec2=function(_0x573654,_0x4994ec){_0x573654=_0x573654-0x0;var _0x4283ba=_0xec24[_0x573654];return _0x4283ba;};'use strict';var moment=require(_0x4ec2('0x0'));var BPromise=require(_0x4ec2('0x1'));var util=require('util');var path=require(_0x4ec2('0x2'));var _=require(_0x4ec2('0x3'));var juice=require(_0x4ec2('0x4'));var Redis=require(_0x4ec2('0x5'));var qs=require(_0x4ec2('0x6'));var logger=require(_0x4ec2('0x7'))(_0x4ec2('0x8'));var config=require(_0x4ec2('0x9'));var db=require('../../mysqldb')['db'];config[_0x4ec2('0xa')]=_[_0x4ec2('0xb')](config[_0x4ec2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ec2('0xc'))(new Redis(config[_0x4ec2('0xa')]));require(_0x4ec2('0xd'))[_0x4ec2('0xe')](socket);var jayson=require(_0x4ec2('0xf'));var client=jayson[_0x4ec2('0x10')][_0x4ec2('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x540033,_0x4cd5ac,_0x6f304a,_0x6040cd){return new BPromise(function(_0x2b8dc6,_0x2fedfd){var _0x13eabf=_0x6040cd||client;return _0x13eabf[_0x4ec2('0x12')](_0x540033,_0x6f304a)['then'](function(_0x41cc16){logger[_0x4ec2('0x13')](_0x4ec2('0x14'),_0x4cd5ac,_0x4ec2('0x15'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4cd5ac,'request\x20sent',JSON[_0x4ec2('0x16')](_0x41cc16));if(_0x41cc16[_0x4ec2('0x17')]){if(_0x41cc16[_0x4ec2('0x17')][_0x4ec2('0x18')]===0x1f4){logger[_0x4ec2('0x17')]('MailAccount,\x20%s,\x20%s',_0x4cd5ac,_0x41cc16[_0x4ec2('0x17')][_0x4ec2('0x19')]);return _0x2fedfd(_0x41cc16['error']['message']);}logger['error'](_0x4ec2('0x14'),_0x4cd5ac,_0x41cc16[_0x4ec2('0x17')][_0x4ec2('0x19')]);return _0x2b8dc6(_0x41cc16[_0x4ec2('0x17')][_0x4ec2('0x19')]);}else{logger[_0x4ec2('0x13')](_0x4ec2('0x14'),_0x4cd5ac,_0x4ec2('0x15'));_0x2b8dc6(_0x41cc16['result']['message']);}})['catch'](function(_0x5c1982){logger[_0x4ec2('0x17')](_0x4ec2('0x14'),_0x4cd5ac,_0x5c1982);_0x2fedfd(_0x5c1982);});});}function respondWithStatusCode(_0x14dd3f,_0x3f5e99){_0x3f5e99=_0x3f5e99||0xcc;return function(_0x102570){if(_0x102570){return _0x14dd3f[_0x4ec2('0x1a')](_0x3f5e99);}return _0x14dd3f['status'](_0x3f5e99)[_0x4ec2('0x1b')]();};}function respondWithResult(_0x2b9932,_0x2cb22a){_0x2cb22a=_0x2cb22a||0xc8;return function(_0xfbc09d){if(_0xfbc09d){return _0x2b9932[_0x4ec2('0x1c')](_0x2cb22a)['json'](_0xfbc09d);}};}function respondWithFilteredResult(_0x5e0c48,_0x47b1ef){return function(_0x1ea79b){if(_0x1ea79b){var _0x5490f9=typeof _0x47b1ef['offset']===_0x4ec2('0x1d')&&typeof _0x47b1ef[_0x4ec2('0x1e')]===_0x4ec2('0x1d');var _0x8c10e9=_0x1ea79b[_0x4ec2('0x1f')];var _0x575dff=_0x5490f9?0x0:_0x47b1ef[_0x4ec2('0x20')];var _0x31cd93=_0x5490f9?_0x1ea79b[_0x4ec2('0x1f')]:_0x47b1ef[_0x4ec2('0x20')]+_0x47b1ef[_0x4ec2('0x1e')];var _0x504130;if(_0x31cd93>=_0x8c10e9){_0x31cd93=_0x8c10e9;_0x504130=0xc8;}else{_0x504130=0xce;}_0x5e0c48[_0x4ec2('0x1c')](_0x504130);return _0x5e0c48[_0x4ec2('0x21')](_0x4ec2('0x22'),_0x575dff+'-'+_0x31cd93+'/'+_0x8c10e9)[_0x4ec2('0x23')](_0x1ea79b);}return null;};}function saveUpdates(_0x43136b){return function(_0x5b7ce2){if(_0x5b7ce2){return _0x5b7ce2['update'](_0x43136b)[_0x4ec2('0x24')](function(_0x1cc75f){return _0x1cc75f;});}return null;};}function removeEntity(_0x40a32b){return function(_0x5950c8){if(_0x5950c8){return _0x5950c8[_0x4ec2('0x25')]()['then'](function(){var _0x297921=_0x5950c8[_0x4ec2('0x26')]({'plain':!![]});var _0x5d9f6c=_0x4ec2('0x27');return db['UserProfileResource'][_0x4ec2('0x25')]({'where':{'type':_0x5d9f6c,'resourceId':_0x297921['id']}})[_0x4ec2('0x24')](function(){return _0x5950c8;});})[_0x4ec2('0x24')](function(){_0x40a32b[_0x4ec2('0x1c')](0xcc)[_0x4ec2('0x1b')]();});}};}function handleEntityNotFound(_0x1d50cf){return function(_0x265bcd){if(!_0x265bcd){_0x1d50cf['sendStatus'](0x194);}return _0x265bcd;};}function handleError(_0x52219a,_0x264876){_0x264876=_0x264876||0x1f4;return function(_0x27b72e){logger[_0x4ec2('0x17')](_0x27b72e[_0x4ec2('0x28')]);if(_0x27b72e[_0x4ec2('0x29')]){delete _0x27b72e[_0x4ec2('0x29')];}_0x52219a[_0x4ec2('0x1c')](_0x264876)[_0x4ec2('0x2a')](_0x27b72e);};}function getImapHost(_0x20e56d){switch(_0x20e56d){case _0x4ec2('0x2b'):return _0x4ec2('0x2c');case _0x4ec2('0x2d'):return'imap.mail.yahoo.com';case _0x4ec2('0x2e'):return _0x4ec2('0x2f');case'outlook365':return'outlook.office365.com';}throw new Error(_0x4ec2('0x30'),_0x20e56d);}function getSmtpHost(_0x5971cf){switch(_0x5971cf){case'gmail':return _0x4ec2('0x31');case _0x4ec2('0x2d'):return _0x4ec2('0x32');case'hotmail':return _0x4ec2('0x33');case _0x4ec2('0x34'):return _0x4ec2('0x35');}throw new Error(_0x4ec2('0x30'),_0x5971cf);}function getAuthenticationOptions(_0x476da2,_0xf3fd4f){var _0x49ea86={};var _0x30dd48={};if(_0x476da2){_0x49ea86[_0x4ec2('0x36')]=_0x30dd48[_0x4ec2('0x36')]=_0xf3fd4f[_0x4ec2('0x37')];_0x49ea86[_0x4ec2('0x38')]=_0x30dd48[_0x4ec2('0x39')]=_0xf3fd4f[_0x4ec2('0x38')];if(_0xf3fd4f['modernAuthentication']){_0x49ea86['modernAuthentication']=_0x30dd48[_0x4ec2('0x3a')]=!![];_0x49ea86['CloudProviderId']=_0x30dd48[_0x4ec2('0x3b')]=_0xf3fd4f[_0x4ec2('0x3b')];_0x49ea86[_0x4ec2('0x38')]=_0x30dd48[_0x4ec2('0x39')]=null;}else{_0x49ea86['CloudProviderId']=_0x30dd48['CloudProviderId']=null;}_0x49ea86['host']=getImapHost(_0x476da2);_0x49ea86[_0x4ec2('0x3c')]=0x3e1;_0x30dd48[_0x4ec2('0x3d')]=getSmtpHost(_0x476da2);_0x30dd48[_0x4ec2('0x3c')]=0x24b;_0x30dd48[_0x4ec2('0x3e')]=![];_0x49ea86[_0x4ec2('0x3f')]=_0x30dd48[_0x4ec2('0x3f')]=null;}else{if(_0xf3fd4f['authentication']){_0x49ea86[_0x4ec2('0x36')]=_0x30dd48[_0x4ec2('0x36')]=_0xf3fd4f[_0x4ec2('0x37')];_0x49ea86[_0x4ec2('0x38')]=_0x30dd48[_0x4ec2('0x39')]=_0xf3fd4f['password'];}else{_0x49ea86[_0x4ec2('0x40')]=_0x30dd48['authentication']=![];_0x49ea86[_0x4ec2('0x36')]=_0x30dd48[_0x4ec2('0x36')]=null;_0x49ea86[_0x4ec2('0x38')]=_0x30dd48[_0x4ec2('0x39')]=null;}_0x49ea86[_0x4ec2('0x3d')]=_0xf3fd4f[_0x4ec2('0x41')][_0x4ec2('0x3d')];_0x49ea86['port']=_0xf3fd4f[_0x4ec2('0x41')][_0x4ec2('0x3c')];_0x30dd48['host']=_0xf3fd4f[_0x4ec2('0x42')][_0x4ec2('0x3d')];_0x30dd48['port']=_0xf3fd4f[_0x4ec2('0x42')][_0x4ec2('0x3c')];}return{'Imap':_0x49ea86,'Smtp':_0x30dd48};}exports['index']=function(_0x488dab,_0x50af2c){var _0x2fac63={'include':[{'model':db[_0x4ec2('0x43')],'as':_0x4ec2('0x41')},{'model':db[_0x4ec2('0x44')],'as':_0x4ec2('0x42')},{'model':db[_0x4ec2('0x45')],'as':_0x4ec2('0x46')}]},_0x3a6dae={},_0x441efe={'count':0x0,'rows':[]};var _0x24f79f=_['map'](db[_0x4ec2('0x47')]['rawAttributes'],function(_0x5af3d7){return{'name':_0x5af3d7['fieldName'],'type':_0x5af3d7[_0x4ec2('0x48')][_0x4ec2('0x49')]};});_0x3a6dae[_0x4ec2('0x4a')]=_[_0x4ec2('0x4b')](_0x24f79f,_0x4ec2('0x29'));_0x3a6dae['query']=_['keys'](_0x488dab[_0x4ec2('0x4c')]);_0x3a6dae[_0x4ec2('0x4d')]=_['intersection'](_0x3a6dae[_0x4ec2('0x4a')],_0x3a6dae['query']);_0x2fac63[_0x4ec2('0x4e')]=_[_0x4ec2('0x4f')](_0x3a6dae[_0x4ec2('0x4a')],qs[_0x4ec2('0x50')](_0x488dab['query']['fields']));_0x2fac63[_0x4ec2('0x4e')]=_0x2fac63['attributes']['length']?_0x2fac63[_0x4ec2('0x4e')]:_0x3a6dae['model'];if(!_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x51')](_0x4ec2('0x52'))){_0x2fac63[_0x4ec2('0x1e')]=qs['limit'](_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x1e')]);_0x2fac63[_0x4ec2('0x20')]=qs[_0x4ec2('0x20')](_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x20')]);}_0x2fac63[_0x4ec2('0x53')]=qs[_0x4ec2('0x54')](_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x54')]);_0x2fac63[_0x4ec2('0x55')]=qs['filters'](_['pick'](_0x488dab[_0x4ec2('0x4c')],_0x3a6dae[_0x4ec2('0x4d')]),_0x24f79f);if(_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x56')]){_0x2fac63[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x2fac63[_0x4ec2('0x55')],{'$or':_[_0x4ec2('0x4b')](_0x24f79f,function(_0x5add2a){if(_0x5add2a[_0x4ec2('0x48')]!==_0x4ec2('0x58')){var _0x387563={};_0x387563[_0x5add2a['name']]={'$like':'%'+_0x488dab[_0x4ec2('0x4c')]['filter']+'%'};return _0x387563;}})});}_0x2fac63=_[_0x4ec2('0x57')]({},_0x2fac63,_0x488dab[_0x4ec2('0x59')]);var _0x44a385={'where':_0x2fac63[_0x4ec2('0x55')]};return db['MailAccount'][_0x4ec2('0x1f')](_0x44a385)[_0x4ec2('0x24')](function(_0x994f56){_0x441efe['count']=_0x994f56;if(_0x488dab[_0x4ec2('0x4c')][_0x4ec2('0x5a')]){_0x2fac63[_0x4ec2('0x5b')]=[{'all':!![]}];}return db[_0x4ec2('0x47')]['findAll'](_0x2fac63);})[_0x4ec2('0x24')](function(_0x39e1ab){_0x441efe[_0x4ec2('0x5c')]=_0x39e1ab;return _0x441efe;})[_0x4ec2('0x24')](respondWithFilteredResult(_0x50af2c,_0x2fac63))[_0x4ec2('0x5d')](handleError(_0x50af2c,null));};exports[_0x4ec2('0x5e')]=function(_0x14528b,_0x391adf){var _0x365dc0={'raw':![],'where':{'id':_0x14528b[_0x4ec2('0x5f')]['id']},'include':[{'model':db[_0x4ec2('0x43')],'as':_0x4ec2('0x41')},{'model':db[_0x4ec2('0x44')],'as':_0x4ec2('0x42')},{'model':db[_0x4ec2('0x45')],'as':_0x4ec2('0x46')}]},_0x3db120={};_0x3db120[_0x4ec2('0x4a')]=_[_0x4ec2('0x60')](db[_0x4ec2('0x47')][_0x4ec2('0x61')]);_0x3db120[_0x4ec2('0x4c')]=_[_0x4ec2('0x60')](_0x14528b[_0x4ec2('0x4c')]);_0x3db120['filters']=_['intersection'](_0x3db120[_0x4ec2('0x4a')],_0x3db120['query']);_0x365dc0[_0x4ec2('0x4e')]=_[_0x4ec2('0x4f')](_0x3db120[_0x4ec2('0x4a')],qs['fields'](_0x14528b['query'][_0x4ec2('0x50')]));_0x365dc0['attributes']=_0x365dc0[_0x4ec2('0x4e')][_0x4ec2('0x62')]?_0x365dc0[_0x4ec2('0x4e')]:_0x3db120['model'];if(_0x14528b[_0x4ec2('0x4c')][_0x4ec2('0x5a')]){_0x365dc0[_0x4ec2('0x5b')]=[{'all':!![]}];}_0x365dc0=_[_0x4ec2('0x57')]({},_0x365dc0,_0x14528b[_0x4ec2('0x59')]);return db[_0x4ec2('0x47')][_0x4ec2('0x63')](_0x365dc0)['then'](handleEntityNotFound(_0x391adf,null))[_0x4ec2('0x24')](respondWithResult(_0x391adf,null))[_0x4ec2('0x5d')](handleError(_0x391adf,null));};exports['update']=function(_0x20048b,_0x3ed5a1){if(_0x20048b[_0x4ec2('0x64')]['id']){delete _0x20048b[_0x4ec2('0x64')]['id'];}var _0x45104a=_0x20048b[_0x4ec2('0x64')]['provider']===_0x4ec2('0x65')?null:_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x66')];var _0x137492=_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x41')]||{};var _0x35dfac=_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x42')]||{};if(_0x45104a){_0x137492[_0x4ec2('0x3d')]=getImapHost(_0x45104a);_0x137492[_0x4ec2('0x3c')]=0x3e1;_0x35dfac[_0x4ec2('0x3d')]=getSmtpHost(_0x45104a);_0x35dfac['port']=0x24b;_0x35dfac[_0x4ec2('0x3e')]=![];}if(_0x35dfac[_0x4ec2('0x3a')]){_0x35dfac[_0x4ec2('0x3e')]=![];}else{_0x35dfac[_0x4ec2('0x3b')]=null;}if(!_0x137492[_0x4ec2('0x3a')])_0x137492['CloudProviderId']=null;_0x20048b['body'][_0x4ec2('0x41')]=_0x137492;_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x42')]=_0x35dfac;return db[_0x4ec2('0x47')]['find']({'where':{'id':_0x20048b[_0x4ec2('0x5f')]['id']},'include':[{'model':db[_0x4ec2('0x43')],'as':'Imap'},{'model':db[_0x4ec2('0x44')],'as':'Smtp'},{'model':db[_0x4ec2('0x45')],'as':_0x4ec2('0x46')}]})[_0x4ec2('0x24')](handleEntityNotFound(_0x3ed5a1,null))[_0x4ec2('0x24')](function(_0x34f935){if(!_0x34f935)throw new Error('Mail\x20Account\x20not\x20found');if(_0x34f935[_0x4ec2('0x3f')])delete _0x20048b[_0x4ec2('0x64')][_0x4ec2('0x41')];return _0x34f935;})[_0x4ec2('0x24')](saveUpdates(_0x20048b[_0x4ec2('0x64')],null))['then'](function(_0x5dac5e){if(!_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x41')])return _0x5dac5e;return db[_0x4ec2('0x43')]['update'](_0x20048b['body'][_0x4ec2('0x41')],{'where':{'MailAccountId':_0x5dac5e['id']}})[_0x4ec2('0x24')](function(){return _0x5dac5e;});})['then'](function(_0x3e6d4d){if(!_0x20048b[_0x4ec2('0x64')][_0x4ec2('0x42')])return _0x3e6d4d;return db['MailServerOut'][_0x4ec2('0x67')](_0x20048b[_0x4ec2('0x64')]['Smtp'],{'where':{'MailAccountId':_0x3e6d4d['id']}})[_0x4ec2('0x24')](function(){return _0x3e6d4d;});})[_0x4ec2('0x24')](respondWithResult(_0x3ed5a1,null))[_0x4ec2('0x5d')](handleError(_0x3ed5a1,null));};exports[_0x4ec2('0x68')]=function(_0x38a0f7,_0x518b05){return db[_0x4ec2('0x47')][_0x4ec2('0x68')]()[_0x4ec2('0x24')](respondWithResult(_0x518b05,null))[_0x4ec2('0x5d')](handleError(_0x518b05,null));};exports[_0x4ec2('0x69')]=function(_0x41f263,_0x39fd9a){if(_0x41f263[_0x4ec2('0x64')]['id']){delete _0x41f263[_0x4ec2('0x64')]['id'];}return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x41f263[_0x4ec2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x39fd9a,null))[_0x4ec2('0x24')](function(_0x22e7a6){if(_0x22e7a6){_0x41f263[_0x4ec2('0x64')][_0x4ec2('0x6a')]=_0x22e7a6['id'];return db[_0x4ec2('0x6b')][_0x4ec2('0x6c')](_0x41f263[_0x4ec2('0x64')]);}})[_0x4ec2('0x24')](respondWithResult(_0x39fd9a,null))['catch'](handleError(_0x39fd9a,null));};exports[_0x4ec2('0x6d')]=function(_0x2c9e15,_0x44bba7){var _0x1042d5={'raw':![],'where':{}};var _0x152592={};var _0x4bc450={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2c9e15[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x44bba7,null))['then'](function(_0x53c43c){if(_0x53c43c){_0x152592[_0x4ec2('0x4a')]=_[_0x4ec2('0x60')](db['Disposition'][_0x4ec2('0x61')]);_0x152592['query']=_[_0x4ec2('0x60')](_0x2c9e15[_0x4ec2('0x4c')]);_0x152592[_0x4ec2('0x4d')]=_[_0x4ec2('0x4f')](_0x152592[_0x4ec2('0x4a')],_0x152592[_0x4ec2('0x4c')]);_0x1042d5[_0x4ec2('0x4e')]=_[_0x4ec2('0x4f')](_0x152592[_0x4ec2('0x4a')],qs[_0x4ec2('0x50')](_0x2c9e15['query'][_0x4ec2('0x50')]));_0x1042d5[_0x4ec2('0x4e')]=_0x1042d5['attributes'][_0x4ec2('0x62')]?_0x1042d5['attributes']:_0x152592[_0x4ec2('0x4a')];if(!_0x2c9e15[_0x4ec2('0x4c')][_0x4ec2('0x51')](_0x4ec2('0x52'))){_0x1042d5[_0x4ec2('0x1e')]=qs[_0x4ec2('0x1e')](_0x2c9e15['query'][_0x4ec2('0x1e')]);_0x1042d5['offset']=qs[_0x4ec2('0x20')](_0x2c9e15[_0x4ec2('0x4c')][_0x4ec2('0x20')]);}_0x1042d5[_0x4ec2('0x53')]=qs['sort'](_0x2c9e15['query'][_0x4ec2('0x54')]);_0x1042d5[_0x4ec2('0x55')]=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0x2c9e15[_0x4ec2('0x4c')],_0x152592[_0x4ec2('0x4d')]));_0x1042d5['where'][_0x4ec2('0x6a')]=_0x53c43c['id'];if(_0x2c9e15['query']['filter']){_0x1042d5[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x1042d5[_0x4ec2('0x55')],{'$or':_['map'](_0x1042d5[_0x4ec2('0x4e')],function(_0x58a869){var _0x4d9dd4={};_0x4d9dd4[_0x58a869]={'$like':'%'+_0x2c9e15[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x4d9dd4;})});}_0x1042d5=_[_0x4ec2('0x57')]({},_0x1042d5,_0x2c9e15[_0x4ec2('0x59')]);return db[_0x4ec2('0x6b')][_0x4ec2('0x1f')]({'where':_0x1042d5[_0x4ec2('0x55')]})[_0x4ec2('0x24')](function(_0x57ee47){_0x4bc450['count']=_0x57ee47;if(_0x2c9e15[_0x4ec2('0x4c')][_0x4ec2('0x5a')]){_0x1042d5[_0x4ec2('0x5b')]=[{'all':!![]}];}return db[_0x4ec2('0x6b')][_0x4ec2('0x6f')](_0x1042d5);})[_0x4ec2('0x24')](function(_0x1d1f5c){_0x4bc450[_0x4ec2('0x5c')]=_0x1d1f5c;return _0x4bc450;});}})[_0x4ec2('0x24')](respondWithFilteredResult(_0x44bba7,_0x1042d5))['catch'](handleError(_0x44bba7,null));};exports['removeDispositions']=function(_0x227e0d,_0x505552){return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x227e0d[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x505552,null))['then'](function(_0x31efce){if(_0x31efce){return _0x31efce[_0x4ec2('0x70')](_0x227e0d[_0x4ec2('0x4c')][_0x4ec2('0x71')]);}})[_0x4ec2('0x24')](respondWithStatusCode(_0x505552,null))[_0x4ec2('0x5d')](handleError(_0x505552,null));};exports[_0x4ec2('0x72')]=function(_0xe9f3b7,_0x398305){if(_0xe9f3b7[_0x4ec2('0x64')]['id']){delete _0xe9f3b7[_0x4ec2('0x64')]['id'];}return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0xe9f3b7[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x398305,null))['then'](function(_0x2c6737){if(_0x2c6737){_0xe9f3b7['body']['MailAccountId']=_0x2c6737['id'];return db[_0x4ec2('0x73')][_0x4ec2('0x6c')](_0xe9f3b7['body']);}})['then'](respondWithResult(_0x398305,null))[_0x4ec2('0x5d')](handleError(_0x398305,null));};exports[_0x4ec2('0x74')]=function(_0xaa54a2,_0x5cb982){var _0x57670f={'raw':![],'where':{}};var _0x11959d={};var _0x2309a7={'count':0x0,'rows':[]};return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0xaa54a2[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x5cb982,null))[_0x4ec2('0x24')](function(_0x26b7a1){if(_0x26b7a1){_0x11959d['model']=_['keys'](db['CannedAnswer'][_0x4ec2('0x61')]);_0x11959d[_0x4ec2('0x4c')]=_[_0x4ec2('0x60')](_0xaa54a2[_0x4ec2('0x4c')]);_0x11959d[_0x4ec2('0x4d')]=_[_0x4ec2('0x4f')](_0x11959d['model'],_0x11959d[_0x4ec2('0x4c')]);_0x57670f[_0x4ec2('0x4e')]=_[_0x4ec2('0x4f')](_0x11959d[_0x4ec2('0x4a')],qs[_0x4ec2('0x50')](_0xaa54a2['query'][_0x4ec2('0x50')]));_0x57670f[_0x4ec2('0x4e')]=_0x57670f[_0x4ec2('0x4e')][_0x4ec2('0x62')]?_0x57670f[_0x4ec2('0x4e')]:_0x11959d[_0x4ec2('0x4a')];if(!_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x51')]('nolimit')){_0x57670f[_0x4ec2('0x1e')]=qs[_0x4ec2('0x1e')](_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x1e')]);_0x57670f['offset']=qs['offset'](_0xaa54a2[_0x4ec2('0x4c')]['offset']);}_0x57670f['order']=qs['sort'](_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x54')]);_0x57670f['where']=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0xaa54a2[_0x4ec2('0x4c')],_0x11959d['filters']));_0x57670f['where']['MailAccountId']=_0x26b7a1['id'];if(_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x56')]){_0x57670f[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x57670f[_0x4ec2('0x55')],{'$or':_['map'](_0x57670f['attributes'],function(_0x1d3c27){var _0x2c0567={};_0x2c0567[_0x1d3c27]={'$like':'%'+_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x2c0567;})});}_0x57670f=_['merge']({},_0x57670f,_0xaa54a2['options']);return db[_0x4ec2('0x73')][_0x4ec2('0x1f')]({'where':_0x57670f[_0x4ec2('0x55')]})[_0x4ec2('0x24')](function(_0xe136ba){_0x2309a7['count']=_0xe136ba;if(_0xaa54a2[_0x4ec2('0x4c')][_0x4ec2('0x5a')]){_0x57670f['include']=[{'all':!![]}];}return db[_0x4ec2('0x73')]['findAll'](_0x57670f);})['then'](function(_0x3e80c3){_0x2309a7['rows']=_0x3e80c3;return _0x2309a7;});}})[_0x4ec2('0x24')](respondWithFilteredResult(_0x5cb982,_0x57670f))['catch'](handleError(_0x5cb982,null));};exports['removeAnswers']=function(_0x5b7aac,_0x14a482){return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x5b7aac[_0x4ec2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x14a482,null))[_0x4ec2('0x24')](function(_0x795b3d){if(_0x795b3d){return _0x795b3d[_0x4ec2('0x76')](_0x5b7aac['query'][_0x4ec2('0x71')]);}})[_0x4ec2('0x24')](respondWithStatusCode(_0x14a482,null))[_0x4ec2('0x5d')](handleError(_0x14a482,null));};exports['create']=function(_0x13b44a,_0x3e9efc){var _0x18a947={'name':_0x13b44a['body'][_0x4ec2('0x29')],'key':_0x13b44a['body'][_0x4ec2('0x49')],'provider':_0x13b44a['body'][_0x4ec2('0x66')]==='custom'?null:_0x13b44a['body'][_0x4ec2('0x66')],'email':_0x13b44a[_0x4ec2('0x64')]['email'],'ListId':_0x13b44a['body'][_0x4ec2('0x77')],'active':!_[_0x4ec2('0x78')](_0x13b44a[_0x4ec2('0x64')][_0x4ec2('0x79')])?_0x13b44a[_0x4ec2('0x64')][_0x4ec2('0x79')]:!![],'description':_0x13b44a[_0x4ec2('0x64')][_0x4ec2('0x7a')]||null};var _0x39c48c=getAuthenticationOptions(_0x18a947[_0x4ec2('0x66')],_0x13b44a[_0x4ec2('0x64')]);_0x18a947[_0x4ec2('0x41')]=_0x39c48c[_0x4ec2('0x41')];_0x18a947['Smtp']=_0x39c48c[_0x4ec2('0x42')];return db['MailAccount'][_0x4ec2('0x6c')](_0x18a947,{'include':[{'model':db[_0x4ec2('0x44')],'as':'Smtp'},{'model':db[_0x4ec2('0x43')],'as':_0x4ec2('0x41')}]})[_0x4ec2('0x24')](function(_0x2b208c){var _0x40aa64=_0x13b44a['user']['get']({'plain':!![]});if(!_0x40aa64)throw new Error(_0x4ec2('0x7b'));if(_0x40aa64[_0x4ec2('0x7c')]===_0x4ec2('0x36')){var _0x37cbb1=_0x2b208c[_0x4ec2('0x26')]({'plain':!![]});return db[_0x4ec2('0x7d')][_0x4ec2('0x63')]({'where':{'name':'MailAccounts','userProfileId':_0x40aa64[_0x4ec2('0x7e')]},'raw':!![]})[_0x4ec2('0x24')](function(_0x2661d7){if(_0x2661d7&&_0x2661d7['autoAssociation']===0x0){return db['UserProfileResource'][_0x4ec2('0x6c')]({'name':_0x37cbb1[_0x4ec2('0x29')],'resourceId':_0x37cbb1['id'],'type':_0x2661d7['name'],'sectionId':_0x2661d7['id']},{})['then'](function(){return _0x2b208c;});}else{return _0x2b208c;}})[_0x4ec2('0x5d')](function(_0x47781b){logger[_0x4ec2('0x17')](_0x4ec2('0x7f'),_0x47781b);throw _0x47781b;});}return _0x2b208c;})[_0x4ec2('0x24')](respondWithResult(_0x3e9efc,0xc9))[_0x4ec2('0x5d')](handleError(_0x3e9efc,null));};exports[_0x4ec2('0x80')]=function(_0x3f463c,_0x3b0ca7){return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0x3f463c[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x3b0ca7,null))['then'](function(_0x27659e){if(_0x27659e){return _0x27659e[_0x4ec2('0x80')]();}return null;})[_0x4ec2('0x24')](respondWithResult(_0x3b0ca7,null))[_0x4ec2('0x5d')](handleError(_0x3b0ca7,null));};exports[_0x4ec2('0x81')]=function(_0x339268,_0x1d74b3){if(_0x339268[_0x4ec2('0x64')]['id']){delete _0x339268[_0x4ec2('0x64')]['id'];}return db['MailAccount'][_0x4ec2('0x63')]({'where':{'id':_0x339268[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x1d74b3,null))[_0x4ec2('0x24')](function(_0x87d00e){if(_0x87d00e){_0x339268['body'][_0x4ec2('0x6a')]=_0x87d00e['id'];return db['MailServerIn'][_0x4ec2('0x6c')](_0x339268[_0x4ec2('0x64')]);}})[_0x4ec2('0x24')](respondWithResult(_0x1d74b3,null))[_0x4ec2('0x5d')](handleError(_0x1d74b3,null));};exports['removeImap']=function(_0x162435,_0x306f65){return db[_0x4ec2('0x47')]['findOne']({'where':{'id':_0x162435['params']['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x306f65,null))[_0x4ec2('0x24')](function(_0x5287e1){if(_0x5287e1){return _0x5287e1[_0x4ec2('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x306f65,null))[_0x4ec2('0x5d')](handleError(_0x306f65,null));};exports[_0x4ec2('0x83')]=function(_0x5f49cf,_0xe6f3ea){return db[_0x4ec2('0x47')]['findOne']({'where':{'id':_0x5f49cf[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0xe6f3ea,null))[_0x4ec2('0x24')](function(_0x20d2e6){if(_0x20d2e6){return _0x20d2e6[_0x4ec2('0x83')]();}return null;})[_0x4ec2('0x24')](respondWithResult(_0xe6f3ea,null))[_0x4ec2('0x5d')](handleError(_0xe6f3ea,null));};exports['addSmtp']=function(_0x493901,_0x539088){if(_0x493901[_0x4ec2('0x64')]['id']){delete _0x493901[_0x4ec2('0x64')]['id'];}return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x493901['params']['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x539088,null))[_0x4ec2('0x24')](function(_0x119f7c){if(_0x119f7c){_0x493901['body'][_0x4ec2('0x6a')]=_0x119f7c['id'];return db[_0x4ec2('0x44')]['create'](_0x493901[_0x4ec2('0x64')]);}})['then'](respondWithResult(_0x539088,null))[_0x4ec2('0x5d')](handleError(_0x539088,null));};exports['removeSmtp']=function(_0x554863,_0x54701c){return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0x554863['params']['id']}})['then'](handleEntityNotFound(_0x54701c,null))[_0x4ec2('0x24')](function(_0x44da76){if(_0x44da76){return _0x44da76['setSmtp'](null);}return null;})[_0x4ec2('0x24')](respondWithStatusCode(_0x54701c,null))['catch'](handleError(_0x54701c,null));};exports[_0x4ec2('0x84')]=function(_0x251e60,_0x5b4b18){return db[_0x4ec2('0x85')]['find']({'where':{'id':_0x251e60[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x5b4b18,null))[_0x4ec2('0x24')](function(_0x3511f4){if(_0x3511f4){return _0x3511f4[_0x4ec2('0x84')](_0x251e60['body']['ids'],_[_0x4ec2('0x86')](_0x251e60[_0x4ec2('0x64')],[_0x4ec2('0x71'),'id'])||{});}})[_0x4ec2('0x24')](respondWithResult(_0x5b4b18,null))[_0x4ec2('0x5d')](handleError(_0x5b4b18,null));};exports['getInteractions']=function(_0x405e3b,_0x31fa37){var _0x35c86f={'raw':![],'where':{}};var _0x6d07ba={};var _0x59acfa={'count':0x0,'rows':[]};return db[_0x4ec2('0x47')]['findOne']({'where':{'id':_0x405e3b[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x31fa37,null))[_0x4ec2('0x24')](function(_0x523960){if(_0x523960){_0x6d07ba[_0x4ec2('0x4a')]=_[_0x4ec2('0x60')](db[_0x4ec2('0x85')][_0x4ec2('0x61')]);_0x6d07ba[_0x4ec2('0x4c')]=_['keys'](_0x405e3b[_0x4ec2('0x4c')]);_0x6d07ba[_0x4ec2('0x4d')]=_[_0x4ec2('0x4f')](_0x6d07ba[_0x4ec2('0x4a')],_0x6d07ba['query']);_0x35c86f['attributes']=_[_0x4ec2('0x4f')](_0x6d07ba['model'],qs[_0x4ec2('0x50')](_0x405e3b['query'][_0x4ec2('0x50')]));_0x35c86f[_0x4ec2('0x4e')]=_0x35c86f[_0x4ec2('0x4e')][_0x4ec2('0x62')]?_0x35c86f[_0x4ec2('0x4e')]:_0x6d07ba[_0x4ec2('0x4a')];if(!_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x51')](_0x4ec2('0x52'))){_0x35c86f[_0x4ec2('0x1e')]=qs['limit'](_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x1e')]);_0x35c86f[_0x4ec2('0x20')]=qs[_0x4ec2('0x20')](_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x20')]);}_0x35c86f[_0x4ec2('0x53')]=qs[_0x4ec2('0x54')](_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x54')]);_0x35c86f[_0x4ec2('0x55')]=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0x405e3b[_0x4ec2('0x4c')],_0x6d07ba[_0x4ec2('0x4d')]));_0x35c86f[_0x4ec2('0x55')][_0x4ec2('0x6a')]=_0x523960['id'];if(_0x405e3b['query'][_0x4ec2('0x56')]){_0x35c86f[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x35c86f[_0x4ec2('0x55')],{'$or':_['map'](_0x35c86f['attributes'],function(_0x70ce60){var _0x9413c0={};_0x9413c0[_0x70ce60]={'$like':'%'+_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x9413c0;})});}_0x35c86f=_['merge']({},_0x35c86f,_0x405e3b[_0x4ec2('0x59')]);return db[_0x4ec2('0x85')]['count']({'where':_0x35c86f[_0x4ec2('0x55')]})[_0x4ec2('0x24')](function(_0x32aed3){_0x59acfa[_0x4ec2('0x1f')]=_0x32aed3;if(_0x405e3b[_0x4ec2('0x4c')]['includeAll']){_0x35c86f[_0x4ec2('0x5b')]=[{'model':db['CmContact'],'as':_0x4ec2('0x87'),'required':![]},{'model':db[_0x4ec2('0x88')],'as':'Owner','attributes':[_0x4ec2('0x29'),_0x4ec2('0x89'),_0x4ec2('0x8a')],'required':![]},{'model':db[_0x4ec2('0x8b')],'as':_0x4ec2('0x8c'),'attributes':['id',_0x4ec2('0x29'),_0x4ec2('0x8d')],'where':_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x8e')]?{'id':_0x405e3b[_0x4ec2('0x4c')][_0x4ec2('0x8e')]}:undefined,'required':_0x405e3b['query'][_0x4ec2('0x8e')]?!![]:![]}];}return db[_0x4ec2('0x85')][_0x4ec2('0x6f')](_0x35c86f);})[_0x4ec2('0x24')](function(_0x3169ea){_0x59acfa[_0x4ec2('0x5c')]=_0x3169ea;return _0x59acfa;});}})[_0x4ec2('0x24')](respondWithFilteredResult(_0x31fa37,_0x35c86f))[_0x4ec2('0x5d')](handleError(_0x31fa37,null));};exports[_0x4ec2('0x8f')]=function addApplications(_0x5d7fc8,_0x4425cf){var _0x13aede=_0x5d7fc8[_0x4ec2('0x5f')]['id'];var _0x28743a=_0x5d7fc8['body'];var _0x35a1d5=0xc8;var _0x1672a7=null;return db[_0x4ec2('0x90')]['transaction']({'isolationLevel':db['sequelize'][_0x4ec2('0x91')][_0x4ec2('0x92')]['READ_COMMITTED']},function(_0x4490a9){return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0x13aede},'transaction':_0x4490a9})[_0x4ec2('0x24')](function(_0x28228a){if(_0x28228a){return db[_0x4ec2('0x93')][_0x4ec2('0x25')]({'where':{'MailAccountId':_0x13aede},'transaction':_0x4490a9})['then'](function(){var _0x28e05e=_[_0x4ec2('0x4b')](_0x28743a,function(_0x7ae136){_0x7ae136[_0x4ec2('0x6a')]=_0x13aede;return _0x7ae136;});return db[_0x4ec2('0x93')][_0x4ec2('0x94')](_0x28e05e,{'transaction':_0x4490a9});});}else{_0x35a1d5=0x194;_0x1672a7=[];}});})['then'](function(){if(_0x35a1d5!==0x194){return db['MailApplication'][_0x4ec2('0x95')]({'where':{'MailAccountId':_0x13aede},'order':'priority'})[_0x4ec2('0x24')](function(_0x40221f){_0x1672a7=_0x40221f;});}})['catch'](function(_0x3a88b5){_0x35a1d5=0x1f4;logger[_0x4ec2('0x17')](_0x3a88b5[_0x4ec2('0x28')]);if(_0x3a88b5[_0x4ec2('0x29')]){delete _0x3a88b5[_0x4ec2('0x29')];}_0x1672a7=_0x3a88b5;})[_0x4ec2('0x96')](function(){if(_0x1672a7===null){_0x4425cf[_0x4ec2('0x1a')](_0x35a1d5);}else{if(_0x35a1d5===0x1f4){_0x4425cf['status'](_0x35a1d5)[_0x4ec2('0x2a')](_0x1672a7);}else{_0x4425cf['status'](_0x35a1d5)[_0x4ec2('0x23')](_0x1672a7);}}});};exports['getApplications']=function(_0x2192ac,_0x568540){var _0x3c4a8b={};var _0x3432bb={};var _0x19d12c;var _0x3b3e8d;return db['MailAccount'][_0x4ec2('0x75')]({'where':{'id':_0x2192ac[_0x4ec2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x568540,null))['then'](function(_0xdb01c3){if(_0xdb01c3){_0x19d12c=_0xdb01c3;_0x3432bb[_0x4ec2('0x4a')]=_[_0x4ec2('0x60')](db[_0x4ec2('0x93')][_0x4ec2('0x61')]);_0x3432bb[_0x4ec2('0x4c')]=_[_0x4ec2('0x60')](_0x2192ac[_0x4ec2('0x4c')]);_0x3432bb[_0x4ec2('0x4d')]=_[_0x4ec2('0x4f')](_0x3432bb[_0x4ec2('0x4a')],_0x3432bb[_0x4ec2('0x4c')]);_0x3c4a8b['attributes']=_[_0x4ec2('0x4f')](_0x3432bb[_0x4ec2('0x4a')],qs[_0x4ec2('0x50')](_0x2192ac[_0x4ec2('0x4c')][_0x4ec2('0x50')]));_0x3c4a8b[_0x4ec2('0x4e')]=_0x3c4a8b[_0x4ec2('0x4e')][_0x4ec2('0x62')]?_0x3c4a8b['attributes']:_0x3432bb[_0x4ec2('0x4a')];_0x3c4a8b[_0x4ec2('0x53')]=qs[_0x4ec2('0x54')](_0x2192ac[_0x4ec2('0x4c')][_0x4ec2('0x54')]);_0x3c4a8b['where']=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0x2192ac[_0x4ec2('0x4c')],_0x3432bb['filters']));if(_0x2192ac[_0x4ec2('0x4c')]['filter']){_0x3c4a8b['where']=_[_0x4ec2('0x57')](_0x3c4a8b['where'],{'$or':_[_0x4ec2('0x4b')](_0x3c4a8b[_0x4ec2('0x4e')],function(_0x3fc59c){var _0x4bd043={};_0x4bd043[_0x3fc59c]={'$like':'%'+_0x2192ac[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x4bd043;})});}_0x3c4a8b=_['merge']({},_0x3c4a8b,_0x2192ac['options']);return _0x19d12c[_0x4ec2('0x97')](_0x3c4a8b);}})[_0x4ec2('0x24')](function(_0x794f6e){if(_0x794f6e){_0x3b3e8d=_0x794f6e[_0x4ec2('0x62')];if(!_0x2192ac['query']['hasOwnProperty']('nolimit')){_0x3c4a8b[_0x4ec2('0x1e')]=qs[_0x4ec2('0x1e')](_0x2192ac[_0x4ec2('0x4c')][_0x4ec2('0x1e')]);_0x3c4a8b[_0x4ec2('0x20')]=qs[_0x4ec2('0x20')](_0x2192ac[_0x4ec2('0x4c')]['offset']);}return _0x19d12c['getApplications'](_0x3c4a8b);}})[_0x4ec2('0x24')](function(_0x3c0440){if(_0x3c0440){return _0x3c0440?{'count':_0x3b3e8d,'rows':_0x3c0440}:null;}})['then'](respondWithResult(_0x568540,null))[_0x4ec2('0x5d')](handleError(_0x568540,null));};exports['getMessages']=function(_0x519115,_0x57ba1a){var _0x1e8b2b={'raw':!![],'where':{}};var _0x31f0ae={};var _0x2cbed0={'count':0x0,'rows':[]};return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0x519115['params']['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x57ba1a,null))[_0x4ec2('0x24')](function(_0x244b2e){if(_0x244b2e){_0x31f0ae[_0x4ec2('0x4a')]=_[_0x4ec2('0x60')](db[_0x4ec2('0x98')][_0x4ec2('0x61')]);_0x31f0ae[_0x4ec2('0x4c')]=_[_0x4ec2('0x60')](_0x519115[_0x4ec2('0x4c')]);_0x31f0ae['filters']=_[_0x4ec2('0x4f')](_0x31f0ae[_0x4ec2('0x4a')],_0x31f0ae[_0x4ec2('0x4c')]);_0x1e8b2b['attributes']=_[_0x4ec2('0x4f')](_0x31f0ae[_0x4ec2('0x4a')],qs['fields'](_0x519115['query'][_0x4ec2('0x50')]));_0x1e8b2b[_0x4ec2('0x4e')]=_0x1e8b2b['attributes']['length']?_0x1e8b2b[_0x4ec2('0x4e')]:_0x31f0ae[_0x4ec2('0x4a')];if(!_0x519115[_0x4ec2('0x4c')]['hasOwnProperty'](_0x4ec2('0x52'))){_0x1e8b2b[_0x4ec2('0x1e')]=qs['limit'](_0x519115['query'][_0x4ec2('0x1e')]);_0x1e8b2b[_0x4ec2('0x20')]=qs['offset'](_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x20')]);}_0x1e8b2b[_0x4ec2('0x53')]=qs[_0x4ec2('0x54')](_0x519115['query'][_0x4ec2('0x54')]);_0x1e8b2b[_0x4ec2('0x55')]=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0x519115[_0x4ec2('0x4c')],_0x31f0ae['filters']));_0x1e8b2b['where'][_0x4ec2('0x6a')]=_0x244b2e['id'];if(_0x519115[_0x4ec2('0x4c')]['filter']){_0x1e8b2b[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x1e8b2b['where'],{'$or':_[_0x4ec2('0x4b')](_0x1e8b2b[_0x4ec2('0x4e')],function(_0x22ba65){var _0x4a94ff={};_0x4a94ff[_0x22ba65]={'$like':'%'+_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x4a94ff;})});}if(_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x99')]){var _0x2f2c9c=_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x99')]['split'](',');var _0x459dc7={};_0x459dc7[_0x2f2c9c[0x0]]={'$gte':moment(_0x2f2c9c[0x1])[_0x4ec2('0x9a')](_0x4ec2('0x9b'))};_0x1e8b2b['where']=_['merge'](_0x1e8b2b['where'],_0x459dc7);}_0x1e8b2b=_[_0x4ec2('0x57')]({},_0x1e8b2b,_0x519115[_0x4ec2('0x59')]);return db['MailMessage'][_0x4ec2('0x1f')]({'where':_0x1e8b2b[_0x4ec2('0x55')]})['then'](function(_0x4bc9c8){_0x2cbed0[_0x4ec2('0x1f')]=_0x4bc9c8;if(_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x5a')]){_0x1e8b2b[_0x4ec2('0x5b')]=[{'all':!![]}];}return db[_0x4ec2('0x98')][_0x4ec2('0x6f')](_0x1e8b2b);})['then'](function(_0x17a7e3){if(_0x519115[_0x4ec2('0x4c')][_0x4ec2('0x9c')]===_0x4ec2('0x9d')){for(var _0x160f77=0x0;_0x160f77<_0x17a7e3['length'];_0x160f77++){_0x17a7e3[_0x160f77]['body']=juice(_0x17a7e3[_0x160f77]['body']);}}_0x2cbed0[_0x4ec2('0x5c')]=_0x17a7e3;return _0x2cbed0;});}})[_0x4ec2('0x24')](respondWithFilteredResult(_0x57ba1a,_0x1e8b2b))['catch'](handleError(_0x57ba1a,null));};exports['send']=function(_0x2f5725,_0x50e58c){var _0x1ab8f5,_0x89a872={},_0x582f6b;if(_0x2f5725[_0x4ec2('0x64')]['to']){_0x582f6b=_0x2f5725[_0x4ec2('0x64')]['to'][_0x4ec2('0x9e')](',')[0x0];}return db[_0x4ec2('0x47')]['find']({'where':{'id':_0x2f5725[_0x4ec2('0x5f')]['id']},'include':[{'model':db[_0x4ec2('0x9f')],'as':_0x4ec2('0xa0'),'include':[{'model':db[_0x4ec2('0xa1')],'as':_0x4ec2('0xa2'),'where':{'email':_0x582f6b},'limit':0x1,'order':[['updatedAt',_0x4ec2('0xa3')]]}]},{'model':db[_0x4ec2('0x44')],'as':_0x4ec2('0x42'),'raw':!![],'include':[{'model':db[_0x4ec2('0xa4')],'as':_0x4ec2('0xa4'),'raw':!![]}]}]})[_0x4ec2('0x24')](handleEntityNotFound(_0x50e58c,null))['then'](function(_0x9a0a8b){if(!_0x9a0a8b)return;_0x1ab8f5=_0x9a0a8b;if(!_0x9a0a8b[_0x4ec2('0x42')])throw new Error(_0x4ec2('0xa5'));if(_[_0x4ec2('0x78')](_0x2f5725['body']['from'])){_0x2f5725['body'][_0x4ec2('0xa6')]=util[_0x4ec2('0x9a')]('%s\x20<%s>',_0x9a0a8b[_0x4ec2('0x29')],_0x9a0a8b['email']||_0x9a0a8b[_0x4ec2('0x42')][_0x4ec2('0x36')]);}if(_0x2f5725[_0x4ec2('0x64')]['attachments']&&_0x2f5725[_0x4ec2('0x64')]['attachments'][_0x4ec2('0x62')]){for(var _0x48d31c=0x0;_0x48d31c<_0x2f5725['body']['attachments']['length'];_0x48d31c+=0x1){_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xa7')][_0x48d31c]={'filename':_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xa7')][_0x48d31c][_0x4ec2('0x29')],'path':path[_0x4ec2('0xa8')](config[_0x4ec2('0xa9')],_0x4ec2('0xaa'),_0x2f5725['body'][_0x4ec2('0xa7')][_0x48d31c][_0x4ec2('0xab')])};}}var _0x341e0d=_0x9a0a8b[_0x4ec2('0xac')]();return respondWithRpcPromise(_0x4ec2('0xad'),_0x4ec2('0xae'),{'account':_0x341e0d,'message':_0x2f5725['body']});})[_0x4ec2('0x24')](function(_0x4cc49a){if(!_0x4cc49a)return;_0x89a872=_0x4cc49a;if(!_0x1ab8f5[_0x4ec2('0xa0')])throw new Error(_0x4ec2('0xaf'));if(_0x1ab8f5['List'][_0x4ec2('0xa2')][_0x4ec2('0x62')])return _0x1ab8f5[_0x4ec2('0xa0')][_0x4ec2('0xa2')][0x0];return db[_0x4ec2('0xa1')][_0x4ec2('0x6c')](_['defaults'](_0x2f5725[_0x4ec2('0x64')],{'firstName':_0x2f5725[_0x4ec2('0x64')]['to'],'email':_0x2f5725[_0x4ec2('0x64')]['to'],'phone':_0x2f5725[_0x4ec2('0x64')]['to'],'ListId':_0x1ab8f5[_0x4ec2('0x77')]}));})[_0x4ec2('0x24')](function(_0x4dca50){if(!_0x4dca50)return;var _0x4b6638={'UserId':_0x2f5725[_0x4ec2('0x36')]['id'],'ContactId':_0x4dca50['id'],'MailAccountId':_0x1ab8f5['id'],'inReplyTo':_0x89a872[_0x4ec2('0xb0')],'to':_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xa6')],'cc':_0x2f5725['body']['cc'],'subject':_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xb1')],'attach':_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xb2')],'firstMsgDirection':_0x4ec2('0xb3'),'lastMsgAt':moment()[_0x4ec2('0x9a')](_0x4ec2('0x9b')),'lastMsgDirection':_0x4ec2('0xb3'),'Messages':[_[_0x4ec2('0x57')](_0x2f5725['body'],{'messageId':_0x89a872[_0x4ec2('0xb0')],'sentAt':moment()[_0x4ec2('0x9a')](_0x4ec2('0x9b')),'read':!![],'MailAccountId':_0x1ab8f5['id'],'UserId':_0x2f5725[_0x4ec2('0x36')]['id'],'ContactId':_0x4dca50['id']})]};if(_0x2f5725['body'][_0x4ec2('0xb4')]){_0x4b6638=_['merge'](_0x4b6638,_0x2f5725[_0x4ec2('0x64')][_0x4ec2('0xb4')]);}return db[_0x4ec2('0x85')][_0x4ec2('0x6c')](_0x4b6638,{'include':[{'model':db[_0x4ec2('0x98')],'as':_0x4ec2('0xb5')}]});})[_0x4ec2('0x24')](respondWithResult(_0x50e58c,null))['catch'](handleError(_0x50e58c,null));};exports[_0x4ec2('0xb6')]=function(_0x29f31e,_0x2875f1){return db['MailAccount'][_0x4ec2('0x63')]({'where':{'id':_0x29f31e[_0x4ec2('0x5f')]['id']},'include':[{'model':db[_0x4ec2('0x44')],'as':_0x4ec2('0x42'),'raw':!![],'include':[{'model':db[_0x4ec2('0xa4')],'as':_0x4ec2('0xa4'),'raw':!![]}]}]})[_0x4ec2('0x24')](handleEntityNotFound(_0x2875f1,null))[_0x4ec2('0x24')](function(_0x5d2c60){if(!_0x5d2c60[_0x4ec2('0x42')])return;var _0x43b51a=_0x5d2c60[_0x4ec2('0xac')]();return respondWithRpcPromise(_0x4ec2('0xb7'),_0x4ec2('0xb6'),{'account':_0x43b51a});})['then'](respondWithResult(_0x2875f1,null))[_0x4ec2('0x5d')](handleError(_0x2875f1,null));};exports[_0x4ec2('0x25')]=function(_0x1d19ec,_0x2161f4){return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x1d19ec[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x2161f4,null))[_0x4ec2('0x24')](function(_0x1ab886){if(_0x1ab886&&_0x1ab886[_0x4ec2('0x3f')]){throw new db[(_0x4ec2('0xb8'))][(_0x4ec2('0xb9'))](_0x4ec2('0xba'));}return _0x1ab886;})[_0x4ec2('0x24')](removeEntity(_0x2161f4,null))[_0x4ec2('0x5d')](handleError(_0x2161f4,null));};exports[_0x4ec2('0xbb')]=function(_0xe4df6d,_0x30c950){return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0xe4df6d['params']['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x30c950,null))[_0x4ec2('0x24')](function(_0x35b6e0){if(_0x35b6e0){return _0x35b6e0[_0x4ec2('0xbb')](_0xe4df6d[_0x4ec2('0x64')][_0x4ec2('0x71')],_[_0x4ec2('0x86')](_0xe4df6d[_0x4ec2('0x64')],[_0x4ec2('0x71'),'id'])||{})['spread'](function(_0x1b3a0a){for(var _0x3cd299=0x0;_0x3cd299<_0xe4df6d[_0x4ec2('0x64')]['ids']['length'];_0x3cd299+=0x1){socket[_0x4ec2('0xbc')](_0x4ec2('0xbd'),{'UserId':Number(_0xe4df6d[_0x4ec2('0x64')][_0x4ec2('0x71')][_0x3cd299]),'MailAccountId':Number(_0xe4df6d[_0x4ec2('0x5f')]['id'])});}return _0x1b3a0a;});}})[_0x4ec2('0x24')](respondWithResult(_0x30c950,null))[_0x4ec2('0x5d')](handleError(_0x30c950,null));};exports['removeAgents']=function(_0x499149,_0x294f8b){return db[_0x4ec2('0x47')][_0x4ec2('0x63')]({'where':{'id':_0x499149[_0x4ec2('0x5f')]['id']}})[_0x4ec2('0x24')](handleEntityNotFound(_0x294f8b,null))[_0x4ec2('0x24')](function(_0x2d267b){if(_0x2d267b){return _0x2d267b[_0x4ec2('0xbe')](_0x499149[_0x4ec2('0x4c')][_0x4ec2('0x71')])[_0x4ec2('0x24')](function(){if(_[_0x4ec2('0xbf')](_0x499149[_0x4ec2('0x4c')]['ids'])){for(var _0x532225=0x0;_0x532225<_0x499149[_0x4ec2('0x4c')]['ids'][_0x4ec2('0x62')];_0x532225+=0x1){socket[_0x4ec2('0xbc')](_0x4ec2('0xc0'),{'UserId':Number(_0x499149[_0x4ec2('0x4c')]['ids'][_0x532225]),'MailAccountId':Number(_0x499149[_0x4ec2('0x5f')]['id'])});}}else{socket[_0x4ec2('0xbc')](_0x4ec2('0xc0'),{'UserId':Number(_0x499149[_0x4ec2('0x4c')]['ids']),'MailAccountId':Number(_0x499149[_0x4ec2('0x5f')]['id'])});}});}})[_0x4ec2('0x24')](respondWithStatusCode(_0x294f8b,null))[_0x4ec2('0x5d')](handleError(_0x294f8b,null));};exports[_0x4ec2('0xc1')]=function(_0x55da4d,_0x4bb2f2){var _0x2f8677={};var _0x4c39c6={};var _0x27ca76;var _0xc8c59;return db[_0x4ec2('0x47')][_0x4ec2('0x75')]({'where':{'id':_0x55da4d[_0x4ec2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4bb2f2,null))[_0x4ec2('0x24')](function(_0x5c1c55){if(_0x5c1c55){_0x27ca76=_0x5c1c55;_0x4c39c6[_0x4ec2('0x4a')]=_['keys'](db[_0x4ec2('0x88')][_0x4ec2('0x61')]);_0x4c39c6[_0x4ec2('0x4c')]=_[_0x4ec2('0x60')](_0x55da4d[_0x4ec2('0x4c')]);_0x4c39c6[_0x4ec2('0x4d')]=_[_0x4ec2('0x4f')](_0x4c39c6['model'],_0x4c39c6['query']);_0x2f8677[_0x4ec2('0x4e')]=_['intersection'](_0x4c39c6[_0x4ec2('0x4a')],qs[_0x4ec2('0x50')](_0x55da4d[_0x4ec2('0x4c')][_0x4ec2('0x50')]));_0x2f8677['attributes']=_0x2f8677[_0x4ec2('0x4e')][_0x4ec2('0x62')]?_0x2f8677[_0x4ec2('0x4e')]:_0x4c39c6[_0x4ec2('0x4a')];_0x2f8677[_0x4ec2('0x53')]=qs[_0x4ec2('0x54')](_0x55da4d[_0x4ec2('0x4c')]['sort']);_0x2f8677[_0x4ec2('0x55')]=qs[_0x4ec2('0x4d')](_[_0x4ec2('0x6e')](_0x55da4d[_0x4ec2('0x4c')],_0x4c39c6[_0x4ec2('0x4d')]));if(_0x55da4d['query']['filter']){_0x2f8677[_0x4ec2('0x55')]=_[_0x4ec2('0x57')](_0x2f8677[_0x4ec2('0x55')],{'$or':_['map'](_0x2f8677['attributes'],function(_0x39a0a6){var _0x4c16fb={};_0x4c16fb[_0x39a0a6]={'$like':'%'+_0x55da4d[_0x4ec2('0x4c')][_0x4ec2('0x56')]+'%'};return _0x4c16fb;})});}_0x2f8677=_[_0x4ec2('0x57')]({},_0x2f8677,_0x55da4d['options']);return _0x27ca76[_0x4ec2('0xc1')](_0x2f8677);}})[_0x4ec2('0x24')](function(_0x5e4392){if(_0x5e4392){_0xc8c59=_0x5e4392['length'];if(!_0x55da4d[_0x4ec2('0x4c')][_0x4ec2('0x51')](_0x4ec2('0x52'))){_0x2f8677['limit']=qs[_0x4ec2('0x1e')](_0x55da4d[_0x4ec2('0x4c')][_0x4ec2('0x1e')]);_0x2f8677[_0x4ec2('0x20')]=qs['offset'](_0x55da4d['query'][_0x4ec2('0x20')]);}return _0x27ca76['getAgents'](_0x2f8677);}})[_0x4ec2('0x24')](function(_0x29dad6){if(_0x29dad6){return _0x29dad6?{'count':_0xc8c59,'rows':_0x29dad6}:null;}})['then'](respondWithResult(_0x4bb2f2,null))[_0x4ec2('0x5d')](handleError(_0x4bb2f2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3a8e07d..1f32594 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 _0xc4aa=['../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc4aa[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require(_0xac4a('0x0'));var MailAccount=require(_0xac4a('0x1'))['db'][_0xac4a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xac4a('0x3')](0x0);var events={'afterCreate':_0xac4a('0x4'),'afterUpdate':_0xac4a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cda73){return function(_0x47d4f6,_0x2f48ed,_0x15b967){MailAccountEvents[_0xac4a('0x6')](_0x5cda73+':'+_0x47d4f6['id'],_0x47d4f6);MailAccountEvents[_0xac4a('0x6')](_0x5cda73,_0x47d4f6);_0x15b967(null);};}for(var e in events){if(events[_0xac4a('0x7')](e)){var event=events[e];MailAccount[_0xac4a('0x8')](e,emitEvent(event));}}module[_0xac4a('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x958a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4f5af0,_0x5af252){var _0x49647a=function(_0x3d9146){while(--_0x3d9146){_0x4f5af0['push'](_0x4f5af0['shift']());}};_0x49647a(++_0x5af252);}(_0x958a,0x128));var _0xa958=function(_0x2c91fe,_0x3efc1e){_0x2c91fe=_0x2c91fe-0x0;var _0x505d70=_0x958a[_0x2c91fe];return _0x505d70;};'use strict';var EventEmitter=require(_0xa958('0x0'));var MailAccount=require(_0xa958('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa958('0x2')](0x0);var events={'afterCreate':_0xa958('0x3'),'afterUpdate':_0xa958('0x4'),'afterDestroy':_0xa958('0x5')};function emitEvent(_0x30f7c5){return function(_0x5194f8,_0x3424b0,_0x578481){MailAccountEvents[_0xa958('0x6')](_0x30f7c5+':'+_0x5194f8['id'],_0x5194f8);MailAccountEvents[_0xa958('0x6')](_0x30f7c5,_0x5194f8);_0x578481(null);};}for(var e in events){if(events[_0xa958('0x7')](e)){var event=events[e];MailAccount[_0xa958('0x8')](e,emitEvent(event));}}module[_0xa958('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 19f3b56..16bb2f8 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 _0xef6a=['authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','auth','./mailAccount.attributes','exports','mail_accounts','provider','custom','service','host','Smtp','port','secure'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xef6a,0xf5));var _0xaef6=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xef6a[_0x2e4aa2];return _0x5e6092;};'use strict';var attributes=require(_0xaef6('0x0'));module[_0xaef6('0x1')]=function(_0x2453d3){return _0x2453d3['define']('MailAccount',attributes,{'tableName':_0xaef6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1e2f0a=this;var _0x52a935={'id':_0x1e2f0a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1e2f0a[_0xaef6('0x3')]!==_0xaef6('0x4')){_0x52a935[_0xaef6('0x5')]=_0x1e2f0a[_0xaef6('0x3')];}else{_0x52a935[_0xaef6('0x6')]=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x6')];_0x52a935['port']=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x8')];_0x52a935[_0xaef6('0x9')]=_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0x9')];}if(_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xa')]){if(_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xb')]){if(!_0x1e2f0a[_0xaef6('0x7')]['CloudProvider'])throw new Error(_0xaef6('0xc'));_0x52a935['auth']={'type':_0xaef6('0xd'),'user':_0x1e2f0a['Smtp'][_0xaef6('0xe')],'accessToken':_0x1e2f0a[_0xaef6('0x7')][_0xaef6('0xf')]['data5']};}else{_0x52a935[_0xaef6('0x10')]={'user':_0x1e2f0a[_0xaef6('0x7')]['user'],'pass':_0x1e2f0a[_0xaef6('0x7')]['pass']};}}return _0x52a935;}}});}; \ No newline at end of file +var _0xbf22=['custom','service','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user','pass','define','MailAccount','mail_accounts','provider'];(function(_0x8a8795,_0x3ba8e2){var _0x509d6d=function(_0x5708d6){while(--_0x5708d6){_0x8a8795['push'](_0x8a8795['shift']());}};_0x509d6d(++_0x3ba8e2);}(_0xbf22,0x1a5));var _0x2bf2=function(_0x9baa45,_0x5438b6){_0x9baa45=_0x9baa45-0x0;var _0x27f002=_0xbf22[_0x9baa45];return _0x27f002;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x55bc17){return _0x55bc17[_0x2bf2('0x0')](_0x2bf2('0x1'),attributes,{'tableName':_0x2bf2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4ca1ce=this;var _0x94272d={'id':_0x4ca1ce['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4ca1ce[_0x2bf2('0x3')]!==_0x2bf2('0x4')){_0x94272d[_0x2bf2('0x5')]=_0x4ca1ce[_0x2bf2('0x3')];}else{_0x94272d['host']=_0x4ca1ce[_0x2bf2('0x6')]['host'];_0x94272d[_0x2bf2('0x7')]=_0x4ca1ce['Smtp']['port'];_0x94272d[_0x2bf2('0x8')]=_0x4ca1ce[_0x2bf2('0x6')][_0x2bf2('0x8')];}if(_0x4ca1ce['Smtp']['authentication']){if(_0x4ca1ce[_0x2bf2('0x6')][_0x2bf2('0x9')]){if(!_0x4ca1ce['Smtp'][_0x2bf2('0xa')])throw new Error(_0x2bf2('0xb'));_0x94272d[_0x2bf2('0xc')]={'type':_0x2bf2('0xd'),'user':_0x4ca1ce[_0x2bf2('0x6')]['user'],'accessToken':_0x4ca1ce[_0x2bf2('0x6')][_0x2bf2('0xa')][_0x2bf2('0xe')]};}else{_0x94272d[_0x2bf2('0xc')]={'user':_0x4ca1ce[_0x2bf2('0x6')][_0x2bf2('0xf')],'pass':_0x4ca1ce['Smtp'][_0x2bf2('0x10')]};}}return _0x94272d;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fe25f91..bd06aad 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 _0xe714=['User','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','include','map','model','catch','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','mail','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','get','omit','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','Messages','inReplyTo','spread','update','interaction','attachments','originTo','originCc','originChannel','Email','ChatOfflineMessageId','Attachment','UserId'];(function(_0x369191,_0x5277af){var _0x1cec18=function(_0xb9058a){while(--_0xb9058a){_0x369191['push'](_0x369191['shift']());}};_0x1cec18(++_0x5277af);}(_0xe714,0xe2));var _0x4e71=function(_0x21c334,_0x3c797f){_0x21c334=_0x21c334-0x0;var _0x52cc3c=_0xe714[_0x21c334];return _0x52cc3c;};'use strict';var _=require(_0x4e71('0x0'));var moment=require('moment');var BPromise=require(_0x4e71('0x1'));var rs=require(_0x4e71('0x2'));var Redis=require(_0x4e71('0x3'));var db=require(_0x4e71('0x4'))['db'];var logger=require('../../config/logger')(_0x4e71('0x5'));var config=require('../../config/environment');var jayson=require(_0x4e71('0x6'));var client=jayson[_0x4e71('0x7')][_0x4e71('0x8')]({'port':0x232c});config[_0x4e71('0x9')]=_[_0x4e71('0xa')](config[_0x4e71('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e71('0xb'))(new Redis(config[_0x4e71('0x9')]));require(_0x4e71('0xc'))['register'](socket);function respondWithRpcPromise(_0x6faa35,_0x4fd08b,_0x300ff6){return new BPromise(function(_0x372059,_0x73a271){return client[_0x4e71('0xd')](_0x6faa35,_0x300ff6)[_0x4e71('0xe')](function(_0xddba1c){logger[_0x4e71('0xf')](_0x4e71('0x10'),_0x4fd08b,'request\x20sent');logger[_0x4e71('0x11')](_0x4e71('0x12'),_0x4fd08b,'request\x20sent',JSON[_0x4e71('0x13')](_0xddba1c));if(_0xddba1c[_0x4e71('0x14')]){if(_0xddba1c['error'][_0x4e71('0x15')]===0x1f4){logger[_0x4e71('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fd08b,_0xddba1c['error'][_0x4e71('0x16')]);return _0x73a271(_0xddba1c['error']['message']);}logger['error'](_0x4e71('0x10'),_0x4fd08b,_0xddba1c[_0x4e71('0x14')]['message']);return _0x372059(_0xddba1c['error'][_0x4e71('0x16')]);}else{logger[_0x4e71('0xf')](_0x4e71('0x10'),_0x4fd08b,_0x4e71('0x17'));_0x372059(_0xddba1c[_0x4e71('0x18')][_0x4e71('0x16')]);}})['catch'](function(_0x18b745){logger[_0x4e71('0x14')]('MailAccount,\x20%s,\x20%s',_0x4fd08b,_0x18b745);_0x73a271(_0x18b745);});});}exports[_0x4e71('0x19')]=function(_0x20b3ef){var _0x59ac5a=this;return new Promise(function(_0x573bad,_0x5e09b9){return db[_0x4e71('0x1a')][_0x4e71('0x1b')]({'raw':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1d')]===undefined?!![]:![]:!![],'where':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1e')]||null:null,'attributes':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef[_0x4e71('0x1c')][_0x4e71('0x1f')]||null:null,'limit':_0x20b3ef[_0x4e71('0x1c')]?_0x20b3ef['options']['limit']||null:null,'include':_0x20b3ef['options']?_0x20b3ef['options'][_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x20b3ef[_0x4e71('0x1c')]['include'],function(_0x35f181){return{'model':db[_0x35f181[_0x4e71('0x22')]],'as':_0x35f181['as'],'attributes':_0x35f181[_0x4e71('0x1f')],'include':_0x35f181[_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x35f181[_0x4e71('0x20')],function(_0x53b08a){return{'model':db[_0x53b08a['model']],'as':_0x53b08a['as'],'attributes':_0x53b08a[_0x4e71('0x1f')],'include':_0x53b08a[_0x4e71('0x20')]?_[_0x4e71('0x21')](_0x53b08a[_0x4e71('0x20')],function(_0xfe5901){return{'model':db[_0xfe5901[_0x4e71('0x22')]],'as':_0xfe5901['as'],'attributes':_0xfe5901['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51e9ea){logger[_0x4e71('0xf')](_0x4e71('0x19'),_0x20b3ef);logger['debug'](_0x4e71('0x19'),_0x20b3ef,JSON['stringify'](_0x51e9ea));_0x573bad(_0x51e9ea);})[_0x4e71('0x23')](function(_0x4326cd){logger[_0x4e71('0x14')](_0x4e71('0x19'),_0x4326cd[_0x4e71('0x16')],_0x20b3ef);_0x5e09b9(_0x59ac5a['error'](0x1f4,_0x4326cd[_0x4e71('0x16')]));});});};exports['ShowMailAccount']=function(_0x17ab47){var _0x2e0f5d=this;return new Promise(function(_0x17ed65,_0x446b39){return db[_0x4e71('0x1a')]['find']({'raw':_0x17ab47['options']?_0x17ab47['options'][_0x4e71('0x1d')]===undefined?!![]:![]:!![],'where':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47['options'][_0x4e71('0x1e')]||null:null,'attributes':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47['options']['attributes']||null:null,'include':_0x17ab47[_0x4e71('0x1c')]?_0x17ab47[_0x4e71('0x1c')]['include']?_[_0x4e71('0x21')](_0x17ab47[_0x4e71('0x1c')]['include'],function(_0x24a8eb){return{'model':db[_0x24a8eb[_0x4e71('0x22')]],'as':_0x24a8eb['as'],'attributes':_0x24a8eb[_0x4e71('0x1f')],'include':_0x24a8eb['include']?_[_0x4e71('0x21')](_0x24a8eb[_0x4e71('0x20')],function(_0x9cb8e6){return{'model':db[_0x9cb8e6[_0x4e71('0x22')]],'as':_0x9cb8e6['as'],'attributes':_0x9cb8e6[_0x4e71('0x1f')],'include':_0x9cb8e6['include']?_[_0x4e71('0x21')](_0x9cb8e6[_0x4e71('0x20')],function(_0xf946c3){return{'model':db[_0xf946c3[_0x4e71('0x22')]],'as':_0xf946c3['as'],'attributes':_0xf946c3[_0x4e71('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50b1b0){if(_0x17ab47[_0x4e71('0x1c')][_0x4e71('0x24')]===!![])_0x50b1b0[_0x4e71('0x25')](_0x4e71('0x26'),_0x50b1b0[_0x4e71('0x27')]());logger['info'](_0x4e71('0x28'),_0x17ab47);logger['debug'](_0x4e71('0x28'),_0x17ab47,JSON['stringify'](_0x50b1b0));_0x17ed65(_0x50b1b0);})[_0x4e71('0x23')](function(_0x25be66){logger['error'](_0x4e71('0x28'),_0x25be66[_0x4e71('0x16')],_0x17ab47);_0x446b39(_0x2e0f5d[_0x4e71('0x14')](0x1f4,_0x25be66[_0x4e71('0x16')]));});});};exports[_0x4e71('0x29')]=function(_0x34bf2a){var _0x43a395=this;return new Promise(function(_0x2bae8a,_0x1d00e5){var _0x5c7c3e={'body':_0x34bf2a['body'],'channel':_0x4e71('0x2a')};var _0x3af98f=_[_0x4e71('0x2b')](_[_0x4e71('0x2c')](db['CmContact']['rawAttributes']),[_0x4e71('0x2d'),_0x4e71('0x2e'),_0x4e71('0x2f'),_0x4e71('0x30')]);var _0x46963b=![];if(_0x34bf2a[_0x4e71('0x31')]['id']){delete _0x34bf2a[_0x4e71('0x31')]['id'];}if(_[_0x4e71('0x32')](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x33')])){return _0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x4e71('0x34')));}if(_['isNil'](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x31')])||_0x34bf2a[_0x4e71('0x31')]['body']===''){return _0x1d00e5(_0x43a395['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')])){return _0x1d00e5(_0x43a395['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3af98f));}if(!_['includes'](_0x3af98f,_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')])){return _0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x4e71('0x36')+_0x3af98f));}var _0x3daa67={};_0x3daa67[_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')]]=_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x33')];return db[_0x4e71('0x1a')]['find']({'where':{'id':_0x34bf2a[_0x4e71('0x37')]['id']},'include':[{'model':db[_0x4e71('0x38')],'as':'List','include':[{'model':db[_0x4e71('0x39')],'as':_0x4e71('0x3a'),'where':_0x3daa67,'limit':0x1,'order':[['updatedAt',_0x4e71('0x3b')]]}]},{'model':db[_0x4e71('0x3c')],'as':_0x4e71('0x3d')},{'model':db[_0x4e71('0x3e')],'as':'Smtp','include':[{'model':db[_0x4e71('0x3f')],'as':'CloudProvider'}]}]})['then'](function(_0x2af74c){if(_0x2af74c&&_0x2af74c[_0x4e71('0x40')]){var _0x3d57a4=_0x2af74c[_0x4e71('0x41')]({'plain':!![]});_0x5c7c3e[_0x4e71('0x37')]=_[_0x4e71('0x42')](_0x3d57a4,['Applications',_0x4e71('0x40')]);_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x26')]=_0x2af74c[_0x4e71('0x27')]();_0x5c7c3e[_0x4e71('0x43')]=_0x3d57a4['Applications'];_0x5c7c3e['list']=_0x3d57a4[_0x4e71('0x40')];_0x5c7c3e[_0x4e71('0x43')]=_[_0x4e71('0x44')](_0x5c7c3e[_0x4e71('0x43')],[_0x4e71('0x45')],[_0x4e71('0x46')]);if(_0x5c7c3e[_0x4e71('0x37')]&&_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x47')]){_0x5c7c3e[_0x4e71('0x43')]['push']({'id':0x0,'priority':_0x5c7c3e[_0x4e71('0x43')][_0x4e71('0x48')]+0x1,'app':_0x4e71('0x49'),'appdata':_0x4e71('0x47'),'interval':_0x4e71('0x4a')});}if(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x3d')]){delete _0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x3d')];}if(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x40')]){delete _0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x40')];}if(_0x3d57a4['List'][_0x4e71('0x3a')][_0x4e71('0x48')]){return _0x3d57a4[_0x4e71('0x40')][_0x4e71('0x3a')][0x0];}var _0x4739a5=_[_0x4e71('0xa')](_0x34bf2a[_0x4e71('0x31')],{'firstName':_0x34bf2a['body'][_0x4e71('0x33')],'ListId':_0x3d57a4['ListId']});_0x4739a5[_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x35')]]=_0x34bf2a[_0x4e71('0x31')]['from'];return db['CmContact'][_0x4e71('0x4b')](_0x4739a5);}else{throw new Error(_0x4e71('0x4c'));}})[_0x4e71('0xe')](function(_0x2de556){_0x5c7c3e['contact']=_0x2de556;if(_0x2de556){if(!_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x4d')]){_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId']=rs[_0x4e71('0x4e')]()+'\x20'+_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x33')];}var _0x3587ba={'ContactId':_0x2de556['id'],'MailAccountId':_0x34bf2a[_0x4e71('0x37')]['id'],'inReplyTo':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x4d')],'to':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x33')],'cc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['cc'],'subject':_0x34bf2a['body'][_0x4e71('0x16')][_0x4e71('0x4f')],'attach':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x50')],'lastMsgAt':moment()[_0x4e71('0x51')](_0x4e71('0x52')),'lastMsgDirection':'in'};return db[_0x4e71('0x53')][_0x4e71('0x54')]({'where':{'closed':![],'MailAccountId':_0x34bf2a[_0x4e71('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x4e71('0x55'),'attributes':['messageId'],'where':{'messageId':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x56')]}}]})['then'](function(_0x2e0cf4){if(_0x2e0cf4){return[_0x2e0cf4,![]];}return db[_0x4e71('0x53')][_0x4e71('0x4b')](_0x3587ba)[_0x4e71('0xe')](function(_0x15c1f8){return[_0x15c1f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4e71('0x57')](function(_0x1d6685,_0x274c38){if(_0x1d6685){_0x46963b=_0x274c38;if(!_0x274c38){return _0x1d6685[_0x4e71('0x58')]({'inReplyTo':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId'],'to':_0x34bf2a['body']['message'][_0x4e71('0x33')],'cc':_0x34bf2a[_0x4e71('0x31')]['message']['cc'],'subject':_0x34bf2a['body']['message'][_0x4e71('0x4f')],'attach':_0x1d6685[_0x4e71('0x50')]?_0x1d6685['attach']:_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x50')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x4e71('0x51')](_0x4e71('0x52')),'lastMsgDirection':'in'});}else{return _0x1d6685;}}})[_0x4e71('0xe')](function(_0x5b53ef){_0x5c7c3e['interaction']=_0x5b53ef[_0x4e71('0x41')]({'plain':!![]});_0x5c7c3e[_0x4e71('0x59')]['created']=_0x46963b;return db['MailMessage'][_0x4e71('0x4b')]({'body':_0x34bf2a[_0x4e71('0x31')]['body'],'MailAccountId':_0x34bf2a['account']['id'],'MailInteractionId':_0x5b53ef['id'],'direction':'in','ContactId':_0x5c7c3e['contact']['id'],'messageId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['messageId'],'from':_0x34bf2a[_0x4e71('0x31')]['message'][_0x4e71('0x33')],'to':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['to'],'cc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['cc'],'subject':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['subject'],'attach':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['attach'],'Attachments':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5a')],'originTo':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5b')],'originCc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5c')],'bcc':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['bcc'],'ChatWebsiteId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')]['ChatWebsiteId']||null,'originChannel':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5d')]||_0x4e71('0x5e'),'ChatOfflineMessageId':_0x34bf2a[_0x4e71('0x31')][_0x4e71('0x16')][_0x4e71('0x5f')]||null},{'include':[{'model':db[_0x4e71('0x60')],'as':'Attachments'}]});})[_0x4e71('0xe')](function(_0x52469b){_0x5c7c3e[_0x4e71('0x16')]=_0x52469b;if(!_0x5c7c3e['interaction'][_0x4e71('0x61')]){return;}return db[_0x4e71('0x62')][_0x4e71('0x54')]({'attributes':['id','name'],'where':{'id':_0x5c7c3e['interaction'][_0x4e71('0x61')]}});})[_0x4e71('0xe')](function(_0x17b8b9){if(_0x17b8b9){_0x5c7c3e[_0x4e71('0x43')][_0x4e71('0x63')]({'id':0x0,'priority':0x0,'app':_0x4e71('0x64'),'appdata':_0x17b8b9['name']+','+(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x65')]||0xa),'interval':'*,*,*,*'});}if(!_0x5c7c3e['interaction']['queueId']){return;}return db[_0x4e71('0x66')][_0x4e71('0x54')]({'attributes':['id','name'],'where':{'id':_0x5c7c3e[_0x4e71('0x59')][_0x4e71('0x67')]}});})[_0x4e71('0xe')](function(_0x1dc958){if(_0x1dc958){_0x5c7c3e[_0x4e71('0x43')]['unshift']({'id':0x0,'priority':0x1,'app':_0x4e71('0x68'),'appdata':_0x1dc958['name']+','+(_0x5c7c3e[_0x4e71('0x37')][_0x4e71('0x69')]||0x12c),'interval':_0x4e71('0x4a')});}return respondWithRpcPromise(_0x4e71('0x6a'),_0x4e71('0x6b'),_0x5c7c3e);})['then'](function(_0x4ea63f){_0x2bae8a(_0x4ea63f);})[_0x4e71('0x23')](function(_0x18c96c){_0x1d00e5(_0x43a395[_0x4e71('0x14')](0x1f4,_0x18c96c[_0x4e71('0x16')]));});});}; \ No newline at end of file +var _0x5d58=['body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','find','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','then','account','omit','smtpOptions','applications','List','orderBy','priority','asc','autoclose','push','length','close','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','attach','YYYY-MM-DD\x20HH:mm:ss','get','interaction','created','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','map','include','model','attributes','ShowMailAccount','smtp','setDataValue','getSmtpOptions','stringify','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','CompanyId'];(function(_0x527377,_0x4898c6){var _0x42dbda=function(_0x1819ae){while(--_0x1819ae){_0x527377['push'](_0x527377['shift']());}};_0x42dbda(++_0x4898c6);}(_0x5d58,0x187));var _0x85d5=function(_0x3d3c16,_0x4aca78){_0x3d3c16=_0x3d3c16-0x0;var _0x34b3a5=_0x5d58[_0x3d3c16];return _0x34b3a5;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require(_0x85d5('0x0'))['db'];var logger=require(_0x85d5('0x1'))('rpc');var config=require(_0x85d5('0x2'));var jayson=require(_0x85d5('0x3'));var client=jayson['client'][_0x85d5('0x4')]({'port':0x232c});config[_0x85d5('0x5')]=_[_0x85d5('0x6')](config[_0x85d5('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x85d5('0x7'))(new Redis(config[_0x85d5('0x5')]));require('./mailAccount.socket')[_0x85d5('0x8')](socket);function respondWithRpcPromise(_0x4eb3ae,_0x1098be,_0x2ce6b9){return new BPromise(function(_0x258f0c,_0x488dcb){return client['request'](_0x4eb3ae,_0x2ce6b9)['then'](function(_0x1a2b82){logger[_0x85d5('0x9')](_0x85d5('0xa'),_0x1098be,_0x85d5('0xb'));logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x1098be,_0x85d5('0xb'),JSON['stringify'](_0x1a2b82));if(_0x1a2b82['error']){if(_0x1a2b82['error'][_0x85d5('0xe')]===0x1f4){logger[_0x85d5('0xf')](_0x85d5('0xa'),_0x1098be,_0x1a2b82[_0x85d5('0xf')][_0x85d5('0x10')]);return _0x488dcb(_0x1a2b82[_0x85d5('0xf')][_0x85d5('0x10')]);}logger['error'](_0x85d5('0xa'),_0x1098be,_0x1a2b82[_0x85d5('0xf')][_0x85d5('0x10')]);return _0x258f0c(_0x1a2b82[_0x85d5('0xf')][_0x85d5('0x10')]);}else{logger[_0x85d5('0x9')](_0x85d5('0xa'),_0x1098be,_0x85d5('0xb'));_0x258f0c(_0x1a2b82[_0x85d5('0x11')][_0x85d5('0x10')]);}})[_0x85d5('0x12')](function(_0x432bd6){logger[_0x85d5('0xf')](_0x85d5('0xa'),_0x1098be,_0x432bd6);_0x488dcb(_0x432bd6);});});}exports[_0x85d5('0x13')]=function(_0x26981b){var _0x54e991=this;return new Promise(function(_0x1d6134,_0x53bd11){return db[_0x85d5('0x14')][_0x85d5('0x15')]({'raw':_0x26981b['options']?_0x26981b[_0x85d5('0x16')][_0x85d5('0x17')]===undefined?!![]:![]:!![],'where':_0x26981b['options']?_0x26981b['options'][_0x85d5('0x18')]||null:null,'attributes':_0x26981b['options']?_0x26981b[_0x85d5('0x16')]['attributes']||null:null,'limit':_0x26981b[_0x85d5('0x16')]?_0x26981b[_0x85d5('0x16')]['limit']||null:null,'include':_0x26981b['options']?_0x26981b['options']['include']?_[_0x85d5('0x19')](_0x26981b[_0x85d5('0x16')][_0x85d5('0x1a')],function(_0x466bbd){return{'model':db[_0x466bbd[_0x85d5('0x1b')]],'as':_0x466bbd['as'],'attributes':_0x466bbd[_0x85d5('0x1c')],'include':_0x466bbd['include']?_[_0x85d5('0x19')](_0x466bbd['include'],function(_0x1b3fae){return{'model':db[_0x1b3fae[_0x85d5('0x1b')]],'as':_0x1b3fae['as'],'attributes':_0x1b3fae[_0x85d5('0x1c')],'include':_0x1b3fae['include']?_[_0x85d5('0x19')](_0x1b3fae[_0x85d5('0x1a')],function(_0x815808){return{'model':db[_0x815808[_0x85d5('0x1b')]],'as':_0x815808['as'],'attributes':_0x815808[_0x85d5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cbef1){logger[_0x85d5('0x9')](_0x85d5('0x13'),_0x26981b);logger[_0x85d5('0xc')](_0x85d5('0x13'),_0x26981b,JSON['stringify'](_0x1cbef1));_0x1d6134(_0x1cbef1);})['catch'](function(_0x2ce7a9){logger[_0x85d5('0xf')](_0x85d5('0x13'),_0x2ce7a9[_0x85d5('0x10')],_0x26981b);_0x53bd11(_0x54e991[_0x85d5('0xf')](0x1f4,_0x2ce7a9['message']));});});};exports[_0x85d5('0x1d')]=function(_0x214908){var _0x5561dd=this;return new Promise(function(_0x4ea24e,_0x26b8eb){return db[_0x85d5('0x14')]['find']({'raw':_0x214908[_0x85d5('0x16')]?_0x214908['options'][_0x85d5('0x17')]===undefined?!![]:![]:!![],'where':_0x214908[_0x85d5('0x16')]?_0x214908['options'][_0x85d5('0x18')]||null:null,'attributes':_0x214908[_0x85d5('0x16')]?_0x214908[_0x85d5('0x16')][_0x85d5('0x1c')]||null:null,'include':_0x214908['options']?_0x214908['options'][_0x85d5('0x1a')]?_[_0x85d5('0x19')](_0x214908[_0x85d5('0x16')][_0x85d5('0x1a')],function(_0x228bf2){return{'model':db[_0x228bf2[_0x85d5('0x1b')]],'as':_0x228bf2['as'],'attributes':_0x228bf2[_0x85d5('0x1c')],'include':_0x228bf2[_0x85d5('0x1a')]?_[_0x85d5('0x19')](_0x228bf2['include'],function(_0x5a15fd){return{'model':db[_0x5a15fd[_0x85d5('0x1b')]],'as':_0x5a15fd['as'],'attributes':_0x5a15fd[_0x85d5('0x1c')],'include':_0x5a15fd[_0x85d5('0x1a')]?_[_0x85d5('0x19')](_0x5a15fd[_0x85d5('0x1a')],function(_0x2a0ff0){return{'model':db[_0x2a0ff0[_0x85d5('0x1b')]],'as':_0x2a0ff0['as'],'attributes':_0x2a0ff0[_0x85d5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x358555){if(_0x214908[_0x85d5('0x16')][_0x85d5('0x1e')]===!![])_0x358555[_0x85d5('0x1f')]('smtpOptions',_0x358555[_0x85d5('0x20')]());logger[_0x85d5('0x9')](_0x85d5('0x1d'),_0x214908);logger[_0x85d5('0xc')]('ShowMailAccount',_0x214908,JSON[_0x85d5('0x21')](_0x358555));_0x4ea24e(_0x358555);})['catch'](function(_0x484a4d){logger[_0x85d5('0xf')]('ShowMailAccount',_0x484a4d[_0x85d5('0x10')],_0x214908);_0x26b8eb(_0x5561dd['error'](0x1f4,_0x484a4d['message']));});});};exports[_0x85d5('0x22')]=function(_0x28e93b){var _0x40360f=this;return new Promise(function(_0x1beffc,_0x234c44){var _0x556800={'body':_0x28e93b['body'],'channel':_0x85d5('0x23')};var _0x173717=_[_0x85d5('0x24')](_[_0x85d5('0x25')](db[_0x85d5('0x26')][_0x85d5('0x27')]),['createdAt','updatedAt',_0x85d5('0x28'),'ListId']);var _0xfbf466=![];if(_0x28e93b[_0x85d5('0x29')]['id']){delete _0x28e93b[_0x85d5('0x29')]['id'];}if(_[_0x85d5('0x2a')](_0x28e93b[_0x85d5('0x29')]['from'])){return _0x234c44(_0x40360f['error'](0x1f4,_0x85d5('0x2b')));}if(_[_0x85d5('0x2a')](_0x28e93b[_0x85d5('0x29')][_0x85d5('0x29')])||_0x28e93b[_0x85d5('0x29')][_0x85d5('0x29')]===''){return _0x234c44(_0x40360f[_0x85d5('0xf')](0x1f4,_0x85d5('0x2c')));}if(_[_0x85d5('0x2a')](_0x28e93b[_0x85d5('0x29')][_0x85d5('0x2d')])){return _0x234c44(_0x40360f[_0x85d5('0xf')](0x1f4,_0x85d5('0x2e')+_0x173717));}if(!_[_0x85d5('0x2f')](_0x173717,_0x28e93b[_0x85d5('0x29')][_0x85d5('0x2d')])){return _0x234c44(_0x40360f[_0x85d5('0xf')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x173717));}var _0x54c786={};_0x54c786[_0x28e93b[_0x85d5('0x29')][_0x85d5('0x2d')]]=_0x28e93b[_0x85d5('0x29')][_0x85d5('0x30')];return db[_0x85d5('0x14')][_0x85d5('0x31')]({'where':{'id':_0x28e93b['account']['id']},'include':[{'model':db[_0x85d5('0x32')],'as':'List','include':[{'model':db['CmContact'],'as':_0x85d5('0x33'),'where':_0x54c786,'limit':0x1,'order':[[_0x85d5('0x34'),_0x85d5('0x35')]]}]},{'model':db[_0x85d5('0x36')],'as':_0x85d5('0x37')},{'model':db['MailServerOut'],'as':_0x85d5('0x38'),'include':[{'model':db['CloudProvider'],'as':_0x85d5('0x39')}]}]})[_0x85d5('0x3a')](function(_0x219154){if(_0x219154&&_0x219154['List']){var _0x58a44d=_0x219154['get']({'plain':!![]});_0x556800[_0x85d5('0x3b')]=_[_0x85d5('0x3c')](_0x58a44d,[_0x85d5('0x37'),'List']);_0x556800['account'][_0x85d5('0x3d')]=_0x219154[_0x85d5('0x20')]();_0x556800[_0x85d5('0x3e')]=_0x58a44d[_0x85d5('0x37')];_0x556800['list']=_0x58a44d[_0x85d5('0x3f')];_0x556800[_0x85d5('0x3e')]=_[_0x85d5('0x40')](_0x556800[_0x85d5('0x3e')],[_0x85d5('0x41')],[_0x85d5('0x42')]);if(_0x556800[_0x85d5('0x3b')]&&_0x556800[_0x85d5('0x3b')][_0x85d5('0x43')]){_0x556800[_0x85d5('0x3e')][_0x85d5('0x44')]({'id':0x0,'priority':_0x556800[_0x85d5('0x3e')][_0x85d5('0x45')]+0x1,'app':_0x85d5('0x46'),'appdata':_0x85d5('0x43'),'interval':'*,*,*,*'});}if(_0x556800[_0x85d5('0x3b')][_0x85d5('0x37')]){delete _0x556800[_0x85d5('0x3b')][_0x85d5('0x37')];}if(_0x556800['account'][_0x85d5('0x3f')]){delete _0x556800['account'][_0x85d5('0x3f')];}if(_0x58a44d[_0x85d5('0x3f')][_0x85d5('0x33')][_0x85d5('0x45')]){return _0x58a44d['List'][_0x85d5('0x33')][0x0];}var _0x5b1a82=_['defaults'](_0x28e93b['body'],{'firstName':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x30')],'ListId':_0x58a44d[_0x85d5('0x47')]});_0x5b1a82[_0x28e93b[_0x85d5('0x29')][_0x85d5('0x2d')]]=_0x28e93b['body']['from'];return db[_0x85d5('0x26')][_0x85d5('0x48')](_0x5b1a82);}else{throw new Error(_0x85d5('0x49'));}})[_0x85d5('0x3a')](function(_0x5809d4){_0x556800[_0x85d5('0x4a')]=_0x5809d4;if(_0x5809d4){if(!_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['messageId']){_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x4b')]=rs[_0x85d5('0x4c')]()+'\x20'+_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x30')];}var _0xa5153d={'ContactId':_0x5809d4['id'],'MailAccountId':_0x28e93b[_0x85d5('0x3b')]['id'],'inReplyTo':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x4b')],'to':_0x28e93b[_0x85d5('0x29')]['message'][_0x85d5('0x30')],'cc':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['cc'],'subject':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x4d')],'attach':_0x28e93b['body'][_0x85d5('0x10')]['attach'],'lastMsgAt':moment()[_0x85d5('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x85d5('0x4f')][_0x85d5('0x31')]({'where':{'closed':![],'MailAccountId':_0x28e93b[_0x85d5('0x3b')]['id']},'include':[{'model':db[_0x85d5('0x50')],'as':'Messages','attributes':[_0x85d5('0x4b')],'where':{'messageId':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x51')]}}]})[_0x85d5('0x3a')](function(_0x226795){if(_0x226795){return[_0x226795,![]];}return db[_0x85d5('0x4f')][_0x85d5('0x48')](_0xa5153d)['then'](function(_0x5d67d1){return[_0x5d67d1,!![]];});});}else{throw new Error(_0x85d5('0x52'));}})['spread'](function(_0x29e17f,_0x12c235){if(_0x29e17f){_0xfbf466=_0x12c235;if(!_0x12c235){return _0x29e17f['update']({'inReplyTo':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x4b')],'to':_0x28e93b[_0x85d5('0x29')]['message'][_0x85d5('0x30')],'cc':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['cc'],'subject':_0x28e93b[_0x85d5('0x29')]['message']['subject'],'attach':_0x29e17f[_0x85d5('0x53')]?_0x29e17f['attach']:_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x53')],'substatus':null,'substatusAt':moment()[_0x85d5('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x85d5('0x54')),'lastMsgDirection':'in'});}else{return _0x29e17f;}}})[_0x85d5('0x3a')](function(_0x291298){_0x556800['interaction']=_0x291298[_0x85d5('0x55')]({'plain':!![]});_0x556800[_0x85d5('0x56')][_0x85d5('0x57')]=_0xfbf466;return db[_0x85d5('0x50')][_0x85d5('0x48')]({'body':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x29')],'MailAccountId':_0x28e93b[_0x85d5('0x3b')]['id'],'MailInteractionId':_0x291298['id'],'direction':'in','ContactId':_0x556800['contact']['id'],'messageId':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x4b')],'from':_0x28e93b[_0x85d5('0x29')]['message'][_0x85d5('0x30')],'to':_0x28e93b[_0x85d5('0x29')]['message']['to'],'cc':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['cc'],'subject':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x4d')],'attach':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x53')],'Attachments':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x58')],'originTo':_0x28e93b['body'][_0x85d5('0x10')][_0x85d5('0x59')],'originCc':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x5a')],'bcc':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x5b')],'ChatWebsiteId':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['ChatWebsiteId']||null,'originChannel':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')][_0x85d5('0x5c')]||_0x85d5('0x5d'),'ChatOfflineMessageId':_0x28e93b[_0x85d5('0x29')][_0x85d5('0x10')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x85d5('0x5e')],'as':'Attachments'}]});})['then'](function(_0x296d6e){_0x556800[_0x85d5('0x10')]=_0x296d6e;if(!_0x556800[_0x85d5('0x56')][_0x85d5('0x5f')]){return;}return db[_0x85d5('0x60')][_0x85d5('0x31')]({'attributes':['id',_0x85d5('0x61')],'where':{'id':_0x556800[_0x85d5('0x56')][_0x85d5('0x5f')]}});})['then'](function(_0x26399f){if(_0x26399f){_0x556800[_0x85d5('0x3e')][_0x85d5('0x62')]({'id':0x0,'priority':0x0,'app':_0x85d5('0x63'),'appdata':_0x26399f[_0x85d5('0x61')]+','+(_0x556800[_0x85d5('0x3b')][_0x85d5('0x64')]||0xa),'interval':_0x85d5('0x65')});}if(!_0x556800[_0x85d5('0x56')][_0x85d5('0x66')]){return;}return db[_0x85d5('0x67')][_0x85d5('0x31')]({'attributes':['id',_0x85d5('0x61')],'where':{'id':_0x556800[_0x85d5('0x56')][_0x85d5('0x66')]}});})['then'](function(_0x52243a){if(_0x52243a){_0x556800[_0x85d5('0x3e')]['unshift']({'id':0x0,'priority':0x1,'app':_0x85d5('0x68'),'appdata':_0x52243a[_0x85d5('0x61')]+','+(_0x556800[_0x85d5('0x3b')][_0x85d5('0x69')]||0x12c),'interval':_0x85d5('0x65')});}return respondWithRpcPromise(_0x85d5('0x6a'),_0x85d5('0x6b'),_0x556800);})[_0x85d5('0x3a')](function(_0x2715da){_0x1beffc(_0x2715da);})['catch'](function(_0x2ebc45){_0x234c44(_0x40360f[_0x85d5('0xf')](0x1f4,_0x2ebc45['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 231b363..7a1464a 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 _0x6629=['save','update','emit','length','mailAccount:','./mailAccount.events'];(function(_0x20319a,_0x593659){var _0x27ef9c=function(_0x58abc0){while(--_0x58abc0){_0x20319a['push'](_0x20319a['shift']());}};_0x27ef9c(++_0x593659);}(_0x6629,0x1a9));var _0x9662=function(_0x3cf190,_0x516d3e){_0x3cf190=_0x3cf190-0x0;var _0x45cf59=_0x6629[_0x3cf190];return _0x45cf59;};'use strict';var MailAccountEvents=require(_0x9662('0x0'));var events=[_0x9662('0x1'),'remove',_0x9662('0x2')];function createListener(_0x520671,_0x43b945){return function(_0xe63d4f){_0x43b945[_0x9662('0x3')](_0x520671,_0xe63d4f);};}function removeListener(_0x4e765a,_0x54a4cf){return function(){MailAccountEvents['removeListener'](_0x4e765a,_0x54a4cf);};}exports['register']=function(_0xed6e5c){for(var _0xbc3676=0x0,_0x88b34b=events[_0x9662('0x4')];_0xbc3676<_0x88b34b;_0xbc3676++){var _0x3a6f57=events[_0xbc3676];var _0xbd5747=createListener(_0x9662('0x5')+_0x3a6f57,_0xed6e5c);MailAccountEvents['on'](_0x3a6f57,_0xbd5747);}}; \ No newline at end of file +var _0xefa1=['removeListener','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x34dcb,_0x18fc01){var _0x29cdb2=function(_0x44d56d){while(--_0x44d56d){_0x34dcb['push'](_0x34dcb['shift']());}};_0x29cdb2(++_0x18fc01);}(_0xefa1,0xce));var _0x1efa=function(_0x32b24a,_0x48f42a){_0x32b24a=_0x32b24a-0x0;var _0x192f0c=_0xefa1[_0x32b24a];return _0x192f0c;};'use strict';var MailAccountEvents=require(_0x1efa('0x0'));var events=[_0x1efa('0x1'),_0x1efa('0x2'),_0x1efa('0x3')];function createListener(_0x171aa5,_0xbcac57){return function(_0x56126c){_0xbcac57['emit'](_0x171aa5,_0x56126c);};}function removeListener(_0x4cf6ec,_0x2cbb82){return function(){MailAccountEvents[_0x1efa('0x4')](_0x4cf6ec,_0x2cbb82);};}exports['register']=function(_0xd6d673){for(var _0x1d2a1a=0x0,_0x57b62f=events[_0x1efa('0x5')];_0x1d2a1a<_0x57b62f;_0x1d2a1a++){var _0x129aa0=events[_0x1d2a1a];var _0x13acdc=createListener(_0x1efa('0x6')+_0x129aa0,_0xd6d673);MailAccountEvents['on'](_0x129aa0,_0x13acdc);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 4a8f1f5..18309c0 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 _0x684b=['fs-extra','../../config/environment','get','/:id','show','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3cc739,_0xcc6544){var _0x1d6020=function(_0x4a0cb0){while(--_0x4a0cb0){_0x3cc739['push'](_0x3cc739['shift']());}};_0x1d6020(++_0xcc6544);}(_0x684b,0x106));var _0xb684=function(_0x23ca51,_0x4dabc6){_0x23ca51=_0x23ca51-0x0;var _0x2138e8=_0x684b[_0x23ca51];return _0x2138e8;};'use strict';var multer=require(_0xb684('0x0'));var util=require(_0xb684('0x1'));var path=require(_0xb684('0x2'));var timeout=require(_0xb684('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb684('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb684('0x5'));var controller=require('./mailApplication.controller');router[_0xb684('0x6')](_0xb684('0x7'),auth['isAuthenticated'](),controller[_0xb684('0x8')]);router[_0xb684('0x9')]('/:id',auth[_0xb684('0xa')](),controller[_0xb684('0xb')]);router['delete']('/:id',auth[_0xb684('0xa')](),controller[_0xb684('0xc')]);module[_0xb684('0xd')]=router; \ No newline at end of file +var _0x00af=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','update','destroy'];(function(_0x24d344,_0x4a2291){var _0x341736=function(_0x40fb8b){while(--_0x40fb8b){_0x24d344['push'](_0x24d344['shift']());}};_0x341736(++_0x4a2291);}(_0x00af,0x131));var _0xf00a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00af[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xf00a('0x0'));var util=require(_0xf00a('0x1'));var path=require(_0xf00a('0x2'));var timeout=require(_0xf00a('0x3'));var express=require(_0xf00a('0x4'));var router=express['Router']();var fs_extra=require(_0xf00a('0x5'));var auth=require(_0xf00a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf00a('0x7'));router[_0xf00a('0x8')](_0xf00a('0x9'),auth['isAuthenticated'](),controller[_0xf00a('0xa')]);router[_0xf00a('0xb')](_0xf00a('0x9'),auth[_0xf00a('0xc')](),controller[_0xf00a('0xd')]);router['delete']('/:id',auth[_0xf00a('0xc')](),controller[_0xf00a('0xe')]);module[_0xf00a('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index c375296..23ad6dd 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 _0x3039=['noop','TEXT','INTEGER','STRING'];(function(_0x2a97f7,_0x465e0c){var _0x13c258=function(_0x1b043d){while(--_0x1b043d){_0x2a97f7['push'](_0x2a97f7['shift']());}};_0x13c258(++_0x465e0c);}(_0x3039,0x8a));var _0x9303=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3039[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9303('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x9303('0x1')],'allowNull':![],'defaultValue':_0x9303('0x2')},'appdata':{'type':Sequelize[_0x9303('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9303('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xad47=['noop','TEXT','STRING'];(function(_0x51fe86,_0x422b66){var _0x3557d4=function(_0x524a6a){while(--_0x524a6a){_0x51fe86['push'](_0x51fe86['shift']());}};_0x3557d4(++_0x422b66);}(_0xad47,0x19a));var _0x7ad4=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xad47[_0x286bfb];return _0x52b683;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7ad4('0x0')],'allowNull':![],'defaultValue':_0x7ad4('0x1')},'appdata':{'type':Sequelize[_0x7ad4('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2ae8521..828bcc2 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x2815,_0x5f3c49){var _0x42d012=function(_0x2288ad){while(--_0x2288ad){_0x2815['push'](_0x2815['shift']());}};_0x42d012(++_0x5f3c49);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','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','reject','update','then','destroy','error','stack','name'];(function(_0x116322,_0x549794){var _0x336a8c=function(_0x57008d){while(--_0x57008d){_0x116322['push'](_0x116322['shift']());}};_0x336a8c(++_0x549794);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xcb91[_0x500c0];return _0xdd146f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 6b22d5b..b6b6522 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 _0x2912=['./mailApplication.attributes','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2912,0xc8));var _0x2291=function(_0x1e6330,_0xa3f4c2){_0x1e6330=_0x1e6330-0x0;var _0x13f84f=_0x2912[_0x1e6330];return _0x13f84f;};'use strict';var _=require(_0x2291('0x0'));var util=require('util');var logger=require(_0x2291('0x1'))(_0x2291('0x2'));var moment=require(_0x2291('0x3'));var BPromise=require(_0x2291('0x4'));var rp=require(_0x2291('0x5'));var fs=require('fs');var path=require(_0x2291('0x6'));var rimraf=require('rimraf');var config=require(_0x2291('0x7'));var attributes=require(_0x2291('0x8'));module['exports']=function(_0x2e6711,_0x3b7bd7){return _0x2e6711[_0x2291('0x9')](_0x2291('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2291('0xb'),'collate':_0x2291('0xc')});}; \ No newline at end of file +var _0x85bb=['mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','MailApplication'];(function(_0x315d6f,_0x8cb82c){var _0xe0f2ae=function(_0x243990){while(--_0x243990){_0x315d6f['push'](_0x315d6f['shift']());}};_0xe0f2ae(++_0x8cb82c);}(_0x85bb,0xc2));var _0xb85b=function(_0x335c16,_0x303c5f){_0x335c16=_0x335c16-0x0;var _0x1c25cb=_0x85bb[_0x335c16];return _0x1c25cb;};'use strict';var _=require(_0xb85b('0x0'));var util=require(_0xb85b('0x1'));var logger=require(_0xb85b('0x2'))(_0xb85b('0x3'));var moment=require(_0xb85b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb85b('0x5'));var rimraf=require('rimraf');var config=require(_0xb85b('0x6'));var attributes=require('./mailApplication.attributes');module[_0xb85b('0x7')]=function(_0x4ddcda,_0x3ff8c2){return _0x4ddcda[_0xb85b('0x8')](_0xb85b('0x9'),attributes,{'tableName':_0xb85b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb85b('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 08b75ae..c27d8fa 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 _0xfd7c=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where'];(function(_0x1186c1,_0x5d359f){var _0x484c85=function(_0x202516){while(--_0x202516){_0x1186c1['push'](_0x1186c1['shift']());}};_0x484c85(++_0x5d359f);}(_0xfd7c,0x1b2));var _0xcfd7=function(_0x5d9030,_0x26a000){_0x5d9030=_0x5d9030-0x0;var _0x52ed22=_0xfd7c[_0x5d9030];return _0x52ed22;};'use strict';var _=require(_0xcfd7('0x0'));var util=require(_0xcfd7('0x1'));var moment=require(_0xcfd7('0x2'));var BPromise=require(_0xcfd7('0x3'));var rs=require(_0xcfd7('0x4'));var fs=require('fs');var Redis=require(_0xcfd7('0x5'));var db=require(_0xcfd7('0x6'))['db'];var utils=require(_0xcfd7('0x7'));var logger=require(_0xcfd7('0x8'))(_0xcfd7('0x9'));var config=require(_0xcfd7('0xa'));var jayson=require(_0xcfd7('0xb'));var client=jayson[_0xcfd7('0xc')][_0xcfd7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ed97c,_0x28fffc,_0xf67144){return new BPromise(function(_0x81d76e,_0x5e7d91){return client[_0xcfd7('0xe')](_0x2ed97c,_0xf67144)[_0xcfd7('0xf')](function(_0x245336){logger[_0xcfd7('0x10')]('MailApplication,\x20%s,\x20%s',_0x28fffc,_0xcfd7('0x11'));logger[_0xcfd7('0x12')](_0xcfd7('0x13'),_0x28fffc,_0xcfd7('0x11'),JSON[_0xcfd7('0x14')](_0x245336));if(_0x245336[_0xcfd7('0x15')]){if(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x16')]===0x1f4){logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x245336[_0xcfd7('0x15')]['message']);return _0x5e7d91(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x18')]);}logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x245336['error'][_0xcfd7('0x18')]);return _0x81d76e(_0x245336[_0xcfd7('0x15')][_0xcfd7('0x18')]);}else{logger[_0xcfd7('0x10')](_0xcfd7('0x17'),_0x28fffc,_0xcfd7('0x11'));_0x81d76e(_0x245336[_0xcfd7('0x19')][_0xcfd7('0x18')]);}})[_0xcfd7('0x1a')](function(_0x5036f){logger[_0xcfd7('0x15')](_0xcfd7('0x17'),_0x28fffc,_0x5036f);_0x5e7d91(_0x5036f);});});}exports[_0xcfd7('0x1b')]=function(_0x3855ad){var _0x3ea837=this;return new Promise(function(_0x581051,_0x1debfb){return db[_0xcfd7('0x1c')][_0xcfd7('0x1d')](_0x3855ad[_0xcfd7('0x1e')],{'raw':_0x3855ad['options']?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3855ad['options']?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x21')]||null:null,'attributes':_0x3855ad[_0xcfd7('0x1f')]?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x22')]||null:null,'limit':_0x3855ad[_0xcfd7('0x1f')]?_0x3855ad[_0xcfd7('0x1f')][_0xcfd7('0x23')]||null:null})[_0xcfd7('0xf')](function(_0x135e49){logger[_0xcfd7('0x10')](_0xcfd7('0x1b'),_0x3855ad);logger['debug']('UpdateMailApplication',_0x3855ad,JSON[_0xcfd7('0x14')](_0x135e49));_0x581051(_0x135e49);})[_0xcfd7('0x1a')](function(_0x33feed){logger[_0xcfd7('0x15')](_0xcfd7('0x1b'),_0x33feed[_0xcfd7('0x18')],_0x3855ad);_0x1debfb(_0x3ea837[_0xcfd7('0x15')](0x1f4,_0x33feed[_0xcfd7('0x18')]));});});}; \ No newline at end of file +var _0xed27=['attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','raw','options','where'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0xed27,0x183));var _0x7ed2=function(_0x73a34a,_0x3659bc){_0x73a34a=_0x73a34a-0x0;var _0x5dda99=_0xed27[_0x73a34a];return _0x5dda99;};'use strict';var _=require(_0x7ed2('0x0'));var util=require(_0x7ed2('0x1'));var moment=require(_0x7ed2('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ed2('0x3'));var fs=require('fs');var Redis=require(_0x7ed2('0x4'));var db=require(_0x7ed2('0x5'))['db'];var utils=require(_0x7ed2('0x6'));var logger=require(_0x7ed2('0x7'))('rpc');var config=require(_0x7ed2('0x8'));var jayson=require(_0x7ed2('0x9'));var client=jayson[_0x7ed2('0xa')][_0x7ed2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d82a,_0x1b23d9,_0x3e362f){return new BPromise(function(_0x1e5d9f,_0x3e6b12){return client[_0x7ed2('0xc')](_0x38d82a,_0x3e362f)['then'](function(_0x3e8c53){logger['info'](_0x7ed2('0xd'),_0x1b23d9,'request\x20sent');logger['debug'](_0x7ed2('0xe'),_0x1b23d9,_0x7ed2('0xf'),JSON[_0x7ed2('0x10')](_0x3e8c53));if(_0x3e8c53[_0x7ed2('0x11')]){if(_0x3e8c53[_0x7ed2('0x11')][_0x7ed2('0x12')]===0x1f4){logger[_0x7ed2('0x11')](_0x7ed2('0xd'),_0x1b23d9,_0x3e8c53[_0x7ed2('0x11')]['message']);return _0x3e6b12(_0x3e8c53['error']['message']);}logger[_0x7ed2('0x11')](_0x7ed2('0xd'),_0x1b23d9,_0x3e8c53[_0x7ed2('0x11')][_0x7ed2('0x13')]);return _0x1e5d9f(_0x3e8c53[_0x7ed2('0x11')][_0x7ed2('0x13')]);}else{logger[_0x7ed2('0x14')]('MailApplication,\x20%s,\x20%s',_0x1b23d9,_0x7ed2('0xf'));_0x1e5d9f(_0x3e8c53[_0x7ed2('0x15')][_0x7ed2('0x13')]);}})[_0x7ed2('0x16')](function(_0x10bf53){logger['error'](_0x7ed2('0xd'),_0x1b23d9,_0x10bf53);_0x3e6b12(_0x10bf53);});});}exports[_0x7ed2('0x17')]=function(_0x184bb2){var _0x18e2bf=this;return new Promise(function(_0x1045b1,_0x38ec45){return db[_0x7ed2('0x18')][_0x7ed2('0x19')](_0x184bb2['body'],{'raw':_0x184bb2['options']?_0x184bb2['options'][_0x7ed2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x184bb2[_0x7ed2('0x1b')]?_0x184bb2['options'][_0x7ed2('0x1c')]||null:null,'attributes':_0x184bb2['options']?_0x184bb2[_0x7ed2('0x1b')][_0x7ed2('0x1d')]||null:null,'limit':_0x184bb2['options']?_0x184bb2[_0x7ed2('0x1b')][_0x7ed2('0x1e')]||null:null})[_0x7ed2('0x1f')](function(_0x9fce2b){logger[_0x7ed2('0x14')]('UpdateMailApplication',_0x184bb2);logger['debug'](_0x7ed2('0x17'),_0x184bb2,JSON[_0x7ed2('0x10')](_0x9fce2b));_0x1045b1(_0x9fce2b);})[_0x7ed2('0x16')](function(_0x13e9d9){logger[_0x7ed2('0x11')](_0x7ed2('0x17'),_0x13e9d9['message'],_0x184bb2);_0x38ec45(_0x18e2bf[_0x7ed2('0x11')](0x1f4,_0x13e9d9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index cb38591..a791f75 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 _0x6821=['mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','post','addMessage','mail','mailinteraction:addtags','put','tracked'];(function(_0x2fffff,_0x415518){var _0x4f2a2c=function(_0x32c77b){while(--_0x32c77b){_0x2fffff['push'](_0x2fffff['shift']());}};_0x4f2a2c(++_0x415518);}(_0x6821,0x1bc));var _0x1682=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x6821[_0x4e55a9];return _0x4a9b67;};'use strict';var express=require('express');var router=express[_0x1682('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0x1682('0x1'));var controller=require(_0x1682('0x2'));router['get']('/',auth[_0x1682('0x3')](),controller[_0x1682('0x4')]);router[_0x1682('0x5')](_0x1682('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x1682('0x7'),auth[_0x1682('0x3')](),controller[_0x1682('0x8')]);router[_0x1682('0x5')](_0x1682('0x9'),auth[_0x1682('0x3')](),controller['getMessages']);router[_0x1682('0x5')]('/:id/download',auth[_0x1682('0x3')](),controller['download']);router[_0x1682('0xa')]('/',auth[_0x1682('0x3')](),controller['create']);router['post']('/:id/messages',auth[_0x1682('0x3')](),controller[_0x1682('0xb')]);router[_0x1682('0xa')]('/:id/tags',auth[_0x1682('0x3')](),interaction['tracked'](_0x1682('0xc'),_0x1682('0xd')),controller['addTags']);router[_0x1682('0xe')](_0x1682('0x7'),auth[_0x1682('0x3')](),interaction[_0x1682('0xf')](_0x1682('0xc'),_0x1682('0x10')),controller[_0x1682('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x1682('0xf')]('mail',_0x1682('0x12')),controller[_0x1682('0x13')]);router[_0x1682('0x14')]('/:id/tags',auth[_0x1682('0x3')](),controller[_0x1682('0x15')]);module[_0x1682('0x16')]=router; \ No newline at end of file +var _0xac96=['isAuthenticated','index','get','/describe','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','/:id','tracked','mailinteraction:update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x612a71,_0xb27d3f){var _0xb07bc1=function(_0x41b70b){while(--_0x41b70b){_0x612a71['push'](_0x612a71['shift']());}};_0xb07bc1(++_0xb27d3f);}(_0xac96,0x1e2));var _0x6ac9=function(_0x4e38b1,_0x309a5e){_0x4e38b1=_0x4e38b1-0x0;var _0x2c4e59=_0xac96[_0x4e38b1];return _0x2c4e59;};'use strict';var express=require(_0x6ac9('0x0'));var router=express[_0x6ac9('0x1')]();var auth=require(_0x6ac9('0x2'));var interaction=require(_0x6ac9('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x6ac9('0x4')](),controller[_0x6ac9('0x5')]);router[_0x6ac9('0x6')](_0x6ac9('0x7'),auth['isAuthenticated'](),controller[_0x6ac9('0x8')]);router[_0x6ac9('0x6')]('/:id',auth[_0x6ac9('0x4')](),controller[_0x6ac9('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x6ac9('0xa')]);router[_0x6ac9('0x6')](_0x6ac9('0xb'),auth[_0x6ac9('0x4')](),controller[_0x6ac9('0xc')]);router[_0x6ac9('0xd')]('/',auth[_0x6ac9('0x4')](),controller[_0x6ac9('0xe')]);router['post'](_0x6ac9('0xf'),auth[_0x6ac9('0x4')](),controller[_0x6ac9('0x10')]);router[_0x6ac9('0xd')](_0x6ac9('0x11'),auth[_0x6ac9('0x4')](),interaction['tracked'](_0x6ac9('0x12'),_0x6ac9('0x13')),controller[_0x6ac9('0x14')]);router['put'](_0x6ac9('0x15'),auth[_0x6ac9('0x4')](),interaction[_0x6ac9('0x16')](_0x6ac9('0x12'),_0x6ac9('0x17')),controller['update']);router[_0x6ac9('0x18')](_0x6ac9('0x15'),auth[_0x6ac9('0x4')](),interaction[_0x6ac9('0x16')](_0x6ac9('0x12'),'mailinteraction:destroy'),controller[_0x6ac9('0x19')]);router[_0x6ac9('0x18')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x6ac9('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 ee525a6..ee0369f 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 _0xef8e=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','iconv','exports','BOOLEAN'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xef8e,0x1dd));var _0xeef8=function(_0x2c7d90,_0x129415){_0x2c7d90=_0x2c7d90-0x0;var _0x35a25c=_0xef8e[_0x2c7d90];return _0x35a25c;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xeef8('0x0'));module[_0xeef8('0x1')]={'closed':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeef8('0x3')]},'disposition':{'type':Sequelize[_0xeef8('0x4')]},'secondDisposition':{'type':Sequelize[_0xeef8('0x4')]},'thirdDisposition':{'type':Sequelize[_0xeef8('0x4')]},'note':{'type':Sequelize[_0xeef8('0x4')]},'inReplyTo':{'type':Sequelize[_0xeef8('0x4')](0x1fe)},'to':{'type':Sequelize[_0xeef8('0x4')]},'cc':{'type':Sequelize[_0xeef8('0x5')](_0xeef8('0x6'))},'subject':{'type':Sequelize[_0xeef8('0x5')]()},'attach':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xeef8('0x3')]},'substatus':{'type':Sequelize[_0xeef8('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xeef8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xeef8('0x7')]('in',_0xeef8('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xeef8('0x7')]('in',_0xeef8('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xeef8('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xeef8('0x9')]}}; \ No newline at end of file +var _0x394c=['TEXT','long','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x4c13b8,_0x151ac9){var _0x4ef742=function(_0x59137d){while(--_0x59137d){_0x4c13b8['push'](_0x4c13b8['shift']());}};_0x4ef742(++_0x151ac9);}(_0x394c,0x71));var _0xc394=function(_0x3df935,_0x2f6877){_0x3df935=_0x3df935-0x0;var _0x152412=_0x394c[_0x3df935];return _0x152412;};'use strict';var Sequelize=require(_0xc394('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xc394('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc394('0x2')]},'disposition':{'type':Sequelize[_0xc394('0x3')]},'secondDisposition':{'type':Sequelize[_0xc394('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc394('0x3')]},'note':{'type':Sequelize[_0xc394('0x3')]},'inReplyTo':{'type':Sequelize[_0xc394('0x3')](0x1fe)},'to':{'type':Sequelize[_0xc394('0x3')]},'cc':{'type':Sequelize[_0xc394('0x4')](_0xc394('0x5'))},'subject':{'type':Sequelize[_0xc394('0x4')]()},'attach':{'type':Sequelize[_0xc394('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xc394('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc394('0x6')]('in',_0xc394('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc394('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc394('0x6')]('in',_0xc394('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc394('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc394('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f27c0c3..9114167 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 _0xf196=['transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','bcc','subject','get','mkdirSync','each','missing.recipient@your.company.com','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','getOptions','mail','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','options','create','body','catch','destroy','find','describe','addMessage','MailMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','inlineCss','true','rows','addTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join'];(function(_0x109107,_0x5b5c5e){var _0x3112dd=function(_0x3e45d4){while(--_0x3e45d4){_0x109107['push'](_0x109107['shift']());}};_0x3112dd(++_0x5b5c5e);}(_0xf196,0x17d));var _0x6f19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf196[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f19('0x0'));var zipdir=require(_0x6f19('0x1'));var moment=require(_0x6f19('0x2'));var BPromise=require(_0x6f19('0x3'));var util=require(_0x6f19('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x6f19('0x5'));var juice=require(_0x6f19('0x6'));var Redis=require(_0x6f19('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x6f19('0x8'));var config=require(_0x6f19('0x9'));var db=require(_0x6f19('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x6f19('0xb')]=_[_0x6f19('0xc')](config[_0x6f19('0xb')],{'host':_0x6f19('0xd'),'port':0x18eb});var socket=require(_0x6f19('0xe'))(new Redis(config['redis']));require(_0x6f19('0xf'))[_0x6f19('0x10')](socket);function respondWithStatusCode(_0x1194c5,_0x9f9bde){_0x9f9bde=_0x9f9bde||0xcc;return function(_0x193cdd){if(_0x193cdd){return _0x1194c5['sendStatus'](_0x9f9bde);}return _0x1194c5['status'](_0x9f9bde)[_0x6f19('0x11')]();};}function respondWithResult(_0x2d4a27,_0x14032c){_0x14032c=_0x14032c||0xc8;return function(_0x19628b){if(_0x19628b){return _0x2d4a27[_0x6f19('0x12')](_0x14032c)[_0x6f19('0x13')](_0x19628b);}};}function respondWithFilteredResult(_0x5d75c0,_0x1b3211){return function(_0x19cca6){if(_0x19cca6){var _0x585eba=typeof _0x1b3211[_0x6f19('0x14')]===_0x6f19('0x15')&&typeof _0x1b3211[_0x6f19('0x16')]==='undefined';var _0xf2601=_0x19cca6[_0x6f19('0x17')];var _0x4a3409=_0x585eba?0x0:_0x1b3211[_0x6f19('0x14')];var _0x4e9477=_0x585eba?_0x19cca6[_0x6f19('0x17')]:_0x1b3211[_0x6f19('0x14')]+_0x1b3211[_0x6f19('0x16')];var _0x5bc338;if(_0x4e9477>=_0xf2601){_0x4e9477=_0xf2601;_0x5bc338=0xc8;}else{_0x5bc338=0xce;}_0x5d75c0['status'](_0x5bc338);return _0x5d75c0[_0x6f19('0x18')](_0x6f19('0x19'),_0x4a3409+'-'+_0x4e9477+'/'+_0xf2601)['json'](_0x19cca6);}return null;};}function saveUpdates(_0x15154a){return function(_0x173359){if(_0x173359){return _0x173359[_0x6f19('0x1a')](_0x15154a)[_0x6f19('0x1b')](function(_0x46e69e){return _0x46e69e;});}return null;};}function removeEntity(_0x13c5f1){return function(_0x9d2937){if(_0x9d2937){return _0x9d2937['destroy']()['then'](function(){_0x13c5f1[_0x6f19('0x12')](0xcc)[_0x6f19('0x11')]();});}};}function handleEntityNotFound(_0x43e1d2){return function(_0x2e611d){if(!_0x2e611d){_0x43e1d2[_0x6f19('0x1c')](0x194);}return _0x2e611d;};}function handleError(_0x2f9d6b,_0x10755d){_0x10755d=_0x10755d||0x1f4;return function(_0x4e037b){logger[_0x6f19('0x1d')](_0x4e037b[_0x6f19('0x1e')]);if(_0x4e037b[_0x6f19('0x1f')]){delete _0x4e037b['name'];}_0x2f9d6b['status'](_0x10755d)[_0x6f19('0x20')](_0x4e037b);};}exports['index']=function(_0x2573c5,_0x9443a1){var _0x558904={};var _0x3d7245=_[_0x6f19('0x21')](db[_0x6f19('0x22')][_0x6f19('0x23')],function(_0xe5ad9e){return{'name':_0xe5ad9e[_0x6f19('0x24')],'type':_0xe5ad9e[_0x6f19('0x25')]['key']};});_0x558904=qs[_0x6f19('0x26')](_0x3d7245,_0x2573c5);return interaction['findAll'](_0x6f19('0x27'),_0x2573c5[_0x6f19('0x28')],_0x2573c5[_0x6f19('0x29')],_0x558904,_0x3d7245)['then'](respondWithFilteredResult(_0x9443a1,_0x558904))['catch'](handleError(_0x9443a1,null));};exports[_0x6f19('0x2a')]=function(_0x573a9d,_0x1cf38b){var _0x4f3eb8={'raw':![],'where':{'id':_0x573a9d[_0x6f19('0x2b')]['id']}},_0x15f87c={};_0x15f87c[_0x6f19('0x2c')]=_[_0x6f19('0x2d')](db[_0x6f19('0x22')]['rawAttributes']);_0x15f87c['query']=_['keys'](_0x573a9d[_0x6f19('0x28')]);_0x15f87c[_0x6f19('0x2e')]=_[_0x6f19('0x2f')](_0x15f87c[_0x6f19('0x2c')],_0x15f87c[_0x6f19('0x28')]);_0x4f3eb8[_0x6f19('0x30')]=_[_0x6f19('0x2f')](_0x15f87c['model'],qs['fields'](_0x573a9d[_0x6f19('0x28')][_0x6f19('0x31')]));_0x4f3eb8[_0x6f19('0x30')]=_0x4f3eb8[_0x6f19('0x30')][_0x6f19('0x32')]?_0x4f3eb8[_0x6f19('0x30')]:_0x15f87c['model'];if(_0x573a9d[_0x6f19('0x28')]['includeAll']){_0x4f3eb8['include']=[{'all':!![]}];}_0x4f3eb8=_['merge']({},_0x4f3eb8,_0x573a9d[_0x6f19('0x33')]);return db[_0x6f19('0x22')]['find'](_0x4f3eb8)[_0x6f19('0x1b')](handleEntityNotFound(_0x1cf38b,null))[_0x6f19('0x1b')](respondWithResult(_0x1cf38b,null))['catch'](handleError(_0x1cf38b,null));};exports[_0x6f19('0x34')]=function(_0x2cd622,_0x698560){return db['MailInteraction'][_0x6f19('0x34')](_0x2cd622['body'],{})[_0x6f19('0x1b')](respondWithResult(_0x698560,0xc9))['catch'](handleError(_0x698560,null));};exports['update']=function(_0x56999c,_0x188abf){if(_0x56999c[_0x6f19('0x35')]['id']){delete _0x56999c[_0x6f19('0x35')]['id'];}return db[_0x6f19('0x22')]['find']({'where':{'id':_0x56999c[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x188abf,null))['then'](saveUpdates(_0x56999c[_0x6f19('0x35')],null))[_0x6f19('0x1b')](respondWithResult(_0x188abf,null))[_0x6f19('0x36')](handleError(_0x188abf,null));};exports[_0x6f19('0x37')]=function(_0x3d798f,_0x584810){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x3d798f[_0x6f19('0x2b')]['id']}})['then'](handleEntityNotFound(_0x584810,null))[_0x6f19('0x1b')](removeEntity(_0x584810,null))[_0x6f19('0x36')](handleError(_0x584810,null));};exports[_0x6f19('0x39')]=function(_0x646746,_0x3fecae){return db['MailInteraction'][_0x6f19('0x39')]()[_0x6f19('0x1b')](respondWithResult(_0x3fecae,null))[_0x6f19('0x36')](handleError(_0x3fecae,null));};exports[_0x6f19('0x3a')]=function(_0x41be38,_0x4ec36c){return db[_0x6f19('0x3b')][_0x6f19('0x38')]({'where':{'id':_0x41be38[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x4ec36c,null))[_0x6f19('0x1b')](function(_0x1706af){if(_0x1706af){return _0x1706af[_0x6f19('0x3a')](_0x41be38['body']['ids'],_['omit'](_0x41be38[_0x6f19('0x35')],[_0x6f19('0x3c'),'id'])||{});}})[_0x6f19('0x1b')](respondWithResult(_0x4ec36c,null))['catch'](handleError(_0x4ec36c,null));};exports[_0x6f19('0x3d')]=function(_0x2fc2d1,_0x4e480d){var _0x3531d8={'raw':![],'where':{}};var _0x36777a={};var _0xb8cf95={'count':0x0,'rows':[]};return db[_0x6f19('0x22')]['findOne']({'where':{'id':_0x2fc2d1[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x4e480d,null))[_0x6f19('0x1b')](function(_0x23faa3){if(_0x23faa3){_0x36777a['model']=_[_0x6f19('0x2d')](db['MailMessage'][_0x6f19('0x23')]);_0x36777a[_0x6f19('0x28')]=_['keys'](_0x2fc2d1[_0x6f19('0x28')]);_0x36777a[_0x6f19('0x2e')]=_[_0x6f19('0x2f')](_0x36777a[_0x6f19('0x2c')],_0x36777a['query']);_0x3531d8[_0x6f19('0x30')]=_[_0x6f19('0x2f')](_0x36777a[_0x6f19('0x2c')],qs[_0x6f19('0x31')](_0x2fc2d1[_0x6f19('0x28')]['fields']));_0x3531d8[_0x6f19('0x30')]=_0x3531d8['attributes']['length']?_0x3531d8[_0x6f19('0x30')]:_0x36777a[_0x6f19('0x2c')];if(!_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x3e')](_0x6f19('0x3f'))){_0x3531d8['limit']=qs[_0x6f19('0x16')](_0x2fc2d1[_0x6f19('0x28')]['limit']);_0x3531d8[_0x6f19('0x14')]=qs['offset'](_0x2fc2d1[_0x6f19('0x28')]['offset']);}_0x3531d8[_0x6f19('0x40')]=qs[_0x6f19('0x41')](_0x2fc2d1['query']['sort']);_0x3531d8[_0x6f19('0x42')]=qs['filters'](_[_0x6f19('0x43')](_0x2fc2d1['query'],_0x36777a[_0x6f19('0x2e')]));_0x3531d8['where'][_0x6f19('0x44')]=_0x23faa3['id'];if(_0x2fc2d1[_0x6f19('0x28')]['filter']){_0x3531d8[_0x6f19('0x42')]=_[_0x6f19('0x45')](_0x3531d8[_0x6f19('0x42')],{'$or':_[_0x6f19('0x21')](_0x3531d8['attributes'],function(_0x26ea2f){var _0x1e2614={};_0x1e2614[_0x26ea2f]={'$like':'%'+_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x46')]+'%'};return _0x1e2614;})});}if(_0x2fc2d1[_0x6f19('0x28')]['$gte']){var _0x4ac990=_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x47')][_0x6f19('0x48')](',');var _0x2c8033={};_0x2c8033[_0x4ac990[0x0]]={'$gte':moment(_0x4ac990[0x1])[_0x6f19('0x49')](_0x6f19('0x4a'))};_0x3531d8[_0x6f19('0x42')]=_[_0x6f19('0x45')](_0x3531d8[_0x6f19('0x42')],_0x2c8033);}_0x3531d8=_[_0x6f19('0x45')]({},_0x3531d8,_0x2fc2d1[_0x6f19('0x33')]);return db[_0x6f19('0x3b')][_0x6f19('0x17')]({'where':_0x3531d8[_0x6f19('0x42')]})[_0x6f19('0x1b')](function(_0x43f186){_0xb8cf95[_0x6f19('0x17')]=_0x43f186;if(_0x2fc2d1['query'][_0x6f19('0x4b')]){_0x3531d8[_0x6f19('0x4c')]=[{'all':!![]}];}return db[_0x6f19('0x3b')][_0x6f19('0x4d')](_0x3531d8);})[_0x6f19('0x1b')](function(_0x4b9471){if(_0x2fc2d1[_0x6f19('0x28')][_0x6f19('0x4e')]===_0x6f19('0x4f')){for(var _0xb3213c=0x0;_0xb3213c<_0x4b9471[_0x6f19('0x32')];_0xb3213c++){_0x4b9471[_0xb3213c][_0x6f19('0x35')]=juice(_0x4b9471[_0xb3213c][_0x6f19('0x35')]);}}_0xb8cf95[_0x6f19('0x50')]=_0x4b9471;return _0xb8cf95;});}})[_0x6f19('0x1b')](respondWithFilteredResult(_0x4e480d,_0x3531d8))[_0x6f19('0x36')](handleError(_0x4e480d,null));};exports[_0x6f19('0x51')]=function(_0x52ca02,_0x1ce3aa){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x52ca02[_0x6f19('0x2b')]['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x1ce3aa,null))[_0x6f19('0x1b')](function(_0x4d5fbc){if(_0x4d5fbc){return _0x4d5fbc['setTags'](_0x52ca02[_0x6f19('0x35')][_0x6f19('0x3c')],_['omit'](_0x52ca02[_0x6f19('0x35')],[_0x6f19('0x3c'),'id'])||{})[_0x6f19('0x52')](function(){return db[_0x6f19('0x53')][_0x6f19('0x4d')]({'attributes':['id',_0x6f19('0x1f'),_0x6f19('0x54')],'where':{'id':_0x52ca02['body'][_0x6f19('0x3c')]}});})[_0x6f19('0x1b')](function(_0x26556c){socket['emit'](_0x6f19('0x55'),{'id':Number(_0x52ca02['params']['id']),'tags':_0x26556c||[]});return{'id':Number(_0x52ca02['params']['id']),'tags':_0x26556c||[]};});}})[_0x6f19('0x1b')](respondWithResult(_0x1ce3aa,null))[_0x6f19('0x36')](handleError(_0x1ce3aa,null));};exports['removeTags']=function(_0x5ea4c8,_0x1863dc){return db[_0x6f19('0x22')][_0x6f19('0x38')]({'where':{'id':_0x5ea4c8['params']['id']}})[_0x6f19('0x1b')](handleEntityNotFound(_0x1863dc,null))[_0x6f19('0x1b')](function(_0x3291e4){if(_0x3291e4){return _0x3291e4[_0x6f19('0x56')](_0x5ea4c8[_0x6f19('0x28')][_0x6f19('0x3c')]);}})[_0x6f19('0x1b')](respondWithStatusCode(_0x1863dc,null))['catch'](handleError(_0x1863dc,null));};exports[_0x6f19('0x57')]=function(_0x12467d,_0x1bfea3){var _0xd78b0f=moment()[_0x6f19('0x58')]()[_0x6f19('0x59')]();var _0x5b7432=path['join'](config[_0x6f19('0x5a')],_0x6f19('0x5b'),_0x6f19('0x5c'),_0x6f19('0x5d'));var _0x1591fa=path[_0x6f19('0x5e')](config[_0x6f19('0x5a')],_0x6f19('0x5b'),_0x6f19('0x5c'),'attachments');var _0x2e7a3b=path[_0x6f19('0x5e')](_0x5b7432,_0xd78b0f);var _0x5558da=util[_0x6f19('0x49')](_0x6f19('0x5f'),_0x12467d[_0x6f19('0x2b')]['id'],_0xd78b0f);var _0x233381=path['join'](_0x5b7432,_0x5558da);var _0x3c34a2=[];if(_0x12467d[_0x6f19('0x28')][_0x6f19('0x60')]){_0x3c34a2[_0x6f19('0x61')]({'model':db[_0x6f19('0x62')],'as':_0x6f19('0x63'),'raw':!![]});}var _0x5e8974=[{'model':db[_0x6f19('0x3b')],'as':_0x6f19('0x64'),'attributes':['id',_0x6f19('0x35'),_0x6f19('0x65'),'to','cc',_0x6f19('0x66'),_0x6f19('0x67'),'createdAt'],'where':{'secret':![]},'order':qs[_0x6f19('0x41')]('id'),'include':_0x3c34a2}];return db['MailInteraction'][_0x6f19('0x38')]({'where':{'id':_0x12467d[_0x6f19('0x2b')]['id']},'include':_0x5e8974})[_0x6f19('0x1b')](handleEntityNotFound(_0x1bfea3,null))[_0x6f19('0x1b')](function(_0x533ce9){if(_0x533ce9&&_0x533ce9[_0x6f19('0x64')]){var _0x55958a=_0x533ce9[_0x6f19('0x68')]({'plain':!![]});fs[_0x6f19('0x69')](_0x2e7a3b);return BPromise[_0x6f19('0x6a')](_0x55958a[_0x6f19('0x64')],function(_0x345a52,_0x58a4f7){var _0xaf5a23={'from':_0x345a52[_0x6f19('0x65')],'to':_0x345a52['to']||_0x6f19('0x6b'),'subject':_0x345a52[_0x6f19('0x67')],'html':htmlEntities[_0x6f19('0x6c')](_0x345a52[_0x6f19('0x35')]),'headers':{'Date':moment(_0x345a52[_0x6f19('0x6d')])[_0x6f19('0x49')](_0x6f19('0x6e'))},'attachments':[]};if(_0x345a52['cc']){_0xaf5a23['headers']['Cc']=_0x345a52['cc'];}if(_0x345a52[_0x6f19('0x66')]){_0xaf5a23[_0x6f19('0x6f')]['Bcc']=_0x345a52[_0x6f19('0x66')];}return new BPromise(function(_0x5dc48f,_0xc5ab5d){if(_0x345a52[_0x6f19('0x63')]){for(var _0x3afa54=0x0;_0x3afa54<_0x345a52[_0x6f19('0x63')][_0x6f19('0x32')];_0x3afa54++){var _0xe108ca=_0x345a52[_0x6f19('0x63')][_0x3afa54];var _0x5dfcc4=path['join'](_0x1591fa,_0xe108ca[_0x6f19('0x70')]);if(fs[_0x6f19('0x71')](_0x5dfcc4)){_0xaf5a23[_0x6f19('0x60')][_0x6f19('0x61')]({'name':_0xe108ca[_0x6f19('0x1f')],'contentType':_0xe108ca[_0x6f19('0x25')],'data':fs[_0x6f19('0x72')](_0x5dfcc4)});}}}emlformat[_0x6f19('0x73')](_0xaf5a23,function(_0x467a89,_0x256be9){if(_0x467a89)return _0xc5ab5d(_0x467a89);fs[_0x6f19('0x74')](path[_0x6f19('0x5e')](_0x2e7a3b,util['format'](_0x6f19('0x75'),_0x58a4f7)),_0x256be9);return _0x5dc48f(_0x256be9);});});})['then'](function(){return new BPromise(function(_0x50094a,_0xbf3132){zipdir(_0x2e7a3b,{'saveTo':_0x233381},function(_0x3bd49a,_0x3d9c46){if(_0x3bd49a)return _0xbf3132(_0x3bd49a);return _0x50094a(_0x3d9c46);});})[_0x6f19('0x1b')](function(){return new BPromise(function(_0x45473e,_0x349b37){rimraf(_0x2e7a3b,function(_0x4066d5){if(_0x4066d5)_0x349b37(_0x4066d5);return _0x45473e();});});})[_0x6f19('0x1b')](function(){return _0x1bfea3['download'](_0x233381,_0x5558da,function(_0x57ab52){if(!_0x57ab52)fs[_0x6f19('0x76')](_0x233381);});});});}else{return _0x1bfea3['sendStatus'](0xc8);}})[_0x6f19('0x36')](handleError(_0x1bfea3,null));}; \ No newline at end of file +var _0x6a66=['unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','then','catch','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','true','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','files','tmp','attachments','join','push','Attachments','Messages','from','bcc','createdAt','get','subject','decode','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','type','build','message%d.eml'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x6a66,0x70));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x66a6('0x0'));var rimraf=require(_0x66a6('0x1'));var zipdir=require(_0x66a6('0x2'));var moment=require(_0x66a6('0x3'));var BPromise=require(_0x66a6('0x4'));var util=require('util');var path=require(_0x66a6('0x5'));var fs=require('fs');var _=require(_0x66a6('0x6'));var juice=require(_0x66a6('0x7'));var Redis=require('ioredis');var interaction=require(_0x66a6('0x8'));var qs=require(_0x66a6('0x9'));var logger=require(_0x66a6('0xa'))('api');var config=require(_0x66a6('0xb'));var db=require(_0x66a6('0xc'))['db'];var htmlEntities=require(_0x66a6('0xd'));config[_0x66a6('0xe')]=_[_0x66a6('0xf')](config[_0x66a6('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x66a6('0x10'))(new Redis(config[_0x66a6('0xe')]));require(_0x66a6('0x11'))[_0x66a6('0x12')](socket);function respondWithStatusCode(_0x4a4654,_0x259de1){_0x259de1=_0x259de1||0xcc;return function(_0x1c6863){if(_0x1c6863){return _0x4a4654[_0x66a6('0x13')](_0x259de1);}return _0x4a4654[_0x66a6('0x14')](_0x259de1)[_0x66a6('0x15')]();};}function respondWithResult(_0x188fc0,_0x2e9311){_0x2e9311=_0x2e9311||0xc8;return function(_0x1789db){if(_0x1789db){return _0x188fc0[_0x66a6('0x14')](_0x2e9311)[_0x66a6('0x16')](_0x1789db);}};}function respondWithFilteredResult(_0x27db3c,_0x3e6aa3){return function(_0x3cc1f7){if(_0x3cc1f7){var _0x11e843=typeof _0x3e6aa3[_0x66a6('0x17')]===_0x66a6('0x18')&&typeof _0x3e6aa3[_0x66a6('0x19')]==='undefined';var _0x2aa868=_0x3cc1f7[_0x66a6('0x1a')];var _0x46043f=_0x11e843?0x0:_0x3e6aa3['offset'];var _0x4414ff=_0x11e843?_0x3cc1f7['count']:_0x3e6aa3[_0x66a6('0x17')]+_0x3e6aa3['limit'];var _0x2ce067;if(_0x4414ff>=_0x2aa868){_0x4414ff=_0x2aa868;_0x2ce067=0xc8;}else{_0x2ce067=0xce;}_0x27db3c[_0x66a6('0x14')](_0x2ce067);return _0x27db3c['set'](_0x66a6('0x1b'),_0x46043f+'-'+_0x4414ff+'/'+_0x2aa868)[_0x66a6('0x16')](_0x3cc1f7);}return null;};}function saveUpdates(_0x52da52){return function(_0x461e5c){if(_0x461e5c){return _0x461e5c[_0x66a6('0x1c')](_0x52da52)['then'](function(_0x468f52){return _0x468f52;});}return null;};}function removeEntity(_0x411c75){return function(_0x157d56){if(_0x157d56){return _0x157d56[_0x66a6('0x1d')]()['then'](function(){_0x411c75[_0x66a6('0x14')](0xcc)[_0x66a6('0x15')]();});}};}function handleEntityNotFound(_0x238f2c){return function(_0x5224a7){if(!_0x5224a7){_0x238f2c[_0x66a6('0x13')](0x194);}return _0x5224a7;};}function handleError(_0x1a0308,_0x3f3dc4){_0x3f3dc4=_0x3f3dc4||0x1f4;return function(_0x172c94){logger['error'](_0x172c94['stack']);if(_0x172c94[_0x66a6('0x1e')]){delete _0x172c94[_0x66a6('0x1e')];}_0x1a0308['status'](_0x3f3dc4)[_0x66a6('0x1f')](_0x172c94);};}exports[_0x66a6('0x20')]=function(_0x1dc3f4,_0xb0adce){var _0x2c70a6={};var _0x3a6c88=_[_0x66a6('0x21')](db[_0x66a6('0x22')][_0x66a6('0x23')],function(_0x5ed273){return{'name':_0x5ed273[_0x66a6('0x24')],'type':_0x5ed273['type'][_0x66a6('0x25')]};});_0x2c70a6=qs[_0x66a6('0x26')](_0x3a6c88,_0x1dc3f4);return interaction[_0x66a6('0x27')]('mail',_0x1dc3f4[_0x66a6('0x28')],_0x1dc3f4[_0x66a6('0x29')],_0x2c70a6,_0x3a6c88)[_0x66a6('0x2a')](respondWithFilteredResult(_0xb0adce,_0x2c70a6))[_0x66a6('0x2b')](handleError(_0xb0adce,null));};exports['show']=function(_0x51b4e8,_0x576c5c){var _0x4e61be={'raw':![],'where':{'id':_0x51b4e8[_0x66a6('0x2c')]['id']}},_0x5a0dc8={};_0x5a0dc8[_0x66a6('0x2d')]=_[_0x66a6('0x2e')](db[_0x66a6('0x22')]['rawAttributes']);_0x5a0dc8[_0x66a6('0x28')]=_[_0x66a6('0x2e')](_0x51b4e8[_0x66a6('0x28')]);_0x5a0dc8[_0x66a6('0x2f')]=_[_0x66a6('0x30')](_0x5a0dc8[_0x66a6('0x2d')],_0x5a0dc8[_0x66a6('0x28')]);_0x4e61be['attributes']=_[_0x66a6('0x30')](_0x5a0dc8[_0x66a6('0x2d')],qs[_0x66a6('0x31')](_0x51b4e8[_0x66a6('0x28')][_0x66a6('0x31')]));_0x4e61be[_0x66a6('0x32')]=_0x4e61be[_0x66a6('0x32')][_0x66a6('0x33')]?_0x4e61be[_0x66a6('0x32')]:_0x5a0dc8['model'];if(_0x51b4e8[_0x66a6('0x28')][_0x66a6('0x34')]){_0x4e61be[_0x66a6('0x35')]=[{'all':!![]}];}_0x4e61be=_[_0x66a6('0x36')]({},_0x4e61be,_0x51b4e8[_0x66a6('0x37')]);return db[_0x66a6('0x22')][_0x66a6('0x38')](_0x4e61be)[_0x66a6('0x2a')](handleEntityNotFound(_0x576c5c,null))[_0x66a6('0x2a')](respondWithResult(_0x576c5c,null))[_0x66a6('0x2b')](handleError(_0x576c5c,null));};exports[_0x66a6('0x39')]=function(_0x446e6d,_0x368930){return db['MailInteraction']['create'](_0x446e6d[_0x66a6('0x3a')],{})['then'](respondWithResult(_0x368930,0xc9))[_0x66a6('0x2b')](handleError(_0x368930,null));};exports[_0x66a6('0x1c')]=function(_0x24f247,_0x5e74a3){if(_0x24f247[_0x66a6('0x3a')]['id']){delete _0x24f247[_0x66a6('0x3a')]['id'];}return db[_0x66a6('0x22')]['find']({'where':{'id':_0x24f247[_0x66a6('0x2c')]['id']}})[_0x66a6('0x2a')](handleEntityNotFound(_0x5e74a3,null))[_0x66a6('0x2a')](saveUpdates(_0x24f247['body'],null))[_0x66a6('0x2a')](respondWithResult(_0x5e74a3,null))[_0x66a6('0x2b')](handleError(_0x5e74a3,null));};exports['destroy']=function(_0x420a9b,_0x57db0c){return db[_0x66a6('0x22')]['find']({'where':{'id':_0x420a9b[_0x66a6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x57db0c,null))['then'](removeEntity(_0x57db0c,null))[_0x66a6('0x2b')](handleError(_0x57db0c,null));};exports[_0x66a6('0x3b')]=function(_0x2e1c74,_0x568dd7){return db['MailInteraction']['describe']()[_0x66a6('0x2a')](respondWithResult(_0x568dd7,null))[_0x66a6('0x2b')](handleError(_0x568dd7,null));};exports[_0x66a6('0x3c')]=function(_0x394749,_0x1e213b){return db[_0x66a6('0x3d')]['find']({'where':{'id':_0x394749[_0x66a6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1e213b,null))['then'](function(_0x58133f){if(_0x58133f){return _0x58133f[_0x66a6('0x3c')](_0x394749['body'][_0x66a6('0x3e')],_['omit'](_0x394749[_0x66a6('0x3a')],[_0x66a6('0x3e'),'id'])||{});}})[_0x66a6('0x2a')](respondWithResult(_0x1e213b,null))[_0x66a6('0x2b')](handleError(_0x1e213b,null));};exports[_0x66a6('0x3f')]=function(_0x27505c,_0x37a971){var _0x591527={'raw':![],'where':{}};var _0x1bcbd3={};var _0x41cf0b={'count':0x0,'rows':[]};return db[_0x66a6('0x22')][_0x66a6('0x40')]({'where':{'id':_0x27505c[_0x66a6('0x2c')]['id']}})[_0x66a6('0x2a')](handleEntityNotFound(_0x37a971,null))[_0x66a6('0x2a')](function(_0x427e8a){if(_0x427e8a){_0x1bcbd3[_0x66a6('0x2d')]=_[_0x66a6('0x2e')](db[_0x66a6('0x3d')][_0x66a6('0x23')]);_0x1bcbd3[_0x66a6('0x28')]=_[_0x66a6('0x2e')](_0x27505c[_0x66a6('0x28')]);_0x1bcbd3[_0x66a6('0x2f')]=_[_0x66a6('0x30')](_0x1bcbd3[_0x66a6('0x2d')],_0x1bcbd3[_0x66a6('0x28')]);_0x591527[_0x66a6('0x32')]=_[_0x66a6('0x30')](_0x1bcbd3[_0x66a6('0x2d')],qs[_0x66a6('0x31')](_0x27505c[_0x66a6('0x28')]['fields']));_0x591527[_0x66a6('0x32')]=_0x591527[_0x66a6('0x32')]['length']?_0x591527[_0x66a6('0x32')]:_0x1bcbd3[_0x66a6('0x2d')];if(!_0x27505c[_0x66a6('0x28')][_0x66a6('0x41')](_0x66a6('0x42'))){_0x591527[_0x66a6('0x19')]=qs['limit'](_0x27505c['query'][_0x66a6('0x19')]);_0x591527['offset']=qs['offset'](_0x27505c['query'][_0x66a6('0x17')]);}_0x591527[_0x66a6('0x43')]=qs[_0x66a6('0x44')](_0x27505c[_0x66a6('0x28')][_0x66a6('0x44')]);_0x591527[_0x66a6('0x45')]=qs[_0x66a6('0x2f')](_[_0x66a6('0x46')](_0x27505c['query'],_0x1bcbd3[_0x66a6('0x2f')]));_0x591527[_0x66a6('0x45')][_0x66a6('0x47')]=_0x427e8a['id'];if(_0x27505c['query'][_0x66a6('0x48')]){_0x591527['where']=_[_0x66a6('0x36')](_0x591527['where'],{'$or':_['map'](_0x591527[_0x66a6('0x32')],function(_0x2a4200){var _0x1d54a2={};_0x1d54a2[_0x2a4200]={'$like':'%'+_0x27505c['query'][_0x66a6('0x48')]+'%'};return _0x1d54a2;})});}if(_0x27505c[_0x66a6('0x28')]['$gte']){var _0x3416cf=_0x27505c[_0x66a6('0x28')][_0x66a6('0x49')][_0x66a6('0x4a')](',');var _0x10d399={};_0x10d399[_0x3416cf[0x0]]={'$gte':moment(_0x3416cf[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x591527[_0x66a6('0x45')]=_[_0x66a6('0x36')](_0x591527[_0x66a6('0x45')],_0x10d399);}_0x591527=_[_0x66a6('0x36')]({},_0x591527,_0x27505c[_0x66a6('0x37')]);return db[_0x66a6('0x3d')][_0x66a6('0x1a')]({'where':_0x591527[_0x66a6('0x45')]})[_0x66a6('0x2a')](function(_0x2d8677){_0x41cf0b[_0x66a6('0x1a')]=_0x2d8677;if(_0x27505c['query'][_0x66a6('0x34')]){_0x591527['include']=[{'all':!![]}];}return db[_0x66a6('0x3d')][_0x66a6('0x27')](_0x591527);})[_0x66a6('0x2a')](function(_0x123391){if(_0x27505c[_0x66a6('0x28')]['inlineCss']===_0x66a6('0x4b')){for(var _0x1bebad=0x0;_0x1bebad<_0x123391['length'];_0x1bebad++){_0x123391[_0x1bebad]['body']=juice(_0x123391[_0x1bebad][_0x66a6('0x3a')]);}}_0x41cf0b['rows']=_0x123391;return _0x41cf0b;});}})[_0x66a6('0x2a')](respondWithFilteredResult(_0x37a971,_0x591527))[_0x66a6('0x2b')](handleError(_0x37a971,null));};exports[_0x66a6('0x4c')]=function(_0x16beed,_0x5172e8){return db[_0x66a6('0x22')][_0x66a6('0x38')]({'where':{'id':_0x16beed[_0x66a6('0x2c')]['id']}})[_0x66a6('0x2a')](handleEntityNotFound(_0x5172e8,null))[_0x66a6('0x2a')](function(_0x149f7f){if(_0x149f7f){return _0x149f7f[_0x66a6('0x4d')](_0x16beed['body'][_0x66a6('0x3e')],_[_0x66a6('0x4e')](_0x16beed[_0x66a6('0x3a')],['ids','id'])||{})[_0x66a6('0x4f')](function(){return db[_0x66a6('0x50')][_0x66a6('0x27')]({'attributes':['id',_0x66a6('0x1e'),'color'],'where':{'id':_0x16beed[_0x66a6('0x3a')]['ids']}});})[_0x66a6('0x2a')](function(_0x149762){socket[_0x66a6('0x51')](_0x66a6('0x52'),{'id':Number(_0x16beed[_0x66a6('0x2c')]['id']),'tags':_0x149762||[]});return{'id':Number(_0x16beed[_0x66a6('0x2c')]['id']),'tags':_0x149762||[]};});}})[_0x66a6('0x2a')](respondWithResult(_0x5172e8,null))[_0x66a6('0x2b')](handleError(_0x5172e8,null));};exports[_0x66a6('0x53')]=function(_0x1bf7e6,_0x5b4f5f){return db[_0x66a6('0x22')][_0x66a6('0x38')]({'where':{'id':_0x1bf7e6[_0x66a6('0x2c')]['id']}})[_0x66a6('0x2a')](handleEntityNotFound(_0x5b4f5f,null))[_0x66a6('0x2a')](function(_0x2ae239){if(_0x2ae239){return _0x2ae239[_0x66a6('0x53')](_0x1bf7e6['query'][_0x66a6('0x3e')]);}})[_0x66a6('0x2a')](respondWithStatusCode(_0x5b4f5f,null))['catch'](handleError(_0x5b4f5f,null));};exports[_0x66a6('0x54')]=function(_0x4d79ed,_0x21e7d8){var _0x5cf393=moment()[_0x66a6('0x55')]()[_0x66a6('0x56')]();var _0xb3471d=path['join'](config[_0x66a6('0x57')],'server',_0x66a6('0x58'),_0x66a6('0x59'));var _0x358227=path['join'](config[_0x66a6('0x57')],'server','files',_0x66a6('0x5a'));var _0x579d2e=path[_0x66a6('0x5b')](_0xb3471d,_0x5cf393);var _0x36e284=util['format']('transcript-%d-%s.zip',_0x4d79ed[_0x66a6('0x2c')]['id'],_0x5cf393);var _0x2d9033=path[_0x66a6('0x5b')](_0xb3471d,_0x36e284);var _0x1722d5=[];if(_0x4d79ed['query'][_0x66a6('0x5a')]){_0x1722d5[_0x66a6('0x5c')]({'model':db['Attachment'],'as':_0x66a6('0x5d'),'raw':!![]});}var _0x17d0b7=[{'model':db[_0x66a6('0x3d')],'as':_0x66a6('0x5e'),'attributes':['id',_0x66a6('0x3a'),_0x66a6('0x5f'),'to','cc',_0x66a6('0x60'),'subject',_0x66a6('0x61')],'where':{'secret':![]},'order':qs[_0x66a6('0x44')]('id'),'include':_0x1722d5}];return db['MailInteraction'][_0x66a6('0x38')]({'where':{'id':_0x4d79ed['params']['id']},'include':_0x17d0b7})[_0x66a6('0x2a')](handleEntityNotFound(_0x21e7d8,null))[_0x66a6('0x2a')](function(_0x5a84cf){if(_0x5a84cf&&_0x5a84cf[_0x66a6('0x5e')]){var _0xd40415=_0x5a84cf[_0x66a6('0x62')]({'plain':!![]});fs['mkdirSync'](_0x579d2e);return BPromise['each'](_0xd40415[_0x66a6('0x5e')],function(_0x42f049,_0x2f0dfb){var _0x5a2d95={'from':_0x42f049[_0x66a6('0x5f')],'to':_0x42f049['to']||'missing.recipient@your.company.com','subject':_0x42f049[_0x66a6('0x63')],'html':htmlEntities[_0x66a6('0x64')](_0x42f049['body']),'headers':{'Date':moment(_0x42f049[_0x66a6('0x61')])[_0x66a6('0x65')](_0x66a6('0x66'))},'attachments':[]};if(_0x42f049['cc']){_0x5a2d95[_0x66a6('0x67')]['Cc']=_0x42f049['cc'];}if(_0x42f049[_0x66a6('0x60')]){_0x5a2d95[_0x66a6('0x67')][_0x66a6('0x68')]=_0x42f049['bcc'];}return new BPromise(function(_0x42ce4c,_0x46790f){if(_0x42f049['Attachments']){for(var _0x3626d5=0x0;_0x3626d5<_0x42f049['Attachments'][_0x66a6('0x33')];_0x3626d5++){var _0x2b4e60=_0x42f049[_0x66a6('0x5d')][_0x3626d5];var _0x425169=path['join'](_0x358227,_0x2b4e60[_0x66a6('0x69')]);if(fs[_0x66a6('0x6a')](_0x425169)){_0x5a2d95[_0x66a6('0x5a')]['push']({'name':_0x2b4e60[_0x66a6('0x1e')],'contentType':_0x2b4e60[_0x66a6('0x6b')],'data':fs['readFileSync'](_0x425169)});}}}emlformat[_0x66a6('0x6c')](_0x5a2d95,function(_0x5dad98,_0x40ae21){if(_0x5dad98)return _0x46790f(_0x5dad98);fs['writeFileSync'](path['join'](_0x579d2e,util['format'](_0x66a6('0x6d'),_0x2f0dfb)),_0x40ae21);return _0x42ce4c(_0x40ae21);});});})['then'](function(){return new BPromise(function(_0x314e95,_0x381128){zipdir(_0x579d2e,{'saveTo':_0x2d9033},function(_0x2df947,_0x41139c){if(_0x2df947)return _0x381128(_0x2df947);return _0x314e95(_0x41139c);});})['then'](function(){return new BPromise(function(_0x286d3c,_0x4f8e75){rimraf(_0x579d2e,function(_0x53d232){if(_0x53d232)_0x4f8e75(_0x53d232);return _0x286d3c();});});})[_0x66a6('0x2a')](function(){return _0x21e7d8[_0x66a6('0x54')](_0x2d9033,_0x36e284,function(_0x3f77b0){if(!_0x3f77b0)fs[_0x66a6('0x6e')](_0x2d9033);});});});}else{return _0x21e7d8[_0x66a6('0x13')](0xc8);}})[_0x66a6('0x2b')](handleError(_0x21e7d8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 502d284..4ecc0c7 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 _0xd2eb=['length','emit','catch','hasOwnProperty','exports','events','MailInteraction','MailMessage','setMaxListeners','save','remove','then','Users','findAll','setDataValue','unreadMessages'];(function(_0x15da19,_0x4b5b10){var _0x3c2991=function(_0x3d68eb){while(--_0x3d68eb){_0x15da19['push'](_0x15da19['shift']());}};_0x3c2991(++_0x4b5b10);}(_0xd2eb,0x1b5));var _0xbd2e=function(_0x23f416,_0x42e777){_0x23f416=_0x23f416-0x0;var _0x14efe5=_0xd2eb[_0x23f416];return _0x14efe5;};'use strict';var EventEmitter=require(_0xbd2e('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbd2e('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xbd2e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbd2e('0x3')](0x0);var events={'afterCreate':_0xbd2e('0x4'),'afterUpdate':'update','afterDestroy':_0xbd2e('0x5')};function emitEvent(_0x284e99){return function(_0x3753dd,_0xb613f1,_0x554e5c){_0x3753dd['getUsers']({'attributes':['id'],'raw':!![]})[_0xbd2e('0x6')](function(_0x5086c2){_0x3753dd['setDataValue'](_0xbd2e('0x7'),_0x5086c2['map'](function(_0x54751e){return{'id':_0x54751e['id']};}));return MailMessage[_0xbd2e('0x8')]({'where':{'MailInteractionId':_0x3753dd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3732e7){_0x3753dd[_0xbd2e('0x9')](_0xbd2e('0xa'),_0x3732e7[_0xbd2e('0xb')]);MailInteractionEvents[_0xbd2e('0xc')](_0x284e99+':'+_0x3753dd['id'],_0x3753dd);MailInteractionEvents['emit'](_0x284e99,_0x3753dd);_0x554e5c(null);})[_0xbd2e('0xd')](_0x554e5c(null));};}for(var e in events){if(events[_0xbd2e('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xbd2e('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x0a93=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','events','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map'];(function(_0x3dc320,_0x51a587){var _0x5d8f4f=function(_0x2cd123){while(--_0x2cd123){_0x3dc320['push'](_0x3dc320['shift']());}};_0x5d8f4f(++_0x51a587);}(_0x0a93,0xf6));var _0x30a9=function(_0x44c827,_0x2be164){_0x44c827=_0x44c827-0x0;var _0x5dac1a=_0x0a93[_0x44c827];return _0x5dac1a;};'use strict';var EventEmitter=require(_0x30a9('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x30a9('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x30a9('0x2')](0x0);var events={'afterCreate':_0x30a9('0x3'),'afterUpdate':_0x30a9('0x4'),'afterDestroy':_0x30a9('0x5')};function emitEvent(_0x5927f2){return function(_0x2f330f,_0x8f3b05,_0x4088ae){_0x2f330f['getUsers']({'attributes':['id'],'raw':!![]})[_0x30a9('0x6')](function(_0x1bb400){_0x2f330f[_0x30a9('0x7')](_0x30a9('0x8'),_0x1bb400[_0x30a9('0x9')](function(_0x1201d3){return{'id':_0x1201d3['id']};}));return MailMessage[_0x30a9('0xa')]({'where':{'MailInteractionId':_0x2f330f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x344385){_0x2f330f[_0x30a9('0x7')](_0x30a9('0xb'),_0x344385[_0x30a9('0xc')]);MailInteractionEvents[_0x30a9('0xd')](_0x5927f2+':'+_0x2f330f['id'],_0x2f330f);MailInteractionEvents[_0x30a9('0xd')](_0x5927f2,_0x2f330f);_0x4088ae(null);})[_0x30a9('0xe')](_0x4088ae(null));};}for(var e in events){if(events[_0x30a9('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3cdc127..bd127d5 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 _0xd8c9=['./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xd8c9,0x1c3));var _0x9d8c=function(_0xf2b275,_0x62f1ff){_0xf2b275=_0xf2b275-0x0;var _0x3a7d9c=_0xd8c9[_0xf2b275];return _0x3a7d9c;};'use strict';var _=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var logger=require(_0x9d8c('0x2'))(_0x9d8c('0x3'));var moment=require('moment');var BPromise=require(_0x9d8c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d8c('0x5'));var rimraf=require(_0x9d8c('0x6'));var config=require(_0x9d8c('0x7'));var attributes=require(_0x9d8c('0x8'));module[_0x9d8c('0x9')]=function(_0x19a8f9,_0x33c258){return _0x19a8f9[_0x9d8c('0xa')]('MailInteraction',attributes,{'tableName':_0x9d8c('0xb'),'paranoid':![],'indexes':[{'name':_0x9d8c('0xc'),'fields':[_0x9d8c('0xd'),'to'],'type':_0x9d8c('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x214532,_0x31196c,_0x324692){if(_0x214532['substatus']){_0x214532[_0x9d8c('0xf')]=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));}if(_0x214532[_0x9d8c('0x12')]){_0x214532['closedAt']=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));}_0x324692(null,_0x31196c);},'beforeUpdate':function(_0x3d5bbc,_0x37d505,_0x2bd257){if(_0x3d5bbc[_0x9d8c('0x13')](_0x9d8c('0x14'))){_0x3d5bbc[_0x9d8c('0xf')]=_0x3d5bbc[_0x9d8c('0x14')]?moment()[_0x9d8c('0x10')](_0x9d8c('0x11')):null;}if(_0x3d5bbc[_0x9d8c('0x13')](_0x9d8c('0x12'))){_0x3d5bbc[_0x9d8c('0x15')]=moment()[_0x9d8c('0x10')](_0x9d8c('0x11'));_0x3d5bbc[_0x9d8c('0x14')]=null;_0x3d5bbc[_0x9d8c('0xf')]=null;}_0x2bd257(null,_0x3d5bbc);},'afterUpdate':function(_0x2932d7,_0x470bff,_0x159209){var _0x26d50e=_0x19a8f9['models'];var _0x4007f4=_0x2932d7['get']({'plain':!![]});if(_0x4007f4[_0x9d8c('0x12')]){return _0x26d50e['MailMessage'][_0x9d8c('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x4007f4['id']}})[_0x9d8c('0x17')](function(){_0x159209();})[_0x9d8c('0x18')](function(_0xf88700){_0x159209(_0xf88700);});}else{_0x159209();}}},'charset':_0x9d8c('0x19'),'collate':_0x9d8c('0x1a')});}; \ No newline at end of file +var _0x6ea9=['MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./mailInteraction.attributes','define'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0x6ea9,0xc8));var _0x96ea=function(_0xb4f87a,_0x426f4c){_0xb4f87a=_0xb4f87a-0x0;var _0x5eaa3a=_0x6ea9[_0xb4f87a];return _0x5eaa3a;};'use strict';var _=require(_0x96ea('0x0'));var util=require('util');var logger=require(_0x96ea('0x1'))('api');var moment=require(_0x96ea('0x2'));var BPromise=require('bluebird');var rp=require(_0x96ea('0x3'));var fs=require('fs');var path=require(_0x96ea('0x4'));var rimraf=require('rimraf');var config=require(_0x96ea('0x5'));var attributes=require(_0x96ea('0x6'));module['exports']=function(_0xc4bc66,_0xf4474f){return _0xc4bc66[_0x96ea('0x7')](_0x96ea('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x96ea('0x9'),'fields':[_0x96ea('0xa'),'to'],'type':_0x96ea('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x345441,_0x33e574,_0x3e589e){if(_0x345441[_0x96ea('0xc')]){_0x345441[_0x96ea('0xd')]=moment()[_0x96ea('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x345441[_0x96ea('0xf')]){_0x345441[_0x96ea('0x10')]=moment()['format'](_0x96ea('0x11'));}_0x3e589e(null,_0x33e574);},'beforeUpdate':function(_0x428ab6,_0x1c0144,_0x3f30ab){if(_0x428ab6[_0x96ea('0x12')](_0x96ea('0xc'))){_0x428ab6[_0x96ea('0xd')]=_0x428ab6['substatus']?moment()[_0x96ea('0xe')](_0x96ea('0x11')):null;}if(_0x428ab6[_0x96ea('0x12')](_0x96ea('0xf'))){_0x428ab6[_0x96ea('0x10')]=moment()[_0x96ea('0xe')](_0x96ea('0x11'));_0x428ab6[_0x96ea('0xc')]=null;_0x428ab6[_0x96ea('0xd')]=null;}_0x3f30ab(null,_0x428ab6);},'afterUpdate':function(_0x45de74,_0x4d10b9,_0x5b502e){var _0x43769e=_0xc4bc66[_0x96ea('0x13')];var _0x1c366f=_0x45de74['get']({'plain':!![]});if(_0x1c366f[_0x96ea('0xf')]){return _0x43769e[_0x96ea('0x14')][_0x96ea('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x1c366f['id']}})[_0x96ea('0x16')](function(){_0x5b502e();})[_0x96ea('0x17')](function(_0x33fa1b){_0x5b502e(_0x33fa1b);});}else{_0x5b502e();}}},'charset':_0x96ea('0x18'),'collate':_0x96ea('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 990f5d5..97c9987 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 _0x3a25=['attributes','AddTagsToMailInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a25,0x1f3));var _0x53a2=function(_0x77d5c0,_0x5b6dc6){_0x77d5c0=_0x77d5c0-0x0;var _0x46dd73=_0x3a25[_0x77d5c0];return _0x46dd73;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var rs=require(_0x53a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53a2('0x6'))(_0x53a2('0x7'));var config=require(_0x53a2('0x8'));var jayson=require(_0x53a2('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x53a2('0xa')]=_[_0x53a2('0xb')](config['redis'],{'host':_0x53a2('0xc'),'port':0x18eb});var socket=require(_0x53a2('0xd'))(new Redis(config[_0x53a2('0xa')]));require(_0x53a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x158700,_0x1400bd,_0x24054f){return new BPromise(function(_0x469538,_0x4c297b){return client[_0x53a2('0xf')](_0x158700,_0x24054f)[_0x53a2('0x10')](function(_0xec44ca){logger[_0x53a2('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1400bd,'request\x20sent');logger[_0x53a2('0x12')](_0x53a2('0x13'),_0x1400bd,_0x53a2('0x14'),JSON[_0x53a2('0x15')](_0xec44ca));if(_0xec44ca[_0x53a2('0x16')]){if(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x17')]===0x1f4){logger[_0x53a2('0x16')]('MailInteraction,\x20%s,\x20%s',_0x1400bd,_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);return _0x4c297b(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);}logger[_0x53a2('0x16')](_0x53a2('0x19'),_0x1400bd,_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);return _0x469538(_0xec44ca[_0x53a2('0x16')][_0x53a2('0x18')]);}else{logger[_0x53a2('0x11')](_0x53a2('0x19'),_0x1400bd,'request\x20sent');_0x469538(_0xec44ca['result'][_0x53a2('0x18')]);}})[_0x53a2('0x1a')](function(_0xb6888d){logger[_0x53a2('0x16')](_0x53a2('0x19'),_0x1400bd,_0xb6888d);_0x4c297b(_0xb6888d);});});}exports[_0x53a2('0x1b')]=function(_0x42e7d4){var _0xdb0e7b=this;return new Promise(function(_0x190eeb,_0x4b7b14){return db[_0x53a2('0x1c')][_0x53a2('0x1d')](_0x42e7d4[_0x53a2('0x1e')],{'raw':_0x42e7d4['options']?_0x42e7d4[_0x53a2('0x1f')][_0x53a2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42e7d4[_0x53a2('0x1f')]?_0x42e7d4[_0x53a2('0x1f')][_0x53a2('0x21')]||null:null,'attributes':_0x42e7d4['options']?_0x42e7d4['options'][_0x53a2('0x22')]||null:null,'limit':_0x42e7d4['options']?_0x42e7d4['options']['limit']||null:null})[_0x53a2('0x10')](function(_0x5d3674){logger[_0x53a2('0x11')]('UpdateMailInteraction',_0x42e7d4);logger[_0x53a2('0x12')](_0x53a2('0x1b'),_0x42e7d4,JSON['stringify'](_0x5d3674));_0x190eeb(_0x5d3674);})['catch'](function(_0x6b50eb){logger[_0x53a2('0x16')](_0x53a2('0x1b'),_0x6b50eb[_0x53a2('0x18')],_0x42e7d4);_0x4b7b14(_0xdb0e7b[_0x53a2('0x16')](0x1f4,_0x6b50eb[_0x53a2('0x18')]));});});};exports[_0x53a2('0x23')]=function(_0x1f28dc){return new Promise(function(_0xf258bd,_0x47152c){return db[_0x53a2('0x1c')][_0x53a2('0x24')]({'where':_0x1f28dc[_0x53a2('0x1f')]?_0x1f28dc[_0x53a2('0x1f')][_0x53a2('0x21')]||null:null})[_0x53a2('0x10')](function(_0x51717b){if(_0x51717b){return _0x51717b[_0x53a2('0x25')](_0x1f28dc[_0x53a2('0x1e')]['ids'],_[_0x53a2('0x26')](_0x1f28dc[_0x53a2('0x1e')],[_0x53a2('0x27'),'id'])||{});}})['spread'](function(_0x24db10){logger[_0x53a2('0x11')](_0x53a2('0x28'),_0x1f28dc);logger[_0x53a2('0x12')]('AddTags',_0x1f28dc,JSON[_0x53a2('0x15')](_0x24db10));_0xf258bd(_0x24db10);})[_0x53a2('0x1a')](function(_0x196f38){logger[_0x53a2('0x16')]('AddTags',_0x196f38[_0x53a2('0x18')],_0x1f28dc);_0x47152c(_this[_0x53a2('0x16')](0x1f4,_0x196f38[_0x53a2('0x18')]));});});}; \ No newline at end of file +var _0xe870=['request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x5c607f,_0x8ecda){var _0x41b277=function(_0xbb4174){while(--_0xbb4174){_0x5c607f['push'](_0x5c607f['shift']());}};_0x41b277(++_0x8ecda);}(_0xe870,0x91));var _0x0e87=function(_0x3074c3,_0x4523a9){_0x3074c3=_0x3074c3-0x0;var _0x50b9a2=_0xe870[_0x3074c3];return _0x50b9a2;};'use strict';var _=require('lodash');var util=require(_0x0e87('0x0'));var moment=require(_0x0e87('0x1'));var BPromise=require(_0x0e87('0x2'));var rs=require(_0x0e87('0x3'));var fs=require('fs');var Redis=require(_0x0e87('0x4'));var db=require(_0x0e87('0x5'))['db'];var utils=require(_0x0e87('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0e87('0x7'));var jayson=require(_0x0e87('0x8'));var client=jayson[_0x0e87('0x9')]['http']({'port':0x232a});config[_0x0e87('0xa')]=_[_0x0e87('0xb')](config[_0x0e87('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e87('0xc'))(new Redis(config[_0x0e87('0xa')]));require(_0x0e87('0xd'))[_0x0e87('0xe')](socket);function respondWithRpcPromise(_0x2c85c1,_0x56fa9c,_0x4f0560){return new BPromise(function(_0x720331,_0x231df0){return client[_0x0e87('0xf')](_0x2c85c1,_0x4f0560)[_0x0e87('0x10')](function(_0x50635d){logger['info'](_0x0e87('0x11'),_0x56fa9c,_0x0e87('0x12'));logger[_0x0e87('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x56fa9c,'request\x20sent',JSON[_0x0e87('0x14')](_0x50635d));if(_0x50635d['error']){if(_0x50635d[_0x0e87('0x15')][_0x0e87('0x16')]===0x1f4){logger[_0x0e87('0x15')](_0x0e87('0x11'),_0x56fa9c,_0x50635d[_0x0e87('0x15')][_0x0e87('0x17')]);return _0x231df0(_0x50635d[_0x0e87('0x15')][_0x0e87('0x17')]);}logger['error'](_0x0e87('0x11'),_0x56fa9c,_0x50635d[_0x0e87('0x15')][_0x0e87('0x17')]);return _0x720331(_0x50635d['error'][_0x0e87('0x17')]);}else{logger[_0x0e87('0x18')](_0x0e87('0x11'),_0x56fa9c,_0x0e87('0x12'));_0x720331(_0x50635d['result'][_0x0e87('0x17')]);}})[_0x0e87('0x19')](function(_0x473fd4){logger[_0x0e87('0x15')](_0x0e87('0x11'),_0x56fa9c,_0x473fd4);_0x231df0(_0x473fd4);});});}exports['UpdateMailInteraction']=function(_0xa1aeb){var _0x14d86f=this;return new Promise(function(_0x1a43f6,_0x4037f3){return db[_0x0e87('0x1a')]['update'](_0xa1aeb[_0x0e87('0x1b')],{'raw':_0xa1aeb[_0x0e87('0x1c')]?_0xa1aeb[_0x0e87('0x1c')][_0x0e87('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa1aeb[_0x0e87('0x1c')]?_0xa1aeb['options'][_0x0e87('0x1e')]||null:null,'attributes':_0xa1aeb[_0x0e87('0x1c')]?_0xa1aeb['options'][_0x0e87('0x1f')]||null:null,'limit':_0xa1aeb['options']?_0xa1aeb['options'][_0x0e87('0x20')]||null:null})[_0x0e87('0x10')](function(_0x550eda){logger[_0x0e87('0x18')](_0x0e87('0x21'),_0xa1aeb);logger['debug'](_0x0e87('0x21'),_0xa1aeb,JSON[_0x0e87('0x14')](_0x550eda));_0x1a43f6(_0x550eda);})[_0x0e87('0x19')](function(_0x243163){logger[_0x0e87('0x15')]('UpdateMailInteraction',_0x243163[_0x0e87('0x17')],_0xa1aeb);_0x4037f3(_0x14d86f[_0x0e87('0x15')](0x1f4,_0x243163['message']));});});};exports[_0x0e87('0x22')]=function(_0xb5e6b6){return new Promise(function(_0xe8bc52,_0x4c1fb7){return db[_0x0e87('0x1a')][_0x0e87('0x23')]({'where':_0xb5e6b6[_0x0e87('0x1c')]?_0xb5e6b6['options'][_0x0e87('0x1e')]||null:null})[_0x0e87('0x10')](function(_0x47bb9d){if(_0x47bb9d){return _0x47bb9d['addTags'](_0xb5e6b6[_0x0e87('0x1b')]['ids'],_[_0x0e87('0x24')](_0xb5e6b6[_0x0e87('0x1b')],[_0x0e87('0x25'),'id'])||{});}})[_0x0e87('0x26')](function(_0x49c908){logger['info'](_0x0e87('0x27'),_0xb5e6b6);logger[_0x0e87('0x13')](_0x0e87('0x27'),_0xb5e6b6,JSON[_0x0e87('0x14')](_0x49c908));_0xe8bc52(_0x49c908);})[_0x0e87('0x19')](function(_0xb2e945){logger[_0x0e87('0x15')](_0x0e87('0x27'),_0xb2e945[_0x0e87('0x17')],_0xb5e6b6);_0x4c1fb7(_this['error'](0x1f4,_0xb2e945[_0x0e87('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6c5e281..de8c309 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 _0x6f6b=['register','mailInteraction:','./mailInteraction.events','save','update','emit'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x6f6b,0x10a));var _0xb6f6=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0x6f6b[_0x1cb931];return _0x1ef86b;};'use strict';var MailInteractionEvents=require(_0xb6f6('0x0'));var events=[_0xb6f6('0x1'),'remove',_0xb6f6('0x2')];function createListener(_0x1b55c9,_0x21a795){return function(_0x2ace6c){_0x21a795[_0xb6f6('0x3')](_0x1b55c9,_0x2ace6c);};}function removeListener(_0x3df0ee,_0x38a10a){return function(){MailInteractionEvents['removeListener'](_0x3df0ee,_0x38a10a);};}exports[_0xb6f6('0x4')]=function(_0x3acad1){for(var _0xcf833d=0x0,_0x38bed8=events['length'];_0xcf833d<_0x38bed8;_0xcf833d++){var _0x413039=events[_0xcf833d];var _0x1967ff=createListener(_0xb6f6('0x5')+_0x413039,_0x3acad1);MailInteractionEvents['on'](_0x413039,_0x1967ff);}}; \ No newline at end of file +var _0xad74=['emit','removeListener','length','save','remove','update'];(function(_0x1eff83,_0x598a1c){var _0x20f2fa=function(_0x25a530){while(--_0x25a530){_0x1eff83['push'](_0x1eff83['shift']());}};_0x20f2fa(++_0x598a1c);}(_0xad74,0x93));var _0x4ad7=function(_0x41216a,_0x53e83d){_0x41216a=_0x41216a-0x0;var _0x122cf1=_0xad74[_0x41216a];return _0x122cf1;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x4ad7('0x0'),_0x4ad7('0x1'),_0x4ad7('0x2')];function createListener(_0x1aab5a,_0xa0a696){return function(_0x15fd05){_0xa0a696[_0x4ad7('0x3')](_0x1aab5a,_0x15fd05);};}function removeListener(_0x5df775,_0x2cb1a0){return function(){MailInteractionEvents[_0x4ad7('0x4')](_0x5df775,_0x2cb1a0);};}exports['register']=function(_0x4d9ae3){for(var _0x59783d=0x0,_0x1b3cf0=events[_0x4ad7('0x5')];_0x59783d<_0x1b3cf0;_0x59783d++){var _0x262782=events[_0x59783d];var _0x41d0f9=createListener('mailInteraction:'+_0x262782,_0x4d9ae3);MailInteractionEvents['on'](_0x262782,_0x41d0f9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9ba277d..a118194 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 _0x70f9=['express','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','show','/:id/download','download','post','tracked','mail','create','update','put','/:id/reject','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x70f9,0x14e));var _0x970f=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0x70f9[_0x21d0c3];return _0x4df18e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x970f('0x0'));var timeout=require(_0x970f('0x1'));var express=require(_0x970f('0x2'));var router=express['Router']();var fs_extra=require(_0x970f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x970f('0x4'));var config=require('../../config/environment');var controller=require(_0x970f('0x5'));router[_0x970f('0x6')]('/',auth[_0x970f('0x7')](),controller['index']);router[_0x970f('0x6')](_0x970f('0x8'),auth[_0x970f('0x7')](),controller[_0x970f('0x9')]);router[_0x970f('0x6')]('/:id',auth[_0x970f('0x7')](),controller[_0x970f('0xa')]);router[_0x970f('0x6')](_0x970f('0xb'),auth[_0x970f('0x7')](),controller[_0x970f('0xc')]);router[_0x970f('0xd')]('/',auth[_0x970f('0x7')](),interaction[_0x970f('0xe')](_0x970f('0xf'),'mailmessage:create'),controller[_0x970f('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x970f('0x11')]);router[_0x970f('0x12')]('/:id/accept',auth[_0x970f('0x7')](),controller['accept']);router['put'](_0x970f('0x13'),auth[_0x970f('0x7')](),controller['reject']);router[_0x970f('0x14')](_0x970f('0x15'),auth[_0x970f('0x7')](),controller[_0x970f('0x16')]);module[_0x970f('0x17')]=router; \ No newline at end of file +var _0x16e3=['multer','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','index','/describe','describe','/:id','/:id/download','isAuthenticated','post','mail','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x16e3,0x168));var _0x316e=function(_0x3a128a,_0x23fab8){_0x3a128a=_0x3a128a-0x0;var _0x2bf3cf=_0x16e3[_0x3a128a];return _0x2bf3cf;};'use strict';var multer=require(_0x316e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x316e('0x1'));var express=require('express');var router=express[_0x316e('0x2')]();var fs_extra=require(_0x316e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x316e('0x4'));var config=require('../../config/environment');var controller=require(_0x316e('0x5'));router[_0x316e('0x6')]('/',auth['isAuthenticated'](),controller[_0x316e('0x7')]);router['get'](_0x316e('0x8'),auth['isAuthenticated'](),controller[_0x316e('0x9')]);router['get'](_0x316e('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x316e('0xb'),auth[_0x316e('0xc')](),controller['download']);router[_0x316e('0xd')]('/',auth[_0x316e('0xc')](),interaction['tracked'](_0x316e('0xe'),'mailmessage:create'),controller['create']);router[_0x316e('0xf')](_0x316e('0xa'),auth[_0x316e('0xc')](),controller[_0x316e('0x10')]);router['put'](_0x316e('0x11'),auth['isAuthenticated'](),controller[_0x316e('0x12')]);router[_0x316e('0xf')](_0x316e('0x13'),auth['isAuthenticated'](),controller[_0x316e('0x14')]);router[_0x316e('0x15')](_0x316e('0xa'),auth['isAuthenticated'](),controller[_0x316e('0x16')]);module[_0x316e('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9d34405..bb322b9 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 _0x9d5c=['Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x3f4ba6,_0x133cd6){var _0x4fa5a3=function(_0x136d8b){while(--_0x136d8b){_0x3f4ba6['push'](_0x3f4ba6['shift']());}};_0x4fa5a3(++_0x133cd6);}(_0x9d5c,0x153));var _0xc9d5=function(_0x2600a6,_0x11f32c){_0x2600a6=_0x2600a6-0x0;var _0x99f4bc=_0x9d5c[_0x2600a6];return _0x99f4bc;};'use strict';var Sequelize=require(_0xc9d5('0x0'));var _=require(_0xc9d5('0x1'));module[_0xc9d5('0x2')]={'body':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9d5('0x6')]('in','out'),'defaultValue':_0xc9d5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc9d5('0x8')](0x1fe)},'from':{'type':Sequelize[_0xc9d5('0x8')]},'to':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'cc':{'type':Sequelize[_0xc9d5('0x3')]('long')},'bcc':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'subject':{'type':Sequelize[_0xc9d5('0x3')]},'sentAt':{'type':Sequelize[_0xc9d5('0x9')]},'attach':{'type':Sequelize[_0xc9d5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc9d5('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc9d5('0x9')]},'originTo':{'type':Sequelize[_0xc9d5('0x3')](_0xc9d5('0x4'))},'originCc':{'type':Sequelize[_0xc9d5('0x3')]('long')},'originChannel':{'type':Sequelize[_0xc9d5('0x6')]('Email',_0xc9d5('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x65c9=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT','long'];(function(_0x2a7e50,_0x387c32){var _0x487907=function(_0x5ec4de){while(--_0x5ec4de){_0x2a7e50['push'](_0x2a7e50['shift']());}};_0x487907(++_0x387c32);}(_0x65c9,0x182));var _0x965c=function(_0x1ef1b6,_0x253a13){_0x1ef1b6=_0x1ef1b6-0x0;var _0x14852b=_0x65c9[_0x1ef1b6];return _0x14852b;};'use strict';var Sequelize=require(_0x965c('0x0'));var _=require(_0x965c('0x1'));module['exports']={'body':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x4'))},'read':{'type':Sequelize[_0x965c('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x965c('0x6')]('in',_0x965c('0x7')),'defaultValue':_0x965c('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x965c('0x8')](0x1fe)},'from':{'type':Sequelize[_0x965c('0x8')]},'to':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x965c('0x3'))},'bcc':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x3'))},'subject':{'type':Sequelize[_0x965c('0x2')]},'sentAt':{'type':Sequelize[_0x965c('0x9')]},'attach':{'type':Sequelize[_0x965c('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x965c('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x3'))},'originCc':{'type':Sequelize[_0x965c('0x2')](_0x965c('0x3'))},'originChannel':{'type':Sequelize[_0x965c('0x6')](_0x965c('0xb'),_0x965c('0xc')),'defaultValue':_0x965c('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 43f46c2..e9cbf5c 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 _0x4f09=['body','find','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','internal','interface','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','download','toString','files','join','server','from','bcc','Attachment','decode','createdAt','headers','Attachments','existsSync','push','readFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','jayson/promise','client','http','request','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','count','limit','Content-Range','json','then','sendStatus','name','send','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','keys','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4f09,0x175));var _0x94f0=function(_0x23e3eb,_0x419ae8){_0x23e3eb=_0x23e3eb-0x0;var _0x1c9ab6=_0x4f09[_0x23e3eb];return _0x1c9ab6;};'use strict';var emlformat=require('eml-format');var moment=require(_0x94f0('0x0'));var BPromise=require(_0x94f0('0x1'));var util=require(_0x94f0('0x2'));var path=require(_0x94f0('0x3'));var fs=require('fs');var _=require(_0x94f0('0x4'));var Redis=require(_0x94f0('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x94f0('0x6'));var logger=require(_0x94f0('0x7'))(_0x94f0('0x8'));var interaction_log=require(_0x94f0('0x7'))('mail-interactions');var config=require(_0x94f0('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x94f0('0xa')](config['redis'],{'host':_0x94f0('0xb'),'port':0x18eb});var socket=require(_0x94f0('0xc'))(new Redis(config[_0x94f0('0xd')]));var htmlEntities=require(_0x94f0('0xe'));require(_0x94f0('0xf'))['register'](socket);var jayson=require(_0x94f0('0x10'));var client=jayson[_0x94f0('0x11')][_0x94f0('0x12')]({'port':0x232c});var client9003=jayson[_0x94f0('0x11')]['http']({'port':0x232b});var client9002=jayson[_0x94f0('0x11')][_0x94f0('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x210cf0,_0x5137b6,_0x3ac01d,_0x1da15e){return new BPromise(function(_0x2842c5,_0x1b2c2d){var _0x532d88=_0x1da15e||client;return _0x532d88[_0x94f0('0x13')](_0x210cf0,_0x3ac01d)['then'](function(_0x4d0c59){logger[_0x94f0('0x14')]('MailMessage,\x20%s,\x20%s',_0x5137b6,'request\x20sent');logger[_0x94f0('0x15')](_0x94f0('0x16'),_0x5137b6,_0x94f0('0x17'),JSON[_0x94f0('0x18')](_0x4d0c59));if(_0x4d0c59[_0x94f0('0x19')]){if(_0x4d0c59['error'][_0x94f0('0x1a')]===0x1f4){logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4d0c59[_0x94f0('0x19')][_0x94f0('0x1c')]);return _0x1b2c2d(_0x4d0c59[_0x94f0('0x19')][_0x94f0('0x1c')]);}logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4d0c59[_0x94f0('0x19')]['message']);return _0x2842c5(_0x4d0c59[_0x94f0('0x19')]['message']);}else{logger[_0x94f0('0x14')]('MailMessage,\x20%s,\x20%s',_0x5137b6,'request\x20sent');_0x2842c5(_0x4d0c59[_0x94f0('0x1d')][_0x94f0('0x1c')]);}})[_0x94f0('0x1e')](function(_0x4357e9){logger[_0x94f0('0x19')](_0x94f0('0x1b'),_0x5137b6,_0x4357e9);_0x1b2c2d(_0x4357e9);});});}function respondWithResult(_0x46931e,_0x17e3d3){_0x17e3d3=_0x17e3d3||0xc8;return function(_0x3e8d44){if(_0x3e8d44){return _0x46931e[_0x94f0('0x1f')](_0x17e3d3)['json'](_0x3e8d44);}};}function respondWithFilteredResult(_0x3d6339,_0x1004a7){return function(_0x6d7875){if(_0x6d7875){var _0x2bcd5b=typeof _0x1004a7[_0x94f0('0x20')]===_0x94f0('0x21')&&typeof _0x1004a7['limit']===_0x94f0('0x21');var _0x330bcd=_0x6d7875[_0x94f0('0x22')];var _0x53fb90=_0x2bcd5b?0x0:_0x1004a7[_0x94f0('0x20')];var _0x4cd201=_0x2bcd5b?_0x6d7875[_0x94f0('0x22')]:_0x1004a7[_0x94f0('0x20')]+_0x1004a7[_0x94f0('0x23')];var _0x576968;if(_0x4cd201>=_0x330bcd){_0x4cd201=_0x330bcd;_0x576968=0xc8;}else{_0x576968=0xce;}_0x3d6339[_0x94f0('0x1f')](_0x576968);return _0x3d6339['set'](_0x94f0('0x24'),_0x53fb90+'-'+_0x4cd201+'/'+_0x330bcd)[_0x94f0('0x25')](_0x6d7875);}return null;};}function saveUpdates(_0x4e38e3){return function(_0x4d0bde){if(_0x4d0bde){return _0x4d0bde['update'](_0x4e38e3)[_0x94f0('0x26')](function(_0x2a7fa4){return _0x2a7fa4;});}return null;};}function removeEntity(_0x468d36){return function(_0xaa1861){if(_0xaa1861){return _0xaa1861['destroy']()[_0x94f0('0x26')](function(){_0x468d36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4699a6){return function(_0x3146c6){if(!_0x3146c6){_0x4699a6[_0x94f0('0x27')](0x194);}return _0x3146c6;};}function handleError(_0x54e58c,_0x12f4ec){_0x12f4ec=_0x12f4ec||0x1f4;return function(_0x4fbaee){logger[_0x94f0('0x19')](_0x4fbaee['stack']);if(_0x4fbaee[_0x94f0('0x28')]){delete _0x4fbaee[_0x94f0('0x28')];}_0x54e58c['status'](_0x12f4ec)[_0x94f0('0x29')](_0x4fbaee);};}exports['index']=function(_0x280839,_0x48b5ec){var _0x4c5513={},_0x5d8c63={},_0xfd1c19={'count':0x0,'rows':[]};var _0x55b211=_[_0x94f0('0x2a')](db[_0x94f0('0x2b')][_0x94f0('0x2c')],function(_0x122b05){return{'name':_0x122b05['fieldName'],'type':_0x122b05[_0x94f0('0x2d')]['key']};});_0x5d8c63[_0x94f0('0x2e')]=_[_0x94f0('0x2a')](_0x55b211,_0x94f0('0x28'));_0x5d8c63[_0x94f0('0x2f')]=_['keys'](_0x280839[_0x94f0('0x2f')]);_0x5d8c63[_0x94f0('0x30')]=_[_0x94f0('0x31')](_0x5d8c63['model'],_0x5d8c63['query']);_0x4c5513[_0x94f0('0x32')]=_['intersection'](_0x5d8c63['model'],qs[_0x94f0('0x33')](_0x280839[_0x94f0('0x2f')][_0x94f0('0x33')]));_0x4c5513[_0x94f0('0x32')]=_0x4c5513[_0x94f0('0x32')][_0x94f0('0x34')]?_0x4c5513['attributes']:_0x5d8c63[_0x94f0('0x2e')];if(!_0x280839[_0x94f0('0x2f')][_0x94f0('0x35')](_0x94f0('0x36'))){_0x4c5513['limit']=qs[_0x94f0('0x23')](_0x280839[_0x94f0('0x2f')][_0x94f0('0x23')]);_0x4c5513[_0x94f0('0x20')]=qs[_0x94f0('0x20')](_0x280839[_0x94f0('0x2f')]['offset']);}_0x4c5513['order']=qs[_0x94f0('0x37')](_0x280839['query']['sort']);_0x4c5513[_0x94f0('0x38')]=qs[_0x94f0('0x30')](_[_0x94f0('0x39')](_0x280839[_0x94f0('0x2f')],_0x5d8c63[_0x94f0('0x30')]),_0x55b211);if(_0x280839['query'][_0x94f0('0x3a')]){_0x4c5513[_0x94f0('0x38')]=_[_0x94f0('0x3b')](_0x4c5513['where'],{'$or':_[_0x94f0('0x2a')](_0x55b211,function(_0x457554){if(_0x457554[_0x94f0('0x2d')]!=='VIRTUAL'){var _0x549b46={};_0x549b46[_0x457554['name']]={'$like':'%'+_0x280839[_0x94f0('0x2f')]['filter']+'%'};return _0x549b46;}})});}_0x4c5513=_[_0x94f0('0x3b')]({},_0x4c5513,_0x280839[_0x94f0('0x3c')]);var _0x364afa={'where':_0x4c5513[_0x94f0('0x38')]};return db['MailMessage'][_0x94f0('0x22')](_0x364afa)[_0x94f0('0x26')](function(_0x4cc399){_0xfd1c19[_0x94f0('0x22')]=_0x4cc399;if(_0x280839['query'][_0x94f0('0x3d')]){_0x4c5513[_0x94f0('0x3e')]=[{'all':!![]}];}return db[_0x94f0('0x2b')]['findAll'](_0x4c5513);})[_0x94f0('0x26')](function(_0x28e1ab){_0xfd1c19[_0x94f0('0x3f')]=_0x28e1ab;return _0xfd1c19;})['then'](respondWithFilteredResult(_0x48b5ec,_0x4c5513))[_0x94f0('0x1e')](handleError(_0x48b5ec,null));};exports[_0x94f0('0x40')]=function(_0x1011cd,_0xf10c6a){var _0x3f040e={'raw':!![],'where':{'id':_0x1011cd[_0x94f0('0x41')]['id']}},_0x235f88={};_0x235f88[_0x94f0('0x2e')]=_['keys'](db['MailMessage'][_0x94f0('0x2c')]);_0x235f88[_0x94f0('0x2f')]=_[_0x94f0('0x42')](_0x1011cd['query']);_0x235f88[_0x94f0('0x30')]=_['intersection'](_0x235f88['model'],_0x235f88['query']);_0x3f040e[_0x94f0('0x32')]=_[_0x94f0('0x31')](_0x235f88[_0x94f0('0x2e')],qs['fields'](_0x1011cd[_0x94f0('0x2f')][_0x94f0('0x33')]));_0x3f040e[_0x94f0('0x32')]=_0x3f040e[_0x94f0('0x32')]['length']?_0x3f040e[_0x94f0('0x32')]:_0x235f88['model'];if(_0x1011cd[_0x94f0('0x2f')][_0x94f0('0x3d')]){_0x3f040e[_0x94f0('0x3e')]=[{'all':!![]}];}_0x3f040e=_[_0x94f0('0x3b')]({},_0x3f040e,_0x1011cd[_0x94f0('0x3c')]);return db['MailMessage']['find'](_0x3f040e)[_0x94f0('0x26')](handleEntityNotFound(_0xf10c6a,null))[_0x94f0('0x26')](respondWithResult(_0xf10c6a,null))[_0x94f0('0x1e')](handleError(_0xf10c6a,null));};exports[_0x94f0('0x43')]=function(_0x281155,_0x25aa64){if(_0x281155[_0x94f0('0x44')]['id']){delete _0x281155['body']['id'];}return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x281155[_0x94f0('0x41')]['id']}})[_0x94f0('0x26')](handleEntityNotFound(_0x25aa64,null))[_0x94f0('0x26')](saveUpdates(_0x281155[_0x94f0('0x44')],null))['then'](respondWithResult(_0x25aa64,null))[_0x94f0('0x1e')](handleError(_0x25aa64,null));};exports[_0x94f0('0x46')]=function(_0x10a223,_0x5f1f3a){return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x10a223[_0x94f0('0x41')]['id']}})[_0x94f0('0x26')](handleEntityNotFound(_0x5f1f3a,null))[_0x94f0('0x26')](removeEntity(_0x5f1f3a,null))['catch'](handleError(_0x5f1f3a,null));};exports[_0x94f0('0x47')]=function(_0x5c3e9b,_0x29a11e){return db[_0x94f0('0x2b')][_0x94f0('0x47')]()[_0x94f0('0x26')](respondWithResult(_0x29a11e,null))[_0x94f0('0x1e')](handleError(_0x29a11e,null));};exports[_0x94f0('0x48')]=function(_0x545211,_0x527372){return db['MailMessage'][_0x94f0('0x48')](_0x545211['body'])[_0x94f0('0x26')](function(_0x49ddeb){if(_0x49ddeb){if(_0x49ddeb[_0x94f0('0x49')]===_0x94f0('0x4a')&&!_0x49ddeb[_0x94f0('0x4b')]){var _0x32a700,_0x11aea1,_0x2b3b9d;if(_0x545211[_0x94f0('0x44')]['to']){_0x11aea1=_0x545211[_0x94f0('0x44')]['to'][_0x94f0('0x4c')](',')[0x0];}return db[_0x94f0('0x4d')][_0x94f0('0x4e')]({'where':{'id':_0x49ddeb[_0x94f0('0x4f')]},'include':[{'model':db[_0x94f0('0x50')],'as':_0x94f0('0x51'),'include':[{'model':db[_0x94f0('0x52')],'as':_0x94f0('0x53'),'where':{'email':_0x11aea1},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x94f0('0x54')],'as':_0x94f0('0x55'),'raw':!![],'include':[{'model':db[_0x94f0('0x56')],'as':_0x94f0('0x56'),'raw':!![]}]}]})['then'](function(_0x3f136d){_0x32a700=_0x3f136d;if(!_0x32a700||!_0x32a700[_0x94f0('0x55')])return;var _0x2ce0c9=_0x32a700[_0x94f0('0x57')]();if(_0x545211[_0x94f0('0x44')][_0x94f0('0x58')]&&_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0x94f0('0x34')]){for(var _0xd48fe7=0x0;_0xd48fe7<_0x545211[_0x94f0('0x44')][_0x94f0('0x58')]['length'];_0xd48fe7+=0x1){_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0xd48fe7]={'filename':_0x545211[_0x94f0('0x44')][_0x94f0('0x58')][_0xd48fe7]['name'],'path':path['join'](config[_0x94f0('0x59')],_0x94f0('0x5a'),_0x545211['body'][_0x94f0('0x58')][_0xd48fe7][_0x94f0('0x5b')])};}}_0x2b3b9d={'account':_0x2ce0c9,'message':_0x545211[_0x94f0('0x44')]};return;})[_0x94f0('0x26')](function(){if(_0x32a700[_0x94f0('0x51')]){if(_0x32a700[_0x94f0('0x51')][_0x94f0('0x53')]['length']){return _0x32a700[_0x94f0('0x51')]['Contacts'][0x0];}else{return db[_0x94f0('0x52')][_0x94f0('0x48')](_[_0x94f0('0xa')](_0x545211['body'],{'firstName':_0x545211[_0x94f0('0x44')]['to'],'email':_0x545211['body']['to'],'phone':_0x545211[_0x94f0('0x44')]['to'],'ListId':_0x32a700['ListId']}));}}else{throw new Error(_0x94f0('0x5c'));}})[_0x94f0('0x26')](function(){if(_0x2b3b9d){return respondWithRpcPromise(_0x94f0('0x5d'),_0x94f0('0x5e'),_0x2b3b9d,client9003)[_0x94f0('0x26')](function(_0x2332f5){return _0x49ddeb[_0x94f0('0x43')]({'read':!![],'messageId':_0x2332f5[_0x94f0('0x5f')],'sentAt':moment()[_0x94f0('0x60')](_0x94f0('0x61'))});})[_0x94f0('0x1e')](function(_0xd0d3b9){logger[_0x94f0('0x19')]('%s',JSON[_0x94f0('0x18')](_0xd0d3b9));return _0x49ddeb;});}return _0x49ddeb;});}return _0x49ddeb;}})[_0x94f0('0x26')](respondWithResult(_0x527372,0xc9))['catch'](handleError(_0x527372,null));};exports['accept']=function(_0x1564b7,_0x43e146){var _0x5f4b81={'agent':{},'channel':'mail'};if(_0x1564b7[_0x94f0('0x44')]['id']){delete _0x1564b7[_0x94f0('0x44')]['id'];}_0x1564b7[_0x94f0('0x44')][_0x94f0('0x62')]=!![];_0x1564b7[_0x94f0('0x44')]['readAt']=moment()[_0x94f0('0x60')](_0x94f0('0x61'));_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')]=_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')]||_0x1564b7[_0x94f0('0x64')]['id'];_0x5f4b81[_0x94f0('0x65')]['id']=_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')];return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x1564b7[_0x94f0('0x41')]['id'],'UserId':null}})[_0x94f0('0x26')](handleEntityNotFound(_0x43e146,null))['then'](saveUpdates(_0x1564b7['body'],null))[_0x94f0('0x26')](function(_0x309af5){if(_0x309af5){_0x5f4b81[_0x94f0('0x1c')]=_0x309af5['get']({'plain':!![]});return db[_0x94f0('0x66')][_0x94f0('0x45')]({'where':{'id':_0x309af5[_0x94f0('0x67')]}});}return null;})[_0x94f0('0x26')](handleEntityNotFound(_0x43e146,null))['then'](function(_0x27094e){if(_0x27094e){return _0x27094e['update']({'UserId':_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')],'read1stAt':_[_0x94f0('0x68')](_0x27094e[_0x94f0('0x69')])?moment()[_0x94f0('0x60')](_0x94f0('0x61')):undefined});}return null;})['then'](function(_0x694a93){if(_0x694a93){_0x5f4b81[_0x94f0('0x6a')]=_0x694a93[_0x94f0('0x6b')]({'plain':!![]});interaction_log['info'](_0x94f0('0x6c'),_0x1564b7[_0x94f0('0x64')]['id'],_0x1564b7[_0x94f0('0x64')]['name'],_0x1564b7['user'][_0x94f0('0x6d')],_0x5f4b81[_0x94f0('0x6a')]['id'],_0x1564b7[_0x94f0('0x44')]?JSON[_0x94f0('0x18')](_0x1564b7[_0x94f0('0x44')]):'null');return respondWithRpcPromise(_0x94f0('0x6e'),_0x94f0('0x6f'),_0x5f4b81);}return null;})['then'](function(_0x1dc784){var _0x294bcf=_0x94f0('0x70')+_0x1dc784[_0x94f0('0x1c')]['ContactId'];return db[_0x94f0('0x71')][_0x94f0('0x2f')](_0x294bcf,{'type':db['Sequelize'][_0x94f0('0x72')]['SELECT'],'raw':!![]})[_0x94f0('0x26')](function(_0x420ccf){return _0x420ccf;});})[_0x94f0('0x26')](function(_0x5bcb5d){if(_0x5bcb5d){_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x73')]=_0x5bcb5d[0x0];if(!_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')])return;return db[_0x94f0('0x74')][_0x94f0('0x45')]({'where':{'id':_0x1564b7[_0x94f0('0x44')][_0x94f0('0x63')],'role':_0x94f0('0x65')},'attributes':['id',_0x94f0('0x28'),'fullname','email',_0x94f0('0x75')],'raw':!![]});}return null;})['then'](function(_0x5aefde){if(!_0x5aefde)return null;_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x65')]=_0x5aefde;return _0x5f4b81;})[_0x94f0('0x26')](function(_0x4aaaed){if(_0x4aaaed){if(_0x1564b7[_0x94f0('0x44')]['manual']){_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x76')]=util[_0x94f0('0x60')](_0x94f0('0x77'),_0x1564b7['user'][_0x94f0('0x28')]);_0x5f4b81['message']['channel']=_0x5f4b81[_0x94f0('0x78')];_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x79')]=_0x5f4b81[_0x94f0('0x78')];_0x5f4b81['message']['event']=_0x94f0('0x7a');_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x44')]=htmlToText[_0x94f0('0x7b')](_0x5f4b81[_0x94f0('0x1c')][_0x94f0('0x44')]);return respondWithRpcPromise(_0x94f0('0x7c'),_0x94f0('0x7c'),{'event':_0x94f0('0x7d'),'message':_0x5f4b81[_0x94f0('0x1c')]},client9002)['then'](function(){return _0x5f4b81;});}return _0x5f4b81;}return null;})[_0x94f0('0x26')](respondWithResult(_0x43e146,null))[_0x94f0('0x1e')](handleError(_0x43e146,null));};exports[_0x94f0('0x7e')]=function(_0x24c8ae,_0x36dc36){var _0xd927a3={'agent':{},'channel':_0x94f0('0x7f')};if(_0x24c8ae['body']['id']){delete _0x24c8ae[_0x94f0('0x44')]['id'];}_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')]=_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')]||_0x24c8ae[_0x94f0('0x64')]['id'];_0xd927a3['agent']['id']=_0x24c8ae[_0x94f0('0x44')][_0x94f0('0x63')];return db[_0x94f0('0x2b')]['find']({'where':{'id':_0x24c8ae[_0x94f0('0x41')]['id'],'UserId':null}})[_0x94f0('0x26')](handleEntityNotFound(_0x36dc36,null))[_0x94f0('0x26')](function(_0x128255){if(_0x128255){_0xd927a3['message']=_0x128255['get']({'plain':!![]});return db[_0x94f0('0x66')][_0x94f0('0x45')]({'where':{'id':_0x128255[_0x94f0('0x67')]}});}return null;})[_0x94f0('0x26')](handleEntityNotFound(_0x36dc36,null))[_0x94f0('0x26')](function(_0x2a53aa){if(_0x2a53aa){_0xd927a3[_0x94f0('0x6a')]=_0x2a53aa['get']({'plain':!![]});interaction_log[_0x94f0('0x14')](_0x94f0('0x80'),_0x24c8ae[_0x94f0('0x64')]['id'],_0x24c8ae[_0x94f0('0x64')][_0x94f0('0x28')],_0x24c8ae['user'][_0x94f0('0x6d')],_0xd927a3[_0x94f0('0x6a')]['id'],_0x24c8ae[_0x94f0('0x44')]?JSON['stringify'](_0x24c8ae[_0x94f0('0x44')]):'null');return respondWithRpcPromise('RejectMessage',_0x94f0('0x81'),_0xd927a3);}return null;})[_0x94f0('0x26')](function(_0x2458e0){var _0x11a157='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2458e0[_0x94f0('0x1c')]['ContactId'];return db[_0x94f0('0x71')][_0x94f0('0x2f')](_0x11a157,{'type':db['Sequelize'][_0x94f0('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x5a934c){return _0x5a934c;});})['then'](function(_0x443280){if(_0x443280){_0xd927a3[_0x94f0('0x1c')]['contact']=_0x443280[0x0];if(!_0x24c8ae['body'][_0x94f0('0x63')])return;return db['User'][_0x94f0('0x45')]({'where':{'id':_0x24c8ae['body'][_0x94f0('0x63')],'role':'agent'},'attributes':['id',_0x94f0('0x28'),'fullname',_0x94f0('0x82'),_0x94f0('0x75')],'raw':!![]});}return null;})['then'](function(_0x455a52){if(!_0x455a52)return null;_0xd927a3[_0x94f0('0x1c')][_0x94f0('0x65')]=_0x455a52;return _0xd927a3;})[_0x94f0('0x26')](function(_0x9bb6ea){if(_0x9bb6ea){_0x9bb6ea['message'][_0x94f0('0x76')]=util['format'](_0x94f0('0x77'),_0x24c8ae[_0x94f0('0x64')][_0x94f0('0x28')]);_0x9bb6ea[_0x94f0('0x1c')][_0x94f0('0x78')]=_0xd927a3[_0x94f0('0x78')];_0x9bb6ea['message'][_0x94f0('0x79')]=_0xd927a3[_0x94f0('0x78')];_0x9bb6ea[_0x94f0('0x1c')]['event']=_0x94f0('0x7e');_0x9bb6ea[_0x94f0('0x1c')][_0x94f0('0x44')]=htmlToText[_0x94f0('0x7b')](_0xd927a3['message'][_0x94f0('0x44')]);respondWithRpcPromise(_0x94f0('0x7c'),_0x94f0('0x7c'),{'event':'rejectmessage','message':_0x9bb6ea[_0x94f0('0x1c')]},client9002);return _0xd927a3;}return null;})[_0x94f0('0x26')](respondWithResult(_0x36dc36,null))['catch'](handleError(_0x36dc36,null));};exports[_0x94f0('0x83')]=function(_0x337b60,_0x3d1f9b){var _0x364c66=moment()['unix']()[_0x94f0('0x84')]();var _0x4808c9=path['join'](config[_0x94f0('0x59')],'server',_0x94f0('0x85'),'tmp');var _0x524d24=path[_0x94f0('0x86')](config['root'],_0x94f0('0x87'),'files',_0x94f0('0x58'));var _0x3f3b0e=util[_0x94f0('0x60')]('message-%s.eml',_0x364c66);return db[_0x94f0('0x2b')][_0x94f0('0x45')]({'where':{'id':_0x337b60['params']['id']},'attributes':['id','body',_0x94f0('0x88'),'to','cc',_0x94f0('0x89'),'subject','createdAt'],'include':_0x337b60[_0x94f0('0x2f')][_0x94f0('0x58')]?[{'model':db[_0x94f0('0x8a')],'as':'Attachments'}]:undefined})[_0x94f0('0x26')](handleEntityNotFound(_0x3d1f9b,null))[_0x94f0('0x26')](function(_0x486754){if(_0x486754){var _0x117810=_0x486754;var _0x29222a={'from':_0x117810[_0x94f0('0x88')],'to':_0x117810['to'],'subject':_0x117810['subject'],'html':htmlEntities[_0x94f0('0x8b')](_0x117810['body']),'headers':{'Date':moment(_0x117810[_0x94f0('0x8c')])[_0x94f0('0x60')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x486754['cc']){_0x29222a['headers']['Cc']=_0x486754['cc'];}if(_0x486754[_0x94f0('0x89')]){_0x29222a[_0x94f0('0x8d')]['Bcc']=_0x486754[_0x94f0('0x89')];}return new BPromise(function(_0x13727b,_0x424ba6){if(_0x486754[_0x94f0('0x8e')]){for(var _0x568557=0x0;_0x568557<_0x486754['Attachments']['length'];_0x568557++){var _0x4470a1=_0x486754[_0x94f0('0x8e')][_0x568557];var _0x631b1e=path[_0x94f0('0x86')](_0x524d24,_0x4470a1[_0x94f0('0x5b')]);if(fs[_0x94f0('0x8f')](_0x631b1e)){_0x29222a[_0x94f0('0x58')][_0x94f0('0x90')]({'name':_0x4470a1[_0x94f0('0x28')],'contentType':_0x4470a1[_0x94f0('0x2d')],'data':fs[_0x94f0('0x91')](_0x631b1e)});}}}emlformat['build'](_0x29222a,function(_0x30b46c,_0x5f4964){if(_0x30b46c)return _0x424ba6(_0x30b46c);fs['writeFileSync'](path[_0x94f0('0x86')](_0x4808c9,_0x3f3b0e),_0x5f4964);return _0x13727b(_0x5f4964);});});}})[_0x94f0('0x26')](function(_0x5130fa){if(_0x5130fa){return _0x3d1f9b['download'](path[_0x94f0('0x86')](_0x4808c9,_0x3f3b0e),_0x3f3b0e,function(_0x3a909b){if(!_0x3a909b)fs[_0x94f0('0x92')](path['join'](_0x4808c9,_0x3f3b0e));});}})['catch'](handleError(_0x3d1f9b,null));}; \ No newline at end of file +var _0x62cd=['localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','send','map','MailMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','includeAll','include','findAll','rows','show','keys','rawAttributes','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','CloudProvider','Smtp','attachments','length','root','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','channel','accept','EventManager','acceptmessage','reject','params','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','motionChannel','event','fromString','rejectmessage','download','unix','toString','server','files','tmp','join','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','headers','Attachments','existsSync','push','writeFileSync','unlinkSync','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x45d898,_0x1603ab){var _0x36a0fd=function(_0x44aef6){while(--_0x44aef6){_0x45d898['push'](_0x45d898['shift']());}};_0x36a0fd(++_0x1603ab);}(_0x62cd,0x133));var _0xd62c=function(_0x5ee5fe,_0x1a116f){_0x5ee5fe=_0x5ee5fe-0x0;var _0x198a98=_0x62cd[_0x5ee5fe];return _0x198a98;};'use strict';var emlformat=require('eml-format');var moment=require(_0xd62c('0x0'));var BPromise=require('bluebird');var util=require(_0xd62c('0x1'));var path=require(_0xd62c('0x2'));var fs=require('fs');var _=require(_0xd62c('0x3'));var Redis=require(_0xd62c('0x4'));var htmlToText=require(_0xd62c('0x5'));var qs=require(_0xd62c('0x6'));var logger=require(_0xd62c('0x7'))(_0xd62c('0x8'));var interaction_log=require(_0xd62c('0x7'))('mail-interactions');var config=require(_0xd62c('0x9'));var db=require(_0xd62c('0xa'))['db'];config[_0xd62c('0xb')]=_[_0xd62c('0xc')](config[_0xd62c('0xb')],{'host':_0xd62c('0xd'),'port':0x18eb});var socket=require(_0xd62c('0xe'))(new Redis(config[_0xd62c('0xb')]));var htmlEntities=require(_0xd62c('0xf'));require(_0xd62c('0x10'))[_0xd62c('0x11')](socket);var jayson=require(_0xd62c('0x12'));var client=jayson['client'][_0xd62c('0x13')]({'port':0x232c});var client9003=jayson[_0xd62c('0x14')][_0xd62c('0x13')]({'port':0x232b});var client9002=jayson[_0xd62c('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d82d8,_0x840411,_0x2de5a9,_0x5cb806){return new BPromise(function(_0x2bcceb,_0x2500c5){var _0x297a40=_0x5cb806||client;return _0x297a40[_0xd62c('0x15')](_0x2d82d8,_0x2de5a9)[_0xd62c('0x16')](function(_0x5ba909){logger['info']('MailMessage,\x20%s,\x20%s',_0x840411,_0xd62c('0x17'));logger[_0xd62c('0x18')](_0xd62c('0x19'),_0x840411,_0xd62c('0x17'),JSON[_0xd62c('0x1a')](_0x5ba909));if(_0x5ba909[_0xd62c('0x1b')]){if(_0x5ba909[_0xd62c('0x1b')]['code']===0x1f4){logger[_0xd62c('0x1b')](_0xd62c('0x1c'),_0x840411,_0x5ba909['error'][_0xd62c('0x1d')]);return _0x2500c5(_0x5ba909['error'][_0xd62c('0x1d')]);}logger[_0xd62c('0x1b')]('MailMessage,\x20%s,\x20%s',_0x840411,_0x5ba909['error'][_0xd62c('0x1d')]);return _0x2bcceb(_0x5ba909[_0xd62c('0x1b')]['message']);}else{logger[_0xd62c('0x1e')](_0xd62c('0x1c'),_0x840411,_0xd62c('0x17'));_0x2bcceb(_0x5ba909[_0xd62c('0x1f')][_0xd62c('0x1d')]);}})[_0xd62c('0x20')](function(_0x15766a){logger[_0xd62c('0x1b')](_0xd62c('0x1c'),_0x840411,_0x15766a);_0x2500c5(_0x15766a);});});}function respondWithResult(_0x1cc013,_0x526c76){_0x526c76=_0x526c76||0xc8;return function(_0x222150){if(_0x222150){return _0x1cc013[_0xd62c('0x21')](_0x526c76)[_0xd62c('0x22')](_0x222150);}};}function respondWithFilteredResult(_0xc1a113,_0x3de14a){return function(_0x265eca){if(_0x265eca){var _0xaed17b=typeof _0x3de14a[_0xd62c('0x23')]===_0xd62c('0x24')&&typeof _0x3de14a[_0xd62c('0x25')]===_0xd62c('0x24');var _0x77b6d1=_0x265eca[_0xd62c('0x26')];var _0x334058=_0xaed17b?0x0:_0x3de14a[_0xd62c('0x23')];var _0x1b2f9b=_0xaed17b?_0x265eca[_0xd62c('0x26')]:_0x3de14a[_0xd62c('0x23')]+_0x3de14a['limit'];var _0x16f18c;if(_0x1b2f9b>=_0x77b6d1){_0x1b2f9b=_0x77b6d1;_0x16f18c=0xc8;}else{_0x16f18c=0xce;}_0xc1a113[_0xd62c('0x21')](_0x16f18c);return _0xc1a113[_0xd62c('0x27')](_0xd62c('0x28'),_0x334058+'-'+_0x1b2f9b+'/'+_0x77b6d1)['json'](_0x265eca);}return null;};}function saveUpdates(_0x528278){return function(_0x384daf){if(_0x384daf){return _0x384daf[_0xd62c('0x29')](_0x528278)[_0xd62c('0x16')](function(_0x43a109){return _0x43a109;});}return null;};}function removeEntity(_0x29695e){return function(_0x1bb662){if(_0x1bb662){return _0x1bb662[_0xd62c('0x2a')]()[_0xd62c('0x16')](function(){_0x29695e[_0xd62c('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58ce9a){return function(_0x3f7e80){if(!_0x3f7e80){_0x58ce9a[_0xd62c('0x2b')](0x194);}return _0x3f7e80;};}function handleError(_0x1fdcac,_0x3d916d){_0x3d916d=_0x3d916d||0x1f4;return function(_0x5278f0){logger[_0xd62c('0x1b')](_0x5278f0[_0xd62c('0x2c')]);if(_0x5278f0[_0xd62c('0x2d')]){delete _0x5278f0[_0xd62c('0x2d')];}_0x1fdcac[_0xd62c('0x21')](_0x3d916d)[_0xd62c('0x2e')](_0x5278f0);};}exports['index']=function(_0x13d9d1,_0x21575e){var _0x170068={},_0x413b25={},_0x565a5f={'count':0x0,'rows':[]};var _0x79f1bf=_[_0xd62c('0x2f')](db[_0xd62c('0x30')]['rawAttributes'],function(_0x24b320){return{'name':_0x24b320[_0xd62c('0x31')],'type':_0x24b320[_0xd62c('0x32')][_0xd62c('0x33')]};});_0x413b25['model']=_[_0xd62c('0x2f')](_0x79f1bf,_0xd62c('0x2d'));_0x413b25[_0xd62c('0x34')]=_['keys'](_0x13d9d1[_0xd62c('0x34')]);_0x413b25[_0xd62c('0x35')]=_[_0xd62c('0x36')](_0x413b25[_0xd62c('0x37')],_0x413b25[_0xd62c('0x34')]);_0x170068[_0xd62c('0x38')]=_['intersection'](_0x413b25[_0xd62c('0x37')],qs['fields'](_0x13d9d1[_0xd62c('0x34')][_0xd62c('0x39')]));_0x170068[_0xd62c('0x38')]=_0x170068[_0xd62c('0x38')]['length']?_0x170068[_0xd62c('0x38')]:_0x413b25[_0xd62c('0x37')];if(!_0x13d9d1['query'][_0xd62c('0x3a')](_0xd62c('0x3b'))){_0x170068[_0xd62c('0x25')]=qs[_0xd62c('0x25')](_0x13d9d1[_0xd62c('0x34')][_0xd62c('0x25')]);_0x170068['offset']=qs[_0xd62c('0x23')](_0x13d9d1['query'][_0xd62c('0x23')]);}_0x170068['order']=qs['sort'](_0x13d9d1[_0xd62c('0x34')][_0xd62c('0x3c')]);_0x170068[_0xd62c('0x3d')]=qs[_0xd62c('0x35')](_[_0xd62c('0x3e')](_0x13d9d1[_0xd62c('0x34')],_0x413b25[_0xd62c('0x35')]),_0x79f1bf);if(_0x13d9d1[_0xd62c('0x34')]['filter']){_0x170068[_0xd62c('0x3d')]=_[_0xd62c('0x3f')](_0x170068[_0xd62c('0x3d')],{'$or':_[_0xd62c('0x2f')](_0x79f1bf,function(_0xf5167b){if(_0xf5167b[_0xd62c('0x32')]!=='VIRTUAL'){var _0x57fa9d={};_0x57fa9d[_0xf5167b[_0xd62c('0x2d')]]={'$like':'%'+_0x13d9d1[_0xd62c('0x34')]['filter']+'%'};return _0x57fa9d;}})});}_0x170068=_['merge']({},_0x170068,_0x13d9d1['options']);var _0x53222f={'where':_0x170068[_0xd62c('0x3d')]};return db[_0xd62c('0x30')][_0xd62c('0x26')](_0x53222f)['then'](function(_0x1ad953){_0x565a5f[_0xd62c('0x26')]=_0x1ad953;if(_0x13d9d1[_0xd62c('0x34')][_0xd62c('0x40')]){_0x170068[_0xd62c('0x41')]=[{'all':!![]}];}return db[_0xd62c('0x30')][_0xd62c('0x42')](_0x170068);})[_0xd62c('0x16')](function(_0x4e03f2){_0x565a5f[_0xd62c('0x43')]=_0x4e03f2;return _0x565a5f;})[_0xd62c('0x16')](respondWithFilteredResult(_0x21575e,_0x170068))['catch'](handleError(_0x21575e,null));};exports[_0xd62c('0x44')]=function(_0xda9d8a,_0x1cc9ac){var _0x41ac1c={'raw':!![],'where':{'id':_0xda9d8a['params']['id']}},_0x145daf={};_0x145daf[_0xd62c('0x37')]=_[_0xd62c('0x45')](db[_0xd62c('0x30')][_0xd62c('0x46')]);_0x145daf[_0xd62c('0x34')]=_['keys'](_0xda9d8a['query']);_0x145daf[_0xd62c('0x35')]=_[_0xd62c('0x36')](_0x145daf[_0xd62c('0x37')],_0x145daf[_0xd62c('0x34')]);_0x41ac1c[_0xd62c('0x38')]=_[_0xd62c('0x36')](_0x145daf['model'],qs[_0xd62c('0x39')](_0xda9d8a[_0xd62c('0x34')][_0xd62c('0x39')]));_0x41ac1c[_0xd62c('0x38')]=_0x41ac1c[_0xd62c('0x38')]['length']?_0x41ac1c[_0xd62c('0x38')]:_0x145daf[_0xd62c('0x37')];if(_0xda9d8a[_0xd62c('0x34')][_0xd62c('0x40')]){_0x41ac1c[_0xd62c('0x41')]=[{'all':!![]}];}_0x41ac1c=_[_0xd62c('0x3f')]({},_0x41ac1c,_0xda9d8a['options']);return db[_0xd62c('0x30')][_0xd62c('0x47')](_0x41ac1c)[_0xd62c('0x16')](handleEntityNotFound(_0x1cc9ac,null))[_0xd62c('0x16')](respondWithResult(_0x1cc9ac,null))['catch'](handleError(_0x1cc9ac,null));};exports[_0xd62c('0x29')]=function(_0x3ea50f,_0x50628c){if(_0x3ea50f[_0xd62c('0x48')]['id']){delete _0x3ea50f[_0xd62c('0x48')]['id'];}return db[_0xd62c('0x30')]['find']({'where':{'id':_0x3ea50f['params']['id']}})['then'](handleEntityNotFound(_0x50628c,null))[_0xd62c('0x16')](saveUpdates(_0x3ea50f[_0xd62c('0x48')],null))[_0xd62c('0x16')](respondWithResult(_0x50628c,null))['catch'](handleError(_0x50628c,null));};exports['destroy']=function(_0xe4d2b3,_0x735d3a){return db[_0xd62c('0x30')][_0xd62c('0x47')]({'where':{'id':_0xe4d2b3['params']['id']}})[_0xd62c('0x16')](handleEntityNotFound(_0x735d3a,null))[_0xd62c('0x16')](removeEntity(_0x735d3a,null))[_0xd62c('0x20')](handleError(_0x735d3a,null));};exports[_0xd62c('0x49')]=function(_0x306f05,_0x3ef646){return db['MailMessage'][_0xd62c('0x49')]()[_0xd62c('0x16')](respondWithResult(_0x3ef646,null))[_0xd62c('0x20')](handleError(_0x3ef646,null));};exports[_0xd62c('0x4a')]=function(_0x174cf8,_0x5b4f08){return db['MailMessage'][_0xd62c('0x4a')](_0x174cf8[_0xd62c('0x48')])[_0xd62c('0x16')](function(_0x384e5f){if(_0x384e5f){if(_0x384e5f[_0xd62c('0x4b')]===_0xd62c('0x4c')&&!_0x384e5f[_0xd62c('0x4d')]){var _0x1e49ac,_0x3aa8e1,_0xb03335;if(_0x174cf8[_0xd62c('0x48')]['to']){_0x3aa8e1=_0x174cf8[_0xd62c('0x48')]['to'][_0xd62c('0x4e')](',')[0x0];}return db[_0xd62c('0x4f')][_0xd62c('0x50')]({'where':{'id':_0x384e5f['MailAccountId']},'include':[{'model':db[_0xd62c('0x51')],'as':_0xd62c('0x52'),'include':[{'model':db[_0xd62c('0x53')],'as':_0xd62c('0x54'),'where':{'email':_0x3aa8e1},'limit':0x1,'order':[['updatedAt',_0xd62c('0x55')]]}]},{'model':db[_0xd62c('0x56')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xd62c('0x57')],'as':_0xd62c('0x57'),'raw':!![]}]}]})[_0xd62c('0x16')](function(_0x3f444d){_0x1e49ac=_0x3f444d;if(!_0x1e49ac||!_0x1e49ac[_0xd62c('0x58')])return;var _0x567089=_0x1e49ac['getSmtpOptions']();if(_0x174cf8[_0xd62c('0x48')][_0xd62c('0x59')]&&_0x174cf8['body'][_0xd62c('0x59')][_0xd62c('0x5a')]){for(var _0x5454fb=0x0;_0x5454fb<_0x174cf8[_0xd62c('0x48')][_0xd62c('0x59')][_0xd62c('0x5a')];_0x5454fb+=0x1){_0x174cf8['body'][_0xd62c('0x59')][_0x5454fb]={'filename':_0x174cf8[_0xd62c('0x48')]['attachments'][_0x5454fb][_0xd62c('0x2d')],'path':path['join'](config[_0xd62c('0x5b')],'server/files/attachments',_0x174cf8[_0xd62c('0x48')][_0xd62c('0x59')][_0x5454fb][_0xd62c('0x5c')])};}}_0xb03335={'account':_0x567089,'message':_0x174cf8[_0xd62c('0x48')]};return;})[_0xd62c('0x16')](function(){if(_0x1e49ac[_0xd62c('0x52')]){if(_0x1e49ac[_0xd62c('0x52')]['Contacts'][_0xd62c('0x5a')]){return _0x1e49ac[_0xd62c('0x52')][_0xd62c('0x54')][0x0];}else{return db[_0xd62c('0x53')][_0xd62c('0x4a')](_[_0xd62c('0xc')](_0x174cf8[_0xd62c('0x48')],{'firstName':_0x174cf8['body']['to'],'email':_0x174cf8[_0xd62c('0x48')]['to'],'phone':_0x174cf8[_0xd62c('0x48')]['to'],'ListId':_0x1e49ac[_0xd62c('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0xb03335){return respondWithRpcPromise(_0xd62c('0x5e'),_0xd62c('0x5f'),_0xb03335,client9003)[_0xd62c('0x16')](function(_0x343549){return _0x384e5f[_0xd62c('0x29')]({'read':!![],'messageId':_0x343549[_0xd62c('0x60')],'sentAt':moment()[_0xd62c('0x61')](_0xd62c('0x62'))});})['catch'](function(_0x4b67b0){logger[_0xd62c('0x1b')]('%s',JSON['stringify'](_0x4b67b0));return _0x384e5f;});}return _0x384e5f;});}return _0x384e5f;}})['then'](respondWithResult(_0x5b4f08,0xc9))['catch'](handleError(_0x5b4f08,null));};exports['accept']=function(_0x51d98d,_0x3683d9){var _0x38e23c={'agent':{},'channel':_0xd62c('0x63')};if(_0x51d98d[_0xd62c('0x48')]['id']){delete _0x51d98d[_0xd62c('0x48')]['id'];}_0x51d98d[_0xd62c('0x48')][_0xd62c('0x64')]=!![];_0x51d98d[_0xd62c('0x48')][_0xd62c('0x65')]=moment()[_0xd62c('0x61')](_0xd62c('0x62'));_0x51d98d[_0xd62c('0x48')][_0xd62c('0x66')]=_0x51d98d[_0xd62c('0x48')][_0xd62c('0x66')]||_0x51d98d['user']['id'];_0x38e23c[_0xd62c('0x67')]['id']=_0x51d98d['body']['UserId'];return db['MailMessage']['find']({'where':{'id':_0x51d98d['params']['id'],'UserId':null}})[_0xd62c('0x16')](handleEntityNotFound(_0x3683d9,null))[_0xd62c('0x16')](saveUpdates(_0x51d98d[_0xd62c('0x48')],null))['then'](function(_0x4291bb){if(_0x4291bb){_0x38e23c['message']=_0x4291bb[_0xd62c('0x68')]({'plain':!![]});return db[_0xd62c('0x69')][_0xd62c('0x47')]({'where':{'id':_0x4291bb[_0xd62c('0x6a')]}});}return null;})[_0xd62c('0x16')](handleEntityNotFound(_0x3683d9,null))['then'](function(_0x2dee3b){if(_0x2dee3b){return _0x2dee3b[_0xd62c('0x29')]({'UserId':_0x51d98d[_0xd62c('0x48')][_0xd62c('0x66')],'read1stAt':_['isNil'](_0x2dee3b[_0xd62c('0x6b')])?moment()[_0xd62c('0x61')](_0xd62c('0x62')):undefined});}return null;})[_0xd62c('0x16')](function(_0x1985d5){if(_0x1985d5){_0x38e23c[_0xd62c('0x6c')]=_0x1985d5[_0xd62c('0x68')]({'plain':!![]});interaction_log[_0xd62c('0x1e')](_0xd62c('0x6d'),_0x51d98d[_0xd62c('0x6e')]['id'],_0x51d98d[_0xd62c('0x6e')][_0xd62c('0x2d')],_0x51d98d[_0xd62c('0x6e')][_0xd62c('0x6f')],_0x38e23c[_0xd62c('0x6c')]['id'],_0x51d98d[_0xd62c('0x48')]?JSON[_0xd62c('0x1a')](_0x51d98d[_0xd62c('0x48')]):_0xd62c('0x70'));return respondWithRpcPromise(_0xd62c('0x71'),'acceptMessage',_0x38e23c);}return null;})[_0xd62c('0x16')](function(_0x23ec53){var _0x59e756='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x23ec53[_0xd62c('0x1d')][_0xd62c('0x72')];return db[_0xd62c('0x73')][_0xd62c('0x34')](_0x59e756,{'type':db[_0xd62c('0x74')][_0xd62c('0x75')][_0xd62c('0x76')],'raw':!![]})[_0xd62c('0x16')](function(_0x162663){return _0x162663;});})[_0xd62c('0x16')](function(_0x1f4409){if(_0x1f4409){_0x38e23c[_0xd62c('0x1d')][_0xd62c('0x77')]=_0x1f4409[0x0];if(!_0x51d98d['body']['UserId'])return;return db[_0xd62c('0x78')][_0xd62c('0x47')]({'where':{'id':_0x51d98d[_0xd62c('0x48')][_0xd62c('0x66')],'role':_0xd62c('0x67')},'attributes':['id','name',_0xd62c('0x79'),_0xd62c('0x7a'),_0xd62c('0x7b')],'raw':!![]});}return null;})[_0xd62c('0x16')](function(_0x3c2040){if(!_0x3c2040)return null;_0x38e23c['message'][_0xd62c('0x67')]=_0x3c2040;return _0x38e23c;})[_0xd62c('0x16')](function(_0x50e0e3){if(_0x50e0e3){if(_0x51d98d[_0xd62c('0x48')][_0xd62c('0x7c')]){_0x38e23c[_0xd62c('0x1d')]['interface']=util['format']('SIP/%s',_0x51d98d[_0xd62c('0x6e')][_0xd62c('0x2d')]);_0x38e23c[_0xd62c('0x1d')][_0xd62c('0x7d')]=_0x38e23c[_0xd62c('0x7d')];_0x38e23c[_0xd62c('0x1d')]['motionChannel']=_0x38e23c[_0xd62c('0x7d')];_0x38e23c[_0xd62c('0x1d')]['event']=_0xd62c('0x7e');_0x38e23c[_0xd62c('0x1d')][_0xd62c('0x48')]=htmlToText['fromString'](_0x38e23c[_0xd62c('0x1d')][_0xd62c('0x48')]);return respondWithRpcPromise(_0xd62c('0x7f'),_0xd62c('0x7f'),{'event':_0xd62c('0x80'),'message':_0x38e23c[_0xd62c('0x1d')]},client9002)[_0xd62c('0x16')](function(){return _0x38e23c;});}return _0x38e23c;}return null;})['then'](respondWithResult(_0x3683d9,null))[_0xd62c('0x20')](handleError(_0x3683d9,null));};exports[_0xd62c('0x81')]=function(_0x82b1b9,_0x569e2a){var _0x400458={'agent':{},'channel':_0xd62c('0x63')};if(_0x82b1b9[_0xd62c('0x48')]['id']){delete _0x82b1b9[_0xd62c('0x48')]['id'];}_0x82b1b9['body'][_0xd62c('0x66')]=_0x82b1b9[_0xd62c('0x48')][_0xd62c('0x66')]||_0x82b1b9['user']['id'];_0x400458['agent']['id']=_0x82b1b9[_0xd62c('0x48')][_0xd62c('0x66')];return db[_0xd62c('0x30')][_0xd62c('0x47')]({'where':{'id':_0x82b1b9[_0xd62c('0x82')]['id'],'UserId':null}})[_0xd62c('0x16')](handleEntityNotFound(_0x569e2a,null))[_0xd62c('0x16')](function(_0xa87c99){if(_0xa87c99){_0x400458[_0xd62c('0x1d')]=_0xa87c99[_0xd62c('0x68')]({'plain':!![]});return db[_0xd62c('0x69')][_0xd62c('0x47')]({'where':{'id':_0xa87c99[_0xd62c('0x6a')]}});}return null;})[_0xd62c('0x16')](handleEntityNotFound(_0x569e2a,null))[_0xd62c('0x16')](function(_0x1b323d){if(_0x1b323d){_0x400458['interaction']=_0x1b323d[_0xd62c('0x68')]({'plain':!![]});interaction_log[_0xd62c('0x1e')](_0xd62c('0x83'),_0x82b1b9[_0xd62c('0x6e')]['id'],_0x82b1b9[_0xd62c('0x6e')][_0xd62c('0x2d')],_0x82b1b9[_0xd62c('0x6e')]['role'],_0x400458['interaction']['id'],_0x82b1b9['body']?JSON[_0xd62c('0x1a')](_0x82b1b9[_0xd62c('0x48')]):'null');return respondWithRpcPromise(_0xd62c('0x84'),_0xd62c('0x85'),_0x400458);}return null;})[_0xd62c('0x16')](function(_0x258aa8){var _0x26d019='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x258aa8[_0xd62c('0x1d')][_0xd62c('0x72')];return db[_0xd62c('0x73')][_0xd62c('0x34')](_0x26d019,{'type':db[_0xd62c('0x74')]['QueryTypes'][_0xd62c('0x76')],'raw':!![]})[_0xd62c('0x16')](function(_0x348462){return _0x348462;});})[_0xd62c('0x16')](function(_0x54c1f7){if(_0x54c1f7){_0x400458[_0xd62c('0x1d')]['contact']=_0x54c1f7[0x0];if(!_0x82b1b9['body']['UserId'])return;return db[_0xd62c('0x78')]['find']({'where':{'id':_0x82b1b9[_0xd62c('0x48')]['UserId'],'role':_0xd62c('0x67')},'attributes':['id',_0xd62c('0x2d'),_0xd62c('0x79'),_0xd62c('0x7a'),'internal'],'raw':!![]});}return null;})[_0xd62c('0x16')](function(_0x5968f9){if(!_0x5968f9)return null;_0x400458[_0xd62c('0x1d')][_0xd62c('0x67')]=_0x5968f9;return _0x400458;})[_0xd62c('0x16')](function(_0x48c265){if(_0x48c265){_0x48c265[_0xd62c('0x1d')][_0xd62c('0x86')]=util[_0xd62c('0x61')](_0xd62c('0x87'),_0x82b1b9['user'][_0xd62c('0x2d')]);_0x48c265['message']['channel']=_0x400458[_0xd62c('0x7d')];_0x48c265['message'][_0xd62c('0x88')]=_0x400458[_0xd62c('0x7d')];_0x48c265['message'][_0xd62c('0x89')]='reject';_0x48c265[_0xd62c('0x1d')][_0xd62c('0x48')]=htmlToText[_0xd62c('0x8a')](_0x400458['message'][_0xd62c('0x48')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xd62c('0x8b'),'message':_0x48c265[_0xd62c('0x1d')]},client9002);return _0x400458;}return null;})[_0xd62c('0x16')](respondWithResult(_0x569e2a,null))['catch'](handleError(_0x569e2a,null));};exports[_0xd62c('0x8c')]=function(_0x5cbb5d,_0x1ab80b){var _0x2abbf7=moment()[_0xd62c('0x8d')]()[_0xd62c('0x8e')]();var _0x118392=path['join'](config[_0xd62c('0x5b')],_0xd62c('0x8f'),_0xd62c('0x90'),_0xd62c('0x91'));var _0x1c273f=path[_0xd62c('0x92')](config['root'],_0xd62c('0x8f'),_0xd62c('0x90'),_0xd62c('0x59'));var _0x3535b2=util['format'](_0xd62c('0x93'),_0x2abbf7);return db['MailMessage'][_0xd62c('0x47')]({'where':{'id':_0x5cbb5d[_0xd62c('0x82')]['id']},'attributes':['id','body',_0xd62c('0x94'),'to','cc',_0xd62c('0x95'),_0xd62c('0x96'),'createdAt'],'include':_0x5cbb5d['query'][_0xd62c('0x59')]?[{'model':db[_0xd62c('0x97')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x1ab80b,null))['then'](function(_0x139012){if(_0x139012){var _0x3d2a3f=_0x139012;var _0x433c2a={'from':_0x3d2a3f['from'],'to':_0x3d2a3f['to'],'subject':_0x3d2a3f[_0xd62c('0x96')],'html':htmlEntities[_0xd62c('0x98')](_0x3d2a3f[_0xd62c('0x48')]),'headers':{'Date':moment(_0x3d2a3f[_0xd62c('0x99')])[_0xd62c('0x61')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x139012['cc']){_0x433c2a[_0xd62c('0x9a')]['Cc']=_0x139012['cc'];}if(_0x139012[_0xd62c('0x95')]){_0x433c2a[_0xd62c('0x9a')]['Bcc']=_0x139012['bcc'];}return new BPromise(function(_0x17aa4a,_0x3a295a){if(_0x139012[_0xd62c('0x9b')]){for(var _0x57ee5b=0x0;_0x57ee5b<_0x139012[_0xd62c('0x9b')][_0xd62c('0x5a')];_0x57ee5b++){var _0x4ba035=_0x139012[_0xd62c('0x9b')][_0x57ee5b];var _0x385c89=path[_0xd62c('0x92')](_0x1c273f,_0x4ba035['basename']);if(fs[_0xd62c('0x9c')](_0x385c89)){_0x433c2a[_0xd62c('0x59')][_0xd62c('0x9d')]({'name':_0x4ba035[_0xd62c('0x2d')],'contentType':_0x4ba035['type'],'data':fs['readFileSync'](_0x385c89)});}}}emlformat['build'](_0x433c2a,function(_0x168855,_0x36823d){if(_0x168855)return _0x3a295a(_0x168855);fs[_0xd62c('0x9e')](path['join'](_0x118392,_0x3535b2),_0x36823d);return _0x17aa4a(_0x36823d);});});}})['then'](function(_0xee379e){if(_0xee379e){return _0x1ab80b[_0xd62c('0x8c')](path[_0xd62c('0x92')](_0x118392,_0x3535b2),_0x3535b2,function(_0x1cafbf){if(!_0x1cafbf)fs[_0xd62c('0x9f')](path[_0xd62c('0x92')](_0x118392,_0x3535b2));});}})[_0xd62c('0x20')](handleError(_0x1ab80b,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 8554925..2269272 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 _0x2d4a=['save','update','emit','hook','exports','events','MailMessage','setMaxListeners'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x2d4a,0xed));var _0xa2d4=function(_0x3a894f,_0x190892){_0x3a894f=_0x3a894f-0x0;var _0x55c214=_0x2d4a[_0x3a894f];return _0x55c214;};'use strict';var EventEmitter=require(_0xa2d4('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xa2d4('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa2d4('0x2')](0x0);var events={'afterCreate':_0xa2d4('0x3'),'afterUpdate':_0xa2d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25c5f2){return function(_0x34de10,_0x5ad817,_0x17cf70){MailMessageEvents[_0xa2d4('0x5')](_0x25c5f2+':'+_0x34de10['id'],_0x34de10);MailMessageEvents['emit'](_0x25c5f2,_0x34de10);_0x17cf70(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa2d4('0x6')](e,emitEvent(event));}}module[_0xa2d4('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xb2b4=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1423e3,_0x20d216){var _0x1aaa0e=function(_0x3bff04){while(--_0x3bff04){_0x1423e3['push'](_0x1423e3['shift']());}};_0x1aaa0e(++_0x20d216);}(_0xb2b4,0x188));var _0x4b2b=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0xb2b4[_0x44cb92];return _0x56b9e6;};'use strict';var EventEmitter=require(_0x4b2b('0x0'));var MailMessage=require(_0x4b2b('0x1'))['db'][_0x4b2b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4b2b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b2b('0x4'),'afterDestroy':_0x4b2b('0x5')};function emitEvent(_0x247f03){return function(_0x523d66,_0x2fa00e,_0x1d6028){MailMessageEvents['emit'](_0x247f03+':'+_0x523d66['id'],_0x523d66);MailMessageEvents[_0x4b2b('0x6')](_0x247f03,_0x523d66);_0x1d6028(null);};}for(var e in events){if(events[_0x4b2b('0x7')](e)){var event=events[e];MailMessage[_0x4b2b('0x8')](e,emitEvent(event));}}module[_0x4b2b('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0bc363b..456d411 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 _0x200f=['../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','path','rimraf'];(function(_0x2c7b46,_0x1aa654){var _0x4fadaa=function(_0xed97bd){while(--_0xed97bd){_0x2c7b46['push'](_0x2c7b46['shift']());}};_0x4fadaa(++_0x1aa654);}(_0x200f,0x93));var _0xf200=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0x200f[_0x122415];return _0x3ac79d;};'use strict';var _=require('lodash');var util=require(_0xf200('0x0'));var logger=require(_0xf200('0x1'))(_0xf200('0x2'));var moment=require('moment');var BPromise=require(_0xf200('0x3'));var rp=require(_0xf200('0x4'));var htmlToText=require(_0xf200('0x5'));var fs=require('fs');var path=require(_0xf200('0x6'));var rimraf=require(_0xf200('0x7'));var config=require(_0xf200('0x8'));var attributes=require(_0xf200('0x9'));module['exports']=function(_0x4c3796,_0xafaf72){return _0x4c3796[_0xf200('0xa')](_0xf200('0xb'),attributes,{'tableName':_0xf200('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4bd0b3,_0x12c862,_0x544a35){if(_0x4bd0b3[_0xf200('0xd')]){_0x4bd0b3['plainBody']=htmlToText[_0xf200('0xe')](_0x4bd0b3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x544a35(null,_0x12c862);},'afterCreate':function(_0x295ccd,_0x1df989,_0x398615){var _0x5d4118=_0x4c3796[_0xf200('0xf')];var _0x1461d5=_0x295ccd[_0xf200('0x10')]({'plain':!![]});if(_0x1461d5[_0xf200('0x11')]['toLowerCase']()==='in'||_0x1461d5[_0xf200('0x11')][_0xf200('0x12')]()===_0xf200('0x13')&&!_0x1461d5[_0xf200('0x14')]&&!_[_0xf200('0x15')](_0x1461d5[_0xf200('0x16')])){_0x5d4118[_0xf200('0x17')][_0xf200('0x18')]({'where':{'id':_0x1461d5[_0xf200('0x19')]}})[_0xf200('0x1a')](function(_0x49c730){if(_0x49c730){_0x49c730[_0xf200('0x1b')]({'lastMsgAt':_0x1461d5[_0xf200('0x1c')],'lastMsgDirection':_0x1461d5['direction']['toLowerCase']()});}})[_0xf200('0x1d')](function(_0x35771f){console['error'](_0x35771f);});}_0x398615();}},'charset':'utf8mb4','collate':_0xf200('0x1e')});}; \ No newline at end of file +var _0xc4b0=['subject','FULLTEXT','fromString','body','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages','plainBody'];(function(_0xe825c7,_0x3c6595){var _0x42b41b=function(_0x4d81d0){while(--_0x4d81d0){_0xe825c7['push'](_0xe825c7['shift']());}};_0x42b41b(++_0x3c6595);}(_0xc4b0,0x1d2));var _0x0c4b=function(_0x526559,_0x3b13c7){_0x526559=_0x526559-0x0;var _0x43019d=_0xc4b0[_0x526559];return _0x43019d;};'use strict';var _=require(_0x0c4b('0x0'));var util=require('util');var logger=require(_0x0c4b('0x1'))('api');var moment=require(_0x0c4b('0x2'));var BPromise=require(_0x0c4b('0x3'));var rp=require(_0x0c4b('0x4'));var htmlToText=require(_0x0c4b('0x5'));var fs=require('fs');var path=require(_0x0c4b('0x6'));var rimraf=require('rimraf');var config=require(_0x0c4b('0x7'));var attributes=require(_0x0c4b('0x8'));module[_0x0c4b('0x9')]=function(_0x58506d,_0x192f1){return _0x58506d['define'](_0x0c4b('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0c4b('0xb')]},{'name':_0x0c4b('0xc'),'fields':[_0x0c4b('0xd'),_0x0c4b('0xe')],'type':_0x0c4b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x125be5,_0x49dc5d,_0x270518){if(_0x125be5['body']){_0x125be5['plainBody']=htmlToText[_0x0c4b('0x10')](_0x125be5[_0x0c4b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x270518(null,_0x49dc5d);},'afterCreate':function(_0x29685f,_0x5280fd,_0x91ae42){var _0x429127=_0x58506d[_0x0c4b('0x12')];var _0x2ae0f6=_0x29685f['get']({'plain':!![]});if(_0x2ae0f6[_0x0c4b('0x13')][_0x0c4b('0x14')]()==='in'||_0x2ae0f6[_0x0c4b('0x13')]['toLowerCase']()==='out'&&!_0x2ae0f6[_0x0c4b('0x15')]&&!_[_0x0c4b('0x16')](_0x2ae0f6[_0x0c4b('0x17')])){_0x429127[_0x0c4b('0x18')]['findOne']({'where':{'id':_0x2ae0f6[_0x0c4b('0x19')]}})[_0x0c4b('0x1a')](function(_0x1635a9){if(_0x1635a9){_0x1635a9[_0x0c4b('0x1b')]({'lastMsgAt':_0x2ae0f6[_0x0c4b('0x1c')],'lastMsgDirection':_0x2ae0f6[_0x0c4b('0x13')][_0x0c4b('0x14')]()});}})[_0x0c4b('0x1d')](function(_0x496ea2){console['error'](_0x496ea2);});}_0x91ae42();}},'charset':_0x0c4b('0x1e'),'collate':_0x0c4b('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 336eceb..191f6cf 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 _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file +var _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2315279..9a6ca16 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 _0x82fa=['emit','removeListener','register','length','./mailMessage.events','save','remove','update'];(function(_0x5b848e,_0x5172b9){var _0x381fdb=function(_0x50d5da){while(--_0x50d5da){_0x5b848e['push'](_0x5b848e['shift']());}};_0x381fdb(++_0x5172b9);}(_0x82fa,0x1cc));var _0xa82f=function(_0x103c33,_0x3584a8){_0x103c33=_0x103c33-0x0;var _0x4f1a7e=_0x82fa[_0x103c33];return _0x4f1a7e;};'use strict';var MailMessageEvents=require(_0xa82f('0x0'));var events=[_0xa82f('0x1'),_0xa82f('0x2'),_0xa82f('0x3')];function createListener(_0x48bbeb,_0x58807b){return function(_0x52b8d8){_0x58807b[_0xa82f('0x4')](_0x48bbeb,_0x52b8d8);};}function removeListener(_0x367016,_0x630deb){return function(){MailMessageEvents[_0xa82f('0x5')](_0x367016,_0x630deb);};}exports[_0xa82f('0x6')]=function(_0x20e6e4){for(var _0x6195ef=0x0,_0x3dbb1c=events[_0xa82f('0x7')];_0x6195ef<_0x3dbb1c;_0x6195ef++){var _0x36507a=events[_0x6195ef];var _0x37ee38=createListener('mailMessage:'+_0x36507a,_0x20e6e4);MailMessageEvents['on'](_0x36507a,_0x37ee38);}}; \ No newline at end of file +var _0x3408=['mailMessage:','./mailMessage.events','remove','update','emit','length'];(function(_0x11d289,_0x1acfa7){var _0x5d99c0=function(_0xa4baba){while(--_0xa4baba){_0x11d289['push'](_0x11d289['shift']());}};_0x5d99c0(++_0x1acfa7);}(_0x3408,0x15d));var _0x8340=function(_0x5be424,_0x3899b8){_0x5be424=_0x5be424-0x0;var _0x305706=_0x3408[_0x5be424];return _0x305706;};'use strict';var MailMessageEvents=require(_0x8340('0x0'));var events=['save',_0x8340('0x1'),_0x8340('0x2')];function createListener(_0x5daaee,_0x57940c){return function(_0x4dc550){_0x57940c[_0x8340('0x3')](_0x5daaee,_0x4dc550);};}function removeListener(_0x46c2fc,_0x2f9406){return function(){MailMessageEvents['removeListener'](_0x46c2fc,_0x2f9406);};}exports['register']=function(_0x3de8d8){for(var _0x21d78d=0x0,_0x440374=events[_0x8340('0x4')];_0x21d78d<_0x440374;_0x21d78d++){var _0x20107c=events[_0x21d78d];var _0x202a5f=createListener(_0x8340('0x5')+_0x20107c,_0x3de8d8);MailMessageEvents['on'](_0x20107c,_0x202a5f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b846d90..6597202 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 _0xc362=['connect-timeout','express','Router','fs-extra','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports'];(function(_0x26abf7,_0x5d96e1){var _0x1bcdae=function(_0x12c7c7){while(--_0x12c7c7){_0x26abf7['push'](_0x26abf7['shift']());}};_0x1bcdae(++_0x5d96e1);}(_0xc362,0x138));var _0x2c36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc362[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2c36('0x0'));var express=require(_0x2c36('0x1'));var router=express[_0x2c36('0x2')]();var fs_extra=require(_0x2c36('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c36('0x4'));var controller=require(_0x2c36('0x5'));router['get']('/',auth[_0x2c36('0x6')](),controller['index']);router[_0x2c36('0x7')](_0x2c36('0x8'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x9')]);router['get'](_0x2c36('0xa'),auth[_0x2c36('0x6')](),controller[_0x2c36('0xb')]);router[_0x2c36('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x2c36('0xc')]);router[_0x2c36('0x7')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0xe')]);router['get'](_0x2c36('0xf'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x10')]);router[_0x2c36('0x11')]('/',auth[_0x2c36('0x6')](),controller[_0x2c36('0x12')]);router[_0x2c36('0x11')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x13')]);router[_0x2c36('0x11')](_0x2c36('0xf'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x14')]);router[_0x2c36('0x15')]('/:id',auth[_0x2c36('0x6')](),controller['update']);router[_0x2c36('0x16')](_0x2c36('0xa'),auth[_0x2c36('0x6')](),controller['destroy']);router[_0x2c36('0x16')](_0x2c36('0xd'),auth[_0x2c36('0x6')](),controller[_0x2c36('0x17')]);router[_0x2c36('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c36('0x18')]);module[_0x2c36('0x19')]=router; \ No newline at end of file +var _0x255d=['../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','show','/:id/members','getMembers','/:id/teams','getAgents','post','addTeams','put','delete','/:id','removeTeams','/:id/users','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x255d,0xe3));var _0xd255=function(_0x21bc94,_0x2a03c1){_0x21bc94=_0x21bc94-0x0;var _0x27ba11=_0x255d[_0x21bc94];return _0x27ba11;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd255('0x0'));var timeout=require(_0xd255('0x1'));var express=require(_0xd255('0x2'));var router=express[_0xd255('0x3')]();var fs_extra=require(_0xd255('0x4'));var auth=require(_0xd255('0x5'));var interaction=require(_0xd255('0x6'));var config=require(_0xd255('0x7'));var controller=require(_0xd255('0x8'));router['get']('/',auth[_0xd255('0x9')](),controller['index']);router[_0xd255('0xa')](_0xd255('0xb'),auth[_0xd255('0x9')](),controller['describe']);router[_0xd255('0xa')]('/:id',auth[_0xd255('0x9')](),controller[_0xd255('0xc')]);router[_0xd255('0xa')](_0xd255('0xd'),auth['isAuthenticated'](),controller[_0xd255('0xe')]);router[_0xd255('0xa')](_0xd255('0xf'),auth[_0xd255('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0xd255('0x9')](),controller[_0xd255('0x10')]);router[_0xd255('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd255('0x11')](_0xd255('0xf'),auth[_0xd255('0x9')](),controller[_0xd255('0x12')]);router[_0xd255('0x11')]('/:id/users',auth[_0xd255('0x9')](),controller['addAgents']);router[_0xd255('0x13')]('/:id',auth[_0xd255('0x9')](),controller['update']);router[_0xd255('0x14')](_0xd255('0x15'),auth[_0xd255('0x9')](),controller['destroy']);router['delete'](_0xd255('0xf'),auth['isAuthenticated'](),controller[_0xd255('0x16')]);router[_0xd255('0x14')](_0xd255('0x17'),auth['isAuthenticated'](),controller[_0xd255('0x18')]);module[_0xd255('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 554d4c6..9af194e 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 _0xa9a1=['roundrobin','sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x49fc26,_0x2a32e6){var _0x1d3940=function(_0xe9bd8a){while(--_0xe9bd8a){_0x49fc26['push'](_0x49fc26['shift']());}};_0x1d3940(++_0x2a32e6);}(_0xa9a1,0x1eb));var _0x1a9a=function(_0x555d39,_0x2c9e33){_0x555d39=_0x555d39-0x0;var _0x5634f9=_0xa9a1[_0x555d39];return _0x5634f9;};'use strict';var Sequelize=require(_0x1a9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a9a('0x1')],'unique':_0x1a9a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a9a('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1a9a('0x3')](_0x1a9a('0x4'),_0x1a9a('0x5'),_0x1a9a('0x6'))}}; \ No newline at end of file +var _0x997b=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x28f8a7,_0x184d1f){var _0x155496=function(_0x597754){while(--_0x597754){_0x28f8a7['push'](_0x28f8a7['shift']());}};_0x155496(++_0x184d1f);}(_0x997b,0x7b));var _0xb997=function(_0x45d9e0,_0x82218e){_0x45d9e0=_0x45d9e0-0x0;var _0x2d8ce3=_0x997b[_0x45d9e0];return _0x2d8ce3;};'use strict';var Sequelize=require(_0xb997('0x0'));module[_0xb997('0x1')]={'name':{'type':Sequelize[_0xb997('0x2')],'unique':_0xb997('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb997('0x2')]},'timeout':{'type':Sequelize[_0xb997('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb997('0x5')](_0xb997('0x6'),'beepall',_0xb997('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a2ba1fe..233b7c5 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 _0x9ad5=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','update','then','destroy','get','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','findAll','catch','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','body','params','describe','getMembers','findOne','UserMailQueue','filters','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','options','addTeams','ids','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis'];(function(_0x39b64d,_0x34a661){var _0x4520f5=function(_0x4ee903){while(--_0x4ee903){_0x39b64d['push'](_0x39b64d['shift']());}};_0x4520f5(++_0x34a661);}(_0x9ad5,0x1cc));var _0x59ad=function(_0x13f5a6,_0xbecee6){_0x13f5a6=_0x13f5a6-0x0;var _0x155664=_0x9ad5[_0x13f5a6];return _0x155664;};'use strict';var BPromise=require(_0x59ad('0x0'));var util=require(_0x59ad('0x1'));var _=require(_0x59ad('0x2'));var squel=require(_0x59ad('0x3'));var Redis=require(_0x59ad('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x59ad('0x5'));var db=require(_0x59ad('0x6'))['db'];config[_0x59ad('0x7')]=_[_0x59ad('0x8')](config[_0x59ad('0x7')],{'host':_0x59ad('0x9'),'port':0x18eb});var socket=require(_0x59ad('0xa'))(new Redis(config['redis']));require(_0x59ad('0xb'))[_0x59ad('0xc')](socket);function respondWithStatusCode(_0x30ea21,_0x4334f6){_0x4334f6=_0x4334f6||0xcc;return function(_0x5cba1f){if(_0x5cba1f){return _0x30ea21[_0x59ad('0xd')](_0x4334f6);}return _0x30ea21['status'](_0x4334f6)[_0x59ad('0xe')]();};}function respondWithResult(_0x3b5079,_0xe95368){_0xe95368=_0xe95368||0xc8;return function(_0x17b9f6){if(_0x17b9f6){return _0x3b5079['status'](_0xe95368)[_0x59ad('0xf')](_0x17b9f6);}};}function respondWithFilteredResult(_0xea902a,_0x1b7bd0){return function(_0x1bac40){if(_0x1bac40){var _0x12054f=typeof _0x1b7bd0[_0x59ad('0x10')]===_0x59ad('0x11')&&typeof _0x1b7bd0[_0x59ad('0x12')]===_0x59ad('0x11');var _0x2d1193=_0x1bac40[_0x59ad('0x13')];var _0x5e70d8=_0x12054f?0x0:_0x1b7bd0['offset'];var _0x4939d9=_0x12054f?_0x1bac40[_0x59ad('0x13')]:_0x1b7bd0[_0x59ad('0x10')]+_0x1b7bd0[_0x59ad('0x12')];var _0x30f1be;if(_0x4939d9>=_0x2d1193){_0x4939d9=_0x2d1193;_0x30f1be=0xc8;}else{_0x30f1be=0xce;}_0xea902a[_0x59ad('0x14')](_0x30f1be);return _0xea902a['set'](_0x59ad('0x15'),_0x5e70d8+'-'+_0x4939d9+'/'+_0x2d1193)['json'](_0x1bac40);}return null;};}function saveUpdates(_0x2b341d){return function(_0x406cde){if(_0x406cde){return _0x406cde[_0x59ad('0x16')](_0x2b341d)[_0x59ad('0x17')](function(_0x15d767){return _0x15d767;});}return null;};}function removeEntity(_0x397774){return function(_0x1efc2c){if(_0x1efc2c){return _0x1efc2c[_0x59ad('0x18')]()[_0x59ad('0x17')](function(){var _0x273d2f=_0x1efc2c[_0x59ad('0x19')]({'plain':!![]});var _0x2fd0c4=_0x59ad('0x1a');return db[_0x59ad('0x1b')][_0x59ad('0x18')]({'where':{'type':_0x2fd0c4,'resourceId':_0x273d2f['id']}})[_0x59ad('0x17')](function(){return _0x1efc2c;});})[_0x59ad('0x17')](function(){_0x397774['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x234b3e){return function(_0x287f2d){if(!_0x287f2d){_0x234b3e[_0x59ad('0xd')](0x194);}return _0x287f2d;};}function handleError(_0x579b48,_0x245e6a){_0x245e6a=_0x245e6a||0x1f4;return function(_0x1529ad){logger[_0x59ad('0x1c')](_0x1529ad[_0x59ad('0x1d')]);if(_0x1529ad[_0x59ad('0x1e')]){delete _0x1529ad[_0x59ad('0x1e')];}_0x579b48['status'](_0x245e6a)['send'](_0x1529ad);};}exports[_0x59ad('0x1f')]=function(_0x2e4069,_0x3ab812){var _0x39c1ca={};var _0x126cce={'count':0x0,'rows':[]};var _0x1475ef=_[_0x59ad('0x20')](db[_0x59ad('0x21')][_0x59ad('0x22')],function(_0x19eeca){return{'name':_0x19eeca[_0x59ad('0x23')],'type':_0x19eeca['type'][_0x59ad('0x24')]};});_0x39c1ca=qs[_0x59ad('0x25')](_0x1475ef,_0x2e4069);var _0x7258e6={'where':_0x39c1ca[_0x59ad('0x26')]};return db[_0x59ad('0x21')][_0x59ad('0x13')](_0x7258e6)[_0x59ad('0x17')](function(_0xbd7773){_0x126cce['count']=_0xbd7773;_0x39c1ca['include']=qs[_0x59ad('0x27')](_0x2e4069['query']);return db[_0x59ad('0x21')][_0x59ad('0x28')](_0x39c1ca);})[_0x59ad('0x17')](function(_0x4fe36a){_0x126cce['rows']=_0x4fe36a;return _0x126cce;})['then'](respondWithFilteredResult(_0x3ab812,_0x39c1ca))[_0x59ad('0x29')](handleError(_0x3ab812,null));};exports[_0x59ad('0x2a')]=function(_0x2515b7,_0x351097){var _0x58d174={'raw':!![],'where':{'id':_0x2515b7['params']['id']}},_0x2586ac={};_0x2586ac[_0x59ad('0x2b')]=_[_0x59ad('0x2c')](db[_0x59ad('0x21')][_0x59ad('0x22')]);_0x2586ac[_0x59ad('0x2d')]=_[_0x59ad('0x2c')](_0x2515b7[_0x59ad('0x2d')]);_0x2586ac['filters']=_['intersection'](_0x2586ac[_0x59ad('0x2b')],_0x2586ac['query']);_0x58d174[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x2586ac['model'],qs[_0x59ad('0x30')](_0x2515b7[_0x59ad('0x2d')]['fields']));_0x58d174[_0x59ad('0x2e')]=_0x58d174[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x58d174[_0x59ad('0x2e')]:_0x2586ac[_0x59ad('0x2b')];if(_0x2515b7[_0x59ad('0x2d')][_0x59ad('0x32')]){_0x58d174['include']=[{'all':!![]}];}_0x58d174=_[_0x59ad('0x33')]({},_0x58d174,_0x2515b7['options']);return db['MailQueue']['find'](_0x58d174)[_0x59ad('0x17')](handleEntityNotFound(_0x351097,null))[_0x59ad('0x17')](respondWithResult(_0x351097,null))[_0x59ad('0x29')](handleError(_0x351097,null));};exports['create']=function(_0xdedc84,_0x3bc4cd){return db[_0x59ad('0x21')][_0x59ad('0x34')](_0xdedc84['body'],{})[_0x59ad('0x17')](function(_0x4a9e5a){var _0x5a703a=_0xdedc84[_0x59ad('0x35')][_0x59ad('0x19')]({'plain':!![]});if(!_0x5a703a)throw new Error(_0x59ad('0x36'));if(_0x5a703a['role']===_0x59ad('0x35')){var _0x3a3bc7=_0x4a9e5a[_0x59ad('0x19')]({'plain':!![]});var _0x55090b=_0x59ad('0x1a');return db[_0x59ad('0x37')][_0x59ad('0x38')]({'where':{'name':_0x55090b,'userProfileId':_0x5a703a['userProfileId']},'raw':!![]})[_0x59ad('0x17')](function(_0x1911ee){if(_0x1911ee&&_0x1911ee[_0x59ad('0x39')]===0x0){return db[_0x59ad('0x1b')][_0x59ad('0x34')]({'name':_0x3a3bc7[_0x59ad('0x1e')],'resourceId':_0x3a3bc7['id'],'type':_0x1911ee[_0x59ad('0x1e')],'sectionId':_0x1911ee['id']},{})[_0x59ad('0x17')](function(){return _0x4a9e5a;});}else{return _0x4a9e5a;}})['catch'](function(_0x3f4712){logger[_0x59ad('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f4712);throw _0x3f4712;});}return _0x4a9e5a;})[_0x59ad('0x17')](respondWithResult(_0x3bc4cd,0xc9))[_0x59ad('0x29')](handleError(_0x3bc4cd,null));};exports[_0x59ad('0x16')]=function(_0x2ce014,_0x999e11){if(_0x2ce014[_0x59ad('0x3a')]['id']){delete _0x2ce014['body']['id'];}return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x2ce014[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x999e11,null))[_0x59ad('0x17')](saveUpdates(_0x2ce014[_0x59ad('0x3a')],null))[_0x59ad('0x17')](respondWithResult(_0x999e11,null))[_0x59ad('0x29')](handleError(_0x999e11,null));};exports[_0x59ad('0x18')]=function(_0x3f16a4,_0x1937b5){return db[_0x59ad('0x21')][_0x59ad('0x38')]({'where':{'id':_0x3f16a4[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x1937b5,null))[_0x59ad('0x17')](removeEntity(_0x1937b5,null))[_0x59ad('0x29')](handleError(_0x1937b5,null));};exports[_0x59ad('0x3c')]=function(_0x40761a,_0x1e318c){return db[_0x59ad('0x21')][_0x59ad('0x3c')]()[_0x59ad('0x17')](respondWithResult(_0x1e318c,null))[_0x59ad('0x29')](handleError(_0x1e318c,null));};exports[_0x59ad('0x3d')]=function(_0x2b0e61,_0x55b04f){var _0x37ef39={'raw':!![],'where':{}},_0x4a273a={},_0x36511e;return db[_0x59ad('0x21')][_0x59ad('0x3e')]({'where':{'id':_0x2b0e61[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x55b04f,null))[_0x59ad('0x17')](function(_0x4d24b5){if(_0x4d24b5){_0x36511e=_0x4d24b5[_0x59ad('0x19')]({'plain':!![]});_0x4a273a[_0x59ad('0x2b')]=_['keys'](db[_0x59ad('0x3f')][_0x59ad('0x22')]);_0x4a273a['query']=_[_0x59ad('0x2c')](_0x2b0e61['query']);_0x4a273a[_0x59ad('0x40')]=_['intersection'](_0x4a273a[_0x59ad('0x2b')],_0x4a273a['query']);_0x37ef39['attributes']=_['intersection'](_0x4a273a['model'],qs[_0x59ad('0x30')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x30')]));_0x37ef39[_0x59ad('0x2e')]=_0x37ef39[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x37ef39['attributes']:_0x4a273a[_0x59ad('0x2b')];if(!_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x41')](_0x59ad('0x42'))){_0x37ef39[_0x59ad('0x12')]=qs[_0x59ad('0x12')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x12')]);_0x37ef39[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x10')]);}_0x37ef39[_0x59ad('0x43')]=qs['sort'](_0x2b0e61['query'][_0x59ad('0x44')]);_0x37ef39['where']=qs[_0x59ad('0x40')](_[_0x59ad('0x45')](_0x2b0e61[_0x59ad('0x2d')],_0x4a273a['filters']));_0x37ef39[_0x59ad('0x26')]['MailQueueId']=_0x4d24b5['id'];if(_0x2b0e61[_0x59ad('0x2d')]['filter']){_0x37ef39['where']=_[_0x59ad('0x33')](_0x37ef39[_0x59ad('0x26')],{'$or':_[_0x59ad('0x20')](_0x37ef39[_0x59ad('0x2e')],function(_0x440322){var _0x25b7c6={};_0x25b7c6[_0x440322]={'$like':'%'+_0x2b0e61[_0x59ad('0x2d')][_0x59ad('0x46')]+'%'};return _0x25b7c6;})});}_0x37ef39=_['merge']({},_0x37ef39,_0x2b0e61['options']);return db[_0x59ad('0x3f')][_0x59ad('0x28')](_0x37ef39);}})[_0x59ad('0x17')](function(_0x35bdb8){if(_0x35bdb8){return db[_0x59ad('0x47')][_0x59ad('0x48')]({'where':{'id':_[_0x59ad('0x20')](_0x35bdb8,'UserId'),'role':_0x59ad('0x49')},'attributes':['id',_0x59ad('0x1e'),_0x59ad('0x4a'),_0x59ad('0x4b'),_0x59ad('0x4c')]});}})[_0x59ad('0x17')](function(_0x32d7ff){if(_0x32d7ff){return{'count':_0x32d7ff[_0x59ad('0x13')],'rows':_['map'](_0x32d7ff[_0x59ad('0x4d')],function(_0x5f141e){return{'membername':_0x5f141e[_0x59ad('0x1e')],'UserId':_0x5f141e['id'],'queue_name':_0x36511e[_0x59ad('0x1e')],'MailQueueId':_0x36511e['id'],'interface':util[_0x59ad('0x4e')](_0x59ad('0x4f'),'SIP',_0x5f141e[_0x59ad('0x1e')]),'penalty':0x0,'paused':_0x5f141e[_0x59ad('0x4a')],'createdAt':_0x5f141e[_0x59ad('0x4c')],'updatedAt':_0x5f141e[_0x59ad('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x59ad('0x17')](respondWithFilteredResult(_0x55b04f,_0x37ef39))[_0x59ad('0x29')](handleError(_0x55b04f,null));};exports[_0x59ad('0x50')]=function(_0x534018,_0x31c016){var _0x46c118={};var _0x56ab55={};var _0x57ad3e;var _0x3922d8;return db['MailQueue'][_0x59ad('0x3e')]({'where':{'id':_0x534018[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x31c016,null))[_0x59ad('0x17')](function(_0x46255f){if(_0x46255f){_0x57ad3e=_0x46255f;_0x56ab55['model']=_[_0x59ad('0x2c')](db[_0x59ad('0x51')][_0x59ad('0x22')]);_0x56ab55[_0x59ad('0x2d')]=_[_0x59ad('0x2c')](_0x534018[_0x59ad('0x2d')]);_0x56ab55[_0x59ad('0x40')]=_['intersection'](_0x56ab55[_0x59ad('0x2b')],_0x56ab55[_0x59ad('0x2d')]);_0x46c118[_0x59ad('0x2e')]=_[_0x59ad('0x2f')](_0x56ab55['model'],qs[_0x59ad('0x30')](_0x534018['query'][_0x59ad('0x30')]));_0x46c118['attributes']=_0x46c118[_0x59ad('0x2e')][_0x59ad('0x31')]?_0x46c118[_0x59ad('0x2e')]:_0x56ab55[_0x59ad('0x2b')];_0x46c118[_0x59ad('0x43')]=qs[_0x59ad('0x44')](_0x534018[_0x59ad('0x2d')][_0x59ad('0x44')]);_0x46c118[_0x59ad('0x26')]=qs[_0x59ad('0x40')](_[_0x59ad('0x45')](_0x534018[_0x59ad('0x2d')],_0x56ab55[_0x59ad('0x40')]));if(_0x534018['query'][_0x59ad('0x46')]){_0x46c118[_0x59ad('0x26')]=_[_0x59ad('0x33')](_0x46c118[_0x59ad('0x26')],{'$or':_['map'](_0x46c118[_0x59ad('0x2e')],function(_0x44933d){var _0x236500={};_0x236500[_0x44933d]={'$like':'%'+_0x534018[_0x59ad('0x2d')]['filter']+'%'};return _0x236500;})});}_0x46c118=_[_0x59ad('0x33')]({},_0x46c118,_0x534018[_0x59ad('0x52')]);return _0x57ad3e[_0x59ad('0x50')](_0x46c118);}})['then'](function(_0x1de4b8){if(_0x1de4b8){_0x3922d8=_0x1de4b8[_0x59ad('0x31')];if(!_0x534018['query'][_0x59ad('0x41')]('nolimit')){_0x46c118[_0x59ad('0x12')]=qs[_0x59ad('0x12')](_0x534018[_0x59ad('0x2d')][_0x59ad('0x12')]);_0x46c118[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x534018[_0x59ad('0x2d')]['offset']);}return _0x57ad3e[_0x59ad('0x50')](_0x46c118);}})[_0x59ad('0x17')](function(_0x19d5f8){if(_0x19d5f8){return _0x19d5f8?{'count':_0x3922d8,'rows':_0x19d5f8}:null;}})[_0x59ad('0x17')](respondWithResult(_0x31c016,null))[_0x59ad('0x29')](handleError(_0x31c016,null));};exports[_0x59ad('0x53')]=function(_0x2d91dd,_0xba670a){var _0x5365ea=_0x2d91dd[_0x59ad('0x3a')][_0x59ad('0x54')];return db[_0x59ad('0x51')][_0x59ad('0x28')]({'where':{'id':_0x5365ea},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x59ad('0x1e'),'online','voicePause','interface'],'raw':!![]}]})[_0x59ad('0x17')](function(_0x299a0a){if(_0x299a0a){var _0x54e0c5=_[_0x59ad('0x55')](_0x299a0a,function(_0x5fe402){var _0x795183=_0x5fe402[_0x59ad('0x19')]({'plain':!![]});return _0x795183[_0x59ad('0x56')];});return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x2d91dd[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](function(_0x7474b6){return db[_0x59ad('0x57')][_0x59ad('0x58')](function(_0x4f03a2){return _0x7474b6[_0x59ad('0x53')](_0x5365ea,{'transaction':_0x4f03a2})[_0x59ad('0x17')](function(){return BPromise[_0x59ad('0x59')](_0x54e0c5,function(_0x18ea80){return db[_0x59ad('0x3f')][_0x59ad('0x5a')]({'where':{'UserId':_0x18ea80['id'],'MailQueueId':_0x2d91dd[_0x59ad('0x3b')]['id']},'transaction':_0x4f03a2});});})[_0x59ad('0x17')](function(){_0x54e0c5[_0x59ad('0x5b')](function(_0x4ec590){socket['emit'](_0x59ad('0x5c'),{'UserId':_0x4ec590['id'],'MailQueueId':_0x7474b6['id']});});});});});}})[_0x59ad('0x17')](respondWithStatusCode(_0xba670a,null))[_0x59ad('0x29')](handleError(_0xba670a,null));};exports[_0x59ad('0x5d')]=function(_0x52f672,_0x5b99d7){return db[_0x59ad('0x51')]['findAll']({'where':{'id':_0x52f672[_0x59ad('0x2d')][_0x59ad('0x54')]},'attributes':['id'],'include':[{'model':db[_0x59ad('0x47')],'as':_0x59ad('0x56'),'attributes':['id'],'raw':!![]}]})[_0x59ad('0x17')](handleEntityNotFound(_0x5b99d7,null))[_0x59ad('0x17')](function(_0x5c2953){var _0x4c8998=_['map'](_0x5c2953,'id');var _0x2f4bff=[];var _0x405535=[];var _0x12c547=squel[_0x59ad('0x5e')]();_0x12c547[_0x59ad('0x5f')](_0x59ad('0x60'))[_0x59ad('0x61')]('team_has_mail_queues','tq')[_0x59ad('0x62')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x59ad('0x26')](_0x59ad('0x63'),_0x52f672['params']['id']);for(var _0x9da32c=0x0;_0x9da32c<_0x5c2953['length'];_0x9da32c+=0x1){let _0x318a4c=_0x5c2953[_0x9da32c];for(var _0x3dee4b=0x0;_0x3dee4b<_0x318a4c[_0x59ad('0x56')][_0x59ad('0x31')];_0x3dee4b+=0x1){let _0xc766dc=_0x318a4c[_0x59ad('0x56')][_0x3dee4b];var _0x1a9fdd=_0x12c547[_0x59ad('0x64')]();_0x1a9fdd[_0x59ad('0x26')]('ut.UserId\x20=\x20?',_0xc766dc['id']);_0x405535[_0x59ad('0x65')](db['sequelize']['query'](_0x1a9fdd[_0x59ad('0x66')](),{'type':db['sequelize'][_0x59ad('0x67')][_0x59ad('0x68')]})['then'](function(_0x19370d){if(_0x19370d[_0x59ad('0x31')]===0x1){return _0xc766dc['id'];}else{var _0x523303=_[_0x59ad('0x69')](_['map'](_0x19370d,_0x59ad('0x6a')),function(_0x4ac404){return _[_0x59ad('0x6b')](_0x4c8998,_0x4ac404);});if(_0x523303){return _0xc766dc['id'];}}}));}}return BPromise['all'](_0x405535)[_0x59ad('0x17')](function(_0x36cbfa){_0x2f4bff=_(_0x2f4bff)[_0x59ad('0x6c')](_0x36cbfa)['compact']()['value']();return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x52f672[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](function(_0x2b1ba6){return db[_0x59ad('0x57')][_0x59ad('0x58')](function(_0x490867){return _0x2b1ba6[_0x59ad('0x5d')](_0x52f672[_0x59ad('0x2d')][_0x59ad('0x54')],{'transaction':_0x490867})['then'](function(){if(!_[_0x59ad('0x6d')](_0x2f4bff)){return _0x2b1ba6[_0x59ad('0x6e')](_0x2f4bff,{'transaction':_0x490867});}})[_0x59ad('0x17')](function(){_0x2f4bff[_0x59ad('0x5b')](function(_0x43d40d){socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':_0x43d40d,'MailQueueId':_0x2b1ba6['id']});});});});});});})[_0x59ad('0x17')](respondWithStatusCode(_0x5b99d7,null))['catch'](handleError(_0x5b99d7,null));};exports[_0x59ad('0x71')]=function(_0x517c65,_0x4d5cff){return db['MailQueue'][_0x59ad('0x38')]({'where':{'id':_0x517c65[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x4d5cff,null))[_0x59ad('0x17')](function(_0x3e8a51){if(_0x3e8a51){return _0x3e8a51[_0x59ad('0x71')](_0x517c65[_0x59ad('0x3a')][_0x59ad('0x54')],_[_0x59ad('0x72')](_0x517c65[_0x59ad('0x3a')],[_0x59ad('0x54'),'id'])||{})['spread'](function(_0x2b7f25){for(var _0x3cc6e3=0x0;_0x3cc6e3<_0x517c65[_0x59ad('0x3a')][_0x59ad('0x54')]['length'];_0x3cc6e3+=0x1){socket[_0x59ad('0x6f')](_0x59ad('0x5c'),{'UserId':Number(_0x517c65['body'][_0x59ad('0x54')][_0x3cc6e3]),'MailQueueId':Number(_0x517c65[_0x59ad('0x3b')]['id'])});}return _0x2b7f25;});}})[_0x59ad('0x17')](respondWithResult(_0x4d5cff,null))[_0x59ad('0x29')](handleError(_0x4d5cff,null));};exports[_0x59ad('0x6e')]=function(_0x5a9623,_0xe9f953){return db[_0x59ad('0x21')][_0x59ad('0x38')]({'where':{'id':_0x5a9623[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0xe9f953,null))[_0x59ad('0x17')](function(_0x1d2611){if(_0x1d2611){return _0x1d2611[_0x59ad('0x6e')](_0x5a9623['query'][_0x59ad('0x54')])[_0x59ad('0x17')](function(){if(_[_0x59ad('0x73')](_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')])){for(var _0x499984=0x0;_0x499984<_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')][_0x59ad('0x31')];_0x499984+=0x1){socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':Number(_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')][_0x499984]),'MailQueueId':Number(_0x5a9623[_0x59ad('0x3b')]['id'])});}}else{socket[_0x59ad('0x6f')](_0x59ad('0x70'),{'UserId':Number(_0x5a9623[_0x59ad('0x2d')][_0x59ad('0x54')]),'MailQueueId':Number(_0x5a9623[_0x59ad('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0xe9f953,null))[_0x59ad('0x29')](handleError(_0xe9f953,null));};exports[_0x59ad('0x74')]=function(_0x4f3447,_0x54baac){var _0x2eba33={};var _0x33ad33={};var _0x8ece02;var _0x47abf4;return db[_0x59ad('0x21')][_0x59ad('0x3e')]({'where':{'id':_0x4f3447[_0x59ad('0x3b')]['id']}})[_0x59ad('0x17')](handleEntityNotFound(_0x54baac,null))['then'](function(_0x4a2304){if(_0x4a2304){_0x8ece02=_0x4a2304;_0x33ad33['model']=_[_0x59ad('0x2c')](db[_0x59ad('0x47')][_0x59ad('0x22')]);_0x33ad33['query']=_[_0x59ad('0x2c')](_0x4f3447[_0x59ad('0x2d')]);_0x33ad33[_0x59ad('0x40')]=_['intersection'](_0x33ad33[_0x59ad('0x2b')],_0x33ad33[_0x59ad('0x2d')]);_0x2eba33[_0x59ad('0x2e')]=_['intersection'](_0x33ad33[_0x59ad('0x2b')],qs[_0x59ad('0x30')](_0x4f3447[_0x59ad('0x2d')]['fields']));_0x2eba33[_0x59ad('0x2e')]=_0x2eba33[_0x59ad('0x2e')]['length']?_0x2eba33[_0x59ad('0x2e')]:_0x33ad33[_0x59ad('0x2b')];_0x2eba33['order']=qs['sort'](_0x4f3447[_0x59ad('0x2d')]['sort']);_0x2eba33[_0x59ad('0x26')]=qs['filters'](_[_0x59ad('0x45')](_0x4f3447['query'],_0x33ad33[_0x59ad('0x40')]));if(_0x4f3447['query'][_0x59ad('0x46')]){_0x2eba33[_0x59ad('0x26')]=_[_0x59ad('0x33')](_0x2eba33[_0x59ad('0x26')],{'$or':_[_0x59ad('0x20')](_0x2eba33['attributes'],function(_0x653ce7){var _0x40171a={};_0x40171a[_0x653ce7]={'$like':'%'+_0x4f3447[_0x59ad('0x2d')][_0x59ad('0x46')]+'%'};return _0x40171a;})});}_0x2eba33=_[_0x59ad('0x33')]({},_0x2eba33,_0x4f3447[_0x59ad('0x52')]);return _0x8ece02[_0x59ad('0x74')](_0x2eba33);}})[_0x59ad('0x17')](function(_0x2dc760){if(_0x2dc760){_0x47abf4=_0x2dc760[_0x59ad('0x31')];if(!_0x4f3447[_0x59ad('0x2d')][_0x59ad('0x41')](_0x59ad('0x42'))){_0x2eba33['limit']=qs[_0x59ad('0x12')](_0x4f3447['query'][_0x59ad('0x12')]);_0x2eba33[_0x59ad('0x10')]=qs[_0x59ad('0x10')](_0x4f3447[_0x59ad('0x2d')]['offset']);}return _0x8ece02[_0x59ad('0x74')](_0x2eba33);}})[_0x59ad('0x17')](function(_0x54cdd5){if(_0x54cdd5){return _0x54cdd5?{'count':_0x47abf4,'rows':_0x54cdd5}:null;}})[_0x59ad('0x17')](respondWithResult(_0x54baac,null))[_0x59ad('0x29')](handleError(_0x54baac,null));}; \ No newline at end of file +var _0x007a=['autoAssociation','params','describe','findOne','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','merge','User','findAndCountAll','map','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','get','MailQueues','error','stack','name','send','MailQueue','rawAttributes','fieldName','getOptions','where','include','query','findAll','rows','catch','show','model','keys','filters','intersection','attributes','fields','options','find','create','body','user','role','UserProfileSection','userProfileId'];(function(_0x2e4767,_0xd28596){var _0xb3570=function(_0x593332){while(--_0x593332){_0x2e4767['push'](_0x2e4767['shift']());}};_0xb3570(++_0xd28596);}(_0x007a,0x1a1));var _0xa007=function(_0x568d30,_0x50fceb){_0x568d30=_0x568d30-0x0;var _0xabb817=_0x007a[_0x568d30];return _0xabb817;};'use strict';var BPromise=require(_0xa007('0x0'));var util=require(_0xa007('0x1'));var _=require('lodash');var squel=require(_0xa007('0x2'));var Redis=require(_0xa007('0x3'));var qs=require(_0xa007('0x4'));var logger=require(_0xa007('0x5'))('api');var config=require(_0xa007('0x6'));var db=require('../../mysqldb')['db'];config[_0xa007('0x7')]=_['defaults'](config['redis'],{'host':_0xa007('0x8'),'port':0x18eb});var socket=require(_0xa007('0x9'))(new Redis(config[_0xa007('0x7')]));require(_0xa007('0xa'))[_0xa007('0xb')](socket);function respondWithStatusCode(_0x261a4c,_0x45620e){_0x45620e=_0x45620e||0xcc;return function(_0x4dfebe){if(_0x4dfebe){return _0x261a4c[_0xa007('0xc')](_0x45620e);}return _0x261a4c[_0xa007('0xd')](_0x45620e)[_0xa007('0xe')]();};}function respondWithResult(_0x9d3332,_0x2a9ae9){_0x2a9ae9=_0x2a9ae9||0xc8;return function(_0xf0c250){if(_0xf0c250){return _0x9d3332[_0xa007('0xd')](_0x2a9ae9)[_0xa007('0xf')](_0xf0c250);}};}function respondWithFilteredResult(_0x2c2e1,_0x57e5e0){return function(_0x491bd1){if(_0x491bd1){var _0xa0ac1c=typeof _0x57e5e0[_0xa007('0x10')]===_0xa007('0x11')&&typeof _0x57e5e0['limit']===_0xa007('0x11');var _0x214d2e=_0x491bd1[_0xa007('0x12')];var _0x448828=_0xa0ac1c?0x0:_0x57e5e0[_0xa007('0x10')];var _0x29cbff=_0xa0ac1c?_0x491bd1[_0xa007('0x12')]:_0x57e5e0[_0xa007('0x10')]+_0x57e5e0[_0xa007('0x13')];var _0x468641;if(_0x29cbff>=_0x214d2e){_0x29cbff=_0x214d2e;_0x468641=0xc8;}else{_0x468641=0xce;}_0x2c2e1['status'](_0x468641);return _0x2c2e1[_0xa007('0x14')](_0xa007('0x15'),_0x448828+'-'+_0x29cbff+'/'+_0x214d2e)[_0xa007('0xf')](_0x491bd1);}return null;};}function saveUpdates(_0x1b20fb){return function(_0x18ad99){if(_0x18ad99){return _0x18ad99['update'](_0x1b20fb)[_0xa007('0x16')](function(_0x54f847){return _0x54f847;});}return null;};}function removeEntity(_0x4584bf){return function(_0x1f0166){if(_0x1f0166){return _0x1f0166[_0xa007('0x17')]()[_0xa007('0x16')](function(){var _0x56dd20=_0x1f0166[_0xa007('0x18')]({'plain':!![]});var _0x34cf90=_0xa007('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x34cf90,'resourceId':_0x56dd20['id']}})['then'](function(){return _0x1f0166;});})['then'](function(){_0x4584bf[_0xa007('0xd')](0xcc)[_0xa007('0xe')]();});}};}function handleEntityNotFound(_0x3d1bbc){return function(_0x68fea8){if(!_0x68fea8){_0x3d1bbc[_0xa007('0xc')](0x194);}return _0x68fea8;};}function handleError(_0x453a77,_0xfa5c1a){_0xfa5c1a=_0xfa5c1a||0x1f4;return function(_0x5c95ba){logger[_0xa007('0x1a')](_0x5c95ba[_0xa007('0x1b')]);if(_0x5c95ba['name']){delete _0x5c95ba[_0xa007('0x1c')];}_0x453a77[_0xa007('0xd')](_0xfa5c1a)[_0xa007('0x1d')](_0x5c95ba);};}exports['index']=function(_0x5af347,_0x14d52b){var _0x597ced={};var _0x3e3060={'count':0x0,'rows':[]};var _0x3c880a=_['map'](db[_0xa007('0x1e')][_0xa007('0x1f')],function(_0x2743e9){return{'name':_0x2743e9[_0xa007('0x20')],'type':_0x2743e9['type']['key']};});_0x597ced=qs[_0xa007('0x21')](_0x3c880a,_0x5af347);var _0x160420={'where':_0x597ced[_0xa007('0x22')]};return db[_0xa007('0x1e')][_0xa007('0x12')](_0x160420)[_0xa007('0x16')](function(_0x232568){_0x3e3060[_0xa007('0x12')]=_0x232568;_0x597ced['include']=qs[_0xa007('0x23')](_0x5af347[_0xa007('0x24')]);return db['MailQueue'][_0xa007('0x25')](_0x597ced);})['then'](function(_0x335c3b){_0x3e3060[_0xa007('0x26')]=_0x335c3b;return _0x3e3060;})['then'](respondWithFilteredResult(_0x14d52b,_0x597ced))[_0xa007('0x27')](handleError(_0x14d52b,null));};exports[_0xa007('0x28')]=function(_0x362ccd,_0x2d6d06){var _0x5601a9={'raw':!![],'where':{'id':_0x362ccd['params']['id']}},_0x55aaf8={};_0x55aaf8[_0xa007('0x29')]=_[_0xa007('0x2a')](db[_0xa007('0x1e')][_0xa007('0x1f')]);_0x55aaf8['query']=_['keys'](_0x362ccd['query']);_0x55aaf8[_0xa007('0x2b')]=_[_0xa007('0x2c')](_0x55aaf8['model'],_0x55aaf8[_0xa007('0x24')]);_0x5601a9[_0xa007('0x2d')]=_['intersection'](_0x55aaf8[_0xa007('0x29')],qs[_0xa007('0x2e')](_0x362ccd[_0xa007('0x24')][_0xa007('0x2e')]));_0x5601a9[_0xa007('0x2d')]=_0x5601a9[_0xa007('0x2d')]['length']?_0x5601a9[_0xa007('0x2d')]:_0x55aaf8['model'];if(_0x362ccd[_0xa007('0x24')]['includeAll']){_0x5601a9[_0xa007('0x23')]=[{'all':!![]}];}_0x5601a9=_['merge']({},_0x5601a9,_0x362ccd[_0xa007('0x2f')]);return db[_0xa007('0x1e')][_0xa007('0x30')](_0x5601a9)['then'](handleEntityNotFound(_0x2d6d06,null))[_0xa007('0x16')](respondWithResult(_0x2d6d06,null))[_0xa007('0x27')](handleError(_0x2d6d06,null));};exports['create']=function(_0x20bfca,_0x1f9d4c){return db[_0xa007('0x1e')][_0xa007('0x31')](_0x20bfca[_0xa007('0x32')],{})[_0xa007('0x16')](function(_0x345a42){var _0x41ebfa=_0x20bfca[_0xa007('0x33')][_0xa007('0x18')]({'plain':!![]});if(!_0x41ebfa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41ebfa[_0xa007('0x34')]==='user'){var _0x5f532c=_0x345a42[_0xa007('0x18')]({'plain':!![]});var _0x4e4534=_0xa007('0x19');return db[_0xa007('0x35')][_0xa007('0x30')]({'where':{'name':_0x4e4534,'userProfileId':_0x41ebfa[_0xa007('0x36')]},'raw':!![]})[_0xa007('0x16')](function(_0x52d563){if(_0x52d563&&_0x52d563[_0xa007('0x37')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f532c[_0xa007('0x1c')],'resourceId':_0x5f532c['id'],'type':_0x52d563[_0xa007('0x1c')],'sectionId':_0x52d563['id']},{})['then'](function(){return _0x345a42;});}else{return _0x345a42;}})[_0xa007('0x27')](function(_0x38fb13){logger[_0xa007('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38fb13);throw _0x38fb13;});}return _0x345a42;})[_0xa007('0x16')](respondWithResult(_0x1f9d4c,0xc9))['catch'](handleError(_0x1f9d4c,null));};exports['update']=function(_0xca659d,_0x48c4d3){if(_0xca659d['body']['id']){delete _0xca659d['body']['id'];}return db[_0xa007('0x1e')]['find']({'where':{'id':_0xca659d[_0xa007('0x38')]['id']}})['then'](handleEntityNotFound(_0x48c4d3,null))['then'](saveUpdates(_0xca659d['body'],null))[_0xa007('0x16')](respondWithResult(_0x48c4d3,null))[_0xa007('0x27')](handleError(_0x48c4d3,null));};exports[_0xa007('0x17')]=function(_0x29d3bc,_0x154153){return db[_0xa007('0x1e')][_0xa007('0x30')]({'where':{'id':_0x29d3bc['params']['id']}})['then'](handleEntityNotFound(_0x154153,null))[_0xa007('0x16')](removeEntity(_0x154153,null))[_0xa007('0x27')](handleError(_0x154153,null));};exports['describe']=function(_0x439af2,_0x3fbc90){return db['MailQueue'][_0xa007('0x39')]()['then'](respondWithResult(_0x3fbc90,null))['catch'](handleError(_0x3fbc90,null));};exports['getMembers']=function(_0x2e62a4,_0x12b3ec){var _0x260c78={'raw':!![],'where':{}},_0x266fc0={},_0x5a981d;return db[_0xa007('0x1e')][_0xa007('0x3a')]({'where':{'id':_0x2e62a4[_0xa007('0x38')]['id']}})[_0xa007('0x16')](handleEntityNotFound(_0x12b3ec,null))['then'](function(_0x5141a9){if(_0x5141a9){_0x5a981d=_0x5141a9[_0xa007('0x18')]({'plain':!![]});_0x266fc0['model']=_[_0xa007('0x2a')](db[_0xa007('0x3b')][_0xa007('0x1f')]);_0x266fc0[_0xa007('0x24')]=_[_0xa007('0x2a')](_0x2e62a4[_0xa007('0x24')]);_0x266fc0[_0xa007('0x2b')]=_['intersection'](_0x266fc0[_0xa007('0x29')],_0x266fc0[_0xa007('0x24')]);_0x260c78[_0xa007('0x2d')]=_['intersection'](_0x266fc0[_0xa007('0x29')],qs[_0xa007('0x2e')](_0x2e62a4[_0xa007('0x24')][_0xa007('0x2e')]));_0x260c78[_0xa007('0x2d')]=_0x260c78['attributes'][_0xa007('0x3c')]?_0x260c78['attributes']:_0x266fc0[_0xa007('0x29')];if(!_0x2e62a4[_0xa007('0x24')][_0xa007('0x3d')](_0xa007('0x3e'))){_0x260c78[_0xa007('0x13')]=qs[_0xa007('0x13')](_0x2e62a4['query'][_0xa007('0x13')]);_0x260c78['offset']=qs[_0xa007('0x10')](_0x2e62a4['query'][_0xa007('0x10')]);}_0x260c78[_0xa007('0x3f')]=qs[_0xa007('0x40')](_0x2e62a4[_0xa007('0x24')]['sort']);_0x260c78[_0xa007('0x22')]=qs[_0xa007('0x2b')](_[_0xa007('0x41')](_0x2e62a4[_0xa007('0x24')],_0x266fc0[_0xa007('0x2b')]));_0x260c78[_0xa007('0x22')][_0xa007('0x42')]=_0x5141a9['id'];if(_0x2e62a4[_0xa007('0x24')][_0xa007('0x43')]){_0x260c78[_0xa007('0x22')]=_[_0xa007('0x44')](_0x260c78[_0xa007('0x22')],{'$or':_['map'](_0x260c78[_0xa007('0x2d')],function(_0xba0a11){var _0x2baa95={};_0x2baa95[_0xba0a11]={'$like':'%'+_0x2e62a4[_0xa007('0x24')][_0xa007('0x43')]+'%'};return _0x2baa95;})});}_0x260c78=_['merge']({},_0x260c78,_0x2e62a4[_0xa007('0x2f')]);return db[_0xa007('0x3b')][_0xa007('0x25')](_0x260c78);}})[_0xa007('0x16')](function(_0xa8c0e0){if(_0xa8c0e0){return db[_0xa007('0x45')][_0xa007('0x46')]({'where':{'id':_[_0xa007('0x47')](_0xa8c0e0,'UserId'),'role':'agent'},'attributes':['id','name',_0xa007('0x48'),_0xa007('0x49'),_0xa007('0x4a')]});}})[_0xa007('0x16')](function(_0x25e22a){if(_0x25e22a){return{'count':_0x25e22a[_0xa007('0x12')],'rows':_['map'](_0x25e22a[_0xa007('0x26')],function(_0x30787d){return{'membername':_0x30787d[_0xa007('0x1c')],'UserId':_0x30787d['id'],'queue_name':_0x5a981d[_0xa007('0x1c')],'MailQueueId':_0x5a981d['id'],'interface':util[_0xa007('0x4b')](_0xa007('0x4c'),_0xa007('0x4d'),_0x30787d[_0xa007('0x1c')]),'penalty':0x0,'paused':_0x30787d[_0xa007('0x48')],'createdAt':_0x30787d[_0xa007('0x4a')],'updatedAt':_0x30787d[_0xa007('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x12b3ec,_0x260c78))[_0xa007('0x27')](handleError(_0x12b3ec,null));};exports[_0xa007('0x4e')]=function(_0x3ef6af,_0x4d72e8){var _0x38cc0d={};var _0x119d25={};var _0x41f41c;var _0x5efb7d;return db[_0xa007('0x1e')][_0xa007('0x3a')]({'where':{'id':_0x3ef6af[_0xa007('0x38')]['id']}})[_0xa007('0x16')](handleEntityNotFound(_0x4d72e8,null))[_0xa007('0x16')](function(_0x3366c1){if(_0x3366c1){_0x41f41c=_0x3366c1;_0x119d25['model']=_[_0xa007('0x2a')](db[_0xa007('0x4f')][_0xa007('0x1f')]);_0x119d25['query']=_[_0xa007('0x2a')](_0x3ef6af[_0xa007('0x24')]);_0x119d25['filters']=_[_0xa007('0x2c')](_0x119d25[_0xa007('0x29')],_0x119d25['query']);_0x38cc0d[_0xa007('0x2d')]=_[_0xa007('0x2c')](_0x119d25['model'],qs[_0xa007('0x2e')](_0x3ef6af[_0xa007('0x24')][_0xa007('0x2e')]));_0x38cc0d[_0xa007('0x2d')]=_0x38cc0d[_0xa007('0x2d')][_0xa007('0x3c')]?_0x38cc0d[_0xa007('0x2d')]:_0x119d25[_0xa007('0x29')];_0x38cc0d[_0xa007('0x3f')]=qs[_0xa007('0x40')](_0x3ef6af[_0xa007('0x24')]['sort']);_0x38cc0d[_0xa007('0x22')]=qs['filters'](_[_0xa007('0x41')](_0x3ef6af['query'],_0x119d25['filters']));if(_0x3ef6af[_0xa007('0x24')][_0xa007('0x43')]){_0x38cc0d[_0xa007('0x22')]=_[_0xa007('0x44')](_0x38cc0d[_0xa007('0x22')],{'$or':_[_0xa007('0x47')](_0x38cc0d[_0xa007('0x2d')],function(_0x2a93bf){var _0x4a67e1={};_0x4a67e1[_0x2a93bf]={'$like':'%'+_0x3ef6af['query'][_0xa007('0x43')]+'%'};return _0x4a67e1;})});}_0x38cc0d=_['merge']({},_0x38cc0d,_0x3ef6af[_0xa007('0x2f')]);return _0x41f41c[_0xa007('0x4e')](_0x38cc0d);}})[_0xa007('0x16')](function(_0x5371e4){if(_0x5371e4){_0x5efb7d=_0x5371e4['length'];if(!_0x3ef6af[_0xa007('0x24')][_0xa007('0x3d')](_0xa007('0x3e'))){_0x38cc0d[_0xa007('0x13')]=qs[_0xa007('0x13')](_0x3ef6af[_0xa007('0x24')][_0xa007('0x13')]);_0x38cc0d[_0xa007('0x10')]=qs['offset'](_0x3ef6af[_0xa007('0x24')][_0xa007('0x10')]);}return _0x41f41c[_0xa007('0x4e')](_0x38cc0d);}})[_0xa007('0x16')](function(_0xa20148){if(_0xa20148){return _0xa20148?{'count':_0x5efb7d,'rows':_0xa20148}:null;}})[_0xa007('0x16')](respondWithResult(_0x4d72e8,null))[_0xa007('0x27')](handleError(_0x4d72e8,null));};exports[_0xa007('0x50')]=function(_0x404142,_0x24384d){var _0x250623=_0x404142[_0xa007('0x32')][_0xa007('0x51')];return db['Team'][_0xa007('0x25')]({'where':{'id':_0x250623},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xa007('0x52'),'voicePause',_0xa007('0x53')],'raw':!![]}]})[_0xa007('0x16')](function(_0x10158e){if(_0x10158e){var _0x5226f8=_[_0xa007('0x54')](_0x10158e,function(_0x362ec6){var _0x80710f=_0x362ec6[_0xa007('0x18')]({'plain':!![]});return _0x80710f[_0xa007('0x55')];});return db[_0xa007('0x1e')][_0xa007('0x30')]({'where':{'id':_0x404142[_0xa007('0x38')]['id']}})[_0xa007('0x16')](function(_0x4cf5eb){return db['sequelize'][_0xa007('0x56')](function(_0x5ca679){return _0x4cf5eb['addTeams'](_0x250623,{'transaction':_0x5ca679})['then'](function(){return BPromise[_0xa007('0x57')](_0x5226f8,function(_0x47ccd2){return db[_0xa007('0x3b')][_0xa007('0x58')]({'where':{'UserId':_0x47ccd2['id'],'MailQueueId':_0x404142[_0xa007('0x38')]['id']},'transaction':_0x5ca679});});})[_0xa007('0x16')](function(){_0x5226f8[_0xa007('0x59')](function(_0x261158){socket[_0xa007('0x5a')](_0xa007('0x5b'),{'UserId':_0x261158['id'],'MailQueueId':_0x4cf5eb['id']});});});});});}})[_0xa007('0x16')](respondWithStatusCode(_0x24384d,null))[_0xa007('0x27')](handleError(_0x24384d,null));};exports['removeTeams']=function(_0x5a9af9,_0x507161){return db['Team'][_0xa007('0x25')]({'where':{'id':_0x5a9af9[_0xa007('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa007('0x45')],'as':_0xa007('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x507161,null))['then'](function(_0x30ea2f){var _0x323366=_[_0xa007('0x47')](_0x30ea2f,'id');var _0x177ff3=[];var _0x554a1f=[];var _0x5696d4=squel[_0xa007('0x5c')]();_0x5696d4[_0xa007('0x5d')](_0xa007('0x5e'))[_0xa007('0x5f')](_0xa007('0x60'),'tq')[_0xa007('0x61')](_0xa007('0x62'),'ut',_0xa007('0x63'))[_0xa007('0x22')]('MailQueueId\x20=\x20?',_0x5a9af9[_0xa007('0x38')]['id']);for(var _0x4d75de=0x0;_0x4d75de<_0x30ea2f[_0xa007('0x3c')];_0x4d75de+=0x1){let _0x4c17=_0x30ea2f[_0x4d75de];for(var _0x2f60a3=0x0;_0x2f60a3<_0x4c17[_0xa007('0x55')]['length'];_0x2f60a3+=0x1){let _0x18a96e=_0x4c17[_0xa007('0x55')][_0x2f60a3];var _0x16e156=_0x5696d4['clone']();_0x16e156[_0xa007('0x22')](_0xa007('0x64'),_0x18a96e['id']);_0x554a1f[_0xa007('0x65')](db[_0xa007('0x66')][_0xa007('0x24')](_0x16e156[_0xa007('0x67')](),{'type':db[_0xa007('0x66')]['QueryTypes'][_0xa007('0x68')]})['then'](function(_0x32ed7b){if(_0x32ed7b[_0xa007('0x3c')]===0x1){return _0x18a96e['id'];}else{var _0x3f87a5=_[_0xa007('0x69')](_[_0xa007('0x47')](_0x32ed7b,_0xa007('0x6a')),function(_0x690604){return _[_0xa007('0x6b')](_0x323366,_0x690604);});if(_0x3f87a5){return _0x18a96e['id'];}}}));}}return BPromise[_0xa007('0x6c')](_0x554a1f)[_0xa007('0x16')](function(_0x4b1299){_0x177ff3=_(_0x177ff3)[_0xa007('0x6d')](_0x4b1299)['compact']()['value']();return db['MailQueue'][_0xa007('0x30')]({'where':{'id':_0x5a9af9[_0xa007('0x38')]['id']}})[_0xa007('0x16')](function(_0x223a8c){return db['sequelize']['transaction'](function(_0x554768){return _0x223a8c[_0xa007('0x6e')](_0x5a9af9['query'][_0xa007('0x51')],{'transaction':_0x554768})[_0xa007('0x16')](function(){if(!_[_0xa007('0x6f')](_0x177ff3)){return _0x223a8c[_0xa007('0x70')](_0x177ff3,{'transaction':_0x554768});}})[_0xa007('0x16')](function(){_0x177ff3['forEach'](function(_0xc17717){socket[_0xa007('0x5a')](_0xa007('0x71'),{'UserId':_0xc17717,'MailQueueId':_0x223a8c['id']});});});});});});})['then'](respondWithStatusCode(_0x507161,null))['catch'](handleError(_0x507161,null));};exports[_0xa007('0x72')]=function(_0x181140,_0x29e2e4){return db[_0xa007('0x1e')][_0xa007('0x30')]({'where':{'id':_0x181140[_0xa007('0x38')]['id']}})['then'](handleEntityNotFound(_0x29e2e4,null))['then'](function(_0x186431){if(_0x186431){return _0x186431[_0xa007('0x72')](_0x181140['body'][_0xa007('0x51')],_['omit'](_0x181140[_0xa007('0x32')],[_0xa007('0x51'),'id'])||{})[_0xa007('0x73')](function(_0x7583d0){for(var _0x209b65=0x0;_0x209b65<_0x181140[_0xa007('0x32')][_0xa007('0x51')][_0xa007('0x3c')];_0x209b65+=0x1){socket[_0xa007('0x5a')](_0xa007('0x5b'),{'UserId':Number(_0x181140[_0xa007('0x32')][_0xa007('0x51')][_0x209b65]),'MailQueueId':Number(_0x181140[_0xa007('0x38')]['id'])});}return _0x7583d0;});}})[_0xa007('0x16')](respondWithResult(_0x29e2e4,null))['catch'](handleError(_0x29e2e4,null));};exports[_0xa007('0x70')]=function(_0x506b77,_0x372879){return db[_0xa007('0x1e')][_0xa007('0x30')]({'where':{'id':_0x506b77['params']['id']}})['then'](handleEntityNotFound(_0x372879,null))['then'](function(_0x64836){if(_0x64836){return _0x64836['removeAgents'](_0x506b77[_0xa007('0x24')][_0xa007('0x51')])[_0xa007('0x16')](function(){if(_[_0xa007('0x74')](_0x506b77[_0xa007('0x24')][_0xa007('0x51')])){for(var _0x59dd44=0x0;_0x59dd44<_0x506b77['query'][_0xa007('0x51')]['length'];_0x59dd44+=0x1){socket['emit'](_0xa007('0x71'),{'UserId':Number(_0x506b77[_0xa007('0x24')][_0xa007('0x51')][_0x59dd44]),'MailQueueId':Number(_0x506b77[_0xa007('0x38')]['id'])});}}else{socket['emit'](_0xa007('0x71'),{'UserId':Number(_0x506b77[_0xa007('0x24')][_0xa007('0x51')]),'MailQueueId':Number(_0x506b77['params']['id'])});}});}})[_0xa007('0x16')](respondWithStatusCode(_0x372879,null))['catch'](handleError(_0x372879,null));};exports[_0xa007('0x75')]=function(_0xb3f2b2,_0x4053bb){var _0x1db5b6={};var _0x4f40ac={};var _0x421fec;var _0x48406b;return db[_0xa007('0x1e')]['findOne']({'where':{'id':_0xb3f2b2['params']['id']}})[_0xa007('0x16')](handleEntityNotFound(_0x4053bb,null))['then'](function(_0x1fb625){if(_0x1fb625){_0x421fec=_0x1fb625;_0x4f40ac[_0xa007('0x29')]=_[_0xa007('0x2a')](db[_0xa007('0x45')][_0xa007('0x1f')]);_0x4f40ac[_0xa007('0x24')]=_[_0xa007('0x2a')](_0xb3f2b2[_0xa007('0x24')]);_0x4f40ac['filters']=_[_0xa007('0x2c')](_0x4f40ac[_0xa007('0x29')],_0x4f40ac[_0xa007('0x24')]);_0x1db5b6[_0xa007('0x2d')]=_[_0xa007('0x2c')](_0x4f40ac[_0xa007('0x29')],qs[_0xa007('0x2e')](_0xb3f2b2[_0xa007('0x24')][_0xa007('0x2e')]));_0x1db5b6[_0xa007('0x2d')]=_0x1db5b6[_0xa007('0x2d')][_0xa007('0x3c')]?_0x1db5b6[_0xa007('0x2d')]:_0x4f40ac['model'];_0x1db5b6[_0xa007('0x3f')]=qs[_0xa007('0x40')](_0xb3f2b2['query'][_0xa007('0x40')]);_0x1db5b6[_0xa007('0x22')]=qs['filters'](_[_0xa007('0x41')](_0xb3f2b2[_0xa007('0x24')],_0x4f40ac[_0xa007('0x2b')]));if(_0xb3f2b2[_0xa007('0x24')][_0xa007('0x43')]){_0x1db5b6['where']=_['merge'](_0x1db5b6[_0xa007('0x22')],{'$or':_[_0xa007('0x47')](_0x1db5b6['attributes'],function(_0x44e166){var _0x4f5394={};_0x4f5394[_0x44e166]={'$like':'%'+_0xb3f2b2[_0xa007('0x24')]['filter']+'%'};return _0x4f5394;})});}_0x1db5b6=_[_0xa007('0x44')]({},_0x1db5b6,_0xb3f2b2[_0xa007('0x2f')]);return _0x421fec[_0xa007('0x75')](_0x1db5b6);}})['then'](function(_0x1c5bbb){if(_0x1c5bbb){_0x48406b=_0x1c5bbb[_0xa007('0x3c')];if(!_0xb3f2b2[_0xa007('0x24')][_0xa007('0x3d')](_0xa007('0x3e'))){_0x1db5b6['limit']=qs[_0xa007('0x13')](_0xb3f2b2[_0xa007('0x24')][_0xa007('0x13')]);_0x1db5b6[_0xa007('0x10')]=qs[_0xa007('0x10')](_0xb3f2b2[_0xa007('0x24')][_0xa007('0x10')]);}return _0x421fec[_0xa007('0x75')](_0x1db5b6);}})['then'](function(_0x397b7c){if(_0x397b7c){return _0x397b7c?{'count':_0x48406b,'rows':_0x397b7c}:null;}})[_0xa007('0x16')](respondWithResult(_0x4053bb,null))[_0xa007('0x27')](handleError(_0x4053bb,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c1f4ffe..706e51a 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 _0x33e1=['../../mysqldb','MailQueue','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d858b,_0x1bc7a4){var _0x567043=function(_0xb34b20){while(--_0xb34b20){_0x4d858b['push'](_0x4d858b['shift']());}};_0x567043(++_0x1bc7a4);}(_0x33e1,0x167));var _0x133e=function(_0x252aa5,_0x3971b5){_0x252aa5=_0x252aa5-0x0;var _0x1f44d6=_0x33e1[_0x252aa5];return _0x1f44d6;};'use strict';var EventEmitter=require(_0x133e('0x0'));var MailQueue=require(_0x133e('0x1'))['db'][_0x133e('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x133e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x161201){return function(_0x54e5b0,_0x47a1bf,_0x131f46){MailQueueEvents['emit'](_0x161201+':'+_0x54e5b0['id'],_0x54e5b0);MailQueueEvents[_0x133e('0x4')](_0x161201,_0x54e5b0);_0x131f46(null);};}for(var e in events){if(events[_0x133e('0x5')](e)){var event=events[e];MailQueue[_0x133e('0x6')](e,emitEvent(event));}}module[_0x133e('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x2646=['hasOwnProperty','hook','MailQueue','setMaxListeners','update','remove'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0x2646,0x17c));var _0x6264=function(_0x9077a4,_0x41748c){_0x9077a4=_0x9077a4-0x0;var _0x204bdc=_0x2646[_0x9077a4];return _0x204bdc;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x6264('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6264('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6264('0x2'),'afterDestroy':_0x6264('0x3')};function emitEvent(_0x59ab61){return function(_0x2ceaef,_0x3f689a,_0x307626){MailQueueEvents['emit'](_0x59ab61+':'+_0x2ceaef['id'],_0x2ceaef);MailQueueEvents['emit'](_0x59ab61,_0x2ceaef);_0x307626(null);};}for(var e in events){if(events[_0x6264('0x4')](e)){var event=events[e];MailQueue[_0x6264('0x5')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 4930de4..e5abb8c 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 _0x8b0e=['./mailQueue.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x8b0e,0x1dc));var _0xe8b0=function(_0x3399bb,_0x5e7c53){_0x3399bb=_0x3399bb-0x0;var _0x1afd51=_0x8b0e[_0x3399bb];return _0x1afd51;};'use strict';var _=require(_0xe8b0('0x0'));var util=require('util');var logger=require(_0xe8b0('0x1'))(_0xe8b0('0x2'));var moment=require(_0xe8b0('0x3'));var BPromise=require(_0xe8b0('0x4'));var rp=require(_0xe8b0('0x5'));var fs=require('fs');var path=require(_0xe8b0('0x6'));var rimraf=require('rimraf');var config=require(_0xe8b0('0x7'));var attributes=require(_0xe8b0('0x8'));module[_0xe8b0('0x9')]=function(_0x3f0176,_0x42e549){return _0x3f0176[_0xe8b0('0xa')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b23=['rimraf','../../config/environment','./mailQueue.attributes','define','mail_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b23,0xb5));var _0x35b2=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0x5b23[_0x312962];return _0x3e85d0;};'use strict';var _=require('lodash');var util=require(_0x35b2('0x0'));var logger=require(_0x35b2('0x1'))(_0x35b2('0x2'));var moment=require(_0x35b2('0x3'));var BPromise=require(_0x35b2('0x4'));var rp=require(_0x35b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35b2('0x6'));var config=require(_0x35b2('0x7'));var attributes=require(_0x35b2('0x8'));module['exports']=function(_0x23298b,_0x12db54){return _0x23298b[_0x35b2('0x9')]('MailQueue',attributes,{'tableName':_0x35b2('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 b638229..e1401d3 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 _0xffbc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','findAll','options','where','attributes','limit','map','include','model','catch','MailQueue','find','raw','ShowMailQueue','lodash','util','moment'];(function(_0x6fb392,_0x254831){var _0x317c4b=function(_0x19994c){while(--_0x19994c){_0x6fb392['push'](_0x6fb392['shift']());}};_0x317c4b(++_0x254831);}(_0xffbc,0x14d));var _0xcffb=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xffbc[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xcffb('0x0'));var util=require(_0xcffb('0x1'));var moment=require(_0xcffb('0x2'));var BPromise=require(_0xcffb('0x3'));var rs=require(_0xcffb('0x4'));var fs=require('fs');var Redis=require(_0xcffb('0x5'));var db=require(_0xcffb('0x6'))['db'];var utils=require(_0xcffb('0x7'));var logger=require(_0xcffb('0x8'))(_0xcffb('0x9'));var config=require(_0xcffb('0xa'));var jayson=require(_0xcffb('0xb'));var client=jayson[_0xcffb('0xc')]['http']({'port':0x232a});config['redis']=_[_0xcffb('0xd')](config[_0xcffb('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcffb('0xe')]));require(_0xcffb('0xf'))['register'](socket);function respondWithRpcPromise(_0x2a6a25,_0x368824,_0x3958ec){return new BPromise(function(_0x10d06d,_0x284a58){return client[_0xcffb('0x10')](_0x2a6a25,_0x3958ec)[_0xcffb('0x11')](function(_0x2e4b94){logger[_0xcffb('0x12')](_0xcffb('0x13'),_0x368824,_0xcffb('0x14'));logger[_0xcffb('0x15')](_0xcffb('0x16'),_0x368824,_0xcffb('0x14'),JSON[_0xcffb('0x17')](_0x2e4b94));if(_0x2e4b94['error']){if(_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x19')]===0x1f4){logger[_0xcffb('0x18')](_0xcffb('0x13'),_0x368824,_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x1a')]);return _0x284a58(_0x2e4b94['error'][_0xcffb('0x1a')]);}logger[_0xcffb('0x18')](_0xcffb('0x13'),_0x368824,_0x2e4b94['error'][_0xcffb('0x1a')]);return _0x10d06d(_0x2e4b94[_0xcffb('0x18')][_0xcffb('0x1a')]);}else{logger[_0xcffb('0x12')](_0xcffb('0x13'),_0x368824,_0xcffb('0x14'));_0x10d06d(_0x2e4b94[_0xcffb('0x1b')][_0xcffb('0x1a')]);}})['catch'](function(_0x2e2a2c){logger[_0xcffb('0x18')]('MailQueue,\x20%s,\x20%s',_0x368824,_0x2e2a2c);_0x284a58(_0x2e2a2c);});});}exports[_0xcffb('0x1c')]=function(_0x1caa7e){var _0x219bb3=this;return new Promise(function(_0x11dc21,_0x4209b1){return db['MailQueue'][_0xcffb('0x1d')]({'raw':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x1f')]||null:null,'attributes':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x20')]||null:null,'limit':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x21')]||null:null,'include':_0x1caa7e[_0xcffb('0x1e')]?_0x1caa7e[_0xcffb('0x1e')]['include']?_[_0xcffb('0x22')](_0x1caa7e[_0xcffb('0x1e')][_0xcffb('0x23')],function(_0x36e3df){return{'model':db[_0x36e3df[_0xcffb('0x24')]],'as':_0x36e3df['as'],'attributes':_0x36e3df[_0xcffb('0x20')],'include':_0x36e3df['include']?_['map'](_0x36e3df[_0xcffb('0x23')],function(_0x2e6b52){return{'model':db[_0x2e6b52[_0xcffb('0x24')]],'as':_0x2e6b52['as'],'attributes':_0x2e6b52[_0xcffb('0x20')],'include':_0x2e6b52[_0xcffb('0x23')]?_[_0xcffb('0x22')](_0x2e6b52[_0xcffb('0x23')],function(_0x4b137d){return{'model':db[_0x4b137d['model']],'as':_0x4b137d['as'],'attributes':_0x4b137d[_0xcffb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcffb('0x11')](function(_0x2ca24b){logger[_0xcffb('0x12')](_0xcffb('0x1c'),_0x1caa7e);logger[_0xcffb('0x15')](_0xcffb('0x1c'),_0x1caa7e,JSON['stringify'](_0x2ca24b));_0x11dc21(_0x2ca24b);})[_0xcffb('0x25')](function(_0x3245ed){logger[_0xcffb('0x18')](_0xcffb('0x1c'),_0x3245ed[_0xcffb('0x1a')],_0x1caa7e);_0x4209b1(_0x219bb3[_0xcffb('0x18')](0x1f4,_0x3245ed['message']));});});};exports['ShowMailQueue']=function(_0x4c5b38){var _0x509ea4=this;return new Promise(function(_0xa7d0f7,_0x37e67c){return db[_0xcffb('0x26')][_0xcffb('0x27')]({'raw':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x28')]===undefined?!![]:![]:!![],'where':_0x4c5b38['options']?_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x1f')]||null:null,'attributes':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')]['attributes']||null:null,'include':_0x4c5b38[_0xcffb('0x1e')]?_0x4c5b38[_0xcffb('0x1e')]['include']?_[_0xcffb('0x22')](_0x4c5b38[_0xcffb('0x1e')][_0xcffb('0x23')],function(_0x1cee22){return{'model':db[_0x1cee22[_0xcffb('0x24')]],'as':_0x1cee22['as'],'attributes':_0x1cee22[_0xcffb('0x20')],'include':_0x1cee22[_0xcffb('0x23')]?_[_0xcffb('0x22')](_0x1cee22[_0xcffb('0x23')],function(_0x1dc480){return{'model':db[_0x1dc480['model']],'as':_0x1dc480['as'],'attributes':_0x1dc480[_0xcffb('0x20')],'include':_0x1dc480['include']?_[_0xcffb('0x22')](_0x1dc480[_0xcffb('0x23')],function(_0x29661d){return{'model':db[_0x29661d[_0xcffb('0x24')]],'as':_0x29661d['as'],'attributes':_0x29661d[_0xcffb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2784b4){logger[_0xcffb('0x12')](_0xcffb('0x29'),_0x4c5b38);logger[_0xcffb('0x15')](_0xcffb('0x29'),_0x4c5b38,JSON['stringify'](_0x2784b4));_0xa7d0f7(_0x2784b4);})[_0xcffb('0x25')](function(_0x21793f){logger[_0xcffb('0x18')](_0xcffb('0x29'),_0x21793f[_0xcffb('0x1a')],_0x4c5b38);_0x37e67c(_0x509ea4[_0xcffb('0x18')](0x1f4,_0x21793f['message']));});});}; \ No newline at end of file +var _0xcb47=['message','result','catch','GetMailQueue','MailQueue','options','where','attributes','include','map','model','ShowMailQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xbf8aa9,_0x1ebcd4){var _0x24714e=function(_0x3d1e5f){while(--_0x3d1e5f){_0xbf8aa9['push'](_0xbf8aa9['shift']());}};_0x24714e(++_0x1ebcd4);}(_0xcb47,0x1d5));var _0x7cb4=function(_0x217ff6,_0x36f75d){_0x217ff6=_0x217ff6-0x0;var _0x417c93=_0xcb47[_0x217ff6];return _0x417c93;};'use strict';var _=require(_0x7cb4('0x0'));var util=require(_0x7cb4('0x1'));var moment=require(_0x7cb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cb4('0x3'));var fs=require('fs');var Redis=require(_0x7cb4('0x4'));var db=require(_0x7cb4('0x5'))['db'];var utils=require(_0x7cb4('0x6'));var logger=require(_0x7cb4('0x7'))(_0x7cb4('0x8'));var config=require(_0x7cb4('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7cb4('0xa')]({'port':0x232a});config['redis']=_[_0x7cb4('0xb')](config[_0x7cb4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cb4('0xd'))(new Redis(config[_0x7cb4('0xc')]));require(_0x7cb4('0xe'))['register'](socket);function respondWithRpcPromise(_0xa72211,_0x291758,_0x4d95fe){return new BPromise(function(_0x56c7da,_0x47fd9b){return client[_0x7cb4('0xf')](_0xa72211,_0x4d95fe)[_0x7cb4('0x10')](function(_0x4a2f31){logger[_0x7cb4('0x11')](_0x7cb4('0x12'),_0x291758,_0x7cb4('0x13'));logger[_0x7cb4('0x14')](_0x7cb4('0x15'),_0x291758,'request\x20sent',JSON[_0x7cb4('0x16')](_0x4a2f31));if(_0x4a2f31['error']){if(_0x4a2f31[_0x7cb4('0x17')][_0x7cb4('0x18')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x291758,_0x4a2f31[_0x7cb4('0x17')]['message']);return _0x47fd9b(_0x4a2f31['error'][_0x7cb4('0x19')]);}logger[_0x7cb4('0x17')]('MailQueue,\x20%s,\x20%s',_0x291758,_0x4a2f31[_0x7cb4('0x17')][_0x7cb4('0x19')]);return _0x56c7da(_0x4a2f31[_0x7cb4('0x17')][_0x7cb4('0x19')]);}else{logger['info'](_0x7cb4('0x12'),_0x291758,_0x7cb4('0x13'));_0x56c7da(_0x4a2f31[_0x7cb4('0x1a')][_0x7cb4('0x19')]);}})[_0x7cb4('0x1b')](function(_0x32e6d0){logger[_0x7cb4('0x17')](_0x7cb4('0x12'),_0x291758,_0x32e6d0);_0x47fd9b(_0x32e6d0);});});}exports[_0x7cb4('0x1c')]=function(_0x49e07c){var _0x17b7e7=this;return new Promise(function(_0x1fa599,_0xf4599e){return db[_0x7cb4('0x1d')]['findAll']({'raw':_0x49e07c[_0x7cb4('0x1e')]?_0x49e07c[_0x7cb4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x49e07c[_0x7cb4('0x1e')]?_0x49e07c[_0x7cb4('0x1e')][_0x7cb4('0x1f')]||null:null,'attributes':_0x49e07c[_0x7cb4('0x1e')]?_0x49e07c['options'][_0x7cb4('0x20')]||null:null,'limit':_0x49e07c[_0x7cb4('0x1e')]?_0x49e07c[_0x7cb4('0x1e')]['limit']||null:null,'include':_0x49e07c['options']?_0x49e07c[_0x7cb4('0x1e')][_0x7cb4('0x21')]?_[_0x7cb4('0x22')](_0x49e07c['options'][_0x7cb4('0x21')],function(_0x2fe302){return{'model':db[_0x2fe302['model']],'as':_0x2fe302['as'],'attributes':_0x2fe302[_0x7cb4('0x20')],'include':_0x2fe302[_0x7cb4('0x21')]?_[_0x7cb4('0x22')](_0x2fe302['include'],function(_0x3332ca){return{'model':db[_0x3332ca[_0x7cb4('0x23')]],'as':_0x3332ca['as'],'attributes':_0x3332ca['attributes'],'include':_0x3332ca['include']?_[_0x7cb4('0x22')](_0x3332ca[_0x7cb4('0x21')],function(_0x44490e){return{'model':db[_0x44490e[_0x7cb4('0x23')]],'as':_0x44490e['as'],'attributes':_0x44490e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cb4('0x10')](function(_0x2aa227){logger[_0x7cb4('0x11')](_0x7cb4('0x1c'),_0x49e07c);logger[_0x7cb4('0x14')]('GetMailQueue',_0x49e07c,JSON[_0x7cb4('0x16')](_0x2aa227));_0x1fa599(_0x2aa227);})[_0x7cb4('0x1b')](function(_0x2a9019){logger['error'](_0x7cb4('0x1c'),_0x2a9019[_0x7cb4('0x19')],_0x49e07c);_0xf4599e(_0x17b7e7['error'](0x1f4,_0x2a9019[_0x7cb4('0x19')]));});});};exports[_0x7cb4('0x24')]=function(_0x1122ec){var _0x20688c=this;return new Promise(function(_0x38abe1,_0x4f236b){return db[_0x7cb4('0x1d')][_0x7cb4('0x25')]({'raw':_0x1122ec[_0x7cb4('0x1e')]?_0x1122ec[_0x7cb4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1122ec['options']?_0x1122ec['options'][_0x7cb4('0x1f')]||null:null,'attributes':_0x1122ec[_0x7cb4('0x1e')]?_0x1122ec[_0x7cb4('0x1e')]['attributes']||null:null,'include':_0x1122ec[_0x7cb4('0x1e')]?_0x1122ec['options'][_0x7cb4('0x21')]?_[_0x7cb4('0x22')](_0x1122ec[_0x7cb4('0x1e')][_0x7cb4('0x21')],function(_0x5ce96b){return{'model':db[_0x5ce96b[_0x7cb4('0x23')]],'as':_0x5ce96b['as'],'attributes':_0x5ce96b[_0x7cb4('0x20')],'include':_0x5ce96b[_0x7cb4('0x21')]?_[_0x7cb4('0x22')](_0x5ce96b[_0x7cb4('0x21')],function(_0x4a23db){return{'model':db[_0x4a23db['model']],'as':_0x4a23db['as'],'attributes':_0x4a23db[_0x7cb4('0x20')],'include':_0x4a23db['include']?_[_0x7cb4('0x22')](_0x4a23db['include'],function(_0x2fe83b){return{'model':db[_0x2fe83b[_0x7cb4('0x23')]],'as':_0x2fe83b['as'],'attributes':_0x2fe83b[_0x7cb4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7cb4('0x10')](function(_0x5977db){logger[_0x7cb4('0x11')](_0x7cb4('0x24'),_0x1122ec);logger[_0x7cb4('0x14')](_0x7cb4('0x24'),_0x1122ec,JSON[_0x7cb4('0x16')](_0x5977db));_0x38abe1(_0x5977db);})[_0x7cb4('0x1b')](function(_0x2a6bd2){logger[_0x7cb4('0x17')](_0x7cb4('0x24'),_0x2a6bd2[_0x7cb4('0x19')],_0x1122ec);_0x4f236b(_0x20688c['error'](0x1f4,_0x2a6bd2[_0x7cb4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0d283ca..5e6ffd0 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 _0x5afb=['length','mailQueue:','./mailQueue.events','save','update','emit','removeListener'];(function(_0x11423d,_0x40da27){var _0x1a9a61=function(_0x11ce2d){while(--_0x11ce2d){_0x11423d['push'](_0x11423d['shift']());}};_0x1a9a61(++_0x40da27);}(_0x5afb,0x1c9));var _0xb5af=function(_0x48b5a2,_0x5014c7){_0x48b5a2=_0x48b5a2-0x0;var _0xc7f542=_0x5afb[_0x48b5a2];return _0xc7f542;};'use strict';var MailQueueEvents=require(_0xb5af('0x0'));var events=[_0xb5af('0x1'),'remove',_0xb5af('0x2')];function createListener(_0x4f14d3,_0x5661c1){return function(_0x2c0288){_0x5661c1[_0xb5af('0x3')](_0x4f14d3,_0x2c0288);};}function removeListener(_0x3dc64c,_0x46ac3d){return function(){MailQueueEvents[_0xb5af('0x4')](_0x3dc64c,_0x46ac3d);};}exports['register']=function(_0x5a8622){for(var _0x2a870a=0x0,_0x3f882c=events[_0xb5af('0x5')];_0x2a870a<_0x3f882c;_0x2a870a++){var _0x871eb5=events[_0x2a870a];var _0x2910c4=createListener(_0xb5af('0x6')+_0x871eb5,_0x5a8622);MailQueueEvents['on'](_0x871eb5,_0x2910c4);}}; \ No newline at end of file +var _0xdfe2=['length','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x377d72,_0x4229ab){var _0x26a814=function(_0x5805bc){while(--_0x5805bc){_0x377d72['push'](_0x377d72['shift']());}};_0x26a814(++_0x4229ab);}(_0xdfe2,0x1b1));var _0x2dfe=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xdfe2[_0x11c573];return _0x6b72de;};'use strict';var MailQueueEvents=require(_0x2dfe('0x0'));var events=[_0x2dfe('0x1'),_0x2dfe('0x2'),_0x2dfe('0x3')];function createListener(_0x3f5eae,_0x315e2c){return function(_0x2823f4){_0x315e2c[_0x2dfe('0x4')](_0x3f5eae,_0x2823f4);};}function removeListener(_0x428c53,_0x219eb9){return function(){MailQueueEvents[_0x2dfe('0x5')](_0x428c53,_0x219eb9);};}exports[_0x2dfe('0x6')]=function(_0x135a73){for(var _0x1d7ee8=0x0,_0x366260=events[_0x2dfe('0x7')];_0x1d7ee8<_0x366260;_0x1d7ee8++){var _0x5b68fa=events[_0x1d7ee8];var _0x3e3e99=createListener('mailQueue:'+_0x5b68fa,_0x135a73);MailQueueEvents['on'](_0x5b68fa,_0x3e3e99);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8106ac6..fadeb40 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 _0x7ae0=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','post','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xfad1a7,_0x2e3b8d){var _0x571012=function(_0x33255d){while(--_0x33255d){_0xfad1a7['push'](_0xfad1a7['shift']());}};_0x571012(++_0x2e3b8d);}(_0x7ae0,0x111));var _0x07ae=function(_0xd5ce2e,_0x1a9c9b){_0xd5ce2e=_0xd5ce2e-0x0;var _0x33bf51=_0x7ae0[_0xd5ce2e];return _0x33bf51;};'use strict';var multer=require('multer');var util=require(_0x07ae('0x0'));var path=require(_0x07ae('0x1'));var timeout=require(_0x07ae('0x2'));var express=require(_0x07ae('0x3'));var router=express[_0x07ae('0x4')]();var fs_extra=require(_0x07ae('0x5'));var auth=require(_0x07ae('0x6'));var interaction=require(_0x07ae('0x7'));var config=require(_0x07ae('0x8'));var controller=require(_0x07ae('0x9'));router['get']('/',auth[_0x07ae('0xa')](),controller['index']);router[_0x07ae('0xb')](_0x07ae('0xc'),auth[_0x07ae('0xa')](),controller[_0x07ae('0xd')]);router[_0x07ae('0xb')]('/:id',auth[_0x07ae('0xa')](),controller['show']);router[_0x07ae('0xe')]('/',auth[_0x07ae('0xa')](),controller[_0x07ae('0xf')]);router['put'](_0x07ae('0x10'),auth[_0x07ae('0xa')](),controller[_0x07ae('0x11')]);router[_0x07ae('0x12')]('/:id',auth[_0x07ae('0xa')](),controller[_0x07ae('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0b61=['./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4f8853,_0x6c254){var _0x4e9fb1=function(_0x5e47e5){while(--_0x5e47e5){_0x4f8853['push'](_0x4f8853['shift']());}};_0x4e9fb1(++_0x6c254);}(_0x0b61,0x11a));var _0x10b6=function(_0x3fad0f,_0x5bec08){_0x3fad0f=_0x3fad0f-0x0;var _0x59f2b8=_0x0b61[_0x3fad0f];return _0x59f2b8;};'use strict';var multer=require(_0x10b6('0x0'));var util=require('util');var path=require(_0x10b6('0x1'));var timeout=require(_0x10b6('0x2'));var express=require(_0x10b6('0x3'));var router=express[_0x10b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x10b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x10b6('0x6'));router[_0x10b6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x10b6('0x7')]('/describe',auth[_0x10b6('0x8')](),controller[_0x10b6('0x9')]);router[_0x10b6('0x7')](_0x10b6('0xa'),auth[_0x10b6('0x8')](),controller[_0x10b6('0xb')]);router[_0x10b6('0xc')]('/',auth[_0x10b6('0x8')](),controller[_0x10b6('0xd')]);router[_0x10b6('0xe')](_0x10b6('0xa'),auth[_0x10b6('0x8')](),controller[_0x10b6('0xf')]);router[_0x10b6('0x10')]('/:id',auth[_0x10b6('0x8')](),controller['destroy']);module[_0x10b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 734702e..cc0bd8f 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 _0x741f=['STRING','DATE','moment','sequelize'];(function(_0x4256c1,_0x3ebd6b){var _0x51db9c=function(_0x25bfa2){while(--_0x25bfa2){_0x4256c1['push'](_0x4256c1['shift']());}};_0x51db9c(++_0x3ebd6b);}(_0x741f,0x76));var _0xf741=function(_0x4dfdb1,_0x5dd194){_0x4dfdb1=_0x4dfdb1-0x0;var _0x1c6fd5=_0x741f[_0x4dfdb1];return _0x1c6fd5;};'use strict';var moment=require(_0xf741('0x0'));var Sequelize=require(_0xf741('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf741('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf741('0x2')]},'joinAt':{'type':Sequelize[_0xf741('0x3')]},'leaveAt':{'type':Sequelize[_0xf741('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf741('0x3')]},'reason':{'type':Sequelize[_0xf741('0x2')]}}; \ No newline at end of file +var _0xd38c=['moment','sequelize','STRING','DATE'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0xd38c,0x174));var _0xcd38=function(_0x1899ee,_0x37bc36){_0x1899ee=_0x1899ee-0x0;var _0x1859ed=_0xd38c[_0x1899ee];return _0x1859ed;};'use strict';var moment=require(_0xcd38('0x0'));var Sequelize=require(_0xcd38('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcd38('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcd38('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcd38('0x3')]},'acceptAt':{'type':Sequelize[_0xcd38('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcd38('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e00718f..86667d9 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','MailQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x36d1b6,_0x317571){var _0x23226d=function(_0x262592){while(--_0x262592){_0x36d1b6['push'](_0x36d1b6['shift']());}};_0x23226d(++_0x317571);}(_0x57ca,0x108));var _0xa57c=function(_0x3b08bf,_0x4ce99b){_0x3b08bf=_0x3b08bf-0x0;var _0x2a0706=_0x57ca[_0x3b08bf];return _0x2a0706;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['MailQueueReport'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['MailQueueReport'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0x2a07=['index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x2a07[_0x2eb5bc];return _0x51c7b1;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['MailQueueReport'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['MailQueueReport']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0bdc5db..fb810b1 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 _0x5d23=['rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5d23,0x6f));var _0x35d2=function(_0x319224,_0x42100e){_0x319224=_0x319224-0x0;var _0xc1bb74=_0x5d23[_0x319224];return _0xc1bb74;};'use strict';var _=require(_0x35d2('0x0'));var util=require('util');var logger=require(_0x35d2('0x1'))(_0x35d2('0x2'));var moment=require(_0x35d2('0x3'));var BPromise=require(_0x35d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35d2('0x5'));var rimraf=require(_0x35d2('0x6'));var config=require(_0x35d2('0x7'));var attributes=require(_0x35d2('0x8'));module['exports']=function(_0x37b700,_0x4edb41){return _0x37b700[_0x35d2('0x9')](_0x35d2('0xa'),attributes,{'tableName':_0x35d2('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x35d2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22f0=['rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x523c78,_0x14129e){var _0x116745=function(_0x430e7b){while(--_0x430e7b){_0x523c78['push'](_0x523c78['shift']());}};_0x116745(++_0x14129e);}(_0x22f0,0x193));var _0x022f=function(_0x51057a,_0x2c8c27){_0x51057a=_0x51057a-0x0;var _0x3cbdaa=_0x22f0[_0x51057a];return _0x3cbdaa;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x022f('0x0'))('api');var moment=require(_0x022f('0x1'));var BPromise=require(_0x022f('0x2'));var rp=require(_0x022f('0x3'));var fs=require('fs');var path=require(_0x022f('0x4'));var rimraf=require(_0x022f('0x5'));var config=require('../../config/environment');var attributes=require(_0x022f('0x6'));module[_0x022f('0x7')]=function(_0x2b21a8,_0x3e0db1){return _0x2b21a8[_0x022f('0x8')](_0x022f('0x9'),attributes,{'tableName':_0x022f('0xa'),'paranoid':![],'indexes':[{'name':_0x022f('0xb'),'fields':[_0x022f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 25c52ee..7ea5ef8 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x5623b1,_0x96aadd){var _0x4f2416=function(_0x26db56){while(--_0x26db56){_0x5623b1['push'](_0x5623b1['shift']());}};_0x4f2416(++_0x96aadd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x2c7bed,_0x5e6dd6){var _0x258355=function(_0xfd0e5b){while(--_0xfd0e5b){_0x2c7bed['push'](_0x2c7bed['shift']());}};_0x258355(++_0x5e6dd6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 4fd9190..e349758 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x416f4e,_0x46a4b1){var _0x230028=function(_0x5a17ea){while(--_0x5a17ea){_0x416f4e['push'](_0x416f4e['shift']());}};_0x230028(++_0x46a4b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x16ce4b,_0x2097c4){var _0x346707=function(_0x166d4a){while(--_0x166d4a){_0x16ce4b['push'](_0x16ce4b['shift']());}};_0x346707(++_0x2097c4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index e0b4ca2..01d7db5 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 _0x73b3=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x29a740,_0x5c211){var _0x4edd09=function(_0x5b7be6){while(--_0x5b7be6){_0x29a740['push'](_0x29a740['shift']());}};_0x4edd09(++_0x5c211);}(_0x73b3,0x1ab));var _0x373b=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x73b3[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require(_0x373b('0x0'));module[_0x373b('0x1')]={'description':{'type':Sequelize[_0x373b('0x2')]},'host':{'type':Sequelize[_0x373b('0x2')]},'authentication':{'type':Sequelize[_0x373b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x373b('0x2')]},'password':{'type':Sequelize[_0x373b('0x2')]},'port':{'type':Sequelize[_0x373b('0x4')]},'tls':{'type':Sequelize[_0x373b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x373b('0x2')],'defaultValue':_0x373b('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x373b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x373b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2502=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x6455c1,_0x24c555){var _0x41edb1=function(_0x35e6e8){while(--_0x35e6e8){_0x6455c1['push'](_0x6455c1['shift']());}};_0x41edb1(++_0x24c555);}(_0x2502,0x1df));var _0x2250=function(_0x44383d,_0x2407c9){_0x44383d=_0x44383d-0x0;var _0xf06251=_0x2502[_0x44383d];return _0xf06251;};'use strict';var Sequelize=require(_0x2250('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2250('0x1')]},'authentication':{'type':Sequelize[_0x2250('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2250('0x3')]},'tls':{'type':Sequelize[_0x2250('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2250('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x2250('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x2250('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9e79daf..2e11418 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 _0x84bd=['lodash','util','../../config/logger','api','moment','bluebird','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x5a94ae,_0x247306){var _0x1537e0=function(_0x1aaebb){while(--_0x1aaebb){_0x5a94ae['push'](_0x5a94ae['shift']());}};_0x1537e0(++_0x247306);}(_0x84bd,0x1c3));var _0xd84b=function(_0x401609,_0x5eb61d){_0x401609=_0x401609-0x0;var _0x35fd57=_0x84bd[_0x401609];return _0x35fd57;};'use strict';var _=require(_0xd84b('0x0'));var util=require(_0xd84b('0x1'));var logger=require(_0xd84b('0x2'))(_0xd84b('0x3'));var moment=require(_0xd84b('0x4'));var BPromise=require(_0xd84b('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(_0xd84b('0x6'));module[_0xd84b('0x7')]=function(_0x1748a3,_0x125aba){return _0x1748a3[_0xd84b('0x8')](_0xd84b('0x9'),attributes,{'tableName':_0xd84b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x458b=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger'];(function(_0x4cf95a,_0x572b8f){var _0x303475=function(_0x28e48a){while(--_0x28e48a){_0x4cf95a['push'](_0x4cf95a['shift']());}};_0x303475(++_0x572b8f);}(_0x458b,0x11d));var _0xb458=function(_0x57dff9,_0x37bd67){_0x57dff9=_0x57dff9-0x0;var _0x346ae6=_0x458b[_0x57dff9];return _0x346ae6;};'use strict';var _=require(_0xb458('0x0'));var util=require(_0xb458('0x1'));var logger=require(_0xb458('0x2'))(_0xb458('0x3'));var moment=require('moment');var BPromise=require(_0xb458('0x4'));var rp=require(_0xb458('0x5'));var fs=require('fs');var path=require(_0xb458('0x6'));var rimraf=require(_0xb458('0x7'));var config=require(_0xb458('0x8'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x375c77,_0x854361){return _0x375c77[_0xb458('0x9')](_0xb458('0xa'),attributes,{'tableName':_0xb458('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 98a3ba6..b508a2b 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 _0x9b69=['options','raw','attributes','limit','include','map','model','debug','GetMailServerIn','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailServerIn','findAll'];(function(_0x14612f,_0x1c3389){var _0x3c41ad=function(_0x41043c){while(--_0x41043c){_0x14612f['push'](_0x14612f['shift']());}};_0x3c41ad(++_0x1c3389);}(_0x9b69,0x196));var _0x99b6=function(_0x49a627,_0x57e91d){_0x49a627=_0x49a627-0x0;var _0x4171b0=_0x9b69[_0x49a627];return _0x4171b0;};'use strict';var _=require(_0x99b6('0x0'));var util=require('util');var moment=require(_0x99b6('0x1'));var BPromise=require(_0x99b6('0x2'));var rs=require(_0x99b6('0x3'));var fs=require('fs');var Redis=require(_0x99b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99b6('0x5'));var logger=require('../../config/logger')(_0x99b6('0x6'));var config=require(_0x99b6('0x7'));var jayson=require(_0x99b6('0x8'));var client=jayson[_0x99b6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55a5ad,_0x5d0ca6,_0x49d176){return new BPromise(function(_0x38c76a,_0x2d14a8){return client[_0x99b6('0xa')](_0x55a5ad,_0x49d176)[_0x99b6('0xb')](function(_0xaf4c11){logger[_0x99b6('0xc')](_0x99b6('0xd'),_0x5d0ca6,_0x99b6('0xe'));logger['debug'](_0x99b6('0xf'),_0x5d0ca6,'request\x20sent',JSON['stringify'](_0xaf4c11));if(_0xaf4c11[_0x99b6('0x10')]){if(_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x11')]===0x1f4){logger[_0x99b6('0x10')]('MailServerIn,\x20%s,\x20%s',_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x2d14a8(_0xaf4c11['error']['message']);}logger['error'](_0x99b6('0xd'),_0x5d0ca6,_0xaf4c11[_0x99b6('0x10')][_0x99b6('0x12')]);return _0x38c76a(_0xaf4c11['error']['message']);}else{logger[_0x99b6('0xc')]('MailServerIn,\x20%s,\x20%s',_0x5d0ca6,_0x99b6('0xe'));_0x38c76a(_0xaf4c11[_0x99b6('0x13')][_0x99b6('0x12')]);}})[_0x99b6('0x14')](function(_0x389ded){logger[_0x99b6('0x10')](_0x99b6('0xd'),_0x5d0ca6,_0x389ded);_0x2d14a8(_0x389ded);});});}exports['GetMailServerIn']=function(_0x1f7f33){var _0x29f844=this;return new Promise(function(_0xf23455,_0x3711ee){return db[_0x99b6('0x15')][_0x99b6('0x16')]({'raw':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x18')]===undefined?!![]:![]:!![],'where':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')]['where']||null:null,'attributes':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x19')]||null:null,'limit':_0x1f7f33['options']?_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x1a')]||null:null,'include':_0x1f7f33[_0x99b6('0x17')]?_0x1f7f33['options'][_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x1f7f33[_0x99b6('0x17')][_0x99b6('0x1b')],function(_0x382ab8){return{'model':db[_0x382ab8[_0x99b6('0x1d')]],'as':_0x382ab8['as'],'attributes':_0x382ab8[_0x99b6('0x19')],'include':_0x382ab8[_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x382ab8[_0x99b6('0x1b')],function(_0x269c21){return{'model':db[_0x269c21[_0x99b6('0x1d')]],'as':_0x269c21['as'],'attributes':_0x269c21[_0x99b6('0x19')],'include':_0x269c21[_0x99b6('0x1b')]?_[_0x99b6('0x1c')](_0x269c21[_0x99b6('0x1b')],function(_0x5416c7){return{'model':db[_0x5416c7[_0x99b6('0x1d')]],'as':_0x5416c7['as'],'attributes':_0x5416c7[_0x99b6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x99b6('0xb')](function(_0x2cc099){logger['info']('GetMailServerIn',_0x1f7f33);logger[_0x99b6('0x1e')](_0x99b6('0x1f'),_0x1f7f33,JSON[_0x99b6('0x20')](_0x2cc099));_0xf23455(_0x2cc099);})['catch'](function(_0x330f8b){logger[_0x99b6('0x10')]('GetMailServerIn',_0x330f8b['message'],_0x1f7f33);_0x3711ee(_0x29f844[_0x99b6('0x10')](0x1f4,_0x330f8b['message']));});});}; \ No newline at end of file +var _0x38e7=['attributes','limit','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','GetMailServerIn','MailServerIn','findAll','options','raw','where'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x38e7,0x1b3));var _0x738e=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x38e7[_0x17823f];return _0x51fc21;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var moment=require(_0x738e('0x1'));var BPromise=require(_0x738e('0x2'));var rs=require(_0x738e('0x3'));var fs=require('fs');var Redis=require(_0x738e('0x4'));var db=require(_0x738e('0x5'))['db'];var utils=require(_0x738e('0x6'));var logger=require(_0x738e('0x7'))('rpc');var config=require(_0x738e('0x8'));var jayson=require(_0x738e('0x9'));var client=jayson[_0x738e('0xa')][_0x738e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20184f,_0x4d83bf,_0xad92ba){return new BPromise(function(_0x84cf69,_0xc3001d){return client['request'](_0x20184f,_0xad92ba)[_0x738e('0xc')](function(_0x1c3cb7){logger[_0x738e('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4d83bf,_0x738e('0xe'));logger[_0x738e('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4d83bf,_0x738e('0xe'),JSON[_0x738e('0x10')](_0x1c3cb7));if(_0x1c3cb7[_0x738e('0x11')]){if(_0x1c3cb7[_0x738e('0x11')][_0x738e('0x12')]===0x1f4){logger[_0x738e('0x11')](_0x738e('0x13'),_0x4d83bf,_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);return _0xc3001d(_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);}logger['error'](_0x738e('0x13'),_0x4d83bf,_0x1c3cb7[_0x738e('0x11')][_0x738e('0x14')]);return _0x84cf69(_0x1c3cb7['error']['message']);}else{logger['info'](_0x738e('0x13'),_0x4d83bf,_0x738e('0xe'));_0x84cf69(_0x1c3cb7['result'][_0x738e('0x14')]);}})['catch'](function(_0x27a956){logger[_0x738e('0x11')](_0x738e('0x13'),_0x4d83bf,_0x27a956);_0xc3001d(_0x27a956);});});}exports[_0x738e('0x15')]=function(_0xe2da97){var _0x20acbe=this;return new Promise(function(_0x411209,_0x28b387){return db[_0x738e('0x16')][_0x738e('0x17')]({'raw':_0xe2da97[_0x738e('0x18')]?_0xe2da97[_0x738e('0x18')][_0x738e('0x19')]===undefined?!![]:![]:!![],'where':_0xe2da97['options']?_0xe2da97[_0x738e('0x18')][_0x738e('0x1a')]||null:null,'attributes':_0xe2da97[_0x738e('0x18')]?_0xe2da97[_0x738e('0x18')][_0x738e('0x1b')]||null:null,'limit':_0xe2da97[_0x738e('0x18')]?_0xe2da97[_0x738e('0x18')][_0x738e('0x1c')]||null:null,'include':_0xe2da97[_0x738e('0x18')]?_0xe2da97[_0x738e('0x18')][_0x738e('0x1d')]?_[_0x738e('0x1e')](_0xe2da97[_0x738e('0x18')][_0x738e('0x1d')],function(_0x2a29f3){return{'model':db[_0x2a29f3[_0x738e('0x1f')]],'as':_0x2a29f3['as'],'attributes':_0x2a29f3['attributes'],'include':_0x2a29f3[_0x738e('0x1d')]?_[_0x738e('0x1e')](_0x2a29f3[_0x738e('0x1d')],function(_0xadc349){return{'model':db[_0xadc349[_0x738e('0x1f')]],'as':_0xadc349['as'],'attributes':_0xadc349[_0x738e('0x1b')],'include':_0xadc349[_0x738e('0x1d')]?_['map'](_0xadc349[_0x738e('0x1d')],function(_0x2c9575){return{'model':db[_0x2c9575['model']],'as':_0x2c9575['as'],'attributes':_0x2c9575[_0x738e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c888){logger[_0x738e('0xd')](_0x738e('0x15'),_0xe2da97);logger['debug']('GetMailServerIn',_0xe2da97,JSON[_0x738e('0x10')](_0x21c888));_0x411209(_0x21c888);})[_0x738e('0x20')](function(_0x9f667b){logger[_0x738e('0x11')](_0x738e('0x15'),_0x9f667b[_0x738e('0x14')],_0xe2da97);_0x28b387(_0x20acbe[_0x738e('0x11')](0x1f4,_0x9f667b[_0x738e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index fea8eb2..8c460c2 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x33a572,_0x8b71a2){_0x33a572=_0x33a572-0x0;var _0x1800ff=_0x7a54[_0x33a572];return _0x1800ff;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 655a7ea..592fb12 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 _0x9348=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x38b8c6,_0x541f91){var _0x3104d6=function(_0x4215ee){while(--_0x4215ee){_0x38b8c6['push'](_0x38b8c6['shift']());}};_0x3104d6(++_0x541f91);}(_0x9348,0x10d));var _0x8934=function(_0x1c649f,_0x296c57){_0x1c649f=_0x1c649f-0x0;var _0x251d8a=_0x9348[_0x1c649f];return _0x251d8a;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'description':{'type':Sequelize[_0x8934('0x2')]},'host':{'type':Sequelize[_0x8934('0x2')]},'user':{'type':Sequelize[_0x8934('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x8934('0x3')]},'secure':{'type':Sequelize[_0x8934('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8934('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x8934('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbee3=['exports','STRING','BOOLEAN'];(function(_0x5d40aa,_0x2cc513){var _0x5633ae=function(_0x2d4150){while(--_0x2d4150){_0x5d40aa['push'](_0x5d40aa['shift']());}};_0x5633ae(++_0x2cc513);}(_0xbee3,0xd5));var _0x3bee=function(_0x4fa030,_0x174be1){_0x4fa030=_0x4fa030-0x0;var _0x4f48d5=_0xbee3[_0x4fa030];return _0x4f48d5;};'use strict';var Sequelize=require('sequelize');module[_0x3bee('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3bee('0x1')]},'pass':{'type':Sequelize[_0x3bee('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x3bee('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3bee('0x1')]},'authentication':{'type':Sequelize[_0x3bee('0x2')],'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 44e0fd8..97b96f7 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 _0x3f1d=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','query','keys','filters'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3f1d,0x1d2));var _0xd3f1=function(_0x47eaf6,_0x22d6f7){_0x47eaf6=_0x47eaf6-0x0;var _0x495430=_0x3f1d[_0x47eaf6];return _0x495430;};'use strict';var emlformat=require(_0xd3f1('0x0'));var rimraf=require(_0xd3f1('0x1'));var zipdir=require(_0xd3f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3f1('0x3'));var moment=require('moment');var BPromise=require(_0xd3f1('0x4'));var Mustache=require(_0xd3f1('0x5'));var util=require('util');var path=require(_0xd3f1('0x6'));var sox=require(_0xd3f1('0x7'));var csv=require(_0xd3f1('0x8'));var ejs=require(_0xd3f1('0x9'));var fs=require('fs');var fs_extra=require(_0xd3f1('0xa'));var _=require(_0xd3f1('0xb'));var squel=require('squel');var crypto=require(_0xd3f1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd3f1('0xd'));var toCsv=require(_0xd3f1('0x8'));var querystring=require(_0xd3f1('0xe'));var Papa=require(_0xd3f1('0xf'));var Redis=require(_0xd3f1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd3f1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3f1('0x12'));var logger=require(_0xd3f1('0x13'))(_0xd3f1('0x14'));var utils=require(_0xd3f1('0x15'));var config=require(_0xd3f1('0x16'));var licenseUtil=require(_0xd3f1('0x17'));var db=require(_0xd3f1('0x18'))['db'];function respondWithStatusCode(_0x5b8877,_0x25bd7c){_0x25bd7c=_0x25bd7c||0xcc;return function(_0x45868e){if(_0x45868e){return _0x5b8877[_0xd3f1('0x19')](_0x25bd7c);}return _0x5b8877[_0xd3f1('0x1a')](_0x25bd7c)['end']();};}function respondWithResult(_0x55504c,_0x510a91){_0x510a91=_0x510a91||0xc8;return function(_0x4ed4d4){if(_0x4ed4d4){return _0x55504c[_0xd3f1('0x1a')](_0x510a91)['json'](_0x4ed4d4);}};}function respondWithFilteredResult(_0x4b72b0,_0x5c7590){return function(_0x4df4d2){if(_0x4df4d2){var _0x59aa79=typeof _0x5c7590[_0xd3f1('0x1b')]===_0xd3f1('0x1c')&&typeof _0x5c7590[_0xd3f1('0x1d')]===_0xd3f1('0x1c');var _0x842237=_0x4df4d2['count'];var _0x2f53bf=_0x59aa79?0x0:_0x5c7590[_0xd3f1('0x1b')];var _0x19d2fa=_0x59aa79?_0x4df4d2[_0xd3f1('0x1e')]:_0x5c7590[_0xd3f1('0x1b')]+_0x5c7590['limit'];var _0x19db03;if(_0x19d2fa>=_0x842237){_0x19d2fa=_0x842237;_0x19db03=0xc8;}else{_0x19db03=0xce;}_0x4b72b0[_0xd3f1('0x1a')](_0x19db03);return _0x4b72b0[_0xd3f1('0x1f')](_0xd3f1('0x20'),_0x2f53bf+'-'+_0x19d2fa+'/'+_0x842237)[_0xd3f1('0x21')](_0x4df4d2);}return null;};}function patchUpdates(_0x2b0e0f){return function(_0x5b60d0){try{jsonpatch[_0xd3f1('0x22')](_0x5b60d0,_0x2b0e0f,!![]);}catch(_0x2ed218){return BPromise[_0xd3f1('0x23')](_0x2ed218);}return _0x5b60d0[_0xd3f1('0x24')]();};}function saveUpdates(_0x7aaf3f,_0x5783ed){return function(_0x50e95c){if(_0x50e95c){return _0x50e95c[_0xd3f1('0x25')](_0x7aaf3f)['then'](function(_0x40ea72){return _0x40ea72;});}return null;};}function removeEntity(_0x16d8ee,_0x35a319){return function(_0x5214b2){if(_0x5214b2){return _0x5214b2['destroy']()[_0xd3f1('0x26')](function(){_0x16d8ee[_0xd3f1('0x1a')](0xcc)[_0xd3f1('0x27')]();});}};}function handleEntityNotFound(_0x2890ee,_0x4e5ad9){return function(_0x442055){if(!_0x442055){_0x2890ee['sendStatus'](0x194);}return _0x442055;};}function handleError(_0x3b301f,_0x22bba4){_0x22bba4=_0x22bba4||0x1f4;return function(_0x214845){logger['error'](_0x214845['stack']);if(_0x214845['name']){delete _0x214845[_0xd3f1('0x28')];}_0x3b301f['status'](_0x22bba4)[_0xd3f1('0x29')](_0x214845);};}exports[_0xd3f1('0x2a')]=function(_0x30d87e,_0x1c3090){var _0x3d1fc5={},_0x355384={},_0x4c4be4={'count':0x0,'rows':[]};var _0x4f2318=_['map'](db[_0xd3f1('0x2b')][_0xd3f1('0x2c')],function(_0x15c2c4){return{'name':_0x15c2c4[_0xd3f1('0x2d')],'type':_0x15c2c4[_0xd3f1('0x2e')][_0xd3f1('0x2f')]};});_0x355384['model']=_[_0xd3f1('0x30')](_0x4f2318,_0xd3f1('0x28'));_0x355384[_0xd3f1('0x31')]=_[_0xd3f1('0x32')](_0x30d87e[_0xd3f1('0x31')]);_0x355384[_0xd3f1('0x33')]=_[_0xd3f1('0x34')](_0x355384[_0xd3f1('0x35')],_0x355384[_0xd3f1('0x31')]);_0x3d1fc5[_0xd3f1('0x36')]=_[_0xd3f1('0x34')](_0x355384[_0xd3f1('0x35')],qs['fields'](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x37')]));_0x3d1fc5['attributes']=_0x3d1fc5[_0xd3f1('0x36')][_0xd3f1('0x38')]?_0x3d1fc5[_0xd3f1('0x36')]:_0x355384[_0xd3f1('0x35')];if(!_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x39')](_0xd3f1('0x3a'))){_0x3d1fc5[_0xd3f1('0x1d')]=qs['limit'](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x1d')]);_0x3d1fc5[_0xd3f1('0x1b')]=qs[_0xd3f1('0x1b')](_0x30d87e[_0xd3f1('0x31')]['offset']);}_0x3d1fc5[_0xd3f1('0x3b')]=qs[_0xd3f1('0x3c')](_0x30d87e[_0xd3f1('0x31')][_0xd3f1('0x3c')]);_0x3d1fc5[_0xd3f1('0x3d')]=qs[_0xd3f1('0x33')](_[_0xd3f1('0x3e')](_0x30d87e[_0xd3f1('0x31')],_0x355384[_0xd3f1('0x33')]),_0x4f2318);if(_0x30d87e[_0xd3f1('0x31')]['filter']){_0x3d1fc5[_0xd3f1('0x3d')]=_['merge'](_0x3d1fc5[_0xd3f1('0x3d')],{'$or':_[_0xd3f1('0x30')](_0x4f2318,function(_0x2fb7d9){if(_0x2fb7d9[_0xd3f1('0x2e')]!=='VIRTUAL'){var _0x351d4={};_0x351d4[_0x2fb7d9['name']]={'$like':'%'+_0x30d87e[_0xd3f1('0x31')]['filter']+'%'};return _0x351d4;}})});}_0x3d1fc5=_[_0xd3f1('0x3f')]({},_0x3d1fc5,_0x30d87e[_0xd3f1('0x40')]);var _0x1cba33={'where':_0x3d1fc5['where']};return db[_0xd3f1('0x2b')][_0xd3f1('0x1e')](_0x1cba33)[_0xd3f1('0x26')](function(_0x5715a9){_0x4c4be4['count']=_0x5715a9;if(_0x30d87e[_0xd3f1('0x31')]['includeAll']){_0x3d1fc5[_0xd3f1('0x41')]=[{'all':!![]}];}return db[_0xd3f1('0x2b')][_0xd3f1('0x42')](_0x3d1fc5);})['then'](function(_0x28832f){_0x4c4be4[_0xd3f1('0x43')]=_0x28832f;return _0x4c4be4;})[_0xd3f1('0x26')](respondWithFilteredResult(_0x1c3090,_0x3d1fc5))[_0xd3f1('0x44')](handleError(_0x1c3090,null));};exports['show']=function(_0x856a36,_0xbf3e2b){var _0x2c356a={'raw':!![],'where':{'id':_0x856a36[_0xd3f1('0x45')]['id']}},_0x5b8378={};_0x5b8378[_0xd3f1('0x35')]=_[_0xd3f1('0x32')](db[_0xd3f1('0x2b')][_0xd3f1('0x2c')]);_0x5b8378[_0xd3f1('0x31')]=_['keys'](_0x856a36[_0xd3f1('0x31')]);_0x5b8378[_0xd3f1('0x33')]=_[_0xd3f1('0x34')](_0x5b8378[_0xd3f1('0x35')],_0x5b8378[_0xd3f1('0x31')]);_0x2c356a[_0xd3f1('0x36')]=_[_0xd3f1('0x34')](_0x5b8378[_0xd3f1('0x35')],qs[_0xd3f1('0x37')](_0x856a36[_0xd3f1('0x31')][_0xd3f1('0x37')]));_0x2c356a[_0xd3f1('0x36')]=_0x2c356a['attributes'][_0xd3f1('0x38')]?_0x2c356a[_0xd3f1('0x36')]:_0x5b8378[_0xd3f1('0x35')];if(_0x856a36[_0xd3f1('0x31')][_0xd3f1('0x46')]){_0x2c356a[_0xd3f1('0x41')]=[{'all':!![]}];}_0x2c356a=_[_0xd3f1('0x3f')]({},_0x2c356a,_0x856a36[_0xd3f1('0x40')]);return db['MailServerOut']['find'](_0x2c356a)[_0xd3f1('0x26')](handleEntityNotFound(_0xbf3e2b,null))['then'](respondWithResult(_0xbf3e2b,null))[_0xd3f1('0x44')](handleError(_0xbf3e2b,null));};exports['create']=function(_0x1de850,_0x461d62){return db['MailServerOut'][_0xd3f1('0x47')](_0x1de850[_0xd3f1('0x48')],{})[_0xd3f1('0x26')](respondWithResult(_0x461d62,0xc9))[_0xd3f1('0x44')](handleError(_0x461d62,null));};exports[_0xd3f1('0x25')]=function(_0x3bd1e0,_0x1077d3){if(_0x3bd1e0['body']['id']){delete _0x3bd1e0['body']['id'];}return db['MailServerOut'][_0xd3f1('0x49')]({'where':{'id':_0x3bd1e0[_0xd3f1('0x45')]['id']}})[_0xd3f1('0x26')](handleEntityNotFound(_0x1077d3,null))[_0xd3f1('0x26')](saveUpdates(_0x3bd1e0[_0xd3f1('0x48')],null))[_0xd3f1('0x26')](respondWithResult(_0x1077d3,null))['catch'](handleError(_0x1077d3,null));};exports['destroy']=function(_0x35a635,_0x1c4442){return db[_0xd3f1('0x2b')][_0xd3f1('0x49')]({'where':{'id':_0x35a635[_0xd3f1('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c4442,null))['then'](removeEntity(_0x1c4442,null))[_0xd3f1('0x44')](handleError(_0x1c4442,null));}; \ No newline at end of file +var _0x9131=['length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','fs-extra','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x27e498,_0x4507b0){var _0x5c9f86=function(_0x39fb44){while(--_0x39fb44){_0x27e498['push'](_0x27e498['shift']());}};_0x5c9f86(++_0x4507b0);}(_0x9131,0xa3));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1913('0x0'));var rimraf=require(_0x1913('0x1'));var zipdir=require(_0x1913('0x2'));var jsonpatch=require(_0x1913('0x3'));var rp=require(_0x1913('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1913('0x5'));var path=require(_0x1913('0x6'));var sox=require(_0x1913('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1913('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1913('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1913('0xa'));var querystring=require('querystring');var Papa=require(_0x1913('0xb'));var Redis=require(_0x1913('0xc'));var authService=require(_0x1913('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1913('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1913('0xf'))(_0x1913('0x10'));var utils=require(_0x1913('0x11'));var config=require(_0x1913('0x12'));var licenseUtil=require(_0x1913('0x13'));var db=require(_0x1913('0x14'))['db'];function respondWithStatusCode(_0x25a240,_0x3d444a){_0x3d444a=_0x3d444a||0xcc;return function(_0x4c23e5){if(_0x4c23e5){return _0x25a240[_0x1913('0x15')](_0x3d444a);}return _0x25a240[_0x1913('0x16')](_0x3d444a)['end']();};}function respondWithResult(_0x245fcd,_0x591a38){_0x591a38=_0x591a38||0xc8;return function(_0x595438){if(_0x595438){return _0x245fcd[_0x1913('0x16')](_0x591a38)[_0x1913('0x17')](_0x595438);}};}function respondWithFilteredResult(_0x3f35e4,_0x550d53){return function(_0x5d8213){if(_0x5d8213){var _0x41b6c0=typeof _0x550d53[_0x1913('0x18')]===_0x1913('0x19')&&typeof _0x550d53[_0x1913('0x1a')]==='undefined';var _0x328fed=_0x5d8213[_0x1913('0x1b')];var _0x5bcfcb=_0x41b6c0?0x0:_0x550d53[_0x1913('0x18')];var _0x42d0e3=_0x41b6c0?_0x5d8213[_0x1913('0x1b')]:_0x550d53[_0x1913('0x18')]+_0x550d53[_0x1913('0x1a')];var _0x4b449f;if(_0x42d0e3>=_0x328fed){_0x42d0e3=_0x328fed;_0x4b449f=0xc8;}else{_0x4b449f=0xce;}_0x3f35e4['status'](_0x4b449f);return _0x3f35e4[_0x1913('0x1c')](_0x1913('0x1d'),_0x5bcfcb+'-'+_0x42d0e3+'/'+_0x328fed)[_0x1913('0x17')](_0x5d8213);}return null;};}function patchUpdates(_0x5519ea){return function(_0x2a9781){try{jsonpatch[_0x1913('0x1e')](_0x2a9781,_0x5519ea,!![]);}catch(_0x46a4ea){return BPromise[_0x1913('0x1f')](_0x46a4ea);}return _0x2a9781[_0x1913('0x20')]();};}function saveUpdates(_0x2d6fdd,_0x1ec749){return function(_0x4f101c){if(_0x4f101c){return _0x4f101c[_0x1913('0x21')](_0x2d6fdd)[_0x1913('0x22')](function(_0x21a307){return _0x21a307;});}return null;};}function removeEntity(_0xbefdc3,_0x26d243){return function(_0x53a251){if(_0x53a251){return _0x53a251[_0x1913('0x23')]()[_0x1913('0x22')](function(){_0xbefdc3['status'](0xcc)[_0x1913('0x24')]();});}};}function handleEntityNotFound(_0x415aa7,_0x4ab597){return function(_0x36258c){if(!_0x36258c){_0x415aa7[_0x1913('0x15')](0x194);}return _0x36258c;};}function handleError(_0x45875b,_0x68c4f6){_0x68c4f6=_0x68c4f6||0x1f4;return function(_0x1740e0){logger['error'](_0x1740e0['stack']);if(_0x1740e0[_0x1913('0x25')]){delete _0x1740e0[_0x1913('0x25')];}_0x45875b[_0x1913('0x16')](_0x68c4f6)[_0x1913('0x26')](_0x1740e0);};}exports[_0x1913('0x27')]=function(_0x366645,_0x309717){var _0x5dbcfe={},_0x4dac10={},_0x2e6886={'count':0x0,'rows':[]};var _0x2dd298=_['map'](db[_0x1913('0x28')][_0x1913('0x29')],function(_0x2c0574){return{'name':_0x2c0574[_0x1913('0x2a')],'type':_0x2c0574[_0x1913('0x2b')][_0x1913('0x2c')]};});_0x4dac10['model']=_[_0x1913('0x2d')](_0x2dd298,'name');_0x4dac10[_0x1913('0x2e')]=_[_0x1913('0x2f')](_0x366645[_0x1913('0x2e')]);_0x4dac10[_0x1913('0x30')]=_[_0x1913('0x31')](_0x4dac10[_0x1913('0x32')],_0x4dac10[_0x1913('0x2e')]);_0x5dbcfe[_0x1913('0x33')]=_[_0x1913('0x31')](_0x4dac10[_0x1913('0x32')],qs[_0x1913('0x34')](_0x366645[_0x1913('0x2e')][_0x1913('0x34')]));_0x5dbcfe[_0x1913('0x33')]=_0x5dbcfe[_0x1913('0x33')][_0x1913('0x35')]?_0x5dbcfe['attributes']:_0x4dac10['model'];if(!_0x366645['query'][_0x1913('0x36')](_0x1913('0x37'))){_0x5dbcfe['limit']=qs[_0x1913('0x1a')](_0x366645['query'][_0x1913('0x1a')]);_0x5dbcfe[_0x1913('0x18')]=qs[_0x1913('0x18')](_0x366645[_0x1913('0x2e')]['offset']);}_0x5dbcfe['order']=qs[_0x1913('0x38')](_0x366645[_0x1913('0x2e')][_0x1913('0x38')]);_0x5dbcfe[_0x1913('0x39')]=qs[_0x1913('0x30')](_[_0x1913('0x3a')](_0x366645[_0x1913('0x2e')],_0x4dac10[_0x1913('0x30')]),_0x2dd298);if(_0x366645[_0x1913('0x2e')]['filter']){_0x5dbcfe['where']=_[_0x1913('0x3b')](_0x5dbcfe[_0x1913('0x39')],{'$or':_[_0x1913('0x2d')](_0x2dd298,function(_0x523b27){if(_0x523b27['type']!==_0x1913('0x3c')){var _0x305427={};_0x305427[_0x523b27[_0x1913('0x25')]]={'$like':'%'+_0x366645[_0x1913('0x2e')][_0x1913('0x3d')]+'%'};return _0x305427;}})});}_0x5dbcfe=_['merge']({},_0x5dbcfe,_0x366645[_0x1913('0x3e')]);var _0x19d22a={'where':_0x5dbcfe[_0x1913('0x39')]};return db['MailServerOut']['count'](_0x19d22a)[_0x1913('0x22')](function(_0x3c4a61){_0x2e6886[_0x1913('0x1b')]=_0x3c4a61;if(_0x366645[_0x1913('0x2e')][_0x1913('0x3f')]){_0x5dbcfe[_0x1913('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x1913('0x41')](_0x5dbcfe);})[_0x1913('0x22')](function(_0x1030f8){_0x2e6886['rows']=_0x1030f8;return _0x2e6886;})[_0x1913('0x22')](respondWithFilteredResult(_0x309717,_0x5dbcfe))[_0x1913('0x42')](handleError(_0x309717,null));};exports[_0x1913('0x43')]=function(_0x16c75b,_0x1aeecf){var _0x24cfd8={'raw':!![],'where':{'id':_0x16c75b[_0x1913('0x44')]['id']}},_0x1eb478={};_0x1eb478[_0x1913('0x32')]=_[_0x1913('0x2f')](db[_0x1913('0x28')][_0x1913('0x29')]);_0x1eb478['query']=_[_0x1913('0x2f')](_0x16c75b[_0x1913('0x2e')]);_0x1eb478[_0x1913('0x30')]=_['intersection'](_0x1eb478[_0x1913('0x32')],_0x1eb478['query']);_0x24cfd8['attributes']=_['intersection'](_0x1eb478[_0x1913('0x32')],qs['fields'](_0x16c75b[_0x1913('0x2e')][_0x1913('0x34')]));_0x24cfd8[_0x1913('0x33')]=_0x24cfd8[_0x1913('0x33')][_0x1913('0x35')]?_0x24cfd8['attributes']:_0x1eb478[_0x1913('0x32')];if(_0x16c75b['query'][_0x1913('0x3f')]){_0x24cfd8[_0x1913('0x40')]=[{'all':!![]}];}_0x24cfd8=_['merge']({},_0x24cfd8,_0x16c75b['options']);return db[_0x1913('0x28')]['find'](_0x24cfd8)[_0x1913('0x22')](handleEntityNotFound(_0x1aeecf,null))[_0x1913('0x22')](respondWithResult(_0x1aeecf,null))['catch'](handleError(_0x1aeecf,null));};exports['create']=function(_0x5a61bd,_0xf143da){return db['MailServerOut'][_0x1913('0x45')](_0x5a61bd['body'],{})['then'](respondWithResult(_0xf143da,0xc9))['catch'](handleError(_0xf143da,null));};exports[_0x1913('0x21')]=function(_0x59bbd0,_0xa5f778){if(_0x59bbd0[_0x1913('0x46')]['id']){delete _0x59bbd0[_0x1913('0x46')]['id'];}return db['MailServerOut'][_0x1913('0x47')]({'where':{'id':_0x59bbd0[_0x1913('0x44')]['id']}})[_0x1913('0x22')](handleEntityNotFound(_0xa5f778,null))[_0x1913('0x22')](saveUpdates(_0x59bbd0['body'],null))[_0x1913('0x22')](respondWithResult(_0xa5f778,null))[_0x1913('0x42')](handleError(_0xa5f778,null));};exports[_0x1913('0x23')]=function(_0x389f47,_0x3eed37){return db[_0x1913('0x28')][_0x1913('0x47')]({'where':{'id':_0x389f47[_0x1913('0x44')]['id']}})['then'](handleEntityNotFound(_0x3eed37,null))['then'](removeEntity(_0x3eed37,null))['catch'](handleError(_0x3eed37,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 578b301..df0256a 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 _0xa2c9=['request-promise','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment','bluebird'];(function(_0x2ba7d3,_0x3befb6){var _0x51fc4f=function(_0x12700b){while(--_0x12700b){_0x2ba7d3['push'](_0x2ba7d3['shift']());}};_0x51fc4f(++_0x3befb6);}(_0xa2c9,0x157));var _0x9a2c=function(_0xd87061,_0x3f6b0f){_0xd87061=_0xd87061-0x0;var _0x1e42ff=_0xa2c9[_0xd87061];return _0x1e42ff;};'use strict';var _=require('lodash');var util=require(_0x9a2c('0x0'));var logger=require(_0x9a2c('0x1'))(_0x9a2c('0x2'));var moment=require(_0x9a2c('0x3'));var BPromise=require(_0x9a2c('0x4'));var rp=require(_0x9a2c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a2c('0x6'));var config=require(_0x9a2c('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x9a2c('0x8')]=function(_0x46b8e2,_0x2afeb4){return _0x46b8e2[_0x9a2c('0x9')](_0x9a2c('0xa'),attributes,{'tableName':_0x9a2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa15=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','bluebird','path','../../config/environment'];(function(_0x1e1b5a,_0x13b534){var _0x3206db=function(_0x5d6c2f){while(--_0x5d6c2f){_0x1e1b5a['push'](_0x1e1b5a['shift']());}};_0x3206db(++_0x13b534);}(_0xfa15,0xa6));var _0x5fa1=function(_0x3cd949,_0x192ba6){_0x3cd949=_0x3cd949-0x0;var _0x28f387=_0xfa15[_0x3cd949];return _0x28f387;};'use strict';var _=require(_0x5fa1('0x0'));var util=require(_0x5fa1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5fa1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fa1('0x3'));var rimraf=require('rimraf');var config=require(_0x5fa1('0x4'));var attributes=require(_0x5fa1('0x5'));module[_0x5fa1('0x6')]=function(_0x5aab3b,_0x234a8e){return _0x5aab3b[_0x5fa1('0x7')](_0x5fa1('0x8'),attributes,{'tableName':'mail_servers_out','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 29f54b5..8d467f4 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(_0x497672,_0x12ffe6){var _0x392c0b=function(_0x52de72){while(--_0x52de72){_0x497672['push'](_0x497672['shift']());}};_0x392c0b(++_0x12ffe6);}(_0xadb5,0xad));var _0x5adb=function(_0x103628,_0x570daa){_0x103628=_0x103628-0x0;var _0xea921c=_0xadb5[_0x103628];return _0xea921c;};'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 _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(_0x484a60,_0x63e920){var _0x18217b=function(_0x15ff9a){while(--_0x15ff9a){_0x484a60['push'](_0x484a60['shift']());}};_0x18217b(++_0x63e920);}(_0xadb5,0xad));var _0x5adb=function(_0x535c15,_0x5dadd9){_0x535c15=_0x535c15-0x0;var _0x1ae7d8=_0xadb5[_0x535c15];return _0x1ae7d8;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fa4a20a..33407ff 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 _0xc2e0=['delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x1c6575,_0x267b20){var _0x52679c=function(_0x39bf24){while(--_0x39bf24){_0x1c6575['push'](_0x1c6575['shift']());}};_0x52679c(++_0x267b20);}(_0xc2e0,0xe7));var _0x0c2e=function(_0x1662b2,_0x111731){_0x1662b2=_0x1662b2-0x0;var _0x9357bd=_0xc2e0[_0x1662b2];return _0x9357bd;};'use strict';var multer=require(_0x0c2e('0x0'));var util=require(_0x0c2e('0x1'));var path=require('path');var timeout=require(_0x0c2e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c2e('0x3'));var auth=require(_0x0c2e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x0c2e('0x5')]('/',auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x7')]);router[_0x0c2e('0x5')](_0x0c2e('0x8'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x9')]);router[_0x0c2e('0x5')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0xb')]);router[_0x0c2e('0xc')]('/',auth['isAuthenticated'](),controller[_0x0c2e('0xd')]);router[_0x0c2e('0xe')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0xf')]);router[_0x0c2e('0x10')](_0x0c2e('0xa'),auth[_0x0c2e('0x6')](),controller[_0x0c2e('0x11')]);module[_0x0c2e('0x12')]=router; \ No newline at end of file +var _0x82f8=['../../components/auth/service','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','multer','path','connect-timeout'];(function(_0x5ecc11,_0x2d761b){var _0xd1254f=function(_0x300ffb){while(--_0x300ffb){_0x5ecc11['push'](_0x5ecc11['shift']());}};_0xd1254f(++_0x2d761b);}(_0x82f8,0x10d));var _0x882f=function(_0x88b0e5,_0x137d45){_0x88b0e5=_0x88b0e5-0x0;var _0x3a1d6b=_0x82f8[_0x88b0e5];return _0x3a1d6b;};'use strict';var multer=require(_0x882f('0x0'));var util=require('util');var path=require(_0x882f('0x1'));var timeout=require(_0x882f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x882f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x882f('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x882f('0x5')]);router[_0x882f('0x6')](_0x882f('0x7'),auth[_0x882f('0x8')](),controller[_0x882f('0x9')]);router['get'](_0x882f('0xa'),auth[_0x882f('0x8')](),controller[_0x882f('0xb')]);router[_0x882f('0xc')]('/',auth[_0x882f('0x8')](),controller[_0x882f('0xd')]);router['put'](_0x882f('0xa'),auth[_0x882f('0x8')](),controller[_0x882f('0xe')]);router[_0x882f('0xf')](_0x882f('0xa'),auth[_0x882f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 073bce9..fa8fa8e 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 _0x2c8f=['exports'];(function(_0x57013d,_0x5355f9){var _0x1c0b29=function(_0x36417b){while(--_0x36417b){_0x57013d['push'](_0x57013d['shift']());}};_0x1c0b29(++_0x5355f9);}(_0x2c8f,0x192));var _0xf2c8=function(_0x355f4f,_0x22b7a7){_0x355f4f=_0x355f4f-0x0;var _0x4a6f56=_0x2c8f[_0x355f4f];return _0x4a6f56;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','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 5055702..bcd0ffe 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 _0x5b14=['stack','name','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','MailSubstatus','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error'];(function(_0x3678bd,_0x3bbe7a){var _0x3f1b84=function(_0x1ac297){while(--_0x1ac297){_0x3678bd['push'](_0x3678bd['shift']());}};_0x3f1b84(++_0x3bbe7a);}(_0x5b14,0x154));var _0x45b1=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x5b14[_0x18d631];return _0x50d708;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b1('0x0'));var zipdir=require(_0x45b1('0x1'));var jsonpatch=require(_0x45b1('0x2'));var rp=require(_0x45b1('0x3'));var moment=require(_0x45b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45b1('0x5'));var util=require(_0x45b1('0x6'));var path=require(_0x45b1('0x7'));var sox=require('sox');var csv=require(_0x45b1('0x8'));var ejs=require(_0x45b1('0x9'));var fs=require('fs');var fs_extra=require(_0x45b1('0xa'));var _=require(_0x45b1('0xb'));var squel=require('squel');var crypto=require(_0x45b1('0xc'));var jsforce=require(_0x45b1('0xd'));var deskjs=require(_0x45b1('0xe'));var toCsv=require(_0x45b1('0x8'));var querystring=require(_0x45b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x45b1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x45b1('0x11'));var as=require(_0x45b1('0x12'));var hardwareService=require(_0x45b1('0x13'));var logger=require(_0x45b1('0x14'))('api');var utils=require(_0x45b1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x45b1('0x16'));var db=require(_0x45b1('0x17'))['db'];function respondWithStatusCode(_0x204de4,_0x342106){_0x342106=_0x342106||0xcc;return function(_0x38899d){if(_0x38899d){return _0x204de4['sendStatus'](_0x342106);}return _0x204de4['status'](_0x342106)[_0x45b1('0x18')]();};}function respondWithResult(_0x10e886,_0x4933de){_0x4933de=_0x4933de||0xc8;return function(_0x28efac){if(_0x28efac){return _0x10e886[_0x45b1('0x19')](_0x4933de)[_0x45b1('0x1a')](_0x28efac);}};}function respondWithFilteredResult(_0x43dc64,_0x19e1c7){return function(_0x36476e){if(_0x36476e){var _0x25b80b=typeof _0x19e1c7[_0x45b1('0x1b')]===_0x45b1('0x1c')&&typeof _0x19e1c7[_0x45b1('0x1d')]===_0x45b1('0x1c');var _0x2d77bb=_0x36476e['count'];var _0x47d61a=_0x25b80b?0x0:_0x19e1c7['offset'];var _0xac0898=_0x25b80b?_0x36476e['count']:_0x19e1c7['offset']+_0x19e1c7['limit'];var _0x3d97b9;if(_0xac0898>=_0x2d77bb){_0xac0898=_0x2d77bb;_0x3d97b9=0xc8;}else{_0x3d97b9=0xce;}_0x43dc64[_0x45b1('0x19')](_0x3d97b9);return _0x43dc64[_0x45b1('0x1e')](_0x45b1('0x1f'),_0x47d61a+'-'+_0xac0898+'/'+_0x2d77bb)[_0x45b1('0x1a')](_0x36476e);}return null;};}function patchUpdates(_0x585d38){return function(_0x34d241){try{jsonpatch[_0x45b1('0x20')](_0x34d241,_0x585d38,!![]);}catch(_0x289136){return BPromise[_0x45b1('0x21')](_0x289136);}return _0x34d241[_0x45b1('0x22')]();};}function saveUpdates(_0x88b96,_0x4a1b69){return function(_0x1326a6){if(_0x1326a6){return _0x1326a6[_0x45b1('0x23')](_0x88b96)[_0x45b1('0x24')](function(_0x5a3aed){return _0x5a3aed;});}return null;};}function removeEntity(_0x334aa0,_0x24d2e4){return function(_0x18ead3){if(_0x18ead3){return _0x18ead3[_0x45b1('0x25')]()['then'](function(){_0x334aa0[_0x45b1('0x19')](0xcc)[_0x45b1('0x18')]();});}};}function handleEntityNotFound(_0x520867,_0x35cc35){return function(_0x34ce0e){if(!_0x34ce0e){_0x520867[_0x45b1('0x26')](0x194);}return _0x34ce0e;};}function handleError(_0x47ea2d,_0x1e5297){_0x1e5297=_0x1e5297||0x1f4;return function(_0x1d2a78){logger[_0x45b1('0x27')](_0x1d2a78[_0x45b1('0x28')]);if(_0x1d2a78[_0x45b1('0x29')]){delete _0x1d2a78['name'];}_0x47ea2d[_0x45b1('0x19')](_0x1e5297)['send'](_0x1d2a78);};}exports['index']=function(_0x1f3178,_0x4490fb){var _0x31ada6={},_0x36ac74={},_0xa9371a={'count':0x0,'rows':[]};var _0x12e5de=_[_0x45b1('0x2a')](db['MailSubstatus'][_0x45b1('0x2b')],function(_0x130d01){return{'name':_0x130d01['fieldName'],'type':_0x130d01['type'][_0x45b1('0x2c')]};});_0x36ac74[_0x45b1('0x2d')]=_['map'](_0x12e5de,_0x45b1('0x29'));_0x36ac74[_0x45b1('0x2e')]=_[_0x45b1('0x2f')](_0x1f3178['query']);_0x36ac74[_0x45b1('0x30')]=_[_0x45b1('0x31')](_0x36ac74[_0x45b1('0x2d')],_0x36ac74['query']);_0x31ada6['attributes']=_['intersection'](_0x36ac74[_0x45b1('0x2d')],qs[_0x45b1('0x32')](_0x1f3178[_0x45b1('0x2e')]['fields']));_0x31ada6[_0x45b1('0x33')]=_0x31ada6[_0x45b1('0x33')][_0x45b1('0x34')]?_0x31ada6['attributes']:_0x36ac74[_0x45b1('0x2d')];if(!_0x1f3178[_0x45b1('0x2e')]['hasOwnProperty'](_0x45b1('0x35'))){_0x31ada6[_0x45b1('0x1d')]=qs[_0x45b1('0x1d')](_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x1d')]);_0x31ada6[_0x45b1('0x1b')]=qs[_0x45b1('0x1b')](_0x1f3178[_0x45b1('0x2e')]['offset']);}_0x31ada6[_0x45b1('0x36')]=qs[_0x45b1('0x37')](_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x37')]);_0x31ada6['where']=qs['filters'](_[_0x45b1('0x38')](_0x1f3178[_0x45b1('0x2e')],_0x36ac74['filters']),_0x12e5de);if(_0x1f3178['query'][_0x45b1('0x39')]){_0x31ada6[_0x45b1('0x3a')]=_[_0x45b1('0x3b')](_0x31ada6[_0x45b1('0x3a')],{'$or':_[_0x45b1('0x2a')](_0x12e5de,function(_0x19e149){if(_0x19e149[_0x45b1('0x3c')]!==_0x45b1('0x3d')){var _0xe175eb={};_0xe175eb[_0x19e149[_0x45b1('0x29')]]={'$like':'%'+_0x1f3178[_0x45b1('0x2e')][_0x45b1('0x39')]+'%'};return _0xe175eb;}})});}_0x31ada6=_[_0x45b1('0x3b')]({},_0x31ada6,_0x1f3178[_0x45b1('0x3e')]);var _0x17ce4b={'where':_0x31ada6[_0x45b1('0x3a')]};return db[_0x45b1('0x3f')][_0x45b1('0x40')](_0x17ce4b)['then'](function(_0x690afb){_0xa9371a[_0x45b1('0x40')]=_0x690afb;if(_0x1f3178['query']['includeAll']){_0x31ada6[_0x45b1('0x41')]=[{'all':!![]}];}return db[_0x45b1('0x3f')][_0x45b1('0x42')](_0x31ada6);})[_0x45b1('0x24')](function(_0x38ff12){_0xa9371a[_0x45b1('0x43')]=_0x38ff12;return _0xa9371a;})[_0x45b1('0x24')](respondWithFilteredResult(_0x4490fb,_0x31ada6))[_0x45b1('0x44')](handleError(_0x4490fb,null));};exports[_0x45b1('0x45')]=function(_0x3559b0,_0x3c9998){var _0xbc5849={'raw':!![],'where':{'id':_0x3559b0['params']['id']}},_0x5a3701={};_0x5a3701[_0x45b1('0x2d')]=_[_0x45b1('0x2f')](db[_0x45b1('0x3f')][_0x45b1('0x2b')]);_0x5a3701[_0x45b1('0x2e')]=_[_0x45b1('0x2f')](_0x3559b0[_0x45b1('0x2e')]);_0x5a3701[_0x45b1('0x30')]=_[_0x45b1('0x31')](_0x5a3701[_0x45b1('0x2d')],_0x5a3701['query']);_0xbc5849[_0x45b1('0x33')]=_[_0x45b1('0x31')](_0x5a3701[_0x45b1('0x2d')],qs[_0x45b1('0x32')](_0x3559b0[_0x45b1('0x2e')][_0x45b1('0x32')]));_0xbc5849[_0x45b1('0x33')]=_0xbc5849[_0x45b1('0x33')]['length']?_0xbc5849['attributes']:_0x5a3701[_0x45b1('0x2d')];if(_0x3559b0[_0x45b1('0x2e')][_0x45b1('0x46')]){_0xbc5849[_0x45b1('0x41')]=[{'all':!![]}];}_0xbc5849=_[_0x45b1('0x3b')]({},_0xbc5849,_0x3559b0['options']);return db[_0x45b1('0x3f')][_0x45b1('0x47')](_0xbc5849)['then'](handleEntityNotFound(_0x3c9998,null))[_0x45b1('0x24')](respondWithResult(_0x3c9998,null))[_0x45b1('0x44')](handleError(_0x3c9998,null));};exports[_0x45b1('0x48')]=function(_0x528737,_0x256e50){return db[_0x45b1('0x3f')][_0x45b1('0x48')](_0x528737[_0x45b1('0x49')],{})[_0x45b1('0x24')](respondWithResult(_0x256e50,0xc9))['catch'](handleError(_0x256e50,null));};exports[_0x45b1('0x23')]=function(_0x11d14e,_0x3a9146){if(_0x11d14e[_0x45b1('0x49')]['id']){delete _0x11d14e[_0x45b1('0x49')]['id'];}return db[_0x45b1('0x3f')]['find']({'where':{'id':_0x11d14e[_0x45b1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3a9146,null))[_0x45b1('0x24')](saveUpdates(_0x11d14e[_0x45b1('0x49')],null))[_0x45b1('0x24')](respondWithResult(_0x3a9146,null))[_0x45b1('0x44')](handleError(_0x3a9146,null));};exports[_0x45b1('0x25')]=function(_0x49b7e3,_0x342116){return db[_0x45b1('0x3f')][_0x45b1('0x47')]({'where':{'id':_0x49b7e3[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x342116,null))[_0x45b1('0x24')](removeEntity(_0x342116,null))[_0x45b1('0x44')](handleError(_0x342116,null));};exports[_0x45b1('0x4b')]=function(_0x5da793,_0x3b683f){return db['MailSubstatus']['describe']()[_0x45b1('0x24')](respondWithResult(_0x3b683f,null))['catch'](handleError(_0x3b683f,null));}; \ No newline at end of file +var _0xcaf4=['offset','undefined','limit','count','Content-Range','reject','then','destroy','error','name','send','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','include','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x4d2dac,_0xa7ae76){var _0xf205d7=function(_0x492b8f){while(--_0x492b8f){_0x4d2dac['push'](_0x4d2dac['shift']());}};_0xf205d7(++_0xa7ae76);}(_0xcaf4,0x14f));var _0x4caf=function(_0x249325,_0x3f3d34){_0x249325=_0x249325-0x0;var _0x1ae979=_0xcaf4[_0x249325];return _0x1ae979;};'use strict';var emlformat=require(_0x4caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4caf('0x1'));var jsonpatch=require(_0x4caf('0x2'));var rp=require('request-promise');var moment=require(_0x4caf('0x3'));var BPromise=require(_0x4caf('0x4'));var Mustache=require(_0x4caf('0x5'));var util=require(_0x4caf('0x6'));var path=require(_0x4caf('0x7'));var sox=require(_0x4caf('0x8'));var csv=require(_0x4caf('0x9'));var ejs=require(_0x4caf('0xa'));var fs=require('fs');var fs_extra=require(_0x4caf('0xb'));var _=require(_0x4caf('0xc'));var squel=require(_0x4caf('0xd'));var crypto=require('crypto');var jsforce=require(_0x4caf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4caf('0x9'));var querystring=require(_0x4caf('0xf'));var Papa=require(_0x4caf('0x10'));var Redis=require(_0x4caf('0x11'));var authService=require(_0x4caf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4caf('0x13'));var hardwareService=require(_0x4caf('0x14'));var logger=require(_0x4caf('0x15'))(_0x4caf('0x16'));var utils=require(_0x4caf('0x17'));var config=require(_0x4caf('0x18'));var licenseUtil=require(_0x4caf('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x522077,_0x532639){_0x532639=_0x532639||0xcc;return function(_0x4ffd08){if(_0x4ffd08){return _0x522077[_0x4caf('0x1a')](_0x532639);}return _0x522077[_0x4caf('0x1b')](_0x532639)[_0x4caf('0x1c')]();};}function respondWithResult(_0x887155,_0x28c13b){_0x28c13b=_0x28c13b||0xc8;return function(_0x13053e){if(_0x13053e){return _0x887155['status'](_0x28c13b)[_0x4caf('0x1d')](_0x13053e);}};}function respondWithFilteredResult(_0x12b039,_0x2f8e6d){return function(_0x555c1d){if(_0x555c1d){var _0x2b1974=typeof _0x2f8e6d[_0x4caf('0x1e')]===_0x4caf('0x1f')&&typeof _0x2f8e6d[_0x4caf('0x20')]===_0x4caf('0x1f');var _0x4a83e0=_0x555c1d[_0x4caf('0x21')];var _0x1c07d6=_0x2b1974?0x0:_0x2f8e6d['offset'];var _0x13b4c1=_0x2b1974?_0x555c1d[_0x4caf('0x21')]:_0x2f8e6d['offset']+_0x2f8e6d[_0x4caf('0x20')];var _0x5deb14;if(_0x13b4c1>=_0x4a83e0){_0x13b4c1=_0x4a83e0;_0x5deb14=0xc8;}else{_0x5deb14=0xce;}_0x12b039[_0x4caf('0x1b')](_0x5deb14);return _0x12b039['set'](_0x4caf('0x22'),_0x1c07d6+'-'+_0x13b4c1+'/'+_0x4a83e0)[_0x4caf('0x1d')](_0x555c1d);}return null;};}function patchUpdates(_0x766b1a){return function(_0x5762c5){try{jsonpatch['apply'](_0x5762c5,_0x766b1a,!![]);}catch(_0x3d9713){return BPromise[_0x4caf('0x23')](_0x3d9713);}return _0x5762c5['save']();};}function saveUpdates(_0x35a846,_0x529561){return function(_0x114dfb){if(_0x114dfb){return _0x114dfb['update'](_0x35a846)[_0x4caf('0x24')](function(_0x2138dd){return _0x2138dd;});}return null;};}function removeEntity(_0x5a2d8b,_0x274542){return function(_0x49328d){if(_0x49328d){return _0x49328d[_0x4caf('0x25')]()['then'](function(){_0x5a2d8b[_0x4caf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5479b8,_0x2cd420){return function(_0x553cd0){if(!_0x553cd0){_0x5479b8['sendStatus'](0x194);}return _0x553cd0;};}function handleError(_0x3b2717,_0x40b227){_0x40b227=_0x40b227||0x1f4;return function(_0x119130){logger[_0x4caf('0x26')](_0x119130['stack']);if(_0x119130[_0x4caf('0x27')]){delete _0x119130[_0x4caf('0x27')];}_0x3b2717[_0x4caf('0x1b')](_0x40b227)[_0x4caf('0x28')](_0x119130);};}exports['index']=function(_0x3601d2,_0x38dbf8){var _0x5de254={},_0x43d021={},_0x507229={'count':0x0,'rows':[]};var _0x4348d2=_[_0x4caf('0x29')](db[_0x4caf('0x2a')][_0x4caf('0x2b')],function(_0x32152c){return{'name':_0x32152c[_0x4caf('0x2c')],'type':_0x32152c[_0x4caf('0x2d')][_0x4caf('0x2e')]};});_0x43d021['model']=_['map'](_0x4348d2,_0x4caf('0x27'));_0x43d021[_0x4caf('0x2f')]=_[_0x4caf('0x30')](_0x3601d2[_0x4caf('0x2f')]);_0x43d021['filters']=_[_0x4caf('0x31')](_0x43d021[_0x4caf('0x32')],_0x43d021[_0x4caf('0x2f')]);_0x5de254[_0x4caf('0x33')]=_['intersection'](_0x43d021[_0x4caf('0x32')],qs[_0x4caf('0x34')](_0x3601d2[_0x4caf('0x2f')][_0x4caf('0x34')]));_0x5de254['attributes']=_0x5de254[_0x4caf('0x33')][_0x4caf('0x35')]?_0x5de254['attributes']:_0x43d021[_0x4caf('0x32')];if(!_0x3601d2[_0x4caf('0x2f')]['hasOwnProperty'](_0x4caf('0x36'))){_0x5de254[_0x4caf('0x20')]=qs['limit'](_0x3601d2['query'][_0x4caf('0x20')]);_0x5de254['offset']=qs[_0x4caf('0x1e')](_0x3601d2[_0x4caf('0x2f')][_0x4caf('0x1e')]);}_0x5de254[_0x4caf('0x37')]=qs[_0x4caf('0x38')](_0x3601d2[_0x4caf('0x2f')]['sort']);_0x5de254[_0x4caf('0x39')]=qs[_0x4caf('0x3a')](_[_0x4caf('0x3b')](_0x3601d2[_0x4caf('0x2f')],_0x43d021[_0x4caf('0x3a')]),_0x4348d2);if(_0x3601d2[_0x4caf('0x2f')][_0x4caf('0x3c')]){_0x5de254[_0x4caf('0x39')]=_[_0x4caf('0x3d')](_0x5de254['where'],{'$or':_[_0x4caf('0x29')](_0x4348d2,function(_0x24dea4){if(_0x24dea4[_0x4caf('0x2d')]!==_0x4caf('0x3e')){var _0x5e5400={};_0x5e5400[_0x24dea4[_0x4caf('0x27')]]={'$like':'%'+_0x3601d2[_0x4caf('0x2f')]['filter']+'%'};return _0x5e5400;}})});}_0x5de254=_[_0x4caf('0x3d')]({},_0x5de254,_0x3601d2['options']);var _0x3c0d49={'where':_0x5de254[_0x4caf('0x39')]};return db[_0x4caf('0x2a')][_0x4caf('0x21')](_0x3c0d49)[_0x4caf('0x24')](function(_0x33afa1){_0x507229[_0x4caf('0x21')]=_0x33afa1;if(_0x3601d2[_0x4caf('0x2f')][_0x4caf('0x3f')]){_0x5de254['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x5de254);})[_0x4caf('0x24')](function(_0x42142f){_0x507229['rows']=_0x42142f;return _0x507229;})[_0x4caf('0x24')](respondWithFilteredResult(_0x38dbf8,_0x5de254))[_0x4caf('0x40')](handleError(_0x38dbf8,null));};exports[_0x4caf('0x41')]=function(_0x596335,_0x57b3f6){var _0x4ee575={'raw':!![],'where':{'id':_0x596335[_0x4caf('0x42')]['id']}},_0x44d9a3={};_0x44d9a3[_0x4caf('0x32')]=_[_0x4caf('0x30')](db[_0x4caf('0x2a')][_0x4caf('0x2b')]);_0x44d9a3['query']=_['keys'](_0x596335[_0x4caf('0x2f')]);_0x44d9a3[_0x4caf('0x3a')]=_[_0x4caf('0x31')](_0x44d9a3[_0x4caf('0x32')],_0x44d9a3[_0x4caf('0x2f')]);_0x4ee575[_0x4caf('0x33')]=_[_0x4caf('0x31')](_0x44d9a3[_0x4caf('0x32')],qs[_0x4caf('0x34')](_0x596335[_0x4caf('0x2f')]['fields']));_0x4ee575['attributes']=_0x4ee575[_0x4caf('0x33')][_0x4caf('0x35')]?_0x4ee575[_0x4caf('0x33')]:_0x44d9a3[_0x4caf('0x32')];if(_0x596335[_0x4caf('0x2f')][_0x4caf('0x3f')]){_0x4ee575[_0x4caf('0x43')]=[{'all':!![]}];}_0x4ee575=_[_0x4caf('0x3d')]({},_0x4ee575,_0x596335[_0x4caf('0x44')]);return db['MailSubstatus']['find'](_0x4ee575)['then'](handleEntityNotFound(_0x57b3f6,null))['then'](respondWithResult(_0x57b3f6,null))[_0x4caf('0x40')](handleError(_0x57b3f6,null));};exports[_0x4caf('0x45')]=function(_0x3f086b,_0xbcb0ca){return db[_0x4caf('0x2a')][_0x4caf('0x45')](_0x3f086b[_0x4caf('0x46')],{})[_0x4caf('0x24')](respondWithResult(_0xbcb0ca,0xc9))[_0x4caf('0x40')](handleError(_0xbcb0ca,null));};exports['update']=function(_0x526360,_0x4decba){if(_0x526360[_0x4caf('0x46')]['id']){delete _0x526360[_0x4caf('0x46')]['id'];}return db[_0x4caf('0x2a')][_0x4caf('0x47')]({'where':{'id':_0x526360[_0x4caf('0x42')]['id']}})[_0x4caf('0x24')](handleEntityNotFound(_0x4decba,null))['then'](saveUpdates(_0x526360[_0x4caf('0x46')],null))['then'](respondWithResult(_0x4decba,null))[_0x4caf('0x40')](handleError(_0x4decba,null));};exports[_0x4caf('0x25')]=function(_0x2dd5b8,_0x426824){return db[_0x4caf('0x2a')][_0x4caf('0x47')]({'where':{'id':_0x2dd5b8[_0x4caf('0x42')]['id']}})[_0x4caf('0x24')](handleEntityNotFound(_0x426824,null))[_0x4caf('0x24')](removeEntity(_0x426824,null))[_0x4caf('0x40')](handleError(_0x426824,null));};exports[_0x4caf('0x48')]=function(_0x5c2eb0,_0x1ab980){return db['MailSubstatus']['describe']()[_0x4caf('0x24')](respondWithResult(_0x1ab980,null))['catch'](handleError(_0x1ab980,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index b3f263b..6cee77e 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 _0x5b2d=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x5cc3cc,_0x2e1ddd){var _0xcf3aae=function(_0x4c685e){while(--_0x4c685e){_0x5cc3cc['push'](_0x5cc3cc['shift']());}};_0xcf3aae(++_0x2e1ddd);}(_0x5b2d,0x164));var _0xd5b2=function(_0x1f04e8,_0x43c684){_0x1f04e8=_0x1f04e8-0x0;var _0x4e130e=_0x5b2d[_0x1f04e8];return _0x4e130e;};'use strict';var EventEmitter=require(_0xd5b2('0x0'));var MailSubstatus=require(_0xd5b2('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd5b2('0x2')](0x0);var events={'afterUpdate':_0xd5b2('0x3')};function emitEvent(_0x10a580){return function(_0x329acc,_0x2b2b8e,_0x1c1ad7){MailSubstatusEvents[_0xd5b2('0x4')](_0x10a580+':'+_0x329acc['id'],_0x329acc);MailSubstatusEvents[_0xd5b2('0x4')](_0x10a580,_0x329acc);_0x1c1ad7(null);};}for(var e in events){if(events[_0xd5b2('0x5')](e)){var event=events[e];MailSubstatus[_0xd5b2('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xff56=['events','../../mysqldb','MailSubstatus','emit','hasOwnProperty','hook','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xff56,0x150));var _0x6ff5=function(_0x2764f7,_0x41dcea){_0x2764f7=_0x2764f7-0x0;var _0x3cef7d=_0xff56[_0x2764f7];return _0x3cef7d;};'use strict';var EventEmitter=require(_0x6ff5('0x0'));var MailSubstatus=require(_0x6ff5('0x1'))['db'][_0x6ff5('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x53ee69){return function(_0x57fdd5,_0x24a8ed,_0x42a6c8){MailSubstatusEvents[_0x6ff5('0x3')](_0x53ee69+':'+_0x57fdd5['id'],_0x57fdd5);MailSubstatusEvents[_0x6ff5('0x3')](_0x53ee69,_0x57fdd5);_0x42a6c8(null);};}for(var e in events){if(events[_0x6ff5('0x4')](e)){var event=events[e];MailSubstatus[_0x6ff5('0x5')](e,emitEvent(event));}}module[_0x6ff5('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 3328c80..6d2a863 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 _0xb728=['Condition','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xb728,0xe2));var _0x8b72=function(_0x345606,_0x42e83c){_0x345606=_0x345606-0x0;var _0x14410b=_0xb728[_0x345606];return _0x14410b;};'use strict';var attributes=require(_0x8b72('0x0'));module[_0x8b72('0x1')]=function(_0x1fe97b){var _0x3b826d=_0x1fe97b['models'];return _0x1fe97b[_0x8b72('0x2')](_0x8b72('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3161ae,_0x694067,_0x233835){return _0x3b826d[_0x8b72('0x4')][_0x8b72('0x5')]({'value':_0x3161ae[_0x8b72('0x6')]},{'where':{'field':_0x8b72('0x7'),'value':_0x3161ae[_0x8b72('0x8')][_0x8b72('0x6')]}})[_0x8b72('0x9')](function(){_0x233835();})['catch'](function(_0x1dfd26){_0x233835(_0x1dfd26);});}}});}; \ No newline at end of file +var _0x8f0a=['mail_substatuses','Condition','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus'];(function(_0x5c2bb0,_0x4ba6ce){var _0x176284=function(_0x22c16b){while(--_0x22c16b){_0x5c2bb0['push'](_0x5c2bb0['shift']());}};_0x176284(++_0x4ba6ce);}(_0x8f0a,0x157));var _0xa8f0=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x8f0a[_0x4480b9];return _0x3f0f02;};'use strict';var attributes=require(_0xa8f0('0x0'));module[_0xa8f0('0x1')]=function(_0x2262de){var _0x54880d=_0x2262de[_0xa8f0('0x2')];return _0x2262de[_0xa8f0('0x3')](_0xa8f0('0x4'),attributes,{'tableName':_0xa8f0('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x31b368,_0x52676f,_0x1ffe18){return _0x54880d[_0xa8f0('0x6')][_0xa8f0('0x7')]({'value':_0x31b368[_0xa8f0('0x8')]},{'where':{'field':_0xa8f0('0x9'),'value':_0x31b368['_previousDataValues'][_0xa8f0('0x8')]}})[_0xa8f0('0xa')](function(){_0x1ffe18();})[_0xa8f0('0xb')](function(_0x328720){_0x1ffe18(_0x328720);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 6a5e1ea..4bbf2c3 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 _0xe0d6=['then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request'];(function(_0x361ab9,_0x2a2bea){var _0x20346a=function(_0x599bb7){while(--_0x599bb7){_0x361ab9['push'](_0x361ab9['shift']());}};_0x20346a(++_0x2a2bea);}(_0xe0d6,0x13f));var _0x6e0d=function(_0x44c9cf,_0x47cbb7){_0x44c9cf=_0x44c9cf-0x0;var _0xbf5a4f=_0xe0d6[_0x44c9cf];return _0xbf5a4f;};'use strict';var _=require('lodash');var util=require(_0x6e0d('0x0'));var moment=require(_0x6e0d('0x1'));var BPromise=require(_0x6e0d('0x2'));var rs=require(_0x6e0d('0x3'));var fs=require('fs');var Redis=require(_0x6e0d('0x4'));var db=require(_0x6e0d('0x5'))['db'];var utils=require(_0x6e0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e0d('0x7'));var jayson=require(_0x6e0d('0x8'));var client=jayson[_0x6e0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x555454,_0x301a53,_0x4ea437){return new BPromise(function(_0x1878e1,_0x1ee2a4){return client[_0x6e0d('0xa')](_0x555454,_0x4ea437)[_0x6e0d('0xb')](function(_0x1df383){logger[_0x6e0d('0xc')](_0x6e0d('0xd'),_0x301a53,_0x6e0d('0xe'));logger[_0x6e0d('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x301a53,_0x6e0d('0xe'),JSON[_0x6e0d('0x10')](_0x1df383));if(_0x1df383['error']){if(_0x1df383['error'][_0x6e0d('0x11')]===0x1f4){logger['error'](_0x6e0d('0xd'),_0x301a53,_0x1df383[_0x6e0d('0x12')]['message']);return _0x1ee2a4(_0x1df383['error'][_0x6e0d('0x13')]);}logger[_0x6e0d('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x301a53,_0x1df383[_0x6e0d('0x12')][_0x6e0d('0x13')]);return _0x1878e1(_0x1df383[_0x6e0d('0x12')][_0x6e0d('0x13')]);}else{logger[_0x6e0d('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x301a53,_0x6e0d('0xe'));_0x1878e1(_0x1df383[_0x6e0d('0x14')][_0x6e0d('0x13')]);}})[_0x6e0d('0x15')](function(_0x54a1c3){logger[_0x6e0d('0x12')](_0x6e0d('0xd'),_0x301a53,_0x54a1c3);_0x1ee2a4(_0x54a1c3);});});} \ No newline at end of file +var _0x17da=['stringify','code','error','message','result','catch','MailSubstatus,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x1af219,_0x525380){var _0xdac840=function(_0x213bdc){while(--_0x213bdc){_0x1af219['push'](_0x1af219['shift']());}};_0xdac840(++_0x525380);}(_0x17da,0x167));var _0xa17d=function(_0x478370,_0x414dfb){_0x478370=_0x478370-0x0;var _0x3434d3=_0x17da[_0x478370];return _0x3434d3;};'use strict';var _=require(_0xa17d('0x0'));var util=require('util');var moment=require(_0xa17d('0x1'));var BPromise=require(_0xa17d('0x2'));var rs=require(_0xa17d('0x3'));var fs=require('fs');var Redis=require(_0xa17d('0x4'));var db=require(_0xa17d('0x5'))['db'];var utils=require(_0xa17d('0x6'));var logger=require('../../config/logger')(_0xa17d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa17d('0x8'));var client=jayson[_0xa17d('0x9')][_0xa17d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d0d8b,_0x237eef,_0x1762c8){return new BPromise(function(_0x26236f,_0x3af17c){return client[_0xa17d('0xb')](_0x4d0d8b,_0x1762c8)[_0xa17d('0xc')](function(_0x4b130f){logger[_0xa17d('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x237eef,_0xa17d('0xe'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x237eef,_0xa17d('0xe'),JSON[_0xa17d('0xf')](_0x4b130f));if(_0x4b130f['error']){if(_0x4b130f['error'][_0xa17d('0x10')]===0x1f4){logger[_0xa17d('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x237eef,_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);return _0x3af17c(_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);}logger[_0xa17d('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x237eef,_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);return _0x26236f(_0x4b130f[_0xa17d('0x11')][_0xa17d('0x12')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x237eef,'request\x20sent');_0x26236f(_0x4b130f[_0xa17d('0x13')][_0xa17d('0x12')]);}})[_0xa17d('0x14')](function(_0x5161aa){logger[_0xa17d('0x11')](_0xa17d('0x15'),_0x237eef,_0x5161aa);_0x3af17c(_0x5161aa);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5b262b8..45525d8 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 _0xc8d1=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x47c273,_0x397e78){var _0x27b2c0=function(_0x22bff1){while(--_0x22bff1){_0x47c273['push'](_0x47c273['shift']());}};_0x27b2c0(++_0x397e78);}(_0xc8d1,0x1b9));var _0x1c8d=function(_0x420745,_0x1a6314){_0x420745=_0x420745-0x0;var _0x153a1a=_0xc8d1[_0x420745];return _0x153a1a;};'use strict';var multer=require(_0x1c8d('0x0'));var util=require(_0x1c8d('0x1'));var path=require(_0x1c8d('0x2'));var timeout=require(_0x1c8d('0x3'));var express=require(_0x1c8d('0x4'));var router=express['Router']();var fs_extra=require(_0x1c8d('0x5'));var auth=require(_0x1c8d('0x6'));var interaction=require(_0x1c8d('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x1c8d('0x8')]('/',auth[_0x1c8d('0x9')](),controller[_0x1c8d('0xa')]);router[_0x1c8d('0x8')](_0x1c8d('0xb'),auth[_0x1c8d('0x9')](),controller[_0x1c8d('0xc')]);router['get'](_0x1c8d('0xd'),auth['isAuthenticated'](),controller[_0x1c8d('0xe')]);router[_0x1c8d('0xf')]('/',auth[_0x1c8d('0x9')](),controller[_0x1c8d('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1c8d('0x11')]);router[_0x1c8d('0x12')](_0x1c8d('0xd'),auth[_0x1c8d('0x9')](),controller['destroy']);module[_0x1c8d('0x13')]=router; \ No newline at end of file +var _0x266a=['/describe','describe','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x266a,0x1e7));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var path=require(_0xa266('0x2'));var timeout=require(_0xa266('0x3'));var express=require(_0xa266('0x4'));var router=express[_0xa266('0x5')]();var fs_extra=require(_0xa266('0x6'));var auth=require(_0xa266('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa266('0x8'));var controller=require(_0xa266('0x9'));router[_0xa266('0xa')]('/',auth[_0xa266('0xb')](),controller[_0xa266('0xc')]);router[_0xa266('0xa')](_0xa266('0xd'),auth[_0xa266('0xb')](),controller[_0xa266('0xe')]);router[_0xa266('0xa')](_0xa266('0xf'),auth[_0xa266('0xb')](),controller[_0xa266('0x10')]);router[_0xa266('0x11')]('/',auth[_0xa266('0xb')](),controller['create']);router[_0xa266('0x12')](_0xa266('0xf'),auth[_0xa266('0xb')](),controller['update']);router['delete'](_0xa266('0xf'),auth[_0xa266('0xb')](),controller['destroy']);module[_0xa266('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 20078d1..4b64598 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x58e093,_0x1bd380){var _0x53da6f=function(_0x4f267c){while(--_0x4f267c){_0x58e093['push'](_0x58e093['shift']());}};_0x53da6f(++_0x1bd380);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xcb91[_0x2ca9d4];return _0x258956;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3c0c3e,_0x53ebb5){var _0x221169=function(_0x57c004){while(--_0x57c004){_0x3c0c3e['push'](_0x3c0c3e['shift']());}};_0x221169(++_0x53ebb5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xcb91[_0x4a29a9];return _0x386570;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2791578..5434b43 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 _0xd010=['key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','include','create','body','find','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0xd010,0x18e));var _0x0d01=function(_0x111730,_0x2e79c4){_0x111730=_0x111730-0x0;var _0x2393fe=_0xd010[_0x111730];return _0x2393fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d01('0x0'));var zipdir=require(_0x0d01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d01('0x2'));var moment=require('moment');var BPromise=require(_0x0d01('0x3'));var Mustache=require('mustache');var util=require(_0x0d01('0x4'));var path=require(_0x0d01('0x5'));var sox=require(_0x0d01('0x6'));var csv=require(_0x0d01('0x7'));var ejs=require(_0x0d01('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d01('0x9'));var squel=require('squel');var crypto=require(_0x0d01('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d01('0x7'));var querystring=require(_0x0d01('0xb'));var Papa=require(_0x0d01('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0d01('0xd'));var as=require(_0x0d01('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d01('0xf'))(_0x0d01('0x10'));var utils=require(_0x0d01('0x11'));var config=require(_0x0d01('0x12'));var licenseUtil=require(_0x0d01('0x13'));var db=require(_0x0d01('0x14'))['db'];function respondWithStatusCode(_0x1bb97b,_0x10a6c3){_0x10a6c3=_0x10a6c3||0xcc;return function(_0x56a0bb){if(_0x56a0bb){return _0x1bb97b[_0x0d01('0x15')](_0x10a6c3);}return _0x1bb97b[_0x0d01('0x16')](_0x10a6c3)[_0x0d01('0x17')]();};}function respondWithResult(_0xa2dfcc,_0x532494){_0x532494=_0x532494||0xc8;return function(_0x11a092){if(_0x11a092){return _0xa2dfcc['status'](_0x532494)[_0x0d01('0x18')](_0x11a092);}};}function respondWithFilteredResult(_0xdfb54c,_0x56cd5e){return function(_0x566346){if(_0x566346){var _0x41d3ac=typeof _0x56cd5e[_0x0d01('0x19')]==='undefined'&&typeof _0x56cd5e[_0x0d01('0x1a')]===_0x0d01('0x1b');var _0x44cddc=_0x566346['count'];var _0x129790=_0x41d3ac?0x0:_0x56cd5e[_0x0d01('0x19')];var _0x2d5bc3=_0x41d3ac?_0x566346[_0x0d01('0x1c')]:_0x56cd5e[_0x0d01('0x19')]+_0x56cd5e['limit'];var _0x4b38ba;if(_0x2d5bc3>=_0x44cddc){_0x2d5bc3=_0x44cddc;_0x4b38ba=0xc8;}else{_0x4b38ba=0xce;}_0xdfb54c[_0x0d01('0x16')](_0x4b38ba);return _0xdfb54c[_0x0d01('0x1d')](_0x0d01('0x1e'),_0x129790+'-'+_0x2d5bc3+'/'+_0x44cddc)['json'](_0x566346);}return null;};}function patchUpdates(_0x3a0035){return function(_0x532b73){try{jsonpatch[_0x0d01('0x1f')](_0x532b73,_0x3a0035,!![]);}catch(_0x56035f){return BPromise[_0x0d01('0x20')](_0x56035f);}return _0x532b73[_0x0d01('0x21')]();};}function saveUpdates(_0x356705,_0x2a3b6c){return function(_0x28a8e0){if(_0x28a8e0){return _0x28a8e0[_0x0d01('0x22')](_0x356705)[_0x0d01('0x23')](function(_0x373eb3){return _0x373eb3;});}return null;};}function removeEntity(_0x36dd94,_0x49d1b8){return function(_0x21d2fc){if(_0x21d2fc){return _0x21d2fc[_0x0d01('0x24')]()[_0x0d01('0x23')](function(){_0x36dd94[_0x0d01('0x16')](0xcc)[_0x0d01('0x17')]();});}};}function handleEntityNotFound(_0x4bef7c,_0x32e2ba){return function(_0x239d6e){if(!_0x239d6e){_0x4bef7c[_0x0d01('0x15')](0x194);}return _0x239d6e;};}function handleError(_0x3e3634,_0x5db6fa){_0x5db6fa=_0x5db6fa||0x1f4;return function(_0x8d2190){logger[_0x0d01('0x25')](_0x8d2190[_0x0d01('0x26')]);if(_0x8d2190['name']){delete _0x8d2190[_0x0d01('0x27')];}_0x3e3634[_0x0d01('0x16')](_0x5db6fa)[_0x0d01('0x28')](_0x8d2190);};}exports[_0x0d01('0x29')]=function(_0x167513,_0x52724c){var _0x5ee386={},_0x25fdcd={},_0x5d2cff={'count':0x0,'rows':[]};var _0x5d85ad=_['map'](db[_0x0d01('0x2a')][_0x0d01('0x2b')],function(_0x12ea28){return{'name':_0x12ea28[_0x0d01('0x2c')],'type':_0x12ea28[_0x0d01('0x2d')][_0x0d01('0x2e')]};});_0x25fdcd[_0x0d01('0x2f')]=_[_0x0d01('0x30')](_0x5d85ad,_0x0d01('0x27'));_0x25fdcd[_0x0d01('0x31')]=_[_0x0d01('0x32')](_0x167513['query']);_0x25fdcd['filters']=_[_0x0d01('0x33')](_0x25fdcd['model'],_0x25fdcd[_0x0d01('0x31')]);_0x5ee386[_0x0d01('0x34')]=_[_0x0d01('0x33')](_0x25fdcd[_0x0d01('0x2f')],qs['fields'](_0x167513[_0x0d01('0x31')][_0x0d01('0x35')]));_0x5ee386[_0x0d01('0x34')]=_0x5ee386[_0x0d01('0x34')][_0x0d01('0x36')]?_0x5ee386['attributes']:_0x25fdcd['model'];if(!_0x167513[_0x0d01('0x31')][_0x0d01('0x37')](_0x0d01('0x38'))){_0x5ee386[_0x0d01('0x1a')]=qs[_0x0d01('0x1a')](_0x167513[_0x0d01('0x31')]['limit']);_0x5ee386[_0x0d01('0x19')]=qs[_0x0d01('0x19')](_0x167513[_0x0d01('0x31')]['offset']);}_0x5ee386[_0x0d01('0x39')]=qs[_0x0d01('0x3a')](_0x167513['query']['sort']);_0x5ee386['where']=qs['filters'](_[_0x0d01('0x3b')](_0x167513['query'],_0x25fdcd[_0x0d01('0x3c')]),_0x5d85ad);if(_0x167513['query'][_0x0d01('0x3d')]){_0x5ee386[_0x0d01('0x3e')]=_[_0x0d01('0x3f')](_0x5ee386[_0x0d01('0x3e')],{'$or':_[_0x0d01('0x30')](_0x5d85ad,function(_0x3bb0fe){if(_0x3bb0fe[_0x0d01('0x2d')]!==_0x0d01('0x40')){var _0x32c992={};_0x32c992[_0x3bb0fe[_0x0d01('0x27')]]={'$like':'%'+_0x167513['query'][_0x0d01('0x3d')]+'%'};return _0x32c992;}})});}_0x5ee386=_[_0x0d01('0x3f')]({},_0x5ee386,_0x167513[_0x0d01('0x41')]);var _0x3269c3={'where':_0x5ee386[_0x0d01('0x3e')]};return db[_0x0d01('0x2a')]['count'](_0x3269c3)[_0x0d01('0x23')](function(_0x454fb6){_0x5d2cff[_0x0d01('0x1c')]=_0x454fb6;if(_0x167513['query'][_0x0d01('0x42')]){_0x5ee386['include']=[{'all':!![]}];}return db[_0x0d01('0x2a')]['findAll'](_0x5ee386);})[_0x0d01('0x23')](function(_0xf7f2f9){_0x5d2cff['rows']=_0xf7f2f9;return _0x5d2cff;})[_0x0d01('0x23')](respondWithFilteredResult(_0x52724c,_0x5ee386))[_0x0d01('0x43')](handleError(_0x52724c,null));};exports[_0x0d01('0x44')]=function(_0x162913,_0x2e5eda){var _0x4b5bdb={'raw':!![],'where':{'id':_0x162913[_0x0d01('0x45')]['id']}},_0x1d7442={};_0x1d7442[_0x0d01('0x2f')]=_[_0x0d01('0x32')](db[_0x0d01('0x2a')]['rawAttributes']);_0x1d7442[_0x0d01('0x31')]=_[_0x0d01('0x32')](_0x162913[_0x0d01('0x31')]);_0x1d7442['filters']=_[_0x0d01('0x33')](_0x1d7442['model'],_0x1d7442[_0x0d01('0x31')]);_0x4b5bdb[_0x0d01('0x34')]=_[_0x0d01('0x33')](_0x1d7442['model'],qs[_0x0d01('0x35')](_0x162913[_0x0d01('0x31')][_0x0d01('0x35')]));_0x4b5bdb[_0x0d01('0x34')]=_0x4b5bdb['attributes'][_0x0d01('0x36')]?_0x4b5bdb['attributes']:_0x1d7442['model'];if(_0x162913[_0x0d01('0x31')][_0x0d01('0x42')]){_0x4b5bdb[_0x0d01('0x46')]=[{'all':!![]}];}_0x4b5bdb=_['merge']({},_0x4b5bdb,_0x162913[_0x0d01('0x41')]);return db['MailTransferReport']['find'](_0x4b5bdb)['then'](handleEntityNotFound(_0x2e5eda,null))[_0x0d01('0x23')](respondWithResult(_0x2e5eda,null))[_0x0d01('0x43')](handleError(_0x2e5eda,null));};exports[_0x0d01('0x47')]=function(_0x3a0ad4,_0x1cdc8e){return db['MailTransferReport'][_0x0d01('0x47')](_0x3a0ad4[_0x0d01('0x48')],{})[_0x0d01('0x23')](respondWithResult(_0x1cdc8e,0xc9))[_0x0d01('0x43')](handleError(_0x1cdc8e,null));};exports['update']=function(_0x940743,_0x1c4b47){if(_0x940743['body']['id']){delete _0x940743['body']['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x940743['params']['id']}})['then'](handleEntityNotFound(_0x1c4b47,null))[_0x0d01('0x23')](saveUpdates(_0x940743[_0x0d01('0x48')],null))['then'](respondWithResult(_0x1c4b47,null))[_0x0d01('0x43')](handleError(_0x1c4b47,null));};exports[_0x0d01('0x24')]=function(_0x456849,_0x4b1f2b){return db[_0x0d01('0x2a')][_0x0d01('0x49')]({'where':{'id':_0x456849['params']['id']}})['then'](handleEntityNotFound(_0x4b1f2b,null))[_0x0d01('0x23')](removeEntity(_0x4b1f2b,null))[_0x0d01('0x43')](handleError(_0x4b1f2b,null));};exports['describe']=function(_0x4f5119,_0x2919af){return db[_0x0d01('0x2a')]['describe']()['then'](respondWithResult(_0x2919af,null))[_0x0d01('0x43')](handleError(_0x2919af,null));}; \ No newline at end of file +var _0x4d88=['where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','findAll','show','model','include','find','catch','create','body','params','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','error','name','index','map','MailTransferReport','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','length','nolimit','offset','sort'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4d88,0x12a));var _0x84d8=function(_0x3b4693,_0x3a608a){_0x3b4693=_0x3b4693-0x0;var _0x2750ed=_0x4d88[_0x3b4693];return _0x2750ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x84d8('0x0'));var zipdir=require(_0x84d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x84d8('0x2'));var BPromise=require(_0x84d8('0x3'));var Mustache=require(_0x84d8('0x4'));var util=require(_0x84d8('0x5'));var path=require(_0x84d8('0x6'));var sox=require(_0x84d8('0x7'));var csv=require(_0x84d8('0x8'));var ejs=require(_0x84d8('0x9'));var fs=require('fs');var fs_extra=require(_0x84d8('0xa'));var _=require(_0x84d8('0xb'));var squel=require(_0x84d8('0xc'));var crypto=require('crypto');var jsforce=require(_0x84d8('0xd'));var deskjs=require(_0x84d8('0xe'));var toCsv=require(_0x84d8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x84d8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x84d8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84d8('0x11'));var logger=require(_0x84d8('0x12'))('api');var utils=require(_0x84d8('0x13'));var config=require(_0x84d8('0x14'));var licenseUtil=require(_0x84d8('0x15'));var db=require(_0x84d8('0x16'))['db'];function respondWithStatusCode(_0x101ae9,_0x3b3fce){_0x3b3fce=_0x3b3fce||0xcc;return function(_0x82edcd){if(_0x82edcd){return _0x101ae9[_0x84d8('0x17')](_0x3b3fce);}return _0x101ae9[_0x84d8('0x18')](_0x3b3fce)[_0x84d8('0x19')]();};}function respondWithResult(_0x2436ba,_0x340e42){_0x340e42=_0x340e42||0xc8;return function(_0x9e4225){if(_0x9e4225){return _0x2436ba[_0x84d8('0x18')](_0x340e42)[_0x84d8('0x1a')](_0x9e4225);}};}function respondWithFilteredResult(_0x37e241,_0x2123ee){return function(_0x1823c5){if(_0x1823c5){var _0x5acee7=typeof _0x2123ee['offset']===_0x84d8('0x1b')&&typeof _0x2123ee[_0x84d8('0x1c')]===_0x84d8('0x1b');var _0x484dff=_0x1823c5[_0x84d8('0x1d')];var _0x56a5d2=_0x5acee7?0x0:_0x2123ee['offset'];var _0x365574=_0x5acee7?_0x1823c5[_0x84d8('0x1d')]:_0x2123ee['offset']+_0x2123ee[_0x84d8('0x1c')];var _0x34e298;if(_0x365574>=_0x484dff){_0x365574=_0x484dff;_0x34e298=0xc8;}else{_0x34e298=0xce;}_0x37e241[_0x84d8('0x18')](_0x34e298);return _0x37e241[_0x84d8('0x1e')]('Content-Range',_0x56a5d2+'-'+_0x365574+'/'+_0x484dff)[_0x84d8('0x1a')](_0x1823c5);}return null;};}function patchUpdates(_0x359328){return function(_0x4dbab7){try{jsonpatch['apply'](_0x4dbab7,_0x359328,!![]);}catch(_0x1e3d99){return BPromise[_0x84d8('0x1f')](_0x1e3d99);}return _0x4dbab7[_0x84d8('0x20')]();};}function saveUpdates(_0x3ea18a,_0x2c2b3e){return function(_0x4fb52b){if(_0x4fb52b){return _0x4fb52b[_0x84d8('0x21')](_0x3ea18a)[_0x84d8('0x22')](function(_0x565e8c){return _0x565e8c;});}return null;};}function removeEntity(_0x75f173,_0x3305ee){return function(_0x1554a8){if(_0x1554a8){return _0x1554a8['destroy']()[_0x84d8('0x22')](function(){_0x75f173['status'](0xcc)[_0x84d8('0x19')]();});}};}function handleEntityNotFound(_0x51a4a9,_0x2c37ce){return function(_0x5da1af){if(!_0x5da1af){_0x51a4a9[_0x84d8('0x17')](0x194);}return _0x5da1af;};}function handleError(_0x2a3f4e,_0x174d13){_0x174d13=_0x174d13||0x1f4;return function(_0x3a884d){logger[_0x84d8('0x23')](_0x3a884d['stack']);if(_0x3a884d[_0x84d8('0x24')]){delete _0x3a884d['name'];}_0x2a3f4e[_0x84d8('0x18')](_0x174d13)['send'](_0x3a884d);};}exports[_0x84d8('0x25')]=function(_0x396fa3,_0x426cb2){var _0x170cca={},_0x4c2730={},_0xfe8473={'count':0x0,'rows':[]};var _0x466297=_[_0x84d8('0x26')](db[_0x84d8('0x27')][_0x84d8('0x28')],function(_0x33f053){return{'name':_0x33f053[_0x84d8('0x29')],'type':_0x33f053['type'][_0x84d8('0x2a')]};});_0x4c2730['model']=_['map'](_0x466297,_0x84d8('0x24'));_0x4c2730[_0x84d8('0x2b')]=_[_0x84d8('0x2c')](_0x396fa3[_0x84d8('0x2b')]);_0x4c2730['filters']=_[_0x84d8('0x2d')](_0x4c2730['model'],_0x4c2730[_0x84d8('0x2b')]);_0x170cca[_0x84d8('0x2e')]=_[_0x84d8('0x2d')](_0x4c2730['model'],qs[_0x84d8('0x2f')](_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x2f')]));_0x170cca[_0x84d8('0x2e')]=_0x170cca[_0x84d8('0x2e')][_0x84d8('0x30')]?_0x170cca[_0x84d8('0x2e')]:_0x4c2730['model'];if(!_0x396fa3[_0x84d8('0x2b')]['hasOwnProperty'](_0x84d8('0x31'))){_0x170cca[_0x84d8('0x1c')]=qs[_0x84d8('0x1c')](_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x1c')]);_0x170cca[_0x84d8('0x32')]=qs[_0x84d8('0x32')](_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x32')]);}_0x170cca['order']=qs[_0x84d8('0x33')](_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x33')]);_0x170cca[_0x84d8('0x34')]=qs['filters'](_[_0x84d8('0x35')](_0x396fa3['query'],_0x4c2730[_0x84d8('0x36')]),_0x466297);if(_0x396fa3[_0x84d8('0x2b')]['filter']){_0x170cca[_0x84d8('0x34')]=_[_0x84d8('0x37')](_0x170cca[_0x84d8('0x34')],{'$or':_[_0x84d8('0x26')](_0x466297,function(_0x2bdbae){if(_0x2bdbae[_0x84d8('0x38')]!==_0x84d8('0x39')){var _0x31c0c3={};_0x31c0c3[_0x2bdbae[_0x84d8('0x24')]]={'$like':'%'+_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x3a')]+'%'};return _0x31c0c3;}})});}_0x170cca=_[_0x84d8('0x37')]({},_0x170cca,_0x396fa3[_0x84d8('0x3b')]);var _0x50f870={'where':_0x170cca[_0x84d8('0x34')]};return db[_0x84d8('0x27')]['count'](_0x50f870)[_0x84d8('0x22')](function(_0x2c385d){_0xfe8473[_0x84d8('0x1d')]=_0x2c385d;if(_0x396fa3[_0x84d8('0x2b')][_0x84d8('0x3c')]){_0x170cca['include']=[{'all':!![]}];}return db[_0x84d8('0x27')][_0x84d8('0x3d')](_0x170cca);})[_0x84d8('0x22')](function(_0x99f1d5){_0xfe8473['rows']=_0x99f1d5;return _0xfe8473;})['then'](respondWithFilteredResult(_0x426cb2,_0x170cca))['catch'](handleError(_0x426cb2,null));};exports[_0x84d8('0x3e')]=function(_0x374c0c,_0x4de1d3){var _0x1f82b4={'raw':!![],'where':{'id':_0x374c0c['params']['id']}},_0x49cdbf={};_0x49cdbf['model']=_[_0x84d8('0x2c')](db[_0x84d8('0x27')][_0x84d8('0x28')]);_0x49cdbf['query']=_[_0x84d8('0x2c')](_0x374c0c['query']);_0x49cdbf[_0x84d8('0x36')]=_[_0x84d8('0x2d')](_0x49cdbf['model'],_0x49cdbf[_0x84d8('0x2b')]);_0x1f82b4[_0x84d8('0x2e')]=_[_0x84d8('0x2d')](_0x49cdbf[_0x84d8('0x3f')],qs[_0x84d8('0x2f')](_0x374c0c['query']['fields']));_0x1f82b4['attributes']=_0x1f82b4[_0x84d8('0x2e')][_0x84d8('0x30')]?_0x1f82b4[_0x84d8('0x2e')]:_0x49cdbf['model'];if(_0x374c0c[_0x84d8('0x2b')][_0x84d8('0x3c')]){_0x1f82b4[_0x84d8('0x40')]=[{'all':!![]}];}_0x1f82b4=_[_0x84d8('0x37')]({},_0x1f82b4,_0x374c0c[_0x84d8('0x3b')]);return db[_0x84d8('0x27')][_0x84d8('0x41')](_0x1f82b4)[_0x84d8('0x22')](handleEntityNotFound(_0x4de1d3,null))[_0x84d8('0x22')](respondWithResult(_0x4de1d3,null))[_0x84d8('0x42')](handleError(_0x4de1d3,null));};exports['create']=function(_0x5a71fc,_0x27c2c2){return db[_0x84d8('0x27')][_0x84d8('0x43')](_0x5a71fc[_0x84d8('0x44')],{})[_0x84d8('0x22')](respondWithResult(_0x27c2c2,0xc9))[_0x84d8('0x42')](handleError(_0x27c2c2,null));};exports[_0x84d8('0x21')]=function(_0x5af64c,_0x2b1718){if(_0x5af64c['body']['id']){delete _0x5af64c[_0x84d8('0x44')]['id'];}return db[_0x84d8('0x27')]['find']({'where':{'id':_0x5af64c[_0x84d8('0x45')]['id']}})[_0x84d8('0x22')](handleEntityNotFound(_0x2b1718,null))[_0x84d8('0x22')](saveUpdates(_0x5af64c[_0x84d8('0x44')],null))['then'](respondWithResult(_0x2b1718,null))[_0x84d8('0x42')](handleError(_0x2b1718,null));};exports['destroy']=function(_0x3f09ee,_0x140357){return db[_0x84d8('0x27')][_0x84d8('0x41')]({'where':{'id':_0x3f09ee[_0x84d8('0x45')]['id']}})[_0x84d8('0x22')](handleEntityNotFound(_0x140357,null))[_0x84d8('0x22')](removeEntity(_0x140357,null))['catch'](handleError(_0x140357,null));};exports['describe']=function(_0xc37305,_0x4ece64){return db[_0x84d8('0x27')]['describe']()['then'](respondWithResult(_0x4ece64,null))[_0x84d8('0x42')](handleError(_0x4ece64,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 046cff5..4180ab1 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 _0x5fdc=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','moment','bluebird','path'];(function(_0x292c26,_0x453998){var _0x4be988=function(_0x48b997){while(--_0x48b997){_0x292c26['push'](_0x292c26['shift']());}};_0x4be988(++_0x453998);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x4619d6,_0x40f9a2){_0x4619d6=_0x4619d6-0x0;var _0xc5ed44=_0x5fdc[_0x4619d6];return _0xc5ed44;};'use strict';var _=require(_0xc5fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5fd('0x4'));var rimraf=require(_0xc5fd('0x5'));var config=require(_0xc5fd('0x6'));var attributes=require(_0xc5fd('0x7'));module[_0xc5fd('0x8')]=function(_0x2a2f9c,_0x34d4d5){return _0x2a2f9c[_0xc5fd('0x9')](_0xc5fd('0xa'),attributes,{'tableName':_0xc5fd('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc5fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8bf5=['../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8bf5,0x172));var _0x58bf=function(_0x53396d,_0x21e4a7){_0x53396d=_0x53396d-0x0;var _0x32e10f=_0x8bf5[_0x53396d];return _0x32e10f;};'use strict';var _=require('lodash');var util=require(_0x58bf('0x0'));var logger=require(_0x58bf('0x1'))(_0x58bf('0x2'));var moment=require('moment');var BPromise=require(_0x58bf('0x3'));var rp=require(_0x58bf('0x4'));var fs=require('fs');var path=require(_0x58bf('0x5'));var rimraf=require(_0x58bf('0x6'));var config=require(_0x58bf('0x7'));var attributes=require(_0x58bf('0x8'));module[_0x58bf('0x9')]=function(_0x1f4925,_0x488b45){return _0x1f4925[_0x58bf('0xa')](_0x58bf('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x58bf('0xc'),'fields':[_0x58bf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9e50a7e..abb851c 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 _0xb35d=['MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb35d,0xfb));var _0xdb35=function(_0x58e32c,_0x309781){_0x58e32c=_0x58e32c-0x0;var _0x481e60=_0xb35d[_0x58e32c];return _0x481e60;};'use strict';var _=require(_0xdb35('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb35('0x1'));var rs=require(_0xdb35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb35('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb35('0x4'))(_0xdb35('0x5'));var config=require(_0xdb35('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdb35('0x7')][_0xdb35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3079b4,_0x10c279,_0x39a0b3){return new BPromise(function(_0x23a8dc,_0x3c20af){return client['request'](_0x3079b4,_0x39a0b3)['then'](function(_0x126e4a){logger[_0xdb35('0x9')]('MailTransferReport,\x20%s,\x20%s',_0x10c279,'request\x20sent');logger[_0xdb35('0xa')](_0xdb35('0xb'),_0x10c279,_0xdb35('0xc'),JSON[_0xdb35('0xd')](_0x126e4a));if(_0x126e4a[_0xdb35('0xe')]){if(_0x126e4a[_0xdb35('0xe')]['code']===0x1f4){logger[_0xdb35('0xe')](_0xdb35('0xf'),_0x10c279,_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);return _0x3c20af(_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);}logger[_0xdb35('0xe')](_0xdb35('0xf'),_0x10c279,_0x126e4a['error'][_0xdb35('0x10')]);return _0x23a8dc(_0x126e4a[_0xdb35('0xe')][_0xdb35('0x10')]);}else{logger[_0xdb35('0x9')](_0xdb35('0xf'),_0x10c279,_0xdb35('0xc'));_0x23a8dc(_0x126e4a[_0xdb35('0x11')][_0xdb35('0x10')]);}})[_0xdb35('0x12')](function(_0x519a39){logger['error'](_0xdb35('0xf'),_0x10c279,_0x519a39);_0x3c20af(_0x519a39);});});} \ No newline at end of file +var _0x6564=['MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x6564,0x17d));var _0x4656=function(_0x49a5a1,_0x47d266){_0x49a5a1=_0x49a5a1-0x0;var _0x3c0177=_0x6564[_0x49a5a1];return _0x3c0177;};'use strict';var _=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var moment=require(_0x4656('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4656('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4656('0x4'));var logger=require(_0x4656('0x5'))('rpc');var config=require(_0x4656('0x6'));var jayson=require(_0x4656('0x7'));var client=jayson[_0x4656('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x550286,_0x661e18,_0x32c900){return new BPromise(function(_0x1c24d4,_0x55de2c){return client['request'](_0x550286,_0x32c900)['then'](function(_0x2a490f){logger[_0x4656('0x9')]('MailTransferReport,\x20%s,\x20%s',_0x661e18,'request\x20sent');logger['debug'](_0x4656('0xa'),_0x661e18,_0x4656('0xb'),JSON[_0x4656('0xc')](_0x2a490f));if(_0x2a490f['error']){if(_0x2a490f['error'][_0x4656('0xd')]===0x1f4){logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);return _0x55de2c(_0x2a490f['error'][_0x4656('0x10')]);}logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);return _0x1c24d4(_0x2a490f[_0x4656('0xe')][_0x4656('0x10')]);}else{logger['info'](_0x4656('0xf'),_0x661e18,_0x4656('0xb'));_0x1c24d4(_0x2a490f['result']['message']);}})[_0x4656('0x11')](function(_0x5b4d9c){logger[_0x4656('0xe')](_0x4656('0xf'),_0x661e18,_0x5b4d9c);_0x55de2c(_0x5b4d9c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a777925..bf38543 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 _0x7bd1=['create','update','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post'];(function(_0x5a9b50,_0x402800){var _0x3a02b6=function(_0x38d5f6){while(--_0x38d5f6){_0x5a9b50['push'](_0x5a9b50['shift']());}};_0x3a02b6(++_0x402800);}(_0x7bd1,0xd0));var _0x17bd=function(_0x2f8f75,_0x23ee4d){_0x2f8f75=_0x2f8f75-0x0;var _0x5c06d0=_0x7bd1[_0x2f8f75];return _0x5c06d0;};'use strict';var multer=require(_0x17bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17bd('0x1'));var router=express[_0x17bd('0x2')]();var fs_extra=require(_0x17bd('0x3'));var auth=require(_0x17bd('0x4'));var interaction=require(_0x17bd('0x5'));var config=require(_0x17bd('0x6'));var controller=require('./memberReport.controller');router[_0x17bd('0x7')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0x9')]);router[_0x17bd('0x7')]('/describe',auth[_0x17bd('0x8')](),controller[_0x17bd('0xa')]);router[_0x17bd('0x7')](_0x17bd('0xb'),auth[_0x17bd('0x8')](),controller['show']);router[_0x17bd('0xc')]('/',auth[_0x17bd('0x8')](),controller[_0x17bd('0xd')]);router['put']('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xe')]);router['delete']('/:id',auth[_0x17bd('0x8')](),controller[_0x17bd('0xf')]);module[_0x17bd('0x10')]=router; \ No newline at end of file +var _0xba5c=['/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x40ba08,_0x241b59){var _0x56a728=function(_0x1217f0){while(--_0x1217f0){_0x40ba08['push'](_0x40ba08['shift']());}};_0x56a728(++_0x241b59);}(_0xba5c,0x13b));var _0xcba5=function(_0x1090fb,_0x7db9c2){_0x1090fb=_0x1090fb-0x0;var _0x3cdb75=_0xba5c[_0x1090fb];return _0x3cdb75;};'use strict';var multer=require(_0xcba5('0x0'));var util=require(_0xcba5('0x1'));var path=require('path');var timeout=require(_0xcba5('0x2'));var express=require(_0xcba5('0x3'));var router=express[_0xcba5('0x4')]();var fs_extra=require(_0xcba5('0x5'));var auth=require(_0xcba5('0x6'));var interaction=require(_0xcba5('0x7'));var config=require(_0xcba5('0x8'));var controller=require(_0xcba5('0x9'));router[_0xcba5('0xa')]('/',auth[_0xcba5('0xb')](),controller[_0xcba5('0xc')]);router[_0xcba5('0xa')](_0xcba5('0xd'),auth[_0xcba5('0xb')](),controller[_0xcba5('0xe')]);router['get'](_0xcba5('0xf'),auth[_0xcba5('0xb')](),controller['show']);router['post']('/',auth[_0xcba5('0xb')](),controller[_0xcba5('0x10')]);router[_0xcba5('0x11')](_0xcba5('0xf'),auth['isAuthenticated'](),controller[_0xcba5('0x12')]);router[_0xcba5('0x13')](_0xcba5('0xf'),auth[_0xcba5('0xb')](),controller[_0xcba5('0x14')]);module[_0xcba5('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 04a1012..1ebf6be 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 _0xf167=['diff','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5c2f52,_0x46e3f5){var _0x1d704e=function(_0x2a0723){while(--_0x2a0723){_0x5c2f52['push'](_0x5c2f52['shift']());}};_0x1d704e(++_0x46e3f5);}(_0xf167,0x124));var _0x7f16=function(_0x1f1f3b,_0x227aa9){_0x1f1f3b=_0x1f1f3b-0x0;var _0x2e63aa=_0xf167[_0x1f1f3b];return _0x2e63aa;};'use strict';var Sequelize=require(_0x7f16('0x0'));var moment=require(_0x7f16('0x1'));module[_0x7f16('0x2')]={'channel':{'type':Sequelize[_0x7f16('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7f16('0x3')]},'type':{'type':Sequelize[_0x7f16('0x3')],'defaultValue':_0x7f16('0x4'),'comment':_0x7f16('0x5')},'duration':{'type':Sequelize[_0x7f16('0x6')]},'enterAt':{'type':Sequelize[_0x7f16('0x7')]},'exitAt':{'type':Sequelize[_0x7f16('0x7')],'set':function(_0x3b0b81){var _0x2c3352=moment(_0x3b0b81);var _0x177af2=moment(this['getDataValue']('enterAt'));var _0x29b4f8=_0x2c3352[_0x7f16('0x8')](_0x177af2,'seconds');this[_0x7f16('0x9')]('exitAt',_0x3b0b81);this[_0x7f16('0x9')](_0x7f16('0xa'),_0x29b4f8>=0x0?_0x29b4f8:null);}},'data1':{'type':Sequelize[_0x7f16('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x7f16('0xb')},'data3':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xc')},'data4':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xd')},'data5':{'type':Sequelize[_0x7f16('0x3')],'comment':_0x7f16('0xe')},'role':{'type':Sequelize[_0x7f16('0x3')]},'internal':{'type':Sequelize[_0x7f16('0x6')]},'uniqueid':{'type':Sequelize[_0x7f16('0x3')]}}; \ No newline at end of file +var _0x01ef=['exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment'];(function(_0x1a6f85,_0xff1ab3){var _0x53f940=function(_0x35837d){while(--_0x35837d){_0x1a6f85['push'](_0x1a6f85['shift']());}};_0x53f940(++_0xff1ab3);}(_0x01ef,0x142));var _0xf01e=function(_0x10302d,_0x3521e3){_0x10302d=_0x10302d-0x0;var _0x295324=_0x01ef[_0x10302d];return _0x295324;};'use strict';var Sequelize=require(_0xf01e('0x0'));var moment=require(_0xf01e('0x1'));module[_0xf01e('0x2')]={'channel':{'type':Sequelize[_0xf01e('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf01e('0x3')]},'type':{'type':Sequelize[_0xf01e('0x3')],'defaultValue':_0xf01e('0x4'),'comment':_0xf01e('0x5')},'duration':{'type':Sequelize[_0xf01e('0x6')]},'enterAt':{'type':Sequelize[_0xf01e('0x7')]},'exitAt':{'type':Sequelize[_0xf01e('0x7')],'set':function(_0x3c6d8f){var _0x4c8ba2=moment(_0x3c6d8f);var _0x10c584=moment(this[_0xf01e('0x8')](_0xf01e('0x9')));var _0xd9d427=_0x4c8ba2[_0xf01e('0xa')](_0x10c584,_0xf01e('0xb'));this[_0xf01e('0xc')](_0xf01e('0xd'),_0x3c6d8f);this['setDataValue'](_0xf01e('0xe'),_0xd9d427>=0x0?_0xd9d427:null);}},'data1':{'type':Sequelize[_0xf01e('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xf01e('0xf')},'data3':{'type':Sequelize[_0xf01e('0x3')],'comment':_0xf01e('0x10')},'data4':{'type':Sequelize[_0xf01e('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xf01e('0x3')],'comment':_0xf01e('0x11')},'role':{'type':Sequelize[_0xf01e('0x3')]},'internal':{'type':Sequelize[_0xf01e('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7e930aa..14e2766 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(_0x5242ce,_0x304f13){var _0x17d2a4=function(_0x5d4fe5){while(--_0x5d4fe5){_0x5242ce['push'](_0x5242ce['shift']());}};_0x17d2a4(++_0x304f13);}(_0x3e74,0x175));var _0x43e7=function(_0x191b51,_0x41f420){_0x191b51=_0x191b51-0x0;var _0x3a3b24=_0x3e74[_0x191b51];return _0x3a3b24;};'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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1c78dd,_0x117d6e){var _0x927903=function(_0x464012){while(--_0x464012){_0x1c78dd['push'](_0x1c78dd['shift']());}};_0x927903(++_0x117d6e);}(_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){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1c2a15f..4ef2fb0 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 _0xa5c9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x336837,_0x8af3e4){var _0xe4493b=function(_0x10c9f8){while(--_0x10c9f8){_0x336837['push'](_0x336837['shift']());}};_0xe4493b(++_0x8af3e4);}(_0xa5c9,0xda));var _0x9a5c=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa5c9[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require(_0x9a5c('0x4'));var BPromise=require(_0x9a5c('0x5'));var rp=require(_0x9a5c('0x6'));var fs=require('fs');var path=require(_0x9a5c('0x7'));var rimraf=require(_0x9a5c('0x8'));var config=require(_0x9a5c('0x9'));var attributes=require(_0x9a5c('0xa'));module['exports']=function(_0x4bce37,_0x57b9e1){return _0x4bce37[_0x9a5c('0xb')](_0x9a5c('0xc'),attributes,{'tableName':_0x9a5c('0xd'),'paranoid':![],'indexes':[{'name':_0x9a5c('0xe'),'fields':[_0x9a5c('0xf'),_0x9a5c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77a9=['../../config/environment','./memberReport.attributes','exports','report_member','membername_interface','interface','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x25c02f,_0x14714d){var _0x2c40a3=function(_0x3e3b11){while(--_0x3e3b11){_0x25c02f['push'](_0x25c02f['shift']());}};_0x2c40a3(++_0x14714d);}(_0x77a9,0x19e));var _0x977a=function(_0x15961b,_0x272dbe){_0x15961b=_0x15961b-0x0;var _0x4dfc47=_0x77a9[_0x15961b];return _0x4dfc47;};'use strict';var _=require(_0x977a('0x0'));var util=require('util');var logger=require(_0x977a('0x1'))('api');var moment=require(_0x977a('0x2'));var BPromise=require(_0x977a('0x3'));var rp=require(_0x977a('0x4'));var fs=require('fs');var path=require(_0x977a('0x5'));var rimraf=require('rimraf');var config=require(_0x977a('0x6'));var attributes=require(_0x977a('0x7'));module[_0x977a('0x8')]=function(_0x2b4ba5,_0x261e46){return _0x2b4ba5['define']('MemberReport',attributes,{'tableName':_0x977a('0x9'),'paranoid':![],'indexes':[{'name':_0x977a('0xa'),'fields':['membername',_0x977a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 88a7464..9c66c06 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 _0x85d0=['GetMemberReport','MemberReport','options','raw','attributes','include','map','model','catch','create','CreateMemberReport','UpdateMemberReport','update','body','where','limit','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x1cf6ef,_0x3a4330){var _0x291a34=function(_0x173cf1){while(--_0x173cf1){_0x1cf6ef['push'](_0x1cf6ef['shift']());}};_0x291a34(++_0x3a4330);}(_0x85d0,0x164));var _0x085d=function(_0x1b04d7,_0x390739){_0x1b04d7=_0x1b04d7-0x0;var _0x517396=_0x85d0[_0x1b04d7];return _0x517396;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x085d('0x0'));var fs=require('fs');var Redis=require(_0x085d('0x1'));var db=require(_0x085d('0x2'))['db'];var utils=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var jayson=require(_0x085d('0x6'));var client=jayson['client'][_0x085d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9acc97,_0x2a6902,_0x4a12b7){return new BPromise(function(_0xf65d01,_0xa94124){return client[_0x085d('0x8')](_0x9acc97,_0x4a12b7)[_0x085d('0x9')](function(_0x349271){logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));logger[_0x085d('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2a6902,_0x085d('0xc'),JSON[_0x085d('0xe')](_0x349271));if(_0x349271[_0x085d('0xf')]){if(_0x349271[_0x085d('0xf')]['code']===0x1f4){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x349271['error'][_0x085d('0x10')]);return _0xa94124(_0x349271[_0x085d('0xf')][_0x085d('0x10')]);}logger[_0x085d('0xf')]('MemberReport,\x20%s,\x20%s',_0x2a6902,_0x349271[_0x085d('0xf')][_0x085d('0x10')]);return _0xf65d01(_0x349271['error']['message']);}else{logger[_0x085d('0xa')](_0x085d('0xb'),_0x2a6902,_0x085d('0xc'));_0xf65d01(_0x349271[_0x085d('0x11')][_0x085d('0x10')]);}})['catch'](function(_0x2b29be){logger[_0x085d('0xf')](_0x085d('0xb'),_0x2a6902,_0x2b29be);_0xa94124(_0x2b29be);});});}exports[_0x085d('0x12')]=function(_0x3e566f){var _0x1c9de6=this;return new Promise(function(_0x5c046e,_0x6f7604){return db[_0x085d('0x13')]['findAll']({'raw':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')][_0x085d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')]['where']||null:null,'attributes':_0x3e566f[_0x085d('0x14')]?_0x3e566f[_0x085d('0x14')][_0x085d('0x16')]||null:null,'limit':_0x3e566f[_0x085d('0x14')]?_0x3e566f['options']['limit']||null:null,'include':_0x3e566f['options']?_0x3e566f[_0x085d('0x14')][_0x085d('0x17')]?_[_0x085d('0x18')](_0x3e566f[_0x085d('0x14')][_0x085d('0x17')],function(_0x17dafb){return{'model':db[_0x17dafb['model']],'as':_0x17dafb['as'],'attributes':_0x17dafb[_0x085d('0x16')],'include':_0x17dafb[_0x085d('0x17')]?_[_0x085d('0x18')](_0x17dafb['include'],function(_0x38cddc){return{'model':db[_0x38cddc[_0x085d('0x19')]],'as':_0x38cddc['as'],'attributes':_0x38cddc[_0x085d('0x16')],'include':_0x38cddc[_0x085d('0x17')]?_[_0x085d('0x18')](_0x38cddc['include'],function(_0x5e5228){return{'model':db[_0x5e5228['model']],'as':_0x5e5228['as'],'attributes':_0x5e5228[_0x085d('0x16')]};}):[]};}):[]};}):[]:[]})[_0x085d('0x9')](function(_0x402440){logger['info'](_0x085d('0x12'),_0x3e566f);logger[_0x085d('0xd')](_0x085d('0x12'),_0x3e566f,JSON['stringify'](_0x402440));_0x5c046e(_0x402440);})[_0x085d('0x1a')](function(_0x2eae2c){logger[_0x085d('0xf')](_0x085d('0x12'),_0x2eae2c['message'],_0x3e566f);_0x6f7604(_0x1c9de6[_0x085d('0xf')](0x1f4,_0x2eae2c[_0x085d('0x10')]));});});};exports['CreateMemberReport']=function(_0x33305c){var _0x326a12=this;return new Promise(function(_0x4b0066,_0x2b8858){return db[_0x085d('0x13')][_0x085d('0x1b')](_0x33305c['body'],{'raw':_0x33305c[_0x085d('0x14')]?_0x33305c[_0x085d('0x14')][_0x085d('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x1bb369){logger['info'](_0x085d('0x1c'),_0x33305c);logger[_0x085d('0xd')](_0x085d('0x1c'),_0x33305c,JSON[_0x085d('0xe')](_0x1bb369));_0x4b0066(_0x1bb369);})['catch'](function(_0x1f6f72){logger[_0x085d('0xf')](_0x085d('0x1c'),_0x1f6f72[_0x085d('0x10')],_0x33305c);_0x2b8858(_0x326a12['error'](0x1f4,_0x1f6f72['message']));});});};exports[_0x085d('0x1d')]=function(_0x2e27ce){var _0xa4d581=this;return new Promise(function(_0x19386,_0x22a83f){return db[_0x085d('0x13')][_0x085d('0x1e')](_0x2e27ce[_0x085d('0x1f')],{'raw':_0x2e27ce[_0x085d('0x14')]?_0x2e27ce['options'][_0x085d('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e27ce[_0x085d('0x14')]?_0x2e27ce['options'][_0x085d('0x20')]||null:null,'attributes':_0x2e27ce['options']?_0x2e27ce[_0x085d('0x14')][_0x085d('0x16')]||null:null,'limit':_0x2e27ce['options']?_0x2e27ce[_0x085d('0x14')][_0x085d('0x21')]||null:null})[_0x085d('0x9')](function(_0x13c7e3){logger[_0x085d('0xa')]('UpdateMemberReport',_0x2e27ce);logger[_0x085d('0xd')]('UpdateMemberReport',_0x2e27ce,JSON['stringify'](_0x13c7e3));_0x19386(_0x13c7e3);})[_0x085d('0x1a')](function(_0x32bf4f){logger[_0x085d('0xf')](_0x085d('0x1d'),_0x32bf4f[_0x085d('0x10')],_0x2e27ce);_0x22a83f(_0xa4d581['error'](0x1f4,_0x32bf4f[_0x085d('0x10')]));});});}; \ No newline at end of file +var _0x24ce=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','raw','where','attributes','include','model','map','CreateMemberReport','create','body','UpdateMemberReport','limit','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2d437b,_0x4a5c63){var _0x462042=function(_0x5233f8){while(--_0x5233f8){_0x2d437b['push'](_0x2d437b['shift']());}};_0x462042(++_0x4a5c63);}(_0x24ce,0x1de));var _0xe24c=function(_0x133d42,_0x56f623){_0x133d42=_0x133d42-0x0;var _0x103ede=_0x24ce[_0x133d42];return _0x103ede;};'use strict';var _=require('lodash');var util=require(_0xe24c('0x0'));var moment=require(_0xe24c('0x1'));var BPromise=require(_0xe24c('0x2'));var rs=require(_0xe24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe24c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe24c('0x5'));var jayson=require(_0xe24c('0x6'));var client=jayson[_0xe24c('0x7')][_0xe24c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1d970,_0x496abb,_0x6d00e){return new BPromise(function(_0x2d8dde,_0x1e02af){return client[_0xe24c('0x9')](_0xe1d970,_0x6d00e)[_0xe24c('0xa')](function(_0x33e9d3){logger[_0xe24c('0xb')](_0xe24c('0xc'),_0x496abb,_0xe24c('0xd'));logger[_0xe24c('0xe')](_0xe24c('0xf'),_0x496abb,_0xe24c('0xd'),JSON[_0xe24c('0x10')](_0x33e9d3));if(_0x33e9d3['error']){if(_0x33e9d3[_0xe24c('0x11')]['code']===0x1f4){logger[_0xe24c('0x11')]('MemberReport,\x20%s,\x20%s',_0x496abb,_0x33e9d3[_0xe24c('0x11')][_0xe24c('0x12')]);return _0x1e02af(_0x33e9d3['error']['message']);}logger['error'](_0xe24c('0xc'),_0x496abb,_0x33e9d3['error'][_0xe24c('0x12')]);return _0x2d8dde(_0x33e9d3[_0xe24c('0x11')][_0xe24c('0x12')]);}else{logger[_0xe24c('0xb')]('MemberReport,\x20%s,\x20%s',_0x496abb,_0xe24c('0xd'));_0x2d8dde(_0x33e9d3[_0xe24c('0x13')][_0xe24c('0x12')]);}})[_0xe24c('0x14')](function(_0x261609){logger[_0xe24c('0x11')](_0xe24c('0xc'),_0x496abb,_0x261609);_0x1e02af(_0x261609);});});}exports[_0xe24c('0x15')]=function(_0x384bd2){var _0x6c7fe2=this;return new Promise(function(_0xed9c0b,_0x1589cc){return db[_0xe24c('0x16')]['findAll']({'raw':_0x384bd2[_0xe24c('0x17')]?_0x384bd2[_0xe24c('0x17')][_0xe24c('0x18')]===undefined?!![]:![]:!![],'where':_0x384bd2['options']?_0x384bd2[_0xe24c('0x17')][_0xe24c('0x19')]||null:null,'attributes':_0x384bd2[_0xe24c('0x17')]?_0x384bd2[_0xe24c('0x17')][_0xe24c('0x1a')]||null:null,'limit':_0x384bd2[_0xe24c('0x17')]?_0x384bd2['options']['limit']||null:null,'include':_0x384bd2['options']?_0x384bd2[_0xe24c('0x17')]['include']?_['map'](_0x384bd2[_0xe24c('0x17')][_0xe24c('0x1b')],function(_0x267de3){return{'model':db[_0x267de3[_0xe24c('0x1c')]],'as':_0x267de3['as'],'attributes':_0x267de3[_0xe24c('0x1a')],'include':_0x267de3[_0xe24c('0x1b')]?_[_0xe24c('0x1d')](_0x267de3[_0xe24c('0x1b')],function(_0x2b6bcf){return{'model':db[_0x2b6bcf[_0xe24c('0x1c')]],'as':_0x2b6bcf['as'],'attributes':_0x2b6bcf[_0xe24c('0x1a')],'include':_0x2b6bcf['include']?_[_0xe24c('0x1d')](_0x2b6bcf[_0xe24c('0x1b')],function(_0x12b536){return{'model':db[_0x12b536[_0xe24c('0x1c')]],'as':_0x12b536['as'],'attributes':_0x12b536[_0xe24c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe24c('0xa')](function(_0x377dbd){logger[_0xe24c('0xb')](_0xe24c('0x15'),_0x384bd2);logger[_0xe24c('0xe')]('GetMemberReport',_0x384bd2,JSON[_0xe24c('0x10')](_0x377dbd));_0xed9c0b(_0x377dbd);})[_0xe24c('0x14')](function(_0x51d81e){logger[_0xe24c('0x11')](_0xe24c('0x15'),_0x51d81e['message'],_0x384bd2);_0x1589cc(_0x6c7fe2['error'](0x1f4,_0x51d81e[_0xe24c('0x12')]));});});};exports[_0xe24c('0x1e')]=function(_0x2eda7a){var _0x4d6e7d=this;return new Promise(function(_0x1e8d7e,_0x5430f9){return db['MemberReport'][_0xe24c('0x1f')](_0x2eda7a[_0xe24c('0x20')],{'raw':_0x2eda7a['options']?_0x2eda7a['options'][_0xe24c('0x18')]===undefined?!![]:![]:!![]})[_0xe24c('0xa')](function(_0x2c2b89){logger[_0xe24c('0xb')]('CreateMemberReport',_0x2eda7a);logger['debug']('CreateMemberReport',_0x2eda7a,JSON[_0xe24c('0x10')](_0x2c2b89));_0x1e8d7e(_0x2c2b89);})[_0xe24c('0x14')](function(_0x11ac90){logger['error'](_0xe24c('0x1e'),_0x11ac90[_0xe24c('0x12')],_0x2eda7a);_0x5430f9(_0x4d6e7d[_0xe24c('0x11')](0x1f4,_0x11ac90[_0xe24c('0x12')]));});});};exports[_0xe24c('0x21')]=function(_0x56ec9c){var _0x578103=this;return new Promise(function(_0x145c92,_0x77f337){return db['MemberReport']['update'](_0x56ec9c[_0xe24c('0x20')],{'raw':_0x56ec9c[_0xe24c('0x17')]?_0x56ec9c[_0xe24c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56ec9c[_0xe24c('0x17')]?_0x56ec9c[_0xe24c('0x17')][_0xe24c('0x19')]||null:null,'attributes':_0x56ec9c[_0xe24c('0x17')]?_0x56ec9c[_0xe24c('0x17')]['attributes']||null:null,'limit':_0x56ec9c[_0xe24c('0x17')]?_0x56ec9c[_0xe24c('0x17')][_0xe24c('0x22')]||null:null})['then'](function(_0x28abe4){logger[_0xe24c('0xb')]('UpdateMemberReport',_0x56ec9c);logger[_0xe24c('0xe')](_0xe24c('0x21'),_0x56ec9c,JSON[_0xe24c('0x10')](_0x28abe4));_0x145c92(_0x28abe4);})[_0xe24c('0x14')](function(_0x5dbd73){logger[_0xe24c('0x11')](_0xe24c('0x21'),_0x5dbd73[_0xe24c('0x12')],_0x56ec9c);_0x77f337(_0x578103[_0xe24c('0x11')](0x1f4,_0x5dbd73[_0xe24c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 152e301..ecc5d47 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 _0x2265=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x543ac1,_0x209912){var _0x36ccc3=function(_0x4a71a4){while(--_0x4a71a4){_0x543ac1['push'](_0x543ac1['shift']());}};_0x36ccc3(++_0x209912);}(_0x2265,0x114));var _0x5226=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x2265[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x5226('0x0'));var util=require(_0x5226('0x1'));var path=require(_0x5226('0x2'));var timeout=require(_0x5226('0x3'));var express=require(_0x5226('0x4'));var router=express[_0x5226('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5226('0x6'));var interaction=require(_0x5226('0x7'));var config=require('../../config/environment');var controller=require(_0x5226('0x8'));router[_0x5226('0x9')]('/',controller['index']);module[_0x5226('0xa')]=router; \ No newline at end of file +var _0x728f=['./migration.controller','get','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x560bfc,_0x38c114){var _0x55b6be=function(_0x2831e7){while(--_0x2831e7){_0x560bfc['push'](_0x560bfc['shift']());}};_0x55b6be(++_0x38c114);}(_0x728f,0x67));var _0xf728=function(_0x29b3d9,_0x370ba0){_0x29b3d9=_0x29b3d9-0x0;var _0x2fa445=_0x728f[_0x29b3d9];return _0x2fa445;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf728('0x0'));var timeout=require(_0xf728('0x1'));var express=require(_0xf728('0x2'));var router=express[_0xf728('0x3')]();var fs_extra=require(_0xf728('0x4'));var auth=require(_0xf728('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf728('0x6'));var controller=require(_0xf728('0x7'));router[_0xf728('0x8')]('/',controller['index']);module[_0xf728('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d56df5b..e9a1e26 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 _0xc886=['STRING','version','sequelize','exports'];(function(_0x51baf5,_0x56276d){var _0x1a9173=function(_0x479f64){while(--_0x479f64){_0x51baf5['push'](_0x51baf5['shift']());}};_0x1a9173(++_0x56276d);}(_0xc886,0x11a));var _0x6c88=function(_0x301808,_0x3d53e1){_0x301808=_0x301808-0x0;var _0x2db2e6=_0xc886[_0x301808];return _0x2db2e6;};'use strict';var Sequelize=require(_0x6c88('0x0'));module[_0x6c88('0x1')]={'version':{'type':Sequelize[_0x6c88('0x2')],'unique':_0x6c88('0x3')}}; \ No newline at end of file +var _0x1f5d=['version','sequelize','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1f5d,0x1a8));var _0xd1f5=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x1f5d[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require(_0xd1f5('0x0'));module['exports']={'version':{'type':Sequelize[_0xd1f5('0x1')],'unique':_0xd1f5('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ccabe60..ecc2453 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 _0xc2f9=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','eml-format'];(function(_0x5c3435,_0x302791){var _0x13a0be=function(_0x5a9032){while(--_0x5a9032){_0x5c3435['push'](_0x5c3435['shift']());}};_0x13a0be(++_0x302791);}(_0xc2f9,0x167));var _0x9c2f=function(_0x5ec4d2,_0xf51fd8){_0x5ec4d2=_0x5ec4d2-0x0;var _0xeb7593=_0xc2f9[_0x5ec4d2];return _0xeb7593;};'use strict';var emlformat=require(_0x9c2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c2f('0x1'));var rp=require(_0x9c2f('0x2'));var moment=require(_0x9c2f('0x3'));var BPromise=require(_0x9c2f('0x4'));var Mustache=require(_0x9c2f('0x5'));var util=require('util');var path=require(_0x9c2f('0x6'));var sox=require(_0x9c2f('0x7'));var csv=require(_0x9c2f('0x8'));var ejs=require(_0x9c2f('0x9'));var fs=require('fs');var fs_extra=require(_0x9c2f('0xa'));var _=require(_0x9c2f('0xb'));var squel=require(_0x9c2f('0xc'));var crypto=require(_0x9c2f('0xd'));var jsforce=require(_0x9c2f('0xe'));var deskjs=require(_0x9c2f('0xf'));var toCsv=require(_0x9c2f('0x8'));var querystring=require(_0x9c2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9c2f('0x11'));var authService=require(_0x9c2f('0x12'));var qs=require(_0x9c2f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c2f('0x14'));var logger=require(_0x9c2f('0x15'))(_0x9c2f('0x16'));var utils=require(_0x9c2f('0x17'));var config=require(_0x9c2f('0x18'));var licenseUtil=require(_0x9c2f('0x19'));var db=require(_0x9c2f('0x1a'))['db'];function respondWithStatusCode(_0xc99058,_0x4cd71d){_0x4cd71d=_0x4cd71d||0xcc;return function(_0x31e697){if(_0x31e697){return _0xc99058[_0x9c2f('0x1b')](_0x4cd71d);}return _0xc99058[_0x9c2f('0x1c')](_0x4cd71d)[_0x9c2f('0x1d')]();};}function respondWithResult(_0x5257ac,_0x201fe8){_0x201fe8=_0x201fe8||0xc8;return function(_0x16de68){if(_0x16de68){return _0x5257ac[_0x9c2f('0x1c')](_0x201fe8)[_0x9c2f('0x1e')](_0x16de68);}};}function respondWithFilteredResult(_0x33c2e5,_0x940be5){return function(_0x14a1f8){if(_0x14a1f8){var _0x22139c=typeof _0x940be5['offset']===_0x9c2f('0x1f')&&typeof _0x940be5[_0x9c2f('0x20')]===_0x9c2f('0x1f');var _0x46f89a=_0x14a1f8[_0x9c2f('0x21')];var _0x17aa5e=_0x22139c?0x0:_0x940be5[_0x9c2f('0x22')];var _0x268245=_0x22139c?_0x14a1f8[_0x9c2f('0x21')]:_0x940be5[_0x9c2f('0x22')]+_0x940be5[_0x9c2f('0x20')];var _0x243c5f;if(_0x268245>=_0x46f89a){_0x268245=_0x46f89a;_0x243c5f=0xc8;}else{_0x243c5f=0xce;}_0x33c2e5['status'](_0x243c5f);return _0x33c2e5[_0x9c2f('0x23')](_0x9c2f('0x24'),_0x17aa5e+'-'+_0x268245+'/'+_0x46f89a)[_0x9c2f('0x1e')](_0x14a1f8);}return null;};}function patchUpdates(_0x504446){return function(_0x237d78){try{jsonpatch[_0x9c2f('0x25')](_0x237d78,_0x504446,!![]);}catch(_0xfaefe2){return BPromise[_0x9c2f('0x26')](_0xfaefe2);}return _0x237d78[_0x9c2f('0x27')]();};}function saveUpdates(_0x5465e2,_0x32f778){return function(_0x4df193){if(_0x4df193){return _0x4df193[_0x9c2f('0x28')](_0x5465e2)['then'](function(_0x529570){return _0x529570;});}return null;};}function removeEntity(_0x242aff,_0x3613d4){return function(_0x2149c4){if(_0x2149c4){return _0x2149c4[_0x9c2f('0x29')]()['then'](function(){_0x242aff[_0x9c2f('0x1c')](0xcc)[_0x9c2f('0x1d')]();});}};}function handleEntityNotFound(_0x2daf6b,_0x55496c){return function(_0x5900d8){if(!_0x5900d8){_0x2daf6b['sendStatus'](0x194);}return _0x5900d8;};}function handleError(_0x57720e,_0x49b1e0){_0x49b1e0=_0x49b1e0||0x1f4;return function(_0x38e962){logger['error'](_0x38e962['stack']);if(_0x38e962[_0x9c2f('0x2a')]){delete _0x38e962[_0x9c2f('0x2a')];}_0x57720e[_0x9c2f('0x1c')](_0x49b1e0)[_0x9c2f('0x2b')](_0x38e962);};}exports['index']=function(_0x4b962e,_0xbc5b9c){var _0x2232c5={},_0x369f1f={},_0x630ea1={'count':0x0,'rows':[]};var _0x543686=_[_0x9c2f('0x2c')](db[_0x9c2f('0x2d')][_0x9c2f('0x2e')],function(_0xf7ceea){return{'name':_0xf7ceea[_0x9c2f('0x2f')],'type':_0xf7ceea[_0x9c2f('0x30')][_0x9c2f('0x31')]};});_0x369f1f[_0x9c2f('0x32')]=_[_0x9c2f('0x2c')](_0x543686,_0x9c2f('0x2a'));_0x369f1f[_0x9c2f('0x33')]=_['keys'](_0x4b962e[_0x9c2f('0x33')]);_0x369f1f[_0x9c2f('0x34')]=_[_0x9c2f('0x35')](_0x369f1f[_0x9c2f('0x32')],_0x369f1f[_0x9c2f('0x33')]);_0x2232c5['attributes']=_[_0x9c2f('0x35')](_0x369f1f['model'],qs[_0x9c2f('0x36')](_0x4b962e[_0x9c2f('0x33')]['fields']));_0x2232c5[_0x9c2f('0x37')]=_0x2232c5[_0x9c2f('0x37')][_0x9c2f('0x38')]?_0x2232c5[_0x9c2f('0x37')]:_0x369f1f[_0x9c2f('0x32')];if(!_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x39')](_0x9c2f('0x3a'))){_0x2232c5[_0x9c2f('0x20')]=qs[_0x9c2f('0x20')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x20')]);_0x2232c5[_0x9c2f('0x22')]=qs['offset'](_0x4b962e['query'][_0x9c2f('0x22')]);}_0x2232c5[_0x9c2f('0x3b')]=qs[_0x9c2f('0x3c')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3c')]);_0x2232c5['where']=qs[_0x9c2f('0x34')](_['pick'](_0x4b962e[_0x9c2f('0x33')],_0x369f1f[_0x9c2f('0x34')]),_0x543686);if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3d')]){_0x2232c5[_0x9c2f('0x3e')]=_['merge'](_0x2232c5[_0x9c2f('0x3e')],{'$or':_[_0x9c2f('0x2c')](_0x543686,function(_0x107eb1){if(_0x107eb1[_0x9c2f('0x30')]!==_0x9c2f('0x3f')){var _0x46ac47={};_0x46ac47[_0x107eb1[_0x9c2f('0x2a')]]={'$like':'%'+_0x4b962e[_0x9c2f('0x33')]['filter']+'%'};return _0x46ac47;}})});}_0x2232c5=_[_0x9c2f('0x40')]({},_0x2232c5,_0x4b962e[_0x9c2f('0x41')]);var _0x526b18={'where':_0x2232c5[_0x9c2f('0x3e')]};return db[_0x9c2f('0x2d')][_0x9c2f('0x21')](_0x526b18)[_0x9c2f('0x42')](function(_0x253ba4){_0x630ea1['count']=_0x253ba4;if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x43')]){_0x2232c5[_0x9c2f('0x44')]=[{'all':!![]}];}return db[_0x9c2f('0x2d')][_0x9c2f('0x45')](_0x2232c5);})['then'](function(_0x23cf60){_0x630ea1[_0x9c2f('0x46')]=_0x23cf60;return _0x630ea1;})[_0x9c2f('0x42')](respondWithFilteredResult(_0xbc5b9c,_0x2232c5))[_0x9c2f('0x47')](handleError(_0xbc5b9c,null));}; \ No newline at end of file +var _0x9e4a=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','eml-format','rimraf','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/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','status','end','stack','name','map','Migration','rawAttributes','type','key'];(function(_0x449166,_0x35d5c7){var _0x37916d=function(_0x8e4ba1){while(--_0x8e4ba1){_0x449166['push'](_0x449166['shift']());}};_0x37916d(++_0x35d5c7);}(_0x9e4a,0x128));var _0xa9e4=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9e4a[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0xa9e4('0x0'));var rimraf=require(_0xa9e4('0x1'));var zipdir=require(_0xa9e4('0x2'));var jsonpatch=require(_0xa9e4('0x3'));var rp=require(_0xa9e4('0x4'));var moment=require(_0xa9e4('0x5'));var BPromise=require(_0xa9e4('0x6'));var Mustache=require(_0xa9e4('0x7'));var util=require(_0xa9e4('0x8'));var path=require(_0xa9e4('0x9'));var sox=require('sox');var csv=require(_0xa9e4('0xa'));var ejs=require(_0xa9e4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9e4('0xc'));var squel=require(_0xa9e4('0xd'));var crypto=require(_0xa9e4('0xe'));var jsforce=require(_0xa9e4('0xf'));var deskjs=require(_0xa9e4('0x10'));var toCsv=require(_0xa9e4('0xa'));var querystring=require(_0xa9e4('0x11'));var Papa=require(_0xa9e4('0x12'));var Redis=require(_0xa9e4('0x13'));var authService=require(_0xa9e4('0x14'));var qs=require(_0xa9e4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9e4('0x16'))(_0xa9e4('0x17'));var utils=require('../../config/utils');var config=require(_0xa9e4('0x18'));var licenseUtil=require(_0xa9e4('0x19'));var db=require(_0xa9e4('0x1a'))['db'];function respondWithStatusCode(_0x2d6121,_0x12653d){_0x12653d=_0x12653d||0xcc;return function(_0x2eed0f){if(_0x2eed0f){return _0x2d6121[_0xa9e4('0x1b')](_0x12653d);}return _0x2d6121['status'](_0x12653d)['end']();};}function respondWithResult(_0x311ea5,_0x40b146){_0x40b146=_0x40b146||0xc8;return function(_0x439232){if(_0x439232){return _0x311ea5['status'](_0x40b146)[_0xa9e4('0x1c')](_0x439232);}};}function respondWithFilteredResult(_0x4b2f1c,_0x69dbaf){return function(_0x513fe2){if(_0x513fe2){var _0x20e5ba=typeof _0x69dbaf[_0xa9e4('0x1d')]===_0xa9e4('0x1e')&&typeof _0x69dbaf[_0xa9e4('0x1f')]===_0xa9e4('0x1e');var _0x1aaf44=_0x513fe2[_0xa9e4('0x20')];var _0x5c34e0=_0x20e5ba?0x0:_0x69dbaf[_0xa9e4('0x1d')];var _0x31840b=_0x20e5ba?_0x513fe2['count']:_0x69dbaf['offset']+_0x69dbaf[_0xa9e4('0x1f')];var _0x511883;if(_0x31840b>=_0x1aaf44){_0x31840b=_0x1aaf44;_0x511883=0xc8;}else{_0x511883=0xce;}_0x4b2f1c['status'](_0x511883);return _0x4b2f1c[_0xa9e4('0x21')](_0xa9e4('0x22'),_0x5c34e0+'-'+_0x31840b+'/'+_0x1aaf44)[_0xa9e4('0x1c')](_0x513fe2);}return null;};}function patchUpdates(_0x386061){return function(_0x5fc7c5){try{jsonpatch[_0xa9e4('0x23')](_0x5fc7c5,_0x386061,!![]);}catch(_0x1b124f){return BPromise[_0xa9e4('0x24')](_0x1b124f);}return _0x5fc7c5[_0xa9e4('0x25')]();};}function saveUpdates(_0x50e2aa,_0x281b1f){return function(_0x4b2eba){if(_0x4b2eba){return _0x4b2eba['update'](_0x50e2aa)[_0xa9e4('0x26')](function(_0x1b3e26){return _0x1b3e26;});}return null;};}function removeEntity(_0x3ff02e,_0xe2757b){return function(_0x2e81e3){if(_0x2e81e3){return _0x2e81e3[_0xa9e4('0x27')]()[_0xa9e4('0x26')](function(){_0x3ff02e[_0xa9e4('0x28')](0xcc)[_0xa9e4('0x29')]();});}};}function handleEntityNotFound(_0x58cab3,_0x474084){return function(_0x12d9ab){if(!_0x12d9ab){_0x58cab3[_0xa9e4('0x1b')](0x194);}return _0x12d9ab;};}function handleError(_0xc2b49e,_0x22fdd3){_0x22fdd3=_0x22fdd3||0x1f4;return function(_0x1bc563){logger['error'](_0x1bc563[_0xa9e4('0x2a')]);if(_0x1bc563[_0xa9e4('0x2b')]){delete _0x1bc563[_0xa9e4('0x2b')];}_0xc2b49e[_0xa9e4('0x28')](_0x22fdd3)['send'](_0x1bc563);};}exports['index']=function(_0x3df514,_0x3fed42){var _0x4055d5={},_0x5f0131={},_0x2d2192={'count':0x0,'rows':[]};var _0x472cc7=_[_0xa9e4('0x2c')](db[_0xa9e4('0x2d')][_0xa9e4('0x2e')],function(_0x5e719d){return{'name':_0x5e719d['fieldName'],'type':_0x5e719d[_0xa9e4('0x2f')][_0xa9e4('0x30')]};});_0x5f0131[_0xa9e4('0x31')]=_[_0xa9e4('0x2c')](_0x472cc7,_0xa9e4('0x2b'));_0x5f0131[_0xa9e4('0x32')]=_[_0xa9e4('0x33')](_0x3df514[_0xa9e4('0x32')]);_0x5f0131[_0xa9e4('0x34')]=_['intersection'](_0x5f0131['model'],_0x5f0131[_0xa9e4('0x32')]);_0x4055d5[_0xa9e4('0x35')]=_[_0xa9e4('0x36')](_0x5f0131[_0xa9e4('0x31')],qs[_0xa9e4('0x37')](_0x3df514[_0xa9e4('0x32')][_0xa9e4('0x37')]));_0x4055d5[_0xa9e4('0x35')]=_0x4055d5[_0xa9e4('0x35')][_0xa9e4('0x38')]?_0x4055d5[_0xa9e4('0x35')]:_0x5f0131[_0xa9e4('0x31')];if(!_0x3df514['query'][_0xa9e4('0x39')](_0xa9e4('0x3a'))){_0x4055d5[_0xa9e4('0x1f')]=qs[_0xa9e4('0x1f')](_0x3df514[_0xa9e4('0x32')][_0xa9e4('0x1f')]);_0x4055d5[_0xa9e4('0x1d')]=qs[_0xa9e4('0x1d')](_0x3df514[_0xa9e4('0x32')][_0xa9e4('0x1d')]);}_0x4055d5[_0xa9e4('0x3b')]=qs[_0xa9e4('0x3c')](_0x3df514[_0xa9e4('0x32')][_0xa9e4('0x3c')]);_0x4055d5[_0xa9e4('0x3d')]=qs[_0xa9e4('0x34')](_[_0xa9e4('0x3e')](_0x3df514[_0xa9e4('0x32')],_0x5f0131['filters']),_0x472cc7);if(_0x3df514['query'][_0xa9e4('0x3f')]){_0x4055d5[_0xa9e4('0x3d')]=_[_0xa9e4('0x40')](_0x4055d5[_0xa9e4('0x3d')],{'$or':_['map'](_0x472cc7,function(_0x39126b){if(_0x39126b[_0xa9e4('0x2f')]!==_0xa9e4('0x41')){var _0x5452e6={};_0x5452e6[_0x39126b[_0xa9e4('0x2b')]]={'$like':'%'+_0x3df514['query'][_0xa9e4('0x3f')]+'%'};return _0x5452e6;}})});}_0x4055d5=_[_0xa9e4('0x40')]({},_0x4055d5,_0x3df514['options']);var _0x4219ed={'where':_0x4055d5['where']};return db['Migration'][_0xa9e4('0x20')](_0x4219ed)[_0xa9e4('0x26')](function(_0x51c8f9){_0x2d2192['count']=_0x51c8f9;if(_0x3df514['query'][_0xa9e4('0x42')]){_0x4055d5['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x4055d5);})[_0xa9e4('0x26')](function(_0x1628ba){_0x2d2192[_0xa9e4('0x43')]=_0x1628ba;return _0x2d2192;})[_0xa9e4('0x26')](respondWithFilteredResult(_0x3fed42,_0x4055d5))[_0xa9e4('0x44')](handleError(_0x3fed42,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6afb8d4..ca9b7d4 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 _0xbe79=['Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x4fd467,_0x52315a){var _0x213143=function(_0x4e4423){while(--_0x4e4423){_0x4fd467['push'](_0x4fd467['shift']());}};_0x213143(++_0x52315a);}(_0xbe79,0x64));var _0x9be7=function(_0x13e998,_0x1e4e68){_0x13e998=_0x13e998-0x0;var _0x142948=_0xbe79[_0x13e998];return _0x142948;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))(_0x9be7('0x3'));var moment=require(_0x9be7('0x4'));var BPromise=require(_0x9be7('0x5'));var rp=require(_0x9be7('0x6'));var fs=require('fs');var path=require(_0x9be7('0x7'));var rimraf=require(_0x9be7('0x8'));var config=require(_0x9be7('0x9'));var attributes=require(_0x9be7('0xa'));module['exports']=function(_0xaef0df,_0xbf323f){return _0xaef0df[_0x9be7('0xb')](_0x9be7('0xc'),attributes,{'tableName':_0x9be7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7695=['request-promise','path','rimraf','../../config/environment','define','Migration','migrations','lodash','util','moment'];(function(_0x5b64b7,_0x2778f4){var _0x335e7a=function(_0xc37880){while(--_0xc37880){_0x5b64b7['push'](_0x5b64b7['shift']());}};_0x335e7a(++_0x2778f4);}(_0x7695,0x147));var _0x5769=function(_0x107277,_0xbfb919){_0x107277=_0x107277-0x0;var _0x41dcc9=_0x7695[_0x107277];return _0x41dcc9;};'use strict';var _=require(_0x5769('0x0'));var util=require(_0x5769('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5769('0x2'));var BPromise=require('bluebird');var rp=require(_0x5769('0x3'));var fs=require('fs');var path=require(_0x5769('0x4'));var rimraf=require(_0x5769('0x5'));var config=require(_0x5769('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x47a6d8,_0x35dd40){return _0x47a6d8[_0x5769('0x7')](_0x5769('0x8'),attributes,{'tableName':_0x5769('0x9'),'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 7092e21..70be120 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 _0xaf80=['result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x47b747,_0x1059a3){var _0x13be0=function(_0x39b008){while(--_0x39b008){_0x47b747['push'](_0x47b747['shift']());}};_0x13be0(++_0x1059a3);}(_0xaf80,0x1ef));var _0x0af8=function(_0x555fa9,_0x194ef2){_0x555fa9=_0x555fa9-0x0;var _0x37d16e=_0xaf80[_0x555fa9];return _0x37d16e;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('Migration,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});} \ No newline at end of file +var _0x98b7=['message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x5572d2,_0x5e01cb){var _0x36bf49=function(_0x3a82ae){while(--_0x3a82ae){_0x5572d2['push'](_0x5572d2['shift']());}};_0x36bf49(++_0x5e01cb);}(_0x98b7,0xc1));var _0x798b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x98b7[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var moment=require(_0x798b('0x2'));var BPromise=require(_0x798b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x798b('0x4'));var logger=require(_0x798b('0x5'))(_0x798b('0x6'));var config=require(_0x798b('0x7'));var jayson=require(_0x798b('0x8'));var client=jayson['client'][_0x798b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d70b2,_0x2b904b,_0xbf4c6c){return new BPromise(function(_0x3fb4de,_0x14994d){return client[_0x798b('0xa')](_0x5d70b2,_0xbf4c6c)['then'](function(_0x24b028){logger['info'](_0x798b('0xb'),_0x2b904b,'request\x20sent');logger[_0x798b('0xc')](_0x798b('0xd'),_0x2b904b,_0x798b('0xe'),JSON['stringify'](_0x24b028));if(_0x24b028['error']){if(_0x24b028[_0x798b('0xf')][_0x798b('0x10')]===0x1f4){logger[_0x798b('0xf')]('Migration,\x20%s,\x20%s',_0x2b904b,_0x24b028[_0x798b('0xf')]['message']);return _0x14994d(_0x24b028[_0x798b('0xf')]['message']);}logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);return _0x3fb4de(_0x24b028[_0x798b('0xf')][_0x798b('0x11')]);}else{logger[_0x798b('0x12')]('Migration,\x20%s,\x20%s',_0x2b904b,'request\x20sent');_0x3fb4de(_0x24b028[_0x798b('0x13')][_0x798b('0x11')]);}})[_0x798b('0x14')](function(_0x19b15c){logger[_0x798b('0xf')](_0x798b('0xb'),_0x2b904b,_0x19b15c);_0x14994d(_0x19b15c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 9be3432..31bbde7 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 _0x431b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','get','show','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x431b,0x18d));var _0xb431=function(_0x303986,_0x5c751c){_0x303986=_0x303986-0x0;var _0x4c4431=_0x431b[_0x303986];return _0x4c4431;};'use strict';var multer=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var path=require(_0xb431('0x2'));var timeout=require('connect-timeout');var express=require(_0xb431('0x3'));var router=express[_0xb431('0x4')]();var fs_extra=require(_0xb431('0x5'));var auth=require(_0xb431('0x6'));var interaction=require(_0xb431('0x7'));var config=require(_0xb431('0x8'));var controller=require(_0xb431('0x9'));router['get']('/',auth[_0xb431('0xa')](),controller['index']);router[_0xb431('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb431('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb431('0xd')]);router[_0xb431('0xe')](_0xb431('0xf'),auth[_0xb431('0xa')](),controller[_0xb431('0x10')]);router[_0xb431('0x11')](_0xb431('0xf'),auth['isAuthenticated'](),controller[_0xb431('0x12')]);module[_0xb431('0x13')]=router; \ No newline at end of file +var _0xef9e=['get','/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./network.controller','index'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xef9e,0x1ef));var _0xeef9=function(_0x5805bb,_0x5d781c){_0x5805bb=_0x5805bb-0x0;var _0x3938e7=_0xef9e[_0x5805bb];return _0x3938e7;};'use strict';var multer=require(_0xeef9('0x0'));var util=require('util');var path=require(_0xeef9('0x1'));var timeout=require(_0xeef9('0x2'));var express=require(_0xeef9('0x3'));var router=express[_0xeef9('0x4')]();var fs_extra=require(_0xeef9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeef9('0x6'));var controller=require(_0xeef9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeef9('0x8')]);router[_0xeef9('0x9')](_0xeef9('0xa'),auth['isAuthenticated'](),controller[_0xeef9('0xb')]);router['post']('/',auth[_0xeef9('0xc')](),controller[_0xeef9('0xd')]);router[_0xeef9('0xe')](_0xeef9('0xa'),auth[_0xeef9('0xc')](),controller['update']);router[_0xeef9('0xf')](_0xeef9('0xa'),auth[_0xeef9('0xc')](),controller[_0xeef9('0x10')]);module[_0xeef9('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 85b29e9..d5f380c 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 _0x2a60=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0xb25d59,_0x263d6e){var _0x4fabcc=function(_0x1862b8){while(--_0x1862b8){_0xb25d59['push'](_0xb25d59['shift']());}};_0x4fabcc(++_0x263d6e);}(_0x2a60,0x1c8));var _0x02a6=function(_0x4a5a9b,_0x452ac8){_0x4a5a9b=_0x4a5a9b-0x0;var _0x3419f0=_0x2a60[_0x4a5a9b];return _0x3419f0;};'use strict';var Sequelize=require(_0x02a6('0x0'));module[_0x02a6('0x1')]={'type':{'type':Sequelize[_0x02a6('0x2')](_0x02a6('0x3'),_0x02a6('0x4'),_0x02a6('0x5'),_0x02a6('0x6'))},'value':{'type':Sequelize[_0x02a6('0x7')]},'username':{'type':Sequelize[_0x02a6('0x7')]},'password':{'type':Sequelize[_0x02a6('0x7')]}}; \ No newline at end of file +var _0xbf15=['stun','turn','STRING','ENUM','localnet','externip'];(function(_0x2449f7,_0x5ed7d4){var _0x4a5ae2=function(_0x52796a){while(--_0x52796a){_0x2449f7['push'](_0x2449f7['shift']());}};_0x4a5ae2(++_0x5ed7d4);}(_0xbf15,0x1d1));var _0x5bf1=function(_0x29da92,_0x4e9596){_0x29da92=_0x29da92-0x0;var _0xac2f=_0xbf15[_0x29da92];return _0xac2f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5bf1('0x0')](_0x5bf1('0x1'),_0x5bf1('0x2'),_0x5bf1('0x3'),_0x5bf1('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5bf1('0x5')]},'password':{'type':Sequelize[_0x5bf1('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d4b0fcc..d3442d1 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 _0x39e8=['request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','limit','count','set','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','model','map','keys','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','intersection','length','find','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','findAll','server/files/templates/stun_multiple.ejs','TURN','chan_sip.so','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39e8,0x1ec));var _0x839e=function(_0xdee8a1,_0x3c4ab1){_0xdee8a1=_0xdee8a1-0x0;var _0x47f6fb=_0x39e8[_0xdee8a1];return _0x47f6fb;};'use strict';var util=require(_0x839e('0x0'));var path=require(_0x839e('0x1'));var ejs=require(_0x839e('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x839e('0x3'));var logger=require(_0x839e('0x4'))(_0x839e('0x5'));var config=require('../../config/environment');var db=require(_0x839e('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x839e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49f160,_0x154f1c,_0x48f6cc,_0xa03428){return new Promise(function(_0x4ee3ee,_0x406e3a){var _0x44e362=_0xa03428||client;return _0x44e362[_0x839e('0x8')](_0x49f160,_0x48f6cc)[_0x839e('0x9')](function(_0x2d59e5){logger[_0x839e('0xa')](_0x839e('0xb'),_0x154f1c,_0x839e('0xc'));logger[_0x839e('0xd')](_0x839e('0xe'),_0x154f1c,_0x839e('0xc'),JSON[_0x839e('0xf')](_0x2d59e5));if(_0x2d59e5[_0x839e('0x10')]){if(_0x2d59e5[_0x839e('0x10')][_0x839e('0x11')]===0x1f4){logger[_0x839e('0x10')](_0x839e('0xb'),_0x154f1c,_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);return _0x406e3a(_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);}logger[_0x839e('0x10')]('Network,\x20%s,\x20%s',_0x154f1c,_0x2d59e5['error']['message']);return _0x4ee3ee(_0x2d59e5[_0x839e('0x10')][_0x839e('0x12')]);}else{logger[_0x839e('0xa')](_0x839e('0xb'),_0x154f1c,_0x839e('0xc'));_0x4ee3ee(_0x2d59e5['result'][_0x839e('0x12')]);}})[_0x839e('0x13')](function(_0x50b743){logger['error'](_0x839e('0xb'),_0x154f1c,_0x50b743);_0x406e3a(_0x50b743);});});}function respondWithResult(_0x3dc3bb,_0x37458d){_0x37458d=_0x37458d||0xc8;return function(_0x4ceb61){if(_0x4ceb61){return _0x3dc3bb[_0x839e('0x14')](_0x37458d)[_0x839e('0x15')](_0x4ceb61);}};}function respondWithFilteredResult(_0xab1536,_0x4841f6){return function(_0xc09210){if(_0xc09210){var _0x48594e=typeof _0x4841f6[_0x839e('0x16')]===_0x839e('0x17')&&typeof _0x4841f6[_0x839e('0x18')]==='undefined';var _0x3adb36=_0xc09210[_0x839e('0x19')];var _0x59250e=_0x48594e?0x0:_0x4841f6[_0x839e('0x16')];var _0x2690ec=_0x48594e?_0xc09210[_0x839e('0x19')]:_0x4841f6[_0x839e('0x16')]+_0x4841f6[_0x839e('0x18')];var _0x515096;if(_0x2690ec>=_0x3adb36){_0x2690ec=_0x3adb36;_0x515096=0xc8;}else{_0x515096=0xce;}_0xab1536['status'](_0x515096);return _0xab1536[_0x839e('0x1a')]('Content-Range',_0x59250e+'-'+_0x2690ec+'/'+_0x3adb36)[_0x839e('0x15')](_0xc09210);}return null;};}function saveUpdates(_0x1d961d){return function(_0x4eac69){if(_0x4eac69){return _0x4eac69[_0x839e('0x1b')](_0x1d961d)['then'](function(_0x3cd6b4){return _0x3cd6b4;});}return null;};}function removeEntity(_0x93d344){return function(_0x178390){if(_0x178390){return _0x178390[_0x839e('0x1c')]()['then'](function(){_0x93d344[_0x839e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43db88){return function(_0x1d0609){if(!_0x1d0609){_0x43db88['sendStatus'](0x194);}return _0x1d0609;};}function handleError(_0x1645b8,_0x13fe46){_0x13fe46=_0x13fe46||0x1f4;return function(_0xdadf92){logger[_0x839e('0x10')](_0xdadf92[_0x839e('0x1d')]);if(_0xdadf92[_0x839e('0x1e')]){delete _0xdadf92[_0x839e('0x1e')];}_0x1645b8[_0x839e('0x14')](_0x13fe46)[_0x839e('0x1f')](_0xdadf92);};}exports[_0x839e('0x20')]=function(_0x4ca768,_0x420187){var _0x149a2a={},_0x4a0001={},_0x595662={'count':0x0,'rows':[]};var _0x1e3c72=_['map'](db[_0x839e('0x21')][_0x839e('0x22')],function(_0x9d085d){return{'name':_0x9d085d[_0x839e('0x23')],'type':_0x9d085d[_0x839e('0x24')]['key']};});_0x4a0001[_0x839e('0x25')]=_[_0x839e('0x26')](_0x1e3c72,'name');_0x4a0001['query']=_[_0x839e('0x27')](_0x4ca768[_0x839e('0x28')]);_0x4a0001[_0x839e('0x29')]=_['intersection'](_0x4a0001[_0x839e('0x25')],_0x4a0001[_0x839e('0x28')]);_0x149a2a['attributes']=_['intersection'](_0x4a0001['model'],qs['fields'](_0x4ca768[_0x839e('0x28')][_0x839e('0x2a')]));_0x149a2a[_0x839e('0x2b')]=_0x149a2a['attributes']['length']?_0x149a2a[_0x839e('0x2b')]:_0x4a0001[_0x839e('0x25')];if(!_0x4ca768['query'][_0x839e('0x2c')](_0x839e('0x2d'))){_0x149a2a[_0x839e('0x18')]=qs[_0x839e('0x18')](_0x4ca768[_0x839e('0x28')]['limit']);_0x149a2a['offset']=qs[_0x839e('0x16')](_0x4ca768[_0x839e('0x28')][_0x839e('0x16')]);}_0x149a2a[_0x839e('0x2e')]=qs[_0x839e('0x2f')](_0x4ca768[_0x839e('0x28')][_0x839e('0x2f')]);_0x149a2a[_0x839e('0x30')]=qs['filters'](_[_0x839e('0x31')](_0x4ca768['query'],_0x4a0001[_0x839e('0x29')]),_0x1e3c72);if(_0x4ca768[_0x839e('0x28')][_0x839e('0x32')]){_0x149a2a[_0x839e('0x30')]=_[_0x839e('0x33')](_0x149a2a[_0x839e('0x30')],{'$or':_['map'](_0x1e3c72,function(_0xefc80c){if(_0xefc80c['type']!==_0x839e('0x34')){var _0xc4f997={};_0xc4f997[_0xefc80c[_0x839e('0x1e')]]={'$like':'%'+_0x4ca768[_0x839e('0x28')][_0x839e('0x32')]+'%'};return _0xc4f997;}})});}_0x149a2a=_['merge']({},_0x149a2a,_0x4ca768[_0x839e('0x35')]);var _0x516af1={'where':_0x149a2a[_0x839e('0x30')]};return db[_0x839e('0x21')][_0x839e('0x19')](_0x516af1)['then'](function(_0x42f947){_0x595662[_0x839e('0x19')]=_0x42f947;if(_0x4ca768[_0x839e('0x28')][_0x839e('0x36')]){_0x149a2a[_0x839e('0x37')]=[{'all':!![]}];}return db['Network']['findAll'](_0x149a2a);})[_0x839e('0x9')](function(_0x2393a4){_0x595662[_0x839e('0x38')]=_0x2393a4;return _0x595662;})[_0x839e('0x9')](respondWithFilteredResult(_0x420187,_0x149a2a))['catch'](handleError(_0x420187,null));};exports['show']=function(_0x4e0fbe,_0x5ca5ce){var _0x4f1b99={'raw':!![],'where':{'id':_0x4e0fbe['params']['id']}},_0x52ac64={};_0x52ac64[_0x839e('0x25')]=_[_0x839e('0x27')](db['Network'][_0x839e('0x22')]);_0x52ac64[_0x839e('0x28')]=_['keys'](_0x4e0fbe['query']);_0x52ac64[_0x839e('0x29')]=_[_0x839e('0x39')](_0x52ac64[_0x839e('0x25')],_0x52ac64[_0x839e('0x28')]);_0x4f1b99['attributes']=_['intersection'](_0x52ac64[_0x839e('0x25')],qs[_0x839e('0x2a')](_0x4e0fbe['query']['fields']));_0x4f1b99['attributes']=_0x4f1b99[_0x839e('0x2b')][_0x839e('0x3a')]?_0x4f1b99[_0x839e('0x2b')]:_0x52ac64[_0x839e('0x25')];if(_0x4e0fbe[_0x839e('0x28')][_0x839e('0x36')]){_0x4f1b99[_0x839e('0x37')]=[{'all':!![]}];}_0x4f1b99=_['merge']({},_0x4f1b99,_0x4e0fbe['options']);return db[_0x839e('0x21')][_0x839e('0x3b')](_0x4f1b99)[_0x839e('0x9')](handleEntityNotFound(_0x5ca5ce,null))[_0x839e('0x9')](respondWithResult(_0x5ca5ce,null))[_0x839e('0x13')](handleError(_0x5ca5ce,null));};exports[_0x839e('0x3c')]=function(_0x1ec462,_0x2ceb6c){var _0x51816d;return db[_0x839e('0x21')]['create'](_0x1ec462[_0x839e('0x3d')],{'raw':!![]})[_0x839e('0x9')](function(_0x15cfd2){_0x51816d=_0x15cfd2;return db[_0x839e('0x21')]['findAll']({'where':{'type':_0x1ec462[_0x839e('0x3d')][_0x839e('0x24')]},'raw':!![]});})['then'](function(_0x44d26c){if(_0x51816d[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x4e7b08=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],'server/files/templates/stun_multiple.ejs'),_0x839e('0x43'));var _0x52e3fd=ejs[_0x839e('0x44')](_0x4e7b08,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](_0x839e('0x46'),_0x52e3fd);return respondWithRpcPromise('Reload',_0x839e('0x3c'),{'module':_0x839e('0x47')});}else if(_0x51816d[_0x839e('0x24')][_0x839e('0x3e')]()=='TURN'){var _0x177717=fs[_0x839e('0x40')](path['join'](config['root'],_0x839e('0x48')),_0x839e('0x43'));var _0x309baa=ejs['render'](_0x177717,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](_0x839e('0x49'),_0x309baa);return respondWithRpcPromise(_0x839e('0x4a'),'create',{'module':_0x839e('0x47')});}else{var _0x1ec86d=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],_0x839e('0x4b')),_0x839e('0x43'));var _0x5c2c46=ejs[_0x839e('0x44')](_0x1ec86d,{'networks':_0x44d26c||[]});fs[_0x839e('0x45')](util[_0x839e('0x4c')](_0x839e('0x4d'),_0x1ec462['body']['type'][_0x839e('0x4e')]()),_0x5c2c46);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x3c'),{'module':'chan_sip.so'});}})['then'](function(){return _0x51816d;})[_0x839e('0x9')](respondWithResult(_0x2ceb6c,0xc9))[_0x839e('0x13')](handleError(_0x2ceb6c,null));};exports[_0x839e('0x1b')]=function(_0x3c0d49,_0x28db92){var _0x225765;return db[_0x839e('0x21')][_0x839e('0x3b')]({'where':{'id':_0x3c0d49[_0x839e('0x4f')]['id']}})[_0x839e('0x9')](handleEntityNotFound(_0x28db92,null))['then'](saveUpdates(_0x3c0d49[_0x839e('0x3d')],null))[_0x839e('0x9')](function(_0x394a56){if(_0x394a56){_0x225765=_0x394a56;return db[_0x839e('0x21')][_0x839e('0x50')]({'where':{'type':_0x225765[_0x839e('0x24')]},'raw':!![]});}return null;})[_0x839e('0x9')](function(_0x5326ca){if(_0x225765[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x2ad06a=fs['readFileSync'](path['join'](config[_0x839e('0x42')],_0x839e('0x51')),'utf8');var _0x28e549=ejs['render'](_0x2ad06a,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')]('/etc/asterisk/stun_xcally.conf',_0x28e549);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x225765[_0x839e('0x24')]['toUpperCase']()==_0x839e('0x52')){var _0x27a191=fs[_0x839e('0x40')](path[_0x839e('0x41')](config['root'],_0x839e('0x48')),_0x839e('0x43'));var _0x50fb4e=ejs[_0x839e('0x44')](_0x27a191,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')](_0x839e('0x49'),_0x50fb4e);return respondWithRpcPromise('Reload',_0x839e('0x1b'),{'module':_0x839e('0x47')});}else{var _0x36d90e=fs[_0x839e('0x40')](path[_0x839e('0x41')](config['root'],_0x839e('0x4b')),_0x839e('0x43'));var _0x1e3a48=ejs[_0x839e('0x44')](_0x36d90e,{'networks':_0x5326ca||[]});fs[_0x839e('0x45')](util['format'](_0x839e('0x4d'),_0x3c0d49['body'][_0x839e('0x24')][_0x839e('0x4e')]()),_0x1e3a48);return respondWithRpcPromise('Reload',_0x839e('0x1b'),{'module':_0x839e('0x53')});}})[_0x839e('0x9')](function(_0x1c8f80){if(_0x1c8f80){return _0x225765;}return null;})[_0x839e('0x9')](respondWithResult(_0x28db92,null))[_0x839e('0x13')](handleError(_0x28db92,null));};exports[_0x839e('0x1c')]=function(_0x49123d,_0x48a845){var _0x16c344;return db['Network'][_0x839e('0x3b')]({'where':{'id':_0x49123d[_0x839e('0x4f')]['id']}})[_0x839e('0x9')](function(_0x3e23d1){_0x16c344=_0x3e23d1;return _0x3e23d1;})[_0x839e('0x9')](handleEntityNotFound(_0x48a845,null))[_0x839e('0x9')](removeEntity(_0x48a845,null))['then'](function(){if(_0x16c344){return db[_0x839e('0x21')][_0x839e('0x50')]({'where':{'type':_0x16c344['type']},'raw':!![]});}})[_0x839e('0x9')](function(_0x5c5ebe){if(_0x16c344['type'][_0x839e('0x3e')]()==_0x839e('0x3f')){var _0x35b267=fs['readFileSync'](path[_0x839e('0x41')](config[_0x839e('0x42')],'server/files/templates/stun_multiple.ejs'),_0x839e('0x43'));var _0x3b02bb=ejs[_0x839e('0x44')](_0x35b267,{'networks':_0x5c5ebe||[]});fs[_0x839e('0x45')](_0x839e('0x46'),_0x3b02bb);return respondWithRpcPromise(_0x839e('0x4a'),_0x839e('0x1c'),{'module':_0x839e('0x47')});}else if(_0x16c344[_0x839e('0x24')][_0x839e('0x3e')]()==_0x839e('0x52')){var _0x2915e1=fs[_0x839e('0x40')](path[_0x839e('0x41')](config[_0x839e('0x42')],_0x839e('0x48')),_0x839e('0x43'));var _0x6f9a7c=ejs[_0x839e('0x44')](_0x2915e1,{'networks':_0x5c5ebe||[]});fs['writeFileSync'](_0x839e('0x49'),_0x6f9a7c);return respondWithRpcPromise('Reload',_0x839e('0x1c'),{'module':_0x839e('0x47')});}else{var _0xab43ab=fs['readFileSync'](path['join'](config[_0x839e('0x42')],_0x839e('0x4b')),_0x839e('0x43'));var _0x21696f=ejs[_0x839e('0x44')](_0xab43ab,{'networks':_0x5c5ebe||[]});fs[_0x839e('0x45')](util[_0x839e('0x4c')](_0x839e('0x4d'),_0x16c344[_0x839e('0x24')]['toLowerCase']()),_0x21696f);return respondWithRpcPromise(_0x839e('0x4a'),'destroy',{'module':'chan_sip.so'});}})[_0x839e('0x13')](handleError(_0x48a845,null));}; \ No newline at end of file +var _0xc251=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','sendStatus','stack','send','index','map','Network','fieldName','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','update','find','server/files/templates/stun_multiple.ejs','toLowerCase','util','path','lodash','../../components/parsers/qs','../../config/environment','../../mysqldb','jayson/promise','client','http','request'];(function(_0x52f090,_0x2833a2){var _0x9e11ae=function(_0x47aa53){while(--_0x47aa53){_0x52f090['push'](_0x52f090['shift']());}};_0x9e11ae(++_0x2833a2);}(_0xc251,0x1a9));var _0x1c25=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xc251[_0x12f688];return _0x59c3de;};'use strict';var util=require(_0x1c25('0x0'));var path=require(_0x1c25('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c25('0x2'));var qs=require(_0x1c25('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x1c25('0x4'));var db=require(_0x1c25('0x5'))['db'];var jayson=require(_0x1c25('0x6'));var client=jayson[_0x1c25('0x7')][_0x1c25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52b63c,_0x1cb521,_0x11f483,_0x12811f){return new Promise(function(_0x42813f,_0x185598){var _0x57e1c0=_0x12811f||client;return _0x57e1c0[_0x1c25('0x9')](_0x52b63c,_0x11f483)['then'](function(_0x5dd7f9){logger[_0x1c25('0xa')](_0x1c25('0xb'),_0x1cb521,_0x1c25('0xc'));logger[_0x1c25('0xd')](_0x1c25('0xe'),_0x1cb521,'request\x20sent',JSON['stringify'](_0x5dd7f9));if(_0x5dd7f9[_0x1c25('0xf')]){if(_0x5dd7f9[_0x1c25('0xf')]['code']===0x1f4){logger[_0x1c25('0xf')](_0x1c25('0xb'),_0x1cb521,_0x5dd7f9[_0x1c25('0xf')]['message']);return _0x185598(_0x5dd7f9[_0x1c25('0xf')][_0x1c25('0x10')]);}logger[_0x1c25('0xf')](_0x1c25('0xb'),_0x1cb521,_0x5dd7f9[_0x1c25('0xf')][_0x1c25('0x10')]);return _0x42813f(_0x5dd7f9['error'][_0x1c25('0x10')]);}else{logger[_0x1c25('0xa')](_0x1c25('0xb'),_0x1cb521,_0x1c25('0xc'));_0x42813f(_0x5dd7f9[_0x1c25('0x11')][_0x1c25('0x10')]);}})['catch'](function(_0x1847eb){logger[_0x1c25('0xf')](_0x1c25('0xb'),_0x1cb521,_0x1847eb);_0x185598(_0x1847eb);});});}function respondWithResult(_0x2b9126,_0x4b9185){_0x4b9185=_0x4b9185||0xc8;return function(_0x413ed6){if(_0x413ed6){return _0x2b9126[_0x1c25('0x12')](_0x4b9185)['json'](_0x413ed6);}};}function respondWithFilteredResult(_0x2e722e,_0x3de4b9){return function(_0x31dc21){if(_0x31dc21){var _0x210b66=typeof _0x3de4b9[_0x1c25('0x13')]===_0x1c25('0x14')&&typeof _0x3de4b9[_0x1c25('0x15')]===_0x1c25('0x14');var _0x437f4=_0x31dc21[_0x1c25('0x16')];var _0x552f40=_0x210b66?0x0:_0x3de4b9[_0x1c25('0x13')];var _0x2d87bf=_0x210b66?_0x31dc21['count']:_0x3de4b9['offset']+_0x3de4b9[_0x1c25('0x15')];var _0x5bb0c2;if(_0x2d87bf>=_0x437f4){_0x2d87bf=_0x437f4;_0x5bb0c2=0xc8;}else{_0x5bb0c2=0xce;}_0x2e722e[_0x1c25('0x12')](_0x5bb0c2);return _0x2e722e[_0x1c25('0x17')](_0x1c25('0x18'),_0x552f40+'-'+_0x2d87bf+'/'+_0x437f4)[_0x1c25('0x19')](_0x31dc21);}return null;};}function saveUpdates(_0x14828b){return function(_0x1f8193){if(_0x1f8193){return _0x1f8193['update'](_0x14828b)[_0x1c25('0x1a')](function(_0x5707be){return _0x5707be;});}return null;};}function removeEntity(_0x51b81b){return function(_0x5495b6){if(_0x5495b6){return _0x5495b6[_0x1c25('0x1b')]()['then'](function(){_0x51b81b[_0x1c25('0x12')](0xcc)[_0x1c25('0x1c')]();});}};}function handleEntityNotFound(_0x2408ad){return function(_0x262a1c){if(!_0x262a1c){_0x2408ad[_0x1c25('0x1d')](0x194);}return _0x262a1c;};}function handleError(_0x1735d8,_0x36c5f1){_0x36c5f1=_0x36c5f1||0x1f4;return function(_0x3902e5){logger[_0x1c25('0xf')](_0x3902e5[_0x1c25('0x1e')]);if(_0x3902e5['name']){delete _0x3902e5['name'];}_0x1735d8[_0x1c25('0x12')](_0x36c5f1)[_0x1c25('0x1f')](_0x3902e5);};}exports[_0x1c25('0x20')]=function(_0x346bbc,_0x32594b){var _0x12f30b={},_0x4a645a={},_0x4ffe8b={'count':0x0,'rows':[]};var _0x6789df=_[_0x1c25('0x21')](db[_0x1c25('0x22')]['rawAttributes'],function(_0xec0fb5){return{'name':_0xec0fb5[_0x1c25('0x23')],'type':_0xec0fb5['type']['key']};});_0x4a645a[_0x1c25('0x24')]=_[_0x1c25('0x21')](_0x6789df,_0x1c25('0x25'));_0x4a645a[_0x1c25('0x26')]=_[_0x1c25('0x27')](_0x346bbc['query']);_0x4a645a[_0x1c25('0x28')]=_[_0x1c25('0x29')](_0x4a645a[_0x1c25('0x24')],_0x4a645a[_0x1c25('0x26')]);_0x12f30b['attributes']=_[_0x1c25('0x29')](_0x4a645a['model'],qs[_0x1c25('0x2a')](_0x346bbc[_0x1c25('0x26')][_0x1c25('0x2a')]));_0x12f30b[_0x1c25('0x2b')]=_0x12f30b[_0x1c25('0x2b')][_0x1c25('0x2c')]?_0x12f30b[_0x1c25('0x2b')]:_0x4a645a['model'];if(!_0x346bbc[_0x1c25('0x26')][_0x1c25('0x2d')](_0x1c25('0x2e'))){_0x12f30b['limit']=qs[_0x1c25('0x15')](_0x346bbc[_0x1c25('0x26')]['limit']);_0x12f30b[_0x1c25('0x13')]=qs[_0x1c25('0x13')](_0x346bbc['query']['offset']);}_0x12f30b[_0x1c25('0x2f')]=qs[_0x1c25('0x30')](_0x346bbc[_0x1c25('0x26')][_0x1c25('0x30')]);_0x12f30b[_0x1c25('0x31')]=qs[_0x1c25('0x28')](_[_0x1c25('0x32')](_0x346bbc['query'],_0x4a645a[_0x1c25('0x28')]),_0x6789df);if(_0x346bbc[_0x1c25('0x26')][_0x1c25('0x33')]){_0x12f30b[_0x1c25('0x31')]=_[_0x1c25('0x34')](_0x12f30b[_0x1c25('0x31')],{'$or':_[_0x1c25('0x21')](_0x6789df,function(_0xab99ca){if(_0xab99ca[_0x1c25('0x35')]!==_0x1c25('0x36')){var _0x70138={};_0x70138[_0xab99ca[_0x1c25('0x25')]]={'$like':'%'+_0x346bbc[_0x1c25('0x26')][_0x1c25('0x33')]+'%'};return _0x70138;}})});}_0x12f30b=_[_0x1c25('0x34')]({},_0x12f30b,_0x346bbc[_0x1c25('0x37')]);var _0x339ef7={'where':_0x12f30b['where']};return db['Network']['count'](_0x339ef7)[_0x1c25('0x1a')](function(_0x2ecbe9){_0x4ffe8b[_0x1c25('0x16')]=_0x2ecbe9;if(_0x346bbc['query'][_0x1c25('0x38')]){_0x12f30b['include']=[{'all':!![]}];}return db[_0x1c25('0x22')][_0x1c25('0x39')](_0x12f30b);})[_0x1c25('0x1a')](function(_0x4011b7){_0x4ffe8b[_0x1c25('0x3a')]=_0x4011b7;return _0x4ffe8b;})[_0x1c25('0x1a')](respondWithFilteredResult(_0x32594b,_0x12f30b))[_0x1c25('0x3b')](handleError(_0x32594b,null));};exports['show']=function(_0x149698,_0x4eaca0){var _0x12ca25={'raw':!![],'where':{'id':_0x149698[_0x1c25('0x3c')]['id']}},_0x4e0e04={};_0x4e0e04[_0x1c25('0x24')]=_[_0x1c25('0x27')](db[_0x1c25('0x22')][_0x1c25('0x3d')]);_0x4e0e04[_0x1c25('0x26')]=_[_0x1c25('0x27')](_0x149698[_0x1c25('0x26')]);_0x4e0e04['filters']=_[_0x1c25('0x29')](_0x4e0e04[_0x1c25('0x24')],_0x4e0e04[_0x1c25('0x26')]);_0x12ca25[_0x1c25('0x2b')]=_['intersection'](_0x4e0e04[_0x1c25('0x24')],qs[_0x1c25('0x2a')](_0x149698[_0x1c25('0x26')][_0x1c25('0x2a')]));_0x12ca25[_0x1c25('0x2b')]=_0x12ca25['attributes']['length']?_0x12ca25[_0x1c25('0x2b')]:_0x4e0e04[_0x1c25('0x24')];if(_0x149698[_0x1c25('0x26')][_0x1c25('0x38')]){_0x12ca25[_0x1c25('0x3e')]=[{'all':!![]}];}_0x12ca25=_[_0x1c25('0x34')]({},_0x12ca25,_0x149698[_0x1c25('0x37')]);return db[_0x1c25('0x22')]['find'](_0x12ca25)[_0x1c25('0x1a')](handleEntityNotFound(_0x4eaca0,null))[_0x1c25('0x1a')](respondWithResult(_0x4eaca0,null))[_0x1c25('0x3b')](handleError(_0x4eaca0,null));};exports[_0x1c25('0x3f')]=function(_0x6de17b,_0x48c886){var _0x18f85d;return db[_0x1c25('0x22')][_0x1c25('0x3f')](_0x6de17b['body'],{'raw':!![]})[_0x1c25('0x1a')](function(_0x33e171){_0x18f85d=_0x33e171;return db[_0x1c25('0x22')][_0x1c25('0x39')]({'where':{'type':_0x6de17b[_0x1c25('0x40')][_0x1c25('0x35')]},'raw':!![]});})[_0x1c25('0x1a')](function(_0x4e37b4){if(_0x18f85d['type'][_0x1c25('0x41')]()==_0x1c25('0x42')){var _0x41a5f2=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config[_0x1c25('0x45')],'server/files/templates/stun_multiple.ejs'),_0x1c25('0x46'));var _0x1649a3=ejs[_0x1c25('0x47')](_0x41a5f2,{'networks':_0x4e37b4||[]});fs[_0x1c25('0x48')](_0x1c25('0x49'),_0x1649a3);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x18f85d[_0x1c25('0x35')][_0x1c25('0x41')]()==_0x1c25('0x4b')){var _0x52edca=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config[_0x1c25('0x45')],_0x1c25('0x4c')),_0x1c25('0x46'));var _0x1ded80=ejs[_0x1c25('0x47')](_0x52edca,{'networks':_0x4e37b4||[]});fs[_0x1c25('0x48')](_0x1c25('0x4d'),_0x1ded80);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x3f'),{'module':_0x1c25('0x4e')});}else{var _0x3f3871=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config[_0x1c25('0x45')],_0x1c25('0x4f')),_0x1c25('0x46'));var _0x4f9965=ejs[_0x1c25('0x47')](_0x3f3871,{'networks':_0x4e37b4||[]});fs[_0x1c25('0x48')](util[_0x1c25('0x50')](_0x1c25('0x51'),_0x6de17b[_0x1c25('0x40')][_0x1c25('0x35')]['toLowerCase']()),_0x4f9965);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x3f'),{'module':_0x1c25('0x52')});}})[_0x1c25('0x1a')](function(){return _0x18f85d;})[_0x1c25('0x1a')](respondWithResult(_0x48c886,0xc9))[_0x1c25('0x3b')](handleError(_0x48c886,null));};exports[_0x1c25('0x53')]=function(_0x1bcf8f,_0x458c88){var _0x473e7b;return db[_0x1c25('0x22')][_0x1c25('0x54')]({'where':{'id':_0x1bcf8f[_0x1c25('0x3c')]['id']}})[_0x1c25('0x1a')](handleEntityNotFound(_0x458c88,null))[_0x1c25('0x1a')](saveUpdates(_0x1bcf8f[_0x1c25('0x40')],null))[_0x1c25('0x1a')](function(_0x2a6487){if(_0x2a6487){_0x473e7b=_0x2a6487;return db[_0x1c25('0x22')]['findAll']({'where':{'type':_0x473e7b['type']},'raw':!![]});}return null;})[_0x1c25('0x1a')](function(_0x2c0c0f){if(_0x473e7b[_0x1c25('0x35')][_0x1c25('0x41')]()=='STUN'){var _0x1c4bd0=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config['root'],_0x1c25('0x55')),'utf8');var _0x1a4cce=ejs['render'](_0x1c4bd0,{'networks':_0x2c0c0f||[]});fs[_0x1c25('0x48')](_0x1c25('0x49'),_0x1a4cce);return respondWithRpcPromise(_0x1c25('0x4a'),'update',{'module':'res_stun_monitor.so'});}else if(_0x473e7b[_0x1c25('0x35')][_0x1c25('0x41')]()==_0x1c25('0x4b')){var _0xc80aa=fs['readFileSync'](path[_0x1c25('0x44')](config['root'],_0x1c25('0x4c')),_0x1c25('0x46'));var _0x3fb68c=ejs[_0x1c25('0x47')](_0xc80aa,{'networks':_0x2c0c0f||[]});fs[_0x1c25('0x48')](_0x1c25('0x4d'),_0x3fb68c);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x18c91a=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config['root'],_0x1c25('0x4f')),_0x1c25('0x46'));var _0x430d7f=ejs['render'](_0x18c91a,{'networks':_0x2c0c0f||[]});fs['writeFileSync'](util[_0x1c25('0x50')](_0x1c25('0x51'),_0x1bcf8f[_0x1c25('0x40')]['type'][_0x1c25('0x56')]()),_0x430d7f);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x53'),{'module':'chan_sip.so'});}})[_0x1c25('0x1a')](function(_0x36c18e){if(_0x36c18e){return _0x473e7b;}return null;})[_0x1c25('0x1a')](respondWithResult(_0x458c88,null))[_0x1c25('0x3b')](handleError(_0x458c88,null));};exports[_0x1c25('0x1b')]=function(_0x350110,_0x4ae982){var _0x3bd5c8;return db['Network'][_0x1c25('0x54')]({'where':{'id':_0x350110[_0x1c25('0x3c')]['id']}})['then'](function(_0x23afc3){_0x3bd5c8=_0x23afc3;return _0x23afc3;})['then'](handleEntityNotFound(_0x4ae982,null))[_0x1c25('0x1a')](removeEntity(_0x4ae982,null))[_0x1c25('0x1a')](function(){if(_0x3bd5c8){return db[_0x1c25('0x22')][_0x1c25('0x39')]({'where':{'type':_0x3bd5c8[_0x1c25('0x35')]},'raw':!![]});}})['then'](function(_0xdafc56){if(_0x3bd5c8[_0x1c25('0x35')][_0x1c25('0x41')]()==_0x1c25('0x42')){var _0x27992f=fs['readFileSync'](path['join'](config[_0x1c25('0x45')],_0x1c25('0x55')),'utf8');var _0x428b13=ejs[_0x1c25('0x47')](_0x27992f,{'networks':_0xdafc56||[]});fs['writeFileSync'](_0x1c25('0x49'),_0x428b13);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x1b'),{'module':_0x1c25('0x4e')});}else if(_0x3bd5c8[_0x1c25('0x35')][_0x1c25('0x41')]()=='TURN'){var _0x56784b=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config[_0x1c25('0x45')],_0x1c25('0x4c')),_0x1c25('0x46'));var _0x3a3ffa=ejs[_0x1c25('0x47')](_0x56784b,{'networks':_0xdafc56||[]});fs[_0x1c25('0x48')](_0x1c25('0x4d'),_0x3a3ffa);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x2134fa=fs[_0x1c25('0x43')](path[_0x1c25('0x44')](config[_0x1c25('0x45')],_0x1c25('0x4f')),_0x1c25('0x46'));var _0x16da3c=ejs[_0x1c25('0x47')](_0x2134fa,{'networks':_0xdafc56||[]});fs['writeFileSync'](util[_0x1c25('0x50')](_0x1c25('0x51'),_0x3bd5c8[_0x1c25('0x35')]['toLowerCase']()),_0x16da3c);return respondWithRpcPromise(_0x1c25('0x4a'),_0x1c25('0x1b'),{'module':_0x1c25('0x52')});}})['catch'](handleError(_0x4ae982,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a2adaf6..0a6931a 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 _0x37f8=['Network','network','util','../../config/logger','api','moment','request-promise','define'];(function(_0x58a359,_0x4c21c5){var _0xfe8153=function(_0x2b6dd7){while(--_0x2b6dd7){_0x58a359['push'](_0x58a359['shift']());}};_0xfe8153(++_0x4c21c5);}(_0x37f8,0xd2));var _0x837f=function(_0x48cd43,_0x18ea0a){_0x48cd43=_0x48cd43-0x0;var _0x3b7362=_0x37f8[_0x48cd43];return _0x3b7362;};'use strict';var _=require('lodash');var util=require(_0x837f('0x0'));var logger=require(_0x837f('0x1'))(_0x837f('0x2'));var moment=require(_0x837f('0x3'));var BPromise=require('bluebird');var rp=require(_0x837f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./network.attributes');module['exports']=function(_0x19c939,_0x42986f){return _0x19c939[_0x837f('0x5')](_0x837f('0x6'),attributes,{'tableName':_0x837f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda65=['../../config/environment','./network.attributes','exports','Network','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xda65,0x1d0));var _0x5da6=function(_0x52b1f3,_0x1fe4cd){_0x52b1f3=_0x52b1f3-0x0;var _0x44106d=_0xda65[_0x52b1f3];return _0x44106d;};'use strict';var _=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var logger=require(_0x5da6('0x2'))('api');var moment=require(_0x5da6('0x3'));var BPromise=require(_0x5da6('0x4'));var rp=require(_0x5da6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5da6('0x6'));var attributes=require(_0x5da6('0x7'));module[_0x5da6('0x8')]=function(_0x32ff03,_0x75126f){return _0x32ff03['define'](_0x5da6('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 65b3345..db7d8b3 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(_0x3debfc,_0x5b140f){var _0x596dc2=function(_0x221993){while(--_0x221993){_0x3debfc['push'](_0x3debfc['shift']());}};_0x596dc2(++_0x5b140f);}(_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 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x599513,_0x2374a0){_0x599513=_0x599513-0x0;var _0x5f5a9e=_0x7a54[_0x599513];return _0x5f5a9e;};'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 0ee32e9..e90735e 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 _0x2220=['removeAnswers','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy'];(function(_0x3c24a1,_0x12903f){var _0x29e948=function(_0x2170ce){while(--_0x2170ce){_0x3c24a1['push'](_0x3c24a1['shift']());}};_0x29e948(++_0x12903f);}(_0x2220,0xdb));var _0x0222=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2220[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x0222('0x0'));var util=require('util');var path=require(_0x0222('0x1'));var timeout=require('connect-timeout');var express=require(_0x0222('0x2'));var router=express[_0x0222('0x3')]();var fs_extra=require(_0x0222('0x4'));var auth=require(_0x0222('0x5'));var interaction=require(_0x0222('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x0222('0x7')](),controller[_0x0222('0x8')]);router[_0x0222('0x9')](_0x0222('0xa'),auth[_0x0222('0x7')](),controller['describe']);router['get'](_0x0222('0xb'),auth[_0x0222('0x7')](),controller[_0x0222('0xc')]);router[_0x0222('0x9')](_0x0222('0xd'),auth[_0x0222('0x7')](),controller[_0x0222('0xe')]);router[_0x0222('0x9')](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x10')]);router[_0x0222('0x9')](_0x0222('0x11'),auth[_0x0222('0x7')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x0222('0x12')]);router['get'](_0x0222('0x13'),auth[_0x0222('0x7')](),controller[_0x0222('0x14')]);router['post']('/',auth[_0x0222('0x7')](),controller[_0x0222('0x15')]);router[_0x0222('0x16')](_0x0222('0xd'),auth[_0x0222('0x7')](),controller[_0x0222('0x17')]);router[_0x0222('0x16')](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x18')]);router['post']('/:id/notify',controller[_0x0222('0x19')]);router[_0x0222('0x16')]('/:id/applications',auth[_0x0222('0x7')](),controller[_0x0222('0x1a')]);router[_0x0222('0x16')](_0x0222('0x13'),auth[_0x0222('0x7')](),controller[_0x0222('0x1b')]);router[_0x0222('0x16')](_0x0222('0x1c'),auth[_0x0222('0x7')](),controller[_0x0222('0x1d')]);router['put'](_0x0222('0xb'),auth[_0x0222('0x7')](),controller[_0x0222('0x1e')]);router[_0x0222('0x1f')]('/:id',auth[_0x0222('0x7')](),controller[_0x0222('0x20')]);router[_0x0222('0x1f')](_0x0222('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x0222('0xf'),auth[_0x0222('0x7')](),controller[_0x0222('0x21')]);router['delete'](_0x0222('0x13'),auth['isAuthenticated'](),controller[_0x0222('0x22')]);module[_0x0222('0x23')]=router; \ No newline at end of file +var _0x87f7=['addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers'];(function(_0x8f94d3,_0x502f60){var _0x54ed6f=function(_0x59520f){while(--_0x59520f){_0x8f94d3['push'](_0x8f94d3['shift']());}};_0x54ed6f(++_0x502f60);}(_0x87f7,0x92));var _0x787f=function(_0x12340a,_0xb20e79){_0x12340a=_0x12340a-0x0;var _0x529cec=_0x87f7[_0x12340a];return _0x529cec;};'use strict';var multer=require('multer');var util=require(_0x787f('0x0'));var path=require(_0x787f('0x1'));var timeout=require(_0x787f('0x2'));var express=require(_0x787f('0x3'));var router=express[_0x787f('0x4')]();var fs_extra=require(_0x787f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x787f('0x6'));var controller=require('./openchannelAccount.controller');router[_0x787f('0x7')]('/',auth[_0x787f('0x8')](),controller[_0x787f('0x9')]);router[_0x787f('0x7')]('/describe',auth[_0x787f('0x8')](),controller[_0x787f('0xa')]);router[_0x787f('0x7')](_0x787f('0xb'),auth[_0x787f('0x8')](),controller['show']);router[_0x787f('0x7')](_0x787f('0xc'),auth[_0x787f('0x8')](),controller[_0x787f('0xd')]);router['get']('/:id/canned_answers',auth[_0x787f('0x8')](),controller[_0x787f('0xe')]);router['get'](_0x787f('0xf'),auth[_0x787f('0x8')](),controller[_0x787f('0x10')]);router['get']('/:id/interactions',auth[_0x787f('0x8')](),controller[_0x787f('0x11')]);router[_0x787f('0x7')](_0x787f('0x12'),auth[_0x787f('0x8')](),controller[_0x787f('0x13')]);router[_0x787f('0x14')]('/',auth[_0x787f('0x8')](),controller[_0x787f('0x15')]);router[_0x787f('0x14')](_0x787f('0xc'),auth['isAuthenticated'](),controller[_0x787f('0x16')]);router[_0x787f('0x14')](_0x787f('0x17'),auth[_0x787f('0x8')](),controller[_0x787f('0x18')]);router[_0x787f('0x14')](_0x787f('0x19'),controller['notify']);router[_0x787f('0x14')](_0x787f('0xf'),auth[_0x787f('0x8')](),controller[_0x787f('0x1a')]);router['post'](_0x787f('0x12'),auth[_0x787f('0x8')](),controller[_0x787f('0x1b')]);router[_0x787f('0x14')](_0x787f('0x1c'),auth[_0x787f('0x8')](),controller[_0x787f('0x1d')]);router[_0x787f('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x787f('0x1f')]);router['delete']('/:id',auth[_0x787f('0x8')](),controller['destroy']);router['delete'](_0x787f('0xc'),auth[_0x787f('0x8')](),controller['removeDispositions']);router[_0x787f('0x20')](_0x787f('0x17'),auth[_0x787f('0x8')](),controller['removeAnswers']);router[_0x787f('0x20')](_0x787f('0x12'),auth['isAuthenticated'](),controller[_0x787f('0x21')]);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 0694bd7..b08090e 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 _0x2267=['mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports','name','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x58a9a9,_0x3fc0d1){var _0x5c66b5=function(_0x4a0bd7){while(--_0x4a0bd7){_0x58a9a9['push'](_0x58a9a9['shift']());}};_0x5c66b5(++_0x3fc0d1);}(_0x2267,0x13a));var _0x7226=function(_0x229a5f,_0xb91285){_0x229a5f=_0x229a5f-0x0;var _0x3d4b3f=_0x2267[_0x229a5f];return _0x3d4b3f;};'use strict';var Sequelize=require(_0x7226('0x0'));var rs=require(_0x7226('0x1'));module[_0x7226('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x7226('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7226('0x4')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x7226('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7226('0x4')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7226('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7226('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7226('0x4')]},'queueTransfer':{'type':Sequelize[_0x7226('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7226('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7226('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x7226('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7226('0x9'),'set':function(_0x1545a6){if(!_0x1545a6)this['setDataValue'](_0x7226('0xa'),null);this[_0x7226('0xb')]('mandatoryDisposition',_0x1545a6);}}}; \ No newline at end of file +var _0xb034=['mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x45d866,_0x1fcec9){var _0x11b910=function(_0x2e0076){while(--_0x2e0076){_0x45d866['push'](_0x45d866['shift']());}};_0x11b910(++_0x1fcec9);}(_0xb034,0xf1));var _0x4b03=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xb034[_0x541ea6];return _0x3c3e84;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x4b03('0x0')]={'name':{'type':Sequelize[_0x4b03('0x1')],'unique':_0x4b03('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x4b03('0x3')]();}},'replyUri':{'type':Sequelize[_0x4b03('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4b03('0x4')],'defaultValue':function(){return _0x4b03('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b03('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4b03('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x4b03('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4b03('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4b03('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x4b03('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4b03('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5d8b8f){if(!_0x5d8b8f)this[_0x4b03('0x9')](_0x4b03('0xa'),null);this[_0x4b03('0x9')](_0x4b03('0xb'),_0x5d8b8f);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 203f191..0629a87 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 _0x047e=['getDispositions','findOne','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','List','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','AttachmentId','UserId','unshift','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','out','OpenchannelMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','show','params','Pause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition'];(function(_0x5404e5,_0x6c7366){var _0x2f6f67=function(_0x4a22b3){while(--_0x4a22b3){_0x5404e5['push'](_0x5404e5['shift']());}};_0x2f6f67(++_0x6c7366);}(_0x047e,0x121));var _0xe047=function(_0x5b6fd2,_0x5830cb){_0x5b6fd2=_0x5b6fd2-0x0;var _0x450877=_0x047e[_0x5b6fd2];return _0x450877;};'use strict';var emlformat=require(_0xe047('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe047('0x1'));var jsonpatch=require(_0xe047('0x2'));var rp=require(_0xe047('0x3'));var moment=require(_0xe047('0x4'));var BPromise=require(_0xe047('0x5'));var Mustache=require('mustache');var util=require(_0xe047('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe047('0x7'));var fs=require('fs');var fs_extra=require(_0xe047('0x8'));var _=require('lodash');var squel=require(_0xe047('0x9'));var crypto=require(_0xe047('0xa'));var jsforce=require(_0xe047('0xb'));var deskjs=require(_0xe047('0xc'));var toCsv=require(_0xe047('0xd'));var querystring=require(_0xe047('0xe'));var Papa=require(_0xe047('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe047('0x10'));var hardwareService=require(_0xe047('0x11'));var logger=require(_0xe047('0x12'))(_0xe047('0x13'));var utils=require(_0xe047('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe047('0x15'));var db=require(_0xe047('0x16'))['db'];config[_0xe047('0x17')]=_[_0xe047('0x18')](config['redis'],{'host':_0xe047('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe047('0x17')]));require(_0xe047('0x1a'))[_0xe047('0x1b')](socket);var jayson=require(_0xe047('0x1c'));var client=jayson['client'][_0xe047('0x1d')]({'port':0x232c});var client9002=jayson[_0xe047('0x1e')][_0xe047('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x198dfe,_0x519a87,_0x629b7,_0x20d24f){return new BPromise(function(_0x310440,_0x5e3e76){var _0x47da67=_0x20d24f||client;return _0x47da67['request'](_0x198dfe,_0x629b7)[_0xe047('0x1f')](function(_0x5c8448){logger[_0xe047('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x519a87,_0xe047('0x21'));logger[_0xe047('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x519a87,_0xe047('0x21'),JSON[_0xe047('0x23')](_0x5c8448));if(_0x5c8448[_0xe047('0x24')]){if(_0x5c8448[_0xe047('0x24')][_0xe047('0x25')]===0x1f4){logger[_0xe047('0x24')](_0xe047('0x26'),_0x519a87,_0x5c8448[_0xe047('0x24')][_0xe047('0x27')]);return _0x5e3e76(_0x5c8448[_0xe047('0x24')]['message']);}logger['error'](_0xe047('0x26'),_0x519a87,_0x5c8448[_0xe047('0x24')][_0xe047('0x27')]);return _0x310440(_0x5c8448['error']['message']);}else{logger[_0xe047('0x20')](_0xe047('0x26'),_0x519a87,_0xe047('0x21'));_0x310440(_0x5c8448[_0xe047('0x28')][_0xe047('0x27')]);}})[_0xe047('0x29')](function(_0x3c0919){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x519a87,_0x3c0919);_0x5e3e76(_0x3c0919);});});}function respondWithStatusCode(_0x20007f,_0x3f4aa4){_0x3f4aa4=_0x3f4aa4||0xcc;return function(_0x490ca0){if(_0x490ca0){return _0x20007f['sendStatus'](_0x3f4aa4);}return _0x20007f[_0xe047('0x2a')](_0x3f4aa4)[_0xe047('0x2b')]();};}function respondWithResult(_0x109934,_0x4a2896){_0x4a2896=_0x4a2896||0xc8;return function(_0x23cdba){if(_0x23cdba){return _0x109934[_0xe047('0x2a')](_0x4a2896)[_0xe047('0x2c')](_0x23cdba);}};}function respondWithFilteredResult(_0x5c2c36,_0x4d057d){return function(_0x5e71d5){if(_0x5e71d5){var _0x3a21d5=typeof _0x4d057d[_0xe047('0x2d')]===_0xe047('0x2e')&&typeof _0x4d057d[_0xe047('0x2f')]===_0xe047('0x2e');var _0x3ce6c7=_0x5e71d5[_0xe047('0x30')];var _0x346cc5=_0x3a21d5?0x0:_0x4d057d[_0xe047('0x2d')];var _0x779c=_0x3a21d5?_0x5e71d5['count']:_0x4d057d[_0xe047('0x2d')]+_0x4d057d[_0xe047('0x2f')];var _0x5e96ff;if(_0x779c>=_0x3ce6c7){_0x779c=_0x3ce6c7;_0x5e96ff=0xc8;}else{_0x5e96ff=0xce;}_0x5c2c36[_0xe047('0x2a')](_0x5e96ff);return _0x5c2c36[_0xe047('0x31')]('Content-Range',_0x346cc5+'-'+_0x779c+'/'+_0x3ce6c7)[_0xe047('0x2c')](_0x5e71d5);}return null;};}function patchUpdates(_0x5bbd5b){return function(_0x445e1f){try{jsonpatch['apply'](_0x445e1f,_0x5bbd5b,!![]);}catch(_0x4b7298){return BPromise[_0xe047('0x32')](_0x4b7298);}return _0x445e1f[_0xe047('0x33')]();};}function saveUpdates(_0xe0359d,_0xee8e87){return function(_0x49406f){if(_0x49406f){return _0x49406f['update'](_0xe0359d)[_0xe047('0x1f')](function(_0x4e0f85){return _0x4e0f85;});}return null;};}function removeEntity(_0x50bf7c,_0x5af6ca){return function(_0x34eaa2){if(_0x34eaa2){return _0x34eaa2['destroy']()[_0xe047('0x1f')](function(){var _0x4da094=_0x34eaa2[_0xe047('0x34')]({'plain':!![]});var _0x30979b=_0xe047('0x35');return db[_0xe047('0x36')][_0xe047('0x37')]({'where':{'type':_0x30979b,'resourceId':_0x4da094['id']}})[_0xe047('0x1f')](function(){return _0x34eaa2;});})[_0xe047('0x1f')](function(){_0x50bf7c[_0xe047('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a70fa,_0x2c526a){return function(_0x403aa8){if(!_0x403aa8){_0x5a70fa[_0xe047('0x38')](0x194);}return _0x403aa8;};}function handleError(_0x52d35f,_0x3d6fdd){_0x3d6fdd=_0x3d6fdd||0x1f4;return function(_0x464653){logger[_0xe047('0x24')](_0x464653[_0xe047('0x39')]);if(_0x464653[_0xe047('0x3a')]){delete _0x464653['name'];}_0x52d35f[_0xe047('0x2a')](_0x3d6fdd)['send'](_0x464653);};}exports[_0xe047('0x3b')]=function(_0x562dae,_0x51ea84){var _0xb09c54={'include':[{'model':db['Pause'],'as':_0xe047('0x3c')}]},_0x5d608e={},_0x4ba517={'count':0x0,'rows':[]};var _0x38e7ff=_['map'](db[_0xe047('0x3d')][_0xe047('0x3e')],function(_0xf5bb08){return{'name':_0xf5bb08[_0xe047('0x3f')],'type':_0xf5bb08[_0xe047('0x40')][_0xe047('0x41')]};});_0x5d608e[_0xe047('0x42')]=_[_0xe047('0x43')](_0x38e7ff,_0xe047('0x3a'));_0x5d608e[_0xe047('0x44')]=_[_0xe047('0x45')](_0x562dae[_0xe047('0x44')]);_0x5d608e[_0xe047('0x46')]=_[_0xe047('0x47')](_0x5d608e[_0xe047('0x42')],_0x5d608e[_0xe047('0x44')]);_0xb09c54[_0xe047('0x48')]=_[_0xe047('0x47')](_0x5d608e['model'],qs[_0xe047('0x49')](_0x562dae[_0xe047('0x44')][_0xe047('0x49')]));_0xb09c54[_0xe047('0x48')]=_0xb09c54['attributes'][_0xe047('0x4a')]?_0xb09c54['attributes']:_0x5d608e[_0xe047('0x42')];if(!_0x562dae[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0xb09c54[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x562dae[_0xe047('0x44')][_0xe047('0x2f')]);_0xb09c54[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x562dae[_0xe047('0x44')]['offset']);}_0xb09c54[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x562dae['query']['sort']);_0xb09c54[_0xe047('0x4f')]=qs['filters'](_[_0xe047('0x50')](_0x562dae[_0xe047('0x44')],_0x5d608e[_0xe047('0x46')]),_0x38e7ff);if(_0x562dae[_0xe047('0x44')]['filter']){_0xb09c54['where']=_[_0xe047('0x51')](_0xb09c54['where'],{'$or':_[_0xe047('0x43')](_0x38e7ff,function(_0x436efe){if(_0x436efe[_0xe047('0x40')]!==_0xe047('0x52')){var _0x53ad73={};_0x53ad73[_0x436efe[_0xe047('0x3a')]]={'$like':'%'+_0x562dae[_0xe047('0x44')]['filter']+'%'};return _0x53ad73;}})});}_0xb09c54=_[_0xe047('0x51')]({},_0xb09c54,_0x562dae['options']);var _0xe898ed={'where':_0xb09c54[_0xe047('0x4f')]};return db[_0xe047('0x3d')]['count'](_0xe898ed)['then'](function(_0x18ee90){_0x4ba517[_0xe047('0x30')]=_0x18ee90;if(_0x562dae['query'][_0xe047('0x53')]){_0xb09c54[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x3d')]['findAll'](_0xb09c54);})[_0xe047('0x1f')](function(_0x11b18a){_0x4ba517['rows']=_0x11b18a;return _0x4ba517;})['then'](respondWithFilteredResult(_0x51ea84,_0xb09c54))['catch'](handleError(_0x51ea84,null));};exports[_0xe047('0x55')]=function(_0x23bb4c,_0x3f47f2){var _0x27a090={'raw':![],'where':{'id':_0x23bb4c[_0xe047('0x56')]['id']},'include':[{'model':db[_0xe047('0x57')],'as':_0xe047('0x3c')}]},_0x2d3afe={};_0x2d3afe[_0xe047('0x42')]=_[_0xe047('0x45')](db['OpenchannelAccount'][_0xe047('0x3e')]);_0x2d3afe[_0xe047('0x44')]=_[_0xe047('0x45')](_0x23bb4c['query']);_0x2d3afe['filters']=_['intersection'](_0x2d3afe[_0xe047('0x42')],_0x2d3afe[_0xe047('0x44')]);_0x27a090['attributes']=_[_0xe047('0x47')](_0x2d3afe['model'],qs[_0xe047('0x49')](_0x23bb4c[_0xe047('0x44')]['fields']));_0x27a090[_0xe047('0x48')]=_0x27a090[_0xe047('0x48')][_0xe047('0x4a')]?_0x27a090[_0xe047('0x48')]:_0x2d3afe[_0xe047('0x42')];if(_0x23bb4c[_0xe047('0x44')][_0xe047('0x53')]){_0x27a090[_0xe047('0x54')]=[{'all':!![]}];}_0x27a090=_['merge']({},_0x27a090,_0x23bb4c[_0xe047('0x58')]);return db['OpenchannelAccount'][_0xe047('0x59')](_0x27a090)[_0xe047('0x1f')](handleEntityNotFound(_0x3f47f2,null))[_0xe047('0x1f')](respondWithResult(_0x3f47f2,null))['catch'](handleError(_0x3f47f2,null));};exports[_0xe047('0x5a')]=function(_0x5c6e63,_0x19f0e9){return db['OpenchannelAccount']['create'](_0x5c6e63['body'],{})[_0xe047('0x1f')](function(_0x1187c7){var _0x3a33d6=_0x5c6e63[_0xe047('0x5b')][_0xe047('0x34')]({'plain':!![]});if(!_0x3a33d6)throw new Error(_0xe047('0x5c'));if(_0x3a33d6['role']===_0xe047('0x5b')){var _0x383ab5=_0x1187c7[_0xe047('0x34')]({'plain':!![]});var _0x270b8e=_0xe047('0x35');return db[_0xe047('0x5d')][_0xe047('0x59')]({'where':{'name':_0x270b8e,'userProfileId':_0x3a33d6[_0xe047('0x5e')]},'raw':!![]})[_0xe047('0x1f')](function(_0x2b1243){if(_0x2b1243&&_0x2b1243[_0xe047('0x5f')]===0x0){return db[_0xe047('0x36')][_0xe047('0x5a')]({'name':_0x383ab5[_0xe047('0x3a')],'resourceId':_0x383ab5['id'],'type':_0x2b1243[_0xe047('0x3a')],'sectionId':_0x2b1243['id']},{})[_0xe047('0x1f')](function(){return _0x1187c7;});}else{return _0x1187c7;}})[_0xe047('0x29')](function(_0x12b8d8){logger[_0xe047('0x24')](_0xe047('0x60'),_0x12b8d8);throw _0x12b8d8;});}return _0x1187c7;})[_0xe047('0x1f')](respondWithResult(_0x19f0e9,0xc9))[_0xe047('0x29')](handleError(_0x19f0e9,null));};exports[_0xe047('0x61')]=function(_0x4aad61,_0x188d3f){if(_0x4aad61['body']['id']){delete _0x4aad61[_0xe047('0x62')]['id'];}return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x4aad61[_0xe047('0x56')]['id']},'include':[{'model':db[_0xe047('0x57')],'as':'mandatoryDispositionPause'}]})[_0xe047('0x1f')](handleEntityNotFound(_0x188d3f,null))[_0xe047('0x1f')](saveUpdates(_0x4aad61['body'],null))[_0xe047('0x1f')](respondWithResult(_0x188d3f,null))[_0xe047('0x29')](handleError(_0x188d3f,null));};exports[_0xe047('0x37')]=function(_0x53cb03,_0x353b45){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x53cb03[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x353b45,null))['then'](removeEntity(_0x353b45,null))[_0xe047('0x29')](handleError(_0x353b45,null));};exports[_0xe047('0x63')]=function(_0x50b54d,_0x49ff01){return db[_0xe047('0x3d')][_0xe047('0x63')]()[_0xe047('0x1f')](respondWithResult(_0x49ff01,null))['catch'](handleError(_0x49ff01,null));};exports[_0xe047('0x64')]=function(_0x301d6d,_0x49d525,_0x29c30f){if(_0x301d6d[_0xe047('0x62')]['id']){delete _0x301d6d['body']['id'];}return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x301d6d[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x49d525,null))[_0xe047('0x1f')](function(_0xaa9ce1){if(_0xaa9ce1){_0x301d6d[_0xe047('0x62')][_0xe047('0x65')]=_0xaa9ce1['id'];return db[_0xe047('0x66')][_0xe047('0x5a')](_0x301d6d['body']);}})[_0xe047('0x1f')](respondWithResult(_0x49d525,null))[_0xe047('0x29')](handleError(_0x49d525,null));};exports[_0xe047('0x67')]=function(_0x550e41,_0x4352f0,_0x4917e){var _0x35bbf8={'raw':![],'where':{}};var _0x166c9c={};var _0x3f011a={'count':0x0,'rows':[]};return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x550e41[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x4352f0,null))[_0xe047('0x1f')](function(_0x2558ae){if(_0x2558ae){_0x166c9c[_0xe047('0x42')]=_[_0xe047('0x45')](db['Disposition'][_0xe047('0x3e')]);_0x166c9c['query']=_['keys'](_0x550e41['query']);_0x166c9c['filters']=_[_0xe047('0x47')](_0x166c9c[_0xe047('0x42')],_0x166c9c[_0xe047('0x44')]);_0x35bbf8[_0xe047('0x48')]=_[_0xe047('0x47')](_0x166c9c[_0xe047('0x42')],qs['fields'](_0x550e41['query'][_0xe047('0x49')]));_0x35bbf8[_0xe047('0x48')]=_0x35bbf8['attributes'][_0xe047('0x4a')]?_0x35bbf8[_0xe047('0x48')]:_0x166c9c['model'];if(!_0x550e41[_0xe047('0x44')][_0xe047('0x4b')]('nolimit')){_0x35bbf8['limit']=qs[_0xe047('0x2f')](_0x550e41[_0xe047('0x44')][_0xe047('0x2f')]);_0x35bbf8[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x550e41[_0xe047('0x44')][_0xe047('0x2d')]);}_0x35bbf8['order']=qs[_0xe047('0x4e')](_0x550e41[_0xe047('0x44')]['sort']);_0x35bbf8[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x550e41[_0xe047('0x44')],_0x166c9c[_0xe047('0x46')]));_0x35bbf8[_0xe047('0x4f')][_0xe047('0x65')]=_0x2558ae['id'];if(_0x550e41[_0xe047('0x44')][_0xe047('0x69')]){_0x35bbf8['where']=_['merge'](_0x35bbf8[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x35bbf8[_0xe047('0x48')],function(_0x12cc8f){var _0x4a5a7f={};_0x4a5a7f[_0x12cc8f]={'$like':'%'+_0x550e41[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x4a5a7f;})});}_0x35bbf8=_[_0xe047('0x51')]({},_0x35bbf8,_0x550e41[_0xe047('0x58')]);return db[_0xe047('0x66')][_0xe047('0x30')]({'where':_0x35bbf8['where']})[_0xe047('0x1f')](function(_0x6dcc6b){_0x3f011a[_0xe047('0x30')]=_0x6dcc6b;if(_0x550e41[_0xe047('0x44')][_0xe047('0x53')]){_0x35bbf8[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x66')]['findAll'](_0x35bbf8);})['then'](function(_0x41c688){_0x3f011a[_0xe047('0x6a')]=_0x41c688;return _0x3f011a;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x4352f0,_0x35bbf8))[_0xe047('0x29')](handleError(_0x4352f0,null));};exports[_0xe047('0x6b')]=function(_0x3e9914,_0x31d99d,_0x5d90ad){return db['OpenchannelAccount'][_0xe047('0x59')]({'where':{'id':_0x3e9914[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x31d99d,null))[_0xe047('0x1f')](function(_0x1ddf5b){if(_0x1ddf5b){return _0x1ddf5b[_0xe047('0x6b')](_0x3e9914[_0xe047('0x44')][_0xe047('0x6c')]);}})[_0xe047('0x1f')](respondWithStatusCode(_0x31d99d,null))['catch'](handleError(_0x31d99d,null));};exports[_0xe047('0x6d')]=function(_0x5bed6a,_0x4a4502,_0x376a3c){if(_0x5bed6a[_0xe047('0x62')]['id']){delete _0x5bed6a[_0xe047('0x62')]['id'];}return db[_0xe047('0x3d')]['find']({'where':{'id':_0x5bed6a[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x4a4502,null))[_0xe047('0x1f')](function(_0x5ab777){if(_0x5ab777){_0x5bed6a[_0xe047('0x62')][_0xe047('0x65')]=_0x5ab777['id'];return db[_0xe047('0x6e')][_0xe047('0x5a')](_0x5bed6a['body']);}})[_0xe047('0x1f')](respondWithResult(_0x4a4502,null))[_0xe047('0x29')](handleError(_0x4a4502,null));};exports[_0xe047('0x6f')]=function(_0x38dcb1,_0x30ff19,_0x300f90){var _0x270b1f={'raw':![],'where':{}};var _0x50db9a={};var _0x46a2ec={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe047('0x68')]({'where':{'id':_0x38dcb1['params']['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x30ff19,null))[_0xe047('0x1f')](function(_0x1f3c53){if(_0x1f3c53){_0x50db9a['model']=_['keys'](db[_0xe047('0x6e')]['rawAttributes']);_0x50db9a[_0xe047('0x44')]=_['keys'](_0x38dcb1[_0xe047('0x44')]);_0x50db9a[_0xe047('0x46')]=_[_0xe047('0x47')](_0x50db9a[_0xe047('0x42')],_0x50db9a['query']);_0x270b1f[_0xe047('0x48')]=_[_0xe047('0x47')](_0x50db9a[_0xe047('0x42')],qs['fields'](_0x38dcb1[_0xe047('0x44')][_0xe047('0x49')]));_0x270b1f[_0xe047('0x48')]=_0x270b1f[_0xe047('0x48')][_0xe047('0x4a')]?_0x270b1f[_0xe047('0x48')]:_0x50db9a[_0xe047('0x42')];if(!_0x38dcb1[_0xe047('0x44')]['hasOwnProperty'](_0xe047('0x4c'))){_0x270b1f[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x2f')]);_0x270b1f[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x2d')]);}_0x270b1f['order']=qs[_0xe047('0x4e')](_0x38dcb1[_0xe047('0x44')][_0xe047('0x4e')]);_0x270b1f[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x38dcb1[_0xe047('0x44')],_0x50db9a[_0xe047('0x46')]));_0x270b1f[_0xe047('0x4f')][_0xe047('0x65')]=_0x1f3c53['id'];if(_0x38dcb1[_0xe047('0x44')][_0xe047('0x69')]){_0x270b1f[_0xe047('0x4f')]=_['merge'](_0x270b1f[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x270b1f[_0xe047('0x48')],function(_0x2bfe51){var _0x252e81={};_0x252e81[_0x2bfe51]={'$like':'%'+_0x38dcb1[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x252e81;})});}_0x270b1f=_['merge']({},_0x270b1f,_0x38dcb1[_0xe047('0x58')]);return db[_0xe047('0x6e')]['count']({'where':_0x270b1f[_0xe047('0x4f')]})['then'](function(_0x2772cd){_0x46a2ec[_0xe047('0x30')]=_0x2772cd;if(_0x38dcb1[_0xe047('0x44')][_0xe047('0x53')]){_0x270b1f[_0xe047('0x54')]=[{'all':!![]}];}return db[_0xe047('0x6e')][_0xe047('0x70')](_0x270b1f);})[_0xe047('0x1f')](function(_0x2692e1){_0x46a2ec[_0xe047('0x6a')]=_0x2692e1;return _0x46a2ec;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x30ff19,_0x270b1f))[_0xe047('0x29')](handleError(_0x30ff19,null));};exports[_0xe047('0x71')]=function(_0x72f0f4,_0x22d2db,_0x3a1bef){return db['OpenchannelAccount'][_0xe047('0x59')]({'where':{'id':_0x72f0f4[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x22d2db,null))[_0xe047('0x1f')](function(_0x186f09){if(_0x186f09){return _0x186f09[_0xe047('0x71')](_0x72f0f4[_0xe047('0x44')][_0xe047('0x6c')]);}})['then'](respondWithStatusCode(_0x22d2db,null))['catch'](handleError(_0x22d2db,null));};exports[_0xe047('0x72')]=function(_0x5f2758,_0x3345b7,_0x2b5f91){var _0x5cf4b2={'body':_0x5f2758[_0xe047('0x62')],'channel':_0xe047('0x73')};var _0x2caea8=[];var _0x30b5cb=[];var _0x5bad19={};var _0x2bcfed=![];return db['CmContact'][_0xe047('0x63')]()['then'](function(_0x5cee28){if(!_0x5cee28){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x76'));}_0x2caea8=_['difference'](_['keys'](_0x5cee28),[_0xe047('0x77'),_0xe047('0x78')]);_0x30b5cb=_[_0xe047('0x79')](_[_0xe047('0x45')](_0x5cee28),[_0xe047('0x77'),'updatedAt','CompanyId',_0xe047('0x7a')]);if(_0x5f2758[_0xe047('0x62')]['id']){delete _0x5f2758[_0xe047('0x62')]['id'];}if(_[_0xe047('0x7b')](_0x5f2758['body'][_0xe047('0x7c')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x7d'));}if(_[_0xe047('0x7b')](_0x5f2758[_0xe047('0x62')][_0xe047('0x62')])||_0x5f2758['body'][_0xe047('0x62')]===''){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x7e'));}if(_['isNil'](_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x80')+_0x30b5cb);}if(!_[_0xe047('0x81')](_0x30b5cb,_0x5f2758['body'][_0xe047('0x7f')])){throw new db[(_0xe047('0x74'))][(_0xe047('0x75'))](_0xe047('0x82')+_0x30b5cb);}_0x5bad19[_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')]]=_0x5f2758[_0xe047('0x62')][_0xe047('0x7c')];})[_0xe047('0x1f')](function(){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x5f2758['params']['id']},'include':[{'model':db[_0xe047('0x83')],'as':'List','include':[{'model':db[_0xe047('0x84')],'as':_0xe047('0x85'),'where':_0x5bad19,'limit':0x1,'order':[['updatedAt',_0xe047('0x86')]]}]},{'model':db[_0xe047('0x87')],'as':_0xe047('0x88')}]});})[_0xe047('0x1f')](handleEntityNotFound(_0x3345b7,null))[_0xe047('0x1f')](function(_0x30e240){if(_0x30e240&&_0x30e240['List']){_0x5cf4b2[_0xe047('0x89')]=_0x30e240;_0x5cf4b2[_0xe047('0x8a')]=_0x30e240[_0xe047('0x88')];_0x5cf4b2['list']=_0x30e240['List'];_0x5cf4b2[_0xe047('0x8a')]=_[_0xe047('0x8b')](_0x5cf4b2[_0xe047('0x8a')],[_0xe047('0x8c')],[_0xe047('0x8d')]);if(_0x5cf4b2[_0xe047('0x89')][_0xe047('0x88')]){delete _0x5cf4b2['account']['Applications'];}if(_0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')]&&_0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')][_0xe047('0x85')]['length']){return _0x5cf4b2[_0xe047('0x89')][_0xe047('0x8e')]['Contacts'][0x0];}var _0x25cdc1=_[_0xe047('0x18')](_0x5f2758[_0xe047('0x62')],{'firstName':_0x5f2758[_0xe047('0x62')][_0xe047('0x7c')],'ListId':_0x30e240[_0xe047('0x7a')]});_0x25cdc1[_0x5f2758[_0xe047('0x62')][_0xe047('0x7f')]]=_0x5f2758[_0xe047('0x62')]['from'];return db['CmContact']['create'](_0x25cdc1,{'fields':_0x2caea8,'raw':!![]});}})[_0xe047('0x1f')](handleEntityNotFound(_0x3345b7,null))['then'](function(_0x74da26){_0x5cf4b2[_0xe047('0x8f')]=_0x74da26;if(_0x74da26){var _0x5e8512={'ContactId':_0x74da26['id'],'OpenchannelAccountId':_0x5f2758[_0xe047('0x56')]['id'],'from':(_0x74da26['firstName']||'')+'\x20'+(_0x74da26[_0xe047('0x90')]||'')};var _0x4c423b={'OpenchannelAccountId':_0x5f2758['params']['id'],'closed':![]};if(_0x5f2758[_0xe047('0x62')]['threadId']){_0x4c423b[_0xe047('0x91')]=_0x5f2758[_0xe047('0x62')][_0xe047('0x91')];return db[_0xe047('0x92')][_0xe047('0x59')]({'where':_0x4c423b})[_0xe047('0x1f')](function(_0x27fcad){if(_0x27fcad){return[_0x27fcad,![]];}_0x5e8512['threadId']=_0x5f2758[_0xe047('0x62')][_0xe047('0x91')];_0x5e8512[_0xe047('0x93')]=_0x5f2758[_0xe047('0x62')][_0xe047('0x93')];return db[_0xe047('0x92')][_0xe047('0x5a')](_0x5e8512)['then'](function(_0x38988d){return[_0x38988d,!![]];});});}else{_0x4c423b['threadId']=null;}_0x4c423b[_0xe047('0x94')]=_0x74da26['id'];return db[_0xe047('0x92')][_0xe047('0x59')]({'where':_0x4c423b})[_0xe047('0x1f')](function(_0x451789){if(_0x451789){return[_0x451789,![]];}return db[_0xe047('0x92')]['create'](_0x5e8512)['then'](function(_0xa9752){return[_0xa9752,!![]];});});}})[_0xe047('0x95')](function(_0x54094f,_0x107d26){if(_0x54094f){_0x2bcfed=_0x107d26;if(!_0x107d26){var _0x1c4412={'from':(_0x5cf4b2[_0xe047('0x8f')]['firstName']||'')+'\x20'+(_0x5cf4b2['contact'][_0xe047('0x90')]||'')};if(_0x5f2758[_0xe047('0x62')][_0xe047('0x91')]&&_0x5f2758['body'][_0xe047('0x96')]&&_0x5f2758[_0xe047('0x62')][_0xe047('0x91')]!=_0x5f2758[_0xe047('0x62')]['messageId']){_0x1c4412['threadId']=_0x5f2758[_0xe047('0x62')]['messageId'];}return _0x54094f['update'](_0x1c4412);}else{return _0x54094f;}}})[_0xe047('0x1f')](function(_0x4618f9){_0x5cf4b2[_0xe047('0x97')]=_0x4618f9[_0xe047('0x34')]({'plain':!![]});_0x5cf4b2['interaction'][_0xe047('0x98')]=_0x2bcfed;if(_0x5cf4b2['interaction'][_0xe047('0x98')]){if(_0x5cf4b2[_0xe047('0x89')]['autoclose']){_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x99')]({'id':0x0,'priority':_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x4a')]+0x1,'app':_0xe047('0x9a'),'appdata':_0xe047('0x9b'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xe047('0x5a')]({'body':_0x5f2758[_0xe047('0x62')][_0xe047('0x62')],'OpenchannelAccountId':_0x5f2758[_0xe047('0x56')]['id'],'OpenchannelInteractionId':_0x4618f9['id'],'direction':'in','ContactId':_0x5cf4b2[_0xe047('0x8f')]['id'],'AttachmentId':_0x5f2758[_0xe047('0x62')][_0xe047('0x9c')]});})[_0xe047('0x1f')](function(_0x4b72d1){_0x5cf4b2['message']=_0x4b72d1;if(!_0x5cf4b2[_0xe047('0x97')][_0xe047('0x9d')])return;return db['User'][_0xe047('0x59')]({'attributes':['id',_0xe047('0x3a')],'where':{'id':_0x5cf4b2['interaction'][_0xe047('0x9d')]}});})[_0xe047('0x1f')](function(_0x461582){if(_0x461582){_0x5cf4b2['applications'][_0xe047('0x9e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x461582[_0xe047('0x3a')]+','+(_0x5cf4b2[_0xe047('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xe047('0x9f')});}if(!_0x5cf4b2[_0xe047('0x97')][_0xe047('0xa0')])return;return db[_0xe047('0xa1')][_0xe047('0x59')]({'attributes':['id','name'],'where':{'id':_0x5cf4b2['interaction']['queueId']}});})['then'](function(_0x2b424e){if(_0x2b424e){_0x5cf4b2[_0xe047('0x8a')][_0xe047('0x9e')]({'id':0x0,'priority':0x1,'app':_0xe047('0xa2'),'appdata':_0x2b424e['name']+','+(_0x5cf4b2[_0xe047('0x89')][_0xe047('0xa3')]||0x12c),'interval':_0xe047('0x9f')});}return respondWithRpcPromise('Start',_0xe047('0xa4'),_0x5cf4b2);})['then'](function(_0x320057){respondWithRpcPromise(_0xe047('0xa5'),_0xe047('0xa5'),{'event':_0xe047('0x72'),'message':_0x320057},client9002);return _0x320057;})[_0xe047('0x1f')](respondWithResult(_0x3345b7,null))[_0xe047('0x29')](handleError(_0x3345b7,null));};exports[_0xe047('0xa6')]=function(_0x586f9d,_0x4818dd){var _0x21999a=_0x586f9d[_0xe047('0x56')]['id'];var _0x443697=_0x586f9d['body'];var _0x5a938e=0xc8;var _0x4952f0=null;return db[_0xe047('0xa7')][_0xe047('0xa8')]({'isolationLevel':db[_0xe047('0xa7')][_0xe047('0xa9')][_0xe047('0xaa')][_0xe047('0xab')]},function(_0x570c31){return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x21999a},'transaction':_0x570c31})[_0xe047('0x1f')](function(_0x36a5ae){if(_0x36a5ae){return db[_0xe047('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x21999a},'transaction':_0x570c31})[_0xe047('0x1f')](function(){var _0x31d794=_[_0xe047('0x43')](_0x443697,function(_0x58a986){_0x58a986[_0xe047('0x65')]=_0x21999a;return _0x58a986;});return db[_0xe047('0x87')][_0xe047('0xac')](_0x31d794,{'transaction':_0x570c31});});}else{_0x5a938e=0x194;_0x4952f0=[];}});})[_0xe047('0x1f')](function(){if(_0x5a938e!==0x194){return db[_0xe047('0x87')][_0xe047('0xad')]({'where':{'OpenchannelAccountId':_0x21999a},'order':_0xe047('0x8c')})['then'](function(_0x11fcdb){_0x4952f0=_0x11fcdb;});}})[_0xe047('0x29')](function(_0x59a182){_0x5a938e=0x1f4;logger[_0xe047('0x24')](_0x59a182[_0xe047('0x39')]);if(_0x59a182[_0xe047('0x3a')]){delete _0x59a182[_0xe047('0x3a')];}_0x4952f0=_0x59a182;})[_0xe047('0xae')](function(){if(_0x4952f0===null){_0x4818dd[_0xe047('0x38')](_0x5a938e);}else{if(_0x5a938e===0x1f4){_0x4818dd['status'](_0x5a938e)[_0xe047('0xaf')](_0x4952f0);}else{_0x4818dd['status'](_0x5a938e)['json'](_0x4952f0);}}});};exports[_0xe047('0xb0')]=function(_0x280e99,_0x308499,_0x59e471){var _0x50a152={};var _0x395ef9={};var _0x5260e1;var _0x3f6f4d;return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x280e99[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x308499,null))['then'](function(_0x1d7920){if(_0x1d7920){_0x5260e1=_0x1d7920;_0x395ef9[_0xe047('0x42')]=_[_0xe047('0x45')](db[_0xe047('0x87')]['rawAttributes']);_0x395ef9[_0xe047('0x44')]=_[_0xe047('0x45')](_0x280e99[_0xe047('0x44')]);_0x395ef9[_0xe047('0x46')]=_[_0xe047('0x47')](_0x395ef9[_0xe047('0x42')],_0x395ef9[_0xe047('0x44')]);_0x50a152['attributes']=_[_0xe047('0x47')](_0x395ef9['model'],qs[_0xe047('0x49')](_0x280e99[_0xe047('0x44')][_0xe047('0x49')]));_0x50a152['attributes']=_0x50a152[_0xe047('0x48')][_0xe047('0x4a')]?_0x50a152[_0xe047('0x48')]:_0x395ef9[_0xe047('0x42')];_0x50a152['order']=qs[_0xe047('0x4e')](_0x280e99[_0xe047('0x44')][_0xe047('0x4e')]);_0x50a152[_0xe047('0x4f')]=qs[_0xe047('0x46')](_['pick'](_0x280e99['query'],_0x395ef9['filters']));if(_0x280e99[_0xe047('0x44')][_0xe047('0x69')]){_0x50a152[_0xe047('0x4f')]=_[_0xe047('0x51')](_0x50a152[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x50a152[_0xe047('0x48')],function(_0x2f8257){var _0x124fd2={};_0x124fd2[_0x2f8257]={'$like':'%'+_0x280e99[_0xe047('0x44')]['filter']+'%'};return _0x124fd2;})});}_0x50a152=_[_0xe047('0x51')]({},_0x50a152,_0x280e99[_0xe047('0x58')]);return _0x5260e1[_0xe047('0xb0')](_0x50a152);}})[_0xe047('0x1f')](function(_0x503749){if(_0x503749){_0x3f6f4d=_0x503749['length'];if(!_0x280e99[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0x50a152[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x280e99[_0xe047('0x44')][_0xe047('0x2f')]);_0x50a152[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x280e99[_0xe047('0x44')]['offset']);}return _0x5260e1[_0xe047('0xb0')](_0x50a152);}})[_0xe047('0x1f')](function(_0x3565ab){if(_0x3565ab){return _0x3565ab?{'count':_0x3f6f4d,'rows':_0x3565ab}:null;}})[_0xe047('0x1f')](respondWithResult(_0x308499,null))['catch'](handleError(_0x308499,null));};exports[_0xe047('0xb1')]=function(_0x49edac,_0x5bb22a,_0x8b09ba){var _0x5caf42={'raw':![],'where':{}};var _0x52cfc6={};var _0x274011={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe047('0x68')]({'where':{'id':_0x49edac['params']['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x5bb22a,null))[_0xe047('0x1f')](function(_0x649a85){if(_0x649a85){_0x52cfc6[_0xe047('0x42')]=_[_0xe047('0x45')](db['OpenchannelInteraction'][_0xe047('0x3e')]);_0x52cfc6['query']=_['keys'](_0x49edac[_0xe047('0x44')]);_0x52cfc6[_0xe047('0x46')]=_[_0xe047('0x47')](_0x52cfc6[_0xe047('0x42')],_0x52cfc6['query']);_0x5caf42['attributes']=_[_0xe047('0x47')](_0x52cfc6['model'],qs[_0xe047('0x49')](_0x49edac['query'][_0xe047('0x49')]));_0x5caf42['attributes']=_0x5caf42[_0xe047('0x48')][_0xe047('0x4a')]?_0x5caf42[_0xe047('0x48')]:_0x52cfc6[_0xe047('0x42')];if(!_0x49edac[_0xe047('0x44')][_0xe047('0x4b')](_0xe047('0x4c'))){_0x5caf42['limit']=qs[_0xe047('0x2f')](_0x49edac['query'][_0xe047('0x2f')]);_0x5caf42[_0xe047('0x2d')]=qs['offset'](_0x49edac[_0xe047('0x44')][_0xe047('0x2d')]);}_0x5caf42[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x49edac[_0xe047('0x44')]['sort']);_0x5caf42['where']=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x49edac[_0xe047('0x44')],_0x52cfc6['filters']));_0x5caf42['where'][_0xe047('0x65')]=_0x649a85['id'];if(_0x49edac[_0xe047('0x44')]['filter']){_0x5caf42['where']=_['merge'](_0x5caf42[_0xe047('0x4f')],{'$or':_[_0xe047('0x43')](_0x5caf42[_0xe047('0x48')],function(_0x4a6dac){var _0x3bc44a={};_0x3bc44a[_0x4a6dac]={'$like':'%'+_0x49edac[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x3bc44a;})});}_0x5caf42=_['merge']({},_0x5caf42,_0x49edac[_0xe047('0x58')]);return db['OpenchannelInteraction']['count']({'where':_0x5caf42[_0xe047('0x4f')]})[_0xe047('0x1f')](function(_0x23a602){_0x274011[_0xe047('0x30')]=_0x23a602;if(_0x49edac['query'][_0xe047('0x53')]){_0x5caf42[_0xe047('0x54')]=[{'model':db[_0xe047('0x84')],'as':_0xe047('0xb2'),'required':![]},{'model':db['User'],'as':_0xe047('0xb3'),'attributes':[_0xe047('0x3a'),_0xe047('0xb4'),_0xe047('0xb5')],'required':![]},{'model':db[_0xe047('0xb6')],'as':'Tags','attributes':['id','name','color'],'where':_0x49edac['query'][_0xe047('0xb7')]?{'id':_0x49edac[_0xe047('0x44')]['tag']}:undefined,'required':_0x49edac['query'][_0xe047('0xb7')]?!![]:![]}];}return db[_0xe047('0x92')][_0xe047('0x70')](_0x5caf42);})[_0xe047('0x1f')](function(_0x254dc9){_0x274011['rows']=_0x254dc9;return _0x274011;});}})[_0xe047('0x1f')](respondWithFilteredResult(_0x5bb22a,_0x5caf42))[_0xe047('0x29')](handleError(_0x5bb22a,null));};exports[_0xe047('0xb8')]=function(_0x4fca2f,_0x29129b,_0x5d4493){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x4fca2f[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x29129b,null))[_0xe047('0x1f')](function(_0x2008e3){if(_0x2008e3){return _0x2008e3[_0xe047('0xb8')](_0x4fca2f[_0xe047('0x62')][_0xe047('0x6c')],_['omit'](_0x4fca2f[_0xe047('0x62')],[_0xe047('0x6c'),'id'])||{})[_0xe047('0x95')](function(_0x181556){for(var _0x4a183a=0x0;_0x4a183a<_0x4fca2f['body'][_0xe047('0x6c')][_0xe047('0x4a')];_0x4a183a+=0x1){socket[_0xe047('0xb9')](_0xe047('0xba'),{'UserId':Number(_0x4fca2f[_0xe047('0x62')][_0xe047('0x6c')][_0x4a183a]),'OpenchannelAccountId':Number(_0x4fca2f[_0xe047('0x56')]['id'])});}return _0x181556;});}})['then'](respondWithResult(_0x29129b,null))[_0xe047('0x29')](handleError(_0x29129b,null));};exports[_0xe047('0xbb')]=function(_0x210632,_0x47117e,_0x3a401e){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x210632[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x47117e,null))['then'](function(_0x10ee42){if(_0x10ee42){return _0x10ee42['removeAgents'](_0x210632[_0xe047('0x44')]['ids'])['then'](function(){if(_[_0xe047('0xbc')](_0x210632[_0xe047('0x44')][_0xe047('0x6c')])){for(var _0x4fbf84=0x0;_0x4fbf84<_0x210632[_0xe047('0x44')]['ids'][_0xe047('0x4a')];_0x4fbf84+=0x1){socket[_0xe047('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x210632[_0xe047('0x44')][_0xe047('0x6c')][_0x4fbf84]),'OpenchannelAccountId':Number(_0x210632['params']['id'])});}}else{socket[_0xe047('0xb9')](_0xe047('0xbd'),{'UserId':Number(_0x210632[_0xe047('0x44')][_0xe047('0x6c')]),'OpenchannelAccountId':Number(_0x210632['params']['id'])});}});}})[_0xe047('0x1f')](respondWithStatusCode(_0x47117e,null))[_0xe047('0x29')](handleError(_0x47117e,null));};exports[_0xe047('0xbe')]=function(_0x4e3259,_0x26ff67,_0x4e29f8){var _0x473777={};var _0x1634a0={};var _0x21ce77;var _0x59317f;return db[_0xe047('0x3d')]['findOne']({'where':{'id':_0x4e3259[_0xe047('0x56')]['id']}})[_0xe047('0x1f')](handleEntityNotFound(_0x26ff67,null))[_0xe047('0x1f')](function(_0x4f5355){if(_0x4f5355){_0x21ce77=_0x4f5355;_0x1634a0[_0xe047('0x42')]=_[_0xe047('0x45')](db[_0xe047('0xbf')][_0xe047('0x3e')]);_0x1634a0[_0xe047('0x44')]=_[_0xe047('0x45')](_0x4e3259[_0xe047('0x44')]);_0x1634a0[_0xe047('0x46')]=_['intersection'](_0x1634a0['model'],_0x1634a0[_0xe047('0x44')]);_0x473777[_0xe047('0x48')]=_['intersection'](_0x1634a0[_0xe047('0x42')],qs['fields'](_0x4e3259[_0xe047('0x44')]['fields']));_0x473777[_0xe047('0x48')]=_0x473777[_0xe047('0x48')][_0xe047('0x4a')]?_0x473777['attributes']:_0x1634a0['model'];_0x473777[_0xe047('0x4d')]=qs[_0xe047('0x4e')](_0x4e3259[_0xe047('0x44')][_0xe047('0x4e')]);_0x473777[_0xe047('0x4f')]=qs[_0xe047('0x46')](_[_0xe047('0x50')](_0x4e3259[_0xe047('0x44')],_0x1634a0['filters']));if(_0x4e3259[_0xe047('0x44')]['filter']){_0x473777[_0xe047('0x4f')]=_[_0xe047('0x51')](_0x473777[_0xe047('0x4f')],{'$or':_['map'](_0x473777['attributes'],function(_0x4cb7af){var _0x577024={};_0x577024[_0x4cb7af]={'$like':'%'+_0x4e3259[_0xe047('0x44')][_0xe047('0x69')]+'%'};return _0x577024;})});}_0x473777=_[_0xe047('0x51')]({},_0x473777,_0x4e3259['options']);return _0x21ce77[_0xe047('0xbe')](_0x473777);}})[_0xe047('0x1f')](function(_0x3b7571){if(_0x3b7571){_0x59317f=_0x3b7571['length'];if(!_0x4e3259[_0xe047('0x44')]['hasOwnProperty'](_0xe047('0x4c'))){_0x473777[_0xe047('0x2f')]=qs[_0xe047('0x2f')](_0x4e3259['query']['limit']);_0x473777[_0xe047('0x2d')]=qs[_0xe047('0x2d')](_0x4e3259['query'][_0xe047('0x2d')]);}return _0x21ce77[_0xe047('0xbe')](_0x473777);}})['then'](function(_0x145a71){if(_0x145a71){return _0x145a71?{'count':_0x59317f,'rows':_0x145a71}:null;}})['then'](respondWithResult(_0x26ff67,null))[_0xe047('0x29')](handleError(_0x26ff67,null));};exports['send']=function(_0x2c647e,_0x4b6e45,_0x4b1064){var _0x3a009a,_0x213d0e,_0x11a772;if(_[_0xe047('0x7b')](_0x2c647e['body'][_0xe047('0x62')])||_0x2c647e[_0xe047('0x62')][_0xe047('0x62')]===''){throw new db['Sequelize'][(_0xe047('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe047('0x7b')](_0x2c647e[_0xe047('0x62')]['to'])){}_0x3a009a=_0x2c647e['body']['to'];return db[_0xe047('0x3d')][_0xe047('0x68')]({'where':{'id':_0x2c647e[_0xe047('0x56')]['id']}})['then'](handleEntityNotFound(_0x4b6e45,null))[_0xe047('0x1f')](function(_0x2e9e7a){if(_0x2e9e7a){return db[_0xe047('0x3d')][_0xe047('0x59')]({'where':{'id':_0x2e9e7a['id']},'include':[{'model':db[_0xe047('0x83')],'as':_0xe047('0x8e'),'include':[{'model':db['CmContact'],'as':_0xe047('0x85'),'where':{[_0x2e9e7a[_0xe047('0x7f')]]:_0x3a009a},'limit':0x1,'order':[[_0xe047('0x78'),_0xe047('0x86')]]}]}]})[_0xe047('0x1f')](handleEntityNotFound(_0x4b6e45,null))[_0xe047('0x1f')](function(_0x2e113f){if(_0x2e113f&&_0x2e113f[_0xe047('0x8e')]){_0x213d0e=_0x2e113f[_0xe047('0x34')]({'plain':!![]});if(_0x213d0e[_0xe047('0x8e')]&&_0x213d0e[_0xe047('0x8e')]['Contacts'][_0xe047('0x4a')]){return _0x213d0e['List'][_0xe047('0x85')][0x0];}return db[_0xe047('0x84')][_0xe047('0x5a')](_['defaults'](_0x2c647e[_0xe047('0x62')],{'firstName':_0x3a009a,[_0x2e113f[_0xe047('0x7f')]]:_0x3a009a,'phone':_0x3a009a,'ListId':_0x213d0e[_0xe047('0x7a')]}));}})['then'](handleEntityNotFound(_0x4b6e45,null))['then'](function(_0x35e59d){if(_0x35e59d){_0x11a772=_0x35e59d;return db[_0xe047('0x92')][_0xe047('0x59')]({'where':{'ContactId':_0x11a772['id'],'closed':![],'OpenchannelAccountId':_0x213d0e['id']}})['then'](function(_0x48a511){if(_0x48a511){return[_0x48a511,![]];}return db[_0xe047('0x92')][_0xe047('0x5a')]({'UserId':_0x2c647e[_0xe047('0x5b')]['id'],'ContactId':_0x11a772['id'],'OpenchannelAccountId':_0x213d0e['id'],'lastMsgDirection':_0xe047('0xc0'),'firstMsgDirection':_0xe047('0xc0'),'Messages':[_['merge'](_0x2c647e['body'],{'read':![],'body':_0x2c647e[_0xe047('0x62')][_0xe047('0x62')],'OpenchannelAccountId':_0x213d0e['id'],'UserId':_0x2c647e['user']['id'],'ContactId':_0x11a772['id']})]},{'include':[{'model':db[_0xe047('0xc1')],'as':_0xe047('0xc2')}]})[_0xe047('0x1f')](function(_0x33dc89){return[_0x33dc89,!![]];});});}})[_0xe047('0x95')](function(_0xa952ef,_0x55621f){if(_0x55621f){return _0xa952ef;}return db['OpenchannelMessage'][_0xe047('0x5a')](_[_0xe047('0x51')](_0x2c647e['body'],{'read':![],'body':_0x2c647e[_0xe047('0x62')]['body'],'OpenchannelAccountId':_0x213d0e['id'],'OpenchannelInteractionId':_0xa952ef['id'],'UserId':_0x2c647e[_0xe047('0x5b')]['id'],'ContactId':_0x11a772['id']}))['then'](function(_0x1b0a3d){_0xa952ef[_0xe047('0xc3')][_0xe047('0xc2')]=[];_0xa952ef['dataValues'][_0xe047('0xc2')][_0xe047('0x99')](_0x1b0a3d[_0xe047('0xc3')]);return _0xa952ef;});});}})[_0xe047('0x1f')](respondWithResult(_0x4b6e45,null))[_0xe047('0x29')](handleError(_0x4b6e45,null));}; \ No newline at end of file +var _0x5977=['READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','fullname','Tag','color','tag','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','Pause','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0x5977,0xe1));var _0x7597=function(_0x4774c4,_0x4a4a49){_0x4774c4=_0x4774c4-0x0;var _0x43714c=_0x5977[_0x4774c4];return _0x43714c;};'use strict';var emlformat=require(_0x7597('0x0'));var rimraf=require(_0x7597('0x1'));var zipdir=require(_0x7597('0x2'));var jsonpatch=require(_0x7597('0x3'));var rp=require('request-promise');var moment=require(_0x7597('0x4'));var BPromise=require(_0x7597('0x5'));var Mustache=require(_0x7597('0x6'));var util=require('util');var path=require(_0x7597('0x7'));var sox=require(_0x7597('0x8'));var csv=require(_0x7597('0x9'));var ejs=require(_0x7597('0xa'));var fs=require('fs');var fs_extra=require(_0x7597('0xb'));var _=require(_0x7597('0xc'));var squel=require(_0x7597('0xd'));var crypto=require(_0x7597('0xe'));var jsforce=require(_0x7597('0xf'));var deskjs=require(_0x7597('0x10'));var toCsv=require(_0x7597('0x9'));var querystring=require('querystring');var Papa=require(_0x7597('0x11'));var Redis=require(_0x7597('0x12'));var authService=require(_0x7597('0x13'));var qs=require(_0x7597('0x14'));var as=require(_0x7597('0x15'));var hardwareService=require(_0x7597('0x16'));var logger=require(_0x7597('0x17'))(_0x7597('0x18'));var utils=require(_0x7597('0x19'));var config=require(_0x7597('0x1a'));var licenseUtil=require(_0x7597('0x1b'));var db=require('../../mysqldb')['db'];config[_0x7597('0x1c')]=_[_0x7597('0x1d')](config[_0x7597('0x1c')],{'host':_0x7597('0x1e'),'port':0x18eb});var socket=require(_0x7597('0x1f'))(new Redis(config['redis']));require(_0x7597('0x20'))[_0x7597('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7597('0x22')][_0x7597('0x23')]({'port':0x232c});var client9002=jayson[_0x7597('0x22')][_0x7597('0x23')]({'port':0x232a});function respondWithRpcPromise(_0xec7ea9,_0x3ca8da,_0x3670fa,_0x3bb8c5){return new BPromise(function(_0x5948b8,_0x55b28b){var _0x24be0d=_0x3bb8c5||client;return _0x24be0d['request'](_0xec7ea9,_0x3670fa)[_0x7597('0x24')](function(_0x237aa4){logger[_0x7597('0x25')](_0x7597('0x26'),_0x3ca8da,_0x7597('0x27'));logger['debug'](_0x7597('0x28'),_0x3ca8da,_0x7597('0x27'),JSON[_0x7597('0x29')](_0x237aa4));if(_0x237aa4['error']){if(_0x237aa4[_0x7597('0x2a')][_0x7597('0x2b')]===0x1f4){logger[_0x7597('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x3ca8da,_0x237aa4['error'][_0x7597('0x2c')]);return _0x55b28b(_0x237aa4[_0x7597('0x2a')]['message']);}logger[_0x7597('0x2a')](_0x7597('0x26'),_0x3ca8da,_0x237aa4['error']['message']);return _0x5948b8(_0x237aa4['error']['message']);}else{logger[_0x7597('0x25')](_0x7597('0x26'),_0x3ca8da,_0x7597('0x27'));_0x5948b8(_0x237aa4[_0x7597('0x2d')][_0x7597('0x2c')]);}})[_0x7597('0x2e')](function(_0x45bf4f){logger[_0x7597('0x2a')](_0x7597('0x26'),_0x3ca8da,_0x45bf4f);_0x55b28b(_0x45bf4f);});});}function respondWithStatusCode(_0x33c293,_0x5c36ef){_0x5c36ef=_0x5c36ef||0xcc;return function(_0x39ff19){if(_0x39ff19){return _0x33c293[_0x7597('0x2f')](_0x5c36ef);}return _0x33c293[_0x7597('0x30')](_0x5c36ef)[_0x7597('0x31')]();};}function respondWithResult(_0x8aab67,_0x3c1dfa){_0x3c1dfa=_0x3c1dfa||0xc8;return function(_0x5d7730){if(_0x5d7730){return _0x8aab67[_0x7597('0x30')](_0x3c1dfa)[_0x7597('0x32')](_0x5d7730);}};}function respondWithFilteredResult(_0x51f9d4,_0x33edee){return function(_0x3dc28c){if(_0x3dc28c){var _0x2ee6cf=typeof _0x33edee[_0x7597('0x33')]==='undefined'&&typeof _0x33edee['limit']===_0x7597('0x34');var _0x25b094=_0x3dc28c[_0x7597('0x35')];var _0x592c3a=_0x2ee6cf?0x0:_0x33edee[_0x7597('0x33')];var _0x2e9de5=_0x2ee6cf?_0x3dc28c['count']:_0x33edee[_0x7597('0x33')]+_0x33edee[_0x7597('0x36')];var _0x387eea;if(_0x2e9de5>=_0x25b094){_0x2e9de5=_0x25b094;_0x387eea=0xc8;}else{_0x387eea=0xce;}_0x51f9d4[_0x7597('0x30')](_0x387eea);return _0x51f9d4[_0x7597('0x37')](_0x7597('0x38'),_0x592c3a+'-'+_0x2e9de5+'/'+_0x25b094)['json'](_0x3dc28c);}return null;};}function patchUpdates(_0x104f51){return function(_0xc80a82){try{jsonpatch[_0x7597('0x39')](_0xc80a82,_0x104f51,!![]);}catch(_0xe10a06){return BPromise[_0x7597('0x3a')](_0xe10a06);}return _0xc80a82[_0x7597('0x3b')]();};}function saveUpdates(_0x4d5867,_0x474b40){return function(_0x44078d){if(_0x44078d){return _0x44078d[_0x7597('0x3c')](_0x4d5867)[_0x7597('0x24')](function(_0xdfdeda){return _0xdfdeda;});}return null;};}function removeEntity(_0x31e99d,_0x3f2f34){return function(_0x3fde9d){if(_0x3fde9d){return _0x3fde9d[_0x7597('0x3d')]()[_0x7597('0x24')](function(){var _0x1603b4=_0x3fde9d['get']({'plain':!![]});var _0x325c69=_0x7597('0x3e');return db[_0x7597('0x3f')]['destroy']({'where':{'type':_0x325c69,'resourceId':_0x1603b4['id']}})[_0x7597('0x24')](function(){return _0x3fde9d;});})['then'](function(){_0x31e99d[_0x7597('0x30')](0xcc)[_0x7597('0x31')]();});}};}function handleEntityNotFound(_0x5bc5de,_0x3222ea){return function(_0x2fc6a5){if(!_0x2fc6a5){_0x5bc5de[_0x7597('0x2f')](0x194);}return _0x2fc6a5;};}function handleError(_0xca4e8e,_0x484254){_0x484254=_0x484254||0x1f4;return function(_0x402c1a){logger['error'](_0x402c1a[_0x7597('0x40')]);if(_0x402c1a['name']){delete _0x402c1a[_0x7597('0x41')];}_0xca4e8e[_0x7597('0x30')](_0x484254)[_0x7597('0x42')](_0x402c1a);};}exports[_0x7597('0x43')]=function(_0x1438f1,_0x272b54){var _0x1a25c2={'include':[{'model':db['Pause'],'as':_0x7597('0x44')}]},_0x4a19c6={},_0x2d600c={'count':0x0,'rows':[]};var _0xd4cf9d=_[_0x7597('0x45')](db[_0x7597('0x46')][_0x7597('0x47')],function(_0x41e2fe){return{'name':_0x41e2fe[_0x7597('0x48')],'type':_0x41e2fe[_0x7597('0x49')][_0x7597('0x4a')]};});_0x4a19c6[_0x7597('0x4b')]=_[_0x7597('0x45')](_0xd4cf9d,'name');_0x4a19c6['query']=_[_0x7597('0x4c')](_0x1438f1[_0x7597('0x4d')]);_0x4a19c6[_0x7597('0x4e')]=_[_0x7597('0x4f')](_0x4a19c6[_0x7597('0x4b')],_0x4a19c6[_0x7597('0x4d')]);_0x1a25c2[_0x7597('0x50')]=_['intersection'](_0x4a19c6[_0x7597('0x4b')],qs[_0x7597('0x51')](_0x1438f1['query']['fields']));_0x1a25c2[_0x7597('0x50')]=_0x1a25c2[_0x7597('0x50')][_0x7597('0x52')]?_0x1a25c2[_0x7597('0x50')]:_0x4a19c6['model'];if(!_0x1438f1['query']['hasOwnProperty'](_0x7597('0x53'))){_0x1a25c2[_0x7597('0x36')]=qs[_0x7597('0x36')](_0x1438f1[_0x7597('0x4d')][_0x7597('0x36')]);_0x1a25c2[_0x7597('0x33')]=qs['offset'](_0x1438f1[_0x7597('0x4d')][_0x7597('0x33')]);}_0x1a25c2[_0x7597('0x54')]=qs[_0x7597('0x55')](_0x1438f1['query'][_0x7597('0x55')]);_0x1a25c2['where']=qs[_0x7597('0x4e')](_['pick'](_0x1438f1['query'],_0x4a19c6[_0x7597('0x4e')]),_0xd4cf9d);if(_0x1438f1[_0x7597('0x4d')][_0x7597('0x56')]){_0x1a25c2[_0x7597('0x57')]=_['merge'](_0x1a25c2['where'],{'$or':_['map'](_0xd4cf9d,function(_0x24f7e2){if(_0x24f7e2[_0x7597('0x49')]!==_0x7597('0x58')){var _0x587141={};_0x587141[_0x24f7e2[_0x7597('0x41')]]={'$like':'%'+_0x1438f1['query']['filter']+'%'};return _0x587141;}})});}_0x1a25c2=_[_0x7597('0x59')]({},_0x1a25c2,_0x1438f1['options']);var _0x4538a0={'where':_0x1a25c2[_0x7597('0x57')]};return db[_0x7597('0x46')]['count'](_0x4538a0)[_0x7597('0x24')](function(_0x25e8f1){_0x2d600c[_0x7597('0x35')]=_0x25e8f1;if(_0x1438f1[_0x7597('0x4d')][_0x7597('0x5a')]){_0x1a25c2[_0x7597('0x5b')]=[{'all':!![]}];}return db[_0x7597('0x46')][_0x7597('0x5c')](_0x1a25c2);})['then'](function(_0x4c2c17){_0x2d600c[_0x7597('0x5d')]=_0x4c2c17;return _0x2d600c;})[_0x7597('0x24')](respondWithFilteredResult(_0x272b54,_0x1a25c2))[_0x7597('0x2e')](handleError(_0x272b54,null));};exports['show']=function(_0x2e6b14,_0x42a20b){var _0x5e5e45={'raw':![],'where':{'id':_0x2e6b14['params']['id']},'include':[{'model':db[_0x7597('0x5e')],'as':'mandatoryDispositionPause'}]},_0x254331={};_0x254331[_0x7597('0x4b')]=_[_0x7597('0x4c')](db[_0x7597('0x46')][_0x7597('0x47')]);_0x254331[_0x7597('0x4d')]=_[_0x7597('0x4c')](_0x2e6b14['query']);_0x254331[_0x7597('0x4e')]=_[_0x7597('0x4f')](_0x254331['model'],_0x254331[_0x7597('0x4d')]);_0x5e5e45[_0x7597('0x50')]=_['intersection'](_0x254331[_0x7597('0x4b')],qs[_0x7597('0x51')](_0x2e6b14[_0x7597('0x4d')][_0x7597('0x51')]));_0x5e5e45[_0x7597('0x50')]=_0x5e5e45[_0x7597('0x50')][_0x7597('0x52')]?_0x5e5e45['attributes']:_0x254331['model'];if(_0x2e6b14['query'][_0x7597('0x5a')]){_0x5e5e45['include']=[{'all':!![]}];}_0x5e5e45=_['merge']({},_0x5e5e45,_0x2e6b14[_0x7597('0x5f')]);return db[_0x7597('0x46')][_0x7597('0x60')](_0x5e5e45)[_0x7597('0x24')](handleEntityNotFound(_0x42a20b,null))[_0x7597('0x24')](respondWithResult(_0x42a20b,null))[_0x7597('0x2e')](handleError(_0x42a20b,null));};exports[_0x7597('0x61')]=function(_0x382cfd,_0x1c0546){return db[_0x7597('0x46')]['create'](_0x382cfd[_0x7597('0x62')],{})[_0x7597('0x24')](function(_0x223cb8){var _0x1354bc=_0x382cfd[_0x7597('0x63')][_0x7597('0x64')]({'plain':!![]});if(!_0x1354bc)throw new Error(_0x7597('0x65'));if(_0x1354bc[_0x7597('0x66')]===_0x7597('0x63')){var _0xa25010=_0x223cb8[_0x7597('0x64')]({'plain':!![]});var _0x17e0d6=_0x7597('0x3e');return db[_0x7597('0x67')][_0x7597('0x60')]({'where':{'name':_0x17e0d6,'userProfileId':_0x1354bc[_0x7597('0x68')]},'raw':!![]})[_0x7597('0x24')](function(_0x3d2ec){if(_0x3d2ec&&_0x3d2ec['autoAssociation']===0x0){return db['UserProfileResource'][_0x7597('0x61')]({'name':_0xa25010[_0x7597('0x41')],'resourceId':_0xa25010['id'],'type':_0x3d2ec['name'],'sectionId':_0x3d2ec['id']},{})['then'](function(){return _0x223cb8;});}else{return _0x223cb8;}})[_0x7597('0x2e')](function(_0x553b61){logger[_0x7597('0x2a')](_0x7597('0x69'),_0x553b61);throw _0x553b61;});}return _0x223cb8;})['then'](respondWithResult(_0x1c0546,0xc9))[_0x7597('0x2e')](handleError(_0x1c0546,null));};exports[_0x7597('0x3c')]=function(_0x1ae0dd,_0x500a74){if(_0x1ae0dd['body']['id']){delete _0x1ae0dd[_0x7597('0x62')]['id'];}return db['OpenchannelAccount'][_0x7597('0x60')]({'where':{'id':_0x1ae0dd[_0x7597('0x6a')]['id']},'include':[{'model':db[_0x7597('0x5e')],'as':'mandatoryDispositionPause'}]})[_0x7597('0x24')](handleEntityNotFound(_0x500a74,null))['then'](saveUpdates(_0x1ae0dd[_0x7597('0x62')],null))[_0x7597('0x24')](respondWithResult(_0x500a74,null))[_0x7597('0x2e')](handleError(_0x500a74,null));};exports[_0x7597('0x3d')]=function(_0xc4203c,_0x4adbf4){return db[_0x7597('0x46')]['find']({'where':{'id':_0xc4203c[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x4adbf4,null))[_0x7597('0x24')](removeEntity(_0x4adbf4,null))[_0x7597('0x2e')](handleError(_0x4adbf4,null));};exports[_0x7597('0x6b')]=function(_0x3804b7,_0x528133){return db[_0x7597('0x46')][_0x7597('0x6b')]()[_0x7597('0x24')](respondWithResult(_0x528133,null))[_0x7597('0x2e')](handleError(_0x528133,null));};exports[_0x7597('0x6c')]=function(_0x150c98,_0x56148d,_0x7f466f){if(_0x150c98[_0x7597('0x62')]['id']){delete _0x150c98[_0x7597('0x62')]['id'];}return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x150c98['params']['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x56148d,null))[_0x7597('0x24')](function(_0x55a650){if(_0x55a650){_0x150c98[_0x7597('0x62')][_0x7597('0x6d')]=_0x55a650['id'];return db[_0x7597('0x6e')]['create'](_0x150c98[_0x7597('0x62')]);}})[_0x7597('0x24')](respondWithResult(_0x56148d,null))['catch'](handleError(_0x56148d,null));};exports[_0x7597('0x6f')]=function(_0x94adcb,_0x312726,_0x3030aa){var _0x5b21d5={'raw':![],'where':{}};var _0x4d56f5={};var _0x36a1cf={'count':0x0,'rows':[]};return db[_0x7597('0x46')][_0x7597('0x70')]({'where':{'id':_0x94adcb[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x312726,null))[_0x7597('0x24')](function(_0x5e1797){if(_0x5e1797){_0x4d56f5[_0x7597('0x4b')]=_[_0x7597('0x4c')](db[_0x7597('0x6e')][_0x7597('0x47')]);_0x4d56f5['query']=_[_0x7597('0x4c')](_0x94adcb[_0x7597('0x4d')]);_0x4d56f5[_0x7597('0x4e')]=_[_0x7597('0x4f')](_0x4d56f5[_0x7597('0x4b')],_0x4d56f5[_0x7597('0x4d')]);_0x5b21d5[_0x7597('0x50')]=_[_0x7597('0x4f')](_0x4d56f5['model'],qs[_0x7597('0x51')](_0x94adcb[_0x7597('0x4d')]['fields']));_0x5b21d5[_0x7597('0x50')]=_0x5b21d5[_0x7597('0x50')][_0x7597('0x52')]?_0x5b21d5['attributes']:_0x4d56f5[_0x7597('0x4b')];if(!_0x94adcb['query'][_0x7597('0x71')](_0x7597('0x53'))){_0x5b21d5[_0x7597('0x36')]=qs['limit'](_0x94adcb[_0x7597('0x4d')][_0x7597('0x36')]);_0x5b21d5[_0x7597('0x33')]=qs['offset'](_0x94adcb[_0x7597('0x4d')]['offset']);}_0x5b21d5[_0x7597('0x54')]=qs['sort'](_0x94adcb['query']['sort']);_0x5b21d5[_0x7597('0x57')]=qs[_0x7597('0x4e')](_[_0x7597('0x72')](_0x94adcb[_0x7597('0x4d')],_0x4d56f5['filters']));_0x5b21d5['where'][_0x7597('0x6d')]=_0x5e1797['id'];if(_0x94adcb[_0x7597('0x4d')]['filter']){_0x5b21d5['where']=_[_0x7597('0x59')](_0x5b21d5[_0x7597('0x57')],{'$or':_['map'](_0x5b21d5[_0x7597('0x50')],function(_0x2102b0){var _0x142f31={};_0x142f31[_0x2102b0]={'$like':'%'+_0x94adcb[_0x7597('0x4d')][_0x7597('0x56')]+'%'};return _0x142f31;})});}_0x5b21d5=_[_0x7597('0x59')]({},_0x5b21d5,_0x94adcb['options']);return db[_0x7597('0x6e')][_0x7597('0x35')]({'where':_0x5b21d5['where']})[_0x7597('0x24')](function(_0x4b0326){_0x36a1cf[_0x7597('0x35')]=_0x4b0326;if(_0x94adcb['query']['includeAll']){_0x5b21d5[_0x7597('0x5b')]=[{'all':!![]}];}return db[_0x7597('0x6e')][_0x7597('0x5c')](_0x5b21d5);})[_0x7597('0x24')](function(_0x3155bf){_0x36a1cf[_0x7597('0x5d')]=_0x3155bf;return _0x36a1cf;});}})[_0x7597('0x24')](respondWithFilteredResult(_0x312726,_0x5b21d5))[_0x7597('0x2e')](handleError(_0x312726,null));};exports['removeDispositions']=function(_0x30e864,_0x433934,_0x1551a9){return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x30e864['params']['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x433934,null))[_0x7597('0x24')](function(_0x559b72){if(_0x559b72){return _0x559b72['removeDispositions'](_0x30e864[_0x7597('0x4d')][_0x7597('0x73')]);}})['then'](respondWithStatusCode(_0x433934,null))['catch'](handleError(_0x433934,null));};exports[_0x7597('0x74')]=function(_0x15efb8,_0x1b9fc4,_0x4c8e6c){if(_0x15efb8[_0x7597('0x62')]['id']){delete _0x15efb8[_0x7597('0x62')]['id'];}return db[_0x7597('0x46')]['find']({'where':{'id':_0x15efb8[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x1b9fc4,null))[_0x7597('0x24')](function(_0x35c61c){if(_0x35c61c){_0x15efb8[_0x7597('0x62')][_0x7597('0x6d')]=_0x35c61c['id'];return db['CannedAnswer'][_0x7597('0x61')](_0x15efb8[_0x7597('0x62')]);}})[_0x7597('0x24')](respondWithResult(_0x1b9fc4,null))['catch'](handleError(_0x1b9fc4,null));};exports['getAnswers']=function(_0x5ad2c8,_0x1f669a,_0x5590f9){var _0x5cd965={'raw':![],'where':{}};var _0x310461={};var _0x1c0061={'count':0x0,'rows':[]};return db[_0x7597('0x46')][_0x7597('0x70')]({'where':{'id':_0x5ad2c8['params']['id']}})['then'](handleEntityNotFound(_0x1f669a,null))[_0x7597('0x24')](function(_0x32b0cf){if(_0x32b0cf){_0x310461[_0x7597('0x4b')]=_[_0x7597('0x4c')](db['CannedAnswer'][_0x7597('0x47')]);_0x310461['query']=_['keys'](_0x5ad2c8['query']);_0x310461[_0x7597('0x4e')]=_[_0x7597('0x4f')](_0x310461[_0x7597('0x4b')],_0x310461[_0x7597('0x4d')]);_0x5cd965[_0x7597('0x50')]=_[_0x7597('0x4f')](_0x310461[_0x7597('0x4b')],qs[_0x7597('0x51')](_0x5ad2c8[_0x7597('0x4d')][_0x7597('0x51')]));_0x5cd965[_0x7597('0x50')]=_0x5cd965[_0x7597('0x50')][_0x7597('0x52')]?_0x5cd965[_0x7597('0x50')]:_0x310461[_0x7597('0x4b')];if(!_0x5ad2c8[_0x7597('0x4d')][_0x7597('0x71')](_0x7597('0x53'))){_0x5cd965[_0x7597('0x36')]=qs[_0x7597('0x36')](_0x5ad2c8[_0x7597('0x4d')]['limit']);_0x5cd965[_0x7597('0x33')]=qs[_0x7597('0x33')](_0x5ad2c8[_0x7597('0x4d')]['offset']);}_0x5cd965[_0x7597('0x54')]=qs['sort'](_0x5ad2c8[_0x7597('0x4d')][_0x7597('0x55')]);_0x5cd965[_0x7597('0x57')]=qs[_0x7597('0x4e')](_[_0x7597('0x72')](_0x5ad2c8[_0x7597('0x4d')],_0x310461[_0x7597('0x4e')]));_0x5cd965[_0x7597('0x57')][_0x7597('0x6d')]=_0x32b0cf['id'];if(_0x5ad2c8['query'][_0x7597('0x56')]){_0x5cd965[_0x7597('0x57')]=_[_0x7597('0x59')](_0x5cd965[_0x7597('0x57')],{'$or':_[_0x7597('0x45')](_0x5cd965[_0x7597('0x50')],function(_0x1529cf){var _0xe1b3ef={};_0xe1b3ef[_0x1529cf]={'$like':'%'+_0x5ad2c8['query']['filter']+'%'};return _0xe1b3ef;})});}_0x5cd965=_[_0x7597('0x59')]({},_0x5cd965,_0x5ad2c8[_0x7597('0x5f')]);return db['CannedAnswer'][_0x7597('0x35')]({'where':_0x5cd965[_0x7597('0x57')]})[_0x7597('0x24')](function(_0x36883f){_0x1c0061['count']=_0x36883f;if(_0x5ad2c8[_0x7597('0x4d')][_0x7597('0x5a')]){_0x5cd965[_0x7597('0x5b')]=[{'all':!![]}];}return db[_0x7597('0x75')][_0x7597('0x5c')](_0x5cd965);})[_0x7597('0x24')](function(_0x5d1b3a){_0x1c0061['rows']=_0x5d1b3a;return _0x1c0061;});}})[_0x7597('0x24')](respondWithFilteredResult(_0x1f669a,_0x5cd965))['catch'](handleError(_0x1f669a,null));};exports[_0x7597('0x76')]=function(_0x5885c7,_0x126102,_0x503b1e){return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x5885c7[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x126102,null))[_0x7597('0x24')](function(_0x3000a8){if(_0x3000a8){return _0x3000a8['removeAnswers'](_0x5885c7['query'][_0x7597('0x73')]);}})['then'](respondWithStatusCode(_0x126102,null))[_0x7597('0x2e')](handleError(_0x126102,null));};exports[_0x7597('0x77')]=function(_0x5f3117,_0xf895f3,_0x119721){var _0x22e8cd={'body':_0x5f3117[_0x7597('0x62')],'channel':_0x7597('0x78')};var _0x5e3d20=[];var _0xa00dec=[];var _0xe20630={};var _0x2e7bb0=![];return db[_0x7597('0x79')][_0x7597('0x6b')]()[_0x7597('0x24')](function(_0x1d4970){if(!_0x1d4970){throw new db['Sequelize'][(_0x7597('0x7a'))](_0x7597('0x7b'));}_0x5e3d20=_[_0x7597('0x7c')](_[_0x7597('0x4c')](_0x1d4970),[_0x7597('0x7d'),_0x7597('0x7e')]);_0xa00dec=_[_0x7597('0x7c')](_[_0x7597('0x4c')](_0x1d4970),[_0x7597('0x7d'),'updatedAt',_0x7597('0x7f'),_0x7597('0x80')]);if(_0x5f3117[_0x7597('0x62')]['id']){delete _0x5f3117[_0x7597('0x62')]['id'];}if(_[_0x7597('0x81')](_0x5f3117[_0x7597('0x62')]['from'])){throw new db['Sequelize'][(_0x7597('0x7a'))](_0x7597('0x82'));}if(_[_0x7597('0x81')](_0x5f3117[_0x7597('0x62')][_0x7597('0x62')])||_0x5f3117[_0x7597('0x62')]['body']===''){throw new db['Sequelize'][(_0x7597('0x7a'))](_0x7597('0x83'));}if(_[_0x7597('0x81')](_0x5f3117[_0x7597('0x62')]['mapKey'])){throw new db[(_0x7597('0x84'))][(_0x7597('0x7a'))](_0x7597('0x85')+_0xa00dec);}if(!_[_0x7597('0x86')](_0xa00dec,_0x5f3117[_0x7597('0x62')][_0x7597('0x87')])){throw new db[(_0x7597('0x84'))][(_0x7597('0x7a'))](_0x7597('0x88')+_0xa00dec);}_0xe20630[_0x5f3117[_0x7597('0x62')]['mapKey']]=_0x5f3117[_0x7597('0x62')][_0x7597('0x89')];})['then'](function(){return db[_0x7597('0x46')]['find']({'where':{'id':_0x5f3117['params']['id']},'include':[{'model':db[_0x7597('0x8a')],'as':_0x7597('0x8b'),'include':[{'model':db['CmContact'],'as':_0x7597('0x8c'),'where':_0xe20630,'limit':0x1,'order':[[_0x7597('0x7e'),_0x7597('0x8d')]]}]},{'model':db[_0x7597('0x8e')],'as':_0x7597('0x8f')}]});})[_0x7597('0x24')](handleEntityNotFound(_0xf895f3,null))[_0x7597('0x24')](function(_0x1c6773){if(_0x1c6773&&_0x1c6773[_0x7597('0x8b')]){_0x22e8cd[_0x7597('0x90')]=_0x1c6773;_0x22e8cd[_0x7597('0x91')]=_0x1c6773[_0x7597('0x8f')];_0x22e8cd[_0x7597('0x92')]=_0x1c6773[_0x7597('0x8b')];_0x22e8cd[_0x7597('0x91')]=_[_0x7597('0x93')](_0x22e8cd[_0x7597('0x91')],[_0x7597('0x94')],[_0x7597('0x95')]);if(_0x22e8cd['account']['Applications']){delete _0x22e8cd[_0x7597('0x90')][_0x7597('0x8f')];}if(_0x22e8cd[_0x7597('0x90')]['List']&&_0x22e8cd[_0x7597('0x90')][_0x7597('0x8b')][_0x7597('0x8c')]['length']){return _0x22e8cd[_0x7597('0x90')][_0x7597('0x8b')][_0x7597('0x8c')][0x0];}var _0x3c9be7=_[_0x7597('0x1d')](_0x5f3117['body'],{'firstName':_0x5f3117[_0x7597('0x62')][_0x7597('0x89')],'ListId':_0x1c6773['ListId']});_0x3c9be7[_0x5f3117[_0x7597('0x62')][_0x7597('0x87')]]=_0x5f3117[_0x7597('0x62')][_0x7597('0x89')];return db[_0x7597('0x79')][_0x7597('0x61')](_0x3c9be7,{'fields':_0x5e3d20,'raw':!![]});}})[_0x7597('0x24')](handleEntityNotFound(_0xf895f3,null))[_0x7597('0x24')](function(_0x233bc1){_0x22e8cd[_0x7597('0x96')]=_0x233bc1;if(_0x233bc1){var _0x471f07={'ContactId':_0x233bc1['id'],'OpenchannelAccountId':_0x5f3117[_0x7597('0x6a')]['id'],'from':(_0x233bc1[_0x7597('0x97')]||'')+'\x20'+(_0x233bc1[_0x7597('0x98')]||'')};var _0x5b5a46={'OpenchannelAccountId':_0x5f3117[_0x7597('0x6a')]['id'],'closed':![]};if(_0x5f3117[_0x7597('0x62')][_0x7597('0x99')]){_0x5b5a46[_0x7597('0x99')]=_0x5f3117[_0x7597('0x62')][_0x7597('0x99')];return db[_0x7597('0x9a')][_0x7597('0x60')]({'where':_0x5b5a46})[_0x7597('0x24')](function(_0x38a76d){if(_0x38a76d){return[_0x38a76d,![]];}_0x471f07[_0x7597('0x99')]=_0x5f3117[_0x7597('0x62')][_0x7597('0x99')];_0x471f07[_0x7597('0x9b')]=_0x5f3117[_0x7597('0x62')][_0x7597('0x9b')];return db[_0x7597('0x9a')][_0x7597('0x61')](_0x471f07)[_0x7597('0x24')](function(_0x2541e5){return[_0x2541e5,!![]];});});}else{_0x5b5a46['threadId']=null;}_0x5b5a46['ContactId']=_0x233bc1['id'];return db[_0x7597('0x9a')][_0x7597('0x60')]({'where':_0x5b5a46})[_0x7597('0x24')](function(_0x2e13f0){if(_0x2e13f0){return[_0x2e13f0,![]];}return db[_0x7597('0x9a')][_0x7597('0x61')](_0x471f07)['then'](function(_0x15022f){return[_0x15022f,!![]];});});}})['spread'](function(_0x26b0aa,_0x375839){if(_0x26b0aa){_0x2e7bb0=_0x375839;if(!_0x375839){var _0x4ca7cf={'from':(_0x22e8cd[_0x7597('0x96')]['firstName']||'')+'\x20'+(_0x22e8cd[_0x7597('0x96')][_0x7597('0x98')]||'')};if(_0x5f3117[_0x7597('0x62')][_0x7597('0x99')]&&_0x5f3117[_0x7597('0x62')]['messageId']&&_0x5f3117['body']['threadId']!=_0x5f3117['body'][_0x7597('0x9c')]){_0x4ca7cf['threadId']=_0x5f3117[_0x7597('0x62')][_0x7597('0x9c')];}return _0x26b0aa[_0x7597('0x3c')](_0x4ca7cf);}else{return _0x26b0aa;}}})['then'](function(_0xf5d1ab){_0x22e8cd['interaction']=_0xf5d1ab[_0x7597('0x64')]({'plain':!![]});_0x22e8cd[_0x7597('0x9d')]['created']=_0x2e7bb0;if(_0x22e8cd[_0x7597('0x9d')][_0x7597('0x9e')]){if(_0x22e8cd[_0x7597('0x90')][_0x7597('0x9f')]){_0x22e8cd[_0x7597('0x91')][_0x7597('0xa0')]({'id':0x0,'priority':_0x22e8cd[_0x7597('0x91')]['length']+0x1,'app':_0x7597('0xa1'),'appdata':_0x7597('0xa2'),'interval':_0x7597('0xa3')});}}return db[_0x7597('0xa4')][_0x7597('0x61')]({'body':_0x5f3117[_0x7597('0x62')][_0x7597('0x62')],'OpenchannelAccountId':_0x5f3117[_0x7597('0x6a')]['id'],'OpenchannelInteractionId':_0xf5d1ab['id'],'direction':'in','ContactId':_0x22e8cd[_0x7597('0x96')]['id'],'AttachmentId':_0x5f3117[_0x7597('0x62')][_0x7597('0xa5')]});})[_0x7597('0x24')](function(_0x5bfc4e){_0x22e8cd[_0x7597('0x2c')]=_0x5bfc4e;if(!_0x22e8cd['interaction'][_0x7597('0xa6')])return;return db[_0x7597('0xa7')]['find']({'attributes':['id',_0x7597('0x41')],'where':{'id':_0x22e8cd[_0x7597('0x9d')]['UserId']}});})['then'](function(_0x32efde){if(_0x32efde){_0x22e8cd[_0x7597('0x91')][_0x7597('0xa8')]({'id':0x0,'priority':0x0,'app':_0x7597('0xa9'),'appdata':_0x32efde[_0x7597('0x41')]+','+(_0x22e8cd['account'][_0x7597('0xaa')]||0xa),'interval':'*,*,*,*'});}if(!_0x22e8cd[_0x7597('0x9d')][_0x7597('0xab')])return;return db[_0x7597('0xac')][_0x7597('0x60')]({'attributes':['id',_0x7597('0x41')],'where':{'id':_0x22e8cd[_0x7597('0x9d')]['queueId']}});})[_0x7597('0x24')](function(_0x263ede){if(_0x263ede){_0x22e8cd[_0x7597('0x91')][_0x7597('0xa8')]({'id':0x0,'priority':0x1,'app':_0x7597('0xad'),'appdata':_0x263ede[_0x7597('0x41')]+','+(_0x22e8cd[_0x7597('0x90')][_0x7597('0xae')]||0x12c),'interval':_0x7597('0xa3')});}return respondWithRpcPromise(_0x7597('0xaf'),_0x7597('0xb0'),_0x22e8cd);})['then'](function(_0x2110c6){respondWithRpcPromise('EventManager',_0x7597('0xb1'),{'event':_0x7597('0x77'),'message':_0x2110c6},client9002);return _0x2110c6;})[_0x7597('0x24')](respondWithResult(_0xf895f3,null))[_0x7597('0x2e')](handleError(_0xf895f3,null));};exports[_0x7597('0xb2')]=function(_0x5e7d99,_0x49f06c){var _0x5970fd=_0x5e7d99[_0x7597('0x6a')]['id'];var _0x53882d=_0x5e7d99[_0x7597('0x62')];var _0x511b2a=0xc8;var _0x20c435=null;return db[_0x7597('0xb3')][_0x7597('0xb4')]({'isolationLevel':db['sequelize'][_0x7597('0xb5')][_0x7597('0xb6')][_0x7597('0xb7')]},function(_0x468880){return db[_0x7597('0x46')][_0x7597('0x70')]({'where':{'id':_0x5970fd},'transaction':_0x468880})[_0x7597('0x24')](function(_0xd8240){if(_0xd8240){return db[_0x7597('0x8e')][_0x7597('0x3d')]({'where':{'OpenchannelAccountId':_0x5970fd},'transaction':_0x468880})[_0x7597('0x24')](function(){var _0x3019f5=_[_0x7597('0x45')](_0x53882d,function(_0xe04b2e){_0xe04b2e[_0x7597('0x6d')]=_0x5970fd;return _0xe04b2e;});return db['OpenchannelApplication'][_0x7597('0xb8')](_0x3019f5,{'transaction':_0x468880});});}else{_0x511b2a=0x194;_0x20c435=[];}});})['then'](function(){if(_0x511b2a!==0x194){return db['OpenchannelApplication'][_0x7597('0xb9')]({'where':{'OpenchannelAccountId':_0x5970fd},'order':'priority'})[_0x7597('0x24')](function(_0x57082a){_0x20c435=_0x57082a;});}})[_0x7597('0x2e')](function(_0x56f8af){_0x511b2a=0x1f4;logger[_0x7597('0x2a')](_0x56f8af[_0x7597('0x40')]);if(_0x56f8af[_0x7597('0x41')]){delete _0x56f8af[_0x7597('0x41')];}_0x20c435=_0x56f8af;})['finally'](function(){if(_0x20c435===null){_0x49f06c[_0x7597('0x2f')](_0x511b2a);}else{if(_0x511b2a===0x1f4){_0x49f06c[_0x7597('0x30')](_0x511b2a)[_0x7597('0x42')](_0x20c435);}else{_0x49f06c[_0x7597('0x30')](_0x511b2a)['json'](_0x20c435);}}});};exports['getApplications']=function(_0x2938e9,_0x3f727b,_0x1835e2){var _0x2bf1b1={};var _0x85bea3={};var _0x2e6c3f;var _0x43a394;return db[_0x7597('0x46')]['findOne']({'where':{'id':_0x2938e9[_0x7597('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3f727b,null))[_0x7597('0x24')](function(_0x56fe45){if(_0x56fe45){_0x2e6c3f=_0x56fe45;_0x85bea3[_0x7597('0x4b')]=_[_0x7597('0x4c')](db[_0x7597('0x8e')][_0x7597('0x47')]);_0x85bea3[_0x7597('0x4d')]=_[_0x7597('0x4c')](_0x2938e9[_0x7597('0x4d')]);_0x85bea3['filters']=_[_0x7597('0x4f')](_0x85bea3['model'],_0x85bea3['query']);_0x2bf1b1[_0x7597('0x50')]=_[_0x7597('0x4f')](_0x85bea3['model'],qs[_0x7597('0x51')](_0x2938e9[_0x7597('0x4d')][_0x7597('0x51')]));_0x2bf1b1['attributes']=_0x2bf1b1['attributes'][_0x7597('0x52')]?_0x2bf1b1[_0x7597('0x50')]:_0x85bea3[_0x7597('0x4b')];_0x2bf1b1[_0x7597('0x54')]=qs[_0x7597('0x55')](_0x2938e9[_0x7597('0x4d')][_0x7597('0x55')]);_0x2bf1b1[_0x7597('0x57')]=qs[_0x7597('0x4e')](_[_0x7597('0x72')](_0x2938e9['query'],_0x85bea3[_0x7597('0x4e')]));if(_0x2938e9[_0x7597('0x4d')][_0x7597('0x56')]){_0x2bf1b1[_0x7597('0x57')]=_[_0x7597('0x59')](_0x2bf1b1[_0x7597('0x57')],{'$or':_['map'](_0x2bf1b1[_0x7597('0x50')],function(_0x4c9498){var _0x49cef6={};_0x49cef6[_0x4c9498]={'$like':'%'+_0x2938e9[_0x7597('0x4d')][_0x7597('0x56')]+'%'};return _0x49cef6;})});}_0x2bf1b1=_[_0x7597('0x59')]({},_0x2bf1b1,_0x2938e9[_0x7597('0x5f')]);return _0x2e6c3f[_0x7597('0xba')](_0x2bf1b1);}})[_0x7597('0x24')](function(_0x40119f){if(_0x40119f){_0x43a394=_0x40119f[_0x7597('0x52')];if(!_0x2938e9['query'][_0x7597('0x71')](_0x7597('0x53'))){_0x2bf1b1[_0x7597('0x36')]=qs[_0x7597('0x36')](_0x2938e9[_0x7597('0x4d')]['limit']);_0x2bf1b1[_0x7597('0x33')]=qs['offset'](_0x2938e9[_0x7597('0x4d')][_0x7597('0x33')]);}return _0x2e6c3f[_0x7597('0xba')](_0x2bf1b1);}})['then'](function(_0x4aa85c){if(_0x4aa85c){return _0x4aa85c?{'count':_0x43a394,'rows':_0x4aa85c}:null;}})[_0x7597('0x24')](respondWithResult(_0x3f727b,null))['catch'](handleError(_0x3f727b,null));};exports[_0x7597('0xbb')]=function(_0x18e464,_0xfa2a2b,_0x2a3d94){var _0x2ca47a={'raw':![],'where':{}};var _0x2cd4c2={};var _0x220b66={'count':0x0,'rows':[]};return db[_0x7597('0x46')]['findOne']({'where':{'id':_0x18e464[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0xfa2a2b,null))[_0x7597('0x24')](function(_0x4afe25){if(_0x4afe25){_0x2cd4c2[_0x7597('0x4b')]=_[_0x7597('0x4c')](db[_0x7597('0x9a')][_0x7597('0x47')]);_0x2cd4c2[_0x7597('0x4d')]=_[_0x7597('0x4c')](_0x18e464['query']);_0x2cd4c2[_0x7597('0x4e')]=_['intersection'](_0x2cd4c2[_0x7597('0x4b')],_0x2cd4c2[_0x7597('0x4d')]);_0x2ca47a['attributes']=_[_0x7597('0x4f')](_0x2cd4c2[_0x7597('0x4b')],qs[_0x7597('0x51')](_0x18e464[_0x7597('0x4d')][_0x7597('0x51')]));_0x2ca47a[_0x7597('0x50')]=_0x2ca47a['attributes'][_0x7597('0x52')]?_0x2ca47a[_0x7597('0x50')]:_0x2cd4c2['model'];if(!_0x18e464[_0x7597('0x4d')][_0x7597('0x71')](_0x7597('0x53'))){_0x2ca47a['limit']=qs[_0x7597('0x36')](_0x18e464[_0x7597('0x4d')][_0x7597('0x36')]);_0x2ca47a[_0x7597('0x33')]=qs[_0x7597('0x33')](_0x18e464['query'][_0x7597('0x33')]);}_0x2ca47a[_0x7597('0x54')]=qs['sort'](_0x18e464[_0x7597('0x4d')][_0x7597('0x55')]);_0x2ca47a['where']=qs[_0x7597('0x4e')](_[_0x7597('0x72')](_0x18e464[_0x7597('0x4d')],_0x2cd4c2[_0x7597('0x4e')]));_0x2ca47a['where'][_0x7597('0x6d')]=_0x4afe25['id'];if(_0x18e464[_0x7597('0x4d')][_0x7597('0x56')]){_0x2ca47a['where']=_[_0x7597('0x59')](_0x2ca47a[_0x7597('0x57')],{'$or':_['map'](_0x2ca47a[_0x7597('0x50')],function(_0x244446){var _0x9c666d={};_0x9c666d[_0x244446]={'$like':'%'+_0x18e464[_0x7597('0x4d')]['filter']+'%'};return _0x9c666d;})});}_0x2ca47a=_[_0x7597('0x59')]({},_0x2ca47a,_0x18e464['options']);return db[_0x7597('0x9a')][_0x7597('0x35')]({'where':_0x2ca47a[_0x7597('0x57')]})[_0x7597('0x24')](function(_0x3bd094){_0x220b66[_0x7597('0x35')]=_0x3bd094;if(_0x18e464[_0x7597('0x4d')]['includeAll']){_0x2ca47a['include']=[{'model':db[_0x7597('0x79')],'as':_0x7597('0xbc'),'required':![]},{'model':db[_0x7597('0xa7')],'as':'Owner','attributes':['name',_0x7597('0xbd'),'internal'],'required':![]},{'model':db[_0x7597('0xbe')],'as':'Tags','attributes':['id',_0x7597('0x41'),_0x7597('0xbf')],'where':_0x18e464[_0x7597('0x4d')][_0x7597('0xc0')]?{'id':_0x18e464['query']['tag']}:undefined,'required':_0x18e464[_0x7597('0x4d')][_0x7597('0xc0')]?!![]:![]}];}return db[_0x7597('0x9a')][_0x7597('0x5c')](_0x2ca47a);})[_0x7597('0x24')](function(_0x4c8416){_0x220b66[_0x7597('0x5d')]=_0x4c8416;return _0x220b66;});}})[_0x7597('0x24')](respondWithFilteredResult(_0xfa2a2b,_0x2ca47a))[_0x7597('0x2e')](handleError(_0xfa2a2b,null));};exports[_0x7597('0xc1')]=function(_0x23a7fc,_0x22ba26,_0x30bfb8){return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x23a7fc['params']['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x22ba26,null))[_0x7597('0x24')](function(_0x3e047e){if(_0x3e047e){return _0x3e047e['addAgents'](_0x23a7fc[_0x7597('0x62')][_0x7597('0x73')],_['omit'](_0x23a7fc[_0x7597('0x62')],[_0x7597('0x73'),'id'])||{})[_0x7597('0xc2')](function(_0x325ed1){for(var _0x2225a4=0x0;_0x2225a4<_0x23a7fc[_0x7597('0x62')][_0x7597('0x73')]['length'];_0x2225a4+=0x1){socket[_0x7597('0xc3')](_0x7597('0xc4'),{'UserId':Number(_0x23a7fc[_0x7597('0x62')]['ids'][_0x2225a4]),'OpenchannelAccountId':Number(_0x23a7fc[_0x7597('0x6a')]['id'])});}return _0x325ed1;});}})['then'](respondWithResult(_0x22ba26,null))[_0x7597('0x2e')](handleError(_0x22ba26,null));};exports['removeAgents']=function(_0x514a7f,_0x1cf0d1,_0xe17321){return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x514a7f[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x1cf0d1,null))['then'](function(_0x267e05){if(_0x267e05){return _0x267e05[_0x7597('0xc5')](_0x514a7f['query'][_0x7597('0x73')])[_0x7597('0x24')](function(){if(_[_0x7597('0xc6')](_0x514a7f[_0x7597('0x4d')][_0x7597('0x73')])){for(var _0x527ca8=0x0;_0x527ca8<_0x514a7f[_0x7597('0x4d')]['ids'][_0x7597('0x52')];_0x527ca8+=0x1){socket[_0x7597('0xc3')](_0x7597('0xc7'),{'UserId':Number(_0x514a7f[_0x7597('0x4d')]['ids'][_0x527ca8]),'OpenchannelAccountId':Number(_0x514a7f[_0x7597('0x6a')]['id'])});}}else{socket[_0x7597('0xc3')](_0x7597('0xc7'),{'UserId':Number(_0x514a7f[_0x7597('0x4d')]['ids']),'OpenchannelAccountId':Number(_0x514a7f[_0x7597('0x6a')]['id'])});}});}})[_0x7597('0x24')](respondWithStatusCode(_0x1cf0d1,null))[_0x7597('0x2e')](handleError(_0x1cf0d1,null));};exports[_0x7597('0xc8')]=function(_0x1396af,_0x829399,_0x3d68b7){var _0x2eeb2f={};var _0x5192a1={};var _0x551595;var _0x5d0867;return db['OpenchannelAccount'][_0x7597('0x70')]({'where':{'id':_0x1396af[_0x7597('0x6a')]['id']}})[_0x7597('0x24')](handleEntityNotFound(_0x829399,null))[_0x7597('0x24')](function(_0x3e8b13){if(_0x3e8b13){_0x551595=_0x3e8b13;_0x5192a1[_0x7597('0x4b')]=_[_0x7597('0x4c')](db[_0x7597('0xa7')][_0x7597('0x47')]);_0x5192a1[_0x7597('0x4d')]=_[_0x7597('0x4c')](_0x1396af['query']);_0x5192a1[_0x7597('0x4e')]=_['intersection'](_0x5192a1[_0x7597('0x4b')],_0x5192a1['query']);_0x2eeb2f[_0x7597('0x50')]=_[_0x7597('0x4f')](_0x5192a1[_0x7597('0x4b')],qs[_0x7597('0x51')](_0x1396af[_0x7597('0x4d')][_0x7597('0x51')]));_0x2eeb2f['attributes']=_0x2eeb2f[_0x7597('0x50')][_0x7597('0x52')]?_0x2eeb2f[_0x7597('0x50')]:_0x5192a1[_0x7597('0x4b')];_0x2eeb2f['order']=qs[_0x7597('0x55')](_0x1396af[_0x7597('0x4d')][_0x7597('0x55')]);_0x2eeb2f[_0x7597('0x57')]=qs[_0x7597('0x4e')](_[_0x7597('0x72')](_0x1396af[_0x7597('0x4d')],_0x5192a1[_0x7597('0x4e')]));if(_0x1396af[_0x7597('0x4d')]['filter']){_0x2eeb2f['where']=_[_0x7597('0x59')](_0x2eeb2f[_0x7597('0x57')],{'$or':_[_0x7597('0x45')](_0x2eeb2f['attributes'],function(_0xecb6d6){var _0x15cde8={};_0x15cde8[_0xecb6d6]={'$like':'%'+_0x1396af['query']['filter']+'%'};return _0x15cde8;})});}_0x2eeb2f=_['merge']({},_0x2eeb2f,_0x1396af[_0x7597('0x5f')]);return _0x551595['getAgents'](_0x2eeb2f);}})[_0x7597('0x24')](function(_0xbb6ec7){if(_0xbb6ec7){_0x5d0867=_0xbb6ec7[_0x7597('0x52')];if(!_0x1396af['query'][_0x7597('0x71')](_0x7597('0x53'))){_0x2eeb2f[_0x7597('0x36')]=qs[_0x7597('0x36')](_0x1396af[_0x7597('0x4d')][_0x7597('0x36')]);_0x2eeb2f[_0x7597('0x33')]=qs[_0x7597('0x33')](_0x1396af[_0x7597('0x4d')][_0x7597('0x33')]);}return _0x551595[_0x7597('0xc8')](_0x2eeb2f);}})['then'](function(_0x2cf221){if(_0x2cf221){return _0x2cf221?{'count':_0x5d0867,'rows':_0x2cf221}:null;}})[_0x7597('0x24')](respondWithResult(_0x829399,null))[_0x7597('0x2e')](handleError(_0x829399,null));};exports[_0x7597('0x42')]=function(_0xbdf6d4,_0x109a9a,_0x26f6b2){var _0x198b6d,_0x443fa1,_0x19d827;if(_[_0x7597('0x81')](_0xbdf6d4[_0x7597('0x62')][_0x7597('0x62')])||_0xbdf6d4[_0x7597('0x62')][_0x7597('0x62')]===''){throw new db[(_0x7597('0x84'))][(_0x7597('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xbdf6d4[_0x7597('0x62')]['to'])){}_0x198b6d=_0xbdf6d4[_0x7597('0x62')]['to'];return db['OpenchannelAccount'][_0x7597('0x70')]({'where':{'id':_0xbdf6d4[_0x7597('0x6a')]['id']}})['then'](handleEntityNotFound(_0x109a9a,null))[_0x7597('0x24')](function(_0x2e8766){if(_0x2e8766){return db[_0x7597('0x46')][_0x7597('0x60')]({'where':{'id':_0x2e8766['id']},'include':[{'model':db['CmList'],'as':_0x7597('0x8b'),'include':[{'model':db[_0x7597('0x79')],'as':'Contacts','where':{[_0x2e8766['mapKey']]:_0x198b6d},'limit':0x1,'order':[[_0x7597('0x7e'),_0x7597('0x8d')]]}]}]})[_0x7597('0x24')](handleEntityNotFound(_0x109a9a,null))[_0x7597('0x24')](function(_0x1782a5){if(_0x1782a5&&_0x1782a5[_0x7597('0x8b')]){_0x443fa1=_0x1782a5[_0x7597('0x64')]({'plain':!![]});if(_0x443fa1[_0x7597('0x8b')]&&_0x443fa1[_0x7597('0x8b')][_0x7597('0x8c')][_0x7597('0x52')]){return _0x443fa1['List'][_0x7597('0x8c')][0x0];}return db['CmContact'][_0x7597('0x61')](_[_0x7597('0x1d')](_0xbdf6d4['body'],{'firstName':_0x198b6d,[_0x1782a5[_0x7597('0x87')]]:_0x198b6d,'phone':_0x198b6d,'ListId':_0x443fa1[_0x7597('0x80')]}));}})[_0x7597('0x24')](handleEntityNotFound(_0x109a9a,null))['then'](function(_0x34277c){if(_0x34277c){_0x19d827=_0x34277c;return db[_0x7597('0x9a')]['find']({'where':{'ContactId':_0x19d827['id'],'closed':![],'OpenchannelAccountId':_0x443fa1['id']}})[_0x7597('0x24')](function(_0x4bec1f){if(_0x4bec1f){return[_0x4bec1f,![]];}return db[_0x7597('0x9a')]['create']({'UserId':_0xbdf6d4[_0x7597('0x63')]['id'],'ContactId':_0x19d827['id'],'OpenchannelAccountId':_0x443fa1['id'],'lastMsgDirection':_0x7597('0xc9'),'firstMsgDirection':_0x7597('0xc9'),'Messages':[_[_0x7597('0x59')](_0xbdf6d4[_0x7597('0x62')],{'read':![],'body':_0xbdf6d4['body'][_0x7597('0x62')],'OpenchannelAccountId':_0x443fa1['id'],'UserId':_0xbdf6d4[_0x7597('0x63')]['id'],'ContactId':_0x19d827['id']})]},{'include':[{'model':db[_0x7597('0xa4')],'as':'Messages'}]})['then'](function(_0x4cdac2){return[_0x4cdac2,!![]];});});}})[_0x7597('0xc2')](function(_0x449493,_0x9650f4){if(_0x9650f4){return _0x449493;}return db[_0x7597('0xa4')][_0x7597('0x61')](_[_0x7597('0x59')](_0xbdf6d4[_0x7597('0x62')],{'read':![],'body':_0xbdf6d4[_0x7597('0x62')][_0x7597('0x62')],'OpenchannelAccountId':_0x443fa1['id'],'OpenchannelInteractionId':_0x449493['id'],'UserId':_0xbdf6d4[_0x7597('0x63')]['id'],'ContactId':_0x19d827['id']}))[_0x7597('0x24')](function(_0x105379){_0x449493[_0x7597('0xca')][_0x7597('0xcb')]=[];_0x449493[_0x7597('0xca')][_0x7597('0xcb')][_0x7597('0xa0')](_0x105379[_0x7597('0xca')]);return _0x449493;});});}})[_0x7597('0x24')](respondWithResult(_0x109a9a,null))[_0x7597('0x2e')](handleError(_0x109a9a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ff1f545..9a9b80a 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a26e7,_0x232272){var _0x13c81b=function(_0x15c69f){while(--_0x15c69f){_0x4a26e7['push'](_0x4a26e7['shift']());}};_0x13c81b(++_0x232272);}(_0x750a,0x140));var _0xa750=function(_0x48d388,_0x134805){_0x48d388=_0x48d388-0x0;var _0x5beafd=_0x750a[_0x48d388];return _0x5beafd;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2750=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x5aa97c,_0x29f366){var _0x220670=function(_0x53113e){while(--_0x53113e){_0x5aa97c['push'](_0x5aa97c['shift']());}};_0x220670(++_0x29f366);}(_0x2750,0x13b));var _0x0275=function(_0x4852ad,_0x5d032d){_0x4852ad=_0x4852ad-0x0;var _0x2de87e=_0x2750[_0x4852ad];return _0x2de87e;};'use strict';var EventEmitter=require(_0x0275('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x0275('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0275('0x2')](0x0);var events={'afterCreate':_0x0275('0x3'),'afterUpdate':_0x0275('0x4'),'afterDestroy':_0x0275('0x5')};function emitEvent(_0x41ec06){return function(_0x20273d,_0x4960,_0x3d0c9c){OpenchannelAccountEvents[_0x0275('0x6')](_0x41ec06+':'+_0x20273d['id'],_0x20273d);OpenchannelAccountEvents['emit'](_0x41ec06,_0x20273d);_0x3d0c9c(null);};}for(var e in events){if(events[_0x0275('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0275('0x8')](e,emitEvent(event));}}module[_0x0275('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 422a204..ba36d62 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(_0x21e822,_0x5482f1){var _0x543380=function(_0x90ac60){while(--_0x90ac60){_0x21e822['push'](_0x21e822['shift']());}};_0x543380(++_0x5482f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x50e337,_0x30d38d){var _0x34e375=function(_0x4f0106){while(--_0x4f0106){_0x50e337['push'](_0x50e337['shift']());}};_0x34e375(++_0x30d38d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 1bce82c..541adc0 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 _0x065e=['socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0x065e,0x1a7));var _0xe065=function(_0x3a62d3,_0x4fd275){_0x3a62d3=_0x3a62d3-0x0;var _0x138eae=_0x065e[_0x3a62d3];return _0x138eae;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});config[_0xe065('0x8')]=_['defaults'](config[_0xe065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x9'))(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xa'))[_0xe065('0xb')](socket);function respondWithRpcPromise(_0x85001e,_0x531ebd,_0x43827c){return new BPromise(function(_0x6c9117,_0x3f59d3){return client[_0xe065('0xc')](_0x85001e,_0x43827c)[_0xe065('0xd')](function(_0x2a6a6e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0xe065('0xe'));logger[_0xe065('0xf')](_0xe065('0x10'),_0x531ebd,'request\x20sent',JSON[_0xe065('0x11')](_0x2a6a6e));if(_0x2a6a6e[_0xe065('0x12')]){if(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);return _0x3f59d3(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}logger[_0xe065('0x12')](_0xe065('0x15'),_0x531ebd,_0x2a6a6e[_0xe065('0x12')]['message']);return _0x6c9117(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}else{logger['info'](_0xe065('0x15'),_0x531ebd,_0xe065('0xe'));_0x6c9117(_0x2a6a6e[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x302adf){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x302adf);_0x3f59d3(_0x302adf);});});} \ No newline at end of file +var _0x80df=['OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','error','code'];(function(_0x3914ac,_0x16321c){var _0x14faf8=function(_0x2d67ec){while(--_0x2d67ec){_0x3914ac['push'](_0x3914ac['shift']());}};_0x14faf8(++_0x16321c);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});config[_0xf80d('0xd')]=_['defaults'](config[_0xf80d('0xd')],{'host':_0xf80d('0xe'),'port':0x18eb});var socket=require(_0xf80d('0xf'))(new Redis(config[_0xf80d('0xd')]));require(_0xf80d('0x10'))[_0xf80d('0x11')](socket);function respondWithRpcPromise(_0x41595f,_0x45d290,_0x2fddc2){return new BPromise(function(_0x2ef5d1,_0x30df95){return client[_0xf80d('0x12')](_0x41595f,_0x2fddc2)[_0xf80d('0x13')](function(_0x29bd2c){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'));logger[_0xf80d('0x15')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45d290,_0xf80d('0x14'),JSON['stringify'](_0x29bd2c));if(_0x29bd2c[_0xf80d('0x16')]){if(_0x29bd2c['error'][_0xf80d('0x17')]===0x1f4){logger['error'](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x30df95(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}logger[_0xf80d('0x16')](_0xf80d('0x18'),_0x45d290,_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);return _0x2ef5d1(_0x29bd2c[_0xf80d('0x16')][_0xf80d('0x19')]);}else{logger[_0xf80d('0x1a')](_0xf80d('0x18'),_0x45d290,_0xf80d('0x14'));_0x2ef5d1(_0x29bd2c[_0xf80d('0x1b')][_0xf80d('0x19')]);}})[_0xf80d('0x1c')](function(_0x124174){logger[_0xf80d('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x45d290,_0x124174);_0x30df95(_0x124174);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7e8ea6c..c8a2aee 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 _0x5e14=['emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x45e1('0x0'));var events=[_0x45e1('0x1'),_0x45e1('0x2'),_0x45e1('0x3')];function createListener(_0x12c02b,_0x1af150){return function(_0xfb5d5e){_0x1af150[_0x45e1('0x4')](_0x12c02b,_0xfb5d5e);};}function removeListener(_0x1f8823,_0x33ce6c){return function(){OpenchannelAccountEvents[_0x45e1('0x5')](_0x1f8823,_0x33ce6c);};}exports[_0x45e1('0x6')]=function(_0xc25c34){for(var _0x41b13c=0x0,_0x26ee2e=events[_0x45e1('0x7')];_0x41b13c<_0x26ee2e;_0x41b13c++){var _0x111f7c=events[_0x41b13c];var _0x4062de=createListener(_0x45e1('0x8')+_0x111f7c,_0xc25c34);OpenchannelAccountEvents['on'](_0x111f7c,_0x4062de);}}; \ No newline at end of file +var _0x3164=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','register'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x3164,0x182));var _0x4316=function(_0x1824c9,_0x475d83){_0x1824c9=_0x1824c9-0x0;var _0x3ad7e9=_0x3164[_0x1824c9];return _0x3ad7e9;};'use strict';var OpenchannelAccountEvents=require(_0x4316('0x0'));var events=[_0x4316('0x1'),_0x4316('0x2'),_0x4316('0x3')];function createListener(_0x169d29,_0x588480){return function(_0x2534d3){_0x588480[_0x4316('0x4')](_0x169d29,_0x2534d3);};}function removeListener(_0x1235d9,_0x56124c){return function(){OpenchannelAccountEvents['removeListener'](_0x1235d9,_0x56124c);};}exports[_0x4316('0x5')]=function(_0x25827b){for(var _0xf88ba4=0x0,_0x29c3c1=events[_0x4316('0x6')];_0xf88ba4<_0x29c3c1;_0xf88ba4++){var _0x473cd2=events[_0xf88ba4];var _0x1bcd38=createListener(_0x4316('0x7')+_0x473cd2,_0x25827b);OpenchannelAccountEvents['on'](_0x473cd2,_0x1bcd38);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ec46755..2b3bc39 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 _0x4461=['get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xd623aa,_0x59c1a8){var _0x5cb726=function(_0x3b79d6){while(--_0x3b79d6){_0xd623aa['push'](_0xd623aa['shift']());}};_0x5cb726(++_0x59c1a8);}(_0x4461,0x13c));var _0x1446=function(_0x78f943,_0x58e155){_0x78f943=_0x78f943-0x0;var _0x51255a=_0x4461[_0x78f943];return _0x51255a;};'use strict';var multer=require(_0x1446('0x0'));var util=require(_0x1446('0x1'));var path=require(_0x1446('0x2'));var timeout=require('connect-timeout');var express=require(_0x1446('0x3'));var router=express[_0x1446('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1446('0x5'));var interaction=require(_0x1446('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x1446('0x7')]('/',auth['isAuthenticated'](),controller[_0x1446('0x8')]);router[_0x1446('0x7')](_0x1446('0x9'),auth[_0x1446('0xa')](),controller['show']);router[_0x1446('0xb')]('/',auth['isAuthenticated'](),controller[_0x1446('0xc')]);router[_0x1446('0xd')](_0x1446('0x9'),auth[_0x1446('0xa')](),controller[_0x1446('0xe')]);router[_0x1446('0xf')]('/:id',auth[_0x1446('0xa')](),controller[_0x1446('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf006=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','path','Router'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xf006,0x1c0));var _0x6f00=function(_0x1ab7ad,_0x5f403d){_0x1ab7ad=_0x1ab7ad-0x0;var _0x307602=_0xf006[_0x1ab7ad];return _0x307602;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f00('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f00('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x6f00('0x2'));var interaction=require(_0x6f00('0x3'));var config=require(_0x6f00('0x4'));var controller=require('./openchannelApplication.controller');router[_0x6f00('0x5')]('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0x7')]);router[_0x6f00('0x5')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0x9')]);router['post']('/',auth[_0x6f00('0x6')](),controller[_0x6f00('0xa')]);router[_0x6f00('0xb')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller[_0x6f00('0xc')]);router[_0x6f00('0xd')](_0x6f00('0x8'),auth[_0x6f00('0x6')](),controller['destroy']);module[_0x6f00('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a08c398..10f4514 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 _0xac8b=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x1706eb,_0xe07024){var _0x267834=function(_0x22abd9){while(--_0x22abd9){_0x1706eb['push'](_0x1706eb['shift']());}};_0x267834(++_0xe07024);}(_0xac8b,0x9e));var _0xbac8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xac8b[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module[_0xbac8('0x0')]={'priority':{'type':Sequelize[_0xbac8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbac8('0x2')],'allowNull':![],'defaultValue':_0xbac8('0x3')},'appdata':{'type':Sequelize[_0xbac8('0x4')]()},'description':{'type':Sequelize[_0xbac8('0x2')]},'interval':{'type':Sequelize[_0xbac8('0x2')],'defaultValue':_0xbac8('0x5')}}; \ No newline at end of file +var _0x939e=['exports','STRING','noop'];(function(_0x9b9a89,_0x1e1797){var _0x391ce2=function(_0x41f2ad){while(--_0x41f2ad){_0x9b9a89['push'](_0x9b9a89['shift']());}};_0x391ce2(++_0x1e1797);}(_0x939e,0x111));var _0xe939=function(_0x13ab7f,_0x35c4f9){_0x13ab7f=_0x13ab7f-0x0;var _0x28c68e=_0x939e[_0x13ab7f];return _0x28c68e;};'use strict';var Sequelize=require('sequelize');module[_0xe939('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe939('0x1')],'allowNull':![],'defaultValue':_0xe939('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe939('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index cccae30..4bc9bfa 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 _0x3f84=['show','includeAll','options','create','body','find','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','include','rows','catch'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x3f84,0x1eb));var _0x43f8=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x3f84[_0x45fc6a];return _0x14bcfd;};'use strict';var emlformat=require(_0x43f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x43f8('0x1'));var rp=require(_0x43f8('0x2'));var moment=require(_0x43f8('0x3'));var BPromise=require(_0x43f8('0x4'));var Mustache=require('mustache');var util=require(_0x43f8('0x5'));var path=require('path');var sox=require(_0x43f8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43f8('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43f8('0x8'));var deskjs=require(_0x43f8('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x43f8('0xa'));var Redis=require(_0x43f8('0xb'));var authService=require(_0x43f8('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x43f8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43f8('0xe'));var utils=require(_0x43f8('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x43f8('0x10'))['db'];function respondWithStatusCode(_0x3c0453,_0x543cbb){_0x543cbb=_0x543cbb||0xcc;return function(_0x4453eb){if(_0x4453eb){return _0x3c0453['sendStatus'](_0x543cbb);}return _0x3c0453[_0x43f8('0x11')](_0x543cbb)[_0x43f8('0x12')]();};}function respondWithResult(_0x5e2339,_0x5c8fc4){_0x5c8fc4=_0x5c8fc4||0xc8;return function(_0x399f20){if(_0x399f20){return _0x5e2339[_0x43f8('0x11')](_0x5c8fc4)[_0x43f8('0x13')](_0x399f20);}};}function respondWithFilteredResult(_0x49acca,_0x45d912){return function(_0x2a4464){if(_0x2a4464){var _0x5f371f=typeof _0x45d912[_0x43f8('0x14')]===_0x43f8('0x15')&&typeof _0x45d912[_0x43f8('0x16')]===_0x43f8('0x15');var _0x3322f4=_0x2a4464[_0x43f8('0x17')];var _0x53701e=_0x5f371f?0x0:_0x45d912['offset'];var _0x4bd4d2=_0x5f371f?_0x2a4464[_0x43f8('0x17')]:_0x45d912[_0x43f8('0x14')]+_0x45d912['limit'];var _0x53f500;if(_0x4bd4d2>=_0x3322f4){_0x4bd4d2=_0x3322f4;_0x53f500=0xc8;}else{_0x53f500=0xce;}_0x49acca[_0x43f8('0x11')](_0x53f500);return _0x49acca[_0x43f8('0x18')](_0x43f8('0x19'),_0x53701e+'-'+_0x4bd4d2+'/'+_0x3322f4)[_0x43f8('0x13')](_0x2a4464);}return null;};}function patchUpdates(_0x5234fc){return function(_0x301a9f){try{jsonpatch[_0x43f8('0x1a')](_0x301a9f,_0x5234fc,!![]);}catch(_0x58504c){return BPromise[_0x43f8('0x1b')](_0x58504c);}return _0x301a9f[_0x43f8('0x1c')]();};}function saveUpdates(_0x55cafb,_0x376b5a){return function(_0x560cbc){if(_0x560cbc){return _0x560cbc[_0x43f8('0x1d')](_0x55cafb)['then'](function(_0x3e5056){return _0x3e5056;});}return null;};}function removeEntity(_0x26c01b,_0x597e2f){return function(_0x2e5a34){if(_0x2e5a34){return _0x2e5a34['destroy']()[_0x43f8('0x1e')](function(){_0x26c01b[_0x43f8('0x11')](0xcc)[_0x43f8('0x12')]();});}};}function handleEntityNotFound(_0x3da717,_0x40d3f4){return function(_0x53ad77){if(!_0x53ad77){_0x3da717[_0x43f8('0x1f')](0x194);}return _0x53ad77;};}function handleError(_0x49c90e,_0x453a3a){_0x453a3a=_0x453a3a||0x1f4;return function(_0x202c7d){logger[_0x43f8('0x20')](_0x202c7d[_0x43f8('0x21')]);if(_0x202c7d[_0x43f8('0x22')]){delete _0x202c7d[_0x43f8('0x22')];}_0x49c90e[_0x43f8('0x11')](_0x453a3a)[_0x43f8('0x23')](_0x202c7d);};}exports[_0x43f8('0x24')]=function(_0x145c1a,_0x528568){var _0x37535a={},_0x3b80f4={},_0x7fc979={'count':0x0,'rows':[]};var _0x15c2ee=_[_0x43f8('0x25')](db[_0x43f8('0x26')]['rawAttributes'],function(_0x482bff){return{'name':_0x482bff[_0x43f8('0x27')],'type':_0x482bff[_0x43f8('0x28')][_0x43f8('0x29')]};});_0x3b80f4['model']=_[_0x43f8('0x25')](_0x15c2ee,'name');_0x3b80f4[_0x43f8('0x2a')]=_[_0x43f8('0x2b')](_0x145c1a[_0x43f8('0x2a')]);_0x3b80f4[_0x43f8('0x2c')]=_[_0x43f8('0x2d')](_0x3b80f4[_0x43f8('0x2e')],_0x3b80f4[_0x43f8('0x2a')]);_0x37535a[_0x43f8('0x2f')]=_[_0x43f8('0x2d')](_0x3b80f4[_0x43f8('0x2e')],qs[_0x43f8('0x30')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x30')]));_0x37535a[_0x43f8('0x2f')]=_0x37535a['attributes'][_0x43f8('0x31')]?_0x37535a['attributes']:_0x3b80f4[_0x43f8('0x2e')];if(!_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x32')](_0x43f8('0x33'))){_0x37535a[_0x43f8('0x16')]=qs[_0x43f8('0x16')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x16')]);_0x37535a[_0x43f8('0x14')]=qs[_0x43f8('0x14')](_0x145c1a[_0x43f8('0x2a')]['offset']);}_0x37535a[_0x43f8('0x34')]=qs[_0x43f8('0x35')](_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x35')]);_0x37535a[_0x43f8('0x36')]=qs[_0x43f8('0x2c')](_['pick'](_0x145c1a['query'],_0x3b80f4[_0x43f8('0x2c')]),_0x15c2ee);if(_0x145c1a[_0x43f8('0x2a')]['filter']){_0x37535a[_0x43f8('0x36')]=_['merge'](_0x37535a[_0x43f8('0x36')],{'$or':_[_0x43f8('0x25')](_0x15c2ee,function(_0x1b22c7){if(_0x1b22c7[_0x43f8('0x28')]!==_0x43f8('0x37')){var _0x29c8d3={};_0x29c8d3[_0x1b22c7[_0x43f8('0x22')]]={'$like':'%'+_0x145c1a[_0x43f8('0x2a')][_0x43f8('0x38')]+'%'};return _0x29c8d3;}})});}_0x37535a=_[_0x43f8('0x39')]({},_0x37535a,_0x145c1a['options']);var _0x595c4c={'where':_0x37535a['where']};return db[_0x43f8('0x26')]['count'](_0x595c4c)[_0x43f8('0x1e')](function(_0x10627c){_0x7fc979[_0x43f8('0x17')]=_0x10627c;if(_0x145c1a[_0x43f8('0x2a')]['includeAll']){_0x37535a[_0x43f8('0x3a')]=[{'all':!![]}];}return db[_0x43f8('0x26')]['findAll'](_0x37535a);})['then'](function(_0x3639e0){_0x7fc979[_0x43f8('0x3b')]=_0x3639e0;return _0x7fc979;})[_0x43f8('0x1e')](respondWithFilteredResult(_0x528568,_0x37535a))[_0x43f8('0x3c')](handleError(_0x528568,null));};exports[_0x43f8('0x3d')]=function(_0x483cb8,_0x2fa327){var _0x3fa2f3={'raw':!![],'where':{'id':_0x483cb8['params']['id']}},_0x5e795d={};_0x5e795d['model']=_['keys'](db[_0x43f8('0x26')]['rawAttributes']);_0x5e795d[_0x43f8('0x2a')]=_[_0x43f8('0x2b')](_0x483cb8['query']);_0x5e795d[_0x43f8('0x2c')]=_[_0x43f8('0x2d')](_0x5e795d[_0x43f8('0x2e')],_0x5e795d[_0x43f8('0x2a')]);_0x3fa2f3[_0x43f8('0x2f')]=_[_0x43f8('0x2d')](_0x5e795d[_0x43f8('0x2e')],qs[_0x43f8('0x30')](_0x483cb8['query'][_0x43f8('0x30')]));_0x3fa2f3['attributes']=_0x3fa2f3[_0x43f8('0x2f')]['length']?_0x3fa2f3['attributes']:_0x5e795d[_0x43f8('0x2e')];if(_0x483cb8[_0x43f8('0x2a')][_0x43f8('0x3e')]){_0x3fa2f3[_0x43f8('0x3a')]=[{'all':!![]}];}_0x3fa2f3=_[_0x43f8('0x39')]({},_0x3fa2f3,_0x483cb8[_0x43f8('0x3f')]);return db[_0x43f8('0x26')]['find'](_0x3fa2f3)[_0x43f8('0x1e')](handleEntityNotFound(_0x2fa327,null))['then'](respondWithResult(_0x2fa327,null))[_0x43f8('0x3c')](handleError(_0x2fa327,null));};exports[_0x43f8('0x40')]=function(_0x32eaf1,_0x1d6114){return db[_0x43f8('0x26')][_0x43f8('0x40')](_0x32eaf1['body'],{})[_0x43f8('0x1e')](respondWithResult(_0x1d6114,0xc9))[_0x43f8('0x3c')](handleError(_0x1d6114,null));};exports[_0x43f8('0x1d')]=function(_0xa1d298,_0x1e765c){if(_0xa1d298[_0x43f8('0x41')]['id']){delete _0xa1d298[_0x43f8('0x41')]['id'];}return db[_0x43f8('0x26')][_0x43f8('0x42')]({'where':{'id':_0xa1d298[_0x43f8('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e765c,null))[_0x43f8('0x1e')](saveUpdates(_0xa1d298[_0x43f8('0x41')],null))['then'](respondWithResult(_0x1e765c,null))[_0x43f8('0x3c')](handleError(_0x1e765c,null));};exports[_0x43f8('0x44')]=function(_0x1dcd48,_0x220cb7){return db[_0x43f8('0x26')][_0x43f8('0x42')]({'where':{'id':_0x1dcd48[_0x43f8('0x43')]['id']}})[_0x43f8('0x1e')](handleEntityNotFound(_0x220cb7,null))['then'](removeEntity(_0x220cb7,null))[_0x43f8('0x3c')](handleError(_0x220cb7,null));}; \ No newline at end of file +var _0x415f=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x7ba204,_0x217d58){var _0x54fcb2=function(_0x4c9497){while(--_0x4c9497){_0x7ba204['push'](_0x7ba204['shift']());}};_0x54fcb2(++_0x217d58);}(_0x415f,0x133));var _0xf415=function(_0x34bb6c,_0x4dcd9d){_0x34bb6c=_0x34bb6c-0x0;var _0x8def74=_0x415f[_0x34bb6c];return _0x8def74;};'use strict';var emlformat=require(_0xf415('0x0'));var rimraf=require(_0xf415('0x1'));var zipdir=require(_0xf415('0x2'));var jsonpatch=require(_0xf415('0x3'));var rp=require(_0xf415('0x4'));var moment=require(_0xf415('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf415('0x6'));var path=require('path');var sox=require(_0xf415('0x7'));var csv=require(_0xf415('0x8'));var ejs=require(_0xf415('0x9'));var fs=require('fs');var fs_extra=require(_0xf415('0xa'));var _=require('lodash');var squel=require(_0xf415('0xb'));var crypto=require(_0xf415('0xc'));var jsforce=require(_0xf415('0xd'));var deskjs=require(_0xf415('0xe'));var toCsv=require(_0xf415('0x8'));var querystring=require(_0xf415('0xf'));var Papa=require(_0xf415('0x10'));var Redis=require('ioredis');var authService=require(_0xf415('0x11'));var qs=require(_0xf415('0x12'));var as=require(_0xf415('0x13'));var hardwareService=require(_0xf415('0x14'));var logger=require(_0xf415('0x15'))(_0xf415('0x16'));var utils=require(_0xf415('0x17'));var config=require(_0xf415('0x18'));var licenseUtil=require(_0xf415('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5707c2,_0xe6be38){_0xe6be38=_0xe6be38||0xcc;return function(_0x379091){if(_0x379091){return _0x5707c2[_0xf415('0x1a')](_0xe6be38);}return _0x5707c2[_0xf415('0x1b')](_0xe6be38)[_0xf415('0x1c')]();};}function respondWithResult(_0x3e2909,_0x21260c){_0x21260c=_0x21260c||0xc8;return function(_0x516e76){if(_0x516e76){return _0x3e2909['status'](_0x21260c)['json'](_0x516e76);}};}function respondWithFilteredResult(_0x595771,_0x562976){return function(_0x1021cd){if(_0x1021cd){var _0x291265=typeof _0x562976[_0xf415('0x1d')]===_0xf415('0x1e')&&typeof _0x562976[_0xf415('0x1f')]===_0xf415('0x1e');var _0x47a254=_0x1021cd[_0xf415('0x20')];var _0xb6d8fa=_0x291265?0x0:_0x562976['offset'];var _0x1bb890=_0x291265?_0x1021cd[_0xf415('0x20')]:_0x562976[_0xf415('0x1d')]+_0x562976[_0xf415('0x1f')];var _0xe8b92b;if(_0x1bb890>=_0x47a254){_0x1bb890=_0x47a254;_0xe8b92b=0xc8;}else{_0xe8b92b=0xce;}_0x595771[_0xf415('0x1b')](_0xe8b92b);return _0x595771[_0xf415('0x21')](_0xf415('0x22'),_0xb6d8fa+'-'+_0x1bb890+'/'+_0x47a254)[_0xf415('0x23')](_0x1021cd);}return null;};}function patchUpdates(_0x3740fe){return function(_0x10fadf){try{jsonpatch[_0xf415('0x24')](_0x10fadf,_0x3740fe,!![]);}catch(_0x4ed786){return BPromise[_0xf415('0x25')](_0x4ed786);}return _0x10fadf[_0xf415('0x26')]();};}function saveUpdates(_0x72ba9f,_0x30d816){return function(_0x5226b8){if(_0x5226b8){return _0x5226b8[_0xf415('0x27')](_0x72ba9f)[_0xf415('0x28')](function(_0x1b64c1){return _0x1b64c1;});}return null;};}function removeEntity(_0x56618b,_0x3d763d){return function(_0x5d389b){if(_0x5d389b){return _0x5d389b['destroy']()['then'](function(){_0x56618b[_0xf415('0x1b')](0xcc)[_0xf415('0x1c')]();});}};}function handleEntityNotFound(_0x34ddea,_0x48b6b7){return function(_0x475827){if(!_0x475827){_0x34ddea['sendStatus'](0x194);}return _0x475827;};}function handleError(_0x42f2a4,_0x4096a9){_0x4096a9=_0x4096a9||0x1f4;return function(_0x2f66f6){logger[_0xf415('0x29')](_0x2f66f6[_0xf415('0x2a')]);if(_0x2f66f6[_0xf415('0x2b')]){delete _0x2f66f6[_0xf415('0x2b')];}_0x42f2a4[_0xf415('0x1b')](_0x4096a9)[_0xf415('0x2c')](_0x2f66f6);};}exports[_0xf415('0x2d')]=function(_0x1a1b7f,_0xc54a1c){var _0x5b8398={},_0x1c389d={},_0x17d5a8={'count':0x0,'rows':[]};var _0x26dd0a=_['map'](db[_0xf415('0x2e')][_0xf415('0x2f')],function(_0xd90696){return{'name':_0xd90696[_0xf415('0x30')],'type':_0xd90696[_0xf415('0x31')][_0xf415('0x32')]};});_0x1c389d['model']=_['map'](_0x26dd0a,_0xf415('0x2b'));_0x1c389d[_0xf415('0x33')]=_[_0xf415('0x34')](_0x1a1b7f[_0xf415('0x33')]);_0x1c389d['filters']=_[_0xf415('0x35')](_0x1c389d['model'],_0x1c389d[_0xf415('0x33')]);_0x5b8398[_0xf415('0x36')]=_[_0xf415('0x35')](_0x1c389d[_0xf415('0x37')],qs[_0xf415('0x38')](_0x1a1b7f[_0xf415('0x33')][_0xf415('0x38')]));_0x5b8398[_0xf415('0x36')]=_0x5b8398['attributes']['length']?_0x5b8398['attributes']:_0x1c389d[_0xf415('0x37')];if(!_0x1a1b7f[_0xf415('0x33')][_0xf415('0x39')](_0xf415('0x3a'))){_0x5b8398[_0xf415('0x1f')]=qs['limit'](_0x1a1b7f[_0xf415('0x33')][_0xf415('0x1f')]);_0x5b8398[_0xf415('0x1d')]=qs[_0xf415('0x1d')](_0x1a1b7f[_0xf415('0x33')][_0xf415('0x1d')]);}_0x5b8398[_0xf415('0x3b')]=qs[_0xf415('0x3c')](_0x1a1b7f[_0xf415('0x33')][_0xf415('0x3c')]);_0x5b8398[_0xf415('0x3d')]=qs[_0xf415('0x3e')](_[_0xf415('0x3f')](_0x1a1b7f[_0xf415('0x33')],_0x1c389d['filters']),_0x26dd0a);if(_0x1a1b7f[_0xf415('0x33')][_0xf415('0x40')]){_0x5b8398['where']=_[_0xf415('0x41')](_0x5b8398['where'],{'$or':_[_0xf415('0x42')](_0x26dd0a,function(_0x1224ea){if(_0x1224ea[_0xf415('0x31')]!==_0xf415('0x43')){var _0x48cb38={};_0x48cb38[_0x1224ea[_0xf415('0x2b')]]={'$like':'%'+_0x1a1b7f[_0xf415('0x33')]['filter']+'%'};return _0x48cb38;}})});}_0x5b8398=_[_0xf415('0x41')]({},_0x5b8398,_0x1a1b7f[_0xf415('0x44')]);var _0x3d9bc8={'where':_0x5b8398['where']};return db[_0xf415('0x2e')][_0xf415('0x20')](_0x3d9bc8)['then'](function(_0x35d4f8){_0x17d5a8[_0xf415('0x20')]=_0x35d4f8;if(_0x1a1b7f['query'][_0xf415('0x45')]){_0x5b8398[_0xf415('0x46')]=[{'all':!![]}];}return db[_0xf415('0x2e')][_0xf415('0x47')](_0x5b8398);})['then'](function(_0x4422d2){_0x17d5a8[_0xf415('0x48')]=_0x4422d2;return _0x17d5a8;})[_0xf415('0x28')](respondWithFilteredResult(_0xc54a1c,_0x5b8398))[_0xf415('0x49')](handleError(_0xc54a1c,null));};exports['show']=function(_0x6ecf39,_0x459159){var _0x59b5ee={'raw':!![],'where':{'id':_0x6ecf39[_0xf415('0x4a')]['id']}},_0x4a5b5a={};_0x4a5b5a[_0xf415('0x37')]=_[_0xf415('0x34')](db[_0xf415('0x2e')][_0xf415('0x2f')]);_0x4a5b5a[_0xf415('0x33')]=_[_0xf415('0x34')](_0x6ecf39[_0xf415('0x33')]);_0x4a5b5a['filters']=_[_0xf415('0x35')](_0x4a5b5a[_0xf415('0x37')],_0x4a5b5a['query']);_0x59b5ee[_0xf415('0x36')]=_[_0xf415('0x35')](_0x4a5b5a[_0xf415('0x37')],qs[_0xf415('0x38')](_0x6ecf39[_0xf415('0x33')][_0xf415('0x38')]));_0x59b5ee[_0xf415('0x36')]=_0x59b5ee[_0xf415('0x36')][_0xf415('0x4b')]?_0x59b5ee['attributes']:_0x4a5b5a[_0xf415('0x37')];if(_0x6ecf39[_0xf415('0x33')][_0xf415('0x45')]){_0x59b5ee[_0xf415('0x46')]=[{'all':!![]}];}_0x59b5ee=_[_0xf415('0x41')]({},_0x59b5ee,_0x6ecf39['options']);return db['OpenchannelApplication'][_0xf415('0x4c')](_0x59b5ee)[_0xf415('0x28')](handleEntityNotFound(_0x459159,null))['then'](respondWithResult(_0x459159,null))[_0xf415('0x49')](handleError(_0x459159,null));};exports['create']=function(_0x4cc455,_0x4db693){return db['OpenchannelApplication'][_0xf415('0x4d')](_0x4cc455[_0xf415('0x4e')],{})[_0xf415('0x28')](respondWithResult(_0x4db693,0xc9))[_0xf415('0x49')](handleError(_0x4db693,null));};exports[_0xf415('0x27')]=function(_0x2dbf68,_0x3c1133){if(_0x2dbf68['body']['id']){delete _0x2dbf68['body']['id'];}return db['OpenchannelApplication'][_0xf415('0x4c')]({'where':{'id':_0x2dbf68['params']['id']}})[_0xf415('0x28')](handleEntityNotFound(_0x3c1133,null))['then'](saveUpdates(_0x2dbf68[_0xf415('0x4e')],null))['then'](respondWithResult(_0x3c1133,null))[_0xf415('0x49')](handleError(_0x3c1133,null));};exports[_0xf415('0x4f')]=function(_0x389d77,_0x5f4740){return db[_0xf415('0x2e')]['find']({'where':{'id':_0x389d77[_0xf415('0x4a')]['id']}})[_0xf415('0x28')](handleEntityNotFound(_0x5f4740,null))[_0xf415('0x28')](removeEntity(_0x5f4740,null))[_0xf415('0x49')](handleError(_0x5f4740,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 964649b..3cb16d6 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 _0x7e0b=['utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelApplication','utf8mb4'];(function(_0x131c4c,_0x15e9a7){var _0x53d693=function(_0x45e431){while(--_0x45e431){_0x131c4c['push'](_0x131c4c['shift']());}};_0x53d693(++_0x15e9a7);}(_0x7e0b,0xb1));var _0xb7e0=function(_0x3c5b22,_0xf1adff){_0x3c5b22=_0x3c5b22-0x0;var _0x347e5b=_0x7e0b[_0x3c5b22];return _0x347e5b;};'use strict';var _=require(_0xb7e0('0x0'));var util=require(_0xb7e0('0x1'));var logger=require('../../config/logger')(_0xb7e0('0x2'));var moment=require('moment');var BPromise=require(_0xb7e0('0x3'));var rp=require(_0xb7e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7e0('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0xb7e0('0x6')]=function(_0x42d05a,_0xb49e96){return _0x42d05a[_0xb7e0('0x7')](_0xb7e0('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb7e0('0x9'),'collate':_0xb7e0('0xa')});}; \ No newline at end of file +var _0xace9=['api','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xace9,0x66));var _0x9ace=function(_0x35018f,_0x346a48){_0x35018f=_0x35018f-0x0;var _0x18aba3=_0xace9[_0x35018f];return _0x18aba3;};'use strict';var _=require('lodash');var util=require(_0x9ace('0x0'));var logger=require(_0x9ace('0x1'))(_0x9ace('0x2'));var moment=require('moment');var BPromise=require(_0x9ace('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ace('0x4'));var rimraf=require(_0x9ace('0x5'));var config=require(_0x9ace('0x6'));var attributes=require(_0x9ace('0x7'));module[_0x9ace('0x8')]=function(_0x2a5f13,_0x4fedd6){return _0x2a5f13[_0x9ace('0x9')](_0x9ace('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ace('0xb'),'collate':_0x9ace('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7a0baba..1964693 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 _0x6bc9=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','stringify','lodash','util'];(function(_0x3bb5be,_0x423a9f){var _0x5ead50=function(_0x3bcb90){while(--_0x3bcb90){_0x3bb5be['push'](_0x3bb5be['shift']());}};_0x5ead50(++_0x423a9f);}(_0x6bc9,0x148));var _0x96bc=function(_0x51e5bd,_0x3c2cf1){_0x51e5bd=_0x51e5bd-0x0;var _0x250aed=_0x6bc9[_0x51e5bd];return _0x250aed;};'use strict';var _=require(_0x96bc('0x0'));var util=require(_0x96bc('0x1'));var moment=require(_0x96bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x96bc('0x3'));var fs=require('fs');var Redis=require(_0x96bc('0x4'));var db=require(_0x96bc('0x5'))['db'];var utils=require(_0x96bc('0x6'));var logger=require(_0x96bc('0x7'))(_0x96bc('0x8'));var config=require('../../config/environment');var jayson=require(_0x96bc('0x9'));var client=jayson[_0x96bc('0xa')][_0x96bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe1aa25,_0x3fd48d,_0x12e760){return new BPromise(function(_0x27cc7b,_0x1ccbee){return client[_0x96bc('0xc')](_0xe1aa25,_0x12e760)['then'](function(_0x5f5839){logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x3fd48d,_0x96bc('0xf'));logger[_0x96bc('0x10')](_0x96bc('0x11'),_0x3fd48d,_0x96bc('0xf'),JSON['stringify'](_0x5f5839));if(_0x5f5839[_0x96bc('0x12')]){if(_0x5f5839['error']['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3fd48d,_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);return _0x1ccbee(_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);}logger[_0x96bc('0x12')](_0x96bc('0xe'),_0x3fd48d,_0x5f5839['error']['message']);return _0x27cc7b(_0x5f5839[_0x96bc('0x12')][_0x96bc('0x13')]);}else{logger[_0x96bc('0xd')](_0x96bc('0xe'),_0x3fd48d,_0x96bc('0xf'));_0x27cc7b(_0x5f5839[_0x96bc('0x14')]['message']);}})[_0x96bc('0x15')](function(_0x935a49){logger[_0x96bc('0x12')](_0x96bc('0xe'),_0x3fd48d,_0x935a49);_0x1ccbee(_0x935a49);});});}exports[_0x96bc('0x16')]=function(_0x1084d5){var _0x3486e4=this;return new Promise(function(_0x599faf,_0xda4cb){return db[_0x96bc('0x17')][_0x96bc('0x18')](_0x1084d5['body'],{'raw':_0x1084d5[_0x96bc('0x19')]?_0x1084d5[_0x96bc('0x19')][_0x96bc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1084d5[_0x96bc('0x19')]?_0x1084d5['options'][_0x96bc('0x1b')]||null:null,'attributes':_0x1084d5[_0x96bc('0x19')]?_0x1084d5[_0x96bc('0x19')]['attributes']||null:null,'limit':_0x1084d5['options']?_0x1084d5[_0x96bc('0x19')][_0x96bc('0x1c')]||null:null})['then'](function(_0x5c6801){logger[_0x96bc('0xd')](_0x96bc('0x16'),_0x1084d5);logger[_0x96bc('0x10')](_0x96bc('0x16'),_0x1084d5,JSON[_0x96bc('0x1d')](_0x5c6801));_0x599faf(_0x5c6801);})[_0x96bc('0x15')](function(_0x35bbe3){logger['error']('UpdateOpenchannelApplication',_0x35bbe3[_0x96bc('0x13')],_0x1084d5);_0xda4cb(_0x3486e4[_0x96bc('0x12')](0x1f4,_0x35bbe3['message']));});});}; \ No newline at end of file +var _0x43fb=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','options','raw','where','limit','debug','UpdateOpenchannelApplication'];(function(_0x25a322,_0x5a1297){var _0x14ce9c=function(_0x18bc55){while(--_0x18bc55){_0x25a322['push'](_0x25a322['shift']());}};_0x14ce9c(++_0x5a1297);}(_0x43fb,0x160));var _0xb43f=function(_0x577c04,_0x447012){_0x577c04=_0x577c04-0x0;var _0x5e0c1e=_0x43fb[_0x577c04];return _0x5e0c1e;};'use strict';var _=require(_0xb43f('0x0'));var util=require('util');var moment=require(_0xb43f('0x1'));var BPromise=require('bluebird');var rs=require(_0xb43f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb43f('0x3'))['db'];var utils=require(_0xb43f('0x4'));var logger=require(_0xb43f('0x5'))(_0xb43f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb43f('0x7')][_0xb43f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21d7b0,_0x5aca8c,_0x9e3d4a){return new BPromise(function(_0x4bed0c,_0x51cecc){return client[_0xb43f('0x9')](_0x21d7b0,_0x9e3d4a)['then'](function(_0x4c4e0f){logger['info'](_0xb43f('0xa'),_0x5aca8c,_0xb43f('0xb'));logger['debug'](_0xb43f('0xc'),_0x5aca8c,_0xb43f('0xb'),JSON[_0xb43f('0xd')](_0x4c4e0f));if(_0x4c4e0f[_0xb43f('0xe')]){if(_0x4c4e0f[_0xb43f('0xe')][_0xb43f('0xf')]===0x1f4){logger[_0xb43f('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x5aca8c,_0x4c4e0f[_0xb43f('0xe')][_0xb43f('0x10')]);return _0x51cecc(_0x4c4e0f[_0xb43f('0xe')][_0xb43f('0x10')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x5aca8c,_0x4c4e0f['error'][_0xb43f('0x10')]);return _0x4bed0c(_0x4c4e0f['error'][_0xb43f('0x10')]);}else{logger[_0xb43f('0x11')](_0xb43f('0xa'),_0x5aca8c,'request\x20sent');_0x4bed0c(_0x4c4e0f[_0xb43f('0x12')][_0xb43f('0x10')]);}})['catch'](function(_0x3f308f){logger[_0xb43f('0xe')](_0xb43f('0xa'),_0x5aca8c,_0x3f308f);_0x51cecc(_0x3f308f);});});}exports['UpdateOpenchannelApplication']=function(_0xce608){var _0x2a31f2=this;return new Promise(function(_0x20bcca,_0xde3146){return db['OpenchannelApplication'][_0xb43f('0x13')](_0xce608['body'],{'raw':_0xce608[_0xb43f('0x14')]?_0xce608[_0xb43f('0x14')][_0xb43f('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce608[_0xb43f('0x14')]?_0xce608[_0xb43f('0x14')][_0xb43f('0x16')]||null:null,'attributes':_0xce608[_0xb43f('0x14')]?_0xce608[_0xb43f('0x14')]['attributes']||null:null,'limit':_0xce608['options']?_0xce608[_0xb43f('0x14')][_0xb43f('0x17')]||null:null})['then'](function(_0x4d4a2c){logger['info']('UpdateOpenchannelApplication',_0xce608);logger[_0xb43f('0x18')](_0xb43f('0x19'),_0xce608,JSON[_0xb43f('0xd')](_0x4d4a2c));_0x20bcca(_0x4d4a2c);})[_0xb43f('0x1a')](function(_0x3e5c12){logger[_0xb43f('0xe')](_0xb43f('0x19'),_0x3e5c12[_0xb43f('0x10')],_0xce608);_0xde3146(_0x2a31f2[_0xb43f('0xe')](0x1f4,_0x3e5c12[_0xb43f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e73ff26..8f56874 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 _0xa17b=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x16d8d9,_0x2be9a4){var _0x274705=function(_0x33ba82){while(--_0x33ba82){_0x16d8d9['push'](_0x16d8d9['shift']());}};_0x274705(++_0x2be9a4);}(_0xa17b,0x7d));var _0xba17=function(_0x81e6e2,_0x3565ca){_0x81e6e2=_0x81e6e2-0x0;var _0x56bb71=_0xa17b[_0x81e6e2];return _0x56bb71;};'use strict';var multer=require(_0xba17('0x0'));var util=require('util');var path=require(_0xba17('0x1'));var timeout=require(_0xba17('0x2'));var express=require(_0xba17('0x3'));var router=express[_0xba17('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba17('0x5'));var interaction=require(_0xba17('0x6'));var config=require(_0xba17('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xba17('0x8')]('/',auth[_0xba17('0x9')](),controller[_0xba17('0xa')]);router[_0xba17('0x8')](_0xba17('0xb'),auth[_0xba17('0x9')](),controller[_0xba17('0xc')]);router[_0xba17('0x8')](_0xba17('0xd'),auth[_0xba17('0x9')](),controller[_0xba17('0xe')]);router[_0xba17('0x8')](_0xba17('0xf'),auth['isAuthenticated'](),controller[_0xba17('0x10')]);router[_0xba17('0x8')](_0xba17('0x11'),auth['isAuthenticated'](),controller[_0xba17('0x12')]);router[_0xba17('0x13')]('/',auth[_0xba17('0x9')](),controller[_0xba17('0x14')]);router[_0xba17('0x13')](_0xba17('0xf'),auth[_0xba17('0x9')](),controller['addMessage']);router['post'](_0xba17('0x15'),auth[_0xba17('0x9')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x18')),controller[_0xba17('0x19')]);router[_0xba17('0x1a')]('/:id',auth[_0xba17('0x9')](),interaction[_0xba17('0x16')]('openchannel',_0xba17('0x1b')),controller[_0xba17('0x1c')]);router[_0xba17('0x1d')](_0xba17('0xd'),auth[_0xba17('0x9')](),interaction[_0xba17('0x16')](_0xba17('0x17'),_0xba17('0x1e')),controller[_0xba17('0x1f')]);router['delete'](_0xba17('0x15'),auth[_0xba17('0x9')](),controller[_0xba17('0x20')]);module['exports']=router; \ No newline at end of file +var _0xdce6=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','/:id/tags','exports','multer','util','path','connect-timeout','Router'];(function(_0x384111,_0x57a591){var _0x9f20b=function(_0x5093ed){while(--_0x5093ed){_0x384111['push'](_0x384111['shift']());}};_0x9f20b(++_0x57a591);}(_0xdce6,0x1ad));var _0x6dce=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xdce6[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x6dce('0x0'));var util=require(_0x6dce('0x1'));var path=require(_0x6dce('0x2'));var timeout=require(_0x6dce('0x3'));var express=require('express');var router=express[_0x6dce('0x4')]();var fs_extra=require(_0x6dce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6dce('0x6'));var config=require(_0x6dce('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x6dce('0x8')](),controller[_0x6dce('0x9')]);router[_0x6dce('0xa')](_0x6dce('0xb'),auth[_0x6dce('0x8')](),controller[_0x6dce('0xc')]);router[_0x6dce('0xa')](_0x6dce('0xd'),auth[_0x6dce('0x8')](),controller[_0x6dce('0xe')]);router[_0x6dce('0xa')](_0x6dce('0xf'),auth[_0x6dce('0x8')](),controller[_0x6dce('0x10')]);router[_0x6dce('0xa')]('/:id/download',auth[_0x6dce('0x8')](),controller[_0x6dce('0x11')]);router[_0x6dce('0x12')]('/',auth[_0x6dce('0x8')](),controller[_0x6dce('0x13')]);router['post'](_0x6dce('0xf'),auth[_0x6dce('0x8')](),controller[_0x6dce('0x14')]);router[_0x6dce('0x12')]('/:id/tags',auth[_0x6dce('0x8')](),interaction['tracked'](_0x6dce('0x15'),_0x6dce('0x16')),controller[_0x6dce('0x17')]);router[_0x6dce('0x18')](_0x6dce('0xd'),auth['isAuthenticated'](),interaction[_0x6dce('0x19')](_0x6dce('0x15'),_0x6dce('0x1a')),controller['update']);router[_0x6dce('0x1b')](_0x6dce('0xd'),auth[_0x6dce('0x8')](),interaction['tracked'](_0x6dce('0x15'),_0x6dce('0x1c')),controller['destroy']);router[_0x6dce('0x1b')](_0x6dce('0x1d'),auth['isAuthenticated'](),controller['removeTags']);module[_0x6dce('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 02016a9..949e161 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 _0xa42e=['STRING','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE'];(function(_0x4d91b4,_0x3d9e10){var _0x3e4be9=function(_0x43d10f){while(--_0x43d10f){_0x4d91b4['push'](_0x4d91b4['shift']());}};_0x3e4be9(++_0x3d9e10);}(_0xa42e,0xba));var _0xea42=function(_0x5df6f0,_0x197a9f){_0x5df6f0=_0x5df6f0-0x0;var _0x252619=_0xa42e[_0x5df6f0];return _0x252619;};'use strict';var Sequelize=require(_0xea42('0x0'));module['exports']={'closed':{'type':Sequelize[_0xea42('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea42('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xea42('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xea42('0x3')]},'externalUrl':{'type':Sequelize[_0xea42('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xea42('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xea42('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xea42('0x6')]}}; \ No newline at end of file +var _0xa1aa=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x456039,_0x68106f){_0x456039=_0x456039-0x0;var _0x58ab74=_0xa1aa[_0x456039];return _0x58ab74;};'use strict';var Sequelize=require('sequelize');module[_0xaa1a('0x0')]={'closed':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa1a('0x2')]},'disposition':{'type':Sequelize[_0xaa1a('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa1a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xaa1a('0x2')]},'threadId':{'type':Sequelize[_0xaa1a('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xaa1a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaa1a('0x4')]('in',_0xaa1a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa1a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xaa1a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5f4d96e..3ca0f4e 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 _0x7025=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','includeAll','include','find','create','body','describe','addMessage','ids','getMessages','findOne','length','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','findAll','rows','addTags','setTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','firstName','lastName','attachments','Attachment','Messages','secret','read','Account','get','Openchannel','Owner','createdAt','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','Contact','renderFile','views','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7025,0xfb));var _0x5702=function(_0xa84ad0,_0x5e31b1){_0xa84ad0=_0xa84ad0-0x0;var _0x4eaadf=_0x7025[_0xa84ad0];return _0x4eaadf;};'use strict';var rimraf=require(_0x5702('0x0'));var zipdir=require(_0x5702('0x1'));var moment=require(_0x5702('0x2'));var util=require(_0x5702('0x3'));var path=require('path');var ejs=require(_0x5702('0x4'));var fs=require('fs');var _=require(_0x5702('0x5'));var Redis=require(_0x5702('0x6'));var interaction=require(_0x5702('0x7'));var qs=require(_0x5702('0x8'));var pdf=require(_0x5702('0x9'));var logger=require(_0x5702('0xa'))(_0x5702('0xb'));var config=require(_0x5702('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5702('0xd')](config[_0x5702('0xe')],{'host':_0x5702('0xf'),'port':0x18eb});var socket=require(_0x5702('0x10'))(new Redis(config[_0x5702('0xe')]));require(_0x5702('0x11'))[_0x5702('0x12')](socket);function respondWithStatusCode(_0x29adec,_0xc7045f){_0xc7045f=_0xc7045f||0xcc;return function(_0x28dd1e){if(_0x28dd1e){return _0x29adec[_0x5702('0x13')](_0xc7045f);}return _0x29adec[_0x5702('0x14')](_0xc7045f)[_0x5702('0x15')]();};}function respondWithResult(_0x52ba89,_0xcbf57b){_0xcbf57b=_0xcbf57b||0xc8;return function(_0x2e3d99){if(_0x2e3d99){return _0x52ba89['status'](_0xcbf57b)[_0x5702('0x16')](_0x2e3d99);}};}function respondWithFilteredResult(_0x320854,_0x125f5c){return function(_0x3b9661){if(_0x3b9661){var _0x244203=typeof _0x125f5c[_0x5702('0x17')]===_0x5702('0x18')&&typeof _0x125f5c[_0x5702('0x19')]===_0x5702('0x18');var _0x47c226=_0x3b9661[_0x5702('0x1a')];var _0x53ee11=_0x244203?0x0:_0x125f5c['offset'];var _0x2fead5=_0x244203?_0x3b9661[_0x5702('0x1a')]:_0x125f5c['offset']+_0x125f5c[_0x5702('0x19')];var _0x31ba77;if(_0x2fead5>=_0x47c226){_0x2fead5=_0x47c226;_0x31ba77=0xc8;}else{_0x31ba77=0xce;}_0x320854['status'](_0x31ba77);return _0x320854[_0x5702('0x1b')](_0x5702('0x1c'),_0x53ee11+'-'+_0x2fead5+'/'+_0x47c226)['json'](_0x3b9661);}return null;};}function saveUpdates(_0x717811){return function(_0x3ce85d){if(_0x3ce85d){return _0x3ce85d[_0x5702('0x1d')](_0x717811)[_0x5702('0x1e')](function(_0x351179){return _0x351179;});}return null;};}function removeEntity(_0x461d3b){return function(_0x3d5ddc){if(_0x3d5ddc){return _0x3d5ddc[_0x5702('0x1f')]()[_0x5702('0x1e')](function(){_0x461d3b[_0x5702('0x14')](0xcc)[_0x5702('0x15')]();});}};}function handleEntityNotFound(_0x446e22){return function(_0x407922){if(!_0x407922){_0x446e22[_0x5702('0x13')](0x194);}return _0x407922;};}function handleError(_0x22bacb,_0x132aa6){_0x132aa6=_0x132aa6||0x1f4;return function(_0xdee55a){logger[_0x5702('0x20')](_0xdee55a[_0x5702('0x21')]);if(_0xdee55a[_0x5702('0x22')]){delete _0xdee55a['name'];}_0x22bacb[_0x5702('0x14')](_0x132aa6)[_0x5702('0x23')](_0xdee55a);};}exports[_0x5702('0x24')]=function(_0x26d372,_0x489c0c){var _0x5cac81={};var _0x53e912=_[_0x5702('0x25')](db[_0x5702('0x26')][_0x5702('0x27')],function(_0x29c664){return{'name':_0x29c664[_0x5702('0x28')],'type':_0x29c664[_0x5702('0x29')][_0x5702('0x2a')]};});_0x5cac81=qs['getOptions'](_0x53e912,_0x26d372);return interaction['findAll'](_0x5702('0x2b'),_0x26d372[_0x5702('0x2c')],_0x26d372[_0x5702('0x2d')],_0x5cac81,_0x53e912)[_0x5702('0x1e')](respondWithFilteredResult(_0x489c0c,_0x5cac81))[_0x5702('0x2e')](handleError(_0x489c0c,null));};exports[_0x5702('0x2f')]=function(_0x37a010,_0x22befc){var _0x5879d7={};if(_0x37a010[_0x5702('0x2c')][_0x5702('0x29')]&&_0x37a010[_0x5702('0x2c')]['type']===_0x5702('0x30')){_0x5879d7['from']=_0x37a010['params']['id'];}else{_0x5879d7['id']=_0x37a010[_0x5702('0x31')]['id'];}var _0x57c326={'raw':![],'where':_0x5879d7},_0x450d08={};_0x450d08[_0x5702('0x32')]=_[_0x5702('0x33')](db['OpenchannelInteraction'][_0x5702('0x27')]);_0x450d08['query']=_[_0x5702('0x33')](_0x37a010[_0x5702('0x2c')]);_0x450d08[_0x5702('0x34')]=_[_0x5702('0x35')](_0x450d08[_0x5702('0x32')],_0x450d08[_0x5702('0x2c')]);_0x57c326[_0x5702('0x36')]=_[_0x5702('0x35')](_0x450d08[_0x5702('0x32')],qs[_0x5702('0x37')](_0x37a010[_0x5702('0x2c')]['fields']));_0x57c326[_0x5702('0x36')]=_0x57c326[_0x5702('0x36')]['length']?_0x57c326[_0x5702('0x36')]:_0x450d08[_0x5702('0x32')];if(_0x37a010['query'][_0x5702('0x38')]){_0x57c326[_0x5702('0x39')]=[{'all':!![]}];}_0x57c326=_['merge']({},_0x57c326,_0x37a010['options']);return db[_0x5702('0x26')][_0x5702('0x3a')](_0x57c326)[_0x5702('0x1e')](handleEntityNotFound(_0x22befc,null))[_0x5702('0x1e')](respondWithResult(_0x22befc,null))[_0x5702('0x2e')](handleError(_0x22befc,null));};exports['create']=function(_0x5d010e,_0xfc1377){return db[_0x5702('0x26')][_0x5702('0x3b')](_0x5d010e['body'],{})[_0x5702('0x1e')](respondWithResult(_0xfc1377,0xc9))[_0x5702('0x2e')](handleError(_0xfc1377,null));};exports[_0x5702('0x1d')]=function(_0x29a282,_0xbef6c7){if(_0x29a282[_0x5702('0x3c')]['id']){delete _0x29a282[_0x5702('0x3c')]['id'];}return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x29a282[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0xbef6c7,null))[_0x5702('0x1e')](saveUpdates(_0x29a282[_0x5702('0x3c')],null))[_0x5702('0x1e')](respondWithResult(_0xbef6c7,null))[_0x5702('0x2e')](handleError(_0xbef6c7,null));};exports[_0x5702('0x1f')]=function(_0x257d09,_0x166bb4){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x257d09[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x166bb4,null))['then'](removeEntity(_0x166bb4,null))[_0x5702('0x2e')](handleError(_0x166bb4,null));};exports['describe']=function(_0x3024ad,_0x594eeb){return db[_0x5702('0x26')][_0x5702('0x3d')]()[_0x5702('0x1e')](respondWithResult(_0x594eeb,null))[_0x5702('0x2e')](handleError(_0x594eeb,null));};exports[_0x5702('0x3e')]=function(_0xdb0ce5,_0x188935){return db['OpenchannelMessage'][_0x5702('0x3a')]({'where':{'id':_0xdb0ce5[_0x5702('0x31')]['id']}})[_0x5702('0x1e')](handleEntityNotFound(_0x188935,null))['then'](function(_0x1548ef){if(_0x1548ef){return _0x1548ef[_0x5702('0x3e')](_0xdb0ce5[_0x5702('0x3c')][_0x5702('0x3f')],_['omit'](_0xdb0ce5[_0x5702('0x3c')],[_0x5702('0x3f'),'id'])||{});}})[_0x5702('0x1e')](respondWithResult(_0x188935,null))[_0x5702('0x2e')](handleError(_0x188935,null));};exports[_0x5702('0x40')]=function(_0x132036,_0x467c88){var _0x46356c={'raw':![],'where':{}};var _0x5d5f6b={};var _0xe9f263={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x5702('0x41')]({'where':{'id':_0x132036[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x467c88,null))[_0x5702('0x1e')](function(_0x357654){if(_0x357654){_0x5d5f6b['model']=_[_0x5702('0x33')](db['OpenchannelMessage'][_0x5702('0x27')]);_0x5d5f6b[_0x5702('0x2c')]=_[_0x5702('0x33')](_0x132036[_0x5702('0x2c')]);_0x5d5f6b[_0x5702('0x34')]=_[_0x5702('0x35')](_0x5d5f6b[_0x5702('0x32')],_0x5d5f6b[_0x5702('0x2c')]);_0x46356c[_0x5702('0x36')]=_[_0x5702('0x35')](_0x5d5f6b['model'],qs[_0x5702('0x37')](_0x132036[_0x5702('0x2c')][_0x5702('0x37')]));_0x46356c['attributes']=_0x46356c[_0x5702('0x36')][_0x5702('0x42')]?_0x46356c[_0x5702('0x36')]:_0x5d5f6b[_0x5702('0x32')];if(!_0x132036[_0x5702('0x2c')][_0x5702('0x43')]('nolimit')){_0x46356c[_0x5702('0x19')]=qs['limit'](_0x132036['query'][_0x5702('0x19')]);_0x46356c['offset']=qs['offset'](_0x132036['query'][_0x5702('0x17')]);}_0x46356c[_0x5702('0x44')]=qs['sort'](_0x132036[_0x5702('0x2c')][_0x5702('0x45')]);_0x46356c[_0x5702('0x46')]=qs[_0x5702('0x34')](_[_0x5702('0x47')](_0x132036[_0x5702('0x2c')],_0x5d5f6b['filters']));_0x46356c[_0x5702('0x46')][_0x5702('0x48')]=_0x357654['id'];if(_0x132036[_0x5702('0x2c')][_0x5702('0x49')]){_0x46356c[_0x5702('0x46')]=_['merge'](_0x46356c[_0x5702('0x46')],{'$or':_['map'](_0x46356c[_0x5702('0x36')],function(_0x1c61bf){var _0x123cc={};_0x123cc[_0x1c61bf]={'$like':'%'+_0x132036['query']['filter']+'%'};return _0x123cc;})});}if(_0x132036[_0x5702('0x2c')][_0x5702('0x4a')]){var _0x2b09f3=_0x132036[_0x5702('0x2c')][_0x5702('0x4a')][_0x5702('0x4b')](',');var _0x45bc74={};_0x45bc74[_0x2b09f3[0x0]]={'$gte':moment(_0x2b09f3[0x1])[_0x5702('0x4c')](_0x5702('0x4d'))};_0x46356c[_0x5702('0x46')]=_['merge'](_0x46356c[_0x5702('0x46')],_0x45bc74);}_0x46356c=_['merge']({},_0x46356c,_0x132036[_0x5702('0x4e')]);return db[_0x5702('0x4f')][_0x5702('0x1a')]({'where':_0x46356c[_0x5702('0x46')]})['then'](function(_0x26a929){_0xe9f263[_0x5702('0x1a')]=_0x26a929;if(_0x132036[_0x5702('0x2c')][_0x5702('0x38')]){_0x46356c[_0x5702('0x39')]=[{'all':!![]}];}return db[_0x5702('0x4f')][_0x5702('0x50')](_0x46356c);})[_0x5702('0x1e')](function(_0x2d3154){_0xe9f263[_0x5702('0x51')]=_0x2d3154;return _0xe9f263;});}})[_0x5702('0x1e')](respondWithFilteredResult(_0x467c88,_0x46356c))[_0x5702('0x2e')](handleError(_0x467c88,null));};exports[_0x5702('0x52')]=function(_0xd49eaa,_0x5d7567){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0xd49eaa[_0x5702('0x31')]['id']}})['then'](handleEntityNotFound(_0x5d7567,null))[_0x5702('0x1e')](function(_0xcb574){if(_0xcb574){return _0xcb574[_0x5702('0x53')](_0xd49eaa['body'][_0x5702('0x3f')],_[_0x5702('0x54')](_0xd49eaa[_0x5702('0x3c')],[_0x5702('0x3f'),'id'])||{})[_0x5702('0x55')](function(){return db[_0x5702('0x56')][_0x5702('0x50')]({'attributes':['id',_0x5702('0x22'),_0x5702('0x57')],'where':{'id':_0xd49eaa[_0x5702('0x3c')][_0x5702('0x3f')]}});})[_0x5702('0x1e')](function(_0x184ced){socket['emit'](_0x5702('0x58'),{'id':Number(_0xd49eaa['params']['id']),'tags':_0x184ced||[]});return{'id':Number(_0xd49eaa[_0x5702('0x31')]['id']),'tags':_0x184ced||[]};});}})['then'](respondWithResult(_0x5d7567,null))[_0x5702('0x2e')](handleError(_0x5d7567,null));};exports[_0x5702('0x59')]=function(_0xa00e56,_0xa3bde8){return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0xa00e56[_0x5702('0x31')]['id']}})[_0x5702('0x1e')](handleEntityNotFound(_0xa3bde8,null))[_0x5702('0x1e')](function(_0x33a7e3){if(_0x33a7e3){return _0x33a7e3[_0x5702('0x59')](_0xa00e56['query'][_0x5702('0x3f')]);}})['then'](respondWithStatusCode(_0xa3bde8,null))[_0x5702('0x2e')](handleError(_0xa3bde8,null));};exports[_0x5702('0x5a')]=function(_0x46d2dc,_0x235cc8){var _0x5b01fd=moment()[_0x5702('0x5b')]()[_0x5702('0x5c')]();var _0x6c25d5=path[_0x5702('0x5d')](config[_0x5702('0x5e')],_0x5702('0x5f'),_0x5702('0x60'),_0x5702('0x61'));var _0x50244d=path[_0x5702('0x5d')](config['root'],_0x5702('0x5f'),_0x5702('0x60'),'attachments');var _0x1f2efb=path['join'](_0x6c25d5,_0x5b01fd);var _0x3226e7=util[_0x5702('0x4c')](_0x5702('0x62'),_0x46d2dc['params']['id'],_0x5b01fd);var _0x4ebf9e=path['join'](_0x6c25d5,_0x3226e7);var _0x42c024=[];_0x42c024['push']({'model':db[_0x5702('0x63')],'as':_0x5702('0x63'),'attributes':['id',_0x5702('0x64')],'raw':!![]});_0x42c024[_0x5702('0x65')]({'model':db[_0x5702('0x66')],'as':'Contact','attributes':['id',_0x5702('0x67'),_0x5702('0x68')],'raw':!![]});if(_0x46d2dc[_0x5702('0x2c')][_0x5702('0x69')]){_0x42c024['push']({'model':db[_0x5702('0x6a')],'as':_0x5702('0x6a'),'raw':!![]});}var _0x55d1f2=[{'model':db['OpenchannelMessage'],'as':_0x5702('0x6b'),'attributes':['id',_0x5702('0x3c'),'createdAt','direction',_0x5702('0x6c'),_0x5702('0x6d')],'include':_0x42c024}];_0x55d1f2[_0x5702('0x65')]({'model':db['OpenchannelAccount'],'as':_0x5702('0x6e'),'attributes':['id',_0x5702('0x22')]});_0x55d1f2[_0x5702('0x65')]({'model':db['User'],'as':'Owner','attributes':['id',_0x5702('0x64')]});return db[_0x5702('0x26')][_0x5702('0x3a')]({'where':{'id':_0x46d2dc[_0x5702('0x31')]['id']},'include':_0x55d1f2})[_0x5702('0x1e')](handleEntityNotFound(_0x235cc8,null))[_0x5702('0x1e')](function(_0x5a666e){if(_0x5a666e){var _0xeaface=_0x5a666e[_0x5702('0x6f')]({'plain':!![]});fs['mkdirSync'](_0x1f2efb);var _0x3737bf={'channel':_0x5702('0x70'),'account':_0xeaface['Account']['name'],'agent':_0xeaface[_0x5702('0x71')]?_0xeaface[_0x5702('0x71')][_0x5702('0x64')]:'N.A.','createdAt':moment(_0xeaface[_0x5702('0x72')])[_0x5702('0x4c')](_0x5702('0x4d'))[_0x5702('0x5c')](),'closedAt':_0xeaface[_0x5702('0x73')]?moment(_0xeaface['closedAt'])['format'](_0x5702('0x4d'))[_0x5702('0x5c')]():'','disposition':_0xeaface[_0x5702('0x74')],'visibility':_0xeaface[_0x5702('0x75')]?_0x5702('0x76'):_0x5702('0x77'),'messages':_(_0xeaface[_0x5702('0x6b')])['filter']({'secret':![]})[_0x5702('0x25')](function(_0x531d47){if(_0x531d47[_0x5702('0x6a')]){var _0x143e3c=path['join'](_0x50244d,_0x531d47[_0x5702('0x6a')][_0x5702('0x78')]);if(fs[_0x5702('0x79')](_0x143e3c)){fs[_0x5702('0x7a')](_0x143e3c)[_0x5702('0x7b')](fs[_0x5702('0x7c')](path[_0x5702('0x5d')](_0x1f2efb,_0x531d47[_0x5702('0x6a')][_0x5702('0x78')])));}}return{'date':moment(_0x531d47['createdAt'])[_0x5702('0x4c')](_0x5702('0x4d'))[_0x5702('0x5c')](),'sender':_0x531d47[_0x5702('0x7d')]===_0x5702('0x7e')?_0x531d47[_0x5702('0x63')]?_0x531d47[_0x5702('0x63')][_0x5702('0x64')]:_0x5702('0x7f'):_0x531d47[_0x5702('0x80')][_0x5702('0x67')]+(_0x531d47['Contact']['lastName']?'\x20'+_0x531d47[_0x5702('0x80')][_0x5702('0x68')]:''),'body':_0x531d47[_0x5702('0x6a')]?_0x531d47['Attachment']['basename']:_0x531d47[_0x5702('0x3c')],'direction':_0x531d47[_0x5702('0x7d')]===_0x5702('0x7e')?'A':'C','secret':_0x531d47[_0x5702('0x6c')],'read':_0x531d47[_0x5702('0x6d')],'attachment':_0x531d47[_0x5702('0x6a')]};})['value']()};return ejs[_0x5702('0x81')](path[_0x5702('0x5d')](config['root'],'server',_0x5702('0x82'),'downloadInteraction.ejs'),{'interaction':_0x3737bf})[_0x5702('0x1e')](function(_0x3a6a55){var _0xa6a3a4=path['join'](_0x1f2efb,_0x5702('0x83')+_0xeaface['id']+'-'+_0x5b01fd+_0x5702('0x84'));var _0x5bb98c={'path':_0xa6a3a4,'channel':_0x5702('0x70'),'interactionId':_0xeaface['id']};return pdf[_0x5702('0x85')](_0x3a6a55,_0x5bb98c);})['then'](function(){return new Promise(function(_0x5be0cd,_0xc73ead){zipdir(_0x1f2efb,{'saveTo':_0x4ebf9e},function(_0x4a0b5c,_0x585439){if(_0x4a0b5c)return _0xc73ead(_0x4a0b5c);return _0x5be0cd(_0x585439);});})[_0x5702('0x1e')](function(){return new Promise(function(_0x4c71ad,_0x22443e){rimraf(_0x1f2efb,function(_0xbce283){if(_0xbce283)_0x22443e(_0xbce283);return _0x4c71ad();});});})['then'](function(){return _0x235cc8[_0x5702('0x5a')](_0x4ebf9e,_0x3226e7,function(_0x43b5e7){if(_0x43b5e7){logger[_0x5702('0x20')](_0x5702('0x86'),_0x43b5e7);}else{fs['unlinkSync'](_0x4ebf9e);}});});});}else{return _0x235cc8[_0x5702('0x13')](0xc8);}})[_0x5702('0x2e')](handleError(_0x235cc8,null));}; \ No newline at end of file +var _0xcf9a=['OpenchannelAccount','Account','name','Owner','get','Openchannel','format','toString','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','out','read','value','root','downloadInteraction.ejs','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','error','stack','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','count','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xcf9a,0x9a));var _0xacf9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcf9a[_0x465a0c];return _0x1e202e;};'use strict';var rimraf=require(_0xacf9('0x0'));var zipdir=require(_0xacf9('0x1'));var moment=require(_0xacf9('0x2'));var util=require(_0xacf9('0x3'));var path=require(_0xacf9('0x4'));var ejs=require(_0xacf9('0x5'));var fs=require('fs');var _=require(_0xacf9('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xacf9('0x7'));var pdf=require(_0xacf9('0x8'));var logger=require(_0xacf9('0x9'))(_0xacf9('0xa'));var config=require(_0xacf9('0xb'));var db=require(_0xacf9('0xc'))['db'];config[_0xacf9('0xd')]=_[_0xacf9('0xe')](config['redis'],{'host':_0xacf9('0xf'),'port':0x18eb});var socket=require(_0xacf9('0x10'))(new Redis(config[_0xacf9('0xd')]));require(_0xacf9('0x11'))[_0xacf9('0x12')](socket);function respondWithStatusCode(_0x5820db,_0x2a724f){_0x2a724f=_0x2a724f||0xcc;return function(_0x46fe79){if(_0x46fe79){return _0x5820db[_0xacf9('0x13')](_0x2a724f);}return _0x5820db[_0xacf9('0x14')](_0x2a724f)[_0xacf9('0x15')]();};}function respondWithResult(_0xfc9107,_0x9a7dac){_0x9a7dac=_0x9a7dac||0xc8;return function(_0x5402f9){if(_0x5402f9){return _0xfc9107[_0xacf9('0x14')](_0x9a7dac)[_0xacf9('0x16')](_0x5402f9);}};}function respondWithFilteredResult(_0x402519,_0x32dc6d){return function(_0x3551de){if(_0x3551de){var _0x5204a2=typeof _0x32dc6d[_0xacf9('0x17')]===_0xacf9('0x18')&&typeof _0x32dc6d[_0xacf9('0x19')]===_0xacf9('0x18');var _0x277421=_0x3551de['count'];var _0x4f5fbb=_0x5204a2?0x0:_0x32dc6d[_0xacf9('0x17')];var _0x5354a0=_0x5204a2?_0x3551de['count']:_0x32dc6d[_0xacf9('0x17')]+_0x32dc6d[_0xacf9('0x19')];var _0x490bfa;if(_0x5354a0>=_0x277421){_0x5354a0=_0x277421;_0x490bfa=0xc8;}else{_0x490bfa=0xce;}_0x402519['status'](_0x490bfa);return _0x402519[_0xacf9('0x1a')](_0xacf9('0x1b'),_0x4f5fbb+'-'+_0x5354a0+'/'+_0x277421)[_0xacf9('0x16')](_0x3551de);}return null;};}function saveUpdates(_0x3a68f7){return function(_0x5bc9f8){if(_0x5bc9f8){return _0x5bc9f8[_0xacf9('0x1c')](_0x3a68f7)[_0xacf9('0x1d')](function(_0x222740){return _0x222740;});}return null;};}function removeEntity(_0x3750db){return function(_0x3bac8a){if(_0x3bac8a){return _0x3bac8a['destroy']()['then'](function(){_0x3750db['status'](0xcc)[_0xacf9('0x15')]();});}};}function handleEntityNotFound(_0x1aeb4a){return function(_0x2b5a70){if(!_0x2b5a70){_0x1aeb4a[_0xacf9('0x13')](0x194);}return _0x2b5a70;};}function handleError(_0x54e4b3,_0x15125e){_0x15125e=_0x15125e||0x1f4;return function(_0x5434e2){logger[_0xacf9('0x1e')](_0x5434e2[_0xacf9('0x1f')]);if(_0x5434e2['name']){delete _0x5434e2['name'];}_0x54e4b3[_0xacf9('0x14')](_0x15125e)['send'](_0x5434e2);};}exports[_0xacf9('0x20')]=function(_0x4042f6,_0x690e9e){var _0x26afad={};var _0x338905=_[_0xacf9('0x21')](db[_0xacf9('0x22')][_0xacf9('0x23')],function(_0x5a7894){return{'name':_0x5a7894[_0xacf9('0x24')],'type':_0x5a7894[_0xacf9('0x25')][_0xacf9('0x26')]};});_0x26afad=qs[_0xacf9('0x27')](_0x338905,_0x4042f6);return interaction[_0xacf9('0x28')]('openchannel',_0x4042f6[_0xacf9('0x29')],_0x4042f6[_0xacf9('0x2a')],_0x26afad,_0x338905)[_0xacf9('0x1d')](respondWithFilteredResult(_0x690e9e,_0x26afad))['catch'](handleError(_0x690e9e,null));};exports[_0xacf9('0x2b')]=function(_0x1a40d4,_0x8961fa){var _0x567131={};if(_0x1a40d4[_0xacf9('0x29')][_0xacf9('0x25')]&&_0x1a40d4['query'][_0xacf9('0x25')]===_0xacf9('0x2c')){_0x567131[_0xacf9('0x2c')]=_0x1a40d4['params']['id'];}else{_0x567131['id']=_0x1a40d4[_0xacf9('0x2d')]['id'];}var _0x14cf46={'raw':![],'where':_0x567131},_0x5a0835={};_0x5a0835['model']=_[_0xacf9('0x2e')](db[_0xacf9('0x22')][_0xacf9('0x23')]);_0x5a0835[_0xacf9('0x29')]=_[_0xacf9('0x2e')](_0x1a40d4[_0xacf9('0x29')]);_0x5a0835[_0xacf9('0x2f')]=_[_0xacf9('0x30')](_0x5a0835[_0xacf9('0x31')],_0x5a0835[_0xacf9('0x29')]);_0x14cf46[_0xacf9('0x32')]=_[_0xacf9('0x30')](_0x5a0835['model'],qs['fields'](_0x1a40d4['query'][_0xacf9('0x33')]));_0x14cf46['attributes']=_0x14cf46['attributes'][_0xacf9('0x34')]?_0x14cf46[_0xacf9('0x32')]:_0x5a0835[_0xacf9('0x31')];if(_0x1a40d4[_0xacf9('0x29')][_0xacf9('0x35')]){_0x14cf46[_0xacf9('0x36')]=[{'all':!![]}];}_0x14cf46=_[_0xacf9('0x37')]({},_0x14cf46,_0x1a40d4[_0xacf9('0x38')]);return db[_0xacf9('0x22')][_0xacf9('0x39')](_0x14cf46)[_0xacf9('0x1d')](handleEntityNotFound(_0x8961fa,null))[_0xacf9('0x1d')](respondWithResult(_0x8961fa,null))[_0xacf9('0x3a')](handleError(_0x8961fa,null));};exports[_0xacf9('0x3b')]=function(_0x132a96,_0x38655d){return db[_0xacf9('0x22')]['create'](_0x132a96[_0xacf9('0x3c')],{})[_0xacf9('0x1d')](respondWithResult(_0x38655d,0xc9))[_0xacf9('0x3a')](handleError(_0x38655d,null));};exports[_0xacf9('0x1c')]=function(_0x323ea9,_0x44dfe0){if(_0x323ea9[_0xacf9('0x3c')]['id']){delete _0x323ea9[_0xacf9('0x3c')]['id'];}return db[_0xacf9('0x22')][_0xacf9('0x39')]({'where':{'id':_0x323ea9[_0xacf9('0x2d')]['id']}})[_0xacf9('0x1d')](handleEntityNotFound(_0x44dfe0,null))[_0xacf9('0x1d')](saveUpdates(_0x323ea9[_0xacf9('0x3c')],null))['then'](respondWithResult(_0x44dfe0,null))[_0xacf9('0x3a')](handleError(_0x44dfe0,null));};exports[_0xacf9('0x3d')]=function(_0x4c7f1a,_0x2e6a40){return db['OpenchannelInteraction'][_0xacf9('0x39')]({'where':{'id':_0x4c7f1a[_0xacf9('0x2d')]['id']}})[_0xacf9('0x1d')](handleEntityNotFound(_0x2e6a40,null))['then'](removeEntity(_0x2e6a40,null))[_0xacf9('0x3a')](handleError(_0x2e6a40,null));};exports[_0xacf9('0x3e')]=function(_0x3e7957,_0x1acee1){return db[_0xacf9('0x22')][_0xacf9('0x3e')]()['then'](respondWithResult(_0x1acee1,null))[_0xacf9('0x3a')](handleError(_0x1acee1,null));};exports['addMessage']=function(_0x5b4cf1,_0x4c234c){return db['OpenchannelMessage'][_0xacf9('0x39')]({'where':{'id':_0x5b4cf1[_0xacf9('0x2d')]['id']}})[_0xacf9('0x1d')](handleEntityNotFound(_0x4c234c,null))[_0xacf9('0x1d')](function(_0x4e2337){if(_0x4e2337){return _0x4e2337[_0xacf9('0x3f')](_0x5b4cf1[_0xacf9('0x3c')][_0xacf9('0x40')],_[_0xacf9('0x41')](_0x5b4cf1['body'],[_0xacf9('0x40'),'id'])||{});}})[_0xacf9('0x1d')](respondWithResult(_0x4c234c,null))[_0xacf9('0x3a')](handleError(_0x4c234c,null));};exports[_0xacf9('0x42')]=function(_0x3d03cf,_0x31fb48){var _0x5c0ce3={'raw':![],'where':{}};var _0x38e562={};var _0x3d8541={'count':0x0,'rows':[]};return db[_0xacf9('0x22')][_0xacf9('0x43')]({'where':{'id':_0x3d03cf['params']['id']}})[_0xacf9('0x1d')](handleEntityNotFound(_0x31fb48,null))[_0xacf9('0x1d')](function(_0x53826e){if(_0x53826e){_0x38e562['model']=_[_0xacf9('0x2e')](db[_0xacf9('0x44')][_0xacf9('0x23')]);_0x38e562['query']=_[_0xacf9('0x2e')](_0x3d03cf[_0xacf9('0x29')]);_0x38e562['filters']=_[_0xacf9('0x30')](_0x38e562['model'],_0x38e562['query']);_0x5c0ce3[_0xacf9('0x32')]=_[_0xacf9('0x30')](_0x38e562[_0xacf9('0x31')],qs[_0xacf9('0x33')](_0x3d03cf['query'][_0xacf9('0x33')]));_0x5c0ce3[_0xacf9('0x32')]=_0x5c0ce3[_0xacf9('0x32')]['length']?_0x5c0ce3[_0xacf9('0x32')]:_0x38e562['model'];if(!_0x3d03cf['query'][_0xacf9('0x45')](_0xacf9('0x46'))){_0x5c0ce3[_0xacf9('0x19')]=qs[_0xacf9('0x19')](_0x3d03cf['query'][_0xacf9('0x19')]);_0x5c0ce3[_0xacf9('0x17')]=qs['offset'](_0x3d03cf[_0xacf9('0x29')]['offset']);}_0x5c0ce3[_0xacf9('0x47')]=qs[_0xacf9('0x48')](_0x3d03cf['query'][_0xacf9('0x48')]);_0x5c0ce3[_0xacf9('0x49')]=qs[_0xacf9('0x2f')](_[_0xacf9('0x4a')](_0x3d03cf[_0xacf9('0x29')],_0x38e562[_0xacf9('0x2f')]));_0x5c0ce3[_0xacf9('0x49')]['OpenchannelInteractionId']=_0x53826e['id'];if(_0x3d03cf[_0xacf9('0x29')]['filter']){_0x5c0ce3[_0xacf9('0x49')]=_['merge'](_0x5c0ce3[_0xacf9('0x49')],{'$or':_[_0xacf9('0x21')](_0x5c0ce3[_0xacf9('0x32')],function(_0x6b403e){var _0xf85b6f={};_0xf85b6f[_0x6b403e]={'$like':'%'+_0x3d03cf[_0xacf9('0x29')][_0xacf9('0x4b')]+'%'};return _0xf85b6f;})});}if(_0x3d03cf[_0xacf9('0x29')]['$gte']){var _0x2c422d=_0x3d03cf[_0xacf9('0x29')][_0xacf9('0x4c')]['split'](',');var _0x31b3f3={};_0x31b3f3[_0x2c422d[0x0]]={'$gte':moment(_0x2c422d[0x1])['format'](_0xacf9('0x4d'))};_0x5c0ce3['where']=_[_0xacf9('0x37')](_0x5c0ce3[_0xacf9('0x49')],_0x31b3f3);}_0x5c0ce3=_['merge']({},_0x5c0ce3,_0x3d03cf[_0xacf9('0x38')]);return db[_0xacf9('0x44')][_0xacf9('0x4e')]({'where':_0x5c0ce3[_0xacf9('0x49')]})['then'](function(_0x5157ff){_0x3d8541['count']=_0x5157ff;if(_0x3d03cf['query']['includeAll']){_0x5c0ce3[_0xacf9('0x36')]=[{'all':!![]}];}return db[_0xacf9('0x44')][_0xacf9('0x28')](_0x5c0ce3);})['then'](function(_0x4c0bf1){_0x3d8541['rows']=_0x4c0bf1;return _0x3d8541;});}})['then'](respondWithFilteredResult(_0x31fb48,_0x5c0ce3))[_0xacf9('0x3a')](handleError(_0x31fb48,null));};exports[_0xacf9('0x4f')]=function(_0x560a11,_0x3eb29b){return db[_0xacf9('0x22')]['find']({'where':{'id':_0x560a11[_0xacf9('0x2d')]['id']}})['then'](handleEntityNotFound(_0x3eb29b,null))[_0xacf9('0x1d')](function(_0xae2aa2){if(_0xae2aa2){return _0xae2aa2['setTags'](_0x560a11[_0xacf9('0x3c')][_0xacf9('0x40')],_['omit'](_0x560a11['body'],['ids','id'])||{})[_0xacf9('0x50')](function(){return db[_0xacf9('0x51')][_0xacf9('0x28')]({'attributes':['id','name',_0xacf9('0x52')],'where':{'id':_0x560a11[_0xacf9('0x3c')][_0xacf9('0x40')]}});})[_0xacf9('0x1d')](function(_0x57ce50){socket[_0xacf9('0x53')](_0xacf9('0x54'),{'id':Number(_0x560a11[_0xacf9('0x2d')]['id']),'tags':_0x57ce50||[]});return{'id':Number(_0x560a11[_0xacf9('0x2d')]['id']),'tags':_0x57ce50||[]};});}})[_0xacf9('0x1d')](respondWithResult(_0x3eb29b,null))[_0xacf9('0x3a')](handleError(_0x3eb29b,null));};exports['removeTags']=function(_0x56a567,_0x2761ef){return db[_0xacf9('0x22')]['find']({'where':{'id':_0x56a567[_0xacf9('0x2d')]['id']}})[_0xacf9('0x1d')](handleEntityNotFound(_0x2761ef,null))[_0xacf9('0x1d')](function(_0x426f7f){if(_0x426f7f){return _0x426f7f[_0xacf9('0x55')](_0x56a567[_0xacf9('0x29')]['ids']);}})['then'](respondWithStatusCode(_0x2761ef,null))[_0xacf9('0x3a')](handleError(_0x2761ef,null));};exports['download']=function(_0xefc4da,_0x4bffa2){var _0x2cd932=moment()[_0xacf9('0x56')]()['toString']();var _0x5f2911=path['join'](config['root'],_0xacf9('0x57'),_0xacf9('0x58'),_0xacf9('0x59'));var _0x2e2e05=path[_0xacf9('0x5a')](config['root'],_0xacf9('0x57'),_0xacf9('0x58'),_0xacf9('0x5b'));var _0x1fff87=path[_0xacf9('0x5a')](_0x5f2911,_0x2cd932);var _0x46ddc4=util['format'](_0xacf9('0x5c'),_0xefc4da[_0xacf9('0x2d')]['id'],_0x2cd932);var _0x38251a=path['join'](_0x5f2911,_0x46ddc4);var _0x38954a=[];_0x38954a[_0xacf9('0x5d')]({'model':db[_0xacf9('0x5e')],'as':_0xacf9('0x5e'),'attributes':['id',_0xacf9('0x5f')],'raw':!![]});_0x38954a[_0xacf9('0x5d')]({'model':db['CmContact'],'as':_0xacf9('0x60'),'attributes':['id',_0xacf9('0x61'),_0xacf9('0x62')],'raw':!![]});if(_0xefc4da[_0xacf9('0x29')][_0xacf9('0x5b')]){_0x38954a[_0xacf9('0x5d')]({'model':db[_0xacf9('0x63')],'as':_0xacf9('0x63'),'raw':!![]});}var _0x38c66b=[{'model':db[_0xacf9('0x44')],'as':_0xacf9('0x64'),'attributes':['id','body',_0xacf9('0x65'),_0xacf9('0x66'),_0xacf9('0x67'),'read'],'include':_0x38954a}];_0x38c66b[_0xacf9('0x5d')]({'model':db[_0xacf9('0x68')],'as':_0xacf9('0x69'),'attributes':['id',_0xacf9('0x6a')]});_0x38c66b[_0xacf9('0x5d')]({'model':db['User'],'as':_0xacf9('0x6b'),'attributes':['id',_0xacf9('0x5f')]});return db[_0xacf9('0x22')][_0xacf9('0x39')]({'where':{'id':_0xefc4da['params']['id']},'include':_0x38c66b})[_0xacf9('0x1d')](handleEntityNotFound(_0x4bffa2,null))[_0xacf9('0x1d')](function(_0x1be0b1){if(_0x1be0b1){var _0x1da93e=_0x1be0b1[_0xacf9('0x6c')]({'plain':!![]});fs['mkdirSync'](_0x1fff87);var _0x35515d={'channel':_0xacf9('0x6d'),'account':_0x1da93e[_0xacf9('0x69')]['name'],'agent':_0x1da93e['Owner']?_0x1da93e[_0xacf9('0x6b')]['fullname']:'N.A.','createdAt':moment(_0x1da93e['createdAt'])[_0xacf9('0x6e')](_0xacf9('0x4d'))[_0xacf9('0x6f')](),'closedAt':_0x1da93e[_0xacf9('0x70')]?moment(_0x1da93e[_0xacf9('0x71')])['format'](_0xacf9('0x4d'))[_0xacf9('0x6f')]():'','disposition':_0x1da93e[_0xacf9('0x72')],'visibility':_0x1da93e[_0xacf9('0x73')]?'Public':_0xacf9('0x74'),'messages':_(_0x1da93e[_0xacf9('0x64')])['filter']({'secret':![]})[_0xacf9('0x21')](function(_0x1cb5ea){if(_0x1cb5ea['Attachment']){var _0xae0d83=path['join'](_0x2e2e05,_0x1cb5ea[_0xacf9('0x63')][_0xacf9('0x75')]);if(fs[_0xacf9('0x76')](_0xae0d83)){fs[_0xacf9('0x77')](_0xae0d83)['pipe'](fs['createWriteStream'](path['join'](_0x1fff87,_0x1cb5ea['Attachment'][_0xacf9('0x75')])));}}return{'date':moment(_0x1cb5ea['createdAt'])[_0xacf9('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')[_0xacf9('0x6f')](),'sender':_0x1cb5ea[_0xacf9('0x66')]===_0xacf9('0x78')?_0x1cb5ea[_0xacf9('0x5e')]?_0x1cb5ea[_0xacf9('0x5e')]['fullname']:'System':_0x1cb5ea[_0xacf9('0x60')][_0xacf9('0x61')]+(_0x1cb5ea[_0xacf9('0x60')][_0xacf9('0x62')]?'\x20'+_0x1cb5ea['Contact'][_0xacf9('0x62')]:''),'body':_0x1cb5ea[_0xacf9('0x63')]?_0x1cb5ea[_0xacf9('0x63')][_0xacf9('0x75')]:_0x1cb5ea[_0xacf9('0x3c')],'direction':_0x1cb5ea[_0xacf9('0x66')]===_0xacf9('0x78')?'A':'C','secret':_0x1cb5ea[_0xacf9('0x67')],'read':_0x1cb5ea[_0xacf9('0x79')],'attachment':_0x1cb5ea[_0xacf9('0x63')]};})[_0xacf9('0x7a')]()};return ejs['renderFile'](path['join'](config[_0xacf9('0x7b')],_0xacf9('0x57'),'views',_0xacf9('0x7c')),{'interaction':_0x35515d})['then'](function(_0x18306c){var _0x2b51ea=path[_0xacf9('0x5a')](_0x1fff87,'transcript-'+_0x1da93e['id']+'-'+_0x2cd932+'.pdf');var _0xa6e55c={'path':_0x2b51ea,'channel':'Openchannel','interactionId':_0x1da93e['id']};return pdf[_0xacf9('0x7d')](_0x18306c,_0xa6e55c);})['then'](function(){return new Promise(function(_0x1963c3,_0x3a6bb7){zipdir(_0x1fff87,{'saveTo':_0x38251a},function(_0x43191d,_0x5a1351){if(_0x43191d)return _0x3a6bb7(_0x43191d);return _0x1963c3(_0x5a1351);});})['then'](function(){return new Promise(function(_0xc2a8f,_0x3cb717){rimraf(_0x1fff87,function(_0x316190){if(_0x316190)_0x3cb717(_0x316190);return _0xc2a8f();});});})[_0xacf9('0x1d')](function(){return _0x4bffa2[_0xacf9('0x7e')](_0x38251a,_0x46ddc4,function(_0x298b82){if(_0x298b82){logger[_0xacf9('0x1e')](_0xacf9('0x7f'),_0x298b82);}else{fs[_0xacf9('0x80')](_0x38251a);}});});});}else{return _0x4bffa2[_0xacf9('0x13')](0xc8);}})[_0xacf9('0x3a')](handleError(_0x4bffa2,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1f51564..ca2943f 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 _0x5ef6=['update','remove','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x95eba8,_0x128c50){var _0x54f606=function(_0x75bbce){while(--_0x75bbce){_0x95eba8['push'](_0x95eba8['shift']());}};_0x54f606(++_0x128c50);}(_0x5ef6,0x1a1));var _0x65ef=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x5ef6[_0x29c261];return _0x1a9335;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x65ef('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x65ef('0x0'))['db'][_0x65ef('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x65ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65ef('0x3'),'afterDestroy':_0x65ef('0x4')};function emitEvent(_0xac4946){return function(_0x26dc12,_0x52fb36,_0x18e1db){_0x26dc12['getUsers']({'attributes':['id'],'raw':!![]})[_0x65ef('0x5')](function(_0x13d4c0){_0x26dc12[_0x65ef('0x6')](_0x65ef('0x7'),_0x13d4c0[_0x65ef('0x8')](function(_0x3029c0){return{'id':_0x3029c0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x26dc12['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x286c57){_0x26dc12[_0x65ef('0x6')]('unreadMessages',_0x286c57[_0x65ef('0x9')]);OpenchannelInteractionEvents[_0x65ef('0xa')](_0xac4946+':'+_0x26dc12['id'],_0x26dc12);OpenchannelInteractionEvents[_0x65ef('0xa')](_0xac4946,_0x26dc12);_0x18e1db(null);})[_0x65ef('0xb')](_0x18e1db(null));};}for(var e in events){if(events[_0x65ef('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x65ef('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x217c=['map','findAll','then','length','hasOwnProperty','hook','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','setDataValue','Users'];(function(_0xed4a34,_0x200e34){var _0x220305=function(_0x5d0159){while(--_0x5d0159){_0xed4a34['push'](_0xed4a34['shift']());}};_0x220305(++_0x200e34);}(_0x217c,0x1d7));var _0xc217=function(_0x11da8e,_0x1a129d){_0x11da8e=_0x11da8e-0x0;var _0x4d97f3=_0x217c[_0x11da8e];return _0x4d97f3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xc217('0x0'))['db'][_0xc217('0x1')];var OpenchannelMessage=require(_0xc217('0x0'))['db'][_0xc217('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc217('0x3'),'afterUpdate':_0xc217('0x4'),'afterDestroy':_0xc217('0x5')};function emitEvent(_0x2f760f){return function(_0x20dbe9,_0x31e788,_0x20ae85){_0x20dbe9[_0xc217('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xad74c3){_0x20dbe9[_0xc217('0x7')](_0xc217('0x8'),_0xad74c3[_0xc217('0x9')](function(_0x314f0f){return{'id':_0x314f0f['id']};}));return OpenchannelMessage[_0xc217('0xa')]({'where':{'OpenchannelInteractionId':_0x20dbe9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc217('0xb')](function(_0x1329c2){_0x20dbe9[_0xc217('0x7')]('unreadMessages',_0x1329c2[_0xc217('0xc')]);OpenchannelInteractionEvents['emit'](_0x2f760f+':'+_0x20dbe9['id'],_0x20dbe9);OpenchannelInteractionEvents['emit'](_0x2f760f,_0x20dbe9);_0x20ae85(null);})['catch'](_0x20ae85(null));};}for(var e in events){if(events[_0xc217('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xc217('0xe')](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 e800695..a0eb2c8 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 _0x7027=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x20ba6d,_0x256177){var _0x338188=function(_0x568977){while(--_0x568977){_0x20ba6d['push'](_0x20ba6d['shift']());}};_0x338188(++_0x256177);}(_0x7027,0x81));var _0x7702=function(_0x39ff94,_0x5af65f){_0x39ff94=_0x39ff94-0x0;var _0x4f1fb9=_0x7027[_0x39ff94];return _0x4f1fb9;};'use strict';var _=require(_0x7702('0x0'));var util=require(_0x7702('0x1'));var logger=require(_0x7702('0x2'))(_0x7702('0x3'));var moment=require(_0x7702('0x4'));var BPromise=require('bluebird');var rp=require(_0x7702('0x5'));var fs=require('fs');var path=require(_0x7702('0x6'));var rimraf=require(_0x7702('0x7'));var config=require(_0x7702('0x8'));var attributes=require(_0x7702('0x9'));module['exports']=function(_0x3f9c89,_0x53522b){return _0x3f9c89['define'](_0x7702('0xa'),attributes,{'tableName':_0x7702('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7702('0xc'),'collate':_0x7702('0xd'),'hooks':{'beforeUpdate':function(_0x43d329,_0x533c7f,_0x8743e9){if(_0x43d329[_0x7702('0xe')]('closed')){_0x43d329[_0x7702('0xf')]=moment()[_0x7702('0x10')](_0x7702('0x11'));}_0x8743e9(null,_0x43d329);}}});}; \ No newline at end of file +var _0x961e=['request-promise','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x961e,0xd2));var _0xe961=function(_0x127362,_0x57f0e8){_0x127362=_0x127362-0x0;var _0x3df58b=_0x961e[_0x127362];return _0x3df58b;};'use strict';var _=require(_0xe961('0x0'));var util=require(_0xe961('0x1'));var logger=require(_0xe961('0x2'))(_0xe961('0x3'));var moment=require(_0xe961('0x4'));var BPromise=require(_0xe961('0x5'));var rp=require(_0xe961('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe961('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xe961('0x8')]=function(_0x5c33dc,_0x4d913d){return _0x5c33dc[_0xe961('0x9')](_0xe961('0xa'),attributes,{'tableName':_0xe961('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe961('0xc'),'collate':_0xe961('0xd'),'hooks':{'beforeUpdate':function(_0x21bfb1,_0x471930,_0x2d8af7){if(_0x21bfb1[_0xe961('0xe')](_0xe961('0xf'))){_0x21bfb1[_0xe961('0x10')]=moment()['format'](_0xe961('0x11'));}_0x2d8af7(null,_0x21bfb1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index a5533e0..12ccbc9 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 _0xdd3d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','moment'];(function(_0x2d946d,_0x4c2c73){var _0x4872fa=function(_0x51d62a){while(--_0x51d62a){_0x2d946d['push'](_0x2d946d['shift']());}};_0x4872fa(++_0x4c2c73);}(_0xdd3d,0x1cc));var _0xddd3=function(_0x209dde,_0x2cd93c){_0x209dde=_0x209dde-0x0;var _0x146dad=_0xdd3d[_0x209dde];return _0x146dad;};'use strict';var _=require(_0xddd3('0x0'));var util=require('util');var moment=require(_0xddd3('0x1'));var BPromise=require(_0xddd3('0x2'));var rs=require(_0xddd3('0x3'));var fs=require('fs');var Redis=require(_0xddd3('0x4'));var db=require(_0xddd3('0x5'))['db'];var utils=require(_0xddd3('0x6'));var logger=require(_0xddd3('0x7'))(_0xddd3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddd3('0x9')]({'port':0x232a});config[_0xddd3('0xa')]=_[_0xddd3('0xb')](config[_0xddd3('0xa')],{'host':_0xddd3('0xc'),'port':0x18eb});var socket=require(_0xddd3('0xd'))(new Redis(config[_0xddd3('0xa')]));require('./openchannelInteraction.socket')[_0xddd3('0xe')](socket);function respondWithRpcPromise(_0x294dad,_0xbceb06,_0x2c3d21){return new BPromise(function(_0x1d3a2e,_0x20ff6c){return client[_0xddd3('0xf')](_0x294dad,_0x2c3d21)[_0xddd3('0x10')](function(_0x5b68f4){logger[_0xddd3('0x11')](_0xddd3('0x12'),_0xbceb06,_0xddd3('0x13'));logger['debug'](_0xddd3('0x14'),_0xbceb06,_0xddd3('0x13'),JSON[_0xddd3('0x15')](_0x5b68f4));if(_0x5b68f4[_0xddd3('0x16')]){if(_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x17')]===0x1f4){logger[_0xddd3('0x16')](_0xddd3('0x12'),_0xbceb06,_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x18')]);return _0x20ff6c(_0x5b68f4['error'][_0xddd3('0x18')]);}logger['error'](_0xddd3('0x12'),_0xbceb06,_0x5b68f4[_0xddd3('0x16')][_0xddd3('0x18')]);return _0x1d3a2e(_0x5b68f4['error'][_0xddd3('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0xbceb06,_0xddd3('0x13'));_0x1d3a2e(_0x5b68f4[_0xddd3('0x19')][_0xddd3('0x18')]);}})[_0xddd3('0x1a')](function(_0x1cecc4){logger[_0xddd3('0x16')](_0xddd3('0x12'),_0xbceb06,_0x1cecc4);_0x20ff6c(_0x1cecc4);});});}exports[_0xddd3('0x1b')]=function(_0x32e681){var _0x4c5c84=this;return new Promise(function(_0x365929,_0x491aae){return db[_0xddd3('0x1c')][_0xddd3('0x1d')](_0x32e681[_0xddd3('0x1e')],{'raw':_0x32e681['options']?_0x32e681[_0xddd3('0x1f')][_0xddd3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e681[_0xddd3('0x1f')]?_0x32e681['options'][_0xddd3('0x21')]||null:null,'attributes':_0x32e681[_0xddd3('0x1f')]?_0x32e681[_0xddd3('0x1f')][_0xddd3('0x22')]||null:null,'limit':_0x32e681[_0xddd3('0x1f')]?_0x32e681['options'][_0xddd3('0x23')]||null:null})[_0xddd3('0x10')](function(_0x14dfbb){logger['info'](_0xddd3('0x1b'),_0x32e681);logger[_0xddd3('0x24')](_0xddd3('0x1b'),_0x32e681,JSON[_0xddd3('0x15')](_0x14dfbb));_0x365929(_0x14dfbb);})[_0xddd3('0x1a')](function(_0x2e2cdd){logger[_0xddd3('0x16')]('UpdateOpenchannelInteraction',_0x2e2cdd[_0xddd3('0x18')],_0x32e681);_0x491aae(_0x4c5c84['error'](0x1f4,_0x2e2cdd['message']));});});};exports[_0xddd3('0x25')]=function(_0x5cb19c){return new Promise(function(_0xde01e0,_0x5bb4a9){return db[_0xddd3('0x1c')]['find']({'where':_0x5cb19c[_0xddd3('0x1f')]?_0x5cb19c[_0xddd3('0x1f')]['where']||null:null})[_0xddd3('0x10')](function(_0x20d93c){if(_0x20d93c){return _0x20d93c[_0xddd3('0x26')](_0x5cb19c[_0xddd3('0x1e')][_0xddd3('0x27')],_[_0xddd3('0x28')](_0x5cb19c[_0xddd3('0x1e')],['ids','id'])||{});}})['spread'](function(_0x5336f8){logger[_0xddd3('0x11')]('AddTags',_0x5cb19c);logger[_0xddd3('0x24')]('AddTags',_0x5cb19c,JSON[_0xddd3('0x15')](_0x5336f8));_0xde01e0(_0x5336f8);})['catch'](function(_0x421ce7){logger[_0xddd3('0x16')](_0xddd3('0x29'),_0x421ce7[_0xddd3('0x18')],_0x5cb19c);_0x5bb4a9(_this[_0xddd3('0x16')](0x1f4,_0x421ce7['message']));});});}; \ No newline at end of file +var _0xa5f1=['UpdateOpenchannelInteraction','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelInteraction','body','options','raw','where','attributes','limit','then','debug'];(function(_0x65e687,_0x2bdaa5){var _0x5d5621=function(_0x5a39f9){while(--_0x5a39f9){_0x65e687['push'](_0x65e687['shift']());}};_0x5d5621(++_0x2bdaa5);}(_0xa5f1,0x1f4));var _0x1a5f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa5f1[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x1a5f('0x0'));var util=require(_0x1a5f('0x1'));var moment=require(_0x1a5f('0x2'));var BPromise=require(_0x1a5f('0x3'));var rs=require(_0x1a5f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a5f('0x5'));var logger=require(_0x1a5f('0x6'))('rpc');var config=require(_0x1a5f('0x7'));var jayson=require(_0x1a5f('0x8'));var client=jayson[_0x1a5f('0x9')][_0x1a5f('0xa')]({'port':0x232a});config[_0x1a5f('0xb')]=_[_0x1a5f('0xc')](config[_0x1a5f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a5f('0xd'))(new Redis(config['redis']));require(_0x1a5f('0xe'))['register'](socket);function respondWithRpcPromise(_0xd42398,_0x3c913b,_0x56331c){return new BPromise(function(_0x1f24c0,_0x1d2171){return client[_0x1a5f('0xf')](_0xd42398,_0x56331c)['then'](function(_0x342af6){logger[_0x1a5f('0x10')](_0x1a5f('0x11'),_0x3c913b,_0x1a5f('0x12'));logger['debug'](_0x1a5f('0x13'),_0x3c913b,'request\x20sent',JSON[_0x1a5f('0x14')](_0x342af6));if(_0x342af6[_0x1a5f('0x15')]){if(_0x342af6['error'][_0x1a5f('0x16')]===0x1f4){logger[_0x1a5f('0x15')](_0x1a5f('0x11'),_0x3c913b,_0x342af6[_0x1a5f('0x15')][_0x1a5f('0x17')]);return _0x1d2171(_0x342af6[_0x1a5f('0x15')]['message']);}logger[_0x1a5f('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3c913b,_0x342af6[_0x1a5f('0x15')][_0x1a5f('0x17')]);return _0x1f24c0(_0x342af6[_0x1a5f('0x15')]['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3c913b,_0x1a5f('0x12'));_0x1f24c0(_0x342af6['result'][_0x1a5f('0x17')]);}})['catch'](function(_0x1d0bdb){logger[_0x1a5f('0x15')](_0x1a5f('0x11'),_0x3c913b,_0x1d0bdb);_0x1d2171(_0x1d0bdb);});});}exports['UpdateOpenchannelInteraction']=function(_0x170e07){var _0x3a6b29=this;return new Promise(function(_0x2271d6,_0x123558){return db[_0x1a5f('0x18')]['update'](_0x170e07[_0x1a5f('0x19')],{'raw':_0x170e07[_0x1a5f('0x1a')]?_0x170e07[_0x1a5f('0x1a')][_0x1a5f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170e07[_0x1a5f('0x1a')]?_0x170e07[_0x1a5f('0x1a')][_0x1a5f('0x1c')]||null:null,'attributes':_0x170e07[_0x1a5f('0x1a')]?_0x170e07[_0x1a5f('0x1a')][_0x1a5f('0x1d')]||null:null,'limit':_0x170e07[_0x1a5f('0x1a')]?_0x170e07[_0x1a5f('0x1a')][_0x1a5f('0x1e')]||null:null})[_0x1a5f('0x1f')](function(_0x789302){logger[_0x1a5f('0x10')]('UpdateOpenchannelInteraction',_0x170e07);logger[_0x1a5f('0x20')](_0x1a5f('0x21'),_0x170e07,JSON['stringify'](_0x789302));_0x2271d6(_0x789302);})[_0x1a5f('0x22')](function(_0x3cbb9d){logger[_0x1a5f('0x15')](_0x1a5f('0x21'),_0x3cbb9d[_0x1a5f('0x17')],_0x170e07);_0x123558(_0x3a6b29[_0x1a5f('0x15')](0x1f4,_0x3cbb9d['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1b8069){return new Promise(function(_0x58b236,_0xd8caa6){return db['OpenchannelInteraction'][_0x1a5f('0x23')]({'where':_0x1b8069['options']?_0x1b8069[_0x1a5f('0x1a')][_0x1a5f('0x1c')]||null:null})[_0x1a5f('0x1f')](function(_0x19205d){if(_0x19205d){return _0x19205d[_0x1a5f('0x24')](_0x1b8069[_0x1a5f('0x19')][_0x1a5f('0x25')],_[_0x1a5f('0x26')](_0x1b8069[_0x1a5f('0x19')],[_0x1a5f('0x25'),'id'])||{});}})[_0x1a5f('0x27')](function(_0x3c5312){logger[_0x1a5f('0x10')]('AddTags',_0x1b8069);logger[_0x1a5f('0x20')](_0x1a5f('0x28'),_0x1b8069,JSON[_0x1a5f('0x14')](_0x3c5312));_0x58b236(_0x3c5312);})[_0x1a5f('0x22')](function(_0x286f7a){logger[_0x1a5f('0x15')](_0x1a5f('0x28'),_0x286f7a[_0x1a5f('0x17')],_0x1b8069);_0xd8caa6(_this['error'](0x1f4,_0x286f7a[_0x1a5f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 889a44e..cbb8339 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 _0xb2dc=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove'];(function(_0x564b0f,_0xbc0201){var _0x5220a4=function(_0x2dec72){while(--_0x2dec72){_0x564b0f['push'](_0x564b0f['shift']());}};_0x5220a4(++_0xbc0201);}(_0xb2dc,0xfa));var _0xcb2d=function(_0x16bf26,_0x224b74){_0x16bf26=_0x16bf26-0x0;var _0x377e93=_0xb2dc[_0x16bf26];return _0x377e93;};'use strict';var OpenchannelInteractionEvents=require(_0xcb2d('0x0'));var events=['save',_0xcb2d('0x1'),'update'];function createListener(_0x3ebee9,_0x36b800){return function(_0x2050a0){_0x36b800[_0xcb2d('0x2')](_0x3ebee9,_0x2050a0);};}function removeListener(_0x4a2059,_0x142ef4){return function(){OpenchannelInteractionEvents[_0xcb2d('0x3')](_0x4a2059,_0x142ef4);};}exports['register']=function(_0x4c13e1){for(var _0x372c39=0x0,_0x5c3a90=events[_0xcb2d('0x4')];_0x372c39<_0x5c3a90;_0x372c39++){var _0x4e3df1=events[_0x372c39];var _0x3d4236=createListener(_0xcb2d('0x5')+_0x4e3df1,_0x4c13e1);OpenchannelInteractionEvents['on'](_0x4e3df1,_0x3d4236);}}; \ No newline at end of file +var _0xab72=['./openchannelInteraction.events','save','remove','removeListener','register','length','openchannelInteraction:'];(function(_0x3d6fc3,_0x8cb1b9){var _0x359eee=function(_0x958397){while(--_0x958397){_0x3d6fc3['push'](_0x3d6fc3['shift']());}};_0x359eee(++_0x8cb1b9);}(_0xab72,0xb6));var _0x2ab7=function(_0x5b254c,_0x5e6f7f){_0x5b254c=_0x5b254c-0x0;var _0x4ef921=_0xab72[_0x5b254c];return _0x4ef921;};'use strict';var OpenchannelInteractionEvents=require(_0x2ab7('0x0'));var events=[_0x2ab7('0x1'),_0x2ab7('0x2'),'update'];function createListener(_0x1aacac,_0x113542){return function(_0x5851b3){_0x113542['emit'](_0x1aacac,_0x5851b3);};}function removeListener(_0x147f23,_0x2f58bd){return function(){OpenchannelInteractionEvents[_0x2ab7('0x3')](_0x147f23,_0x2f58bd);};}exports[_0x2ab7('0x4')]=function(_0x19ac82){for(var _0x40a921=0x0,_0x91c53f=events[_0x2ab7('0x5')];_0x40a921<_0x91c53f;_0x40a921++){var _0x5610a4=events[_0x40a921];var _0x834a1d=createListener(_0x2ab7('0x6')+_0x5610a4,_0x19ac82);OpenchannelInteractionEvents['on'](_0x5610a4,_0x834a1d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index afb8ddc..bcda5a2 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x236028,_0x430735){_0x236028=_0x236028-0x0;var _0x14338d=_0x70e0[_0x236028];return _0x14338d;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x19b26d,_0x147e71){var _0x502f37=function(_0x3d6faf){while(--_0x3d6faf){_0x19b26d['push'](_0x19b26d['shift']());}};_0x502f37(++_0x147e71);}(_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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2b254f5..599d34d 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 _0x9861=['out','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x533b33,_0x1690bf){var _0x50d6f6=function(_0x29bedb){while(--_0x29bedb){_0x533b33['push'](_0x533b33['shift']());}};_0x50d6f6(++_0x1690bf);}(_0x9861,0x176));var _0x1986=function(_0xb07ec8,_0x4ec78b){_0xb07ec8=_0xb07ec8-0x0;var _0x56cf8c=_0x9861[_0xb07ec8];return _0x56cf8c;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1986('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1986('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1986('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1986('0x3')]('in',_0x1986('0x4')),'defaultValue':_0x1986('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x1986('0x5')]},'providerResponse':{'type':Sequelize[_0x1986('0x6')]}}; \ No newline at end of file +var _0x0825=['TEXT','sequelize','exports','BOOLEAN','out','DATE','STRING'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x0825,0x1e4));var _0x5082=function(_0xb0372b,_0x3e974c){_0xb0372b=_0xb0372b-0x0;var _0x2733d6=_0x0825[_0xb0372b];return _0x2733d6;};'use strict';var Sequelize=require(_0x5082('0x0'));module[_0x5082('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5082('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5082('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5082('0x3')),'defaultValue':_0x5082('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5082('0x4')]},'providerName':{'type':Sequelize[_0x5082('0x5')]},'providerResponse':{'type':Sequelize[_0x5082('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0e565a3..04fd7c5 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 _0xc690=['includeAll','include','findAll','rows','catch','show','params','keys','OpenchannelMessage','length','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','email','internal','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','agent','SIP/%s','rejectmessage','rimraf','request-promise','moment','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0xc690,0x1b8));var _0x0c69=function(_0xbf2ad2,_0x360d77){_0xbf2ad2=_0xbf2ad2-0x0;var _0x56a440=_0xc690[_0xbf2ad2];return _0x56a440;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c69('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c69('0x1'));var moment=require(_0x0c69('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c69('0x3'));var path=require('path');var sox=require(_0x0c69('0x4'));var csv=require(_0x0c69('0x5'));var ejs=require(_0x0c69('0x6'));var fs=require('fs');var fs_extra=require(_0x0c69('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c69('0x8'));var jsforce=require(_0x0c69('0x9'));var deskjs=require(_0x0c69('0xa'));var toCsv=require(_0x0c69('0x5'));var querystring=require(_0x0c69('0xb'));var Papa=require('papaparse');var Redis=require(_0x0c69('0xc'));var authService=require(_0x0c69('0xd'));var qs=require(_0x0c69('0xe'));var as=require(_0x0c69('0xf'));var hardwareService=require(_0x0c69('0x10'));var logger=require(_0x0c69('0x11'))('api');var utils=require(_0x0c69('0x12'));var config=require(_0x0c69('0x13'));var licenseUtil=require(_0x0c69('0x14'));var db=require(_0x0c69('0x15'))['db'];config['redis']=_[_0x0c69('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c69('0x17'))(new Redis(config[_0x0c69('0x18')]));require(_0x0c69('0x19'))[_0x0c69('0x1a')](socket);var jayson=require(_0x0c69('0x1b'));var client=jayson[_0x0c69('0x1c')][_0x0c69('0x1d')]({'port':0x232c});var client9002=jayson[_0x0c69('0x1c')][_0x0c69('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1ad0b3,_0x16da0e,_0x476a77,_0x4ab1bc){return new BPromise(function(_0x367dba,_0x150349){var _0x256896=_0x4ab1bc||client;return _0x256896[_0x0c69('0x1e')](_0x1ad0b3,_0x476a77)[_0x0c69('0x1f')](function(_0x56a972){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x16da0e,_0x0c69('0x20'));logger['debug'](_0x0c69('0x21'),_0x16da0e,_0x0c69('0x20'),JSON[_0x0c69('0x22')](_0x56a972));if(_0x56a972[_0x0c69('0x23')]){if(_0x56a972[_0x0c69('0x23')][_0x0c69('0x24')]===0x1f4){logger['error'](_0x0c69('0x25'),_0x16da0e,_0x56a972['error'][_0x0c69('0x26')]);return _0x150349(_0x56a972[_0x0c69('0x23')]['message']);}logger[_0x0c69('0x23')](_0x0c69('0x25'),_0x16da0e,_0x56a972[_0x0c69('0x23')][_0x0c69('0x26')]);return _0x367dba(_0x56a972['error'][_0x0c69('0x26')]);}else{logger[_0x0c69('0x27')](_0x0c69('0x25'),_0x16da0e,_0x0c69('0x20'));_0x367dba(_0x56a972[_0x0c69('0x28')][_0x0c69('0x26')]);}})['catch'](function(_0x3ce1da){logger[_0x0c69('0x23')](_0x0c69('0x25'),_0x16da0e,_0x3ce1da);_0x150349(_0x3ce1da);});});}function respondWithStatusCode(_0x1d0291,_0x50550a){_0x50550a=_0x50550a||0xcc;return function(_0x38f734){if(_0x38f734){return _0x1d0291[_0x0c69('0x29')](_0x50550a);}return _0x1d0291[_0x0c69('0x2a')](_0x50550a)[_0x0c69('0x2b')]();};}function respondWithResult(_0x2cf105,_0x53113a){_0x53113a=_0x53113a||0xc8;return function(_0x3a13fa){if(_0x3a13fa){return _0x2cf105['status'](_0x53113a)[_0x0c69('0x2c')](_0x3a13fa);}};}function respondWithFilteredResult(_0xd21feb,_0x3b817){return function(_0x3c7737){if(_0x3c7737){var _0x41e189=typeof _0x3b817[_0x0c69('0x2d')]===_0x0c69('0x2e')&&typeof _0x3b817[_0x0c69('0x2f')]===_0x0c69('0x2e');var _0x3746bc=_0x3c7737[_0x0c69('0x30')];var _0x1cbeb4=_0x41e189?0x0:_0x3b817['offset'];var _0x10a756=_0x41e189?_0x3c7737[_0x0c69('0x30')]:_0x3b817[_0x0c69('0x2d')]+_0x3b817[_0x0c69('0x2f')];var _0x23e587;if(_0x10a756>=_0x3746bc){_0x10a756=_0x3746bc;_0x23e587=0xc8;}else{_0x23e587=0xce;}_0xd21feb[_0x0c69('0x2a')](_0x23e587);return _0xd21feb[_0x0c69('0x31')]('Content-Range',_0x1cbeb4+'-'+_0x10a756+'/'+_0x3746bc)['json'](_0x3c7737);}return null;};}function patchUpdates(_0x2db44c){return function(_0x6dc200){try{jsonpatch[_0x0c69('0x32')](_0x6dc200,_0x2db44c,!![]);}catch(_0x58c471){return BPromise[_0x0c69('0x33')](_0x58c471);}return _0x6dc200[_0x0c69('0x34')]();};}function saveUpdates(_0x3af862,_0x28edd6){return function(_0x2ed545){if(_0x2ed545){return _0x2ed545[_0x0c69('0x35')](_0x3af862)[_0x0c69('0x1f')](function(_0xcd7ecf){return _0xcd7ecf;});}return null;};}function removeEntity(_0x18b4a9,_0x12e920){return function(_0x3b7a42){if(_0x3b7a42){return _0x3b7a42[_0x0c69('0x36')]()['then'](function(){_0x18b4a9[_0x0c69('0x2a')](0xcc)[_0x0c69('0x2b')]();});}};}function handleEntityNotFound(_0x28c8b4,_0x76365f){return function(_0x29f1ae){if(!_0x29f1ae){_0x28c8b4[_0x0c69('0x29')](0x194);}return _0x29f1ae;};}function handleError(_0x106fa6,_0x4894e9){_0x4894e9=_0x4894e9||0x1f4;return function(_0x45da52){logger[_0x0c69('0x23')](_0x45da52['stack']);if(_0x45da52['name']){delete _0x45da52[_0x0c69('0x37')];}_0x106fa6[_0x0c69('0x2a')](_0x4894e9)[_0x0c69('0x38')](_0x45da52);};}exports[_0x0c69('0x39')]=function(_0x39d328,_0x12f0fa){var _0x412848={},_0x1b63dc={},_0xe79a2={'count':0x0,'rows':[]};var _0x1a701b=_[_0x0c69('0x3a')](db['OpenchannelMessage'][_0x0c69('0x3b')],function(_0x2c83f4){return{'name':_0x2c83f4[_0x0c69('0x3c')],'type':_0x2c83f4[_0x0c69('0x3d')]['key']};});_0x1b63dc['model']=_[_0x0c69('0x3a')](_0x1a701b,'name');_0x1b63dc[_0x0c69('0x3e')]=_['keys'](_0x39d328[_0x0c69('0x3e')]);_0x1b63dc[_0x0c69('0x3f')]=_['intersection'](_0x1b63dc[_0x0c69('0x40')],_0x1b63dc[_0x0c69('0x3e')]);_0x412848[_0x0c69('0x41')]=_[_0x0c69('0x42')](_0x1b63dc[_0x0c69('0x40')],qs[_0x0c69('0x43')](_0x39d328[_0x0c69('0x3e')][_0x0c69('0x43')]));_0x412848[_0x0c69('0x41')]=_0x412848[_0x0c69('0x41')]['length']?_0x412848[_0x0c69('0x41')]:_0x1b63dc[_0x0c69('0x40')];if(!_0x39d328[_0x0c69('0x3e')]['hasOwnProperty']('nolimit')){_0x412848[_0x0c69('0x2f')]=qs[_0x0c69('0x2f')](_0x39d328['query']['limit']);_0x412848[_0x0c69('0x2d')]=qs[_0x0c69('0x2d')](_0x39d328[_0x0c69('0x3e')][_0x0c69('0x2d')]);}_0x412848[_0x0c69('0x44')]=qs[_0x0c69('0x45')](_0x39d328[_0x0c69('0x3e')]['sort']);_0x412848[_0x0c69('0x46')]=qs[_0x0c69('0x3f')](_[_0x0c69('0x47')](_0x39d328[_0x0c69('0x3e')],_0x1b63dc[_0x0c69('0x3f')]),_0x1a701b);if(_0x39d328[_0x0c69('0x3e')]['filter']){_0x412848[_0x0c69('0x46')]=_[_0x0c69('0x48')](_0x412848[_0x0c69('0x46')],{'$or':_[_0x0c69('0x3a')](_0x1a701b,function(_0x1f97d4){if(_0x1f97d4[_0x0c69('0x3d')]!==_0x0c69('0x49')){var _0x27741b={};_0x27741b[_0x1f97d4[_0x0c69('0x37')]]={'$like':'%'+_0x39d328[_0x0c69('0x3e')][_0x0c69('0x4a')]+'%'};return _0x27741b;}})});}_0x412848=_[_0x0c69('0x48')]({},_0x412848,_0x39d328[_0x0c69('0x4b')]);var _0x2659a5={'where':_0x412848[_0x0c69('0x46')]};return db['OpenchannelMessage'][_0x0c69('0x30')](_0x2659a5)[_0x0c69('0x1f')](function(_0x1bce85){_0xe79a2[_0x0c69('0x30')]=_0x1bce85;if(_0x39d328['query'][_0x0c69('0x4c')]){_0x412848[_0x0c69('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0c69('0x4e')](_0x412848);})[_0x0c69('0x1f')](function(_0x24281e){_0xe79a2[_0x0c69('0x4f')]=_0x24281e;return _0xe79a2;})[_0x0c69('0x1f')](respondWithFilteredResult(_0x12f0fa,_0x412848))[_0x0c69('0x50')](handleError(_0x12f0fa,null));};exports[_0x0c69('0x51')]=function(_0x534352,_0x264bc1){var _0x44f014={'raw':!![],'where':{'id':_0x534352[_0x0c69('0x52')]['id']}},_0x4c5cd8={};_0x4c5cd8[_0x0c69('0x40')]=_[_0x0c69('0x53')](db[_0x0c69('0x54')]['rawAttributes']);_0x4c5cd8['query']=_[_0x0c69('0x53')](_0x534352[_0x0c69('0x3e')]);_0x4c5cd8[_0x0c69('0x3f')]=_[_0x0c69('0x42')](_0x4c5cd8[_0x0c69('0x40')],_0x4c5cd8['query']);_0x44f014[_0x0c69('0x41')]=_['intersection'](_0x4c5cd8['model'],qs[_0x0c69('0x43')](_0x534352[_0x0c69('0x3e')][_0x0c69('0x43')]));_0x44f014[_0x0c69('0x41')]=_0x44f014[_0x0c69('0x41')][_0x0c69('0x55')]?_0x44f014[_0x0c69('0x41')]:_0x4c5cd8[_0x0c69('0x40')];if(_0x534352['query'][_0x0c69('0x4c')]){_0x44f014[_0x0c69('0x4d')]=[{'all':!![]}];}_0x44f014=_[_0x0c69('0x48')]({},_0x44f014,_0x534352[_0x0c69('0x4b')]);return db[_0x0c69('0x54')][_0x0c69('0x56')](_0x44f014)[_0x0c69('0x1f')](handleEntityNotFound(_0x264bc1,null))['then'](respondWithResult(_0x264bc1,null))[_0x0c69('0x50')](handleError(_0x264bc1,null));};exports[_0x0c69('0x57')]=function(_0x559cc3,_0x152629){return db[_0x0c69('0x54')][_0x0c69('0x57')](_0x559cc3[_0x0c69('0x58')],{})[_0x0c69('0x1f')](respondWithResult(_0x152629,0xc9))[_0x0c69('0x50')](handleError(_0x152629,null));};exports[_0x0c69('0x35')]=function(_0x2b52f8,_0x1dc818){if(_0x2b52f8[_0x0c69('0x58')]['id']){delete _0x2b52f8[_0x0c69('0x58')]['id'];}return db[_0x0c69('0x54')]['find']({'where':{'id':_0x2b52f8[_0x0c69('0x52')]['id']}})[_0x0c69('0x1f')](handleEntityNotFound(_0x1dc818,null))['then'](saveUpdates(_0x2b52f8[_0x0c69('0x58')],null))[_0x0c69('0x1f')](respondWithResult(_0x1dc818,null))[_0x0c69('0x50')](handleError(_0x1dc818,null));};exports[_0x0c69('0x36')]=function(_0xda4dee,_0x50810e){return db[_0x0c69('0x54')][_0x0c69('0x56')]({'where':{'id':_0xda4dee[_0x0c69('0x52')]['id']}})[_0x0c69('0x1f')](handleEntityNotFound(_0x50810e,null))[_0x0c69('0x1f')](removeEntity(_0x50810e,null))['catch'](handleError(_0x50810e,null));};exports[_0x0c69('0x59')]=function(_0x38d32f,_0x8c2416){return db[_0x0c69('0x54')][_0x0c69('0x59')]()[_0x0c69('0x1f')](respondWithResult(_0x8c2416,null))[_0x0c69('0x50')](handleError(_0x8c2416,null));};var interaction_log=require(_0x0c69('0x11'))(_0x0c69('0x5a'));exports[_0x0c69('0x5b')]=function(_0x1244e2,_0x1603f9,_0xe35deb){var _0x1f2515={'agent':{},'channel':_0x0c69('0x5c')};if(_0x1244e2[_0x0c69('0x58')]['id']){delete _0x1244e2[_0x0c69('0x58')]['id'];}_0x1244e2[_0x0c69('0x58')][_0x0c69('0x5d')]=!![];_0x1244e2[_0x0c69('0x58')][_0x0c69('0x5e')]=moment()[_0x0c69('0x5f')](_0x0c69('0x60'));_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')]=_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')]||_0x1244e2[_0x0c69('0x62')]['id'];_0x1f2515['agent']['id']=_0x1244e2[_0x0c69('0x58')]['UserId'];return db[_0x0c69('0x54')]['find']({'where':{'id':_0x1244e2[_0x0c69('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1603f9,null))['then'](saveUpdates(_0x1244e2[_0x0c69('0x58')],null))[_0x0c69('0x1f')](function(_0x19b4df){if(_0x19b4df){_0x1f2515[_0x0c69('0x26')]=_0x19b4df[_0x0c69('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0c69('0x56')]({'where':{'id':_0x19b4df['OpenchannelInteractionId']}});}return null;})[_0x0c69('0x1f')](handleEntityNotFound(_0x1603f9,null))[_0x0c69('0x1f')](function(_0x27ab94){if(_0x27ab94){return _0x27ab94[_0x0c69('0x35')]({'UserId':_0x1244e2['body'][_0x0c69('0x61')],'read1stAt':_[_0x0c69('0x64')](_0x27ab94[_0x0c69('0x65')])?moment()['format'](_0x0c69('0x60')):undefined});}return null;})[_0x0c69('0x1f')](function(_0x1f454d){if(_0x1f454d){_0x1f2515['interaction']=_0x1f454d['get']({'plain':!![]});interaction_log[_0x0c69('0x27')](_0x0c69('0x66'),_0x1244e2[_0x0c69('0x62')]['id'],_0x1244e2[_0x0c69('0x62')][_0x0c69('0x37')],_0x1244e2['user'][_0x0c69('0x67')],_0x1f2515[_0x0c69('0x68')]['id'],_0x1244e2[_0x0c69('0x58')]?JSON[_0x0c69('0x22')](_0x1244e2[_0x0c69('0x58')]):_0x0c69('0x69'));return respondWithRpcPromise(_0x0c69('0x6a'),_0x0c69('0x6b'),_0x1f2515);}return null;})[_0x0c69('0x1f')](function(_0x5089ea){var _0x5a95b0=_0x0c69('0x6c')+_0x5089ea[_0x0c69('0x26')]['ContactId'];return db['sequelize']['query'](_0x5a95b0,{'type':db['Sequelize'][_0x0c69('0x6d')][_0x0c69('0x6e')],'raw':!![]})[_0x0c69('0x1f')](function(_0x2a2f9b){return _0x2a2f9b;});})[_0x0c69('0x1f')](function(_0x5543d8){if(_0x5543d8){_0x1f2515[_0x0c69('0x26')][_0x0c69('0x6f')]=_0x5543d8[0x0];if(!_0x1244e2[_0x0c69('0x58')][_0x0c69('0x61')])return;return db[_0x0c69('0x70')][_0x0c69('0x56')]({'where':{'id':_0x1244e2['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x0c69('0x71'),_0x0c69('0x72'),_0x0c69('0x73')],'raw':!![]});}return null;})['then'](function(_0x2ca74c){if(!_0x2ca74c)return null;_0x1f2515[_0x0c69('0x26')]['agent']=_0x2ca74c;return _0x1f2515;})['then'](function(_0x523185){if(_0x523185){if(_0x1244e2[_0x0c69('0x58')]['manual']){_0x1f2515[_0x0c69('0x26')]['interface']=util[_0x0c69('0x5f')]('SIP/%s',_0x1244e2[_0x0c69('0x62')]['name']);_0x1f2515[_0x0c69('0x26')][_0x0c69('0x74')]=_0x1f2515['channel'];_0x1f2515[_0x0c69('0x26')][_0x0c69('0x75')]=_0x1f2515[_0x0c69('0x74')];_0x1f2515[_0x0c69('0x26')][_0x0c69('0x76')]=_0x0c69('0x5b');return respondWithRpcPromise(_0x0c69('0x77'),'EventManager',{'event':_0x0c69('0x78'),'message':_0x1f2515[_0x0c69('0x26')]},client9002)[_0x0c69('0x1f')](function(){return _0x1f2515;});}return _0x1f2515;}return null;})[_0x0c69('0x1f')](respondWithResult(_0x1603f9,null))['catch'](handleError(_0x1603f9,null));};var interaction_log=require(_0x0c69('0x11'))('openchannel-interactions');exports[_0x0c69('0x33')]=function(_0x5ddb9c,_0x512e21,_0x1a9acb){var _0x17497c={'agent':{},'channel':_0x0c69('0x5c')};if(_0x5ddb9c[_0x0c69('0x58')]['id']){delete _0x5ddb9c[_0x0c69('0x58')]['id'];}_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')]=_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')]||_0x5ddb9c[_0x0c69('0x62')]['id'];_0x17497c['agent']['id']=_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')];return db[_0x0c69('0x54')]['find']({'where':{'id':_0x5ddb9c[_0x0c69('0x52')]['id'],'UserId':null}})[_0x0c69('0x1f')](handleEntityNotFound(_0x512e21,null))[_0x0c69('0x1f')](function(_0x54c456){if(_0x54c456){_0x17497c[_0x0c69('0x26')]=_0x54c456[_0x0c69('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x0c69('0x56')]({'where':{'id':_0x54c456['OpenchannelInteractionId']}});}return null;})[_0x0c69('0x1f')](handleEntityNotFound(_0x512e21,null))[_0x0c69('0x1f')](function(_0xe52a4f){if(_0xe52a4f){_0x17497c[_0x0c69('0x68')]=_0xe52a4f[_0x0c69('0x63')]({'plain':!![]});interaction_log[_0x0c69('0x27')](_0x0c69('0x79'),_0x5ddb9c[_0x0c69('0x62')]['id'],_0x5ddb9c[_0x0c69('0x62')]['name'],_0x5ddb9c[_0x0c69('0x62')][_0x0c69('0x67')],_0x17497c[_0x0c69('0x68')]['id'],_0x5ddb9c[_0x0c69('0x58')]?JSON[_0x0c69('0x22')](_0x5ddb9c[_0x0c69('0x58')]):'null');return respondWithRpcPromise(_0x0c69('0x7a'),_0x0c69('0x7b'),_0x17497c);}return null;})[_0x0c69('0x1f')](function(_0xb5dce5){var _0x223175='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xb5dce5[_0x0c69('0x26')]['ContactId'];return db[_0x0c69('0x7c')][_0x0c69('0x3e')](_0x223175,{'type':db[_0x0c69('0x7d')][_0x0c69('0x6d')]['SELECT'],'raw':!![]})[_0x0c69('0x1f')](function(_0xbea6bd){return _0xbea6bd;});})['then'](function(_0x19b843){if(_0x19b843){_0x17497c['message'][_0x0c69('0x6f')]=_0x19b843[0x0];if(!_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')])return;return db[_0x0c69('0x70')]['find']({'where':{'id':_0x5ddb9c[_0x0c69('0x58')][_0x0c69('0x61')],'role':_0x0c69('0x7e')},'attributes':['id','name',_0x0c69('0x71'),_0x0c69('0x72'),_0x0c69('0x73')],'raw':!![]});}return null;})[_0x0c69('0x1f')](function(_0x214e69){if(!_0x214e69)return null;_0x17497c['message'][_0x0c69('0x7e')]=_0x214e69;return _0x17497c;})[_0x0c69('0x1f')](function(_0x117aec){if(_0x117aec){_0x117aec[_0x0c69('0x26')]['interface']=util[_0x0c69('0x5f')](_0x0c69('0x7f'),_0x5ddb9c[_0x0c69('0x62')][_0x0c69('0x37')]);_0x117aec[_0x0c69('0x26')][_0x0c69('0x74')]=_0x17497c['channel'];_0x117aec['message'][_0x0c69('0x75')]=_0x17497c[_0x0c69('0x74')];_0x117aec['message'][_0x0c69('0x76')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x0c69('0x80'),'message':_0x117aec[_0x0c69('0x26')]},client9002);return _0x17497c;}return null;})[_0x0c69('0x1f')](respondWithResult(_0x512e21,null))[_0x0c69('0x50')](handleError(_0x512e21,null));}; \ No newline at end of file +var _0x83da=['interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','sequelize','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual'];(function(_0x25ff14,_0x384501){var _0x1eef4d=function(_0x6df658){while(--_0x6df658){_0x25ff14['push'](_0x25ff14['shift']());}};_0x1eef4d(++_0x384501);}(_0x83da,0x115));var _0xa83d=function(_0x57d258,_0x4ad15e){_0x57d258=_0x57d258-0x0;var _0x3ba38e=_0x83da[_0x57d258];return _0x3ba38e;};'use strict';var emlformat=require(_0xa83d('0x0'));var rimraf=require(_0xa83d('0x1'));var zipdir=require(_0xa83d('0x2'));var jsonpatch=require(_0xa83d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa83d('0x4'));var Mustache=require(_0xa83d('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa83d('0x6'));var csv=require('to-csv');var ejs=require(_0xa83d('0x7'));var fs=require('fs');var fs_extra=require(_0xa83d('0x8'));var _=require(_0xa83d('0x9'));var squel=require(_0xa83d('0xa'));var crypto=require(_0xa83d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa83d('0xc'));var toCsv=require(_0xa83d('0xd'));var querystring=require(_0xa83d('0xe'));var Papa=require(_0xa83d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa83d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa83d('0x11'));var logger=require(_0xa83d('0x12'))('api');var utils=require(_0xa83d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa83d('0x14'));var db=require(_0xa83d('0x15'))['db'];config[_0xa83d('0x16')]=_[_0xa83d('0x17')](config[_0xa83d('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa83d('0x16')]));require(_0xa83d('0x18'))['register'](socket);var jayson=require(_0xa83d('0x19'));var client=jayson[_0xa83d('0x1a')][_0xa83d('0x1b')]({'port':0x232c});var client9002=jayson[_0xa83d('0x1a')][_0xa83d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x89b34f,_0x4032ae,_0x169cf9,_0x42d122){return new BPromise(function(_0x47b3f9,_0xae5365){var _0x14e74f=_0x42d122||client;return _0x14e74f[_0xa83d('0x1c')](_0x89b34f,_0x169cf9)[_0xa83d('0x1d')](function(_0x54e3a6){logger[_0xa83d('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x4032ae,_0xa83d('0x1f'));logger['debug'](_0xa83d('0x20'),_0x4032ae,'request\x20sent',JSON['stringify'](_0x54e3a6));if(_0x54e3a6['error']){if(_0x54e3a6[_0xa83d('0x21')]['code']===0x1f4){logger[_0xa83d('0x21')](_0xa83d('0x22'),_0x4032ae,_0x54e3a6[_0xa83d('0x21')][_0xa83d('0x23')]);return _0xae5365(_0x54e3a6[_0xa83d('0x21')]['message']);}logger['error'](_0xa83d('0x22'),_0x4032ae,_0x54e3a6[_0xa83d('0x21')][_0xa83d('0x23')]);return _0x47b3f9(_0x54e3a6['error']['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4032ae,'request\x20sent');_0x47b3f9(_0x54e3a6[_0xa83d('0x24')]['message']);}})['catch'](function(_0x100b1d){logger[_0xa83d('0x21')](_0xa83d('0x22'),_0x4032ae,_0x100b1d);_0xae5365(_0x100b1d);});});}function respondWithStatusCode(_0x152aa6,_0x22f152){_0x22f152=_0x22f152||0xcc;return function(_0xf97ddb){if(_0xf97ddb){return _0x152aa6[_0xa83d('0x25')](_0x22f152);}return _0x152aa6[_0xa83d('0x26')](_0x22f152)[_0xa83d('0x27')]();};}function respondWithResult(_0x3dbd79,_0x1f595c){_0x1f595c=_0x1f595c||0xc8;return function(_0x2b84f3){if(_0x2b84f3){return _0x3dbd79['status'](_0x1f595c)[_0xa83d('0x28')](_0x2b84f3);}};}function respondWithFilteredResult(_0x4d5b2a,_0x35f1d7){return function(_0x45ebae){if(_0x45ebae){var _0x1e8895=typeof _0x35f1d7[_0xa83d('0x29')]==='undefined'&&typeof _0x35f1d7[_0xa83d('0x2a')]===_0xa83d('0x2b');var _0x32f87f=_0x45ebae[_0xa83d('0x2c')];var _0x453a69=_0x1e8895?0x0:_0x35f1d7[_0xa83d('0x29')];var _0x119956=_0x1e8895?_0x45ebae['count']:_0x35f1d7[_0xa83d('0x29')]+_0x35f1d7[_0xa83d('0x2a')];var _0x4df867;if(_0x119956>=_0x32f87f){_0x119956=_0x32f87f;_0x4df867=0xc8;}else{_0x4df867=0xce;}_0x4d5b2a[_0xa83d('0x26')](_0x4df867);return _0x4d5b2a[_0xa83d('0x2d')]('Content-Range',_0x453a69+'-'+_0x119956+'/'+_0x32f87f)[_0xa83d('0x28')](_0x45ebae);}return null;};}function patchUpdates(_0x2a6d93){return function(_0x222bd7){try{jsonpatch[_0xa83d('0x2e')](_0x222bd7,_0x2a6d93,!![]);}catch(_0x1f672c){return BPromise[_0xa83d('0x2f')](_0x1f672c);}return _0x222bd7[_0xa83d('0x30')]();};}function saveUpdates(_0x48991a,_0x331fd1){return function(_0x1decc5){if(_0x1decc5){return _0x1decc5[_0xa83d('0x31')](_0x48991a)[_0xa83d('0x1d')](function(_0x268c56){return _0x268c56;});}return null;};}function removeEntity(_0x40495c,_0x4517c9){return function(_0x22e172){if(_0x22e172){return _0x22e172['destroy']()[_0xa83d('0x1d')](function(){_0x40495c[_0xa83d('0x26')](0xcc)[_0xa83d('0x27')]();});}};}function handleEntityNotFound(_0x3f80f4,_0x32a4c6){return function(_0x4e0965){if(!_0x4e0965){_0x3f80f4[_0xa83d('0x25')](0x194);}return _0x4e0965;};}function handleError(_0x2b8c7d,_0x164c2d){_0x164c2d=_0x164c2d||0x1f4;return function(_0x8917fc){logger[_0xa83d('0x21')](_0x8917fc['stack']);if(_0x8917fc[_0xa83d('0x32')]){delete _0x8917fc['name'];}_0x2b8c7d[_0xa83d('0x26')](_0x164c2d)[_0xa83d('0x33')](_0x8917fc);};}exports[_0xa83d('0x34')]=function(_0x26fa14,_0x17a716){var _0x388f38={},_0x52ec4f={},_0x20ddb0={'count':0x0,'rows':[]};var _0x4d3aec=_[_0xa83d('0x35')](db[_0xa83d('0x36')][_0xa83d('0x37')],function(_0x55c8e9){return{'name':_0x55c8e9[_0xa83d('0x38')],'type':_0x55c8e9['type'][_0xa83d('0x39')]};});_0x52ec4f[_0xa83d('0x3a')]=_[_0xa83d('0x35')](_0x4d3aec,_0xa83d('0x32'));_0x52ec4f[_0xa83d('0x3b')]=_[_0xa83d('0x3c')](_0x26fa14[_0xa83d('0x3b')]);_0x52ec4f['filters']=_[_0xa83d('0x3d')](_0x52ec4f[_0xa83d('0x3a')],_0x52ec4f['query']);_0x388f38[_0xa83d('0x3e')]=_[_0xa83d('0x3d')](_0x52ec4f['model'],qs['fields'](_0x26fa14[_0xa83d('0x3b')][_0xa83d('0x3f')]));_0x388f38['attributes']=_0x388f38[_0xa83d('0x3e')]['length']?_0x388f38['attributes']:_0x52ec4f[_0xa83d('0x3a')];if(!_0x26fa14[_0xa83d('0x3b')][_0xa83d('0x40')](_0xa83d('0x41'))){_0x388f38['limit']=qs[_0xa83d('0x2a')](_0x26fa14['query'][_0xa83d('0x2a')]);_0x388f38['offset']=qs[_0xa83d('0x29')](_0x26fa14[_0xa83d('0x3b')]['offset']);}_0x388f38[_0xa83d('0x42')]=qs[_0xa83d('0x43')](_0x26fa14[_0xa83d('0x3b')][_0xa83d('0x43')]);_0x388f38['where']=qs['filters'](_[_0xa83d('0x44')](_0x26fa14['query'],_0x52ec4f[_0xa83d('0x45')]),_0x4d3aec);if(_0x26fa14[_0xa83d('0x3b')][_0xa83d('0x46')]){_0x388f38[_0xa83d('0x47')]=_[_0xa83d('0x48')](_0x388f38[_0xa83d('0x47')],{'$or':_[_0xa83d('0x35')](_0x4d3aec,function(_0x4456a4){if(_0x4456a4['type']!=='VIRTUAL'){var _0x80215={};_0x80215[_0x4456a4[_0xa83d('0x32')]]={'$like':'%'+_0x26fa14[_0xa83d('0x3b')][_0xa83d('0x46')]+'%'};return _0x80215;}})});}_0x388f38=_[_0xa83d('0x48')]({},_0x388f38,_0x26fa14[_0xa83d('0x49')]);var _0x27a86c={'where':_0x388f38[_0xa83d('0x47')]};return db[_0xa83d('0x36')][_0xa83d('0x2c')](_0x27a86c)[_0xa83d('0x1d')](function(_0xdfd08f){_0x20ddb0[_0xa83d('0x2c')]=_0xdfd08f;if(_0x26fa14['query'][_0xa83d('0x4a')]){_0x388f38['include']=[{'all':!![]}];}return db[_0xa83d('0x36')][_0xa83d('0x4b')](_0x388f38);})[_0xa83d('0x1d')](function(_0x254467){_0x20ddb0[_0xa83d('0x4c')]=_0x254467;return _0x20ddb0;})[_0xa83d('0x1d')](respondWithFilteredResult(_0x17a716,_0x388f38))[_0xa83d('0x4d')](handleError(_0x17a716,null));};exports[_0xa83d('0x4e')]=function(_0x475096,_0xb8b066){var _0x163c25={'raw':!![],'where':{'id':_0x475096[_0xa83d('0x4f')]['id']}},_0x34cb83={};_0x34cb83[_0xa83d('0x3a')]=_[_0xa83d('0x3c')](db['OpenchannelMessage'][_0xa83d('0x37')]);_0x34cb83[_0xa83d('0x3b')]=_[_0xa83d('0x3c')](_0x475096['query']);_0x34cb83[_0xa83d('0x45')]=_[_0xa83d('0x3d')](_0x34cb83['model'],_0x34cb83['query']);_0x163c25['attributes']=_[_0xa83d('0x3d')](_0x34cb83[_0xa83d('0x3a')],qs[_0xa83d('0x3f')](_0x475096['query'][_0xa83d('0x3f')]));_0x163c25[_0xa83d('0x3e')]=_0x163c25[_0xa83d('0x3e')]['length']?_0x163c25[_0xa83d('0x3e')]:_0x34cb83[_0xa83d('0x3a')];if(_0x475096[_0xa83d('0x3b')][_0xa83d('0x4a')]){_0x163c25[_0xa83d('0x50')]=[{'all':!![]}];}_0x163c25=_[_0xa83d('0x48')]({},_0x163c25,_0x475096[_0xa83d('0x49')]);return db[_0xa83d('0x36')][_0xa83d('0x51')](_0x163c25)[_0xa83d('0x1d')](handleEntityNotFound(_0xb8b066,null))[_0xa83d('0x1d')](respondWithResult(_0xb8b066,null))[_0xa83d('0x4d')](handleError(_0xb8b066,null));};exports['create']=function(_0x2173f9,_0xba6a22){return db[_0xa83d('0x36')][_0xa83d('0x52')](_0x2173f9[_0xa83d('0x53')],{})['then'](respondWithResult(_0xba6a22,0xc9))[_0xa83d('0x4d')](handleError(_0xba6a22,null));};exports['update']=function(_0x88f208,_0x512f6e){if(_0x88f208[_0xa83d('0x53')]['id']){delete _0x88f208[_0xa83d('0x53')]['id'];}return db[_0xa83d('0x36')]['find']({'where':{'id':_0x88f208['params']['id']}})[_0xa83d('0x1d')](handleEntityNotFound(_0x512f6e,null))[_0xa83d('0x1d')](saveUpdates(_0x88f208[_0xa83d('0x53')],null))[_0xa83d('0x1d')](respondWithResult(_0x512f6e,null))[_0xa83d('0x4d')](handleError(_0x512f6e,null));};exports[_0xa83d('0x54')]=function(_0x56decf,_0x65cd33){return db[_0xa83d('0x36')][_0xa83d('0x51')]({'where':{'id':_0x56decf[_0xa83d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x65cd33,null))[_0xa83d('0x1d')](removeEntity(_0x65cd33,null))['catch'](handleError(_0x65cd33,null));};exports['describe']=function(_0x4092c4,_0x291059){return db[_0xa83d('0x36')][_0xa83d('0x55')]()[_0xa83d('0x1d')](respondWithResult(_0x291059,null))[_0xa83d('0x4d')](handleError(_0x291059,null));};var interaction_log=require('../../config/logger')(_0xa83d('0x56'));exports[_0xa83d('0x57')]=function(_0xc9cfd1,_0x3741f2,_0xf32af7){var _0x2d0094={'agent':{},'channel':_0xa83d('0x58')};if(_0xc9cfd1[_0xa83d('0x53')]['id']){delete _0xc9cfd1[_0xa83d('0x53')]['id'];}_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x59')]=!![];_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x5a')]=moment()['format'](_0xa83d('0x5b'));_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x5c')]=_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x5c')]||_0xc9cfd1['user']['id'];_0x2d0094[_0xa83d('0x5d')]['id']=_0xc9cfd1['body'][_0xa83d('0x5c')];return db['OpenchannelMessage'][_0xa83d('0x51')]({'where':{'id':_0xc9cfd1[_0xa83d('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3741f2,null))[_0xa83d('0x1d')](saveUpdates(_0xc9cfd1[_0xa83d('0x53')],null))['then'](function(_0x4f91ba){if(_0x4f91ba){_0x2d0094[_0xa83d('0x23')]=_0x4f91ba[_0xa83d('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa83d('0x51')]({'where':{'id':_0x4f91ba[_0xa83d('0x5f')]}});}return null;})[_0xa83d('0x1d')](handleEntityNotFound(_0x3741f2,null))['then'](function(_0x1a150e){if(_0x1a150e){return _0x1a150e['update']({'UserId':_0xc9cfd1['body'][_0xa83d('0x5c')],'read1stAt':_[_0xa83d('0x60')](_0x1a150e[_0xa83d('0x61')])?moment()['format'](_0xa83d('0x5b')):undefined});}return null;})['then'](function(_0x18b00e){if(_0x18b00e){_0x2d0094['interaction']=_0x18b00e[_0xa83d('0x5e')]({'plain':!![]});interaction_log[_0xa83d('0x1e')](_0xa83d('0x62'),_0xc9cfd1[_0xa83d('0x63')]['id'],_0xc9cfd1[_0xa83d('0x63')][_0xa83d('0x32')],_0xc9cfd1['user'][_0xa83d('0x64')],_0x2d0094['interaction']['id'],_0xc9cfd1[_0xa83d('0x53')]?JSON['stringify'](_0xc9cfd1[_0xa83d('0x53')]):'null');return respondWithRpcPromise(_0xa83d('0x65'),_0xa83d('0x66'),_0x2d0094);}return null;})[_0xa83d('0x1d')](function(_0x2ae302){var _0x476a90=_0xa83d('0x67')+_0x2ae302[_0xa83d('0x23')][_0xa83d('0x68')];return db['sequelize'][_0xa83d('0x3b')](_0x476a90,{'type':db[_0xa83d('0x69')][_0xa83d('0x6a')][_0xa83d('0x6b')],'raw':!![]})[_0xa83d('0x1d')](function(_0x3233e5){return _0x3233e5;});})[_0xa83d('0x1d')](function(_0x223f9b){if(_0x223f9b){_0x2d0094[_0xa83d('0x23')][_0xa83d('0x6c')]=_0x223f9b[0x0];if(!_0xc9cfd1[_0xa83d('0x53')]['UserId'])return;return db[_0xa83d('0x6d')][_0xa83d('0x51')]({'where':{'id':_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x5c')],'role':_0xa83d('0x5d')},'attributes':['id',_0xa83d('0x32'),_0xa83d('0x6e'),_0xa83d('0x6f'),'internal'],'raw':!![]});}return null;})[_0xa83d('0x1d')](function(_0x3d9cb0){if(!_0x3d9cb0)return null;_0x2d0094[_0xa83d('0x23')][_0xa83d('0x5d')]=_0x3d9cb0;return _0x2d0094;})[_0xa83d('0x1d')](function(_0x537bd4){if(_0x537bd4){if(_0xc9cfd1[_0xa83d('0x53')][_0xa83d('0x70')]){_0x2d0094[_0xa83d('0x23')][_0xa83d('0x71')]=util[_0xa83d('0x72')](_0xa83d('0x73'),_0xc9cfd1[_0xa83d('0x63')]['name']);_0x2d0094[_0xa83d('0x23')][_0xa83d('0x74')]=_0x2d0094[_0xa83d('0x74')];_0x2d0094['message'][_0xa83d('0x75')]=_0x2d0094['channel'];_0x2d0094[_0xa83d('0x23')][_0xa83d('0x76')]='accept';return respondWithRpcPromise('EventManager',_0xa83d('0x77'),{'event':_0xa83d('0x78'),'message':_0x2d0094[_0xa83d('0x23')]},client9002)[_0xa83d('0x1d')](function(){return _0x2d0094;});}return _0x2d0094;}return null;})['then'](respondWithResult(_0x3741f2,null))[_0xa83d('0x4d')](handleError(_0x3741f2,null));};var interaction_log=require(_0xa83d('0x12'))('openchannel-interactions');exports['reject']=function(_0x1aed8c,_0x316a92,_0x100024){var _0x369c3c={'agent':{},'channel':'openchannel'};if(_0x1aed8c[_0xa83d('0x53')]['id']){delete _0x1aed8c['body']['id'];}_0x1aed8c[_0xa83d('0x53')][_0xa83d('0x5c')]=_0x1aed8c[_0xa83d('0x53')][_0xa83d('0x5c')]||_0x1aed8c[_0xa83d('0x63')]['id'];_0x369c3c[_0xa83d('0x5d')]['id']=_0x1aed8c[_0xa83d('0x53')][_0xa83d('0x5c')];return db[_0xa83d('0x36')][_0xa83d('0x51')]({'where':{'id':_0x1aed8c[_0xa83d('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x316a92,null))['then'](function(_0x5ae696){if(_0x5ae696){_0x369c3c['message']=_0x5ae696[_0xa83d('0x5e')]({'plain':!![]});return db[_0xa83d('0x79')]['find']({'where':{'id':_0x5ae696[_0xa83d('0x5f')]}});}return null;})[_0xa83d('0x1d')](handleEntityNotFound(_0x316a92,null))[_0xa83d('0x1d')](function(_0x1fdab0){if(_0x1fdab0){_0x369c3c['interaction']=_0x1fdab0[_0xa83d('0x5e')]({'plain':!![]});interaction_log[_0xa83d('0x1e')](_0xa83d('0x7a'),_0x1aed8c[_0xa83d('0x63')]['id'],_0x1aed8c[_0xa83d('0x63')][_0xa83d('0x32')],_0x1aed8c[_0xa83d('0x63')][_0xa83d('0x64')],_0x369c3c['interaction']['id'],_0x1aed8c[_0xa83d('0x53')]?JSON[_0xa83d('0x7b')](_0x1aed8c[_0xa83d('0x53')]):_0xa83d('0x7c'));return respondWithRpcPromise(_0xa83d('0x7d'),_0xa83d('0x7e'),_0x369c3c);}return null;})[_0xa83d('0x1d')](function(_0xa55b66){var _0xbefc7f=_0xa83d('0x67')+_0xa55b66['message'][_0xa83d('0x68')];return db[_0xa83d('0x7f')]['query'](_0xbefc7f,{'type':db[_0xa83d('0x69')][_0xa83d('0x6a')][_0xa83d('0x6b')],'raw':!![]})[_0xa83d('0x1d')](function(_0xd80e7a){return _0xd80e7a;});})[_0xa83d('0x1d')](function(_0x1001e6){if(_0x1001e6){_0x369c3c[_0xa83d('0x23')]['contact']=_0x1001e6[0x0];if(!_0x1aed8c[_0xa83d('0x53')][_0xa83d('0x5c')])return;return db[_0xa83d('0x6d')][_0xa83d('0x51')]({'where':{'id':_0x1aed8c['body'][_0xa83d('0x5c')],'role':_0xa83d('0x5d')},'attributes':['id','name',_0xa83d('0x6e'),_0xa83d('0x6f'),_0xa83d('0x80')],'raw':!![]});}return null;})[_0xa83d('0x1d')](function(_0x5dd3fb){if(!_0x5dd3fb)return null;_0x369c3c[_0xa83d('0x23')][_0xa83d('0x5d')]=_0x5dd3fb;return _0x369c3c;})[_0xa83d('0x1d')](function(_0x495d46){if(_0x495d46){_0x495d46[_0xa83d('0x23')]['interface']=util[_0xa83d('0x72')](_0xa83d('0x73'),_0x1aed8c[_0xa83d('0x63')][_0xa83d('0x32')]);_0x495d46[_0xa83d('0x23')][_0xa83d('0x74')]=_0x369c3c['channel'];_0x495d46['message']['motionChannel']=_0x369c3c[_0xa83d('0x74')];_0x495d46[_0xa83d('0x23')]['event']=_0xa83d('0x2f');respondWithRpcPromise(_0xa83d('0x77'),_0xa83d('0x77'),{'event':_0xa83d('0x81'),'message':_0x495d46['message']},client9002);return _0x369c3c;}return null;})['then'](respondWithResult(_0x316a92,null))['catch'](handleError(_0x316a92,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c4b5d0c..5cec8c3 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 _0xb57f=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','emit'];(function(_0x17aa68,_0x340a68){var _0x58f216=function(_0xe0981f){while(--_0xe0981f){_0x17aa68['push'](_0x17aa68['shift']());}};_0x58f216(++_0x340a68);}(_0xb57f,0xa3));var _0xfb57=function(_0x31616b,_0x362e3b){_0x31616b=_0x31616b-0x0;var _0x570931=_0xb57f[_0x31616b];return _0x570931;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfb57('0x0'))['db'][_0xfb57('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfb57('0x2')](0x0);var events={'afterCreate':_0xfb57('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54d676){return function(_0x3c3f47,_0x57b239,_0x123475){OpenchannelMessageEvents['emit'](_0x54d676+':'+_0x3c3f47['id'],_0x3c3f47);OpenchannelMessageEvents[_0xfb57('0x4')](_0x54d676,_0x3c3f47);_0x123475(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xfb57('0x5')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x179a=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x220a8d,_0x586ff1){var _0x2167f8=function(_0x40d8d7){while(--_0x40d8d7){_0x220a8d['push'](_0x220a8d['shift']());}};_0x2167f8(++_0x586ff1);}(_0x179a,0xd7));var _0xa179=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x179a[_0x1bd323];return _0x13097b;};'use strict';var EventEmitter=require(_0xa179('0x0'));var OpenchannelMessage=require(_0xa179('0x1'))['db'][_0xa179('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa179('0x3')](0x0);var events={'afterCreate':_0xa179('0x4'),'afterUpdate':_0xa179('0x5'),'afterDestroy':_0xa179('0x6')};function emitEvent(_0x97b087){return function(_0x384dd4,_0x40b13d,_0x2bfc62){OpenchannelMessageEvents[_0xa179('0x7')](_0x97b087+':'+_0x384dd4['id'],_0x384dd4);OpenchannelMessageEvents['emit'](_0x97b087,_0x384dd4);_0x2bfc62(null);};}for(var e in events){if(events[_0xa179('0x8')](e)){var event=events[e];OpenchannelMessage[_0xa179('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 15217e8..f2ee67e 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 _0xe7e4=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','out','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','then','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','POST','method','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch'];(function(_0x5bdd96,_0x178a4f){var _0x31625b=function(_0x4e8535){while(--_0x4e8535){_0x5bdd96['push'](_0x5bdd96['shift']());}};_0x31625b(++_0x178a4f);}(_0xe7e4,0xc1));var _0x4e7e=function(_0x556a98,_0xc65176){_0x556a98=_0x556a98-0x0;var _0x1d0d5f=_0xe7e4[_0x556a98];return _0x1d0d5f;};'use strict';var _=require(_0x4e7e('0x0'));var util=require(_0x4e7e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e7e('0x2'));var rp=require(_0x4e7e('0x3'));var fs=require('fs');var path=require(_0x4e7e('0x4'));var rimraf=require(_0x4e7e('0x5'));var config=require(_0x4e7e('0x6'));var attributes=require(_0x4e7e('0x7'));module[_0x4e7e('0x8')]=function(_0x37a160,_0x4b153c){return _0x37a160[_0x4e7e('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4e7e('0xa'),'fields':['body'],'type':_0x4e7e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e1e15,_0x553532,_0x298ce7){var _0x516559=_0x37a160[_0x4e7e('0xc')];var _0x2b2c61=_0x2e1e15[_0x4e7e('0xd')]({'plain':!![]});if(_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()==='in'||_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()==='out'&&!_0x2b2c61['secret']&&!_[_0x4e7e('0x10')](_0x2b2c61[_0x4e7e('0x11')])){_0x516559[_0x4e7e('0x12')][_0x4e7e('0x13')]({'where':{'id':_0x2b2c61[_0x4e7e('0x14')]}})['then'](function(_0x2afcd8){if(_0x2afcd8){_0x2afcd8[_0x4e7e('0x15')]({'lastMsgAt':_0x2b2c61[_0x4e7e('0x16')],'lastMsgDirection':_0x2b2c61[_0x4e7e('0xe')][_0x4e7e('0xf')]()});}})['catch'](function(_0x359998){console[_0x4e7e('0x17')](_0x359998);});}if(_0x2b2c61[_0x4e7e('0xe')]===_0x4e7e('0x18')&&!_0x2b2c61['secret']){var _0x5d5b20;_0x516559['CmContact'][_0x4e7e('0x19')]()['then'](function(_0x24677b){return _0x516559[_0x4e7e('0x1a')][_0x4e7e('0x1b')]({'where':{'id':_0x2b2c61[_0x4e7e('0x1c')]},'include':[{'model':_0x516559[_0x4e7e('0x12')],'as':_0x4e7e('0x1d'),'where':{'id':_0x2b2c61[_0x4e7e('0x14')]},'limit':0x1,'include':[{'model':_0x516559[_0x4e7e('0x1e')],'as':_0x4e7e('0x1f'),'attributes':_['keys'](_0x24677b)}]}]});})[_0x4e7e('0x20')](function(_0x4a364b){_0x5d5b20=_0x4a364b['get']({'plain':!![]});if(_0x5d5b20&&_0x5d5b20[_0x4e7e('0x21')]){logger['info'](_0x4e7e('0x22'),_0x4e7e('0x23'),util[_0x4e7e('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2b2c61['id'],_0x5d5b20[_0x4e7e('0x21')]));if(_0x5d5b20[_0x4e7e('0x1d')]&&_0x5d5b20[_0x4e7e('0x1d')][_0x4e7e('0x25')]){_0x2b2c61[_0x4e7e('0x26')]=_[_0x4e7e('0x27')](_0x5d5b20[_0x4e7e('0x1d')][0x0],_0x4e7e('0x1f'));_0x2b2c61[_0x4e7e('0x1f')]=_0x5d5b20['Interactions'][0x0][_0x4e7e('0x1f')];}var _0x553532={'method':_0x4e7e('0x28'),'uri':encodeURI(_0x5d5b20[_0x4e7e('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x553532[_0x4e7e('0x29')]){case'GET':_0x553532['qs']=_0x2b2c61;break;case _0x4e7e('0x28'):_0x553532[_0x4e7e('0x2a')]=_0x2b2c61;break;}return rp(_0x553532)[_0x4e7e('0x20')](function(_0x4f6dee){logger[_0x4e7e('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x4e7e('0x23'),util[_0x4e7e('0x24')](_0x4e7e('0x2c'),_0x2b2c61['id'],_0x5d5b20[_0x4e7e('0x21')]));if(_0x4f6dee[_0x4e7e('0x2a')][_0x4e7e('0x2d')]&&_0x4f6dee[_0x4e7e('0x2a')]['threadId']!=_0x2b2c61['Interaction'][_0x4e7e('0x2d')]){return _0x516559[_0x4e7e('0x12')][_0x4e7e('0x15')]({'threadId':_0x4f6dee[_0x4e7e('0x2a')]['threadId']},{'where':{'id':_0x2b2c61[_0x4e7e('0x26')]['id']}});}else{return;}})[_0x4e7e('0x20')](function(){return _0x2e1e15[_0x4e7e('0x15')]({'read':!![]});})[_0x4e7e('0x2e')](function(_0x26ba8a){logger[_0x4e7e('0x17')](_0x4e7e('0x22'),_0x4e7e('0x23'),util['inspect'](_0x26ba8a,{'showHidden':![],'depth':null}));_0x298ce7();});}else{_0x298ce7();}})['finally'](function(){_0x298ce7();});}else{_0x298ce7();}}},'charset':'utf8mb4','collate':_0x4e7e('0x2f')});}; \ No newline at end of file +var _0xfa2b=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','GET','afterCreate','Interaction','threadId','update','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','CmContact','OpenchannelAccount','find','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa2b,0x12d));var _0xbfa2=function(_0xd33cda,_0x8f0190){_0xd33cda=_0xd33cda-0x0;var _0x28eda2=_0xfa2b[_0xd33cda];return _0x28eda2;};'use strict';var _=require('lodash');var util=require(_0xbfa2('0x0'));var logger=require(_0xbfa2('0x1'))('api');var moment=require(_0xbfa2('0x2'));var BPromise=require(_0xbfa2('0x3'));var rp=require(_0xbfa2('0x4'));var fs=require('fs');var path=require(_0xbfa2('0x5'));var rimraf=require(_0xbfa2('0x6'));var config=require(_0xbfa2('0x7'));var attributes=require(_0xbfa2('0x8'));module[_0xbfa2('0x9')]=function(_0x38a3aa,_0x2cd19b){return _0x38a3aa['define'](_0xbfa2('0xa'),attributes,{'tableName':_0xbfa2('0xb'),'paranoid':![],'indexes':[{'name':_0xbfa2('0xc'),'fields':[_0xbfa2('0xd')],'type':_0xbfa2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fac35,_0x1dd3d5,_0x376d3d){var _0x14b369=_0x38a3aa['models'];var _0x382181=_0x2fac35[_0xbfa2('0xf')]({'plain':!![]});if(_0x382181[_0xbfa2('0x10')][_0xbfa2('0x11')]()==='in'||_0x382181[_0xbfa2('0x10')][_0xbfa2('0x11')]()==='out'&&!_0x382181['secret']&&!_[_0xbfa2('0x12')](_0x382181[_0xbfa2('0x13')])){_0x14b369[_0xbfa2('0x14')][_0xbfa2('0x15')]({'where':{'id':_0x382181['OpenchannelInteractionId']}})[_0xbfa2('0x16')](function(_0xe5cca7){if(_0xe5cca7){_0xe5cca7['update']({'lastMsgAt':_0x382181[_0xbfa2('0x17')],'lastMsgDirection':_0x382181[_0xbfa2('0x10')][_0xbfa2('0x11')]()});}})[_0xbfa2('0x18')](function(_0x22137f){console['error'](_0x22137f);});}if(_0x382181[_0xbfa2('0x10')]==='out'&&!_0x382181['secret']){var _0x4c162b;_0x14b369[_0xbfa2('0x19')]['describe']()[_0xbfa2('0x16')](function(_0x28b1fc){return _0x14b369[_0xbfa2('0x1a')][_0xbfa2('0x1b')]({'where':{'id':_0x382181['OpenchannelAccountId']},'include':[{'model':_0x14b369[_0xbfa2('0x14')],'as':_0xbfa2('0x1c'),'where':{'id':_0x382181[_0xbfa2('0x1d')]},'limit':0x1,'include':[{'model':_0x14b369[_0xbfa2('0x19')],'as':_0xbfa2('0x1e'),'attributes':_[_0xbfa2('0x1f')](_0x28b1fc)}]}]});})['then'](function(_0x1f3901){_0x4c162b=_0x1f3901[_0xbfa2('0xf')]({'plain':!![]});if(_0x4c162b&&_0x4c162b[_0xbfa2('0x20')]){logger[_0xbfa2('0x21')](_0xbfa2('0x22'),'afterCreate',util[_0xbfa2('0x23')](_0xbfa2('0x24'),_0x382181['id'],_0x4c162b[_0xbfa2('0x20')]));if(_0x4c162b[_0xbfa2('0x1c')]&&_0x4c162b['Interactions'][_0xbfa2('0x25')]){_0x382181['Interaction']=_['omit'](_0x4c162b[_0xbfa2('0x1c')][0x0],_0xbfa2('0x1e'));_0x382181[_0xbfa2('0x1e')]=_0x4c162b[_0xbfa2('0x1c')][0x0][_0xbfa2('0x1e')];}var _0x1dd3d5={'method':_0xbfa2('0x26'),'uri':encodeURI(_0x4c162b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1dd3d5[_0xbfa2('0x27')]){case _0xbfa2('0x28'):_0x1dd3d5['qs']=_0x382181;break;case _0xbfa2('0x26'):_0x1dd3d5[_0xbfa2('0xd')]=_0x382181;break;}return rp(_0x1dd3d5)[_0xbfa2('0x16')](function(_0x445f76){logger['info'](_0xbfa2('0x22'),_0xbfa2('0x29'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x382181['id'],_0x4c162b[_0xbfa2('0x20')]));if(_0x445f76[_0xbfa2('0xd')]['threadId']&&_0x445f76[_0xbfa2('0xd')]['threadId']!=_0x382181[_0xbfa2('0x2a')][_0xbfa2('0x2b')]){return _0x14b369[_0xbfa2('0x14')][_0xbfa2('0x2c')]({'threadId':_0x445f76[_0xbfa2('0xd')]['threadId']},{'where':{'id':_0x382181['Interaction']['id']}});}else{return;}})['then'](function(){return _0x2fac35[_0xbfa2('0x2c')]({'read':!![]});})['catch'](function(_0x1cc84e){logger[_0xbfa2('0x2d')](_0xbfa2('0x22'),_0xbfa2('0x29'),util['inspect'](_0x1cc84e,{'showHidden':![],'depth':null}));_0x376d3d();});}else{_0x376d3d();}})['finally'](function(){_0x376d3d();});}else{_0x376d3d();}}},'charset':_0xbfa2('0x2e'),'collate':_0xbfa2('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index b723483..f866bed 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x324af0,_0x188f98){var _0x3ee024=function(_0x26a877){while(--_0x26a877){_0x324af0['push'](_0x324af0['shift']());}};_0x3ee024(++_0x188f98);}(_0x2ef3,0xba));var _0x32ef=function(_0x2fa7a8,_0x44a7a1){_0x2fa7a8=_0x2fa7a8-0x0;var _0x4a5625=_0x2ef3[_0x2fa7a8];return _0x4a5625;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xeb5c89,_0x433faa){var _0x11a461=function(_0x74946f){while(--_0x74946f){_0xeb5c89['push'](_0xeb5c89['shift']());}};_0x11a461(++_0x433faa);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23b09b,_0x473276){_0x23b09b=_0x23b09b-0x0;var _0x235254=_0x5f2f[_0x23b09b];return _0x235254;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3e7d3f8..0dee77c 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 _0x8375=['openchannelMessage:','save','remove','update','register'];(function(_0x19c741,_0x347762){var _0x1f4595=function(_0x25b59f){while(--_0x25b59f){_0x19c741['push'](_0x19c741['shift']());}};_0x1f4595(++_0x347762);}(_0x8375,0x132));var _0x5837=function(_0x25690f,_0xa41edb){_0x25690f=_0x25690f-0x0;var _0x356dd6=_0x8375[_0x25690f];return _0x356dd6;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5837('0x0'),_0x5837('0x1'),_0x5837('0x2')];function createListener(_0x1fb900,_0x3bd795){return function(_0x144751){_0x3bd795['emit'](_0x1fb900,_0x144751);};}function removeListener(_0x2ddfc1,_0x110a7d){return function(){OpenchannelMessageEvents['removeListener'](_0x2ddfc1,_0x110a7d);};}exports[_0x5837('0x3')]=function(_0x438491){for(var _0x21c9bd=0x0,_0x1e0d00=events['length'];_0x21c9bd<_0x1e0d00;_0x21c9bd++){var _0x23454c=events[_0x21c9bd];var _0x1f4f78=createListener(_0x5837('0x4')+_0x23454c,_0x438491);OpenchannelMessageEvents['on'](_0x23454c,_0x1f4f78);}}; \ No newline at end of file +var _0xa53e=['remove','update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x20a424,_0x2ac71a){var _0x28911f=function(_0x22cffe){while(--_0x22cffe){_0x20a424['push'](_0x20a424['shift']());}};_0x28911f(++_0x2ac71a);}(_0xa53e,0xe6));var _0xea53=function(_0x1fbce0,_0x1d42ea){_0x1fbce0=_0x1fbce0-0x0;var _0x8e6d6a=_0xa53e[_0x1fbce0];return _0x8e6d6a;};'use strict';var OpenchannelMessageEvents=require(_0xea53('0x0'));var events=['save',_0xea53('0x1'),_0xea53('0x2')];function createListener(_0x5da833,_0x31dbb){return function(_0x3ad2cc){_0x31dbb['emit'](_0x5da833,_0x3ad2cc);};}function removeListener(_0x2b11f7,_0x5b46b6){return function(){OpenchannelMessageEvents[_0xea53('0x3')](_0x2b11f7,_0x5b46b6);};}exports[_0xea53('0x4')]=function(_0x599f62){for(var _0x299106=0x0,_0x1877c1=events[_0xea53('0x5')];_0x299106<_0x1877c1;_0x299106++){var _0x5baa34=events[_0x299106];var _0x1a4e70=createListener(_0xea53('0x6')+_0x5baa34,_0x599f62);OpenchannelMessageEvents['on'](_0x5baa34,_0x1a4e70);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 655bc47..c3766ea 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 _0xc06d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x18c06f,_0x3dc7b3){var _0x191c53=function(_0x3a5a32){while(--_0x3a5a32){_0x18c06f['push'](_0x18c06f['shift']());}};_0x191c53(++_0x3dc7b3);}(_0xc06d,0xba));var _0xdc06=function(_0x4fa4e0,_0x6791e7){_0x4fa4e0=_0x4fa4e0-0x0;var _0x4ab6ee=_0xc06d[_0x4fa4e0];return _0x4ab6ee;};'use strict';var multer=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var path=require(_0xdc06('0x2'));var timeout=require(_0xdc06('0x3'));var express=require(_0xdc06('0x4'));var router=express[_0xdc06('0x5')]();var fs_extra=require(_0xdc06('0x6'));var auth=require(_0xdc06('0x7'));var interaction=require(_0xdc06('0x8'));var config=require(_0xdc06('0x9'));var controller=require(_0xdc06('0xa'));router[_0xdc06('0xb')]('/',auth['isAuthenticated'](),controller[_0xdc06('0xc')]);router[_0xdc06('0xb')](_0xdc06('0xd'),auth[_0xdc06('0xe')](),controller['describe']);router[_0xdc06('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xdc06('0xf')]);router[_0xdc06('0xb')](_0xdc06('0x10'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x11')]);router[_0xdc06('0xb')](_0xdc06('0x12'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x13')]);router[_0xdc06('0xb')]('/:id/users',auth[_0xdc06('0xe')](),controller[_0xdc06('0x14')]);router[_0xdc06('0x15')]('/',auth['isAuthenticated'](),controller[_0xdc06('0x16')]);router['post'](_0xdc06('0x12'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x17')]);router['post'](_0xdc06('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xdc06('0x19'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x1a')]);router[_0xdc06('0x1b')](_0xdc06('0x19'),auth[_0xdc06('0xe')](),controller[_0xdc06('0x1c')]);router['delete']('/:id/teams',auth[_0xdc06('0xe')](),controller[_0xdc06('0x1d')]);router[_0xdc06('0x1b')](_0xdc06('0x18'),auth['isAuthenticated'](),controller[_0xdc06('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x500b=['isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x312c25,_0x59e6f3){var _0x46f2a8=function(_0x494080){while(--_0x494080){_0x312c25['push'](_0x312c25['shift']());}};_0x46f2a8(++_0x59e6f3);}(_0x500b,0x79));var _0xb500=function(_0x3d6eb1,_0x1f99b1){_0x3d6eb1=_0x3d6eb1-0x0;var _0x4e5356=_0x500b[_0x3d6eb1];return _0x4e5356;};'use strict';var multer=require(_0xb500('0x0'));var util=require('util');var path=require(_0xb500('0x1'));var timeout=require(_0xb500('0x2'));var express=require(_0xb500('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb500('0x4'));var interaction=require(_0xb500('0x5'));var config=require(_0xb500('0x6'));var controller=require(_0xb500('0x7'));router[_0xb500('0x8')]('/',auth[_0xb500('0x9')](),controller[_0xb500('0xa')]);router['get'](_0xb500('0xb'),auth[_0xb500('0x9')](),controller['describe']);router['get'](_0xb500('0xc'),auth[_0xb500('0x9')](),controller[_0xb500('0xd')]);router[_0xb500('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xb500('0xe')]);router['get'](_0xb500('0xf'),auth[_0xb500('0x9')](),controller[_0xb500('0x10')]);router[_0xb500('0x8')](_0xb500('0x11'),auth['isAuthenticated'](),controller[_0xb500('0x12')]);router['post']('/',auth[_0xb500('0x9')](),controller[_0xb500('0x13')]);router[_0xb500('0x14')](_0xb500('0xf'),auth[_0xb500('0x9')](),controller['addTeams']);router[_0xb500('0x14')](_0xb500('0x11'),auth[_0xb500('0x9')](),controller[_0xb500('0x15')]);router['put']('/:id',auth[_0xb500('0x9')](),controller['update']);router['delete']('/:id',auth[_0xb500('0x9')](),controller['destroy']);router[_0xb500('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb500('0x17')]);router[_0xb500('0x16')](_0xb500('0x11'),auth[_0xb500('0x9')](),controller[_0xb500('0x18')]);module[_0xb500('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1dc88a7..224979a 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 _0x8719=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x4612f5,_0x3e9ae5){var _0x5eaaf8=function(_0x1f5c4f){while(--_0x1f5c4f){_0x4612f5['push'](_0x4612f5['shift']());}};_0x5eaaf8(++_0x3e9ae5);}(_0x8719,0x1ed));var _0x9871=function(_0x138751,_0x27e5a5){_0x138751=_0x138751-0x0;var _0xc96617=_0x8719[_0x138751];return _0xc96617;};'use strict';var Sequelize=require(_0x9871('0x0'));module[_0x9871('0x1')]={'name':{'type':Sequelize[_0x9871('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9871('0x2')]},'timeout':{'type':Sequelize[_0x9871('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9871('0x4'),_0x9871('0x5'),_0x9871('0x6'))}}; \ No newline at end of file +var _0x87c8=['beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x10b243,_0x579676){var _0x5002d4=function(_0x1c3fd6){while(--_0x1c3fd6){_0x10b243['push'](_0x10b243['shift']());}};_0x5002d4(++_0x579676);}(_0x87c8,0x133));var _0x887c=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x87c8[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0x887c('0x0'));module[_0x887c('0x1')]={'name':{'type':Sequelize[_0x887c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x887c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x887c('0x4')]('rrmemory',_0x887c('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 3dca9eb..41919c5 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 _0x69ed=['query','findAll','rows','show','params','model','keys','filters','attributes','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','intersection','hasOwnProperty','nolimit','sort','where','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','union','compact','isEmpty','removeAgents','addAgents','omit','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','get','OpenchannelQueues','name','send','index','map','rawAttributes','fieldName','type','getOptions','OpenchannelQueue','include'];(function(_0x2879ea,_0xd06535){var _0x270d9c=function(_0x5a1b63){while(--_0x5a1b63){_0x2879ea['push'](_0x2879ea['shift']());}};_0x270d9c(++_0xd06535);}(_0x69ed,0x1c8));var _0xd69e=function(_0x1a8ee7,_0x4114e2){_0x1a8ee7=_0x1a8ee7-0x0;var _0x4535c0=_0x69ed[_0x1a8ee7];return _0x4535c0;};'use strict';var BPromise=require(_0xd69e('0x0'));var util=require(_0xd69e('0x1'));var _=require(_0xd69e('0x2'));var squel=require(_0xd69e('0x3'));var Redis=require(_0xd69e('0x4'));var qs=require(_0xd69e('0x5'));var logger=require(_0xd69e('0x6'))(_0xd69e('0x7'));var config=require(_0xd69e('0x8'));var db=require(_0xd69e('0x9'))['db'];config[_0xd69e('0xa')]=_[_0xd69e('0xb')](config[_0xd69e('0xa')],{'host':_0xd69e('0xc'),'port':0x18eb});var socket=require(_0xd69e('0xd'))(new Redis(config[_0xd69e('0xa')]));require(_0xd69e('0xe'))[_0xd69e('0xf')](socket);function respondWithStatusCode(_0x580cd6,_0x5ccd3e){_0x5ccd3e=_0x5ccd3e||0xcc;return function(_0x1ca6db){if(_0x1ca6db){return _0x580cd6[_0xd69e('0x10')](_0x5ccd3e);}return _0x580cd6['status'](_0x5ccd3e)[_0xd69e('0x11')]();};}function respondWithResult(_0x297df5,_0x2dc278){_0x2dc278=_0x2dc278||0xc8;return function(_0x4e71cf){if(_0x4e71cf){return _0x297df5[_0xd69e('0x12')](_0x2dc278)[_0xd69e('0x13')](_0x4e71cf);}};}function respondWithFilteredResult(_0x53fea9,_0x3c033c){return function(_0x449b6e){if(_0x449b6e){var _0x4f0925=typeof _0x3c033c[_0xd69e('0x14')]===_0xd69e('0x15')&&typeof _0x3c033c[_0xd69e('0x16')]===_0xd69e('0x15');var _0x11e1d0=_0x449b6e[_0xd69e('0x17')];var _0x268e9a=_0x4f0925?0x0:_0x3c033c[_0xd69e('0x14')];var _0x4d5e4a=_0x4f0925?_0x449b6e[_0xd69e('0x17')]:_0x3c033c[_0xd69e('0x14')]+_0x3c033c[_0xd69e('0x16')];var _0x1f209c;if(_0x4d5e4a>=_0x11e1d0){_0x4d5e4a=_0x11e1d0;_0x1f209c=0xc8;}else{_0x1f209c=0xce;}_0x53fea9[_0xd69e('0x12')](_0x1f209c);return _0x53fea9[_0xd69e('0x18')]('Content-Range',_0x268e9a+'-'+_0x4d5e4a+'/'+_0x11e1d0)[_0xd69e('0x13')](_0x449b6e);}return null;};}function saveUpdates(_0x1b4fa4){return function(_0x245635){if(_0x245635){return _0x245635[_0xd69e('0x19')](_0x1b4fa4)[_0xd69e('0x1a')](function(_0x8b1bca){return _0x8b1bca;});}return null;};}function removeEntity(_0x1f9a76){return function(_0x5809a8){if(_0x5809a8){return _0x5809a8[_0xd69e('0x1b')]()[_0xd69e('0x1a')](function(){var _0xd3d214=_0x5809a8[_0xd69e('0x1c')]({'plain':!![]});var _0x157626=_0xd69e('0x1d');return db['UserProfileResource'][_0xd69e('0x1b')]({'where':{'type':_0x157626,'resourceId':_0xd3d214['id']}})[_0xd69e('0x1a')](function(){return _0x5809a8;});})[_0xd69e('0x1a')](function(){_0x1f9a76[_0xd69e('0x12')](0xcc)[_0xd69e('0x11')]();});}};}function handleEntityNotFound(_0x48a934){return function(_0x9f274f){if(!_0x9f274f){_0x48a934['sendStatus'](0x194);}return _0x9f274f;};}function handleError(_0x5393a6,_0x1f92c5){_0x1f92c5=_0x1f92c5||0x1f4;return function(_0x583238){logger['error'](_0x583238['stack']);if(_0x583238[_0xd69e('0x1e')]){delete _0x583238[_0xd69e('0x1e')];}_0x5393a6[_0xd69e('0x12')](_0x1f92c5)[_0xd69e('0x1f')](_0x583238);};}exports[_0xd69e('0x20')]=function(_0x36f61e,_0x16de08){var _0x1292c5={};var _0xb45e19={'count':0x0,'rows':[]};var _0x3dc2ac=_[_0xd69e('0x21')](db['OpenchannelQueue'][_0xd69e('0x22')],function(_0x2c7f6c){return{'name':_0x2c7f6c[_0xd69e('0x23')],'type':_0x2c7f6c[_0xd69e('0x24')]['key']};});_0x1292c5=qs[_0xd69e('0x25')](_0x3dc2ac,_0x36f61e);var _0x118625={'where':_0x1292c5['where']};return db[_0xd69e('0x26')][_0xd69e('0x17')](_0x118625)[_0xd69e('0x1a')](function(_0xf17ce0){_0xb45e19[_0xd69e('0x17')]=_0xf17ce0;_0x1292c5[_0xd69e('0x27')]=qs[_0xd69e('0x27')](_0x36f61e[_0xd69e('0x28')]);return db[_0xd69e('0x26')][_0xd69e('0x29')](_0x1292c5);})[_0xd69e('0x1a')](function(_0x44ac64){_0xb45e19[_0xd69e('0x2a')]=_0x44ac64;return _0xb45e19;})[_0xd69e('0x1a')](respondWithFilteredResult(_0x16de08,_0x1292c5))['catch'](handleError(_0x16de08,null));};exports[_0xd69e('0x2b')]=function(_0x1ad516,_0x3636dd){var _0x57e0fe={'raw':!![],'where':{'id':_0x1ad516[_0xd69e('0x2c')]['id']}},_0x28ea70={};_0x28ea70[_0xd69e('0x2d')]=_['keys'](db['OpenchannelQueue'][_0xd69e('0x22')]);_0x28ea70[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x1ad516[_0xd69e('0x28')]);_0x28ea70[_0xd69e('0x2f')]=_['intersection'](_0x28ea70[_0xd69e('0x2d')],_0x28ea70[_0xd69e('0x28')]);_0x57e0fe[_0xd69e('0x30')]=_['intersection'](_0x28ea70[_0xd69e('0x2d')],qs['fields'](_0x1ad516['query'][_0xd69e('0x31')]));_0x57e0fe[_0xd69e('0x30')]=_0x57e0fe[_0xd69e('0x30')][_0xd69e('0x32')]?_0x57e0fe['attributes']:_0x28ea70[_0xd69e('0x2d')];if(_0x1ad516[_0xd69e('0x28')][_0xd69e('0x33')]){_0x57e0fe[_0xd69e('0x27')]=[{'all':!![]}];}_0x57e0fe=_[_0xd69e('0x34')]({},_0x57e0fe,_0x1ad516[_0xd69e('0x35')]);return db[_0xd69e('0x26')][_0xd69e('0x36')](_0x57e0fe)['then'](handleEntityNotFound(_0x3636dd,null))[_0xd69e('0x1a')](respondWithResult(_0x3636dd,null))[_0xd69e('0x37')](handleError(_0x3636dd,null));};exports['create']=function(_0x5ffc07,_0x1c2d6e){return db[_0xd69e('0x26')][_0xd69e('0x38')](_0x5ffc07[_0xd69e('0x39')],{})[_0xd69e('0x1a')](function(_0x30909d){var _0x5a1de1=_0x5ffc07[_0xd69e('0x3a')][_0xd69e('0x1c')]({'plain':!![]});if(!_0x5a1de1)throw new Error(_0xd69e('0x3b'));if(_0x5a1de1[_0xd69e('0x3c')]===_0xd69e('0x3a')){var _0x68978a=_0x30909d[_0xd69e('0x1c')]({'plain':!![]});var _0x2db4c4=_0xd69e('0x1d');return db[_0xd69e('0x3d')]['find']({'where':{'name':_0x2db4c4,'userProfileId':_0x5a1de1[_0xd69e('0x3e')]},'raw':!![]})[_0xd69e('0x1a')](function(_0xab5674){if(_0xab5674&&_0xab5674[_0xd69e('0x3f')]===0x0){return db['UserProfileResource'][_0xd69e('0x38')]({'name':_0x68978a['name'],'resourceId':_0x68978a['id'],'type':_0xab5674[_0xd69e('0x1e')],'sectionId':_0xab5674['id']},{})[_0xd69e('0x1a')](function(){return _0x30909d;});}else{return _0x30909d;}})[_0xd69e('0x37')](function(_0x2abd9c){logger['error'](_0xd69e('0x40'),_0x2abd9c);throw _0x2abd9c;});}return _0x30909d;})['then'](respondWithResult(_0x1c2d6e,0xc9))[_0xd69e('0x37')](handleError(_0x1c2d6e,null));};exports['update']=function(_0x4d2a44,_0x4b4ff2){if(_0x4d2a44[_0xd69e('0x39')]['id']){delete _0x4d2a44[_0xd69e('0x39')]['id'];}return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x4d2a44[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4b4ff2,null))['then'](saveUpdates(_0x4d2a44['body'],null))[_0xd69e('0x1a')](respondWithResult(_0x4b4ff2,null))[_0xd69e('0x37')](handleError(_0x4b4ff2,null));};exports['destroy']=function(_0x3912cb,_0x56fd8b){return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x3912cb['params']['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x56fd8b,null))[_0xd69e('0x1a')](removeEntity(_0x56fd8b,null))[_0xd69e('0x37')](handleError(_0x56fd8b,null));};exports['describe']=function(_0x758746,_0xd8af2b){return db[_0xd69e('0x26')]['describe']()['then'](respondWithResult(_0xd8af2b,null))[_0xd69e('0x37')](handleError(_0xd8af2b,null));};exports[_0xd69e('0x41')]=function(_0x22a3f7,_0x3cad4b){var _0x594533={'raw':!![],'where':{}},_0x2a24bc={},_0x3cd2e6;return db[_0xd69e('0x26')]['findOne']({'where':{'id':_0x22a3f7[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x3cad4b,null))[_0xd69e('0x1a')](function(_0x4e6d0f){if(_0x4e6d0f){_0x3cd2e6=_0x4e6d0f[_0xd69e('0x1c')]({'plain':!![]});_0x2a24bc['model']=_[_0xd69e('0x2e')](db['UserOpenchannelQueue'][_0xd69e('0x22')]);_0x2a24bc[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x22a3f7[_0xd69e('0x28')]);_0x2a24bc['filters']=_['intersection'](_0x2a24bc[_0xd69e('0x2d')],_0x2a24bc[_0xd69e('0x28')]);_0x594533[_0xd69e('0x30')]=_[_0xd69e('0x42')](_0x2a24bc[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x31')]));_0x594533[_0xd69e('0x30')]=_0x594533[_0xd69e('0x30')]['length']?_0x594533[_0xd69e('0x30')]:_0x2a24bc['model'];if(!_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x594533[_0xd69e('0x16')]=qs['limit'](_0x22a3f7['query'][_0xd69e('0x16')]);_0x594533[_0xd69e('0x14')]=qs[_0xd69e('0x14')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x14')]);}_0x594533['order']=qs[_0xd69e('0x45')](_0x22a3f7[_0xd69e('0x28')][_0xd69e('0x45')]);_0x594533[_0xd69e('0x46')]=qs[_0xd69e('0x2f')](_[_0xd69e('0x47')](_0x22a3f7[_0xd69e('0x28')],_0x2a24bc[_0xd69e('0x2f')]));_0x594533[_0xd69e('0x46')][_0xd69e('0x48')]=_0x4e6d0f['id'];if(_0x22a3f7[_0xd69e('0x28')]['filter']){_0x594533[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x594533['where'],{'$or':_[_0xd69e('0x21')](_0x594533[_0xd69e('0x30')],function(_0x44d7bd){var _0x45ee26={};_0x45ee26[_0x44d7bd]={'$like':'%'+_0x22a3f7['query'][_0xd69e('0x49')]+'%'};return _0x45ee26;})});}_0x594533=_[_0xd69e('0x34')]({},_0x594533,_0x22a3f7['options']);return db[_0xd69e('0x4a')][_0xd69e('0x29')](_0x594533);}})['then'](function(_0x6ef73c){if(_0x6ef73c){return db[_0xd69e('0x4b')]['findAndCountAll']({'where':{'id':_[_0xd69e('0x21')](_0x6ef73c,_0xd69e('0x4c')),'role':_0xd69e('0x4d')},'attributes':['id',_0xd69e('0x1e'),_0xd69e('0x4e'),_0xd69e('0x4f'),'createdAt']});}})[_0xd69e('0x1a')](function(_0x44d7b2){if(_0x44d7b2){return{'count':_0x44d7b2[_0xd69e('0x17')],'rows':_[_0xd69e('0x21')](_0x44d7b2[_0xd69e('0x2a')],function(_0x580e69){return{'membername':_0x580e69[_0xd69e('0x1e')],'UserId':_0x580e69['id'],'queue_name':_0x3cd2e6[_0xd69e('0x1e')],'OpenchannelQueueId':_0x3cd2e6['id'],'interface':util[_0xd69e('0x50')](_0xd69e('0x51'),_0xd69e('0x52'),_0x580e69[_0xd69e('0x1e')]),'penalty':0x0,'paused':_0x580e69[_0xd69e('0x4e')],'createdAt':_0x580e69['createdAt'],'updatedAt':_0x580e69[_0xd69e('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3cad4b,_0x594533))['catch'](handleError(_0x3cad4b,null));};exports[_0xd69e('0x53')]=function(_0x2b3f22,_0x314015){var _0x119c64={};var _0x222d43={};var _0x5bae3e;var _0x18d088;return db['OpenchannelQueue'][_0xd69e('0x54')]({'where':{'id':_0x2b3f22[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x314015,null))[_0xd69e('0x1a')](function(_0x4fe1dd){if(_0x4fe1dd){_0x5bae3e=_0x4fe1dd;_0x222d43[_0xd69e('0x2d')]=_['keys'](db['Team'][_0xd69e('0x22')]);_0x222d43[_0xd69e('0x28')]=_[_0xd69e('0x2e')](_0x2b3f22['query']);_0x222d43[_0xd69e('0x2f')]=_[_0xd69e('0x42')](_0x222d43[_0xd69e('0x2d')],_0x222d43['query']);_0x119c64['attributes']=_[_0xd69e('0x42')](_0x222d43[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x31')]));_0x119c64['attributes']=_0x119c64[_0xd69e('0x30')][_0xd69e('0x32')]?_0x119c64[_0xd69e('0x30')]:_0x222d43[_0xd69e('0x2d')];_0x119c64[_0xd69e('0x55')]=qs[_0xd69e('0x45')](_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x45')]);_0x119c64[_0xd69e('0x46')]=qs[_0xd69e('0x2f')](_['pick'](_0x2b3f22[_0xd69e('0x28')],_0x222d43[_0xd69e('0x2f')]));if(_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x49')]){_0x119c64[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x119c64['where'],{'$or':_[_0xd69e('0x21')](_0x119c64[_0xd69e('0x30')],function(_0x3ee509){var _0x338791={};_0x338791[_0x3ee509]={'$like':'%'+_0x2b3f22['query'][_0xd69e('0x49')]+'%'};return _0x338791;})});}_0x119c64=_[_0xd69e('0x34')]({},_0x119c64,_0x2b3f22[_0xd69e('0x35')]);return _0x5bae3e[_0xd69e('0x53')](_0x119c64);}})['then'](function(_0x47ad9e){if(_0x47ad9e){_0x18d088=_0x47ad9e[_0xd69e('0x32')];if(!_0x2b3f22[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x119c64[_0xd69e('0x16')]=qs['limit'](_0x2b3f22['query'][_0xd69e('0x16')]);_0x119c64['offset']=qs[_0xd69e('0x14')](_0x2b3f22['query'][_0xd69e('0x14')]);}return _0x5bae3e[_0xd69e('0x53')](_0x119c64);}})['then'](function(_0x50ed0a){if(_0x50ed0a){return _0x50ed0a?{'count':_0x18d088,'rows':_0x50ed0a}:null;}})[_0xd69e('0x1a')](respondWithResult(_0x314015,null))[_0xd69e('0x37')](handleError(_0x314015,null));};exports[_0xd69e('0x56')]=function(_0x14e141,_0x14ee4d){var _0x3786dd=_0x14e141[_0xd69e('0x39')][_0xd69e('0x57')];return db['Team'][_0xd69e('0x29')]({'where':{'id':_0x3786dd},'attributes':['id'],'include':[{'model':db[_0xd69e('0x4b')],'as':_0xd69e('0x58'),'attributes':['id',_0xd69e('0x1e'),_0xd69e('0x59'),_0xd69e('0x5a'),_0xd69e('0x5b')],'raw':!![]}]})[_0xd69e('0x1a')](function(_0x53f0d7){if(_0x53f0d7){var _0x54c511=_[_0xd69e('0x5c')](_0x53f0d7,function(_0x4e7aff){var _0x40f4cf=_0x4e7aff[_0xd69e('0x1c')]({'plain':!![]});return _0x40f4cf['Agents'];});return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x14e141[_0xd69e('0x2c')]['id']}})['then'](function(_0x1f95e8){return db[_0xd69e('0x5d')][_0xd69e('0x5e')](function(_0x5b8827){return _0x1f95e8[_0xd69e('0x56')](_0x3786dd,{'transaction':_0x5b8827})['then'](function(){return BPromise[_0xd69e('0x5f')](_0x54c511,function(_0x589d73){return db[_0xd69e('0x4a')][_0xd69e('0x60')]({'where':{'UserId':_0x589d73['id'],'OpenchannelQueueId':_0x14e141[_0xd69e('0x2c')]['id']},'transaction':_0x5b8827});});})['then'](function(){_0x54c511[_0xd69e('0x61')](function(_0x2b3e1e){socket[_0xd69e('0x62')](_0xd69e('0x63'),{'UserId':_0x2b3e1e['id'],'OpenchannelQueueId':_0x1f95e8['id']});});});});});}})[_0xd69e('0x1a')](respondWithStatusCode(_0x14ee4d,null))[_0xd69e('0x37')](handleError(_0x14ee4d,null));};exports[_0xd69e('0x64')]=function(_0x2eea21,_0x12776d){return db[_0xd69e('0x65')][_0xd69e('0x29')]({'where':{'id':_0x2eea21[_0xd69e('0x28')][_0xd69e('0x57')]},'attributes':['id'],'include':[{'model':db[_0xd69e('0x4b')],'as':_0xd69e('0x58'),'attributes':['id'],'raw':!![]}]})[_0xd69e('0x1a')](handleEntityNotFound(_0x12776d,null))[_0xd69e('0x1a')](function(_0x2f14a0){var _0x5cac57=_['map'](_0x2f14a0,'id');var _0x35d93d=[];var _0x38b8a0=[];var _0xc465a9=squel[_0xd69e('0x66')]();_0xc465a9[_0xd69e('0x67')](_0xd69e('0x68'))[_0xd69e('0x69')](_0xd69e('0x6a'),'tq')[_0xd69e('0x6b')]('user_has_teams','ut',_0xd69e('0x6c'))['where']('OpenchannelQueueId\x20=\x20?',_0x2eea21[_0xd69e('0x2c')]['id']);for(var _0x26f95e=0x0;_0x26f95e<_0x2f14a0[_0xd69e('0x32')];_0x26f95e+=0x1){let _0x44feb5=_0x2f14a0[_0x26f95e];for(var _0x37bbf8=0x0;_0x37bbf8<_0x44feb5[_0xd69e('0x58')]['length'];_0x37bbf8+=0x1){let _0x43eac7=_0x44feb5[_0xd69e('0x58')][_0x37bbf8];var _0x99d69f=_0xc465a9[_0xd69e('0x6d')]();_0x99d69f['where'](_0xd69e('0x6e'),_0x43eac7['id']);_0x38b8a0[_0xd69e('0x6f')](db[_0xd69e('0x5d')][_0xd69e('0x28')](_0x99d69f[_0xd69e('0x70')](),{'type':db[_0xd69e('0x5d')]['QueryTypes'][_0xd69e('0x71')]})[_0xd69e('0x1a')](function(_0x3079df){if(_0x3079df[_0xd69e('0x32')]===0x1){return _0x43eac7['id'];}else{var _0x10bf09=_[_0xd69e('0x72')](_[_0xd69e('0x21')](_0x3079df,'TeamId'),function(_0x4fa954){return _[_0xd69e('0x73')](_0x5cac57,_0x4fa954);});if(_0x10bf09){return _0x43eac7['id'];}}}));}}return BPromise['all'](_0x38b8a0)[_0xd69e('0x1a')](function(_0x243957){_0x35d93d=_(_0x35d93d)[_0xd69e('0x74')](_0x243957)[_0xd69e('0x75')]()['value']();return db[_0xd69e('0x26')]['find']({'where':{'id':_0x2eea21[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](function(_0x38a775){return db[_0xd69e('0x5d')][_0xd69e('0x5e')](function(_0x5bd844){return _0x38a775['removeTeams'](_0x2eea21[_0xd69e('0x28')][_0xd69e('0x57')],{'transaction':_0x5bd844})[_0xd69e('0x1a')](function(){if(!_[_0xd69e('0x76')](_0x35d93d)){return _0x38a775[_0xd69e('0x77')](_0x35d93d,{'transaction':_0x5bd844});}})[_0xd69e('0x1a')](function(){_0x35d93d[_0xd69e('0x61')](function(_0x2ba4c4){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x2ba4c4,'OpenchannelQueueId':_0x38a775['id']});});});});});});})[_0xd69e('0x1a')](respondWithStatusCode(_0x12776d,null))[_0xd69e('0x37')](handleError(_0x12776d,null));};exports[_0xd69e('0x78')]=function(_0x220cca,_0x2ee6fe){return db[_0xd69e('0x26')][_0xd69e('0x36')]({'where':{'id':_0x220cca[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2ee6fe,null))[_0xd69e('0x1a')](function(_0x17d86b){if(_0x17d86b){return _0x17d86b['addAgents'](_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')],_[_0xd69e('0x79')](_0x220cca[_0xd69e('0x39')],[_0xd69e('0x57'),'id'])||{})['spread'](function(_0x2e8cf8){for(var _0x548e7f=0x0;_0x548e7f<_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')][_0xd69e('0x32')];_0x548e7f+=0x1){socket['emit'](_0xd69e('0x63'),{'UserId':Number(_0x220cca[_0xd69e('0x39')][_0xd69e('0x57')][_0x548e7f]),'OpenchannelQueueId':Number(_0x220cca[_0xd69e('0x2c')]['id'])});}return _0x2e8cf8;});}})[_0xd69e('0x1a')](respondWithResult(_0x2ee6fe,null))[_0xd69e('0x37')](handleError(_0x2ee6fe,null));};exports[_0xd69e('0x77')]=function(_0x286de5,_0x51461c){return db[_0xd69e('0x26')]['find']({'where':{'id':_0x286de5[_0xd69e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x51461c,null))[_0xd69e('0x1a')](function(_0x3bec51){if(_0x3bec51){return _0x3bec51[_0xd69e('0x77')](_0x286de5['query'][_0xd69e('0x57')])[_0xd69e('0x1a')](function(){if(_['isArray'](_0x286de5['query']['ids'])){for(var _0x810c16=0x0;_0x810c16<_0x286de5[_0xd69e('0x28')][_0xd69e('0x57')][_0xd69e('0x32')];_0x810c16+=0x1){socket[_0xd69e('0x62')](_0xd69e('0x7a'),{'UserId':Number(_0x286de5['query'][_0xd69e('0x57')][_0x810c16]),'OpenchannelQueueId':Number(_0x286de5[_0xd69e('0x2c')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x286de5[_0xd69e('0x28')][_0xd69e('0x57')]),'OpenchannelQueueId':Number(_0x286de5[_0xd69e('0x2c')]['id'])});}});}})[_0xd69e('0x1a')](respondWithStatusCode(_0x51461c,null))[_0xd69e('0x37')](handleError(_0x51461c,null));};exports['getAgents']=function(_0x4b01a8,_0x33060f){var _0x473f0c={};var _0x4bb875={};var _0x1bfe27;var _0x3da6bc;return db[_0xd69e('0x26')][_0xd69e('0x54')]({'where':{'id':_0x4b01a8[_0xd69e('0x2c')]['id']}})[_0xd69e('0x1a')](handleEntityNotFound(_0x33060f,null))[_0xd69e('0x1a')](function(_0x3ab014){if(_0x3ab014){_0x1bfe27=_0x3ab014;_0x4bb875[_0xd69e('0x2d')]=_['keys'](db['User'][_0xd69e('0x22')]);_0x4bb875[_0xd69e('0x28')]=_['keys'](_0x4b01a8[_0xd69e('0x28')]);_0x4bb875[_0xd69e('0x2f')]=_[_0xd69e('0x42')](_0x4bb875[_0xd69e('0x2d')],_0x4bb875[_0xd69e('0x28')]);_0x473f0c[_0xd69e('0x30')]=_[_0xd69e('0x42')](_0x4bb875[_0xd69e('0x2d')],qs[_0xd69e('0x31')](_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x31')]));_0x473f0c[_0xd69e('0x30')]=_0x473f0c[_0xd69e('0x30')][_0xd69e('0x32')]?_0x473f0c[_0xd69e('0x30')]:_0x4bb875[_0xd69e('0x2d')];_0x473f0c['order']=qs[_0xd69e('0x45')](_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x45')]);_0x473f0c['where']=qs['filters'](_['pick'](_0x4b01a8[_0xd69e('0x28')],_0x4bb875[_0xd69e('0x2f')]));if(_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x49')]){_0x473f0c[_0xd69e('0x46')]=_[_0xd69e('0x34')](_0x473f0c[_0xd69e('0x46')],{'$or':_[_0xd69e('0x21')](_0x473f0c[_0xd69e('0x30')],function(_0x5a095d){var _0x196d53={};_0x196d53[_0x5a095d]={'$like':'%'+_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x49')]+'%'};return _0x196d53;})});}_0x473f0c=_[_0xd69e('0x34')]({},_0x473f0c,_0x4b01a8[_0xd69e('0x35')]);return _0x1bfe27[_0xd69e('0x7b')](_0x473f0c);}})[_0xd69e('0x1a')](function(_0x2d331f){if(_0x2d331f){_0x3da6bc=_0x2d331f[_0xd69e('0x32')];if(!_0x4b01a8[_0xd69e('0x28')][_0xd69e('0x43')](_0xd69e('0x44'))){_0x473f0c[_0xd69e('0x16')]=qs[_0xd69e('0x16')](_0x4b01a8[_0xd69e('0x28')]['limit']);_0x473f0c['offset']=qs[_0xd69e('0x14')](_0x4b01a8[_0xd69e('0x28')]['offset']);}return _0x1bfe27[_0xd69e('0x7b')](_0x473f0c);}})[_0xd69e('0x1a')](function(_0x39d8ab){if(_0x39d8ab){return _0x39d8ab?{'count':_0x3da6bc,'rows':_0x39d8ab}:null;}})['then'](respondWithResult(_0x33060f,null))[_0xd69e('0x37')](handleError(_0x33060f,null));}; \ No newline at end of file +var _0xd4ab=['update','destroy','then','get','OpenchannelQueues','UserProfileResource','end','sendStatus','error','stack','name','send','map','OpenchannelQueue','fieldName','key','getOptions','where','count','include','findAll','rows','catch','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','length','nolimit','order','sort','pick','OpenchannelQueueId','filter','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','status','json','undefined','limit','offset','set','Content-Range'];(function(_0x3046ea,_0x206d8e){var _0xcddba4=function(_0x9d759){while(--_0x9d759){_0x3046ea['push'](_0x3046ea['shift']());}};_0xcddba4(++_0x206d8e);}(_0xd4ab,0x15a));var _0xbd4a=function(_0x246412,_0x2f9b17){_0x246412=_0x246412-0x0;var _0x41aaf5=_0xd4ab[_0x246412];return _0x41aaf5;};'use strict';var BPromise=require('bluebird');var util=require(_0xbd4a('0x0'));var _=require(_0xbd4a('0x1'));var squel=require(_0xbd4a('0x2'));var Redis=require(_0xbd4a('0x3'));var qs=require(_0xbd4a('0x4'));var logger=require(_0xbd4a('0x5'))(_0xbd4a('0x6'));var config=require(_0xbd4a('0x7'));var db=require(_0xbd4a('0x8'))['db'];config['redis']=_['defaults'](config[_0xbd4a('0x9')],{'host':_0xbd4a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd4a('0x9')]));require(_0xbd4a('0xb'))[_0xbd4a('0xc')](socket);function respondWithStatusCode(_0x5477c2,_0x385c61){_0x385c61=_0x385c61||0xcc;return function(_0x418c70){if(_0x418c70){return _0x5477c2['sendStatus'](_0x385c61);}return _0x5477c2['status'](_0x385c61)['end']();};}function respondWithResult(_0x93f2fb,_0x568002){_0x568002=_0x568002||0xc8;return function(_0x4003a2){if(_0x4003a2){return _0x93f2fb[_0xbd4a('0xd')](_0x568002)[_0xbd4a('0xe')](_0x4003a2);}};}function respondWithFilteredResult(_0x2b681e,_0x396d9f){return function(_0x3b1cd8){if(_0x3b1cd8){var _0xd58352=typeof _0x396d9f['offset']===_0xbd4a('0xf')&&typeof _0x396d9f[_0xbd4a('0x10')]===_0xbd4a('0xf');var _0x520b0c=_0x3b1cd8['count'];var _0x101b62=_0xd58352?0x0:_0x396d9f[_0xbd4a('0x11')];var _0x272890=_0xd58352?_0x3b1cd8['count']:_0x396d9f[_0xbd4a('0x11')]+_0x396d9f[_0xbd4a('0x10')];var _0x247626;if(_0x272890>=_0x520b0c){_0x272890=_0x520b0c;_0x247626=0xc8;}else{_0x247626=0xce;}_0x2b681e[_0xbd4a('0xd')](_0x247626);return _0x2b681e[_0xbd4a('0x12')](_0xbd4a('0x13'),_0x101b62+'-'+_0x272890+'/'+_0x520b0c)[_0xbd4a('0xe')](_0x3b1cd8);}return null;};}function saveUpdates(_0x3109f8){return function(_0x2147de){if(_0x2147de){return _0x2147de[_0xbd4a('0x14')](_0x3109f8)['then'](function(_0x24b14e){return _0x24b14e;});}return null;};}function removeEntity(_0x39bd9e){return function(_0x5b1e3e){if(_0x5b1e3e){return _0x5b1e3e[_0xbd4a('0x15')]()[_0xbd4a('0x16')](function(){var _0x4ef52b=_0x5b1e3e[_0xbd4a('0x17')]({'plain':!![]});var _0x3f5c8d=_0xbd4a('0x18');return db[_0xbd4a('0x19')]['destroy']({'where':{'type':_0x3f5c8d,'resourceId':_0x4ef52b['id']}})[_0xbd4a('0x16')](function(){return _0x5b1e3e;});})[_0xbd4a('0x16')](function(){_0x39bd9e[_0xbd4a('0xd')](0xcc)[_0xbd4a('0x1a')]();});}};}function handleEntityNotFound(_0x5eeeb8){return function(_0x59b30f){if(!_0x59b30f){_0x5eeeb8[_0xbd4a('0x1b')](0x194);}return _0x59b30f;};}function handleError(_0x284ee6,_0x33927e){_0x33927e=_0x33927e||0x1f4;return function(_0x17eb0f){logger[_0xbd4a('0x1c')](_0x17eb0f[_0xbd4a('0x1d')]);if(_0x17eb0f['name']){delete _0x17eb0f[_0xbd4a('0x1e')];}_0x284ee6[_0xbd4a('0xd')](_0x33927e)[_0xbd4a('0x1f')](_0x17eb0f);};}exports['index']=function(_0xbe7e14,_0x4416e3){var _0x18229f={};var _0x4f21af={'count':0x0,'rows':[]};var _0x3c7096=_[_0xbd4a('0x20')](db[_0xbd4a('0x21')]['rawAttributes'],function(_0x552b29){return{'name':_0x552b29[_0xbd4a('0x22')],'type':_0x552b29['type'][_0xbd4a('0x23')]};});_0x18229f=qs[_0xbd4a('0x24')](_0x3c7096,_0xbe7e14);var _0x425f32={'where':_0x18229f[_0xbd4a('0x25')]};return db[_0xbd4a('0x21')][_0xbd4a('0x26')](_0x425f32)['then'](function(_0x55e074){_0x4f21af[_0xbd4a('0x26')]=_0x55e074;_0x18229f[_0xbd4a('0x27')]=qs['include'](_0xbe7e14['query']);return db[_0xbd4a('0x21')][_0xbd4a('0x28')](_0x18229f);})[_0xbd4a('0x16')](function(_0x269c00){_0x4f21af[_0xbd4a('0x29')]=_0x269c00;return _0x4f21af;})['then'](respondWithFilteredResult(_0x4416e3,_0x18229f))[_0xbd4a('0x2a')](handleError(_0x4416e3,null));};exports['show']=function(_0x57b7a6,_0x279ead){var _0x4dae88={'raw':!![],'where':{'id':_0x57b7a6[_0xbd4a('0x2b')]['id']}},_0x2f7706={};_0x2f7706[_0xbd4a('0x2c')]=_[_0xbd4a('0x2d')](db[_0xbd4a('0x21')][_0xbd4a('0x2e')]);_0x2f7706[_0xbd4a('0x2f')]=_[_0xbd4a('0x2d')](_0x57b7a6['query']);_0x2f7706[_0xbd4a('0x30')]=_[_0xbd4a('0x31')](_0x2f7706[_0xbd4a('0x2c')],_0x2f7706[_0xbd4a('0x2f')]);_0x4dae88[_0xbd4a('0x32')]=_[_0xbd4a('0x31')](_0x2f7706[_0xbd4a('0x2c')],qs['fields'](_0x57b7a6['query'][_0xbd4a('0x33')]));_0x4dae88[_0xbd4a('0x32')]=_0x4dae88[_0xbd4a('0x32')]['length']?_0x4dae88[_0xbd4a('0x32')]:_0x2f7706[_0xbd4a('0x2c')];if(_0x57b7a6[_0xbd4a('0x2f')][_0xbd4a('0x34')]){_0x4dae88[_0xbd4a('0x27')]=[{'all':!![]}];}_0x4dae88=_[_0xbd4a('0x35')]({},_0x4dae88,_0x57b7a6[_0xbd4a('0x36')]);return db[_0xbd4a('0x21')][_0xbd4a('0x37')](_0x4dae88)['then'](handleEntityNotFound(_0x279ead,null))['then'](respondWithResult(_0x279ead,null))[_0xbd4a('0x2a')](handleError(_0x279ead,null));};exports[_0xbd4a('0x38')]=function(_0xfe3169,_0xdf1986){return db[_0xbd4a('0x21')][_0xbd4a('0x38')](_0xfe3169[_0xbd4a('0x39')],{})[_0xbd4a('0x16')](function(_0x1e71b6){var _0xb514b8=_0xfe3169[_0xbd4a('0x3a')][_0xbd4a('0x17')]({'plain':!![]});if(!_0xb514b8)throw new Error(_0xbd4a('0x3b'));if(_0xb514b8[_0xbd4a('0x3c')]===_0xbd4a('0x3a')){var _0x609511=_0x1e71b6[_0xbd4a('0x17')]({'plain':!![]});var _0x26ded5=_0xbd4a('0x18');return db[_0xbd4a('0x3d')]['find']({'where':{'name':_0x26ded5,'userProfileId':_0xb514b8[_0xbd4a('0x3e')]},'raw':!![]})[_0xbd4a('0x16')](function(_0x39af46){if(_0x39af46&&_0x39af46[_0xbd4a('0x3f')]===0x0){return db[_0xbd4a('0x19')][_0xbd4a('0x38')]({'name':_0x609511[_0xbd4a('0x1e')],'resourceId':_0x609511['id'],'type':_0x39af46['name'],'sectionId':_0x39af46['id']},{})['then'](function(){return _0x1e71b6;});}else{return _0x1e71b6;}})[_0xbd4a('0x2a')](function(_0xeb379){logger['error'](_0xbd4a('0x40'),_0xeb379);throw _0xeb379;});}return _0x1e71b6;})[_0xbd4a('0x16')](respondWithResult(_0xdf1986,0xc9))[_0xbd4a('0x2a')](handleError(_0xdf1986,null));};exports['update']=function(_0x12b5a5,_0x451b34){if(_0x12b5a5[_0xbd4a('0x39')]['id']){delete _0x12b5a5[_0xbd4a('0x39')]['id'];}return db[_0xbd4a('0x21')][_0xbd4a('0x37')]({'where':{'id':_0x12b5a5[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](handleEntityNotFound(_0x451b34,null))[_0xbd4a('0x16')](saveUpdates(_0x12b5a5['body'],null))['then'](respondWithResult(_0x451b34,null))[_0xbd4a('0x2a')](handleError(_0x451b34,null));};exports[_0xbd4a('0x15')]=function(_0x29b7fd,_0x170411){return db[_0xbd4a('0x21')][_0xbd4a('0x37')]({'where':{'id':_0x29b7fd[_0xbd4a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x170411,null))[_0xbd4a('0x16')](removeEntity(_0x170411,null))[_0xbd4a('0x2a')](handleError(_0x170411,null));};exports['describe']=function(_0x144820,_0x24e647){return db[_0xbd4a('0x21')][_0xbd4a('0x41')]()[_0xbd4a('0x16')](respondWithResult(_0x24e647,null))['catch'](handleError(_0x24e647,null));};exports[_0xbd4a('0x42')]=function(_0x5c9feb,_0x151c4f){var _0xa06061={'raw':!![],'where':{}},_0x3d44e7={},_0x3b933d;return db[_0xbd4a('0x21')][_0xbd4a('0x43')]({'where':{'id':_0x5c9feb[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](handleEntityNotFound(_0x151c4f,null))[_0xbd4a('0x16')](function(_0x260a1e){if(_0x260a1e){_0x3b933d=_0x260a1e[_0xbd4a('0x17')]({'plain':!![]});_0x3d44e7[_0xbd4a('0x2c')]=_[_0xbd4a('0x2d')](db[_0xbd4a('0x44')][_0xbd4a('0x2e')]);_0x3d44e7[_0xbd4a('0x2f')]=_['keys'](_0x5c9feb['query']);_0x3d44e7['filters']=_[_0xbd4a('0x31')](_0x3d44e7[_0xbd4a('0x2c')],_0x3d44e7[_0xbd4a('0x2f')]);_0xa06061['attributes']=_['intersection'](_0x3d44e7[_0xbd4a('0x2c')],qs[_0xbd4a('0x33')](_0x5c9feb[_0xbd4a('0x2f')][_0xbd4a('0x33')]));_0xa06061[_0xbd4a('0x32')]=_0xa06061[_0xbd4a('0x32')][_0xbd4a('0x45')]?_0xa06061['attributes']:_0x3d44e7[_0xbd4a('0x2c')];if(!_0x5c9feb[_0xbd4a('0x2f')]['hasOwnProperty'](_0xbd4a('0x46'))){_0xa06061['limit']=qs['limit'](_0x5c9feb['query'][_0xbd4a('0x10')]);_0xa06061[_0xbd4a('0x11')]=qs[_0xbd4a('0x11')](_0x5c9feb[_0xbd4a('0x2f')][_0xbd4a('0x11')]);}_0xa06061[_0xbd4a('0x47')]=qs[_0xbd4a('0x48')](_0x5c9feb[_0xbd4a('0x2f')]['sort']);_0xa06061[_0xbd4a('0x25')]=qs[_0xbd4a('0x30')](_[_0xbd4a('0x49')](_0x5c9feb[_0xbd4a('0x2f')],_0x3d44e7[_0xbd4a('0x30')]));_0xa06061[_0xbd4a('0x25')][_0xbd4a('0x4a')]=_0x260a1e['id'];if(_0x5c9feb[_0xbd4a('0x2f')][_0xbd4a('0x4b')]){_0xa06061['where']=_[_0xbd4a('0x35')](_0xa06061[_0xbd4a('0x25')],{'$or':_['map'](_0xa06061['attributes'],function(_0x7507b3){var _0x4005d3={};_0x4005d3[_0x7507b3]={'$like':'%'+_0x5c9feb['query'][_0xbd4a('0x4b')]+'%'};return _0x4005d3;})});}_0xa06061=_[_0xbd4a('0x35')]({},_0xa06061,_0x5c9feb[_0xbd4a('0x36')]);return db[_0xbd4a('0x44')]['findAll'](_0xa06061);}})[_0xbd4a('0x16')](function(_0x18864){if(_0x18864){return db[_0xbd4a('0x4c')]['findAndCountAll']({'where':{'id':_['map'](_0x18864,_0xbd4a('0x4d')),'role':_0xbd4a('0x4e')},'attributes':['id',_0xbd4a('0x1e'),_0xbd4a('0x4f'),_0xbd4a('0x50'),_0xbd4a('0x51')]});}})[_0xbd4a('0x16')](function(_0x4a5c8a){if(_0x4a5c8a){return{'count':_0x4a5c8a[_0xbd4a('0x26')],'rows':_[_0xbd4a('0x20')](_0x4a5c8a[_0xbd4a('0x29')],function(_0x43b0a2){return{'membername':_0x43b0a2['name'],'UserId':_0x43b0a2['id'],'queue_name':_0x3b933d[_0xbd4a('0x1e')],'OpenchannelQueueId':_0x3b933d['id'],'interface':util[_0xbd4a('0x52')](_0xbd4a('0x53'),'SIP',_0x43b0a2[_0xbd4a('0x1e')]),'penalty':0x0,'paused':_0x43b0a2[_0xbd4a('0x4f')],'createdAt':_0x43b0a2[_0xbd4a('0x51')],'updatedAt':_0x43b0a2[_0xbd4a('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd4a('0x16')](respondWithFilteredResult(_0x151c4f,_0xa06061))['catch'](handleError(_0x151c4f,null));};exports[_0xbd4a('0x54')]=function(_0x5766a1,_0x31af1b){var _0x4dd2eb={};var _0x3a6948={};var _0xe89c31;var _0x3e8c40;return db['OpenchannelQueue'][_0xbd4a('0x43')]({'where':{'id':_0x5766a1[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](handleEntityNotFound(_0x31af1b,null))['then'](function(_0x454b9b){if(_0x454b9b){_0xe89c31=_0x454b9b;_0x3a6948[_0xbd4a('0x2c')]=_['keys'](db[_0xbd4a('0x55')]['rawAttributes']);_0x3a6948[_0xbd4a('0x2f')]=_[_0xbd4a('0x2d')](_0x5766a1[_0xbd4a('0x2f')]);_0x3a6948['filters']=_[_0xbd4a('0x31')](_0x3a6948[_0xbd4a('0x2c')],_0x3a6948[_0xbd4a('0x2f')]);_0x4dd2eb[_0xbd4a('0x32')]=_[_0xbd4a('0x31')](_0x3a6948['model'],qs['fields'](_0x5766a1['query'][_0xbd4a('0x33')]));_0x4dd2eb[_0xbd4a('0x32')]=_0x4dd2eb[_0xbd4a('0x32')]['length']?_0x4dd2eb[_0xbd4a('0x32')]:_0x3a6948[_0xbd4a('0x2c')];_0x4dd2eb[_0xbd4a('0x47')]=qs[_0xbd4a('0x48')](_0x5766a1[_0xbd4a('0x2f')][_0xbd4a('0x48')]);_0x4dd2eb[_0xbd4a('0x25')]=qs['filters'](_[_0xbd4a('0x49')](_0x5766a1[_0xbd4a('0x2f')],_0x3a6948[_0xbd4a('0x30')]));if(_0x5766a1['query'][_0xbd4a('0x4b')]){_0x4dd2eb['where']=_[_0xbd4a('0x35')](_0x4dd2eb[_0xbd4a('0x25')],{'$or':_[_0xbd4a('0x20')](_0x4dd2eb[_0xbd4a('0x32')],function(_0x194ae1){var _0x37df26={};_0x37df26[_0x194ae1]={'$like':'%'+_0x5766a1['query']['filter']+'%'};return _0x37df26;})});}_0x4dd2eb=_[_0xbd4a('0x35')]({},_0x4dd2eb,_0x5766a1[_0xbd4a('0x36')]);return _0xe89c31[_0xbd4a('0x54')](_0x4dd2eb);}})['then'](function(_0x5aac03){if(_0x5aac03){_0x3e8c40=_0x5aac03[_0xbd4a('0x45')];if(!_0x5766a1[_0xbd4a('0x2f')][_0xbd4a('0x56')](_0xbd4a('0x46'))){_0x4dd2eb[_0xbd4a('0x10')]=qs[_0xbd4a('0x10')](_0x5766a1['query'][_0xbd4a('0x10')]);_0x4dd2eb[_0xbd4a('0x11')]=qs[_0xbd4a('0x11')](_0x5766a1['query'][_0xbd4a('0x11')]);}return _0xe89c31['getTeams'](_0x4dd2eb);}})[_0xbd4a('0x16')](function(_0x15bd30){if(_0x15bd30){return _0x15bd30?{'count':_0x3e8c40,'rows':_0x15bd30}:null;}})[_0xbd4a('0x16')](respondWithResult(_0x31af1b,null))[_0xbd4a('0x2a')](handleError(_0x31af1b,null));};exports[_0xbd4a('0x57')]=function(_0x1c2b19,_0x424d63){var _0x35e11a=_0x1c2b19[_0xbd4a('0x39')][_0xbd4a('0x58')];return db[_0xbd4a('0x55')][_0xbd4a('0x28')]({'where':{'id':_0x35e11a},'attributes':['id'],'include':[{'model':db[_0xbd4a('0x4c')],'as':'Agents','attributes':['id','name',_0xbd4a('0x59'),_0xbd4a('0x5a'),'interface'],'raw':!![]}]})[_0xbd4a('0x16')](function(_0x5eeb74){if(_0x5eeb74){var _0x2077ee=_[_0xbd4a('0x5b')](_0x5eeb74,function(_0x156bfb){var _0x8394df=_0x156bfb[_0xbd4a('0x17')]({'plain':!![]});return _0x8394df[_0xbd4a('0x5c')];});return db[_0xbd4a('0x21')][_0xbd4a('0x37')]({'where':{'id':_0x1c2b19[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](function(_0x13ad15){return db['sequelize'][_0xbd4a('0x5d')](function(_0x2c83da){return _0x13ad15['addTeams'](_0x35e11a,{'transaction':_0x2c83da})[_0xbd4a('0x16')](function(){return BPromise[_0xbd4a('0x5e')](_0x2077ee,function(_0x525655){return db[_0xbd4a('0x44')][_0xbd4a('0x5f')]({'where':{'UserId':_0x525655['id'],'OpenchannelQueueId':_0x1c2b19[_0xbd4a('0x2b')]['id']},'transaction':_0x2c83da});});})[_0xbd4a('0x16')](function(){_0x2077ee[_0xbd4a('0x60')](function(_0x461814){socket[_0xbd4a('0x61')]('userOpenchannelQueue:save',{'UserId':_0x461814['id'],'OpenchannelQueueId':_0x13ad15['id']});});});});});}})[_0xbd4a('0x16')](respondWithStatusCode(_0x424d63,null))[_0xbd4a('0x2a')](handleError(_0x424d63,null));};exports[_0xbd4a('0x62')]=function(_0xf1db46,_0x2e4013){return db[_0xbd4a('0x55')][_0xbd4a('0x28')]({'where':{'id':_0xf1db46[_0xbd4a('0x2f')][_0xbd4a('0x58')]},'attributes':['id'],'include':[{'model':db[_0xbd4a('0x4c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbd4a('0x16')](handleEntityNotFound(_0x2e4013,null))['then'](function(_0x3790d4){var _0x3c44f6=_['map'](_0x3790d4,'id');var _0x1c6834=[];var _0x481c3f=[];var _0x3f1389=squel['select']();_0x3f1389[_0xbd4a('0x63')](_0xbd4a('0x64'))['from'](_0xbd4a('0x65'),'tq')['join'](_0xbd4a('0x66'),'ut',_0xbd4a('0x67'))['where']('OpenchannelQueueId\x20=\x20?',_0xf1db46[_0xbd4a('0x2b')]['id']);for(var _0x1a1ad2=0x0;_0x1a1ad2<_0x3790d4['length'];_0x1a1ad2+=0x1){let _0x549e2c=_0x3790d4[_0x1a1ad2];for(var _0x4174d8=0x0;_0x4174d8<_0x549e2c[_0xbd4a('0x5c')]['length'];_0x4174d8+=0x1){let _0x367b29=_0x549e2c[_0xbd4a('0x5c')][_0x4174d8];var _0x5eba1e=_0x3f1389['clone']();_0x5eba1e['where'](_0xbd4a('0x68'),_0x367b29['id']);_0x481c3f['push'](db[_0xbd4a('0x69')][_0xbd4a('0x2f')](_0x5eba1e[_0xbd4a('0x6a')](),{'type':db[_0xbd4a('0x69')][_0xbd4a('0x6b')]['SELECT']})[_0xbd4a('0x16')](function(_0x1f7f3b){if(_0x1f7f3b['length']===0x1){return _0x367b29['id'];}else{var _0xcb40cc=_[_0xbd4a('0x6c')](_[_0xbd4a('0x20')](_0x1f7f3b,_0xbd4a('0x6d')),function(_0x305b86){return _[_0xbd4a('0x6e')](_0x3c44f6,_0x305b86);});if(_0xcb40cc){return _0x367b29['id'];}}}));}}return BPromise['all'](_0x481c3f)[_0xbd4a('0x16')](function(_0xf1b877){_0x1c6834=_(_0x1c6834)[_0xbd4a('0x6f')](_0xf1b877)[_0xbd4a('0x70')]()[_0xbd4a('0x71')]();return db['OpenchannelQueue'][_0xbd4a('0x37')]({'where':{'id':_0xf1db46[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](function(_0x2f63a3){return db['sequelize']['transaction'](function(_0xb1c0bc){return _0x2f63a3['removeTeams'](_0xf1db46[_0xbd4a('0x2f')][_0xbd4a('0x58')],{'transaction':_0xb1c0bc})['then'](function(){if(!_[_0xbd4a('0x72')](_0x1c6834)){return _0x2f63a3['removeAgents'](_0x1c6834,{'transaction':_0xb1c0bc});}})['then'](function(){_0x1c6834[_0xbd4a('0x60')](function(_0x17bd84){socket[_0xbd4a('0x61')](_0xbd4a('0x73'),{'UserId':_0x17bd84,'OpenchannelQueueId':_0x2f63a3['id']});});});});});});})['then'](respondWithStatusCode(_0x2e4013,null))[_0xbd4a('0x2a')](handleError(_0x2e4013,null));};exports['addAgents']=function(_0x4e53fc,_0x305e31){return db[_0xbd4a('0x21')][_0xbd4a('0x37')]({'where':{'id':_0x4e53fc[_0xbd4a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x305e31,null))['then'](function(_0x2c18e6){if(_0x2c18e6){return _0x2c18e6[_0xbd4a('0x74')](_0x4e53fc[_0xbd4a('0x39')]['ids'],_[_0xbd4a('0x75')](_0x4e53fc[_0xbd4a('0x39')],['ids','id'])||{})[_0xbd4a('0x76')](function(_0x4e7297){for(var _0x5ff175=0x0;_0x5ff175<_0x4e53fc[_0xbd4a('0x39')][_0xbd4a('0x58')][_0xbd4a('0x45')];_0x5ff175+=0x1){socket[_0xbd4a('0x61')](_0xbd4a('0x77'),{'UserId':Number(_0x4e53fc[_0xbd4a('0x39')]['ids'][_0x5ff175]),'OpenchannelQueueId':Number(_0x4e53fc[_0xbd4a('0x2b')]['id'])});}return _0x4e7297;});}})[_0xbd4a('0x16')](respondWithResult(_0x305e31,null))[_0xbd4a('0x2a')](handleError(_0x305e31,null));};exports[_0xbd4a('0x78')]=function(_0xd4b81,_0x240919){return db[_0xbd4a('0x21')][_0xbd4a('0x37')]({'where':{'id':_0xd4b81[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](handleEntityNotFound(_0x240919,null))[_0xbd4a('0x16')](function(_0x2f526f){if(_0x2f526f){return _0x2f526f['removeAgents'](_0xd4b81['query']['ids'])[_0xbd4a('0x16')](function(){if(_['isArray'](_0xd4b81[_0xbd4a('0x2f')][_0xbd4a('0x58')])){for(var _0x55cb89=0x0;_0x55cb89<_0xd4b81['query']['ids'][_0xbd4a('0x45')];_0x55cb89+=0x1){socket[_0xbd4a('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd4b81[_0xbd4a('0x2f')]['ids'][_0x55cb89]),'OpenchannelQueueId':Number(_0xd4b81[_0xbd4a('0x2b')]['id'])});}}else{socket[_0xbd4a('0x61')]('userOpenchannelQueue:remove',{'UserId':Number(_0xd4b81['query'][_0xbd4a('0x58')]),'OpenchannelQueueId':Number(_0xd4b81[_0xbd4a('0x2b')]['id'])});}});}})[_0xbd4a('0x16')](respondWithStatusCode(_0x240919,null))[_0xbd4a('0x2a')](handleError(_0x240919,null));};exports['getAgents']=function(_0x240753,_0x40f855){var _0x34ed13={};var _0x1cd7dd={};var _0x5a7d0a;var _0x9247be;return db[_0xbd4a('0x21')][_0xbd4a('0x43')]({'where':{'id':_0x240753[_0xbd4a('0x2b')]['id']}})[_0xbd4a('0x16')](handleEntityNotFound(_0x40f855,null))[_0xbd4a('0x16')](function(_0x855ac1){if(_0x855ac1){_0x5a7d0a=_0x855ac1;_0x1cd7dd[_0xbd4a('0x2c')]=_[_0xbd4a('0x2d')](db[_0xbd4a('0x4c')][_0xbd4a('0x2e')]);_0x1cd7dd[_0xbd4a('0x2f')]=_[_0xbd4a('0x2d')](_0x240753[_0xbd4a('0x2f')]);_0x1cd7dd[_0xbd4a('0x30')]=_[_0xbd4a('0x31')](_0x1cd7dd[_0xbd4a('0x2c')],_0x1cd7dd[_0xbd4a('0x2f')]);_0x34ed13['attributes']=_['intersection'](_0x1cd7dd[_0xbd4a('0x2c')],qs[_0xbd4a('0x33')](_0x240753['query'][_0xbd4a('0x33')]));_0x34ed13[_0xbd4a('0x32')]=_0x34ed13[_0xbd4a('0x32')][_0xbd4a('0x45')]?_0x34ed13[_0xbd4a('0x32')]:_0x1cd7dd[_0xbd4a('0x2c')];_0x34ed13['order']=qs[_0xbd4a('0x48')](_0x240753[_0xbd4a('0x2f')][_0xbd4a('0x48')]);_0x34ed13[_0xbd4a('0x25')]=qs[_0xbd4a('0x30')](_['pick'](_0x240753['query'],_0x1cd7dd[_0xbd4a('0x30')]));if(_0x240753['query'][_0xbd4a('0x4b')]){_0x34ed13[_0xbd4a('0x25')]=_[_0xbd4a('0x35')](_0x34ed13[_0xbd4a('0x25')],{'$or':_['map'](_0x34ed13['attributes'],function(_0x498c22){var _0x17ebb3={};_0x17ebb3[_0x498c22]={'$like':'%'+_0x240753[_0xbd4a('0x2f')][_0xbd4a('0x4b')]+'%'};return _0x17ebb3;})});}_0x34ed13=_['merge']({},_0x34ed13,_0x240753[_0xbd4a('0x36')]);return _0x5a7d0a[_0xbd4a('0x79')](_0x34ed13);}})[_0xbd4a('0x16')](function(_0x540d99){if(_0x540d99){_0x9247be=_0x540d99['length'];if(!_0x240753[_0xbd4a('0x2f')][_0xbd4a('0x56')]('nolimit')){_0x34ed13['limit']=qs[_0xbd4a('0x10')](_0x240753[_0xbd4a('0x2f')]['limit']);_0x34ed13[_0xbd4a('0x11')]=qs[_0xbd4a('0x11')](_0x240753[_0xbd4a('0x2f')][_0xbd4a('0x11')]);}return _0x5a7d0a[_0xbd4a('0x79')](_0x34ed13);}})[_0xbd4a('0x16')](function(_0x5d0076){if(_0x5d0076){return _0x5d0076?{'count':_0x9247be,'rows':_0x5d0076}:null;}})[_0xbd4a('0x16')](respondWithResult(_0x40f855,null))['catch'](handleError(_0x40f855,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4040254..d531306 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 _0x3e26=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x59e0fc,_0x2ad48c){var _0x477e19=function(_0x3fabc9){while(--_0x3fabc9){_0x59e0fc['push'](_0x59e0fc['shift']());}};_0x477e19(++_0x2ad48c);}(_0x3e26,0xe1));var _0x63e2=function(_0x346687,_0x1e1bd8){_0x346687=_0x346687-0x0;var _0x31d223=_0x3e26[_0x346687];return _0x31d223;};'use strict';var EventEmitter=require(_0x63e2('0x0'));var OpenchannelQueue=require(_0x63e2('0x1'))['db'][_0x63e2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x63e2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x63e2('0x4'),'afterDestroy':_0x63e2('0x5')};function emitEvent(_0x1fdca0){return function(_0x1ef797,_0x4df2ff,_0x3a42c1){OpenchannelQueueEvents[_0x63e2('0x6')](_0x1fdca0+':'+_0x1ef797['id'],_0x1ef797);OpenchannelQueueEvents['emit'](_0x1fdca0,_0x1ef797);_0x3a42c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x63e2('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x01ad=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2c1670,_0x50c1a8){var _0x4b6b91=function(_0xadec93){while(--_0xadec93){_0x2c1670['push'](_0x2c1670['shift']());}};_0x4b6b91(++_0x50c1a8);}(_0x01ad,0x1ba));var _0xd01a=function(_0x346df7,_0x3404ad){_0x346df7=_0x346df7-0x0;var _0x504fd8=_0x01ad[_0x346df7];return _0x504fd8;};'use strict';var EventEmitter=require(_0xd01a('0x0'));var OpenchannelQueue=require(_0xd01a('0x1'))['db'][_0xd01a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd01a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd01a('0x4'),'afterDestroy':_0xd01a('0x5')};function emitEvent(_0x24cd81){return function(_0x1e38cd,_0x26d5a1,_0x5aae1a){OpenchannelQueueEvents[_0xd01a('0x6')](_0x24cd81+':'+_0x1e38cd['id'],_0x1e38cd);OpenchannelQueueEvents[_0xd01a('0x6')](_0x24cd81,_0x1e38cd);_0x5aae1a(null);};}for(var e in events){if(events[_0xd01a('0x7')](e)){var event=events[e];OpenchannelQueue[_0xd01a('0x8')](e,emitEvent(event));}}module[_0xd01a('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 210644b..877cccb 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 _0xdd28=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x10035e,_0x1315b5){var _0x3f64b4=function(_0x189276){while(--_0x189276){_0x10035e['push'](_0x10035e['shift']());}};_0x3f64b4(++_0x1315b5);}(_0xdd28,0xfb));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var util=require(_0x8dd2('0x1'));var logger=require(_0x8dd2('0x2'))(_0x8dd2('0x3'));var moment=require(_0x8dd2('0x4'));var BPromise=require(_0x8dd2('0x5'));var rp=require(_0x8dd2('0x6'));var fs=require('fs');var path=require(_0x8dd2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x8dd2('0x8')]=function(_0x5ac649,_0x27abef){return _0x5ac649[_0x8dd2('0x9')](_0x8dd2('0xa'),attributes,{'tableName':_0x8dd2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9294=['request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5ddb95,_0x59b0ef){var _0x53e2e7=function(_0x4892f5){while(--_0x4892f5){_0x5ddb95['push'](_0x5ddb95['shift']());}};_0x53e2e7(++_0x59b0ef);}(_0x9294,0xbd));var _0x4929=function(_0x10e870,_0x4c4324){_0x10e870=_0x10e870-0x0;var _0x29b93d=_0x9294[_0x10e870];return _0x29b93d;};'use strict';var _=require(_0x4929('0x0'));var util=require(_0x4929('0x1'));var logger=require(_0x4929('0x2'))(_0x4929('0x3'));var moment=require(_0x4929('0x4'));var BPromise=require(_0x4929('0x5'));var rp=require(_0x4929('0x6'));var fs=require('fs');var path=require(_0x4929('0x7'));var rimraf=require('rimraf');var config=require(_0x4929('0x8'));var attributes=require(_0x4929('0x9'));module[_0x4929('0xa')]=function(_0x46e342,_0x10e36e){return _0x46e342[_0x4929('0xb')]('OpenchannelQueue',attributes,{'tableName':_0x4929('0xc'),'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 8ad6254..bf65e37 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 _0x28d8=['error','code','message','result','catch','OpenchannelQueue','options','raw','where','attributes','limit','map','model','include','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','util','moment','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x315843,_0x301556){var _0x4fd3bc=function(_0x498e22){while(--_0x498e22){_0x315843['push'](_0x315843['shift']());}};_0x4fd3bc(++_0x301556);}(_0x28d8,0x168));var _0x828d=function(_0x482ed9,_0x589513){_0x482ed9=_0x482ed9-0x0;var _0x4a55f1=_0x28d8[_0x482ed9];return _0x4a55f1;};'use strict';var _=require('lodash');var util=require(_0x828d('0x0'));var moment=require(_0x828d('0x1'));var BPromise=require('bluebird');var rs=require(_0x828d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x828d('0x3'))['db'];var utils=require(_0x828d('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x828d('0x5'));var client=jayson[_0x828d('0x6')][_0x828d('0x7')]({'port':0x232a});config['redis']=_[_0x828d('0x8')](config[_0x828d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x828d('0xa'))(new Redis(config['redis']));require(_0x828d('0xb'))[_0x828d('0xc')](socket);function respondWithRpcPromise(_0x23f433,_0x30a6ed,_0x9182f8){return new BPromise(function(_0x427aab,_0x2dc4f6){return client[_0x828d('0xd')](_0x23f433,_0x9182f8)[_0x828d('0xe')](function(_0x1a7624){logger[_0x828d('0xf')](_0x828d('0x10'),_0x30a6ed,'request\x20sent');logger[_0x828d('0x11')](_0x828d('0x12'),_0x30a6ed,_0x828d('0x13'),JSON['stringify'](_0x1a7624));if(_0x1a7624[_0x828d('0x14')]){if(_0x1a7624[_0x828d('0x14')][_0x828d('0x15')]===0x1f4){logger[_0x828d('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x30a6ed,_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);return _0x2dc4f6(_0x1a7624['error'][_0x828d('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x30a6ed,_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);return _0x427aab(_0x1a7624[_0x828d('0x14')][_0x828d('0x16')]);}else{logger[_0x828d('0xf')](_0x828d('0x10'),_0x30a6ed,'request\x20sent');_0x427aab(_0x1a7624[_0x828d('0x17')][_0x828d('0x16')]);}})[_0x828d('0x18')](function(_0x1ab551){logger[_0x828d('0x14')](_0x828d('0x10'),_0x30a6ed,_0x1ab551);_0x2dc4f6(_0x1ab551);});});}exports['GetOpenchannelQueue']=function(_0x5f361d){var _0x52bb40=this;return new Promise(function(_0x15f97a,_0x22eebf){return db[_0x828d('0x19')]['findAll']({'raw':_0x5f361d['options']?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1b')]===undefined?!![]:![]:!![],'where':_0x5f361d[_0x828d('0x1a')]?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1c')]||null:null,'attributes':_0x5f361d[_0x828d('0x1a')]?_0x5f361d['options'][_0x828d('0x1d')]||null:null,'limit':_0x5f361d['options']?_0x5f361d[_0x828d('0x1a')][_0x828d('0x1e')]||null:null,'include':_0x5f361d[_0x828d('0x1a')]?_0x5f361d[_0x828d('0x1a')]['include']?_[_0x828d('0x1f')](_0x5f361d['options']['include'],function(_0x59147a){return{'model':db[_0x59147a[_0x828d('0x20')]],'as':_0x59147a['as'],'attributes':_0x59147a[_0x828d('0x1d')],'include':_0x59147a['include']?_[_0x828d('0x1f')](_0x59147a[_0x828d('0x21')],function(_0x5ebb68){return{'model':db[_0x5ebb68[_0x828d('0x20')]],'as':_0x5ebb68['as'],'attributes':_0x5ebb68[_0x828d('0x1d')],'include':_0x5ebb68[_0x828d('0x21')]?_[_0x828d('0x1f')](_0x5ebb68[_0x828d('0x21')],function(_0x23b6a6){return{'model':db[_0x23b6a6['model']],'as':_0x23b6a6['as'],'attributes':_0x23b6a6[_0x828d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x828d('0xe')](function(_0x142b20){logger[_0x828d('0xf')](_0x828d('0x22'),_0x5f361d);logger[_0x828d('0x11')](_0x828d('0x22'),_0x5f361d,JSON[_0x828d('0x23')](_0x142b20));_0x15f97a(_0x142b20);})[_0x828d('0x18')](function(_0x37bac0){logger[_0x828d('0x14')](_0x828d('0x22'),_0x37bac0[_0x828d('0x16')],_0x5f361d);_0x22eebf(_0x52bb40[_0x828d('0x14')](0x1f4,_0x37bac0['message']));});});};exports[_0x828d('0x24')]=function(_0x49c860){var _0xee4495=this;return new Promise(function(_0x1f57ee,_0x22d0a1){return db['OpenchannelQueue'][_0x828d('0x25')]({'raw':_0x49c860[_0x828d('0x1a')]?_0x49c860['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')][_0x828d('0x1c')]||null:null,'attributes':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')]['attributes']||null:null,'include':_0x49c860[_0x828d('0x1a')]?_0x49c860[_0x828d('0x1a')][_0x828d('0x21')]?_[_0x828d('0x1f')](_0x49c860[_0x828d('0x1a')]['include'],function(_0x2e5b25){return{'model':db[_0x2e5b25['model']],'as':_0x2e5b25['as'],'attributes':_0x2e5b25[_0x828d('0x1d')],'include':_0x2e5b25[_0x828d('0x21')]?_['map'](_0x2e5b25[_0x828d('0x21')],function(_0x5d1f29){return{'model':db[_0x5d1f29[_0x828d('0x20')]],'as':_0x5d1f29['as'],'attributes':_0x5d1f29[_0x828d('0x1d')],'include':_0x5d1f29[_0x828d('0x21')]?_[_0x828d('0x1f')](_0x5d1f29[_0x828d('0x21')],function(_0x562dab){return{'model':db[_0x562dab[_0x828d('0x20')]],'as':_0x562dab['as'],'attributes':_0x562dab['attributes']};}):[]};}):[]};}):[]:[]})[_0x828d('0xe')](function(_0x36bca8){logger['info'](_0x828d('0x24'),_0x49c860);logger['debug'](_0x828d('0x24'),_0x49c860,JSON[_0x828d('0x23')](_0x36bca8));_0x1f57ee(_0x36bca8);})['catch'](function(_0x4751c4){logger[_0x828d('0x14')](_0x828d('0x24'),_0x4751c4[_0x828d('0x16')],_0x49c860);_0x22d0a1(_0xee4495[_0x828d('0x14')](0x1f4,_0x4751c4[_0x828d('0x16')]));});});}; \ No newline at end of file +var _0x9721=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','map','include','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','lodash','util','randomstring'];(function(_0x25900e,_0x544d8a){var _0x1ed711=function(_0xf3ede9){while(--_0xf3ede9){_0x25900e['push'](_0x25900e['shift']());}};_0x1ed711(++_0x544d8a);}(_0x9721,0x8d));var _0x1972=function(_0xd40243,_0x531200){_0xd40243=_0xd40243-0x0;var _0x232d4c=_0x9721[_0xd40243];return _0x232d4c;};'use strict';var _=require(_0x1972('0x0'));var util=require(_0x1972('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1972('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1972('0x3'))['db'];var utils=require(_0x1972('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1972('0x5'));var jayson=require(_0x1972('0x6'));var client=jayson[_0x1972('0x7')]['http']({'port':0x232a});config[_0x1972('0x8')]=_['defaults'](config[_0x1972('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1972('0x9'))(new Redis(config[_0x1972('0x8')]));require(_0x1972('0xa'))[_0x1972('0xb')](socket);function respondWithRpcPromise(_0x15866d,_0x17fe33,_0x1bc56e){return new BPromise(function(_0xee0a6e,_0x195dae){return client[_0x1972('0xc')](_0x15866d,_0x1bc56e)[_0x1972('0xd')](function(_0x4941b9){logger[_0x1972('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x17fe33,_0x1972('0xf'));logger[_0x1972('0x10')](_0x1972('0x11'),_0x17fe33,_0x1972('0xf'),JSON['stringify'](_0x4941b9));if(_0x4941b9[_0x1972('0x12')]){if(_0x4941b9['error'][_0x1972('0x13')]===0x1f4){logger['error'](_0x1972('0x14'),_0x17fe33,_0x4941b9[_0x1972('0x12')][_0x1972('0x15')]);return _0x195dae(_0x4941b9['error']['message']);}logger[_0x1972('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x17fe33,_0x4941b9['error'][_0x1972('0x15')]);return _0xee0a6e(_0x4941b9[_0x1972('0x12')][_0x1972('0x15')]);}else{logger[_0x1972('0xe')](_0x1972('0x14'),_0x17fe33,_0x1972('0xf'));_0xee0a6e(_0x4941b9[_0x1972('0x16')][_0x1972('0x15')]);}})[_0x1972('0x17')](function(_0x2ddc3c){logger[_0x1972('0x12')](_0x1972('0x14'),_0x17fe33,_0x2ddc3c);_0x195dae(_0x2ddc3c);});});}exports['GetOpenchannelQueue']=function(_0xf1fd9f){var _0x496645=this;return new Promise(function(_0x41b3dd,_0xfd5399){return db[_0x1972('0x18')][_0x1972('0x19')]({'raw':_0xf1fd9f[_0x1972('0x1a')]?_0xf1fd9f[_0x1972('0x1a')][_0x1972('0x1b')]===undefined?!![]:![]:!![],'where':_0xf1fd9f[_0x1972('0x1a')]?_0xf1fd9f[_0x1972('0x1a')]['where']||null:null,'attributes':_0xf1fd9f[_0x1972('0x1a')]?_0xf1fd9f[_0x1972('0x1a')][_0x1972('0x1c')]||null:null,'limit':_0xf1fd9f['options']?_0xf1fd9f[_0x1972('0x1a')][_0x1972('0x1d')]||null:null,'include':_0xf1fd9f[_0x1972('0x1a')]?_0xf1fd9f['options']['include']?_[_0x1972('0x1e')](_0xf1fd9f[_0x1972('0x1a')]['include'],function(_0x51b97f){return{'model':db[_0x51b97f['model']],'as':_0x51b97f['as'],'attributes':_0x51b97f[_0x1972('0x1c')],'include':_0x51b97f[_0x1972('0x1f')]?_[_0x1972('0x1e')](_0x51b97f[_0x1972('0x1f')],function(_0x497eba){return{'model':db[_0x497eba[_0x1972('0x20')]],'as':_0x497eba['as'],'attributes':_0x497eba[_0x1972('0x1c')],'include':_0x497eba['include']?_[_0x1972('0x1e')](_0x497eba[_0x1972('0x1f')],function(_0x743dca){return{'model':db[_0x743dca[_0x1972('0x20')]],'as':_0x743dca['as'],'attributes':_0x743dca['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1710f5){logger[_0x1972('0xe')](_0x1972('0x21'),_0xf1fd9f);logger[_0x1972('0x10')](_0x1972('0x21'),_0xf1fd9f,JSON[_0x1972('0x22')](_0x1710f5));_0x41b3dd(_0x1710f5);})[_0x1972('0x17')](function(_0x11608f){logger['error'](_0x1972('0x21'),_0x11608f[_0x1972('0x15')],_0xf1fd9f);_0xfd5399(_0x496645[_0x1972('0x12')](0x1f4,_0x11608f['message']));});});};exports[_0x1972('0x23')]=function(_0xf99944){var _0xd3a56=this;return new Promise(function(_0x26564b,_0x150a2f){return db[_0x1972('0x18')]['find']({'raw':_0xf99944[_0x1972('0x1a')]?_0xf99944[_0x1972('0x1a')][_0x1972('0x1b')]===undefined?!![]:![]:!![],'where':_0xf99944[_0x1972('0x1a')]?_0xf99944['options']['where']||null:null,'attributes':_0xf99944[_0x1972('0x1a')]?_0xf99944[_0x1972('0x1a')][_0x1972('0x1c')]||null:null,'include':_0xf99944[_0x1972('0x1a')]?_0xf99944[_0x1972('0x1a')][_0x1972('0x1f')]?_[_0x1972('0x1e')](_0xf99944[_0x1972('0x1a')][_0x1972('0x1f')],function(_0x345ba6){return{'model':db[_0x345ba6['model']],'as':_0x345ba6['as'],'attributes':_0x345ba6['attributes'],'include':_0x345ba6[_0x1972('0x1f')]?_['map'](_0x345ba6[_0x1972('0x1f')],function(_0x35ff1f){return{'model':db[_0x35ff1f[_0x1972('0x20')]],'as':_0x35ff1f['as'],'attributes':_0x35ff1f[_0x1972('0x1c')],'include':_0x35ff1f[_0x1972('0x1f')]?_['map'](_0x35ff1f[_0x1972('0x1f')],function(_0x45ac60){return{'model':db[_0x45ac60[_0x1972('0x20')]],'as':_0x45ac60['as'],'attributes':_0x45ac60[_0x1972('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3931d2){logger[_0x1972('0xe')]('ShowOpenchannelQueue',_0xf99944);logger[_0x1972('0x10')](_0x1972('0x23'),_0xf99944,JSON[_0x1972('0x22')](_0x3931d2));_0x26564b(_0x3931d2);})[_0x1972('0x17')](function(_0x128980){logger[_0x1972('0x12')](_0x1972('0x23'),_0x128980[_0x1972('0x15')],_0xf99944);_0x150a2f(_0xd3a56['error'](0x1f4,_0x128980[_0x1972('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index d07a371..9ff1221 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 _0xe1c6=['remove','update','emit','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x5f0c2e,_0x33309f){var _0x1c2dda=function(_0x205be4){while(--_0x205be4){_0x5f0c2e['push'](_0x5f0c2e['shift']());}};_0x1c2dda(++_0x33309f);}(_0xe1c6,0x18d));var _0x6e1c=function(_0x3d8163,_0x5470c4){_0x3d8163=_0x3d8163-0x0;var _0x49db86=_0xe1c6[_0x3d8163];return _0x49db86;};'use strict';var OpenchannelQueueEvents=require(_0x6e1c('0x0'));var events=[_0x6e1c('0x1'),_0x6e1c('0x2'),_0x6e1c('0x3')];function createListener(_0x41dde8,_0x37f67c){return function(_0x53ba58){_0x37f67c[_0x6e1c('0x4')](_0x41dde8,_0x53ba58);};}function removeListener(_0x500a2a,_0xf3008b){return function(){OpenchannelQueueEvents['removeListener'](_0x500a2a,_0xf3008b);};}exports[_0x6e1c('0x5')]=function(_0x1d4f6c){for(var _0xfe7d3e=0x0,_0x4602aa=events['length'];_0xfe7d3e<_0x4602aa;_0xfe7d3e++){var _0x4e9c87=events[_0xfe7d3e];var _0x283e42=createListener(_0x6e1c('0x6')+_0x4e9c87,_0x1d4f6c);OpenchannelQueueEvents['on'](_0x4e9c87,_0x283e42);}}; \ No newline at end of file +var _0x0e92=['./openchannelQueue.events','save','remove','update','removeListener','register','length','openchannelQueue:'];(function(_0x1f65a5,_0x282105){var _0x4e44b2=function(_0x1ad119){while(--_0x1ad119){_0x1f65a5['push'](_0x1f65a5['shift']());}};_0x4e44b2(++_0x282105);}(_0x0e92,0xf8));var _0x20e9=function(_0x30bbcd,_0x45d095){_0x30bbcd=_0x30bbcd-0x0;var _0xd09799=_0x0e92[_0x30bbcd];return _0xd09799;};'use strict';var OpenchannelQueueEvents=require(_0x20e9('0x0'));var events=[_0x20e9('0x1'),_0x20e9('0x2'),_0x20e9('0x3')];function createListener(_0x26c073,_0x42288b){return function(_0x5ad4bd){_0x42288b['emit'](_0x26c073,_0x5ad4bd);};}function removeListener(_0x252788,_0x3ad6f1){return function(){OpenchannelQueueEvents[_0x20e9('0x4')](_0x252788,_0x3ad6f1);};}exports[_0x20e9('0x5')]=function(_0xadb972){for(var _0x415ce9=0x0,_0x19b61a=events[_0x20e9('0x6')];_0x415ce9<_0x19b61a;_0x415ce9++){var _0xe1788f=events[_0x415ce9];var _0x2df45c=createListener(_0x20e9('0x7')+_0xe1788f,_0xadb972);OpenchannelQueueEvents['on'](_0xe1788f,_0x2df45c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e3e936b..27e73f6 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 _0xee16=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','exports'];(function(_0x130a28,_0x315418){var _0x2dc93b=function(_0x29295c){while(--_0x29295c){_0x130a28['push'](_0x130a28['shift']());}};_0x2dc93b(++_0x315418);}(_0xee16,0x1e0));var _0x6ee1=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xee16[_0x22868f];return _0x97bc75;};'use strict';var multer=require(_0x6ee1('0x0'));var util=require(_0x6ee1('0x1'));var path=require(_0x6ee1('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ee1('0x3'));var router=express[_0x6ee1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ee1('0x5'));var interaction=require(_0x6ee1('0x6'));var config=require(_0x6ee1('0x7'));var controller=require(_0x6ee1('0x8'));router[_0x6ee1('0x9')]('/',auth[_0x6ee1('0xa')](),controller['index']);router[_0x6ee1('0x9')](_0x6ee1('0xb'),auth[_0x6ee1('0xa')](),controller[_0x6ee1('0xc')]);router[_0x6ee1('0x9')](_0x6ee1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6ee1('0xe')]('/',auth[_0x6ee1('0xa')](),controller[_0x6ee1('0xf')]);router[_0x6ee1('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6ee1('0x11')]('/:id',auth[_0x6ee1('0xa')](),controller[_0x6ee1('0x12')]);module[_0x6ee1('0x13')]=router; \ No newline at end of file +var _0x424d=['get','isAuthenticated','index','describe','show','post','create','/:id','update','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x2cdf4e,_0x210079){var _0x5a4400=function(_0x297ee3){while(--_0x297ee3){_0x2cdf4e['push'](_0x2cdf4e['shift']());}};_0x5a4400(++_0x210079);}(_0x424d,0x12a));var _0xd424=function(_0x525d78,_0x14175d){_0x525d78=_0x525d78-0x0;var _0x4c203d=_0x424d[_0x525d78];return _0x4c203d;};'use strict';var multer=require('multer');var util=require(_0xd424('0x0'));var path=require(_0xd424('0x1'));var timeout=require(_0xd424('0x2'));var express=require('express');var router=express[_0xd424('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd424('0x4'));var interaction=require(_0xd424('0x5'));var config=require(_0xd424('0x6'));var controller=require(_0xd424('0x7'));router[_0xd424('0x8')]('/',auth[_0xd424('0x9')](),controller[_0xd424('0xa')]);router['get']('/describe',auth[_0xd424('0x9')](),controller[_0xd424('0xb')]);router[_0xd424('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd424('0xc')]);router[_0xd424('0xd')]('/',auth[_0xd424('0x9')](),controller[_0xd424('0xe')]);router['put'](_0xd424('0xf'),auth[_0xd424('0x9')](),controller[_0xd424('0x10')]);router['delete'](_0xd424('0xf'),auth['isAuthenticated'](),controller['destroy']);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 6a04092..dda117a 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 _0x49fe=['STRING','moment','sequelize','exports','DATE'];(function(_0x3137f0,_0x509d52){var _0x4c12c4=function(_0x4b9be3){while(--_0x4b9be3){_0x3137f0['push'](_0x3137f0['shift']());}};_0x4c12c4(++_0x509d52);}(_0x49fe,0x100));var _0xe49f=function(_0x3607ed,_0x4d75fc){_0x3607ed=_0x3607ed-0x0;var _0x339085=_0x49fe[_0x3607ed];return _0x339085;};'use strict';var moment=require(_0xe49f('0x0'));var Sequelize=require(_0xe49f('0x1'));module[_0xe49f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe49f('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe49f('0x3')]},'exitAt':{'type':Sequelize[_0xe49f('0x3')]},'reason':{'type':Sequelize[_0xe49f('0x4')]}}; \ No newline at end of file +var _0xcd0a=['exports','STRING','DATE','moment','sequelize'];(function(_0x4274fd,_0x275800){var _0x661d97=function(_0x22ca7d){while(--_0x22ca7d){_0x4274fd['push'](_0x4274fd['shift']());}};_0x661d97(++_0x275800);}(_0xcd0a,0xee));var _0xacd0=function(_0x16bfc5,_0x4f9dc3){_0x16bfc5=_0x16bfc5-0x0;var _0x43b820=_0xcd0a[_0x16bfc5];return _0x43b820;};'use strict';var moment=require(_0xacd0('0x0'));var Sequelize=require(_0xacd0('0x1'));module[_0xacd0('0x2')]={'uniqueid':{'type':Sequelize[_0xacd0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xacd0('0x3')]},'joinAt':{'type':Sequelize[_0xacd0('0x4')]},'leaveAt':{'type':Sequelize[_0xacd0('0x4')]},'acceptAt':{'type':Sequelize[_0xacd0('0x4')]},'exitAt':{'type':Sequelize[_0xacd0('0x4')]},'reason':{'type':Sequelize[_0xacd0('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index bce58bb..e7c206c 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 _0xc6f8=['attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','rows','params','keys','filters','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','intersection'];(function(_0x1b95e1,_0x43f2d4){var _0x572e1f=function(_0x363009){while(--_0x363009){_0x1b95e1['push'](_0x1b95e1['shift']());}};_0x572e1f(++_0x43f2d4);}(_0xc6f8,0xf4));var _0x8c6f=function(_0x53fb8c,_0x1ed0df){_0x53fb8c=_0x53fb8c-0x0;var _0x3d899f=_0xc6f8[_0x53fb8c];return _0x3d899f;};'use strict';var emlformat=require(_0x8c6f('0x0'));var rimraf=require(_0x8c6f('0x1'));var zipdir=require(_0x8c6f('0x2'));var jsonpatch=require(_0x8c6f('0x3'));var rp=require('request-promise');var moment=require(_0x8c6f('0x4'));var BPromise=require(_0x8c6f('0x5'));var Mustache=require(_0x8c6f('0x6'));var util=require(_0x8c6f('0x7'));var path=require(_0x8c6f('0x8'));var sox=require(_0x8c6f('0x9'));var csv=require(_0x8c6f('0xa'));var ejs=require(_0x8c6f('0xb'));var fs=require('fs');var fs_extra=require(_0x8c6f('0xc'));var _=require(_0x8c6f('0xd'));var squel=require(_0x8c6f('0xe'));var crypto=require('crypto');var jsforce=require(_0x8c6f('0xf'));var deskjs=require(_0x8c6f('0x10'));var toCsv=require(_0x8c6f('0xa'));var querystring=require(_0x8c6f('0x11'));var Papa=require(_0x8c6f('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c6f('0x13'));var as=require(_0x8c6f('0x14'));var hardwareService=require(_0x8c6f('0x15'));var logger=require(_0x8c6f('0x16'))(_0x8c6f('0x17'));var utils=require('../../config/utils');var config=require(_0x8c6f('0x18'));var licenseUtil=require(_0x8c6f('0x19'));var db=require(_0x8c6f('0x1a'))['db'];function respondWithStatusCode(_0x2c5f4a,_0x25773a){_0x25773a=_0x25773a||0xcc;return function(_0x2c9199){if(_0x2c9199){return _0x2c5f4a['sendStatus'](_0x25773a);}return _0x2c5f4a[_0x8c6f('0x1b')](_0x25773a)[_0x8c6f('0x1c')]();};}function respondWithResult(_0x67c414,_0x441f23){_0x441f23=_0x441f23||0xc8;return function(_0x1c39b4){if(_0x1c39b4){return _0x67c414[_0x8c6f('0x1b')](_0x441f23)[_0x8c6f('0x1d')](_0x1c39b4);}};}function respondWithFilteredResult(_0x349466,_0x2aa6ba){return function(_0x1e7016){if(_0x1e7016){var _0x873c85=typeof _0x2aa6ba['offset']==='undefined'&&typeof _0x2aa6ba[_0x8c6f('0x1e')]==='undefined';var _0x2c342c=_0x1e7016[_0x8c6f('0x1f')];var _0x23baff=_0x873c85?0x0:_0x2aa6ba[_0x8c6f('0x20')];var _0x1b0c8e=_0x873c85?_0x1e7016[_0x8c6f('0x1f')]:_0x2aa6ba['offset']+_0x2aa6ba[_0x8c6f('0x1e')];var _0xde77f4;if(_0x1b0c8e>=_0x2c342c){_0x1b0c8e=_0x2c342c;_0xde77f4=0xc8;}else{_0xde77f4=0xce;}_0x349466[_0x8c6f('0x1b')](_0xde77f4);return _0x349466['set'](_0x8c6f('0x21'),_0x23baff+'-'+_0x1b0c8e+'/'+_0x2c342c)[_0x8c6f('0x1d')](_0x1e7016);}return null;};}function patchUpdates(_0x45a2){return function(_0x369fce){try{jsonpatch[_0x8c6f('0x22')](_0x369fce,_0x45a2,!![]);}catch(_0x21941c){return BPromise[_0x8c6f('0x23')](_0x21941c);}return _0x369fce['save']();};}function saveUpdates(_0x2a4a28,_0x21108a){return function(_0x14b1cd){if(_0x14b1cd){return _0x14b1cd[_0x8c6f('0x24')](_0x2a4a28)['then'](function(_0x447731){return _0x447731;});}return null;};}function removeEntity(_0x53f942,_0x21a912){return function(_0x2bf630){if(_0x2bf630){return _0x2bf630[_0x8c6f('0x25')]()[_0x8c6f('0x26')](function(){_0x53f942[_0x8c6f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a4245,_0x1ae94e){return function(_0x4001c7){if(!_0x4001c7){_0x2a4245[_0x8c6f('0x27')](0x194);}return _0x4001c7;};}function handleError(_0x49eed2,_0x4ce32e){_0x4ce32e=_0x4ce32e||0x1f4;return function(_0x2a4df6){logger[_0x8c6f('0x28')](_0x2a4df6[_0x8c6f('0x29')]);if(_0x2a4df6[_0x8c6f('0x2a')]){delete _0x2a4df6[_0x8c6f('0x2a')];}_0x49eed2[_0x8c6f('0x1b')](_0x4ce32e)[_0x8c6f('0x2b')](_0x2a4df6);};}exports[_0x8c6f('0x2c')]=function(_0x1907a0,_0x12501e){var _0x2d3103={},_0x5b4ccd={},_0x3122e2={'count':0x0,'rows':[]};var _0x3a9992=_['map'](db[_0x8c6f('0x2d')][_0x8c6f('0x2e')],function(_0x2b5748){return{'name':_0x2b5748[_0x8c6f('0x2f')],'type':_0x2b5748['type'][_0x8c6f('0x30')]};});_0x5b4ccd[_0x8c6f('0x31')]=_['map'](_0x3a9992,'name');_0x5b4ccd[_0x8c6f('0x32')]=_['keys'](_0x1907a0[_0x8c6f('0x32')]);_0x5b4ccd['filters']=_[_0x8c6f('0x33')](_0x5b4ccd[_0x8c6f('0x31')],_0x5b4ccd[_0x8c6f('0x32')]);_0x2d3103[_0x8c6f('0x34')]=_[_0x8c6f('0x33')](_0x5b4ccd[_0x8c6f('0x31')],qs[_0x8c6f('0x35')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x35')]));_0x2d3103['attributes']=_0x2d3103[_0x8c6f('0x34')][_0x8c6f('0x36')]?_0x2d3103[_0x8c6f('0x34')]:_0x5b4ccd[_0x8c6f('0x31')];if(!_0x1907a0[_0x8c6f('0x32')]['hasOwnProperty'](_0x8c6f('0x37'))){_0x2d3103['limit']=qs[_0x8c6f('0x1e')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x1e')]);_0x2d3103[_0x8c6f('0x20')]=qs[_0x8c6f('0x20')](_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x20')]);}_0x2d3103['order']=qs[_0x8c6f('0x38')](_0x1907a0[_0x8c6f('0x32')]['sort']);_0x2d3103[_0x8c6f('0x39')]=qs['filters'](_[_0x8c6f('0x3a')](_0x1907a0[_0x8c6f('0x32')],_0x5b4ccd['filters']),_0x3a9992);if(_0x1907a0['query'][_0x8c6f('0x3b')]){_0x2d3103[_0x8c6f('0x39')]=_[_0x8c6f('0x3c')](_0x2d3103[_0x8c6f('0x39')],{'$or':_[_0x8c6f('0x3d')](_0x3a9992,function(_0x3c269b){if(_0x3c269b['type']!=='VIRTUAL'){var _0xbbd99d={};_0xbbd99d[_0x3c269b[_0x8c6f('0x2a')]]={'$like':'%'+_0x1907a0['query']['filter']+'%'};return _0xbbd99d;}})});}_0x2d3103=_[_0x8c6f('0x3c')]({},_0x2d3103,_0x1907a0[_0x8c6f('0x3e')]);var _0x12289e={'where':_0x2d3103[_0x8c6f('0x39')]};return db[_0x8c6f('0x2d')][_0x8c6f('0x1f')](_0x12289e)[_0x8c6f('0x26')](function(_0x59f113){_0x3122e2[_0x8c6f('0x1f')]=_0x59f113;if(_0x1907a0[_0x8c6f('0x32')][_0x8c6f('0x3f')]){_0x2d3103[_0x8c6f('0x40')]=[{'all':!![]}];}return db[_0x8c6f('0x2d')]['findAll'](_0x2d3103);})[_0x8c6f('0x26')](function(_0x31d360){_0x3122e2[_0x8c6f('0x41')]=_0x31d360;return _0x3122e2;})['then'](respondWithFilteredResult(_0x12501e,_0x2d3103))['catch'](handleError(_0x12501e,null));};exports['show']=function(_0x322cad,_0x450a2d){var _0x3d69ac={'raw':!![],'where':{'id':_0x322cad[_0x8c6f('0x42')]['id']}},_0x525117={};_0x525117[_0x8c6f('0x31')]=_[_0x8c6f('0x43')](db[_0x8c6f('0x2d')][_0x8c6f('0x2e')]);_0x525117[_0x8c6f('0x32')]=_[_0x8c6f('0x43')](_0x322cad[_0x8c6f('0x32')]);_0x525117[_0x8c6f('0x44')]=_[_0x8c6f('0x33')](_0x525117['model'],_0x525117[_0x8c6f('0x32')]);_0x3d69ac['attributes']=_[_0x8c6f('0x33')](_0x525117[_0x8c6f('0x31')],qs[_0x8c6f('0x35')](_0x322cad[_0x8c6f('0x32')]['fields']));_0x3d69ac[_0x8c6f('0x34')]=_0x3d69ac['attributes'][_0x8c6f('0x36')]?_0x3d69ac[_0x8c6f('0x34')]:_0x525117[_0x8c6f('0x31')];if(_0x322cad[_0x8c6f('0x32')][_0x8c6f('0x3f')]){_0x3d69ac['include']=[{'all':!![]}];}_0x3d69ac=_[_0x8c6f('0x3c')]({},_0x3d69ac,_0x322cad[_0x8c6f('0x3e')]);return db[_0x8c6f('0x2d')][_0x8c6f('0x45')](_0x3d69ac)['then'](handleEntityNotFound(_0x450a2d,null))['then'](respondWithResult(_0x450a2d,null))['catch'](handleError(_0x450a2d,null));};exports['create']=function(_0x2af357,_0x240519){return db[_0x8c6f('0x2d')][_0x8c6f('0x46')](_0x2af357['body'],{})[_0x8c6f('0x26')](respondWithResult(_0x240519,0xc9))[_0x8c6f('0x47')](handleError(_0x240519,null));};exports[_0x8c6f('0x24')]=function(_0x248661,_0x464a55){if(_0x248661[_0x8c6f('0x48')]['id']){delete _0x248661[_0x8c6f('0x48')]['id'];}return db[_0x8c6f('0x2d')]['find']({'where':{'id':_0x248661[_0x8c6f('0x42')]['id']}})[_0x8c6f('0x26')](handleEntityNotFound(_0x464a55,null))['then'](saveUpdates(_0x248661[_0x8c6f('0x48')],null))[_0x8c6f('0x26')](respondWithResult(_0x464a55,null))[_0x8c6f('0x47')](handleError(_0x464a55,null));};exports[_0x8c6f('0x25')]=function(_0x248815,_0x375f7a){return db[_0x8c6f('0x2d')][_0x8c6f('0x45')]({'where':{'id':_0x248815[_0x8c6f('0x42')]['id']}})[_0x8c6f('0x26')](handleEntityNotFound(_0x375f7a,null))['then'](removeEntity(_0x375f7a,null))['catch'](handleError(_0x375f7a,null));};exports[_0x8c6f('0x49')]=function(_0xf412c5,_0x4b9a4c){return db[_0x8c6f('0x2d')]['describe']()[_0x8c6f('0x26')](respondWithResult(_0x4b9a4c,null))[_0x8c6f('0x47')](handleError(_0x4b9a4c,null));}; \ No newline at end of file +var _0xd04f=['include','findAll','rows','show','keys','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','end','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options'];(function(_0xfa0b78,_0x539843){var _0x960691=function(_0x1455d9){while(--_0x1455d9){_0xfa0b78['push'](_0xfa0b78['shift']());}};_0x960691(++_0x539843);}(_0xd04f,0x1c7));var _0xfd04=function(_0x177ee8,_0x1c5606){_0x177ee8=_0x177ee8-0x0;var _0x386283=_0xd04f[_0x177ee8];return _0x386283;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd04('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd04('0x1'));var rp=require(_0xfd04('0x2'));var moment=require(_0xfd04('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfd04('0x4'));var util=require(_0xfd04('0x5'));var path=require('path');var sox=require(_0xfd04('0x6'));var csv=require(_0xfd04('0x7'));var ejs=require(_0xfd04('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd04('0x9'));var squel=require(_0xfd04('0xa'));var crypto=require(_0xfd04('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfd04('0xc'));var toCsv=require(_0xfd04('0x7'));var querystring=require(_0xfd04('0xd'));var Papa=require(_0xfd04('0xe'));var Redis=require(_0xfd04('0xf'));var authService=require(_0xfd04('0x10'));var qs=require(_0xfd04('0x11'));var as=require(_0xfd04('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd04('0x13'))(_0xfd04('0x14'));var utils=require(_0xfd04('0x15'));var config=require(_0xfd04('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd04('0x17'))['db'];function respondWithStatusCode(_0x485d39,_0xd0606){_0xd0606=_0xd0606||0xcc;return function(_0x3de7f2){if(_0x3de7f2){return _0x485d39[_0xfd04('0x18')](_0xd0606);}return _0x485d39[_0xfd04('0x19')](_0xd0606)['end']();};}function respondWithResult(_0x5f0f1c,_0x105201){_0x105201=_0x105201||0xc8;return function(_0x5b6818){if(_0x5b6818){return _0x5f0f1c['status'](_0x105201)[_0xfd04('0x1a')](_0x5b6818);}};}function respondWithFilteredResult(_0x4c2053,_0x5d050d){return function(_0x43eb0a){if(_0x43eb0a){var _0x20d4f1=typeof _0x5d050d[_0xfd04('0x1b')]==='undefined'&&typeof _0x5d050d['limit']===_0xfd04('0x1c');var _0x12081d=_0x43eb0a[_0xfd04('0x1d')];var _0x398b77=_0x20d4f1?0x0:_0x5d050d['offset'];var _0x6916f3=_0x20d4f1?_0x43eb0a['count']:_0x5d050d[_0xfd04('0x1b')]+_0x5d050d[_0xfd04('0x1e')];var _0x10ee35;if(_0x6916f3>=_0x12081d){_0x6916f3=_0x12081d;_0x10ee35=0xc8;}else{_0x10ee35=0xce;}_0x4c2053[_0xfd04('0x19')](_0x10ee35);return _0x4c2053[_0xfd04('0x1f')]('Content-Range',_0x398b77+'-'+_0x6916f3+'/'+_0x12081d)[_0xfd04('0x1a')](_0x43eb0a);}return null;};}function patchUpdates(_0x3774e1){return function(_0x5de6de){try{jsonpatch['apply'](_0x5de6de,_0x3774e1,!![]);}catch(_0x5ab966){return BPromise[_0xfd04('0x20')](_0x5ab966);}return _0x5de6de[_0xfd04('0x21')]();};}function saveUpdates(_0x10851f,_0x50cc7f){return function(_0x346048){if(_0x346048){return _0x346048[_0xfd04('0x22')](_0x10851f)[_0xfd04('0x23')](function(_0x39acb8){return _0x39acb8;});}return null;};}function removeEntity(_0x236ca9,_0x42bf15){return function(_0x1878b5){if(_0x1878b5){return _0x1878b5[_0xfd04('0x24')]()['then'](function(){_0x236ca9[_0xfd04('0x19')](0xcc)[_0xfd04('0x25')]();});}};}function handleEntityNotFound(_0x424538,_0x286d78){return function(_0x41eb4c){if(!_0x41eb4c){_0x424538[_0xfd04('0x18')](0x194);}return _0x41eb4c;};}function handleError(_0x2233e5,_0x2a2af5){_0x2a2af5=_0x2a2af5||0x1f4;return function(_0x5e8f8a){logger[_0xfd04('0x26')](_0x5e8f8a['stack']);if(_0x5e8f8a['name']){delete _0x5e8f8a[_0xfd04('0x27')];}_0x2233e5['status'](_0x2a2af5)[_0xfd04('0x28')](_0x5e8f8a);};}exports[_0xfd04('0x29')]=function(_0x3936ea,_0x77e39d){var _0x14cf90={},_0xd13e15={},_0xf7b772={'count':0x0,'rows':[]};var _0x5741b5=_[_0xfd04('0x2a')](db[_0xfd04('0x2b')][_0xfd04('0x2c')],function(_0x265f48){return{'name':_0x265f48[_0xfd04('0x2d')],'type':_0x265f48[_0xfd04('0x2e')][_0xfd04('0x2f')]};});_0xd13e15[_0xfd04('0x30')]=_[_0xfd04('0x2a')](_0x5741b5,_0xfd04('0x27'));_0xd13e15[_0xfd04('0x31')]=_['keys'](_0x3936ea[_0xfd04('0x31')]);_0xd13e15[_0xfd04('0x32')]=_[_0xfd04('0x33')](_0xd13e15[_0xfd04('0x30')],_0xd13e15['query']);_0x14cf90['attributes']=_[_0xfd04('0x33')](_0xd13e15['model'],qs[_0xfd04('0x34')](_0x3936ea[_0xfd04('0x31')]['fields']));_0x14cf90['attributes']=_0x14cf90[_0xfd04('0x35')][_0xfd04('0x36')]?_0x14cf90[_0xfd04('0x35')]:_0xd13e15[_0xfd04('0x30')];if(!_0x3936ea[_0xfd04('0x31')][_0xfd04('0x37')](_0xfd04('0x38'))){_0x14cf90['limit']=qs[_0xfd04('0x1e')](_0x3936ea['query'][_0xfd04('0x1e')]);_0x14cf90[_0xfd04('0x1b')]=qs['offset'](_0x3936ea['query'][_0xfd04('0x1b')]);}_0x14cf90['order']=qs['sort'](_0x3936ea['query']['sort']);_0x14cf90[_0xfd04('0x39')]=qs[_0xfd04('0x32')](_[_0xfd04('0x3a')](_0x3936ea['query'],_0xd13e15[_0xfd04('0x32')]),_0x5741b5);if(_0x3936ea['query'][_0xfd04('0x3b')]){_0x14cf90[_0xfd04('0x39')]=_['merge'](_0x14cf90[_0xfd04('0x39')],{'$or':_[_0xfd04('0x2a')](_0x5741b5,function(_0x40df29){if(_0x40df29[_0xfd04('0x2e')]!==_0xfd04('0x3c')){var _0x1fcc49={};_0x1fcc49[_0x40df29[_0xfd04('0x27')]]={'$like':'%'+_0x3936ea[_0xfd04('0x31')]['filter']+'%'};return _0x1fcc49;}})});}_0x14cf90=_[_0xfd04('0x3d')]({},_0x14cf90,_0x3936ea[_0xfd04('0x3e')]);var _0x2a4a3f={'where':_0x14cf90[_0xfd04('0x39')]};return db['OpenchannelQueueReport'][_0xfd04('0x1d')](_0x2a4a3f)['then'](function(_0x1b33bb){_0xf7b772[_0xfd04('0x1d')]=_0x1b33bb;if(_0x3936ea['query']['includeAll']){_0x14cf90[_0xfd04('0x3f')]=[{'all':!![]}];}return db[_0xfd04('0x2b')][_0xfd04('0x40')](_0x14cf90);})[_0xfd04('0x23')](function(_0x191ab9){_0xf7b772[_0xfd04('0x41')]=_0x191ab9;return _0xf7b772;})[_0xfd04('0x23')](respondWithFilteredResult(_0x77e39d,_0x14cf90))['catch'](handleError(_0x77e39d,null));};exports[_0xfd04('0x42')]=function(_0x45ec58,_0xa5a6b2){var _0x66dad3={'raw':!![],'where':{'id':_0x45ec58['params']['id']}},_0x561381={};_0x561381[_0xfd04('0x30')]=_[_0xfd04('0x43')](db[_0xfd04('0x2b')][_0xfd04('0x2c')]);_0x561381[_0xfd04('0x31')]=_[_0xfd04('0x43')](_0x45ec58[_0xfd04('0x31')]);_0x561381[_0xfd04('0x32')]=_['intersection'](_0x561381[_0xfd04('0x30')],_0x561381['query']);_0x66dad3[_0xfd04('0x35')]=_[_0xfd04('0x33')](_0x561381[_0xfd04('0x30')],qs[_0xfd04('0x34')](_0x45ec58[_0xfd04('0x31')][_0xfd04('0x34')]));_0x66dad3['attributes']=_0x66dad3[_0xfd04('0x35')][_0xfd04('0x36')]?_0x66dad3['attributes']:_0x561381[_0xfd04('0x30')];if(_0x45ec58['query']['includeAll']){_0x66dad3['include']=[{'all':!![]}];}_0x66dad3=_['merge']({},_0x66dad3,_0x45ec58[_0xfd04('0x3e')]);return db['OpenchannelQueueReport'][_0xfd04('0x44')](_0x66dad3)[_0xfd04('0x23')](handleEntityNotFound(_0xa5a6b2,null))[_0xfd04('0x23')](respondWithResult(_0xa5a6b2,null))[_0xfd04('0x45')](handleError(_0xa5a6b2,null));};exports[_0xfd04('0x46')]=function(_0x2f8aea,_0x2faa29){return db['OpenchannelQueueReport']['create'](_0x2f8aea[_0xfd04('0x47')],{})['then'](respondWithResult(_0x2faa29,0xc9))[_0xfd04('0x45')](handleError(_0x2faa29,null));};exports[_0xfd04('0x22')]=function(_0x437da1,_0x3c4ac0){if(_0x437da1[_0xfd04('0x47')]['id']){delete _0x437da1[_0xfd04('0x47')]['id'];}return db[_0xfd04('0x2b')][_0xfd04('0x44')]({'where':{'id':_0x437da1['params']['id']}})['then'](handleEntityNotFound(_0x3c4ac0,null))[_0xfd04('0x23')](saveUpdates(_0x437da1['body'],null))[_0xfd04('0x23')](respondWithResult(_0x3c4ac0,null))[_0xfd04('0x45')](handleError(_0x3c4ac0,null));};exports[_0xfd04('0x24')]=function(_0x183327,_0x2af5d2){return db[_0xfd04('0x2b')][_0xfd04('0x44')]({'where':{'id':_0x183327[_0xfd04('0x48')]['id']}})['then'](handleEntityNotFound(_0x2af5d2,null))['then'](removeEntity(_0x2af5d2,null))[_0xfd04('0x45')](handleError(_0x2af5d2,null));};exports[_0xfd04('0x49')]=function(_0x42846d,_0x48f1bc){return db[_0xfd04('0x2b')][_0xfd04('0x49')]()['then'](respondWithResult(_0x48f1bc,null))[_0xfd04('0x45')](handleError(_0x48f1bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 15b2318..bb85822 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x224570,_0x25b2f0){var _0x51c15e=function(_0x60b5f5){while(--_0x60b5f5){_0x224570['push'](_0x224570['shift']());}};_0x51c15e(++_0x25b2f0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x5b9f91,_0x2c2501){var _0x476c98=function(_0x11cd1d){while(--_0x11cd1d){_0x5b9f91['push'](_0x5b9f91['shift']());}};_0x476c98(++_0x2c2501);}(_0x1261,0x144));var _0x1126=function(_0x4529b3,_0x390ebb){_0x4529b3=_0x4529b3-0x0;var _0x21e907=_0x1261[_0x4529b3];return _0x21e907;};'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 c843604..b142a12 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 _0x01d3=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','catch','CreateOpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where'];(function(_0x16ae15,_0x7dec88){var _0x18fd6f=function(_0x24a0bc){while(--_0x24a0bc){_0x16ae15['push'](_0x16ae15['shift']());}};_0x18fd6f(++_0x7dec88);}(_0x01d3,0xa2));var _0x301d=function(_0xd6667d,_0x406fd3){_0xd6667d=_0xd6667d-0x0;var _0x247e8f=_0x01d3[_0xd6667d];return _0x247e8f;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var moment=require(_0x301d('0x2'));var BPromise=require(_0x301d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x301d('0x4'));var db=require(_0x301d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x301d('0x6'))(_0x301d('0x7'));var config=require(_0x301d('0x8'));var jayson=require(_0x301d('0x9'));var client=jayson['client'][_0x301d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8fc2,_0xe2b2d8,_0x3bbbde){return new BPromise(function(_0x35e760,_0x3ba019){return client[_0x301d('0xb')](_0x2d8fc2,_0x3bbbde)[_0x301d('0xc')](function(_0x35ae14){logger[_0x301d('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe2b2d8,_0x301d('0xe'));logger[_0x301d('0xf')](_0x301d('0x10'),_0xe2b2d8,'request\x20sent',JSON[_0x301d('0x11')](_0x35ae14));if(_0x35ae14[_0x301d('0x12')]){if(_0x35ae14['error']['code']===0x1f4){logger['error'](_0x301d('0x13'),_0xe2b2d8,_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);return _0x3ba019(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x35ae14['error']['message']);return _0x35e760(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}else{logger[_0x301d('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe2b2d8,'request\x20sent');_0x35e760(_0x35ae14['result']['message']);}})[_0x301d('0x15')](function(_0x3deffb){logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x3deffb);_0x3ba019(_0x3deffb);});});}exports[_0x301d('0x16')]=function(_0x39e505){var _0x4c36a6=this;return new Promise(function(_0x40a9ed,_0x4ed038){return db['OpenchannelQueueReport'][_0x301d('0x17')](_0x39e505[_0x301d('0x18')],{'raw':_0x39e505['options']?_0x39e505[_0x301d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x301d('0xc')](function(_0x3f300c){logger[_0x301d('0xd')]('CreateOpenchannelQueueReport',_0x39e505);logger[_0x301d('0xf')]('CreateOpenchannelQueueReport',_0x39e505,JSON[_0x301d('0x11')](_0x3f300c));_0x40a9ed(_0x3f300c);})[_0x301d('0x15')](function(_0x24b6fc){logger['error'](_0x301d('0x16'),_0x24b6fc[_0x301d('0x14')],_0x39e505);_0x4ed038(_0x4c36a6[_0x301d('0x12')](0x1f4,_0x24b6fc[_0x301d('0x14')]));});});};exports[_0x301d('0x1a')]=function(_0x1d8d00){var _0x36f26a=this;return new Promise(function(_0x52e758,_0x2f3b71){return db[_0x301d('0x1b')][_0x301d('0x1c')](_0x1d8d00['body'],{'raw':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00[_0x301d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00['options'][_0x301d('0x1d')]||null:null,'attributes':_0x1d8d00[_0x301d('0x19')]?_0x1d8d00['options'][_0x301d('0x1e')]||null:null,'limit':_0x1d8d00['options']?_0x1d8d00['options'][_0x301d('0x1f')]||null:null})[_0x301d('0xc')](function(_0x2a6652){logger['info'](_0x301d('0x1a'),_0x1d8d00);logger['debug']('UpdateOpenchannelQueueReport',_0x1d8d00,JSON['stringify'](_0x2a6652));_0x52e758(_0x2a6652);})[_0x301d('0x15')](function(_0x54e9a1){logger[_0x301d('0x12')](_0x301d('0x1a'),_0x54e9a1[_0x301d('0x14')],_0x1d8d00);_0x2f3b71(_0x36f26a[_0x301d('0x12')](0x1f4,_0x54e9a1[_0x301d('0x14')]));});});}; \ No newline at end of file +var _0x4e2e=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','debug','catch','update','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x58bbc3,_0x306368){_0x58bbc3=_0x58bbc3-0x0;var _0x596477=_0x4e2e[_0x58bbc3];return _0x596477;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});}exports['CreateOpenchannelQueueReport']=function(_0x196f16){var _0x54c80b=this;return new Promise(function(_0x1d5e9d,_0x3f313b){return db[_0xe4e2('0x15')][_0xe4e2('0x16')](_0x196f16[_0xe4e2('0x17')],{'raw':_0x196f16[_0xe4e2('0x18')]?_0x196f16[_0xe4e2('0x18')][_0xe4e2('0x19')]===undefined?!![]:![]:!![]})[_0xe4e2('0xc')](function(_0x362741){logger['info'](_0xe4e2('0x1a'),_0x196f16);logger[_0xe4e2('0x1b')](_0xe4e2('0x1a'),_0x196f16,JSON[_0xe4e2('0x11')](_0x362741));_0x1d5e9d(_0x362741);})[_0xe4e2('0x1c')](function(_0x23b466){logger[_0xe4e2('0x12')]('CreateOpenchannelQueueReport',_0x23b466[_0xe4e2('0x13')],_0x196f16);_0x3f313b(_0x54c80b[_0xe4e2('0x12')](0x1f4,_0x23b466[_0xe4e2('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x353030){var _0x12ad33=this;return new Promise(function(_0x598fa3,_0xcba85a){return db[_0xe4e2('0x15')][_0xe4e2('0x1d')](_0x353030[_0xe4e2('0x17')],{'raw':_0x353030[_0xe4e2('0x18')]?_0x353030['options'][_0xe4e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')]['where']||null:null,'attributes':_0x353030[_0xe4e2('0x18')]?_0x353030[_0xe4e2('0x18')][_0xe4e2('0x1e')]||null:null,'limit':_0x353030['options']?_0x353030[_0xe4e2('0x18')]['limit']||null:null})[_0xe4e2('0xc')](function(_0x1e21c0){logger['info'](_0xe4e2('0x1f'),_0x353030);logger[_0xe4e2('0x1b')](_0xe4e2('0x1f'),_0x353030,JSON[_0xe4e2('0x11')](_0x1e21c0));_0x598fa3(_0x1e21c0);})[_0xe4e2('0x1c')](function(_0x4d33de){logger['error'](_0xe4e2('0x1f'),_0x4d33de[_0xe4e2('0x13')],_0x353030);_0xcba85a(_0x12ad33[_0xe4e2('0x12')](0x1f4,_0x4d33de[_0xe4e2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e5d893d..0449f2d 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 _0x7369=['show','create','put','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','describe','/:id','isAuthenticated'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7369,0x112));var _0x9736=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7369[_0x4dbaad];return _0x226c72;};'use strict';var multer=require('multer');var util=require(_0x9736('0x0'));var path=require(_0x9736('0x1'));var timeout=require(_0x9736('0x2'));var express=require('express');var router=express[_0x9736('0x3')]();var fs_extra=require(_0x9736('0x4'));var auth=require(_0x9736('0x5'));var interaction=require(_0x9736('0x6'));var config=require(_0x9736('0x7'));var controller=require(_0x9736('0x8'));router[_0x9736('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9736('0x9')](_0x9736('0xa'),auth['isAuthenticated'](),controller[_0x9736('0xb')]);router[_0x9736('0x9')](_0x9736('0xc'),auth[_0x9736('0xd')](),controller[_0x9736('0xe')]);router['post']('/',auth[_0x9736('0xd')](),controller[_0x9736('0xf')]);router[_0x9736('0x10')]('/:id',auth[_0x9736('0xd')](),controller['update']);router[_0x9736('0x11')](_0x9736('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3eac=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','multer','path','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3eac,0xf9));var _0xc3ea=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x3eac[_0x31a576];return _0x30b1d3;};'use strict';var multer=require(_0xc3ea('0x0'));var util=require('util');var path=require(_0xc3ea('0x1'));var timeout=require(_0xc3ea('0x2'));var express=require('express');var router=express[_0xc3ea('0x3')]();var fs_extra=require(_0xc3ea('0x4'));var auth=require(_0xc3ea('0x5'));var interaction=require(_0xc3ea('0x6'));var config=require(_0xc3ea('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0xc3ea('0x8')]('/',auth[_0xc3ea('0x9')](),controller['index']);router[_0xc3ea('0x8')](_0xc3ea('0xa'),auth['isAuthenticated'](),controller[_0xc3ea('0xb')]);router[_0xc3ea('0x8')](_0xc3ea('0xc'),auth[_0xc3ea('0x9')](),controller[_0xc3ea('0xd')]);router[_0xc3ea('0xe')]('/',auth[_0xc3ea('0x9')](),controller[_0xc3ea('0xf')]);router['put']('/:id',auth[_0xc3ea('0x9')](),controller['update']);router[_0xc3ea('0x10')]('/:id',auth[_0xc3ea('0x9')](),controller[_0xc3ea('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 21c3f10..d05dc98 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x27d94f,_0x1739db){var _0x1e722b=function(_0x3046ca){while(--_0x3046ca){_0x27d94f['push'](_0x27d94f['shift']());}};_0x1e722b(++_0x1739db);}(_0x70e0,0x17b));var _0x070e=function(_0x747f88,_0x1b4d62){_0x747f88=_0x747f88-0x0;var _0x5d8539=_0x70e0[_0x747f88];return _0x5d8539;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x423aa6,_0x131d91){var _0x3f9650=function(_0x5f50c9){while(--_0x5f50c9){_0x423aa6['push'](_0x423aa6['shift']());}};_0x3f9650(++_0x131d91);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c34be0b..8609576 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 _0x3bf8=['includeAll','merge','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','show','params'];(function(_0x544e03,_0x5dd541){var _0x17a562=function(_0x3638d3){while(--_0x3638d3){_0x544e03['push'](_0x544e03['shift']());}};_0x17a562(++_0x5dd541);}(_0x3bf8,0x127));var _0x83bf=function(_0x51c3a7,_0x4db319){_0x51c3a7=_0x51c3a7-0x0;var _0x290f32=_0x3bf8[_0x51c3a7];return _0x290f32;};'use strict';var emlformat=require(_0x83bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83bf('0x1'));var jsonpatch=require(_0x83bf('0x2'));var rp=require('request-promise');var moment=require(_0x83bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x83bf('0x4'));var util=require('util');var path=require(_0x83bf('0x5'));var sox=require(_0x83bf('0x6'));var csv=require(_0x83bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x83bf('0x8'));var squel=require(_0x83bf('0x9'));var crypto=require(_0x83bf('0xa'));var jsforce=require(_0x83bf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x83bf('0x7'));var querystring=require(_0x83bf('0xc'));var Papa=require(_0x83bf('0xd'));var Redis=require(_0x83bf('0xe'));var authService=require(_0x83bf('0xf'));var qs=require(_0x83bf('0x10'));var as=require(_0x83bf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83bf('0x12'))('api');var utils=require(_0x83bf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x83bf('0x14'));var db=require(_0x83bf('0x15'))['db'];function respondWithStatusCode(_0xfef3cd,_0x438966){_0x438966=_0x438966||0xcc;return function(_0x4f7b8b){if(_0x4f7b8b){return _0xfef3cd[_0x83bf('0x16')](_0x438966);}return _0xfef3cd[_0x83bf('0x17')](_0x438966)[_0x83bf('0x18')]();};}function respondWithResult(_0x18b7ff,_0x5f4b4d){_0x5f4b4d=_0x5f4b4d||0xc8;return function(_0x5c6520){if(_0x5c6520){return _0x18b7ff[_0x83bf('0x17')](_0x5f4b4d)[_0x83bf('0x19')](_0x5c6520);}};}function respondWithFilteredResult(_0x358239,_0x5e700c){return function(_0x1825ea){if(_0x1825ea){var _0x1d14fe=typeof _0x5e700c[_0x83bf('0x1a')]===_0x83bf('0x1b')&&typeof _0x5e700c[_0x83bf('0x1c')]===_0x83bf('0x1b');var _0x593833=_0x1825ea[_0x83bf('0x1d')];var _0x1da7c2=_0x1d14fe?0x0:_0x5e700c['offset'];var _0x107a5d=_0x1d14fe?_0x1825ea[_0x83bf('0x1d')]:_0x5e700c[_0x83bf('0x1a')]+_0x5e700c['limit'];var _0x529a78;if(_0x107a5d>=_0x593833){_0x107a5d=_0x593833;_0x529a78=0xc8;}else{_0x529a78=0xce;}_0x358239[_0x83bf('0x17')](_0x529a78);return _0x358239[_0x83bf('0x1e')]('Content-Range',_0x1da7c2+'-'+_0x107a5d+'/'+_0x593833)[_0x83bf('0x19')](_0x1825ea);}return null;};}function patchUpdates(_0x104e4d){return function(_0x19b970){try{jsonpatch['apply'](_0x19b970,_0x104e4d,!![]);}catch(_0x25e27b){return BPromise[_0x83bf('0x1f')](_0x25e27b);}return _0x19b970[_0x83bf('0x20')]();};}function saveUpdates(_0x2f03ca,_0x449935){return function(_0x23f9cb){if(_0x23f9cb){return _0x23f9cb[_0x83bf('0x21')](_0x2f03ca)[_0x83bf('0x22')](function(_0x6ca67c){return _0x6ca67c;});}return null;};}function removeEntity(_0x36799d,_0x37c995){return function(_0x3b4c83){if(_0x3b4c83){return _0x3b4c83['destroy']()[_0x83bf('0x22')](function(){_0x36799d[_0x83bf('0x17')](0xcc)[_0x83bf('0x18')]();});}};}function handleEntityNotFound(_0x421116,_0x4c0acc){return function(_0xa40b8c){if(!_0xa40b8c){_0x421116[_0x83bf('0x16')](0x194);}return _0xa40b8c;};}function handleError(_0x481613,_0x41374c){_0x41374c=_0x41374c||0x1f4;return function(_0x3dce9a){logger['error'](_0x3dce9a[_0x83bf('0x23')]);if(_0x3dce9a[_0x83bf('0x24')]){delete _0x3dce9a['name'];}_0x481613[_0x83bf('0x17')](_0x41374c)[_0x83bf('0x25')](_0x3dce9a);};}exports['index']=function(_0x5878ac,_0x52ef65){var _0x30b046={},_0x12263f={},_0x30871f={'count':0x0,'rows':[]};var _0x5d0ec7=_[_0x83bf('0x26')](db[_0x83bf('0x27')][_0x83bf('0x28')],function(_0x2adb86){return{'name':_0x2adb86['fieldName'],'type':_0x2adb86[_0x83bf('0x29')][_0x83bf('0x2a')]};});_0x12263f[_0x83bf('0x2b')]=_[_0x83bf('0x26')](_0x5d0ec7,_0x83bf('0x24'));_0x12263f[_0x83bf('0x2c')]=_[_0x83bf('0x2d')](_0x5878ac[_0x83bf('0x2c')]);_0x12263f[_0x83bf('0x2e')]=_['intersection'](_0x12263f['model'],_0x12263f[_0x83bf('0x2c')]);_0x30b046[_0x83bf('0x2f')]=_[_0x83bf('0x30')](_0x12263f['model'],qs[_0x83bf('0x31')](_0x5878ac[_0x83bf('0x2c')]['fields']));_0x30b046[_0x83bf('0x2f')]=_0x30b046['attributes'][_0x83bf('0x32')]?_0x30b046['attributes']:_0x12263f[_0x83bf('0x2b')];if(!_0x5878ac[_0x83bf('0x2c')][_0x83bf('0x33')](_0x83bf('0x34'))){_0x30b046['limit']=qs['limit'](_0x5878ac[_0x83bf('0x2c')]['limit']);_0x30b046['offset']=qs[_0x83bf('0x1a')](_0x5878ac[_0x83bf('0x2c')][_0x83bf('0x1a')]);}_0x30b046[_0x83bf('0x35')]=qs[_0x83bf('0x36')](_0x5878ac[_0x83bf('0x2c')]['sort']);_0x30b046[_0x83bf('0x37')]=qs[_0x83bf('0x2e')](_[_0x83bf('0x38')](_0x5878ac[_0x83bf('0x2c')],_0x12263f['filters']),_0x5d0ec7);if(_0x5878ac['query'][_0x83bf('0x39')]){_0x30b046[_0x83bf('0x37')]=_['merge'](_0x30b046[_0x83bf('0x37')],{'$or':_['map'](_0x5d0ec7,function(_0x1efd48){if(_0x1efd48[_0x83bf('0x29')]!==_0x83bf('0x3a')){var _0x563f87={};_0x563f87[_0x1efd48[_0x83bf('0x24')]]={'$like':'%'+_0x5878ac['query'][_0x83bf('0x39')]+'%'};return _0x563f87;}})});}_0x30b046=_['merge']({},_0x30b046,_0x5878ac[_0x83bf('0x3b')]);var _0x5d22b3={'where':_0x30b046[_0x83bf('0x37')]};return db[_0x83bf('0x27')][_0x83bf('0x1d')](_0x5d22b3)[_0x83bf('0x22')](function(_0x131f9e){_0x30871f[_0x83bf('0x1d')]=_0x131f9e;if(_0x5878ac[_0x83bf('0x2c')]['includeAll']){_0x30b046[_0x83bf('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x83bf('0x3d')](_0x30b046);})[_0x83bf('0x22')](function(_0x41ae47){_0x30871f['rows']=_0x41ae47;return _0x30871f;})['then'](respondWithFilteredResult(_0x52ef65,_0x30b046))[_0x83bf('0x3e')](handleError(_0x52ef65,null));};exports[_0x83bf('0x3f')]=function(_0x5a2b70,_0xdf60aa){var _0x1bb5cb={'raw':!![],'where':{'id':_0x5a2b70[_0x83bf('0x40')]['id']}},_0x131126={};_0x131126[_0x83bf('0x2b')]=_['keys'](db[_0x83bf('0x27')][_0x83bf('0x28')]);_0x131126[_0x83bf('0x2c')]=_[_0x83bf('0x2d')](_0x5a2b70[_0x83bf('0x2c')]);_0x131126[_0x83bf('0x2e')]=_[_0x83bf('0x30')](_0x131126[_0x83bf('0x2b')],_0x131126[_0x83bf('0x2c')]);_0x1bb5cb[_0x83bf('0x2f')]=_['intersection'](_0x131126[_0x83bf('0x2b')],qs[_0x83bf('0x31')](_0x5a2b70['query'][_0x83bf('0x31')]));_0x1bb5cb[_0x83bf('0x2f')]=_0x1bb5cb['attributes'][_0x83bf('0x32')]?_0x1bb5cb['attributes']:_0x131126[_0x83bf('0x2b')];if(_0x5a2b70['query'][_0x83bf('0x41')]){_0x1bb5cb['include']=[{'all':!![]}];}_0x1bb5cb=_[_0x83bf('0x42')]({},_0x1bb5cb,_0x5a2b70[_0x83bf('0x3b')]);return db['OpenchannelTransferReport'][_0x83bf('0x43')](_0x1bb5cb)['then'](handleEntityNotFound(_0xdf60aa,null))['then'](respondWithResult(_0xdf60aa,null))[_0x83bf('0x3e')](handleError(_0xdf60aa,null));};exports[_0x83bf('0x44')]=function(_0x322e80,_0x3e735c){return db['OpenchannelTransferReport'][_0x83bf('0x44')](_0x322e80[_0x83bf('0x45')],{})[_0x83bf('0x22')](respondWithResult(_0x3e735c,0xc9))[_0x83bf('0x3e')](handleError(_0x3e735c,null));};exports[_0x83bf('0x21')]=function(_0x41f40e,_0x18bb14){if(_0x41f40e['body']['id']){delete _0x41f40e[_0x83bf('0x45')]['id'];}return db[_0x83bf('0x27')][_0x83bf('0x43')]({'where':{'id':_0x41f40e['params']['id']}})['then'](handleEntityNotFound(_0x18bb14,null))[_0x83bf('0x22')](saveUpdates(_0x41f40e['body'],null))[_0x83bf('0x22')](respondWithResult(_0x18bb14,null))[_0x83bf('0x3e')](handleError(_0x18bb14,null));};exports[_0x83bf('0x46')]=function(_0x574a8f,_0xf901b6){return db[_0x83bf('0x27')][_0x83bf('0x43')]({'where':{'id':_0x574a8f[_0x83bf('0x40')]['id']}})['then'](handleEntityNotFound(_0xf901b6,null))[_0x83bf('0x22')](removeEntity(_0xf901b6,null))[_0x83bf('0x3e')](handleError(_0xf901b6,null));};exports[_0x83bf('0x47')]=function(_0x559bbd,_0x28e15a){return db[_0x83bf('0x27')]['describe']()[_0x83bf('0x22')](respondWithResult(_0x28e15a,null))[_0x83bf('0x3e')](handleError(_0x28e15a,null));}; \ No newline at end of file +var _0x152b=['status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x261c09,_0x14a73d){var _0x5e1ee6=function(_0x2414f9){while(--_0x2414f9){_0x261c09['push'](_0x261c09['shift']());}};_0x5e1ee6(++_0x14a73d);}(_0x152b,0x1e7));var _0xb152=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x152b[_0x52a857];return _0x4e2aae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb152('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb152('0x1'));var BPromise=require(_0xb152('0x2'));var Mustache=require(_0xb152('0x3'));var util=require(_0xb152('0x4'));var path=require(_0xb152('0x5'));var sox=require(_0xb152('0x6'));var csv=require('to-csv');var ejs=require(_0xb152('0x7'));var fs=require('fs');var fs_extra=require(_0xb152('0x8'));var _=require('lodash');var squel=require(_0xb152('0x9'));var crypto=require(_0xb152('0xa'));var jsforce=require(_0xb152('0xb'));var deskjs=require(_0xb152('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb152('0xd'));var Redis=require(_0xb152('0xe'));var authService=require(_0xb152('0xf'));var qs=require(_0xb152('0x10'));var as=require(_0xb152('0x11'));var hardwareService=require(_0xb152('0x12'));var logger=require('../../config/logger')(_0xb152('0x13'));var utils=require(_0xb152('0x14'));var config=require(_0xb152('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb152('0x16'))['db'];function respondWithStatusCode(_0x6ffa58,_0x2c85ff){_0x2c85ff=_0x2c85ff||0xcc;return function(_0x53bc0d){if(_0x53bc0d){return _0x6ffa58[_0xb152('0x17')](_0x2c85ff);}return _0x6ffa58[_0xb152('0x18')](_0x2c85ff)[_0xb152('0x19')]();};}function respondWithResult(_0x3121ae,_0x1d80c9){_0x1d80c9=_0x1d80c9||0xc8;return function(_0x2035de){if(_0x2035de){return _0x3121ae['status'](_0x1d80c9)[_0xb152('0x1a')](_0x2035de);}};}function respondWithFilteredResult(_0x1d6a5b,_0x11a8a8){return function(_0x2d529f){if(_0x2d529f){var _0x3b15c8=typeof _0x11a8a8[_0xb152('0x1b')]===_0xb152('0x1c')&&typeof _0x11a8a8[_0xb152('0x1d')]===_0xb152('0x1c');var _0x455a80=_0x2d529f['count'];var _0x50f131=_0x3b15c8?0x0:_0x11a8a8['offset'];var _0x168310=_0x3b15c8?_0x2d529f[_0xb152('0x1e')]:_0x11a8a8[_0xb152('0x1b')]+_0x11a8a8[_0xb152('0x1d')];var _0x1217a2;if(_0x168310>=_0x455a80){_0x168310=_0x455a80;_0x1217a2=0xc8;}else{_0x1217a2=0xce;}_0x1d6a5b[_0xb152('0x18')](_0x1217a2);return _0x1d6a5b['set'](_0xb152('0x1f'),_0x50f131+'-'+_0x168310+'/'+_0x455a80)[_0xb152('0x1a')](_0x2d529f);}return null;};}function patchUpdates(_0x357f99){return function(_0x4e448b){try{jsonpatch['apply'](_0x4e448b,_0x357f99,!![]);}catch(_0x39be6d){return BPromise[_0xb152('0x20')](_0x39be6d);}return _0x4e448b[_0xb152('0x21')]();};}function saveUpdates(_0x1c6868,_0x3605ec){return function(_0x27fcd0){if(_0x27fcd0){return _0x27fcd0[_0xb152('0x22')](_0x1c6868)[_0xb152('0x23')](function(_0x1a9b46){return _0x1a9b46;});}return null;};}function removeEntity(_0x549285,_0x75fd78){return function(_0x21c061){if(_0x21c061){return _0x21c061['destroy']()[_0xb152('0x23')](function(){_0x549285[_0xb152('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a539a,_0x551914){return function(_0x5ad5a3){if(!_0x5ad5a3){_0x1a539a[_0xb152('0x17')](0x194);}return _0x5ad5a3;};}function handleError(_0x502e7b,_0x120a11){_0x120a11=_0x120a11||0x1f4;return function(_0x40081c){logger[_0xb152('0x24')](_0x40081c[_0xb152('0x25')]);if(_0x40081c[_0xb152('0x26')]){delete _0x40081c[_0xb152('0x26')];}_0x502e7b[_0xb152('0x18')](_0x120a11)[_0xb152('0x27')](_0x40081c);};}exports[_0xb152('0x28')]=function(_0x2fd9df,_0xfd4a46){var _0x5c8ca0={},_0x5b59e9={},_0x2fbd24={'count':0x0,'rows':[]};var _0x5c1258=_[_0xb152('0x29')](db[_0xb152('0x2a')][_0xb152('0x2b')],function(_0x145926){return{'name':_0x145926['fieldName'],'type':_0x145926[_0xb152('0x2c')][_0xb152('0x2d')]};});_0x5b59e9[_0xb152('0x2e')]=_['map'](_0x5c1258,_0xb152('0x26'));_0x5b59e9[_0xb152('0x2f')]=_[_0xb152('0x30')](_0x2fd9df[_0xb152('0x2f')]);_0x5b59e9['filters']=_[_0xb152('0x31')](_0x5b59e9[_0xb152('0x2e')],_0x5b59e9[_0xb152('0x2f')]);_0x5c8ca0['attributes']=_[_0xb152('0x31')](_0x5b59e9[_0xb152('0x2e')],qs[_0xb152('0x32')](_0x2fd9df[_0xb152('0x2f')][_0xb152('0x32')]));_0x5c8ca0[_0xb152('0x33')]=_0x5c8ca0[_0xb152('0x33')][_0xb152('0x34')]?_0x5c8ca0['attributes']:_0x5b59e9[_0xb152('0x2e')];if(!_0x2fd9df[_0xb152('0x2f')][_0xb152('0x35')]('nolimit')){_0x5c8ca0['limit']=qs[_0xb152('0x1d')](_0x2fd9df[_0xb152('0x2f')][_0xb152('0x1d')]);_0x5c8ca0[_0xb152('0x1b')]=qs[_0xb152('0x1b')](_0x2fd9df[_0xb152('0x2f')][_0xb152('0x1b')]);}_0x5c8ca0['order']=qs[_0xb152('0x36')](_0x2fd9df[_0xb152('0x2f')][_0xb152('0x36')]);_0x5c8ca0[_0xb152('0x37')]=qs[_0xb152('0x38')](_[_0xb152('0x39')](_0x2fd9df[_0xb152('0x2f')],_0x5b59e9[_0xb152('0x38')]),_0x5c1258);if(_0x2fd9df[_0xb152('0x2f')][_0xb152('0x3a')]){_0x5c8ca0[_0xb152('0x37')]=_['merge'](_0x5c8ca0[_0xb152('0x37')],{'$or':_['map'](_0x5c1258,function(_0x113575){if(_0x113575['type']!==_0xb152('0x3b')){var _0x5332e2={};_0x5332e2[_0x113575[_0xb152('0x26')]]={'$like':'%'+_0x2fd9df[_0xb152('0x2f')][_0xb152('0x3a')]+'%'};return _0x5332e2;}})});}_0x5c8ca0=_[_0xb152('0x3c')]({},_0x5c8ca0,_0x2fd9df[_0xb152('0x3d')]);var _0x55ed9a={'where':_0x5c8ca0[_0xb152('0x37')]};return db['OpenchannelTransferReport']['count'](_0x55ed9a)[_0xb152('0x23')](function(_0x61e3c4){_0x2fbd24['count']=_0x61e3c4;if(_0x2fd9df['query']['includeAll']){_0x5c8ca0['include']=[{'all':!![]}];}return db[_0xb152('0x2a')][_0xb152('0x3e')](_0x5c8ca0);})[_0xb152('0x23')](function(_0x59dc03){_0x2fbd24[_0xb152('0x3f')]=_0x59dc03;return _0x2fbd24;})[_0xb152('0x23')](respondWithFilteredResult(_0xfd4a46,_0x5c8ca0))[_0xb152('0x40')](handleError(_0xfd4a46,null));};exports[_0xb152('0x41')]=function(_0x2ee42f,_0x165a54){var _0x24357a={'raw':!![],'where':{'id':_0x2ee42f[_0xb152('0x42')]['id']}},_0x3cceb9={};_0x3cceb9['model']=_[_0xb152('0x30')](db[_0xb152('0x2a')]['rawAttributes']);_0x3cceb9[_0xb152('0x2f')]=_[_0xb152('0x30')](_0x2ee42f[_0xb152('0x2f')]);_0x3cceb9[_0xb152('0x38')]=_['intersection'](_0x3cceb9[_0xb152('0x2e')],_0x3cceb9['query']);_0x24357a[_0xb152('0x33')]=_[_0xb152('0x31')](_0x3cceb9[_0xb152('0x2e')],qs[_0xb152('0x32')](_0x2ee42f['query'][_0xb152('0x32')]));_0x24357a[_0xb152('0x33')]=_0x24357a[_0xb152('0x33')][_0xb152('0x34')]?_0x24357a[_0xb152('0x33')]:_0x3cceb9[_0xb152('0x2e')];if(_0x2ee42f['query'][_0xb152('0x43')]){_0x24357a['include']=[{'all':!![]}];}_0x24357a=_['merge']({},_0x24357a,_0x2ee42f[_0xb152('0x3d')]);return db['OpenchannelTransferReport'][_0xb152('0x44')](_0x24357a)[_0xb152('0x23')](handleEntityNotFound(_0x165a54,null))['then'](respondWithResult(_0x165a54,null))[_0xb152('0x40')](handleError(_0x165a54,null));};exports[_0xb152('0x45')]=function(_0x3e5253,_0x1de71f){return db['OpenchannelTransferReport']['create'](_0x3e5253[_0xb152('0x46')],{})[_0xb152('0x23')](respondWithResult(_0x1de71f,0xc9))[_0xb152('0x40')](handleError(_0x1de71f,null));};exports['update']=function(_0x437b20,_0x19e606){if(_0x437b20[_0xb152('0x46')]['id']){delete _0x437b20[_0xb152('0x46')]['id'];}return db[_0xb152('0x2a')][_0xb152('0x44')]({'where':{'id':_0x437b20[_0xb152('0x42')]['id']}})[_0xb152('0x23')](handleEntityNotFound(_0x19e606,null))[_0xb152('0x23')](saveUpdates(_0x437b20[_0xb152('0x46')],null))['then'](respondWithResult(_0x19e606,null))[_0xb152('0x40')](handleError(_0x19e606,null));};exports[_0xb152('0x47')]=function(_0x641138,_0x43e128){return db[_0xb152('0x2a')][_0xb152('0x44')]({'where':{'id':_0x641138['params']['id']}})[_0xb152('0x23')](handleEntityNotFound(_0x43e128,null))[_0xb152('0x23')](removeEntity(_0x43e128,null))['catch'](handleError(_0x43e128,null));};exports[_0xb152('0x48')]=function(_0x5e6eb2,_0x28a3fb){return db[_0xb152('0x2a')][_0xb152('0x48')]()['then'](respondWithResult(_0x28a3fb,null))[_0xb152('0x40')](handleError(_0x28a3fb,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index b3cac13..941ded4 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 _0x820c=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x6b3aa,_0x25d15c){var _0x1123f2=function(_0x576038){while(--_0x576038){_0x6b3aa['push'](_0x6b3aa['shift']());}};_0x1123f2(++_0x25d15c);}(_0x820c,0x18b));var _0xc820=function(_0x55728b,_0x11641a){_0x55728b=_0x55728b-0x0;var _0x430ef1=_0x820c[_0x55728b];return _0x430ef1;};'use strict';var _=require('lodash');var util=require(_0xc820('0x0'));var logger=require(_0xc820('0x1'))(_0xc820('0x2'));var moment=require(_0xc820('0x3'));var BPromise=require('bluebird');var rp=require(_0xc820('0x4'));var fs=require('fs');var path=require(_0xc820('0x5'));var rimraf=require('rimraf');var config=require(_0xc820('0x6'));var attributes=require(_0xc820('0x7'));module[_0xc820('0x8')]=function(_0x193539,_0x3765a8){return _0x193539[_0xc820('0x9')](_0xc820('0xa'),attributes,{'tableName':_0xc820('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc820('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2233=['moment','bluebird','request-promise','../../config/environment','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x560d4f,_0x5eec7f){var _0x30b9f7=function(_0x3c68f6){while(--_0x3c68f6){_0x560d4f['push'](_0x560d4f['shift']());}};_0x30b9f7(++_0x5eec7f);}(_0x2233,0x170));var _0x3223=function(_0x8f7825,_0xaa0ca0){_0x8f7825=_0x8f7825-0x0;var _0x29a7c9=_0x2233[_0x8f7825];return _0x29a7c9;};'use strict';var _=require(_0x3223('0x0'));var util=require(_0x3223('0x1'));var logger=require(_0x3223('0x2'))(_0x3223('0x3'));var moment=require(_0x3223('0x4'));var BPromise=require(_0x3223('0x5'));var rp=require(_0x3223('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3223('0x7'));var attributes=require(_0x3223('0x8'));module['exports']=function(_0x410288,_0x5a2210){return _0x410288['define'](_0x3223('0x9'),attributes,{'tableName':_0x3223('0xa'),'paranoid':![],'indexes':[{'name':_0x3223('0xb'),'fields':[_0x3223('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 2aa8003..14b940d 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 _0x2975=['http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0xf3e375,_0x5dc1c9){var _0x27027b=function(_0x41785a){while(--_0x41785a){_0xf3e375['push'](_0xf3e375['shift']());}};_0x27027b(++_0x5dc1c9);}(_0x2975,0x1c5));var _0x5297=function(_0x4c892e,_0x33bf4c){_0x4c892e=_0x4c892e-0x0;var _0x55c680=_0x2975[_0x4c892e];return _0x55c680;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var moment=require(_0x5297('0x1'));var BPromise=require(_0x5297('0x2'));var rs=require(_0x5297('0x3'));var fs=require('fs');var Redis=require(_0x5297('0x4'));var db=require(_0x5297('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5297('0x6'));var jayson=require(_0x5297('0x7'));var client=jayson[_0x5297('0x8')][_0x5297('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d1d2c,_0x1f6762,_0x1b72a7){return new BPromise(function(_0x4f12b0,_0x2c015c){return client[_0x5297('0xa')](_0x4d1d2c,_0x1b72a7)[_0x5297('0xb')](function(_0x2f3b24){logger[_0x5297('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x5297('0xd'));logger[_0x5297('0xe')](_0x5297('0xf'),_0x1f6762,'request\x20sent',JSON[_0x5297('0x10')](_0x2f3b24));if(_0x2f3b24[_0x5297('0x11')]){if(_0x2f3b24[_0x5297('0x11')]['code']===0x1f4){logger[_0x5297('0x11')](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error']['message']);return _0x2c015c(_0x2f3b24[_0x5297('0x11')][_0x5297('0x13')]);}logger['error'](_0x5297('0x12'),_0x1f6762,_0x2f3b24['error'][_0x5297('0x13')]);return _0x4f12b0(_0x2f3b24[_0x5297('0x11')]['message']);}else{logger[_0x5297('0xc')](_0x5297('0x12'),_0x1f6762,_0x5297('0xd'));_0x4f12b0(_0x2f3b24[_0x5297('0x14')][_0x5297('0x13')]);}})[_0x5297('0x15')](function(_0x1fb138){logger[_0x5297('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f6762,_0x1fb138);_0x2c015c(_0x1fb138);});});} \ No newline at end of file +var _0xa786=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xa786,0x1d2));var _0x6a78=function(_0x100bb7,_0xfecf7d){_0x100bb7=_0x100bb7-0x0;var _0x261d9c=_0xa786[_0x100bb7];return _0x261d9c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6a78('0x0'));var BPromise=require(_0x6a78('0x1'));var rs=require(_0x6a78('0x2'));var fs=require('fs');var Redis=require(_0x6a78('0x3'));var db=require(_0x6a78('0x4'))['db'];var utils=require(_0x6a78('0x5'));var logger=require(_0x6a78('0x6'))('rpc');var config=require(_0x6a78('0x7'));var jayson=require(_0x6a78('0x8'));var client=jayson[_0x6a78('0x9')][_0x6a78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28d286,_0x2f8387,_0x2b8c4c){return new BPromise(function(_0x2a6de6,_0x25db5e){return client[_0x6a78('0xb')](_0x28d286,_0x2b8c4c)[_0x6a78('0xc')](function(_0x33e71c){logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x2f8387,_0x6a78('0xf'));logger[_0x6a78('0x10')](_0x6a78('0x11'),_0x2f8387,_0x6a78('0xf'),JSON[_0x6a78('0x12')](_0x33e71c));if(_0x33e71c['error']){if(_0x33e71c['error'][_0x6a78('0x13')]===0x1f4){logger[_0x6a78('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2f8387,_0x33e71c[_0x6a78('0x14')][_0x6a78('0x15')]);return _0x25db5e(_0x33e71c[_0x6a78('0x14')][_0x6a78('0x15')]);}logger[_0x6a78('0x14')](_0x6a78('0xe'),_0x2f8387,_0x33e71c[_0x6a78('0x14')]['message']);return _0x2a6de6(_0x33e71c['error']['message']);}else{logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x2f8387,_0x6a78('0xf'));_0x2a6de6(_0x33e71c['result'][_0x6a78('0x15')]);}})[_0x6a78('0x16')](function(_0x5b5a5d){logger[_0x6a78('0x14')](_0x6a78('0xe'),_0x2f8387,_0x5b5a5d);_0x25db5e(_0x5b5a5d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 640b226..40827ce 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 _0x9b93=['../../components/auth/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b93,0xf7));var _0x39b9=function(_0x1118eb,_0x476f0a){_0x1118eb=_0x1118eb-0x0;var _0x2dbcd0=_0x9b93[_0x1118eb];return _0x2dbcd0;};'use strict';var multer=require(_0x39b9('0x0'));var util=require(_0x39b9('0x1'));var path=require(_0x39b9('0x2'));var timeout=require(_0x39b9('0x3'));var express=require(_0x39b9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x39b9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39b9('0x6'));router[_0x39b9('0x7')]('/',auth[_0x39b9('0x8')](),controller[_0x39b9('0x9')]);router[_0x39b9('0x7')](_0x39b9('0xa'),auth[_0x39b9('0x8')](),controller[_0x39b9('0xb')]);router[_0x39b9('0xc')]('/',auth['isAuthenticated'](),controller[_0x39b9('0xd')]);router[_0x39b9('0xe')](_0x39b9('0xa'),auth[_0x39b9('0x8')](),controller['update']);router[_0x39b9('0xf')]('/:id',auth[_0x39b9('0x8')](),controller[_0x39b9('0x10')]);module[_0x39b9('0x11')]=router; \ No newline at end of file +var _0xaf58=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id','isAuthenticated','create','delete','destroy','exports','multer'];(function(_0x44e4a1,_0x3d053a){var _0x546ad3=function(_0x5dd44c){while(--_0x5dd44c){_0x44e4a1['push'](_0x44e4a1['shift']());}};_0x546ad3(++_0x3d053a);}(_0xaf58,0x1b1));var _0x8af5=function(_0x53e991,_0x4b7706){_0x53e991=_0x53e991-0x0;var _0x89eaf=_0xaf58[_0x53e991];return _0x89eaf;};'use strict';var multer=require(_0x8af5('0x0'));var util=require(_0x8af5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8af5('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8af5('0x3'));var interaction=require(_0x8af5('0x4'));var config=require(_0x8af5('0x5'));var controller=require(_0x8af5('0x6'));router[_0x8af5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8af5('0x7')](_0x8af5('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8af5('0x9')](),controller[_0x8af5('0xa')]);router['put'](_0x8af5('0x8'),auth[_0x8af5('0x9')](),controller['update']);router[_0x8af5('0xb')](_0x8af5('0x8'),auth['isAuthenticated'](),controller[_0x8af5('0xc')]);module[_0x8af5('0xd')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f2da93e..6bbdc05 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 _0xdc52=['exports','STRING','sequelize'];(function(_0x4982f6,_0x45ba31){var _0x3d8a48=function(_0xef2826){while(--_0xef2826){_0x4982f6['push'](_0x4982f6['shift']());}};_0x3d8a48(++_0x45ba31);}(_0xdc52,0xe9));var _0x2dc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dc5('0x0'));module[_0x2dc5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2dc5('0x2')]}}; \ No newline at end of file +var _0xde54=['exports','STRING','name'];(function(_0x47872c,_0x8fc111){var _0x266863=function(_0x229584){while(--_0x229584){_0x47872c['push'](_0x47872c['shift']());}};_0x266863(++_0x8fc111);}(_0xde54,0x1a1));var _0x4de5=function(_0x5954d2,_0x15db93){_0x5954d2=_0x5954d2-0x0;var _0x316928=_0xde54[_0x5954d2];return _0x316928;};'use strict';var Sequelize=require('sequelize');module[_0x4de5('0x0')]={'name':{'type':Sequelize[_0x4de5('0x1')],'unique':_0x4de5('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index cf7eb67..ff7bcca 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 _0xa67e=['index','map','Pause','type','key','model','query','keys','intersection','attributes','fields','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','sendStatus','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa67e,0xcf));var _0xea67=function(_0x45f3a4,_0x46968d){_0x45f3a4=_0x45f3a4-0x0;var _0x49943a=_0xa67e[_0x45f3a4];return _0x49943a;};'use strict';var emlformat=require(_0xea67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea67('0x1'));var jsonpatch=require(_0xea67('0x2'));var rp=require(_0xea67('0x3'));var moment=require(_0xea67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xea67('0x5'));var util=require('util');var path=require('path');var sox=require(_0xea67('0x6'));var csv=require(_0xea67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea67('0x8'));var _=require(_0xea67('0x9'));var squel=require(_0xea67('0xa'));var crypto=require(_0xea67('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea67('0xc'));var toCsv=require(_0xea67('0x7'));var querystring=require(_0xea67('0xd'));var Papa=require(_0xea67('0xe'));var Redis=require(_0xea67('0xf'));var authService=require(_0xea67('0x10'));var qs=require(_0xea67('0x11'));var as=require(_0xea67('0x12'));var hardwareService=require(_0xea67('0x13'));var logger=require(_0xea67('0x14'))(_0xea67('0x15'));var utils=require('../../config/utils');var config=require(_0xea67('0x16'));var licenseUtil=require(_0xea67('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15aa32,_0x346a68){_0x346a68=_0x346a68||0xcc;return function(_0x1c0d13){if(_0x1c0d13){return _0x15aa32['sendStatus'](_0x346a68);}return _0x15aa32[_0xea67('0x18')](_0x346a68)[_0xea67('0x19')]();};}function respondWithResult(_0x1be315,_0x3f304d){_0x3f304d=_0x3f304d||0xc8;return function(_0x1a8a41){if(_0x1a8a41){return _0x1be315[_0xea67('0x18')](_0x3f304d)[_0xea67('0x1a')](_0x1a8a41);}};}function respondWithFilteredResult(_0x411001,_0xf016f3){return function(_0x389b43){if(_0x389b43){var _0x893bf7=typeof _0xf016f3[_0xea67('0x1b')]===_0xea67('0x1c')&&typeof _0xf016f3['limit']===_0xea67('0x1c');var _0x26e2f4=_0x389b43[_0xea67('0x1d')];var _0x235478=_0x893bf7?0x0:_0xf016f3['offset'];var _0x433f2e=_0x893bf7?_0x389b43[_0xea67('0x1d')]:_0xf016f3[_0xea67('0x1b')]+_0xf016f3['limit'];var _0x4bfbe7;if(_0x433f2e>=_0x26e2f4){_0x433f2e=_0x26e2f4;_0x4bfbe7=0xc8;}else{_0x4bfbe7=0xce;}_0x411001['status'](_0x4bfbe7);return _0x411001[_0xea67('0x1e')](_0xea67('0x1f'),_0x235478+'-'+_0x433f2e+'/'+_0x26e2f4)[_0xea67('0x1a')](_0x389b43);}return null;};}function patchUpdates(_0x2ed6bd){return function(_0x5559b3){try{jsonpatch[_0xea67('0x20')](_0x5559b3,_0x2ed6bd,!![]);}catch(_0x4f35a0){return BPromise[_0xea67('0x21')](_0x4f35a0);}return _0x5559b3[_0xea67('0x22')]();};}function saveUpdates(_0xe57108,_0x468b35){return function(_0xd6eab4){if(_0xd6eab4){return _0xd6eab4[_0xea67('0x23')](_0xe57108)[_0xea67('0x24')](function(_0x17fd84){return _0x17fd84;});}return null;};}function removeEntity(_0x1a6cc5,_0x3c7cd4){return function(_0x3c9c4b){if(_0x3c9c4b){return _0x3c9c4b[_0xea67('0x25')]()[_0xea67('0x24')](function(){var _0x2c9ee5=_0x3c9c4b['get']({'plain':!![]});var _0x34a598=_0xea67('0x26');return db[_0xea67('0x27')][_0xea67('0x25')]({'where':{'type':_0x34a598,'resourceId':_0x2c9ee5['id']}})[_0xea67('0x24')](function(){return _0x3c9c4b;});})[_0xea67('0x24')](function(){_0x1a6cc5['status'](0xcc)[_0xea67('0x19')]();});}};}function handleEntityNotFound(_0x3eb1c0,_0x21a014){return function(_0x9d92b){if(!_0x9d92b){_0x3eb1c0[_0xea67('0x28')](0x194);}return _0x9d92b;};}function handleError(_0x4cd17e,_0x4ded9b){_0x4ded9b=_0x4ded9b||0x1f4;return function(_0x597cfb){logger[_0xea67('0x29')](_0x597cfb[_0xea67('0x2a')]);if(_0x597cfb[_0xea67('0x2b')]){delete _0x597cfb['name'];}_0x4cd17e['status'](_0x4ded9b)[_0xea67('0x2c')](_0x597cfb);};}exports[_0xea67('0x2d')]=function(_0xc64b68,_0x5dc157){var _0x5ba159={},_0x240e38={},_0x452c90={'count':0x0,'rows':[]};var _0x46e08d=_[_0xea67('0x2e')](db[_0xea67('0x2f')]['rawAttributes'],function(_0x687a24){return{'name':_0x687a24['fieldName'],'type':_0x687a24[_0xea67('0x30')][_0xea67('0x31')]};});_0x240e38[_0xea67('0x32')]=_[_0xea67('0x2e')](_0x46e08d,_0xea67('0x2b'));_0x240e38[_0xea67('0x33')]=_[_0xea67('0x34')](_0xc64b68[_0xea67('0x33')]);_0x240e38['filters']=_[_0xea67('0x35')](_0x240e38[_0xea67('0x32')],_0x240e38['query']);_0x5ba159[_0xea67('0x36')]=_[_0xea67('0x35')](_0x240e38[_0xea67('0x32')],qs[_0xea67('0x37')](_0xc64b68[_0xea67('0x33')][_0xea67('0x37')]));_0x5ba159[_0xea67('0x36')]=_0x5ba159['attributes']['length']?_0x5ba159['attributes']:_0x240e38[_0xea67('0x32')];if(!_0xc64b68[_0xea67('0x33')]['hasOwnProperty']('nolimit')){_0x5ba159[_0xea67('0x38')]=qs[_0xea67('0x38')](_0xc64b68[_0xea67('0x33')]['limit']);_0x5ba159[_0xea67('0x1b')]=qs[_0xea67('0x1b')](_0xc64b68[_0xea67('0x33')][_0xea67('0x1b')]);}_0x5ba159['order']=qs[_0xea67('0x39')](_0xc64b68[_0xea67('0x33')][_0xea67('0x39')]);_0x5ba159[_0xea67('0x3a')]=qs[_0xea67('0x3b')](_[_0xea67('0x3c')](_0xc64b68['query'],_0x240e38[_0xea67('0x3b')]),_0x46e08d);if(_0xc64b68['query'][_0xea67('0x3d')]){_0x5ba159['where']=_[_0xea67('0x3e')](_0x5ba159[_0xea67('0x3a')],{'$or':_[_0xea67('0x2e')](_0x46e08d,function(_0x5f3ea0){if(_0x5f3ea0[_0xea67('0x30')]!==_0xea67('0x3f')){var _0x19394c={};_0x19394c[_0x5f3ea0[_0xea67('0x2b')]]={'$like':'%'+_0xc64b68[_0xea67('0x33')][_0xea67('0x3d')]+'%'};return _0x19394c;}})});}_0x5ba159=_[_0xea67('0x3e')]({},_0x5ba159,_0xc64b68[_0xea67('0x40')]);var _0x5a28b4={'where':_0x5ba159[_0xea67('0x3a')]};return db[_0xea67('0x2f')][_0xea67('0x1d')](_0x5a28b4)[_0xea67('0x24')](function(_0x2b3571){_0x452c90['count']=_0x2b3571;if(_0xc64b68[_0xea67('0x33')][_0xea67('0x41')]){_0x5ba159[_0xea67('0x42')]=[{'all':!![]}];}return db[_0xea67('0x2f')]['findAll'](_0x5ba159);})[_0xea67('0x24')](function(_0x71f909){_0x452c90[_0xea67('0x43')]=_0x71f909;return _0x452c90;})[_0xea67('0x24')](respondWithFilteredResult(_0x5dc157,_0x5ba159))[_0xea67('0x44')](handleError(_0x5dc157,null));};exports[_0xea67('0x45')]=function(_0x4dcbd5,_0x5ba4d8){var _0x31b604={'raw':!![],'where':{'id':_0x4dcbd5[_0xea67('0x46')]['id']}},_0x502cda={};_0x502cda[_0xea67('0x32')]=_[_0xea67('0x34')](db[_0xea67('0x2f')][_0xea67('0x47')]);_0x502cda[_0xea67('0x33')]=_[_0xea67('0x34')](_0x4dcbd5[_0xea67('0x33')]);_0x502cda[_0xea67('0x3b')]=_[_0xea67('0x35')](_0x502cda[_0xea67('0x32')],_0x502cda[_0xea67('0x33')]);_0x31b604[_0xea67('0x36')]=_['intersection'](_0x502cda[_0xea67('0x32')],qs['fields'](_0x4dcbd5[_0xea67('0x33')]['fields']));_0x31b604['attributes']=_0x31b604['attributes'][_0xea67('0x48')]?_0x31b604[_0xea67('0x36')]:_0x502cda['model'];if(_0x4dcbd5[_0xea67('0x33')][_0xea67('0x41')]){_0x31b604['include']=[{'all':!![]}];}_0x31b604=_['merge']({},_0x31b604,_0x4dcbd5[_0xea67('0x40')]);return db[_0xea67('0x2f')]['find'](_0x31b604)[_0xea67('0x24')](handleEntityNotFound(_0x5ba4d8,null))[_0xea67('0x24')](respondWithResult(_0x5ba4d8,null))[_0xea67('0x44')](handleError(_0x5ba4d8,null));};exports[_0xea67('0x49')]=function(_0x104ed3,_0x5c67d1){return db[_0xea67('0x2f')][_0xea67('0x49')](_0x104ed3['body'],{})[_0xea67('0x24')](function(_0x1310c9){var _0x3cecd6=_0x104ed3[_0xea67('0x4a')]['get']({'plain':!![]});if(!_0x3cecd6)throw new Error(_0xea67('0x4b'));if(_0x3cecd6[_0xea67('0x4c')]===_0xea67('0x4a')){var _0x570413=_0x1310c9[_0xea67('0x4d')]({'plain':!![]});var _0x409edf='Pauses';return db[_0xea67('0x4e')][_0xea67('0x4f')]({'where':{'name':_0x409edf,'userProfileId':_0x3cecd6[_0xea67('0x50')]},'raw':!![]})[_0xea67('0x24')](function(_0x30d0f8){if(_0x30d0f8&&_0x30d0f8[_0xea67('0x51')]===0x0){return db[_0xea67('0x27')]['create']({'name':_0x570413[_0xea67('0x2b')],'resourceId':_0x570413['id'],'type':_0x30d0f8['name'],'sectionId':_0x30d0f8['id']},{})['then'](function(){return _0x1310c9;});}else{return _0x1310c9;}})['catch'](function(_0x50d371){logger['error'](_0xea67('0x52'),_0x50d371);throw _0x50d371;});}return _0x1310c9;})[_0xea67('0x24')](respondWithResult(_0x5c67d1,0xc9))[_0xea67('0x44')](handleError(_0x5c67d1,null));};exports['update']=function(_0x3aea2c,_0x4cd15b){if(_0x3aea2c[_0xea67('0x53')]['id']){delete _0x3aea2c[_0xea67('0x53')]['id'];}return db[_0xea67('0x2f')][_0xea67('0x4f')]({'where':{'id':_0x3aea2c['params']['id']}})[_0xea67('0x24')](handleEntityNotFound(_0x4cd15b,null))[_0xea67('0x24')](saveUpdates(_0x3aea2c[_0xea67('0x53')],null))[_0xea67('0x24')](respondWithResult(_0x4cd15b,null))['catch'](handleError(_0x4cd15b,null));};exports[_0xea67('0x25')]=function(_0x412155,_0x3306b3){return db[_0xea67('0x2f')][_0xea67('0x4f')]({'where':{'id':_0x412155['params']['id']}})['then'](handleEntityNotFound(_0x3306b3,null))[_0xea67('0x24')](removeEntity(_0x3306b3,null))[_0xea67('0x44')](handleError(_0x3306b3,null));}; \ No newline at end of file +var _0x662e=['query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','Pauses','UserProfileResource','stack','name','send','index','Pause','rawAttributes','type','key','model','map'];(function(_0x268afe,_0x50bb60){var _0x288d0b=function(_0x5ec113){while(--_0x5ec113){_0x268afe['push'](_0x268afe['shift']());}};_0x288d0b(++_0x50bb60);}(_0x662e,0x164));var _0xe662=function(_0x195f52,_0x936883){_0x195f52=_0x195f52-0x0;var _0x4c5eaa=_0x662e[_0x195f52];return _0x4c5eaa;};'use strict';var emlformat=require(_0xe662('0x0'));var rimraf=require(_0xe662('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe662('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe662('0x3'));var path=require(_0xe662('0x4'));var sox=require(_0xe662('0x5'));var csv=require(_0xe662('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe662('0x7'));var _=require(_0xe662('0x8'));var squel=require(_0xe662('0x9'));var crypto=require(_0xe662('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe662('0xb'));var toCsv=require(_0xe662('0x6'));var querystring=require('querystring');var Papa=require(_0xe662('0xc'));var Redis=require(_0xe662('0xd'));var authService=require(_0xe662('0xe'));var qs=require(_0xe662('0xf'));var as=require(_0xe662('0x10'));var hardwareService=require(_0xe662('0x11'));var logger=require(_0xe662('0x12'))(_0xe662('0x13'));var utils=require(_0xe662('0x14'));var config=require(_0xe662('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe662('0x16'))['db'];function respondWithStatusCode(_0x37b109,_0x6b0b96){_0x6b0b96=_0x6b0b96||0xcc;return function(_0xca1c28){if(_0xca1c28){return _0x37b109[_0xe662('0x17')](_0x6b0b96);}return _0x37b109[_0xe662('0x18')](_0x6b0b96)[_0xe662('0x19')]();};}function respondWithResult(_0x2bf39e,_0x222bf6){_0x222bf6=_0x222bf6||0xc8;return function(_0xcde2a6){if(_0xcde2a6){return _0x2bf39e[_0xe662('0x18')](_0x222bf6)[_0xe662('0x1a')](_0xcde2a6);}};}function respondWithFilteredResult(_0x2e3468,_0x37c41a){return function(_0x22ab3a){if(_0x22ab3a){var _0x1ea01d=typeof _0x37c41a['offset']===_0xe662('0x1b')&&typeof _0x37c41a[_0xe662('0x1c')]==='undefined';var _0xc5e9ab=_0x22ab3a[_0xe662('0x1d')];var _0x4769cc=_0x1ea01d?0x0:_0x37c41a['offset'];var _0x13ed8b=_0x1ea01d?_0x22ab3a[_0xe662('0x1d')]:_0x37c41a[_0xe662('0x1e')]+_0x37c41a[_0xe662('0x1c')];var _0x298bae;if(_0x13ed8b>=_0xc5e9ab){_0x13ed8b=_0xc5e9ab;_0x298bae=0xc8;}else{_0x298bae=0xce;}_0x2e3468[_0xe662('0x18')](_0x298bae);return _0x2e3468[_0xe662('0x1f')](_0xe662('0x20'),_0x4769cc+'-'+_0x13ed8b+'/'+_0xc5e9ab)['json'](_0x22ab3a);}return null;};}function patchUpdates(_0x461071){return function(_0x1cb8e0){try{jsonpatch['apply'](_0x1cb8e0,_0x461071,!![]);}catch(_0x3f5c63){return BPromise['reject'](_0x3f5c63);}return _0x1cb8e0[_0xe662('0x21')]();};}function saveUpdates(_0x5c4808,_0x1a6f70){return function(_0x575fb2){if(_0x575fb2){return _0x575fb2[_0xe662('0x22')](_0x5c4808)[_0xe662('0x23')](function(_0x370b6b){return _0x370b6b;});}return null;};}function removeEntity(_0x36f191,_0x341d04){return function(_0xa980d9){if(_0xa980d9){return _0xa980d9[_0xe662('0x24')]()[_0xe662('0x23')](function(){var _0x30ef00=_0xa980d9['get']({'plain':!![]});var _0x4a5d00=_0xe662('0x25');return db[_0xe662('0x26')]['destroy']({'where':{'type':_0x4a5d00,'resourceId':_0x30ef00['id']}})['then'](function(){return _0xa980d9;});})['then'](function(){_0x36f191[_0xe662('0x18')](0xcc)[_0xe662('0x19')]();});}};}function handleEntityNotFound(_0x5b8fd9,_0x317d31){return function(_0x553bfd){if(!_0x553bfd){_0x5b8fd9[_0xe662('0x17')](0x194);}return _0x553bfd;};}function handleError(_0x167c87,_0x500dc0){_0x500dc0=_0x500dc0||0x1f4;return function(_0xcbfe79){logger['error'](_0xcbfe79[_0xe662('0x27')]);if(_0xcbfe79['name']){delete _0xcbfe79[_0xe662('0x28')];}_0x167c87[_0xe662('0x18')](_0x500dc0)[_0xe662('0x29')](_0xcbfe79);};}exports[_0xe662('0x2a')]=function(_0x54b7b8,_0x296d90){var _0x5f10f7={},_0x559570={},_0x220841={'count':0x0,'rows':[]};var _0x28aff5=_['map'](db[_0xe662('0x2b')][_0xe662('0x2c')],function(_0x24ca38){return{'name':_0x24ca38['fieldName'],'type':_0x24ca38[_0xe662('0x2d')][_0xe662('0x2e')]};});_0x559570[_0xe662('0x2f')]=_[_0xe662('0x30')](_0x28aff5,'name');_0x559570[_0xe662('0x31')]=_[_0xe662('0x32')](_0x54b7b8[_0xe662('0x31')]);_0x559570[_0xe662('0x33')]=_[_0xe662('0x34')](_0x559570[_0xe662('0x2f')],_0x559570['query']);_0x5f10f7['attributes']=_[_0xe662('0x34')](_0x559570[_0xe662('0x2f')],qs[_0xe662('0x35')](_0x54b7b8['query'][_0xe662('0x35')]));_0x5f10f7[_0xe662('0x36')]=_0x5f10f7[_0xe662('0x36')][_0xe662('0x37')]?_0x5f10f7['attributes']:_0x559570['model'];if(!_0x54b7b8[_0xe662('0x31')]['hasOwnProperty'](_0xe662('0x38'))){_0x5f10f7['limit']=qs[_0xe662('0x1c')](_0x54b7b8[_0xe662('0x31')]['limit']);_0x5f10f7[_0xe662('0x1e')]=qs[_0xe662('0x1e')](_0x54b7b8['query'][_0xe662('0x1e')]);}_0x5f10f7[_0xe662('0x39')]=qs[_0xe662('0x3a')](_0x54b7b8[_0xe662('0x31')][_0xe662('0x3a')]);_0x5f10f7['where']=qs[_0xe662('0x33')](_[_0xe662('0x3b')](_0x54b7b8['query'],_0x559570[_0xe662('0x33')]),_0x28aff5);if(_0x54b7b8[_0xe662('0x31')][_0xe662('0x3c')]){_0x5f10f7[_0xe662('0x3d')]=_[_0xe662('0x3e')](_0x5f10f7['where'],{'$or':_[_0xe662('0x30')](_0x28aff5,function(_0x4a49a6){if(_0x4a49a6['type']!==_0xe662('0x3f')){var _0x593563={};_0x593563[_0x4a49a6[_0xe662('0x28')]]={'$like':'%'+_0x54b7b8[_0xe662('0x31')][_0xe662('0x3c')]+'%'};return _0x593563;}})});}_0x5f10f7=_['merge']({},_0x5f10f7,_0x54b7b8['options']);var _0x508357={'where':_0x5f10f7[_0xe662('0x3d')]};return db[_0xe662('0x2b')]['count'](_0x508357)['then'](function(_0x8dba0b){_0x220841[_0xe662('0x1d')]=_0x8dba0b;if(_0x54b7b8['query'][_0xe662('0x40')]){_0x5f10f7[_0xe662('0x41')]=[{'all':!![]}];}return db[_0xe662('0x2b')]['findAll'](_0x5f10f7);})[_0xe662('0x23')](function(_0x56d47a){_0x220841[_0xe662('0x42')]=_0x56d47a;return _0x220841;})[_0xe662('0x23')](respondWithFilteredResult(_0x296d90,_0x5f10f7))[_0xe662('0x43')](handleError(_0x296d90,null));};exports[_0xe662('0x44')]=function(_0x4b143a,_0x1d5836){var _0x2704e7={'raw':!![],'where':{'id':_0x4b143a['params']['id']}},_0x123d58={};_0x123d58[_0xe662('0x2f')]=_[_0xe662('0x32')](db[_0xe662('0x2b')][_0xe662('0x2c')]);_0x123d58[_0xe662('0x31')]=_[_0xe662('0x32')](_0x4b143a['query']);_0x123d58[_0xe662('0x33')]=_['intersection'](_0x123d58[_0xe662('0x2f')],_0x123d58[_0xe662('0x31')]);_0x2704e7['attributes']=_[_0xe662('0x34')](_0x123d58[_0xe662('0x2f')],qs[_0xe662('0x35')](_0x4b143a['query'][_0xe662('0x35')]));_0x2704e7['attributes']=_0x2704e7[_0xe662('0x36')][_0xe662('0x37')]?_0x2704e7[_0xe662('0x36')]:_0x123d58['model'];if(_0x4b143a['query']['includeAll']){_0x2704e7[_0xe662('0x41')]=[{'all':!![]}];}_0x2704e7=_[_0xe662('0x3e')]({},_0x2704e7,_0x4b143a['options']);return db['Pause']['find'](_0x2704e7)[_0xe662('0x23')](handleEntityNotFound(_0x1d5836,null))['then'](respondWithResult(_0x1d5836,null))[_0xe662('0x43')](handleError(_0x1d5836,null));};exports[_0xe662('0x45')]=function(_0x24f457,_0x52e13e){return db[_0xe662('0x2b')]['create'](_0x24f457[_0xe662('0x46')],{})['then'](function(_0x2b487b){var _0x1c0636=_0x24f457[_0xe662('0x47')][_0xe662('0x48')]({'plain':!![]});if(!_0x1c0636)throw new Error(_0xe662('0x49'));if(_0x1c0636['role']==='user'){var _0x1d6f7b=_0x2b487b[_0xe662('0x48')]({'plain':!![]});var _0x49ac2f='Pauses';return db[_0xe662('0x4a')][_0xe662('0x4b')]({'where':{'name':_0x49ac2f,'userProfileId':_0x1c0636[_0xe662('0x4c')]},'raw':!![]})[_0xe662('0x23')](function(_0x3ff679){if(_0x3ff679&&_0x3ff679[_0xe662('0x4d')]===0x0){return db[_0xe662('0x26')][_0xe662('0x45')]({'name':_0x1d6f7b[_0xe662('0x28')],'resourceId':_0x1d6f7b['id'],'type':_0x3ff679[_0xe662('0x28')],'sectionId':_0x3ff679['id']},{})[_0xe662('0x23')](function(){return _0x2b487b;});}else{return _0x2b487b;}})['catch'](function(_0x5a4143){logger[_0xe662('0x4e')](_0xe662('0x4f'),_0x5a4143);throw _0x5a4143;});}return _0x2b487b;})['then'](respondWithResult(_0x52e13e,0xc9))['catch'](handleError(_0x52e13e,null));};exports[_0xe662('0x22')]=function(_0x1d1c0a,_0x26fe30){if(_0x1d1c0a[_0xe662('0x46')]['id']){delete _0x1d1c0a[_0xe662('0x46')]['id'];}return db[_0xe662('0x2b')]['find']({'where':{'id':_0x1d1c0a[_0xe662('0x50')]['id']}})[_0xe662('0x23')](handleEntityNotFound(_0x26fe30,null))['then'](saveUpdates(_0x1d1c0a[_0xe662('0x46')],null))[_0xe662('0x23')](respondWithResult(_0x26fe30,null))[_0xe662('0x43')](handleError(_0x26fe30,null));};exports[_0xe662('0x24')]=function(_0xdcb24b,_0x5740a3){return db[_0xe662('0x2b')]['find']({'where':{'id':_0xdcb24b['params']['id']}})['then'](handleEntityNotFound(_0x5740a3,null))['then'](removeEntity(_0x5740a3,null))[_0xe662('0x43')](handleError(_0x5740a3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6d06658..8ff9b69 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x241b65,_0x308473){var _0x147013=function(_0x8930c2){while(--_0x8930c2){_0x241b65['push'](_0x241b65['shift']());}};_0x147013(++_0x308473);}(_0x53ec,0x192));var _0xc53e=function(_0x2aa47b,_0x2d19f0){_0x2aa47b=_0x2aa47b-0x0;var _0x4b05d5=_0x53ec[_0x2aa47b];return _0x4b05d5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'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 3df2f4e..6c20f8d 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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x483b9c,_0x2adf61){var _0x5a6d50=function(_0x48aee0){while(--_0x48aee0){_0x483b9c['push'](_0x483b9c['shift']());}};_0x5a6d50(++_0x2adf61);}(_0x7a54,0x106));var _0x47a5=function(_0x4884e4,_0x883ea3){_0x4884e4=_0x4884e4-0x0;var _0x1aafdf=_0x7a54[_0x4884e4];return _0x1aafdf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x260e61,_0x325896){var _0x338c5e=function(_0x1ff31b){while(--_0x1ff31b){_0x260e61['push'](_0x260e61['shift']());}};_0x338c5e(++_0x325896);}(_0x7a54,0x106));var _0x47a5=function(_0x37dc2c,_0x2f2907){_0x37dc2c=_0x37dc2c-0x0;var _0x1f27d0=_0x7a54[_0x37dc2c];return _0x1f27d0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ece7390..1298973 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 _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x24de14,_0x880194){var _0x2afa28=function(_0x1fcc45){while(--_0x1fcc45){_0x24de14['push'](_0x24de14['shift']());}};_0x2afa28(++_0x880194);}(_0x55e0,0xdc));var _0x055e=function(_0x192b63,_0x1004c7){_0x192b63=_0x192b63-0x0;var _0x48a225=_0x55e0[_0x192b63];return _0x48a225;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/webhook','webhookGet','/:id','show','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./plugin.controller','isAuthenticated'];(function(_0x518b8c,_0x277365){var _0x2cc8d3=function(_0x3d57d0){while(--_0x3d57d0){_0x518b8c['push'](_0x518b8c['shift']());}};_0x2cc8d3(++_0x277365);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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'),controller[_0x49c4('0xb')]);router['get'](_0x49c4('0xc'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router[_0x49c4('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x49c4('0xe')]);var upload=multer({'storage':multer[_0x49c4('0xf')]({'destination':function(_0x58cad7,_0xb611a1,_0x459d09){_0x459d09(null,path['join'](config['root'],_0x49c4('0x10')));},'filename':function(_0x6d1b08,_0x5487cd,_0x7df3a9){_0x5487cd[_0x49c4('0x11')]=_0x5487cd['originalname'][_0x49c4('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x7df3a9(null,util[_0x49c4('0x13')](_0x49c4('0x14'),path[_0x49c4('0x15')](_0x5487cd[_0x49c4('0x11')],path[_0x49c4('0x16')](_0x5487cd[_0x49c4('0x11')])),Date[_0x49c4('0x17')](),path['extname'](_0x5487cd[_0x49c4('0x11')])));}})});router[_0x49c4('0x18')]('/',upload[_0x49c4('0x19')](_0x49c4('0x1a')),controller[_0x49c4('0x1b')]);router['post'](_0x49c4('0xa'),controller[_0x49c4('0x1c')]);router['put']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x1d')]);router[_0x49c4('0x1e')]('/:id',auth[_0x49c4('0x7')](),controller['delete']);module[_0x49c4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 6a0df99..ab54f3c 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 _0x273e=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x273e,0x66));var _0xe273=function(_0x416e6a,_0x102b77){_0x416e6a=_0x416e6a-0x0;var _0x523f0c=_0x273e[_0x416e6a];return _0x523f0c;};'use strict';var Sequelize=require(_0xe273('0x0'));module[_0xe273('0x1')]={'name':{'type':Sequelize[_0xe273('0x2')]},'type':{'type':Sequelize[_0xe273('0x3')](_0xe273('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xe273('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe273('0x6')},'sidebar':{'type':Sequelize[_0xe273('0x3')](_0xe273('0x7'),_0xe273('0x8'),_0xe273('0x9'),_0xe273('0xa')),'defaultValue':_0xe273('0x9'),'comment':_0xe273('0xb')},'icon':{'type':Sequelize[_0xe273('0x2')]},'adminUrl':{'type':Sequelize[_0xe273('0x2')]},'agentUrl':{'type':Sequelize[_0xe273('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xe273('0x2')]}}; \ No newline at end of file +var _0x8334=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never'];(function(_0x350019,_0x2121a3){var _0x4fc9df=function(_0x3fc2bf){while(--_0x3fc2bf){_0x350019['push'](_0x350019['shift']());}};_0x4fc9df(++_0x2121a3);}(_0x8334,0xde));var _0x4833=function(_0x489bfa,_0x229c3f){_0x489bfa=_0x489bfa-0x0;var _0xf09f79=_0x8334[_0x489bfa];return _0xf09f79;};'use strict';var Sequelize=require(_0x4833('0x0'));module[_0x4833('0x1')]={'name':{'type':Sequelize[_0x4833('0x2')]},'type':{'type':Sequelize[_0x4833('0x3')]('html',_0x4833('0x4'))},'description':{'type':Sequelize[_0x4833('0x5')]},'version':{'type':Sequelize[_0x4833('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x4833('0x6')},'active':{'type':Sequelize[_0x4833('0x7')],'defaultValue':0x0,'comment':_0x4833('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x4833('0x9'),'agentOnly',_0x4833('0xa'),_0x4833('0xb')),'defaultValue':_0x4833('0xa'),'comment':_0x4833('0xc')},'icon':{'type':Sequelize[_0x4833('0x2')]},'adminUrl':{'type':Sequelize[_0x4833('0x2')]},'agentUrl':{'type':Sequelize[_0x4833('0x2')]},'scriptName':{'type':Sequelize['STRING']},'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 f728f0a..e58c532 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 _0x8c9c=['sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','params','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x8c9c,0x136));var _0xc8c9=function(_0x8a0dfe,_0x25015a){_0x8a0dfe=_0x8a0dfe-0x0;var _0x134296=_0x8c9c[_0x8a0dfe];return _0x134296;};'use strict';var emlformat=require(_0xc8c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8c9('0x2'));var moment=require(_0xc8c9('0x3'));var BPromise=require(_0xc8c9('0x4'));var Mustache=require(_0xc8c9('0x5'));var util=require(_0xc8c9('0x6'));var path=require(_0xc8c9('0x7'));var sox=require('sox');var csv=require(_0xc8c9('0x8'));var ejs=require(_0xc8c9('0x9'));var fs=require('fs');var fs_extra=require(_0xc8c9('0xa'));var _=require('lodash');var squel=require(_0xc8c9('0xb'));var crypto=require(_0xc8c9('0xc'));var jsforce=require(_0xc8c9('0xd'));var deskjs=require(_0xc8c9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc8c9('0xf'));var Papa=require(_0xc8c9('0x10'));var extract=require(_0xc8c9('0x11'));var rimraf=require(_0xc8c9('0x12'));var archiver=require(_0xc8c9('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc8c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8c9('0x15'))(_0xc8c9('0x16'));var utils=require(_0xc8c9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8c9('0x18'));var db=require(_0xc8c9('0x19'))['db'];config[_0xc8c9('0x1a')]=_[_0xc8c9('0x1b')](config['redis'],{'host':_0xc8c9('0x1c'),'port':0x18eb});var socket=require(_0xc8c9('0x1d'))(new Redis(config[_0xc8c9('0x1a')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x48d419,_0x1b178d){_0x1b178d=_0x1b178d||0xcc;return function(_0x1b031e){if(_0x1b031e){return _0x48d419[_0xc8c9('0x1e')](_0x1b178d);}return _0x48d419['status'](_0x1b178d)[_0xc8c9('0x1f')]();};}function respondWithResult(_0x167704,_0x55a4a7){_0x55a4a7=_0x55a4a7||0xc8;return function(_0x4f9600){if(_0x4f9600){return _0x167704[_0xc8c9('0x20')](_0x55a4a7)['json'](_0x4f9600);}};}function respondWithFilteredResult(_0x490b95,_0x2b1ed5){return function(_0x1469d9){if(_0x1469d9){var _0x29f42a=typeof _0x2b1ed5[_0xc8c9('0x21')]===_0xc8c9('0x22')&&typeof _0x2b1ed5[_0xc8c9('0x23')]===_0xc8c9('0x22');var _0x105a58=_0x1469d9[_0xc8c9('0x24')];var _0x1c95bf=_0x29f42a?0x0:_0x2b1ed5[_0xc8c9('0x21')];var _0x4ef6ab=_0x29f42a?_0x1469d9[_0xc8c9('0x24')]:_0x2b1ed5[_0xc8c9('0x21')]+_0x2b1ed5[_0xc8c9('0x23')];var _0x3d1b7c;if(_0x4ef6ab>=_0x105a58){_0x4ef6ab=_0x105a58;_0x3d1b7c=0xc8;}else{_0x3d1b7c=0xce;}_0x490b95[_0xc8c9('0x20')](_0x3d1b7c);return _0x490b95[_0xc8c9('0x25')]('Content-Range',_0x1c95bf+'-'+_0x4ef6ab+'/'+_0x105a58)[_0xc8c9('0x26')](_0x1469d9);}return null;};}function patchUpdates(_0x4605fb){return function(_0x584459){try{jsonpatch[_0xc8c9('0x27')](_0x584459,_0x4605fb,!![]);}catch(_0x1ba51b){return BPromise[_0xc8c9('0x28')](_0x1ba51b);}return _0x584459[_0xc8c9('0x29')]();};}function saveUpdates(_0x1d0407,_0x25ce27){return function(_0x1e9867){if(_0x1e9867){return _0x1e9867[_0xc8c9('0x2a')](_0x1d0407)[_0xc8c9('0x2b')](function(_0x5d9461){return _0x5d9461;});}return null;};}function removeEntity(_0x46720a,_0x1d40ea){return function(_0x4887cf){if(_0x4887cf){return _0x4887cf[_0xc8c9('0x2c')]()['then'](function(){var _0x933134=_0x4887cf[_0xc8c9('0x2d')]({'plain':!![]});var _0x37cf12='Plugins';return db[_0xc8c9('0x2e')][_0xc8c9('0x2c')]({'where':{'type':_0x37cf12,'resourceId':_0x933134['id']}})[_0xc8c9('0x2b')](function(){return _0x4887cf;});})[_0xc8c9('0x2b')](function(){_0x46720a[_0xc8c9('0x20')](0xcc)[_0xc8c9('0x1f')]();});}};}function handleEntityNotFound(_0x5b0fd3,_0xa08b71){return function(_0x26c660){if(!_0x26c660){_0x5b0fd3[_0xc8c9('0x1e')](0x194);}return _0x26c660;};}function handleError(_0x26478a,_0x272b57){_0x272b57=_0x272b57||0x1f4;return function(_0xa2c4f1){logger[_0xc8c9('0x2f')](_0xa2c4f1[_0xc8c9('0x30')]);if(_0xa2c4f1[_0xc8c9('0x31')]){delete _0xa2c4f1[_0xc8c9('0x31')];}_0x26478a['status'](_0x272b57)[_0xc8c9('0x32')](_0xa2c4f1);};}exports['index']=function(_0x4bb793,_0x49bac6){var _0x2cae39={},_0x5cd531={},_0x4bce9a={'count':0x0,'rows':[]};var _0x467048=_[_0xc8c9('0x33')](db[_0xc8c9('0x34')][_0xc8c9('0x35')],function(_0x4ce26b){return{'name':_0x4ce26b['fieldName'],'type':_0x4ce26b[_0xc8c9('0x36')][_0xc8c9('0x37')]};});_0x5cd531[_0xc8c9('0x38')]=_[_0xc8c9('0x33')](_0x467048,_0xc8c9('0x31'));_0x5cd531[_0xc8c9('0x39')]=_[_0xc8c9('0x3a')](_0x4bb793[_0xc8c9('0x39')]);_0x5cd531[_0xc8c9('0x3b')]=_['intersection'](_0x5cd531[_0xc8c9('0x38')],_0x5cd531[_0xc8c9('0x39')]);_0x2cae39['attributes']=_[_0xc8c9('0x3c')](_0x5cd531[_0xc8c9('0x38')],qs[_0xc8c9('0x3d')](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x3d')]));_0x2cae39[_0xc8c9('0x3e')]=_0x2cae39[_0xc8c9('0x3e')][_0xc8c9('0x3f')]?_0x2cae39['attributes']:_0x5cd531[_0xc8c9('0x38')];if(!_0x4bb793['query']['hasOwnProperty'](_0xc8c9('0x40'))){_0x2cae39[_0xc8c9('0x23')]=qs[_0xc8c9('0x23')](_0x4bb793['query'][_0xc8c9('0x23')]);_0x2cae39[_0xc8c9('0x21')]=qs[_0xc8c9('0x21')](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x21')]);}_0x2cae39['order']=qs['sort'](_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x41')]);_0x2cae39['where']=qs['filters'](_['pick'](_0x4bb793['query'],_0x5cd531[_0xc8c9('0x3b')]),_0x467048);if(_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x42')]){_0x2cae39[_0xc8c9('0x43')]=_[_0xc8c9('0x44')](_0x2cae39[_0xc8c9('0x43')],{'$or':_[_0xc8c9('0x33')](_0x467048,function(_0x3e4ef9){if(_0x3e4ef9[_0xc8c9('0x36')]!=='VIRTUAL'){var _0x2c0145={};_0x2c0145[_0x3e4ef9[_0xc8c9('0x31')]]={'$like':'%'+_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x42')]+'%'};return _0x2c0145;}})});}_0x2cae39=_['merge']({},_0x2cae39,_0x4bb793[_0xc8c9('0x45')]);var _0x5d8edc={'where':_0x2cae39[_0xc8c9('0x43')]};return db[_0xc8c9('0x34')][_0xc8c9('0x24')](_0x5d8edc)[_0xc8c9('0x2b')](function(_0xaee9ec){_0x4bce9a['count']=_0xaee9ec;if(_0x4bb793[_0xc8c9('0x39')][_0xc8c9('0x46')]){_0x2cae39[_0xc8c9('0x47')]=[{'all':!![]}];}return db[_0xc8c9('0x34')][_0xc8c9('0x48')](_0x2cae39);})[_0xc8c9('0x2b')](function(_0xb91bfa){_0x4bce9a[_0xc8c9('0x49')]=_0xb91bfa;return _0x4bce9a;})['then'](respondWithFilteredResult(_0x49bac6,_0x2cae39))[_0xc8c9('0x4a')](handleError(_0x49bac6,null));};exports['show']=function(_0x3845c9,_0x110b75){var _0x23c612={'raw':!![],'where':{'id':_0x3845c9['params']['id']}},_0x5e09ea={};_0x5e09ea[_0xc8c9('0x38')]=_[_0xc8c9('0x3a')](db['Plugin']['rawAttributes']);_0x5e09ea[_0xc8c9('0x39')]=_['keys'](_0x3845c9['query']);_0x5e09ea[_0xc8c9('0x3b')]=_[_0xc8c9('0x3c')](_0x5e09ea[_0xc8c9('0x38')],_0x5e09ea[_0xc8c9('0x39')]);_0x23c612[_0xc8c9('0x3e')]=_['intersection'](_0x5e09ea['model'],qs[_0xc8c9('0x3d')](_0x3845c9[_0xc8c9('0x39')][_0xc8c9('0x3d')]));_0x23c612[_0xc8c9('0x3e')]=_0x23c612[_0xc8c9('0x3e')][_0xc8c9('0x3f')]?_0x23c612[_0xc8c9('0x3e')]:_0x5e09ea[_0xc8c9('0x38')];if(_0x3845c9[_0xc8c9('0x39')][_0xc8c9('0x46')]){_0x23c612[_0xc8c9('0x47')]=[{'all':!![]}];}_0x23c612=_[_0xc8c9('0x44')]({},_0x23c612,_0x3845c9[_0xc8c9('0x45')]);return db[_0xc8c9('0x34')][_0xc8c9('0x4b')](_0x23c612)['then'](handleEntityNotFound(_0x110b75,null))['then'](respondWithResult(_0x110b75,null))['catch'](handleError(_0x110b75,null));};exports['download']=function(_0x3eba49,_0x33ec18,_0x5e9c97){return db[_0xc8c9('0x34')]['find']({'where':{'id':_0x3eba49['params']['id']},'attributes':[_0xc8c9('0x31'),_0xc8c9('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x33ec18,null))['then'](function(_0x50083c){if(_0x50083c){var _0x3c4612=path[_0xc8c9('0x4c')](config[_0xc8c9('0x4d')],_0xc8c9('0x4e'),util[_0xc8c9('0x4f')](_0xc8c9('0x50'),path[_0xc8c9('0x51')](_0x50083c[_0xc8c9('0x7')])));var _0x4489c8=fs[_0xc8c9('0x52')](_0x3c4612);var _0x77293b=archiver('zip',{'zlib':{'level':0x9}});_0x77293b['on'](_0xc8c9('0x53'),function(_0x5100d6){if(_0x5100d6['code']===_0xc8c9('0x54')){logger[_0xc8c9('0x2f')](_0x5100d6);}else{throw new db[(_0xc8c9('0x55'))][(_0xc8c9('0x56'))](_0xc8c9('0x57'));}});_0x77293b['on'](_0xc8c9('0x2f'),function(_0x1f1ac3){throw new db[(_0xc8c9('0x55'))]['Error'](_0xc8c9('0x57'));});_0x77293b['pipe'](_0x4489c8);_0x77293b[_0xc8c9('0x58')](_0xc8c9('0x59'),{'cwd':path['join'](config[_0xc8c9('0x4d')],'server/files/plugins',path[_0xc8c9('0x5a')](_0x50083c[_0xc8c9('0x7')])),'ignore':[path[_0xc8c9('0x4c')](path[_0xc8c9('0x51')](_0x50083c[_0xc8c9('0x7')]),_0xc8c9('0x5b')),path[_0xc8c9('0x4c')](path['basename'](_0x50083c[_0xc8c9('0x7')]),_0xc8c9('0x5c'))],'nodir':!![]})[_0xc8c9('0x5d')]();_0x4489c8['on'](_0xc8c9('0x5e'),function(){if(!fs[_0xc8c9('0x5f')](_0x3c4612)){throw new db[(_0xc8c9('0x55'))][(_0xc8c9('0x56'))](_0xc8c9('0x60'));}return _0x33ec18['download'](_0x3c4612,util[_0xc8c9('0x4f')](_0xc8c9('0x50'),path['basename'](_0x50083c['path'])),function(_0x11bfd7){if(_0x11bfd7){throw new db['Sequelize'][(_0xc8c9('0x56'))](_0xc8c9('0x61'));}fs[_0xc8c9('0x62')](_0x3c4612);logger[_0xc8c9('0x63')](_0xc8c9('0x64'));logger[_0xc8c9('0x63')](_0xc8c9('0x65'));});});}return null;})[_0xc8c9('0x4a')](handleError(_0x33ec18,null));};exports['upload']=function(_0x25378d,_0x274c5f,_0x34e77c){var _0x13adc0=path[_0xc8c9('0x51')](_0x25378d[_0xc8c9('0x66')]['filename'],path[_0xc8c9('0x67')](_0x25378d[_0xc8c9('0x66')][_0xc8c9('0x68')]));var _0x5e1871=path['join'](config['root'],_0xc8c9('0x4e'),_0x25378d['file'][_0xc8c9('0x68')]);var _0x5591d5=path['join'](config[_0xc8c9('0x4d')],'server/files/plugins',_0x13adc0);logger[_0xc8c9('0x63')](_0xc8c9('0x69'),_0x5e1871);logger['info'](_0xc8c9('0x6a'),_0x5591d5);try{fs[_0xc8c9('0x6b')](_0x5e1871,parseInt(_0xc8c9('0x6c'),0x8));extract(_0x5e1871,{'dir':_0x5591d5},function(_0x1efe2b){if(_0x1efe2b){logger['error'](_0x1efe2b);handleError(_0x1efe2b,!![]);};var _0xa8765f=fs[_0xc8c9('0x6d')](_0x5591d5);if(_0xa8765f[_0xc8c9('0x3f')]>0x1){removeReferences(_0x5e1871,_0x5591d5);logger['error']('Invalid\x20plugin\x20structure');return _0x34e77c(new Error(_0xc8c9('0x6e')));}var _0x512d67=fs[_0xc8c9('0x6f')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0]));if(_0x512d67[_0xc8c9('0x70')]()){removeReferences(_0x5e1871,_0x5591d5);logger[_0xc8c9('0x2f')](_0xc8c9('0x6e'));return _0x34e77c(new Error(_0xc8c9('0x6e')));}if(_0x512d67[_0xc8c9('0x71')]()){var _0x252a6e=fs[_0xc8c9('0x6d')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0]));if(_0x252a6e[_0xc8c9('0x3f')]===0x0){removeReferences(_0x5e1871,_0x5591d5);logger['error'](_0xc8c9('0x6e'));return _0x34e77c(new Error('Invalid\x20plugin\x20structure'));}var _0x31c796=_0x252a6e['some'](function(_0xec34b6){return _0xec34b6===_0xc8c9('0x72');});if(!_0x31c796){return _0x34e77c(new Error(_0xc8c9('0x73')));}var _0x302039=fs[_0xc8c9('0x74')](path[_0xc8c9('0x4c')](_0x5591d5,_0xa8765f[0x0],_0xc8c9('0x72')));var _0x4685d1=JSON[_0xc8c9('0x75')](_0x302039);if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x31')]){return _0x34e77c(new Error(_0xc8c9('0x76')));}if(_0xc8c9('0x22')==typeof _0x4685d1['type']){return _0x34e77c(new Error(_0xc8c9('0x77')));}if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x78')]){return _0x34e77c(new Error(_0xc8c9('0x79')));}if(_0xc8c9('0x22')==typeof _0x4685d1['parameters']){return _0x34e77c(new Error(_0xc8c9('0x7a')));}if(_0x4685d1[_0xc8c9('0x36')]==='html'){if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]){return _0x34e77c(new Error(_0xc8c9('0x7d')));}if(_0xc8c9('0x22')==typeof _0x4685d1['parameters'][_0xc8c9('0x7c')][_0xc8c9('0x7e')]&&'undefined'==typeof _0x4685d1[_0xc8c9('0x7b')]['views'][_0xc8c9('0x7f')]){return _0x34e77c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4685d1[_0xc8c9('0x36')]===_0xc8c9('0x80')){if(_0xc8c9('0x22')==typeof _0x4685d1['parameters'][_0xc8c9('0x81')]){return _0x34e77c(new Error(_0xc8c9('0x82')));}if(_0xc8c9('0x22')==typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x83')]){return _0x34e77c(new Error(_0xc8c9('0x84')));}}else{return _0x34e77c(new Error(_0xc8c9('0x85')));}var _0x3e9b9d=_0x4685d1[_0xc8c9('0x31')];var _0x594efc=_0x4685d1[_0xc8c9('0x86')];var _0x4e888b=_0x4685d1[_0xc8c9('0x36')];var _0x534386=_0x4685d1[_0xc8c9('0x87')]?_0x4685d1['sidebar']:_0xc8c9('0x88');var _0x46f237=_0x4685d1[_0xc8c9('0x89')]?_0x4685d1[_0xc8c9('0x89')]:'icon-apps';var _0x572833='';var _0x4f3b29='';var _0x4b2b93='';var _0x4c0501='';var _0x1831d6=_0x4685d1[_0xc8c9('0x78')];if(_0x4e888b==='html'){if(_0xc8c9('0x22')!=typeof _0x4685d1[_0xc8c9('0x7b')]['views'][_0xc8c9('0x7e')]){var _0x258e34=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x258e34)){_0x572833=path['join'](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x258e34);}else{_0x572833=_0x258e34;}}else{logger['info'](_0xc8c9('0x8c'));}if('undefined'!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7f')]){var _0x269ae3=_0x4685d1['parameters'][_0xc8c9('0x7c')][_0xc8c9('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x269ae3)){_0x4f3b29=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x269ae3);}else{_0x4f3b29=_0x269ae3;}}else{logger[_0xc8c9('0x63')](_0xc8c9('0x8d'));}}else if(_0x4e888b===_0xc8c9('0x80')){_0x4b2b93=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x81')];_0x4c0501=_0x4685d1['parameters'][_0xc8c9('0x83')];if('undefined'!=typeof _0x4685d1['parameters']['views']){if(_0xc8c9('0x22')!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['admin']){var _0x258e34=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')][_0xc8c9('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x258e34)){_0x572833=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x258e34);}else{_0x572833=_0x258e34;}}if('undefined'!=typeof _0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['agent']){var _0x269ae3=_0x4685d1[_0xc8c9('0x7b')][_0xc8c9('0x7c')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc8c9('0x8a')](_0x269ae3)){_0x4f3b29=path[_0xc8c9('0x4c')](_0xc8c9('0x8b'),_0x13adc0,_0xa8765f[0x0],_0x269ae3);}else{_0x4f3b29=_0x269ae3;}}}}var _0x309ccc={'name':_0x3e9b9d,'description':_0x594efc,'path':path[_0xc8c9('0x4c')](_0x13adc0,_0xa8765f[0x0]),'type':_0x4e888b,'sidebar':_0x534386,'icon':_0x46f237,'adminUrl':_0x572833,'agentUrl':_0x4f3b29,'scriptName':_0x4b2b93,'scriptPath':_0x4c0501,'version':_0x1831d6};removeReferences(_0x5e1871,null);return db[_0xc8c9('0x34')][_0xc8c9('0x8e')](_0x309ccc)[_0xc8c9('0x2b')](function(_0x12daed){var _0x3489b2={'role':_0x25378d['body'][_0xc8c9('0x8f')],'userProfileId':_0x25378d[_0xc8c9('0x90')][_0xc8c9('0x91')]};if(!_0x3489b2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3489b2[_0xc8c9('0x8f')]===_0xc8c9('0x92')){var _0xf24161=_0x12daed[_0xc8c9('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0xc8c9('0x4b')]({'where':{'name':_0xc8c9('0x93'),'userProfileId':_0x3489b2['userProfileId']},'raw':!![]})[_0xc8c9('0x2b')](function(_0x28a31d){if(_0x28a31d&&_0x28a31d[_0xc8c9('0x94')]===0x0){return db[_0xc8c9('0x2e')][_0xc8c9('0x8e')]({'name':_0xf24161[_0xc8c9('0x31')],'resourceId':_0xf24161['id'],'type':_0x28a31d['name'],'sectionId':_0x28a31d['id']},{})['then'](function(){return _0x12daed;});}else{return _0x12daed;}})['catch'](function(_0x466c8d){logger[_0xc8c9('0x2f')](_0xc8c9('0x95'),_0x466c8d);throw _0x466c8d;});}return _0x12daed;})[_0xc8c9('0x2b')](respondWithResult(_0x274c5f,null))[_0xc8c9('0x4a')](handleError(_0x274c5f,null));}});}catch(_0x5d2934){_0x274c5f[_0xc8c9('0x20')](0x1f4)[_0xc8c9('0x32')](_0x5d2934);}};function removeReferences(_0x815b4b,_0x1ea471){try{if(_0x815b4b){fs[_0xc8c9('0x62')](_0x815b4b);logger[_0xc8c9('0x63')]('Zip\x20archive\x20removed');}if(_0x1ea471){rimraf(_0x1ea471,function(){});logger[_0xc8c9('0x63')](_0xc8c9('0x96'));}}catch(_0x590aeb){logger[_0xc8c9('0x2f')](_0x590aeb);}}exports[_0xc8c9('0x2a')]=function(_0x592af1,_0x531cfe,_0x4c2139){return db[_0xc8c9('0x34')][_0xc8c9('0x4b')]({'where':{'id':_0x592af1[_0xc8c9('0x97')]['id']}})[_0xc8c9('0x2b')](handleEntityNotFound(_0x531cfe,null))[_0xc8c9('0x2b')](saveUpdates(_0x592af1[_0xc8c9('0x90')],null))[_0xc8c9('0x2b')](respondWithResult(_0x531cfe,null))[_0xc8c9('0x4a')](handleError(_0x531cfe,null));};exports[_0xc8c9('0x98')]=function(_0x2a3442,_0x1cc3db,_0x135f23){return db['Plugin'][_0xc8c9('0x4b')]({'where':{'id':_0x2a3442['params']['id']}})[_0xc8c9('0x2b')](function(_0x4b56af){if(_0x4b56af){return _0x4b56af['destroy']();}})['then'](function(_0x11e075){rimraf(path[_0xc8c9('0x4c')](config[_0xc8c9('0x4d')],'server/files/plugins',path[_0xc8c9('0x5a')](_0x11e075[_0xc8c9('0x7')])),function(){});return _0x11e075;})[_0xc8c9('0x2b')](handleEntityNotFound(_0x1cc3db,null))[_0xc8c9('0x2b')](respondWithStatusCode(_0x1cc3db,null))['catch'](handleError(_0x1cc3db,null));};exports[_0xc8c9('0x99')]=function(_0x257a3d,_0x3de673,_0x1b2943){return BPromise[_0xc8c9('0x9a')]()['then'](function(){if(!_0x257a3d[_0xc8c9('0x39')]['path']){throw new Error(_0xc8c9('0x9b'));}if(!_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9c')]){throw new Error(_0xc8c9('0x9d'));}var _0x3256fc=_0x257a3d['query'][_0xc8c9('0x9e')]?_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9e')]+':'+_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x9c')]:_0xc8c9('0x9f')+_0x257a3d['query']['port'];var _0x44e9a7=_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x26')]?_0x257a3d[_0xc8c9('0x39')]['json']:!![];var _0xc44200=_0x257a3d['query'][_0xc8c9('0xa0')]?_0x257a3d[_0xc8c9('0x39')]['encoding']:null;var _0x53e323={'method':_0x257a3d[_0xc8c9('0xa1')],'uri':util[_0xc8c9('0x4f')](_0xc8c9('0xa2'),_0x3256fc,_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x7')]),'json':_0x44e9a7,'resolveWithFullResponse':!![],'encoding':_0xc44200,'qs':_0x257a3d['query']};if(_0x257a3d[_0xc8c9('0xa3')]){_0x53e323['headers']=_0x257a3d[_0xc8c9('0xa3')];if(_0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa4')]){delete _0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa4')];}}if(_0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa5')]){delete _0x53e323[_0xc8c9('0xa3')][_0xc8c9('0xa5')];}return rp(_0x53e323);})[_0xc8c9('0x2b')](function(_0x26cd61){if(_0x26cd61){_0x3de673[_0xc8c9('0x25')](_0x26cd61[_0xc8c9('0xa3')]);logger['info'](_0x26cd61[_0xc8c9('0x90')]);if(_[_0xc8c9('0xa6')](_0x257a3d[_0xc8c9('0x39')][_0xc8c9('0x7')],_0xc8c9('0xa7'))&&_0x26cd61[_0xc8c9('0xa8')]==0x1f4){return _0x3de673[_0xc8c9('0x1e')](_0x26cd61[_0xc8c9('0xa8')]);}else{return _0x3de673[_0xc8c9('0x20')](_0x26cd61['statusCode'])[_0xc8c9('0x32')](_0x26cd61[_0xc8c9('0x90')]);}}else{return _0x3de673['sendStatus'](0xc8);}})[_0xc8c9('0x4a')](handleError(_0x3de673,null));};exports[_0xc8c9('0xa9')]=function(_0x5ec498,_0x5e150c,_0x348bbb){return BPromise[_0xc8c9('0x9a')]()[_0xc8c9('0x2b')](function(){if(!_0x5ec498['query']['path']){throw new Error(_0xc8c9('0x9b'));}if(!_0x5ec498[_0xc8c9('0x39')]['port']){throw new Error(_0xc8c9('0x9d'));}var _0x1708ca=_0x5ec498[_0xc8c9('0x39')]['hostname']?_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x9e')]+':'+_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x9c')]:_0xc8c9('0x9f')+_0x5ec498[_0xc8c9('0x39')]['port'];var _0x16ab0b=_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x26')]?_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0x26')]:!![];var _0x43cf63=_0x5ec498[_0xc8c9('0x39')][_0xc8c9('0xa0')]?_0x5ec498[_0xc8c9('0x39')]['encoding']:null;var _0x502ec1={'method':_0x5ec498['method'],'uri':util[_0xc8c9('0x4f')](_0xc8c9('0xa2'),_0x1708ca,_0x5ec498['query'][_0xc8c9('0x7')]),'json':_0x16ab0b,'resolveWithFullResponse':!![],'encoding':_0x43cf63,'body':_0x5ec498[_0xc8c9('0x90')]};if(_0x5ec498[_0xc8c9('0xa3')]){_0x502ec1[_0xc8c9('0xa3')]=_0x5ec498[_0xc8c9('0xa3')];if(_0x502ec1['headers']['content-length']){delete _0x502ec1[_0xc8c9('0xa3')][_0xc8c9('0xa4')];}}if(_0x502ec1[_0xc8c9('0xa3')]['content-type']){delete _0x502ec1[_0xc8c9('0xa3')][_0xc8c9('0xa5')];}return rp(_0x502ec1);})[_0xc8c9('0x2b')](function(_0x2fe052){if(_0x2fe052){_0x5e150c['set'](_0x2fe052[_0xc8c9('0xa3')]);logger[_0xc8c9('0x63')](_0x2fe052[_0xc8c9('0x90')]);return _0x5e150c[_0xc8c9('0x20')](_0x2fe052['statusCode'])['send'](_0x2fe052[_0xc8c9('0x90')]);}else{return _0x5e150c[_0xc8c9('0x1e')](0xc8);}})[_0xc8c9('0x4a')](handleError(_0x5e150c,null));}; \ No newline at end of file +var _0x68b7=['redis','defaults','socket.io-emitter','./plugin.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','end','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','download','root','%s.zip','basename','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','**/*','server/files/plugins','dirname','node_modules/**/*','join','attachments/**/*','close','existsSync','format','unlinkSync','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','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','icon-apps','version','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','endsWith','statusCode','webhookPost','%s%s','content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1431cd,_0x1f1b30){var _0x13968a=function(_0x500449){while(--_0x500449){_0x1431cd['push'](_0x1431cd['shift']());}};_0x13968a(++_0x1f1b30);}(_0x68b7,0x94));var _0x768b=function(_0x8bdbf0,_0x235b62){_0x8bdbf0=_0x8bdbf0-0x0;var _0x1cc12d=_0x68b7[_0x8bdbf0];return _0x1cc12d;};'use strict';var emlformat=require(_0x768b('0x0'));var rimraf=require(_0x768b('0x1'));var zipdir=require(_0x768b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x768b('0x3'));var moment=require(_0x768b('0x4'));var BPromise=require(_0x768b('0x5'));var Mustache=require(_0x768b('0x6'));var util=require(_0x768b('0x7'));var path=require(_0x768b('0x8'));var sox=require(_0x768b('0x9'));var csv=require(_0x768b('0xa'));var ejs=require(_0x768b('0xb'));var fs=require('fs');var fs_extra=require(_0x768b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x768b('0xd'));var jsforce=require(_0x768b('0xe'));var deskjs=require(_0x768b('0xf'));var toCsv=require(_0x768b('0xa'));var querystring=require(_0x768b('0x10'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x768b('0x1'));var archiver=require(_0x768b('0x11'));var Redis=require(_0x768b('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x768b('0x13'));var hardwareService=require(_0x768b('0x14'));var logger=require(_0x768b('0x15'))(_0x768b('0x16'));var utils=require(_0x768b('0x17'));var config=require(_0x768b('0x18'));var licenseUtil=require(_0x768b('0x19'));var db=require(_0x768b('0x1a'))['db'];config[_0x768b('0x1b')]=_[_0x768b('0x1c')](config[_0x768b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x768b('0x1d'))(new Redis(config[_0x768b('0x1b')]));require(_0x768b('0x1e'))[_0x768b('0x1f')](socket);function respondWithStatusCode(_0x5aea1d,_0x185f84){_0x185f84=_0x185f84||0xcc;return function(_0x8dade8){if(_0x8dade8){return _0x5aea1d['sendStatus'](_0x185f84);}return _0x5aea1d[_0x768b('0x20')](_0x185f84)['end']();};}function respondWithResult(_0x4232d2,_0x4a602b){_0x4a602b=_0x4a602b||0xc8;return function(_0x20b975){if(_0x20b975){return _0x4232d2[_0x768b('0x20')](_0x4a602b)[_0x768b('0x21')](_0x20b975);}};}function respondWithFilteredResult(_0x36459c,_0x1ef75e){return function(_0x20262c){if(_0x20262c){var _0x23bf6e=typeof _0x1ef75e[_0x768b('0x22')]===_0x768b('0x23')&&typeof _0x1ef75e[_0x768b('0x24')]===_0x768b('0x23');var _0x32de5a=_0x20262c[_0x768b('0x25')];var _0xf5ee=_0x23bf6e?0x0:_0x1ef75e['offset'];var _0x497f66=_0x23bf6e?_0x20262c[_0x768b('0x25')]:_0x1ef75e[_0x768b('0x22')]+_0x1ef75e[_0x768b('0x24')];var _0x5cb428;if(_0x497f66>=_0x32de5a){_0x497f66=_0x32de5a;_0x5cb428=0xc8;}else{_0x5cb428=0xce;}_0x36459c[_0x768b('0x20')](_0x5cb428);return _0x36459c[_0x768b('0x26')](_0x768b('0x27'),_0xf5ee+'-'+_0x497f66+'/'+_0x32de5a)['json'](_0x20262c);}return null;};}function patchUpdates(_0xf832bb){return function(_0x324ce2){try{jsonpatch[_0x768b('0x28')](_0x324ce2,_0xf832bb,!![]);}catch(_0x1fa281){return BPromise['reject'](_0x1fa281);}return _0x324ce2[_0x768b('0x29')]();};}function saveUpdates(_0x152bce,_0x41589b){return function(_0x1109fc){if(_0x1109fc){return _0x1109fc[_0x768b('0x2a')](_0x152bce)[_0x768b('0x2b')](function(_0x1c0d67){return _0x1c0d67;});}return null;};}function removeEntity(_0x43dd87,_0x77ebbc){return function(_0x42827c){if(_0x42827c){return _0x42827c[_0x768b('0x2c')]()['then'](function(){var _0x5f0e71=_0x42827c[_0x768b('0x2d')]({'plain':!![]});var _0x394240=_0x768b('0x2e');return db[_0x768b('0x2f')]['destroy']({'where':{'type':_0x394240,'resourceId':_0x5f0e71['id']}})[_0x768b('0x2b')](function(){return _0x42827c;});})[_0x768b('0x2b')](function(){_0x43dd87[_0x768b('0x20')](0xcc)[_0x768b('0x30')]();});}};}function handleEntityNotFound(_0x1f92cd,_0x5a2bc9){return function(_0xd88c47){if(!_0xd88c47){_0x1f92cd[_0x768b('0x31')](0x194);}return _0xd88c47;};}function handleError(_0x36e83d,_0xf2678f){_0xf2678f=_0xf2678f||0x1f4;return function(_0x44015d){logger[_0x768b('0x32')](_0x44015d[_0x768b('0x33')]);if(_0x44015d[_0x768b('0x34')]){delete _0x44015d[_0x768b('0x34')];}_0x36e83d[_0x768b('0x20')](_0xf2678f)[_0x768b('0x35')](_0x44015d);};}exports[_0x768b('0x36')]=function(_0x342e30,_0x7021b1){var _0x12cbb0={},_0x13dcae={},_0x30cddc={'count':0x0,'rows':[]};var _0x4f24e7=_['map'](db[_0x768b('0x37')][_0x768b('0x38')],function(_0x5a69b3){return{'name':_0x5a69b3[_0x768b('0x39')],'type':_0x5a69b3[_0x768b('0x3a')][_0x768b('0x3b')]};});_0x13dcae[_0x768b('0x3c')]=_[_0x768b('0x3d')](_0x4f24e7,'name');_0x13dcae[_0x768b('0x3e')]=_[_0x768b('0x3f')](_0x342e30[_0x768b('0x3e')]);_0x13dcae[_0x768b('0x40')]=_[_0x768b('0x41')](_0x13dcae[_0x768b('0x3c')],_0x13dcae[_0x768b('0x3e')]);_0x12cbb0[_0x768b('0x42')]=_[_0x768b('0x41')](_0x13dcae[_0x768b('0x3c')],qs[_0x768b('0x43')](_0x342e30[_0x768b('0x3e')]['fields']));_0x12cbb0[_0x768b('0x42')]=_0x12cbb0[_0x768b('0x42')]['length']?_0x12cbb0[_0x768b('0x42')]:_0x13dcae[_0x768b('0x3c')];if(!_0x342e30[_0x768b('0x3e')][_0x768b('0x44')](_0x768b('0x45'))){_0x12cbb0['limit']=qs[_0x768b('0x24')](_0x342e30[_0x768b('0x3e')][_0x768b('0x24')]);_0x12cbb0[_0x768b('0x22')]=qs[_0x768b('0x22')](_0x342e30[_0x768b('0x3e')]['offset']);}_0x12cbb0[_0x768b('0x46')]=qs[_0x768b('0x47')](_0x342e30[_0x768b('0x3e')][_0x768b('0x47')]);_0x12cbb0[_0x768b('0x48')]=qs[_0x768b('0x40')](_[_0x768b('0x49')](_0x342e30[_0x768b('0x3e')],_0x13dcae[_0x768b('0x40')]),_0x4f24e7);if(_0x342e30[_0x768b('0x3e')][_0x768b('0x4a')]){_0x12cbb0[_0x768b('0x48')]=_['merge'](_0x12cbb0[_0x768b('0x48')],{'$or':_[_0x768b('0x3d')](_0x4f24e7,function(_0x10ab5f){if(_0x10ab5f[_0x768b('0x3a')]!==_0x768b('0x4b')){var _0x14dcda={};_0x14dcda[_0x10ab5f[_0x768b('0x34')]]={'$like':'%'+_0x342e30[_0x768b('0x3e')][_0x768b('0x4a')]+'%'};return _0x14dcda;}})});}_0x12cbb0=_[_0x768b('0x4c')]({},_0x12cbb0,_0x342e30[_0x768b('0x4d')]);var _0x5c3bf2={'where':_0x12cbb0['where']};return db['Plugin']['count'](_0x5c3bf2)[_0x768b('0x2b')](function(_0x7a0288){_0x30cddc[_0x768b('0x25')]=_0x7a0288;if(_0x342e30[_0x768b('0x3e')][_0x768b('0x4e')]){_0x12cbb0[_0x768b('0x4f')]=[{'all':!![]}];}return db[_0x768b('0x37')][_0x768b('0x50')](_0x12cbb0);})[_0x768b('0x2b')](function(_0x154a74){_0x30cddc[_0x768b('0x51')]=_0x154a74;return _0x30cddc;})[_0x768b('0x2b')](respondWithFilteredResult(_0x7021b1,_0x12cbb0))[_0x768b('0x52')](handleError(_0x7021b1,null));};exports[_0x768b('0x53')]=function(_0x55db3d,_0x5095fa){var _0x373221={'raw':!![],'where':{'id':_0x55db3d[_0x768b('0x54')]['id']}},_0x3206b5={};_0x3206b5[_0x768b('0x3c')]=_[_0x768b('0x3f')](db['Plugin'][_0x768b('0x38')]);_0x3206b5[_0x768b('0x3e')]=_[_0x768b('0x3f')](_0x55db3d[_0x768b('0x3e')]);_0x3206b5['filters']=_[_0x768b('0x41')](_0x3206b5['model'],_0x3206b5['query']);_0x373221['attributes']=_['intersection'](_0x3206b5[_0x768b('0x3c')],qs[_0x768b('0x43')](_0x55db3d[_0x768b('0x3e')]['fields']));_0x373221[_0x768b('0x42')]=_0x373221[_0x768b('0x42')][_0x768b('0x55')]?_0x373221[_0x768b('0x42')]:_0x3206b5['model'];if(_0x55db3d[_0x768b('0x3e')][_0x768b('0x4e')]){_0x373221[_0x768b('0x4f')]=[{'all':!![]}];}_0x373221=_[_0x768b('0x4c')]({},_0x373221,_0x55db3d[_0x768b('0x4d')]);return db['Plugin'][_0x768b('0x56')](_0x373221)['then'](handleEntityNotFound(_0x5095fa,null))[_0x768b('0x2b')](respondWithResult(_0x5095fa,null))[_0x768b('0x52')](handleError(_0x5095fa,null));};exports[_0x768b('0x57')]=function(_0x19eebf,_0x5b0cbf,_0x2e622c){return db[_0x768b('0x37')][_0x768b('0x56')]({'where':{'id':_0x19eebf[_0x768b('0x54')]['id']},'attributes':[_0x768b('0x34'),'path'],'raw':!![]})[_0x768b('0x2b')](handleEntityNotFound(_0x5b0cbf,null))[_0x768b('0x2b')](function(_0x43029c){if(_0x43029c){var _0x1418c9=path['join'](config[_0x768b('0x58')],'server/files/plugins',util['format'](_0x768b('0x59'),path[_0x768b('0x5a')](_0x43029c[_0x768b('0x8')])));var _0x13f34b=fs['createWriteStream'](_0x1418c9);var _0x3896d3=archiver('zip',{'zlib':{'level':0x9}});_0x3896d3['on'](_0x768b('0x5b'),function(_0x589de7){if(_0x589de7[_0x768b('0x5c')]===_0x768b('0x5d')){logger[_0x768b('0x32')](_0x589de7);}else{throw new db[(_0x768b('0x5e'))]['Error'](_0x768b('0x5f'));}});_0x3896d3['on'](_0x768b('0x32'),function(_0x4ea82f){throw new db['Sequelize'][(_0x768b('0x60'))](_0x768b('0x5f'));});_0x3896d3[_0x768b('0x61')](_0x13f34b);_0x3896d3['glob'](_0x768b('0x62'),{'cwd':path['join'](config[_0x768b('0x58')],_0x768b('0x63'),path[_0x768b('0x64')](_0x43029c[_0x768b('0x8')])),'ignore':[path['join'](path['basename'](_0x43029c[_0x768b('0x8')]),_0x768b('0x65')),path[_0x768b('0x66')](path[_0x768b('0x5a')](_0x43029c[_0x768b('0x8')]),_0x768b('0x67'))],'nodir':!![]})['finalize']();_0x13f34b['on'](_0x768b('0x68'),function(){if(!fs[_0x768b('0x69')](_0x1418c9)){throw new db['Sequelize'][(_0x768b('0x60'))]('Plugin\x20not\x20found');}return _0x5b0cbf[_0x768b('0x57')](_0x1418c9,util[_0x768b('0x6a')](_0x768b('0x59'),path[_0x768b('0x5a')](_0x43029c[_0x768b('0x8')])),function(_0x4ac4a8){if(_0x4ac4a8){throw new db[(_0x768b('0x5e'))][(_0x768b('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x768b('0x6b')](_0x1418c9);logger[_0x768b('0x6c')](_0x768b('0x6d'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x768b('0x52')](handleError(_0x5b0cbf,null));};exports[_0x768b('0x6e')]=function(_0x487c5c,_0x5a1a5,_0x3b0674){var _0x19e977=path[_0x768b('0x5a')](_0x487c5c[_0x768b('0x6f')][_0x768b('0x70')],path[_0x768b('0x71')](_0x487c5c['file'][_0x768b('0x70')]));var _0x1dcc26=path[_0x768b('0x66')](config['root'],'server/files/plugins',_0x487c5c['file'][_0x768b('0x70')]);var _0x674b52=path[_0x768b('0x66')](config[_0x768b('0x58')],_0x768b('0x63'),_0x19e977);logger[_0x768b('0x6c')](_0x768b('0x72'),_0x1dcc26);logger[_0x768b('0x6c')]('Plugin\x20upload\x20destination:\x20%s',_0x674b52);try{fs['chmodSync'](_0x1dcc26,parseInt(_0x768b('0x73'),0x8));extract(_0x1dcc26,{'dir':_0x674b52},function(_0x1ffa65){if(_0x1ffa65){logger[_0x768b('0x32')](_0x1ffa65);handleError(_0x1ffa65,!![]);};var _0x426f6c=fs[_0x768b('0x74')](_0x674b52);if(_0x426f6c[_0x768b('0x55')]>0x1){removeReferences(_0x1dcc26,_0x674b52);logger[_0x768b('0x32')]('Invalid\x20plugin\x20structure');return _0x3b0674(new Error(_0x768b('0x75')));}var _0x3165aa=fs[_0x768b('0x76')](path['join'](_0x674b52,_0x426f6c[0x0]));if(_0x3165aa['isFile']()){removeReferences(_0x1dcc26,_0x674b52);logger[_0x768b('0x32')](_0x768b('0x75'));return _0x3b0674(new Error(_0x768b('0x75')));}if(_0x3165aa[_0x768b('0x77')]()){var _0x42d98a=fs[_0x768b('0x74')](path[_0x768b('0x66')](_0x674b52,_0x426f6c[0x0]));if(_0x42d98a[_0x768b('0x55')]===0x0){removeReferences(_0x1dcc26,_0x674b52);logger[_0x768b('0x32')](_0x768b('0x75'));return _0x3b0674(new Error(_0x768b('0x75')));}var _0x16e20d=_0x42d98a[_0x768b('0x78')](function(_0x863ca1){return _0x863ca1===_0x768b('0x79');});if(!_0x16e20d){return _0x3b0674(new Error(_0x768b('0x7a')));}var _0x3788ee=fs[_0x768b('0x7b')](path[_0x768b('0x66')](_0x674b52,_0x426f6c[0x0],_0x768b('0x79')));var _0x5d271a=JSON['parse'](_0x3788ee);if(_0x768b('0x23')==typeof _0x5d271a['name']){return _0x3b0674(new Error(_0x768b('0x7c')));}if(_0x768b('0x23')==typeof _0x5d271a['type']){return _0x3b0674(new Error(_0x768b('0x7d')));}if(_0x768b('0x23')==typeof _0x5d271a['version']){return _0x3b0674(new Error(_0x768b('0x7e')));}if(_0x768b('0x23')==typeof _0x5d271a[_0x768b('0x7f')]){return _0x3b0674(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5d271a[_0x768b('0x3a')]==='html'){if(_0x768b('0x23')==typeof _0x5d271a[_0x768b('0x7f')][_0x768b('0x80')]){return _0x3b0674(new Error(_0x768b('0x81')));}if(_0x768b('0x23')==typeof _0x5d271a[_0x768b('0x7f')][_0x768b('0x80')]['admin']&&_0x768b('0x23')==typeof _0x5d271a['parameters'][_0x768b('0x80')]['agent']){return _0x3b0674(new Error(_0x768b('0x82')));}}else if(_0x5d271a['type']===_0x768b('0x83')){if(_0x768b('0x23')==typeof _0x5d271a[_0x768b('0x7f')][_0x768b('0x84')]){return _0x3b0674(new Error(_0x768b('0x85')));}if(_0x768b('0x23')==typeof _0x5d271a[_0x768b('0x7f')][_0x768b('0x86')]){return _0x3b0674(new Error(_0x768b('0x87')));}}else{return _0x3b0674(new Error(_0x768b('0x88')));}var _0x3594f3=_0x5d271a['name'];var _0x217ab7=_0x5d271a[_0x768b('0x89')];var _0x31e0d6=_0x5d271a[_0x768b('0x3a')];var _0x4eb62c=_0x5d271a['sidebar']?_0x5d271a[_0x768b('0x8a')]:_0x768b('0x8b');var _0x238d06=_0x5d271a[_0x768b('0x8c')]?_0x5d271a['icon']:_0x768b('0x8d');var _0x4286f5='';var _0x36682d='';var _0x5bab95='';var _0x32931c='';var _0x320a22=_0x5d271a[_0x768b('0x8e')];if(_0x31e0d6==='html'){if(_0x768b('0x23')!=typeof _0x5d271a[_0x768b('0x7f')]['views'][_0x768b('0x8f')]){var _0xf003d=_0x5d271a['parameters'][_0x768b('0x80')][_0x768b('0x8f')];if(!/^(f|ht)tps?:\/\//i['test'](_0xf003d)){_0x4286f5=path[_0x768b('0x66')](_0x768b('0x90'),_0x19e977,_0x426f6c[0x0],_0xf003d);}else{_0x4286f5=_0xf003d;}}else{logger['info'](_0x768b('0x91'));}if(_0x768b('0x23')!=typeof _0x5d271a['parameters']['views'][_0x768b('0x92')]){var _0xb1d597=_0x5d271a['parameters']['views'][_0x768b('0x92')];if(!/^(f|ht)tps?:\/\//i['test'](_0xb1d597)){_0x36682d=path[_0x768b('0x66')](_0x768b('0x90'),_0x19e977,_0x426f6c[0x0],_0xb1d597);}else{_0x36682d=_0xb1d597;}}else{logger[_0x768b('0x6c')](_0x768b('0x93'));}}else if(_0x31e0d6===_0x768b('0x83')){_0x5bab95=_0x5d271a[_0x768b('0x7f')][_0x768b('0x84')];_0x32931c=_0x5d271a['parameters'][_0x768b('0x86')];if(_0x768b('0x23')!=typeof _0x5d271a[_0x768b('0x7f')]['views']){if(_0x768b('0x23')!=typeof _0x5d271a[_0x768b('0x7f')]['views'][_0x768b('0x8f')]){var _0xf003d=_0x5d271a[_0x768b('0x7f')]['views'][_0x768b('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x768b('0x94')](_0xf003d)){_0x4286f5=path['join']('plugins',_0x19e977,_0x426f6c[0x0],_0xf003d);}else{_0x4286f5=_0xf003d;}}if(_0x768b('0x23')!=typeof _0x5d271a['parameters'][_0x768b('0x80')][_0x768b('0x92')]){var _0xb1d597=_0x5d271a[_0x768b('0x7f')][_0x768b('0x80')][_0x768b('0x92')];if(!/^(f|ht)tps?:\/\//i[_0x768b('0x94')](_0xb1d597)){_0x36682d=path[_0x768b('0x66')](_0x768b('0x90'),_0x19e977,_0x426f6c[0x0],_0xb1d597);}else{_0x36682d=_0xb1d597;}}}}var _0x2d3412={'name':_0x3594f3,'description':_0x217ab7,'path':path[_0x768b('0x66')](_0x19e977,_0x426f6c[0x0]),'type':_0x31e0d6,'sidebar':_0x4eb62c,'icon':_0x238d06,'adminUrl':_0x4286f5,'agentUrl':_0x36682d,'scriptName':_0x5bab95,'scriptPath':_0x32931c,'version':_0x320a22};removeReferences(_0x1dcc26,null);return db[_0x768b('0x37')][_0x768b('0x95')](_0x2d3412)[_0x768b('0x2b')](function(_0x36425f){var _0x4a031e={'role':_0x487c5c[_0x768b('0x96')][_0x768b('0x97')],'userProfileId':_0x487c5c[_0x768b('0x96')]['userProfileId']};if(!_0x4a031e)throw new Error(_0x768b('0x98'));if(_0x4a031e[_0x768b('0x97')]===_0x768b('0x99')){var _0x3c3940=_0x36425f[_0x768b('0x2d')]({'plain':!![]});return db[_0x768b('0x9a')][_0x768b('0x56')]({'where':{'name':_0x768b('0x2e'),'userProfileId':_0x4a031e[_0x768b('0x9b')]},'raw':!![]})[_0x768b('0x2b')](function(_0x1ec11f){if(_0x1ec11f&&_0x1ec11f['autoAssociation']===0x0){return db[_0x768b('0x2f')]['create']({'name':_0x3c3940['name'],'resourceId':_0x3c3940['id'],'type':_0x1ec11f[_0x768b('0x34')],'sectionId':_0x1ec11f['id']},{})[_0x768b('0x2b')](function(){return _0x36425f;});}else{return _0x36425f;}})[_0x768b('0x52')](function(_0x3a2a9a){logger[_0x768b('0x32')](_0x768b('0x9c'),_0x3a2a9a);throw _0x3a2a9a;});}return _0x36425f;})[_0x768b('0x2b')](respondWithResult(_0x5a1a5,null))[_0x768b('0x52')](handleError(_0x5a1a5,null));}});}catch(_0x53ea20){_0x5a1a5[_0x768b('0x20')](0x1f4)[_0x768b('0x35')](_0x53ea20);}};function removeReferences(_0x10af6e,_0x5b4be0){try{if(_0x10af6e){fs['unlinkSync'](_0x10af6e);logger[_0x768b('0x6c')](_0x768b('0x9d'));}if(_0x5b4be0){rimraf(_0x5b4be0,function(){});logger[_0x768b('0x6c')](_0x768b('0x9e'));}}catch(_0x35fa47){logger[_0x768b('0x32')](_0x35fa47);}}exports[_0x768b('0x2a')]=function(_0x28a5cd,_0x18f738,_0x54a0b6){return db[_0x768b('0x37')][_0x768b('0x56')]({'where':{'id':_0x28a5cd['params']['id']}})['then'](handleEntityNotFound(_0x18f738,null))[_0x768b('0x2b')](saveUpdates(_0x28a5cd[_0x768b('0x96')],null))[_0x768b('0x2b')](respondWithResult(_0x18f738,null))[_0x768b('0x52')](handleError(_0x18f738,null));};exports['delete']=function(_0x2172b1,_0x312181,_0x4e4eab){return db[_0x768b('0x37')]['find']({'where':{'id':_0x2172b1[_0x768b('0x54')]['id']}})[_0x768b('0x2b')](function(_0x4c2cdc){if(_0x4c2cdc){return _0x4c2cdc[_0x768b('0x2c')]();}})[_0x768b('0x2b')](function(_0x40f202){rimraf(path[_0x768b('0x66')](config['root'],_0x768b('0x63'),path['dirname'](_0x40f202['path'])),function(){});return _0x40f202;})[_0x768b('0x2b')](handleEntityNotFound(_0x312181,null))[_0x768b('0x2b')](respondWithStatusCode(_0x312181,null))[_0x768b('0x52')](handleError(_0x312181,null));};exports[_0x768b('0x9f')]=function(_0x120e0d,_0x91a982,_0x519745){return BPromise[_0x768b('0xa0')]()[_0x768b('0x2b')](function(){if(!_0x120e0d[_0x768b('0x3e')]['path']){throw new Error(_0x768b('0xa1'));}if(!_0x120e0d[_0x768b('0x3e')][_0x768b('0xa2')]){throw new Error(_0x768b('0xa3'));}var _0x595616=_0x120e0d['query'][_0x768b('0xa4')]?_0x120e0d[_0x768b('0x3e')][_0x768b('0xa4')]+':'+_0x120e0d['query'][_0x768b('0xa2')]:_0x768b('0xa5')+_0x120e0d[_0x768b('0x3e')][_0x768b('0xa2')];var _0x7369ef=_0x120e0d[_0x768b('0x3e')][_0x768b('0x21')]?_0x120e0d['query'][_0x768b('0x21')]:!![];var _0x28a728=_0x120e0d[_0x768b('0x3e')][_0x768b('0xa6')]?_0x120e0d[_0x768b('0x3e')][_0x768b('0xa6')]:null;var _0x299d36={'method':_0x120e0d[_0x768b('0xa7')],'uri':util['format']('%s%s',_0x595616,_0x120e0d['query'][_0x768b('0x8')]),'json':_0x7369ef,'resolveWithFullResponse':!![],'encoding':_0x28a728,'qs':_0x120e0d['query']};if(_0x120e0d['headers']){_0x299d36[_0x768b('0xa8')]=_0x120e0d[_0x768b('0xa8')];if(_0x299d36[_0x768b('0xa8')]['content-length']){delete _0x299d36[_0x768b('0xa8')][_0x768b('0xa9')];}}if(_0x299d36[_0x768b('0xa8')]['content-type']){delete _0x299d36[_0x768b('0xa8')]['content-type'];}return rp(_0x299d36);})[_0x768b('0x2b')](function(_0x20170b){if(_0x20170b){_0x91a982[_0x768b('0x26')](_0x20170b['headers']);logger[_0x768b('0x6c')](_0x20170b[_0x768b('0x96')]);if(_[_0x768b('0xaa')](_0x120e0d[_0x768b('0x3e')][_0x768b('0x8')],'download')&&_0x20170b[_0x768b('0xab')]==0x1f4){return _0x91a982[_0x768b('0x31')](_0x20170b[_0x768b('0xab')]);}else{return _0x91a982[_0x768b('0x20')](_0x20170b['statusCode'])[_0x768b('0x35')](_0x20170b[_0x768b('0x96')]);}}else{return _0x91a982[_0x768b('0x31')](0xc8);}})['catch'](handleError(_0x91a982,null));};exports[_0x768b('0xac')]=function(_0xd0d9ca,_0x2618f2,_0x381314){return BPromise[_0x768b('0xa0')]()[_0x768b('0x2b')](function(){if(!_0xd0d9ca[_0x768b('0x3e')][_0x768b('0x8')]){throw new Error(_0x768b('0xa1'));}if(!_0xd0d9ca[_0x768b('0x3e')][_0x768b('0xa2')]){throw new Error(_0x768b('0xa3'));}var _0x5b9c05=_0xd0d9ca['query'][_0x768b('0xa4')]?_0xd0d9ca[_0x768b('0x3e')][_0x768b('0xa4')]+':'+_0xd0d9ca[_0x768b('0x3e')][_0x768b('0xa2')]:_0x768b('0xa5')+_0xd0d9ca['query']['port'];var _0x853454=_0xd0d9ca[_0x768b('0x3e')][_0x768b('0x21')]?_0xd0d9ca['query']['json']:!![];var _0x1cac31=_0xd0d9ca[_0x768b('0x3e')]['encoding']?_0xd0d9ca[_0x768b('0x3e')][_0x768b('0xa6')]:null;var _0x191c4c={'method':_0xd0d9ca['method'],'uri':util['format'](_0x768b('0xad'),_0x5b9c05,_0xd0d9ca['query'][_0x768b('0x8')]),'json':_0x853454,'resolveWithFullResponse':!![],'encoding':_0x1cac31,'body':_0xd0d9ca['body']};if(_0xd0d9ca[_0x768b('0xa8')]){_0x191c4c['headers']=_0xd0d9ca[_0x768b('0xa8')];if(_0x191c4c['headers'][_0x768b('0xa9')]){delete _0x191c4c['headers'][_0x768b('0xa9')];}}if(_0x191c4c[_0x768b('0xa8')]['content-type']){delete _0x191c4c[_0x768b('0xa8')][_0x768b('0xae')];}return rp(_0x191c4c);})['then'](function(_0x258d4d){if(_0x258d4d){_0x2618f2[_0x768b('0x26')](_0x258d4d['headers']);logger[_0x768b('0x6c')](_0x258d4d['body']);return _0x2618f2[_0x768b('0x20')](_0x258d4d[_0x768b('0xab')])[_0x768b('0x35')](_0x258d4d['body']);}else{return _0x2618f2[_0x768b('0x31')](0xc8);}})[_0x768b('0x52')](handleError(_0x2618f2,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9505682..72c4c14 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 _0xf569=['exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x52b501,_0x2a4a0e){var _0x15050f=function(_0x3e9590){while(--_0x3e9590){_0x52b501['push'](_0x52b501['shift']());}};_0x15050f(++_0x2a4a0e);}(_0xf569,0xd0));var _0x9f56=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf569[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9f56('0x0'))['db'][_0x9f56('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9f56('0x2')](0x0);var events={'afterCreate':_0x9f56('0x3'),'afterUpdate':_0x9f56('0x4'),'afterDestroy':_0x9f56('0x5')};function emitEvent(_0x4506a1){return function(_0x6d506b,_0x5bc3e8,_0x314ee2){PluginEvents['emit'](_0x4506a1+':'+_0x6d506b['id'],_0x6d506b);PluginEvents[_0x9f56('0x6')](_0x4506a1,_0x6d506b);_0x314ee2(null);};}for(var e in events){if(events[_0x9f56('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x9f56('0x8')]=PluginEvents; \ No newline at end of file +var _0xf03a=['remove','emit','hook','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x1d0695,_0x5359f9){var _0x59ed38=function(_0x150fd5){while(--_0x150fd5){_0x1d0695['push'](_0x1d0695['shift']());}};_0x59ed38(++_0x5359f9);}(_0xf03a,0x1a0));var _0xaf03=function(_0x273826,_0x446d19){_0x273826=_0x273826-0x0;var _0x3a4b70=_0xf03a[_0x273826];return _0x3a4b70;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xaf03('0x0'))['db'][_0xaf03('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xaf03('0x2')](0x0);var events={'afterCreate':_0xaf03('0x3'),'afterUpdate':'update','afterDestroy':_0xaf03('0x4')};function emitEvent(_0xfe64f3){return function(_0x4f13f3,_0x3aa47d,_0x10a6a5){PluginEvents[_0xaf03('0x5')](_0xfe64f3+':'+_0x4f13f3['id'],_0x4f13f3);PluginEvents[_0xaf03('0x5')](_0xfe64f3,_0x4f13f3);_0x10a6a5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xaf03('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e97c249..3c18ac3 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 _0x8406=['bluebird','request-promise','path','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x8406,0x10c));var _0x6840=function(_0x427810,_0x1fd7b2){_0x427810=_0x427810-0x0;var _0x2341c8=_0x8406[_0x427810];return _0x2341c8;};'use strict';var _=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var logger=require(_0x6840('0x2'))(_0x6840('0x3'));var moment=require(_0x6840('0x4'));var BPromise=require(_0x6840('0x5'));var rp=require(_0x6840('0x6'));var fs=require('fs');var path=require(_0x6840('0x7'));var rimraf=require('rimraf');var config=require(_0x6840('0x8'));var attributes=require(_0x6840('0x9'));module['exports']=function(_0x4a33be,_0xf0cbcb){return _0x4a33be[_0x6840('0xa')](_0x6840('0xb'),attributes,{'tableName':_0x6840('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ec5=['lodash','util','../../config/logger','bluebird','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x1ec5,0xfd));var _0x51ec=function(_0x4f9a11,_0x27e3c8){_0x4f9a11=_0x4f9a11-0x0;var _0x139c7a=_0x1ec5[_0x4f9a11];return _0x139c7a;};'use strict';var _=require(_0x51ec('0x0'));var util=require(_0x51ec('0x1'));var logger=require(_0x51ec('0x2'))('api');var moment=require('moment');var BPromise=require(_0x51ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51ec('0x4'));var rimraf=require(_0x51ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x51ec('0x6'));module[_0x51ec('0x7')]=function(_0x2c9c0c,_0xaa9f1){return _0x2c9c0c[_0x51ec('0x8')](_0x51ec('0x9'),attributes,{'tableName':_0x51ec('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 1ce5254..fb2250a 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 _0xcb52=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','raw','info','CreatePlugin','catch','lodash','util','ioredis','../../mysqldb'];(function(_0x1d0988,_0x5eb899){var _0x323608=function(_0x2cad60){while(--_0x2cad60){_0x1d0988['push'](_0x1d0988['shift']());}};_0x323608(++_0x5eb899);}(_0xcb52,0x15c));var _0x2cb5=function(_0x3efcf1,_0xfa83c3){_0x3efcf1=_0x3efcf1-0x0;var _0x4ef023=_0xcb52[_0x3efcf1];return _0x4ef023;};'use strict';var _=require(_0x2cb5('0x0'));var util=require(_0x2cb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cb5('0x2'));var db=require(_0x2cb5('0x3'))['db'];var utils=require(_0x2cb5('0x4'));var logger=require(_0x2cb5('0x5'))(_0x2cb5('0x6'));var config=require(_0x2cb5('0x7'));var jayson=require(_0x2cb5('0x8'));var client=jayson[_0x2cb5('0x9')][_0x2cb5('0xa')]({'port':0x232a});config[_0x2cb5('0xb')]=_[_0x2cb5('0xc')](config['redis'],{'host':_0x2cb5('0xd'),'port':0x18eb});var socket=require(_0x2cb5('0xe'))(new Redis(config[_0x2cb5('0xb')]));require('./plugin.socket')[_0x2cb5('0xf')](socket);function respondWithRpcPromise(_0x27a571,_0x9dcc97,_0x1029eb){return new BPromise(function(_0x1054e6,_0x1a48b8){return client[_0x2cb5('0x10')](_0x27a571,_0x1029eb)[_0x2cb5('0x11')](function(_0x5febfc){logger['info'](_0x2cb5('0x12'),_0x9dcc97,_0x2cb5('0x13'));logger[_0x2cb5('0x14')](_0x2cb5('0x15'),_0x9dcc97,_0x2cb5('0x13'),JSON[_0x2cb5('0x16')](_0x5febfc));if(_0x5febfc[_0x2cb5('0x17')]){if(_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x18')]===0x1f4){logger[_0x2cb5('0x17')](_0x2cb5('0x12'),_0x9dcc97,_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x19')]);return _0x1a48b8(_0x5febfc[_0x2cb5('0x17')][_0x2cb5('0x19')]);}logger['error'](_0x2cb5('0x12'),_0x9dcc97,_0x5febfc['error']['message']);return _0x1054e6(_0x5febfc[_0x2cb5('0x17')]['message']);}else{logger['info'](_0x2cb5('0x12'),_0x9dcc97,_0x2cb5('0x13'));_0x1054e6(_0x5febfc[_0x2cb5('0x1a')][_0x2cb5('0x19')]);}})['catch'](function(_0x30c128){logger['error']('Plugin,\x20%s,\x20%s',_0x9dcc97,_0x30c128);_0x1a48b8(_0x30c128);});});}exports['CreatePlugin']=function(_0x37559c){var _0x976359=this;return new Promise(function(_0x58f357,_0x31eefc){return db['Plugin'][_0x2cb5('0x1b')](_0x37559c['body'],{'raw':_0x37559c['options']?_0x37559c['options'][_0x2cb5('0x1c')]===undefined?!![]:![]:!![]})[_0x2cb5('0x11')](function(_0x4b0b29){logger[_0x2cb5('0x1d')](_0x2cb5('0x1e'),_0x37559c);logger[_0x2cb5('0x14')]('CreatePlugin',_0x37559c,JSON['stringify'](_0x4b0b29));_0x58f357(_0x4b0b29);})[_0x2cb5('0x1f')](function(_0x5a968a){logger[_0x2cb5('0x17')](_0x2cb5('0x1e'),_0x5a968a[_0x2cb5('0x19')],_0x37559c);_0x31eefc(_0x976359[_0x2cb5('0x17')](0x1f4,_0x5a968a['message']));});});}; \ No newline at end of file +var _0x16d5=['code','message','info','result','catch','CreatePlugin','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error'];(function(_0xe1b102,_0x542a72){var _0xed6dcc=function(_0x3191a6){while(--_0x3191a6){_0xe1b102['push'](_0xe1b102['shift']());}};_0xed6dcc(++_0x542a72);}(_0x16d5,0xe9));var _0x516d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x516d('0x0'));var util=require(_0x516d('0x1'));var moment=require('moment');var BPromise=require(_0x516d('0x2'));var rs=require(_0x516d('0x3'));var fs=require('fs');var Redis=require(_0x516d('0x4'));var db=require(_0x516d('0x5'))['db'];var utils=require(_0x516d('0x6'));var logger=require(_0x516d('0x7'))(_0x516d('0x8'));var config=require(_0x516d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x516d('0xa')][_0x516d('0xb')]({'port':0x232a});config[_0x516d('0xc')]=_['defaults'](config[_0x516d('0xc')],{'host':_0x516d('0xd'),'port':0x18eb});var socket=require(_0x516d('0xe'))(new Redis(config['redis']));require(_0x516d('0xf'))[_0x516d('0x10')](socket);function respondWithRpcPromise(_0x9cfba5,_0x427d8a,_0x5054d8){return new BPromise(function(_0xe3b578,_0x532019){return client[_0x516d('0x11')](_0x9cfba5,_0x5054d8)['then'](function(_0x3a66b5){logger['info'](_0x516d('0x12'),_0x427d8a,_0x516d('0x13'));logger[_0x516d('0x14')](_0x516d('0x15'),_0x427d8a,_0x516d('0x13'),JSON['stringify'](_0x3a66b5));if(_0x3a66b5['error']){if(_0x3a66b5[_0x516d('0x16')][_0x516d('0x17')]===0x1f4){logger[_0x516d('0x16')]('Plugin,\x20%s,\x20%s',_0x427d8a,_0x3a66b5[_0x516d('0x16')][_0x516d('0x18')]);return _0x532019(_0x3a66b5['error'][_0x516d('0x18')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x427d8a,_0x3a66b5[_0x516d('0x16')][_0x516d('0x18')]);return _0xe3b578(_0x3a66b5[_0x516d('0x16')]['message']);}else{logger[_0x516d('0x19')]('Plugin,\x20%s,\x20%s',_0x427d8a,'request\x20sent');_0xe3b578(_0x3a66b5[_0x516d('0x1a')][_0x516d('0x18')]);}})[_0x516d('0x1b')](function(_0x38523d){logger[_0x516d('0x16')](_0x516d('0x12'),_0x427d8a,_0x38523d);_0x532019(_0x38523d);});});}exports[_0x516d('0x1c')]=function(_0x2acba0){var _0x5992df=this;return new Promise(function(_0xac0c63,_0x580c69){return db['Plugin']['create'](_0x2acba0['body'],{'raw':_0x2acba0[_0x516d('0x1d')]?_0x2acba0[_0x516d('0x1d')][_0x516d('0x1e')]===undefined?!![]:![]:!![]})[_0x516d('0x1f')](function(_0x2335ad){logger[_0x516d('0x19')](_0x516d('0x1c'),_0x2acba0);logger[_0x516d('0x14')](_0x516d('0x1c'),_0x2acba0,JSON['stringify'](_0x2335ad));_0xac0c63(_0x2335ad);})[_0x516d('0x1b')](function(_0x3f96bc){logger[_0x516d('0x16')](_0x516d('0x1c'),_0x3f96bc['message'],_0x2acba0);_0x580c69(_0x5992df[_0x516d('0x16')](0x1f4,_0x3f96bc['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bd27ba0..99529f4 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 _0x47b1=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events','save'];(function(_0x32abb6,_0x1650a8){var _0x401c73=function(_0x43733e){while(--_0x43733e){_0x32abb6['push'](_0x32abb6['shift']());}};_0x401c73(++_0x1650a8);}(_0x47b1,0x130));var _0x147b=function(_0x3cf5b1,_0xb6502b){_0x3cf5b1=_0x3cf5b1-0x0;var _0x45585a=_0x47b1[_0x3cf5b1];return _0x45585a;};'use strict';var PluginEvents=require(_0x147b('0x0'));var events=[_0x147b('0x1'),_0x147b('0x2'),_0x147b('0x3')];function createListener(_0x3275ac,_0x1e82dd){return function(_0x56c813){_0x1e82dd[_0x147b('0x4')](_0x3275ac,_0x56c813);};}function removeListener(_0x412044,_0x233652){return function(){PluginEvents[_0x147b('0x5')](_0x412044,_0x233652);};}exports[_0x147b('0x6')]=function(_0x5128b9){for(var _0x2c1c15=0x0,_0x497f2b=events[_0x147b('0x7')];_0x2c1c15<_0x497f2b;_0x2c1c15++){var _0xdae9fd=events[_0x2c1c15];var _0x1761c3=createListener(_0x147b('0x8')+_0xdae9fd,_0x5128b9);PluginEvents['on'](_0xdae9fd,_0x1761c3);}}; \ No newline at end of file +var _0x5edb=['plugin:','save','update','emit','removeListener','register','length'];(function(_0x21ff39,_0x4c3be2){var _0x41d160=function(_0x1b174b){while(--_0x1b174b){_0x21ff39['push'](_0x21ff39['shift']());}};_0x41d160(++_0x4c3be2);}(_0x5edb,0x1a5));var _0xb5ed=function(_0xa2c55f,_0x313ba7){_0xa2c55f=_0xa2c55f-0x0;var _0xc49ec9=_0x5edb[_0xa2c55f];return _0xc49ec9;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xb5ed('0x0'),'remove',_0xb5ed('0x1')];function createListener(_0x1336b4,_0xa0186a){return function(_0x1e4f2){_0xa0186a[_0xb5ed('0x2')](_0x1336b4,_0x1e4f2);};}function removeListener(_0x22f1ff,_0x565773){return function(){PluginEvents[_0xb5ed('0x3')](_0x22f1ff,_0x565773);};}exports[_0xb5ed('0x4')]=function(_0x252900){for(var _0x4890b8=0x0,_0x490dd6=events[_0xb5ed('0x5')];_0x4890b8<_0x490dd6;_0x4890b8++){var _0xb33503=events[_0x4890b8];var _0x1e1983=createListener(_0xb5ed('0x6')+_0xb33503,_0x252900);PluginEvents['on'](_0xb33503,_0x1e1983);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4aea471..a3ebd92 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(_0x182f68,_0x18d7a4){var _0x3b16bd=function(_0x346f9c){while(--_0x346f9c){_0x182f68['push'](_0x182f68['shift']());}};_0x3b16bd(++_0x18d7a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x3c05a5,_0x1a93f4){var _0xb15a3c=function(_0x2fa2f1){while(--_0x2fa2f1){_0x3c05a5['push'](_0x3c05a5['shift']());}};_0xb15a3c(++_0x1a93f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 863e616..5234e8d 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 _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x1fa361,_0x43de67){var _0x59b0cc=function(_0x17b2ac){while(--_0x17b2ac){_0x1fa361['push'](_0x1fa361['shift']());}};_0x59b0cc(++_0x43de67);}(_0x2f68,0x9a));var _0x82f6=function(_0x47896f,_0x52db00){_0x47896f=_0x47896f-0x0;var _0x2dca2b=_0x2f68[_0x47896f];return _0x2dca2b;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file +var _0xa9e0=['list','then','reject','express','motion2','catch','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','status','stack','name','send','info','error','index'];(function(_0x1c5622,_0x3f5394){var _0x1d42c9=function(_0x343495){while(--_0x343495){_0x1c5622['push'](_0x1c5622['shift']());}};_0x1d42c9(++_0x3f5394);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x0a9e('0x0'));var pm2=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var path=require('path');var exec=require(_0x0a9e('0x3'))['exec'];var BPromise=require(_0x0a9e('0x4'));function handleEntityNotFound(_0x432180,_0x2ab90b){return function(_0x991246){if(!_0x991246){_0x432180[_0x0a9e('0x5')](0x194);;}return _0x991246;};}function respondWithResult(_0x57b080,_0x219af0){_0x219af0=_0x219af0||0xc8;return function(_0x441e3a){if(_0x441e3a){return _0x57b080[_0x0a9e('0x6')](_0x219af0)['json'](_0x441e3a);}return null;};}function handleError(_0x503809,_0xe42b77){_0xe42b77=_0xe42b77||0x1f4;return function(_0x56465b){logger['error'](_0x56465b[_0x0a9e('0x7')]);if(_0x56465b[_0x0a9e('0x8')]){delete _0x56465b[_0x0a9e('0x8')];}_0x503809[_0x0a9e('0x6')](_0xe42b77)[_0x0a9e('0x9')](_0x56465b);};}function execChildProcess(){return new BPromise(function(_0xbd1168,_0x4a4c56){exec('npm\x20install',function(_0x527cdd,_0x4cfe67,_0x273d4d){logger[_0x0a9e('0xa')](_0x4cfe67);logger[_0x0a9e('0xa')](_0x273d4d);if(_0x527cdd){logger[_0x0a9e('0xb')](_0x527cdd);return _0x4a4c56(_0x527cdd);}return _0xbd1168(_0x4cfe67);});});}exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return pm2[_0x0a9e('0xd')]()[_0x0a9e('0xe')](function(_0x2b4227){if(_0x2b4227){var _0x281129=_[_0x0a9e('0xf')](_0x2b4227,function(_0x4d5611){return _0x4d5611['name']===_0x0a9e('0x10')||_0x4d5611['name']===_0x0a9e('0x11');});return{'rows':_0x281129,'count':_0x281129['length']};}return null;})[_0x0a9e('0xe')](respondWithResult(_0x5db4b0,null))[_0x0a9e('0x12')](handleError(_0x5db4b0,null));};exports['show']=function(_0x225616,_0x5a0a06){return pm2[_0x0a9e('0x13')](_0x225616[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x5a0a06,null))[_0x0a9e('0xe')](handleEntityNotFound(_0x5a0a06,null))[_0x0a9e('0x12')](handleError(_0x5a0a06,null));};exports[_0x0a9e('0x15')]=function(_0x530eb7,_0x20559e){if(_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')]&&_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x17')]){var _0x4bb1e3=path[_0x0a9e('0x18')](__dirname,_0x0a9e('0x19'),_0x530eb7['body'][_0x0a9e('0x17')]);var _0x5a09ef=process['cwd']();process[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x4bb1e3));return execChildProcess()[_0x0a9e('0xe')](function(_0x30bae6){process['chdir'](_0x5a09ef);return pm2[_0x0a9e('0x1c')]({'name':_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')],'script':_0x4bb1e3});})[_0x0a9e('0xe')](function(_0x370d86){pm2[_0x0a9e('0x1d')]();return _0x370d86[0x0];})[_0x0a9e('0xe')](respondWithResult(_0x20559e,0xc9))['catch'](handleError(_0x20559e,null));}else{return _0x20559e['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x1e')});}};exports[_0x0a9e('0x1f')]=function(_0x33161b,_0x526cf3){if(_0x33161b[_0x0a9e('0x16')]['id']){delete _0x33161b['body']['id'];}var _0x45a1e7={'online':'restart','stopped':_0x0a9e('0x20')};if(_0x45a1e7[_0x0a9e('0x21')](_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')])){return pm2[_0x45a1e7[_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')]]](_0x33161b[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x526cf3,0xc8))['catch'](handleError(_0x526cf3,null));}else{return _0x526cf3[_0x0a9e('0x6')](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x22')});}};exports[_0x0a9e('0x23')]=function(_0x5c877d,_0x15b200){if(_0x5c877d[_0x0a9e('0x16')]['id']){delete _0x5c877d[_0x0a9e('0x16')]['id'];}if(_0x5c877d[_0x0a9e('0x14')]['id']){return pm2[_0x0a9e('0x24')](_0x5c877d[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](function(_0x2e8759){pm2[_0x0a9e('0x1d')]();return _0x2e8759[0x0];})['then'](respondWithResult(_0x15b200,null))[_0x0a9e('0x12')](handleError(_0x15b200,null));}else{return _0x15b200['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 2294995..d252e05 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 _0x5ccd=['exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated','getAgents','/queues','getQueues'];(function(_0xcbe787,_0x401e4c){var _0x4c78fa=function(_0x392922){while(--_0x392922){_0xcbe787['push'](_0xcbe787['shift']());}};_0x4c78fa(++_0x401e4c);}(_0x5ccd,0x79));var _0xd5cc=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0x5ccd[_0x12309b];return _0x482e4d;};'use strict';var express=require(_0xd5cc('0x0'));var router=express[_0xd5cc('0x1')]();var auth=require(_0xd5cc('0x2'));var controller=require(_0xd5cc('0x3'));router['get'](_0xd5cc('0x4'),auth[_0xd5cc('0x5')](),controller[_0xd5cc('0x6')]);router['get'](_0xd5cc('0x7'),auth['isAuthenticated'](),controller[_0xd5cc('0x8')]);module[_0xd5cc('0x9')]=router; \ No newline at end of file +var _0xf3a8=['../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents','getQueues','exports','express'];(function(_0x2c6c27,_0x583885){var _0x4bf010=function(_0x254c61){while(--_0x254c61){_0x2c6c27['push'](_0x2c6c27['shift']());}};_0x4bf010(++_0x583885);}(_0xf3a8,0xef));var _0x8f3a=function(_0x481ffc,_0x2c8d2c){_0x481ffc=_0x481ffc-0x0;var _0x58e8a2=_0xf3a8[_0x481ffc];return _0x58e8a2;};'use strict';var express=require(_0x8f3a('0x0'));var router=express['Router']();var auth=require(_0x8f3a('0x1'));var controller=require(_0x8f3a('0x2'));router[_0x8f3a('0x3')]('/agents',auth[_0x8f3a('0x4')](),controller[_0x8f3a('0x5')]);router['get']('/queues',auth['isAuthenticated'](),controller[_0x8f3a('0x6')]);module[_0x8f3a('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 06459c1..28736ad 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 _0x7ca0=['voiceStatus','talking','Status','sortAgentsByStatus','rows','pick','catch','getQueues','key','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','count','limit','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice'];(function(_0x1362b1,_0x2f0a44){var _0x4c64c4=function(_0x1fe655){while(--_0x1fe655){_0x1362b1['push'](_0x1362b1['shift']());}};_0x4c64c4(++_0x2f0a44);}(_0x7ca0,0xbb));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07ca('0x0'));var util=require('util');var rta=require(_0x07ca('0x1'));var rtq=require(_0x07ca('0x2'));var qs=require(_0x07ca('0x3'));var utils=require(_0x07ca('0x4'));var db=require(_0x07ca('0x5'))['db'];var APIBadRequestError=require(_0x07ca('0x6'))[_0x07ca('0x7')];var APIHandleError=require(_0x07ca('0x6'))[_0x07ca('0x8')];function respondWithFilteredResult(_0x3eb065,_0x1f91e2){return function(_0x4e8566){if(_0x4e8566){var _0x17ca29=typeof _0x1f91e2[_0x07ca('0x9')]==='undefined'&&typeof _0x1f91e2['limit']==='undefined';var _0x3c7f7e=_0x4e8566[_0x07ca('0xa')];var _0x31a7f5=_0x17ca29?0x0:_0x1f91e2[_0x07ca('0x9')];var _0x5dc6cb=_0x17ca29?_0x4e8566[_0x07ca('0xa')]:_0x1f91e2[_0x07ca('0x9')]+_0x1f91e2[_0x07ca('0xb')];var _0x319fec;if(_0x5dc6cb>=_0x3c7f7e){_0x5dc6cb=_0x3c7f7e;_0x319fec=0xc8;}else{_0x319fec=0xce;}_0x3eb065[_0x07ca('0xc')](_0x319fec);return _0x3eb065[_0x07ca('0xd')](_0x07ca('0xe'),_0x31a7f5+'-'+_0x5dc6cb+'/'+_0x3c7f7e)[_0x07ca('0xf')](_0x4e8566);}return null;};}exports[_0x07ca('0x10')]=function(_0x4b3917,_0x33ea7b){var _0x1e73fd={'count':0x0,'rows':[]};var _0x5bc08a={};var _0x1b56a4;var _0x52049d=utils[_0x07ca('0x11')]();var _0x48447f;var _0x5d6b40;var _0x5033a0=_0x4b3917[_0x07ca('0x12')][_0x07ca('0x13')];var _0x48a00e=_0x4b3917[_0x07ca('0x12')][_0x07ca('0x14')];var _0x1e2faf=_0x4b3917['query'][_0x07ca('0x15')];var _0x4cb0e2=_0x48a00e===_0x07ca('0x16')||_0x48a00e==='*pause'?!![]:![];var _0x32627e=[];var _0x21bdc2;var _0x2ad3eb;Promise[_0x07ca('0x17')]()[_0x07ca('0x18')](function(){if(_0x4b3917[_0x07ca('0x12')]['channel']){if(!utils[_0x07ca('0x19')](_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1a')])){throw new APIBadRequestError(util[_0x07ca('0x1b')](_0x07ca('0x1c'),_0x4b3917['query'][_0x07ca('0x1a')]));}_0x1b56a4=_0x4b3917[_0x07ca('0x12')]['channel'][_0x07ca('0x1d')]();}if(!_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')]||!_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')][_0x07ca('0x1f')](_0x07ca('0x20'))){_0x4b3917[_0x07ca('0x12')][_0x07ca('0x1e')]=rta[_0x07ca('0x21')](_0x4b3917[_0x07ca('0x12')]['sort']);return;}var _0x419225=rta[_0x07ca('0x22')](_0x4b3917['query'][_0x07ca('0x1e')]);_0x4b3917['query'][_0x07ca('0x1e')]=_0x419225[_0x07ca('0x23')][_0x07ca('0x24')](',');_0x21bdc2=_0x419225[_0x07ca('0x25')];})[_0x07ca('0x18')](function(){if(!_0x5033a0){return[];}return rta[_0x07ca('0x26')](_0x5033a0,_0x1b56a4);})[_0x07ca('0x18')](function(_0x2af06e){_0x32627e=_0x2af06e;return rta[_0x07ca('0x27')]();})[_0x07ca('0x18')](function(_0xaa496){_0x5d6b40=_0xaa496['rows'];if((!_0x48a00e||_0x4cb0e2)&&!_0x21bdc2){return _0x32627e;}if(_0x21bdc2&&!_0x48a00e){return rta[_0x07ca('0x28')](_0x5d6b40,_0x32627e,_0x21bdc2);}else{return rta[_0x07ca('0x29')](_0x5d6b40,_0x32627e,_0x48a00e);}})['then'](function(_0xff4f25){_0x32627e=_0xff4f25;var _0x24072c=![];if(_0x32627e[_0x07ca('0x2a')]===0x0){if(_0x5033a0||_0x48a00e){_0x24072c=!![];}if(_0x4cb0e2){_0x24072c=![];}}if(_0x24072c){return _0x1e73fd;}var _0x26632b=_[_0x07ca('0x2b')](db[_0x07ca('0x2c')]['rawAttributes'],function(_0x42d68a){return{'name':_0x42d68a[_0x07ca('0x2d')],'type':_0x42d68a[_0x07ca('0x2e')]['key']};});_0x4b3917['query'][_0x07ca('0x2f')]=_0x07ca('0x30');_0x5bc08a=qs[_0x07ca('0x31')](_0x26632b,_0x4b3917);_0x5bc08a[_0x07ca('0x32')]=!![];var _0x5f25e8=[];if(_0x32627e[_0x07ca('0x2a')]>0x0){_0x5f25e8[_0x07ca('0x33')]({'id':{'$in':_0x32627e}});if(_0x21bdc2&&!_0x48a00e){_0x2ad3eb=[db['sequelize'][_0x07ca('0x34')](_0x07ca('0x35')+_0x32627e+')')];_0x5bc08a[_0x07ca('0x25')]=_0x2ad3eb;}}if(_0x4cb0e2){_0x52049d[_0x07ca('0x36')](function(_0x2dad36){var _0x2c7fc0=!![];if(_0x48a00e===_0x07ca('0x37')&&_0x1b56a4!==_0x2dad36){_0x2c7fc0=![];}_0x5f25e8[_0x07ca('0x33')]({[_0x2dad36+_0x07ca('0x38')]:_0x2c7fc0});});if(_0x1e2faf){_0x5f25e8['push']({'pauseType':_0x1e2faf});}}else if(_0x48a00e){_0x52049d[_0x07ca('0x36')](function(_0x4a9811){_0x5f25e8['push']({[_0x4a9811+'Pause']:![]});});}_0x5bc08a[_0x07ca('0x39')]=_[_0x07ca('0x3a')](_0x5bc08a[_0x07ca('0x39')],{'$and':_0x5f25e8});if(_0x4b3917[_0x07ca('0x3b')][_0x07ca('0x2f')]===_0x07ca('0x3b')){var _0x3064fa={'params':{'id':_0x4b3917[_0x07ca('0x3b')][_0x07ca('0x3c')]},'query':{'section':_0x07ca('0x3d'),'role':_0x07ca('0x30'),'raw':!![],'ids':_0x32627e,'customSorting':_0x2ad3eb}};if(_0x4b3917['query'][_0x07ca('0x3e')]){_0x3064fa[_0x07ca('0x12')][_0x07ca('0x3e')]=!![];}if(_0x4cb0e2){_0x3064fa['query'][_0x07ca('0x3f')]=_0x5f25e8;}_0x3064fa['query']=Object['assign'](_0x3064fa['query'],_0x4b3917[_0x07ca('0x12')]);return db[_0x07ca('0x40')][_0x07ca('0x41')](_0x3064fa);}return db['User'][_0x07ca('0x42')](_0x5bc08a);})[_0x07ca('0x18')](function(_0x320825){_0x1e73fd[_0x07ca('0xa')]=_0x320825[_0x07ca('0xa')];_0x48447f=_0x320825['rows'];return _0x48447f[_0x07ca('0x2b')](function(_0x1fe59a){var _0x471ab8=_[_0x07ca('0x43')](_0x5d6b40,['id',_0x1fe59a['id']]);if(_0x471ab8){var _0x562506=rta[_0x07ca('0x44')](_0x471ab8);_[_0x07ca('0x3a')](_0x1fe59a,_0x562506);}_0x1fe59a[_0x07ca('0x20')]=rta[_0x07ca('0x45')](_0x1fe59a);if(_0x1fe59a[_0x07ca('0x20')]['includes'](_0x07ca('0x16'))){_0x52049d[_0x07ca('0x36')](function(_0x459d18){if(_0x1fe59a[_0x459d18+_0x07ca('0x38')]){if(_0x459d18===_0x07ca('0x46')){if(_0x1fe59a[_0x07ca('0x47')]!==_0x07ca('0x48')){_0x1fe59a['voiceStatus']=_0x07ca('0x16');}}else{_0x1fe59a[_0x459d18+_0x07ca('0x49')]='pause';}}});}return _0x1fe59a;});})[_0x07ca('0x18')](function(_0x58ebc1){if(!_0x21bdc2||_0x2ad3eb){return _0x58ebc1;}return rta[_0x07ca('0x4a')](_0x58ebc1,_0x21bdc2);})[_0x07ca('0x18')](function(_0x474edb){var _0x17576d=rta['getRealtimeAgentsQueryFields']();_0x1e73fd[_0x07ca('0x4b')]=_0x474edb[_0x07ca('0x2b')](function(_0x4bfbbd){return _[_0x07ca('0x4c')](_0x4bfbbd,_0x17576d);});return _0x1e73fd;})['then'](respondWithFilteredResult(_0x33ea7b,_0x5bc08a))[_0x07ca('0x4d')](APIHandleError(_0x33ea7b));};exports[_0x07ca('0x4e')]=function(_0x281d87,_0x3f9490){var _0x2cc4ac={'count':0x0,'rows':[]};var _0x271a94={};var _0x1d1f5d;var _0x351949;var _0x463c96;Promise[_0x07ca('0x17')]()[_0x07ca('0x18')](function(){if(_0x281d87['query'][_0x07ca('0x1a')]){if(!utils[_0x07ca('0x19')](_0x281d87[_0x07ca('0x12')]['channel'])){throw new APIBadRequestError(util[_0x07ca('0x1b')](_0x07ca('0x1c'),_0x281d87[_0x07ca('0x12')][_0x07ca('0x1a')]));}_0x1d1f5d=_0x281d87[_0x07ca('0x12')][_0x07ca('0x1a')][_0x07ca('0x1d')]();}var _0x568eec=_['startCase'](_0x1d1f5d)+'Queue';var _0x175ac6=_['map'](db[_0x568eec]['rawAttributes'],function(_0xf438c6){return{'name':_0xf438c6[_0x07ca('0x2d')],'type':_0xf438c6[_0x07ca('0x2e')][_0x07ca('0x4f')]};});if(!_0x281d87[_0x07ca('0x12')][_0x07ca('0x23')]){var _0x555aa6=['id','name'];if(_0x1d1f5d===_0x07ca('0x46')){_0x555aa6[_0x07ca('0x33')](_0x07ca('0x2e'));if(_0x281d87['query'][_0x07ca('0x2e')]==='outbound'){_0x555aa6[_0x07ca('0x33')](['dialActive','dialMethod']);}}_0x281d87[_0x07ca('0x12')][_0x07ca('0x23')]=_0x555aa6['join'](',');}_0x271a94=qs['getOptions'](_0x175ac6,_0x281d87);if(_0x281d87[_0x07ca('0x3b')][_0x07ca('0x2f')]==='user'){var _0x57a53e={'params':{'id':_0x281d87['user'][_0x07ca('0x3c')]},'query':{'section':_0x1d1f5d===_0x07ca('0x46')&&_0x281d87[_0x07ca('0x12')]['type']==='outbound'?_0x07ca('0x50'):_['startCase'](_0x1d1f5d)+_0x07ca('0x51'),'type':_0x281d87['query']['type'],'nolimit':!![],'sort':_0x07ca('0x52'),'filter':_0x281d87[_0x07ca('0x12')][_0x07ca('0x53')]}};_0x57a53e['query']=Object['assign'](_0x57a53e[_0x07ca('0x12')],_0x281d87[_0x07ca('0x12')]);delete _0x57a53e[_0x07ca('0x12')]['id'];return db[_0x07ca('0x40')]['getResources'](_0x57a53e);}return db[_0x568eec]['findAndCountAll'](_0x271a94);})[_0x07ca('0x18')](function(_0xadc30c){_0x2cc4ac[_0x07ca('0xa')]=_0xadc30c['count'];_0x351949=_0xadc30c[_0x07ca('0x4b')];return rtq[_0x07ca('0x54')](_0x281d87,_0x1d1f5d);})['then'](function(_0x2736ad){_0x463c96=_0x2736ad[_0x07ca('0x4b')];return rtq[_0x07ca('0x55')](_0x351949,_0x463c96,_0x1d1f5d,_0x281d87[_0x07ca('0x12')][_0x07ca('0x2e')]);})['then'](function(_0x176ceb){_0x2cc4ac[_0x07ca('0x4b')]=_0x176ceb;return _0x2cc4ac;})[_0x07ca('0x18')](respondWithFilteredResult(_0x3f9490,_0x271a94))[_0x07ca('0x4d')](APIHandleError(_0x3f9490));}; \ No newline at end of file +var _0xaec7=['getSortedAgentsIdsByStatus','length','map','User','fieldName','type','key','agent','getOptions','raw','push','sequelize','FIELD(id,','forEach','*pause','Pause','user','role','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll','find','merge','getAgentStatus','includes','voice','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','Queue','rawAttributes','fields','name','outbound','QueueCampaigns','Queues','getResources','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','handleError','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','pause','then','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows'];(function(_0x25edb4,_0x467ab3){var _0x1d11df=function(_0x321e68){while(--_0x321e68){_0x25edb4['push'](_0x25edb4['shift']());}};_0x1d11df(++_0x467ab3);}(_0xaec7,0x1ca));var _0x7aec=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xaec7[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0x7aec('0x0'));var rtq=require(_0x7aec('0x1'));var qs=require(_0x7aec('0x2'));var utils=require('../../config/utils');var db=require(_0x7aec('0x3'))['db'];var APIBadRequestError=require(_0x7aec('0x4'))['APIBadRequestError'];var APIHandleError=require(_0x7aec('0x4'))[_0x7aec('0x5')];function respondWithFilteredResult(_0x5d042b,_0x10e4ea){return function(_0x36d275){if(_0x36d275){var _0x417b10=typeof _0x10e4ea[_0x7aec('0x6')]==='undefined'&&typeof _0x10e4ea[_0x7aec('0x7')]===_0x7aec('0x8');var _0x31c730=_0x36d275['count'];var _0x1cbb66=_0x417b10?0x0:_0x10e4ea[_0x7aec('0x6')];var _0x2e99c7=_0x417b10?_0x36d275[_0x7aec('0x9')]:_0x10e4ea[_0x7aec('0x6')]+_0x10e4ea['limit'];var _0x561ca6;if(_0x2e99c7>=_0x31c730){_0x2e99c7=_0x31c730;_0x561ca6=0xc8;}else{_0x561ca6=0xce;}_0x5d042b[_0x7aec('0xa')](_0x561ca6);return _0x5d042b[_0x7aec('0xb')](_0x7aec('0xc'),_0x1cbb66+'-'+_0x2e99c7+'/'+_0x31c730)[_0x7aec('0xd')](_0x36d275);}return null;};}exports[_0x7aec('0xe')]=function(_0x53e46d,_0x36d203){var _0xfd201e={'count':0x0,'rows':[]};var _0x3652f6={};var _0x5649f4;var _0x278e10=utils[_0x7aec('0xf')]();var _0x38dd36;var _0x852670;var _0x2c3e44=_0x53e46d['query'][_0x7aec('0x10')];var _0x227c28=_0x53e46d[_0x7aec('0x11')]['globalStatusFilter'];var _0x57ed45=_0x53e46d[_0x7aec('0x11')]['pauseTypeFilter'];var _0x1dbe68=_0x227c28===_0x7aec('0x12')||_0x227c28==='*pause'?!![]:![];var _0x2deaae=[];var _0x2b4c90;var _0x142932;Promise['resolve']()[_0x7aec('0x13')](function(){if(_0x53e46d[_0x7aec('0x11')]['channel']){if(!utils[_0x7aec('0x14')](_0x53e46d['query']['channel'])){throw new APIBadRequestError(util[_0x7aec('0x15')](_0x7aec('0x16'),_0x53e46d[_0x7aec('0x11')][_0x7aec('0x17')]));}_0x5649f4=_0x53e46d[_0x7aec('0x11')][_0x7aec('0x17')][_0x7aec('0x18')]();}if(!_0x53e46d[_0x7aec('0x11')][_0x7aec('0x19')]||!_0x53e46d[_0x7aec('0x11')][_0x7aec('0x19')]['includes'](_0x7aec('0x1a'))){_0x53e46d['query'][_0x7aec('0x19')]=rta[_0x7aec('0x1b')](_0x53e46d[_0x7aec('0x11')][_0x7aec('0x19')]);return;}var _0x3786c7=rta[_0x7aec('0x1c')](_0x53e46d[_0x7aec('0x11')][_0x7aec('0x19')]);_0x53e46d[_0x7aec('0x11')][_0x7aec('0x19')]=_0x3786c7['fields'][_0x7aec('0x1d')](',');_0x2b4c90=_0x3786c7[_0x7aec('0x1e')];})[_0x7aec('0x13')](function(){if(!_0x2c3e44){return[];}return rta[_0x7aec('0x1f')](_0x2c3e44,_0x5649f4);})[_0x7aec('0x13')](function(_0x5d2884){_0x2deaae=_0x5d2884;return rta[_0x7aec('0x20')]();})[_0x7aec('0x13')](function(_0x2fbca8){_0x852670=_0x2fbca8[_0x7aec('0x21')];if((!_0x227c28||_0x1dbe68)&&!_0x2b4c90){return _0x2deaae;}if(_0x2b4c90&&!_0x227c28){return rta[_0x7aec('0x22')](_0x852670,_0x2deaae,_0x2b4c90);}else{return rta['getAgentIdsByStatus'](_0x852670,_0x2deaae,_0x227c28);}})['then'](function(_0x9384e){_0x2deaae=_0x9384e;var _0x532395=![];if(_0x2deaae[_0x7aec('0x23')]===0x0){if(_0x2c3e44||_0x227c28){_0x532395=!![];}if(_0x1dbe68){_0x532395=![];}}if(_0x532395){return _0xfd201e;}var _0x28ec4f=_[_0x7aec('0x24')](db[_0x7aec('0x25')]['rawAttributes'],function(_0x75278f){return{'name':_0x75278f[_0x7aec('0x26')],'type':_0x75278f[_0x7aec('0x27')][_0x7aec('0x28')]};});_0x53e46d[_0x7aec('0x11')]['role']=_0x7aec('0x29');_0x3652f6=qs[_0x7aec('0x2a')](_0x28ec4f,_0x53e46d);_0x3652f6[_0x7aec('0x2b')]=!![];var _0x17d224=[];if(_0x2deaae[_0x7aec('0x23')]>0x0){_0x17d224[_0x7aec('0x2c')]({'id':{'$in':_0x2deaae}});if(_0x2b4c90&&!_0x227c28){_0x142932=[db[_0x7aec('0x2d')]['literal'](_0x7aec('0x2e')+_0x2deaae+')')];_0x3652f6['order']=_0x142932;}}if(_0x1dbe68){_0x278e10[_0x7aec('0x2f')](function(_0x479396){var _0x40c051=!![];if(_0x227c28===_0x7aec('0x30')&&_0x5649f4!==_0x479396){_0x40c051=![];}_0x17d224[_0x7aec('0x2c')]({[_0x479396+_0x7aec('0x31')]:_0x40c051});});if(_0x57ed45){_0x17d224[_0x7aec('0x2c')]({'pauseType':_0x57ed45});}}else if(_0x227c28){_0x278e10['forEach'](function(_0x54fb85){_0x17d224[_0x7aec('0x2c')]({[_0x54fb85+'Pause']:![]});});}_0x3652f6['where']=_['merge'](_0x3652f6['where'],{'$and':_0x17d224});if(_0x53e46d[_0x7aec('0x32')][_0x7aec('0x33')]==='user'){var _0x4c8b70={'params':{'id':_0x53e46d[_0x7aec('0x32')][_0x7aec('0x34')]},'query':{'section':_0x7aec('0x35'),'role':_0x7aec('0x29'),'raw':!![],'ids':_0x2deaae,'customSorting':_0x142932}};if(_0x53e46d[_0x7aec('0x11')][_0x7aec('0x36')]){_0x4c8b70[_0x7aec('0x11')][_0x7aec('0x36')]=!![];}if(_0x1dbe68){_0x4c8b70[_0x7aec('0x11')][_0x7aec('0x37')]=_0x17d224;}_0x4c8b70['query']=Object[_0x7aec('0x38')](_0x4c8b70[_0x7aec('0x11')],_0x53e46d[_0x7aec('0x11')]);return db[_0x7aec('0x39')]['getResources'](_0x4c8b70);}return db[_0x7aec('0x25')][_0x7aec('0x3a')](_0x3652f6);})[_0x7aec('0x13')](function(_0x4f9938){_0xfd201e[_0x7aec('0x9')]=_0x4f9938[_0x7aec('0x9')];_0x38dd36=_0x4f9938['rows'];return _0x38dd36[_0x7aec('0x24')](function(_0xefc2fe){var _0x51868a=_[_0x7aec('0x3b')](_0x852670,['id',_0xefc2fe['id']]);if(_0x51868a){var _0x3178f7=rta['filterAgentAttributes'](_0x51868a);_[_0x7aec('0x3c')](_0xefc2fe,_0x3178f7);}_0xefc2fe['globalStatus']=rta[_0x7aec('0x3d')](_0xefc2fe);if(_0xefc2fe[_0x7aec('0x1a')][_0x7aec('0x3e')](_0x7aec('0x12'))){_0x278e10[_0x7aec('0x2f')](function(_0x86e0db){if(_0xefc2fe[_0x86e0db+_0x7aec('0x31')]){if(_0x86e0db===_0x7aec('0x3f')){if(_0xefc2fe[_0x7aec('0x40')]!==_0x7aec('0x41')){_0xefc2fe[_0x7aec('0x40')]=_0x7aec('0x12');}}else{_0xefc2fe[_0x86e0db+_0x7aec('0x42')]='pause';}}});}return _0xefc2fe;});})[_0x7aec('0x13')](function(_0x511a57){if(!_0x2b4c90||_0x142932){return _0x511a57;}return rta['sortAgentsByStatus'](_0x511a57,_0x2b4c90);})[_0x7aec('0x13')](function(_0x378c86){var _0x59b9f9=rta[_0x7aec('0x43')]();_0xfd201e['rows']=_0x378c86['map'](function(_0x1104ef){return _[_0x7aec('0x44')](_0x1104ef,_0x59b9f9);});return _0xfd201e;})['then'](respondWithFilteredResult(_0x36d203,_0x3652f6))[_0x7aec('0x45')](APIHandleError(_0x36d203));};exports[_0x7aec('0x46')]=function(_0x57f0c4,_0x1328e6){var _0x48340d={'count':0x0,'rows':[]};var _0x54aa25={};var _0x56fcbc;var _0x308646;var _0x48b16c;Promise[_0x7aec('0x47')]()['then'](function(){if(_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x17')]){if(!utils['isValidChannel'](_0x57f0c4['query'][_0x7aec('0x17')])){throw new APIBadRequestError(util[_0x7aec('0x15')](_0x7aec('0x16'),_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x17')]));}_0x56fcbc=_0x57f0c4['query']['channel'][_0x7aec('0x18')]();}var _0x50f4ef=_['startCase'](_0x56fcbc)+_0x7aec('0x48');var _0x1dbfbd=_[_0x7aec('0x24')](db[_0x50f4ef][_0x7aec('0x49')],function(_0xd3d373){return{'name':_0xd3d373[_0x7aec('0x26')],'type':_0xd3d373['type'][_0x7aec('0x28')]};});if(!_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x4a')]){var _0x515480=['id',_0x7aec('0x4b')];if(_0x56fcbc===_0x7aec('0x3f')){_0x515480[_0x7aec('0x2c')](_0x7aec('0x27'));if(_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x27')]===_0x7aec('0x4c')){_0x515480[_0x7aec('0x2c')](['dialActive','dialMethod']);}}_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x4a')]=_0x515480[_0x7aec('0x1d')](',');}_0x54aa25=qs[_0x7aec('0x2a')](_0x1dbfbd,_0x57f0c4);if(_0x57f0c4[_0x7aec('0x32')]['role']==='user'){var _0x2e3507={'params':{'id':_0x57f0c4[_0x7aec('0x32')][_0x7aec('0x34')]},'query':{'section':_0x56fcbc===_0x7aec('0x3f')&&_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x27')]===_0x7aec('0x4c')?_0x7aec('0x4d'):_['startCase'](_0x56fcbc)+_0x7aec('0x4e'),'type':_0x57f0c4[_0x7aec('0x11')][_0x7aec('0x27')],'nolimit':!![],'sort':_0x7aec('0x4b'),'filter':_0x57f0c4[_0x7aec('0x11')]['filter']}};_0x2e3507[_0x7aec('0x11')]=Object[_0x7aec('0x38')](_0x2e3507[_0x7aec('0x11')],_0x57f0c4[_0x7aec('0x11')]);delete _0x2e3507['query']['id'];return db[_0x7aec('0x39')][_0x7aec('0x4f')](_0x2e3507);}return db[_0x50f4ef][_0x7aec('0x3a')](_0x54aa25);})[_0x7aec('0x13')](function(_0x48030d){_0x48340d[_0x7aec('0x9')]=_0x48030d[_0x7aec('0x9')];_0x308646=_0x48030d['rows'];return rtq[_0x7aec('0x50')](_0x57f0c4,_0x56fcbc);})['then'](function(_0x31108c){_0x48b16c=_0x31108c[_0x7aec('0x21')];return rtq[_0x7aec('0x51')](_0x308646,_0x48b16c,_0x56fcbc,_0x57f0c4[_0x7aec('0x11')]['type']);})[_0x7aec('0x13')](function(_0x361f42){_0x48340d[_0x7aec('0x21')]=_0x361f42;return _0x48340d;})[_0x7aec('0x13')](respondWithFilteredResult(_0x1328e6,_0x54aa25))['catch'](APIHandleError(_0x1328e6));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 16e9420..4444a4d 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x233ef0,_0x5bb5ed){var _0x58c405=function(_0x1f43f7){while(--_0x1f43f7){_0x233ef0['push'](_0x233ef0['shift']());}};_0x58c405(++_0x5bb5ed);}(_0xe706,0xa3));var _0x6e70=function(_0x192ec2,_0xc3a237){_0x192ec2=_0x192ec2-0x0;var _0x4abd11=_0xe706[_0x192ec2];return _0x4abd11;};'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(_0x1f610c,_0x1b9392){var _0x527782=function(_0x180042){while(--_0x180042){_0x1f610c['push'](_0x1f610c['shift']());}};_0x527782(++_0x1b9392);}(_0x70e0,0x17b));var _0x070e=function(_0x26adb2,_0x7bb3f8){_0x26adb2=_0x26adb2-0x0;var _0x39b09b=_0x70e0[_0x26adb2];return _0x39b09b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9308c37..6380268 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 _0x1298=['DATE','INTEGER','exports','STRING'];(function(_0x5c8fc3,_0x1cb71a){var _0x262ac7=function(_0x1e0dc7){while(--_0x1e0dc7){_0x5c8fc3['push'](_0x5c8fc3['shift']());}};_0x262ac7(++_0x1cb71a);}(_0x1298,0x19e));var _0x8129=function(_0x5a278b,_0x31cf6a){_0x5a278b=_0x5a278b-0x0;var _0x280554=_0x1298[_0x5a278b];return _0x280554;};'use strict';var Sequelize=require('sequelize');module[_0x8129('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8129('0x1')]},'scheduledat':{'type':Sequelize[_0x8129('0x2')]},'uniqueid':{'type':Sequelize[_0x8129('0x1')]},'starttime':{'type':Sequelize[_0x8129('0x2')]},'responsetime':{'type':Sequelize[_0x8129('0x2')]},'ringtime':{'type':Sequelize[_0x8129('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x8129('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8129('0x1')]}}; \ No newline at end of file +var _0x5d58=['INTEGER','STRING','DATE'];(function(_0x5f71e5,_0x315165){var _0x35863b=function(_0x2be05f){while(--_0x2be05f){_0x5f71e5['push'](_0x5f71e5['shift']());}};_0x35863b(++_0x315165);}(_0x5d58,0x187));var _0x85d5=function(_0x4b82c2,_0x5f70eb){_0x4b82c2=_0x4b82c2-0x0;var _0x473e6e=_0x5d58[_0x4b82c2];return _0x473e6e;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x85d5('0x0')]},'starttime':{'type':Sequelize[_0x85d5('0x1')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x85d5('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x85d5('0x0')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x85d5('0x0')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 0b46fb4..73f87ed 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 _0x101f=['define','report_agent_preview','lodash','util','api','moment','path','./reportAgentPreview.attributes','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x101f,0x92));var _0xf101=function(_0xc47d86,_0x5de3dd){_0xc47d86=_0xc47d86-0x0;var _0x951916=_0x101f[_0xc47d86];return _0x951916;};'use strict';var _=require(_0xf101('0x0'));var util=require(_0xf101('0x1'));var logger=require('../../config/logger')(_0xf101('0x2'));var moment=require(_0xf101('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf101('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf101('0x5'));module[_0xf101('0x6')]=function(_0x5501eb,_0x36205c){return _0x5501eb[_0xf101('0x7')]('ReportAgentPreview',attributes,{'tableName':_0xf101('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x190c=['ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x302c75,_0x3701e7){var _0x473a4d=function(_0x117dbb){while(--_0x117dbb){_0x302c75['push'](_0x302c75['shift']());}};_0x473a4d(++_0x3701e7);}(_0x190c,0xde));var _0xc190=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0x190c[_0x2daef6];return _0x62d030;};'use strict';var _=require('lodash');var util=require(_0xc190('0x0'));var logger=require(_0xc190('0x1'))(_0xc190('0x2'));var moment=require(_0xc190('0x3'));var BPromise=require(_0xc190('0x4'));var rp=require(_0xc190('0x5'));var fs=require('fs');var path=require(_0xc190('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xc190('0x7')]=function(_0x4c0a24,_0x55d46d){return _0x4c0a24['define'](_0xc190('0x8'),attributes,{'tableName':_0xc190('0x9'),'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 6a6ce4d..80cd4dc 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 _0xb810=['options','raw','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body'];(function(_0xe97e4c,_0x486a93){var _0x2a2f09=function(_0x4a7575){while(--_0x4a7575){_0xe97e4c['push'](_0xe97e4c['shift']());}};_0x2a2f09(++_0x486a93);}(_0xb810,0x8a));var _0x0b81=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb810[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x0b81('0x0'));var moment=require(_0x0b81('0x1'));var BPromise=require(_0x0b81('0x2'));var rs=require(_0x0b81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b81('0x4'))['db'];var utils=require(_0x0b81('0x5'));var logger=require(_0x0b81('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0b81('0x7'));var client=jayson[_0x0b81('0x8')][_0x0b81('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f64d7,_0x368955,_0x41ca94){return new BPromise(function(_0x14cf43,_0xd52c13){return client['request'](_0x2f64d7,_0x41ca94)[_0x0b81('0xa')](function(_0x1fed9b){logger[_0x0b81('0xb')](_0x0b81('0xc'),_0x368955,'request\x20sent');logger[_0x0b81('0xd')](_0x0b81('0xe'),_0x368955,_0x0b81('0xf'),JSON[_0x0b81('0x10')](_0x1fed9b));if(_0x1fed9b[_0x0b81('0x11')]){if(_0x1fed9b[_0x0b81('0x11')]['code']===0x1f4){logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);return _0xd52c13(_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);}logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);return _0x14cf43(_0x1fed9b[_0x0b81('0x11')][_0x0b81('0x12')]);}else{logger[_0x0b81('0xb')](_0x0b81('0xc'),_0x368955,_0x0b81('0xf'));_0x14cf43(_0x1fed9b[_0x0b81('0x13')][_0x0b81('0x12')]);}})['catch'](function(_0x1d7a47){logger[_0x0b81('0x11')](_0x0b81('0xc'),_0x368955,_0x1d7a47);_0xd52c13(_0x1d7a47);});});}exports[_0x0b81('0x14')]=function(_0x1809db){var _0x1cfe2a=this;return new Promise(function(_0x279a69,_0x214b83){return db[_0x0b81('0x15')][_0x0b81('0x16')](_0x1809db[_0x0b81('0x17')],{'raw':_0x1809db['options']?_0x1809db[_0x0b81('0x18')][_0x0b81('0x19')]===undefined?!![]:![]:!![]})[_0x0b81('0xa')](function(_0x1e4b93){logger['info'](_0x0b81('0x14'),_0x1809db);logger[_0x0b81('0xd')](_0x0b81('0x14'),_0x1809db,JSON[_0x0b81('0x10')](_0x1e4b93));_0x279a69(_0x1e4b93);})[_0x0b81('0x1a')](function(_0x546b39){logger[_0x0b81('0x11')]('CreateReportAgentPreview',_0x546b39[_0x0b81('0x12')],_0x1809db);_0x214b83(_0x1cfe2a[_0x0b81('0x11')](0x1f4,_0x546b39['message']));});});}; \ No newline at end of file +var _0xb2c7=['ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','debug','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xb2c7,0x87));var _0x7b2c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2c7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7b2c('0x0'));var util=require(_0x7b2c('0x1'));var moment=require(_0x7b2c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7b2c('0x4'))(_0x7b2c('0x5'));var config=require(_0x7b2c('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b2c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e8baf,_0x150634,_0x3921cc){return new BPromise(function(_0x31779e,_0xd59d6){return client['request'](_0x1e8baf,_0x3921cc)[_0x7b2c('0x8')](function(_0x3da938){logger[_0x7b2c('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x150634,_0x7b2c('0xa'));logger['debug'](_0x7b2c('0xb'),_0x150634,'request\x20sent',JSON[_0x7b2c('0xc')](_0x3da938));if(_0x3da938['error']){if(_0x3da938[_0x7b2c('0xd')][_0x7b2c('0xe')]===0x1f4){logger[_0x7b2c('0xd')](_0x7b2c('0xf'),_0x150634,_0x3da938[_0x7b2c('0xd')][_0x7b2c('0x10')]);return _0xd59d6(_0x3da938['error'][_0x7b2c('0x10')]);}logger[_0x7b2c('0xd')](_0x7b2c('0xf'),_0x150634,_0x3da938[_0x7b2c('0xd')][_0x7b2c('0x10')]);return _0x31779e(_0x3da938[_0x7b2c('0xd')][_0x7b2c('0x10')]);}else{logger[_0x7b2c('0x9')](_0x7b2c('0xf'),_0x150634,'request\x20sent');_0x31779e(_0x3da938[_0x7b2c('0x11')]['message']);}})[_0x7b2c('0x12')](function(_0xa1c70c){logger[_0x7b2c('0xd')](_0x7b2c('0xf'),_0x150634,_0xa1c70c);_0xd59d6(_0xa1c70c);});});}exports[_0x7b2c('0x13')]=function(_0x255163){var _0x1c713f=this;return new Promise(function(_0x4807f6,_0x47fc6e){return db[_0x7b2c('0x14')][_0x7b2c('0x15')](_0x255163[_0x7b2c('0x16')],{'raw':_0x255163[_0x7b2c('0x17')]?_0x255163[_0x7b2c('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7b2c('0x8')](function(_0x3039fc){logger[_0x7b2c('0x9')]('CreateReportAgentPreview',_0x255163);logger[_0x7b2c('0x18')](_0x7b2c('0x13'),_0x255163,JSON[_0x7b2c('0xc')](_0x3039fc));_0x4807f6(_0x3039fc);})[_0x7b2c('0x12')](function(_0x304b86){logger['error'](_0x7b2c('0x13'),_0x304b86[_0x7b2c('0x10')],_0x255163);_0x47fc6e(_0x1c713f[_0x7b2c('0xd')](0x1f4,_0x304b86[_0x7b2c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b6fa61b..c7c852d 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 _0x937f=['showWhatsappQueues','agentNotify','exports','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','queueNotify','chat','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id'];(function(_0x308d9f,_0x36733d){var _0x2bfbe8=function(_0x43cb64){while(--_0x43cb64){_0x308d9f['push'](_0x308d9f['shift']());}};_0x2bfbe8(++_0x36733d);}(_0x937f,0x175));var _0xf937=function(_0x41232a,_0x20440d){_0x41232a=_0x41232a-0x0;var _0x1ab731=_0x937f[_0x41232a];return _0x1ab731;};'use strict';var multer=require(_0xf937('0x0'));var util=require('util');var path=require(_0xf937('0x1'));var express=require(_0xf937('0x2'));var router=express[_0xf937('0x3')]();var auth=require(_0xf937('0x4'));var controller=require(_0xf937('0x5'));router[_0xf937('0x6')]('/voice/channels',auth[_0xf937('0x7')](),controller['voiceChannels']);router[_0xf937('0x6')](_0xf937('0x8'),auth[_0xf937('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0xf937('0x9'),auth[_0xf937('0x7')](),controller['voiceChannelStopMixMonitor']);router['get'](_0xf937('0xa'),auth[_0xf937('0x7')](),controller[_0xf937('0xb')]);router['get'](_0xf937('0xc'),auth['isAuthenticated'](),controller[_0xf937('0xd')]);router[_0xf937('0x6')]('/mail/queues',auth[_0xf937('0x7')](),controller[_0xf937('0xe')]);router[_0xf937('0x6')]('/mail/accounts',auth[_0xf937('0x7')](),controller[_0xf937('0xf')]);router[_0xf937('0x6')](_0xf937('0x10'),auth[_0xf937('0x7')](),controller[_0xf937('0x11')]);router[_0xf937('0x6')](_0xf937('0x12'),auth[_0xf937('0x7')](),controller[_0xf937('0x13')]);router[_0xf937('0x6')](_0xf937('0x14'),auth[_0xf937('0x7')](),controller['whatsappQueues']);router[_0xf937('0x6')](_0xf937('0x15'),auth[_0xf937('0x7')](),controller[_0xf937('0x16')]);router[_0xf937('0x6')](_0xf937('0x17'),auth[_0xf937('0x7')](),controller['voiceQueuesPreview']);router[_0xf937('0x6')](_0xf937('0x18'),auth[_0xf937('0x7')](),controller[_0xf937('0x19')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid',auth[_0xf937('0x7')](),controller[_0xf937('0x1a')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xf937('0x1b')]);router[_0xf937('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf937('0x7')](),controller[_0xf937('0x1c')]);router[_0xf937('0x6')](_0xf937('0x1d'),auth[_0xf937('0x7')](),controller[_0xf937('0x1e')]);router['put'](_0xf937('0x1d'),auth[_0xf937('0x7')](),controller['updateVoiceQueue']);router[_0xf937('0x6')](_0xf937('0x1f'),auth[_0xf937('0x7')](),controller[_0xf937('0x20')]);router[_0xf937('0x6')](_0xf937('0x21'),auth[_0xf937('0x7')](),controller[_0xf937('0x22')]);router[_0xf937('0x6')]('/agents',auth[_0xf937('0x7')](),controller['agents']);router['put'](_0xf937('0x23'),auth[_0xf937('0x7')](),controller['agentCapacity']);router[_0xf937('0x6')](_0xf937('0x24'),auth[_0xf937('0x7')](),controller['telephones']);router['get'](_0xf937('0x25'),auth[_0xf937('0x7')](),controller[_0xf937('0x26')]);router[_0xf937('0x6')](_0xf937('0x27'),auth[_0xf937('0x7')](),controller[_0xf937('0x28')]);router[_0xf937('0x6')](_0xf937('0x29'),auth[_0xf937('0x7')](),controller[_0xf937('0x2a')]);router['get'](_0xf937('0x2b'),auth[_0xf937('0x7')](),controller[_0xf937('0x2c')]);router[_0xf937('0x6')](_0xf937('0x2d'),auth[_0xf937('0x7')](),controller[_0xf937('0x2e')]);router['get'](_0xf937('0x2f'),auth['isAuthenticated'](),controller[_0xf937('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xf937('0x31')]);router[_0xf937('0x6')]('/sms/queues/waitinginteractions',auth[_0xf937('0x7')](),controller[_0xf937('0x32')]);router[_0xf937('0x6')](_0xf937('0x33'),auth[_0xf937('0x7')](),controller[_0xf937('0x34')]);router[_0xf937('0x6')](_0xf937('0x35'),auth[_0xf937('0x7')](),controller[_0xf937('0x36')]);router['post'](_0xf937('0x37'),auth[_0xf937('0x7')](),controller['queueNotify'](_0xf937('0x38')));router[_0xf937('0x6')](_0xf937('0x39'),auth[_0xf937('0x7')](),controller['showMailQueues']);router[_0xf937('0x3a')](_0xf937('0x3b'),auth[_0xf937('0x7')](),controller[_0xf937('0x3c')](_0xf937('0x3d')));router[_0xf937('0x6')]('/chat/queues/:id',auth[_0xf937('0x7')](),controller['showChatQueues']);router[_0xf937('0x3a')](_0xf937('0x3e'),auth[_0xf937('0x7')](),controller['queueNotify']('fax'));router[_0xf937('0x6')](_0xf937('0x3f'),auth[_0xf937('0x7')](),controller[_0xf937('0x40')]);router[_0xf937('0x3a')](_0xf937('0x41'),auth['isAuthenticated'](),controller[_0xf937('0x3c')]('openchannel'));router[_0xf937('0x6')](_0xf937('0x42'),auth[_0xf937('0x7')](),controller['showOpenchannelQueues']);router[_0xf937('0x3a')](_0xf937('0x43'),auth[_0xf937('0x7')](),controller[_0xf937('0x3c')]('sms'));router[_0xf937('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xf937('0x7')](),controller[_0xf937('0x3c')](_0xf937('0x44')));router[_0xf937('0x6')]('/sms/queues/:id',auth[_0xf937('0x7')](),controller[_0xf937('0x45')]);router[_0xf937('0x6')](_0xf937('0x46'),auth[_0xf937('0x7')](),controller[_0xf937('0x47')]);router['post']('/agents/:id/notify',auth[_0xf937('0x7')](),controller[_0xf937('0x48')]);module[_0xf937('0x49')]=router; \ No newline at end of file +var _0x9a87=['/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor'];(function(_0x59729b,_0x2ad058){var _0x61ae20=function(_0x16c6ee){while(--_0x16c6ee){_0x59729b['push'](_0x59729b['shift']());}};_0x61ae20(++_0x2ad058);}(_0x9a87,0x144));var _0x79a8=function(_0x410c18,_0x5ade20){_0x410c18=_0x410c18-0x0;var _0x44edf6=_0x9a87[_0x410c18];return _0x44edf6;};'use strict';var multer=require('multer');var util=require(_0x79a8('0x0'));var path=require(_0x79a8('0x1'));var express=require(_0x79a8('0x2'));var router=express[_0x79a8('0x3')]();var auth=require(_0x79a8('0x4'));var controller=require('./rpc.controller');router[_0x79a8('0x5')](_0x79a8('0x6'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x8')]);router[_0x79a8('0x5')](_0x79a8('0x9'),auth['isAuthenticated'](),controller[_0x79a8('0xa')]);router[_0x79a8('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x79a8('0x7')](),controller[_0x79a8('0xb')]);router[_0x79a8('0x5')](_0x79a8('0xc'),auth[_0x79a8('0x7')](),controller[_0x79a8('0xd')]);router['get'](_0x79a8('0xe'),auth[_0x79a8('0x7')](),controller['chatQueues']);router['get'](_0x79a8('0xf'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x10')]);router[_0x79a8('0x5')](_0x79a8('0x11'),auth[_0x79a8('0x7')](),controller['mailAccounts']);router[_0x79a8('0x5')](_0x79a8('0x12'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x13')]);router[_0x79a8('0x5')](_0x79a8('0x14'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x15')]);router[_0x79a8('0x5')](_0x79a8('0x16'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x17')]);router['get'](_0x79a8('0x18'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x19')]);router[_0x79a8('0x5')](_0x79a8('0x1a'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x1b')]);router[_0x79a8('0x5')](_0x79a8('0x1c'),auth[_0x79a8('0x7')](),controller['voiceQueuesChannels']);router[_0x79a8('0x5')](_0x79a8('0x1d'),auth['isAuthenticated'](),controller[_0x79a8('0x1e')]);router[_0x79a8('0x5')](_0x79a8('0x1f'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x20')]);router[_0x79a8('0x5')](_0x79a8('0x21'),auth['isAuthenticated'](),controller[_0x79a8('0x22')]);router[_0x79a8('0x5')](_0x79a8('0x23'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x24')]);router[_0x79a8('0x25')](_0x79a8('0x23'),auth[_0x79a8('0x7')](),controller['updateVoiceQueue']);router[_0x79a8('0x5')]('/outbound',auth[_0x79a8('0x7')](),controller[_0x79a8('0x26')]);router['get'](_0x79a8('0x27'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x28')]);router[_0x79a8('0x5')](_0x79a8('0x29'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x2a')]);router[_0x79a8('0x25')]('/agents/:id/capacity',auth[_0x79a8('0x7')](),controller[_0x79a8('0x2b')]);router['get'](_0x79a8('0x2c'),auth['isAuthenticated'](),controller['telephones']);router[_0x79a8('0x5')]('/trunks',auth[_0x79a8('0x7')](),controller[_0x79a8('0x2d')]);router[_0x79a8('0x5')](_0x79a8('0x2e'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x2f')]);router[_0x79a8('0x5')]('/fax/accounts',auth[_0x79a8('0x7')](),controller[_0x79a8('0x30')]);router[_0x79a8('0x5')](_0x79a8('0x31'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x32')]);router['get'](_0x79a8('0x33'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x34')]);router[_0x79a8('0x5')](_0x79a8('0x35'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x36')]);router[_0x79a8('0x5')](_0x79a8('0x37'),auth[_0x79a8('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x79a8('0x5')]('/sms/queues/waitinginteractions',auth[_0x79a8('0x7')](),controller[_0x79a8('0x38')]);router[_0x79a8('0x5')]('/whatsapp/queues/waitinginteractions',auth[_0x79a8('0x7')](),controller[_0x79a8('0x39')]);router['get'](_0x79a8('0x3a'),auth[_0x79a8('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x79a8('0x3b')](_0x79a8('0x3c'),auth[_0x79a8('0x7')](),controller['queueNotify'](_0x79a8('0x3d')));router['get'](_0x79a8('0x3e'),auth['isAuthenticated'](),controller[_0x79a8('0x3f')]);router[_0x79a8('0x3b')](_0x79a8('0x40'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x41')](_0x79a8('0x42')));router[_0x79a8('0x5')](_0x79a8('0x43'),auth['isAuthenticated'](),controller[_0x79a8('0x44')]);router[_0x79a8('0x3b')](_0x79a8('0x45'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x41')](_0x79a8('0x46')));router[_0x79a8('0x5')]('/fax/queues/:id',auth[_0x79a8('0x7')](),controller[_0x79a8('0x47')]);router['post'](_0x79a8('0x48'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x41')](_0x79a8('0x49')));router[_0x79a8('0x5')](_0x79a8('0x4a'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x4b')]);router['post']('/sms/queues/:id/notify',auth[_0x79a8('0x7')](),controller[_0x79a8('0x41')](_0x79a8('0x4c')));router['post'](_0x79a8('0x4d'),auth['isAuthenticated'](),controller[_0x79a8('0x41')]('whatsapp'));router[_0x79a8('0x5')](_0x79a8('0x4e'),auth[_0x79a8('0x7')](),controller['showSmsQueues']);router[_0x79a8('0x5')](_0x79a8('0x4f'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x50')]);router['post'](_0x79a8('0x51'),auth[_0x79a8('0x7')](),controller[_0x79a8('0x52')]);module[_0x79a8('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5681af4..ec4dbe5 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 _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(_0x1c978f,_0x5d0883){var _0x177929=function(_0x399143){while(--_0x399143){_0x1c978f['push'](_0x1c978f['shift']());}};_0x177929(++_0x5d0883);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 +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(_0x1087a0,_0xca735e){var _0x193f20=function(_0xd38146){while(--_0xd38146){_0x1087a0['push'](_0x1087a0['shift']());}};_0x193f20(++_0xca735e);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1e04,_0x1b7b69){_0x3b1e04=_0x3b1e04-0x0;var _0x4b6fa0=_0xe706[_0x3b1e04];return _0x4b6fa0;};'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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d3691be..26d8c39 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 _0x5282=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5282,0xc8));var _0x2528=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x5282[_0x4536a4];return _0x4fd1c1;};'use strict';var multer=require(_0x2528('0x0'));var util=require(_0x2528('0x1'));var path=require(_0x2528('0x2'));var timeout=require(_0x2528('0x3'));var express=require(_0x2528('0x4'));var router=express[_0x2528('0x5')]();var fs_extra=require(_0x2528('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2528('0x7'));var config=require(_0x2528('0x8'));var controller=require(_0x2528('0x9'));router[_0x2528('0xa')]('/',auth[_0x2528('0xb')](),controller[_0x2528('0xc')]);router[_0x2528('0xa')]('/:id',auth[_0x2528('0xb')](),controller[_0x2528('0xd')]);router[_0x2528('0xa')](_0x2528('0xe'),auth['isAuthenticated'](),controller[_0x2528('0xf')]);router[_0x2528('0x10')]('/',auth[_0x2528('0xb')](),controller[_0x2528('0x11')]);router['put'](_0x2528('0x12'),auth[_0x2528('0xb')](),controller[_0x2528('0x13')]);router['delete'](_0x2528('0x12'),auth['isAuthenticated'](),controller[_0x2528('0x14')]);module[_0x2528('0x15')]=router; \ No newline at end of file +var _0x064c=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','put','/:id','destroy','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x064c,0x11c));var _0xc064=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x064c[_0x5ce3c8];return _0xa76867;};'use strict';var multer=require(_0xc064('0x0'));var util=require(_0xc064('0x1'));var path=require(_0xc064('0x2'));var timeout=require(_0xc064('0x3'));var express=require(_0xc064('0x4'));var router=express[_0xc064('0x5')]();var fs_extra=require(_0xc064('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc064('0x7'));var controller=require(_0xc064('0x8'));router[_0xc064('0x9')]('/',auth[_0xc064('0xa')](),controller[_0xc064('0xb')]);router[_0xc064('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc064('0xc')]);router[_0xc064('0x9')](_0xc064('0xd'),auth[_0xc064('0xa')](),controller[_0xc064('0xe')]);router[_0xc064('0xf')]('/',auth[_0xc064('0xa')](),controller['create']);router[_0xc064('0x10')]('/:id',auth[_0xc064('0xa')](),controller['update']);router['delete'](_0xc064('0x11'),auth[_0xc064('0xa')](),controller[_0xc064('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index cff3edb..218726b 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 _0x1247=['months','weeks','hours','days','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters'];(function(_0x4c184d,_0x4278ab){var _0x23d997=function(_0x22d068){while(--_0x22d068){_0x4c184d['push'](_0x4c184d['shift']());}};_0x23d997(++_0x4278ab);}(_0x1247,0xbe));var _0x7124=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x1247[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0x7124('0x0'));module[_0x7124('0x1')]={'name':{'type':Sequelize[_0x7124('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7124('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7124('0x2')],'allowNull':![],'defaultValue':_0x7124('0x4')},'startAt':{'type':Sequelize[_0x7124('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7124('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7124('0x7')](_0x7124('0x8'),_0x7124('0x9'),_0x7124('0xa'),_0x7124('0xb'),'days',_0x7124('0xc'),'minutes'),'allowNull':![],'defaultValue':_0x7124('0xd')},'output':{'type':Sequelize['ENUM'](_0x7124('0xe'),_0x7124('0xf'),_0x7124('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0x7124('0x11')),'allowNull':![],'defaultValue':_0x7124('0x12')},'sendMail':{'type':Sequelize[_0x7124('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x7124('0x13')]},'bcc':{'type':Sequelize[_0x7124('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x7124('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x338f=['sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','weeks','days','hours','minutes','pdf','xlsx','csv','custom','default','TEXT'];(function(_0x4b5d00,_0x417c50){var _0x11cedb=function(_0x406ed8){while(--_0x406ed8){_0x4b5d00['push'](_0x4b5d00['shift']());}};_0x11cedb(++_0x417c50);}(_0x338f,0xab));var _0xf338=function(_0x5aa1e2,_0x2b5adb){_0x5aa1e2=_0x5aa1e2-0x0;var _0x399098=_0x338f[_0x5aa1e2];return _0x399098;};'use strict';var Sequelize=require(_0xf338('0x0'));module[_0xf338('0x1')]={'name':{'type':Sequelize[_0xf338('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf338('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf338('0x2')],'allowNull':![],'defaultValue':_0xf338('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xf338('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf338('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf338('0x7')]('years',_0xf338('0x8'),'months',_0xf338('0x9'),_0xf338('0xa'),_0xf338('0xb'),_0xf338('0xc')),'allowNull':![],'defaultValue':_0xf338('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0xf338('0xd'),_0xf338('0xe')),'allowNull':![],'defaultValue':_0xf338('0xf')},'type':{'type':Sequelize[_0xf338('0x7')](_0xf338('0x10'),_0xf338('0x11')),'allowNull':![],'defaultValue':_0xf338('0x10')},'sendMail':{'type':Sequelize[_0xf338('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf338('0x2')]},'cc':{'type':Sequelize[_0xf338('0x12')]},'bcc':{'type':Sequelize[_0xf338('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xf338('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 a9572fa..6a69bb1 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 _0x58d1=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x58d1,0x1dc));var _0x158d=function(_0x3799cd,_0x131494){_0x3799cd=_0x3799cd-0x0;var _0x3410d3=_0x58d1[_0x3799cd];return _0x3410d3;};'use strict';var emlformat=require(_0x158d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x158d('0x1'));var jsonpatch=require(_0x158d('0x2'));var rp=require(_0x158d('0x3'));var moment=require(_0x158d('0x4'));var BPromise=require(_0x158d('0x5'));var Mustache=require(_0x158d('0x6'));var util=require('util');var path=require(_0x158d('0x7'));var sox=require(_0x158d('0x8'));var csv=require(_0x158d('0x9'));var ejs=require(_0x158d('0xa'));var fs=require('fs');var fs_extra=require(_0x158d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x158d('0xc'));var jsforce=require(_0x158d('0xd'));var deskjs=require(_0x158d('0xe'));var toCsv=require(_0x158d('0x9'));var querystring=require(_0x158d('0xf'));var Papa=require(_0x158d('0x10'));var Redis=require(_0x158d('0x11'));var authService=require(_0x158d('0x12'));var qs=require(_0x158d('0x13'));var as=require(_0x158d('0x14'));var hardwareService=require(_0x158d('0x15'));var logger=require(_0x158d('0x16'))('api');var utils=require(_0x158d('0x17'));var config=require(_0x158d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x158d('0x19'))['db'];function respondWithStatusCode(_0x42ed79,_0x25b311){_0x25b311=_0x25b311||0xcc;return function(_0xa4ed2f){if(_0xa4ed2f){return _0x42ed79[_0x158d('0x1a')](_0x25b311);}return _0x42ed79[_0x158d('0x1b')](_0x25b311)[_0x158d('0x1c')]();};}function respondWithResult(_0x2021ec,_0x506c65){_0x506c65=_0x506c65||0xc8;return function(_0x2c1e54){if(_0x2c1e54){return _0x2021ec['status'](_0x506c65)[_0x158d('0x1d')](_0x2c1e54);}};}function respondWithFilteredResult(_0x2a7a2a,_0x157384){return function(_0x5d5157){if(_0x5d5157){var _0x3dc804=typeof _0x157384[_0x158d('0x1e')]===_0x158d('0x1f')&&typeof _0x157384['limit']===_0x158d('0x1f');var _0x5550a7=_0x5d5157['count'];var _0x3e7628=_0x3dc804?0x0:_0x157384[_0x158d('0x1e')];var _0x617591=_0x3dc804?_0x5d5157['count']:_0x157384[_0x158d('0x1e')]+_0x157384[_0x158d('0x20')];var _0x3cf271;if(_0x617591>=_0x5550a7){_0x617591=_0x5550a7;_0x3cf271=0xc8;}else{_0x3cf271=0xce;}_0x2a7a2a[_0x158d('0x1b')](_0x3cf271);return _0x2a7a2a[_0x158d('0x21')](_0x158d('0x22'),_0x3e7628+'-'+_0x617591+'/'+_0x5550a7)[_0x158d('0x1d')](_0x5d5157);}return null;};}function patchUpdates(_0x10e54d){return function(_0xa9aea5){try{jsonpatch['apply'](_0xa9aea5,_0x10e54d,!![]);}catch(_0x3a50b5){return BPromise[_0x158d('0x23')](_0x3a50b5);}return _0xa9aea5[_0x158d('0x24')]();};}function saveUpdates(_0x1b78bf,_0x328d20){return function(_0x4cbe02){if(_0x4cbe02){return _0x4cbe02[_0x158d('0x25')](_0x1b78bf)['then'](function(_0x12e9e8){return _0x12e9e8;});}return null;};}function removeEntity(_0x757800,_0x3623c9){return function(_0x2ce398){if(_0x2ce398){return _0x2ce398['destroy']()[_0x158d('0x26')](function(){var _0x240f47=_0x2ce398[_0x158d('0x27')]({'plain':!![]});var _0x48082a='Scheduler';return db[_0x158d('0x28')][_0x158d('0x29')]({'where':{'type':_0x48082a,'resourceId':_0x240f47['id']}})[_0x158d('0x26')](function(){return _0x2ce398;});})[_0x158d('0x26')](function(){_0x757800[_0x158d('0x1b')](0xcc)[_0x158d('0x1c')]();});}};}function handleEntityNotFound(_0x122cc0,_0x503561){return function(_0x2e255c){if(!_0x2e255c){_0x122cc0['sendStatus'](0x194);}return _0x2e255c;};}function handleError(_0x223698,_0x514f04){_0x514f04=_0x514f04||0x1f4;return function(_0x892bda){logger[_0x158d('0x2a')](_0x892bda[_0x158d('0x2b')]);if(_0x892bda[_0x158d('0x2c')]){delete _0x892bda[_0x158d('0x2c')];}_0x223698[_0x158d('0x1b')](_0x514f04)[_0x158d('0x2d')](_0x892bda);};}exports[_0x158d('0x2e')]=function(_0x4ed741,_0x4754e8){var _0x318ede={},_0x78a935={},_0x1118dd={'count':0x0,'rows':[]};var _0x419192=_['map'](db[_0x158d('0x2f')][_0x158d('0x30')],function(_0x1aba99){return{'name':_0x1aba99[_0x158d('0x31')],'type':_0x1aba99[_0x158d('0x32')][_0x158d('0x33')]};});_0x78a935['model']=_['map'](_0x419192,'name');_0x78a935[_0x158d('0x34')]=_['keys'](_0x4ed741[_0x158d('0x34')]);_0x78a935[_0x158d('0x35')]=_[_0x158d('0x36')](_0x78a935[_0x158d('0x37')],_0x78a935[_0x158d('0x34')]);_0x318ede[_0x158d('0x38')]=_[_0x158d('0x36')](_0x78a935[_0x158d('0x37')],qs['fields'](_0x4ed741['query'][_0x158d('0x39')]));_0x318ede[_0x158d('0x38')]=_0x318ede[_0x158d('0x38')][_0x158d('0x3a')]?_0x318ede[_0x158d('0x38')]:_0x78a935['model'];if(!_0x4ed741[_0x158d('0x34')][_0x158d('0x3b')](_0x158d('0x3c'))){_0x318ede[_0x158d('0x20')]=qs['limit'](_0x4ed741[_0x158d('0x34')][_0x158d('0x20')]);_0x318ede['offset']=qs[_0x158d('0x1e')](_0x4ed741[_0x158d('0x34')]['offset']);}_0x318ede[_0x158d('0x3d')]=qs[_0x158d('0x3e')](_0x4ed741[_0x158d('0x34')][_0x158d('0x3e')]);_0x318ede[_0x158d('0x3f')]=qs[_0x158d('0x35')](_[_0x158d('0x40')](_0x4ed741[_0x158d('0x34')],_0x78a935[_0x158d('0x35')]),_0x419192);if(_0x4ed741[_0x158d('0x34')][_0x158d('0x41')]){_0x318ede['where']=_[_0x158d('0x42')](_0x318ede['where'],{'$or':_[_0x158d('0x43')](_0x419192,function(_0x4ef2fe){if(_0x4ef2fe[_0x158d('0x32')]!==_0x158d('0x44')){var _0x130d0c={};_0x130d0c[_0x4ef2fe[_0x158d('0x2c')]]={'$like':'%'+_0x4ed741[_0x158d('0x34')][_0x158d('0x41')]+'%'};return _0x130d0c;}})});}_0x318ede=_['merge']({},_0x318ede,_0x4ed741[_0x158d('0x45')]);var _0x14e4d6={'where':_0x318ede[_0x158d('0x3f')]};return db[_0x158d('0x2f')]['count'](_0x14e4d6)[_0x158d('0x26')](function(_0x15d7c8){_0x1118dd[_0x158d('0x46')]=_0x15d7c8;if(_0x4ed741['query'][_0x158d('0x47')]){_0x318ede[_0x158d('0x48')]=[{'all':!![]}];}return db[_0x158d('0x2f')][_0x158d('0x49')](_0x318ede);})[_0x158d('0x26')](function(_0x1ac035){_0x1118dd['rows']=_0x1ac035;return _0x1118dd;})[_0x158d('0x26')](respondWithFilteredResult(_0x4754e8,_0x318ede))[_0x158d('0x4a')](handleError(_0x4754e8,null));};exports[_0x158d('0x4b')]=function(_0xf86b1e,_0x58a999){var _0x168b87={'raw':![],'where':{'id':_0xf86b1e[_0x158d('0x4c')]['id']}},_0x5a813c={};_0x5a813c[_0x158d('0x37')]=_[_0x158d('0x4d')](db[_0x158d('0x2f')][_0x158d('0x30')]);_0x5a813c[_0x158d('0x34')]=_[_0x158d('0x4d')](_0xf86b1e[_0x158d('0x34')]);_0x5a813c[_0x158d('0x35')]=_[_0x158d('0x36')](_0x5a813c[_0x158d('0x37')],_0x5a813c[_0x158d('0x34')]);_0x168b87[_0x158d('0x38')]=_[_0x158d('0x36')](_0x5a813c[_0x158d('0x37')],qs[_0x158d('0x39')](_0xf86b1e[_0x158d('0x34')][_0x158d('0x39')]));_0x168b87['attributes']=_0x168b87['attributes'][_0x158d('0x3a')]?_0x168b87['attributes']:_0x5a813c[_0x158d('0x37')];if(_0xf86b1e[_0x158d('0x34')][_0x158d('0x47')]){_0x168b87[_0x158d('0x48')]=[{'all':!![]}];}_0x168b87=_[_0x158d('0x42')]({},_0x168b87,_0xf86b1e[_0x158d('0x45')]);return db['Schedule'][_0x158d('0x4e')](_0x168b87)[_0x158d('0x26')](handleEntityNotFound(_0x58a999,null))[_0x158d('0x26')](respondWithResult(_0x58a999,null))[_0x158d('0x4a')](handleError(_0x58a999,null));};exports[_0x158d('0x4f')]=function(_0x2bf6b0,_0x18d831){return db['Schedule'][_0x158d('0x4f')](_0x2bf6b0[_0x158d('0x50')],{})[_0x158d('0x26')](function(_0x531599){var _0x5c6bca=_0x2bf6b0[_0x158d('0x51')]['get']({'plain':!![]});if(!_0x5c6bca)throw new Error(_0x158d('0x52'));if(_0x5c6bca[_0x158d('0x53')]==='user'){var _0x48a780=_0x531599[_0x158d('0x27')]({'plain':!![]});var _0x52476d='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x52476d,'userProfileId':_0x5c6bca[_0x158d('0x54')]},'raw':!![]})['then'](function(_0x58fb27){if(_0x58fb27&&_0x58fb27[_0x158d('0x55')]===0x0){return db[_0x158d('0x28')][_0x158d('0x4f')]({'name':_0x48a780[_0x158d('0x2c')],'resourceId':_0x48a780['id'],'type':_0x58fb27['name'],'sectionId':_0x58fb27['id']},{})['then'](function(){return _0x531599;});}else{return _0x531599;}})[_0x158d('0x4a')](function(_0x389d67){logger[_0x158d('0x2a')](_0x158d('0x56'),_0x389d67);throw _0x389d67;});}return _0x531599;})[_0x158d('0x26')](respondWithResult(_0x18d831,0xc9))[_0x158d('0x4a')](handleError(_0x18d831,null));};exports['update']=function(_0x57db7c,_0x12b0da){if(_0x57db7c['body']['id']){delete _0x57db7c[_0x158d('0x50')]['id'];}return db[_0x158d('0x2f')][_0x158d('0x4e')]({'where':{'id':_0x57db7c[_0x158d('0x4c')]['id']}})[_0x158d('0x26')](handleEntityNotFound(_0x12b0da,null))['then'](saveUpdates(_0x57db7c[_0x158d('0x50')],null))[_0x158d('0x26')](respondWithResult(_0x12b0da,null))[_0x158d('0x4a')](handleError(_0x12b0da,null));};exports[_0x158d('0x29')]=function(_0x5c935d,_0x304f94){return db[_0x158d('0x2f')][_0x158d('0x4e')]({'where':{'id':_0x5c935d[_0x158d('0x4c')]['id']}})[_0x158d('0x26')](handleEntityNotFound(_0x304f94,null))[_0x158d('0x26')](removeEntity(_0x304f94,null))[_0x158d('0x4a')](handleError(_0x304f94,null));};exports[_0x158d('0x57')]=function(_0x2a059a,_0x26b492,_0xa99daa){var _0x363a4f=require(_0x158d('0x58'));return db['Schedule'][_0x158d('0x4e')]({'where':{'id':_0x2a059a[_0x158d('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x26b492,null))[_0x158d('0x26')](function(){_0x363a4f['run'](_0x2a059a[_0x158d('0x4c')]['id']);})[_0x158d('0x26')](respondWithStatusCode(_0x26b492,null))[_0x158d('0x4a')](handleError(_0x26b492,null));}; \ No newline at end of file +var _0xeebb=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','Scheduler','destroy','error','stack','name','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','VIRTUAL','filter','options','includeAll','rows','catch','show','rawAttributes','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','run','eml-format','rimraf'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xeebb,0x132));var _0xbeeb=function(_0x5ab3bb,_0x2d8b3c){_0x5ab3bb=_0x5ab3bb-0x0;var _0x3f54e7=_0xeebb[_0x5ab3bb];return _0x3f54e7;};'use strict';var emlformat=require(_0xbeeb('0x0'));var rimraf=require(_0xbeeb('0x1'));var zipdir=require(_0xbeeb('0x2'));var jsonpatch=require(_0xbeeb('0x3'));var rp=require(_0xbeeb('0x4'));var moment=require(_0xbeeb('0x5'));var BPromise=require(_0xbeeb('0x6'));var Mustache=require(_0xbeeb('0x7'));var util=require(_0xbeeb('0x8'));var path=require(_0xbeeb('0x9'));var sox=require('sox');var csv=require(_0xbeeb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeeb('0xb'));var crypto=require(_0xbeeb('0xc'));var jsforce=require(_0xbeeb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbeeb('0xa'));var querystring=require(_0xbeeb('0xe'));var Papa=require(_0xbeeb('0xf'));var Redis=require(_0xbeeb('0x10'));var authService=require(_0xbeeb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbeeb('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbeeb('0x13'));var db=require(_0xbeeb('0x14'))['db'];function respondWithStatusCode(_0x31f40f,_0x4c8b5f){_0x4c8b5f=_0x4c8b5f||0xcc;return function(_0x204b96){if(_0x204b96){return _0x31f40f['sendStatus'](_0x4c8b5f);}return _0x31f40f[_0xbeeb('0x15')](_0x4c8b5f)['end']();};}function respondWithResult(_0x1e4276,_0x40743e){_0x40743e=_0x40743e||0xc8;return function(_0x21f9fd){if(_0x21f9fd){return _0x1e4276[_0xbeeb('0x15')](_0x40743e)[_0xbeeb('0x16')](_0x21f9fd);}};}function respondWithFilteredResult(_0x26b4d1,_0xc74c30){return function(_0x26a093){if(_0x26a093){var _0x46865f=typeof _0xc74c30[_0xbeeb('0x17')]==='undefined'&&typeof _0xc74c30[_0xbeeb('0x18')]===_0xbeeb('0x19');var _0x2f6300=_0x26a093[_0xbeeb('0x1a')];var _0x3d4da8=_0x46865f?0x0:_0xc74c30[_0xbeeb('0x17')];var _0x11502f=_0x46865f?_0x26a093[_0xbeeb('0x1a')]:_0xc74c30[_0xbeeb('0x17')]+_0xc74c30[_0xbeeb('0x18')];var _0x512a96;if(_0x11502f>=_0x2f6300){_0x11502f=_0x2f6300;_0x512a96=0xc8;}else{_0x512a96=0xce;}_0x26b4d1[_0xbeeb('0x15')](_0x512a96);return _0x26b4d1[_0xbeeb('0x1b')](_0xbeeb('0x1c'),_0x3d4da8+'-'+_0x11502f+'/'+_0x2f6300)[_0xbeeb('0x16')](_0x26a093);}return null;};}function patchUpdates(_0x4baf32){return function(_0x31de52){try{jsonpatch[_0xbeeb('0x1d')](_0x31de52,_0x4baf32,!![]);}catch(_0x202c08){return BPromise[_0xbeeb('0x1e')](_0x202c08);}return _0x31de52['save']();};}function saveUpdates(_0x384423,_0x2e7d82){return function(_0x7a94ba){if(_0x7a94ba){return _0x7a94ba[_0xbeeb('0x1f')](_0x384423)[_0xbeeb('0x20')](function(_0x92963){return _0x92963;});}return null;};}function removeEntity(_0x4be0f9,_0x2575e3){return function(_0x28b7dd){if(_0x28b7dd){return _0x28b7dd['destroy']()[_0xbeeb('0x20')](function(){var _0x1eee89=_0x28b7dd['get']({'plain':!![]});var _0x2e6c70=_0xbeeb('0x21');return db['UserProfileResource'][_0xbeeb('0x22')]({'where':{'type':_0x2e6c70,'resourceId':_0x1eee89['id']}})['then'](function(){return _0x28b7dd;});})[_0xbeeb('0x20')](function(){_0x4be0f9[_0xbeeb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27ac66,_0x4d7384){return function(_0x2b1a9c){if(!_0x2b1a9c){_0x27ac66['sendStatus'](0x194);}return _0x2b1a9c;};}function handleError(_0x1ff0f6,_0x30929c){_0x30929c=_0x30929c||0x1f4;return function(_0x203c5a){logger[_0xbeeb('0x23')](_0x203c5a[_0xbeeb('0x24')]);if(_0x203c5a[_0xbeeb('0x25')]){delete _0x203c5a['name'];}_0x1ff0f6['status'](_0x30929c)['send'](_0x203c5a);};}exports['index']=function(_0x5b14ce,_0x37707e){var _0x641e69={},_0x5539e8={},_0x5b44e8={'count':0x0,'rows':[]};var _0xd121a3=_[_0xbeeb('0x26')](db[_0xbeeb('0x27')]['rawAttributes'],function(_0x1376c6){return{'name':_0x1376c6[_0xbeeb('0x28')],'type':_0x1376c6[_0xbeeb('0x29')][_0xbeeb('0x2a')]};});_0x5539e8[_0xbeeb('0x2b')]=_['map'](_0xd121a3,'name');_0x5539e8[_0xbeeb('0x2c')]=_[_0xbeeb('0x2d')](_0x5b14ce[_0xbeeb('0x2c')]);_0x5539e8[_0xbeeb('0x2e')]=_[_0xbeeb('0x2f')](_0x5539e8[_0xbeeb('0x2b')],_0x5539e8[_0xbeeb('0x2c')]);_0x641e69[_0xbeeb('0x30')]=_[_0xbeeb('0x2f')](_0x5539e8['model'],qs[_0xbeeb('0x31')](_0x5b14ce[_0xbeeb('0x2c')][_0xbeeb('0x31')]));_0x641e69[_0xbeeb('0x30')]=_0x641e69['attributes'][_0xbeeb('0x32')]?_0x641e69[_0xbeeb('0x30')]:_0x5539e8[_0xbeeb('0x2b')];if(!_0x5b14ce[_0xbeeb('0x2c')][_0xbeeb('0x33')](_0xbeeb('0x34'))){_0x641e69[_0xbeeb('0x18')]=qs[_0xbeeb('0x18')](_0x5b14ce['query'][_0xbeeb('0x18')]);_0x641e69[_0xbeeb('0x17')]=qs[_0xbeeb('0x17')](_0x5b14ce[_0xbeeb('0x2c')][_0xbeeb('0x17')]);}_0x641e69['order']=qs['sort'](_0x5b14ce[_0xbeeb('0x2c')]['sort']);_0x641e69['where']=qs[_0xbeeb('0x2e')](_['pick'](_0x5b14ce[_0xbeeb('0x2c')],_0x5539e8[_0xbeeb('0x2e')]),_0xd121a3);if(_0x5b14ce['query']['filter']){_0x641e69[_0xbeeb('0x35')]=_['merge'](_0x641e69[_0xbeeb('0x35')],{'$or':_[_0xbeeb('0x26')](_0xd121a3,function(_0x427664){if(_0x427664['type']!==_0xbeeb('0x36')){var _0xe52b32={};_0xe52b32[_0x427664[_0xbeeb('0x25')]]={'$like':'%'+_0x5b14ce[_0xbeeb('0x2c')][_0xbeeb('0x37')]+'%'};return _0xe52b32;}})});}_0x641e69=_['merge']({},_0x641e69,_0x5b14ce[_0xbeeb('0x38')]);var _0x5b10b2={'where':_0x641e69[_0xbeeb('0x35')]};return db[_0xbeeb('0x27')][_0xbeeb('0x1a')](_0x5b10b2)[_0xbeeb('0x20')](function(_0x46e1ce){_0x5b44e8[_0xbeeb('0x1a')]=_0x46e1ce;if(_0x5b14ce[_0xbeeb('0x2c')][_0xbeeb('0x39')]){_0x641e69['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x641e69);})[_0xbeeb('0x20')](function(_0x5dafd8){_0x5b44e8[_0xbeeb('0x3a')]=_0x5dafd8;return _0x5b44e8;})[_0xbeeb('0x20')](respondWithFilteredResult(_0x37707e,_0x641e69))[_0xbeeb('0x3b')](handleError(_0x37707e,null));};exports[_0xbeeb('0x3c')]=function(_0x5064f9,_0x30f8b6){var _0x283625={'raw':![],'where':{'id':_0x5064f9['params']['id']}},_0x36f526={};_0x36f526[_0xbeeb('0x2b')]=_[_0xbeeb('0x2d')](db['Schedule'][_0xbeeb('0x3d')]);_0x36f526['query']=_['keys'](_0x5064f9['query']);_0x36f526[_0xbeeb('0x2e')]=_['intersection'](_0x36f526[_0xbeeb('0x2b')],_0x36f526['query']);_0x283625[_0xbeeb('0x30')]=_[_0xbeeb('0x2f')](_0x36f526[_0xbeeb('0x2b')],qs[_0xbeeb('0x31')](_0x5064f9[_0xbeeb('0x2c')][_0xbeeb('0x31')]));_0x283625[_0xbeeb('0x30')]=_0x283625['attributes']['length']?_0x283625[_0xbeeb('0x30')]:_0x36f526['model'];if(_0x5064f9['query'][_0xbeeb('0x39')]){_0x283625[_0xbeeb('0x3e')]=[{'all':!![]}];}_0x283625=_['merge']({},_0x283625,_0x5064f9['options']);return db['Schedule']['find'](_0x283625)['then'](handleEntityNotFound(_0x30f8b6,null))['then'](respondWithResult(_0x30f8b6,null))[_0xbeeb('0x3b')](handleError(_0x30f8b6,null));};exports[_0xbeeb('0x3f')]=function(_0x10a2b2,_0x112ab3){return db[_0xbeeb('0x27')][_0xbeeb('0x3f')](_0x10a2b2[_0xbeeb('0x40')],{})[_0xbeeb('0x20')](function(_0x1b297f){var _0x235af5=_0x10a2b2[_0xbeeb('0x41')][_0xbeeb('0x42')]({'plain':!![]});if(!_0x235af5)throw new Error(_0xbeeb('0x43'));if(_0x235af5[_0xbeeb('0x44')]==='user'){var _0x10dc15=_0x1b297f[_0xbeeb('0x42')]({'plain':!![]});var _0x3719d4=_0xbeeb('0x21');return db[_0xbeeb('0x45')]['find']({'where':{'name':_0x3719d4,'userProfileId':_0x235af5[_0xbeeb('0x46')]},'raw':!![]})[_0xbeeb('0x20')](function(_0x56b0a0){if(_0x56b0a0&&_0x56b0a0[_0xbeeb('0x47')]===0x0){return db[_0xbeeb('0x48')][_0xbeeb('0x3f')]({'name':_0x10dc15[_0xbeeb('0x25')],'resourceId':_0x10dc15['id'],'type':_0x56b0a0['name'],'sectionId':_0x56b0a0['id']},{})[_0xbeeb('0x20')](function(){return _0x1b297f;});}else{return _0x1b297f;}})[_0xbeeb('0x3b')](function(_0x503503){logger[_0xbeeb('0x23')](_0xbeeb('0x49'),_0x503503);throw _0x503503;});}return _0x1b297f;})[_0xbeeb('0x20')](respondWithResult(_0x112ab3,0xc9))[_0xbeeb('0x3b')](handleError(_0x112ab3,null));};exports['update']=function(_0x2dc304,_0x58bdb3){if(_0x2dc304['body']['id']){delete _0x2dc304[_0xbeeb('0x40')]['id'];}return db[_0xbeeb('0x27')][_0xbeeb('0x4a')]({'where':{'id':_0x2dc304[_0xbeeb('0x4b')]['id']}})[_0xbeeb('0x20')](handleEntityNotFound(_0x58bdb3,null))[_0xbeeb('0x20')](saveUpdates(_0x2dc304['body'],null))['then'](respondWithResult(_0x58bdb3,null))[_0xbeeb('0x3b')](handleError(_0x58bdb3,null));};exports['destroy']=function(_0x31370a,_0x5b72dc){return db[_0xbeeb('0x27')]['find']({'where':{'id':_0x31370a[_0xbeeb('0x4b')]['id']}})[_0xbeeb('0x20')](handleEntityNotFound(_0x5b72dc,null))[_0xbeeb('0x20')](removeEntity(_0x5b72dc,null))['catch'](handleError(_0x5b72dc,null));};exports[_0xbeeb('0x4c')]=function(_0x5d166b,_0x1afcc2,_0x214629){var _0xf2813e=require('../../config/schedule');return db['Schedule'][_0xbeeb('0x4a')]({'where':{'id':_0x5d166b[_0xbeeb('0x4b')]['id']},'raw':!![]})[_0xbeeb('0x20')](handleEntityNotFound(_0x1afcc2,null))[_0xbeeb('0x20')](function(){_0xf2813e[_0xbeeb('0x4c')](_0x5d166b[_0xbeeb('0x4b')]['id']);})[_0xbeeb('0x20')](respondWithStatusCode(_0x1afcc2,null))[_0xbeeb('0x3b')](handleError(_0x1afcc2,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5826d25..759d761 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 _0x8169=['rimraf','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','bluebird','path'];(function(_0x417990,_0x3c6fd7){var _0x415a4a=function(_0x1e0838){while(--_0x1e0838){_0x417990['push'](_0x417990['shift']());}};_0x415a4a(++_0x3c6fd7);}(_0x8169,0x187));var _0x9816=function(_0x5988d1,_0x345c23){_0x5988d1=_0x5988d1-0x0;var _0x32a7ea=_0x8169[_0x5988d1];return _0x32a7ea;};'use strict';var _=require(_0x9816('0x0'));var util=require(_0x9816('0x1'));var logger=require(_0x9816('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9816('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9816('0x4'));var rimraf=require(_0x9816('0x5'));var config=require('../../config/environment');var attributes=require(_0x9816('0x6'));module[_0x9816('0x7')]=function(_0x24d74c,_0x1f2710){return _0x24d74c['define'](_0x9816('0x8'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3693=['path','../../config/environment','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4ad90a,_0x1130ce){var _0x3c1570=function(_0x183b48){while(--_0x183b48){_0x4ad90a['push'](_0x4ad90a['shift']());}};_0x3c1570(++_0x1130ce);}(_0x3693,0x158));var _0x3369=function(_0x4119e1,_0x35b803){_0x4119e1=_0x4119e1-0x0;var _0x4b8d1f=_0x3693[_0x4119e1];return _0x4b8d1f;};'use strict';var _=require(_0x3369('0x0'));var util=require(_0x3369('0x1'));var logger=require(_0x3369('0x2'))(_0x3369('0x3'));var moment=require(_0x3369('0x4'));var BPromise=require(_0x3369('0x5'));var rp=require(_0x3369('0x6'));var fs=require('fs');var path=require(_0x3369('0x7'));var rimraf=require('rimraf');var config=require(_0x3369('0x8'));var attributes=require('./schedule.attributes');module[_0x3369('0x9')]=function(_0x5e1b87,_0x4038ea){return _0x5e1b87[_0x3369('0xa')](_0x3369('0xb'),attributes,{'tableName':_0x3369('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ea81def..8b719bd 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 _0xf8f2=['rpc','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xf8f2,0x171));var _0x2f8f=function(_0x4b4501,_0x105927){_0x4b4501=_0x4b4501-0x0;var _0x421562=_0xf8f2[_0x4b4501];return _0x421562;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var moment=require(_0x2f8f('0x2'));var BPromise=require(_0x2f8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f8f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2f8f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2125f5,_0x17878a,_0x3b78b2){return new BPromise(function(_0x4d3be3,_0x49ffb8){return client['request'](_0x2125f5,_0x3b78b2)[_0x2f8f('0x7')](function(_0xeaccf){logger[_0x2f8f('0x8')](_0x2f8f('0x9'),_0x17878a,_0x2f8f('0xa'));logger[_0x2f8f('0xb')](_0x2f8f('0xc'),_0x17878a,_0x2f8f('0xa'),JSON['stringify'](_0xeaccf));if(_0xeaccf['error']){if(_0xeaccf[_0x2f8f('0xd')]['code']===0x1f4){logger[_0x2f8f('0xd')](_0x2f8f('0x9'),_0x17878a,_0xeaccf[_0x2f8f('0xd')][_0x2f8f('0xe')]);return _0x49ffb8(_0xeaccf[_0x2f8f('0xd')][_0x2f8f('0xe')]);}logger[_0x2f8f('0xd')](_0x2f8f('0x9'),_0x17878a,_0xeaccf['error'][_0x2f8f('0xe')]);return _0x4d3be3(_0xeaccf['error'][_0x2f8f('0xe')]);}else{logger[_0x2f8f('0x8')]('Schedule,\x20%s,\x20%s',_0x17878a,_0x2f8f('0xa'));_0x4d3be3(_0xeaccf[_0x2f8f('0xf')][_0x2f8f('0xe')]);}})[_0x2f8f('0x10')](function(_0x16014d){logger[_0x2f8f('0xd')]('Schedule,\x20%s,\x20%s',_0x17878a,_0x16014d);_0x49ffb8(_0x16014d);});});} \ No newline at end of file +var _0xf8b1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8b1,0x197));var _0x1f8b=function(_0x4e04c4,_0x1ba3c3){_0x4e04c4=_0x4e04c4-0x0;var _0x1592fb=_0xf8b1[_0x4e04c4];return _0x1592fb;};'use strict';var _=require(_0x1f8b('0x0'));var util=require(_0x1f8b('0x1'));var moment=require(_0x1f8b('0x2'));var BPromise=require(_0x1f8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f8b('0x4'));var db=require(_0x1f8b('0x5'))['db'];var utils=require(_0x1f8b('0x6'));var logger=require(_0x1f8b('0x7'))(_0x1f8b('0x8'));var config=require(_0x1f8b('0x9'));var jayson=require(_0x1f8b('0xa'));var client=jayson[_0x1f8b('0xb')][_0x1f8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x539457,_0x29d170,_0x1ab58f){return new BPromise(function(_0x14078b,_0x3707b8){return client[_0x1f8b('0xd')](_0x539457,_0x1ab58f)[_0x1f8b('0xe')](function(_0x6bab37){logger['info']('Schedule,\x20%s,\x20%s',_0x29d170,_0x1f8b('0xf'));logger[_0x1f8b('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x29d170,_0x1f8b('0xf'),JSON[_0x1f8b('0x11')](_0x6bab37));if(_0x6bab37[_0x1f8b('0x12')]){if(_0x6bab37[_0x1f8b('0x12')][_0x1f8b('0x13')]===0x1f4){logger[_0x1f8b('0x12')](_0x1f8b('0x14'),_0x29d170,_0x6bab37[_0x1f8b('0x12')][_0x1f8b('0x15')]);return _0x3707b8(_0x6bab37[_0x1f8b('0x12')][_0x1f8b('0x15')]);}logger[_0x1f8b('0x12')]('Schedule,\x20%s,\x20%s',_0x29d170,_0x6bab37[_0x1f8b('0x12')][_0x1f8b('0x15')]);return _0x14078b(_0x6bab37[_0x1f8b('0x12')][_0x1f8b('0x15')]);}else{logger['info'](_0x1f8b('0x14'),_0x29d170,_0x1f8b('0xf'));_0x14078b(_0x6bab37[_0x1f8b('0x16')][_0x1f8b('0x15')]);}})[_0x1f8b('0x17')](function(_0x3251a6){logger[_0x1f8b('0x12')](_0x1f8b('0x14'),_0x29d170,_0x3251a6);_0x3707b8(_0x3251a6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 19fe706..419e43d 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 _0xf53b=['show','download','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0xbdf55e,_0x5e4edb){var _0x5aa5af=function(_0x42420c){while(--_0x42420c){_0xbdf55e['push'](_0xbdf55e['shift']());}};_0x5aa5af(++_0x5e4edb);}(_0xf53b,0xf8));var _0xbf53=function(_0x2e7105,_0x391c65){_0x2e7105=_0x2e7105-0x0;var _0x306db8=_0xf53b[_0x2e7105];return _0x306db8;};'use strict';var multer=require(_0xbf53('0x0'));var util=require(_0xbf53('0x1'));var path=require(_0xbf53('0x2'));var timeout=require(_0xbf53('0x3'));var express=require(_0xbf53('0x4'));var router=express[_0xbf53('0x5')]();var fs_extra=require(_0xbf53('0x6'));var auth=require(_0xbf53('0x7'));var interaction=require(_0xbf53('0x8'));var config=require(_0xbf53('0x9'));var controller=require(_0xbf53('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbf53('0xb')](_0xbf53('0xc'),auth[_0xbf53('0xd')](),controller[_0xbf53('0xe')]);router[_0xbf53('0xb')](_0xbf53('0xf'),auth[_0xbf53('0xd')](),controller[_0xbf53('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xbf53('0x11')]);router[_0xbf53('0x12')]('/',auth[_0xbf53('0xd')](),controller[_0xbf53('0x13')]);router[_0xbf53('0x14')]('/:id',auth[_0xbf53('0xd')](),controller[_0xbf53('0x15')]);router['delete'](_0xbf53('0xf'),auth['isAuthenticated'](),controller[_0xbf53('0x16')]);module[_0xbf53('0x17')]=router; \ No newline at end of file +var _0xc1a0=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x1546c2,_0x22e822){var _0x24583c=function(_0x3906f8){while(--_0x3906f8){_0x1546c2['push'](_0x1546c2['shift']());}};_0x24583c(++_0x22e822);}(_0xc1a0,0x19f));var _0x0c1a=function(_0x3e961c,_0x5747e7){_0x3e961c=_0x3e961c-0x0;var _0x474f9c=_0xc1a0[_0x3e961c];return _0x474f9c;};'use strict';var multer=require('multer');var util=require(_0x0c1a('0x0'));var path=require(_0x0c1a('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c1a('0x2'));var router=express[_0x0c1a('0x3')]();var fs_extra=require(_0x0c1a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c1a('0x5'));var config=require(_0x0c1a('0x6'));var controller=require(_0x0c1a('0x7'));router[_0x0c1a('0x8')]('/',auth[_0x0c1a('0x9')](),controller[_0x0c1a('0xa')]);router[_0x0c1a('0x8')](_0x0c1a('0xb'),auth[_0x0c1a('0x9')](),controller['describe']);router[_0x0c1a('0x8')](_0x0c1a('0xc'),auth[_0x0c1a('0x9')](),controller['show']);router[_0x0c1a('0x8')](_0x0c1a('0xd'),auth['isAuthenticated'](),controller[_0x0c1a('0xe')]);router[_0x0c1a('0xf')]('/',auth[_0x0c1a('0x9')](),controller[_0x0c1a('0x10')]);router[_0x0c1a('0x11')](_0x0c1a('0xc'),auth[_0x0c1a('0x9')](),controller[_0x0c1a('0x12')]);router['delete']('/:id',auth[_0x0c1a('0x9')](),controller[_0x0c1a('0x13')]);module[_0x0c1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6e0900c..fb3b392 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 _0xa848=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt'];(function(_0xf08827,_0x36d525){var _0x339b17=function(_0x341390){while(--_0x341390){_0xf08827['push'](_0xf08827['shift']());}};_0x339b17(++_0x36d525);}(_0xa848,0x99));var _0x8a84=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa848[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x8a84('0x0'));var moment=require(_0x8a84('0x1'));var path=require(_0x8a84('0x2'));var config=require('../../config/environment');module[_0x8a84('0x3')]={'format':{'type':Sequelize[_0x8a84('0x4')],'get':function(){return this[_0x8a84('0x5')](_0x8a84('0x6'))?path[_0x8a84('0x7')](this[_0x8a84('0x5')](_0x8a84('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x8a84('0x8')]},'channel':{'type':Sequelize[_0x8a84('0x8')]},'value':{'type':Sequelize[_0x8a84('0x8')],'set':function(_0x1d463b){var _0x1b958b=_0x1d463b[_0x8a84('0x9')](/\\/g,'/');this[_0x8a84('0xa')]('value',_0x1b958b);}},'rating':{'type':Sequelize[_0x8a84('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8a84('0xb')],'set':function(_0x2294c8){this['setDataValue'](_0x8a84('0xc'),moment()[_0x8a84('0xd')](_0x2294c8,'ms'));this[_0x8a84('0xa')](_0x8a84('0xe'),moment());this[_0x8a84('0xa')](_0x8a84('0xf'),_0x2294c8);}},'startedAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0xc')))[_0x8a84('0x11')](_0x8a84('0x12'))[_0x8a84('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0xe')))[_0x8a84('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x8a84('0x13')]();}},'createdAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')]('createdAt'))[_0x8a84('0x11')](_0x8a84('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x8a84('0x10')],'get':function(){return moment(this[_0x8a84('0x5')](_0x8a84('0x14')))[_0x8a84('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x8a84('0x13')]();}}}; \ No newline at end of file +var _0xb03e=['duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb03e,0x1eb));var _0xeb03=function(_0x684c0c,_0x39dbfd){_0x684c0c=_0x684c0c-0x0;var _0x324ff6=_0xb03e[_0x684c0c];return _0x324ff6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var config=require(_0xeb03('0x2'));module[_0xeb03('0x3')]={'format':{'type':Sequelize[_0xeb03('0x4')],'get':function(){return this[_0xeb03('0x5')](_0xeb03('0x6'))?path[_0xeb03('0x7')](this[_0xeb03('0x5')](_0xeb03('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xeb03('0x8')]},'channel':{'type':Sequelize[_0xeb03('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3b58a2){var _0x3d3322=_0x3b58a2[_0xeb03('0x9')](/\\/g,'/');this[_0xeb03('0xa')](_0xeb03('0x6'),_0x3d3322);}},'rating':{'type':Sequelize[_0xeb03('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x403b77){this[_0xeb03('0xa')](_0xeb03('0xc'),moment()['subtract'](_0x403b77,'ms'));this[_0xeb03('0xa')]('closedAt',moment());this[_0xeb03('0xa')](_0xeb03('0xd'),_0x403b77);}},'startedAt':{'type':Sequelize[_0xeb03('0xe')],'get':function(){return moment(this[_0xeb03('0x5')](_0xeb03('0xc')))[_0xeb03('0xf')](_0xeb03('0x10'))[_0xeb03('0x11')]();}},'closedAt':{'type':Sequelize[_0xeb03('0xe')],'get':function(){return moment(this[_0xeb03('0x5')](_0xeb03('0x12')))[_0xeb03('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xeb03('0x11')]();}},'createdAt':{'type':Sequelize[_0xeb03('0xe')],'get':function(){return moment(this[_0xeb03('0x5')](_0xeb03('0x13')))['format'](_0xeb03('0x10'))[_0xeb03('0x11')]();}},'updatedAt':{'type':Sequelize[_0xeb03('0xe')],'get':function(){return moment(this['getDataValue'](_0xeb03('0x14')))[_0xeb03('0xf')](_0xeb03('0x10'))[_0xeb03('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a5648ff..98e2715 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 _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x008c,0x188));var _0xc008=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x008c[_0x21b359];return _0x57b8e7;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file +var _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','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','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x46ed,0x168));var _0xd46e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x46ed[_0x46e363];return _0x3fb059;};'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(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 153a871..6ea0a2d 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 _0xa5ad=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0xa5ad,0xce));var _0xda5a=function(_0x518342,_0x464bad){_0x518342=_0x518342-0x0;var _0x5a384f=_0xa5ad[_0x518342];return _0x5a384f;};'use strict';var _=require(_0xda5a('0x0'));var util=require(_0xda5a('0x1'));var logger=require(_0xda5a('0x2'))(_0xda5a('0x3'));var moment=require(_0xda5a('0x4'));var BPromise=require(_0xda5a('0x5'));var rp=require(_0xda5a('0x6'));var fs=require('fs');var path=require(_0xda5a('0x7'));var rimraf=require(_0xda5a('0x8'));var config=require(_0xda5a('0x9'));var attributes=require(_0xda5a('0xa'));module[_0xda5a('0xb')]=function(_0x351c9f,_0x5d3bce){return _0x351c9f[_0xda5a('0xc')](_0xda5a('0xd'),attributes,{'tableName':_0xda5a('0xe'),'paranoid':![],'indexes':[{'name':_0xda5a('0xf'),'fields':[_0xda5a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9b=['interactionid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x4afe81,_0x10d261){var _0x184773=function(_0x52fd94){while(--_0x52fd94){_0x4afe81['push'](_0x4afe81['shift']());}};_0x184773(++_0x10d261);}(_0x0e9b,0x109));var _0xb0e9=function(_0x455a20,_0x464bef){_0x455a20=_0x455a20-0x0;var _0x34002a=_0x0e9b[_0x455a20];return _0x34002a;};'use strict';var _=require('lodash');var util=require(_0xb0e9('0x0'));var logger=require(_0xb0e9('0x1'))(_0xb0e9('0x2'));var moment=require(_0xb0e9('0x3'));var BPromise=require(_0xb0e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0e9('0x5'));var rimraf=require('rimraf');var config=require(_0xb0e9('0x6'));var attributes=require(_0xb0e9('0x7'));module['exports']=function(_0x23a3a8,_0x4a97ae){return _0x23a3a8[_0xb0e9('0x8')](_0xb0e9('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xb0e9('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 1968b42..b878bd3 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 _0x4ccd=['http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5793e1,_0x5f2966){var _0x43ea8f=function(_0x5aa1b2){while(--_0x5aa1b2){_0x5793e1['push'](_0x5793e1['shift']());}};_0x43ea8f(++_0x5f2966);}(_0x4ccd,0x1c4));var _0xd4cc=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x4ccd[_0x5817e6];return _0x51916a;};'use strict';var _=require(_0xd4cc('0x0'));var util=require(_0xd4cc('0x1'));var moment=require(_0xd4cc('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4cc('0x4'))['db'];var utils=require(_0xd4cc('0x5'));var logger=require(_0xd4cc('0x6'))(_0xd4cc('0x7'));var config=require(_0xd4cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4cc('0x9')][_0xd4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x279efc,_0x2fc1cb,_0x333505){return new BPromise(function(_0x1f9984,_0x57580a){return client[_0xd4cc('0xb')](_0x279efc,_0x333505)[_0xd4cc('0xc')](function(_0x260a1c){logger['info'](_0xd4cc('0xd'),_0x2fc1cb,_0xd4cc('0xe'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x2fc1cb,'request\x20sent',JSON[_0xd4cc('0xf')](_0x260a1c));if(_0x260a1c[_0xd4cc('0x10')]){if(_0x260a1c['error'][_0xd4cc('0x11')]===0x1f4){logger['error'](_0xd4cc('0xd'),_0x2fc1cb,_0x260a1c[_0xd4cc('0x10')][_0xd4cc('0x12')]);return _0x57580a(_0x260a1c['error'][_0xd4cc('0x12')]);}logger[_0xd4cc('0x10')](_0xd4cc('0xd'),_0x2fc1cb,_0x260a1c['error'][_0xd4cc('0x12')]);return _0x1f9984(_0x260a1c[_0xd4cc('0x10')][_0xd4cc('0x12')]);}else{logger[_0xd4cc('0x13')](_0xd4cc('0xd'),_0x2fc1cb,_0xd4cc('0xe'));_0x1f9984(_0x260a1c[_0xd4cc('0x14')][_0xd4cc('0x12')]);}})[_0xd4cc('0x15')](function(_0x26f838){logger[_0xd4cc('0x10')](_0xd4cc('0xd'),_0x2fc1cb,_0x26f838);_0x57580a(_0x26f838);});});} \ No newline at end of file +var _0x23b1=['client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x513f27,_0x1cbc87){var _0xa316b7=function(_0x3b592d){while(--_0x3b592d){_0x513f27['push'](_0x513f27['shift']());}};_0xa316b7(++_0x1cbc87);}(_0x23b1,0xae));var _0x123b=function(_0x4ad893,_0x7a2145){_0x4ad893=_0x4ad893-0x0;var _0x99f347=_0x23b1[_0x4ad893];return _0x99f347;};'use strict';var _=require(_0x123b('0x0'));var util=require(_0x123b('0x1'));var moment=require(_0x123b('0x2'));var BPromise=require(_0x123b('0x3'));var rs=require(_0x123b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x123b('0x5'))['db'];var utils=require(_0x123b('0x6'));var logger=require(_0x123b('0x7'))(_0x123b('0x8'));var config=require(_0x123b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x123b('0xa')][_0x123b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a024c,_0x1c572a,_0x5486fa){return new BPromise(function(_0x4a9123,_0x1c9929){return client[_0x123b('0xc')](_0x1a024c,_0x5486fa)[_0x123b('0xd')](function(_0x3a359e){logger[_0x123b('0xe')](_0x123b('0xf'),_0x1c572a,'request\x20sent');logger['debug'](_0x123b('0x10'),_0x1c572a,'request\x20sent',JSON['stringify'](_0x3a359e));if(_0x3a359e[_0x123b('0x11')]){if(_0x3a359e[_0x123b('0x11')][_0x123b('0x12')]===0x1f4){logger['error'](_0x123b('0xf'),_0x1c572a,_0x3a359e[_0x123b('0x11')][_0x123b('0x13')]);return _0x1c9929(_0x3a359e[_0x123b('0x11')][_0x123b('0x13')]);}logger[_0x123b('0x11')](_0x123b('0xf'),_0x1c572a,_0x3a359e[_0x123b('0x11')][_0x123b('0x13')]);return _0x4a9123(_0x3a359e['error'][_0x123b('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1c572a,_0x123b('0x14'));_0x4a9123(_0x3a359e[_0x123b('0x15')][_0x123b('0x13')]);}})[_0x123b('0x16')](function(_0x4e9f92){logger[_0x123b('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1c572a,_0x4e9f92);_0x1c9929(_0x4e9f92);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index aad181a..52e1788 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 _0xc324=['update','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','getLogoLogin','/:id/gdpr','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','join','post','/:id/logo_login','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','addFavicon','put'];(function(_0x38ba02,_0x2f9f4e){var _0xefb4f5=function(_0x27fb0f){while(--_0x27fb0f){_0x38ba02['push'](_0x38ba02['shift']());}};_0xefb4f5(++_0x2f9f4e);}(_0xc324,0x1c9));var _0x4c32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc324[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c32('0x0'));var util=require(_0x4c32('0x1'));var path=require('path');var timeout=require(_0x4c32('0x2'));var express=require(_0x4c32('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4c32('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c32('0x5'));var controller=require(_0x4c32('0x6'));router['get']('/',auth[_0x4c32('0x7')](),controller[_0x4c32('0x8')]);router[_0x4c32('0x9')](_0x4c32('0xa'),controller[_0x4c32('0xb')]);router[_0x4c32('0x9')](_0x4c32('0xc'),controller['show']);router[_0x4c32('0x9')]('/:id/logo',controller['getLogo']);router[_0x4c32('0x9')]('/:id/logo_login',controller[_0x4c32('0xd')]);router[_0x4c32('0x9')](_0x4c32('0xe'),controller['gdpr']);router['get']('/:id/preferred',controller['getPreferred']);router['get'](_0x4c32('0xf'),controller[_0x4c32('0x10')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x5ab3d7,_0x114965,_0x470575){_0x470575(null,path['join'](config[_0x4c32('0x12')],_0x4c32('0x13')));},'filename':function(_0x24fbae,_0x47eb67,_0x1f0ea4){_0x1f0ea4(null,util[_0x4c32('0x14')](_0x4c32('0x15'),_0x4c32('0x16'),path[_0x4c32('0x17')](_0x47eb67[_0x4c32('0x18')])));}})});router['post']('/:id/logo',upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x48a69c,_0x21f7a6,_0x3ceb17){_0x3ceb17(null,path[_0x4c32('0x1b')](config['root'],_0x4c32('0x13')));},'filename':function(_0x592586,_0xb52953,_0x319408){_0x319408(null,util[_0x4c32('0x14')](_0x4c32('0x15'),'logologin',path[_0x4c32('0x17')](_0xb52953['originalname'])));}})});router[_0x4c32('0x1c')](_0x4c32('0x1d'),upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller[_0x4c32('0x1e')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x35106e,_0x75b351,_0x5802ae){_0x5802ae(null,path[_0x4c32('0x1b')](config[_0x4c32('0x12')],'server/files/images/logos/'));},'filename':function(_0x1777ea,_0x27e9a0,_0x410a3d){_0x410a3d(null,util[_0x4c32('0x14')]('%s%s',_0x4c32('0x1f'),path[_0x4c32('0x17')](_0x27e9a0[_0x4c32('0x18')])));}})});router[_0x4c32('0x1c')](_0x4c32('0x20'),upload['single'](_0x4c32('0x1a')),controller[_0x4c32('0x21')]);var upload=multer({'storage':multer[_0x4c32('0x11')]({'destination':function(_0x6c6eb1,_0x30e712,_0x2d0b66){_0x2d0b66(null,path[_0x4c32('0x1b')](config[_0x4c32('0x12')],_0x4c32('0x13')));},'filename':function(_0x3a0318,_0x592d5e,_0x20680c){_0x20680c(null,util[_0x4c32('0x14')]('%s%s',_0x4c32('0x22'),path[_0x4c32('0x17')](_0x592d5e['originalname'])));}})});router[_0x4c32('0x1c')](_0x4c32('0xf'),upload[_0x4c32('0x19')](_0x4c32('0x1a')),controller[_0x4c32('0x23')]);router[_0x4c32('0x24')](_0x4c32('0xc'),auth[_0x4c32('0x7')](),controller[_0x4c32('0x25')]);module['exports']=router; \ No newline at end of file +var _0x4c54=['favicon','addFavicon','put','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','single','addLogo','diskStorage','logologin','extname','post','/:id/logo_login','file','preferred','originalname','/:id/preferred','addPreferred'];(function(_0x3176d6,_0x27ef13){var _0x4ec505=function(_0x5d743c){while(--_0x5d743c){_0x3176d6['push'](_0x3176d6['shift']());}};_0x4ec505(++_0x27ef13);}(_0x4c54,0x12a));var _0x44c5=function(_0x222090,_0x504675){_0x222090=_0x222090-0x0;var _0x11766b=_0x4c54[_0x222090];return _0x11766b;};'use strict';var multer=require(_0x44c5('0x0'));var util=require(_0x44c5('0x1'));var path=require(_0x44c5('0x2'));var timeout=require(_0x44c5('0x3'));var express=require('express');var router=express[_0x44c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x44c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x44c5('0x6'));var controller=require(_0x44c5('0x7'));router[_0x44c5('0x8')]('/',auth[_0x44c5('0x9')](),controller[_0x44c5('0xa')]);router[_0x44c5('0x8')](_0x44c5('0xb'),controller['getDate']);router[_0x44c5('0x8')](_0x44c5('0xc'),controller[_0x44c5('0xd')]);router[_0x44c5('0x8')](_0x44c5('0xe'),controller[_0x44c5('0xf')]);router[_0x44c5('0x8')]('/:id/logo_login',controller[_0x44c5('0x10')]);router['get'](_0x44c5('0x11'),controller[_0x44c5('0x12')]);router[_0x44c5('0x8')]('/:id/preferred',controller['getPreferred']);router[_0x44c5('0x8')](_0x44c5('0x13'),controller[_0x44c5('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25d3e6,_0x48a573,_0x15ea8d){_0x15ea8d(null,path[_0x44c5('0x15')](config[_0x44c5('0x16')],_0x44c5('0x17')));},'filename':function(_0x555b36,_0x32b03d,_0x535f38){_0x535f38(null,util[_0x44c5('0x18')](_0x44c5('0x19'),'logo',path['extname'](_0x32b03d['originalname'])));}})});router['post'](_0x44c5('0xe'),upload[_0x44c5('0x1a')]('file'),controller[_0x44c5('0x1b')]);var upload=multer({'storage':multer[_0x44c5('0x1c')]({'destination':function(_0x301a3c,_0xa45e6c,_0x676e78){_0x676e78(null,path[_0x44c5('0x15')](config[_0x44c5('0x16')],_0x44c5('0x17')));},'filename':function(_0x58de00,_0x28d6ee,_0x1e75df){_0x1e75df(null,util[_0x44c5('0x18')](_0x44c5('0x19'),_0x44c5('0x1d'),path[_0x44c5('0x1e')](_0x28d6ee['originalname'])));}})});router[_0x44c5('0x1f')](_0x44c5('0x20'),upload[_0x44c5('0x1a')](_0x44c5('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x44c5('0x1c')]({'destination':function(_0x22dd21,_0x5298da,_0x32b616){_0x32b616(null,path[_0x44c5('0x15')](config[_0x44c5('0x16')],'server/files/images/logos/'));},'filename':function(_0x4b16ea,_0x4336da,_0x5d4725){_0x5d4725(null,util[_0x44c5('0x18')](_0x44c5('0x19'),_0x44c5('0x22'),path[_0x44c5('0x1e')](_0x4336da[_0x44c5('0x23')])));}})});router[_0x44c5('0x1f')](_0x44c5('0x24'),upload[_0x44c5('0x1a')]('file'),controller[_0x44c5('0x25')]);var upload=multer({'storage':multer[_0x44c5('0x1c')]({'destination':function(_0x58da9f,_0x244686,_0x389625){_0x389625(null,path['join'](config[_0x44c5('0x16')],_0x44c5('0x17')));},'filename':function(_0x1de421,_0x1f6a17,_0x4097eb){_0x4097eb(null,util[_0x44c5('0x18')](_0x44c5('0x19'),_0x44c5('0x26'),path[_0x44c5('0x1e')](_0x1f6a17[_0x44c5('0x23')])));}})});router['post'](_0x44c5('0x13'),upload[_0x44c5('0x1a')](_0x44c5('0x21')),controller[_0x44c5('0x27')]);router[_0x44c5('0x28')](_0x44c5('0xc'),auth[_0x44c5('0x9')](),controller['update']);module[_0x44c5('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7456c03..a53d67e 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x33385a,_0x340697){var _0x22459b=function(_0xa41ae7){while(--_0xa41ae7){_0x33385a['push'](_0x33385a['shift']());}};_0x22459b(++_0x340697);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1c06e0,_0x48066a){var _0x32b2fd=function(_0x5f3630){while(--_0x5f3630){_0x1c06e0['push'](_0x1c06e0['shift']());}};_0x32b2fd(++_0x48066a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index bdec26b..7d56065 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 _0x362a=['defaultPreferred','default_loginLogo.svg','default','custom','gdpr','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','ValidationError','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','params','keys','intersection','find','update','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','existsSync','join','root','toLower','default_logo.svg','upperFirst','Sequelize','\x20not\x20found','download','getLicense'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x362a,0x102));var _0xa362=function(_0x5c1a4c,_0x3778b2){_0x5c1a4c=_0x5c1a4c-0x0;var _0x5c66b7=_0x362a[_0x5c1a4c];return _0x5c66b7;};'use strict';var emlformat=require(_0xa362('0x0'));var rimraf=require(_0xa362('0x1'));var zipdir=require(_0xa362('0x2'));var jsonpatch=require(_0xa362('0x3'));var rp=require(_0xa362('0x4'));var moment=require(_0xa362('0x5'));var BPromise=require(_0xa362('0x6'));var Mustache=require(_0xa362('0x7'));var util=require(_0xa362('0x8'));var path=require(_0xa362('0x9'));var sox=require(_0xa362('0xa'));var csv=require(_0xa362('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa362('0xc'));var _=require(_0xa362('0xd'));var squel=require(_0xa362('0xe'));var crypto=require(_0xa362('0xf'));var jsforce=require(_0xa362('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa362('0xb'));var querystring=require(_0xa362('0x11'));var Papa=require(_0xa362('0x12'));var Redis=require(_0xa362('0x13'));var authService=require(_0xa362('0x14'));var qs=require(_0xa362('0x15'));var as=require(_0xa362('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa362('0x17'))(_0xa362('0x18'));var utils=require(_0xa362('0x19'));var config=require(_0xa362('0x1a'));var licenseUtil=require(_0xa362('0x1b'));var db=require(_0xa362('0x1c'))['db'];var jayson=require(_0xa362('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xef2703,_0x154d05,_0x3fe753,_0x158b6f){return new BPromise(function(_0x5700fc,_0x4c5c50){var _0x218465=_0x158b6f||client;return _0x218465['request'](_0xef2703,_0x3fe753)[_0xa362('0x1e')](function(_0xf13eca){logger[_0xa362('0x1f')](_0xa362('0x20'),_0x154d05,'request\x20sent');logger['debug'](_0xa362('0x21'),_0x154d05,_0xa362('0x22'),JSON[_0xa362('0x23')](_0xf13eca));if(_0xf13eca[_0xa362('0x24')]){if(_0xf13eca['error'][_0xa362('0x25')]===0x1f4){logger[_0xa362('0x24')](_0xa362('0x20'),_0x154d05,_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);return _0x4c5c50(_0xf13eca['error']['message']);}logger['error'](_0xa362('0x20'),_0x154d05,_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);return _0x5700fc(_0xf13eca[_0xa362('0x24')][_0xa362('0x26')]);}else{logger[_0xa362('0x1f')](_0xa362('0x20'),_0x154d05,_0xa362('0x22'));_0x5700fc(_0xf13eca[_0xa362('0x27')][_0xa362('0x26')]);}})[_0xa362('0x28')](function(_0x559398){logger[_0xa362('0x24')]('Setting,\x20%s,\x20%s',_0x154d05,_0x559398);_0x4c5c50(_0x559398);});});}function respondWithStatusCode(_0x2384b6,_0x3f5449){_0x3f5449=_0x3f5449||0xcc;return function(_0x545157){if(_0x545157){return _0x2384b6[_0xa362('0x29')](_0x3f5449);}return _0x2384b6['status'](_0x3f5449)['end']();};}function respondWithResult(_0x3cb136,_0x53c9a7){_0x53c9a7=_0x53c9a7||0xc8;return function(_0x3f5bc2){if(_0x3f5bc2){return _0x3cb136[_0xa362('0x2a')](_0x53c9a7)[_0xa362('0x2b')](_0x3f5bc2);}};}function respondWithFilteredResult(_0x54a496,_0x275a52){return function(_0x32ceb1){if(_0x32ceb1){var _0x293aff=typeof _0x275a52[_0xa362('0x2c')]===_0xa362('0x2d')&&typeof _0x275a52[_0xa362('0x2e')]===_0xa362('0x2d');var _0x26de98=_0x32ceb1[_0xa362('0x2f')];var _0x3018df=_0x293aff?0x0:_0x275a52['offset'];var _0x136e20=_0x293aff?_0x32ceb1[_0xa362('0x2f')]:_0x275a52['offset']+_0x275a52[_0xa362('0x2e')];var _0xa97673;if(_0x136e20>=_0x26de98){_0x136e20=_0x26de98;_0xa97673=0xc8;}else{_0xa97673=0xce;}_0x54a496[_0xa362('0x2a')](_0xa97673);return _0x54a496[_0xa362('0x30')](_0xa362('0x31'),_0x3018df+'-'+_0x136e20+'/'+_0x26de98)[_0xa362('0x2b')](_0x32ceb1);}return null;};}function patchUpdates(_0xb085fc){return function(_0x49422e){try{jsonpatch[_0xa362('0x32')](_0x49422e,_0xb085fc,!![]);}catch(_0x5ddc48){return BPromise[_0xa362('0x33')](_0x5ddc48);}return _0x49422e[_0xa362('0x34')]();};}function saveUpdates(_0x45a5fc,_0x28c0e2){return function(_0x14f1ac){if(_0x14f1ac){return _0x14f1ac['update'](_0x45a5fc)[_0xa362('0x1e')](function(_0x6d1927){return _0x6d1927;});}return null;};}function removeEntity(_0x342bb3,_0x5839aa){return function(_0x3b4058){if(_0x3b4058){return _0x3b4058[_0xa362('0x35')]()[_0xa362('0x1e')](function(){_0x342bb3[_0xa362('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29ac42,_0x2e127e){return function(_0x363516){if(!_0x363516){_0x29ac42['sendStatus'](0x194);}return _0x363516;};}function handleError(_0x2cbbb8,_0x120e25){_0x120e25=_0x120e25||0x1f4;return function(_0x16e89d){logger[_0xa362('0x24')](_0x16e89d[_0xa362('0x36')]);if(_0x16e89d[_0xa362('0x37')]){delete _0x16e89d[_0xa362('0x37')];}_0x2cbbb8[_0xa362('0x2a')](_0x120e25)['send'](_0x16e89d);};}exports['index']=function(_0x13217d,_0x43d6ea){var _0x268e4e={},_0x4c7910={},_0x5ce606={'count':0x0,'rows':[]};var _0x347b0a=_[_0xa362('0x38')](db[_0xa362('0x39')][_0xa362('0x3a')],function(_0x10a27a){return{'name':_0x10a27a[_0xa362('0x3b')],'type':_0x10a27a[_0xa362('0x3c')][_0xa362('0x3d')]};});_0x4c7910[_0xa362('0x3e')]=_[_0xa362('0x38')](_0x347b0a,'name');_0x4c7910[_0xa362('0x3f')]=_['keys'](_0x13217d[_0xa362('0x3f')]);_0x4c7910[_0xa362('0x40')]=_['intersection'](_0x4c7910[_0xa362('0x3e')],_0x4c7910[_0xa362('0x3f')]);_0x268e4e[_0xa362('0x41')]=_['intersection'](_0x4c7910['model'],qs[_0xa362('0x42')](_0x13217d[_0xa362('0x3f')]['fields']));_0x268e4e[_0xa362('0x41')]=_0x268e4e['attributes'][_0xa362('0x43')]?_0x268e4e[_0xa362('0x41')]:_0x4c7910[_0xa362('0x3e')];if(!_0x13217d[_0xa362('0x3f')]['hasOwnProperty'](_0xa362('0x44'))){_0x268e4e[_0xa362('0x2e')]=qs['limit'](_0x13217d[_0xa362('0x3f')][_0xa362('0x2e')]);_0x268e4e[_0xa362('0x2c')]=qs[_0xa362('0x2c')](_0x13217d[_0xa362('0x3f')][_0xa362('0x2c')]);}_0x268e4e['order']=qs[_0xa362('0x45')](_0x13217d[_0xa362('0x3f')]['sort']);_0x268e4e[_0xa362('0x46')]=qs[_0xa362('0x40')](_[_0xa362('0x47')](_0x13217d[_0xa362('0x3f')],_0x4c7910[_0xa362('0x40')]),_0x347b0a);if(_0x13217d[_0xa362('0x3f')][_0xa362('0x48')]){_0x268e4e[_0xa362('0x46')]=_[_0xa362('0x49')](_0x268e4e[_0xa362('0x46')],{'$or':_[_0xa362('0x38')](_0x347b0a,function(_0x2a22c2){if(_0x2a22c2[_0xa362('0x3c')]!==_0xa362('0x4a')){var _0x1470f1={};_0x1470f1[_0x2a22c2[_0xa362('0x37')]]={'$like':'%'+_0x13217d[_0xa362('0x3f')][_0xa362('0x48')]+'%'};return _0x1470f1;}})});}_0x268e4e=_[_0xa362('0x49')]({},_0x268e4e,_0x13217d['options']);var _0x59488b={'where':_0x268e4e[_0xa362('0x46')]};return db[_0xa362('0x39')][_0xa362('0x2f')](_0x59488b)['then'](function(_0x2ac9da){_0x5ce606[_0xa362('0x2f')]=_0x2ac9da;if(_0x13217d[_0xa362('0x3f')]['includeAll']){_0x268e4e[_0xa362('0x4b')]=[{'all':!![]}];}return db[_0xa362('0x39')]['findAll'](_0x268e4e);})[_0xa362('0x1e')](function(_0x58e4dd){_0x5ce606[_0xa362('0x4c')]=_0x58e4dd;return _0x5ce606;})['then'](respondWithFilteredResult(_0x43d6ea,_0x268e4e))['catch'](handleError(_0x43d6ea,null));};exports[_0xa362('0x4d')]=function(_0x50eb0a,_0x2bcd29){var _0x118472={'raw':![],'where':{'id':_0x50eb0a[_0xa362('0x4e')]['id']}},_0xcbd59d={};_0xcbd59d[_0xa362('0x3e')]=_[_0xa362('0x4f')](db[_0xa362('0x39')][_0xa362('0x3a')]);_0xcbd59d['query']=_[_0xa362('0x4f')](_0x50eb0a[_0xa362('0x3f')]);_0xcbd59d['filters']=_[_0xa362('0x50')](_0xcbd59d['model'],_0xcbd59d[_0xa362('0x3f')]);_0x118472['attributes']=_[_0xa362('0x50')](_0xcbd59d['model'],qs[_0xa362('0x42')](_0x50eb0a[_0xa362('0x3f')][_0xa362('0x42')]));_0x118472['attributes']=_0x118472[_0xa362('0x41')]['length']?_0x118472[_0xa362('0x41')]:_0xcbd59d[_0xa362('0x3e')];if(_0x50eb0a['query']['includeAll']){_0x118472[_0xa362('0x4b')]=[{'all':!![]}];}_0x118472=_['merge']({},_0x118472,_0x50eb0a['options']);return db[_0xa362('0x39')][_0xa362('0x51')](_0x118472)['then'](handleEntityNotFound(_0x2bcd29,null))[_0xa362('0x1e')](respondWithResult(_0x2bcd29,null))['catch'](handleError(_0x2bcd29,null));};exports[_0xa362('0x52')]=function(_0x1ab4ea,_0x5e84c7){if(_0x1ab4ea[_0xa362('0x53')]['id']){delete _0x1ab4ea['body']['id'];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x1ab4ea['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x5e84c7,null))[_0xa362('0x1e')](saveUpdates(_0x1ab4ea[_0xa362('0x53')],null))['then'](respondWithResult(_0x5e84c7,null))[_0xa362('0x28')](handleError(_0x5e84c7,null));};exports[_0xa362('0x54')]=function(_0x186fd3,_0xff68f9,_0x3749e4){if(_0x186fd3[_0xa362('0x55')]&&_0x186fd3[_0xa362('0x55')][_0xa362('0x56')]){_0x186fd3[_0xa362('0x53')][_0xa362('0x57')]=_0x186fd3[_0xa362('0x55')]['filename'];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x186fd3[_0xa362('0x4e')]['id']}})['then'](handleEntityNotFound(_0xff68f9,null))[_0xa362('0x1e')](saveUpdates(_0x186fd3['body'],null))[_0xa362('0x1e')](respondWithResult(_0xff68f9,null))[_0xa362('0x28')](handleError(_0xff68f9,null));};exports['addLogoLogin']=function(_0x220033,_0xe1b952,_0x12a581){if(_0x220033['file']&&_0x220033[_0xa362('0x55')]['filename']){_0x220033[_0xa362('0x53')][_0xa362('0x58')]=_0x220033[_0xa362('0x55')]['filename'];}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x220033['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0xe1b952,null))[_0xa362('0x1e')](saveUpdates(_0x220033[_0xa362('0x53')],null))['then'](respondWithResult(_0xe1b952,null))['catch'](handleError(_0xe1b952,null));};var utilLicense=require(_0xa362('0x1b'));exports[_0xa362('0x59')]=function(_0x1d9b14,_0xa899d,_0xfbf1b9){var _0x302d0c=_0xa362('0x5a');var _0x2acdb6={'custom':![]};return utilLicense['getLicense']()[_0xa362('0x1e')](function(_0x35b7f7){if(_0x35b7f7){_0x2acdb6=_0x35b7f7;}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x1d9b14[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),_0xa362('0x58'),_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xa899d,null))[_0xa362('0x1e')](function(_0x1fceb3){if(_0x1fceb3){var _0x4bbf3a=_0x1fceb3[_0xa362('0x57')]&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_[_0xa362('0x62')](_0x1fceb3[_0xa362('0x57')])))?path['join'](config['root'],_0x302d0c,_[_0xa362('0x62')](_0x1fceb3[_0xa362('0x57')])):path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_[_0xa362('0x62')](_0xa362('0x63')));var _0x727503='default'+_[_0xa362('0x64')](_0xa362('0x57'));if(_0x1fceb3[_0x727503]||!_0x2acdb6['custom']){_0x4bbf3a=path[_0xa362('0x60')](config[_0xa362('0x61')],_0x302d0c,_['toLower'](_0xa362('0x63')));}if(!fs[_0xa362('0x5f')](_0x4bbf3a)){throw new db[(_0xa362('0x65'))]['ValidationError'](_[_0xa362('0x64')](_0xa362('0x57'))+_0xa362('0x66'));}return _0xa899d[_0xa362('0x67')](_0x4bbf3a);}})['catch'](handleError(_0xa899d,null));};var utilLicense=require(_0xa362('0x1b'));exports['getLogoLogin']=function(_0x12221c,_0x2bfd6a,_0x144a11){var _0x27d40e=_0xa362('0x5a');var _0x5c8709={'custom':![]};return utilLicense[_0xa362('0x68')]()[_0xa362('0x1e')](function(_0x2e1449){if(_0x2e1449){_0x5c8709=_0x2e1449;}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x12221c['params']['id']},'attributes':['logo',_0xa362('0x58'),_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),_0xa362('0x69'),'defaultFavicon'],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x2bfd6a,null))['then'](function(_0x15b44e){if(_0x15b44e){var _0x1ece48=_0x15b44e['loginLogo']&&fs['existsSync'](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0x15b44e[_0xa362('0x58')])))?path[_0xa362('0x60')](config['root'],_0x27d40e,_[_0xa362('0x62')](_0x15b44e[_0xa362('0x58')])):path['join'](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0xa362('0x6a')));var _0x4215a7=_0xa362('0x6b')+_[_0xa362('0x64')](_0xa362('0x58'));if(_0x15b44e[_0x4215a7]||!_0x5c8709[_0xa362('0x6c')]){_0x1ece48=path['join'](config[_0xa362('0x61')],_0x27d40e,_['toLower'](_0xa362('0x6a')));}if(!fs[_0xa362('0x5f')](_0x1ece48)){throw new db['Sequelize']['ValidationError'](_[_0xa362('0x64')](_0xa362('0x58'))+_0xa362('0x66'));}return _0x2bfd6a[_0xa362('0x67')](_0x1ece48);}})[_0xa362('0x28')](handleError(_0x2bfd6a,null));};exports[_0xa362('0x6d')]=function(_0x197607,_0x3cb1f1){return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x197607[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x6e')]})[_0xa362('0x1e')](respondWithResult(_0x3cb1f1,null))['catch'](handleError(_0x3cb1f1,null));};exports[_0xa362('0x6f')]=function(_0x3874c9,_0x408c31,_0x590077){if(_0x3874c9[_0xa362('0x55')]&&_0x3874c9[_0xa362('0x55')]['filename']){_0x3874c9[_0xa362('0x53')][_0xa362('0x5b')]=_0x3874c9['file'][_0xa362('0x56')];}return db[_0xa362('0x39')][_0xa362('0x51')]({'where':{'id':_0x3874c9['params']['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x408c31,null))[_0xa362('0x1e')](saveUpdates(_0x3874c9[_0xa362('0x53')],null))[_0xa362('0x1e')](respondWithResult(_0x408c31,null))['catch'](handleError(_0x408c31,null));};var utilLicense=require(_0xa362('0x1b'));exports[_0xa362('0x70')]=function(_0x3f1077,_0x139c54,_0x159dfb){var _0x424f39=_0xa362('0x5a');var _0x576ecb={'custom':![]};return utilLicense[_0xa362('0x68')]()['then'](function(_0x3b27ed){if(_0x3b27ed){_0x576ecb=_0x3b27ed;}return db[_0xa362('0x39')]['find']({'where':{'id':_0x3f1077[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),_0xa362('0x58'),'preferred',_0xa362('0x5c'),_0xa362('0x5d'),_0xa362('0x5e'),_0xa362('0x69'),_0xa362('0x71')],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x139c54,null))[_0xa362('0x1e')](function(_0x27867f){if(_0x27867f){var _0xa4a7ee=_0x27867f['preferred']&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')](_0x27867f[_0xa362('0x5b')])))?path['join'](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')](_0x27867f[_0xa362('0x5b')])):path[_0xa362('0x60')](config[_0xa362('0x61')],_0x424f39,_['toLower'](_0xa362('0x72')));var _0x404a78=_0xa362('0x6b')+_[_0xa362('0x64')]('preferred');if(_0x27867f[_0x404a78]||!_0x576ecb[_0xa362('0x6c')]||!_0x576ecb[_0xa362('0x5b')]){_0xa4a7ee=path['join'](config[_0xa362('0x61')],_0x424f39,_[_0xa362('0x62')]('default_preferred.png'));}if(!fs['existsSync'](_0xa4a7ee)){throw new db[(_0xa362('0x65'))][(_0xa362('0x73'))](_[_0xa362('0x64')](_0xa362('0x5b'))+_0xa362('0x66'));}return _0x139c54['download'](_0xa4a7ee);}})['catch'](handleError(_0x139c54,null));};exports[_0xa362('0x74')]=function(_0x838a6c,_0x437382,_0x53ed06){if(_0x838a6c['file']&&_0x838a6c[_0xa362('0x55')][_0xa362('0x56')]){_0x838a6c[_0xa362('0x53')][_0xa362('0x5c')]=_0x838a6c[_0xa362('0x55')]['filename'];}return db['Setting']['find']({'where':{'id':_0x838a6c[_0xa362('0x4e')]['id']}})[_0xa362('0x1e')](handleEntityNotFound(_0x437382,null))[_0xa362('0x1e')](saveUpdates(_0x838a6c[_0xa362('0x53')],null))['then'](respondWithResult(_0x437382,null))[_0xa362('0x28')](handleError(_0x437382,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2b0ab1,_0x539a06,_0x11aa6c){var _0x389e92='server/files/images/logos';var _0x5a06ea={'custom':![]};return utilLicense[_0xa362('0x68')]()[_0xa362('0x1e')](function(_0x13b970){if(_0x13b970){_0x5a06ea=_0x13b970;}return db['Setting'][_0xa362('0x51')]({'where':{'id':_0x2b0ab1[_0xa362('0x4e')]['id']},'attributes':[_0xa362('0x57'),'loginLogo',_0xa362('0x5b'),_0xa362('0x5c'),_0xa362('0x5d'),'defaultLoginLogo',_0xa362('0x69'),_0xa362('0x71')],'raw':!![]});})[_0xa362('0x1e')](handleEntityNotFound(_0x539a06,null))[_0xa362('0x1e')](function(_0x2741ad){if(_0x2741ad){var _0x22f77e=_0x2741ad['favicon']&&fs[_0xa362('0x5f')](path[_0xa362('0x60')](config[_0xa362('0x61')],_0x389e92,_['toLower'](_0x2741ad[_0xa362('0x5c')])))?path['join'](config[_0xa362('0x61')],_0x389e92,_[_0xa362('0x62')](_0x2741ad[_0xa362('0x5c')])):path['join'](config[_0xa362('0x61')],_0x389e92,_[_0xa362('0x62')](_0xa362('0x75')));var _0x2ddcd6=_0xa362('0x6b')+_['upperFirst']('favicon');if(_0x2741ad[_0x2ddcd6]||!_0x5a06ea[_0xa362('0x6c')]){_0x22f77e=path[_0xa362('0x60')](config['root'],_0x389e92,_[_0xa362('0x62')](_0xa362('0x75')));}if(!fs[_0xa362('0x5f')](_0x22f77e)){throw new db[(_0xa362('0x65'))][(_0xa362('0x73'))](_[_0xa362('0x64')](_0xa362('0x5c'))+'\x20not\x20found');}return _0x539a06[_0xa362('0x67')](_0x22f77e);}})[_0xa362('0x28')](handleError(_0x539a06,null));};exports['getDate']=function(_0x1a2a81,_0x195026){var _0x1f612a={'offset':moment()[_0xa362('0x76')]()};_0x1f612a[_0xa362('0x77')]=moment()['utcOffset'](_0x1f612a[_0xa362('0x2c')])['format'](_0xa362('0x78'));return _0x195026['status'](0xc8)['send'](_0x1f612a);}; \ No newline at end of file +var _0xe009=['find','body','addLogo','file','filename','logo','params','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','server/files/images/logos','favicon','defaultPreferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','Setting','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','keys','rawAttributes','options'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0xe009,0x122));var _0x9e00=function(_0x387d39,_0x315fb7){_0x387d39=_0x387d39-0x0;var _0xa1703=_0xe009[_0x387d39];return _0xa1703;};'use strict';var emlformat=require(_0x9e00('0x0'));var rimraf=require(_0x9e00('0x1'));var zipdir=require(_0x9e00('0x2'));var jsonpatch=require(_0x9e00('0x3'));var rp=require('request-promise');var moment=require(_0x9e00('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e00('0x5'));var util=require(_0x9e00('0x6'));var path=require(_0x9e00('0x7'));var sox=require(_0x9e00('0x8'));var csv=require(_0x9e00('0x9'));var ejs=require(_0x9e00('0xa'));var fs=require('fs');var fs_extra=require(_0x9e00('0xb'));var _=require(_0x9e00('0xc'));var squel=require(_0x9e00('0xd'));var crypto=require(_0x9e00('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9e00('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e00('0x10'));var Redis=require(_0x9e00('0x11'));var authService=require(_0x9e00('0x12'));var qs=require(_0x9e00('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e00('0x14'));var logger=require(_0x9e00('0x15'))(_0x9e00('0x16'));var utils=require('../../config/utils');var config=require(_0x9e00('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9e00('0x18'));var client=jayson['client'][_0x9e00('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3b1960,_0x1d2d17,_0x344c3e,_0x175e7d){return new BPromise(function(_0x40b563,_0x580f5c){var _0x5d7a77=_0x175e7d||client;return _0x5d7a77[_0x9e00('0x1a')](_0x3b1960,_0x344c3e)['then'](function(_0x10df77){logger[_0x9e00('0x1b')](_0x9e00('0x1c'),_0x1d2d17,_0x9e00('0x1d'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1d2d17,'request\x20sent',JSON['stringify'](_0x10df77));if(_0x10df77[_0x9e00('0x1e')]){if(_0x10df77['error'][_0x9e00('0x1f')]===0x1f4){logger[_0x9e00('0x1e')]('Setting,\x20%s,\x20%s',_0x1d2d17,_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);return _0x580f5c(_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);}logger[_0x9e00('0x1e')](_0x9e00('0x1c'),_0x1d2d17,_0x10df77[_0x9e00('0x1e')][_0x9e00('0x20')]);return _0x40b563(_0x10df77['error']['message']);}else{logger[_0x9e00('0x1b')](_0x9e00('0x1c'),_0x1d2d17,_0x9e00('0x1d'));_0x40b563(_0x10df77['result'][_0x9e00('0x20')]);}})[_0x9e00('0x21')](function(_0x355ed8){logger['error'](_0x9e00('0x1c'),_0x1d2d17,_0x355ed8);_0x580f5c(_0x355ed8);});});}function respondWithStatusCode(_0x4008f9,_0x18fac5){_0x18fac5=_0x18fac5||0xcc;return function(_0x781601){if(_0x781601){return _0x4008f9[_0x9e00('0x22')](_0x18fac5);}return _0x4008f9[_0x9e00('0x23')](_0x18fac5)[_0x9e00('0x24')]();};}function respondWithResult(_0x741ba2,_0x2a1113){_0x2a1113=_0x2a1113||0xc8;return function(_0x418f8a){if(_0x418f8a){return _0x741ba2[_0x9e00('0x23')](_0x2a1113)[_0x9e00('0x25')](_0x418f8a);}};}function respondWithFilteredResult(_0x232bcf,_0x4b9097){return function(_0x831f2b){if(_0x831f2b){var _0x249fe0=typeof _0x4b9097[_0x9e00('0x26')]===_0x9e00('0x27')&&typeof _0x4b9097[_0x9e00('0x28')]==='undefined';var _0x5659c5=_0x831f2b['count'];var _0x418d06=_0x249fe0?0x0:_0x4b9097[_0x9e00('0x26')];var _0x351b30=_0x249fe0?_0x831f2b[_0x9e00('0x29')]:_0x4b9097['offset']+_0x4b9097[_0x9e00('0x28')];var _0x1a8b14;if(_0x351b30>=_0x5659c5){_0x351b30=_0x5659c5;_0x1a8b14=0xc8;}else{_0x1a8b14=0xce;}_0x232bcf[_0x9e00('0x23')](_0x1a8b14);return _0x232bcf['set'](_0x9e00('0x2a'),_0x418d06+'-'+_0x351b30+'/'+_0x5659c5)[_0x9e00('0x25')](_0x831f2b);}return null;};}function patchUpdates(_0x315882){return function(_0x26ecf0){try{jsonpatch[_0x9e00('0x2b')](_0x26ecf0,_0x315882,!![]);}catch(_0x2291ef){return BPromise[_0x9e00('0x2c')](_0x2291ef);}return _0x26ecf0[_0x9e00('0x2d')]();};}function saveUpdates(_0x50da18,_0x506dad){return function(_0x36fa66){if(_0x36fa66){return _0x36fa66[_0x9e00('0x2e')](_0x50da18)[_0x9e00('0x2f')](function(_0x160ad8){return _0x160ad8;});}return null;};}function removeEntity(_0x225caa,_0x26c99b){return function(_0x3a08cc){if(_0x3a08cc){return _0x3a08cc[_0x9e00('0x30')]()['then'](function(){_0x225caa[_0x9e00('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x154eeb,_0xe0421e){return function(_0x35d778){if(!_0x35d778){_0x154eeb[_0x9e00('0x22')](0x194);}return _0x35d778;};}function handleError(_0xf3ab01,_0x4bf063){_0x4bf063=_0x4bf063||0x1f4;return function(_0x28701a){logger['error'](_0x28701a['stack']);if(_0x28701a[_0x9e00('0x31')]){delete _0x28701a['name'];}_0xf3ab01['status'](_0x4bf063)[_0x9e00('0x32')](_0x28701a);};}exports[_0x9e00('0x33')]=function(_0x33b80e,_0x5c8329){var _0x7df394={},_0x33389d={},_0x1e638d={'count':0x0,'rows':[]};var _0x1fe6f6=_[_0x9e00('0x34')](db[_0x9e00('0x35')]['rawAttributes'],function(_0x58f6b5){return{'name':_0x58f6b5[_0x9e00('0x36')],'type':_0x58f6b5[_0x9e00('0x37')][_0x9e00('0x38')]};});_0x33389d['model']=_[_0x9e00('0x34')](_0x1fe6f6,'name');_0x33389d[_0x9e00('0x39')]=_['keys'](_0x33b80e[_0x9e00('0x39')]);_0x33389d[_0x9e00('0x3a')]=_['intersection'](_0x33389d[_0x9e00('0x3b')],_0x33389d[_0x9e00('0x39')]);_0x7df394[_0x9e00('0x3c')]=_[_0x9e00('0x3d')](_0x33389d[_0x9e00('0x3b')],qs[_0x9e00('0x3e')](_0x33b80e[_0x9e00('0x39')][_0x9e00('0x3e')]));_0x7df394['attributes']=_0x7df394[_0x9e00('0x3c')]['length']?_0x7df394['attributes']:_0x33389d['model'];if(!_0x33b80e['query'][_0x9e00('0x3f')](_0x9e00('0x40'))){_0x7df394[_0x9e00('0x28')]=qs[_0x9e00('0x28')](_0x33b80e[_0x9e00('0x39')]['limit']);_0x7df394['offset']=qs[_0x9e00('0x26')](_0x33b80e[_0x9e00('0x39')][_0x9e00('0x26')]);}_0x7df394[_0x9e00('0x41')]=qs[_0x9e00('0x42')](_0x33b80e['query'][_0x9e00('0x42')]);_0x7df394[_0x9e00('0x43')]=qs['filters'](_[_0x9e00('0x44')](_0x33b80e[_0x9e00('0x39')],_0x33389d[_0x9e00('0x3a')]),_0x1fe6f6);if(_0x33b80e[_0x9e00('0x39')][_0x9e00('0x45')]){_0x7df394[_0x9e00('0x43')]=_['merge'](_0x7df394['where'],{'$or':_[_0x9e00('0x34')](_0x1fe6f6,function(_0x2feee1){if(_0x2feee1[_0x9e00('0x37')]!==_0x9e00('0x46')){var _0x2fc1b7={};_0x2fc1b7[_0x2feee1[_0x9e00('0x31')]]={'$like':'%'+_0x33b80e[_0x9e00('0x39')][_0x9e00('0x45')]+'%'};return _0x2fc1b7;}})});}_0x7df394=_[_0x9e00('0x47')]({},_0x7df394,_0x33b80e['options']);var _0x14663d={'where':_0x7df394[_0x9e00('0x43')]};return db[_0x9e00('0x35')][_0x9e00('0x29')](_0x14663d)[_0x9e00('0x2f')](function(_0x4ca8ce){_0x1e638d['count']=_0x4ca8ce;if(_0x33b80e[_0x9e00('0x39')][_0x9e00('0x48')]){_0x7df394[_0x9e00('0x49')]=[{'all':!![]}];}return db[_0x9e00('0x35')][_0x9e00('0x4a')](_0x7df394);})[_0x9e00('0x2f')](function(_0x47c646){_0x1e638d[_0x9e00('0x4b')]=_0x47c646;return _0x1e638d;})[_0x9e00('0x2f')](respondWithFilteredResult(_0x5c8329,_0x7df394))[_0x9e00('0x21')](handleError(_0x5c8329,null));};exports['show']=function(_0x24199a,_0x555db9){var _0x41bd72={'raw':![],'where':{'id':_0x24199a['params']['id']}},_0x12dc78={};_0x12dc78[_0x9e00('0x3b')]=_[_0x9e00('0x4c')](db['Setting'][_0x9e00('0x4d')]);_0x12dc78['query']=_[_0x9e00('0x4c')](_0x24199a['query']);_0x12dc78[_0x9e00('0x3a')]=_[_0x9e00('0x3d')](_0x12dc78[_0x9e00('0x3b')],_0x12dc78[_0x9e00('0x39')]);_0x41bd72['attributes']=_['intersection'](_0x12dc78[_0x9e00('0x3b')],qs['fields'](_0x24199a[_0x9e00('0x39')][_0x9e00('0x3e')]));_0x41bd72[_0x9e00('0x3c')]=_0x41bd72['attributes']['length']?_0x41bd72[_0x9e00('0x3c')]:_0x12dc78[_0x9e00('0x3b')];if(_0x24199a['query']['includeAll']){_0x41bd72['include']=[{'all':!![]}];}_0x41bd72=_[_0x9e00('0x47')]({},_0x41bd72,_0x24199a[_0x9e00('0x4e')]);return db[_0x9e00('0x35')]['find'](_0x41bd72)[_0x9e00('0x2f')](handleEntityNotFound(_0x555db9,null))[_0x9e00('0x2f')](respondWithResult(_0x555db9,null))[_0x9e00('0x21')](handleError(_0x555db9,null));};exports[_0x9e00('0x2e')]=function(_0x4e5815,_0x8d3e90){if(_0x4e5815['body']['id']){delete _0x4e5815['body']['id'];}return db['Setting'][_0x9e00('0x4f')]({'where':{'id':_0x4e5815['params']['id']}})[_0x9e00('0x2f')](handleEntityNotFound(_0x8d3e90,null))[_0x9e00('0x2f')](saveUpdates(_0x4e5815[_0x9e00('0x50')],null))[_0x9e00('0x2f')](respondWithResult(_0x8d3e90,null))[_0x9e00('0x21')](handleError(_0x8d3e90,null));};exports[_0x9e00('0x51')]=function(_0x301ddb,_0x3be119,_0x3600e0){if(_0x301ddb['file']&&_0x301ddb[_0x9e00('0x52')][_0x9e00('0x53')]){_0x301ddb[_0x9e00('0x50')][_0x9e00('0x54')]=_0x301ddb['file'][_0x9e00('0x53')];}return db[_0x9e00('0x35')]['find']({'where':{'id':_0x301ddb[_0x9e00('0x55')]['id']}})['then'](handleEntityNotFound(_0x3be119,null))[_0x9e00('0x2f')](saveUpdates(_0x301ddb[_0x9e00('0x50')],null))[_0x9e00('0x2f')](respondWithResult(_0x3be119,null))[_0x9e00('0x21')](handleError(_0x3be119,null));};exports[_0x9e00('0x56')]=function(_0x3a9b22,_0x2829e5,_0x147e17){if(_0x3a9b22[_0x9e00('0x52')]&&_0x3a9b22[_0x9e00('0x52')][_0x9e00('0x53')]){_0x3a9b22[_0x9e00('0x50')][_0x9e00('0x57')]=_0x3a9b22[_0x9e00('0x52')][_0x9e00('0x53')];}return db['Setting']['find']({'where':{'id':_0x3a9b22['params']['id']}})['then'](handleEntityNotFound(_0x2829e5,null))[_0x9e00('0x2f')](saveUpdates(_0x3a9b22['body'],null))[_0x9e00('0x2f')](respondWithResult(_0x2829e5,null))[_0x9e00('0x21')](handleError(_0x2829e5,null));};var utilLicense=require(_0x9e00('0x58'));exports[_0x9e00('0x59')]=function(_0x2c9613,_0x2aba4c,_0x9eba57){var _0x2ba1e5='server/files/images/logos';var _0x15dd9b={'custom':![]};return utilLicense[_0x9e00('0x5a')]()['then'](function(_0x53b224){if(_0x53b224){_0x15dd9b=_0x53b224;}return db['Setting'][_0x9e00('0x4f')]({'where':{'id':_0x2c9613[_0x9e00('0x55')]['id']},'attributes':['logo',_0x9e00('0x57'),_0x9e00('0x5b'),'favicon',_0x9e00('0x5c'),_0x9e00('0x5d'),'defaultPreferred',_0x9e00('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x2aba4c,null))[_0x9e00('0x2f')](function(_0x4cfbd8){if(_0x4cfbd8){var _0x2baae1=_0x4cfbd8[_0x9e00('0x54')]&&fs[_0x9e00('0x5f')](path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x2ba1e5,_[_0x9e00('0x62')](_0x4cfbd8[_0x9e00('0x54')])))?path['join'](config[_0x9e00('0x61')],_0x2ba1e5,_['toLower'](_0x4cfbd8[_0x9e00('0x54')])):path[_0x9e00('0x60')](config['root'],_0x2ba1e5,_[_0x9e00('0x62')](_0x9e00('0x63')));var _0x4bb86c=_0x9e00('0x64')+_[_0x9e00('0x65')](_0x9e00('0x54'));if(_0x4cfbd8[_0x4bb86c]||!_0x15dd9b[_0x9e00('0x66')]){_0x2baae1=path['join'](config[_0x9e00('0x61')],_0x2ba1e5,_['toLower'](_0x9e00('0x63')));}if(!fs['existsSync'](_0x2baae1)){throw new db[(_0x9e00('0x67'))]['ValidationError'](_['upperFirst'](_0x9e00('0x54'))+_0x9e00('0x68'));}return _0x2aba4c[_0x9e00('0x69')](_0x2baae1);}})[_0x9e00('0x21')](handleError(_0x2aba4c,null));};var utilLicense=require(_0x9e00('0x58'));exports['getLogoLogin']=function(_0x9c88ea,_0x39a6fd,_0x4a23fe){var _0x52143e=_0x9e00('0x6a');var _0x3eeada={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x271622){if(_0x271622){_0x3eeada=_0x271622;}return db[_0x9e00('0x35')][_0x9e00('0x4f')]({'where':{'id':_0x9c88ea[_0x9e00('0x55')]['id']},'attributes':[_0x9e00('0x54'),_0x9e00('0x57'),_0x9e00('0x5b'),_0x9e00('0x6b'),_0x9e00('0x5c'),'defaultLoginLogo',_0x9e00('0x6c'),_0x9e00('0x5e')],'raw':!![]});})[_0x9e00('0x2f')](handleEntityNotFound(_0x39a6fd,null))[_0x9e00('0x2f')](function(_0x5cc264){if(_0x5cc264){var _0x5d520f=_0x5cc264[_0x9e00('0x57')]&&fs[_0x9e00('0x5f')](path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x52143e,_['toLower'](_0x5cc264[_0x9e00('0x57')])))?path[_0x9e00('0x60')](config['root'],_0x52143e,_[_0x9e00('0x62')](_0x5cc264[_0x9e00('0x57')])):path['join'](config[_0x9e00('0x61')],_0x52143e,_[_0x9e00('0x62')]('default_loginLogo.svg'));var _0x26b321='default'+_[_0x9e00('0x65')](_0x9e00('0x57'));if(_0x5cc264[_0x26b321]||!_0x3eeada[_0x9e00('0x66')]){_0x5d520f=path['join'](config[_0x9e00('0x61')],_0x52143e,_[_0x9e00('0x62')](_0x9e00('0x6d')));}if(!fs[_0x9e00('0x5f')](_0x5d520f)){throw new db[(_0x9e00('0x67'))][(_0x9e00('0x6e'))](_['upperFirst'](_0x9e00('0x57'))+_0x9e00('0x68'));}return _0x39a6fd[_0x9e00('0x69')](_0x5d520f);}})[_0x9e00('0x21')](handleError(_0x39a6fd,null));};exports[_0x9e00('0x6f')]=function(_0x1e1f0e,_0xa11da9){return db[_0x9e00('0x35')]['find']({'where':{'id':_0x1e1f0e['params']['id']},'attributes':[_0x9e00('0x70')]})[_0x9e00('0x2f')](respondWithResult(_0xa11da9,null))[_0x9e00('0x21')](handleError(_0xa11da9,null));};exports['addPreferred']=function(_0x97f3dd,_0x235924,_0x534d7b){if(_0x97f3dd[_0x9e00('0x52')]&&_0x97f3dd[_0x9e00('0x52')][_0x9e00('0x53')]){_0x97f3dd['body'][_0x9e00('0x5b')]=_0x97f3dd[_0x9e00('0x52')][_0x9e00('0x53')];}return db[_0x9e00('0x35')]['find']({'where':{'id':_0x97f3dd[_0x9e00('0x55')]['id']}})[_0x9e00('0x2f')](handleEntityNotFound(_0x235924,null))[_0x9e00('0x2f')](saveUpdates(_0x97f3dd['body'],null))[_0x9e00('0x2f')](respondWithResult(_0x235924,null))['catch'](handleError(_0x235924,null));};var utilLicense=require('../../config/license/util');exports[_0x9e00('0x71')]=function(_0x26af74,_0x234db2,_0x3e491c){var _0x32c2c6=_0x9e00('0x6a');var _0x44836f={'custom':![]};return utilLicense[_0x9e00('0x5a')]()[_0x9e00('0x2f')](function(_0x14a4e7){if(_0x14a4e7){_0x44836f=_0x14a4e7;}return db['Setting'][_0x9e00('0x4f')]({'where':{'id':_0x26af74['params']['id']},'attributes':[_0x9e00('0x54'),_0x9e00('0x57'),_0x9e00('0x5b'),'favicon',_0x9e00('0x5c'),'defaultLoginLogo',_0x9e00('0x6c'),_0x9e00('0x5e')],'raw':!![]});})[_0x9e00('0x2f')](handleEntityNotFound(_0x234db2,null))[_0x9e00('0x2f')](function(_0x816b26){if(_0x816b26){var _0x3510a2=_0x816b26[_0x9e00('0x5b')]&&fs[_0x9e00('0x5f')](path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x32c2c6,_[_0x9e00('0x62')](_0x816b26[_0x9e00('0x5b')])))?path['join'](config[_0x9e00('0x61')],_0x32c2c6,_[_0x9e00('0x62')](_0x816b26[_0x9e00('0x5b')])):path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x32c2c6,_[_0x9e00('0x62')](_0x9e00('0x72')));var _0x81e43c=_0x9e00('0x64')+_[_0x9e00('0x65')](_0x9e00('0x5b'));if(_0x816b26[_0x81e43c]||!_0x44836f[_0x9e00('0x66')]||!_0x44836f[_0x9e00('0x5b')]){_0x3510a2=path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x32c2c6,_['toLower'](_0x9e00('0x72')));}if(!fs['existsSync'](_0x3510a2)){throw new db['Sequelize'][(_0x9e00('0x6e'))](_[_0x9e00('0x65')]('preferred')+_0x9e00('0x68'));}return _0x234db2[_0x9e00('0x69')](_0x3510a2);}})[_0x9e00('0x21')](handleError(_0x234db2,null));};exports[_0x9e00('0x73')]=function(_0x6db7f3,_0x3aa8af,_0x3cbb5e){if(_0x6db7f3[_0x9e00('0x52')]&&_0x6db7f3['file'][_0x9e00('0x53')]){_0x6db7f3[_0x9e00('0x50')][_0x9e00('0x6b')]=_0x6db7f3[_0x9e00('0x52')][_0x9e00('0x53')];}return db[_0x9e00('0x35')][_0x9e00('0x4f')]({'where':{'id':_0x6db7f3[_0x9e00('0x55')]['id']}})[_0x9e00('0x2f')](handleEntityNotFound(_0x3aa8af,null))[_0x9e00('0x2f')](saveUpdates(_0x6db7f3['body'],null))[_0x9e00('0x2f')](respondWithResult(_0x3aa8af,null))['catch'](handleError(_0x3aa8af,null));};var utilLicense=require(_0x9e00('0x58'));exports[_0x9e00('0x74')]=function(_0x52551d,_0x7cd26c,_0x3bf65d){var _0x5914c7=_0x9e00('0x6a');var _0x312068={'custom':![]};return utilLicense[_0x9e00('0x5a')]()[_0x9e00('0x2f')](function(_0xffc71c){if(_0xffc71c){_0x312068=_0xffc71c;}return db['Setting'][_0x9e00('0x4f')]({'where':{'id':_0x52551d['params']['id']},'attributes':[_0x9e00('0x54'),_0x9e00('0x57'),_0x9e00('0x5b'),'favicon',_0x9e00('0x5c'),_0x9e00('0x5d'),_0x9e00('0x6c'),_0x9e00('0x5e')],'raw':!![]});})[_0x9e00('0x2f')](handleEntityNotFound(_0x7cd26c,null))[_0x9e00('0x2f')](function(_0x57db08){if(_0x57db08){var _0x4159a1=_0x57db08['favicon']&&fs[_0x9e00('0x5f')](path['join'](config['root'],_0x5914c7,_[_0x9e00('0x62')](_0x57db08[_0x9e00('0x6b')])))?path[_0x9e00('0x60')](config['root'],_0x5914c7,_[_0x9e00('0x62')](_0x57db08['favicon'])):path[_0x9e00('0x60')](config[_0x9e00('0x61')],_0x5914c7,_[_0x9e00('0x62')](_0x9e00('0x75')));var _0x2b0e6d='default'+_['upperFirst'](_0x9e00('0x6b'));if(_0x57db08[_0x2b0e6d]||!_0x312068[_0x9e00('0x66')]){_0x4159a1=path['join'](config['root'],_0x5914c7,_[_0x9e00('0x62')]('default_favicon.ico'));}if(!fs[_0x9e00('0x5f')](_0x4159a1)){throw new db[(_0x9e00('0x67'))]['ValidationError'](_[_0x9e00('0x65')](_0x9e00('0x6b'))+_0x9e00('0x68'));}return _0x7cd26c[_0x9e00('0x69')](_0x4159a1);}})[_0x9e00('0x21')](handleError(_0x7cd26c,null));};exports[_0x9e00('0x76')]=function(_0x5694aa,_0x1991fa){var _0x284a4c={'offset':moment()['utcOffset']()};_0x284a4c[_0x9e00('0x77')]=moment()[_0x9e00('0x78')](_0x284a4c[_0x9e00('0x26')])[_0x9e00('0x79')](_0x9e00('0x7a'));return _0x1991fa[_0x9e00('0x23')](0xc8)[_0x9e00('0x32')](_0x284a4c);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 61dc15f..9eabf3d 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x5e465c,_0x384ccb){var _0x533db1=function(_0x51c79e){while(--_0x51c79e){_0x5e465c['push'](_0x5e465c['shift']());}};_0x533db1(++_0x384ccb);}(_0x34e8,0x12c));var _0x834e=function(_0x1d0ebd,_0x42a828){_0x1d0ebd=_0x1d0ebd-0x0;var _0x55dd40=_0x34e8[_0x1d0ebd];return _0x55dd40;};'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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x55ca,0x126));var _0xa55c=function(_0x3a2225,_0xb6600){_0x3a2225=_0x3a2225-0x0;var _0x5c8040=_0x55ca[_0x3a2225];return _0x5c8040;};'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 8002d54..03dfb8c 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 _0x011e=['find','options','raw','where','include','map','attributes','model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSetting','Setting'];(function(_0x1cdbcf,_0x39f808){var _0x2c531b=function(_0x269642){while(--_0x269642){_0x1cdbcf['push'](_0x1cdbcf['shift']());}};_0x2c531b(++_0x39f808);}(_0x011e,0x70));var _0xe011=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x011e[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xe011('0x0'));var util=require(_0xe011('0x1'));var moment=require(_0xe011('0x2'));var BPromise=require(_0xe011('0x3'));var rs=require(_0xe011('0x4'));var fs=require('fs');var Redis=require(_0xe011('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe011('0x6'));var logger=require(_0xe011('0x7'))(_0xe011('0x8'));var config=require(_0xe011('0x9'));var jayson=require(_0xe011('0xa'));var client=jayson[_0xe011('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e898f,_0x5484bd,_0x4430e1){return new BPromise(function(_0x54296d,_0x2fc3a0){return client[_0xe011('0xc')](_0x5e898f,_0x4430e1)[_0xe011('0xd')](function(_0x234df9){logger[_0xe011('0xe')](_0xe011('0xf'),_0x5484bd,_0xe011('0x10'));logger['debug'](_0xe011('0x11'),_0x5484bd,'request\x20sent',JSON['stringify'](_0x234df9));if(_0x234df9[_0xe011('0x12')]){if(_0x234df9[_0xe011('0x12')][_0xe011('0x13')]===0x1f4){logger[_0xe011('0x12')](_0xe011('0xf'),_0x5484bd,_0x234df9['error'][_0xe011('0x14')]);return _0x2fc3a0(_0x234df9[_0xe011('0x12')]['message']);}logger['error'](_0xe011('0xf'),_0x5484bd,_0x234df9[_0xe011('0x12')][_0xe011('0x14')]);return _0x54296d(_0x234df9[_0xe011('0x12')][_0xe011('0x14')]);}else{logger[_0xe011('0xe')](_0xe011('0xf'),_0x5484bd,_0xe011('0x10'));_0x54296d(_0x234df9[_0xe011('0x15')][_0xe011('0x14')]);}})['catch'](function(_0x1dc2db){logger['error']('Setting,\x20%s,\x20%s',_0x5484bd,_0x1dc2db);_0x2fc3a0(_0x1dc2db);});});}exports[_0xe011('0x16')]=function(_0x307d6e){var _0x471772=this;return new Promise(function(_0x175cae,_0x462ba7){return db[_0xe011('0x17')][_0xe011('0x18')]({'raw':_0x307d6e[_0xe011('0x19')]?_0x307d6e['options'][_0xe011('0x1a')]===undefined?!![]:![]:!![],'where':_0x307d6e[_0xe011('0x19')]?_0x307d6e[_0xe011('0x19')][_0xe011('0x1b')]||null:null,'attributes':_0x307d6e[_0xe011('0x19')]?_0x307d6e[_0xe011('0x19')]['attributes']||null:null,'include':_0x307d6e['options']?_0x307d6e[_0xe011('0x19')][_0xe011('0x1c')]?_[_0xe011('0x1d')](_0x307d6e[_0xe011('0x19')][_0xe011('0x1c')],function(_0xcfbad1){return{'model':db[_0xcfbad1['model']],'as':_0xcfbad1['as'],'attributes':_0xcfbad1[_0xe011('0x1e')],'include':_0xcfbad1[_0xe011('0x1c')]?_[_0xe011('0x1d')](_0xcfbad1[_0xe011('0x1c')],function(_0xfd2d71){return{'model':db[_0xfd2d71[_0xe011('0x1f')]],'as':_0xfd2d71['as'],'attributes':_0xfd2d71['attributes'],'include':_0xfd2d71[_0xe011('0x1c')]?_[_0xe011('0x1d')](_0xfd2d71[_0xe011('0x1c')],function(_0x5e2901){return{'model':db[_0x5e2901['model']],'as':_0x5e2901['as'],'attributes':_0x5e2901[_0xe011('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe011('0xd')](function(_0x3a9e28){logger[_0xe011('0xe')](_0xe011('0x16'),_0x307d6e);logger[_0xe011('0x20')]('ShowSetting',_0x307d6e,JSON[_0xe011('0x21')](_0x3a9e28));_0x175cae(_0x3a9e28);})['catch'](function(_0x4b20f0){logger[_0xe011('0x12')](_0xe011('0x16'),_0x4b20f0[_0xe011('0x14')],_0x307d6e);_0x462ba7(_0x471772[_0xe011('0x12')](0x1f4,_0x4b20f0[_0xe011('0x14')]));});});}; \ No newline at end of file +var _0xb2d7=['stringify','error','code','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x164a4c,_0x417ca9){var _0x20bb78=function(_0x11e3cb){while(--_0x11e3cb){_0x164a4c['push'](_0x164a4c['shift']());}};_0x20bb78(++_0x417ca9);}(_0xb2d7,0x10e));var _0x7b2d=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xb2d7[_0x202c61];return _0x540691;};'use strict';var _=require(_0x7b2d('0x0'));var util=require(_0x7b2d('0x1'));var moment=require(_0x7b2d('0x2'));var BPromise=require(_0x7b2d('0x3'));var rs=require(_0x7b2d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b2d('0x5'))['db'];var utils=require(_0x7b2d('0x6'));var logger=require(_0x7b2d('0x7'))(_0x7b2d('0x8'));var config=require(_0x7b2d('0x9'));var jayson=require(_0x7b2d('0xa'));var client=jayson[_0x7b2d('0xb')][_0x7b2d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f0a5b,_0x28faaf,_0x4402b2){return new BPromise(function(_0x545eac,_0x2f08e2){return client[_0x7b2d('0xd')](_0x5f0a5b,_0x4402b2)['then'](function(_0xd09925){logger['info'](_0x7b2d('0xe'),_0x28faaf,_0x7b2d('0xf'));logger[_0x7b2d('0x10')](_0x7b2d('0x11'),_0x28faaf,_0x7b2d('0xf'),JSON[_0x7b2d('0x12')](_0xd09925));if(_0xd09925[_0x7b2d('0x13')]){if(_0xd09925[_0x7b2d('0x13')][_0x7b2d('0x14')]===0x1f4){logger['error'](_0x7b2d('0xe'),_0x28faaf,_0xd09925[_0x7b2d('0x13')][_0x7b2d('0x15')]);return _0x2f08e2(_0xd09925['error'][_0x7b2d('0x15')]);}logger['error']('Setting,\x20%s,\x20%s',_0x28faaf,_0xd09925[_0x7b2d('0x13')][_0x7b2d('0x15')]);return _0x545eac(_0xd09925[_0x7b2d('0x13')][_0x7b2d('0x15')]);}else{logger[_0x7b2d('0x16')]('Setting,\x20%s,\x20%s',_0x28faaf,_0x7b2d('0xf'));_0x545eac(_0xd09925[_0x7b2d('0x17')][_0x7b2d('0x15')]);}})[_0x7b2d('0x18')](function(_0x4dd34f){logger[_0x7b2d('0x13')]('Setting,\x20%s,\x20%s',_0x28faaf,_0x4dd34f);_0x2f08e2(_0x4dd34f);});});}exports[_0x7b2d('0x19')]=function(_0x77a76a){var _0x56d761=this;return new Promise(function(_0x2275c4,_0x27beff){return db[_0x7b2d('0x1a')][_0x7b2d('0x1b')]({'raw':_0x77a76a['options']?_0x77a76a[_0x7b2d('0x1c')][_0x7b2d('0x1d')]===undefined?!![]:![]:!![],'where':_0x77a76a[_0x7b2d('0x1c')]?_0x77a76a[_0x7b2d('0x1c')][_0x7b2d('0x1e')]||null:null,'attributes':_0x77a76a[_0x7b2d('0x1c')]?_0x77a76a[_0x7b2d('0x1c')][_0x7b2d('0x1f')]||null:null,'include':_0x77a76a[_0x7b2d('0x1c')]?_0x77a76a[_0x7b2d('0x1c')][_0x7b2d('0x20')]?_[_0x7b2d('0x21')](_0x77a76a[_0x7b2d('0x1c')]['include'],function(_0x1c3f19){return{'model':db[_0x1c3f19[_0x7b2d('0x22')]],'as':_0x1c3f19['as'],'attributes':_0x1c3f19['attributes'],'include':_0x1c3f19[_0x7b2d('0x20')]?_['map'](_0x1c3f19[_0x7b2d('0x20')],function(_0x3058cc){return{'model':db[_0x3058cc[_0x7b2d('0x22')]],'as':_0x3058cc['as'],'attributes':_0x3058cc[_0x7b2d('0x1f')],'include':_0x3058cc[_0x7b2d('0x20')]?_[_0x7b2d('0x21')](_0x3058cc[_0x7b2d('0x20')],function(_0x5416a0){return{'model':db[_0x5416a0[_0x7b2d('0x22')]],'as':_0x5416a0['as'],'attributes':_0x5416a0[_0x7b2d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7b2d('0x23')](function(_0x2dda20){logger[_0x7b2d('0x16')]('ShowSetting',_0x77a76a);logger[_0x7b2d('0x10')](_0x7b2d('0x19'),_0x77a76a,JSON[_0x7b2d('0x12')](_0x2dda20));_0x2275c4(_0x2dda20);})[_0x7b2d('0x18')](function(_0x302ad0){logger['error']('ShowSetting',_0x302ad0[_0x7b2d('0x15')],_0x77a76a);_0x27beff(_0x56d761[_0x7b2d('0x13')](0x1f4,_0x302ad0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index cc9bc43..d075dc0 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x89311d,_0x991439){var _0x53ee33=function(_0x10f6d0){while(--_0x10f6d0){_0x89311d['push'](_0x89311d['shift']());}};_0x53ee33(++_0x991439);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4b9216,_0x4eaf36){var _0x309f82=function(_0x3c4a31){while(--_0x3c4a31){_0x4b9216['push'](_0x4b9216['shift']());}};_0x309f82(++_0x4eaf36);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0a388c2..618affe 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 _0x39c0=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer'];(function(_0x5b2672,_0x5d5820){var _0x44cbaa=function(_0x9f9574){while(--_0x9f9574){_0x5b2672['push'](_0x5b2672['shift']());}};_0x44cbaa(++_0x5d5820);}(_0x39c0,0x1ab));var _0x039c=function(_0x434ad8,_0x2579ff){_0x434ad8=_0x434ad8-0x0;var _0x5ad69b=_0x39c0[_0x434ad8];return _0x5ad69b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x039c('0x0'));module['exports']={'name':{'type':Sequelize[_0x039c('0x1')],'unique':_0x039c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x039c('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x039c('0x1')],'defaultValue':function(){return rs[_0x039c('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x039c('0x4')](_0x039c('0x5'),'skebby',_0x039c('0x6'),_0x039c('0x7'),_0x039c('0x8'),_0x039c('0x9'),'bandwidth',_0x039c('0xa'),_0x039c('0xb'),_0x039c('0xc'))},'accountSid':{'type':Sequelize[_0x039c('0x1')]},'authId':{'type':Sequelize[_0x039c('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x039c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x039c('0x1')]},'password':{'type':Sequelize[_0x039c('0x1')]},'apiKey':{'type':Sequelize[_0x039c('0x1')]},'applicationId':{'type':Sequelize[_0x039c('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x039c('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x039c('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x039c('0xd');}},'notificationSound':{'type':Sequelize[_0x039c('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x039c('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x039c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x039c('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a8ca0){if(!_0x4a8ca0)this['setDataValue'](_0x039c('0x11'),null);this[_0x039c('0x12')](_0x039c('0x13'),_0x4a8ca0);}}}; \ No newline at end of file +var _0x23ed=['connectel','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby'];(function(_0x479520,_0x37b505){var _0x4fbd01=function(_0x22462a){while(--_0x22462a){_0x479520['push'](_0x479520['shift']());}};_0x4fbd01(++_0x37b505);}(_0x23ed,0x196));var _0xd23e=function(_0x59d661,_0x61bee6){_0x59d661=_0x59d661-0x0;var _0x6daaff=_0x23ed[_0x59d661];return _0x6daaff;};'use strict';var Sequelize=require(_0xd23e('0x0'));var rs=require(_0xd23e('0x1'));module[_0xd23e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xd23e('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd23e('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0xd23e('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0xd23e('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd23e('0x4')]},'type':{'type':Sequelize[_0xd23e('0x5')](_0xd23e('0x6'),_0xd23e('0x7'),_0xd23e('0x8'),'clicksend',_0xd23e('0x9'),_0xd23e('0xa'),_0xd23e('0xb'),_0xd23e('0xc'),_0xd23e('0xd'),_0xd23e('0xe'))},'accountSid':{'type':Sequelize[_0xd23e('0x4')]},'authId':{'type':Sequelize[_0xd23e('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xd23e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd23e('0x4')]},'password':{'type':Sequelize[_0xd23e('0x4')]},'apiKey':{'type':Sequelize[_0xd23e('0x4')]},'applicationId':{'type':Sequelize[_0xd23e('0x4')]},'accountId':{'type':Sequelize[_0xd23e('0x4')]},'senderString':{'type':Sequelize[_0xd23e('0x4')]},'deliveryReport':{'type':Sequelize[_0xd23e('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xd23e('0x4')]},'notificationTemplate':{'type':Sequelize[_0xd23e('0x10')],'defaultValue':function(){return _0xd23e('0x11');}},'notificationSound':{'type':Sequelize[_0xd23e('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd23e('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd23e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd23e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd23e('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd23e('0x12')],'comment':_0xd23e('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x417837){if(!_0x417837)this[_0xd23e('0x14')](_0xd23e('0x15'),null);this['setDataValue'](_0xd23e('0x16'),_0x417837);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b004117..2b4e31f 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 _0x0b81=['find','autoAssociation','describe','addDisposition','SmsAccountId','Disposition','pick','ids','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','MessageSid','skebby','sender','text','connectel','clicksend','messageId','message_id','plivo','results','csc','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','entity\x20found','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','getApplications','Contact','Owner','fullname','internal','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','clickatell','redif','error_code','infobip','message-delivered','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x0b81,0x166));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x10b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10b8('0x1'));var jsonpatch=require(_0x10b8('0x2'));var rp=require(_0x10b8('0x3'));var moment=require(_0x10b8('0x4'));var BPromise=require(_0x10b8('0x5'));var Mustache=require(_0x10b8('0x6'));var util=require('util');var path=require(_0x10b8('0x7'));var sox=require(_0x10b8('0x8'));var csv=require(_0x10b8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10b8('0xa'));var _=require(_0x10b8('0xb'));var squel=require(_0x10b8('0xc'));var crypto=require(_0x10b8('0xd'));var jsforce=require(_0x10b8('0xe'));var deskjs=require(_0x10b8('0xf'));var toCsv=require(_0x10b8('0x9'));var querystring=require(_0x10b8('0x10'));var Papa=require('papaparse');var Redis=require(_0x10b8('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x10b8('0x12'));var hardwareService=require(_0x10b8('0x13'));var logger=require('../../config/logger')(_0x10b8('0x14'));var utils=require('../../config/utils');var config=require(_0x10b8('0x15'));var licenseUtil=require(_0x10b8('0x16'));var db=require('../../mysqldb')['db'];config[_0x10b8('0x17')]=_[_0x10b8('0x18')](config[_0x10b8('0x17')],{'host':_0x10b8('0x19'),'port':0x18eb});var socket=require(_0x10b8('0x1a'))(new Redis(config[_0x10b8('0x17')]));require(_0x10b8('0x1b'))[_0x10b8('0x1c')](socket);var jayson=require(_0x10b8('0x1d'));var client=jayson[_0x10b8('0x1e')][_0x10b8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x7af8c2,_0x3edbd8,_0x17524a,_0xe27e8b){return new BPromise(function(_0x24d083,_0x20db2c){var _0x17bea4=_0xe27e8b||client;return _0x17bea4['request'](_0x7af8c2,_0x17524a)[_0x10b8('0x20')](function(_0x76323b){logger['info'](_0x10b8('0x21'),_0x3edbd8,_0x10b8('0x22'));logger[_0x10b8('0x23')](_0x10b8('0x24'),_0x3edbd8,_0x10b8('0x22'),JSON[_0x10b8('0x25')](_0x76323b));if(_0x76323b['error']){if(_0x76323b[_0x10b8('0x26')]['code']===0x1f4){logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);return _0x20db2c(_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);}logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);return _0x24d083(_0x76323b[_0x10b8('0x26')][_0x10b8('0x27')]);}else{logger[_0x10b8('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3edbd8,_0x10b8('0x22'));_0x24d083(_0x76323b[_0x10b8('0x29')][_0x10b8('0x27')]);}})[_0x10b8('0x2a')](function(_0x242d2f){logger[_0x10b8('0x26')](_0x10b8('0x21'),_0x3edbd8,_0x242d2f);_0x20db2c(_0x242d2f);});});}function respondWithStatusCode(_0x14fcaf,_0x371ab7){_0x371ab7=_0x371ab7||0xcc;return function(_0x5b56aa){if(_0x5b56aa){return _0x14fcaf[_0x10b8('0x2b')](_0x371ab7);}return _0x14fcaf[_0x10b8('0x2c')](_0x371ab7)['end']();};}function respondWithResult(_0x54f293,_0x321faa){_0x321faa=_0x321faa||0xc8;return function(_0x1bbdc6){if(_0x1bbdc6){return _0x54f293[_0x10b8('0x2c')](_0x321faa)['json'](_0x1bbdc6);}};}function respondWithFilteredResult(_0x30d14,_0x5dca40){return function(_0x69edec){if(_0x69edec){var _0x46b442=typeof _0x5dca40[_0x10b8('0x2d')]===_0x10b8('0x2e')&&typeof _0x5dca40['limit']==='undefined';var _0x56bff2=_0x69edec['count'];var _0x53826a=_0x46b442?0x0:_0x5dca40['offset'];var _0xb777b5=_0x46b442?_0x69edec[_0x10b8('0x2f')]:_0x5dca40[_0x10b8('0x2d')]+_0x5dca40[_0x10b8('0x30')];var _0x30d7fc;if(_0xb777b5>=_0x56bff2){_0xb777b5=_0x56bff2;_0x30d7fc=0xc8;}else{_0x30d7fc=0xce;}_0x30d14[_0x10b8('0x2c')](_0x30d7fc);return _0x30d14[_0x10b8('0x31')](_0x10b8('0x32'),_0x53826a+'-'+_0xb777b5+'/'+_0x56bff2)[_0x10b8('0x33')](_0x69edec);}return null;};}function patchUpdates(_0x501c7f){return function(_0x25bb83){try{jsonpatch[_0x10b8('0x34')](_0x25bb83,_0x501c7f,!![]);}catch(_0x6ae12c){return BPromise[_0x10b8('0x35')](_0x6ae12c);}return _0x25bb83[_0x10b8('0x36')]();};}function saveUpdates(_0x4a670b,_0x43df24){return function(_0x4efa03){if(_0x4efa03){return _0x4efa03[_0x10b8('0x37')](_0x4a670b)[_0x10b8('0x20')](function(_0x1ba926){return _0x1ba926;});}return null;};}function removeEntity(_0x23b86e,_0x58a3d4){return function(_0x4f80de){if(_0x4f80de){return _0x4f80de[_0x10b8('0x38')]()[_0x10b8('0x20')](function(){var _0x513fd3=_0x4f80de[_0x10b8('0x39')]({'plain':!![]});var _0x3786df=_0x10b8('0x3a');return db[_0x10b8('0x3b')][_0x10b8('0x38')]({'where':{'type':_0x3786df,'resourceId':_0x513fd3['id']}})['then'](function(){return _0x4f80de;});})[_0x10b8('0x20')](function(){_0x23b86e['status'](0xcc)[_0x10b8('0x3c')]();});}};}function handleEntityNotFound(_0x3e21f1,_0x26d2f0){return function(_0x539bc0){if(!_0x539bc0){_0x3e21f1[_0x10b8('0x2b')](0x194);}return _0x539bc0;};}function handleError(_0x5a0023,_0x145320){_0x145320=_0x145320||0x1f4;return function(_0x265b15){logger[_0x10b8('0x26')](_0x265b15[_0x10b8('0x3d')]);if(_0x265b15[_0x10b8('0x3e')]){delete _0x265b15[_0x10b8('0x3e')];}_0x5a0023['status'](_0x145320)[_0x10b8('0x3f')](_0x265b15);};}exports[_0x10b8('0x40')]=function(_0x1d34e6,_0x3f0349){var _0x3c86f5={'include':[{'model':db[_0x10b8('0x41')],'as':_0x10b8('0x42')}]},_0x3f5ea6={},_0x4845fc={'count':0x0,'rows':[]};var _0x2c40ec=_[_0x10b8('0x43')](db[_0x10b8('0x44')][_0x10b8('0x45')],function(_0x3c586f){return{'name':_0x3c586f[_0x10b8('0x46')],'type':_0x3c586f[_0x10b8('0x47')][_0x10b8('0x48')]};});_0x3f5ea6[_0x10b8('0x49')]=_[_0x10b8('0x43')](_0x2c40ec,'name');_0x3f5ea6['query']=_[_0x10b8('0x4a')](_0x1d34e6[_0x10b8('0x4b')]);_0x3f5ea6[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x3f5ea6[_0x10b8('0x49')],_0x3f5ea6[_0x10b8('0x4b')]);_0x3c86f5[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x3f5ea6[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x4f')]));_0x3c86f5[_0x10b8('0x4e')]=_0x3c86f5[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x3c86f5['attributes']:_0x3f5ea6[_0x10b8('0x49')];if(!_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x51')](_0x10b8('0x52'))){_0x3c86f5[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x3c86f5[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x1d34e6['query']['offset']);}_0x3c86f5[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x3c86f5['where']=qs['filters'](_['pick'](_0x1d34e6[_0x10b8('0x4b')],_0x3f5ea6['filters']),_0x2c40ec);if(_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x3c86f5['where']=_['merge'](_0x3c86f5[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0x2c40ec,function(_0x325903){if(_0x325903[_0x10b8('0x47')]!=='VIRTUAL'){var _0x1e0405={};_0x1e0405[_0x325903[_0x10b8('0x3e')]]={'$like':'%'+_0x1d34e6[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x1e0405;}})});}_0x3c86f5=_[_0x10b8('0x57')]({},_0x3c86f5,_0x1d34e6[_0x10b8('0x58')]);var _0x289076={'where':_0x3c86f5[_0x10b8('0x56')]};return db[_0x10b8('0x44')]['count'](_0x289076)[_0x10b8('0x20')](function(_0x3d3eac){_0x4845fc[_0x10b8('0x2f')]=_0x3d3eac;if(_0x1d34e6['query'][_0x10b8('0x59')]){_0x3c86f5['include']=[{'all':!![]}];}return db['SmsAccount'][_0x10b8('0x5a')](_0x3c86f5);})[_0x10b8('0x20')](function(_0x24921b){_0x4845fc[_0x10b8('0x5b')]=_0x24921b;return _0x4845fc;})['then'](respondWithFilteredResult(_0x3f0349,_0x3c86f5))[_0x10b8('0x2a')](handleError(_0x3f0349,null));};exports['show']=function(_0x1ca17e,_0x27e1bd){var _0x5f277a={'raw':![],'where':{'id':_0x1ca17e[_0x10b8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x10b8('0x42')}]},_0x5ad26e={};_0x5ad26e[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db[_0x10b8('0x44')]['rawAttributes']);_0x5ad26e['query']=_['keys'](_0x1ca17e[_0x10b8('0x4b')]);_0x5ad26e[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x5ad26e[_0x10b8('0x49')],_0x5ad26e[_0x10b8('0x4b')]);_0x5f277a[_0x10b8('0x4e')]=_['intersection'](_0x5ad26e[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x1ca17e['query'][_0x10b8('0x4f')]));_0x5f277a[_0x10b8('0x4e')]=_0x5f277a[_0x10b8('0x4e')]['length']?_0x5f277a[_0x10b8('0x4e')]:_0x5ad26e[_0x10b8('0x49')];if(_0x1ca17e['query']['includeAll']){_0x5f277a[_0x10b8('0x5d')]=[{'all':!![]}];}_0x5f277a=_[_0x10b8('0x57')]({},_0x5f277a,_0x1ca17e['options']);return db[_0x10b8('0x44')]['find'](_0x5f277a)['then'](handleEntityNotFound(_0x27e1bd,null))[_0x10b8('0x20')](respondWithResult(_0x27e1bd,null))['catch'](handleError(_0x27e1bd,null));};exports[_0x10b8('0x5e')]=function(_0x58ff42,_0x3fe235){return db[_0x10b8('0x44')][_0x10b8('0x5e')](_0x58ff42[_0x10b8('0x5f')],{})['then'](function(_0x4059fc){var _0x12ca77=_0x58ff42[_0x10b8('0x60')][_0x10b8('0x39')]({'plain':!![]});if(!_0x12ca77)throw new Error(_0x10b8('0x61'));if(_0x12ca77[_0x10b8('0x62')]===_0x10b8('0x60')){var _0x261ae9=_0x4059fc[_0x10b8('0x39')]({'plain':!![]});var _0x286e2f=_0x10b8('0x3a');return db[_0x10b8('0x63')][_0x10b8('0x64')]({'where':{'name':_0x286e2f,'userProfileId':_0x12ca77['userProfileId']},'raw':!![]})['then'](function(_0x15c460){if(_0x15c460&&_0x15c460[_0x10b8('0x65')]===0x0){return db[_0x10b8('0x3b')]['create']({'name':_0x261ae9['name'],'resourceId':_0x261ae9['id'],'type':_0x15c460[_0x10b8('0x3e')],'sectionId':_0x15c460['id']},{})[_0x10b8('0x20')](function(){return _0x4059fc;});}else{return _0x4059fc;}})[_0x10b8('0x2a')](function(_0x286446){logger[_0x10b8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x286446);throw _0x286446;});}return _0x4059fc;})[_0x10b8('0x20')](respondWithResult(_0x3fe235,0xc9))[_0x10b8('0x2a')](handleError(_0x3fe235,null));};exports['update']=function(_0x2d335a,_0x19f62b){if(_0x2d335a[_0x10b8('0x5f')]['id']){delete _0x2d335a[_0x10b8('0x5f')]['id'];}return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0x2d335a[_0x10b8('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x10b8('0x42')}]})[_0x10b8('0x20')](handleEntityNotFound(_0x19f62b,null))[_0x10b8('0x20')](saveUpdates(_0x2d335a[_0x10b8('0x5f')],null))[_0x10b8('0x20')](respondWithResult(_0x19f62b,null))[_0x10b8('0x2a')](handleError(_0x19f62b,null));};exports['destroy']=function(_0x142f75,_0x2efc50){return db[_0x10b8('0x44')]['find']({'where':{'id':_0x142f75[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x2efc50,null))['then'](removeEntity(_0x2efc50,null))[_0x10b8('0x2a')](handleError(_0x2efc50,null));};exports['describe']=function(_0x352b8a,_0x411d7e){return db['SmsAccount'][_0x10b8('0x66')]()[_0x10b8('0x20')](respondWithResult(_0x411d7e,null))['catch'](handleError(_0x411d7e,null));};exports[_0x10b8('0x67')]=function(_0x2f9dbc,_0xbe5458,_0x1ad62b){if(_0x2f9dbc['body']['id']){delete _0x2f9dbc[_0x10b8('0x5f')]['id'];}return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x2f9dbc[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0xbe5458,null))['then'](function(_0x41e4bc){if(_0x41e4bc){_0x2f9dbc[_0x10b8('0x5f')][_0x10b8('0x68')]=_0x41e4bc['id'];return db[_0x10b8('0x69')][_0x10b8('0x5e')](_0x2f9dbc[_0x10b8('0x5f')]);}})[_0x10b8('0x20')](respondWithResult(_0xbe5458,null))[_0x10b8('0x2a')](handleError(_0xbe5458,null));};exports['getDispositions']=function(_0xb7b2dd,_0x481d04,_0x882c91){var _0x145291={'raw':![],'where':{}};var _0xf0eaa0={};var _0x340fd9={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xb7b2dd[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x481d04,null))[_0x10b8('0x20')](function(_0x62a4f){if(_0x62a4f){_0xf0eaa0[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db[_0x10b8('0x69')][_0x10b8('0x45')]);_0xf0eaa0[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0xb7b2dd[_0x10b8('0x4b')]);_0xf0eaa0['filters']=_['intersection'](_0xf0eaa0['model'],_0xf0eaa0[_0x10b8('0x4b')]);_0x145291[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0xf0eaa0[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0xb7b2dd['query']['fields']));_0x145291[_0x10b8('0x4e')]=_0x145291['attributes'][_0x10b8('0x50')]?_0x145291[_0x10b8('0x4e')]:_0xf0eaa0[_0x10b8('0x49')];if(!_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x51')](_0x10b8('0x52'))){_0x145291[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0xb7b2dd['query'][_0x10b8('0x30')]);_0x145291['offset']=qs[_0x10b8('0x2d')](_0xb7b2dd['query']['offset']);}_0x145291[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x145291[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0xb7b2dd[_0x10b8('0x4b')],_0xf0eaa0[_0x10b8('0x4c')]));_0x145291['where'][_0x10b8('0x68')]=_0x62a4f['id'];if(_0xb7b2dd['query']['filter']){_0x145291['where']=_[_0x10b8('0x57')](_0x145291[_0x10b8('0x56')],{'$or':_['map'](_0x145291[_0x10b8('0x4e')],function(_0x1d54f4){var _0x14aea1={};_0x14aea1[_0x1d54f4]={'$like':'%'+_0xb7b2dd[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x14aea1;})});}_0x145291=_[_0x10b8('0x57')]({},_0x145291,_0xb7b2dd[_0x10b8('0x58')]);return db[_0x10b8('0x69')][_0x10b8('0x2f')]({'where':_0x145291['where']})[_0x10b8('0x20')](function(_0x99ec56){_0x340fd9[_0x10b8('0x2f')]=_0x99ec56;if(_0xb7b2dd[_0x10b8('0x4b')]['includeAll']){_0x145291[_0x10b8('0x5d')]=[{'all':!![]}];}return db[_0x10b8('0x69')][_0x10b8('0x5a')](_0x145291);})[_0x10b8('0x20')](function(_0x2b1769){_0x340fd9[_0x10b8('0x5b')]=_0x2b1769;return _0x340fd9;});}})[_0x10b8('0x20')](respondWithFilteredResult(_0x481d04,_0x145291))[_0x10b8('0x2a')](handleError(_0x481d04,null));};exports['removeDispositions']=function(_0x34c201,_0x382578,_0xe9c06a){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x34c201[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x382578,null))[_0x10b8('0x20')](function(_0x4af548){if(_0x4af548){return _0x4af548['removeDispositions'](_0x34c201[_0x10b8('0x4b')][_0x10b8('0x6b')]);}})['then'](respondWithStatusCode(_0x382578,null))[_0x10b8('0x2a')](handleError(_0x382578,null));};exports['addAnswer']=function(_0x42d25b,_0x2104eb,_0x3cc3af){if(_0x42d25b['body']['id']){delete _0x42d25b[_0x10b8('0x5f')]['id'];}return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x42d25b['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x2104eb,null))[_0x10b8('0x20')](function(_0x54a7e4){if(_0x54a7e4){_0x42d25b[_0x10b8('0x5f')][_0x10b8('0x68')]=_0x54a7e4['id'];return db['CannedAnswer'][_0x10b8('0x5e')](_0x42d25b[_0x10b8('0x5f')]);}})['then'](respondWithResult(_0x2104eb,null))[_0x10b8('0x2a')](handleError(_0x2104eb,null));};exports[_0x10b8('0x6c')]=function(_0x5e46a1,_0x5ecbd8,_0x3145f3){var _0x12c020={'raw':![],'where':{}};var _0x1a0725={};var _0x1e8239={'count':0x0,'rows':[]};return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x5e46a1['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x5ecbd8,null))[_0x10b8('0x20')](function(_0x56a719){if(_0x56a719){_0x1a0725['model']=_[_0x10b8('0x4a')](db[_0x10b8('0x6e')][_0x10b8('0x45')]);_0x1a0725['query']=_['keys'](_0x5e46a1[_0x10b8('0x4b')]);_0x1a0725[_0x10b8('0x4c')]=_['intersection'](_0x1a0725[_0x10b8('0x49')],_0x1a0725['query']);_0x12c020[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x1a0725[_0x10b8('0x49')],qs['fields'](_0x5e46a1['query'][_0x10b8('0x4f')]));_0x12c020[_0x10b8('0x4e')]=_0x12c020['attributes'][_0x10b8('0x50')]?_0x12c020['attributes']:_0x1a0725[_0x10b8('0x49')];if(!_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x51')]('nolimit')){_0x12c020[_0x10b8('0x30')]=qs['limit'](_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x12c020[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x5e46a1['query']['offset']);}_0x12c020[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x5e46a1['query']['sort']);_0x12c020[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0x5e46a1['query'],_0x1a0725[_0x10b8('0x4c')]));_0x12c020[_0x10b8('0x56')][_0x10b8('0x68')]=_0x56a719['id'];if(_0x5e46a1[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x12c020[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0x12c020[_0x10b8('0x56')],{'$or':_['map'](_0x12c020[_0x10b8('0x4e')],function(_0x3b7d0a){var _0x1336e0={};_0x1336e0[_0x3b7d0a]={'$like':'%'+_0x5e46a1['query'][_0x10b8('0x55')]+'%'};return _0x1336e0;})});}_0x12c020=_[_0x10b8('0x57')]({},_0x12c020,_0x5e46a1[_0x10b8('0x58')]);return db[_0x10b8('0x6e')][_0x10b8('0x2f')]({'where':_0x12c020[_0x10b8('0x56')]})[_0x10b8('0x20')](function(_0x540ac8){_0x1e8239[_0x10b8('0x2f')]=_0x540ac8;if(_0x5e46a1['query']['includeAll']){_0x12c020[_0x10b8('0x5d')]=[{'all':!![]}];}return db[_0x10b8('0x6e')]['findAll'](_0x12c020);})[_0x10b8('0x20')](function(_0x25462a){_0x1e8239[_0x10b8('0x5b')]=_0x25462a;return _0x1e8239;});}})[_0x10b8('0x20')](respondWithFilteredResult(_0x5ecbd8,_0x12c020))['catch'](handleError(_0x5ecbd8,null));};exports[_0x10b8('0x6f')]=function(_0x2f8be0,_0x30f6bd,_0x164cff){return db[_0x10b8('0x44')]['find']({'where':{'id':_0x2f8be0[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30f6bd,null))[_0x10b8('0x20')](function(_0x47d5ad){if(_0x47d5ad){return _0x47d5ad['removeAnswers'](_0x2f8be0[_0x10b8('0x4b')][_0x10b8('0x6b')]);}})[_0x10b8('0x20')](respondWithStatusCode(_0x30f6bd,null))[_0x10b8('0x2a')](handleError(_0x30f6bd,null));};exports[_0x10b8('0x70')]=function(_0x2be967,_0x21437e,_0x56c800){var _0x586221={'channel':_0x10b8('0x71')};var _0x299e38=[];var _0x50400a=[];var _0x2a95bd={};return db[_0x10b8('0x44')]['find']({'where':{'id':_0x2be967[_0x10b8('0x5c')]['id']},'include':[{'model':db[_0x10b8('0x72')],'as':'Applications'}]})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))['then'](function(_0xcdc309){_0x586221[_0x10b8('0x73')]=_0xcdc309;_0x586221[_0x10b8('0x74')]=_['orderBy'](_0xcdc309[_0x10b8('0x75')],['priority'],[_0x10b8('0x76')]);if(_0x586221[_0x10b8('0x73')][_0x10b8('0x75')]){delete _0x586221[_0x10b8('0x73')][_0x10b8('0x75')];}return db[_0x10b8('0x77')][_0x10b8('0x66')]();})[_0x10b8('0x20')](function(_0x1f1996){if(!_0x1f1996){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0x7a'));}_0x299e38=_[_0x10b8('0x7b')](_[_0x10b8('0x4a')](_0x1f1996),[_0x10b8('0x7c'),_0x10b8('0x7d')]);_0x50400a=_['difference'](_[_0x10b8('0x4a')](_0x1f1996),['createdAt',_0x10b8('0x7d'),_0x10b8('0x7e'),_0x10b8('0x7f')]);_0x586221[_0x10b8('0x5f')]={'mapKey':'mobile'};if(_0x586221[_0x10b8('0x73')]['type']){switch(_0x586221[_0x10b8('0x73')][_0x10b8('0x47')]){case _0x10b8('0x80'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x82')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['Body'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x83')];break;case _0x10b8('0x84'):_0x586221[_0x10b8('0x5f')]['from']='+'+_0x2be967[_0x10b8('0x5f')][_0x10b8('0x85')];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x86')];break;case _0x10b8('0x87'):_0x586221['body'][_0x10b8('0x81')]=_0x2be967['body'][_0x10b8('0x81')];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x27')];break;case _0x10b8('0x88'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x81')];_0x586221['body']['body']=_0x2be967['body'][_0x10b8('0x5f')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967['body'][_0x10b8('0x8a')];break;case _0x10b8('0x8b'):_0x586221['body'][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x82')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['Text'];_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')]['MessageUUID'];break;case'infobip':_0x586221['body'][_0x10b8('0x81')]='+'+_0x2be967[_0x10b8('0x5f')]['results'][0x0][_0x10b8('0x81')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['results'][0x0]['text'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8c')][0x0][_0x10b8('0x89')];break;case _0x10b8('0x8d'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967['body']['originatingAddress'];_0x586221['body'][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8e')][_0x10b8('0x27')];break;case'clickatell':_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x8f')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['text'];_0x586221['body'][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x90')];break;case'bandwidth':_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')]=_0x2be967[_0x10b8('0x5f')][0x0]['message']['id'];_0x586221['body']['from']=_0x2be967[_0x10b8('0x5f')][0x0]['message']['from'];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')][0x0][_0x10b8('0x27')]['text'];break;case _0x10b8('0x91'):_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')]=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x81')];_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]=_0x2be967[_0x10b8('0x5f')]['message'];_0x586221[_0x10b8('0x5f')]['messageId']=_0x2be967[_0x10b8('0x5f')][_0x10b8('0x92')];break;}}if(_0x586221[_0x10b8('0x5f')]['id']){delete _0x586221['body']['id'];}if(_['isNil'](_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')])){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0x93'));}if(_['isNil'](_0x586221[_0x10b8('0x5f')]['body'])||_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')]===''){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')])){throw new db[(_0x10b8('0x78'))]['ValidationError'](_0x10b8('0x95')+_0x50400a);}if(!_['includes'](_0x50400a,_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')])){throw new db[(_0x10b8('0x78'))]['ValidationError'](_0x10b8('0x96')+_0x50400a);}_0x2a95bd[_0x586221['body'][_0x10b8('0x94')]]=_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')];return db[_0x10b8('0x97')][_0x10b8('0x64')]({'where':{'id':_0x586221[_0x10b8('0x73')]['ListId']},'include':[{'model':db[_0x10b8('0x77')],'as':_0x10b8('0x98'),'where':_0x2a95bd,'limit':0x1,'order':[[_0x10b8('0x7d'),_0x10b8('0x99')]]}]});})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))[_0x10b8('0x20')](function(_0x8af95d){if(_0x8af95d){_0x586221[_0x10b8('0x9a')]=_[_0x10b8('0x9b')](_0x8af95d,[_0x10b8('0x98')]);if(_0x8af95d[_0x10b8('0x98')][_0x10b8('0x50')]){return _0x8af95d['Contacts'][0x0];}var _0x4dfa35=_[_0x10b8('0x18')](_0x586221[_0x10b8('0x5f')],{'firstName':_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')],'ListId':_0x8af95d['id']});_0x4dfa35[_0x586221[_0x10b8('0x5f')][_0x10b8('0x94')]]=_0x586221[_0x10b8('0x5f')][_0x10b8('0x81')];return db[_0x10b8('0x77')][_0x10b8('0x5e')](_0x4dfa35,{'fields':_0x299e38,'raw':!![]});}})[_0x10b8('0x20')](handleEntityNotFound(_0x21437e,null))[_0x10b8('0x20')](function(_0x565c57){if(_0x565c57){_0x586221[_0x10b8('0x9c')]=_0x565c57;var _0x398215={'ContactId':_0x565c57['id'],'phone':_0x586221[_0x10b8('0x5f')]['from'],'SmsAccountId':_0x2be967['params']['id']};var _0x98b3f4={'ContactId':_0x565c57['id'],'SmsAccountId':_0x2be967['params']['id'],'closed':![]};return db[_0x10b8('0x9d')][_0x10b8('0x64')]({'where':_0x98b3f4})[_0x10b8('0x20')](function(_0x115feb){if(_0x115feb){return[_0x115feb,![]];}return db['SmsInteraction']['create'](_0x398215)[_0x10b8('0x20')](function(_0x2822f0){return[_0x2822f0,!![]];});});}})[_0x10b8('0x9e')](function(_0x41fe2b,_0x23080f){_0x586221['interaction']=_0x41fe2b['get']({'plain':!![]});_0x586221[_0x10b8('0x9f')]['created']=![];if(_0x23080f){if(_0x586221[_0x10b8('0x73')][_0x10b8('0xa0')]){_0x586221[_0x10b8('0x74')]['push']({'id':0x0,'priority':_0x586221['applications']['length']+0x1,'app':_0x10b8('0xa1'),'appdata':_0x10b8('0xa2'),'interval':_0x10b8('0xa3')});}_0x586221['interaction']['created']=!![];}return db['SmsMessage']['create']({'phone':_0x586221[_0x10b8('0x5f')]['from'],'messageId':_0x586221[_0x10b8('0x5f')][_0x10b8('0x89')],'body':_0x586221[_0x10b8('0x5f')][_0x10b8('0x5f')],'SmsAccountId':_0x2be967[_0x10b8('0x5c')]['id'],'SmsInteractionId':_0x41fe2b['id'],'direction':'in','ContactId':_0x41fe2b[_0x10b8('0xa4')],'AttachmentId':_0x586221[_0x10b8('0x5f')][_0x10b8('0xa5')]});})[_0x10b8('0x20')](function(_0x65827d){_0x586221[_0x10b8('0x27')]=_0x65827d;if(!_0x586221[_0x10b8('0x9f')][_0x10b8('0xa6')])return;return db[_0x10b8('0xa7')][_0x10b8('0x64')]({'attributes':['id','name'],'where':{'id':_0x586221[_0x10b8('0x9f')]['UserId']}});})[_0x10b8('0x20')](function(_0x471978){if(_0x471978){_0x586221[_0x10b8('0x74')][_0x10b8('0xa8')]({'id':0x0,'priority':0x0,'app':_0x10b8('0xa9'),'appdata':_0x471978[_0x10b8('0x3e')]+','+(_0x586221['account'][_0x10b8('0xaa')]||0xa),'interval':'*,*,*,*'});}if(!_0x586221[_0x10b8('0x9f')][_0x10b8('0xab')])return;return db[_0x10b8('0xac')][_0x10b8('0x64')]({'attributes':['id',_0x10b8('0x3e')],'where':{'id':_0x586221['interaction'][_0x10b8('0xab')]}});})[_0x10b8('0x20')](function(_0x541087){if(_0x541087){_0x586221[_0x10b8('0x74')][_0x10b8('0xa8')]({'id':0x0,'priority':0x1,'app':_0x10b8('0xad'),'appdata':_0x541087[_0x10b8('0x3e')]+','+(_0x586221[_0x10b8('0x73')][_0x10b8('0xae')]||0x12c),'interval':_0x10b8('0xa3')});}return respondWithRpcPromise(_0x10b8('0xaf'),'startRouting',_0x586221);})[_0x10b8('0x20')](function(_0x1266c5){if(_0x1266c5){var _0x3804e1=0xc8;var _0x9338b6='receiveMessage';logger['info'](_0x10b8('0x24'),_0x9338b6,_0x3804e1,_0x10b8('0xb0'));logger[_0x10b8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x9338b6,_0x3804e1,_0x10b8('0xb0'),JSON['stringify'](_0x1266c5));if(_0x586221['account'][_0x10b8('0x47')]===_0x10b8('0x80')){return _0x21437e[_0x10b8('0x2c')](_0x3804e1)['set'](_0x10b8('0xb1'),_0x10b8('0xb2'))[_0x10b8('0x3f')](_0x10b8('0xb3'));}else{return _0x21437e[_0x10b8('0x2c')](_0x3804e1)[_0x10b8('0x33')](_0x1266c5);}}})[_0x10b8('0x2a')](handleError(_0x21437e,null));};exports[_0x10b8('0xb4')]=function(_0x1dd7d3,_0x305fb9){var _0xc5f75=_0x1dd7d3[_0x10b8('0x5c')]['id'];var _0x565c55=_0x1dd7d3[_0x10b8('0x5f')];var _0x1709d0=0xc8;var _0x194bcb=null;return db[_0x10b8('0xb5')][_0x10b8('0xb6')]({'isolationLevel':db[_0x10b8('0xb5')][_0x10b8('0xb7')][_0x10b8('0xb8')][_0x10b8('0xb9')]},function(_0x30a5d9){return db[_0x10b8('0x44')]['findOne']({'where':{'id':_0xc5f75},'transaction':_0x30a5d9})[_0x10b8('0x20')](function(_0x2a629c){if(_0x2a629c){return db[_0x10b8('0x72')]['destroy']({'where':{'SmsAccountId':_0xc5f75},'transaction':_0x30a5d9})['then'](function(){var _0x88f156=_[_0x10b8('0x43')](_0x565c55,function(_0x464a81){_0x464a81[_0x10b8('0x68')]=_0xc5f75;return _0x464a81;});return db[_0x10b8('0x72')]['bulkCreate'](_0x88f156,{'transaction':_0x30a5d9});});}else{_0x1709d0=0x194;_0x194bcb=[];}});})['then'](function(){if(_0x1709d0!==0x194){return db[_0x10b8('0x72')][_0x10b8('0xba')]({'where':{'SmsAccountId':_0xc5f75},'order':_0x10b8('0xbb')})[_0x10b8('0x20')](function(_0x3004eb){_0x194bcb=_0x3004eb;});}})[_0x10b8('0x2a')](function(_0x55b936){_0x1709d0=0x1f4;logger[_0x10b8('0x26')](_0x55b936[_0x10b8('0x3d')]);if(_0x55b936[_0x10b8('0x3e')]){delete _0x55b936['name'];}_0x194bcb=_0x55b936;})['finally'](function(){if(_0x194bcb===null){_0x305fb9[_0x10b8('0x2b')](_0x1709d0);}else{if(_0x1709d0===0x1f4){_0x305fb9[_0x10b8('0x2c')](_0x1709d0)['send'](_0x194bcb);}else{_0x305fb9[_0x10b8('0x2c')](_0x1709d0)['json'](_0x194bcb);}}});};exports['getApplications']=function(_0x20ec3e,_0x19e6d9,_0x3986c3){var _0x3e4381={};var _0x27e99e={};var _0x4e3229;var _0x3d0a95;return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x20ec3e[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x19e6d9,null))['then'](function(_0x3047ae){if(_0x3047ae){_0x4e3229=_0x3047ae;_0x27e99e[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db['SmsApplication']['rawAttributes']);_0x27e99e['query']=_[_0x10b8('0x4a')](_0x20ec3e['query']);_0x27e99e[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x27e99e[_0x10b8('0x49')],_0x27e99e[_0x10b8('0x4b')]);_0x3e4381[_0x10b8('0x4e')]=_[_0x10b8('0x4d')](_0x27e99e[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x4f')]));_0x3e4381['attributes']=_0x3e4381[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x3e4381[_0x10b8('0x4e')]:_0x27e99e[_0x10b8('0x49')];_0x3e4381['order']=qs['sort'](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x3e4381[_0x10b8('0x56')]=qs['filters'](_[_0x10b8('0x6a')](_0x20ec3e[_0x10b8('0x4b')],_0x27e99e['filters']));if(_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x55')]){_0x3e4381['where']=_['merge'](_0x3e4381[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0x3e4381[_0x10b8('0x4e')],function(_0x4e2b1b){var _0x15f3d9={};_0x15f3d9[_0x4e2b1b]={'$like':'%'+_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x15f3d9;})});}_0x3e4381=_['merge']({},_0x3e4381,_0x20ec3e[_0x10b8('0x58')]);return _0x4e3229['getApplications'](_0x3e4381);}})[_0x10b8('0x20')](function(_0x32a6b0){if(_0x32a6b0){_0x3d0a95=_0x32a6b0[_0x10b8('0x50')];if(!_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x51')]('nolimit')){_0x3e4381['limit']=qs[_0x10b8('0x30')](_0x20ec3e[_0x10b8('0x4b')][_0x10b8('0x30')]);_0x3e4381[_0x10b8('0x2d')]=qs['offset'](_0x20ec3e[_0x10b8('0x4b')]['offset']);}return _0x4e3229[_0x10b8('0xbc')](_0x3e4381);}})[_0x10b8('0x20')](function(_0x491010){if(_0x491010){return _0x491010?{'count':_0x3d0a95,'rows':_0x491010}:null;}})['then'](respondWithResult(_0x19e6d9,null))['catch'](handleError(_0x19e6d9,null));};exports['getInteractions']=function(_0x166851,_0x31bab3,_0x3d4883){var _0x2ec485={'raw':![],'where':{}};var _0x4132f7={};var _0x433bb3={'count':0x0,'rows':[]};return db[_0x10b8('0x44')]['findOne']({'where':{'id':_0x166851[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x31bab3,null))['then'](function(_0x1f88a8){if(_0x1f88a8){_0x4132f7[_0x10b8('0x49')]=_[_0x10b8('0x4a')](db['SmsInteraction'][_0x10b8('0x45')]);_0x4132f7[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0x166851['query']);_0x4132f7[_0x10b8('0x4c')]=_[_0x10b8('0x4d')](_0x4132f7[_0x10b8('0x49')],_0x4132f7[_0x10b8('0x4b')]);_0x2ec485['attributes']=_[_0x10b8('0x4d')](_0x4132f7[_0x10b8('0x49')],qs[_0x10b8('0x4f')](_0x166851['query'][_0x10b8('0x4f')]));_0x2ec485[_0x10b8('0x4e')]=_0x2ec485[_0x10b8('0x4e')][_0x10b8('0x50')]?_0x2ec485[_0x10b8('0x4e')]:_0x4132f7[_0x10b8('0x49')];if(!_0x166851[_0x10b8('0x4b')]['hasOwnProperty']('nolimit')){_0x2ec485[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x166851[_0x10b8('0x4b')]['limit']);_0x2ec485[_0x10b8('0x2d')]=qs[_0x10b8('0x2d')](_0x166851[_0x10b8('0x4b')]['offset']);}_0x2ec485[_0x10b8('0x53')]=qs[_0x10b8('0x54')](_0x166851[_0x10b8('0x4b')][_0x10b8('0x54')]);_0x2ec485[_0x10b8('0x56')]=qs['filters'](_[_0x10b8('0x6a')](_0x166851['query'],_0x4132f7[_0x10b8('0x4c')]));_0x2ec485['where'][_0x10b8('0x68')]=_0x1f88a8['id'];if(_0x166851['query'][_0x10b8('0x55')]){_0x2ec485[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0x2ec485['where'],{'$or':_[_0x10b8('0x43')](_0x2ec485['attributes'],function(_0x11c545){var _0x3a6c2a={};_0x3a6c2a[_0x11c545]={'$like':'%'+_0x166851['query'][_0x10b8('0x55')]+'%'};return _0x3a6c2a;})});}_0x2ec485=_[_0x10b8('0x57')]({},_0x2ec485,_0x166851[_0x10b8('0x58')]);return db[_0x10b8('0x9d')]['count']({'where':_0x2ec485[_0x10b8('0x56')]})[_0x10b8('0x20')](function(_0x143778){_0x433bb3[_0x10b8('0x2f')]=_0x143778;if(_0x166851[_0x10b8('0x4b')]['includeAll']){_0x2ec485[_0x10b8('0x5d')]=[{'model':db['CmContact'],'as':_0x10b8('0xbd'),'required':![]},{'model':db[_0x10b8('0xa7')],'as':_0x10b8('0xbe'),'attributes':[_0x10b8('0x3e'),_0x10b8('0xbf'),_0x10b8('0xc0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x10b8('0x3e'),_0x10b8('0xc1')],'where':_0x166851[_0x10b8('0x4b')][_0x10b8('0xc2')]?{'id':_0x166851[_0x10b8('0x4b')]['tag']}:undefined,'required':_0x166851[_0x10b8('0x4b')][_0x10b8('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x10b8('0x5a')](_0x2ec485);})[_0x10b8('0x20')](function(_0x4a22c2){_0x433bb3[_0x10b8('0x5b')]=_0x4a22c2;return _0x433bb3;});}})['then'](respondWithFilteredResult(_0x31bab3,_0x2ec485))['catch'](handleError(_0x31bab3,null));};exports[_0x10b8('0x3f')]=function(_0x2ae0a8,_0x975443,_0x21ca5a){var _0x558a2e,_0x1e12dc,_0x5524ab;if(_['isNil'](_0x2ae0a8[_0x10b8('0x5f')]['body'])||_0x2ae0a8[_0x10b8('0x5f')][_0x10b8('0x5f')]===''){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0xc3'));}if(_[_0x10b8('0xc4')](_0x2ae0a8[_0x10b8('0x5f')]['to'])){throw new db[(_0x10b8('0x78'))][(_0x10b8('0x79'))](_0x10b8('0xc5'));}_0x558a2e=_0x2ae0a8[_0x10b8('0x5f')]['to'];return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0x2ae0a8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x10b8('0x77')],'as':_0x10b8('0x98'),'where':{'mobile':_0x558a2e},'limit':0x1,'order':[['updatedAt',_0x10b8('0x99')]]}]}]})[_0x10b8('0x20')](handleEntityNotFound(_0x975443,null))['then'](function(_0x42033d){if(_0x42033d&&_0x42033d[_0x10b8('0xc6')]){_0x1e12dc=_0x42033d[_0x10b8('0x39')]({'plain':!![]});if(_0x1e12dc[_0x10b8('0xc6')]&&_0x1e12dc[_0x10b8('0xc6')][_0x10b8('0x98')][_0x10b8('0x50')]){return _0x1e12dc[_0x10b8('0xc6')][_0x10b8('0x98')][0x0];}return db['CmContact'][_0x10b8('0x5e')](_[_0x10b8('0x18')](_0x2ae0a8[_0x10b8('0x5f')],{'firstName':_0x558a2e,'mobile':_0x558a2e,'phone':_0x558a2e,'ListId':_0x1e12dc[_0x10b8('0x7f')]}));}})[_0x10b8('0x20')](handleEntityNotFound(_0x975443,null))[_0x10b8('0x20')](function(_0x1853cb){if(_0x1853cb){_0x5524ab=_0x1853cb;return db[_0x10b8('0x9d')][_0x10b8('0x64')]({'where':{'ContactId':_0x5524ab['id'],'closed':![],'SmsAccountId':_0x1e12dc['id']}})[_0x10b8('0x20')](function(_0x1c7ee5){if(_0x1c7ee5){return[_0x1c7ee5,![]];}return db[_0x10b8('0x9d')]['create']({'UserId':_0x2ae0a8[_0x10b8('0x60')]['id'],'ContactId':_0x5524ab['id'],'SmsAccountId':_0x1e12dc['id'],'phone':_0x558a2e,'firstMsgDirection':'out','Messages':[_[_0x10b8('0x57')](_0x2ae0a8['body'],{'read':![],'body':_0x2ae0a8[_0x10b8('0x5f')]['body'],'phone':_0x558a2e,'SmsAccountId':_0x1e12dc['id'],'UserId':_0x2ae0a8['user']['id'],'ContactId':_0x5524ab['id']})]},{'include':[{'model':db[_0x10b8('0xc7')],'as':_0x10b8('0xc8')}]})['then'](function(_0x51a753){return[_0x51a753,!![]];});});}})[_0x10b8('0x9e')](function(_0x284271,_0x701296){if(_0x701296){return _0x284271;}return db[_0x10b8('0xc7')]['create'](_[_0x10b8('0x57')](_0x2ae0a8['body'],{'read':![],'body':_0x2ae0a8[_0x10b8('0x5f')]['body'],'phone':_0x558a2e,'SmsAccountId':_0x1e12dc['id'],'SmsInteractionId':_0x284271['id'],'UserId':_0x2ae0a8[_0x10b8('0x60')]['id'],'ContactId':_0x5524ab['id']}))['then'](function(_0x53260e){_0x284271[_0x10b8('0xc9')][_0x10b8('0xc8')]=[];_0x284271['dataValues']['Messages'][_0x10b8('0xca')](_0x53260e[_0x10b8('0xc9')]);return _0x284271;});})[_0x10b8('0x20')](respondWithResult(_0x975443,null))['catch'](handleError(_0x975443,null));};exports[_0x10b8('0x2c')]=function(_0x12faf4,_0x4c349a,_0x370d17){if(_0x12faf4['body']['id']){delete _0x12faf4[_0x10b8('0x5f')]['id'];}var _0x50127e,_0x5b051d,_0x1d4deb;return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x12faf4[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x4c349a,null))[_0x10b8('0x20')](function(_0x17c8ea){if(_0x17c8ea){_0x1d4deb=_0x17c8ea;logger[_0x10b8('0x23')](_0x10b8('0x24'),'status',_0x10b8('0xcb'),_0x17c8ea[_0x10b8('0x47')],util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));switch(_0x17c8ea[_0x10b8('0x47')]){case'skebby':if(_0x12faf4['body'][_0x10b8('0xcd')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4['body'][_0x10b8('0xcd')]}});}break;case _0x10b8('0x87'):if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xce')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xcf')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xcf')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')]['requestid']}});}break;case'clicksend':if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x8a')]&&_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd0')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd0')];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')]['message_id']}});}break;case'infobip':var _0x16914e=_0x12faf4['body']['results'][0x0];if(_0x16914e[_0x10b8('0x89')]&&_0x16914e[_0x10b8('0x2c')][_0x10b8('0xd1')]===_0x10b8('0xd2')){_0x5b051d=_0x16914e[_0x10b8('0x2c')]['groupName'];return db[_0x10b8('0xc7')][_0x10b8('0x64')]({'where':{'messageId':_0x16914e['messageId']}});}break;case _0x10b8('0xd3'):if(_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x89')]&&_0x12faf4['body'][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4['body'][_0x10b8('0x2c')];return db['SmsMessage'][_0x10b8('0x64')]({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x89')]}});}break;case'bandwidth':if(_0x12faf4['body'][0x0]['message']['id']){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][0x0][_0x10b8('0x47')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][0x0][_0x10b8('0x27')]['id']}});}break;case _0x10b8('0x91'):if(_0x12faf4[_0x10b8('0x5f')]['redif']&&_0x12faf4['body'][_0x10b8('0x2c')]){_0x5b051d=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x2c')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd4')]}});}break;}}})[_0x10b8('0x20')](handleEntityNotFound(_0x4c349a,null))[_0x10b8('0x20')](function(_0x40a5a5){if(_0x40a5a5){_0x50127e=_0x40a5a5;switch(_0x1d4deb[_0x10b8('0x47')]){case'skebby':if(_0x5b051d===_0x10b8('0xd2')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),'skebby',util[_0x10b8('0xcc')](_0x12faf4['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5b051d==='1'){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x84'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0x88'):if(!_0x12faf4[_0x10b8('0x5f')][_0x10b8('0xd5')]&&_0x5b051d>=0xc8&&_0x5b051d<=0xce){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x88'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0xd6'):var _0x1505f6=_0x12faf4[_0x10b8('0x5f')][_0x10b8('0x8c')][0x0];if(_0x1505f6[_0x10b8('0x2c')]['groupName']===_0x10b8('0xd2')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util['inspect'](_0x12faf4['body'],{'showHidden':![],'depth':null}));}break;case _0x10b8('0xd3'):if(_0x5b051d=='DELIVERED_TO_GATEWAY'||_0x5b051d=='RECEIVED_BY_RECIPIENT'){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0xd3'),util[_0x10b8('0xcc')](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x5b051d==_0x10b8('0xd7')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),'status',_0x10b8('0xd8'),util['inspect'](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x10b8('0x91'):if(_0x5b051d===_0x10b8('0xd9')||_0x5b051d===_0x10b8('0xda')){return _0x50127e[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x10b8('0x2c'),_0x10b8('0x91'),util['inspect'](_0x12faf4[_0x10b8('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x50127e;}})['then'](respondWithResult(_0x4c349a,null))[_0x10b8('0x2a')](handleError(_0x4c349a,null));};exports[_0x10b8('0xdb')]=function(_0xa96549,_0x4556b3,_0x23afc2){var _0x22802a,_0x4bde36,_0x204240;return db['SmsAccount'][_0x10b8('0x64')]({'where':{'id':_0xa96549[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4556b3,null))[_0x10b8('0x20')](function(_0x48454b){if(_0x48454b){_0x204240=_0x48454b;logger['debug'](_0x10b8('0x24'),'status',_0x10b8('0xcb'),_0x48454b[_0x10b8('0x47')],util[_0x10b8('0xcc')](_0xa96549['query'],{'showHidden':![],'depth':null}));switch(_0x48454b[_0x10b8('0x47')]){case'csc':if(_0xa96549['query'][_0x10b8('0xdc')]&&_0xa96549[_0x10b8('0x4b')][_0x10b8('0xdd')]){_0x4bde36=_0xa96549['query'][_0x10b8('0xdd')];return db[_0x10b8('0xc7')]['find']({'where':{'messageId':_0xa96549[_0x10b8('0x4b')]['message-id']}});}break;}}})[_0x10b8('0x20')](handleEntityNotFound(_0x4556b3,null))['then'](function(_0x530c20){if(_0x530c20){_0x22802a=_0x530c20;switch(_0x204240[_0x10b8('0x47')]){case _0x10b8('0x8d'):if(_0x4bde36==='2'||_0x4bde36==='6'){return _0x22802a[_0x10b8('0x37')]({'read':!![]});}else{logger[_0x10b8('0x26')](_0x10b8('0x24'),_0x10b8('0x2c'),_0x10b8('0x8d'),util[_0x10b8('0xcc')](_0xa96549[_0x10b8('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x22802a;}})[_0x10b8('0x20')](respondWithResult(_0x4556b3,null))[_0x10b8('0x2a')](handleError(_0x4556b3,null));};exports['addAgents']=function(_0x5a2bac,_0xc504fd,_0x1d064a){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x5a2bac['params']['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0xc504fd,null))[_0x10b8('0x20')](function(_0x597377){if(_0x597377){return _0x597377[_0x10b8('0xde')](_0x5a2bac['body'][_0x10b8('0x6b')],_[_0x10b8('0x9b')](_0x5a2bac['body'],[_0x10b8('0x6b'),'id'])||{})['spread'](function(_0x441e4b){for(var _0x1857c2=0x0;_0x1857c2<_0x5a2bac[_0x10b8('0x5f')][_0x10b8('0x6b')][_0x10b8('0x50')];_0x1857c2+=0x1){socket[_0x10b8('0xdf')](_0x10b8('0xe0'),{'UserId':Number(_0x5a2bac[_0x10b8('0x5f')][_0x10b8('0x6b')][_0x1857c2]),'SmsAccountId':Number(_0x5a2bac[_0x10b8('0x5c')]['id'])});}return _0x441e4b;});}})[_0x10b8('0x20')](respondWithResult(_0xc504fd,null))[_0x10b8('0x2a')](handleError(_0xc504fd,null));};exports[_0x10b8('0xe1')]=function(_0x1c8747,_0x44d0e8,_0x5c4c7f){return db[_0x10b8('0x44')][_0x10b8('0x64')]({'where':{'id':_0x1c8747[_0x10b8('0x5c')]['id']}})[_0x10b8('0x20')](handleEntityNotFound(_0x44d0e8,null))[_0x10b8('0x20')](function(_0x3ad8b5){if(_0x3ad8b5){return _0x3ad8b5[_0x10b8('0xe1')](_0x1c8747['query'][_0x10b8('0x6b')])[_0x10b8('0x20')](function(){if(_[_0x10b8('0xe2')](_0x1c8747[_0x10b8('0x4b')][_0x10b8('0x6b')])){for(var _0x2e461a=0x0;_0x2e461a<_0x1c8747[_0x10b8('0x4b')]['ids'][_0x10b8('0x50')];_0x2e461a+=0x1){socket[_0x10b8('0xdf')](_0x10b8('0xe3'),{'UserId':Number(_0x1c8747[_0x10b8('0x4b')]['ids'][_0x2e461a]),'SmsAccountId':Number(_0x1c8747[_0x10b8('0x5c')]['id'])});}}else{socket[_0x10b8('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x1c8747[_0x10b8('0x4b')][_0x10b8('0x6b')]),'SmsAccountId':Number(_0x1c8747[_0x10b8('0x5c')]['id'])});}});}})[_0x10b8('0x20')](respondWithStatusCode(_0x44d0e8,null))[_0x10b8('0x2a')](handleError(_0x44d0e8,null));};exports[_0x10b8('0xe4')]=function(_0x5ed413,_0x1ec4e7,_0x40cb32){var _0xd6ddff={};var _0x58a417={};var _0x5b1e2c;var _0x6b16a2;return db[_0x10b8('0x44')][_0x10b8('0x6d')]({'where':{'id':_0x5ed413[_0x10b8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1ec4e7,null))[_0x10b8('0x20')](function(_0x50572b){if(_0x50572b){_0x5b1e2c=_0x50572b;_0x58a417['model']=_[_0x10b8('0x4a')](db['User']['rawAttributes']);_0x58a417[_0x10b8('0x4b')]=_[_0x10b8('0x4a')](_0x5ed413['query']);_0x58a417['filters']=_['intersection'](_0x58a417[_0x10b8('0x49')],_0x58a417[_0x10b8('0x4b')]);_0xd6ddff['attributes']=_[_0x10b8('0x4d')](_0x58a417['model'],qs[_0x10b8('0x4f')](_0x5ed413[_0x10b8('0x4b')]['fields']));_0xd6ddff[_0x10b8('0x4e')]=_0xd6ddff[_0x10b8('0x4e')][_0x10b8('0x50')]?_0xd6ddff[_0x10b8('0x4e')]:_0x58a417['model'];_0xd6ddff['order']=qs['sort'](_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x54')]);_0xd6ddff[_0x10b8('0x56')]=qs[_0x10b8('0x4c')](_[_0x10b8('0x6a')](_0x5ed413[_0x10b8('0x4b')],_0x58a417[_0x10b8('0x4c')]));if(_0x5ed413['query'][_0x10b8('0x55')]){_0xd6ddff[_0x10b8('0x56')]=_[_0x10b8('0x57')](_0xd6ddff[_0x10b8('0x56')],{'$or':_[_0x10b8('0x43')](_0xd6ddff['attributes'],function(_0xc341a3){var _0x308b03={};_0x308b03[_0xc341a3]={'$like':'%'+_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x55')]+'%'};return _0x308b03;})});}_0xd6ddff=_[_0x10b8('0x57')]({},_0xd6ddff,_0x5ed413[_0x10b8('0x58')]);return _0x5b1e2c[_0x10b8('0xe4')](_0xd6ddff);}})[_0x10b8('0x20')](function(_0x3f5f47){if(_0x3f5f47){_0x6b16a2=_0x3f5f47[_0x10b8('0x50')];if(!_0x5ed413['query'][_0x10b8('0x51')](_0x10b8('0x52'))){_0xd6ddff[_0x10b8('0x30')]=qs[_0x10b8('0x30')](_0x5ed413[_0x10b8('0x4b')][_0x10b8('0x30')]);_0xd6ddff[_0x10b8('0x2d')]=qs['offset'](_0x5ed413['query']['offset']);}return _0x5b1e2c['getAgents'](_0xd6ddff);}})[_0x10b8('0x20')](function(_0x5f064b){if(_0x5f064b){return _0x5f064b?{'count':_0x6b16a2,'rows':_0x5f064b}:null;}})['then'](respondWithResult(_0x1ec4e7,null))[_0x10b8('0x2a')](handleError(_0x1ec4e7,null));}; \ No newline at end of file +var _0x2c7d=['filters','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','length','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','from','From','Body','MessageSid','sender','text','connectel','clicksend','messageId','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','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','CmList','Contacts','DESC','list','omit','spread','interaction','created','close','unmanaged','SmsMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','twilio','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','SmsApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','user','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','bandwidth','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','name','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','keys'];(function(_0x3a0633,_0x120c59){var _0x58341e=function(_0x1ecb29){while(--_0x1ecb29){_0x3a0633['push'](_0x3a0633['shift']());}};_0x58341e(++_0x120c59);}(_0x2c7d,0x196));var _0xd2c7=function(_0x59eac3,_0x34aeb9){_0x59eac3=_0x59eac3-0x0;var _0x2d47b5=_0x2c7d[_0x59eac3];return _0x2d47b5;};'use strict';var emlformat=require(_0xd2c7('0x0'));var rimraf=require(_0xd2c7('0x1'));var zipdir=require(_0xd2c7('0x2'));var jsonpatch=require(_0xd2c7('0x3'));var rp=require(_0xd2c7('0x4'));var moment=require(_0xd2c7('0x5'));var BPromise=require(_0xd2c7('0x6'));var Mustache=require(_0xd2c7('0x7'));var util=require(_0xd2c7('0x8'));var path=require(_0xd2c7('0x9'));var sox=require(_0xd2c7('0xa'));var csv=require(_0xd2c7('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2c7('0xc'));var squel=require(_0xd2c7('0xd'));var crypto=require(_0xd2c7('0xe'));var jsforce=require(_0xd2c7('0xf'));var deskjs=require(_0xd2c7('0x10'));var toCsv=require(_0xd2c7('0xb'));var querystring=require(_0xd2c7('0x11'));var Papa=require(_0xd2c7('0x12'));var Redis=require(_0xd2c7('0x13'));var authService=require(_0xd2c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd2c7('0x15'));var hardwareService=require(_0xd2c7('0x16'));var logger=require(_0xd2c7('0x17'))(_0xd2c7('0x18'));var utils=require(_0xd2c7('0x19'));var config=require(_0xd2c7('0x1a'));var licenseUtil=require(_0xd2c7('0x1b'));var db=require(_0xd2c7('0x1c'))['db'];config[_0xd2c7('0x1d')]=_[_0xd2c7('0x1e')](config[_0xd2c7('0x1d')],{'host':_0xd2c7('0x1f'),'port':0x18eb});var socket=require(_0xd2c7('0x20'))(new Redis(config[_0xd2c7('0x1d')]));require('./smsAccount.socket')[_0xd2c7('0x21')](socket);var jayson=require(_0xd2c7('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5b6986,_0x3b9c26,_0x93c8d7,_0x13df43){return new BPromise(function(_0x11efbc,_0x4c1c9f){var _0x6a4a43=_0x13df43||client;return _0x6a4a43['request'](_0x5b6986,_0x93c8d7)[_0xd2c7('0x23')](function(_0x320ee7){logger['info'](_0xd2c7('0x24'),_0x3b9c26,_0xd2c7('0x25'));logger[_0xd2c7('0x26')](_0xd2c7('0x27'),_0x3b9c26,_0xd2c7('0x25'),JSON[_0xd2c7('0x28')](_0x320ee7));if(_0x320ee7['error']){if(_0x320ee7[_0xd2c7('0x29')][_0xd2c7('0x2a')]===0x1f4){logger['error'](_0xd2c7('0x24'),_0x3b9c26,_0x320ee7[_0xd2c7('0x29')]['message']);return _0x4c1c9f(_0x320ee7[_0xd2c7('0x29')][_0xd2c7('0x2b')]);}logger[_0xd2c7('0x29')]('SmsAccount,\x20%s,\x20%s',_0x3b9c26,_0x320ee7['error'][_0xd2c7('0x2b')]);return _0x11efbc(_0x320ee7['error'][_0xd2c7('0x2b')]);}else{logger[_0xd2c7('0x2c')](_0xd2c7('0x24'),_0x3b9c26,_0xd2c7('0x25'));_0x11efbc(_0x320ee7['result'][_0xd2c7('0x2b')]);}})['catch'](function(_0x53c8f9){logger[_0xd2c7('0x29')]('SmsAccount,\x20%s,\x20%s',_0x3b9c26,_0x53c8f9);_0x4c1c9f(_0x53c8f9);});});}function respondWithStatusCode(_0x2bea2d,_0x384d8b){_0x384d8b=_0x384d8b||0xcc;return function(_0x4b22d6){if(_0x4b22d6){return _0x2bea2d['sendStatus'](_0x384d8b);}return _0x2bea2d[_0xd2c7('0x2d')](_0x384d8b)[_0xd2c7('0x2e')]();};}function respondWithResult(_0x5cbfe9,_0x8f8958){_0x8f8958=_0x8f8958||0xc8;return function(_0x5ccb2c){if(_0x5ccb2c){return _0x5cbfe9[_0xd2c7('0x2d')](_0x8f8958)[_0xd2c7('0x2f')](_0x5ccb2c);}};}function respondWithFilteredResult(_0x53d2ed,_0x3ecaba){return function(_0x272348){if(_0x272348){var _0x226496=typeof _0x3ecaba[_0xd2c7('0x30')]==='undefined'&&typeof _0x3ecaba['limit']===_0xd2c7('0x31');var _0x414453=_0x272348[_0xd2c7('0x32')];var _0x2cdf34=_0x226496?0x0:_0x3ecaba[_0xd2c7('0x30')];var _0x5469d0=_0x226496?_0x272348['count']:_0x3ecaba['offset']+_0x3ecaba[_0xd2c7('0x33')];var _0x5a567e;if(_0x5469d0>=_0x414453){_0x5469d0=_0x414453;_0x5a567e=0xc8;}else{_0x5a567e=0xce;}_0x53d2ed['status'](_0x5a567e);return _0x53d2ed[_0xd2c7('0x34')]('Content-Range',_0x2cdf34+'-'+_0x5469d0+'/'+_0x414453)[_0xd2c7('0x2f')](_0x272348);}return null;};}function patchUpdates(_0x174da6){return function(_0x85da25){try{jsonpatch[_0xd2c7('0x35')](_0x85da25,_0x174da6,!![]);}catch(_0x5069c7){return BPromise[_0xd2c7('0x36')](_0x5069c7);}return _0x85da25[_0xd2c7('0x37')]();};}function saveUpdates(_0x5bc567,_0x2ce1f5){return function(_0xc1c849){if(_0xc1c849){return _0xc1c849[_0xd2c7('0x38')](_0x5bc567)[_0xd2c7('0x23')](function(_0x2d337e){return _0x2d337e;});}return null;};}function removeEntity(_0x20e046,_0x3f928c){return function(_0x5087b0){if(_0x5087b0){return _0x5087b0[_0xd2c7('0x39')]()[_0xd2c7('0x23')](function(){var _0x5b4677=_0x5087b0[_0xd2c7('0x3a')]({'plain':!![]});var _0x52acd6=_0xd2c7('0x3b');return db[_0xd2c7('0x3c')][_0xd2c7('0x39')]({'where':{'type':_0x52acd6,'resourceId':_0x5b4677['id']}})[_0xd2c7('0x23')](function(){return _0x5087b0;});})[_0xd2c7('0x23')](function(){_0x20e046['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4005aa,_0x1c2937){return function(_0x3e5fe0){if(!_0x3e5fe0){_0x4005aa[_0xd2c7('0x3d')](0x194);}return _0x3e5fe0;};}function handleError(_0x334744,_0x230c0f){_0x230c0f=_0x230c0f||0x1f4;return function(_0x571817){logger[_0xd2c7('0x29')](_0x571817['stack']);if(_0x571817[_0xd2c7('0x3e')]){delete _0x571817[_0xd2c7('0x3e')];}_0x334744[_0xd2c7('0x2d')](_0x230c0f)['send'](_0x571817);};}exports['index']=function(_0x4a0afe,_0x3c8552){var _0x277f8d={'include':[{'model':db[_0xd2c7('0x3f')],'as':_0xd2c7('0x40')}]},_0x4c44df={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5b01a1=_[_0xd2c7('0x41')](db[_0xd2c7('0x42')][_0xd2c7('0x43')],function(_0x40b3c9){return{'name':_0x40b3c9['fieldName'],'type':_0x40b3c9[_0xd2c7('0x44')][_0xd2c7('0x45')]};});_0x4c44df[_0xd2c7('0x46')]=_[_0xd2c7('0x41')](_0x5b01a1,_0xd2c7('0x3e'));_0x4c44df['query']=_[_0xd2c7('0x47')](_0x4a0afe['query']);_0x4c44df[_0xd2c7('0x48')]=_['intersection'](_0x4c44df['model'],_0x4c44df[_0xd2c7('0x49')]);_0x277f8d[_0xd2c7('0x4a')]=_['intersection'](_0x4c44df[_0xd2c7('0x46')],qs[_0xd2c7('0x4b')](_0x4a0afe[_0xd2c7('0x49')]['fields']));_0x277f8d[_0xd2c7('0x4a')]=_0x277f8d['attributes']['length']?_0x277f8d[_0xd2c7('0x4a')]:_0x4c44df[_0xd2c7('0x46')];if(!_0x4a0afe[_0xd2c7('0x49')][_0xd2c7('0x4c')](_0xd2c7('0x4d'))){_0x277f8d['limit']=qs['limit'](_0x4a0afe[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0x277f8d[_0xd2c7('0x30')]=qs[_0xd2c7('0x30')](_0x4a0afe['query'][_0xd2c7('0x30')]);}_0x277f8d[_0xd2c7('0x4e')]=qs[_0xd2c7('0x4f')](_0x4a0afe[_0xd2c7('0x49')][_0xd2c7('0x4f')]);_0x277f8d[_0xd2c7('0x50')]=qs['filters'](_['pick'](_0x4a0afe['query'],_0x4c44df[_0xd2c7('0x48')]),_0x5b01a1);if(_0x4a0afe[_0xd2c7('0x49')][_0xd2c7('0x51')]){_0x277f8d[_0xd2c7('0x50')]=_[_0xd2c7('0x52')](_0x277f8d['where'],{'$or':_['map'](_0x5b01a1,function(_0x379df1){if(_0x379df1[_0xd2c7('0x44')]!==_0xd2c7('0x53')){var _0x925dbe={};_0x925dbe[_0x379df1[_0xd2c7('0x3e')]]={'$like':'%'+_0x4a0afe['query'][_0xd2c7('0x51')]+'%'};return _0x925dbe;}})});}_0x277f8d=_[_0xd2c7('0x52')]({},_0x277f8d,_0x4a0afe['options']);var _0x15f04e={'where':_0x277f8d[_0xd2c7('0x50')]};return db[_0xd2c7('0x42')][_0xd2c7('0x32')](_0x15f04e)[_0xd2c7('0x23')](function(_0xc33601){_0x17ff3f[_0xd2c7('0x32')]=_0xc33601;if(_0x4a0afe[_0xd2c7('0x49')][_0xd2c7('0x54')]){_0x277f8d[_0xd2c7('0x55')]=[{'all':!![]}];}return db[_0xd2c7('0x42')][_0xd2c7('0x56')](_0x277f8d);})[_0xd2c7('0x23')](function(_0xc8201){_0x17ff3f[_0xd2c7('0x57')]=_0xc8201;return _0x17ff3f;})['then'](respondWithFilteredResult(_0x3c8552,_0x277f8d))['catch'](handleError(_0x3c8552,null));};exports[_0xd2c7('0x58')]=function(_0x51eb6a,_0x22f4e8){var _0x3b0ae0={'raw':![],'where':{'id':_0x51eb6a[_0xd2c7('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xd2c7('0x40')}]},_0x23bde6={};_0x23bde6[_0xd2c7('0x46')]=_[_0xd2c7('0x47')](db[_0xd2c7('0x42')]['rawAttributes']);_0x23bde6[_0xd2c7('0x49')]=_[_0xd2c7('0x47')](_0x51eb6a[_0xd2c7('0x49')]);_0x23bde6[_0xd2c7('0x48')]=_[_0xd2c7('0x5a')](_0x23bde6[_0xd2c7('0x46')],_0x23bde6[_0xd2c7('0x49')]);_0x3b0ae0[_0xd2c7('0x4a')]=_[_0xd2c7('0x5a')](_0x23bde6[_0xd2c7('0x46')],qs[_0xd2c7('0x4b')](_0x51eb6a[_0xd2c7('0x49')][_0xd2c7('0x4b')]));_0x3b0ae0[_0xd2c7('0x4a')]=_0x3b0ae0[_0xd2c7('0x4a')][_0xd2c7('0x5b')]?_0x3b0ae0['attributes']:_0x23bde6[_0xd2c7('0x46')];if(_0x51eb6a[_0xd2c7('0x49')]['includeAll']){_0x3b0ae0[_0xd2c7('0x55')]=[{'all':!![]}];}_0x3b0ae0=_[_0xd2c7('0x52')]({},_0x3b0ae0,_0x51eb6a[_0xd2c7('0x5c')]);return db[_0xd2c7('0x42')]['find'](_0x3b0ae0)[_0xd2c7('0x23')](handleEntityNotFound(_0x22f4e8,null))[_0xd2c7('0x23')](respondWithResult(_0x22f4e8,null))[_0xd2c7('0x5d')](handleError(_0x22f4e8,null));};exports[_0xd2c7('0x5e')]=function(_0x106143,_0xa57538){return db[_0xd2c7('0x42')]['create'](_0x106143[_0xd2c7('0x5f')],{})[_0xd2c7('0x23')](function(_0x36a95d){var _0xb15366=_0x106143['user']['get']({'plain':!![]});if(!_0xb15366)throw new Error(_0xd2c7('0x60'));if(_0xb15366['role']==='user'){var _0x7ef5ea=_0x36a95d[_0xd2c7('0x3a')]({'plain':!![]});var _0x594949='SmsAccounts';return db[_0xd2c7('0x61')][_0xd2c7('0x62')]({'where':{'name':_0x594949,'userProfileId':_0xb15366[_0xd2c7('0x63')]},'raw':!![]})[_0xd2c7('0x23')](function(_0x57cdee){if(_0x57cdee&&_0x57cdee['autoAssociation']===0x0){return db[_0xd2c7('0x3c')]['create']({'name':_0x7ef5ea[_0xd2c7('0x3e')],'resourceId':_0x7ef5ea['id'],'type':_0x57cdee[_0xd2c7('0x3e')],'sectionId':_0x57cdee['id']},{})[_0xd2c7('0x23')](function(){return _0x36a95d;});}else{return _0x36a95d;}})[_0xd2c7('0x5d')](function(_0x4da1e6){logger['error'](_0xd2c7('0x64'),_0x4da1e6);throw _0x4da1e6;});}return _0x36a95d;})[_0xd2c7('0x23')](respondWithResult(_0xa57538,0xc9))[_0xd2c7('0x5d')](handleError(_0xa57538,null));};exports[_0xd2c7('0x38')]=function(_0x5e3e5e,_0x43a5ea){if(_0x5e3e5e[_0xd2c7('0x5f')]['id']){delete _0x5e3e5e[_0xd2c7('0x5f')]['id'];}return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x5e3e5e[_0xd2c7('0x59')]['id']},'include':[{'model':db[_0xd2c7('0x3f')],'as':_0xd2c7('0x40')}]})[_0xd2c7('0x23')](handleEntityNotFound(_0x43a5ea,null))[_0xd2c7('0x23')](saveUpdates(_0x5e3e5e['body'],null))[_0xd2c7('0x23')](respondWithResult(_0x43a5ea,null))[_0xd2c7('0x5d')](handleError(_0x43a5ea,null));};exports[_0xd2c7('0x39')]=function(_0x517921,_0x41da05){return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x517921[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x41da05,null))[_0xd2c7('0x23')](removeEntity(_0x41da05,null))[_0xd2c7('0x5d')](handleError(_0x41da05,null));};exports['describe']=function(_0x4a101f,_0x2617c8){return db[_0xd2c7('0x42')][_0xd2c7('0x65')]()[_0xd2c7('0x23')](respondWithResult(_0x2617c8,null))['catch'](handleError(_0x2617c8,null));};exports[_0xd2c7('0x66')]=function(_0x4a20d9,_0x2ebafc,_0x519cde){if(_0x4a20d9[_0xd2c7('0x5f')]['id']){delete _0x4a20d9[_0xd2c7('0x5f')]['id'];}return db[_0xd2c7('0x42')]['find']({'where':{'id':_0x4a20d9[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x2ebafc,null))[_0xd2c7('0x23')](function(_0x29692f){if(_0x29692f){_0x4a20d9['body'][_0xd2c7('0x67')]=_0x29692f['id'];return db['Disposition'][_0xd2c7('0x5e')](_0x4a20d9['body']);}})[_0xd2c7('0x23')](respondWithResult(_0x2ebafc,null))[_0xd2c7('0x5d')](handleError(_0x2ebafc,null));};exports[_0xd2c7('0x68')]=function(_0x99294e,_0x570fa3,_0x3862b4){var _0x185829={'raw':![],'where':{}};var _0x52a4f7={};var _0x270ccc={'count':0x0,'rows':[]};return db[_0xd2c7('0x42')][_0xd2c7('0x69')]({'where':{'id':_0x99294e[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x570fa3,null))[_0xd2c7('0x23')](function(_0x4a6bf9){if(_0x4a6bf9){_0x52a4f7[_0xd2c7('0x46')]=_[_0xd2c7('0x47')](db[_0xd2c7('0x6a')][_0xd2c7('0x43')]);_0x52a4f7[_0xd2c7('0x49')]=_[_0xd2c7('0x47')](_0x99294e[_0xd2c7('0x49')]);_0x52a4f7[_0xd2c7('0x48')]=_[_0xd2c7('0x5a')](_0x52a4f7[_0xd2c7('0x46')],_0x52a4f7[_0xd2c7('0x49')]);_0x185829[_0xd2c7('0x4a')]=_['intersection'](_0x52a4f7['model'],qs[_0xd2c7('0x4b')](_0x99294e['query'][_0xd2c7('0x4b')]));_0x185829[_0xd2c7('0x4a')]=_0x185829['attributes'][_0xd2c7('0x5b')]?_0x185829[_0xd2c7('0x4a')]:_0x52a4f7[_0xd2c7('0x46')];if(!_0x99294e[_0xd2c7('0x49')][_0xd2c7('0x4c')](_0xd2c7('0x4d'))){_0x185829[_0xd2c7('0x33')]=qs['limit'](_0x99294e[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0x185829[_0xd2c7('0x30')]=qs[_0xd2c7('0x30')](_0x99294e[_0xd2c7('0x49')][_0xd2c7('0x30')]);}_0x185829[_0xd2c7('0x4e')]=qs[_0xd2c7('0x4f')](_0x99294e[_0xd2c7('0x49')][_0xd2c7('0x4f')]);_0x185829[_0xd2c7('0x50')]=qs['filters'](_[_0xd2c7('0x6b')](_0x99294e[_0xd2c7('0x49')],_0x52a4f7[_0xd2c7('0x48')]));_0x185829[_0xd2c7('0x50')]['SmsAccountId']=_0x4a6bf9['id'];if(_0x99294e['query'][_0xd2c7('0x51')]){_0x185829[_0xd2c7('0x50')]=_[_0xd2c7('0x52')](_0x185829[_0xd2c7('0x50')],{'$or':_[_0xd2c7('0x41')](_0x185829[_0xd2c7('0x4a')],function(_0x2b122d){var _0x4fae7b={};_0x4fae7b[_0x2b122d]={'$like':'%'+_0x99294e[_0xd2c7('0x49')][_0xd2c7('0x51')]+'%'};return _0x4fae7b;})});}_0x185829=_[_0xd2c7('0x52')]({},_0x185829,_0x99294e[_0xd2c7('0x5c')]);return db[_0xd2c7('0x6a')][_0xd2c7('0x32')]({'where':_0x185829[_0xd2c7('0x50')]})[_0xd2c7('0x23')](function(_0x5983ef){_0x270ccc['count']=_0x5983ef;if(_0x99294e['query'][_0xd2c7('0x54')]){_0x185829['include']=[{'all':!![]}];}return db[_0xd2c7('0x6a')]['findAll'](_0x185829);})[_0xd2c7('0x23')](function(_0x3f5660){_0x270ccc['rows']=_0x3f5660;return _0x270ccc;});}})[_0xd2c7('0x23')](respondWithFilteredResult(_0x570fa3,_0x185829))[_0xd2c7('0x5d')](handleError(_0x570fa3,null));};exports['removeDispositions']=function(_0x6d1ec7,_0x306414,_0xa802c3){return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x6d1ec7[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x306414,null))[_0xd2c7('0x23')](function(_0x5994b2){if(_0x5994b2){return _0x5994b2[_0xd2c7('0x6c')](_0x6d1ec7[_0xd2c7('0x49')]['ids']);}})[_0xd2c7('0x23')](respondWithStatusCode(_0x306414,null))[_0xd2c7('0x5d')](handleError(_0x306414,null));};exports[_0xd2c7('0x6d')]=function(_0x180a4e,_0x2846e2,_0x5eba88){if(_0x180a4e[_0xd2c7('0x5f')]['id']){delete _0x180a4e[_0xd2c7('0x5f')]['id'];}return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x180a4e[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x2846e2,null))[_0xd2c7('0x23')](function(_0x13e1d2){if(_0x13e1d2){_0x180a4e[_0xd2c7('0x5f')]['SmsAccountId']=_0x13e1d2['id'];return db[_0xd2c7('0x6e')][_0xd2c7('0x5e')](_0x180a4e[_0xd2c7('0x5f')]);}})[_0xd2c7('0x23')](respondWithResult(_0x2846e2,null))[_0xd2c7('0x5d')](handleError(_0x2846e2,null));};exports[_0xd2c7('0x6f')]=function(_0x180e12,_0x2586a5,_0x2df04d){var _0x445c9e={'raw':![],'where':{}};var _0x49ecac={};var _0x3ee470={'count':0x0,'rows':[]};return db[_0xd2c7('0x42')][_0xd2c7('0x69')]({'where':{'id':_0x180e12['params']['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x2586a5,null))[_0xd2c7('0x23')](function(_0x5a50ee){if(_0x5a50ee){_0x49ecac[_0xd2c7('0x46')]=_[_0xd2c7('0x47')](db[_0xd2c7('0x6e')][_0xd2c7('0x43')]);_0x49ecac['query']=_[_0xd2c7('0x47')](_0x180e12[_0xd2c7('0x49')]);_0x49ecac[_0xd2c7('0x48')]=_[_0xd2c7('0x5a')](_0x49ecac['model'],_0x49ecac[_0xd2c7('0x49')]);_0x445c9e[_0xd2c7('0x4a')]=_[_0xd2c7('0x5a')](_0x49ecac[_0xd2c7('0x46')],qs['fields'](_0x180e12['query']['fields']));_0x445c9e[_0xd2c7('0x4a')]=_0x445c9e[_0xd2c7('0x4a')][_0xd2c7('0x5b')]?_0x445c9e['attributes']:_0x49ecac[_0xd2c7('0x46')];if(!_0x180e12[_0xd2c7('0x49')][_0xd2c7('0x4c')](_0xd2c7('0x4d'))){_0x445c9e['limit']=qs[_0xd2c7('0x33')](_0x180e12[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0x445c9e['offset']=qs[_0xd2c7('0x30')](_0x180e12[_0xd2c7('0x49')][_0xd2c7('0x30')]);}_0x445c9e[_0xd2c7('0x4e')]=qs[_0xd2c7('0x4f')](_0x180e12[_0xd2c7('0x49')][_0xd2c7('0x4f')]);_0x445c9e[_0xd2c7('0x50')]=qs[_0xd2c7('0x48')](_[_0xd2c7('0x6b')](_0x180e12[_0xd2c7('0x49')],_0x49ecac[_0xd2c7('0x48')]));_0x445c9e[_0xd2c7('0x50')][_0xd2c7('0x67')]=_0x5a50ee['id'];if(_0x180e12['query'][_0xd2c7('0x51')]){_0x445c9e[_0xd2c7('0x50')]=_[_0xd2c7('0x52')](_0x445c9e[_0xd2c7('0x50')],{'$or':_[_0xd2c7('0x41')](_0x445c9e['attributes'],function(_0x32bc2d){var _0x59f5a6={};_0x59f5a6[_0x32bc2d]={'$like':'%'+_0x180e12[_0xd2c7('0x49')]['filter']+'%'};return _0x59f5a6;})});}_0x445c9e=_[_0xd2c7('0x52')]({},_0x445c9e,_0x180e12[_0xd2c7('0x5c')]);return db[_0xd2c7('0x6e')][_0xd2c7('0x32')]({'where':_0x445c9e[_0xd2c7('0x50')]})[_0xd2c7('0x23')](function(_0x43b6e8){_0x3ee470['count']=_0x43b6e8;if(_0x180e12[_0xd2c7('0x49')][_0xd2c7('0x54')]){_0x445c9e[_0xd2c7('0x55')]=[{'all':!![]}];}return db[_0xd2c7('0x6e')][_0xd2c7('0x56')](_0x445c9e);})[_0xd2c7('0x23')](function(_0x215564){_0x3ee470[_0xd2c7('0x57')]=_0x215564;return _0x3ee470;});}})['then'](respondWithFilteredResult(_0x2586a5,_0x445c9e))[_0xd2c7('0x5d')](handleError(_0x2586a5,null));};exports[_0xd2c7('0x70')]=function(_0x24620d,_0x1fb9cc,_0x5a5219){return db[_0xd2c7('0x42')]['find']({'where':{'id':_0x24620d[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x1fb9cc,null))[_0xd2c7('0x23')](function(_0x26a680){if(_0x26a680){return _0x26a680[_0xd2c7('0x70')](_0x24620d[_0xd2c7('0x49')][_0xd2c7('0x71')]);}})['then'](respondWithStatusCode(_0x1fb9cc,null))[_0xd2c7('0x5d')](handleError(_0x1fb9cc,null));};exports[_0xd2c7('0x72')]=function(_0xd7cbb6,_0x560b12,_0x52c8f0){var _0x61d81a={'channel':'sms'};var _0x14678b=[];var _0x509289=[];var _0x2af76e={};return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0xd7cbb6[_0xd2c7('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xd2c7('0x73')}]})[_0xd2c7('0x23')](handleEntityNotFound(_0x560b12,null))[_0xd2c7('0x23')](function(_0x1915a7){_0x61d81a[_0xd2c7('0x74')]=_0x1915a7;_0x61d81a[_0xd2c7('0x75')]=_[_0xd2c7('0x76')](_0x1915a7['Applications'],[_0xd2c7('0x77')],[_0xd2c7('0x78')]);if(_0x61d81a[_0xd2c7('0x74')]['Applications']){delete _0x61d81a['account'][_0xd2c7('0x73')];}return db[_0xd2c7('0x79')][_0xd2c7('0x65')]();})[_0xd2c7('0x23')](function(_0x6cab42){if(!_0x6cab42){throw new db[(_0xd2c7('0x7a'))]['ValidationError'](_0xd2c7('0x7b'));}_0x14678b=_['difference'](_[_0xd2c7('0x47')](_0x6cab42),[_0xd2c7('0x7c'),_0xd2c7('0x7d')]);_0x509289=_[_0xd2c7('0x7e')](_[_0xd2c7('0x47')](_0x6cab42),[_0xd2c7('0x7c'),_0xd2c7('0x7d'),_0xd2c7('0x7f'),'ListId']);_0x61d81a[_0xd2c7('0x5f')]={'mapKey':_0xd2c7('0x80')};if(_0x61d81a[_0xd2c7('0x74')]['type']){switch(_0x61d81a[_0xd2c7('0x74')][_0xd2c7('0x44')]){case'twilio':_0x61d81a['body'][_0xd2c7('0x81')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x82')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]=_0xd7cbb6['body'][_0xd2c7('0x83')];_0x61d81a['body']['messageId']=_0xd7cbb6['body'][_0xd2c7('0x84')];break;case'skebby':_0x61d81a[_0xd2c7('0x5f')]['from']='+'+_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x85')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x86')];break;case _0xd2c7('0x87'):_0x61d81a['body'][_0xd2c7('0x81')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x81')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]=_0xd7cbb6[_0xd2c7('0x5f')]['message'];break;case _0xd2c7('0x88'):_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x81')];_0x61d81a['body'][_0xd2c7('0x5f')]=_0xd7cbb6['body'][_0xd2c7('0x5f')];_0x61d81a['body'][_0xd2c7('0x89')]=_0xd7cbb6['body']['message_id'];break;case _0xd2c7('0x8a'):_0x61d81a['body']['from']=_0xd7cbb6['body'][_0xd2c7('0x82')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x8b')];_0x61d81a['body']['messageId']=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x8c')];break;case _0xd2c7('0x8d'):_0x61d81a['body'][_0xd2c7('0x81')]='+'+_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x8e')][0x0][_0xd2c7('0x81')];_0x61d81a['body'][_0xd2c7('0x5f')]=_0xd7cbb6['body'][_0xd2c7('0x8e')][0x0][_0xd2c7('0x86')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x89')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x8e')][0x0]['messageId'];break;case _0xd2c7('0x8f'):_0x61d81a[_0xd2c7('0x5f')]['from']=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x90')];_0x61d81a['body'][_0xd2c7('0x5f')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x91')]['message'];break;case _0xd2c7('0x92'):_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')]=_0xd7cbb6['body'][_0xd2c7('0x93')];_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x86')];_0x61d81a['body'][_0xd2c7('0x89')]=_0xd7cbb6[_0xd2c7('0x5f')]['replyMessageId'];break;case'bandwidth':_0x61d81a['body'][_0xd2c7('0x89')]=_0xd7cbb6['body'][0x0]['message']['id'];_0x61d81a['body'][_0xd2c7('0x81')]=_0xd7cbb6[_0xd2c7('0x5f')][0x0][_0xd2c7('0x2b')][_0xd2c7('0x81')];_0x61d81a['body']['body']=_0xd7cbb6[_0xd2c7('0x5f')][0x0][_0xd2c7('0x2b')]['text'];break;case'intelepeer':_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x81')];_0x61d81a[_0xd2c7('0x5f')]['body']=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x2b')];_0x61d81a['body'][_0xd2c7('0x89')]=_0xd7cbb6[_0xd2c7('0x5f')][_0xd2c7('0x94')];break;}}if(_0x61d81a[_0xd2c7('0x5f')]['id']){delete _0x61d81a[_0xd2c7('0x5f')]['id'];}if(_[_0xd2c7('0x95')](_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')])){throw new db[(_0xd2c7('0x7a'))][(_0xd2c7('0x96'))](_0xd2c7('0x97'));}if(_['isNil'](_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')])||_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')]===''){throw new db[(_0xd2c7('0x7a'))][(_0xd2c7('0x96'))](_0xd2c7('0x98'));}if(_[_0xd2c7('0x95')](_0x61d81a['body'][_0xd2c7('0x99')])){throw new db[(_0xd2c7('0x7a'))][(_0xd2c7('0x96'))](_0xd2c7('0x9a')+_0x509289);}if(!_[_0xd2c7('0x9b')](_0x509289,_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x99')])){throw new db['Sequelize'][(_0xd2c7('0x96'))](_0xd2c7('0x9c')+_0x509289);}_0x2af76e[_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x99')]]=_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')];return db[_0xd2c7('0x9d')][_0xd2c7('0x62')]({'where':{'id':_0x61d81a['account']['ListId']},'include':[{'model':db[_0xd2c7('0x79')],'as':_0xd2c7('0x9e'),'where':_0x2af76e,'limit':0x1,'order':[['updatedAt',_0xd2c7('0x9f')]]}]});})[_0xd2c7('0x23')](handleEntityNotFound(_0x560b12,null))[_0xd2c7('0x23')](function(_0x2308c2){if(_0x2308c2){_0x61d81a[_0xd2c7('0xa0')]=_[_0xd2c7('0xa1')](_0x2308c2,[_0xd2c7('0x9e')]);if(_0x2308c2['Contacts'][_0xd2c7('0x5b')]){return _0x2308c2['Contacts'][0x0];}var _0x49982f=_[_0xd2c7('0x1e')](_0x61d81a[_0xd2c7('0x5f')],{'firstName':_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')],'ListId':_0x2308c2['id']});_0x49982f[_0x61d81a[_0xd2c7('0x5f')]['mapKey']]=_0x61d81a['body'][_0xd2c7('0x81')];return db[_0xd2c7('0x79')]['create'](_0x49982f,{'fields':_0x14678b,'raw':!![]});}})['then'](handleEntityNotFound(_0x560b12,null))['then'](function(_0x29a03e){if(_0x29a03e){_0x61d81a['contact']=_0x29a03e;var _0x39e6c1={'ContactId':_0x29a03e['id'],'phone':_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x81')],'SmsAccountId':_0xd7cbb6['params']['id']};var _0x5f585a={'ContactId':_0x29a03e['id'],'SmsAccountId':_0xd7cbb6['params']['id'],'closed':![]};return db['SmsInteraction'][_0xd2c7('0x62')]({'where':_0x5f585a})['then'](function(_0x208827){if(_0x208827){return[_0x208827,![]];}return db['SmsInteraction'][_0xd2c7('0x5e')](_0x39e6c1)[_0xd2c7('0x23')](function(_0x4ee650){return[_0x4ee650,!![]];});});}})[_0xd2c7('0xa2')](function(_0x44b37b,_0x3d3dd1){_0x61d81a[_0xd2c7('0xa3')]=_0x44b37b[_0xd2c7('0x3a')]({'plain':!![]});_0x61d81a['interaction'][_0xd2c7('0xa4')]=![];if(_0x3d3dd1){if(_0x61d81a[_0xd2c7('0x74')]['autoclose']){_0x61d81a[_0xd2c7('0x75')]['push']({'id':0x0,'priority':_0x61d81a[_0xd2c7('0x75')]['length']+0x1,'app':_0xd2c7('0xa5'),'appdata':_0xd2c7('0xa6'),'interval':'*,*,*,*'});}_0x61d81a['interaction'][_0xd2c7('0xa4')]=!![];}return db[_0xd2c7('0xa7')][_0xd2c7('0x5e')]({'phone':_0x61d81a[_0xd2c7('0x5f')]['from'],'messageId':_0x61d81a[_0xd2c7('0x5f')]['messageId'],'body':_0x61d81a[_0xd2c7('0x5f')][_0xd2c7('0x5f')],'SmsAccountId':_0xd7cbb6[_0xd2c7('0x59')]['id'],'SmsInteractionId':_0x44b37b['id'],'direction':'in','ContactId':_0x44b37b[_0xd2c7('0xa8')],'AttachmentId':_0x61d81a[_0xd2c7('0x5f')]['AttachmentId']});})[_0xd2c7('0x23')](function(_0x377813){_0x61d81a[_0xd2c7('0x2b')]=_0x377813;if(!_0x61d81a[_0xd2c7('0xa3')][_0xd2c7('0xa9')])return;return db[_0xd2c7('0xaa')]['find']({'attributes':['id',_0xd2c7('0x3e')],'where':{'id':_0x61d81a[_0xd2c7('0xa3')]['UserId']}});})['then'](function(_0x2a8a1f){if(_0x2a8a1f){_0x61d81a['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd2c7('0xab'),'appdata':_0x2a8a1f[_0xd2c7('0x3e')]+','+(_0x61d81a['account'][_0xd2c7('0xac')]||0xa),'interval':_0xd2c7('0xad')});}if(!_0x61d81a[_0xd2c7('0xa3')][_0xd2c7('0xae')])return;return db[_0xd2c7('0xaf')][_0xd2c7('0x62')]({'attributes':['id','name'],'where':{'id':_0x61d81a[_0xd2c7('0xa3')]['queueId']}});})[_0xd2c7('0x23')](function(_0x31f2a7){if(_0x31f2a7){_0x61d81a[_0xd2c7('0x75')]['unshift']({'id':0x0,'priority':0x1,'app':_0xd2c7('0xb0'),'appdata':_0x31f2a7[_0xd2c7('0x3e')]+','+(_0x61d81a['account'][_0xd2c7('0xb1')]||0x12c),'interval':_0xd2c7('0xad')});}return respondWithRpcPromise(_0xd2c7('0xb2'),_0xd2c7('0xb3'),_0x61d81a);})[_0xd2c7('0x23')](function(_0x115ab6){if(_0x115ab6){var _0x66febe=0xc8;var _0x1e44c1=_0xd2c7('0xb4');logger['info'](_0xd2c7('0x27'),_0x1e44c1,_0x66febe,'entity\x20found');logger[_0xd2c7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1e44c1,_0x66febe,_0xd2c7('0xb5'),JSON['stringify'](_0x115ab6));if(_0x61d81a['account'][_0xd2c7('0x44')]===_0xd2c7('0xb6')){return _0x560b12[_0xd2c7('0x2d')](_0x66febe)[_0xd2c7('0x34')]('Content-Type',_0xd2c7('0xb7'))[_0xd2c7('0xb8')](_0xd2c7('0xb9'));}else{return _0x560b12[_0xd2c7('0x2d')](_0x66febe)[_0xd2c7('0x2f')](_0x115ab6);}}})[_0xd2c7('0x5d')](handleError(_0x560b12,null));};exports[_0xd2c7('0xba')]=function(_0x2ed12f,_0x4d4344){var _0x582287=_0x2ed12f[_0xd2c7('0x59')]['id'];var _0x620fc9=_0x2ed12f[_0xd2c7('0x5f')];var _0x5e95af=0xc8;var _0xd4b8ac=null;return db[_0xd2c7('0xbb')][_0xd2c7('0xbc')]({'isolationLevel':db['sequelize'][_0xd2c7('0xbd')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x385704){return db[_0xd2c7('0x42')][_0xd2c7('0x69')]({'where':{'id':_0x582287},'transaction':_0x385704})[_0xd2c7('0x23')](function(_0x293c16){if(_0x293c16){return db['SmsApplication'][_0xd2c7('0x39')]({'where':{'SmsAccountId':_0x582287},'transaction':_0x385704})[_0xd2c7('0x23')](function(){var _0xcee38f=_[_0xd2c7('0x41')](_0x620fc9,function(_0x5b0779){_0x5b0779[_0xd2c7('0x67')]=_0x582287;return _0x5b0779;});return db[_0xd2c7('0xbe')][_0xd2c7('0xbf')](_0xcee38f,{'transaction':_0x385704});});}else{_0x5e95af=0x194;_0xd4b8ac=[];}});})[_0xd2c7('0x23')](function(){if(_0x5e95af!==0x194){return db[_0xd2c7('0xbe')][_0xd2c7('0xc0')]({'where':{'SmsAccountId':_0x582287},'order':_0xd2c7('0x77')})[_0xd2c7('0x23')](function(_0x43fa65){_0xd4b8ac=_0x43fa65;});}})[_0xd2c7('0x5d')](function(_0xc37d3d){_0x5e95af=0x1f4;logger[_0xd2c7('0x29')](_0xc37d3d[_0xd2c7('0xc1')]);if(_0xc37d3d['name']){delete _0xc37d3d[_0xd2c7('0x3e')];}_0xd4b8ac=_0xc37d3d;})[_0xd2c7('0xc2')](function(){if(_0xd4b8ac===null){_0x4d4344[_0xd2c7('0x3d')](_0x5e95af);}else{if(_0x5e95af===0x1f4){_0x4d4344[_0xd2c7('0x2d')](_0x5e95af)['send'](_0xd4b8ac);}else{_0x4d4344[_0xd2c7('0x2d')](_0x5e95af)[_0xd2c7('0x2f')](_0xd4b8ac);}}});};exports[_0xd2c7('0xc3')]=function(_0x19f06d,_0x2d5910,_0x200844){var _0x2d717b={};var _0x22c087={};var _0x134ad3;var _0x4d615d;return db[_0xd2c7('0x42')]['findOne']({'where':{'id':_0x19f06d[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x2d5910,null))['then'](function(_0x34d6d9){if(_0x34d6d9){_0x134ad3=_0x34d6d9;_0x22c087[_0xd2c7('0x46')]=_[_0xd2c7('0x47')](db[_0xd2c7('0xbe')][_0xd2c7('0x43')]);_0x22c087[_0xd2c7('0x49')]=_[_0xd2c7('0x47')](_0x19f06d[_0xd2c7('0x49')]);_0x22c087['filters']=_[_0xd2c7('0x5a')](_0x22c087['model'],_0x22c087[_0xd2c7('0x49')]);_0x2d717b[_0xd2c7('0x4a')]=_[_0xd2c7('0x5a')](_0x22c087[_0xd2c7('0x46')],qs[_0xd2c7('0x4b')](_0x19f06d[_0xd2c7('0x49')][_0xd2c7('0x4b')]));_0x2d717b['attributes']=_0x2d717b[_0xd2c7('0x4a')][_0xd2c7('0x5b')]?_0x2d717b[_0xd2c7('0x4a')]:_0x22c087['model'];_0x2d717b['order']=qs[_0xd2c7('0x4f')](_0x19f06d[_0xd2c7('0x49')]['sort']);_0x2d717b['where']=qs[_0xd2c7('0x48')](_[_0xd2c7('0x6b')](_0x19f06d['query'],_0x22c087[_0xd2c7('0x48')]));if(_0x19f06d['query']['filter']){_0x2d717b[_0xd2c7('0x50')]=_[_0xd2c7('0x52')](_0x2d717b[_0xd2c7('0x50')],{'$or':_[_0xd2c7('0x41')](_0x2d717b[_0xd2c7('0x4a')],function(_0x4e4ccd){var _0x51e61f={};_0x51e61f[_0x4e4ccd]={'$like':'%'+_0x19f06d['query'][_0xd2c7('0x51')]+'%'};return _0x51e61f;})});}_0x2d717b=_[_0xd2c7('0x52')]({},_0x2d717b,_0x19f06d['options']);return _0x134ad3[_0xd2c7('0xc3')](_0x2d717b);}})[_0xd2c7('0x23')](function(_0x57a0ca){if(_0x57a0ca){_0x4d615d=_0x57a0ca[_0xd2c7('0x5b')];if(!_0x19f06d['query'][_0xd2c7('0x4c')]('nolimit')){_0x2d717b[_0xd2c7('0x33')]=qs[_0xd2c7('0x33')](_0x19f06d[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0x2d717b['offset']=qs[_0xd2c7('0x30')](_0x19f06d[_0xd2c7('0x49')][_0xd2c7('0x30')]);}return _0x134ad3[_0xd2c7('0xc3')](_0x2d717b);}})['then'](function(_0x1a4e7e){if(_0x1a4e7e){return _0x1a4e7e?{'count':_0x4d615d,'rows':_0x1a4e7e}:null;}})[_0xd2c7('0x23')](respondWithResult(_0x2d5910,null))['catch'](handleError(_0x2d5910,null));};exports[_0xd2c7('0xc4')]=function(_0x335a77,_0x54595a,_0x857e95){var _0x46a823={'raw':![],'where':{}};var _0x5157d3={};var _0x14cdee={'count':0x0,'rows':[]};return db[_0xd2c7('0x42')][_0xd2c7('0x69')]({'where':{'id':_0x335a77[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x54595a,null))[_0xd2c7('0x23')](function(_0xc2cf26){if(_0xc2cf26){_0x5157d3['model']=_[_0xd2c7('0x47')](db[_0xd2c7('0xc5')][_0xd2c7('0x43')]);_0x5157d3[_0xd2c7('0x49')]=_[_0xd2c7('0x47')](_0x335a77[_0xd2c7('0x49')]);_0x5157d3[_0xd2c7('0x48')]=_[_0xd2c7('0x5a')](_0x5157d3[_0xd2c7('0x46')],_0x5157d3[_0xd2c7('0x49')]);_0x46a823['attributes']=_['intersection'](_0x5157d3[_0xd2c7('0x46')],qs[_0xd2c7('0x4b')](_0x335a77[_0xd2c7('0x49')][_0xd2c7('0x4b')]));_0x46a823['attributes']=_0x46a823[_0xd2c7('0x4a')][_0xd2c7('0x5b')]?_0x46a823[_0xd2c7('0x4a')]:_0x5157d3[_0xd2c7('0x46')];if(!_0x335a77['query']['hasOwnProperty'](_0xd2c7('0x4d'))){_0x46a823[_0xd2c7('0x33')]=qs[_0xd2c7('0x33')](_0x335a77[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0x46a823['offset']=qs[_0xd2c7('0x30')](_0x335a77[_0xd2c7('0x49')]['offset']);}_0x46a823[_0xd2c7('0x4e')]=qs['sort'](_0x335a77['query'][_0xd2c7('0x4f')]);_0x46a823[_0xd2c7('0x50')]=qs[_0xd2c7('0x48')](_[_0xd2c7('0x6b')](_0x335a77[_0xd2c7('0x49')],_0x5157d3[_0xd2c7('0x48')]));_0x46a823[_0xd2c7('0x50')][_0xd2c7('0x67')]=_0xc2cf26['id'];if(_0x335a77[_0xd2c7('0x49')]['filter']){_0x46a823['where']=_[_0xd2c7('0x52')](_0x46a823[_0xd2c7('0x50')],{'$or':_[_0xd2c7('0x41')](_0x46a823[_0xd2c7('0x4a')],function(_0x37a434){var _0x2c97ca={};_0x2c97ca[_0x37a434]={'$like':'%'+_0x335a77[_0xd2c7('0x49')]['filter']+'%'};return _0x2c97ca;})});}_0x46a823=_[_0xd2c7('0x52')]({},_0x46a823,_0x335a77['options']);return db[_0xd2c7('0xc5')]['count']({'where':_0x46a823[_0xd2c7('0x50')]})['then'](function(_0x2ebba3){_0x14cdee[_0xd2c7('0x32')]=_0x2ebba3;if(_0x335a77['query'][_0xd2c7('0x54')]){_0x46a823[_0xd2c7('0x55')]=[{'model':db['CmContact'],'as':_0xd2c7('0xc6'),'required':![]},{'model':db[_0xd2c7('0xaa')],'as':_0xd2c7('0xc7'),'attributes':[_0xd2c7('0x3e'),_0xd2c7('0xc8'),'internal'],'required':![]},{'model':db[_0xd2c7('0xc9')],'as':'Tags','attributes':['id','name',_0xd2c7('0xca')],'where':_0x335a77['query'][_0xd2c7('0xcb')]?{'id':_0x335a77['query']['tag']}:undefined,'required':_0x335a77['query'][_0xd2c7('0xcb')]?!![]:![]}];}return db[_0xd2c7('0xc5')][_0xd2c7('0x56')](_0x46a823);})[_0xd2c7('0x23')](function(_0x585c55){_0x14cdee[_0xd2c7('0x57')]=_0x585c55;return _0x14cdee;});}})[_0xd2c7('0x23')](respondWithFilteredResult(_0x54595a,_0x46a823))[_0xd2c7('0x5d')](handleError(_0x54595a,null));};exports[_0xd2c7('0xb8')]=function(_0x1c2cd8,_0xb7c20a,_0x35d869){var _0x1333a7,_0x5263fc,_0x426800;if(_[_0xd2c7('0x95')](_0x1c2cd8['body'][_0xd2c7('0x5f')])||_0x1c2cd8['body'][_0xd2c7('0x5f')]===''){throw new db[(_0xd2c7('0x7a'))]['ValidationError'](_0xd2c7('0x98'));}if(_['isNil'](_0x1c2cd8[_0xd2c7('0x5f')]['to'])){throw new db[(_0xd2c7('0x7a'))][(_0xd2c7('0x96'))](_0xd2c7('0xcc'));}_0x1333a7=_0x1c2cd8['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x1c2cd8[_0xd2c7('0x59')]['id']},'include':[{'model':db[_0xd2c7('0x9d')],'as':_0xd2c7('0xcd'),'include':[{'model':db['CmContact'],'as':_0xd2c7('0x9e'),'where':{'mobile':_0x1333a7},'limit':0x1,'order':[['updatedAt',_0xd2c7('0x9f')]]}]}]})[_0xd2c7('0x23')](handleEntityNotFound(_0xb7c20a,null))[_0xd2c7('0x23')](function(_0x1eeac7){if(_0x1eeac7&&_0x1eeac7['List']){_0x5263fc=_0x1eeac7[_0xd2c7('0x3a')]({'plain':!![]});if(_0x5263fc['List']&&_0x5263fc[_0xd2c7('0xcd')][_0xd2c7('0x9e')][_0xd2c7('0x5b')]){return _0x5263fc[_0xd2c7('0xcd')]['Contacts'][0x0];}return db[_0xd2c7('0x79')][_0xd2c7('0x5e')](_[_0xd2c7('0x1e')](_0x1c2cd8[_0xd2c7('0x5f')],{'firstName':_0x1333a7,'mobile':_0x1333a7,'phone':_0x1333a7,'ListId':_0x5263fc['ListId']}));}})[_0xd2c7('0x23')](handleEntityNotFound(_0xb7c20a,null))[_0xd2c7('0x23')](function(_0xe74e05){if(_0xe74e05){_0x426800=_0xe74e05;return db['SmsInteraction']['find']({'where':{'ContactId':_0x426800['id'],'closed':![],'SmsAccountId':_0x5263fc['id']}})[_0xd2c7('0x23')](function(_0x874f88){if(_0x874f88){return[_0x874f88,![]];}return db['SmsInteraction'][_0xd2c7('0x5e')]({'UserId':_0x1c2cd8['user']['id'],'ContactId':_0x426800['id'],'SmsAccountId':_0x5263fc['id'],'phone':_0x1333a7,'firstMsgDirection':_0xd2c7('0xce'),'Messages':[_[_0xd2c7('0x52')](_0x1c2cd8[_0xd2c7('0x5f')],{'read':![],'body':_0x1c2cd8[_0xd2c7('0x5f')][_0xd2c7('0x5f')],'phone':_0x1333a7,'SmsAccountId':_0x5263fc['id'],'UserId':_0x1c2cd8[_0xd2c7('0xcf')]['id'],'ContactId':_0x426800['id']})]},{'include':[{'model':db[_0xd2c7('0xa7')],'as':_0xd2c7('0xd0')}]})[_0xd2c7('0x23')](function(_0x2ac813){return[_0x2ac813,!![]];});});}})['spread'](function(_0x2873dd,_0x4a0898){if(_0x4a0898){return _0x2873dd;}return db['SmsMessage'][_0xd2c7('0x5e')](_[_0xd2c7('0x52')](_0x1c2cd8[_0xd2c7('0x5f')],{'read':![],'body':_0x1c2cd8[_0xd2c7('0x5f')][_0xd2c7('0x5f')],'phone':_0x1333a7,'SmsAccountId':_0x5263fc['id'],'SmsInteractionId':_0x2873dd['id'],'UserId':_0x1c2cd8[_0xd2c7('0xcf')]['id'],'ContactId':_0x426800['id']}))[_0xd2c7('0x23')](function(_0x4e0b7c){_0x2873dd[_0xd2c7('0xd1')][_0xd2c7('0xd0')]=[];_0x2873dd[_0xd2c7('0xd1')]['Messages'][_0xd2c7('0xd2')](_0x4e0b7c['dataValues']);return _0x2873dd;});})[_0xd2c7('0x23')](respondWithResult(_0xb7c20a,null))[_0xd2c7('0x5d')](handleError(_0xb7c20a,null));};exports[_0xd2c7('0x2d')]=function(_0x176d05,_0x2022d8,_0x29cdfc){if(_0x176d05[_0xd2c7('0x5f')]['id']){delete _0x176d05['body']['id'];}var _0x363750,_0x12b0a7,_0xb8ce88;return db['SmsAccount'][_0xd2c7('0x62')]({'where':{'id':_0x176d05[_0xd2c7('0x59')]['id']}})['then'](handleEntityNotFound(_0x2022d8,null))['then'](function(_0x31fc2b){if(_0x31fc2b){_0xb8ce88=_0x31fc2b;logger[_0xd2c7('0x26')](_0xd2c7('0x27'),_0xd2c7('0x2d'),_0xd2c7('0xd3'),_0x31fc2b[_0xd2c7('0x44')],util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));switch(_0x31fc2b[_0xd2c7('0x44')]){case _0xd2c7('0xd5'):if(_0x176d05[_0xd2c7('0x5f')]['skebby_dispatch_id']&&_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x2d')]){_0x12b0a7=_0x176d05['body'][_0xd2c7('0x2d')];return db[_0xd2c7('0xa7')][_0xd2c7('0x62')]({'where':{'messageId':_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xd6')]}});}break;case _0xd2c7('0x87'):if(_0x176d05['body'][_0xd2c7('0xd7')]&&_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xd8')]){_0x12b0a7=_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xd8')];return db['SmsMessage'][_0xd2c7('0x62')]({'where':{'messageId':_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xd7')]}});}break;case'clicksend':if(_0x176d05['body'][_0xd2c7('0xd9')]&&_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xda')]){_0x12b0a7=_0x176d05[_0xd2c7('0x5f')]['status_code'];return db[_0xd2c7('0xa7')][_0xd2c7('0x62')]({'where':{'messageId':_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xd9')]}});}break;case'infobip':var _0x3ecf39=_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x8e')][0x0];if(_0x3ecf39[_0xd2c7('0x89')]&&_0x3ecf39[_0xd2c7('0x2d')][_0xd2c7('0xdb')]===_0xd2c7('0xdc')){_0x12b0a7=_0x3ecf39[_0xd2c7('0x2d')]['groupName'];return db['SmsMessage'][_0xd2c7('0x62')]({'where':{'messageId':_0x3ecf39['messageId']}});}break;case _0xd2c7('0x92'):if(_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x89')]&&_0x176d05[_0xd2c7('0x5f')]['status']){_0x12b0a7=_0x176d05[_0xd2c7('0x5f')]['status'];return db[_0xd2c7('0xa7')][_0xd2c7('0x62')]({'where':{'messageId':_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x89')]}});}break;case _0xd2c7('0xdd'):if(_0x176d05[_0xd2c7('0x5f')][0x0][_0xd2c7('0x2b')]['id']){_0x12b0a7=_0x176d05[_0xd2c7('0x5f')][0x0][_0xd2c7('0x44')];return db['SmsMessage']['find']({'where':{'messageId':_0x176d05[_0xd2c7('0x5f')][0x0][_0xd2c7('0x2b')]['id']}});}break;case _0xd2c7('0xde'):if(_0x176d05[_0xd2c7('0x5f')]['redif']&&_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x2d')]){_0x12b0a7=_0x176d05[_0xd2c7('0x5f')]['status'];return db[_0xd2c7('0xa7')]['find']({'where':{'messageId':_0x176d05['body'][_0xd2c7('0xdf')]}});}break;}}})[_0xd2c7('0x23')](handleEntityNotFound(_0x2022d8,null))[_0xd2c7('0x23')](function(_0x55910a){if(_0x55910a){_0x363750=_0x55910a;switch(_0xb8ce88['type']){case _0xd2c7('0xd5'):if(_0x12b0a7===_0xd2c7('0xdc')){return _0x363750['update']({'read':!![]});}else{logger[_0xd2c7('0x29')](_0xd2c7('0x27'),_0xd2c7('0x2d'),_0xd2c7('0xd5'),util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd2c7('0x87'):if(_0x12b0a7==='1'){return _0x363750[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')](_0xd2c7('0x27'),_0xd2c7('0x2d'),'skebby',util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd2c7('0x88'):if(!_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0xe0')]&&_0x12b0a7>=0xc8&&_0x12b0a7<=0xce){return _0x363750[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')](_0xd2c7('0x27'),_0xd2c7('0x2d'),_0xd2c7('0x88'),util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd2c7('0x8d'):var _0x5ced92=_0x176d05[_0xd2c7('0x5f')][_0xd2c7('0x8e')][0x0];if(_0x5ced92[_0xd2c7('0x2d')][_0xd2c7('0xdb')]===_0xd2c7('0xdc')){return _0x363750[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xd2c7('0x8d'),util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd2c7('0x92'):if(_0x12b0a7==_0xd2c7('0xe1')||_0x12b0a7==_0xd2c7('0xe2')){return _0x363750[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')](_0xd2c7('0x27'),_0xd2c7('0x2d'),'clickatell',util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x12b0a7==_0xd2c7('0xe3')){return _0x363750[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xd2c7('0xde'):if(_0x12b0a7===_0xd2c7('0xe4')||_0x12b0a7===_0xd2c7('0xe5')){return _0x363750['update']({'read':!![]});}else{logger[_0xd2c7('0x29')](_0xd2c7('0x27'),_0xd2c7('0x2d'),'intelepeer',util[_0xd2c7('0xd4')](_0x176d05[_0xd2c7('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x363750;}})[_0xd2c7('0x23')](respondWithResult(_0x2022d8,null))[_0xd2c7('0x5d')](handleError(_0x2022d8,null));};exports['statusGet']=function(_0x5a3519,_0x50b3be,_0x237487){var _0x220d65,_0x344c25,_0x3ec1fa;return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x5a3519[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x50b3be,null))[_0xd2c7('0x23')](function(_0x8b6487){if(_0x8b6487){_0x3ec1fa=_0x8b6487;logger[_0xd2c7('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd2c7('0x2d'),_0xd2c7('0xd3'),_0x8b6487[_0xd2c7('0x44')],util['inspect'](_0x5a3519[_0xd2c7('0x49')],{'showHidden':![],'depth':null}));switch(_0x8b6487[_0xd2c7('0x44')]){case _0xd2c7('0x8f'):if(_0x5a3519['query'][_0xd2c7('0xe6')]&&_0x5a3519['query'][_0xd2c7('0xe7')]){_0x344c25=_0x5a3519[_0xd2c7('0x49')]['state'];return db[_0xd2c7('0xa7')][_0xd2c7('0x62')]({'where':{'messageId':_0x5a3519[_0xd2c7('0x49')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x50b3be,null))['then'](function(_0xe0f025){if(_0xe0f025){_0x220d65=_0xe0f025;switch(_0x3ec1fa[_0xd2c7('0x44')]){case'csc':if(_0x344c25==='2'||_0x344c25==='6'){return _0x220d65[_0xd2c7('0x38')]({'read':!![]});}else{logger[_0xd2c7('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd2c7('0x2d'),_0xd2c7('0x8f'),util[_0xd2c7('0xd4')](_0x5a3519['query'],{'showHidden':![],'depth':null}));};break;}return _0x220d65;}})[_0xd2c7('0x23')](respondWithResult(_0x50b3be,null))[_0xd2c7('0x5d')](handleError(_0x50b3be,null));};exports[_0xd2c7('0xe8')]=function(_0x2e31dd,_0x4c679e,_0x4d687a){return db[_0xd2c7('0x42')][_0xd2c7('0x62')]({'where':{'id':_0x2e31dd[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x4c679e,null))[_0xd2c7('0x23')](function(_0x3931da){if(_0x3931da){return _0x3931da[_0xd2c7('0xe8')](_0x2e31dd[_0xd2c7('0x5f')]['ids'],_['omit'](_0x2e31dd[_0xd2c7('0x5f')],['ids','id'])||{})[_0xd2c7('0xa2')](function(_0x3ccad8){for(var _0x4965ed=0x0;_0x4965ed<_0x2e31dd[_0xd2c7('0x5f')]['ids']['length'];_0x4965ed+=0x1){socket['emit'](_0xd2c7('0xe9'),{'UserId':Number(_0x2e31dd[_0xd2c7('0x5f')][_0xd2c7('0x71')][_0x4965ed]),'SmsAccountId':Number(_0x2e31dd['params']['id'])});}return _0x3ccad8;});}})[_0xd2c7('0x23')](respondWithResult(_0x4c679e,null))[_0xd2c7('0x5d')](handleError(_0x4c679e,null));};exports[_0xd2c7('0xea')]=function(_0x2f5cca,_0x5c3b91,_0x1d73e1){return db[_0xd2c7('0x42')]['find']({'where':{'id':_0x2f5cca[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x5c3b91,null))[_0xd2c7('0x23')](function(_0x4a9c59){if(_0x4a9c59){return _0x4a9c59[_0xd2c7('0xea')](_0x2f5cca['query'][_0xd2c7('0x71')])[_0xd2c7('0x23')](function(){if(_[_0xd2c7('0xeb')](_0x2f5cca['query'][_0xd2c7('0x71')])){for(var _0x37d302=0x0;_0x37d302<_0x2f5cca[_0xd2c7('0x49')][_0xd2c7('0x71')][_0xd2c7('0x5b')];_0x37d302+=0x1){socket['emit'](_0xd2c7('0xec'),{'UserId':Number(_0x2f5cca[_0xd2c7('0x49')][_0xd2c7('0x71')][_0x37d302]),'SmsAccountId':Number(_0x2f5cca[_0xd2c7('0x59')]['id'])});}}else{socket[_0xd2c7('0xed')](_0xd2c7('0xec'),{'UserId':Number(_0x2f5cca[_0xd2c7('0x49')]['ids']),'SmsAccountId':Number(_0x2f5cca[_0xd2c7('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c3b91,null))[_0xd2c7('0x5d')](handleError(_0x5c3b91,null));};exports[_0xd2c7('0xee')]=function(_0x1b2ed5,_0x1e0d89,_0x45a21f){var _0xdc9172={};var _0x3f9e2a={};var _0x5cd9a8;var _0x56a45f;return db[_0xd2c7('0x42')]['findOne']({'where':{'id':_0x1b2ed5[_0xd2c7('0x59')]['id']}})[_0xd2c7('0x23')](handleEntityNotFound(_0x1e0d89,null))[_0xd2c7('0x23')](function(_0x1d3015){if(_0x1d3015){_0x5cd9a8=_0x1d3015;_0x3f9e2a[_0xd2c7('0x46')]=_[_0xd2c7('0x47')](db[_0xd2c7('0xaa')][_0xd2c7('0x43')]);_0x3f9e2a[_0xd2c7('0x49')]=_[_0xd2c7('0x47')](_0x1b2ed5[_0xd2c7('0x49')]);_0x3f9e2a[_0xd2c7('0x48')]=_[_0xd2c7('0x5a')](_0x3f9e2a['model'],_0x3f9e2a['query']);_0xdc9172[_0xd2c7('0x4a')]=_[_0xd2c7('0x5a')](_0x3f9e2a[_0xd2c7('0x46')],qs[_0xd2c7('0x4b')](_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x4b')]));_0xdc9172[_0xd2c7('0x4a')]=_0xdc9172['attributes'][_0xd2c7('0x5b')]?_0xdc9172[_0xd2c7('0x4a')]:_0x3f9e2a[_0xd2c7('0x46')];_0xdc9172[_0xd2c7('0x4e')]=qs[_0xd2c7('0x4f')](_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x4f')]);_0xdc9172[_0xd2c7('0x50')]=qs[_0xd2c7('0x48')](_['pick'](_0x1b2ed5['query'],_0x3f9e2a['filters']));if(_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x51')]){_0xdc9172[_0xd2c7('0x50')]=_[_0xd2c7('0x52')](_0xdc9172[_0xd2c7('0x50')],{'$or':_[_0xd2c7('0x41')](_0xdc9172['attributes'],function(_0x418f78){var _0x345c83={};_0x345c83[_0x418f78]={'$like':'%'+_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x51')]+'%'};return _0x345c83;})});}_0xdc9172=_[_0xd2c7('0x52')]({},_0xdc9172,_0x1b2ed5[_0xd2c7('0x5c')]);return _0x5cd9a8[_0xd2c7('0xee')](_0xdc9172);}})[_0xd2c7('0x23')](function(_0x5c9330){if(_0x5c9330){_0x56a45f=_0x5c9330[_0xd2c7('0x5b')];if(!_0x1b2ed5[_0xd2c7('0x49')]['hasOwnProperty']('nolimit')){_0xdc9172['limit']=qs[_0xd2c7('0x33')](_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x33')]);_0xdc9172[_0xd2c7('0x30')]=qs[_0xd2c7('0x30')](_0x1b2ed5[_0xd2c7('0x49')][_0xd2c7('0x30')]);}return _0x5cd9a8[_0xd2c7('0xee')](_0xdc9172);}})[_0xd2c7('0x23')](function(_0x44eaf1){if(_0x44eaf1){return _0x44eaf1?{'count':_0x56a45f,'rows':_0x44eaf1}:null;}})[_0xd2c7('0x23')](respondWithResult(_0x1e0d89,null))[_0xd2c7('0x5d')](handleError(_0x1e0d89,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 32eeb66..23b684b 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 _0x1a18=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x103576,_0x44cf91){var _0x18cccb=function(_0x541145){while(--_0x541145){_0x103576['push'](_0x103576['shift']());}};_0x18cccb(++_0x44cf91);}(_0x1a18,0x1f1));var _0x81a1=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x1a18[_0x335271];return _0xa9fff8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x81a1('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x81a1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x81a1('0x2'),'afterDestroy':_0x81a1('0x3')};function emitEvent(_0x2b2187){return function(_0x4b4f24,_0x2af1d2,_0x3824e5){SmsAccountEvents[_0x81a1('0x4')](_0x2b2187+':'+_0x4b4f24['id'],_0x4b4f24);SmsAccountEvents['emit'](_0x2b2187,_0x4b4f24);_0x3824e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x81a1('0x5')](e,emitEvent(event));}}module[_0x81a1('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0x4dd6=['remove','emit','hasOwnProperty','exports','events','SmsAccount'];(function(_0x1b30ef,_0x198a1c){var _0x3b33b1=function(_0x22e5c6){while(--_0x22e5c6){_0x1b30ef['push'](_0x1b30ef['shift']());}};_0x3b33b1(++_0x198a1c);}(_0x4dd6,0x142));var _0x64dd=function(_0x25a665,_0x52c944){_0x25a665=_0x25a665-0x0;var _0x5137bf=_0x4dd6[_0x25a665];return _0x5137bf;};'use strict';var EventEmitter=require(_0x64dd('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x64dd('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x64dd('0x2')};function emitEvent(_0x209939){return function(_0x1ac588,_0x3d394b,_0x11d61e){SmsAccountEvents[_0x64dd('0x3')](_0x209939+':'+_0x1ac588['id'],_0x1ac588);SmsAccountEvents[_0x64dd('0x3')](_0x209939,_0x1ac588);_0x11d61e(null);};}for(var e in events){if(events[_0x64dd('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x64dd('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ed8fe18..b4fedd2 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 _0xf300=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','SmsAccount','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf300,0xe5));var _0x0f30=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xf300[_0x1fa381];return _0x47eefe;};'use strict';var _=require('lodash');var util=require(_0x0f30('0x0'));var logger=require(_0x0f30('0x1'))(_0x0f30('0x2'));var moment=require(_0x0f30('0x3'));var BPromise=require(_0x0f30('0x4'));var rp=require(_0x0f30('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f30('0x6'));var config=require(_0x0f30('0x7'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x5bfeef,_0x42b0a2){return _0x5bfeef[_0x0f30('0x8')](_0x0f30('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3390=['define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./smsAccount.attributes'];(function(_0x15a0ff,_0x906058){var _0x38d79a=function(_0xd97d15){while(--_0xd97d15){_0x15a0ff['push'](_0x15a0ff['shift']());}};_0x38d79a(++_0x906058);}(_0x3390,0x173));var _0x0339=function(_0x110b67,_0x199229){_0x110b67=_0x110b67-0x0;var _0x5dbe0d=_0x3390[_0x110b67];return _0x5dbe0d;};'use strict';var _=require(_0x0339('0x0'));var util=require(_0x0339('0x1'));var logger=require(_0x0339('0x2'))(_0x0339('0x3'));var moment=require(_0x0339('0x4'));var BPromise=require('bluebird');var rp=require(_0x0339('0x5'));var fs=require('fs');var path=require(_0x0339('0x6'));var rimraf=require(_0x0339('0x7'));var config=require('../../config/environment');var attributes=require(_0x0339('0x8'));module['exports']=function(_0x22d670,_0x57bccf){return _0x22d670[_0x0339('0x9')]('SmsAccount',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 2430a22..d8de098 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 _0xfdaf=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','SmsAccount','find','options','raw','include','map','model','attributes','then','ShowSmsAccount','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdaf,0x19e));var _0xffda=function(_0x28a0fa,_0x24395f){_0x28a0fa=_0x28a0fa-0x0;var _0x11e95f=_0xfdaf[_0x28a0fa];return _0x11e95f;};'use strict';var _=require(_0xffda('0x0'));var util=require(_0xffda('0x1'));var moment=require(_0xffda('0x2'));var BPromise=require(_0xffda('0x3'));var rs=require(_0xffda('0x4'));var fs=require('fs');var Redis=require(_0xffda('0x5'));var db=require(_0xffda('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xffda('0x7'))('rpc');var config=require(_0xffda('0x8'));var jayson=require(_0xffda('0x9'));var client=jayson[_0xffda('0xa')][_0xffda('0xb')]({'port':0x232a});config[_0xffda('0xc')]=_[_0xffda('0xd')](config[_0xffda('0xc')],{'host':_0xffda('0xe'),'port':0x18eb});var socket=require(_0xffda('0xf'))(new Redis(config[_0xffda('0xc')]));require('./smsAccount.socket')[_0xffda('0x10')](socket);function respondWithRpcPromise(_0x6fba41,_0x32320c,_0x2c87fa){return new BPromise(function(_0x509b2f,_0x561fb){return client['request'](_0x6fba41,_0x2c87fa)['then'](function(_0x4946d7){logger['info']('SmsAccount,\x20%s,\x20%s',_0x32320c,_0xffda('0x11'));logger[_0xffda('0x12')](_0xffda('0x13'),_0x32320c,_0xffda('0x11'),JSON[_0xffda('0x14')](_0x4946d7));if(_0x4946d7[_0xffda('0x15')]){if(_0x4946d7[_0xffda('0x15')][_0xffda('0x16')]===0x1f4){logger[_0xffda('0x15')](_0xffda('0x17'),_0x32320c,_0x4946d7[_0xffda('0x15')][_0xffda('0x18')]);return _0x561fb(_0x4946d7['error'][_0xffda('0x18')]);}logger['error'](_0xffda('0x17'),_0x32320c,_0x4946d7[_0xffda('0x15')]['message']);return _0x509b2f(_0x4946d7['error']['message']);}else{logger[_0xffda('0x19')](_0xffda('0x17'),_0x32320c,_0xffda('0x11'));_0x509b2f(_0x4946d7[_0xffda('0x1a')][_0xffda('0x18')]);}})[_0xffda('0x1b')](function(_0x209147){logger[_0xffda('0x15')](_0xffda('0x17'),_0x32320c,_0x209147);_0x561fb(_0x209147);});});}exports['ShowSmsAccount']=function(_0x30f39b){var _0x344fc6=this;return new Promise(function(_0x396222,_0x503e1a){return db[_0xffda('0x1c')][_0xffda('0x1d')]({'raw':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')][_0xffda('0x1f')]===undefined?!![]:![]:!![],'where':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')]['where']||null:null,'attributes':_0x30f39b[_0xffda('0x1e')]?_0x30f39b[_0xffda('0x1e')]['attributes']||null:null,'include':_0x30f39b[_0xffda('0x1e')]?_0x30f39b['options'][_0xffda('0x20')]?_[_0xffda('0x21')](_0x30f39b[_0xffda('0x1e')][_0xffda('0x20')],function(_0x231360){return{'model':db[_0x231360[_0xffda('0x22')]],'as':_0x231360['as'],'attributes':_0x231360[_0xffda('0x23')],'include':_0x231360[_0xffda('0x20')]?_[_0xffda('0x21')](_0x231360['include'],function(_0x1ffcb4){return{'model':db[_0x1ffcb4['model']],'as':_0x1ffcb4['as'],'attributes':_0x1ffcb4[_0xffda('0x23')],'include':_0x1ffcb4[_0xffda('0x20')]?_['map'](_0x1ffcb4[_0xffda('0x20')],function(_0x51955b){return{'model':db[_0x51955b['model']],'as':_0x51955b['as'],'attributes':_0x51955b[_0xffda('0x23')]};}):[]};}):[]};}):[]:[]})[_0xffda('0x24')](function(_0x56adbe){logger[_0xffda('0x19')](_0xffda('0x25'),_0x30f39b);logger[_0xffda('0x12')]('ShowSmsAccount',_0x30f39b,JSON[_0xffda('0x14')](_0x56adbe));_0x396222(_0x56adbe);})[_0xffda('0x1b')](function(_0x13159f){logger[_0xffda('0x15')](_0xffda('0x25'),_0x13159f[_0xffda('0x18')],_0x30f39b);_0x503e1a(_0x344fc6['error'](0x1f4,_0x13159f['message']));});});}; \ No newline at end of file +var _0x841f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsAccount.socket','register','request','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','model','attributes','map','stringify','lodash','moment','bluebird','randomstring'];(function(_0x32ca7a,_0x4a069d){var _0xab41b9=function(_0x346bfc){while(--_0x346bfc){_0x32ca7a['push'](_0x32ca7a['shift']());}};_0xab41b9(++_0x4a069d);}(_0x841f,0xe0));var _0xf841=function(_0x4bf3c,_0x4082fd){_0x4bf3c=_0x4bf3c-0x0;var _0x31c21a=_0x841f[_0x4bf3c];return _0x31c21a;};'use strict';var _=require(_0xf841('0x0'));var util=require('util');var moment=require(_0xf841('0x1'));var BPromise=require(_0xf841('0x2'));var rs=require(_0xf841('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf841('0x4'))['db'];var utils=require(_0xf841('0x5'));var logger=require(_0xf841('0x6'))(_0xf841('0x7'));var config=require(_0xf841('0x8'));var jayson=require(_0xf841('0x9'));var client=jayson[_0xf841('0xa')][_0xf841('0xb')]({'port':0x232a});config['redis']=_[_0xf841('0xc')](config[_0xf841('0xd')],{'host':_0xf841('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf841('0xd')]));require(_0xf841('0xf'))[_0xf841('0x10')](socket);function respondWithRpcPromise(_0x5c5172,_0x5a749d,_0x560662){return new BPromise(function(_0x4210e0,_0x4db778){return client[_0xf841('0x11')](_0x5c5172,_0x560662)[_0xf841('0x12')](function(_0xf57034){logger[_0xf841('0x13')]('SmsAccount,\x20%s,\x20%s',_0x5a749d,_0xf841('0x14'));logger[_0xf841('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5a749d,_0xf841('0x14'),JSON['stringify'](_0xf57034));if(_0xf57034[_0xf841('0x16')]){if(_0xf57034['error'][_0xf841('0x17')]===0x1f4){logger['error'](_0xf841('0x18'),_0x5a749d,_0xf57034[_0xf841('0x16')][_0xf841('0x19')]);return _0x4db778(_0xf57034[_0xf841('0x16')][_0xf841('0x19')]);}logger[_0xf841('0x16')](_0xf841('0x18'),_0x5a749d,_0xf57034[_0xf841('0x16')][_0xf841('0x19')]);return _0x4210e0(_0xf57034[_0xf841('0x16')][_0xf841('0x19')]);}else{logger['info'](_0xf841('0x18'),_0x5a749d,_0xf841('0x14'));_0x4210e0(_0xf57034[_0xf841('0x1a')][_0xf841('0x19')]);}})['catch'](function(_0x3394b5){logger[_0xf841('0x16')](_0xf841('0x18'),_0x5a749d,_0x3394b5);_0x4db778(_0x3394b5);});});}exports[_0xf841('0x1b')]=function(_0x3b3ce0){var _0x4d9f50=this;return new Promise(function(_0x44275f,_0x507bce){return db[_0xf841('0x1c')][_0xf841('0x1d')]({'raw':_0x3b3ce0[_0xf841('0x1e')]?_0x3b3ce0[_0xf841('0x1e')][_0xf841('0x1f')]===undefined?!![]:![]:!![],'where':_0x3b3ce0[_0xf841('0x1e')]?_0x3b3ce0[_0xf841('0x1e')][_0xf841('0x20')]||null:null,'attributes':_0x3b3ce0[_0xf841('0x1e')]?_0x3b3ce0[_0xf841('0x1e')]['attributes']||null:null,'include':_0x3b3ce0[_0xf841('0x1e')]?_0x3b3ce0[_0xf841('0x1e')][_0xf841('0x21')]?_['map'](_0x3b3ce0[_0xf841('0x1e')][_0xf841('0x21')],function(_0x58e44a){return{'model':db[_0x58e44a[_0xf841('0x22')]],'as':_0x58e44a['as'],'attributes':_0x58e44a[_0xf841('0x23')],'include':_0x58e44a['include']?_[_0xf841('0x24')](_0x58e44a[_0xf841('0x21')],function(_0x2733e5){return{'model':db[_0x2733e5[_0xf841('0x22')]],'as':_0x2733e5['as'],'attributes':_0x2733e5['attributes'],'include':_0x2733e5[_0xf841('0x21')]?_[_0xf841('0x24')](_0x2733e5['include'],function(_0x2add1c){return{'model':db[_0x2add1c[_0xf841('0x22')]],'as':_0x2add1c['as'],'attributes':_0x2add1c[_0xf841('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39892a){logger[_0xf841('0x13')](_0xf841('0x1b'),_0x3b3ce0);logger[_0xf841('0x15')](_0xf841('0x1b'),_0x3b3ce0,JSON[_0xf841('0x25')](_0x39892a));_0x44275f(_0x39892a);})['catch'](function(_0x503def){logger[_0xf841('0x16')](_0xf841('0x1b'),_0x503def['message'],_0x3b3ce0);_0x507bce(_0x4d9f50[_0xf841('0x16')](0x1f4,_0x503def['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9c4c5b9..f865ef8 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 60f2a04..31fa7d2 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x286c12,_0x20b2ce){var _0x43f526=function(_0x1e01bd){while(--_0x1e01bd){_0x286c12['push'](_0x286c12['shift']());}};_0x43f526(++_0x20b2ce);}(_0xedd9,0xfc));var _0x9edd=function(_0x268ac1,_0x3c9369){_0x268ac1=_0x268ac1-0x0;var _0x53c80c=_0xedd9[_0x268ac1];return _0x53c80c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x4da0fa,_0x527d66){var _0x44770f=function(_0x3501df){while(--_0x3501df){_0x4da0fa['push'](_0x4da0fa['shift']());}};_0x44770f(++_0x527d66);}(_0x55ca,0x126));var _0xa55c=function(_0x1529a3,_0x529f63){_0x1529a3=_0x1529a3-0x0;var _0x1a0d4b=_0x55ca[_0x1529a3];return _0x1a0d4b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 699f581..1a74627 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 _0x4d19=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0x4d19,0x98));var _0x94d1=function(_0x1486a4,_0xc1fd28){_0x1486a4=_0x1486a4-0x0;var _0x4c17fc=_0x4d19[_0x1486a4];return _0x4c17fc;};'use strict';var Sequelize=require(_0x94d1('0x0'));module[_0x94d1('0x1')]={'priority':{'type':Sequelize[_0x94d1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x94d1('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x94d1('0x4')]()},'description':{'type':Sequelize[_0x94d1('0x3')]},'interval':{'type':Sequelize[_0x94d1('0x3')],'defaultValue':_0x94d1('0x5')}}; \ No newline at end of file +var _0x203b=['INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x203b,0xe5));var _0xb203=function(_0x31c370,_0x5e27f9){_0x31c370=_0x31c370-0x0;var _0x449100=_0x203b[_0x31c370];return _0x449100;};'use strict';var Sequelize=require(_0xb203('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb203('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb203('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb203('0x3')],'defaultValue':_0xb203('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7d28609..cef7f99 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 _0xba90=['options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','includeAll','SmsApplication','findAll','rows','catch','show','params','include'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xba90,0x1bb));var _0x0ba9=function(_0x53dec5,_0x5553a2){_0x53dec5=_0x53dec5-0x0;var _0x3d456a=_0xba90[_0x53dec5];return _0x3d456a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ba9('0x0'));var zipdir=require(_0x0ba9('0x1'));var jsonpatch=require(_0x0ba9('0x2'));var rp=require('request-promise');var moment=require(_0x0ba9('0x3'));var BPromise=require(_0x0ba9('0x4'));var Mustache=require(_0x0ba9('0x5'));var util=require(_0x0ba9('0x6'));var path=require(_0x0ba9('0x7'));var sox=require(_0x0ba9('0x8'));var csv=require(_0x0ba9('0x9'));var ejs=require(_0x0ba9('0xa'));var fs=require('fs');var fs_extra=require(_0x0ba9('0xb'));var _=require(_0x0ba9('0xc'));var squel=require(_0x0ba9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ba9('0x9'));var querystring=require(_0x0ba9('0xe'));var Papa=require(_0x0ba9('0xf'));var Redis=require(_0x0ba9('0x10'));var authService=require(_0x0ba9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ba9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ba9('0x13'))(_0x0ba9('0x14'));var utils=require(_0x0ba9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ba9('0x16'))['db'];function respondWithStatusCode(_0x3e0d47,_0x4aa6f2){_0x4aa6f2=_0x4aa6f2||0xcc;return function(_0x11be1e){if(_0x11be1e){return _0x3e0d47[_0x0ba9('0x17')](_0x4aa6f2);}return _0x3e0d47[_0x0ba9('0x18')](_0x4aa6f2)['end']();};}function respondWithResult(_0x3eecbd,_0x542be1){_0x542be1=_0x542be1||0xc8;return function(_0x433c33){if(_0x433c33){return _0x3eecbd['status'](_0x542be1)[_0x0ba9('0x19')](_0x433c33);}};}function respondWithFilteredResult(_0x1638e1,_0xd525e){return function(_0x12da39){if(_0x12da39){var _0x1b0f32=typeof _0xd525e[_0x0ba9('0x1a')]===_0x0ba9('0x1b')&&typeof _0xd525e[_0x0ba9('0x1c')]==='undefined';var _0x8f5ff7=_0x12da39[_0x0ba9('0x1d')];var _0x503c3c=_0x1b0f32?0x0:_0xd525e[_0x0ba9('0x1a')];var _0x3d9c38=_0x1b0f32?_0x12da39[_0x0ba9('0x1d')]:_0xd525e[_0x0ba9('0x1a')]+_0xd525e['limit'];var _0x10e324;if(_0x3d9c38>=_0x8f5ff7){_0x3d9c38=_0x8f5ff7;_0x10e324=0xc8;}else{_0x10e324=0xce;}_0x1638e1[_0x0ba9('0x18')](_0x10e324);return _0x1638e1['set'](_0x0ba9('0x1e'),_0x503c3c+'-'+_0x3d9c38+'/'+_0x8f5ff7)[_0x0ba9('0x19')](_0x12da39);}return null;};}function patchUpdates(_0x5cba5d){return function(_0x1b1468){try{jsonpatch['apply'](_0x1b1468,_0x5cba5d,!![]);}catch(_0x100130){return BPromise[_0x0ba9('0x1f')](_0x100130);}return _0x1b1468[_0x0ba9('0x20')]();};}function saveUpdates(_0x4ae238,_0x30bb09){return function(_0x464150){if(_0x464150){return _0x464150[_0x0ba9('0x21')](_0x4ae238)[_0x0ba9('0x22')](function(_0x31bd83){return _0x31bd83;});}return null;};}function removeEntity(_0x3ff663,_0x148723){return function(_0x5bb26a){if(_0x5bb26a){return _0x5bb26a['destroy']()[_0x0ba9('0x22')](function(){_0x3ff663['status'](0xcc)[_0x0ba9('0x23')]();});}};}function handleEntityNotFound(_0x422848,_0xcd810a){return function(_0x344e19){if(!_0x344e19){_0x422848[_0x0ba9('0x17')](0x194);}return _0x344e19;};}function handleError(_0x5e3d09,_0x14305e){_0x14305e=_0x14305e||0x1f4;return function(_0x5ccd60){logger[_0x0ba9('0x24')](_0x5ccd60[_0x0ba9('0x25')]);if(_0x5ccd60[_0x0ba9('0x26')]){delete _0x5ccd60[_0x0ba9('0x26')];}_0x5e3d09[_0x0ba9('0x18')](_0x14305e)['send'](_0x5ccd60);};}exports[_0x0ba9('0x27')]=function(_0x1ab125,_0xd43445){var _0x47a096={},_0x5b2bf0={},_0x60818c={'count':0x0,'rows':[]};var _0x1cf3c7=_[_0x0ba9('0x28')](db['SmsApplication'][_0x0ba9('0x29')],function(_0x63df61){return{'name':_0x63df61[_0x0ba9('0x2a')],'type':_0x63df61[_0x0ba9('0x2b')][_0x0ba9('0x2c')]};});_0x5b2bf0['model']=_[_0x0ba9('0x28')](_0x1cf3c7,_0x0ba9('0x26'));_0x5b2bf0[_0x0ba9('0x2d')]=_[_0x0ba9('0x2e')](_0x1ab125['query']);_0x5b2bf0[_0x0ba9('0x2f')]=_[_0x0ba9('0x30')](_0x5b2bf0['model'],_0x5b2bf0[_0x0ba9('0x2d')]);_0x47a096['attributes']=_[_0x0ba9('0x30')](_0x5b2bf0[_0x0ba9('0x31')],qs['fields'](_0x1ab125['query']['fields']));_0x47a096['attributes']=_0x47a096[_0x0ba9('0x32')][_0x0ba9('0x33')]?_0x47a096[_0x0ba9('0x32')]:_0x5b2bf0[_0x0ba9('0x31')];if(!_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x34')](_0x0ba9('0x35'))){_0x47a096[_0x0ba9('0x1c')]=qs[_0x0ba9('0x1c')](_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x1c')]);_0x47a096[_0x0ba9('0x1a')]=qs[_0x0ba9('0x1a')](_0x1ab125['query'][_0x0ba9('0x1a')]);}_0x47a096[_0x0ba9('0x36')]=qs[_0x0ba9('0x37')](_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x37')]);_0x47a096['where']=qs[_0x0ba9('0x2f')](_['pick'](_0x1ab125[_0x0ba9('0x2d')],_0x5b2bf0[_0x0ba9('0x2f')]),_0x1cf3c7);if(_0x1ab125['query']['filter']){_0x47a096['where']=_[_0x0ba9('0x38')](_0x47a096[_0x0ba9('0x39')],{'$or':_[_0x0ba9('0x28')](_0x1cf3c7,function(_0x2747f7){if(_0x2747f7[_0x0ba9('0x2b')]!==_0x0ba9('0x3a')){var _0x2c858f={};_0x2c858f[_0x2747f7[_0x0ba9('0x26')]]={'$like':'%'+_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x3b')]+'%'};return _0x2c858f;}})});}_0x47a096=_[_0x0ba9('0x38')]({},_0x47a096,_0x1ab125['options']);var _0x3b931c={'where':_0x47a096[_0x0ba9('0x39')]};return db['SmsApplication'][_0x0ba9('0x1d')](_0x3b931c)[_0x0ba9('0x22')](function(_0x2e0b2f){_0x60818c['count']=_0x2e0b2f;if(_0x1ab125[_0x0ba9('0x2d')][_0x0ba9('0x3c')]){_0x47a096['include']=[{'all':!![]}];}return db[_0x0ba9('0x3d')][_0x0ba9('0x3e')](_0x47a096);})['then'](function(_0x2678ed){_0x60818c[_0x0ba9('0x3f')]=_0x2678ed;return _0x60818c;})[_0x0ba9('0x22')](respondWithFilteredResult(_0xd43445,_0x47a096))[_0x0ba9('0x40')](handleError(_0xd43445,null));};exports[_0x0ba9('0x41')]=function(_0x2129b0,_0x149b61){var _0x318ac9={'raw':!![],'where':{'id':_0x2129b0[_0x0ba9('0x42')]['id']}},_0x4e0682={};_0x4e0682[_0x0ba9('0x31')]=_[_0x0ba9('0x2e')](db[_0x0ba9('0x3d')][_0x0ba9('0x29')]);_0x4e0682[_0x0ba9('0x2d')]=_[_0x0ba9('0x2e')](_0x2129b0[_0x0ba9('0x2d')]);_0x4e0682[_0x0ba9('0x2f')]=_['intersection'](_0x4e0682['model'],_0x4e0682[_0x0ba9('0x2d')]);_0x318ac9[_0x0ba9('0x32')]=_[_0x0ba9('0x30')](_0x4e0682['model'],qs['fields'](_0x2129b0['query']['fields']));_0x318ac9['attributes']=_0x318ac9[_0x0ba9('0x32')][_0x0ba9('0x33')]?_0x318ac9['attributes']:_0x4e0682[_0x0ba9('0x31')];if(_0x2129b0[_0x0ba9('0x2d')][_0x0ba9('0x3c')]){_0x318ac9[_0x0ba9('0x43')]=[{'all':!![]}];}_0x318ac9=_[_0x0ba9('0x38')]({},_0x318ac9,_0x2129b0[_0x0ba9('0x44')]);return db['SmsApplication'][_0x0ba9('0x45')](_0x318ac9)['then'](handleEntityNotFound(_0x149b61,null))[_0x0ba9('0x22')](respondWithResult(_0x149b61,null))['catch'](handleError(_0x149b61,null));};exports[_0x0ba9('0x46')]=function(_0x2d2feb,_0x3b5512){return db[_0x0ba9('0x3d')]['create'](_0x2d2feb[_0x0ba9('0x47')],{})[_0x0ba9('0x22')](respondWithResult(_0x3b5512,0xc9))[_0x0ba9('0x40')](handleError(_0x3b5512,null));};exports[_0x0ba9('0x21')]=function(_0x163378,_0x1d7724){if(_0x163378[_0x0ba9('0x47')]['id']){delete _0x163378[_0x0ba9('0x47')]['id'];}return db[_0x0ba9('0x3d')]['find']({'where':{'id':_0x163378[_0x0ba9('0x42')]['id']}})[_0x0ba9('0x22')](handleEntityNotFound(_0x1d7724,null))['then'](saveUpdates(_0x163378[_0x0ba9('0x47')],null))[_0x0ba9('0x22')](respondWithResult(_0x1d7724,null))['catch'](handleError(_0x1d7724,null));};exports[_0x0ba9('0x48')]=function(_0x302902,_0x17686b){return db[_0x0ba9('0x3d')][_0x0ba9('0x45')]({'where':{'id':_0x302902[_0x0ba9('0x42')]['id']}})['then'](handleEntityNotFound(_0x17686b,null))[_0x0ba9('0x22')](removeEntity(_0x17686b,null))['catch'](handleError(_0x17686b,null));}; \ No newline at end of file +var _0x1df5=['util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','keys','filters','model','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','fields','length','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x41aa4a,_0x355f2e){var _0x4c4ccb=function(_0x55e919){while(--_0x55e919){_0x41aa4a['push'](_0x41aa4a['shift']());}};_0x4c4ccb(++_0x355f2e);}(_0x1df5,0x1bc));var _0x51df=function(_0x4154a6,_0x470c76){_0x4154a6=_0x4154a6-0x0;var _0x1281ec=_0x1df5[_0x4154a6];return _0x1281ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51df('0x0'));var zipdir=require(_0x51df('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51df('0x2'));var moment=require(_0x51df('0x3'));var BPromise=require(_0x51df('0x4'));var Mustache=require(_0x51df('0x5'));var util=require(_0x51df('0x6'));var path=require(_0x51df('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x51df('0x8'));var fs=require('fs');var fs_extra=require(_0x51df('0x9'));var _=require(_0x51df('0xa'));var squel=require(_0x51df('0xb'));var crypto=require(_0x51df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x51df('0xd'));var toCsv=require(_0x51df('0xe'));var querystring=require(_0x51df('0xf'));var Papa=require(_0x51df('0x10'));var Redis=require(_0x51df('0x11'));var authService=require(_0x51df('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x51df('0x13'))(_0x51df('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51df('0x15'));var db=require(_0x51df('0x16'))['db'];function respondWithStatusCode(_0xfc9883,_0x5bc68d){_0x5bc68d=_0x5bc68d||0xcc;return function(_0x55cc60){if(_0x55cc60){return _0xfc9883[_0x51df('0x17')](_0x5bc68d);}return _0xfc9883['status'](_0x5bc68d)[_0x51df('0x18')]();};}function respondWithResult(_0x3ece28,_0x4b99e6){_0x4b99e6=_0x4b99e6||0xc8;return function(_0x1d230c){if(_0x1d230c){return _0x3ece28[_0x51df('0x19')](_0x4b99e6)['json'](_0x1d230c);}};}function respondWithFilteredResult(_0x4ed92c,_0x210a0e){return function(_0xab078a){if(_0xab078a){var _0x10720c=typeof _0x210a0e[_0x51df('0x1a')]===_0x51df('0x1b')&&typeof _0x210a0e['limit']===_0x51df('0x1b');var _0x2e85ba=_0xab078a[_0x51df('0x1c')];var _0x1a7608=_0x10720c?0x0:_0x210a0e[_0x51df('0x1a')];var _0x31cf7c=_0x10720c?_0xab078a[_0x51df('0x1c')]:_0x210a0e[_0x51df('0x1a')]+_0x210a0e[_0x51df('0x1d')];var _0x43bc35;if(_0x31cf7c>=_0x2e85ba){_0x31cf7c=_0x2e85ba;_0x43bc35=0xc8;}else{_0x43bc35=0xce;}_0x4ed92c[_0x51df('0x19')](_0x43bc35);return _0x4ed92c['set'](_0x51df('0x1e'),_0x1a7608+'-'+_0x31cf7c+'/'+_0x2e85ba)[_0x51df('0x1f')](_0xab078a);}return null;};}function patchUpdates(_0x2ce88a){return function(_0x11e13a){try{jsonpatch[_0x51df('0x20')](_0x11e13a,_0x2ce88a,!![]);}catch(_0x38ddd0){return BPromise[_0x51df('0x21')](_0x38ddd0);}return _0x11e13a[_0x51df('0x22')]();};}function saveUpdates(_0x33887b,_0x1e03fb){return function(_0x401724){if(_0x401724){return _0x401724[_0x51df('0x23')](_0x33887b)[_0x51df('0x24')](function(_0x1907f9){return _0x1907f9;});}return null;};}function removeEntity(_0x5d5e3d,_0x454b9b){return function(_0x475115){if(_0x475115){return _0x475115[_0x51df('0x25')]()[_0x51df('0x24')](function(){_0x5d5e3d[_0x51df('0x19')](0xcc)[_0x51df('0x18')]();});}};}function handleEntityNotFound(_0x4a73aa,_0xe44224){return function(_0x3722c7){if(!_0x3722c7){_0x4a73aa[_0x51df('0x17')](0x194);}return _0x3722c7;};}function handleError(_0x1500ba,_0xa1957f){_0xa1957f=_0xa1957f||0x1f4;return function(_0x4b034f){logger[_0x51df('0x26')](_0x4b034f[_0x51df('0x27')]);if(_0x4b034f[_0x51df('0x28')]){delete _0x4b034f[_0x51df('0x28')];}_0x1500ba[_0x51df('0x19')](_0xa1957f)[_0x51df('0x29')](_0x4b034f);};}exports[_0x51df('0x2a')]=function(_0x437175,_0x2a26ca){var _0x1e853a={},_0x7cd928={},_0x4873bd={'count':0x0,'rows':[]};var _0x46b716=_[_0x51df('0x2b')](db[_0x51df('0x2c')][_0x51df('0x2d')],function(_0x5da28d){return{'name':_0x5da28d[_0x51df('0x2e')],'type':_0x5da28d[_0x51df('0x2f')]['key']};});_0x7cd928['model']=_[_0x51df('0x2b')](_0x46b716,_0x51df('0x28'));_0x7cd928[_0x51df('0x30')]=_[_0x51df('0x31')](_0x437175[_0x51df('0x30')]);_0x7cd928[_0x51df('0x32')]=_['intersection'](_0x7cd928[_0x51df('0x33')],_0x7cd928[_0x51df('0x30')]);_0x1e853a['attributes']=_[_0x51df('0x34')](_0x7cd928[_0x51df('0x33')],qs['fields'](_0x437175[_0x51df('0x30')]['fields']));_0x1e853a[_0x51df('0x35')]=_0x1e853a['attributes']['length']?_0x1e853a[_0x51df('0x35')]:_0x7cd928[_0x51df('0x33')];if(!_0x437175['query'][_0x51df('0x36')](_0x51df('0x37'))){_0x1e853a['limit']=qs['limit'](_0x437175['query'][_0x51df('0x1d')]);_0x1e853a['offset']=qs[_0x51df('0x1a')](_0x437175[_0x51df('0x30')]['offset']);}_0x1e853a[_0x51df('0x38')]=qs[_0x51df('0x39')](_0x437175[_0x51df('0x30')][_0x51df('0x39')]);_0x1e853a[_0x51df('0x3a')]=qs['filters'](_[_0x51df('0x3b')](_0x437175[_0x51df('0x30')],_0x7cd928[_0x51df('0x32')]),_0x46b716);if(_0x437175['query'][_0x51df('0x3c')]){_0x1e853a['where']=_[_0x51df('0x3d')](_0x1e853a['where'],{'$or':_['map'](_0x46b716,function(_0x10eef0){if(_0x10eef0[_0x51df('0x2f')]!=='VIRTUAL'){var _0x4b0caa={};_0x4b0caa[_0x10eef0['name']]={'$like':'%'+_0x437175['query'][_0x51df('0x3c')]+'%'};return _0x4b0caa;}})});}_0x1e853a=_[_0x51df('0x3d')]({},_0x1e853a,_0x437175[_0x51df('0x3e')]);var _0x2b55d9={'where':_0x1e853a[_0x51df('0x3a')]};return db[_0x51df('0x2c')][_0x51df('0x1c')](_0x2b55d9)[_0x51df('0x24')](function(_0x1f5632){_0x4873bd['count']=_0x1f5632;if(_0x437175[_0x51df('0x30')][_0x51df('0x3f')]){_0x1e853a[_0x51df('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0x51df('0x41')](_0x1e853a);})[_0x51df('0x24')](function(_0x4e30b5){_0x4873bd[_0x51df('0x42')]=_0x4e30b5;return _0x4873bd;})['then'](respondWithFilteredResult(_0x2a26ca,_0x1e853a))['catch'](handleError(_0x2a26ca,null));};exports[_0x51df('0x43')]=function(_0x18ebba,_0x166e2a){var _0x3d599e={'raw':!![],'where':{'id':_0x18ebba[_0x51df('0x44')]['id']}},_0x207dfc={};_0x207dfc['model']=_[_0x51df('0x31')](db[_0x51df('0x2c')][_0x51df('0x2d')]);_0x207dfc['query']=_[_0x51df('0x31')](_0x18ebba[_0x51df('0x30')]);_0x207dfc[_0x51df('0x32')]=_[_0x51df('0x34')](_0x207dfc[_0x51df('0x33')],_0x207dfc[_0x51df('0x30')]);_0x3d599e[_0x51df('0x35')]=_[_0x51df('0x34')](_0x207dfc['model'],qs[_0x51df('0x45')](_0x18ebba[_0x51df('0x30')]['fields']));_0x3d599e['attributes']=_0x3d599e[_0x51df('0x35')][_0x51df('0x46')]?_0x3d599e[_0x51df('0x35')]:_0x207dfc[_0x51df('0x33')];if(_0x18ebba[_0x51df('0x30')][_0x51df('0x3f')]){_0x3d599e[_0x51df('0x40')]=[{'all':!![]}];}_0x3d599e=_['merge']({},_0x3d599e,_0x18ebba['options']);return db['SmsApplication'][_0x51df('0x47')](_0x3d599e)[_0x51df('0x24')](handleEntityNotFound(_0x166e2a,null))['then'](respondWithResult(_0x166e2a,null))[_0x51df('0x48')](handleError(_0x166e2a,null));};exports[_0x51df('0x49')]=function(_0x2edfc5,_0x3397ca){return db[_0x51df('0x2c')]['create'](_0x2edfc5[_0x51df('0x4a')],{})['then'](respondWithResult(_0x3397ca,0xc9))[_0x51df('0x48')](handleError(_0x3397ca,null));};exports['update']=function(_0x4a7d69,_0x424c39){if(_0x4a7d69['body']['id']){delete _0x4a7d69[_0x51df('0x4a')]['id'];}return db[_0x51df('0x2c')][_0x51df('0x47')]({'where':{'id':_0x4a7d69[_0x51df('0x44')]['id']}})['then'](handleEntityNotFound(_0x424c39,null))[_0x51df('0x24')](saveUpdates(_0x4a7d69[_0x51df('0x4a')],null))[_0x51df('0x24')](respondWithResult(_0x424c39,null))['catch'](handleError(_0x424c39,null));};exports[_0x51df('0x25')]=function(_0x177dd0,_0xd7255a){return db['SmsApplication'][_0x51df('0x47')]({'where':{'id':_0x177dd0['params']['id']}})[_0x51df('0x24')](handleEntityNotFound(_0xd7255a,null))[_0x51df('0x24')](removeEntity(_0xd7255a,null))[_0x51df('0x48')](handleError(_0xd7255a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a116cae..cdfe7f5 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 _0xe54d=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','rimraf'];(function(_0x78029b,_0x19ce64){var _0x2c1b66=function(_0x3d1543){while(--_0x3d1543){_0x78029b['push'](_0x78029b['shift']());}};_0x2c1b66(++_0x19ce64);}(_0xe54d,0xbe));var _0xde54=function(_0x39fcf9,_0x26f83f){_0x39fcf9=_0x39fcf9-0x0;var _0x35fcce=_0xe54d[_0x39fcf9];return _0x35fcce;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var logger=require('../../config/logger')(_0xde54('0x2'));var moment=require('moment');var BPromise=require(_0xde54('0x3'));var rp=require(_0xde54('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde54('0x5'));var config=require(_0xde54('0x6'));var attributes=require(_0xde54('0x7'));module[_0xde54('0x8')]=function(_0x1bad1d,_0xc080cd){return _0x1bad1d[_0xde54('0x9')](_0xde54('0xa'),attributes,{'tableName':_0xde54('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde54('0xc'),'collate':_0xde54('0xd')});}; \ No newline at end of file +var _0x836d=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x3d1bdc,_0x5f0da5){var _0x36050f=function(_0x4058e0){while(--_0x4058e0){_0x3d1bdc['push'](_0x3d1bdc['shift']());}};_0x36050f(++_0x5f0da5);}(_0x836d,0x126));var _0xd836=function(_0x5e8531,_0x315eaf){_0x5e8531=_0x5e8531-0x0;var _0x304ae4=_0x836d[_0x5e8531];return _0x304ae4;};'use strict';var _=require(_0xd836('0x0'));var util=require(_0xd836('0x1'));var logger=require(_0xd836('0x2'))(_0xd836('0x3'));var moment=require(_0xd836('0x4'));var BPromise=require(_0xd836('0x5'));var rp=require(_0xd836('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd836('0x7'));var config=require(_0xd836('0x8'));var attributes=require(_0xd836('0x9'));module[_0xd836('0xa')]=function(_0x5aa18d,_0x5d7f6e){return _0x5aa18d[_0xd836('0xb')](_0xd836('0xc'),attributes,{'tableName':_0xd836('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd836('0xe'),'collate':_0xd836('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8a7ee0f..9e4336f 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 _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x18998b,_0x3a0248){var _0x50186d=function(_0x55faf9){while(--_0x55faf9){_0x18998b['push'](_0x18998b['shift']());}};_0x50186d(++_0x3a0248);}(_0xa3fe,0xd8));var _0xea3f=function(_0x3d3685,_0x1439db){_0x3d3685=_0x3d3685-0x0;var _0x1f8b0a=_0xa3fe[_0x3d3685];return _0x1f8b0a;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e494,_0x56abd6,_0x187ce0){return new BPromise(function(_0x35ba50,_0x3c4807){return client['request'](_0x49e494,_0x187ce0)['then'](function(_0x464ad4){logger['info']('SmsApplication,\x20%s,\x20%s',_0x56abd6,_0xea3f('0xa'));logger[_0xea3f('0xb')](_0xea3f('0xc'),_0x56abd6,'request\x20sent',JSON['stringify'](_0x464ad4));if(_0x464ad4['error']){if(_0x464ad4[_0xea3f('0xd')][_0xea3f('0xe')]===0x1f4){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x464ad4['error']['message']);return _0x3c4807(_0x464ad4['error'][_0xea3f('0x10')]);}logger[_0xea3f('0xd')]('SmsApplication,\x20%s,\x20%s',_0x56abd6,_0x464ad4[_0xea3f('0xd')][_0xea3f('0x10')]);return _0x35ba50(_0x464ad4['error'][_0xea3f('0x10')]);}else{logger[_0xea3f('0x11')](_0xea3f('0xf'),_0x56abd6,_0xea3f('0xa'));_0x35ba50(_0x464ad4[_0xea3f('0x12')][_0xea3f('0x10')]);}})[_0xea3f('0x13')](function(_0x2585f1){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x2585f1);_0x3c4807(_0x2585f1);});});} \ No newline at end of file +var _0x57ef=['SmsApplication,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0x558000,_0x4f25cd){var _0x345b63=function(_0x2465ea){while(--_0x2465ea){_0x558000['push'](_0x558000['shift']());}};_0x345b63(++_0x4f25cd);}(_0x57ef,0xdb));var _0xf57e=function(_0x46fb31,_0x35e74a){_0x46fb31=_0x46fb31-0x0;var _0x540e0a=_0x57ef[_0x46fb31];return _0x540e0a;};'use strict';var _=require('lodash');var util=require(_0xf57e('0x0'));var moment=require(_0xf57e('0x1'));var BPromise=require(_0xf57e('0x2'));var rs=require(_0xf57e('0x3'));var fs=require('fs');var Redis=require(_0xf57e('0x4'));var db=require(_0xf57e('0x5'))['db'];var utils=require(_0xf57e('0x6'));var logger=require('../../config/logger')(_0xf57e('0x7'));var config=require(_0xf57e('0x8'));var jayson=require(_0xf57e('0x9'));var client=jayson[_0xf57e('0xa')][_0xf57e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f47b5,_0x2498c5,_0x29ad0f){return new BPromise(function(_0x48031b,_0x2c69e6){return client[_0xf57e('0xc')](_0x2f47b5,_0x29ad0f)[_0xf57e('0xd')](function(_0x2430b1){logger[_0xf57e('0xe')]('SmsApplication,\x20%s,\x20%s',_0x2498c5,_0xf57e('0xf'));logger[_0xf57e('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2498c5,_0xf57e('0xf'),JSON[_0xf57e('0x11')](_0x2430b1));if(_0x2430b1[_0xf57e('0x12')]){if(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x13')]===0x1f4){logger[_0xf57e('0x12')]('SmsApplication,\x20%s,\x20%s',_0x2498c5,_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);return _0x2c69e6(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);}logger[_0xf57e('0x12')](_0xf57e('0x15'),_0x2498c5,_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);return _0x48031b(_0x2430b1[_0xf57e('0x12')][_0xf57e('0x14')]);}else{logger[_0xf57e('0xe')](_0xf57e('0x15'),_0x2498c5,_0xf57e('0xf'));_0x48031b(_0x2430b1[_0xf57e('0x16')][_0xf57e('0x14')]);}})[_0xf57e('0x17')](function(_0x464d53){logger[_0xf57e('0x12')](_0xf57e('0x15'),_0x2498c5,_0x464d53);_0x2c69e6(_0x464d53);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3b5f7da..6a088f9 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 _0xe5b5=['destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','tracked','smsinteraction:update','delete','smsinteraction:destroy'];(function(_0x20d2c8,_0x560bd7){var _0x4137de=function(_0x56b70f){while(--_0x56b70f){_0x20d2c8['push'](_0x20d2c8['shift']());}};_0x4137de(++_0x560bd7);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xe5b5[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/messages',auth[_0x5e5b('0xc')](),controller['getMessages']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e5b('0x14')](_0x5e5b('0x15'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x14')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),interaction['tracked'](_0x5e5b('0x18'),_0x5e5b('0x19')),controller['addTags']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5e5b('0x1b')](_0x5e5b('0x18'),_0x5e5b('0x1c')),controller['update']);router[_0x5e5b('0x1d')]('/:id',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x1b')]('sms',_0x5e5b('0x1e')),controller[_0x5e5b('0x1f')]);router[_0x5e5b('0x1d')]('/:id/tags',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x20')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f44258e..31f9b21 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 _0xc373=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','moment'];(function(_0x386a7c,_0x1aaa07){var _0x19ed87=function(_0x4fdc94){while(--_0x4fdc94){_0x386a7c['push'](_0x386a7c['shift']());}};_0x19ed87(++_0x1aaa07);}(_0xc373,0x1c7));var _0x3c37=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xc373[_0x2e819c];return _0x24e271;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c37('0x0'));module[_0x3c37('0x1')]={'closed':{'type':Sequelize[_0x3c37('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3c37('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3c37('0x3')]},'note':{'type':Sequelize[_0x3c37('0x3')]},'phone':{'type':Sequelize[_0x3c37('0x3')]},'read1stAt':{'type':Sequelize[_0x3c37('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3c37('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3c37('0x5')]('in',_0x3c37('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3c37('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3c37('0x7')]}}; \ No newline at end of file +var _0xdab3=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0xdab3,0xeb));var _0x3dab=function(_0x3c8eb1,_0x391be0){_0x3c8eb1=_0x3c8eb1-0x0;var _0x82dabb=_0xdab3[_0x3c8eb1];return _0x82dabb;};'use strict';var Sequelize=require(_0x3dab('0x0'));var moment=require(_0x3dab('0x1'));module['exports']={'closed':{'type':Sequelize[_0x3dab('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3dab('0x3')]},'disposition':{'type':Sequelize[_0x3dab('0x4')]},'secondDisposition':{'type':Sequelize[_0x3dab('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3dab('0x4')]},'note':{'type':Sequelize[_0x3dab('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3dab('0x5')]('in',_0x3dab('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3dab('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3dab('0x5')]('in',_0x3dab('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3dab('0x2')],'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 926a4ed..cce0ff6 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 _0xa65a=['Contact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','out','System','value','server','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','util','path','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','index','map','rawAttributes','type','getOptions','sms','query','user','catch','show','params','model','keys','SmsInteraction','filters','attributes','intersection','fields','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','includeAll','findAll','addTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','join','root','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact'];(function(_0x38fe37,_0x55dff6){var _0x22dbe9=function(_0x36d9bb){while(--_0x36d9bb){_0x38fe37['push'](_0x38fe37['shift']());}};_0x22dbe9(++_0x55dff6);}(_0xa65a,0x176));var _0xaa65=function(_0xfc1114,_0x5c3aae){_0xfc1114=_0xfc1114-0x0;var _0x34183b=_0xa65a[_0xfc1114];return _0x34183b;};'use strict';var rimraf=require(_0xaa65('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xaa65('0x1'));var path=require(_0xaa65('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xaa65('0x3'));var interaction=require('../../components/interaction/service');var qs=require(_0xaa65('0x4'));var pdf=require(_0xaa65('0x5'));var logger=require(_0xaa65('0x6'))(_0xaa65('0x7'));var config=require(_0xaa65('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaa65('0x9')](config['redis'],{'host':_0xaa65('0xa'),'port':0x18eb});var socket=require(_0xaa65('0xb'))(new Redis(config[_0xaa65('0xc')]));require(_0xaa65('0xd'))[_0xaa65('0xe')](socket);function respondWithStatusCode(_0x187742,_0x45d264){_0x45d264=_0x45d264||0xcc;return function(_0x560ab7){if(_0x560ab7){return _0x187742[_0xaa65('0xf')](_0x45d264);}return _0x187742[_0xaa65('0x10')](_0x45d264)['end']();};}function respondWithResult(_0x54234d,_0x22bd35){_0x22bd35=_0x22bd35||0xc8;return function(_0x4fa736){if(_0x4fa736){return _0x54234d[_0xaa65('0x10')](_0x22bd35)[_0xaa65('0x11')](_0x4fa736);}};}function respondWithFilteredResult(_0xb82770,_0x58086b){return function(_0x4be9b5){if(_0x4be9b5){var _0xe49e54=typeof _0x58086b[_0xaa65('0x12')]===_0xaa65('0x13')&&typeof _0x58086b[_0xaa65('0x14')]==='undefined';var _0x3ca5e9=_0x4be9b5[_0xaa65('0x15')];var _0x478ff3=_0xe49e54?0x0:_0x58086b[_0xaa65('0x12')];var _0x908c58=_0xe49e54?_0x4be9b5[_0xaa65('0x15')]:_0x58086b[_0xaa65('0x12')]+_0x58086b[_0xaa65('0x14')];var _0x58d4d6;if(_0x908c58>=_0x3ca5e9){_0x908c58=_0x3ca5e9;_0x58d4d6=0xc8;}else{_0x58d4d6=0xce;}_0xb82770[_0xaa65('0x10')](_0x58d4d6);return _0xb82770[_0xaa65('0x16')](_0xaa65('0x17'),_0x478ff3+'-'+_0x908c58+'/'+_0x3ca5e9)[_0xaa65('0x11')](_0x4be9b5);}return null;};}function saveUpdates(_0x2bce70){return function(_0x2029eb){if(_0x2029eb){return _0x2029eb[_0xaa65('0x18')](_0x2bce70)[_0xaa65('0x19')](function(_0x2a0651){return _0x2a0651;});}return null;};}function removeEntity(_0x851f42){return function(_0x17ba66){if(_0x17ba66){return _0x17ba66['destroy']()[_0xaa65('0x19')](function(){_0x851f42['status'](0xcc)[_0xaa65('0x1a')]();});}};}function handleEntityNotFound(_0x196c79){return function(_0x16b66b){if(!_0x16b66b){_0x196c79['sendStatus'](0x194);}return _0x16b66b;};}function handleError(_0x76f213,_0x584695){_0x584695=_0x584695||0x1f4;return function(_0x5d4eb2){logger[_0xaa65('0x1b')](_0x5d4eb2[_0xaa65('0x1c')]);if(_0x5d4eb2['name']){delete _0x5d4eb2[_0xaa65('0x1d')];}_0x76f213['status'](_0x584695)['send'](_0x5d4eb2);};}exports[_0xaa65('0x1e')]=function(_0x12b205,_0x40d799){var _0x19cace={};var _0xbcf2ab=_[_0xaa65('0x1f')](db['SmsInteraction'][_0xaa65('0x20')],function(_0x3e9232){return{'name':_0x3e9232['fieldName'],'type':_0x3e9232[_0xaa65('0x21')]['key']};});_0x19cace=qs[_0xaa65('0x22')](_0xbcf2ab,_0x12b205);return interaction['findAll'](_0xaa65('0x23'),_0x12b205[_0xaa65('0x24')],_0x12b205[_0xaa65('0x25')],_0x19cace,_0xbcf2ab)['then'](respondWithFilteredResult(_0x40d799,_0x19cace))[_0xaa65('0x26')](handleError(_0x40d799,null));};exports[_0xaa65('0x27')]=function(_0x5257e4,_0x399231){var _0x35b359={'raw':![],'where':{'id':_0x5257e4[_0xaa65('0x28')]['id']}},_0x2bf870={};_0x2bf870[_0xaa65('0x29')]=_[_0xaa65('0x2a')](db[_0xaa65('0x2b')]['rawAttributes']);_0x2bf870['query']=_[_0xaa65('0x2a')](_0x5257e4[_0xaa65('0x24')]);_0x2bf870[_0xaa65('0x2c')]=_['intersection'](_0x2bf870[_0xaa65('0x29')],_0x2bf870[_0xaa65('0x24')]);_0x35b359[_0xaa65('0x2d')]=_[_0xaa65('0x2e')](_0x2bf870[_0xaa65('0x29')],qs[_0xaa65('0x2f')](_0x5257e4['query'][_0xaa65('0x2f')]));_0x35b359[_0xaa65('0x2d')]=_0x35b359[_0xaa65('0x2d')]['length']?_0x35b359['attributes']:_0x2bf870[_0xaa65('0x29')];if(_0x5257e4[_0xaa65('0x24')]['includeAll']){_0x35b359[_0xaa65('0x30')]=[{'all':!![]}];}_0x35b359=_[_0xaa65('0x31')]({},_0x35b359,_0x5257e4[_0xaa65('0x32')]);return db[_0xaa65('0x2b')][_0xaa65('0x33')](_0x35b359)[_0xaa65('0x19')](handleEntityNotFound(_0x399231,null))[_0xaa65('0x19')](respondWithResult(_0x399231,null))[_0xaa65('0x26')](handleError(_0x399231,null));};exports[_0xaa65('0x34')]=function(_0x56dd8a,_0x4e97ce){return db[_0xaa65('0x2b')]['create'](_0x56dd8a[_0xaa65('0x35')],{})[_0xaa65('0x19')](respondWithResult(_0x4e97ce,0xc9))[_0xaa65('0x26')](handleError(_0x4e97ce,null));};exports[_0xaa65('0x18')]=function(_0x3b6967,_0x4eb563){if(_0x3b6967[_0xaa65('0x35')]['id']){delete _0x3b6967[_0xaa65('0x35')]['id'];}return db[_0xaa65('0x2b')][_0xaa65('0x33')]({'where':{'id':_0x3b6967[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x4eb563,null))[_0xaa65('0x19')](saveUpdates(_0x3b6967[_0xaa65('0x35')],null))[_0xaa65('0x19')](respondWithResult(_0x4eb563,null))[_0xaa65('0x26')](handleError(_0x4eb563,null));};exports['destroy']=function(_0x240d52,_0x24e571){return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x240d52[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x24e571,null))[_0xaa65('0x19')](removeEntity(_0x24e571,null))['catch'](handleError(_0x24e571,null));};exports[_0xaa65('0x36')]=function(_0x507a7b,_0x3d9075){return db[_0xaa65('0x2b')]['describe']()[_0xaa65('0x19')](respondWithResult(_0x3d9075,null))[_0xaa65('0x26')](handleError(_0x3d9075,null));};exports[_0xaa65('0x37')]=function(_0x27e2c9,_0x428c1e){return db[_0xaa65('0x38')]['find']({'where':{'id':_0x27e2c9[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x428c1e,null))[_0xaa65('0x19')](function(_0x50407e){if(_0x50407e){return _0x50407e[_0xaa65('0x37')](_0x27e2c9['body'][_0xaa65('0x39')],_['omit'](_0x27e2c9[_0xaa65('0x35')],[_0xaa65('0x39'),'id'])||{});}})[_0xaa65('0x19')](respondWithResult(_0x428c1e,null))[_0xaa65('0x26')](handleError(_0x428c1e,null));};exports[_0xaa65('0x3a')]=function(_0x51ca6f,_0x32f6a4){var _0x24f40e={'raw':![],'where':{}};var _0x13eb75={};var _0x57028a={'count':0x0,'rows':[]};return db[_0xaa65('0x2b')][_0xaa65('0x3b')]({'where':{'id':_0x51ca6f[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x32f6a4,null))['then'](function(_0x3e0731){if(_0x3e0731){_0x13eb75[_0xaa65('0x29')]=_[_0xaa65('0x2a')](db['SmsMessage']['rawAttributes']);_0x13eb75['query']=_[_0xaa65('0x2a')](_0x51ca6f['query']);_0x13eb75[_0xaa65('0x2c')]=_['intersection'](_0x13eb75[_0xaa65('0x29')],_0x13eb75[_0xaa65('0x24')]);_0x24f40e['attributes']=_['intersection'](_0x13eb75[_0xaa65('0x29')],qs['fields'](_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x2f')]));_0x24f40e[_0xaa65('0x2d')]=_0x24f40e['attributes'][_0xaa65('0x3c')]?_0x24f40e['attributes']:_0x13eb75[_0xaa65('0x29')];if(!_0x51ca6f['query'][_0xaa65('0x3d')](_0xaa65('0x3e'))){_0x24f40e[_0xaa65('0x14')]=qs[_0xaa65('0x14')](_0x51ca6f['query'][_0xaa65('0x14')]);_0x24f40e[_0xaa65('0x12')]=qs['offset'](_0x51ca6f['query'][_0xaa65('0x12')]);}_0x24f40e[_0xaa65('0x3f')]=qs[_0xaa65('0x40')](_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x40')]);_0x24f40e[_0xaa65('0x41')]=qs[_0xaa65('0x2c')](_['pick'](_0x51ca6f[_0xaa65('0x24')],_0x13eb75[_0xaa65('0x2c')]));_0x24f40e[_0xaa65('0x41')]['SmsInteractionId']=_0x3e0731['id'];if(_0x51ca6f['query'][_0xaa65('0x42')]){_0x24f40e[_0xaa65('0x41')]=_[_0xaa65('0x31')](_0x24f40e[_0xaa65('0x41')],{'$or':_[_0xaa65('0x1f')](_0x24f40e[_0xaa65('0x2d')],function(_0x388294){var _0x16e61e={};_0x16e61e[_0x388294]={'$like':'%'+_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x42')]+'%'};return _0x16e61e;})});}if(_0x51ca6f['query'][_0xaa65('0x43')]){var _0x2fb896=_0x51ca6f[_0xaa65('0x24')][_0xaa65('0x43')][_0xaa65('0x44')](',');var _0x3fa93f={};_0x3fa93f[_0x2fb896[0x0]]={'$gte':moment(_0x2fb896[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24f40e[_0xaa65('0x41')]=_[_0xaa65('0x31')](_0x24f40e[_0xaa65('0x41')],_0x3fa93f);}_0x24f40e=_[_0xaa65('0x31')]({},_0x24f40e,_0x51ca6f[_0xaa65('0x32')]);return db[_0xaa65('0x38')]['count']({'where':_0x24f40e[_0xaa65('0x41')]})[_0xaa65('0x19')](function(_0x352f72){_0x57028a[_0xaa65('0x15')]=_0x352f72;if(_0x51ca6f['query'][_0xaa65('0x45')]){_0x24f40e[_0xaa65('0x30')]=[{'all':!![]}];}return db[_0xaa65('0x38')][_0xaa65('0x46')](_0x24f40e);})['then'](function(_0x57b25e){_0x57028a['rows']=_0x57b25e;return _0x57028a;});}})[_0xaa65('0x19')](respondWithFilteredResult(_0x32f6a4,_0x24f40e))[_0xaa65('0x26')](handleError(_0x32f6a4,null));};exports[_0xaa65('0x47')]=function(_0x289dd1,_0x2a7b1b){return db[_0xaa65('0x2b')][_0xaa65('0x33')]({'where':{'id':_0x289dd1[_0xaa65('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a7b1b,null))[_0xaa65('0x19')](function(_0x2db3f1){if(_0x2db3f1){return _0x2db3f1['setTags'](_0x289dd1[_0xaa65('0x35')][_0xaa65('0x39')],_[_0xaa65('0x48')](_0x289dd1[_0xaa65('0x35')],[_0xaa65('0x39'),'id'])||{})[_0xaa65('0x49')](function(){return db[_0xaa65('0x4a')][_0xaa65('0x46')]({'attributes':['id',_0xaa65('0x1d'),_0xaa65('0x4b')],'where':{'id':_0x289dd1['body'][_0xaa65('0x39')]}});})[_0xaa65('0x19')](function(_0x2b7def){socket[_0xaa65('0x4c')](_0xaa65('0x4d'),{'id':Number(_0x289dd1[_0xaa65('0x28')]['id']),'tags':_0x2b7def||[]});return{'id':Number(_0x289dd1[_0xaa65('0x28')]['id']),'tags':_0x2b7def||[]};});}})[_0xaa65('0x19')](respondWithResult(_0x2a7b1b,null))['catch'](handleError(_0x2a7b1b,null));};exports[_0xaa65('0x4e')]=function(_0x484c5f,_0x1a0574){return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x484c5f[_0xaa65('0x28')]['id']}})[_0xaa65('0x19')](handleEntityNotFound(_0x1a0574,null))['then'](function(_0x1953a2){if(_0x1953a2){return _0x1953a2['removeTags'](_0x484c5f[_0xaa65('0x24')]['ids']);}})['then'](respondWithStatusCode(_0x1a0574,null))[_0xaa65('0x26')](handleError(_0x1a0574,null));};exports[_0xaa65('0x4f')]=function(_0x3ad417,_0x380845){var _0x2e526d=moment()['unix']()['toString']();var _0xf80879=path[_0xaa65('0x50')](config[_0xaa65('0x51')],'server',_0xaa65('0x52'),_0xaa65('0x53'));var _0x40e92c=path[_0xaa65('0x50')](_0xf80879,_0x2e526d);var _0x26ec46=util[_0xaa65('0x54')](_0xaa65('0x55'),_0x3ad417['params']['id'],_0x2e526d);var _0x49b446=path[_0xaa65('0x50')](_0xf80879,_0x26ec46);var _0x1b20d3=[];_0x1b20d3[_0xaa65('0x56')]({'model':db['User'],'as':_0xaa65('0x57'),'attributes':['id',_0xaa65('0x58')],'raw':!![]});_0x1b20d3[_0xaa65('0x56')]({'model':db[_0xaa65('0x59')],'as':_0xaa65('0x5a'),'attributes':['id','firstName',_0xaa65('0x5b')],'raw':!![]});var _0x3f5009=[{'model':db['SmsMessage'],'as':_0xaa65('0x5c'),'attributes':['id',_0xaa65('0x35'),_0xaa65('0x5d'),_0xaa65('0x5e'),_0xaa65('0x5f'),_0xaa65('0x60')],'include':_0x1b20d3}];_0x3f5009[_0xaa65('0x56')]({'model':db[_0xaa65('0x61')],'as':_0xaa65('0x62'),'attributes':['id',_0xaa65('0x1d')]});_0x3f5009['push']({'model':db[_0xaa65('0x57')],'as':_0xaa65('0x63'),'attributes':['id',_0xaa65('0x58')]});return db['SmsInteraction'][_0xaa65('0x33')]({'where':{'id':_0x3ad417['params']['id']},'include':_0x3f5009})[_0xaa65('0x19')](handleEntityNotFound(_0x380845,null))[_0xaa65('0x19')](function(_0x33e69e){if(_0x33e69e){var _0x975a95=_0x33e69e['get']({'plain':!![]});fs[_0xaa65('0x64')](_0x40e92c);var _0x409176={'channel':'Sms','account':_0x975a95[_0xaa65('0x62')][_0xaa65('0x1d')],'agent':_0x975a95['Owner']?_0x975a95['Owner'][_0xaa65('0x58')]:_0xaa65('0x65'),'createdAt':moment(_0x975a95[_0xaa65('0x5d')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x975a95[_0xaa65('0x66')]?moment(_0x975a95[_0xaa65('0x67')])[_0xaa65('0x54')](_0xaa65('0x68'))[_0xaa65('0x69')]():'','disposition':_0x975a95['disposition'],'messages':_(_0x975a95[_0xaa65('0x5c')])[_0xaa65('0x42')]({'secret':![]})[_0xaa65('0x1f')](function(_0x1ade1f){return{'date':moment(_0x1ade1f[_0xaa65('0x5d')])[_0xaa65('0x54')](_0xaa65('0x68'))[_0xaa65('0x69')](),'sender':_0x1ade1f['direction']===_0xaa65('0x6a')?_0x1ade1f[_0xaa65('0x57')]?_0x1ade1f['User'][_0xaa65('0x58')]:_0xaa65('0x6b'):_0x1ade1f['Contact']['firstName']+(_0x1ade1f[_0xaa65('0x5a')]['lastName']?'\x20'+_0x1ade1f[_0xaa65('0x5a')][_0xaa65('0x5b')]:''),'body':_0x1ade1f[_0xaa65('0x35')],'direction':_0x1ade1f[_0xaa65('0x5e')]===_0xaa65('0x6a')?'A':'C','secret':_0x1ade1f[_0xaa65('0x5f')],'read':_0x1ade1f[_0xaa65('0x60')]};})[_0xaa65('0x6c')]()};return ejs['renderFile'](path[_0xaa65('0x50')](config[_0xaa65('0x51')],_0xaa65('0x6d'),'views',_0xaa65('0x6e')),{'interaction':_0x409176})['then'](function(_0x40f3fb){var _0x6f3dc7=path['join'](_0x40e92c,'transcript-'+_0x975a95['id']+'-'+_0x2e526d+_0xaa65('0x6f'));var _0x5a39c9={'path':_0x6f3dc7,'channel':'Sms','interactionId':_0x975a95['id']};return pdf[_0xaa65('0x70')](_0x40f3fb,_0x5a39c9);})['then'](function(){return new BPromise(function(_0x345ef5,_0x5d359c){zipdir(_0x40e92c,{'saveTo':_0x49b446},function(_0x1127e5,_0xf819d7){if(_0x1127e5)return _0x5d359c(_0x1127e5);return _0x345ef5(_0xf819d7);});})[_0xaa65('0x19')](function(){return new BPromise(function(_0x1c3918,_0x2035a4){rimraf(_0x40e92c,function(_0x3c971e){if(_0x3c971e)_0x2035a4(_0x3c971e);return _0x1c3918();});});})[_0xaa65('0x19')](function(){return _0x380845[_0xaa65('0x4f')](_0x49b446,_0x26ec46,function(_0x592dcb){if(_0x592dcb){console[_0xaa65('0x71')](_0xaa65('0x72'),_0x592dcb);}else{fs[_0xaa65('0x73')](_0x49b446);}});});});}else{return _0x380845[_0xaa65('0xf')](0xc8);}})[_0xaa65('0x26')](handleError(_0x380845,null));}; \ No newline at end of file +var _0x86c7=['color','emit','removeTags','download','unix','toString','join','root','files','push','User','fullname','CmContact','Contact','firstName','Messages','createdAt','direction','read','SmsAccount','Owner','get','mkdirSync','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','System','out','secret','server','views','downloadInteraction.ejs','transcript-','.pdf','Sms','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','error','name','map','SmsInteraction','rawAttributes','fieldName','type','findAll','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','format','addTags','setTags','spread','Tag'];(function(_0x2c3f00,_0x3f9a01){var _0x1143f5=function(_0x1973e1){while(--_0x1973e1){_0x2c3f00['push'](_0x2c3f00['shift']());}};_0x1143f5(++_0x3f9a01);}(_0x86c7,0x182));var _0x786c=function(_0x4f2066,_0x3da1ba){_0x4f2066=_0x4f2066-0x0;var _0x5121c4=_0x86c7[_0x4f2066];return _0x5121c4;};'use strict';var rimraf=require(_0x786c('0x0'));var zipdir=require(_0x786c('0x1'));var moment=require(_0x786c('0x2'));var BPromise=require('bluebird');var util=require(_0x786c('0x3'));var path=require(_0x786c('0x4'));var ejs=require(_0x786c('0x5'));var fs=require('fs');var _=require(_0x786c('0x6'));var Redis=require('ioredis');var interaction=require(_0x786c('0x7'));var qs=require(_0x786c('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0x786c('0x9'))('api');var config=require(_0x786c('0xa'));var db=require(_0x786c('0xb'))['db'];config[_0x786c('0xc')]=_[_0x786c('0xd')](config['redis'],{'host':_0x786c('0xe'),'port':0x18eb});var socket=require(_0x786c('0xf'))(new Redis(config[_0x786c('0xc')]));require('./smsInteraction.socket')[_0x786c('0x10')](socket);function respondWithStatusCode(_0x4ac120,_0x35f5fb){_0x35f5fb=_0x35f5fb||0xcc;return function(_0x58c2e1){if(_0x58c2e1){return _0x4ac120[_0x786c('0x11')](_0x35f5fb);}return _0x4ac120[_0x786c('0x12')](_0x35f5fb)[_0x786c('0x13')]();};}function respondWithResult(_0x217729,_0x568221){_0x568221=_0x568221||0xc8;return function(_0x1c441b){if(_0x1c441b){return _0x217729['status'](_0x568221)[_0x786c('0x14')](_0x1c441b);}};}function respondWithFilteredResult(_0x421b1f,_0x186fe1){return function(_0x2e35b2){if(_0x2e35b2){var _0x2f8114=typeof _0x186fe1['offset']===_0x786c('0x15')&&typeof _0x186fe1[_0x786c('0x16')]==='undefined';var _0x1b4f6e=_0x2e35b2[_0x786c('0x17')];var _0x418520=_0x2f8114?0x0:_0x186fe1[_0x786c('0x18')];var _0x1bbb93=_0x2f8114?_0x2e35b2[_0x786c('0x17')]:_0x186fe1[_0x786c('0x18')]+_0x186fe1['limit'];var _0x254207;if(_0x1bbb93>=_0x1b4f6e){_0x1bbb93=_0x1b4f6e;_0x254207=0xc8;}else{_0x254207=0xce;}_0x421b1f['status'](_0x254207);return _0x421b1f[_0x786c('0x19')](_0x786c('0x1a'),_0x418520+'-'+_0x1bbb93+'/'+_0x1b4f6e)[_0x786c('0x14')](_0x2e35b2);}return null;};}function saveUpdates(_0x163751){return function(_0x24b548){if(_0x24b548){return _0x24b548['update'](_0x163751)[_0x786c('0x1b')](function(_0x4d9dbd){return _0x4d9dbd;});}return null;};}function removeEntity(_0x4cb1ea){return function(_0x31d7a6){if(_0x31d7a6){return _0x31d7a6[_0x786c('0x1c')]()[_0x786c('0x1b')](function(){_0x4cb1ea[_0x786c('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5904d8){return function(_0x77a6f2){if(!_0x77a6f2){_0x5904d8[_0x786c('0x11')](0x194);}return _0x77a6f2;};}function handleError(_0x31468d,_0x5e1c9b){_0x5e1c9b=_0x5e1c9b||0x1f4;return function(_0x45b276){logger[_0x786c('0x1d')](_0x45b276['stack']);if(_0x45b276[_0x786c('0x1e')]){delete _0x45b276[_0x786c('0x1e')];}_0x31468d[_0x786c('0x12')](_0x5e1c9b)['send'](_0x45b276);};}exports['index']=function(_0x5b1539,_0x46f05f){var _0x409fa7={};var _0x303a43=_[_0x786c('0x1f')](db[_0x786c('0x20')][_0x786c('0x21')],function(_0x2db8f6){return{'name':_0x2db8f6[_0x786c('0x22')],'type':_0x2db8f6[_0x786c('0x23')]['key']};});_0x409fa7=qs['getOptions'](_0x303a43,_0x5b1539);return interaction[_0x786c('0x24')]('sms',_0x5b1539[_0x786c('0x25')],_0x5b1539[_0x786c('0x26')],_0x409fa7,_0x303a43)[_0x786c('0x1b')](respondWithFilteredResult(_0x46f05f,_0x409fa7))[_0x786c('0x27')](handleError(_0x46f05f,null));};exports[_0x786c('0x28')]=function(_0x552b3f,_0x2fd41d){var _0x2ad54a={'raw':![],'where':{'id':_0x552b3f[_0x786c('0x29')]['id']}},_0x490570={};_0x490570[_0x786c('0x2a')]=_[_0x786c('0x2b')](db['SmsInteraction'][_0x786c('0x21')]);_0x490570[_0x786c('0x25')]=_[_0x786c('0x2b')](_0x552b3f[_0x786c('0x25')]);_0x490570[_0x786c('0x2c')]=_[_0x786c('0x2d')](_0x490570[_0x786c('0x2a')],_0x490570[_0x786c('0x25')]);_0x2ad54a[_0x786c('0x2e')]=_[_0x786c('0x2d')](_0x490570['model'],qs[_0x786c('0x2f')](_0x552b3f['query'][_0x786c('0x2f')]));_0x2ad54a[_0x786c('0x2e')]=_0x2ad54a[_0x786c('0x2e')][_0x786c('0x30')]?_0x2ad54a['attributes']:_0x490570[_0x786c('0x2a')];if(_0x552b3f[_0x786c('0x25')][_0x786c('0x31')]){_0x2ad54a[_0x786c('0x32')]=[{'all':!![]}];}_0x2ad54a=_[_0x786c('0x33')]({},_0x2ad54a,_0x552b3f[_0x786c('0x34')]);return db[_0x786c('0x20')][_0x786c('0x35')](_0x2ad54a)[_0x786c('0x1b')](handleEntityNotFound(_0x2fd41d,null))[_0x786c('0x1b')](respondWithResult(_0x2fd41d,null))[_0x786c('0x27')](handleError(_0x2fd41d,null));};exports[_0x786c('0x36')]=function(_0x179a8c,_0x18836e){return db[_0x786c('0x20')][_0x786c('0x36')](_0x179a8c[_0x786c('0x37')],{})['then'](respondWithResult(_0x18836e,0xc9))[_0x786c('0x27')](handleError(_0x18836e,null));};exports[_0x786c('0x38')]=function(_0x4e1f30,_0x1655ca){if(_0x4e1f30[_0x786c('0x37')]['id']){delete _0x4e1f30['body']['id'];}return db[_0x786c('0x20')][_0x786c('0x35')]({'where':{'id':_0x4e1f30[_0x786c('0x29')]['id']}})['then'](handleEntityNotFound(_0x1655ca,null))[_0x786c('0x1b')](saveUpdates(_0x4e1f30['body'],null))[_0x786c('0x1b')](respondWithResult(_0x1655ca,null))[_0x786c('0x27')](handleError(_0x1655ca,null));};exports[_0x786c('0x1c')]=function(_0x462483,_0x5e4011){return db[_0x786c('0x20')][_0x786c('0x35')]({'where':{'id':_0x462483[_0x786c('0x29')]['id']}})[_0x786c('0x1b')](handleEntityNotFound(_0x5e4011,null))[_0x786c('0x1b')](removeEntity(_0x5e4011,null))[_0x786c('0x27')](handleError(_0x5e4011,null));};exports[_0x786c('0x39')]=function(_0x204103,_0x19a30b){return db['SmsInteraction'][_0x786c('0x39')]()['then'](respondWithResult(_0x19a30b,null))[_0x786c('0x27')](handleError(_0x19a30b,null));};exports['addMessage']=function(_0x5891ae,_0x253b59){return db[_0x786c('0x3a')]['find']({'where':{'id':_0x5891ae[_0x786c('0x29')]['id']}})[_0x786c('0x1b')](handleEntityNotFound(_0x253b59,null))['then'](function(_0x408ff8){if(_0x408ff8){return _0x408ff8['addMessage'](_0x5891ae[_0x786c('0x37')][_0x786c('0x3b')],_[_0x786c('0x3c')](_0x5891ae[_0x786c('0x37')],[_0x786c('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x253b59,null))['catch'](handleError(_0x253b59,null));};exports[_0x786c('0x3d')]=function(_0x3b6065,_0x38c3cc){var _0x5bc7e3={'raw':![],'where':{}};var _0x255a85={};var _0x4ac734={'count':0x0,'rows':[]};return db[_0x786c('0x20')][_0x786c('0x3e')]({'where':{'id':_0x3b6065[_0x786c('0x29')]['id']}})['then'](handleEntityNotFound(_0x38c3cc,null))[_0x786c('0x1b')](function(_0x43ff4b){if(_0x43ff4b){_0x255a85[_0x786c('0x2a')]=_[_0x786c('0x2b')](db[_0x786c('0x3a')][_0x786c('0x21')]);_0x255a85[_0x786c('0x25')]=_[_0x786c('0x2b')](_0x3b6065[_0x786c('0x25')]);_0x255a85[_0x786c('0x2c')]=_[_0x786c('0x2d')](_0x255a85[_0x786c('0x2a')],_0x255a85[_0x786c('0x25')]);_0x5bc7e3[_0x786c('0x2e')]=_[_0x786c('0x2d')](_0x255a85['model'],qs['fields'](_0x3b6065[_0x786c('0x25')][_0x786c('0x2f')]));_0x5bc7e3['attributes']=_0x5bc7e3['attributes']['length']?_0x5bc7e3[_0x786c('0x2e')]:_0x255a85[_0x786c('0x2a')];if(!_0x3b6065[_0x786c('0x25')][_0x786c('0x3f')](_0x786c('0x40'))){_0x5bc7e3[_0x786c('0x16')]=qs[_0x786c('0x16')](_0x3b6065['query'][_0x786c('0x16')]);_0x5bc7e3[_0x786c('0x18')]=qs['offset'](_0x3b6065[_0x786c('0x25')][_0x786c('0x18')]);}_0x5bc7e3[_0x786c('0x41')]=qs[_0x786c('0x42')](_0x3b6065[_0x786c('0x25')]['sort']);_0x5bc7e3['where']=qs['filters'](_[_0x786c('0x43')](_0x3b6065[_0x786c('0x25')],_0x255a85[_0x786c('0x2c')]));_0x5bc7e3[_0x786c('0x44')][_0x786c('0x45')]=_0x43ff4b['id'];if(_0x3b6065[_0x786c('0x25')][_0x786c('0x46')]){_0x5bc7e3[_0x786c('0x44')]=_['merge'](_0x5bc7e3[_0x786c('0x44')],{'$or':_[_0x786c('0x1f')](_0x5bc7e3['attributes'],function(_0x2a32b6){var _0x459599={};_0x459599[_0x2a32b6]={'$like':'%'+_0x3b6065[_0x786c('0x25')][_0x786c('0x46')]+'%'};return _0x459599;})});}if(_0x3b6065['query'][_0x786c('0x47')]){var _0x16a452=_0x3b6065[_0x786c('0x25')][_0x786c('0x47')][_0x786c('0x48')](',');var _0x1defe7={};_0x1defe7[_0x16a452[0x0]]={'$gte':moment(_0x16a452[0x1])[_0x786c('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5bc7e3['where']=_['merge'](_0x5bc7e3[_0x786c('0x44')],_0x1defe7);}_0x5bc7e3=_[_0x786c('0x33')]({},_0x5bc7e3,_0x3b6065['options']);return db['SmsMessage'][_0x786c('0x17')]({'where':_0x5bc7e3[_0x786c('0x44')]})['then'](function(_0x157b8b){_0x4ac734['count']=_0x157b8b;if(_0x3b6065['query'][_0x786c('0x31')]){_0x5bc7e3[_0x786c('0x32')]=[{'all':!![]}];}return db[_0x786c('0x3a')]['findAll'](_0x5bc7e3);})['then'](function(_0x193b47){_0x4ac734['rows']=_0x193b47;return _0x4ac734;});}})[_0x786c('0x1b')](respondWithFilteredResult(_0x38c3cc,_0x5bc7e3))[_0x786c('0x27')](handleError(_0x38c3cc,null));};exports[_0x786c('0x4a')]=function(_0x36ed5d,_0x794d3f){return db[_0x786c('0x20')][_0x786c('0x35')]({'where':{'id':_0x36ed5d[_0x786c('0x29')]['id']}})[_0x786c('0x1b')](handleEntityNotFound(_0x794d3f,null))[_0x786c('0x1b')](function(_0x53b126){if(_0x53b126){return _0x53b126[_0x786c('0x4b')](_0x36ed5d[_0x786c('0x37')][_0x786c('0x3b')],_[_0x786c('0x3c')](_0x36ed5d[_0x786c('0x37')],['ids','id'])||{})[_0x786c('0x4c')](function(){return db[_0x786c('0x4d')]['findAll']({'attributes':['id',_0x786c('0x1e'),_0x786c('0x4e')],'where':{'id':_0x36ed5d[_0x786c('0x37')][_0x786c('0x3b')]}});})[_0x786c('0x1b')](function(_0x3af750){socket[_0x786c('0x4f')]('smsInteractionTags:save',{'id':Number(_0x36ed5d[_0x786c('0x29')]['id']),'tags':_0x3af750||[]});return{'id':Number(_0x36ed5d[_0x786c('0x29')]['id']),'tags':_0x3af750||[]};});}})[_0x786c('0x1b')](respondWithResult(_0x794d3f,null))[_0x786c('0x27')](handleError(_0x794d3f,null));};exports[_0x786c('0x50')]=function(_0x8b6411,_0x59ca95){return db['SmsInteraction'][_0x786c('0x35')]({'where':{'id':_0x8b6411[_0x786c('0x29')]['id']}})[_0x786c('0x1b')](handleEntityNotFound(_0x59ca95,null))['then'](function(_0x2c7d40){if(_0x2c7d40){return _0x2c7d40['removeTags'](_0x8b6411[_0x786c('0x25')][_0x786c('0x3b')]);}})[_0x786c('0x1b')](respondWithStatusCode(_0x59ca95,null))['catch'](handleError(_0x59ca95,null));};exports[_0x786c('0x51')]=function(_0x47dfe5,_0x4224c4){var _0x444abf=moment()[_0x786c('0x52')]()[_0x786c('0x53')]();var _0x435a8e=path[_0x786c('0x54')](config[_0x786c('0x55')],'server',_0x786c('0x56'),'tmp');var _0x29c066=path['join'](_0x435a8e,_0x444abf);var _0x5b109b=util[_0x786c('0x49')]('transcript-%d-%s.zip',_0x47dfe5['params']['id'],_0x444abf);var _0x598084=path[_0x786c('0x54')](_0x435a8e,_0x5b109b);var _0x38cb26=[];_0x38cb26[_0x786c('0x57')]({'model':db[_0x786c('0x58')],'as':_0x786c('0x58'),'attributes':['id',_0x786c('0x59')],'raw':!![]});_0x38cb26[_0x786c('0x57')]({'model':db[_0x786c('0x5a')],'as':_0x786c('0x5b'),'attributes':['id',_0x786c('0x5c'),'lastName'],'raw':!![]});var _0x108495=[{'model':db[_0x786c('0x3a')],'as':_0x786c('0x5d'),'attributes':['id',_0x786c('0x37'),_0x786c('0x5e'),_0x786c('0x5f'),'secret',_0x786c('0x60')],'include':_0x38cb26}];_0x108495[_0x786c('0x57')]({'model':db[_0x786c('0x61')],'as':'Account','attributes':['id','name']});_0x108495[_0x786c('0x57')]({'model':db[_0x786c('0x58')],'as':_0x786c('0x62'),'attributes':['id',_0x786c('0x59')]});return db['SmsInteraction'][_0x786c('0x35')]({'where':{'id':_0x47dfe5['params']['id']},'include':_0x108495})['then'](handleEntityNotFound(_0x4224c4,null))[_0x786c('0x1b')](function(_0x4cb09c){if(_0x4cb09c){var _0x4eb519=_0x4cb09c[_0x786c('0x63')]({'plain':!![]});fs[_0x786c('0x64')](_0x29c066);var _0x5829e4={'channel':'Sms','account':_0x4eb519[_0x786c('0x65')][_0x786c('0x1e')],'agent':_0x4eb519[_0x786c('0x62')]?_0x4eb519[_0x786c('0x62')][_0x786c('0x59')]:_0x786c('0x66'),'createdAt':moment(_0x4eb519[_0x786c('0x5e')])[_0x786c('0x49')](_0x786c('0x67'))['toString'](),'closedAt':_0x4eb519[_0x786c('0x68')]?moment(_0x4eb519[_0x786c('0x69')])[_0x786c('0x49')](_0x786c('0x67'))[_0x786c('0x53')]():'','disposition':_0x4eb519['disposition'],'messages':_(_0x4eb519[_0x786c('0x5d')])[_0x786c('0x46')]({'secret':![]})[_0x786c('0x1f')](function(_0x25e4bd){return{'date':moment(_0x25e4bd[_0x786c('0x5e')])['format'](_0x786c('0x67'))[_0x786c('0x53')](),'sender':_0x25e4bd[_0x786c('0x5f')]==='out'?_0x25e4bd[_0x786c('0x58')]?_0x25e4bd[_0x786c('0x58')]['fullname']:_0x786c('0x6a'):_0x25e4bd[_0x786c('0x5b')]['firstName']+(_0x25e4bd[_0x786c('0x5b')]['lastName']?'\x20'+_0x25e4bd[_0x786c('0x5b')]['lastName']:''),'body':_0x25e4bd[_0x786c('0x37')],'direction':_0x25e4bd['direction']===_0x786c('0x6b')?'A':'C','secret':_0x25e4bd[_0x786c('0x6c')],'read':_0x25e4bd[_0x786c('0x60')]};})['value']()};return ejs['renderFile'](path[_0x786c('0x54')](config[_0x786c('0x55')],_0x786c('0x6d'),_0x786c('0x6e'),_0x786c('0x6f')),{'interaction':_0x5829e4})[_0x786c('0x1b')](function(_0x3ec0c2){var _0x350463=path[_0x786c('0x54')](_0x29c066,_0x786c('0x70')+_0x4eb519['id']+'-'+_0x444abf+_0x786c('0x71'));var _0x289dc9={'path':_0x350463,'channel':_0x786c('0x72'),'interactionId':_0x4eb519['id']};return pdf['createPdfFromHTML'](_0x3ec0c2,_0x289dc9);})[_0x786c('0x1b')](function(){return new BPromise(function(_0x2ab778,_0x303d88){zipdir(_0x29c066,{'saveTo':_0x598084},function(_0x3f5d67,_0x383e36){if(_0x3f5d67)return _0x303d88(_0x3f5d67);return _0x2ab778(_0x383e36);});})[_0x786c('0x1b')](function(){return new BPromise(function(_0x2bf55d,_0x205114){rimraf(_0x29c066,function(_0x11140e){if(_0x11140e)_0x205114(_0x11140e);return _0x2bf55d();});});})[_0x786c('0x1b')](function(){return _0x4224c4['download'](_0x598084,_0x5b109b,function(_0x1fa3f9){if(_0x1fa3f9){console['log']('err',_0x1fa3f9);}else{fs[_0x786c('0x73')](_0x598084);}});});});}else{return _0x4224c4[_0x786c('0x11')](0xc8);}})[_0x786c('0x27')](handleError(_0x4224c4,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index df75faa..6859401 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 _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x583af6,_0x48e7bd){var _0x2f5bc8=function(_0x9702b3){while(--_0x9702b3){_0x583af6['push'](_0x583af6['shift']());}};_0x2f5bc8(++_0x48e7bd);}(_0x1399,0x16c));var _0x9139=function(_0x415429,_0x1e15b8){_0x415429=_0x415429-0x0;var _0x5f3cc5=_0x1399[_0x415429];return _0x5f3cc5;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x4374c3,_0x515498){var _0x4352db=function(_0x3a2ce6){while(--_0x3a2ce6){_0x4374c3['push'](_0x4374c3['shift']());}};_0x4352db(++_0x515498);}(_0x0598,0x92));var _0x8059=function(_0x54894e,_0x5786c5){_0x54894e=_0x54894e-0x0;var _0x5f3608=_0x0598[_0x54894e];return _0x5f3608;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2679733..8fb218c 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 _0x5328=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x5ead51,_0x20050d){var _0x511fb3=function(_0x4a93f9){while(--_0x4a93f9){_0x5ead51['push'](_0x5ead51['shift']());}};_0x511fb3(++_0x20050d);}(_0x5328,0x15b));var _0x8532=function(_0x82d1f8,_0x5d37a9){_0x82d1f8=_0x82d1f8-0x0;var _0x3290f8=_0x5328[_0x82d1f8];return _0x3290f8;};'use strict';var _=require(_0x8532('0x0'));var util=require(_0x8532('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8532('0x2'));var BPromise=require(_0x8532('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8532('0x4'));var rimraf=require(_0x8532('0x5'));var config=require('../../config/environment');var attributes=require(_0x8532('0x6'));module[_0x8532('0x7')]=function(_0x8cbb9f,_0x33b8cf){return _0x8cbb9f['define'](_0x8532('0x8'),attributes,{'tableName':_0x8532('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d372f,_0x4e48bc,_0x5b389b){if(_0x1d372f[_0x8532('0xa')](_0x8532('0xb'))){_0x1d372f[_0x8532('0xc')]=moment()[_0x8532('0xd')](_0x8532('0xe'));}_0x5b389b(null,_0x1d372f);}}});}; \ No newline at end of file +var _0x8232=['rimraf','../../config/environment','./smsInteraction.attributes','SmsInteraction','sms_interactions','changed','closed','format','lodash','../../config/logger','api','moment','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8232,0x1dc));var _0x2823=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8232[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x2823('0x0'));var util=require('util');var logger=require(_0x2823('0x1'))(_0x2823('0x2'));var moment=require(_0x2823('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2823('0x4'));var rimraf=require(_0x2823('0x5'));var config=require(_0x2823('0x6'));var attributes=require(_0x2823('0x7'));module['exports']=function(_0x2648d2,_0x499601){return _0x2648d2['define'](_0x2823('0x8'),attributes,{'tableName':_0x2823('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3543c3,_0x3ee104,_0x48c9b4){if(_0x3543c3[_0x2823('0xa')](_0x2823('0xb'))){_0x3543c3['closedAt']=moment()[_0x2823('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x48c9b4(null,_0x3543c3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index a7df457..0fe3fb9 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 _0x43f9=['./smsInteraction.socket','register','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','then','info','AddTagsToSmsInteraction','find','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x3f8be8,_0x4268b2){var _0x16b4c0=function(_0x4e8ead){while(--_0x4e8ead){_0x3f8be8['push'](_0x3f8be8['shift']());}};_0x16b4c0(++_0x4268b2);}(_0x43f9,0x94));var _0x943f=function(_0xa896ef,_0x6a6ee){_0xa896ef=_0xa896ef-0x0;var _0xb956bd=_0x43f9[_0xa896ef];return _0xb956bd;};'use strict';var _=require(_0x943f('0x0'));var util=require(_0x943f('0x1'));var moment=require(_0x943f('0x2'));var BPromise=require(_0x943f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x943f('0x4'));var db=require(_0x943f('0x5'))['db'];var utils=require(_0x943f('0x6'));var logger=require(_0x943f('0x7'))(_0x943f('0x8'));var config=require(_0x943f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x943f('0xa')]({'port':0x232a});config[_0x943f('0xb')]=_['defaults'](config[_0x943f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x943f('0xb')]));require(_0x943f('0xc'))[_0x943f('0xd')](socket);function respondWithRpcPromise(_0x5c4820,_0xe47cf0,_0x589af2){return new BPromise(function(_0x25d271,_0x30e4c7){return client['request'](_0x5c4820,_0x589af2)['then'](function(_0x5d4257){logger['info'](_0x943f('0xe'),_0xe47cf0,_0x943f('0xf'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0xe47cf0,_0x943f('0xf'),JSON[_0x943f('0x10')](_0x5d4257));if(_0x5d4257[_0x943f('0x11')]){if(_0x5d4257[_0x943f('0x11')][_0x943f('0x12')]===0x1f4){logger[_0x943f('0x11')](_0x943f('0xe'),_0xe47cf0,_0x5d4257['error'][_0x943f('0x13')]);return _0x30e4c7(_0x5d4257['error']['message']);}logger['error'](_0x943f('0xe'),_0xe47cf0,_0x5d4257[_0x943f('0x11')][_0x943f('0x13')]);return _0x25d271(_0x5d4257[_0x943f('0x11')][_0x943f('0x13')]);}else{logger['info'](_0x943f('0xe'),_0xe47cf0,_0x943f('0xf'));_0x25d271(_0x5d4257[_0x943f('0x14')][_0x943f('0x13')]);}})[_0x943f('0x15')](function(_0xa10c29){logger['error'](_0x943f('0xe'),_0xe47cf0,_0xa10c29);_0x30e4c7(_0xa10c29);});});}exports[_0x943f('0x16')]=function(_0x45e82e){var _0x59b6cc=this;return new Promise(function(_0x3e2c59,_0x213eb6){return db[_0x943f('0x17')][_0x943f('0x18')](_0x45e82e[_0x943f('0x19')],{'raw':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')][_0x943f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')]['where']||null:null,'attributes':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')][_0x943f('0x1c')]||null:null,'limit':_0x45e82e[_0x943f('0x1a')]?_0x45e82e[_0x943f('0x1a')]['limit']||null:null})[_0x943f('0x1d')](function(_0x1f409c){logger[_0x943f('0x1e')](_0x943f('0x16'),_0x45e82e);logger['debug'](_0x943f('0x16'),_0x45e82e,JSON['stringify'](_0x1f409c));_0x3e2c59(_0x1f409c);})[_0x943f('0x15')](function(_0x10af6e){logger['error'](_0x943f('0x16'),_0x10af6e[_0x943f('0x13')],_0x45e82e);_0x213eb6(_0x59b6cc[_0x943f('0x11')](0x1f4,_0x10af6e[_0x943f('0x13')]));});});};exports[_0x943f('0x1f')]=function(_0x6d3904){return new Promise(function(_0x1aa46c,_0x128f8c){return db[_0x943f('0x17')][_0x943f('0x20')]({'where':_0x6d3904[_0x943f('0x1a')]?_0x6d3904[_0x943f('0x1a')][_0x943f('0x21')]||null:null})[_0x943f('0x1d')](function(_0x122f4c){if(_0x122f4c){return _0x122f4c[_0x943f('0x22')](_0x6d3904[_0x943f('0x19')][_0x943f('0x23')],_[_0x943f('0x24')](_0x6d3904['body'],[_0x943f('0x23'),'id'])||{});}})[_0x943f('0x25')](function(_0x42f0fa){logger[_0x943f('0x1e')](_0x943f('0x26'),_0x6d3904);logger[_0x943f('0x27')]('AddTags',_0x6d3904,JSON[_0x943f('0x10')](_0x42f0fa));_0x1aa46c(_0x42f0fa);})['catch'](function(_0x56b301){logger[_0x943f('0x11')](_0x943f('0x26'),_0x56b301['message'],_0x6d3904);_0x128f8c(_this[_0x943f('0x11')](0x1f4,_0x56b301[_0x943f('0x13')]));});});}; \ No newline at end of file +var _0xd853=['ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','update','options','raw','where','attributes','limit','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','SmsInteraction','find','addTags','body'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd853,0xb9));var _0x3d85=function(_0x5e9aa2,_0xd197ca){_0x5e9aa2=_0x5e9aa2-0x0;var _0xc42277=_0xd853[_0x5e9aa2];return _0xc42277;};'use strict';var _=require(_0x3d85('0x0'));var util=require(_0x3d85('0x1'));var moment=require(_0x3d85('0x2'));var BPromise=require(_0x3d85('0x3'));var rs=require(_0x3d85('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d85('0x5'))['db'];var utils=require(_0x3d85('0x6'));var logger=require(_0x3d85('0x7'))(_0x3d85('0x8'));var config=require(_0x3d85('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3d85('0xa')][_0x3d85('0xb')]({'port':0x232a});config[_0x3d85('0xc')]=_[_0x3d85('0xd')](config[_0x3d85('0xc')],{'host':_0x3d85('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d85('0xc')]));require(_0x3d85('0xf'))[_0x3d85('0x10')](socket);function respondWithRpcPromise(_0x765c6b,_0x51d0e1,_0x38f4de){return new BPromise(function(_0x3da98e,_0x8090c8){return client[_0x3d85('0x11')](_0x765c6b,_0x38f4de)[_0x3d85('0x12')](function(_0x30edcf){logger[_0x3d85('0x13')](_0x3d85('0x14'),_0x51d0e1,_0x3d85('0x15'));logger['debug'](_0x3d85('0x16'),_0x51d0e1,_0x3d85('0x15'),JSON['stringify'](_0x30edcf));if(_0x30edcf[_0x3d85('0x17')]){if(_0x30edcf['error'][_0x3d85('0x18')]===0x1f4){logger[_0x3d85('0x17')](_0x3d85('0x14'),_0x51d0e1,_0x30edcf[_0x3d85('0x17')][_0x3d85('0x19')]);return _0x8090c8(_0x30edcf['error']['message']);}logger[_0x3d85('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x51d0e1,_0x30edcf[_0x3d85('0x17')][_0x3d85('0x19')]);return _0x3da98e(_0x30edcf['error']['message']);}else{logger[_0x3d85('0x13')](_0x3d85('0x14'),_0x51d0e1,'request\x20sent');_0x3da98e(_0x30edcf['result'][_0x3d85('0x19')]);}})[_0x3d85('0x1a')](function(_0x39187a){logger[_0x3d85('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x51d0e1,_0x39187a);_0x8090c8(_0x39187a);});});}exports['UpdateSmsInteraction']=function(_0x2025ff){var _0x3976d7=this;return new Promise(function(_0x427217,_0x4c6ca1){return db['SmsInteraction'][_0x3d85('0x1b')](_0x2025ff['body'],{'raw':_0x2025ff[_0x3d85('0x1c')]?_0x2025ff['options'][_0x3d85('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2025ff[_0x3d85('0x1c')]?_0x2025ff['options'][_0x3d85('0x1e')]||null:null,'attributes':_0x2025ff[_0x3d85('0x1c')]?_0x2025ff[_0x3d85('0x1c')][_0x3d85('0x1f')]||null:null,'limit':_0x2025ff[_0x3d85('0x1c')]?_0x2025ff[_0x3d85('0x1c')][_0x3d85('0x20')]||null:null})[_0x3d85('0x12')](function(_0x487f02){logger[_0x3d85('0x13')]('UpdateSmsInteraction',_0x2025ff);logger['debug'](_0x3d85('0x21'),_0x2025ff,JSON[_0x3d85('0x22')](_0x487f02));_0x427217(_0x487f02);})[_0x3d85('0x1a')](function(_0x1a5529){logger[_0x3d85('0x17')](_0x3d85('0x21'),_0x1a5529[_0x3d85('0x19')],_0x2025ff);_0x4c6ca1(_0x3976d7[_0x3d85('0x17')](0x1f4,_0x1a5529[_0x3d85('0x19')]));});});};exports[_0x3d85('0x23')]=function(_0x282fe1){return new Promise(function(_0x10db2d,_0x1c4f00){return db[_0x3d85('0x24')][_0x3d85('0x25')]({'where':_0x282fe1[_0x3d85('0x1c')]?_0x282fe1[_0x3d85('0x1c')][_0x3d85('0x1e')]||null:null})[_0x3d85('0x12')](function(_0x550933){if(_0x550933){return _0x550933[_0x3d85('0x26')](_0x282fe1[_0x3d85('0x27')][_0x3d85('0x28')],_[_0x3d85('0x29')](_0x282fe1[_0x3d85('0x27')],['ids','id'])||{});}})[_0x3d85('0x2a')](function(_0x362aad){logger[_0x3d85('0x13')](_0x3d85('0x2b'),_0x282fe1);logger[_0x3d85('0x2c')]('AddTags',_0x282fe1,JSON[_0x3d85('0x22')](_0x362aad));_0x10db2d(_0x362aad);})['catch'](function(_0x2050d8){logger[_0x3d85('0x17')](_0x3d85('0x2b'),_0x2050d8['message'],_0x282fe1);_0x1c4f00(_this[_0x3d85('0x17')](0x1f4,_0x2050d8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 689f874..6e01a2e 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 _0xf906=['remove','emit','register','save'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xf906,0x167));var _0x6f90=function(_0x26bfa3,_0x14eddb){_0x26bfa3=_0x26bfa3-0x0;var _0x37daaf=_0xf906[_0x26bfa3];return _0x37daaf;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x6f90('0x0'),_0x6f90('0x1'),'update'];function createListener(_0x3d22b2,_0x5e0ed7){return function(_0x2f157c){_0x5e0ed7[_0x6f90('0x2')](_0x3d22b2,_0x2f157c);};}function removeListener(_0x3946a2,_0x723985){return function(){SmsInteractionEvents['removeListener'](_0x3946a2,_0x723985);};}exports[_0x6f90('0x3')]=function(_0x25af83){for(var _0x215db1=0x0,_0x5f14ad=events['length'];_0x215db1<_0x5f14ad;_0x215db1++){var _0x2e92da=events[_0x215db1];var _0x4baab2=createListener('smsInteraction:'+_0x2e92da,_0x25af83);SmsInteractionEvents['on'](_0x2e92da,_0x4baab2);}}; \ No newline at end of file +var _0x09c0=['removeListener','register','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0x09c0,0xdc));var _0x009c=function(_0x153a97,_0x7a3c3e){_0x153a97=_0x153a97-0x0;var _0x30855f=_0x09c0[_0x153a97];return _0x30855f;};'use strict';var SmsInteractionEvents=require(_0x009c('0x0'));var events=[_0x009c('0x1'),'remove',_0x009c('0x2')];function createListener(_0x46c966,_0x1adaa7){return function(_0x204213){_0x1adaa7[_0x009c('0x3')](_0x46c966,_0x204213);};}function removeListener(_0x8abf39,_0x2fb461){return function(){SmsInteractionEvents[_0x009c('0x4')](_0x8abf39,_0x2fb461);};}exports[_0x009c('0x5')]=function(_0xf3f882){for(var _0x5ddf4c=0x0,_0x1ea8ca=events['length'];_0x5ddf4c<_0x1ea8ca;_0x5ddf4c++){var _0x3ca80e=events[_0x5ddf4c];var _0x2b0d61=createListener(_0x009c('0x6')+_0x3ca80e,_0xf3f882);SmsInteractionEvents['on'](_0x3ca80e,_0x2b0d61);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 20c3065..cdb9c3f 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 _0x8f9b=['/:id/reject','reject','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','create','/:id/status','update','put','/:id/accept'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8f9b,0x162));var _0xb8f9=function(_0x4af9e5,_0x14f208){_0x4af9e5=_0x4af9e5-0x0;var _0x2cac90=_0x8f9b[_0x4af9e5];return _0x2cac90;};'use strict';var multer=require(_0xb8f9('0x0'));var util=require('util');var path=require(_0xb8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8f9('0x2'));var router=express[_0xb8f9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f9('0x4'));var interaction=require(_0xb8f9('0x5'));var config=require('../../config/environment');var controller=require(_0xb8f9('0x6'));router[_0xb8f9('0x7')]('/',auth[_0xb8f9('0x8')](),controller['index']);router[_0xb8f9('0x7')](_0xb8f9('0x9'),auth['isAuthenticated'](),controller[_0xb8f9('0xa')]);router[_0xb8f9('0x7')](_0xb8f9('0xb'),auth['isAuthenticated'](),controller[_0xb8f9('0xc')]);router[_0xb8f9('0xd')]('/',auth['isAuthenticated'](),interaction[_0xb8f9('0xe')](_0xb8f9('0xf'),'smsmessage:create'),controller[_0xb8f9('0x10')]);router[_0xb8f9('0xd')](_0xb8f9('0x11'),controller['status']);router['put'](_0xb8f9('0xb'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x12')]);router[_0xb8f9('0x13')](_0xb8f9('0x14'),auth[_0xb8f9('0x8')](),controller['accept']);router['put'](_0xb8f9('0x15'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x16')]);router[_0xb8f9('0x17')](_0xb8f9('0xb'),auth[_0xb8f9('0x8')](),controller[_0xb8f9('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1e7b=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1b2e34,_0x8d3ab5){var _0x13c2b9=function(_0x1d4bb3){while(--_0x1d4bb3){_0x1b2e34['push'](_0x1b2e34['shift']());}};_0x13c2b9(++_0x8d3ab5);}(_0x1e7b,0x12d));var _0xb1e7=function(_0x2a31b9,_0x4a634d){_0x2a31b9=_0x2a31b9-0x0;var _0x5cda05=_0x1e7b[_0x2a31b9];return _0x5cda05;};'use strict';var multer=require(_0xb1e7('0x0'));var util=require(_0xb1e7('0x1'));var path=require('path');var timeout=require(_0xb1e7('0x2'));var express=require(_0xb1e7('0x3'));var router=express['Router']();var fs_extra=require(_0xb1e7('0x4'));var auth=require(_0xb1e7('0x5'));var interaction=require(_0xb1e7('0x6'));var config=require(_0xb1e7('0x7'));var controller=require('./smsMessage.controller');router[_0xb1e7('0x8')]('/',auth[_0xb1e7('0x9')](),controller[_0xb1e7('0xa')]);router[_0xb1e7('0x8')](_0xb1e7('0xb'),auth['isAuthenticated'](),controller[_0xb1e7('0xc')]);router[_0xb1e7('0x8')](_0xb1e7('0xd'),auth[_0xb1e7('0x9')](),controller[_0xb1e7('0xe')]);router[_0xb1e7('0xf')]('/',auth[_0xb1e7('0x9')](),interaction[_0xb1e7('0x10')](_0xb1e7('0x11'),_0xb1e7('0x12')),controller[_0xb1e7('0x13')]);router[_0xb1e7('0xf')](_0xb1e7('0x14'),controller[_0xb1e7('0x15')]);router[_0xb1e7('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb1e7('0x17')]);router[_0xb1e7('0x16')](_0xb1e7('0x18'),auth['isAuthenticated'](),controller[_0xb1e7('0x19')]);router[_0xb1e7('0x16')](_0xb1e7('0x1a'),auth['isAuthenticated'](),controller[_0xb1e7('0x1b')]);router[_0xb1e7('0x1c')](_0xb1e7('0xd'),auth['isAuthenticated'](),controller[_0xb1e7('0x1d')]);module[_0xb1e7('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d477b08..df8f646 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 _0x2159=['ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x1135b1,_0x644ab2){var _0x387f6b=function(_0x515757){while(--_0x515757){_0x1135b1['push'](_0x1135b1['shift']());}};_0x387f6b(++_0x644ab2);}(_0x2159,0x17f));var _0x9215=function(_0x3e734a,_0x5479d4){_0x3e734a=_0x3e734a-0x0;var _0xe6fc77=_0x2159[_0x3e734a];return _0xe6fc77;};'use strict';var Sequelize=require(_0x9215('0x0'));module[_0x9215('0x1')]={'body':{'type':Sequelize[_0x9215('0x2')](_0x9215('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9215('0x4')]('in','out'),'defaultValue':_0x9215('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9215('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9215('0x6')]},'readAt':{'type':Sequelize[_0x9215('0x7')]},'secret':{'type':Sequelize[_0x9215('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9215('0x6')]},'providerResponse':{'type':Sequelize[_0x9215('0x2')]}}; \ No newline at end of file +var _0x703e=['medium','BOOLEAN','ENUM','STRING','DATE','sequelize','exports','TEXT'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x703e,0x1a5));var _0xe703=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x703e[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xe703('0x0'));module[_0xe703('0x1')]={'body':{'type':Sequelize[_0xe703('0x2')](_0xe703('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe703('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe703('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe703('0x6')](0xbe)},'phone':{'type':Sequelize[_0xe703('0x6')]},'readAt':{'type':Sequelize[_0xe703('0x7')]},'secret':{'type':Sequelize[_0xe703('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe703('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6a52b2d..7b19762 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 _0x7cdc=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','sms-interactions','accept','readAt','format','UserId','user','agent','SmsInteraction','SmsInteractionId','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','sms','RejectMessage','rejectMessage','ContactId','interface','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7cdc,0x190));var _0xc7cd=function(_0x8a101d,_0x43bafb){_0x8a101d=_0x8a101d-0x0;var _0x597503=_0x7cdc[_0x8a101d];return _0x597503;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7cd('0x0'));var zipdir=require(_0xc7cd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc7cd('0x2'));var moment=require(_0xc7cd('0x3'));var BPromise=require(_0xc7cd('0x4'));var Mustache=require('mustache');var util=require(_0xc7cd('0x5'));var path=require(_0xc7cd('0x6'));var sox=require('sox');var csv=require(_0xc7cd('0x7'));var ejs=require(_0xc7cd('0x8'));var fs=require('fs');var fs_extra=require(_0xc7cd('0x9'));var _=require(_0xc7cd('0xa'));var squel=require(_0xc7cd('0xb'));var crypto=require(_0xc7cd('0xc'));var jsforce=require(_0xc7cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc7cd('0x7'));var querystring=require('querystring');var Papa=require(_0xc7cd('0xe'));var Redis=require(_0xc7cd('0xf'));var authService=require(_0xc7cd('0x10'));var qs=require(_0xc7cd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7cd('0x12'));var logger=require(_0xc7cd('0x13'))(_0xc7cd('0x14'));var utils=require(_0xc7cd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7cd('0x16'));var db=require('../../mysqldb')['db'];config[_0xc7cd('0x17')]=_[_0xc7cd('0x18')](config[_0xc7cd('0x17')],{'host':_0xc7cd('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7cd('0x17')]));require(_0xc7cd('0x1a'))['register'](socket);var jayson=require(_0xc7cd('0x1b'));var client=jayson['client'][_0xc7cd('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xc7cd('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe07,_0x2f04cb,_0x317b0b,_0x494658){return new BPromise(function(_0x211e6d,_0x34ddb8){var _0x3c7d5c=_0x494658||client;return _0x3c7d5c[_0xc7cd('0x1d')](_0x2bbe07,_0x317b0b)[_0xc7cd('0x1e')](function(_0x2eca03){logger[_0xc7cd('0x1f')](_0xc7cd('0x20'),_0x2f04cb,_0xc7cd('0x21'));logger['debug'](_0xc7cd('0x22'),_0x2f04cb,'request\x20sent',JSON[_0xc7cd('0x23')](_0x2eca03));if(_0x2eca03[_0xc7cd('0x24')]){if(_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x25')]===0x1f4){logger[_0xc7cd('0x24')]('SmsMessage,\x20%s,\x20%s',_0x2f04cb,_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);return _0x34ddb8(_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);}logger['error'](_0xc7cd('0x20'),_0x2f04cb,_0x2eca03[_0xc7cd('0x24')][_0xc7cd('0x26')]);return _0x211e6d(_0x2eca03[_0xc7cd('0x24')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x2f04cb,_0xc7cd('0x21'));_0x211e6d(_0x2eca03['result'][_0xc7cd('0x26')]);}})[_0xc7cd('0x27')](function(_0x2932fe){logger[_0xc7cd('0x24')](_0xc7cd('0x20'),_0x2f04cb,_0x2932fe);_0x34ddb8(_0x2932fe);});});}function respondWithStatusCode(_0x3242a4,_0x5d16e3){_0x5d16e3=_0x5d16e3||0xcc;return function(_0x2d2c1c){if(_0x2d2c1c){return _0x3242a4[_0xc7cd('0x28')](_0x5d16e3);}return _0x3242a4[_0xc7cd('0x29')](_0x5d16e3)[_0xc7cd('0x2a')]();};}function respondWithResult(_0x51d040,_0x325792){_0x325792=_0x325792||0xc8;return function(_0x3994ae){if(_0x3994ae){return _0x51d040[_0xc7cd('0x29')](_0x325792)[_0xc7cd('0x2b')](_0x3994ae);}};}function respondWithFilteredResult(_0x4ed88b,_0x19aa4a){return function(_0x22be13){if(_0x22be13){var _0x5ab9a2=typeof _0x19aa4a['offset']===_0xc7cd('0x2c')&&typeof _0x19aa4a[_0xc7cd('0x2d')]===_0xc7cd('0x2c');var _0x34530d=_0x22be13['count'];var _0x1d5d4c=_0x5ab9a2?0x0:_0x19aa4a[_0xc7cd('0x2e')];var _0x5ed4d5=_0x5ab9a2?_0x22be13[_0xc7cd('0x2f')]:_0x19aa4a['offset']+_0x19aa4a[_0xc7cd('0x2d')];var _0xbd2964;if(_0x5ed4d5>=_0x34530d){_0x5ed4d5=_0x34530d;_0xbd2964=0xc8;}else{_0xbd2964=0xce;}_0x4ed88b[_0xc7cd('0x29')](_0xbd2964);return _0x4ed88b[_0xc7cd('0x30')](_0xc7cd('0x31'),_0x1d5d4c+'-'+_0x5ed4d5+'/'+_0x34530d)[_0xc7cd('0x2b')](_0x22be13);}return null;};}function patchUpdates(_0x1b7edd){return function(_0x11be09){try{jsonpatch['apply'](_0x11be09,_0x1b7edd,!![]);}catch(_0x4ee497){return BPromise[_0xc7cd('0x32')](_0x4ee497);}return _0x11be09['save']();};}function saveUpdates(_0x5dfa8a,_0x68f3b3){return function(_0x2e4790){if(_0x2e4790){return _0x2e4790[_0xc7cd('0x33')](_0x5dfa8a)[_0xc7cd('0x1e')](function(_0x4e1582){return _0x4e1582;});}return null;};}function removeEntity(_0x3dfcb7,_0xe319f6){return function(_0x2d9518){if(_0x2d9518){return _0x2d9518[_0xc7cd('0x34')]()[_0xc7cd('0x1e')](function(){_0x3dfcb7['status'](0xcc)[_0xc7cd('0x2a')]();});}};}function handleEntityNotFound(_0x2d2fc7,_0x5c6060){return function(_0xf0eb98){if(!_0xf0eb98){_0x2d2fc7[_0xc7cd('0x28')](0x194);}return _0xf0eb98;};}function handleError(_0x1ed44e,_0xcbc4aa){_0xcbc4aa=_0xcbc4aa||0x1f4;return function(_0x47d9b3){logger[_0xc7cd('0x24')](_0x47d9b3[_0xc7cd('0x35')]);if(_0x47d9b3[_0xc7cd('0x36')]){delete _0x47d9b3[_0xc7cd('0x36')];}_0x1ed44e[_0xc7cd('0x29')](_0xcbc4aa)[_0xc7cd('0x37')](_0x47d9b3);};}exports[_0xc7cd('0x38')]=function(_0x1a2f34,_0x426977){var _0x3ea57b={},_0x55ca78={},_0xc553aa={'count':0x0,'rows':[]};var _0x5d59e9=_[_0xc7cd('0x39')](db[_0xc7cd('0x3a')][_0xc7cd('0x3b')],function(_0x3b6ed4){return{'name':_0x3b6ed4[_0xc7cd('0x3c')],'type':_0x3b6ed4[_0xc7cd('0x3d')]['key']};});_0x55ca78['model']=_[_0xc7cd('0x39')](_0x5d59e9,_0xc7cd('0x36'));_0x55ca78[_0xc7cd('0x3e')]=_['keys'](_0x1a2f34[_0xc7cd('0x3e')]);_0x55ca78[_0xc7cd('0x3f')]=_[_0xc7cd('0x40')](_0x55ca78[_0xc7cd('0x41')],_0x55ca78[_0xc7cd('0x3e')]);_0x3ea57b['attributes']=_['intersection'](_0x55ca78[_0xc7cd('0x41')],qs[_0xc7cd('0x42')](_0x1a2f34[_0xc7cd('0x3e')]['fields']));_0x3ea57b[_0xc7cd('0x43')]=_0x3ea57b[_0xc7cd('0x43')][_0xc7cd('0x44')]?_0x3ea57b[_0xc7cd('0x43')]:_0x55ca78[_0xc7cd('0x41')];if(!_0x1a2f34[_0xc7cd('0x3e')]['hasOwnProperty'](_0xc7cd('0x45'))){_0x3ea57b[_0xc7cd('0x2d')]=qs[_0xc7cd('0x2d')](_0x1a2f34['query']['limit']);_0x3ea57b[_0xc7cd('0x2e')]=qs[_0xc7cd('0x2e')](_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x2e')]);}_0x3ea57b[_0xc7cd('0x46')]=qs['sort'](_0x1a2f34['query'][_0xc7cd('0x47')]);_0x3ea57b[_0xc7cd('0x48')]=qs[_0xc7cd('0x3f')](_[_0xc7cd('0x49')](_0x1a2f34[_0xc7cd('0x3e')],_0x55ca78[_0xc7cd('0x3f')]),_0x5d59e9);if(_0x1a2f34['query'][_0xc7cd('0x4a')]){_0x3ea57b[_0xc7cd('0x48')]=_[_0xc7cd('0x4b')](_0x3ea57b[_0xc7cd('0x48')],{'$or':_[_0xc7cd('0x39')](_0x5d59e9,function(_0x1f2bc2){if(_0x1f2bc2[_0xc7cd('0x3d')]!==_0xc7cd('0x4c')){var _0x10dbfb={};_0x10dbfb[_0x1f2bc2[_0xc7cd('0x36')]]={'$like':'%'+_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x4a')]+'%'};return _0x10dbfb;}})});}_0x3ea57b=_[_0xc7cd('0x4b')]({},_0x3ea57b,_0x1a2f34[_0xc7cd('0x4d')]);var _0x4db42c={'where':_0x3ea57b[_0xc7cd('0x48')]};return db[_0xc7cd('0x3a')]['count'](_0x4db42c)[_0xc7cd('0x1e')](function(_0xce7089){_0xc553aa[_0xc7cd('0x2f')]=_0xce7089;if(_0x1a2f34[_0xc7cd('0x3e')][_0xc7cd('0x4e')]){_0x3ea57b[_0xc7cd('0x4f')]=[{'all':!![]}];}return db[_0xc7cd('0x3a')][_0xc7cd('0x50')](_0x3ea57b);})[_0xc7cd('0x1e')](function(_0x11a0a3){_0xc553aa[_0xc7cd('0x51')]=_0x11a0a3;return _0xc553aa;})[_0xc7cd('0x1e')](respondWithFilteredResult(_0x426977,_0x3ea57b))[_0xc7cd('0x27')](handleError(_0x426977,null));};exports[_0xc7cd('0x52')]=function(_0x553c68,_0x598aa0){var _0x5f25bc={'raw':!![],'where':{'id':_0x553c68[_0xc7cd('0x53')]['id']}},_0x5df6d0={};_0x5df6d0[_0xc7cd('0x41')]=_[_0xc7cd('0x54')](db[_0xc7cd('0x3a')][_0xc7cd('0x3b')]);_0x5df6d0[_0xc7cd('0x3e')]=_[_0xc7cd('0x54')](_0x553c68[_0xc7cd('0x3e')]);_0x5df6d0[_0xc7cd('0x3f')]=_[_0xc7cd('0x40')](_0x5df6d0[_0xc7cd('0x41')],_0x5df6d0[_0xc7cd('0x3e')]);_0x5f25bc[_0xc7cd('0x43')]=_[_0xc7cd('0x40')](_0x5df6d0[_0xc7cd('0x41')],qs['fields'](_0x553c68[_0xc7cd('0x3e')][_0xc7cd('0x42')]));_0x5f25bc[_0xc7cd('0x43')]=_0x5f25bc['attributes']['length']?_0x5f25bc[_0xc7cd('0x43')]:_0x5df6d0['model'];if(_0x553c68['query']['includeAll']){_0x5f25bc[_0xc7cd('0x4f')]=[{'all':!![]}];}_0x5f25bc=_[_0xc7cd('0x4b')]({},_0x5f25bc,_0x553c68[_0xc7cd('0x4d')]);return db[_0xc7cd('0x3a')]['find'](_0x5f25bc)[_0xc7cd('0x1e')](handleEntityNotFound(_0x598aa0,null))[_0xc7cd('0x1e')](respondWithResult(_0x598aa0,null))[_0xc7cd('0x27')](handleError(_0x598aa0,null));};exports[_0xc7cd('0x55')]=function(_0x1ed9be,_0x1df3a4){return db[_0xc7cd('0x3a')][_0xc7cd('0x55')](_0x1ed9be[_0xc7cd('0x56')],{})['then'](respondWithResult(_0x1df3a4,0xc9))[_0xc7cd('0x27')](handleError(_0x1df3a4,null));};exports[_0xc7cd('0x33')]=function(_0x33d1c0,_0x508f43){if(_0x33d1c0['body']['id']){delete _0x33d1c0[_0xc7cd('0x56')]['id'];}return db[_0xc7cd('0x3a')][_0xc7cd('0x57')]({'where':{'id':_0x33d1c0[_0xc7cd('0x53')]['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x508f43,null))[_0xc7cd('0x1e')](saveUpdates(_0x33d1c0[_0xc7cd('0x56')],null))['then'](respondWithResult(_0x508f43,null))[_0xc7cd('0x27')](handleError(_0x508f43,null));};exports['destroy']=function(_0x2389b8,_0x199e5a){return db[_0xc7cd('0x3a')]['find']({'where':{'id':_0x2389b8[_0xc7cd('0x53')]['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x199e5a,null))[_0xc7cd('0x1e')](removeEntity(_0x199e5a,null))[_0xc7cd('0x27')](handleError(_0x199e5a,null));};exports['describe']=function(_0xbd358f,_0xc4eaef){return db[_0xc7cd('0x3a')][_0xc7cd('0x58')]()['then'](respondWithResult(_0xc4eaef,null))[_0xc7cd('0x27')](handleError(_0xc4eaef,null));};var interaction_log=require(_0xc7cd('0x13'))(_0xc7cd('0x59'));exports[_0xc7cd('0x5a')]=function(_0x266423,_0x4fe62a,_0x4f229e){var _0x2c5cc3={'agent':{},'channel':'sms'};if(_0x266423['body']['id']){delete _0x266423['body']['id'];}_0x266423[_0xc7cd('0x56')]['read']=!![];_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5b')]=moment()[_0xc7cd('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5d')]=_0x266423[_0xc7cd('0x56')][_0xc7cd('0x5d')]||_0x266423[_0xc7cd('0x5e')]['id'];_0x2c5cc3[_0xc7cd('0x5f')]['id']=_0x266423['body']['UserId'];return db[_0xc7cd('0x3a')]['find']({'where':{'id':_0x266423['params']['id'],'UserId':null}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x4fe62a,null))[_0xc7cd('0x1e')](saveUpdates(_0x266423[_0xc7cd('0x56')],null))[_0xc7cd('0x1e')](function(_0xeb8e3c){if(_0xeb8e3c){_0x2c5cc3[_0xc7cd('0x26')]=_0xeb8e3c['get']({'plain':!![]});return db[_0xc7cd('0x60')][_0xc7cd('0x57')]({'where':{'id':_0xeb8e3c[_0xc7cd('0x61')]}});}return null;})[_0xc7cd('0x1e')](handleEntityNotFound(_0x4fe62a,null))[_0xc7cd('0x1e')](function(_0x5bb5fb){if(_0x5bb5fb){return _0x5bb5fb[_0xc7cd('0x33')]({'UserId':_0x266423[_0xc7cd('0x56')]['UserId'],'read1stAt':_[_0xc7cd('0x62')](_0x5bb5fb['read1stAt'])?moment()[_0xc7cd('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xc7cd('0x1e')](function(_0x565092){if(_0x565092){_0x2c5cc3[_0xc7cd('0x63')]=_0x565092[_0xc7cd('0x64')]({'plain':!![]});interaction_log['info'](_0xc7cd('0x65'),_0x266423['user']['id'],_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x36')],_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x66')],_0x2c5cc3[_0xc7cd('0x63')]['id'],_0x266423['body']?JSON[_0xc7cd('0x23')](_0x266423[_0xc7cd('0x56')]):_0xc7cd('0x67'));return respondWithRpcPromise(_0xc7cd('0x68'),'acceptMessage',_0x2c5cc3);}return null;})[_0xc7cd('0x1e')](function(_0x5ac889){var _0x318359='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5ac889[_0xc7cd('0x26')]['ContactId'];return db[_0xc7cd('0x69')][_0xc7cd('0x3e')](_0x318359,{'type':db[_0xc7cd('0x6a')][_0xc7cd('0x6b')][_0xc7cd('0x6c')],'raw':!![]})[_0xc7cd('0x1e')](function(_0x7401c3){return _0x7401c3;});})[_0xc7cd('0x1e')](function(_0x34d708){if(_0x34d708){_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x6d')]=_0x34d708[0x0];if(!_0x266423[_0xc7cd('0x56')]['UserId'])return;return db[_0xc7cd('0x6e')][_0xc7cd('0x57')]({'where':{'id':_0x266423['body'][_0xc7cd('0x5d')],'role':_0xc7cd('0x5f')},'attributes':['id',_0xc7cd('0x36'),_0xc7cd('0x6f'),_0xc7cd('0x70'),_0xc7cd('0x71')],'raw':!![]});}return null;})[_0xc7cd('0x1e')](function(_0x295b21){if(!_0x295b21)return null;_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x5f')]=_0x295b21;return _0x2c5cc3;})[_0xc7cd('0x1e')](function(_0x41d08f){if(_0x41d08f){if(_0x266423[_0xc7cd('0x56')][_0xc7cd('0x72')]){_0x2c5cc3[_0xc7cd('0x26')]['interface']=util[_0xc7cd('0x5c')](_0xc7cd('0x73'),_0x266423[_0xc7cd('0x5e')][_0xc7cd('0x36')]);_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x74')]=_0x2c5cc3[_0xc7cd('0x74')];_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x75')]=_0x2c5cc3['channel'];_0x2c5cc3[_0xc7cd('0x26')][_0xc7cd('0x76')]=_0xc7cd('0x5a');return respondWithRpcPromise(_0xc7cd('0x77'),_0xc7cd('0x77'),{'event':'acceptmessage','message':_0x2c5cc3['message']},client9002)['then'](function(){return _0x2c5cc3;});}return _0x2c5cc3;}return null;})['then'](respondWithResult(_0x4fe62a,null))[_0xc7cd('0x27')](handleError(_0x4fe62a,null));};var interaction_log=require('../../config/logger')(_0xc7cd('0x59'));exports[_0xc7cd('0x32')]=function(_0x1a7fa8,_0x5f40e6,_0x1546d9){var _0x13f0c9={'agent':{},'channel':_0xc7cd('0x78')};if(_0x1a7fa8[_0xc7cd('0x56')]['id']){delete _0x1a7fa8[_0xc7cd('0x56')]['id'];}_0x1a7fa8['body'][_0xc7cd('0x5d')]=_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')]||_0x1a7fa8[_0xc7cd('0x5e')]['id'];_0x13f0c9[_0xc7cd('0x5f')]['id']=_0x1a7fa8['body'][_0xc7cd('0x5d')];return db[_0xc7cd('0x3a')][_0xc7cd('0x57')]({'where':{'id':_0x1a7fa8[_0xc7cd('0x53')]['id'],'UserId':null}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x5f40e6,null))['then'](function(_0x2c459e){if(_0x2c459e){_0x13f0c9['message']=_0x2c459e[_0xc7cd('0x64')]({'plain':!![]});return db['SmsInteraction'][_0xc7cd('0x57')]({'where':{'id':_0x2c459e['SmsInteractionId']}});}return null;})[_0xc7cd('0x1e')](handleEntityNotFound(_0x5f40e6,null))[_0xc7cd('0x1e')](function(_0x3553f0){if(_0x3553f0){_0x13f0c9[_0xc7cd('0x63')]=_0x3553f0[_0xc7cd('0x64')]({'plain':!![]});interaction_log[_0xc7cd('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1a7fa8[_0xc7cd('0x5e')]['id'],_0x1a7fa8[_0xc7cd('0x5e')][_0xc7cd('0x36')],_0x1a7fa8[_0xc7cd('0x5e')][_0xc7cd('0x66')],_0x13f0c9[_0xc7cd('0x63')]['id'],_0x1a7fa8[_0xc7cd('0x56')]?JSON['stringify'](_0x1a7fa8[_0xc7cd('0x56')]):'null');return respondWithRpcPromise(_0xc7cd('0x79'),_0xc7cd('0x7a'),_0x13f0c9);}return null;})['then'](function(_0x1dd560){var _0x5c23a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1dd560['message'][_0xc7cd('0x7b')];return db[_0xc7cd('0x69')][_0xc7cd('0x3e')](_0x5c23a3,{'type':db[_0xc7cd('0x6a')][_0xc7cd('0x6b')]['SELECT'],'raw':!![]})[_0xc7cd('0x1e')](function(_0x283af){return _0x283af;});})['then'](function(_0x464ee5){if(_0x464ee5){_0x13f0c9['message'][_0xc7cd('0x6d')]=_0x464ee5[0x0];if(!_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')])return;return db[_0xc7cd('0x6e')][_0xc7cd('0x57')]({'where':{'id':_0x1a7fa8[_0xc7cd('0x56')][_0xc7cd('0x5d')],'role':_0xc7cd('0x5f')},'attributes':['id',_0xc7cd('0x36'),_0xc7cd('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0xc7cd('0x1e')](function(_0xc06513){if(!_0xc06513)return null;_0x13f0c9[_0xc7cd('0x26')][_0xc7cd('0x5f')]=_0xc06513;return _0x13f0c9;})[_0xc7cd('0x1e')](function(_0x4eeeff){if(_0x4eeeff){_0x4eeeff[_0xc7cd('0x26')][_0xc7cd('0x7c')]=util[_0xc7cd('0x5c')](_0xc7cd('0x73'),_0x1a7fa8[_0xc7cd('0x5e')]['name']);_0x4eeeff['message'][_0xc7cd('0x74')]=_0x13f0c9[_0xc7cd('0x74')];_0x4eeeff['message'][_0xc7cd('0x75')]=_0x13f0c9[_0xc7cd('0x74')];_0x4eeeff[_0xc7cd('0x26')][_0xc7cd('0x76')]=_0xc7cd('0x32');respondWithRpcPromise('EventManager',_0xc7cd('0x77'),{'event':_0xc7cd('0x7d'),'message':_0x4eeeff['message']},client9002);return _0x13f0c9;}return null;})[_0xc7cd('0x1e')](respondWithResult(_0x5f40e6,null))[_0xc7cd('0x27')](handleError(_0x5f40e6,null));};exports[_0xc7cd('0x29')]=function(_0x3fc99b,_0x2b7901,_0x495642){if(_0x3fc99b['body']['id']){delete _0x3fc99b[_0xc7cd('0x56')]['id'];}var _0x2abcc5;return db['SmsMessage'][_0xc7cd('0x57')]({'where':{'id':_0x3fc99b['params']['id']}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x2b7901,null))[_0xc7cd('0x1e')](function(_0x27c2ad){if(_0x27c2ad){_0x2abcc5=_0x27c2ad;return db[_0xc7cd('0x7e')][_0xc7cd('0x57')]({'where':{'id':_0x27c2ad[_0xc7cd('0x7f')]}});}})[_0xc7cd('0x1e')](handleEntityNotFound(_0x2b7901,null))[_0xc7cd('0x1e')](function(_0x2c916c){if(_0x2c916c){logger[_0xc7cd('0x80')](_0xc7cd('0x22'),_0xc7cd('0x29'),_0xc7cd('0x81'),_0x2c916c[_0xc7cd('0x3d')],util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));switch(_0x2c916c[_0xc7cd('0x3d')]){case _0xc7cd('0x83'):if(_0x3fc99b[_0xc7cd('0x56')][_0xc7cd('0x84')]&&_0x3fc99b['body']['MessageSid']===_0x2abcc5['messageId']){return _0x2abcc5[_0xc7cd('0x33')]({'read':!![]});}else{logger[_0xc7cd('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7cd('0x29'),_0xc7cd('0x83'),util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc7cd('0x85'):if(_0x3fc99b['body'][_0xc7cd('0x86')]&&_0x3fc99b[_0xc7cd('0x56')]['MessageUUID']===_0x2abcc5[_0xc7cd('0x87')]&&_[_0xc7cd('0x88')]([_0xc7cd('0x89'),'delivered'],_0x3fc99b[_0xc7cd('0x56')]['Status'])>=0x0){return _0x2abcc5['update']({'read':!![]});}else{logger['error'](_0xc7cd('0x8a'),_0xc7cd('0x29'),_0xc7cd('0x8b'),util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc7cd('0x8c'):var _0xb88536=_0x3fc99b[_0xc7cd('0x56')][_0xc7cd('0x8d')][0x0];if(_0xb88536[_0xc7cd('0x29')][_0xc7cd('0x8e')]==='DELIVERED'){return _0x2abcc5[_0xc7cd('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc7cd('0x29'),'infobip',util[_0xc7cd('0x82')](_0x3fc99b[_0xc7cd('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2abcc5;}})[_0xc7cd('0x1e')](respondWithResult(_0x2b7901,null))[_0xc7cd('0x27')](handleError(_0x2b7901,null));}; \ No newline at end of file +var _0x9a2d=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','destroy','stack','name','fieldName','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SmsMessage','count','includeAll','include','findAll','rows','show','rawAttributes','filters','options','find','create','body','update','params','describe','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x16d2ec,_0x5114d6){var _0x2b5cf5=function(_0x3ecd72){while(--_0x3ecd72){_0x16d2ec['push'](_0x16d2ec['shift']());}};_0x2b5cf5(++_0x5114d6);}(_0x9a2d,0x123));var _0xd9a2=function(_0x19d9bd,_0x468b68){_0x19d9bd=_0x19d9bd-0x0;var _0x3a13f6=_0x9a2d[_0x19d9bd];return _0x3a13f6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd9a2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9a2('0x1'));var moment=require(_0xd9a2('0x2'));var BPromise=require(_0xd9a2('0x3'));var Mustache=require(_0xd9a2('0x4'));var util=require(_0xd9a2('0x5'));var path=require(_0xd9a2('0x6'));var sox=require(_0xd9a2('0x7'));var csv=require(_0xd9a2('0x8'));var ejs=require(_0xd9a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd9a2('0xa'));var _=require(_0xd9a2('0xb'));var squel=require(_0xd9a2('0xc'));var crypto=require(_0xd9a2('0xd'));var jsforce=require(_0xd9a2('0xe'));var deskjs=require(_0xd9a2('0xf'));var toCsv=require(_0xd9a2('0x8'));var querystring=require(_0xd9a2('0x10'));var Papa=require(_0xd9a2('0x11'));var Redis=require(_0xd9a2('0x12'));var authService=require(_0xd9a2('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9a2('0x14'));var logger=require('../../config/logger')(_0xd9a2('0x15'));var utils=require('../../config/utils');var config=require(_0xd9a2('0x16'));var licenseUtil=require(_0xd9a2('0x17'));var db=require(_0xd9a2('0x18'))['db'];config[_0xd9a2('0x19')]=_['defaults'](config[_0xd9a2('0x19')],{'host':_0xd9a2('0x1a'),'port':0x18eb});var socket=require(_0xd9a2('0x1b'))(new Redis(config['redis']));require(_0xd9a2('0x1c'))['register'](socket);var jayson=require(_0xd9a2('0x1d'));var client=jayson['client'][_0xd9a2('0x1e')]({'port':0x232c});var client9002=jayson[_0xd9a2('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xee6ea8,_0x1447e6,_0x4a8d26,_0x36764b){return new BPromise(function(_0x53f6fb,_0x34ee99){var _0x5185d0=_0x36764b||client;return _0x5185d0[_0xd9a2('0x20')](_0xee6ea8,_0x4a8d26)[_0xd9a2('0x21')](function(_0x53dace){logger[_0xd9a2('0x22')](_0xd9a2('0x23'),_0x1447e6,_0xd9a2('0x24'));logger[_0xd9a2('0x25')](_0xd9a2('0x26'),_0x1447e6,_0xd9a2('0x24'),JSON[_0xd9a2('0x27')](_0x53dace));if(_0x53dace['error']){if(_0x53dace['error'][_0xd9a2('0x28')]===0x1f4){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x34ee99(_0x53dace['error'][_0xd9a2('0x2a')]);}logger[_0xd9a2('0x29')](_0xd9a2('0x23'),_0x1447e6,_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);return _0x53f6fb(_0x53dace[_0xd9a2('0x29')][_0xd9a2('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0xd9a2('0x24'));_0x53f6fb(_0x53dace[_0xd9a2('0x2b')][_0xd9a2('0x2a')]);}})[_0xd9a2('0x2c')](function(_0x492320){logger[_0xd9a2('0x29')]('SmsMessage,\x20%s,\x20%s',_0x1447e6,_0x492320);_0x34ee99(_0x492320);});});}function respondWithStatusCode(_0x3ee7fe,_0x2093ea){_0x2093ea=_0x2093ea||0xcc;return function(_0x5ea1fc){if(_0x5ea1fc){return _0x3ee7fe[_0xd9a2('0x2d')](_0x2093ea);}return _0x3ee7fe[_0xd9a2('0x2e')](_0x2093ea)[_0xd9a2('0x2f')]();};}function respondWithResult(_0x4c89d8,_0x308dde){_0x308dde=_0x308dde||0xc8;return function(_0x392d24){if(_0x392d24){return _0x4c89d8[_0xd9a2('0x2e')](_0x308dde)[_0xd9a2('0x30')](_0x392d24);}};}function respondWithFilteredResult(_0x53723f,_0x1c8557){return function(_0x5a6f29){if(_0x5a6f29){var _0xc422b0=typeof _0x1c8557['offset']===_0xd9a2('0x31')&&typeof _0x1c8557[_0xd9a2('0x32')]===_0xd9a2('0x31');var _0x1c07b9=_0x5a6f29['count'];var _0x41aca0=_0xc422b0?0x0:_0x1c8557[_0xd9a2('0x33')];var _0x3e6e47=_0xc422b0?_0x5a6f29['count']:_0x1c8557[_0xd9a2('0x33')]+_0x1c8557['limit'];var _0x592ff3;if(_0x3e6e47>=_0x1c07b9){_0x3e6e47=_0x1c07b9;_0x592ff3=0xc8;}else{_0x592ff3=0xce;}_0x53723f['status'](_0x592ff3);return _0x53723f['set'](_0xd9a2('0x34'),_0x41aca0+'-'+_0x3e6e47+'/'+_0x1c07b9)['json'](_0x5a6f29);}return null;};}function patchUpdates(_0x55973c){return function(_0x2885ad){try{jsonpatch[_0xd9a2('0x35')](_0x2885ad,_0x55973c,!![]);}catch(_0xeddcd){return BPromise[_0xd9a2('0x36')](_0xeddcd);}return _0x2885ad['save']();};}function saveUpdates(_0x53bbfc,_0x47ecf2){return function(_0x3ee4c3){if(_0x3ee4c3){return _0x3ee4c3['update'](_0x53bbfc)[_0xd9a2('0x21')](function(_0x475236){return _0x475236;});}return null;};}function removeEntity(_0x33ed44,_0x28de27){return function(_0x322303){if(_0x322303){return _0x322303[_0xd9a2('0x37')]()['then'](function(){_0x33ed44[_0xd9a2('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2e455,_0x5bbeef){return function(_0x2db13d){if(!_0x2db13d){_0xd2e455[_0xd9a2('0x2d')](0x194);}return _0x2db13d;};}function handleError(_0x3c7bb1,_0x41e47f){_0x41e47f=_0x41e47f||0x1f4;return function(_0x535c8f){logger[_0xd9a2('0x29')](_0x535c8f[_0xd9a2('0x38')]);if(_0x535c8f[_0xd9a2('0x39')]){delete _0x535c8f[_0xd9a2('0x39')];}_0x3c7bb1[_0xd9a2('0x2e')](_0x41e47f)['send'](_0x535c8f);};}exports['index']=function(_0xff9e89,_0x147ad8){var _0x3c6a68={},_0x291766={},_0x110064={'count':0x0,'rows':[]};var _0x3228df=_['map'](db['SmsMessage']['rawAttributes'],function(_0x3dae16){return{'name':_0x3dae16[_0xd9a2('0x3a')],'type':_0x3dae16['type'][_0xd9a2('0x3b')]};});_0x291766[_0xd9a2('0x3c')]=_[_0xd9a2('0x3d')](_0x3228df,'name');_0x291766[_0xd9a2('0x3e')]=_['keys'](_0xff9e89[_0xd9a2('0x3e')]);_0x291766['filters']=_['intersection'](_0x291766[_0xd9a2('0x3c')],_0x291766[_0xd9a2('0x3e')]);_0x3c6a68[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x291766[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0x3c6a68[_0xd9a2('0x3f')]=_0x3c6a68[_0xd9a2('0x3f')][_0xd9a2('0x42')]?_0x3c6a68['attributes']:_0x291766[_0xd9a2('0x3c')];if(!_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x43')](_0xd9a2('0x44'))){_0x3c6a68['limit']=qs[_0xd9a2('0x32')](_0xff9e89[_0xd9a2('0x3e')]['limit']);_0x3c6a68['offset']=qs[_0xd9a2('0x33')](_0xff9e89['query']['offset']);}_0x3c6a68[_0xd9a2('0x45')]=qs[_0xd9a2('0x46')](_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x46')]);_0x3c6a68[_0xd9a2('0x47')]=qs['filters'](_['pick'](_0xff9e89[_0xd9a2('0x3e')],_0x291766['filters']),_0x3228df);if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]){_0x3c6a68[_0xd9a2('0x47')]=_[_0xd9a2('0x49')](_0x3c6a68[_0xd9a2('0x47')],{'$or':_[_0xd9a2('0x3d')](_0x3228df,function(_0x2e0dce){if(_0x2e0dce[_0xd9a2('0x4a')]!==_0xd9a2('0x4b')){var _0x3ddadf={};_0x3ddadf[_0x2e0dce[_0xd9a2('0x39')]]={'$like':'%'+_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x48')]+'%'};return _0x3ddadf;}})});}_0x3c6a68=_[_0xd9a2('0x49')]({},_0x3c6a68,_0xff9e89['options']);var _0x2a098f={'where':_0x3c6a68[_0xd9a2('0x47')]};return db[_0xd9a2('0x4c')][_0xd9a2('0x4d')](_0x2a098f)[_0xd9a2('0x21')](function(_0x4d76fc){_0x110064['count']=_0x4d76fc;if(_0xff9e89[_0xd9a2('0x3e')][_0xd9a2('0x4e')]){_0x3c6a68[_0xd9a2('0x4f')]=[{'all':!![]}];}return db[_0xd9a2('0x4c')][_0xd9a2('0x50')](_0x3c6a68);})[_0xd9a2('0x21')](function(_0xe7d5c0){_0x110064[_0xd9a2('0x51')]=_0xe7d5c0;return _0x110064;})[_0xd9a2('0x21')](respondWithFilteredResult(_0x147ad8,_0x3c6a68))[_0xd9a2('0x2c')](handleError(_0x147ad8,null));};exports[_0xd9a2('0x52')]=function(_0x156608,_0xd184db){var _0xc43dea={'raw':!![],'where':{'id':_0x156608['params']['id']}},_0x43c91b={};_0x43c91b[_0xd9a2('0x3c')]=_['keys'](db[_0xd9a2('0x4c')][_0xd9a2('0x53')]);_0x43c91b[_0xd9a2('0x3e')]=_['keys'](_0x156608[_0xd9a2('0x3e')]);_0x43c91b[_0xd9a2('0x54')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],_0x43c91b[_0xd9a2('0x3e')]);_0xc43dea[_0xd9a2('0x3f')]=_[_0xd9a2('0x40')](_0x43c91b[_0xd9a2('0x3c')],qs[_0xd9a2('0x41')](_0x156608[_0xd9a2('0x3e')][_0xd9a2('0x41')]));_0xc43dea[_0xd9a2('0x3f')]=_0xc43dea[_0xd9a2('0x3f')]['length']?_0xc43dea[_0xd9a2('0x3f')]:_0x43c91b[_0xd9a2('0x3c')];if(_0x156608['query'][_0xd9a2('0x4e')]){_0xc43dea[_0xd9a2('0x4f')]=[{'all':!![]}];}_0xc43dea=_[_0xd9a2('0x49')]({},_0xc43dea,_0x156608[_0xd9a2('0x55')]);return db[_0xd9a2('0x4c')][_0xd9a2('0x56')](_0xc43dea)[_0xd9a2('0x21')](handleEntityNotFound(_0xd184db,null))[_0xd9a2('0x21')](respondWithResult(_0xd184db,null))[_0xd9a2('0x2c')](handleError(_0xd184db,null));};exports[_0xd9a2('0x57')]=function(_0x5dda06,_0x555e8f){return db['SmsMessage'][_0xd9a2('0x57')](_0x5dda06[_0xd9a2('0x58')],{})[_0xd9a2('0x21')](respondWithResult(_0x555e8f,0xc9))['catch'](handleError(_0x555e8f,null));};exports[_0xd9a2('0x59')]=function(_0x500c40,_0x4305da){if(_0x500c40[_0xd9a2('0x58')]['id']){delete _0x500c40[_0xd9a2('0x58')]['id'];}return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x500c40[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4305da,null))['then'](saveUpdates(_0x500c40[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](respondWithResult(_0x4305da,null))[_0xd9a2('0x2c')](handleError(_0x4305da,null));};exports[_0xd9a2('0x37')]=function(_0x3a882a,_0x16350d){return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x3a882a[_0xd9a2('0x5a')]['id']}})[_0xd9a2('0x21')](handleEntityNotFound(_0x16350d,null))[_0xd9a2('0x21')](removeEntity(_0x16350d,null))['catch'](handleError(_0x16350d,null));};exports[_0xd9a2('0x5b')]=function(_0x1a42db,_0xe094dc){return db['SmsMessage'][_0xd9a2('0x5b')]()[_0xd9a2('0x21')](respondWithResult(_0xe094dc,null))['catch'](handleError(_0xe094dc,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xd9a2('0x5c')]=function(_0x96a587,_0xb549a9,_0x2c482a){var _0x416c03={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x96a587[_0xd9a2('0x58')]['id']){delete _0x96a587[_0xd9a2('0x58')]['id'];}_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x5e')]=!![];_0x96a587['body'][_0xd9a2('0x5f')]=moment()[_0xd9a2('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x96a587['body']['UserId']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')]||_0x96a587[_0xd9a2('0x62')]['id'];_0x416c03[_0xd9a2('0x63')]['id']=_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')];return db[_0xd9a2('0x4c')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x5a')]['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](saveUpdates(_0x96a587[_0xd9a2('0x58')],null))[_0xd9a2('0x21')](function(_0x10b10f){if(_0x10b10f){_0x416c03['message']=_0x10b10f[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x10b10f[_0xd9a2('0x66')]}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0xb549a9,null))[_0xd9a2('0x21')](function(_0x4883f0){if(_0x4883f0){return _0x4883f0[_0xd9a2('0x59')]({'UserId':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'read1stAt':_[_0xd9a2('0x67')](_0x4883f0[_0xd9a2('0x68')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x65bfe1){if(_0x65bfe1){_0x416c03[_0xd9a2('0x69')]=_0x65bfe1[_0xd9a2('0x64')]({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x6a'),_0x96a587['user']['id'],_0x96a587[_0xd9a2('0x62')]['name'],_0x96a587['user'][_0xd9a2('0x6b')],_0x416c03[_0xd9a2('0x69')]['id'],_0x96a587[_0xd9a2('0x58')]?JSON[_0xd9a2('0x27')](_0x96a587[_0xd9a2('0x58')]):'null');return respondWithRpcPromise(_0xd9a2('0x6c'),_0xd9a2('0x6d'),_0x416c03);}return null;})[_0xd9a2('0x21')](function(_0x359ffb){var _0x17a77f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x359ffb[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x17a77f,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')][_0xd9a2('0x72')],'raw':!![]})[_0xd9a2('0x21')](function(_0x140484){return _0x140484;});})['then'](function(_0x5dabb5){if(_0x5dabb5){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5dabb5[0x0];if(!_0x96a587['body'][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')]['find']({'where':{'id':_0x96a587[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':'agent'},'attributes':['id',_0xd9a2('0x39'),_0xd9a2('0x75'),_0xd9a2('0x76'),_0xd9a2('0x77')],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x406964){if(!_0x406964)return null;_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x63')]=_0x406964;return _0x416c03;})[_0xd9a2('0x21')](function(_0x50020d){if(_0x50020d){if(_0x96a587[_0xd9a2('0x58')]['manual']){_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x78')]=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x96a587[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x416c03['channel'];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x416c03[_0xd9a2('0x7a')];_0x416c03[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x5c');return respondWithRpcPromise(_0xd9a2('0x7d'),'EventManager',{'event':'acceptmessage','message':_0x416c03[_0xd9a2('0x2a')]},client9002)[_0xd9a2('0x21')](function(){return _0x416c03;});}return _0x416c03;}return null;})[_0xd9a2('0x21')](respondWithResult(_0xb549a9,null))['catch'](handleError(_0xb549a9,null));};var interaction_log=require('../../config/logger')(_0xd9a2('0x7e'));exports[_0xd9a2('0x36')]=function(_0x5df83c,_0x4c1cf3,_0x37e307){var _0x3ae1bc={'agent':{},'channel':_0xd9a2('0x5d')};if(_0x5df83c[_0xd9a2('0x58')]['id']){delete _0x5df83c[_0xd9a2('0x58')]['id'];}_0x5df83c['body'][_0xd9a2('0x61')]=_0x5df83c['body']['UserId']||_0x5df83c[_0xd9a2('0x62')]['id'];_0x3ae1bc[_0xd9a2('0x63')]['id']=_0x5df83c[_0xd9a2('0x58')]['UserId'];return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c['params']['id'],'UserId':null}})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x24eb4b){if(_0x24eb4b){_0x3ae1bc[_0xd9a2('0x2a')]=_0x24eb4b[_0xd9a2('0x64')]({'plain':!![]});return db[_0xd9a2('0x65')][_0xd9a2('0x56')]({'where':{'id':_0x24eb4b['SmsInteractionId']}});}return null;})[_0xd9a2('0x21')](handleEntityNotFound(_0x4c1cf3,null))[_0xd9a2('0x21')](function(_0x5b3735){if(_0x5b3735){_0x3ae1bc[_0xd9a2('0x69')]=_0x5b3735['get']({'plain':!![]});interaction_log[_0xd9a2('0x22')](_0xd9a2('0x7f'),_0x5df83c[_0xd9a2('0x62')]['id'],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')],_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x6b')],_0x3ae1bc[_0xd9a2('0x69')]['id'],_0x5df83c[_0xd9a2('0x58')]?JSON['stringify'](_0x5df83c[_0xd9a2('0x58')]):_0xd9a2('0x80'));return respondWithRpcPromise(_0xd9a2('0x81'),'rejectMessage',_0x3ae1bc);}return null;})[_0xd9a2('0x21')](function(_0x4fb154){var _0x2c9b15=_0xd9a2('0x82')+_0x4fb154[_0xd9a2('0x2a')][_0xd9a2('0x6e')];return db[_0xd9a2('0x6f')][_0xd9a2('0x3e')](_0x2c9b15,{'type':db[_0xd9a2('0x70')][_0xd9a2('0x71')]['SELECT'],'raw':!![]})[_0xd9a2('0x21')](function(_0x1fd236){return _0x1fd236;});})[_0xd9a2('0x21')](function(_0x5ade4d){if(_0x5ade4d){_0x3ae1bc[_0xd9a2('0x2a')][_0xd9a2('0x73')]=_0x5ade4d[0x0];if(!_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')])return;return db[_0xd9a2('0x74')][_0xd9a2('0x56')]({'where':{'id':_0x5df83c[_0xd9a2('0x58')][_0xd9a2('0x61')],'role':_0xd9a2('0x63')},'attributes':['id',_0xd9a2('0x39'),'fullname',_0xd9a2('0x76'),'internal'],'raw':!![]});}return null;})[_0xd9a2('0x21')](function(_0x5e9bdd){if(!_0x5e9bdd)return null;_0x3ae1bc['message'][_0xd9a2('0x63')]=_0x5e9bdd;return _0x3ae1bc;})[_0xd9a2('0x21')](function(_0x339d19){if(_0x339d19){_0x339d19[_0xd9a2('0x2a')]['interface']=util[_0xd9a2('0x60')](_0xd9a2('0x79'),_0x5df83c[_0xd9a2('0x62')][_0xd9a2('0x39')]);_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7a')]=_0x3ae1bc['channel'];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7b')]=_0x3ae1bc[_0xd9a2('0x7a')];_0x339d19[_0xd9a2('0x2a')][_0xd9a2('0x7c')]=_0xd9a2('0x36');respondWithRpcPromise(_0xd9a2('0x7d'),_0xd9a2('0x7d'),{'event':_0xd9a2('0x83'),'message':_0x339d19[_0xd9a2('0x2a')]},client9002);return _0x3ae1bc;}return null;})['then'](respondWithResult(_0x4c1cf3,null))[_0xd9a2('0x2c')](handleError(_0x4c1cf3,null));};exports['status']=function(_0x4b8b48,_0x1213f1,_0x1dba0c){if(_0x4b8b48[_0xd9a2('0x58')]['id']){delete _0x4b8b48[_0xd9a2('0x58')]['id'];}var _0x35e050;return db[_0xd9a2('0x4c')][_0xd9a2('0x56')]({'where':{'id':_0x4b8b48['params']['id']}})['then'](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x6e0fc7){if(_0x6e0fc7){_0x35e050=_0x6e0fc7;return db['SmsAccount'][_0xd9a2('0x56')]({'where':{'id':_0x6e0fc7['SmsAccountId']}});}})[_0xd9a2('0x21')](handleEntityNotFound(_0x1213f1,null))[_0xd9a2('0x21')](function(_0x1dd219){if(_0x1dd219){logger[_0xd9a2('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9a2('0x2e'),_0xd9a2('0x84'),_0x1dd219[_0xd9a2('0x4a')],util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));switch(_0x1dd219[_0xd9a2('0x4a')]){case _0xd9a2('0x86'):if(_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x87')]&&_0x4b8b48[_0xd9a2('0x58')]['MessageSid']===_0x35e050[_0xd9a2('0x88')]){return _0x35e050[_0xd9a2('0x59')]({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),'twilio',util['inspect'](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4b8b48[_0xd9a2('0x58')]['MessageUUID']&&_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8a')]===_0x35e050[_0xd9a2('0x88')]&&_[_0xd9a2('0x8b')]([_0xd9a2('0x8c'),_0xd9a2('0x8d')],_0x4b8b48[_0xd9a2('0x58')][_0xd9a2('0x8e')])>=0x0){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x8f'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;case _0xd9a2('0x90'):var _0x460b62=_0x4b8b48['body'][_0xd9a2('0x91')][0x0];if(_0x460b62[_0xd9a2('0x2e')][_0xd9a2('0x92')]===_0xd9a2('0x93')){return _0x35e050['update']({'read':!![]});}else{logger[_0xd9a2('0x29')](_0xd9a2('0x89'),_0xd9a2('0x2e'),_0xd9a2('0x90'),util[_0xd9a2('0x85')](_0x4b8b48[_0xd9a2('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x35e050;}})[_0xd9a2('0x21')](respondWithResult(_0x1213f1,null))[_0xd9a2('0x2c')](handleError(_0x1213f1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 813aeaf..b372896 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 _0x6f5b=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13c0df,_0x785782){var _0x3eb8dd=function(_0x16eca5){while(--_0x16eca5){_0x13c0df['push'](_0x13c0df['shift']());}};_0x3eb8dd(++_0x785782);}(_0x6f5b,0x1d5));var _0xb6f5=function(_0x544f22,_0x4d4ad8){_0x544f22=_0x544f22-0x0;var _0x47090b=_0x6f5b[_0x544f22];return _0x47090b;};'use strict';var EventEmitter=require(_0xb6f5('0x0'));var SmsMessage=require(_0xb6f5('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6f5('0x2'),'afterUpdate':_0xb6f5('0x3'),'afterDestroy':_0xb6f5('0x4')};function emitEvent(_0x7dbce){return function(_0x57ae3e,_0x1c6118,_0x3abc9d){SmsMessageEvents[_0xb6f5('0x5')](_0x7dbce+':'+_0x57ae3e['id'],_0x57ae3e);SmsMessageEvents[_0xb6f5('0x5')](_0x7dbce,_0x57ae3e);_0x3abc9d(null);};}for(var e in events){if(events[_0xb6f5('0x6')](e)){var event=events[e];SmsMessage[_0xb6f5('0x7')](e,emitEvent(event));}}module[_0xb6f5('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xeac1=['emit','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x541a14,_0x1e44cf){var _0x142a07=function(_0x3e779c){while(--_0x3e779c){_0x541a14['push'](_0x541a14['shift']());}};_0x142a07(++_0x1e44cf);}(_0xeac1,0x126));var _0x1eac=function(_0x1e9a78,_0x50c252){_0x1e9a78=_0x1e9a78-0x0;var _0x5490ca=_0xeac1[_0x1e9a78];return _0x5490ca;};'use strict';var EventEmitter=require(_0x1eac('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x1eac('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x1eac('0x2')](0x0);var events={'afterCreate':_0x1eac('0x3'),'afterUpdate':_0x1eac('0x4'),'afterDestroy':_0x1eac('0x5')};function emitEvent(_0x181386){return function(_0x26ae89,_0x1a50d9,_0x409735){SmsMessageEvents['emit'](_0x181386+':'+_0x26ae89['id'],_0x26ae89);SmsMessageEvents[_0x1eac('0x6')](_0x181386,_0x26ae89);_0x409735(null);};}for(var e in events){if(events[_0x1eac('0x7')](e)){var event=events[e];SmsMessage[_0x1eac('0x8')](e,emitEvent(event));}}module[_0x1eac('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ed5a70e..fcd37e4 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 _0x4b71=['deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','clickatell','https://platform.clickatell.com/messages','UTF-8','bandwidth','accountId','/messages','intelepeer','apiKey','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','update','createdAt','catch','error','SmsAccount','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','POST','user_key','session_key','total_sent'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x4b71,0x1ac));var _0x14b7=function(_0x2b3062,_0x1f4d35){_0x2b3062=_0x2b3062-0x0;var _0x528b16=_0x4b71[_0x2b3062];return _0x528b16;};'use strict';var _=require(_0x14b7('0x0'));var util=require('util');var logger=require(_0x14b7('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14b7('0x2'));var fs=require('fs');var path=require(_0x14b7('0x3'));var rimraf=require(_0x14b7('0x4'));var config=require(_0x14b7('0x5'));var attributes=require(_0x14b7('0x6'));module[_0x14b7('0x7')]=function(_0x45a6ea,_0x8255cc){return _0x45a6ea['define'](_0x14b7('0x8'),attributes,{'tableName':_0x14b7('0x9'),'paranoid':![],'indexes':[{'name':_0x14b7('0xa'),'fields':[_0x14b7('0xa')]},{'name':_0x14b7('0xb'),'fields':[_0x14b7('0xc')],'type':_0x14b7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d13a2,_0x19459d,_0x32c32f){var _0x2c7994=_0x45a6ea[_0x14b7('0xe')];var _0x315841=_0x4d13a2['get']({'plain':!![]});if(_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()==='in'||_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()===_0x14b7('0x11')&&!_0x315841[_0x14b7('0x12')]&&!_[_0x14b7('0x13')](_0x315841[_0x14b7('0x14')])&&!_['isNil'](_0x315841['SmsInteractionId'])){_0x2c7994[_0x14b7('0x15')]['findOne']({'where':{'id':_0x315841['SmsInteractionId']}})['then'](function(_0xb633ce){if(_0xb633ce){_0xb633ce[_0x14b7('0x16')]({'lastMsgAt':_0x315841[_0x14b7('0x17')],'lastMsgDirection':_0x315841[_0x14b7('0xf')][_0x14b7('0x10')]()});}})[_0x14b7('0x18')](function(_0x1ed0df){console[_0x14b7('0x19')](_0x1ed0df);});}if(_0x315841[_0x14b7('0xf')]===_0x14b7('0x11')&&!_0x315841['secret']){var _0x2fb697;_0x2c7994[_0x14b7('0x1a')]['find']({'where':{'id':_0x315841['SmsAccountId']},'raw':!![]})[_0x14b7('0x1b')](function(_0x70e586){_0x2fb697=_0x70e586;if(_0x2fb697&&_0x2fb697[_0x14b7('0x1c')]){switch(_0x2fb697['type']){case'twilio':var _0x172c56=require(_0x14b7('0x1d'));if(_0x2fb697[_0x14b7('0x1e')]&&_0x2fb697[_0x14b7('0x1f')]&&_0x2fb697[_0x14b7('0x20')]){var _0x4b3c9f=new _0x172c56(_0x2fb697[_0x14b7('0x1e')],_0x2fb697['authToken']);_0x4b3c9f['messages'][_0x14b7('0x21')]({'body':_0x315841[_0x14b7('0xc')],'to':_0x315841['phone'],'from':_0x2fb697['phone'],'statusCallback':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+_0x14b7('0x24')+_0x2fb697['token']})['then'](function(_0x3c79e3){if(_0x3c79e3[_0x14b7('0x25')]){return _0x4d13a2[_0x14b7('0x16')]({'messageId':_0x3c79e3[_0x14b7('0x25')]});}})['catch'](function(_0x8df0c4){logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate','twilio',util['inspect'](_0x8df0c4,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'twilio',_0x14b7('0x28'));}break;case'skebby':var _0x17ad1f='https://api.skebby.it/API/v1.0/REST/';if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697[_0x14b7('0x2a')]){var _0x54e31f={'recipient':[_0x315841[_0x14b7('0x20')]],'message':_0x315841[_0x14b7('0xc')],'message_type':_0x2fb697['smsMethod']};if(_0x2fb697[_0x14b7('0x2b')]&&_0x2fb697[_0x14b7('0x2b')]!=='SI'){_0x54e31f[_0x14b7('0x2c')]=_0x2fb697[_0x14b7('0x20')];}var _0x170e2f={'url':_0x17ad1f+_0x14b7('0x2d')+_0x2fb697[_0x14b7('0x29')]+_0x14b7('0x2e')+_0x2fb697[_0x14b7('0x2a')],'method':_0x14b7('0x2f')};rp(_0x170e2f)[_0x14b7('0x1b')](function(_0x1a44fd){var _0x1e7893=_0x1a44fd['split'](';');var _0x444070={'user_key':_0x1e7893[0x0],'session_key':_0x1e7893[0x1]};_0x170e2f={'url':_0x17ad1f+'sms','method':_0x14b7('0x30'),'headers':{'user_key':_0x444070[_0x14b7('0x31')],'Session_key':_0x444070[_0x14b7('0x32')]},'json':!![],'body':_0x54e31f};return rp(_0x170e2f);})['then'](function(_0x947912){if(_0x947912[_0x14b7('0x33')]>=0x1){var _0x4c43fb={'messageId':_0x947912['internal_order_id']};if(_0x2fb697[_0x14b7('0x2b')]!=='GP'||!_0x2fb697[_0x14b7('0x34')]){_0x4c43fb[_0x14b7('0x35')]=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x4c43fb);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x36'),util['inspect'](_0x947912,{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x53afa5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),_0x14b7('0x36'),util[_0x14b7('0x37')](_0x53afa5,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x36'),_0x14b7('0x38'));}break;case _0x14b7('0x39'):if(_0x2fb697[_0x14b7('0x1f')]){var _0x452a8f={'recipient':_0x315841[_0x14b7('0x20')],'message':_0x315841[_0x14b7('0xc')],'sender':_0x2fb697[_0x14b7('0x3a')]||_0x2fb697[_0x14b7('0x20')],'authorization':_0x2fb697[_0x14b7('0x1f')]};var _0x19459d={'method':_0x14b7('0x30'),'uri':_0x14b7('0x3b'),'body':_0x452a8f,'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x3e1d0e){var _0x569a08={'messageId':_0x3e1d0e[_0x14b7('0x3c')]};if(!_0x2fb697[_0x14b7('0x34')]){_0x569a08[_0x14b7('0x35')]=!![];}return _0x4d13a2['update'](_0x569a08);})[_0x14b7('0x18')](function(_0x55d525){logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x39'),util[_0x14b7('0x37')](_0x55d525,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),_0x14b7('0x39'),_0x14b7('0x3d'));}break;case _0x14b7('0x3e'):if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697['password']){var _0x452a8f={'messages':[{'source':_0x14b7('0x3f'),'to':_0x315841[_0x14b7('0x20')],'body':_0x315841[_0x14b7('0xc')],'from':_0x2fb697['senderString']||_0x2fb697[_0x14b7('0x20')]}]};var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x29')],_0x2fb697[_0x14b7('0x2a')]);var _0x19459d={'method':'POST','uri':_0x14b7('0x42'),'body':_0x452a8f,'headers':{'Authorization':util[_0x14b7('0x40')](_0x14b7('0x43'),new Buffer(_0x13f048)[_0x14b7('0x44')](_0x14b7('0x45')))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x24c928){if(_0x24c928[_0x14b7('0x46')]>=0xc8&&_0x24c928[_0x14b7('0x46')]<=0xce){if(_0x24c928[_0x14b7('0x47')]&&_0x24c928[_0x14b7('0x47')][_0x14b7('0x48')]>0x0){var _0x5f92c5=_[_0x14b7('0x49')](_0x24c928[_0x14b7('0x47')]['messages']);var _0x4a4b9e={'messageId':_0x5f92c5[_0x14b7('0x4a')]};if(!_0x2fb697['deliveryReport']){_0x4a4b9e['read']=!![];}return _0x4d13a2['update'](_0x4a4b9e);}else{logger['error'](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4b'),util[_0x14b7('0x37')](_0x24c928,{'showHidden':![],'depth':null}));}}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4b'),util[_0x14b7('0x37')](_0x24c928,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e28eb){logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x14b7('0x37')](_0x4e28eb,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x4b'),_0x14b7('0x38'));}break;case _0x14b7('0x4c'):if(_0x2fb697[_0x14b7('0x4d')]&&_0x2fb697[_0x14b7('0x1f')]){var _0x452a8f={'dst':_0x315841['phone'],'text':_0x315841[_0x14b7('0xc')],'src':_0x2fb697[_0x14b7('0x3a')]||_0x2fb697[_0x14b7('0x20')],'url':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+_0x14b7('0x24')+_0x2fb697[_0x14b7('0x4e')]};var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x4d')],_0x2fb697[_0x14b7('0x1f')]);var _0x19459d={'method':_0x14b7('0x30'),'uri':util[_0x14b7('0x40')](_0x14b7('0x4f'),_0x2fb697[_0x14b7('0x4d')]),'body':_0x452a8f,'headers':{'Authorization':util[_0x14b7('0x40')]('Basic\x20%s',new Buffer(_0x13f048)[_0x14b7('0x44')]('base64'))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x34d9b9){var _0x5c7fab={'messageId':_0x34d9b9[_0x14b7('0x50')][0x0]};return _0x4d13a2[_0x14b7('0x16')](_0x5c7fab);})[_0x14b7('0x18')](function(_0x421e5d){logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4c'),util[_0x14b7('0x37')](_0x421e5d,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x4c'),_0x14b7('0x51'));}break;case _0x14b7('0x52'):if(_0x2fb697['username']&&_0x2fb697[_0x14b7('0x2a')]){if(_0x2fb697[_0x14b7('0x53')]){var _0x4cead1={'method':_0x14b7('0x30'),'uri':_0x2fb697[_0x14b7('0x53')]+'/auth/1/session','body':{'username':_0x2fb697[_0x14b7('0x29')],'password':_0x2fb697[_0x14b7('0x2a')]},'json':!![]};return rp(_0x4cead1)[_0x14b7('0x1b')](function(_0xbba1dd){var _0x4c8779={'method':_0x14b7('0x30'),'uri':_0x2fb697[_0x14b7('0x53')]+_0x14b7('0x54'),'body':{'messages':[{'from':_0x2fb697[_0x14b7('0x20')],'destinations':[{'to':_0x315841['phone']}],'text':_0x315841[_0x14b7('0xc')],'notifyUrl':_0x2fb697[_0x14b7('0x22')]+_0x14b7('0x23')+_0x315841['id']+'/status?token='+_0x2fb697[_0x14b7('0x4e')],'notifyContentType':_0x14b7('0x55'),'callbackData':_0x2fb697[_0x14b7('0x20')]+';'+_0x315841[_0x14b7('0xc')]}]},'headers':{'Authorization':_0x14b7('0x56')+_0xbba1dd[_0x14b7('0x4e')]},'json':!![]};return rp(_0x4c8779)[_0x14b7('0x1b')](function(_0x2feb8b){if(_0x2feb8b[_0x14b7('0x57')]){var _0x55089b={'messageId':_0x2feb8b[_0x14b7('0x57')][0x0]['messageId']};if(!_0x2fb697[_0x14b7('0x34')]){_0x55089b['read']=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x55089b);}else{return logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x14b7('0x37')](_0x2feb8b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x7b0f5d){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x52'),util['inspect'](_0x7b0f5d,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),'infobip',_0x14b7('0x58'));}}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x52'),_0x14b7('0x38'));}break;case _0x14b7('0x59'):var _0x58e63c=require(_0x14b7('0x5a'));if(_0x2fb697['apiKey']){var _0x58569c={};_0x58569c[_0x14b7('0x5b')]=_0x2fb697[_0x14b7('0x29')];_0x58569c[_0x14b7('0x20')]=_0x315841[_0x14b7('0x20')];_0x58569c[_0x14b7('0x2c')]=_0x2fb697['phone'];_0x58569c[_0x14b7('0x5c')]=_0x315841[_0x14b7('0xc')];_0x58569c[_0x14b7('0x5d')]=+new Date();var _0x4b5676='';var _0x3108a6='';var _0x38b672=Object[_0x14b7('0x5e')](_0x58569c);_0x38b672[_0x14b7('0x5f')]();for(var _0x4f0796=0x0;_0x4f0796<_0x38b672[_0x14b7('0x60')];_0x4f0796++){if(_0x4b5676!=''){_0x4b5676+='&';}_0x4b5676+=_0x38b672[_0x4f0796]+'='+encodeURIComponent(_0x58569c[_0x38b672[_0x4f0796]]);_0x3108a6+=_0x58569c[_0x38b672[_0x4f0796]];}_0x3108a6+=_0x2fb697['apiKey'];_0x3108a6=_0x58e63c[_0x14b7('0x61')](_0x14b7('0x62'))['update'](_0x3108a6)[_0x14b7('0x63')](_0x14b7('0x64'));if(_0x4b5676!==''){_0x4b5676+='&';}_0x4b5676+=_0x14b7('0x65')+_0x3108a6;var _0x170e2f={'method':_0x14b7('0x2f'),'uri':_0x2fb697[_0x14b7('0x53')]+'/external/get/send.php?'+_0x4b5676,'json':!![]};return rp(_0x170e2f)['then'](function(_0x4db376){var _0x39143f=Object[_0x14b7('0x5e')](_0x4db376);if(_0x4db376[_0x39143f[0x0]][_0x14b7('0x19')]&&parseInt(_0x4db376[_0x39143f[0x0]][_0x14b7('0x19')])===0x0){var _0x2e72fa={'messageId':_0x4db376[_0x39143f[0x0]]['id_sms']};if(!_0x2fb697['deliveryReport']){_0x2e72fa[_0x14b7('0x35')]=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x2e72fa);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x59'),util['inspect'](_0x4db376[_0x14b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x432294){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x59'),util['inspect'](_0x432294,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14b7('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x14b7('0x66'):if(_0x2fb697['apiKey']){var _0x2a30aa={'method':_0x14b7('0x30'),'uri':_0x14b7('0x67'),'headers':{'Authorization':_0x2fb697['apiKey']},'body':{'content':_0x315841[_0x14b7('0xc')],'to':[_0x315841[_0x14b7('0x20')]],'from':_0x2fb697[_0x14b7('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x14b7('0x68')},'json':!![]};rp(_0x2a30aa)[_0x14b7('0x1b')](function(_0x17645a){if(!_0x17645a[_0x14b7('0x19')]){var _0x10a8f9={'messageId':_0x17645a['messages'][0x0]['apiMessageId']};if(!_0x2fb697[_0x14b7('0x34')]){_0x10a8f9['read']=!![];}return _0x4d13a2[_0x14b7('0x16')](_0x10a8f9);}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'clickatell',util['inspect'](_0x17645a[_0x14b7('0x19')],{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x3d4068){return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x66'),util[_0x14b7('0x37')](_0x3d4068,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0x14b7('0x69'):if(_0x2fb697[_0x14b7('0x29')]&&_0x2fb697[_0x14b7('0x2a')]){var _0x13f048=util[_0x14b7('0x40')](_0x14b7('0x41'),_0x2fb697[_0x14b7('0x29')],_0x2fb697[_0x14b7('0x2a')]);var _0x19459d={'method':_0x14b7('0x30'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2fb697[_0x14b7('0x6a')]+_0x14b7('0x6b'),'body':{'to':[_0x315841['phone']],'text':_0x315841[_0x14b7('0xc')],'from':_0x2fb697['phone'],'applicationId':_0x2fb697['applicationId']},'headers':{'Authorization':util[_0x14b7('0x40')](_0x14b7('0x43'),new Buffer(_0x13f048)['toString']('base64'))},'json':!![]};rp(_0x19459d)[_0x14b7('0x1b')](function(_0x47bb3a){if(_0x47bb3a['id']){var _0x27abbf={'messageId':_0x47bb3a['id']};return _0x4d13a2['update'](_0x27abbf);}else{logger['error'](_0x14b7('0x26'),'afterCreate',_0x14b7('0x69'),util[_0x14b7('0x37')](_0x47bb3a,{'showHidden':![],'depth':null}));}})[_0x14b7('0x18')](function(_0x2756ae){logger[_0x14b7('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x14b7('0x27'),'bandwidth',util[_0x14b7('0x37')](_0x2756ae,{'showHidden':![],'depth':null}));});}else{logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x14b7('0x6c'):if(_0x2fb697[_0x14b7('0x6d')]){var _0x23ef6f={};var _0x170e2f={'method':_0x14b7('0x30'),'uri':_0x14b7('0x6e'),'headers':{'Authorization':_0x14b7('0x6f')+_0x2fb697[_0x14b7('0x6d')],'Content-Type':_0x14b7('0x55')},'body':{'from':_0x2fb697['phone'],'to':_0x315841[_0x14b7('0x20')],'text':_0x315841[_0x14b7('0xc')]},'json':!![]};return rp(_0x170e2f)[_0x14b7('0x1b')](function(_0xa4de67){if(_0xa4de67[_0x14b7('0x70')]==0xca){_0x23ef6f[_0x14b7('0x71')]=_0xa4de67;var _0x216725={'method':_0x14b7('0x30'),'uri':_0x14b7('0x72'),'headers':{'Authorization':_0x14b7('0x6f')+_0x2fb697['apiKey'],'Content-Type':_0x14b7('0x55')},'body':{'refid':_0x23ef6f[_0x14b7('0x71')][_0x14b7('0x73')]},'json':!![]};return rp(_0x216725)[_0x14b7('0x1b')](function(_0x464c9b){_0x23ef6f[_0x14b7('0x74')]=_0x464c9b;var _0xcd0f2a={'messageId':_0x23ef6f['message'][_0x14b7('0x73')],'read':!![]};return _0x4d13a2[_0x14b7('0x16')](_0xcd0f2a);});}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),'afterCreate',_0x14b7('0x6c'),util[_0x14b7('0x37')](_0xa4de67,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5518f5){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x14b7('0x6c'),util[_0x14b7('0x37')](_0x5518f5,{'showHidden':![],'depth':null}));});}else{return logger[_0x14b7('0x19')](_0x14b7('0x26'),_0x14b7('0x27'),_0x14b7('0x6c'),_0x14b7('0x75'));}break;}}})[_0x14b7('0x76')](function(){_0x32c32f();});}else{_0x32c32f();}}},'charset':_0x14b7('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3db0=['smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','text','timestamp','keys','sort','length','md5','digest','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','rimraf','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','update','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','username','password'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x3db0,0x1a6));var _0x03db=function(_0x214a7b,_0x4e7847){_0x214a7b=_0x214a7b-0x0;var _0x36c004=_0x3db0[_0x214a7b];return _0x36c004;};'use strict';var _=require(_0x03db('0x0'));var util=require('util');var logger=require(_0x03db('0x1'))('api');var moment=require(_0x03db('0x2'));var BPromise=require(_0x03db('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x03db('0x4'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x03db('0x5')]=function(_0x184fa,_0x5582ba){return _0x184fa[_0x03db('0x6')](_0x03db('0x7'),attributes,{'tableName':_0x03db('0x8'),'paranoid':![],'indexes':[{'name':_0x03db('0x9'),'fields':[_0x03db('0x9')]},{'name':_0x03db('0xa'),'fields':[_0x03db('0xb')],'type':_0x03db('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22b3f8,_0x153059,_0x1a9caf){var _0x1265dc=_0x184fa[_0x03db('0xd')];var _0x3709cb=_0x22b3f8[_0x03db('0xe')]({'plain':!![]});if(_0x3709cb[_0x03db('0xf')][_0x03db('0x10')]()==='in'||_0x3709cb[_0x03db('0xf')][_0x03db('0x10')]()===_0x03db('0x11')&&!_0x3709cb[_0x03db('0x12')]&&!_[_0x03db('0x13')](_0x3709cb['UserId'])&&!_[_0x03db('0x13')](_0x3709cb[_0x03db('0x14')])){_0x1265dc[_0x03db('0x15')][_0x03db('0x16')]({'where':{'id':_0x3709cb[_0x03db('0x14')]}})[_0x03db('0x17')](function(_0x193556){if(_0x193556){_0x193556['update']({'lastMsgAt':_0x3709cb[_0x03db('0x18')],'lastMsgDirection':_0x3709cb[_0x03db('0xf')][_0x03db('0x10')]()});}})[_0x03db('0x19')](function(_0x764f7a){console[_0x03db('0x1a')](_0x764f7a);});}if(_0x3709cb[_0x03db('0xf')]==='out'&&!_0x3709cb[_0x03db('0x12')]){var _0xa82b3e;_0x1265dc['SmsAccount']['find']({'where':{'id':_0x3709cb[_0x03db('0x1b')]},'raw':!![]})['then'](function(_0x102e3b){_0xa82b3e=_0x102e3b;if(_0xa82b3e&&_0xa82b3e[_0x03db('0x1c')]){switch(_0xa82b3e[_0x03db('0x1c')]){case _0x03db('0x1d'):var _0x14c66c=require('twilio');if(_0xa82b3e[_0x03db('0x1e')]&&_0xa82b3e[_0x03db('0x1f')]&&_0xa82b3e[_0x03db('0x20')]){var _0x1eaaa2=new _0x14c66c(_0xa82b3e[_0x03db('0x1e')],_0xa82b3e[_0x03db('0x1f')]);_0x1eaaa2[_0x03db('0x21')][_0x03db('0x22')]({'body':_0x3709cb[_0x03db('0xb')],'to':_0x3709cb[_0x03db('0x20')],'from':_0xa82b3e['phone'],'statusCallback':_0xa82b3e[_0x03db('0x23')]+_0x03db('0x24')+_0x3709cb['id']+'/status?token='+_0xa82b3e[_0x03db('0x25')]})[_0x03db('0x17')](function(_0x3a819c){if(_0x3a819c[_0x03db('0x26')]){return _0x22b3f8[_0x03db('0x27')]({'messageId':_0x3a819c[_0x03db('0x26')]});}})[_0x03db('0x19')](function(_0xaa08e7){logger[_0x03db('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x03db('0x28'),_0x03db('0x1d'),util[_0x03db('0x29')](_0xaa08e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x03db('0x2a'),'afterCreate',_0x03db('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x03db('0x2b'):var _0x1b35fc='https://api.skebby.it/API/v1.0/REST/';if(_0xa82b3e[_0x03db('0x2c')]&&_0xa82b3e[_0x03db('0x2d')]){var _0x4cf49e={'recipient':[_0x3709cb[_0x03db('0x20')]],'message':_0x3709cb[_0x03db('0xb')],'message_type':_0xa82b3e[_0x03db('0x2e')]};if(_0xa82b3e[_0x03db('0x2e')]&&_0xa82b3e['smsMethod']!=='SI'){_0x4cf49e[_0x03db('0x2f')]=_0xa82b3e[_0x03db('0x20')];}var _0x3eb606={'url':_0x1b35fc+_0x03db('0x30')+_0xa82b3e[_0x03db('0x2c')]+_0x03db('0x31')+_0xa82b3e['password'],'method':_0x03db('0x32')};rp(_0x3eb606)['then'](function(_0xeb29f5){var _0x1238b6=_0xeb29f5[_0x03db('0x33')](';');var _0x3df378={'user_key':_0x1238b6[0x0],'session_key':_0x1238b6[0x1]};_0x3eb606={'url':_0x1b35fc+_0x03db('0x34'),'method':_0x03db('0x35'),'headers':{'user_key':_0x3df378[_0x03db('0x36')],'Session_key':_0x3df378[_0x03db('0x37')]},'json':!![],'body':_0x4cf49e};return rp(_0x3eb606);})['then'](function(_0x472938){if(_0x472938['total_sent']>=0x1){var _0x4f031d={'messageId':_0x472938['internal_order_id']};if(_0xa82b3e[_0x03db('0x2e')]!=='GP'||!_0xa82b3e[_0x03db('0x38')]){_0x4f031d[_0x03db('0x39')]=!![];}return _0x22b3f8[_0x03db('0x27')](_0x4f031d);}else{return logger[_0x03db('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util['inspect'](_0x472938,{'showHidden':![],'depth':null}));}})['catch'](function(_0x139539){return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x2b'),util[_0x03db('0x29')](_0x139539,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x03db('0x28'),'skebby',_0x03db('0x3a'));}break;case _0x03db('0x3b'):if(_0xa82b3e['authToken']){var _0x4079a4={'recipient':_0x3709cb[_0x03db('0x20')],'message':_0x3709cb[_0x03db('0xb')],'sender':_0xa82b3e[_0x03db('0x3c')]||_0xa82b3e[_0x03db('0x20')],'authorization':_0xa82b3e[_0x03db('0x1f')]};var _0x153059={'method':_0x03db('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x4079a4,'json':!![]};rp(_0x153059)[_0x03db('0x17')](function(_0x33bc9e){var _0x312cd2={'messageId':_0x33bc9e['requestid']};if(!_0xa82b3e['deliveryReport']){_0x312cd2['read']=!![];}return _0x22b3f8[_0x03db('0x27')](_0x312cd2);})[_0x03db('0x19')](function(_0x413203){logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),'connectel',util[_0x03db('0x29')](_0x413203,{'showHidden':![],'depth':null}));});}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),'afterCreate',_0x03db('0x3b'),_0x03db('0x3d'));}break;case _0x03db('0x3e'):if(_0xa82b3e['username']&&_0xa82b3e[_0x03db('0x2d')]){var _0x4079a4={'messages':[{'source':_0x03db('0x3f'),'to':_0x3709cb[_0x03db('0x20')],'body':_0x3709cb[_0x03db('0xb')],'from':_0xa82b3e['senderString']||_0xa82b3e[_0x03db('0x20')]}]};var _0x22358d=util[_0x03db('0x40')](_0x03db('0x41'),_0xa82b3e['username'],_0xa82b3e[_0x03db('0x2d')]);var _0x153059={'method':_0x03db('0x35'),'uri':_0x03db('0x42'),'body':_0x4079a4,'headers':{'Authorization':util[_0x03db('0x40')](_0x03db('0x43'),new Buffer(_0x22358d)[_0x03db('0x44')]('base64'))},'json':!![]};rp(_0x153059)[_0x03db('0x17')](function(_0x2a5817){if(_0x2a5817[_0x03db('0x45')]>=0xc8&&_0x2a5817[_0x03db('0x45')]<=0xce){if(_0x2a5817[_0x03db('0x46')]&&_0x2a5817['data'][_0x03db('0x47')]>0x0){var _0x5be1c1=_[_0x03db('0x48')](_0x2a5817['data'][_0x03db('0x21')]);var _0x50cd60={'messageId':_0x5be1c1[_0x03db('0x49')]};if(!_0xa82b3e[_0x03db('0x38')]){_0x50cd60[_0x03db('0x39')]=!![];}return _0x22b3f8['update'](_0x50cd60);}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x4a'),util[_0x03db('0x29')](_0x2a5817,{'showHidden':![],'depth':null}));}}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),'clickSend',util['inspect'](_0x2a5817,{'showHidden':![],'depth':null}));}})[_0x03db('0x19')](function(_0x18cfb0){logger[_0x03db('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x03db('0x28'),'clickSend',util[_0x03db('0x29')](_0x18cfb0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x03db('0x4b'):if(_0xa82b3e[_0x03db('0x4c')]&&_0xa82b3e[_0x03db('0x1f')]){var _0x4079a4={'dst':_0x3709cb[_0x03db('0x20')],'text':_0x3709cb['body'],'src':_0xa82b3e[_0x03db('0x3c')]||_0xa82b3e[_0x03db('0x20')],'url':_0xa82b3e[_0x03db('0x23')]+_0x03db('0x24')+_0x3709cb['id']+_0x03db('0x4d')+_0xa82b3e[_0x03db('0x25')]};var _0x22358d=util[_0x03db('0x40')](_0x03db('0x41'),_0xa82b3e[_0x03db('0x4c')],_0xa82b3e[_0x03db('0x1f')]);var _0x153059={'method':_0x03db('0x35'),'uri':util[_0x03db('0x40')](_0x03db('0x4e'),_0xa82b3e[_0x03db('0x4c')]),'body':_0x4079a4,'headers':{'Authorization':util[_0x03db('0x40')]('Basic\x20%s',new Buffer(_0x22358d)['toString'](_0x03db('0x4f')))},'json':!![]};rp(_0x153059)[_0x03db('0x17')](function(_0x1e9e26){var _0x5a7159={'messageId':_0x1e9e26[_0x03db('0x50')][0x0]};return _0x22b3f8[_0x03db('0x27')](_0x5a7159);})[_0x03db('0x19')](function(_0x4e80af){logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x4b'),util[_0x03db('0x29')](_0x4e80af,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x4b'),_0x03db('0x51'));}break;case _0x03db('0x52'):if(_0xa82b3e[_0x03db('0x2c')]&&_0xa82b3e['password']){if(_0xa82b3e[_0x03db('0x53')]){var _0x53ae82={'method':_0x03db('0x35'),'uri':_0xa82b3e[_0x03db('0x53')]+_0x03db('0x54'),'body':{'username':_0xa82b3e['username'],'password':_0xa82b3e[_0x03db('0x2d')]},'json':!![]};return rp(_0x53ae82)[_0x03db('0x17')](function(_0x5a6653){var _0x2fbb10={'method':'POST','uri':_0xa82b3e[_0x03db('0x53')]+_0x03db('0x55'),'body':{'messages':[{'from':_0xa82b3e[_0x03db('0x20')],'destinations':[{'to':_0x3709cb[_0x03db('0x20')]}],'text':_0x3709cb[_0x03db('0xb')],'notifyUrl':_0xa82b3e[_0x03db('0x23')]+_0x03db('0x24')+_0x3709cb['id']+'/status?token='+_0xa82b3e[_0x03db('0x25')],'notifyContentType':'application/json','callbackData':_0xa82b3e[_0x03db('0x20')]+';'+_0x3709cb[_0x03db('0xb')]}]},'headers':{'Authorization':_0x03db('0x56')+_0x5a6653['token']},'json':!![]};return rp(_0x2fbb10)[_0x03db('0x17')](function(_0x11b46e){if(_0x11b46e['messages']){var _0x3455a7={'messageId':_0x11b46e['messages'][0x0][_0x03db('0x9')]};if(!_0xa82b3e[_0x03db('0x38')]){_0x3455a7[_0x03db('0x39')]=!![];}return _0x22b3f8[_0x03db('0x27')](_0x3455a7);}else{return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),'infobip',util[_0x03db('0x29')](_0x11b46e,{'showHidden':![],'depth':null}));}});})[_0x03db('0x19')](function(_0x20cb9f){return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x52'),util[_0x03db('0x29')](_0x20cb9f,{'showHidden':![],'depth':null}));});}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x52'),_0x03db('0x57'));}}else{logger[_0x03db('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x03db('0x28'),_0x03db('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x4e3fb4=require(_0x03db('0x58'));if(_0xa82b3e[_0x03db('0x59')]){var _0x2aae4f={};_0x2aae4f['login']=_0xa82b3e[_0x03db('0x2c')];_0x2aae4f['phone']=_0x3709cb[_0x03db('0x20')];_0x2aae4f[_0x03db('0x2f')]=_0xa82b3e[_0x03db('0x20')];_0x2aae4f[_0x03db('0x5a')]=_0x3709cb[_0x03db('0xb')];_0x2aae4f[_0x03db('0x5b')]=+new Date();var _0x33a562='';var _0x4d5f48='';var _0x1b4505=Object[_0x03db('0x5c')](_0x2aae4f);_0x1b4505[_0x03db('0x5d')]();for(var _0x469258=0x0;_0x469258<_0x1b4505[_0x03db('0x5e')];_0x469258++){if(_0x33a562!=''){_0x33a562+='&';}_0x33a562+=_0x1b4505[_0x469258]+'='+encodeURIComponent(_0x2aae4f[_0x1b4505[_0x469258]]);_0x4d5f48+=_0x2aae4f[_0x1b4505[_0x469258]];}_0x4d5f48+=_0xa82b3e[_0x03db('0x59')];_0x4d5f48=_0x4e3fb4['createHash'](_0x03db('0x5f'))['update'](_0x4d5f48)[_0x03db('0x60')]('hex');if(_0x33a562!==''){_0x33a562+='&';}_0x33a562+='signature='+_0x4d5f48;var _0x3eb606={'method':_0x03db('0x32'),'uri':_0xa82b3e[_0x03db('0x53')]+'/external/get/send.php?'+_0x33a562,'json':!![]};return rp(_0x3eb606)[_0x03db('0x17')](function(_0x115802){var _0x2beb30=Object[_0x03db('0x5c')](_0x115802);if(_0x115802[_0x2beb30[0x0]]['error']&&parseInt(_0x115802[_0x2beb30[0x0]][_0x03db('0x1a')])===0x0){var _0xdfcd3f={'messageId':_0x115802[_0x2beb30[0x0]][_0x03db('0x61')]};if(!_0xa82b3e[_0x03db('0x38')]){_0xdfcd3f[_0x03db('0x39')]=!![];}return _0x22b3f8[_0x03db('0x27')](_0xdfcd3f);}else{return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x62'),util['inspect'](_0x115802[_0x03db('0x1a')],{'showHidden':![],'depth':null}));}})[_0x03db('0x19')](function(_0x1f0891){return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x62'),util[_0x03db('0x29')](_0x1f0891,{'showHidden':![],'depth':null}));});}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),'afterCreate',_0x03db('0x62'),_0x03db('0x63'));}break;case _0x03db('0x64'):if(_0xa82b3e[_0x03db('0x59')]){var _0x146d7f={'method':_0x03db('0x35'),'uri':_0x03db('0x65'),'headers':{'Authorization':_0xa82b3e['apiKey']},'body':{'content':_0x3709cb[_0x03db('0xb')],'to':[_0x3709cb['phone']],'from':_0xa82b3e[_0x03db('0x20')],'binary':![],'clientMessageId':_0x03db('0x66'),'charset':_0x03db('0x67')},'json':!![]};rp(_0x146d7f)[_0x03db('0x17')](function(_0x5bc0c8){if(!_0x5bc0c8[_0x03db('0x1a')]){var _0x26ee0f={'messageId':_0x5bc0c8['messages'][0x0]['apiMessageId']};if(!_0xa82b3e[_0x03db('0x38')]){_0x26ee0f[_0x03db('0x39')]=!![];}return _0x22b3f8[_0x03db('0x27')](_0x26ee0f);}else{return logger['error'](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x64'),util['inspect'](_0x5bc0c8['error'],{'showHidden':![],'depth':null}));}})[_0x03db('0x19')](function(_0x14ab45){return logger[_0x03db('0x1a')](_0x03db('0x2a'),'afterCreate',_0x03db('0x64'),util['inspect'](_0x14ab45,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x64'),_0x03db('0x63'));}break;case _0x03db('0x68'):if(_0xa82b3e['username']&&_0xa82b3e[_0x03db('0x2d')]){var _0x22358d=util[_0x03db('0x40')](_0x03db('0x41'),_0xa82b3e[_0x03db('0x2c')],_0xa82b3e[_0x03db('0x2d')]);var _0x153059={'method':'POST','uri':_0x03db('0x69')+_0xa82b3e['accountId']+_0x03db('0x6a'),'body':{'to':[_0x3709cb['phone']],'text':_0x3709cb[_0x03db('0xb')],'from':_0xa82b3e[_0x03db('0x20')],'applicationId':_0xa82b3e[_0x03db('0x6b')]},'headers':{'Authorization':util['format'](_0x03db('0x43'),new Buffer(_0x22358d)[_0x03db('0x44')]('base64'))},'json':!![]};rp(_0x153059)['then'](function(_0x272ff6){if(_0x272ff6['id']){var _0xef2a1f={'messageId':_0x272ff6['id']};return _0x22b3f8['update'](_0xef2a1f);}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),'afterCreate','bandwidth',util[_0x03db('0x29')](_0x272ff6,{'showHidden':![],'depth':null}));}})[_0x03db('0x19')](function(_0x141b8a){logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x68'),util[_0x03db('0x29')](_0x141b8a,{'showHidden':![],'depth':null}));});}else{logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x68'),_0x03db('0x3a'));}break;case'intelepeer':if(_0xa82b3e[_0x03db('0x59')]){var _0x28de13={};var _0x3eb606={'method':_0x03db('0x35'),'uri':_0x03db('0x6c'),'headers':{'Authorization':_0x03db('0x6d')+_0xa82b3e['apiKey'],'Content-Type':_0x03db('0x6e')},'body':{'from':_0xa82b3e[_0x03db('0x20')],'to':_0x3709cb[_0x03db('0x20')],'text':_0x3709cb[_0x03db('0xb')]},'json':!![]};return rp(_0x3eb606)[_0x03db('0x17')](function(_0x6d8508){if(_0x6d8508['code']==0xca){_0x28de13[_0x03db('0x6f')]=_0x6d8508;var _0x5ca69e={'method':_0x03db('0x35'),'uri':_0x03db('0x70'),'headers':{'Authorization':_0x03db('0x6d')+_0xa82b3e[_0x03db('0x59')],'Content-Type':_0x03db('0x6e')},'body':{'refid':_0x28de13[_0x03db('0x6f')][_0x03db('0x71')]},'json':!![]};return rp(_0x5ca69e)[_0x03db('0x17')](function(_0x1080d1){_0x28de13['status']=_0x1080d1;var _0x5f3648={'messageId':_0x28de13[_0x03db('0x6f')][_0x03db('0x71')],'read':!![]};return _0x22b3f8['update'](_0x5f3648);});}else{return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),'intelepeer',util['inspect'](_0x6d8508,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3ad7d6){return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x72'),util[_0x03db('0x29')](_0x3ad7d6,{'showHidden':![],'depth':null}));});}else{return logger[_0x03db('0x1a')](_0x03db('0x2a'),_0x03db('0x28'),_0x03db('0x72'),'Token\x20not\x20received');}break;}}})[_0x03db('0x73')](function(){_0x1a9caf();});}else{_0x1a9caf();}}},'charset':_0x03db('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ee59772..c281d13 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 _0x29ef=['SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','localhost','socket.io-emitter','redis','register','request','then'];(function(_0x315aea,_0x318a80){var _0x4a4bdb=function(_0x7c049c){while(--_0x7c049c){_0x315aea['push'](_0x315aea['shift']());}};_0x4a4bdb(++_0x318a80);}(_0x29ef,0x14d));var _0xf29e=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x29ef[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xf29e('0x0'));var util=require(_0xf29e('0x1'));var moment=require('moment');var BPromise=require(_0xf29e('0x2'));var rs=require(_0xf29e('0x3'));var fs=require('fs');var Redis=require(_0xf29e('0x4'));var db=require(_0xf29e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf29e('0x6'))('rpc');var config=require(_0xf29e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29e('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xf29e('0x9'),'port':0x18eb});var socket=require(_0xf29e('0xa'))(new Redis(config[_0xf29e('0xb')]));require('./smsMessage.socket')[_0xf29e('0xc')](socket);function respondWithRpcPromise(_0x17c069,_0x225a03,_0xc98e67){return new BPromise(function(_0x502cbd,_0x295d1c){return client[_0xf29e('0xd')](_0x17c069,_0xc98e67)[_0xf29e('0xe')](function(_0xe86ca7){logger['info'](_0xf29e('0xf'),_0x225a03,_0xf29e('0x10'));logger[_0xf29e('0x11')](_0xf29e('0x12'),_0x225a03,_0xf29e('0x10'),JSON['stringify'](_0xe86ca7));if(_0xe86ca7[_0xf29e('0x13')]){if(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x14')]===0x1f4){logger[_0xf29e('0x13')](_0xf29e('0xf'),_0x225a03,_0xe86ca7[_0xf29e('0x13')]['message']);return _0x295d1c(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x15')]);}logger[_0xf29e('0x13')](_0xf29e('0xf'),_0x225a03,_0xe86ca7['error'][_0xf29e('0x15')]);return _0x502cbd(_0xe86ca7[_0xf29e('0x13')][_0xf29e('0x15')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x225a03,_0xf29e('0x10'));_0x502cbd(_0xe86ca7['result']['message']);}})[_0xf29e('0x16')](function(_0x29ebbc){logger['error']('SmsMessage,\x20%s,\x20%s',_0x225a03,_0x29ebbc);_0x295d1c(_0x29ebbc);});});}exports[_0xf29e('0x17')]=function(_0x8515e4){var _0x1df09f=this;return new Promise(function(_0xac7ea8,_0x3b8ce9){return db[_0xf29e('0x18')][_0xf29e('0x19')](_0x8515e4[_0xf29e('0x1a')],{'raw':_0x8515e4[_0xf29e('0x1b')]?_0x8515e4[_0xf29e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf29e('0xe')](function(_0x1296cd){logger['info'](_0xf29e('0x17'),_0x8515e4);logger[_0xf29e('0x11')](_0xf29e('0x17'),_0x8515e4,JSON[_0xf29e('0x1c')](_0x1296cd));_0xac7ea8(_0x1296cd);})[_0xf29e('0x16')](function(_0x118faa){logger['error'](_0xf29e('0x17'),_0x118faa[_0xf29e('0x15')],_0x8515e4);_0x3b8ce9(_0x1df09f[_0xf29e('0x13')](0x1f4,_0x118faa['message']));});});}; \ No newline at end of file +var _0x1a04=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify','util','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a04,0x116));var _0x41a0=function(_0x991a92,_0x274a74){_0x991a92=_0x991a92-0x0;var _0x4eca8e=_0x1a04[_0x991a92];return _0x4eca8e;};'use strict';var _=require('lodash');var util=require(_0x41a0('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41a0('0x1'));var db=require(_0x41a0('0x2'))['db'];var utils=require(_0x41a0('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x41a0('0x4'));var jayson=require(_0x41a0('0x5'));var client=jayson[_0x41a0('0x6')]['http']({'port':0x232a});config[_0x41a0('0x7')]=_[_0x41a0('0x8')](config[_0x41a0('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41a0('0x7')]));require(_0x41a0('0x9'))['register'](socket);function respondWithRpcPromise(_0x552476,_0x784dfc,_0x43b540){return new BPromise(function(_0x155477,_0x2d8166){return client[_0x41a0('0xa')](_0x552476,_0x43b540)[_0x41a0('0xb')](function(_0x195fe4){logger[_0x41a0('0xc')](_0x41a0('0xd'),_0x784dfc,_0x41a0('0xe'));logger[_0x41a0('0xf')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x784dfc,_0x41a0('0xe'),JSON['stringify'](_0x195fe4));if(_0x195fe4['error']){if(_0x195fe4[_0x41a0('0x10')][_0x41a0('0x11')]===0x1f4){logger[_0x41a0('0x10')](_0x41a0('0xd'),_0x784dfc,_0x195fe4['error']['message']);return _0x2d8166(_0x195fe4['error'][_0x41a0('0x12')]);}logger[_0x41a0('0x10')](_0x41a0('0xd'),_0x784dfc,_0x195fe4[_0x41a0('0x10')][_0x41a0('0x12')]);return _0x155477(_0x195fe4[_0x41a0('0x10')][_0x41a0('0x12')]);}else{logger[_0x41a0('0xc')]('SmsMessage,\x20%s,\x20%s',_0x784dfc,_0x41a0('0xe'));_0x155477(_0x195fe4[_0x41a0('0x13')][_0x41a0('0x12')]);}})[_0x41a0('0x14')](function(_0x2fdd29){logger['error'](_0x41a0('0xd'),_0x784dfc,_0x2fdd29);_0x2d8166(_0x2fdd29);});});}exports[_0x41a0('0x15')]=function(_0x164bb9){var _0x15bbcd=this;return new Promise(function(_0x19a1ca,_0x138a43){return db[_0x41a0('0x16')][_0x41a0('0x17')](_0x164bb9[_0x41a0('0x18')],{'raw':_0x164bb9['options']?_0x164bb9[_0x41a0('0x19')][_0x41a0('0x1a')]===undefined?!![]:![]:!![]})[_0x41a0('0xb')](function(_0x240c94){logger[_0x41a0('0xc')]('CreateSmsMessage',_0x164bb9);logger[_0x41a0('0xf')](_0x41a0('0x15'),_0x164bb9,JSON[_0x41a0('0x1b')](_0x240c94));_0x19a1ca(_0x240c94);})[_0x41a0('0x14')](function(_0x5e70db){logger['error']('CreateSmsMessage',_0x5e70db[_0x41a0('0x12')],_0x164bb9);_0x138a43(_0x15bbcd[_0x41a0('0x10')](0x1f4,_0x5e70db[_0x41a0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 65dd0a1..a30b362 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 _0x835b=['emit','removeListener','register','length','./smsMessage.events','remove','update'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x835b,0xdd));var _0xb835=function(_0x2e17ee,_0x2ca16d){_0x2e17ee=_0x2e17ee-0x0;var _0x3155ba=_0x835b[_0x2e17ee];return _0x3155ba;};'use strict';var SmsMessageEvents=require(_0xb835('0x0'));var events=['save',_0xb835('0x1'),_0xb835('0x2')];function createListener(_0x2b44cc,_0x3f0959){return function(_0x5c8949){_0x3f0959[_0xb835('0x3')](_0x2b44cc,_0x5c8949);};}function removeListener(_0x4a3518,_0x356115){return function(){SmsMessageEvents[_0xb835('0x4')](_0x4a3518,_0x356115);};}exports[_0xb835('0x5')]=function(_0x3bc867){for(var _0x186354=0x0,_0x2a893a=events[_0xb835('0x6')];_0x186354<_0x2a893a;_0x186354++){var _0x304184=events[_0x186354];var _0x4f4d4f=createListener('smsMessage:'+_0x304184,_0x3bc867);SmsMessageEvents['on'](_0x304184,_0x4f4d4f);}}; \ No newline at end of file +var _0x26f3=['save','remove','update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x5895e8,_0x16dc8f){var _0x33c12b=function(_0x2323ea){while(--_0x2323ea){_0x5895e8['push'](_0x5895e8['shift']());}};_0x33c12b(++_0x16dc8f);}(_0x26f3,0x107));var _0x326f=function(_0x35c2fc,_0xabea37){_0x35c2fc=_0x35c2fc-0x0;var _0x4727fd=_0x26f3[_0x35c2fc];return _0x4727fd;};'use strict';var SmsMessageEvents=require(_0x326f('0x0'));var events=[_0x326f('0x1'),_0x326f('0x2'),_0x326f('0x3')];function createListener(_0x3dba5a,_0x247202){return function(_0x681010){_0x247202[_0x326f('0x4')](_0x3dba5a,_0x681010);};}function removeListener(_0x4e6244,_0x2b6285){return function(){SmsMessageEvents[_0x326f('0x5')](_0x4e6244,_0x2b6285);};}exports['register']=function(_0x36d420){for(var _0x5f48e4=0x0,_0x5e1770=events[_0x326f('0x6')];_0x5f48e4<_0x5e1770;_0x5f48e4++){var _0x3c09eb=events[_0x5f48e4];var _0x33e839=createListener(_0x326f('0x7')+_0x3c09eb,_0x36d420);SmsMessageEvents['on'](_0x3c09eb,_0x33e839);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d2aa3bf..36558c4 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 _0x0ea8=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0ea8,0x97));var _0x80ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0ea8[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x80ea('0x0'));var util=require(_0x80ea('0x1'));var path=require(_0x80ea('0x2'));var timeout=require(_0x80ea('0x3'));var express=require(_0x80ea('0x4'));var router=express[_0x80ea('0x5')]();var fs_extra=require(_0x80ea('0x6'));var auth=require(_0x80ea('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x80ea('0x8'));var controller=require(_0x80ea('0x9'));router[_0x80ea('0xa')]('/',auth[_0x80ea('0xb')](),controller[_0x80ea('0xc')]);router[_0x80ea('0xa')](_0x80ea('0xd'),auth[_0x80ea('0xb')](),controller[_0x80ea('0xe')]);router[_0x80ea('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x80ea('0xf')]);router['get'](_0x80ea('0x10'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x11')]);router[_0x80ea('0xa')](_0x80ea('0x12'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x13')]);router['get'](_0x80ea('0x14'),auth['isAuthenticated'](),controller[_0x80ea('0x15')]);router[_0x80ea('0x16')]('/',auth[_0x80ea('0xb')](),controller['create']);router[_0x80ea('0x16')]('/:id/teams',auth[_0x80ea('0xb')](),controller[_0x80ea('0x17')]);router['post'](_0x80ea('0x14'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x18')]);router[_0x80ea('0x19')](_0x80ea('0x1a'),auth[_0x80ea('0xb')](),controller['update']);router[_0x80ea('0x1b')](_0x80ea('0x1a'),auth['isAuthenticated'](),controller[_0x80ea('0x1c')]);router[_0x80ea('0x1b')](_0x80ea('0x12'),auth[_0x80ea('0xb')](),controller[_0x80ea('0x1d')]);router[_0x80ea('0x1b')]('/:id/users',auth[_0x80ea('0xb')](),controller[_0x80ea('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x27c4=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','create','addAgents','put','update','/:id/teams','delete','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe00bc3,_0x3fda98){var _0x244b89=function(_0x1466fe){while(--_0x1466fe){_0xe00bc3['push'](_0xe00bc3['shift']());}};_0x244b89(++_0x3fda98);}(_0x27c4,0xeb));var _0x427c=function(_0x354667,_0x224d87){_0x354667=_0x354667-0x0;var _0x50bb45=_0x27c4[_0x354667];return _0x50bb45;};'use strict';var multer=require(_0x427c('0x0'));var util=require('util');var path=require(_0x427c('0x1'));var timeout=require(_0x427c('0x2'));var express=require(_0x427c('0x3'));var router=express[_0x427c('0x4')]();var fs_extra=require(_0x427c('0x5'));var auth=require(_0x427c('0x6'));var interaction=require(_0x427c('0x7'));var config=require(_0x427c('0x8'));var controller=require('./smsQueue.controller');router[_0x427c('0x9')]('/',auth[_0x427c('0xa')](),controller[_0x427c('0xb')]);router['get'](_0x427c('0xc'),auth[_0x427c('0xa')](),controller['describe']);router[_0x427c('0x9')](_0x427c('0xd'),auth['isAuthenticated'](),controller[_0x427c('0xe')]);router[_0x427c('0x9')](_0x427c('0xf'),auth[_0x427c('0xa')](),controller[_0x427c('0x10')]);router['get']('/:id/teams',auth[_0x427c('0xa')](),controller[_0x427c('0x11')]);router[_0x427c('0x9')](_0x427c('0x12'),auth[_0x427c('0xa')](),controller['getAgents']);router[_0x427c('0x13')]('/',auth[_0x427c('0xa')](),controller[_0x427c('0x14')]);router['post']('/:id/teams',auth[_0x427c('0xa')](),controller['addTeams']);router['post'](_0x427c('0x12'),auth[_0x427c('0xa')](),controller[_0x427c('0x15')]);router[_0x427c('0x16')](_0x427c('0xd'),auth[_0x427c('0xa')](),controller[_0x427c('0x17')]);router['delete'](_0x427c('0xd'),auth[_0x427c('0xa')](),controller['destroy']);router['delete'](_0x427c('0x18'),auth[_0x427c('0xa')](),controller['removeTeams']);router[_0x427c('0x19')](_0x427c('0x12'),auth[_0x427c('0xa')](),controller[_0x427c('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7aed3e6..fc7f80d 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 _0xcf31=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x38daa6,_0x37ca95){var _0x372625=function(_0x2b8b7c){while(--_0x2b8b7c){_0x38daa6['push'](_0x38daa6['shift']());}};_0x372625(++_0x37ca95);}(_0xcf31,0x96));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1cf3('0x0'));module[_0x1cf3('0x1')]={'name':{'type':Sequelize[_0x1cf3('0x2')],'unique':_0x1cf3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1cf3('0x2')]},'timeout':{'type':Sequelize[_0x1cf3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1cf3('0x5')](_0x1cf3('0x6'),_0x1cf3('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x18db=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x18db,0x1a5));var _0xb18d=function(_0x3a22f4,_0x2e9656){_0x3a22f4=_0x3a22f4-0x0;var _0x26c62b=_0x18db[_0x3a22f4];return _0x26c62b;};'use strict';var Sequelize=require(_0xb18d('0x0'));module[_0xb18d('0x1')]={'name':{'type':Sequelize[_0xb18d('0x2')],'unique':_0xb18d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb18d('0x2')]},'timeout':{'type':Sequelize[_0xb18d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb18d('0x5'),'beepall',_0xb18d('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 520ac51..00e1b45 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(_0x54820c,_0xd5a2f6){var _0x5c60c1=function(_0x495680){while(--_0x495680){_0x54820c['push'](_0x54820c['shift']());}};_0x5c60c1(++_0xd5a2f6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1599c9,_0x172bdb){_0x1599c9=_0x1599c9-0x0;var _0x46b583=_0x5f2f[_0x1599c9];return _0x46b583;};'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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x1ffb41,_0x214beb){var _0x35c6ff=function(_0x62cf5f){while(--_0x62cf5f){_0x1ffb41['push'](_0x1ffb41['shift']());}};_0x35c6ff(++_0x214beb);}(_0x7a54,0x106));var _0x47a5=function(_0x4d027a,_0x9b7ceb){_0x4d027a=_0x4d027a-0x0;var _0x1bf7b7=_0x7a54[_0x4d027a];return _0x1bf7b7;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 52842f5..e69a4b5 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 _0x8b42=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x1090f8,_0xd83a11){var _0x180524=function(_0x109ab8){while(--_0x109ab8){_0x1090f8['push'](_0x1090f8['shift']());}};_0x180524(++_0xd83a11);}(_0x8b42,0x11f));var _0x28b4=function(_0x50e704,_0x1cac35){_0x50e704=_0x50e704-0x0;var _0x21a84a=_0x8b42[_0x50e704];return _0x21a84a;};'use strict';var EventEmitter=require(_0x28b4('0x0'));var SmsQueue=require(_0x28b4('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x28b4('0x2')](0x0);var events={'afterCreate':_0x28b4('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e2e9a){return function(_0x425dab,_0x265026,_0x471ab4){SmsQueueEvents[_0x28b4('0x4')](_0x3e2e9a+':'+_0x425dab['id'],_0x425dab);SmsQueueEvents[_0x28b4('0x4')](_0x3e2e9a,_0x425dab);_0x471ab4(null);};}for(var e in events){if(events[_0x28b4('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x28b4('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x40eb=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x52ddc8,_0xada5d6){var _0x41e9c3=function(_0x432441){while(--_0x432441){_0x52ddc8['push'](_0x52ddc8['shift']());}};_0x41e9c3(++_0xada5d6);}(_0x40eb,0xb0));var _0xb40e=function(_0x394b03,_0x3cecf5){_0x394b03=_0x394b03-0x0;var _0x5c420d=_0x40eb[_0x394b03];return _0x5c420d;};'use strict';var EventEmitter=require(_0xb40e('0x0'));var SmsQueue=require(_0xb40e('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb40e('0x2')](0x0);var events={'afterCreate':_0xb40e('0x3'),'afterUpdate':'update','afterDestroy':_0xb40e('0x4')};function emitEvent(_0x5488b9){return function(_0xe056d6,_0x441169,_0x2874fc){SmsQueueEvents[_0xb40e('0x5')](_0x5488b9+':'+_0xe056d6['id'],_0xe056d6);SmsQueueEvents['emit'](_0x5488b9,_0xe056d6);_0x2874fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb40e('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 2ed68de..41dbe17 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 _0xac00=['path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','moment','bluebird','request-promise'];(function(_0x14294a,_0x30486d){var _0x527f17=function(_0x4f2234){while(--_0x4f2234){_0x14294a['push'](_0x14294a['shift']());}};_0x527f17(++_0x30486d);}(_0xac00,0xd8));var _0x0ac0=function(_0x56ab74,_0x1effda){_0x56ab74=_0x56ab74-0x0;var _0x17d8d0=_0xac00[_0x56ab74];return _0x17d8d0;};'use strict';var _=require(_0x0ac0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ac0('0x1'));var BPromise=require(_0x0ac0('0x2'));var rp=require(_0x0ac0('0x3'));var fs=require('fs');var path=require(_0x0ac0('0x4'));var rimraf=require(_0x0ac0('0x5'));var config=require(_0x0ac0('0x6'));var attributes=require(_0x0ac0('0x7'));module[_0x0ac0('0x8')]=function(_0xba8195,_0x481451){return _0xba8195[_0x0ac0('0x9')]('SmsQueue',attributes,{'tableName':_0x0ac0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29a9=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','./smsQueue.attributes'];(function(_0x1af577,_0x1bd440){var _0x18ec4f=function(_0x4c9f95){while(--_0x4c9f95){_0x1af577['push'](_0x1af577['shift']());}};_0x18ec4f(++_0x1bd440);}(_0x29a9,0x92));var _0x929a=function(_0x9861ff,_0x41fb17){_0x9861ff=_0x9861ff-0x0;var _0x48852b=_0x29a9[_0x9861ff];return _0x48852b;};'use strict';var _=require(_0x929a('0x0'));var util=require(_0x929a('0x1'));var logger=require(_0x929a('0x2'))(_0x929a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x929a('0x4'));var fs=require('fs');var path=require(_0x929a('0x5'));var rimraf=require(_0x929a('0x6'));var config=require('../../config/environment');var attributes=require(_0x929a('0x7'));module['exports']=function(_0x1b1c63,_0x462c9d){return _0x1b1c63[_0x929a('0x8')](_0x929a('0x9'),attributes,{'tableName':_0x929a('0xa'),'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 a0c749c..2369d78 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 _0x5e37=['stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetSmsQueue','SmsQueue','find','ShowSmsQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1383dd,_0x51e52d){var _0x3902bf=function(_0x19542f){while(--_0x19542f){_0x1383dd['push'](_0x1383dd['shift']());}};_0x3902bf(++_0x51e52d);}(_0x5e37,0x139));var _0x75e3=function(_0x525d78,_0x14175d){_0x525d78=_0x525d78-0x0;var _0x4c203d=_0x5e37[_0x525d78];return _0x4c203d;};'use strict';var _=require(_0x75e3('0x0'));var util=require(_0x75e3('0x1'));var moment=require(_0x75e3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75e3('0x4'));var logger=require(_0x75e3('0x5'))(_0x75e3('0x6'));var config=require(_0x75e3('0x7'));var jayson=require(_0x75e3('0x8'));var client=jayson['client'][_0x75e3('0x9')]({'port':0x232a});config[_0x75e3('0xa')]=_[_0x75e3('0xb')](config[_0x75e3('0xa')],{'host':_0x75e3('0xc'),'port':0x18eb});var socket=require(_0x75e3('0xd'))(new Redis(config['redis']));require(_0x75e3('0xe'))[_0x75e3('0xf')](socket);function respondWithRpcPromise(_0x5adb61,_0x20c672,_0x3a0269){return new BPromise(function(_0x41e613,_0x2b6bba){return client[_0x75e3('0x10')](_0x5adb61,_0x3a0269)[_0x75e3('0x11')](function(_0xf65f2b){logger[_0x75e3('0x12')](_0x75e3('0x13'),_0x20c672,_0x75e3('0x14'));logger[_0x75e3('0x15')](_0x75e3('0x16'),_0x20c672,_0x75e3('0x14'),JSON[_0x75e3('0x17')](_0xf65f2b));if(_0xf65f2b['error']){if(_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x19')]===0x1f4){logger[_0x75e3('0x18')](_0x75e3('0x13'),_0x20c672,_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x1a')]);return _0x2b6bba(_0xf65f2b[_0x75e3('0x18')]['message']);}logger['error'](_0x75e3('0x13'),_0x20c672,_0xf65f2b['error'][_0x75e3('0x1a')]);return _0x41e613(_0xf65f2b[_0x75e3('0x18')][_0x75e3('0x1a')]);}else{logger[_0x75e3('0x12')](_0x75e3('0x13'),_0x20c672,_0x75e3('0x14'));_0x41e613(_0xf65f2b[_0x75e3('0x1b')][_0x75e3('0x1a')]);}})[_0x75e3('0x1c')](function(_0xc0b9e6){logger[_0x75e3('0x18')]('SmsQueue,\x20%s,\x20%s',_0x20c672,_0xc0b9e6);_0x2b6bba(_0xc0b9e6);});});}exports['GetSmsQueue']=function(_0x1b96f5){var _0x3118ea=this;return new Promise(function(_0x3c7762,_0x4d381d){return db['SmsQueue'][_0x75e3('0x1d')]({'raw':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b96f5['options']?_0x1b96f5['options'][_0x75e3('0x20')]||null:null,'attributes':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5['options']['attributes']||null:null,'limit':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x21')]||null:null,'include':_0x1b96f5[_0x75e3('0x1e')]?_0x1b96f5[_0x75e3('0x1e')][_0x75e3('0x22')]?_['map'](_0x1b96f5['options'][_0x75e3('0x22')],function(_0x1cce29){return{'model':db[_0x1cce29[_0x75e3('0x23')]],'as':_0x1cce29['as'],'attributes':_0x1cce29[_0x75e3('0x24')],'include':_0x1cce29['include']?_[_0x75e3('0x25')](_0x1cce29[_0x75e3('0x22')],function(_0x1d3816){return{'model':db[_0x1d3816['model']],'as':_0x1d3816['as'],'attributes':_0x1d3816[_0x75e3('0x24')],'include':_0x1d3816[_0x75e3('0x22')]?_['map'](_0x1d3816[_0x75e3('0x22')],function(_0x2ac4c3){return{'model':db[_0x2ac4c3['model']],'as':_0x2ac4c3['as'],'attributes':_0x2ac4c3[_0x75e3('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b1f85){logger[_0x75e3('0x12')]('GetSmsQueue',_0x1b96f5);logger[_0x75e3('0x15')](_0x75e3('0x26'),_0x1b96f5,JSON[_0x75e3('0x17')](_0x3b1f85));_0x3c7762(_0x3b1f85);})['catch'](function(_0x2ef426){logger[_0x75e3('0x18')](_0x75e3('0x26'),_0x2ef426[_0x75e3('0x1a')],_0x1b96f5);_0x4d381d(_0x3118ea[_0x75e3('0x18')](0x1f4,_0x2ef426['message']));});});};exports['ShowSmsQueue']=function(_0x2b7c10){var _0x29d766=this;return new Promise(function(_0x176bef,_0x567c67){return db[_0x75e3('0x27')][_0x75e3('0x28')]({'raw':_0x2b7c10['options']?_0x2b7c10['options'][_0x75e3('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x20')]||null:null,'attributes':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10['options']['attributes']||null:null,'include':_0x2b7c10[_0x75e3('0x1e')]?_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x22')]?_[_0x75e3('0x25')](_0x2b7c10[_0x75e3('0x1e')][_0x75e3('0x22')],function(_0xc85ece){return{'model':db[_0xc85ece['model']],'as':_0xc85ece['as'],'attributes':_0xc85ece[_0x75e3('0x24')],'include':_0xc85ece[_0x75e3('0x22')]?_[_0x75e3('0x25')](_0xc85ece[_0x75e3('0x22')],function(_0x42cc8c){return{'model':db[_0x42cc8c['model']],'as':_0x42cc8c['as'],'attributes':_0x42cc8c[_0x75e3('0x24')],'include':_0x42cc8c['include']?_[_0x75e3('0x25')](_0x42cc8c['include'],function(_0x8b19f7){return{'model':db[_0x8b19f7['model']],'as':_0x8b19f7['as'],'attributes':_0x8b19f7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x224980){logger[_0x75e3('0x12')](_0x75e3('0x29'),_0x2b7c10);logger['debug'](_0x75e3('0x29'),_0x2b7c10,JSON[_0x75e3('0x17')](_0x224980));_0x176bef(_0x224980);})[_0x75e3('0x1c')](function(_0x2f3017){logger['error'](_0x75e3('0x29'),_0x2f3017[_0x75e3('0x1a')],_0x2b7c10);_0x567c67(_0x29d766[_0x75e3('0x18')](0x1f4,_0x2f3017[_0x75e3('0x1a')]));});});}; \ No newline at end of file +var _0x0c97=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSmsQueue','find','lodash'];(function(_0x5d27c3,_0x5ac158){var _0xed73f8=function(_0xc9c3d2){while(--_0xc9c3d2){_0x5d27c3['push'](_0x5d27c3['shift']());}};_0xed73f8(++_0x5ac158);}(_0x0c97,0x9f));var _0x70c9=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x0c97[_0x540dcb];return _0x49353c;};'use strict';var _=require(_0x70c9('0x0'));var util=require(_0x70c9('0x1'));var moment=require(_0x70c9('0x2'));var BPromise=require(_0x70c9('0x3'));var rs=require(_0x70c9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70c9('0x5'))['db'];var utils=require(_0x70c9('0x6'));var logger=require(_0x70c9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x70c9('0x8'));var client=jayson[_0x70c9('0x9')][_0x70c9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x70c9('0xb')],{'host':_0x70c9('0xc'),'port':0x18eb});var socket=require(_0x70c9('0xd'))(new Redis(config['redis']));require(_0x70c9('0xe'))[_0x70c9('0xf')](socket);function respondWithRpcPromise(_0x10e066,_0x1432a7,_0x491e9e){return new BPromise(function(_0x242fec,_0x24439d){return client['request'](_0x10e066,_0x491e9e)[_0x70c9('0x10')](function(_0x37f143){logger[_0x70c9('0x11')](_0x70c9('0x12'),_0x1432a7,_0x70c9('0x13'));logger[_0x70c9('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x1432a7,_0x70c9('0x13'),JSON['stringify'](_0x37f143));if(_0x37f143[_0x70c9('0x15')]){if(_0x37f143[_0x70c9('0x15')][_0x70c9('0x16')]===0x1f4){logger[_0x70c9('0x15')](_0x70c9('0x12'),_0x1432a7,_0x37f143['error'][_0x70c9('0x17')]);return _0x24439d(_0x37f143[_0x70c9('0x15')][_0x70c9('0x17')]);}logger['error'](_0x70c9('0x12'),_0x1432a7,_0x37f143[_0x70c9('0x15')]['message']);return _0x242fec(_0x37f143[_0x70c9('0x15')][_0x70c9('0x17')]);}else{logger[_0x70c9('0x11')](_0x70c9('0x12'),_0x1432a7,_0x70c9('0x13'));_0x242fec(_0x37f143[_0x70c9('0x18')][_0x70c9('0x17')]);}})[_0x70c9('0x19')](function(_0x41eb81){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1432a7,_0x41eb81);_0x24439d(_0x41eb81);});});}exports[_0x70c9('0x1a')]=function(_0x5c61e9){var _0x5be7d7=this;return new Promise(function(_0x5de388,_0x31b303){return db[_0x70c9('0x1b')][_0x70c9('0x1c')]({'raw':_0x5c61e9['options']?_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c61e9[_0x70c9('0x1d')]?_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x1f')]||null:null,'attributes':_0x5c61e9[_0x70c9('0x1d')]?_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x20')]||null:null,'limit':_0x5c61e9[_0x70c9('0x1d')]?_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x21')]||null:null,'include':_0x5c61e9[_0x70c9('0x1d')]?_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x22')]?_[_0x70c9('0x23')](_0x5c61e9[_0x70c9('0x1d')][_0x70c9('0x22')],function(_0x1027c9){return{'model':db[_0x1027c9['model']],'as':_0x1027c9['as'],'attributes':_0x1027c9[_0x70c9('0x20')],'include':_0x1027c9['include']?_[_0x70c9('0x23')](_0x1027c9['include'],function(_0x396b61){return{'model':db[_0x396b61['model']],'as':_0x396b61['as'],'attributes':_0x396b61['attributes'],'include':_0x396b61['include']?_[_0x70c9('0x23')](_0x396b61[_0x70c9('0x22')],function(_0x3d368a){return{'model':db[_0x3d368a[_0x70c9('0x24')]],'as':_0x3d368a['as'],'attributes':_0x3d368a['attributes']};}):[]};}):[]};}):[]:[]})[_0x70c9('0x10')](function(_0x2926c8){logger['info'](_0x70c9('0x1a'),_0x5c61e9);logger['debug']('GetSmsQueue',_0x5c61e9,JSON[_0x70c9('0x25')](_0x2926c8));_0x5de388(_0x2926c8);})[_0x70c9('0x19')](function(_0x52b106){logger[_0x70c9('0x15')](_0x70c9('0x1a'),_0x52b106[_0x70c9('0x17')],_0x5c61e9);_0x31b303(_0x5be7d7['error'](0x1f4,_0x52b106[_0x70c9('0x17')]));});});};exports[_0x70c9('0x26')]=function(_0x39d790){var _0x149849=this;return new Promise(function(_0xb9cd94,_0x5b474f){return db[_0x70c9('0x1b')][_0x70c9('0x27')]({'raw':_0x39d790[_0x70c9('0x1d')]?_0x39d790[_0x70c9('0x1d')][_0x70c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x39d790[_0x70c9('0x1d')]?_0x39d790[_0x70c9('0x1d')][_0x70c9('0x1f')]||null:null,'attributes':_0x39d790[_0x70c9('0x1d')]?_0x39d790[_0x70c9('0x1d')][_0x70c9('0x20')]||null:null,'include':_0x39d790[_0x70c9('0x1d')]?_0x39d790[_0x70c9('0x1d')][_0x70c9('0x22')]?_[_0x70c9('0x23')](_0x39d790[_0x70c9('0x1d')]['include'],function(_0x5cdcd8){return{'model':db[_0x5cdcd8[_0x70c9('0x24')]],'as':_0x5cdcd8['as'],'attributes':_0x5cdcd8[_0x70c9('0x20')],'include':_0x5cdcd8[_0x70c9('0x22')]?_[_0x70c9('0x23')](_0x5cdcd8[_0x70c9('0x22')],function(_0x25af2b){return{'model':db[_0x25af2b[_0x70c9('0x24')]],'as':_0x25af2b['as'],'attributes':_0x25af2b[_0x70c9('0x20')],'include':_0x25af2b[_0x70c9('0x22')]?_['map'](_0x25af2b[_0x70c9('0x22')],function(_0x3e9db5){return{'model':db[_0x3e9db5[_0x70c9('0x24')]],'as':_0x3e9db5['as'],'attributes':_0x3e9db5['attributes']};}):[]};}):[]};}):[]:[]})[_0x70c9('0x10')](function(_0x4926be){logger[_0x70c9('0x11')]('ShowSmsQueue',_0x39d790);logger['debug'](_0x70c9('0x26'),_0x39d790,JSON[_0x70c9('0x25')](_0x4926be));_0xb9cd94(_0x4926be);})['catch'](function(_0x3564d6){logger[_0x70c9('0x15')](_0x70c9('0x26'),_0x3564d6[_0x70c9('0x17')],_0x39d790);_0x5b474f(_0x149849['error'](0x1f4,_0x3564d6[_0x70c9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a7a723d..0fa98db 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 _0x6ac0=['emit','removeListener','register','length','smsQueue:','save','remove'];(function(_0x159722,_0x2ffac5){var _0x72d030=function(_0x4c88c6){while(--_0x4c88c6){_0x159722['push'](_0x159722['shift']());}};_0x72d030(++_0x2ffac5);}(_0x6ac0,0xbb));var _0x06ac=function(_0x367a2d,_0x17d047){_0x367a2d=_0x367a2d-0x0;var _0x59c356=_0x6ac0[_0x367a2d];return _0x59c356;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x06ac('0x0'),_0x06ac('0x1'),'update'];function createListener(_0x8ee130,_0x3f3c6f){return function(_0x15f3fc){_0x3f3c6f[_0x06ac('0x2')](_0x8ee130,_0x15f3fc);};}function removeListener(_0x5c8e99,_0x574802){return function(){SmsQueueEvents[_0x06ac('0x3')](_0x5c8e99,_0x574802);};}exports[_0x06ac('0x4')]=function(_0x15b9bc){for(var _0x4c55e6=0x0,_0xb62f6a=events[_0x06ac('0x5')];_0x4c55e6<_0xb62f6a;_0x4c55e6++){var _0x32a618=events[_0x4c55e6];var _0x3cd4ee=createListener(_0x06ac('0x6')+_0x32a618,_0x15b9bc);SmsQueueEvents['on'](_0x32a618,_0x3cd4ee);}}; \ No newline at end of file +var _0xef55=['length','smsQueue:','./smsQueue.events','save','update','removeListener','register'];(function(_0x5eb67b,_0x1c9e9d){var _0x477275=function(_0xfa0f1){while(--_0xfa0f1){_0x5eb67b['push'](_0x5eb67b['shift']());}};_0x477275(++_0x1c9e9d);}(_0xef55,0x72));var _0x5ef5=function(_0x1c023a,_0x1499c2){_0x1c023a=_0x1c023a-0x0;var _0x1ccc7c=_0xef55[_0x1c023a];return _0x1ccc7c;};'use strict';var SmsQueueEvents=require(_0x5ef5('0x0'));var events=[_0x5ef5('0x1'),'remove',_0x5ef5('0x2')];function createListener(_0x3cfbb8,_0xa7480d){return function(_0x5c3ee4){_0xa7480d['emit'](_0x3cfbb8,_0x5c3ee4);};}function removeListener(_0x1a5d9f,_0x5d3400){return function(){SmsQueueEvents[_0x5ef5('0x3')](_0x1a5d9f,_0x5d3400);};}exports[_0x5ef5('0x4')]=function(_0x5a75b7){for(var _0x35508e=0x0,_0x37648e=events[_0x5ef5('0x5')];_0x35508e<_0x37648e;_0x35508e++){var _0x3e38b7=events[_0x35508e];var _0x4983b6=createListener(_0x5ef5('0x6')+_0x3e38b7,_0x5a75b7);SmsQueueEvents['on'](_0x3e38b7,_0x4983b6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 25eb23c..8253f27 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 _0xac4f=['delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xac4f,0x122));var _0xfac4=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0xac4f[_0x13f5a2];return _0x1c2719;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfac4('0x3'));var interaction=require(_0xfac4('0x4'));var config=require('../../config/environment');var controller=require(_0xfac4('0x5'));router[_0xfac4('0x6')]('/',auth[_0xfac4('0x7')](),controller['index']);router[_0xfac4('0x6')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x9')]);router[_0xfac4('0x6')](_0xfac4('0xa'),auth['isAuthenticated'](),controller[_0xfac4('0xb')]);router[_0xfac4('0xc')]('/',auth[_0xfac4('0x7')](),controller[_0xfac4('0xd')]);router[_0xfac4('0xe')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xf')]);router[_0xfac4('0x10')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6a3b=['./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fcdec,_0x5b0f30){var _0x397c35=function(_0x501454){while(--_0x501454){_0x4fcdec['push'](_0x4fcdec['shift']());}};_0x397c35(++_0x5b0f30);}(_0x6a3b,0x134));var _0xb6a3=function(_0x5de001,_0x4faf61){_0x5de001=_0x5de001-0x0;var _0x31a945=_0x6a3b[_0x5de001];return _0x31a945;};'use strict';var multer=require('multer');var util=require(_0xb6a3('0x0'));var path=require(_0xb6a3('0x1'));var timeout=require(_0xb6a3('0x2'));var express=require('express');var router=express[_0xb6a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb6a3('0x4'));var interaction=require(_0xb6a3('0x5'));var config=require(_0xb6a3('0x6'));var controller=require(_0xb6a3('0x7'));router['get']('/',auth[_0xb6a3('0x8')](),controller[_0xb6a3('0x9')]);router[_0xb6a3('0xa')](_0xb6a3('0xb'),auth[_0xb6a3('0x8')](),controller[_0xb6a3('0xc')]);router[_0xb6a3('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb6a3('0xd')]);router[_0xb6a3('0xe')]('/',auth[_0xb6a3('0x8')](),controller[_0xb6a3('0xf')]);router[_0xb6a3('0x10')]('/:id',auth[_0xb6a3('0x8')](),controller[_0xb6a3('0x11')]);router[_0xb6a3('0x12')](_0xb6a3('0x13'),auth[_0xb6a3('0x8')](),controller['destroy']);module[_0xb6a3('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b93a6d3..2b97acd 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 _0xdc0d=['sequelize','STRING','DATE','moment'];(function(_0x107c1e,_0xb15ce){var _0x20a663=function(_0x41484b){while(--_0x41484b){_0x107c1e['push'](_0x107c1e['shift']());}};_0x20a663(++_0xb15ce);}(_0xdc0d,0x1db));var _0xddc0=function(_0x3a7e32,_0x4c6ad5){_0x3a7e32=_0x3a7e32-0x0;var _0x52347a=_0xdc0d[_0x3a7e32];return _0x52347a;};'use strict';var moment=require(_0xddc0('0x0'));var Sequelize=require(_0xddc0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xddc0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xddc0('0x3')]},'leaveAt':{'type':Sequelize[_0xddc0('0x3')]},'acceptAt':{'type':Sequelize[_0xddc0('0x3')]},'exitAt':{'type':Sequelize[_0xddc0('0x3')]},'reason':{'type':Sequelize[_0xddc0('0x2')]}}; \ No newline at end of file +var _0x2d8d=['moment','sequelize','exports','STRING','DATE'];(function(_0x3e0f7b,_0x515281){var _0x598f36=function(_0x5999c1){while(--_0x5999c1){_0x3e0f7b['push'](_0x3e0f7b['shift']());}};_0x598f36(++_0x515281);}(_0x2d8d,0x154));var _0xd2d8=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x2d8d[_0x3725ee];return _0x399c71;};'use strict';var moment=require(_0xd2d8('0x0'));var Sequelize=require(_0xd2d8('0x1'));module[_0xd2d8('0x2')]={'uniqueid':{'type':Sequelize[_0xd2d8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd2d8('0x3')]},'joinAt':{'type':Sequelize[_0xd2d8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd2d8('0x4')]},'reason':{'type':Sequelize[_0xd2d8('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b957ea1..f566eb2 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 _0xf836=['pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params','keys','fields','includeAll','create','body','find','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','length','attributes','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf836,0xf0));var _0x6f83=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf836[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6f83('0x0'));var rimraf=require(_0x6f83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f83('0x2'));var BPromise=require(_0x6f83('0x3'));var Mustache=require(_0x6f83('0x4'));var util=require(_0x6f83('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6f83('0x6'));var ejs=require(_0x6f83('0x7'));var fs=require('fs');var fs_extra=require(_0x6f83('0x8'));var _=require(_0x6f83('0x9'));var squel=require(_0x6f83('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f83('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f83('0xc'));var Redis=require(_0x6f83('0xd'));var authService=require(_0x6f83('0xe'));var qs=require(_0x6f83('0xf'));var as=require(_0x6f83('0x10'));var hardwareService=require(_0x6f83('0x11'));var logger=require(_0x6f83('0x12'))(_0x6f83('0x13'));var utils=require(_0x6f83('0x14'));var config=require(_0x6f83('0x15'));var licenseUtil=require(_0x6f83('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47362a,_0x2a77db){_0x2a77db=_0x2a77db||0xcc;return function(_0x4452e2){if(_0x4452e2){return _0x47362a[_0x6f83('0x17')](_0x2a77db);}return _0x47362a[_0x6f83('0x18')](_0x2a77db)[_0x6f83('0x19')]();};}function respondWithResult(_0x2103af,_0xc63775){_0xc63775=_0xc63775||0xc8;return function(_0x7a598f){if(_0x7a598f){return _0x2103af['status'](_0xc63775)[_0x6f83('0x1a')](_0x7a598f);}};}function respondWithFilteredResult(_0x5e35aa,_0xfc511a){return function(_0x1b0644){if(_0x1b0644){var _0x1e2191=typeof _0xfc511a[_0x6f83('0x1b')]==='undefined'&&typeof _0xfc511a[_0x6f83('0x1c')]===_0x6f83('0x1d');var _0x149a13=_0x1b0644[_0x6f83('0x1e')];var _0x446342=_0x1e2191?0x0:_0xfc511a[_0x6f83('0x1b')];var _0x12fb0c=_0x1e2191?_0x1b0644[_0x6f83('0x1e')]:_0xfc511a['offset']+_0xfc511a[_0x6f83('0x1c')];var _0x1978cd;if(_0x12fb0c>=_0x149a13){_0x12fb0c=_0x149a13;_0x1978cd=0xc8;}else{_0x1978cd=0xce;}_0x5e35aa[_0x6f83('0x18')](_0x1978cd);return _0x5e35aa['set'](_0x6f83('0x1f'),_0x446342+'-'+_0x12fb0c+'/'+_0x149a13)[_0x6f83('0x1a')](_0x1b0644);}return null;};}function patchUpdates(_0x578674){return function(_0x5c0b71){try{jsonpatch['apply'](_0x5c0b71,_0x578674,!![]);}catch(_0x2df47d){return BPromise[_0x6f83('0x20')](_0x2df47d);}return _0x5c0b71[_0x6f83('0x21')]();};}function saveUpdates(_0xfedf41,_0x68941e){return function(_0x386971){if(_0x386971){return _0x386971['update'](_0xfedf41)['then'](function(_0x498a42){return _0x498a42;});}return null;};}function removeEntity(_0x23f137,_0x3dd40d){return function(_0x40ef31){if(_0x40ef31){return _0x40ef31[_0x6f83('0x22')]()['then'](function(){_0x23f137[_0x6f83('0x18')](0xcc)[_0x6f83('0x19')]();});}};}function handleEntityNotFound(_0x5c2a0d,_0x3399d3){return function(_0x331a60){if(!_0x331a60){_0x5c2a0d['sendStatus'](0x194);}return _0x331a60;};}function handleError(_0x1a4977,_0x4660de){_0x4660de=_0x4660de||0x1f4;return function(_0x41ef1a){logger[_0x6f83('0x23')](_0x41ef1a[_0x6f83('0x24')]);if(_0x41ef1a[_0x6f83('0x25')]){delete _0x41ef1a[_0x6f83('0x25')];}_0x1a4977[_0x6f83('0x18')](_0x4660de)[_0x6f83('0x26')](_0x41ef1a);};}exports[_0x6f83('0x27')]=function(_0x2ef02d,_0x4a7c9a){var _0xc2fb74={},_0x200ade={},_0x2ba11e={'count':0x0,'rows':[]};var _0x506506=_[_0x6f83('0x28')](db[_0x6f83('0x29')][_0x6f83('0x2a')],function(_0x357529){return{'name':_0x357529[_0x6f83('0x2b')],'type':_0x357529[_0x6f83('0x2c')][_0x6f83('0x2d')]};});_0x200ade[_0x6f83('0x2e')]=_[_0x6f83('0x28')](_0x506506,_0x6f83('0x25'));_0x200ade[_0x6f83('0x2f')]=_['keys'](_0x2ef02d[_0x6f83('0x2f')]);_0x200ade[_0x6f83('0x30')]=_[_0x6f83('0x31')](_0x200ade['model'],_0x200ade['query']);_0xc2fb74['attributes']=_[_0x6f83('0x31')](_0x200ade[_0x6f83('0x2e')],qs['fields'](_0x2ef02d[_0x6f83('0x2f')]['fields']));_0xc2fb74['attributes']=_0xc2fb74['attributes'][_0x6f83('0x32')]?_0xc2fb74[_0x6f83('0x33')]:_0x200ade[_0x6f83('0x2e')];if(!_0x2ef02d[_0x6f83('0x2f')]['hasOwnProperty'](_0x6f83('0x34'))){_0xc2fb74[_0x6f83('0x1c')]=qs[_0x6f83('0x1c')](_0x2ef02d[_0x6f83('0x2f')][_0x6f83('0x1c')]);_0xc2fb74[_0x6f83('0x1b')]=qs[_0x6f83('0x1b')](_0x2ef02d['query'][_0x6f83('0x1b')]);}_0xc2fb74[_0x6f83('0x35')]=qs[_0x6f83('0x36')](_0x2ef02d[_0x6f83('0x2f')]['sort']);_0xc2fb74[_0x6f83('0x37')]=qs[_0x6f83('0x30')](_[_0x6f83('0x38')](_0x2ef02d[_0x6f83('0x2f')],_0x200ade[_0x6f83('0x30')]),_0x506506);if(_0x2ef02d['query'][_0x6f83('0x39')]){_0xc2fb74[_0x6f83('0x37')]=_['merge'](_0xc2fb74[_0x6f83('0x37')],{'$or':_['map'](_0x506506,function(_0x37a80c){if(_0x37a80c['type']!==_0x6f83('0x3a')){var _0x48015c={};_0x48015c[_0x37a80c[_0x6f83('0x25')]]={'$like':'%'+_0x2ef02d[_0x6f83('0x2f')]['filter']+'%'};return _0x48015c;}})});}_0xc2fb74=_[_0x6f83('0x3b')]({},_0xc2fb74,_0x2ef02d[_0x6f83('0x3c')]);var _0x206271={'where':_0xc2fb74[_0x6f83('0x37')]};return db[_0x6f83('0x29')]['count'](_0x206271)[_0x6f83('0x3d')](function(_0x5e57e0){_0x2ba11e['count']=_0x5e57e0;if(_0x2ef02d[_0x6f83('0x2f')]['includeAll']){_0xc2fb74[_0x6f83('0x3e')]=[{'all':!![]}];}return db[_0x6f83('0x29')][_0x6f83('0x3f')](_0xc2fb74);})[_0x6f83('0x3d')](function(_0x192509){_0x2ba11e[_0x6f83('0x40')]=_0x192509;return _0x2ba11e;})[_0x6f83('0x3d')](respondWithFilteredResult(_0x4a7c9a,_0xc2fb74))[_0x6f83('0x41')](handleError(_0x4a7c9a,null));};exports['show']=function(_0x5a96c1,_0x19748c){var _0x5e0cc5={'raw':!![],'where':{'id':_0x5a96c1[_0x6f83('0x42')]['id']}},_0x2461ae={};_0x2461ae['model']=_['keys'](db[_0x6f83('0x29')][_0x6f83('0x2a')]);_0x2461ae[_0x6f83('0x2f')]=_[_0x6f83('0x43')](_0x5a96c1[_0x6f83('0x2f')]);_0x2461ae[_0x6f83('0x30')]=_[_0x6f83('0x31')](_0x2461ae[_0x6f83('0x2e')],_0x2461ae['query']);_0x5e0cc5[_0x6f83('0x33')]=_[_0x6f83('0x31')](_0x2461ae[_0x6f83('0x2e')],qs[_0x6f83('0x44')](_0x5a96c1['query'][_0x6f83('0x44')]));_0x5e0cc5[_0x6f83('0x33')]=_0x5e0cc5[_0x6f83('0x33')][_0x6f83('0x32')]?_0x5e0cc5[_0x6f83('0x33')]:_0x2461ae[_0x6f83('0x2e')];if(_0x5a96c1[_0x6f83('0x2f')][_0x6f83('0x45')]){_0x5e0cc5[_0x6f83('0x3e')]=[{'all':!![]}];}_0x5e0cc5=_[_0x6f83('0x3b')]({},_0x5e0cc5,_0x5a96c1['options']);return db[_0x6f83('0x29')]['find'](_0x5e0cc5)[_0x6f83('0x3d')](handleEntityNotFound(_0x19748c,null))['then'](respondWithResult(_0x19748c,null))['catch'](handleError(_0x19748c,null));};exports[_0x6f83('0x46')]=function(_0x105843,_0x4cf2c5){return db[_0x6f83('0x29')][_0x6f83('0x46')](_0x105843[_0x6f83('0x47')],{})[_0x6f83('0x3d')](respondWithResult(_0x4cf2c5,0xc9))[_0x6f83('0x41')](handleError(_0x4cf2c5,null));};exports['update']=function(_0x3e778b,_0x351390){if(_0x3e778b[_0x6f83('0x47')]['id']){delete _0x3e778b[_0x6f83('0x47')]['id'];}return db[_0x6f83('0x29')][_0x6f83('0x48')]({'where':{'id':_0x3e778b[_0x6f83('0x42')]['id']}})[_0x6f83('0x3d')](handleEntityNotFound(_0x351390,null))['then'](saveUpdates(_0x3e778b[_0x6f83('0x47')],null))[_0x6f83('0x3d')](respondWithResult(_0x351390,null))['catch'](handleError(_0x351390,null));};exports[_0x6f83('0x22')]=function(_0x4f560f,_0x397ffe){return db[_0x6f83('0x29')][_0x6f83('0x48')]({'where':{'id':_0x4f560f['params']['id']}})[_0x6f83('0x3d')](handleEntityNotFound(_0x397ffe,null))['then'](removeEntity(_0x397ffe,null))[_0x6f83('0x41')](handleError(_0x397ffe,null));};exports['describe']=function(_0x5a7d15,_0x506444){return db[_0x6f83('0x29')][_0x6f83('0x49')]()[_0x6f83('0x3d')](respondWithResult(_0x506444,null))['catch'](handleError(_0x506444,null));}; \ No newline at end of file +var _0x984b=['crypto','desk.js','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','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x984b,0x8a));var _0xb984=function(_0x53bb0d,_0x9b536d){_0x53bb0d=_0x53bb0d-0x0;var _0x561f6f=_0x984b[_0x53bb0d];return _0x561f6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb984('0x0'));var rp=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var BPromise=require(_0xb984('0x3'));var Mustache=require('mustache');var util=require(_0xb984('0x4'));var path=require(_0xb984('0x5'));var sox=require(_0xb984('0x6'));var csv=require(_0xb984('0x7'));var ejs=require(_0xb984('0x8'));var fs=require('fs');var fs_extra=require(_0xb984('0x9'));var _=require(_0xb984('0xa'));var squel=require(_0xb984('0xb'));var crypto=require(_0xb984('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb984('0xd'));var toCsv=require(_0xb984('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb984('0xe'));var authService=require(_0xb984('0xf'));var qs=require(_0xb984('0x10'));var as=require(_0xb984('0x11'));var hardwareService=require(_0xb984('0x12'));var logger=require('../../config/logger')(_0xb984('0x13'));var utils=require(_0xb984('0x14'));var config=require(_0xb984('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb984('0x16'))['db'];function respondWithStatusCode(_0x5b5033,_0x3f7d73){_0x3f7d73=_0x3f7d73||0xcc;return function(_0x5c35d2){if(_0x5c35d2){return _0x5b5033[_0xb984('0x17')](_0x3f7d73);}return _0x5b5033[_0xb984('0x18')](_0x3f7d73)[_0xb984('0x19')]();};}function respondWithResult(_0x197902,_0x5501b4){_0x5501b4=_0x5501b4||0xc8;return function(_0x53fe1e){if(_0x53fe1e){return _0x197902[_0xb984('0x18')](_0x5501b4)[_0xb984('0x1a')](_0x53fe1e);}};}function respondWithFilteredResult(_0x44bffd,_0x13b4c0){return function(_0x445e64){if(_0x445e64){var _0xb9f60e=typeof _0x13b4c0[_0xb984('0x1b')]===_0xb984('0x1c')&&typeof _0x13b4c0[_0xb984('0x1d')]===_0xb984('0x1c');var _0x5a067e=_0x445e64[_0xb984('0x1e')];var _0x428d91=_0xb9f60e?0x0:_0x13b4c0['offset'];var _0x48a0d6=_0xb9f60e?_0x445e64[_0xb984('0x1e')]:_0x13b4c0[_0xb984('0x1b')]+_0x13b4c0[_0xb984('0x1d')];var _0x124cfa;if(_0x48a0d6>=_0x5a067e){_0x48a0d6=_0x5a067e;_0x124cfa=0xc8;}else{_0x124cfa=0xce;}_0x44bffd[_0xb984('0x18')](_0x124cfa);return _0x44bffd[_0xb984('0x1f')](_0xb984('0x20'),_0x428d91+'-'+_0x48a0d6+'/'+_0x5a067e)[_0xb984('0x1a')](_0x445e64);}return null;};}function patchUpdates(_0x4431ba){return function(_0x5da919){try{jsonpatch[_0xb984('0x21')](_0x5da919,_0x4431ba,!![]);}catch(_0xf88835){return BPromise[_0xb984('0x22')](_0xf88835);}return _0x5da919['save']();};}function saveUpdates(_0x42564a,_0x4334f3){return function(_0x481c0c){if(_0x481c0c){return _0x481c0c[_0xb984('0x23')](_0x42564a)[_0xb984('0x24')](function(_0x22dab6){return _0x22dab6;});}return null;};}function removeEntity(_0x5a374d,_0x58f677){return function(_0x41ea2f){if(_0x41ea2f){return _0x41ea2f['destroy']()['then'](function(){_0x5a374d[_0xb984('0x18')](0xcc)[_0xb984('0x19')]();});}};}function handleEntityNotFound(_0x49e3f3,_0x1d3be5){return function(_0x2b9777){if(!_0x2b9777){_0x49e3f3[_0xb984('0x17')](0x194);}return _0x2b9777;};}function handleError(_0x1e3c3b,_0x114f1a){_0x114f1a=_0x114f1a||0x1f4;return function(_0x2d790b){logger[_0xb984('0x25')](_0x2d790b[_0xb984('0x26')]);if(_0x2d790b[_0xb984('0x27')]){delete _0x2d790b[_0xb984('0x27')];}_0x1e3c3b[_0xb984('0x18')](_0x114f1a)['send'](_0x2d790b);};}exports[_0xb984('0x28')]=function(_0x2dd5d0,_0x5b8231){var _0x41be9a={},_0x13d1df={},_0x3ef0b7={'count':0x0,'rows':[]};var _0x414359=_[_0xb984('0x29')](db[_0xb984('0x2a')][_0xb984('0x2b')],function(_0x1b704a){return{'name':_0x1b704a[_0xb984('0x2c')],'type':_0x1b704a[_0xb984('0x2d')][_0xb984('0x2e')]};});_0x13d1df[_0xb984('0x2f')]=_[_0xb984('0x29')](_0x414359,'name');_0x13d1df[_0xb984('0x30')]=_[_0xb984('0x31')](_0x2dd5d0['query']);_0x13d1df[_0xb984('0x32')]=_['intersection'](_0x13d1df['model'],_0x13d1df[_0xb984('0x30')]);_0x41be9a[_0xb984('0x33')]=_['intersection'](_0x13d1df[_0xb984('0x2f')],qs[_0xb984('0x34')](_0x2dd5d0['query'][_0xb984('0x34')]));_0x41be9a[_0xb984('0x33')]=_0x41be9a[_0xb984('0x33')]['length']?_0x41be9a[_0xb984('0x33')]:_0x13d1df['model'];if(!_0x2dd5d0[_0xb984('0x30')][_0xb984('0x35')](_0xb984('0x36'))){_0x41be9a['limit']=qs[_0xb984('0x1d')](_0x2dd5d0[_0xb984('0x30')][_0xb984('0x1d')]);_0x41be9a['offset']=qs['offset'](_0x2dd5d0[_0xb984('0x30')][_0xb984('0x1b')]);}_0x41be9a['order']=qs[_0xb984('0x37')](_0x2dd5d0['query'][_0xb984('0x37')]);_0x41be9a['where']=qs[_0xb984('0x32')](_['pick'](_0x2dd5d0[_0xb984('0x30')],_0x13d1df[_0xb984('0x32')]),_0x414359);if(_0x2dd5d0['query'][_0xb984('0x38')]){_0x41be9a['where']=_[_0xb984('0x39')](_0x41be9a['where'],{'$or':_['map'](_0x414359,function(_0x1609a5){if(_0x1609a5[_0xb984('0x2d')]!==_0xb984('0x3a')){var _0x58c5fe={};_0x58c5fe[_0x1609a5[_0xb984('0x27')]]={'$like':'%'+_0x2dd5d0[_0xb984('0x30')][_0xb984('0x38')]+'%'};return _0x58c5fe;}})});}_0x41be9a=_['merge']({},_0x41be9a,_0x2dd5d0[_0xb984('0x3b')]);var _0x215b2a={'where':_0x41be9a[_0xb984('0x3c')]};return db[_0xb984('0x2a')]['count'](_0x215b2a)[_0xb984('0x24')](function(_0x44ae8e){_0x3ef0b7[_0xb984('0x1e')]=_0x44ae8e;if(_0x2dd5d0['query'][_0xb984('0x3d')]){_0x41be9a['include']=[{'all':!![]}];}return db[_0xb984('0x2a')][_0xb984('0x3e')](_0x41be9a);})[_0xb984('0x24')](function(_0x3b121a){_0x3ef0b7[_0xb984('0x3f')]=_0x3b121a;return _0x3ef0b7;})[_0xb984('0x24')](respondWithFilteredResult(_0x5b8231,_0x41be9a))[_0xb984('0x40')](handleError(_0x5b8231,null));};exports[_0xb984('0x41')]=function(_0x3f1c47,_0x54dfa3){var _0x280d80={'raw':!![],'where':{'id':_0x3f1c47[_0xb984('0x42')]['id']}},_0x25800b={};_0x25800b['model']=_[_0xb984('0x31')](db[_0xb984('0x2a')]['rawAttributes']);_0x25800b[_0xb984('0x30')]=_[_0xb984('0x31')](_0x3f1c47[_0xb984('0x30')]);_0x25800b[_0xb984('0x32')]=_[_0xb984('0x43')](_0x25800b['model'],_0x25800b['query']);_0x280d80[_0xb984('0x33')]=_[_0xb984('0x43')](_0x25800b['model'],qs['fields'](_0x3f1c47[_0xb984('0x30')][_0xb984('0x34')]));_0x280d80['attributes']=_0x280d80[_0xb984('0x33')][_0xb984('0x44')]?_0x280d80[_0xb984('0x33')]:_0x25800b['model'];if(_0x3f1c47['query'][_0xb984('0x3d')]){_0x280d80[_0xb984('0x45')]=[{'all':!![]}];}_0x280d80=_['merge']({},_0x280d80,_0x3f1c47[_0xb984('0x3b')]);return db[_0xb984('0x2a')][_0xb984('0x46')](_0x280d80)[_0xb984('0x24')](handleEntityNotFound(_0x54dfa3,null))[_0xb984('0x24')](respondWithResult(_0x54dfa3,null))[_0xb984('0x40')](handleError(_0x54dfa3,null));};exports[_0xb984('0x47')]=function(_0x5d8915,_0x58fac7){return db[_0xb984('0x2a')][_0xb984('0x47')](_0x5d8915[_0xb984('0x48')],{})[_0xb984('0x24')](respondWithResult(_0x58fac7,0xc9))['catch'](handleError(_0x58fac7,null));};exports[_0xb984('0x23')]=function(_0x18dd45,_0xb8bad1){if(_0x18dd45[_0xb984('0x48')]['id']){delete _0x18dd45[_0xb984('0x48')]['id'];}return db[_0xb984('0x2a')][_0xb984('0x46')]({'where':{'id':_0x18dd45[_0xb984('0x42')]['id']}})[_0xb984('0x24')](handleEntityNotFound(_0xb8bad1,null))[_0xb984('0x24')](saveUpdates(_0x18dd45['body'],null))['then'](respondWithResult(_0xb8bad1,null))[_0xb984('0x40')](handleError(_0xb8bad1,null));};exports[_0xb984('0x49')]=function(_0x5cc62a,_0x580114){return db[_0xb984('0x2a')][_0xb984('0x46')]({'where':{'id':_0x5cc62a['params']['id']}})['then'](handleEntityNotFound(_0x580114,null))[_0xb984('0x24')](removeEntity(_0x580114,null))[_0xb984('0x40')](handleError(_0x580114,null));};exports[_0xb984('0x4a')]=function(_0x50d605,_0x4c24b5){return db[_0xb984('0x2a')]['describe']()['then'](respondWithResult(_0x4c24b5,null))[_0xb984('0x40')](handleError(_0x4c24b5,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 94a18ac..c0244cf 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x2bf948,_0x470191){var _0x22c3c5=function(_0x500f97){while(--_0x500f97){_0x2bf948['push'](_0x2bf948['shift']());}};_0x22c3c5(++_0x470191);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcb91[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 2023c02..c61f963 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 _0xba26=['UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','then','CreateSmsQueueReport','SmsQueueReport','raw','attributes','limit'];(function(_0x521d5c,_0x2a1b45){var _0x5cc0e5=function(_0x2e240e){while(--_0x2e240e){_0x521d5c['push'](_0x521d5c['shift']());}};_0x5cc0e5(++_0x2a1b45);}(_0xba26,0x1f1));var _0x6ba2=function(_0x42ab07,_0x4788a1){_0x42ab07=_0x42ab07-0x0;var _0x44836a=_0xba26[_0x42ab07];return _0x44836a;};'use strict';var _=require(_0x6ba2('0x0'));var util=require(_0x6ba2('0x1'));var moment=require(_0x6ba2('0x2'));var BPromise=require(_0x6ba2('0x3'));var rs=require(_0x6ba2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ba2('0x5'))('rpc');var config=require(_0x6ba2('0x6'));var jayson=require(_0x6ba2('0x7'));var client=jayson[_0x6ba2('0x8')][_0x6ba2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56d090,_0x5aec70,_0x46806d){return new BPromise(function(_0x4bc518,_0x428a8c){return client['request'](_0x56d090,_0x46806d)['then'](function(_0x10c282){logger[_0x6ba2('0xa')](_0x6ba2('0xb'),_0x5aec70,_0x6ba2('0xc'));logger[_0x6ba2('0xd')](_0x6ba2('0xe'),_0x5aec70,'request\x20sent',JSON[_0x6ba2('0xf')](_0x10c282));if(_0x10c282['error']){if(_0x10c282[_0x6ba2('0x10')][_0x6ba2('0x11')]===0x1f4){logger[_0x6ba2('0x10')](_0x6ba2('0xb'),_0x5aec70,_0x10c282[_0x6ba2('0x10')][_0x6ba2('0x12')]);return _0x428a8c(_0x10c282[_0x6ba2('0x10')]['message']);}logger['error'](_0x6ba2('0xb'),_0x5aec70,_0x10c282[_0x6ba2('0x10')]['message']);return _0x4bc518(_0x10c282[_0x6ba2('0x10')]['message']);}else{logger['info'](_0x6ba2('0xb'),_0x5aec70,_0x6ba2('0xc'));_0x4bc518(_0x10c282[_0x6ba2('0x13')][_0x6ba2('0x12')]);}})[_0x6ba2('0x14')](function(_0x3d0574){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5aec70,_0x3d0574);_0x428a8c(_0x3d0574);});});}exports['CreateSmsQueueReport']=function(_0x227bdc){var _0x54bb03=this;return new Promise(function(_0x56d5f0,_0xe30abb){return db['SmsQueueReport'][_0x6ba2('0x15')](_0x227bdc[_0x6ba2('0x16')],{'raw':_0x227bdc[_0x6ba2('0x17')]?_0x227bdc['options']['raw']===undefined?!![]:![]:!![]})[_0x6ba2('0x18')](function(_0x3d1821){logger[_0x6ba2('0xa')]('CreateSmsQueueReport',_0x227bdc);logger['debug'](_0x6ba2('0x19'),_0x227bdc,JSON[_0x6ba2('0xf')](_0x3d1821));_0x56d5f0(_0x3d1821);})[_0x6ba2('0x14')](function(_0x1bb5f9){logger['error'](_0x6ba2('0x19'),_0x1bb5f9[_0x6ba2('0x12')],_0x227bdc);_0xe30abb(_0x54bb03[_0x6ba2('0x10')](0x1f4,_0x1bb5f9['message']));});});};exports['UpdateSmsQueueReport']=function(_0x42844a){var _0x8bc5c1=this;return new Promise(function(_0x36a28f,_0x35c2bb){return db[_0x6ba2('0x1a')]['update'](_0x42844a[_0x6ba2('0x16')],{'raw':_0x42844a[_0x6ba2('0x17')]?_0x42844a[_0x6ba2('0x17')][_0x6ba2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42844a['options']?_0x42844a[_0x6ba2('0x17')]['where']||null:null,'attributes':_0x42844a[_0x6ba2('0x17')]?_0x42844a[_0x6ba2('0x17')][_0x6ba2('0x1c')]||null:null,'limit':_0x42844a[_0x6ba2('0x17')]?_0x42844a['options'][_0x6ba2('0x1d')]||null:null})[_0x6ba2('0x18')](function(_0x42964c){logger[_0x6ba2('0xa')](_0x6ba2('0x1e'),_0x42844a);logger[_0x6ba2('0xd')](_0x6ba2('0x1e'),_0x42844a,JSON[_0x6ba2('0xf')](_0x42964c));_0x36a28f(_0x42964c);})['catch'](function(_0x3a7d6b){logger[_0x6ba2('0x10')]('UpdateSmsQueueReport',_0x3a7d6b[_0x6ba2('0x12')],_0x42844a);_0x35c2bb(_0x8bc5c1[_0x6ba2('0x10')](0x1f4,_0x3a7d6b['message']));});});}; \ No newline at end of file +var _0x418a=['where','attributes','limit','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport'];(function(_0x2c0fd2,_0x46ab45){var _0x1b7ec=function(_0x429bb1){while(--_0x429bb1){_0x2c0fd2['push'](_0x2c0fd2['shift']());}};_0x1b7ec(++_0x46ab45);}(_0x418a,0x16f));var _0xa418=function(_0x4c8587,_0x547744){_0x4c8587=_0x4c8587-0x0;var _0x120294=_0x418a[_0x4c8587];return _0x120294;};'use strict';var _=require('lodash');var util=require(_0xa418('0x0'));var moment=require(_0xa418('0x1'));var BPromise=require('bluebird');var rs=require(_0xa418('0x2'));var fs=require('fs');var Redis=require(_0xa418('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa418('0x4'))(_0xa418('0x5'));var config=require('../../config/environment');var jayson=require(_0xa418('0x6'));var client=jayson[_0xa418('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3490e7,_0x428cf1,_0x2e0362){return new BPromise(function(_0xb6aa08,_0x3f8e76){return client['request'](_0x3490e7,_0x2e0362)[_0xa418('0x8')](function(_0x2f7522){logger[_0xa418('0x9')](_0xa418('0xa'),_0x428cf1,_0xa418('0xb'));logger[_0xa418('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x428cf1,'request\x20sent',JSON[_0xa418('0xd')](_0x2f7522));if(_0x2f7522[_0xa418('0xe')]){if(_0x2f7522[_0xa418('0xe')][_0xa418('0xf')]===0x1f4){logger[_0xa418('0xe')](_0xa418('0xa'),_0x428cf1,_0x2f7522[_0xa418('0xe')][_0xa418('0x10')]);return _0x3f8e76(_0x2f7522['error']['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x428cf1,_0x2f7522[_0xa418('0xe')][_0xa418('0x10')]);return _0xb6aa08(_0x2f7522[_0xa418('0xe')][_0xa418('0x10')]);}else{logger[_0xa418('0x9')](_0xa418('0xa'),_0x428cf1,_0xa418('0xb'));_0xb6aa08(_0x2f7522[_0xa418('0x11')][_0xa418('0x10')]);}})['catch'](function(_0x23f827){logger[_0xa418('0xe')](_0xa418('0xa'),_0x428cf1,_0x23f827);_0x3f8e76(_0x23f827);});});}exports[_0xa418('0x12')]=function(_0x513913){var _0x303d68=this;return new Promise(function(_0x5b277b,_0x1e051e){return db[_0xa418('0x13')][_0xa418('0x14')](_0x513913['body'],{'raw':_0x513913[_0xa418('0x15')]?_0x513913[_0xa418('0x15')][_0xa418('0x16')]===undefined?!![]:![]:!![]})[_0xa418('0x8')](function(_0x1e625f){logger[_0xa418('0x9')](_0xa418('0x12'),_0x513913);logger[_0xa418('0xc')]('CreateSmsQueueReport',_0x513913,JSON['stringify'](_0x1e625f));_0x5b277b(_0x1e625f);})[_0xa418('0x17')](function(_0x5b0ffe){logger['error'](_0xa418('0x12'),_0x5b0ffe[_0xa418('0x10')],_0x513913);_0x1e051e(_0x303d68[_0xa418('0xe')](0x1f4,_0x5b0ffe[_0xa418('0x10')]));});});};exports[_0xa418('0x18')]=function(_0x1543ba){var _0x2fe330=this;return new Promise(function(_0x2d8556,_0x3664d7){return db[_0xa418('0x13')]['update'](_0x1543ba['body'],{'raw':_0x1543ba['options']?_0x1543ba[_0xa418('0x15')][_0xa418('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1543ba['options']?_0x1543ba[_0xa418('0x15')][_0xa418('0x19')]||null:null,'attributes':_0x1543ba[_0xa418('0x15')]?_0x1543ba[_0xa418('0x15')][_0xa418('0x1a')]||null:null,'limit':_0x1543ba[_0xa418('0x15')]?_0x1543ba[_0xa418('0x15')][_0xa418('0x1b')]||null:null})[_0xa418('0x8')](function(_0x3553e9){logger['info']('UpdateSmsQueueReport',_0x1543ba);logger[_0xa418('0xc')](_0xa418('0x18'),_0x1543ba,JSON[_0xa418('0xd')](_0x3553e9));_0x2d8556(_0x3553e9);})[_0xa418('0x17')](function(_0x523016){logger['error'](_0xa418('0x18'),_0x523016[_0xa418('0x10')],_0x1543ba);_0x3664d7(_0x2fe330[_0xa418('0xe')](0x1f4,_0x523016[_0xa418('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index b340660..17206a4 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 _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x454df7,_0x449532){var _0x12e277=function(_0x560355){while(--_0x560355){_0x454df7['push'](_0x454df7['shift']());}};_0x12e277(++_0x449532);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0xe0ae[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file +var _0xa23f=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa23f,0x7c));var _0xfa23=function(_0x278de6,_0x5a6efd){_0x278de6=_0x278de6-0x0;var _0x13f427=_0xa23f[_0x278de6];return _0x13f427;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./smsTransferReport.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfa23('0xd')]('/:id',auth[_0xfa23('0x8')](),controller['update']);router[_0xfa23('0xe')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller['destroy']);module[_0xfa23('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ebf0976..ce54504 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x31e94f,_0x42ecd6){var _0x1b8494=function(_0x5da15c){while(--_0x5da15c){_0x31e94f['push'](_0x31e94f['shift']());}};_0x1b8494(++_0x42ecd6);}(_0x34e8,0x12c));var _0x834e=function(_0x45e031,_0x4ff4b1){_0x45e031=_0x45e031-0x0;var _0x4c5064=_0x34e8[_0x45e031];return _0x4c5064;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2313a0,_0x59aee0){var _0x113801=function(_0x3e7f2f){while(--_0x3e7f2f){_0x2313a0['push'](_0x2313a0['shift']());}};_0x113801(++_0x59aee0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'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 3f2ac87..55f6686 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 _0xdcd0=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','params','merge','options','find','create','body','describe','eml-format','rimraf','moment','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','../../mysqldb'];(function(_0xa270f3,_0x293fd){var _0x48767f=function(_0x2db048){while(--_0x2db048){_0xa270f3['push'](_0xa270f3['shift']());}};_0x48767f(++_0x293fd);}(_0xdcd0,0x163));var _0x0dcd=function(_0x570da3,_0x2f3016){_0x570da3=_0x570da3-0x0;var _0x196ecb=_0xdcd0[_0x570da3];return _0x196ecb;};'use strict';var emlformat=require(_0x0dcd('0x0'));var rimraf=require(_0x0dcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0dcd('0x2'));var BPromise=require(_0x0dcd('0x3'));var Mustache=require(_0x0dcd('0x4'));var util=require(_0x0dcd('0x5'));var path=require(_0x0dcd('0x6'));var sox=require(_0x0dcd('0x7'));var csv=require(_0x0dcd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dcd('0x9'));var squel=require(_0x0dcd('0xa'));var crypto=require(_0x0dcd('0xb'));var jsforce=require(_0x0dcd('0xc'));var deskjs=require(_0x0dcd('0xd'));var toCsv=require(_0x0dcd('0x8'));var querystring=require(_0x0dcd('0xe'));var Papa=require(_0x0dcd('0xf'));var Redis=require(_0x0dcd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0dcd('0x11'));var as=require(_0x0dcd('0x12'));var hardwareService=require(_0x0dcd('0x13'));var logger=require(_0x0dcd('0x14'))(_0x0dcd('0x15'));var utils=require(_0x0dcd('0x16'));var config=require(_0x0dcd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dcd('0x18'))['db'];function respondWithStatusCode(_0x4aaf44,_0x3b9104){_0x3b9104=_0x3b9104||0xcc;return function(_0x25c637){if(_0x25c637){return _0x4aaf44[_0x0dcd('0x19')](_0x3b9104);}return _0x4aaf44[_0x0dcd('0x1a')](_0x3b9104)[_0x0dcd('0x1b')]();};}function respondWithResult(_0x53813f,_0x222a01){_0x222a01=_0x222a01||0xc8;return function(_0x148547){if(_0x148547){return _0x53813f['status'](_0x222a01)[_0x0dcd('0x1c')](_0x148547);}};}function respondWithFilteredResult(_0xfc51ef,_0x7acc97){return function(_0x4d2e20){if(_0x4d2e20){var _0x5206ea=typeof _0x7acc97[_0x0dcd('0x1d')]===_0x0dcd('0x1e')&&typeof _0x7acc97['limit']===_0x0dcd('0x1e');var _0x2fad1b=_0x4d2e20[_0x0dcd('0x1f')];var _0x5ecc10=_0x5206ea?0x0:_0x7acc97[_0x0dcd('0x1d')];var _0x28eea2=_0x5206ea?_0x4d2e20[_0x0dcd('0x1f')]:_0x7acc97[_0x0dcd('0x1d')]+_0x7acc97[_0x0dcd('0x20')];var _0x2ef19b;if(_0x28eea2>=_0x2fad1b){_0x28eea2=_0x2fad1b;_0x2ef19b=0xc8;}else{_0x2ef19b=0xce;}_0xfc51ef[_0x0dcd('0x1a')](_0x2ef19b);return _0xfc51ef['set'](_0x0dcd('0x21'),_0x5ecc10+'-'+_0x28eea2+'/'+_0x2fad1b)['json'](_0x4d2e20);}return null;};}function patchUpdates(_0x14dc65){return function(_0xaff053){try{jsonpatch[_0x0dcd('0x22')](_0xaff053,_0x14dc65,!![]);}catch(_0x590a4e){return BPromise[_0x0dcd('0x23')](_0x590a4e);}return _0xaff053[_0x0dcd('0x24')]();};}function saveUpdates(_0x446135,_0x249aa8){return function(_0x298f91){if(_0x298f91){return _0x298f91['update'](_0x446135)[_0x0dcd('0x25')](function(_0x342f40){return _0x342f40;});}return null;};}function removeEntity(_0x5e1567,_0x9b4787){return function(_0x38ac13){if(_0x38ac13){return _0x38ac13[_0x0dcd('0x26')]()[_0x0dcd('0x25')](function(){_0x5e1567[_0x0dcd('0x1a')](0xcc)[_0x0dcd('0x1b')]();});}};}function handleEntityNotFound(_0x539373,_0x24de75){return function(_0x448cb4){if(!_0x448cb4){_0x539373['sendStatus'](0x194);}return _0x448cb4;};}function handleError(_0x278cfc,_0x25d61f){_0x25d61f=_0x25d61f||0x1f4;return function(_0x5839ea){logger[_0x0dcd('0x27')](_0x5839ea['stack']);if(_0x5839ea['name']){delete _0x5839ea[_0x0dcd('0x28')];}_0x278cfc[_0x0dcd('0x1a')](_0x25d61f)[_0x0dcd('0x29')](_0x5839ea);};}exports[_0x0dcd('0x2a')]=function(_0x23ecb6,_0x298312){var _0x41be93={},_0x6260e0={},_0x567f9b={'count':0x0,'rows':[]};var _0x772564=_[_0x0dcd('0x2b')](db[_0x0dcd('0x2c')][_0x0dcd('0x2d')],function(_0x4e45d1){return{'name':_0x4e45d1[_0x0dcd('0x2e')],'type':_0x4e45d1[_0x0dcd('0x2f')][_0x0dcd('0x30')]};});_0x6260e0[_0x0dcd('0x31')]=_['map'](_0x772564,'name');_0x6260e0[_0x0dcd('0x32')]=_[_0x0dcd('0x33')](_0x23ecb6[_0x0dcd('0x32')]);_0x6260e0[_0x0dcd('0x34')]=_['intersection'](_0x6260e0[_0x0dcd('0x31')],_0x6260e0[_0x0dcd('0x32')]);_0x41be93[_0x0dcd('0x35')]=_[_0x0dcd('0x36')](_0x6260e0[_0x0dcd('0x31')],qs[_0x0dcd('0x37')](_0x23ecb6['query'][_0x0dcd('0x37')]));_0x41be93[_0x0dcd('0x35')]=_0x41be93[_0x0dcd('0x35')][_0x0dcd('0x38')]?_0x41be93['attributes']:_0x6260e0[_0x0dcd('0x31')];if(!_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x39')](_0x0dcd('0x3a'))){_0x41be93[_0x0dcd('0x20')]=qs[_0x0dcd('0x20')](_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x20')]);_0x41be93[_0x0dcd('0x1d')]=qs[_0x0dcd('0x1d')](_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x1d')]);}_0x41be93[_0x0dcd('0x3b')]=qs[_0x0dcd('0x3c')](_0x23ecb6['query'][_0x0dcd('0x3c')]);_0x41be93[_0x0dcd('0x3d')]=qs['filters'](_['pick'](_0x23ecb6[_0x0dcd('0x32')],_0x6260e0['filters']),_0x772564);if(_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x3e')]){_0x41be93[_0x0dcd('0x3d')]=_['merge'](_0x41be93['where'],{'$or':_[_0x0dcd('0x2b')](_0x772564,function(_0x4c911d){if(_0x4c911d[_0x0dcd('0x2f')]!==_0x0dcd('0x3f')){var _0x5c01a6={};_0x5c01a6[_0x4c911d[_0x0dcd('0x28')]]={'$like':'%'+_0x23ecb6['query'][_0x0dcd('0x3e')]+'%'};return _0x5c01a6;}})});}_0x41be93=_['merge']({},_0x41be93,_0x23ecb6['options']);var _0x27341f={'where':_0x41be93[_0x0dcd('0x3d')]};return db['SmsTransferReport'][_0x0dcd('0x1f')](_0x27341f)['then'](function(_0x809f03){_0x567f9b[_0x0dcd('0x1f')]=_0x809f03;if(_0x23ecb6[_0x0dcd('0x32')][_0x0dcd('0x40')]){_0x41be93[_0x0dcd('0x41')]=[{'all':!![]}];}return db[_0x0dcd('0x2c')]['findAll'](_0x41be93);})['then'](function(_0x1041d0){_0x567f9b[_0x0dcd('0x42')]=_0x1041d0;return _0x567f9b;})[_0x0dcd('0x25')](respondWithFilteredResult(_0x298312,_0x41be93))[_0x0dcd('0x43')](handleError(_0x298312,null));};exports[_0x0dcd('0x44')]=function(_0x68f9d6,_0x41db50){var _0x52cce7={'raw':!![],'where':{'id':_0x68f9d6[_0x0dcd('0x45')]['id']}},_0x3b9071={};_0x3b9071[_0x0dcd('0x31')]=_[_0x0dcd('0x33')](db[_0x0dcd('0x2c')][_0x0dcd('0x2d')]);_0x3b9071['query']=_[_0x0dcd('0x33')](_0x68f9d6['query']);_0x3b9071[_0x0dcd('0x34')]=_['intersection'](_0x3b9071[_0x0dcd('0x31')],_0x3b9071[_0x0dcd('0x32')]);_0x52cce7[_0x0dcd('0x35')]=_[_0x0dcd('0x36')](_0x3b9071[_0x0dcd('0x31')],qs['fields'](_0x68f9d6[_0x0dcd('0x32')][_0x0dcd('0x37')]));_0x52cce7[_0x0dcd('0x35')]=_0x52cce7[_0x0dcd('0x35')][_0x0dcd('0x38')]?_0x52cce7[_0x0dcd('0x35')]:_0x3b9071['model'];if(_0x68f9d6[_0x0dcd('0x32')][_0x0dcd('0x40')]){_0x52cce7[_0x0dcd('0x41')]=[{'all':!![]}];}_0x52cce7=_[_0x0dcd('0x46')]({},_0x52cce7,_0x68f9d6[_0x0dcd('0x47')]);return db['SmsTransferReport'][_0x0dcd('0x48')](_0x52cce7)[_0x0dcd('0x25')](handleEntityNotFound(_0x41db50,null))[_0x0dcd('0x25')](respondWithResult(_0x41db50,null))[_0x0dcd('0x43')](handleError(_0x41db50,null));};exports[_0x0dcd('0x49')]=function(_0x30d46f,_0x3107a2){return db['SmsTransferReport'][_0x0dcd('0x49')](_0x30d46f[_0x0dcd('0x4a')],{})[_0x0dcd('0x25')](respondWithResult(_0x3107a2,0xc9))[_0x0dcd('0x43')](handleError(_0x3107a2,null));};exports['update']=function(_0x50114c,_0x35816e){if(_0x50114c[_0x0dcd('0x4a')]['id']){delete _0x50114c[_0x0dcd('0x4a')]['id'];}return db[_0x0dcd('0x2c')][_0x0dcd('0x48')]({'where':{'id':_0x50114c[_0x0dcd('0x45')]['id']}})[_0x0dcd('0x25')](handleEntityNotFound(_0x35816e,null))[_0x0dcd('0x25')](saveUpdates(_0x50114c[_0x0dcd('0x4a')],null))[_0x0dcd('0x25')](respondWithResult(_0x35816e,null))['catch'](handleError(_0x35816e,null));};exports[_0x0dcd('0x26')]=function(_0x340b7a,_0x1f56f4){return db[_0x0dcd('0x2c')][_0x0dcd('0x48')]({'where':{'id':_0x340b7a[_0x0dcd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f56f4,null))['then'](removeEntity(_0x1f56f4,null))[_0x0dcd('0x43')](handleError(_0x1f56f4,null));};exports['describe']=function(_0x336a25,_0x234ca5){return db['SmsTransferReport'][_0x0dcd('0x4b')]()[_0x0dcd('0x25')](respondWithResult(_0x234ca5,null))[_0x0dcd('0x43')](handleError(_0x234ca5,null));}; \ No newline at end of file +var _0x434f=['sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','fast-json-patch','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x434f,0x7d));var _0xf434=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x434f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf434('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf434('0x1'));var util=require(_0xf434('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0xf434('0x3'));var ejs=require(_0xf434('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf434('0x5'));var crypto=require(_0xf434('0x6'));var jsforce=require(_0xf434('0x7'));var deskjs=require(_0xf434('0x8'));var toCsv=require(_0xf434('0x3'));var querystring=require(_0xf434('0x9'));var Papa=require(_0xf434('0xa'));var Redis=require(_0xf434('0xb'));var authService=require(_0xf434('0xc'));var qs=require(_0xf434('0xd'));var as=require(_0xf434('0xe'));var hardwareService=require(_0xf434('0xf'));var logger=require(_0xf434('0x10'))(_0xf434('0x11'));var utils=require(_0xf434('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf434('0x13'));var db=require(_0xf434('0x14'))['db'];function respondWithStatusCode(_0x570666,_0x2076b8){_0x2076b8=_0x2076b8||0xcc;return function(_0x553558){if(_0x553558){return _0x570666[_0xf434('0x15')](_0x2076b8);}return _0x570666[_0xf434('0x16')](_0x2076b8)[_0xf434('0x17')]();};}function respondWithResult(_0x4f25ce,_0x58c089){_0x58c089=_0x58c089||0xc8;return function(_0x2b12ab){if(_0x2b12ab){return _0x4f25ce[_0xf434('0x16')](_0x58c089)[_0xf434('0x18')](_0x2b12ab);}};}function respondWithFilteredResult(_0x38633a,_0x3e9e3b){return function(_0x3a8209){if(_0x3a8209){var _0x39b9c8=typeof _0x3e9e3b['offset']==='undefined'&&typeof _0x3e9e3b[_0xf434('0x19')]===_0xf434('0x1a');var _0x4ab4a8=_0x3a8209[_0xf434('0x1b')];var _0x5d4f91=_0x39b9c8?0x0:_0x3e9e3b[_0xf434('0x1c')];var _0x4a6f6c=_0x39b9c8?_0x3a8209['count']:_0x3e9e3b[_0xf434('0x1c')]+_0x3e9e3b['limit'];var _0x27ff40;if(_0x4a6f6c>=_0x4ab4a8){_0x4a6f6c=_0x4ab4a8;_0x27ff40=0xc8;}else{_0x27ff40=0xce;}_0x38633a[_0xf434('0x16')](_0x27ff40);return _0x38633a[_0xf434('0x1d')]('Content-Range',_0x5d4f91+'-'+_0x4a6f6c+'/'+_0x4ab4a8)[_0xf434('0x18')](_0x3a8209);}return null;};}function patchUpdates(_0x580772){return function(_0x114ca3){try{jsonpatch[_0xf434('0x1e')](_0x114ca3,_0x580772,!![]);}catch(_0x5ca18d){return BPromise['reject'](_0x5ca18d);}return _0x114ca3[_0xf434('0x1f')]();};}function saveUpdates(_0x2a7e83,_0x2bceb9){return function(_0x13b2b0){if(_0x13b2b0){return _0x13b2b0[_0xf434('0x20')](_0x2a7e83)[_0xf434('0x21')](function(_0x566e5a){return _0x566e5a;});}return null;};}function removeEntity(_0xb0d9f5,_0x25843f){return function(_0x8aad54){if(_0x8aad54){return _0x8aad54['destroy']()['then'](function(){_0xb0d9f5[_0xf434('0x16')](0xcc)[_0xf434('0x17')]();});}};}function handleEntityNotFound(_0x4a25db,_0x2de2ea){return function(_0x5ee7c8){if(!_0x5ee7c8){_0x4a25db[_0xf434('0x15')](0x194);}return _0x5ee7c8;};}function handleError(_0x13e82d,_0x19cf10){_0x19cf10=_0x19cf10||0x1f4;return function(_0x3b4a69){logger[_0xf434('0x22')](_0x3b4a69[_0xf434('0x23')]);if(_0x3b4a69[_0xf434('0x24')]){delete _0x3b4a69[_0xf434('0x24')];}_0x13e82d[_0xf434('0x16')](_0x19cf10)['send'](_0x3b4a69);};}exports[_0xf434('0x25')]=function(_0x1a146f,_0x24db50){var _0x561b7a={},_0x361ef2={},_0x5b42a8={'count':0x0,'rows':[]};var _0x496feb=_['map'](db[_0xf434('0x26')][_0xf434('0x27')],function(_0x52da30){return{'name':_0x52da30[_0xf434('0x28')],'type':_0x52da30[_0xf434('0x29')][_0xf434('0x2a')]};});_0x361ef2[_0xf434('0x2b')]=_[_0xf434('0x2c')](_0x496feb,_0xf434('0x24'));_0x361ef2[_0xf434('0x2d')]=_[_0xf434('0x2e')](_0x1a146f['query']);_0x361ef2['filters']=_[_0xf434('0x2f')](_0x361ef2['model'],_0x361ef2[_0xf434('0x2d')]);_0x561b7a[_0xf434('0x30')]=_['intersection'](_0x361ef2[_0xf434('0x2b')],qs[_0xf434('0x31')](_0x1a146f[_0xf434('0x2d')][_0xf434('0x31')]));_0x561b7a[_0xf434('0x30')]=_0x561b7a[_0xf434('0x30')][_0xf434('0x32')]?_0x561b7a[_0xf434('0x30')]:_0x361ef2['model'];if(!_0x1a146f[_0xf434('0x2d')][_0xf434('0x33')](_0xf434('0x34'))){_0x561b7a[_0xf434('0x19')]=qs[_0xf434('0x19')](_0x1a146f[_0xf434('0x2d')][_0xf434('0x19')]);_0x561b7a[_0xf434('0x1c')]=qs[_0xf434('0x1c')](_0x1a146f[_0xf434('0x2d')]['offset']);}_0x561b7a[_0xf434('0x35')]=qs[_0xf434('0x36')](_0x1a146f[_0xf434('0x2d')][_0xf434('0x36')]);_0x561b7a['where']=qs[_0xf434('0x37')](_[_0xf434('0x38')](_0x1a146f[_0xf434('0x2d')],_0x361ef2['filters']),_0x496feb);if(_0x1a146f[_0xf434('0x2d')][_0xf434('0x39')]){_0x561b7a['where']=_[_0xf434('0x3a')](_0x561b7a[_0xf434('0x3b')],{'$or':_[_0xf434('0x2c')](_0x496feb,function(_0x2e139c){if(_0x2e139c[_0xf434('0x29')]!==_0xf434('0x3c')){var _0xb0f919={};_0xb0f919[_0x2e139c[_0xf434('0x24')]]={'$like':'%'+_0x1a146f[_0xf434('0x2d')]['filter']+'%'};return _0xb0f919;}})});}_0x561b7a=_[_0xf434('0x3a')]({},_0x561b7a,_0x1a146f[_0xf434('0x3d')]);var _0x55a605={'where':_0x561b7a[_0xf434('0x3b')]};return db[_0xf434('0x26')]['count'](_0x55a605)[_0xf434('0x21')](function(_0x3f090c){_0x5b42a8[_0xf434('0x1b')]=_0x3f090c;if(_0x1a146f[_0xf434('0x2d')][_0xf434('0x3e')]){_0x561b7a[_0xf434('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xf434('0x40')](_0x561b7a);})[_0xf434('0x21')](function(_0x4ea116){_0x5b42a8[_0xf434('0x41')]=_0x4ea116;return _0x5b42a8;})['then'](respondWithFilteredResult(_0x24db50,_0x561b7a))[_0xf434('0x42')](handleError(_0x24db50,null));};exports[_0xf434('0x43')]=function(_0x55657d,_0x163e87){var _0x53cf7b={'raw':!![],'where':{'id':_0x55657d[_0xf434('0x44')]['id']}},_0x3836d8={};_0x3836d8['model']=_['keys'](db[_0xf434('0x26')][_0xf434('0x27')]);_0x3836d8[_0xf434('0x2d')]=_['keys'](_0x55657d[_0xf434('0x2d')]);_0x3836d8[_0xf434('0x37')]=_[_0xf434('0x2f')](_0x3836d8[_0xf434('0x2b')],_0x3836d8['query']);_0x53cf7b[_0xf434('0x30')]=_[_0xf434('0x2f')](_0x3836d8[_0xf434('0x2b')],qs[_0xf434('0x31')](_0x55657d['query'][_0xf434('0x31')]));_0x53cf7b[_0xf434('0x30')]=_0x53cf7b[_0xf434('0x30')][_0xf434('0x32')]?_0x53cf7b[_0xf434('0x30')]:_0x3836d8[_0xf434('0x2b')];if(_0x55657d['query'][_0xf434('0x3e')]){_0x53cf7b['include']=[{'all':!![]}];}_0x53cf7b=_[_0xf434('0x3a')]({},_0x53cf7b,_0x55657d[_0xf434('0x3d')]);return db[_0xf434('0x26')][_0xf434('0x45')](_0x53cf7b)['then'](handleEntityNotFound(_0x163e87,null))[_0xf434('0x21')](respondWithResult(_0x163e87,null))['catch'](handleError(_0x163e87,null));};exports[_0xf434('0x46')]=function(_0x3c42db,_0x5bebc4){return db[_0xf434('0x26')]['create'](_0x3c42db[_0xf434('0x47')],{})[_0xf434('0x21')](respondWithResult(_0x5bebc4,0xc9))[_0xf434('0x42')](handleError(_0x5bebc4,null));};exports['update']=function(_0x1de16f,_0x434dec){if(_0x1de16f[_0xf434('0x47')]['id']){delete _0x1de16f[_0xf434('0x47')]['id'];}return db[_0xf434('0x26')][_0xf434('0x45')]({'where':{'id':_0x1de16f[_0xf434('0x44')]['id']}})[_0xf434('0x21')](handleEntityNotFound(_0x434dec,null))[_0xf434('0x21')](saveUpdates(_0x1de16f[_0xf434('0x47')],null))[_0xf434('0x21')](respondWithResult(_0x434dec,null))['catch'](handleError(_0x434dec,null));};exports['destroy']=function(_0x4c4b4d,_0x22752f){return db[_0xf434('0x26')][_0xf434('0x45')]({'where':{'id':_0x4c4b4d['params']['id']}})[_0xf434('0x21')](handleEntityNotFound(_0x22752f,null))[_0xf434('0x21')](removeEntity(_0x22752f,null))['catch'](handleError(_0x22752f,null));};exports[_0xf434('0x48')]=function(_0x3db4e2,_0x4c6cd2){return db[_0xf434('0x26')][_0xf434('0x48')]()[_0xf434('0x21')](respondWithResult(_0x4c6cd2,null))[_0xf434('0x42')](handleError(_0x4c6cd2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3d43b79..6ce0bc7 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 _0x3ffb=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x1455e5,_0x732446){var _0x53b75f=function(_0x324236){while(--_0x324236){_0x1455e5['push'](_0x1455e5['shift']());}};_0x53b75f(++_0x732446);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x2a219a,_0x5ed797){_0x2a219a=_0x2a219a-0x0;var _0x471b5b=_0x3ffb[_0x2a219a];return _0x471b5b;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require(_0xb3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x45d514,_0x59bcb3){return _0x45d514[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[{'name':_0xb3ff('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f89=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x5c7701,_0x4c33b3){var _0x4db90d=function(_0x3195b1){while(--_0x3195b1){_0x5c7701['push'](_0x5c7701['shift']());}};_0x4db90d(++_0x4c33b3);}(_0x0f89,0x111));var _0x90f8=function(_0x418ca0,_0x2a51cf){_0x418ca0=_0x418ca0-0x0;var _0x366e80=_0x0f89[_0x418ca0];return _0x366e80;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require(_0x90f8('0x2'))('api');var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require(_0x90f8('0x6'));var rimraf=require('rimraf');var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module['exports']=function(_0x7b8d25,_0x4439a9){return _0x7b8d25[_0x90f8('0x9')](_0x90f8('0xa'),attributes,{'tableName':_0x90f8('0xb'),'paranoid':![],'indexes':[{'name':_0x90f8('0xc'),'fields':[_0x90f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index bbdaa9a..9599cfa 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 _0x029b=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x21f931,_0x598b2d){var _0x3f083c=function(_0x1c7c49){while(--_0x1c7c49){_0x21f931['push'](_0x21f931['shift']());}};_0x3f083c(++_0x598b2d);}(_0x029b,0x66));var _0xb029=function(_0x516d3c,_0x362179){_0x516d3c=_0x516d3c-0x0;var _0x462cc7=_0x029b[_0x516d3c];return _0x462cc7;};'use strict';var _=require(_0xb029('0x0'));var util=require(_0xb029('0x1'));var moment=require('moment');var BPromise=require(_0xb029('0x2'));var rs=require(_0xb029('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb029('0x4'))['db'];var utils=require(_0xb029('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb029('0x6'));var jayson=require(_0xb029('0x7'));var client=jayson[_0xb029('0x8')][_0xb029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15871f,_0x48b100,_0x38e856){return new BPromise(function(_0x48b3d0,_0x3fffd9){return client['request'](_0x15871f,_0x38e856)[_0xb029('0xa')](function(_0x5a8bb7){logger[_0xb029('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'));logger[_0xb029('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x48b100,_0xb029('0xc'),JSON[_0xb029('0xe')](_0x5a8bb7));if(_0x5a8bb7[_0xb029('0xf')]){if(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x10')]===0x1f4){logger['error'](_0xb029('0x11'),_0x48b100,_0x5a8bb7['error'][_0xb029('0x12')]);return _0x3fffd9(_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);}logger[_0xb029('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x48b100,_0x5a8bb7[_0xb029('0xf')][_0xb029('0x12')]);return _0x48b3d0(_0x5a8bb7[_0xb029('0xf')]['message']);}else{logger[_0xb029('0xb')](_0xb029('0x11'),_0x48b100,_0xb029('0xc'));_0x48b3d0(_0x5a8bb7[_0xb029('0x13')][_0xb029('0x12')]);}})[_0xb029('0x14')](function(_0x185292){logger[_0xb029('0xf')](_0xb029('0x11'),_0x48b100,_0x185292);_0x3fffd9(_0x185292);});});} \ No newline at end of file +var _0xc18a=['code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x3ea5a6,_0x28652a){var _0x11c5ce=function(_0x12e2cf){while(--_0x12e2cf){_0x3ea5a6['push'](_0x3ea5a6['shift']());}};_0x11c5ce(++_0x28652a);}(_0xc18a,0x1cf));var _0xac18=function(_0x37b3ef,_0x49ccd8){_0x37b3ef=_0x37b3ef-0x0;var _0x200dbe=_0xc18a[_0x37b3ef];return _0x200dbe;};'use strict';var _=require(_0xac18('0x0'));var util=require(_0xac18('0x1'));var moment=require(_0xac18('0x2'));var BPromise=require(_0xac18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac18('0x4'));var db=require(_0xac18('0x5'))['db'];var utils=require(_0xac18('0x6'));var logger=require(_0xac18('0x7'))(_0xac18('0x8'));var config=require(_0xac18('0x9'));var jayson=require(_0xac18('0xa'));var client=jayson[_0xac18('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab6cb,_0x268fa1,_0x542a9){return new BPromise(function(_0x2bf4b8,_0xd3c4bc){return client[_0xac18('0xc')](_0xab6cb,_0x542a9)[_0xac18('0xd')](function(_0x223d7f){logger[_0xac18('0xe')](_0xac18('0xf'),_0x268fa1,_0xac18('0x10'));logger[_0xac18('0x11')](_0xac18('0x12'),_0x268fa1,_0xac18('0x10'),JSON['stringify'](_0x223d7f));if(_0x223d7f[_0xac18('0x13')]){if(_0x223d7f['error'][_0xac18('0x14')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x268fa1,_0x223d7f[_0xac18('0x13')]['message']);return _0xd3c4bc(_0x223d7f['error'][_0xac18('0x15')]);}logger[_0xac18('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x268fa1,_0x223d7f[_0xac18('0x13')][_0xac18('0x15')]);return _0x2bf4b8(_0x223d7f['error'][_0xac18('0x15')]);}else{logger['info'](_0xac18('0xf'),_0x268fa1,'request\x20sent');_0x2bf4b8(_0x223d7f['result'][_0xac18('0x15')]);}})[_0xac18('0x16')](function(_0x519c07){logger['error'](_0xac18('0xf'),_0x268fa1,_0x519c07);_0xd3c4bc(_0x519c07);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 7936aee..c8beab6 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 _0xa5fc=['get','index','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','single','file','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3a5776,_0x332ba2){var _0x538c74=function(_0x1a82b2){while(--_0x1a82b2){_0x3a5776['push'](_0x3a5776['shift']());}};_0x538c74(++_0x332ba2);}(_0xa5fc,0x18e));var _0xca5f=function(_0x3470d9,_0x558b23){_0x3470d9=_0x3470d9-0x0;var _0x49e30c=_0xa5fc[_0x3470d9];return _0x49e30c;};'use strict';var multer=require(_0xca5f('0x0'));var util=require(_0xca5f('0x1'));var path=require(_0xca5f('0x2'));var timeout=require('connect-timeout');var express=require(_0xca5f('0x3'));var router=express[_0xca5f('0x4')]();var fs_extra=require(_0xca5f('0x5'));var auth=require(_0xca5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xca5f('0x7'));var controller=require('./sound.controller');router[_0xca5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xca5f('0x9')]);router[_0xca5f('0x8')](_0xca5f('0xa'),auth['isAuthenticated'](),controller[_0xca5f('0xb')]);router[_0xca5f('0x8')](_0xca5f('0xc'),auth[_0xca5f('0xd')](),controller[_0xca5f('0xe')]);var upload=multer({'storage':multer[_0xca5f('0xf')]({'destination':function(_0x27d8b3,_0x2d97ee,_0x5ae832){_0x5ae832(null,path[_0xca5f('0x10')](config['root'],_0xca5f('0x11')));},'filename':function(_0x5aa250,_0x1bcf69,_0x58b4f){_0x1bcf69[_0xca5f('0x12')]=_0x1bcf69['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58b4f(null,util[_0xca5f('0x13')](_0xca5f('0x14'),path[_0xca5f('0x15')](_0x1bcf69[_0xca5f('0x12')],path[_0xca5f('0x16')](_0x1bcf69[_0xca5f('0x12')])),Date[_0xca5f('0x17')](),path[_0xca5f('0x16')](_0x1bcf69['originalname'])));}})});router['post']('/',upload[_0xca5f('0x18')](_0xca5f('0x19')),controller['create']);router[_0xca5f('0x1a')]('/:id',auth[_0xca5f('0xd')](),controller[_0xca5f('0x1b')]);router[_0xca5f('0x1c')](_0xca5f('0xa'),auth[_0xca5f('0xd')](),controller[_0xca5f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x48d5=['./sound.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0x48d5,0x1da));var _0x548d=function(_0x3710a4,_0x411b57){_0x3710a4=_0x3710a4-0x0;var _0x470675=_0x48d5[_0x3710a4];return _0x470675;};'use strict';var multer=require(_0x548d('0x0'));var util=require(_0x548d('0x1'));var path=require('path');var timeout=require(_0x548d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x548d('0x3'));var interaction=require(_0x548d('0x4'));var config=require(_0x548d('0x5'));var controller=require(_0x548d('0x6'));router[_0x548d('0x7')]('/',auth[_0x548d('0x8')](),controller[_0x548d('0x9')]);router[_0x548d('0x7')](_0x548d('0xa'),auth[_0x548d('0x8')](),controller[_0x548d('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x548d('0xc')]);var upload=multer({'storage':multer[_0x548d('0xd')]({'destination':function(_0x3fbf5c,_0xa2de89,_0x495753){_0x495753(null,path[_0x548d('0xe')](config[_0x548d('0xf')],_0x548d('0x10')));},'filename':function(_0x17277f,_0x29ab36,_0xf95414){_0x29ab36[_0x548d('0x11')]=_0x29ab36['originalname'][_0x548d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf95414(null,util[_0x548d('0x13')](_0x548d('0x14'),path[_0x548d('0x15')](_0x29ab36['originalname'],path[_0x548d('0x16')](_0x29ab36[_0x548d('0x11')])),Date[_0x548d('0x17')](),path[_0x548d('0x16')](_0x29ab36[_0x548d('0x11')])));}})});router[_0x548d('0x18')]('/',upload[_0x548d('0x19')](_0x548d('0x1a')),controller['create']);router[_0x548d('0x1b')](_0x548d('0xa'),auth[_0x548d('0x8')](),controller[_0x548d('0x1c')]);router['delete'](_0x548d('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x548d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5a80309..28c2359 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 _0xc81e=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x22d0bd,_0xea2573){var _0x5af8c6=function(_0x43af3a){while(--_0x43af3a){_0x22d0bd['push'](_0x22d0bd['shift']());}};_0x5af8c6(++_0xea2573);}(_0xc81e,0xff));var _0xec81=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xc81e[_0x5ca5bc];return _0x26ca86;};'use strict';var Sequelize=require(_0xec81('0x0'));module[_0xec81('0x1')]={'name':{'type':Sequelize[_0xec81('0x2')],'unique':_0xec81('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xec81('0x2')]},'display_name':{'type':Sequelize[_0xec81('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xec81('0x2')]},'original_format':{'type':Sequelize[_0xec81('0x2')]},'original_duration':{'type':Sequelize[_0xec81('0x4')]},'original_sampleCount':{'type':Sequelize[_0xec81('0x5')]},'original_channelCount':{'type':Sequelize[_0xec81('0x6')]},'original_bitRate':{'type':Sequelize[_0xec81('0x5')]},'original_sampleRate':{'type':Sequelize[_0xec81('0x6')]},'converted_format':{'type':Sequelize[_0xec81('0x2')]},'converted_duration':{'type':Sequelize[_0xec81('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xec81('0x5')]},'converted_channelCount':{'type':Sequelize[_0xec81('0x6')]},'converted_bitRate':{'type':Sequelize[_0xec81('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xec81('0x6')]}}; \ No newline at end of file +var _0x881d=['FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x550b28,_0x1b10b9){var _0x751ce5=function(_0x336314){while(--_0x336314){_0x550b28['push'](_0x550b28['shift']());}};_0x751ce5(++_0x1b10b9);}(_0x881d,0x1cf));var _0xd881=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x881d[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xd881('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd881('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd881('0x1')]},'original_format':{'type':Sequelize[_0xd881('0x1')]},'original_duration':{'type':Sequelize[_0xd881('0x2')]},'original_sampleCount':{'type':Sequelize[_0xd881('0x3')]},'original_channelCount':{'type':Sequelize[_0xd881('0x4')]},'original_bitRate':{'type':Sequelize[_0xd881('0x3')]},'original_sampleRate':{'type':Sequelize[_0xd881('0x4')]},'converted_format':{'type':Sequelize[_0xd881('0x1')]},'converted_duration':{'type':Sequelize[_0xd881('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xd881('0x3')]},'converted_channelCount':{'type':Sequelize[_0xd881('0x4')]},'converted_bitRate':{'type':Sequelize[_0xd881('0x3')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b4225a5..f2759cf 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 _0x95c9=['bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','map','Sound','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','download','save_name','existsSync','root','server/files/sounds/converted','Sound\x20not\x20found','format','%s.%s','converted_format','create','basename','originalname','file','filename','extname','substring','wav','join','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','body','userProfileId','user','UserProfileSection','find','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','delete','original_format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x483ebd,_0x518149){var _0x337843=function(_0x5ef04a){while(--_0x5ef04a){_0x483ebd['push'](_0x483ebd['shift']());}};_0x337843(++_0x518149);}(_0x95c9,0x78));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x995c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x995c('0x1'));var rp=require(_0x995c('0x2'));var moment=require(_0x995c('0x3'));var BPromise=require(_0x995c('0x4'));var Mustache=require('mustache');var util=require(_0x995c('0x5'));var path=require(_0x995c('0x6'));var sox=require(_0x995c('0x7'));var csv=require(_0x995c('0x8'));var ejs=require(_0x995c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x995c('0xa'));var squel=require('squel');var crypto=require(_0x995c('0xb'));var jsforce=require(_0x995c('0xc'));var deskjs=require(_0x995c('0xd'));var toCsv=require(_0x995c('0x8'));var querystring=require(_0x995c('0xe'));var Papa=require(_0x995c('0xf'));var Redis=require(_0x995c('0x10'));var authService=require(_0x995c('0x11'));var qs=require(_0x995c('0x12'));var as=require(_0x995c('0x13'));var hardwareService=require(_0x995c('0x14'));var logger=require('../../config/logger')(_0x995c('0x15'));var utils=require(_0x995c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x995c('0x17'));var db=require(_0x995c('0x18'))['db'];function respondWithStatusCode(_0x1be672,_0x1509c7){_0x1509c7=_0x1509c7||0xcc;return function(_0x354c92){if(_0x354c92){return _0x1be672[_0x995c('0x19')](_0x1509c7);}return _0x1be672['status'](_0x1509c7)['end']();};}function respondWithResult(_0x2a4d87,_0x2aaeca){_0x2aaeca=_0x2aaeca||0xc8;return function(_0x229bf4){if(_0x229bf4){return _0x2a4d87[_0x995c('0x1a')](_0x2aaeca)[_0x995c('0x1b')](_0x229bf4);}};}function respondWithFilteredResult(_0x11e4e2,_0x156d29){return function(_0x32a447){if(_0x32a447){var _0x553eba=typeof _0x156d29['offset']===_0x995c('0x1c')&&typeof _0x156d29['limit']===_0x995c('0x1c');var _0x1bd079=_0x32a447['count'];var _0x512928=_0x553eba?0x0:_0x156d29[_0x995c('0x1d')];var _0x4c7d97=_0x553eba?_0x32a447[_0x995c('0x1e')]:_0x156d29[_0x995c('0x1d')]+_0x156d29['limit'];var _0x13fc68;if(_0x4c7d97>=_0x1bd079){_0x4c7d97=_0x1bd079;_0x13fc68=0xc8;}else{_0x13fc68=0xce;}_0x11e4e2[_0x995c('0x1a')](_0x13fc68);return _0x11e4e2['set'](_0x995c('0x1f'),_0x512928+'-'+_0x4c7d97+'/'+_0x1bd079)[_0x995c('0x1b')](_0x32a447);}return null;};}function patchUpdates(_0x519352){return function(_0x29c986){try{jsonpatch[_0x995c('0x20')](_0x29c986,_0x519352,!![]);}catch(_0x2e50c4){return BPromise[_0x995c('0x21')](_0x2e50c4);}return _0x29c986[_0x995c('0x22')]();};}function saveUpdates(_0x33e67f,_0x2628e5){return function(_0x51f7ad){if(_0x51f7ad){return _0x51f7ad[_0x995c('0x23')](_0x33e67f)[_0x995c('0x24')](function(_0x57f887){return _0x57f887;});}return null;};}function removeEntity(_0x37bcf8,_0x31e854){return function(_0x1a0ea5){if(_0x1a0ea5){return _0x1a0ea5[_0x995c('0x25')]()[_0x995c('0x24')](function(){var _0x44ad4c=_0x1a0ea5[_0x995c('0x26')]({'plain':!![]});var _0x258f99='Sounds';return db[_0x995c('0x27')][_0x995c('0x25')]({'where':{'type':_0x258f99,'resourceId':_0x44ad4c['id']}})['then'](function(){return _0x1a0ea5;});})[_0x995c('0x24')](function(){_0x37bcf8['status'](0xcc)[_0x995c('0x28')]();});}};}function handleEntityNotFound(_0x128dc1,_0x2c743c){return function(_0x370cdf){if(!_0x370cdf){_0x128dc1[_0x995c('0x19')](0x194);}return _0x370cdf;};}function handleError(_0x156083,_0x2dae99){_0x2dae99=_0x2dae99||0x1f4;return function(_0x358c5a){logger[_0x995c('0x29')](_0x358c5a['stack']);if(_0x358c5a[_0x995c('0x2a')]){delete _0x358c5a['name'];}_0x156083[_0x995c('0x1a')](_0x2dae99)['send'](_0x358c5a);};}exports['index']=function(_0xd995f9,_0x3088ce){var _0xc91c3c={},_0x2695d1={},_0x374be7={'count':0x0,'rows':[]};var _0x29f8b7=_[_0x995c('0x2b')](db[_0x995c('0x2c')]['rawAttributes'],function(_0x178ff){return{'name':_0x178ff[_0x995c('0x2d')],'type':_0x178ff[_0x995c('0x2e')]['key']};});_0x2695d1[_0x995c('0x2f')]=_[_0x995c('0x2b')](_0x29f8b7,_0x995c('0x2a'));_0x2695d1[_0x995c('0x30')]=_[_0x995c('0x31')](_0xd995f9['query']);_0x2695d1['filters']=_['intersection'](_0x2695d1[_0x995c('0x2f')],_0x2695d1[_0x995c('0x30')]);_0xc91c3c[_0x995c('0x32')]=_[_0x995c('0x33')](_0x2695d1[_0x995c('0x2f')],qs[_0x995c('0x34')](_0xd995f9[_0x995c('0x30')][_0x995c('0x34')]));_0xc91c3c[_0x995c('0x32')]=_0xc91c3c['attributes'][_0x995c('0x35')]?_0xc91c3c['attributes']:_0x2695d1[_0x995c('0x2f')];if(!_0xd995f9[_0x995c('0x30')][_0x995c('0x36')](_0x995c('0x37'))){_0xc91c3c[_0x995c('0x38')]=qs['limit'](_0xd995f9[_0x995c('0x30')]['limit']);_0xc91c3c[_0x995c('0x1d')]=qs[_0x995c('0x1d')](_0xd995f9[_0x995c('0x30')]['offset']);}_0xc91c3c[_0x995c('0x39')]=qs[_0x995c('0x3a')](_0xd995f9[_0x995c('0x30')]['sort']);_0xc91c3c[_0x995c('0x3b')]=qs[_0x995c('0x3c')](_[_0x995c('0x3d')](_0xd995f9['query'],_0x2695d1[_0x995c('0x3c')]),_0x29f8b7);if(_0xd995f9[_0x995c('0x30')][_0x995c('0x3e')]){_0xc91c3c[_0x995c('0x3b')]=_[_0x995c('0x3f')](_0xc91c3c['where'],{'$or':_[_0x995c('0x2b')](_0x29f8b7,function(_0x2752eb){if(_0x2752eb[_0x995c('0x2e')]!==_0x995c('0x40')){var _0xa838dd={};_0xa838dd[_0x2752eb['name']]={'$like':'%'+_0xd995f9[_0x995c('0x30')]['filter']+'%'};return _0xa838dd;}})});}_0xc91c3c=_[_0x995c('0x3f')]({},_0xc91c3c,_0xd995f9[_0x995c('0x41')]);var _0x15430f={'where':_0xc91c3c['where']};return db[_0x995c('0x2c')][_0x995c('0x1e')](_0x15430f)[_0x995c('0x24')](function(_0x438b20){_0x374be7[_0x995c('0x1e')]=_0x438b20;if(_0xd995f9['query'][_0x995c('0x42')]){_0xc91c3c[_0x995c('0x43')]=[{'all':!![]}];}return db['Sound'][_0x995c('0x44')](_0xc91c3c);})[_0x995c('0x24')](function(_0x232bf5){_0x374be7[_0x995c('0x45')]=_0x232bf5;return _0x374be7;})[_0x995c('0x24')](respondWithFilteredResult(_0x3088ce,_0xc91c3c))[_0x995c('0x46')](handleError(_0x3088ce,null));};exports[_0x995c('0x47')]=function(_0x36d217,_0x48a67c){var _0x2fadb7={'raw':!![],'where':{'id':_0x36d217['params']['id']}},_0x142dc3={};_0x142dc3[_0x995c('0x2f')]=_['keys'](db[_0x995c('0x2c')][_0x995c('0x48')]);_0x142dc3['query']=_[_0x995c('0x31')](_0x36d217[_0x995c('0x30')]);_0x142dc3['filters']=_[_0x995c('0x33')](_0x142dc3[_0x995c('0x2f')],_0x142dc3[_0x995c('0x30')]);_0x2fadb7[_0x995c('0x32')]=_[_0x995c('0x33')](_0x142dc3['model'],qs[_0x995c('0x34')](_0x36d217[_0x995c('0x30')][_0x995c('0x34')]));_0x2fadb7[_0x995c('0x32')]=_0x2fadb7[_0x995c('0x32')][_0x995c('0x35')]?_0x2fadb7[_0x995c('0x32')]:_0x142dc3['model'];if(_0x36d217['query'][_0x995c('0x42')]){_0x2fadb7[_0x995c('0x43')]=[{'all':!![]}];}_0x2fadb7=_[_0x995c('0x3f')]({},_0x2fadb7,_0x36d217['options']);return db[_0x995c('0x2c')]['find'](_0x2fadb7)[_0x995c('0x24')](handleEntityNotFound(_0x48a67c,null))[_0x995c('0x24')](respondWithResult(_0x48a67c,null))[_0x995c('0x46')](handleError(_0x48a67c,null));};exports[_0x995c('0x49')]=function(_0x2eb2e5,_0x500ba5,_0x509a82){return db[_0x995c('0x2c')]['find']({'where':{'id':_0x2eb2e5['params']['id']},'attributes':[_0x995c('0x2a'),_0x995c('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x500ba5,null))['then'](function(_0x8f1d7f){if(_0x8f1d7f){if(!fs[_0x995c('0x4b')](path['join'](config[_0x995c('0x4c')],_0x995c('0x4d'),_0x8f1d7f[_0x995c('0x4a')]+'.'+_0x8f1d7f['converted_format']))){throw new db['Sequelize']['ValidationError'](_0x995c('0x4e'));}return _0x500ba5[_0x995c('0x49')](path['join'](config[_0x995c('0x4c')],_0x995c('0x4d'),util[_0x995c('0x4f')](_0x995c('0x50'),_0x8f1d7f[_0x995c('0x4a')],_0x8f1d7f['converted_format'])),util['format'](_0x995c('0x50'),_0x8f1d7f['name'],_0x8f1d7f[_0x995c('0x51')]));}return null;})[_0x995c('0x46')](handleError(_0x500ba5,null));};exports[_0x995c('0x52')]=function(_0x5b7426,_0x43c52c,_0x43163c){var _0x22b2c2={'name':path[_0x995c('0x53')](_0x5b7426['file'][_0x995c('0x54')],path['extname'](_0x5b7426[_0x995c('0x55')][_0x995c('0x54')])),'save_name':path[_0x995c('0x53')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')],path[_0x995c('0x57')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')])),'original_format':path['extname'](_0x5b7426['file'][_0x995c('0x54')])[_0x995c('0x58')](0x1),'converted_format':_0x995c('0x59')};var _0x51aa06=path[_0x995c('0x5a')](config[_0x995c('0x4c')],_0x995c('0x5b'),_0x5b7426[_0x995c('0x55')][_0x995c('0x56')]);var _0x5a0673=path[_0x995c('0x5a')](config['root'],'server/files/sounds/converted',util[_0x995c('0x4f')](_0x995c('0x50'),path[_0x995c('0x53')](_0x5b7426[_0x995c('0x55')][_0x995c('0x56')],path[_0x995c('0x57')](_0x5b7426[_0x995c('0x55')]['filename'])),_0x22b2c2[_0x995c('0x51')]));logger[_0x995c('0x5c')](_0x995c('0x5d'),_0x51aa06);logger[_0x995c('0x5c')](_0x995c('0x5e'),_0x5a0673);try{fs[_0x995c('0x5f')](_0x51aa06,parseInt(_0x995c('0x60'),0x8));var _0x4abb08=sox[_0x995c('0x61')](_0x51aa06,_0x5a0673,{'sampleRate':0x1f40,'format':_0x995c('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4abb08['on'](_0x995c('0x29'),function(_0x2781fd){fs[_0x995c('0x62')](_0x51aa06);_0x43c52c[_0x995c('0x1a')](0x1f4)[_0x995c('0x63')](_0x2781fd);});_0x4abb08['on']('src',function(_0x28f98f){_0x22b2c2['original_duration']=isNaN(_0x28f98f['duration'])?null:_0x28f98f[_0x995c('0x64')]*0x3e8;_0x22b2c2[_0x995c('0x65')]=isNaN(_0x28f98f['sampleCount'])?null:_0x28f98f[_0x995c('0x66')];_0x22b2c2['original_channelCount']=isNaN(_0x28f98f[_0x995c('0x67')])?null:_0x28f98f[_0x995c('0x67')];_0x22b2c2['original_bitRate']=isNaN(_0x28f98f[_0x995c('0x68')])?null:_0x28f98f[_0x995c('0x68')];_0x22b2c2[_0x995c('0x69')]=isNaN(_0x28f98f[_0x995c('0x6a')])?null:_0x28f98f['sampleRate'];});_0x4abb08['on'](_0x995c('0x6b'),function(_0x43d4a4){_0x22b2c2[_0x995c('0x6c')]=isNaN(_0x43d4a4[_0x995c('0x64')])?null:_0x43d4a4['duration']*0x3e8;_0x22b2c2['converted_sampleCount']=isNaN(_0x43d4a4[_0x995c('0x66')])?null:_0x43d4a4[_0x995c('0x66')];_0x22b2c2[_0x995c('0x6d')]=isNaN(_0x43d4a4[_0x995c('0x67')])?null:_0x43d4a4['channelCount'];_0x22b2c2['converted_bitRate']=isNaN(_0x43d4a4[_0x995c('0x68')])?null:_0x43d4a4[_0x995c('0x68')];_0x22b2c2[_0x995c('0x6e')]=isNaN(_0x43d4a4['sampleRate'])?null:_0x43d4a4[_0x995c('0x6a')];});_0x4abb08['on'](_0x995c('0x28'),function(){fs[_0x995c('0x5f')](_0x5a0673,parseInt('0777',0x8));return db[_0x995c('0x2c')][_0x995c('0x52')](_0x22b2c2)[_0x995c('0x24')](function(_0x2502dc){var _0x4d2c25={'role':_0x5b7426[_0x995c('0x6f')]['role'],'userProfileId':_0x5b7426[_0x995c('0x6f')][_0x995c('0x70')]};if(!_0x4d2c25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2c25['role']===_0x995c('0x71')){var _0x36a435=_0x2502dc[_0x995c('0x26')]({'plain':!![]});return db[_0x995c('0x72')][_0x995c('0x73')]({'where':{'name':_0x995c('0x74'),'userProfileId':_0x4d2c25['userProfileId']},'raw':!![]})[_0x995c('0x24')](function(_0x247d69){if(_0x247d69&&_0x247d69[_0x995c('0x75')]===0x0){return db['UserProfileResource']['create']({'name':_0x36a435[_0x995c('0x2a')],'resourceId':_0x36a435['id'],'type':_0x247d69[_0x995c('0x2a')],'sectionId':_0x247d69['id']},{})[_0x995c('0x24')](function(){return _0x2502dc;});}else{return _0x2502dc;}})[_0x995c('0x46')](function(_0x137716){logger[_0x995c('0x29')](_0x995c('0x76'),_0x137716);throw _0x137716;});}return _0x2502dc;})['then'](respondWithResult(_0x43c52c,null))['catch'](handleError(_0x43c52c,null));});_0x4abb08[_0x995c('0x77')]();}catch(_0x34f507){_0x43c52c[_0x995c('0x1a')](0x1f4)[_0x995c('0x63')](_0x34f507);}};exports['update']=function(_0x23f609,_0x2a3493,_0x2d778e){return db[_0x995c('0x2c')]['find']({'where':{'id':_0x23f609[_0x995c('0x78')]['id']}})[_0x995c('0x24')](handleEntityNotFound(_0x2a3493,null))[_0x995c('0x24')](saveUpdates(_[_0x995c('0x3d')](_0x23f609['body'],['name',_0x995c('0x79')]),null))[_0x995c('0x24')](respondWithResult(_0x2a3493,null))[_0x995c('0x46')](handleError(_0x2a3493,null));};exports[_0x995c('0x7a')]=function(_0x53df81,_0x371784,_0x140302){return db[_0x995c('0x2c')][_0x995c('0x73')]({'where':{'id':_0x53df81[_0x995c('0x78')]['id']}})['then'](function(_0x576f05){if(_0x576f05){return _0x576f05[_0x995c('0x25')]();}})[_0x995c('0x24')](function(_0x4517c0){var _0x5bae74=path[_0x995c('0x5a')](config[_0x995c('0x4c')],'server/files/sounds/original',util[_0x995c('0x4f')](_0x995c('0x50'),_0x4517c0[_0x995c('0x4a')],_0x4517c0[_0x995c('0x7b')]));var _0x102ab1=path[_0x995c('0x5a')](config[_0x995c('0x4c')],_0x995c('0x4d'),util['format'](_0x995c('0x50'),_0x4517c0['save_name'],_0x4517c0[_0x995c('0x51')]));fs[_0x995c('0x62')](_0x5bae74);fs['unlinkSync'](_0x102ab1);return _0x4517c0;})[_0x995c('0x24')](function(_0x576334){if(_0x576334){return _0x371784['status'](0xcc)[_0x995c('0x28')]();}})[_0x995c('0x24')](handleEntityNotFound(_0x371784,null))['catch'](handleError(_0x371784,null));}; \ No newline at end of file +var _0x0896=['fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','download','format','%s.%s','create','file','originalname','extname','basename','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','sampleRate','converted_duration','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','apply','update','then','get','Sounds','UserProfileResource','destroy','sendStatus','stack','name','send','index','Sound','rawAttributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0896,0x13d));var _0x6089=function(_0x62c9a5,_0x52e53f){_0x62c9a5=_0x62c9a5-0x0;var _0x176555=_0x0896[_0x62c9a5];return _0x176555;};'use strict';var emlformat=require(_0x6089('0x0'));var rimraf=require(_0x6089('0x1'));var zipdir=require(_0x6089('0x2'));var jsonpatch=require(_0x6089('0x3'));var rp=require(_0x6089('0x4'));var moment=require(_0x6089('0x5'));var BPromise=require(_0x6089('0x6'));var Mustache=require(_0x6089('0x7'));var util=require(_0x6089('0x8'));var path=require('path');var sox=require(_0x6089('0x9'));var csv=require(_0x6089('0xa'));var ejs=require(_0x6089('0xb'));var fs=require('fs');var fs_extra=require(_0x6089('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6089('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6089('0xe'));var toCsv=require(_0x6089('0xa'));var querystring=require(_0x6089('0xf'));var Papa=require(_0x6089('0x10'));var Redis=require(_0x6089('0x11'));var authService=require(_0x6089('0x12'));var qs=require(_0x6089('0x13'));var as=require(_0x6089('0x14'));var hardwareService=require(_0x6089('0x15'));var logger=require(_0x6089('0x16'))('api');var utils=require(_0x6089('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6089('0x18'));var db=require(_0x6089('0x19'))['db'];function respondWithStatusCode(_0x30780c,_0x398524){_0x398524=_0x398524||0xcc;return function(_0x15192d){if(_0x15192d){return _0x30780c['sendStatus'](_0x398524);}return _0x30780c[_0x6089('0x1a')](_0x398524)[_0x6089('0x1b')]();};}function respondWithResult(_0x35c462,_0x18fd86){_0x18fd86=_0x18fd86||0xc8;return function(_0xe527a4){if(_0xe527a4){return _0x35c462['status'](_0x18fd86)[_0x6089('0x1c')](_0xe527a4);}};}function respondWithFilteredResult(_0x4e8155,_0x35b545){return function(_0x4ba926){if(_0x4ba926){var _0x5e4f35=typeof _0x35b545[_0x6089('0x1d')]===_0x6089('0x1e')&&typeof _0x35b545['limit']===_0x6089('0x1e');var _0x471861=_0x4ba926[_0x6089('0x1f')];var _0x3ca2df=_0x5e4f35?0x0:_0x35b545['offset'];var _0x21131=_0x5e4f35?_0x4ba926[_0x6089('0x1f')]:_0x35b545[_0x6089('0x1d')]+_0x35b545['limit'];var _0x568298;if(_0x21131>=_0x471861){_0x21131=_0x471861;_0x568298=0xc8;}else{_0x568298=0xce;}_0x4e8155['status'](_0x568298);return _0x4e8155['set']('Content-Range',_0x3ca2df+'-'+_0x21131+'/'+_0x471861)[_0x6089('0x1c')](_0x4ba926);}return null;};}function patchUpdates(_0x514a2f){return function(_0x365336){try{jsonpatch[_0x6089('0x20')](_0x365336,_0x514a2f,!![]);}catch(_0x459572){return BPromise['reject'](_0x459572);}return _0x365336['save']();};}function saveUpdates(_0x303566,_0x49c631){return function(_0x160da5){if(_0x160da5){return _0x160da5[_0x6089('0x21')](_0x303566)[_0x6089('0x22')](function(_0x58811a){return _0x58811a;});}return null;};}function removeEntity(_0x130428,_0xc55e4f){return function(_0x5ea458){if(_0x5ea458){return _0x5ea458['destroy']()[_0x6089('0x22')](function(){var _0x4e33b4=_0x5ea458[_0x6089('0x23')]({'plain':!![]});var _0x3012d4=_0x6089('0x24');return db[_0x6089('0x25')][_0x6089('0x26')]({'where':{'type':_0x3012d4,'resourceId':_0x4e33b4['id']}})[_0x6089('0x22')](function(){return _0x5ea458;});})[_0x6089('0x22')](function(){_0x130428[_0x6089('0x1a')](0xcc)[_0x6089('0x1b')]();});}};}function handleEntityNotFound(_0x6e97c7,_0x324f0f){return function(_0x32e43b){if(!_0x32e43b){_0x6e97c7[_0x6089('0x27')](0x194);}return _0x32e43b;};}function handleError(_0x61b825,_0x237ba8){_0x237ba8=_0x237ba8||0x1f4;return function(_0x118738){logger['error'](_0x118738[_0x6089('0x28')]);if(_0x118738[_0x6089('0x29')]){delete _0x118738[_0x6089('0x29')];}_0x61b825[_0x6089('0x1a')](_0x237ba8)[_0x6089('0x2a')](_0x118738);};}exports[_0x6089('0x2b')]=function(_0x5db310,_0x175745){var _0x3494ee={},_0x24aa2b={},_0x3d9809={'count':0x0,'rows':[]};var _0x1165fc=_['map'](db[_0x6089('0x2c')][_0x6089('0x2d')],function(_0x1c7018){return{'name':_0x1c7018[_0x6089('0x2e')],'type':_0x1c7018[_0x6089('0x2f')][_0x6089('0x30')]};});_0x24aa2b[_0x6089('0x31')]=_[_0x6089('0x32')](_0x1165fc,'name');_0x24aa2b[_0x6089('0x33')]=_[_0x6089('0x34')](_0x5db310[_0x6089('0x33')]);_0x24aa2b[_0x6089('0x35')]=_[_0x6089('0x36')](_0x24aa2b[_0x6089('0x31')],_0x24aa2b[_0x6089('0x33')]);_0x3494ee[_0x6089('0x37')]=_[_0x6089('0x36')](_0x24aa2b[_0x6089('0x31')],qs['fields'](_0x5db310[_0x6089('0x33')][_0x6089('0x38')]));_0x3494ee['attributes']=_0x3494ee['attributes'][_0x6089('0x39')]?_0x3494ee[_0x6089('0x37')]:_0x24aa2b['model'];if(!_0x5db310[_0x6089('0x33')]['hasOwnProperty']('nolimit')){_0x3494ee[_0x6089('0x3a')]=qs['limit'](_0x5db310[_0x6089('0x33')]['limit']);_0x3494ee[_0x6089('0x1d')]=qs[_0x6089('0x1d')](_0x5db310[_0x6089('0x33')][_0x6089('0x1d')]);}_0x3494ee[_0x6089('0x3b')]=qs[_0x6089('0x3c')](_0x5db310[_0x6089('0x33')][_0x6089('0x3c')]);_0x3494ee[_0x6089('0x3d')]=qs[_0x6089('0x35')](_[_0x6089('0x3e')](_0x5db310[_0x6089('0x33')],_0x24aa2b[_0x6089('0x35')]),_0x1165fc);if(_0x5db310[_0x6089('0x33')][_0x6089('0x3f')]){_0x3494ee[_0x6089('0x3d')]=_[_0x6089('0x40')](_0x3494ee[_0x6089('0x3d')],{'$or':_[_0x6089('0x32')](_0x1165fc,function(_0x420281){if(_0x420281[_0x6089('0x2f')]!==_0x6089('0x41')){var _0x38d670={};_0x38d670[_0x420281[_0x6089('0x29')]]={'$like':'%'+_0x5db310['query'][_0x6089('0x3f')]+'%'};return _0x38d670;}})});}_0x3494ee=_['merge']({},_0x3494ee,_0x5db310[_0x6089('0x42')]);var _0x42778a={'where':_0x3494ee[_0x6089('0x3d')]};return db['Sound']['count'](_0x42778a)['then'](function(_0x5c953a){_0x3d9809['count']=_0x5c953a;if(_0x5db310[_0x6089('0x33')]['includeAll']){_0x3494ee[_0x6089('0x43')]=[{'all':!![]}];}return db[_0x6089('0x2c')][_0x6089('0x44')](_0x3494ee);})['then'](function(_0x1f5b9c){_0x3d9809['rows']=_0x1f5b9c;return _0x3d9809;})[_0x6089('0x22')](respondWithFilteredResult(_0x175745,_0x3494ee))[_0x6089('0x45')](handleError(_0x175745,null));};exports[_0x6089('0x46')]=function(_0x559018,_0x15de1d){var _0x3d94e8={'raw':!![],'where':{'id':_0x559018['params']['id']}},_0x370185={};_0x370185[_0x6089('0x31')]=_[_0x6089('0x34')](db[_0x6089('0x2c')][_0x6089('0x2d')]);_0x370185[_0x6089('0x33')]=_[_0x6089('0x34')](_0x559018[_0x6089('0x33')]);_0x370185['filters']=_[_0x6089('0x36')](_0x370185[_0x6089('0x31')],_0x370185[_0x6089('0x33')]);_0x3d94e8[_0x6089('0x37')]=_[_0x6089('0x36')](_0x370185['model'],qs[_0x6089('0x38')](_0x559018[_0x6089('0x33')][_0x6089('0x38')]));_0x3d94e8['attributes']=_0x3d94e8['attributes']['length']?_0x3d94e8[_0x6089('0x37')]:_0x370185['model'];if(_0x559018[_0x6089('0x33')][_0x6089('0x47')]){_0x3d94e8['include']=[{'all':!![]}];}_0x3d94e8=_[_0x6089('0x40')]({},_0x3d94e8,_0x559018[_0x6089('0x42')]);return db['Sound'][_0x6089('0x48')](_0x3d94e8)[_0x6089('0x22')](handleEntityNotFound(_0x15de1d,null))[_0x6089('0x22')](respondWithResult(_0x15de1d,null))[_0x6089('0x45')](handleError(_0x15de1d,null));};exports['download']=function(_0x305fad,_0x3ada36,_0x596855){return db[_0x6089('0x2c')][_0x6089('0x48')]({'where':{'id':_0x305fad[_0x6089('0x49')]['id']},'attributes':[_0x6089('0x29'),_0x6089('0x4a'),_0x6089('0x4b')],'raw':!![]})[_0x6089('0x22')](handleEntityNotFound(_0x3ada36,null))['then'](function(_0x2551f9){if(_0x2551f9){if(!fs[_0x6089('0x4c')](path[_0x6089('0x4d')](config[_0x6089('0x4e')],_0x6089('0x4f'),_0x2551f9[_0x6089('0x4a')]+'.'+_0x2551f9[_0x6089('0x4b')]))){throw new db[(_0x6089('0x50'))][(_0x6089('0x51'))]('Sound\x20not\x20found');}return _0x3ada36[_0x6089('0x52')](path[_0x6089('0x4d')](config[_0x6089('0x4e')],_0x6089('0x4f'),util[_0x6089('0x53')]('%s.%s',_0x2551f9[_0x6089('0x4a')],_0x2551f9[_0x6089('0x4b')])),util[_0x6089('0x53')](_0x6089('0x54'),_0x2551f9[_0x6089('0x29')],_0x2551f9[_0x6089('0x4b')]));}return null;})[_0x6089('0x45')](handleError(_0x3ada36,null));};exports[_0x6089('0x55')]=function(_0x2841dc,_0x549315,_0x14fd29){var _0x132015={'name':path['basename'](_0x2841dc[_0x6089('0x56')][_0x6089('0x57')],path[_0x6089('0x58')](_0x2841dc[_0x6089('0x56')]['originalname'])),'save_name':path[_0x6089('0x59')](_0x2841dc['file'][_0x6089('0x5a')],path[_0x6089('0x58')](_0x2841dc['file'][_0x6089('0x5a')])),'original_format':path['extname'](_0x2841dc[_0x6089('0x56')]['originalname'])['substring'](0x1),'converted_format':_0x6089('0x5b')};var _0x3d3d6a=path[_0x6089('0x4d')](config[_0x6089('0x4e')],_0x6089('0x5c'),_0x2841dc['file'][_0x6089('0x5a')]);var _0x2613d8=path[_0x6089('0x4d')](config[_0x6089('0x4e')],_0x6089('0x4f'),util[_0x6089('0x53')](_0x6089('0x54'),path[_0x6089('0x59')](_0x2841dc['file'][_0x6089('0x5a')],path[_0x6089('0x58')](_0x2841dc['file'][_0x6089('0x5a')])),_0x132015[_0x6089('0x4b')]));logger[_0x6089('0x5d')](_0x6089('0x5e'),_0x3d3d6a);logger['info'](_0x6089('0x5f'),_0x2613d8);try{fs[_0x6089('0x60')](_0x3d3d6a,parseInt(_0x6089('0x61'),0x8));var _0x4156d5=sox['transcode'](_0x3d3d6a,_0x2613d8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4156d5['on'](_0x6089('0x62'),function(_0x286367){fs[_0x6089('0x63')](_0x3d3d6a);_0x549315[_0x6089('0x1a')](0x1f4)['send'](_0x286367);});_0x4156d5['on'](_0x6089('0x64'),function(_0x10c226){_0x132015[_0x6089('0x65')]=isNaN(_0x10c226[_0x6089('0x66')])?null:_0x10c226[_0x6089('0x66')]*0x3e8;_0x132015[_0x6089('0x67')]=isNaN(_0x10c226[_0x6089('0x68')])?null:_0x10c226[_0x6089('0x68')];_0x132015[_0x6089('0x69')]=isNaN(_0x10c226['channelCount'])?null:_0x10c226[_0x6089('0x6a')];_0x132015[_0x6089('0x6b')]=isNaN(_0x10c226['bitRate'])?null:_0x10c226['bitRate'];_0x132015['original_sampleRate']=isNaN(_0x10c226['sampleRate'])?null:_0x10c226[_0x6089('0x6c')];});_0x4156d5['on']('dest',function(_0x365076){_0x132015[_0x6089('0x6d')]=isNaN(_0x365076['duration'])?null:_0x365076[_0x6089('0x66')]*0x3e8;_0x132015['converted_sampleCount']=isNaN(_0x365076['sampleCount'])?null:_0x365076[_0x6089('0x68')];_0x132015['converted_channelCount']=isNaN(_0x365076['channelCount'])?null:_0x365076[_0x6089('0x6a')];_0x132015[_0x6089('0x6e')]=isNaN(_0x365076['bitRate'])?null:_0x365076['bitRate'];_0x132015[_0x6089('0x6f')]=isNaN(_0x365076[_0x6089('0x6c')])?null:_0x365076['sampleRate'];});_0x4156d5['on'](_0x6089('0x1b'),function(){fs[_0x6089('0x60')](_0x2613d8,parseInt(_0x6089('0x61'),0x8));return db[_0x6089('0x2c')][_0x6089('0x55')](_0x132015)[_0x6089('0x22')](function(_0x5b833f){var _0x513869={'role':_0x2841dc['body'][_0x6089('0x70')],'userProfileId':_0x2841dc[_0x6089('0x71')][_0x6089('0x72')]};if(!_0x513869)throw new Error(_0x6089('0x73'));if(_0x513869['role']==='user'){var _0x50b32c=_0x5b833f[_0x6089('0x23')]({'plain':!![]});return db[_0x6089('0x74')][_0x6089('0x48')]({'where':{'name':_0x6089('0x24'),'userProfileId':_0x513869[_0x6089('0x72')]},'raw':!![]})['then'](function(_0x476394){if(_0x476394&&_0x476394['autoAssociation']===0x0){return db[_0x6089('0x25')][_0x6089('0x55')]({'name':_0x50b32c[_0x6089('0x29')],'resourceId':_0x50b32c['id'],'type':_0x476394['name'],'sectionId':_0x476394['id']},{})[_0x6089('0x22')](function(){return _0x5b833f;});}else{return _0x5b833f;}})[_0x6089('0x45')](function(_0x2219ba){logger[_0x6089('0x62')](_0x6089('0x75'),_0x2219ba);throw _0x2219ba;});}return _0x5b833f;})[_0x6089('0x22')](respondWithResult(_0x549315,null))[_0x6089('0x45')](handleError(_0x549315,null));});_0x4156d5[_0x6089('0x76')]();}catch(_0x38ae9a){_0x549315[_0x6089('0x1a')](0x1f4)[_0x6089('0x2a')](_0x38ae9a);}};exports[_0x6089('0x21')]=function(_0x2992c7,_0xf00560,_0x2ee868){return db[_0x6089('0x2c')]['find']({'where':{'id':_0x2992c7[_0x6089('0x49')]['id']}})[_0x6089('0x22')](handleEntityNotFound(_0xf00560,null))[_0x6089('0x22')](saveUpdates(_['pick'](_0x2992c7[_0x6089('0x71')],['name',_0x6089('0x77')]),null))['then'](respondWithResult(_0xf00560,null))[_0x6089('0x45')](handleError(_0xf00560,null));};exports[_0x6089('0x78')]=function(_0x5e11f0,_0x25b50a,_0x136040){return db['Sound']['find']({'where':{'id':_0x5e11f0[_0x6089('0x49')]['id']}})[_0x6089('0x22')](function(_0x56208d){if(_0x56208d){return _0x56208d[_0x6089('0x26')]();}})['then'](function(_0x3d124e){var _0x55d68d=path['join'](config['root'],_0x6089('0x5c'),util[_0x6089('0x53')](_0x6089('0x54'),_0x3d124e[_0x6089('0x4a')],_0x3d124e['original_format']));var _0x37ed95=path[_0x6089('0x4d')](config[_0x6089('0x4e')],_0x6089('0x4f'),util[_0x6089('0x53')](_0x6089('0x54'),_0x3d124e[_0x6089('0x4a')],_0x3d124e[_0x6089('0x4b')]));fs[_0x6089('0x63')](_0x55d68d);fs[_0x6089('0x63')](_0x37ed95);return _0x3d124e;})[_0x6089('0x22')](function(_0x338db2){if(_0x338db2){return _0x25b50a[_0x6089('0x1a')](0xcc)[_0x6089('0x1b')]();}})[_0x6089('0x22')](handleEntityNotFound(_0x25b50a,null))[_0x6089('0x45')](handleError(_0x25b50a,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ae6a287..8ec97d8 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 _0xd464=['define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x559d4a,_0x29471d){var _0x5aca02=function(_0x4aafe3){while(--_0x4aafe3){_0x559d4a['push'](_0x559d4a['shift']());}};_0x5aca02(++_0x29471d);}(_0xd464,0xc3));var _0x4d46=function(_0x8207,_0x11c9dc){_0x8207=_0x8207-0x0;var _0x3d0ac2=_0xd464[_0x8207];return _0x3d0ac2;};'use strict';var _=require('lodash');var util=require(_0x4d46('0x0'));var logger=require(_0x4d46('0x1'))(_0x4d46('0x2'));var moment=require(_0x4d46('0x3'));var BPromise=require(_0x4d46('0x4'));var rp=require(_0x4d46('0x5'));var fs=require('fs');var path=require(_0x4d46('0x6'));var rimraf=require('rimraf');var config=require(_0x4d46('0x7'));var attributes=require('./sound.attributes');module[_0x4d46('0x8')]=function(_0x36f806,_0x32c67a){return _0x36f806[_0x4d46('0x9')](_0x4d46('0xa'),attributes,{'tableName':_0x4d46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3ab=['request-promise','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','../../config/logger','api','moment'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xa3ab,0x172));var _0xba3a=function(_0x425217,_0xb35cb9){_0x425217=_0x425217-0x0;var _0x1a07cd=_0xa3ab[_0x425217];return _0x1a07cd;};'use strict';var _=require(_0xba3a('0x0'));var util=require('util');var logger=require(_0xba3a('0x1'))(_0xba3a('0x2'));var moment=require(_0xba3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xba3a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba3a('0x5'));var attributes=require(_0xba3a('0x6'));module[_0xba3a('0x7')]=function(_0x2387ee,_0x1fd9b7){return _0x2387ee[_0xba3a('0x8')](_0xba3a('0x9'),attributes,{'tableName':_0xba3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 2536f25..f1de8a8 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 _0x60c1=['ShowSound','Sound','find','options','raw','where','include','attributes','map','model','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent'];(function(_0x4d1f69,_0x4a1749){var _0x40a64b=function(_0x52adaf){while(--_0x52adaf){_0x4d1f69['push'](_0x4d1f69['shift']());}};_0x40a64b(++_0x4a1749);}(_0x60c1,0x10b));var _0x160c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x60c1[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x160c('0x0'));var util=require('util');var moment=require(_0x160c('0x1'));var BPromise=require(_0x160c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x160c('0x3'))['db'];var utils=require(_0x160c('0x4'));var logger=require(_0x160c('0x5'))(_0x160c('0x6'));var config=require(_0x160c('0x7'));var jayson=require(_0x160c('0x8'));var client=jayson['client'][_0x160c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52fd60,_0x5438db,_0x35aa27){return new BPromise(function(_0x156037,_0x43a21d){return client[_0x160c('0xa')](_0x52fd60,_0x35aa27)[_0x160c('0xb')](function(_0x325dd3){logger[_0x160c('0xc')]('Sound,\x20%s,\x20%s',_0x5438db,'request\x20sent');logger[_0x160c('0xd')](_0x160c('0xe'),_0x5438db,'request\x20sent',JSON[_0x160c('0xf')](_0x325dd3));if(_0x325dd3[_0x160c('0x10')]){if(_0x325dd3['error'][_0x160c('0x11')]===0x1f4){logger[_0x160c('0x10')](_0x160c('0x12'),_0x5438db,_0x325dd3[_0x160c('0x10')]['message']);return _0x43a21d(_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);}logger[_0x160c('0x10')]('Sound,\x20%s,\x20%s',_0x5438db,_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);return _0x156037(_0x325dd3[_0x160c('0x10')][_0x160c('0x13')]);}else{logger[_0x160c('0xc')]('Sound,\x20%s,\x20%s',_0x5438db,_0x160c('0x14'));_0x156037(_0x325dd3['result'][_0x160c('0x13')]);}})['catch'](function(_0x515fad){logger['error'](_0x160c('0x12'),_0x5438db,_0x515fad);_0x43a21d(_0x515fad);});});}exports[_0x160c('0x15')]=function(_0x51f0d){var _0x347e8f=this;return new Promise(function(_0x48f3c6,_0x2e8e93){return db[_0x160c('0x16')][_0x160c('0x17')]({'raw':_0x51f0d['options']?_0x51f0d[_0x160c('0x18')][_0x160c('0x19')]===undefined?!![]:![]:!![],'where':_0x51f0d[_0x160c('0x18')]?_0x51f0d[_0x160c('0x18')][_0x160c('0x1a')]||null:null,'attributes':_0x51f0d['options']?_0x51f0d['options']['attributes']||null:null,'include':_0x51f0d[_0x160c('0x18')]?_0x51f0d[_0x160c('0x18')]['include']?_['map'](_0x51f0d[_0x160c('0x18')][_0x160c('0x1b')],function(_0x3275d5){return{'model':db[_0x3275d5['model']],'as':_0x3275d5['as'],'attributes':_0x3275d5[_0x160c('0x1c')],'include':_0x3275d5[_0x160c('0x1b')]?_[_0x160c('0x1d')](_0x3275d5[_0x160c('0x1b')],function(_0x2e091c){return{'model':db[_0x2e091c['model']],'as':_0x2e091c['as'],'attributes':_0x2e091c[_0x160c('0x1c')],'include':_0x2e091c[_0x160c('0x1b')]?_['map'](_0x2e091c[_0x160c('0x1b')],function(_0x356356){return{'model':db[_0x356356[_0x160c('0x1e')]],'as':_0x356356['as'],'attributes':_0x356356[_0x160c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x160c('0xb')](function(_0x465e97){logger[_0x160c('0xc')]('ShowSound',_0x51f0d);logger[_0x160c('0xd')](_0x160c('0x15'),_0x51f0d,JSON[_0x160c('0xf')](_0x465e97));_0x48f3c6(_0x465e97);})[_0x160c('0x1f')](function(_0xc50fd7){logger[_0x160c('0x10')]('ShowSound',_0xc50fd7['message'],_0x51f0d);_0x2e8e93(_0x347e8f[_0x160c('0x10')](0x1f4,_0xc50fd7['message']));});});}; \ No newline at end of file +var _0x6eb3=['raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound','Sound','find','options'];(function(_0x410322,_0x58b68d){var _0x13680a=function(_0x43830b){while(--_0x43830b){_0x410322['push'](_0x410322['shift']());}};_0x13680a(++_0x58b68d);}(_0x6eb3,0x15b));var _0x36eb=function(_0x513dce,_0x386966){_0x513dce=_0x513dce-0x0;var _0x2b0bfe=_0x6eb3[_0x513dce];return _0x2b0bfe;};'use strict';var _=require('lodash');var util=require(_0x36eb('0x0'));var moment=require(_0x36eb('0x1'));var BPromise=require(_0x36eb('0x2'));var rs=require(_0x36eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36eb('0x4'))['db'];var utils=require(_0x36eb('0x5'));var logger=require(_0x36eb('0x6'))(_0x36eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x36eb('0x8'));var client=jayson[_0x36eb('0x9')][_0x36eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5443be,_0x4e2414,_0x2e3051){return new BPromise(function(_0x244e8e,_0x2989b7){return client['request'](_0x5443be,_0x2e3051)[_0x36eb('0xb')](function(_0x395d83){logger[_0x36eb('0xc')](_0x36eb('0xd'),_0x4e2414,_0x36eb('0xe'));logger[_0x36eb('0xf')](_0x36eb('0x10'),_0x4e2414,_0x36eb('0xe'),JSON[_0x36eb('0x11')](_0x395d83));if(_0x395d83[_0x36eb('0x12')]){if(_0x395d83[_0x36eb('0x12')]['code']===0x1f4){logger[_0x36eb('0x12')](_0x36eb('0xd'),_0x4e2414,_0x395d83[_0x36eb('0x12')][_0x36eb('0x13')]);return _0x2989b7(_0x395d83[_0x36eb('0x12')][_0x36eb('0x13')]);}logger[_0x36eb('0x12')](_0x36eb('0xd'),_0x4e2414,_0x395d83[_0x36eb('0x12')]['message']);return _0x244e8e(_0x395d83[_0x36eb('0x12')][_0x36eb('0x13')]);}else{logger['info'](_0x36eb('0xd'),_0x4e2414,_0x36eb('0xe'));_0x244e8e(_0x395d83['result'][_0x36eb('0x13')]);}})[_0x36eb('0x14')](function(_0x372a75){logger['error'](_0x36eb('0xd'),_0x4e2414,_0x372a75);_0x2989b7(_0x372a75);});});}exports[_0x36eb('0x15')]=function(_0x24da67){var _0x4f6249=this;return new Promise(function(_0x119e60,_0x2154a1){return db[_0x36eb('0x16')][_0x36eb('0x17')]({'raw':_0x24da67[_0x36eb('0x18')]?_0x24da67[_0x36eb('0x18')][_0x36eb('0x19')]===undefined?!![]:![]:!![],'where':_0x24da67[_0x36eb('0x18')]?_0x24da67['options'][_0x36eb('0x1a')]||null:null,'attributes':_0x24da67[_0x36eb('0x18')]?_0x24da67[_0x36eb('0x18')][_0x36eb('0x1b')]||null:null,'include':_0x24da67['options']?_0x24da67['options'][_0x36eb('0x1c')]?_[_0x36eb('0x1d')](_0x24da67[_0x36eb('0x18')][_0x36eb('0x1c')],function(_0x4c1d5d){return{'model':db[_0x4c1d5d[_0x36eb('0x1e')]],'as':_0x4c1d5d['as'],'attributes':_0x4c1d5d[_0x36eb('0x1b')],'include':_0x4c1d5d[_0x36eb('0x1c')]?_[_0x36eb('0x1d')](_0x4c1d5d['include'],function(_0x5903bd){return{'model':db[_0x5903bd['model']],'as':_0x5903bd['as'],'attributes':_0x5903bd[_0x36eb('0x1b')],'include':_0x5903bd['include']?_['map'](_0x5903bd[_0x36eb('0x1c')],function(_0x11dcd5){return{'model':db[_0x11dcd5[_0x36eb('0x1e')]],'as':_0x11dcd5['as'],'attributes':_0x11dcd5[_0x36eb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x36eb('0xb')](function(_0x2b00bd){logger[_0x36eb('0xc')]('ShowSound',_0x24da67);logger[_0x36eb('0xf')](_0x36eb('0x15'),_0x24da67,JSON[_0x36eb('0x11')](_0x2b00bd));_0x119e60(_0x2b00bd);})[_0x36eb('0x14')](function(_0x1b1e9d){logger[_0x36eb('0x12')](_0x36eb('0x15'),_0x1b1e9d['message'],_0x24da67);_0x2154a1(_0x4f6249['error'](0x1f4,_0x1b1e9d[_0x36eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index f73a194..d0d7e05 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x24122c,_0x3e341e){var _0x3b9ad2=function(_0x935a85){while(--_0x935a85){_0x24122c['push'](_0x24122c['shift']());}};_0x3b9ad2(++_0x3e341e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x2ee3b9,_0x201d1b){var _0xd2e6b2=function(_0x158043){while(--_0x158043){_0x2ee3b9['push'](_0x2ee3b9['shift']());}};_0xd2e6b2(++_0x201d1b);}(_0x14a0,0x8e));var _0x014a=function(_0x38307c,_0xe6a99){_0x38307c=_0x38307c-0x0;var _0x4f4f62=_0x14a0[_0x38307c];return _0x4f4f62;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 68efe65..c94131c 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 _0x71de=['ENUM','out','sequelize','exports','STRING','TEXT','medium'];(function(_0x3db704,_0x40edae){var _0x289e84=function(_0x58d376){while(--_0x58d376){_0x3db704['push'](_0x3db704['shift']());}};_0x289e84(++_0x40edae);}(_0x71de,0x136));var _0xe71d=function(_0x2350de,_0x237caa){_0x2350de=_0x2350de-0x0;var _0x23462d=_0x71de[_0x2350de];return _0x23462d;};'use strict';var Sequelize=require(_0xe71d('0x0'));module[_0xe71d('0x1')]={'uniqueid':{'type':Sequelize[_0xe71d('0x2')]},'body':{'type':Sequelize[_0xe71d('0x3')](_0xe71d('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe71d('0x5')]('in',_0xe71d('0x6')),'defaultValue':_0xe71d('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe71d('0x2')]},'providerResponse':{'type':Sequelize[_0xe71d('0x3')]}}; \ No newline at end of file +var _0xbf33=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x6dd3c1,_0x53cf52){var _0xdef05a=function(_0x26a262){while(--_0x26a262){_0x6dd3c1['push'](_0x6dd3c1['shift']());}};_0xdef05a(++_0x53cf52);}(_0xbf33,0x86));var _0x3bf3=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xbf33[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x3bf3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3bf3('0x1')]},'body':{'type':Sequelize[_0x3bf3('0x2')](_0x3bf3('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x3bf3('0x4')]('in',_0x3bf3('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x3bf3('0x1')]},'providerResponse':{'type':Sequelize[_0x3bf3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index d06d1f6..1a4f114 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 _0xdc73=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','limit','undefined','count','offset','set','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','rimraf','zip-dir'];(function(_0x4c0bfe,_0x5124fd){var _0x1ada5c=function(_0x350ed2){while(--_0x350ed2){_0x4c0bfe['push'](_0x4c0bfe['shift']());}};_0x1ada5c(++_0x5124fd);}(_0xdc73,0x19c));var _0x3dc7=function(_0x3490f7,_0x46963a){_0x3490f7=_0x3490f7-0x0;var _0x5b3372=_0xdc73[_0x3490f7];return _0x5b3372;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3dc7('0x0'));var zipdir=require(_0x3dc7('0x1'));var jsonpatch=require(_0x3dc7('0x2'));var rp=require(_0x3dc7('0x3'));var moment=require(_0x3dc7('0x4'));var BPromise=require(_0x3dc7('0x5'));var Mustache=require(_0x3dc7('0x6'));var util=require('util');var path=require(_0x3dc7('0x7'));var sox=require('sox');var csv=require(_0x3dc7('0x8'));var ejs=require(_0x3dc7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3dc7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3dc7('0xb'));var toCsv=require(_0x3dc7('0x8'));var querystring=require(_0x3dc7('0xc'));var Papa=require('papaparse');var Redis=require(_0x3dc7('0xd'));var authService=require(_0x3dc7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3dc7('0xf'));var hardwareService=require(_0x3dc7('0x10'));var logger=require(_0x3dc7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3dc7('0x12'));var licenseUtil=require(_0x3dc7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61345b,_0x597841){_0x597841=_0x597841||0xcc;return function(_0x31b283){if(_0x31b283){return _0x61345b['sendStatus'](_0x597841);}return _0x61345b[_0x3dc7('0x14')](_0x597841)['end']();};}function respondWithResult(_0x57f89e,_0x106482){_0x106482=_0x106482||0xc8;return function(_0x126eae){if(_0x126eae){return _0x57f89e[_0x3dc7('0x14')](_0x106482)[_0x3dc7('0x15')](_0x126eae);}};}function respondWithFilteredResult(_0x4631a4,_0x523eba){return function(_0x164e6a){if(_0x164e6a){var _0x541ea3=typeof _0x523eba['offset']==='undefined'&&typeof _0x523eba[_0x3dc7('0x16')]===_0x3dc7('0x17');var _0x3030f2=_0x164e6a[_0x3dc7('0x18')];var _0x37a609=_0x541ea3?0x0:_0x523eba['offset'];var _0x4f26fe=_0x541ea3?_0x164e6a['count']:_0x523eba[_0x3dc7('0x19')]+_0x523eba['limit'];var _0x115c0f;if(_0x4f26fe>=_0x3030f2){_0x4f26fe=_0x3030f2;_0x115c0f=0xc8;}else{_0x115c0f=0xce;}_0x4631a4['status'](_0x115c0f);return _0x4631a4[_0x3dc7('0x1a')]('Content-Range',_0x37a609+'-'+_0x4f26fe+'/'+_0x3030f2)['json'](_0x164e6a);}return null;};}function patchUpdates(_0xd177a2){return function(_0xfb05c3){try{jsonpatch['apply'](_0xfb05c3,_0xd177a2,!![]);}catch(_0x64166b){return BPromise[_0x3dc7('0x1b')](_0x64166b);}return _0xfb05c3[_0x3dc7('0x1c')]();};}function saveUpdates(_0x2f8149,_0x463a49){return function(_0x202062){if(_0x202062){return _0x202062[_0x3dc7('0x1d')](_0x2f8149)[_0x3dc7('0x1e')](function(_0x26fe36){return _0x26fe36;});}return null;};}function removeEntity(_0x3aa68e,_0x556dd0){return function(_0x4ba74b){if(_0x4ba74b){return _0x4ba74b[_0x3dc7('0x1f')]()[_0x3dc7('0x1e')](function(){_0x3aa68e[_0x3dc7('0x14')](0xcc)[_0x3dc7('0x20')]();});}};}function handleEntityNotFound(_0x285995,_0x5b9d96){return function(_0x32aef6){if(!_0x32aef6){_0x285995[_0x3dc7('0x21')](0x194);}return _0x32aef6;};}function handleError(_0x1eb267,_0x53afa5){_0x53afa5=_0x53afa5||0x1f4;return function(_0x3b7019){logger[_0x3dc7('0x22')](_0x3b7019[_0x3dc7('0x23')]);if(_0x3b7019[_0x3dc7('0x24')]){delete _0x3b7019['name'];}_0x1eb267[_0x3dc7('0x14')](_0x53afa5)[_0x3dc7('0x25')](_0x3b7019);};}exports[_0x3dc7('0x26')]=function(_0x2959cd,_0x4991b4){var _0x5a4c56={},_0x1f114d={},_0x19e6e7={'count':0x0,'rows':[]};var _0x4caf9c=_[_0x3dc7('0x27')](db[_0x3dc7('0x28')][_0x3dc7('0x29')],function(_0x2d28d8){return{'name':_0x2d28d8[_0x3dc7('0x2a')],'type':_0x2d28d8[_0x3dc7('0x2b')]['key']};});_0x1f114d['model']=_['map'](_0x4caf9c,_0x3dc7('0x24'));_0x1f114d[_0x3dc7('0x2c')]=_[_0x3dc7('0x2d')](_0x2959cd['query']);_0x1f114d[_0x3dc7('0x2e')]=_[_0x3dc7('0x2f')](_0x1f114d[_0x3dc7('0x30')],_0x1f114d[_0x3dc7('0x2c')]);_0x5a4c56[_0x3dc7('0x31')]=_[_0x3dc7('0x2f')](_0x1f114d[_0x3dc7('0x30')],qs[_0x3dc7('0x32')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x32')]));_0x5a4c56[_0x3dc7('0x31')]=_0x5a4c56[_0x3dc7('0x31')][_0x3dc7('0x33')]?_0x5a4c56[_0x3dc7('0x31')]:_0x1f114d['model'];if(!_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x34')]('nolimit')){_0x5a4c56[_0x3dc7('0x16')]=qs[_0x3dc7('0x16')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x16')]);_0x5a4c56[_0x3dc7('0x19')]=qs[_0x3dc7('0x19')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x19')]);}_0x5a4c56[_0x3dc7('0x35')]=qs[_0x3dc7('0x36')](_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x36')]);_0x5a4c56[_0x3dc7('0x37')]=qs[_0x3dc7('0x2e')](_[_0x3dc7('0x38')](_0x2959cd[_0x3dc7('0x2c')],_0x1f114d[_0x3dc7('0x2e')]),_0x4caf9c);if(_0x2959cd['query'][_0x3dc7('0x39')]){_0x5a4c56['where']=_[_0x3dc7('0x3a')](_0x5a4c56['where'],{'$or':_[_0x3dc7('0x27')](_0x4caf9c,function(_0x46c904){if(_0x46c904['type']!==_0x3dc7('0x3b')){var _0x56223c={};_0x56223c[_0x46c904[_0x3dc7('0x24')]]={'$like':'%'+_0x2959cd[_0x3dc7('0x2c')][_0x3dc7('0x39')]+'%'};return _0x56223c;}})});}_0x5a4c56=_[_0x3dc7('0x3a')]({},_0x5a4c56,_0x2959cd[_0x3dc7('0x3c')]);var _0x5ba53f={'where':_0x5a4c56[_0x3dc7('0x37')]};return db[_0x3dc7('0x28')][_0x3dc7('0x18')](_0x5ba53f)[_0x3dc7('0x1e')](function(_0x2ac7d0){_0x19e6e7[_0x3dc7('0x18')]=_0x2ac7d0;if(_0x2959cd['query'][_0x3dc7('0x3d')]){_0x5a4c56['include']=[{'all':!![]}];}return db[_0x3dc7('0x28')]['findAll'](_0x5a4c56);})['then'](function(_0x599f89){_0x19e6e7[_0x3dc7('0x3e')]=_0x599f89;return _0x19e6e7;})[_0x3dc7('0x1e')](respondWithFilteredResult(_0x4991b4,_0x5a4c56))[_0x3dc7('0x3f')](handleError(_0x4991b4,null));};exports[_0x3dc7('0x40')]=function(_0x27181f,_0x406be6){var _0x281e01={'raw':!![],'where':{'id':_0x27181f[_0x3dc7('0x41')]['id']}},_0x2b2750={};_0x2b2750[_0x3dc7('0x30')]=_[_0x3dc7('0x2d')](db[_0x3dc7('0x28')][_0x3dc7('0x29')]);_0x2b2750[_0x3dc7('0x2c')]=_[_0x3dc7('0x2d')](_0x27181f[_0x3dc7('0x2c')]);_0x2b2750[_0x3dc7('0x2e')]=_[_0x3dc7('0x2f')](_0x2b2750[_0x3dc7('0x30')],_0x2b2750['query']);_0x281e01[_0x3dc7('0x31')]=_[_0x3dc7('0x2f')](_0x2b2750[_0x3dc7('0x30')],qs['fields'](_0x27181f[_0x3dc7('0x2c')]['fields']));_0x281e01[_0x3dc7('0x31')]=_0x281e01[_0x3dc7('0x31')]['length']?_0x281e01[_0x3dc7('0x31')]:_0x2b2750[_0x3dc7('0x30')];if(_0x27181f[_0x3dc7('0x2c')][_0x3dc7('0x3d')]){_0x281e01['include']=[{'all':!![]}];}_0x281e01=_['merge']({},_0x281e01,_0x27181f[_0x3dc7('0x3c')]);return db[_0x3dc7('0x28')][_0x3dc7('0x42')](_0x281e01)[_0x3dc7('0x1e')](handleEntityNotFound(_0x406be6,null))['then'](respondWithResult(_0x406be6,null))[_0x3dc7('0x3f')](handleError(_0x406be6,null));};exports['create']=function(_0x117681,_0xfba3e9){return db[_0x3dc7('0x28')][_0x3dc7('0x43')](_0x117681[_0x3dc7('0x44')],{})[_0x3dc7('0x1e')](respondWithResult(_0xfba3e9,0xc9))['catch'](handleError(_0xfba3e9,null));};exports[_0x3dc7('0x1d')]=function(_0x45f18a,_0x24764f){if(_0x45f18a[_0x3dc7('0x44')]['id']){delete _0x45f18a[_0x3dc7('0x44')]['id'];}return db[_0x3dc7('0x28')][_0x3dc7('0x42')]({'where':{'id':_0x45f18a[_0x3dc7('0x41')]['id']}})[_0x3dc7('0x1e')](handleEntityNotFound(_0x24764f,null))[_0x3dc7('0x1e')](saveUpdates(_0x45f18a[_0x3dc7('0x44')],null))['then'](respondWithResult(_0x24764f,null))['catch'](handleError(_0x24764f,null));};exports[_0x3dc7('0x1f')]=function(_0x45e5d4,_0x4e6feb){return db[_0x3dc7('0x28')][_0x3dc7('0x42')]({'where':{'id':_0x45e5d4['params']['id']}})[_0x3dc7('0x1e')](handleEntityNotFound(_0x4e6feb,null))['then'](removeEntity(_0x4e6feb,null))[_0x3dc7('0x3f')](handleError(_0x4e6feb,null));}; \ No newline at end of file +var _0xae6e=['attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','include','findAll','show','create','body','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','SquareMessage','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x2109a8,_0x3a7797){var _0x522094=function(_0x545aa1){while(--_0x545aa1){_0x2109a8['push'](_0x2109a8['shift']());}};_0x522094(++_0x3a7797);}(_0xae6e,0x1e5));var _0xeae6=function(_0x410884,_0x5951e3){_0x410884=_0x410884-0x0;var _0x5ba2b1=_0xae6e[_0x410884];return _0x5ba2b1;};'use strict';var emlformat=require(_0xeae6('0x0'));var rimraf=require(_0xeae6('0x1'));var zipdir=require(_0xeae6('0x2'));var jsonpatch=require(_0xeae6('0x3'));var rp=require(_0xeae6('0x4'));var moment=require('moment');var BPromise=require(_0xeae6('0x5'));var Mustache=require('mustache');var util=require(_0xeae6('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeae6('0x7'));var fs=require('fs');var fs_extra=require(_0xeae6('0x8'));var _=require('lodash');var squel=require(_0xeae6('0x9'));var crypto=require(_0xeae6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeae6('0xb'));var querystring=require(_0xeae6('0xc'));var Papa=require(_0xeae6('0xd'));var Redis=require(_0xeae6('0xe'));var authService=require(_0xeae6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeae6('0x10'));var hardwareService=require(_0xeae6('0x11'));var logger=require(_0xeae6('0x12'))(_0xeae6('0x13'));var utils=require(_0xeae6('0x14'));var config=require(_0xeae6('0x15'));var licenseUtil=require(_0xeae6('0x16'));var db=require(_0xeae6('0x17'))['db'];function respondWithStatusCode(_0x571985,_0x429d80){_0x429d80=_0x429d80||0xcc;return function(_0x5050b5){if(_0x5050b5){return _0x571985['sendStatus'](_0x429d80);}return _0x571985[_0xeae6('0x18')](_0x429d80)[_0xeae6('0x19')]();};}function respondWithResult(_0x1741a5,_0x31f94a){_0x31f94a=_0x31f94a||0xc8;return function(_0x426af){if(_0x426af){return _0x1741a5[_0xeae6('0x18')](_0x31f94a)[_0xeae6('0x1a')](_0x426af);}};}function respondWithFilteredResult(_0x1b91cf,_0x34a0e5){return function(_0x5e5f55){if(_0x5e5f55){var _0x553429=typeof _0x34a0e5[_0xeae6('0x1b')]===_0xeae6('0x1c')&&typeof _0x34a0e5[_0xeae6('0x1d')]===_0xeae6('0x1c');var _0x5deb01=_0x5e5f55[_0xeae6('0x1e')];var _0x3376b6=_0x553429?0x0:_0x34a0e5[_0xeae6('0x1b')];var _0x126e69=_0x553429?_0x5e5f55[_0xeae6('0x1e')]:_0x34a0e5[_0xeae6('0x1b')]+_0x34a0e5[_0xeae6('0x1d')];var _0x120e29;if(_0x126e69>=_0x5deb01){_0x126e69=_0x5deb01;_0x120e29=0xc8;}else{_0x120e29=0xce;}_0x1b91cf['status'](_0x120e29);return _0x1b91cf['set'](_0xeae6('0x1f'),_0x3376b6+'-'+_0x126e69+'/'+_0x5deb01)['json'](_0x5e5f55);}return null;};}function patchUpdates(_0x1f0550){return function(_0x166a78){try{jsonpatch[_0xeae6('0x20')](_0x166a78,_0x1f0550,!![]);}catch(_0x48843c){return BPromise[_0xeae6('0x21')](_0x48843c);}return _0x166a78[_0xeae6('0x22')]();};}function saveUpdates(_0x2dbc6d,_0x1e8c0f){return function(_0xfd44b5){if(_0xfd44b5){return _0xfd44b5[_0xeae6('0x23')](_0x2dbc6d)[_0xeae6('0x24')](function(_0x1ed263){return _0x1ed263;});}return null;};}function removeEntity(_0x4b8886,_0x47c8a0){return function(_0x4bf0db){if(_0x4bf0db){return _0x4bf0db[_0xeae6('0x25')]()[_0xeae6('0x24')](function(){_0x4b8886[_0xeae6('0x18')](0xcc)[_0xeae6('0x19')]();});}};}function handleEntityNotFound(_0x25b540,_0x3dabff){return function(_0x172349){if(!_0x172349){_0x25b540['sendStatus'](0x194);}return _0x172349;};}function handleError(_0x34dfb4,_0x551720){_0x551720=_0x551720||0x1f4;return function(_0x5a5861){logger['error'](_0x5a5861[_0xeae6('0x26')]);if(_0x5a5861[_0xeae6('0x27')]){delete _0x5a5861[_0xeae6('0x27')];}_0x34dfb4[_0xeae6('0x18')](_0x551720)['send'](_0x5a5861);};}exports['index']=function(_0x538dfb,_0x22fa08){var _0x21a54e={},_0x1f702a={},_0x5bacc6={'count':0x0,'rows':[]};var _0x20819f=_[_0xeae6('0x28')](db[_0xeae6('0x29')]['rawAttributes'],function(_0x54bee5){return{'name':_0x54bee5[_0xeae6('0x2a')],'type':_0x54bee5[_0xeae6('0x2b')][_0xeae6('0x2c')]};});_0x1f702a[_0xeae6('0x2d')]=_[_0xeae6('0x28')](_0x20819f,_0xeae6('0x27'));_0x1f702a[_0xeae6('0x2e')]=_[_0xeae6('0x2f')](_0x538dfb[_0xeae6('0x2e')]);_0x1f702a[_0xeae6('0x30')]=_[_0xeae6('0x31')](_0x1f702a[_0xeae6('0x2d')],_0x1f702a[_0xeae6('0x2e')]);_0x21a54e['attributes']=_[_0xeae6('0x31')](_0x1f702a[_0xeae6('0x2d')],qs[_0xeae6('0x32')](_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x32')]));_0x21a54e[_0xeae6('0x33')]=_0x21a54e['attributes'][_0xeae6('0x34')]?_0x21a54e[_0xeae6('0x33')]:_0x1f702a[_0xeae6('0x2d')];if(!_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x35')](_0xeae6('0x36'))){_0x21a54e[_0xeae6('0x1d')]=qs[_0xeae6('0x1d')](_0x538dfb[_0xeae6('0x2e')]['limit']);_0x21a54e[_0xeae6('0x1b')]=qs[_0xeae6('0x1b')](_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x1b')]);}_0x21a54e['order']=qs[_0xeae6('0x37')](_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x37')]);_0x21a54e['where']=qs[_0xeae6('0x30')](_['pick'](_0x538dfb[_0xeae6('0x2e')],_0x1f702a['filters']),_0x20819f);if(_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x38')]){_0x21a54e['where']=_[_0xeae6('0x39')](_0x21a54e['where'],{'$or':_['map'](_0x20819f,function(_0x26b08d){if(_0x26b08d[_0xeae6('0x2b')]!=='VIRTUAL'){var _0x1da578={};_0x1da578[_0x26b08d[_0xeae6('0x27')]]={'$like':'%'+_0x538dfb[_0xeae6('0x2e')][_0xeae6('0x38')]+'%'};return _0x1da578;}})});}_0x21a54e=_[_0xeae6('0x39')]({},_0x21a54e,_0x538dfb['options']);var _0x3e7f21={'where':_0x21a54e[_0xeae6('0x3a')]};return db[_0xeae6('0x29')]['count'](_0x3e7f21)['then'](function(_0x1b1175){_0x5bacc6['count']=_0x1b1175;if(_0x538dfb[_0xeae6('0x2e')]['includeAll']){_0x21a54e[_0xeae6('0x3b')]=[{'all':!![]}];}return db[_0xeae6('0x29')][_0xeae6('0x3c')](_0x21a54e);})['then'](function(_0x529a4a){_0x5bacc6['rows']=_0x529a4a;return _0x5bacc6;})[_0xeae6('0x24')](respondWithFilteredResult(_0x22fa08,_0x21a54e))['catch'](handleError(_0x22fa08,null));};exports[_0xeae6('0x3d')]=function(_0x3aeac6,_0x4f4f11){var _0x103de3={'raw':!![],'where':{'id':_0x3aeac6['params']['id']}},_0x78664d={};_0x78664d['model']=_[_0xeae6('0x2f')](db['SquareMessage']['rawAttributes']);_0x78664d[_0xeae6('0x2e')]=_[_0xeae6('0x2f')](_0x3aeac6['query']);_0x78664d[_0xeae6('0x30')]=_[_0xeae6('0x31')](_0x78664d[_0xeae6('0x2d')],_0x78664d[_0xeae6('0x2e')]);_0x103de3[_0xeae6('0x33')]=_[_0xeae6('0x31')](_0x78664d[_0xeae6('0x2d')],qs[_0xeae6('0x32')](_0x3aeac6[_0xeae6('0x2e')][_0xeae6('0x32')]));_0x103de3['attributes']=_0x103de3[_0xeae6('0x33')][_0xeae6('0x34')]?_0x103de3['attributes']:_0x78664d[_0xeae6('0x2d')];if(_0x3aeac6[_0xeae6('0x2e')]['includeAll']){_0x103de3[_0xeae6('0x3b')]=[{'all':!![]}];}_0x103de3=_[_0xeae6('0x39')]({},_0x103de3,_0x3aeac6['options']);return db[_0xeae6('0x29')]['find'](_0x103de3)['then'](handleEntityNotFound(_0x4f4f11,null))[_0xeae6('0x24')](respondWithResult(_0x4f4f11,null))['catch'](handleError(_0x4f4f11,null));};exports[_0xeae6('0x3e')]=function(_0x129e25,_0x2a06bd){return db[_0xeae6('0x29')][_0xeae6('0x3e')](_0x129e25[_0xeae6('0x3f')],{})['then'](respondWithResult(_0x2a06bd,0xc9))[_0xeae6('0x40')](handleError(_0x2a06bd,null));};exports[_0xeae6('0x23')]=function(_0x1171a5,_0x5eac0b){if(_0x1171a5['body']['id']){delete _0x1171a5[_0xeae6('0x3f')]['id'];}return db['SquareMessage'][_0xeae6('0x41')]({'where':{'id':_0x1171a5[_0xeae6('0x42')]['id']}})['then'](handleEntityNotFound(_0x5eac0b,null))['then'](saveUpdates(_0x1171a5['body'],null))[_0xeae6('0x24')](respondWithResult(_0x5eac0b,null))['catch'](handleError(_0x5eac0b,null));};exports[_0xeae6('0x25')]=function(_0x902adc,_0x4aa50a){return db[_0xeae6('0x29')]['find']({'where':{'id':_0x902adc[_0xeae6('0x42')]['id']}})[_0xeae6('0x24')](handleEntityNotFound(_0x4aa50a,null))[_0xeae6('0x24')](removeEntity(_0x4aa50a,null))[_0xeae6('0x40')](handleError(_0x4aa50a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c2bec15..9a276cd 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 _0x4311=['lodash','../../config/logger','api','moment','bluebird','path','./squareMessage.attributes','exports','SquareMessage'];(function(_0xabe64d,_0x2618da){var _0x59af04=function(_0x8e7866){while(--_0x8e7866){_0xabe64d['push'](_0xabe64d['shift']());}};_0x59af04(++_0x2618da);}(_0x4311,0x105));var _0x1431=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4311[_0x432682];return _0x463d05;};'use strict';var _=require(_0x1431('0x0'));var util=require('util');var logger=require(_0x1431('0x1'))(_0x1431('0x2'));var moment=require(_0x1431('0x3'));var BPromise=require(_0x1431('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1431('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1431('0x6'));module[_0x1431('0x7')]=function(_0x5d4d0c,_0x55c61f){return _0x5d4d0c['define'](_0x1431('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x974d=['../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1212be,_0x131ef3){var _0x376da1=function(_0x32912f){while(--_0x32912f){_0x1212be['push'](_0x1212be['shift']());}};_0x376da1(++_0x131ef3);}(_0x974d,0x1cc));var _0xd974=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x974d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd974('0x0'));var util=require(_0xd974('0x1'));var logger=require(_0xd974('0x2'))('api');var moment=require(_0xd974('0x3'));var BPromise=require(_0xd974('0x4'));var rp=require(_0xd974('0x5'));var fs=require('fs');var path=require(_0xd974('0x6'));var rimraf=require(_0xd974('0x7'));var config=require(_0xd974('0x8'));var attributes=require(_0xd974('0x9'));module['exports']=function(_0x4ed3a7,_0x39ffcb){return _0x4ed3a7['define'](_0xd974('0xa'),attributes,{'tableName':_0xd974('0xb'),'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 b4fea70..09f8d93 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 _0x5c66=['../../config/logger','rpc','jayson/promise','client','http','request','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x27da74,_0x210795){var _0x217dc9=function(_0x3301f3){while(--_0x3301f3){_0x27da74['push'](_0x27da74['shift']());}};_0x217dc9(++_0x210795);}(_0x5c66,0x174));var _0x65c6=function(_0x52f738,_0x1a59d2){_0x52f738=_0x52f738-0x0;var _0x44e552=_0x5c66[_0x52f738];return _0x44e552;};'use strict';var _=require(_0x65c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65c6('0x1'));var rs=require(_0x65c6('0x2'));var fs=require('fs');var Redis=require(_0x65c6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x65c6('0x4'));var logger=require(_0x65c6('0x5'))(_0x65c6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65c6('0x7'));var client=jayson[_0x65c6('0x8')][_0x65c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22ed9c,_0x66ba52,_0x327edb){return new BPromise(function(_0x45a8ac,_0x2b3a2b){return client[_0x65c6('0xa')](_0x22ed9c,_0x327edb)['then'](function(_0x1fc647){logger[_0x65c6('0xb')]('SquareMessage,\x20%s,\x20%s',_0x66ba52,'request\x20sent');logger[_0x65c6('0xc')](_0x65c6('0xd'),_0x66ba52,'request\x20sent',JSON['stringify'](_0x1fc647));if(_0x1fc647['error']){if(_0x1fc647[_0x65c6('0xe')][_0x65c6('0xf')]===0x1f4){logger[_0x65c6('0xe')](_0x65c6('0x10'),_0x66ba52,_0x1fc647[_0x65c6('0xe')]['message']);return _0x2b3a2b(_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);}logger['error'](_0x65c6('0x10'),_0x66ba52,_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);return _0x45a8ac(_0x1fc647[_0x65c6('0xe')][_0x65c6('0x11')]);}else{logger[_0x65c6('0xb')](_0x65c6('0x10'),_0x66ba52,_0x65c6('0x12'));_0x45a8ac(_0x1fc647[_0x65c6('0x13')][_0x65c6('0x11')]);}})[_0x65c6('0x14')](function(_0x2e63d2){logger['error'](_0x65c6('0x10'),_0x66ba52,_0x2e63d2);_0x2b3a2b(_0x2e63d2);});});}exports[_0x65c6('0x15')]=function(_0x1ce327){var _0x1a2029=this;return new Promise(function(_0x1ce01c,_0x540771){return db[_0x65c6('0x16')][_0x65c6('0x17')](_0x1ce327[_0x65c6('0x18')],{'raw':_0x1ce327[_0x65c6('0x19')]?_0x1ce327['options'][_0x65c6('0x1a')]===undefined?!![]:![]:!![]})[_0x65c6('0x1b')](function(_0x3a7d6e){logger['info']('CreateSquareMessage',_0x1ce327);logger['debug'](_0x65c6('0x15'),_0x1ce327,JSON[_0x65c6('0x1c')](_0x3a7d6e));_0x1ce01c(_0x3a7d6e);})[_0x65c6('0x14')](function(_0x40cc42){logger[_0x65c6('0xe')](_0x65c6('0x15'),_0x40cc42[_0x65c6('0x11')],_0x1ce327);_0x540771(_0x1a2029[_0x65c6('0xe')](0x1f4,_0x40cc42[_0x65c6('0x11')]));});});}; \ No newline at end of file +var _0x2eaf=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateSquareMessage','SquareMessage','create','body','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x1ba4fb,_0x256cdb){var _0x2ce8e6=function(_0x5b8c54){while(--_0x5b8c54){_0x1ba4fb['push'](_0x1ba4fb['shift']());}};_0x2ce8e6(++_0x256cdb);}(_0x2eaf,0x1ce));var _0xf2ea=function(_0x2dd849,_0x3bd1bf){_0x2dd849=_0x2dd849-0x0;var _0x38ba4e=_0x2eaf[_0x2dd849];return _0x38ba4e;};'use strict';var _=require(_0xf2ea('0x0'));var util=require(_0xf2ea('0x1'));var moment=require(_0xf2ea('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2ea('0x3'));var fs=require('fs');var Redis=require(_0xf2ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2ea('0x5'));var logger=require(_0xf2ea('0x6'))('rpc');var config=require(_0xf2ea('0x7'));var jayson=require(_0xf2ea('0x8'));var client=jayson[_0xf2ea('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e1190,_0x37da28,_0xca7a05){return new BPromise(function(_0x3fd520,_0x31b228){return client[_0xf2ea('0xa')](_0x4e1190,_0xca7a05)[_0xf2ea('0xb')](function(_0x244bf7){logger[_0xf2ea('0xc')](_0xf2ea('0xd'),_0x37da28,_0xf2ea('0xe'));logger[_0xf2ea('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x37da28,_0xf2ea('0xe'),JSON[_0xf2ea('0x10')](_0x244bf7));if(_0x244bf7['error']){if(_0x244bf7[_0xf2ea('0x11')][_0xf2ea('0x12')]===0x1f4){logger[_0xf2ea('0x11')]('SquareMessage,\x20%s,\x20%s',_0x37da28,_0x244bf7[_0xf2ea('0x11')][_0xf2ea('0x13')]);return _0x31b228(_0x244bf7[_0xf2ea('0x11')]['message']);}logger['error'](_0xf2ea('0xd'),_0x37da28,_0x244bf7['error'][_0xf2ea('0x13')]);return _0x3fd520(_0x244bf7[_0xf2ea('0x11')][_0xf2ea('0x13')]);}else{logger[_0xf2ea('0xc')](_0xf2ea('0xd'),_0x37da28,'request\x20sent');_0x3fd520(_0x244bf7['result'][_0xf2ea('0x13')]);}})['catch'](function(_0x3c3002){logger[_0xf2ea('0x11')](_0xf2ea('0xd'),_0x37da28,_0x3c3002);_0x31b228(_0x3c3002);});});}exports[_0xf2ea('0x14')]=function(_0xfe36ee){var _0x869473=this;return new Promise(function(_0x1cb098,_0x3cad10){return db[_0xf2ea('0x15')][_0xf2ea('0x16')](_0xfe36ee[_0xf2ea('0x17')],{'raw':_0xfe36ee[_0xf2ea('0x18')]?_0xfe36ee[_0xf2ea('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf2ea('0xb')](function(_0x41f291){logger[_0xf2ea('0xc')]('CreateSquareMessage',_0xfe36ee);logger['debug'](_0xf2ea('0x14'),_0xfe36ee,JSON[_0xf2ea('0x10')](_0x41f291));_0x1cb098(_0x41f291);})[_0xf2ea('0x19')](function(_0x60a018){logger[_0xf2ea('0x11')]('CreateSquareMessage',_0x60a018[_0xf2ea('0x13')],_0xfe36ee);_0x3cad10(_0x869473['error'](0x1f4,_0x60a018[_0xf2ea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1ed21ec..13ef87f 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 _0x2bf7=['./squareOdbc.controller','get','index','/:id','isAuthenticated','show','/:id/test','test','post','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58a4d8,_0x5be7ee){var _0x571334=function(_0x14c6c8){while(--_0x14c6c8){_0x58a4d8['push'](_0x58a4d8['shift']());}};_0x571334(++_0x5be7ee);}(_0x2bf7,0x1c7));var _0x72bf=function(_0x17ff87,_0x2a069d){_0x17ff87=_0x17ff87-0x0;var _0x181e07=_0x2bf7[_0x17ff87];return _0x181e07;};'use strict';var multer=require(_0x72bf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x72bf('0x1'));var express=require(_0x72bf('0x2'));var router=express['Router']();var fs_extra=require(_0x72bf('0x3'));var auth=require(_0x72bf('0x4'));var interaction=require(_0x72bf('0x5'));var config=require(_0x72bf('0x6'));var controller=require(_0x72bf('0x7'));router[_0x72bf('0x8')]('/',auth['isAuthenticated'](),controller[_0x72bf('0x9')]);router[_0x72bf('0x8')](_0x72bf('0xa'),auth[_0x72bf('0xb')](),controller[_0x72bf('0xc')]);router['get'](_0x72bf('0xd'),auth['isAuthenticated'](),timeout('15s'),controller[_0x72bf('0xe')]);router[_0x72bf('0xf')]('/',auth[_0x72bf('0xb')](),controller['create']);router[_0x72bf('0x10')](_0x72bf('0xa'),auth[_0x72bf('0xb')](),controller[_0x72bf('0x11')]);router[_0x72bf('0x12')]('/:id',auth[_0x72bf('0xb')](),controller[_0x72bf('0x13')]);module[_0x72bf('0x14')]=router; \ No newline at end of file +var _0xa083=['isAuthenticated','index','get','/:id','show','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x4e4c0c,_0x1b019e){var _0x1090db=function(_0x2d8cc6){while(--_0x2d8cc6){_0x4e4c0c['push'](_0x4e4c0c['shift']());}};_0x1090db(++_0x1b019e);}(_0xa083,0x73));var _0x3a08=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0xa083[_0x403115];return _0x596ef3;};'use strict';var multer=require('multer');var util=require(_0x3a08('0x0'));var path=require(_0x3a08('0x1'));var timeout=require(_0x3a08('0x2'));var express=require(_0x3a08('0x3'));var router=express[_0x3a08('0x4')]();var fs_extra=require(_0x3a08('0x5'));var auth=require(_0x3a08('0x6'));var interaction=require(_0x3a08('0x7'));var config=require(_0x3a08('0x8'));var controller=require(_0x3a08('0x9'));router['get']('/',auth[_0x3a08('0xa')](),controller[_0x3a08('0xb')]);router[_0x3a08('0xc')](_0x3a08('0xd'),auth[_0x3a08('0xa')](),controller[_0x3a08('0xe')]);router['get'](_0x3a08('0xf'),auth[_0x3a08('0xa')](),timeout(_0x3a08('0x10')),controller[_0x3a08('0x11')]);router[_0x3a08('0x12')]('/',auth[_0x3a08('0xa')](),controller[_0x3a08('0x13')]);router[_0x3a08('0x14')]('/:id',auth[_0x3a08('0xa')](),controller[_0x3a08('0x15')]);router[_0x3a08('0x16')]('/:id',auth[_0x3a08('0xa')](),controller[_0x3a08('0x17')]);module[_0x3a08('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 38a4394..001e20a 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 _0x2ffe=['name','sequelize','exports','STRING'];(function(_0x1a351c,_0x3f2134){var _0x10bfc0=function(_0x2de818){while(--_0x2de818){_0x1a351c['push'](_0x1a351c['shift']());}};_0x10bfc0(++_0x3f2134);}(_0x2ffe,0x155));var _0xe2ff=function(_0x47f5bf,_0xbcccc0){_0x47f5bf=_0x47f5bf-0x0;var _0x1c027d=_0x2ffe[_0x47f5bf];return _0x1c027d;};'use strict';var Sequelize=require(_0xe2ff('0x0'));module[_0xe2ff('0x1')]={'name':{'type':Sequelize[_0xe2ff('0x2')],'unique':_0xe2ff('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe2ff('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8b36177..d730d62 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 _0x6a9f=['map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','update','test','dsn','odbc','closeSync','eml-format','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','ODBC','UserProfileResource','stack','name','send'];(function(_0x5b8f39,_0x103579){var _0x1be276=function(_0x540fd1){while(--_0x540fd1){_0x5b8f39['push'](_0x5b8f39['shift']());}};_0x1be276(++_0x103579);}(_0x6a9f,0xcf));var _0xf6a9=function(_0x58ddd6,_0x5496a0){_0x58ddd6=_0x58ddd6-0x0;var _0x553775=_0x6a9f[_0x58ddd6];return _0x553775;};'use strict';var emlformat=require(_0xf6a9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6a9('0x1'));var moment=require(_0xf6a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf6a9('0x3'));var util=require('util');var path=require(_0xf6a9('0x4'));var sox=require(_0xf6a9('0x5'));var csv=require('to-csv');var ejs=require(_0xf6a9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6a9('0x7'));var squel=require(_0xf6a9('0x8'));var crypto=require(_0xf6a9('0x9'));var jsforce=require(_0xf6a9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf6a9('0xb'));var querystring=require(_0xf6a9('0xc'));var Papa=require(_0xf6a9('0xd'));var Redis=require('ioredis');var authService=require(_0xf6a9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a9('0xf'));var hardwareService=require(_0xf6a9('0x10'));var logger=require(_0xf6a9('0x11'))(_0xf6a9('0x12'));var utils=require(_0xf6a9('0x13'));var config=require(_0xf6a9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf6a9('0x15'))['db'];function respondWithStatusCode(_0xf16a50,_0x57ff5b){_0x57ff5b=_0x57ff5b||0xcc;return function(_0x4d8a18){if(_0x4d8a18){return _0xf16a50[_0xf6a9('0x16')](_0x57ff5b);}return _0xf16a50[_0xf6a9('0x17')](_0x57ff5b)[_0xf6a9('0x18')]();};}function respondWithResult(_0x4b8e69,_0x56b56f){_0x56b56f=_0x56b56f||0xc8;return function(_0x5ee9f7){if(_0x5ee9f7){return _0x4b8e69[_0xf6a9('0x17')](_0x56b56f)[_0xf6a9('0x19')](_0x5ee9f7);}};}function respondWithFilteredResult(_0x136504,_0x25acea){return function(_0x3884dc){if(_0x3884dc){var _0xd22700=typeof _0x25acea[_0xf6a9('0x1a')]===_0xf6a9('0x1b')&&typeof _0x25acea[_0xf6a9('0x1c')]===_0xf6a9('0x1b');var _0x1be8cb=_0x3884dc[_0xf6a9('0x1d')];var _0x4a81c9=_0xd22700?0x0:_0x25acea[_0xf6a9('0x1a')];var _0x5eee4b=_0xd22700?_0x3884dc['count']:_0x25acea[_0xf6a9('0x1a')]+_0x25acea['limit'];var _0x4e91f3;if(_0x5eee4b>=_0x1be8cb){_0x5eee4b=_0x1be8cb;_0x4e91f3=0xc8;}else{_0x4e91f3=0xce;}_0x136504[_0xf6a9('0x17')](_0x4e91f3);return _0x136504[_0xf6a9('0x1e')](_0xf6a9('0x1f'),_0x4a81c9+'-'+_0x5eee4b+'/'+_0x1be8cb)[_0xf6a9('0x19')](_0x3884dc);}return null;};}function patchUpdates(_0x2f9b1b){return function(_0x156a1){try{jsonpatch['apply'](_0x156a1,_0x2f9b1b,!![]);}catch(_0x395ad8){return BPromise[_0xf6a9('0x20')](_0x395ad8);}return _0x156a1[_0xf6a9('0x21')]();};}function saveUpdates(_0x23d58c,_0xc78830){return function(_0x482371){if(_0x482371){return _0x482371['update'](_0x23d58c)[_0xf6a9('0x22')](function(_0x4e1a65){return _0x4e1a65;});}return null;};}function removeEntity(_0x205e57,_0x2ef7ff){return function(_0x18737b){if(_0x18737b){return _0x18737b[_0xf6a9('0x23')]()[_0xf6a9('0x22')](function(){var _0x4387a=_0x18737b[_0xf6a9('0x24')]({'plain':!![]});var _0xe7f193=_0xf6a9('0x25');return db[_0xf6a9('0x26')][_0xf6a9('0x23')]({'where':{'type':_0xe7f193,'resourceId':_0x4387a['id']}})['then'](function(){return _0x18737b;});})['then'](function(){_0x205e57[_0xf6a9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18943f,_0xf92187){return function(_0x21bb86){if(!_0x21bb86){_0x18943f[_0xf6a9('0x16')](0x194);}return _0x21bb86;};}function handleError(_0x505f33,_0x2f2ae5){_0x2f2ae5=_0x2f2ae5||0x1f4;return function(_0x207868){logger['error'](_0x207868[_0xf6a9('0x27')]);if(_0x207868['name']){delete _0x207868[_0xf6a9('0x28')];}_0x505f33['status'](_0x2f2ae5)[_0xf6a9('0x29')](_0x207868);};}exports['index']=function(_0x29556e,_0x72d8e5){var _0x3125fe={},_0x50c03e={},_0x449472={'count':0x0,'rows':[]};var _0x5072af=_[_0xf6a9('0x2a')](db[_0xf6a9('0x2b')][_0xf6a9('0x2c')],function(_0x13f07b){return{'name':_0x13f07b[_0xf6a9('0x2d')],'type':_0x13f07b[_0xf6a9('0x2e')][_0xf6a9('0x2f')]};});_0x50c03e[_0xf6a9('0x30')]=_[_0xf6a9('0x2a')](_0x5072af,_0xf6a9('0x28'));_0x50c03e['query']=_[_0xf6a9('0x31')](_0x29556e[_0xf6a9('0x32')]);_0x50c03e[_0xf6a9('0x33')]=_[_0xf6a9('0x34')](_0x50c03e[_0xf6a9('0x30')],_0x50c03e['query']);_0x3125fe[_0xf6a9('0x35')]=_['intersection'](_0x50c03e[_0xf6a9('0x30')],qs[_0xf6a9('0x36')](_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x36')]));_0x3125fe[_0xf6a9('0x35')]=_0x3125fe[_0xf6a9('0x35')][_0xf6a9('0x37')]?_0x3125fe[_0xf6a9('0x35')]:_0x50c03e[_0xf6a9('0x30')];if(!_0x29556e[_0xf6a9('0x32')]['hasOwnProperty'](_0xf6a9('0x38'))){_0x3125fe['limit']=qs[_0xf6a9('0x1c')](_0x29556e['query']['limit']);_0x3125fe[_0xf6a9('0x1a')]=qs[_0xf6a9('0x1a')](_0x29556e['query']['offset']);}_0x3125fe[_0xf6a9('0x39')]=qs[_0xf6a9('0x3a')](_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x3a')]);_0x3125fe[_0xf6a9('0x3b')]=qs[_0xf6a9('0x33')](_['pick'](_0x29556e[_0xf6a9('0x32')],_0x50c03e['filters']),_0x5072af);if(_0x29556e[_0xf6a9('0x32')][_0xf6a9('0x3c')]){_0x3125fe['where']=_[_0xf6a9('0x3d')](_0x3125fe[_0xf6a9('0x3b')],{'$or':_[_0xf6a9('0x2a')](_0x5072af,function(_0x424efa){if(_0x424efa[_0xf6a9('0x2e')]!==_0xf6a9('0x3e')){var _0x5bf70d={};_0x5bf70d[_0x424efa['name']]={'$like':'%'+_0x29556e['query'][_0xf6a9('0x3c')]+'%'};return _0x5bf70d;}})});}_0x3125fe=_[_0xf6a9('0x3d')]({},_0x3125fe,_0x29556e[_0xf6a9('0x3f')]);var _0x3f0d7a={'where':_0x3125fe[_0xf6a9('0x3b')]};return db['SquareOdbc'][_0xf6a9('0x1d')](_0x3f0d7a)['then'](function(_0x411caf){_0x449472['count']=_0x411caf;if(_0x29556e[_0xf6a9('0x32')]['includeAll']){_0x3125fe[_0xf6a9('0x40')]=[{'all':!![]}];}return db[_0xf6a9('0x2b')][_0xf6a9('0x41')](_0x3125fe);})[_0xf6a9('0x22')](function(_0x42d2d4){_0x449472[_0xf6a9('0x42')]=_0x42d2d4;return _0x449472;})['then'](respondWithFilteredResult(_0x72d8e5,_0x3125fe))['catch'](handleError(_0x72d8e5,null));};exports['show']=function(_0x7ccffe,_0x1e4a2a){var _0x4d0f90={'raw':!![],'where':{'id':_0x7ccffe[_0xf6a9('0x43')]['id']}},_0x162bbe={};_0x162bbe['model']=_['keys'](db[_0xf6a9('0x2b')]['rawAttributes']);_0x162bbe[_0xf6a9('0x32')]=_[_0xf6a9('0x31')](_0x7ccffe[_0xf6a9('0x32')]);_0x162bbe[_0xf6a9('0x33')]=_['intersection'](_0x162bbe[_0xf6a9('0x30')],_0x162bbe[_0xf6a9('0x32')]);_0x4d0f90[_0xf6a9('0x35')]=_[_0xf6a9('0x34')](_0x162bbe[_0xf6a9('0x30')],qs[_0xf6a9('0x36')](_0x7ccffe[_0xf6a9('0x32')][_0xf6a9('0x36')]));_0x4d0f90[_0xf6a9('0x35')]=_0x4d0f90['attributes'][_0xf6a9('0x37')]?_0x4d0f90[_0xf6a9('0x35')]:_0x162bbe[_0xf6a9('0x30')];if(_0x7ccffe[_0xf6a9('0x32')][_0xf6a9('0x44')]){_0x4d0f90[_0xf6a9('0x40')]=[{'all':!![]}];}_0x4d0f90=_[_0xf6a9('0x3d')]({},_0x4d0f90,_0x7ccffe[_0xf6a9('0x3f')]);return db[_0xf6a9('0x2b')][_0xf6a9('0x45')](_0x4d0f90)['then'](handleEntityNotFound(_0x1e4a2a,null))[_0xf6a9('0x22')](respondWithResult(_0x1e4a2a,null))[_0xf6a9('0x46')](handleError(_0x1e4a2a,null));};exports[_0xf6a9('0x47')]=function(_0x2528e0,_0x4116dc){return db[_0xf6a9('0x2b')]['create'](_0x2528e0[_0xf6a9('0x48')],{})['then'](function(_0x3c27c8){var _0x580d49=_0x2528e0['user'][_0xf6a9('0x24')]({'plain':!![]});if(!_0x580d49)throw new Error(_0xf6a9('0x49'));if(_0x580d49[_0xf6a9('0x4a')]===_0xf6a9('0x4b')){var _0x551b91=_0x3c27c8[_0xf6a9('0x24')]({'plain':!![]});var _0xef368b='ODBC';return db['UserProfileSection'][_0xf6a9('0x45')]({'where':{'name':_0xef368b,'userProfileId':_0x580d49[_0xf6a9('0x4c')]},'raw':!![]})[_0xf6a9('0x22')](function(_0x38c3b8){if(_0x38c3b8&&_0x38c3b8[_0xf6a9('0x4d')]===0x0){return db[_0xf6a9('0x26')][_0xf6a9('0x47')]({'name':_0x551b91[_0xf6a9('0x28')],'resourceId':_0x551b91['id'],'type':_0x38c3b8[_0xf6a9('0x28')],'sectionId':_0x38c3b8['id']},{})[_0xf6a9('0x22')](function(){return _0x3c27c8;});}else{return _0x3c27c8;}})[_0xf6a9('0x46')](function(_0x3c10c2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c10c2);throw _0x3c10c2;});}return _0x3c27c8;})[_0xf6a9('0x22')](respondWithResult(_0x4116dc,0xc9))['catch'](handleError(_0x4116dc,null));};exports[_0xf6a9('0x4e')]=function(_0x12d2ec,_0x3b5615){if(_0x12d2ec['body']['id']){delete _0x12d2ec['body']['id'];}return db['SquareOdbc'][_0xf6a9('0x45')]({'where':{'id':_0x12d2ec[_0xf6a9('0x43')]['id']}})[_0xf6a9('0x22')](handleEntityNotFound(_0x3b5615,null))['then'](saveUpdates(_0x12d2ec['body'],null))[_0xf6a9('0x22')](respondWithResult(_0x3b5615,null))[_0xf6a9('0x46')](handleError(_0x3b5615,null));};exports[_0xf6a9('0x23')]=function(_0xda77d6,_0x426f53){return db[_0xf6a9('0x2b')][_0xf6a9('0x45')]({'where':{'id':_0xda77d6['params']['id']}})[_0xf6a9('0x22')](handleEntityNotFound(_0x426f53,null))[_0xf6a9('0x22')](removeEntity(_0x426f53,null))[_0xf6a9('0x46')](handleError(_0x426f53,null));};exports[_0xf6a9('0x4f')]=function(_0x37652c,_0xb3f418,_0x44a7f2){var _0x2015d4;return db[_0xf6a9('0x2b')][_0xf6a9('0x45')]({'where':{'id':_0x37652c[_0xf6a9('0x43')]['id']},'attributes':['id',_0xf6a9('0x50')]})[_0xf6a9('0x22')](handleEntityNotFound(_0xb3f418,null))[_0xf6a9('0x22')](function(_0x450c63){if(_0x450c63){var _0x5a2fd6=require(_0xf6a9('0x51'))();_0x5a2fd6['openSync'](_0x450c63[_0xf6a9('0x50')]);_0x5a2fd6[_0xf6a9('0x52')]();return _0x450c63;}})[_0xf6a9('0x22')](respondWithResult(_0xb3f418,null))[_0xf6a9('0x46')](handleError(_0xb3f418,null));}; \ No newline at end of file +var _0x2cb4=['includeAll','include','rows','catch','show','params','rawAttributes','length','find','user','role','UserProfileSection','userProfileId','autoAssociation','create','body','dsn','openSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ODBC','UserProfileResource','then','name','send','index','map','SquareOdbc','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x2cb4,0xc2));var _0x42cb=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0x2cb4[_0x47568e];return _0x33815b;};'use strict';var emlformat=require(_0x42cb('0x0'));var rimraf=require(_0x42cb('0x1'));var zipdir=require(_0x42cb('0x2'));var jsonpatch=require(_0x42cb('0x3'));var rp=require('request-promise');var moment=require(_0x42cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x42cb('0x5'));var util=require(_0x42cb('0x6'));var path=require(_0x42cb('0x7'));var sox=require(_0x42cb('0x8'));var csv=require(_0x42cb('0x9'));var ejs=require(_0x42cb('0xa'));var fs=require('fs');var fs_extra=require(_0x42cb('0xb'));var _=require('lodash');var squel=require(_0x42cb('0xc'));var crypto=require(_0x42cb('0xd'));var jsforce=require(_0x42cb('0xe'));var deskjs=require(_0x42cb('0xf'));var toCsv=require(_0x42cb('0x9'));var querystring=require(_0x42cb('0x10'));var Papa=require(_0x42cb('0x11'));var Redis=require(_0x42cb('0x12'));var authService=require(_0x42cb('0x13'));var qs=require(_0x42cb('0x14'));var as=require(_0x42cb('0x15'));var hardwareService=require(_0x42cb('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x42cb('0x17'));var config=require(_0x42cb('0x18'));var licenseUtil=require(_0x42cb('0x19'));var db=require(_0x42cb('0x1a'))['db'];function respondWithStatusCode(_0x424ebe,_0xc10a4c){_0xc10a4c=_0xc10a4c||0xcc;return function(_0xb37247){if(_0xb37247){return _0x424ebe[_0x42cb('0x1b')](_0xc10a4c);}return _0x424ebe[_0x42cb('0x1c')](_0xc10a4c)[_0x42cb('0x1d')]();};}function respondWithResult(_0x13e140,_0x37706e){_0x37706e=_0x37706e||0xc8;return function(_0x44fc03){if(_0x44fc03){return _0x13e140[_0x42cb('0x1c')](_0x37706e)[_0x42cb('0x1e')](_0x44fc03);}};}function respondWithFilteredResult(_0x4fa61c,_0x58668c){return function(_0x476481){if(_0x476481){var _0x4d5c68=typeof _0x58668c[_0x42cb('0x1f')]===_0x42cb('0x20')&&typeof _0x58668c[_0x42cb('0x21')]===_0x42cb('0x20');var _0x1312f7=_0x476481[_0x42cb('0x22')];var _0x553db4=_0x4d5c68?0x0:_0x58668c[_0x42cb('0x1f')];var _0x5946ed=_0x4d5c68?_0x476481[_0x42cb('0x22')]:_0x58668c['offset']+_0x58668c[_0x42cb('0x21')];var _0x28e382;if(_0x5946ed>=_0x1312f7){_0x5946ed=_0x1312f7;_0x28e382=0xc8;}else{_0x28e382=0xce;}_0x4fa61c[_0x42cb('0x1c')](_0x28e382);return _0x4fa61c[_0x42cb('0x23')](_0x42cb('0x24'),_0x553db4+'-'+_0x5946ed+'/'+_0x1312f7)[_0x42cb('0x1e')](_0x476481);}return null;};}function patchUpdates(_0x20320a){return function(_0x5804da){try{jsonpatch[_0x42cb('0x25')](_0x5804da,_0x20320a,!![]);}catch(_0x290a39){return BPromise[_0x42cb('0x26')](_0x290a39);}return _0x5804da[_0x42cb('0x27')]();};}function saveUpdates(_0x28f52b,_0x2efeab){return function(_0x27f6e3){if(_0x27f6e3){return _0x27f6e3[_0x42cb('0x28')](_0x28f52b)['then'](function(_0x59fb67){return _0x59fb67;});}return null;};}function removeEntity(_0x5c0392,_0x24e4fd){return function(_0x1cb988){if(_0x1cb988){return _0x1cb988[_0x42cb('0x29')]()['then'](function(){var _0x42ec9d=_0x1cb988[_0x42cb('0x2a')]({'plain':!![]});var _0x1f1eeb=_0x42cb('0x2b');return db[_0x42cb('0x2c')][_0x42cb('0x29')]({'where':{'type':_0x1f1eeb,'resourceId':_0x42ec9d['id']}})[_0x42cb('0x2d')](function(){return _0x1cb988;});})[_0x42cb('0x2d')](function(){_0x5c0392[_0x42cb('0x1c')](0xcc)[_0x42cb('0x1d')]();});}};}function handleEntityNotFound(_0x714f2a,_0x48dbe2){return function(_0x3d149c){if(!_0x3d149c){_0x714f2a[_0x42cb('0x1b')](0x194);}return _0x3d149c;};}function handleError(_0x2b9b4b,_0x1d33ca){_0x1d33ca=_0x1d33ca||0x1f4;return function(_0x25d4de){logger['error'](_0x25d4de['stack']);if(_0x25d4de[_0x42cb('0x2e')]){delete _0x25d4de[_0x42cb('0x2e')];}_0x2b9b4b['status'](_0x1d33ca)[_0x42cb('0x2f')](_0x25d4de);};}exports[_0x42cb('0x30')]=function(_0x284e5d,_0x267c33){var _0x465f38={},_0x4f75c3={},_0x230af6={'count':0x0,'rows':[]};var _0x1310a9=_[_0x42cb('0x31')](db[_0x42cb('0x32')]['rawAttributes'],function(_0x378ee9){return{'name':_0x378ee9[_0x42cb('0x33')],'type':_0x378ee9[_0x42cb('0x34')][_0x42cb('0x35')]};});_0x4f75c3['model']=_[_0x42cb('0x31')](_0x1310a9,_0x42cb('0x2e'));_0x4f75c3[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x284e5d[_0x42cb('0x36')]);_0x4f75c3[_0x42cb('0x38')]=_['intersection'](_0x4f75c3[_0x42cb('0x39')],_0x4f75c3[_0x42cb('0x36')]);_0x465f38[_0x42cb('0x3a')]=_[_0x42cb('0x3b')](_0x4f75c3[_0x42cb('0x39')],qs[_0x42cb('0x3c')](_0x284e5d[_0x42cb('0x36')][_0x42cb('0x3c')]));_0x465f38[_0x42cb('0x3a')]=_0x465f38[_0x42cb('0x3a')]['length']?_0x465f38[_0x42cb('0x3a')]:_0x4f75c3[_0x42cb('0x39')];if(!_0x284e5d[_0x42cb('0x36')][_0x42cb('0x3d')](_0x42cb('0x3e'))){_0x465f38[_0x42cb('0x21')]=qs['limit'](_0x284e5d[_0x42cb('0x36')][_0x42cb('0x21')]);_0x465f38[_0x42cb('0x1f')]=qs[_0x42cb('0x1f')](_0x284e5d[_0x42cb('0x36')]['offset']);}_0x465f38[_0x42cb('0x3f')]=qs[_0x42cb('0x40')](_0x284e5d[_0x42cb('0x36')][_0x42cb('0x40')]);_0x465f38[_0x42cb('0x41')]=qs[_0x42cb('0x38')](_['pick'](_0x284e5d[_0x42cb('0x36')],_0x4f75c3[_0x42cb('0x38')]),_0x1310a9);if(_0x284e5d[_0x42cb('0x36')][_0x42cb('0x42')]){_0x465f38[_0x42cb('0x41')]=_['merge'](_0x465f38[_0x42cb('0x41')],{'$or':_[_0x42cb('0x31')](_0x1310a9,function(_0x1439ca){if(_0x1439ca[_0x42cb('0x34')]!==_0x42cb('0x43')){var _0x1664ae={};_0x1664ae[_0x1439ca[_0x42cb('0x2e')]]={'$like':'%'+_0x284e5d['query'][_0x42cb('0x42')]+'%'};return _0x1664ae;}})});}_0x465f38=_[_0x42cb('0x44')]({},_0x465f38,_0x284e5d[_0x42cb('0x45')]);var _0x5aea05={'where':_0x465f38[_0x42cb('0x41')]};return db[_0x42cb('0x32')][_0x42cb('0x22')](_0x5aea05)[_0x42cb('0x2d')](function(_0x25fa05){_0x230af6[_0x42cb('0x22')]=_0x25fa05;if(_0x284e5d[_0x42cb('0x36')][_0x42cb('0x46')]){_0x465f38[_0x42cb('0x47')]=[{'all':!![]}];}return db[_0x42cb('0x32')]['findAll'](_0x465f38);})[_0x42cb('0x2d')](function(_0x426628){_0x230af6[_0x42cb('0x48')]=_0x426628;return _0x230af6;})[_0x42cb('0x2d')](respondWithFilteredResult(_0x267c33,_0x465f38))[_0x42cb('0x49')](handleError(_0x267c33,null));};exports[_0x42cb('0x4a')]=function(_0x1f5836,_0x5d657e){var _0x5f46ea={'raw':!![],'where':{'id':_0x1f5836[_0x42cb('0x4b')]['id']}},_0x164f2e={};_0x164f2e[_0x42cb('0x39')]=_[_0x42cb('0x37')](db[_0x42cb('0x32')][_0x42cb('0x4c')]);_0x164f2e[_0x42cb('0x36')]=_[_0x42cb('0x37')](_0x1f5836[_0x42cb('0x36')]);_0x164f2e[_0x42cb('0x38')]=_[_0x42cb('0x3b')](_0x164f2e[_0x42cb('0x39')],_0x164f2e[_0x42cb('0x36')]);_0x5f46ea['attributes']=_[_0x42cb('0x3b')](_0x164f2e['model'],qs[_0x42cb('0x3c')](_0x1f5836['query'][_0x42cb('0x3c')]));_0x5f46ea['attributes']=_0x5f46ea[_0x42cb('0x3a')][_0x42cb('0x4d')]?_0x5f46ea[_0x42cb('0x3a')]:_0x164f2e[_0x42cb('0x39')];if(_0x1f5836['query'][_0x42cb('0x46')]){_0x5f46ea[_0x42cb('0x47')]=[{'all':!![]}];}_0x5f46ea=_[_0x42cb('0x44')]({},_0x5f46ea,_0x1f5836[_0x42cb('0x45')]);return db['SquareOdbc'][_0x42cb('0x4e')](_0x5f46ea)[_0x42cb('0x2d')](handleEntityNotFound(_0x5d657e,null))['then'](respondWithResult(_0x5d657e,null))['catch'](handleError(_0x5d657e,null));};exports['create']=function(_0x13f6a9,_0x314c90){return db[_0x42cb('0x32')]['create'](_0x13f6a9['body'],{})[_0x42cb('0x2d')](function(_0x2ee1ca){var _0x49913a=_0x13f6a9[_0x42cb('0x4f')]['get']({'plain':!![]});if(!_0x49913a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49913a[_0x42cb('0x50')]==='user'){var _0x2b9252=_0x2ee1ca[_0x42cb('0x2a')]({'plain':!![]});var _0x5f1681=_0x42cb('0x2b');return db[_0x42cb('0x51')]['find']({'where':{'name':_0x5f1681,'userProfileId':_0x49913a[_0x42cb('0x52')]},'raw':!![]})[_0x42cb('0x2d')](function(_0x2de750){if(_0x2de750&&_0x2de750[_0x42cb('0x53')]===0x0){return db[_0x42cb('0x2c')][_0x42cb('0x54')]({'name':_0x2b9252[_0x42cb('0x2e')],'resourceId':_0x2b9252['id'],'type':_0x2de750[_0x42cb('0x2e')],'sectionId':_0x2de750['id']},{})['then'](function(){return _0x2ee1ca;});}else{return _0x2ee1ca;}})[_0x42cb('0x49')](function(_0x1dc7e6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dc7e6);throw _0x1dc7e6;});}return _0x2ee1ca;})[_0x42cb('0x2d')](respondWithResult(_0x314c90,0xc9))[_0x42cb('0x49')](handleError(_0x314c90,null));};exports[_0x42cb('0x28')]=function(_0x19474a,_0x3a9c6e){if(_0x19474a['body']['id']){delete _0x19474a[_0x42cb('0x55')]['id'];}return db[_0x42cb('0x32')][_0x42cb('0x4e')]({'where':{'id':_0x19474a[_0x42cb('0x4b')]['id']}})[_0x42cb('0x2d')](handleEntityNotFound(_0x3a9c6e,null))[_0x42cb('0x2d')](saveUpdates(_0x19474a['body'],null))[_0x42cb('0x2d')](respondWithResult(_0x3a9c6e,null))[_0x42cb('0x49')](handleError(_0x3a9c6e,null));};exports['destroy']=function(_0x380d78,_0x433a73){return db[_0x42cb('0x32')][_0x42cb('0x4e')]({'where':{'id':_0x380d78['params']['id']}})[_0x42cb('0x2d')](handleEntityNotFound(_0x433a73,null))[_0x42cb('0x2d')](removeEntity(_0x433a73,null))['catch'](handleError(_0x433a73,null));};exports['test']=function(_0x45386b,_0xe6c9f0,_0x679af3){var _0x2e997b;return db['SquareOdbc'][_0x42cb('0x4e')]({'where':{'id':_0x45386b[_0x42cb('0x4b')]['id']},'attributes':['id',_0x42cb('0x56')]})['then'](handleEntityNotFound(_0xe6c9f0,null))[_0x42cb('0x2d')](function(_0x4dc1e3){if(_0x4dc1e3){var _0x30d7ae=require('odbc')();_0x30d7ae[_0x42cb('0x57')](_0x4dc1e3['dsn']);_0x30d7ae['closeSync']();return _0x4dc1e3;}})['then'](respondWithResult(_0xe6c9f0,null))['catch'](handleError(_0xe6c9f0,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 44cd95c..2314b82 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 _0xd08b=['api','moment','request-promise','rimraf','exports','define','SquareOdbc','square_odbc','util','../../config/logger'];(function(_0x6287b6,_0x5682e7){var _0x5d6be4=function(_0x3e3975){while(--_0x3e3975){_0x6287b6['push'](_0x6287b6['shift']());}};_0x5d6be4(++_0x5682e7);}(_0xd08b,0xee));var _0xbd08=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0xd08b[_0x197065];return _0x3d9404;};'use strict';var _=require('lodash');var util=require(_0xbd08('0x0'));var logger=require(_0xbd08('0x1'))(_0xbd08('0x2'));var moment=require(_0xbd08('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd08('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd08('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xbd08('0x6')]=function(_0x2a1950,_0x49c784){return _0x2a1950[_0xbd08('0x7')](_0xbd08('0x8'),attributes,{'tableName':_0xbd08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4d2=['path','rimraf','../../config/environment','./squareOdbc.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4c04ca,_0x318eff){var _0x415328=function(_0xa0d92d){while(--_0xa0d92d){_0x4c04ca['push'](_0x4c04ca['shift']());}};_0x415328(++_0x318eff);}(_0xf4d2,0x130));var _0x2f4d=function(_0x38d33b,_0x5ab09d){_0x38d33b=_0x38d33b-0x0;var _0x3a18e9=_0xf4d2[_0x38d33b];return _0x3a18e9;};'use strict';var _=require(_0x2f4d('0x0'));var util=require(_0x2f4d('0x1'));var logger=require(_0x2f4d('0x2'))('api');var moment=require(_0x2f4d('0x3'));var BPromise=require(_0x2f4d('0x4'));var rp=require(_0x2f4d('0x5'));var fs=require('fs');var path=require(_0x2f4d('0x6'));var rimraf=require(_0x2f4d('0x7'));var config=require(_0x2f4d('0x8'));var attributes=require(_0x2f4d('0x9'));module['exports']=function(_0x1a96ae,_0x224413){return _0x1a96ae['define']('SquareOdbc',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 c138850..aa19b11 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 _0x34a4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','include','model','attributes','map','stringify','util'];(function(_0x5e1459,_0x2d68ac){var _0x54c384=function(_0x2aa499){while(--_0x2aa499){_0x5e1459['push'](_0x5e1459['shift']());}};_0x54c384(++_0x2d68ac);}(_0x34a4,0x1b2));var _0x434a=function(_0x2f59f1,_0xdfe0c6){_0x2f59f1=_0x2f59f1-0x0;var _0x2ee114=_0x34a4[_0x2f59f1];return _0x2ee114;};'use strict';var _=require('lodash');var util=require(_0x434a('0x0'));var moment=require(_0x434a('0x1'));var BPromise=require(_0x434a('0x2'));var rs=require(_0x434a('0x3'));var fs=require('fs');var Redis=require(_0x434a('0x4'));var db=require(_0x434a('0x5'))['db'];var utils=require(_0x434a('0x6'));var logger=require('../../config/logger')(_0x434a('0x7'));var config=require(_0x434a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x434a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51093a,_0x16d3e0,_0x6fad18){return new BPromise(function(_0x337068,_0xf273c5){return client[_0x434a('0xa')](_0x51093a,_0x6fad18)[_0x434a('0xb')](function(_0x13b510){logger[_0x434a('0xc')](_0x434a('0xd'),_0x16d3e0,_0x434a('0xe'));logger[_0x434a('0xf')](_0x434a('0x10'),_0x16d3e0,_0x434a('0xe'),JSON['stringify'](_0x13b510));if(_0x13b510[_0x434a('0x11')]){if(_0x13b510[_0x434a('0x11')][_0x434a('0x12')]===0x1f4){logger[_0x434a('0x11')](_0x434a('0xd'),_0x16d3e0,_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);return _0xf273c5(_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);}logger[_0x434a('0x11')](_0x434a('0xd'),_0x16d3e0,_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);return _0x337068(_0x13b510[_0x434a('0x11')][_0x434a('0x13')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x16d3e0,_0x434a('0xe'));_0x337068(_0x13b510[_0x434a('0x14')][_0x434a('0x13')]);}})[_0x434a('0x15')](function(_0x2f7d27){logger['error'](_0x434a('0xd'),_0x16d3e0,_0x2f7d27);_0xf273c5(_0x2f7d27);});});}exports[_0x434a('0x16')]=function(_0x7eb234){var _0x40b565=this;return new Promise(function(_0xc9f5d,_0x3188bb){return db['SquareOdbc']['find']({'raw':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['where']||null:null,'attributes':_0x7eb234[_0x434a('0x17')]?_0x7eb234[_0x434a('0x17')]['attributes']||null:null,'include':_0x7eb234['options']?_0x7eb234[_0x434a('0x17')][_0x434a('0x18')]?_['map'](_0x7eb234[_0x434a('0x17')][_0x434a('0x18')],function(_0x19527d){return{'model':db[_0x19527d[_0x434a('0x19')]],'as':_0x19527d['as'],'attributes':_0x19527d[_0x434a('0x1a')],'include':_0x19527d[_0x434a('0x18')]?_['map'](_0x19527d[_0x434a('0x18')],function(_0x3da0f4){return{'model':db[_0x3da0f4[_0x434a('0x19')]],'as':_0x3da0f4['as'],'attributes':_0x3da0f4[_0x434a('0x1a')],'include':_0x3da0f4[_0x434a('0x18')]?_[_0x434a('0x1b')](_0x3da0f4[_0x434a('0x18')],function(_0x4cd37b){return{'model':db[_0x4cd37b[_0x434a('0x19')]],'as':_0x4cd37b['as'],'attributes':_0x4cd37b[_0x434a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cdfda){logger[_0x434a('0xc')](_0x434a('0x16'),_0x7eb234);logger[_0x434a('0xf')](_0x434a('0x16'),_0x7eb234,JSON[_0x434a('0x1c')](_0x5cdfda));_0xc9f5d(_0x5cdfda);})[_0x434a('0x15')](function(_0x54ed49){logger['error'](_0x434a('0x16'),_0x54ed49[_0x434a('0x13')],_0x7eb234);_0x3188bb(_0x40b565[_0x434a('0x11')](0x1f4,_0x54ed49[_0x434a('0x13')]));});});}; \ No newline at end of file +var _0xb8bf=['../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','model','map','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x1a7c9d,_0x54a301){var _0xea2de5=function(_0x5f042a){while(--_0x5f042a){_0x1a7c9d['push'](_0x1a7c9d['shift']());}};_0xea2de5(++_0x54a301);}(_0xb8bf,0xb3));var _0xfb8b=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb8bf[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xfb8b('0x0'));var moment=require(_0xfb8b('0x1'));var BPromise=require(_0xfb8b('0x2'));var rs=require(_0xfb8b('0x3'));var fs=require('fs');var Redis=require(_0xfb8b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb8b('0x5'));var logger=require('../../config/logger')(_0xfb8b('0x6'));var config=require(_0xfb8b('0x7'));var jayson=require(_0xfb8b('0x8'));var client=jayson[_0xfb8b('0x9')][_0xfb8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13e580,_0x31edcf,_0x2ec223){return new BPromise(function(_0x1320b6,_0x211f95){return client[_0xfb8b('0xb')](_0x13e580,_0x2ec223)[_0xfb8b('0xc')](function(_0x41e001){logger['info'](_0xfb8b('0xd'),_0x31edcf,'request\x20sent');logger[_0xfb8b('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x31edcf,_0xfb8b('0xf'),JSON['stringify'](_0x41e001));if(_0x41e001[_0xfb8b('0x10')]){if(_0x41e001[_0xfb8b('0x10')]['code']===0x1f4){logger[_0xfb8b('0x10')](_0xfb8b('0xd'),_0x31edcf,_0x41e001[_0xfb8b('0x10')][_0xfb8b('0x11')]);return _0x211f95(_0x41e001['error']['message']);}logger[_0xfb8b('0x10')](_0xfb8b('0xd'),_0x31edcf,_0x41e001[_0xfb8b('0x10')][_0xfb8b('0x11')]);return _0x1320b6(_0x41e001['error'][_0xfb8b('0x11')]);}else{logger[_0xfb8b('0x12')](_0xfb8b('0xd'),_0x31edcf,_0xfb8b('0xf'));_0x1320b6(_0x41e001[_0xfb8b('0x13')][_0xfb8b('0x11')]);}})[_0xfb8b('0x14')](function(_0x4689fc){logger[_0xfb8b('0x10')](_0xfb8b('0xd'),_0x31edcf,_0x4689fc);_0x211f95(_0x4689fc);});});}exports[_0xfb8b('0x15')]=function(_0xf24b29){var _0x1506a7=this;return new Promise(function(_0x3deea6,_0x55013b){return db[_0xfb8b('0x16')][_0xfb8b('0x17')]({'raw':_0xf24b29[_0xfb8b('0x18')]?_0xf24b29[_0xfb8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xf24b29['options']?_0xf24b29[_0xfb8b('0x18')][_0xfb8b('0x19')]||null:null,'attributes':_0xf24b29[_0xfb8b('0x18')]?_0xf24b29[_0xfb8b('0x18')][_0xfb8b('0x1a')]||null:null,'include':_0xf24b29['options']?_0xf24b29[_0xfb8b('0x18')][_0xfb8b('0x1b')]?_['map'](_0xf24b29[_0xfb8b('0x18')][_0xfb8b('0x1b')],function(_0x142bd9){return{'model':db[_0x142bd9[_0xfb8b('0x1c')]],'as':_0x142bd9['as'],'attributes':_0x142bd9[_0xfb8b('0x1a')],'include':_0x142bd9[_0xfb8b('0x1b')]?_[_0xfb8b('0x1d')](_0x142bd9['include'],function(_0x41ab19){return{'model':db[_0x41ab19[_0xfb8b('0x1c')]],'as':_0x41ab19['as'],'attributes':_0x41ab19[_0xfb8b('0x1a')],'include':_0x41ab19[_0xfb8b('0x1b')]?_[_0xfb8b('0x1d')](_0x41ab19[_0xfb8b('0x1b')],function(_0x36896e){return{'model':db[_0x36896e['model']],'as':_0x36896e['as'],'attributes':_0x36896e['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb8b('0xc')](function(_0x298a23){logger[_0xfb8b('0x12')](_0xfb8b('0x15'),_0xf24b29);logger[_0xfb8b('0xe')](_0xfb8b('0x15'),_0xf24b29,JSON[_0xfb8b('0x1e')](_0x298a23));_0x3deea6(_0x298a23);})[_0xfb8b('0x14')](function(_0x5956f2){logger[_0xfb8b('0x10')](_0xfb8b('0x15'),_0x5956f2[_0xfb8b('0x11')],_0xf24b29);_0x55013b(_0x1506a7['error'](0x1f4,_0x5956f2[_0xfb8b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4f4ab66..3cf36d6 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 _0x0f9c=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index'];(function(_0x3c6264,_0x4f6bd6){var _0x2b3b8f=function(_0x2b70ec){while(--_0x2b70ec){_0x3c6264['push'](_0x3c6264['shift']());}};_0x2b3b8f(++_0x4f6bd6);}(_0x0f9c,0xd1));var _0xc0f9=function(_0x497061,_0x126934){_0x497061=_0x497061-0x0;var _0x3c8b58=_0x0f9c[_0x497061];return _0x3c8b58;};'use strict';var multer=require(_0xc0f9('0x0'));var util=require(_0xc0f9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0f9('0x2'));var router=express[_0xc0f9('0x3')]();var fs_extra=require(_0xc0f9('0x4'));var auth=require(_0xc0f9('0x5'));var interaction=require(_0xc0f9('0x6'));var config=require(_0xc0f9('0x7'));var controller=require(_0xc0f9('0x8'));router['get']('/',auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xa')]);router['get'](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xc')]);router[_0xc0f9('0xd')]('/',auth[_0xc0f9('0x9')](),controller[_0xc0f9('0xe')]);router[_0xc0f9('0xf')](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0x10')]);router[_0xc0f9('0x11')](_0xc0f9('0xb'),auth[_0xc0f9('0x9')](),controller[_0xc0f9('0x12')]);module[_0xc0f9('0x13')]=router; \ No newline at end of file +var _0x2ac8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','delete','destroy','util','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2ac8,0x12e));var _0x82ac=function(_0x50fea9,_0x148cea){_0x50fea9=_0x50fea9-0x0;var _0x4a1c74=_0x2ac8[_0x50fea9];return _0x4a1c74;};'use strict';var multer=require('multer');var util=require(_0x82ac('0x0'));var path=require(_0x82ac('0x1'));var timeout=require(_0x82ac('0x2'));var express=require('express');var router=express[_0x82ac('0x3')]();var fs_extra=require(_0x82ac('0x4'));var auth=require(_0x82ac('0x5'));var interaction=require(_0x82ac('0x6'));var config=require(_0x82ac('0x7'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x82ac('0x8')](),controller['index']);router[_0x82ac('0x9')](_0x82ac('0xa'),auth[_0x82ac('0x8')](),controller[_0x82ac('0xb')]);router[_0x82ac('0xc')]('/',auth['isAuthenticated'](),controller[_0x82ac('0xd')]);router['put']('/:id',auth[_0x82ac('0x8')](),controller['update']);router[_0x82ac('0xe')](_0x82ac('0xa'),auth['isAuthenticated'](),controller[_0x82ac('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a382416..ab27283 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 _0xcc66=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xcc66[_0x4b7b69];return _0x173b4c;};'use strict';var Sequelize=require(_0x6cc6('0x0'));module[_0x6cc6('0x1')]={'name':{'type':Sequelize[_0x6cc6('0x2')],'unique':_0x6cc6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6cc6('0x2')]},'notes':{'type':Sequelize[_0x6cc6('0x4')]},'preproduction':{'type':Sequelize[_0x6cc6('0x5')](_0x6cc6('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x6cc6('0x7')](_0x6cc6('0x8'))[_0x6cc6('0x9')](_0x6cc6('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0x6cc6('0x6')),'get':function(){if(this[_0x6cc6('0x7')]('production')){return this['getDataValue'](_0x6cc6('0xb'))['toString'](_0x6cc6('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x6cc6('0xc')]}}; \ No newline at end of file +var _0x207e=['long','production','DATE','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x207e,0x12f));var _0xe207=function(_0x2eb23d,_0x5b75fd){_0x2eb23d=_0x2eb23d-0x0;var _0x45e265=_0x207e[_0x2eb23d];return _0x45e265;};'use strict';var Sequelize=require('sequelize');module[_0xe207('0x0')]={'name':{'type':Sequelize[_0xe207('0x1')],'unique':_0xe207('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xe207('0x1')]},'notes':{'type':Sequelize[_0xe207('0x3')]},'preproduction':{'type':Sequelize[_0xe207('0x4')]('long'),'get':function(){if(this[_0xe207('0x5')](_0xe207('0x6'))){return this[_0xe207('0x5')](_0xe207('0x6'))[_0xe207('0x7')](_0xe207('0x8'));}}},'production':{'type':Sequelize[_0xe207('0x4')](_0xe207('0x9')),'get':function(){if(this[_0xe207('0x5')]('production')){return this[_0xe207('0x5')](_0xe207('0xa'))[_0xe207('0x7')](_0xe207('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe207('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index cbba4ec..06c11f8 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 _0xdf72=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','name','options','SquareProject','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','pick','production','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','./squareProject.socket','register','status','json','undefined','offset','count','limit','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','stack','send','index','map'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xdf72,0x181));var _0x2df7=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xdf72[_0x46efd7];return _0x5637e4;};'use strict';var _=require(_0x2df7('0x0'));var Redis=require(_0x2df7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2df7('0x2'))('api');var config=require(_0x2df7('0x3'));var db=require(_0x2df7('0x4'))['db'];config[_0x2df7('0x5')]=_['defaults'](config[_0x2df7('0x5')],{'host':_0x2df7('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2df7('0x7'))[_0x2df7('0x8')](socket);function respondWithResult(_0x2d900a,_0x2d2f49){_0x2d2f49=_0x2d2f49||0xc8;return function(_0x19af37){if(_0x19af37){return _0x2d900a[_0x2df7('0x9')](_0x2d2f49)[_0x2df7('0xa')](_0x19af37);}};}function respondWithFilteredResult(_0x2d614d,_0x52b6bc){return function(_0x54c41e){if(_0x54c41e){var _0x464166=typeof _0x52b6bc['offset']==='undefined'&&typeof _0x52b6bc['limit']===_0x2df7('0xb');var _0x15b760=_0x54c41e['count'];var _0x36ecd4=_0x464166?0x0:_0x52b6bc[_0x2df7('0xc')];var _0x446a4d=_0x464166?_0x54c41e[_0x2df7('0xd')]:_0x52b6bc[_0x2df7('0xc')]+_0x52b6bc[_0x2df7('0xe')];var _0xf1d044;if(_0x446a4d>=_0x15b760){_0x446a4d=_0x15b760;_0xf1d044=0xc8;}else{_0xf1d044=0xce;}_0x2d614d[_0x2df7('0x9')](_0xf1d044);return _0x2d614d[_0x2df7('0xf')](_0x2df7('0x10'),_0x36ecd4+'-'+_0x446a4d+'/'+_0x15b760)['json'](_0x54c41e);}return null;};}function saveUpdates(_0x5c1b82){return function(_0x21bcac){if(_0x21bcac){return _0x21bcac[_0x2df7('0x11')](_0x5c1b82)[_0x2df7('0x12')](function(_0xe83263){return _0xe83263;});}return null;};}function removeEntity(_0x57aee3){return function(_0xbedfb7){if(_0xbedfb7){return _0xbedfb7[_0x2df7('0x13')]()[_0x2df7('0x12')](function(){var _0x171188=_0xbedfb7['get']({'plain':!![]});var _0x109db6=_0x2df7('0x14');return db[_0x2df7('0x15')][_0x2df7('0x13')]({'where':{'type':_0x109db6,'resourceId':_0x171188['id']}})[_0x2df7('0x12')](function(){return _0xbedfb7;});})[_0x2df7('0x12')](function(){var _0x24927d=new Redis(config['redis']);_0x24927d[_0x2df7('0x16')](_0x2df7('0x17'),JSON[_0x2df7('0x18')]({'id':_0xbedfb7['id'],'deleted':!![]}));})['then'](function(){_0x57aee3[_0x2df7('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe013e2){return function(_0x2c02ce){if(!_0x2c02ce){_0xe013e2['sendStatus'](0x194);}return _0x2c02ce;};}function handleError(_0x3c7c99,_0x595ecc){_0x595ecc=_0x595ecc||0x1f4;return function(_0x539b37){logger['error'](_0x539b37[_0x2df7('0x19')]);if(_0x539b37['name']){delete _0x539b37['name'];}_0x3c7c99[_0x2df7('0x9')](_0x595ecc)[_0x2df7('0x1a')](_0x539b37);};}exports[_0x2df7('0x1b')]=function(_0x2dfb47,_0x1e3ad2){var _0x56631d={},_0x3e83dd={},_0x394ee8={'count':0x0,'rows':[]};var _0x5aa607=_[_0x2df7('0x1c')](db['SquareProject'][_0x2df7('0x1d')],function(_0x32be0c){return{'name':_0x32be0c[_0x2df7('0x1e')],'type':_0x32be0c[_0x2df7('0x1f')][_0x2df7('0x20')]};});_0x3e83dd[_0x2df7('0x21')]=_[_0x2df7('0x1c')](_0x5aa607,'name');_0x3e83dd[_0x2df7('0x22')]=_[_0x2df7('0x23')](_0x2dfb47[_0x2df7('0x22')]);_0x3e83dd[_0x2df7('0x24')]=_[_0x2df7('0x25')](_0x3e83dd[_0x2df7('0x21')],_0x3e83dd[_0x2df7('0x22')]);_0x56631d[_0x2df7('0x26')]=_[_0x2df7('0x25')](_0x3e83dd[_0x2df7('0x21')],qs[_0x2df7('0x27')](_0x2dfb47[_0x2df7('0x22')][_0x2df7('0x27')]));_0x56631d[_0x2df7('0x26')]=_0x56631d[_0x2df7('0x26')]['length']?_0x56631d[_0x2df7('0x26')]:_0x3e83dd[_0x2df7('0x21')];if(!_0x2dfb47[_0x2df7('0x22')][_0x2df7('0x28')](_0x2df7('0x29'))){_0x56631d[_0x2df7('0xe')]=qs[_0x2df7('0xe')](_0x2dfb47[_0x2df7('0x22')][_0x2df7('0xe')]);_0x56631d[_0x2df7('0xc')]=qs[_0x2df7('0xc')](_0x2dfb47['query'][_0x2df7('0xc')]);}_0x56631d[_0x2df7('0x2a')]=qs[_0x2df7('0x2b')](_0x2dfb47['query']['sort']);_0x56631d[_0x2df7('0x2c')]=qs[_0x2df7('0x24')](_['pick'](_0x2dfb47[_0x2df7('0x22')],_0x3e83dd['filters']),_0x5aa607);if(_0x2dfb47[_0x2df7('0x22')]['filter']){_0x56631d[_0x2df7('0x2c')]=_[_0x2df7('0x2d')](_0x56631d[_0x2df7('0x2c')],{'$or':_[_0x2df7('0x1c')](_0x5aa607,function(_0x4086d4){if(_0x4086d4['type']!==_0x2df7('0x2e')){var _0x2d0648={};_0x2d0648[_0x4086d4[_0x2df7('0x2f')]]={'$like':'%'+_0x2dfb47[_0x2df7('0x22')]['filter']+'%'};return _0x2d0648;}})});}_0x56631d=_['merge']({},_0x56631d,_0x2dfb47[_0x2df7('0x30')]);var _0x5610b4={'where':_0x56631d[_0x2df7('0x2c')]};return db[_0x2df7('0x31')][_0x2df7('0xd')](_0x5610b4)['then'](function(_0x1177a0){_0x394ee8[_0x2df7('0xd')]=_0x1177a0;if(_0x2dfb47['query'][_0x2df7('0x32')]){_0x56631d[_0x2df7('0x33')]=[{'all':!![]}];}return db['SquareProject'][_0x2df7('0x34')](_0x56631d);})[_0x2df7('0x12')](function(_0x4e0f8f){_0x394ee8['rows']=_0x4e0f8f;return _0x394ee8;})['then'](respondWithFilteredResult(_0x1e3ad2,_0x56631d))[_0x2df7('0x35')](handleError(_0x1e3ad2,null));};exports['show']=function(_0x273a97,_0x4f19f2){var _0x28ea02={'raw':![],'where':{'id':_0x273a97['params']['id']}},_0x163bb0={};_0x163bb0[_0x2df7('0x21')]=_[_0x2df7('0x23')](db[_0x2df7('0x31')][_0x2df7('0x1d')]);_0x163bb0[_0x2df7('0x22')]=_[_0x2df7('0x23')](_0x273a97[_0x2df7('0x22')]);_0x163bb0[_0x2df7('0x24')]=_[_0x2df7('0x25')](_0x163bb0['model'],_0x163bb0[_0x2df7('0x22')]);_0x28ea02[_0x2df7('0x26')]=_[_0x2df7('0x25')](_0x163bb0[_0x2df7('0x21')],qs['fields'](_0x273a97[_0x2df7('0x22')][_0x2df7('0x27')]));_0x28ea02['attributes']=_0x28ea02['attributes'][_0x2df7('0x36')]?_0x28ea02['attributes']:_0x163bb0['model'];if(_0x273a97[_0x2df7('0x22')]['includeAll']){_0x28ea02[_0x2df7('0x33')]=[{'all':!![]}];}_0x28ea02=_[_0x2df7('0x2d')]({},_0x28ea02,_0x273a97[_0x2df7('0x30')]);return db['SquareProject'][_0x2df7('0x37')](_0x28ea02)[_0x2df7('0x12')](handleEntityNotFound(_0x4f19f2,null))[_0x2df7('0x12')](respondWithResult(_0x4f19f2,null))[_0x2df7('0x35')](handleError(_0x4f19f2,null));};exports[_0x2df7('0x38')]=function(_0x5e4c43,_0x3516ff){return db['SquareProject'][_0x2df7('0x38')](_0x5e4c43['body'],{})[_0x2df7('0x12')](function(_0x2b7619){var _0x2e48d7=_0x5e4c43[_0x2df7('0x39')]['get']({'plain':!![]});if(!_0x2e48d7)throw new Error(_0x2df7('0x3a'));if(_0x2e48d7[_0x2df7('0x3b')]==='user'){var _0x5048d6=_0x2b7619[_0x2df7('0x3c')]({'plain':!![]});var _0x3e85b=_0x2df7('0x14');return db[_0x2df7('0x3d')][_0x2df7('0x37')]({'where':{'name':_0x3e85b,'userProfileId':_0x2e48d7[_0x2df7('0x3e')]},'raw':!![]})[_0x2df7('0x12')](function(_0x4d84b8){if(_0x4d84b8&&_0x4d84b8['autoAssociation']===0x0){return db[_0x2df7('0x15')][_0x2df7('0x38')]({'name':_0x5048d6[_0x2df7('0x2f')],'resourceId':_0x5048d6['id'],'type':_0x4d84b8[_0x2df7('0x2f')],'sectionId':_0x4d84b8['id']},{})[_0x2df7('0x12')](function(){return _0x2b7619;});}else{return _0x2b7619;}})[_0x2df7('0x35')](function(_0x1d7a1f){logger[_0x2df7('0x3f')](_0x2df7('0x40'),_0x1d7a1f);throw _0x1d7a1f;});}return _0x2b7619;})[_0x2df7('0x12')](respondWithResult(_0x3516ff,0xc9))['catch'](handleError(_0x3516ff,null));};exports[_0x2df7('0x11')]=function(_0x10b8b1,_0x3ed58c){if(_0x10b8b1[_0x2df7('0x41')]['id']){delete _0x10b8b1[_0x2df7('0x41')]['id'];}return db[_0x2df7('0x31')][_0x2df7('0x37')]({'where':{'id':_0x10b8b1[_0x2df7('0x42')]['id']}})[_0x2df7('0x12')](handleEntityNotFound(_0x3ed58c,null))[_0x2df7('0x12')](saveUpdates(_0x10b8b1[_0x2df7('0x41')],null))[_0x2df7('0x12')](function(_0x53ab25){if(!_0x53ab25)return;var _0x247a9b=_0x53ab25[_0x2df7('0x3c')]({'plain':!![]});return _0x247a9b;})[_0x2df7('0x12')](function(_0x15fe00){var _0x3d903e=new Redis(config[_0x2df7('0x5')]);_0x3d903e[_0x2df7('0x16')](_0x2df7('0x17'),JSON['stringify'](_[_0x2df7('0x43')](_0x15fe00,['id','name',_0x2df7('0x44')])));return _0x15fe00;})[_0x2df7('0x12')](respondWithResult(_0x3ed58c,null))[_0x2df7('0x35')](handleError(_0x3ed58c,null));};exports[_0x2df7('0x13')]=function(_0x52e2d3,_0x4239cb){return db[_0x2df7('0x31')][_0x2df7('0x37')]({'where':{'id':_0x52e2d3['params']['id']}})['then'](handleEntityNotFound(_0x4239cb,null))[_0x2df7('0x12')](removeEntity(_0x4239cb,null))['catch'](handleError(_0x4239cb,null));}; \ No newline at end of file +var _0x175d=['type','includeAll','SquareProject','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','production','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','update','then','get','SquareProjects','UserProfileResource','destroy','publish','agi','stringify','sendStatus','error','stack','name','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x44e5d8,_0x4f6070){var _0x44fe81=function(_0x1d6e78){while(--_0x1d6e78){_0x44e5d8['push'](_0x44e5d8['shift']());}};_0x44fe81(++_0x4f6070);}(_0x175d,0x130));var _0xd175=function(_0x248aa0,_0x9acf1b){_0x248aa0=_0x248aa0-0x0;var _0x2a0e5d=_0x175d[_0x248aa0];return _0x2a0e5d;};'use strict';var _=require(_0xd175('0x0'));var Redis=require(_0xd175('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd175('0x2'))(_0xd175('0x3'));var config=require(_0xd175('0x4'));var db=require(_0xd175('0x5'))['db'];config[_0xd175('0x6')]=_[_0xd175('0x7')](config['redis'],{'host':_0xd175('0x8'),'port':0x18eb});var socket=require(_0xd175('0x9'))(new Redis(config[_0xd175('0x6')]));require(_0xd175('0xa'))[_0xd175('0xb')](socket);function respondWithResult(_0xce5a5f,_0x1c6d72){_0x1c6d72=_0x1c6d72||0xc8;return function(_0x2982ae){if(_0x2982ae){return _0xce5a5f[_0xd175('0xc')](_0x1c6d72)[_0xd175('0xd')](_0x2982ae);}};}function respondWithFilteredResult(_0x1a2bc2,_0x1cacf0){return function(_0x213ccb){if(_0x213ccb){var _0x1a0369=typeof _0x1cacf0['offset']===_0xd175('0xe')&&typeof _0x1cacf0[_0xd175('0xf')]==='undefined';var _0x4bc7b3=_0x213ccb[_0xd175('0x10')];var _0x2cccbf=_0x1a0369?0x0:_0x1cacf0[_0xd175('0x11')];var _0x3b8bfa=_0x1a0369?_0x213ccb[_0xd175('0x10')]:_0x1cacf0[_0xd175('0x11')]+_0x1cacf0[_0xd175('0xf')];var _0x8d9f84;if(_0x3b8bfa>=_0x4bc7b3){_0x3b8bfa=_0x4bc7b3;_0x8d9f84=0xc8;}else{_0x8d9f84=0xce;}_0x1a2bc2[_0xd175('0xc')](_0x8d9f84);return _0x1a2bc2[_0xd175('0x12')]('Content-Range',_0x2cccbf+'-'+_0x3b8bfa+'/'+_0x4bc7b3)['json'](_0x213ccb);}return null;};}function saveUpdates(_0x28d845){return function(_0x2003cf){if(_0x2003cf){return _0x2003cf[_0xd175('0x13')](_0x28d845)[_0xd175('0x14')](function(_0x1395d8){return _0x1395d8;});}return null;};}function removeEntity(_0x3f19f0){return function(_0x2cde9e){if(_0x2cde9e){return _0x2cde9e['destroy']()[_0xd175('0x14')](function(){var _0xb013d9=_0x2cde9e[_0xd175('0x15')]({'plain':!![]});var _0x112318=_0xd175('0x16');return db[_0xd175('0x17')][_0xd175('0x18')]({'where':{'type':_0x112318,'resourceId':_0xb013d9['id']}})[_0xd175('0x14')](function(){return _0x2cde9e;});})[_0xd175('0x14')](function(){var _0x63e26c=new Redis(config['redis']);_0x63e26c[_0xd175('0x19')](_0xd175('0x1a'),JSON[_0xd175('0x1b')]({'id':_0x2cde9e['id'],'deleted':!![]}));})['then'](function(){_0x3f19f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x496a52){return function(_0x4cbcba){if(!_0x4cbcba){_0x496a52[_0xd175('0x1c')](0x194);}return _0x4cbcba;};}function handleError(_0x307a15,_0x11fcae){_0x11fcae=_0x11fcae||0x1f4;return function(_0x14a76d){logger[_0xd175('0x1d')](_0x14a76d[_0xd175('0x1e')]);if(_0x14a76d[_0xd175('0x1f')]){delete _0x14a76d[_0xd175('0x1f')];}_0x307a15[_0xd175('0xc')](_0x11fcae)['send'](_0x14a76d);};}exports[_0xd175('0x20')]=function(_0x9efa56,_0x167bf1){var _0x35ce37={},_0x36cb50={},_0x39a286={'count':0x0,'rows':[]};var _0x5a5df5=_[_0xd175('0x21')](db['SquareProject']['rawAttributes'],function(_0x3b4443){return{'name':_0x3b4443[_0xd175('0x22')],'type':_0x3b4443['type'][_0xd175('0x23')]};});_0x36cb50[_0xd175('0x24')]=_[_0xd175('0x21')](_0x5a5df5,_0xd175('0x1f'));_0x36cb50[_0xd175('0x25')]=_['keys'](_0x9efa56[_0xd175('0x25')]);_0x36cb50[_0xd175('0x26')]=_[_0xd175('0x27')](_0x36cb50[_0xd175('0x24')],_0x36cb50[_0xd175('0x25')]);_0x35ce37[_0xd175('0x28')]=_[_0xd175('0x27')](_0x36cb50['model'],qs[_0xd175('0x29')](_0x9efa56[_0xd175('0x25')][_0xd175('0x29')]));_0x35ce37[_0xd175('0x28')]=_0x35ce37[_0xd175('0x28')][_0xd175('0x2a')]?_0x35ce37[_0xd175('0x28')]:_0x36cb50['model'];if(!_0x9efa56[_0xd175('0x25')][_0xd175('0x2b')](_0xd175('0x2c'))){_0x35ce37[_0xd175('0xf')]=qs[_0xd175('0xf')](_0x9efa56[_0xd175('0x25')][_0xd175('0xf')]);_0x35ce37[_0xd175('0x11')]=qs[_0xd175('0x11')](_0x9efa56[_0xd175('0x25')][_0xd175('0x11')]);}_0x35ce37[_0xd175('0x2d')]=qs[_0xd175('0x2e')](_0x9efa56[_0xd175('0x25')][_0xd175('0x2e')]);_0x35ce37[_0xd175('0x2f')]=qs['filters'](_[_0xd175('0x30')](_0x9efa56[_0xd175('0x25')],_0x36cb50[_0xd175('0x26')]),_0x5a5df5);if(_0x9efa56[_0xd175('0x25')][_0xd175('0x31')]){_0x35ce37[_0xd175('0x2f')]=_[_0xd175('0x32')](_0x35ce37[_0xd175('0x2f')],{'$or':_['map'](_0x5a5df5,function(_0x979d9f){if(_0x979d9f[_0xd175('0x33')]!=='VIRTUAL'){var _0x43efbf={};_0x43efbf[_0x979d9f[_0xd175('0x1f')]]={'$like':'%'+_0x9efa56[_0xd175('0x25')][_0xd175('0x31')]+'%'};return _0x43efbf;}})});}_0x35ce37=_[_0xd175('0x32')]({},_0x35ce37,_0x9efa56['options']);var _0x2d8b79={'where':_0x35ce37[_0xd175('0x2f')]};return db['SquareProject']['count'](_0x2d8b79)[_0xd175('0x14')](function(_0x5949b8){_0x39a286[_0xd175('0x10')]=_0x5949b8;if(_0x9efa56[_0xd175('0x25')][_0xd175('0x34')]){_0x35ce37['include']=[{'all':!![]}];}return db[_0xd175('0x35')][_0xd175('0x36')](_0x35ce37);})[_0xd175('0x14')](function(_0x2f174){_0x39a286[_0xd175('0x37')]=_0x2f174;return _0x39a286;})[_0xd175('0x14')](respondWithFilteredResult(_0x167bf1,_0x35ce37))[_0xd175('0x38')](handleError(_0x167bf1,null));};exports[_0xd175('0x39')]=function(_0x344fdb,_0xe306b9){var _0x5aa76e={'raw':![],'where':{'id':_0x344fdb[_0xd175('0x3a')]['id']}},_0x1f8a19={};_0x1f8a19[_0xd175('0x24')]=_[_0xd175('0x3b')](db[_0xd175('0x35')][_0xd175('0x3c')]);_0x1f8a19[_0xd175('0x25')]=_[_0xd175('0x3b')](_0x344fdb['query']);_0x1f8a19[_0xd175('0x26')]=_[_0xd175('0x27')](_0x1f8a19[_0xd175('0x24')],_0x1f8a19[_0xd175('0x25')]);_0x5aa76e[_0xd175('0x28')]=_[_0xd175('0x27')](_0x1f8a19['model'],qs[_0xd175('0x29')](_0x344fdb[_0xd175('0x25')]['fields']));_0x5aa76e[_0xd175('0x28')]=_0x5aa76e[_0xd175('0x28')][_0xd175('0x2a')]?_0x5aa76e[_0xd175('0x28')]:_0x1f8a19[_0xd175('0x24')];if(_0x344fdb[_0xd175('0x25')][_0xd175('0x34')]){_0x5aa76e[_0xd175('0x3d')]=[{'all':!![]}];}_0x5aa76e=_['merge']({},_0x5aa76e,_0x344fdb[_0xd175('0x3e')]);return db[_0xd175('0x35')][_0xd175('0x3f')](_0x5aa76e)[_0xd175('0x14')](handleEntityNotFound(_0xe306b9,null))[_0xd175('0x14')](respondWithResult(_0xe306b9,null))['catch'](handleError(_0xe306b9,null));};exports['create']=function(_0x3ed70d,_0x3d25b3){return db[_0xd175('0x35')][_0xd175('0x40')](_0x3ed70d[_0xd175('0x41')],{})['then'](function(_0x181069){var _0x180f7b=_0x3ed70d[_0xd175('0x42')]['get']({'plain':!![]});if(!_0x180f7b)throw new Error(_0xd175('0x43'));if(_0x180f7b['role']==='user'){var _0x5d397d=_0x181069['get']({'plain':!![]});var _0x490aaf='SquareProjects';return db[_0xd175('0x44')][_0xd175('0x3f')]({'where':{'name':_0x490aaf,'userProfileId':_0x180f7b['userProfileId']},'raw':!![]})[_0xd175('0x14')](function(_0x247459){if(_0x247459&&_0x247459[_0xd175('0x45')]===0x0){return db[_0xd175('0x17')][_0xd175('0x40')]({'name':_0x5d397d['name'],'resourceId':_0x5d397d['id'],'type':_0x247459[_0xd175('0x1f')],'sectionId':_0x247459['id']},{})[_0xd175('0x14')](function(){return _0x181069;});}else{return _0x181069;}})[_0xd175('0x38')](function(_0x156052){logger[_0xd175('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x156052);throw _0x156052;});}return _0x181069;})[_0xd175('0x14')](respondWithResult(_0x3d25b3,0xc9))[_0xd175('0x38')](handleError(_0x3d25b3,null));};exports[_0xd175('0x13')]=function(_0xdb2c0b,_0xb38ca3){if(_0xdb2c0b[_0xd175('0x41')]['id']){delete _0xdb2c0b[_0xd175('0x41')]['id'];}return db[_0xd175('0x35')][_0xd175('0x3f')]({'where':{'id':_0xdb2c0b[_0xd175('0x3a')]['id']}})[_0xd175('0x14')](handleEntityNotFound(_0xb38ca3,null))[_0xd175('0x14')](saveUpdates(_0xdb2c0b[_0xd175('0x41')],null))[_0xd175('0x14')](function(_0x36f230){if(!_0x36f230)return;var _0x5b6c4a=_0x36f230['get']({'plain':!![]});return _0x5b6c4a;})[_0xd175('0x14')](function(_0x5c272f){var _0x158c9a=new Redis(config[_0xd175('0x6')]);_0x158c9a[_0xd175('0x19')]('agi',JSON[_0xd175('0x1b')](_['pick'](_0x5c272f,['id',_0xd175('0x1f'),_0xd175('0x46')])));return _0x5c272f;})[_0xd175('0x14')](respondWithResult(_0xb38ca3,null))[_0xd175('0x38')](handleError(_0xb38ca3,null));};exports['destroy']=function(_0x44154d,_0x44907f){return db[_0xd175('0x35')][_0xd175('0x3f')]({'where':{'id':_0x44154d[_0xd175('0x3a')]['id']}})[_0xd175('0x14')](handleEntityNotFound(_0x44907f,null))[_0xd175('0x14')](removeEntity(_0x44907f,null))[_0xd175('0x38')](handleError(_0x44907f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0607500..7df6c81 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 _0x235a=['remove','emit','exports','events','SquareProject','setMaxListeners','save','update'];(function(_0x48d3fe,_0x18c913){var _0x5f4219=function(_0x48e50e){while(--_0x48e50e){_0x48d3fe['push'](_0x48d3fe['shift']());}};_0x5f4219(++_0x18c913);}(_0x235a,0x193));var _0xa235=function(_0x5ed226,_0x1e1f0a){_0x5ed226=_0x5ed226-0x0;var _0x2e7859=_0x235a[_0x5ed226];return _0x2e7859;};'use strict';var EventEmitter=require(_0xa235('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa235('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa235('0x2')](0x0);var events={'afterCreate':_0xa235('0x3'),'afterUpdate':_0xa235('0x4'),'afterDestroy':_0xa235('0x5')};function emitEvent(_0x221aed){return function(_0x142a43,_0x17311d,_0x3bf1d5){SquareProjectEvents[_0xa235('0x6')](_0x221aed+':'+_0x142a43['id'],_0x142a43);SquareProjectEvents[_0xa235('0x6')](_0x221aed,_0x142a43);_0x3bf1d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa235('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x2108=['hasOwnProperty','setMaxListeners','update','emit'];(function(_0x57c248,_0x10dc87){var _0x2ce826=function(_0x12f644){while(--_0x12f644){_0x57c248['push'](_0x57c248['shift']());}};_0x2ce826(++_0x10dc87);}(_0x2108,0x17d));var _0x8210=function(_0x2a7240,_0x2e05b3){_0x2a7240=_0x2a7240-0x0;var _0x549f60=_0x2108[_0x2a7240];return _0x549f60;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8210('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8210('0x1'),'afterDestroy':'remove'};function emitEvent(_0x3c381d){return function(_0x43dd3a,_0xab8a93,_0xfe72cd){SquareProjectEvents[_0x8210('0x2')](_0x3c381d+':'+_0x43dd3a['id'],_0x43dd3a);SquareProjectEvents[_0x8210('0x2')](_0x3c381d,_0x43dd3a);_0xfe72cd(null);};}for(var e in events){if(events[_0x8210('0x3')](e)){var event=events[e];SquareProject['hook'](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 9a8bafa..fd0db86 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 _0x71de=['exports','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x176a2e,_0x208408){var _0x57228a=function(_0x5961d3){while(--_0x5961d3){_0x176a2e['push'](_0x176a2e['shift']());}};_0x57228a(++_0x208408);}(_0x71de,0xb6));var _0xe71d=function(_0x3fa819,_0x38bc8e){_0x3fa819=_0x3fa819-0x0;var _0x403f35=_0x71de[_0x3fa819];return _0x403f35;};'use strict';var _=require(_0xe71d('0x0'));var util=require(_0xe71d('0x1'));var logger=require(_0xe71d('0x2'))(_0xe71d('0x3'));var moment=require(_0xe71d('0x4'));var BPromise=require(_0xe71d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe71d('0x6'));var rimraf=require(_0xe71d('0x7'));var config=require(_0xe71d('0x8'));var attributes=require(_0xe71d('0x9'));module[_0xe71d('0xa')]=function(_0x2bfc7c,_0x4f1a09){return _0x2bfc7c['define']('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x489b27,_0xb8d7ac,_0x59a761){if(_0x489b27[_0xe71d('0xb')](_0xe71d('0xc'))){_0x489b27[_0xe71d('0xd')]=moment()['format'](_0xe71d('0xe'));}if(_0x489b27[_0xe71d('0xb')]('production')){_0x489b27[_0xe71d('0xf')]=moment()['format'](_0xe71d('0xe'));}_0x59a761(null,_0x489b27);}}});}; \ No newline at end of file +var _0x4d36=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x4a79b8,_0x23163f){var _0xc03275=function(_0x1edfe4){while(--_0x1edfe4){_0x4a79b8['push'](_0x4a79b8['shift']());}};_0xc03275(++_0x23163f);}(_0x4d36,0x130));var _0x64d3=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x4d36[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x64d3('0x0'));var util=require(_0x64d3('0x1'));var logger=require('../../config/logger')(_0x64d3('0x2'));var moment=require(_0x64d3('0x3'));var BPromise=require(_0x64d3('0x4'));var rp=require(_0x64d3('0x5'));var fs=require('fs');var path=require(_0x64d3('0x6'));var rimraf=require(_0x64d3('0x7'));var config=require(_0x64d3('0x8'));var attributes=require(_0x64d3('0x9'));module['exports']=function(_0x31c380,_0x230b0b){return _0x31c380[_0x64d3('0xa')](_0x64d3('0xb'),attributes,{'tableName':_0x64d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1977b6,_0xa2cac2,_0x3e80b9){if(_0x1977b6[_0x64d3('0xd')](_0x64d3('0xe'))){_0x1977b6[_0x64d3('0xf')]=moment()[_0x64d3('0x10')](_0x64d3('0x11'));}if(_0x1977b6[_0x64d3('0xd')](_0x64d3('0x12'))){_0x1977b6[_0x64d3('0x13')]=moment()[_0x64d3('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e80b9(null,_0x1977b6);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 39096f9..4cf9905 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 _0x372a=['./squareProject.socket','register','GetSquareProjects','SquareProject','raw','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x372a,0xfd));var _0xa372=function(_0x4f9f0c,_0x499a73){_0x4f9f0c=_0x4f9f0c-0x0;var _0x366119=_0x372a[_0x4f9f0c];return _0x366119;};'use strict';var _=require(_0xa372('0x0'));var Redis=require(_0xa372('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xa372('0x2'))('rpc');var config=require(_0xa372('0x3'));config[_0xa372('0x4')]=_[_0xa372('0x5')](config[_0xa372('0x4')],{'host':_0xa372('0x6'),'port':0x18eb});var socket=require(_0xa372('0x7'))(new Redis(config[_0xa372('0x4')]));require(_0xa372('0x8'))[_0xa372('0x9')](socket);exports[_0xa372('0xa')]=function(_0x2a674e){var _0xf1dbae=this;return new Promise(function(_0x311116,_0x1d29cf){return db[_0xa372('0xb')]['findAll']({'raw':_0x2a674e['options']?_0x2a674e['options'][_0xa372('0xc')]===undefined?!![]:![]:!![],'where':_0x2a674e['options']?_0x2a674e[_0xa372('0xd')][_0xa372('0xe')]||null:null,'attributes':_0x2a674e[_0xa372('0xd')]?_0x2a674e['options'][_0xa372('0xf')]||null:null,'limit':_0x2a674e[_0xa372('0xd')]?_0x2a674e['options'][_0xa372('0x10')]||null:null,'include':_0x2a674e['options']?_0x2a674e[_0xa372('0xd')][_0xa372('0x11')]?_[_0xa372('0x12')](_0x2a674e[_0xa372('0xd')]['include'],function(_0x571239){return{'model':db[_0x571239[_0xa372('0x13')]],'as':_0x571239['as'],'attributes':_0x571239['attributes'],'include':_0x571239[_0xa372('0x11')]?_['map'](_0x571239[_0xa372('0x11')],function(_0x3c6deb){return{'model':db[_0x3c6deb[_0xa372('0x13')]],'as':_0x3c6deb['as'],'attributes':_0x3c6deb[_0xa372('0xf')],'include':_0x3c6deb[_0xa372('0x11')]?_[_0xa372('0x12')](_0x3c6deb[_0xa372('0x11')],function(_0x591518){return{'model':db[_0x591518[_0xa372('0x13')]],'as':_0x591518['as'],'attributes':_0x591518[_0xa372('0xf')]};}):[]};}):[]};}):[]:[]})[_0xa372('0x14')](function(_0x20a33e){logger[_0xa372('0x15')]('GetSquareProjects',_0x2a674e);logger[_0xa372('0x16')](_0xa372('0xa'),_0x2a674e,JSON[_0xa372('0x17')](_0x20a33e));_0x311116(_0x20a33e);})[_0xa372('0x18')](function(_0x393cc3){logger['error']('GetSquareProjects',_0x393cc3[_0xa372('0x19')],_0x2a674e);_0x1d29cf(_0xf1dbae[_0xa372('0x1a')](0x1f4,_0x393cc3[_0xa372('0x19')]));});});};exports[_0xa372('0x1b')]=function(_0x57c8b9){var _0x45e480=this;return new Promise(function(_0x37c1c9,_0x497f35){return db[_0xa372('0xb')][_0xa372('0x1c')]({'raw':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9[_0xa372('0xd')][_0xa372('0xc')]===undefined?!![]:![]:!![],'where':_0x57c8b9['options']?_0x57c8b9[_0xa372('0xd')][_0xa372('0xe')]||null:null,'attributes':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9[_0xa372('0xd')][_0xa372('0xf')]||null:null,'include':_0x57c8b9[_0xa372('0xd')]?_0x57c8b9['options']['include']?_[_0xa372('0x12')](_0x57c8b9[_0xa372('0xd')][_0xa372('0x11')],function(_0x1be1f8){return{'model':db[_0x1be1f8[_0xa372('0x13')]],'as':_0x1be1f8['as'],'attributes':_0x1be1f8[_0xa372('0xf')],'include':_0x1be1f8[_0xa372('0x11')]?_['map'](_0x1be1f8[_0xa372('0x11')],function(_0x1f7831){return{'model':db[_0x1f7831[_0xa372('0x13')]],'as':_0x1f7831['as'],'attributes':_0x1f7831[_0xa372('0xf')],'include':_0x1f7831['include']?_[_0xa372('0x12')](_0x1f7831['include'],function(_0x18d5c5){return{'model':db[_0x18d5c5[_0xa372('0x13')]],'as':_0x18d5c5['as'],'attributes':_0x18d5c5[_0xa372('0xf')]};}):[]};}):[]};}):[]:[]})[_0xa372('0x14')](function(_0x37732c){logger[_0xa372('0x15')]('ShowSquareProject',_0x57c8b9);logger[_0xa372('0x16')](_0xa372('0x1b'),_0x57c8b9,JSON[_0xa372('0x17')](_0x37732c));_0x37c1c9(_0x37732c);})['catch'](function(_0x537061){logger[_0xa372('0x1a')](_0xa372('0x1b'),_0x537061[_0xa372('0x19')],_0x57c8b9);_0x497f35(_0x45e480[_0xa372('0x1a')](0x1f4,_0x537061['message']));});});}; \ No newline at end of file +var _0xabc6=['defaults','localhost','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','ShowSquareProject','SquareProject','find','where','error','../../mysqldb','../../config/logger','../../config/environment','redis'];(function(_0xda95eb,_0x362c18){var _0x28c8d9=function(_0x2fe5a0){while(--_0x2fe5a0){_0xda95eb['push'](_0xda95eb['shift']());}};_0x28c8d9(++_0x362c18);}(_0xabc6,0x1bc));var _0x6abc=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0xabc6[_0x2cc594];return _0x4abff7;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x6abc('0x0'))['db'];var logger=require(_0x6abc('0x1'))('rpc');var config=require(_0x6abc('0x2'));config[_0x6abc('0x3')]=_[_0x6abc('0x4')](config['redis'],{'host':_0x6abc('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6abc('0x3')]));require(_0x6abc('0x6'))[_0x6abc('0x7')](socket);exports[_0x6abc('0x8')]=function(_0xd4953e){var _0x2bc5a2=this;return new Promise(function(_0x5d31ba,_0x45c829){return db['SquareProject'][_0x6abc('0x9')]({'raw':_0xd4953e[_0x6abc('0xa')]?_0xd4953e[_0x6abc('0xa')][_0x6abc('0xb')]===undefined?!![]:![]:!![],'where':_0xd4953e[_0x6abc('0xa')]?_0xd4953e[_0x6abc('0xa')]['where']||null:null,'attributes':_0xd4953e[_0x6abc('0xa')]?_0xd4953e[_0x6abc('0xa')][_0x6abc('0xc')]||null:null,'limit':_0xd4953e[_0x6abc('0xa')]?_0xd4953e['options'][_0x6abc('0xd')]||null:null,'include':_0xd4953e[_0x6abc('0xa')]?_0xd4953e[_0x6abc('0xa')][_0x6abc('0xe')]?_[_0x6abc('0xf')](_0xd4953e[_0x6abc('0xa')]['include'],function(_0x57f3c7){return{'model':db[_0x57f3c7['model']],'as':_0x57f3c7['as'],'attributes':_0x57f3c7['attributes'],'include':_0x57f3c7[_0x6abc('0xe')]?_['map'](_0x57f3c7[_0x6abc('0xe')],function(_0x597a34){return{'model':db[_0x597a34[_0x6abc('0x10')]],'as':_0x597a34['as'],'attributes':_0x597a34['attributes'],'include':_0x597a34[_0x6abc('0xe')]?_['map'](_0x597a34[_0x6abc('0xe')],function(_0x33d253){return{'model':db[_0x33d253['model']],'as':_0x33d253['as'],'attributes':_0x33d253[_0x6abc('0xc')]};}):[]};}):[]};}):[]:[]})[_0x6abc('0x11')](function(_0x226ef3){logger[_0x6abc('0x12')](_0x6abc('0x8'),_0xd4953e);logger[_0x6abc('0x13')](_0x6abc('0x8'),_0xd4953e,JSON[_0x6abc('0x14')](_0x226ef3));_0x5d31ba(_0x226ef3);})[_0x6abc('0x15')](function(_0x7da602){logger['error'](_0x6abc('0x8'),_0x7da602['message'],_0xd4953e);_0x45c829(_0x2bc5a2['error'](0x1f4,_0x7da602[_0x6abc('0x16')]));});});};exports[_0x6abc('0x17')]=function(_0x3bce19){var _0x262df0=this;return new Promise(function(_0x4c11cb,_0x47307f){return db[_0x6abc('0x18')][_0x6abc('0x19')]({'raw':_0x3bce19['options']?_0x3bce19[_0x6abc('0xa')][_0x6abc('0xb')]===undefined?!![]:![]:!![],'where':_0x3bce19[_0x6abc('0xa')]?_0x3bce19[_0x6abc('0xa')][_0x6abc('0x1a')]||null:null,'attributes':_0x3bce19[_0x6abc('0xa')]?_0x3bce19[_0x6abc('0xa')][_0x6abc('0xc')]||null:null,'include':_0x3bce19[_0x6abc('0xa')]?_0x3bce19[_0x6abc('0xa')][_0x6abc('0xe')]?_[_0x6abc('0xf')](_0x3bce19['options'][_0x6abc('0xe')],function(_0x2acb17){return{'model':db[_0x2acb17[_0x6abc('0x10')]],'as':_0x2acb17['as'],'attributes':_0x2acb17[_0x6abc('0xc')],'include':_0x2acb17[_0x6abc('0xe')]?_[_0x6abc('0xf')](_0x2acb17[_0x6abc('0xe')],function(_0x1453d0){return{'model':db[_0x1453d0[_0x6abc('0x10')]],'as':_0x1453d0['as'],'attributes':_0x1453d0[_0x6abc('0xc')],'include':_0x1453d0[_0x6abc('0xe')]?_['map'](_0x1453d0[_0x6abc('0xe')],function(_0xb345b4){return{'model':db[_0xb345b4[_0x6abc('0x10')]],'as':_0xb345b4['as'],'attributes':_0xb345b4[_0x6abc('0xc')]};}):[]};}):[]};}):[]:[]})[_0x6abc('0x11')](function(_0x46f828){logger[_0x6abc('0x12')]('ShowSquareProject',_0x3bce19);logger[_0x6abc('0x13')](_0x6abc('0x17'),_0x3bce19,JSON['stringify'](_0x46f828));_0x4c11cb(_0x46f828);})['catch'](function(_0x50425a){logger[_0x6abc('0x1b')](_0x6abc('0x17'),_0x50425a[_0x6abc('0x16')],_0x3bce19);_0x47307f(_0x262df0[_0x6abc('0x1b')](0x1f4,_0x50425a[_0x6abc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 361f457..950ff5e 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 _0x000d=['save','remove','update','emit','length','./squareProject.events'];(function(_0x62dedc,_0xc903a7){var _0x4114ac=function(_0x515a34){while(--_0x515a34){_0x62dedc['push'](_0x62dedc['shift']());}};_0x4114ac(++_0xc903a7);}(_0x000d,0x15b));var _0xd000=function(_0x397aa5,_0x436a3c){_0x397aa5=_0x397aa5-0x0;var _0x194c61=_0x000d[_0x397aa5];return _0x194c61;};'use strict';var SquareProjectEvents=require(_0xd000('0x0'));var events=[_0xd000('0x1'),_0xd000('0x2'),_0xd000('0x3')];function createListener(_0x1b3087,_0x1d24a6){return function(_0x6a1bb7){_0x1d24a6[_0xd000('0x4')](_0x1b3087,_0x6a1bb7);};}function removeListener(_0x216952,_0x498cc5){return function(){SquareProjectEvents['removeListener'](_0x216952,_0x498cc5);};}exports['register']=function(_0x3daa8f){for(var _0x142c68=0x0,_0x5874a7=events[_0xd000('0x5')];_0x142c68<_0x5874a7;_0x142c68++){var _0x3f7782=events[_0x142c68];var _0x581c3c=createListener('squareProject:'+_0x3f7782,_0x3daa8f);SquareProjectEvents['on'](_0x3f7782,_0x581c3c);}}; \ No newline at end of file +var _0x900b=['emit','removeListener','register','length','squareProject:','./squareProject.events','remove','update'];(function(_0x4860f6,_0x2c6830){var _0x5735ab=function(_0x5146a0){while(--_0x5146a0){_0x4860f6['push'](_0x4860f6['shift']());}};_0x5735ab(++_0x2c6830);}(_0x900b,0x9d));var _0xb900=function(_0x4af517,_0x5e6af1){_0x4af517=_0x4af517-0x0;var _0x134147=_0x900b[_0x4af517];return _0x134147;};'use strict';var SquareProjectEvents=require(_0xb900('0x0'));var events=['save',_0xb900('0x1'),_0xb900('0x2')];function createListener(_0x5d193e,_0x370924){return function(_0x11bcb6){_0x370924[_0xb900('0x3')](_0x5d193e,_0x11bcb6);};}function removeListener(_0x225a13,_0x37c4be){return function(){SquareProjectEvents[_0xb900('0x4')](_0x225a13,_0x37c4be);};}exports[_0xb900('0x5')]=function(_0x1d152b){for(var _0x1edf14=0x0,_0x449d5c=events[_0xb900('0x6')];_0x1edf14<_0x449d5c;_0x1edf14++){var _0x3a0843=events[_0x1edf14];var _0x13ec62=createListener(_0xb900('0x7')+_0x3a0843,_0x1d152b);SquareProjectEvents['on'](_0x3a0843,_0x13ec62);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 72c81ff..75865f3 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x52d943,_0x28eae7){var _0x40c30c=function(_0x1de5c1){while(--_0x1de5c1){_0x52d943['push'](_0x52d943['shift']());}};_0x40c30c(++_0x28eae7);}(_0x5fab,0x177));var _0xb5fa=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0x5fab[_0x7ea1fb];return _0x478241;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x13e796,_0x385f78){var _0x3f0824=function(_0x2546ad){while(--_0x2546ad){_0x13e796['push'](_0x13e796['shift']());}};_0x3f0824(++_0x385f78);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 768b7aa..c2c6e2b 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 _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x424b05,_0x526b5b){var _0x4c65cd=function(_0x59e1f3){while(--_0x59e1f3){_0x424b05['push'](_0x424b05['shift']());}};_0x4c65cd(++_0x526b5b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x42075a,_0x1c7df3){_0x42075a=_0x42075a-0x0;var _0x5614d6=_0x9c5a[_0x42075a];return _0x5614d6;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file +var _0xa630=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x59ad8f,_0x1b9612){_0x59ad8f=_0x59ad8f-0x0;var _0x35d585=_0xa630[_0x59ad8f];return _0x35d585;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0a63('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'dnid':{'type':Sequelize[_0x0a63('0x2')]},'projectName':{'type':Sequelize[_0x0a63('0x2')]},'saveName':{'type':Sequelize[_0x0a63('0x2')]},'filename':{'type':Sequelize[_0x0a63('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a63('0x3')],'get':function(){var _0x3d5f0b='';var _0xc2dcd7=this[_0x0a63('0x4')](_0x0a63('0x5'));if(_0xc2dcd7){_0x3d5f0b=_0xc2dcd7[_0x0a63('0x6')](_0xc2dcd7['lastIndexOf']('.'));}return _0x3d5f0b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3cd49c4..ceaeeac 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 _0xcb2a=['error','stack','name','send','map','SquareRecording','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','then','destroy'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0xcb2a,0xfc));var _0xacb2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcb2a[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xacb2('0x0'));var rimraf=require(_0xacb2('0x1'));var zipdir=require(_0xacb2('0x2'));var jsonpatch=require(_0xacb2('0x3'));var rp=require(_0xacb2('0x4'));var moment=require(_0xacb2('0x5'));var BPromise=require(_0xacb2('0x6'));var Mustache=require(_0xacb2('0x7'));var util=require('util');var path=require(_0xacb2('0x8'));var sox=require(_0xacb2('0x9'));var csv=require(_0xacb2('0xa'));var ejs=require(_0xacb2('0xb'));var fs=require('fs');var fs_extra=require(_0xacb2('0xc'));var _=require(_0xacb2('0xd'));var squel=require(_0xacb2('0xe'));var crypto=require(_0xacb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xacb2('0x10'));var toCsv=require(_0xacb2('0xa'));var querystring=require(_0xacb2('0x11'));var Papa=require(_0xacb2('0x12'));var Redis=require(_0xacb2('0x13'));var authService=require(_0xacb2('0x14'));var qs=require(_0xacb2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacb2('0x16'));var logger=require(_0xacb2('0x17'))(_0xacb2('0x18'));var utils=require(_0xacb2('0x19'));var config=require(_0xacb2('0x1a'));var licenseUtil=require(_0xacb2('0x1b'));var db=require(_0xacb2('0x1c'))['db'];function respondWithStatusCode(_0x531695,_0x3abe3e){_0x3abe3e=_0x3abe3e||0xcc;return function(_0x24b9c9){if(_0x24b9c9){return _0x531695[_0xacb2('0x1d')](_0x3abe3e);}return _0x531695[_0xacb2('0x1e')](_0x3abe3e)['end']();};}function respondWithResult(_0x181747,_0xa7e973){_0xa7e973=_0xa7e973||0xc8;return function(_0x230507){if(_0x230507){return _0x181747[_0xacb2('0x1e')](_0xa7e973)[_0xacb2('0x1f')](_0x230507);}};}function respondWithFilteredResult(_0x5241e5,_0x386fb7){return function(_0x5c6179){if(_0x5c6179){var _0x1df92d=typeof _0x386fb7[_0xacb2('0x20')]===_0xacb2('0x21')&&typeof _0x386fb7['limit']===_0xacb2('0x21');var _0x18ee31=_0x5c6179[_0xacb2('0x22')];var _0x3772ce=_0x1df92d?0x0:_0x386fb7['offset'];var _0x945dc1=_0x1df92d?_0x5c6179[_0xacb2('0x22')]:_0x386fb7[_0xacb2('0x20')]+_0x386fb7[_0xacb2('0x23')];var _0x561e91;if(_0x945dc1>=_0x18ee31){_0x945dc1=_0x18ee31;_0x561e91=0xc8;}else{_0x561e91=0xce;}_0x5241e5[_0xacb2('0x1e')](_0x561e91);return _0x5241e5['set'](_0xacb2('0x24'),_0x3772ce+'-'+_0x945dc1+'/'+_0x18ee31)['json'](_0x5c6179);}return null;};}function patchUpdates(_0x501fd9){return function(_0x573e79){try{jsonpatch['apply'](_0x573e79,_0x501fd9,!![]);}catch(_0x5c9f6b){return BPromise['reject'](_0x5c9f6b);}return _0x573e79['save']();};}function saveUpdates(_0x413c6a,_0x26341c){return function(_0x3fa799){if(_0x3fa799){return _0x3fa799['update'](_0x413c6a)[_0xacb2('0x25')](function(_0x1ee6c7){return _0x1ee6c7;});}return null;};}function removeEntity(_0x5bfa34,_0x3abe9c){return function(_0x9a8f09){if(_0x9a8f09){return _0x9a8f09[_0xacb2('0x26')]()[_0xacb2('0x25')](function(){_0x5bfa34[_0xacb2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d507a,_0x5d867f){return function(_0x426ebf){if(!_0x426ebf){_0x1d507a[_0xacb2('0x1d')](0x194);}return _0x426ebf;};}function handleError(_0x3a3de9,_0x51461d){_0x51461d=_0x51461d||0x1f4;return function(_0x535747){logger[_0xacb2('0x27')](_0x535747[_0xacb2('0x28')]);if(_0x535747[_0xacb2('0x29')]){delete _0x535747['name'];}_0x3a3de9[_0xacb2('0x1e')](_0x51461d)[_0xacb2('0x2a')](_0x535747);};}exports['index']=function(_0x518fe0,_0x20d879){var _0x42b185={},_0x1f385f={},_0x1241b5={'count':0x0,'rows':[]};var _0x55a47a=_[_0xacb2('0x2b')](db[_0xacb2('0x2c')][_0xacb2('0x2d')],function(_0x1104c6){return{'name':_0x1104c6['fieldName'],'type':_0x1104c6[_0xacb2('0x2e')][_0xacb2('0x2f')]};});_0x1f385f['model']=_[_0xacb2('0x2b')](_0x55a47a,_0xacb2('0x29'));_0x1f385f['query']=_[_0xacb2('0x30')](_0x518fe0[_0xacb2('0x31')]);_0x1f385f[_0xacb2('0x32')]=_[_0xacb2('0x33')](_0x1f385f[_0xacb2('0x34')],_0x1f385f[_0xacb2('0x31')]);_0x42b185[_0xacb2('0x35')]=_[_0xacb2('0x33')](_0x1f385f[_0xacb2('0x34')],qs[_0xacb2('0x36')](_0x518fe0[_0xacb2('0x31')][_0xacb2('0x36')]));_0x42b185['attributes']=_0x42b185[_0xacb2('0x35')][_0xacb2('0x37')]?_0x42b185['attributes']:_0x1f385f[_0xacb2('0x34')];if(!_0x518fe0[_0xacb2('0x31')][_0xacb2('0x38')](_0xacb2('0x39'))){_0x42b185[_0xacb2('0x23')]=qs[_0xacb2('0x23')](_0x518fe0['query']['limit']);_0x42b185['offset']=qs[_0xacb2('0x20')](_0x518fe0[_0xacb2('0x31')]['offset']);}_0x42b185['order']=qs[_0xacb2('0x3a')](_0x518fe0[_0xacb2('0x31')]['sort']);_0x42b185[_0xacb2('0x3b')]=qs[_0xacb2('0x32')](_[_0xacb2('0x3c')](_0x518fe0[_0xacb2('0x31')],_0x1f385f['filters']),_0x55a47a);if(_0x518fe0[_0xacb2('0x31')]['filter']){_0x42b185[_0xacb2('0x3b')]=_[_0xacb2('0x3d')](_0x42b185[_0xacb2('0x3b')],{'$or':_[_0xacb2('0x2b')](_0x55a47a,function(_0x463610){if(_0x463610['type']!=='VIRTUAL'){var _0x557446={};_0x557446[_0x463610[_0xacb2('0x29')]]={'$like':'%'+_0x518fe0[_0xacb2('0x31')][_0xacb2('0x3e')]+'%'};return _0x557446;}})});}_0x42b185=_[_0xacb2('0x3d')]({},_0x42b185,_0x518fe0[_0xacb2('0x3f')]);var _0x4b9b15={'where':_0x42b185[_0xacb2('0x3b')]};return db[_0xacb2('0x2c')]['count'](_0x4b9b15)[_0xacb2('0x25')](function(_0x1f322d){_0x1241b5[_0xacb2('0x22')]=_0x1f322d;if(_0x518fe0['query'][_0xacb2('0x40')]){_0x42b185[_0xacb2('0x41')]=[{'all':!![]}];}return db[_0xacb2('0x2c')][_0xacb2('0x42')](_0x42b185);})[_0xacb2('0x25')](function(_0x118762){_0x1241b5[_0xacb2('0x43')]=_0x118762;return _0x1241b5;})[_0xacb2('0x25')](respondWithFilteredResult(_0x20d879,_0x42b185))[_0xacb2('0x44')](handleError(_0x20d879,null));};exports[_0xacb2('0x45')]=function(_0x536999,_0x5ad8bd){var _0x5de46e={'raw':!![],'where':{'id':_0x536999[_0xacb2('0x46')]['id']}},_0x2611d6={};_0x2611d6[_0xacb2('0x34')]=_['keys'](db[_0xacb2('0x2c')][_0xacb2('0x2d')]);_0x2611d6[_0xacb2('0x31')]=_['keys'](_0x536999['query']);_0x2611d6[_0xacb2('0x32')]=_[_0xacb2('0x33')](_0x2611d6['model'],_0x2611d6[_0xacb2('0x31')]);_0x5de46e[_0xacb2('0x35')]=_['intersection'](_0x2611d6['model'],qs[_0xacb2('0x36')](_0x536999['query'][_0xacb2('0x36')]));_0x5de46e[_0xacb2('0x35')]=_0x5de46e[_0xacb2('0x35')][_0xacb2('0x37')]?_0x5de46e['attributes']:_0x2611d6['model'];if(_0x536999[_0xacb2('0x31')][_0xacb2('0x40')]){_0x5de46e['include']=[{'all':!![]}];}_0x5de46e=_[_0xacb2('0x3d')]({},_0x5de46e,_0x536999[_0xacb2('0x3f')]);return db[_0xacb2('0x2c')]['find'](_0x5de46e)[_0xacb2('0x25')](handleEntityNotFound(_0x5ad8bd,null))[_0xacb2('0x25')](respondWithResult(_0x5ad8bd,null))[_0xacb2('0x44')](handleError(_0x5ad8bd,null));};exports[_0xacb2('0x47')]=function(_0xb81a97,_0x39f55a){return db['SquareRecording'][_0xacb2('0x47')](_0xb81a97[_0xacb2('0x48')],{})[_0xacb2('0x25')](respondWithResult(_0x39f55a,0xc9))[_0xacb2('0x44')](handleError(_0x39f55a,null));};exports['update']=function(_0x80589b,_0x33a836){if(_0x80589b[_0xacb2('0x48')]['id']){delete _0x80589b['body']['id'];}return db[_0xacb2('0x2c')][_0xacb2('0x49')]({'where':{'id':_0x80589b[_0xacb2('0x46')]['id']}})[_0xacb2('0x25')](handleEntityNotFound(_0x33a836,null))[_0xacb2('0x25')](saveUpdates(_0x80589b['body'],null))[_0xacb2('0x25')](respondWithResult(_0x33a836,null))[_0xacb2('0x44')](handleError(_0x33a836,null));};exports[_0xacb2('0x4a')]=function(_0x241b32,_0x38011f,_0x37d1ca){var _0x41a6d6=require(_0xacb2('0x4b'));var _0x4372fa=![];var _0x4de8f6={};if(_0x241b32[_0xacb2('0x31')]['type']&&_0x241b32[_0xacb2('0x31')][_0xacb2('0x2e')]===_0xacb2('0x4c')){_0x4de8f6['uniqueid']=_0x241b32[_0xacb2('0x46')]['id'];}else{_0x4de8f6['id']=_0x241b32[_0xacb2('0x46')]['id'];}return db[_0xacb2('0x2c')][_0xacb2('0x49')]({'where':_0x4de8f6,'attributes':['id',_0xacb2('0x4d'),_0xacb2('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x38011f,null))['then'](function(_0x3d5aae){if(_0x3d5aae){var _0x5a0a44=_0x3d5aae[_0xacb2('0x4d')];var _0x1177be=util[_0xacb2('0x4f')](_0xacb2('0x50'),_0x5a0a44);if(fs['existsSync'](_0x1177be)){_0x4372fa=!![];return _0x41a6d6[_0xacb2('0x51')](_0x1177be,_0x5a0a44,config[_0xacb2('0x52')][_0xacb2('0x53')])[_0xacb2('0x25')](function(){return _0x3d5aae;});}return _0x3d5aae;}})[_0xacb2('0x25')](function(_0x2f0d90){if(_0x2f0d90){var _0x288822=_0x2f0d90['savePath'];if(!fs[_0xacb2('0x54')](_0x288822)){throw new db[(_0xacb2('0x55'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x2f0d90[_0xacb2('0x4e')]){return _0x38011f[_0xacb2('0x4a')](_0x288822,_0x2f0d90[_0xacb2('0x4e')]+path[_0xacb2('0x56')](_0x288822),function(){if(_0x4372fa){fs[_0xacb2('0x57')](_0x288822);}});}else{return _0x38011f[_0xacb2('0x4a')](_0x288822,function(_0x417387){if(_0x4372fa){fs['unlink'](_0x288822);}});}}})[_0xacb2('0x44')](function(_0x20268f){if(_0x20268f['message']==='SquareRecording\x20not\x20found'){_0x38011f[_0xacb2('0x1e')](0x194)[_0xacb2('0x2a')](_0xacb2('0x58'));}else{return handleError(_0x38011f,null);}});};exports[_0xacb2('0x26')]=function(_0x42d5b5,_0x7785b3){return db[_0xacb2('0x2c')]['find']({'where':{'id':_0x42d5b5['params']['id']}})[_0xacb2('0x25')](function(_0x379d32){if(_[_0xacb2('0x59')](_0x379d32)){throw new ReferenceError(_0xacb2('0x5a'));}return _0x379d32;})['then'](function(_0x1eb81e){var _0x3db2a2=_0x1eb81e['savePath'];logger['info'](_0xacb2('0x5b'),_0x3db2a2);if(!_[_0xacb2('0x59')](_0x1eb81e[_0xacb2('0x4d')])&&fs[_0xacb2('0x54')](_0x3db2a2)){logger['info'](_0xacb2('0x5c')+_0x3db2a2+_0xacb2('0x5d'));fs[_0xacb2('0x5e')](_0x3db2a2);}_0x3db2a2=_0x3db2a2+_0xacb2('0x5f');if(!_[_0xacb2('0x59')](_0x1eb81e[_0xacb2('0x4d')])&&fs[_0xacb2('0x54')](_0x3db2a2)){logger[_0xacb2('0x60')](_0xacb2('0x5c')+_0x3db2a2+_0xacb2('0x5d'));fs[_0xacb2('0x5e')](_0x3db2a2);}return _0x1eb81e;})['then'](function(_0x59e214){if(!_0x59e214)throw new InternalError();return _0x59e214[_0xacb2('0x26')]();})['then'](function(){_0x7785b3['status'](0xcc)['end']();})[_0xacb2('0x44')](handleError(_0x7785b3,null));}; \ No newline at end of file +var _0x1563=['Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','end','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','keys','intersection','includeAll','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil'];(function(_0x313e3d,_0x2d149f){var _0x3989d0=function(_0x91af6a){while(--_0x91af6a){_0x313e3d['push'](_0x313e3d['shift']());}};_0x3989d0(++_0x2d149f);}(_0x1563,0x1ec));var _0x3156=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0x1563[_0x2e1907];return _0x401555;};'use strict';var emlformat=require(_0x3156('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3156('0x1'));var jsonpatch=require(_0x3156('0x2'));var rp=require(_0x3156('0x3'));var moment=require('moment');var BPromise=require(_0x3156('0x4'));var Mustache=require('mustache');var util=require(_0x3156('0x5'));var path=require(_0x3156('0x6'));var sox=require(_0x3156('0x7'));var csv=require(_0x3156('0x8'));var ejs=require(_0x3156('0x9'));var fs=require('fs');var fs_extra=require(_0x3156('0xa'));var _=require('lodash');var squel=require(_0x3156('0xb'));var crypto=require('crypto');var jsforce=require(_0x3156('0xc'));var deskjs=require(_0x3156('0xd'));var toCsv=require(_0x3156('0x8'));var querystring=require(_0x3156('0xe'));var Papa=require(_0x3156('0xf'));var Redis=require(_0x3156('0x10'));var authService=require(_0x3156('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3156('0x12'));var hardwareService=require(_0x3156('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3156('0x14'));var config=require(_0x3156('0x15'));var licenseUtil=require(_0x3156('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xec7e19,_0x4e30e6){_0x4e30e6=_0x4e30e6||0xcc;return function(_0xcc01bf){if(_0xcc01bf){return _0xec7e19[_0x3156('0x17')](_0x4e30e6);}return _0xec7e19[_0x3156('0x18')](_0x4e30e6)['end']();};}function respondWithResult(_0x3faf55,_0x46491f){_0x46491f=_0x46491f||0xc8;return function(_0x5cf0ea){if(_0x5cf0ea){return _0x3faf55[_0x3156('0x18')](_0x46491f)[_0x3156('0x19')](_0x5cf0ea);}};}function respondWithFilteredResult(_0x1cb009,_0x5d8d5f){return function(_0x3935db){if(_0x3935db){var _0x448733=typeof _0x5d8d5f[_0x3156('0x1a')]===_0x3156('0x1b')&&typeof _0x5d8d5f[_0x3156('0x1c')]==='undefined';var _0x36071b=_0x3935db[_0x3156('0x1d')];var _0x1ea03d=_0x448733?0x0:_0x5d8d5f[_0x3156('0x1a')];var _0x48418a=_0x448733?_0x3935db['count']:_0x5d8d5f['offset']+_0x5d8d5f['limit'];var _0xf59d80;if(_0x48418a>=_0x36071b){_0x48418a=_0x36071b;_0xf59d80=0xc8;}else{_0xf59d80=0xce;}_0x1cb009[_0x3156('0x18')](_0xf59d80);return _0x1cb009[_0x3156('0x1e')](_0x3156('0x1f'),_0x1ea03d+'-'+_0x48418a+'/'+_0x36071b)['json'](_0x3935db);}return null;};}function patchUpdates(_0x44347c){return function(_0x191b9f){try{jsonpatch['apply'](_0x191b9f,_0x44347c,!![]);}catch(_0x1dbb34){return BPromise[_0x3156('0x20')](_0x1dbb34);}return _0x191b9f['save']();};}function saveUpdates(_0x2714b1,_0x51d903){return function(_0x44add7){if(_0x44add7){return _0x44add7[_0x3156('0x21')](_0x2714b1)[_0x3156('0x22')](function(_0x2e5efe){return _0x2e5efe;});}return null;};}function removeEntity(_0x43cb78,_0x303632){return function(_0x12dbb9){if(_0x12dbb9){return _0x12dbb9[_0x3156('0x23')]()[_0x3156('0x22')](function(){_0x43cb78[_0x3156('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a789f,_0x356c69){return function(_0x4aae8d){if(!_0x4aae8d){_0x2a789f['sendStatus'](0x194);}return _0x4aae8d;};}function handleError(_0x28ff79,_0x1a55dc){_0x1a55dc=_0x1a55dc||0x1f4;return function(_0x7267de){logger[_0x3156('0x24')](_0x7267de[_0x3156('0x25')]);if(_0x7267de[_0x3156('0x26')]){delete _0x7267de[_0x3156('0x26')];}_0x28ff79[_0x3156('0x18')](_0x1a55dc)[_0x3156('0x27')](_0x7267de);};}exports[_0x3156('0x28')]=function(_0xdb5f3d,_0x353b3c){var _0x3f8384={},_0x3c1b3f={},_0x3c333c={'count':0x0,'rows':[]};var _0x22345c=_[_0x3156('0x29')](db[_0x3156('0x2a')][_0x3156('0x2b')],function(_0x25f767){return{'name':_0x25f767[_0x3156('0x2c')],'type':_0x25f767[_0x3156('0x2d')][_0x3156('0x2e')]};});_0x3c1b3f[_0x3156('0x2f')]=_['map'](_0x22345c,_0x3156('0x26'));_0x3c1b3f[_0x3156('0x30')]=_['keys'](_0xdb5f3d[_0x3156('0x30')]);_0x3c1b3f[_0x3156('0x31')]=_['intersection'](_0x3c1b3f[_0x3156('0x2f')],_0x3c1b3f['query']);_0x3f8384[_0x3156('0x32')]=_['intersection'](_0x3c1b3f['model'],qs[_0x3156('0x33')](_0xdb5f3d['query'][_0x3156('0x33')]));_0x3f8384[_0x3156('0x32')]=_0x3f8384[_0x3156('0x32')][_0x3156('0x34')]?_0x3f8384[_0x3156('0x32')]:_0x3c1b3f['model'];if(!_0xdb5f3d[_0x3156('0x30')][_0x3156('0x35')]('nolimit')){_0x3f8384[_0x3156('0x1c')]=qs[_0x3156('0x1c')](_0xdb5f3d[_0x3156('0x30')][_0x3156('0x1c')]);_0x3f8384[_0x3156('0x1a')]=qs['offset'](_0xdb5f3d[_0x3156('0x30')][_0x3156('0x1a')]);}_0x3f8384[_0x3156('0x36')]=qs['sort'](_0xdb5f3d[_0x3156('0x30')][_0x3156('0x37')]);_0x3f8384[_0x3156('0x38')]=qs[_0x3156('0x31')](_[_0x3156('0x39')](_0xdb5f3d['query'],_0x3c1b3f[_0x3156('0x31')]),_0x22345c);if(_0xdb5f3d[_0x3156('0x30')][_0x3156('0x3a')]){_0x3f8384[_0x3156('0x38')]=_[_0x3156('0x3b')](_0x3f8384[_0x3156('0x38')],{'$or':_[_0x3156('0x29')](_0x22345c,function(_0x3218c2){if(_0x3218c2[_0x3156('0x2d')]!==_0x3156('0x3c')){var _0x83686f={};_0x83686f[_0x3218c2[_0x3156('0x26')]]={'$like':'%'+_0xdb5f3d['query']['filter']+'%'};return _0x83686f;}})});}_0x3f8384=_[_0x3156('0x3b')]({},_0x3f8384,_0xdb5f3d[_0x3156('0x3d')]);var _0x3093cf={'where':_0x3f8384[_0x3156('0x38')]};return db['SquareRecording']['count'](_0x3093cf)[_0x3156('0x22')](function(_0x533094){_0x3c333c[_0x3156('0x1d')]=_0x533094;if(_0xdb5f3d[_0x3156('0x30')]['includeAll']){_0x3f8384['include']=[{'all':!![]}];}return db[_0x3156('0x2a')][_0x3156('0x3e')](_0x3f8384);})['then'](function(_0x3ca57c){_0x3c333c['rows']=_0x3ca57c;return _0x3c333c;})[_0x3156('0x22')](respondWithFilteredResult(_0x353b3c,_0x3f8384))[_0x3156('0x3f')](handleError(_0x353b3c,null));};exports[_0x3156('0x40')]=function(_0x36ce2e,_0x56e56d){var _0x21d6a2={'raw':!![],'where':{'id':_0x36ce2e['params']['id']}},_0x3cbaec={};_0x3cbaec[_0x3156('0x2f')]=_[_0x3156('0x41')](db[_0x3156('0x2a')][_0x3156('0x2b')]);_0x3cbaec[_0x3156('0x30')]=_[_0x3156('0x41')](_0x36ce2e[_0x3156('0x30')]);_0x3cbaec[_0x3156('0x31')]=_[_0x3156('0x42')](_0x3cbaec[_0x3156('0x2f')],_0x3cbaec[_0x3156('0x30')]);_0x21d6a2[_0x3156('0x32')]=_['intersection'](_0x3cbaec['model'],qs[_0x3156('0x33')](_0x36ce2e[_0x3156('0x30')][_0x3156('0x33')]));_0x21d6a2[_0x3156('0x32')]=_0x21d6a2[_0x3156('0x32')]['length']?_0x21d6a2['attributes']:_0x3cbaec['model'];if(_0x36ce2e[_0x3156('0x30')][_0x3156('0x43')]){_0x21d6a2['include']=[{'all':!![]}];}_0x21d6a2=_['merge']({},_0x21d6a2,_0x36ce2e[_0x3156('0x3d')]);return db[_0x3156('0x2a')][_0x3156('0x44')](_0x21d6a2)[_0x3156('0x22')](handleEntityNotFound(_0x56e56d,null))[_0x3156('0x22')](respondWithResult(_0x56e56d,null))[_0x3156('0x3f')](handleError(_0x56e56d,null));};exports['create']=function(_0x3faa88,_0x374eeb){return db[_0x3156('0x2a')][_0x3156('0x45')](_0x3faa88[_0x3156('0x46')],{})[_0x3156('0x22')](respondWithResult(_0x374eeb,0xc9))['catch'](handleError(_0x374eeb,null));};exports[_0x3156('0x21')]=function(_0x4130fc,_0x58a1f7){if(_0x4130fc['body']['id']){delete _0x4130fc[_0x3156('0x46')]['id'];}return db[_0x3156('0x2a')][_0x3156('0x44')]({'where':{'id':_0x4130fc[_0x3156('0x47')]['id']}})[_0x3156('0x22')](handleEntityNotFound(_0x58a1f7,null))[_0x3156('0x22')](saveUpdates(_0x4130fc[_0x3156('0x46')],null))['then'](respondWithResult(_0x58a1f7,null))['catch'](handleError(_0x58a1f7,null));};exports[_0x3156('0x48')]=function(_0x19f265,_0x129e90,_0x4fd1ec){var _0x415fde=require(_0x3156('0x49'));var _0x10c93d=![];var _0x1dbee5={};if(_0x19f265[_0x3156('0x30')][_0x3156('0x2d')]&&_0x19f265['query'][_0x3156('0x2d')]===_0x3156('0x4a')){_0x1dbee5['uniqueid']=_0x19f265[_0x3156('0x47')]['id'];}else{_0x1dbee5['id']=_0x19f265['params']['id'];}return db[_0x3156('0x2a')][_0x3156('0x44')]({'where':_0x1dbee5,'attributes':['id','savePath',_0x3156('0x4b')],'raw':!![]})[_0x3156('0x22')](handleEntityNotFound(_0x129e90,null))[_0x3156('0x22')](function(_0x461592){if(_0x461592){var _0x49af5d=_0x461592[_0x3156('0x4c')];var _0x5e9322=util[_0x3156('0x4d')](_0x3156('0x4e'),_0x49af5d);if(fs[_0x3156('0x4f')](_0x5e9322)){_0x10c93d=!![];return _0x415fde[_0x3156('0x50')](_0x5e9322,_0x49af5d,config[_0x3156('0x51')][_0x3156('0x52')])[_0x3156('0x22')](function(){return _0x461592;});}return _0x461592;}})['then'](function(_0x51d8f6){if(_0x51d8f6){var _0x3f8eea=_0x51d8f6[_0x3156('0x4c')];if(!fs[_0x3156('0x4f')](_0x3f8eea)){throw new db[(_0x3156('0x53'))][(_0x3156('0x54'))](_0x3156('0x55'));}if(_0x51d8f6[_0x3156('0x4b')]){return _0x129e90[_0x3156('0x48')](_0x3f8eea,_0x51d8f6[_0x3156('0x4b')]+path[_0x3156('0x56')](_0x3f8eea),function(){if(_0x10c93d){fs[_0x3156('0x57')](_0x3f8eea);}});}else{return _0x129e90['download'](_0x3f8eea,function(_0x4fa470){if(_0x10c93d){fs[_0x3156('0x57')](_0x3f8eea);}});}}})[_0x3156('0x3f')](function(_0x1037fc){if(_0x1037fc['message']===_0x3156('0x55')){_0x129e90[_0x3156('0x18')](0x194)[_0x3156('0x27')](_0x3156('0x58'));}else{return handleError(_0x129e90,null);}});};exports[_0x3156('0x23')]=function(_0x21046d,_0x59651f){return db[_0x3156('0x2a')]['find']({'where':{'id':_0x21046d[_0x3156('0x47')]['id']}})[_0x3156('0x22')](function(_0x2980bd){if(_[_0x3156('0x59')](_0x2980bd)){throw new ReferenceError(_0x3156('0x5a'));}return _0x2980bd;})['then'](function(_0x5c6912){var _0x546fd2=_0x5c6912[_0x3156('0x4c')];logger[_0x3156('0x5b')](_0x3156('0x5c'),_0x546fd2);if(!_['isNil'](_0x5c6912['savePath'])&&fs[_0x3156('0x4f')](_0x546fd2)){logger[_0x3156('0x5b')](_0x3156('0x5d')+_0x546fd2+_0x3156('0x5e'));fs['unlinkSync'](_0x546fd2);}_0x546fd2=_0x546fd2+_0x3156('0x5f');if(!_['isNil'](_0x5c6912[_0x3156('0x4c')])&&fs[_0x3156('0x4f')](_0x546fd2)){logger[_0x3156('0x5b')]('File:\x20\x22'+_0x546fd2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x546fd2);}return _0x5c6912;})['then'](function(_0x581d29){if(!_0x581d29)throw new InternalError();return _0x581d29[_0x3156('0x23')]();})[_0x3156('0x22')](function(){_0x59651f['status'](0xcc)[_0x3156('0x60')]();})[_0x3156('0x3f')](handleError(_0x59651f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8c3afef..fa0eb1d 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 _0x89fb=['SquareRecording','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0x89fb,0x14b));var _0xb89f=function(_0x4fc0c6,_0x26afb4){_0x4fc0c6=_0x4fc0c6-0x0;var _0xdbb988=_0x89fb[_0x4fc0c6];return _0xdbb988;};'use strict';var _=require('lodash');var util=require(_0xb89f('0x0'));var logger=require(_0xb89f('0x1'))(_0xb89f('0x2'));var moment=require(_0xb89f('0x3'));var BPromise=require(_0xb89f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb89f('0x5'));var rimraf=require(_0xb89f('0x6'));var config=require(_0xb89f('0x7'));var attributes=require(_0xb89f('0x8'));module[_0xb89f('0x9')]=function(_0x564ef3,_0x2ce32a){return _0x564ef3['define'](_0xb89f('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings'];(function(_0x34c028,_0x194c47){var _0x448f70=function(_0x108b1e){while(--_0x108b1e){_0x34c028['push'](_0x34c028['shift']());}};_0x448f70(++_0x194c47);}(_0x2d72,0xa8));var _0x22d7=function(_0x4b7cf6,_0x23f8a3){_0x4b7cf6=_0x4b7cf6-0x0;var _0x767fe8=_0x2d72[_0x4b7cf6];return _0x767fe8;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'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 342ad78..110e980 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 _0xcf9a=['CreateSquareRecording','SquareRecording','create','options','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4089fd,_0x460230){var _0x549185=function(_0x434c0e){while(--_0x434c0e){_0x4089fd['push'](_0x4089fd['shift']());}};_0x549185(++_0x460230);}(_0xcf9a,0x122));var _0xacf9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcf9a[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xacf9('0x0'));var util=require('util');var moment=require(_0xacf9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacf9('0x2'));var db=require(_0xacf9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacf9('0x4'))(_0xacf9('0x5'));var config=require(_0xacf9('0x6'));var jayson=require(_0xacf9('0x7'));var client=jayson[_0xacf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5684a1,_0x1f1524,_0x22bf50){return new BPromise(function(_0x5c8b38,_0x12f332){return client[_0xacf9('0x9')](_0x5684a1,_0x22bf50)[_0xacf9('0xa')](function(_0x52573c){logger[_0xacf9('0xb')](_0xacf9('0xc'),_0x1f1524,_0xacf9('0xd'));logger[_0xacf9('0xe')](_0xacf9('0xf'),_0x1f1524,_0xacf9('0xd'),JSON[_0xacf9('0x10')](_0x52573c));if(_0x52573c[_0xacf9('0x11')]){if(_0x52573c[_0xacf9('0x11')][_0xacf9('0x12')]===0x1f4){logger[_0xacf9('0x11')]('SquareRecording,\x20%s,\x20%s',_0x1f1524,_0x52573c['error'][_0xacf9('0x13')]);return _0x12f332(_0x52573c[_0xacf9('0x11')][_0xacf9('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x1f1524,_0x52573c[_0xacf9('0x11')]['message']);return _0x5c8b38(_0x52573c[_0xacf9('0x11')][_0xacf9('0x13')]);}else{logger[_0xacf9('0xb')](_0xacf9('0xc'),_0x1f1524,_0xacf9('0xd'));_0x5c8b38(_0x52573c[_0xacf9('0x14')][_0xacf9('0x13')]);}})[_0xacf9('0x15')](function(_0x468322){logger[_0xacf9('0x11')](_0xacf9('0xc'),_0x1f1524,_0x468322);_0x12f332(_0x468322);});});}exports[_0xacf9('0x16')]=function(_0x357cfa){var _0x2eff5c=this;return new Promise(function(_0x43828d,_0x4b8a7f){return db[_0xacf9('0x17')][_0xacf9('0x18')](_0x357cfa['body'],{'raw':_0x357cfa[_0xacf9('0x19')]?_0x357cfa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1dec82){logger[_0xacf9('0xb')]('CreateSquareRecording',_0x357cfa);logger[_0xacf9('0xe')]('CreateSquareRecording',_0x357cfa,JSON[_0xacf9('0x10')](_0x1dec82));_0x43828d(_0x1dec82);})[_0xacf9('0x15')](function(_0x335e7d){logger['error'](_0xacf9('0x16'),_0x335e7d['message'],_0x357cfa);_0x4b8a7f(_0x2eff5c['error'](0x1f4,_0x335e7d[_0xacf9('0x13')]));});});}; \ No newline at end of file +var _0x9d74=['SquareRecording','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateSquareRecording'];(function(_0x29e215,_0x7c3e95){var _0x50cc14=function(_0x2a91b7){while(--_0x2a91b7){_0x29e215['push'](_0x29e215['shift']());}};_0x50cc14(++_0x7c3e95);}(_0x9d74,0x18d));var _0x49d7=function(_0x4bf5fd,_0x21a61f){_0x4bf5fd=_0x4bf5fd-0x0;var _0xaa79ab=_0x9d74[_0x4bf5fd];return _0xaa79ab;};'use strict';var _=require(_0x49d7('0x0'));var util=require('util');var moment=require(_0x49d7('0x1'));var BPromise=require(_0x49d7('0x2'));var rs=require(_0x49d7('0x3'));var fs=require('fs');var Redis=require(_0x49d7('0x4'));var db=require(_0x49d7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x49d7('0x6'))(_0x49d7('0x7'));var config=require(_0x49d7('0x8'));var jayson=require(_0x49d7('0x9'));var client=jayson['client'][_0x49d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1948a1,_0x297538,_0x1bfb50){return new BPromise(function(_0x31205c,_0x47768c){return client['request'](_0x1948a1,_0x1bfb50)[_0x49d7('0xb')](function(_0x55a1ac){logger[_0x49d7('0xc')](_0x49d7('0xd'),_0x297538,'request\x20sent');logger[_0x49d7('0xe')](_0x49d7('0xf'),_0x297538,_0x49d7('0x10'),JSON[_0x49d7('0x11')](_0x55a1ac));if(_0x55a1ac[_0x49d7('0x12')]){if(_0x55a1ac[_0x49d7('0x12')]['code']===0x1f4){logger['error'](_0x49d7('0xd'),_0x297538,_0x55a1ac[_0x49d7('0x12')][_0x49d7('0x13')]);return _0x47768c(_0x55a1ac[_0x49d7('0x12')][_0x49d7('0x13')]);}logger[_0x49d7('0x12')]('SquareRecording,\x20%s,\x20%s',_0x297538,_0x55a1ac[_0x49d7('0x12')]['message']);return _0x31205c(_0x55a1ac[_0x49d7('0x12')][_0x49d7('0x13')]);}else{logger[_0x49d7('0xc')](_0x49d7('0xd'),_0x297538,_0x49d7('0x10'));_0x31205c(_0x55a1ac[_0x49d7('0x14')]['message']);}})[_0x49d7('0x15')](function(_0x4aa024){logger['error']('SquareRecording,\x20%s,\x20%s',_0x297538,_0x4aa024);_0x47768c(_0x4aa024);});});}exports[_0x49d7('0x16')]=function(_0x237c3d){var _0x382499=this;return new Promise(function(_0x20e25d,_0x585f32){return db[_0x49d7('0x17')][_0x49d7('0x18')](_0x237c3d[_0x49d7('0x19')],{'raw':_0x237c3d[_0x49d7('0x1a')]?_0x237c3d[_0x49d7('0x1a')][_0x49d7('0x1b')]===undefined?!![]:![]:!![]})[_0x49d7('0xb')](function(_0xe79f8f){logger[_0x49d7('0xc')](_0x49d7('0x16'),_0x237c3d);logger[_0x49d7('0xe')]('CreateSquareRecording',_0x237c3d,JSON[_0x49d7('0x11')](_0xe79f8f));_0x20e25d(_0xe79f8f);})[_0x49d7('0x15')](function(_0x4b940b){logger[_0x49d7('0x12')](_0x49d7('0x16'),_0x4b940b[_0x49d7('0x13')],_0x237c3d);_0x585f32(_0x382499[_0x49d7('0x12')](0x1f4,_0x4b940b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9fbc19f..68ea0b4 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(_0x4596ef,_0x1e0b80){var _0x26c7b2=function(_0x3e0d75){while(--_0x3e0d75){_0x4596ef['push'](_0x4596ef['shift']());}};_0x26c7b2(++_0x1e0b80);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5b65d8,_0x5d31d2){var _0x1476ee=function(_0x50f099){while(--_0x50f099){_0x5b65d8['push'](_0x5b65d8['shift']());}};_0x1476ee(++_0x5d31d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xb10b[_0x3438cf];return _0x278698;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0b63502..7c94b28 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 _0x2ca1=['STRING','DATE','sequelize','exports'];(function(_0x5a2635,_0x350231){var _0xbb4c68=function(_0x1ba0ec){while(--_0x1ba0ec){_0x5a2635['push'](_0x5a2635['shift']());}};_0xbb4c68(++_0x350231);}(_0x2ca1,0x116));var _0x12ca=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2ca1[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x12ca('0x0'));module[_0x12ca('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x12ca('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x12ca('0x2')]},'type':{'type':Sequelize[_0x12ca('0x2')]},'uniqueid':{'type':Sequelize[_0x12ca('0x2')]},'version':{'type':Sequelize[_0x12ca('0x2')]},'callerid':{'type':Sequelize[_0x12ca('0x2')]},'calleridname':{'type':Sequelize[_0x12ca('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x12ca('0x2')]},'callingtns':{'type':Sequelize[_0x12ca('0x2')]},'dnid':{'type':Sequelize[_0x12ca('0x2')]},'rdnis':{'type':Sequelize[_0x12ca('0x2')]},'context':{'type':Sequelize[_0x12ca('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x12ca('0x2')]},'enhanced':{'type':Sequelize[_0x12ca('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x12ca('0x2')]},'joinAt':{'type':Sequelize[_0x12ca('0x3')]},'leaveAt':{'type':Sequelize[_0x12ca('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xded4=['BOOLEAN','STRING','DATE'];(function(_0x2ea4bb,_0x98bb3c){var _0x372b61=function(_0x61b3f1){while(--_0x61b3f1){_0x2ea4bb['push'](_0x2ea4bb['shift']());}};_0x372b61(++_0x98bb3c);}(_0xded4,0x1bd));var _0x4ded=function(_0x44ffc5,_0x1f9d16){_0x44ffc5=_0x44ffc5-0x0;var _0x196105=_0xded4[_0x44ffc5];return _0x196105;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x4ded('0x0')]},'network_script':{'type':Sequelize[_0x4ded('0x0')]},'request':{'type':Sequelize[_0x4ded('0x0')]},'channel':{'type':Sequelize[_0x4ded('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4ded('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x4ded('0x0')]},'callerid':{'type':Sequelize[_0x4ded('0x0')]},'calleridname':{'type':Sequelize[_0x4ded('0x0')]},'callingpres':{'type':Sequelize[_0x4ded('0x0')]},'callingani2':{'type':Sequelize[_0x4ded('0x0')]},'callington':{'type':Sequelize[_0x4ded('0x0')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x4ded('0x0')]},'context':{'type':Sequelize[_0x4ded('0x0')]},'extension':{'type':Sequelize[_0x4ded('0x0')]},'priority':{'type':Sequelize[_0x4ded('0x0')]},'enhanced':{'type':Sequelize[_0x4ded('0x0')]},'accountcode':{'type':Sequelize[_0x4ded('0x0')]},'threadid':{'type':Sequelize[_0x4ded('0x0')]},'project_name':{'type':Sequelize[_0x4ded('0x0')]},'joinAt':{'type':Sequelize[_0x4ded('0x1')]},'leaveAt':{'type':Sequelize[_0x4ded('0x1')]},'bot':{'type':Sequelize[_0x4ded('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b4d97c9..306c63d 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 _0xf73c=['to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x12a984,_0x41c519){var _0x4a625c=function(_0x1d0b99){while(--_0x1d0b99){_0x12a984['push'](_0x12a984['shift']());}};_0x4a625c(++_0x41c519);}(_0xf73c,0x8e));var _0xcf73=function(_0xe98afa,_0x578029){_0xe98afa=_0xe98afa-0x0;var _0x4a5af7=_0xf73c[_0xe98afa];return _0x4a5af7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf73('0x1'));var rp=require(_0xcf73('0x2'));var moment=require(_0xcf73('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf73('0x4'));var util=require(_0xcf73('0x5'));var path=require(_0xcf73('0x6'));var sox=require(_0xcf73('0x7'));var csv=require(_0xcf73('0x8'));var ejs=require(_0xcf73('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf73('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcf73('0xb'));var deskjs=require(_0xcf73('0xc'));var toCsv=require(_0xcf73('0x8'));var querystring=require(_0xcf73('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcf73('0xe'));var qs=require(_0xcf73('0xf'));var as=require(_0xcf73('0x10'));var hardwareService=require(_0xcf73('0x11'));var logger=require('../../config/logger')(_0xcf73('0x12'));var utils=require(_0xcf73('0x13'));var config=require(_0xcf73('0x14'));var licenseUtil=require(_0xcf73('0x15'));var db=require(_0xcf73('0x16'))['db'];function respondWithStatusCode(_0x4c3e7a,_0x25242d){_0x25242d=_0x25242d||0xcc;return function(_0x55d6c9){if(_0x55d6c9){return _0x4c3e7a['sendStatus'](_0x25242d);}return _0x4c3e7a[_0xcf73('0x17')](_0x25242d)[_0xcf73('0x18')]();};}function respondWithResult(_0xea329f,_0x26d47d){_0x26d47d=_0x26d47d||0xc8;return function(_0x2e54ff){if(_0x2e54ff){return _0xea329f[_0xcf73('0x17')](_0x26d47d)[_0xcf73('0x19')](_0x2e54ff);}};}function respondWithFilteredResult(_0x363046,_0x30e9b0){return function(_0x3cb1b9){if(_0x3cb1b9){var _0x132a26=typeof _0x30e9b0[_0xcf73('0x1a')]===_0xcf73('0x1b')&&typeof _0x30e9b0[_0xcf73('0x1c')]===_0xcf73('0x1b');var _0xfe83b1=_0x3cb1b9[_0xcf73('0x1d')];var _0x45fbcc=_0x132a26?0x0:_0x30e9b0['offset'];var _0x34c585=_0x132a26?_0x3cb1b9[_0xcf73('0x1d')]:_0x30e9b0[_0xcf73('0x1a')]+_0x30e9b0[_0xcf73('0x1c')];var _0xcc9739;if(_0x34c585>=_0xfe83b1){_0x34c585=_0xfe83b1;_0xcc9739=0xc8;}else{_0xcc9739=0xce;}_0x363046[_0xcf73('0x17')](_0xcc9739);return _0x363046['set'](_0xcf73('0x1e'),_0x45fbcc+'-'+_0x34c585+'/'+_0xfe83b1)[_0xcf73('0x19')](_0x3cb1b9);}return null;};}function patchUpdates(_0x14b24a){return function(_0x3edb04){try{jsonpatch[_0xcf73('0x1f')](_0x3edb04,_0x14b24a,!![]);}catch(_0x16ea17){return BPromise[_0xcf73('0x20')](_0x16ea17);}return _0x3edb04[_0xcf73('0x21')]();};}function saveUpdates(_0x2e1cc3,_0x38ac4c){return function(_0xa369ee){if(_0xa369ee){return _0xa369ee[_0xcf73('0x22')](_0x2e1cc3)[_0xcf73('0x23')](function(_0x1d0407){return _0x1d0407;});}return null;};}function removeEntity(_0x42c983,_0x1e3f3b){return function(_0xef30f6){if(_0xef30f6){return _0xef30f6['destroy']()[_0xcf73('0x23')](function(){_0x42c983[_0xcf73('0x17')](0xcc)[_0xcf73('0x18')]();});}};}function handleEntityNotFound(_0x3a58b5,_0x336cb5){return function(_0x24e3e3){if(!_0x24e3e3){_0x3a58b5[_0xcf73('0x24')](0x194);}return _0x24e3e3;};}function handleError(_0x51f527,_0x175085){_0x175085=_0x175085||0x1f4;return function(_0x920091){logger[_0xcf73('0x25')](_0x920091[_0xcf73('0x26')]);if(_0x920091[_0xcf73('0x27')]){delete _0x920091[_0xcf73('0x27')];}_0x51f527[_0xcf73('0x17')](_0x175085)[_0xcf73('0x28')](_0x920091);};}exports[_0xcf73('0x29')]=function(_0x4ec508,_0x4b5097){var _0xc186b4={},_0x344a8e={},_0x24ba2c={'count':0x0,'rows':[]};var _0x229795=_[_0xcf73('0x2a')](db[_0xcf73('0x2b')][_0xcf73('0x2c')],function(_0x4b6aa4){return{'name':_0x4b6aa4[_0xcf73('0x2d')],'type':_0x4b6aa4[_0xcf73('0x2e')][_0xcf73('0x2f')]};});_0x344a8e['model']=_[_0xcf73('0x2a')](_0x229795,_0xcf73('0x27'));_0x344a8e['query']=_['keys'](_0x4ec508[_0xcf73('0x30')]);_0x344a8e[_0xcf73('0x31')]=_[_0xcf73('0x32')](_0x344a8e['model'],_0x344a8e[_0xcf73('0x30')]);_0xc186b4['attributes']=_[_0xcf73('0x32')](_0x344a8e[_0xcf73('0x33')],qs[_0xcf73('0x34')](_0x4ec508[_0xcf73('0x30')]['fields']));_0xc186b4['attributes']=_0xc186b4[_0xcf73('0x35')][_0xcf73('0x36')]?_0xc186b4[_0xcf73('0x35')]:_0x344a8e[_0xcf73('0x33')];if(!_0x4ec508[_0xcf73('0x30')][_0xcf73('0x37')](_0xcf73('0x38'))){_0xc186b4[_0xcf73('0x1c')]=qs[_0xcf73('0x1c')](_0x4ec508[_0xcf73('0x30')]['limit']);_0xc186b4[_0xcf73('0x1a')]=qs[_0xcf73('0x1a')](_0x4ec508['query'][_0xcf73('0x1a')]);}_0xc186b4[_0xcf73('0x39')]=qs['sort'](_0x4ec508[_0xcf73('0x30')][_0xcf73('0x3a')]);_0xc186b4['where']=qs[_0xcf73('0x31')](_[_0xcf73('0x3b')](_0x4ec508[_0xcf73('0x30')],_0x344a8e['filters']),_0x229795);if(_0x4ec508[_0xcf73('0x30')][_0xcf73('0x3c')]){_0xc186b4[_0xcf73('0x3d')]=_[_0xcf73('0x3e')](_0xc186b4[_0xcf73('0x3d')],{'$or':_[_0xcf73('0x2a')](_0x229795,function(_0x45cf6a){if(_0x45cf6a['type']!==_0xcf73('0x3f')){var _0xad65c8={};_0xad65c8[_0x45cf6a[_0xcf73('0x27')]]={'$like':'%'+_0x4ec508[_0xcf73('0x30')]['filter']+'%'};return _0xad65c8;}})});}_0xc186b4=_['merge']({},_0xc186b4,_0x4ec508[_0xcf73('0x40')]);var _0x10d161={'where':_0xc186b4[_0xcf73('0x3d')]};return db[_0xcf73('0x2b')][_0xcf73('0x1d')](_0x10d161)['then'](function(_0xb8aa0c){_0x24ba2c[_0xcf73('0x1d')]=_0xb8aa0c;if(_0x4ec508[_0xcf73('0x30')][_0xcf73('0x41')]){_0xc186b4[_0xcf73('0x42')]=[{'all':!![]}];}return db[_0xcf73('0x2b')]['findAll'](_0xc186b4);})[_0xcf73('0x23')](function(_0x4aaf8c){_0x24ba2c[_0xcf73('0x43')]=_0x4aaf8c;return _0x24ba2c;})[_0xcf73('0x23')](respondWithFilteredResult(_0x4b5097,_0xc186b4))[_0xcf73('0x44')](handleError(_0x4b5097,null));};exports[_0xcf73('0x45')]=function(_0x460b82,_0x4ab86f){var _0x4b9dc9={'raw':!![],'where':{'id':_0x460b82[_0xcf73('0x46')]['id']}},_0x2c94d7={};_0x2c94d7['model']=_['keys'](db[_0xcf73('0x2b')][_0xcf73('0x2c')]);_0x2c94d7[_0xcf73('0x30')]=_[_0xcf73('0x47')](_0x460b82['query']);_0x2c94d7['filters']=_[_0xcf73('0x32')](_0x2c94d7[_0xcf73('0x33')],_0x2c94d7[_0xcf73('0x30')]);_0x4b9dc9[_0xcf73('0x35')]=_[_0xcf73('0x32')](_0x2c94d7['model'],qs[_0xcf73('0x34')](_0x460b82[_0xcf73('0x30')][_0xcf73('0x34')]));_0x4b9dc9['attributes']=_0x4b9dc9[_0xcf73('0x35')]['length']?_0x4b9dc9[_0xcf73('0x35')]:_0x2c94d7[_0xcf73('0x33')];if(_0x460b82[_0xcf73('0x30')]['includeAll']){_0x4b9dc9['include']=[{'all':!![]}];}_0x4b9dc9=_[_0xcf73('0x3e')]({},_0x4b9dc9,_0x460b82[_0xcf73('0x40')]);return db['SquareReport'][_0xcf73('0x48')](_0x4b9dc9)['then'](handleEntityNotFound(_0x4ab86f,null))[_0xcf73('0x23')](respondWithResult(_0x4ab86f,null))['catch'](handleError(_0x4ab86f,null));};exports[_0xcf73('0x49')]=function(_0x42a020,_0x573217){return db['SquareReport'][_0xcf73('0x49')](_0x42a020['body'],{})[_0xcf73('0x23')](respondWithResult(_0x573217,0xc9))[_0xcf73('0x44')](handleError(_0x573217,null));};exports['update']=function(_0x15e703,_0x192a78){if(_0x15e703['body']['id']){delete _0x15e703[_0xcf73('0x4a')]['id'];}return db[_0xcf73('0x2b')][_0xcf73('0x48')]({'where':{'id':_0x15e703[_0xcf73('0x46')]['id']}})[_0xcf73('0x23')](handleEntityNotFound(_0x192a78,null))[_0xcf73('0x23')](saveUpdates(_0x15e703[_0xcf73('0x4a')],null))[_0xcf73('0x23')](respondWithResult(_0x192a78,null))[_0xcf73('0x44')](handleError(_0x192a78,null));};exports['destroy']=function(_0x1cf645,_0x1934f3){return db[_0xcf73('0x2b')][_0xcf73('0x48')]({'where':{'id':_0x1cf645[_0xcf73('0x46')]['id']}})[_0xcf73('0x23')](handleEntityNotFound(_0x1934f3,null))[_0xcf73('0x23')](removeEntity(_0x1934f3,null))[_0xcf73('0x44')](handleError(_0x1934f3,null));};exports['describe']=function(_0x1d17f1,_0x4a2e67){return db['SquareReport']['describe']()[_0xcf73('0x23')](respondWithResult(_0x4a2e67,null))[_0xcf73('0x44')](handleError(_0x4a2e67,null));}; \ No newline at end of file +var _0x7ff2=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7ff2,0x17b));var _0x27ff=function(_0x1fa96c,_0x547788){_0x1fa96c=_0x1fa96c-0x0;var _0x54fa7b=_0x7ff2[_0x1fa96c];return _0x54fa7b;};'use strict';var emlformat=require(_0x27ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27ff('0x1'));var jsonpatch=require(_0x27ff('0x2'));var rp=require(_0x27ff('0x3'));var moment=require('moment');var BPromise=require(_0x27ff('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x27ff('0x5'));var sox=require(_0x27ff('0x6'));var csv=require(_0x27ff('0x7'));var ejs=require(_0x27ff('0x8'));var fs=require('fs');var fs_extra=require(_0x27ff('0x9'));var _=require(_0x27ff('0xa'));var squel=require(_0x27ff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x27ff('0x7'));var querystring=require('querystring');var Papa=require(_0x27ff('0xc'));var Redis=require('ioredis');var authService=require(_0x27ff('0xd'));var qs=require(_0x27ff('0xe'));var as=require(_0x27ff('0xf'));var hardwareService=require(_0x27ff('0x10'));var logger=require(_0x27ff('0x11'))(_0x27ff('0x12'));var utils=require('../../config/utils');var config=require(_0x27ff('0x13'));var licenseUtil=require(_0x27ff('0x14'));var db=require(_0x27ff('0x15'))['db'];function respondWithStatusCode(_0x1d4b0,_0x4c496f){_0x4c496f=_0x4c496f||0xcc;return function(_0x3285bd){if(_0x3285bd){return _0x1d4b0['sendStatus'](_0x4c496f);}return _0x1d4b0[_0x27ff('0x16')](_0x4c496f)[_0x27ff('0x17')]();};}function respondWithResult(_0x15caf3,_0x34abb2){_0x34abb2=_0x34abb2||0xc8;return function(_0x5af3b5){if(_0x5af3b5){return _0x15caf3[_0x27ff('0x16')](_0x34abb2)[_0x27ff('0x18')](_0x5af3b5);}};}function respondWithFilteredResult(_0x5ac07b,_0x583732){return function(_0xf1dab3){if(_0xf1dab3){var _0x5c0f0a=typeof _0x583732[_0x27ff('0x19')]===_0x27ff('0x1a')&&typeof _0x583732[_0x27ff('0x1b')]===_0x27ff('0x1a');var _0x2e82d5=_0xf1dab3['count'];var _0x312bb1=_0x5c0f0a?0x0:_0x583732[_0x27ff('0x19')];var _0x1ae71c=_0x5c0f0a?_0xf1dab3[_0x27ff('0x1c')]:_0x583732[_0x27ff('0x19')]+_0x583732['limit'];var _0x442f0a;if(_0x1ae71c>=_0x2e82d5){_0x1ae71c=_0x2e82d5;_0x442f0a=0xc8;}else{_0x442f0a=0xce;}_0x5ac07b[_0x27ff('0x16')](_0x442f0a);return _0x5ac07b[_0x27ff('0x1d')](_0x27ff('0x1e'),_0x312bb1+'-'+_0x1ae71c+'/'+_0x2e82d5)['json'](_0xf1dab3);}return null;};}function patchUpdates(_0x26323c){return function(_0x425637){try{jsonpatch[_0x27ff('0x1f')](_0x425637,_0x26323c,!![]);}catch(_0x13c989){return BPromise[_0x27ff('0x20')](_0x13c989);}return _0x425637['save']();};}function saveUpdates(_0x5d4373,_0x394f48){return function(_0x2b009b){if(_0x2b009b){return _0x2b009b[_0x27ff('0x21')](_0x5d4373)[_0x27ff('0x22')](function(_0x4b75fd){return _0x4b75fd;});}return null;};}function removeEntity(_0x4072dc,_0x4b22f6){return function(_0x10a943){if(_0x10a943){return _0x10a943[_0x27ff('0x23')]()['then'](function(){_0x4072dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x112815,_0x377427){return function(_0x450145){if(!_0x450145){_0x112815[_0x27ff('0x24')](0x194);}return _0x450145;};}function handleError(_0x2e890d,_0x5bc7d4){_0x5bc7d4=_0x5bc7d4||0x1f4;return function(_0x458669){logger['error'](_0x458669[_0x27ff('0x25')]);if(_0x458669[_0x27ff('0x26')]){delete _0x458669[_0x27ff('0x26')];}_0x2e890d[_0x27ff('0x16')](_0x5bc7d4)[_0x27ff('0x27')](_0x458669);};}exports[_0x27ff('0x28')]=function(_0x152d4f,_0x3d9664){var _0x3175b6={},_0x1324f5={},_0x52ee8f={'count':0x0,'rows':[]};var _0x18b844=_[_0x27ff('0x29')](db[_0x27ff('0x2a')][_0x27ff('0x2b')],function(_0x56acbd){return{'name':_0x56acbd['fieldName'],'type':_0x56acbd[_0x27ff('0x2c')][_0x27ff('0x2d')]};});_0x1324f5[_0x27ff('0x2e')]=_[_0x27ff('0x29')](_0x18b844,'name');_0x1324f5[_0x27ff('0x2f')]=_[_0x27ff('0x30')](_0x152d4f[_0x27ff('0x2f')]);_0x1324f5[_0x27ff('0x31')]=_[_0x27ff('0x32')](_0x1324f5[_0x27ff('0x2e')],_0x1324f5['query']);_0x3175b6[_0x27ff('0x33')]=_[_0x27ff('0x32')](_0x1324f5[_0x27ff('0x2e')],qs[_0x27ff('0x34')](_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x34')]));_0x3175b6['attributes']=_0x3175b6['attributes'][_0x27ff('0x35')]?_0x3175b6[_0x27ff('0x33')]:_0x1324f5[_0x27ff('0x2e')];if(!_0x152d4f['query'][_0x27ff('0x36')](_0x27ff('0x37'))){_0x3175b6['limit']=qs[_0x27ff('0x1b')](_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x1b')]);_0x3175b6[_0x27ff('0x19')]=qs[_0x27ff('0x19')](_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x19')]);}_0x3175b6[_0x27ff('0x38')]=qs[_0x27ff('0x39')](_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x39')]);_0x3175b6[_0x27ff('0x3a')]=qs[_0x27ff('0x31')](_[_0x27ff('0x3b')](_0x152d4f[_0x27ff('0x2f')],_0x1324f5[_0x27ff('0x31')]),_0x18b844);if(_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x3c')]){_0x3175b6[_0x27ff('0x3a')]=_[_0x27ff('0x3d')](_0x3175b6['where'],{'$or':_[_0x27ff('0x29')](_0x18b844,function(_0x4abb47){if(_0x4abb47['type']!=='VIRTUAL'){var _0x1e9134={};_0x1e9134[_0x4abb47[_0x27ff('0x26')]]={'$like':'%'+_0x152d4f['query'][_0x27ff('0x3c')]+'%'};return _0x1e9134;}})});}_0x3175b6=_[_0x27ff('0x3d')]({},_0x3175b6,_0x152d4f[_0x27ff('0x3e')]);var _0x10c3f3={'where':_0x3175b6['where']};return db[_0x27ff('0x2a')][_0x27ff('0x1c')](_0x10c3f3)['then'](function(_0xf9ee54){_0x52ee8f[_0x27ff('0x1c')]=_0xf9ee54;if(_0x152d4f[_0x27ff('0x2f')][_0x27ff('0x3f')]){_0x3175b6[_0x27ff('0x40')]=[{'all':!![]}];}return db[_0x27ff('0x2a')]['findAll'](_0x3175b6);})[_0x27ff('0x22')](function(_0x3c2e11){_0x52ee8f[_0x27ff('0x41')]=_0x3c2e11;return _0x52ee8f;})[_0x27ff('0x22')](respondWithFilteredResult(_0x3d9664,_0x3175b6))[_0x27ff('0x42')](handleError(_0x3d9664,null));};exports['show']=function(_0x5e8b27,_0x4d7815){var _0x3f32e1={'raw':!![],'where':{'id':_0x5e8b27['params']['id']}},_0x1b2466={};_0x1b2466[_0x27ff('0x2e')]=_['keys'](db[_0x27ff('0x2a')][_0x27ff('0x2b')]);_0x1b2466[_0x27ff('0x2f')]=_['keys'](_0x5e8b27[_0x27ff('0x2f')]);_0x1b2466[_0x27ff('0x31')]=_[_0x27ff('0x32')](_0x1b2466['model'],_0x1b2466['query']);_0x3f32e1[_0x27ff('0x33')]=_['intersection'](_0x1b2466[_0x27ff('0x2e')],qs[_0x27ff('0x34')](_0x5e8b27[_0x27ff('0x2f')]['fields']));_0x3f32e1[_0x27ff('0x33')]=_0x3f32e1[_0x27ff('0x33')][_0x27ff('0x35')]?_0x3f32e1[_0x27ff('0x33')]:_0x1b2466[_0x27ff('0x2e')];if(_0x5e8b27[_0x27ff('0x2f')][_0x27ff('0x3f')]){_0x3f32e1['include']=[{'all':!![]}];}_0x3f32e1=_[_0x27ff('0x3d')]({},_0x3f32e1,_0x5e8b27['options']);return db[_0x27ff('0x2a')]['find'](_0x3f32e1)[_0x27ff('0x22')](handleEntityNotFound(_0x4d7815,null))[_0x27ff('0x22')](respondWithResult(_0x4d7815,null))[_0x27ff('0x42')](handleError(_0x4d7815,null));};exports['create']=function(_0x44a054,_0x2320b5){return db['SquareReport'][_0x27ff('0x43')](_0x44a054['body'],{})[_0x27ff('0x22')](respondWithResult(_0x2320b5,0xc9))['catch'](handleError(_0x2320b5,null));};exports['update']=function(_0x1d97a5,_0x5b6f51){if(_0x1d97a5['body']['id']){delete _0x1d97a5[_0x27ff('0x44')]['id'];}return db[_0x27ff('0x2a')][_0x27ff('0x45')]({'where':{'id':_0x1d97a5[_0x27ff('0x46')]['id']}})[_0x27ff('0x22')](handleEntityNotFound(_0x5b6f51,null))[_0x27ff('0x22')](saveUpdates(_0x1d97a5[_0x27ff('0x44')],null))[_0x27ff('0x22')](respondWithResult(_0x5b6f51,null))[_0x27ff('0x42')](handleError(_0x5b6f51,null));};exports[_0x27ff('0x23')]=function(_0xc94e,_0x3ee623){return db[_0x27ff('0x2a')][_0x27ff('0x45')]({'where':{'id':_0xc94e[_0x27ff('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ee623,null))[_0x27ff('0x22')](removeEntity(_0x3ee623,null))[_0x27ff('0x42')](handleError(_0x3ee623,null));};exports[_0x27ff('0x47')]=function(_0x3883d3,_0x37c83c){return db['SquareReport'][_0x27ff('0x47')]()['then'](respondWithResult(_0x37c83c,null))[_0x27ff('0x42')](handleError(_0x37c83c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5a4e3f0..46f1b8b 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 _0xdb4f=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util','../../config/logger','moment','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x45f68b,_0x8fc70d){var _0x3c470a=function(_0x493684){while(--_0x493684){_0x45f68b['push'](_0x45f68b['shift']());}};_0x3c470a(++_0x8fc70d);}(_0xdb4f,0xd6));var _0xfdb4=function(_0x3c2722,_0x1c4748){_0x3c2722=_0x3c2722-0x0;var _0x99c954=_0xdb4f[_0x3c2722];return _0x99c954;};'use strict';var _=require('lodash');var util=require(_0xfdb4('0x0'));var logger=require(_0xfdb4('0x1'))('api');var moment=require(_0xfdb4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdb4('0x3'));var attributes=require(_0xfdb4('0x4'));module[_0xfdb4('0x5')]=function(_0x2bcce8,_0x3b573e){return _0x2bcce8[_0xfdb4('0x6')](_0xfdb4('0x7'),attributes,{'tableName':_0xfdb4('0x8'),'paranoid':![],'indexes':[{'name':_0xfdb4('0x9'),'fields':[_0xfdb4('0xa'),_0xfdb4('0xb')]},{'name':_0xfdb4('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x35ad=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x80ecfc,_0x26160a){var _0x243f01=function(_0x2b50e5){while(--_0x2b50e5){_0x80ecfc['push'](_0x80ecfc['shift']());}};_0x243f01(++_0x26160a);}(_0x35ad,0x13b));var _0xd35a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x35ad[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xd35a('0x0'));var util=require(_0xd35a('0x1'));var logger=require(_0xd35a('0x2'))(_0xd35a('0x3'));var moment=require('moment');var BPromise=require(_0xd35a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd35a('0x5'));var rimraf=require(_0xd35a('0x6'));var config=require(_0xd35a('0x7'));var attributes=require(_0xd35a('0x8'));module[_0xd35a('0x9')]=function(_0xa1d192,_0x3db44a){return _0xa1d192[_0xd35a('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xd35a('0xb'),'fields':[_0xd35a('0xc'),_0xd35a('0xd')]},{'name':_0xd35a('0xe'),'fields':[_0xd35a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d0fd0d0..6467d70 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 _0xbb9d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SquareReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','options','raw','then','CreateSquareReport','update','body','where','UpdateSquareReport','lodash','util','moment','bluebird','randomstring'];(function(_0x49da8d,_0x16590e){var _0x2729b5=function(_0xe31f31){while(--_0xe31f31){_0x49da8d['push'](_0x49da8d['shift']());}};_0x2729b5(++_0x16590e);}(_0xbb9d,0x10b));var _0xdbb9=function(_0x514f32,_0x51e8f9){_0x514f32=_0x514f32-0x0;var _0x534c29=_0xbb9d[_0x514f32];return _0x534c29;};'use strict';var _=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var moment=require(_0xdbb9('0x2'));var BPromise=require(_0xdbb9('0x3'));var rs=require(_0xdbb9('0x4'));var fs=require('fs');var Redis=require(_0xdbb9('0x5'));var db=require(_0xdbb9('0x6'))['db'];var utils=require(_0xdbb9('0x7'));var logger=require(_0xdbb9('0x8'))(_0xdbb9('0x9'));var config=require(_0xdbb9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xdbb9('0xb')][_0xdbb9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b0e61,_0x54c81b,_0x5b4952){return new BPromise(function(_0x574971,_0x4d1289){return client[_0xdbb9('0xd')](_0x2b0e61,_0x5b4952)['then'](function(_0x5d5044){logger[_0xdbb9('0xe')](_0xdbb9('0xf'),_0x54c81b,'request\x20sent');logger[_0xdbb9('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x54c81b,_0xdbb9('0x11'),JSON[_0xdbb9('0x12')](_0x5d5044));if(_0x5d5044[_0xdbb9('0x13')]){if(_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x14')]===0x1f4){logger[_0xdbb9('0x13')]('SquareReport,\x20%s,\x20%s',_0x54c81b,_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x15')]);return _0x4d1289(_0x5d5044[_0xdbb9('0x13')]['message']);}logger[_0xdbb9('0x13')](_0xdbb9('0xf'),_0x54c81b,_0x5d5044['error'][_0xdbb9('0x15')]);return _0x574971(_0x5d5044[_0xdbb9('0x13')][_0xdbb9('0x15')]);}else{logger[_0xdbb9('0xe')]('SquareReport,\x20%s,\x20%s',_0x54c81b,_0xdbb9('0x11'));_0x574971(_0x5d5044[_0xdbb9('0x16')]['message']);}})[_0xdbb9('0x17')](function(_0x500c09){logger[_0xdbb9('0x13')](_0xdbb9('0xf'),_0x54c81b,_0x500c09);_0x4d1289(_0x500c09);});});}exports['CreateSquareReport']=function(_0x173c12){var _0x2bbf34=this;return new Promise(function(_0x3173c1,_0xaebbf8){return db[_0xdbb9('0x18')][_0xdbb9('0x19')](_0x173c12['body'],{'raw':_0x173c12[_0xdbb9('0x1a')]?_0x173c12['options'][_0xdbb9('0x1b')]===undefined?!![]:![]:!![]})[_0xdbb9('0x1c')](function(_0x3e901a){logger[_0xdbb9('0xe')](_0xdbb9('0x1d'),_0x173c12);logger[_0xdbb9('0x10')]('CreateSquareReport',_0x173c12,JSON['stringify'](_0x3e901a));_0x3173c1(_0x3e901a);})[_0xdbb9('0x17')](function(_0x2619a4){logger['error'](_0xdbb9('0x1d'),_0x2619a4[_0xdbb9('0x15')],_0x173c12);_0xaebbf8(_0x2bbf34[_0xdbb9('0x13')](0x1f4,_0x2619a4['message']));});});};exports['UpdateSquareReport']=function(_0x41b069){var _0x42e0de=this;return new Promise(function(_0x3dd91d,_0x16f29e){return db[_0xdbb9('0x18')][_0xdbb9('0x1e')](_0x41b069[_0xdbb9('0x1f')],{'raw':_0x41b069['options']?_0x41b069[_0xdbb9('0x1a')][_0xdbb9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')][_0xdbb9('0x20')]||null:null,'attributes':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')]['attributes']||null:null,'limit':_0x41b069[_0xdbb9('0x1a')]?_0x41b069[_0xdbb9('0x1a')]['limit']||null:null})['then'](function(_0x4b2ac8){logger['info'](_0xdbb9('0x21'),_0x41b069);logger[_0xdbb9('0x10')]('UpdateSquareReport',_0x41b069,JSON[_0xdbb9('0x12')](_0x4b2ac8));_0x3dd91d(_0x4b2ac8);})[_0xdbb9('0x17')](function(_0x5ee796){logger[_0xdbb9('0x13')](_0xdbb9('0x21'),_0x5ee796[_0xdbb9('0x15')],_0x41b069);_0x16f29e(_0x42e0de[_0xdbb9('0x13')](0x1f4,_0x5ee796[_0xdbb9('0x15')]));});});}; \ No newline at end of file +var _0x289f=['ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','SquareReport','body','options','raw','CreateSquareReport','stringify','UpdateSquareReport','update','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x39a6a4,_0x61de91){var _0xcdc577=function(_0x90f69a){while(--_0x90f69a){_0x39a6a4['push'](_0x39a6a4['shift']());}};_0xcdc577(++_0x61de91);}(_0x289f,0x128));var _0xf289=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x289f[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xf289('0x0'));var util=require(_0xf289('0x1'));var moment=require('moment');var BPromise=require(_0xf289('0x2'));var rs=require(_0xf289('0x3'));var fs=require('fs');var Redis=require(_0xf289('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf289('0x5'));var config=require(_0xf289('0x6'));var jayson=require(_0xf289('0x7'));var client=jayson[_0xf289('0x8')][_0xf289('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x322a22,_0xb3c0dc,_0x2da280){return new BPromise(function(_0x34ea03,_0x384412){return client['request'](_0x322a22,_0x2da280)[_0xf289('0xa')](function(_0x8ec152){logger[_0xf289('0xb')](_0xf289('0xc'),_0xb3c0dc,_0xf289('0xd'));logger[_0xf289('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xb3c0dc,'request\x20sent',JSON['stringify'](_0x8ec152));if(_0x8ec152[_0xf289('0xf')]){if(_0x8ec152['error'][_0xf289('0x10')]===0x1f4){logger['error'](_0xf289('0xc'),_0xb3c0dc,_0x8ec152[_0xf289('0xf')]['message']);return _0x384412(_0x8ec152[_0xf289('0xf')][_0xf289('0x11')]);}logger[_0xf289('0xf')](_0xf289('0xc'),_0xb3c0dc,_0x8ec152[_0xf289('0xf')][_0xf289('0x11')]);return _0x34ea03(_0x8ec152[_0xf289('0xf')]['message']);}else{logger['info'](_0xf289('0xc'),_0xb3c0dc,_0xf289('0xd'));_0x34ea03(_0x8ec152['result'][_0xf289('0x11')]);}})[_0xf289('0x12')](function(_0x8dce48){logger[_0xf289('0xf')](_0xf289('0xc'),_0xb3c0dc,_0x8dce48);_0x384412(_0x8dce48);});});}exports['CreateSquareReport']=function(_0x2df594){var _0x44fdab=this;return new Promise(function(_0x4ba7d8,_0x231814){return db[_0xf289('0x13')]['create'](_0x2df594[_0xf289('0x14')],{'raw':_0x2df594[_0xf289('0x15')]?_0x2df594[_0xf289('0x15')][_0xf289('0x16')]===undefined?!![]:![]:!![]})[_0xf289('0xa')](function(_0xb8117a){logger[_0xf289('0xb')](_0xf289('0x17'),_0x2df594);logger[_0xf289('0xe')](_0xf289('0x17'),_0x2df594,JSON[_0xf289('0x18')](_0xb8117a));_0x4ba7d8(_0xb8117a);})[_0xf289('0x12')](function(_0x3d8ab1){logger[_0xf289('0xf')](_0xf289('0x17'),_0x3d8ab1['message'],_0x2df594);_0x231814(_0x44fdab['error'](0x1f4,_0x3d8ab1['message']));});});};exports[_0xf289('0x19')]=function(_0x290dae){var _0x230882=this;return new Promise(function(_0x475aa6,_0x35d49){return db[_0xf289('0x13')][_0xf289('0x1a')](_0x290dae['body'],{'raw':_0x290dae['options']?_0x290dae[_0xf289('0x15')][_0xf289('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290dae[_0xf289('0x15')]?_0x290dae[_0xf289('0x15')][_0xf289('0x1b')]||null:null,'attributes':_0x290dae[_0xf289('0x15')]?_0x290dae['options'][_0xf289('0x1c')]||null:null,'limit':_0x290dae[_0xf289('0x15')]?_0x290dae[_0xf289('0x15')][_0xf289('0x1d')]||null:null})['then'](function(_0x1ca49b){logger[_0xf289('0xb')](_0xf289('0x19'),_0x290dae);logger['debug'](_0xf289('0x19'),_0x290dae,JSON[_0xf289('0x18')](_0x1ca49b));_0x475aa6(_0x1ca49b);})[_0xf289('0x12')](function(_0x2eee88){logger['error']('UpdateSquareReport',_0x2eee88[_0xf289('0x11')],_0x290dae);_0x35d49(_0x230882[_0xf289('0xf')](0x1f4,_0x2eee88['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e08cdd1..236276d 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 _0xe5a8=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xe5a8,0x64));var _0x8e5a=function(_0x5a907b,_0x142a25){_0x5a907b=_0x5a907b-0x0;var _0x40f067=_0xe5a8[_0x5a907b];return _0x40f067;};'use strict';var multer=require(_0x8e5a('0x0'));var util=require('util');var path=require(_0x8e5a('0x1'));var timeout=require(_0x8e5a('0x2'));var express=require(_0x8e5a('0x3'));var router=express[_0x8e5a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8e5a('0x5'));var config=require(_0x8e5a('0x6'));var controller=require('./squareReportDetail.controller');router[_0x8e5a('0x7')]('/',auth[_0x8e5a('0x8')](),controller['index']);router['get'](_0x8e5a('0x9'),auth['isAuthenticated'](),controller[_0x8e5a('0xa')]);router[_0x8e5a('0x7')](_0x8e5a('0xb'),auth[_0x8e5a('0x8')](),controller[_0x8e5a('0xc')]);router[_0x8e5a('0xd')]('/',auth[_0x8e5a('0x8')](),controller[_0x8e5a('0xe')]);router[_0x8e5a('0xf')](_0x8e5a('0xb'),auth[_0x8e5a('0x8')](),controller[_0x8e5a('0x10')]);router[_0x8e5a('0x11')]('/:id',auth[_0x8e5a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8924=['index','/describe','isAuthenticated','describe','get','post','create','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x44dca7,_0x1aec74){var _0x56b40f=function(_0xbc05ca){while(--_0xbc05ca){_0x44dca7['push'](_0x44dca7['shift']());}};_0x56b40f(++_0x1aec74);}(_0x8924,0xb6));var _0x4892=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x8924[_0x45806b];return _0x3e228e;};'use strict';var multer=require('multer');var util=require(_0x4892('0x0'));var path=require(_0x4892('0x1'));var timeout=require(_0x4892('0x2'));var express=require(_0x4892('0x3'));var router=express['Router']();var fs_extra=require(_0x4892('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4892('0x5'));var config=require(_0x4892('0x6'));var controller=require(_0x4892('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4892('0x8')]);router['get'](_0x4892('0x9'),auth[_0x4892('0xa')](),controller[_0x4892('0xb')]);router[_0x4892('0xc')]('/:id',auth[_0x4892('0xa')](),controller['show']);router[_0x4892('0xd')]('/',auth[_0x4892('0xa')](),controller[_0x4892('0xe')]);router['put'](_0x4892('0xf'),auth[_0x4892('0xa')](),controller[_0x4892('0x10')]);router[_0x4892('0x11')](_0x4892('0xf'),auth[_0x4892('0xa')](),controller['destroy']);module[_0x4892('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4b663ca..b551808 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 _0x829f=['exports','STRING'];(function(_0x549d00,_0x5e5d79){var _0x248617=function(_0x4ba607){while(--_0x4ba607){_0x549d00['push'](_0x549d00['shift']());}};_0x248617(++_0x5e5d79);}(_0x829f,0x142));var _0xf829=function(_0x7b392a,_0x4c5bae){_0x7b392a=_0x7b392a-0x0;var _0x345400=_0x829f[_0x7b392a];return _0x345400;};'use strict';var Sequelize=require('sequelize');module[_0xf829('0x0')]={'uniqueid':{'type':Sequelize[_0xf829('0x1')]},'node':{'type':Sequelize[_0xf829('0x1')]},'application':{'type':Sequelize[_0xf829('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf829('0x1')]}}; \ No newline at end of file +var _0xee39=['exports','STRING','TEXT','sequelize'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xee39,0x1cb));var _0x9ee3=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0xee39[_0x2aa48b];return _0x48caf8;};'use strict';var Sequelize=require(_0x9ee3('0x0'));module[_0x9ee3('0x1')]={'uniqueid':{'type':Sequelize[_0x9ee3('0x2')]},'node':{'type':Sequelize[_0x9ee3('0x2')]},'application':{'type':Sequelize[_0x9ee3('0x2')]},'data':{'type':Sequelize[_0x9ee3('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9ee3('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c41d41c..1573996 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 _0xaa3c=['end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','catch','create','body','destroy','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x471ac7,_0x5c96da){var _0xe5b9b3=function(_0x459834){while(--_0x459834){_0x471ac7['push'](_0x471ac7['shift']());}};_0xe5b9b3(++_0x5c96da);}(_0xaa3c,0x120));var _0xcaa3=function(_0x42889a,_0x153e84){_0x42889a=_0x42889a-0x0;var _0x4022d0=_0xaa3c[_0x42889a];return _0x4022d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaa3('0x0'));var zipdir=require(_0xcaa3('0x1'));var jsonpatch=require(_0xcaa3('0x2'));var rp=require(_0xcaa3('0x3'));var moment=require(_0xcaa3('0x4'));var BPromise=require(_0xcaa3('0x5'));var Mustache=require(_0xcaa3('0x6'));var util=require('util');var path=require(_0xcaa3('0x7'));var sox=require(_0xcaa3('0x8'));var csv=require(_0xcaa3('0x9'));var ejs=require(_0xcaa3('0xa'));var fs=require('fs');var fs_extra=require(_0xcaa3('0xb'));var _=require(_0xcaa3('0xc'));var squel=require(_0xcaa3('0xd'));var crypto=require(_0xcaa3('0xe'));var jsforce=require(_0xcaa3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcaa3('0x9'));var querystring=require(_0xcaa3('0x10'));var Papa=require('papaparse');var Redis=require(_0xcaa3('0x11'));var authService=require(_0xcaa3('0x12'));var qs=require(_0xcaa3('0x13'));var as=require(_0xcaa3('0x14'));var hardwareService=require(_0xcaa3('0x15'));var logger=require(_0xcaa3('0x16'))(_0xcaa3('0x17'));var utils=require(_0xcaa3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcaa3('0x19'));var db=require(_0xcaa3('0x1a'))['db'];function respondWithStatusCode(_0xed27d2,_0x126a5d){_0x126a5d=_0x126a5d||0xcc;return function(_0x82cfcb){if(_0x82cfcb){return _0xed27d2[_0xcaa3('0x1b')](_0x126a5d);}return _0xed27d2['status'](_0x126a5d)[_0xcaa3('0x1c')]();};}function respondWithResult(_0x58736e,_0x5dd078){_0x5dd078=_0x5dd078||0xc8;return function(_0x24838e){if(_0x24838e){return _0x58736e[_0xcaa3('0x1d')](_0x5dd078)['json'](_0x24838e);}};}function respondWithFilteredResult(_0x35bb68,_0xd4a2a2){return function(_0xd79a93){if(_0xd79a93){var _0x2e452d=typeof _0xd4a2a2[_0xcaa3('0x1e')]===_0xcaa3('0x1f')&&typeof _0xd4a2a2[_0xcaa3('0x20')]===_0xcaa3('0x1f');var _0x58556a=_0xd79a93[_0xcaa3('0x21')];var _0x4d0769=_0x2e452d?0x0:_0xd4a2a2['offset'];var _0x55ad3d=_0x2e452d?_0xd79a93[_0xcaa3('0x21')]:_0xd4a2a2[_0xcaa3('0x1e')]+_0xd4a2a2['limit'];var _0x4de7e9;if(_0x55ad3d>=_0x58556a){_0x55ad3d=_0x58556a;_0x4de7e9=0xc8;}else{_0x4de7e9=0xce;}_0x35bb68[_0xcaa3('0x1d')](_0x4de7e9);return _0x35bb68[_0xcaa3('0x22')](_0xcaa3('0x23'),_0x4d0769+'-'+_0x55ad3d+'/'+_0x58556a)[_0xcaa3('0x24')](_0xd79a93);}return null;};}function patchUpdates(_0x3e2d66){return function(_0x21220f){try{jsonpatch['apply'](_0x21220f,_0x3e2d66,!![]);}catch(_0x1f11b9){return BPromise[_0xcaa3('0x25')](_0x1f11b9);}return _0x21220f[_0xcaa3('0x26')]();};}function saveUpdates(_0x36b931,_0x2512fc){return function(_0x1bbbf7){if(_0x1bbbf7){return _0x1bbbf7[_0xcaa3('0x27')](_0x36b931)[_0xcaa3('0x28')](function(_0x53a506){return _0x53a506;});}return null;};}function removeEntity(_0x1157a9,_0x22a8d0){return function(_0x32f4da){if(_0x32f4da){return _0x32f4da['destroy']()[_0xcaa3('0x28')](function(){_0x1157a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fcf64,_0x314084){return function(_0x459f47){if(!_0x459f47){_0x7fcf64[_0xcaa3('0x1b')](0x194);}return _0x459f47;};}function handleError(_0x48d5a1,_0x44983e){_0x44983e=_0x44983e||0x1f4;return function(_0x5c5a16){logger[_0xcaa3('0x29')](_0x5c5a16[_0xcaa3('0x2a')]);if(_0x5c5a16[_0xcaa3('0x2b')]){delete _0x5c5a16[_0xcaa3('0x2b')];}_0x48d5a1[_0xcaa3('0x1d')](_0x44983e)[_0xcaa3('0x2c')](_0x5c5a16);};}exports['index']=function(_0x5f201f,_0x307cef){var _0x46b4de={},_0x3b0f73={},_0x4c7c0c={'count':0x0,'rows':[]};var _0x15a5ff=_[_0xcaa3('0x2d')](db[_0xcaa3('0x2e')][_0xcaa3('0x2f')],function(_0x594694){return{'name':_0x594694[_0xcaa3('0x30')],'type':_0x594694[_0xcaa3('0x31')][_0xcaa3('0x32')]};});_0x3b0f73[_0xcaa3('0x33')]=_[_0xcaa3('0x2d')](_0x15a5ff,_0xcaa3('0x2b'));_0x3b0f73[_0xcaa3('0x34')]=_['keys'](_0x5f201f[_0xcaa3('0x34')]);_0x3b0f73[_0xcaa3('0x35')]=_[_0xcaa3('0x36')](_0x3b0f73['model'],_0x3b0f73['query']);_0x46b4de['attributes']=_[_0xcaa3('0x36')](_0x3b0f73[_0xcaa3('0x33')],qs[_0xcaa3('0x37')](_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x37')]));_0x46b4de[_0xcaa3('0x38')]=_0x46b4de[_0xcaa3('0x38')][_0xcaa3('0x39')]?_0x46b4de[_0xcaa3('0x38')]:_0x3b0f73['model'];if(!_0x5f201f['query'][_0xcaa3('0x3a')]('nolimit')){_0x46b4de[_0xcaa3('0x20')]=qs[_0xcaa3('0x20')](_0x5f201f[_0xcaa3('0x34')]['limit']);_0x46b4de[_0xcaa3('0x1e')]=qs[_0xcaa3('0x1e')](_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x1e')]);}_0x46b4de[_0xcaa3('0x3b')]=qs[_0xcaa3('0x3c')](_0x5f201f['query'][_0xcaa3('0x3c')]);_0x46b4de['where']=qs['filters'](_[_0xcaa3('0x3d')](_0x5f201f[_0xcaa3('0x34')],_0x3b0f73[_0xcaa3('0x35')]),_0x15a5ff);if(_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x3e')]){_0x46b4de[_0xcaa3('0x3f')]=_[_0xcaa3('0x40')](_0x46b4de[_0xcaa3('0x3f')],{'$or':_[_0xcaa3('0x2d')](_0x15a5ff,function(_0x41a55c){if(_0x41a55c[_0xcaa3('0x31')]!==_0xcaa3('0x41')){var _0x1bbd57={};_0x1bbd57[_0x41a55c[_0xcaa3('0x2b')]]={'$like':'%'+_0x5f201f[_0xcaa3('0x34')][_0xcaa3('0x3e')]+'%'};return _0x1bbd57;}})});}_0x46b4de=_[_0xcaa3('0x40')]({},_0x46b4de,_0x5f201f[_0xcaa3('0x42')]);var _0x1f6fff={'where':_0x46b4de[_0xcaa3('0x3f')]};return db[_0xcaa3('0x2e')][_0xcaa3('0x21')](_0x1f6fff)[_0xcaa3('0x28')](function(_0x13d23b){_0x4c7c0c[_0xcaa3('0x21')]=_0x13d23b;if(_0x5f201f['query'][_0xcaa3('0x43')]){_0x46b4de[_0xcaa3('0x44')]=[{'all':!![]}];}return db[_0xcaa3('0x2e')]['findAll'](_0x46b4de);})[_0xcaa3('0x28')](function(_0x7a2b47){_0x4c7c0c[_0xcaa3('0x45')]=_0x7a2b47;return _0x4c7c0c;})['then'](respondWithFilteredResult(_0x307cef,_0x46b4de))['catch'](handleError(_0x307cef,null));};exports[_0xcaa3('0x46')]=function(_0x5d9899,_0x44081b){var _0xe49338={'raw':!![],'where':{'id':_0x5d9899['params']['id']}},_0x35f96a={};_0x35f96a[_0xcaa3('0x33')]=_[_0xcaa3('0x47')](db[_0xcaa3('0x2e')][_0xcaa3('0x2f')]);_0x35f96a[_0xcaa3('0x34')]=_[_0xcaa3('0x47')](_0x5d9899[_0xcaa3('0x34')]);_0x35f96a[_0xcaa3('0x35')]=_[_0xcaa3('0x36')](_0x35f96a[_0xcaa3('0x33')],_0x35f96a[_0xcaa3('0x34')]);_0xe49338['attributes']=_[_0xcaa3('0x36')](_0x35f96a['model'],qs[_0xcaa3('0x37')](_0x5d9899[_0xcaa3('0x34')][_0xcaa3('0x37')]));_0xe49338['attributes']=_0xe49338[_0xcaa3('0x38')]['length']?_0xe49338[_0xcaa3('0x38')]:_0x35f96a['model'];if(_0x5d9899['query']['includeAll']){_0xe49338[_0xcaa3('0x44')]=[{'all':!![]}];}_0xe49338=_[_0xcaa3('0x40')]({},_0xe49338,_0x5d9899[_0xcaa3('0x42')]);return db[_0xcaa3('0x2e')][_0xcaa3('0x48')](_0xe49338)[_0xcaa3('0x28')](handleEntityNotFound(_0x44081b,null))['then'](respondWithResult(_0x44081b,null))[_0xcaa3('0x49')](handleError(_0x44081b,null));};exports[_0xcaa3('0x4a')]=function(_0x58b562,_0x137929){return db[_0xcaa3('0x2e')]['create'](_0x58b562[_0xcaa3('0x4b')],{})[_0xcaa3('0x28')](respondWithResult(_0x137929,0xc9))[_0xcaa3('0x49')](handleError(_0x137929,null));};exports[_0xcaa3('0x27')]=function(_0x44fa0c,_0x295cba){if(_0x44fa0c[_0xcaa3('0x4b')]['id']){delete _0x44fa0c['body']['id'];}return db[_0xcaa3('0x2e')]['find']({'where':{'id':_0x44fa0c['params']['id']}})[_0xcaa3('0x28')](handleEntityNotFound(_0x295cba,null))['then'](saveUpdates(_0x44fa0c[_0xcaa3('0x4b')],null))[_0xcaa3('0x28')](respondWithResult(_0x295cba,null))[_0xcaa3('0x49')](handleError(_0x295cba,null));};exports[_0xcaa3('0x4c')]=function(_0x46fa8c,_0x52a651){return db[_0xcaa3('0x2e')]['find']({'where':{'id':_0x46fa8c[_0xcaa3('0x4d')]['id']}})[_0xcaa3('0x28')](handleEntityNotFound(_0x52a651,null))['then'](removeEntity(_0x52a651,null))[_0xcaa3('0x49')](handleError(_0x52a651,null));};exports[_0xcaa3('0x4e')]=function(_0x32cd12,_0x4c2da5){return db[_0xcaa3('0x2e')][_0xcaa3('0x4e')]()[_0xcaa3('0x28')](respondWithResult(_0x4c2da5,null))[_0xcaa3('0x49')](handleError(_0x4c2da5,null));}; \ No newline at end of file +var _0xc327=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','SquareDetailsReport','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index'];(function(_0xd13969,_0x26c2a8){var _0x44d388=function(_0x48a942){while(--_0x48a942){_0xd13969['push'](_0xd13969['shift']());}};_0x44d388(++_0x26c2a8);}(_0xc327,0x1e5));var _0x7c32=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc327[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c32('0x0'));var zipdir=require(_0x7c32('0x1'));var jsonpatch=require(_0x7c32('0x2'));var rp=require(_0x7c32('0x3'));var moment=require(_0x7c32('0x4'));var BPromise=require(_0x7c32('0x5'));var Mustache=require(_0x7c32('0x6'));var util=require(_0x7c32('0x7'));var path=require('path');var sox=require(_0x7c32('0x8'));var csv=require(_0x7c32('0x9'));var ejs=require(_0x7c32('0xa'));var fs=require('fs');var fs_extra=require(_0x7c32('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c32('0xc'));var jsforce=require(_0x7c32('0xd'));var deskjs=require(_0x7c32('0xe'));var toCsv=require(_0x7c32('0x9'));var querystring=require(_0x7c32('0xf'));var Papa=require(_0x7c32('0x10'));var Redis=require(_0x7c32('0x11'));var authService=require(_0x7c32('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7c32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7c32('0x14'));var licenseUtil=require(_0x7c32('0x15'));var db=require(_0x7c32('0x16'))['db'];function respondWithStatusCode(_0x2f4230,_0x5d03b4){_0x5d03b4=_0x5d03b4||0xcc;return function(_0x3f47cd){if(_0x3f47cd){return _0x2f4230['sendStatus'](_0x5d03b4);}return _0x2f4230[_0x7c32('0x17')](_0x5d03b4)[_0x7c32('0x18')]();};}function respondWithResult(_0xb4105,_0x5dc253){_0x5dc253=_0x5dc253||0xc8;return function(_0x2e46e1){if(_0x2e46e1){return _0xb4105[_0x7c32('0x17')](_0x5dc253)[_0x7c32('0x19')](_0x2e46e1);}};}function respondWithFilteredResult(_0x1cd27,_0x5890c3){return function(_0x328153){if(_0x328153){var _0x3f3286=typeof _0x5890c3[_0x7c32('0x1a')]===_0x7c32('0x1b')&&typeof _0x5890c3[_0x7c32('0x1c')]===_0x7c32('0x1b');var _0x4dd669=_0x328153[_0x7c32('0x1d')];var _0x55d6f8=_0x3f3286?0x0:_0x5890c3['offset'];var _0x1893d8=_0x3f3286?_0x328153['count']:_0x5890c3[_0x7c32('0x1a')]+_0x5890c3[_0x7c32('0x1c')];var _0x16f3a1;if(_0x1893d8>=_0x4dd669){_0x1893d8=_0x4dd669;_0x16f3a1=0xc8;}else{_0x16f3a1=0xce;}_0x1cd27['status'](_0x16f3a1);return _0x1cd27[_0x7c32('0x1e')](_0x7c32('0x1f'),_0x55d6f8+'-'+_0x1893d8+'/'+_0x4dd669)[_0x7c32('0x19')](_0x328153);}return null;};}function patchUpdates(_0x2bd98e){return function(_0x43671a){try{jsonpatch[_0x7c32('0x20')](_0x43671a,_0x2bd98e,!![]);}catch(_0x2b3bd7){return BPromise[_0x7c32('0x21')](_0x2b3bd7);}return _0x43671a[_0x7c32('0x22')]();};}function saveUpdates(_0x32b3e1,_0x2860f4){return function(_0x3c268c){if(_0x3c268c){return _0x3c268c['update'](_0x32b3e1)[_0x7c32('0x23')](function(_0x2f4f2f){return _0x2f4f2f;});}return null;};}function removeEntity(_0x3207a4,_0xfd7451){return function(_0x39c1df){if(_0x39c1df){return _0x39c1df['destroy']()[_0x7c32('0x23')](function(){_0x3207a4[_0x7c32('0x17')](0xcc)[_0x7c32('0x18')]();});}};}function handleEntityNotFound(_0x1c96f1,_0x4f0b00){return function(_0x45e9f6){if(!_0x45e9f6){_0x1c96f1['sendStatus'](0x194);}return _0x45e9f6;};}function handleError(_0x3d6b38,_0x18a67b){_0x18a67b=_0x18a67b||0x1f4;return function(_0x4f31f5){logger[_0x7c32('0x24')](_0x4f31f5[_0x7c32('0x25')]);if(_0x4f31f5[_0x7c32('0x26')]){delete _0x4f31f5['name'];}_0x3d6b38[_0x7c32('0x17')](_0x18a67b)['send'](_0x4f31f5);};}exports[_0x7c32('0x27')]=function(_0x15bbd3,_0x2192aa){var _0x17ec86={},_0x592a63={},_0x2efd2f={'count':0x0,'rows':[]};var _0x35721c=_['map'](db['SquareDetailsReport'][_0x7c32('0x28')],function(_0x2a4f90){return{'name':_0x2a4f90[_0x7c32('0x29')],'type':_0x2a4f90[_0x7c32('0x2a')][_0x7c32('0x2b')]};});_0x592a63[_0x7c32('0x2c')]=_['map'](_0x35721c,_0x7c32('0x26'));_0x592a63[_0x7c32('0x2d')]=_[_0x7c32('0x2e')](_0x15bbd3['query']);_0x592a63[_0x7c32('0x2f')]=_[_0x7c32('0x30')](_0x592a63['model'],_0x592a63['query']);_0x17ec86[_0x7c32('0x31')]=_[_0x7c32('0x30')](_0x592a63[_0x7c32('0x2c')],qs[_0x7c32('0x32')](_0x15bbd3[_0x7c32('0x2d')][_0x7c32('0x32')]));_0x17ec86[_0x7c32('0x31')]=_0x17ec86[_0x7c32('0x31')][_0x7c32('0x33')]?_0x17ec86['attributes']:_0x592a63[_0x7c32('0x2c')];if(!_0x15bbd3[_0x7c32('0x2d')]['hasOwnProperty'](_0x7c32('0x34'))){_0x17ec86[_0x7c32('0x1c')]=qs[_0x7c32('0x1c')](_0x15bbd3['query'][_0x7c32('0x1c')]);_0x17ec86[_0x7c32('0x1a')]=qs[_0x7c32('0x1a')](_0x15bbd3[_0x7c32('0x2d')]['offset']);}_0x17ec86['order']=qs[_0x7c32('0x35')](_0x15bbd3[_0x7c32('0x2d')][_0x7c32('0x35')]);_0x17ec86[_0x7c32('0x36')]=qs[_0x7c32('0x2f')](_[_0x7c32('0x37')](_0x15bbd3[_0x7c32('0x2d')],_0x592a63['filters']),_0x35721c);if(_0x15bbd3[_0x7c32('0x2d')][_0x7c32('0x38')]){_0x17ec86[_0x7c32('0x36')]=_[_0x7c32('0x39')](_0x17ec86[_0x7c32('0x36')],{'$or':_[_0x7c32('0x3a')](_0x35721c,function(_0x3a9387){if(_0x3a9387['type']!==_0x7c32('0x3b')){var _0x11e60e={};_0x11e60e[_0x3a9387['name']]={'$like':'%'+_0x15bbd3[_0x7c32('0x2d')][_0x7c32('0x38')]+'%'};return _0x11e60e;}})});}_0x17ec86=_[_0x7c32('0x39')]({},_0x17ec86,_0x15bbd3['options']);var _0x1c09a6={'where':_0x17ec86['where']};return db[_0x7c32('0x3c')]['count'](_0x1c09a6)[_0x7c32('0x23')](function(_0x2d9e0f){_0x2efd2f[_0x7c32('0x1d')]=_0x2d9e0f;if(_0x15bbd3['query']['includeAll']){_0x17ec86[_0x7c32('0x3d')]=[{'all':!![]}];}return db[_0x7c32('0x3c')][_0x7c32('0x3e')](_0x17ec86);})[_0x7c32('0x23')](function(_0x380182){_0x2efd2f[_0x7c32('0x3f')]=_0x380182;return _0x2efd2f;})['then'](respondWithFilteredResult(_0x2192aa,_0x17ec86))[_0x7c32('0x40')](handleError(_0x2192aa,null));};exports[_0x7c32('0x41')]=function(_0x504622,_0x33b4eb){var _0x598ef2={'raw':!![],'where':{'id':_0x504622[_0x7c32('0x42')]['id']}},_0x2b2bdf={};_0x2b2bdf['model']=_['keys'](db[_0x7c32('0x3c')]['rawAttributes']);_0x2b2bdf[_0x7c32('0x2d')]=_[_0x7c32('0x2e')](_0x504622[_0x7c32('0x2d')]);_0x2b2bdf[_0x7c32('0x2f')]=_['intersection'](_0x2b2bdf[_0x7c32('0x2c')],_0x2b2bdf[_0x7c32('0x2d')]);_0x598ef2['attributes']=_[_0x7c32('0x30')](_0x2b2bdf['model'],qs[_0x7c32('0x32')](_0x504622['query'][_0x7c32('0x32')]));_0x598ef2[_0x7c32('0x31')]=_0x598ef2['attributes'][_0x7c32('0x33')]?_0x598ef2[_0x7c32('0x31')]:_0x2b2bdf[_0x7c32('0x2c')];if(_0x504622['query'][_0x7c32('0x43')]){_0x598ef2['include']=[{'all':!![]}];}_0x598ef2=_[_0x7c32('0x39')]({},_0x598ef2,_0x504622[_0x7c32('0x44')]);return db[_0x7c32('0x3c')][_0x7c32('0x45')](_0x598ef2)[_0x7c32('0x23')](handleEntityNotFound(_0x33b4eb,null))['then'](respondWithResult(_0x33b4eb,null))[_0x7c32('0x40')](handleError(_0x33b4eb,null));};exports[_0x7c32('0x46')]=function(_0x25276f,_0x8a2f5a){return db[_0x7c32('0x3c')][_0x7c32('0x46')](_0x25276f[_0x7c32('0x47')],{})[_0x7c32('0x23')](respondWithResult(_0x8a2f5a,0xc9))[_0x7c32('0x40')](handleError(_0x8a2f5a,null));};exports[_0x7c32('0x48')]=function(_0x302ff5,_0x43d605){if(_0x302ff5[_0x7c32('0x47')]['id']){delete _0x302ff5[_0x7c32('0x47')]['id'];}return db[_0x7c32('0x3c')]['find']({'where':{'id':_0x302ff5[_0x7c32('0x42')]['id']}})[_0x7c32('0x23')](handleEntityNotFound(_0x43d605,null))['then'](saveUpdates(_0x302ff5['body'],null))['then'](respondWithResult(_0x43d605,null))['catch'](handleError(_0x43d605,null));};exports[_0x7c32('0x49')]=function(_0x142352,_0x3608d6){return db[_0x7c32('0x3c')][_0x7c32('0x45')]({'where':{'id':_0x142352[_0x7c32('0x42')]['id']}})['then'](handleEntityNotFound(_0x3608d6,null))[_0x7c32('0x23')](removeEntity(_0x3608d6,null))[_0x7c32('0x40')](handleError(_0x3608d6,null));};exports[_0x7c32('0x4a')]=function(_0x32f875,_0x4bb76d){return db[_0x7c32('0x3c')][_0x7c32('0x4a')]()['then'](respondWithResult(_0x4bb76d,null))[_0x7c32('0x40')](handleError(_0x4bb76d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index e68979e..26a4732 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 _0x7423=['SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2cba09,_0x23ee85){var _0x10d084=function(_0x11d2e4){while(--_0x11d2e4){_0x2cba09['push'](_0x2cba09['shift']());}};_0x10d084(++_0x23ee85);}(_0x7423,0x122));var _0x3742=function(_0x3fa02f,_0x332597){_0x3fa02f=_0x3fa02f-0x0;var _0x1b2d41=_0x7423[_0x3fa02f];return _0x1b2d41;};'use strict';var _=require(_0x3742('0x0'));var util=require('util');var logger=require(_0x3742('0x1'))(_0x3742('0x2'));var moment=require(_0x3742('0x3'));var BPromise=require(_0x3742('0x4'));var rp=require(_0x3742('0x5'));var fs=require('fs');var path=require(_0x3742('0x6'));var rimraf=require(_0x3742('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x3742('0x8')]=function(_0xebeb23,_0xfeb6a4){return _0xebeb23[_0x3742('0x9')](_0x3742('0xa'),attributes,{'tableName':_0x3742('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01f3=['rimraf','../../config/environment','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x01f3,0x8b));var _0x301f=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0x01f3[_0x57cb4f];return _0x29bb45;};'use strict';var _=require(_0x301f('0x0'));var util=require('util');var logger=require(_0x301f('0x1'))(_0x301f('0x2'));var moment=require('moment');var BPromise=require(_0x301f('0x3'));var rp=require(_0x301f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x301f('0x5'));var config=require(_0x301f('0x6'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x20ed06,_0x9959e){return _0x20ed06['define'](_0x301f('0x7'),attributes,{'tableName':_0x301f('0x8'),'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 09acd7c..7e59c27 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 _0x6a95=['message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57173f,_0x34c5d5){var _0x56b2a6=function(_0x369388){while(--_0x369388){_0x57173f['push'](_0x57173f['shift']());}};_0x56b2a6(++_0x34c5d5);}(_0x6a95,0x1db));var _0x56a9=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x6a95[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});}; \ No newline at end of file +var _0x0e56=['body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport'];(function(_0x117fb1,_0x4b9774){var _0x53db22=function(_0x4de034){while(--_0x4de034){_0x117fb1['push'](_0x117fb1['shift']());}};_0x53db22(++_0x4b9774);}(_0x0e56,0xf5));var _0x60e5=function(_0xd2c332,_0x1b5f38){_0xd2c332=_0xd2c332-0x0;var _0x4efc6f=_0x0e56[_0xd2c332];return _0x4efc6f;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['SquareDetailsReport']['create'](_0x12aee7[_0x60e5('0x19')],{'raw':_0x12aee7[_0x60e5('0x1a')]?_0x12aee7[_0x60e5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x60e5('0xc')](function(_0x68c78){logger[_0x60e5('0xd')](_0x60e5('0x18'),_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0x68c78));_0x51688a(_0x68c78);})[_0x60e5('0x17')](function(_0x443665){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0x443665['message'],_0x12aee7);_0x599dc4(_0x3060b6['error'](0x1f4,_0x443665[_0x60e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 38a8ede..aa2756f 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 _0xb150=['Router','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x34a223,_0x5b0fe9){var _0x4a9a0e=function(_0x2f109a){while(--_0x2f109a){_0x34a223['push'](_0x34a223['shift']());}};_0x4a9a0e(++_0x5b0fe9);}(_0xb150,0xa7));var _0x0b15=function(_0x38d18b,_0x56df34){_0x38d18b=_0x38d18b-0x0;var _0xc432e1=_0xb150[_0x38d18b];return _0xc432e1;};'use strict';var express=require(_0x0b15('0x0'));var router=express[_0x0b15('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x0b15('0x2')]('/',auth[_0x0b15('0x3')](),controller[_0x0b15('0x4')]);router[_0x0b15('0x2')](_0x0b15('0x5'),auth[_0x0b15('0x3')](),controller[_0x0b15('0x6')]);module[_0x0b15('0x7')]=router; \ No newline at end of file +var _0x6f43=['get','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','../../components/auth/service','./system.controller','index'];(function(_0x1d60d0,_0x2cfa88){var _0x1a0917=function(_0x24dc91){while(--_0x24dc91){_0x1d60d0['push'](_0x1d60d0['shift']());}};_0x1a0917(++_0x2cfa88);}(_0x6f43,0x1db));var _0x36f4=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x6f43[_0x1f7413];return _0x2d2775;};'use strict';var express=require(_0x36f4('0x0'));var router=express[_0x36f4('0x1')]();var auth=require(_0x36f4('0x2'));var controller=require(_0x36f4('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x36f4('0x4')]);router[_0x36f4('0x5')](_0x36f4('0x6'),auth[_0x36f4('0x7')](),controller[_0x36f4('0x8')]);module[_0x36f4('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 336cc57..aabee77 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 _0x552d=['inspect','name','status','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x29f0da,_0x216858){var _0x152cd8=function(_0x548240){while(--_0x548240){_0x29f0da['push'](_0x29f0da['shift']());}};_0x152cd8(++_0x216858);}(_0x552d,0x105));var _0xd552=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x552d[_0x4b369d];return _0x571a98;};'use strict';var info=require(_0xd552('0x0'));var exec=require(_0xd552('0x1'))[_0xd552('0x2')];var logger=require(_0xd552('0x3'))(_0xd552('0x4'));var util=require(_0xd552('0x5'));var BPromise=require('bluebird');var _=require(_0xd552('0x6'));function handleError(_0x5c2bb9,_0x3192d0,_0x447003){_0x3192d0=_0x3192d0||0x1f4;return function(_0x5aea67){logger[_0xd552('0x7')](_0xd552('0x8'),_0x447003,_0x3192d0,util[_0xd552('0x9')](_0x5aea67,{'showHidden':![],'depth':null}));delete _0x5aea67[_0xd552('0xa')];_0x5c2bb9[_0xd552('0xb')](_0x3192d0)['send'](_0x5aea67);};}exports['index']=function(_0x41388e,_0x4e7abf){return info[_0xd552('0xc')]()[_0xd552('0xd')](function(_0x13cd9f){return _0x4e7abf['status'](0xc8)[_0xd552('0xe')](_0x13cd9f);})[_0xd552('0xf')](function(_0x2527b1){return _0x4e7abf[_0xd552('0xb')](0x1f4)[_0xd552('0xe')](_0x2527b1);});};exports[_0xd552('0x10')]=function(_0xb9d5e2,_0x1b24ea){var _0x50ced6=[_0xd552('0x11')];return new BPromise(function(_0x53d300,_0x23a09d){return exec(util[_0xd552('0x12')](_0xd552('0x13'),_0xb9d5e2[_0xd552('0x14')][_0xd552('0x15')]),function(_0x5bb048,_0x2b86ad,_0x5cbfad){if(_0x5bb048){return _0x23a09d(_0x5bb048);}return _0x53d300(_0x2b86ad);});})['then'](function(_0x58964e){var _0x5354a2=![];var _0xa4f83a=_0x58964e[_0xd552('0x16')](/\n/);for(var _0x44228c=0x0,_0xfea99d=_0x50ced6['length'];_0x44228c<_0xfea99d,_0x5354a2===![];_0x44228c+=0x1){if(_0x58964e['indexOf'](_0x50ced6[_0x44228c])>=0x0){_0x5354a2=!![];}}if(!_0x5354a2){throw new Error(util[_0xd552('0x12')](_0xd552('0x17'),_0xb9d5e2[_0xd552('0x14')][_0xd552('0x15')]));}process[_0xd552('0x18')](_0xb9d5e2['params']['pid'],_0xd552('0x19'));return _0x1b24ea[_0xd552('0xb')](0xc8)[_0xd552('0xe')]({'message':util[_0xd552('0x12')](_0xd552('0x1a'),_0xb9d5e2['params'][_0xd552('0x15')])});})['catch'](handleError(_0x1b24ea,null,_0xd552('0x10')));}; \ No newline at end of file +var _0x5bc8=['catch','components/import/cm','format','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','json'];(function(_0x3e1ec9,_0x383138){var _0x257e53=function(_0x58e110){while(--_0x58e110){_0x3e1ec9['push'](_0x3e1ec9['shift']());}};_0x257e53(++_0x383138);}(_0x5bc8,0x10f));var _0x85bc=function(_0x43a5c7,_0x2286bf){_0x43a5c7=_0x43a5c7-0x0;var _0x3b12a2=_0x5bc8[_0x43a5c7];return _0x3b12a2;};'use strict';var info=require(_0x85bc('0x0'));var exec=require(_0x85bc('0x1'))[_0x85bc('0x2')];var logger=require(_0x85bc('0x3'))(_0x85bc('0x4'));var util=require('util');var BPromise=require(_0x85bc('0x5'));var _=require(_0x85bc('0x6'));function handleError(_0x2d43ce,_0x2811d1,_0x19798b){_0x2811d1=_0x2811d1||0x1f4;return function(_0x4a4c86){logger[_0x85bc('0x7')](_0x85bc('0x8'),_0x19798b,_0x2811d1,util[_0x85bc('0x9')](_0x4a4c86,{'showHidden':![],'depth':null}));delete _0x4a4c86[_0x85bc('0xa')];_0x2d43ce[_0x85bc('0xb')](_0x2811d1)['send'](_0x4a4c86);};}exports[_0x85bc('0xc')]=function(_0x53178f,_0x360c79){return info['getAllData']()[_0x85bc('0xd')](function(_0x7b54b5){return _0x360c79[_0x85bc('0xb')](0xc8)[_0x85bc('0xe')](_0x7b54b5);})[_0x85bc('0xf')](function(_0x49697b){return _0x360c79['status'](0x1f4)[_0x85bc('0xe')](_0x49697b);});};exports['killProcess']=function(_0x171d44,_0x1d20d3){var _0x10ff18=[_0x85bc('0x10')];return new BPromise(function(_0x568c90,_0x1ebfc9){return exec(util[_0x85bc('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x171d44[_0x85bc('0x12')]['pid']),function(_0x32b1da,_0x24adee,_0xf512c){if(_0x32b1da){return _0x1ebfc9(_0x32b1da);}return _0x568c90(_0x24adee);});})['then'](function(_0x5bf7b5){var _0x4bfa80=![];var _0x553eab=_0x5bf7b5['split'](/\n/);for(var _0x32f088=0x0,_0x5e69fa=_0x10ff18[_0x85bc('0x13')];_0x32f088<_0x5e69fa,_0x4bfa80===![];_0x32f088+=0x1){if(_0x5bf7b5[_0x85bc('0x14')](_0x10ff18[_0x32f088])>=0x0){_0x4bfa80=!![];}}if(!_0x4bfa80){throw new Error(util[_0x85bc('0x11')](_0x85bc('0x15'),_0x171d44[_0x85bc('0x12')]['pid']));}process[_0x85bc('0x16')](_0x171d44[_0x85bc('0x12')][_0x85bc('0x17')],_0x85bc('0x18'));return _0x1d20d3[_0x85bc('0xb')](0xc8)[_0x85bc('0xe')]({'message':util['format'](_0x85bc('0x19'),_0x171d44[_0x85bc('0x12')]['pid'])});})[_0x85bc('0xf')](handleError(_0x1d20d3,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 85e80fc..8e39613 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 _0xd597=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x5f0fec,_0x28ac8c){var _0x2c8388=function(_0x5c249d){while(--_0x5c249d){_0x5f0fec['push'](_0x5f0fec['shift']());}};_0x2c8388(++_0x28ac8c);}(_0xd597,0x94));var _0x7d59=function(_0xdff7e8,_0x4c11be){_0xdff7e8=_0xdff7e8-0x0;var _0x2fceef=_0xd597[_0xdff7e8];return _0x2fceef;};'use strict';var multer=require(_0x7d59('0x0'));var util=require(_0x7d59('0x1'));var path=require(_0x7d59('0x2'));var timeout=require(_0x7d59('0x3'));var express=require(_0x7d59('0x4'));var router=express[_0x7d59('0x5')]();var fs_extra=require(_0x7d59('0x6'));var auth=require(_0x7d59('0x7'));var interaction=require(_0x7d59('0x8'));var config=require(_0x7d59('0x9'));var controller=require(_0x7d59('0xa'));router[_0x7d59('0xb')]('/',auth[_0x7d59('0xc')](),controller[_0x7d59('0xd')]);router[_0x7d59('0xb')](_0x7d59('0xe'),auth[_0x7d59('0xc')](),controller[_0x7d59('0xf')]);router[_0x7d59('0x10')]('/',auth[_0x7d59('0xc')](),controller[_0x7d59('0x11')]);router[_0x7d59('0x12')]('/:id',auth[_0x7d59('0xc')](),controller[_0x7d59('0x13')]);router[_0x7d59('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7d59('0x15')]);module[_0x7d59('0x16')]=router; \ No newline at end of file +var _0xde3a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','Router'];(function(_0x5c1af6,_0x5b3875){var _0x5c1a5f=function(_0x408ec7){while(--_0x408ec7){_0x5c1af6['push'](_0x5c1af6['shift']());}};_0x5c1a5f(++_0x5b3875);}(_0xde3a,0x140));var _0xade3=function(_0x43ad11,_0x5ce962){_0x43ad11=_0x43ad11-0x0;var _0x1cebca=_0xde3a[_0x43ad11];return _0x1cebca;};'use strict';var multer=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xade3('0x2')]();var fs_extra=require(_0xade3('0x3'));var auth=require(_0xade3('0x4'));var interaction=require(_0xade3('0x5'));var config=require(_0xade3('0x6'));var controller=require(_0xade3('0x7'));router[_0xade3('0x8')]('/',auth[_0xade3('0x9')](),controller[_0xade3('0xa')]);router['get'](_0xade3('0xb'),auth[_0xade3('0x9')](),controller[_0xade3('0xc')]);router[_0xade3('0xd')]('/',auth[_0xade3('0x9')](),controller[_0xade3('0xe')]);router[_0xade3('0xf')]('/:id',auth[_0xade3('0x9')](),controller[_0xade3('0x10')]);router[_0xade3('0x11')](_0xade3('0xb'),auth[_0xade3('0x9')](),controller['destroy']);module[_0xade3('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0ae8b5a..4860f80 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 _0xc4dd=['#0091EA','sequelize','exports','STRING'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc4dd,0xad));var _0xdc4d=function(_0x59c1c8,_0x97355e){_0x59c1c8=_0x59c1c8-0x0;var _0x254820=_0xc4dd[_0x59c1c8];return _0x254820;};'use strict';var Sequelize=require(_0xdc4d('0x0'));module[_0xdc4d('0x1')]={'name':{'type':Sequelize[_0xdc4d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xdc4d('0x2')],'defaultValue':_0xdc4d('0x3')},'description':{'type':Sequelize[_0xdc4d('0x2')]}}; \ No newline at end of file +var _0xfef3=['#0091EA','sequelize','STRING'];(function(_0xa24d6d,_0x18c97c){var _0x2de7e7=function(_0x4444ae){while(--_0x4444ae){_0xa24d6d['push'](_0xa24d6d['shift']());}};_0x2de7e7(++_0x18c97c);}(_0xfef3,0x118));var _0x3fef=function(_0x523212,_0x437cc3){_0x523212=_0x523212-0x0;var _0x38c3b2=_0xfef3[_0x523212];return _0x38c3b2;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3fef('0x1')],'defaultValue':_0x3fef('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f4b4d65..26a301f 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 _0x4c4e=['util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Tags','destroy','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','Tag','includeAll','include','rows','catch','show','params','rawAttributes','keys','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x4c4e,0x152));var _0xe4c4=function(_0x457394,_0x294b51){_0x457394=_0x457394-0x0;var _0x4930fc=_0x4c4e[_0x457394];return _0x4930fc;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){var _0x4dc8cc=_0x59498e[_0xe4c4('0x27')]({'plain':!![]});var _0x5374fd=_0xe4c4('0x28');return db['UserProfileResource'][_0xe4c4('0x29')]({'where':{'type':_0x5374fd,'resourceId':_0x4dc8cc['id']}})['then'](function(){return _0x59498e;});})[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cea1f,_0x5d66ab){return function(_0x3221cd){if(!_0x3221cd){_0x4cea1f['sendStatus'](0x194);}return _0x3221cd;};}function handleError(_0x5b5ea5,_0xe2c1b4){_0xe2c1b4=_0xe2c1b4||0x1f4;return function(_0x11deab){logger['error'](_0x11deab['stack']);if(_0x11deab[_0xe4c4('0x2a')]){delete _0x11deab[_0xe4c4('0x2a')];}_0x5b5ea5['status'](_0xe2c1b4)[_0xe4c4('0x2b')](_0x11deab);};}exports[_0xe4c4('0x2c')]=function(_0x3f60fc,_0x48060e){var _0x5d49fd={},_0x46db7e={},_0x2c5652={'count':0x0,'rows':[]};var _0x12bde8=_[_0xe4c4('0x2d')](db['Tag']['rawAttributes'],function(_0x1731c8){return{'name':_0x1731c8[_0xe4c4('0x2e')],'type':_0x1731c8['type'][_0xe4c4('0x2f')]};});_0x46db7e[_0xe4c4('0x30')]=_[_0xe4c4('0x2d')](_0x12bde8,'name');_0x46db7e[_0xe4c4('0x31')]=_['keys'](_0x3f60fc[_0xe4c4('0x31')]);_0x46db7e[_0xe4c4('0x32')]=_[_0xe4c4('0x33')](_0x46db7e[_0xe4c4('0x30')],_0x46db7e[_0xe4c4('0x31')]);_0x5d49fd[_0xe4c4('0x34')]=_[_0xe4c4('0x33')](_0x46db7e[_0xe4c4('0x30')],qs[_0xe4c4('0x35')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x35')]));_0x5d49fd[_0xe4c4('0x34')]=_0x5d49fd['attributes'][_0xe4c4('0x36')]?_0x5d49fd[_0xe4c4('0x34')]:_0x46db7e[_0xe4c4('0x30')];if(!_0x3f60fc['query'][_0xe4c4('0x37')](_0xe4c4('0x38'))){_0x5d49fd[_0xe4c4('0x1f')]=qs['limit'](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x1f')]);_0x5d49fd[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x1d')]);}_0x5d49fd[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x3a')]);_0x5d49fd['where']=qs[_0xe4c4('0x32')](_[_0xe4c4('0x3b')](_0x3f60fc[_0xe4c4('0x31')],_0x46db7e[_0xe4c4('0x32')]),_0x12bde8);if(_0x3f60fc['query'][_0xe4c4('0x3c')]){_0x5d49fd[_0xe4c4('0x3d')]=_['merge'](_0x5d49fd[_0xe4c4('0x3d')],{'$or':_[_0xe4c4('0x2d')](_0x12bde8,function(_0x4db15d){if(_0x4db15d[_0xe4c4('0x3e')]!==_0xe4c4('0x3f')){var _0x127bcd={};_0x127bcd[_0x4db15d[_0xe4c4('0x2a')]]={'$like':'%'+_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x3c')]+'%'};return _0x127bcd;}})});}_0x5d49fd=_[_0xe4c4('0x40')]({},_0x5d49fd,_0x3f60fc[_0xe4c4('0x41')]);var _0x1e457c={'where':_0x5d49fd[_0xe4c4('0x3d')]};return db[_0xe4c4('0x42')][_0xe4c4('0x20')](_0x1e457c)['then'](function(_0x3773dd){_0x2c5652[_0xe4c4('0x20')]=_0x3773dd;if(_0x3f60fc[_0xe4c4('0x31')][_0xe4c4('0x43')]){_0x5d49fd[_0xe4c4('0x44')]=[{'all':!![]}];}return db[_0xe4c4('0x42')]['findAll'](_0x5d49fd);})[_0xe4c4('0x26')](function(_0x526bef){_0x2c5652[_0xe4c4('0x45')]=_0x526bef;return _0x2c5652;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x48060e,_0x5d49fd))[_0xe4c4('0x46')](handleError(_0x48060e,null));};exports[_0xe4c4('0x47')]=function(_0x48177f,_0x566eb7){var _0x55b527={'raw':!![],'where':{'id':_0x48177f[_0xe4c4('0x48')]['id']}},_0x23a668={};_0x23a668[_0xe4c4('0x30')]=_['keys'](db[_0xe4c4('0x42')][_0xe4c4('0x49')]);_0x23a668[_0xe4c4('0x31')]=_[_0xe4c4('0x4a')](_0x48177f['query']);_0x23a668[_0xe4c4('0x32')]=_[_0xe4c4('0x33')](_0x23a668[_0xe4c4('0x30')],_0x23a668[_0xe4c4('0x31')]);_0x55b527[_0xe4c4('0x34')]=_[_0xe4c4('0x33')](_0x23a668[_0xe4c4('0x30')],qs[_0xe4c4('0x35')](_0x48177f[_0xe4c4('0x31')]['fields']));_0x55b527[_0xe4c4('0x34')]=_0x55b527['attributes'][_0xe4c4('0x36')]?_0x55b527[_0xe4c4('0x34')]:_0x23a668[_0xe4c4('0x30')];if(_0x48177f[_0xe4c4('0x31')][_0xe4c4('0x43')]){_0x55b527[_0xe4c4('0x44')]=[{'all':!![]}];}_0x55b527=_[_0xe4c4('0x40')]({},_0x55b527,_0x48177f[_0xe4c4('0x41')]);return db[_0xe4c4('0x42')][_0xe4c4('0x4b')](_0x55b527)[_0xe4c4('0x26')](handleEntityNotFound(_0x566eb7,null))[_0xe4c4('0x26')](respondWithResult(_0x566eb7,null))[_0xe4c4('0x46')](handleError(_0x566eb7,null));};exports[_0xe4c4('0x4c')]=function(_0x535bcc,_0x4922f5){return db[_0xe4c4('0x42')][_0xe4c4('0x4c')](_0x535bcc['body'],{})[_0xe4c4('0x26')](function(_0x2853da){var _0x1211f9=_0x535bcc[_0xe4c4('0x4d')][_0xe4c4('0x27')]({'plain':!![]});if(!_0x1211f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1211f9[_0xe4c4('0x4e')]===_0xe4c4('0x4d')){var _0x4f6e03=_0x2853da[_0xe4c4('0x27')]({'plain':!![]});var _0x24b0e7='Tags';return db[_0xe4c4('0x4f')]['find']({'where':{'name':_0x24b0e7,'userProfileId':_0x1211f9[_0xe4c4('0x50')]},'raw':!![]})[_0xe4c4('0x26')](function(_0x2a54ef){if(_0x2a54ef&&_0x2a54ef[_0xe4c4('0x51')]===0x0){return db[_0xe4c4('0x52')]['create']({'name':_0x4f6e03[_0xe4c4('0x2a')],'resourceId':_0x4f6e03['id'],'type':_0x2a54ef[_0xe4c4('0x2a')],'sectionId':_0x2a54ef['id']},{})[_0xe4c4('0x26')](function(){return _0x2853da;});}else{return _0x2853da;}})[_0xe4c4('0x46')](function(_0x3c9fc4){logger[_0xe4c4('0x53')](_0xe4c4('0x54'),_0x3c9fc4);throw _0x3c9fc4;});}return _0x2853da;})[_0xe4c4('0x26')](respondWithResult(_0x4922f5,0xc9))[_0xe4c4('0x46')](handleError(_0x4922f5,null));};exports[_0xe4c4('0x25')]=function(_0x1fe354,_0x1940e3){if(_0x1fe354[_0xe4c4('0x55')]['id']){delete _0x1fe354[_0xe4c4('0x55')]['id'];}return db[_0xe4c4('0x42')][_0xe4c4('0x4b')]({'where':{'id':_0x1fe354['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x1940e3,null))[_0xe4c4('0x26')](saveUpdates(_0x1fe354[_0xe4c4('0x55')],null))['then'](respondWithResult(_0x1940e3,null))[_0xe4c4('0x46')](handleError(_0x1940e3,null));};exports[_0xe4c4('0x29')]=function(_0x35f750,_0x512ca9){return db[_0xe4c4('0x42')]['find']({'where':{'id':_0x35f750[_0xe4c4('0x48')]['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x512ca9,null))[_0xe4c4('0x26')](removeEntity(_0x512ca9,null))['catch'](handleError(_0x512ca9,null));}; \ No newline at end of file +var _0x407f=['filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x1d7cdb,_0x2dfc00){var _0x4e0475=function(_0x108151){while(--_0x108151){_0x1d7cdb['push'](_0x1d7cdb['shift']());}};_0x4e0475(++_0x2dfc00);}(_0x407f,0xc2));var _0xf407=function(_0x20f2c9,_0x371080){_0x20f2c9=_0x20f2c9-0x0;var _0x1d9c40=_0x407f[_0x20f2c9];return _0x1d9c40;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf407('0x0'));var rp=require(_0xf407('0x1'));var moment=require(_0xf407('0x2'));var BPromise=require(_0xf407('0x3'));var Mustache=require(_0xf407('0x4'));var util=require(_0xf407('0x5'));var path=require(_0xf407('0x6'));var sox=require(_0xf407('0x7'));var csv=require(_0xf407('0x8'));var ejs=require(_0xf407('0x9'));var fs=require('fs');var fs_extra=require(_0xf407('0xa'));var _=require(_0xf407('0xb'));var squel=require(_0xf407('0xc'));var crypto=require(_0xf407('0xd'));var jsforce=require(_0xf407('0xe'));var deskjs=require(_0xf407('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require(_0xf407('0x12'));var authService=require(_0xf407('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var licenseUtil=require(_0xf407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ee485,_0x3f4ca0){_0x3f4ca0=_0x3f4ca0||0xcc;return function(_0x3b26ae){if(_0x3b26ae){return _0x2ee485[_0xf407('0x19')](_0x3f4ca0);}return _0x2ee485[_0xf407('0x1a')](_0x3f4ca0)[_0xf407('0x1b')]();};}function respondWithResult(_0x242f43,_0x5257ef){_0x5257ef=_0x5257ef||0xc8;return function(_0x5d80ab){if(_0x5d80ab){return _0x242f43['status'](_0x5257ef)[_0xf407('0x1c')](_0x5d80ab);}};}function respondWithFilteredResult(_0x593e36,_0x454710){return function(_0x4c1320){if(_0x4c1320){var _0x48fd5d=typeof _0x454710[_0xf407('0x1d')]===_0xf407('0x1e')&&typeof _0x454710[_0xf407('0x1f')]===_0xf407('0x1e');var _0x351252=_0x4c1320[_0xf407('0x20')];var _0x4ddbe6=_0x48fd5d?0x0:_0x454710[_0xf407('0x1d')];var _0x588fe4=_0x48fd5d?_0x4c1320[_0xf407('0x20')]:_0x454710[_0xf407('0x1d')]+_0x454710[_0xf407('0x1f')];var _0x334c1a;if(_0x588fe4>=_0x351252){_0x588fe4=_0x351252;_0x334c1a=0xc8;}else{_0x334c1a=0xce;}_0x593e36[_0xf407('0x1a')](_0x334c1a);return _0x593e36[_0xf407('0x21')]('Content-Range',_0x4ddbe6+'-'+_0x588fe4+'/'+_0x351252)[_0xf407('0x1c')](_0x4c1320);}return null;};}function patchUpdates(_0x39febd){return function(_0x2f7ed0){try{jsonpatch[_0xf407('0x22')](_0x2f7ed0,_0x39febd,!![]);}catch(_0x4eb0c3){return BPromise[_0xf407('0x23')](_0x4eb0c3);}return _0x2f7ed0[_0xf407('0x24')]();};}function saveUpdates(_0x23659c,_0xa6f11e){return function(_0x5f32bb){if(_0x5f32bb){return _0x5f32bb['update'](_0x23659c)[_0xf407('0x25')](function(_0x100e6e){return _0x100e6e;});}return null;};}function removeEntity(_0x2558a1,_0x2cea00){return function(_0x9406cf){if(_0x9406cf){return _0x9406cf[_0xf407('0x26')]()[_0xf407('0x25')](function(){var _0x5aecf2=_0x9406cf[_0xf407('0x27')]({'plain':!![]});var _0x1996c8=_0xf407('0x28');return db['UserProfileResource'][_0xf407('0x26')]({'where':{'type':_0x1996c8,'resourceId':_0x5aecf2['id']}})[_0xf407('0x25')](function(){return _0x9406cf;});})[_0xf407('0x25')](function(){_0x2558a1[_0xf407('0x1a')](0xcc)[_0xf407('0x1b')]();});}};}function handleEntityNotFound(_0x187c93,_0x524b34){return function(_0x3953c5){if(!_0x3953c5){_0x187c93['sendStatus'](0x194);}return _0x3953c5;};}function handleError(_0x4fc4df,_0x949669){_0x949669=_0x949669||0x1f4;return function(_0x115dce){logger[_0xf407('0x29')](_0x115dce[_0xf407('0x2a')]);if(_0x115dce[_0xf407('0x2b')]){delete _0x115dce[_0xf407('0x2b')];}_0x4fc4df['status'](_0x949669)[_0xf407('0x2c')](_0x115dce);};}exports[_0xf407('0x2d')]=function(_0xa91b61,_0x89915b){var _0x15cd8d={},_0x5e12da={},_0x4a763e={'count':0x0,'rows':[]};var _0xce3a12=_[_0xf407('0x2e')](db[_0xf407('0x2f')][_0xf407('0x30')],function(_0x153287){return{'name':_0x153287[_0xf407('0x31')],'type':_0x153287[_0xf407('0x32')]['key']};});_0x5e12da[_0xf407('0x33')]=_['map'](_0xce3a12,_0xf407('0x2b'));_0x5e12da[_0xf407('0x34')]=_['keys'](_0xa91b61['query']);_0x5e12da['filters']=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],_0x5e12da['query']);_0x15cd8d[_0xf407('0x36')]=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],qs[_0xf407('0x37')](_0xa91b61['query']['fields']));_0x15cd8d[_0xf407('0x36')]=_0x15cd8d[_0xf407('0x36')][_0xf407('0x38')]?_0x15cd8d[_0xf407('0x36')]:_0x5e12da[_0xf407('0x33')];if(!_0xa91b61[_0xf407('0x34')][_0xf407('0x39')](_0xf407('0x3a'))){_0x15cd8d[_0xf407('0x1f')]=qs[_0xf407('0x1f')](_0xa91b61['query'][_0xf407('0x1f')]);_0x15cd8d['offset']=qs[_0xf407('0x1d')](_0xa91b61[_0xf407('0x34')][_0xf407('0x1d')]);}_0x15cd8d[_0xf407('0x3b')]=qs[_0xf407('0x3c')](_0xa91b61['query'][_0xf407('0x3c')]);_0x15cd8d[_0xf407('0x3d')]=qs[_0xf407('0x3e')](_[_0xf407('0x3f')](_0xa91b61['query'],_0x5e12da[_0xf407('0x3e')]),_0xce3a12);if(_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]){_0x15cd8d['where']=_['merge'](_0x15cd8d[_0xf407('0x3d')],{'$or':_['map'](_0xce3a12,function(_0x573fae){if(_0x573fae[_0xf407('0x32')]!==_0xf407('0x41')){var _0x4890ae={};_0x4890ae[_0x573fae[_0xf407('0x2b')]]={'$like':'%'+_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]+'%'};return _0x4890ae;}})});}_0x15cd8d=_[_0xf407('0x42')]({},_0x15cd8d,_0xa91b61[_0xf407('0x43')]);var _0x5c27c4={'where':_0x15cd8d[_0xf407('0x3d')]};return db['Tag']['count'](_0x5c27c4)[_0xf407('0x25')](function(_0x1ddb15){_0x4a763e['count']=_0x1ddb15;if(_0xa91b61[_0xf407('0x34')][_0xf407('0x44')]){_0x15cd8d[_0xf407('0x45')]=[{'all':!![]}];}return db[_0xf407('0x2f')][_0xf407('0x46')](_0x15cd8d);})[_0xf407('0x25')](function(_0x1c8f17){_0x4a763e[_0xf407('0x47')]=_0x1c8f17;return _0x4a763e;})['then'](respondWithFilteredResult(_0x89915b,_0x15cd8d))[_0xf407('0x48')](handleError(_0x89915b,null));};exports['show']=function(_0x2def2e,_0x571188){var _0x444b01={'raw':!![],'where':{'id':_0x2def2e[_0xf407('0x49')]['id']}},_0x56ea2b={};_0x56ea2b[_0xf407('0x33')]=_[_0xf407('0x4a')](db[_0xf407('0x2f')][_0xf407('0x30')]);_0x56ea2b[_0xf407('0x34')]=_[_0xf407('0x4a')](_0x2def2e['query']);_0x56ea2b[_0xf407('0x3e')]=_[_0xf407('0x35')](_0x56ea2b[_0xf407('0x33')],_0x56ea2b[_0xf407('0x34')]);_0x444b01[_0xf407('0x36')]=_[_0xf407('0x35')](_0x56ea2b['model'],qs[_0xf407('0x37')](_0x2def2e[_0xf407('0x34')][_0xf407('0x37')]));_0x444b01[_0xf407('0x36')]=_0x444b01[_0xf407('0x36')][_0xf407('0x38')]?_0x444b01['attributes']:_0x56ea2b[_0xf407('0x33')];if(_0x2def2e[_0xf407('0x34')][_0xf407('0x44')]){_0x444b01['include']=[{'all':!![]}];}_0x444b01=_[_0xf407('0x42')]({},_0x444b01,_0x2def2e['options']);return db[_0xf407('0x2f')][_0xf407('0x4b')](_0x444b01)[_0xf407('0x25')](handleEntityNotFound(_0x571188,null))[_0xf407('0x25')](respondWithResult(_0x571188,null))['catch'](handleError(_0x571188,null));};exports[_0xf407('0x4c')]=function(_0x3b6c44,_0x16cf14){return db['Tag']['create'](_0x3b6c44[_0xf407('0x4d')],{})[_0xf407('0x25')](function(_0x45e9ab){var _0x4799c1=_0x3b6c44[_0xf407('0x4e')][_0xf407('0x27')]({'plain':!![]});if(!_0x4799c1)throw new Error(_0xf407('0x4f'));if(_0x4799c1[_0xf407('0x50')]==='user'){var _0x1282df=_0x45e9ab[_0xf407('0x27')]({'plain':!![]});var _0x4e8483=_0xf407('0x28');return db[_0xf407('0x51')][_0xf407('0x4b')]({'where':{'name':_0x4e8483,'userProfileId':_0x4799c1['userProfileId']},'raw':!![]})[_0xf407('0x25')](function(_0xd168af){if(_0xd168af&&_0xd168af[_0xf407('0x52')]===0x0){return db[_0xf407('0x53')]['create']({'name':_0x1282df[_0xf407('0x2b')],'resourceId':_0x1282df['id'],'type':_0xd168af[_0xf407('0x2b')],'sectionId':_0xd168af['id']},{})['then'](function(){return _0x45e9ab;});}else{return _0x45e9ab;}})[_0xf407('0x48')](function(_0x588fd7){logger[_0xf407('0x29')](_0xf407('0x54'),_0x588fd7);throw _0x588fd7;});}return _0x45e9ab;})['then'](respondWithResult(_0x16cf14,0xc9))[_0xf407('0x48')](handleError(_0x16cf14,null));};exports[_0xf407('0x55')]=function(_0x4b161b,_0x289d00){if(_0x4b161b['body']['id']){delete _0x4b161b['body']['id'];}return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x4b161b[_0xf407('0x49')]['id']}})[_0xf407('0x25')](handleEntityNotFound(_0x289d00,null))[_0xf407('0x25')](saveUpdates(_0x4b161b[_0xf407('0x4d')],null))['then'](respondWithResult(_0x289d00,null))['catch'](handleError(_0x289d00,null));};exports[_0xf407('0x26')]=function(_0x34cdf1,_0x417bdd){return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x34cdf1[_0xf407('0x49')]['id']}})['then'](handleEntityNotFound(_0x417bdd,null))[_0xf407('0x25')](removeEntity(_0x417bdd,null))[_0xf407('0x48')](handleError(_0x417bdd,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 546b971..8321c08 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 _0x9a20=['rimraf','./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9a20,0x158));var _0x09a2=function(_0x169c31,_0x51237e){_0x169c31=_0x169c31-0x0;var _0x43da62=_0x9a20[_0x169c31];return _0x43da62;};'use strict';var _=require(_0x09a2('0x0'));var util=require(_0x09a2('0x1'));var logger=require(_0x09a2('0x2'))(_0x09a2('0x3'));var moment=require(_0x09a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x09a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x09a2('0x7'));module['exports']=function(_0x17caf0,_0x2289f2){return _0x17caf0['define'](_0x09a2('0x8'),attributes,{'tableName':_0x09a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45e7=['bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x2503dc,_0x24d155){var _0x317eb8=function(_0x41c240){while(--_0x41c240){_0x2503dc['push'](_0x2503dc['shift']());}};_0x317eb8(++_0x24d155);}(_0x45e7,0xaf));var _0x745e=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x45e7[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x745e('0x0'));var util=require(_0x745e('0x1'));var logger=require(_0x745e('0x2'))(_0x745e('0x3'));var moment=require(_0x745e('0x4'));var BPromise=require(_0x745e('0x5'));var rp=require(_0x745e('0x6'));var fs=require('fs');var path=require(_0x745e('0x7'));var rimraf=require('rimraf');var config=require(_0x745e('0x8'));var attributes=require(_0x745e('0x9'));module[_0x745e('0xa')]=function(_0x536f95,_0xd89a05){return _0x536f95['define']('Tag',attributes,{'tableName':_0x745e('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 28757ef..cb57636 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f9f17,_0x1339d9){var _0x420462=function(_0x5b2c44){while(--_0x5b2c44){_0x3f9f17['push'](_0x3f9f17['shift']());}};_0x420462(++_0x1339d9);}(_0x6aa7,0x178));var _0x76aa=function(_0x1585d0,_0x340114){_0x1585d0=_0x1585d0-0x0;var _0x1c5bd6=_0x6aa7[_0x1585d0];return _0x1c5bd6;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x1b1194,_0x173210){var _0x43d544=function(_0x510040){while(--_0x510040){_0x1b1194['push'](_0x1b1194['shift']());}};_0x43d544(++_0x173210);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xf9f7[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 616b1b9..3cf4a94 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 1ffceee..9a34bed 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(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x3d212e,_0x50817c){var _0x2f2250=function(_0x53bb70){while(--_0x53bb70){_0x3d212e['push'](_0x3d212e['shift']());}};_0x2f2250(++_0x50817c);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bf258,_0x5e0bb2){_0x2bf258=_0x2bf258-0x0;var _0x3b43af=_0xb10b[_0x2bf258];return _0x3b43af;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9f530e5..fecf0c9 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 _0x5a47=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','merge','filter','options','count','includeAll','findAll','show','keys','fields','length','include','find','catch','create','user','get','role','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','getQueues','channel','ValidationError','Queue','order','pick','toLowerCase','Queues','findOne','isValidChannel','Unknown\x20channel','add','capitalize','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','QueueId','penalty','User','findOrCreate','voicePause','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','TeamVoiceQueue','all','UserVoicePrefix','VoicePrefixId','spread','removeAgents','Openchannel','emit','Queue:remove','getAgents','eml-format','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x2cc5c7,_0x1bcb0d){var _0x10a9e4=function(_0x321337){while(--_0x321337){_0x2cc5c7['push'](_0x2cc5c7['shift']());}};_0x10a9e4(++_0x1bcb0d);}(_0x5a47,0x1aa));var _0x75a4=function(_0x1bed6d,_0x14fa14){_0x1bed6d=_0x1bed6d-0x0;var _0x2042d6=_0x5a47[_0x1bed6d];return _0x2042d6;};'use strict';var emlformat=require(_0x75a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75a4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75a4('0x2'));var Mustache=require(_0x75a4('0x3'));var util=require(_0x75a4('0x4'));var path=require('path');var sox=require(_0x75a4('0x5'));var csv=require('to-csv');var ejs=require(_0x75a4('0x6'));var fs=require('fs');var fs_extra=require(_0x75a4('0x7'));var _=require(_0x75a4('0x8'));var squel=require(_0x75a4('0x9'));var crypto=require('crypto');var jsforce=require(_0x75a4('0xa'));var deskjs=require(_0x75a4('0xb'));var toCsv=require(_0x75a4('0xc'));var querystring=require(_0x75a4('0xd'));var Papa=require(_0x75a4('0xe'));var Redis=require(_0x75a4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x75a4('0x10'));var as=require(_0x75a4('0x11'));var hardwareService=require(_0x75a4('0x12'));var logger=require(_0x75a4('0x13'))('api');var utils=require(_0x75a4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x75a4('0x15'));var db=require('../../mysqldb')['db'];config[_0x75a4('0x16')]=_[_0x75a4('0x17')](config['redis'],{'host':_0x75a4('0x18'),'port':0x18eb});var socket=require(_0x75a4('0x19'))(new Redis(config[_0x75a4('0x16')]));require('./team.socket')[_0x75a4('0x1a')](socket);function respondWithStatusCode(_0x3461f5,_0x250a7c){_0x250a7c=_0x250a7c||0xcc;return function(_0x4f1fb5){if(_0x4f1fb5){return _0x3461f5[_0x75a4('0x1b')](_0x250a7c);}return _0x3461f5[_0x75a4('0x1c')](_0x250a7c)[_0x75a4('0x1d')]();};}function respondWithResult(_0x12bff6,_0x33c98d){_0x33c98d=_0x33c98d||0xc8;return function(_0x31f780){if(_0x31f780){return _0x12bff6['status'](_0x33c98d)[_0x75a4('0x1e')](_0x31f780);}};}function respondWithFilteredResult(_0x43b8f7,_0x1667ab){return function(_0xac6dc2){if(_0xac6dc2){var _0x5ced51=typeof _0x1667ab[_0x75a4('0x1f')]===_0x75a4('0x20')&&typeof _0x1667ab['limit']==='undefined';var _0x1c68ad=_0xac6dc2['count'];var _0x2f0afd=_0x5ced51?0x0:_0x1667ab[_0x75a4('0x1f')];var _0x2768ff=_0x5ced51?_0xac6dc2['count']:_0x1667ab['offset']+_0x1667ab[_0x75a4('0x21')];var _0x1230d9;if(_0x2768ff>=_0x1c68ad){_0x2768ff=_0x1c68ad;_0x1230d9=0xc8;}else{_0x1230d9=0xce;}_0x43b8f7[_0x75a4('0x1c')](_0x1230d9);return _0x43b8f7[_0x75a4('0x22')](_0x75a4('0x23'),_0x2f0afd+'-'+_0x2768ff+'/'+_0x1c68ad)[_0x75a4('0x1e')](_0xac6dc2);}return null;};}function patchUpdates(_0xb41a4c){return function(_0x482ae9){try{jsonpatch[_0x75a4('0x24')](_0x482ae9,_0xb41a4c,!![]);}catch(_0x25f9b4){return BPromise[_0x75a4('0x25')](_0x25f9b4);}return _0x482ae9[_0x75a4('0x26')]();};}function saveUpdates(_0x4a8b20,_0x5c1dab){return function(_0x177166){if(_0x177166){return _0x177166[_0x75a4('0x27')](_0x4a8b20)[_0x75a4('0x28')](function(_0x44e27b){return _0x44e27b;});}return null;};}function handleEntityNotFound(_0x400fa1,_0x5d8e03){return function(_0x28c8e0){if(!_0x28c8e0){_0x400fa1[_0x75a4('0x1b')](0x194);}return _0x28c8e0;};}function handleError(_0x1209df,_0x110ae0){_0x110ae0=_0x110ae0||0x1f4;return function(_0x4b4b5a){logger[_0x75a4('0x29')](_0x4b4b5a[_0x75a4('0x2a')]);if(_0x4b4b5a[_0x75a4('0x2b')]){delete _0x4b4b5a[_0x75a4('0x2b')];}_0x1209df['status'](_0x110ae0)[_0x75a4('0x2c')](_0x4b4b5a);};}exports[_0x75a4('0x2d')]=function(_0x25d95b,_0x4b1e11){var _0x25c274={},_0x4f86ca={},_0x25ceb6={'count':0x0,'rows':[]};var _0xa9857=_[_0x75a4('0x2e')](db[_0x75a4('0x2f')][_0x75a4('0x30')],function(_0xde2e17){return{'name':_0xde2e17[_0x75a4('0x31')],'type':_0xde2e17[_0x75a4('0x32')][_0x75a4('0x33')]};});_0x4f86ca['model']=_[_0x75a4('0x2e')](_0xa9857,'name');_0x4f86ca[_0x75a4('0x34')]=_['keys'](_0x25d95b[_0x75a4('0x34')]);_0x4f86ca[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x4f86ca[_0x75a4('0x37')],_0x4f86ca[_0x75a4('0x34')]);_0x25c274[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x4f86ca[_0x75a4('0x37')],qs['fields'](_0x25d95b[_0x75a4('0x34')]['fields']));_0x25c274[_0x75a4('0x38')]=_0x25c274[_0x75a4('0x38')]['length']?_0x25c274['attributes']:_0x4f86ca[_0x75a4('0x37')];if(!_0x25d95b[_0x75a4('0x34')][_0x75a4('0x39')](_0x75a4('0x3a'))){_0x25c274[_0x75a4('0x21')]=qs[_0x75a4('0x21')](_0x25d95b['query'][_0x75a4('0x21')]);_0x25c274[_0x75a4('0x1f')]=qs[_0x75a4('0x1f')](_0x25d95b[_0x75a4('0x34')][_0x75a4('0x1f')]);}_0x25c274['order']=qs[_0x75a4('0x3b')](_0x25d95b[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x25c274['where']=qs[_0x75a4('0x35')](_['pick'](_0x25d95b[_0x75a4('0x34')],_0x4f86ca[_0x75a4('0x35')]),_0xa9857);if(_0x25d95b[_0x75a4('0x34')]['filter']){_0x25c274[_0x75a4('0x3c')]=_[_0x75a4('0x3d')](_0x25c274[_0x75a4('0x3c')],{'$or':_[_0x75a4('0x2e')](_0xa9857,function(_0x1b2c8a){if(_0x1b2c8a[_0x75a4('0x32')]!=='VIRTUAL'){var _0x48b1d7={};_0x48b1d7[_0x1b2c8a['name']]={'$like':'%'+_0x25d95b[_0x75a4('0x34')][_0x75a4('0x3e')]+'%'};return _0x48b1d7;}})});}_0x25c274=_[_0x75a4('0x3d')]({},_0x25c274,_0x25d95b[_0x75a4('0x3f')]);var _0x281b69={'where':_0x25c274[_0x75a4('0x3c')]};return db[_0x75a4('0x2f')][_0x75a4('0x40')](_0x281b69)['then'](function(_0x34491c){_0x25ceb6[_0x75a4('0x40')]=_0x34491c;if(_0x25d95b[_0x75a4('0x34')][_0x75a4('0x41')]){_0x25c274['include']=[{'all':!![]}];}return db[_0x75a4('0x2f')][_0x75a4('0x42')](_0x25c274);})['then'](function(_0x2ae79f){_0x25ceb6['rows']=_0x2ae79f;return _0x25ceb6;})['then'](respondWithFilteredResult(_0x4b1e11,_0x25c274))['catch'](handleError(_0x4b1e11,null));};exports[_0x75a4('0x43')]=function(_0x56af33,_0x4c6a9e){var _0x2b1243={'raw':![],'where':{'id':_0x56af33['params']['id']}},_0x16e4a5={};_0x16e4a5[_0x75a4('0x37')]=_[_0x75a4('0x44')](db[_0x75a4('0x2f')][_0x75a4('0x30')]);_0x16e4a5[_0x75a4('0x34')]=_['keys'](_0x56af33[_0x75a4('0x34')]);_0x16e4a5[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x16e4a5[_0x75a4('0x37')],_0x16e4a5[_0x75a4('0x34')]);_0x2b1243[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x16e4a5['model'],qs['fields'](_0x56af33[_0x75a4('0x34')][_0x75a4('0x45')]));_0x2b1243[_0x75a4('0x38')]=_0x2b1243[_0x75a4('0x38')][_0x75a4('0x46')]?_0x2b1243[_0x75a4('0x38')]:_0x16e4a5[_0x75a4('0x37')];if(_0x56af33[_0x75a4('0x34')][_0x75a4('0x41')]){_0x2b1243[_0x75a4('0x47')]=[{'all':!![]}];}_0x2b1243=_[_0x75a4('0x3d')]({},_0x2b1243,_0x56af33[_0x75a4('0x3f')]);return db['Team'][_0x75a4('0x48')](_0x2b1243)[_0x75a4('0x28')](handleEntityNotFound(_0x4c6a9e,null))[_0x75a4('0x28')](respondWithResult(_0x4c6a9e,null))[_0x75a4('0x49')](handleError(_0x4c6a9e,null));};exports[_0x75a4('0x4a')]=function(_0x2d7600,_0x494580){return db[_0x75a4('0x2f')][_0x75a4('0x4a')](_0x2d7600['body'],{})[_0x75a4('0x28')](function(_0x1cbf33){var _0x2fbfca=_0x2d7600[_0x75a4('0x4b')][_0x75a4('0x4c')]({'plain':!![]});if(!_0x2fbfca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fbfca[_0x75a4('0x4d')]===_0x75a4('0x4b')){var _0x3ed209=_0x1cbf33[_0x75a4('0x4c')]({'plain':!![]});var _0x348f65=_0x75a4('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x348f65,'userProfileId':_0x2fbfca[_0x75a4('0x4f')]},'raw':!![]})[_0x75a4('0x28')](function(_0x146db3){if(_0x146db3&&_0x146db3[_0x75a4('0x50')]===0x0){return db[_0x75a4('0x51')]['create']({'name':_0x3ed209[_0x75a4('0x2b')],'resourceId':_0x3ed209['id'],'type':_0x146db3[_0x75a4('0x2b')],'sectionId':_0x146db3['id']},{})[_0x75a4('0x28')](function(){return _0x1cbf33;});}else{return _0x1cbf33;}})[_0x75a4('0x49')](function(_0x4d2242){logger['error'](_0x75a4('0x52'),_0x4d2242);throw _0x4d2242;});}return _0x1cbf33;})[_0x75a4('0x28')](respondWithResult(_0x494580,0xc9))[_0x75a4('0x49')](handleError(_0x494580,null));};exports['update']=function(_0x38074f,_0x30144d){if(_0x38074f['body']['id']){delete _0x38074f['body']['id'];}return db[_0x75a4('0x2f')]['find']({'where':{'id':_0x38074f[_0x75a4('0x53')]['id']}})[_0x75a4('0x28')](handleEntityNotFound(_0x30144d,null))[_0x75a4('0x28')](saveUpdates(_0x38074f[_0x75a4('0x54')],null))['then'](respondWithResult(_0x30144d,null))['catch'](handleError(_0x30144d,null));};exports['destroy']=function(_0x43285d,_0x1c307f){var _0x54e494=_0x43285d[_0x75a4('0x53')]['id'];var _0x1eb97b=[];return db[_0x75a4('0x55')]['transaction'](function(_0x4658ca){var _0xbb22f3=_0x75a4('0x56')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0xbb22f3,{'type':db['Sequelize']['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca})[_0x75a4('0x28')](function(_0x30a5c5){_0x1eb97b=_[_0x75a4('0x2e')](_0x30a5c5,function(_0xffc439){return Number(_0xffc439['UserId']);});})['then'](function(){var _0x325acc=_0x75a4('0x58')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x325acc,{'type':db[_0x75a4('0x59')]['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x599c9e){var _0x4e8069=_['map'](_0x599c9e,function(_0x4ae951){return Number(_0x4ae951[_0x75a4('0x5a')]);});return db[_0x75a4('0x5b')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'VoiceQueueId':{'$in':_0x4e8069}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x5daaab=_0x75a4('0x5d')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x5daaab,{'type':db['Sequelize']['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0x515e5b){var _0x57b32a=_[_0x75a4('0x2e')](_0x515e5b,function(_0x2baa89){return Number(_0x2baa89[_0x75a4('0x5e')]);});return db['UserMailQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'MailQueueId':{'$in':_0x57b32a}},'transaction':_0x4658ca});})['then'](function(){var _0x236373=_0x75a4('0x5f')+_0x54e494;return db['sequelize']['query'](_0x236373,{'type':db[_0x75a4('0x59')]['QueryTypes'][_0x75a4('0x57')],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0xdfc9f8){var _0x3139ce=_[_0x75a4('0x2e')](_0xdfc9f8,function(_0x419c41){return Number(_0x419c41['SmsQueueId']);});return db['UserSmsQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'SmsQueueId':{'$in':_0x3139ce}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x291bf9=_0x75a4('0x60')+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x291bf9,{'type':db['Sequelize'][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x2adfb7){var _0x5214e7=_[_0x75a4('0x2e')](_0x2adfb7,function(_0x59dd8c){return Number(_0x59dd8c[_0x75a4('0x62')]);});return db['UserChatQueue'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'ChatQueueId':{'$in':_0x5214e7}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x3442df=_0x75a4('0x63')+_0x54e494;return db['sequelize'][_0x75a4('0x34')](_0x3442df,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x5db57b){var _0x4ee513=_[_0x75a4('0x2e')](_0x5db57b,function(_0x2d0d99){return Number(_0x2d0d99[_0x75a4('0x64')]);});return db[_0x75a4('0x65')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'FaxQueueId':{'$in':_0x4ee513}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x486366='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e494;return db[_0x75a4('0x55')][_0x75a4('0x34')](_0x486366,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0xaa296c){var _0x53abc0=_[_0x75a4('0x2e')](_0xaa296c,function(_0x57fd37){return Number(_0x57fd37[_0x75a4('0x66')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x1eb97b},'OpenchannelQueueId':{'$in':_0x53abc0}},'transaction':_0x4658ca});})[_0x75a4('0x28')](function(){var _0x18fab5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x54e494;return db[_0x75a4('0x55')]['query'](_0x18fab5,{'type':db[_0x75a4('0x59')][_0x75a4('0x61')]['SELECT'],'raw':!![],'transaction':_0x4658ca});})['then'](function(_0xa56625){var _0x5ccc6d=_[_0x75a4('0x2e')](_0xa56625,function(_0x34e255){return Number(_0x34e255[_0x75a4('0x67')]);});return db[_0x75a4('0x68')][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'WhatsappQueueId':{'$in':_0x5ccc6d}},'transaction':_0x4658ca});})['then'](function(){return db[_0x75a4('0x69')][_0x75a4('0x48')]({'where':{'TeamId':_0x54e494}});})[_0x75a4('0x28')](function(_0x568de1){if(_0x568de1===null){return;}return db['UserVoicePrefix'][_0x75a4('0x5c')]({'where':{'UserId':{'$in':_0x1eb97b},'VoicePrefixId':_0x568de1['VoicePrefixId']},'transaction':_0x4658ca});})['then'](function(){return db['Team'][_0x75a4('0x5c')]({'where':{'id':_0x54e494},'cascade':!![],'transaction':_0x4658ca});})[_0x75a4('0x28')](function(_0x300f2a){if(_0x300f2a===0x0){_0x1c307f['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x75a4('0x5c')]({'where':{'type':_0x75a4('0x4e'),'resourceId':_0x54e494},'cascade':!![],'transaction':_0x4658ca})[_0x75a4('0x28')](function(){_0x1c307f[_0x75a4('0x1c')](0xcc)[_0x75a4('0x1d')]();});}})['catch'](function(_0x505e54){_0x1c307f[_0x75a4('0x1c')](0x1f4)[_0x75a4('0x2c')](_0x505e54);});});};exports[_0x75a4('0x6a')]=function(_0xfbc298,_0x41f360,_0x50bdf5){return db[_0x75a4('0x2f')]['findOne']({'where':{'id':_0xfbc298['params']['id']}})['then'](handleEntityNotFound(_0x41f360,null))['then'](function(_0x131b8d){if(!_0xfbc298[_0x75a4('0x34')]['channel']||!utils['isValidChannel'](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x6b')])){throw new db[(_0x75a4('0x59'))][(_0x75a4('0x6c'))]('Unknown\x20channel');}var _0x4a75a3={};var _0x36f71d={};_0x36f71d[_0x75a4('0x37')]=_[_0x75a4('0x44')](db[_['capitalize'](_0xfbc298['query'][_0x75a4('0x6b')]['toLowerCase']())+_0x75a4('0x6d')][_0x75a4('0x30')]);_0x36f71d[_0x75a4('0x34')]=_[_0x75a4('0x44')](_0xfbc298[_0x75a4('0x34')]);_0x36f71d[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x36f71d[_0x75a4('0x37')],_0x36f71d[_0x75a4('0x34')]);_0x4a75a3[_0x75a4('0x38')]=_['intersection'](_0x36f71d[_0x75a4('0x37')],qs[_0x75a4('0x45')](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x45')]));_0x4a75a3[_0x75a4('0x38')]=_0x4a75a3[_0x75a4('0x38')][_0x75a4('0x46')]?_0x4a75a3[_0x75a4('0x38')]:_0x36f71d[_0x75a4('0x37')];_0x4a75a3[_0x75a4('0x21')]=qs[_0x75a4('0x21')](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x21')]);_0x4a75a3[_0x75a4('0x1f')]=qs['offset'](_0xfbc298[_0x75a4('0x34')]['offset']);_0x4a75a3[_0x75a4('0x6e')]=qs['sort'](_0xfbc298[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x4a75a3[_0x75a4('0x3c')]=qs[_0x75a4('0x35')](_[_0x75a4('0x6f')](_0xfbc298[_0x75a4('0x34')],_0x36f71d[_0x75a4('0x35')]));_0x4a75a3=_[_0x75a4('0x3d')]({},_0x4a75a3,_0xfbc298[_0x75a4('0x3f')]);return _0x131b8d[_0x75a4('0x4c')+_['capitalize'](_0xfbc298['query'][_0x75a4('0x6b')][_0x75a4('0x70')]())+_0x75a4('0x71')](_0x4a75a3);})[_0x75a4('0x28')](respondWithResult(_0x41f360,null))[_0x75a4('0x49')](handleError(_0x41f360,null));};exports['addQueues']=function(_0x2b2ab1,_0x7170ae,_0x4345b3){return db[_0x75a4('0x2f')][_0x75a4('0x72')]({'where':{'id':_0x2b2ab1[_0x75a4('0x53')]['id']}})['then'](function(_0x21d944){if(_0x21d944){if(!_0x2b2ab1[_0x75a4('0x54')][_0x75a4('0x6b')]||!utils[_0x75a4('0x73')](_0x2b2ab1[_0x75a4('0x54')]['channel'])){throw new db['Sequelize'][(_0x75a4('0x6c'))](_0x75a4('0x74'));}return _0x21d944[_0x75a4('0x75')+_[_0x75a4('0x76')](_0x2b2ab1['body'][_0x75a4('0x6b')][_0x75a4('0x70')]())+'Queues'](_0x2b2ab1[_0x75a4('0x54')]['ids']);}return null;})[_0x75a4('0x28')](handleEntityNotFound(_0x7170ae,null))['then'](respondWithStatusCode(_0x7170ae,null))[_0x75a4('0x49')](handleError(_0x7170ae,null));};exports[_0x75a4('0x77')]=function(_0x236956,_0x16abf5,_0x3eb365){return db[_0x75a4('0x2f')][_0x75a4('0x72')]({'where':{'id':_0x236956[_0x75a4('0x53')]['id']}})[_0x75a4('0x28')](function(_0x4c42f7){if(_0x4c42f7){if(!_0x236956[_0x75a4('0x34')][_0x75a4('0x6b')]||!utils[_0x75a4('0x73')](_0x236956['query'][_0x75a4('0x6b')])){throw new db[(_0x75a4('0x59'))][(_0x75a4('0x6c'))](_0x75a4('0x74'));}return _0x4c42f7['remove'+_['capitalize'](_0x236956[_0x75a4('0x34')][_0x75a4('0x6b')]['toLowerCase']())+'Queues'](_0x236956[_0x75a4('0x34')][_0x75a4('0x78')]);}return null;})[_0x75a4('0x28')](handleEntityNotFound(_0x16abf5,null))[_0x75a4('0x28')](respondWithStatusCode(_0x16abf5,null))['catch'](handleError(_0x16abf5,null));};exports[_0x75a4('0x79')]=function(_0x1667af,_0x40cd0c){var _0x4c7179=_[_0x75a4('0x7a')](_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')])?_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')]:[_0x1667af[_0x75a4('0x54')][_0x75a4('0x78')]];var _0x3d6b5f=_0x1667af[_0x75a4('0x53')]['id'];return db[_0x75a4('0x2f')][_0x75a4('0x48')]({'where':{'id':_0x3d6b5f}})['then'](handleEntityNotFound(_0x40cd0c,null))[_0x75a4('0x28')](function(_0x21b8d4){if(_0x21b8d4){var _0x4344dd=[_0x75a4('0x7b'),_0x75a4('0x7c'),_0x75a4('0x7d'),_0x75a4('0x7e'),_0x75a4('0x7f'),'Openchannel',_0x75a4('0x80')];return db['sequelize'][_0x75a4('0x81')](function(_0xc10d55){var _0x3ee53d=_[_0x75a4('0x2e')](_0x4344dd,function(_0x359687){var _0x5bc1e8={'attributes':['id',_0x75a4('0x2b')]};if(_0x359687==='Voice'){_0x5bc1e8['through']={'attributes':['penalty']};}return _0x21b8d4[_0x75a4('0x4c')+_0x359687+'Queues'](_0x5bc1e8)[_0x75a4('0x28')](function(_0x535404){var _0x765ba5=_[_0x75a4('0x2e')](_0x535404,function(_0x42ac43){var _0x2c6e=_['map'](_0x4c7179,function(_0x51c0a5){var _0x4fdbc1={'where':{'UserId':_0x51c0a5,[_0x359687+_0x75a4('0x82')]:_0x42ac43['id']},'transaction':_0xc10d55};if(_0x359687===_0x75a4('0x7b')){_0x4fdbc1[_0x75a4('0x17')]={'penalty':_0x42ac43['TeamVoiceQueue'][_0x75a4('0x83')]};}return db[_0x75a4('0x84')+_0x359687+_0x75a4('0x6d')][_0x75a4('0x85')](_0x4fdbc1)['then'](function(){socket['emit'](_0x75a4('0x4b')+_0x359687+'Queue:save',{'UserId':_0x51c0a5,[_0x359687+'QueueId']:_0x42ac43['id']});if(_0x359687!==_0x75a4('0x7b')){return;}return db[_0x75a4('0x84')]['findAll']({'where':{'id':_0x4c7179,'online':0x1},'attributes':['id','name','online',_0x75a4('0x86'),'interface'],'raw':!![]})[_0x75a4('0x28')](function(_0x2fee47){var _0x3a0f33=_[_0x75a4('0x2e')](_0x2fee47,function(_0x256a0d){return db[_0x75a4('0x87')][_0x75a4('0x88')]({'membername':_0x256a0d['name'],'UserId':_0x256a0d['id'],'queue_name':_0x42ac43[_0x75a4('0x2b')],'VoiceQueueId':_0x42ac43['id'],'interface':_[_0x75a4('0x89')](_0x256a0d['interface'])?util['format'](_0x75a4('0x8a'),_0x256a0d[_0x75a4('0x2b')]):_0x256a0d[_0x75a4('0x8b')],'paused':_0x256a0d[_0x75a4('0x86')]||![],'penalty':_0x42ac43[_0x75a4('0x8c')]['penalty']},{'transaction':_0xc10d55});});return Promise[_0x75a4('0x8d')](_0x3a0f33);});});});return Promise['all'](_0x2c6e);});return Promise[_0x75a4('0x8d')](_0x765ba5);})[_0x75a4('0x28')](function(){return db[_0x75a4('0x69')][_0x75a4('0x72')]({'where':{'teamId':_0x3d6b5f}})[_0x75a4('0x28')](function(_0x5b8c4f){if(_0x5b8c4f){var _0x12c30f=_['map'](_0x4c7179,function(_0x2c5340){db[_0x75a4('0x8e')][_0x75a4('0x88')]({'UserId':_0x2c5340,'VoicePrefixId':_0x5b8c4f[_0x75a4('0x8f')]});});return Promise[_0x75a4('0x8d')](_0x12c30f);}});});});return Promise[_0x75a4('0x8d')](_0x3ee53d)[_0x75a4('0x28')](function(){return _0x21b8d4[_0x75a4('0x79')](_0x4c7179,{'transaction':_0xc10d55})[_0x75a4('0x90')](function(_0xc32e80){return _0xc32e80;});});});}})[_0x75a4('0x28')](respondWithResult(_0x40cd0c,null))[_0x75a4('0x49')](handleError(_0x40cd0c,null));};exports[_0x75a4('0x91')]=function(_0x450d50,_0x2fa6a5){var _0x58f54f=_[_0x75a4('0x7a')](_0x450d50[_0x75a4('0x34')]['ids'])?_0x450d50[_0x75a4('0x34')][_0x75a4('0x78')]:[_0x450d50[_0x75a4('0x34')]['ids']];var _0x9af7c0=_0x450d50[_0x75a4('0x53')]['id'];return db[_0x75a4('0x2f')][_0x75a4('0x48')]({'where':{'id':_0x9af7c0}})[_0x75a4('0x28')](handleEntityNotFound(_0x2fa6a5,null))[_0x75a4('0x28')](function(_0x3d4e00){if(_0x3d4e00){var _0x1a3746=['Voice','Chat',_0x75a4('0x7d'),_0x75a4('0x7e'),_0x75a4('0x7f'),_0x75a4('0x92'),'Whatsapp'];return db['sequelize'][_0x75a4('0x81')](function(_0x55bf83){var _0x3c767f=_['map'](_0x1a3746,function(_0x91ffda){var _0x5d00c0={'attributes':['id',_0x75a4('0x2b')]};return _0x3d4e00[_0x75a4('0x4c')+_0x91ffda+_0x75a4('0x71')](_0x5d00c0)[_0x75a4('0x28')](function(_0x209ccc){var _0x4d746f=_[_0x75a4('0x2e')](_0x209ccc,function(_0x253b05){return _0x253b05[_0x75a4('0x91')](_0x58f54f,{'transaction':_0x55bf83})[_0x75a4('0x28')](function(){var _0x29c28e=_['map'](_0x58f54f,function(_0xba3b7){socket[_0x75a4('0x93')](_0x75a4('0x4b')+_0x91ffda+_0x75a4('0x94'),{'UserId':Number(_0xba3b7),[_0x91ffda+_0x75a4('0x82')]:_0x253b05['id']});if(_0x91ffda!==_0x75a4('0x7b')){return;}return db[_0x75a4('0x87')][_0x75a4('0x5c')]({'where':{'VoiceQueueId':_0x253b05['id'],'UserId':_0xba3b7},'transaction':_0x55bf83});});return Promise[_0x75a4('0x8d')](_0x29c28e);});});return Promise[_0x75a4('0x8d')](_0x4d746f);});});return Promise[_0x75a4('0x8d')](_0x3c767f)['then'](function(){return _0x3d4e00[_0x75a4('0x91')](_0x58f54f,{'transaction':_0x55bf83});})[_0x75a4('0x28')](function(){return db[_0x75a4('0x69')][_0x75a4('0x72')]({'where':{'teamId':_0x9af7c0}})['then'](function(_0x2b89de){if(_0x2b89de){var _0x3451c9=_[_0x75a4('0x2e')](_0x58f54f,function(_0xe1cb55){db[_0x75a4('0x8e')][_0x75a4('0x5c')]({'where':{'UserId':_0xe1cb55,'VoicePrefixId':_0x2b89de[_0x75a4('0x8f')]}});});return Promise[_0x75a4('0x8d')](_0x3451c9);}});});});}})['then'](respondWithStatusCode(_0x2fa6a5,null))[_0x75a4('0x49')](handleError(_0x2fa6a5,null));};exports['getAgents']=function(_0x3bf953,_0x112202,_0x4a2a08){var _0x37b5bb={};var _0x118daf={};var _0x1826bd;var _0x529087;return db['Team'][_0x75a4('0x72')]({'where':{'id':_0x3bf953['params']['id']}})[_0x75a4('0x28')](handleEntityNotFound(_0x112202,null))['then'](function(_0x59e89c){if(_0x59e89c){_0x1826bd=_0x59e89c;_0x118daf[_0x75a4('0x37')]=_[_0x75a4('0x44')](db['User']['rawAttributes']);_0x118daf['query']=_[_0x75a4('0x44')](_0x3bf953[_0x75a4('0x34')]);_0x118daf[_0x75a4('0x35')]=_[_0x75a4('0x36')](_0x118daf[_0x75a4('0x37')],_0x118daf[_0x75a4('0x34')]);_0x37b5bb[_0x75a4('0x38')]=_[_0x75a4('0x36')](_0x118daf[_0x75a4('0x37')],qs[_0x75a4('0x45')](_0x3bf953['query'][_0x75a4('0x45')]));_0x37b5bb['attributes']=_0x37b5bb[_0x75a4('0x38')][_0x75a4('0x46')]?_0x37b5bb[_0x75a4('0x38')]:_0x118daf['model'];_0x37b5bb['order']=qs['sort'](_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3b')]);_0x37b5bb['where']=qs[_0x75a4('0x35')](_[_0x75a4('0x6f')](_0x3bf953['query'],_0x118daf['filters']));if(_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3e')]){_0x37b5bb['where']=_[_0x75a4('0x3d')](_0x37b5bb[_0x75a4('0x3c')],{'$or':_[_0x75a4('0x2e')](_0x37b5bb[_0x75a4('0x38')],function(_0x2d7559){var _0x5c48ce={};_0x5c48ce[_0x2d7559]={'$like':'%'+_0x3bf953[_0x75a4('0x34')][_0x75a4('0x3e')]+'%'};return _0x5c48ce;})});}_0x37b5bb=_[_0x75a4('0x3d')]({},_0x37b5bb,_0x3bf953[_0x75a4('0x3f')]);return _0x1826bd[_0x75a4('0x95')](_0x37b5bb);}})['then'](function(_0x4f931e){if(_0x4f931e){_0x529087=_0x4f931e[_0x75a4('0x46')];if(!_0x3bf953[_0x75a4('0x34')]['hasOwnProperty'](_0x75a4('0x3a'))){_0x37b5bb['limit']=qs[_0x75a4('0x21')](_0x3bf953[_0x75a4('0x34')]['limit']);_0x37b5bb[_0x75a4('0x1f')]=qs['offset'](_0x3bf953[_0x75a4('0x34')]['offset']);}return _0x1826bd[_0x75a4('0x95')](_0x37b5bb);}})[_0x75a4('0x28')](function(_0x38436b){if(_0x38436b){return _0x38436b?{'count':_0x529087,'rows':_0x38436b}:null;}})[_0x75a4('0x28')](respondWithResult(_0x112202,null))[_0x75a4('0x49')](handleError(_0x112202,null));}; \ No newline at end of file +var _0x9e3a=['localhost','socket.io-emitter','./team.socket','register','status','json','offset','undefined','count','limit','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','Team','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','removeQueues','remove','ids','isArray','Chat','Mail','Sms','Whatsapp','Voice','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','online','interface','upsert','isNil','SIP/%s','voicePause','all','addAgents','Openchannel','user','Queue:remove','QueueId','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x4a79a8,_0x2dcd16){var _0x5d9421=function(_0x39e995){while(--_0x39e995){_0x4a79a8['push'](_0x4a79a8['shift']());}};_0x5d9421(++_0x2dcd16);}(_0x9e3a,0x82));var _0xa9e3=function(_0x2109ad,_0x1d84ee){_0x2109ad=_0x2109ad-0x0;var _0x590b6d=_0x9e3a[_0x2109ad];return _0x590b6d;};'use strict';var emlformat=require(_0xa9e3('0x0'));var rimraf=require(_0xa9e3('0x1'));var zipdir=require(_0xa9e3('0x2'));var jsonpatch=require(_0xa9e3('0x3'));var rp=require('request-promise');var moment=require(_0xa9e3('0x4'));var BPromise=require(_0xa9e3('0x5'));var Mustache=require(_0xa9e3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa9e3('0x7'));var csv=require('to-csv');var ejs=require(_0xa9e3('0x8'));var fs=require('fs');var fs_extra=require(_0xa9e3('0x9'));var _=require(_0xa9e3('0xa'));var squel=require(_0xa9e3('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9e3('0xc'));var deskjs=require(_0xa9e3('0xd'));var toCsv=require(_0xa9e3('0xe'));var querystring=require(_0xa9e3('0xf'));var Papa=require('papaparse');var Redis=require(_0xa9e3('0x10'));var authService=require(_0xa9e3('0x11'));var qs=require(_0xa9e3('0x12'));var as=require(_0xa9e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9e3('0x14'));var utils=require(_0xa9e3('0x15'));var config=require(_0xa9e3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9e3('0x17'))['db'];config[_0xa9e3('0x18')]=_[_0xa9e3('0x19')](config[_0xa9e3('0x18')],{'host':_0xa9e3('0x1a'),'port':0x18eb});var socket=require(_0xa9e3('0x1b'))(new Redis(config[_0xa9e3('0x18')]));require(_0xa9e3('0x1c'))[_0xa9e3('0x1d')](socket);function respondWithStatusCode(_0x3b309f,_0x19ba2e){_0x19ba2e=_0x19ba2e||0xcc;return function(_0x587a53){if(_0x587a53){return _0x3b309f['sendStatus'](_0x19ba2e);}return _0x3b309f[_0xa9e3('0x1e')](_0x19ba2e)['end']();};}function respondWithResult(_0x5b4f48,_0x1fed8f){_0x1fed8f=_0x1fed8f||0xc8;return function(_0x46910f){if(_0x46910f){return _0x5b4f48[_0xa9e3('0x1e')](_0x1fed8f)[_0xa9e3('0x1f')](_0x46910f);}};}function respondWithFilteredResult(_0x1d7662,_0x22570c){return function(_0x318b12){if(_0x318b12){var _0x46b0a3=typeof _0x22570c[_0xa9e3('0x20')]===_0xa9e3('0x21')&&typeof _0x22570c['limit']===_0xa9e3('0x21');var _0x23da09=_0x318b12['count'];var _0x4efd7a=_0x46b0a3?0x0:_0x22570c[_0xa9e3('0x20')];var _0x3bc23f=_0x46b0a3?_0x318b12[_0xa9e3('0x22')]:_0x22570c['offset']+_0x22570c[_0xa9e3('0x23')];var _0x10a2ff;if(_0x3bc23f>=_0x23da09){_0x3bc23f=_0x23da09;_0x10a2ff=0xc8;}else{_0x10a2ff=0xce;}_0x1d7662[_0xa9e3('0x1e')](_0x10a2ff);return _0x1d7662['set']('Content-Range',_0x4efd7a+'-'+_0x3bc23f+'/'+_0x23da09)['json'](_0x318b12);}return null;};}function patchUpdates(_0x5e87d3){return function(_0x3fa5b3){try{jsonpatch[_0xa9e3('0x24')](_0x3fa5b3,_0x5e87d3,!![]);}catch(_0x136bce){return BPromise[_0xa9e3('0x25')](_0x136bce);}return _0x3fa5b3[_0xa9e3('0x26')]();};}function saveUpdates(_0x553fc0,_0x32dcf1){return function(_0x57cb6e){if(_0x57cb6e){return _0x57cb6e[_0xa9e3('0x27')](_0x553fc0)[_0xa9e3('0x28')](function(_0x12d5d0){return _0x12d5d0;});}return null;};}function handleEntityNotFound(_0x336ec8,_0x2f4031){return function(_0x4e2346){if(!_0x4e2346){_0x336ec8[_0xa9e3('0x29')](0x194);}return _0x4e2346;};}function handleError(_0x54ad87,_0xd0c9b){_0xd0c9b=_0xd0c9b||0x1f4;return function(_0x28c55c){logger[_0xa9e3('0x2a')](_0x28c55c[_0xa9e3('0x2b')]);if(_0x28c55c[_0xa9e3('0x2c')]){delete _0x28c55c[_0xa9e3('0x2c')];}_0x54ad87[_0xa9e3('0x1e')](_0xd0c9b)[_0xa9e3('0x2d')](_0x28c55c);};}exports[_0xa9e3('0x2e')]=function(_0x10467f,_0x457fd9){var _0x5dcdde={},_0x3f3b3c={},_0x48676e={'count':0x0,'rows':[]};var _0x5ba389=_['map'](db[_0xa9e3('0x2f')][_0xa9e3('0x30')],function(_0x4ab70f){return{'name':_0x4ab70f[_0xa9e3('0x31')],'type':_0x4ab70f['type'][_0xa9e3('0x32')]};});_0x3f3b3c[_0xa9e3('0x33')]=_[_0xa9e3('0x34')](_0x5ba389,_0xa9e3('0x2c'));_0x3f3b3c['query']=_[_0xa9e3('0x35')](_0x10467f[_0xa9e3('0x36')]);_0x3f3b3c['filters']=_[_0xa9e3('0x37')](_0x3f3b3c[_0xa9e3('0x33')],_0x3f3b3c[_0xa9e3('0x36')]);_0x5dcdde[_0xa9e3('0x38')]=_[_0xa9e3('0x37')](_0x3f3b3c['model'],qs[_0xa9e3('0x39')](_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x39')]));_0x5dcdde[_0xa9e3('0x38')]=_0x5dcdde['attributes'][_0xa9e3('0x3a')]?_0x5dcdde[_0xa9e3('0x38')]:_0x3f3b3c['model'];if(!_0x10467f['query'][_0xa9e3('0x3b')](_0xa9e3('0x3c'))){_0x5dcdde[_0xa9e3('0x23')]=qs[_0xa9e3('0x23')](_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x23')]);_0x5dcdde[_0xa9e3('0x20')]=qs['offset'](_0x10467f['query'][_0xa9e3('0x20')]);}_0x5dcdde[_0xa9e3('0x3d')]=qs[_0xa9e3('0x3e')](_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x3e')]);_0x5dcdde['where']=qs['filters'](_[_0xa9e3('0x3f')](_0x10467f['query'],_0x3f3b3c[_0xa9e3('0x40')]),_0x5ba389);if(_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x41')]){_0x5dcdde[_0xa9e3('0x42')]=_[_0xa9e3('0x43')](_0x5dcdde[_0xa9e3('0x42')],{'$or':_[_0xa9e3('0x34')](_0x5ba389,function(_0x4edc96){if(_0x4edc96[_0xa9e3('0x44')]!=='VIRTUAL'){var _0x2c77e1={};_0x2c77e1[_0x4edc96[_0xa9e3('0x2c')]]={'$like':'%'+_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x41')]+'%'};return _0x2c77e1;}})});}_0x5dcdde=_[_0xa9e3('0x43')]({},_0x5dcdde,_0x10467f[_0xa9e3('0x45')]);var _0x26fb20={'where':_0x5dcdde['where']};return db[_0xa9e3('0x2f')][_0xa9e3('0x22')](_0x26fb20)[_0xa9e3('0x28')](function(_0x2660f1){_0x48676e['count']=_0x2660f1;if(_0x10467f[_0xa9e3('0x36')][_0xa9e3('0x46')]){_0x5dcdde[_0xa9e3('0x47')]=[{'all':!![]}];}return db[_0xa9e3('0x2f')][_0xa9e3('0x48')](_0x5dcdde);})['then'](function(_0x530500){_0x48676e[_0xa9e3('0x49')]=_0x530500;return _0x48676e;})[_0xa9e3('0x28')](respondWithFilteredResult(_0x457fd9,_0x5dcdde))['catch'](handleError(_0x457fd9,null));};exports[_0xa9e3('0x4a')]=function(_0x52f698,_0x352590){var _0x300658={'raw':![],'where':{'id':_0x52f698[_0xa9e3('0x4b')]['id']}},_0x32ed89={};_0x32ed89[_0xa9e3('0x33')]=_['keys'](db[_0xa9e3('0x2f')][_0xa9e3('0x30')]);_0x32ed89['query']=_[_0xa9e3('0x35')](_0x52f698[_0xa9e3('0x36')]);_0x32ed89[_0xa9e3('0x40')]=_['intersection'](_0x32ed89[_0xa9e3('0x33')],_0x32ed89[_0xa9e3('0x36')]);_0x300658[_0xa9e3('0x38')]=_[_0xa9e3('0x37')](_0x32ed89['model'],qs[_0xa9e3('0x39')](_0x52f698[_0xa9e3('0x36')]['fields']));_0x300658[_0xa9e3('0x38')]=_0x300658[_0xa9e3('0x38')][_0xa9e3('0x3a')]?_0x300658[_0xa9e3('0x38')]:_0x32ed89[_0xa9e3('0x33')];if(_0x52f698['query'][_0xa9e3('0x46')]){_0x300658[_0xa9e3('0x47')]=[{'all':!![]}];}_0x300658=_['merge']({},_0x300658,_0x52f698[_0xa9e3('0x45')]);return db[_0xa9e3('0x2f')][_0xa9e3('0x4c')](_0x300658)[_0xa9e3('0x28')](handleEntityNotFound(_0x352590,null))[_0xa9e3('0x28')](respondWithResult(_0x352590,null))[_0xa9e3('0x4d')](handleError(_0x352590,null));};exports[_0xa9e3('0x4e')]=function(_0x310d4f,_0x36b633){return db[_0xa9e3('0x2f')][_0xa9e3('0x4e')](_0x310d4f[_0xa9e3('0x4f')],{})[_0xa9e3('0x28')](function(_0x3b6bbc){var _0x16874c=_0x310d4f['user'][_0xa9e3('0x50')]({'plain':!![]});if(!_0x16874c)throw new Error(_0xa9e3('0x51'));if(_0x16874c[_0xa9e3('0x52')]==='user'){var _0x46bb4b=_0x3b6bbc[_0xa9e3('0x50')]({'plain':!![]});var _0x6cdab0=_0xa9e3('0x53');return db[_0xa9e3('0x54')][_0xa9e3('0x4c')]({'where':{'name':_0x6cdab0,'userProfileId':_0x16874c[_0xa9e3('0x55')]},'raw':!![]})[_0xa9e3('0x28')](function(_0x29db98){if(_0x29db98&&_0x29db98['autoAssociation']===0x0){return db[_0xa9e3('0x56')][_0xa9e3('0x4e')]({'name':_0x46bb4b[_0xa9e3('0x2c')],'resourceId':_0x46bb4b['id'],'type':_0x29db98[_0xa9e3('0x2c')],'sectionId':_0x29db98['id']},{})[_0xa9e3('0x28')](function(){return _0x3b6bbc;});}else{return _0x3b6bbc;}})[_0xa9e3('0x4d')](function(_0x1f3c82){logger[_0xa9e3('0x2a')](_0xa9e3('0x57'),_0x1f3c82);throw _0x1f3c82;});}return _0x3b6bbc;})[_0xa9e3('0x28')](respondWithResult(_0x36b633,0xc9))['catch'](handleError(_0x36b633,null));};exports[_0xa9e3('0x27')]=function(_0x3413ad,_0x29487f){if(_0x3413ad['body']['id']){delete _0x3413ad['body']['id'];}return db[_0xa9e3('0x2f')][_0xa9e3('0x4c')]({'where':{'id':_0x3413ad[_0xa9e3('0x4b')]['id']}})[_0xa9e3('0x28')](handleEntityNotFound(_0x29487f,null))['then'](saveUpdates(_0x3413ad[_0xa9e3('0x4f')],null))[_0xa9e3('0x28')](respondWithResult(_0x29487f,null))[_0xa9e3('0x4d')](handleError(_0x29487f,null));};exports[_0xa9e3('0x58')]=function(_0x79b763,_0x21c135){var _0x4436fb=_0x79b763['params']['id'];var _0x15f882=[];return db[_0xa9e3('0x59')][_0xa9e3('0x5a')](function(_0x1f347a){var _0xdc4112=_0xa9e3('0x5b')+_0x4436fb;return db[_0xa9e3('0x59')][_0xa9e3('0x36')](_0xdc4112,{'type':db[_0xa9e3('0x5c')][_0xa9e3('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f347a})[_0xa9e3('0x28')](function(_0x36f6c2){_0x15f882=_[_0xa9e3('0x34')](_0x36f6c2,function(_0x587592){return Number(_0x587592[_0xa9e3('0x5e')]);});})[_0xa9e3('0x28')](function(){var _0x23fa20=_0xa9e3('0x5f')+_0x4436fb;return db[_0xa9e3('0x59')][_0xa9e3('0x36')](_0x23fa20,{'type':db['Sequelize'][_0xa9e3('0x5d')][_0xa9e3('0x60')],'raw':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x58d09f){var _0x4009bb=_[_0xa9e3('0x34')](_0x58d09f,function(_0x524a41){return Number(_0x524a41[_0xa9e3('0x61')]);});return db['UserVoiceQueue'][_0xa9e3('0x58')]({'where':{'UserId':{'$in':_0x15f882},'VoiceQueueId':{'$in':_0x4009bb}},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){var _0x32ab87=_0xa9e3('0x62')+_0x4436fb;return db[_0xa9e3('0x59')]['query'](_0x32ab87,{'type':db[_0xa9e3('0x5c')][_0xa9e3('0x5d')][_0xa9e3('0x60')],'raw':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x1b517f){var _0x3708ca=_['map'](_0x1b517f,function(_0x3d42ea){return Number(_0x3d42ea[_0xa9e3('0x63')]);});return db[_0xa9e3('0x64')][_0xa9e3('0x58')]({'where':{'UserId':{'$in':_0x15f882},'MailQueueId':{'$in':_0x3708ca}},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){var _0x5df92f=_0xa9e3('0x65')+_0x4436fb;return db['sequelize'][_0xa9e3('0x36')](_0x5df92f,{'type':db[_0xa9e3('0x5c')][_0xa9e3('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f347a});})['then'](function(_0x4a16d6){var _0x36fbbc=_[_0xa9e3('0x34')](_0x4a16d6,function(_0x360c7f){return Number(_0x360c7f[_0xa9e3('0x66')]);});return db[_0xa9e3('0x67')]['destroy']({'where':{'UserId':{'$in':_0x15f882},'SmsQueueId':{'$in':_0x36fbbc}},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){var _0x1e19a6=_0xa9e3('0x68')+_0x4436fb;return db[_0xa9e3('0x59')][_0xa9e3('0x36')](_0x1e19a6,{'type':db['Sequelize'][_0xa9e3('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x15789c){var _0x1ce612=_[_0xa9e3('0x34')](_0x15789c,function(_0x806dec){return Number(_0x806dec['ChatQueueId']);});return db[_0xa9e3('0x69')][_0xa9e3('0x58')]({'where':{'UserId':{'$in':_0x15f882},'ChatQueueId':{'$in':_0x1ce612}},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){var _0x19fa04=_0xa9e3('0x6a')+_0x4436fb;return db[_0xa9e3('0x59')][_0xa9e3('0x36')](_0x19fa04,{'type':db[_0xa9e3('0x5c')][_0xa9e3('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x1ebf57){var _0x16b13c=_[_0xa9e3('0x34')](_0x1ebf57,function(_0x278dd2){return Number(_0x278dd2[_0xa9e3('0x6b')]);});return db[_0xa9e3('0x6c')][_0xa9e3('0x58')]({'where':{'UserId':{'$in':_0x15f882},'FaxQueueId':{'$in':_0x16b13c}},'transaction':_0x1f347a});})['then'](function(){var _0x16f2c2=_0xa9e3('0x6d')+_0x4436fb;return db[_0xa9e3('0x59')][_0xa9e3('0x36')](_0x16f2c2,{'type':db[_0xa9e3('0x5c')][_0xa9e3('0x5d')]['SELECT'],'raw':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x1b0929){var _0x1ea3a1=_[_0xa9e3('0x34')](_0x1b0929,function(_0x486129){return Number(_0x486129[_0xa9e3('0x6e')]);});return db[_0xa9e3('0x6f')][_0xa9e3('0x58')]({'where':{'UserId':{'$in':_0x15f882},'OpenchannelQueueId':{'$in':_0x1ea3a1}},'transaction':_0x1f347a});})['then'](function(){var _0xed1b44='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4436fb;return db['sequelize'][_0xa9e3('0x36')](_0xed1b44,{'type':db['Sequelize'][_0xa9e3('0x5d')][_0xa9e3('0x60')],'raw':!![],'transaction':_0x1f347a});})['then'](function(_0x221386){var _0x381947=_[_0xa9e3('0x34')](_0x221386,function(_0x27b524){return Number(_0x27b524['WhatsappQueueId']);});return db[_0xa9e3('0x70')]['destroy']({'where':{'UserId':{'$in':_0x15f882},'WhatsappQueueId':{'$in':_0x381947}},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){return db[_0xa9e3('0x71')]['find']({'where':{'TeamId':_0x4436fb}});})[_0xa9e3('0x28')](function(_0xc65acf){if(_0xc65acf===null){return;}return db[_0xa9e3('0x72')]['destroy']({'where':{'UserId':{'$in':_0x15f882},'VoicePrefixId':_0xc65acf[_0xa9e3('0x73')]},'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(){return db[_0xa9e3('0x2f')]['destroy']({'where':{'id':_0x4436fb},'cascade':!![],'transaction':_0x1f347a});})[_0xa9e3('0x28')](function(_0x251bd7){if(_0x251bd7===0x0){_0x21c135[_0xa9e3('0x29')](0x194);}else{return db[_0xa9e3('0x56')][_0xa9e3('0x58')]({'where':{'type':'Teams','resourceId':_0x4436fb},'cascade':!![],'transaction':_0x1f347a})[_0xa9e3('0x28')](function(){_0x21c135[_0xa9e3('0x1e')](0xcc)[_0xa9e3('0x74')]();});}})['catch'](function(_0x10c784){_0x21c135['status'](0x1f4)[_0xa9e3('0x2d')](_0x10c784);});});};exports[_0xa9e3('0x75')]=function(_0x5d8277,_0x27eca4,_0x314099){return db[_0xa9e3('0x2f')][_0xa9e3('0x76')]({'where':{'id':_0x5d8277[_0xa9e3('0x4b')]['id']}})[_0xa9e3('0x28')](handleEntityNotFound(_0x27eca4,null))['then'](function(_0xf82c4f){if(!_0x5d8277[_0xa9e3('0x36')][_0xa9e3('0x77')]||!utils['isValidChannel'](_0x5d8277[_0xa9e3('0x36')][_0xa9e3('0x77')])){throw new db[(_0xa9e3('0x5c'))][(_0xa9e3('0x78'))](_0xa9e3('0x79'));}var _0x400671={};var _0x273655={};_0x273655[_0xa9e3('0x33')]=_[_0xa9e3('0x35')](db[_[_0xa9e3('0x7a')](_0x5d8277[_0xa9e3('0x36')]['channel'][_0xa9e3('0x7b')]())+_0xa9e3('0x7c')][_0xa9e3('0x30')]);_0x273655[_0xa9e3('0x36')]=_[_0xa9e3('0x35')](_0x5d8277[_0xa9e3('0x36')]);_0x273655[_0xa9e3('0x40')]=_[_0xa9e3('0x37')](_0x273655[_0xa9e3('0x33')],_0x273655[_0xa9e3('0x36')]);_0x400671[_0xa9e3('0x38')]=_[_0xa9e3('0x37')](_0x273655[_0xa9e3('0x33')],qs[_0xa9e3('0x39')](_0x5d8277['query'][_0xa9e3('0x39')]));_0x400671[_0xa9e3('0x38')]=_0x400671['attributes'][_0xa9e3('0x3a')]?_0x400671[_0xa9e3('0x38')]:_0x273655['model'];_0x400671[_0xa9e3('0x23')]=qs[_0xa9e3('0x23')](_0x5d8277[_0xa9e3('0x36')]['limit']);_0x400671[_0xa9e3('0x20')]=qs[_0xa9e3('0x20')](_0x5d8277[_0xa9e3('0x36')][_0xa9e3('0x20')]);_0x400671['order']=qs[_0xa9e3('0x3e')](_0x5d8277[_0xa9e3('0x36')][_0xa9e3('0x3e')]);_0x400671[_0xa9e3('0x42')]=qs['filters'](_[_0xa9e3('0x3f')](_0x5d8277[_0xa9e3('0x36')],_0x273655[_0xa9e3('0x40')]));_0x400671=_[_0xa9e3('0x43')]({},_0x400671,_0x5d8277[_0xa9e3('0x45')]);return _0xf82c4f[_0xa9e3('0x50')+_[_0xa9e3('0x7a')](_0x5d8277['query'][_0xa9e3('0x77')][_0xa9e3('0x7b')]())+_0xa9e3('0x7d')](_0x400671);})[_0xa9e3('0x28')](respondWithResult(_0x27eca4,null))[_0xa9e3('0x4d')](handleError(_0x27eca4,null));};exports['addQueues']=function(_0x131a28,_0x2cb4a6,_0x400e5b){return db[_0xa9e3('0x2f')][_0xa9e3('0x76')]({'where':{'id':_0x131a28[_0xa9e3('0x4b')]['id']}})[_0xa9e3('0x28')](function(_0x7765ff){if(_0x7765ff){if(!_0x131a28[_0xa9e3('0x4f')]['channel']||!utils[_0xa9e3('0x7e')](_0x131a28['body']['channel'])){throw new db[(_0xa9e3('0x5c'))][(_0xa9e3('0x78'))](_0xa9e3('0x79'));}return _0x7765ff['add'+_[_0xa9e3('0x7a')](_0x131a28['body'][_0xa9e3('0x77')][_0xa9e3('0x7b')]())+'Queues'](_0x131a28['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x2cb4a6,null))[_0xa9e3('0x28')](respondWithStatusCode(_0x2cb4a6,null))[_0xa9e3('0x4d')](handleError(_0x2cb4a6,null));};exports[_0xa9e3('0x7f')]=function(_0x276c96,_0x6d07a7,_0x45b037){return db[_0xa9e3('0x2f')][_0xa9e3('0x76')]({'where':{'id':_0x276c96[_0xa9e3('0x4b')]['id']}})[_0xa9e3('0x28')](function(_0x336579){if(_0x336579){if(!_0x276c96['query'][_0xa9e3('0x77')]||!utils['isValidChannel'](_0x276c96['query'][_0xa9e3('0x77')])){throw new db[(_0xa9e3('0x5c'))][(_0xa9e3('0x78'))]('Unknown\x20channel');}return _0x336579[_0xa9e3('0x80')+_[_0xa9e3('0x7a')](_0x276c96[_0xa9e3('0x36')][_0xa9e3('0x77')]['toLowerCase']())+_0xa9e3('0x7d')](_0x276c96[_0xa9e3('0x36')][_0xa9e3('0x81')]);}return null;})[_0xa9e3('0x28')](handleEntityNotFound(_0x6d07a7,null))[_0xa9e3('0x28')](respondWithStatusCode(_0x6d07a7,null))[_0xa9e3('0x4d')](handleError(_0x6d07a7,null));};exports['addAgents']=function(_0x4f987a,_0x513826){var _0xee4119=_[_0xa9e3('0x82')](_0x4f987a[_0xa9e3('0x4f')][_0xa9e3('0x81')])?_0x4f987a[_0xa9e3('0x4f')][_0xa9e3('0x81')]:[_0x4f987a[_0xa9e3('0x4f')][_0xa9e3('0x81')]];var _0xefdc1b=_0x4f987a[_0xa9e3('0x4b')]['id'];return db[_0xa9e3('0x2f')][_0xa9e3('0x4c')]({'where':{'id':_0xefdc1b}})[_0xa9e3('0x28')](handleEntityNotFound(_0x513826,null))[_0xa9e3('0x28')](function(_0x4b8cd5){if(_0x4b8cd5){var _0x7eefbf=['Voice',_0xa9e3('0x83'),_0xa9e3('0x84'),_0xa9e3('0x85'),'Fax','Openchannel',_0xa9e3('0x86')];return db[_0xa9e3('0x59')]['transaction'](function(_0xf9924f){var _0x1905a0=_['map'](_0x7eefbf,function(_0xf6578e){var _0x55f71d={'attributes':['id','name']};if(_0xf6578e===_0xa9e3('0x87')){_0x55f71d[_0xa9e3('0x88')]={'attributes':[_0xa9e3('0x89')]};}return _0x4b8cd5['get'+_0xf6578e+'Queues'](_0x55f71d)[_0xa9e3('0x28')](function(_0x254e29){var _0x2f2406=_[_0xa9e3('0x34')](_0x254e29,function(_0x1f5dda){var _0x2fa55f=_['map'](_0xee4119,function(_0x5814a0){var _0x28fd60={'where':{'UserId':_0x5814a0,[_0xf6578e+'QueueId']:_0x1f5dda['id']},'transaction':_0xf9924f};if(_0xf6578e===_0xa9e3('0x87')){_0x28fd60[_0xa9e3('0x19')]={'penalty':_0x1f5dda[_0xa9e3('0x8a')]['penalty']};}return db[_0xa9e3('0x8b')+_0xf6578e+_0xa9e3('0x7c')][_0xa9e3('0x8c')](_0x28fd60)['then'](function(){socket[_0xa9e3('0x8d')]('user'+_0xf6578e+'Queue:save',{'UserId':_0x5814a0,[_0xf6578e+'QueueId']:_0x1f5dda['id']});if(_0xf6578e!=='Voice'){return;}return db[_0xa9e3('0x8b')][_0xa9e3('0x48')]({'where':{'id':_0xee4119,'online':0x1},'attributes':['id','name',_0xa9e3('0x8e'),'voicePause',_0xa9e3('0x8f')],'raw':!![]})[_0xa9e3('0x28')](function(_0x36686a){var _0x378b39=_[_0xa9e3('0x34')](_0x36686a,function(_0x1b5534){return db['UserVoiceQueueRt'][_0xa9e3('0x90')]({'membername':_0x1b5534[_0xa9e3('0x2c')],'UserId':_0x1b5534['id'],'queue_name':_0x1f5dda[_0xa9e3('0x2c')],'VoiceQueueId':_0x1f5dda['id'],'interface':_[_0xa9e3('0x91')](_0x1b5534[_0xa9e3('0x8f')])?util['format'](_0xa9e3('0x92'),_0x1b5534['name']):_0x1b5534[_0xa9e3('0x8f')],'paused':_0x1b5534[_0xa9e3('0x93')]||![],'penalty':_0x1f5dda[_0xa9e3('0x8a')][_0xa9e3('0x89')]},{'transaction':_0xf9924f});});return Promise[_0xa9e3('0x94')](_0x378b39);});});});return Promise['all'](_0x2fa55f);});return Promise[_0xa9e3('0x94')](_0x2f2406);})[_0xa9e3('0x28')](function(){return db[_0xa9e3('0x71')][_0xa9e3('0x76')]({'where':{'teamId':_0xefdc1b}})[_0xa9e3('0x28')](function(_0x40ee07){if(_0x40ee07){var _0x38f93b=_[_0xa9e3('0x34')](_0xee4119,function(_0x32318c){db[_0xa9e3('0x72')][_0xa9e3('0x90')]({'UserId':_0x32318c,'VoicePrefixId':_0x40ee07[_0xa9e3('0x73')]});});return Promise[_0xa9e3('0x94')](_0x38f93b);}});});});return Promise['all'](_0x1905a0)[_0xa9e3('0x28')](function(){return _0x4b8cd5[_0xa9e3('0x95')](_0xee4119,{'transaction':_0xf9924f})['spread'](function(_0x12eb38){return _0x12eb38;});});});}})['then'](respondWithResult(_0x513826,null))['catch'](handleError(_0x513826,null));};exports['removeAgents']=function(_0x4e5050,_0x73e205){var _0x1351be=_[_0xa9e3('0x82')](_0x4e5050[_0xa9e3('0x36')][_0xa9e3('0x81')])?_0x4e5050['query'][_0xa9e3('0x81')]:[_0x4e5050[_0xa9e3('0x36')][_0xa9e3('0x81')]];var _0x5d0ad1=_0x4e5050[_0xa9e3('0x4b')]['id'];return db[_0xa9e3('0x2f')][_0xa9e3('0x4c')]({'where':{'id':_0x5d0ad1}})[_0xa9e3('0x28')](handleEntityNotFound(_0x73e205,null))[_0xa9e3('0x28')](function(_0x2c2dc4){if(_0x2c2dc4){var _0x2fceb3=[_0xa9e3('0x87'),'Chat','Mail',_0xa9e3('0x85'),'Fax',_0xa9e3('0x96'),_0xa9e3('0x86')];return db[_0xa9e3('0x59')][_0xa9e3('0x5a')](function(_0x4a7aa6){var _0x51d25c=_[_0xa9e3('0x34')](_0x2fceb3,function(_0x5da1e9){var _0x80e995={'attributes':['id',_0xa9e3('0x2c')]};return _0x2c2dc4['get'+_0x5da1e9+_0xa9e3('0x7d')](_0x80e995)[_0xa9e3('0x28')](function(_0x35c8e8){var _0x30deeb=_[_0xa9e3('0x34')](_0x35c8e8,function(_0x31912b){return _0x31912b['removeAgents'](_0x1351be,{'transaction':_0x4a7aa6})[_0xa9e3('0x28')](function(){var _0x219a35=_['map'](_0x1351be,function(_0x22ab29){socket[_0xa9e3('0x8d')](_0xa9e3('0x97')+_0x5da1e9+_0xa9e3('0x98'),{'UserId':Number(_0x22ab29),[_0x5da1e9+_0xa9e3('0x99')]:_0x31912b['id']});if(_0x5da1e9!==_0xa9e3('0x87')){return;}return db[_0xa9e3('0x9a')]['destroy']({'where':{'VoiceQueueId':_0x31912b['id'],'UserId':_0x22ab29},'transaction':_0x4a7aa6});});return Promise[_0xa9e3('0x94')](_0x219a35);});});return Promise[_0xa9e3('0x94')](_0x30deeb);});});return Promise[_0xa9e3('0x94')](_0x51d25c)[_0xa9e3('0x28')](function(){return _0x2c2dc4['removeAgents'](_0x1351be,{'transaction':_0x4a7aa6});})[_0xa9e3('0x28')](function(){return db[_0xa9e3('0x71')][_0xa9e3('0x76')]({'where':{'teamId':_0x5d0ad1}})[_0xa9e3('0x28')](function(_0x365380){if(_0x365380){var _0x397b24=_[_0xa9e3('0x34')](_0x1351be,function(_0x5b112d){db['UserVoicePrefix'][_0xa9e3('0x58')]({'where':{'UserId':_0x5b112d,'VoicePrefixId':_0x365380[_0xa9e3('0x73')]}});});return Promise['all'](_0x397b24);}});});});}})[_0xa9e3('0x28')](respondWithStatusCode(_0x73e205,null))[_0xa9e3('0x4d')](handleError(_0x73e205,null));};exports['getAgents']=function(_0x2e88ca,_0x20ebb8,_0x492e8e){var _0x498611={};var _0x5d2a1a={};var _0x4005f8;var _0x410896;return db['Team']['findOne']({'where':{'id':_0x2e88ca[_0xa9e3('0x4b')]['id']}})[_0xa9e3('0x28')](handleEntityNotFound(_0x20ebb8,null))[_0xa9e3('0x28')](function(_0x36e457){if(_0x36e457){_0x4005f8=_0x36e457;_0x5d2a1a['model']=_[_0xa9e3('0x35')](db[_0xa9e3('0x8b')][_0xa9e3('0x30')]);_0x5d2a1a[_0xa9e3('0x36')]=_[_0xa9e3('0x35')](_0x2e88ca['query']);_0x5d2a1a[_0xa9e3('0x40')]=_[_0xa9e3('0x37')](_0x5d2a1a[_0xa9e3('0x33')],_0x5d2a1a[_0xa9e3('0x36')]);_0x498611[_0xa9e3('0x38')]=_[_0xa9e3('0x37')](_0x5d2a1a[_0xa9e3('0x33')],qs[_0xa9e3('0x39')](_0x2e88ca[_0xa9e3('0x36')][_0xa9e3('0x39')]));_0x498611[_0xa9e3('0x38')]=_0x498611[_0xa9e3('0x38')]['length']?_0x498611[_0xa9e3('0x38')]:_0x5d2a1a[_0xa9e3('0x33')];_0x498611[_0xa9e3('0x3d')]=qs[_0xa9e3('0x3e')](_0x2e88ca['query'][_0xa9e3('0x3e')]);_0x498611[_0xa9e3('0x42')]=qs['filters'](_[_0xa9e3('0x3f')](_0x2e88ca[_0xa9e3('0x36')],_0x5d2a1a[_0xa9e3('0x40')]));if(_0x2e88ca[_0xa9e3('0x36')]['filter']){_0x498611[_0xa9e3('0x42')]=_[_0xa9e3('0x43')](_0x498611['where'],{'$or':_['map'](_0x498611[_0xa9e3('0x38')],function(_0x2d7c9c){var _0x25b711={};_0x25b711[_0x2d7c9c]={'$like':'%'+_0x2e88ca[_0xa9e3('0x36')][_0xa9e3('0x41')]+'%'};return _0x25b711;})});}_0x498611=_[_0xa9e3('0x43')]({},_0x498611,_0x2e88ca[_0xa9e3('0x45')]);return _0x4005f8['getAgents'](_0x498611);}})[_0xa9e3('0x28')](function(_0x4f9ed4){if(_0x4f9ed4){_0x410896=_0x4f9ed4[_0xa9e3('0x3a')];if(!_0x2e88ca['query'][_0xa9e3('0x3b')]('nolimit')){_0x498611[_0xa9e3('0x23')]=qs['limit'](_0x2e88ca[_0xa9e3('0x36')][_0xa9e3('0x23')]);_0x498611['offset']=qs[_0xa9e3('0x20')](_0x2e88ca['query']['offset']);}return _0x4005f8[_0xa9e3('0x9b')](_0x498611);}})['then'](function(_0x517a6b){if(_0x517a6b){return _0x517a6b?{'count':_0x410896,'rows':_0x517a6b}:null;}})[_0xa9e3('0x28')](respondWithResult(_0x20ebb8,null))[_0xa9e3('0x4d')](handleError(_0x20ebb8,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index cfe763f..2c81233 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 _0x1a0e=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x1fbb2b,_0x2a7fbd){var _0x29acf2=function(_0x5a6196){while(--_0x5a6196){_0x1fbb2b['push'](_0x1fbb2b['shift']());}};_0x29acf2(++_0x2a7fbd);}(_0x1a0e,0xbb));var _0xe1a0=function(_0x51b698,_0x2fd161){_0x51b698=_0x51b698-0x0;var _0xfa0590=_0x1a0e[_0x51b698];return _0xfa0590;};'use strict';var EventEmitter=require('events');var Team=require(_0xe1a0('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe1a0('0x1')](0x0);var events={'afterCreate':_0xe1a0('0x2'),'afterUpdate':'update','afterDestroy':_0xe1a0('0x3')};function emitEvent(_0x22c878){return function(_0x1bfde7,_0x152b0f,_0x4e4306){TeamEvents[_0xe1a0('0x4')](_0x22c878+':'+_0x1bfde7['id'],_0x1bfde7);TeamEvents[_0xe1a0('0x4')](_0x22c878,_0x1bfde7);_0x4e4306(null);};}for(var e in events){if(events[_0xe1a0('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xe1a0('0x6')]=TeamEvents; \ No newline at end of file +var _0x197e=['events','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3c90d6,_0x41eb61){var _0x480355=function(_0x45b958){while(--_0x45b958){_0x3c90d6['push'](_0x3c90d6['shift']());}};_0x480355(++_0x41eb61);}(_0x197e,0xe6));var _0xe197=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x197e[_0x3ab9ee];return _0x82ee88;};'use strict';var EventEmitter=require(_0xe197('0x0'));var Team=require(_0xe197('0x1'))['db'][_0xe197('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe197('0x3')](0x0);var events={'afterCreate':_0xe197('0x4'),'afterUpdate':'update','afterDestroy':_0xe197('0x5')};function emitEvent(_0x5099b4){return function(_0x12c10c,_0x187448,_0x186ea6){TeamEvents['emit'](_0x5099b4+':'+_0x12c10c['id'],_0x12c10c);TeamEvents[_0xe197('0x6')](_0x5099b4,_0x12c10c);_0x186ea6(null);};}for(var e in events){if(events[_0xe197('0x7')](e)){var event=events[e];Team[_0xe197('0x8')](e,emitEvent(event));}}module[_0xe197('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2cc8f76..4a44672 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 _0x12ad=['map','setDataValue','define','Team','teams','Fax','Mail','Sms','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes','get','then'];(function(_0x24bade,_0x211808){var _0x5cbbd5=function(_0x53535f){while(--_0x53535f){_0x24bade['push'](_0x24bade['shift']());}};_0x5cbbd5(++_0x211808);}(_0x12ad,0x1a5));var _0xd12a=function(_0x2cefd2,_0x3eed48){_0x2cefd2=_0x2cefd2-0x0;var _0x528537=_0x12ad[_0x2cefd2];return _0x528537;};'use strict';var _=require(_0xd12a('0x0'));var attributes=require(_0xd12a('0x1'));function getQueuesByChannel(_0x171d1d,_0x307679){var _0x49a830=_0xd12a('0x2')+_0x307679+'Queues';return _0x171d1d[_0x49a830]()[_0xd12a('0x3')](function(_0x27fa27){return _[_0xd12a('0x4')](_0x27fa27,function(_0xc8b0ea){_0xc8b0ea[_0xd12a('0x5')]('channel',_0x307679);return _0xc8b0ea;});})['catch'](function(_0x2fdf5a){throw _0x2fdf5a;});}module['exports']=function(_0x553413){return _0x553413[_0xd12a('0x6')](_0xd12a('0x7'),attributes,{'tableName':_0xd12a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xd1096d=this;var _0x449b5d=['Chat',_0xd12a('0x9'),_0xd12a('0xa'),'Openchannel',_0xd12a('0xb'),_0xd12a('0xc'),_0xd12a('0xd')];return Promise[_0xd12a('0xe')]()[_0xd12a('0x3')](function(){var _0x35b0b1=_[_0xd12a('0x4')](_0x449b5d,function(_0x279db7){return getQueuesByChannel(_0xd1096d,_0x279db7);});return Promise[_0xd12a('0xf')](_0x35b0b1);})[_0xd12a('0x10')](function(_0x5b64eb){throw _0x5b64eb;});}}});}; \ No newline at end of file +var _0xb130=['resolve','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports','define','Team','teams','Chat','Openchannel','Sms','Voice','Whatsapp'];(function(_0x225cd4,_0x3f62ae){var _0x391565=function(_0xb31054){while(--_0xb31054){_0x225cd4['push'](_0x225cd4['shift']());}};_0x391565(++_0x3f62ae);}(_0xb130,0xad));var _0x0b13=function(_0x2c73fa,_0x41b660){_0x2c73fa=_0x2c73fa-0x0;var _0x201374=_0xb130[_0x2c73fa];return _0x201374;};'use strict';var _=require(_0x0b13('0x0'));var attributes=require(_0x0b13('0x1'));function getQueuesByChannel(_0x444ba5,_0x318adc){var _0x127ca3=_0x0b13('0x2')+_0x318adc+_0x0b13('0x3');return _0x444ba5[_0x127ca3]()[_0x0b13('0x4')](function(_0x4cba97){return _[_0x0b13('0x5')](_0x4cba97,function(_0x46a734){_0x46a734['setDataValue'](_0x0b13('0x6'),_0x318adc);return _0x46a734;});})[_0x0b13('0x7')](function(_0x1b7bc3){throw _0x1b7bc3;});}module[_0x0b13('0x8')]=function(_0x84bab9){return _0x84bab9[_0x0b13('0x9')](_0x0b13('0xa'),attributes,{'tableName':_0x0b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x151c14=this;var _0x430eea=[_0x0b13('0xc'),'Fax','Mail',_0x0b13('0xd'),_0x0b13('0xe'),_0x0b13('0xf'),_0x0b13('0x10')];return Promise[_0x0b13('0x11')]()['then'](function(){var _0x2f45ac=_[_0x0b13('0x5')](_0x430eea,function(_0x44f45d){return getQueuesByChannel(_0x151c14,_0x44f45d);});return Promise[_0x0b13('0x12')](_0x2f45ac);})['catch'](function(_0x107cad){throw _0x107cad;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index a40c0c4..d01042c 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 _0xfe55=['defaults','localhost','socket.io-emitter','./team.socket','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfe55,0x9d));var _0x5fe5=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xfe55[_0x402c8f];return _0x11e809;};'use strict';var _=require('lodash');var util=require(_0x5fe5('0x0'));var moment=require(_0x5fe5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fe5('0x2'));var db=require(_0x5fe5('0x3'))['db'];var utils=require(_0x5fe5('0x4'));var logger=require(_0x5fe5('0x5'))(_0x5fe5('0x6'));var config=require(_0x5fe5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fe5('0x8')][_0x5fe5('0x9')]({'port':0x232a});config[_0x5fe5('0xa')]=_[_0x5fe5('0xb')](config[_0x5fe5('0xa')],{'host':_0x5fe5('0xc'),'port':0x18eb});var socket=require(_0x5fe5('0xd'))(new Redis(config[_0x5fe5('0xa')]));require(_0x5fe5('0xe'))['register'](socket);function respondWithRpcPromise(_0x655c6a,_0x13a201,_0x21987b){return new BPromise(function(_0x59918d,_0x5d6532){return client['request'](_0x655c6a,_0x21987b)['then'](function(_0xac0d65){logger[_0x5fe5('0xf')](_0x5fe5('0x10'),_0x13a201,_0x5fe5('0x11'));logger[_0x5fe5('0x12')](_0x5fe5('0x13'),_0x13a201,'request\x20sent',JSON['stringify'](_0xac0d65));if(_0xac0d65[_0x5fe5('0x14')]){if(_0xac0d65[_0x5fe5('0x14')][_0x5fe5('0x15')]===0x1f4){logger['error'](_0x5fe5('0x10'),_0x13a201,_0xac0d65[_0x5fe5('0x14')]['message']);return _0x5d6532(_0xac0d65[_0x5fe5('0x14')][_0x5fe5('0x16')]);}logger['error']('Team,\x20%s,\x20%s',_0x13a201,_0xac0d65[_0x5fe5('0x14')]['message']);return _0x59918d(_0xac0d65['error'][_0x5fe5('0x16')]);}else{logger[_0x5fe5('0xf')](_0x5fe5('0x10'),_0x13a201,_0x5fe5('0x11'));_0x59918d(_0xac0d65[_0x5fe5('0x17')][_0x5fe5('0x16')]);}})['catch'](function(_0x204b8c){logger[_0x5fe5('0x14')]('Team,\x20%s,\x20%s',_0x13a201,_0x204b8c);_0x5d6532(_0x204b8c);});});} \ No newline at end of file +var _0xabeb=['../../mysqldb','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x49fdc9,_0x429f86){var _0xc586fd=function(_0xd509a0){while(--_0xd509a0){_0x49fdc9['push'](_0x49fdc9['shift']());}};_0xc586fd(++_0x429f86);}(_0xabeb,0x181));var _0xbabe=function(_0x41273e,_0x1a8d3f){_0x41273e=_0x41273e-0x0;var _0x340241=_0xabeb[_0x41273e];return _0x340241;};'use strict';var _=require(_0xbabe('0x0'));var util=require(_0xbabe('0x1'));var moment=require(_0xbabe('0x2'));var BPromise=require(_0xbabe('0x3'));var rs=require(_0xbabe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbabe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbabe('0x6'))(_0xbabe('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbabe('0x8')]({'port':0x232a});config[_0xbabe('0x9')]=_[_0xbabe('0xa')](config[_0xbabe('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xbabe('0xb'))(new Redis(config['redis']));require('./team.socket')[_0xbabe('0xc')](socket);function respondWithRpcPromise(_0x648916,_0x4ce671,_0xd4c60){return new BPromise(function(_0x16b733,_0x10853c){return client[_0xbabe('0xd')](_0x648916,_0xd4c60)[_0xbabe('0xe')](function(_0x395b5f){logger[_0xbabe('0xf')](_0xbabe('0x10'),_0x4ce671,_0xbabe('0x11'));logger[_0xbabe('0x12')](_0xbabe('0x13'),_0x4ce671,'request\x20sent',JSON[_0xbabe('0x14')](_0x395b5f));if(_0x395b5f[_0xbabe('0x15')]){if(_0x395b5f[_0xbabe('0x15')][_0xbabe('0x16')]===0x1f4){logger[_0xbabe('0x15')](_0xbabe('0x10'),_0x4ce671,_0x395b5f[_0xbabe('0x15')]['message']);return _0x10853c(_0x395b5f[_0xbabe('0x15')][_0xbabe('0x17')]);}logger['error']('Team,\x20%s,\x20%s',_0x4ce671,_0x395b5f[_0xbabe('0x15')][_0xbabe('0x17')]);return _0x16b733(_0x395b5f[_0xbabe('0x15')][_0xbabe('0x17')]);}else{logger[_0xbabe('0xf')](_0xbabe('0x10'),_0x4ce671,_0xbabe('0x11'));_0x16b733(_0x395b5f[_0xbabe('0x18')][_0xbabe('0x17')]);}})[_0xbabe('0x19')](function(_0x45fb04){logger[_0xbabe('0x15')](_0xbabe('0x10'),_0x4ce671,_0x45fb04);_0x10853c(_0x45fb04);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6e3c228..4f3a8f8 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 _0xc009=['update','emit','removeListener','register','length','./team.events','save'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xc009,0xc9));var _0x9c00=function(_0x2523db,_0x5935c7){_0x2523db=_0x2523db-0x0;var _0x6fa64b=_0xc009[_0x2523db];return _0x6fa64b;};'use strict';var TeamEvents=require(_0x9c00('0x0'));var events=[_0x9c00('0x1'),'remove',_0x9c00('0x2')];function createListener(_0x45a262,_0x5a94dd){return function(_0x5c8be1){_0x5a94dd[_0x9c00('0x3')](_0x45a262,_0x5c8be1);};}function removeListener(_0x558af3,_0x429dba){return function(){TeamEvents[_0x9c00('0x4')](_0x558af3,_0x429dba);};}exports[_0x9c00('0x5')]=function(_0x3556b3){for(var _0x30aace=0x0,_0x54f6e4=events[_0x9c00('0x6')];_0x30aace<_0x54f6e4;_0x30aace++){var _0x558614=events[_0x30aace];var _0x1627e2=createListener('team:'+_0x558614,_0x3556b3);TeamEvents['on'](_0x558614,_0x1627e2);}}; \ No newline at end of file +var _0x1371=['team:','./team.events','save','remove','emit','removeListener','register','length'];(function(_0x423bf0,_0x2bf4c3){var _0x42ec64=function(_0xecb9aa){while(--_0xecb9aa){_0x423bf0['push'](_0x423bf0['shift']());}};_0x42ec64(++_0x2bf4c3);}(_0x1371,0x91));var _0x1137=function(_0x5a8152,_0x4dbae7){_0x5a8152=_0x5a8152-0x0;var _0x1b3389=_0x1371[_0x5a8152];return _0x1b3389;};'use strict';var TeamEvents=require(_0x1137('0x0'));var events=[_0x1137('0x1'),_0x1137('0x2'),'update'];function createListener(_0x3d73dc,_0x625608){return function(_0x3dab43){_0x625608[_0x1137('0x3')](_0x3d73dc,_0x3dab43);};}function removeListener(_0x8d13c8,_0x200e56){return function(){TeamEvents[_0x1137('0x4')](_0x8d13c8,_0x200e56);};}exports[_0x1137('0x5')]=function(_0x5d9cf0){for(var _0x1933a8=0x0,_0x4e2d0a=events[_0x1137('0x6')];_0x1933a8<_0x4e2d0a;_0x1933a8++){var _0xd6ecc8=events[_0x1933a8];var _0x2b2acc=createListener(_0x1137('0x7')+_0xd6ecc8,_0x5d9cf0);TeamEvents['on'](_0xd6ecc8,_0x2b2acc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0e14301..5e4ada1 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 _0xcc40=['INTEGER','sequelize'];(function(_0x68b042,_0x261e87){var _0x20c9be=function(_0x1d692b){while(--_0x1d692b){_0x68b042['push'](_0x68b042['shift']());}};_0x20c9be(++_0x261e87);}(_0xcc40,0x97));var _0x0cc4=function(_0x4aa9ed,_0x93e3a2){_0x4aa9ed=_0x4aa9ed-0x0;var _0x14c0a5=_0xcc40[_0x4aa9ed];return _0x14c0a5;};'use strict';var Sequelize=require(_0x0cc4('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x0cc4('0x1')]}}; \ No newline at end of file +var _0xc874=['sequelize','INTEGER'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0xc874,0x154));var _0x4c87=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0xc874[_0x5bfa44];return _0x43815f;};'use strict';var Sequelize=require(_0x4c87('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x4c87('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4c87('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2cd2006..f0f7f43 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 _0xb010=['rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','util','api','bluebird','path'];(function(_0x4b5933,_0x2f3f64){var _0x58c26f=function(_0x1929b8){while(--_0x1929b8){_0x4b5933['push'](_0x4b5933['shift']());}};_0x58c26f(++_0x2f3f64);}(_0xb010,0x8b));var _0x0b01=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb010[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x0b01('0x0'));var logger=require('../../config/logger')(_0x0b01('0x1'));var moment=require('moment');var BPromise=require(_0x0b01('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b01('0x3'));var rimraf=require(_0x0b01('0x4'));var config=require(_0x0b01('0x5'));var attributes=require(_0x0b01('0x6'));module[_0x0b01('0x7')]=function(_0x1eade9,_0x250f25){return _0x1eade9[_0x0b01('0x8')](_0x0b01('0x9'),attributes,{'tableName':_0x0b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['request-promise','path','rimraf','./teamVoicePrefix.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xbdb7[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('TeamVoicePrefix',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 c26a1f1..341314a 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4e4d4b,_0x3a85d4){var _0x7cd244=function(_0x4965ff){while(--_0x4965ff){_0x4e4d4b['push'](_0x4e4d4b['shift']());}};_0x7cd244(++_0x3a85d4);}(_0x70e0,0x17b));var _0x070e=function(_0x35ba87,_0xc7d66a){_0x35ba87=_0x35ba87-0x0;var _0x336d59=_0x70e0[_0x35ba87];return _0x336d59;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5eff0b,_0x2ae598){var _0xce2ae4=function(_0x35bbf6){while(--_0x35bbf6){_0x5eff0b['push'](_0x5eff0b['shift']());}};_0xce2ae4(++_0x2ae598);}(_0xe706,0xa3));var _0x6e70=function(_0x4ec3de,_0x1c67c4){_0x4ec3de=_0x4ec3de-0x0;var _0x37478a=_0xe706[_0x4ec3de];return _0x37478a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c59f3a4..bf90a70 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 _0x937c=['sequelize','exports','INTEGER'];(function(_0x59a475,_0x4b607a){var _0x6695e7=function(_0x140809){while(--_0x140809){_0x59a475['push'](_0x59a475['shift']());}};_0x6695e7(++_0x4b607a);}(_0x937c,0x6c));var _0xc937=function(_0x519378,_0x6bec08){_0x519378=_0x519378-0x0;var _0x278456=_0x937c[_0x519378];return _0x278456;};'use strict';var Sequelize=require(_0xc937('0x0'));module[_0xc937('0x1')]={'penalty':{'type':Sequelize[_0xc937('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e8c=['INTEGER','sequelize'];(function(_0x492603,_0xf0fa6f){var _0x1be403=function(_0x89e78c){while(--_0x89e78c){_0x492603['push'](_0x492603['shift']());}};_0x1be403(++_0xf0fa6f);}(_0x2e8c,0xbd));var _0xc2e8=function(_0x3664f5,_0xa63a64){_0x3664f5=_0x3664f5-0x0;var _0x1e7303=_0x2e8c[_0x3664f5];return _0x1e7303;};'use strict';var Sequelize=require(_0xc2e8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc2e8('0x1')],'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 944cc23..3c4a552 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 _0x692c=['TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x56bf9f,_0x457fd0){var _0x29850c=function(_0xece461){while(--_0xece461){_0x56bf9f['push'](_0x56bf9f['shift']());}};_0x29850c(++_0x457fd0);}(_0x692c,0x6a));var _0xc692=function(_0x727995,_0x2f2d91){_0x727995=_0x727995-0x0;var _0x38458e=_0x692c[_0x727995];return _0x38458e;};'use strict';var _=require(_0xc692('0x0'));var util=require(_0xc692('0x1'));var logger=require(_0xc692('0x2'))(_0xc692('0x3'));var moment=require(_0xc692('0x4'));var BPromise=require(_0xc692('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc692('0x6'));var rimraf=require(_0xc692('0x7'));var config=require(_0xc692('0x8'));var attributes=require(_0xc692('0x9'));module[_0xc692('0xa')]=function(_0x1b54a9,_0x4f8759){return _0x1b54a9['define'](_0xc692('0xb'),attributes,{'tableName':_0xc692('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63bb=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue'];(function(_0xbcfd08,_0xe4414a){var _0x31c2de=function(_0x147308){while(--_0x147308){_0xbcfd08['push'](_0xbcfd08['shift']());}};_0x31c2de(++_0xe4414a);}(_0x63bb,0xf8));var _0xb63b=function(_0x7f287d,_0xe3b36e){_0x7f287d=_0x7f287d-0x0;var _0x21514f=_0x63bb[_0x7f287d];return _0x21514f;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var logger=require(_0xb63b('0x2'))(_0xb63b('0x3'));var moment=require(_0xb63b('0x4'));var BPromise=require(_0xb63b('0x5'));var rp=require(_0xb63b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb63b('0x7'));var attributes=require(_0xb63b('0x8'));module[_0xb63b('0x9')]=function(_0x22be29,_0x4fc464){return _0x22be29[_0xb63b('0xa')](_0xb63b('0xb'),attributes,{'tableName':_0xb63b('0xc'),'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 ce744a6..ab5834b 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 _0x982c=['request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0xec609d,_0x28de5b){var _0x5711c1=function(_0x59900c){while(--_0x59900c){_0xec609d['push'](_0xec609d['shift']());}};_0x5711c1(++_0x28de5b);}(_0x982c,0xd9));var _0xc982=function(_0x1600c3,_0x555b85){_0x1600c3=_0x1600c3-0x0;var _0x10f45d=_0x982c[_0x1600c3];return _0x10f45d;};'use strict';var _=require('lodash');var util=require(_0xc982('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc982('0x1'));var fs=require('fs');var Redis=require(_0xc982('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc982('0x3'));var logger=require(_0xc982('0x4'))(_0xc982('0x5'));var config=require('../../config/environment');var jayson=require(_0xc982('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce5ea,_0x55d698,_0x2dbf31){return new BPromise(function(_0x3545c1,_0x51974a){return client[_0xc982('0x7')](_0x1ce5ea,_0x2dbf31)[_0xc982('0x8')](function(_0xae94c8){logger[_0xc982('0x9')](_0xc982('0xa'),_0x55d698,_0xc982('0xb'));logger['debug'](_0xc982('0xc'),_0x55d698,_0xc982('0xb'),JSON[_0xc982('0xd')](_0xae94c8));if(_0xae94c8['error']){if(_0xae94c8['error'][_0xc982('0xe')]===0x1f4){logger[_0xc982('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x55d698,_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);return _0x51974a(_0xae94c8[_0xc982('0xf')]['message']);}logger[_0xc982('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x55d698,_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);return _0x3545c1(_0xae94c8[_0xc982('0xf')][_0xc982('0x10')]);}else{logger[_0xc982('0x9')](_0xc982('0xa'),_0x55d698,'request\x20sent');_0x3545c1(_0xae94c8[_0xc982('0x11')][_0xc982('0x10')]);}})[_0xc982('0x12')](function(_0x25a0fd){logger[_0xc982('0xf')](_0xc982('0xa'),_0x55d698,_0x25a0fd);_0x51974a(_0x25a0fd);});});} \ No newline at end of file +var _0xf6da=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3f24ac,_0x3514b2){var _0x17f584=function(_0x96dd01){while(--_0x96dd01){_0x3f24ac['push'](_0x3f24ac['shift']());}};_0x17f584(++_0x3514b2);}(_0xf6da,0x65));var _0xaf6d=function(_0x558342,_0x961f31){_0x558342=_0x558342-0x0;var _0x464347=_0xf6da[_0x558342];return _0x464347;};'use strict';var _=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var moment=require(_0xaf6d('0x2'));var BPromise=require(_0xaf6d('0x3'));var rs=require(_0xaf6d('0x4'));var fs=require('fs');var Redis=require(_0xaf6d('0x5'));var db=require(_0xaf6d('0x6'))['db'];var utils=require(_0xaf6d('0x7'));var logger=require(_0xaf6d('0x8'))(_0xaf6d('0x9'));var config=require(_0xaf6d('0xa'));var jayson=require(_0xaf6d('0xb'));var client=jayson['client'][_0xaf6d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e97dc,_0x5c01b8,_0x2cb3aa){return new BPromise(function(_0x4b93b2,_0x32e622){return client[_0xaf6d('0xd')](_0x3e97dc,_0x2cb3aa)[_0xaf6d('0xe')](function(_0x14bc2e){logger[_0xaf6d('0xf')](_0xaf6d('0x10'),_0x5c01b8,'request\x20sent');logger[_0xaf6d('0x11')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c01b8,_0xaf6d('0x12'),JSON[_0xaf6d('0x13')](_0x14bc2e));if(_0x14bc2e[_0xaf6d('0x14')]){if(_0x14bc2e[_0xaf6d('0x14')][_0xaf6d('0x15')]===0x1f4){logger['error'](_0xaf6d('0x10'),_0x5c01b8,_0x14bc2e['error'][_0xaf6d('0x16')]);return _0x32e622(_0x14bc2e[_0xaf6d('0x14')][_0xaf6d('0x16')]);}logger[_0xaf6d('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5c01b8,_0x14bc2e[_0xaf6d('0x14')]['message']);return _0x4b93b2(_0x14bc2e['error'][_0xaf6d('0x16')]);}else{logger[_0xaf6d('0xf')](_0xaf6d('0x10'),_0x5c01b8,_0xaf6d('0x12'));_0x4b93b2(_0x14bc2e['result']['message']);}})[_0xaf6d('0x17')](function(_0x146a33){logger[_0xaf6d('0x14')](_0xaf6d('0x10'),_0x5c01b8,_0x146a33);_0x32e622(_0x146a33);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ad31b45..d408758 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 _0xc43c=['update','delete','destroy','exports','multer','util','path','fs-extra','./template.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xc43c,0xd4));var _0xcc43=function(_0x2effc3,_0x49988c){_0x2effc3=_0x2effc3-0x0;var _0x56d065=_0xc43c[_0x2effc3];return _0x56d065;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcc43('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcc43('0x4'));router[_0xcc43('0x5')]('/',auth[_0xcc43('0x6')](),controller['index']);router[_0xcc43('0x5')](_0xcc43('0x7'),auth[_0xcc43('0x6')](),controller[_0xcc43('0x8')]);router[_0xcc43('0x9')]('/',auth[_0xcc43('0x6')](),controller[_0xcc43('0xa')]);router[_0xcc43('0xb')]('/:id',auth[_0xcc43('0x6')](),controller[_0xcc43('0xc')]);router[_0xcc43('0xd')](_0xcc43('0x7'),auth[_0xcc43('0x6')](),controller[_0xcc43('0xe')]);module[_0xcc43('0xf')]=router; \ No newline at end of file +var _0x4b11=['put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b11,0xf4));var _0x14b1=function(_0x226473,_0x46c312){_0x226473=_0x226473-0x0;var _0x5dad92=_0x4b11[_0x226473];return _0x5dad92;};'use strict';var multer=require(_0x14b1('0x0'));var util=require(_0x14b1('0x1'));var path=require(_0x14b1('0x2'));var timeout=require(_0x14b1('0x3'));var express=require('express');var router=express[_0x14b1('0x4')]();var fs_extra=require(_0x14b1('0x5'));var auth=require(_0x14b1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x14b1('0x7'));var controller=require(_0x14b1('0x8'));router[_0x14b1('0x9')]('/',auth[_0x14b1('0xa')](),controller[_0x14b1('0xb')]);router[_0x14b1('0x9')](_0x14b1('0xc'),auth[_0x14b1('0xa')](),controller[_0x14b1('0xd')]);router[_0x14b1('0xe')]('/',auth[_0x14b1('0xa')](),controller[_0x14b1('0xf')]);router[_0x14b1('0x10')](_0x14b1('0xc'),auth[_0x14b1('0xa')](),controller['update']);router[_0x14b1('0x11')](_0x14b1('0xc'),auth['isAuthenticated'](),controller[_0x14b1('0x12')]);module[_0x14b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 90f72f0..d8e3128 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 _0xdcde=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcde,0x97));var _0xedcd=function(_0x5713af,_0x8517b6){_0x5713af=_0x5713af-0x0;var _0x46e605=_0xdcde[_0x5713af];return _0x46e605;};'use strict';var Sequelize=require(_0xedcd('0x0'));module[_0xedcd('0x1')]={'name':{'type':Sequelize[_0xedcd('0x2')]},'description':{'type':Sequelize[_0xedcd('0x2')]},'html':{'type':Sequelize[_0xedcd('0x3')]}}; \ No newline at end of file +var _0x2c17=['exports','STRING','TEXT','sequelize'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x2c17,0xa3));var _0x72c1=function(_0x1a1f23,_0x29a228){_0x1a1f23=_0x1a1f23-0x0;var _0x3ff1bd=_0x2c17[_0x1a1f23];return _0x3ff1bd;};'use strict';var Sequelize=require(_0x72c1('0x0'));module[_0x72c1('0x1')]={'name':{'type':Sequelize[_0x72c1('0x2')]},'description':{'type':Sequelize[_0x72c1('0x2')]},'html':{'type':Sequelize[_0x72c1('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0570e56..97f4c1a 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 _0x961b=['then','destroy','get','Templates','UserProfileResource','sendStatus','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x961b,0xda));var _0xb961=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x961b[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb961('0x0'));var zipdir=require(_0xb961('0x1'));var jsonpatch=require(_0xb961('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb961('0x3'));var Mustache=require(_0xb961('0x4'));var util=require('util');var path=require(_0xb961('0x5'));var sox=require(_0xb961('0x6'));var csv=require('to-csv');var ejs=require(_0xb961('0x7'));var fs=require('fs');var fs_extra=require(_0xb961('0x8'));var _=require(_0xb961('0x9'));var squel=require(_0xb961('0xa'));var crypto=require(_0xb961('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb961('0xc'));var toCsv=require(_0xb961('0xd'));var querystring=require(_0xb961('0xe'));var Papa=require(_0xb961('0xf'));var Redis=require(_0xb961('0x10'));var authService=require(_0xb961('0x11'));var qs=require(_0xb961('0x12'));var as=require(_0xb961('0x13'));var hardwareService=require(_0xb961('0x14'));var logger=require(_0xb961('0x15'))('api');var utils=require(_0xb961('0x16'));var config=require(_0xb961('0x17'));var licenseUtil=require(_0xb961('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd204,_0x6b47d0){_0x6b47d0=_0x6b47d0||0xcc;return function(_0x2059ec){if(_0x2059ec){return _0x4cd204['sendStatus'](_0x6b47d0);}return _0x4cd204[_0xb961('0x19')](_0x6b47d0)[_0xb961('0x1a')]();};}function respondWithResult(_0x1bffc7,_0x1262fb){_0x1262fb=_0x1262fb||0xc8;return function(_0xd7ccd7){if(_0xd7ccd7){return _0x1bffc7[_0xb961('0x19')](_0x1262fb)[_0xb961('0x1b')](_0xd7ccd7);}};}function respondWithFilteredResult(_0x3f654f,_0x217e52){return function(_0x519db8){if(_0x519db8){var _0x2a96a2=typeof _0x217e52['offset']===_0xb961('0x1c')&&typeof _0x217e52[_0xb961('0x1d')]==='undefined';var _0x24e391=_0x519db8[_0xb961('0x1e')];var _0x3f323b=_0x2a96a2?0x0:_0x217e52[_0xb961('0x1f')];var _0x3bb556=_0x2a96a2?_0x519db8[_0xb961('0x1e')]:_0x217e52[_0xb961('0x1f')]+_0x217e52[_0xb961('0x1d')];var _0x3295a9;if(_0x3bb556>=_0x24e391){_0x3bb556=_0x24e391;_0x3295a9=0xc8;}else{_0x3295a9=0xce;}_0x3f654f[_0xb961('0x19')](_0x3295a9);return _0x3f654f['set'](_0xb961('0x20'),_0x3f323b+'-'+_0x3bb556+'/'+_0x24e391)[_0xb961('0x1b')](_0x519db8);}return null;};}function patchUpdates(_0x1b292b){return function(_0x17646c){try{jsonpatch[_0xb961('0x21')](_0x17646c,_0x1b292b,!![]);}catch(_0x108132){return BPromise[_0xb961('0x22')](_0x108132);}return _0x17646c[_0xb961('0x23')]();};}function saveUpdates(_0x177065,_0x30d000){return function(_0x4fa402){if(_0x4fa402){return _0x4fa402[_0xb961('0x24')](_0x177065)[_0xb961('0x25')](function(_0x10b1c6){return _0x10b1c6;});}return null;};}function removeEntity(_0x3f1380,_0x37b049){return function(_0x192e5e){if(_0x192e5e){return _0x192e5e[_0xb961('0x26')]()['then'](function(){var _0x139fb6=_0x192e5e[_0xb961('0x27')]({'plain':!![]});var _0x4a82c0=_0xb961('0x28');return db[_0xb961('0x29')][_0xb961('0x26')]({'where':{'type':_0x4a82c0,'resourceId':_0x139fb6['id']}})[_0xb961('0x25')](function(){return _0x192e5e;});})[_0xb961('0x25')](function(){_0x3f1380['status'](0xcc)[_0xb961('0x1a')]();});}};}function handleEntityNotFound(_0x2c1e88,_0x1c6411){return function(_0x51ac47){if(!_0x51ac47){_0x2c1e88[_0xb961('0x2a')](0x194);}return _0x51ac47;};}function handleError(_0x513506,_0x5ce33f){_0x5ce33f=_0x5ce33f||0x1f4;return function(_0x5aec8a){logger['error'](_0x5aec8a[_0xb961('0x2b')]);if(_0x5aec8a['name']){delete _0x5aec8a[_0xb961('0x2c')];}_0x513506[_0xb961('0x19')](_0x5ce33f)[_0xb961('0x2d')](_0x5aec8a);};}exports[_0xb961('0x2e')]=function(_0x411e86,_0x246ea2){var _0x850377={},_0x56f2d0={},_0x446c3e={'count':0x0,'rows':[]};var _0x11ae08=_[_0xb961('0x2f')](db[_0xb961('0x30')][_0xb961('0x31')],function(_0x59b59f){return{'name':_0x59b59f[_0xb961('0x32')],'type':_0x59b59f[_0xb961('0x33')][_0xb961('0x34')]};});_0x56f2d0[_0xb961('0x35')]=_['map'](_0x11ae08,_0xb961('0x2c'));_0x56f2d0[_0xb961('0x36')]=_[_0xb961('0x37')](_0x411e86[_0xb961('0x36')]);_0x56f2d0['filters']=_[_0xb961('0x38')](_0x56f2d0[_0xb961('0x35')],_0x56f2d0[_0xb961('0x36')]);_0x850377[_0xb961('0x39')]=_['intersection'](_0x56f2d0[_0xb961('0x35')],qs[_0xb961('0x3a')](_0x411e86[_0xb961('0x36')][_0xb961('0x3a')]));_0x850377[_0xb961('0x39')]=_0x850377[_0xb961('0x39')]['length']?_0x850377['attributes']:_0x56f2d0[_0xb961('0x35')];if(!_0x411e86[_0xb961('0x36')][_0xb961('0x3b')](_0xb961('0x3c'))){_0x850377[_0xb961('0x1d')]=qs[_0xb961('0x1d')](_0x411e86['query'][_0xb961('0x1d')]);_0x850377['offset']=qs[_0xb961('0x1f')](_0x411e86[_0xb961('0x36')][_0xb961('0x1f')]);}_0x850377['order']=qs[_0xb961('0x3d')](_0x411e86[_0xb961('0x36')][_0xb961('0x3d')]);_0x850377[_0xb961('0x3e')]=qs[_0xb961('0x3f')](_[_0xb961('0x40')](_0x411e86[_0xb961('0x36')],_0x56f2d0[_0xb961('0x3f')]),_0x11ae08);if(_0x411e86[_0xb961('0x36')][_0xb961('0x41')]){_0x850377[_0xb961('0x3e')]=_[_0xb961('0x42')](_0x850377[_0xb961('0x3e')],{'$or':_[_0xb961('0x2f')](_0x11ae08,function(_0x166e1e){if(_0x166e1e[_0xb961('0x33')]!==_0xb961('0x43')){var _0x492d66={};_0x492d66[_0x166e1e[_0xb961('0x2c')]]={'$like':'%'+_0x411e86['query'][_0xb961('0x41')]+'%'};return _0x492d66;}})});}_0x850377=_[_0xb961('0x42')]({},_0x850377,_0x411e86['options']);var _0x11ad8f={'where':_0x850377[_0xb961('0x3e')]};return db['Template']['count'](_0x11ad8f)['then'](function(_0x556f63){_0x446c3e[_0xb961('0x1e')]=_0x556f63;if(_0x411e86[_0xb961('0x36')][_0xb961('0x44')]){_0x850377[_0xb961('0x45')]=[{'all':!![]}];}return db['Template'][_0xb961('0x46')](_0x850377);})[_0xb961('0x25')](function(_0x13b55c){_0x446c3e[_0xb961('0x47')]=_0x13b55c;return _0x446c3e;})[_0xb961('0x25')](respondWithFilteredResult(_0x246ea2,_0x850377))[_0xb961('0x48')](handleError(_0x246ea2,null));};exports['show']=function(_0x207472,_0x54b892){var _0x11b905={'raw':!![],'where':{'id':_0x207472[_0xb961('0x49')]['id']}},_0x437a30={};_0x437a30[_0xb961('0x35')]=_[_0xb961('0x37')](db[_0xb961('0x30')]['rawAttributes']);_0x437a30[_0xb961('0x36')]=_[_0xb961('0x37')](_0x207472['query']);_0x437a30['filters']=_[_0xb961('0x38')](_0x437a30[_0xb961('0x35')],_0x437a30['query']);_0x11b905[_0xb961('0x39')]=_[_0xb961('0x38')](_0x437a30[_0xb961('0x35')],qs[_0xb961('0x3a')](_0x207472['query'][_0xb961('0x3a')]));_0x11b905['attributes']=_0x11b905[_0xb961('0x39')][_0xb961('0x4a')]?_0x11b905[_0xb961('0x39')]:_0x437a30['model'];if(_0x207472[_0xb961('0x36')][_0xb961('0x44')]){_0x11b905[_0xb961('0x45')]=[{'all':!![]}];}_0x11b905=_[_0xb961('0x42')]({},_0x11b905,_0x207472['options']);return db[_0xb961('0x30')][_0xb961('0x4b')](_0x11b905)['then'](handleEntityNotFound(_0x54b892,null))[_0xb961('0x25')](respondWithResult(_0x54b892,null))[_0xb961('0x48')](handleError(_0x54b892,null));};exports['create']=function(_0x117d1c,_0x440f38){return db['Template'][_0xb961('0x4c')](_0x117d1c[_0xb961('0x4d')],{})[_0xb961('0x25')](function(_0x4e1e64){var _0x268dec=_0x117d1c[_0xb961('0x4e')][_0xb961('0x27')]({'plain':!![]});if(!_0x268dec)throw new Error(_0xb961('0x4f'));if(_0x268dec[_0xb961('0x50')]===_0xb961('0x4e')){var _0x547b2b=_0x4e1e64[_0xb961('0x27')]({'plain':!![]});var _0x3fc36c='Templates';return db[_0xb961('0x51')][_0xb961('0x4b')]({'where':{'name':_0x3fc36c,'userProfileId':_0x268dec[_0xb961('0x52')]},'raw':!![]})[_0xb961('0x25')](function(_0x5777c5){if(_0x5777c5&&_0x5777c5['autoAssociation']===0x0){return db[_0xb961('0x29')][_0xb961('0x4c')]({'name':_0x547b2b['name'],'resourceId':_0x547b2b['id'],'type':_0x5777c5['name'],'sectionId':_0x5777c5['id']},{})[_0xb961('0x25')](function(){return _0x4e1e64;});}else{return _0x4e1e64;}})[_0xb961('0x48')](function(_0x280e9f){logger[_0xb961('0x53')](_0xb961('0x54'),_0x280e9f);throw _0x280e9f;});}return _0x4e1e64;})[_0xb961('0x25')](respondWithResult(_0x440f38,0xc9))[_0xb961('0x48')](handleError(_0x440f38,null));};exports['update']=function(_0x27da72,_0x289dad){if(_0x27da72[_0xb961('0x4d')]['id']){delete _0x27da72[_0xb961('0x4d')]['id'];}return db[_0xb961('0x30')]['find']({'where':{'id':_0x27da72[_0xb961('0x49')]['id']}})[_0xb961('0x25')](handleEntityNotFound(_0x289dad,null))[_0xb961('0x25')](saveUpdates(_0x27da72['body'],null))['then'](respondWithResult(_0x289dad,null))['catch'](handleError(_0x289dad,null));};exports[_0xb961('0x26')]=function(_0xea2a02,_0x194f99){return db['Template'][_0xb961('0x4b')]({'where':{'id':_0xea2a02[_0xb961('0x49')]['id']}})[_0xb961('0x25')](handleEntityNotFound(_0x194f99,null))[_0xb961('0x25')](removeEntity(_0x194f99,null))[_0xb961('0x48')](handleError(_0x194f99,null));}; \ No newline at end of file +var _0x8421=['hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','options','Template','includeAll','findAll','rows','show','params','find','catch','create','body','user','get','role','Templates','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length'];(function(_0x159856,_0xae177c){var _0x222a0c=function(_0x1054ef){while(--_0x1054ef){_0x159856['push'](_0x159856['shift']());}};_0x222a0c(++_0xae177c);}(_0x8421,0x186));var _0x1842=function(_0x4d4c05,_0x11dc7d){_0x4d4c05=_0x4d4c05-0x0;var _0x1f5df7=_0x8421[_0x4d4c05];return _0x1f5df7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1842('0x0'));var zipdir=require(_0x1842('0x1'));var jsonpatch=require(_0x1842('0x2'));var rp=require(_0x1842('0x3'));var moment=require(_0x1842('0x4'));var BPromise=require(_0x1842('0x5'));var Mustache=require(_0x1842('0x6'));var util=require('util');var path=require(_0x1842('0x7'));var sox=require('sox');var csv=require(_0x1842('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1842('0x9'));var _=require('lodash');var squel=require(_0x1842('0xa'));var crypto=require('crypto');var jsforce=require(_0x1842('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1842('0x8'));var querystring=require('querystring');var Papa=require(_0x1842('0xc'));var Redis=require(_0x1842('0xd'));var authService=require(_0x1842('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1842('0xf'));var hardwareService=require(_0x1842('0x10'));var logger=require('../../config/logger')(_0x1842('0x11'));var utils=require(_0x1842('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1842('0x13'))['db'];function respondWithStatusCode(_0x530ecb,_0x41b342){_0x41b342=_0x41b342||0xcc;return function(_0xbbccc){if(_0xbbccc){return _0x530ecb['sendStatus'](_0x41b342);}return _0x530ecb['status'](_0x41b342)[_0x1842('0x14')]();};}function respondWithResult(_0x595634,_0x584851){_0x584851=_0x584851||0xc8;return function(_0xa73371){if(_0xa73371){return _0x595634[_0x1842('0x15')](_0x584851)[_0x1842('0x16')](_0xa73371);}};}function respondWithFilteredResult(_0x132226,_0x3ccdcb){return function(_0x4d106f){if(_0x4d106f){var _0x5623f9=typeof _0x3ccdcb[_0x1842('0x17')]===_0x1842('0x18')&&typeof _0x3ccdcb['limit']==='undefined';var _0x3b424b=_0x4d106f['count'];var _0x18ebd0=_0x5623f9?0x0:_0x3ccdcb[_0x1842('0x17')];var _0x444595=_0x5623f9?_0x4d106f[_0x1842('0x19')]:_0x3ccdcb[_0x1842('0x17')]+_0x3ccdcb['limit'];var _0xc32ef2;if(_0x444595>=_0x3b424b){_0x444595=_0x3b424b;_0xc32ef2=0xc8;}else{_0xc32ef2=0xce;}_0x132226[_0x1842('0x15')](_0xc32ef2);return _0x132226['set'](_0x1842('0x1a'),_0x18ebd0+'-'+_0x444595+'/'+_0x3b424b)['json'](_0x4d106f);}return null;};}function patchUpdates(_0x41d844){return function(_0x42eafe){try{jsonpatch['apply'](_0x42eafe,_0x41d844,!![]);}catch(_0xb5959e){return BPromise[_0x1842('0x1b')](_0xb5959e);}return _0x42eafe[_0x1842('0x1c')]();};}function saveUpdates(_0x21bf3f,_0x1d012f){return function(_0x3ac8be){if(_0x3ac8be){return _0x3ac8be[_0x1842('0x1d')](_0x21bf3f)[_0x1842('0x1e')](function(_0x57064d){return _0x57064d;});}return null;};}function removeEntity(_0x1d265b,_0x266792){return function(_0x20f6fa){if(_0x20f6fa){return _0x20f6fa['destroy']()[_0x1842('0x1e')](function(){var _0x13a8fa=_0x20f6fa['get']({'plain':!![]});var _0x4b29f7='Templates';return db[_0x1842('0x1f')][_0x1842('0x20')]({'where':{'type':_0x4b29f7,'resourceId':_0x13a8fa['id']}})[_0x1842('0x1e')](function(){return _0x20f6fa;});})[_0x1842('0x1e')](function(){_0x1d265b[_0x1842('0x15')](0xcc)[_0x1842('0x14')]();});}};}function handleEntityNotFound(_0x595a54,_0x3eaef4){return function(_0x2a1d2b){if(!_0x2a1d2b){_0x595a54['sendStatus'](0x194);}return _0x2a1d2b;};}function handleError(_0x4ae056,_0x31c3c8){_0x31c3c8=_0x31c3c8||0x1f4;return function(_0x59fb7a){logger[_0x1842('0x21')](_0x59fb7a[_0x1842('0x22')]);if(_0x59fb7a['name']){delete _0x59fb7a[_0x1842('0x23')];}_0x4ae056['status'](_0x31c3c8)[_0x1842('0x24')](_0x59fb7a);};}exports[_0x1842('0x25')]=function(_0x412421,_0xe6d5cb){var _0x5a7c20={},_0x252b99={},_0x17e190={'count':0x0,'rows':[]};var _0xa5811=_['map'](db['Template'][_0x1842('0x26')],function(_0x1d5744){return{'name':_0x1d5744[_0x1842('0x27')],'type':_0x1d5744[_0x1842('0x28')]['key']};});_0x252b99[_0x1842('0x29')]=_['map'](_0xa5811,_0x1842('0x23'));_0x252b99[_0x1842('0x2a')]=_['keys'](_0x412421['query']);_0x252b99[_0x1842('0x2b')]=_[_0x1842('0x2c')](_0x252b99[_0x1842('0x29')],_0x252b99[_0x1842('0x2a')]);_0x5a7c20['attributes']=_[_0x1842('0x2c')](_0x252b99[_0x1842('0x29')],qs[_0x1842('0x2d')](_0x412421[_0x1842('0x2a')][_0x1842('0x2d')]));_0x5a7c20[_0x1842('0x2e')]=_0x5a7c20[_0x1842('0x2e')][_0x1842('0x2f')]?_0x5a7c20[_0x1842('0x2e')]:_0x252b99[_0x1842('0x29')];if(!_0x412421[_0x1842('0x2a')][_0x1842('0x30')](_0x1842('0x31'))){_0x5a7c20[_0x1842('0x32')]=qs[_0x1842('0x32')](_0x412421['query']['limit']);_0x5a7c20[_0x1842('0x17')]=qs[_0x1842('0x17')](_0x412421['query'][_0x1842('0x17')]);}_0x5a7c20['order']=qs['sort'](_0x412421[_0x1842('0x2a')][_0x1842('0x33')]);_0x5a7c20[_0x1842('0x34')]=qs[_0x1842('0x2b')](_['pick'](_0x412421[_0x1842('0x2a')],_0x252b99['filters']),_0xa5811);if(_0x412421[_0x1842('0x2a')][_0x1842('0x35')]){_0x5a7c20[_0x1842('0x34')]=_[_0x1842('0x36')](_0x5a7c20[_0x1842('0x34')],{'$or':_[_0x1842('0x37')](_0xa5811,function(_0x50ac5a){if(_0x50ac5a['type']!=='VIRTUAL'){var _0x151180={};_0x151180[_0x50ac5a[_0x1842('0x23')]]={'$like':'%'+_0x412421[_0x1842('0x2a')][_0x1842('0x35')]+'%'};return _0x151180;}})});}_0x5a7c20=_[_0x1842('0x36')]({},_0x5a7c20,_0x412421[_0x1842('0x38')]);var _0x26619b={'where':_0x5a7c20[_0x1842('0x34')]};return db[_0x1842('0x39')][_0x1842('0x19')](_0x26619b)[_0x1842('0x1e')](function(_0x48939f){_0x17e190[_0x1842('0x19')]=_0x48939f;if(_0x412421[_0x1842('0x2a')][_0x1842('0x3a')]){_0x5a7c20['include']=[{'all':!![]}];}return db[_0x1842('0x39')][_0x1842('0x3b')](_0x5a7c20);})[_0x1842('0x1e')](function(_0x5414d2){_0x17e190[_0x1842('0x3c')]=_0x5414d2;return _0x17e190;})[_0x1842('0x1e')](respondWithFilteredResult(_0xe6d5cb,_0x5a7c20))['catch'](handleError(_0xe6d5cb,null));};exports[_0x1842('0x3d')]=function(_0x151536,_0x4c1739){var _0x290e5e={'raw':!![],'where':{'id':_0x151536[_0x1842('0x3e')]['id']}},_0x278df9={};_0x278df9[_0x1842('0x29')]=_['keys'](db[_0x1842('0x39')][_0x1842('0x26')]);_0x278df9[_0x1842('0x2a')]=_['keys'](_0x151536[_0x1842('0x2a')]);_0x278df9[_0x1842('0x2b')]=_['intersection'](_0x278df9[_0x1842('0x29')],_0x278df9['query']);_0x290e5e['attributes']=_[_0x1842('0x2c')](_0x278df9[_0x1842('0x29')],qs[_0x1842('0x2d')](_0x151536['query'][_0x1842('0x2d')]));_0x290e5e[_0x1842('0x2e')]=_0x290e5e['attributes'][_0x1842('0x2f')]?_0x290e5e['attributes']:_0x278df9[_0x1842('0x29')];if(_0x151536['query'][_0x1842('0x3a')]){_0x290e5e['include']=[{'all':!![]}];}_0x290e5e=_['merge']({},_0x290e5e,_0x151536['options']);return db[_0x1842('0x39')][_0x1842('0x3f')](_0x290e5e)['then'](handleEntityNotFound(_0x4c1739,null))['then'](respondWithResult(_0x4c1739,null))[_0x1842('0x40')](handleError(_0x4c1739,null));};exports[_0x1842('0x41')]=function(_0x399a7d,_0x4bdbef){return db[_0x1842('0x39')][_0x1842('0x41')](_0x399a7d[_0x1842('0x42')],{})['then'](function(_0x4c4abb){var _0x358a19=_0x399a7d[_0x1842('0x43')][_0x1842('0x44')]({'plain':!![]});if(!_0x358a19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x358a19[_0x1842('0x45')]===_0x1842('0x43')){var _0x5da33d=_0x4c4abb[_0x1842('0x44')]({'plain':!![]});var _0x39c6a5=_0x1842('0x46');return db['UserProfileSection'][_0x1842('0x3f')]({'where':{'name':_0x39c6a5,'userProfileId':_0x358a19['userProfileId']},'raw':!![]})[_0x1842('0x1e')](function(_0x7e182e){if(_0x7e182e&&_0x7e182e[_0x1842('0x47')]===0x0){return db['UserProfileResource'][_0x1842('0x41')]({'name':_0x5da33d[_0x1842('0x23')],'resourceId':_0x5da33d['id'],'type':_0x7e182e[_0x1842('0x23')],'sectionId':_0x7e182e['id']},{})[_0x1842('0x1e')](function(){return _0x4c4abb;});}else{return _0x4c4abb;}})['catch'](function(_0x5b3032){logger[_0x1842('0x21')](_0x1842('0x48'),_0x5b3032);throw _0x5b3032;});}return _0x4c4abb;})['then'](respondWithResult(_0x4bdbef,0xc9))[_0x1842('0x40')](handleError(_0x4bdbef,null));};exports[_0x1842('0x1d')]=function(_0x4fb101,_0x118f25){if(_0x4fb101[_0x1842('0x42')]['id']){delete _0x4fb101[_0x1842('0x42')]['id'];}return db[_0x1842('0x39')][_0x1842('0x3f')]({'where':{'id':_0x4fb101[_0x1842('0x3e')]['id']}})[_0x1842('0x1e')](handleEntityNotFound(_0x118f25,null))[_0x1842('0x1e')](saveUpdates(_0x4fb101[_0x1842('0x42')],null))[_0x1842('0x1e')](respondWithResult(_0x118f25,null))['catch'](handleError(_0x118f25,null));};exports[_0x1842('0x20')]=function(_0x11d39e,_0x498fb1){return db[_0x1842('0x39')][_0x1842('0x3f')]({'where':{'id':_0x11d39e[_0x1842('0x3e')]['id']}})['then'](handleEntityNotFound(_0x498fb1,null))['then'](removeEntity(_0x498fb1,null))[_0x1842('0x40')](handleError(_0x498fb1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3bb3603..ad40153 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 _0x8b34=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','lodash','util'];(function(_0x1eb40a,_0x4fd90d){var _0x2262a9=function(_0x58de7d){while(--_0x58de7d){_0x1eb40a['push'](_0x1eb40a['shift']());}};_0x2262a9(++_0x4fd90d);}(_0x8b34,0x1f2));var _0x48b3=function(_0x5e94d9,_0x321598){_0x5e94d9=_0x5e94d9-0x0;var _0x515fb2=_0x8b34[_0x5e94d9];return _0x515fb2;};'use strict';var _=require(_0x48b3('0x0'));var util=require(_0x48b3('0x1'));var logger=require(_0x48b3('0x2'))(_0x48b3('0x3'));var moment=require('moment');var BPromise=require(_0x48b3('0x4'));var rp=require(_0x48b3('0x5'));var fs=require('fs');var path=require(_0x48b3('0x6'));var rimraf=require('rimraf');var config=require(_0x48b3('0x7'));var attributes=require(_0x48b3('0x8'));module[_0x48b3('0x9')]=function(_0x7e857d,_0x57e76a){return _0x7e857d['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x367b=['Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./template.attributes','define'];(function(_0x46c913,_0x1a4181){var _0x41c6f6=function(_0x2b68c5){while(--_0x2b68c5){_0x46c913['push'](_0x46c913['shift']());}};_0x41c6f6(++_0x1a4181);}(_0x367b,0xf2));var _0xb367=function(_0x152228,_0x4b7a48){_0x152228=_0x152228-0x0;var _0x4ddf96=_0x367b[_0x152228];return _0x4ddf96;};'use strict';var _=require(_0xb367('0x0'));var util=require('util');var logger=require(_0xb367('0x1'))(_0xb367('0x2'));var moment=require(_0xb367('0x3'));var BPromise=require(_0xb367('0x4'));var rp=require(_0xb367('0x5'));var fs=require('fs');var path=require(_0xb367('0x6'));var rimraf=require('rimraf');var config=require(_0xb367('0x7'));var attributes=require(_0xb367('0x8'));module['exports']=function(_0x2f039b,_0x2af4fc){return _0x2f039b[_0xb367('0x9')](_0xb367('0xa'),attributes,{'tableName':_0xb367('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 f74d5d8..56c1b43 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 _0x2f91=['message','GetTemplate','options','where','attributes','limit','map','model','include','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x2d4e89,_0x29665e){var _0x57ee47=function(_0x79351a){while(--_0x79351a){_0x2d4e89['push'](_0x2d4e89['shift']());}};_0x57ee47(++_0x29665e);}(_0x2f91,0xdd));var _0x12f9=function(_0x442f3c,_0x363ee7){_0x442f3c=_0x442f3c-0x0;var _0xa36cb9=_0x2f91[_0x442f3c];return _0xa36cb9;};'use strict';var _=require(_0x12f9('0x0'));var util=require(_0x12f9('0x1'));var moment=require(_0x12f9('0x2'));var BPromise=require(_0x12f9('0x3'));var rs=require(_0x12f9('0x4'));var fs=require('fs');var Redis=require(_0x12f9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x12f9('0x6'))(_0x12f9('0x7'));var config=require(_0x12f9('0x8'));var jayson=require(_0x12f9('0x9'));var client=jayson['client'][_0x12f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17615f,_0x4ced59,_0x444e58){return new BPromise(function(_0x1b6b38,_0x289eff){return client[_0x12f9('0xb')](_0x17615f,_0x444e58)['then'](function(_0x6126e8){logger[_0x12f9('0xc')](_0x12f9('0xd'),_0x4ced59,'request\x20sent');logger[_0x12f9('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x4ced59,_0x12f9('0xf'),JSON[_0x12f9('0x10')](_0x6126e8));if(_0x6126e8[_0x12f9('0x11')]){if(_0x6126e8['error'][_0x12f9('0x12')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x4ced59,_0x6126e8[_0x12f9('0x11')][_0x12f9('0x13')]);return _0x289eff(_0x6126e8['error'][_0x12f9('0x13')]);}logger[_0x12f9('0x11')](_0x12f9('0xd'),_0x4ced59,_0x6126e8[_0x12f9('0x11')][_0x12f9('0x13')]);return _0x1b6b38(_0x6126e8[_0x12f9('0x11')]['message']);}else{logger[_0x12f9('0xc')](_0x12f9('0xd'),_0x4ced59,'request\x20sent');_0x1b6b38(_0x6126e8['result'][_0x12f9('0x13')]);}})['catch'](function(_0x320395){logger[_0x12f9('0x11')]('Template,\x20%s,\x20%s',_0x4ced59,_0x320395);_0x289eff(_0x320395);});});}exports[_0x12f9('0x14')]=function(_0x35ebe7){var _0x8b5495=this;return new Promise(function(_0x1f87a2,_0x1152b3){return db['Template']['findAll']({'raw':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')][_0x12f9('0x16')]||null:null,'attributes':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7[_0x12f9('0x15')][_0x12f9('0x17')]||null:null,'limit':_0x35ebe7[_0x12f9('0x15')]?_0x35ebe7['options'][_0x12f9('0x18')]||null:null,'include':_0x35ebe7['options']?_0x35ebe7[_0x12f9('0x15')]['include']?_[_0x12f9('0x19')](_0x35ebe7[_0x12f9('0x15')]['include'],function(_0x4942d8){return{'model':db[_0x4942d8[_0x12f9('0x1a')]],'as':_0x4942d8['as'],'attributes':_0x4942d8['attributes'],'include':_0x4942d8[_0x12f9('0x1b')]?_[_0x12f9('0x19')](_0x4942d8[_0x12f9('0x1b')],function(_0x46da9b){return{'model':db[_0x46da9b['model']],'as':_0x46da9b['as'],'attributes':_0x46da9b[_0x12f9('0x17')],'include':_0x46da9b[_0x12f9('0x1b')]?_[_0x12f9('0x19')](_0x46da9b[_0x12f9('0x1b')],function(_0x3ee680){return{'model':db[_0x3ee680[_0x12f9('0x1a')]],'as':_0x3ee680['as'],'attributes':_0x3ee680[_0x12f9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x12f9('0x1c')](function(_0x18c2ad){logger[_0x12f9('0xc')](_0x12f9('0x14'),_0x35ebe7);logger['debug'](_0x12f9('0x14'),_0x35ebe7,JSON[_0x12f9('0x10')](_0x18c2ad));_0x1f87a2(_0x18c2ad);})[_0x12f9('0x1d')](function(_0x918618){logger[_0x12f9('0x11')](_0x12f9('0x14'),_0x918618[_0x12f9('0x13')],_0x35ebe7);_0x1152b3(_0x8b5495[_0x12f9('0x11')](0x1f4,_0x918618[_0x12f9('0x13')]));});});}; \ No newline at end of file +var _0xddcf=['../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x45ce30,_0x2b5ec7){var _0x2eeafb=function(_0x3faf9d){while(--_0x3faf9d){_0x45ce30['push'](_0x45ce30['shift']());}};_0x2eeafb(++_0x2b5ec7);}(_0xddcf,0x133));var _0xfddc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xddcf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfddc('0x0'));var util=require(_0xfddc('0x1'));var moment=require(_0xfddc('0x2'));var BPromise=require('bluebird');var rs=require(_0xfddc('0x3'));var fs=require('fs');var Redis=require(_0xfddc('0x4'));var db=require(_0xfddc('0x5'))['db'];var utils=require(_0xfddc('0x6'));var logger=require('../../config/logger')(_0xfddc('0x7'));var config=require(_0xfddc('0x8'));var jayson=require(_0xfddc('0x9'));var client=jayson[_0xfddc('0xa')][_0xfddc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565165,_0x34ec19,_0x4c678e){return new BPromise(function(_0x2d7598,_0x28177f){return client[_0xfddc('0xc')](_0x565165,_0x4c678e)[_0xfddc('0xd')](function(_0x50c052){logger[_0xfddc('0xe')](_0xfddc('0xf'),_0x34ec19,_0xfddc('0x10'));logger[_0xfddc('0x11')](_0xfddc('0x12'),_0x34ec19,'request\x20sent',JSON[_0xfddc('0x13')](_0x50c052));if(_0x50c052[_0xfddc('0x14')]){if(_0x50c052[_0xfddc('0x14')][_0xfddc('0x15')]===0x1f4){logger[_0xfddc('0x14')]('Template,\x20%s,\x20%s',_0x34ec19,_0x50c052['error'][_0xfddc('0x16')]);return _0x28177f(_0x50c052[_0xfddc('0x14')]['message']);}logger[_0xfddc('0x14')](_0xfddc('0xf'),_0x34ec19,_0x50c052[_0xfddc('0x14')][_0xfddc('0x16')]);return _0x2d7598(_0x50c052[_0xfddc('0x14')]['message']);}else{logger[_0xfddc('0xe')](_0xfddc('0xf'),_0x34ec19,_0xfddc('0x10'));_0x2d7598(_0x50c052[_0xfddc('0x17')]['message']);}})[_0xfddc('0x18')](function(_0x19c54c){logger[_0xfddc('0x14')](_0xfddc('0xf'),_0x34ec19,_0x19c54c);_0x28177f(_0x19c54c);});});}exports[_0xfddc('0x19')]=function(_0x55fca5){var _0x16ea1b=this;return new Promise(function(_0x5e2798,_0x167668){return db[_0xfddc('0x1a')][_0xfddc('0x1b')]({'raw':_0x55fca5[_0xfddc('0x1c')]?_0x55fca5[_0xfddc('0x1c')][_0xfddc('0x1d')]===undefined?!![]:![]:!![],'where':_0x55fca5[_0xfddc('0x1c')]?_0x55fca5['options'][_0xfddc('0x1e')]||null:null,'attributes':_0x55fca5[_0xfddc('0x1c')]?_0x55fca5[_0xfddc('0x1c')][_0xfddc('0x1f')]||null:null,'limit':_0x55fca5[_0xfddc('0x1c')]?_0x55fca5['options']['limit']||null:null,'include':_0x55fca5[_0xfddc('0x1c')]?_0x55fca5[_0xfddc('0x1c')][_0xfddc('0x20')]?_[_0xfddc('0x21')](_0x55fca5['options']['include'],function(_0x9eba8a){return{'model':db[_0x9eba8a[_0xfddc('0x22')]],'as':_0x9eba8a['as'],'attributes':_0x9eba8a[_0xfddc('0x1f')],'include':_0x9eba8a[_0xfddc('0x20')]?_[_0xfddc('0x21')](_0x9eba8a[_0xfddc('0x20')],function(_0x3af83f){return{'model':db[_0x3af83f[_0xfddc('0x22')]],'as':_0x3af83f['as'],'attributes':_0x3af83f['attributes'],'include':_0x3af83f[_0xfddc('0x20')]?_[_0xfddc('0x21')](_0x3af83f[_0xfddc('0x20')],function(_0x211a26){return{'model':db[_0x211a26['model']],'as':_0x211a26['as'],'attributes':_0x211a26[_0xfddc('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfddc('0xd')](function(_0x188e20){logger['info'](_0xfddc('0x19'),_0x55fca5);logger[_0xfddc('0x11')](_0xfddc('0x19'),_0x55fca5,JSON[_0xfddc('0x13')](_0x188e20));_0x5e2798(_0x188e20);})[_0xfddc('0x18')](function(_0x14df22){logger[_0xfddc('0x14')](_0xfddc('0x19'),_0x14df22[_0xfddc('0x16')],_0x55fca5);_0x167668(_0x16ea1b[_0xfddc('0x14')](0x1f4,_0x14df22[_0xfddc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 194b1fe..12539ca 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 _0xa937=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','get','/:id/all_conditions','getAllConditions','/:id/any_conditions','create','addAllCondition','addAnyCondition','post','addAction','put'];(function(_0x204224,_0x564de0){var _0x2d2928=function(_0x482f38){while(--_0x482f38){_0x204224['push'](_0x204224['shift']());}};_0x2d2928(++_0x564de0);}(_0xa937,0x163));var _0x7a93=function(_0x961079,_0x47a743){_0x961079=_0x961079-0x0;var _0x58e624=_0xa937[_0x961079];return _0x58e624;};'use strict';var multer=require(_0x7a93('0x0'));var util=require('util');var path=require(_0x7a93('0x1'));var timeout=require(_0x7a93('0x2'));var express=require(_0x7a93('0x3'));var router=express[_0x7a93('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a93('0x5'));var interaction=require(_0x7a93('0x6'));var config=require(_0x7a93('0x7'));var controller=require(_0x7a93('0x8'));router['get']('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0xa')]);router['get'](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0xc')]);router[_0x7a93('0xd')](_0x7a93('0xe'),auth['isAuthenticated'](),controller[_0x7a93('0xf')]);router[_0x7a93('0xd')](_0x7a93('0x10'),auth[_0x7a93('0x9')](),controller['getAnyConditions']);router[_0x7a93('0xd')]('/:id/actions',auth[_0x7a93('0x9')](),controller['getActions']);router['post']('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0x11')]);router['post']('/:id/all_conditions',auth[_0x7a93('0x9')](),controller[_0x7a93('0x12')]);router['post'](_0x7a93('0x10'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x13')]);router[_0x7a93('0x14')]('/:id/actions',auth[_0x7a93('0x9')](),controller[_0x7a93('0x15')]);router[_0x7a93('0x16')](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x17')]);router[_0x7a93('0x18')](_0x7a93('0xb'),auth[_0x7a93('0x9')](),controller[_0x7a93('0x19')]);module[_0x7a93('0x1a')]=router; \ No newline at end of file +var _0xb5d5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAllCondition','addAction','put','/:id','update','delete','destroy','util','connect-timeout'];(function(_0x348f32,_0x117e5f){var _0x165f30=function(_0x1856fd){while(--_0x1856fd){_0x348f32['push'](_0x348f32['shift']());}};_0x165f30(++_0x117e5f);}(_0xb5d5,0x1c0));var _0x5b5d=function(_0x59c16a,_0x149b92){_0x59c16a=_0x59c16a-0x0;var _0x64d5d2=_0xb5d5[_0x59c16a];return _0x64d5d2;};'use strict';var multer=require('multer');var util=require(_0x5b5d('0x0'));var path=require('path');var timeout=require(_0x5b5d('0x1'));var express=require(_0x5b5d('0x2'));var router=express[_0x5b5d('0x3')]();var fs_extra=require(_0x5b5d('0x4'));var auth=require(_0x5b5d('0x5'));var interaction=require(_0x5b5d('0x6'));var config=require(_0x5b5d('0x7'));var controller=require(_0x5b5d('0x8'));router[_0x5b5d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b5d('0x9')]('/:id',auth[_0x5b5d('0xa')](),controller[_0x5b5d('0xb')]);router[_0x5b5d('0x9')]('/:id/all_conditions',auth[_0x5b5d('0xa')](),controller[_0x5b5d('0xc')]);router['get'](_0x5b5d('0xd'),auth[_0x5b5d('0xa')](),controller['getAnyConditions']);router[_0x5b5d('0x9')](_0x5b5d('0xe'),auth[_0x5b5d('0xa')](),controller[_0x5b5d('0xf')]);router[_0x5b5d('0x10')]('/',auth[_0x5b5d('0xa')](),controller[_0x5b5d('0x11')]);router[_0x5b5d('0x10')]('/:id/all_conditions',auth[_0x5b5d('0xa')](),controller[_0x5b5d('0x12')]);router[_0x5b5d('0x10')](_0x5b5d('0xd'),auth[_0x5b5d('0xa')](),controller['addAnyCondition']);router['post'](_0x5b5d('0xe'),auth[_0x5b5d('0xa')](),controller[_0x5b5d('0x13')]);router[_0x5b5d('0x14')](_0x5b5d('0x15'),auth[_0x5b5d('0xa')](),controller[_0x5b5d('0x16')]);router[_0x5b5d('0x17')](_0x5b5d('0x15'),auth[_0x5b5d('0xa')](),controller[_0x5b5d('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 3f2838b..cd2efe7 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 _0x965f=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x965f,0x19a));var _0xf965=function(_0x13503c,_0x29ea4c){_0x13503c=_0x13503c-0x0;var _0x1f587a=_0x965f[_0x13503c];return _0x1f587a;};'use strict';var Sequelize=require(_0xf965('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf965('0x1')]},'description':{'type':Sequelize[_0xf965('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd3de=['STRING','BOOLEAN','sequelize','exports'];(function(_0x556b59,_0x25f365){var _0x450158=function(_0x3b0f0e){while(--_0x3b0f0e){_0x556b59['push'](_0x556b59['shift']());}};_0x450158(++_0x25f365);}(_0xd3de,0x15e));var _0xed3d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd3de[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xed3d('0x0'));module[_0xed3d('0x1')]={'name':{'type':Sequelize[_0xed3d('0x2')]},'channel':{'type':Sequelize[_0xed3d('0x2')]},'description':{'type':Sequelize[_0xed3d('0x2')]},'status':{'type':Sequelize[_0xed3d('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 cdc2ba4..7e0a237 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 _0xf036=['filters','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','pick','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','Trigger','rawAttributes','fieldName','type','key','map','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf036,0x1f0));var _0x6f03=function(_0x57f46b,_0x508960){_0x57f46b=_0x57f46b-0x0;var _0x2139b0=_0xf036[_0x57f46b];return _0x2139b0;};'use strict';var emlformat=require(_0x6f03('0x0'));var rimraf=require(_0x6f03('0x1'));var zipdir=require(_0x6f03('0x2'));var jsonpatch=require(_0x6f03('0x3'));var rp=require(_0x6f03('0x4'));var moment=require(_0x6f03('0x5'));var BPromise=require(_0x6f03('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f03('0x7'));var sox=require(_0x6f03('0x8'));var csv=require(_0x6f03('0x9'));var ejs=require(_0x6f03('0xa'));var fs=require('fs');var fs_extra=require(_0x6f03('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f03('0xc'));var jsforce=require(_0x6f03('0xd'));var deskjs=require(_0x6f03('0xe'));var toCsv=require(_0x6f03('0x9'));var querystring=require('querystring');var Papa=require(_0x6f03('0xf'));var Redis=require(_0x6f03('0x10'));var authService=require(_0x6f03('0x11'));var qs=require(_0x6f03('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f03('0x13'));var logger=require(_0x6f03('0x14'))(_0x6f03('0x15'));var utils=require(_0x6f03('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f03('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50214f,_0x1ad003){_0x1ad003=_0x1ad003||0xcc;return function(_0x340e8b){if(_0x340e8b){return _0x50214f[_0x6f03('0x18')](_0x1ad003);}return _0x50214f[_0x6f03('0x19')](_0x1ad003)['end']();};}function respondWithResult(_0x2cfea9,_0xc74090){_0xc74090=_0xc74090||0xc8;return function(_0x4a413a){if(_0x4a413a){return _0x2cfea9['status'](_0xc74090)[_0x6f03('0x1a')](_0x4a413a);}};}function respondWithFilteredResult(_0xf7fba9,_0x1eee42){return function(_0x27533b){if(_0x27533b){var _0x42e6a9=typeof _0x1eee42[_0x6f03('0x1b')]===_0x6f03('0x1c')&&typeof _0x1eee42['limit']===_0x6f03('0x1c');var _0x46b27b=_0x27533b[_0x6f03('0x1d')];var _0x55ac41=_0x42e6a9?0x0:_0x1eee42[_0x6f03('0x1b')];var _0x1f195e=_0x42e6a9?_0x27533b[_0x6f03('0x1d')]:_0x1eee42[_0x6f03('0x1b')]+_0x1eee42[_0x6f03('0x1e')];var _0x361693;if(_0x1f195e>=_0x46b27b){_0x1f195e=_0x46b27b;_0x361693=0xc8;}else{_0x361693=0xce;}_0xf7fba9[_0x6f03('0x19')](_0x361693);return _0xf7fba9[_0x6f03('0x1f')](_0x6f03('0x20'),_0x55ac41+'-'+_0x1f195e+'/'+_0x46b27b)[_0x6f03('0x1a')](_0x27533b);}return null;};}function patchUpdates(_0x59d9b8){return function(_0xa99fe){try{jsonpatch[_0x6f03('0x21')](_0xa99fe,_0x59d9b8,!![]);}catch(_0x5d985f){return BPromise[_0x6f03('0x22')](_0x5d985f);}return _0xa99fe[_0x6f03('0x23')]();};}function saveUpdates(_0x2409ed,_0x36852e){return function(_0xc344e6){if(_0xc344e6){return _0xc344e6[_0x6f03('0x24')](_0x2409ed)[_0x6f03('0x25')](function(_0x58d824){return _0x58d824;});}return null;};}function removeEntity(_0x53697d,_0x1659dd){return function(_0x5cb82c){if(_0x5cb82c){return _0x5cb82c[_0x6f03('0x26')]()[_0x6f03('0x25')](function(){var _0x53e257=_0x5cb82c[_0x6f03('0x27')]({'plain':!![]});var _0xfb6908='Triggers';return db[_0x6f03('0x28')][_0x6f03('0x26')]({'where':{'type':_0xfb6908,'resourceId':_0x53e257['id']}})[_0x6f03('0x25')](function(){return _0x5cb82c;});})['then'](function(){_0x53697d['status'](0xcc)[_0x6f03('0x29')]();});}};}function handleEntityNotFound(_0x28e519,_0x5bfa03){return function(_0x178763){if(!_0x178763){_0x28e519[_0x6f03('0x18')](0x194);}return _0x178763;};}function handleError(_0x480ddd,_0x309058){_0x309058=_0x309058||0x1f4;return function(_0x2c18e7){logger[_0x6f03('0x2a')](_0x2c18e7['stack']);if(_0x2c18e7[_0x6f03('0x2b')]){delete _0x2c18e7[_0x6f03('0x2b')];}_0x480ddd['status'](_0x309058)[_0x6f03('0x2c')](_0x2c18e7);};}exports[_0x6f03('0x2d')]=function(_0x558935,_0x2bce93){var _0x1dea21={},_0x4b96c0={},_0x38a9b6={'count':0x0,'rows':[]};var _0x42eddf=_['map'](db[_0x6f03('0x2e')][_0x6f03('0x2f')],function(_0x520da4){return{'name':_0x520da4[_0x6f03('0x30')],'type':_0x520da4[_0x6f03('0x31')][_0x6f03('0x32')]};});_0x4b96c0['model']=_[_0x6f03('0x33')](_0x42eddf,_0x6f03('0x2b'));_0x4b96c0[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x558935['query']);_0x4b96c0['filters']=_['intersection'](_0x4b96c0[_0x6f03('0x36')],_0x4b96c0[_0x6f03('0x34')]);_0x1dea21['attributes']=_[_0x6f03('0x37')](_0x4b96c0[_0x6f03('0x36')],qs['fields'](_0x558935[_0x6f03('0x34')][_0x6f03('0x38')]));_0x1dea21['attributes']=_0x1dea21[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x1dea21[_0x6f03('0x39')]:_0x4b96c0[_0x6f03('0x36')];if(!_0x558935[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x1dea21[_0x6f03('0x1e')]=qs['limit'](_0x558935[_0x6f03('0x34')]['limit']);_0x1dea21[_0x6f03('0x1b')]=qs['offset'](_0x558935[_0x6f03('0x34')][_0x6f03('0x1b')]);}_0x1dea21[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x558935[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x1dea21['where']=qs[_0x6f03('0x3e')](_['pick'](_0x558935[_0x6f03('0x34')],_0x4b96c0[_0x6f03('0x3e')]),_0x42eddf);if(_0x558935[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x1dea21[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x1dea21[_0x6f03('0x40')],{'$or':_['map'](_0x42eddf,function(_0x3f0cfc){if(_0x3f0cfc['type']!==_0x6f03('0x42')){var _0x236573={};_0x236573[_0x3f0cfc[_0x6f03('0x2b')]]={'$like':'%'+_0x558935[_0x6f03('0x34')][_0x6f03('0x3f')]+'%'};return _0x236573;}})});}_0x1dea21=_[_0x6f03('0x41')]({},_0x1dea21,_0x558935[_0x6f03('0x43')]);var _0x333138={'where':_0x1dea21[_0x6f03('0x40')]};return db[_0x6f03('0x2e')][_0x6f03('0x1d')](_0x333138)['then'](function(_0x124ef4){_0x38a9b6['count']=_0x124ef4;if(_0x558935[_0x6f03('0x34')][_0x6f03('0x44')]){_0x1dea21['include']=[{'all':!![]}];}return db['Trigger'][_0x6f03('0x45')](_0x1dea21);})['then'](function(_0x13daa2){_0x38a9b6[_0x6f03('0x46')]=_0x13daa2;return _0x38a9b6;})[_0x6f03('0x25')](respondWithFilteredResult(_0x2bce93,_0x1dea21))[_0x6f03('0x47')](handleError(_0x2bce93,null));};exports[_0x6f03('0x48')]=function(_0x1a5798,_0x4aa2ce){var _0x12af7d={'raw':![],'where':{'id':_0x1a5798[_0x6f03('0x49')]['id']}},_0x3b4860={};_0x3b4860[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x2e')][_0x6f03('0x2f')]);_0x3b4860[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x1a5798[_0x6f03('0x34')]);_0x3b4860['filters']=_['intersection'](_0x3b4860['model'],_0x3b4860[_0x6f03('0x34')]);_0x12af7d['attributes']=_[_0x6f03('0x37')](_0x3b4860[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x1a5798['query'][_0x6f03('0x38')]));_0x12af7d[_0x6f03('0x39')]=_0x12af7d[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x12af7d[_0x6f03('0x39')]:_0x3b4860[_0x6f03('0x36')];if(_0x1a5798[_0x6f03('0x34')][_0x6f03('0x44')]){_0x12af7d['include']=[{'all':!![]}];}_0x12af7d=_['merge']({},_0x12af7d,_0x1a5798[_0x6f03('0x43')]);return db[_0x6f03('0x2e')][_0x6f03('0x4a')](_0x12af7d)[_0x6f03('0x25')](handleEntityNotFound(_0x4aa2ce,null))[_0x6f03('0x25')](respondWithResult(_0x4aa2ce,null))['catch'](handleError(_0x4aa2ce,null));};exports[_0x6f03('0x4b')]=function(_0x78e428,_0x37c3c8){return db[_0x6f03('0x2e')][_0x6f03('0x4b')](_0x78e428[_0x6f03('0x4c')],{})[_0x6f03('0x25')](function(_0x4039c2){var _0x22a4f5=_0x78e428[_0x6f03('0x4d')][_0x6f03('0x27')]({'plain':!![]});if(!_0x22a4f5)throw new Error(_0x6f03('0x4e'));if(_0x22a4f5[_0x6f03('0x4f')]===_0x6f03('0x4d')){var _0x2c2fd4=_0x4039c2['get']({'plain':!![]});var _0x422b51=_0x6f03('0x50');return db[_0x6f03('0x51')][_0x6f03('0x4a')]({'where':{'name':_0x422b51,'userProfileId':_0x22a4f5[_0x6f03('0x52')]},'raw':!![]})[_0x6f03('0x25')](function(_0x4b4737){if(_0x4b4737&&_0x4b4737[_0x6f03('0x53')]===0x0){return db[_0x6f03('0x28')]['create']({'name':_0x2c2fd4[_0x6f03('0x2b')],'resourceId':_0x2c2fd4['id'],'type':_0x4b4737['name'],'sectionId':_0x4b4737['id']},{})[_0x6f03('0x25')](function(){return _0x4039c2;});}else{return _0x4039c2;}})['catch'](function(_0x10850e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10850e);throw _0x10850e;});}return _0x4039c2;})[_0x6f03('0x25')](respondWithResult(_0x37c3c8,0xc9))[_0x6f03('0x47')](handleError(_0x37c3c8,null));};exports['update']=function(_0x4c002c,_0x126c9b){if(_0x4c002c['body']['id']){delete _0x4c002c[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')][_0x6f03('0x4a')]({'where':{'id':_0x4c002c[_0x6f03('0x49')]['id']}})['then'](handleEntityNotFound(_0x126c9b,null))[_0x6f03('0x25')](saveUpdates(_0x4c002c[_0x6f03('0x4c')],null))['then'](respondWithResult(_0x126c9b,null))[_0x6f03('0x47')](handleError(_0x126c9b,null));};exports['destroy']=function(_0x5a7370,_0x2a756b){return db['Trigger']['find']({'where':{'id':_0x5a7370[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2a756b,null))[_0x6f03('0x25')](removeEntity(_0x2a756b,null))[_0x6f03('0x47')](handleError(_0x2a756b,null));};exports['addAllCondition']=function(_0x4394b7,_0x1abed6,_0x48e063){if(_0x4394b7[_0x6f03('0x4c')]['id']){delete _0x4394b7[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')]['find']({'where':{'id':_0x4394b7[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x1abed6,null))['then'](function(_0x59ed36){if(_0x59ed36){_0x4394b7[_0x6f03('0x4c')]['TriggerAllId']=_0x59ed36['id'];return db[_0x6f03('0x54')][_0x6f03('0x4b')](_0x4394b7[_0x6f03('0x4c')]);}})[_0x6f03('0x25')](respondWithResult(_0x1abed6,null))[_0x6f03('0x47')](handleError(_0x1abed6,null));};exports[_0x6f03('0x55')]=function(_0x43428d,_0x2facd0,_0x4fc944){if(_0x43428d[_0x6f03('0x4c')]['id']){delete _0x43428d[_0x6f03('0x4c')]['id'];}return db[_0x6f03('0x2e')][_0x6f03('0x4a')]({'where':{'id':_0x43428d['params']['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2facd0,null))[_0x6f03('0x25')](function(_0x42e53c){if(_0x42e53c){_0x43428d[_0x6f03('0x4c')]['TriggerAnyId']=_0x42e53c['id'];return db[_0x6f03('0x54')][_0x6f03('0x4b')](_0x43428d[_0x6f03('0x4c')]);}})[_0x6f03('0x25')](respondWithResult(_0x2facd0,null))[_0x6f03('0x47')](handleError(_0x2facd0,null));};exports['getAllConditions']=function(_0x5017f7,_0x50d89d,_0x196324){var _0x311e0b={};var _0x124710={};var _0x1a887e;var _0x594bae;return db[_0x6f03('0x2e')]['findOne']({'where':{'id':_0x5017f7['params']['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x50d89d,null))[_0x6f03('0x25')](function(_0x30c91a){if(_0x30c91a){_0x1a887e=_0x30c91a;_0x124710[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x54')][_0x6f03('0x2f')]);_0x124710[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x5017f7['query']);_0x124710['filters']=_[_0x6f03('0x37')](_0x124710[_0x6f03('0x36')],_0x124710[_0x6f03('0x34')]);_0x311e0b['attributes']=_['intersection'](_0x124710[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x38')]));_0x311e0b[_0x6f03('0x39')]=_0x311e0b[_0x6f03('0x39')]['length']?_0x311e0b['attributes']:_0x124710['model'];_0x311e0b[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x311e0b[_0x6f03('0x40')]=qs['filters'](_['pick'](_0x5017f7[_0x6f03('0x34')],_0x124710[_0x6f03('0x3e')]));if(_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x311e0b[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x311e0b[_0x6f03('0x40')],{'$or':_['map'](_0x311e0b[_0x6f03('0x39')],function(_0x42ef6d){var _0x4aa4c9={};_0x4aa4c9[_0x42ef6d]={'$like':'%'+_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3f')]+'%'};return _0x4aa4c9;})});}_0x311e0b=_[_0x6f03('0x41')]({},_0x311e0b,_0x5017f7['options']);return _0x1a887e[_0x6f03('0x56')](_0x311e0b);}})['then'](function(_0x16fd08){if(_0x16fd08){_0x594bae=_0x16fd08[_0x6f03('0x3a')];if(!_0x5017f7[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x311e0b[_0x6f03('0x1e')]=qs[_0x6f03('0x1e')](_0x5017f7['query'][_0x6f03('0x1e')]);_0x311e0b[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x5017f7[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x1a887e['getAllConditions'](_0x311e0b);}})['then'](function(_0x3da882){if(_0x3da882){return _0x3da882?{'count':_0x594bae,'rows':_0x3da882}:null;}})[_0x6f03('0x25')](respondWithResult(_0x50d89d,null))[_0x6f03('0x47')](handleError(_0x50d89d,null));};exports[_0x6f03('0x57')]=function(_0x5574fe,_0x2a6999,_0x328334){var _0x2768ae={};var _0x198124={};var _0x153ce0;var _0x487801;return db[_0x6f03('0x2e')][_0x6f03('0x58')]({'where':{'id':_0x5574fe[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x2a6999,null))['then'](function(_0x505b65){if(_0x505b65){_0x153ce0=_0x505b65;_0x198124[_0x6f03('0x36')]=_[_0x6f03('0x35')](db[_0x6f03('0x54')]['rawAttributes']);_0x198124[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x5574fe[_0x6f03('0x34')]);_0x198124['filters']=_['intersection'](_0x198124[_0x6f03('0x36')],_0x198124[_0x6f03('0x34')]);_0x2768ae[_0x6f03('0x39')]=_[_0x6f03('0x37')](_0x198124[_0x6f03('0x36')],qs['fields'](_0x5574fe[_0x6f03('0x34')][_0x6f03('0x38')]));_0x2768ae[_0x6f03('0x39')]=_0x2768ae['attributes'][_0x6f03('0x3a')]?_0x2768ae[_0x6f03('0x39')]:_0x198124[_0x6f03('0x36')];_0x2768ae['order']=qs[_0x6f03('0x3d')](_0x5574fe['query'][_0x6f03('0x3d')]);_0x2768ae['where']=qs['filters'](_[_0x6f03('0x59')](_0x5574fe[_0x6f03('0x34')],_0x198124[_0x6f03('0x3e')]));if(_0x5574fe[_0x6f03('0x34')][_0x6f03('0x3f')]){_0x2768ae[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x2768ae['where'],{'$or':_[_0x6f03('0x33')](_0x2768ae[_0x6f03('0x39')],function(_0x262ab1){var _0x3c4b90={};_0x3c4b90[_0x262ab1]={'$like':'%'+_0x5574fe['query'][_0x6f03('0x3f')]+'%'};return _0x3c4b90;})});}_0x2768ae=_['merge']({},_0x2768ae,_0x5574fe[_0x6f03('0x43')]);return _0x153ce0[_0x6f03('0x57')](_0x2768ae);}})['then'](function(_0x921389){if(_0x921389){_0x487801=_0x921389[_0x6f03('0x3a')];if(!_0x5574fe['query'][_0x6f03('0x3b')]('nolimit')){_0x2768ae[_0x6f03('0x1e')]=qs['limit'](_0x5574fe[_0x6f03('0x34')]['limit']);_0x2768ae[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x5574fe[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x153ce0[_0x6f03('0x57')](_0x2768ae);}})[_0x6f03('0x25')](function(_0x5a6e29){if(_0x5a6e29){return _0x5a6e29?{'count':_0x487801,'rows':_0x5a6e29}:null;}})[_0x6f03('0x25')](respondWithResult(_0x2a6999,null))[_0x6f03('0x47')](handleError(_0x2a6999,null));};exports['addAction']=function(_0x67f3bc,_0x57e9a1,_0x426551){if(_0x67f3bc[_0x6f03('0x4c')]['id']){delete _0x67f3bc['body']['id'];}return db['Trigger'][_0x6f03('0x4a')]({'where':{'id':_0x67f3bc[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x57e9a1,null))[_0x6f03('0x25')](function(_0x5e477d){if(_0x5e477d){_0x67f3bc[_0x6f03('0x4c')][_0x6f03('0x5a')]=_0x5e477d['id'];return db[_0x6f03('0x5b')][_0x6f03('0x4b')](_0x67f3bc['body']);}})[_0x6f03('0x25')](respondWithResult(_0x57e9a1,null))[_0x6f03('0x47')](handleError(_0x57e9a1,null));};exports['getActions']=function(_0x310c5d,_0x6c0986,_0x5d9f83){var _0x3eafa3={};var _0x2ba7fa={};var _0x236bca;var _0xa22d2a;return db['Trigger'][_0x6f03('0x58')]({'where':{'id':_0x310c5d[_0x6f03('0x49')]['id']}})[_0x6f03('0x25')](handleEntityNotFound(_0x6c0986,null))[_0x6f03('0x25')](function(_0x3b7fd2){if(_0x3b7fd2){_0x236bca=_0x3b7fd2;_0x2ba7fa[_0x6f03('0x36')]=_[_0x6f03('0x35')](db['Action'][_0x6f03('0x2f')]);_0x2ba7fa[_0x6f03('0x34')]=_[_0x6f03('0x35')](_0x310c5d[_0x6f03('0x34')]);_0x2ba7fa[_0x6f03('0x3e')]=_[_0x6f03('0x37')](_0x2ba7fa[_0x6f03('0x36')],_0x2ba7fa[_0x6f03('0x34')]);_0x3eafa3[_0x6f03('0x39')]=_['intersection'](_0x2ba7fa[_0x6f03('0x36')],qs[_0x6f03('0x38')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x38')]));_0x3eafa3[_0x6f03('0x39')]=_0x3eafa3[_0x6f03('0x39')][_0x6f03('0x3a')]?_0x3eafa3[_0x6f03('0x39')]:_0x2ba7fa[_0x6f03('0x36')];_0x3eafa3[_0x6f03('0x3c')]=qs[_0x6f03('0x3d')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x3d')]);_0x3eafa3[_0x6f03('0x40')]=qs[_0x6f03('0x3e')](_[_0x6f03('0x59')](_0x310c5d[_0x6f03('0x34')],_0x2ba7fa['filters']));if(_0x310c5d['query']['filter']){_0x3eafa3[_0x6f03('0x40')]=_[_0x6f03('0x41')](_0x3eafa3[_0x6f03('0x40')],{'$or':_[_0x6f03('0x33')](_0x3eafa3[_0x6f03('0x39')],function(_0x24e10e){var _0x81e117={};_0x81e117[_0x24e10e]={'$like':'%'+_0x310c5d[_0x6f03('0x34')]['filter']+'%'};return _0x81e117;})});}_0x3eafa3=_[_0x6f03('0x41')]({},_0x3eafa3,_0x310c5d[_0x6f03('0x43')]);return _0x236bca[_0x6f03('0x5c')](_0x3eafa3);}})[_0x6f03('0x25')](function(_0xcd9cfe){if(_0xcd9cfe){_0xa22d2a=_0xcd9cfe[_0x6f03('0x3a')];if(!_0x310c5d[_0x6f03('0x34')][_0x6f03('0x3b')]('nolimit')){_0x3eafa3[_0x6f03('0x1e')]=qs[_0x6f03('0x1e')](_0x310c5d['query'][_0x6f03('0x1e')]);_0x3eafa3[_0x6f03('0x1b')]=qs[_0x6f03('0x1b')](_0x310c5d[_0x6f03('0x34')][_0x6f03('0x1b')]);}return _0x236bca[_0x6f03('0x5c')](_0x3eafa3);}})[_0x6f03('0x25')](function(_0x29c7d0){if(_0x29c7d0){return _0x29c7d0?{'count':_0xa22d2a,'rows':_0x29c7d0}:null;}})[_0x6f03('0x25')](respondWithResult(_0x6c0986,null))['catch'](handleError(_0x6c0986,null));}; \ No newline at end of file +var _0xbb42=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Triggers','UserProfileResource','error','name','send','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','userProfileId'];(function(_0x5ae088,_0x23419f){var _0x18f040=function(_0x49c162){while(--_0x49c162){_0x5ae088['push'](_0x5ae088['shift']());}};_0x18f040(++_0x23419f);}(_0xbb42,0x65));var _0x2bb4=function(_0xf4c726,_0x246367){_0xf4c726=_0xf4c726-0x0;var _0x186e1c=_0xbb42[_0xf4c726];return _0x186e1c;};'use strict';var emlformat=require(_0x2bb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bb4('0x1'));var jsonpatch=require(_0x2bb4('0x2'));var rp=require(_0x2bb4('0x3'));var moment=require(_0x2bb4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bb4('0x5'));var util=require('util');var path=require(_0x2bb4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2bb4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bb4('0x8'));var squel=require(_0x2bb4('0x9'));var crypto=require(_0x2bb4('0xa'));var jsforce=require(_0x2bb4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2bb4('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2bb4('0xd'));var authService=require(_0x2bb4('0xe'));var qs=require(_0x2bb4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2bb4('0x10'));var logger=require(_0x2bb4('0x11'))(_0x2bb4('0x12'));var utils=require(_0x2bb4('0x13'));var config=require(_0x2bb4('0x14'));var licenseUtil=require(_0x2bb4('0x15'));var db=require(_0x2bb4('0x16'))['db'];function respondWithStatusCode(_0x242c50,_0x85a4ee){_0x85a4ee=_0x85a4ee||0xcc;return function(_0x53f8c5){if(_0x53f8c5){return _0x242c50['sendStatus'](_0x85a4ee);}return _0x242c50[_0x2bb4('0x17')](_0x85a4ee)[_0x2bb4('0x18')]();};}function respondWithResult(_0xb30439,_0xaabf9){_0xaabf9=_0xaabf9||0xc8;return function(_0x282e47){if(_0x282e47){return _0xb30439[_0x2bb4('0x17')](_0xaabf9)[_0x2bb4('0x19')](_0x282e47);}};}function respondWithFilteredResult(_0x174e1b,_0x5af8ac){return function(_0x4b708e){if(_0x4b708e){var _0x4d6f91=typeof _0x5af8ac[_0x2bb4('0x1a')]===_0x2bb4('0x1b')&&typeof _0x5af8ac[_0x2bb4('0x1c')]===_0x2bb4('0x1b');var _0x36da40=_0x4b708e[_0x2bb4('0x1d')];var _0x542006=_0x4d6f91?0x0:_0x5af8ac[_0x2bb4('0x1a')];var _0x3fa126=_0x4d6f91?_0x4b708e[_0x2bb4('0x1d')]:_0x5af8ac[_0x2bb4('0x1a')]+_0x5af8ac[_0x2bb4('0x1c')];var _0x134b96;if(_0x3fa126>=_0x36da40){_0x3fa126=_0x36da40;_0x134b96=0xc8;}else{_0x134b96=0xce;}_0x174e1b['status'](_0x134b96);return _0x174e1b[_0x2bb4('0x1e')](_0x2bb4('0x1f'),_0x542006+'-'+_0x3fa126+'/'+_0x36da40)[_0x2bb4('0x19')](_0x4b708e);}return null;};}function patchUpdates(_0x4fa549){return function(_0x5187e7){try{jsonpatch[_0x2bb4('0x20')](_0x5187e7,_0x4fa549,!![]);}catch(_0x51ec8b){return BPromise[_0x2bb4('0x21')](_0x51ec8b);}return _0x5187e7['save']();};}function saveUpdates(_0x4eeb60,_0x3edfa5){return function(_0x49d293){if(_0x49d293){return _0x49d293[_0x2bb4('0x22')](_0x4eeb60)[_0x2bb4('0x23')](function(_0x502091){return _0x502091;});}return null;};}function removeEntity(_0x4e52dd,_0x3fd139){return function(_0x3979d1){if(_0x3979d1){return _0x3979d1[_0x2bb4('0x24')]()['then'](function(){var _0x17bf70=_0x3979d1['get']({'plain':!![]});var _0x2205f7=_0x2bb4('0x25');return db[_0x2bb4('0x26')][_0x2bb4('0x24')]({'where':{'type':_0x2205f7,'resourceId':_0x17bf70['id']}})['then'](function(){return _0x3979d1;});})[_0x2bb4('0x23')](function(){_0x4e52dd[_0x2bb4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20885d,_0x3bcd15){return function(_0x316ecd){if(!_0x316ecd){_0x20885d['sendStatus'](0x194);}return _0x316ecd;};}function handleError(_0x3fe50a,_0x3f30c9){_0x3f30c9=_0x3f30c9||0x1f4;return function(_0x16f39f){logger[_0x2bb4('0x27')](_0x16f39f['stack']);if(_0x16f39f[_0x2bb4('0x28')]){delete _0x16f39f[_0x2bb4('0x28')];}_0x3fe50a['status'](_0x3f30c9)[_0x2bb4('0x29')](_0x16f39f);};}exports['index']=function(_0x358ffe,_0x256e6c){var _0xa2d952={},_0x3c8b51={},_0x5d460b={'count':0x0,'rows':[]};var _0x284615=_[_0x2bb4('0x2a')](db[_0x2bb4('0x2b')][_0x2bb4('0x2c')],function(_0x4dffea){return{'name':_0x4dffea[_0x2bb4('0x2d')],'type':_0x4dffea[_0x2bb4('0x2e')][_0x2bb4('0x2f')]};});_0x3c8b51[_0x2bb4('0x30')]=_['map'](_0x284615,_0x2bb4('0x28'));_0x3c8b51[_0x2bb4('0x31')]=_[_0x2bb4('0x32')](_0x358ffe['query']);_0x3c8b51[_0x2bb4('0x33')]=_[_0x2bb4('0x34')](_0x3c8b51[_0x2bb4('0x30')],_0x3c8b51[_0x2bb4('0x31')]);_0xa2d952[_0x2bb4('0x35')]=_['intersection'](_0x3c8b51[_0x2bb4('0x30')],qs[_0x2bb4('0x36')](_0x358ffe[_0x2bb4('0x31')][_0x2bb4('0x36')]));_0xa2d952[_0x2bb4('0x35')]=_0xa2d952[_0x2bb4('0x35')]['length']?_0xa2d952['attributes']:_0x3c8b51['model'];if(!_0x358ffe[_0x2bb4('0x31')]['hasOwnProperty'](_0x2bb4('0x37'))){_0xa2d952[_0x2bb4('0x1c')]=qs['limit'](_0x358ffe['query'][_0x2bb4('0x1c')]);_0xa2d952[_0x2bb4('0x1a')]=qs[_0x2bb4('0x1a')](_0x358ffe[_0x2bb4('0x31')][_0x2bb4('0x1a')]);}_0xa2d952[_0x2bb4('0x38')]=qs['sort'](_0x358ffe['query'][_0x2bb4('0x39')]);_0xa2d952[_0x2bb4('0x3a')]=qs[_0x2bb4('0x33')](_[_0x2bb4('0x3b')](_0x358ffe['query'],_0x3c8b51[_0x2bb4('0x33')]),_0x284615);if(_0x358ffe[_0x2bb4('0x31')]['filter']){_0xa2d952[_0x2bb4('0x3a')]=_[_0x2bb4('0x3c')](_0xa2d952[_0x2bb4('0x3a')],{'$or':_[_0x2bb4('0x2a')](_0x284615,function(_0x147f2e){if(_0x147f2e['type']!=='VIRTUAL'){var _0x3f4239={};_0x3f4239[_0x147f2e[_0x2bb4('0x28')]]={'$like':'%'+_0x358ffe[_0x2bb4('0x31')][_0x2bb4('0x3d')]+'%'};return _0x3f4239;}})});}_0xa2d952=_['merge']({},_0xa2d952,_0x358ffe[_0x2bb4('0x3e')]);var _0x37b05c={'where':_0xa2d952['where']};return db[_0x2bb4('0x2b')][_0x2bb4('0x1d')](_0x37b05c)[_0x2bb4('0x23')](function(_0x8b3747){_0x5d460b[_0x2bb4('0x1d')]=_0x8b3747;if(_0x358ffe[_0x2bb4('0x31')][_0x2bb4('0x3f')]){_0xa2d952[_0x2bb4('0x40')]=[{'all':!![]}];}return db[_0x2bb4('0x2b')][_0x2bb4('0x41')](_0xa2d952);})[_0x2bb4('0x23')](function(_0x38a8b6){_0x5d460b[_0x2bb4('0x42')]=_0x38a8b6;return _0x5d460b;})[_0x2bb4('0x23')](respondWithFilteredResult(_0x256e6c,_0xa2d952))[_0x2bb4('0x43')](handleError(_0x256e6c,null));};exports[_0x2bb4('0x44')]=function(_0x136aee,_0xf65c6c){var _0x4173bc={'raw':![],'where':{'id':_0x136aee[_0x2bb4('0x45')]['id']}},_0x16120f={};_0x16120f[_0x2bb4('0x30')]=_[_0x2bb4('0x32')](db[_0x2bb4('0x2b')][_0x2bb4('0x2c')]);_0x16120f[_0x2bb4('0x31')]=_['keys'](_0x136aee[_0x2bb4('0x31')]);_0x16120f['filters']=_[_0x2bb4('0x34')](_0x16120f['model'],_0x16120f[_0x2bb4('0x31')]);_0x4173bc[_0x2bb4('0x35')]=_[_0x2bb4('0x34')](_0x16120f['model'],qs['fields'](_0x136aee[_0x2bb4('0x31')]['fields']));_0x4173bc['attributes']=_0x4173bc['attributes'][_0x2bb4('0x46')]?_0x4173bc['attributes']:_0x16120f[_0x2bb4('0x30')];if(_0x136aee[_0x2bb4('0x31')][_0x2bb4('0x3f')]){_0x4173bc['include']=[{'all':!![]}];}_0x4173bc=_['merge']({},_0x4173bc,_0x136aee[_0x2bb4('0x3e')]);return db['Trigger'][_0x2bb4('0x47')](_0x4173bc)[_0x2bb4('0x23')](handleEntityNotFound(_0xf65c6c,null))[_0x2bb4('0x23')](respondWithResult(_0xf65c6c,null))['catch'](handleError(_0xf65c6c,null));};exports[_0x2bb4('0x48')]=function(_0x126dc6,_0x426efc){return db['Trigger'][_0x2bb4('0x48')](_0x126dc6[_0x2bb4('0x49')],{})[_0x2bb4('0x23')](function(_0x90c3bb){var _0x13d770=_0x126dc6[_0x2bb4('0x4a')]['get']({'plain':!![]});if(!_0x13d770)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13d770[_0x2bb4('0x4b')]===_0x2bb4('0x4a')){var _0x201d13=_0x90c3bb['get']({'plain':!![]});var _0x3b54e5=_0x2bb4('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3b54e5,'userProfileId':_0x13d770[_0x2bb4('0x4c')]},'raw':!![]})[_0x2bb4('0x23')](function(_0x3525e8){if(_0x3525e8&&_0x3525e8[_0x2bb4('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x201d13[_0x2bb4('0x28')],'resourceId':_0x201d13['id'],'type':_0x3525e8[_0x2bb4('0x28')],'sectionId':_0x3525e8['id']},{})[_0x2bb4('0x23')](function(){return _0x90c3bb;});}else{return _0x90c3bb;}})[_0x2bb4('0x43')](function(_0x4db30b){logger[_0x2bb4('0x27')](_0x2bb4('0x4e'),_0x4db30b);throw _0x4db30b;});}return _0x90c3bb;})[_0x2bb4('0x23')](respondWithResult(_0x426efc,0xc9))[_0x2bb4('0x43')](handleError(_0x426efc,null));};exports[_0x2bb4('0x22')]=function(_0x4dd49d,_0x562481){if(_0x4dd49d[_0x2bb4('0x49')]['id']){delete _0x4dd49d[_0x2bb4('0x49')]['id'];}return db[_0x2bb4('0x2b')][_0x2bb4('0x47')]({'where':{'id':_0x4dd49d[_0x2bb4('0x45')]['id']}})[_0x2bb4('0x23')](handleEntityNotFound(_0x562481,null))['then'](saveUpdates(_0x4dd49d[_0x2bb4('0x49')],null))['then'](respondWithResult(_0x562481,null))[_0x2bb4('0x43')](handleError(_0x562481,null));};exports['destroy']=function(_0x270d02,_0x34c5d4){return db['Trigger'][_0x2bb4('0x47')]({'where':{'id':_0x270d02[_0x2bb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x34c5d4,null))[_0x2bb4('0x23')](removeEntity(_0x34c5d4,null))[_0x2bb4('0x43')](handleError(_0x34c5d4,null));};exports['addAllCondition']=function(_0x27bb29,_0x145893,_0x5243ef){if(_0x27bb29[_0x2bb4('0x49')]['id']){delete _0x27bb29[_0x2bb4('0x49')]['id'];}return db['Trigger'][_0x2bb4('0x47')]({'where':{'id':_0x27bb29[_0x2bb4('0x45')]['id']}})[_0x2bb4('0x23')](handleEntityNotFound(_0x145893,null))[_0x2bb4('0x23')](function(_0x2869b3){if(_0x2869b3){_0x27bb29[_0x2bb4('0x49')]['TriggerAllId']=_0x2869b3['id'];return db[_0x2bb4('0x4f')][_0x2bb4('0x48')](_0x27bb29[_0x2bb4('0x49')]);}})[_0x2bb4('0x23')](respondWithResult(_0x145893,null))[_0x2bb4('0x43')](handleError(_0x145893,null));};exports[_0x2bb4('0x50')]=function(_0x7e1a9a,_0x1ed1d5,_0x227503){if(_0x7e1a9a[_0x2bb4('0x49')]['id']){delete _0x7e1a9a['body']['id'];}return db[_0x2bb4('0x2b')][_0x2bb4('0x47')]({'where':{'id':_0x7e1a9a[_0x2bb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ed1d5,null))[_0x2bb4('0x23')](function(_0x43879e){if(_0x43879e){_0x7e1a9a[_0x2bb4('0x49')][_0x2bb4('0x51')]=_0x43879e['id'];return db[_0x2bb4('0x4f')][_0x2bb4('0x48')](_0x7e1a9a[_0x2bb4('0x49')]);}})[_0x2bb4('0x23')](respondWithResult(_0x1ed1d5,null))[_0x2bb4('0x43')](handleError(_0x1ed1d5,null));};exports[_0x2bb4('0x52')]=function(_0x2717bc,_0xb80bea,_0x41746d){var _0x5e9c4a={};var _0xe75758={};var _0x2a279d;var _0x598613;return db[_0x2bb4('0x2b')][_0x2bb4('0x53')]({'where':{'id':_0x2717bc[_0x2bb4('0x45')]['id']}})[_0x2bb4('0x23')](handleEntityNotFound(_0xb80bea,null))[_0x2bb4('0x23')](function(_0x28f092){if(_0x28f092){_0x2a279d=_0x28f092;_0xe75758[_0x2bb4('0x30')]=_[_0x2bb4('0x32')](db[_0x2bb4('0x4f')]['rawAttributes']);_0xe75758[_0x2bb4('0x31')]=_[_0x2bb4('0x32')](_0x2717bc[_0x2bb4('0x31')]);_0xe75758[_0x2bb4('0x33')]=_[_0x2bb4('0x34')](_0xe75758['model'],_0xe75758['query']);_0x5e9c4a[_0x2bb4('0x35')]=_[_0x2bb4('0x34')](_0xe75758[_0x2bb4('0x30')],qs[_0x2bb4('0x36')](_0x2717bc[_0x2bb4('0x31')][_0x2bb4('0x36')]));_0x5e9c4a[_0x2bb4('0x35')]=_0x5e9c4a[_0x2bb4('0x35')][_0x2bb4('0x46')]?_0x5e9c4a[_0x2bb4('0x35')]:_0xe75758[_0x2bb4('0x30')];_0x5e9c4a[_0x2bb4('0x38')]=qs[_0x2bb4('0x39')](_0x2717bc[_0x2bb4('0x31')]['sort']);_0x5e9c4a[_0x2bb4('0x3a')]=qs[_0x2bb4('0x33')](_[_0x2bb4('0x3b')](_0x2717bc['query'],_0xe75758[_0x2bb4('0x33')]));if(_0x2717bc[_0x2bb4('0x31')][_0x2bb4('0x3d')]){_0x5e9c4a[_0x2bb4('0x3a')]=_['merge'](_0x5e9c4a[_0x2bb4('0x3a')],{'$or':_[_0x2bb4('0x2a')](_0x5e9c4a[_0x2bb4('0x35')],function(_0x476c0f){var _0x102f91={};_0x102f91[_0x476c0f]={'$like':'%'+_0x2717bc[_0x2bb4('0x31')][_0x2bb4('0x3d')]+'%'};return _0x102f91;})});}_0x5e9c4a=_[_0x2bb4('0x3c')]({},_0x5e9c4a,_0x2717bc['options']);return _0x2a279d['getAllConditions'](_0x5e9c4a);}})[_0x2bb4('0x23')](function(_0x173bef){if(_0x173bef){_0x598613=_0x173bef['length'];if(!_0x2717bc[_0x2bb4('0x31')][_0x2bb4('0x54')]('nolimit')){_0x5e9c4a[_0x2bb4('0x1c')]=qs['limit'](_0x2717bc[_0x2bb4('0x31')]['limit']);_0x5e9c4a[_0x2bb4('0x1a')]=qs[_0x2bb4('0x1a')](_0x2717bc[_0x2bb4('0x31')]['offset']);}return _0x2a279d[_0x2bb4('0x52')](_0x5e9c4a);}})['then'](function(_0x2dddec){if(_0x2dddec){return _0x2dddec?{'count':_0x598613,'rows':_0x2dddec}:null;}})['then'](respondWithResult(_0xb80bea,null))['catch'](handleError(_0xb80bea,null));};exports[_0x2bb4('0x55')]=function(_0x14423a,_0x518afd,_0x2b1134){var _0x843f40={};var _0x10d847={};var _0x3ff416;var _0x253c0d;return db['Trigger'][_0x2bb4('0x53')]({'where':{'id':_0x14423a[_0x2bb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x518afd,null))[_0x2bb4('0x23')](function(_0x141693){if(_0x141693){_0x3ff416=_0x141693;_0x10d847[_0x2bb4('0x30')]=_[_0x2bb4('0x32')](db['Condition'][_0x2bb4('0x2c')]);_0x10d847[_0x2bb4('0x31')]=_[_0x2bb4('0x32')](_0x14423a['query']);_0x10d847[_0x2bb4('0x33')]=_[_0x2bb4('0x34')](_0x10d847[_0x2bb4('0x30')],_0x10d847[_0x2bb4('0x31')]);_0x843f40[_0x2bb4('0x35')]=_['intersection'](_0x10d847[_0x2bb4('0x30')],qs['fields'](_0x14423a['query']['fields']));_0x843f40[_0x2bb4('0x35')]=_0x843f40[_0x2bb4('0x35')][_0x2bb4('0x46')]?_0x843f40[_0x2bb4('0x35')]:_0x10d847['model'];_0x843f40[_0x2bb4('0x38')]=qs[_0x2bb4('0x39')](_0x14423a['query'][_0x2bb4('0x39')]);_0x843f40[_0x2bb4('0x3a')]=qs[_0x2bb4('0x33')](_[_0x2bb4('0x3b')](_0x14423a['query'],_0x10d847[_0x2bb4('0x33')]));if(_0x14423a[_0x2bb4('0x31')]['filter']){_0x843f40[_0x2bb4('0x3a')]=_['merge'](_0x843f40[_0x2bb4('0x3a')],{'$or':_[_0x2bb4('0x2a')](_0x843f40[_0x2bb4('0x35')],function(_0x180497){var _0x57e5ce={};_0x57e5ce[_0x180497]={'$like':'%'+_0x14423a[_0x2bb4('0x31')]['filter']+'%'};return _0x57e5ce;})});}_0x843f40=_[_0x2bb4('0x3c')]({},_0x843f40,_0x14423a['options']);return _0x3ff416[_0x2bb4('0x55')](_0x843f40);}})['then'](function(_0x2587c5){if(_0x2587c5){_0x253c0d=_0x2587c5[_0x2bb4('0x46')];if(!_0x14423a[_0x2bb4('0x31')][_0x2bb4('0x54')]('nolimit')){_0x843f40[_0x2bb4('0x1c')]=qs[_0x2bb4('0x1c')](_0x14423a[_0x2bb4('0x31')][_0x2bb4('0x1c')]);_0x843f40[_0x2bb4('0x1a')]=qs['offset'](_0x14423a['query'][_0x2bb4('0x1a')]);}return _0x3ff416['getAnyConditions'](_0x843f40);}})[_0x2bb4('0x23')](function(_0x35ee74){if(_0x35ee74){return _0x35ee74?{'count':_0x253c0d,'rows':_0x35ee74}:null;}})[_0x2bb4('0x23')](respondWithResult(_0x518afd,null))[_0x2bb4('0x43')](handleError(_0x518afd,null));};exports['addAction']=function(_0x498ab4,_0x20055b,_0xca7c5){if(_0x498ab4['body']['id']){delete _0x498ab4[_0x2bb4('0x49')]['id'];}return db[_0x2bb4('0x2b')][_0x2bb4('0x47')]({'where':{'id':_0x498ab4[_0x2bb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x20055b,null))['then'](function(_0x2304c7){if(_0x2304c7){_0x498ab4[_0x2bb4('0x49')][_0x2bb4('0x56')]=_0x2304c7['id'];return db[_0x2bb4('0x57')][_0x2bb4('0x48')](_0x498ab4[_0x2bb4('0x49')]);}})[_0x2bb4('0x23')](respondWithResult(_0x20055b,null))['catch'](handleError(_0x20055b,null));};exports[_0x2bb4('0x58')]=function(_0x42f56d,_0x2038c6,_0x134507){var _0x270421={};var _0x43dcf2={};var _0xf66835;var _0xb7c32f;return db[_0x2bb4('0x2b')]['findOne']({'where':{'id':_0x42f56d[_0x2bb4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2038c6,null))['then'](function(_0x4a9c34){if(_0x4a9c34){_0xf66835=_0x4a9c34;_0x43dcf2[_0x2bb4('0x30')]=_[_0x2bb4('0x32')](db[_0x2bb4('0x57')][_0x2bb4('0x2c')]);_0x43dcf2['query']=_['keys'](_0x42f56d['query']);_0x43dcf2['filters']=_['intersection'](_0x43dcf2['model'],_0x43dcf2[_0x2bb4('0x31')]);_0x270421[_0x2bb4('0x35')]=_[_0x2bb4('0x34')](_0x43dcf2[_0x2bb4('0x30')],qs['fields'](_0x42f56d['query'][_0x2bb4('0x36')]));_0x270421[_0x2bb4('0x35')]=_0x270421['attributes']['length']?_0x270421['attributes']:_0x43dcf2[_0x2bb4('0x30')];_0x270421['order']=qs[_0x2bb4('0x39')](_0x42f56d[_0x2bb4('0x31')][_0x2bb4('0x39')]);_0x270421[_0x2bb4('0x3a')]=qs['filters'](_[_0x2bb4('0x3b')](_0x42f56d[_0x2bb4('0x31')],_0x43dcf2['filters']));if(_0x42f56d[_0x2bb4('0x31')]['filter']){_0x270421[_0x2bb4('0x3a')]=_['merge'](_0x270421[_0x2bb4('0x3a')],{'$or':_[_0x2bb4('0x2a')](_0x270421[_0x2bb4('0x35')],function(_0x4dca17){var _0x455450={};_0x455450[_0x4dca17]={'$like':'%'+_0x42f56d['query'][_0x2bb4('0x3d')]+'%'};return _0x455450;})});}_0x270421=_[_0x2bb4('0x3c')]({},_0x270421,_0x42f56d[_0x2bb4('0x3e')]);return _0xf66835['getActions'](_0x270421);}})[_0x2bb4('0x23')](function(_0x12926b){if(_0x12926b){_0xb7c32f=_0x12926b[_0x2bb4('0x46')];if(!_0x42f56d['query']['hasOwnProperty']('nolimit')){_0x270421[_0x2bb4('0x1c')]=qs[_0x2bb4('0x1c')](_0x42f56d[_0x2bb4('0x31')][_0x2bb4('0x1c')]);_0x270421[_0x2bb4('0x1a')]=qs[_0x2bb4('0x1a')](_0x42f56d[_0x2bb4('0x31')][_0x2bb4('0x1a')]);}return _0xf66835[_0x2bb4('0x58')](_0x270421);}})[_0x2bb4('0x23')](function(_0xa1e5e5){if(_0xa1e5e5){return _0xa1e5e5?{'count':_0xb7c32f,'rows':_0xa1e5e5}:null;}})[_0x2bb4('0x23')](respondWithResult(_0x2038c6,null))['catch'](handleError(_0x2038c6,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8b9c463..694bd71 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 _0x1738=['exports','define','Trigger','tools_triggers','lodash','util','moment','bluebird','request-promise','../../config/environment','./trigger.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1738,0x1bc));var _0x8173=function(_0x30981e,_0x35b32b){_0x30981e=_0x30981e-0x0;var _0x45ade2=_0x1738[_0x30981e];return _0x45ade2;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8173('0x2'));var BPromise=require(_0x8173('0x3'));var rp=require(_0x8173('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8173('0x5'));var attributes=require(_0x8173('0x6'));module[_0x8173('0x7')]=function(_0x3cf9ac,_0x2220fd){return _0x3cf9ac[_0x8173('0x8')](_0x8173('0x9'),attributes,{'tableName':_0x8173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9b=['util','../../config/logger','api','moment','path','../../config/environment','./trigger.attributes','define','lodash'];(function(_0x1520e9,_0x288a61){var _0x2368a9=function(_0x1c1ea6){while(--_0x1c1ea6){_0x1520e9['push'](_0x1520e9['shift']());}};_0x2368a9(++_0x288a61);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d9('0x6'));var attributes=require(_0xb8d9('0x7'));module['exports']=function(_0x5996e9,_0x529b0a){return _0x5996e9[_0xb8d9('0x8')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 43aa424..10c9305 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 _0xbed1=['result','catch','Trigger,\x20%s,\x20%s','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','Trigger','find','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbed1,0x1c2));var _0x1bed=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0xbed1[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0x1bed('0x0'));var util=require('util');var moment=require(_0x1bed('0x1'));var BPromise=require(_0x1bed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bed('0x3'));var db=require(_0x1bed('0x4'))['db'];var utils=require(_0x1bed('0x5'));var logger=require(_0x1bed('0x6'))(_0x1bed('0x7'));var config=require(_0x1bed('0x8'));var jayson=require(_0x1bed('0x9'));var client=jayson['client'][_0x1bed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f309,_0x3956c9,_0x479340){return new BPromise(function(_0x2afa33,_0x1c906d){return client[_0x1bed('0xb')](_0x27f309,_0x479340)['then'](function(_0x10407){logger[_0x1bed('0xc')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'));logger[_0x1bed('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'),JSON['stringify'](_0x10407));if(_0x10407[_0x1bed('0xf')]){if(_0x10407[_0x1bed('0xf')][_0x1bed('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x3956c9,_0x10407[_0x1bed('0xf')]['message']);return _0x1c906d(_0x10407[_0x1bed('0xf')][_0x1bed('0x11')]);}logger[_0x1bed('0xf')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x10407[_0x1bed('0xf')][_0x1bed('0x11')]);return _0x2afa33(_0x10407['error'][_0x1bed('0x11')]);}else{logger[_0x1bed('0xc')]('Trigger,\x20%s,\x20%s',_0x3956c9,_0x1bed('0xd'));_0x2afa33(_0x10407[_0x1bed('0x12')]['message']);}})[_0x1bed('0x13')](function(_0x6f92b4){logger[_0x1bed('0xf')](_0x1bed('0x14'),_0x3956c9,_0x6f92b4);_0x1c906d(_0x6f92b4);});});}exports['GetTrigger']=function(_0x5844b3){var _0x1acaa9=this;return new Promise(function(_0x3d32af,_0x523797){return db['Trigger'][_0x1bed('0x15')]({'raw':_0x5844b3[_0x1bed('0x16')]?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x17')]===undefined?!![]:![]:!![],'where':_0x5844b3[_0x1bed('0x16')]?_0x5844b3['options'][_0x1bed('0x18')]||null:null,'attributes':_0x5844b3['options']?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x19')]||null:null,'limit':_0x5844b3[_0x1bed('0x16')]?_0x5844b3['options'][_0x1bed('0x1a')]||null:null,'include':_0x5844b3['options']?_0x5844b3[_0x1bed('0x16')][_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x5844b3[_0x1bed('0x16')][_0x1bed('0x1b')],function(_0x173356){return{'model':db[_0x173356[_0x1bed('0x1d')]],'as':_0x173356['as'],'attributes':_0x173356[_0x1bed('0x19')],'include':_0x173356[_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x173356[_0x1bed('0x1b')],function(_0x321239){return{'model':db[_0x321239['model']],'as':_0x321239['as'],'attributes':_0x321239[_0x1bed('0x19')],'include':_0x321239[_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x321239['include'],function(_0x31e420){return{'model':db[_0x31e420[_0x1bed('0x1d')]],'as':_0x31e420['as'],'attributes':_0x31e420[_0x1bed('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1bed('0x1e')](function(_0x40598a){logger[_0x1bed('0xc')](_0x1bed('0x1f'),_0x5844b3);logger[_0x1bed('0xe')](_0x1bed('0x1f'),_0x5844b3,JSON['stringify'](_0x40598a));_0x3d32af(_0x40598a);})['catch'](function(_0x685b60){logger[_0x1bed('0xf')](_0x1bed('0x1f'),_0x685b60[_0x1bed('0x11')],_0x5844b3);_0x523797(_0x1acaa9[_0x1bed('0xf')](0x1f4,_0x685b60[_0x1bed('0x11')]));});});};exports[_0x1bed('0x20')]=function(_0x287a71){var _0x13e82a=this;return new Promise(function(_0x215c3f,_0x4d1438){return db[_0x1bed('0x21')][_0x1bed('0x22')]({'raw':_0x287a71[_0x1bed('0x16')]?_0x287a71[_0x1bed('0x16')][_0x1bed('0x17')]===undefined?!![]:![]:!![],'where':_0x287a71[_0x1bed('0x16')]?_0x287a71[_0x1bed('0x16')]['where']||null:null,'attributes':_0x287a71['options']?_0x287a71[_0x1bed('0x16')]['attributes']||null:null,'include':_0x287a71[_0x1bed('0x16')]?_0x287a71['options'][_0x1bed('0x1b')]?_[_0x1bed('0x1c')](_0x287a71[_0x1bed('0x16')][_0x1bed('0x1b')],function(_0x2e46f9){return{'model':db[_0x2e46f9[_0x1bed('0x1d')]],'as':_0x2e46f9['as'],'attributes':_0x2e46f9[_0x1bed('0x19')],'include':_0x2e46f9[_0x1bed('0x1b')]?_['map'](_0x2e46f9[_0x1bed('0x1b')],function(_0x57a6f3){return{'model':db[_0x57a6f3[_0x1bed('0x1d')]],'as':_0x57a6f3['as'],'attributes':_0x57a6f3[_0x1bed('0x19')],'include':_0x57a6f3['include']?_['map'](_0x57a6f3[_0x1bed('0x1b')],function(_0x303037){return{'model':db[_0x303037[_0x1bed('0x1d')]],'as':_0x303037['as'],'attributes':_0x303037[_0x1bed('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5391e8){logger[_0x1bed('0xc')](_0x1bed('0x20'),_0x287a71);logger[_0x1bed('0xe')]('ShowTrigger',_0x287a71,JSON[_0x1bed('0x23')](_0x5391e8));_0x215c3f(_0x5391e8);})[_0x1bed('0x13')](function(_0x406bcd){logger['error']('ShowTrigger',_0x406bcd[_0x1bed('0x11')],_0x287a71);_0x4d1438(_0x13e82a[_0x1bed('0xf')](0x1f4,_0x406bcd[_0x1bed('0x11')]));});});}; \ No newline at end of file +var _0x5979=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','findAll','options','where','attributes','limit','include','map','model','debug','ShowTrigger','find','raw','lodash','moment'];(function(_0x155477,_0x35dfa5){var _0x2e5f7e=function(_0x11d984){while(--_0x11d984){_0x155477['push'](_0x155477['shift']());}};_0x2e5f7e(++_0x35dfa5);}(_0x5979,0x1ab));var _0x9597=function(_0x20ef63,_0x5a67d5){_0x20ef63=_0x20ef63-0x0;var _0x22f6bd=_0x5979[_0x20ef63];return _0x22f6bd;};'use strict';var _=require(_0x9597('0x0'));var util=require('util');var moment=require(_0x9597('0x1'));var BPromise=require(_0x9597('0x2'));var rs=require(_0x9597('0x3'));var fs=require('fs');var Redis=require(_0x9597('0x4'));var db=require(_0x9597('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9597('0x6'))(_0x9597('0x7'));var config=require(_0x9597('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9597('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd18aeb,_0x2532c4,_0x515bc4){return new BPromise(function(_0x3ea905,_0x375677){return client['request'](_0xd18aeb,_0x515bc4)[_0x9597('0xa')](function(_0x3ff28c){logger[_0x9597('0xb')](_0x9597('0xc'),_0x2532c4,_0x9597('0xd'));logger['debug'](_0x9597('0xe'),_0x2532c4,_0x9597('0xd'),JSON[_0x9597('0xf')](_0x3ff28c));if(_0x3ff28c[_0x9597('0x10')]){if(_0x3ff28c[_0x9597('0x10')][_0x9597('0x11')]===0x1f4){logger[_0x9597('0x10')](_0x9597('0xc'),_0x2532c4,_0x3ff28c[_0x9597('0x10')][_0x9597('0x12')]);return _0x375677(_0x3ff28c[_0x9597('0x10')][_0x9597('0x12')]);}logger[_0x9597('0x10')]('Trigger,\x20%s,\x20%s',_0x2532c4,_0x3ff28c['error'][_0x9597('0x12')]);return _0x3ea905(_0x3ff28c[_0x9597('0x10')][_0x9597('0x12')]);}else{logger[_0x9597('0xb')](_0x9597('0xc'),_0x2532c4,_0x9597('0xd'));_0x3ea905(_0x3ff28c['result'][_0x9597('0x12')]);}})[_0x9597('0x13')](function(_0x137c67){logger[_0x9597('0x10')](_0x9597('0xc'),_0x2532c4,_0x137c67);_0x375677(_0x137c67);});});}exports[_0x9597('0x14')]=function(_0x1ad168){var _0x369433=this;return new Promise(function(_0x364754,_0x520925){return db['Trigger'][_0x9597('0x15')]({'raw':_0x1ad168[_0x9597('0x16')]?_0x1ad168[_0x9597('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1ad168[_0x9597('0x16')]?_0x1ad168[_0x9597('0x16')][_0x9597('0x17')]||null:null,'attributes':_0x1ad168[_0x9597('0x16')]?_0x1ad168[_0x9597('0x16')][_0x9597('0x18')]||null:null,'limit':_0x1ad168[_0x9597('0x16')]?_0x1ad168[_0x9597('0x16')][_0x9597('0x19')]||null:null,'include':_0x1ad168[_0x9597('0x16')]?_0x1ad168[_0x9597('0x16')][_0x9597('0x1a')]?_[_0x9597('0x1b')](_0x1ad168[_0x9597('0x16')][_0x9597('0x1a')],function(_0x1de4c9){return{'model':db[_0x1de4c9[_0x9597('0x1c')]],'as':_0x1de4c9['as'],'attributes':_0x1de4c9[_0x9597('0x18')],'include':_0x1de4c9[_0x9597('0x1a')]?_[_0x9597('0x1b')](_0x1de4c9[_0x9597('0x1a')],function(_0x5a6591){return{'model':db[_0x5a6591['model']],'as':_0x5a6591['as'],'attributes':_0x5a6591[_0x9597('0x18')],'include':_0x5a6591[_0x9597('0x1a')]?_[_0x9597('0x1b')](_0x5a6591[_0x9597('0x1a')],function(_0xe13e7d){return{'model':db[_0xe13e7d[_0x9597('0x1c')]],'as':_0xe13e7d['as'],'attributes':_0xe13e7d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9597('0xa')](function(_0x4698ef){logger[_0x9597('0xb')](_0x9597('0x14'),_0x1ad168);logger[_0x9597('0x1d')](_0x9597('0x14'),_0x1ad168,JSON[_0x9597('0xf')](_0x4698ef));_0x364754(_0x4698ef);})[_0x9597('0x13')](function(_0x15952f){logger['error']('GetTrigger',_0x15952f[_0x9597('0x12')],_0x1ad168);_0x520925(_0x369433[_0x9597('0x10')](0x1f4,_0x15952f[_0x9597('0x12')]));});});};exports[_0x9597('0x1e')]=function(_0x2ce35a){var _0x11c9ce=this;return new Promise(function(_0x396c70,_0x2cec63){return db['Trigger'][_0x9597('0x1f')]({'raw':_0x2ce35a[_0x9597('0x16')]?_0x2ce35a[_0x9597('0x16')][_0x9597('0x20')]===undefined?!![]:![]:!![],'where':_0x2ce35a[_0x9597('0x16')]?_0x2ce35a[_0x9597('0x16')][_0x9597('0x17')]||null:null,'attributes':_0x2ce35a[_0x9597('0x16')]?_0x2ce35a[_0x9597('0x16')][_0x9597('0x18')]||null:null,'include':_0x2ce35a[_0x9597('0x16')]?_0x2ce35a[_0x9597('0x16')][_0x9597('0x1a')]?_['map'](_0x2ce35a[_0x9597('0x16')]['include'],function(_0x2aa74b){return{'model':db[_0x2aa74b['model']],'as':_0x2aa74b['as'],'attributes':_0x2aa74b[_0x9597('0x18')],'include':_0x2aa74b[_0x9597('0x1a')]?_['map'](_0x2aa74b[_0x9597('0x1a')],function(_0x4c2919){return{'model':db[_0x4c2919[_0x9597('0x1c')]],'as':_0x4c2919['as'],'attributes':_0x4c2919[_0x9597('0x18')],'include':_0x4c2919['include']?_['map'](_0x4c2919[_0x9597('0x1a')],function(_0x428b30){return{'model':db[_0x428b30['model']],'as':_0x428b30['as'],'attributes':_0x428b30[_0x9597('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9597('0xa')](function(_0x595f68){logger['info'](_0x9597('0x1e'),_0x2ce35a);logger[_0x9597('0x1d')]('ShowTrigger',_0x2ce35a,JSON[_0x9597('0xf')](_0x595f68));_0x396c70(_0x595f68);})[_0x9597('0x13')](function(_0x32f9c1){logger[_0x9597('0x10')](_0x9597('0x1e'),_0x32f9c1[_0x9597('0x12')],_0x2ce35a);_0x2cec63(_0x11c9ce[_0x9597('0x10')](0x1f4,_0x32f9c1[_0x9597('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 013e702..492c28d 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 _0x2c43=['get','isAuthenticated','index','post','put','update','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c43,0xbd));var _0x32c4=function(_0xb042ac,_0x1541c5){_0xb042ac=_0xb042ac-0x0;var _0x34dc6c=_0x2c43[_0xb042ac];return _0x34dc6c;};'use strict';var multer=require(_0x32c4('0x0'));var util=require('util');var path=require(_0x32c4('0x1'));var timeout=require(_0x32c4('0x2'));var express=require(_0x32c4('0x3'));var router=express[_0x32c4('0x4')]();var fs_extra=require(_0x32c4('0x5'));var auth=require(_0x32c4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x32c4('0x7'));var controller=require(_0x32c4('0x8'));router[_0x32c4('0x9')]('/',auth[_0x32c4('0xa')](),controller[_0x32c4('0xb')]);router[_0x32c4('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x32c4('0xc')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x32c4('0xc')]('/',auth[_0x32c4('0xa')](),controller['create']);router[_0x32c4('0xd')]('/:id',auth[_0x32c4('0xa')](),controller[_0x32c4('0xe')]);router[_0x32c4('0xf')](_0x32c4('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x32c4('0x11')]=router; \ No newline at end of file +var _0xd3ce=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','/:id/clone','post','create','put','delete'];(function(_0x35fa06,_0x56a72d){var _0x13e5a2=function(_0x551371){while(--_0x551371){_0x35fa06['push'](_0x35fa06['shift']());}};_0x13e5a2(++_0x56a72d);}(_0xd3ce,0x105));var _0xed3c=function(_0x198b01,_0x1a59e6){_0x198b01=_0x198b01-0x0;var _0x4d4a51=_0xd3ce[_0x198b01];return _0x4d4a51;};'use strict';var multer=require(_0xed3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed3c('0x1'));var express=require(_0xed3c('0x2'));var router=express[_0xed3c('0x3')]();var fs_extra=require(_0xed3c('0x4'));var auth=require(_0xed3c('0x5'));var interaction=require(_0xed3c('0x6'));var config=require(_0xed3c('0x7'));var controller=require(_0xed3c('0x8'));router[_0xed3c('0x9')]('/',auth['isAuthenticated'](),controller[_0xed3c('0xa')]);router[_0xed3c('0x9')](_0xed3c('0xb'),auth[_0xed3c('0xc')](),controller[_0xed3c('0xd')]);router['post'](_0xed3c('0xe'),auth[_0xed3c('0xc')](),controller['clone']);router[_0xed3c('0xf')]('/',auth[_0xed3c('0xc')](),controller[_0xed3c('0x10')]);router[_0xed3c('0x11')]('/:id',auth[_0xed3c('0xc')](),controller['update']);router[_0xed3c('0x12')](_0xed3c('0xb'),auth[_0xed3c('0xc')](),controller[_0xed3c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 8822cc5..9558fad 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 _0xd4a0=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','nonat','sequelize','exports','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x570e70,_0x379463){var _0x2a7be9=function(_0x537fc9){while(--_0x537fc9){_0x570e70['push'](_0x570e70['shift']());}};_0x2a7be9(++_0x379463);}(_0xd4a0,0x1e7));var _0x0d4a=function(_0x346f7b,_0x1ba839){_0x346f7b=_0x346f7b-0x0;var _0x1adb65=_0xd4a0[_0x346f7b];return _0x1adb65;};'use strict';var Sequelize=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]={'name':{'type':Sequelize[_0x0d4a('0x2')],'allowNull':![],'unique':_0x0d4a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0d4a('0x4'),'user',_0x0d4a('0x5')),'allowNull':![],'defaultValue':_0x0d4a('0x4')},'context':{'type':Sequelize[_0x0d4a('0x2')],'allowNull':![],'defaultValue':_0x0d4a('0x6')},'callingpres':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x8'),_0x0d4a('0x9'),_0x0d4a('0xa'),_0x0d4a('0xb'),_0x0d4a('0xc'),'PROHIB_PASSED_SCREEN',_0x0d4a('0xd'),_0x0d4a('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x0d4a('0x2')]},'transport':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0xf'),'set':function(_0x306aa8){this['setDataValue'](_0x0d4a('0x10'),_0x306aa8?_0x306aa8[_0x0d4a('0x11')](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x10'))?this[_0x0d4a('0x12')](_0x0d4a('0x10'))[_0x0d4a('0x13')](','):null;},'comment':_0x0d4a('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0d4a('0x15'),_0x0d4a('0x16'),'shortinfo','inband',_0x0d4a('0x17')),'defaultValue':_0x0d4a('0x15')},'directmedia':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no','nonat',_0x0d4a('0x19'),_0x0d4a('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x0d4a('0x2')]},'nat':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x1b'),'set':function(_0x569b3d){this[_0x0d4a('0x1c')](_0x0d4a('0x1d'),_0x569b3d?_0x569b3d['join'](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x1d'))?this['getDataValue'](_0x0d4a('0x1d'))[_0x0d4a('0x13')](','):null;},'comment':_0x0d4a('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x0d4a('0x2')]},'pickupgroup':{'type':Sequelize[_0x0d4a('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x0d4a('0x2')]},'language':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d4a('0x20'),'set':function(_0x5e8b3f){this[_0x0d4a('0x1c')](_0x0d4a('0x21'),_0x5e8b3f?_0x5e8b3f[_0x0d4a('0x11')](';'):_0x0d4a('0x20'));},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x21'))?this[_0x0d4a('0x12')](_0x0d4a('0x21'))['split'](';'):null;},'comment':_0x0d4a('0x22')},'autoframing':{'type':Sequelize[_0x0d4a('0x7')]('yes','no')},'insecure':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x23'),'set':function(_0x27c4d2){this[_0x0d4a('0x1c')](_0x0d4a('0x24'),_0x27c4d2?_0x27c4d2[_0x0d4a('0x11')](','):null);},'get':function(){return this[_0x0d4a('0x12')](_0x0d4a('0x24'))?this['getDataValue'](_0x0d4a('0x24'))['split'](','):null;},'comment':_0x0d4a('0x25')},'trustrpid':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x26'))},'promiscredir':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'accountcode':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'setvar':{'type':Sequelize[_0x0d4a('0x2')]},'callerid':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':_0x0d4a('0x28')},'amaflags':{'type':Sequelize[_0x0d4a('0x2')]},'callcounter':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x0d4a('0x2')]},'videosupport':{'type':Sequelize[_0x0d4a('0x7')]('yes','no',_0x0d4a('0x29')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'mailbox':{'type':Sequelize[_0x0d4a('0x2')]},'session_timers':{'type':Sequelize[_0x0d4a('0x7')]('accept',_0x0d4a('0x2a'),_0x0d4a('0x2b'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x2c'),'uas'),'defaultValue':_0x0d4a('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x0d4a('0x2')]},'fromuser':{'type':Sequelize[_0x0d4a('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':_0x0d4a('0x18')},'keepalive':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x0d4a('0x2')]},'rtptimeout':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0d4a('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'timerb':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x0d4a('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'encryption':{'type':Sequelize[_0x0d4a('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'force_avp':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no',_0x0d4a('0x2f'),_0x0d4a('0x30'))},'dtlsrekey':{'type':Sequelize[_0x0d4a('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x0d4a('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscipher':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscafile':{'type':Sequelize[_0x0d4a('0x2')]},'dtlscapath':{'type':Sequelize[_0x0d4a('0x2')]},'dtlssetup':{'type':Sequelize[_0x0d4a('0x7')]('active',_0x0d4a('0x31'),_0x0d4a('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0d4a('0x2')]},'usereqphone':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x0d4a('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x0d4a('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x0d4a('0x18'),'no')},'vmexten':{'type':Sequelize[_0x0d4a('0x2')]},'mohinterpret':{'type':Sequelize[_0x0d4a('0x2')]},'mohsuggest':{'type':Sequelize[_0x0d4a('0x2')]},'parkinglot':{'type':Sequelize[_0x0d4a('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x0d4a('0x7')](_0x0d4a('0x18'),'no',_0x0d4a('0x33'),_0x0d4a('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x0d4a('0x2')]},'otherFields':{'type':Sequelize[_0x0d4a('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x0d4a('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x00c8=['allow','join','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','accept','originate','uas','pai','fingerprint','passive','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x00c8,0x105));var _0x800c=function(_0x42fe6e,_0x3308e5){_0x42fe6e=_0x42fe6e-0x0;var _0x1c9df2=_0x00c8[_0x42fe6e];return _0x1c9df2;};'use strict';var Sequelize=require(_0x800c('0x0'));module[_0x800c('0x1')]={'name':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'unique':_0x800c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x800c('0x4')]('friend',_0x800c('0x5'),_0x800c('0x6')),'allowNull':![],'defaultValue':_0x800c('0x7')},'context':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x800c('0x8'),_0x800c('0x9'),'ALLOWED_FAILED_SCREEN',_0x800c('0xa'),_0x800c('0xb'),_0x800c('0xc'),_0x800c('0xd'),_0x800c('0xe'))},'deny':{'type':Sequelize[_0x800c('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x800c('0x2')]},'md5secret':{'type':Sequelize[_0x800c('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x800c('0x2')],'defaultValue':'udp','set':function(_0x2b9d7a){this[_0x800c('0xf')](_0x800c('0x10'),_0x2b9d7a?_0x2b9d7a['join'](','):null);},'get':function(){return this['getDataValue'](_0x800c('0x10'))?this[_0x800c('0x11')](_0x800c('0x10'))[_0x800c('0x12')](','):null;},'comment':_0x800c('0x13')},'dtmfmode':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x14'),_0x800c('0x15'),_0x800c('0x16'),_0x800c('0x17'),_0x800c('0x18')),'defaultValue':_0x800c('0x14')},'directmedia':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no',_0x800c('0x1a'),_0x800c('0x1b'),_0x800c('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x800c('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x800c('0x2')]},'directmediadeny':{'type':Sequelize[_0x800c('0x2')]},'nat':{'type':Sequelize[_0x800c('0x2')],'defaultValue':_0x800c('0x1d'),'set':function(_0x485d2f){this[_0x800c('0xf')]('nat',_0x485d2f?_0x485d2f['join'](','):null);},'get':function(){return this[_0x800c('0x11')](_0x800c('0x1e'))?this[_0x800c('0x11')](_0x800c('0x1e'))[_0x800c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x800c('0x2')]},'namedcallgroup':{'type':Sequelize[_0x800c('0x2')]},'pickupgroup':{'type':Sequelize[_0x800c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x800c('0x2')]},'language':{'type':Sequelize[_0x800c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x800c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x800c('0x1f')},'allow':{'type':Sequelize[_0x800c('0x2')],'allowNull':![],'defaultValue':_0x800c('0x20'),'set':function(_0x2fb445){this[_0x800c('0xf')](_0x800c('0x21'),_0x2fb445?_0x2fb445[_0x800c('0x22')](';'):_0x800c('0x20'));},'get':function(){return this[_0x800c('0x11')](_0x800c('0x21'))?this[_0x800c('0x11')](_0x800c('0x21'))[_0x800c('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'insecure':{'type':Sequelize[_0x800c('0x2')],'defaultValue':_0x800c('0x23'),'set':function(_0xcf31a0){this['setDataValue']('insecure',_0xcf31a0?_0xcf31a0[_0x800c('0x22')](','):null);},'get':function(){return this[_0x800c('0x11')](_0x800c('0x24'))?this[_0x800c('0x11')](_0x800c('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x800c('0x4')]('yes','no',_0x800c('0x25'))},'promiscredir':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x800c('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x800c('0x2')]},'callerid':{'type':Sequelize[_0x800c('0x2')],'defaultValue':_0x800c('0x26')},'amaflags':{'type':Sequelize[_0x800c('0x2')]},'callcounter':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x800c('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x800c('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x800c('0x2')]},'template':{'type':Sequelize[_0x800c('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x800c('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x800c('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'mailbox':{'type':Sequelize[_0x800c('0x2')]},'session_timers':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x28'),'refuse',_0x800c('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x800c('0x4')]('uac',_0x800c('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x800c('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no'),'defaultValue':_0x800c('0x19')},'keepalive':{'type':Sequelize[_0x800c('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x800c('0x2')]},'rtptimeout':{'type':Sequelize[_0x800c('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x800c('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x800c('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x800c('0x4')]('yes','no',_0x800c('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x800c('0x2')]},'callbackextension':{'type':Sequelize[_0x800c('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x800c('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x800c('0x27')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x800c('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x800c('0x2')]},'maxforwards':{'type':Sequelize[_0x800c('0x27')](0xb)},'encryption':{'type':Sequelize[_0x800c('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x800c('0x4')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x800c('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x800c('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x800c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x800c('0x2')]},'dtlscipher':{'type':Sequelize[_0x800c('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x800c('0x4')]('active',_0x800c('0x2d'),_0x800c('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x800c('0x2')]},'recordofffeature':{'type':Sequelize[_0x800c('0x2')]},'call_limit':{'type':Sequelize[_0x800c('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x800c('0x4')](_0x800c('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x800c('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x800c('0x2')]},'description':{'type':Sequelize[_0x800c('0x2')]},'host':{'type':Sequelize[_0x800c('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x800c('0x19'),'no',_0x800c('0x1a'),_0x800c('0x1b'),_0x800c('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x800c('0x2')]},'otherFields':{'type':Sequelize[_0x800c('0x2')]},'active':{'type':Sequelize[_0x800c('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 30bddf7..61158a1 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x4b84[_0x2e9187];return _0x1fc3a8;};'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'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x1c3aa3,_0x30dc50){var _0xc34c17=function(_0x40dc60){while(--_0x40dc60){_0x1c3aa3['push'](_0x1c3aa3['shift']());}};_0xc34c17(++_0x30dc50);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x44df32,_0x49c74c){_0x44df32=_0x44df32-0x0;var _0x362ee3=_0x8d0e[_0x44df32];return _0x362ee3;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index b168fc3..d08f6f5 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 _0x7a48=['path','../../config/environment','define','Trunk','lodash','util','../../config/logger','api','moment'];(function(_0x4e840e,_0x5a44c1){var _0x44f805=function(_0x507b3f){while(--_0x507b3f){_0x4e840e['push'](_0x4e840e['shift']());}};_0x44f805(++_0x5a44c1);}(_0x7a48,0x100));var _0x87a4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7a48[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x87a4('0x0'));var util=require(_0x87a4('0x1'));var logger=require(_0x87a4('0x2'))(_0x87a4('0x3'));var moment=require(_0x87a4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x87a4('0x5'));var rimraf=require('rimraf');var config=require(_0x87a4('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4e4103,_0x504b7e){return _0x4e4103[_0x87a4('0x7')](_0x87a4('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe294=['util','bluebird','path','rimraf','../../config/environment','exports','tools_trunks','lodash'];(function(_0x554bd3,_0x3f2825){var _0x1ea182=function(_0x423e4d){while(--_0x423e4d){_0x554bd3['push'](_0x554bd3['shift']());}};_0x1ea182(++_0x3f2825);}(_0xe294,0xa7));var _0x4e29=function(_0x1ac293,_0x159b9f){_0x1ac293=_0x1ac293-0x0;var _0x3d8f6f=_0xe294[_0x1ac293];return _0x3d8f6f;};'use strict';var _=require(_0x4e29('0x0'));var util=require(_0x4e29('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4e29('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e29('0x3'));var rimraf=require(_0x4e29('0x4'));var config=require(_0x4e29('0x5'));var attributes=require('./trunk.attributes');module[_0x4e29('0x6')]=function(_0x4c1099,_0x3025ff){return _0x4c1099['define']('Trunk',attributes,{'tableName':_0x4e29('0x7'),'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 4d6c6f2..ba30ea0 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 _0xd6ab=['client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','model','map','then','stringify','ShowTrunk','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5111e8,_0x454afc){var _0x5ea361=function(_0x2b526b){while(--_0x2b526b){_0x5111e8['push'](_0x5111e8['shift']());}};_0x5ea361(++_0x454afc);}(_0xd6ab,0x10f));var _0xbd6a=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0xd6ab[_0x14af87];return _0x4ff770;};'use strict';var _=require('lodash');var util=require(_0xbd6a('0x0'));var moment=require(_0xbd6a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd6a('0x2'));var db=require(_0xbd6a('0x3'))['db'];var utils=require(_0xbd6a('0x4'));var logger=require(_0xbd6a('0x5'))(_0xbd6a('0x6'));var config=require(_0xbd6a('0x7'));var jayson=require(_0xbd6a('0x8'));var client=jayson[_0xbd6a('0x9')][_0xbd6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372179,_0x1f6d23,_0x19b487){return new BPromise(function(_0x534922,_0xa9f811){return client[_0xbd6a('0xb')](_0x372179,_0x19b487)['then'](function(_0x302782){logger[_0xbd6a('0xc')](_0xbd6a('0xd'),_0x1f6d23,_0xbd6a('0xe'));logger[_0xbd6a('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x1f6d23,_0xbd6a('0xe'),JSON['stringify'](_0x302782));if(_0x302782[_0xbd6a('0x10')]){if(_0x302782[_0xbd6a('0x10')][_0xbd6a('0x11')]===0x1f4){logger[_0xbd6a('0x10')]('Trunk,\x20%s,\x20%s',_0x1f6d23,_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);return _0xa9f811(_0x302782['error']['message']);}logger[_0xbd6a('0x10')](_0xbd6a('0xd'),_0x1f6d23,_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);return _0x534922(_0x302782[_0xbd6a('0x10')][_0xbd6a('0x12')]);}else{logger['info'](_0xbd6a('0xd'),_0x1f6d23,'request\x20sent');_0x534922(_0x302782[_0xbd6a('0x13')]['message']);}})[_0xbd6a('0x14')](function(_0x51c993){logger[_0xbd6a('0x10')](_0xbd6a('0xd'),_0x1f6d23,_0x51c993);_0xa9f811(_0x51c993);});});}exports[_0xbd6a('0x15')]=function(_0x667555){var _0x307514=this;return new Promise(function(_0x3845d3,_0x4704df){return db[_0xbd6a('0x16')][_0xbd6a('0x17')]({'raw':_0x667555['options']?_0x667555[_0xbd6a('0x18')][_0xbd6a('0x19')]===undefined?!![]:![]:!![],'where':_0x667555[_0xbd6a('0x18')]?_0x667555[_0xbd6a('0x18')]['where']||null:null,'attributes':_0x667555[_0xbd6a('0x18')]?_0x667555[_0xbd6a('0x18')][_0xbd6a('0x1a')]||null:null,'limit':_0x667555['options']?_0x667555['options'][_0xbd6a('0x1b')]||null:null,'include':_0x667555[_0xbd6a('0x18')]?_0x667555['options']['include']?_['map'](_0x667555[_0xbd6a('0x18')][_0xbd6a('0x1c')],function(_0x34191f){return{'model':db[_0x34191f[_0xbd6a('0x1d')]],'as':_0x34191f['as'],'attributes':_0x34191f[_0xbd6a('0x1a')],'include':_0x34191f[_0xbd6a('0x1c')]?_[_0xbd6a('0x1e')](_0x34191f[_0xbd6a('0x1c')],function(_0x3045f8){return{'model':db[_0x3045f8[_0xbd6a('0x1d')]],'as':_0x3045f8['as'],'attributes':_0x3045f8['attributes'],'include':_0x3045f8[_0xbd6a('0x1c')]?_['map'](_0x3045f8[_0xbd6a('0x1c')],function(_0x573749){return{'model':db[_0x573749['model']],'as':_0x573749['as'],'attributes':_0x573749[_0xbd6a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd6a('0x1f')](function(_0x5e4d82){logger['info'](_0xbd6a('0x15'),_0x667555);logger[_0xbd6a('0xf')](_0xbd6a('0x15'),_0x667555,JSON[_0xbd6a('0x20')](_0x5e4d82));_0x3845d3(_0x5e4d82);})[_0xbd6a('0x14')](function(_0xdcadba){logger[_0xbd6a('0x10')]('GetTrunk',_0xdcadba[_0xbd6a('0x12')],_0x667555);_0x4704df(_0x307514['error'](0x1f4,_0xdcadba[_0xbd6a('0x12')]));});});};exports[_0xbd6a('0x21')]=function(_0x1c24d5){var _0x428d53=this;return new Promise(function(_0x55d30a,_0x307a44){return db[_0xbd6a('0x16')][_0xbd6a('0x22')]({'raw':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x19')]===undefined?!![]:![]:!![],'where':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5['options']['where']||null:null,'attributes':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5['options'][_0xbd6a('0x1a')]||null:null,'include':_0x1c24d5[_0xbd6a('0x18')]?_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x1c')]?_['map'](_0x1c24d5[_0xbd6a('0x18')][_0xbd6a('0x1c')],function(_0x2549cc){return{'model':db[_0x2549cc['model']],'as':_0x2549cc['as'],'attributes':_0x2549cc[_0xbd6a('0x1a')],'include':_0x2549cc[_0xbd6a('0x1c')]?_['map'](_0x2549cc[_0xbd6a('0x1c')],function(_0x41c89f){return{'model':db[_0x41c89f[_0xbd6a('0x1d')]],'as':_0x41c89f['as'],'attributes':_0x41c89f[_0xbd6a('0x1a')],'include':_0x41c89f[_0xbd6a('0x1c')]?_[_0xbd6a('0x1e')](_0x41c89f[_0xbd6a('0x1c')],function(_0x1c72b1){return{'model':db[_0x1c72b1[_0xbd6a('0x1d')]],'as':_0x1c72b1['as'],'attributes':_0x1c72b1[_0xbd6a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd6a('0x1f')](function(_0x5b4216){logger[_0xbd6a('0xc')](_0xbd6a('0x21'),_0x1c24d5);logger[_0xbd6a('0xf')](_0xbd6a('0x21'),_0x1c24d5,JSON['stringify'](_0x5b4216));_0x55d30a(_0x5b4216);})[_0xbd6a('0x14')](function(_0x346c2f){logger[_0xbd6a('0x10')](_0xbd6a('0x21'),_0x346c2f[_0xbd6a('0x12')],_0x1c24d5);_0x307a44(_0x428d53[_0xbd6a('0x10')](0x1f4,_0x346c2f[_0xbd6a('0x12')]));});});}; \ No newline at end of file +var _0x8cf5=['GetTrunk','Trunk','options','raw','attributes','include','map','model','stringify','ShowTrunk','find','where','then','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch'];(function(_0x5508d8,_0x38136e){var _0x330ffc=function(_0x30655f){while(--_0x30655f){_0x5508d8['push'](_0x5508d8['shift']());}};_0x330ffc(++_0x38136e);}(_0x8cf5,0x12d));var _0x58cf=function(_0x1ddecb,_0x4987ee){_0x1ddecb=_0x1ddecb-0x0;var _0x357ded=_0x8cf5[_0x1ddecb];return _0x357ded;};'use strict';var _=require(_0x58cf('0x0'));var util=require(_0x58cf('0x1'));var moment=require(_0x58cf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58cf('0x3'));var db=require(_0x58cf('0x4'))['db'];var utils=require(_0x58cf('0x5'));var logger=require(_0x58cf('0x6'))(_0x58cf('0x7'));var config=require(_0x58cf('0x8'));var jayson=require(_0x58cf('0x9'));var client=jayson[_0x58cf('0xa')][_0x58cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e0e1e,_0x57707c,_0x1573f7){return new BPromise(function(_0xd315d1,_0x238611){return client[_0x58cf('0xc')](_0x5e0e1e,_0x1573f7)['then'](function(_0x3a7e0f){logger[_0x58cf('0xd')]('Trunk,\x20%s,\x20%s',_0x57707c,'request\x20sent');logger[_0x58cf('0xe')](_0x58cf('0xf'),_0x57707c,_0x58cf('0x10'),JSON['stringify'](_0x3a7e0f));if(_0x3a7e0f[_0x58cf('0x11')]){if(_0x3a7e0f['error'][_0x58cf('0x12')]===0x1f4){logger[_0x58cf('0x11')](_0x58cf('0x13'),_0x57707c,_0x3a7e0f[_0x58cf('0x11')]['message']);return _0x238611(_0x3a7e0f[_0x58cf('0x11')][_0x58cf('0x14')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x57707c,_0x3a7e0f[_0x58cf('0x11')][_0x58cf('0x14')]);return _0xd315d1(_0x3a7e0f['error']['message']);}else{logger[_0x58cf('0xd')](_0x58cf('0x13'),_0x57707c,_0x58cf('0x10'));_0xd315d1(_0x3a7e0f[_0x58cf('0x15')][_0x58cf('0x14')]);}})[_0x58cf('0x16')](function(_0x59440f){logger[_0x58cf('0x11')](_0x58cf('0x13'),_0x57707c,_0x59440f);_0x238611(_0x59440f);});});}exports[_0x58cf('0x17')]=function(_0x546213){var _0x15ed20=this;return new Promise(function(_0x12c95,_0x146bd6){return db[_0x58cf('0x18')]['findAll']({'raw':_0x546213[_0x58cf('0x19')]?_0x546213[_0x58cf('0x19')][_0x58cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x546213['options']?_0x546213[_0x58cf('0x19')]['where']||null:null,'attributes':_0x546213[_0x58cf('0x19')]?_0x546213[_0x58cf('0x19')][_0x58cf('0x1b')]||null:null,'limit':_0x546213['options']?_0x546213[_0x58cf('0x19')]['limit']||null:null,'include':_0x546213[_0x58cf('0x19')]?_0x546213[_0x58cf('0x19')][_0x58cf('0x1c')]?_[_0x58cf('0x1d')](_0x546213['options'][_0x58cf('0x1c')],function(_0x447ec0){return{'model':db[_0x447ec0[_0x58cf('0x1e')]],'as':_0x447ec0['as'],'attributes':_0x447ec0[_0x58cf('0x1b')],'include':_0x447ec0[_0x58cf('0x1c')]?_[_0x58cf('0x1d')](_0x447ec0[_0x58cf('0x1c')],function(_0x272a1e){return{'model':db[_0x272a1e['model']],'as':_0x272a1e['as'],'attributes':_0x272a1e[_0x58cf('0x1b')],'include':_0x272a1e[_0x58cf('0x1c')]?_['map'](_0x272a1e['include'],function(_0x427505){return{'model':db[_0x427505[_0x58cf('0x1e')]],'as':_0x427505['as'],'attributes':_0x427505[_0x58cf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x267d90){logger['info'](_0x58cf('0x17'),_0x546213);logger[_0x58cf('0xe')](_0x58cf('0x17'),_0x546213,JSON[_0x58cf('0x1f')](_0x267d90));_0x12c95(_0x267d90);})[_0x58cf('0x16')](function(_0x763d25){logger[_0x58cf('0x11')](_0x58cf('0x17'),_0x763d25[_0x58cf('0x14')],_0x546213);_0x146bd6(_0x15ed20[_0x58cf('0x11')](0x1f4,_0x763d25[_0x58cf('0x14')]));});});};exports[_0x58cf('0x20')]=function(_0x5b087c){var _0x2bc135=this;return new Promise(function(_0x2e13c8,_0x393a86){return db['Trunk'][_0x58cf('0x21')]({'raw':_0x5b087c[_0x58cf('0x19')]?_0x5b087c[_0x58cf('0x19')][_0x58cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b087c[_0x58cf('0x19')]?_0x5b087c[_0x58cf('0x19')][_0x58cf('0x22')]||null:null,'attributes':_0x5b087c[_0x58cf('0x19')]?_0x5b087c['options'][_0x58cf('0x1b')]||null:null,'include':_0x5b087c['options']?_0x5b087c[_0x58cf('0x19')][_0x58cf('0x1c')]?_[_0x58cf('0x1d')](_0x5b087c[_0x58cf('0x19')][_0x58cf('0x1c')],function(_0x442f74){return{'model':db[_0x442f74[_0x58cf('0x1e')]],'as':_0x442f74['as'],'attributes':_0x442f74['attributes'],'include':_0x442f74['include']?_[_0x58cf('0x1d')](_0x442f74[_0x58cf('0x1c')],function(_0xeb0777){return{'model':db[_0xeb0777[_0x58cf('0x1e')]],'as':_0xeb0777['as'],'attributes':_0xeb0777[_0x58cf('0x1b')],'include':_0xeb0777[_0x58cf('0x1c')]?_['map'](_0xeb0777[_0x58cf('0x1c')],function(_0x3ef9be){return{'model':db[_0x3ef9be['model']],'as':_0x3ef9be['as'],'attributes':_0x3ef9be['attributes']};}):[]};}):[]};}):[]:[]})[_0x58cf('0x23')](function(_0x256fd7){logger[_0x58cf('0xd')](_0x58cf('0x20'),_0x5b087c);logger[_0x58cf('0xe')]('ShowTrunk',_0x5b087c,JSON[_0x58cf('0x1f')](_0x256fd7));_0x2e13c8(_0x256fd7);})['catch'](function(_0x4bb17a){logger[_0x58cf('0x11')](_0x58cf('0x20'),_0x4bb17a[_0x58cf('0x14')],_0x5b087c);_0x393a86(_0x2bc135['error'](0x1f4,_0x4bb17a[_0x58cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 4baa914..9f44064 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 _0xaa32=['isAuthenticated','exports','Router','./user-setting.controller','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa32,0x70));var _0x2aa3=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0xaa32[_0x420d8d];return _0x4865d7;};'use strict';var express=require('express');var router=express[_0x2aa3('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x2aa3('0x1'));router['put'](_0x2aa3('0x2'),auth[_0x2aa3('0x3')](),controller['update']);module[_0x2aa3('0x4')]=router; \ No newline at end of file +var _0xf73f=['./user-setting.controller','put','/:id','isAuthenticated','update','exports'];(function(_0x43fbe3,_0xaa6874){var _0x3d73fd=function(_0x278e89){while(--_0x278e89){_0x43fbe3['push'](_0x43fbe3['shift']());}};_0x3d73fd(++_0xaa6874);}(_0xf73f,0xc0));var _0xff73=function(_0x41b738,_0x5ad752){_0x41b738=_0x41b738-0x0;var _0x2be26f=_0xf73f[_0x41b738];return _0x2be26f;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xff73('0x0'));router[_0xff73('0x1')](_0xff73('0x2'),auth[_0xff73('0x3')](),controller[_0xff73('0x4')]);module[_0xff73('0x5')]=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 ee651fe..af6d3e6 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 _0x9b38=['info','error','TEXT','INTEGER','sequelize','warning'];(function(_0x451bed,_0x17621c){var _0x338f53=function(_0x48f04e){while(--_0x48f04e){_0x451bed['push'](_0x451bed['shift']());}};_0x338f53(++_0x17621c);}(_0x9b38,0x172));var _0x89b3=function(_0x3ce9cc,_0x50fb18){_0x3ce9cc=_0x3ce9cc-0x0;var _0x279201=_0x9b38[_0x3ce9cc];return _0x279201;};'use strict';var Sequelize=require(_0x89b3('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x89b3('0x1'),_0x89b3('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x89b3('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x89b3('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x89b3('0x5')],'unique':'UserId'}}; \ No newline at end of file +var _0x88eb=['BOOLEAN','TEXT','DATE','UserId','sequelize','warning','debug','ENUM','error'];(function(_0x40a1d6,_0x1dab7a){var _0x3dc7b0=function(_0xe1c8bf){while(--_0xe1c8bf){_0x40a1d6['push'](_0x40a1d6['shift']());}};_0x3dc7b0(++_0x1dab7a);}(_0x88eb,0x1f3));var _0xb88e=function(_0x2f59f1,_0x3c5f16){_0x2f59f1=_0x2f59f1-0x0;var _0x524ffc=_0x88eb[_0x2f59f1];return _0x524ffc;};'use strict';var Sequelize=require(_0xb88e('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb88e('0x1'),'info',_0xb88e('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb88e('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb88e('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb88e('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb88e('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb88e('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xb88e('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 f1a7f12..27d3156 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 _0xe13a=['api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','../../config/logger'];(function(_0x3e37d2,_0x30679e){var _0x247a83=function(_0x5bee50){while(--_0x5bee50){_0x3e37d2['push'](_0x3e37d2['shift']());}};_0x247a83(++_0x30679e);}(_0xe13a,0x178));var _0xae13=function(_0x19331d,_0x29bede){_0x19331d=_0x19331d-0x0;var _0xc3583c=_0xe13a[_0x19331d];return _0xc3583c;};'use strict';var _=require('lodash');var Redis=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var config=require(_0xae13('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xae13('0x4'))(new Redis(config[_0xae13('0x5')]));require(_0xae13('0x6'))[_0xae13('0x7')](socket);config[_0xae13('0x5')]=_[_0xae13('0x8')](config[_0xae13('0x5')],{'host':_0xae13('0x9'),'port':0x18eb});function respondWithResult(_0x341ba4,_0x4ae51f){_0x4ae51f=_0x4ae51f||0xc8;return function(_0x2f6d10){if(_0x2f6d10){return _0x341ba4[_0xae13('0xa')](_0x4ae51f)[_0xae13('0xb')](_0x2f6d10);}};}function saveUpdates(_0x2a793f){return function(_0x22027e){if(_0x22027e){return _0x22027e[_0xae13('0xc')](_0x2a793f)[_0xae13('0xd')](function(_0x2d1149){return _0x2d1149;});}return null;};}function handleEntityNotFound(_0x1f3451){return function(_0x5990e3){if(!_0x5990e3){_0x1f3451[_0xae13('0xe')](0x194);}return _0x5990e3;};}function handleError(_0x83de98,_0x3d6a85){_0x3d6a85=_0x3d6a85||0x1f4;return function(_0x3a6d41){logger[_0xae13('0xf')](_0x3a6d41[_0xae13('0x10')]);if(_0x3a6d41[_0xae13('0x11')]){delete _0x3a6d41['name'];}_0x83de98[_0xae13('0xa')](_0x3d6a85)[_0xae13('0x12')](_0x3a6d41);};}exports['update']=function(_0x589803,_0x506411){if(_0x589803['user']['role']!==_0xae13('0x13'))throw new Error(_0xae13('0x14'));if(isNaN(Number(_0x589803[_0xae13('0x15')]['id'])))throw new Error(_0xae13('0x16'));return db[_0xae13('0x17')][_0xae13('0x18')]({'where':{'id':_0x589803['params']['id']}})[_0xae13('0xd')](handleEntityNotFound(_0x506411,null))['then'](saveUpdates(_0x589803[_0xae13('0x19')],null))[_0xae13('0xd')](respondWithResult(_0x506411,null))[_0xae13('0x1a')](handleError(_0x506411,null));}; \ No newline at end of file +var _0x5c12=['role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','then','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','sendStatus','error','name','send'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x5c12,0x188));var _0x25c1=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x5c12[_0x556927];return _0x5f1235;};'use strict';var _=require('lodash');var Redis=require(_0x25c1('0x0'));var logger=require(_0x25c1('0x1'))('api');var config=require(_0x25c1('0x2'));var db=require(_0x25c1('0x3'))['db'];var socket=require(_0x25c1('0x4'))(new Redis(config[_0x25c1('0x5')]));require(_0x25c1('0x6'))[_0x25c1('0x7')](socket);config[_0x25c1('0x5')]=_['defaults'](config[_0x25c1('0x5')],{'host':_0x25c1('0x8'),'port':0x18eb});function respondWithResult(_0x382922,_0x4ab674){_0x4ab674=_0x4ab674||0xc8;return function(_0x5c69b1){if(_0x5c69b1){return _0x382922[_0x25c1('0x9')](_0x4ab674)[_0x25c1('0xa')](_0x5c69b1);}};}function saveUpdates(_0x449014){return function(_0x22a7b0){if(_0x22a7b0){return _0x22a7b0[_0x25c1('0xb')](_0x449014)['then'](function(_0x3e062e){return _0x3e062e;});}return null;};}function handleEntityNotFound(_0x41c89d){return function(_0x11a223){if(!_0x11a223){_0x41c89d[_0x25c1('0xc')](0x194);}return _0x11a223;};}function handleError(_0x2872b2,_0x5e44e2){_0x5e44e2=_0x5e44e2||0x1f4;return function(_0x196e2f){logger[_0x25c1('0xd')](_0x196e2f['stack']);if(_0x196e2f[_0x25c1('0xe')]){delete _0x196e2f[_0x25c1('0xe')];}_0x2872b2[_0x25c1('0x9')](_0x5e44e2)[_0x25c1('0xf')](_0x196e2f);};}exports['update']=function(_0x569ef9,_0x4ef5d7){if(_0x569ef9['user'][_0x25c1('0x10')]!==_0x25c1('0x11'))throw new Error(_0x25c1('0x12'));if(isNaN(Number(_0x569ef9[_0x25c1('0x13')]['id'])))throw new Error(_0x25c1('0x14'));return db['UserSetting'][_0x25c1('0x15')]({'where':{'id':_0x569ef9['params']['id']}})['then'](handleEntityNotFound(_0x4ef5d7,null))['then'](saveUpdates(_0x569ef9[_0x25c1('0x16')],null))[_0x25c1('0x17')](respondWithResult(_0x4ef5d7,null))['catch'](handleError(_0x4ef5d7,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 cae3486..8f90da8 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 _0x2a01=['remove','emit','hasOwnProperty','hook','exports','events','UserSetting','setMaxListeners','save','update'];(function(_0x341be4,_0x11ccb1){var _0x5570e4=function(_0x2d6552){while(--_0x2d6552){_0x341be4['push'](_0x341be4['shift']());}};_0x5570e4(++_0x11ccb1);}(_0x2a01,0x113));var _0x12a0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x2a01[_0x1928c9];return _0x51b5fb;};'use strict';var EventEmitter=require(_0x12a0('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x12a0('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x12a0('0x2')](0x0);var events={'afterCreate':_0x12a0('0x3'),'afterUpdate':_0x12a0('0x4'),'afterDestroy':_0x12a0('0x5')};function emitEvent(_0x3fb0df){return function(_0x17ca2b,_0x50be3c,_0x58c599){UserSettingEvents[_0x12a0('0x6')](_0x3fb0df+':'+_0x17ca2b['id'],_0x17ca2b);UserSettingEvents[_0x12a0('0x6')](_0x3fb0df,_0x17ca2b);_0x58c599(null);};}for(var e in events){if(events[_0x12a0('0x7')](e)){var event=events[e];UserSetting[_0x12a0('0x8')](e,emitEvent(event));}}module[_0x12a0('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x35a0=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x35a0,0x1d0));var _0x035a=function(_0xa232b6,_0x4e0e3e){_0xa232b6=_0xa232b6-0x0;var _0x9c47aa=_0x35a0[_0xa232b6];return _0x9c47aa;};'use strict';var EventEmitter=require(_0x035a('0x0'));var UserSetting=require(_0x035a('0x1'))['db'][_0x035a('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x035a('0x3')](0x0);var events={'afterCreate':_0x035a('0x4'),'afterUpdate':_0x035a('0x5'),'afterDestroy':_0x035a('0x6')};function emitEvent(_0x17e3a8){return function(_0x149689,_0x2816fa,_0x3316f4){UserSettingEvents[_0x035a('0x7')](_0x17e3a8+':'+_0x149689['id'],_0x149689);UserSettingEvents[_0x035a('0x7')](_0x17e3a8,_0x149689);_0x3316f4(null);};}for(var e in events){if(events[_0x035a('0x8')](e)){var event=events[e];UserSetting[_0x035a('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 923587d..ee074c2 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 _0x9e6b=['exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4a6d6f,_0x275f37){var _0x71e7e5=function(_0x709a29){while(--_0x709a29){_0x4a6d6f['push'](_0x4a6d6f['shift']());}};_0x71e7e5(++_0x275f37);}(_0x9e6b,0x11c));var _0xb9e6=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9e6b[_0xfae23b];return _0x200640;};'use strict';var attributes=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]=function(_0x5373ce){return _0x5373ce[_0xb9e6('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33d064){if(!_0x33d064[_0xb9e6('0x3')])_0x33d064[_0xb9e6('0x4')]=null;else if(_0x33d064[_0xb9e6('0x4')]===null)_0x33d064['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x6cb4=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0xec9824,_0x33bd9d){var _0x126344=function(_0x2a6ded){while(--_0x2a6ded){_0xec9824['push'](_0xec9824['shift']());}};_0x126344(++_0x33bd9d);}(_0x6cb4,0xff));var _0x46cb=function(_0x15427c,_0x33bb28){_0x15427c=_0x15427c-0x0;var _0x40ae38=_0x6cb4[_0x15427c];return _0x40ae38;};'use strict';var attributes=require(_0x46cb('0x0'));module[_0x46cb('0x1')]=function(_0x205a8d){return _0x205a8d[_0x46cb('0x2')](_0x46cb('0x3'),attributes,{'tableName':_0x46cb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b8d70){if(!_0x2b8d70[_0x46cb('0x5')])_0x2b8d70[_0x46cb('0x6')]=null;else if(_0x2b8d70['clientSideLoggingEnabledSince']===null)_0x2b8d70[_0x46cb('0x6')]=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 ccfd82d..0ebb047 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 _0x5f89=['user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','emit'];(function(_0x468ad2,_0xc897f2){var _0x1e5289=function(_0x17a4f1){while(--_0x17a4f1){_0x468ad2['push'](_0x468ad2['shift']());}};_0x1e5289(++_0xc897f2);}(_0x5f89,0x7e));var _0x95f8=function(_0x141a50,_0x47c7d5){_0x141a50=_0x141a50-0x0;var _0x12a37f=_0x5f89[_0x141a50];return _0x12a37f;};'use strict';var UserSettingEvents=require(_0x95f8('0x0'));var events=[_0x95f8('0x1'),_0x95f8('0x2'),'update'];function createListener(_0xd4cdf3,_0x1ad9eb){return function(_0x535737){_0x1ad9eb[_0x95f8('0x3')](_0xd4cdf3,_0x535737);if(_0xd4cdf3===_0x95f8('0x4')){_0x1ad9eb[_0x95f8('0x3')](_0x95f8('0x5')+_0x535737[_0x95f8('0x6')],_0x535737);}};}exports[_0x95f8('0x7')]=function(_0x5c909a){for(var _0x193bdc=0x0,_0x37a5a6=events[_0x95f8('0x8')];_0x193bdc<_0x37a5a6;_0x193bdc++){var _0x5e7bed=events[_0x193bdc];var _0x443e96=createListener(_0x95f8('0x9')+_0x5e7bed,_0x5c909a);UserSettingEvents['on'](_0x5e7bed,_0x443e96);}}; \ No newline at end of file +var _0xcd78=['length','user-setting:','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd78,0x152));var _0x8cd7=function(_0x41ee1f,_0x31ea45){_0x41ee1f=_0x41ee1f-0x0;var _0x44a42f=_0xcd78[_0x41ee1f];return _0x44a42f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove',_0x8cd7('0x0')];function createListener(_0x3422d9,_0x357a1f){return function(_0x1df6b3){_0x357a1f[_0x8cd7('0x1')](_0x3422d9,_0x1df6b3);if(_0x3422d9===_0x8cd7('0x2')){_0x357a1f[_0x8cd7('0x1')](_0x8cd7('0x3')+_0x1df6b3[_0x8cd7('0x4')],_0x1df6b3);}};}exports[_0x8cd7('0x5')]=function(_0x59e6b1){for(var _0x1a08a5=0x0,_0x220843=events[_0x8cd7('0x6')];_0x1a08a5<_0x220843;_0x1a08a5++){var _0x1742c4=events[_0x1a08a5];var _0x48fbab=createListener(_0x8cd7('0x7')+_0x1742c4,_0x59e6b1);UserSettingEvents['on'](_0x1742c4,_0x48fbab);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 95c9555..5dcbcef 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 _0x4889=['whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','put','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./user.controller','isAuthenticated','index','get'];(function(_0x52660b,_0xbdd628){var _0x24eac6=function(_0x2a0eca){while(--_0x2a0eca){_0x52660b['push'](_0x52660b['shift']());}};_0x24eac6(++_0xbdd628);}(_0x4889,0x69));var _0x9488=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0x4889[_0x491faa];return _0x414440;};'use strict';var multer=require(_0x9488('0x0'));var util=require(_0x9488('0x1'));var path=require('path');var timeout=require(_0x9488('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9488('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9488('0x4'));var config=require('../../config/environment');var controller=require(_0x9488('0x5'));router['get']('/',auth[_0x9488('0x6')](),controller[_0x9488('0x7')]);router[_0x9488('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9488('0x8')]('/whoami',auth['isAuthenticated'](),controller[_0x9488('0x9')]);router[_0x9488('0x8')](_0x9488('0xa'),auth[_0x9488('0x6')](),controller[_0x9488('0xb')]);router[_0x9488('0x8')](_0x9488('0xc'),auth[_0x9488('0x6')](),controller[_0x9488('0xd')]);router[_0x9488('0x8')](_0x9488('0xe'),controller['getAvatar']);router[_0x9488('0x8')](_0x9488('0xf'),auth[_0x9488('0x6')](),controller[_0x9488('0x10')]);router[_0x9488('0x8')](_0x9488('0x11'),auth[_0x9488('0x6')](),controller[_0x9488('0x12')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x9488('0x13')]);router[_0x9488('0x8')]('/:id/queues_rt',auth[_0x9488('0x6')](),controller[_0x9488('0x14')]);router[_0x9488('0x8')](_0x9488('0x15'),auth[_0x9488('0x6')](),controller[_0x9488('0x16')]);router[_0x9488('0x8')](_0x9488('0x17'),auth[_0x9488('0x6')](),controller[_0x9488('0x18')]);router[_0x9488('0x8')](_0x9488('0x19'),auth['isAuthenticated'](),controller[_0x9488('0x1a')]);router['get']('/:id/chat/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x1b')]);router[_0x9488('0x8')](_0x9488('0x1c'),auth[_0x9488('0x6')](),controller[_0x9488('0x1d')]);router['get'](_0x9488('0x1e'),auth['isAuthenticated'](),controller[_0x9488('0x1f')]);router[_0x9488('0x8')]('/:id/sms/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x20')]);router[_0x9488('0x8')]('/:id/fax/interactions',auth[_0x9488('0x6')](),controller['getFaxInteractions']);router[_0x9488('0x8')]('/:id/whatsapp/interactions',auth[_0x9488('0x6')](),controller[_0x9488('0x21')]);router[_0x9488('0x8')]('/:id/teams',auth[_0x9488('0x6')](),controller[_0x9488('0x22')]);router['get'](_0x9488('0x23'),auth['isAuthenticated'](),controller[_0x9488('0x24')]);router['get'](_0x9488('0x25'),auth[_0x9488('0x6')](),controller[_0x9488('0x26')]);router[_0x9488('0x8')](_0x9488('0x27'),auth[_0x9488('0x6')](),controller[_0x9488('0x28')]);router[_0x9488('0x8')](_0x9488('0x29'),auth['isAuthenticated'](),controller[_0x9488('0x2a')]);router[_0x9488('0x8')]('/:id/mail_accounts',auth[_0x9488('0x6')](),controller[_0x9488('0x2b')]);router['get'](_0x9488('0x2c'),auth[_0x9488('0x6')](),controller[_0x9488('0x2d')]);router[_0x9488('0x8')](_0x9488('0x2e'),auth[_0x9488('0x6')](),controller['getSmsAccounts']);router[_0x9488('0x8')]('/:id/chat_websites',auth[_0x9488('0x6')](),controller[_0x9488('0x2f')]);router[_0x9488('0x8')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x31')]);router['get'](_0x9488('0x32'),auth[_0x9488('0x6')](),controller['getScheduledCalls']);router['get'](_0x9488('0x33'),auth[_0x9488('0x6')](),controller[_0x9488('0x34')]);router[_0x9488('0x35')](_0x9488('0x11'),auth[_0x9488('0x6')](),controller[_0x9488('0x36')]);router[_0x9488('0x35')]('/',auth[_0x9488('0x6')](),controller[_0x9488('0x37')]);router['post'](_0x9488('0x38'),auth[_0x9488('0x6')](),controller[_0x9488('0x39')]);router[_0x9488('0x35')](_0x9488('0x3a'),auth[_0x9488('0x6')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9488('0x3b')]({'destination':function(_0x407e57,_0x13467e,_0x3199c5){_0x3199c5(null,path['join'](config['root'],_0x9488('0x3c')));},'filename':function(_0x4cb536,_0xdbaee1,_0x3488a1){_0x3488a1(null,util[_0x9488('0x3d')](_0x9488('0x3e'),Date[_0x9488('0x3f')](),_0xdbaee1[_0x9488('0x40')]));}})});router[_0x9488('0x35')](_0x9488('0xe'),upload[_0x9488('0x41')](_0x9488('0x42')),controller[_0x9488('0x43')]);router['post'](_0x9488('0x44'),auth[_0x9488('0x6')](),controller[_0x9488('0x45')]);router[_0x9488('0x35')]('/:id/logout',auth[_0x9488('0x6')](),controller[_0x9488('0x46')]);router[_0x9488('0x35')](_0x9488('0x47'),auth[_0x9488('0x6')](),controller[_0x9488('0x48')]);router[_0x9488('0x35')](_0x9488('0x49'),auth[_0x9488('0x6')](),controller['unpause']);router[_0x9488('0x35')](_0x9488('0x4a'),auth[_0x9488('0x6')](),controller[_0x9488('0x4b')]);router[_0x9488('0x35')](_0x9488('0x4c'),auth['isAuthenticated'](),controller[_0x9488('0x4d')]);router[_0x9488('0x35')](_0x9488('0x4e'),auth[_0x9488('0x6')](),controller[_0x9488('0x4f')]);router['post'](_0x9488('0x50'),auth[_0x9488('0x6')](),controller[_0x9488('0x51')]);router[_0x9488('0x35')](_0x9488('0x52'),auth[_0x9488('0x6')](),controller[_0x9488('0x53')]);router['post'](_0x9488('0x54'),auth[_0x9488('0x6')](),controller[_0x9488('0x55')]);router[_0x9488('0x35')](_0x9488('0x56'),auth[_0x9488('0x6')](),controller['addWhatsappInteractions']);router['post'](_0x9488('0x29'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x9488('0x35')]('/:id/mail_accounts',auth[_0x9488('0x6')](),controller[_0x9488('0x57')]);router[_0x9488('0x35')](_0x9488('0x2c'),auth[_0x9488('0x6')](),controller[_0x9488('0x58')]);router[_0x9488('0x35')](_0x9488('0x2e'),auth[_0x9488('0x6')](),controller[_0x9488('0x59')]);router[_0x9488('0x35')](_0x9488('0x5a'),auth[_0x9488('0x6')](),controller['addChatWebsites']);router[_0x9488('0x35')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x5b')]);router[_0x9488('0x35')](_0x9488('0x33'),auth[_0x9488('0x6')](),controller['createApiKey']);router[_0x9488('0x5c')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9488('0x5c')](_0x9488('0x5d'),auth[_0x9488('0x6')](),controller[_0x9488('0x5e')]);router[_0x9488('0x5f')]('/:id/queues',auth[_0x9488('0x6')](),controller[_0x9488('0x60')]);router[_0x9488('0x5f')](_0x9488('0x4a'),auth[_0x9488('0x6')](),controller[_0x9488('0x61')]);router[_0x9488('0x5f')](_0x9488('0xc'),auth[_0x9488('0x6')](),controller['destroy']);router[_0x9488('0x5f')](_0x9488('0x4c'),auth['isAuthenticated'](),controller[_0x9488('0x62')]);router[_0x9488('0x5f')](_0x9488('0x4e'),auth[_0x9488('0x6')](),controller[_0x9488('0x63')]);router[_0x9488('0x5f')](_0x9488('0x50'),auth[_0x9488('0x6')](),controller['removeFaxInteractions']);router[_0x9488('0x5f')](_0x9488('0x52'),auth[_0x9488('0x6')](),controller[_0x9488('0x64')]);router[_0x9488('0x5f')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x9488('0x65')]);router[_0x9488('0x5f')](_0x9488('0x56'),auth[_0x9488('0x6')](),controller[_0x9488('0x66')]);router['delete'](_0x9488('0x29'),auth[_0x9488('0x6')](),controller[_0x9488('0x67')]);router[_0x9488('0x5f')](_0x9488('0x68'),auth[_0x9488('0x6')](),controller[_0x9488('0x69')]);router[_0x9488('0x5f')](_0x9488('0x2c'),auth['isAuthenticated'](),controller[_0x9488('0x6a')]);router[_0x9488('0x5f')](_0x9488('0x2e'),auth['isAuthenticated'](),controller[_0x9488('0x6b')]);router['delete'](_0x9488('0x5a'),auth[_0x9488('0x6')](),controller[_0x9488('0x6c')]);router[_0x9488('0x5f')](_0x9488('0x30'),auth[_0x9488('0x6')](),controller[_0x9488('0x6d')]);router['delete'](_0x9488('0x33'),auth[_0x9488('0x6')](),controller[_0x9488('0x6e')]);router[_0x9488('0x35')](_0x9488('0x6f'),auth[_0x9488('0x6')](),controller[_0x9488('0x70')]);module[_0x9488('0x71')]=router; \ No newline at end of file +var _0x8813=['getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','messengerSoundNotification','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','/describe','isAuthenticated','describe','get','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt'];(function(_0x585234,_0x3ae470){var _0x28b8a7=function(_0x9081e1){while(--_0x9081e1){_0x585234['push'](_0x585234['shift']());}};_0x28b8a7(++_0x3ae470);}(_0x8813,0xd3));var _0x3881=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8813[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3881('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3881('0x1'));var express=require(_0x3881('0x2'));var router=express[_0x3881('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3881('0x4'));var interaction=require(_0x3881('0x5'));var config=require(_0x3881('0x6'));var controller=require(_0x3881('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3881('0x8'),auth[_0x3881('0x9')](),controller[_0x3881('0xa')]);router[_0x3881('0xb')]('/whoami',auth[_0x3881('0x9')](),controller[_0x3881('0xc')]);router[_0x3881('0xb')](_0x3881('0xd'),auth[_0x3881('0x9')](),controller[_0x3881('0xe')]);router[_0x3881('0xb')](_0x3881('0xf'),auth[_0x3881('0x9')](),controller[_0x3881('0x10')]);router[_0x3881('0xb')]('/:id/avatar',controller[_0x3881('0x11')]);router[_0x3881('0xb')]('/:id/open_tabs',auth[_0x3881('0x9')](),controller[_0x3881('0x12')]);router['get']('/:id/contacts',auth[_0x3881('0x9')](),controller[_0x3881('0x13')]);router[_0x3881('0xb')](_0x3881('0x14'),auth['isAuthenticated'](),controller[_0x3881('0x15')]);router[_0x3881('0xb')](_0x3881('0x16'),auth['isAuthenticated'](),controller[_0x3881('0x17')]);router[_0x3881('0xb')]('/:id/groups',auth[_0x3881('0x9')](),controller[_0x3881('0x18')]);router['get'](_0x3881('0x19'),auth['isAuthenticated'](),controller[_0x3881('0x1a')]);router[_0x3881('0xb')](_0x3881('0x1b'),auth[_0x3881('0x9')](),controller[_0x3881('0x1c')]);router['get'](_0x3881('0x1d'),auth['isAuthenticated'](),controller[_0x3881('0x1e')]);router[_0x3881('0xb')]('/:id/openchannel/interactions',auth[_0x3881('0x9')](),controller[_0x3881('0x1f')]);router[_0x3881('0xb')]('/:id/mail/interactions',auth[_0x3881('0x9')](),controller[_0x3881('0x20')]);router[_0x3881('0xb')](_0x3881('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x3881('0xb')](_0x3881('0x22'),auth[_0x3881('0x9')](),controller[_0x3881('0x23')]);router[_0x3881('0xb')]('/:id/whatsapp/interactions',auth[_0x3881('0x9')](),controller[_0x3881('0x24')]);router[_0x3881('0xb')](_0x3881('0x25'),auth[_0x3881('0x9')](),controller[_0x3881('0x26')]);router[_0x3881('0xb')]('/:id/lists',auth[_0x3881('0x9')](),controller['getLists']);router[_0x3881('0xb')](_0x3881('0x27'),auth[_0x3881('0x9')](),controller['getAgents']);router[_0x3881('0xb')](_0x3881('0x28'),auth[_0x3881('0x9')](),controller[_0x3881('0x29')]);router[_0x3881('0xb')]('/:id/fax_accounts',auth[_0x3881('0x9')](),controller[_0x3881('0x2a')]);router[_0x3881('0xb')](_0x3881('0x2b'),auth[_0x3881('0x9')](),controller[_0x3881('0x2c')]);router[_0x3881('0xb')](_0x3881('0x2d'),auth[_0x3881('0x9')](),controller[_0x3881('0x2e')]);router[_0x3881('0xb')](_0x3881('0x2f'),auth[_0x3881('0x9')](),controller['getSmsAccounts']);router['get'](_0x3881('0x30'),auth[_0x3881('0x9')](),controller[_0x3881('0x31')]);router['get'](_0x3881('0x32'),auth['isAuthenticated'](),controller[_0x3881('0x33')]);router[_0x3881('0xb')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x3881('0x34')]);router[_0x3881('0xb')]('/:id/api_key',auth[_0x3881('0x9')](),controller[_0x3881('0x35')]);router[_0x3881('0x36')](_0x3881('0x37'),auth['isAuthenticated'](),controller[_0x3881('0x38')]);router['post']('/',auth[_0x3881('0x9')](),controller[_0x3881('0x39')]);router['post'](_0x3881('0x3a'),auth[_0x3881('0x9')](),controller[_0x3881('0x3b')]);router[_0x3881('0x36')](_0x3881('0x14'),auth['isAuthenticated'](),controller[_0x3881('0x3c')]);var upload=multer({'storage':multer[_0x3881('0x3d')]({'destination':function(_0x1b1e41,_0x3b390a,_0x37050f){_0x37050f(null,path[_0x3881('0x3e')](config[_0x3881('0x3f')],_0x3881('0x40')));},'filename':function(_0x24d177,_0x47f837,_0x565b92){_0x565b92(null,util[_0x3881('0x41')](_0x3881('0x42'),Date[_0x3881('0x43')](),_0x47f837[_0x3881('0x44')]));}})});router['post'](_0x3881('0x45'),upload[_0x3881('0x46')](_0x3881('0x47')),controller[_0x3881('0x48')]);router['post'](_0x3881('0x49'),auth['isAuthenticated'](),controller[_0x3881('0x4a')]);router['post'](_0x3881('0x4b'),auth[_0x3881('0x9')](),controller[_0x3881('0x4c')]);router[_0x3881('0x36')]('/:id/pause',auth['isAuthenticated'](),controller[_0x3881('0x4d')]);router[_0x3881('0x36')]('/:id/unpause',auth['isAuthenticated'](),controller[_0x3881('0x4e')]);router['post'](_0x3881('0x25'),auth[_0x3881('0x9')](),controller[_0x3881('0x4f')]);router[_0x3881('0x36')]('/:id/chat_interactions',auth[_0x3881('0x9')](),controller['addChatInteractions']);router[_0x3881('0x36')](_0x3881('0x50'),auth[_0x3881('0x9')](),controller[_0x3881('0x51')]);router[_0x3881('0x36')]('/:id/fax_interactions',auth[_0x3881('0x9')](),controller['addFaxInteractions']);router['post'](_0x3881('0x52'),auth[_0x3881('0x9')](),controller[_0x3881('0x53')]);router[_0x3881('0x36')](_0x3881('0x54'),auth['isAuthenticated'](),controller[_0x3881('0x55')]);router[_0x3881('0x36')]('/:id/whatsapp_interactions',auth[_0x3881('0x9')](),controller[_0x3881('0x56')]);router['post'](_0x3881('0x57'),auth[_0x3881('0x9')](),controller[_0x3881('0x58')]);router[_0x3881('0x36')](_0x3881('0x2b'),auth[_0x3881('0x9')](),controller[_0x3881('0x59')]);router[_0x3881('0x36')](_0x3881('0x2d'),auth[_0x3881('0x9')](),controller[_0x3881('0x5a')]);router[_0x3881('0x36')]('/:id/sms_accounts',auth[_0x3881('0x9')](),controller[_0x3881('0x5b')]);router['post'](_0x3881('0x30'),auth[_0x3881('0x9')](),controller[_0x3881('0x5c')]);router[_0x3881('0x36')](_0x3881('0x32'),auth['isAuthenticated'](),controller[_0x3881('0x5d')]);router[_0x3881('0x36')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x3881('0x5e')]);router[_0x3881('0x5f')](_0x3881('0xf'),auth[_0x3881('0x9')](),controller['update']);router[_0x3881('0x5f')]('/:id/password',auth[_0x3881('0x9')](),controller[_0x3881('0x60')]);router[_0x3881('0x61')](_0x3881('0x14'),auth[_0x3881('0x9')](),controller[_0x3881('0x62')]);router['delete']('/:id/teams',auth[_0x3881('0x9')](),controller[_0x3881('0x63')]);router['delete'](_0x3881('0xf'),auth['isAuthenticated'](),controller[_0x3881('0x64')]);router[_0x3881('0x61')](_0x3881('0x65'),auth['isAuthenticated'](),controller[_0x3881('0x66')]);router[_0x3881('0x61')]('/:id/mail_interactions',auth[_0x3881('0x9')](),controller['removeMailInteractions']);router[_0x3881('0x61')](_0x3881('0x67'),auth[_0x3881('0x9')](),controller[_0x3881('0x68')]);router[_0x3881('0x61')](_0x3881('0x52'),auth['isAuthenticated'](),controller[_0x3881('0x69')]);router['delete'](_0x3881('0x54'),auth['isAuthenticated'](),controller[_0x3881('0x6a')]);router[_0x3881('0x61')](_0x3881('0x6b'),auth[_0x3881('0x9')](),controller[_0x3881('0x6c')]);router[_0x3881('0x61')](_0x3881('0x57'),auth[_0x3881('0x9')](),controller[_0x3881('0x6d')]);router[_0x3881('0x61')](_0x3881('0x2b'),auth[_0x3881('0x9')](),controller['removeMailAccounts']);router[_0x3881('0x61')](_0x3881('0x2d'),auth[_0x3881('0x9')](),controller[_0x3881('0x6e')]);router[_0x3881('0x61')](_0x3881('0x2f'),auth[_0x3881('0x9')](),controller['removeSmsAccounts']);router[_0x3881('0x61')](_0x3881('0x30'),auth['isAuthenticated'](),controller[_0x3881('0x6f')]);router['delete'](_0x3881('0x32'),auth['isAuthenticated'](),controller[_0x3881('0x70')]);router[_0x3881('0x61')](_0x3881('0x71'),auth[_0x3881('0x9')](),controller[_0x3881('0x72')]);router[_0x3881('0x36')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x3881('0x73')]);module[_0x3881('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8d7cd64..34beabe 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 _0x9b50=['always','accept','uas','fingerprint','certificate','active','actpass','update','TEXT','get','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','STRING','name','setDataValue','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>'];(function(_0xd8d422,_0x2a29cb){var _0x554af6=function(_0x4f5385){while(--_0x4f5385){_0xd8d422['push'](_0xd8d422['shift']());}};_0x554af6(++_0x2a29cb);}(_0x9b50,0x78));var _0x09b5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9b50[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x09b5('0x0'));var moment=require('moment');var util=require(_0x09b5('0x1'));var _=require(_0x09b5('0x2'));module['exports']={'name':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'unique':_0x09b5('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x11b218){this[_0x09b5('0x5')](_0x09b5('0x4'),_0x11b218);this[_0x09b5('0x5')]('defaultuser',_0x11b218);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'set':function(_0x119826){this[_0x09b5('0x5')]('fullname',_0x119826);this[_0x09b5('0x5')](_0x09b5('0x6'),util[_0x09b5('0x7')](_0x09b5('0x8'),_0x119826,this[_0x09b5('0x9')](_0x09b5('0xa'))));}},'alias':{'type':Sequelize[_0x09b5('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x09b5('0xb'),'validate':{'isEmail':!![]},'set':function(_0x81dd32){if(_0x81dd32){this[_0x09b5('0x5')]('email',_0x81dd32[_0x09b5('0xc')]());}}},'role':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0xe'),_0x09b5('0xf'),_0x09b5('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x09b5('0x11')},'internal':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':![],'unique':_0x09b5('0xa'),'set':function(_0x4bb2b9){this['setDataValue'](_0x09b5('0xa'),_0x4bb2b9);this[_0x09b5('0x5')]('accountcode',_0x4bb2b9);this[_0x09b5('0x5')](_0x09b5('0x6'),util[_0x09b5('0x7')](_0x09b5('0x8'),this[_0x09b5('0x9')](_0x09b5('0x13')),_0x4bb2b9));}},'salt':{'type':Sequelize[_0x09b5('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x09b5('0x3')]},'address':{'type':Sequelize[_0x09b5('0x3')]},'zipcode':{'type':Sequelize[_0x09b5('0x3')]},'userpic':{'type':Sequelize[_0x09b5('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x09b5('0x3')]},'online':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x09b5('0x15')]},'voicePause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':_0x09b5('0x16')},'lastPauseAt':{'type':Sequelize[_0x09b5('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x09b5('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x09b5('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09b5('0x17')},'ipaddr':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x09b5('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x18'),_0x09b5('0xf'),_0x09b5('0x19')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x1a'),_0x09b5('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x09b5('0x1c'),_0x09b5('0x1d'),_0x09b5('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':_0x09b5('0x1f'),'set':function(_0x3d3615){this[_0x09b5('0x5')](_0x09b5('0x20'),_0x3d3615?_0x3d3615[_0x09b5('0x21')](','):null);},'get':function(){return this[_0x09b5('0x9')](_0x09b5('0x20'))?this[_0x09b5('0x9')]('transport')[_0x09b5('0x22')](','):null;},'comment':_0x09b5('0x23')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x09b5('0x24'),_0x09b5('0x25'),_0x09b5('0x26'),_0x09b5('0x27')),'allowNull':!![],'defaultValue':_0x09b5('0x28')},'directmedia':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no',_0x09b5('0x2a'),'update',_0x09b5('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![],'defaultValue':_0x09b5('0x2c'),'set':function(_0x39b0fc){this['setDataValue'](_0x09b5('0x2d'),_0x39b0fc?_0x39b0fc[_0x09b5('0x21')](','):null);},'get':function(){return this[_0x09b5('0x9')]('nat')?this[_0x09b5('0x9')](_0x09b5('0x2d'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x09b5('0x3')]},'namedcallgroup':{'type':Sequelize[_0x09b5('0x3')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x09b5('0x3')]},'language':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x09b5('0x3')]},'disallow':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'defaultValue':_0x09b5('0x2e')},'allow':{'type':Sequelize[_0x09b5('0x3')],'allowNull':![],'defaultValue':_0x09b5('0x2f'),'set':function(_0xfc7927){this[_0x09b5('0x5')](_0x09b5('0x30'),_0xfc7927?_0xfc7927[_0x09b5('0x21')](';'):_0x09b5('0x2f'));},'get':function(){return this[_0x09b5('0x9')](_0x09b5('0x30'))?this['getDataValue'](_0x09b5('0x30'))[_0x09b5('0x22')](';'):null;},'comment':_0x09b5('0x31')},'autoframing':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x135708){this[_0x09b5('0x5')](_0x09b5('0x32'),_0x135708?_0x135708['join'](','):null);},'get':function(){return this[_0x09b5('0x9')]('insecure')?this[_0x09b5('0x9')](_0x09b5('0x32'))['split'](','):null;},'comment':_0x09b5('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x09b5('0xd')]('yes','no',_0x09b5('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x09b5('0x35')},'amaflags':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x09b5('0x29')},'busylevel':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no',_0x09b5('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x09b5('0x37'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x09b5('0xd')]('uac',_0x09b5('0x38')),'allowNull':!![],'defaultValue':_0x09b5('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no',_0x09b5('0x39'),_0x09b5('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x09b5('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x3b'),'passive',_0x09b5('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x09b5('0xd')](_0x09b5('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x09b5('0x29'),'no',_0x09b5('0x2a'),_0x09b5('0x3d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x09b5('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x09b5('0x15')]},'passwordResetAt':{'type':Sequelize[_0x09b5('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x09b5('0x3e')]},'showWebBar':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0,'set':function(_0xf1e12d){this[_0x09b5('0x5')]('showWebBar',_0xf1e12d);var _0x3cabd2=this[_0x09b5('0x3f')]({'plain':!![]});switch(_0xf1e12d){case 0x0:case 0x1:var _0x21ad15=_0x3cabd2[_0x09b5('0x20')]?_['isArray'](_0x3cabd2[_0x09b5('0x20')])?_0x3cabd2[_0x09b5('0x20')][_0x09b5('0x21')]():_0x3cabd2[_0x09b5('0x20')]:'udp';if(_0x21ad15===_0x09b5('0x40')){_0x21ad15=_0x09b5('0x1f');}this['setDataValue'](_0x09b5('0x20'),_0x21ad15);this[_0x09b5('0x5')](_0x09b5('0x41'),'no');this[_0x09b5('0x5')](_0x09b5('0x42'),null);this[_0x09b5('0x5')](_0x09b5('0x43'),null);this[_0x09b5('0x5')](_0x09b5('0x44'),null);this[_0x09b5('0x5')](_0x09b5('0x45'),null);this['setDataValue'](_0x09b5('0x46'),null);this[_0x09b5('0x5')](_0x09b5('0x47'),null);this[_0x09b5('0x5')](_0x09b5('0x48'),null);this['setDataValue'](_0x09b5('0x49'),null);this['setDataValue'](_0x09b5('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x09b5('0x20'),_0x09b5('0x40'));this[_0x09b5('0x5')]('encryption','yes');this[_0x09b5('0x5')](_0x09b5('0x42'),_0x09b5('0x29'));this[_0x09b5('0x5')]('force_avp','yes');this[_0x09b5('0x5')](_0x09b5('0x44'),_0x09b5('0x29'));this[_0x09b5('0x5')](_0x09b5('0x45'),_0x09b5('0x29'));this[_0x09b5('0x5')]('dtlsverify','no');this[_0x09b5('0x5')](_0x09b5('0x47'),_0x09b5('0x3c'));this[_0x09b5('0x5')](_0x09b5('0x48'),_0x3cabd2[_0x09b5('0x48')]||_0x09b5('0x4b'));this[_0x09b5('0x5')](_0x09b5('0x49'),_0x3cabd2[_0x09b5('0x49')]||_0x09b5('0x4c'));this[_0x09b5('0x5')](_0x09b5('0x4a'),_0x09b5('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1f0a21){this['setDataValue'](_0x09b5('0x4d'),_0x1f0a21?_0x1f0a21[_0x09b5('0x21')](','):[]);},'get':function(){return this[_0x09b5('0x9')]('permissions')?_[_0x09b5('0x4e')](this[_0x09b5('0x9')](_0x09b5('0x4d'))[_0x09b5('0x22')](','),function(_0x4d9b78){return parseInt(_0x4d9b78,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x09b5('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x09b5('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x09b5('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x09b5('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x09b5('0x4f'))?this[_0x09b5('0x9')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x09b5('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![],'set':function(_0x4dfa6d){if(typeof _0x4dfa6d===_0x09b5('0x50')){var _0x178f27=_0x4dfa6d==='1'?!![]:_0x4dfa6d==='0'?![]:_0x4dfa6d==='true'?!![]:_0x4dfa6d===_0x09b5('0x51')?![]:![];this['setDataValue'](_0x09b5('0x52'),_0x178f27);}else{this[_0x09b5('0x5')](_0x09b5('0x52'),_0x4dfa6d);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x21cf62){this['setDataValue'](_0x09b5('0x53'),_0x21cf62);if(_0x21cf62===!![]){this['setDataValue'](_0x09b5('0x54'),moment());this['setDataValue'](_0x09b5('0x55'),0x0);}else{this[_0x09b5('0x5')](_0x09b5('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x09b5('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x09b5('0x12')](0x5)[_0x09b5('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x09b5('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x09b5('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0xab82=['lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','email','toLowerCase','admin','user','agent','telephone','INTEGER','internal','accountcode','format','\x22%s\x22\x20<%s>','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','passive','update,nonat','TEXT','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0xab82,0x10c));var _0x2ab8=function(_0x4586a6,_0x243d07){_0x4586a6=_0x4586a6-0x0;var _0x5b912b=_0xab82[_0x4586a6];return _0x5b912b;};'use strict';var Sequelize=require(_0x2ab8('0x0'));var moment=require('moment');var util=require(_0x2ab8('0x1'));var _=require(_0x2ab8('0x2'));module['exports']={'name':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':![],'unique':_0x2ab8('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x576fcd){this[_0x2ab8('0x5')]('name',_0x576fcd);this['setDataValue'](_0x2ab8('0x6'),_0x576fcd);},'comment':_0x2ab8('0x7')},'fullname':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':![],'set':function(_0x50c39f){this[_0x2ab8('0x5')](_0x2ab8('0x8'),_0x50c39f);this[_0x2ab8('0x5')]('callerid',util['format']('\x22%s\x22\x20<%s>',_0x50c39f,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x2ab8('0x3')]},'email':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':![],'unique':_0x2ab8('0x9'),'validate':{'isEmail':!![]},'set':function(_0x380d7a){if(_0x380d7a){this[_0x2ab8('0x5')]('email',_0x380d7a[_0x2ab8('0xa')]());}}},'role':{'type':Sequelize['ENUM'](_0x2ab8('0xb'),_0x2ab8('0xc'),_0x2ab8('0xd'),_0x2ab8('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2ab8('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':![],'unique':_0x2ab8('0x10'),'set':function(_0x415e1f){this[_0x2ab8('0x5')](_0x2ab8('0x10'),_0x415e1f);this[_0x2ab8('0x5')](_0x2ab8('0x11'),_0x415e1f);this['setDataValue']('callerid',util[_0x2ab8('0x12')](_0x2ab8('0x13'),this[_0x2ab8('0x14')](_0x2ab8('0x8')),_0x415e1f));}},'salt':{'type':Sequelize[_0x2ab8('0x3')]},'phone':{'type':Sequelize[_0x2ab8('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x2ab8('0x3')]},'zipcode':{'type':Sequelize[_0x2ab8('0x3')]},'userpic':{'type':Sequelize[_0x2ab8('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2ab8('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2ab8('0x15')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2ab8('0x3')],'defaultValue':_0x2ab8('0x17')},'lastPauseAt':{'type':Sequelize[_0x2ab8('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2ab8('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2ab8('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![],'defaultValue':_0x2ab8('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x2ab8('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x1a'),_0x2ab8('0xc'),_0x2ab8('0x1b')),'allowNull':!![],'defaultValue':_0x2ab8('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x1c'),_0x2ab8('0x1d'),_0x2ab8('0x1e'),_0x2ab8('0x1f'),_0x2ab8('0x20'),_0x2ab8('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![],'defaultValue':_0x2ab8('0x22'),'set':function(_0x41eeec){this[_0x2ab8('0x5')]('transport',_0x41eeec?_0x41eeec[_0x2ab8('0x23')](','):null);},'get':function(){return this[_0x2ab8('0x14')](_0x2ab8('0x24'))?this[_0x2ab8('0x14')](_0x2ab8('0x24'))[_0x2ab8('0x25')](','):null;},'comment':_0x2ab8('0x26')},'dtmfmode':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x27'),_0x2ab8('0x28'),_0x2ab8('0x29'),_0x2ab8('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0x2ab8('0x27')},'directmedia':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no',_0x2ab8('0x2c'),_0x2ab8('0x2d'),_0x2ab8('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4650c3){this[_0x2ab8('0x5')]('nat',_0x4650c3?_0x4650c3['join'](','):null);},'get':function(){return this['getDataValue'](_0x2ab8('0x2f'))?this[_0x2ab8('0x14')](_0x2ab8('0x2f'))['split'](','):null;},'comment':_0x2ab8('0x30')},'callgroup':{'type':Sequelize[_0x2ab8('0x3')]},'namedcallgroup':{'type':Sequelize[_0x2ab8('0x3')]},'pickupgroup':{'type':Sequelize[_0x2ab8('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x2ab8('0x3')]},'language':{'type':Sequelize[_0x2ab8('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2ab8('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3400d0){this[_0x2ab8('0x5')](_0x2ab8('0x31'),_0x3400d0?_0x3400d0[_0x2ab8('0x23')](';'):_0x2ab8('0x32'));},'get':function(){return this['getDataValue']('allow')?this[_0x2ab8('0x14')]('allow')[_0x2ab8('0x25')](';'):null;},'comment':_0x2ab8('0x33')},'autoframing':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![],'set':function(_0x3db171){this[_0x2ab8('0x5')](_0x2ab8('0x34'),_0x3db171?_0x3db171['join'](','):null);},'get':function(){return this[_0x2ab8('0x14')]('insecure')?this[_0x2ab8('0x14')](_0x2ab8('0x34'))[_0x2ab8('0x25')](','):null;},'comment':_0x2ab8('0x35')},'trustrpid':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no',_0x2ab8('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![],'defaultValue':_0x2ab8('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no',_0x2ab8('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2ab8('0x19')]('accept',_0x2ab8('0x39'),_0x2ab8('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x2ab8('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2ab8('0x19')]('yes','no'),'allowNull':!![],'defaultValue':_0x2ab8('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no','fingerprint',_0x2ab8('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2ab8('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2ab8('0x19')]('active',_0x2ab8('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2ab8('0x19')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2ab8('0x19')](_0x2ab8('0x2b'),'no',_0x2ab8('0x2c'),_0x2ab8('0x2d'),_0x2ab8('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2ab8('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2ab8('0x40')]},'showWebBar':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0,'set':function(_0x96cd8a){this[_0x2ab8('0x5')](_0x2ab8('0x41'),_0x96cd8a);var _0x1b0c53=this['get']({'plain':!![]});switch(_0x96cd8a){case 0x0:case 0x1:var _0x3cbb91=_0x1b0c53[_0x2ab8('0x24')]?_[_0x2ab8('0x42')](_0x1b0c53[_0x2ab8('0x24')])?_0x1b0c53[_0x2ab8('0x24')][_0x2ab8('0x23')]():_0x1b0c53[_0x2ab8('0x24')]:_0x2ab8('0x22');if(_0x3cbb91===_0x2ab8('0x43')){_0x3cbb91=_0x2ab8('0x22');}this[_0x2ab8('0x5')]('transport',_0x3cbb91);this[_0x2ab8('0x5')](_0x2ab8('0x44'),'no');this[_0x2ab8('0x5')](_0x2ab8('0x45'),null);this[_0x2ab8('0x5')](_0x2ab8('0x46'),null);this[_0x2ab8('0x5')](_0x2ab8('0x47'),null);this[_0x2ab8('0x5')](_0x2ab8('0x48'),null);this[_0x2ab8('0x5')](_0x2ab8('0x49'),null);this[_0x2ab8('0x5')](_0x2ab8('0x4a'),null);this[_0x2ab8('0x5')](_0x2ab8('0x4b'),null);this[_0x2ab8('0x5')]('dtlsprivatekey',null);this[_0x2ab8('0x5')](_0x2ab8('0x4c'),'no');break;case 0x2:this[_0x2ab8('0x5')](_0x2ab8('0x24'),_0x2ab8('0x43'));this[_0x2ab8('0x5')](_0x2ab8('0x44'),'yes');this['setDataValue']('avpf','yes');this[_0x2ab8('0x5')]('force_avp',_0x2ab8('0x2b'));this['setDataValue'](_0x2ab8('0x47'),_0x2ab8('0x2b'));this[_0x2ab8('0x5')](_0x2ab8('0x48'),'yes');this[_0x2ab8('0x5')]('dtlsverify','no');this['setDataValue']('dtlssetup','actpass');this[_0x2ab8('0x5')](_0x2ab8('0x4b'),_0x1b0c53[_0x2ab8('0x4b')]||_0x2ab8('0x4d'));this[_0x2ab8('0x5')](_0x2ab8('0x4e'),_0x1b0c53[_0x2ab8('0x4e')]||_0x2ab8('0x4f'));this[_0x2ab8('0x5')](_0x2ab8('0x4c'),_0x2ab8('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x2ab8('0x40')],'set':function(_0x3ae1ce){this[_0x2ab8('0x5')]('permissions',_0x3ae1ce?_0x3ae1ce[_0x2ab8('0x23')](','):[]);},'get':function(){return this['getDataValue'](_0x2ab8('0x50'))?_['map'](this[_0x2ab8('0x14')](_0x2ab8('0x50'))[_0x2ab8('0x25')](','),function(_0x4f51c9){return parseInt(_0x4f51c9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2ab8('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2ab8('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2ab8('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2ab8('0x51')],'get':function(){return this[_0x2ab8('0x14')](_0x2ab8('0x52'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2ab8('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2ab8('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f8cc6){if(typeof _0x4f8cc6===_0x2ab8('0x53')){var _0x31e8c5=_0x4f8cc6==='1'?!![]:_0x4f8cc6==='0'?![]:_0x4f8cc6===_0x2ab8('0x54')?!![]:_0x4f8cc6===_0x2ab8('0x55')?![]:![];this[_0x2ab8('0x5')](_0x2ab8('0x56'),_0x31e8c5);}else{this[_0x2ab8('0x5')](_0x2ab8('0x56'),_0x4f8cc6);}}},'blocked':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![],'set':function(_0x1894df){this[_0x2ab8('0x5')](_0x2ab8('0x57'),_0x1894df);if(_0x1894df===!![]){this[_0x2ab8('0x5')](_0x2ab8('0x58'),moment());this[_0x2ab8('0x5')](_0x2ab8('0x59'),0x0);}else{this[_0x2ab8('0x5')](_0x2ab8('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x2ab8('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2ab8('0xf')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2ab8('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3e756f5..58d9a46 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 _0xbd03=['dataValues','fax','mail','openchannel','whatsapp','all','catch','show','merge','update','body','params','describe','addContacts','ids','omit','Setting','findById','securePassword','max','internal','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','VoiceMail','fullname','email','permissions','101','102','103','113','104','105','106','109','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','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','findAll','isEmpty','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','toLowerCase','Queues','spread','capitalize','voice','VoiceQueue','online','interface','format','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','QueueId','Queue:remove','addAvatar','userpic','file','filename','root','server/files/images/logos/default_profile.png','existsSync','join','download','sms','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','tag','model','keys','Queue','filters','intersection','fields','order','pick','options','nolimit','getVoiceQueuesRt','sort','getGroups','ChatGroup','UserId','VoiceRecording','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','mobile','user:%s','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','addTeams','resolve','transaction','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','VoicePrefixId','getDataValue','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getLists','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$gt','$eq','$not','$between','$in','$like','$iLike','$notILike','$any','firstName','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','idle','ringing','inbound','flatten','toString','lower','col','desc','asc','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','messengerSoundNotification','moment','util','path','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','APIBadRequestError','../../errors/api','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','sendStatus','status','end','json','offset','limit','count','set','then','role','agent','emit','userNotification:recalc:','destroy','get','admin','user','Agents','Telephones','telephone','filter','ignore','value','includes','find','name','error','stack','send','User','rawAttributes','map','fieldName','type','key','password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','getOptions','where','query','includeAll','include','true','UserSetting','userSetting','attributes','push','rows','openTabs','length','chat'];(function(_0x5b117f,_0x252384){var _0x2334df=function(_0xeca8d9){while(--_0xeca8d9){_0x5b117f['push'](_0x5b117f['shift']());}};_0x2334df(++_0x252384);}(_0xbd03,0x129));var _0x3bd0=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xbd03[_0x18a79d];return _0x4f8848;};'use strict';var moment=require(_0x3bd0('0x0'));var util=require(_0x3bd0('0x1'));var path=require(_0x3bd0('0x2'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var authService=require(_0x3bd0('0x3'));var contacts=require(_0x3bd0('0x4'));var qs=require(_0x3bd0('0x5'));var rta=require(_0x3bd0('0x6'));var logger=require(_0x3bd0('0x7'))(_0x3bd0('0x8'));var utils=require(_0x3bd0('0x9'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require('../../errors/api')[_0x3bd0('0xa')];var APINotFoundError=require(_0x3bd0('0xb'))['APINotFoundError'];var APIHandleError=require(_0x3bd0('0xb'))[_0x3bd0('0xc')];var db=require(_0x3bd0('0xd'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x3bd0('0xe')]));require(_0x3bd0('0xf'))[_0x3bd0('0x10')](socket);config[_0x3bd0('0xe')]=_[_0x3bd0('0x11')](config['redis'],{'host':_0x3bd0('0x12'),'port':0x18eb});var values;function respondWithStatusCode(_0x50bd0c,_0x51b082){_0x51b082=_0x51b082||0xcc;return function(_0x3e4155){if(_0x3e4155){return _0x50bd0c[_0x3bd0('0x13')](_0x51b082);}return _0x50bd0c[_0x3bd0('0x14')](_0x51b082)[_0x3bd0('0x15')]();};}function respondWithResult(_0x11d219,_0x558daa){_0x558daa=_0x558daa||0xc8;return function(_0x1524de){if(_0x1524de){return _0x11d219[_0x3bd0('0x14')](_0x558daa)[_0x3bd0('0x16')](_0x1524de);}};}function respondWithFilteredResult(_0x3754a9,_0x40b2b2){return function(_0x459462){if(_0x459462){var _0x56d0e5=typeof _0x40b2b2[_0x3bd0('0x17')]==='undefined'&&typeof _0x40b2b2[_0x3bd0('0x18')]==='undefined';var _0x197a2a=_0x459462[_0x3bd0('0x19')];var _0x1aa0e5=_0x56d0e5?0x0:_0x40b2b2['offset'];var _0x201323=_0x56d0e5?_0x459462[_0x3bd0('0x19')]:_0x40b2b2[_0x3bd0('0x17')]+_0x40b2b2[_0x3bd0('0x18')];var _0x30ae81;if(_0x201323>=_0x197a2a){_0x201323=_0x197a2a;_0x30ae81=0xc8;}else{_0x30ae81=0xce;}_0x3754a9[_0x3bd0('0x14')](_0x30ae81);return _0x3754a9[_0x3bd0('0x1a')]('Content-Range',_0x1aa0e5+'-'+_0x201323+'/'+_0x197a2a)[_0x3bd0('0x16')](_0x459462);}return null;};}function saveUpdates(_0x29b69b){return function(_0x22d9b8){if(_0x22d9b8){return _0x22d9b8['update'](_0x29b69b)[_0x3bd0('0x1b')](function(_0x5946c4){if(_0x5946c4[_0x3bd0('0x1c')]===_0x3bd0('0x1d')){socket[_0x3bd0('0x1e')](_0x3bd0('0x1f')+_0x5946c4['id'],_0x5946c4);}return _0x5946c4;});}return null;};}function removeEntity(_0x2476c8){return function(_0x1688a2){if(_0x1688a2){return _0x1688a2[_0x3bd0('0x20')]()[_0x3bd0('0x1b')](function(){var _0x47c589=_0x1688a2[_0x3bd0('0x21')]({'plain':!![]});if(_0x47c589[_0x3bd0('0x1c')]===_0x3bd0('0x22'))return;var _0x2ba955=[{'name':'Users','value':_0x3bd0('0x23'),'ignore':!![]},{'name':_0x3bd0('0x24'),'value':_0x3bd0('0x1d'),'ignore':![]},{'name':_0x3bd0('0x25'),'value':_0x3bd0('0x26'),'ignore':![]}];var _0x37feaf=_(_0x2ba955)[_0x3bd0('0x27')](_0x3bd0('0x28'))['map'](_0x3bd0('0x29'))[_0x3bd0('0x29')]();if(_[_0x3bd0('0x2a')](_0x37feaf,_0x47c589['role'])){return;}var _0x3b3f09=_[_0x3bd0('0x2b')](_0x2ba955,['value',_0x47c589[_0x3bd0('0x1c')]])[_0x3bd0('0x2c')];return db['UserProfileResource'][_0x3bd0('0x20')]({'where':{'type':_0x3b3f09,'resourceId':_0x47c589['id']}})['then'](function(){return _0x1688a2;});})[_0x3bd0('0x1b')](function(){_0x2476c8[_0x3bd0('0x14')](0xcc)[_0x3bd0('0x15')]();});}};}function handleEntityNotFound(_0x5a2b7c){return function(_0x333372){if(!_0x333372){_0x5a2b7c['sendStatus'](0x194);}return _0x333372;};}function handleError(_0x5eefec,_0x268242){_0x268242=_0x268242||0x1f4;return function(_0x4fe0bb){logger[_0x3bd0('0x2d')](_0x4fe0bb[_0x3bd0('0x2e')]);if(_0x4fe0bb[_0x3bd0('0x2c')]){delete _0x4fe0bb['name'];}_0x5eefec[_0x3bd0('0x14')](_0x268242)[_0x3bd0('0x2f')](_0x4fe0bb);};}function getUserAttributes(){return _(db[_0x3bd0('0x30')][_0x3bd0('0x31')])[_0x3bd0('0x32')](function(_0x3f51b1){return{'name':_0x3f51b1[_0x3bd0('0x33')],'type':_0x3f51b1[_0x3bd0('0x34')][_0x3bd0('0x35')]};})['filter'](function(_0x3f0b98){return![_0x3bd0('0x36'),_0x3bd0('0x37'),_0x3bd0('0x38'),_0x3bd0('0x39'),_0x3bd0('0x3a'),_0x3bd0('0x3b')][_0x3bd0('0x2a')](_0x3f0b98[_0x3bd0('0x2c')]);})[_0x3bd0('0x29')]();}exports['index']=function(_0x3d52a1,_0x3c896e){var _0x5412ab={},_0x418d39={'count':0x0,'rows':[]};var _0x2e7016=getUserAttributes();_0x5412ab=qs[_0x3bd0('0x3c')](_0x2e7016,_0x3d52a1);var _0x97b9ed={'where':_0x5412ab[_0x3bd0('0x3d')]};return db[_0x3bd0('0x30')]['count'](_0x97b9ed)[_0x3bd0('0x1b')](function(_0x4edced){_0x418d39['count']=_0x4edced;if(_0x3d52a1[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x5412ab[_0x3bd0('0x40')]=[{'all':!![]}];}if(_0x3d52a1[_0x3bd0('0x3e')]['userSetting']===_0x3bd0('0x41')){_0x5412ab[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0x42')],'as':_0x3bd0('0x43')}];}if(!_[_0x3bd0('0x2a')](_0x5412ab[_0x3bd0('0x44')],'id')){_0x5412ab[_0x3bd0('0x44')][_0x3bd0('0x45')]('id');}return db[_0x3bd0('0x30')]['findAll'](_0x5412ab);})[_0x3bd0('0x1b')](function(_0x5f151b){_0x418d39[_0x3bd0('0x46')]=_0x5f151b;if(_0x3d52a1[_0x3bd0('0x3e')][_0x3bd0('0x47')]===_0x3bd0('0x41')){var _0x537061=[];for(var _0x2a2056=0x0;_0x2a2056<_0x418d39[_0x3bd0('0x46')][_0x3bd0('0x48')];_0x2a2056++){_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x49'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs('sms',_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4c'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061['push'](get_open_tabs(_0x3bd0('0x4d'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));_0x537061[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4e'),_0x418d39[_0x3bd0('0x46')][_0x2a2056][_0x3bd0('0x4a')]));}return Promise[_0x3bd0('0x4f')](_0x537061)[_0x3bd0('0x1b')](function(){return _0x418d39;});}else{return _0x418d39;}})['then'](respondWithFilteredResult(_0x3c896e,_0x5412ab))[_0x3bd0('0x50')](handleError(_0x3c896e,null));};exports[_0x3bd0('0x51')]=function(_0x2fad79,_0x3192b2){var _0x189bfd=getUserAttributes();_0x2fad79[_0x3bd0('0x3e')]['id']=_0x2fad79['params']['id'];var _0x338b98=qs[_0x3bd0('0x3c')](_0x189bfd,_0x2fad79);if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x338b98[_0x3bd0('0x40')]=[{'all':!![]}];}if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x43')]===_0x3bd0('0x41')){_0x338b98[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0x42')],'as':_0x3bd0('0x43')}];}_0x338b98=_[_0x3bd0('0x52')]({},_0x338b98,_0x2fad79['options']);if(!_[_0x3bd0('0x2a')](_0x338b98['attributes'],'id')){_0x338b98[_0x3bd0('0x44')][_0x3bd0('0x45')]('id');}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')](_0x338b98)['then'](handleEntityNotFound(_0x3192b2,null))[_0x3bd0('0x1b')](function(_0x3e213a){var _0x352442=[];values=_0x3e213a;if(_0x2fad79[_0x3bd0('0x3e')][_0x3bd0('0x47')]===_0x3bd0('0x41')){_0x352442[_0x3bd0('0x45')](get_open_tabs('chat',_0x3e213a['dataValues']));_0x352442[_0x3bd0('0x45')](get_open_tabs('sms',_0x3e213a[_0x3bd0('0x4a')]));_0x352442['push'](get_open_tabs(_0x3bd0('0x4d'),_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs('whatsapp',_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x3e213a[_0x3bd0('0x4a')]));_0x352442[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4c'),_0x3e213a[_0x3bd0('0x4a')]));return Promise[_0x3bd0('0x4f')](_0x352442);}else{return values;}})[_0x3bd0('0x1b')](function(){return values;})[_0x3bd0('0x1b')](respondWithResult(_0x3192b2,null))[_0x3bd0('0x50')](handleError(_0x3192b2,null));};exports[_0x3bd0('0x53')]=function(_0x8b6867,_0x24d1b3){if(_0x8b6867[_0x3bd0('0x54')]['id']){delete _0x8b6867[_0x3bd0('0x54')]['id'];}delete _0x8b6867[_0x3bd0('0x54')][_0x3bd0('0x1c')];return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x8b6867[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x24d1b3,null))[_0x3bd0('0x1b')](saveUpdates(_0x8b6867[_0x3bd0('0x54')],null))['then'](respondWithResult(_0x24d1b3,null))[_0x3bd0('0x50')](handleError(_0x24d1b3,null));};exports[_0x3bd0('0x56')]=function(_0x2bc4ba,_0x49e30b){return db['User'][_0x3bd0('0x56')]()[_0x3bd0('0x1b')](respondWithResult(_0x49e30b,null))[_0x3bd0('0x50')](handleError(_0x49e30b,null));};exports[_0x3bd0('0x57')]=function(_0x29c50b,_0x5463c9){return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x29c50b['params']['id']}})['then'](handleEntityNotFound(_0x5463c9,null))['then'](function(_0x4b8d13){if(_0x4b8d13){return _0x4b8d13[_0x3bd0('0x57')](_0x29c50b[_0x3bd0('0x54')][_0x3bd0('0x58')],_[_0x3bd0('0x59')](_0x29c50b[_0x3bd0('0x54')],[_0x3bd0('0x58'),'id'])||{});}})[_0x3bd0('0x1b')](respondWithResult(_0x5463c9,null))[_0x3bd0('0x50')](handleError(_0x5463c9,null));};function validateUser(_0x1eed02){return new Promise(function(_0x112ae5,_0x38f103){if(_0x1eed02['internal'])return _0x112ae5(_0x1eed02);return db[_0x3bd0('0x5a')][_0x3bd0('0x5b')](0x1)[_0x3bd0('0x1b')](function(_0x19b33b){if(_0x19b33b[_0x3bd0('0x5c')])authService['validatePasswordPattern'](_0x1eed02['password']);db[_0x3bd0('0x30')][_0x3bd0('0x5d')](_0x3bd0('0x5e'))[_0x3bd0('0x1b')](function(_0x2eb87e){if(_['isNil'](_0x2eb87e)){_0x1eed02[_0x3bd0('0x5e')]=_0x19b33b[_0x3bd0('0x5f')]||0x1;return;}if(_[_0x3bd0('0x60')](_0x19b33b[_0x3bd0('0x5f')])||_0x19b33b[_0x3bd0('0x5f')]===_0x2eb87e){_0x1eed02[_0x3bd0('0x5e')]=_0x2eb87e+0x1;return;}if(_0x19b33b['min_internal']>_0x2eb87e){_0x1eed02[_0x3bd0('0x5e')]=_0x19b33b[_0x3bd0('0x5f')];return;}return db[_0x3bd0('0x61')][_0x3bd0('0x3e')](_0x3bd0('0x62'),{'type':db[_0x3bd0('0x61')]['QueryTypes'][_0x3bd0('0x63')]})[_0x3bd0('0x1b')](function(_0x531832){if(_0x531832&&_0x531832[_0x3bd0('0x48')]){for(var _0x594443=0x0,_0x4cb12d=_0x531832[_0x3bd0('0x48')];_0x594443<_0x4cb12d&&_[_0x3bd0('0x60')](_0x1eed02['internal']);_0x594443++){if(_0x19b33b[_0x3bd0('0x5f')]<=_0x531832[_0x594443]['from']){_0x1eed02[_0x3bd0('0x5e')]=_0x531832[_0x594443][_0x3bd0('0x64')];}else if(_0x19b33b[_0x3bd0('0x5f')]>_0x531832[_0x594443]['from']&&_0x19b33b['min_internal']<=_0x531832[_0x594443]['to']){_0x1eed02['internal']=_0x19b33b[_0x3bd0('0x5f')];}}}if(_[_0x3bd0('0x60')](_0x1eed02['internal'])){_0x1eed02[_0x3bd0('0x5e')]=_0x2eb87e+0x1;}return _0x112ae5(_0x1eed02);});});})[_0x3bd0('0x50')](function(_0x513e26){_0x38f103(_0x513e26);});});}function updateUser(_0x24e6b8){return new Promise(function(_0x724597,_0x50b990){try{if(_0x24e6b8[_0x3bd0('0x65')]){_0x24e6b8['mailbox']=_0x24e6b8['internal'];_0x24e6b8[_0x3bd0('0x66')]={'mailbox':_0x24e6b8['internal'],'password':_0x24e6b8[_0x3bd0('0x36')],'fullname':_0x24e6b8[_0x3bd0('0x67')],'email':_0x24e6b8[_0x3bd0('0x68')]};}if(_0x24e6b8['role']==='agent'){if(!_0x24e6b8[_0x3bd0('0x69')])_0x24e6b8[_0x3bd0('0x69')]=[_0x3bd0('0x6a'),_0x3bd0('0x6b'),_0x3bd0('0x6c'),_0x3bd0('0x6d'),'110',_0x3bd0('0x6e'),_0x3bd0('0x6f'),_0x3bd0('0x70'),'107','108',_0x3bd0('0x71'),_0x3bd0('0x72'),_0x3bd0('0x73'),_0x3bd0('0x74'),'115'];}_0x724597(_0x24e6b8);}catch(_0x4dae56){_0x50b990(_0x4dae56);}});}exports[_0x3bd0('0x75')]=function(_0x622012,_0x56bcc3){if(_0x622012[_0x3bd0('0x23')]['role']===_0x3bd0('0x1d'))throw new Error(_0x3bd0('0x76'));if(_0x622012[_0x3bd0('0x54')][_0x3bd0('0x1c')]===_0x3bd0('0x23')&&_0x622012[_0x3bd0('0x23')][_0x3bd0('0x1c')]!==_0x3bd0('0x22')){throw new Error(_0x3bd0('0x77'));}if(_0x622012[_0x3bd0('0x54')]['role']==='admin'&&_0x622012['user'][_0x3bd0('0x1c')]!==_0x3bd0('0x22')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3bd0('0x78')]([_0x622012[_0x3bd0('0x54')]])[_0x3bd0('0x1b')](function(){return validateUser(_0x622012[_0x3bd0('0x54')]);})[_0x3bd0('0x1b')](function(_0x518d23){return updateUser(_0x518d23)[_0x3bd0('0x1b')](function(_0x253112){if(_0x253112[_0x3bd0('0x1c')]===_0x3bd0('0x22')){_0x253112[_0x3bd0('0x79')]=_0x622012[_0x3bd0('0x23')][_0x3bd0('0x79')];delete _0x253112[_0x3bd0('0x7a')];}return _0x253112;});})[_0x3bd0('0x1b')](function(_0x52ed76){return db['User'][_0x3bd0('0x75')](_0x52ed76,{'include':[{'model':db[_0x3bd0('0x66')],'as':_0x3bd0('0x66')}]});})[_0x3bd0('0x1b')](function(_0x4bc45e){if(_0x622012['body']['role']===_0x3bd0('0x23'))return _0x4bc45e;if(_0x622012[_0x3bd0('0x23')][_0x3bd0('0x1c')]!==_0x3bd0('0x23'))return _0x4bc45e;return db[_0x3bd0('0x7b')][_0x3bd0('0x2b')]({'where':{'name':_0x4bc45e[_0x3bd0('0x1c')]==='agent'?_0x3bd0('0x24'):_0x3bd0('0x25'),'userProfileId':_0x622012[_0x3bd0('0x23')][_0x3bd0('0x7a')]},'raw':!![]})[_0x3bd0('0x1b')](function(_0x2c53c9){if(!_0x2c53c9||_0x2c53c9[_0x3bd0('0x7c')]!=0x0)return _0x4bc45e;return db[_0x3bd0('0x7d')]['create']({'name':_0x4bc45e['name'],'resourceId':_0x4bc45e['id'],'type':_0x2c53c9[_0x3bd0('0x2c')],'sectionId':_0x2c53c9['id']},{})['then'](function(){return _0x4bc45e;});})[_0x3bd0('0x50')](function(_0x561614){logger[_0x3bd0('0x2d')](_0x3bd0('0x7e'),_0x561614);throw _0x561614;});})[_0x3bd0('0x1b')](respondWithResult(_0x56bcc3,0xc9))[_0x3bd0('0x50')](handleError(_0x56bcc3,null));};exports[_0x3bd0('0x7f')]=function(_0x4dd6f6,_0xb1e7fa){var _0x43afc7=_0x4dd6f6[_0x3bd0('0x54')];var _0x1f1864=[];if(_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]===_0x3bd0('0x1d'))throw new Error(_0x3bd0('0x76'));if(_['some'](_0x43afc7,['role',_0x3bd0('0x23')])&&_0x4dd6f6[_0x3bd0('0x23')]['role']!=='admin'){throw new Error(_0x3bd0('0x77'));}if(_[_0x3bd0('0x80')](_0x43afc7,[_0x3bd0('0x1c'),_0x3bd0('0x22')])&&_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]!=='admin'){throw new Error(_0x3bd0('0x81'));}return licenseUtil[_0x3bd0('0x78')](_0x43afc7)['then'](function(){return validateUser(_0x43afc7[0x0]);})[_0x3bd0('0x1b')](function(){for(var _0x32ab97=0x1;_0x32ab97<_0x43afc7['length'];_0x32ab97++){var _0x53968c=_0x43afc7[_0x32ab97-0x1][_0x3bd0('0x5e')];if(!_0x43afc7[_0x32ab97][_0x3bd0('0x5e')])_0x43afc7[_0x32ab97][_0x3bd0('0x5e')]=_0x53968c+0x1;_0x1f1864[_0x3bd0('0x45')](validateUser(_0x43afc7[_0x32ab97]));}return Promise[_0x3bd0('0x4f')](_0x1f1864);})['then'](function(){_0x1f1864=[];for(var _0x5bf4f9=0x0;_0x5bf4f9<_0x43afc7[_0x3bd0('0x48')];_0x5bf4f9++){_0x1f1864[_0x3bd0('0x45')](updateUser(_0x43afc7[_0x5bf4f9]));}return Promise[_0x3bd0('0x4f')](_0x1f1864);})[_0x3bd0('0x1b')](function(){_0x1f1864=_0x43afc7['map'](function(_0x5aef6b){return db[_0x3bd0('0x30')][_0x3bd0('0x75')](_0x5aef6b,{'include':[{'model':db['VoiceMail'],'as':_0x3bd0('0x66')}]})[_0x3bd0('0x1b')](function(_0x559b1d){_0x5aef6b['id']=_0x559b1d['id'];return _0x5aef6b;});});return Promise[_0x3bd0('0x4f')](_0x1f1864);})['then'](function(_0x3bcf30){if(_0x4dd6f6['body'][_0x3bd0('0x1c')]===_0x3bd0('0x23'))return _0x3bcf30;if(_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x1c')]!=='user')return _0x3bcf30;var _0x370038=_[_0x3bd0('0x80')](_0x3bcf30,function(_0xd8f0b4){return _0xd8f0b4[_0x3bd0('0x1c')]==='agent'||_0xd8f0b4[_0x3bd0('0x1c')]===_0x3bd0('0x26');});if(!_0x370038)return _0x3bcf30;return db[_0x3bd0('0x7b')][_0x3bd0('0x82')]({'where':{'name':{'$or':[_0x3bd0('0x24'),'Telephones']},'userProfileId':_0x4dd6f6[_0x3bd0('0x23')][_0x3bd0('0x7a')]},'raw':!![]})[_0x3bd0('0x1b')](function(_0xbec164){if(_[_0x3bd0('0x83')](_0xbec164)||!_[_0x3bd0('0x80')](_0xbec164,['autoAssociation',0x0]))return _0x3bcf30;_0x1f1864=[];var _0x4460a8=_(_0xbec164)[_0x3bd0('0x32')](function(_0xfb530f){if(_0xfb530f[_0x3bd0('0x7c')]===0x1)return;return _0xfb530f['name']===_0x3bd0('0x24')?'agent':_0x3bd0('0x26');})['compact']()[_0x3bd0('0x29')]();for(var _0x4d3c76=0x0;_0x4d3c76<_0x3bcf30[_0x3bd0('0x48')];_0x4d3c76++){if(!_[_0x3bd0('0x2a')](_0x4460a8,_0x3bcf30[_0x4d3c76]['role']))return;var _0x1ec960=_0x3bcf30[_0x4d3c76][_0x3bd0('0x1c')]===_0x3bd0('0x1d')?_0x3bd0('0x24'):_0x3bd0('0x25');_0x1f1864[_0x3bd0('0x45')](db['UserProfileResource'][_0x3bd0('0x75')]({'name':_0x3bcf30[_0x4d3c76][_0x3bd0('0x2c')],'resourceId':_0x3bcf30[_0x4d3c76]['id'],'type':_0x1ec960,'sectionId':_[_0x3bd0('0x2b')](_0xbec164,[_0x3bd0('0x2c'),_0x1ec960])['id']},{}));}return Promise[_0x3bd0('0x4f')](_0x1f1864);});})[_0x3bd0('0x1b')](respondWithResult(_0xb1e7fa,0xc9))[_0x3bd0('0x50')](handleError(_0xb1e7fa,null));};exports[_0x3bd0('0x84')]=function(_0x5cbd25,_0x60754){if(_0x5cbd25[_0x3bd0('0x54')]['id']){delete _0x5cbd25[_0x3bd0('0x54')]['id'];}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x5cbd25[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](function(_0x56cc83){if(!_0x56cc83)return null;if(_0x56cc83['id']===_0x5cbd25[_0x3bd0('0x23')]['id']){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x85')]||!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db[(_0x3bd0('0x87'))]['ValidationError'](_0x3bd0('0x88'));}if(!_0x56cc83['authenticate'](_0x5cbd25[_0x3bd0('0x54')]['oldPassword'])){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))]('Wrong\x20credentials');}if(_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x85')]===_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x8a'));}}else if(_0x5cbd25[_0x3bd0('0x23')][_0x3bd0('0x1c')]===_0x3bd0('0x22')){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0x8b'));}}else if(_0x5cbd25['user'][_0x3bd0('0x1c')]===_0x3bd0('0x23')){if(!_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')]){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x8b'));}if(_0x56cc83[_0x3bd0('0x1c')]!==_0x3bd0('0x1d')){throw new db['Sequelize']['ValidationError'](_0x3bd0('0x76'));}}else{throw new db[(_0x3bd0('0x87'))]['ValidationError'](_0x3bd0('0x76'));}return _0x56cc83;})[_0x3bd0('0x1b')](handleEntityNotFound(_0x60754,null))[_0x3bd0('0x1b')](function(_0x3eec6b){return db[_0x3bd0('0x5a')][_0x3bd0('0x8c')]({'attributes':['id',_0x3bd0('0x5c'),'enforcePasswordHistory',_0x3bd0('0x8d')]})[_0x3bd0('0x1b')](function(_0xfe6b12){if(_0xfe6b12[_0x3bd0('0x5c')])authService[_0x3bd0('0x8e')](_0x5cbd25[_0x3bd0('0x54')]['newPassword']);if(!_0xfe6b12[_0x3bd0('0x8f')]||!_0x3eec6b[_0x3bd0('0x38')])return _0x3eec6b;authService[_0x3bd0('0x90')](_0x5cbd25[_0x3bd0('0x54')][_0x3bd0('0x86')],_0x3eec6b[_0x3bd0('0x38')],_0xfe6b12[_0x3bd0('0x8d')]);return _0x3eec6b;})['then'](saveUpdates({'password':_0x5cbd25['body'][_0x3bd0('0x86')],'passwordResetAt':_0x5cbd25[_0x3bd0('0x23')]['id']==_0x5cbd25[_0x3bd0('0x55')]['id']?moment():null,'previousPasswords':authService[_0x3bd0('0x91')](_0x5cbd25[_0x3bd0('0x54')]['newPassword'],_0x3eec6b[_0x3bd0('0x38')])},null));})[_0x3bd0('0x1b')](respondWithResult(_0x60754,null))[_0x3bd0('0x50')](handleError(_0x60754,null));};exports[_0x3bd0('0x92')]=function(_0x4201e6,_0x51ed02){var _0x122d02=_0x4201e6['body'][_0x3bd0('0x93')];return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x4201e6[_0x3bd0('0x55')]['id']},'attributes':['id',_0x3bd0('0x2c'),'role','online',_0x3bd0('0x94'),_0x3bd0('0x95'),'interface']})['then'](handleEntityNotFound(_0x51ed02,null))[_0x3bd0('0x1b')](function(_0x2a75d5){if(_0x2a75d5){if(!utils[_0x3bd0('0x96')](_0x122d02)){throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0x97'));}return _0x2a75d5[_0x3bd0('0x98')+_['capitalize'](_0x122d02[_0x3bd0('0x99')]())+_0x3bd0('0x9a')](_0x4201e6[_0x3bd0('0x54')]['ids'],{'penalty':_0x4201e6[_0x3bd0('0x54')]['penalty']||0x0})[_0x3bd0('0x9b')](function(_0x1b773a){for(var _0x1d0577=0x0;_0x1d0577<_0x4201e6['body'][_0x3bd0('0x58')][_0x3bd0('0x48')];_0x1d0577+=0x1){var _0x49ef5f={'UserId':Number(_0x4201e6['params']['id'])};_0x49ef5f[_[_0x3bd0('0x9c')](_0x122d02['toLowerCase']())+'QueueId']=Number(_0x4201e6['body'][_0x3bd0('0x58')][_0x1d0577]);socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x122d02['toLowerCase']())+'Queue:save',_0x49ef5f);}return _0x1b773a;})['then'](function(){if(_0x122d02===_0x3bd0('0x9d')){return db[_0x3bd0('0x9e')]['findAll']({'where':{'id':_0x4201e6['body'][_0x3bd0('0x58')]||[]},'raw':!![],'attributes':['id',_0x3bd0('0x2c')]});}})[_0x3bd0('0x1b')](function(_0x1c1209){var _0x56b561=_0x2a75d5[_0x3bd0('0x21')]({'plain':!![]});var _0x34b16c=[];if(_0x122d02===_0x3bd0('0x9d')&&_0x56b561[_0x3bd0('0x1c')]===_0x3bd0('0x1d')&&_0x56b561[_0x3bd0('0x9f')]){for(let _0x42cd26=0x0;_0x42cd26<_0x1c1209[_0x3bd0('0x48')];_0x42cd26+=0x1){_0x34b16c[_0x3bd0('0x45')]({'membername':_0x56b561['name'],'UserId':_0x56b561['id'],'queue_name':_0x1c1209[_0x42cd26][_0x3bd0('0x2c')],'VoiceQueueId':_0x1c1209[_0x42cd26]['id'],'interface':_[_0x3bd0('0x60')](_0x56b561[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x56b561[_0x3bd0('0x2c')]):_0x56b561[_0x3bd0('0xa0')],'paused':_0x56b561[_0x3bd0('0x95')]||![],'penalty':_0x4201e6[_0x3bd0('0x54')][_0x3bd0('0xa3')]||0x0});}return Promise['all'](_0x34b16c[_0x3bd0('0x32')](function(_0xee0b91){return db[_0x3bd0('0xa4')]['upsert'](_0xee0b91);}));}return _0x2a75d5;});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x51ed02,null))['catch'](handleError(_0x51ed02,null));};exports[_0x3bd0('0xa5')]=function(_0x5027ec,_0xd62853){var _0x200823,_0x12ba41;return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x5027ec[_0x3bd0('0x55')]['id']},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c')]})[_0x3bd0('0x1b')](handleEntityNotFound(_0xd62853,null))[_0x3bd0('0x1b')](function(_0xa49fa3){if(_0xa49fa3){_0x200823=_0xa49fa3;if(!_0x5027ec['query']['channel']||!utils[_0x3bd0('0x96')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')])){throw new db[(_0x3bd0('0x87'))]['ValidationError']('Unknown\x20channel');}return _0xa49fa3[_0x3bd0('0xa6')+_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')][_0x3bd0('0x99')]())+_0x3bd0('0x9a')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]);}})[_0x3bd0('0x1b')](function(_0x5cb5f4){if(_[_0x3bd0('0xa7')](_0x5027ec[_0x3bd0('0x3e')]['ids'])){for(var _0x42024f=0x0;_0x42024f<_0x5027ec['query']['ids'][_0x3bd0('0x48')];_0x42024f+=0x1){_0x12ba41={'UserId':Number(_0x5027ec[_0x3bd0('0x55')]['id'])};_0x12ba41[_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')][_0x3bd0('0x99')]())+_0x3bd0('0xa8')]=Number(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')][_0x42024f]);socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]['toLowerCase']())+_0x3bd0('0xa9'),_0x12ba41);}}else{_0x12ba41={'UserId':Number(_0x5027ec['params']['id'])};_0x12ba41[_['capitalize'](_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]['toLowerCase']())+_0x3bd0('0xa8')]=Number(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]);socket['emit'](_0x3bd0('0x23')+_[_0x3bd0('0x9c')](_0x5027ec['query'][_0x3bd0('0x93')][_0x3bd0('0x99')]())+'Queue:remove',_0x12ba41);}return _0x5cb5f4;})[_0x3bd0('0x1b')](function(){if(_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x93')]==='voice'){return db['UserVoiceQueueRt'][_0x3bd0('0x20')]({'where':{'UserId':_0x5027ec[_0x3bd0('0x55')]['id'],'VoiceQueueId':_0x5027ec[_0x3bd0('0x3e')][_0x3bd0('0x58')]},'individualHooks':!![]})[_0x3bd0('0x1b')](function(){return _0x200823;});}return _0x200823;})[_0x3bd0('0x1b')](respondWithStatusCode(_0xd62853,null))['catch'](handleError(_0xd62853,null));};exports[_0x3bd0('0xaa')]=function(_0xfe5378,_0x41b755){_0xfe5378['body'][_0x3bd0('0xab')]=_0xfe5378[_0x3bd0('0xac')][_0x3bd0('0xad')];return db['User']['find']({'where':{'id':_0xfe5378['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x41b755,null))['then'](saveUpdates(_0xfe5378[_0x3bd0('0x54')],null))['then'](respondWithResult(_0x41b755,null))[_0x3bd0('0x50')](handleError(_0x41b755,null));};exports['getAvatar']=function(_0x6cf494,_0x1c98c3){var _0x5087c8=path['join'](config[_0x3bd0('0xae')],_0x3bd0('0xaf'));return db['User'][_0x3bd0('0x2b')]({'where':{'id':_0x6cf494['params']['id']},'attributes':['id',_0x3bd0('0xab')],'raw':!![]})[_0x3bd0('0x1b')](handleEntityNotFound(_0x1c98c3,null))[_0x3bd0('0x1b')](function(_0x279956){if(_0x279956){if(_[_0x3bd0('0x60')](_0x279956[_0x3bd0('0xab')])){return _0x1c98c3['download'](_0x5087c8);}else{if(!fs[_0x3bd0('0xb0')](path[_0x3bd0('0xb1')](config[_0x3bd0('0xae')],'server/files/images/',_0x279956[_0x3bd0('0xab')]))){return _0x1c98c3[_0x3bd0('0xb2')](_0x5087c8);}return _0x1c98c3['download'](path[_0x3bd0('0xb1')](config[_0x3bd0('0xae')],'server/files/images/',_0x279956[_0x3bd0('0xab')]));}}})[_0x3bd0('0x50')](handleError(_0x1c98c3,null));};exports['getOpenTabs']=function(_0x7590b0,_0xe3ba41){return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x7590b0['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xe3ba41,null))['then'](function(_0x483495){var _0xec2b42=[];values=_0x483495[_0x3bd0('0x4a')];_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x49'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0xb3'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4d'),_0x483495['dataValues']));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4e'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs(_0x3bd0('0x4b'),_0x483495[_0x3bd0('0x4a')]));_0xec2b42[_0x3bd0('0x45')](get_open_tabs('mail',_0x483495['dataValues']));return Promise[_0x3bd0('0x4f')](_0xec2b42);})[_0x3bd0('0x1b')](function(_0x1dd1e2){if(_0x1dd1e2){var _0x1588fa=_['map'](values[_0x3bd0('0xb4')],function(_0x3553b9){return{'channel':_0x3bd0('0xb5'),'id':_0x3553b9['id'],'createdAt':_0x3553b9[_0x3bd0('0xb6')]};});var _0x1262f6=_['map'](values[_0x3bd0('0xb7')],function(_0x1822d2){return{'channel':'FAX','id':_0x1822d2['id'],'createdAt':_0x1822d2['createdAt']};});var _0x38cbf5=_[_0x3bd0('0x32')](values[_0x3bd0('0xb8')],function(_0x3d5560){return{'channel':_0x3bd0('0xb9'),'id':_0x3d5560['id'],'createdAt':_0x3d5560['createdAt']};});var _0x2b91a1=_['map'](values[_0x3bd0('0xba')],function(_0x544b28){return{'channel':_0x3bd0('0xbb'),'id':_0x544b28['id'],'createdAt':_0x544b28[_0x3bd0('0xb6')]};});var _0x55bd9e=_['map'](values[_0x3bd0('0xbc')],function(_0x4b4a87){return{'channel':_0x3bd0('0xbd'),'id':_0x4b4a87['id'],'createdAt':_0x4b4a87['createdAt']};});var _0x16c8df=_['map'](values[_0x3bd0('0xbe')],function(_0x19e5c7){return{'channel':_0x3bd0('0xbf'),'id':_0x19e5c7['id'],'createdAt':_0x19e5c7[_0x3bd0('0xb6')]};});var _0x56f662=_[_0x3bd0('0xc0')](_0x1588fa,_0x1262f6,_0x38cbf5,_0x2b91a1,_0x55bd9e,_0x16c8df);var _0x1bef2b={'count':_0x56f662[_0x3bd0('0x48')],'rows':_0x56f662};return _0x1bef2b;}else return null;})[_0x3bd0('0x1b')](respondWithResult(_0xe3ba41,null))['catch'](handleError(_0xe3ba41,null));};exports['getContacts']=function(_0x11d118,_0x3fd04b){var _0x2fed7c={};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x11d118[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](function(_0x23337f){if(!_0x23337f){throw new APINotFoundError(util[_0x3bd0('0xa1')](_0x3bd0('0xc1'),_0x11d118[_0x3bd0('0x55')]['id']));}return contacts['describe']();})['then'](function(_0x409500){_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0x30')]=_0x11d118[_0x3bd0('0x55')]['id'];_0x2fed7c=qs[_0x3bd0('0x3c')](_0x409500,_0x11d118);if(_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0x3f'))){_0x2fed7c[_0x3bd0('0x40')]=[{'model':db[_0x3bd0('0xc3')],'as':'List','required':![]},{'model':db[_0x3bd0('0xc4')],'as':_0x3bd0('0xc5'),'attributes':['id',_0x3bd0('0x2c'),'color'],'where':_0x11d118[_0x3bd0('0x3e')]['tag']?{'id':_0x11d118['query'][_0x3bd0('0xc6')]}:undefined,'required':_0x11d118[_0x3bd0('0x3e')][_0x3bd0('0xc6')]?!![]:![]}];}return contacts[_0x3bd0('0x82')](_0x11d118[_0x3bd0('0x3e')],_0x11d118[_0x3bd0('0x23')],_0x2fed7c,_0x409500);})[_0x3bd0('0x1b')](respondWithFilteredResult(_0x3fd04b,_0x2fed7c))[_0x3bd0('0x50')](APIHandleError(_0x3fd04b));};exports['getQueues']=function(_0x3a026f,_0x11b320){var _0x27e46c;var _0x2e5758={};var _0x3b646f;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x3a026f[_0x3bd0('0x55')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x11b320,null))[_0x3bd0('0x1b')](function(_0xc87256){if(!utils[_0x3bd0('0x96')](_0x3a026f['query']['channel'])){throw new db['Sequelize'][(_0x3bd0('0x89'))](_0x3bd0('0x97'));}_0x27e46c=_0xc87256;var _0x25f399={};_0x25f399[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_['capitalize'](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+_0x3bd0('0xc9')][_0x3bd0('0x31')]);_0x25f399['query']=_[_0x3bd0('0xc8')](_0x3a026f[_0x3bd0('0x3e')]);_0x25f399[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x25f399[_0x3bd0('0xc7')],_0x25f399['query']);_0x2e5758['attributes']=_['intersection'](_0x25f399[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x2e5758[_0x3bd0('0x44')]=_0x2e5758[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2e5758['attributes']:_0x25f399['model'];_0x2e5758[_0x3bd0('0xcd')]=qs['sort'](_0x3a026f[_0x3bd0('0x3e')]['sort']);_0x2e5758[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x3a026f[_0x3bd0('0x3e')],_0x25f399[_0x3bd0('0xca')]));if(_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2e5758[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x2e5758[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x2e5758[_0x3bd0('0x44')],function(_0x5a9e3f){var _0x5a39fa={};_0x5a39fa[_0x5a9e3f]={'$like':'%'+_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x5a39fa;})});}_0x2e5758=_[_0x3bd0('0x52')]({},_0x2e5758,_0x3a026f[_0x3bd0('0xcf')]);switch(_0x27e46c['role']){case'admin':return db[_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+'Queue'][_0x3bd0('0x82')](_0x2e5758);case _0x3bd0('0x23'):case _0x3bd0('0x1d'):return _0x27e46c['get'+_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')]['channel'])+'Queues'](_0x2e5758);default:throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))]('Unknown\x20role');}})['then'](function(_0x5807de){_0x3b646f=_0x5807de['length'];if(!_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x2e5758[_0x3bd0('0x18')]=qs['limit'](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x2e5758['offset']=qs[_0x3bd0('0x17')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}switch(_0x27e46c[_0x3bd0('0x1c')]){case _0x3bd0('0x22'):return db[_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')][_0x3bd0('0x93')])+_0x3bd0('0xc9')][_0x3bd0('0x82')](_0x2e5758);case'user':case _0x3bd0('0x1d'):return _0x27e46c['get'+_[_0x3bd0('0x9c')](_0x3a026f[_0x3bd0('0x3e')]['channel'])+_0x3bd0('0x9a')](_0x2e5758);}})[_0x3bd0('0x1b')](function(_0x41b613){return{'count':_0x3b646f,'rows':_0x41b613};})[_0x3bd0('0x1b')](respondWithResult(_0x11b320,null))[_0x3bd0('0x50')](handleError(_0x11b320,null));};exports[_0x3bd0('0xd1')]=function(_0x4f481e,_0xf7e7ca){var _0x42d914={};var _0x4e367c={};var _0x242732;var _0x20e37d;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x4f481e['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0xf7e7ca,null))[_0x3bd0('0x1b')](function(_0x2de590){if(_0x2de590){_0x242732=_0x2de590;_0x4e367c[_0x3bd0('0xc7')]=_['keys'](db[_0x3bd0('0xa4')][_0x3bd0('0x31')]);_0x4e367c[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x4f481e[_0x3bd0('0x3e')]);_0x4e367c[_0x3bd0('0xca')]=_['intersection'](_0x4e367c[_0x3bd0('0xc7')],_0x4e367c['query']);_0x42d914[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x4e367c['model'],qs['fields'](_0x4f481e[_0x3bd0('0x3e')]['fields']));_0x42d914[_0x3bd0('0x44')]=_0x42d914['attributes']['length']?_0x42d914['attributes']:_0x4e367c[_0x3bd0('0xc7')];_0x42d914[_0x3bd0('0xcd')]=qs['sort'](_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x42d914[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x4f481e[_0x3bd0('0x3e')],_0x4e367c[_0x3bd0('0xca')]));if(_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x42d914[_0x3bd0('0x3d')]=_['merge'](_0x42d914[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x42d914[_0x3bd0('0x44')],function(_0x5b990c){var _0x3c49b2={};_0x3c49b2[_0x5b990c]={'$like':'%'+_0x4f481e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x3c49b2;})});}_0x42d914=_[_0x3bd0('0x52')]({},_0x42d914,_0x4f481e[_0x3bd0('0xcf')]);return _0x242732['getVoiceQueuesRt'](_0x42d914);}})['then'](function(_0xe9e81e){if(_0xe9e81e){_0x20e37d=_0xe9e81e[_0x3bd0('0x48')];if(!_0x4f481e[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x42d914[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x4f481e[_0x3bd0('0x3e')]['limit']);_0x42d914[_0x3bd0('0x17')]=qs['offset'](_0x4f481e['query'][_0x3bd0('0x17')]);}return _0x242732[_0x3bd0('0xd1')](_0x42d914);}})[_0x3bd0('0x1b')](function(_0x586b0f){if(_0x586b0f){return _0x586b0f?{'count':_0x20e37d,'rows':_0x586b0f}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0xf7e7ca,null))[_0x3bd0('0x50')](handleError(_0xf7e7ca,null));};exports[_0x3bd0('0xd3')]=function(_0x26d15e,_0x2e5482){var _0x2c8b88={};var _0x2e8cbd={};var _0x478c1;var _0x185630;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x26d15e[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x2e5482,null))[_0x3bd0('0x1b')](function(_0x1f4a54){if(_0x1f4a54){_0x478c1=_0x1f4a54;_0x2e8cbd[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xd4')][_0x3bd0('0x31')]);_0x2e8cbd['query']=_[_0x3bd0('0xc8')](_0x26d15e[_0x3bd0('0x3e')]);_0x2e8cbd[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x2e8cbd[_0x3bd0('0xc7')],_0x2e8cbd[_0x3bd0('0x3e')]);_0x2c8b88[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x2e8cbd[_0x3bd0('0xc7')],qs['fields'](_0x26d15e[_0x3bd0('0x3e')]['fields']));_0x2c8b88[_0x3bd0('0x44')]=_0x2c8b88[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2c8b88['attributes']:_0x2e8cbd[_0x3bd0('0xc7')];_0x2c8b88[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x2c8b88[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x26d15e[_0x3bd0('0x3e')],_0x2e8cbd[_0x3bd0('0xca')]));if(_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2c8b88['where']=_[_0x3bd0('0x52')](_0x2c8b88[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x2c8b88[_0x3bd0('0x44')],function(_0x2f30fd){var _0x33a777={};_0x33a777[_0x2f30fd]={'$like':'%'+_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x33a777;})});}_0x2c8b88=_[_0x3bd0('0x52')]({},_0x2c8b88,_0x26d15e[_0x3bd0('0xcf')]);return _0x478c1[_0x3bd0('0xd3')](_0x2c8b88);}})[_0x3bd0('0x1b')](function(_0x52468a){if(_0x52468a){_0x185630=_0x52468a[_0x3bd0('0x48')];if(!_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x2c8b88['limit']=qs['limit'](_0x26d15e[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x2c8b88[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x26d15e[_0x3bd0('0x3e')]['offset']);}return _0x478c1[_0x3bd0('0xd3')](_0x2c8b88);}})[_0x3bd0('0x1b')](function(_0x2a79a3){if(_0x2a79a3){return _0x2a79a3?{'count':_0x185630,'rows':_0x2a79a3}:null;}})['then'](respondWithResult(_0x2e5482,null))[_0x3bd0('0x50')](handleError(_0x2e5482,null));};exports['getRecordings']=function(_0x5beda9,_0x41a5c4){var _0x3204c1={'raw':!![],'where':{}};var _0x8393d8={};var _0x1731a0={'count':0x0,'rows':[]};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x5beda9[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x41a5c4,null))[_0x3bd0('0x1b')](function(_0x3b3a9f){if(_0x3b3a9f){_0x8393d8[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db['VoiceRecording']['rawAttributes']);_0x8393d8[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x5beda9[_0x3bd0('0x3e')]);_0x8393d8[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x8393d8['model'],_0x8393d8[_0x3bd0('0x3e')]);_0x3204c1[_0x3bd0('0x44')]=_['intersection'](_0x8393d8[_0x3bd0('0xc7')],qs['fields'](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x3204c1[_0x3bd0('0x44')]=_0x3204c1[_0x3bd0('0x44')]['length']?_0x3204c1[_0x3bd0('0x44')]:_0x8393d8['model'];if(!_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x3204c1[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x3204c1['offset']=qs[_0x3bd0('0x17')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x3204c1[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x3204c1[_0x3bd0('0x3d')]=qs['filters'](_[_0x3bd0('0xce')](_0x5beda9[_0x3bd0('0x3e')],_0x8393d8[_0x3bd0('0xca')]));_0x3204c1[_0x3bd0('0x3d')][_0x3bd0('0xd5')]=_0x3b3a9f['id'];if(_0x5beda9['query'][_0x3bd0('0x27')]){_0x3204c1[_0x3bd0('0x3d')]=_['merge'](_0x3204c1[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x3204c1['attributes'],function(_0x2424ef){var _0x8cd91e={};_0x8cd91e[_0x2424ef]={'$like':'%'+_0x5beda9[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x8cd91e;})});}_0x3204c1=_[_0x3bd0('0x52')]({},_0x3204c1,_0x5beda9[_0x3bd0('0xcf')]);return db['VoiceRecording'][_0x3bd0('0x19')]({'where':_0x3204c1['where']})['then'](function(_0xd445e8){_0x1731a0[_0x3bd0('0x19')]=_0xd445e8;if(_0x5beda9['query']['includeAll']){_0x3204c1['include']=[{'all':!![]}];}return db[_0x3bd0('0xd6')][_0x3bd0('0x82')](_0x3204c1);})[_0x3bd0('0x1b')](function(_0x5e2479){_0x1731a0[_0x3bd0('0x46')]=_0x5e2479;return _0x1731a0;});}})['then'](respondWithFilteredResult(_0x41a5c4,_0x3204c1))['catch'](handleError(_0x41a5c4,null));};exports['getScreenRecordings']=function(_0x37b45b,_0x589355){var _0x38e75f={'raw':!![],'where':{}};var _0x4ec808={};var _0x4cf62b={'count':0x0,'rows':[]};return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x37b45b[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x589355,null))['then'](function(_0x143c20){if(_0x143c20){_0x4ec808['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xd7')]['rawAttributes']);_0x4ec808[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x37b45b[_0x3bd0('0x3e')]);_0x4ec808[_0x3bd0('0xca')]=_['intersection'](_0x4ec808[_0x3bd0('0xc7')],_0x4ec808[_0x3bd0('0x3e')]);_0x38e75f[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x4ec808['model'],qs[_0x3bd0('0xcc')](_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x38e75f[_0x3bd0('0x44')]=_0x38e75f[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x38e75f[_0x3bd0('0x44')]:_0x4ec808[_0x3bd0('0xc7')];if(!_0x37b45b[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x38e75f[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x37b45b['query']['limit']);_0x38e75f[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x38e75f[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x37b45b[_0x3bd0('0x3e')]['sort']);_0x38e75f['where']=qs[_0x3bd0('0xca')](_['pick'](_0x37b45b[_0x3bd0('0x3e')],_0x4ec808['filters']));_0x38e75f[_0x3bd0('0x3d')]['UserId']=_0x143c20['id'];if(_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x38e75f[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x38e75f['where'],{'$or':_[_0x3bd0('0x32')](_0x38e75f[_0x3bd0('0x44')],function(_0x291070){var _0x30f7fc={};_0x30f7fc[_0x291070]={'$like':'%'+_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x30f7fc;})});}_0x38e75f=_[_0x3bd0('0x52')]({},_0x38e75f,_0x37b45b[_0x3bd0('0xcf')]);return db[_0x3bd0('0xd7')][_0x3bd0('0x19')]({'where':_0x38e75f[_0x3bd0('0x3d')]})[_0x3bd0('0x1b')](function(_0x4afb04){_0x4cf62b[_0x3bd0('0x19')]=_0x4afb04;if(_0x37b45b[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x38e75f[_0x3bd0('0x40')]=[{'all':!![]}];}return db[_0x3bd0('0xd7')][_0x3bd0('0x82')](_0x38e75f);})[_0x3bd0('0x1b')](function(_0x41530d){_0x4cf62b[_0x3bd0('0x46')]=_0x41530d;return _0x4cf62b;});}})['then'](respondWithFilteredResult(_0x589355,_0x38e75f))[_0x3bd0('0x50')](handleError(_0x589355,null));};exports[_0x3bd0('0xd8')]=function(_0x11056b,_0x2f9e0b){var _0xc8f040={};var _0x14f4ad={};var _0x3daa04;var _0x5f512e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x11056b['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x2f9e0b,null))[_0x3bd0('0x1b')](function(_0x213352){if(_0x213352){_0x3daa04=_0x213352;_0x14f4ad['model']=_[_0x3bd0('0xc8')](db['ChatInteraction']['rawAttributes']);_0x14f4ad['query']=_[_0x3bd0('0xc8')](_0x11056b[_0x3bd0('0x3e')]);_0x14f4ad[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x14f4ad[_0x3bd0('0xc7')],_0x14f4ad['query']);_0xc8f040[_0x3bd0('0x44')]=_['intersection'](_0x14f4ad[_0x3bd0('0xc7')],qs['fields'](_0x11056b['query'][_0x3bd0('0xcc')]));_0xc8f040[_0x3bd0('0x44')]=_0xc8f040[_0x3bd0('0x44')]['length']?_0xc8f040[_0x3bd0('0x44')]:_0x14f4ad['model'];_0xc8f040[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x11056b['query'][_0x3bd0('0xd2')]);_0xc8f040[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x11056b[_0x3bd0('0x3e')],_0x14f4ad[_0x3bd0('0xca')]));if(_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0xc8f040[_0x3bd0('0x3d')]=_['merge'](_0xc8f040[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0xc8f040[_0x3bd0('0x44')],function(_0x2e2f6a){var _0xe51eef={};_0xe51eef[_0x2e2f6a]={'$like':'%'+_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0xe51eef;})});}_0xc8f040=_['merge']({},_0xc8f040,_0x11056b[_0x3bd0('0xcf')]);return _0x3daa04[_0x3bd0('0xd8')](_0xc8f040);}})[_0x3bd0('0x1b')](function(_0x10d244){if(_0x10d244){_0x5f512e=_0x10d244['length'];if(!_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0xc8f040[_0x3bd0('0x18')]=qs[_0x3bd0('0x18')](_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0xc8f040[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x11056b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x3daa04[_0x3bd0('0xd8')](_0xc8f040);}})[_0x3bd0('0x1b')](function(_0x273f37){if(_0x273f37){return _0x273f37?{'count':_0x5f512e,'rows':_0x273f37}:null;}})['then'](respondWithResult(_0x2f9e0b,null))[_0x3bd0('0x50')](handleError(_0x2f9e0b,null));};exports[_0x3bd0('0xd9')]=function(_0x1c18c0,_0x464a2f){var _0x2ca6af={};var _0x44ccba={};var _0x255da8;var _0x1f797c;return db[_0x3bd0('0x30')]['findOne']({'where':{'id':_0x1c18c0['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x464a2f,null))[_0x3bd0('0x1b')](function(_0x5d4091){if(_0x5d4091){_0x255da8=_0x5d4091;_0x44ccba['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xda')][_0x3bd0('0x31')]);_0x44ccba['query']=_[_0x3bd0('0xc8')](_0x1c18c0[_0x3bd0('0x3e')]);_0x44ccba[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x44ccba[_0x3bd0('0xc7')],_0x44ccba[_0x3bd0('0x3e')]);_0x2ca6af[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x44ccba['model'],qs[_0x3bd0('0xcc')](_0x1c18c0[_0x3bd0('0x3e')]['fields']));_0x2ca6af[_0x3bd0('0x44')]=_0x2ca6af[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x2ca6af[_0x3bd0('0x44')]:_0x44ccba[_0x3bd0('0xc7')];_0x2ca6af[_0x3bd0('0xcd')]=qs['sort'](_0x1c18c0['query'][_0x3bd0('0xd2')]);_0x2ca6af[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x1c18c0[_0x3bd0('0x3e')],_0x44ccba[_0x3bd0('0xca')]));if(_0x1c18c0[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x2ca6af['where']=_[_0x3bd0('0x52')](_0x2ca6af['where'],{'$or':_[_0x3bd0('0x32')](_0x2ca6af[_0x3bd0('0x44')],function(_0x512309){var _0x21f891={};_0x21f891[_0x512309]={'$like':'%'+_0x1c18c0['query'][_0x3bd0('0x27')]+'%'};return _0x21f891;})});}_0x2ca6af=_[_0x3bd0('0x52')]({},_0x2ca6af,_0x1c18c0['options']);return _0x255da8[_0x3bd0('0xd9')](_0x2ca6af);}})['then'](function(_0x49c465){if(_0x49c465){_0x1f797c=_0x49c465['length'];if(!_0x1c18c0[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x2ca6af[_0x3bd0('0x18')]=qs['limit'](_0x1c18c0['query'][_0x3bd0('0x18')]);_0x2ca6af['offset']=qs[_0x3bd0('0x17')](_0x1c18c0['query'][_0x3bd0('0x17')]);}return _0x255da8[_0x3bd0('0xd9')](_0x2ca6af);}})[_0x3bd0('0x1b')](function(_0x36349f){if(_0x36349f){return _0x36349f?{'count':_0x1f797c,'rows':_0x36349f}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x464a2f,null))[_0x3bd0('0x50')](handleError(_0x464a2f,null));};exports[_0x3bd0('0xdb')]=function(_0x24ef0b,_0x34d2d3){var _0x372c1d={'raw':!![],'where':{}};var _0x5972ac={};var _0x1b8044={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x24ef0b[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0x34d2d3,null))[_0x3bd0('0x1b')](function(_0xd3354){if(_0xd3354){_0x5972ac[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db['MailInteraction'][_0x3bd0('0x31')]);_0x5972ac[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x24ef0b[_0x3bd0('0x3e')]);_0x5972ac[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x5972ac['model'],_0x5972ac[_0x3bd0('0x3e')]);_0x372c1d[_0x3bd0('0x44')]=_['intersection'](_0x5972ac[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x372c1d['attributes']=_0x372c1d[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x372c1d[_0x3bd0('0x44')]:_0x5972ac[_0x3bd0('0xc7')];if(!_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xc2')]('nolimit')){_0x372c1d[_0x3bd0('0x18')]=qs['limit'](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x372c1d['offset']=qs[_0x3bd0('0x17')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}_0x372c1d[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x372c1d[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x24ef0b[_0x3bd0('0x3e')],_0x5972ac[_0x3bd0('0xca')]));_0x372c1d[_0x3bd0('0x3d')][_0x3bd0('0xd5')]=_0xd3354['id'];if(_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x372c1d['where']=_['merge'](_0x372c1d['where'],{'$or':_['map'](_0x372c1d[_0x3bd0('0x44')],function(_0x5b76f0){var _0x516fda={};_0x516fda[_0x5b76f0]={'$like':'%'+_0x24ef0b['query']['filter']+'%'};return _0x516fda;})});}_0x372c1d=_[_0x3bd0('0x52')]({},_0x372c1d,_0x24ef0b[_0x3bd0('0xcf')]);return db['MailInteraction'][_0x3bd0('0x19')]({'where':_0x372c1d[_0x3bd0('0x3d')]})[_0x3bd0('0x1b')](function(_0x539b8f){_0x1b8044[_0x3bd0('0x19')]=_0x539b8f;if(_0x24ef0b[_0x3bd0('0x3e')][_0x3bd0('0x3f')]){_0x372c1d['include']=[{'all':!![]}];}return db[_0x3bd0('0xdc')]['findAll'](_0x372c1d);})[_0x3bd0('0x1b')](function(_0x3440fe){_0x1b8044[_0x3bd0('0x46')]=_0x3440fe;return _0x1b8044;});}})[_0x3bd0('0x1b')](respondWithFilteredResult(_0x34d2d3,_0x372c1d))[_0x3bd0('0x50')](handleError(_0x34d2d3,null));};exports[_0x3bd0('0xdd')]=function(_0x23654a,_0x50aeee){var _0x4a0873={};var _0x350d65={};var _0x52b15f;var _0x45885e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x23654a[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x50aeee,null))[_0x3bd0('0x1b')](function(_0x82dcc9){if(_0x82dcc9){_0x52b15f=_0x82dcc9;_0x350d65['model']=_[_0x3bd0('0xc8')](db[_0x3bd0('0xde')][_0x3bd0('0x31')]);_0x350d65['query']=_['keys'](_0x23654a[_0x3bd0('0x3e')]);_0x350d65[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x350d65[_0x3bd0('0xc7')],_0x350d65[_0x3bd0('0x3e')]);_0x4a0873['attributes']=_[_0x3bd0('0xcb')](_0x350d65[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x23654a[_0x3bd0('0x3e')]['fields']));_0x4a0873['attributes']=_0x4a0873[_0x3bd0('0x44')]['length']?_0x4a0873[_0x3bd0('0x44')]:_0x350d65[_0x3bd0('0xc7')];_0x4a0873[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x23654a[_0x3bd0('0x3e')]['sort']);_0x4a0873['where']=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x23654a[_0x3bd0('0x3e')],_0x350d65[_0x3bd0('0xca')]));if(_0x23654a[_0x3bd0('0x3e')]['filter']){_0x4a0873[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x4a0873['where'],{'$or':_[_0x3bd0('0x32')](_0x4a0873[_0x3bd0('0x44')],function(_0xe95568){var _0x5a79e3={};_0x5a79e3[_0xe95568]={'$like':'%'+_0x23654a[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x5a79e3;})});}_0x4a0873=_[_0x3bd0('0x52')]({},_0x4a0873,_0x23654a['options']);return _0x52b15f[_0x3bd0('0xdd')](_0x4a0873);}})[_0x3bd0('0x1b')](function(_0x5cbab6){if(_0x5cbab6){_0x45885e=_0x5cbab6['length'];if(!_0x23654a['query']['hasOwnProperty']('nolimit')){_0x4a0873[_0x3bd0('0x18')]=qs['limit'](_0x23654a['query']['limit']);_0x4a0873[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x23654a[_0x3bd0('0x3e')]['offset']);}return _0x52b15f[_0x3bd0('0xdd')](_0x4a0873);}})[_0x3bd0('0x1b')](function(_0x487371){if(_0x487371){return _0x487371?{'count':_0x45885e,'rows':_0x487371}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x50aeee,null))[_0x3bd0('0x50')](handleError(_0x50aeee,null));};exports[_0x3bd0('0xdf')]=function(_0x13ed4d,_0x55d9a6){var _0x508c6c={};var _0x37f48c={};var _0x4acdb8;var _0x3ce534;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x13ed4d['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x55d9a6,null))['then'](function(_0x10cf84){if(_0x10cf84){_0x4acdb8=_0x10cf84;_0x37f48c[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xe0')]['rawAttributes']);_0x37f48c[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x13ed4d[_0x3bd0('0x3e')]);_0x37f48c['filters']=_['intersection'](_0x37f48c['model'],_0x37f48c[_0x3bd0('0x3e')]);_0x508c6c[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x37f48c[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x13ed4d[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x508c6c['attributes']=_0x508c6c[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x508c6c[_0x3bd0('0x44')]:_0x37f48c['model'];_0x508c6c[_0x3bd0('0xcd')]=qs['sort'](_0x13ed4d[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x508c6c[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x13ed4d[_0x3bd0('0x3e')],_0x37f48c[_0x3bd0('0xca')]));if(_0x13ed4d[_0x3bd0('0x3e')]['filter']){_0x508c6c[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x508c6c[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x508c6c[_0x3bd0('0x44')],function(_0xe06427){var _0xf7b6da={};_0xf7b6da[_0xe06427]={'$like':'%'+_0x13ed4d[_0x3bd0('0x3e')]['filter']+'%'};return _0xf7b6da;})});}_0x508c6c=_[_0x3bd0('0x52')]({},_0x508c6c,_0x13ed4d['options']);return _0x4acdb8[_0x3bd0('0xdf')](_0x508c6c);}})[_0x3bd0('0x1b')](function(_0x42c5bd){if(_0x42c5bd){_0x3ce534=_0x42c5bd['length'];if(!_0x13ed4d[_0x3bd0('0x3e')]['hasOwnProperty']('nolimit')){_0x508c6c['limit']=qs[_0x3bd0('0x18')](_0x13ed4d['query']['limit']);_0x508c6c['offset']=qs[_0x3bd0('0x17')](_0x13ed4d['query'][_0x3bd0('0x17')]);}return _0x4acdb8[_0x3bd0('0xdf')](_0x508c6c);}})[_0x3bd0('0x1b')](function(_0xf26d4e){if(_0xf26d4e){return _0xf26d4e?{'count':_0x3ce534,'rows':_0xf26d4e}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x55d9a6,null))[_0x3bd0('0x50')](handleError(_0x55d9a6,null));};exports[_0x3bd0('0xe1')]=function(_0x9a25e,_0x2fd53b){var _0xb1843b={};var _0x276f7a={};var _0x4a2446;var _0x5e6288;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x9a25e['params']['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x2fd53b,null))[_0x3bd0('0x1b')](function(_0x3641b2){if(_0x3641b2){_0x4a2446=_0x3641b2;_0x276f7a[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xe2')][_0x3bd0('0x31')]);_0x276f7a[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x9a25e[_0x3bd0('0x3e')]);_0x276f7a[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x276f7a['model'],_0x276f7a[_0x3bd0('0x3e')]);_0xb1843b[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x276f7a['model'],qs[_0x3bd0('0xcc')](_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0xb1843b[_0x3bd0('0x44')]=_0xb1843b[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0xb1843b['attributes']:_0x276f7a[_0x3bd0('0xc7')];_0xb1843b['order']=qs[_0x3bd0('0xd2')](_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0xb1843b['where']=qs['filters'](_[_0x3bd0('0xce')](_0x9a25e[_0x3bd0('0x3e')],_0x276f7a['filters']));if(_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0xb1843b[_0x3bd0('0x3d')]=_['merge'](_0xb1843b[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0xb1843b[_0x3bd0('0x44')],function(_0x48fbbf){var _0xde53a3={};_0xde53a3[_0x48fbbf]={'$like':'%'+_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0xde53a3;})});}_0xb1843b=_[_0x3bd0('0x52')]({},_0xb1843b,_0x9a25e[_0x3bd0('0xcf')]);return _0x4a2446[_0x3bd0('0xe1')](_0xb1843b);}})[_0x3bd0('0x1b')](function(_0x4a6c63){if(_0x4a6c63){_0x5e6288=_0x4a6c63[_0x3bd0('0x48')];if(!_0x9a25e[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0xb1843b['limit']=qs[_0x3bd0('0x18')](_0x9a25e[_0x3bd0('0x3e')]['limit']);_0xb1843b[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x9a25e['query'][_0x3bd0('0x17')]);}return _0x4a2446[_0x3bd0('0xe1')](_0xb1843b);}})[_0x3bd0('0x1b')](function(_0x234b37){if(_0x234b37){return _0x234b37?{'count':_0x5e6288,'rows':_0x234b37}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x2fd53b,null))[_0x3bd0('0x50')](handleError(_0x2fd53b,null));};exports['login']=function(_0xce427,_0x141e65,_0x46a798){var _0x506df3;var _0x3864e2;var _0x32cad7;var _0x36df62=!_[_0x3bd0('0x60')](_0xce427['params']['id'])?_0xce427[_0x3bd0('0x55')]['id']:!_[_0x3bd0('0x60')](_0xce427['user']['id'])?_0xce427[_0x3bd0('0x23')]['id']:null;return db['User'][_0x3bd0('0x2b')]({'where':{'id':_0x36df62,'role':{'$or':[_0x3bd0('0x22'),_0x3bd0('0x23'),_0x3bd0('0x1d')]}},'attributes':['id',_0x3bd0('0x2c'),'phone',_0x3bd0('0xe3'),'role','internal',_0x3bd0('0x94')]})[_0x3bd0('0x1b')](function(_0x2f3bfa){if(_0x2f3bfa){if(_0x2f3bfa['role']===_0x3bd0('0x1d')){_0x506df3=_0x2f3bfa;if(_0xce427[_0x3bd0('0x54')]['interface']){_0x32cad7=util[_0x3bd0('0xa1')]('LOCAL/%s@from-sip/n',_0x506df3[_0xce427[_0x3bd0('0x54')]['interface']]);}else if(_0xce427[_0x3bd0('0x54')]['intrf']){_0x32cad7=util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0xce427[_0x3bd0('0x54')]['intrf']);}else{_0x32cad7=util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x506df3['name']);}socket['to'](util['format'](_0x3bd0('0xe4'),_0x506df3[_0x3bd0('0x2c')]))[_0x3bd0('0x1e')]('user:forcelogout',{'user':{'id':_0x506df3['id'],'name':_0x506df3[_0x3bd0('0x2c')]},'ip':_0xce427['headers'][_0x3bd0('0xe5')]||_0xce427['connection'][_0x3bd0('0xe6')]||_0xce427[_0x3bd0('0xe7')][_0x3bd0('0xe6')]||_0xce427[_0x3bd0('0xe8')]['socket'][_0x3bd0('0xe6')]});return db[_0x3bd0('0xa4')][_0x3bd0('0x20')]({'where':{'membername':_0x506df3[_0x3bd0('0x2c')]},'individualHooks':!![]});}}else{throw new db[(_0x3bd0('0x87'))][(_0x3bd0('0x89'))](_0x3bd0('0xe9'));}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return _0x506df3[_0x3bd0('0xea')]({'raw':!![]});}})['then'](function(_0x5d6074){if(_0x506df3){if(_0x5d6074){_0x3864e2=_0x5d6074;if(_0x3864e2['length']){var _0x38de65=_0x3864e2[_0x3bd0('0x32')](function(_0x5506e0){var _0x3f3ba7={'membername':_0x506df3[_0x3bd0('0x2c')],'UserId':_0x506df3['id'],'queue_name':_0x5506e0[_0x3bd0('0x2c')],'VoiceQueueId':_0x5506e0['id'],'interface':_0x32cad7,'paused':_0x506df3[_0x3bd0('0x94')]||![],'penalty':_0x5506e0[_0x3bd0('0xeb')]||0x0};return db[_0x3bd0('0xa4')]['upsert'](_0x3f3ba7);});return Promise[_0x3bd0('0x4f')](_0x38de65);}}}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return db['MemberReport'][_0x3bd0('0x82')]({'where':{'membername':_0x506df3[_0x3bd0('0x2c')],'exitAt':null}});}})[_0x3bd0('0x1b')](function(_0x56b572){if(_0x506df3){var _0x374dda=[];_0x56b572[_0x3bd0('0xec')](function(_0x142a55){_0x374dda[_0x3bd0('0x45')](_0x142a55[_0x3bd0('0x53')]({'exitAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))}));});return Promise[_0x3bd0('0x4f')](_0x374dda);}})[_0x3bd0('0x1b')](function(){if(_0x506df3){var _0x40d1f4=[];var _0x4b4e6a=[];var _0x256a98=utils['getChannels']();var _0x37b3d7={'membername':_0x506df3[_0x3bd0('0x2c')],'interface':_0x32cad7,'enterAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x506df3[_0x3bd0('0x1c')],'internal':_0x506df3['internal']};_0x256a98[_0x3bd0('0xec')](function(_0x357aa5){_0x40d1f4[_0x3bd0('0x45')](_[_0x3bd0('0x52')]({'channel':_0x357aa5,'type':_0x3bd0('0xee'),'data1':_0xce427[_0x3bd0('0x54')][_0x3bd0('0xef')],'data2':_0x32cad7},_0x37b3d7));if(_0x506df3['loginInPause']){_0x4b4e6a[_0x3bd0('0x45')](_['merge']({'channel':_0x357aa5,'type':_0x3bd0('0xf0'),'data1':_0x3bd0('0xf1')},_0x37b3d7));}});return db[_0x3bd0('0xf2')][_0x3bd0('0x7f')](_0x40d1f4[_0x3bd0('0xc0')](_0x4b4e6a),{'individualHooks':!![]});}})[_0x3bd0('0x1b')](function(){if(_0x506df3){return _0x506df3[_0x3bd0('0x53')]({'online':!![],'lastLoginAt':moment()['format'](_0x3bd0('0xed')),'voicePause':_0x506df3['loginInPause']||![],'mailPause':_0x506df3[_0x3bd0('0x94')]||![],'chatPause':_0x506df3[_0x3bd0('0x94')]||![],'faxPause':_0x506df3[_0x3bd0('0x94')]||![],'smsPause':_0x506df3[_0x3bd0('0x94')]||![],'openchannelPause':_0x506df3[_0x3bd0('0x94')]||![],'whatsappPause':_0x506df3[_0x3bd0('0x94')]||![],'pauseType':_0x506df3[_0x3bd0('0x94')]?_0x3bd0('0xf1'):null,'interface':_0x32cad7,'lastPauseAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))});}})['then'](function(_0x4888e3){if(_0xce427[_0x3bd0('0xf3')]){return _0x46a798();}else{return Promise['resolve'](_0x4888e3)[_0x3bd0('0x1b')](respondWithResult(_0x141e65,null));}})[_0x3bd0('0x50')](handleError(_0x141e65,null));};exports['logout']=function(_0x1e34c8,_0x5c6178){var _0x4f1d22;return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x1e34c8[_0x3bd0('0x55')]['id'],'role':_0x3bd0('0x1d')},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c')]})[_0x3bd0('0x1b')](handleEntityNotFound(_0x5c6178,null))[_0x3bd0('0x1b')](function(_0x5f214c){if(_0x5f214c){_0x4f1d22=_0x5f214c;return db[_0x3bd0('0xa4')]['destroy']({'where':{'membername':_0x4f1d22['name']},'individualHooks':!![]});}})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0xf2')]['findAll']({'where':{'membername':_0x4f1d22[_0x3bd0('0x2c')],'exitAt':null}});})[_0x3bd0('0x1b')](function(_0x39f129){var _0x27d2fe=[];_0x39f129[_0x3bd0('0xec')](function(_0x5fa440){_0x27d2fe[_0x3bd0('0x45')](_0x5fa440[_0x3bd0('0x53')]({'exitAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x3bd0('0x4f')](_0x27d2fe);})['then'](function(){return _0x4f1d22['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3bd0('0x1b')](respondWithResult(_0x5c6178,null))[_0x3bd0('0x50')](handleError(_0x5c6178,null));};exports[_0x3bd0('0xf4')]=function(_0x52afb7,_0x36a189){var _0x2a7a36;return db[_0x3bd0('0xa4')]['update']({'paused':0x1},{'where':{'UserId':_0x52afb7[_0x3bd0('0x55')]['id']},'individualHooks':!![]})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x30')]['find']({'where':{'id':_0x52afb7[_0x3bd0('0x55')]['id'],'role':'agent'},'attributes':['id',_0x3bd0('0x2c'),_0x3bd0('0x1c'),_0x3bd0('0x5e'),_0x3bd0('0xa0'),'online']});})[_0x3bd0('0x1b')](handleEntityNotFound(_0x36a189,null))[_0x3bd0('0x1b')](function(_0x171138){if(_0x171138){_0x2a7a36=_0x171138;return db[_0x3bd0('0xf2')][_0x3bd0('0x82')]({'where':{'membername':_0x2a7a36[_0x3bd0('0x2c')],'type':_0x3bd0('0xf0'),'exitAt':null}});}})[_0x3bd0('0x1b')](function(_0x45d2f0){if(_0x45d2f0[_0x3bd0('0x48')]){var _0x16509c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x262c2d=0x0,_0x568842=_0x45d2f0['length'];_0x262c2d<_0x568842;_0x262c2d++){_0x45d2f0[_0x262c2d][_0x3bd0('0xf5')]({'exitAt':_0x16509c});}}})[_0x3bd0('0x1b')](function(){var _0x419495=[];var _0x15be9a=utils[_0x3bd0('0xf6')]();_0x15be9a[_0x3bd0('0xec')](function(_0xa71f61){_0x419495[_0x3bd0('0x45')]({'channel':_0xa71f61,'membername':_0x2a7a36[_0x3bd0('0x2c')],'interface':_['isNil'](_0x2a7a36[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x2a7a36['name']):_0x2a7a36[_0x3bd0('0xa0')],'type':_0x3bd0('0xf0'),'enterAt':moment()[_0x3bd0('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x52afb7[_0x3bd0('0x54')]['type']||'DEFAULT\x20PAUSE','role':_0x2a7a36[_0x3bd0('0x1c')],'internal':_0x2a7a36[_0x3bd0('0x5e')]});});return db[_0x3bd0('0xf2')][_0x3bd0('0x7f')](_0x419495,{'individualHooks':!![]});})['then'](function(){return _0x2a7a36[_0x3bd0('0x53')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x52afb7[_0x3bd0('0x54')]['type']||_0x3bd0('0xf7'),'lastPauseAt':moment()[_0x3bd0('0xa1')](_0x3bd0('0xed'))});})[_0x3bd0('0x1b')](respondWithResult(_0x36a189,null))[_0x3bd0('0x50')](handleError(_0x36a189,null));};exports[_0x3bd0('0xf8')]=function(_0x107030,_0x2d2522){if(_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')]&&!utils[_0x3bd0('0x96')](_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')])){throw new APIBadRequestError(util[_0x3bd0('0xa1')](_0x3bd0('0xf9'),_0x107030[_0x3bd0('0x54')]['channel']));}return db[_0x3bd0('0x30')][_0x3bd0('0x2b')]({'where':{'id':_0x107030['params']['id']},'attributes':['id','name',_0x3bd0('0x1c'),_0x3bd0('0x5e'),_0x3bd0('0xa0'),_0x3bd0('0x9f'),'voicePause',_0x3bd0('0xfa'),_0x3bd0('0xfb'),_0x3bd0('0xfc'),_0x3bd0('0xfd'),_0x3bd0('0xfe'),'whatsappPause',_0x3bd0('0xff'),_0x3bd0('0x100')]})['then'](function(_0x2c398f){if(!_0x2c398f){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x107030[_0x3bd0('0x55')]['id']));}return _0x2c398f['unpause'](_0x107030[_0x3bd0('0x54')][_0x3bd0('0x93')]);})[_0x3bd0('0x1b')](respondWithResult(_0x2d2522,null))[_0x3bd0('0x50')](APIHandleError(_0x2d2522));};exports[_0x3bd0('0x101')]=function(_0x2ef423,_0x31674b){var _0x5f4f83={};var _0x547c68={};var _0x21c0cc;var _0x9f0e8e;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x2ef423[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x31674b,null))[_0x3bd0('0x1b')](function(_0x261601){if(_0x261601){_0x21c0cc=_0x261601;_0x547c68['model']=_['keys'](db[_0x3bd0('0x102')][_0x3bd0('0x31')]);_0x547c68[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x2ef423[_0x3bd0('0x3e')]);_0x547c68[_0x3bd0('0xca')]=_['intersection'](_0x547c68[_0x3bd0('0xc7')],_0x547c68['query']);_0x5f4f83[_0x3bd0('0x44')]=_[_0x3bd0('0xcb')](_0x547c68[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x2ef423['query'][_0x3bd0('0xcc')]));_0x5f4f83[_0x3bd0('0x44')]=_0x5f4f83['attributes'][_0x3bd0('0x48')]?_0x5f4f83[_0x3bd0('0x44')]:_0x547c68[_0x3bd0('0xc7')];_0x5f4f83[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x2ef423[_0x3bd0('0x3e')]['sort']);_0x5f4f83['where']=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x2ef423['query'],_0x547c68[_0x3bd0('0xca')]));if(_0x2ef423['query'][_0x3bd0('0x27')]){_0x5f4f83['where']=_[_0x3bd0('0x52')](_0x5f4f83['where'],{'$or':_[_0x3bd0('0x32')](_0x5f4f83[_0x3bd0('0x44')],function(_0x328858){var _0x857a97={};_0x857a97[_0x328858]={'$like':'%'+_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x857a97;})});}_0x5f4f83=_['merge']({},_0x5f4f83,_0x2ef423[_0x3bd0('0xcf')]);return _0x21c0cc['getTeams'](_0x5f4f83);}})[_0x3bd0('0x1b')](function(_0x5738a1){if(_0x5738a1){_0x9f0e8e=_0x5738a1[_0x3bd0('0x48')];if(!_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x5f4f83['limit']=qs[_0x3bd0('0x18')](_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x18')]);_0x5f4f83[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x2ef423[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x21c0cc['getTeams'](_0x5f4f83);}})[_0x3bd0('0x1b')](function(_0x351333){if(_0x351333){return _0x351333?{'count':_0x9f0e8e,'rows':_0x351333}:null;}})[_0x3bd0('0x1b')](respondWithResult(_0x31674b,null))[_0x3bd0('0x50')](handleError(_0x31674b,null));};exports[_0x3bd0('0x103')]=function(_0x179a73,_0x26ffbd){var _0x14de87=_0x179a73[_0x3bd0('0x55')]['id'];var _0x2578fd=_0x179a73[_0x3bd0('0x54')]?_0x179a73[_0x3bd0('0x54')]['ids']:null;var _0x344e5a=[];return Promise[_0x3bd0('0x104')]()['then'](function(){if(!_0x2578fd)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x14de87}});})['then'](function(_0x5f1e8e){if(!_0x5f1e8e)throw new APINotFoundError(util[_0x3bd0('0xa1')](_0x3bd0('0xc1'),_0x179a73[_0x3bd0('0x55')]['id']));return db['sequelize'][_0x3bd0('0x105')](function(_0x461dba){return _0x5f1e8e['addTeams'](_0x2578fd,{'transaction':_0x461dba})['then'](function(){return db[_0x3bd0('0x102')][_0x3bd0('0x82')]({'where':{'id':{'$in':_0x2578fd}}});})[_0x3bd0('0x1b')](function(_0x2f9c2e){var _0x8208c3=_['map'](_0x2f9c2e,function(_0x1fc052){return _0x1fc052[_0x3bd0('0x106')]();});return Promise[_0x3bd0('0x4f')](_0x8208c3);})[_0x3bd0('0x1b')](function(_0x1ac03e){_0x344e5a=_[_0x3bd0('0x107')](_0x1ac03e);var _0x35db04=_[_0x3bd0('0x32')](_0x344e5a,function(_0x2e1a92){return _0x2e1a92[_0x3bd0('0x108')](_0x5f1e8e['id'],{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0x35db04);})[_0x3bd0('0x1b')](function(){if(!_0x5f1e8e[_0x3bd0('0x9f')])return;var _0x387b7a=_[_0x3bd0('0x27')](_0x344e5a,function(_0x2ec79b){return _0x2ec79b['getDataValue'](_0x3bd0('0x93'))===_0x3bd0('0x109');});var _0x10b529=_[_0x3bd0('0x32')](_0x387b7a,function(_0xc16233){return db['UserVoiceQueueRt']['upsert']({'membername':_0x5f1e8e[_0x3bd0('0x2c')],'UserId':_0x5f1e8e['id'],'queue_name':_0xc16233[_0x3bd0('0x2c')],'VoiceQueueId':_0xc16233['id'],'interface':_['isNil'](_0x5f1e8e[_0x3bd0('0xa0')])?util[_0x3bd0('0xa1')](_0x3bd0('0xa2'),_0x5f1e8e[_0x3bd0('0x2c')]):_0x5f1e8e[_0x3bd0('0xa0')],'paused':_0x5f1e8e[_0x3bd0('0x95')]||![],'penalty':_0x5f1e8e[_0x3bd0('0xa3')]},{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0x10b529);})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x10a')]['findAll']({'where':{'teamId':{'$in':_0x2578fd}}});})[_0x3bd0('0x1b')](function(_0x3de85e){var _0xd0766=_[_0x3bd0('0x32')](_0x3de85e,function(_0x4bd264){return db['UserVoicePrefix'][_0x3bd0('0x75')]({'UserId':_0x5f1e8e['id'],'VoicePrefixId':_0x4bd264[_0x3bd0('0x10b')]},{'transaction':_0x461dba});});return Promise[_0x3bd0('0x4f')](_0xd0766);});});})[_0x3bd0('0x1b')](function(){for(var _0x19489b=0x0;_0x19489b<_0x344e5a[_0x3bd0('0x48')];_0x19489b++){var _0x46bf1d=_0x344e5a[_0x19489b][_0x3bd0('0x10c')](_0x3bd0('0x93'));var _0x2df8f9=_0x46bf1d+_0x3bd0('0xa8');socket['emit'](_0x3bd0('0x23')+_0x46bf1d+_0x3bd0('0x10d'),{'UserId':_0x14de87,['queueField']:_0x344e5a[_0x19489b]['id']});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x26ffbd,null))['catch'](APIHandleError(_0x26ffbd));};exports[_0x3bd0('0x10e')]=function(_0xc2dadf,_0x2f9357){var _0x2da3e6=_0xc2dadf['params']['id'];var _0x3686ec=null;if(_0xc2dadf['query']['ids']){_0x3686ec=_[_0x3bd0('0xa7')](_0xc2dadf[_0x3bd0('0x3e')][_0x3bd0('0x58')])?_0xc2dadf[_0x3bd0('0x3e')][_0x3bd0('0x58')]:[_0xc2dadf['query'][_0x3bd0('0x58')]];}var _0x257c16=[];return Promise[_0x3bd0('0x104')]()[_0x3bd0('0x1b')](function(){if(!_0x3686ec)throw new APIBadRequestError(_0x3bd0('0x10f'));})['then'](function(){return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x2da3e6}});})[_0x3bd0('0x1b')](function(_0xaa3fd9){if(!_0xaa3fd9)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xc2dadf[_0x3bd0('0x55')]['id']));return db['sequelize'][_0x3bd0('0x105')](function(_0xb0ba58){return _0xaa3fd9[_0x3bd0('0x10e')](_0x3686ec,{'transaction':_0xb0ba58})['then'](function(){return db['Team'][_0x3bd0('0x82')]({'where':{'id':{'$in':_0x3686ec}}});})[_0x3bd0('0x1b')](function(_0x35a2d2){var _0x5cb13c=_['map'](_0x35a2d2,function(_0x287979){return _0x287979[_0x3bd0('0x106')]();});return Promise[_0x3bd0('0x4f')](_0x5cb13c);})[_0x3bd0('0x1b')](function(_0x45b403){_0x257c16=_[_0x3bd0('0x107')](_0x45b403);var _0x2ea7b6=_['map'](_0x257c16,function(_0x215aa2){return _0x215aa2['removeAgent'](_0xaa3fd9['id'],{'transaction':_0xb0ba58});});return Promise['all'](_0x2ea7b6);})[_0x3bd0('0x1b')](function(){if(!_0xaa3fd9[_0x3bd0('0x9f')])return;var _0x39cf8d=_[_0x3bd0('0x27')](_0x257c16,function(_0x1e7404){return _0x1e7404[_0x3bd0('0x10c')](_0x3bd0('0x93'))==='Voice';});var _0x40166a=_[_0x3bd0('0x32')](_0x39cf8d,function(_0x2c1b70){return db[_0x3bd0('0xa4')][_0x3bd0('0x20')]({'where':{'VoiceQueueId':_0x2c1b70['id'],'UserId':_0xaa3fd9['id']},'transaction':_0xb0ba58});});return Promise[_0x3bd0('0x4f')](_0x40166a);})[_0x3bd0('0x1b')](function(){return db[_0x3bd0('0x10a')][_0x3bd0('0x82')]({'where':{'teamId':{'$in':_0x3686ec}}});})[_0x3bd0('0x1b')](function(_0x24d5b9){var _0x384041=_[_0x3bd0('0x32')](_0x24d5b9,function(_0x25b849){return db['UserVoicePrefix'][_0x3bd0('0x20')]({'where':{'UserId':_0xaa3fd9['id'],'VoicePrefixId':_0x25b849['VoicePrefixId']}},{'transaction':_0xb0ba58});});return Promise[_0x3bd0('0x4f')](_0x384041);});});})[_0x3bd0('0x1b')](function(){for(var _0x2b6003=0x0;_0x2b6003<_0x257c16[_0x3bd0('0x48')];_0x2b6003++){var _0x40cdba=_0x257c16[_0x2b6003][_0x3bd0('0x10c')](_0x3bd0('0x93'));var _0x9b311d=_0x40cdba+_0x3bd0('0xa8');socket[_0x3bd0('0x1e')](_0x3bd0('0x23')+_0x40cdba+'Queue:remove',{'UserId':_0x2da3e6,['queueField']:_0x257c16[_0x2b6003]['id']});}})[_0x3bd0('0x1b')](respondWithStatusCode(_0x2f9357,null))['catch'](APIHandleError(_0x2f9357));};exports[_0x3bd0('0x110')]=function(_0x3345b7,_0x9f1c8a){var _0x17baa2={};var _0x5c5cb2={};var _0x4487c5;var _0x465df6;return db[_0x3bd0('0x30')][_0x3bd0('0x8c')]({'where':{'id':_0x3345b7[_0x3bd0('0x55')]['id']}})[_0x3bd0('0x1b')](handleEntityNotFound(_0x9f1c8a,null))['then'](function(_0x1b6975){if(_0x1b6975){_0x4487c5=_0x1b6975;_0x5c5cb2[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0xc3')][_0x3bd0('0x31')]);_0x5c5cb2[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x3345b7['query']);_0x5c5cb2['filters']=_['intersection'](_0x5c5cb2[_0x3bd0('0xc7')],_0x5c5cb2[_0x3bd0('0x3e')]);_0x17baa2[_0x3bd0('0x44')]=_['intersection'](_0x5c5cb2[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x3345b7['query'][_0x3bd0('0xcc')]));_0x17baa2[_0x3bd0('0x44')]=_0x17baa2[_0x3bd0('0x44')][_0x3bd0('0x48')]?_0x17baa2['attributes']:_0x5c5cb2['model'];_0x17baa2[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0xd2')]);_0x17baa2[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x3345b7['query'],_0x5c5cb2[_0x3bd0('0xca')]));if(_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0x27')]){_0x17baa2[_0x3bd0('0x3d')]=_[_0x3bd0('0x52')](_0x17baa2[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x17baa2[_0x3bd0('0x44')],function(_0x71be7a){var _0xfb27cc={};_0xfb27cc[_0x71be7a]={'$like':'%'+_0x3345b7[_0x3bd0('0x3e')]['filter']+'%'};return _0xfb27cc;})});}_0x17baa2=_[_0x3bd0('0x52')]({},_0x17baa2,_0x3345b7['options']);return _0x4487c5[_0x3bd0('0x110')](_0x17baa2);}})[_0x3bd0('0x1b')](function(_0x87c049){if(_0x87c049){_0x465df6=_0x87c049[_0x3bd0('0x48')];if(!_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0xc2')](_0x3bd0('0xd0'))){_0x17baa2['limit']=qs[_0x3bd0('0x18')](_0x3345b7['query'][_0x3bd0('0x18')]);_0x17baa2[_0x3bd0('0x17')]=qs[_0x3bd0('0x17')](_0x3345b7[_0x3bd0('0x3e')][_0x3bd0('0x17')]);}return _0x4487c5['getLists'](_0x17baa2);}})['then'](function(_0x858b00){if(_0x858b00){return _0x858b00?{'count':_0x465df6,'rows':_0x858b00}:null;}})['then'](respondWithResult(_0x9f1c8a,null))[_0x3bd0('0x50')](handleError(_0x9f1c8a,null));};exports['getAgents']=function(_0x477b4f,_0xe65f50){var _0x31a34f={};var _0x13f774={};var _0x4ef333;return db['User']['findOne']({'where':{'id':_0x477b4f[_0x3bd0('0x55')]['id']}})['then'](handleEntityNotFound(_0xe65f50,null))[_0x3bd0('0x1b')](function(_0x4032f4){if(_0x4032f4){_0x4ef333=_0x4032f4;_0x13f774[_0x3bd0('0xc7')]=_[_0x3bd0('0xc8')](db[_0x3bd0('0x30')][_0x3bd0('0x31')]);_0x13f774[_0x3bd0('0x3e')]=_[_0x3bd0('0xc8')](_0x477b4f[_0x3bd0('0x3e')]);_0x13f774[_0x3bd0('0xca')]=_[_0x3bd0('0xcb')](_0x13f774['model'],_0x13f774['query']);_0x31a34f['attributes']=_[_0x3bd0('0xcb')](_0x13f774[_0x3bd0('0xc7')],qs[_0x3bd0('0xcc')](_0x477b4f[_0x3bd0('0x3e')][_0x3bd0('0xcc')]));_0x31a34f[_0x3bd0('0x44')]=_0x31a34f['attributes'][_0x3bd0('0x48')]?_0x31a34f[_0x3bd0('0x44')]:_0x13f774[_0x3bd0('0xc7')];_0x31a34f[_0x3bd0('0xcd')]=qs[_0x3bd0('0xd2')](_0x477b4f[_0x3bd0('0x3e')]['sort']);_0x31a34f[_0x3bd0('0x3d')]=qs[_0x3bd0('0xca')](_[_0x3bd0('0xce')](_0x477b4f[_0x3bd0('0x3e')],_0x13f774[_0x3bd0('0xca')]));if(_0x477b4f[_0x3bd0('0x3e')]['filter']){_0x31a34f[_0x3bd0('0x3d')]=_['merge'](_0x31a34f[_0x3bd0('0x3d')],{'$or':_[_0x3bd0('0x32')](_0x31a34f[_0x3bd0('0x44')],function(_0x50f15d){var _0x463cd4={};_0x463cd4[_0x50f15d]={'$like':'%'+_0x477b4f[_0x3bd0('0x3e')][_0x3bd0('0x27')]+'%'};return _0x463cd4;})});}_0x31a34f['model']=db[_0x3bd0('0x30')];_0x31a34f['as']=_0x3bd0('0x24');_0x31a34f=_[_0x3bd0('0x52')]({},_0x31a34f,_0x477b4f[_0x3bd0('0xcf')]);return _0x4ef333[_0x3bd0('0xea')]({'include':[_0x31a34f]});}})[_0x3bd0('0x1b')](function(_0x385344){if(_0x385344){var _0x5c02db={},_0x266926=[];for(var _0x299259=0x0;_0x299259<_0x385344['length'];_0x299259+=0x1){for(var _0x5809ac=0x0,_0x3a7aa3;_0x5809ac<_0x385344[_0x299259][_0x3bd0('0x24')][_0x3bd0('0x48')];_0x5809ac+=0x1){_0x3a7aa3=_0x385344[_0x299259][_0x3bd0('0x24')][_0x5809ac][_0x3bd0('0x21')]({'plain':!![]});_0x5c02db[_0x3a7aa3['id']]=_0x3a7aa3;}}_0x5c02db=_[_0x3bd0('0x111')](_0x5c02db);for(var _0x4cf1aa=qs[_0x3bd0('0x17')](_0x477b4f[_0x3bd0('0x3e')]['offset']);_0x4cf1aa<_0x5c02db[_0x3bd0('0x48')]&&_0x266926[_0x3bd0('0x48')]=_0x2d7687){_0x3a2e27=_0x2d7687;_0x304e8d=0xc8;}else{_0x304e8d=0xce;}_0x229a0e['status'](_0x304e8d);return _0x229a0e[_0x5894('0x19')](_0x5894('0x1a'),_0x398928+'-'+_0x3a2e27+'/'+_0x2d7687)[_0x5894('0x1b')](_0x52cb1e);}return null;};}function saveUpdates(_0x83b003){return function(_0x1f9f10){if(_0x1f9f10){return _0x1f9f10[_0x5894('0x1c')](_0x83b003)['then'](function(_0xd51aae){if(_0xd51aae[_0x5894('0x1d')]===_0x5894('0x1e')){socket[_0x5894('0x1f')](_0x5894('0x20')+_0xd51aae['id'],_0xd51aae);}return _0xd51aae;});}return null;};}function removeEntity(_0x42ddd7){return function(_0xfcb5ee){if(_0xfcb5ee){return _0xfcb5ee[_0x5894('0x21')]()[_0x5894('0x22')](function(){var _0x3a35a=_0xfcb5ee[_0x5894('0x23')]({'plain':!![]});if(_0x3a35a[_0x5894('0x1d')]==='admin')return;var _0x165900=[{'name':_0x5894('0x24'),'value':_0x5894('0x25'),'ignore':!![]},{'name':'Agents','value':_0x5894('0x1e'),'ignore':![]},{'name':_0x5894('0x26'),'value':'telephone','ignore':![]}];var _0x5e3132=_(_0x165900)[_0x5894('0x27')]('ignore')['map'](_0x5894('0x28'))[_0x5894('0x28')]();if(_['includes'](_0x5e3132,_0x3a35a[_0x5894('0x1d')])){return;}var _0x4d2acd=_[_0x5894('0x29')](_0x165900,[_0x5894('0x28'),_0x3a35a[_0x5894('0x1d')]])[_0x5894('0x2a')];return db[_0x5894('0x2b')][_0x5894('0x21')]({'where':{'type':_0x4d2acd,'resourceId':_0x3a35a['id']}})[_0x5894('0x22')](function(){return _0xfcb5ee;});})['then'](function(){_0x42ddd7[_0x5894('0x2c')](0xcc)[_0x5894('0x2d')]();});}};}function handleEntityNotFound(_0x2409ad){return function(_0x2550ff){if(!_0x2550ff){_0x2409ad[_0x5894('0x14')](0x194);}return _0x2550ff;};}function handleError(_0x104f8a,_0x5b05d3){_0x5b05d3=_0x5b05d3||0x1f4;return function(_0x75f90e){logger[_0x5894('0x2e')](_0x75f90e['stack']);if(_0x75f90e[_0x5894('0x2a')]){delete _0x75f90e[_0x5894('0x2a')];}_0x104f8a[_0x5894('0x2c')](_0x5b05d3)[_0x5894('0x2f')](_0x75f90e);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x5894('0x30')](function(_0xb52340){return{'name':_0xb52340['fieldName'],'type':_0xb52340['type'][_0x5894('0x31')]};})[_0x5894('0x27')](function(_0x3beb18){return![_0x5894('0x32'),_0x5894('0x33'),_0x5894('0x34'),_0x5894('0x35'),_0x5894('0x36'),_0x5894('0x37')][_0x5894('0x38')](_0x3beb18[_0x5894('0x2a')]);})[_0x5894('0x28')]();}exports['index']=function(_0x86adf3,_0x554139){var _0x1f1d8d={},_0x88c402={'count':0x0,'rows':[]};var _0x400e20=getUserAttributes();_0x1f1d8d=qs[_0x5894('0x39')](_0x400e20,_0x86adf3);var _0x488a94={'where':_0x1f1d8d[_0x5894('0x3a')]};return db[_0x5894('0x3b')]['count'](_0x488a94)[_0x5894('0x22')](function(_0xf9dd1b){_0x88c402[_0x5894('0x18')]=_0xf9dd1b;if(_0x86adf3[_0x5894('0x3c')][_0x5894('0x3d')]){_0x1f1d8d[_0x5894('0x3e')]=[{'all':!![]}];}if(_0x86adf3[_0x5894('0x3c')]['userSetting']===_0x5894('0x3f')){_0x1f1d8d[_0x5894('0x3e')]=[{'model':db['UserSetting'],'as':_0x5894('0x40')}];}if(!_[_0x5894('0x38')](_0x1f1d8d[_0x5894('0x41')],'id')){_0x1f1d8d['attributes']['push']('id');}return db[_0x5894('0x3b')][_0x5894('0x42')](_0x1f1d8d);})[_0x5894('0x22')](function(_0x22bccf){_0x88c402[_0x5894('0x43')]=_0x22bccf;if(_0x86adf3[_0x5894('0x3c')][_0x5894('0x44')]===_0x5894('0x3f')){var _0x5df8d7=[];for(var _0x50b9ab=0x0;_0x50b9ab<_0x88c402[_0x5894('0x43')][_0x5894('0x45')];_0x50b9ab++){_0x5df8d7[_0x5894('0x46')](get_open_tabs(_0x5894('0x47'),_0x88c402[_0x5894('0x43')][_0x50b9ab]['dataValues']));_0x5df8d7['push'](get_open_tabs(_0x5894('0x48'),_0x88c402[_0x5894('0x43')][_0x50b9ab][_0x5894('0x49')]));_0x5df8d7['push'](get_open_tabs(_0x5894('0x4a'),_0x88c402[_0x5894('0x43')][_0x50b9ab][_0x5894('0x49')]));_0x5df8d7[_0x5894('0x46')](get_open_tabs(_0x5894('0x4b'),_0x88c402['rows'][_0x50b9ab][_0x5894('0x49')]));_0x5df8d7['push'](get_open_tabs(_0x5894('0x4c'),_0x88c402[_0x5894('0x43')][_0x50b9ab][_0x5894('0x49')]));_0x5df8d7[_0x5894('0x46')](get_open_tabs(_0x5894('0x4d'),_0x88c402[_0x5894('0x43')][_0x50b9ab]['dataValues']));}return Promise[_0x5894('0x4e')](_0x5df8d7)['then'](function(){return _0x88c402;});}else{return _0x88c402;}})['then'](respondWithFilteredResult(_0x554139,_0x1f1d8d))[_0x5894('0x4f')](handleError(_0x554139,null));};exports[_0x5894('0x50')]=function(_0x4278de,_0x5a7e76){var _0x17461d=getUserAttributes();_0x4278de[_0x5894('0x3c')]['id']=_0x4278de[_0x5894('0x51')]['id'];var _0x36cbc6=qs[_0x5894('0x39')](_0x17461d,_0x4278de);if(_0x4278de[_0x5894('0x3c')][_0x5894('0x3d')]){_0x36cbc6[_0x5894('0x3e')]=[{'all':!![]}];}if(_0x4278de['query']['userSetting']===_0x5894('0x3f')){_0x36cbc6[_0x5894('0x3e')]=[{'model':db[_0x5894('0x52')],'as':'userSetting'}];}_0x36cbc6=_[_0x5894('0x53')]({},_0x36cbc6,_0x4278de[_0x5894('0x54')]);if(!_[_0x5894('0x38')](_0x36cbc6['attributes'],'id')){_0x36cbc6[_0x5894('0x41')][_0x5894('0x46')]('id');}return db['User'][_0x5894('0x29')](_0x36cbc6)[_0x5894('0x22')](handleEntityNotFound(_0x5a7e76,null))[_0x5894('0x22')](function(_0x5bfd69){var _0x4e0704=[];values=_0x5bfd69;if(_0x4278de[_0x5894('0x3c')][_0x5894('0x44')]===_0x5894('0x3f')){_0x4e0704[_0x5894('0x46')](get_open_tabs('chat',_0x5bfd69[_0x5894('0x49')]));_0x4e0704[_0x5894('0x46')](get_open_tabs(_0x5894('0x48'),_0x5bfd69[_0x5894('0x49')]));_0x4e0704[_0x5894('0x46')](get_open_tabs('openchannel',_0x5bfd69[_0x5894('0x49')]));_0x4e0704[_0x5894('0x46')](get_open_tabs(_0x5894('0x4d'),_0x5bfd69[_0x5894('0x49')]));_0x4e0704[_0x5894('0x46')](get_open_tabs('fax',_0x5bfd69[_0x5894('0x49')]));_0x4e0704[_0x5894('0x46')](get_open_tabs(_0x5894('0x4b'),_0x5bfd69['dataValues']));return Promise[_0x5894('0x4e')](_0x4e0704);}else{return values;}})[_0x5894('0x22')](function(){return values;})[_0x5894('0x22')](respondWithResult(_0x5a7e76,null))[_0x5894('0x4f')](handleError(_0x5a7e76,null));};exports['update']=function(_0x37616f,_0x5120b0){if(_0x37616f[_0x5894('0x55')]['id']){delete _0x37616f[_0x5894('0x55')]['id'];}delete _0x37616f[_0x5894('0x55')][_0x5894('0x1d')];return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x37616f[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0x5120b0,null))[_0x5894('0x22')](saveUpdates(_0x37616f[_0x5894('0x55')],null))[_0x5894('0x22')](respondWithResult(_0x5120b0,null))[_0x5894('0x4f')](handleError(_0x5120b0,null));};exports[_0x5894('0x56')]=function(_0x515a23,_0x1a4d21){return db[_0x5894('0x3b')]['describe']()[_0x5894('0x22')](respondWithResult(_0x1a4d21,null))[_0x5894('0x4f')](handleError(_0x1a4d21,null));};exports[_0x5894('0x57')]=function(_0x298969,_0x39f26d){return db[_0x5894('0x3b')]['find']({'where':{'id':_0x298969[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x39f26d,null))['then'](function(_0x36d580){if(_0x36d580){return _0x36d580[_0x5894('0x57')](_0x298969[_0x5894('0x55')][_0x5894('0x58')],_[_0x5894('0x59')](_0x298969['body'],[_0x5894('0x58'),'id'])||{});}})[_0x5894('0x22')](respondWithResult(_0x39f26d,null))[_0x5894('0x4f')](handleError(_0x39f26d,null));};function validateUser(_0xdc7dc1){return new Promise(function(_0x49cfe7,_0x211da2){if(_0xdc7dc1['internal'])return _0x49cfe7(_0xdc7dc1);return db['Setting']['findById'](0x1)[_0x5894('0x22')](function(_0x43b425){if(_0x43b425['securePassword'])authService[_0x5894('0x5a')](_0xdc7dc1['password']);db[_0x5894('0x3b')][_0x5894('0x5b')]('internal')[_0x5894('0x22')](function(_0x26f96e){if(_[_0x5894('0x5c')](_0x26f96e)){_0xdc7dc1[_0x5894('0x5d')]=_0x43b425[_0x5894('0x5e')]||0x1;return;}if(_['isNil'](_0x43b425[_0x5894('0x5e')])||_0x43b425['min_internal']===_0x26f96e){_0xdc7dc1['internal']=_0x26f96e+0x1;return;}if(_0x43b425['min_internal']>_0x26f96e){_0xdc7dc1[_0x5894('0x5d')]=_0x43b425[_0x5894('0x5e')];return;}return db['sequelize'][_0x5894('0x3c')](_0x5894('0x5f'),{'type':db['sequelize'][_0x5894('0x60')][_0x5894('0x61')]})[_0x5894('0x22')](function(_0x43f1d3){if(_0x43f1d3&&_0x43f1d3[_0x5894('0x45')]){for(var _0x257411=0x0,_0x3fdd9a=_0x43f1d3[_0x5894('0x45')];_0x257411<_0x3fdd9a&&_[_0x5894('0x5c')](_0xdc7dc1[_0x5894('0x5d')]);_0x257411++){if(_0x43b425[_0x5894('0x5e')]<=_0x43f1d3[_0x257411]['from']){_0xdc7dc1['internal']=_0x43f1d3[_0x257411][_0x5894('0x62')];}else if(_0x43b425[_0x5894('0x5e')]>_0x43f1d3[_0x257411]['from']&&_0x43b425[_0x5894('0x5e')]<=_0x43f1d3[_0x257411]['to']){_0xdc7dc1[_0x5894('0x5d')]=_0x43b425[_0x5894('0x5e')];}}}if(_[_0x5894('0x5c')](_0xdc7dc1[_0x5894('0x5d')])){_0xdc7dc1[_0x5894('0x5d')]=_0x26f96e+0x1;}return _0x49cfe7(_0xdc7dc1);});});})[_0x5894('0x4f')](function(_0x36cef9){_0x211da2(_0x36cef9);});});}function updateUser(_0x4034c5){return new Promise(function(_0x1abd4d,_0x50ce00){try{if(_0x4034c5[_0x5894('0x63')]){_0x4034c5['mailbox']=_0x4034c5['internal'];_0x4034c5[_0x5894('0x64')]={'mailbox':_0x4034c5['internal'],'password':_0x4034c5[_0x5894('0x32')],'fullname':_0x4034c5[_0x5894('0x65')],'email':_0x4034c5['email']};}if(_0x4034c5[_0x5894('0x1d')]===_0x5894('0x1e')){if(!_0x4034c5['permissions'])_0x4034c5[_0x5894('0x66')]=[_0x5894('0x67'),_0x5894('0x68'),_0x5894('0x69'),_0x5894('0x6a'),_0x5894('0x6b'),_0x5894('0x6c'),_0x5894('0x6d'),_0x5894('0x6e'),_0x5894('0x6f'),'108','109',_0x5894('0x70'),_0x5894('0x71'),'114',_0x5894('0x72')];}_0x1abd4d(_0x4034c5);}catch(_0xab4400){_0x50ce00(_0xab4400);}});}exports[_0x5894('0x73')]=function(_0x2f0bad,_0x44b950){if(_0x2f0bad['user']['role']===_0x5894('0x1e'))throw new Error(_0x5894('0x74'));if(_0x2f0bad[_0x5894('0x55')][_0x5894('0x1d')]==='user'&&_0x2f0bad[_0x5894('0x25')][_0x5894('0x1d')]!==_0x5894('0x75')){throw new Error(_0x5894('0x76'));}if(_0x2f0bad[_0x5894('0x55')][_0x5894('0x1d')]===_0x5894('0x75')&&_0x2f0bad[_0x5894('0x25')][_0x5894('0x1d')]!=='admin'){throw new Error(_0x5894('0x77'));}return licenseUtil[_0x5894('0x78')]([_0x2f0bad[_0x5894('0x55')]])[_0x5894('0x22')](function(){return validateUser(_0x2f0bad[_0x5894('0x55')]);})[_0x5894('0x22')](function(_0x312a13){return updateUser(_0x312a13)[_0x5894('0x22')](function(_0x308800){if(_0x308800[_0x5894('0x1d')]===_0x5894('0x75')){_0x308800['settingsEnabled']=_0x2f0bad[_0x5894('0x25')][_0x5894('0x79')];delete _0x308800[_0x5894('0x7a')];}return _0x308800;});})[_0x5894('0x22')](function(_0x57b1d7){return db[_0x5894('0x3b')][_0x5894('0x73')](_0x57b1d7,{'include':[{'model':db[_0x5894('0x64')],'as':_0x5894('0x64')}]});})[_0x5894('0x22')](function(_0x34bf33){if(_0x2f0bad[_0x5894('0x55')]['role']===_0x5894('0x25'))return _0x34bf33;if(_0x2f0bad[_0x5894('0x25')]['role']!==_0x5894('0x25'))return _0x34bf33;return db[_0x5894('0x7b')][_0x5894('0x29')]({'where':{'name':_0x34bf33['role']==='agent'?'Agents':_0x5894('0x26'),'userProfileId':_0x2f0bad[_0x5894('0x25')][_0x5894('0x7a')]},'raw':!![]})['then'](function(_0x381ec8){if(!_0x381ec8||_0x381ec8[_0x5894('0x7c')]!=0x0)return _0x34bf33;return db[_0x5894('0x2b')][_0x5894('0x73')]({'name':_0x34bf33[_0x5894('0x2a')],'resourceId':_0x34bf33['id'],'type':_0x381ec8[_0x5894('0x2a')],'sectionId':_0x381ec8['id']},{})[_0x5894('0x22')](function(){return _0x34bf33;});})['catch'](function(_0x35adfb){logger['error'](_0x5894('0x7d'),_0x35adfb);throw _0x35adfb;});})['then'](respondWithResult(_0x44b950,0xc9))[_0x5894('0x4f')](handleError(_0x44b950,null));};exports['bulkCreate']=function(_0x5767b9,_0x446a71){var _0x352af3=_0x5767b9[_0x5894('0x55')];var _0xbba23e=[];if(_0x5767b9[_0x5894('0x25')][_0x5894('0x1d')]===_0x5894('0x1e'))throw new Error(_0x5894('0x74'));if(_[_0x5894('0x7e')](_0x352af3,[_0x5894('0x1d'),_0x5894('0x25')])&&_0x5767b9[_0x5894('0x25')][_0x5894('0x1d')]!==_0x5894('0x75')){throw new Error(_0x5894('0x76'));}if(_[_0x5894('0x7e')](_0x352af3,['role','admin'])&&_0x5767b9['user'][_0x5894('0x1d')]!==_0x5894('0x75')){throw new Error(_0x5894('0x7f'));}return licenseUtil[_0x5894('0x78')](_0x352af3)['then'](function(){return validateUser(_0x352af3[0x0]);})['then'](function(){for(var _0x24be26=0x1;_0x24be26<_0x352af3[_0x5894('0x45')];_0x24be26++){var _0x43cee8=_0x352af3[_0x24be26-0x1][_0x5894('0x5d')];if(!_0x352af3[_0x24be26][_0x5894('0x5d')])_0x352af3[_0x24be26][_0x5894('0x5d')]=_0x43cee8+0x1;_0xbba23e[_0x5894('0x46')](validateUser(_0x352af3[_0x24be26]));}return Promise['all'](_0xbba23e);})['then'](function(){_0xbba23e=[];for(var _0x216413=0x0;_0x216413<_0x352af3[_0x5894('0x45')];_0x216413++){_0xbba23e[_0x5894('0x46')](updateUser(_0x352af3[_0x216413]));}return Promise[_0x5894('0x4e')](_0xbba23e);})[_0x5894('0x22')](function(){_0xbba23e=_0x352af3[_0x5894('0x30')](function(_0x1feef5){return db[_0x5894('0x3b')][_0x5894('0x73')](_0x1feef5,{'include':[{'model':db[_0x5894('0x64')],'as':_0x5894('0x64')}]})['then'](function(_0x2f04e2){_0x1feef5['id']=_0x2f04e2['id'];return _0x1feef5;});});return Promise['all'](_0xbba23e);})['then'](function(_0x2bc974){if(_0x5767b9[_0x5894('0x55')][_0x5894('0x1d')]==='user')return _0x2bc974;if(_0x5767b9[_0x5894('0x25')][_0x5894('0x1d')]!=='user')return _0x2bc974;var _0x516d27=_[_0x5894('0x7e')](_0x2bc974,function(_0xdc20f4){return _0xdc20f4[_0x5894('0x1d')]===_0x5894('0x1e')||_0xdc20f4[_0x5894('0x1d')]===_0x5894('0x80');});if(!_0x516d27)return _0x2bc974;return db['UserProfileSection'][_0x5894('0x42')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5767b9['user'][_0x5894('0x7a')]},'raw':!![]})[_0x5894('0x22')](function(_0x4397a6){if(_['isEmpty'](_0x4397a6)||!_['some'](_0x4397a6,[_0x5894('0x7c'),0x0]))return _0x2bc974;_0xbba23e=[];var _0x24fea3=_(_0x4397a6)['map'](function(_0x949443){if(_0x949443['autoAssociation']===0x1)return;return _0x949443[_0x5894('0x2a')]===_0x5894('0x81')?'agent':_0x5894('0x80');})['compact']()['value']();for(var _0x12d5b6=0x0;_0x12d5b6<_0x2bc974[_0x5894('0x45')];_0x12d5b6++){if(!_[_0x5894('0x38')](_0x24fea3,_0x2bc974[_0x12d5b6][_0x5894('0x1d')]))return;var _0x3c4c2d=_0x2bc974[_0x12d5b6][_0x5894('0x1d')]==='agent'?'Agents':_0x5894('0x26');_0xbba23e['push'](db[_0x5894('0x2b')]['create']({'name':_0x2bc974[_0x12d5b6]['name'],'resourceId':_0x2bc974[_0x12d5b6]['id'],'type':_0x3c4c2d,'sectionId':_[_0x5894('0x29')](_0x4397a6,[_0x5894('0x2a'),_0x3c4c2d])['id']},{}));}return Promise[_0x5894('0x4e')](_0xbba23e);});})['then'](respondWithResult(_0x446a71,0xc9))[_0x5894('0x4f')](handleError(_0x446a71,null));};exports[_0x5894('0x82')]=function(_0xf24dd7,_0x513e25){if(_0xf24dd7[_0x5894('0x55')]['id']){delete _0xf24dd7[_0x5894('0x55')]['id'];}return db[_0x5894('0x3b')]['find']({'where':{'id':_0xf24dd7[_0x5894('0x51')]['id']}})[_0x5894('0x22')](function(_0x4db560){if(!_0x4db560)return null;if(_0x4db560['id']===_0xf24dd7[_0x5894('0x25')]['id']){if(!_0xf24dd7[_0x5894('0x55')][_0x5894('0x83')]||!_0xf24dd7[_0x5894('0x55')][_0x5894('0x84')]){throw new db[(_0x5894('0x85'))][(_0x5894('0x86'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4db560['authenticate'](_0xf24dd7[_0x5894('0x55')][_0x5894('0x83')])){throw new db[(_0x5894('0x85'))]['ValidationError'](_0x5894('0x87'));}if(_0xf24dd7['body'][_0x5894('0x83')]===_0xf24dd7[_0x5894('0x55')][_0x5894('0x84')]){throw new db[(_0x5894('0x85'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xf24dd7[_0x5894('0x25')][_0x5894('0x1d')]===_0x5894('0x75')){if(!_0xf24dd7[_0x5894('0x55')]['newPassword']){throw new db[(_0x5894('0x85'))][(_0x5894('0x86'))](_0x5894('0x88'));}}else if(_0xf24dd7[_0x5894('0x25')][_0x5894('0x1d')]===_0x5894('0x25')){if(!_0xf24dd7[_0x5894('0x55')]['newPassword']){throw new db['Sequelize'][(_0x5894('0x86'))](_0x5894('0x88'));}if(_0x4db560['role']!==_0x5894('0x1e')){throw new db[(_0x5894('0x85'))][(_0x5894('0x86'))](_0x5894('0x74'));}}else{throw new db['Sequelize'][(_0x5894('0x86'))](_0x5894('0x74'));}return _0x4db560;})[_0x5894('0x22')](handleEntityNotFound(_0x513e25,null))[_0x5894('0x22')](function(_0x3b3f2c){return db[_0x5894('0x89')][_0x5894('0x8a')]({'attributes':['id','securePassword',_0x5894('0x8b'),_0x5894('0x8c')]})[_0x5894('0x22')](function(_0x1c2434){if(_0x1c2434['securePassword'])authService[_0x5894('0x5a')](_0xf24dd7[_0x5894('0x55')][_0x5894('0x84')]);if(!_0x1c2434[_0x5894('0x8b')]||!_0x3b3f2c[_0x5894('0x34')])return _0x3b3f2c;authService[_0x5894('0x8d')](_0xf24dd7[_0x5894('0x55')][_0x5894('0x84')],_0x3b3f2c[_0x5894('0x34')],_0x1c2434[_0x5894('0x8c')]);return _0x3b3f2c;})[_0x5894('0x22')](saveUpdates({'password':_0xf24dd7[_0x5894('0x55')][_0x5894('0x84')],'passwordResetAt':_0xf24dd7[_0x5894('0x25')]['id']==_0xf24dd7[_0x5894('0x51')]['id']?moment():null,'previousPasswords':authService[_0x5894('0x8e')](_0xf24dd7['body']['newPassword'],_0x3b3f2c[_0x5894('0x34')])},null));})[_0x5894('0x22')](respondWithResult(_0x513e25,null))[_0x5894('0x4f')](handleError(_0x513e25,null));};exports[_0x5894('0x8f')]=function(_0x4de019,_0x183082){var _0x5b9924=_0x4de019[_0x5894('0x55')][_0x5894('0x90')];return db[_0x5894('0x3b')]['find']({'where':{'id':_0x4de019[_0x5894('0x51')]['id']},'attributes':['id',_0x5894('0x2a'),_0x5894('0x1d'),_0x5894('0x91'),'loginInPause','voicePause',_0x5894('0x92')]})[_0x5894('0x22')](handleEntityNotFound(_0x183082,null))[_0x5894('0x22')](function(_0x4800cb){if(_0x4800cb){if(!utils[_0x5894('0x93')](_0x5b9924)){throw new db['Sequelize'][(_0x5894('0x86'))](_0x5894('0x94'));}return _0x4800cb[_0x5894('0x95')+_[_0x5894('0x96')](_0x5b9924[_0x5894('0x97')]())+_0x5894('0x98')](_0x4de019[_0x5894('0x55')][_0x5894('0x58')],{'penalty':_0x4de019[_0x5894('0x55')][_0x5894('0x99')]||0x0})[_0x5894('0x9a')](function(_0x1f0086){for(var _0x47ad70=0x0;_0x47ad70<_0x4de019['body'][_0x5894('0x58')][_0x5894('0x45')];_0x47ad70+=0x1){var _0x144241={'UserId':Number(_0x4de019[_0x5894('0x51')]['id'])};_0x144241[_[_0x5894('0x96')](_0x5b9924[_0x5894('0x97')]())+_0x5894('0x9b')]=Number(_0x4de019[_0x5894('0x55')][_0x5894('0x58')][_0x47ad70]);socket['emit'](_0x5894('0x25')+_['capitalize'](_0x5b9924[_0x5894('0x97')]())+_0x5894('0x9c'),_0x144241);}return _0x1f0086;})[_0x5894('0x22')](function(){if(_0x5b9924===_0x5894('0x9d')){return db[_0x5894('0x9e')][_0x5894('0x42')]({'where':{'id':_0x4de019['body'][_0x5894('0x58')]||[]},'raw':!![],'attributes':['id',_0x5894('0x2a')]});}})[_0x5894('0x22')](function(_0xb267c4){var _0x12ec84=_0x4800cb['get']({'plain':!![]});var _0x27b3c7=[];if(_0x5b9924===_0x5894('0x9d')&&_0x12ec84[_0x5894('0x1d')]===_0x5894('0x1e')&&_0x12ec84[_0x5894('0x91')]){for(let _0x3c86ae=0x0;_0x3c86ae<_0xb267c4[_0x5894('0x45')];_0x3c86ae+=0x1){_0x27b3c7[_0x5894('0x46')]({'membername':_0x12ec84[_0x5894('0x2a')],'UserId':_0x12ec84['id'],'queue_name':_0xb267c4[_0x3c86ae][_0x5894('0x2a')],'VoiceQueueId':_0xb267c4[_0x3c86ae]['id'],'interface':_[_0x5894('0x5c')](_0x12ec84['interface'])?util[_0x5894('0x9f')](_0x5894('0xa0'),_0x12ec84['name']):_0x12ec84[_0x5894('0x92')],'paused':_0x12ec84[_0x5894('0xa1')]||![],'penalty':_0x4de019[_0x5894('0x55')]['penalty']||0x0});}return Promise[_0x5894('0x4e')](_0x27b3c7[_0x5894('0x30')](function(_0x428264){return db[_0x5894('0xa2')]['upsert'](_0x428264);}));}return _0x4800cb;});}})[_0x5894('0x22')](respondWithStatusCode(_0x183082,null))[_0x5894('0x4f')](handleError(_0x183082,null));};exports['removeQueues']=function(_0x273dc8,_0x5dbd6e){var _0x3c8792,_0x139192;return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x273dc8['params']['id']},'attributes':['id',_0x5894('0x2a'),_0x5894('0x1d')]})[_0x5894('0x22')](handleEntityNotFound(_0x5dbd6e,null))['then'](function(_0x1ac119){if(_0x1ac119){_0x3c8792=_0x1ac119;if(!_0x273dc8['query'][_0x5894('0x90')]||!utils['isValidChannel'](_0x273dc8['query'][_0x5894('0x90')])){throw new db['Sequelize'][(_0x5894('0x86'))](_0x5894('0x94'));}return _0x1ac119[_0x5894('0xa3')+_['capitalize'](_0x273dc8[_0x5894('0x3c')][_0x5894('0x90')][_0x5894('0x97')]())+'Queues'](_0x273dc8['query']['ids']);}})['then'](function(_0x22175b){if(_[_0x5894('0xa4')](_0x273dc8[_0x5894('0x3c')][_0x5894('0x58')])){for(var _0x9da13e=0x0;_0x9da13e<_0x273dc8['query'][_0x5894('0x58')]['length'];_0x9da13e+=0x1){_0x139192={'UserId':Number(_0x273dc8['params']['id'])};_0x139192[_[_0x5894('0x96')](_0x273dc8[_0x5894('0x3c')]['channel'][_0x5894('0x97')]())+_0x5894('0x9b')]=Number(_0x273dc8[_0x5894('0x3c')][_0x5894('0x58')][_0x9da13e]);socket[_0x5894('0x1f')](_0x5894('0x25')+_['capitalize'](_0x273dc8[_0x5894('0x3c')][_0x5894('0x90')][_0x5894('0x97')]())+_0x5894('0xa5'),_0x139192);}}else{_0x139192={'UserId':Number(_0x273dc8[_0x5894('0x51')]['id'])};_0x139192[_[_0x5894('0x96')](_0x273dc8[_0x5894('0x3c')][_0x5894('0x90')]['toLowerCase']())+_0x5894('0x9b')]=Number(_0x273dc8[_0x5894('0x3c')][_0x5894('0x58')]);socket[_0x5894('0x1f')](_0x5894('0x25')+_[_0x5894('0x96')](_0x273dc8[_0x5894('0x3c')]['channel'][_0x5894('0x97')]())+'Queue:remove',_0x139192);}return _0x22175b;})[_0x5894('0x22')](function(){if(_0x273dc8[_0x5894('0x3c')][_0x5894('0x90')]===_0x5894('0x9d')){return db['UserVoiceQueueRt'][_0x5894('0x21')]({'where':{'UserId':_0x273dc8[_0x5894('0x51')]['id'],'VoiceQueueId':_0x273dc8[_0x5894('0x3c')][_0x5894('0x58')]},'individualHooks':!![]})[_0x5894('0x22')](function(){return _0x3c8792;});}return _0x3c8792;})[_0x5894('0x22')](respondWithStatusCode(_0x5dbd6e,null))[_0x5894('0x4f')](handleError(_0x5dbd6e,null));};exports[_0x5894('0xa6')]=function(_0x132b8e,_0x3c8f10){_0x132b8e[_0x5894('0x55')][_0x5894('0xa7')]=_0x132b8e[_0x5894('0xa8')]['filename'];return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x132b8e[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c8f10,null))[_0x5894('0x22')](saveUpdates(_0x132b8e[_0x5894('0x55')],null))['then'](respondWithResult(_0x3c8f10,null))['catch'](handleError(_0x3c8f10,null));};exports[_0x5894('0xa9')]=function(_0x51c1d9,_0x459296){var _0x2dbb72=path['join'](config[_0x5894('0xaa')],_0x5894('0xab'));return db['User']['find']({'where':{'id':_0x51c1d9[_0x5894('0x51')]['id']},'attributes':['id',_0x5894('0xa7')],'raw':!![]})[_0x5894('0x22')](handleEntityNotFound(_0x459296,null))[_0x5894('0x22')](function(_0xbe1a35){if(_0xbe1a35){if(_[_0x5894('0x5c')](_0xbe1a35[_0x5894('0xa7')])){return _0x459296[_0x5894('0xac')](_0x2dbb72);}else{if(!fs[_0x5894('0xad')](path[_0x5894('0xae')](config['root'],_0x5894('0xaf'),_0xbe1a35[_0x5894('0xa7')]))){return _0x459296[_0x5894('0xac')](_0x2dbb72);}return _0x459296['download'](path[_0x5894('0xae')](config[_0x5894('0xaa')],_0x5894('0xaf'),_0xbe1a35[_0x5894('0xa7')]));}}})[_0x5894('0x4f')](handleError(_0x459296,null));};exports['getOpenTabs']=function(_0x376986,_0x3a965b){return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x376986[_0x5894('0x51')]['id']},'attributes':['id']})[_0x5894('0x22')](handleEntityNotFound(_0x3a965b,null))[_0x5894('0x22')](function(_0x3acc11){var _0x417894=[];values=_0x3acc11[_0x5894('0x49')];_0x417894['push'](get_open_tabs('chat',_0x3acc11[_0x5894('0x49')]));_0x417894['push'](get_open_tabs('sms',_0x3acc11[_0x5894('0x49')]));_0x417894['push'](get_open_tabs(_0x5894('0x4c'),_0x3acc11['dataValues']));_0x417894['push'](get_open_tabs(_0x5894('0x4d'),_0x3acc11[_0x5894('0x49')]));_0x417894[_0x5894('0x46')](get_open_tabs('fax',_0x3acc11[_0x5894('0x49')]));_0x417894[_0x5894('0x46')](get_open_tabs(_0x5894('0x4b'),_0x3acc11[_0x5894('0x49')]));return Promise[_0x5894('0x4e')](_0x417894);})[_0x5894('0x22')](function(_0x2d31fd){if(_0x2d31fd){var _0x294a19=_[_0x5894('0x30')](values[_0x5894('0xb0')],function(_0x2fd0f4){return{'channel':_0x5894('0xb1'),'id':_0x2fd0f4['id'],'createdAt':_0x2fd0f4[_0x5894('0xb2')]};});var _0x585054=_[_0x5894('0x30')](values[_0x5894('0xb3')],function(_0x38936){return{'channel':_0x5894('0xb4'),'id':_0x38936['id'],'createdAt':_0x38936['createdAt']};});var _0xe72b9=_['map'](values[_0x5894('0xb5')],function(_0x22297c){return{'channel':_0x5894('0xb6'),'id':_0x22297c['id'],'createdAt':_0x22297c[_0x5894('0xb2')]};});var _0x218688=_[_0x5894('0x30')](values[_0x5894('0xb7')],function(_0x4b4ff9){return{'channel':_0x5894('0xb8'),'id':_0x4b4ff9['id'],'createdAt':_0x4b4ff9[_0x5894('0xb2')]};});var _0x20e330=_[_0x5894('0x30')](values[_0x5894('0xb9')],function(_0x3017d5){return{'channel':_0x5894('0xba'),'id':_0x3017d5['id'],'createdAt':_0x3017d5['createdAt']};});var _0x1c90f6=_[_0x5894('0x30')](values[_0x5894('0xbb')],function(_0x244747){return{'channel':'WHATSAPP','id':_0x244747['id'],'createdAt':_0x244747[_0x5894('0xb2')]};});var _0x93bf12=_['concat'](_0x294a19,_0x585054,_0xe72b9,_0x218688,_0x20e330,_0x1c90f6);var _0x3b033b={'count':_0x93bf12[_0x5894('0x45')],'rows':_0x93bf12};return _0x3b033b;}else return null;})[_0x5894('0x22')](respondWithResult(_0x3a965b,null))[_0x5894('0x4f')](handleError(_0x3a965b,null));};exports['getContacts']=function(_0x2eba30,_0x1074a6){var _0x4706d6={};return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x2eba30[_0x5894('0x51')]['id']}})['then'](function(_0x3e5bed){if(!_0x3e5bed){throw new APINotFoundError(util[_0x5894('0x9f')](_0x5894('0xbc'),_0x2eba30[_0x5894('0x51')]['id']));}return contacts[_0x5894('0x56')]();})['then'](function(_0x204f73){_0x2eba30[_0x5894('0x3c')][_0x5894('0x3b')]=_0x2eba30[_0x5894('0x51')]['id'];_0x4706d6=qs['getOptions'](_0x204f73,_0x2eba30);if(_0x2eba30[_0x5894('0x3c')][_0x5894('0xbd')](_0x5894('0x3d'))){_0x4706d6[_0x5894('0x3e')]=[{'model':db[_0x5894('0xbe')],'as':_0x5894('0xbf'),'required':![]},{'model':db[_0x5894('0xc0')],'as':'Tags','attributes':['id',_0x5894('0x2a'),_0x5894('0xc1')],'where':_0x2eba30[_0x5894('0x3c')][_0x5894('0xc2')]?{'id':_0x2eba30['query'][_0x5894('0xc2')]}:undefined,'required':_0x2eba30[_0x5894('0x3c')][_0x5894('0xc2')]?!![]:![]}];}return contacts[_0x5894('0x42')](_0x2eba30[_0x5894('0x3c')],_0x2eba30['user'],_0x4706d6,_0x204f73);})[_0x5894('0x22')](respondWithFilteredResult(_0x1074a6,_0x4706d6))[_0x5894('0x4f')](APIHandleError(_0x1074a6));};exports[_0x5894('0xc3')]=function(_0x38e620,_0x2ae405){var _0x31e317;var _0x5af020={};var _0x28e7b3;return db['User'][_0x5894('0x8a')]({'where':{'id':_0x38e620[_0x5894('0x51')]['id']},'attributes':['id',_0x5894('0x2a'),'role']})[_0x5894('0x22')](handleEntityNotFound(_0x2ae405,null))['then'](function(_0x3c34d6){if(!utils[_0x5894('0x93')](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])){throw new db[(_0x5894('0x85'))]['ValidationError'](_0x5894('0x94'));}_0x31e317=_0x3c34d6;var _0x308ac9={};_0x308ac9['model']=_['keys'](db[_['capitalize'](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])+_0x5894('0xc4')][_0x5894('0xc5')]);_0x308ac9[_0x5894('0x3c')]=_['keys'](_0x38e620[_0x5894('0x3c')]);_0x308ac9[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x308ac9['model'],_0x308ac9[_0x5894('0x3c')]);_0x5af020[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x308ac9['model'],qs['fields'](_0x38e620['query'][_0x5894('0xc8')]));_0x5af020[_0x5894('0x41')]=_0x5af020[_0x5894('0x41')][_0x5894('0x45')]?_0x5af020[_0x5894('0x41')]:_0x308ac9['model'];_0x5af020[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0x38e620['query'][_0x5894('0xca')]);_0x5af020[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x38e620[_0x5894('0x3c')],_0x308ac9['filters']));if(_0x38e620[_0x5894('0x3c')][_0x5894('0x27')]){_0x5af020[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x5af020['where'],{'$or':_[_0x5894('0x30')](_0x5af020['attributes'],function(_0x54c985){var _0x5911e8={};_0x5911e8[_0x54c985]={'$like':'%'+_0x38e620['query'][_0x5894('0x27')]+'%'};return _0x5911e8;})});}_0x5af020=_[_0x5894('0x53')]({},_0x5af020,_0x38e620['options']);switch(_0x31e317['role']){case _0x5894('0x75'):return db[_[_0x5894('0x96')](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])+_0x5894('0xc4')][_0x5894('0x42')](_0x5af020);case _0x5894('0x25'):case _0x5894('0x1e'):return _0x31e317[_0x5894('0x23')+_[_0x5894('0x96')](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])+_0x5894('0x98')](_0x5af020);default:throw new db[(_0x5894('0x85'))]['ValidationError'](_0x5894('0xcc'));}})[_0x5894('0x22')](function(_0x5546de){_0x28e7b3=_0x5546de['length'];if(!_0x38e620['query']['hasOwnProperty'](_0x5894('0xcd'))){_0x5af020['limit']=qs[_0x5894('0x17')](_0x38e620[_0x5894('0x3c')][_0x5894('0x17')]);_0x5af020['offset']=qs[_0x5894('0x15')](_0x38e620[_0x5894('0x3c')][_0x5894('0x15')]);}switch(_0x31e317['role']){case _0x5894('0x75'):return db[_[_0x5894('0x96')](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])+_0x5894('0xc4')][_0x5894('0x42')](_0x5af020);case _0x5894('0x25'):case _0x5894('0x1e'):return _0x31e317[_0x5894('0x23')+_[_0x5894('0x96')](_0x38e620[_0x5894('0x3c')][_0x5894('0x90')])+'Queues'](_0x5af020);}})[_0x5894('0x22')](function(_0xec8dff){return{'count':_0x28e7b3,'rows':_0xec8dff};})['then'](respondWithResult(_0x2ae405,null))['catch'](handleError(_0x2ae405,null));};exports[_0x5894('0xce')]=function(_0xd54185,_0x5e085c){var _0x56a72={};var _0x9d4e34={};var _0x4ba8f3;var _0x59e7c9;return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0xd54185[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x5e085c,null))['then'](function(_0x3168b2){if(_0x3168b2){_0x4ba8f3=_0x3168b2;_0x9d4e34[_0x5894('0xcf')]=_['keys'](db[_0x5894('0xa2')][_0x5894('0xc5')]);_0x9d4e34[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0xd54185[_0x5894('0x3c')]);_0x9d4e34[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x9d4e34['model'],_0x9d4e34[_0x5894('0x3c')]);_0x56a72['attributes']=_['intersection'](_0x9d4e34['model'],qs[_0x5894('0xc8')](_0xd54185['query'][_0x5894('0xc8')]));_0x56a72[_0x5894('0x41')]=_0x56a72[_0x5894('0x41')][_0x5894('0x45')]?_0x56a72['attributes']:_0x9d4e34[_0x5894('0xcf')];_0x56a72[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0xd54185['query'][_0x5894('0xca')]);_0x56a72[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_['pick'](_0xd54185[_0x5894('0x3c')],_0x9d4e34[_0x5894('0xc6')]));if(_0xd54185['query'][_0x5894('0x27')]){_0x56a72[_0x5894('0x3a')]=_['merge'](_0x56a72[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x56a72['attributes'],function(_0x3d0ea9){var _0x4d40c8={};_0x4d40c8[_0x3d0ea9]={'$like':'%'+_0xd54185['query']['filter']+'%'};return _0x4d40c8;})});}_0x56a72=_[_0x5894('0x53')]({},_0x56a72,_0xd54185[_0x5894('0x54')]);return _0x4ba8f3[_0x5894('0xce')](_0x56a72);}})[_0x5894('0x22')](function(_0x475ef7){if(_0x475ef7){_0x59e7c9=_0x475ef7[_0x5894('0x45')];if(!_0xd54185[_0x5894('0x3c')][_0x5894('0xbd')](_0x5894('0xcd'))){_0x56a72[_0x5894('0x17')]=qs[_0x5894('0x17')](_0xd54185[_0x5894('0x3c')]['limit']);_0x56a72[_0x5894('0x15')]=qs['offset'](_0xd54185['query'][_0x5894('0x15')]);}return _0x4ba8f3[_0x5894('0xce')](_0x56a72);}})[_0x5894('0x22')](function(_0x149980){if(_0x149980){return _0x149980?{'count':_0x59e7c9,'rows':_0x149980}:null;}})['then'](respondWithResult(_0x5e085c,null))['catch'](handleError(_0x5e085c,null));};exports[_0x5894('0xd1')]=function(_0x16f442,_0x44c8b8){var _0xc476a8={};var _0x367cf4={};var _0x2dc9c5;var _0x4e2e68;return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x16f442[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0x44c8b8,null))[_0x5894('0x22')](function(_0x5a4d3d){if(_0x5a4d3d){_0x2dc9c5=_0x5a4d3d;_0x367cf4[_0x5894('0xcf')]=_[_0x5894('0xd0')](db['ChatGroup'][_0x5894('0xc5')]);_0x367cf4[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x16f442[_0x5894('0x3c')]);_0x367cf4[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x367cf4['model'],_0x367cf4[_0x5894('0x3c')]);_0xc476a8[_0x5894('0x41')]=_['intersection'](_0x367cf4[_0x5894('0xcf')],qs['fields'](_0x16f442[_0x5894('0x3c')][_0x5894('0xc8')]));_0xc476a8['attributes']=_0xc476a8[_0x5894('0x41')][_0x5894('0x45')]?_0xc476a8[_0x5894('0x41')]:_0x367cf4[_0x5894('0xcf')];_0xc476a8[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0x16f442[_0x5894('0x3c')][_0x5894('0xca')]);_0xc476a8[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x16f442[_0x5894('0x3c')],_0x367cf4['filters']));if(_0x16f442[_0x5894('0x3c')]['filter']){_0xc476a8[_0x5894('0x3a')]=_[_0x5894('0x53')](_0xc476a8[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0xc476a8[_0x5894('0x41')],function(_0x46559c){var _0x59840a={};_0x59840a[_0x46559c]={'$like':'%'+_0x16f442[_0x5894('0x3c')][_0x5894('0x27')]+'%'};return _0x59840a;})});}_0xc476a8=_[_0x5894('0x53')]({},_0xc476a8,_0x16f442[_0x5894('0x54')]);return _0x2dc9c5[_0x5894('0xd1')](_0xc476a8);}})[_0x5894('0x22')](function(_0x8263ab){if(_0x8263ab){_0x4e2e68=_0x8263ab[_0x5894('0x45')];if(!_0x16f442[_0x5894('0x3c')][_0x5894('0xbd')](_0x5894('0xcd'))){_0xc476a8[_0x5894('0x17')]=qs[_0x5894('0x17')](_0x16f442[_0x5894('0x3c')][_0x5894('0x17')]);_0xc476a8[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x16f442[_0x5894('0x3c')]['offset']);}return _0x2dc9c5[_0x5894('0xd1')](_0xc476a8);}})['then'](function(_0xa73b4b){if(_0xa73b4b){return _0xa73b4b?{'count':_0x4e2e68,'rows':_0xa73b4b}:null;}})[_0x5894('0x22')](respondWithResult(_0x44c8b8,null))[_0x5894('0x4f')](handleError(_0x44c8b8,null));};exports[_0x5894('0xd2')]=function(_0x1145d8,_0x223e91){var _0x4ade6a={'raw':!![],'where':{}};var _0x5adfeb={};var _0x5abc4a={'count':0x0,'rows':[]};return db['User'][_0x5894('0x8a')]({'where':{'id':_0x1145d8['params']['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x223e91,null))[_0x5894('0x22')](function(_0x4187fc){if(_0x4187fc){_0x5adfeb[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xd3')][_0x5894('0xc5')]);_0x5adfeb[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x1145d8[_0x5894('0x3c')]);_0x5adfeb['filters']=_['intersection'](_0x5adfeb[_0x5894('0xcf')],_0x5adfeb[_0x5894('0x3c')]);_0x4ade6a[_0x5894('0x41')]=_['intersection'](_0x5adfeb['model'],qs[_0x5894('0xc8')](_0x1145d8[_0x5894('0x3c')][_0x5894('0xc8')]));_0x4ade6a[_0x5894('0x41')]=_0x4ade6a['attributes'][_0x5894('0x45')]?_0x4ade6a[_0x5894('0x41')]:_0x5adfeb[_0x5894('0xcf')];if(!_0x1145d8[_0x5894('0x3c')][_0x5894('0xbd')](_0x5894('0xcd'))){_0x4ade6a[_0x5894('0x17')]=qs[_0x5894('0x17')](_0x1145d8['query']['limit']);_0x4ade6a[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x1145d8[_0x5894('0x3c')][_0x5894('0x15')]);}_0x4ade6a[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0x1145d8[_0x5894('0x3c')][_0x5894('0xca')]);_0x4ade6a[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_['pick'](_0x1145d8[_0x5894('0x3c')],_0x5adfeb[_0x5894('0xc6')]));_0x4ade6a[_0x5894('0x3a')][_0x5894('0xd4')]=_0x4187fc['id'];if(_0x1145d8[_0x5894('0x3c')][_0x5894('0x27')]){_0x4ade6a[_0x5894('0x3a')]=_['merge'](_0x4ade6a[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x4ade6a[_0x5894('0x41')],function(_0x6ebaa8){var _0xe75dba={};_0xe75dba[_0x6ebaa8]={'$like':'%'+_0x1145d8[_0x5894('0x3c')]['filter']+'%'};return _0xe75dba;})});}_0x4ade6a=_[_0x5894('0x53')]({},_0x4ade6a,_0x1145d8['options']);return db[_0x5894('0xd3')]['count']({'where':_0x4ade6a['where']})['then'](function(_0x54f2dc){_0x5abc4a[_0x5894('0x18')]=_0x54f2dc;if(_0x1145d8['query']['includeAll']){_0x4ade6a[_0x5894('0x3e')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4ade6a);})['then'](function(_0x497151){_0x5abc4a[_0x5894('0x43')]=_0x497151;return _0x5abc4a;});}})[_0x5894('0x22')](respondWithFilteredResult(_0x223e91,_0x4ade6a))[_0x5894('0x4f')](handleError(_0x223e91,null));};exports[_0x5894('0xd5')]=function(_0x472c9c,_0x435da4){var _0x481ffa={'raw':!![],'where':{}};var _0x167929={};var _0x4e12ab={'count':0x0,'rows':[]};return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x472c9c['params']['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x435da4,null))['then'](function(_0x2038cc){if(_0x2038cc){_0x167929[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xd6')][_0x5894('0xc5')]);_0x167929[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x472c9c['query']);_0x167929[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x167929[_0x5894('0xcf')],_0x167929[_0x5894('0x3c')]);_0x481ffa[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x167929[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x472c9c['query'][_0x5894('0xc8')]));_0x481ffa['attributes']=_0x481ffa['attributes'][_0x5894('0x45')]?_0x481ffa[_0x5894('0x41')]:_0x167929[_0x5894('0xcf')];if(!_0x472c9c[_0x5894('0x3c')]['hasOwnProperty'](_0x5894('0xcd'))){_0x481ffa['limit']=qs[_0x5894('0x17')](_0x472c9c[_0x5894('0x3c')][_0x5894('0x17')]);_0x481ffa[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x472c9c[_0x5894('0x3c')][_0x5894('0x15')]);}_0x481ffa['order']=qs[_0x5894('0xca')](_0x472c9c[_0x5894('0x3c')][_0x5894('0xca')]);_0x481ffa[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x472c9c[_0x5894('0x3c')],_0x167929[_0x5894('0xc6')]));_0x481ffa[_0x5894('0x3a')][_0x5894('0xd4')]=_0x2038cc['id'];if(_0x472c9c[_0x5894('0x3c')][_0x5894('0x27')]){_0x481ffa['where']=_[_0x5894('0x53')](_0x481ffa['where'],{'$or':_[_0x5894('0x30')](_0x481ffa[_0x5894('0x41')],function(_0x4544fc){var _0x4af199={};_0x4af199[_0x4544fc]={'$like':'%'+_0x472c9c['query'][_0x5894('0x27')]+'%'};return _0x4af199;})});}_0x481ffa=_['merge']({},_0x481ffa,_0x472c9c['options']);return db['ScreenRecording'][_0x5894('0x18')]({'where':_0x481ffa['where']})[_0x5894('0x22')](function(_0x43a6ef){_0x4e12ab[_0x5894('0x18')]=_0x43a6ef;if(_0x472c9c[_0x5894('0x3c')][_0x5894('0x3d')]){_0x481ffa[_0x5894('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5894('0x42')](_0x481ffa);})[_0x5894('0x22')](function(_0x3356ca){_0x4e12ab['rows']=_0x3356ca;return _0x4e12ab;});}})['then'](respondWithFilteredResult(_0x435da4,_0x481ffa))[_0x5894('0x4f')](handleError(_0x435da4,null));};exports['getChatInteractions']=function(_0x4bae4f,_0x3b4cdc){var _0x5f3392={};var _0x22f412={};var _0x12b491;var _0x4e8b2e;return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x4bae4f['params']['id']}})['then'](handleEntityNotFound(_0x3b4cdc,null))['then'](function(_0x4ddc0f){if(_0x4ddc0f){_0x12b491=_0x4ddc0f;_0x22f412[_0x5894('0xcf')]=_[_0x5894('0xd0')](db['ChatInteraction'][_0x5894('0xc5')]);_0x22f412[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x4bae4f['query']);_0x22f412[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x22f412[_0x5894('0xcf')],_0x22f412[_0x5894('0x3c')]);_0x5f3392['attributes']=_[_0x5894('0xc7')](_0x22f412[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x4bae4f[_0x5894('0x3c')][_0x5894('0xc8')]));_0x5f3392[_0x5894('0x41')]=_0x5f3392['attributes']['length']?_0x5f3392['attributes']:_0x22f412['model'];_0x5f3392['order']=qs['sort'](_0x4bae4f[_0x5894('0x3c')]['sort']);_0x5f3392['where']=qs['filters'](_['pick'](_0x4bae4f[_0x5894('0x3c')],_0x22f412[_0x5894('0xc6')]));if(_0x4bae4f['query'][_0x5894('0x27')]){_0x5f3392[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x5f3392[_0x5894('0x3a')],{'$or':_['map'](_0x5f3392[_0x5894('0x41')],function(_0x1f753f){var _0x2243fa={};_0x2243fa[_0x1f753f]={'$like':'%'+_0x4bae4f['query']['filter']+'%'};return _0x2243fa;})});}_0x5f3392=_[_0x5894('0x53')]({},_0x5f3392,_0x4bae4f[_0x5894('0x54')]);return _0x12b491['getChatInteractions'](_0x5f3392);}})[_0x5894('0x22')](function(_0x1be45e){if(_0x1be45e){_0x4e8b2e=_0x1be45e[_0x5894('0x45')];if(!_0x4bae4f[_0x5894('0x3c')]['hasOwnProperty']('nolimit')){_0x5f3392['limit']=qs[_0x5894('0x17')](_0x4bae4f[_0x5894('0x3c')]['limit']);_0x5f3392[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x4bae4f[_0x5894('0x3c')]['offset']);}return _0x12b491['getChatInteractions'](_0x5f3392);}})['then'](function(_0x233493){if(_0x233493){return _0x233493?{'count':_0x4e8b2e,'rows':_0x233493}:null;}})['then'](respondWithResult(_0x3b4cdc,null))['catch'](handleError(_0x3b4cdc,null));};exports['getOpenchannelInteractions']=function(_0x370707,_0x4d0554){var _0x6c109d={};var _0x29b34c={};var _0x1fb2d7;var _0x6cc66;return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x370707[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x4d0554,null))['then'](function(_0x5b9d8b){if(_0x5b9d8b){_0x1fb2d7=_0x5b9d8b;_0x29b34c[_0x5894('0xcf')]=_['keys'](db[_0x5894('0xd7')][_0x5894('0xc5')]);_0x29b34c[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x370707[_0x5894('0x3c')]);_0x29b34c[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x29b34c[_0x5894('0xcf')],_0x29b34c['query']);_0x6c109d[_0x5894('0x41')]=_['intersection'](_0x29b34c[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x370707['query'][_0x5894('0xc8')]));_0x6c109d[_0x5894('0x41')]=_0x6c109d[_0x5894('0x41')][_0x5894('0x45')]?_0x6c109d[_0x5894('0x41')]:_0x29b34c['model'];_0x6c109d['order']=qs[_0x5894('0xca')](_0x370707['query'][_0x5894('0xca')]);_0x6c109d[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x370707['query'],_0x29b34c[_0x5894('0xc6')]));if(_0x370707[_0x5894('0x3c')]['filter']){_0x6c109d[_0x5894('0x3a')]=_['merge'](_0x6c109d['where'],{'$or':_[_0x5894('0x30')](_0x6c109d[_0x5894('0x41')],function(_0x1d0d4c){var _0x5a1e7b={};_0x5a1e7b[_0x1d0d4c]={'$like':'%'+_0x370707[_0x5894('0x3c')][_0x5894('0x27')]+'%'};return _0x5a1e7b;})});}_0x6c109d=_['merge']({},_0x6c109d,_0x370707[_0x5894('0x54')]);return _0x1fb2d7[_0x5894('0xd8')](_0x6c109d);}})[_0x5894('0x22')](function(_0x3739ad){if(_0x3739ad){_0x6cc66=_0x3739ad[_0x5894('0x45')];if(!_0x370707[_0x5894('0x3c')]['hasOwnProperty'](_0x5894('0xcd'))){_0x6c109d[_0x5894('0x17')]=qs['limit'](_0x370707[_0x5894('0x3c')]['limit']);_0x6c109d[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x370707[_0x5894('0x3c')][_0x5894('0x15')]);}return _0x1fb2d7['getOpenchannelInteractions'](_0x6c109d);}})[_0x5894('0x22')](function(_0x272cdd){if(_0x272cdd){return _0x272cdd?{'count':_0x6cc66,'rows':_0x272cdd}:null;}})[_0x5894('0x22')](respondWithResult(_0x4d0554,null))[_0x5894('0x4f')](handleError(_0x4d0554,null));};exports[_0x5894('0xd9')]=function(_0x266bcc,_0x4f0685){var _0x4540fa={'raw':!![],'where':{}};var _0x248b3f={};var _0x36a9e7={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x266bcc[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f0685,null))[_0x5894('0x22')](function(_0x3e234d){if(_0x3e234d){_0x248b3f[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xda')][_0x5894('0xc5')]);_0x248b3f['query']=_[_0x5894('0xd0')](_0x266bcc[_0x5894('0x3c')]);_0x248b3f[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x248b3f[_0x5894('0xcf')],_0x248b3f[_0x5894('0x3c')]);_0x4540fa[_0x5894('0x41')]=_['intersection'](_0x248b3f[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x266bcc['query'][_0x5894('0xc8')]));_0x4540fa[_0x5894('0x41')]=_0x4540fa[_0x5894('0x41')][_0x5894('0x45')]?_0x4540fa[_0x5894('0x41')]:_0x248b3f[_0x5894('0xcf')];if(!_0x266bcc['query'][_0x5894('0xbd')](_0x5894('0xcd'))){_0x4540fa[_0x5894('0x17')]=qs[_0x5894('0x17')](_0x266bcc['query']['limit']);_0x4540fa[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x266bcc[_0x5894('0x3c')][_0x5894('0x15')]);}_0x4540fa[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0x266bcc[_0x5894('0x3c')][_0x5894('0xca')]);_0x4540fa[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x266bcc[_0x5894('0x3c')],_0x248b3f['filters']));_0x4540fa[_0x5894('0x3a')]['UserId']=_0x3e234d['id'];if(_0x266bcc['query']['filter']){_0x4540fa[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x4540fa[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x4540fa['attributes'],function(_0x5d612a){var _0x1d05d6={};_0x1d05d6[_0x5d612a]={'$like':'%'+_0x266bcc['query']['filter']+'%'};return _0x1d05d6;})});}_0x4540fa=_[_0x5894('0x53')]({},_0x4540fa,_0x266bcc[_0x5894('0x54')]);return db['MailInteraction']['count']({'where':_0x4540fa[_0x5894('0x3a')]})[_0x5894('0x22')](function(_0x48714f){_0x36a9e7[_0x5894('0x18')]=_0x48714f;if(_0x266bcc[_0x5894('0x3c')][_0x5894('0x3d')]){_0x4540fa['include']=[{'all':!![]}];}return db[_0x5894('0xda')][_0x5894('0x42')](_0x4540fa);})[_0x5894('0x22')](function(_0x29f8e4){_0x36a9e7[_0x5894('0x43')]=_0x29f8e4;return _0x36a9e7;});}})['then'](respondWithFilteredResult(_0x4f0685,_0x4540fa))[_0x5894('0x4f')](handleError(_0x4f0685,null));};exports[_0x5894('0xdb')]=function(_0x255420,_0x5d6740){var _0x121e86={};var _0x13d25c={};var _0x3277b3;var _0x526ecd;return db['User'][_0x5894('0x8a')]({'where':{'id':_0x255420[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x5d6740,null))[_0x5894('0x22')](function(_0xed00b6){if(_0xed00b6){_0x3277b3=_0xed00b6;_0x13d25c[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xdc')]['rawAttributes']);_0x13d25c['query']=_[_0x5894('0xd0')](_0x255420[_0x5894('0x3c')]);_0x13d25c['filters']=_[_0x5894('0xc7')](_0x13d25c[_0x5894('0xcf')],_0x13d25c['query']);_0x121e86[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x13d25c['model'],qs[_0x5894('0xc8')](_0x255420[_0x5894('0x3c')][_0x5894('0xc8')]));_0x121e86[_0x5894('0x41')]=_0x121e86[_0x5894('0x41')]['length']?_0x121e86['attributes']:_0x13d25c[_0x5894('0xcf')];_0x121e86[_0x5894('0xc9')]=qs['sort'](_0x255420[_0x5894('0x3c')]['sort']);_0x121e86[_0x5894('0x3a')]=qs['filters'](_[_0x5894('0xcb')](_0x255420['query'],_0x13d25c['filters']));if(_0x255420[_0x5894('0x3c')][_0x5894('0x27')]){_0x121e86[_0x5894('0x3a')]=_['merge'](_0x121e86[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x121e86[_0x5894('0x41')],function(_0x50a92e){var _0x233467={};_0x233467[_0x50a92e]={'$like':'%'+_0x255420[_0x5894('0x3c')][_0x5894('0x27')]+'%'};return _0x233467;})});}_0x121e86=_[_0x5894('0x53')]({},_0x121e86,_0x255420['options']);return _0x3277b3[_0x5894('0xdb')](_0x121e86);}})[_0x5894('0x22')](function(_0x97f15e){if(_0x97f15e){_0x526ecd=_0x97f15e['length'];if(!_0x255420['query'][_0x5894('0xbd')](_0x5894('0xcd'))){_0x121e86[_0x5894('0x17')]=qs['limit'](_0x255420[_0x5894('0x3c')][_0x5894('0x17')]);_0x121e86[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x255420['query'][_0x5894('0x15')]);}return _0x3277b3[_0x5894('0xdb')](_0x121e86);}})['then'](function(_0x4c0707){if(_0x4c0707){return _0x4c0707?{'count':_0x526ecd,'rows':_0x4c0707}:null;}})[_0x5894('0x22')](respondWithResult(_0x5d6740,null))[_0x5894('0x4f')](handleError(_0x5d6740,null));};exports['getFaxInteractions']=function(_0x3f613b,_0xbd55b4){var _0x267c75={};var _0x38184e={};var _0x4dc819;var _0x3b9f87;return db[_0x5894('0x3b')]['findOne']({'where':{'id':_0x3f613b[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0xbd55b4,null))[_0x5894('0x22')](function(_0x5ebe09){if(_0x5ebe09){_0x4dc819=_0x5ebe09;_0x38184e[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xdd')][_0x5894('0xc5')]);_0x38184e[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x3f613b[_0x5894('0x3c')]);_0x38184e['filters']=_['intersection'](_0x38184e[_0x5894('0xcf')],_0x38184e['query']);_0x267c75[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x38184e[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x3f613b[_0x5894('0x3c')][_0x5894('0xc8')]));_0x267c75['attributes']=_0x267c75['attributes'][_0x5894('0x45')]?_0x267c75[_0x5894('0x41')]:_0x38184e[_0x5894('0xcf')];_0x267c75['order']=qs['sort'](_0x3f613b[_0x5894('0x3c')]['sort']);_0x267c75[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_['pick'](_0x3f613b[_0x5894('0x3c')],_0x38184e[_0x5894('0xc6')]));if(_0x3f613b['query']['filter']){_0x267c75[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x267c75[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x267c75[_0x5894('0x41')],function(_0x4368c3){var _0x5f45f8={};_0x5f45f8[_0x4368c3]={'$like':'%'+_0x3f613b['query'][_0x5894('0x27')]+'%'};return _0x5f45f8;})});}_0x267c75=_[_0x5894('0x53')]({},_0x267c75,_0x3f613b['options']);return _0x4dc819[_0x5894('0xde')](_0x267c75);}})[_0x5894('0x22')](function(_0x318bf4){if(_0x318bf4){_0x3b9f87=_0x318bf4[_0x5894('0x45')];if(!_0x3f613b[_0x5894('0x3c')][_0x5894('0xbd')]('nolimit')){_0x267c75[_0x5894('0x17')]=qs['limit'](_0x3f613b[_0x5894('0x3c')][_0x5894('0x17')]);_0x267c75[_0x5894('0x15')]=qs['offset'](_0x3f613b[_0x5894('0x3c')]['offset']);}return _0x4dc819[_0x5894('0xde')](_0x267c75);}})[_0x5894('0x22')](function(_0x1aee75){if(_0x1aee75){return _0x1aee75?{'count':_0x3b9f87,'rows':_0x1aee75}:null;}})[_0x5894('0x22')](respondWithResult(_0xbd55b4,null))[_0x5894('0x4f')](handleError(_0xbd55b4,null));};exports[_0x5894('0xdf')]=function(_0x159884,_0x3eb7cd){var _0x1e26d3={};var _0x49bc26={};var _0x2fd125;var _0x4531d7;return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x159884[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x3eb7cd,null))[_0x5894('0x22')](function(_0x3b1ecb){if(_0x3b1ecb){_0x2fd125=_0x3b1ecb;_0x49bc26[_0x5894('0xcf')]=_[_0x5894('0xd0')](db['WhatsappInteraction'][_0x5894('0xc5')]);_0x49bc26['query']=_[_0x5894('0xd0')](_0x159884[_0x5894('0x3c')]);_0x49bc26[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x49bc26[_0x5894('0xcf')],_0x49bc26[_0x5894('0x3c')]);_0x1e26d3[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x49bc26[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x159884[_0x5894('0x3c')][_0x5894('0xc8')]));_0x1e26d3[_0x5894('0x41')]=_0x1e26d3['attributes'][_0x5894('0x45')]?_0x1e26d3[_0x5894('0x41')]:_0x49bc26['model'];_0x1e26d3[_0x5894('0xc9')]=qs[_0x5894('0xca')](_0x159884[_0x5894('0x3c')]['sort']);_0x1e26d3[_0x5894('0x3a')]=qs['filters'](_[_0x5894('0xcb')](_0x159884[_0x5894('0x3c')],_0x49bc26[_0x5894('0xc6')]));if(_0x159884[_0x5894('0x3c')]['filter']){_0x1e26d3[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x1e26d3[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0x1e26d3[_0x5894('0x41')],function(_0x911f15){var _0x297c51={};_0x297c51[_0x911f15]={'$like':'%'+_0x159884['query'][_0x5894('0x27')]+'%'};return _0x297c51;})});}_0x1e26d3=_[_0x5894('0x53')]({},_0x1e26d3,_0x159884['options']);return _0x2fd125['getWhatsappInteractions'](_0x1e26d3);}})[_0x5894('0x22')](function(_0x1e205e){if(_0x1e205e){_0x4531d7=_0x1e205e[_0x5894('0x45')];if(!_0x159884['query'][_0x5894('0xbd')](_0x5894('0xcd'))){_0x1e26d3[_0x5894('0x17')]=qs[_0x5894('0x17')](_0x159884['query'][_0x5894('0x17')]);_0x1e26d3[_0x5894('0x15')]=qs['offset'](_0x159884['query']['offset']);}return _0x2fd125[_0x5894('0xdf')](_0x1e26d3);}})[_0x5894('0x22')](function(_0x4c2044){if(_0x4c2044){return _0x4c2044?{'count':_0x4531d7,'rows':_0x4c2044}:null;}})[_0x5894('0x22')](respondWithResult(_0x3eb7cd,null))[_0x5894('0x4f')](handleError(_0x3eb7cd,null));};exports[_0x5894('0xe0')]=function(_0x6f5a6c,_0x3fb7d1,_0x1161ba){var _0x3ab51d;var _0x5ce104;var _0x21ebbf;var _0x97857c=!_[_0x5894('0x5c')](_0x6f5a6c[_0x5894('0x51')]['id'])?_0x6f5a6c['params']['id']:!_[_0x5894('0x5c')](_0x6f5a6c[_0x5894('0x25')]['id'])?_0x6f5a6c[_0x5894('0x25')]['id']:null;return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x97857c,'role':{'$or':[_0x5894('0x75'),_0x5894('0x25'),_0x5894('0x1e')]}},'attributes':['id',_0x5894('0x2a'),_0x5894('0xe1'),'mobile',_0x5894('0x1d'),'internal',_0x5894('0xe2')]})[_0x5894('0x22')](function(_0x191cdd){if(_0x191cdd){if(_0x191cdd[_0x5894('0x1d')]===_0x5894('0x1e')){_0x3ab51d=_0x191cdd;if(_0x6f5a6c[_0x5894('0x55')][_0x5894('0x92')]){_0x21ebbf=util['format']('LOCAL/%s@from-sip/n',_0x3ab51d[_0x6f5a6c[_0x5894('0x55')][_0x5894('0x92')]]);}else if(_0x6f5a6c[_0x5894('0x55')][_0x5894('0xe3')]){_0x21ebbf=util['format']('SIP/%s',_0x6f5a6c['body'][_0x5894('0xe3')]);}else{_0x21ebbf=util[_0x5894('0x9f')](_0x5894('0xa0'),_0x3ab51d[_0x5894('0x2a')]);}socket['to'](util[_0x5894('0x9f')]('user:%s',_0x3ab51d[_0x5894('0x2a')]))['emit'](_0x5894('0xe4'),{'user':{'id':_0x3ab51d['id'],'name':_0x3ab51d[_0x5894('0x2a')]},'ip':_0x6f5a6c[_0x5894('0xe5')][_0x5894('0xe6')]||_0x6f5a6c['connection']['remoteAddress']||_0x6f5a6c[_0x5894('0xe7')]['remoteAddress']||_0x6f5a6c['connection'][_0x5894('0xe7')]['remoteAddress']});return db[_0x5894('0xa2')][_0x5894('0x21')]({'where':{'membername':_0x3ab51d['name']},'individualHooks':!![]});}}else{throw new db[(_0x5894('0x85'))][(_0x5894('0x86'))](_0x5894('0xe8'));}})[_0x5894('0x22')](function(){if(_0x3ab51d){return _0x3ab51d[_0x5894('0xe9')]({'raw':!![]});}})[_0x5894('0x22')](function(_0x53fa8d){if(_0x3ab51d){if(_0x53fa8d){_0x5ce104=_0x53fa8d;if(_0x5ce104[_0x5894('0x45')]){var _0x19cac1=_0x5ce104[_0x5894('0x30')](function(_0x4577be){var _0x1f93d7={'membername':_0x3ab51d[_0x5894('0x2a')],'UserId':_0x3ab51d['id'],'queue_name':_0x4577be[_0x5894('0x2a')],'VoiceQueueId':_0x4577be['id'],'interface':_0x21ebbf,'paused':_0x3ab51d[_0x5894('0xe2')]||![],'penalty':_0x4577be[_0x5894('0xea')]||0x0};return db[_0x5894('0xa2')]['upsert'](_0x1f93d7);});return Promise[_0x5894('0x4e')](_0x19cac1);}}}})[_0x5894('0x22')](function(){if(_0x3ab51d){return db[_0x5894('0xeb')][_0x5894('0x42')]({'where':{'membername':_0x3ab51d['name'],'exitAt':null}});}})[_0x5894('0x22')](function(_0x29a616){if(_0x3ab51d){var _0xb0e799=[];_0x29a616['forEach'](function(_0x41b6ec){_0xb0e799[_0x5894('0x46')](_0x41b6ec[_0x5894('0x1c')]({'exitAt':moment()[_0x5894('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x5894('0x4e')](_0xb0e799);}})[_0x5894('0x22')](function(){if(_0x3ab51d){var _0x1f1a12=[];var _0x642768=[];var _0x113a89=utils[_0x5894('0xec')]();var _0x4402d3={'membername':_0x3ab51d['name'],'interface':_0x21ebbf,'enterAt':moment()[_0x5894('0x9f')](_0x5894('0xed')),'role':_0x3ab51d[_0x5894('0x1d')],'internal':_0x3ab51d[_0x5894('0x5d')]};_0x113a89['forEach'](function(_0x2678b9){_0x1f1a12[_0x5894('0x46')](_[_0x5894('0x53')]({'channel':_0x2678b9,'type':_0x5894('0xee'),'data1':_0x6f5a6c['body'][_0x5894('0xef')],'data2':_0x21ebbf},_0x4402d3));if(_0x3ab51d[_0x5894('0xe2')]){_0x642768[_0x5894('0x46')](_[_0x5894('0x53')]({'channel':_0x2678b9,'type':'PAUSE','data1':_0x5894('0xf0')},_0x4402d3));}});return db['MemberReport']['bulkCreate'](_0x1f1a12[_0x5894('0xf1')](_0x642768),{'individualHooks':!![]});}})[_0x5894('0x22')](function(){if(_0x3ab51d){return _0x3ab51d[_0x5894('0x1c')]({'online':!![],'lastLoginAt':moment()[_0x5894('0x9f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3ab51d[_0x5894('0xe2')]||![],'mailPause':_0x3ab51d[_0x5894('0xe2')]||![],'chatPause':_0x3ab51d[_0x5894('0xe2')]||![],'faxPause':_0x3ab51d['loginInPause']||![],'smsPause':_0x3ab51d[_0x5894('0xe2')]||![],'openchannelPause':_0x3ab51d[_0x5894('0xe2')]||![],'whatsappPause':_0x3ab51d[_0x5894('0xe2')]||![],'pauseType':_0x3ab51d['loginInPause']?'LOGININPAUSE':null,'interface':_0x21ebbf,'lastPauseAt':moment()[_0x5894('0x9f')](_0x5894('0xed'))});}})[_0x5894('0x22')](function(_0x31ceb2){if(_0x6f5a6c['isMiddleware']){return _0x1161ba();}else{return Promise[_0x5894('0xf2')](_0x31ceb2)['then'](respondWithResult(_0x3fb7d1,null));}})[_0x5894('0x4f')](handleError(_0x3fb7d1,null));};exports['logout']=function(_0x466858,_0x53e432){var _0xa791d6;return db[_0x5894('0x3b')][_0x5894('0x29')]({'where':{'id':_0x466858[_0x5894('0x51')]['id'],'role':_0x5894('0x1e')},'attributes':['id',_0x5894('0x2a'),_0x5894('0x1d')]})['then'](handleEntityNotFound(_0x53e432,null))['then'](function(_0xde4d9d){if(_0xde4d9d){_0xa791d6=_0xde4d9d;return db[_0x5894('0xa2')][_0x5894('0x21')]({'where':{'membername':_0xa791d6[_0x5894('0x2a')]},'individualHooks':!![]});}})[_0x5894('0x22')](function(){return db[_0x5894('0xeb')]['findAll']({'where':{'membername':_0xa791d6['name'],'exitAt':null}});})['then'](function(_0x6a98c6){var _0x1eb724=[];_0x6a98c6[_0x5894('0xf3')](function(_0x18eef6){_0x1eb724['push'](_0x18eef6[_0x5894('0x1c')]({'exitAt':moment()['format'](_0x5894('0xed'))}));});return Promise[_0x5894('0x4e')](_0x1eb724);})[_0x5894('0x22')](function(){return _0xa791d6[_0x5894('0x1c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x53e432,null))[_0x5894('0x4f')](handleError(_0x53e432,null));};exports[_0x5894('0xf4')]=function(_0x52cdf7,_0x5f3e5d){var _0x5ab693;return db[_0x5894('0xa2')][_0x5894('0x1c')]({'paused':0x1},{'where':{'UserId':_0x52cdf7['params']['id']},'individualHooks':!![]})[_0x5894('0x22')](function(){return db['User'][_0x5894('0x29')]({'where':{'id':_0x52cdf7[_0x5894('0x51')]['id'],'role':_0x5894('0x1e')},'attributes':['id',_0x5894('0x2a'),_0x5894('0x1d'),'internal','interface',_0x5894('0x91')]});})['then'](handleEntityNotFound(_0x5f3e5d,null))['then'](function(_0x3b4c46){if(_0x3b4c46){_0x5ab693=_0x3b4c46;return db[_0x5894('0xeb')][_0x5894('0x42')]({'where':{'membername':_0x5ab693[_0x5894('0x2a')],'type':_0x5894('0xf5'),'exitAt':null}});}})[_0x5894('0x22')](function(_0x25538d){if(_0x25538d['length']){var _0x16e5cb=moment()[_0x5894('0x9f')](_0x5894('0xed'));for(var _0x56814e=0x0,_0x19a3dd=_0x25538d[_0x5894('0x45')];_0x56814e<_0x19a3dd;_0x56814e++){_0x25538d[_0x56814e][_0x5894('0xf6')]({'exitAt':_0x16e5cb});}}})[_0x5894('0x22')](function(){var _0x4da22b=[];var _0x4759b3=utils['getChannels']();_0x4759b3[_0x5894('0xf3')](function(_0x5cb4b1){_0x4da22b[_0x5894('0x46')]({'channel':_0x5cb4b1,'membername':_0x5ab693[_0x5894('0x2a')],'interface':_[_0x5894('0x5c')](_0x5ab693['interface'])?util[_0x5894('0x9f')](_0x5894('0xa0'),_0x5ab693[_0x5894('0x2a')]):_0x5ab693[_0x5894('0x92')],'type':_0x5894('0xf5'),'enterAt':moment()[_0x5894('0x9f')](_0x5894('0xed')),'data1':_0x52cdf7[_0x5894('0x55')]['type']||_0x5894('0xf7'),'role':_0x5ab693[_0x5894('0x1d')],'internal':_0x5ab693[_0x5894('0x5d')]});});return db[_0x5894('0xeb')][_0x5894('0xf8')](_0x4da22b,{'individualHooks':!![]});})[_0x5894('0x22')](function(){return _0x5ab693[_0x5894('0x1c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x52cdf7[_0x5894('0x55')][_0x5894('0xf9')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x5894('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5894('0x22')](respondWithResult(_0x5f3e5d,null))[_0x5894('0x4f')](handleError(_0x5f3e5d,null));};exports[_0x5894('0xfa')]=function(_0x23edcb,_0x4ab9b0){if(_0x23edcb[_0x5894('0x55')][_0x5894('0x90')]&&!utils['isValidChannel'](_0x23edcb['body'][_0x5894('0x90')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x23edcb['body'][_0x5894('0x90')]));}return db[_0x5894('0x3b')]['find']({'where':{'id':_0x23edcb['params']['id']},'attributes':['id',_0x5894('0x2a'),_0x5894('0x1d'),'internal',_0x5894('0x92'),_0x5894('0x91'),_0x5894('0xa1'),'mailPause',_0x5894('0xfb'),_0x5894('0xfc'),'openchannelPause',_0x5894('0xfd'),'whatsappPause',_0x5894('0xfe'),_0x5894('0xff')]})[_0x5894('0x22')](function(_0x2e0edd){if(!_0x2e0edd){throw new APINotFoundError(util[_0x5894('0x9f')](_0x5894('0xbc'),_0x23edcb[_0x5894('0x51')]['id']));}return _0x2e0edd['unpause'](_0x23edcb[_0x5894('0x55')]['channel']);})[_0x5894('0x22')](respondWithResult(_0x4ab9b0,null))['catch'](APIHandleError(_0x4ab9b0));};exports[_0x5894('0x100')]=function(_0x3d6640,_0x5bb213){var _0x49ef62={};var _0x286de6={};var _0x464252;var _0x2dde5e;return db['User']['findOne']({'where':{'id':_0x3d6640[_0x5894('0x51')]['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x5bb213,null))['then'](function(_0x4d302a){if(_0x4d302a){_0x464252=_0x4d302a;_0x286de6[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0x101')][_0x5894('0xc5')]);_0x286de6[_0x5894('0x3c')]=_['keys'](_0x3d6640[_0x5894('0x3c')]);_0x286de6[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x286de6[_0x5894('0xcf')],_0x286de6[_0x5894('0x3c')]);_0x49ef62[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x286de6['model'],qs['fields'](_0x3d6640['query']['fields']));_0x49ef62[_0x5894('0x41')]=_0x49ef62[_0x5894('0x41')]['length']?_0x49ef62[_0x5894('0x41')]:_0x286de6[_0x5894('0xcf')];_0x49ef62[_0x5894('0xc9')]=qs['sort'](_0x3d6640[_0x5894('0x3c')][_0x5894('0xca')]);_0x49ef62[_0x5894('0x3a')]=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x3d6640[_0x5894('0x3c')],_0x286de6['filters']));if(_0x3d6640[_0x5894('0x3c')][_0x5894('0x27')]){_0x49ef62[_0x5894('0x3a')]=_[_0x5894('0x53')](_0x49ef62['where'],{'$or':_[_0x5894('0x30')](_0x49ef62[_0x5894('0x41')],function(_0x156718){var _0x1dd6a7={};_0x1dd6a7[_0x156718]={'$like':'%'+_0x3d6640[_0x5894('0x3c')][_0x5894('0x27')]+'%'};return _0x1dd6a7;})});}_0x49ef62=_[_0x5894('0x53')]({},_0x49ef62,_0x3d6640[_0x5894('0x54')]);return _0x464252[_0x5894('0x100')](_0x49ef62);}})['then'](function(_0x3a84e8){if(_0x3a84e8){_0x2dde5e=_0x3a84e8[_0x5894('0x45')];if(!_0x3d6640[_0x5894('0x3c')]['hasOwnProperty'](_0x5894('0xcd'))){_0x49ef62['limit']=qs[_0x5894('0x17')](_0x3d6640[_0x5894('0x3c')][_0x5894('0x17')]);_0x49ef62[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x3d6640[_0x5894('0x3c')][_0x5894('0x15')]);}return _0x464252[_0x5894('0x100')](_0x49ef62);}})[_0x5894('0x22')](function(_0x4444ab){if(_0x4444ab){return _0x4444ab?{'count':_0x2dde5e,'rows':_0x4444ab}:null;}})[_0x5894('0x22')](respondWithResult(_0x5bb213,null))['catch'](handleError(_0x5bb213,null));};exports[_0x5894('0x102')]=function(_0x334cf2,_0x1081dd){var _0x148b6a=_0x334cf2[_0x5894('0x51')]['id'];var _0x33ad6e=_0x334cf2[_0x5894('0x55')]?_0x334cf2[_0x5894('0x55')][_0x5894('0x58')]:null;var _0x5a4972=[];return Promise['resolve']()[_0x5894('0x22')](function(){if(!_0x33ad6e)throw new APIBadRequestError(_0x5894('0x103'));})[_0x5894('0x22')](function(){return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x148b6a}});})[_0x5894('0x22')](function(_0x550e4b){if(!_0x550e4b)throw new APINotFoundError(util[_0x5894('0x9f')](_0x5894('0xbc'),_0x334cf2[_0x5894('0x51')]['id']));return db['sequelize']['transaction'](function(_0x4fab66){return _0x550e4b[_0x5894('0x102')](_0x33ad6e,{'transaction':_0x4fab66})[_0x5894('0x22')](function(){return db[_0x5894('0x101')]['findAll']({'where':{'id':{'$in':_0x33ad6e}}});})[_0x5894('0x22')](function(_0x416557){var _0x4c3e9b=_[_0x5894('0x30')](_0x416557,function(_0x43e61d){return _0x43e61d['getAssociatedQueues']();});return Promise[_0x5894('0x4e')](_0x4c3e9b);})['then'](function(_0x4e08eb){_0x5a4972=_['flattenDeep'](_0x4e08eb);var _0x2fc6f3=_['map'](_0x5a4972,function(_0x4d18d8){return _0x4d18d8[_0x5894('0x104')](_0x550e4b['id'],{'transaction':_0x4fab66});});return Promise[_0x5894('0x4e')](_0x2fc6f3);})[_0x5894('0x22')](function(){if(!_0x550e4b[_0x5894('0x91')])return;var _0x5dee07=_[_0x5894('0x27')](_0x5a4972,function(_0x1d6419){return _0x1d6419['getDataValue']('channel')==='Voice';});var _0x6cf45f=_[_0x5894('0x30')](_0x5dee07,function(_0x4df8c2){return db[_0x5894('0xa2')][_0x5894('0x105')]({'membername':_0x550e4b[_0x5894('0x2a')],'UserId':_0x550e4b['id'],'queue_name':_0x4df8c2[_0x5894('0x2a')],'VoiceQueueId':_0x4df8c2['id'],'interface':_[_0x5894('0x5c')](_0x550e4b['interface'])?util[_0x5894('0x9f')](_0x5894('0xa0'),_0x550e4b[_0x5894('0x2a')]):_0x550e4b[_0x5894('0x92')],'paused':_0x550e4b[_0x5894('0xa1')]||![],'penalty':_0x550e4b[_0x5894('0x99')]},{'transaction':_0x4fab66});});return Promise[_0x5894('0x4e')](_0x6cf45f);})[_0x5894('0x22')](function(){return db[_0x5894('0x106')][_0x5894('0x42')]({'where':{'teamId':{'$in':_0x33ad6e}}});})[_0x5894('0x22')](function(_0x19c881){var _0x43ed21=_[_0x5894('0x30')](_0x19c881,function(_0xcd78b9){return db[_0x5894('0x107')][_0x5894('0x73')]({'UserId':_0x550e4b['id'],'VoicePrefixId':_0xcd78b9['VoicePrefixId']},{'transaction':_0x4fab66});});return Promise[_0x5894('0x4e')](_0x43ed21);});});})[_0x5894('0x22')](function(){for(var _0xe564af=0x0;_0xe564af<_0x5a4972[_0x5894('0x45')];_0xe564af++){var _0x200e66=_0x5a4972[_0xe564af][_0x5894('0x108')](_0x5894('0x90'));var _0x26366e=_0x200e66+_0x5894('0x9b');socket[_0x5894('0x1f')](_0x5894('0x25')+_0x200e66+_0x5894('0x9c'),{'UserId':_0x148b6a,['queueField']:_0x5a4972[_0xe564af]['id']});}})[_0x5894('0x22')](respondWithStatusCode(_0x1081dd,null))['catch'](APIHandleError(_0x1081dd));};exports['removeTeams']=function(_0x637ba3,_0x377ebf){var _0x3b4b26=_0x637ba3[_0x5894('0x51')]['id'];var _0x9d5987=null;if(_0x637ba3[_0x5894('0x3c')][_0x5894('0x58')]){_0x9d5987=_[_0x5894('0xa4')](_0x637ba3[_0x5894('0x3c')][_0x5894('0x58')])?_0x637ba3['query'][_0x5894('0x58')]:[_0x637ba3[_0x5894('0x3c')]['ids']];}var _0x1edaff=[];return Promise[_0x5894('0xf2')]()[_0x5894('0x22')](function(){if(!_0x9d5987)throw new APIBadRequestError(_0x5894('0x109'));})[_0x5894('0x22')](function(){return db[_0x5894('0x3b')][_0x5894('0x8a')]({'where':{'id':_0x3b4b26}});})[_0x5894('0x22')](function(_0x126e0d){if(!_0x126e0d)throw new APINotFoundError(util[_0x5894('0x9f')](_0x5894('0xbc'),_0x637ba3['params']['id']));return db[_0x5894('0x10a')][_0x5894('0x10b')](function(_0x48c962){return _0x126e0d['removeTeams'](_0x9d5987,{'transaction':_0x48c962})[_0x5894('0x22')](function(){return db[_0x5894('0x101')]['findAll']({'where':{'id':{'$in':_0x9d5987}}});})['then'](function(_0x4fdaad){var _0x281e8b=_[_0x5894('0x30')](_0x4fdaad,function(_0x3f8a32){return _0x3f8a32[_0x5894('0x10c')]();});return Promise[_0x5894('0x4e')](_0x281e8b);})[_0x5894('0x22')](function(_0x348805){_0x1edaff=_['flattenDeep'](_0x348805);var _0xe9bde6=_[_0x5894('0x30')](_0x1edaff,function(_0x2034bb){return _0x2034bb[_0x5894('0x10d')](_0x126e0d['id'],{'transaction':_0x48c962});});return Promise['all'](_0xe9bde6);})[_0x5894('0x22')](function(){if(!_0x126e0d['online'])return;var _0x336983=_[_0x5894('0x27')](_0x1edaff,function(_0x510fb0){return _0x510fb0['getDataValue'](_0x5894('0x90'))===_0x5894('0x10e');});var _0x151800=_['map'](_0x336983,function(_0x59ed54){return db[_0x5894('0xa2')]['destroy']({'where':{'VoiceQueueId':_0x59ed54['id'],'UserId':_0x126e0d['id']},'transaction':_0x48c962});});return Promise[_0x5894('0x4e')](_0x151800);})[_0x5894('0x22')](function(){return db[_0x5894('0x106')][_0x5894('0x42')]({'where':{'teamId':{'$in':_0x9d5987}}});})[_0x5894('0x22')](function(_0xb9f2c7){var _0x22e441=_[_0x5894('0x30')](_0xb9f2c7,function(_0x32bc89){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x126e0d['id'],'VoicePrefixId':_0x32bc89[_0x5894('0x10f')]}},{'transaction':_0x48c962});});return Promise[_0x5894('0x4e')](_0x22e441);});});})[_0x5894('0x22')](function(){for(var _0xdc924b=0x0;_0xdc924b<_0x1edaff[_0x5894('0x45')];_0xdc924b++){var _0x56033b=_0x1edaff[_0xdc924b][_0x5894('0x108')](_0x5894('0x90'));var _0x3f9016=_0x56033b+_0x5894('0x9b');socket[_0x5894('0x1f')]('user'+_0x56033b+_0x5894('0xa5'),{'UserId':_0x3b4b26,['queueField']:_0x1edaff[_0xdc924b]['id']});}})[_0x5894('0x22')](respondWithStatusCode(_0x377ebf,null))[_0x5894('0x4f')](APIHandleError(_0x377ebf));};exports[_0x5894('0x110')]=function(_0x1be7bb,_0x1aea96){var _0x2a34fe={};var _0x3aa5cc={};var _0x307d3b;var _0x5a087c;return db['User'][_0x5894('0x8a')]({'where':{'id':_0x1be7bb['params']['id']}})[_0x5894('0x22')](handleEntityNotFound(_0x1aea96,null))[_0x5894('0x22')](function(_0x52f2d0){if(_0x52f2d0){_0x307d3b=_0x52f2d0;_0x3aa5cc[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0xbe')][_0x5894('0xc5')]);_0x3aa5cc[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x1be7bb[_0x5894('0x3c')]);_0x3aa5cc[_0x5894('0xc6')]=_[_0x5894('0xc7')](_0x3aa5cc[_0x5894('0xcf')],_0x3aa5cc[_0x5894('0x3c')]);_0x2a34fe[_0x5894('0x41')]=_[_0x5894('0xc7')](_0x3aa5cc[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x1be7bb[_0x5894('0x3c')][_0x5894('0xc8')]));_0x2a34fe['attributes']=_0x2a34fe[_0x5894('0x41')][_0x5894('0x45')]?_0x2a34fe['attributes']:_0x3aa5cc[_0x5894('0xcf')];_0x2a34fe[_0x5894('0xc9')]=qs['sort'](_0x1be7bb[_0x5894('0x3c')]['sort']);_0x2a34fe['where']=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x1be7bb[_0x5894('0x3c')],_0x3aa5cc[_0x5894('0xc6')]));if(_0x1be7bb[_0x5894('0x3c')]['filter']){_0x2a34fe[_0x5894('0x3a')]=_['merge'](_0x2a34fe[_0x5894('0x3a')],{'$or':_['map'](_0x2a34fe['attributes'],function(_0x56d32d){var _0x4a2766={};_0x4a2766[_0x56d32d]={'$like':'%'+_0x1be7bb['query'][_0x5894('0x27')]+'%'};return _0x4a2766;})});}_0x2a34fe=_['merge']({},_0x2a34fe,_0x1be7bb[_0x5894('0x54')]);return _0x307d3b[_0x5894('0x110')](_0x2a34fe);}})[_0x5894('0x22')](function(_0x102d8b){if(_0x102d8b){_0x5a087c=_0x102d8b['length'];if(!_0x1be7bb[_0x5894('0x3c')]['hasOwnProperty'](_0x5894('0xcd'))){_0x2a34fe[_0x5894('0x17')]=qs[_0x5894('0x17')](_0x1be7bb['query'][_0x5894('0x17')]);_0x2a34fe[_0x5894('0x15')]=qs[_0x5894('0x15')](_0x1be7bb['query'][_0x5894('0x15')]);}return _0x307d3b['getLists'](_0x2a34fe);}})['then'](function(_0x5063d6){if(_0x5063d6){return _0x5063d6?{'count':_0x5a087c,'rows':_0x5063d6}:null;}})[_0x5894('0x22')](respondWithResult(_0x1aea96,null))[_0x5894('0x4f')](handleError(_0x1aea96,null));};exports[_0x5894('0x111')]=function(_0x1a84a2,_0x5f4570){var _0xe5c5a9={};var _0xa64b33={};var _0x346168;return db['User'][_0x5894('0x8a')]({'where':{'id':_0x1a84a2[_0x5894('0x51')]['id']}})['then'](handleEntityNotFound(_0x5f4570,null))[_0x5894('0x22')](function(_0x1c00e3){if(_0x1c00e3){_0x346168=_0x1c00e3;_0xa64b33[_0x5894('0xcf')]=_[_0x5894('0xd0')](db[_0x5894('0x3b')]['rawAttributes']);_0xa64b33[_0x5894('0x3c')]=_[_0x5894('0xd0')](_0x1a84a2[_0x5894('0x3c')]);_0xa64b33['filters']=_[_0x5894('0xc7')](_0xa64b33[_0x5894('0xcf')],_0xa64b33[_0x5894('0x3c')]);_0xe5c5a9[_0x5894('0x41')]=_[_0x5894('0xc7')](_0xa64b33[_0x5894('0xcf')],qs[_0x5894('0xc8')](_0x1a84a2[_0x5894('0x3c')][_0x5894('0xc8')]));_0xe5c5a9[_0x5894('0x41')]=_0xe5c5a9[_0x5894('0x41')][_0x5894('0x45')]?_0xe5c5a9[_0x5894('0x41')]:_0xa64b33[_0x5894('0xcf')];_0xe5c5a9[_0x5894('0xc9')]=qs['sort'](_0x1a84a2[_0x5894('0x3c')][_0x5894('0xca')]);_0xe5c5a9['where']=qs[_0x5894('0xc6')](_[_0x5894('0xcb')](_0x1a84a2[_0x5894('0x3c')],_0xa64b33[_0x5894('0xc6')]));if(_0x1a84a2['query']['filter']){_0xe5c5a9[_0x5894('0x3a')]=_['merge'](_0xe5c5a9[_0x5894('0x3a')],{'$or':_[_0x5894('0x30')](_0xe5c5a9[_0x5894('0x41')],function(_0x816ec8){var _0x36ce32={};_0x36ce32[_0x816ec8]={'$like':'%'+_0x1a84a2['query'][_0x5894('0x27')]+'%'};return _0x36ce32;})});}_0xe5c5a9[_0x5894('0xcf')]=db[_0x5894('0x3b')];_0xe5c5a9['as']=_0x5894('0x81');_0xe5c5a9=_['merge']({},_0xe5c5a9,_0x1a84a2[_0x5894('0x54')]);return _0x346168[_0x5894('0xe9')]({'include':[_0xe5c5a9]});}})[_0x5894('0x22')](function(_0x1cd0ae){if(_0x1cd0ae){var _0x49b45d={},_0x223c1c=[];for(var _0x5a10f0=0x0;_0x5a10f0<_0x1cd0ae[_0x5894('0x45')];_0x5a10f0+=0x1){for(var _0x1f2282=0x0,_0x3f20b1;_0x1f2282<_0x1cd0ae[_0x5a10f0][_0x5894('0x81')][_0x5894('0x45')];_0x1f2282+=0x1){_0x3f20b1=_0x1cd0ae[_0x5a10f0][_0x5894('0x81')][_0x1f2282][_0x5894('0x23')]({'plain':!![]});_0x49b45d[_0x3f20b1['id']]=_0x3f20b1;}}_0x49b45d=_['values'](_0x49b45d);for(var _0x4ff82c=qs[_0x5894('0x15')](_0x1a84a2[_0x5894('0x3c')][_0x5894('0x15')]);_0x4ff82c<_0x49b45d[_0x5894('0x45')]&&_0x223c1c[_0x5894('0x45')]=_0x518bcd[_0x4e11('0x53')]){throw new Error(_0x4e11('0x54'));}})['then'](function(){if(_0x54be0a){return db['UserVoiceQueueRt'][_0x4e11('0x49')]({'where':{'membername':_0x54be0a[_0x4e11('0x20')]},'individualHooks':!![]});}})[_0x4e11('0x14')](function(){if(_0x54be0a){return _0x54be0a[_0x4e11('0x55')]({'raw':!![]});}})['then'](function(_0xd4477e){if(_0x54be0a){if(_0xd4477e){var _0x384472=[];_0x1d58c7=_0xd4477e;if(_0x1d58c7[_0x4e11('0x29')]){for(var _0x31d5b1=0x0;_0x31d5b1<_0x1d58c7['length'];_0x31d5b1++){_0x384472['push'](db[_0x4e11('0x25')][_0x4e11('0x56')]({'membername':_0x54be0a['name'],'UserId':_0x54be0a['id'],'queue_name':_0x1d58c7[_0x31d5b1][_0x4e11('0x20')],'VoiceQueueId':_0x1d58c7[_0x31d5b1]['id'],'interface':_0xf4bb57,'paused':_0x54be0a[_0x4e11('0x4e')]||![],'penalty':_0x1d58c7[_0x31d5b1][_0x4e11('0x57')]||0x0}));}return BPromise[_0x4e11('0x4a')](_0x384472);}}}})[_0x4e11('0x14')](function(){if(_0x54be0a){return db['MemberReport'][_0x4e11('0xc')]({'where':{'membername':_0x54be0a[_0x4e11('0x20')],'exitAt':null}});}})[_0x4e11('0x14')](function(_0x3f2787){if(_0x54be0a){if(_0x3f2787&&_0x3f2787[_0x4e11('0x29')]){var _0x13f30d=[];_0x3f2787['forEach'](function(_0x19a03f){_0x13f30d[_0x4e11('0x2e')](_0x19a03f[_0x4e11('0x26')]({'exitAt':moment()['format'](_0x4e11('0x2a'))}));});return BPromise[_0x4e11('0x4a')](_0x13f30d);}}})[_0x4e11('0x14')](function(){if(_0x54be0a){var _0x42321d=[];var _0xe7004f=[];var _0x212472=utils['getChannels']();var _0x58cda3={'membername':_0x54be0a[_0x4e11('0x20')],'interface':_0xf4bb57,'enterAt':moment()['format'](_0x4e11('0x2a')),'role':_0x54be0a['role'],'internal':_0x54be0a[_0x4e11('0x22')]};_0x212472[_0x4e11('0x2d')](function(_0x33efc9){_0x42321d['push'](_['merge']({'channel':_0x33efc9,'type':'LOGIN','data1':_0x4e11('0x58'),'data2':_0xf4bb57},_0x58cda3));if(_0x54be0a[_0x4e11('0x4e')]){_0xe7004f[_0x4e11('0x2e')](_[_0x4e11('0x59')]({'channel':_0x33efc9,'type':_0x4e11('0x28'),'data1':'LOGININPAUSE'},_0x58cda3));}});return db['MemberReport'][_0x4e11('0x35')](_0x42321d[_0x4e11('0x5a')](_0xe7004f),{'individualHooks':!![]});}})[_0x4e11('0x14')](function(){if(_0x54be0a){return _0x54be0a['update']({'online':!![],'lastLoginAt':moment()[_0x4e11('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x54be0a[_0x4e11('0x4e')]||![],'mailPause':_0x54be0a[_0x4e11('0x4e')]||![],'chatPause':_0x54be0a[_0x4e11('0x4e')]||![],'faxPause':_0x54be0a['loginInPause']||![],'smsPause':_0x54be0a[_0x4e11('0x4e')]||![],'openchannelPause':_0x54be0a[_0x4e11('0x4e')]||![],'pauseType':_0x54be0a[_0x4e11('0x4e')]?_0x4e11('0x5b'):null,'lastPauseAt':moment()[_0x4e11('0x24')](_0x4e11('0x2a')),'interface':_0xf4bb57});}})[_0x4e11('0x14')](function(_0x51b7ec){_0x38849b(_0x51b7ec);})[_0x4e11('0x18')](function(_0x4cbf49){_0x2004a7(_0x2c9e7f['error'](0x1f4,_0x4cbf49['message']));});});}; \ No newline at end of file +var _0x87ed=['merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','./user.socket','User','findAll','options','raw','attributes','limit','include','model','map','then','info','GetUser','debug','stringify','catch','error','message','ShowUser','where','PauseUser','find','name','role','interface','format','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','body','type','DEFAULT\x20PAUSE','internal','uniqueid','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','system','LogoutUser','findOne','destroy','push','all','phone','SIP/%s','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','loginInPause','UserVoiceQueue.penalty'];(function(_0x3730f6,_0x962339){var _0x4887ff=function(_0x19d77f){while(--_0x19d77f){_0x3730f6['push'](_0x3730f6['shift']());}};_0x4887ff(++_0x962339);}(_0x87ed,0x1c2));var _0xd87e=function(_0x54f415,_0x52be28){_0x54f415=_0x54f415-0x0;var _0xaca73b=_0x87ed[_0x54f415];return _0xaca73b;};'use strict';var _=require(_0xd87e('0x0'));var util=require(_0xd87e('0x1'));var moment=require(_0xd87e('0x2'));var BPromise=require(_0xd87e('0x3'));var Redis=require(_0xd87e('0x4'));var db=require(_0xd87e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd87e('0x6'));var config=require('../../config/environment');config[_0xd87e('0x7')]=_[_0xd87e('0x8')](config['redis'],{'host':_0xd87e('0x9'),'port':0x18eb});var socket=require(_0xd87e('0xa'))(new Redis(config['redis']));require(_0xd87e('0xb'))['register'](socket);exports['GetUser']=function(_0x3d0511){var _0x520617=this;return new Promise(function(_0x4e6cc7,_0x2d61d3){return db[_0xd87e('0xc')][_0xd87e('0xd')]({'raw':_0x3d0511[_0xd87e('0xe')]?_0x3d0511[_0xd87e('0xe')][_0xd87e('0xf')]===undefined?!![]:![]:!![],'where':_0x3d0511[_0xd87e('0xe')]?_0x3d0511[_0xd87e('0xe')]['where']||null:null,'attributes':_0x3d0511[_0xd87e('0xe')]?_0x3d0511[_0xd87e('0xe')][_0xd87e('0x10')]||null:null,'limit':_0x3d0511['options']?_0x3d0511[_0xd87e('0xe')][_0xd87e('0x11')]||null:null,'include':_0x3d0511['options']?_0x3d0511[_0xd87e('0xe')][_0xd87e('0x12')]?_['map'](_0x3d0511[_0xd87e('0xe')][_0xd87e('0x12')],function(_0x44da88){return{'model':db[_0x44da88[_0xd87e('0x13')]],'as':_0x44da88['as'],'attributes':_0x44da88['attributes'],'include':_0x44da88[_0xd87e('0x12')]?_['map'](_0x44da88[_0xd87e('0x12')],function(_0x2baf0e){return{'model':db[_0x2baf0e[_0xd87e('0x13')]],'as':_0x2baf0e['as'],'attributes':_0x2baf0e[_0xd87e('0x10')],'include':_0x2baf0e['include']?_[_0xd87e('0x14')](_0x2baf0e[_0xd87e('0x12')],function(_0x40a31e){return{'model':db[_0x40a31e[_0xd87e('0x13')]],'as':_0x40a31e['as'],'attributes':_0x40a31e[_0xd87e('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd87e('0x15')](function(_0x44f18a){logger[_0xd87e('0x16')](_0xd87e('0x17'),_0x3d0511);logger[_0xd87e('0x18')](_0xd87e('0x17'),_0x3d0511,JSON[_0xd87e('0x19')](_0x44f18a));_0x4e6cc7(_0x44f18a);})[_0xd87e('0x1a')](function(_0x482ab4){logger[_0xd87e('0x1b')](_0xd87e('0x17'),_0x482ab4[_0xd87e('0x1c')],_0x3d0511);_0x2d61d3(_0x520617[_0xd87e('0x1b')](0x1f4,_0x482ab4[_0xd87e('0x1c')]));});});};exports[_0xd87e('0x1d')]=function(_0x2b7a18){var _0x4ede11=this;return new Promise(function(_0x26dcdc,_0xd8b904){return db[_0xd87e('0xc')]['find']({'raw':_0x2b7a18['options']?_0x2b7a18[_0xd87e('0xe')][_0xd87e('0xf')]===undefined?!![]:![]:!![],'where':_0x2b7a18['options']?_0x2b7a18[_0xd87e('0xe')][_0xd87e('0x1e')]||null:null,'attributes':_0x2b7a18['options']?_0x2b7a18[_0xd87e('0xe')][_0xd87e('0x10')]||null:null,'include':_0x2b7a18[_0xd87e('0xe')]?_0x2b7a18[_0xd87e('0xe')][_0xd87e('0x12')]?_[_0xd87e('0x14')](_0x2b7a18['options'][_0xd87e('0x12')],function(_0x165344){return{'model':db[_0x165344[_0xd87e('0x13')]],'as':_0x165344['as'],'attributes':_0x165344['attributes'],'include':_0x165344['include']?_['map'](_0x165344[_0xd87e('0x12')],function(_0x19e666){return{'model':db[_0x19e666[_0xd87e('0x13')]],'as':_0x19e666['as'],'attributes':_0x19e666[_0xd87e('0x10')],'include':_0x19e666[_0xd87e('0x12')]?_['map'](_0x19e666[_0xd87e('0x12')],function(_0x577d62){return{'model':db[_0x577d62[_0xd87e('0x13')]],'as':_0x577d62['as'],'attributes':_0x577d62[_0xd87e('0x10')]};}):[]};}):[]};}):[]:[]})[_0xd87e('0x15')](function(_0x1fe8da){logger[_0xd87e('0x16')](_0xd87e('0x1d'),_0x2b7a18);logger[_0xd87e('0x18')](_0xd87e('0x1d'),_0x2b7a18,JSON[_0xd87e('0x19')](_0x1fe8da));_0x26dcdc(_0x1fe8da);})[_0xd87e('0x1a')](function(_0x1ffe0d){logger[_0xd87e('0x1b')]('ShowUser',_0x1ffe0d[_0xd87e('0x1c')],_0x2b7a18);_0xd8b904(_0x4ede11['error'](0x1f4,_0x1ffe0d[_0xd87e('0x1c')]));});});};exports[_0xd87e('0x1f')]=function(_0x2aa030){var _0x570a2d;return db[_0xd87e('0xc')][_0xd87e('0x20')]({'where':_0x2aa030[_0xd87e('0xe')]['where']||{},'attributes':['id',_0xd87e('0x21'),_0xd87e('0x22'),'internal',_0xd87e('0x23')]})[_0xd87e('0x15')](function(_0x19f23c){if(!_0x19f23c){throw new Error(util[_0xd87e('0x24')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2aa030[_0xd87e('0x25')]['id']));}_0x570a2d=_0x19f23c;return db[_0xd87e('0x26')][_0xd87e('0x27')]({'paused':0x1},{'where':{'UserId':_0x570a2d['id']},'individualHooks':!![]});})[_0xd87e('0x15')](function(){return db[_0xd87e('0x28')][_0xd87e('0xd')]({'where':{'membername':_0x570a2d[_0xd87e('0x21')],'type':_0xd87e('0x29'),'exitAt':null}});})[_0xd87e('0x15')](function(_0x18ff2a){if(_0x18ff2a&&_0x18ff2a[_0xd87e('0x2a')]){var _0x56e89a=moment()['format'](_0xd87e('0x2b'));for(var _0x13424d=0x0,_0x476cfa=_0x18ff2a[_0xd87e('0x2a')];_0x13424d<_0x476cfa;_0x13424d++){_0x18ff2a[_0x13424d][_0xd87e('0x2c')]({'exitAt':_0x56e89a});}}})[_0xd87e('0x15')](function(){var _0x57dfdb=[];var _0x6e59d7=utils[_0xd87e('0x2d')]();_0x6e59d7[_0xd87e('0x2e')](function(_0x1ac95e){_0x57dfdb['push']({'channel':_0x1ac95e,'membername':_0x570a2d['name'],'interface':_['isNil'](_0x570a2d[_0xd87e('0x23')])?util[_0xd87e('0x24')]('SIP/%s',_0x570a2d['name']):_0x570a2d[_0xd87e('0x23')],'type':_0xd87e('0x29'),'enterAt':moment()[_0xd87e('0x24')](_0xd87e('0x2b')),'data1':_0x2aa030[_0xd87e('0x2f')][_0xd87e('0x30')]||_0xd87e('0x31'),'role':_0x570a2d[_0xd87e('0x22')],'internal':_0x570a2d[_0xd87e('0x32')],'uniqueid':_0x2aa030[_0xd87e('0x2f')][_0xd87e('0x33')]||null});});return db['MemberReport'][_0xd87e('0x34')](_0x57dfdb,{'individualHooks':!![]});})[_0xd87e('0x15')](function(){return _0x570a2d[_0xd87e('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2aa030[_0xd87e('0x2f')][_0xd87e('0x30')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x29ab61){throw _0x29ab61;});};exports[_0xd87e('0x35')]=function(_0x19dfb1){return Promise[_0xd87e('0x36')]()['then'](function(){if(_0x19dfb1[_0xd87e('0x2f')][_0xd87e('0x37')]&&!utils[_0xd87e('0x38')](_0x19dfb1[_0xd87e('0x2f')]['channel'])){throw new Error(util['format'](_0xd87e('0x39'),_0x19dfb1[_0xd87e('0x2f')][_0xd87e('0x37')]));}return db[_0xd87e('0xc')]['findOne']({'where':_0x19dfb1[_0xd87e('0xe')]['where']||{},'attributes':['id',_0xd87e('0x21'),_0xd87e('0x22'),_0xd87e('0x32'),'interface','online',_0xd87e('0x3a'),_0xd87e('0x3b'),_0xd87e('0x3c'),_0xd87e('0x3d'),_0xd87e('0x3e'),_0xd87e('0x3f'),_0xd87e('0x40'),'pauseType',_0xd87e('0x41')]});})['then'](function(_0xde92){if(!_0xde92){throw new Error(util[_0xd87e('0x24')](_0xd87e('0x42'),_0x19dfb1['params']['id']));}return _0xde92[_0xd87e('0x43')](_0x19dfb1[_0xd87e('0x2f')][_0xd87e('0x37')],_0xd87e('0x44'));})[_0xd87e('0x1a')](function(_0x43c405){throw _0x43c405;});};exports[_0xd87e('0x45')]=function(_0x1db9c1){var _0x58e020=this;return new Promise(function(_0x33d33b,_0x14e8de){var _0x179355;return db[_0xd87e('0xc')][_0xd87e('0x46')]({'where':_0x1db9c1[_0xd87e('0xe')][_0xd87e('0x1e')]||{},'attributes':['id','name']})[_0xd87e('0x15')](function(_0x5e5d65){if(_0x5e5d65){_0x179355=_0x5e5d65;return db[_0xd87e('0x26')][_0xd87e('0x47')]({'where':{'membername':_0x179355[_0xd87e('0x21')]},'individualHooks':!![]});}})[_0xd87e('0x15')](function(){if(_0x179355){return db[_0xd87e('0x28')][_0xd87e('0xd')]({'where':{'membername':_0x179355[_0xd87e('0x21')],'exitAt':null}});}})[_0xd87e('0x15')](function(_0x1a7ff3){if(_0x179355){if(_0x1a7ff3&&_0x1a7ff3[_0xd87e('0x2a')]){var _0xeb157e=[];_0x1a7ff3[_0xd87e('0x2e')](function(_0x3a7108){_0xeb157e[_0xd87e('0x48')](_0x3a7108[_0xd87e('0x27')]({'exitAt':moment()[_0xd87e('0x24')](_0xd87e('0x2b'))}));});return BPromise[_0xd87e('0x49')](_0xeb157e);}}})[_0xd87e('0x15')](function(){if(_0x179355){return _0x179355['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd87e('0x15')](function(_0x1bcba5){_0x33d33b(_0x1bcba5);})['catch'](function(_0x166012){_0x14e8de(_0x58e020['error'](0x1f4,_0x166012[_0xd87e('0x1c')]));});});};exports['LoginUser']=function(_0x2906b0){var _0x5ee901=this;return new Promise(function(_0x39d5d6,_0x398ae2){var _0x52d928;var _0x5b383;var _0x153282;var _0x1f71b7;return db[_0xd87e('0xc')][_0xd87e('0x46')]({'where':_0x2906b0[_0xd87e('0xe')][_0xd87e('0x1e')]||{},'attributes':['id','name','role','mobile',_0xd87e('0x4a'),_0xd87e('0x32'),'loginInPause',_0xd87e('0x23')]})[_0xd87e('0x15')](function(_0x12cb14){if(_0x12cb14){_0x52d928=_0x12cb14;_0x1f71b7=_0x2906b0['body'][_0xd87e('0x23')]?_0x2906b0[_0xd87e('0x2f')][_0xd87e('0x23')]:util[_0xd87e('0x24')](_0xd87e('0x4b'),_0x52d928[_0xd87e('0x21')]);return db[_0xd87e('0xc')][_0xd87e('0x4c')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x52d928['id']}}});}})[_0xd87e('0x15')](function(_0x129ea2){if(_0x129ea2){_0x153282=_0x129ea2;return require(_0xd87e('0x4d'))[_0xd87e('0x4e')]();}})['then'](function(_0x48cff9){if(_0x48cff9&&_0x48cff9[_0xd87e('0x4f')]&&_0x153282>=_0x48cff9[_0xd87e('0x4f')]){throw new Error(_0xd87e('0x50'));}})['then'](function(){if(_0x52d928){return db[_0xd87e('0x26')]['destroy']({'where':{'membername':_0x52d928[_0xd87e('0x21')]},'individualHooks':!![]});}})['then'](function(){if(_0x52d928){return _0x52d928['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x3cf7df){if(_0x52d928){if(_0x3cf7df){var _0xbd33ef=[];_0x5b383=_0x3cf7df;if(_0x5b383[_0xd87e('0x2a')]){for(var _0x39c166=0x0;_0x39c166<_0x5b383['length'];_0x39c166++){_0xbd33ef['push'](db[_0xd87e('0x26')][_0xd87e('0x51')]({'membername':_0x52d928[_0xd87e('0x21')],'UserId':_0x52d928['id'],'queue_name':_0x5b383[_0x39c166][_0xd87e('0x21')],'VoiceQueueId':_0x5b383[_0x39c166]['id'],'interface':_0x1f71b7,'paused':_0x52d928[_0xd87e('0x52')]||![],'penalty':_0x5b383[_0x39c166][_0xd87e('0x53')]||0x0}));}return BPromise[_0xd87e('0x49')](_0xbd33ef);}}}})[_0xd87e('0x15')](function(){if(_0x52d928){return db[_0xd87e('0x28')][_0xd87e('0xd')]({'where':{'membername':_0x52d928[_0xd87e('0x21')],'exitAt':null}});}})[_0xd87e('0x15')](function(_0xde7633){if(_0x52d928){if(_0xde7633&&_0xde7633[_0xd87e('0x2a')]){var _0x106505=[];_0xde7633[_0xd87e('0x2e')](function(_0x3c1b87){_0x106505[_0xd87e('0x48')](_0x3c1b87['update']({'exitAt':moment()[_0xd87e('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd87e('0x49')](_0x106505);}}})['then'](function(){if(_0x52d928){var _0x2ceb7e=[];var _0x34b852=[];var _0x276cf8=utils[_0xd87e('0x2d')]();var _0x134228={'membername':_0x52d928[_0xd87e('0x21')],'interface':_0x1f71b7,'enterAt':moment()[_0xd87e('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x52d928[_0xd87e('0x22')],'internal':_0x52d928[_0xd87e('0x32')]};_0x276cf8[_0xd87e('0x2e')](function(_0x2054b3){_0x2ceb7e[_0xd87e('0x48')](_[_0xd87e('0x54')]({'channel':_0x2054b3,'type':_0xd87e('0x55'),'data1':_0xd87e('0x56'),'data2':_0x1f71b7},_0x134228));if(_0x52d928['loginInPause']){_0x34b852[_0xd87e('0x48')](_['merge']({'channel':_0x2054b3,'type':_0xd87e('0x29'),'data1':_0xd87e('0x57')},_0x134228));}});return db[_0xd87e('0x28')][_0xd87e('0x34')](_0x2ceb7e[_0xd87e('0x58')](_0x34b852),{'individualHooks':!![]});}})[_0xd87e('0x15')](function(){if(_0x52d928){return _0x52d928[_0xd87e('0x27')]({'online':!![],'lastLoginAt':moment()[_0xd87e('0x24')](_0xd87e('0x2b')),'voicePause':_0x52d928[_0xd87e('0x52')]||![],'mailPause':_0x52d928['loginInPause']||![],'chatPause':_0x52d928['loginInPause']||![],'faxPause':_0x52d928[_0xd87e('0x52')]||![],'smsPause':_0x52d928[_0xd87e('0x52')]||![],'openchannelPause':_0x52d928[_0xd87e('0x52')]||![],'pauseType':_0x52d928[_0xd87e('0x52')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xd87e('0x2b')),'interface':_0x1f71b7});}})[_0xd87e('0x15')](function(_0x5229d8){_0x39d5d6(_0x5229d8);})[_0xd87e('0x1a')](function(_0x2e7032){_0x398ae2(_0x5ee901[_0xd87e('0x1b')](0x1f4,_0x2e7032[_0xd87e('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 08fc1ac..c545e65 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 _0x2e95=['length','user:','./user.events','remove','update','emit','register'];(function(_0x183245,_0xecb018){var _0x72a0c1=function(_0x56c74a){while(--_0x56c74a){_0x183245['push'](_0x183245['shift']());}};_0x72a0c1(++_0xecb018);}(_0x2e95,0x1ad));var _0x52e9=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x2e95[_0x3df223];return _0x562d11;};'use strict';var UserEvents=require(_0x52e9('0x0'));var events=['save',_0x52e9('0x1'),_0x52e9('0x2')];function createListener(_0x48c645,_0x239fed){return function(_0x13fde3){_0x239fed[_0x52e9('0x3')](_0x48c645,_0x13fde3);};}function removeListener(_0x814104,_0x3ad589){return function(){UserEvents['removeListener'](_0x814104,_0x3ad589);};}exports[_0x52e9('0x4')]=function(_0x221dd3){for(var _0x5cba6c=0x0,_0x4c2e17=events[_0x52e9('0x5')];_0x5cba6c<_0x4c2e17;_0x5cba6c++){var _0x5b3b94=events[_0x5cba6c];var _0x5de067=createListener(_0x52e9('0x6')+_0x5b3b94,_0x221dd3);UserEvents['on'](_0x5b3b94,_0x5de067);}}; \ No newline at end of file +var _0xec37=['register','length','user:','./user.events','save','remove','removeListener'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0xec37,0x114));var _0x7ec3=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xec37[_0x3be7ff];return _0x186721;};'use strict';var UserEvents=require(_0x7ec3('0x0'));var events=[_0x7ec3('0x1'),_0x7ec3('0x2'),'update'];function createListener(_0x304516,_0x467bfc){return function(_0x1a2934){_0x467bfc['emit'](_0x304516,_0x1a2934);};}function removeListener(_0x4f21e0,_0x1d41b7){return function(){UserEvents[_0x7ec3('0x3')](_0x4f21e0,_0x1d41b7);};}exports[_0x7ec3('0x4')]=function(_0x51c3cb){for(var _0x3ee9e7=0x0,_0x5430b4=events[_0x7ec3('0x5')];_0x3ee9e7<_0x5430b4;_0x3ee9e7++){var _0x4d1dc7=events[_0x3ee9e7];var _0x5caa90=createListener(_0x7ec3('0x6')+_0x4d1dc7,_0x51c3cb);UserEvents['on'](_0x4d1dc7,_0x5caa90);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2cbac31..292e625 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x599856,_0x37d1df){var _0x5d9917=function(_0x49e0f3){while(--_0x49e0f3){_0x599856['push'](_0x599856['shift']());}};_0x5d9917(++_0x37d1df);}(_0x70e0,0x17b));var _0x070e=function(_0x1bbaf0,_0x592f6a){_0x1bbaf0=_0x1bbaf0-0x0;var _0x498d48=_0x70e0[_0x1bbaf0];return _0x498d48;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x269275,_0x45c58c){var _0x1c0bcb=function(_0x1c3055){while(--_0x1c3055){_0x269275['push'](_0x269275['shift']());}};_0x1c0bcb(++_0x45c58c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f8fb223..24fc70d 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 _0xdae9=['exports','sequelize'];(function(_0x24dfb7,_0x2bf1bf){var _0x525851=function(_0xa8a946){while(--_0xa8a946){_0x24dfb7['push'](_0x24dfb7['shift']());}};_0x525851(++_0x2bf1bf);}(_0xdae9,0x12b));var _0x9dae=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdae9[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x9dae('0x0'));module[_0x9dae('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6007=['exports','INTEGER','sequelize'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x6007,0x8f));var _0x7600=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x6007[_0x13187a];return _0x65b85f;};'use strict';var Sequelize=require(_0x7600('0x0'));module[_0x7600('0x1')]={'penalty':{'type':Sequelize[_0x7600('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 fe4148f..757e3c4 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 _0x384c=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','request-promise','path'];(function(_0x576312,_0x5ab20c){var _0x266476=function(_0x153e9f){while(--_0x153e9f){_0x576312['push'](_0x576312['shift']());}};_0x266476(++_0x5ab20c);}(_0x384c,0x166));var _0xc384=function(_0x310316,_0x475b0c){_0x310316=_0x310316-0x0;var _0x1b280a=_0x384c[_0x310316];return _0x1b280a;};'use strict';var _=require(_0xc384('0x0'));var util=require(_0xc384('0x1'));var logger=require(_0xc384('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc384('0x3'));var fs=require('fs');var path=require(_0xc384('0x4'));var rimraf=require(_0xc384('0x5'));var config=require(_0xc384('0x6'));var attributes=require(_0xc384('0x7'));module[_0xc384('0x8')]=function(_0x13332c,_0x6babd4){return _0x13332c[_0xc384('0x9')](_0xc384('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc20a=['exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x349798,_0x446636){var _0x321e84=function(_0x263bf6){while(--_0x263bf6){_0x349798['push'](_0x349798['shift']());}};_0x321e84(++_0x446636);}(_0xc20a,0x1cc));var _0xac20=function(_0x3cb48e,_0x580d7a){_0x3cb48e=_0x3cb48e-0x0;var _0x27c35a=_0xc20a[_0x3cb48e];return _0x27c35a;};'use strict';var _=require(_0xac20('0x0'));var util=require('util');var logger=require(_0xac20('0x1'))(_0xac20('0x2'));var moment=require(_0xac20('0x3'));var BPromise=require('bluebird');var rp=require(_0xac20('0x4'));var fs=require('fs');var path=require(_0xac20('0x5'));var rimraf=require(_0xac20('0x6'));var config=require(_0xac20('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xac20('0x8')]=function(_0x5dba1a,_0x348030){return _0x5dba1a[_0xac20('0x9')](_0xac20('0xa'),attributes,{'tableName':_0xac20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index cc8477e..905b161 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 _0x0ca9=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0ca9,0xee));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x90ca('0x0'));var moment=require(_0x90ca('0x1'));var BPromise=require(_0x90ca('0x2'));var rs=require(_0x90ca('0x3'));var fs=require('fs');var Redis=require(_0x90ca('0x4'));var db=require(_0x90ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x90ca('0x6'))(_0x90ca('0x7'));var config=require(_0x90ca('0x8'));var jayson=require(_0x90ca('0x9'));var client=jayson['client'][_0x90ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd5c6,_0xa1c53a,_0x456481){return new BPromise(function(_0xb09b17,_0x389069){return client[_0x90ca('0xb')](_0x3dd5c6,_0x456481)[_0x90ca('0xc')](function(_0x4a473f){logger['info'](_0x90ca('0xd'),_0xa1c53a,_0x90ca('0xe'));logger[_0x90ca('0xf')](_0x90ca('0x10'),_0xa1c53a,_0x90ca('0xe'),JSON['stringify'](_0x4a473f));if(_0x4a473f[_0x90ca('0x11')]){if(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x12')]===0x1f4){logger[_0x90ca('0x11')]('UserChatQueue,\x20%s,\x20%s',_0xa1c53a,_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);return _0x389069(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);}logger['error'](_0x90ca('0xd'),_0xa1c53a,_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);return _0xb09b17(_0x4a473f[_0x90ca('0x11')][_0x90ca('0x13')]);}else{logger[_0x90ca('0x14')](_0x90ca('0xd'),_0xa1c53a,_0x90ca('0xe'));_0xb09b17(_0x4a473f[_0x90ca('0x15')]['message']);}})['catch'](function(_0x51bfe2){logger[_0x90ca('0x11')](_0x90ca('0xd'),_0xa1c53a,_0x51bfe2);_0x389069(_0x51bfe2);});});} \ No newline at end of file +var _0x68f1=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x68f1,0x131));var _0x168f=function(_0x54b468,_0x553142){_0x54b468=_0x54b468-0x0;var _0x23ce45=_0x68f1[_0x54b468];return _0x23ce45;};'use strict';var _=require(_0x168f('0x0'));var util=require(_0x168f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x168f('0x2'));var fs=require('fs');var Redis=require(_0x168f('0x3'));var db=require(_0x168f('0x4'))['db'];var utils=require(_0x168f('0x5'));var logger=require(_0x168f('0x6'))('rpc');var config=require(_0x168f('0x7'));var jayson=require(_0x168f('0x8'));var client=jayson[_0x168f('0x9')][_0x168f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263504,_0x420ca6,_0x3716b2){return new BPromise(function(_0x5cedb8,_0x5d0466){return client['request'](_0x263504,_0x3716b2)['then'](function(_0x319614){logger[_0x168f('0xb')](_0x168f('0xc'),_0x420ca6,_0x168f('0xd'));logger['debug'](_0x168f('0xe'),_0x420ca6,_0x168f('0xd'),JSON['stringify'](_0x319614));if(_0x319614['error']){if(_0x319614['error']['code']===0x1f4){logger['error'](_0x168f('0xc'),_0x420ca6,_0x319614[_0x168f('0xf')]['message']);return _0x5d0466(_0x319614[_0x168f('0xf')][_0x168f('0x10')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x420ca6,_0x319614[_0x168f('0xf')]['message']);return _0x5cedb8(_0x319614[_0x168f('0xf')]['message']);}else{logger[_0x168f('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x420ca6,_0x168f('0xd'));_0x5cedb8(_0x319614[_0x168f('0x11')][_0x168f('0x10')]);}})[_0x168f('0x12')](function(_0xbebb03){logger[_0x168f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x420ca6,_0xbebb03);_0x5d0466(_0xbebb03);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index de14361..085d28e 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(_0x3180da,_0x53a63d){var _0x10f321=function(_0x18bd07){while(--_0x18bd07){_0x3180da['push'](_0x3180da['shift']());}};_0x10f321(++_0x53a63d);}(_0xe706,0xa3));var _0x6e70=function(_0x3216f5,_0xe32e8a){_0x3216f5=_0x3216f5-0x0;var _0x17035a=_0xe706[_0x3216f5];return _0x17035a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5c8b01,_0x1102c1){var _0x180b22=function(_0x279299){while(--_0x279299){_0x5c8b01['push'](_0x5c8b01['shift']());}};_0x180b22(++_0x1102c1);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 2d6ce17..079f6d3 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 _0x97e2=['INTEGER','exports'];(function(_0x13e758,_0x317d23){var _0x5b53c3=function(_0x103e80){while(--_0x103e80){_0x13e758['push'](_0x13e758['shift']());}};_0x5b53c3(++_0x317d23);}(_0x97e2,0x1ef));var _0x297e=function(_0x3da359,_0x42cf0f){_0x3da359=_0x3da359-0x0;var _0x4f8a10=_0x97e2[_0x3da359];return _0x4f8a10;};'use strict';var Sequelize=require('sequelize');module[_0x297e('0x0')]={'penalty':{'type':Sequelize[_0x297e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8532=['sequelize','exports','INTEGER'];(function(_0x3e193f,_0x3148e3){var _0x241b8a=function(_0x47d357){while(--_0x47d357){_0x3e193f['push'](_0x3e193f['shift']());}};_0x241b8a(++_0x3148e3);}(_0x8532,0x1cb));var _0x2853=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x8532[_0x3c5e54];return _0x3ae1f3;};'use strict';var Sequelize=require(_0x2853('0x0'));module[_0x2853('0x1')]={'penalty':{'type':Sequelize[_0x2853('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2853('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ca35eec..c8798df 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 _0x1322=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x1322,0xfc));var _0x2132=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x1322[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x2132('0x0'));var util=require(_0x2132('0x1'));var logger=require(_0x2132('0x2'))(_0x2132('0x3'));var moment=require(_0x2132('0x4'));var BPromise=require('bluebird');var rp=require(_0x2132('0x5'));var fs=require('fs');var path=require(_0x2132('0x6'));var rimraf=require(_0x2132('0x7'));var config=require(_0x2132('0x8'));var attributes=require(_0x2132('0x9'));module[_0x2132('0xa')]=function(_0x18b85a,_0xf35e6b){return _0x18b85a[_0x2132('0xb')](_0x2132('0xc'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x083d=['api','moment','bluebird','path','rimraf','../../config/environment','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x55c4fa,_0x5506d6){var _0x406d72=function(_0x534eff){while(--_0x534eff){_0x55c4fa['push'](_0x55c4fa['shift']());}};_0x406d72(++_0x5506d6);}(_0x083d,0x1ca));var _0xd083=function(_0x2a411e,_0xfc9cd){_0x2a411e=_0x2a411e-0x0;var _0x19128f=_0x083d[_0x2a411e];return _0x19128f;};'use strict';var _=require(_0xd083('0x0'));var util=require('util');var logger=require(_0xd083('0x1'))(_0xd083('0x2'));var moment=require(_0xd083('0x3'));var BPromise=require(_0xd083('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd083('0x5'));var rimraf=require(_0xd083('0x6'));var config=require(_0xd083('0x7'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x1f645b,_0x1296cb){return _0x1f645b[_0xd083('0x8')]('UserFaxQueue',attributes,{'tableName':_0xd083('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 6e95181..11e2c67 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 _0x21b8=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2295fa,_0x53f01b){var _0xcdd3b7=function(_0x3dbd2e){while(--_0x3dbd2e){_0x2295fa['push'](_0x2295fa['shift']());}};_0xcdd3b7(++_0x53f01b);}(_0x21b8,0xf6));var _0x821b=function(_0x357287,_0x368265){_0x357287=_0x357287-0x0;var _0x168be1=_0x21b8[_0x357287];return _0x168be1;};'use strict';var _=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var moment=require(_0x821b('0x2'));var BPromise=require('bluebird');var rs=require(_0x821b('0x3'));var fs=require('fs');var Redis=require(_0x821b('0x4'));var db=require(_0x821b('0x5'))['db'];var utils=require(_0x821b('0x6'));var logger=require('../../config/logger')(_0x821b('0x7'));var config=require('../../config/environment');var jayson=require(_0x821b('0x8'));var client=jayson['client'][_0x821b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x459b18,_0xa961c2,_0x556803){return new BPromise(function(_0x3194b6,_0x556198){return client['request'](_0x459b18,_0x556803)[_0x821b('0xa')](function(_0x16e9a8){logger['info'](_0x821b('0xb'),_0xa961c2,_0x821b('0xc'));logger[_0x821b('0xd')](_0x821b('0xe'),_0xa961c2,_0x821b('0xc'),JSON[_0x821b('0xf')](_0x16e9a8));if(_0x16e9a8[_0x821b('0x10')]){if(_0x16e9a8[_0x821b('0x10')][_0x821b('0x11')]===0x1f4){logger['error'](_0x821b('0xb'),_0xa961c2,_0x16e9a8[_0x821b('0x10')]['message']);return _0x556198(_0x16e9a8[_0x821b('0x10')][_0x821b('0x12')]);}logger[_0x821b('0x10')](_0x821b('0xb'),_0xa961c2,_0x16e9a8['error'][_0x821b('0x12')]);return _0x3194b6(_0x16e9a8[_0x821b('0x10')][_0x821b('0x12')]);}else{logger[_0x821b('0x13')](_0x821b('0xb'),_0xa961c2,_0x821b('0xc'));_0x3194b6(_0x16e9a8[_0x821b('0x14')][_0x821b('0x12')]);}})[_0x821b('0x15')](function(_0x1fe776){logger[_0x821b('0x10')](_0x821b('0xb'),_0xa961c2,_0x1fe776);_0x556198(_0x1fe776);});});} \ No newline at end of file +var _0x3474=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash'];(function(_0x3aed99,_0x675423){var _0x22fc20=function(_0x3f6163){while(--_0x3f6163){_0x3aed99['push'](_0x3aed99['shift']());}};_0x22fc20(++_0x675423);}(_0x3474,0x179));var _0x4347=function(_0x413a72,_0x118ac4){_0x413a72=_0x413a72-0x0;var _0x54b63c=_0x3474[_0x413a72];return _0x54b63c;};'use strict';var _=require(_0x4347('0x0'));var util=require('util');var moment=require(_0x4347('0x1'));var BPromise=require(_0x4347('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4347('0x3'));var db=require(_0x4347('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4347('0x5'))(_0x4347('0x6'));var config=require(_0x4347('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4347('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d3abe,_0x36d0ae,_0x1e7599){return new BPromise(function(_0x3c6a44,_0x4df2fc){return client[_0x4347('0x9')](_0x3d3abe,_0x1e7599)['then'](function(_0x2d4e60){logger[_0x4347('0xa')](_0x4347('0xb'),_0x36d0ae,'request\x20sent');logger['debug'](_0x4347('0xc'),_0x36d0ae,'request\x20sent',JSON['stringify'](_0x2d4e60));if(_0x2d4e60[_0x4347('0xd')]){if(_0x2d4e60[_0x4347('0xd')][_0x4347('0xe')]===0x1f4){logger[_0x4347('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x36d0ae,_0x2d4e60['error'][_0x4347('0xf')]);return _0x4df2fc(_0x2d4e60[_0x4347('0xd')][_0x4347('0xf')]);}logger[_0x4347('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x36d0ae,_0x2d4e60[_0x4347('0xd')][_0x4347('0xf')]);return _0x3c6a44(_0x2d4e60[_0x4347('0xd')][_0x4347('0xf')]);}else{logger[_0x4347('0xa')](_0x4347('0xb'),_0x36d0ae,_0x4347('0x10'));_0x3c6a44(_0x2d4e60['result'][_0x4347('0xf')]);}})[_0x4347('0x11')](function(_0x3b1407){logger[_0x4347('0xd')](_0x4347('0xb'),_0x36d0ae,_0x3b1407);_0x4df2fc(_0x3b1407);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index b3bbce3..ad7d02e 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xb98d8d,_0x481423){var _0x489b15=function(_0x409a13){while(--_0x409a13){_0xb98d8d['push'](_0xb98d8d['shift']());}};_0x489b15(++_0x481423);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xebc72a,_0x5a55c5){var _0x441d7d=function(_0x8a1eaf){while(--_0x8a1eaf){_0xebc72a['push'](_0xebc72a['shift']());}};_0x441d7d(++_0x5a55c5);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 4d8b098..108d40b 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 _0x1a2a=['exports','INTEGER','sequelize'];(function(_0x359def,_0x5abd96){var _0x30412d=function(_0x4a4725){while(--_0x4a4725){_0x359def['push'](_0x359def['shift']());}};_0x30412d(++_0x5abd96);}(_0x1a2a,0x83));var _0xa1a2=function(_0x125425,_0x4b6bab){_0x125425=_0x125425-0x0;var _0xd04dc4=_0x1a2a[_0x125425];return _0xd04dc4;};'use strict';var Sequelize=require(_0xa1a2('0x0'));module[_0xa1a2('0x1')]={'penalty':{'type':Sequelize[_0xa1a2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb41c=['INTEGER','sequelize','exports'];(function(_0x5a0b42,_0x3e3308){var _0x1ecfad=function(_0x2fcc95){while(--_0x2fcc95){_0x5a0b42['push'](_0x5a0b42['shift']());}};_0x1ecfad(++_0x3e3308);}(_0xb41c,0x14e));var _0xcb41=function(_0x359434,_0x32d220){_0x359434=_0x359434-0x0;var _0x52a2b4=_0xb41c[_0x359434];return _0x52a2b4;};'use strict';var Sequelize=require(_0xcb41('0x0'));module[_0xcb41('0x1')]={'penalty':{'type':Sequelize[_0xcb41('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 d68c6db..3e8f69c 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 _0xcc89=['./userMailQueue.attributes','define','user_has_mail_queues','lodash','../../config/logger','moment','../../config/environment'];(function(_0x531b1e,_0x301978){var _0x1208b6=function(_0x3af74a){while(--_0x3af74a){_0x531b1e['push'](_0x531b1e['shift']());}};_0x1208b6(++_0x301978);}(_0xcc89,0x1df));var _0x9cc8=function(_0x2c9874,_0x1b596e){_0x2c9874=_0x2c9874-0x0;var _0x4f52e7=_0xcc89[_0x2c9874];return _0x4f52e7;};'use strict';var _=require(_0x9cc8('0x0'));var util=require('util');var logger=require(_0x9cc8('0x1'))('api');var moment=require(_0x9cc8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9cc8('0x3'));var attributes=require(_0x9cc8('0x4'));module['exports']=function(_0x2d6990,_0x58b55a){return _0x2d6990[_0x9cc8('0x5')]('UserMailQueue',attributes,{'tableName':_0x9cc8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ad0=['exports','user_has_mail_queues','lodash','util','moment','request-promise','./userMailQueue.attributes'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x9ad0,0xb1));var _0x09ad=function(_0x3b6a3f,_0x1537d5){_0x3b6a3f=_0x3b6a3f-0x0;var _0x3f7379=_0x9ad0[_0x3b6a3f];return _0x3f7379;};'use strict';var _=require(_0x09ad('0x0'));var util=require(_0x09ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09ad('0x2'));var BPromise=require('bluebird');var rp=require(_0x09ad('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09ad('0x4'));module[_0x09ad('0x5')]=function(_0x28150c,_0x5cc805){return _0x28150c['define']('UserMailQueue',attributes,{'tableName':_0x09ad('0x6'),'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 37a1c72..45812be 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x566c8a,_0x34da6c){var _0xc82ae8=function(_0xa8795c){while(--_0xa8795c){_0x566c8a['push'](_0x566c8a['shift']());}};_0xc82ae8(++_0x34da6c);}(_0x6aa7,0x178));var _0x76aa=function(_0x2cd4fd,_0x4cbc8b){_0x2cd4fd=_0x2cd4fd-0x0;var _0x406b68=_0x6aa7[_0x2cd4fd];return _0x406b68;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5546fb,_0x574452){var _0x26a624=function(_0x303d86){while(--_0x303d86){_0x5546fb['push'](_0x5546fb['shift']());}};_0x26a624(++_0x574452);}(_0x6aa7,0x178));var _0x76aa=function(_0x4b50eb,_0x43cc8c){_0x4b50eb=_0x4b50eb-0x0;var _0x276347=_0x6aa7[_0x4b50eb];return _0x276347;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index e495add..2261f3a 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 _0xc838=['../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5bb1ed,_0x488623){var _0x357bdb=function(_0x3e4662){while(--_0x3e4662){_0x5bb1ed['push'](_0x5bb1ed['shift']());}};_0x357bdb(++_0x488623);}(_0xc838,0x179));var _0x8c83=function(_0x1935bc,_0x160450){_0x1935bc=_0x1935bc-0x0;var _0x1a04d8=_0xc838[_0x1935bc];return _0x1a04d8;};'use strict';var multer=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var path=require(_0x8c83('0x2'));var timeout=require(_0x8c83('0x3'));var express=require(_0x8c83('0x4'));var router=express[_0x8c83('0x5')]();var fs_extra=require(_0x8c83('0x6'));var auth=require(_0x8c83('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c83('0x8'));router['post']('/',auth[_0x8c83('0x9')](),controller[_0x8c83('0xa')]);module[_0x8c83('0xb')]=router; \ No newline at end of file +var _0x5576=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports'];(function(_0x131951,_0x59bd06){var _0x11c6fa=function(_0x1f28a3){while(--_0x1f28a3){_0x131951['push'](_0x131951['shift']());}};_0x11c6fa(++_0x59bd06);}(_0x5576,0xd8));var _0x6557=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x5576[_0x15a8fa];return _0x1355c2;};'use strict';var multer=require(_0x6557('0x0'));var util=require('util');var path=require(_0x6557('0x1'));var timeout=require('connect-timeout');var express=require(_0x6557('0x2'));var router=express[_0x6557('0x3')]();var fs_extra=require(_0x6557('0x4'));var auth=require(_0x6557('0x5'));var interaction=require(_0x6557('0x6'));var config=require(_0x6557('0x7'));var controller=require(_0x6557('0x8'));router[_0x6557('0x9')]('/',auth['isAuthenticated'](),controller[_0x6557('0xa')]);module[_0x6557('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7b09fe5..1aaa08e 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 _0x4b12=['TEXT','STRING'];(function(_0x268421,_0x29336d){var _0x46ace0=function(_0x8cd6ec){while(--_0x8cd6ec){_0x268421['push'](_0x268421['shift']());}};_0x46ace0(++_0x29336d);}(_0x4b12,0xda));var _0x24b1=function(_0x25ca60,_0x5ea135){_0x25ca60=_0x25ca60-0x0;var _0x1088e6=_0x4b12[_0x25ca60];return _0x1088e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x24b1('0x0')]},'senderName':{'type':Sequelize[_0x24b1('0x1')]},'recipientsId':{'type':Sequelize[_0x24b1('0x0')]},'recipientsDescription':{'type':Sequelize[_0x24b1('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x2f43=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3a6a36,_0x114699){var _0x2a15b9=function(_0x517e20){while(--_0x517e20){_0x3a6a36['push'](_0x3a6a36['shift']());}};_0x2a15b9(++_0x114699);}(_0x2f43,0x1e8));var _0x32f4=function(_0x47a2ae,_0x150ea3){_0x47a2ae=_0x47a2ae-0x0;var _0x3752ea=_0x2f43[_0x47a2ae];return _0x3752ea;};'use strict';var Sequelize=require(_0x32f4('0x0'));module[_0x32f4('0x1')]={'body':{'type':Sequelize[_0x32f4('0x2')]},'senderName':{'type':Sequelize[_0x32f4('0x3')]},'recipientsId':{'type':Sequelize[_0x32f4('0x2')]},'recipientsDescription':{'type':Sequelize[_0x32f4('0x3')]},'beep':{'type':Sequelize[_0x32f4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b0d50f8..ca26213 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 _0xe6cd=['sendUserNotification','body','text','TemplateId','ValidationError','hasOwnProperty','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','render','html','view','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','map','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send'];(function(_0x1f825a,_0x36ad38){var _0x3e4958=function(_0x3fcfd3){while(--_0x3fcfd3){_0x1f825a['push'](_0x1f825a['shift']());}};_0x3e4958(++_0x36ad38);}(_0xe6cd,0x1bd));var _0xde6c=function(_0xbf8f73,_0x2ca243){_0xbf8f73=_0xbf8f73-0x0;var _0x53d9a9=_0xe6cd[_0xbf8f73];return _0x53d9a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6c('0x0'));var zipdir=require(_0xde6c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xde6c('0x2'));var Mustache=require(_0xde6c('0x3'));var util=require('util');var path=require(_0xde6c('0x4'));var sox=require(_0xde6c('0x5'));var csv=require(_0xde6c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde6c('0x7'));var squel=require('squel');var crypto=require(_0xde6c('0x8'));var jsforce=require(_0xde6c('0x9'));var deskjs=require(_0xde6c('0xa'));var toCsv=require(_0xde6c('0x6'));var querystring=require(_0xde6c('0xb'));var Papa=require('papaparse');var Redis=require(_0xde6c('0xc'));var authService=require(_0xde6c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xde6c('0xe'));var hardwareService=require(_0xde6c('0xf'));var logger=require(_0xde6c('0x10'))(_0xde6c('0x11'));var utils=require(_0xde6c('0x12'));var config=require(_0xde6c('0x13'));var licenseUtil=require(_0xde6c('0x14'));var db=require(_0xde6c('0x15'))['db'];config[_0xde6c('0x16')]=_[_0xde6c('0x17')](config[_0xde6c('0x16')],{'host':_0xde6c('0x18'),'port':0x18eb});var socket=require(_0xde6c('0x19'))(new Redis(config[_0xde6c('0x16')]));require('./userNotification.socket')[_0xde6c('0x1a')](socket);function respondWithStatusCode(_0x5b98fb,_0x400f1b){_0x400f1b=_0x400f1b||0xcc;return function(_0x2ce1b6){if(_0x2ce1b6){return _0x5b98fb['sendStatus'](_0x400f1b);}return _0x5b98fb[_0xde6c('0x1b')](_0x400f1b)[_0xde6c('0x1c')]();};}function respondWithResult(_0x421ac2,_0x3ab8c6){_0x3ab8c6=_0x3ab8c6||0xc8;return function(_0x159ccc){if(_0x159ccc){return _0x421ac2[_0xde6c('0x1b')](_0x3ab8c6)[_0xde6c('0x1d')](_0x159ccc);}};}function respondWithFilteredResult(_0x937ec,_0x4f8275){return function(_0x1ce909){if(_0x1ce909){var _0x5d194a=typeof _0x4f8275[_0xde6c('0x1e')]===_0xde6c('0x1f')&&typeof _0x4f8275['limit']===_0xde6c('0x1f');var _0x433e5e=_0x1ce909[_0xde6c('0x20')];var _0x440744=_0x5d194a?0x0:_0x4f8275[_0xde6c('0x1e')];var _0x228cd8=_0x5d194a?_0x1ce909[_0xde6c('0x20')]:_0x4f8275[_0xde6c('0x1e')]+_0x4f8275[_0xde6c('0x21')];var _0x329034;if(_0x228cd8>=_0x433e5e){_0x228cd8=_0x433e5e;_0x329034=0xc8;}else{_0x329034=0xce;}_0x937ec[_0xde6c('0x1b')](_0x329034);return _0x937ec[_0xde6c('0x22')](_0xde6c('0x23'),_0x440744+'-'+_0x228cd8+'/'+_0x433e5e)[_0xde6c('0x1d')](_0x1ce909);}return null;};}function patchUpdates(_0x167cc8){return function(_0x5d3d5f){try{jsonpatch[_0xde6c('0x24')](_0x5d3d5f,_0x167cc8,!![]);}catch(_0x5ea8bc){return BPromise[_0xde6c('0x25')](_0x5ea8bc);}return _0x5d3d5f['save']();};}function saveUpdates(_0x1040b,_0x3377d3){return function(_0x1b10c2){if(_0x1b10c2){return _0x1b10c2[_0xde6c('0x26')](_0x1040b)['then'](function(_0xe1b1b9){return _0xe1b1b9;});}return null;};}function removeEntity(_0x500d2f,_0x185d06){return function(_0x397f4d){if(_0x397f4d){return _0x397f4d[_0xde6c('0x27')]()[_0xde6c('0x28')](function(){_0x500d2f[_0xde6c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x272ece,_0x109e58){return function(_0x2c170a){if(!_0x2c170a){_0x272ece[_0xde6c('0x29')](0x194);}return _0x2c170a;};}function handleError(_0x502df0,_0x1411a7){_0x1411a7=_0x1411a7||0x1f4;return function(_0x483a13){logger[_0xde6c('0x2a')](_0x483a13['stack']);if(_0x483a13['name']){delete _0x483a13[_0xde6c('0x2b')];}_0x502df0[_0xde6c('0x1b')](_0x1411a7)[_0xde6c('0x2c')](_0x483a13);};}exports[_0xde6c('0x2d')]=function(_0x522b21,_0x127d7d,_0x5eea2c){if(!_0x522b21[_0xde6c('0x2e')]['hasOwnProperty'](_0xde6c('0x2f'))&&!_0x522b21[_0xde6c('0x2e')]['hasOwnProperty'](_0xde6c('0x30'))){throw new db['Sequelize'][(_0xde6c('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')]('TemplateId')&&!_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')]('view')){throw new db[(_0xde6c('0x33'))]['ValidationError'](_0xde6c('0x34'));}if(!_0x522b21[_0xde6c('0x2e')][_0xde6c('0x32')](_0xde6c('0x35'))){throw new db[(_0xde6c('0x33'))][(_0xde6c('0x31'))](_0xde6c('0x36'));}else{try{var _0x1e30f7=JSON[_0xde6c('0x37')](_0x522b21[_0xde6c('0x2e')][_0xde6c('0x35')]);}catch(_0x20233b){logger[_0xde6c('0x2a')](_0x20233b);throw new db['Sequelize'][(_0xde6c('0x31'))](_0xde6c('0x38'));}var _0x3814bc=[_0xde6c('0x39'),_0xde6c('0x3a'),'mailqueue',_0xde6c('0x3b'),_0xde6c('0x3c'),'voicequeue',_0xde6c('0x3d'),_0xde6c('0x3e'),_0xde6c('0x3f')];if(_['some'](_0x1e30f7,function(_0x278566){return!_['includes'](_0x3814bc,_0x278566[_0xde6c('0x40')][_0xde6c('0x41')]());})){throw new db['Sequelize'][(_0xde6c('0x31'))](_0xde6c('0x42'));}}}var _0x2fa946={};_0x2fa946[_0xde6c('0x43')]=_0x522b21['body']['hasOwnProperty'](_0xde6c('0x43'))?_0x522b21[_0xde6c('0x2e')][_0xde6c('0x43')]:_0x522b21['user']['fullname'];_0x2fa946[_0xde6c('0x44')]=_['isEmpty'](_0x522b21[_0xde6c('0x2e')][_0xde6c('0x44')])?null:_0x522b21[_0xde6c('0x2e')][_0xde6c('0x44')];_0x2fa946[_0xde6c('0x45')]=_0x522b21[_0xde6c('0x2e')][_0xde6c('0x45')]||![];_0x2fa946[_0xde6c('0x46')]=_0x522b21[_0xde6c('0x3f')]['id'];return getContent(_0x522b21['body'])[_0xde6c('0x28')](function(_0x1f13a4){_0x2fa946['body']=_0x1f13a4;return getRecipients(_0x1e30f7);})[_0xde6c('0x28')](function(_0x5ae755){_0x2fa946['recipientsId']=_[_0xde6c('0x47')](_0x5ae755)['join'](',');return db[_0xde6c('0x48')][_0xde6c('0x49')](function(_0x24caac){return db[_0xde6c('0x4a')][_0xde6c('0x4b')](_0x2fa946,{'raw':!![],'transaction':_0x24caac})[_0xde6c('0x28')](function(_0x34a7a9){var _0x28c561={'sender':_0x2fa946[_0xde6c('0x43')],'description':_0x2fa946[_0xde6c('0x44')],'content':_0x2fa946[_0xde6c('0x2e')],'beep':_0x2fa946[_0xde6c('0x45')]};_0x5ae755[_0xde6c('0x4c')](function(_0x4bfccb){_0x28c561[_0xde6c('0x4d')]=_0x4bfccb;socket[_0xde6c('0x4e')](_0xde6c('0x4f'),_0x28c561);});return _0x34a7a9;});});})[_0xde6c('0x28')](respondWithResult(_0x127d7d,0xc9))[_0xde6c('0x50')](handleError(_0x127d7d,null));};function getContent(_0x372b67){return new BPromise(function(_0x521629,_0x5f47c6){if(_0x372b67['text']){_0x521629(_0x372b67[_0xde6c('0x2f')]);return;}return db[_0xde6c('0x51')][_0xde6c('0x52')]({'attributes':['html'],'where':{'id':_0x372b67['TemplateId']},'raw':!![]})['then'](function(_0x421604){if(!_0x421604)throw new db[(_0xde6c('0x33'))][(_0xde6c('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4301a0=Mustache[_0xde6c('0x53')](_0x421604[_0xde6c('0x54')],_0x372b67[_0xde6c('0x55')]);_0x521629(_0x4301a0);})[_0xde6c('0x50')](function(_0x186723){_0x5f47c6(_0x186723);});});}function getRecipients(_0x571398){return new BPromise(function(_0x35da7b,_0xbeb213){var _0x54be17=[];var _0x4b1ac2=[];_0x571398['forEach'](function(_0x36a323){var _0x120870=_[_0xde6c('0x56')](_0x36a323[_0xde6c('0x40')][_0xde6c('0x41')]());if(_0x120870===_0xde6c('0x57')){_0x54be17=_[_0xde6c('0x58')](_0x54be17,_0x36a323[_0xde6c('0x59')]);}else{if(_[_0xde6c('0x5a')](_0x120870,_0xde6c('0x5b')))_0x120870=_0x120870[_0xde6c('0x5c')](_0xde6c('0x5b'),_0xde6c('0x5d'));_0x36a323[_0xde6c('0x59')][_0xde6c('0x4c')](function(_0x3ac01e){_0x4b1ac2[_0xde6c('0x5e')](getAgents(_0x120870,_0x3ac01e));});}});return BPromise[_0xde6c('0x5f')](_0x4b1ac2)[_0xde6c('0x28')](function(_0x27dba8){_0x54be17=_[_0xde6c('0x58')](_0x54be17,_[_0xde6c('0x60')](_0x27dba8));_0x35da7b(_0x54be17);})['catch'](function(_0x4a19f9){_0xbeb213(_0x4a19f9);});});}function getAgents(_0x43777b,_0x3ffa2e){return new BPromise(function(_0x58d924,_0x3637dc){return db[_0x43777b][_0xde6c('0x52')]({'where':{'id':_0x3ffa2e}})[_0xde6c('0x28')](function(_0x2c19e5){return _0x2c19e5['getAgents']({'attributes':['id'],'raw':!![]})[_0xde6c('0x28')](function(_0x32246d){var _0x23627f=_[_0xde6c('0x61')](_0x32246d,'id');_0x58d924(_0x23627f);});})[_0xde6c('0x50')](function(_0x3d5b46){_0x3637dc(_0x3d5b46);});});} \ No newline at end of file +var _0xe8ed=['register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','ValidationError','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','sortBy','join','transaction','UserNotification','create','recipient','userNotification:send','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','forEach','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','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','redis','localhost','socket.io-emitter','./userNotification.socket'];(function(_0x511a0f,_0x1c41de){var _0x336830=function(_0x4f76f9){while(--_0x4f76f9){_0x511a0f['push'](_0x511a0f['shift']());}};_0x336830(++_0x1c41de);}(_0xe8ed,0x16c));var _0xde8e=function(_0x1525e1,_0x1788a1){_0x1525e1=_0x1525e1-0x0;var _0x106e37=_0xe8ed[_0x1525e1];return _0x106e37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde8e('0x0'));var zipdir=require(_0xde8e('0x1'));var jsonpatch=require(_0xde8e('0x2'));var rp=require('request-promise');var moment=require(_0xde8e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xde8e('0x4'));var util=require(_0xde8e('0x5'));var path=require(_0xde8e('0x6'));var sox=require(_0xde8e('0x7'));var csv=require(_0xde8e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde8e('0x9'));var _=require('lodash');var squel=require(_0xde8e('0xa'));var crypto=require(_0xde8e('0xb'));var jsforce=require(_0xde8e('0xc'));var deskjs=require(_0xde8e('0xd'));var toCsv=require(_0xde8e('0x8'));var querystring=require(_0xde8e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xde8e('0xf'));var qs=require(_0xde8e('0x10'));var as=require(_0xde8e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde8e('0x12'))(_0xde8e('0x13'));var utils=require(_0xde8e('0x14'));var config=require(_0xde8e('0x15'));var licenseUtil=require(_0xde8e('0x16'));var db=require(_0xde8e('0x17'))['db'];config['redis']=_['defaults'](config[_0xde8e('0x18')],{'host':_0xde8e('0x19'),'port':0x18eb});var socket=require(_0xde8e('0x1a'))(new Redis(config[_0xde8e('0x18')]));require(_0xde8e('0x1b'))[_0xde8e('0x1c')](socket);function respondWithStatusCode(_0x1424e9,_0x199db5){_0x199db5=_0x199db5||0xcc;return function(_0x48ec76){if(_0x48ec76){return _0x1424e9[_0xde8e('0x1d')](_0x199db5);}return _0x1424e9[_0xde8e('0x1e')](_0x199db5)[_0xde8e('0x1f')]();};}function respondWithResult(_0x1c20f8,_0x2dda1a){_0x2dda1a=_0x2dda1a||0xc8;return function(_0x511b99){if(_0x511b99){return _0x1c20f8[_0xde8e('0x1e')](_0x2dda1a)[_0xde8e('0x20')](_0x511b99);}};}function respondWithFilteredResult(_0x587aca,_0xbffdbc){return function(_0x26aea5){if(_0x26aea5){var _0x1a6175=typeof _0xbffdbc['offset']==='undefined'&&typeof _0xbffdbc[_0xde8e('0x21')]===_0xde8e('0x22');var _0x521602=_0x26aea5[_0xde8e('0x23')];var _0x2e959f=_0x1a6175?0x0:_0xbffdbc[_0xde8e('0x24')];var _0x5bf099=_0x1a6175?_0x26aea5[_0xde8e('0x23')]:_0xbffdbc[_0xde8e('0x24')]+_0xbffdbc[_0xde8e('0x21')];var _0x4e8c1b;if(_0x5bf099>=_0x521602){_0x5bf099=_0x521602;_0x4e8c1b=0xc8;}else{_0x4e8c1b=0xce;}_0x587aca['status'](_0x4e8c1b);return _0x587aca[_0xde8e('0x25')](_0xde8e('0x26'),_0x2e959f+'-'+_0x5bf099+'/'+_0x521602)[_0xde8e('0x20')](_0x26aea5);}return null;};}function patchUpdates(_0xfdf8bd){return function(_0x57a79e){try{jsonpatch[_0xde8e('0x27')](_0x57a79e,_0xfdf8bd,!![]);}catch(_0x2465c5){return BPromise['reject'](_0x2465c5);}return _0x57a79e[_0xde8e('0x28')]();};}function saveUpdates(_0x20a72a,_0x3028d8){return function(_0x3a8dd4){if(_0x3a8dd4){return _0x3a8dd4['update'](_0x20a72a)[_0xde8e('0x29')](function(_0x294bbb){return _0x294bbb;});}return null;};}function removeEntity(_0x587bc1,_0x5efcc8){return function(_0x18d8d5){if(_0x18d8d5){return _0x18d8d5[_0xde8e('0x2a')]()[_0xde8e('0x29')](function(){_0x587bc1[_0xde8e('0x1e')](0xcc)[_0xde8e('0x1f')]();});}};}function handleEntityNotFound(_0xfadc95,_0x39a700){return function(_0x3010e2){if(!_0x3010e2){_0xfadc95[_0xde8e('0x1d')](0x194);}return _0x3010e2;};}function handleError(_0x964bc0,_0x422e0f){_0x422e0f=_0x422e0f||0x1f4;return function(_0x22b93d){logger[_0xde8e('0x2b')](_0x22b93d[_0xde8e('0x2c')]);if(_0x22b93d[_0xde8e('0x2d')]){delete _0x22b93d[_0xde8e('0x2d')];}_0x964bc0[_0xde8e('0x1e')](_0x422e0f)[_0xde8e('0x2e')](_0x22b93d);};}exports[_0xde8e('0x2f')]=function(_0x4ff9a6,_0x4ff445,_0x34279b){if(!_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x31')]('text')&&!_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x31')](_0xde8e('0x32'))){throw new db['Sequelize'][(_0xde8e('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x31')](_0xde8e('0x32'))&&!_0x4ff9a6['body'][_0xde8e('0x31')]('view')){throw new db[(_0xde8e('0x34'))][(_0xde8e('0x33'))](_0xde8e('0x35'));}if(!_0x4ff9a6['body'][_0xde8e('0x31')](_0xde8e('0x36'))){throw new db[(_0xde8e('0x34'))][(_0xde8e('0x33'))](_0xde8e('0x37'));}else{try{var _0x378a51=JSON[_0xde8e('0x38')](_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x36')]);}catch(_0x4de649){logger['error'](_0x4de649);throw new db[(_0xde8e('0x34'))][(_0xde8e('0x33'))](_0xde8e('0x39'));}var _0x3dc5cb=[_0xde8e('0x3a'),_0xde8e('0x3b'),'mailqueue',_0xde8e('0x3c'),'smsqueue','voicequeue','whatsappqueue',_0xde8e('0x3d'),'user'];if(_['some'](_0x378a51,function(_0x38d5b8){return!_[_0xde8e('0x3e')](_0x3dc5cb,_0x38d5b8[_0xde8e('0x3f')][_0xde8e('0x40')]());})){throw new db['Sequelize'][(_0xde8e('0x33'))](_0xde8e('0x41'));}}}var _0x532577={};_0x532577[_0xde8e('0x42')]=_0x4ff9a6[_0xde8e('0x30')]['hasOwnProperty'](_0xde8e('0x42'))?_0x4ff9a6['body'][_0xde8e('0x42')]:_0x4ff9a6[_0xde8e('0x43')][_0xde8e('0x44')];_0x532577[_0xde8e('0x45')]=_[_0xde8e('0x46')](_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x45')])?null:_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x45')];_0x532577[_0xde8e('0x47')]=_0x4ff9a6[_0xde8e('0x30')][_0xde8e('0x47')]||![];_0x532577['SenderId']=_0x4ff9a6[_0xde8e('0x43')]['id'];return getContent(_0x4ff9a6['body'])[_0xde8e('0x29')](function(_0x3be757){_0x532577[_0xde8e('0x30')]=_0x3be757;return getRecipients(_0x378a51);})['then'](function(_0x4144df){_0x532577['recipientsId']=_[_0xde8e('0x48')](_0x4144df)[_0xde8e('0x49')](',');return db['sequelize'][_0xde8e('0x4a')](function(_0x3657a4){return db[_0xde8e('0x4b')][_0xde8e('0x4c')](_0x532577,{'raw':!![],'transaction':_0x3657a4})['then'](function(_0x16bb37){var _0x647a96={'sender':_0x532577[_0xde8e('0x42')],'description':_0x532577['recipientsDescription'],'content':_0x532577[_0xde8e('0x30')],'beep':_0x532577[_0xde8e('0x47')]};_0x4144df['forEach'](function(_0x190245){_0x647a96[_0xde8e('0x4d')]=_0x190245;socket['emit'](_0xde8e('0x4e'),_0x647a96);});return _0x16bb37;});});})[_0xde8e('0x29')](respondWithResult(_0x4ff445,0xc9))['catch'](handleError(_0x4ff445,null));};function getContent(_0x62d8ea){return new BPromise(function(_0x509750,_0x57cf05){if(_0x62d8ea[_0xde8e('0x4f')]){_0x509750(_0x62d8ea[_0xde8e('0x4f')]);return;}return db['Template'][_0xde8e('0x50')]({'attributes':[_0xde8e('0x51')],'where':{'id':_0x62d8ea[_0xde8e('0x32')]},'raw':!![]})[_0xde8e('0x29')](function(_0x105ae3){if(!_0x105ae3)throw new db[(_0xde8e('0x34'))][(_0xde8e('0x33'))](_0xde8e('0x52'));var _0x3fea38=Mustache[_0xde8e('0x53')](_0x105ae3[_0xde8e('0x51')],_0x62d8ea[_0xde8e('0x54')]);_0x509750(_0x3fea38);})[_0xde8e('0x55')](function(_0x35a08c){_0x57cf05(_0x35a08c);});});}function getRecipients(_0x5a6b65){return new BPromise(function(_0x2edfe3,_0x1cae78){var _0x212abc=[];var _0x29dd75=[];_0x5a6b65[_0xde8e('0x56')](function(_0xb1c1a7){var _0x1ef052=_['startCase'](_0xb1c1a7[_0xde8e('0x3f')][_0xde8e('0x40')]());if(_0x1ef052===_0xde8e('0x57')){_0x212abc=_[_0xde8e('0x58')](_0x212abc,_0xb1c1a7[_0xde8e('0x59')]);}else{if(_[_0xde8e('0x3e')](_0x1ef052,_0xde8e('0x5a')))_0x1ef052=_0x1ef052[_0xde8e('0x5b')](_0xde8e('0x5a'),_0xde8e('0x5c'));_0xb1c1a7[_0xde8e('0x59')]['forEach'](function(_0x95aa17){_0x29dd75[_0xde8e('0x5d')](getAgents(_0x1ef052,_0x95aa17));});}});return BPromise[_0xde8e('0x5e')](_0x29dd75)[_0xde8e('0x29')](function(_0x274bc5){_0x212abc=_[_0xde8e('0x58')](_0x212abc,_[_0xde8e('0x5f')](_0x274bc5));_0x2edfe3(_0x212abc);})[_0xde8e('0x55')](function(_0x487df6){_0x1cae78(_0x487df6);});});}function getAgents(_0x4b6688,_0x4f57ca){return new BPromise(function(_0x1920a0,_0x2b0770){return db[_0x4b6688][_0xde8e('0x50')]({'where':{'id':_0x4f57ca}})[_0xde8e('0x29')](function(_0x104af1){return _0x104af1[_0xde8e('0x60')]({'attributes':['id'],'raw':!![]})[_0xde8e('0x29')](function(_0x15ef89){var _0x16210c=_[_0xde8e('0x61')](_0x15ef89,'id');_0x1920a0(_0x16210c);});})[_0xde8e('0x55')](function(_0x1deb1d){_0x2b0770(_0x1deb1d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6d0027d..1758a2a 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 _0x707b=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x707b,0x1d1));var _0xb707=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x707b[_0x49fcfb];return _0x964926;};'use strict';var EventEmitter=require(_0xb707('0x0'));var UserNotification=require(_0xb707('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb707('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb707('0x3'),'afterDestroy':_0xb707('0x4')};function emitEvent(_0x5a0709){return function(_0x258af7,_0x30f09e,_0x2cfc35){UserNotificationEvents['emit'](_0x5a0709+':'+_0x258af7['id'],_0x258af7);UserNotificationEvents[_0xb707('0x5')](_0x5a0709,_0x258af7);_0x2cfc35(null);};}for(var e in events){if(events[_0xb707('0x6')](e)){var event=events[e];UserNotification[_0xb707('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xe59a=['hasOwnProperty','events','setMaxListeners','save','update','remove','emit'];(function(_0x5204a4,_0xe9fbf5){var _0x40b9fc=function(_0x2c500a){while(--_0x2c500a){_0x5204a4['push'](_0x5204a4['shift']());}};_0x40b9fc(++_0xe9fbf5);}(_0xe59a,0xf6));var _0xae59=function(_0x9ce0ec,_0x34686c){_0x9ce0ec=_0x9ce0ec-0x0;var _0x5218d6=_0xe59a[_0x9ce0ec];return _0x5218d6;};'use strict';var EventEmitter=require(_0xae59('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xae59('0x1')](0x0);var events={'afterCreate':_0xae59('0x2'),'afterUpdate':_0xae59('0x3'),'afterDestroy':_0xae59('0x4')};function emitEvent(_0x49a385){return function(_0x28f837,_0x2c6c6c,_0x3a98ca){UserNotificationEvents[_0xae59('0x5')](_0x49a385+':'+_0x28f837['id'],_0x28f837);UserNotificationEvents[_0xae59('0x5')](_0x49a385,_0x28f837);_0x3a98ca(null);};}for(var e in events){if(events[_0xae59('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 31ae3ca..56d0bc9 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 _0xcd2c=['exports','define','UserNotification','userNotifications','utf8mb4','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcd2c,0x1e5));var _0xccd2=function(_0x113350,_0x21bf5e){_0x113350=_0x113350-0x0;var _0x3b7aae=_0xcd2c[_0x113350];return _0x3b7aae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xccd2('0x0'))(_0xccd2('0x1'));var moment=require('moment');var BPromise=require(_0xccd2('0x2'));var rp=require(_0xccd2('0x3'));var fs=require('fs');var path=require(_0xccd2('0x4'));var rimraf=require(_0xccd2('0x5'));var config=require(_0xccd2('0x6'));var attributes=require('./userNotification.attributes');module[_0xccd2('0x7')]=function(_0x879139,_0x2446f4){return _0x879139[_0xccd2('0x8')](_0xccd2('0x9'),attributes,{'tableName':_0xccd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xccd2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x41ee=['utf8mb4','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','define','userNotifications'];(function(_0x4cd38e,_0xbb4e63){var _0x1732ca=function(_0x269ad6){while(--_0x269ad6){_0x4cd38e['push'](_0x4cd38e['shift']());}};_0x1732ca(++_0xbb4e63);}(_0x41ee,0x9b));var _0xe41e=function(_0x2b1ed2,_0x191038){_0x2b1ed2=_0x2b1ed2-0x0;var _0x3193d8=_0x41ee[_0x2b1ed2];return _0x3193d8;};'use strict';var _=require(_0xe41e('0x0'));var util=require(_0xe41e('0x1'));var logger=require('../../config/logger')(_0xe41e('0x2'));var moment=require('moment');var BPromise=require(_0xe41e('0x3'));var rp=require(_0xe41e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe41e('0x5'));var config=require(_0xe41e('0x6'));var attributes=require(_0xe41e('0x7'));module['exports']=function(_0x2a8e08,_0x29e885){return _0x2a8e08[_0xe41e('0x8')]('UserNotification',attributes,{'tableName':_0xe41e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe41e('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index fd536d6..d0a7581 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 _0x73cb=['../../config/environment','client','redis','defaults','localhost','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x28d6b9,_0xbe9964){var _0x1e2bee=function(_0xc75f76){while(--_0xc75f76){_0x28d6b9['push'](_0x28d6b9['shift']());}};_0x1e2bee(++_0xbe9964);}(_0x73cb,0x130));var _0xb73c=function(_0x50de8c,_0x292a72){_0x50de8c=_0x50de8c-0x0;var _0x1eed36=_0x73cb[_0x50de8c];return _0x1eed36;};'use strict';var _=require(_0xb73c('0x0'));var util=require('util');var moment=require(_0xb73c('0x1'));var BPromise=require(_0xb73c('0x2'));var rs=require(_0xb73c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb73c('0x4'))['db'];var utils=require(_0xb73c('0x5'));var logger=require(_0xb73c('0x6'))(_0xb73c('0x7'));var config=require(_0xb73c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb73c('0x9')]['http']({'port':0x232a});config[_0xb73c('0xa')]=_[_0xb73c('0xb')](config['redis'],{'host':_0xb73c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb73c('0xd'))[_0xb73c('0xe')](socket);function respondWithRpcPromise(_0x436ef2,_0x3feb16,_0x46f3af){return new BPromise(function(_0xb20ea7,_0x2df14d){return client[_0xb73c('0xf')](_0x436ef2,_0x46f3af)[_0xb73c('0x10')](function(_0x5748a3){logger[_0xb73c('0x11')]('UserNotification,\x20%s,\x20%s',_0x3feb16,_0xb73c('0x12'));logger[_0xb73c('0x13')](_0xb73c('0x14'),_0x3feb16,_0xb73c('0x12'),JSON[_0xb73c('0x15')](_0x5748a3));if(_0x5748a3['error']){if(_0x5748a3['error'][_0xb73c('0x16')]===0x1f4){logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x5748a3[_0xb73c('0x17')]['message']);return _0x2df14d(_0x5748a3[_0xb73c('0x17')][_0xb73c('0x19')]);}logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x5748a3[_0xb73c('0x17')][_0xb73c('0x19')]);return _0xb20ea7(_0x5748a3[_0xb73c('0x17')]['message']);}else{logger[_0xb73c('0x11')](_0xb73c('0x18'),_0x3feb16,_0xb73c('0x12'));_0xb20ea7(_0x5748a3['result'][_0xb73c('0x19')]);}})['catch'](function(_0x2ea05b){logger[_0xb73c('0x17')](_0xb73c('0x18'),_0x3feb16,_0x2ea05b);_0x2df14d(_0x2ea05b);});});} \ No newline at end of file +var _0xd47c=['./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x25ccc8,_0x3ecd9d){var _0x20862d=function(_0x109f16){while(--_0x109f16){_0x25ccc8['push'](_0x25ccc8['shift']());}};_0x20862d(++_0x3ecd9d);}(_0xd47c,0x142));var _0xcd47=function(_0x59308b,_0x1a729f){_0x59308b=_0x59308b-0x0;var _0x380534=_0xd47c[_0x59308b];return _0x380534;};'use strict';var _=require(_0xcd47('0x0'));var util=require('util');var moment=require(_0xcd47('0x1'));var BPromise=require(_0xcd47('0x2'));var rs=require(_0xcd47('0x3'));var fs=require('fs');var Redis=require(_0xcd47('0x4'));var db=require(_0xcd47('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd47('0x6'))('rpc');var config=require(_0xcd47('0x7'));var jayson=require(_0xcd47('0x8'));var client=jayson[_0xcd47('0x9')][_0xcd47('0xa')]({'port':0x232a});config['redis']=_[_0xcd47('0xb')](config[_0xcd47('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd47('0xd'))(new Redis(config[_0xcd47('0xc')]));require(_0xcd47('0xe'))[_0xcd47('0xf')](socket);function respondWithRpcPromise(_0x3d1c19,_0x15f3e2,_0x3fd460){return new BPromise(function(_0xad3847,_0x46bc9c){return client[_0xcd47('0x10')](_0x3d1c19,_0x3fd460)[_0xcd47('0x11')](function(_0x53eb52){logger['info'](_0xcd47('0x12'),_0x15f3e2,_0xcd47('0x13'));logger['debug'](_0xcd47('0x14'),_0x15f3e2,_0xcd47('0x13'),JSON[_0xcd47('0x15')](_0x53eb52));if(_0x53eb52[_0xcd47('0x16')]){if(_0x53eb52['error'][_0xcd47('0x17')]===0x1f4){logger[_0xcd47('0x16')](_0xcd47('0x12'),_0x15f3e2,_0x53eb52[_0xcd47('0x16')][_0xcd47('0x18')]);return _0x46bc9c(_0x53eb52[_0xcd47('0x16')][_0xcd47('0x18')]);}logger['error'](_0xcd47('0x12'),_0x15f3e2,_0x53eb52[_0xcd47('0x16')][_0xcd47('0x18')]);return _0xad3847(_0x53eb52[_0xcd47('0x16')][_0xcd47('0x18')]);}else{logger[_0xcd47('0x19')](_0xcd47('0x12'),_0x15f3e2,_0xcd47('0x13'));_0xad3847(_0x53eb52[_0xcd47('0x1a')][_0xcd47('0x18')]);}})[_0xcd47('0x1b')](function(_0x2ef166){logger[_0xcd47('0x16')](_0xcd47('0x12'),_0x15f3e2,_0x2ef166);_0x46bc9c(_0x2ef166);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3969e8e..cf9c0fe 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 _0x7611=['remove','update','emit','removeListener','./userNotification.events','save'];(function(_0x11d85a,_0x4a908e){var _0x5b5638=function(_0x1d8b30){while(--_0x1d8b30){_0x11d85a['push'](_0x11d85a['shift']());}};_0x5b5638(++_0x4a908e);}(_0x7611,0x1cc));var _0x1761=function(_0x57e496,_0x1fa5e1){_0x57e496=_0x57e496-0x0;var _0x168769=_0x7611[_0x57e496];return _0x168769;};'use strict';var UserNotificationEvents=require(_0x1761('0x0'));var events=[_0x1761('0x1'),_0x1761('0x2'),_0x1761('0x3')];function createListener(_0x107d24,_0x235605){return function(_0x389c76){_0x235605[_0x1761('0x4')](_0x107d24,_0x389c76);};}function removeListener(_0x518db3,_0x5b8ab8){return function(){UserNotificationEvents[_0x1761('0x5')](_0x518db3,_0x5b8ab8);};}exports['register']=function(_0xab4028){for(var _0x274c39=0x0,_0x399978=events['length'];_0x274c39<_0x399978;_0x274c39++){var _0x451d26=events[_0x274c39];var _0x39225f=createListener('userNotification:'+_0x451d26,_0xab4028);UserNotificationEvents['on'](_0x451d26,_0x39225f);}}; \ No newline at end of file +var _0xb9a4=['removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x3cbb14,_0x3c95a7){var _0x2bfb35=function(_0x384c4d){while(--_0x384c4d){_0x3cbb14['push'](_0x3cbb14['shift']());}};_0x2bfb35(++_0x3c95a7);}(_0xb9a4,0x95));var _0x4b9a=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0xb9a4[_0x46ce98];return _0x172f46;};'use strict';var UserNotificationEvents=require(_0x4b9a('0x0'));var events=['save','remove','update'];function createListener(_0x3f6cc3,_0x5a168a){return function(_0x4a2fc4){_0x5a168a['emit'](_0x3f6cc3,_0x4a2fc4);};}function removeListener(_0xd5ba1d,_0x37fe7f){return function(){UserNotificationEvents[_0x4b9a('0x1')](_0xd5ba1d,_0x37fe7f);};}exports[_0x4b9a('0x2')]=function(_0xd87c53){for(var _0x25e70e=0x0,_0x5dd902=events[_0x4b9a('0x3')];_0x25e70e<_0x5dd902;_0x25e70e++){var _0x11195d=events[_0x25e70e];var _0x370d91=createListener(_0x4b9a('0x4')+_0x11195d,_0xd87c53);UserNotificationEvents['on'](_0x11195d,_0x370d91);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b3fd41f..362972f 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x18979e,_0x7b37e3){var _0x5e7630=function(_0x469dc4){while(--_0x469dc4){_0x18979e['push'](_0x18979e['shift']());}};_0x5e7630(++_0x7b37e3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x10d581,_0x5ecfe5){var _0x2f8adb=function(_0x10af51){while(--_0x10af51){_0x10d581['push'](_0x10d581['shift']());}};_0x2f8adb(++_0x5ecfe5);}(_0x70e0,0x17b));var _0x070e=function(_0x1fbff1,_0x16e51e){_0x1fbff1=_0x1fbff1-0x0;var _0x513123=_0x70e0[_0x1fbff1];return _0x513123;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3219ac5..7bdb35f 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 _0x889d=['INTEGER','sequelize','exports'];(function(_0x3ff339,_0x4f5443){var _0x181daa=function(_0x548c5a){while(--_0x548c5a){_0x3ff339['push'](_0x3ff339['shift']());}};_0x181daa(++_0x4f5443);}(_0x889d,0x142));var _0xd889=function(_0x22e976,_0x3a9adb){_0x22e976=_0x22e976-0x0;var _0x41037d=_0x889d[_0x22e976];return _0x41037d;};'use strict';var Sequelize=require(_0xd889('0x0'));module[_0xd889('0x1')]={'penalty':{'type':Sequelize[_0xd889('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf339=['exports','sequelize'];(function(_0x495f25,_0x3cecf0){var _0x70f44c=function(_0x2dbba4){while(--_0x2dbba4){_0x495f25['push'](_0x495f25['shift']());}};_0x70f44c(++_0x3cecf0);}(_0xf339,0x67));var _0x9f33=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf339[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x9f33('0x0'));module[_0x9f33('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 00a5ac3..f3789b9 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 _0xc198=['user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x49d7a7,_0x473232){var _0x3e0944=function(_0x3dbbe6){while(--_0x3dbbe6){_0x49d7a7['push'](_0x49d7a7['shift']());}};_0x3e0944(++_0x473232);}(_0xc198,0xde));var _0x8c19=function(_0x54b7bc,_0x1f5b38){_0x54b7bc=_0x54b7bc-0x0;var _0x38810c=_0xc198[_0x54b7bc];return _0x38810c;};'use strict';var _=require(_0x8c19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c19('0x1'));var moment=require(_0x8c19('0x2'));var BPromise=require(_0x8c19('0x3'));var rp=require(_0x8c19('0x4'));var fs=require('fs');var path=require(_0x8c19('0x5'));var rimraf=require(_0x8c19('0x6'));var config=require(_0x8c19('0x7'));var attributes=require(_0x8c19('0x8'));module[_0x8c19('0x9')]=function(_0x56479d,_0x260ec2){return _0x56479d[_0x8c19('0xa')](_0x8c19('0xb'),attributes,{'tableName':_0x8c19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95aa=['path','define','UserOpenchannelQueue','user_has_openchannel_queues','util','api','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x95aa,0xd6));var _0xa95a=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0x95aa[_0x4aac5a];return _0x42e7bc;};'use strict';var _=require('lodash');var util=require(_0xa95a('0x0'));var logger=require('../../config/logger')(_0xa95a('0x1'));var moment=require('moment');var BPromise=require(_0xa95a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa95a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0xce58c,_0x9a18f9){return _0xce58c[_0xa95a('0x4')](_0xa95a('0x5'),attributes,{'tableName':_0xa95a('0x6'),'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 14dd6b7..6069bbb 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 _0x7c6f=['message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x7c6f,0x178));var _0xf7c6=function(_0x7049c7,_0x35761f){_0x7049c7=_0x7049c7-0x0;var _0x2d6408=_0x7c6f[_0x7049c7];return _0x2d6408;};'use strict';var _=require('lodash');var util=require(_0xf7c6('0x0'));var moment=require(_0xf7c6('0x1'));var BPromise=require(_0xf7c6('0x2'));var rs=require(_0xf7c6('0x3'));var fs=require('fs');var Redis=require(_0xf7c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf7c6('0x5'));var logger=require(_0xf7c6('0x6'))('rpc');var config=require(_0xf7c6('0x7'));var jayson=require(_0xf7c6('0x8'));var client=jayson['client'][_0xf7c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24d7ef,_0x51bbef,_0x45dd9b){return new BPromise(function(_0x23f23f,_0x347e08){return client[_0xf7c6('0xa')](_0x24d7ef,_0x45dd9b)[_0xf7c6('0xb')](function(_0x116f1d){logger[_0xf7c6('0xc')](_0xf7c6('0xd'),_0x51bbef,_0xf7c6('0xe'));logger[_0xf7c6('0xf')](_0xf7c6('0x10'),_0x51bbef,_0xf7c6('0xe'),JSON[_0xf7c6('0x11')](_0x116f1d));if(_0x116f1d[_0xf7c6('0x12')]){if(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x13')]===0x1f4){logger[_0xf7c6('0x12')](_0xf7c6('0xd'),_0x51bbef,_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);return _0x347e08(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);}logger[_0xf7c6('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x51bbef,_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);return _0x23f23f(_0x116f1d[_0xf7c6('0x12')][_0xf7c6('0x14')]);}else{logger[_0xf7c6('0xc')](_0xf7c6('0xd'),_0x51bbef,_0xf7c6('0xe'));_0x23f23f(_0x116f1d[_0xf7c6('0x15')]['message']);}})['catch'](function(_0x981122){logger[_0xf7c6('0x12')](_0xf7c6('0xd'),_0x51bbef,_0x981122);_0x347e08(_0x981122);});});} \ No newline at end of file +var _0x97f8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x125ca2,_0x5ac3d0){var _0x402039=function(_0x30a4d){while(--_0x30a4d){_0x125ca2['push'](_0x125ca2['shift']());}};_0x402039(++_0x5ac3d0);}(_0x97f8,0x1df));var _0x897f=function(_0x23a2eb,_0x3b2e33){_0x23a2eb=_0x23a2eb-0x0;var _0x11525f=_0x97f8[_0x23a2eb];return _0x11525f;};'use strict';var _=require(_0x897f('0x0'));var util=require(_0x897f('0x1'));var moment=require(_0x897f('0x2'));var BPromise=require(_0x897f('0x3'));var rs=require(_0x897f('0x4'));var fs=require('fs');var Redis=require(_0x897f('0x5'));var db=require(_0x897f('0x6'))['db'];var utils=require(_0x897f('0x7'));var logger=require(_0x897f('0x8'))('rpc');var config=require(_0x897f('0x9'));var jayson=require(_0x897f('0xa'));var client=jayson['client'][_0x897f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x185c9a,_0x18905d,_0x7cbf55){return new BPromise(function(_0x2b4070,_0x2ff383){return client['request'](_0x185c9a,_0x7cbf55)[_0x897f('0xc')](function(_0x2033e3){logger['info'](_0x897f('0xd'),_0x18905d,_0x897f('0xe'));logger[_0x897f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x18905d,_0x897f('0xe'),JSON[_0x897f('0x10')](_0x2033e3));if(_0x2033e3['error']){if(_0x2033e3[_0x897f('0x11')][_0x897f('0x12')]===0x1f4){logger[_0x897f('0x11')](_0x897f('0xd'),_0x18905d,_0x2033e3[_0x897f('0x11')][_0x897f('0x13')]);return _0x2ff383(_0x2033e3[_0x897f('0x11')]['message']);}logger['error'](_0x897f('0xd'),_0x18905d,_0x2033e3[_0x897f('0x11')][_0x897f('0x13')]);return _0x2b4070(_0x2033e3[_0x897f('0x11')]['message']);}else{logger[_0x897f('0x14')](_0x897f('0xd'),_0x18905d,_0x897f('0xe'));_0x2b4070(_0x2033e3['result'][_0x897f('0x13')]);}})['catch'](function(_0x5027aa){logger[_0x897f('0x11')](_0x897f('0xd'),_0x18905d,_0x5027aa);_0x2ff383(_0x5027aa);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3b4eec1..3b98d1e 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 _0x6b14=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout'];(function(_0x5e3124,_0x1e9c4c){var _0x2195c2=function(_0x5d57a8){while(--_0x5d57a8){_0x5e3124['push'](_0x5e3124['shift']());}};_0x2195c2(++_0x1e9c4c);}(_0x6b14,0x102));var _0x46b1=function(_0x14622c,_0x1a39a8){_0x14622c=_0x14622c-0x0;var _0x20e47b=_0x6b14[_0x14622c];return _0x20e47b;};'use strict';var multer=require('multer');var util=require(_0x46b1('0x0'));var path=require(_0x46b1('0x1'));var timeout=require(_0x46b1('0x2'));var express=require(_0x46b1('0x3'));var router=express[_0x46b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46b1('0x5'));var interaction=require(_0x46b1('0x6'));var config=require(_0x46b1('0x7'));var controller=require(_0x46b1('0x8'));router[_0x46b1('0x9')]('/',auth[_0x46b1('0xa')](),controller[_0x46b1('0xb')]);router['get']('/describe',auth[_0x46b1('0xa')](),controller[_0x46b1('0xc')]);router[_0x46b1('0x9')](_0x46b1('0xd'),auth[_0x46b1('0xa')](),controller[_0x46b1('0xe')]);router[_0x46b1('0x9')](_0x46b1('0xf'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x10')]);router[_0x46b1('0x9')](_0x46b1('0x11'),auth[_0x46b1('0xa')](),controller['getResources']);router[_0x46b1('0x12')]('/',auth[_0x46b1('0xa')](),controller[_0x46b1('0x13')]);router[_0x46b1('0x12')](_0x46b1('0x14'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x15')]);router[_0x46b1('0x12')](_0x46b1('0xf'),auth['isAuthenticated'](),controller[_0x46b1('0x16')]);router['post'](_0x46b1('0x11'),auth[_0x46b1('0xa')](),controller[_0x46b1('0x17')]);router['put'](_0x46b1('0xd'),auth[_0x46b1('0xa')](),controller['update']);router[_0x46b1('0x18')](_0x46b1('0xd'),auth['isAuthenticated'](),controller[_0x46b1('0x19')]);router[_0x46b1('0x18')](_0x46b1('0xf'),auth['isAuthenticated'](),controller[_0x46b1('0x1a')]);router[_0x46b1('0x18')]('/:id/resources',auth[_0x46b1('0xa')](),controller[_0x46b1('0x1b')]);module[_0x46b1('0x1c')]=router; \ No newline at end of file +var _0xf6d2=['addSections','put','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id/sections','/:id/resources','getResources','post','clone'];(function(_0x5a0b43,_0x256dad){var _0xc3ef6=function(_0x1e36f2){while(--_0x1e36f2){_0x5a0b43['push'](_0x5a0b43['shift']());}};_0xc3ef6(++_0x256dad);}(_0xf6d2,0x177));var _0x2f6d=function(_0x2a7090,_0x129601){_0x2a7090=_0x2a7090-0x0;var _0x254ac8=_0xf6d2[_0x2a7090];return _0x254ac8;};'use strict';var multer=require('multer');var util=require(_0x2f6d('0x0'));var path=require(_0x2f6d('0x1'));var timeout=require(_0x2f6d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f6d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2f6d('0x4'));var config=require(_0x2f6d('0x5'));var controller=require(_0x2f6d('0x6'));router['get']('/',auth[_0x2f6d('0x7')](),controller['index']);router[_0x2f6d('0x8')](_0x2f6d('0x9'),auth[_0x2f6d('0x7')](),controller[_0x2f6d('0xa')]);router[_0x2f6d('0x8')]('/:id',auth[_0x2f6d('0x7')](),controller['show']);router['get'](_0x2f6d('0xb'),auth[_0x2f6d('0x7')](),controller['getSections']);router[_0x2f6d('0x8')](_0x2f6d('0xc'),auth[_0x2f6d('0x7')](),controller[_0x2f6d('0xd')]);router[_0x2f6d('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x2f6d('0xf')]);router[_0x2f6d('0xe')](_0x2f6d('0xb'),auth['isAuthenticated'](),controller[_0x2f6d('0x10')]);router[_0x2f6d('0xe')](_0x2f6d('0xc'),auth['isAuthenticated'](),controller['addResources']);router[_0x2f6d('0x11')]('/:id',auth[_0x2f6d('0x7')](),controller['update']);router[_0x2f6d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2f6d('0x13')]);router[_0x2f6d('0x12')](_0x2f6d('0xb'),auth['isAuthenticated'](),controller[_0x2f6d('0x14')]);router['delete'](_0x2f6d('0xc'),auth['isAuthenticated'](),controller[_0x2f6d('0x15')]);module[_0x2f6d('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 03cfe5f..c0f96cd 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 _0xe918=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x57a81,_0x43b6cb){var _0x1f3d77=function(_0x454fc9){while(--_0x454fc9){_0x57a81['push'](_0x57a81['shift']());}};_0x1f3d77(++_0x43b6cb);}(_0xe918,0x114));var _0x8e91=function(_0x4c21c0,_0x1a7559){_0x4c21c0=_0x4c21c0-0x0;var _0x428a0b=_0xe918[_0x4c21c0];return _0x428a0b;};'use strict';var Sequelize=require(_0x8e91('0x0'));module[_0x8e91('0x1')]={'name':{'type':Sequelize[_0x8e91('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8e91('0x2')],'set':function(_0x43c235){this[_0x8e91('0x3')](_0x8e91('0x4'),_0x43c235?_0x43c235[_0x8e91('0x5')](''):[]);},'get':function(){return this[_0x8e91('0x6')](_0x8e91('0x4'))?this[_0x8e91('0x6')](_0x8e91('0x4'))[_0x8e91('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8e91('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8e91('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xcc62=['getDataValue','crudPermissions','BOOLEAN','sequelize','name','STRING','join'];(function(_0x5bb043,_0x3cc791){var _0x571474=function(_0x680e4d){while(--_0x680e4d){_0x5bb043['push'](_0x5bb043['shift']());}};_0x571474(++_0x3cc791);}(_0xcc62,0x199));var _0x2cc6=function(_0x56a51f,_0x4f86aa){_0x56a51f=_0x56a51f-0x0;var _0x696c7c=_0xcc62[_0x56a51f];return _0x696c7c;};'use strict';var Sequelize=require(_0x2cc6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2cc6('0x1')},'crudPermissions':{'type':Sequelize[_0x2cc6('0x2')],'set':function(_0x58f0cc){this['setDataValue']('crudPermissions',_0x58f0cc?_0x58f0cc[_0x2cc6('0x3')](''):[]);},'get':function(){return this[_0x2cc6('0x4')]('crudPermissions')?this['getDataValue'](_0x2cc6('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2cc6('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2cc6('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2cc6('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2cc6('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2cc6('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index ad2390e..4de6c2b 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 _0x6e29=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','end','error','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','UserProfile','findAll','rows','show','params','includeAll','find','create','body','catch','clone','omit','updatedAt','crudPermissions','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','update','describe','addSections','destroy','sectionId','push','removeSections','ids','getSections','enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','sequelize','bulkCreate','removeResources','section','Missing\x20section\x20parameter','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x38b890,_0x5d5148){var _0x299d72=function(_0x5dbeb4){while(--_0x5dbeb4){_0x38b890['push'](_0x38b890['shift']());}};_0x299d72(++_0x5d5148);}(_0x6e29,0x1cd));var _0x96e2=function(_0x27e539,_0x4cf05f){_0x27e539=_0x27e539-0x0;var _0x1d081b=_0x6e29[_0x27e539];return _0x1d081b;};'use strict';var emlformat=require(_0x96e2('0x0'));var rimraf=require(_0x96e2('0x1'));var zipdir=require(_0x96e2('0x2'));var jsonpatch=require(_0x96e2('0x3'));var rp=require(_0x96e2('0x4'));var moment=require(_0x96e2('0x5'));var BPromise=require(_0x96e2('0x6'));var Mustache=require(_0x96e2('0x7'));var util=require('util');var path=require(_0x96e2('0x8'));var sox=require(_0x96e2('0x9'));var csv=require(_0x96e2('0xa'));var ejs=require(_0x96e2('0xb'));var fs=require('fs');var fs_extra=require(_0x96e2('0xc'));var _=require(_0x96e2('0xd'));var squel=require(_0x96e2('0xe'));var crypto=require(_0x96e2('0xf'));var jsforce=require(_0x96e2('0x10'));var deskjs=require(_0x96e2('0x11'));var toCsv=require(_0x96e2('0xa'));var querystring=require(_0x96e2('0x12'));var Papa=require(_0x96e2('0x13'));var Redis=require(_0x96e2('0x14'));var authService=require(_0x96e2('0x15'));var qs=require(_0x96e2('0x16'));var as=require(_0x96e2('0x17'));var hardwareService=require(_0x96e2('0x18'));var logger=require(_0x96e2('0x19'))(_0x96e2('0x1a'));var utils=require('../../config/utils');var config=require(_0x96e2('0x1b'));var licenseUtil=require(_0x96e2('0x1c'));var db=require(_0x96e2('0x1d'))['db'];config['redis']=_[_0x96e2('0x1e')](config[_0x96e2('0x1f')],{'host':_0x96e2('0x20'),'port':0x18eb});var socket=require(_0x96e2('0x21'))(new Redis(config[_0x96e2('0x1f')]));require(_0x96e2('0x22'))[_0x96e2('0x23')](socket);function respondWithStatusCode(_0x17a0c8,_0x18ee32){_0x18ee32=_0x18ee32||0xcc;return function(_0x7fd164){if(_0x7fd164){return _0x17a0c8[_0x96e2('0x24')](_0x18ee32);}return _0x17a0c8[_0x96e2('0x25')](_0x18ee32)['end']();};}function respondWithResult(_0x535887,_0x249dde){_0x249dde=_0x249dde||0xc8;return function(_0x545bd8){if(_0x545bd8){return _0x535887[_0x96e2('0x25')](_0x249dde)[_0x96e2('0x26')](_0x545bd8);}};}function respondWithFilteredResult(_0x4efe72,_0x56a3a9){return function(_0x5c0ad0){if(_0x5c0ad0){var _0x3652fe=typeof _0x56a3a9['offset']===_0x96e2('0x27')&&typeof _0x56a3a9[_0x96e2('0x28')]===_0x96e2('0x27');var _0xb23d37=_0x5c0ad0[_0x96e2('0x29')];var _0x45433d=_0x3652fe?0x0:_0x56a3a9[_0x96e2('0x2a')];var _0x3b39a1=_0x3652fe?_0x5c0ad0[_0x96e2('0x29')]:_0x56a3a9['offset']+_0x56a3a9[_0x96e2('0x28')];var _0x1c5687;if(_0x3b39a1>=_0xb23d37){_0x3b39a1=_0xb23d37;_0x1c5687=0xc8;}else{_0x1c5687=0xce;}_0x4efe72[_0x96e2('0x25')](_0x1c5687);return _0x4efe72['set'](_0x96e2('0x2b'),_0x45433d+'-'+_0x3b39a1+'/'+_0xb23d37)[_0x96e2('0x26')](_0x5c0ad0);}return null;};}function patchUpdates(_0x34b461){return function(_0x24fb5d){try{jsonpatch[_0x96e2('0x2c')](_0x24fb5d,_0x34b461,!![]);}catch(_0x10aebb){return BPromise[_0x96e2('0x2d')](_0x10aebb);}return _0x24fb5d[_0x96e2('0x2e')]();};}function saveUpdates(_0x435d44,_0x50fb31){return function(_0x54fc29){if(_0x54fc29){return _0x54fc29['update'](_0x435d44)[_0x96e2('0x2f')](function(_0x55b8d9){return _0x55b8d9;});}return null;};}function removeEntity(_0x546de6,_0x4874ad){return function(_0x29d022){if(_0x29d022){return _0x29d022['destroy']()['then'](function(){_0x546de6[_0x96e2('0x25')](0xcc)[_0x96e2('0x30')]();});}};}function handleEntityNotFound(_0x3a47c8,_0x270d4b){return function(_0x2381bf){if(!_0x2381bf){_0x3a47c8[_0x96e2('0x24')](0x194);}return _0x2381bf;};}function handleError(_0xcdf7ea,_0x56f5ab){_0x56f5ab=_0x56f5ab||0x1f4;return function(_0x72a052){logger[_0x96e2('0x31')](_0x72a052['stack']);if(_0x72a052[_0x96e2('0x32')]){delete _0x72a052[_0x96e2('0x32')];}_0xcdf7ea[_0x96e2('0x25')](_0x56f5ab)[_0x96e2('0x33')](_0x72a052);};}exports[_0x96e2('0x34')]=function(_0x53d716,_0x43800b){var _0x840137={},_0x1a44aa={},_0x36cd94={'count':0x0,'rows':[]};var _0x3fe040=_['map'](db['UserProfile'][_0x96e2('0x35')],function(_0x4dcaa8){return{'name':_0x4dcaa8[_0x96e2('0x36')],'type':_0x4dcaa8[_0x96e2('0x37')]['key']};});_0x1a44aa[_0x96e2('0x38')]=_[_0x96e2('0x39')](_0x3fe040,'name');_0x1a44aa[_0x96e2('0x3a')]=_[_0x96e2('0x3b')](_0x53d716['query']);_0x1a44aa[_0x96e2('0x3c')]=_[_0x96e2('0x3d')](_0x1a44aa[_0x96e2('0x38')],_0x1a44aa[_0x96e2('0x3a')]);_0x840137[_0x96e2('0x3e')]=_['intersection'](_0x1a44aa['model'],qs['fields'](_0x53d716[_0x96e2('0x3a')][_0x96e2('0x3f')]));_0x840137[_0x96e2('0x3e')]=_0x840137[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x840137[_0x96e2('0x3e')]:_0x1a44aa[_0x96e2('0x38')];if(!_0x53d716[_0x96e2('0x3a')][_0x96e2('0x41')](_0x96e2('0x42'))){_0x840137[_0x96e2('0x28')]=qs[_0x96e2('0x28')](_0x53d716[_0x96e2('0x3a')][_0x96e2('0x28')]);_0x840137['offset']=qs['offset'](_0x53d716['query'][_0x96e2('0x2a')]);}_0x840137[_0x96e2('0x43')]=qs['sort'](_0x53d716['query'][_0x96e2('0x44')]);_0x840137[_0x96e2('0x45')]=qs['filters'](_[_0x96e2('0x46')](_0x53d716['query'],_0x1a44aa[_0x96e2('0x3c')]),_0x3fe040);if(_0x53d716[_0x96e2('0x3a')]['filter']){_0x840137[_0x96e2('0x45')]=_['merge'](_0x840137[_0x96e2('0x45')],{'$or':_[_0x96e2('0x39')](_0x3fe040,function(_0x4d7a3d){if(_0x4d7a3d[_0x96e2('0x37')]!==_0x96e2('0x47')){var _0xeb9f55={};_0xeb9f55[_0x4d7a3d[_0x96e2('0x32')]]={'$like':'%'+_0x53d716[_0x96e2('0x3a')][_0x96e2('0x48')]+'%'};return _0xeb9f55;}})});}_0x840137=_[_0x96e2('0x49')]({},_0x840137,_0x53d716[_0x96e2('0x4a')]);var _0x1389ca={'where':_0x840137[_0x96e2('0x45')]};return db['UserProfile'][_0x96e2('0x29')](_0x1389ca)[_0x96e2('0x2f')](function(_0x4f0ad3){_0x36cd94[_0x96e2('0x29')]=_0x4f0ad3;if(_0x53d716[_0x96e2('0x3a')]['includeAll']){_0x840137[_0x96e2('0x4b')]=[{'all':!![]}];}return db[_0x96e2('0x4c')][_0x96e2('0x4d')](_0x840137);})[_0x96e2('0x2f')](function(_0xaae9c7){_0x36cd94[_0x96e2('0x4e')]=_0xaae9c7;return _0x36cd94;})[_0x96e2('0x2f')](respondWithFilteredResult(_0x43800b,_0x840137))['catch'](handleError(_0x43800b,null));};exports[_0x96e2('0x4f')]=function(_0x19ebf0,_0x417b5f){var _0x243344={'raw':![],'where':{'id':_0x19ebf0[_0x96e2('0x50')]['id']}},_0x5c3768={};_0x5c3768[_0x96e2('0x38')]=_[_0x96e2('0x3b')](db[_0x96e2('0x4c')][_0x96e2('0x35')]);_0x5c3768[_0x96e2('0x3a')]=_['keys'](_0x19ebf0['query']);_0x5c3768['filters']=_['intersection'](_0x5c3768[_0x96e2('0x38')],_0x5c3768[_0x96e2('0x3a')]);_0x243344[_0x96e2('0x3e')]=_['intersection'](_0x5c3768[_0x96e2('0x38')],qs['fields'](_0x19ebf0[_0x96e2('0x3a')][_0x96e2('0x3f')]));_0x243344[_0x96e2('0x3e')]=_0x243344[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x243344[_0x96e2('0x3e')]:_0x5c3768['model'];if(_0x19ebf0['query'][_0x96e2('0x51')]){_0x243344[_0x96e2('0x4b')]=[{'all':!![]}];}_0x243344=_['merge']({},_0x243344,_0x19ebf0[_0x96e2('0x4a')]);return db[_0x96e2('0x4c')][_0x96e2('0x52')](_0x243344)[_0x96e2('0x2f')](handleEntityNotFound(_0x417b5f,null))[_0x96e2('0x2f')](respondWithResult(_0x417b5f,null))['catch'](handleError(_0x417b5f,null));};exports[_0x96e2('0x53')]=function(_0x95ea82,_0x54b379){return db['UserProfile'][_0x96e2('0x53')](_0x95ea82[_0x96e2('0x54')],{})[_0x96e2('0x2f')](respondWithResult(_0x54b379,0xc9))[_0x96e2('0x55')](handleError(_0x54b379,null));};exports[_0x96e2('0x56')]=function(_0x345e15,_0x4320bd){var _0x339403={'where':{'id':_0x345e15['params']['id']}},_0x300252={};_0x300252[_0x96e2('0x38')]=_[_0x96e2('0x3b')](db[_0x96e2('0x4c')][_0x96e2('0x35')]);_0x339403[_0x96e2('0x3e')]=_['intersection'](_0x300252[_0x96e2('0x38')],qs[_0x96e2('0x3f')](_0x345e15[_0x96e2('0x3a')]['fields']));_0x339403[_0x96e2('0x3e')]=_0x339403[_0x96e2('0x3e')][_0x96e2('0x40')]?_0x339403[_0x96e2('0x3e')]:_0x300252[_0x96e2('0x38')];if(_0x345e15[_0x96e2('0x3a')][_0x96e2('0x51')]){_0x339403[_0x96e2('0x4b')]=[{'all':!![]}];}_0x339403=_[_0x96e2('0x49')]({},_0x339403,_0x345e15[_0x96e2('0x4a')]);return db[_0x96e2('0x4c')]['find'](_0x339403)[_0x96e2('0x2f')](handleEntityNotFound(_0x4320bd,null))[_0x96e2('0x2f')](function(_0x7eab15){if(_0x7eab15){var _0x291529=_0x7eab15['get']({'plain':!![]});_0x291529=qs[_0x96e2('0x57')](_0x291529,['id','createdAt',_0x96e2('0x58'),_0x96e2('0x59')]);_0x345e15[_0x96e2('0x54')]=_['omit'](_0x345e15[_0x96e2('0x54')],['id','createdAt','updatedAt']);return db['sequelize'][_0x96e2('0x5a')](function(_0x4cd817){return db['UserProfile']['create'](_[_0x96e2('0x49')](_0x291529,_0x345e15[_0x96e2('0x54')]),{'include':_0x345e15[_0x96e2('0x3a')][_0x96e2('0x51')]?[{'all':!![]}]:undefined,'transaction':_0x4cd817})['then'](function(_0xb9aac8){var _0x290d83=_0xb9aac8[_0x96e2('0x5b')]({'plain':!![]});return db[_0x96e2('0x5c')]['findAll']({'where':{'userProfileId':_0x345e15['params']['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x1c4b8d){if(_0x1c4b8d){return BPromise[_0x96e2('0x5d')](_0x1c4b8d,function(_0x20cad9){return new BPromise(function(_0x3b3ed2,_0x120263){if(_0x20cad9[_0x96e2('0x5e')]===null||_0x20cad9[_0x96e2('0x5e')]===0x1)_0x3b3ed2(null);return db[_0x96e2('0x5f')][_0x96e2('0x4d')]({'where':{'sectionId':_0x20cad9['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x3913c9){var _0x5110d7=_[_0x96e2('0x39')](_0x3913c9,function(_0x3725fb){return qs[_0x96e2('0x57')](_0x3725fb,['id','createdAt',_0x96e2('0x58'),'sectionId']);});_0x3b3ed2(_0x5110d7);})[_0x96e2('0x55')](function(_0x992ecb){_0x120263(_0x992ecb);});})[_0x96e2('0x2f')](function(_0xac65da){var _0x546af4=qs[_0x96e2('0x57')](_0x20cad9,['id',_0x96e2('0x60'),_0x96e2('0x58')]);_0x546af4[_0x96e2('0x61')]=_0x290d83['id'];if(_0xac65da)_0x546af4[_0x96e2('0x62')]=_0xac65da;return _0x546af4;})[_0x96e2('0x2f')](function(_0xed0b1){return db[_0x96e2('0x5c')]['create'](_0xed0b1,{'include':[{'model':db[_0x96e2('0x5f')],'as':_0x96e2('0x62')}],'raw':!![],'transaction':_0x4cd817});});})['then'](function(){return _0x290d83;});}});});});}})[_0x96e2('0x2f')](respondWithResult(_0x4320bd,0xc9))[_0x96e2('0x55')](handleError(_0x4320bd,null));};exports[_0x96e2('0x63')]=function(_0x32f1d9,_0x2ad68a){if(_0x32f1d9['body']['id']){delete _0x32f1d9['body']['id'];}return db[_0x96e2('0x4c')][_0x96e2('0x52')]({'where':{'id':_0x32f1d9[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x2ad68a,null))['then'](saveUpdates(_0x32f1d9[_0x96e2('0x54')],null))[_0x96e2('0x2f')](respondWithResult(_0x2ad68a,null))[_0x96e2('0x55')](handleError(_0x2ad68a,null));};exports['destroy']=function(_0x1c8fde,_0x59a0cf){return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x1c8fde[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x59a0cf,null))[_0x96e2('0x2f')](removeEntity(_0x59a0cf,null))['catch'](handleError(_0x59a0cf,null));};exports[_0x96e2('0x64')]=function(_0xe7309,_0x58804e){return db[_0x96e2('0x4c')][_0x96e2('0x64')]()[_0x96e2('0x2f')](respondWithResult(_0x58804e,null))[_0x96e2('0x55')](handleError(_0x58804e,null));};exports[_0x96e2('0x65')]=function(_0x21226f,_0x26a2ab){var _0x22a4b1=_0x21226f[_0x96e2('0x54')];return db[_0x96e2('0x4c')]['find']({'where':{'id':_0x21226f[_0x96e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x26a2ab,null))['then'](function(_0x101ed7){if(_0x101ed7){return db['sequelize']['transaction'](function(_0x5f27cd){return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x21226f[_0x96e2('0x50')]['id'],'sectionId':_[_0x96e2('0x39')](_0x22a4b1,function(_0x38b656){return _0x38b656[_0x96e2('0x67')];})},'transaction':_0x5f27cd})[_0x96e2('0x2f')](function(){var _0x4a2bbd=_['map'](_0x22a4b1,function(_0x22ce6d){_0x22ce6d['userProfileId']=_0x21226f[_0x96e2('0x50')]['id'];return _0x22ce6d;});var _0x11dd25=[];return BPromise[_0x96e2('0x5d')](_0x4a2bbd,function(_0x1c3ead){return db[_0x96e2('0x5c')][_0x96e2('0x53')](_0x1c3ead,{'include':[{'model':db['UserProfileResource'],'as':_0x96e2('0x62')}],'raw':!![],'transaction':_0x5f27cd})[_0x96e2('0x2f')](function(_0x506a09){_0x11dd25[_0x96e2('0x68')](_0x506a09[_0x96e2('0x5b')]({'plain':!![]}));});})[_0x96e2('0x2f')](function(){return _0x11dd25;});});});}})[_0x96e2('0x2f')](function(_0xe9f5fc){return _0xe9f5fc;})[_0x96e2('0x2f')](respondWithResult(_0x26a2ab,null))[_0x96e2('0x55')](handleError(_0x26a2ab,null));};exports[_0x96e2('0x69')]=function(_0x259583,_0x14e147){var _0x8cbf74;return db[_0x96e2('0x4c')][_0x96e2('0x52')]({'where':{'id':_0x259583['params']['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x14e147,null))[_0x96e2('0x2f')](function(_0x3cb7f3){if(_0x3cb7f3){_0x8cbf74=_0x3cb7f3;return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x259583['params']['id'],'sectionId':_0x259583[_0x96e2('0x3a')][_0x96e2('0x6a')]}});}})[_0x96e2('0x2f')](function(){return _0x8cbf74;})[_0x96e2('0x2f')](respondWithStatusCode(_0x14e147,null))['catch'](handleError(_0x14e147,null));};exports[_0x96e2('0x6b')]=function(_0x1f57f4,_0x110c25){var _0x1deccb=[];var _0x19d00c=[];return db['UserProfileSection'][_0x96e2('0x4d')]({'where':{'userProfileId':_0x1f57f4[_0x96e2('0x50')]['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x16e4f0){_0x1deccb=_[_0x96e2('0x48')](_0x16e4f0,function(_0x1cc6e){return _0x1cc6e[_0x96e2('0x6c')]===0x1||_[_0x96e2('0x6d')]([0x3eb,0x709],_0x1cc6e[_0x96e2('0x67')]);});if(!_['isEmpty'](_0x1deccb)){return _[_0x96e2('0x39')](_0x1deccb,function(_0x1b5c97){return _0x1b5c97[_0x96e2('0x67')];});}else{return;}})[_0x96e2('0x2f')](function(_0x4e7df6){if(_0x4e7df6)_0x19d00c=_0x4e7df6;if(_[_0x96e2('0x6d')](_0x19d00c,0x64)){var _0x9f58b0=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x64});return hasDefaultDashboard(_0x9f58b0)['then'](function(_0x16a67d){return _[_0x96e2('0x39')](_0x1deccb,function(_0x547fdf){if(_0x547fdf['sectionId']===0x64){_0x547fdf[_0x96e2('0x6e')]=_0x16a67d;}return _0x547fdf;});});}else{return;}})['then'](function(_0x562d6f){if(_0x562d6f)_0x1deccb=_0x562d6f;if(_[_0x96e2('0x6d')](_0x19d00c,0x3eb)){var _0x3a8be6=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x3eb});return getCustomDashboards(_0x3a8be6)[_0x96e2('0x2f')](function(_0x4a1838){return _[_0x96e2('0x39')](_0x1deccb,function(_0x477759){if(_0x3a8be6[_0x96e2('0x6c')]){if(_0x477759[_0x96e2('0x67')]===0x3eb){_0x477759[_0x96e2('0x6e')]=_0x4a1838;}}else{if(_0x477759[_0x96e2('0x67')]===0x64){if(!_0x477759['subsections']){_0x477759[_0x96e2('0x6e')]=[];}_0x477759['subsections']=_0x477759[_0x96e2('0x6e')][_0x96e2('0x6f')](_0x4a1838);}}return _0x477759;});});}else{return;}})['then'](function(_0x1c0b68){if(_0x1c0b68)_0x1deccb=_0x1c0b68;if(_[_0x96e2('0x6d')](_0x19d00c,0x709)){var _0x27b0f7=_[_0x96e2('0x52')](_0x1deccb,{'sectionId':0x709});return getPlugins(_0x27b0f7)[_0x96e2('0x2f')](function(_0x3b39f1){if(_0x27b0f7[_0x96e2('0x6c')]){return _[_0x96e2('0x39')](_0x1deccb,function(_0x1521de){if(_0x1521de['sectionId']===0x709){_0x1521de['subsections']=_0x3b39f1;}return _0x1521de;});}else{var _0x398d42={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b39f1};var _0x40e0d1=_[_0x96e2('0x39')](_0x1deccb);_0x40e0d1[_0x96e2('0x68')](_0x398d42);return _0x40e0d1;}});}else{return;}})[_0x96e2('0x2f')](function(_0x33dfb5){if(_0x33dfb5)_0x1deccb=_0x33dfb5;return _[_0x96e2('0x48')](_0x1deccb,[_0x96e2('0x6c'),0x1]);})[_0x96e2('0x2f')](respondWithResult(_0x110c25,null))['catch'](handleError(_0x110c25,null));};function hasDefaultDashboard(_0x588271){var _0x59491e=[0x65];return new BPromise(function(_0x515313,_0x1f9f0c){try{if(_0x588271['autoAssociation']){_0x515313(_0x59491e);}else{return db['UserProfileResource'][_0x96e2('0x70')]({'where':{'sectionId':_0x588271['id']},'raw':!![]})['then'](function(_0x4a5f28){_0x4a5f28?_0x515313(_0x59491e):_0x515313();});}}catch(_0x9ae0f){_0x1f9f0c(_0x9ae0f);}});}function getCustomDashboards(_0x1833f4){var _0x122a66=[];return new BPromise(function(_0x5ddaca,_0x5ccfba){try{if(_0x1833f4[_0x96e2('0x5e')]){return db[_0x96e2('0x71')][_0x96e2('0x4d')]({'raw':!![]})[_0x96e2('0x2f')](function(_0x38e063){_0x38e063[_0x96e2('0x72')](function(_0x4dfbfd){_0x122a66[_0x96e2('0x68')](_0x4dfbfd['id']+0x1869f);});_0x5ddaca(_0x122a66);});}else{return db[_0x96e2('0x5f')]['findAll']({'where':{'sectionId':_0x1833f4['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x432b34){_0x432b34[_0x96e2('0x72')](function(_0x41edd0){_0x122a66[_0x96e2('0x68')](_0x41edd0['resourceId']+0x1869f);});_0x5ddaca(_0x122a66);});}}catch(_0x1c7964){_0x5ccfba(_0x1c7964);}});}function getPlugins(_0x36e178){var _0x195203=[];return new BPromise(function(_0x431975,_0x214f32){try{if(_0x36e178[_0x96e2('0x5e')]){return db['Plugin'][_0x96e2('0x4d')]({'raw':!![]})[_0x96e2('0x2f')](function(_0x192552){_0x192552[_0x96e2('0x72')](function(_0x38a98e){_0x195203[_0x96e2('0x68')](_0x38a98e['id']+0x15b38);});_0x431975(_0x195203);});}else{return db[_0x96e2('0x5f')][_0x96e2('0x4d')]({'where':{'sectionId':_0x36e178['id']},'raw':!![]})[_0x96e2('0x2f')](function(_0x36f8ba){_0x36f8ba['forEach'](function(_0xab15fb){_0x195203[_0x96e2('0x68')](_0xab15fb[_0x96e2('0x73')]+0x15b38);});_0x431975(_0x195203);});}}catch(_0x1385db){_0x214f32(_0x1385db);}});}exports['addResources']=function(_0x211294,_0x1ab780){return db[_0x96e2('0x4c')]['find']({'where':{'id':_0x211294[_0x96e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ab780,null))[_0x96e2('0x2f')](function(_0x42eef2){if(_0x42eef2){return db[_0x96e2('0x74')][_0x96e2('0x5a')](function(_0x185ec9){return db[_0x96e2('0x5c')][_0x96e2('0x4d')]({'where':{'userProfileId':_0x211294['params']['id']},'attributes':['id'],'raw':!![]})[_0x96e2('0x2f')](function(_0x9492f1){if(_0x9492f1){return db[_0x96e2('0x5c')][_0x96e2('0x66')]({'where':{'userProfileId':_0x211294[_0x96e2('0x50')]['id'],'id':_['map'](_0x9492f1,function(_0x12a97f){return _0x12a97f['id'];})},'transaction':_0x185ec9});}})[_0x96e2('0x2f')](function(_0x25fbb7){var _0x3fddd6=_[_0x96e2('0x39')](_0x211294[_0x96e2('0x54')],function(_0x36d415){_0x36d415[_0x96e2('0x61')]=_0x211294['params']['id'];return _0x36d415;});return db[_0x96e2('0x5c')][_0x96e2('0x75')](_0x3fddd6,{'raw':!![],'transaction':_0x185ec9});})['then'](function(_0x5e8b8e){var _0x155cc1=_[_0x96e2('0x48')](_[_0x96e2('0x39')](_0x5e8b8e,function(_0x458363){return _0x458363[_0x96e2('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x155cc1){return db[_0x96e2('0x5c')][_0x96e2('0x4d')]({'where':{'userProfileId':_0x211294[_0x96e2('0x50')]['id'],'sectionId':_[_0x96e2('0x39')](_0x155cc1,function(_0x506ac9){return _0x506ac9[_0x96e2('0x67')];})},'attributes':['id',_0x96e2('0x67')],'raw':!![]})[_0x96e2('0x2f')](function(_0x40a0a2){var _0x5269ca=_[_0x96e2('0x39')](_0x211294['body'],function(_0x2ceede){_0x2ceede[_0x96e2('0x61')]=_0x211294['params']['id'];return _0x2ceede;});return db[_0x96e2('0x5f')][_0x96e2('0x75')](_0x5269ca,{'raw':!![],'transaction':_0x185ec9});});}})[_0x96e2('0x55')](handleError(_0x1ab780,null));});}})[_0x96e2('0x2f')](function(_0x3d036a){var _0x322548=_[_0x96e2('0x39')](_0x3d036a,function(_0x1570ab){return _0x1570ab[_0x96e2('0x5b')]({'plain':!![]});});})[_0x96e2('0x2f')](respondWithResult(_0x1ab780,null))[_0x96e2('0x55')](handleError(_0x1ab780,null));};exports['removeResources']=function(_0x436697,_0x86400,_0x39b7f0){return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x436697['params']['id']}})[_0x96e2('0x2f')](handleEntityNotFound(_0x86400,null))[_0x96e2('0x2f')](function(_0x23e2c5){if(_0x23e2c5){return _0x23e2c5[_0x96e2('0x76')](_0x436697[_0x96e2('0x3a')][_0x96e2('0x6a')]);}})[_0x96e2('0x2f')](respondWithStatusCode(_0x86400,null))['catch'](handleError(_0x86400,null));};exports['getResources']=function(_0x3bf78e,_0x1a2590){var _0x4e62b8={};if(!_0x3bf78e[_0x96e2('0x3a')][_0x96e2('0x77')])throw new Error(_0x96e2('0x78'));if(!_0x3bf78e['query']['hasOwnProperty'](_0x96e2('0x42'))){_0x4e62b8['limit']=qs[_0x96e2('0x28')](_0x3bf78e[_0x96e2('0x3a')]['limit']);_0x4e62b8[_0x96e2('0x2a')]=qs['offset'](_0x3bf78e[_0x96e2('0x3a')][_0x96e2('0x2a')]);}return db['UserProfile'][_0x96e2('0x52')]({'where':{'id':_0x3bf78e[_0x96e2('0x50')]['id']}})[_0x96e2('0x2f')](function(_0x4d4cf7){if(!_0x4d4cf7)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3bf78e[_0x96e2('0x50')]['id']);return db[_0x96e2('0x4c')][_0x96e2('0x79')](_0x3bf78e);})[_0x96e2('0x2f')](respondWithFilteredResult(_0x1a2590,_0x4e62b8))[_0x96e2('0x55')](handleError(_0x1a2590,null));}; \ No newline at end of file +var _0xddae=['enabled','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','clone','params','get','omit','createdAt','crudPermissions','sequelize','transaction','autoAssociation','sectionId','updatedAt','userProfileId','UserProfileSection','UserProfileResource','describe','addSections','destroy','each','Resources','push','removeSections','ids','getSections'];(function(_0x5f284a,_0x4aab66){var _0x5fe7ed=function(_0xbec4ee){while(--_0xbec4ee){_0x5f284a['push'](_0x5f284a['shift']());}};_0x5fe7ed(++_0x4aab66);}(_0xddae,0x1dc));var _0xedda=function(_0x32a49f,_0x4dae0e){_0x32a49f=_0x32a49f-0x0;var _0x3ba2df=_0xddae[_0x32a49f];return _0x3ba2df;};'use strict';var emlformat=require(_0xedda('0x0'));var rimraf=require(_0xedda('0x1'));var zipdir=require(_0xedda('0x2'));var jsonpatch=require(_0xedda('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xedda('0x4'));var Mustache=require(_0xedda('0x5'));var util=require(_0xedda('0x6'));var path=require(_0xedda('0x7'));var sox=require(_0xedda('0x8'));var csv=require(_0xedda('0x9'));var ejs=require(_0xedda('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xedda('0xb'));var squel=require(_0xedda('0xc'));var crypto=require('crypto');var jsforce=require(_0xedda('0xd'));var deskjs=require(_0xedda('0xe'));var toCsv=require(_0xedda('0x9'));var querystring=require('querystring');var Papa=require(_0xedda('0xf'));var Redis=require(_0xedda('0x10'));var authService=require(_0xedda('0x11'));var qs=require(_0xedda('0x12'));var as=require(_0xedda('0x13'));var hardwareService=require(_0xedda('0x14'));var logger=require(_0xedda('0x15'))('api');var utils=require(_0xedda('0x16'));var config=require(_0xedda('0x17'));var licenseUtil=require(_0xedda('0x18'));var db=require(_0xedda('0x19'))['db'];config[_0xedda('0x1a')]=_[_0xedda('0x1b')](config[_0xedda('0x1a')],{'host':_0xedda('0x1c'),'port':0x18eb});var socket=require(_0xedda('0x1d'))(new Redis(config[_0xedda('0x1a')]));require(_0xedda('0x1e'))['register'](socket);function respondWithStatusCode(_0x3c0281,_0x557536){_0x557536=_0x557536||0xcc;return function(_0x539f73){if(_0x539f73){return _0x3c0281[_0xedda('0x1f')](_0x557536);}return _0x3c0281['status'](_0x557536)['end']();};}function respondWithResult(_0x44cf93,_0x5a4d52){_0x5a4d52=_0x5a4d52||0xc8;return function(_0x451d27){if(_0x451d27){return _0x44cf93[_0xedda('0x20')](_0x5a4d52)['json'](_0x451d27);}};}function respondWithFilteredResult(_0x317007,_0x284aa0){return function(_0x660c7e){if(_0x660c7e){var _0x256bd2=typeof _0x284aa0[_0xedda('0x21')]===_0xedda('0x22')&&typeof _0x284aa0[_0xedda('0x23')]===_0xedda('0x22');var _0x41cd50=_0x660c7e[_0xedda('0x24')];var _0x4e51d6=_0x256bd2?0x0:_0x284aa0[_0xedda('0x21')];var _0x617e1b=_0x256bd2?_0x660c7e['count']:_0x284aa0['offset']+_0x284aa0[_0xedda('0x23')];var _0x28e1b7;if(_0x617e1b>=_0x41cd50){_0x617e1b=_0x41cd50;_0x28e1b7=0xc8;}else{_0x28e1b7=0xce;}_0x317007['status'](_0x28e1b7);return _0x317007[_0xedda('0x25')](_0xedda('0x26'),_0x4e51d6+'-'+_0x617e1b+'/'+_0x41cd50)['json'](_0x660c7e);}return null;};}function patchUpdates(_0x584d7d){return function(_0x2323d4){try{jsonpatch[_0xedda('0x27')](_0x2323d4,_0x584d7d,!![]);}catch(_0x53bc09){return BPromise[_0xedda('0x28')](_0x53bc09);}return _0x2323d4['save']();};}function saveUpdates(_0x4d15fd,_0x1ebcd8){return function(_0x576870){if(_0x576870){return _0x576870['update'](_0x4d15fd)[_0xedda('0x29')](function(_0x47234b){return _0x47234b;});}return null;};}function removeEntity(_0x2d1c76,_0x4e7c5a){return function(_0x5b46e3){if(_0x5b46e3){return _0x5b46e3['destroy']()[_0xedda('0x29')](function(){_0x2d1c76[_0xedda('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc6e8,_0x30df69){return function(_0x14d5da){if(!_0x14d5da){_0x1cc6e8['sendStatus'](0x194);}return _0x14d5da;};}function handleError(_0x1ed26c,_0x2891d5){_0x2891d5=_0x2891d5||0x1f4;return function(_0x2f23da){logger[_0xedda('0x2a')](_0x2f23da['stack']);if(_0x2f23da[_0xedda('0x2b')]){delete _0x2f23da[_0xedda('0x2b')];}_0x1ed26c['status'](_0x2891d5)[_0xedda('0x2c')](_0x2f23da);};}exports[_0xedda('0x2d')]=function(_0x1018f0,_0x59f8f3){var _0x4f7f34={},_0x30fa2={},_0x264bac={'count':0x0,'rows':[]};var _0x2155af=_[_0xedda('0x2e')](db[_0xedda('0x2f')][_0xedda('0x30')],function(_0x3b9e4e){return{'name':_0x3b9e4e[_0xedda('0x31')],'type':_0x3b9e4e['type'][_0xedda('0x32')]};});_0x30fa2[_0xedda('0x33')]=_[_0xedda('0x2e')](_0x2155af,'name');_0x30fa2[_0xedda('0x34')]=_[_0xedda('0x35')](_0x1018f0[_0xedda('0x34')]);_0x30fa2[_0xedda('0x36')]=_[_0xedda('0x37')](_0x30fa2[_0xedda('0x33')],_0x30fa2[_0xedda('0x34')]);_0x4f7f34[_0xedda('0x38')]=_[_0xedda('0x37')](_0x30fa2[_0xedda('0x33')],qs[_0xedda('0x39')](_0x1018f0[_0xedda('0x34')][_0xedda('0x39')]));_0x4f7f34[_0xedda('0x38')]=_0x4f7f34[_0xedda('0x38')][_0xedda('0x3a')]?_0x4f7f34[_0xedda('0x38')]:_0x30fa2[_0xedda('0x33')];if(!_0x1018f0['query'][_0xedda('0x3b')](_0xedda('0x3c'))){_0x4f7f34['limit']=qs[_0xedda('0x23')](_0x1018f0['query'][_0xedda('0x23')]);_0x4f7f34['offset']=qs[_0xedda('0x21')](_0x1018f0[_0xedda('0x34')][_0xedda('0x21')]);}_0x4f7f34[_0xedda('0x3d')]=qs[_0xedda('0x3e')](_0x1018f0['query'][_0xedda('0x3e')]);_0x4f7f34[_0xedda('0x3f')]=qs[_0xedda('0x36')](_['pick'](_0x1018f0[_0xedda('0x34')],_0x30fa2[_0xedda('0x36')]),_0x2155af);if(_0x1018f0['query'][_0xedda('0x40')]){_0x4f7f34[_0xedda('0x3f')]=_[_0xedda('0x41')](_0x4f7f34[_0xedda('0x3f')],{'$or':_['map'](_0x2155af,function(_0x346f62){if(_0x346f62['type']!=='VIRTUAL'){var _0x56bdf5={};_0x56bdf5[_0x346f62[_0xedda('0x2b')]]={'$like':'%'+_0x1018f0[_0xedda('0x34')][_0xedda('0x40')]+'%'};return _0x56bdf5;}})});}_0x4f7f34=_[_0xedda('0x41')]({},_0x4f7f34,_0x1018f0[_0xedda('0x42')]);var _0x5d35fe={'where':_0x4f7f34[_0xedda('0x3f')]};return db['UserProfile'][_0xedda('0x24')](_0x5d35fe)['then'](function(_0x424892){_0x264bac[_0xedda('0x24')]=_0x424892;if(_0x1018f0[_0xedda('0x34')][_0xedda('0x43')]){_0x4f7f34[_0xedda('0x44')]=[{'all':!![]}];}return db[_0xedda('0x2f')][_0xedda('0x45')](_0x4f7f34);})[_0xedda('0x29')](function(_0xbdf513){_0x264bac[_0xedda('0x46')]=_0xbdf513;return _0x264bac;})[_0xedda('0x29')](respondWithFilteredResult(_0x59f8f3,_0x4f7f34))['catch'](handleError(_0x59f8f3,null));};exports[_0xedda('0x47')]=function(_0x542dac,_0x9982fa){var _0x288e6e={'raw':![],'where':{'id':_0x542dac['params']['id']}},_0x3438e7={};_0x3438e7[_0xedda('0x33')]=_[_0xedda('0x35')](db['UserProfile']['rawAttributes']);_0x3438e7[_0xedda('0x34')]=_[_0xedda('0x35')](_0x542dac[_0xedda('0x34')]);_0x3438e7['filters']=_[_0xedda('0x37')](_0x3438e7[_0xedda('0x33')],_0x3438e7[_0xedda('0x34')]);_0x288e6e[_0xedda('0x38')]=_[_0xedda('0x37')](_0x3438e7['model'],qs[_0xedda('0x39')](_0x542dac[_0xedda('0x34')]['fields']));_0x288e6e[_0xedda('0x38')]=_0x288e6e['attributes'][_0xedda('0x3a')]?_0x288e6e['attributes']:_0x3438e7[_0xedda('0x33')];if(_0x542dac[_0xedda('0x34')][_0xedda('0x43')]){_0x288e6e['include']=[{'all':!![]}];}_0x288e6e=_[_0xedda('0x41')]({},_0x288e6e,_0x542dac[_0xedda('0x42')]);return db[_0xedda('0x2f')][_0xedda('0x48')](_0x288e6e)[_0xedda('0x29')](handleEntityNotFound(_0x9982fa,null))['then'](respondWithResult(_0x9982fa,null))[_0xedda('0x49')](handleError(_0x9982fa,null));};exports[_0xedda('0x4a')]=function(_0x2fc978,_0x5baa32){return db['UserProfile']['create'](_0x2fc978[_0xedda('0x4b')],{})[_0xedda('0x29')](respondWithResult(_0x5baa32,0xc9))[_0xedda('0x49')](handleError(_0x5baa32,null));};exports[_0xedda('0x4c')]=function(_0x16eb80,_0x338cc9){var _0x418fb2={'where':{'id':_0x16eb80[_0xedda('0x4d')]['id']}},_0x32b8b7={};_0x32b8b7['model']=_[_0xedda('0x35')](db[_0xedda('0x2f')][_0xedda('0x30')]);_0x418fb2['attributes']=_['intersection'](_0x32b8b7[_0xedda('0x33')],qs['fields'](_0x16eb80['query'][_0xedda('0x39')]));_0x418fb2[_0xedda('0x38')]=_0x418fb2[_0xedda('0x38')][_0xedda('0x3a')]?_0x418fb2['attributes']:_0x32b8b7[_0xedda('0x33')];if(_0x16eb80[_0xedda('0x34')][_0xedda('0x43')]){_0x418fb2[_0xedda('0x44')]=[{'all':!![]}];}_0x418fb2=_[_0xedda('0x41')]({},_0x418fb2,_0x16eb80[_0xedda('0x42')]);return db['UserProfile'][_0xedda('0x48')](_0x418fb2)[_0xedda('0x29')](handleEntityNotFound(_0x338cc9,null))[_0xedda('0x29')](function(_0x5225f0){if(_0x5225f0){var _0x511bab=_0x5225f0[_0xedda('0x4e')]({'plain':!![]});_0x511bab=qs[_0xedda('0x4f')](_0x511bab,['id',_0xedda('0x50'),'updatedAt',_0xedda('0x51')]);_0x16eb80[_0xedda('0x4b')]=_[_0xedda('0x4f')](_0x16eb80['body'],['id',_0xedda('0x50'),'updatedAt']);return db[_0xedda('0x52')][_0xedda('0x53')](function(_0x511e50){return db[_0xedda('0x2f')]['create'](_[_0xedda('0x41')](_0x511bab,_0x16eb80[_0xedda('0x4b')]),{'include':_0x16eb80['query'][_0xedda('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x511e50})[_0xedda('0x29')](function(_0x1daa8d){var _0xbfe102=_0x1daa8d[_0xedda('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0xedda('0x45')]({'where':{'userProfileId':_0x16eb80['params']['id']},'raw':!![]})[_0xedda('0x29')](function(_0x43022e){if(_0x43022e){return BPromise['each'](_0x43022e,function(_0x3b42a8){return new BPromise(function(_0xf75dd3,_0x31c6fa){if(_0x3b42a8[_0xedda('0x54')]===null||_0x3b42a8[_0xedda('0x54')]===0x1)_0xf75dd3(null);return db['UserProfileResource'][_0xedda('0x45')]({'where':{'sectionId':_0x3b42a8['id']},'raw':!![]})['then'](function(_0x542e2f){var _0x111df1=_[_0xedda('0x2e')](_0x542e2f,function(_0x559f35){return qs[_0xedda('0x4f')](_0x559f35,['id',_0xedda('0x50'),'updatedAt',_0xedda('0x55')]);});_0xf75dd3(_0x111df1);})['catch'](function(_0x3cc903){_0x31c6fa(_0x3cc903);});})['then'](function(_0x5a32b0){var _0x41c998=qs[_0xedda('0x4f')](_0x3b42a8,['id',_0xedda('0x50'),_0xedda('0x56')]);_0x41c998[_0xedda('0x57')]=_0xbfe102['id'];if(_0x5a32b0)_0x41c998['Resources']=_0x5a32b0;return _0x41c998;})[_0xedda('0x29')](function(_0x4c003e){return db[_0xedda('0x58')][_0xedda('0x4a')](_0x4c003e,{'include':[{'model':db[_0xedda('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x511e50});});})[_0xedda('0x29')](function(){return _0xbfe102;});}});});});}})['then'](respondWithResult(_0x338cc9,0xc9))[_0xedda('0x49')](handleError(_0x338cc9,null));};exports['update']=function(_0x54b79d,_0x33dd59){if(_0x54b79d[_0xedda('0x4b')]['id']){delete _0x54b79d[_0xedda('0x4b')]['id'];}return db[_0xedda('0x2f')][_0xedda('0x48')]({'where':{'id':_0x54b79d[_0xedda('0x4d')]['id']}})['then'](handleEntityNotFound(_0x33dd59,null))[_0xedda('0x29')](saveUpdates(_0x54b79d[_0xedda('0x4b')],null))[_0xedda('0x29')](respondWithResult(_0x33dd59,null))['catch'](handleError(_0x33dd59,null));};exports['destroy']=function(_0x1c52b8,_0xd19561){return db[_0xedda('0x2f')][_0xedda('0x48')]({'where':{'id':_0x1c52b8[_0xedda('0x4d')]['id']}})[_0xedda('0x29')](handleEntityNotFound(_0xd19561,null))[_0xedda('0x29')](removeEntity(_0xd19561,null))['catch'](handleError(_0xd19561,null));};exports[_0xedda('0x5a')]=function(_0x5f5033,_0x2146aa){return db['UserProfile'][_0xedda('0x5a')]()[_0xedda('0x29')](respondWithResult(_0x2146aa,null))[_0xedda('0x49')](handleError(_0x2146aa,null));};exports[_0xedda('0x5b')]=function(_0x2f7ea4,_0x3641c9){var _0x462196=_0x2f7ea4[_0xedda('0x4b')];return db[_0xedda('0x2f')]['find']({'where':{'id':_0x2f7ea4[_0xedda('0x4d')]['id']}})[_0xedda('0x29')](handleEntityNotFound(_0x3641c9,null))[_0xedda('0x29')](function(_0x43500d){if(_0x43500d){return db[_0xedda('0x52')][_0xedda('0x53')](function(_0x58ceb7){return db[_0xedda('0x58')][_0xedda('0x5c')]({'where':{'userProfileId':_0x2f7ea4['params']['id'],'sectionId':_[_0xedda('0x2e')](_0x462196,function(_0x2d5400){return _0x2d5400['sectionId'];})},'transaction':_0x58ceb7})[_0xedda('0x29')](function(){var _0x15156f=_[_0xedda('0x2e')](_0x462196,function(_0x34081a){_0x34081a[_0xedda('0x57')]=_0x2f7ea4[_0xedda('0x4d')]['id'];return _0x34081a;});var _0x59cc24=[];return BPromise[_0xedda('0x5d')](_0x15156f,function(_0x3439a7){return db[_0xedda('0x58')]['create'](_0x3439a7,{'include':[{'model':db[_0xedda('0x59')],'as':_0xedda('0x5e')}],'raw':!![],'transaction':_0x58ceb7})[_0xedda('0x29')](function(_0x135c88){_0x59cc24[_0xedda('0x5f')](_0x135c88[_0xedda('0x4e')]({'plain':!![]}));});})[_0xedda('0x29')](function(){return _0x59cc24;});});});}})['then'](function(_0x1ae298){return _0x1ae298;})['then'](respondWithResult(_0x3641c9,null))['catch'](handleError(_0x3641c9,null));};exports[_0xedda('0x60')]=function(_0x4c5fe8,_0x492526){var _0x3edf95;return db[_0xedda('0x2f')][_0xedda('0x48')]({'where':{'id':_0x4c5fe8[_0xedda('0x4d')]['id']},'attributes':['id','name']})[_0xedda('0x29')](handleEntityNotFound(_0x492526,null))[_0xedda('0x29')](function(_0x580f9c){if(_0x580f9c){_0x3edf95=_0x580f9c;return db[_0xedda('0x58')][_0xedda('0x5c')]({'where':{'userProfileId':_0x4c5fe8[_0xedda('0x4d')]['id'],'sectionId':_0x4c5fe8[_0xedda('0x34')][_0xedda('0x61')]}});}})[_0xedda('0x29')](function(){return _0x3edf95;})[_0xedda('0x29')](respondWithStatusCode(_0x492526,null))[_0xedda('0x49')](handleError(_0x492526,null));};exports[_0xedda('0x62')]=function(_0x315e0d,_0x3740d0){var _0x1664a3=[];var _0x96f9da=[];return db[_0xedda('0x58')]['findAll']({'where':{'userProfileId':_0x315e0d[_0xedda('0x4d')]['id']},'raw':!![]})[_0xedda('0x29')](function(_0x5840c7){_0x1664a3=_['filter'](_0x5840c7,function(_0x4cab37){return _0x4cab37[_0xedda('0x63')]===0x1||_[_0xedda('0x64')]([0x3eb,0x709],_0x4cab37[_0xedda('0x55')]);});if(!_['isEmpty'](_0x1664a3)){return _['map'](_0x1664a3,function(_0x466720){return _0x466720['sectionId'];});}else{return;}})['then'](function(_0x3b445c){if(_0x3b445c)_0x96f9da=_0x3b445c;if(_[_0xedda('0x64')](_0x96f9da,0x64)){var _0x5df45=_['find'](_0x1664a3,{'sectionId':0x64});return hasDefaultDashboard(_0x5df45)['then'](function(_0x18135e){return _['map'](_0x1664a3,function(_0x4b13af){if(_0x4b13af[_0xedda('0x55')]===0x64){_0x4b13af[_0xedda('0x65')]=_0x18135e;}return _0x4b13af;});});}else{return;}})[_0xedda('0x29')](function(_0x220d88){if(_0x220d88)_0x1664a3=_0x220d88;if(_['includes'](_0x96f9da,0x3eb)){var _0x351d35=_[_0xedda('0x48')](_0x1664a3,{'sectionId':0x3eb});return getCustomDashboards(_0x351d35)['then'](function(_0x12f7c9){return _['map'](_0x1664a3,function(_0x2a5e44){if(_0x351d35[_0xedda('0x63')]){if(_0x2a5e44[_0xedda('0x55')]===0x3eb){_0x2a5e44[_0xedda('0x65')]=_0x12f7c9;}}else{if(_0x2a5e44[_0xedda('0x55')]===0x64){if(!_0x2a5e44[_0xedda('0x65')]){_0x2a5e44[_0xedda('0x65')]=[];}_0x2a5e44[_0xedda('0x65')]=_0x2a5e44[_0xedda('0x65')][_0xedda('0x66')](_0x12f7c9);}}return _0x2a5e44;});});}else{return;}})['then'](function(_0x373309){if(_0x373309)_0x1664a3=_0x373309;if(_[_0xedda('0x64')](_0x96f9da,0x709)){var _0x37acf2=_[_0xedda('0x48')](_0x1664a3,{'sectionId':0x709});return getPlugins(_0x37acf2)[_0xedda('0x29')](function(_0x47143a){if(_0x37acf2['enabled']){return _[_0xedda('0x2e')](_0x1664a3,function(_0x5bd847){if(_0x5bd847[_0xedda('0x55')]===0x709){_0x5bd847[_0xedda('0x65')]=_0x47143a;}return _0x5bd847;});}else{var _0x1eab73={'sectionId':0x76c,'enabled':0x1,'subsections':_0x47143a};var _0x317b16=_['map'](_0x1664a3);_0x317b16[_0xedda('0x5f')](_0x1eab73);return _0x317b16;}});}else{return;}})['then'](function(_0x1c1f6e){if(_0x1c1f6e)_0x1664a3=_0x1c1f6e;return _[_0xedda('0x40')](_0x1664a3,[_0xedda('0x63'),0x1]);})[_0xedda('0x29')](respondWithResult(_0x3740d0,null))[_0xedda('0x49')](handleError(_0x3740d0,null));};function hasDefaultDashboard(_0x1b4c21){var _0x33503c=[0x65];return new BPromise(function(_0x5c9671,_0x4d0612){try{if(_0x1b4c21[_0xedda('0x54')]){_0x5c9671(_0x33503c);}else{return db[_0xedda('0x59')][_0xedda('0x67')]({'where':{'sectionId':_0x1b4c21['id']},'raw':!![]})[_0xedda('0x29')](function(_0xab9239){_0xab9239?_0x5c9671(_0x33503c):_0x5c9671();});}}catch(_0x425073){_0x4d0612(_0x425073);}});}function getCustomDashboards(_0xa949f9){var _0x5217e8=[];return new BPromise(function(_0x248438,_0x238157){try{if(_0xa949f9[_0xedda('0x54')]){return db[_0xedda('0x68')][_0xedda('0x45')]({'raw':!![]})[_0xedda('0x29')](function(_0x5f0021){_0x5f0021[_0xedda('0x69')](function(_0x4d5f0c){_0x5217e8['push'](_0x4d5f0c['id']+0x1869f);});_0x248438(_0x5217e8);});}else{return db[_0xedda('0x59')]['findAll']({'where':{'sectionId':_0xa949f9['id']},'raw':!![]})['then'](function(_0xd975d9){_0xd975d9[_0xedda('0x69')](function(_0x907db3){_0x5217e8[_0xedda('0x5f')](_0x907db3[_0xedda('0x6a')]+0x1869f);});_0x248438(_0x5217e8);});}}catch(_0x1bd12d){_0x238157(_0x1bd12d);}});}function getPlugins(_0x2b3db1){var _0x57d0c6=[];return new BPromise(function(_0x2d0b8a,_0x1498bc){try{if(_0x2b3db1[_0xedda('0x54')]){return db[_0xedda('0x6b')][_0xedda('0x45')]({'raw':!![]})['then'](function(_0x45dce4){_0x45dce4[_0xedda('0x69')](function(_0x33c1cd){_0x57d0c6['push'](_0x33c1cd['id']+0x15b38);});_0x2d0b8a(_0x57d0c6);});}else{return db['UserProfileResource'][_0xedda('0x45')]({'where':{'sectionId':_0x2b3db1['id']},'raw':!![]})['then'](function(_0xb0d037){_0xb0d037['forEach'](function(_0x5c69ad){_0x57d0c6['push'](_0x5c69ad[_0xedda('0x6a')]+0x15b38);});_0x2d0b8a(_0x57d0c6);});}}catch(_0x24761b){_0x1498bc(_0x24761b);}});}exports[_0xedda('0x6c')]=function(_0x18888e,_0x54b518){return db[_0xedda('0x2f')][_0xedda('0x48')]({'where':{'id':_0x18888e[_0xedda('0x4d')]['id']}})[_0xedda('0x29')](handleEntityNotFound(_0x54b518,null))[_0xedda('0x29')](function(_0x400b66){if(_0x400b66){return db[_0xedda('0x52')]['transaction'](function(_0x56ed4a){return db[_0xedda('0x58')][_0xedda('0x45')]({'where':{'userProfileId':_0x18888e[_0xedda('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0xedda('0x29')](function(_0x6b292a){if(_0x6b292a){return db[_0xedda('0x58')][_0xedda('0x5c')]({'where':{'userProfileId':_0x18888e[_0xedda('0x4d')]['id'],'id':_[_0xedda('0x2e')](_0x6b292a,function(_0xd31e63){return _0xd31e63['id'];})},'transaction':_0x56ed4a});}})[_0xedda('0x29')](function(_0x352cc7){var _0x1c657c=_['map'](_0x18888e[_0xedda('0x4b')],function(_0x36ee95){_0x36ee95[_0xedda('0x57')]=_0x18888e[_0xedda('0x4d')]['id'];return _0x36ee95;});return db[_0xedda('0x58')][_0xedda('0x6d')](_0x1c657c,{'raw':!![],'transaction':_0x56ed4a});})[_0xedda('0x29')](function(_0x55b694){var _0x53f3ee=_[_0xedda('0x40')](_[_0xedda('0x2e')](_0x55b694,function(_0x5d64a1){return _0x5d64a1[_0xedda('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x53f3ee){return db[_0xedda('0x58')]['findAll']({'where':{'userProfileId':_0x18888e[_0xedda('0x4d')]['id'],'sectionId':_[_0xedda('0x2e')](_0x53f3ee,function(_0x587ac9){return _0x587ac9[_0xedda('0x55')];})},'attributes':['id',_0xedda('0x55')],'raw':!![]})[_0xedda('0x29')](function(_0x37228a){var _0x56e9f8=_[_0xedda('0x2e')](_0x18888e[_0xedda('0x4b')],function(_0x8fa422){_0x8fa422[_0xedda('0x57')]=_0x18888e['params']['id'];return _0x8fa422;});return db[_0xedda('0x59')]['bulkCreate'](_0x56e9f8,{'raw':!![],'transaction':_0x56ed4a});});}})[_0xedda('0x49')](handleError(_0x54b518,null));});}})[_0xedda('0x29')](function(_0x3bec81){var _0x33151d=_[_0xedda('0x2e')](_0x3bec81,function(_0x4cb840){return _0x4cb840[_0xedda('0x4e')]({'plain':!![]});});})[_0xedda('0x29')](respondWithResult(_0x54b518,null))[_0xedda('0x49')](handleError(_0x54b518,null));};exports[_0xedda('0x6e')]=function(_0x4e2415,_0x2c9c27,_0x1fb3b9){return db[_0xedda('0x2f')][_0xedda('0x48')]({'where':{'id':_0x4e2415[_0xedda('0x4d')]['id']}})[_0xedda('0x29')](handleEntityNotFound(_0x2c9c27,null))[_0xedda('0x29')](function(_0x29bf59){if(_0x29bf59){return _0x29bf59[_0xedda('0x6e')](_0x4e2415[_0xedda('0x34')][_0xedda('0x61')]);}})[_0xedda('0x29')](respondWithStatusCode(_0x2c9c27,null))[_0xedda('0x49')](handleError(_0x2c9c27,null));};exports[_0xedda('0x6f')]=function(_0x4601b2,_0x2905b7){var _0x64620e={};if(!_0x4601b2[_0xedda('0x34')][_0xedda('0x70')])throw new Error(_0xedda('0x71'));if(!_0x4601b2[_0xedda('0x34')][_0xedda('0x3b')](_0xedda('0x3c'))){_0x64620e[_0xedda('0x23')]=qs[_0xedda('0x23')](_0x4601b2[_0xedda('0x34')][_0xedda('0x23')]);_0x64620e[_0xedda('0x21')]=qs[_0xedda('0x21')](_0x4601b2[_0xedda('0x34')][_0xedda('0x21')]);}return db['UserProfile']['find']({'where':{'id':_0x4601b2[_0xedda('0x4d')]['id']}})[_0xedda('0x29')](function(_0x3577cf){if(!_0x3577cf)throw new Error(_0xedda('0x72')+_0x4601b2[_0xedda('0x4d')]['id']);return db['UserProfile']['getResources'](_0x4601b2);})['then'](respondWithFilteredResult(_0x2905b7,_0x64620e))['catch'](handleError(_0x2905b7,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index a4869fa..c65f7d0 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 _0x7524=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7524,0xce));var _0x4752=function(_0x173137,_0x5f3278){_0x173137=_0x173137-0x0;var _0x4930be=_0x7524[_0x173137];return _0x4930be;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4752('0x0'))['db'][_0x4752('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4752('0x2'),'afterUpdate':_0x4752('0x3'),'afterDestroy':'remove'};function emitEvent(_0x599e2b){return function(_0x3eae1a,_0x4d5e05,_0x3884b9){UserProfileEvents[_0x4752('0x4')](_0x599e2b+':'+_0x3eae1a['id'],_0x3eae1a);UserProfileEvents[_0x4752('0x4')](_0x599e2b,_0x3eae1a);_0x3884b9(null);};}for(var e in events){if(events[_0x4752('0x5')](e)){var event=events[e];UserProfile[_0x4752('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x3e24=['../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1d9b07,_0x19ee52){var _0x24dab2=function(_0x3de071){while(--_0x3de071){_0x1d9b07['push'](_0x1d9b07['shift']());}};_0x24dab2(++_0x19ee52);}(_0x3e24,0x167));var _0x43e2=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0x3e24[_0x10d618];return _0x57d044;};'use strict';var EventEmitter=require(_0x43e2('0x0'));var UserProfile=require(_0x43e2('0x1'))['db'][_0x43e2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x43e2('0x3')](0x0);var events={'afterCreate':_0x43e2('0x4'),'afterUpdate':'update','afterDestroy':_0x43e2('0x5')};function emitEvent(_0x1ff04b){return function(_0x5d2806,_0x1dd127,_0x18629c){UserProfileEvents[_0x43e2('0x6')](_0x1ff04b+':'+_0x5d2806['id'],_0x5d2806);UserProfileEvents[_0x43e2('0x6')](_0x1ff04b,_0x5d2806);_0x18629c(null);};}for(var e in events){if(events[_0x43e2('0x7')](e)){var event=events[e];UserProfile[_0x43e2('0x8')](e,emitEvent(event));}}module[_0x43e2('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 4b6aaab..802f69d 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 _0x8a62=['internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueue','type','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','Users','admin','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','charAt','select','ui.','InteractionId','ui.createdAt','_interactions','where','ui.UserId\x20=\x20?','OpenTabs','define','UserProfile','query','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','isEmpty','union','length','rawAttributes','keys','filters','intersection','fields','attributes','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','color','tag','ThroughTags','Agents','openTabs','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','findAll','map','catch','model','then','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','ListId','lists','CmList','companies','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes'];(function(_0x3585fb,_0x5df075){var _0x48fb79=function(_0x595516){while(--_0x595516){_0x3585fb['push'](_0x3585fb['shift']());}};_0x48fb79(++_0x5df075);}(_0x8a62,0x1ef));var _0x28a6=function(_0x4348c4,_0x5a76a1){_0x4348c4=_0x4348c4-0x0;var _0x5a978c=_0x8a62[_0x4348c4];return _0x5a978c;};'use strict';var _=require(_0x28a6('0x0'));var attributes=require(_0x28a6('0x1'));var squel=require('squel');module[_0x28a6('0x2')]=function(_0x1d915c){var _0x50adad=_0x1d915c[_0x28a6('0x3')];function _0x487417(_0x52c0a7,_0x513f1e){return new Promise(function(_0x420858,_0x429e0f){if(!_0x513f1e)return _0x420858(null);var _0x36a0ba=_0x513f1e['filter']?{[_0x513f1e[_0x28a6('0x4')][_0x28a6('0x5')]]:_0x513f1e['filter'][_0x28a6('0x6')]}:undefined;return _0x50adad[_0x52c0a7][_0x28a6('0x7')]({'where':_0x36a0ba,'raw':!![]})['then'](function(_0x2871ce){_0x513f1e['associatedResources']=_[_0x28a6('0x8')](_0x2871ce,'id');_0x420858(_0x513f1e);})[_0x28a6('0x9')](function(_0x851ef5){_0x429e0f(_0x851ef5);});});}function _0x3b5b3d(_0x22c58a,_0x42a557){return new Promise(function(_0x3c9b41,_0x2546ed){var _0x40fe8b=_0x22c58a[_0x28a6('0x4')]?{[_0x22c58a[_0x28a6('0x4')][_0x28a6('0x5')]]:_0x22c58a[_0x28a6('0x4')][_0x28a6('0x6')]}:undefined;return _0x50adad[_0x22c58a[_0x28a6('0xa')]][_0x28a6('0x7')]({'where':_0x40fe8b,'raw':!![]})[_0x28a6('0xb')](function(_0x5c810f){_0x42a557[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x5c810f,function(_0x42202f){return _0x42202f[_0x28a6('0xd')];});_0x3c9b41(_0x42a557);})[_0x28a6('0x9')](function(_0x4f4117){_0x2546ed(_0x4f4117);});});}function _0x4c1c0a(_0x385983,_0x50af5c,_0x10d0a1){if(!_0x50af5c)return Promise[_0x28a6('0xe')](null);return new Promise(function(_0x46197d,_0x442897){return _0x50adad[_0x28a6('0xf')][_0x28a6('0x7')]({'where':{'sectionId':_0x50af5c['id']},'raw':!![]})['then'](function(_0x2155e5){if(_0x385983[_0x28a6('0x5')]&&_0x385983[_0x28a6('0x5')]!=='id'){_0x50af5c[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x2155e5,function(_0xe50159){return _0xe50159[_0x385983['field']];});}else{if(_0x10d0a1===_0x28a6('0x10')){_0x50af5c['associatedResources']=_[_0x28a6('0x8')](_0x2155e5,function(_0x42799d){return{'id':_0x42799d['resourceId'],'type':_0x42799d['type']};});}else{_0x50af5c[_0x28a6('0xc')]=_[_0x28a6('0x8')](_0x2155e5,function(_0x313536){return _0x313536[_0x28a6('0x11')];});}}_0x46197d(_0x50af5c);})[_0x28a6('0x9')](function(_0x3f7217){_0x442897(_0x3f7217);});});}function _0x15cb95(_0x41d40f,_0x33efac){var _0x5c4bc1={'parentSections':[]};switch(_0x41d40f[_0x28a6('0x12')]()){case _0x28a6('0x13'):_0x5c4bc1[_0x28a6('0x14')]='SquareProject';break;case _0x28a6('0x15'):_0x5c4bc1[_0x28a6('0x14')]='SquareOdbc';break;case _0x28a6('0x16'):_0x5c4bc1['childModel']=_0x28a6('0x17');_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x19'),'field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x1a')}];break;case'projects':_0x5c4bc1['childModel']=_0x28a6('0x1b');break;case _0x28a6('0x1c'):_0x5c4bc1[_0x28a6('0x14')]='CmContact';_0x5c4bc1['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x28a6('0x1d')}];break;case _0x28a6('0x1e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x1f');break;case _0x28a6('0x20'):_0x5c4bc1[_0x28a6('0x14')]='CmCompany';break;case'globalcustomfields':_0x5c4bc1['childModel']='CmCustomField';break;case _0x28a6('0x21'):_0x5c4bc1['childModel']=_0x28a6('0x22');break;case _0x28a6('0x23'):_0x5c4bc1[_0x28a6('0x14')]='ChatWebsite';break;case _0x28a6('0x24'):_0x5c4bc1[_0x28a6('0x14')]='FaxQueue';break;case _0x28a6('0x25'):_0x5c4bc1['childModel']='FaxAccount';break;case _0x28a6('0x26'):case _0x28a6('0x27'):case _0x28a6('0x28'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x29');break;case _0x28a6('0x2a'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2b');break;case'voicemails':_0x5c4bc1[_0x28a6('0x14')]='VoiceMail';break;case _0x28a6('0x2c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2d');_0x5c4bc1[_0x28a6('0x18')]=[{'name':'Agents','field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x2e'),'model':_0x28a6('0x2f'),'filter':{'field':_0x28a6('0x30'),'value':['agent']}},{'name':_0x28a6('0x31'),'field':_0x28a6('0xd'),'foreignKey':_0x28a6('0x2e'),'model':_0x28a6('0x2f'),'filter':{'field':'role','value':[_0x28a6('0x32')]}},{'name':'VoiceQueues','field':_0x28a6('0xd'),'foreignKey':'queue','model':_0x28a6('0x33'),'filter':{'field':_0x28a6('0x34'),'value':['inbound']}},{'name':_0x28a6('0x35'),'field':'name','foreignKey':_0x28a6('0x36'),'model':'VoiceQueue','filter':{'field':_0x28a6('0x34'),'value':[_0x28a6('0x37')]}}];break;case _0x28a6('0x38'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x39');break;case _0x28a6('0x3a'):_0x5c4bc1['childModel']=_0x28a6('0x3b');break;case'voiceprefixes':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3c');break;case _0x28a6('0x3d'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3e');break;case'mailqueues':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x3f');break;case _0x28a6('0x40'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x41');break;case _0x28a6('0x42'):_0x5c4bc1['childModel']=_0x28a6('0x43');break;case _0x28a6('0x44'):_0x5c4bc1['childModel']=_0x28a6('0x45');break;case'openchannelaccounts':_0x5c4bc1['childModel']=_0x28a6('0x46');break;case _0x28a6('0x47'):_0x5c4bc1[_0x28a6('0x14')]='SmsQueue';break;case _0x28a6('0x48'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x49');break;case _0x28a6('0x4a'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x4b');break;case _0x28a6('0x4c'):_0x5c4bc1[_0x28a6('0x14')]='WhatsappAccount';break;case'teams':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x4d');break;case _0x28a6('0x4e'):case _0x28a6('0x4f'):_0x5c4bc1['childModel']=_0x28a6('0x33');if(_0x33efac){_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x50')},{'name':_0x28a6('0x35')}];}break;case _0x28a6('0x51'):case _0x28a6('0x52'):case'telephones':_0x5c4bc1[_0x28a6('0x14')]='User';if(_0x33efac){_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x53'),'filter':{'field':_0x28a6('0x30'),'value':[_0x28a6('0x54'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0x28a6('0x31')}];}break;case'zendeskaccounts':_0x5c4bc1['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x55');break;case _0x28a6('0x56'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x57');break;case'sugarcrmaccounts':_0x5c4bc1[_0x28a6('0x14')]='SugarcrmAccount';break;case _0x28a6('0x58'):_0x5c4bc1['childModel']=_0x28a6('0x59');break;case _0x28a6('0x5a'):_0x5c4bc1[_0x28a6('0x14')]='ZohoAccount';break;case _0x28a6('0x5b'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x2f');break;case _0x28a6('0x5c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x5d');break;case _0x28a6('0x5e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x5f');break;case _0x28a6('0x60'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x61');break;case _0x28a6('0x62'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x63');break;case _0x28a6('0x64'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x65');break;case _0x28a6('0x66'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x67');break;case _0x28a6('0x68'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x69');break;case _0x28a6('0x6a'):_0x5c4bc1['childModel']=_0x28a6('0x6b');break;case _0x28a6('0x6c'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x6d');break;case'triggers':_0x5c4bc1['childModel']='Trigger';break;case _0x28a6('0x6e'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x6f');break;case _0x28a6('0x70'):_0x5c4bc1['childModel']='Variable';break;case _0x28a6('0x71'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x72');break;case _0x28a6('0x73'):_0x5c4bc1[_0x28a6('0x14')]=_0x28a6('0x10');_0x5c4bc1[_0x28a6('0x18')]=[{'name':_0x28a6('0x74'),'field':'id','foreignKey':_0x28a6('0x75')}];break;case'metrics':_0x5c4bc1[_0x28a6('0x14')]='AnalyticMetric';break;}return _0x5c4bc1;}function _0xb3ce00(_0x35e1e9,_0x2d84ab){var _0x3405c5=_0x35e1e9[_0x28a6('0x76')](0x0)['toUpperCase']()+_0x35e1e9['slice'](0x1);var _0x48f300={'type':_0x50adad['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x5cc720,_0x3da05f){var _0x1b5e24=squel[_0x28a6('0x77')]()[_0x28a6('0x5')](_0x28a6('0x78')+_0x3405c5+_0x28a6('0x79'),'id')[_0x28a6('0x5')](_0x28a6('0x7a'))['from']('user_has_'+_0x35e1e9+_0x28a6('0x7b'),'ui')[_0x28a6('0x7c')](_0x28a6('0x7d'),_0x2d84ab['id']);return _0x50adad['sequelize']['query'](_0x1b5e24['toString'](),_0x48f300)[_0x28a6('0xb')](function(_0x2254eb){_0x2d84ab[_0x3405c5+_0x28a6('0x7e')]=_0x2254eb;_0x5cc720(_0x2254eb);})[_0x28a6('0x9')](function(_0x5c9bdc){_0x3da05f(_0x5c9bdc);});});}return _0x1d915c[_0x28a6('0x7f')](_0x28a6('0x80'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c2243){var _0x31a138=require('../../components/parsers/qs');var _0x59ef6b={'raw':_0x1c2243[_0x28a6('0x81')]['raw'],'where':{}};var _0x4a9b40={};var _0x3661fa={'count':0x0,'rows':[]};var _0x2f88cb=_0x1c2243[_0x28a6('0x81')][_0x28a6('0x82')];var _0x4be869=_0x1c2243[_0x28a6('0x81')][_0x28a6('0x83')]||![];var _0x2239c6=_0x15cb95(_0x2f88cb,_0x4be869);if(!_0x2239c6[_0x28a6('0x14')])throw new Error(_0x28a6('0x84')+_0x2f88cb+'\x27');var _0x314501=[{'name':_0x2f88cb}];if(!_['isEmpty'](_0x2239c6[_0x28a6('0x18')]))_0x314501=_0x2239c6['parentSections'];var _0x3e39c5=[];for(var _0xb56b90=0x0;_0xb56b90<_0x314501['length'];_0xb56b90++){_0x3e39c5[_0x28a6('0x85')](_0x50adad[_0x28a6('0x86')][_0x28a6('0x87')]({'where':{'userProfileId':_0x1c2243[_0x28a6('0x88')]['id'],'name':_0x314501[_0xb56b90][_0x28a6('0xd')]},'raw':!![]}));}return Promise[_0x28a6('0x89')](_0x3e39c5)['then'](function(_0x26078e){var _0x528277=_['filter'](_0x26078e,function(_0x57561c){return _0x57561c?_0x57561c:undefined;});var _0x1282ed=_['filter'](_0x314501,['ignore',!![]]);var _0x3788be=_[_0x28a6('0x8a')](_0x528277)&&_['isEmpty'](_0x1282ed)?null:_[_0x28a6('0x8b')](_0x1282ed,_0x528277);if(!_0x3788be)return null;var _0x5347ed=[];for(var _0x13eeb7=0x0;_0x13eeb7<_0x3788be[_0x28a6('0x8c')];_0x13eeb7++){var _0x3aaa92=_['find'](_0x314501,function(_0x183fa8){return _0x3788be[_0x13eeb7]?_0x183fa8[_0x28a6('0xd')]===_0x3788be[_0x13eeb7][_0x28a6('0xd')]:null;});if(_0x3aaa92){if(_0x3788be[_0x13eeb7]['ignore']){_0x5347ed[_0x28a6('0x85')](_0x487417(_0x2239c6[_0x28a6('0x14')],_0x3788be[_0x13eeb7]));}else{if(!_0x3788be[_0x13eeb7]['autoAssociation']){_0x5347ed[_0x28a6('0x85')](_0x4c1c0a(_0x3aaa92,_0x3788be[_0x13eeb7],_0x2239c6[_0x28a6('0x14')]));}else{if(_0x3aaa92[_0x28a6('0xa')]){_0x5347ed[_0x28a6('0x85')](_0x3b5b3d(_0x3aaa92,_0x3788be[_0x13eeb7]));}}}}}return Promise[_0x28a6('0x89')](_0x5347ed);})[_0x28a6('0xb')](function(_0x23378f){var _0x326efb=_0x23378f;var _0x338e26=null;if(_0x326efb){_0x338e26=_0x326efb[_0x28a6('0x8c')]===0x1?_0x326efb[0x0]:null;}if(!_0x338e26&&!_0x326efb)return _0x3661fa;var _0x314dab=_0x50adad[_0x2239c6['childModel']][_0x28a6('0x8d')];_0x4a9b40[_0x28a6('0xa')]=_[_0x28a6('0x8e')](_0x314dab);_0x4a9b40[_0x28a6('0x81')]=_[_0x28a6('0x8e')](_0x1c2243[_0x28a6('0x81')]);_0x4a9b40[_0x28a6('0x8f')]=_['intersection'](_0x4a9b40[_0x28a6('0xa')],_0x4a9b40['query']);_0x59ef6b['attributes']=_[_0x28a6('0x90')](_0x4a9b40['model'],_0x31a138[_0x28a6('0x91')](_0x1c2243[_0x28a6('0x81')]['fields']));_0x59ef6b[_0x28a6('0x92')]=_0x59ef6b[_0x28a6('0x92')][_0x28a6('0x8c')]?_0x59ef6b[_0x28a6('0x92')]:_0x4a9b40[_0x28a6('0xa')];if(!_0x1c2243[_0x28a6('0x81')]['hasOwnProperty']('nolimit')){_0x59ef6b['limit']=_0x31a138[_0x28a6('0x93')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x93')]);_0x59ef6b['offset']=_0x31a138['offset'](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x94')]);}_0x59ef6b[_0x28a6('0x95')]=_0x31a138[_0x28a6('0x96')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0x96')]);_0x59ef6b[_0x28a6('0x7c')]=_0x31a138[_0x28a6('0x8f')](_[_0x28a6('0x97')](_0x1c2243[_0x28a6('0x81')],_0x4a9b40[_0x28a6('0x8f')]));if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0x4')]){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$or':_[_0x28a6('0x8')](_0x314dab,function(_0x368aa6){if(_0x368aa6[_0x28a6('0x34')]['key']!==_0x28a6('0x99')){var _0x3427bb={};_0x3427bb[_0x368aa6[_0x28a6('0x5')]]={'$like':'%'+_0x1c2243[_0x28a6('0x81')][_0x28a6('0x4')]+'%'};return _0x3427bb;}})});}var _0x53b503=[];var _0x2bfc35=null;var _0xfe5390={};if(_0x338e26){_0x2bfc35=_[_0x28a6('0x87')](_0x314501,[_0x28a6('0xd'),_0x338e26[_0x28a6('0xd')]]);if(_0x2bfc35[_0x28a6('0x5')]){_0xfe5390={};if(_0x2239c6[_0x28a6('0x14')]===_0x28a6('0x10')){_0xfe5390[_0x2bfc35['foreignKey']]=_[_0x28a6('0x8')](_0x338e26[_0x28a6('0xc')],'id');}else{_0xfe5390[_0x2bfc35[_0x28a6('0x9a')]]=_0x338e26[_0x28a6('0xc')];}_0x53b503[_0x28a6('0x85')](_0xfe5390);}else{_0x59ef6b[_0x28a6('0x7c')]['id']=_0x338e26['associatedResources'];}}else{for(var _0x3b2e6e=0x0;_0x3b2e6e<_0x326efb[_0x28a6('0x8c')];_0x3b2e6e++){_0x2bfc35=_[_0x28a6('0x87')](_0x314501,[_0x28a6('0xd'),_0x326efb[_0x3b2e6e][_0x28a6('0xd')]]);if(_0x2bfc35[_0x28a6('0x5')]){_0xfe5390={};_0xfe5390[_0x2bfc35[_0x28a6('0x9a')]]=_0x326efb[_0x3b2e6e][_0x28a6('0xc')];_0x53b503['push'](_0xfe5390);}else{if(!_0x59ef6b['where']['id'])_0x59ef6b[_0x28a6('0x7c')]['id']=[];_0x326efb[_0x3b2e6e]['associatedResources'][_0x28a6('0x9b')](function(_0xcb0921){_0x59ef6b['where']['id']['push'](_0xcb0921);});}}}if(!_[_0x28a6('0x8a')](_0x53b503)){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$and':{'$or':_0x53b503}});}_0x59ef6b=_[_0x28a6('0x98')]({},_0x59ef6b,_0x1c2243[_0x28a6('0x9c')]);if(_0x338e26&&!_0x338e26[_0x28a6('0x9d')]&&_0x2239c6['childModel']==='AnalyticExtractedReport'){if(_0x1c2243['query'][_0x28a6('0x9e')]){_0x59ef6b[_0x28a6('0x9f')]=[{'all':!![]}];}return _0x50adad[_0x2239c6[_0x28a6('0x14')]][_0x28a6('0x7')](_0x59ef6b)[_0x28a6('0xb')](function(_0xebe998){var _0x2a0e22=[];_0xebe998[_0x28a6('0x9b')](function(_0x26aa53){var _0x1cd5ac;switch(_0x26aa53['reportType']){case'default':_0x1cd5ac=_['find'](_0x338e26[_0x28a6('0xc')],function(_0x314133){return _0x314133['id']===_0x26aa53[_0x28a6('0x75')]&&_0x314133[_0x28a6('0x34')]===_0x28a6('0xa0');});break;case _0x28a6('0xa1'):_0x1cd5ac=_[_0x28a6('0x87')](_0x338e26[_0x28a6('0xc')],function(_0x54b6d6){return _0x54b6d6['id']===_0x26aa53[_0x28a6('0x75')]&&_0x54b6d6[_0x28a6('0x34')]===_0x28a6('0xa2');});break;}if(_0x1cd5ac)_0x2a0e22['push'](_0x26aa53);});_0x3661fa[_0x28a6('0xa3')]=_0x2a0e22['length'];_0x3661fa[_0x28a6('0xa4')]=_0x2a0e22;return _0x3661fa;});}else{if(!_[_0x28a6('0x8a')](_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa5')])){_0x59ef6b[_0x28a6('0x7c')]['id']=_0x59ef6b['where']['id']?_[_0x28a6('0x90')](_0x59ef6b['where']['id'],_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa5')]):_0x1c2243['query']['ids'];if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa6')]){_0x59ef6b[_0x28a6('0x95')]=_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa6')];}}if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa7')]){_0x59ef6b[_0x28a6('0x7c')]=_[_0x28a6('0x98')](_0x59ef6b[_0x28a6('0x7c')],{'$and':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa7')]});}return _0x50adad[_0x2239c6[_0x28a6('0x14')]][_0x28a6('0xa3')]({'where':_0x59ef6b[_0x28a6('0x7c')]})[_0x28a6('0xb')](function(_0x294f0a){_0x3661fa[_0x28a6('0xa3')]=_0x294f0a;if(_0x1c2243[_0x28a6('0x81')][_0x28a6('0x9e')]){if(_0x2239c6['childModel']==='CmContact'){_0x59ef6b['include']=[{'model':_0x50adad[_0x28a6('0x6b')],'as':'Tags','attributes':['id',_0x28a6('0xd'),_0x28a6('0xa8')],'required':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]?!![]:![]},{'model':_0x50adad[_0x28a6('0x6b')],'as':_0x28a6('0xaa'),'attributes':['id',_0x28a6('0xd'),_0x28a6('0xa8')],'through':_0x1c2243['query'][_0x28a6('0xa9')]?{'attributes':[],'where':{'TagId':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]||undefined}}:{},'required':_0x1c2243[_0x28a6('0x81')][_0x28a6('0xa9')]?!![]:![]}];}else{_0x59ef6b[_0x28a6('0x9f')]=[{'all':!![]}];}}return _0x50adad[_0x2239c6['childModel']]['findAll'](_0x59ef6b);})[_0x28a6('0xb')](function(_0x1a74b2){_0x3661fa[_0x28a6('0xa4')]=_0x1a74b2;if(_0x2f88cb===_0x28a6('0xab')&&_0x1c2243[_0x28a6('0x81')][_0x28a6('0xac')]==='true'){var _0x254ea5=[];for(var _0x233247=0x0;_0x233247<_0x3661fa[_0x28a6('0xa4')][_0x28a6('0x8c')];_0x233247++){_0x254ea5['push'](_0xb3ce00(_0x28a6('0xad'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00(_0x28a6('0xaf'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00('fax',_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00('mail',_0x3661fa['rows'][_0x233247][_0x28a6('0xae')]));_0x254ea5[_0x28a6('0x85')](_0xb3ce00(_0x28a6('0xb0'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));_0x254ea5['push'](_0xb3ce00(_0x28a6('0xb1'),_0x3661fa[_0x28a6('0xa4')][_0x233247][_0x28a6('0xae')]));}return Promise[_0x28a6('0x89')](_0x254ea5)[_0x28a6('0xb')](function(){return _0x3661fa;});}return _0x3661fa;});}});}}});}; \ No newline at end of file +var _0xb62b=['customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.createdAt','user_has_','_interactions','where','sequelize','query','toString','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','ignore','autoAssociation','all','length','rawAttributes','keys','filters','attributes','intersection','fields','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','includeAll','include','forEach','reportType','default','DefaultReports','custom','reportId','CustomReports','rows','ids','customSorting','extraQueryConditions','count','color','tag','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','lodash','exports','filter','field','value','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','findAll','AnalyticExtractedReport','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','globalcustomfields','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','Telephones','telephone','VoiceQueues','VoiceQueue','type','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','mailqueues','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','telephones','Users','admin','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xb62b,0x115));var _0xbb62=function(_0xf0d3b7,_0x4bd02d){_0xf0d3b7=_0xf0d3b7-0x0;var _0x30ec7a=_0xb62b[_0xf0d3b7];return _0x30ec7a;};'use strict';var _=require(_0xbb62('0x0'));var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0xbb62('0x1')]=function(_0x30887c){var _0x32626b=_0x30887c['models'];function _0x160e3e(_0x367a55,_0x4215c1){return new Promise(function(_0x3a4e26,_0x1ee2ff){if(!_0x4215c1)return _0x3a4e26(null);var _0x5bb5c1=_0x4215c1['filter']?{[_0x4215c1[_0xbb62('0x2')][_0xbb62('0x3')]]:_0x4215c1['filter'][_0xbb62('0x4')]}:undefined;return _0x32626b[_0x367a55]['findAll']({'where':_0x5bb5c1,'raw':!![]})[_0xbb62('0x5')](function(_0x210207){_0x4215c1[_0xbb62('0x6')]=_[_0xbb62('0x7')](_0x210207,'id');_0x3a4e26(_0x4215c1);})[_0xbb62('0x8')](function(_0x21b73c){_0x1ee2ff(_0x21b73c);});});}function _0x594de7(_0x13602c,_0x23c5d4){return new Promise(function(_0xc62993,_0x12a5b7){var _0x3c3ea1=_0x13602c['filter']?{[_0x13602c[_0xbb62('0x2')][_0xbb62('0x3')]]:_0x13602c['filter']['value']}:undefined;return _0x32626b[_0x13602c[_0xbb62('0x9')]]['findAll']({'where':_0x3c3ea1,'raw':!![]})['then'](function(_0x3a633f){_0x23c5d4[_0xbb62('0x6')]=_[_0xbb62('0x7')](_0x3a633f,function(_0x2f5df7){return _0x2f5df7[_0xbb62('0xa')];});_0xc62993(_0x23c5d4);})[_0xbb62('0x8')](function(_0x23604d){_0x12a5b7(_0x23604d);});});}function _0x512897(_0x398507,_0x60babb,_0x589497){if(!_0x60babb)return Promise[_0xbb62('0xb')](null);return new Promise(function(_0x47b634,_0x721d0d){return _0x32626b[_0xbb62('0xc')][_0xbb62('0xd')]({'where':{'sectionId':_0x60babb['id']},'raw':!![]})[_0xbb62('0x5')](function(_0x1e813d){if(_0x398507['field']&&_0x398507[_0xbb62('0x3')]!=='id'){_0x60babb[_0xbb62('0x6')]=_[_0xbb62('0x7')](_0x1e813d,function(_0x4f5a14){return _0x4f5a14[_0x398507[_0xbb62('0x3')]];});}else{if(_0x589497===_0xbb62('0xe')){_0x60babb[_0xbb62('0x6')]=_['map'](_0x1e813d,function(_0x202eec){return{'id':_0x202eec['resourceId'],'type':_0x202eec['type']};});}else{_0x60babb[_0xbb62('0x6')]=_[_0xbb62('0x7')](_0x1e813d,function(_0x16a24b){return _0x16a24b['resourceId'];});}}_0x47b634(_0x60babb);})[_0xbb62('0x8')](function(_0x2b9cf3){_0x721d0d(_0x2b9cf3);});});}function _0x318c02(_0x1f81f6,_0x778223){var _0x5e832e={'parentSections':[]};switch(_0x1f81f6[_0xbb62('0xf')]()){case _0xbb62('0x10'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x12');break;case _0xbb62('0x13'):_0x5e832e[_0xbb62('0x11')]='SquareOdbc';break;case _0xbb62('0x14'):_0x5e832e['childModel']=_0xbb62('0x15');_0x5e832e['parentSections']=[{'name':_0xbb62('0x16'),'field':_0xbb62('0xa'),'foreignKey':_0xbb62('0x17')}];break;case _0xbb62('0x18'):_0x5e832e[_0xbb62('0x11')]='JscriptyProject';break;case _0xbb62('0x19'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x1a');_0x5e832e[_0xbb62('0x1b')]=[{'name':_0xbb62('0x1c'),'field':'id','foreignKey':_0xbb62('0x1d')}];break;case _0xbb62('0x1e'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x1f');break;case _0xbb62('0x20'):_0x5e832e['childModel']='CmCompany';break;case _0xbb62('0x21'):_0x5e832e['childModel']='CmCustomField';break;case'chatqueues':_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x22');break;case _0xbb62('0x23'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x24');break;case _0xbb62('0x25'):_0x5e832e['childModel']=_0xbb62('0x26');break;case _0xbb62('0x27'):_0x5e832e[_0xbb62('0x11')]='FaxAccount';break;case'inboundroutes':case _0xbb62('0x28'):case _0xbb62('0x29'):_0x5e832e['childModel']='VoiceExtension';break;case _0xbb62('0x2a'):_0x5e832e['childModel']=_0xbb62('0x2b');break;case _0xbb62('0x2c'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x2d');break;case _0xbb62('0x2e'):_0x5e832e['childModel']=_0xbb62('0x2f');_0x5e832e['parentSections']=[{'name':'Agents','field':_0xbb62('0xa'),'foreignKey':_0xbb62('0x30'),'model':_0xbb62('0x31'),'filter':{'field':_0xbb62('0x32'),'value':['agent']}},{'name':_0xbb62('0x33'),'field':_0xbb62('0xa'),'foreignKey':_0xbb62('0x30'),'model':'User','filter':{'field':_0xbb62('0x32'),'value':[_0xbb62('0x34')]}},{'name':_0xbb62('0x35'),'field':_0xbb62('0xa'),'foreignKey':'queue','model':_0xbb62('0x36'),'filter':{'field':_0xbb62('0x37'),'value':[_0xbb62('0x38')]}},{'name':_0xbb62('0x39'),'field':_0xbb62('0xa'),'foreignKey':_0xbb62('0x3a'),'model':'VoiceQueue','filter':{'field':'type','value':[_0xbb62('0x3b')]}}];break;case _0xbb62('0x3c'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x3d');break;case _0xbb62('0x3e'):_0x5e832e['childModel']=_0xbb62('0x3f');break;case _0xbb62('0x40'):_0x5e832e[_0xbb62('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x5e832e[_0xbb62('0x11')]='Campaign';break;case _0xbb62('0x41'):_0x5e832e[_0xbb62('0x11')]='MailQueue';break;case'mailaccounts':_0x5e832e[_0xbb62('0x11')]='MailAccount';break;case _0xbb62('0x42'):_0x5e832e['childModel']=_0xbb62('0x43');break;case _0xbb62('0x44'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x45');break;case _0xbb62('0x46'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x47');break;case _0xbb62('0x48'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x49');break;case'smsaccounts':_0x5e832e[_0xbb62('0x11')]='SmsAccount';break;case _0xbb62('0x4a'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x4b');break;case _0xbb62('0x4c'):_0x5e832e['childModel']=_0xbb62('0x4d');break;case _0xbb62('0x4e'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x4f');break;case _0xbb62('0x50'):case'queuecampaigns':_0x5e832e[_0xbb62('0x11')]='VoiceQueue';if(_0x778223){_0x5e832e[_0xbb62('0x1b')]=[{'name':_0xbb62('0x35')},{'name':_0xbb62('0x39')}];}break;case _0xbb62('0x51'):case _0xbb62('0x52'):case _0xbb62('0x53'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x31');if(_0x778223){_0x5e832e[_0xbb62('0x1b')]=[{'name':_0xbb62('0x54'),'filter':{'field':_0xbb62('0x32'),'value':[_0xbb62('0x55'),'user']},'ignore':!![]},{'name':_0xbb62('0x56')},{'name':_0xbb62('0x33')}];}break;case _0xbb62('0x57'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x58');break;case _0xbb62('0x59'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x5a');break;case'freshdeskaccounts':_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x5b');break;case _0xbb62('0x5c'):_0x5e832e[_0xbb62('0x11')]='SugarcrmAccount';break;case'deskaccounts':_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x5d');break;case _0xbb62('0x5e'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x5f');break;case _0xbb62('0x60'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x31');break;case _0xbb62('0x61'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x62');break;case _0xbb62('0x63'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x64');break;case _0xbb62('0x65'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x66');break;case _0xbb62('0x67'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x68');break;case _0xbb62('0x69'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x6a');break;case _0xbb62('0x6b'):_0x5e832e['childModel']='Schedule';break;case _0xbb62('0x6c'):_0x5e832e['childModel']=_0xbb62('0x6d');break;case'tags':_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x6e');break;case'templates':_0x5e832e['childModel']=_0xbb62('0x6f');break;case _0xbb62('0x70'):_0x5e832e['childModel']=_0xbb62('0x71');break;case _0xbb62('0x72'):_0x5e832e[_0xbb62('0x11')]=_0xbb62('0x73');break;case'variables':_0x5e832e['childModel']=_0xbb62('0x74');break;case _0xbb62('0x75'):_0x5e832e['childModel']=_0xbb62('0x76');break;case _0xbb62('0x77'):_0x5e832e[_0xbb62('0x11')]='AnalyticExtractedReport';_0x5e832e['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xbb62('0x78'):_0x5e832e['childModel']=_0xbb62('0x79');break;}return _0x5e832e;}function _0x9356b2(_0x148c4d,_0xf17371){var _0x155a4d=_0x148c4d[_0xbb62('0x7a')](0x0)[_0xbb62('0x7b')]()+_0x148c4d[_0xbb62('0x7c')](0x1);var _0x5e1234={'type':_0x32626b[_0xbb62('0x7d')][_0xbb62('0x7e')][_0xbb62('0x7f')],'raw':!![]};return new Promise(function(_0xd4f47f,_0x2351e5){var _0x3e156c=squel[_0xbb62('0x80')]()['field']('ui.'+_0x155a4d+'InteractionId','id')[_0xbb62('0x3')](_0xbb62('0x81'))['from'](_0xbb62('0x82')+_0x148c4d+_0xbb62('0x83'),'ui')[_0xbb62('0x84')]('ui.UserId\x20=\x20?',_0xf17371['id']);return _0x32626b[_0xbb62('0x85')][_0xbb62('0x86')](_0x3e156c[_0xbb62('0x87')](),_0x5e1234)[_0xbb62('0x5')](function(_0x112224){_0xf17371[_0x155a4d+'OpenTabs']=_0x112224;_0xd4f47f(_0x112224);})[_0xbb62('0x8')](function(_0x37c25d){_0x2351e5(_0x37c25d);});});}return _0x30887c['define'](_0xbb62('0x88'),attributes,{'tableName':_0xbb62('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5b4226){var _0x3b0d21=require('../../components/parsers/qs');var _0x48dde7={'raw':_0x5b4226[_0xbb62('0x86')][_0xbb62('0x8a')],'where':{}};var _0x359dc7={};var _0x6ca715={'count':0x0,'rows':[]};var _0x509e4c=_0x5b4226[_0xbb62('0x86')][_0xbb62('0x8b')];var _0x135a38=_0x5b4226[_0xbb62('0x86')][_0xbb62('0x8c')]||![];var _0x1d95b5=_0x318c02(_0x509e4c,_0x135a38);if(!_0x1d95b5[_0xbb62('0x11')])throw new Error(_0xbb62('0x8d')+_0x509e4c+'\x27');var _0x1af432=[{'name':_0x509e4c}];if(!_[_0xbb62('0x8e')](_0x1d95b5[_0xbb62('0x1b')]))_0x1af432=_0x1d95b5['parentSections'];var _0x3469d1=[];for(var _0xb3aa09=0x0;_0xb3aa09<_0x1af432['length'];_0xb3aa09++){_0x3469d1[_0xbb62('0x8f')](_0x32626b[_0xbb62('0x90')][_0xbb62('0x91')]({'where':{'userProfileId':_0x5b4226[_0xbb62('0x92')]['id'],'name':_0x1af432[_0xb3aa09]['name']},'raw':!![]}));}return Promise['all'](_0x3469d1)[_0xbb62('0x5')](function(_0x356604){var _0x4f7d35=_['filter'](_0x356604,function(_0x38a804){return _0x38a804?_0x38a804:undefined;});var _0x158435=_['filter'](_0x1af432,[_0xbb62('0x93'),!![]]);var _0x4cc6fc=_[_0xbb62('0x8e')](_0x4f7d35)&&_['isEmpty'](_0x158435)?null:_['union'](_0x158435,_0x4f7d35);if(!_0x4cc6fc)return null;var _0x1937dd=[];for(var _0x321365=0x0;_0x321365<_0x4cc6fc['length'];_0x321365++){var _0x4914ba=_[_0xbb62('0x91')](_0x1af432,function(_0x2aecad){return _0x4cc6fc[_0x321365]?_0x2aecad[_0xbb62('0xa')]===_0x4cc6fc[_0x321365][_0xbb62('0xa')]:null;});if(_0x4914ba){if(_0x4cc6fc[_0x321365]['ignore']){_0x1937dd[_0xbb62('0x8f')](_0x160e3e(_0x1d95b5[_0xbb62('0x11')],_0x4cc6fc[_0x321365]));}else{if(!_0x4cc6fc[_0x321365][_0xbb62('0x94')]){_0x1937dd[_0xbb62('0x8f')](_0x512897(_0x4914ba,_0x4cc6fc[_0x321365],_0x1d95b5[_0xbb62('0x11')]));}else{if(_0x4914ba[_0xbb62('0x9')]){_0x1937dd['push'](_0x594de7(_0x4914ba,_0x4cc6fc[_0x321365]));}}}}}return Promise[_0xbb62('0x95')](_0x1937dd);})[_0xbb62('0x5')](function(_0xb8d04c){var _0x5548c7=_0xb8d04c;var _0x218b19=null;if(_0x5548c7){_0x218b19=_0x5548c7[_0xbb62('0x96')]===0x1?_0x5548c7[0x0]:null;}if(!_0x218b19&&!_0x5548c7)return _0x6ca715;var _0x10c1f0=_0x32626b[_0x1d95b5[_0xbb62('0x11')]][_0xbb62('0x97')];_0x359dc7[_0xbb62('0x9')]=_['keys'](_0x10c1f0);_0x359dc7[_0xbb62('0x86')]=_[_0xbb62('0x98')](_0x5b4226[_0xbb62('0x86')]);_0x359dc7[_0xbb62('0x99')]=_['intersection'](_0x359dc7[_0xbb62('0x9')],_0x359dc7[_0xbb62('0x86')]);_0x48dde7[_0xbb62('0x9a')]=_[_0xbb62('0x9b')](_0x359dc7['model'],_0x3b0d21[_0xbb62('0x9c')](_0x5b4226[_0xbb62('0x86')][_0xbb62('0x9c')]));_0x48dde7[_0xbb62('0x9a')]=_0x48dde7['attributes'][_0xbb62('0x96')]?_0x48dde7['attributes']:_0x359dc7[_0xbb62('0x9')];if(!_0x5b4226['query']['hasOwnProperty']('nolimit')){_0x48dde7[_0xbb62('0x9d')]=_0x3b0d21[_0xbb62('0x9d')](_0x5b4226[_0xbb62('0x86')][_0xbb62('0x9d')]);_0x48dde7['offset']=_0x3b0d21[_0xbb62('0x9e')](_0x5b4226[_0xbb62('0x86')]['offset']);}_0x48dde7[_0xbb62('0x9f')]=_0x3b0d21[_0xbb62('0xa0')](_0x5b4226[_0xbb62('0x86')][_0xbb62('0xa0')]);_0x48dde7[_0xbb62('0x84')]=_0x3b0d21[_0xbb62('0x99')](_[_0xbb62('0xa1')](_0x5b4226['query'],_0x359dc7['filters']));if(_0x5b4226['query'][_0xbb62('0x2')]){_0x48dde7[_0xbb62('0x84')]=_[_0xbb62('0xa2')](_0x48dde7[_0xbb62('0x84')],{'$or':_['map'](_0x10c1f0,function(_0x182670){if(_0x182670['type'][_0xbb62('0xa3')]!==_0xbb62('0xa4')){var _0xe41f7c={};_0xe41f7c[_0x182670[_0xbb62('0x3')]]={'$like':'%'+_0x5b4226[_0xbb62('0x86')][_0xbb62('0x2')]+'%'};return _0xe41f7c;}})});}var _0x46b2a5=[];var _0x1e3d95=null;var _0x9d19ae={};if(_0x218b19){_0x1e3d95=_[_0xbb62('0x91')](_0x1af432,[_0xbb62('0xa'),_0x218b19[_0xbb62('0xa')]]);if(_0x1e3d95['field']){_0x9d19ae={};if(_0x1d95b5[_0xbb62('0x11')]===_0xbb62('0xe')){_0x9d19ae[_0x1e3d95[_0xbb62('0xa5')]]=_[_0xbb62('0x7')](_0x218b19[_0xbb62('0x6')],'id');}else{_0x9d19ae[_0x1e3d95['foreignKey']]=_0x218b19[_0xbb62('0x6')];}_0x46b2a5[_0xbb62('0x8f')](_0x9d19ae);}else{_0x48dde7['where']['id']=_0x218b19[_0xbb62('0x6')];}}else{for(var _0x3b11cd=0x0;_0x3b11cd<_0x5548c7[_0xbb62('0x96')];_0x3b11cd++){_0x1e3d95=_[_0xbb62('0x91')](_0x1af432,[_0xbb62('0xa'),_0x5548c7[_0x3b11cd][_0xbb62('0xa')]]);if(_0x1e3d95[_0xbb62('0x3')]){_0x9d19ae={};_0x9d19ae[_0x1e3d95[_0xbb62('0xa5')]]=_0x5548c7[_0x3b11cd]['associatedResources'];_0x46b2a5[_0xbb62('0x8f')](_0x9d19ae);}else{if(!_0x48dde7[_0xbb62('0x84')]['id'])_0x48dde7[_0xbb62('0x84')]['id']=[];_0x5548c7[_0x3b11cd][_0xbb62('0x6')]['forEach'](function(_0x41b3ac){_0x48dde7[_0xbb62('0x84')]['id'][_0xbb62('0x8f')](_0x41b3ac);});}}}if(!_[_0xbb62('0x8e')](_0x46b2a5)){_0x48dde7[_0xbb62('0x84')]=_[_0xbb62('0xa2')](_0x48dde7[_0xbb62('0x84')],{'$and':{'$or':_0x46b2a5}});}_0x48dde7=_[_0xbb62('0xa2')]({},_0x48dde7,_0x5b4226['options']);if(_0x218b19&&!_0x218b19[_0xbb62('0x94')]&&_0x1d95b5[_0xbb62('0x11')]===_0xbb62('0xe')){if(_0x5b4226[_0xbb62('0x86')][_0xbb62('0xa6')]){_0x48dde7[_0xbb62('0xa7')]=[{'all':!![]}];}return _0x32626b[_0x1d95b5['childModel']]['findAll'](_0x48dde7)[_0xbb62('0x5')](function(_0x3cdd2f){var _0x5b844e=[];_0x3cdd2f[_0xbb62('0xa8')](function(_0x1ed84f){var _0x44388c;switch(_0x1ed84f[_0xbb62('0xa9')]){case _0xbb62('0xaa'):_0x44388c=_['find'](_0x218b19[_0xbb62('0x6')],function(_0x5a0449){return _0x5a0449['id']===_0x1ed84f['reportId']&&_0x5a0449['type']===_0xbb62('0xab');});break;case _0xbb62('0xac'):_0x44388c=_[_0xbb62('0x91')](_0x218b19['associatedResources'],function(_0x1ff333){return _0x1ff333['id']===_0x1ed84f[_0xbb62('0xad')]&&_0x1ff333[_0xbb62('0x37')]===_0xbb62('0xae');});break;}if(_0x44388c)_0x5b844e[_0xbb62('0x8f')](_0x1ed84f);});_0x6ca715['count']=_0x5b844e['length'];_0x6ca715[_0xbb62('0xaf')]=_0x5b844e;return _0x6ca715;});}else{if(!_['isEmpty'](_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb0')])){_0x48dde7[_0xbb62('0x84')]['id']=_0x48dde7[_0xbb62('0x84')]['id']?_[_0xbb62('0x9b')](_0x48dde7[_0xbb62('0x84')]['id'],_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb0')]):_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb0')];if(_0x5b4226['query'][_0xbb62('0xb1')]){_0x48dde7['order']=_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb1')];}}if(_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb2')]){_0x48dde7['where']=_['merge'](_0x48dde7[_0xbb62('0x84')],{'$and':_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb2')]});}return _0x32626b[_0x1d95b5[_0xbb62('0x11')]][_0xbb62('0xb3')]({'where':_0x48dde7[_0xbb62('0x84')]})[_0xbb62('0x5')](function(_0x63050c){_0x6ca715[_0xbb62('0xb3')]=_0x63050c;if(_0x5b4226[_0xbb62('0x86')][_0xbb62('0xa6')]){if(_0x1d95b5[_0xbb62('0x11')]===_0xbb62('0x1a')){_0x48dde7[_0xbb62('0xa7')]=[{'model':_0x32626b['Tag'],'as':'Tags','attributes':['id',_0xbb62('0xa'),_0xbb62('0xb4')],'required':_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb5')]?!![]:![]},{'model':_0x32626b[_0xbb62('0x6e')],'as':'ThroughTags','attributes':['id',_0xbb62('0xa'),_0xbb62('0xb4')],'through':_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb5')]?{'attributes':[],'where':{'TagId':_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb5')]||undefined}}:{},'required':_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb5')]?!![]:![]}];}else{_0x48dde7[_0xbb62('0xa7')]=[{'all':!![]}];}}return _0x32626b[_0x1d95b5[_0xbb62('0x11')]]['findAll'](_0x48dde7);})[_0xbb62('0x5')](function(_0x3bcea5){_0x6ca715[_0xbb62('0xaf')]=_0x3bcea5;if(_0x509e4c===_0xbb62('0x56')&&_0x5b4226[_0xbb62('0x86')][_0xbb62('0xb6')]===_0xbb62('0xb7')){var _0x4f3790=[];for(var _0x25a675=0x0;_0x25a675<_0x6ca715[_0xbb62('0xaf')][_0xbb62('0x96')];_0x25a675++){_0x4f3790[_0xbb62('0x8f')](_0x9356b2(_0xbb62('0xb8'),_0x6ca715[_0xbb62('0xaf')][_0x25a675]['dataValues']));_0x4f3790[_0xbb62('0x8f')](_0x9356b2('sms',_0x6ca715[_0xbb62('0xaf')][_0x25a675][_0xbb62('0xb9')]));_0x4f3790[_0xbb62('0x8f')](_0x9356b2('fax',_0x6ca715[_0xbb62('0xaf')][_0x25a675][_0xbb62('0xb9')]));_0x4f3790[_0xbb62('0x8f')](_0x9356b2(_0xbb62('0xba'),_0x6ca715[_0xbb62('0xaf')][_0x25a675][_0xbb62('0xb9')]));_0x4f3790[_0xbb62('0x8f')](_0x9356b2(_0xbb62('0xbb'),_0x6ca715[_0xbb62('0xaf')][_0x25a675]['dataValues']));_0x4f3790[_0xbb62('0x8f')](_0x9356b2(_0xbb62('0xbc'),_0x6ca715[_0xbb62('0xaf')][_0x25a675][_0xbb62('0xb9')]));}return Promise[_0xbb62('0x95')](_0x4f3790)[_0xbb62('0x5')](function(){return _0x6ca715;});}return _0x6ca715;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 52e5476..60bfa76 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 _0xa809=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util'];(function(_0x3c2166,_0x41fc16){var _0x30ccc3=function(_0x689bc3){while(--_0x689bc3){_0x3c2166['push'](_0x3c2166['shift']());}};_0x30ccc3(++_0x41fc16);}(_0xa809,0x1f3));var _0x9a80=function(_0x12f288,_0x325616){_0x12f288=_0x12f288-0x0;var _0x5e25d0=_0xa809[_0x12f288];return _0x5e25d0;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a80('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9a80('0x2'))(_0x9a80('0x3'));var config=require(_0x9a80('0x4'));var jayson=require(_0x9a80('0x5'));var client=jayson['client'][_0x9a80('0x6')]({'port':0x232a});config['redis']=_[_0x9a80('0x7')](config[_0x9a80('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a80('0x9'))(new Redis(config[_0x9a80('0x8')]));require(_0x9a80('0xa'))[_0x9a80('0xb')](socket);function respondWithRpcPromise(_0x596b93,_0x3d5aba,_0x1e0017){return new BPromise(function(_0x396fc5,_0x3277f6){return client[_0x9a80('0xc')](_0x596b93,_0x1e0017)[_0x9a80('0xd')](function(_0x1504ae){logger[_0x9a80('0xe')]('UserProfile,\x20%s,\x20%s',_0x3d5aba,_0x9a80('0xf'));logger[_0x9a80('0x10')](_0x9a80('0x11'),_0x3d5aba,_0x9a80('0xf'),JSON[_0x9a80('0x12')](_0x1504ae));if(_0x1504ae[_0x9a80('0x13')]){if(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x14')]===0x1f4){logger['error'](_0x9a80('0x15'),_0x3d5aba,_0x1504ae['error'][_0x9a80('0x16')]);return _0x3277f6(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);}logger['error'](_0x9a80('0x15'),_0x3d5aba,_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);return _0x396fc5(_0x1504ae[_0x9a80('0x13')][_0x9a80('0x16')]);}else{logger['info'](_0x9a80('0x15'),_0x3d5aba,'request\x20sent');_0x396fc5(_0x1504ae[_0x9a80('0x17')][_0x9a80('0x16')]);}})[_0x9a80('0x18')](function(_0x3c2ae0){logger['error']('UserProfile,\x20%s,\x20%s',_0x3d5aba,_0x3c2ae0);_0x3277f6(_0x3c2ae0);});});} \ No newline at end of file +var _0x38b2=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','code','error','UserProfile,\x20%s,\x20%s'];(function(_0x50ebd7,_0x4e2450){var _0x4bacee=function(_0x5a6a50){while(--_0x5a6a50){_0x50ebd7['push'](_0x50ebd7['shift']());}};_0x4bacee(++_0x4e2450);}(_0x38b2,0xf6));var _0x238b=function(_0x2e47ef,_0x3140fd){_0x2e47ef=_0x2e47ef-0x0;var _0x4b8cd2=_0x38b2[_0x2e47ef];return _0x4b8cd2;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x238b('0x3'));var db=require(_0x238b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x238b('0x5'))('rpc');var config=require(_0x238b('0x6'));var jayson=require(_0x238b('0x7'));var client=jayson[_0x238b('0x8')][_0x238b('0x9')]({'port':0x232a});config['redis']=_[_0x238b('0xa')](config[_0x238b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x238b('0xc'))(new Redis(config[_0x238b('0xb')]));require(_0x238b('0xd'))[_0x238b('0xe')](socket);function respondWithRpcPromise(_0x19afcf,_0x17f674,_0x1b7bf4){return new BPromise(function(_0x4df7d6,_0x137ad2){return client[_0x238b('0xf')](_0x19afcf,_0x1b7bf4)[_0x238b('0x10')](function(_0x40762f){logger[_0x238b('0x11')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x238b('0x12'));logger[_0x238b('0x13')](_0x238b('0x14'),_0x17f674,_0x238b('0x12'),JSON['stringify'](_0x40762f));if(_0x40762f['error']){if(_0x40762f['error'][_0x238b('0x15')]===0x1f4){logger[_0x238b('0x16')](_0x238b('0x17'),_0x17f674,_0x40762f[_0x238b('0x16')][_0x238b('0x18')]);return _0x137ad2(_0x40762f[_0x238b('0x16')][_0x238b('0x18')]);}logger[_0x238b('0x16')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x40762f[_0x238b('0x16')]['message']);return _0x4df7d6(_0x40762f[_0x238b('0x16')]['message']);}else{logger[_0x238b('0x11')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x238b('0x12'));_0x4df7d6(_0x40762f[_0x238b('0x19')][_0x238b('0x18')]);}})[_0x238b('0x1a')](function(_0x30d14){logger[_0x238b('0x16')]('UserProfile,\x20%s,\x20%s',_0x17f674,_0x30d14);_0x137ad2(_0x30d14);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b5e5e62..170bccf 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 _0xaa11=['removeListener','register','userProfile:','./userProfile.events','save','remove','emit'];(function(_0x17c55f,_0x3e1a19){var _0xfd98fa=function(_0x3d26fb){while(--_0x3d26fb){_0x17c55f['push'](_0x17c55f['shift']());}};_0xfd98fa(++_0x3e1a19);}(_0xaa11,0xb2));var _0x1aa1=function(_0x4c7c25,_0x1e16a8){_0x4c7c25=_0x4c7c25-0x0;var _0x297619=_0xaa11[_0x4c7c25];return _0x297619;};'use strict';var UserProfileEvents=require(_0x1aa1('0x0'));var events=[_0x1aa1('0x1'),_0x1aa1('0x2'),'update'];function createListener(_0x5de2bf,_0x237aaf){return function(_0x2a4b76){_0x237aaf[_0x1aa1('0x3')](_0x5de2bf,_0x2a4b76);};}function removeListener(_0x56ccc9,_0x5282b0){return function(){UserProfileEvents[_0x1aa1('0x4')](_0x56ccc9,_0x5282b0);};}exports[_0x1aa1('0x5')]=function(_0x493ee8){for(var _0x55dfea=0x0,_0x3e45cd=events['length'];_0x55dfea<_0x3e45cd;_0x55dfea++){var _0x43ff50=events[_0x55dfea];var _0x314e1d=createListener(_0x1aa1('0x6')+_0x43ff50,_0x493ee8);UserProfileEvents['on'](_0x43ff50,_0x314e1d);}}; \ No newline at end of file +var _0x2b48=['removeListener','register','length','./userProfile.events','save','remove','update','emit'];(function(_0x46a691,_0x1a5c86){var _0x4e3499=function(_0x27d839){while(--_0x27d839){_0x46a691['push'](_0x46a691['shift']());}};_0x4e3499(++_0x1a5c86);}(_0x2b48,0x7b));var _0x82b4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2b48[_0x46e363];return _0x3fb059;};'use strict';var UserProfileEvents=require(_0x82b4('0x0'));var events=[_0x82b4('0x1'),_0x82b4('0x2'),_0x82b4('0x3')];function createListener(_0x2a2c97,_0x451f77){return function(_0x2e6e4d){_0x451f77[_0x82b4('0x4')](_0x2a2c97,_0x2e6e4d);};}function removeListener(_0x50b074,_0x11ae54){return function(){UserProfileEvents[_0x82b4('0x5')](_0x50b074,_0x11ae54);};}exports[_0x82b4('0x6')]=function(_0xf01970){for(var _0x21099e=0x0,_0x1ca371=events[_0x82b4('0x7')];_0x21099e<_0x1ca371;_0x21099e++){var _0x21bcf5=events[_0x21099e];var _0x206b3d=createListener('userProfile:'+_0x21bcf5,_0xf01970);UserProfileEvents['on'](_0x21bcf5,_0x206b3d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4d163ea..344afc7 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 _0xa3d8=['put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','show','post','create'];(function(_0x204809,_0x2fc643){var _0x3bbbf5=function(_0x3b7989){while(--_0x3b7989){_0x204809['push'](_0x204809['shift']());}};_0x3bbbf5(++_0x2fc643);}(_0xa3d8,0xa6));var _0x8a3d=function(_0x2a77d4,_0x8a7e75){_0x2a77d4=_0x2a77d4-0x0;var _0x4205e6=_0xa3d8[_0x2a77d4];return _0x4205e6;};'use strict';var multer=require(_0x8a3d('0x0'));var util=require(_0x8a3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a3d('0x2'));var router=express[_0x8a3d('0x3')]();var fs_extra=require(_0x8a3d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a3d('0x5'));var config=require(_0x8a3d('0x6'));var controller=require(_0x8a3d('0x7'));router[_0x8a3d('0x8')]('/',auth[_0x8a3d('0x9')](),controller['index']);router[_0x8a3d('0x8')](_0x8a3d('0xa'),auth[_0x8a3d('0x9')](),controller['describe']);router[_0x8a3d('0x8')]('/:id',auth[_0x8a3d('0x9')](),controller[_0x8a3d('0xb')]);router[_0x8a3d('0xc')]('/',auth[_0x8a3d('0x9')](),controller[_0x8a3d('0xd')]);router[_0x8a3d('0xe')](_0x8a3d('0xf'),auth['isAuthenticated'](),controller[_0x8a3d('0x10')]);router[_0x8a3d('0x11')](_0x8a3d('0xf'),auth[_0x8a3d('0x9')](),controller[_0x8a3d('0x12')]);module[_0x8a3d('0x13')]=router; \ No newline at end of file +var _0xba17=['get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x37df25,_0x5ba1df){var _0x7a9842=function(_0x166b41){while(--_0x166b41){_0x37df25['push'](_0x37df25['shift']());}};_0x7a9842(++_0x5ba1df);}(_0xba17,0x182));var _0x7ba1=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0xba17[_0x58bf72];return _0x5ac3aa;};'use strict';var multer=require(_0x7ba1('0x0'));var util=require(_0x7ba1('0x1'));var path=require(_0x7ba1('0x2'));var timeout=require(_0x7ba1('0x3'));var express=require(_0x7ba1('0x4'));var router=express[_0x7ba1('0x5')]();var fs_extra=require(_0x7ba1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7ba1('0x7'));var config=require(_0x7ba1('0x8'));var controller=require(_0x7ba1('0x9'));router[_0x7ba1('0xa')]('/',auth[_0x7ba1('0xb')](),controller[_0x7ba1('0xc')]);router[_0x7ba1('0xa')](_0x7ba1('0xd'),auth['isAuthenticated'](),controller[_0x7ba1('0xe')]);router[_0x7ba1('0xa')](_0x7ba1('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x7ba1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7ba1('0x11')](_0x7ba1('0xf'),auth['isAuthenticated'](),controller[_0x7ba1('0x12')]);router[_0x7ba1('0x13')](_0x7ba1('0xf'),auth[_0x7ba1('0xb')](),controller[_0x7ba1('0x14')]);module[_0x7ba1('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1542e91..0ad1034 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 _0x862c=['sequelize','exports','STRING','INTEGER'];(function(_0x1e54bd,_0x7915f3){var _0x33bda2=function(_0x5fcdef){while(--_0x5fcdef){_0x1e54bd['push'](_0x1e54bd['shift']());}};_0x33bda2(++_0x7915f3);}(_0x862c,0xa4));var _0xc862=function(_0x15c083,_0x9e73d3){_0x15c083=_0x15c083-0x0;var _0x1320c5=_0x862c[_0x15c083];return _0x1320c5;};'use strict';var Sequelize=require(_0xc862('0x0'));module[_0xc862('0x1')]={'name':{'type':Sequelize[_0xc862('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc862('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc862('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9c7d=['sequelize','exports','STRING','INTEGER'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x9c7d,0x98));var _0xd9c7=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0x9c7d[_0x175e89];return _0x2ed996;};'use strict';var Sequelize=require(_0xd9c7('0x0'));module[_0xd9c7('0x1')]={'name':{'type':Sequelize[_0xd9c7('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd9c7('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e0680e6..5c11d76 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x13d1d4,_0x43f857){var _0x3957a5=function(_0x21a87c){while(--_0x21a87c){_0x13d1d4['push'](_0x13d1d4['shift']());}};_0x3957a5(++_0x43f857);}(_0xef0f,0x168));var _0xfef0=function(_0x3ca0d4,_0x37c881){_0x3ca0d4=_0x3ca0d4-0x0;var _0x5e21b2=_0xef0f[_0x3ca0d4];return _0x5e21b2;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0x33af=['findAll','rows','catch','show','params','length','include','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0x395366,_0x196bfa){var _0x50db87=function(_0x180b0d){while(--_0x180b0d){_0x395366['push'](_0x395366['shift']());}};_0x50db87(++_0x196bfa);}(_0x33af,0xec));var _0xf33a=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x33af[_0x2ddfd9];return _0x2668f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['UserProfileResource'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));};exports[_0xf33a('0x4a')]=function(_0xd40707,_0x36cba8){return db['UserProfileResource'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8adcff1..dd2c897 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 _0x4684=['UserProfileResource','user_profile_has_resources','sectionId','util','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4684,0x142));var _0x4468=function(_0x58aae3,_0x3fbc1b){_0x58aae3=_0x58aae3-0x0;var _0x5c1c8a=_0x4684[_0x58aae3];return _0x5c1c8a;};'use strict';var _=require('lodash');var util=require(_0x4468('0x0'));var logger=require('../../config/logger')(_0x4468('0x1'));var moment=require(_0x4468('0x2'));var BPromise=require(_0x4468('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4468('0x4'));var rimraf=require('rimraf');var config=require(_0x4468('0x5'));var attributes=require('./userProfileResource.attributes');module[_0x4468('0x6')]=function(_0x1051b8,_0x3664c0){return _0x1051b8[_0x4468('0x7')](_0x4468('0x8'),attributes,{'tableName':_0x4468('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x4468('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x087c=['UserProfileResource','user_profile_has_resources','resourceId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x087c,0xea));var _0xc087=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x087c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc087('0x0'));var util=require(_0xc087('0x1'));var logger=require(_0xc087('0x2'))(_0xc087('0x3'));var moment=require(_0xc087('0x4'));var BPromise=require('bluebird');var rp=require(_0xc087('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc087('0x6'));var config=require(_0xc087('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x548578,_0x379387){return _0x548578['define'](_0xc087('0x8'),attributes,{'tableName':_0xc087('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc087('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 c82af17..7a83b05 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 _0x2842=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','request\x20sent'];(function(_0x5054c8,_0x482d9c){var _0x1c1acf=function(_0x541c82){while(--_0x541c82){_0x5054c8['push'](_0x5054c8['shift']());}};_0x1c1acf(++_0x482d9c);}(_0x2842,0x1e1));var _0x2284=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x2842[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x2284('0x0'));var util=require(_0x2284('0x1'));var moment=require(_0x2284('0x2'));var BPromise=require(_0x2284('0x3'));var rs=require(_0x2284('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2284('0x5'))['db'];var utils=require(_0x2284('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2284('0x7'));var jayson=require(_0x2284('0x8'));var client=jayson[_0x2284('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dec7e,_0xed0889,_0x47dc9b){return new BPromise(function(_0x27473d,_0x1105c7){return client['request'](_0x2dec7e,_0x47dc9b)[_0x2284('0xa')](function(_0x37e378){logger[_0x2284('0xb')]('UserProfileResource,\x20%s,\x20%s',_0xed0889,_0x2284('0xc'));logger[_0x2284('0xd')](_0x2284('0xe'),_0xed0889,_0x2284('0xc'),JSON['stringify'](_0x37e378));if(_0x37e378['error']){if(_0x37e378['error']['code']===0x1f4){logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x37e378[_0x2284('0xf')][_0x2284('0x11')]);return _0x1105c7(_0x37e378[_0x2284('0xf')][_0x2284('0x11')]);}logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x37e378['error']['message']);return _0x27473d(_0x37e378[_0x2284('0xf')]['message']);}else{logger[_0x2284('0xb')]('UserProfileResource,\x20%s,\x20%s',_0xed0889,_0x2284('0xc'));_0x27473d(_0x37e378['result'][_0x2284('0x11')]);}})[_0x2284('0x12')](function(_0x26b23a){logger[_0x2284('0xf')](_0x2284('0x10'),_0xed0889,_0x26b23a);_0x1105c7(_0x26b23a);});});} \ No newline at end of file +var _0x499d=['message','UserProfileResource,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0x499d,0x1a1));var _0xd499=function(_0x314adf,_0x236520){_0x314adf=_0x314adf-0x0;var _0x4f40b3=_0x499d[_0x314adf];return _0x4f40b3;};'use strict';var _=require(_0xd499('0x0'));var util=require(_0xd499('0x1'));var moment=require('moment');var BPromise=require(_0xd499('0x2'));var rs=require(_0xd499('0x3'));var fs=require('fs');var Redis=require(_0xd499('0x4'));var db=require(_0xd499('0x5'))['db'];var utils=require(_0xd499('0x6'));var logger=require(_0xd499('0x7'))(_0xd499('0x8'));var config=require(_0xd499('0x9'));var jayson=require(_0xd499('0xa'));var client=jayson[_0xd499('0xb')][_0xd499('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2248b4,_0x5af739,_0x3a3ada){return new BPromise(function(_0x592e47,_0x112f8a){return client[_0xd499('0xd')](_0x2248b4,_0x3a3ada)['then'](function(_0x31bbd8){logger[_0xd499('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5af739,_0xd499('0xf'));logger['debug'](_0xd499('0x10'),_0x5af739,'request\x20sent',JSON[_0xd499('0x11')](_0x31bbd8));if(_0x31bbd8[_0xd499('0x12')]){if(_0x31bbd8['error'][_0xd499('0x13')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5af739,_0x31bbd8[_0xd499('0x12')]['message']);return _0x112f8a(_0x31bbd8[_0xd499('0x12')][_0xd499('0x14')]);}logger[_0xd499('0x12')](_0xd499('0x15'),_0x5af739,_0x31bbd8[_0xd499('0x12')]['message']);return _0x592e47(_0x31bbd8[_0xd499('0x12')][_0xd499('0x14')]);}else{logger[_0xd499('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5af739,'request\x20sent');_0x592e47(_0x31bbd8[_0xd499('0x16')][_0xd499('0x14')]);}})['catch'](function(_0x19187b){logger[_0xd499('0x12')](_0xd499('0x15'),_0x5af739,_0x19187b);_0x112f8a(_0x19187b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b53e393..45ba3b6 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 _0x6e46=['/describe','describe','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index'];(function(_0x95c573,_0x284e8f){var _0x52daf0=function(_0x3891f9){while(--_0x3891f9){_0x95c573['push'](_0x95c573['shift']());}};_0x52daf0(++_0x284e8f);}(_0x6e46,0x186));var _0x66e4=function(_0x144071,_0x33edf1){_0x144071=_0x144071-0x0;var _0x2dc87c=_0x6e46[_0x144071];return _0x2dc87c;};'use strict';var multer=require('multer');var util=require(_0x66e4('0x0'));var path=require('path');var timeout=require(_0x66e4('0x1'));var express=require('express');var router=express[_0x66e4('0x2')]();var fs_extra=require(_0x66e4('0x3'));var auth=require(_0x66e4('0x4'));var interaction=require(_0x66e4('0x5'));var config=require('../../config/environment');var controller=require(_0x66e4('0x6'));router[_0x66e4('0x7')]('/',auth[_0x66e4('0x8')](),controller[_0x66e4('0x9')]);router[_0x66e4('0x7')](_0x66e4('0xa'),auth[_0x66e4('0x8')](),controller[_0x66e4('0xb')]);router['get'](_0x66e4('0xc'),auth[_0x66e4('0x8')](),controller[_0x66e4('0xd')]);router[_0x66e4('0xe')]('/',auth[_0x66e4('0x8')](),controller['create']);router[_0x66e4('0xf')](_0x66e4('0xc'),auth['isAuthenticated'](),controller[_0x66e4('0x10')]);router[_0x66e4('0x11')](_0x66e4('0xc'),auth[_0x66e4('0x8')](),controller[_0x66e4('0x12')]);module[_0x66e4('0x13')]=router; \ No newline at end of file +var _0x20e1=['../../config/environment','get','isAuthenticated','/describe','show','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8d823c,_0x4dfa8e){var _0x1399a6=function(_0x85d55e){while(--_0x85d55e){_0x8d823c['push'](_0x8d823c['shift']());}};_0x1399a6(++_0x4dfa8e);}(_0x20e1,0xef));var _0x120e=function(_0x4ddef8,_0x3c78fe){_0x4ddef8=_0x4ddef8-0x0;var _0x456403=_0x20e1[_0x4ddef8];return _0x456403;};'use strict';var multer=require(_0x120e('0x0'));var util=require('util');var path=require(_0x120e('0x1'));var timeout=require(_0x120e('0x2'));var express=require(_0x120e('0x3'));var router=express[_0x120e('0x4')]();var fs_extra=require(_0x120e('0x5'));var auth=require(_0x120e('0x6'));var interaction=require(_0x120e('0x7'));var config=require(_0x120e('0x8'));var controller=require('./userProfileSection.controller');router[_0x120e('0x9')]('/',auth[_0x120e('0xa')](),controller['index']);router[_0x120e('0x9')](_0x120e('0xb'),auth[_0x120e('0xa')](),controller['describe']);router['get']('/:id',auth[_0x120e('0xa')](),controller[_0x120e('0xc')]);router['post']('/',auth[_0x120e('0xa')](),controller[_0x120e('0xd')]);router[_0x120e('0xe')](_0x120e('0xf'),auth[_0x120e('0xa')](),controller[_0x120e('0x10')]);router[_0x120e('0x11')](_0x120e('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x120e('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d1b39f1..ab2c4db 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 _0x4213=['getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','crudPermissions','join'];(function(_0x8a4546,_0x1786c5){var _0x4ee16d=function(_0x4d88c){while(--_0x4d88c){_0x8a4546['push'](_0x8a4546['shift']());}};_0x4ee16d(++_0x1786c5);}(_0x4213,0x77));var _0x3421=function(_0x2b3659,_0x4850f0){_0x2b3659=_0x2b3659-0x0;var _0x5e1f19=_0x4213[_0x2b3659];return _0x5e1f19;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x3421('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3421('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3421('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xdbd54e){this['setDataValue'](_0x3421('0x5'),_0xdbd54e?_0xdbd54e[_0x3421('0x6')](''):[]);},'get':function(){return this[_0x3421('0x7')](_0x3421('0x5'))?this['getDataValue'](_0x3421('0x5'))[_0x3421('0x8')](''):[];}}}; \ No newline at end of file +var _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x4fe78f,_0x185467){var _0x1b0c3d=function(_0x36e1f0){while(--_0x36e1f0){_0x4fe78f['push'](_0x4fe78f['shift']());}};_0x1b0c3d(++_0x185467);}(_0xefda,0x96));var _0xaefd=function(_0x35f9e4,_0x519505){_0x35f9e4=_0x35f9e4-0x0;var _0x5985a7=_0xefda[_0x35f9e4];return _0x5985a7;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 9abba18..7feb7f2 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 _0xf8a9=['options','then','includeAll','include','findAll','catch','params','fields','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','sendStatus','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','order','where','filter','VIRTUAL','merge'];(function(_0x25b6b5,_0x50744f){var _0x82b1ef=function(_0x32d0da){while(--_0x32d0da){_0x25b6b5['push'](_0x25b6b5['shift']());}};_0x82b1ef(++_0x50744f);}(_0xf8a9,0x169));var _0x9f8a=function(_0x10e485,_0x4ee577){_0x10e485=_0x10e485-0x0;var _0x540f38=_0xf8a9[_0x10e485];return _0x540f38;};'use strict';var emlformat=require(_0x9f8a('0x0'));var rimraf=require(_0x9f8a('0x1'));var zipdir=require(_0x9f8a('0x2'));var jsonpatch=require(_0x9f8a('0x3'));var rp=require('request-promise');var moment=require(_0x9f8a('0x4'));var BPromise=require(_0x9f8a('0x5'));var Mustache=require('mustache');var util=require(_0x9f8a('0x6'));var path=require(_0x9f8a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f8a('0x8'));var fs=require('fs');var fs_extra=require(_0x9f8a('0x9'));var _=require(_0x9f8a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9f8a('0xb'));var deskjs=require(_0x9f8a('0xc'));var toCsv=require(_0x9f8a('0xd'));var querystring=require(_0x9f8a('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f8a('0xf'));var authService=require(_0x9f8a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f8a('0x11'));var logger=require(_0x9f8a('0x12'))(_0x9f8a('0x13'));var utils=require(_0x9f8a('0x14'));var config=require(_0x9f8a('0x15'));var licenseUtil=require(_0x9f8a('0x16'));var db=require(_0x9f8a('0x17'))['db'];function respondWithStatusCode(_0x46b230,_0x4ec0a2){_0x4ec0a2=_0x4ec0a2||0xcc;return function(_0x5cfaa6){if(_0x5cfaa6){return _0x46b230['sendStatus'](_0x4ec0a2);}return _0x46b230[_0x9f8a('0x18')](_0x4ec0a2)[_0x9f8a('0x19')]();};}function respondWithResult(_0x568fee,_0x7fa3ba){_0x7fa3ba=_0x7fa3ba||0xc8;return function(_0x92ebc){if(_0x92ebc){return _0x568fee[_0x9f8a('0x18')](_0x7fa3ba)[_0x9f8a('0x1a')](_0x92ebc);}};}function respondWithFilteredResult(_0x13c31e,_0x254b96){return function(_0xf59bd6){if(_0xf59bd6){var _0x2b0be0=typeof _0x254b96[_0x9f8a('0x1b')]===_0x9f8a('0x1c')&&typeof _0x254b96[_0x9f8a('0x1d')]===_0x9f8a('0x1c');var _0x40ded8=_0xf59bd6[_0x9f8a('0x1e')];var _0x27e08a=_0x2b0be0?0x0:_0x254b96[_0x9f8a('0x1b')];var _0x8dab6c=_0x2b0be0?_0xf59bd6['count']:_0x254b96[_0x9f8a('0x1b')]+_0x254b96[_0x9f8a('0x1d')];var _0x7cbbf0;if(_0x8dab6c>=_0x40ded8){_0x8dab6c=_0x40ded8;_0x7cbbf0=0xc8;}else{_0x7cbbf0=0xce;}_0x13c31e[_0x9f8a('0x18')](_0x7cbbf0);return _0x13c31e[_0x9f8a('0x1f')]('Content-Range',_0x27e08a+'-'+_0x8dab6c+'/'+_0x40ded8)[_0x9f8a('0x1a')](_0xf59bd6);}return null;};}function patchUpdates(_0x391158){return function(_0x410a99){try{jsonpatch[_0x9f8a('0x20')](_0x410a99,_0x391158,!![]);}catch(_0x2b1247){return BPromise[_0x9f8a('0x21')](_0x2b1247);}return _0x410a99[_0x9f8a('0x22')]();};}function saveUpdates(_0x2c51d6,_0x3445f8){return function(_0x20a083){if(_0x20a083){return _0x20a083[_0x9f8a('0x23')](_0x2c51d6)['then'](function(_0x1cdee7){return _0x1cdee7;});}return null;};}function removeEntity(_0x435b68,_0x1d92dd){return function(_0x120ae7){if(_0x120ae7){return _0x120ae7[_0x9f8a('0x24')]()['then'](function(){_0x435b68[_0x9f8a('0x18')](0xcc)[_0x9f8a('0x19')]();});}};}function handleEntityNotFound(_0x4f798f,_0x4e4746){return function(_0xb961b){if(!_0xb961b){_0x4f798f[_0x9f8a('0x25')](0x194);}return _0xb961b;};}function handleError(_0x2dfd35,_0x34b57f){_0x34b57f=_0x34b57f||0x1f4;return function(_0x1f44ca){logger[_0x9f8a('0x26')](_0x1f44ca['stack']);if(_0x1f44ca[_0x9f8a('0x27')]){delete _0x1f44ca[_0x9f8a('0x27')];}_0x2dfd35[_0x9f8a('0x18')](_0x34b57f)[_0x9f8a('0x28')](_0x1f44ca);};}exports['index']=function(_0x661ebf,_0x530a34){var _0x496185={},_0x2deeee={},_0x594baa={'count':0x0,'rows':[]};var _0x13438a=_[_0x9f8a('0x29')](db[_0x9f8a('0x2a')][_0x9f8a('0x2b')],function(_0xebed9){return{'name':_0xebed9[_0x9f8a('0x2c')],'type':_0xebed9[_0x9f8a('0x2d')][_0x9f8a('0x2e')]};});_0x2deeee[_0x9f8a('0x2f')]=_['map'](_0x13438a,_0x9f8a('0x27'));_0x2deeee['query']=_[_0x9f8a('0x30')](_0x661ebf[_0x9f8a('0x31')]);_0x2deeee[_0x9f8a('0x32')]=_[_0x9f8a('0x33')](_0x2deeee[_0x9f8a('0x2f')],_0x2deeee[_0x9f8a('0x31')]);_0x496185[_0x9f8a('0x34')]=_[_0x9f8a('0x33')](_0x2deeee['model'],qs['fields'](_0x661ebf[_0x9f8a('0x31')]['fields']));_0x496185[_0x9f8a('0x34')]=_0x496185[_0x9f8a('0x34')][_0x9f8a('0x35')]?_0x496185[_0x9f8a('0x34')]:_0x2deeee[_0x9f8a('0x2f')];if(!_0x661ebf[_0x9f8a('0x31')]['hasOwnProperty']('nolimit')){_0x496185[_0x9f8a('0x1d')]=qs[_0x9f8a('0x1d')](_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x1d')]);_0x496185[_0x9f8a('0x1b')]=qs[_0x9f8a('0x1b')](_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x1b')]);}_0x496185[_0x9f8a('0x36')]=qs['sort'](_0x661ebf['query']['sort']);_0x496185[_0x9f8a('0x37')]=qs[_0x9f8a('0x32')](_['pick'](_0x661ebf[_0x9f8a('0x31')],_0x2deeee[_0x9f8a('0x32')]),_0x13438a);if(_0x661ebf['query'][_0x9f8a('0x38')]){_0x496185[_0x9f8a('0x37')]=_['merge'](_0x496185[_0x9f8a('0x37')],{'$or':_['map'](_0x13438a,function(_0x122b9f){if(_0x122b9f[_0x9f8a('0x2d')]!==_0x9f8a('0x39')){var _0x2c9806={};_0x2c9806[_0x122b9f['name']]={'$like':'%'+_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x38')]+'%'};return _0x2c9806;}})});}_0x496185=_[_0x9f8a('0x3a')]({},_0x496185,_0x661ebf[_0x9f8a('0x3b')]);var _0x4a42a5={'where':_0x496185[_0x9f8a('0x37')]};return db[_0x9f8a('0x2a')][_0x9f8a('0x1e')](_0x4a42a5)[_0x9f8a('0x3c')](function(_0x5780ad){_0x594baa[_0x9f8a('0x1e')]=_0x5780ad;if(_0x661ebf[_0x9f8a('0x31')][_0x9f8a('0x3d')]){_0x496185[_0x9f8a('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9f8a('0x3f')](_0x496185);})[_0x9f8a('0x3c')](function(_0x51af3b){_0x594baa['rows']=_0x51af3b;return _0x594baa;})['then'](respondWithFilteredResult(_0x530a34,_0x496185))[_0x9f8a('0x40')](handleError(_0x530a34,null));};exports['show']=function(_0xb70fe3,_0x4bdb8a){var _0x17fda9={'raw':![],'where':{'id':_0xb70fe3[_0x9f8a('0x41')]['id']}},_0x48bc83={};_0x48bc83['model']=_[_0x9f8a('0x30')](db[_0x9f8a('0x2a')][_0x9f8a('0x2b')]);_0x48bc83['query']=_['keys'](_0xb70fe3[_0x9f8a('0x31')]);_0x48bc83[_0x9f8a('0x32')]=_[_0x9f8a('0x33')](_0x48bc83[_0x9f8a('0x2f')],_0x48bc83[_0x9f8a('0x31')]);_0x17fda9[_0x9f8a('0x34')]=_['intersection'](_0x48bc83[_0x9f8a('0x2f')],qs['fields'](_0xb70fe3['query'][_0x9f8a('0x42')]));_0x17fda9[_0x9f8a('0x34')]=_0x17fda9['attributes']['length']?_0x17fda9['attributes']:_0x48bc83[_0x9f8a('0x2f')];if(_0xb70fe3['query'][_0x9f8a('0x3d')]){_0x17fda9['include']=[{'all':!![]}];}_0x17fda9=_[_0x9f8a('0x3a')]({},_0x17fda9,_0xb70fe3['options']);return db[_0x9f8a('0x2a')][_0x9f8a('0x43')](_0x17fda9)[_0x9f8a('0x3c')](handleEntityNotFound(_0x4bdb8a,null))[_0x9f8a('0x3c')](respondWithResult(_0x4bdb8a,null))[_0x9f8a('0x40')](handleError(_0x4bdb8a,null));};exports['create']=function(_0x2db8f3,_0x3e211a){return db[_0x9f8a('0x2a')]['create'](_0x2db8f3[_0x9f8a('0x44')],{})['then'](respondWithResult(_0x3e211a,0xc9))[_0x9f8a('0x40')](handleError(_0x3e211a,null));};exports[_0x9f8a('0x23')]=function(_0x24f33f,_0x189687){if(_0x24f33f[_0x9f8a('0x44')]['id']){delete _0x24f33f[_0x9f8a('0x44')]['id'];}return db['UserProfileSection'][_0x9f8a('0x43')]({'where':{'id':_0x24f33f[_0x9f8a('0x41')]['id']}})[_0x9f8a('0x3c')](handleEntityNotFound(_0x189687,null))['then'](saveUpdates(_0x24f33f[_0x9f8a('0x44')],null))['then'](respondWithResult(_0x189687,null))['catch'](handleError(_0x189687,null));};exports[_0x9f8a('0x24')]=function(_0x516a1e,_0x1c8345){return db['UserProfileSection'][_0x9f8a('0x43')]({'where':{'id':_0x516a1e[_0x9f8a('0x41')]['id']}})[_0x9f8a('0x3c')](handleEntityNotFound(_0x1c8345,null))[_0x9f8a('0x3c')](removeEntity(_0x1c8345,null))[_0x9f8a('0x40')](handleError(_0x1c8345,null));};exports[_0x9f8a('0x45')]=function(_0x10fb05,_0xc5a67){return db[_0x9f8a('0x2a')][_0x9f8a('0x45')]()[_0x9f8a('0x3c')](respondWithResult(_0xc5a67,null))[_0x9f8a('0x40')](handleError(_0xc5a67,null));}; \ No newline at end of file +var _0x1bac=['limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','includeAll','include','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','moment','mustache','util','path','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/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0x4ace68,_0x12be6f){var _0x306a7b=function(_0x3be5f4){while(--_0x3be5f4){_0x4ace68['push'](_0x4ace68['shift']());}};_0x306a7b(++_0x12be6f);}(_0x1bac,0x108));var _0xc1ba=function(_0x1edcf4,_0x4a0365){_0x1edcf4=_0x1edcf4-0x0;var _0x4119c1=_0x1bac[_0x1edcf4];return _0x4119c1;};'use strict';var emlformat=require(_0xc1ba('0x0'));var rimraf=require(_0xc1ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc1ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc1ba('0x3'));var util=require(_0xc1ba('0x4'));var path=require(_0xc1ba('0x5'));var sox=require(_0xc1ba('0x6'));var csv=require(_0xc1ba('0x7'));var ejs=require(_0xc1ba('0x8'));var fs=require('fs');var fs_extra=require(_0xc1ba('0x9'));var _=require(_0xc1ba('0xa'));var squel=require(_0xc1ba('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1ba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1ba('0x7'));var querystring=require(_0xc1ba('0xd'));var Papa=require(_0xc1ba('0xe'));var Redis=require(_0xc1ba('0xf'));var authService=require(_0xc1ba('0x10'));var qs=require(_0xc1ba('0x11'));var as=require(_0xc1ba('0x12'));var hardwareService=require(_0xc1ba('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc1ba('0x14'));var config=require(_0xc1ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1ba('0x16'))['db'];function respondWithStatusCode(_0x2be0b0,_0x48f770){_0x48f770=_0x48f770||0xcc;return function(_0x3526a7){if(_0x3526a7){return _0x2be0b0[_0xc1ba('0x17')](_0x48f770);}return _0x2be0b0['status'](_0x48f770)[_0xc1ba('0x18')]();};}function respondWithResult(_0x18dfae,_0x3b5fc3){_0x3b5fc3=_0x3b5fc3||0xc8;return function(_0x3f6f6e){if(_0x3f6f6e){return _0x18dfae[_0xc1ba('0x19')](_0x3b5fc3)['json'](_0x3f6f6e);}};}function respondWithFilteredResult(_0x1f678d,_0x1caadf){return function(_0x3148ef){if(_0x3148ef){var _0x478143=typeof _0x1caadf[_0xc1ba('0x1a')]===_0xc1ba('0x1b')&&typeof _0x1caadf[_0xc1ba('0x1c')]===_0xc1ba('0x1b');var _0x5ade45=_0x3148ef['count'];var _0x59c4f1=_0x478143?0x0:_0x1caadf['offset'];var _0x51ddfb=_0x478143?_0x3148ef[_0xc1ba('0x1d')]:_0x1caadf[_0xc1ba('0x1a')]+_0x1caadf[_0xc1ba('0x1c')];var _0x3b9a0a;if(_0x51ddfb>=_0x5ade45){_0x51ddfb=_0x5ade45;_0x3b9a0a=0xc8;}else{_0x3b9a0a=0xce;}_0x1f678d[_0xc1ba('0x19')](_0x3b9a0a);return _0x1f678d[_0xc1ba('0x1e')]('Content-Range',_0x59c4f1+'-'+_0x51ddfb+'/'+_0x5ade45)['json'](_0x3148ef);}return null;};}function patchUpdates(_0x24bc40){return function(_0x23e5ae){try{jsonpatch[_0xc1ba('0x1f')](_0x23e5ae,_0x24bc40,!![]);}catch(_0x40c723){return BPromise['reject'](_0x40c723);}return _0x23e5ae[_0xc1ba('0x20')]();};}function saveUpdates(_0x229e79,_0x4203df){return function(_0x3455ae){if(_0x3455ae){return _0x3455ae[_0xc1ba('0x21')](_0x229e79)[_0xc1ba('0x22')](function(_0x29ca1b){return _0x29ca1b;});}return null;};}function removeEntity(_0x1bbcee,_0x3668a3){return function(_0x51411d){if(_0x51411d){return _0x51411d[_0xc1ba('0x23')]()[_0xc1ba('0x22')](function(){_0x1bbcee[_0xc1ba('0x19')](0xcc)[_0xc1ba('0x18')]();});}};}function handleEntityNotFound(_0xf23ee5,_0x304973){return function(_0x1c4da2){if(!_0x1c4da2){_0xf23ee5['sendStatus'](0x194);}return _0x1c4da2;};}function handleError(_0x1a4a19,_0x539109){_0x539109=_0x539109||0x1f4;return function(_0x1abc82){logger[_0xc1ba('0x24')](_0x1abc82[_0xc1ba('0x25')]);if(_0x1abc82[_0xc1ba('0x26')]){delete _0x1abc82[_0xc1ba('0x26')];}_0x1a4a19['status'](_0x539109)[_0xc1ba('0x27')](_0x1abc82);};}exports[_0xc1ba('0x28')]=function(_0x1c0ada,_0x480d2e){var _0x453847={},_0x23eff7={},_0x31fe29={'count':0x0,'rows':[]};var _0x215644=_['map'](db[_0xc1ba('0x29')][_0xc1ba('0x2a')],function(_0x37644f){return{'name':_0x37644f[_0xc1ba('0x2b')],'type':_0x37644f[_0xc1ba('0x2c')][_0xc1ba('0x2d')]};});_0x23eff7[_0xc1ba('0x2e')]=_['map'](_0x215644,_0xc1ba('0x26'));_0x23eff7[_0xc1ba('0x2f')]=_[_0xc1ba('0x30')](_0x1c0ada['query']);_0x23eff7['filters']=_[_0xc1ba('0x31')](_0x23eff7['model'],_0x23eff7[_0xc1ba('0x2f')]);_0x453847[_0xc1ba('0x32')]=_[_0xc1ba('0x31')](_0x23eff7['model'],qs[_0xc1ba('0x33')](_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x33')]));_0x453847[_0xc1ba('0x32')]=_0x453847['attributes'][_0xc1ba('0x34')]?_0x453847[_0xc1ba('0x32')]:_0x23eff7[_0xc1ba('0x2e')];if(!_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x35')]('nolimit')){_0x453847['limit']=qs[_0xc1ba('0x1c')](_0x1c0ada[_0xc1ba('0x2f')]['limit']);_0x453847[_0xc1ba('0x1a')]=qs[_0xc1ba('0x1a')](_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x1a')]);}_0x453847[_0xc1ba('0x36')]=qs['sort'](_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x37')]);_0x453847[_0xc1ba('0x38')]=qs[_0xc1ba('0x39')](_[_0xc1ba('0x3a')](_0x1c0ada['query'],_0x23eff7[_0xc1ba('0x39')]),_0x215644);if(_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x3b')]){_0x453847['where']=_[_0xc1ba('0x3c')](_0x453847[_0xc1ba('0x38')],{'$or':_[_0xc1ba('0x3d')](_0x215644,function(_0x53d6d3){if(_0x53d6d3[_0xc1ba('0x2c')]!=='VIRTUAL'){var _0x4aa45a={};_0x4aa45a[_0x53d6d3[_0xc1ba('0x26')]]={'$like':'%'+_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x3b')]+'%'};return _0x4aa45a;}})});}_0x453847=_['merge']({},_0x453847,_0x1c0ada['options']);var _0x3c3649={'where':_0x453847[_0xc1ba('0x38')]};return db[_0xc1ba('0x29')]['count'](_0x3c3649)[_0xc1ba('0x22')](function(_0x464f81){_0x31fe29['count']=_0x464f81;if(_0x1c0ada[_0xc1ba('0x2f')][_0xc1ba('0x3e')]){_0x453847[_0xc1ba('0x3f')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x453847);})['then'](function(_0xd65ace){_0x31fe29[_0xc1ba('0x40')]=_0xd65ace;return _0x31fe29;})[_0xc1ba('0x22')](respondWithFilteredResult(_0x480d2e,_0x453847))[_0xc1ba('0x41')](handleError(_0x480d2e,null));};exports[_0xc1ba('0x42')]=function(_0x5073bc,_0x50139c){var _0x4ed2d0={'raw':![],'where':{'id':_0x5073bc['params']['id']}},_0x2182a3={};_0x2182a3[_0xc1ba('0x2e')]=_[_0xc1ba('0x30')](db[_0xc1ba('0x29')][_0xc1ba('0x2a')]);_0x2182a3[_0xc1ba('0x2f')]=_['keys'](_0x5073bc[_0xc1ba('0x2f')]);_0x2182a3[_0xc1ba('0x39')]=_[_0xc1ba('0x31')](_0x2182a3[_0xc1ba('0x2e')],_0x2182a3['query']);_0x4ed2d0[_0xc1ba('0x32')]=_['intersection'](_0x2182a3['model'],qs[_0xc1ba('0x33')](_0x5073bc['query'][_0xc1ba('0x33')]));_0x4ed2d0[_0xc1ba('0x32')]=_0x4ed2d0[_0xc1ba('0x32')][_0xc1ba('0x34')]?_0x4ed2d0[_0xc1ba('0x32')]:_0x2182a3[_0xc1ba('0x2e')];if(_0x5073bc[_0xc1ba('0x2f')][_0xc1ba('0x3e')]){_0x4ed2d0[_0xc1ba('0x3f')]=[{'all':!![]}];}_0x4ed2d0=_['merge']({},_0x4ed2d0,_0x5073bc[_0xc1ba('0x43')]);return db[_0xc1ba('0x29')][_0xc1ba('0x44')](_0x4ed2d0)[_0xc1ba('0x22')](handleEntityNotFound(_0x50139c,null))[_0xc1ba('0x22')](respondWithResult(_0x50139c,null))[_0xc1ba('0x41')](handleError(_0x50139c,null));};exports[_0xc1ba('0x45')]=function(_0x9f682e,_0x3441df){return db['UserProfileSection']['create'](_0x9f682e[_0xc1ba('0x46')],{})[_0xc1ba('0x22')](respondWithResult(_0x3441df,0xc9))[_0xc1ba('0x41')](handleError(_0x3441df,null));};exports[_0xc1ba('0x21')]=function(_0x27112d,_0x4990ce){if(_0x27112d[_0xc1ba('0x46')]['id']){delete _0x27112d['body']['id'];}return db[_0xc1ba('0x29')]['find']({'where':{'id':_0x27112d['params']['id']}})[_0xc1ba('0x22')](handleEntityNotFound(_0x4990ce,null))[_0xc1ba('0x22')](saveUpdates(_0x27112d[_0xc1ba('0x46')],null))[_0xc1ba('0x22')](respondWithResult(_0x4990ce,null))[_0xc1ba('0x41')](handleError(_0x4990ce,null));};exports[_0xc1ba('0x23')]=function(_0x31b454,_0x1ee993){return db[_0xc1ba('0x29')][_0xc1ba('0x44')]({'where':{'id':_0x31b454[_0xc1ba('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ee993,null))[_0xc1ba('0x22')](removeEntity(_0x1ee993,null))['catch'](handleError(_0x1ee993,null));};exports[_0xc1ba('0x48')]=function(_0x3a30fc,_0x4681a2){return db['UserProfileSection'][_0xc1ba('0x48')]()['then'](respondWithResult(_0x4681a2,null))[_0xc1ba('0x41')](handleError(_0x4681a2,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b29718e..a27b528 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 _0xf325=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0x2b082e,_0x12aead){var _0x246043=function(_0x348ef5){while(--_0x348ef5){_0x2b082e['push'](_0x2b082e['shift']());}};_0x246043(++_0x12aead);}(_0xf325,0x164));var _0x5f32=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xf325[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x5f32('0x0'));var util=require(_0x5f32('0x1'));var logger=require(_0x5f32('0x2'))(_0x5f32('0x3'));var moment=require(_0x5f32('0x4'));var BPromise=require(_0x5f32('0x5'));var rp=require(_0x5f32('0x6'));var fs=require('fs');var path=require(_0x5f32('0x7'));var rimraf=require(_0x5f32('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f32('0x9'));module[_0x5f32('0xa')]=function(_0x27988e,_0x43b861){return _0x27988e['define'](_0x5f32('0xb'),attributes,{'tableName':_0x5f32('0xc'),'paranoid':![],'indexes':[{'name':_0x5f32('0xd'),'fields':[_0x5f32('0xe'),_0x5f32('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b02=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','define'];(function(_0x248197,_0x1b1c11){var _0x5847a0=function(_0x1e64f6){while(--_0x1e64f6){_0x248197['push'](_0x248197['shift']());}};_0x5847a0(++_0x1b1c11);}(_0x8b02,0x1f4));var _0x28b0=function(_0x333767,_0x220733){_0x333767=_0x333767-0x0;var _0x42a755=_0x8b02[_0x333767];return _0x42a755;};'use strict';var _=require(_0x28b0('0x0'));var util=require(_0x28b0('0x1'));var logger=require('../../config/logger')(_0x28b0('0x2'));var moment=require(_0x28b0('0x3'));var BPromise=require(_0x28b0('0x4'));var rp=require(_0x28b0('0x5'));var fs=require('fs');var path=require(_0x28b0('0x6'));var rimraf=require(_0x28b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x28b0('0x8'));module['exports']=function(_0x3bf778,_0x229afe){return _0x3bf778[_0x28b0('0x9')](_0x28b0('0xa'),attributes,{'tableName':_0x28b0('0xb'),'paranoid':![],'indexes':[{'name':_0x28b0('0xc'),'fields':[_0x28b0('0xd'),_0x28b0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8200422..203a97f 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 _0x54be=['info','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x16551f,_0x19b73b){var _0xd0df68=function(_0x4741a7){while(--_0x4741a7){_0x16551f['push'](_0x16551f['shift']());}};_0xd0df68(++_0x19b73b);}(_0x54be,0x1ba));var _0xe54b=function(_0x3eb8df,_0x3b967f){_0x3eb8df=_0x3eb8df-0x0;var _0x4de9c5=_0x54be[_0x3eb8df];return _0x4de9c5;};'use strict';var _=require(_0xe54b('0x0'));var util=require(_0xe54b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe54b('0x2'));var db=require(_0xe54b('0x3'))['db'];var utils=require(_0xe54b('0x4'));var logger=require(_0xe54b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe54b('0x6'));var client=jayson[_0xe54b('0x7')][_0xe54b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5072f6,_0x395a38,_0x534b75){return new BPromise(function(_0x3e7dcf,_0x4938e0){return client[_0xe54b('0x9')](_0x5072f6,_0x534b75)[_0xe54b('0xa')](function(_0x3e2696){logger['info'](_0xe54b('0xb'),_0x395a38,_0xe54b('0xc'));logger[_0xe54b('0xd')](_0xe54b('0xe'),_0x395a38,_0xe54b('0xc'),JSON[_0xe54b('0xf')](_0x3e2696));if(_0x3e2696['error']){if(_0x3e2696[_0xe54b('0x10')]['code']===0x1f4){logger[_0xe54b('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x395a38,_0x3e2696[_0xe54b('0x10')][_0xe54b('0x11')]);return _0x4938e0(_0x3e2696['error'][_0xe54b('0x11')]);}logger[_0xe54b('0x10')](_0xe54b('0xb'),_0x395a38,_0x3e2696['error'][_0xe54b('0x11')]);return _0x3e7dcf(_0x3e2696[_0xe54b('0x10')][_0xe54b('0x11')]);}else{logger[_0xe54b('0x12')](_0xe54b('0xb'),_0x395a38,_0xe54b('0xc'));_0x3e7dcf(_0x3e2696['result'][_0xe54b('0x11')]);}})[_0xe54b('0x13')](function(_0x56189e){logger[_0xe54b('0x10')](_0xe54b('0xb'),_0x395a38,_0x56189e);_0x4938e0(_0x56189e);});});} \ No newline at end of file +var _0xef27=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5ece78,_0x5171b8){var _0x51e3b8=function(_0x24402c){while(--_0x24402c){_0x5ece78['push'](_0x5ece78['shift']());}};_0x51e3b8(++_0x5171b8);}(_0xef27,0x1c2));var _0x7ef2=function(_0x22cf75,_0x58dabd){_0x22cf75=_0x22cf75-0x0;var _0xa79e14=_0xef27[_0x22cf75];return _0xa79e14;};'use strict';var _=require(_0x7ef2('0x0'));var util=require(_0x7ef2('0x1'));var moment=require(_0x7ef2('0x2'));var BPromise=require(_0x7ef2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ef2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ef2('0x5'));var config=require(_0x7ef2('0x6'));var jayson=require(_0x7ef2('0x7'));var client=jayson[_0x7ef2('0x8')][_0x7ef2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc65abc,_0x40d543,_0x205c81){return new BPromise(function(_0x19c095,_0x151b9c){return client[_0x7ef2('0xa')](_0xc65abc,_0x205c81)[_0x7ef2('0xb')](function(_0x116ff6){logger[_0x7ef2('0xc')](_0x7ef2('0xd'),_0x40d543,_0x7ef2('0xe'));logger['debug'](_0x7ef2('0xf'),_0x40d543,'request\x20sent',JSON[_0x7ef2('0x10')](_0x116ff6));if(_0x116ff6['error']){if(_0x116ff6['error'][_0x7ef2('0x11')]===0x1f4){logger[_0x7ef2('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x40d543,_0x116ff6[_0x7ef2('0x12')][_0x7ef2('0x13')]);return _0x151b9c(_0x116ff6[_0x7ef2('0x12')][_0x7ef2('0x13')]);}logger['error'](_0x7ef2('0xd'),_0x40d543,_0x116ff6[_0x7ef2('0x12')][_0x7ef2('0x13')]);return _0x19c095(_0x116ff6['error'][_0x7ef2('0x13')]);}else{logger[_0x7ef2('0xc')](_0x7ef2('0xd'),_0x40d543,'request\x20sent');_0x19c095(_0x116ff6[_0x7ef2('0x14')][_0x7ef2('0x13')]);}})[_0x7ef2('0x15')](function(_0x7f3a4b){logger[_0x7ef2('0x12')](_0x7ef2('0xd'),_0x40d543,_0x7f3a4b);_0x151b9c(_0x7f3a4b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index dbc3590..c162eb2 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x55b68b,_0x1c3dad){var _0x46fceb=function(_0x3cddbc){while(--_0x3cddbc){_0x55b68b['push'](_0x55b68b['shift']());}};_0x46fceb(++_0x1c3dad);}(_0x70e0,0x17b));var _0x070e=function(_0x423b0f,_0x5298b5){_0x423b0f=_0x423b0f-0x0;var _0x1945cd=_0x70e0[_0x423b0f];return _0x1945cd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x318d5c,_0x19679e){var _0x39b387=function(_0x1b2876){while(--_0x1b2876){_0x318d5c['push'](_0x318d5c['shift']());}};_0x39b387(++_0x19679e);}(_0xedd9,0xfc));var _0x9edd=function(_0x532f0d,_0x409644){_0x532f0d=_0x532f0d-0x0;var _0xb8140d=_0xedd9[_0x532f0d];return _0xb8140d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d123940..265ef48 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 _0xaac4=['sequelize','exports','INTEGER'];(function(_0x2e7a5d,_0x16d072){var _0x1e8c25=function(_0x4ff798){while(--_0x4ff798){_0x2e7a5d['push'](_0x2e7a5d['shift']());}};_0x1e8c25(++_0x16d072);}(_0xaac4,0x72));var _0x4aac=function(_0x7b341f,_0x11e481){_0x7b341f=_0x7b341f-0x0;var _0x46d0a1=_0xaac4[_0x7b341f];return _0x46d0a1;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'penalty':{'type':Sequelize[_0x4aac('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc5dd=['sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc5dd,0x170));var _0xdc5d=function(_0x30b44a,_0x3c48f3){_0x30b44a=_0x30b44a-0x0;var _0xd172c4=_0xc5dd[_0x30b44a];return _0xd172c4;};'use strict';var Sequelize=require(_0xdc5d('0x0'));module[_0xdc5d('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 1d2bd8e..4a1ac36 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 _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x4f62a8,_0x28e774){var _0x5b7315=function(_0x4d2953){while(--_0x4d2953){_0x4f62a8['push'](_0x4f62a8['shift']());}};_0x5b7315(++_0x28e774);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1d5fbd,_0x38bbf0){_0x1d5fbd=_0x1d5fbd-0x0;var _0x3be8b5=_0xd8fb[_0x1d5fbd];return _0x3be8b5;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b8e=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x528301,_0x26e009){var _0x539395=function(_0x1c24ac){while(--_0x1c24ac){_0x528301['push'](_0x528301['shift']());}};_0x539395(++_0x26e009);}(_0x8b8e,0x108));var _0xe8b8=function(_0x19883a,_0x19601a){_0x19883a=_0x19883a-0x0;var _0x440f0c=_0x8b8e[_0x19883a];return _0x440f0c;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var logger=require(_0xe8b8('0x1'))('api');var moment=require(_0xe8b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8b8('0x3'));var rimraf=require(_0xe8b8('0x4'));var config=require(_0xe8b8('0x5'));var attributes=require(_0xe8b8('0x6'));module[_0xe8b8('0x7')]=function(_0x3f5dd7,_0x1c0548){return _0x3f5dd7[_0xe8b8('0x8')](_0xe8b8('0x9'),attributes,{'tableName':_0xe8b8('0xa'),'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 44a91ad..bcc43de 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 _0xabf5=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb2e35d,_0xce8450){var _0xf8748a=function(_0x2d7de7){while(--_0x2d7de7){_0xb2e35d['push'](_0xb2e35d['shift']());}};_0xf8748a(++_0xce8450);}(_0xabf5,0x1d2));var _0x5abf=function(_0x15497f,_0x15ecb3){_0x15497f=_0x15497f-0x0;var _0x3dff4e=_0xabf5[_0x15497f];return _0x3dff4e;};'use strict';var _=require(_0x5abf('0x0'));var util=require(_0x5abf('0x1'));var moment=require(_0x5abf('0x2'));var BPromise=require(_0x5abf('0x3'));var rs=require(_0x5abf('0x4'));var fs=require('fs');var Redis=require(_0x5abf('0x5'));var db=require(_0x5abf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5abf('0x7'))('rpc');var config=require(_0x5abf('0x8'));var jayson=require(_0x5abf('0x9'));var client=jayson['client'][_0x5abf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc7fa01,_0x146e9c,_0x18ef38){return new BPromise(function(_0x26850f,_0x3e95a6){return client[_0x5abf('0xb')](_0xc7fa01,_0x18ef38)[_0x5abf('0xc')](function(_0x2720ed){logger[_0x5abf('0xd')](_0x5abf('0xe'),_0x146e9c,_0x5abf('0xf'));logger[_0x5abf('0x10')](_0x5abf('0x11'),_0x146e9c,_0x5abf('0xf'),JSON['stringify'](_0x2720ed));if(_0x2720ed[_0x5abf('0x12')]){if(_0x2720ed[_0x5abf('0x12')][_0x5abf('0x13')]===0x1f4){logger['error'](_0x5abf('0xe'),_0x146e9c,_0x2720ed[_0x5abf('0x12')][_0x5abf('0x14')]);return _0x3e95a6(_0x2720ed['error'][_0x5abf('0x14')]);}logger[_0x5abf('0x12')](_0x5abf('0xe'),_0x146e9c,_0x2720ed[_0x5abf('0x12')]['message']);return _0x26850f(_0x2720ed[_0x5abf('0x12')][_0x5abf('0x14')]);}else{logger['info'](_0x5abf('0xe'),_0x146e9c,'request\x20sent');_0x26850f(_0x2720ed[_0x5abf('0x15')]['message']);}})[_0x5abf('0x16')](function(_0x6cdabb){logger['error'](_0x5abf('0xe'),_0x146e9c,_0x6cdabb);_0x3e95a6(_0x6cdabb);});});} \ No newline at end of file +var _0xe950=['stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xe950,0x1e6));var _0x0e95=function(_0x51ee0a,_0x109984){_0x51ee0a=_0x51ee0a-0x0;var _0x4c5f09=_0xe950[_0x51ee0a];return _0x4c5f09;};'use strict';var _=require(_0x0e95('0x0'));var util=require(_0x0e95('0x1'));var moment=require('moment');var BPromise=require(_0x0e95('0x2'));var rs=require(_0x0e95('0x3'));var fs=require('fs');var Redis=require(_0x0e95('0x4'));var db=require(_0x0e95('0x5'))['db'];var utils=require(_0x0e95('0x6'));var logger=require('../../config/logger')(_0x0e95('0x7'));var config=require(_0x0e95('0x8'));var jayson=require(_0x0e95('0x9'));var client=jayson[_0x0e95('0xa')][_0x0e95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x403c73,_0xed4e7b,_0x14dd6c){return new BPromise(function(_0xc58b2,_0x41c01e){return client[_0x0e95('0xc')](_0x403c73,_0x14dd6c)[_0x0e95('0xd')](function(_0x550b29){logger['info'](_0x0e95('0xe'),_0xed4e7b,_0x0e95('0xf'));logger[_0x0e95('0x10')](_0x0e95('0x11'),_0xed4e7b,'request\x20sent',JSON[_0x0e95('0x12')](_0x550b29));if(_0x550b29[_0x0e95('0x13')]){if(_0x550b29[_0x0e95('0x13')][_0x0e95('0x14')]===0x1f4){logger[_0x0e95('0x13')](_0x0e95('0xe'),_0xed4e7b,_0x550b29[_0x0e95('0x13')]['message']);return _0x41c01e(_0x550b29[_0x0e95('0x13')][_0x0e95('0x15')]);}logger[_0x0e95('0x13')](_0x0e95('0xe'),_0xed4e7b,_0x550b29[_0x0e95('0x13')][_0x0e95('0x15')]);return _0xc58b2(_0x550b29[_0x0e95('0x13')][_0x0e95('0x15')]);}else{logger[_0x0e95('0x16')](_0x0e95('0xe'),_0xed4e7b,'request\x20sent');_0xc58b2(_0x550b29['result'][_0x0e95('0x15')]);}})[_0x0e95('0x17')](function(_0x54ecce){logger[_0x0e95('0x13')](_0x0e95('0xe'),_0xed4e7b,_0x54ecce);_0x41c01e(_0x54ecce);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 7bb80e0..00d27bb 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 _0xf686=['INTEGER','exports'];(function(_0x3f56af,_0x2fb687){var _0x21ef73=function(_0x5203e3){while(--_0x5203e3){_0x3f56af['push'](_0x3f56af['shift']());}};_0x21ef73(++_0x2fb687);}(_0xf686,0x1e9));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x6f68('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6f68('0x1')]}}; \ No newline at end of file +var _0xbb88=['exports','INTEGER'];(function(_0x34015b,_0x20eede){var _0x3ae577=function(_0x35ac2b){while(--_0x35ac2b){_0x34015b['push'](_0x34015b['shift']());}};_0x3ae577(++_0x20eede);}(_0xbb88,0x76));var _0x8bb8=function(_0x399c4f,_0x45e483){_0x399c4f=_0x399c4f-0x0;var _0x6ee6a9=_0xbb88[_0x399c4f];return _0x6ee6a9;};'use strict';var Sequelize=require('sequelize');module[_0x8bb8('0x0')]={'UserId':{'type':Sequelize[_0x8bb8('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8bb8('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index ee745ec..4e0c84f 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(_0x2bcdd2,_0x3e732f){var _0x476f23=function(_0x1250f8){while(--_0x1250f8){_0x2bcdd2['push'](_0x2bcdd2['shift']());}};_0x476f23(++_0x3e732f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x55f797,_0x460272){var _0x81f0da=function(_0x2cf6b4){while(--_0x2cf6b4){_0x55f797['push'](_0x55f797['shift']());}};_0x81f0da(++_0x460272);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 71b01fb..4c4fa46 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2f2388,_0x4ea55c){var _0x451e17=function(_0x3a81e0){while(--_0x3a81e0){_0x2f2388['push'](_0x2f2388['shift']());}};_0x451e17(++_0x4ea55c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3feec6,_0x4db012){var _0x56d5e2=function(_0x108629){while(--_0x108629){_0x3feec6['push'](_0x3feec6['shift']());}};_0x56d5e2(++_0x4db012);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f606d84..f574014 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 _0xc22d=['INTEGER','exports'];(function(_0x5e88a9,_0x2104ce){var _0x232b1f=function(_0x27af90){while(--_0x27af90){_0x5e88a9['push'](_0x5e88a9['shift']());}};_0x232b1f(++_0x2104ce);}(_0xc22d,0x151));var _0xdc22=function(_0x51129c,_0x41591a){_0x51129c=_0x51129c-0x0;var _0x58cac4=_0xc22d[_0x51129c];return _0x58cac4;};'use strict';var Sequelize=require('sequelize');module[_0xdc22('0x0')]={'penalty':{'type':Sequelize[_0xdc22('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaec5=['INTEGER','exports'];(function(_0xfd901c,_0x41e7b9){var _0x27935c=function(_0x87ce85){while(--_0x87ce85){_0xfd901c['push'](_0xfd901c['shift']());}};_0x27935c(++_0x41e7b9);}(_0xaec5,0x67));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x5aec('0x0')]={'penalty':{'type':Sequelize[_0x5aec('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 9665594..d683e80 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 _0xab3c=['api','moment','request-promise','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger'];(function(_0x4a8cbb,_0x40177c){var _0x36b5b1=function(_0x436ef1){while(--_0x436ef1){_0x4a8cbb['push'](_0x4a8cbb['shift']());}};_0x36b5b1(++_0x40177c);}(_0xab3c,0x6b));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var util=require(_0xcab3('0x1'));var logger=require(_0xcab3('0x2'))(_0xcab3('0x3'));var moment=require(_0xcab3('0x4'));var BPromise=require('bluebird');var rp=require(_0xcab3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcab3('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0xcab3('0x7')]=function(_0x20d0ae,_0x1854c4){return _0x20d0ae[_0xcab3('0x8')](_0xcab3('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbedb=['request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x138c34,_0x3a6fa3){var _0x276398=function(_0x16e2dc){while(--_0x16e2dc){_0x138c34['push'](_0x138c34['shift']());}};_0x276398(++_0x3a6fa3);}(_0xbedb,0x1e9));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbed('0x0'));var util=require(_0xbbed('0x1'));var logger=require(_0xbbed('0x2'))(_0xbbed('0x3'));var moment=require(_0xbbed('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbed('0x5'));var fs=require('fs');var path=require(_0xbbed('0x6'));var rimraf=require('rimraf');var config=require(_0xbbed('0x7'));var attributes=require(_0xbbed('0x8'));module[_0xbbed('0x9')]=function(_0x3fbaa5,_0x4cd8cd){return _0x3fbaa5[_0xbbed('0xa')](_0xbbed('0xb'),attributes,{'tableName':_0xbbed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5066d07..fdf7ea4 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 _0xef8c=['http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b452b,_0x38556b){var _0x2c1f6f=function(_0x4e0560){while(--_0x4e0560){_0x4b452b['push'](_0x4b452b['shift']());}};_0x2c1f6f(++_0x38556b);}(_0xef8c,0xdb));var _0xcef8=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0xef8c[_0x39187b];return _0x2cf25f;};'use strict';var _=require(_0xcef8('0x0'));var util=require('util');var moment=require(_0xcef8('0x1'));var BPromise=require(_0xcef8('0x2'));var rs=require(_0xcef8('0x3'));var fs=require('fs');var Redis=require(_0xcef8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcef8('0x5'));var logger=require(_0xcef8('0x6'))(_0xcef8('0x7'));var config=require(_0xcef8('0x8'));var jayson=require(_0xcef8('0x9'));var client=jayson[_0xcef8('0xa')][_0xcef8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17a585,_0x2e2d1d,_0x5853c7){return new BPromise(function(_0x126286,_0x128712){return client[_0xcef8('0xc')](_0x17a585,_0x5853c7)[_0xcef8('0xd')](function(_0x5a793b){logger[_0xcef8('0xe')](_0xcef8('0xf'),_0x2e2d1d,_0xcef8('0x10'));logger[_0xcef8('0x11')](_0xcef8('0x12'),_0x2e2d1d,_0xcef8('0x10'),JSON['stringify'](_0x5a793b));if(_0x5a793b[_0xcef8('0x13')]){if(_0x5a793b[_0xcef8('0x13')]['code']===0x1f4){logger[_0xcef8('0x13')](_0xcef8('0xf'),_0x2e2d1d,_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);return _0x128712(_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);}logger[_0xcef8('0x13')](_0xcef8('0xf'),_0x2e2d1d,_0x5a793b[_0xcef8('0x13')]['message']);return _0x126286(_0x5a793b[_0xcef8('0x13')][_0xcef8('0x14')]);}else{logger['info'](_0xcef8('0xf'),_0x2e2d1d,_0xcef8('0x10'));_0x126286(_0x5a793b[_0xcef8('0x15')][_0xcef8('0x14')]);}})[_0xcef8('0x16')](function(_0x3a4eed){logger['error'](_0xcef8('0xf'),_0x2e2d1d,_0x3a4eed);_0x128712(_0x3a4eed);});});} \ No newline at end of file +var _0x8767=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8767,0xcf));var _0x7876=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8767[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7876('0x0'));var util=require('util');var moment=require(_0x7876('0x1'));var BPromise=require('bluebird');var rs=require(_0x7876('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7876('0x3'))['db'];var utils=require(_0x7876('0x4'));var logger=require(_0x7876('0x5'))(_0x7876('0x6'));var config=require('../../config/environment');var jayson=require(_0x7876('0x7'));var client=jayson[_0x7876('0x8')][_0x7876('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35b8b1,_0xe82f52,_0x181314){return new BPromise(function(_0x2f79ff,_0x1ed316){return client[_0x7876('0xa')](_0x35b8b1,_0x181314)[_0x7876('0xb')](function(_0x1e1613){logger[_0x7876('0xc')](_0x7876('0xd'),_0xe82f52,_0x7876('0xe'));logger['debug'](_0x7876('0xf'),_0xe82f52,'request\x20sent',JSON[_0x7876('0x10')](_0x1e1613));if(_0x1e1613[_0x7876('0x11')]){if(_0x1e1613[_0x7876('0x11')][_0x7876('0x12')]===0x1f4){logger[_0x7876('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0xe82f52,_0x1e1613[_0x7876('0x11')][_0x7876('0x13')]);return _0x1ed316(_0x1e1613['error']['message']);}logger[_0x7876('0x11')](_0x7876('0xd'),_0xe82f52,_0x1e1613[_0x7876('0x11')][_0x7876('0x13')]);return _0x2f79ff(_0x1e1613['error'][_0x7876('0x13')]);}else{logger[_0x7876('0xc')](_0x7876('0xd'),_0xe82f52,_0x7876('0xe'));_0x2f79ff(_0x1e1613[_0x7876('0x14')]['message']);}})['catch'](function(_0x204487){logger[_0x7876('0x11')](_0x7876('0xd'),_0xe82f52,_0x204487);_0x1ed316(_0x204487);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c04af3a..42400dc 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1b2465,_0x22e4a9){var _0x4aa387=function(_0x534863){while(--_0x534863){_0x1b2465['push'](_0x1b2465['shift']());}};_0x4aa387(++_0x22e4a9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xcb91[_0xbf8ebe];return _0x1e25e8;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x265f52,_0x2d59d1){var _0x108c85=function(_0x56bc80){while(--_0x56bc80){_0x265f52['push'](_0x265f52['shift']());}};_0x108c85(++_0x2d59d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index edb3111..fd57249 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 _0x05d9=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x557d81,_0x2a6677){var _0x13fb9c=function(_0x421b67){while(--_0x421b67){_0x557d81['push'](_0x557d81['shift']());}};_0x13fb9c(++_0x2a6677);}(_0x05d9,0xb2));var _0x905d=function(_0x4a84c8,_0x3d1627){_0x4a84c8=_0x4a84c8-0x0;var _0x23e210=_0x05d9[_0x4a84c8];return _0x23e210;};'use strict';var Sequelize=require(_0x905d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x905d('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x905d('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x905d('0x2')},'UserId':{'type':Sequelize[_0x905d('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x905d('0x3')],'allowNull':![],'unique':_0x905d('0x4'),'comment':_0x905d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x905d('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x905d('0x3')],'allowNull':![],'unique':_0x905d('0x4'),'comment':_0x905d('0x2')},'penalty':{'type':Sequelize[_0x905d('0x1')](0xb),'defaultValue':0x0,'comment':_0x905d('0x2')},'paused':{'type':Sequelize[_0x905d('0x1')](0xb),'defaultValue':0x0,'comment':_0x905d('0x2')}}; \ No newline at end of file +var _0x23ce=['INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x150fac,_0x571849){var _0x5a1dd1=function(_0x2da213){while(--_0x2da213){_0x150fac['push'](_0x150fac['shift']());}};_0x5a1dd1(++_0x571849);}(_0x23ce,0x1e2));var _0xe23c=function(_0x51910a,_0x681154){_0x51910a=_0x51910a-0x0;var _0x479e8b=_0x23ce[_0x51910a];return _0x479e8b;};'use strict';var Sequelize=require(_0xe23c('0x0'));module[_0xe23c('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe23c('0x2')},'membername':{'type':Sequelize[_0xe23c('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xe23c('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe23c('0x5'),'comment':_0xe23c('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xe23c('0x3')],'allowNull':![],'unique':_0xe23c('0x5'),'comment':_0xe23c('0x2')},'penalty':{'type':Sequelize[_0xe23c('0x4')](0xb),'defaultValue':0x0,'comment':_0xe23c('0x2')},'paused':{'type':Sequelize[_0xe23c('0x4')](0xb),'defaultValue':0x0,'comment':_0xe23c('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ccc00fa..0b6a514 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 _0x9efd=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x9efd,0x1c6));var _0xd9ef=function(_0x428499,_0x5a7cf9){_0x428499=_0x428499-0x0;var _0x604083=_0x9efd[_0x428499];return _0x604083;};'use strict';var EventEmitter=require(_0xd9ef('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xd9ef('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd9ef('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd9ef('0x3'),'afterDestroy':_0xd9ef('0x4')};function emitEvent(_0x4fc2a8){return function(_0xaaf64a,_0x367730,_0x302947){UserVoiceQueueRtEvents[_0xd9ef('0x5')](_0x4fc2a8+':'+_0xaaf64a['id'],_0xaaf64a);UserVoiceQueueRtEvents[_0xd9ef('0x5')](_0x4fc2a8,_0xaaf64a);_0x302947(null);};}for(var e in events){if(events[_0xd9ef('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xd9ef('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x44c9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44c9,0xcd));var _0x944c=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x44c9[_0x470e67];return _0x28bbde;};'use strict';var EventEmitter=require(_0x944c('0x0'));var UserVoiceQueueRt=require(_0x944c('0x1'))['db'][_0x944c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x944c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x944c('0x4'),'afterDestroy':_0x944c('0x5')};function emitEvent(_0x83fa66){return function(_0x4f19d0,_0x5943ec,_0x13cd27){UserVoiceQueueRtEvents['emit'](_0x83fa66+':'+_0x4f19d0['id'],_0x4f19d0);UserVoiceQueueRtEvents[_0x944c('0x6')](_0x83fa66,_0x4f19d0);_0x13cd27(null);};}for(var e in events){if(events[_0x944c('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x944c('0x8')](e,emitEvent(event));}}module[_0x944c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 030d8d7..81020e3 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 _0x3ea7=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ea7,0x1de));var _0x73ea=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x3ea7[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x73ea('0x0'));var util=require(_0x73ea('0x1'));var logger=require(_0x73ea('0x2'))(_0x73ea('0x3'));var moment=require(_0x73ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x73ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ea('0x6'));var config=require(_0x73ea('0x7'));var attributes=require(_0x73ea('0x8'));module[_0x73ea('0x9')]=function(_0x3c76e1,_0x4bc16e){return _0x3c76e1[_0x73ea('0xa')](_0x73ea('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['request-promise','path','rimraf','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0xa5));var _0xa57c=function(_0x5dc768,_0x5501ac){_0x5dc768=_0x5dc768-0x0;var _0x59ee8a=_0x57ca[_0x5dc768];return _0x59ee8a;};'use strict';var _=require(_0xa57c('0x0'));var util=require('util');var logger=require(_0xa57c('0x1'))(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var rp=require(_0xa57c('0x5'));var fs=require('fs');var path=require(_0xa57c('0x6'));var rimraf=require(_0xa57c('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x33d1da,_0x1bf955){return _0x33d1da['define'](_0xa57c('0x8'),attributes,{'tableName':_0xa57c('0x9'),'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 0211a85..57e4f4b 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 _0xaae6=['error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaae6,0x84));var _0x6aae=function(_0x362566,_0x381629){_0x362566=_0x362566-0x0;var _0x55edfa=_0xaae6[_0x362566];return _0x55edfa;};'use strict';var _=require(_0x6aae('0x0'));var util=require(_0x6aae('0x1'));var moment=require(_0x6aae('0x2'));var BPromise=require(_0x6aae('0x3'));var rs=require(_0x6aae('0x4'));var fs=require('fs');var Redis=require(_0x6aae('0x5'));var db=require(_0x6aae('0x6'))['db'];var utils=require(_0x6aae('0x7'));var logger=require(_0x6aae('0x8'))(_0x6aae('0x9'));var config=require('../../config/environment');var jayson=require(_0x6aae('0xa'));var client=jayson['client'][_0x6aae('0xb')]({'port':0x232a});config[_0x6aae('0xc')]=_[_0x6aae('0xd')](config[_0x6aae('0xc')],{'host':_0x6aae('0xe'),'port':0x18eb});var socket=require(_0x6aae('0xf'))(new Redis(config[_0x6aae('0xc')]));require(_0x6aae('0x10'))[_0x6aae('0x11')](socket);function respondWithRpcPromise(_0x2c449b,_0x162e02,_0x3e4181){return new BPromise(function(_0x4764bf,_0x4eddc0){return client[_0x6aae('0x12')](_0x2c449b,_0x3e4181)[_0x6aae('0x13')](function(_0x160cc7){logger['info'](_0x6aae('0x14'),_0x162e02,'request\x20sent');logger[_0x6aae('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x162e02,_0x6aae('0x16'),JSON[_0x6aae('0x17')](_0x160cc7));if(_0x160cc7[_0x6aae('0x18')]){if(_0x160cc7['error'][_0x6aae('0x19')]===0x1f4){logger[_0x6aae('0x18')](_0x6aae('0x14'),_0x162e02,_0x160cc7['error'][_0x6aae('0x1a')]);return _0x4eddc0(_0x160cc7[_0x6aae('0x18')]['message']);}logger[_0x6aae('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x162e02,_0x160cc7[_0x6aae('0x18')][_0x6aae('0x1a')]);return _0x4764bf(_0x160cc7[_0x6aae('0x18')][_0x6aae('0x1a')]);}else{logger[_0x6aae('0x1b')](_0x6aae('0x14'),_0x162e02,_0x6aae('0x16'));_0x4764bf(_0x160cc7[_0x6aae('0x1c')][_0x6aae('0x1a')]);}})[_0x6aae('0x1d')](function(_0x2b8b55){logger[_0x6aae('0x18')](_0x6aae('0x14'),_0x162e02,_0x2b8b55);_0x4eddc0(_0x2b8b55);});});}exports[_0x6aae('0x1e')]=function(_0x486e6e){var _0x779a0a=this;return new Promise(function(_0x153943,_0x4fa7d0){return db[_0x6aae('0x1f')][_0x6aae('0x20')]({'raw':_0x486e6e[_0x6aae('0x21')]?_0x486e6e[_0x6aae('0x21')][_0x6aae('0x22')]===undefined?!![]:![]:!![],'where':_0x486e6e[_0x6aae('0x21')]?_0x486e6e[_0x6aae('0x21')][_0x6aae('0x23')]||null:null,'attributes':[[db['sequelize']['fn'](_0x6aae('0x24'),db[_0x6aae('0x25')]['fn']('IF',db[_0x6aae('0x25')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x6aae('0x26')]]})[_0x6aae('0x13')](function(_0x8fa9aa){logger[_0x6aae('0x1b')]('GetVoiceQueueRtPauses',_0x486e6e);logger[_0x6aae('0x15')](_0x6aae('0x1e'),_0x486e6e,JSON[_0x6aae('0x17')](_0x8fa9aa));_0x153943(_0x8fa9aa);})[_0x6aae('0x1d')](function(_0x295784){logger['error']('GetVoiceQueueRtPauses',_0x295784[_0x6aae('0x1a')],_0x486e6e);_0x4fa7d0(_0x779a0a[_0x6aae('0x18')](0x1f4,_0x295784['message']));});});}; \ No newline at end of file +var _0xde67=['result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','literal','outboundQueuePauses','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0xd37244,_0x1e708c){var _0x3b201d=function(_0x3c112d){while(--_0x3c112d){_0xd37244['push'](_0xd37244['shift']());}};_0x3b201d(++_0x1e708c);}(_0xde67,0x1e9));var _0x7de6=function(_0x396910,_0x397bda){_0x396910=_0x396910-0x0;var _0x217d81=_0xde67[_0x396910];return _0x217d81;};'use strict';var _=require(_0x7de6('0x0'));var util=require(_0x7de6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7de6('0x2'));var fs=require('fs');var Redis=require(_0x7de6('0x3'));var db=require(_0x7de6('0x4'))['db'];var utils=require(_0x7de6('0x5'));var logger=require(_0x7de6('0x6'))(_0x7de6('0x7'));var config=require(_0x7de6('0x8'));var jayson=require(_0x7de6('0x9'));var client=jayson['client'][_0x7de6('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7de6('0xb'))[_0x7de6('0xc')](socket);function respondWithRpcPromise(_0x91c4ed,_0x5a961b,_0x4ac753){return new BPromise(function(_0x10f6a2,_0x283c09){return client[_0x7de6('0xd')](_0x91c4ed,_0x4ac753)[_0x7de6('0xe')](function(_0x104bfb){logger[_0x7de6('0xf')](_0x7de6('0x10'),_0x5a961b,_0x7de6('0x11'));logger[_0x7de6('0x12')](_0x7de6('0x13'),_0x5a961b,_0x7de6('0x11'),JSON[_0x7de6('0x14')](_0x104bfb));if(_0x104bfb[_0x7de6('0x15')]){if(_0x104bfb[_0x7de6('0x15')]['code']===0x1f4){logger[_0x7de6('0x15')](_0x7de6('0x10'),_0x5a961b,_0x104bfb[_0x7de6('0x15')][_0x7de6('0x16')]);return _0x283c09(_0x104bfb[_0x7de6('0x15')][_0x7de6('0x16')]);}logger[_0x7de6('0x15')](_0x7de6('0x10'),_0x5a961b,_0x104bfb[_0x7de6('0x15')][_0x7de6('0x16')]);return _0x10f6a2(_0x104bfb[_0x7de6('0x15')][_0x7de6('0x16')]);}else{logger[_0x7de6('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5a961b,'request\x20sent');_0x10f6a2(_0x104bfb[_0x7de6('0x17')][_0x7de6('0x16')]);}})[_0x7de6('0x18')](function(_0x3fd5db){logger[_0x7de6('0x15')](_0x7de6('0x10'),_0x5a961b,_0x3fd5db);_0x283c09(_0x3fd5db);});});}exports[_0x7de6('0x19')]=function(_0x10c34a){var _0x59dc8e=this;return new Promise(function(_0x446e82,_0x2ea499){return db[_0x7de6('0x1a')]['findAll']({'raw':_0x10c34a[_0x7de6('0x1b')]?_0x10c34a[_0x7de6('0x1b')][_0x7de6('0x1c')]===undefined?!![]:![]:!![],'where':_0x10c34a[_0x7de6('0x1b')]?_0x10c34a[_0x7de6('0x1b')]['where']||null:null,'attributes':[[db[_0x7de6('0x1d')]['fn']('COUNT',db[_0x7de6('0x1d')]['fn']('IF',db[_0x7de6('0x1d')][_0x7de6('0x1e')]('`paused`\x20=\x201,\x201,\x20null'))),_0x7de6('0x1f')]]})[_0x7de6('0xe')](function(_0x362f71){logger[_0x7de6('0xf')]('GetVoiceQueueRtPauses',_0x10c34a);logger[_0x7de6('0x12')]('GetVoiceQueueRtPauses',_0x10c34a,JSON[_0x7de6('0x14')](_0x362f71));_0x446e82(_0x362f71);})[_0x7de6('0x18')](function(_0x2fdd45){logger[_0x7de6('0x15')]('GetVoiceQueueRtPauses',_0x2fdd45[_0x7de6('0x16')],_0x10c34a);_0x2ea499(_0x59dc8e[_0x7de6('0x15')](0x1f4,_0x2fdd45[_0x7de6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 49105ce..475c604 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 _0x49df=['emit','removeListener','register','length','userVoiceQueueRt:','remove','update'];(function(_0x1d1fa6,_0x331dc0){var _0x5e1a83=function(_0x526ece){while(--_0x526ece){_0x1d1fa6['push'](_0x1d1fa6['shift']());}};_0x5e1a83(++_0x331dc0);}(_0x49df,0xad));var _0xf49d=function(_0x22fc16,_0x53cf38){_0x22fc16=_0x22fc16-0x0;var _0x24e7b3=_0x49df[_0x22fc16];return _0x24e7b3;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xf49d('0x0'),_0xf49d('0x1')];function createListener(_0x4e297,_0x21eb98){return function(_0x3d07cf){_0x21eb98[_0xf49d('0x2')](_0x4e297,_0x3d07cf);};}function removeListener(_0x44b37e,_0x59cb9d){return function(){UserVoiceQueueRtEvents[_0xf49d('0x3')](_0x44b37e,_0x59cb9d);};}exports[_0xf49d('0x4')]=function(_0x325c19){for(var _0xca1090=0x0,_0x1aaf37=events[_0xf49d('0x5')];_0xca1090<_0x1aaf37;_0xca1090++){var _0x4e8b5e=events[_0xca1090];var _0xadfde5=createListener(_0xf49d('0x6')+_0x4e8b5e,_0x325c19);UserVoiceQueueRtEvents['on'](_0x4e8b5e,_0xadfde5);}}; \ No newline at end of file +var _0x1d7e=['remove','update','emit','removeListener','register','length','save'];(function(_0x3ca014,_0x392ae3){var _0x5bb06c=function(_0x307fb6){while(--_0x307fb6){_0x3ca014['push'](_0x3ca014['shift']());}};_0x5bb06c(++_0x392ae3);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x1d7e[_0x4243a3];return _0x1b2a33;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xe1d7('0x0'),_0xe1d7('0x1'),_0xe1d7('0x2')];function createListener(_0x47c24f,_0x141274){return function(_0x4c39bd){_0x141274[_0xe1d7('0x3')](_0x47c24f,_0x4c39bd);};}function removeListener(_0x118bc6,_0x354906){return function(){UserVoiceQueueRtEvents[_0xe1d7('0x4')](_0x118bc6,_0x354906);};}exports[_0xe1d7('0x5')]=function(_0x4058fe){for(var _0x252026=0x0,_0x867e5=events[_0xe1d7('0x6')];_0x252026<_0x867e5;_0x252026++){var _0x439ffd=events[_0x252026];var _0x3f1859=createListener('userVoiceQueueRt:'+_0x439ffd,_0x4058fe);UserVoiceQueueRtEvents['on'](_0x439ffd,_0x3f1859);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1ad8bc7..4c4dc63 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5b91d9,_0x2d1e3a){var _0x232963=function(_0x27ebf5){while(--_0x27ebf5){_0x5b91d9['push'](_0x5b91d9['shift']());}};_0x232963(++_0x2d1e3a);}(_0xedd9,0xfc));var _0x9edd=function(_0x53b4c,_0x255bf6){_0x53b4c=_0x53b4c-0x0;var _0x223533=_0xedd9[_0x53b4c];return _0x223533;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3dc07f,_0x47a5b3){var _0x58792a=function(_0x33e2cc){while(--_0x33e2cc){_0x3dc07f['push'](_0x3dc07f['shift']());}};_0x58792a(++_0x47a5b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d4a4ce0..f1bcb5d 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 _0x737e=['INTEGER','exports'];(function(_0x10dc9b,_0x173b34){var _0x1f767e=function(_0x51fe8c){while(--_0x51fe8c){_0x10dc9b['push'](_0x10dc9b['shift']());}};_0x1f767e(++_0x173b34);}(_0x737e,0xb9));var _0xe737=function(_0xb8901a,_0x36bada){_0xb8901a=_0xb8901a-0x0;var _0x4bc168=_0x737e[_0xb8901a];return _0x4bc168;};'use strict';var Sequelize=require('sequelize');module[_0xe737('0x0')]={'penalty':{'type':Sequelize[_0xe737('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1848=['INTEGER','sequelize','exports'];(function(_0x2bee90,_0x1b4409){var _0x1777a5=function(_0x53664d){while(--_0x53664d){_0x2bee90['push'](_0x2bee90['shift']());}};_0x1777a5(++_0x1b4409);}(_0x1848,0x166));var _0x8184=function(_0x44647a,_0x1d83bb){_0x44647a=_0x44647a-0x0;var _0x4d55a8=_0x1848[_0x44647a];return _0x4d55a8;};'use strict';var Sequelize=require(_0x8184('0x0'));module[_0x8184('0x1')]={'penalty':{'type':Sequelize[_0x8184('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e8307f5..39dc539 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 _0x1026=['../../config/logger','moment','path','./userWhatsappQueue.attributes','define','lodash','util'];(function(_0x3597ce,_0x53f918){var _0x3d258b=function(_0x123d18){while(--_0x123d18){_0x3597ce['push'](_0x3597ce['shift']());}};_0x3d258b(++_0x53f918);}(_0x1026,0x14e));var _0x6102=function(_0x11ba46,_0x1d6752){_0x11ba46=_0x11ba46-0x0;var _0x1c8c6f=_0x1026[_0x11ba46];return _0x1c8c6f;};'use strict';var _=require(_0x6102('0x0'));var util=require(_0x6102('0x1'));var logger=require(_0x6102('0x2'))('api');var moment=require(_0x6102('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6102('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6102('0x5'));module['exports']=function(_0x478b18,_0x3f29cd){return _0x478b18[_0x6102('0x6')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb1=['request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','util','moment'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xbbb1,0xcd));var _0x1bbb=function(_0x4c6351,_0x3be607){_0x4c6351=_0x4c6351-0x0;var _0x401038=_0xbbb1[_0x4c6351];return _0x401038;};'use strict';var _=require('lodash');var util=require(_0x1bbb('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1bbb('0x1'));var BPromise=require('bluebird');var rp=require(_0x1bbb('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1bbb('0x3'));var config=require(_0x1bbb('0x4'));var attributes=require(_0x1bbb('0x5'));module[_0x1bbb('0x6')]=function(_0x68ca6e,_0x48beba){return _0x68ca6e[_0x1bbb('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0x1bbb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 0d964af..4faa70b 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 _0x6500=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e4919,_0x56e6e8){var _0x521e71=function(_0x2e5407){while(--_0x2e5407){_0x4e4919['push'](_0x4e4919['shift']());}};_0x521e71(++_0x56e6e8);}(_0x6500,0x84));var _0x0650=function(_0x15b0d4,_0x5333b1){_0x15b0d4=_0x15b0d4-0x0;var _0x5d594e=_0x6500[_0x15b0d4];return _0x5d594e;};'use strict';var _=require(_0x0650('0x0'));var util=require('util');var moment=require(_0x0650('0x1'));var BPromise=require(_0x0650('0x2'));var rs=require(_0x0650('0x3'));var fs=require('fs');var Redis=require(_0x0650('0x4'));var db=require(_0x0650('0x5'))['db'];var utils=require(_0x0650('0x6'));var logger=require(_0x0650('0x7'))(_0x0650('0x8'));var config=require(_0x0650('0x9'));var jayson=require(_0x0650('0xa'));var client=jayson[_0x0650('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x594281,_0x5b9a48,_0x3bf3d1){return new BPromise(function(_0x37f670,_0x3aea0f){return client[_0x0650('0xc')](_0x594281,_0x3bf3d1)[_0x0650('0xd')](function(_0x55be48){logger[_0x0650('0xe')](_0x0650('0xf'),_0x5b9a48,'request\x20sent');logger[_0x0650('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5b9a48,'request\x20sent',JSON['stringify'](_0x55be48));if(_0x55be48['error']){if(_0x55be48['error'][_0x0650('0x11')]===0x1f4){logger['error'](_0x0650('0xf'),_0x5b9a48,_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);return _0x3aea0f(_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);}logger[_0x0650('0x12')](_0x0650('0xf'),_0x5b9a48,_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);return _0x37f670(_0x55be48[_0x0650('0x12')][_0x0650('0x13')]);}else{logger[_0x0650('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x5b9a48,_0x0650('0x14'));_0x37f670(_0x55be48[_0x0650('0x15')][_0x0650('0x13')]);}})[_0x0650('0x16')](function(_0x4e1136){logger['error'](_0x0650('0xf'),_0x5b9a48,_0x4e1136);_0x3aea0f(_0x4e1136);});});} \ No newline at end of file +var _0xe5c6=['rpc','client','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2fa255,_0x3ab888){var _0x865f6e=function(_0x57d25e){while(--_0x57d25e){_0x2fa255['push'](_0x2fa255['shift']());}};_0x865f6e(++_0x3ab888);}(_0xe5c6,0x107));var _0x6e5c=function(_0x59025d,_0x3bcf24){_0x59025d=_0x59025d-0x0;var _0x4474fb=_0xe5c6[_0x59025d];return _0x4474fb;};'use strict';var _=require('lodash');var util=require(_0x6e5c('0x0'));var moment=require(_0x6e5c('0x1'));var BPromise=require(_0x6e5c('0x2'));var rs=require(_0x6e5c('0x3'));var fs=require('fs');var Redis=require(_0x6e5c('0x4'));var db=require(_0x6e5c('0x5'))['db'];var utils=require(_0x6e5c('0x6'));var logger=require('../../config/logger')(_0x6e5c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6e5c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e7e23,_0x55e067,_0x5d2846){return new BPromise(function(_0x41c11c,_0x3edcfb){return client['request'](_0x3e7e23,_0x5d2846)['then'](function(_0x4274d3){logger[_0x6e5c('0x9')](_0x6e5c('0xa'),_0x55e067,_0x6e5c('0xb'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x55e067,'request\x20sent',JSON[_0x6e5c('0xc')](_0x4274d3));if(_0x4274d3[_0x6e5c('0xd')]){if(_0x4274d3[_0x6e5c('0xd')][_0x6e5c('0xe')]===0x1f4){logger['error'](_0x6e5c('0xa'),_0x55e067,_0x4274d3[_0x6e5c('0xd')][_0x6e5c('0xf')]);return _0x3edcfb(_0x4274d3[_0x6e5c('0xd')]['message']);}logger[_0x6e5c('0xd')](_0x6e5c('0xa'),_0x55e067,_0x4274d3[_0x6e5c('0xd')][_0x6e5c('0xf')]);return _0x41c11c(_0x4274d3[_0x6e5c('0xd')][_0x6e5c('0xf')]);}else{logger[_0x6e5c('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x55e067,_0x6e5c('0xb'));_0x41c11c(_0x4274d3[_0x6e5c('0x10')][_0x6e5c('0xf')]);}})[_0x6e5c('0x11')](function(_0x361064){logger[_0x6e5c('0xd')](_0x6e5c('0xa'),_0x55e067,_0x361064);_0x3edcfb(_0x361064);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d39ea20..ecb4f13 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 _0x5b7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x1ac4bb,_0x1ab73a){_0x1ac4bb=_0x1ac4bb-0x0;var _0x348d0c=_0x5b7f[_0x1ac4bb];return _0x348d0c;};'use strict';var multer=require(_0xf5b7('0x0'));var util=require(_0xf5b7('0x1'));var path=require(_0xf5b7('0x2'));var timeout=require(_0xf5b7('0x3'));var express=require(_0xf5b7('0x4'));var router=express[_0xf5b7('0x5')]();var fs_extra=require(_0xf5b7('0x6'));var auth=require(_0xf5b7('0x7'));var interaction=require(_0xf5b7('0x8'));var config=require(_0xf5b7('0x9'));var controller=require(_0xf5b7('0xa'));router[_0xf5b7('0xb')]('/',auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xd')]);router[_0xf5b7('0xb')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf5b7('0x10')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x11')]);router[_0xf5b7('0x12')](_0xf5b7('0xe'),auth[_0xf5b7('0xc')](),controller[_0xf5b7('0x13')]);module[_0xf5b7('0x14')]=router; \ No newline at end of file +var _0xc978=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0xe')]);router[_0x8c97('0xf')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0x11')]('/:id',auth[_0x8c97('0xb')](),controller[_0x8c97('0x12')]);router[_0x8c97('0x13')](_0x8c97('0xd'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x14')]);module[_0x8c97('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c4ac6e6..4fc1c53 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 _0x41a6=['STRING','name'];(function(_0x4d431e,_0x4b37c9){var _0x887d02=function(_0xe6b7b){while(--_0xe6b7b){_0x4d431e['push'](_0x4d431e['shift']());}};_0x887d02(++_0x4b37c9);}(_0x41a6,0x16b));var _0x641a=function(_0x77a42b,_0x25c9b3){_0x77a42b=_0x77a42b-0x0;var _0x8f2a8a=_0x41a6[_0x77a42b];return _0x8f2a8a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x641a('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x641a('0x1')]}}; \ No newline at end of file +var _0x5f96=['name','sequelize','exports','STRING'];(function(_0x3a2855,_0x3495e1){var _0x1fc9cc=function(_0x3265f3){while(--_0x3265f3){_0x3a2855['push'](_0x3a2855['shift']());}};_0x1fc9cc(++_0x3495e1);}(_0x5f96,0x75));var _0x65f9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x5f96[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x65f9('0x0'));module[_0x65f9('0x1')]={'name':{'type':Sequelize[_0x65f9('0x2')],'unique':_0x65f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x65f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 2366461..01fd9b5 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 _0x2125=['update','then','destroy','get','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0xcdfc26,_0x2949e0){var _0x38ad7f=function(_0x3f9841){while(--_0x3f9841){_0xcdfc26['push'](_0xcdfc26['shift']());}};_0x38ad7f(++_0x2949e0);}(_0x2125,0x85));var _0x5212=function(_0x249d9f,_0x17d2b2){_0x249d9f=_0x249d9f-0x0;var _0x24e8bd=_0x2125[_0x249d9f];return _0x24e8bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5212('0x0'));var jsonpatch=require(_0x5212('0x1'));var rp=require(_0x5212('0x2'));var moment=require(_0x5212('0x3'));var BPromise=require(_0x5212('0x4'));var Mustache=require(_0x5212('0x5'));var util=require(_0x5212('0x6'));var path=require(_0x5212('0x7'));var sox=require(_0x5212('0x8'));var csv=require(_0x5212('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5212('0xa'));var _=require('lodash');var squel=require(_0x5212('0xb'));var crypto=require(_0x5212('0xc'));var jsforce=require(_0x5212('0xd'));var deskjs=require(_0x5212('0xe'));var toCsv=require(_0x5212('0x9'));var querystring=require(_0x5212('0xf'));var Papa=require(_0x5212('0x10'));var Redis=require(_0x5212('0x11'));var authService=require(_0x5212('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5212('0x13'));var logger=require(_0x5212('0x14'))(_0x5212('0x15'));var utils=require(_0x5212('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5212('0x17'))['db'];function respondWithStatusCode(_0x481e18,_0x331071){_0x331071=_0x331071||0xcc;return function(_0x10e265){if(_0x10e265){return _0x481e18[_0x5212('0x18')](_0x331071);}return _0x481e18[_0x5212('0x19')](_0x331071)[_0x5212('0x1a')]();};}function respondWithResult(_0x404cc9,_0x56ef54){_0x56ef54=_0x56ef54||0xc8;return function(_0x36c6ac){if(_0x36c6ac){return _0x404cc9[_0x5212('0x19')](_0x56ef54)[_0x5212('0x1b')](_0x36c6ac);}};}function respondWithFilteredResult(_0x819fbd,_0x1e2b96){return function(_0x29f1d8){if(_0x29f1d8){var _0x46ab04=typeof _0x1e2b96[_0x5212('0x1c')]===_0x5212('0x1d')&&typeof _0x1e2b96[_0x5212('0x1e')]===_0x5212('0x1d');var _0x15c4d1=_0x29f1d8[_0x5212('0x1f')];var _0x3c3306=_0x46ab04?0x0:_0x1e2b96[_0x5212('0x1c')];var _0x128bdb=_0x46ab04?_0x29f1d8[_0x5212('0x1f')]:_0x1e2b96[_0x5212('0x1c')]+_0x1e2b96[_0x5212('0x1e')];var _0x4de94e;if(_0x128bdb>=_0x15c4d1){_0x128bdb=_0x15c4d1;_0x4de94e=0xc8;}else{_0x4de94e=0xce;}_0x819fbd['status'](_0x4de94e);return _0x819fbd[_0x5212('0x20')](_0x5212('0x21'),_0x3c3306+'-'+_0x128bdb+'/'+_0x15c4d1)[_0x5212('0x1b')](_0x29f1d8);}return null;};}function patchUpdates(_0x4bf7ac){return function(_0x4638e8){try{jsonpatch[_0x5212('0x22')](_0x4638e8,_0x4bf7ac,!![]);}catch(_0x5b6431){return BPromise['reject'](_0x5b6431);}return _0x4638e8['save']();};}function saveUpdates(_0x11fa46,_0x1d6c3b){return function(_0x4c0cee){if(_0x4c0cee){return _0x4c0cee[_0x5212('0x23')](_0x11fa46)[_0x5212('0x24')](function(_0x4b4224){return _0x4b4224;});}return null;};}function removeEntity(_0x11083a,_0x1a329c){return function(_0x4b836e){if(_0x4b836e){return _0x4b836e[_0x5212('0x25')]()[_0x5212('0x24')](function(){var _0x50122a=_0x4b836e[_0x5212('0x26')]({'plain':!![]});var _0x4a8041=_0x5212('0x27');return db['UserProfileResource'][_0x5212('0x25')]({'where':{'type':_0x4a8041,'resourceId':_0x50122a['id']}})[_0x5212('0x24')](function(){return _0x4b836e;});})[_0x5212('0x24')](function(){_0x11083a[_0x5212('0x19')](0xcc)[_0x5212('0x1a')]();});}};}function handleEntityNotFound(_0x1cacea,_0x5f1651){return function(_0x2d5207){if(!_0x2d5207){_0x1cacea['sendStatus'](0x194);}return _0x2d5207;};}function handleError(_0x546833,_0x154c59){_0x154c59=_0x154c59||0x1f4;return function(_0x58d855){logger[_0x5212('0x28')](_0x58d855[_0x5212('0x29')]);if(_0x58d855[_0x5212('0x2a')]){delete _0x58d855[_0x5212('0x2a')];}_0x546833['status'](_0x154c59)[_0x5212('0x2b')](_0x58d855);};}exports[_0x5212('0x2c')]=function(_0x3bd55c,_0x209a31){var _0x1fef06={},_0x5b026f={},_0xb51953={'count':0x0,'rows':[]};var _0xc866a=_[_0x5212('0x2d')](db[_0x5212('0x2e')][_0x5212('0x2f')],function(_0xc1b238){return{'name':_0xc1b238[_0x5212('0x30')],'type':_0xc1b238[_0x5212('0x31')][_0x5212('0x32')]};});_0x5b026f[_0x5212('0x33')]=_['map'](_0xc866a,'name');_0x5b026f['query']=_[_0x5212('0x34')](_0x3bd55c[_0x5212('0x35')]);_0x5b026f[_0x5212('0x36')]=_[_0x5212('0x37')](_0x5b026f[_0x5212('0x33')],_0x5b026f[_0x5212('0x35')]);_0x1fef06[_0x5212('0x38')]=_[_0x5212('0x37')](_0x5b026f[_0x5212('0x33')],qs[_0x5212('0x39')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x39')]));_0x1fef06['attributes']=_0x1fef06['attributes'][_0x5212('0x3a')]?_0x1fef06[_0x5212('0x38')]:_0x5b026f['model'];if(!_0x3bd55c[_0x5212('0x35')]['hasOwnProperty'](_0x5212('0x3b'))){_0x1fef06[_0x5212('0x1e')]=qs[_0x5212('0x1e')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x1e')]);_0x1fef06['offset']=qs[_0x5212('0x1c')](_0x3bd55c[_0x5212('0x35')][_0x5212('0x1c')]);}_0x1fef06[_0x5212('0x3c')]=qs[_0x5212('0x3d')](_0x3bd55c[_0x5212('0x35')]['sort']);_0x1fef06[_0x5212('0x3e')]=qs[_0x5212('0x36')](_[_0x5212('0x3f')](_0x3bd55c['query'],_0x5b026f[_0x5212('0x36')]),_0xc866a);if(_0x3bd55c[_0x5212('0x35')][_0x5212('0x40')]){_0x1fef06['where']=_['merge'](_0x1fef06[_0x5212('0x3e')],{'$or':_['map'](_0xc866a,function(_0xe1d907){if(_0xe1d907['type']!==_0x5212('0x41')){var _0x2375e8={};_0x2375e8[_0xe1d907[_0x5212('0x2a')]]={'$like':'%'+_0x3bd55c[_0x5212('0x35')][_0x5212('0x40')]+'%'};return _0x2375e8;}})});}_0x1fef06=_[_0x5212('0x42')]({},_0x1fef06,_0x3bd55c[_0x5212('0x43')]);var _0x467690={'where':_0x1fef06['where']};return db['Variable'][_0x5212('0x1f')](_0x467690)[_0x5212('0x24')](function(_0x729b4f){_0xb51953['count']=_0x729b4f;if(_0x3bd55c[_0x5212('0x35')][_0x5212('0x44')]){_0x1fef06[_0x5212('0x45')]=[{'all':!![]}];}return db[_0x5212('0x2e')][_0x5212('0x46')](_0x1fef06);})[_0x5212('0x24')](function(_0x289f65){_0xb51953[_0x5212('0x47')]=_0x289f65;return _0xb51953;})[_0x5212('0x24')](respondWithFilteredResult(_0x209a31,_0x1fef06))[_0x5212('0x48')](handleError(_0x209a31,null));};exports[_0x5212('0x49')]=function(_0x33815d,_0xfe4f71){var _0x2f1137={'raw':!![],'where':{'id':_0x33815d[_0x5212('0x4a')]['id']}},_0x3effea={};_0x3effea[_0x5212('0x33')]=_['keys'](db[_0x5212('0x2e')][_0x5212('0x2f')]);_0x3effea[_0x5212('0x35')]=_['keys'](_0x33815d[_0x5212('0x35')]);_0x3effea[_0x5212('0x36')]=_['intersection'](_0x3effea[_0x5212('0x33')],_0x3effea[_0x5212('0x35')]);_0x2f1137[_0x5212('0x38')]=_[_0x5212('0x37')](_0x3effea[_0x5212('0x33')],qs['fields'](_0x33815d['query'][_0x5212('0x39')]));_0x2f1137[_0x5212('0x38')]=_0x2f1137[_0x5212('0x38')]['length']?_0x2f1137[_0x5212('0x38')]:_0x3effea[_0x5212('0x33')];if(_0x33815d[_0x5212('0x35')][_0x5212('0x44')]){_0x2f1137[_0x5212('0x45')]=[{'all':!![]}];}_0x2f1137=_[_0x5212('0x42')]({},_0x2f1137,_0x33815d[_0x5212('0x43')]);return db['Variable'][_0x5212('0x4b')](_0x2f1137)[_0x5212('0x24')](handleEntityNotFound(_0xfe4f71,null))[_0x5212('0x24')](respondWithResult(_0xfe4f71,null))[_0x5212('0x48')](handleError(_0xfe4f71,null));};exports['create']=function(_0x501b42,_0x476ee7){return db[_0x5212('0x2e')]['create'](_0x501b42[_0x5212('0x4c')],{})[_0x5212('0x24')](function(_0x153376){var _0x19db1e=_0x501b42[_0x5212('0x4d')][_0x5212('0x26')]({'plain':!![]});if(!_0x19db1e)throw new Error(_0x5212('0x4e'));if(_0x19db1e[_0x5212('0x4f')]==='user'){var _0x36ca29=_0x153376['get']({'plain':!![]});var _0x47465e=_0x5212('0x27');return db[_0x5212('0x50')][_0x5212('0x4b')]({'where':{'name':_0x47465e,'userProfileId':_0x19db1e['userProfileId']},'raw':!![]})[_0x5212('0x24')](function(_0xf71acb){if(_0xf71acb&&_0xf71acb[_0x5212('0x51')]===0x0){return db[_0x5212('0x52')][_0x5212('0x53')]({'name':_0x36ca29['name'],'resourceId':_0x36ca29['id'],'type':_0xf71acb[_0x5212('0x2a')],'sectionId':_0xf71acb['id']},{})[_0x5212('0x24')](function(){return _0x153376;});}else{return _0x153376;}})[_0x5212('0x48')](function(_0x116bd2){logger[_0x5212('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x116bd2);throw _0x116bd2;});}return _0x153376;})[_0x5212('0x24')](respondWithResult(_0x476ee7,0xc9))[_0x5212('0x48')](handleError(_0x476ee7,null));};exports[_0x5212('0x23')]=function(_0x46a91e,_0x13c2ea){if(_0x46a91e[_0x5212('0x4c')]['id']){delete _0x46a91e[_0x5212('0x4c')]['id'];}return db[_0x5212('0x2e')][_0x5212('0x4b')]({'where':{'id':_0x46a91e[_0x5212('0x4a')]['id']}})[_0x5212('0x24')](handleEntityNotFound(_0x13c2ea,null))[_0x5212('0x24')](saveUpdates(_0x46a91e[_0x5212('0x4c')],null))[_0x5212('0x24')](respondWithResult(_0x13c2ea,null))[_0x5212('0x48')](handleError(_0x13c2ea,null));};exports['destroy']=function(_0x83e628,_0x14793d){return db[_0x5212('0x2e')]['find']({'where':{'id':_0x83e628['params']['id']}})[_0x5212('0x24')](handleEntityNotFound(_0x14793d,null))[_0x5212('0x24')](removeEntity(_0x14793d,null))['catch'](handleError(_0x14793d,null));}; \ No newline at end of file +var _0x569d=['hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','Variable','include','findAll','rows','params','keys','includeAll','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','Variables','sendStatus','send','map','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length'];(function(_0x822939,_0x34bc67){var _0x476773=function(_0x5e2a68){while(--_0x5e2a68){_0x822939['push'](_0x822939['shift']());}};_0x476773(++_0x34bc67);}(_0x569d,0x6d));var _0xd569=function(_0x129f74,_0x3d64d8){_0x129f74=_0x129f74-0x0;var _0x1cf683=_0x569d[_0x129f74];return _0x1cf683;};'use strict';var emlformat=require(_0xd569('0x0'));var rimraf=require(_0xd569('0x1'));var zipdir=require(_0xd569('0x2'));var jsonpatch=require(_0xd569('0x3'));var rp=require(_0xd569('0x4'));var moment=require(_0xd569('0x5'));var BPromise=require(_0xd569('0x6'));var Mustache=require(_0xd569('0x7'));var util=require(_0xd569('0x8'));var path=require('path');var sox=require(_0xd569('0x9'));var csv=require(_0xd569('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd569('0xb'));var _=require('lodash');var squel=require(_0xd569('0xc'));var crypto=require('crypto');var jsforce=require(_0xd569('0xd'));var deskjs=require(_0xd569('0xe'));var toCsv=require(_0xd569('0xa'));var querystring=require(_0xd569('0xf'));var Papa=require(_0xd569('0x10'));var Redis=require(_0xd569('0x11'));var authService=require(_0xd569('0x12'));var qs=require(_0xd569('0x13'));var as=require(_0xd569('0x14'));var hardwareService=require(_0xd569('0x15'));var logger=require(_0xd569('0x16'))('api');var utils=require(_0xd569('0x17'));var config=require(_0xd569('0x18'));var licenseUtil=require(_0xd569('0x19'));var db=require(_0xd569('0x1a'))['db'];function respondWithStatusCode(_0x405f9b,_0x576adb){_0x576adb=_0x576adb||0xcc;return function(_0x4325ae){if(_0x4325ae){return _0x405f9b['sendStatus'](_0x576adb);}return _0x405f9b[_0xd569('0x1b')](_0x576adb)[_0xd569('0x1c')]();};}function respondWithResult(_0x15d396,_0xfa5334){_0xfa5334=_0xfa5334||0xc8;return function(_0xf91cda){if(_0xf91cda){return _0x15d396[_0xd569('0x1b')](_0xfa5334)['json'](_0xf91cda);}};}function respondWithFilteredResult(_0x38e563,_0x3af506){return function(_0x5eee65){if(_0x5eee65){var _0x14884e=typeof _0x3af506[_0xd569('0x1d')]===_0xd569('0x1e')&&typeof _0x3af506[_0xd569('0x1f')]===_0xd569('0x1e');var _0x3d9f13=_0x5eee65[_0xd569('0x20')];var _0x2ebd11=_0x14884e?0x0:_0x3af506['offset'];var _0x3e3487=_0x14884e?_0x5eee65[_0xd569('0x20')]:_0x3af506[_0xd569('0x1d')]+_0x3af506[_0xd569('0x1f')];var _0x2ce093;if(_0x3e3487>=_0x3d9f13){_0x3e3487=_0x3d9f13;_0x2ce093=0xc8;}else{_0x2ce093=0xce;}_0x38e563['status'](_0x2ce093);return _0x38e563[_0xd569('0x21')](_0xd569('0x22'),_0x2ebd11+'-'+_0x3e3487+'/'+_0x3d9f13)[_0xd569('0x23')](_0x5eee65);}return null;};}function patchUpdates(_0x5b3e94){return function(_0x1bdaad){try{jsonpatch['apply'](_0x1bdaad,_0x5b3e94,!![]);}catch(_0x489401){return BPromise['reject'](_0x489401);}return _0x1bdaad[_0xd569('0x24')]();};}function saveUpdates(_0x271921,_0x654616){return function(_0x1e4cc5){if(_0x1e4cc5){return _0x1e4cc5[_0xd569('0x25')](_0x271921)[_0xd569('0x26')](function(_0x53c26d){return _0x53c26d;});}return null;};}function removeEntity(_0x3bfc1a,_0x5f08df){return function(_0x2f1f57){if(_0x2f1f57){return _0x2f1f57[_0xd569('0x27')]()[_0xd569('0x26')](function(){var _0x1b1b9a=_0x2f1f57['get']({'plain':!![]});var _0xc67db1=_0xd569('0x28');return db['UserProfileResource'][_0xd569('0x27')]({'where':{'type':_0xc67db1,'resourceId':_0x1b1b9a['id']}})[_0xd569('0x26')](function(){return _0x2f1f57;});})['then'](function(){_0x3bfc1a[_0xd569('0x1b')](0xcc)[_0xd569('0x1c')]();});}};}function handleEntityNotFound(_0xf2abcc,_0xa17900){return function(_0x1d469b){if(!_0x1d469b){_0xf2abcc[_0xd569('0x29')](0x194);}return _0x1d469b;};}function handleError(_0x916b8b,_0x882f85){_0x882f85=_0x882f85||0x1f4;return function(_0x5ba2a0){logger['error'](_0x5ba2a0['stack']);if(_0x5ba2a0['name']){delete _0x5ba2a0['name'];}_0x916b8b['status'](_0x882f85)[_0xd569('0x2a')](_0x5ba2a0);};}exports['index']=function(_0x4d7793,_0x378ae0){var _0x240655={},_0x14fc14={},_0x157c43={'count':0x0,'rows':[]};var _0x5b5e94=_[_0xd569('0x2b')](db['Variable'][_0xd569('0x2c')],function(_0x24b4e6){return{'name':_0x24b4e6['fieldName'],'type':_0x24b4e6[_0xd569('0x2d')][_0xd569('0x2e')]};});_0x14fc14[_0xd569('0x2f')]=_['map'](_0x5b5e94,_0xd569('0x30'));_0x14fc14[_0xd569('0x31')]=_['keys'](_0x4d7793[_0xd569('0x31')]);_0x14fc14[_0xd569('0x32')]=_['intersection'](_0x14fc14[_0xd569('0x2f')],_0x14fc14[_0xd569('0x31')]);_0x240655['attributes']=_[_0xd569('0x33')](_0x14fc14[_0xd569('0x2f')],qs[_0xd569('0x34')](_0x4d7793[_0xd569('0x31')][_0xd569('0x34')]));_0x240655[_0xd569('0x35')]=_0x240655[_0xd569('0x35')][_0xd569('0x36')]?_0x240655['attributes']:_0x14fc14[_0xd569('0x2f')];if(!_0x4d7793[_0xd569('0x31')][_0xd569('0x37')](_0xd569('0x38'))){_0x240655[_0xd569('0x1f')]=qs[_0xd569('0x1f')](_0x4d7793[_0xd569('0x31')][_0xd569('0x1f')]);_0x240655['offset']=qs[_0xd569('0x1d')](_0x4d7793[_0xd569('0x31')][_0xd569('0x1d')]);}_0x240655[_0xd569('0x39')]=qs[_0xd569('0x3a')](_0x4d7793[_0xd569('0x31')][_0xd569('0x3a')]);_0x240655[_0xd569('0x3b')]=qs[_0xd569('0x32')](_[_0xd569('0x3c')](_0x4d7793['query'],_0x14fc14[_0xd569('0x32')]),_0x5b5e94);if(_0x4d7793[_0xd569('0x31')]['filter']){_0x240655['where']=_[_0xd569('0x3d')](_0x240655[_0xd569('0x3b')],{'$or':_['map'](_0x5b5e94,function(_0x5153eb){if(_0x5153eb[_0xd569('0x2d')]!=='VIRTUAL'){var _0x52bfa2={};_0x52bfa2[_0x5153eb['name']]={'$like':'%'+_0x4d7793[_0xd569('0x31')][_0xd569('0x3e')]+'%'};return _0x52bfa2;}})});}_0x240655=_[_0xd569('0x3d')]({},_0x240655,_0x4d7793[_0xd569('0x3f')]);var _0x1d83b1={'where':_0x240655[_0xd569('0x3b')]};return db[_0xd569('0x40')][_0xd569('0x20')](_0x1d83b1)[_0xd569('0x26')](function(_0x7717fd){_0x157c43['count']=_0x7717fd;if(_0x4d7793[_0xd569('0x31')]['includeAll']){_0x240655[_0xd569('0x41')]=[{'all':!![]}];}return db['Variable'][_0xd569('0x42')](_0x240655);})[_0xd569('0x26')](function(_0x4da685){_0x157c43[_0xd569('0x43')]=_0x4da685;return _0x157c43;})[_0xd569('0x26')](respondWithFilteredResult(_0x378ae0,_0x240655))['catch'](handleError(_0x378ae0,null));};exports['show']=function(_0x2defe5,_0x327419){var _0x5d8837={'raw':!![],'where':{'id':_0x2defe5[_0xd569('0x44')]['id']}},_0x23c577={};_0x23c577[_0xd569('0x2f')]=_['keys'](db[_0xd569('0x40')][_0xd569('0x2c')]);_0x23c577['query']=_[_0xd569('0x45')](_0x2defe5[_0xd569('0x31')]);_0x23c577[_0xd569('0x32')]=_[_0xd569('0x33')](_0x23c577[_0xd569('0x2f')],_0x23c577[_0xd569('0x31')]);_0x5d8837[_0xd569('0x35')]=_[_0xd569('0x33')](_0x23c577[_0xd569('0x2f')],qs[_0xd569('0x34')](_0x2defe5[_0xd569('0x31')][_0xd569('0x34')]));_0x5d8837[_0xd569('0x35')]=_0x5d8837[_0xd569('0x35')][_0xd569('0x36')]?_0x5d8837['attributes']:_0x23c577[_0xd569('0x2f')];if(_0x2defe5['query'][_0xd569('0x46')]){_0x5d8837[_0xd569('0x41')]=[{'all':!![]}];}_0x5d8837=_[_0xd569('0x3d')]({},_0x5d8837,_0x2defe5['options']);return db[_0xd569('0x40')][_0xd569('0x47')](_0x5d8837)[_0xd569('0x26')](handleEntityNotFound(_0x327419,null))['then'](respondWithResult(_0x327419,null))[_0xd569('0x48')](handleError(_0x327419,null));};exports[_0xd569('0x49')]=function(_0x1dfff7,_0x11c4e6){return db[_0xd569('0x40')]['create'](_0x1dfff7[_0xd569('0x4a')],{})[_0xd569('0x26')](function(_0x5307b3){var _0x307f38=_0x1dfff7['user'][_0xd569('0x4b')]({'plain':!![]});if(!_0x307f38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x307f38[_0xd569('0x4c')]===_0xd569('0x4d')){var _0x1d3ce9=_0x5307b3[_0xd569('0x4b')]({'plain':!![]});var _0x6e17c1=_0xd569('0x28');return db[_0xd569('0x4e')]['find']({'where':{'name':_0x6e17c1,'userProfileId':_0x307f38[_0xd569('0x4f')]},'raw':!![]})[_0xd569('0x26')](function(_0x3ed2d3){if(_0x3ed2d3&&_0x3ed2d3[_0xd569('0x50')]===0x0){return db[_0xd569('0x51')][_0xd569('0x49')]({'name':_0x1d3ce9[_0xd569('0x30')],'resourceId':_0x1d3ce9['id'],'type':_0x3ed2d3[_0xd569('0x30')],'sectionId':_0x3ed2d3['id']},{})[_0xd569('0x26')](function(){return _0x5307b3;});}else{return _0x5307b3;}})[_0xd569('0x48')](function(_0x13455f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13455f);throw _0x13455f;});}return _0x5307b3;})['then'](respondWithResult(_0x11c4e6,0xc9))[_0xd569('0x48')](handleError(_0x11c4e6,null));};exports[_0xd569('0x25')]=function(_0xe09d15,_0x242d97){if(_0xe09d15[_0xd569('0x4a')]['id']){delete _0xe09d15[_0xd569('0x4a')]['id'];}return db['Variable']['find']({'where':{'id':_0xe09d15['params']['id']}})['then'](handleEntityNotFound(_0x242d97,null))[_0xd569('0x26')](saveUpdates(_0xe09d15['body'],null))[_0xd569('0x26')](respondWithResult(_0x242d97,null))[_0xd569('0x48')](handleError(_0x242d97,null));};exports[_0xd569('0x27')]=function(_0x5c3d00,_0x315e56){return db[_0xd569('0x40')][_0xd569('0x47')]({'where':{'id':_0x5c3d00['params']['id']}})[_0xd569('0x26')](handleEntityNotFound(_0x315e56,null))[_0xd569('0x26')](removeEntity(_0x315e56,null))[_0xd569('0x48')](handleError(_0x315e56,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0403340..ab57666 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 _0xe0a9=['./variable.attributes','Variable','tools_variables','lodash','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x22fe1d,_0xda3ae9){var _0x6e6b29=function(_0x4e489c){while(--_0x4e489c){_0x22fe1d['push'](_0x22fe1d['shift']());}};_0x6e6b29(++_0xda3ae9);}(_0xe0a9,0x8b));var _0x9e0a=function(_0x12cbad,_0x1d5de4){_0x12cbad=_0x12cbad-0x0;var _0x593568=_0xe0a9[_0x12cbad];return _0x593568;};'use strict';var _=require(_0x9e0a('0x0'));var util=require('util');var logger=require(_0x9e0a('0x1'))('api');var moment=require(_0x9e0a('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e0a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e0a('0x4'));var attributes=require(_0x9e0a('0x5'));module['exports']=function(_0x319d09,_0x4f3721){return _0x319d09['define'](_0x9e0a('0x6'),attributes,{'tableName':_0x9e0a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cfd=['Variable','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0x1cedd0,_0x34ad38){var _0xd1cafb=function(_0x416468){while(--_0x416468){_0x1cedd0['push'](_0x1cedd0['shift']());}};_0xd1cafb(++_0x34ad38);}(_0x4cfd,0x114));var _0xd4cf=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x4cfd[_0x49beea];return _0x27693a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd4cf('0x0'))(_0xd4cf('0x1'));var moment=require(_0xd4cf('0x2'));var BPromise=require(_0xd4cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4cf('0x4'));var rimraf=require(_0xd4cf('0x5'));var config=require(_0xd4cf('0x6'));var attributes=require(_0xd4cf('0x7'));module[_0xd4cf('0x8')]=function(_0x596698,_0x2fc2ae){return _0x596698[_0xd4cf('0x9')](_0xd4cf('0xa'),attributes,{'tableName':'tools_variables','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 b5405fa..c616bf6 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x407473,_0x1921d3){var _0xa1e5aa=function(_0x478e17){while(--_0x478e17){_0x407473['push'](_0x407473['shift']());}};_0xa1e5aa(++_0x1921d3);}(_0x814b,0x1a2));var _0xb814=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x814b[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x41b74b,_0x162818){var _0xc362ea=function(_0x2c410e){while(--_0x2c410e){_0x41b74b['push'](_0x41b74b['shift']());}};_0xc362ea(++_0x162818);}(_0x6aa7,0x178));var _0x76aa=function(_0xc5c1da,_0x14444b){_0xc5c1da=_0xc5c1da-0x0;var _0x3731f8=_0x6aa7[_0xc5c1da];return _0x3731f8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index f5f14bc..ad3e183 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 _0x041f=['isAuthenticated','/reset','reset','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x472efd,_0x187147){var _0x2a6d15=function(_0x25bd29){while(--_0x25bd29){_0x472efd['push'](_0x472efd['shift']());}};_0x2a6d15(++_0x187147);}(_0x041f,0x94));var _0xf041=function(_0x3411ad,_0x1f2fe2){_0x3411ad=_0x3411ad-0x0;var _0x18edca=_0x041f[_0x3411ad];return _0x18edca;};'use strict';var express=require('express');var router=express[_0xf041('0x0')]();var auth=require(_0xf041('0x1'));var controller=require(_0xf041('0x2'));router[_0xf041('0x3')]('/',controller[_0xf041('0x4')]);router[_0xf041('0x3')](_0xf041('0x5'),auth[_0xf041('0x6')](),auth['canUpdate'](),controller['fetch']);router[_0xf041('0x3')](_0xf041('0x7'),auth[_0xf041('0x6')](),auth['canUpdate'](),controller[_0xf041('0x8')]);router[_0xf041('0x3')]('/pull',auth[_0xf041('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xf041('0x3')](_0xf041('0x9'),auth[_0xf041('0x6')](),controller[_0xf041('0xa')]);router['get'](_0xf041('0xb'),controller[_0xf041('0xc')]);module[_0xf041('0xd')]=router; \ No newline at end of file +var _0xd6a6=['/migrations','express','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','pull','/restart'];(function(_0x1edd66,_0x1d6d00){var _0x27ac08=function(_0x2ffa39){while(--_0x2ffa39){_0x1edd66['push'](_0x1edd66['shift']());}};_0x27ac08(++_0x1d6d00);}(_0xd6a6,0x1dd));var _0x6d6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6a6[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x6d6a('0x0'));var router=express['Router']();var auth=require(_0x6d6a('0x1'));var controller=require(_0x6d6a('0x2'));router[_0x6d6a('0x3')]('/',controller['index']);router[_0x6d6a('0x3')](_0x6d6a('0x4'),auth['isAuthenticated'](),auth[_0x6d6a('0x5')](),controller[_0x6d6a('0x6')]);router[_0x6d6a('0x3')](_0x6d6a('0x7'),auth[_0x6d6a('0x8')](),auth[_0x6d6a('0x5')](),controller[_0x6d6a('0x9')]);router[_0x6d6a('0x3')](_0x6d6a('0xa'),auth['isAuthenticated'](),auth[_0x6d6a('0x5')](),controller[_0x6d6a('0xb')]);router['get'](_0x6d6a('0xc'),auth['isAuthenticated'](),controller['restart']);router[_0x6d6a('0x3')](_0x6d6a('0xd'),controller['migrations']);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 9242f48..bc08fd2 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 _0xc3c0=['npm\x20install\x20--production','info','restart','motion2','then','join','server','replace','.js','length','sequelize','constructor','migrations','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','Database\x20already\x20up-to-date','lodash','version','compare-versions','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x5e8f4b,_0x9fdac4){var _0x368d10=function(_0x1574ad){while(--_0x1574ad){_0x5e8f4b['push'](_0x5e8f4b['shift']());}};_0x368d10(++_0x9fdac4);}(_0xc3c0,0x1b0));var _0x0c3c=function(_0x350658,_0x5cc88d){_0x350658=_0x350658-0x0;var _0x6e49d6=_0xc3c0[_0x350658];return _0x6e49d6;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x0c3c('0x0'));var pkginfo=require('pkginfo')(module,_0x0c3c('0x1'));var compareVersions=require(_0x0c3c('0x2'));var exec=require('child_process')[_0x0c3c('0x3')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x0c3c('0x4'));var logger=require(_0x0c3c('0x5'))(_0x0c3c('0x6'));var git=require(_0x0c3c('0x7'))(config[_0x0c3c('0x8')]);exports[_0x0c3c('0x9')]=function(_0x261f04,_0xfdff3d){var _0x1dc7d6={'current':module['exports'][_0x0c3c('0x1')],'phonebar':0x2};if(_0x261f04[_0x0c3c('0xa')]&&_0x261f04[_0x0c3c('0xa')][_0x0c3c('0xb')]){return git[_0x0c3c('0xc')]()[_0x0c3c('0xd')](function(_0x55a315,_0x14781a){_0x1dc7d6[_0x0c3c('0xb')]=(_0x55a315?module[_0x0c3c('0xe')][_0x0c3c('0x1')]:_0x14781a[_0x0c3c('0xb')])||_0x0c3c('0xf');return _0xfdff3d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')](_0x1dc7d6);});}else{return _0xfdff3d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')](_0x1dc7d6);}};exports['fetch']=function(_0x39be6a,_0x4425b2){return git[_0x0c3c('0xc')]([_0x0c3c('0x12'),_0x0c3c('0x13')],function(_0x45e7dd){if(_0x45e7dd){logger[_0x0c3c('0x14')](_0x45e7dd);return _0x4425b2[_0x0c3c('0x10')](0x1f4)['json'](_0x45e7dd);}logger['info'](_0x0c3c('0x15'));return _0x4425b2[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x16')});});};exports[_0x0c3c('0x17')]=function(_0x10e2ca,_0x577be5){return git[_0x0c3c('0x17')]([_0x0c3c('0x18'),_0x0c3c('0x19')],function(_0xf7da30){if(_0xf7da30){logger[_0x0c3c('0x14')](_0xf7da30);return _0x577be5[_0x0c3c('0x10')](0x1f4)[_0x0c3c('0x11')](_0xf7da30);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x577be5[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x1a')});});};exports[_0x0c3c('0x1b')]=function(_0x216ef5,_0x5ae86c){exec(_0x0c3c('0x1c'),function(_0x248fea,_0x1d031e,_0x427f1f){logger[_0x0c3c('0x1d')](_0x1d031e);logger['info'](_0x427f1f);if(_0x248fea){logger['error'](_0x248fea);return _0x5ae86c[_0x0c3c('0x10')](0x1f4)['json'](_0x248fea);}return _0x5ae86c['status'](0xc8)[_0x0c3c('0x11')]({'output':_0x1d031e});});};exports[_0x0c3c('0x1e')]=function(_0x1b2ff9,_0x2c9c7d){return pm2['restart'](_0x0c3c('0x1f'))[_0x0c3c('0x20')](function(_0x3825c1){logger[_0x0c3c('0x1d')]('pm2\x20restart\x20motion\x20%s',_0x3825c1);return _0x2c9c7d[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x22e1b3){logger[_0x0c3c('0x14')](_0x22e1b3);return _0x2c9c7d['status'](0x1f4)[_0x0c3c('0x11')](_0x22e1b3);});};exports['migrations']=function(_0x3ad541,_0x3f7306){var _0x300366=fs['readdirSync'](path[_0x0c3c('0x21')](config[_0x0c3c('0x8')],_0x0c3c('0x22'),'migrations'));var _0x17d312=[];for(var _0x1bbb77=0x0;_0x1bbb77<_0x300366['length'];_0x1bbb77++){var _0xadbf=_0x300366[_0x1bbb77][_0x0c3c('0x23')](_0x0c3c('0x24'),'');if(compareVersions(module[_0x0c3c('0xe')][_0x0c3c('0x1')],_0xadbf)===-0x1){_0x17d312['push'](_0xadbf);}}if(_0x17d312[_0x0c3c('0x25')]){var _0x59b36f=_0x17d312['sort'](compareVersions);var _0x3e329e=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x0c3c('0x1')},'migrations':{'params':[db[_0x0c3c('0x26')]['getQueryInterface'](),db[_0x0c3c('0x26')][_0x0c3c('0x27')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x0c3c('0x21')](config[_0x0c3c('0x8')],_0x0c3c('0x22'),_0x0c3c('0x28')),'pattern':/\.js$/}});_0x3e329e['up']({'migrations':_['map'](_0x59b36f,function(_0x4c34ab){return _0x4c34ab+_0x0c3c('0x24');})})[_0x0c3c('0x20')](function(){return _0x3f7306['status'](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x29')+module[_0x0c3c('0xe')][_0x0c3c('0x1')]+_0x0c3c('0x2a')+_[_0x0c3c('0x2b')](_0x59b36f),'migrations':_['join'](_0x59b36f)});})[_0x0c3c('0x2c')](function(_0x2c3e4f){if(_0x2c3e4f instanceof db['sequelize']['UniqueConstraintError']){return _0x3f7306[_0x0c3c('0x10')](0xc8)[_0x0c3c('0x11')]({'output':_0x0c3c('0x2d')});}else{return _0x3f7306[_0x0c3c('0x10')](0x1f4)[_0x0c3c('0x11')](_0x2c3e4f);}});}else{return _0x3f7306[_0x0c3c('0x10')](0xc8)['json']({'output':_0x0c3c('0x2d')});}}; \ No newline at end of file +var _0x1c24=['server','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','exec','../../config/environment','../../config/pm2','update','simple-git','query','latest','fetch','tags','exports','2.0.0','status','json','master','info','git\x20fetch\x20origin\x20master','reset','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','length','replace','version','push','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x3ac129,_0x176c70){var _0x39b534=function(_0x5d26dd){while(--_0x5d26dd){_0x3ac129['push'](_0x3ac129['shift']());}};_0x39b534(++_0x176c70);}(_0x1c24,0x15f));var _0x41c2=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1c24[_0x4c12ec];return _0x3ae42c;};'use strict';var Umzug=require(_0x41c2('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x41c2('0x1'));var pkginfo=require(_0x41c2('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require('child_process')[_0x41c2('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x41c2('0x4'));var pm2=require(_0x41c2('0x5'));var logger=require('../../config/logger')(_0x41c2('0x6'));var git=require(_0x41c2('0x7'))(config['root']);exports['index']=function(_0x2e741a,_0x2d975f){var _0x446b81={'current':module['exports']['version'],'phonebar':0x2};if(_0x2e741a[_0x41c2('0x8')]&&_0x2e741a['query'][_0x41c2('0x9')]){return git[_0x41c2('0xa')]()[_0x41c2('0xb')](function(_0x13c208,_0x4c0f7b){_0x446b81[_0x41c2('0x9')]=(_0x13c208?module[_0x41c2('0xc')]['version']:_0x4c0f7b[_0x41c2('0x9')])||_0x41c2('0xd');return _0x2d975f[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')](_0x446b81);});}else{return _0x2d975f['status'](0xc8)['json'](_0x446b81);}};exports[_0x41c2('0xa')]=function(_0x58f91d,_0x13add8){return git[_0x41c2('0xa')](['origin',_0x41c2('0x10')],function(_0x36edab){if(_0x36edab){logger['error'](_0x36edab);return _0x13add8['status'](0x1f4)[_0x41c2('0xf')](_0x36edab);}logger[_0x41c2('0x11')]('git\x20fetch');return _0x13add8[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')]({'output':_0x41c2('0x12')});});};exports[_0x41c2('0x13')]=function(_0x1258d6,_0x1f9c50){return git['reset']([_0x41c2('0x14'),'FETCH_HEAD'],function(_0x4b845a){if(_0x4b845a){logger[_0x41c2('0x15')](_0x4b845a);return _0x1f9c50['status'](0x1f4)[_0x41c2('0xf')](_0x4b845a);}logger['info'](_0x41c2('0x16'));return _0x1f9c50[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x2a05c2,_0x2bd925){exec(_0x41c2('0x17'),function(_0x3e0ff3,_0x156ade,_0x52350b){logger[_0x41c2('0x11')](_0x156ade);logger['info'](_0x52350b);if(_0x3e0ff3){logger[_0x41c2('0x15')](_0x3e0ff3);return _0x2bd925[_0x41c2('0xe')](0x1f4)[_0x41c2('0xf')](_0x3e0ff3);}return _0x2bd925[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')]({'output':_0x156ade});});};exports['restart']=function(_0x2d9651,_0x11dc03){return pm2[_0x41c2('0x18')](_0x41c2('0x19'))['then'](function(_0x8341a0){logger[_0x41c2('0x11')](_0x41c2('0x1a'),_0x8341a0);return _0x11dc03[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')]({'output':_0x41c2('0x1b')});})[_0x41c2('0x1c')](function(_0x4fad45){logger[_0x41c2('0x15')](_0x4fad45);return _0x11dc03[_0x41c2('0xe')](0x1f4)['json'](_0x4fad45);});};exports[_0x41c2('0x1d')]=function(_0x11dcf9,_0x1cf0a0){var _0x4b7f81=fs['readdirSync'](path[_0x41c2('0x1e')](config[_0x41c2('0x1f')],'server',_0x41c2('0x1d')));var _0x354e59=[];for(var _0x56e74e=0x0;_0x56e74e<_0x4b7f81[_0x41c2('0x20')];_0x56e74e++){var _0x44dde7=_0x4b7f81[_0x56e74e][_0x41c2('0x21')]('.js','');if(compareVersions(module[_0x41c2('0xc')][_0x41c2('0x22')],_0x44dde7)===-0x1){_0x354e59[_0x41c2('0x23')](_0x44dde7);}}if(_0x354e59['length']){var _0xf94c5a=_0x354e59[_0x41c2('0x24')](compareVersions);var _0x51f8ad=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x41c2('0x25')],'modelName':_0x41c2('0x25'),'columnName':_0x41c2('0x22')},'migrations':{'params':[db[_0x41c2('0x26')][_0x41c2('0x27')](),db['sequelize']['constructor'],function(){throw new Error(_0x41c2('0x28'));}],'path':path[_0x41c2('0x1e')](config[_0x41c2('0x1f')],_0x41c2('0x29'),_0x41c2('0x1d')),'pattern':/\.js$/}});_0x51f8ad['up']({'migrations':_[_0x41c2('0x2a')](_0xf94c5a,function(_0x17a912){return _0x17a912+_0x41c2('0x2b');})})[_0x41c2('0x2c')](function(){return _0x1cf0a0['status'](0xc8)[_0x41c2('0xf')]({'output':_0x41c2('0x2d')+module['exports']['version']+_0x41c2('0x2e')+_['last'](_0xf94c5a),'migrations':_[_0x41c2('0x1e')](_0xf94c5a)});})[_0x41c2('0x1c')](function(_0x3386ec){if(_0x3386ec instanceof db['sequelize'][_0x41c2('0x2f')]){return _0x1cf0a0['status'](0xc8)[_0x41c2('0xf')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x1cf0a0['status'](0x1f4)[_0x41c2('0xf')](_0x3386ec);}});}else{return _0x1cf0a0[_0x41c2('0xe')](0xc8)[_0x41c2('0xf')]({'output':_0x41c2('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0436cd9..a1590e9 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 _0xba33=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy'];(function(_0x5e9817,_0xa29439){var _0x25b437=function(_0x46851b){while(--_0x46851b){_0x5e9817['push'](_0x5e9817['shift']());}};_0x25b437(++_0xa29439);}(_0xba33,0x120));var _0x3ba3=function(_0x5697ed,_0x2351ab){_0x5697ed=_0x5697ed-0x0;var _0x15db26=_0xba33[_0x5697ed];return _0x15db26;};'use strict';var multer=require('multer');var util=require(_0x3ba3('0x0'));var path=require('path');var timeout=require(_0x3ba3('0x1'));var express=require('express');var router=express[_0x3ba3('0x2')]();var fs_extra=require(_0x3ba3('0x3'));var auth=require(_0x3ba3('0x4'));var interaction=require(_0x3ba3('0x5'));var config=require(_0x3ba3('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x3ba3('0x7')]('/',auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x9')]);router[_0x3ba3('0x7')](_0x3ba3('0xa'),auth['isAuthenticated'](),controller[_0x3ba3('0xb')]);router[_0x3ba3('0x7')](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0xd')]);router[_0x3ba3('0xe')]('/',auth[_0x3ba3('0x8')](),controller['create']);router[_0x3ba3('0xf')](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x10')]);router['delete'](_0x3ba3('0xc'),auth[_0x3ba3('0x8')](),controller[_0x3ba3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf0e8=['./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0xe22d99,_0x866968){var _0x8b0d52=function(_0x236b7b){while(--_0x236b7b){_0xe22d99['push'](_0xe22d99['shift']());}};_0x8b0d52(++_0x866968);}(_0xf0e8,0x81));var _0x8f0e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf0e8[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x8f0e('0x0'));var util=require(_0x8f0e('0x1'));var path=require('path');var timeout=require(_0x8f0e('0x2'));var express=require('express');var router=express[_0x8f0e('0x3')]();var fs_extra=require(_0x8f0e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8f0e('0x5'));var config=require(_0x8f0e('0x6'));var controller=require(_0x8f0e('0x7'));router[_0x8f0e('0x8')]('/',auth[_0x8f0e('0x9')](),controller['index']);router['get'](_0x8f0e('0xa'),auth[_0x8f0e('0x9')](),controller['describe']);router[_0x8f0e('0x8')](_0x8f0e('0xb'),auth[_0x8f0e('0x9')](),controller['show']);router['post']('/',auth[_0x8f0e('0x9')](),controller[_0x8f0e('0xc')]);router['put'](_0x8f0e('0xb'),auth[_0x8f0e('0x9')](),controller[_0x8f0e('0xd')]);router[_0x8f0e('0xe')]('/:id',auth[_0x8f0e('0x9')](),controller[_0x8f0e('0xf')]);module[_0x8f0e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 780976d..37c201f 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 _0x8952=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x5cc0c8,_0x403e0e){var _0x3b3f67=function(_0x4c743f){while(--_0x4c743f){_0x5cc0c8['push'](_0x5cc0c8['shift']());}};_0x3b3f67(++_0x403e0e);}(_0x8952,0x17e));var _0x2895=function(_0x155371,_0x4501a9){_0x155371=_0x155371-0x0;var _0xfd5c1f=_0x8952[_0x155371];return _0xfd5c1f;};'use strict';var Sequelize=require('sequelize');module[_0x2895('0x0')]={'type':{'type':Sequelize[_0x2895('0x1')]},'uniqueid':{'type':Sequelize[_0x2895('0x1')]},'calleridnum':{'type':Sequelize[_0x2895('0x1')]},'calleridname':{'type':Sequelize[_0x2895('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2895('0x1')]},'membername':{'type':Sequelize[_0x2895('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2895('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x2895('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x2895('0x2')]},'agentdumpAt':{'type':Sequelize[_0x2895('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x2895('0x4')]},'agentacw':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2895('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x2895('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2895('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2895('0x1')]},'accountcode':{'type':Sequelize[_0x2895('0x1')]},'context':{'type':Sequelize[_0x2895('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2895('0x1')]},'destchannel':{'type':Sequelize[_0x2895('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x2895('0x1')]},'destcalleridnum':{'type':Sequelize[_0x2895('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2895('0x1')]},'destlanguage':{'type':Sequelize[_0x2895('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2895('0x1')]},'destexten':{'type':Sequelize[_0x2895('0x1')]},'destpriority':{'type':Sequelize[_0x2895('0x1')]},'destuniqueid':{'type':Sequelize[_0x2895('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2895('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x2895('0x1')]},'transfer':{'type':Sequelize[_0x2895('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2895('0x1')],'comment':_0x2895('0x5')},'transferexten':{'type':Sequelize[_0x2895('0x1')]},'transferuniqueid':{'type':Sequelize[_0x2895('0x1')]},'agententerreason':{'type':Sequelize[_0x2895('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x85de=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x85de,0x65));var _0xe85d=function(_0x22f2d2,_0x506950){_0x22f2d2=_0x22f2d2-0x0;var _0x2e9e55=_0x85de[_0x22f2d2];return _0x2e9e55;};'use strict';var Sequelize=require(_0xe85d('0x0'));module[_0xe85d('0x1')]={'type':{'type':Sequelize[_0xe85d('0x2')]},'uniqueid':{'type':Sequelize[_0xe85d('0x2')]},'calleridnum':{'type':Sequelize[_0xe85d('0x2')]},'calleridname':{'type':Sequelize[_0xe85d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe85d('0x2')]},'membername':{'type':Sequelize[_0xe85d('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe85d('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe85d('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xe85d('0x3')]},'holdtime':{'type':Sequelize[_0xe85d('0x4')]},'agentcomplete':{'type':Sequelize[_0xe85d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xe85d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe85d('0x4')]},'agentacw':{'type':Sequelize[_0xe85d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe85d('0x4')]},'reason':{'type':Sequelize[_0xe85d('0x2')]},'lastevent':{'type':Sequelize[_0xe85d('0x2')]},'channel':{'type':Sequelize[_0xe85d('0x2')]},'channelstate':{'type':Sequelize[_0xe85d('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe85d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe85d('0x2')]},'connectedlinename':{'type':Sequelize[_0xe85d('0x2')]},'language':{'type':Sequelize[_0xe85d('0x2')]},'accountcode':{'type':Sequelize[_0xe85d('0x2')]},'context':{'type':Sequelize[_0xe85d('0x2')]},'exten':{'type':Sequelize[_0xe85d('0x2')]},'priority':{'type':Sequelize[_0xe85d('0x2')]},'destchannel':{'type':Sequelize[_0xe85d('0x2')]},'destchannelstate':{'type':Sequelize[_0xe85d('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xe85d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xe85d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xe85d('0x2')]},'destlanguage':{'type':Sequelize[_0xe85d('0x2')]},'destaccountcode':{'type':Sequelize[_0xe85d('0x2')]},'destcontext':{'type':Sequelize[_0xe85d('0x2')]},'destexten':{'type':Sequelize[_0xe85d('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe85d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe85d('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe85d('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe85d('0x2')]},'agententerreason':{'type':Sequelize[_0xe85d('0x4')],'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 67cd184..14a4089 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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 17c1a49..11ab2c9 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 _0xb182=['destuniqueid','util','../../config/logger','api','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x4ecd76,_0x79f1f3){var _0x240f34=function(_0x563f79){while(--_0x563f79){_0x4ecd76['push'](_0x4ecd76['shift']());}};_0x240f34(++_0x79f1f3);}(_0xb182,0x121));var _0x2b18=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xb182[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var util=require(_0x2b18('0x0'));var logger=require(_0x2b18('0x1'))(_0x2b18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2b18('0x3'));var fs=require('fs');var path=require(_0x2b18('0x4'));var rimraf=require(_0x2b18('0x5'));var config=require('../../config/environment');var attributes=require(_0x2b18('0x6'));module[_0x2b18('0x7')]=function(_0x22eae8,_0x31236f){return _0x22eae8[_0x2b18('0x8')](_0x2b18('0x9'),attributes,{'tableName':_0x2b18('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x2b18('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x29fc2c,_0x4ff86a){var _0x1adbc8=function(_0x596f87){while(--_0x596f87){_0x29fc2c['push'](_0x29fc2c['shift']());}};_0x1adbc8(++_0x4ff86a);}(_0xac31,0xca));var _0x1ac3=function(_0x3ba31b,_0x2d3d69){_0x3ba31b=_0x3ba31b-0x0;var _0x413d33=_0xac31[_0x3ba31b];return _0x413d33;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x1ac3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 70ac0fb..9c2b79e 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 _0x6476=['../../config/environment','client','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','debug','UpdateVoiceAgentReport','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e9ace,_0xbcc2eb){var _0x8b6958=function(_0x1898d0){while(--_0x1898d0){_0x1e9ace['push'](_0x1e9ace['shift']());}};_0x8b6958(++_0xbcc2eb);}(_0x6476,0x139));var _0x6647=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x6476[_0x550d12];return _0x12103d;};'use strict';var _=require(_0x6647('0x0'));var util=require('util');var moment=require(_0x6647('0x1'));var BPromise=require('bluebird');var rs=require(_0x6647('0x2'));var fs=require('fs');var Redis=require(_0x6647('0x3'));var db=require(_0x6647('0x4'))['db'];var utils=require(_0x6647('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6647('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6647('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f7a3e,_0x5c3a4a,_0x148a1b){return new BPromise(function(_0x37f966,_0x413f1d){return client[_0x6647('0x8')](_0x4f7a3e,_0x148a1b)[_0x6647('0x9')](function(_0x3f65cb){logger['info'](_0x6647('0xa'),_0x5c3a4a,_0x6647('0xb'));logger['debug'](_0x6647('0xc'),_0x5c3a4a,_0x6647('0xb'),JSON[_0x6647('0xd')](_0x3f65cb));if(_0x3f65cb[_0x6647('0xe')]){if(_0x3f65cb[_0x6647('0xe')][_0x6647('0xf')]===0x1f4){logger[_0x6647('0xe')](_0x6647('0xa'),_0x5c3a4a,_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);return _0x413f1d(_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);}logger['error'](_0x6647('0xa'),_0x5c3a4a,_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);return _0x37f966(_0x3f65cb[_0x6647('0xe')][_0x6647('0x10')]);}else{logger[_0x6647('0x11')](_0x6647('0xa'),_0x5c3a4a,_0x6647('0xb'));_0x37f966(_0x3f65cb['result'][_0x6647('0x10')]);}})[_0x6647('0x12')](function(_0x3499b8){logger[_0x6647('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x5c3a4a,_0x3499b8);_0x413f1d(_0x3499b8);});});}exports['CreateVoiceAgentReport']=function(_0x3bac09){var _0xcc9a75=this;return new Promise(function(_0x36d400,_0x152103){return db[_0x6647('0x13')]['create'](_0x3bac09[_0x6647('0x14')],{'raw':_0x3bac09['options']?_0x3bac09[_0x6647('0x15')][_0x6647('0x16')]===undefined?!![]:![]:!![]})[_0x6647('0x9')](function(_0x202100){logger[_0x6647('0x11')](_0x6647('0x17'),_0x3bac09);logger[_0x6647('0x18')](_0x6647('0x17'),_0x3bac09,JSON[_0x6647('0xd')](_0x202100));_0x36d400(_0x202100);})[_0x6647('0x12')](function(_0x4270c3){logger[_0x6647('0xe')]('CreateVoiceAgentReport',_0x4270c3[_0x6647('0x10')],_0x3bac09);_0x152103(_0xcc9a75['error'](0x1f4,_0x4270c3['message']));});});};exports[_0x6647('0x19')]=function(_0x114886){var _0x565218=this;return new Promise(function(_0x436fce,_0x7849c6){return db['VoiceAgentReport']['update'](_0x114886[_0x6647('0x14')],{'raw':_0x114886[_0x6647('0x15')]?_0x114886[_0x6647('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114886['options']?_0x114886[_0x6647('0x15')][_0x6647('0x1a')]||null:null,'attributes':_0x114886[_0x6647('0x15')]?_0x114886['options'][_0x6647('0x1b')]||null:null,'limit':_0x114886[_0x6647('0x15')]?_0x114886['options'][_0x6647('0x1c')]||null:null})[_0x6647('0x9')](function(_0x336cf2){logger[_0x6647('0x11')](_0x6647('0x19'),_0x114886);logger[_0x6647('0x18')](_0x6647('0x19'),_0x114886,JSON[_0x6647('0xd')](_0x336cf2));_0x436fce(_0x336cf2);})[_0x6647('0x12')](function(_0x3eb7ec){logger[_0x6647('0xe')](_0x6647('0x19'),_0x3eb7ec['message'],_0x114886);_0x7849c6(_0x565218[_0x6647('0xe')](0x1f4,_0x3eb7ec[_0x6647('0x10')]));});});}; \ No newline at end of file +var _0xa48d=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','update','raw','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x165e8c,_0x39d736){var _0x463871=function(_0x3ae2e8){while(--_0x3ae2e8){_0x165e8c['push'](_0x165e8c['shift']());}};_0x463871(++_0x39d736);}(_0xa48d,0x16e));var _0xda48=function(_0x577f79,_0x3c9e58){_0x577f79=_0x577f79-0x0;var _0x2b4c82=_0xa48d[_0x577f79];return _0x2b4c82;};'use strict';var _=require('lodash');var util=require(_0xda48('0x0'));var moment=require(_0xda48('0x1'));var BPromise=require('bluebird');var rs=require(_0xda48('0x2'));var fs=require('fs');var Redis=require(_0xda48('0x3'));var db=require(_0xda48('0x4'))['db'];var utils=require(_0xda48('0x5'));var logger=require(_0xda48('0x6'))(_0xda48('0x7'));var config=require(_0xda48('0x8'));var jayson=require(_0xda48('0x9'));var client=jayson['client'][_0xda48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x151113,_0x208f99,_0x3fc8e8){return new BPromise(function(_0x295440,_0x46ab3b){return client[_0xda48('0xb')](_0x151113,_0x3fc8e8)[_0xda48('0xc')](function(_0x17299f){logger[_0xda48('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x208f99,_0xda48('0xe'));logger[_0xda48('0xf')](_0xda48('0x10'),_0x208f99,_0xda48('0xe'),JSON['stringify'](_0x17299f));if(_0x17299f['error']){if(_0x17299f[_0xda48('0x11')][_0xda48('0x12')]===0x1f4){logger[_0xda48('0x11')](_0xda48('0x13'),_0x208f99,_0x17299f['error'][_0xda48('0x14')]);return _0x46ab3b(_0x17299f['error']['message']);}logger[_0xda48('0x11')](_0xda48('0x13'),_0x208f99,_0x17299f[_0xda48('0x11')][_0xda48('0x14')]);return _0x295440(_0x17299f[_0xda48('0x11')]['message']);}else{logger[_0xda48('0xd')](_0xda48('0x13'),_0x208f99,_0xda48('0xe'));_0x295440(_0x17299f[_0xda48('0x15')][_0xda48('0x14')]);}})[_0xda48('0x16')](function(_0x51016a){logger['error'](_0xda48('0x13'),_0x208f99,_0x51016a);_0x46ab3b(_0x51016a);});});}exports[_0xda48('0x17')]=function(_0x18480d){var _0x2e9488=this;return new Promise(function(_0xed1862,_0x29d6ac){return db[_0xda48('0x18')][_0xda48('0x19')](_0x18480d[_0xda48('0x1a')],{'raw':_0x18480d[_0xda48('0x1b')]?_0x18480d[_0xda48('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xda48('0xc')](function(_0x18a9b6){logger[_0xda48('0xd')](_0xda48('0x17'),_0x18480d);logger[_0xda48('0xf')](_0xda48('0x17'),_0x18480d,JSON[_0xda48('0x1c')](_0x18a9b6));_0xed1862(_0x18a9b6);})[_0xda48('0x16')](function(_0x490088){logger[_0xda48('0x11')](_0xda48('0x17'),_0x490088['message'],_0x18480d);_0x29d6ac(_0x2e9488[_0xda48('0x11')](0x1f4,_0x490088[_0xda48('0x14')]));});});};exports[_0xda48('0x1d')]=function(_0x59b514){var _0x267438=this;return new Promise(function(_0x125be5,_0x5ead04){return db[_0xda48('0x18')][_0xda48('0x1e')](_0x59b514[_0xda48('0x1a')],{'raw':_0x59b514['options']?_0x59b514[_0xda48('0x1b')][_0xda48('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b514[_0xda48('0x1b')]?_0x59b514[_0xda48('0x1b')]['where']||null:null,'attributes':_0x59b514[_0xda48('0x1b')]?_0x59b514[_0xda48('0x1b')][_0xda48('0x20')]||null:null,'limit':_0x59b514[_0xda48('0x1b')]?_0x59b514[_0xda48('0x1b')][_0xda48('0x21')]||null:null})[_0xda48('0xc')](function(_0x24db8e){logger[_0xda48('0xd')]('UpdateVoiceAgentReport',_0x59b514);logger['debug'](_0xda48('0x1d'),_0x59b514,JSON['stringify'](_0x24db8e));_0x125be5(_0x24db8e);})[_0xda48('0x16')](function(_0x26be72){logger['error']('UpdateVoiceAgentReport',_0x26be72[_0xda48('0x14')],_0x59b514);_0x5ead04(_0x267438[_0xda48('0x11')](0x1f4,_0x26be72[_0xda48('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 77c94be..ec8e40c 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 _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path'];(function(_0x2627df,_0x3887e9){var _0x388825=function(_0x303291){while(--_0x303291){_0x2627df['push'](_0x2627df['shift']());}};_0x388825(++_0x3887e9);}(_0xb138,0x1dd));var _0x8b13=function(_0x133a18,_0x14ba98){_0x133a18=_0x133a18-0x0;var _0x394b44=_0xb138[_0x133a18];return _0x394b44;};'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['post']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xf')]);router[_0x8b13('0x10')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['update']);router[_0x8b13('0x11')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x12')]);module[_0x8b13('0x13')]=router; \ No newline at end of file +var _0x0e85=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x3ac312,_0x5d3903){var _0x36b673=function(_0x254b25){while(--_0x254b25){_0x3ac312['push'](_0x3ac312['shift']());}};_0x36b673(++_0x5d3903);}(_0x0e85,0x7c));var _0x50e8=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x0e85[_0xac151d];return _0x111dba;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50e8('0x4'));var config=require('../../config/environment');var controller=require(_0x50e8('0x5'));router[_0x50e8('0x6')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0x8')]);router['get'](_0x50e8('0x9'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xa')]);router[_0x50e8('0x6')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller['show']);router[_0x50e8('0xc')]('/',auth[_0x50e8('0x7')](),controller[_0x50e8('0xd')]);router[_0x50e8('0xe')](_0x50e8('0xb'),auth[_0x50e8('0x7')](),controller[_0x50e8('0xf')]);router[_0x50e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x50e8('0x11')]);module[_0x50e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index d5705ac..7e1cb8c 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 _0xaf3f=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x365714,_0x44e99a){var _0xe4e943=function(_0x24436d){while(--_0x24436d){_0x365714['push'](_0x365714['shift']());}};_0xe4e943(++_0x44e99a);}(_0xaf3f,0x11e));var _0xfaf3=function(_0x58b4e4,_0x2e3672){_0x58b4e4=_0x58b4e4-0x0;var _0x136827=_0xaf3f[_0x58b4e4];return _0x136827;};'use strict';var Sequelize=require(_0xfaf3('0x0'));module[_0xfaf3('0x1')]={'uniqueid':{'type':Sequelize[_0xfaf3('0x2')]},'type':{'type':Sequelize[_0xfaf3('0x3')](_0xfaf3('0x4'),_0xfaf3('0x5'),_0xfaf3('0x6'),_0xfaf3('0x7'),_0xfaf3('0x8'),_0xfaf3('0x9'))},'tag':{'type':Sequelize[_0xfaf3('0x2')]},'accountcode':{'type':Sequelize[_0xfaf3('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xfaf3('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xfaf3('0x2')]},'destinationchannel':{'type':Sequelize[_0xfaf3('0x2')]},'lastapplication':{'type':Sequelize[_0xfaf3('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xfaf3('0xa')]},'answertime':{'type':Sequelize[_0xfaf3('0xa')]},'endtime':{'type':Sequelize[_0xfaf3('0xa')]},'duration':{'type':Sequelize[_0xfaf3('0xb')]},'billableseconds':{'type':Sequelize[_0xfaf3('0xb')]},'mohtime':{'type':Sequelize[_0xfaf3('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xfaf3('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xfaf3('0x2')]},'userDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xfaf3('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xfaf3('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xfaf3('0x2')]}}; \ No newline at end of file +var _0x235b=['STRING','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax'];(function(_0x44c515,_0x1e40ec){var _0x2dd882=function(_0x550fb3){while(--_0x550fb3){_0x44c515['push'](_0x44c515['shift']());}};_0x2dd882(++_0x1e40ec);}(_0x235b,0x1ed));var _0xb235=function(_0x2fa5ba,_0x4a70a1){_0x2fa5ba=_0x2fa5ba-0x0;var _0x38aa4b=_0x235b[_0x2fa5ba];return _0x38aa4b;};'use strict';var Sequelize=require(_0xb235('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb235('0x1')](_0xb235('0x2'),_0xb235('0x3'),_0xb235('0x4'),_0xb235('0x5'),_0xb235('0x6'),'dialer')},'tag':{'type':Sequelize[_0xb235('0x7')]},'accountcode':{'type':Sequelize[_0xb235('0x7')]},'source':{'type':Sequelize[_0xb235('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xb235('0x7')]},'callerid':{'type':Sequelize[_0xb235('0x7')]},'channel':{'type':Sequelize[_0xb235('0x7')]},'destinationchannel':{'type':Sequelize[_0xb235('0x7')]},'lastapplication':{'type':Sequelize[_0xb235('0x7')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xb235('0x8')]},'answertime':{'type':Sequelize[_0xb235('0x8')]},'endtime':{'type':Sequelize[_0xb235('0x8')]},'duration':{'type':Sequelize[_0xb235('0x9')]},'billableseconds':{'type':Sequelize[_0xb235('0x9')]},'mohtime':{'type':Sequelize[_0xb235('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb235('0x7')]},'amaflags':{'type':Sequelize[_0xb235('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xb235('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xb235('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xb235('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb235('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xb235('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 1947191..a31704c 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 _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0xadb5,0xad));var _0x5adb=function(_0x3d600c,_0x416db8){_0x3d600c=_0x3d600c-0x0;var _0x5efa88=_0xadb5[_0x3d600c];return _0x5efa88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0xadb5,0xad));var _0x5adb=function(_0x4d7a48,_0x12c36c){_0x4d7a48=_0x4d7a48-0x0;var _0xdc9b8b=_0xadb5[_0x4d7a48];return _0xdc9b8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f9b25f7..5014d94 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 _0x2516=['request-promise','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x221188,_0x2691b7){var _0x1bd725=function(_0x4b7811){while(--_0x4b7811){_0x221188['push'](_0x221188['shift']());}};_0x1bd725(++_0x2691b7);}(_0x2516,0x16f));var _0x6251=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x2516[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var logger=require(_0x6251('0x2'))(_0x6251('0x3'));var moment=require('moment');var BPromise=require(_0x6251('0x4'));var rp=require(_0x6251('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6251('0x6'));var attributes=require(_0x6251('0x7'));module[_0x6251('0x8')]=function(_0x3d3ff5,_0x34aba1){return _0x3d3ff5[_0x6251('0x9')](_0x6251('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6251('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3142=['VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3142,0x1e3));var _0x2314=function(_0x543217,_0x35f5af){_0x543217=_0x543217-0x0;var _0x1e39cb=_0x3142[_0x543217];return _0x1e39cb;};'use strict';var _=require(_0x2314('0x0'));var util=require(_0x2314('0x1'));var logger=require('../../config/logger')(_0x2314('0x2'));var moment=require(_0x2314('0x3'));var BPromise=require(_0x2314('0x4'));var rp=require(_0x2314('0x5'));var fs=require('fs');var path=require(_0x2314('0x6'));var rimraf=require(_0x2314('0x7'));var config=require(_0x2314('0x8'));var attributes=require(_0x2314('0x9'));module[_0x2314('0xa')]=function(_0x558395,_0xedf7c1){return _0x558395[_0x2314('0xb')](_0x2314('0xc'),attributes,{'tableName':_0x2314('0xd'),'paranoid':![],'indexes':[{'fields':[_0x2314('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b8e9047..b05834f 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 _0xa5f4=['message','VoiceCallReport,\x20%s,\x20%s','result','catch','VoiceCallReport','options','raw','attributes','limit','include','map','model','GetVoiceCallReport','debug','create','body','CreateVoiceCallReport','update','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','request','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x6ca07c,_0x5cc954){var _0x32f9b7=function(_0x33ab17){while(--_0x33ab17){_0x6ca07c['push'](_0x6ca07c['shift']());}};_0x32f9b7(++_0x5cc954);}(_0xa5f4,0x134));var _0x4a5f=function(_0x25b9a9,_0x2aeeb4){_0x25b9a9=_0x25b9a9-0x0;var _0x3bceb6=_0xa5f4[_0x25b9a9];return _0x3bceb6;};'use strict';var _=require(_0x4a5f('0x0'));var util=require(_0x4a5f('0x1'));var moment=require(_0x4a5f('0x2'));var BPromise=require(_0x4a5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a5f('0x4'));var db=require(_0x4a5f('0x5'))['db'];var utils=require(_0x4a5f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a5f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x17a9fe,_0x4853ee,_0x3cfe90){return new BPromise(function(_0x51ace6,_0x364ddc){return client[_0x4a5f('0x8')](_0x17a9fe,_0x3cfe90)[_0x4a5f('0x9')](function(_0x75d23c){logger[_0x4a5f('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x4853ee,'request\x20sent');logger['debug'](_0x4a5f('0xb'),_0x4853ee,_0x4a5f('0xc'),JSON[_0x4a5f('0xd')](_0x75d23c));if(_0x75d23c[_0x4a5f('0xe')]){if(_0x75d23c['error'][_0x4a5f('0xf')]===0x1f4){logger[_0x4a5f('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x4853ee,_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);return _0x364ddc(_0x75d23c[_0x4a5f('0xe')]['message']);}logger['error'](_0x4a5f('0x11'),_0x4853ee,_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);return _0x51ace6(_0x75d23c[_0x4a5f('0xe')][_0x4a5f('0x10')]);}else{logger[_0x4a5f('0xa')](_0x4a5f('0x11'),_0x4853ee,_0x4a5f('0xc'));_0x51ace6(_0x75d23c[_0x4a5f('0x12')][_0x4a5f('0x10')]);}})[_0x4a5f('0x13')](function(_0x381c41){logger['error'](_0x4a5f('0x11'),_0x4853ee,_0x381c41);_0x364ddc(_0x381c41);});});}exports['GetVoiceCallReport']=function(_0x4f42ba){var _0x3eb838=this;return new Promise(function(_0x54176c,_0x1e1694){return db[_0x4a5f('0x14')]['findAll']({'raw':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x16')]===undefined?!![]:![]:!![],'where':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')]['where']||null:null,'attributes':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba['options'][_0x4a5f('0x17')]||null:null,'limit':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x18')]||null:null,'include':_0x4f42ba[_0x4a5f('0x15')]?_0x4f42ba[_0x4a5f('0x15')][_0x4a5f('0x19')]?_[_0x4a5f('0x1a')](_0x4f42ba['options'][_0x4a5f('0x19')],function(_0x30f822){return{'model':db[_0x30f822['model']],'as':_0x30f822['as'],'attributes':_0x30f822[_0x4a5f('0x17')],'include':_0x30f822[_0x4a5f('0x19')]?_[_0x4a5f('0x1a')](_0x30f822['include'],function(_0x3e943c){return{'model':db[_0x3e943c[_0x4a5f('0x1b')]],'as':_0x3e943c['as'],'attributes':_0x3e943c[_0x4a5f('0x17')],'include':_0x3e943c['include']?_[_0x4a5f('0x1a')](_0x3e943c['include'],function(_0x5fea59){return{'model':db[_0x5fea59[_0x4a5f('0x1b')]],'as':_0x5fea59['as'],'attributes':_0x5fea59[_0x4a5f('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4a5f('0x9')](function(_0x5d3af3){logger[_0x4a5f('0xa')](_0x4a5f('0x1c'),_0x4f42ba);logger[_0x4a5f('0x1d')]('GetVoiceCallReport',_0x4f42ba,JSON['stringify'](_0x5d3af3));_0x54176c(_0x5d3af3);})[_0x4a5f('0x13')](function(_0x3e7a8d){logger[_0x4a5f('0xe')](_0x4a5f('0x1c'),_0x3e7a8d['message'],_0x4f42ba);_0x1e1694(_0x3eb838[_0x4a5f('0xe')](0x1f4,_0x3e7a8d[_0x4a5f('0x10')]));});});};exports['CreateVoiceCallReport']=function(_0x44789a){var _0x3277ca=this;return new Promise(function(_0x1cb6b8,_0x2db6df){return db[_0x4a5f('0x14')][_0x4a5f('0x1e')](_0x44789a[_0x4a5f('0x1f')],{'raw':_0x44789a[_0x4a5f('0x15')]?_0x44789a['options'][_0x4a5f('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xe3c52a){logger[_0x4a5f('0xa')](_0x4a5f('0x20'),_0x44789a);logger[_0x4a5f('0x1d')](_0x4a5f('0x20'),_0x44789a,JSON[_0x4a5f('0xd')](_0xe3c52a));_0x1cb6b8(_0xe3c52a);})[_0x4a5f('0x13')](function(_0x4f3260){logger['error']('CreateVoiceCallReport',_0x4f3260['message'],_0x44789a);_0x2db6df(_0x3277ca[_0x4a5f('0xe')](0x1f4,_0x4f3260['message']));});});};exports['UpdateVoiceCallReport']=function(_0x4f1ee1){var _0x138519=this;return new Promise(function(_0x2653c2,_0x45776e){return db[_0x4a5f('0x14')][_0x4a5f('0x21')](_0x4f1ee1[_0x4a5f('0x1f')],{'raw':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1[_0x4a5f('0x15')][_0x4a5f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1['options'][_0x4a5f('0x22')]||null:null,'attributes':_0x4f1ee1['options']?_0x4f1ee1[_0x4a5f('0x15')][_0x4a5f('0x17')]||null:null,'limit':_0x4f1ee1[_0x4a5f('0x15')]?_0x4f1ee1[_0x4a5f('0x15')]['limit']||null:null})[_0x4a5f('0x9')](function(_0x2aecaa){logger[_0x4a5f('0xa')](_0x4a5f('0x23'),_0x4f1ee1);logger[_0x4a5f('0x1d')](_0x4a5f('0x23'),_0x4f1ee1,JSON[_0x4a5f('0xd')](_0x2aecaa));_0x2653c2(_0x2aecaa);})[_0x4a5f('0x13')](function(_0x392e02){logger[_0x4a5f('0xe')]('UpdateVoiceCallReport',_0x392e02['message'],_0x4f1ee1);_0x45776e(_0x138519['error'](0x1f4,_0x392e02[_0x4a5f('0x10')]));});});}; \ No newline at end of file +var _0x6723=['CreateVoiceCallReport','UpdateVoiceCallReport','update','body','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','map','include','model','VoiceCallReport','create'];(function(_0x547dfe,_0x2e9855){var _0x13342a=function(_0x41bc7c){while(--_0x41bc7c){_0x547dfe['push'](_0x547dfe['shift']());}};_0x13342a(++_0x2e9855);}(_0x6723,0xa9));var _0x3672=function(_0x4aca14,_0x11976f){_0x4aca14=_0x4aca14-0x0;var _0x4c25c1=_0x6723[_0x4aca14];return _0x4c25c1;};'use strict';var _=require(_0x3672('0x0'));var util=require(_0x3672('0x1'));var moment=require(_0x3672('0x2'));var BPromise=require('bluebird');var rs=require(_0x3672('0x3'));var fs=require('fs');var Redis=require(_0x3672('0x4'));var db=require(_0x3672('0x5'))['db'];var utils=require(_0x3672('0x6'));var logger=require(_0x3672('0x7'))(_0x3672('0x8'));var config=require(_0x3672('0x9'));var jayson=require(_0x3672('0xa'));var client=jayson['client'][_0x3672('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13236d,_0x12b6c9,_0x3e7448){return new BPromise(function(_0x5513e3,_0x2db4f8){return client[_0x3672('0xc')](_0x13236d,_0x3e7448)[_0x3672('0xd')](function(_0x467b1f){logger[_0x3672('0xe')](_0x3672('0xf'),_0x12b6c9,_0x3672('0x10'));logger[_0x3672('0x11')](_0x3672('0x12'),_0x12b6c9,'request\x20sent',JSON[_0x3672('0x13')](_0x467b1f));if(_0x467b1f[_0x3672('0x14')]){if(_0x467b1f['error'][_0x3672('0x15')]===0x1f4){logger['error'](_0x3672('0xf'),_0x12b6c9,_0x467b1f['error'][_0x3672('0x16')]);return _0x2db4f8(_0x467b1f[_0x3672('0x14')][_0x3672('0x16')]);}logger[_0x3672('0x14')](_0x3672('0xf'),_0x12b6c9,_0x467b1f[_0x3672('0x14')][_0x3672('0x16')]);return _0x5513e3(_0x467b1f[_0x3672('0x14')]['message']);}else{logger[_0x3672('0xe')](_0x3672('0xf'),_0x12b6c9,_0x3672('0x10'));_0x5513e3(_0x467b1f[_0x3672('0x17')][_0x3672('0x16')]);}})[_0x3672('0x18')](function(_0xe9d58c){logger[_0x3672('0x14')](_0x3672('0xf'),_0x12b6c9,_0xe9d58c);_0x2db4f8(_0xe9d58c);});});}exports[_0x3672('0x19')]=function(_0xab90b3){var _0x24b1b1=this;return new Promise(function(_0x1fe3cb,_0x5825ce){return db['VoiceCallReport'][_0x3672('0x1a')]({'raw':_0xab90b3['options']?_0xab90b3[_0x3672('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xab90b3['options']?_0xab90b3['options'][_0x3672('0x1c')]||null:null,'attributes':_0xab90b3[_0x3672('0x1b')]?_0xab90b3[_0x3672('0x1b')][_0x3672('0x1d')]||null:null,'limit':_0xab90b3[_0x3672('0x1b')]?_0xab90b3[_0x3672('0x1b')][_0x3672('0x1e')]||null:null,'include':_0xab90b3['options']?_0xab90b3[_0x3672('0x1b')]['include']?_[_0x3672('0x1f')](_0xab90b3[_0x3672('0x1b')][_0x3672('0x20')],function(_0x521ab7){return{'model':db[_0x521ab7[_0x3672('0x21')]],'as':_0x521ab7['as'],'attributes':_0x521ab7[_0x3672('0x1d')],'include':_0x521ab7[_0x3672('0x20')]?_[_0x3672('0x1f')](_0x521ab7[_0x3672('0x20')],function(_0x223c7f){return{'model':db[_0x223c7f[_0x3672('0x21')]],'as':_0x223c7f['as'],'attributes':_0x223c7f[_0x3672('0x1d')],'include':_0x223c7f['include']?_[_0x3672('0x1f')](_0x223c7f[_0x3672('0x20')],function(_0x136e09){return{'model':db[_0x136e09['model']],'as':_0x136e09['as'],'attributes':_0x136e09[_0x3672('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3672('0xd')](function(_0x82b145){logger[_0x3672('0xe')](_0x3672('0x19'),_0xab90b3);logger[_0x3672('0x11')](_0x3672('0x19'),_0xab90b3,JSON['stringify'](_0x82b145));_0x1fe3cb(_0x82b145);})[_0x3672('0x18')](function(_0x18cc53){logger[_0x3672('0x14')](_0x3672('0x19'),_0x18cc53[_0x3672('0x16')],_0xab90b3);_0x5825ce(_0x24b1b1[_0x3672('0x14')](0x1f4,_0x18cc53[_0x3672('0x16')]));});});};exports['CreateVoiceCallReport']=function(_0x302767){var _0x49f44b=this;return new Promise(function(_0x6d4ab7,_0x45af32){return db[_0x3672('0x22')][_0x3672('0x23')](_0x302767['body'],{'raw':_0x302767['options']?_0x302767[_0x3672('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3672('0xd')](function(_0x12f43b){logger[_0x3672('0xe')](_0x3672('0x24'),_0x302767);logger[_0x3672('0x11')](_0x3672('0x24'),_0x302767,JSON[_0x3672('0x13')](_0x12f43b));_0x6d4ab7(_0x12f43b);})[_0x3672('0x18')](function(_0x19c931){logger[_0x3672('0x14')](_0x3672('0x24'),_0x19c931['message'],_0x302767);_0x45af32(_0x49f44b[_0x3672('0x14')](0x1f4,_0x19c931[_0x3672('0x16')]));});});};exports[_0x3672('0x25')]=function(_0x2fe61a){var _0x1f794a=this;return new Promise(function(_0x1caa6c,_0x1c219b){return db[_0x3672('0x22')][_0x3672('0x26')](_0x2fe61a[_0x3672('0x27')],{'raw':_0x2fe61a[_0x3672('0x1b')]?_0x2fe61a[_0x3672('0x1b')][_0x3672('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fe61a[_0x3672('0x1b')]?_0x2fe61a[_0x3672('0x1b')][_0x3672('0x1c')]||null:null,'attributes':_0x2fe61a[_0x3672('0x1b')]?_0x2fe61a['options']['attributes']||null:null,'limit':_0x2fe61a['options']?_0x2fe61a[_0x3672('0x1b')]['limit']||null:null})[_0x3672('0xd')](function(_0x1d23c7){logger[_0x3672('0xe')](_0x3672('0x25'),_0x2fe61a);logger[_0x3672('0x11')]('UpdateVoiceCallReport',_0x2fe61a,JSON[_0x3672('0x13')](_0x1d23c7));_0x1caa6c(_0x1d23c7);})[_0x3672('0x18')](function(_0x469c1a){logger[_0x3672('0x14')](_0x3672('0x25'),_0x469c1a[_0x3672('0x16')],_0x2fe61a);_0x1c219b(_0x1f794a[_0x3672('0x14')](0x1f4,_0x469c1a[_0x3672('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 400bfb4..4b6657f 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 _0x21cc=['isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller'];(function(_0x4b9900,_0x17e382){var _0x114982=function(_0x509206){while(--_0x509206){_0x4b9900['push'](_0x4b9900['shift']());}};_0x114982(++_0x17e382);}(_0x21cc,0xd0));var _0xc21c=function(_0x536eca,_0x18b615){_0x536eca=_0x536eca-0x0;var _0x28f35f=_0x21cc[_0x536eca];return _0x28f35f;};'use strict';var multer=require('multer');var util=require(_0xc21c('0x0'));var path=require('path');var timeout=require(_0xc21c('0x1'));var express=require(_0xc21c('0x2'));var router=express['Router']();var fs_extra=require(_0xc21c('0x3'));var auth=require(_0xc21c('0x4'));var interaction=require(_0xc21c('0x5'));var config=require(_0xc21c('0x6'));var controller=require(_0xc21c('0x7'));router['get']('/',auth[_0xc21c('0x8')](),controller['index']);router[_0xc21c('0x9')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0xb')]);router[_0xc21c('0xc')]('/',auth['isAuthenticated'](),controller[_0xc21c('0xd')]);router[_0xc21c('0xe')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0xf')]);router[_0xc21c('0x10')](_0xc21c('0xa'),auth[_0xc21c('0x8')](),controller[_0xc21c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7e73=['delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update'];(function(_0x1ce340,_0x558246){var _0x50fa4e=function(_0x22dcbc){while(--_0x22dcbc){_0x1ce340['push'](_0x1ce340['shift']());}};_0x50fa4e(++_0x558246);}(_0x7e73,0x1cb));var _0x37e7=function(_0x50e564,_0x8d0fbc){_0x50e564=_0x50e564-0x0;var _0x2c44c0=_0x7e73[_0x50e564];return _0x2c44c0;};'use strict';var multer=require(_0x37e7('0x0'));var util=require(_0x37e7('0x1'));var path=require('path');var timeout=require(_0x37e7('0x2'));var express=require('express');var router=express[_0x37e7('0x3')]();var fs_extra=require(_0x37e7('0x4'));var auth=require(_0x37e7('0x5'));var interaction=require(_0x37e7('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x37e7('0x7')](),controller[_0x37e7('0x8')]);router[_0x37e7('0x9')](_0x37e7('0xa'),auth[_0x37e7('0x7')](),controller[_0x37e7('0xb')]);router[_0x37e7('0xc')]('/',auth[_0x37e7('0x7')](),controller[_0x37e7('0xd')]);router[_0x37e7('0xe')]('/:id',auth[_0x37e7('0x7')](),controller[_0x37e7('0xf')]);router[_0x37e7('0x10')](_0x37e7('0xa'),auth['isAuthenticated'](),controller[_0x37e7('0x11')]);module[_0x37e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e9d2baa..303f939 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 _0x62c0=['BOOLEAN','sequelize','exports','STRING','name','options','join','getDataValue'];(function(_0x32fc4e,_0x5e9884){var _0x508311=function(_0x35b41f){while(--_0x35b41f){_0x32fc4e['push'](_0x32fc4e['shift']());}};_0x508311(++_0x5e9884);}(_0x62c0,0x151));var _0x062c=function(_0x54a9e3,_0x4a3813){_0x54a9e3=_0x54a9e3-0x0;var _0x247cce=_0x62c0[_0x54a9e3];return _0x247cce;};'use strict';var Sequelize=require(_0x062c('0x0'));module[_0x062c('0x1')]={'name':{'type':Sequelize[_0x062c('0x2')]},'prefix':{'type':Sequelize[_0x062c('0x2')],'unique':_0x062c('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x41bd42){this['setDataValue'](_0x062c('0x4'),_0x41bd42?_0x41bd42[_0x062c('0x5')](''):[]);},'get':function(){return this[_0x062c('0x6')](_0x062c('0x4'))?this[_0x062c('0x6')](_0x062c('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x062c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x062c('0x2')]},'record':{'type':Sequelize[_0x062c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x062c('0x2')]},'description':{'type':Sequelize[_0x062c('0x2')]}}; \ No newline at end of file +var _0x8fc0=['sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split','BOOLEAN'];(function(_0x13b1e0,_0x183380){var _0x3d9e9b=function(_0xce37e8){while(--_0xce37e8){_0x13b1e0['push'](_0x13b1e0['shift']());}};_0x3d9e9b(++_0x183380);}(_0x8fc0,0xe6));var _0x08fc=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x8fc0[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0x08fc('0x0'));module[_0x08fc('0x1')]={'name':{'type':Sequelize[_0x08fc('0x2')]},'prefix':{'type':Sequelize[_0x08fc('0x2')],'unique':_0x08fc('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x08fc('0x2')],'set':function(_0xd564f){this[_0x08fc('0x4')]('options',_0xd564f?_0xd564f[_0x08fc('0x5')](''):[]);},'get':function(){return this[_0x08fc('0x6')](_0x08fc('0x7'))?this[_0x08fc('0x6')](_0x08fc('0x7'))[_0x08fc('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x08fc('0x2')]},'record':{'type':Sequelize[_0x08fc('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x08fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index df6788a..8d0f518 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 _0x3657=['reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0xbd0f73,_0x4c8037){var _0x184fdc=function(_0x272e91){while(--_0x272e91){_0xbd0f73['push'](_0xbd0f73['shift']());}};_0x184fdc(++_0x4c8037);}(_0x3657,0x183));var _0x7365=function(_0x28e424,_0x4d6508){_0x28e424=_0x28e424-0x0;var _0x25ab59=_0x3657[_0x28e424];return _0x25ab59;};'use strict';var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require(_0x7365('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x3'));var moment=require(_0x7365('0x4'));var BPromise=require(_0x7365('0x5'));var Mustache=require(_0x7365('0x6'));var util=require('util');var path=require(_0x7365('0x7'));var sox=require(_0x7365('0x8'));var csv=require(_0x7365('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7365('0xa'));var _=require(_0x7365('0xb'));var squel=require(_0x7365('0xc'));var crypto=require('crypto');var jsforce=require(_0x7365('0xd'));var deskjs=require(_0x7365('0xe'));var toCsv=require(_0x7365('0x9'));var querystring=require('querystring');var Papa=require(_0x7365('0xf'));var Redis=require(_0x7365('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x12'));var logger=require(_0x7365('0x13'))(_0x7365('0x14'));var utils=require('../../config/utils');var config=require(_0x7365('0x15'));var licenseUtil=require(_0x7365('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1179b8,_0x33b248){_0x33b248=_0x33b248||0xcc;return function(_0x30c2a1){if(_0x30c2a1){return _0x1179b8[_0x7365('0x17')](_0x33b248);}return _0x1179b8[_0x7365('0x18')](_0x33b248)['end']();};}function respondWithResult(_0x2ba19c,_0x52f309){_0x52f309=_0x52f309||0xc8;return function(_0x39faaf){if(_0x39faaf){return _0x2ba19c['status'](_0x52f309)['json'](_0x39faaf);}};}function respondWithFilteredResult(_0xf753a3,_0x21548f){return function(_0x26cf47){if(_0x26cf47){var _0xb73d63=typeof _0x21548f[_0x7365('0x19')]==='undefined'&&typeof _0x21548f['limit']===_0x7365('0x1a');var _0x32980a=_0x26cf47['count'];var _0x337e7f=_0xb73d63?0x0:_0x21548f[_0x7365('0x19')];var _0x30dfe9=_0xb73d63?_0x26cf47[_0x7365('0x1b')]:_0x21548f[_0x7365('0x19')]+_0x21548f[_0x7365('0x1c')];var _0x3f52aa;if(_0x30dfe9>=_0x32980a){_0x30dfe9=_0x32980a;_0x3f52aa=0xc8;}else{_0x3f52aa=0xce;}_0xf753a3[_0x7365('0x18')](_0x3f52aa);return _0xf753a3[_0x7365('0x1d')](_0x7365('0x1e'),_0x337e7f+'-'+_0x30dfe9+'/'+_0x32980a)[_0x7365('0x1f')](_0x26cf47);}return null;};}function patchUpdates(_0x463d01){return function(_0x3d9027){try{jsonpatch[_0x7365('0x20')](_0x3d9027,_0x463d01,!![]);}catch(_0x3434bf){return BPromise[_0x7365('0x21')](_0x3434bf);}return _0x3d9027[_0x7365('0x22')]();};}function saveUpdates(_0x577bc3,_0x5da4fb){return function(_0x3c3571){if(_0x3c3571){return _0x3c3571[_0x7365('0x23')](_0x577bc3)[_0x7365('0x24')](function(_0x45cfe1){return _0x45cfe1;});}return null;};}function removeEntity(_0x43670f,_0x431fa1){return function(_0x582b65){if(_0x582b65){return _0x582b65[_0x7365('0x25')]()[_0x7365('0x24')](function(){var _0x3c9e48=_0x582b65[_0x7365('0x26')]({'plain':!![]});var _0x680d5b='ChanSpies';return db[_0x7365('0x27')][_0x7365('0x25')]({'where':{'type':_0x680d5b,'resourceId':_0x3c9e48['id']}})[_0x7365('0x24')](function(){return _0x582b65;});})[_0x7365('0x24')](function(){_0x43670f['status'](0xcc)[_0x7365('0x28')]();});}};}function handleEntityNotFound(_0xf4cdb6,_0x4a29f0){return function(_0x4dceeb){if(!_0x4dceeb){_0xf4cdb6[_0x7365('0x17')](0x194);}return _0x4dceeb;};}function handleError(_0x41a04f,_0x4e5242){_0x4e5242=_0x4e5242||0x1f4;return function(_0x3d1e72){logger['error'](_0x3d1e72[_0x7365('0x29')]);if(_0x3d1e72[_0x7365('0x2a')]){delete _0x3d1e72['name'];}_0x41a04f[_0x7365('0x18')](_0x4e5242)['send'](_0x3d1e72);};}exports[_0x7365('0x2b')]=function(_0x41b97a,_0x29277b){var _0x2af1fc={},_0x2f1c40={},_0xbdb78c={'count':0x0,'rows':[]};var _0x3439ae=_[_0x7365('0x2c')](db[_0x7365('0x2d')][_0x7365('0x2e')],function(_0x433c38){return{'name':_0x433c38[_0x7365('0x2f')],'type':_0x433c38['type'][_0x7365('0x30')]};});_0x2f1c40['model']=_[_0x7365('0x2c')](_0x3439ae,_0x7365('0x2a'));_0x2f1c40[_0x7365('0x31')]=_['keys'](_0x41b97a['query']);_0x2f1c40['filters']=_[_0x7365('0x32')](_0x2f1c40[_0x7365('0x33')],_0x2f1c40[_0x7365('0x31')]);_0x2af1fc[_0x7365('0x34')]=_[_0x7365('0x32')](_0x2f1c40[_0x7365('0x33')],qs['fields'](_0x41b97a[_0x7365('0x31')][_0x7365('0x35')]));_0x2af1fc[_0x7365('0x34')]=_0x2af1fc['attributes']['length']?_0x2af1fc['attributes']:_0x2f1c40[_0x7365('0x33')];if(!_0x41b97a[_0x7365('0x31')][_0x7365('0x36')](_0x7365('0x37'))){_0x2af1fc[_0x7365('0x1c')]=qs[_0x7365('0x1c')](_0x41b97a[_0x7365('0x31')][_0x7365('0x1c')]);_0x2af1fc[_0x7365('0x19')]=qs[_0x7365('0x19')](_0x41b97a[_0x7365('0x31')]['offset']);}_0x2af1fc['order']=qs[_0x7365('0x38')](_0x41b97a['query'][_0x7365('0x38')]);_0x2af1fc[_0x7365('0x39')]=qs['filters'](_[_0x7365('0x3a')](_0x41b97a['query'],_0x2f1c40[_0x7365('0x3b')]),_0x3439ae);if(_0x41b97a[_0x7365('0x31')][_0x7365('0x3c')]){_0x2af1fc[_0x7365('0x39')]=_[_0x7365('0x3d')](_0x2af1fc[_0x7365('0x39')],{'$or':_[_0x7365('0x2c')](_0x3439ae,function(_0x19a33b){if(_0x19a33b[_0x7365('0x3e')]!==_0x7365('0x3f')){var _0x493d4f={};_0x493d4f[_0x19a33b[_0x7365('0x2a')]]={'$like':'%'+_0x41b97a['query']['filter']+'%'};return _0x493d4f;}})});}_0x2af1fc=_[_0x7365('0x3d')]({},_0x2af1fc,_0x41b97a[_0x7365('0x40')]);var _0x266c35={'where':_0x2af1fc[_0x7365('0x39')]};return db[_0x7365('0x2d')][_0x7365('0x1b')](_0x266c35)[_0x7365('0x24')](function(_0x4e646e){_0xbdb78c[_0x7365('0x1b')]=_0x4e646e;if(_0x41b97a[_0x7365('0x31')][_0x7365('0x41')]){_0x2af1fc[_0x7365('0x42')]=[{'all':!![]}];}return db[_0x7365('0x2d')][_0x7365('0x43')](_0x2af1fc);})[_0x7365('0x24')](function(_0x3276c8){_0xbdb78c[_0x7365('0x44')]=_0x3276c8;return _0xbdb78c;})[_0x7365('0x24')](respondWithFilteredResult(_0x29277b,_0x2af1fc))[_0x7365('0x45')](handleError(_0x29277b,null));};exports['show']=function(_0x4b9f1a,_0x5aaf16){var _0x35b966={'raw':![],'where':{'id':_0x4b9f1a[_0x7365('0x46')]['id']}},_0x75e2e1={};_0x75e2e1[_0x7365('0x33')]=_[_0x7365('0x47')](db[_0x7365('0x2d')][_0x7365('0x2e')]);_0x75e2e1['query']=_[_0x7365('0x47')](_0x4b9f1a[_0x7365('0x31')]);_0x75e2e1['filters']=_[_0x7365('0x32')](_0x75e2e1['model'],_0x75e2e1['query']);_0x35b966[_0x7365('0x34')]=_[_0x7365('0x32')](_0x75e2e1[_0x7365('0x33')],qs[_0x7365('0x35')](_0x4b9f1a['query'][_0x7365('0x35')]));_0x35b966[_0x7365('0x34')]=_0x35b966[_0x7365('0x34')][_0x7365('0x48')]?_0x35b966[_0x7365('0x34')]:_0x75e2e1[_0x7365('0x33')];if(_0x4b9f1a['query']['includeAll']){_0x35b966[_0x7365('0x42')]=[{'all':!![]}];}_0x35b966=_[_0x7365('0x3d')]({},_0x35b966,_0x4b9f1a['options']);return db['VoiceChanSpy'][_0x7365('0x49')](_0x35b966)[_0x7365('0x24')](handleEntityNotFound(_0x5aaf16,null))[_0x7365('0x24')](respondWithResult(_0x5aaf16,null))[_0x7365('0x45')](handleError(_0x5aaf16,null));};exports[_0x7365('0x4a')]=function(_0x4333a9,_0x4543af){return db['VoiceChanSpy'][_0x7365('0x4a')](_0x4333a9[_0x7365('0x4b')],{})[_0x7365('0x24')](function(_0x3ff5b9){var _0x3ef995=_0x4333a9[_0x7365('0x4c')]['get']({'plain':!![]});if(!_0x3ef995)throw new Error(_0x7365('0x4d'));if(_0x3ef995[_0x7365('0x4e')]===_0x7365('0x4c')){var _0x38e9ff=_0x3ff5b9[_0x7365('0x26')]({'plain':!![]});var _0x4f4eda='ChanSpies';return db[_0x7365('0x4f')][_0x7365('0x49')]({'where':{'name':_0x4f4eda,'userProfileId':_0x3ef995[_0x7365('0x50')]},'raw':!![]})['then'](function(_0x2e100b){if(_0x2e100b&&_0x2e100b[_0x7365('0x51')]===0x0){return db[_0x7365('0x27')][_0x7365('0x4a')]({'name':_0x38e9ff['name'],'resourceId':_0x38e9ff['id'],'type':_0x2e100b[_0x7365('0x2a')],'sectionId':_0x2e100b['id']},{})[_0x7365('0x24')](function(){return _0x3ff5b9;});}else{return _0x3ff5b9;}})[_0x7365('0x45')](function(_0x3ec79c){logger[_0x7365('0x52')](_0x7365('0x53'),_0x3ec79c);throw _0x3ec79c;});}return _0x3ff5b9;})[_0x7365('0x24')](respondWithResult(_0x4543af,0xc9))[_0x7365('0x45')](handleError(_0x4543af,null));};exports[_0x7365('0x23')]=function(_0x3522f0,_0x5b9726){if(_0x3522f0[_0x7365('0x4b')]['id']){delete _0x3522f0[_0x7365('0x4b')]['id'];}return db['VoiceChanSpy'][_0x7365('0x49')]({'where':{'id':_0x3522f0[_0x7365('0x46')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x5b9726,null))[_0x7365('0x24')](saveUpdates(_0x3522f0['body'],null))[_0x7365('0x24')](respondWithResult(_0x5b9726,null))['catch'](handleError(_0x5b9726,null));};exports[_0x7365('0x25')]=function(_0xf7af20,_0x10808e){return db['VoiceChanSpy'][_0x7365('0x49')]({'where':{'id':_0xf7af20['params']['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x10808e,null))[_0x7365('0x24')](removeEntity(_0x10808e,null))[_0x7365('0x45')](handleError(_0x10808e,null));}; \ No newline at end of file +var _0x85b5=['save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','reject'];(function(_0x543363,_0x122f9e){var _0x416317=function(_0x28178f){while(--_0x28178f){_0x543363['push'](_0x543363['shift']());}};_0x416317(++_0x122f9e);}(_0x85b5,0x7f));var _0x585b=function(_0x10cd27,_0x4cbc07){_0x10cd27=_0x10cd27-0x0;var _0x1ff482=_0x85b5[_0x10cd27];return _0x1ff482;};'use strict';var emlformat=require(_0x585b('0x0'));var rimraf=require(_0x585b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x585b('0x2'));var rp=require('request-promise');var moment=require(_0x585b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x585b('0x4'));var path=require('path');var sox=require(_0x585b('0x5'));var csv=require(_0x585b('0x6'));var ejs=require(_0x585b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x585b('0x8'));var squel=require('squel');var crypto=require(_0x585b('0x9'));var jsforce=require(_0x585b('0xa'));var deskjs=require(_0x585b('0xb'));var toCsv=require(_0x585b('0x6'));var querystring=require('querystring');var Papa=require(_0x585b('0xc'));var Redis=require(_0x585b('0xd'));var authService=require(_0x585b('0xe'));var qs=require(_0x585b('0xf'));var as=require(_0x585b('0x10'));var hardwareService=require(_0x585b('0x11'));var logger=require(_0x585b('0x12'))('api');var utils=require(_0x585b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x585b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16d608,_0x35bda0){_0x35bda0=_0x35bda0||0xcc;return function(_0x19336c){if(_0x19336c){return _0x16d608['sendStatus'](_0x35bda0);}return _0x16d608[_0x585b('0x15')](_0x35bda0)[_0x585b('0x16')]();};}function respondWithResult(_0x3d15ed,_0x299ee4){_0x299ee4=_0x299ee4||0xc8;return function(_0x3dcc28){if(_0x3dcc28){return _0x3d15ed[_0x585b('0x15')](_0x299ee4)[_0x585b('0x17')](_0x3dcc28);}};}function respondWithFilteredResult(_0x5ebc1a,_0x2f827f){return function(_0x41f50d){if(_0x41f50d){var _0x4c094e=typeof _0x2f827f['offset']===_0x585b('0x18')&&typeof _0x2f827f['limit']==='undefined';var _0x2f840e=_0x41f50d[_0x585b('0x19')];var _0x20c4ba=_0x4c094e?0x0:_0x2f827f['offset'];var _0x72fdc4=_0x4c094e?_0x41f50d[_0x585b('0x19')]:_0x2f827f[_0x585b('0x1a')]+_0x2f827f[_0x585b('0x1b')];var _0x562886;if(_0x72fdc4>=_0x2f840e){_0x72fdc4=_0x2f840e;_0x562886=0xc8;}else{_0x562886=0xce;}_0x5ebc1a[_0x585b('0x15')](_0x562886);return _0x5ebc1a[_0x585b('0x1c')](_0x585b('0x1d'),_0x20c4ba+'-'+_0x72fdc4+'/'+_0x2f840e)['json'](_0x41f50d);}return null;};}function patchUpdates(_0x5200ec){return function(_0x6bea29){try{jsonpatch['apply'](_0x6bea29,_0x5200ec,!![]);}catch(_0x484157){return BPromise[_0x585b('0x1e')](_0x484157);}return _0x6bea29[_0x585b('0x1f')]();};}function saveUpdates(_0x48d9f8,_0x183308){return function(_0x272a8d){if(_0x272a8d){return _0x272a8d['update'](_0x48d9f8)[_0x585b('0x20')](function(_0xe50751){return _0xe50751;});}return null;};}function removeEntity(_0x2122e0,_0x5bf9e4){return function(_0x1c8a7b){if(_0x1c8a7b){return _0x1c8a7b['destroy']()[_0x585b('0x20')](function(){var _0x10dd42=_0x1c8a7b[_0x585b('0x21')]({'plain':!![]});var _0x428a9a=_0x585b('0x22');return db[_0x585b('0x23')][_0x585b('0x24')]({'where':{'type':_0x428a9a,'resourceId':_0x10dd42['id']}})[_0x585b('0x20')](function(){return _0x1c8a7b;});})[_0x585b('0x20')](function(){_0x2122e0[_0x585b('0x15')](0xcc)[_0x585b('0x16')]();});}};}function handleEntityNotFound(_0x35075c,_0x11dc56){return function(_0x476ed9){if(!_0x476ed9){_0x35075c[_0x585b('0x25')](0x194);}return _0x476ed9;};}function handleError(_0x554099,_0x2f848c){_0x2f848c=_0x2f848c||0x1f4;return function(_0x205ffe){logger[_0x585b('0x26')](_0x205ffe[_0x585b('0x27')]);if(_0x205ffe['name']){delete _0x205ffe['name'];}_0x554099[_0x585b('0x15')](_0x2f848c)[_0x585b('0x28')](_0x205ffe);};}exports['index']=function(_0x2ce768,_0x112fb5){var _0x5c9249={},_0x47020d={},_0x3e700a={'count':0x0,'rows':[]};var _0x2ab871=_[_0x585b('0x29')](db[_0x585b('0x2a')][_0x585b('0x2b')],function(_0x227149){return{'name':_0x227149[_0x585b('0x2c')],'type':_0x227149[_0x585b('0x2d')][_0x585b('0x2e')]};});_0x47020d['model']=_[_0x585b('0x29')](_0x2ab871,_0x585b('0x2f'));_0x47020d[_0x585b('0x30')]=_['keys'](_0x2ce768[_0x585b('0x30')]);_0x47020d[_0x585b('0x31')]=_[_0x585b('0x32')](_0x47020d['model'],_0x47020d[_0x585b('0x30')]);_0x5c9249[_0x585b('0x33')]=_[_0x585b('0x32')](_0x47020d[_0x585b('0x34')],qs['fields'](_0x2ce768['query'][_0x585b('0x35')]));_0x5c9249[_0x585b('0x33')]=_0x5c9249[_0x585b('0x33')][_0x585b('0x36')]?_0x5c9249[_0x585b('0x33')]:_0x47020d['model'];if(!_0x2ce768[_0x585b('0x30')][_0x585b('0x37')](_0x585b('0x38'))){_0x5c9249[_0x585b('0x1b')]=qs[_0x585b('0x1b')](_0x2ce768['query']['limit']);_0x5c9249['offset']=qs[_0x585b('0x1a')](_0x2ce768[_0x585b('0x30')][_0x585b('0x1a')]);}_0x5c9249[_0x585b('0x39')]=qs[_0x585b('0x3a')](_0x2ce768[_0x585b('0x30')][_0x585b('0x3a')]);_0x5c9249[_0x585b('0x3b')]=qs[_0x585b('0x31')](_['pick'](_0x2ce768[_0x585b('0x30')],_0x47020d[_0x585b('0x31')]),_0x2ab871);if(_0x2ce768['query'][_0x585b('0x3c')]){_0x5c9249[_0x585b('0x3b')]=_[_0x585b('0x3d')](_0x5c9249[_0x585b('0x3b')],{'$or':_[_0x585b('0x29')](_0x2ab871,function(_0x12f7b1){if(_0x12f7b1['type']!==_0x585b('0x3e')){var _0x3c10b2={};_0x3c10b2[_0x12f7b1[_0x585b('0x2f')]]={'$like':'%'+_0x2ce768[_0x585b('0x30')][_0x585b('0x3c')]+'%'};return _0x3c10b2;}})});}_0x5c9249=_[_0x585b('0x3d')]({},_0x5c9249,_0x2ce768[_0x585b('0x3f')]);var _0xc543ca={'where':_0x5c9249['where']};return db[_0x585b('0x2a')][_0x585b('0x19')](_0xc543ca)[_0x585b('0x20')](function(_0x4c5a14){_0x3e700a[_0x585b('0x19')]=_0x4c5a14;if(_0x2ce768[_0x585b('0x30')][_0x585b('0x40')]){_0x5c9249['include']=[{'all':!![]}];}return db[_0x585b('0x2a')][_0x585b('0x41')](_0x5c9249);})['then'](function(_0x4edd57){_0x3e700a[_0x585b('0x42')]=_0x4edd57;return _0x3e700a;})['then'](respondWithFilteredResult(_0x112fb5,_0x5c9249))[_0x585b('0x43')](handleError(_0x112fb5,null));};exports['show']=function(_0x207d79,_0x33380b){var _0x5e989e={'raw':![],'where':{'id':_0x207d79['params']['id']}},_0xa26652={};_0xa26652['model']=_['keys'](db[_0x585b('0x2a')]['rawAttributes']);_0xa26652[_0x585b('0x30')]=_[_0x585b('0x44')](_0x207d79['query']);_0xa26652[_0x585b('0x31')]=_[_0x585b('0x32')](_0xa26652[_0x585b('0x34')],_0xa26652['query']);_0x5e989e['attributes']=_['intersection'](_0xa26652[_0x585b('0x34')],qs[_0x585b('0x35')](_0x207d79[_0x585b('0x30')][_0x585b('0x35')]));_0x5e989e['attributes']=_0x5e989e[_0x585b('0x33')][_0x585b('0x36')]?_0x5e989e[_0x585b('0x33')]:_0xa26652[_0x585b('0x34')];if(_0x207d79['query'][_0x585b('0x40')]){_0x5e989e[_0x585b('0x45')]=[{'all':!![]}];}_0x5e989e=_[_0x585b('0x3d')]({},_0x5e989e,_0x207d79[_0x585b('0x3f')]);return db[_0x585b('0x2a')]['find'](_0x5e989e)['then'](handleEntityNotFound(_0x33380b,null))['then'](respondWithResult(_0x33380b,null))[_0x585b('0x43')](handleError(_0x33380b,null));};exports['create']=function(_0x1f8ae0,_0x54ab6f){return db['VoiceChanSpy']['create'](_0x1f8ae0[_0x585b('0x46')],{})[_0x585b('0x20')](function(_0x47c349){var _0x5116a8=_0x1f8ae0[_0x585b('0x47')][_0x585b('0x21')]({'plain':!![]});if(!_0x5116a8)throw new Error(_0x585b('0x48'));if(_0x5116a8['role']===_0x585b('0x47')){var _0x4ca120=_0x47c349[_0x585b('0x21')]({'plain':!![]});var _0x5f31cb=_0x585b('0x22');return db['UserProfileSection'][_0x585b('0x49')]({'where':{'name':_0x5f31cb,'userProfileId':_0x5116a8['userProfileId']},'raw':!![]})[_0x585b('0x20')](function(_0x259dac){if(_0x259dac&&_0x259dac[_0x585b('0x4a')]===0x0){return db[_0x585b('0x23')][_0x585b('0x4b')]({'name':_0x4ca120['name'],'resourceId':_0x4ca120['id'],'type':_0x259dac[_0x585b('0x2f')],'sectionId':_0x259dac['id']},{})[_0x585b('0x20')](function(){return _0x47c349;});}else{return _0x47c349;}})[_0x585b('0x43')](function(_0x2d0f60){logger[_0x585b('0x26')](_0x585b('0x4c'),_0x2d0f60);throw _0x2d0f60;});}return _0x47c349;})['then'](respondWithResult(_0x54ab6f,0xc9))[_0x585b('0x43')](handleError(_0x54ab6f,null));};exports[_0x585b('0x4d')]=function(_0x14a30b,_0x2f0741){if(_0x14a30b['body']['id']){delete _0x14a30b[_0x585b('0x46')]['id'];}return db[_0x585b('0x2a')][_0x585b('0x49')]({'where':{'id':_0x14a30b['params']['id']}})['then'](handleEntityNotFound(_0x2f0741,null))['then'](saveUpdates(_0x14a30b['body'],null))['then'](respondWithResult(_0x2f0741,null))['catch'](handleError(_0x2f0741,null));};exports[_0x585b('0x24')]=function(_0x39f29e,_0x102733){return db['VoiceChanSpy'][_0x585b('0x49')]({'where':{'id':_0x39f29e[_0x585b('0x4e')]['id']}})[_0x585b('0x20')](handleEntityNotFound(_0x102733,null))[_0x585b('0x20')](removeEntity(_0x102733,null))['catch'](handleError(_0x102733,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9a3663a..6f30871 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 _0x6d43=['%s%s','prefix','system','merge','format','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','push','SIP/%s,%s','name','options','join','record','StopMixMonitor','length','internal','concat','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','context','from-sip'];(function(_0x292419,_0x298ef2){var _0x20dc90=function(_0x2e468a){while(--_0x2e468a){_0x292419['push'](_0x292419['shift']());}};_0x20dc90(++_0x298ef2);}(_0x6d43,0x124));var _0x36d4=function(_0x378930,_0x2d5b88){_0x378930=_0x378930-0x0;var _0x2b6a1e=_0x6d43[_0x378930];return _0x2b6a1e;};'use strict';var _=require(_0x36d4('0x0'));var util=require(_0x36d4('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1e6082,_0x529c26,_0x20df09){var _0x5501b3=0x1;var _0x6b24f4=[];var _0x360e5e={'context':_0x529c26[_0x36d4('0x2')]||_0x36d4('0x3'),'exten':util['format'](_0x36d4('0x4'),_0x1e6082[_0x36d4('0x5')],_0x20df09),'type':_0x36d4('0x6'),'isApp':![],'ChanSpyId':_0x1e6082['id'],'UserId':_0x529c26['id']};_0x6b24f4['push'](_[_0x36d4('0x7')]({'app':'Set','appdata':util[_0x36d4('0x8')](_0x36d4('0x9'),_0x36d4('0xa')),'priority':_0x5501b3++},_0x360e5e));if(_0x1e6082['record']){_0x6b24f4['push'](_[_0x36d4('0x7')]({'app':_0x36d4('0xb'),'appdata':util[_0x36d4('0x8')](_0x36d4('0xc'),_0x1e6082[_0x36d4('0xd')]),'priority':_0x5501b3++},_0x360e5e));}if(_0x1e6082['auth']){_0x6b24f4['push'](_['merge']({'app':_0x36d4('0xe'),'appdata':_0x1e6082['password'],'priority':_0x5501b3++},_0x360e5e));}_0x6b24f4[_0x36d4('0xf')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x36d4('0x10'),_0x529c26[_0x36d4('0x11')],_0x1e6082['options']?_0x1e6082[_0x36d4('0x12')][_0x36d4('0x13')](''):''),'priority':_0x5501b3++},_0x360e5e));if(_0x1e6082[_0x36d4('0x14')]){_0x6b24f4[_0x36d4('0xf')](_[_0x36d4('0x7')]({'app':_0x36d4('0x15'),'priority':_0x5501b3++},_0x360e5e));}return _0x6b24f4;};var getChanSpyApplications=function(_0x36a209,_0x4e79db){var _0x456288=[];for(var _0x370426=0x0,_0x2282b0=0x1;_0x370426<_0x4e79db[_0x36d4('0x16')];_0x370426++,_0x2282b0=0x1){_0x456288=_0x456288['concat'](getUserApplications(_0x36a209,_0x4e79db[_0x370426],_0x4e79db[_0x370426][_0x36d4('0x17')]));if(_0x4e79db[_0x370426]['internal']!=_0x4e79db[_0x370426][_0x36d4('0x11')]){_0x456288=_0x456288[_0x36d4('0x18')](getUserApplications(_0x36a209,_0x4e79db[_0x370426],_0x4e79db[_0x370426][_0x36d4('0x11')]));}}return _0x456288;};var getChanSpyPromise=function(_0x441248,_0x15c894){return new BPromise(function(_0x101517,_0x13ceb2){return _0x441248['User'][_0x36d4('0x19')]({'attributes':['id','name','internal'],'where':{'role':_0x36d4('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1cf7fc){if(_0x1cf7fc){return _0x101517(getChanSpyApplications(_0x15c894,_0x1cf7fc));}return _0x101517([]);})[_0x36d4('0x1b')](function(_0x3e55bd){_0x13ceb2(_0x3e55bd);});});};module[_0x36d4('0x1c')]=function(_0x418a3a,_0xc976f7){var _0x34be56=_0x418a3a[_0x36d4('0x1d')];return _0x418a3a[_0x36d4('0x1e')](_0x36d4('0x1f'),attributes,{'tableName':_0x36d4('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c923,_0x5e6a12,_0x59bcd5){return getChanSpyPromise(_0x34be56,_0x28c923)[_0x36d4('0x21')](function(_0x2d62b8){if(_0x2d62b8&&_0x2d62b8[_0x36d4('0x16')]){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x23')](_0x2d62b8);}})['then'](function(){_0x59bcd5();})['catch'](function(_0x1f9614){_0x59bcd5(_0x1f9614);});},'afterUpdate':function(_0x4ee097,_0x383c91,_0x345ff6){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x24')]({'where':{'ChanSpyId':_0x4ee097['id']}})[_0x36d4('0x21')](function(){return getChanSpyPromise(_0x34be56,_0x4ee097);})['then'](function(_0x443dc5){if(_0x443dc5&&_0x443dc5[_0x36d4('0x16')]){return _0x34be56[_0x36d4('0x22')]['bulkCreate'](_0x443dc5);}})['then'](function(){_0x345ff6();})[_0x36d4('0x1b')](function(_0x52a59e){_0x345ff6(_0x52a59e);});},'afterDestroy':function(_0x168c03,_0x568b1b,_0x350bc2){return _0x34be56[_0x36d4('0x22')][_0x36d4('0x24')]({'where':{'ChanSpyId':_0x168c03['id']}})[_0x36d4('0x21')](function(){_0x350bc2();})['catch'](function(_0x590f63){_0x350bc2(_0x590f63);});}}});}; \ No newline at end of file +var _0x445b=['name','options','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s'];(function(_0x83e492,_0x1b2238){var _0x19c748=function(_0x158db7){while(--_0x158db7){_0x83e492['push'](_0x83e492['shift']());}};_0x19c748(++_0x1b2238);}(_0x445b,0x11c));var _0xb445=function(_0x3976cb,_0x136270){_0x3976cb=_0x3976cb-0x0;var _0x3842ca=_0x445b[_0x3976cb];return _0x3842ca;};'use strict';var _=require(_0xb445('0x0'));var util=require('util');var BPromise=require(_0xb445('0x1'));var attributes=require(_0xb445('0x2'));var getUserApplications=function(_0x45f8bb,_0x4028df,_0x48b4ab){var _0x80a337=0x1;var _0x3d7bdf=[];var _0x138529={'context':_0x4028df[_0xb445('0x3')]||_0xb445('0x4'),'exten':util[_0xb445('0x5')](_0xb445('0x6'),_0x45f8bb[_0xb445('0x7')],_0x48b4ab),'type':'system','isApp':![],'ChanSpyId':_0x45f8bb['id'],'UserId':_0x4028df['id']};_0x3d7bdf[_0xb445('0x8')](_[_0xb445('0x9')]({'app':_0xb445('0xa'),'appdata':util[_0xb445('0x5')](_0xb445('0xb'),_0xb445('0xc')),'priority':_0x80a337++},_0x138529));if(_0x45f8bb[_0xb445('0xd')]){_0x3d7bdf['push'](_[_0xb445('0x9')]({'app':_0xb445('0xe'),'appdata':util[_0xb445('0x5')](_0xb445('0xf'),_0x45f8bb['recordingFormat']),'priority':_0x80a337++},_0x138529));}if(_0x45f8bb['auth']){_0x3d7bdf[_0xb445('0x8')](_[_0xb445('0x9')]({'app':_0xb445('0x10'),'appdata':_0x45f8bb[_0xb445('0x11')],'priority':_0x80a337++},_0x138529));}_0x3d7bdf[_0xb445('0x8')](_['merge']({'app':_0xb445('0x12'),'appdata':util[_0xb445('0x5')](_0xb445('0x13'),_0x4028df[_0xb445('0x14')],_0x45f8bb[_0xb445('0x15')]?_0x45f8bb[_0xb445('0x15')]['join'](''):''),'priority':_0x80a337++},_0x138529));if(_0x45f8bb[_0xb445('0xd')]){_0x3d7bdf['push'](_[_0xb445('0x9')]({'app':_0xb445('0x16'),'priority':_0x80a337++},_0x138529));}return _0x3d7bdf;};var getChanSpyApplications=function(_0x1f7363,_0x42188d){var _0x435b99=[];for(var _0x2da31e=0x0,_0x6f783a=0x1;_0x2da31e<_0x42188d[_0xb445('0x17')];_0x2da31e++,_0x6f783a=0x1){_0x435b99=_0x435b99['concat'](getUserApplications(_0x1f7363,_0x42188d[_0x2da31e],_0x42188d[_0x2da31e][_0xb445('0x18')]));if(_0x42188d[_0x2da31e][_0xb445('0x18')]!=_0x42188d[_0x2da31e][_0xb445('0x14')]){_0x435b99=_0x435b99[_0xb445('0x19')](getUserApplications(_0x1f7363,_0x42188d[_0x2da31e],_0x42188d[_0x2da31e][_0xb445('0x14')]));}}return _0x435b99;};var getChanSpyPromise=function(_0x16f03c,_0x48ec66){return new BPromise(function(_0x34f526,_0x31a277){return _0x16f03c[_0xb445('0x1a')][_0xb445('0x1b')]({'attributes':['id',_0xb445('0x14'),'internal'],'where':{'role':_0xb445('0x1c'),'chanspy':!![]},'raw':!![]})[_0xb445('0x1d')](function(_0x141e6f){if(_0x141e6f){return _0x34f526(getChanSpyApplications(_0x48ec66,_0x141e6f));}return _0x34f526([]);})[_0xb445('0x1e')](function(_0x1ef001){_0x31a277(_0x1ef001);});});};module[_0xb445('0x1f')]=function(_0x28aaa3,_0x4fc8ee){var _0xf12ec1=_0x28aaa3[_0xb445('0x20')];return _0x28aaa3[_0xb445('0x21')](_0xb445('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa1a5e7,_0x219ad8,_0x1f6ef){return getChanSpyPromise(_0xf12ec1,_0xa1a5e7)['then'](function(_0x1513b2){if(_0x1513b2&&_0x1513b2[_0xb445('0x17')]){return _0xf12ec1[_0xb445('0x23')][_0xb445('0x24')](_0x1513b2);}})[_0xb445('0x1d')](function(){_0x1f6ef();})[_0xb445('0x1e')](function(_0x7dd059){_0x1f6ef(_0x7dd059);});},'afterUpdate':function(_0x36cb20,_0x282345,_0xcc874b){return _0xf12ec1[_0xb445('0x23')][_0xb445('0x25')]({'where':{'ChanSpyId':_0x36cb20['id']}})['then'](function(){return getChanSpyPromise(_0xf12ec1,_0x36cb20);})[_0xb445('0x1d')](function(_0x1e5817){if(_0x1e5817&&_0x1e5817[_0xb445('0x17')]){return _0xf12ec1['VoiceExtension'][_0xb445('0x24')](_0x1e5817);}})['then'](function(){_0xcc874b();})[_0xb445('0x1e')](function(_0x50d4de){_0xcc874b(_0x50d4de);});},'afterDestroy':function(_0x4e48e7,_0x4c5e78,_0x71d530){return _0xf12ec1['VoiceExtension'][_0xb445('0x25')]({'where':{'ChanSpyId':_0x4e48e7['id']}})['then'](function(){_0x71d530();})[_0xb445('0x1e')](function(_0x92e1c0){_0x71d530(_0x92e1c0);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e792bd4..d988256 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 _0x2356=['then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','rpc','client','http'];(function(_0xb054e3,_0x235c2f){var _0x3e6c59=function(_0x58a6cc){while(--_0x58a6cc){_0xb054e3['push'](_0xb054e3['shift']());}};_0x3e6c59(++_0x235c2f);}(_0x2356,0x14f));var _0x6235=function(_0x42df18,_0x57ce64){_0x42df18=_0x42df18-0x0;var _0x1f5a27=_0x2356[_0x42df18];return _0x1f5a27;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3663e7,_0x47f3a5,_0x4c15c6){return new BPromise(function(_0x547159,_0x3a5750){return client['request'](_0x3663e7,_0x4c15c6)[_0x6235('0x7')](function(_0x11d1f9){logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,'request\x20sent');logger[_0x6235('0xa')](_0x6235('0xb'),_0x47f3a5,_0x6235('0xc'),JSON[_0x6235('0xd')](_0x11d1f9));if(_0x11d1f9[_0x6235('0xe')]){if(_0x11d1f9['error'][_0x6235('0xf')]===0x1f4){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x11d1f9[_0x6235('0xe')]['message']);return _0x3a5750(_0x11d1f9[_0x6235('0xe')][_0x6235('0x10')]);}logger['error'](_0x6235('0x9'),_0x47f3a5,_0x11d1f9['error'][_0x6235('0x10')]);return _0x547159(_0x11d1f9[_0x6235('0xe')]['message']);}else{logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,_0x6235('0xc'));_0x547159(_0x11d1f9[_0x6235('0x11')]['message']);}})[_0x6235('0x12')](function(_0x190d7c){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x190d7c);_0x3a5750(_0x190d7c);});});} \ No newline at end of file +var _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xee5b,0x1f4));var _0xbee5=function(_0x446543,_0x3644c4){_0x446543=_0x446543-0x0;var _0x40ddc1=_0xee5b[_0x446543];return _0x40ddc1;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5b307a8..47023a6 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 _0x51f6=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x51f6,0x169));var _0x651f=function(_0xf61301,_0x4d93a9){_0xf61301=_0xf61301-0x0;var _0x7201f4=_0x51f6[_0xf61301];return _0x7201f4;};'use strict';var multer=require(_0x651f('0x0'));var util=require(_0x651f('0x1'));var path=require(_0x651f('0x2'));var timeout=require('connect-timeout');var express=require(_0x651f('0x3'));var router=express[_0x651f('0x4')]();var fs_extra=require(_0x651f('0x5'));var auth=require(_0x651f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x651f('0x7'));var controller=require(_0x651f('0x8'));router[_0x651f('0x9')]('/',auth['isAuthenticated'](),controller[_0x651f('0xa')]);router['get'](_0x651f('0xb'),auth[_0x651f('0xc')](),controller['show']);router[_0x651f('0xd')]('/',auth[_0x651f('0xc')](),controller[_0x651f('0xe')]);router[_0x651f('0xf')](_0x651f('0xb'),auth[_0x651f('0xc')](),controller[_0x651f('0x10')]);router[_0x651f('0x11')]('/:id',auth[_0x651f('0xc')](),controller[_0x651f('0x12')]);module[_0x651f('0x13')]=router; \ No newline at end of file +var _0x2d9c=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create','put','util'];(function(_0x146ac1,_0xe96031){var _0x26404c=function(_0x41224e){while(--_0x41224e){_0x146ac1['push'](_0x146ac1['shift']());}};_0x26404c(++_0xe96031);}(_0x2d9c,0x1df));var _0xc2d9=function(_0x5b9a6d,_0x12f1f4){_0x5b9a6d=_0x5b9a6d-0x0;var _0xe32e65=_0x2d9c[_0x5b9a6d];return _0xe32e65;};'use strict';var multer=require('multer');var util=require(_0xc2d9('0x0'));var path=require(_0xc2d9('0x1'));var timeout=require(_0xc2d9('0x2'));var express=require('express');var router=express[_0xc2d9('0x3')]();var fs_extra=require(_0xc2d9('0x4'));var auth=require(_0xc2d9('0x5'));var interaction=require(_0xc2d9('0x6'));var config=require(_0xc2d9('0x7'));var controller=require(_0xc2d9('0x8'));router[_0xc2d9('0x9')]('/',auth[_0xc2d9('0xa')](),controller[_0xc2d9('0xb')]);router[_0xc2d9('0x9')](_0xc2d9('0xc'),auth[_0xc2d9('0xa')](),controller[_0xc2d9('0xd')]);router['post']('/',auth[_0xc2d9('0xa')](),controller[_0xc2d9('0xe')]);router[_0xc2d9('0xf')](_0xc2d9('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc2d9('0xc'),auth[_0xc2d9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e527844..af0793a 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 _0x2d3e=['exports','STRING','name','BOOLEAN'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x2d3e,0x1b8));var _0xe2d3=function(_0x2bba5f,_0x4e0e85){_0x2bba5f=_0x2bba5f-0x0;var _0x475de7=_0x2d3e[_0x2bba5f];return _0x475de7;};'use strict';var Sequelize=require('sequelize');module[_0xe2d3('0x0')]={'name':{'type':Sequelize[_0xe2d3('0x1')],'unique':_0xe2d3('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe2d3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb893=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x161d41,_0x306119){var _0x21daf6=function(_0x1429fa){while(--_0x1429fa){_0x161d41['push'](_0x161d41['shift']());}};_0x21daf6(++_0x306119);}(_0xb893,0x77));var _0x3b89=function(_0x5f1c59,_0x3fff4c){_0x5f1c59=_0x5f1c59-0x0;var _0xbfb242=_0xb893[_0x5f1c59];return _0xbfb242;};'use strict';var Sequelize=require(_0x3b89('0x0'));module[_0x3b89('0x1')]={'name':{'type':Sequelize[_0x3b89('0x2')],'unique':_0x3b89('0x3')},'description':{'type':Sequelize[_0x3b89('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3b89('0x4')],'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 7661631..22a5561 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 _0x671d=['end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','get','Contexts','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','VoiceContext','rows','show','params','fields','options','create','body','findAll','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/context.ejs','Reload','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','status'];(function(_0x387e50,_0x106d75){var _0xa79d84=function(_0x308ec7){while(--_0x308ec7){_0x387e50['push'](_0x387e50['shift']());}};_0xa79d84(++_0x106d75);}(_0x671d,0x1f4));var _0xd671=function(_0x1b658,_0x344b6a){_0x1b658=_0x1b658-0x0;var _0x1d17e5=_0x671d[_0x1b658];return _0x1d17e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd671('0x0'));var zipdir=require(_0xd671('0x1'));var jsonpatch=require(_0xd671('0x2'));var rp=require(_0xd671('0x3'));var moment=require(_0xd671('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd671('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd671('0x6'));var csv=require(_0xd671('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd671('0x8'));var _=require('lodash');var squel=require(_0xd671('0x9'));var crypto=require(_0xd671('0xa'));var jsforce=require(_0xd671('0xb'));var deskjs=require(_0xd671('0xc'));var toCsv=require(_0xd671('0x7'));var querystring=require(_0xd671('0xd'));var Papa=require(_0xd671('0xe'));var Redis=require(_0xd671('0xf'));var authService=require(_0xd671('0x10'));var qs=require(_0xd671('0x11'));var as=require(_0xd671('0x12'));var hardwareService=require(_0xd671('0x13'));var logger=require(_0xd671('0x14'))(_0xd671('0x15'));var utils=require('../../config/utils');var config=require(_0xd671('0x16'));var licenseUtil=require(_0xd671('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd671('0x18'));var client=jayson[_0xd671('0x19')][_0xd671('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x168576,_0x1ca4a8,_0x4123d1,_0x2962ad){return new BPromise(function(_0x5b30b8,_0x5d24cd){var _0x4ca511=_0x2962ad||client;return _0x4ca511[_0xd671('0x1b')](_0x168576,_0x4123d1)[_0xd671('0x1c')](function(_0x3b0537){logger[_0xd671('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x1ca4a8,_0xd671('0x1e'));logger[_0xd671('0x1f')](_0xd671('0x20'),_0x1ca4a8,_0xd671('0x1e'),JSON[_0xd671('0x21')](_0x3b0537));if(_0x3b0537[_0xd671('0x22')]){if(_0x3b0537[_0xd671('0x22')]['code']===0x1f4){logger[_0xd671('0x22')]('VoiceContext,\x20%s,\x20%s',_0x1ca4a8,_0x3b0537[_0xd671('0x22')][_0xd671('0x23')]);return _0x5d24cd(_0x3b0537['error']['message']);}logger[_0xd671('0x22')](_0xd671('0x24'),_0x1ca4a8,_0x3b0537['error']['message']);return _0x5b30b8(_0x3b0537['error'][_0xd671('0x23')]);}else{logger['info'](_0xd671('0x24'),_0x1ca4a8,_0xd671('0x1e'));_0x5b30b8(_0x3b0537[_0xd671('0x25')]['message']);}})[_0xd671('0x26')](function(_0x3c0e2a){logger[_0xd671('0x22')](_0xd671('0x24'),_0x1ca4a8,_0x3c0e2a);_0x5d24cd(_0x3c0e2a);});});}function respondWithStatusCode(_0x406d87,_0x57a35d){_0x57a35d=_0x57a35d||0xcc;return function(_0x529cfd){if(_0x529cfd){return _0x406d87['sendStatus'](_0x57a35d);}return _0x406d87[_0xd671('0x27')](_0x57a35d)[_0xd671('0x28')]();};}function respondWithResult(_0x42b2a4,_0x9d11c8){_0x9d11c8=_0x9d11c8||0xc8;return function(_0x1c439c){if(_0x1c439c){return _0x42b2a4[_0xd671('0x27')](_0x9d11c8)[_0xd671('0x29')](_0x1c439c);}};}function respondWithFilteredResult(_0x1caf01,_0x5b4d62){return function(_0x11124c){if(_0x11124c){var _0x20d180=typeof _0x5b4d62[_0xd671('0x2a')]===_0xd671('0x2b')&&typeof _0x5b4d62['limit']===_0xd671('0x2b');var _0x4f6158=_0x11124c['count'];var _0x1f1ea4=_0x20d180?0x0:_0x5b4d62[_0xd671('0x2a')];var _0x5529b3=_0x20d180?_0x11124c[_0xd671('0x2c')]:_0x5b4d62[_0xd671('0x2a')]+_0x5b4d62[_0xd671('0x2d')];var _0x47de27;if(_0x5529b3>=_0x4f6158){_0x5529b3=_0x4f6158;_0x47de27=0xc8;}else{_0x47de27=0xce;}_0x1caf01[_0xd671('0x27')](_0x47de27);return _0x1caf01['set'](_0xd671('0x2e'),_0x1f1ea4+'-'+_0x5529b3+'/'+_0x4f6158)[_0xd671('0x29')](_0x11124c);}return null;};}function patchUpdates(_0x5c3f27){return function(_0x4b725e){try{jsonpatch[_0xd671('0x2f')](_0x4b725e,_0x5c3f27,!![]);}catch(_0x3a880d){return BPromise[_0xd671('0x30')](_0x3a880d);}return _0x4b725e[_0xd671('0x31')]();};}function saveUpdates(_0x4758e0,_0x4871e3){return function(_0x2201ec){if(_0x2201ec){return _0x2201ec[_0xd671('0x32')](_0x4758e0)[_0xd671('0x1c')](function(_0x41cc8e){return _0x41cc8e;});}return null;};}function removeEntity(_0x1554a0,_0x4678d8){return function(_0x5c5d01){if(_0x5c5d01){return _0x5c5d01['destroy']()[_0xd671('0x1c')](function(){var _0xe92860=_0x5c5d01[_0xd671('0x33')]({'plain':!![]});var _0x487568=_0xd671('0x34');return db['UserProfileResource'][_0xd671('0x35')]({'where':{'type':_0x487568,'resourceId':_0xe92860['id']}})['then'](function(){return _0x5c5d01;});})[_0xd671('0x1c')](function(){_0x1554a0[_0xd671('0x27')](0xcc)[_0xd671('0x28')]();});}};}function handleEntityNotFound(_0x3626c7,_0x4fbdf8){return function(_0x15db36){if(!_0x15db36){_0x3626c7[_0xd671('0x36')](0x194);}return _0x15db36;};}function handleError(_0x10875f,_0x15b306){_0x15b306=_0x15b306||0x1f4;return function(_0x3b9ce7){logger[_0xd671('0x22')](_0x3b9ce7[_0xd671('0x37')]);if(_0x3b9ce7[_0xd671('0x38')]){delete _0x3b9ce7[_0xd671('0x38')];}_0x10875f[_0xd671('0x27')](_0x15b306)[_0xd671('0x39')](_0x3b9ce7);};}exports[_0xd671('0x3a')]=function(_0x86964,_0x56892e){var _0x352588={},_0x847652={},_0x2a9c20={'count':0x0,'rows':[]};var _0x281022=_[_0xd671('0x3b')](db['VoiceContext'][_0xd671('0x3c')],function(_0x1cfb6a){return{'name':_0x1cfb6a[_0xd671('0x3d')],'type':_0x1cfb6a['type'][_0xd671('0x3e')]};});_0x847652[_0xd671('0x3f')]=_[_0xd671('0x3b')](_0x281022,_0xd671('0x38'));_0x847652[_0xd671('0x40')]=_[_0xd671('0x41')](_0x86964['query']);_0x847652[_0xd671('0x42')]=_[_0xd671('0x43')](_0x847652['model'],_0x847652[_0xd671('0x40')]);_0x352588[_0xd671('0x44')]=_['intersection'](_0x847652[_0xd671('0x3f')],qs['fields'](_0x86964[_0xd671('0x40')]['fields']));_0x352588[_0xd671('0x44')]=_0x352588[_0xd671('0x44')][_0xd671('0x45')]?_0x352588['attributes']:_0x847652[_0xd671('0x3f')];if(!_0x86964[_0xd671('0x40')][_0xd671('0x46')](_0xd671('0x47'))){_0x352588['limit']=qs['limit'](_0x86964['query'][_0xd671('0x2d')]);_0x352588[_0xd671('0x2a')]=qs[_0xd671('0x2a')](_0x86964['query'][_0xd671('0x2a')]);}_0x352588[_0xd671('0x48')]=qs[_0xd671('0x49')](_0x86964[_0xd671('0x40')][_0xd671('0x49')]);_0x352588['where']=qs[_0xd671('0x42')](_[_0xd671('0x4a')](_0x86964[_0xd671('0x40')],_0x847652['filters']),_0x281022);if(_0x86964[_0xd671('0x40')][_0xd671('0x4b')]){_0x352588[_0xd671('0x4c')]=_[_0xd671('0x4d')](_0x352588[_0xd671('0x4c')],{'$or':_[_0xd671('0x3b')](_0x281022,function(_0x295edf){if(_0x295edf[_0xd671('0x4e')]!==_0xd671('0x4f')){var _0x5964b2={};_0x5964b2[_0x295edf[_0xd671('0x38')]]={'$like':'%'+_0x86964['query'][_0xd671('0x4b')]+'%'};return _0x5964b2;}})});}_0x352588=_['merge']({},_0x352588,_0x86964['options']);var _0x12ba3a={'where':_0x352588['where']};return db['VoiceContext'][_0xd671('0x2c')](_0x12ba3a)[_0xd671('0x1c')](function(_0x433922){_0x2a9c20['count']=_0x433922;if(_0x86964[_0xd671('0x40')][_0xd671('0x50')]){_0x352588[_0xd671('0x51')]=[{'all':!![]}];}return db[_0xd671('0x52')]['findAll'](_0x352588);})['then'](function(_0x8c8423){_0x2a9c20[_0xd671('0x53')]=_0x8c8423;return _0x2a9c20;})[_0xd671('0x1c')](respondWithFilteredResult(_0x56892e,_0x352588))[_0xd671('0x26')](handleError(_0x56892e,null));};exports[_0xd671('0x54')]=function(_0x10189a,_0x2b10ce){var _0x271dd0={'raw':![],'where':{'id':_0x10189a[_0xd671('0x55')]['id']}},_0xafaff4={};_0xafaff4[_0xd671('0x3f')]=_[_0xd671('0x41')](db[_0xd671('0x52')][_0xd671('0x3c')]);_0xafaff4[_0xd671('0x40')]=_[_0xd671('0x41')](_0x10189a['query']);_0xafaff4[_0xd671('0x42')]=_[_0xd671('0x43')](_0xafaff4[_0xd671('0x3f')],_0xafaff4[_0xd671('0x40')]);_0x271dd0[_0xd671('0x44')]=_['intersection'](_0xafaff4[_0xd671('0x3f')],qs[_0xd671('0x56')](_0x10189a['query'][_0xd671('0x56')]));_0x271dd0['attributes']=_0x271dd0['attributes'][_0xd671('0x45')]?_0x271dd0[_0xd671('0x44')]:_0xafaff4[_0xd671('0x3f')];if(_0x10189a[_0xd671('0x40')][_0xd671('0x50')]){_0x271dd0[_0xd671('0x51')]=[{'all':!![]}];}_0x271dd0=_[_0xd671('0x4d')]({},_0x271dd0,_0x10189a[_0xd671('0x57')]);return db[_0xd671('0x52')]['find'](_0x271dd0)['then'](handleEntityNotFound(_0x2b10ce,null))[_0xd671('0x1c')](respondWithResult(_0x2b10ce,null))[_0xd671('0x26')](handleError(_0x2b10ce,null));};exports[_0xd671('0x58')]=function(_0x571487,_0x3e9652,_0xdf49dc){var _0x1f34c9;return db[_0xd671('0x52')][_0xd671('0x58')](_0x571487[_0xd671('0x59')],{'raw':!![]})[_0xd671('0x1c')](function(_0xfd8089){_0x1f34c9=_0xfd8089;return db['VoiceContext'][_0xd671('0x5a')]({'raw':!![]});})['then'](function(_0xbc48bd){var _0x1be8e3=fs['readFileSync'](path['join'](config[_0xd671('0x5b')],'server/files/templates/context.ejs'),_0xd671('0x5c'));var _0x138590=ejs[_0xd671('0x5d')](_0x1be8e3,{'contexts':_0xbc48bd||[]});fs[_0xd671('0x5e')](_0xd671('0x5f'),_0x138590);})['then'](function(){return respondWithRpcPromise('Reload',_0xd671('0x58'),{'module':_0xd671('0x60')});})[_0xd671('0x1c')](function(){var _0x19ea9e=_0x571487[_0xd671('0x61')][_0xd671('0x33')]({'plain':!![]});if(!_0x19ea9e)throw new Error(_0xd671('0x62'));if(_0x19ea9e['role']===_0xd671('0x61')){var _0x3c3f29=_0x1f34c9[_0xd671('0x33')]({'plain':!![]});return db[_0xd671('0x63')][_0xd671('0x64')]({'where':{'name':_0xd671('0x34'),'userProfileId':_0x19ea9e['userProfileId']},'raw':!![]})[_0xd671('0x1c')](function(_0x578aa6){if(_0x578aa6&&_0x578aa6[_0xd671('0x65')]===0x0){return db[_0xd671('0x66')][_0xd671('0x58')]({'name':_0x3c3f29[_0xd671('0x38')],'resourceId':_0x3c3f29['id'],'type':_0x578aa6[_0xd671('0x38')],'sectionId':_0x578aa6['id']},{})[_0xd671('0x1c')](function(){return _0x1f34c9;});}else{return _0x1f34c9;}})['catch'](function(_0x41563a){logger[_0xd671('0x22')](_0xd671('0x67'),_0x41563a);throw _0x41563a;});}return _0x1f34c9;})[_0xd671('0x1c')](respondWithResult(_0x3e9652,0xc9))[_0xd671('0x26')](handleError(_0x3e9652,null));};exports[_0xd671('0x32')]=function(_0x42212a,_0x459a65,_0x2a8fd9){var _0x5f3cf5;return db[_0xd671('0x52')][_0xd671('0x64')]({'where':{'id':_0x42212a[_0xd671('0x55')]['id']}})[_0xd671('0x1c')](handleEntityNotFound(_0x459a65,null))[_0xd671('0x1c')](saveUpdates(_0x42212a[_0xd671('0x59')],null))[_0xd671('0x1c')](function(_0x20c7ce){if(_0x20c7ce){_0x5f3cf5=_0x20c7ce;return db[_0xd671('0x52')]['findAll']({'raw':!![]});}})['then'](function(_0x5d818a){var _0x4e4f98=fs[_0xd671('0x68')](path[_0xd671('0x69')](config[_0xd671('0x5b')],_0xd671('0x6a')),_0xd671('0x5c'));var _0x2cf1ac=ejs[_0xd671('0x5d')](_0x4e4f98,{'contexts':_0x5d818a||[]});fs[_0xd671('0x5e')](_0xd671('0x5f'),_0x2cf1ac);})['then'](function(){return respondWithRpcPromise(_0xd671('0x6b'),_0xd671('0x32'),{'module':'chan_sip.so'});})[_0xd671('0x1c')](function(){return _0x5f3cf5;})[_0xd671('0x1c')](respondWithResult(_0x459a65,null))[_0xd671('0x26')](handleError(_0x459a65,null));};exports[_0xd671('0x35')]=function(_0x45c19b,_0x37ef1f,_0x24bdc6){var _0xdfebe7;return db[_0xd671('0x52')][_0xd671('0x64')]({'where':{'id':_0x45c19b[_0xd671('0x55')]['id']}})['then'](handleEntityNotFound(_0x37ef1f,null))['then'](removeEntity(_0x37ef1f,null))[_0xd671('0x1c')](function(){return db[_0xd671('0x52')]['findAll']({'raw':!![]});})['then'](function(_0x2d2dff){var _0x13f13c=fs[_0xd671('0x68')](path[_0xd671('0x69')](config['root'],_0xd671('0x6a')),_0xd671('0x5c'));var _0x4a9440=ejs[_0xd671('0x5d')](_0x13f13c,{'contexts':_0x2d2dff});fs['writeFileSync'](_0xd671('0x5f'),_0x4a9440);return respondWithRpcPromise('Reload',_0xd671('0x35'),{'module':_0xd671('0x60')});})['catch'](handleError(_0x37ef1f,null));}; \ No newline at end of file +var _0x30c3=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','count','set','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','fieldName','type','key','query','filters','intersection','model','fields','attributes','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','length','find','create','findAll','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','Reload','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x137320,_0x3fcac9){var _0x3f1e9f=function(_0x5b4325){while(--_0x5b4325){_0x137320['push'](_0x137320['shift']());}};_0x3f1e9f(++_0x3fcac9);}(_0x30c3,0xcd));var _0x330c=function(_0x4b53d3,_0x19db52){_0x4b53d3=_0x4b53d3-0x0;var _0x15b95d=_0x30c3[_0x4b53d3];return _0x15b95d;};'use strict';var emlformat=require(_0x330c('0x0'));var rimraf=require(_0x330c('0x1'));var zipdir=require(_0x330c('0x2'));var jsonpatch=require(_0x330c('0x3'));var rp=require('request-promise');var moment=require(_0x330c('0x4'));var BPromise=require(_0x330c('0x5'));var Mustache=require('mustache');var util=require(_0x330c('0x6'));var path=require(_0x330c('0x7'));var sox=require(_0x330c('0x8'));var csv=require(_0x330c('0x9'));var ejs=require(_0x330c('0xa'));var fs=require('fs');var fs_extra=require(_0x330c('0xb'));var _=require(_0x330c('0xc'));var squel=require('squel');var crypto=require(_0x330c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x330c('0xe'));var toCsv=require(_0x330c('0x9'));var querystring=require(_0x330c('0xf'));var Papa=require(_0x330c('0x10'));var Redis=require(_0x330c('0x11'));var authService=require(_0x330c('0x12'));var qs=require(_0x330c('0x13'));var as=require(_0x330c('0x14'));var hardwareService=require(_0x330c('0x15'));var logger=require(_0x330c('0x16'))(_0x330c('0x17'));var utils=require(_0x330c('0x18'));var config=require(_0x330c('0x19'));var licenseUtil=require(_0x330c('0x1a'));var db=require(_0x330c('0x1b'))['db'];var jayson=require(_0x330c('0x1c'));var client=jayson['client'][_0x330c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x55892d,_0x435bcf,_0x5d797a,_0x17a681){return new BPromise(function(_0x1a4d71,_0xe82e3f){var _0x1dc19f=_0x17a681||client;return _0x1dc19f[_0x330c('0x1e')](_0x55892d,_0x5d797a)['then'](function(_0x3aba5f){logger[_0x330c('0x1f')](_0x330c('0x20'),_0x435bcf,_0x330c('0x21'));logger[_0x330c('0x22')](_0x330c('0x23'),_0x435bcf,_0x330c('0x21'),JSON[_0x330c('0x24')](_0x3aba5f));if(_0x3aba5f['error']){if(_0x3aba5f[_0x330c('0x25')][_0x330c('0x26')]===0x1f4){logger['error'](_0x330c('0x20'),_0x435bcf,_0x3aba5f[_0x330c('0x25')][_0x330c('0x27')]);return _0xe82e3f(_0x3aba5f[_0x330c('0x25')]['message']);}logger[_0x330c('0x25')]('VoiceContext,\x20%s,\x20%s',_0x435bcf,_0x3aba5f[_0x330c('0x25')][_0x330c('0x27')]);return _0x1a4d71(_0x3aba5f['error']['message']);}else{logger['info'](_0x330c('0x20'),_0x435bcf,_0x330c('0x21'));_0x1a4d71(_0x3aba5f[_0x330c('0x28')][_0x330c('0x27')]);}})[_0x330c('0x29')](function(_0x2c6721){logger['error'](_0x330c('0x20'),_0x435bcf,_0x2c6721);_0xe82e3f(_0x2c6721);});});}function respondWithStatusCode(_0x4187e5,_0x3e48d6){_0x3e48d6=_0x3e48d6||0xcc;return function(_0x528445){if(_0x528445){return _0x4187e5[_0x330c('0x2a')](_0x3e48d6);}return _0x4187e5[_0x330c('0x2b')](_0x3e48d6)[_0x330c('0x2c')]();};}function respondWithResult(_0x4ce820,_0x50fa2b){_0x50fa2b=_0x50fa2b||0xc8;return function(_0x317b87){if(_0x317b87){return _0x4ce820['status'](_0x50fa2b)[_0x330c('0x2d')](_0x317b87);}};}function respondWithFilteredResult(_0x28fc48,_0xd27e02){return function(_0x419e82){if(_0x419e82){var _0x3e91fe=typeof _0xd27e02[_0x330c('0x2e')]==='undefined'&&typeof _0xd27e02['limit']==='undefined';var _0x5a5384=_0x419e82[_0x330c('0x2f')];var _0x72cb04=_0x3e91fe?0x0:_0xd27e02['offset'];var _0x369a03=_0x3e91fe?_0x419e82[_0x330c('0x2f')]:_0xd27e02[_0x330c('0x2e')]+_0xd27e02['limit'];var _0x55c6fe;if(_0x369a03>=_0x5a5384){_0x369a03=_0x5a5384;_0x55c6fe=0xc8;}else{_0x55c6fe=0xce;}_0x28fc48[_0x330c('0x2b')](_0x55c6fe);return _0x28fc48[_0x330c('0x30')]('Content-Range',_0x72cb04+'-'+_0x369a03+'/'+_0x5a5384)[_0x330c('0x2d')](_0x419e82);}return null;};}function patchUpdates(_0x47551){return function(_0x355808){try{jsonpatch[_0x330c('0x31')](_0x355808,_0x47551,!![]);}catch(_0x34c4d1){return BPromise[_0x330c('0x32')](_0x34c4d1);}return _0x355808[_0x330c('0x33')]();};}function saveUpdates(_0x48d6d2,_0x13d25a){return function(_0xb7a939){if(_0xb7a939){return _0xb7a939[_0x330c('0x34')](_0x48d6d2)['then'](function(_0x46a708){return _0x46a708;});}return null;};}function removeEntity(_0x3b6742,_0x107f86){return function(_0x2f4eb8){if(_0x2f4eb8){return _0x2f4eb8[_0x330c('0x35')]()[_0x330c('0x36')](function(){var _0x1a30f2=_0x2f4eb8[_0x330c('0x37')]({'plain':!![]});var _0x409654=_0x330c('0x38');return db[_0x330c('0x39')][_0x330c('0x35')]({'where':{'type':_0x409654,'resourceId':_0x1a30f2['id']}})[_0x330c('0x36')](function(){return _0x2f4eb8;});})[_0x330c('0x36')](function(){_0x3b6742[_0x330c('0x2b')](0xcc)[_0x330c('0x2c')]();});}};}function handleEntityNotFound(_0x538023,_0x75230b){return function(_0x27a9a5){if(!_0x27a9a5){_0x538023[_0x330c('0x2a')](0x194);}return _0x27a9a5;};}function handleError(_0x1f335d,_0x388b5a){_0x388b5a=_0x388b5a||0x1f4;return function(_0x3b82b4){logger[_0x330c('0x25')](_0x3b82b4[_0x330c('0x3a')]);if(_0x3b82b4[_0x330c('0x3b')]){delete _0x3b82b4[_0x330c('0x3b')];}_0x1f335d[_0x330c('0x2b')](_0x388b5a)[_0x330c('0x3c')](_0x3b82b4);};}exports[_0x330c('0x3d')]=function(_0x6ba0d4,_0x204aa6){var _0x45f668={},_0x3df623={},_0xa37af2={'count':0x0,'rows':[]};var _0x5bfb3b=_[_0x330c('0x3e')](db[_0x330c('0x3f')]['rawAttributes'],function(_0x7a505e){return{'name':_0x7a505e[_0x330c('0x40')],'type':_0x7a505e[_0x330c('0x41')][_0x330c('0x42')]};});_0x3df623['model']=_['map'](_0x5bfb3b,_0x330c('0x3b'));_0x3df623[_0x330c('0x43')]=_['keys'](_0x6ba0d4[_0x330c('0x43')]);_0x3df623[_0x330c('0x44')]=_[_0x330c('0x45')](_0x3df623[_0x330c('0x46')],_0x3df623['query']);_0x45f668['attributes']=_[_0x330c('0x45')](_0x3df623['model'],qs['fields'](_0x6ba0d4['query'][_0x330c('0x47')]));_0x45f668[_0x330c('0x48')]=_0x45f668['attributes']['length']?_0x45f668[_0x330c('0x48')]:_0x3df623[_0x330c('0x46')];if(!_0x6ba0d4[_0x330c('0x43')]['hasOwnProperty']('nolimit')){_0x45f668[_0x330c('0x49')]=qs[_0x330c('0x49')](_0x6ba0d4[_0x330c('0x43')]['limit']);_0x45f668[_0x330c('0x2e')]=qs['offset'](_0x6ba0d4['query'][_0x330c('0x2e')]);}_0x45f668[_0x330c('0x4a')]=qs[_0x330c('0x4b')](_0x6ba0d4[_0x330c('0x43')][_0x330c('0x4b')]);_0x45f668[_0x330c('0x4c')]=qs[_0x330c('0x44')](_[_0x330c('0x4d')](_0x6ba0d4[_0x330c('0x43')],_0x3df623[_0x330c('0x44')]),_0x5bfb3b);if(_0x6ba0d4[_0x330c('0x43')][_0x330c('0x4e')]){_0x45f668[_0x330c('0x4c')]=_['merge'](_0x45f668[_0x330c('0x4c')],{'$or':_[_0x330c('0x3e')](_0x5bfb3b,function(_0x2ecceb){if(_0x2ecceb[_0x330c('0x41')]!==_0x330c('0x4f')){var _0x31f070={};_0x31f070[_0x2ecceb[_0x330c('0x3b')]]={'$like':'%'+_0x6ba0d4[_0x330c('0x43')][_0x330c('0x4e')]+'%'};return _0x31f070;}})});}_0x45f668=_[_0x330c('0x50')]({},_0x45f668,_0x6ba0d4[_0x330c('0x51')]);var _0x5614f8={'where':_0x45f668[_0x330c('0x4c')]};return db[_0x330c('0x3f')][_0x330c('0x2f')](_0x5614f8)[_0x330c('0x36')](function(_0x12ce40){_0xa37af2[_0x330c('0x2f')]=_0x12ce40;if(_0x6ba0d4[_0x330c('0x43')][_0x330c('0x52')]){_0x45f668[_0x330c('0x53')]=[{'all':!![]}];}return db[_0x330c('0x3f')]['findAll'](_0x45f668);})[_0x330c('0x36')](function(_0x14e7c7){_0xa37af2[_0x330c('0x54')]=_0x14e7c7;return _0xa37af2;})[_0x330c('0x36')](respondWithFilteredResult(_0x204aa6,_0x45f668))[_0x330c('0x29')](handleError(_0x204aa6,null));};exports[_0x330c('0x55')]=function(_0xb07daa,_0x2e3c48){var _0x43e290={'raw':![],'where':{'id':_0xb07daa[_0x330c('0x56')]['id']}},_0x2b11ae={};_0x2b11ae[_0x330c('0x46')]=_[_0x330c('0x57')](db['VoiceContext']['rawAttributes']);_0x2b11ae[_0x330c('0x43')]=_[_0x330c('0x57')](_0xb07daa['query']);_0x2b11ae['filters']=_[_0x330c('0x45')](_0x2b11ae[_0x330c('0x46')],_0x2b11ae[_0x330c('0x43')]);_0x43e290['attributes']=_['intersection'](_0x2b11ae[_0x330c('0x46')],qs[_0x330c('0x47')](_0xb07daa[_0x330c('0x43')]['fields']));_0x43e290[_0x330c('0x48')]=_0x43e290[_0x330c('0x48')][_0x330c('0x58')]?_0x43e290[_0x330c('0x48')]:_0x2b11ae[_0x330c('0x46')];if(_0xb07daa[_0x330c('0x43')]['includeAll']){_0x43e290[_0x330c('0x53')]=[{'all':!![]}];}_0x43e290=_[_0x330c('0x50')]({},_0x43e290,_0xb07daa[_0x330c('0x51')]);return db[_0x330c('0x3f')][_0x330c('0x59')](_0x43e290)[_0x330c('0x36')](handleEntityNotFound(_0x2e3c48,null))['then'](respondWithResult(_0x2e3c48,null))[_0x330c('0x29')](handleError(_0x2e3c48,null));};exports[_0x330c('0x5a')]=function(_0x18b0b2,_0x1349d1,_0x30d7d5){var _0x34d750;return db[_0x330c('0x3f')][_0x330c('0x5a')](_0x18b0b2['body'],{'raw':!![]})[_0x330c('0x36')](function(_0x4879db){_0x34d750=_0x4879db;return db[_0x330c('0x3f')][_0x330c('0x5b')]({'raw':!![]});})[_0x330c('0x36')](function(_0x5a83d5){var _0x37ef28=fs[_0x330c('0x5c')](path[_0x330c('0x5d')](config['root'],_0x330c('0x5e')),_0x330c('0x5f'));var _0x16b299=ejs[_0x330c('0x60')](_0x37ef28,{'contexts':_0x5a83d5||[]});fs[_0x330c('0x61')](_0x330c('0x62'),_0x16b299);})[_0x330c('0x36')](function(){return respondWithRpcPromise('Reload',_0x330c('0x5a'),{'module':_0x330c('0x63')});})[_0x330c('0x36')](function(){var _0xe372aa=_0x18b0b2[_0x330c('0x64')][_0x330c('0x37')]({'plain':!![]});if(!_0xe372aa)throw new Error(_0x330c('0x65'));if(_0xe372aa[_0x330c('0x66')]===_0x330c('0x64')){var _0x49f2e0=_0x34d750['get']({'plain':!![]});return db[_0x330c('0x67')][_0x330c('0x59')]({'where':{'name':_0x330c('0x38'),'userProfileId':_0xe372aa[_0x330c('0x68')]},'raw':!![]})[_0x330c('0x36')](function(_0x4e9217){if(_0x4e9217&&_0x4e9217[_0x330c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x49f2e0[_0x330c('0x3b')],'resourceId':_0x49f2e0['id'],'type':_0x4e9217['name'],'sectionId':_0x4e9217['id']},{})[_0x330c('0x36')](function(){return _0x34d750;});}else{return _0x34d750;}})[_0x330c('0x29')](function(_0x26f401){logger[_0x330c('0x25')](_0x330c('0x6a'),_0x26f401);throw _0x26f401;});}return _0x34d750;})[_0x330c('0x36')](respondWithResult(_0x1349d1,0xc9))['catch'](handleError(_0x1349d1,null));};exports[_0x330c('0x34')]=function(_0x58eed7,_0x202ea0,_0x3a5347){var _0xde725f;return db['VoiceContext'][_0x330c('0x59')]({'where':{'id':_0x58eed7[_0x330c('0x56')]['id']}})['then'](handleEntityNotFound(_0x202ea0,null))['then'](saveUpdates(_0x58eed7['body'],null))[_0x330c('0x36')](function(_0x372e14){if(_0x372e14){_0xde725f=_0x372e14;return db[_0x330c('0x3f')][_0x330c('0x5b')]({'raw':!![]});}})[_0x330c('0x36')](function(_0x4880ff){var _0x5401e6=fs[_0x330c('0x5c')](path[_0x330c('0x5d')](config[_0x330c('0x6b')],_0x330c('0x5e')),'utf8');var _0x5abf7f=ejs['render'](_0x5401e6,{'contexts':_0x4880ff||[]});fs[_0x330c('0x61')](_0x330c('0x62'),_0x5abf7f);})['then'](function(){return respondWithRpcPromise(_0x330c('0x6c'),_0x330c('0x34'),{'module':_0x330c('0x63')});})[_0x330c('0x36')](function(){return _0xde725f;})[_0x330c('0x36')](respondWithResult(_0x202ea0,null))[_0x330c('0x29')](handleError(_0x202ea0,null));};exports[_0x330c('0x35')]=function(_0x1bb79c,_0x114de8,_0x1a346e){var _0x328efb;return db[_0x330c('0x3f')][_0x330c('0x59')]({'where':{'id':_0x1bb79c[_0x330c('0x56')]['id']}})[_0x330c('0x36')](handleEntityNotFound(_0x114de8,null))[_0x330c('0x36')](removeEntity(_0x114de8,null))[_0x330c('0x36')](function(){return db['VoiceContext'][_0x330c('0x5b')]({'raw':!![]});})['then'](function(_0x13c991){var _0x57e687=fs['readFileSync'](path[_0x330c('0x5d')](config[_0x330c('0x6b')],'server/files/templates/context.ejs'),_0x330c('0x5f'));var _0x157eac=ejs['render'](_0x57e687,{'contexts':_0x13c991});fs['writeFileSync'](_0x330c('0x62'),_0x157eac);return respondWithRpcPromise(_0x330c('0x6c'),_0x330c('0x35'),{'module':_0x330c('0x63')});})[_0x330c('0x29')](handleError(_0x114de8,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c730066..e6c1e92 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 _0x3164=['./voiceContext.attributes','exports','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x139578,_0x3607ff){var _0x25b6d9=function(_0x581a34){while(--_0x581a34){_0x139578['push'](_0x139578['shift']());}};_0x25b6d9(++_0x3607ff);}(_0x3164,0x85));var _0x4316=function(_0x574912,_0x3e903e){_0x574912=_0x574912-0x0;var _0x246891=_0x3164[_0x574912];return _0x246891;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require(_0x4316('0x4'));var BPromise=require(_0x4316('0x5'));var rp=require(_0x4316('0x6'));var fs=require('fs');var path=require(_0x4316('0x7'));var rimraf=require(_0x4316('0x8'));var config=require(_0x4316('0x9'));var attributes=require(_0x4316('0xa'));module[_0x4316('0xb')]=function(_0x3f82c4,_0x364941){return _0x3f82c4['define']('VoiceContext',attributes,{'tableName':_0x4316('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ee=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','lodash'];(function(_0x42a822,_0x50b5db){var _0x349ad6=function(_0x5bf27f){while(--_0x5bf27f){_0x42a822['push'](_0x42a822['shift']());}};_0x349ad6(++_0x50b5db);}(_0x71ee,0x1cb));var _0xe71e=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0x71ee[_0xd5584e];return _0xdc594e;};'use strict';var _=require(_0xe71e('0x0'));var util=require('util');var logger=require(_0xe71e('0x1'))('api');var moment=require(_0xe71e('0x2'));var BPromise=require(_0xe71e('0x3'));var rp=require(_0xe71e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe71e('0x5'));var config=require(_0xe71e('0x6'));var attributes=require(_0xe71e('0x7'));module[_0xe71e('0x8')]=function(_0x30acff,_0x87181f){return _0x30acff['define'](_0xe71e('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 3a847ab..b4514dd 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 _0xeeeb=['client','http','request\x20sent','debug','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x1e58bc,_0x8cddd3){_0x1e58bc=_0x1e58bc-0x0;var _0x41efa1=_0xeeeb[_0x1e58bc];return _0x41efa1;};'use strict';var _=require('lodash');var util=require(_0xbeee('0x0'));var moment=require(_0xbeee('0x1'));var BPromise=require(_0xbeee('0x2'));var rs=require(_0xbeee('0x3'));var fs=require('fs');var Redis=require(_0xbeee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbeee('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbeee('0x6'));var client=jayson[_0xbeee('0x7')][_0xbeee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x377323,_0x2bf12e,_0x14ba0c){return new BPromise(function(_0x4dc25f,_0x236be1){return client['request'](_0x377323,_0x14ba0c)['then'](function(_0xfa37bd){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'));logger[_0xbeee('0xa')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2bf12e,_0xbeee('0x9'),JSON[_0xbeee('0xb')](_0xfa37bd));if(_0xfa37bd[_0xbeee('0xc')]){if(_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xd')]===0x1f4){logger[_0xbeee('0xc')](_0xbeee('0xe'),_0x2bf12e,_0xfa37bd[_0xbeee('0xc')][_0xbeee('0xf')]);return _0x236be1(_0xfa37bd['error'][_0xbeee('0xf')]);}logger[_0xbeee('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0xfa37bd[_0xbeee('0xc')]['message']);return _0x4dc25f(_0xfa37bd[_0xbeee('0xc')]['message']);}else{logger[_0xbeee('0x10')](_0xbeee('0xe'),_0x2bf12e,_0xbeee('0x9'));_0x4dc25f(_0xfa37bd[_0xbeee('0x11')]['message']);}})['catch'](function(_0x3ac978){logger[_0xbeee('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2bf12e,_0x3ac978);_0x236be1(_0x3ac978);});});} \ No newline at end of file +var _0xfe9d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x50071e,_0x5781c1){var _0x572cb6=function(_0x2de068){while(--_0x2de068){_0x50071e['push'](_0x50071e['shift']());}};_0x572cb6(++_0x5781c1);}(_0xfe9d,0x10e));var _0xdfe9=function(_0x377216,_0x4678e8){_0x377216=_0x377216-0x0;var _0x449bcf=_0xfe9d[_0x377216];return _0x449bcf;};'use strict';var _=require(_0xdfe9('0x0'));var util=require(_0xdfe9('0x1'));var moment=require(_0xdfe9('0x2'));var BPromise=require(_0xdfe9('0x3'));var rs=require(_0xdfe9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfe9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfe9('0x6'))(_0xdfe9('0x7'));var config=require(_0xdfe9('0x8'));var jayson=require(_0xdfe9('0x9'));var client=jayson[_0xdfe9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x523ecf,_0x3e3fe6,_0x4ab07f){return new BPromise(function(_0x1bc0ea,_0x46d8eb){return client['request'](_0x523ecf,_0x4ab07f)[_0xdfe9('0xb')](function(_0x36f0c6){logger[_0xdfe9('0xc')](_0xdfe9('0xd'),_0x3e3fe6,'request\x20sent');logger[_0xdfe9('0xe')](_0xdfe9('0xf'),_0x3e3fe6,_0xdfe9('0x10'),JSON[_0xdfe9('0x11')](_0x36f0c6));if(_0x36f0c6[_0xdfe9('0x12')]){if(_0x36f0c6[_0xdfe9('0x12')][_0xdfe9('0x13')]===0x1f4){logger[_0xdfe9('0x12')](_0xdfe9('0xd'),_0x3e3fe6,_0x36f0c6[_0xdfe9('0x12')]['message']);return _0x46d8eb(_0x36f0c6[_0xdfe9('0x12')]['message']);}logger['error'](_0xdfe9('0xd'),_0x3e3fe6,_0x36f0c6[_0xdfe9('0x12')]['message']);return _0x1bc0ea(_0x36f0c6[_0xdfe9('0x12')][_0xdfe9('0x14')]);}else{logger['info'](_0xdfe9('0xd'),_0x3e3fe6,'request\x20sent');_0x1bc0ea(_0x36f0c6[_0xdfe9('0x15')][_0xdfe9('0x14')]);}})[_0xdfe9('0x16')](function(_0x23582f){logger[_0xdfe9('0x12')](_0xdfe9('0xd'),_0x3e3fe6,_0x23582f);_0x46d8eb(_0x23582f);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 88b622f..cd522cb 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 _0xe0db=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','delete','destroy'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xe0db,0x65));var _0xbe0d=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xe0db[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0xbe0d('0x0'));var util=require('util');var path=require(_0xbe0d('0x1'));var timeout=require(_0xbe0d('0x2'));var express=require(_0xbe0d('0x3'));var router=express[_0xbe0d('0x4')]();var fs_extra=require(_0xbe0d('0x5'));var auth=require(_0xbe0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe0d('0x7'));var controller=require(_0xbe0d('0x8'));router[_0xbe0d('0x9')]('/',auth[_0xbe0d('0xa')](),controller['index']);router[_0xbe0d('0x9')](_0xbe0d('0xb'),auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xc')]);router[_0xbe0d('0x9')]('/:id',auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xd')]);router[_0xbe0d('0xe')]('/',auth[_0xbe0d('0xa')](),controller[_0xbe0d('0xf')]);router['put'](_0xbe0d('0x10'),auth[_0xbe0d('0xa')](),controller['update']);router[_0xbe0d('0x11')](_0xbe0d('0x10'),auth[_0xbe0d('0xa')](),controller[_0xbe0d('0x12')]);module[_0xbe0d('0x13')]=router; \ No newline at end of file +var _0xd9cc=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','index','/describe','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x56f56c,_0x32a850){var _0x59f094=function(_0xb4042c){while(--_0xb4042c){_0x56f56c['push'](_0x56f56c['shift']());}};_0x59f094(++_0x32a850);}(_0xd9cc,0x1e1));var _0xcd9c=function(_0x119077,_0x1d2d63){_0x119077=_0x119077-0x0;var _0x570645=_0xd9cc[_0x119077];return _0x570645;};'use strict';var multer=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var path=require(_0xcd9c('0x2'));var timeout=require(_0xcd9c('0x3'));var express=require(_0xcd9c('0x4'));var router=express['Router']();var fs_extra=require(_0xcd9c('0x5'));var auth=require(_0xcd9c('0x6'));var interaction=require(_0xcd9c('0x7'));var config=require('../../config/environment');var controller=require(_0xcd9c('0x8'));router[_0xcd9c('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd9c('0xa')]);router[_0xcd9c('0x9')](_0xcd9c('0xb'),auth[_0xcd9c('0xc')](),controller['describe']);router[_0xcd9c('0x9')]('/:id',auth[_0xcd9c('0xc')](),controller[_0xcd9c('0xd')]);router[_0xcd9c('0xe')]('/',auth[_0xcd9c('0xc')](),controller[_0xcd9c('0xf')]);router['put']('/:id',auth[_0xcd9c('0xc')](),controller[_0xcd9c('0x10')]);router[_0xcd9c('0x11')]('/:id',auth[_0xcd9c('0xc')](),controller[_0xcd9c('0x12')]);module[_0xcd9c('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 c6bc5c2..8258041 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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x957b63,_0x73eef6){var _0x1e5224=function(_0x468295){while(--_0x468295){_0x957b63['push'](_0x957b63['shift']());}};_0x1e5224(++_0x73eef6);}(_0xe5b3,0x133));var _0x3e5b=function(_0xaf74e9,_0x1095cb){_0xaf74e9=_0xaf74e9-0x0;var _0x305840=_0xe5b3[_0xaf74e9];return _0x305840;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x27bc1d,_0x5b53d5){var _0x170135=function(_0xfaa11c){while(--_0xfaa11c){_0x27bc1d['push'](_0x27bc1d['shift']());}};_0x170135(++_0x5b53d5);}(_0x81bd,0x7c));var _0xd81b=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x81bd[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9edd452..c6dfe73 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 _0x00d3=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','set','update','then','end','sendStatus','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','eml-format'];(function(_0xdf6d86,_0x357d29){var _0x1a7467=function(_0x259c1b){while(--_0x259c1b){_0xdf6d86['push'](_0xdf6d86['shift']());}};_0x1a7467(++_0x357d29);}(_0x00d3,0x11b));var _0x300d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00d3[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x300d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x300d('0x1'));var rp=require(_0x300d('0x2'));var moment=require(_0x300d('0x3'));var BPromise=require(_0x300d('0x4'));var Mustache=require(_0x300d('0x5'));var util=require('util');var path=require(_0x300d('0x6'));var sox=require('sox');var csv=require(_0x300d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x300d('0x8'));var _=require(_0x300d('0x9'));var squel=require(_0x300d('0xa'));var crypto=require(_0x300d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x300d('0xc'));var toCsv=require(_0x300d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x300d('0xd'));var authService=require(_0x300d('0xe'));var qs=require(_0x300d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x300d('0x10'));var logger=require(_0x300d('0x11'))(_0x300d('0x12'));var utils=require(_0x300d('0x13'));var config=require(_0x300d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x300d('0x15'))['db'];function respondWithStatusCode(_0x302fc6,_0x195ce7){_0x195ce7=_0x195ce7||0xcc;return function(_0x4866b3){if(_0x4866b3){return _0x302fc6['sendStatus'](_0x195ce7);}return _0x302fc6[_0x300d('0x16')](_0x195ce7)['end']();};}function respondWithResult(_0x14c16b,_0x27978e){_0x27978e=_0x27978e||0xc8;return function(_0x5d7ef6){if(_0x5d7ef6){return _0x14c16b['status'](_0x27978e)[_0x300d('0x17')](_0x5d7ef6);}};}function respondWithFilteredResult(_0x5f2752,_0x45727){return function(_0x2a9d2a){if(_0x2a9d2a){var _0xd92711=typeof _0x45727['offset']===_0x300d('0x18')&&typeof _0x45727[_0x300d('0x19')]==='undefined';var _0x413000=_0x2a9d2a['count'];var _0x38eca4=_0xd92711?0x0:_0x45727[_0x300d('0x1a')];var _0x46118d=_0xd92711?_0x2a9d2a['count']:_0x45727['offset']+_0x45727['limit'];var _0x3cbfc7;if(_0x46118d>=_0x413000){_0x46118d=_0x413000;_0x3cbfc7=0xc8;}else{_0x3cbfc7=0xce;}_0x5f2752[_0x300d('0x16')](_0x3cbfc7);return _0x5f2752[_0x300d('0x1b')]('Content-Range',_0x38eca4+'-'+_0x46118d+'/'+_0x413000)[_0x300d('0x17')](_0x2a9d2a);}return null;};}function patchUpdates(_0x320c2c){return function(_0x21c194){try{jsonpatch['apply'](_0x21c194,_0x320c2c,!![]);}catch(_0x2d44bc){return BPromise['reject'](_0x2d44bc);}return _0x21c194['save']();};}function saveUpdates(_0x10a898,_0x3c09f8){return function(_0x5a5409){if(_0x5a5409){return _0x5a5409[_0x300d('0x1c')](_0x10a898)[_0x300d('0x1d')](function(_0x2ce6e6){return _0x2ce6e6;});}return null;};}function removeEntity(_0x31ac43,_0x159ee3){return function(_0x206a2b){if(_0x206a2b){return _0x206a2b['destroy']()[_0x300d('0x1d')](function(){_0x31ac43[_0x300d('0x16')](0xcc)[_0x300d('0x1e')]();});}};}function handleEntityNotFound(_0x5db2c0,_0x19430f){return function(_0x10ed9b){if(!_0x10ed9b){_0x5db2c0[_0x300d('0x1f')](0x194);}return _0x10ed9b;};}function handleError(_0x2e0550,_0x30b4db){_0x30b4db=_0x30b4db||0x1f4;return function(_0x3154fe){logger[_0x300d('0x20')](_0x3154fe[_0x300d('0x21')]);if(_0x3154fe[_0x300d('0x22')]){delete _0x3154fe[_0x300d('0x22')];}_0x2e0550[_0x300d('0x16')](_0x30b4db)[_0x300d('0x23')](_0x3154fe);};}exports[_0x300d('0x24')]=function(_0x2bbc56,_0xfad49f){var _0x52444c={},_0xaa63ac={},_0x35fe18={'count':0x0,'rows':[]};var _0x2ed0ef=_[_0x300d('0x25')](db[_0x300d('0x26')][_0x300d('0x27')],function(_0x4d4fe6){return{'name':_0x4d4fe6[_0x300d('0x28')],'type':_0x4d4fe6['type']['key']};});_0xaa63ac['model']=_[_0x300d('0x25')](_0x2ed0ef,_0x300d('0x22'));_0xaa63ac['query']=_[_0x300d('0x29')](_0x2bbc56[_0x300d('0x2a')]);_0xaa63ac[_0x300d('0x2b')]=_[_0x300d('0x2c')](_0xaa63ac[_0x300d('0x2d')],_0xaa63ac[_0x300d('0x2a')]);_0x52444c[_0x300d('0x2e')]=_[_0x300d('0x2c')](_0xaa63ac[_0x300d('0x2d')],qs[_0x300d('0x2f')](_0x2bbc56[_0x300d('0x2a')][_0x300d('0x2f')]));_0x52444c['attributes']=_0x52444c[_0x300d('0x2e')][_0x300d('0x30')]?_0x52444c[_0x300d('0x2e')]:_0xaa63ac['model'];if(!_0x2bbc56['query']['hasOwnProperty'](_0x300d('0x31'))){_0x52444c[_0x300d('0x19')]=qs['limit'](_0x2bbc56['query'][_0x300d('0x19')]);_0x52444c[_0x300d('0x1a')]=qs[_0x300d('0x1a')](_0x2bbc56['query'][_0x300d('0x1a')]);}_0x52444c[_0x300d('0x32')]=qs[_0x300d('0x33')](_0x2bbc56[_0x300d('0x2a')]['sort']);_0x52444c[_0x300d('0x34')]=qs[_0x300d('0x2b')](_[_0x300d('0x35')](_0x2bbc56[_0x300d('0x2a')],_0xaa63ac['filters']),_0x2ed0ef);if(_0x2bbc56['query'][_0x300d('0x36')]){_0x52444c[_0x300d('0x34')]=_[_0x300d('0x37')](_0x52444c['where'],{'$or':_['map'](_0x2ed0ef,function(_0x5e58cd){if(_0x5e58cd[_0x300d('0x38')]!==_0x300d('0x39')){var _0x5106ba={};_0x5106ba[_0x5e58cd[_0x300d('0x22')]]={'$like':'%'+_0x2bbc56[_0x300d('0x2a')][_0x300d('0x36')]+'%'};return _0x5106ba;}})});}_0x52444c=_[_0x300d('0x37')]({},_0x52444c,_0x2bbc56[_0x300d('0x3a')]);var _0x43fb54={'where':_0x52444c['where']};return db['VoiceDialReport'][_0x300d('0x3b')](_0x43fb54)['then'](function(_0x52ef33){_0x35fe18[_0x300d('0x3b')]=_0x52ef33;if(_0x2bbc56['query'][_0x300d('0x3c')]){_0x52444c[_0x300d('0x3d')]=[{'all':!![]}];}return db[_0x300d('0x26')][_0x300d('0x3e')](_0x52444c);})[_0x300d('0x1d')](function(_0x1ef9fc){_0x35fe18['rows']=_0x1ef9fc;return _0x35fe18;})[_0x300d('0x1d')](respondWithFilteredResult(_0xfad49f,_0x52444c))[_0x300d('0x3f')](handleError(_0xfad49f,null));};exports[_0x300d('0x40')]=function(_0x434d37,_0x554b72){var _0x5b5d0f={'raw':!![],'where':{'id':_0x434d37[_0x300d('0x41')]['id']}},_0x115fe9={};_0x115fe9[_0x300d('0x2d')]=_[_0x300d('0x29')](db[_0x300d('0x26')][_0x300d('0x27')]);_0x115fe9[_0x300d('0x2a')]=_[_0x300d('0x29')](_0x434d37['query']);_0x115fe9[_0x300d('0x2b')]=_[_0x300d('0x2c')](_0x115fe9[_0x300d('0x2d')],_0x115fe9['query']);_0x5b5d0f[_0x300d('0x2e')]=_[_0x300d('0x2c')](_0x115fe9[_0x300d('0x2d')],qs['fields'](_0x434d37[_0x300d('0x2a')][_0x300d('0x2f')]));_0x5b5d0f[_0x300d('0x2e')]=_0x5b5d0f[_0x300d('0x2e')][_0x300d('0x30')]?_0x5b5d0f['attributes']:_0x115fe9[_0x300d('0x2d')];if(_0x434d37[_0x300d('0x2a')]['includeAll']){_0x5b5d0f[_0x300d('0x3d')]=[{'all':!![]}];}_0x5b5d0f=_['merge']({},_0x5b5d0f,_0x434d37[_0x300d('0x3a')]);return db[_0x300d('0x26')][_0x300d('0x42')](_0x5b5d0f)[_0x300d('0x1d')](handleEntityNotFound(_0x554b72,null))[_0x300d('0x1d')](respondWithResult(_0x554b72,null))[_0x300d('0x3f')](handleError(_0x554b72,null));};exports[_0x300d('0x43')]=function(_0x12b200,_0x5c0cc5){return db[_0x300d('0x26')][_0x300d('0x43')](_0x12b200[_0x300d('0x44')],{})['then'](respondWithResult(_0x5c0cc5,0xc9))[_0x300d('0x3f')](handleError(_0x5c0cc5,null));};exports[_0x300d('0x1c')]=function(_0x22ab19,_0x3e6b37){if(_0x22ab19[_0x300d('0x44')]['id']){delete _0x22ab19[_0x300d('0x44')]['id'];}return db[_0x300d('0x26')][_0x300d('0x42')]({'where':{'id':_0x22ab19[_0x300d('0x41')]['id']}})[_0x300d('0x1d')](handleEntityNotFound(_0x3e6b37,null))[_0x300d('0x1d')](saveUpdates(_0x22ab19['body'],null))['then'](respondWithResult(_0x3e6b37,null))[_0x300d('0x3f')](handleError(_0x3e6b37,null));};exports[_0x300d('0x45')]=function(_0x5ed0b9,_0x348d33){return db[_0x300d('0x26')]['find']({'where':{'id':_0x5ed0b9[_0x300d('0x41')]['id']}})['then'](handleEntityNotFound(_0x348d33,null))[_0x300d('0x1d')](removeEntity(_0x348d33,null))[_0x300d('0x3f')](handleError(_0x348d33,null));};exports[_0x300d('0x46')]=function(_0x3fe32d,_0x243eb7){return db['VoiceDialReport']['describe']()[_0x300d('0x1d')](respondWithResult(_0x243eb7,null))[_0x300d('0x3f')](handleError(_0x243eb7,null));}; \ No newline at end of file +var _0xa6a9=['map','VoiceDialReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xa6a9,0x104));var _0x9a6a=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0xa6a9[_0xee3051];return _0x139e81;};'use strict';var emlformat=require(_0x9a6a('0x0'));var rimraf=require(_0x9a6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a6a('0x2'));var rp=require(_0x9a6a('0x3'));var moment=require(_0x9a6a('0x4'));var BPromise=require(_0x9a6a('0x5'));var Mustache=require(_0x9a6a('0x6'));var util=require(_0x9a6a('0x7'));var path=require(_0x9a6a('0x8'));var sox=require(_0x9a6a('0x9'));var csv=require(_0x9a6a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a6a('0xb'));var _=require(_0x9a6a('0xc'));var squel=require(_0x9a6a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9a6a('0xe'));var toCsv=require(_0x9a6a('0xa'));var querystring=require(_0x9a6a('0xf'));var Papa=require(_0x9a6a('0x10'));var Redis=require(_0x9a6a('0x11'));var authService=require(_0x9a6a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a6a('0x13'));var hardwareService=require(_0x9a6a('0x14'));var logger=require(_0x9a6a('0x15'))(_0x9a6a('0x16'));var utils=require('../../config/utils');var config=require(_0x9a6a('0x17'));var licenseUtil=require(_0x9a6a('0x18'));var db=require(_0x9a6a('0x19'))['db'];function respondWithStatusCode(_0x2cc4bb,_0x40044c){_0x40044c=_0x40044c||0xcc;return function(_0x38a1b3){if(_0x38a1b3){return _0x2cc4bb[_0x9a6a('0x1a')](_0x40044c);}return _0x2cc4bb[_0x9a6a('0x1b')](_0x40044c)[_0x9a6a('0x1c')]();};}function respondWithResult(_0x355739,_0x13ee09){_0x13ee09=_0x13ee09||0xc8;return function(_0x11752f){if(_0x11752f){return _0x355739[_0x9a6a('0x1b')](_0x13ee09)['json'](_0x11752f);}};}function respondWithFilteredResult(_0x5be5d7,_0x192af6){return function(_0x6c1146){if(_0x6c1146){var _0x9bdd84=typeof _0x192af6[_0x9a6a('0x1d')]==='undefined'&&typeof _0x192af6[_0x9a6a('0x1e')]===_0x9a6a('0x1f');var _0x190bce=_0x6c1146[_0x9a6a('0x20')];var _0x38fab9=_0x9bdd84?0x0:_0x192af6[_0x9a6a('0x1d')];var _0x24627c=_0x9bdd84?_0x6c1146[_0x9a6a('0x20')]:_0x192af6[_0x9a6a('0x1d')]+_0x192af6[_0x9a6a('0x1e')];var _0x1658d3;if(_0x24627c>=_0x190bce){_0x24627c=_0x190bce;_0x1658d3=0xc8;}else{_0x1658d3=0xce;}_0x5be5d7[_0x9a6a('0x1b')](_0x1658d3);return _0x5be5d7[_0x9a6a('0x21')](_0x9a6a('0x22'),_0x38fab9+'-'+_0x24627c+'/'+_0x190bce)['json'](_0x6c1146);}return null;};}function patchUpdates(_0x372b2e){return function(_0x123f01){try{jsonpatch['apply'](_0x123f01,_0x372b2e,!![]);}catch(_0x440051){return BPromise[_0x9a6a('0x23')](_0x440051);}return _0x123f01[_0x9a6a('0x24')]();};}function saveUpdates(_0x2c5565,_0x5cca78){return function(_0x350d48){if(_0x350d48){return _0x350d48[_0x9a6a('0x25')](_0x2c5565)['then'](function(_0x52bed4){return _0x52bed4;});}return null;};}function removeEntity(_0x19deb4,_0x5e4aa5){return function(_0x75ff6a){if(_0x75ff6a){return _0x75ff6a[_0x9a6a('0x26')]()[_0x9a6a('0x27')](function(){_0x19deb4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d5d9,_0x3914a1){return function(_0x2c8fb2){if(!_0x2c8fb2){_0x22d5d9[_0x9a6a('0x1a')](0x194);}return _0x2c8fb2;};}function handleError(_0x2a1456,_0x44eba0){_0x44eba0=_0x44eba0||0x1f4;return function(_0x3965c8){logger['error'](_0x3965c8[_0x9a6a('0x28')]);if(_0x3965c8[_0x9a6a('0x29')]){delete _0x3965c8[_0x9a6a('0x29')];}_0x2a1456[_0x9a6a('0x1b')](_0x44eba0)[_0x9a6a('0x2a')](_0x3965c8);};}exports[_0x9a6a('0x2b')]=function(_0x124257,_0x344223){var _0x28e8e5={},_0x16bff0={},_0x61fe67={'count':0x0,'rows':[]};var _0x1597a3=_[_0x9a6a('0x2c')](db[_0x9a6a('0x2d')]['rawAttributes'],function(_0x4e9a7c){return{'name':_0x4e9a7c[_0x9a6a('0x2e')],'type':_0x4e9a7c[_0x9a6a('0x2f')][_0x9a6a('0x30')]};});_0x16bff0[_0x9a6a('0x31')]=_[_0x9a6a('0x2c')](_0x1597a3,_0x9a6a('0x29'));_0x16bff0[_0x9a6a('0x32')]=_['keys'](_0x124257[_0x9a6a('0x32')]);_0x16bff0[_0x9a6a('0x33')]=_[_0x9a6a('0x34')](_0x16bff0['model'],_0x16bff0[_0x9a6a('0x32')]);_0x28e8e5[_0x9a6a('0x35')]=_[_0x9a6a('0x34')](_0x16bff0['model'],qs[_0x9a6a('0x36')](_0x124257[_0x9a6a('0x32')][_0x9a6a('0x36')]));_0x28e8e5[_0x9a6a('0x35')]=_0x28e8e5[_0x9a6a('0x35')][_0x9a6a('0x37')]?_0x28e8e5[_0x9a6a('0x35')]:_0x16bff0[_0x9a6a('0x31')];if(!_0x124257['query']['hasOwnProperty'](_0x9a6a('0x38'))){_0x28e8e5[_0x9a6a('0x1e')]=qs['limit'](_0x124257[_0x9a6a('0x32')][_0x9a6a('0x1e')]);_0x28e8e5['offset']=qs['offset'](_0x124257['query']['offset']);}_0x28e8e5['order']=qs[_0x9a6a('0x39')](_0x124257['query'][_0x9a6a('0x39')]);_0x28e8e5['where']=qs[_0x9a6a('0x33')](_[_0x9a6a('0x3a')](_0x124257[_0x9a6a('0x32')],_0x16bff0[_0x9a6a('0x33')]),_0x1597a3);if(_0x124257[_0x9a6a('0x32')][_0x9a6a('0x3b')]){_0x28e8e5['where']=_[_0x9a6a('0x3c')](_0x28e8e5[_0x9a6a('0x3d')],{'$or':_[_0x9a6a('0x2c')](_0x1597a3,function(_0x5a7980){if(_0x5a7980[_0x9a6a('0x2f')]!=='VIRTUAL'){var _0x4f3c12={};_0x4f3c12[_0x5a7980['name']]={'$like':'%'+_0x124257[_0x9a6a('0x32')][_0x9a6a('0x3b')]+'%'};return _0x4f3c12;}})});}_0x28e8e5=_[_0x9a6a('0x3c')]({},_0x28e8e5,_0x124257[_0x9a6a('0x3e')]);var _0x568d96={'where':_0x28e8e5['where']};return db[_0x9a6a('0x2d')][_0x9a6a('0x20')](_0x568d96)[_0x9a6a('0x27')](function(_0x112a7c){_0x61fe67[_0x9a6a('0x20')]=_0x112a7c;if(_0x124257['query'][_0x9a6a('0x3f')]){_0x28e8e5['include']=[{'all':!![]}];}return db[_0x9a6a('0x2d')][_0x9a6a('0x40')](_0x28e8e5);})[_0x9a6a('0x27')](function(_0x22641c){_0x61fe67[_0x9a6a('0x41')]=_0x22641c;return _0x61fe67;})[_0x9a6a('0x27')](respondWithFilteredResult(_0x344223,_0x28e8e5))[_0x9a6a('0x42')](handleError(_0x344223,null));};exports[_0x9a6a('0x43')]=function(_0x4c66a7,_0x4feb56){var _0x214475={'raw':!![],'where':{'id':_0x4c66a7[_0x9a6a('0x44')]['id']}},_0x3c89aa={};_0x3c89aa[_0x9a6a('0x31')]=_[_0x9a6a('0x45')](db[_0x9a6a('0x2d')][_0x9a6a('0x46')]);_0x3c89aa[_0x9a6a('0x32')]=_[_0x9a6a('0x45')](_0x4c66a7[_0x9a6a('0x32')]);_0x3c89aa[_0x9a6a('0x33')]=_[_0x9a6a('0x34')](_0x3c89aa['model'],_0x3c89aa['query']);_0x214475[_0x9a6a('0x35')]=_[_0x9a6a('0x34')](_0x3c89aa[_0x9a6a('0x31')],qs['fields'](_0x4c66a7[_0x9a6a('0x32')][_0x9a6a('0x36')]));_0x214475[_0x9a6a('0x35')]=_0x214475[_0x9a6a('0x35')][_0x9a6a('0x37')]?_0x214475[_0x9a6a('0x35')]:_0x3c89aa['model'];if(_0x4c66a7[_0x9a6a('0x32')]['includeAll']){_0x214475[_0x9a6a('0x47')]=[{'all':!![]}];}_0x214475=_[_0x9a6a('0x3c')]({},_0x214475,_0x4c66a7[_0x9a6a('0x3e')]);return db[_0x9a6a('0x2d')]['find'](_0x214475)['then'](handleEntityNotFound(_0x4feb56,null))[_0x9a6a('0x27')](respondWithResult(_0x4feb56,null))['catch'](handleError(_0x4feb56,null));};exports[_0x9a6a('0x48')]=function(_0x2ec174,_0x26b71c){return db['VoiceDialReport'][_0x9a6a('0x48')](_0x2ec174[_0x9a6a('0x49')],{})[_0x9a6a('0x27')](respondWithResult(_0x26b71c,0xc9))[_0x9a6a('0x42')](handleError(_0x26b71c,null));};exports[_0x9a6a('0x25')]=function(_0x1bab0a,_0x4da907){if(_0x1bab0a[_0x9a6a('0x49')]['id']){delete _0x1bab0a[_0x9a6a('0x49')]['id'];}return db[_0x9a6a('0x2d')][_0x9a6a('0x4a')]({'where':{'id':_0x1bab0a[_0x9a6a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4da907,null))[_0x9a6a('0x27')](saveUpdates(_0x1bab0a[_0x9a6a('0x49')],null))[_0x9a6a('0x27')](respondWithResult(_0x4da907,null))[_0x9a6a('0x42')](handleError(_0x4da907,null));};exports[_0x9a6a('0x26')]=function(_0x1a7dee,_0x311bf7){return db['VoiceDialReport'][_0x9a6a('0x4a')]({'where':{'id':_0x1a7dee[_0x9a6a('0x44')]['id']}})['then'](handleEntityNotFound(_0x311bf7,null))[_0x9a6a('0x27')](removeEntity(_0x311bf7,null))[_0x9a6a('0x42')](handleError(_0x311bf7,null));};exports['describe']=function(_0x566fc7,_0x447ae0){return db[_0x9a6a('0x2d')][_0x9a6a('0x4b')]()[_0x9a6a('0x27')](respondWithResult(_0x447ae0,null))[_0x9a6a('0x42')](handleError(_0x447ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 6e86812..13736a5 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 _0x33a7=['define','VoiceDialReport','uniqueid','util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes'];(function(_0x5f429d,_0x71a169){var _0x2563f6=function(_0x71e4b1){while(--_0x71e4b1){_0x5f429d['push'](_0x5f429d['shift']());}};_0x2563f6(++_0x71a169);}(_0x33a7,0xfd));var _0x733a=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0x33a7[_0x4a4a43];return _0x5893a6;};'use strict';var _=require('lodash');var util=require(_0x733a('0x0'));var logger=require(_0x733a('0x1'))(_0x733a('0x2'));var moment=require(_0x733a('0x3'));var BPromise=require(_0x733a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x733a('0x5'));var attributes=require(_0x733a('0x6'));module['exports']=function(_0x15ea97,_0x47af2f){return _0x15ea97[_0x733a('0x7')](_0x733a('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x733a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2865=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_dial','uniqueid'];(function(_0x40bdc9,_0x2c8dae){var _0x450d2b=function(_0x96a3e0){while(--_0x96a3e0){_0x40bdc9['push'](_0x40bdc9['shift']());}};_0x450d2b(++_0x2c8dae);}(_0x2865,0x1b0));var _0x5286=function(_0x81810f,_0x459711){_0x81810f=_0x81810f-0x0;var _0x50c95c=_0x2865[_0x81810f];return _0x50c95c;};'use strict';var _=require('lodash');var util=require(_0x5286('0x0'));var logger=require(_0x5286('0x1'))(_0x5286('0x2'));var moment=require(_0x5286('0x3'));var BPromise=require(_0x5286('0x4'));var rp=require(_0x5286('0x5'));var fs=require('fs');var path=require(_0x5286('0x6'));var rimraf=require(_0x5286('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x5286('0x8')]=function(_0x239b6e,_0x26af24){return _0x239b6e[_0x5286('0x9')]('VoiceDialReport',attributes,{'tableName':_0x5286('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5286('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 198f737..ed42665 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 _0x00c7=['then','UpdateVoiceDialReport','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','update','where'];(function(_0x1c02f5,_0x2cda5c){var _0x186eb2=function(_0x44cd8c){while(--_0x44cd8c){_0x1c02f5['push'](_0x1c02f5['shift']());}};_0x186eb2(++_0x2cda5c);}(_0x00c7,0x1b4));var _0x700c=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0x00c7[_0x3f3bad];return _0x4f0801;};'use strict';var _=require('lodash');var util=require(_0x700c('0x0'));var moment=require(_0x700c('0x1'));var BPromise=require('bluebird');var rs=require(_0x700c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x700c('0x3'))['db'];var utils=require(_0x700c('0x4'));var logger=require('../../config/logger')(_0x700c('0x5'));var config=require(_0x700c('0x6'));var jayson=require(_0x700c('0x7'));var client=jayson['client'][_0x700c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ecde,_0x41c307,_0x54ff40){return new BPromise(function(_0x15cf60,_0x23557b){return client[_0x700c('0x9')](_0x25ecde,_0x54ff40)['then'](function(_0x257da0){logger[_0x700c('0xa')](_0x700c('0xb'),_0x41c307,_0x700c('0xc'));logger[_0x700c('0xd')](_0x700c('0xe'),_0x41c307,_0x700c('0xc'),JSON[_0x700c('0xf')](_0x257da0));if(_0x257da0[_0x700c('0x10')]){if(_0x257da0[_0x700c('0x10')][_0x700c('0x11')]===0x1f4){logger[_0x700c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x41c307,_0x257da0[_0x700c('0x10')]['message']);return _0x23557b(_0x257da0[_0x700c('0x10')]['message']);}logger['error'](_0x700c('0xb'),_0x41c307,_0x257da0[_0x700c('0x10')][_0x700c('0x12')]);return _0x15cf60(_0x257da0['error'][_0x700c('0x12')]);}else{logger[_0x700c('0xa')](_0x700c('0xb'),_0x41c307,_0x700c('0xc'));_0x15cf60(_0x257da0[_0x700c('0x13')][_0x700c('0x12')]);}})['catch'](function(_0x4a5bb4){logger[_0x700c('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x41c307,_0x4a5bb4);_0x23557b(_0x4a5bb4);});});}exports[_0x700c('0x14')]=function(_0x1c2af5){var _0x5f2dec=this;return new Promise(function(_0x151a20,_0x5ecc04){return db[_0x700c('0x15')][_0x700c('0x16')](_0x1c2af5[_0x700c('0x17')],{'raw':_0x1c2af5[_0x700c('0x18')]?_0x1c2af5[_0x700c('0x18')][_0x700c('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2e2a0f){logger['info'](_0x700c('0x14'),_0x1c2af5);logger[_0x700c('0xd')](_0x700c('0x14'),_0x1c2af5,JSON['stringify'](_0x2e2a0f));_0x151a20(_0x2e2a0f);})[_0x700c('0x1a')](function(_0x21bdb4){logger[_0x700c('0x10')](_0x700c('0x14'),_0x21bdb4[_0x700c('0x12')],_0x1c2af5);_0x5ecc04(_0x5f2dec[_0x700c('0x10')](0x1f4,_0x21bdb4[_0x700c('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x2b5cad){var _0xb79a7c=this;return new Promise(function(_0x37baaf,_0x21e01c){return db[_0x700c('0x15')][_0x700c('0x1b')](_0x2b5cad['body'],{'raw':_0x2b5cad['options']?_0x2b5cad[_0x700c('0x18')][_0x700c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad['options'][_0x700c('0x1c')]||null:null,'attributes':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad[_0x700c('0x18')]['attributes']||null:null,'limit':_0x2b5cad[_0x700c('0x18')]?_0x2b5cad[_0x700c('0x18')]['limit']||null:null})[_0x700c('0x1d')](function(_0x3a454c){logger[_0x700c('0xa')](_0x700c('0x1e'),_0x2b5cad);logger[_0x700c('0xd')](_0x700c('0x1e'),_0x2b5cad,JSON[_0x700c('0xf')](_0x3a454c));_0x37baaf(_0x3a454c);})[_0x700c('0x1a')](function(_0x450984){logger[_0x700c('0x10')](_0x700c('0x1e'),_0x450984[_0x700c('0x12')],_0x2b5cad);_0x21e01c(_0xb79a7c[_0x700c('0x10')](0x1f4,_0x450984[_0x700c('0x12')]));});});}; \ No newline at end of file +var _0x114c=['error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a2d49,_0x10dd1b){var _0x25eaf6=function(_0x5c3c59){while(--_0x5c3c59){_0x5a2d49['push'](_0x5a2d49['shift']());}};_0x25eaf6(++_0x10dd1b);}(_0x114c,0x166));var _0xc114=function(_0xc03b30,_0xa8d304){_0xc03b30=_0xc03b30-0x0;var _0x3b8127=_0x114c[_0xc03b30];return _0x3b8127;};'use strict';var _=require(_0xc114('0x0'));var util=require('util');var moment=require(_0xc114('0x1'));var BPromise=require(_0xc114('0x2'));var rs=require(_0xc114('0x3'));var fs=require('fs');var Redis=require(_0xc114('0x4'));var db=require(_0xc114('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc114('0x6'))(_0xc114('0x7'));var config=require(_0xc114('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc114('0x9')][_0xc114('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6e75c9,_0x46549f,_0x54622a){return new BPromise(function(_0x166c4b,_0x16646a){return client['request'](_0x6e75c9,_0x54622a)[_0xc114('0xb')](function(_0x195576){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x46549f,_0xc114('0xc'));logger[_0xc114('0xd')](_0xc114('0xe'),_0x46549f,'request\x20sent',JSON[_0xc114('0xf')](_0x195576));if(_0x195576[_0xc114('0x10')]){if(_0x195576['error'][_0xc114('0x11')]===0x1f4){logger[_0xc114('0x10')](_0xc114('0x12'),_0x46549f,_0x195576['error'][_0xc114('0x13')]);return _0x16646a(_0x195576[_0xc114('0x10')][_0xc114('0x13')]);}logger[_0xc114('0x10')](_0xc114('0x12'),_0x46549f,_0x195576[_0xc114('0x10')][_0xc114('0x13')]);return _0x166c4b(_0x195576['error'][_0xc114('0x13')]);}else{logger[_0xc114('0x14')](_0xc114('0x12'),_0x46549f,'request\x20sent');_0x166c4b(_0x195576[_0xc114('0x15')]['message']);}})[_0xc114('0x16')](function(_0x44158a){logger[_0xc114('0x10')](_0xc114('0x12'),_0x46549f,_0x44158a);_0x16646a(_0x44158a);});});}exports[_0xc114('0x17')]=function(_0xcd58f4){var _0x2dc73b=this;return new Promise(function(_0xa38f3d,_0x4e470f){return db[_0xc114('0x18')][_0xc114('0x19')](_0xcd58f4[_0xc114('0x1a')],{'raw':_0xcd58f4[_0xc114('0x1b')]?_0xcd58f4[_0xc114('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xc114('0xb')](function(_0x369969){logger[_0xc114('0x14')](_0xc114('0x17'),_0xcd58f4);logger[_0xc114('0xd')]('CreateVoiceDialReport',_0xcd58f4,JSON[_0xc114('0xf')](_0x369969));_0xa38f3d(_0x369969);})[_0xc114('0x16')](function(_0x3f3b84){logger[_0xc114('0x10')]('CreateVoiceDialReport',_0x3f3b84['message'],_0xcd58f4);_0x4e470f(_0x2dc73b[_0xc114('0x10')](0x1f4,_0x3f3b84[_0xc114('0x13')]));});});};exports[_0xc114('0x1c')]=function(_0x3d7e0e){var _0x160ed9=this;return new Promise(function(_0x46c1cf,_0x35ea0d){return db[_0xc114('0x18')][_0xc114('0x1d')](_0x3d7e0e[_0xc114('0x1a')],{'raw':_0x3d7e0e[_0xc114('0x1b')]?_0x3d7e0e[_0xc114('0x1b')][_0xc114('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7e0e['options']?_0x3d7e0e[_0xc114('0x1b')][_0xc114('0x1f')]||null:null,'attributes':_0x3d7e0e['options']?_0x3d7e0e[_0xc114('0x1b')][_0xc114('0x20')]||null:null,'limit':_0x3d7e0e['options']?_0x3d7e0e[_0xc114('0x1b')][_0xc114('0x21')]||null:null})[_0xc114('0xb')](function(_0xa03fce){logger[_0xc114('0x14')]('UpdateVoiceDialReport',_0x3d7e0e);logger[_0xc114('0xd')](_0xc114('0x1c'),_0x3d7e0e,JSON[_0xc114('0xf')](_0xa03fce));_0x46c1cf(_0xa03fce);})[_0xc114('0x16')](function(_0x440878){logger[_0xc114('0x10')](_0xc114('0x1c'),_0x440878[_0xc114('0x13')],_0x3d7e0e);_0x35ea0d(_0x160ed9[_0xc114('0x10')](0x1f4,_0x440878[_0xc114('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 64cf128..b65d99f 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 _0x4639=['/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','show','post','create','/:id/applications','addApplications','put'];(function(_0xb9a64f,_0x4e5ce3){var _0x34a9f5=function(_0x2575d4){while(--_0x2575d4){_0xb9a64f['push'](_0xb9a64f['shift']());}};_0x34a9f5(++_0x4e5ce3);}(_0x4639,0x9b));var _0x9463=function(_0x45493c,_0x39478b){_0x45493c=_0x45493c-0x0;var _0xe89240=_0x4639[_0x45493c];return _0xe89240;};'use strict';var multer=require(_0x9463('0x0'));var util=require(_0x9463('0x1'));var path=require(_0x9463('0x2'));var timeout=require(_0x9463('0x3'));var express=require('express');var router=express[_0x9463('0x4')]();var fs_extra=require(_0x9463('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9463('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x9463('0x7')](),controller[_0x9463('0x8')]);router[_0x9463('0x9')]('/:id',auth[_0x9463('0x7')](),controller[_0x9463('0xa')]);router[_0x9463('0xb')]('/',auth[_0x9463('0x7')](),controller[_0x9463('0xc')]);router[_0x9463('0xb')](_0x9463('0xd'),auth[_0x9463('0x7')](),controller[_0x9463('0xe')]);router[_0x9463('0xf')](_0x9463('0x10'),auth[_0x9463('0x7')](),controller[_0x9463('0x11')]);router['delete']('/:id',auth[_0x9463('0x7')](),controller['destroy']);module[_0x9463('0x12')]=router; \ No newline at end of file +var _0x844e=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x844e,0x94));var _0xe844=function(_0x53d2f2,_0x53a473){_0x53d2f2=_0x53d2f2-0x0;var _0xf41caf=_0x844e[_0x53d2f2];return _0xf41caf;};'use strict';var multer=require(_0xe844('0x0'));var util=require(_0xe844('0x1'));var path=require(_0xe844('0x2'));var timeout=require(_0xe844('0x3'));var express=require(_0xe844('0x4'));var router=express[_0xe844('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe844('0x6'));var interaction=require(_0xe844('0x7'));var config=require('../../config/environment');var controller=require(_0xe844('0x8'));router[_0xe844('0x9')]('/',auth[_0xe844('0xa')](),controller[_0xe844('0xb')]);router[_0xe844('0x9')](_0xe844('0xc'),auth[_0xe844('0xa')](),controller[_0xe844('0xd')]);router[_0xe844('0xe')]('/',auth[_0xe844('0xa')](),controller[_0xe844('0xf')]);router[_0xe844('0xe')](_0xe844('0x10'),auth[_0xe844('0xa')](),controller[_0xe844('0x11')]);router[_0xe844('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe844('0x13')]);router[_0xe844('0x14')](_0xe844('0xc'),auth[_0xe844('0xa')](),controller[_0xe844('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 9c6f0ec..714b742 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 _0xe363=['STRING','compositeIndex','ENUM','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x1b5ee6,_0xc4c347){var _0x533919=function(_0x5934bb){while(--_0x5934bb){_0x1b5ee6['push'](_0x1b5ee6['shift']());}};_0x533919(++_0xc4c347);}(_0xe363,0x10e));var _0x3e36=function(_0x149c69,_0xa04536){_0x149c69=_0x149c69-0x0;var _0x10289c=_0xe363[_0x149c69];return _0x10289c;};'use strict';var Sequelize=require(_0x3e36('0x0'));module[_0x3e36('0x1')]={'context':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'unique':_0x3e36('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'unique':_0x3e36('0x3')},'priority':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x3e36('0x3')},'tag':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3e36('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3e36('0x4')]('inbound',_0x3e36('0x5'),'internal',_0x3e36('0x6'),_0x3e36('0x7'),_0x3e36('0x8'),_0x3e36('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3e36('0x2')],'allowNull':![],'defaultValue':_0x3e36('0xa')},'IntervalId':{'type':Sequelize[_0x3e36('0xb')]},'isApp':{'type':Sequelize[_0x3e36('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3e36('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3e36('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x3e36('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3e36('0xb')]},'recordingFormat':{'type':Sequelize[_0x3e36('0x2')],'defaultValue':_0x3e36('0xd')},'answer':{'type':Sequelize[_0x3e36('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3e36('0xe')],'get':function(_0x3cfac9){return this[_0x3e36('0xf')](_0x3e36('0x10'));}},'alias':{'type':Sequelize[_0x3e36('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x5b87=['*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0xd92a00,_0x3cadb5){var _0x22aff5=function(_0x56d6df){while(--_0x56d6df){_0xd92a00['push'](_0xd92a00['shift']());}};_0x22aff5(++_0x3cadb5);}(_0x5b87,0x1ec));var _0x75b8=function(_0x537d32,_0x31098e){_0x537d32=_0x537d32-0x0;var _0x9daaba=_0x5b87[_0x537d32];return _0x9daaba;};'use strict';var Sequelize=require(_0x75b8('0x0'));module[_0x75b8('0x1')]={'context':{'type':Sequelize[_0x75b8('0x2')],'allowNull':![],'unique':_0x75b8('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x75b8('0x3')},'priority':{'type':Sequelize[_0x75b8('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x75b8('0x3')},'tag':{'type':Sequelize[_0x75b8('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x75b8('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x75b8('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x75b8('0x4')](_0x75b8('0x5'),_0x75b8('0x6'),_0x75b8('0x7'),_0x75b8('0x8'),_0x75b8('0x9'),_0x75b8('0xa'),_0x75b8('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x75b8('0x2')]},'interval':{'type':Sequelize[_0x75b8('0x2')],'allowNull':![],'defaultValue':_0x75b8('0xc')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x75b8('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x75b8('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x75b8('0xe')]},'recordingFormat':{'type':Sequelize[_0x75b8('0x2')],'defaultValue':_0x75b8('0xf')},'answer':{'type':Sequelize[_0x75b8('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x75b8('0x10')],'get':function(_0x46a2ad){return this[_0x75b8('0x11')]('exten');}},'alias':{'type':Sequelize[_0x75b8('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 61d2b3c..cf60d72 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 _0x4660=['OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','then','error','stack','send','index','VoiceExtension','rawAttributes','key','query','intersection','model','fields','attributes','length','order','sort','filters','pick','where','merge','includeAll','include','findAll','catch','show','params','keys','options','create','body','startsWith','exten','concat','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','cutdigits','mandatoryDisposition','context','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4660,0xf9));var _0x0466=function(_0x18fe4e,_0xf5e00f){_0x18fe4e=_0x18fe4e-0x0;var _0x463dfb=_0x4660[_0x18fe4e];return _0x463dfb;};'use strict';var _=require(_0x0466('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0466('0x1'))(_0x0466('0x2'));var config=require(_0x0466('0x3'));var db=require(_0x0466('0x4'))['db'];config[_0x0466('0x5')]=_[_0x0466('0x6')](config[_0x0466('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x0466('0x7'))(new Redis(config[_0x0466('0x5')]));require(_0x0466('0x8'))[_0x0466('0x9')](socket);function respondWithStatusCode(_0x2fa0cc,_0x31f963){_0x31f963=_0x31f963||0xcc;return function(_0x3a1ddc){if(_0x3a1ddc){return _0x2fa0cc[_0x0466('0xa')](_0x31f963);}return _0x2fa0cc[_0x0466('0xb')](_0x31f963)[_0x0466('0xc')]();};}function respondWithResult(_0x158054,_0xcc3fda){_0xcc3fda=_0xcc3fda||0xc8;return function(_0x489e85){if(_0x489e85){return _0x158054[_0x0466('0xb')](_0xcc3fda)[_0x0466('0xd')](_0x489e85);}};}function respondWithFilteredResult(_0x48d0dd,_0x24dcf0){return function(_0x20a5cb){if(_0x20a5cb){var _0x867271=typeof _0x24dcf0[_0x0466('0xe')]===_0x0466('0xf')&&typeof _0x24dcf0[_0x0466('0x10')]===_0x0466('0xf');var _0x40fc99=_0x20a5cb[_0x0466('0x11')];var _0x2c3d42=_0x867271?0x0:_0x24dcf0[_0x0466('0xe')];var _0x3eef06=_0x867271?_0x20a5cb[_0x0466('0x11')]:_0x24dcf0['offset']+_0x24dcf0[_0x0466('0x10')];var _0x4480b1;if(_0x3eef06>=_0x40fc99){_0x3eef06=_0x40fc99;_0x4480b1=0xc8;}else{_0x4480b1=0xce;}_0x48d0dd[_0x0466('0xb')](_0x4480b1);return _0x48d0dd[_0x0466('0x12')](_0x0466('0x13'),_0x2c3d42+'-'+_0x3eef06+'/'+_0x40fc99)['json'](_0x20a5cb);}return null;};}function removeEntity(_0x37c1b6){return function(_0x28e4a8){if(_0x28e4a8){return _0x28e4a8[_0x0466('0x14')]()['then'](function(){var _0x541b06=_0x28e4a8[_0x0466('0x15')]({'plain':!![]});var _0x1b11c3=[{'name':_0x0466('0x16'),'value':_0x0466('0x17'),'ignore':![]},{'name':_0x0466('0x18'),'value':_0x0466('0x19'),'ignore':![]},{'name':_0x0466('0x1a'),'value':_0x0466('0x1b'),'ignore':![]}];var _0xe70398=_(_0x1b11c3)[_0x0466('0x1c')](_0x0466('0x1d'))[_0x0466('0x1e')](_0x0466('0x1f'))[_0x0466('0x1f')]();if(_[_0x0466('0x20')](_0xe70398,_0x541b06['type'])){return;}var _0x38e337=_[_0x0466('0x21')](_0x1b11c3,[_0x0466('0x1f'),_0x541b06[_0x0466('0x22')]])[_0x0466('0x23')];return db['UserProfileResource']['destroy']({'where':{'type':_0x38e337,'resourceId':_0x541b06['id']}})['then'](function(){return _0x28e4a8;});})[_0x0466('0x24')](function(){_0x37c1b6[_0x0466('0xb')](0xcc)[_0x0466('0xc')]();});}};}function handleEntityNotFound(_0x199ae6){return function(_0x3c391c){if(!_0x3c391c){_0x199ae6[_0x0466('0xa')](0x194);}return _0x3c391c;};}function handleError(_0xd328a7,_0xe46173){_0xe46173=_0xe46173||0x1f4;return function(_0x414b58){logger[_0x0466('0x25')](_0x414b58[_0x0466('0x26')]);if(_0x414b58['name']){delete _0x414b58[_0x0466('0x23')];}_0xd328a7[_0x0466('0xb')](_0xe46173)[_0x0466('0x27')](_0x414b58);};}exports[_0x0466('0x28')]=function(_0x46bc29,_0x242741){var _0x5d7303={},_0x5053cb={},_0x3a9235={'count':0x0,'rows':[]};var _0xbabfe0=_[_0x0466('0x1e')](db[_0x0466('0x29')][_0x0466('0x2a')],function(_0x426f4c){return{'name':_0x426f4c['fieldName'],'type':_0x426f4c[_0x0466('0x22')][_0x0466('0x2b')]};});_0x5053cb['model']=_[_0x0466('0x1e')](_0xbabfe0,_0x0466('0x23'));_0x5053cb[_0x0466('0x2c')]=_['keys'](_0x46bc29[_0x0466('0x2c')]);_0x5053cb['filters']=_[_0x0466('0x2d')](_0x5053cb[_0x0466('0x2e')],_0x5053cb[_0x0466('0x2c')]);_0x5d7303['attributes']=_[_0x0466('0x2d')](_0x5053cb[_0x0466('0x2e')],qs[_0x0466('0x2f')](_0x46bc29[_0x0466('0x2c')][_0x0466('0x2f')]));_0x5d7303['attributes']=_0x5d7303[_0x0466('0x30')][_0x0466('0x31')]?_0x5d7303[_0x0466('0x30')]:_0x5053cb[_0x0466('0x2e')];if(!_0x46bc29['query']['hasOwnProperty']('nolimit')){_0x5d7303['limit']=qs[_0x0466('0x10')](_0x46bc29[_0x0466('0x2c')][_0x0466('0x10')]);_0x5d7303[_0x0466('0xe')]=qs['offset'](_0x46bc29[_0x0466('0x2c')][_0x0466('0xe')]);}_0x5d7303[_0x0466('0x32')]=qs[_0x0466('0x33')](_0x46bc29[_0x0466('0x2c')]['sort']);_0x5d7303['where']=qs[_0x0466('0x34')](_[_0x0466('0x35')](_0x46bc29[_0x0466('0x2c')],_0x5053cb[_0x0466('0x34')]),_0xbabfe0);if(_0x46bc29[_0x0466('0x2c')][_0x0466('0x1c')]){_0x5d7303[_0x0466('0x36')]=_[_0x0466('0x37')](_0x5d7303[_0x0466('0x36')],{'$or':_[_0x0466('0x1e')](_0xbabfe0,function(_0x4d79d2){if(_0x4d79d2['type']!=='VIRTUAL'){var _0x18749e={};_0x18749e[_0x4d79d2[_0x0466('0x23')]]={'$like':'%'+_0x46bc29[_0x0466('0x2c')]['filter']+'%'};return _0x18749e;}})});}_0x5d7303=_[_0x0466('0x37')]({},_0x5d7303,_0x46bc29['options']);var _0xd9269e={'where':_0x5d7303[_0x0466('0x36')]};return db[_0x0466('0x29')][_0x0466('0x11')](_0xd9269e)[_0x0466('0x24')](function(_0x235cd3){_0x3a9235[_0x0466('0x11')]=_0x235cd3;if(_0x46bc29[_0x0466('0x2c')][_0x0466('0x38')]){_0x5d7303[_0x0466('0x39')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0466('0x3a')](_0x5d7303);})['then'](function(_0x3c6457){_0x3a9235['rows']=_0x3c6457;return _0x3a9235;})[_0x0466('0x24')](respondWithFilteredResult(_0x242741,_0x5d7303))[_0x0466('0x3b')](handleError(_0x242741,null));};exports[_0x0466('0x3c')]=function(_0x281e5a,_0x219712){var _0x628bca={'raw':![],'where':{'id':_0x281e5a[_0x0466('0x3d')]['id']}},_0x78fe12={};_0x78fe12[_0x0466('0x2e')]=_[_0x0466('0x3e')](db[_0x0466('0x29')][_0x0466('0x2a')]);_0x78fe12[_0x0466('0x2c')]=_[_0x0466('0x3e')](_0x281e5a['query']);_0x78fe12[_0x0466('0x34')]=_['intersection'](_0x78fe12[_0x0466('0x2e')],_0x78fe12[_0x0466('0x2c')]);_0x628bca[_0x0466('0x30')]=_[_0x0466('0x2d')](_0x78fe12['model'],qs['fields'](_0x281e5a[_0x0466('0x2c')][_0x0466('0x2f')]));_0x628bca[_0x0466('0x30')]=_0x628bca[_0x0466('0x30')][_0x0466('0x31')]?_0x628bca['attributes']:_0x78fe12[_0x0466('0x2e')];if(_0x281e5a[_0x0466('0x2c')]['includeAll']){_0x628bca[_0x0466('0x39')]=[{'all':!![]}];}_0x628bca=_[_0x0466('0x37')]({},_0x628bca,_0x281e5a[_0x0466('0x3f')]);return db[_0x0466('0x29')][_0x0466('0x21')](_0x628bca)['then'](handleEntityNotFound(_0x219712,null))['then'](respondWithResult(_0x219712,null))['catch'](handleError(_0x219712,null));};exports['destroy']=function(_0x7f4f8c,_0x293bf6){return db[_0x0466('0x29')][_0x0466('0x21')]({'where':{'id':_0x7f4f8c['params']['id']}})[_0x0466('0x24')](handleEntityNotFound(_0x293bf6,null))[_0x0466('0x24')](removeEntity(_0x293bf6,null))[_0x0466('0x3b')](handleError(_0x293bf6,null));};exports[_0x0466('0x40')]=function(_0x512fe1,_0x2c1819){if(_0x512fe1[_0x0466('0x41')]['type']==='outbound'&&!_[_0x0466('0x42')](_0x512fe1['body'][_0x0466('0x43')],'_')){_0x512fe1[_0x0466('0x41')][_0x0466('0x43')]='_'[_0x0466('0x44')](_0x512fe1[_0x0466('0x41')][_0x0466('0x43')]);}return db[_0x0466('0x29')][_0x0466('0x40')](_0x512fe1['body'],{'raw':![]})[_0x0466('0x24')](function(_0x23aff3){var _0x559c9b=_0x512fe1[_0x0466('0x45')][_0x0466('0x15')]({'plain':!![]});if(!_0x559c9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x559c9b['role']===_0x0466('0x45')){var _0x3a19ed=_0x23aff3['get']({'plain':!![]});var _0x2222ce=[{'name':_0x0466('0x16'),'value':_0x0466('0x17')},{'name':'OutboundRoutes','value':_0x0466('0x19')},{'name':_0x0466('0x1a'),'value':_0x0466('0x1b')}];var _0x5a21fb=_[_0x0466('0x21')](_0x2222ce,[_0x0466('0x1f'),_0x3a19ed[_0x0466('0x22')]])[_0x0466('0x23')];return db[_0x0466('0x46')][_0x0466('0x21')]({'where':{'name':_0x5a21fb,'userProfileId':_0x559c9b[_0x0466('0x47')]},'raw':!![]})[_0x0466('0x24')](function(_0x13d235){if(_0x13d235&&_0x13d235[_0x0466('0x48')]===0x0){return db[_0x0466('0x49')]['create']({'name':_0x3a19ed['name'],'resourceId':_0x3a19ed['id'],'type':_0x13d235[_0x0466('0x23')],'sectionId':_0x13d235['id']},{})[_0x0466('0x24')](function(){return _0x23aff3;});}else{return _0x23aff3;}})[_0x0466('0x3b')](function(_0x3cb817){logger[_0x0466('0x25')](_0x0466('0x4a'),_0x3cb817);throw _0x3cb817;});}return _0x23aff3;})[_0x0466('0x24')](respondWithResult(_0x2c1819,0xc9))['catch'](handleError(_0x2c1819,null));};exports[_0x0466('0x4b')]=function(_0x4ff979,_0x41f6b4){if(_0x4ff979['body']['id']){delete _0x4ff979[_0x0466('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x4ff979['params']['id']}})[_0x0466('0x24')](handleEntityNotFound(_0x41f6b4,null))[_0x0466('0x24')](function(_0x4c1d73){if(_0x4c1d73){return db[_0x0466('0x29')][_0x0466('0x4b')](_[_0x0466('0x35')](_0x4ff979[_0x0466('0x41')],[_0x0466('0x43'),'context','description','recordingFormat',_0x0466('0x4c'),_0x0466('0x4d'),'alias']),{'where':{'context':_0x4c1d73[_0x0466('0x4e')],'exten':_0x4c1d73[_0x0466('0x43')]},'individualHooks':!![]})[_0x0466('0x24')](function(_0x1a2d24){return _0x1a2d24;});}return null;})[_0x0466('0x24')](respondWithStatusCode(_0x41f6b4,null))[_0x0466('0x3b')](handleError(_0x41f6b4,null));};exports[_0x0466('0x4f')]=function(_0x246e95,_0x7f5928){var _0x2c0739=_0x246e95['params']['id'];var _0x23cb41=_0x246e95['body'];var _0x1ddfa3=0xc8;var _0x2202f1=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0466('0x50')]['Transaction'][_0x0466('0x51')][_0x0466('0x52')]},function(_0x2f74f2){return db[_0x0466('0x29')][_0x0466('0x53')]({'where':{'id':_0x2c0739},'transaction':_0x2f74f2})['then'](function(_0x536660){if(_0x536660){return db[_0x0466('0x29')][_0x0466('0x14')]({'where':{'VoiceExtensionId':_0x2c0739},'transaction':_0x2f74f2})[_0x0466('0x24')](function(){var _0x3057d6=_[_0x0466('0x1e')](_0x23cb41,function(_0x349547){_0x349547[_0x0466('0x54')]=_0x2c0739;_0x349547[_0x0466('0x55')]=!![];return _0x349547;});return _0x536660[_0x0466('0x56')](_0x3057d6);})[_0x0466('0x24')](function(_0x42429b){return db['VoiceExtension'][_0x0466('0x57')](_0x42429b,{'transaction':_0x2f74f2});});}else{_0x1ddfa3=0x194;_0x2202f1=[];}});})[_0x0466('0x24')](function(){if(_0x1ddfa3!==0x194){return db[_0x0466('0x29')][_0x0466('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c0739},'order':_0x0466('0x59')})[_0x0466('0x24')](function(_0x1eea1c){_0x2202f1=_0x1eea1c;});}})['catch'](function(_0x1d66a1){_0x1ddfa3=0x1f4;logger[_0x0466('0x25')](_0x1d66a1[_0x0466('0x26')]);if(_0x1d66a1['name']){delete _0x1d66a1[_0x0466('0x23')];}_0x2202f1=_0x1d66a1;})[_0x0466('0x5a')](function(){if(_0x2202f1===null){_0x7f5928[_0x0466('0xa')](_0x1ddfa3);}else{if(_0x1ddfa3===0x1f4){_0x7f5928[_0x0466('0xb')](_0x1ddfa3)[_0x0466('0x27')](_0x2202f1);}else{_0x7f5928[_0x0466('0xb')](_0x1ddfa3)[_0x0466('0xd')](_0x2202f1);}}});}; \ No newline at end of file +var _0x4154=['addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','destroy','error','send','index','map','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','rows','params','length','catch','create','body','startsWith','exten','concat','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','alias'];(function(_0x3e5bc3,_0x5192ca){var _0x1efff6=function(_0x18774d){while(--_0x18774d){_0x3e5bc3['push'](_0x3e5bc3['shift']());}};_0x1efff6(++_0x5192ca);}(_0x4154,0xbe));var _0x4415=function(_0x119d13,_0x263cd2){_0x119d13=_0x119d13-0x0;var _0x333c35=_0x4154[_0x119d13];return _0x333c35;};'use strict';var _=require(_0x4415('0x0'));var Redis=require(_0x4415('0x1'));var qs=require(_0x4415('0x2'));var logger=require(_0x4415('0x3'))('api');var config=require(_0x4415('0x4'));var db=require(_0x4415('0x5'))['db'];config[_0x4415('0x6')]=_[_0x4415('0x7')](config[_0x4415('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x4415('0x8'))(new Redis(config[_0x4415('0x6')]));require(_0x4415('0x9'))['register'](socket);function respondWithStatusCode(_0x106907,_0x5768dd){_0x5768dd=_0x5768dd||0xcc;return function(_0x3ac154){if(_0x3ac154){return _0x106907[_0x4415('0xa')](_0x5768dd);}return _0x106907[_0x4415('0xb')](_0x5768dd)[_0x4415('0xc')]();};}function respondWithResult(_0x580439,_0x44325d){_0x44325d=_0x44325d||0xc8;return function(_0x5118c4){if(_0x5118c4){return _0x580439['status'](_0x44325d)[_0x4415('0xd')](_0x5118c4);}};}function respondWithFilteredResult(_0x5ab279,_0x5a95e1){return function(_0x19932e){if(_0x19932e){var _0x251dcf=typeof _0x5a95e1[_0x4415('0xe')]===_0x4415('0xf')&&typeof _0x5a95e1[_0x4415('0x10')]===_0x4415('0xf');var _0xa28c80=_0x19932e[_0x4415('0x11')];var _0x29ef31=_0x251dcf?0x0:_0x5a95e1['offset'];var _0x5cad76=_0x251dcf?_0x19932e[_0x4415('0x11')]:_0x5a95e1['offset']+_0x5a95e1[_0x4415('0x10')];var _0x5954a9;if(_0x5cad76>=_0xa28c80){_0x5cad76=_0xa28c80;_0x5954a9=0xc8;}else{_0x5954a9=0xce;}_0x5ab279[_0x4415('0xb')](_0x5954a9);return _0x5ab279[_0x4415('0x12')](_0x4415('0x13'),_0x29ef31+'-'+_0x5cad76+'/'+_0xa28c80)[_0x4415('0xd')](_0x19932e);}return null;};}function removeEntity(_0x4e9042){return function(_0x5f33a4){if(_0x5f33a4){return _0x5f33a4['destroy']()[_0x4415('0x14')](function(){var _0x5f4350=_0x5f33a4[_0x4415('0x15')]({'plain':!![]});var _0x1c1667=[{'name':_0x4415('0x16'),'value':_0x4415('0x17'),'ignore':![]},{'name':_0x4415('0x18'),'value':_0x4415('0x19'),'ignore':![]},{'name':_0x4415('0x1a'),'value':_0x4415('0x1b'),'ignore':![]}];var _0x24cef9=_(_0x1c1667)[_0x4415('0x1c')](_0x4415('0x1d'))['map'](_0x4415('0x1e'))[_0x4415('0x1e')]();if(_['includes'](_0x24cef9,_0x5f4350[_0x4415('0x1f')])){return;}var _0x2e7aae=_[_0x4415('0x20')](_0x1c1667,[_0x4415('0x1e'),_0x5f4350[_0x4415('0x1f')]])[_0x4415('0x21')];return db['UserProfileResource'][_0x4415('0x22')]({'where':{'type':_0x2e7aae,'resourceId':_0x5f4350['id']}})[_0x4415('0x14')](function(){return _0x5f33a4;});})[_0x4415('0x14')](function(){_0x4e9042[_0x4415('0xb')](0xcc)[_0x4415('0xc')]();});}};}function handleEntityNotFound(_0x31da8b){return function(_0x30f45c){if(!_0x30f45c){_0x31da8b[_0x4415('0xa')](0x194);}return _0x30f45c;};}function handleError(_0x547bcd,_0x2ccc95){_0x2ccc95=_0x2ccc95||0x1f4;return function(_0x45feee){logger[_0x4415('0x23')](_0x45feee['stack']);if(_0x45feee[_0x4415('0x21')]){delete _0x45feee[_0x4415('0x21')];}_0x547bcd['status'](_0x2ccc95)[_0x4415('0x24')](_0x45feee);};}exports[_0x4415('0x25')]=function(_0x51a980,_0x5eda3f){var _0xc5aca0={},_0x5c8806={},_0x1baae4={'count':0x0,'rows':[]};var _0xc19a37=_[_0x4415('0x26')](db[_0x4415('0x27')][_0x4415('0x28')],function(_0x22d087){return{'name':_0x22d087[_0x4415('0x29')],'type':_0x22d087[_0x4415('0x1f')]['key']};});_0x5c8806[_0x4415('0x2a')]=_[_0x4415('0x26')](_0xc19a37,_0x4415('0x21'));_0x5c8806[_0x4415('0x2b')]=_[_0x4415('0x2c')](_0x51a980[_0x4415('0x2b')]);_0x5c8806[_0x4415('0x2d')]=_[_0x4415('0x2e')](_0x5c8806[_0x4415('0x2a')],_0x5c8806['query']);_0xc5aca0[_0x4415('0x2f')]=_[_0x4415('0x2e')](_0x5c8806[_0x4415('0x2a')],qs[_0x4415('0x30')](_0x51a980[_0x4415('0x2b')][_0x4415('0x30')]));_0xc5aca0[_0x4415('0x2f')]=_0xc5aca0['attributes']['length']?_0xc5aca0['attributes']:_0x5c8806['model'];if(!_0x51a980[_0x4415('0x2b')][_0x4415('0x31')](_0x4415('0x32'))){_0xc5aca0['limit']=qs['limit'](_0x51a980[_0x4415('0x2b')][_0x4415('0x10')]);_0xc5aca0[_0x4415('0xe')]=qs[_0x4415('0xe')](_0x51a980[_0x4415('0x2b')][_0x4415('0xe')]);}_0xc5aca0['order']=qs[_0x4415('0x33')](_0x51a980['query'][_0x4415('0x33')]);_0xc5aca0[_0x4415('0x34')]=qs[_0x4415('0x2d')](_[_0x4415('0x35')](_0x51a980[_0x4415('0x2b')],_0x5c8806[_0x4415('0x2d')]),_0xc19a37);if(_0x51a980[_0x4415('0x2b')][_0x4415('0x1c')]){_0xc5aca0[_0x4415('0x34')]=_[_0x4415('0x36')](_0xc5aca0[_0x4415('0x34')],{'$or':_[_0x4415('0x26')](_0xc19a37,function(_0x3ef79c){if(_0x3ef79c['type']!=='VIRTUAL'){var _0x4db431={};_0x4db431[_0x3ef79c[_0x4415('0x21')]]={'$like':'%'+_0x51a980[_0x4415('0x2b')][_0x4415('0x1c')]+'%'};return _0x4db431;}})});}_0xc5aca0=_[_0x4415('0x36')]({},_0xc5aca0,_0x51a980[_0x4415('0x37')]);var _0x48bfd0={'where':_0xc5aca0[_0x4415('0x34')]};return db[_0x4415('0x27')][_0x4415('0x11')](_0x48bfd0)[_0x4415('0x14')](function(_0x466d99){_0x1baae4[_0x4415('0x11')]=_0x466d99;if(_0x51a980[_0x4415('0x2b')][_0x4415('0x38')]){_0xc5aca0[_0x4415('0x39')]=[{'all':!![]}];}return db[_0x4415('0x27')]['findAll'](_0xc5aca0);})[_0x4415('0x14')](function(_0x449eea){_0x1baae4[_0x4415('0x3a')]=_0x449eea;return _0x1baae4;})[_0x4415('0x14')](respondWithFilteredResult(_0x5eda3f,_0xc5aca0))['catch'](handleError(_0x5eda3f,null));};exports['show']=function(_0x5abd67,_0x19b2a6){var _0x364ee1={'raw':![],'where':{'id':_0x5abd67[_0x4415('0x3b')]['id']}},_0x4ce42d={};_0x4ce42d[_0x4415('0x2a')]=_[_0x4415('0x2c')](db['VoiceExtension'][_0x4415('0x28')]);_0x4ce42d[_0x4415('0x2b')]=_['keys'](_0x5abd67['query']);_0x4ce42d['filters']=_[_0x4415('0x2e')](_0x4ce42d[_0x4415('0x2a')],_0x4ce42d['query']);_0x364ee1[_0x4415('0x2f')]=_[_0x4415('0x2e')](_0x4ce42d['model'],qs[_0x4415('0x30')](_0x5abd67['query'][_0x4415('0x30')]));_0x364ee1[_0x4415('0x2f')]=_0x364ee1[_0x4415('0x2f')][_0x4415('0x3c')]?_0x364ee1['attributes']:_0x4ce42d[_0x4415('0x2a')];if(_0x5abd67[_0x4415('0x2b')]['includeAll']){_0x364ee1[_0x4415('0x39')]=[{'all':!![]}];}_0x364ee1=_['merge']({},_0x364ee1,_0x5abd67[_0x4415('0x37')]);return db['VoiceExtension'][_0x4415('0x20')](_0x364ee1)[_0x4415('0x14')](handleEntityNotFound(_0x19b2a6,null))[_0x4415('0x14')](respondWithResult(_0x19b2a6,null))[_0x4415('0x3d')](handleError(_0x19b2a6,null));};exports[_0x4415('0x22')]=function(_0x31511c,_0x1736e3){return db['VoiceExtension'][_0x4415('0x20')]({'where':{'id':_0x31511c[_0x4415('0x3b')]['id']}})[_0x4415('0x14')](handleEntityNotFound(_0x1736e3,null))[_0x4415('0x14')](removeEntity(_0x1736e3,null))['catch'](handleError(_0x1736e3,null));};exports[_0x4415('0x3e')]=function(_0x2f21e3,_0x3e2977){if(_0x2f21e3[_0x4415('0x3f')][_0x4415('0x1f')]===_0x4415('0x19')&&!_[_0x4415('0x40')](_0x2f21e3['body']['exten'],'_')){_0x2f21e3[_0x4415('0x3f')][_0x4415('0x41')]='_'[_0x4415('0x42')](_0x2f21e3[_0x4415('0x3f')]['exten']);}return db[_0x4415('0x27')]['create'](_0x2f21e3[_0x4415('0x3f')],{'raw':![]})['then'](function(_0x1b4fd5){var _0x335be6=_0x2f21e3[_0x4415('0x43')]['get']({'plain':!![]});if(!_0x335be6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x335be6[_0x4415('0x44')]===_0x4415('0x43')){var _0x596f4a=_0x1b4fd5[_0x4415('0x15')]({'plain':!![]});var _0xd52852=[{'name':_0x4415('0x16'),'value':'inbound'},{'name':_0x4415('0x18'),'value':'outbound'},{'name':'InternalRoutes','value':_0x4415('0x1b')}];var _0x5b5cda=_[_0x4415('0x20')](_0xd52852,[_0x4415('0x1e'),_0x596f4a[_0x4415('0x1f')]])[_0x4415('0x21')];return db[_0x4415('0x45')][_0x4415('0x20')]({'where':{'name':_0x5b5cda,'userProfileId':_0x335be6['userProfileId']},'raw':!![]})[_0x4415('0x14')](function(_0x34101f){if(_0x34101f&&_0x34101f[_0x4415('0x46')]===0x0){return db[_0x4415('0x47')][_0x4415('0x3e')]({'name':_0x596f4a[_0x4415('0x21')],'resourceId':_0x596f4a['id'],'type':_0x34101f['name'],'sectionId':_0x34101f['id']},{})[_0x4415('0x14')](function(){return _0x1b4fd5;});}else{return _0x1b4fd5;}})['catch'](function(_0x1035ad){logger['error'](_0x4415('0x48'),_0x1035ad);throw _0x1035ad;});}return _0x1b4fd5;})[_0x4415('0x14')](respondWithResult(_0x3e2977,0xc9))['catch'](handleError(_0x3e2977,null));};exports[_0x4415('0x49')]=function(_0x3dc11e,_0x223cd4){if(_0x3dc11e[_0x4415('0x3f')]['id']){delete _0x3dc11e[_0x4415('0x3f')]['id'];}return db[_0x4415('0x27')][_0x4415('0x20')]({'where':{'id':_0x3dc11e['params']['id']}})['then'](handleEntityNotFound(_0x223cd4,null))[_0x4415('0x14')](function(_0x3ce803){if(_0x3ce803){return db[_0x4415('0x27')][_0x4415('0x49')](_[_0x4415('0x35')](_0x3dc11e['body'],[_0x4415('0x41'),_0x4415('0x4a'),'description',_0x4415('0x4b'),'cutdigits','mandatoryDisposition',_0x4415('0x4c')]),{'where':{'context':_0x3ce803['context'],'exten':_0x3ce803[_0x4415('0x41')]},'individualHooks':!![]})[_0x4415('0x14')](function(_0x17ddb4){return _0x17ddb4;});}return null;})[_0x4415('0x14')](respondWithStatusCode(_0x223cd4,null))[_0x4415('0x3d')](handleError(_0x223cd4,null));};exports[_0x4415('0x4d')]=function(_0x2b243c,_0x1db206){var _0x5120fb=_0x2b243c[_0x4415('0x3b')]['id'];var _0x57555d=_0x2b243c['body'];var _0x26eb25=0xc8;var _0x22a724=null;return db[_0x4415('0x4e')]['transaction']({'isolationLevel':db[_0x4415('0x4e')][_0x4415('0x4f')][_0x4415('0x50')][_0x4415('0x51')]},function(_0x37b467){return db[_0x4415('0x27')][_0x4415('0x52')]({'where':{'id':_0x5120fb},'transaction':_0x37b467})['then'](function(_0x24fb4b){if(_0x24fb4b){return db['VoiceExtension'][_0x4415('0x22')]({'where':{'VoiceExtensionId':_0x5120fb},'transaction':_0x37b467})['then'](function(){var _0x3afede=_[_0x4415('0x26')](_0x57555d,function(_0x45084c){_0x45084c[_0x4415('0x53')]=_0x5120fb;_0x45084c[_0x4415('0x54')]=!![];return _0x45084c;});return _0x24fb4b['createRouting'](_0x3afede);})[_0x4415('0x14')](function(_0x25b391){return db[_0x4415('0x27')][_0x4415('0x55')](_0x25b391,{'transaction':_0x37b467});});}else{_0x26eb25=0x194;_0x22a724=[];}});})['then'](function(){if(_0x26eb25!==0x194){return db['VoiceExtension'][_0x4415('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5120fb},'order':'cast(priority\x20as\x20unsigned)'})[_0x4415('0x14')](function(_0x3a8e71){_0x22a724=_0x3a8e71;});}})[_0x4415('0x3d')](function(_0x423c00){_0x26eb25=0x1f4;logger[_0x4415('0x23')](_0x423c00[_0x4415('0x57')]);if(_0x423c00[_0x4415('0x21')]){delete _0x423c00['name'];}_0x22a724=_0x423c00;})[_0x4415('0x58')](function(){if(_0x22a724===null){_0x1db206[_0x4415('0xa')](_0x26eb25);}else{if(_0x26eb25===0x1f4){_0x1db206[_0x4415('0xb')](_0x26eb25)[_0x4415('0x24')](_0x22a724);}else{_0x1db206['status'](_0x26eb25)[_0x4415('0xd')](_0x22a724);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6a840d9..2dd66d7 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 _0x79b7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x9a7796,_0xe30784){var _0x2e73a0=function(_0x120615){while(--_0x120615){_0x9a7796['push'](_0x9a7796['shift']());}};_0x2e73a0(++_0xe30784);}(_0x79b7,0x17a));var _0x779b=function(_0x410be5,_0x12f2b7){_0x410be5=_0x410be5-0x0;var _0x1403af=_0x79b7[_0x410be5];return _0x1403af;};'use strict';var EventEmitter=require(_0x779b('0x0'));var VoiceExtension=require(_0x779b('0x1'))['db'][_0x779b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x779b('0x3')](0x0);var events={'afterCreate':_0x779b('0x4'),'afterUpdate':_0x779b('0x5'),'afterDestroy':_0x779b('0x6')};function emitEvent(_0x4e1245){return function(_0x4f948a,_0x1aa991,_0x1d3511){VoiceExtensionEvents[_0x779b('0x7')](_0x4e1245+':'+_0x4f948a['id'],_0x4f948a);VoiceExtensionEvents[_0x779b('0x7')](_0x4e1245,_0x4f948a);_0x1d3511(null);};}for(var e in events){if(events[_0x779b('0x8')](e)){var event=events[e];VoiceExtension[_0x779b('0x9')](e,emitEvent(event));}}module[_0x779b('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8ca5=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3fc60c,_0xc669aa){var _0x10e498=function(_0x1d95c3){while(--_0x1d95c3){_0x3fc60c['push'](_0x3fc60c['shift']());}};_0x10e498(++_0xc669aa);}(_0x8ca5,0x82));var _0x58ca=function(_0x1a6aad,_0x229893){_0x1a6aad=_0x1a6aad-0x0;var _0x12ef60=_0x8ca5[_0x1a6aad];return _0x12ef60;};'use strict';var EventEmitter=require(_0x58ca('0x0'));var VoiceExtension=require(_0x58ca('0x1'))['db'][_0x58ca('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x58ca('0x3')](0x0);var events={'afterCreate':_0x58ca('0x4'),'afterUpdate':_0x58ca('0x5'),'afterDestroy':_0x58ca('0x6')};function emitEvent(_0x3a4b7a){return function(_0x379f0a,_0x2bfd9d,_0x59915b){VoiceExtensionEvents[_0x58ca('0x7')](_0x3a4b7a+':'+_0x379f0a['id'],_0x379f0a);VoiceExtensionEvents[_0x58ca('0x7')](_0x3a4b7a,_0x379f0a);_0x59915b(null);};}for(var e in events){if(events[_0x58ca('0x8')](e)){var event=events[e];VoiceExtension[_0x58ca('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index be65fd0..60adf3b 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 _0x809e=['queue','playback','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime','appType','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','trunk','timeout','options','url','split','length','name','param','prefix','phone','join','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer'];(function(_0xaa9dc0,_0x3bff6a){var _0x5ee2f8=function(_0x1ff53f){while(--_0x1ff53f){_0xaa9dc0['push'](_0xaa9dc0['shift']());}};_0x5ee2f8(++_0x3bff6a);}(_0x809e,0x1e8));var _0xe809=function(_0x247024,_0xae82fb){_0x247024=_0x247024-0x0;var _0x59b429=_0x809e[_0x247024];return _0x59b429;};'use strict';var _=require(_0xe809('0x0'));var attributes=require(_0xe809('0x1'));module[_0xe809('0x2')]=function(_0x182d56){var _0x1f1e6c=_0x182d56[_0xe809('0x3')];function _0x814e61(_0x1d2fdf){var _0x4d51d7=0x2;var _0x2fc7b6=[{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':'CDR(type)='+_0x1d2fdf[_0xe809('0x4')],'context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0x1d2fdf[_0xe809('0x8')]?'Set':_0xe809('0x9'),'appdata':_0x1d2fdf[_0xe809('0x8')]?_0xe809('0xa')+_0x1d2fdf[_0xe809('0x8')]:_0xe809('0xb'),'context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']}];if(_0x1d2fdf[_0xe809('0x4')]===_0xe809('0xc')){_0x2fc7b6[_0xe809('0xd')]({'type':_0xe809('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x1d2fdf['id'],'context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']});}_0x2fc7b6[_0xe809('0xd')]({'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':_0xe809('0xe'),'context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf['type'],'app':_0xe809('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d2fdf['context'],'exten':_0x1d2fdf[_0xe809('0x7')],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']},{'type':_0x1d2fdf[_0xe809('0x4')],'app':_0xe809('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d2fdf[_0xe809('0x6')],'exten':_0x1d2fdf['exten'],'priority':_0x4d51d7++,'VoiceExtensionId':_0x1d2fdf['id']});return _0x2fc7b6;}function _0x4da0f0(_0x3d1dce){var _0x1f790c=0x2;var _0x428796=[{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':'CDR(type)=outbound','context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0x3d1dce[_0xe809('0x8')]?_0xe809('0x5'):'NoOp','appdata':_0x3d1dce[_0xe809('0x8')]?_0xe809('0xa')+_0x3d1dce[_0xe809('0x8')]:_0xe809('0xb'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x10')+(_0x3d1dce[_0xe809('0x11')]?_0xe809('0x12')+_0x3d1dce['cutdigits']+'}':_0xe809('0x13')),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x14')+_0x3d1dce['id'],'context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x15'),'appdata':_0xe809('0x16')+(_0x1f790c+0x2)+_0xe809('0x17')+(_0x1f790c+0x1)+')','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x5'),'appdata':_0x3d1dce[_0xe809('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x3d1dce[_0xe809('0x11')]+'}':_0xe809('0x18'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0xe'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x19'),'context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':'outbound','app':_0xe809('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':'Set','appdata':_0xe809('0x1a')+_0x3d1dce['id'],'context':_0x3d1dce['context'],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']}];if(_0x3d1dce[_0xe809('0x1b')]('recordingFormat')&&_0x3d1dce['recordingFormat']!==_0xe809('0x1c')){_0x428796[_0xe809('0xd')]({'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3d1dce[_0xe809('0x6')],'exten':_0x3d1dce[_0xe809('0x7')],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']},{'type':_0xe809('0xf'),'app':_0xe809('0x5'),'appdata':_0xe809('0x1d')+_0x3d1dce[_0xe809('0x1e')]||_0xe809('0x1f'),'context':_0x3d1dce['context'],'exten':_0x3d1dce['exten'],'priority':_0x1f790c++,'VoiceExtensionId':_0x3d1dce['id']});}return _0x428796;}function _0xeb18a6(_0x2a583d,_0x51d1d0){var _0x212e28=[{'name':_0xe809('0x20'),'param':0x0},{'name':_0xe809('0x21'),'param':0x1},{'name':_0xe809('0x22'),'param':0x2},{'name':_0xe809('0x23'),'param':0x3}];var _0x516c4c={};var _0xb43ff=_0x51d1d0[_0xe809('0x24')](',');var _0x56c2ea=[];for(var _0x6d8152=0x0;_0x6d8152<_0x212e28[_0xe809('0x25')];_0x6d8152++){switch(_0x212e28[_0x6d8152][_0xe809('0x26')]){case _0xe809('0x20'):_0x516c4c[_0xe809('0x20')]=_0xb43ff[_0x212e28[_0x6d8152][_0xe809('0x27')]][_0xe809('0x24')]('/')[0x1];_0x516c4c['phone']=_0xb43ff[_0x212e28[_0x6d8152]['param']][_0xe809('0x24')]('/')[0x2];_0x516c4c[_0xe809('0x28')]=_0x516c4c[_0xe809('0x29')]?_0x516c4c[_0xe809('0x29')][_0xe809('0x24')]('$')[0x0]:undefined;_0x516c4c[_0xe809('0x29')]=_0x2a583d[_0xe809('0x11')]?(_0x516c4c['prefix']||'')+'${EXTEN:'+_0x2a583d[_0xe809('0x11')]+'}':(_0x516c4c[_0xe809('0x28')]||'')+_0xe809('0x13');_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=['SIP',_0x516c4c[_0xe809('0x20')],_0x516c4c[_0xe809('0x29')]][_0xe809('0x2a')]('/');break;case _0xe809('0x22'):_0x516c4c[_0xe809('0x22')]=_0xb43ff[_0x212e28[_0x6d8152]['param']];if(_0x2a583d['recordingFormat']!==_0xe809('0x1c')){if(_0x516c4c[_0xe809('0x22')]['indexOf'](_0xe809('0x2b'))<0x0){_0x516c4c['options']+=_0xe809('0x2b');}}else{_0x516c4c[_0xe809('0x22')]=_0x516c4c[_0xe809('0x22')]['replace'](_0xe809('0x2b'),'');}_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=_0x516c4c['options'];break;default:_0x56c2ea[_0x212e28[_0x6d8152][_0xe809('0x27')]]=_0xb43ff[_0x212e28[_0x6d8152][_0xe809('0x27')]];}}return _0x56c2ea[_0xe809('0x2a')](',');}function _0x2f5a77(_0x38dabc,_0x1ef1da,_0x223522){return new Promise(function(_0xb673dd,_0x44b99e){var _0x502621=[];if(_['isEmpty'](_0x1ef1da))return _0xb673dd(_0x502621);_0x1f1e6c[_0xe809('0x2c')][_0xe809('0x2d')]({'attributes':['id',_0xe809('0x2e'),_0xe809('0x2f')],'raw':!![]})['then'](function(_0x5725f1){for(var _0x3001c8=0x0,_0x4729a3=0x0;_0x3001c8<_0x1ef1da[_0xe809('0x25')];_0x3001c8++,_0x4729a3=0x0){var _0x5ae640=_0x1ef1da[_0x3001c8];var _0xe62bbe=[];var _0x5a6a0d=[];delete _0x5ae640['id'];if(_0x5ae640[_0xe809('0x2e')]!=='*,*,*,*'){_0x5ae640['intervals']=[_0x5ae640[_0xe809('0x2e')]];}else{_0x5ae640[_0xe809('0x30')]=_0x5ae640[_0xe809('0x2f')]?_[_0xe809('0x31')](_['filter'](_0x5725f1,{'IntervalId':_0x5ae640[_0xe809('0x2f')]}),_0xe809('0x2e')):[];}_0x5ae640['context']=_0x38dabc[_0xe809('0x6')];_0x5ae640['exten']=_0x38dabc[_0xe809('0x7')];if(_0x5ae640[_0xe809('0x4')])_0x5ae640['type']=_0x5ae640[_0xe809('0x4')][_0xe809('0x32')]();if(_0x38dabc[_0xe809('0x4')]===_0xe809('0xf')){if(_0x5ae640[_0xe809('0x1b')](_0xe809('0x33'))&&_0x5ae640[_0xe809('0x33')]&&_0x5ae640[_0xe809('0x33')]!=='--'){_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'Set','appdata':_0xe809('0x34')+_0x5ae640['tag'],'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640['intervals'][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'ExecIf','appdata':_0xe809('0x35')+(_0x5ae640[_0xe809('0x36')]?_0xe809('0x37')+_0x5ae640[_0xe809('0x36')]+')':_0xe809('0x38')),'context':_0x38dabc['context'],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}else{if(_0x5ae640[_0xe809('0x1b')](_0xe809('0x39'))){if([_0xe809('0x3a'),_0xe809('0x3b')]['includes'](_0x5ae640[_0xe809('0x3c')][_0xe809('0x32')]())&&_0x5ae640['appType']!==_0xe809('0x3d')){if(_0x5ae640[_0xe809('0x39')]){_0xe62bbe['push']({'type':_0x5ae640[_0xe809('0x4')][_0xe809('0x32')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640['type']['toLowerCase'](),'app':_0xe809('0x5'),'appdata':_0xe809('0x3e'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')]['length']+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}else{_0xe62bbe['push']({'type':_0x5ae640[_0xe809('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0xe809('0x3f'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640['intervals'][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});_0xe62bbe[_0xe809('0xd')]({'type':_0x5ae640['type'][_0xe809('0x32')](),'app':_0xe809('0x5'),'appdata':_0xe809('0x40'),'context':_0x38dabc['context'],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}}}}for(var _0x262688=0x0;_0x262688<_0x5ae640[_0xe809('0x30')][_0xe809('0x25')];_0x262688++){var _0x540932=_0x223522+_0x5ae640['intervals'][_0xe809('0x25')];var _0xea5dbc=_0x262688===_0x5ae640[_0xe809('0x30')]['length']-0x1?_0x223522+_0xe62bbe['length']+_0x5a6a0d['length']+0x2:_0x223522+_0x262688+0x1;_0xe62bbe['splice'](_0x262688,0x0,{'type':_0x38dabc[_0xe809('0x4')],'app':_0xe809('0x41'),'appdata':_0x5ae640[_0xe809('0x30')][_0x262688]+'?'+_0x38dabc['context']+',${EXTEN},'+_0x540932+':'+_0x38dabc[_0xe809('0x6')]+',${EXTEN},'+_0xea5dbc,'exten':_0x38dabc[_0xe809('0x7')],'context':_0x38dabc[_0xe809('0x6')],'priority':_0x223522+_0x262688,'VoiceExtensionId':_0x38dabc['id']});}if(_0x5ae640[_0xe809('0x42')]==='outboundDial'){_0x5ae640[_0xe809('0x43')]=_0xeb18a6(_0x38dabc,_0x5ae640[_0xe809('0x43')]);}if(_0x5ae640[_0xe809('0x42')]===_0xe809('0x44')){_0xe62bbe['push']({'type':_0x5ae640['type']['toLowerCase'](),'app':_0xe809('0x5'),'appdata':_0xe809('0x45'),'context':_0x38dabc[_0xe809('0x6')],'exten':_0x38dabc[_0xe809('0x7')],'priority':_0x5ae640[_0xe809('0x30')][_0xe809('0x25')]+_0x223522+_0x4729a3++,'VoiceExtensionId':_0x38dabc['id']});}_0x5ae640[_0xe809('0x46')]=_0xe62bbe[_0xe809('0x25')]?_[_0xe809('0x47')](_0xe62bbe)[_0xe809('0x46')]+0x1:_0x223522;_0x502621=_[_0xe809('0x48')](_0x502621,_0xe62bbe,[_0x5ae640],_0x5a6a0d);_0x223522=_[_0xe809('0x47')](_0x502621)['priority']+0x1;}return _0xb673dd(_0x502621);})[_0xe809('0x49')](function(_0x4937fe){_0x44b99e(_0x4937fe);});});}return _0x182d56[_0xe809('0x4a')](_0xe809('0x4b'),attributes,{'tableName':_0xe809('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x360f98){var _0x498bcd=this[_0xe809('0x4d')]({'plain':!![]});var _0x50cbff=_0x498bcd[_0xe809('0x4')]===_0xe809('0xf')?_0x4da0f0(_0x498bcd):_0x814e61(_0x498bcd);return _0x2f5a77(_0x498bcd,_0x360f98,_[_0xe809('0x47')](_0x50cbff)['priority']+0x1)['then'](function(_0x224961){var _0x12b71c=_[_0xe809('0x48')](_0x50cbff,_0x224961);_0x12b71c[_0xe809('0xd')]({'type':_0x498bcd[_0xe809('0x4')],'app':'Hangup','exten':_0x498bcd[_0xe809('0x7')],'context':_0x498bcd[_0xe809('0x6')],'priority':_[_0xe809('0x47')](_0x12b71c)[_0xe809('0x46')]+0x1,'VoiceExtensionId':_0x498bcd['id']});return _0x12b71c;});}}});}; \ No newline at end of file +var _0x2e38=['length','trunk','param','phone','prefix','${EXTEN}','options','U(xcally-mixmonitor-context)','join','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','priority','catch','define','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split'];(function(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x2e38,0x11a));var _0x82e3=function(_0x206ab4,_0x53e86a){_0x206ab4=_0x206ab4-0x0;var _0x90b8cb=_0x2e38[_0x206ab4];return _0x90b8cb;};'use strict';var _=require(_0x82e3('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x82e3('0x1')]=function(_0x2bbf7e){var _0x108303=_0x2bbf7e[_0x82e3('0x2')];function _0x55cdb8(_0x24a5b2){var _0x49ec5b=0x2;var _0x2371bc=[{'type':_0x24a5b2[_0x82e3('0x3')],'app':_0x82e3('0x4'),'appdata':_0x82e3('0x5')+_0x24a5b2[_0x82e3('0x3')],'context':_0x24a5b2[_0x82e3('0x6')],'exten':_0x24a5b2['exten'],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']},{'type':_0x24a5b2[_0x82e3('0x3')],'app':_0x24a5b2[_0x82e3('0x7')]?_0x82e3('0x4'):_0x82e3('0x8'),'appdata':_0x24a5b2[_0x82e3('0x7')]?_0x82e3('0x9')+_0x24a5b2[_0x82e3('0x7')]:_0x82e3('0xa'),'context':_0x24a5b2[_0x82e3('0x6')],'exten':_0x24a5b2[_0x82e3('0xb')],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']}];if(_0x24a5b2[_0x82e3('0x3')]===_0x82e3('0xc')){_0x2371bc[_0x82e3('0xd')]({'type':_0x82e3('0xc'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0xe')+_0x24a5b2['id'],'context':_0x24a5b2[_0x82e3('0x6')],'exten':_0x24a5b2[_0x82e3('0xb')],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']});}_0x2371bc[_0x82e3('0xd')]({'type':_0x24a5b2[_0x82e3('0x3')],'app':_0x82e3('0x4'),'appdata':_0x82e3('0xf'),'context':_0x24a5b2[_0x82e3('0x6')],'exten':_0x24a5b2[_0x82e3('0xb')],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']},{'type':_0x24a5b2['type'],'app':_0x82e3('0x4'),'appdata':_0x82e3('0x10'),'context':_0x24a5b2['context'],'exten':_0x24a5b2[_0x82e3('0xb')],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']},{'type':_0x24a5b2[_0x82e3('0x3')],'app':_0x82e3('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x24a5b2[_0x82e3('0x6')],'exten':_0x24a5b2[_0x82e3('0xb')],'priority':_0x49ec5b++,'VoiceExtensionId':_0x24a5b2['id']});return _0x2371bc;}function _0x4c2395(_0x1097cb){var _0x5901b5=0x2;var _0x300507=[{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x12'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb[_0x82e3('0xb')],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':'outbound','app':_0x1097cb['alias']?_0x82e3('0x4'):_0x82e3('0x8'),'appdata':_0x1097cb[_0x82e3('0x7')]?_0x82e3('0x9')+_0x1097cb['alias']:_0x82e3('0xa'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb[_0x82e3('0xb')],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':'outbound','app':_0x82e3('0x4'),'appdata':_0x82e3('0x13')+(_0x1097cb[_0x82e3('0x14')]?_0x82e3('0x15')+_0x1097cb[_0x82e3('0x14')]+'}':'${EXTEN}'),'context':_0x1097cb['context'],'exten':_0x1097cb[_0x82e3('0xb')],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0xe')+_0x1097cb['id'],'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x16'),'appdata':_0x82e3('0x17')+(_0x5901b5+0x2)+_0x82e3('0x18')+(_0x5901b5+0x1)+')','context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x1097cb['cutdigits']?_0x82e3('0x19')+_0x1097cb[_0x82e3('0x14')]+'}':_0x82e3('0x1a'),'context':_0x1097cb['context'],'exten':_0x1097cb[_0x82e3('0xb')],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':'Set','appdata':_0x82e3('0xf'),'context':_0x1097cb['context'],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x10'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x1b'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x1c')+_0x1097cb['id'],'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']}];if(_0x1097cb[_0x82e3('0x1d')](_0x82e3('0x1e'))&&_0x1097cb['recordingFormat']!==_0x82e3('0x1f')){_0x300507[_0x82e3('0xd')]({'type':_0x82e3('0x11'),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x20'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb[_0x82e3('0xb')],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']},{'type':_0x82e3('0x11'),'app':'Set','appdata':_0x82e3('0x21')+_0x1097cb[_0x82e3('0x1e')]||_0x82e3('0x22'),'context':_0x1097cb[_0x82e3('0x6')],'exten':_0x1097cb['exten'],'priority':_0x5901b5++,'VoiceExtensionId':_0x1097cb['id']});}return _0x300507;}function _0x6be40(_0xe4880f,_0x359abb){var _0x5ac469=[{'name':'trunk','param':0x0},{'name':_0x82e3('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':_0x82e3('0x24'),'param':0x3}];var _0xb55d30={};var _0x2628a6=_0x359abb[_0x82e3('0x25')](',');var _0x774104=[];for(var _0x2b4350=0x0;_0x2b4350<_0x5ac469[_0x82e3('0x26')];_0x2b4350++){switch(_0x5ac469[_0x2b4350]['name']){case'trunk':_0xb55d30[_0x82e3('0x27')]=_0x2628a6[_0x5ac469[_0x2b4350][_0x82e3('0x28')]][_0x82e3('0x25')]('/')[0x1];_0xb55d30[_0x82e3('0x29')]=_0x2628a6[_0x5ac469[_0x2b4350][_0x82e3('0x28')]][_0x82e3('0x25')]('/')[0x2];_0xb55d30[_0x82e3('0x2a')]=_0xb55d30[_0x82e3('0x29')]?_0xb55d30['phone'][_0x82e3('0x25')]('$')[0x0]:undefined;_0xb55d30['phone']=_0xe4880f[_0x82e3('0x14')]?(_0xb55d30[_0x82e3('0x2a')]||'')+_0x82e3('0x15')+_0xe4880f[_0x82e3('0x14')]+'}':(_0xb55d30[_0x82e3('0x2a')]||'')+_0x82e3('0x2b');_0x774104[_0x5ac469[_0x2b4350]['param']]=['SIP',_0xb55d30[_0x82e3('0x27')],_0xb55d30[_0x82e3('0x29')]]['join']('/');break;case'options':_0xb55d30['options']=_0x2628a6[_0x5ac469[_0x2b4350][_0x82e3('0x28')]];if(_0xe4880f['recordingFormat']!==_0x82e3('0x1f')){if(_0xb55d30[_0x82e3('0x2c')]['indexOf'](_0x82e3('0x2d'))<0x0){_0xb55d30[_0x82e3('0x2c')]+='U(xcally-mixmonitor-context)';}}else{_0xb55d30[_0x82e3('0x2c')]=_0xb55d30[_0x82e3('0x2c')]['replace']('U(xcally-mixmonitor-context)','');}_0x774104[_0x5ac469[_0x2b4350][_0x82e3('0x28')]]=_0xb55d30[_0x82e3('0x2c')];break;default:_0x774104[_0x5ac469[_0x2b4350][_0x82e3('0x28')]]=_0x2628a6[_0x5ac469[_0x2b4350]['param']];}}return _0x774104[_0x82e3('0x2e')](',');}function _0x49da62(_0x1ad18e,_0x5b5810,_0xcee736){return new Promise(function(_0x3d61ed,_0x48cbfd){var _0x417090=[];if(_[_0x82e3('0x2f')](_0x5b5810))return _0x3d61ed(_0x417090);_0x108303[_0x82e3('0x30')]['findAll']({'attributes':['id',_0x82e3('0x31'),_0x82e3('0x32')],'raw':!![]})[_0x82e3('0x33')](function(_0x5cb9b9){for(var _0xd379ea=0x0,_0xfc124f=0x0;_0xd379ea<_0x5b5810[_0x82e3('0x26')];_0xd379ea++,_0xfc124f=0x0){var _0x1ad56d=_0x5b5810[_0xd379ea];var _0x46a372=[];var _0x5a2924=[];delete _0x1ad56d['id'];if(_0x1ad56d['interval']!==_0x82e3('0x34')){_0x1ad56d[_0x82e3('0x35')]=[_0x1ad56d[_0x82e3('0x31')]];}else{_0x1ad56d[_0x82e3('0x35')]=_0x1ad56d[_0x82e3('0x32')]?_['map'](_['filter'](_0x5cb9b9,{'IntervalId':_0x1ad56d[_0x82e3('0x32')]}),_0x82e3('0x31')):[];}_0x1ad56d[_0x82e3('0x6')]=_0x1ad18e[_0x82e3('0x6')];_0x1ad56d['exten']=_0x1ad18e['exten'];if(_0x1ad56d[_0x82e3('0x3')])_0x1ad56d[_0x82e3('0x3')]=_0x1ad56d[_0x82e3('0x3')][_0x82e3('0x36')]();if(_0x1ad18e[_0x82e3('0x3')]==='outbound'){if(_0x1ad56d['hasOwnProperty'](_0x82e3('0x37'))&&_0x1ad56d[_0x82e3('0x37')]&&_0x1ad56d[_0x82e3('0x37')]!=='--'){_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d[_0x82e3('0x3')][_0x82e3('0x36')](),'app':'Set','appdata':_0x82e3('0x38')+_0x1ad56d['tag'],'context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d[_0x82e3('0x35')]['length']+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});}_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d[_0x82e3('0x3')][_0x82e3('0x36')](),'app':_0x82e3('0x16'),'appdata':_0x82e3('0x39')+(_0x1ad56d[_0x82e3('0x3a')]?_0x82e3('0x3b')+_0x1ad56d['callerID']+')':_0x82e3('0x3c')),'context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});}else{if(_0x1ad56d[_0x82e3('0x1d')](_0x82e3('0x3d'))){if([_0x82e3('0x3e'),_0x82e3('0x3f')]['includes'](_0x1ad56d[_0x82e3('0x40')][_0x82e3('0x36')]())&&_0x1ad56d[_0x82e3('0x41')]!=='custom'){if(_0x1ad56d[_0x82e3('0x3d')]){_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d[_0x82e3('0x3')][_0x82e3('0x36')](),'app':_0x82e3('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d['type'][_0x82e3('0x36')](),'app':'Set','appdata':_0x82e3('0x42'),'context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e['exten'],'priority':_0x1ad56d['intervals'][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});}else{_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d['type'][_0x82e3('0x36')](),'app':_0x82e3('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1ad18e['context'],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});_0x46a372['push']({'type':_0x1ad56d[_0x82e3('0x3')][_0x82e3('0x36')](),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x43'),'context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});}}}}for(var _0xdd5a6=0x0;_0xdd5a6<_0x1ad56d[_0x82e3('0x35')]['length'];_0xdd5a6++){var _0x8c4609=_0xcee736+_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')];var _0xbe4ae3=_0xdd5a6===_0x1ad56d[_0x82e3('0x35')][_0x82e3('0x26')]-0x1?_0xcee736+_0x46a372['length']+_0x5a2924[_0x82e3('0x26')]+0x2:_0xcee736+_0xdd5a6+0x1;_0x46a372[_0x82e3('0x44')](_0xdd5a6,0x0,{'type':_0x1ad18e[_0x82e3('0x3')],'app':'GotoIfTime','appdata':_0x1ad56d[_0x82e3('0x35')][_0xdd5a6]+'?'+_0x1ad18e[_0x82e3('0x6')]+',${EXTEN},'+_0x8c4609+':'+_0x1ad18e[_0x82e3('0x6')]+',${EXTEN},'+_0xbe4ae3,'exten':_0x1ad18e[_0x82e3('0xb')],'context':_0x1ad18e[_0x82e3('0x6')],'priority':_0xcee736+_0xdd5a6,'VoiceExtensionId':_0x1ad18e['id']});}if(_0x1ad56d[_0x82e3('0x41')]===_0x82e3('0x45')){_0x1ad56d[_0x82e3('0x46')]=_0x6be40(_0x1ad18e,_0x1ad56d[_0x82e3('0x46')]);}if(_0x1ad56d[_0x82e3('0x41')]==='agi'){_0x46a372[_0x82e3('0xd')]({'type':_0x1ad56d[_0x82e3('0x3')]['toLowerCase'](),'app':_0x82e3('0x4'),'appdata':_0x82e3('0x47'),'context':_0x1ad18e[_0x82e3('0x6')],'exten':_0x1ad18e[_0x82e3('0xb')],'priority':_0x1ad56d['intervals'][_0x82e3('0x26')]+_0xcee736+_0xfc124f++,'VoiceExtensionId':_0x1ad18e['id']});}_0x1ad56d['priority']=_0x46a372[_0x82e3('0x26')]?_[_0x82e3('0x48')](_0x46a372)['priority']+0x1:_0xcee736;_0x417090=_[_0x82e3('0x49')](_0x417090,_0x46a372,[_0x1ad56d],_0x5a2924);_0xcee736=_[_0x82e3('0x48')](_0x417090)[_0x82e3('0x4a')]+0x1;}return _0x3d61ed(_0x417090);})[_0x82e3('0x4b')](function(_0x47c453){_0x48cbfd(_0x47c453);});});}return _0x2bbf7e[_0x82e3('0x4c')](_0x82e3('0x4d'),attributes,{'tableName':_0x82e3('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3bcf76){var _0x37573a=this['get']({'plain':!![]});var _0x579762=_0x37573a[_0x82e3('0x3')]===_0x82e3('0x11')?_0x4c2395(_0x37573a):_0x55cdb8(_0x37573a);return _0x49da62(_0x37573a,_0x3bcf76,_[_0x82e3('0x48')](_0x579762)[_0x82e3('0x4a')]+0x1)['then'](function(_0x3d17d5){var _0x19af2b=_[_0x82e3('0x49')](_0x579762,_0x3d17d5);_0x19af2b[_0x82e3('0xd')]({'type':_0x37573a[_0x82e3('0x3')],'app':_0x82e3('0x4f'),'exten':_0x37573a[_0x82e3('0xb')],'context':_0x37573a[_0x82e3('0x6')],'priority':_['last'](_0x19af2b)[_0x82e3('0x4a')]+0x1,'VoiceExtensionId':_0x37573a['id']});return _0x19af2b;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cd3304a..f5ef80a 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 _0x2675=['findAll','options','where','limit','include','map','model','attributes','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceExtension','VoiceExtension'];(function(_0x47c97a,_0x23d388){var _0x296a19=function(_0x5971f6){while(--_0x5971f6){_0x47c97a['push'](_0x47c97a['shift']());}};_0x296a19(++_0x23d388);}(_0x2675,0x75));var _0x5267=function(_0xd7a37d,_0x3b2141){_0xd7a37d=_0xd7a37d-0x0;var _0x3b1898=_0x2675[_0xd7a37d];return _0x3b1898;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});config[_0x5267('0x9')]=_[_0x5267('0xa')](config['redis'],{'host':_0x5267('0xb'),'port':0x18eb});var socket=require(_0x5267('0xc'))(new Redis(config['redis']));require(_0x5267('0xd'))['register'](socket);function respondWithRpcPromise(_0x3ff4e9,_0x207d47,_0x26e22b){return new BPromise(function(_0x534c2b,_0x3e6964){return client['request'](_0x3ff4e9,_0x26e22b)[_0x5267('0xe')](function(_0x5bbf00){logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));logger[_0x5267('0x12')](_0x5267('0x13'),_0x207d47,_0x5267('0x11'),JSON[_0x5267('0x14')](_0x5bbf00));if(_0x5bbf00[_0x5267('0x15')]){if(_0x5bbf00[_0x5267('0x15')][_0x5267('0x16')]===0x1f4){logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')]['message']);return _0x3e6964(_0x5bbf00['error'][_0x5267('0x17')]);}logger[_0x5267('0x15')](_0x5267('0x10'),_0x207d47,_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);return _0x534c2b(_0x5bbf00[_0x5267('0x15')][_0x5267('0x17')]);}else{logger[_0x5267('0xf')](_0x5267('0x10'),_0x207d47,_0x5267('0x11'));_0x534c2b(_0x5bbf00[_0x5267('0x18')][_0x5267('0x17')]);}})['catch'](function(_0x18f32e){logger[_0x5267('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x207d47,_0x18f32e);_0x3e6964(_0x18f32e);});});}exports[_0x5267('0x19')]=function(_0x56733e){var _0x1cf835=this;return new Promise(function(_0x1019e7,_0x39c0c3){return db[_0x5267('0x1a')][_0x5267('0x1b')]({'raw':_0x56733e['options']?_0x56733e[_0x5267('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x56733e[_0x5267('0x1c')]?_0x56733e[_0x5267('0x1c')][_0x5267('0x1d')]||null:null,'attributes':_0x56733e['options']?_0x56733e['options']['attributes']||null:null,'limit':_0x56733e['options']?_0x56733e['options'][_0x5267('0x1e')]||null:null,'include':_0x56733e[_0x5267('0x1c')]?_0x56733e[_0x5267('0x1c')][_0x5267('0x1f')]?_[_0x5267('0x20')](_0x56733e[_0x5267('0x1c')][_0x5267('0x1f')],function(_0x220e03){return{'model':db[_0x220e03[_0x5267('0x21')]],'as':_0x220e03['as'],'attributes':_0x220e03['attributes'],'include':_0x220e03['include']?_[_0x5267('0x20')](_0x220e03[_0x5267('0x1f')],function(_0x5abf95){return{'model':db[_0x5abf95[_0x5267('0x21')]],'as':_0x5abf95['as'],'attributes':_0x5abf95['attributes'],'include':_0x5abf95['include']?_[_0x5267('0x20')](_0x5abf95[_0x5267('0x1f')],function(_0x1f33b7){return{'model':db[_0x1f33b7[_0x5267('0x21')]],'as':_0x1f33b7['as'],'attributes':_0x1f33b7[_0x5267('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e87eb){logger[_0x5267('0xf')](_0x5267('0x19'),_0x56733e);logger[_0x5267('0x12')]('GetVoiceExtension',_0x56733e,JSON['stringify'](_0x5e87eb));_0x1019e7(_0x5e87eb);})[_0x5267('0x23')](function(_0x3ef2a8){logger[_0x5267('0x15')]('GetVoiceExtension',_0x3ef2a8['message'],_0x56733e);_0x39c0c3(_0x1cf835[_0x5267('0x15')](0x1f4,_0x3ef2a8[_0x5267('0x17')]));});});}; \ No newline at end of file +var _0xaa48=['options','raw','where','limit','include','map','model','attributes','GetVoiceExtension','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa48,0x15a));var _0x8aa4=function(_0x4cb7fb,_0x1b6bab){_0x4cb7fb=_0x4cb7fb-0x0;var _0x565e60=_0xaa48[_0x4cb7fb];return _0x565e60;};'use strict';var _=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var moment=require(_0x8aa4('0x2'));var BPromise=require(_0x8aa4('0x3'));var rs=require(_0x8aa4('0x4'));var fs=require('fs');var Redis=require(_0x8aa4('0x5'));var db=require(_0x8aa4('0x6'))['db'];var utils=require(_0x8aa4('0x7'));var logger=require(_0x8aa4('0x8'))(_0x8aa4('0x9'));var config=require(_0x8aa4('0xa'));var jayson=require(_0x8aa4('0xb'));var client=jayson[_0x8aa4('0xc')][_0x8aa4('0xd')]({'port':0x232a});config[_0x8aa4('0xe')]=_[_0x8aa4('0xf')](config[_0x8aa4('0xe')],{'host':_0x8aa4('0x10'),'port':0x18eb});var socket=require(_0x8aa4('0x11'))(new Redis(config['redis']));require(_0x8aa4('0x12'))[_0x8aa4('0x13')](socket);function respondWithRpcPromise(_0x55c899,_0x177fe5,_0xab07f2){return new BPromise(function(_0x557ffa,_0xc21580){return client[_0x8aa4('0x14')](_0x55c899,_0xab07f2)[_0x8aa4('0x15')](function(_0x38ecc6){logger[_0x8aa4('0x16')](_0x8aa4('0x17'),_0x177fe5,_0x8aa4('0x18'));logger[_0x8aa4('0x19')](_0x8aa4('0x1a'),_0x177fe5,_0x8aa4('0x18'),JSON['stringify'](_0x38ecc6));if(_0x38ecc6['error']){if(_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1c')]===0x1f4){logger[_0x8aa4('0x1b')](_0x8aa4('0x17'),_0x177fe5,_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1d')]);return _0xc21580(_0x38ecc6[_0x8aa4('0x1b')][_0x8aa4('0x1d')]);}logger[_0x8aa4('0x1b')](_0x8aa4('0x17'),_0x177fe5,_0x38ecc6['error']['message']);return _0x557ffa(_0x38ecc6['error'][_0x8aa4('0x1d')]);}else{logger[_0x8aa4('0x16')](_0x8aa4('0x17'),_0x177fe5,_0x8aa4('0x18'));_0x557ffa(_0x38ecc6['result'][_0x8aa4('0x1d')]);}})[_0x8aa4('0x1e')](function(_0x59d3a2){logger[_0x8aa4('0x1b')]('VoiceExtension,\x20%s,\x20%s',_0x177fe5,_0x59d3a2);_0xc21580(_0x59d3a2);});});}exports['GetVoiceExtension']=function(_0x174158){var _0x5971e7=this;return new Promise(function(_0x324d59,_0x2df294){return db['VoiceExtension'][_0x8aa4('0x1f')]({'raw':_0x174158[_0x8aa4('0x20')]?_0x174158['options'][_0x8aa4('0x21')]===undefined?!![]:![]:!![],'where':_0x174158[_0x8aa4('0x20')]?_0x174158[_0x8aa4('0x20')][_0x8aa4('0x22')]||null:null,'attributes':_0x174158[_0x8aa4('0x20')]?_0x174158['options']['attributes']||null:null,'limit':_0x174158['options']?_0x174158['options'][_0x8aa4('0x23')]||null:null,'include':_0x174158['options']?_0x174158[_0x8aa4('0x20')][_0x8aa4('0x24')]?_[_0x8aa4('0x25')](_0x174158[_0x8aa4('0x20')]['include'],function(_0x513cb9){return{'model':db[_0x513cb9[_0x8aa4('0x26')]],'as':_0x513cb9['as'],'attributes':_0x513cb9['attributes'],'include':_0x513cb9[_0x8aa4('0x24')]?_[_0x8aa4('0x25')](_0x513cb9['include'],function(_0x14b38d){return{'model':db[_0x14b38d['model']],'as':_0x14b38d['as'],'attributes':_0x14b38d[_0x8aa4('0x27')],'include':_0x14b38d['include']?_[_0x8aa4('0x25')](_0x14b38d[_0x8aa4('0x24')],function(_0x41b1e0){return{'model':db[_0x41b1e0[_0x8aa4('0x26')]],'as':_0x41b1e0['as'],'attributes':_0x41b1e0[_0x8aa4('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d4894){logger['info'](_0x8aa4('0x28'),_0x174158);logger[_0x8aa4('0x19')]('GetVoiceExtension',_0x174158,JSON[_0x8aa4('0x29')](_0x5d4894));_0x324d59(_0x5d4894);})[_0x8aa4('0x1e')](function(_0x3e4595){logger[_0x8aa4('0x1b')](_0x8aa4('0x28'),_0x3e4595[_0x8aa4('0x1d')],_0x174158);_0x2df294(_0x5971e7['error'](0x1f4,_0x3e4595[_0x8aa4('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1b0eb2d..9b4bebc 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x3e376e,_0x2b44ed){var _0x1a8b09=function(_0x24a083){while(--_0x24a083){_0x3e376e['push'](_0x3e376e['shift']());}};_0x1a8b09(++_0x2b44ed);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f87c2,_0x5b1e5c){_0x2f87c2=_0x2f87c2-0x0;var _0x2aaa28=_0xf494[_0x2f87c2];return _0x2aaa28;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x14c566,_0x49dd17){var _0x42435d=function(_0x546ce1){while(--_0x546ce1){_0x14c566['push'](_0x14c566['shift']());}};_0x42435d(++_0x49dd17);}(_0x4975,0x86));var _0x5497=function(_0xfe26cc,_0x3dbc61){_0xfe26cc=_0xfe26cc-0x0;var _0x425dca=_0x4975[_0xfe26cc];return _0x425dca;};'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 493abdf..93624fc 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 _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x291d8c,_0x27f577){var _0x382aea=function(_0x1de38f){while(--_0x1de38f){_0x291d8c['push'](_0x291d8c['shift']());}};_0x382aea(++_0x27f577);}(_0x958a,0x128));var _0xa958=function(_0x2d22d4,_0x39d5fb){_0x2d22d4=_0x2d22d4-0x0;var _0x427a3f=_0x958a[_0x2d22d4];return _0x427a3f;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc6ac=['./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18c25f,_0x59370e){var _0x188c12=function(_0x2d5825){while(--_0x2d5825){_0x18c25f['push'](_0x18c25f['shift']());}};_0x188c12(++_0x59370e);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x211891,_0x19d6d5){_0x211891=_0x211891-0x0;var _0x38d310=_0xc6ac[_0x211891];return _0x38d310;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')]('/',auth[_0xcc6a('0xc')](),controller['create']);router[_0xcc6a('0x13')](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller['update']);router[_0xcc6a('0x14')](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a651fd9..fcf09f9 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 _0x5edb=['INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TIMESTAMP'];(function(_0x246701,_0x45d903){var _0x2e3cde=function(_0x3c61bb){while(--_0x3c61bb){_0x246701['push'](_0x246701['shift']());}};_0x2e3cde(++_0x45d903);}(_0x5edb,0xb5));var _0xb5ed=function(_0x23f7f7,_0x1e4f85){_0x23f7f7=_0x23f7f7-0x0;var _0xfd12e0=_0x5edb[_0x23f7f7];return _0xfd12e0;};'use strict';var Sequelize=require('sequelize');module[_0xb5ed('0x0')]={'customer_id':{'type':Sequelize[_0xb5ed('0x1')]},'context':{'type':Sequelize[_0xb5ed('0x1')],'defaultValue':_0xb5ed('0x2'),'unique':_0xb5ed('0x3')},'mailbox':{'type':Sequelize[_0xb5ed('0x1')],'defaultValue':'','allowNull':![],'unique':_0xb5ed('0x3')},'password':{'type':Sequelize[_0xb5ed('0x1')]},'fullname':{'type':Sequelize[_0xb5ed('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32d98c){this[_0xb5ed('0x4')](_0xb5ed('0x5'),typeof _0x32d98c==='string'&&_0x32d98c[_0xb5ed('0x6')]()?_0x32d98c[_0xb5ed('0x6')]():null);}},'pager':{'type':Sequelize[_0xb5ed('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xb5ed('0x7')},'attach':{'type':Sequelize['ENUM'](_0xb5ed('0x8'),'no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xb5ed('0x1')]},'callback':{'type':Sequelize[_0xb5ed('0x1')]},'review':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb5ed('0x9')](_0xb5ed('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb5ed('0x9')]('yes','no'),'defaultValue':_0xb5ed('0x8'),'allowNull':![]},'stamp':{'type':_0xb5ed('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xb5ed('0x1')]},'maxsecs':{'type':Sequelize[_0xb5ed('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb5ed('0xc')](_0xb5ed('0xd'))+_0xb5ed('0xe')+this[_0xb5ed('0xc')](_0xb5ed('0xf'));}}}; \ No newline at end of file +var _0xc075=['contest_mailbox','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','STRING','from-voicemail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc075,0x166));var _0x5c07=function(_0x1721f3,_0x5263f3){_0x1721f3=_0x1721f3-0x0;var _0x3dc3a1=_0xc075[_0x1721f3];return _0x3dc3a1;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x5c07('0x0')]},'context':{'type':Sequelize[_0x5c07('0x0')],'defaultValue':_0x5c07('0x1'),'unique':_0x5c07('0x2')},'mailbox':{'type':Sequelize[_0x5c07('0x0')],'defaultValue':'','allowNull':![],'unique':_0x5c07('0x2')},'password':{'type':Sequelize[_0x5c07('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5c07('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3b2d45){this['setDataValue'](_0x5c07('0x3'),typeof _0x3b2d45===_0x5c07('0x4')&&_0x3b2d45[_0x5c07('0x5')]()?_0x3b2d45['trim']():null);}},'pager':{'type':Sequelize[_0x5c07('0x0')]},'tz':{'type':Sequelize[_0x5c07('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':_0x5c07('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5c07('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5c07('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':_0x5c07('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5c07('0x6')](_0x5c07('0x7'),'no'),'defaultValue':_0x5c07('0x7'),'allowNull':![]},'stamp':{'type':_0x5c07('0x9')},'emailsubject':{'type':Sequelize[_0x5c07('0x0')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x5c07('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5c07('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5c07('0xb')],'get':function(){return this[_0x5c07('0xc')]('fullname')+_0x5c07('0xd')+this[_0x5c07('0xc')](_0x5c07('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index d1a7e4f..4be6e16 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 _0x91a7=['status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','includeAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','order','mailbox','options','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x1ca9eb,_0x99a10b){var _0x2e284e=function(_0x1196a4){while(--_0x1196a4){_0x1ca9eb['push'](_0x1ca9eb['shift']());}};_0x2e284e(++_0x99a10b);}(_0x91a7,0xe7));var _0x791a=function(_0x36650f,_0x233480){_0x36650f=_0x36650f-0x0;var _0x4ca8bf=_0x91a7[_0x36650f];return _0x4ca8bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791a('0x0'));var zipdir=require(_0x791a('0x1'));var jsonpatch=require(_0x791a('0x2'));var rp=require('request-promise');var moment=require(_0x791a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x791a('0x4'));var util=require('util');var path=require('path');var sox=require(_0x791a('0x5'));var csv=require(_0x791a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x791a('0x7'));var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0x6'));var querystring=require(_0x791a('0xb'));var Papa=require(_0x791a('0xc'));var Redis=require(_0x791a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xe'));var as=require(_0x791a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x10'))(_0x791a('0x11'));var utils=require(_0x791a('0x12'));var config=require(_0x791a('0x13'));var licenseUtil=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x53dc41,_0x5daecd){_0x5daecd=_0x5daecd||0xcc;return function(_0xc92016){if(_0xc92016){return _0x53dc41[_0x791a('0x16')](_0x5daecd);}return _0x53dc41['status'](_0x5daecd)[_0x791a('0x17')]();};}function respondWithResult(_0x3a2ec6,_0x5d5b11){_0x5d5b11=_0x5d5b11||0xc8;return function(_0x2887f0){if(_0x2887f0){return _0x3a2ec6[_0x791a('0x18')](_0x5d5b11)[_0x791a('0x19')](_0x2887f0);}};}function respondWithFilteredResult(_0x5cdf2,_0x55e845){return function(_0x2ce2e0){if(_0x2ce2e0){var _0x575d11=typeof _0x55e845[_0x791a('0x1a')]===_0x791a('0x1b')&&typeof _0x55e845['limit']===_0x791a('0x1b');var _0x5bea2e=_0x2ce2e0[_0x791a('0x1c')];var _0x52941d=_0x575d11?0x0:_0x55e845['offset'];var _0x588d00=_0x575d11?_0x2ce2e0[_0x791a('0x1c')]:_0x55e845['offset']+_0x55e845['limit'];var _0x39c60b;if(_0x588d00>=_0x5bea2e){_0x588d00=_0x5bea2e;_0x39c60b=0xc8;}else{_0x39c60b=0xce;}_0x5cdf2[_0x791a('0x18')](_0x39c60b);return _0x5cdf2[_0x791a('0x1d')](_0x791a('0x1e'),_0x52941d+'-'+_0x588d00+'/'+_0x5bea2e)['json'](_0x2ce2e0);}return null;};}function patchUpdates(_0x189c0d){return function(_0xcb5e66){try{jsonpatch[_0x791a('0x1f')](_0xcb5e66,_0x189c0d,!![]);}catch(_0x280f1e){return BPromise['reject'](_0x280f1e);}return _0xcb5e66[_0x791a('0x20')]();};}function saveUpdates(_0x2054c6,_0x25bae5){return function(_0x9e17b5){if(_0x9e17b5){return _0x9e17b5[_0x791a('0x21')](_0x2054c6)[_0x791a('0x22')](function(_0x2241a0){return _0x2241a0;});}return null;};}function removeEntity(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(_0xe8e452){return _0xe8e452[_0x791a('0x23')]()['then'](function(){var _0x1102c9=_0xe8e452[_0x791a('0x24')]({'plain':!![]});var _0x380329=_0x791a('0x25');return db['UserProfileResource'][_0x791a('0x23')]({'where':{'type':_0x380329,'resourceId':_0x1102c9['id']}})[_0x791a('0x22')](function(){return _0xe8e452;});})['then'](function(){_0x45a67d[_0x791a('0x18')](0xcc)[_0x791a('0x17')]();});}};}function handleEntityNotFound(_0x16dbaf,_0x4c1626){return function(_0x29194d){if(!_0x29194d){_0x16dbaf[_0x791a('0x16')](0x194);}return _0x29194d;};}function handleError(_0x2b0784,_0x395376){_0x395376=_0x395376||0x1f4;return function(_0x4f423){logger[_0x791a('0x26')](_0x4f423[_0x791a('0x27')]);if(_0x4f423[_0x791a('0x28')]){delete _0x4f423['name'];}_0x2b0784[_0x791a('0x18')](_0x395376)[_0x791a('0x29')](_0x4f423);};}exports[_0x791a('0x2a')]=function(_0x59d2c0,_0x1cdda9){var _0x5df656={},_0xc59f5e={},_0x2e4ec8={'count':0x0,'rows':[]};var _0xcde862=_[_0x791a('0x2b')](db[_0x791a('0x2c')][_0x791a('0x2d')],function(_0x15ff6e){return{'name':_0x15ff6e['fieldName'],'type':_0x15ff6e[_0x791a('0x2e')][_0x791a('0x2f')]};});_0xc59f5e[_0x791a('0x30')]=_[_0x791a('0x2b')](_0xcde862,_0x791a('0x28'));_0xc59f5e['query']=_[_0x791a('0x31')](_0x59d2c0[_0x791a('0x32')]);_0xc59f5e[_0x791a('0x33')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],_0xc59f5e['query']);_0x5df656[_0x791a('0x35')]=_[_0x791a('0x34')](_0xc59f5e[_0x791a('0x30')],qs[_0x791a('0x36')](_0x59d2c0[_0x791a('0x32')]['fields']));_0x5df656[_0x791a('0x35')]=_0x5df656['attributes'][_0x791a('0x37')]?_0x5df656['attributes']:_0xc59f5e['model'];if(!_0x59d2c0[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x5df656[_0x791a('0x3a')]=qs[_0x791a('0x3a')](_0x59d2c0[_0x791a('0x32')][_0x791a('0x3a')]);_0x5df656['offset']=qs[_0x791a('0x1a')](_0x59d2c0['query'][_0x791a('0x1a')]);}_0x5df656['order']=qs[_0x791a('0x3b')](_0x59d2c0[_0x791a('0x32')]['sort']);_0x5df656[_0x791a('0x3c')]=qs[_0x791a('0x33')](_['pick'](_0x59d2c0[_0x791a('0x32')],_0xc59f5e[_0x791a('0x33')]),_0xcde862);if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3d')]){_0x5df656[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x5df656[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0xcde862,function(_0xc0fb63){if(_0xc0fb63[_0x791a('0x2e')]!=='VIRTUAL'){var _0x15f066={};_0x15f066[_0xc0fb63[_0x791a('0x28')]]={'$like':'%'+_0x59d2c0[_0x791a('0x32')]['filter']+'%'};return _0x15f066;}})});}_0x5df656=_[_0x791a('0x3e')]({},_0x5df656,_0x59d2c0['options']);var _0x5bad7d={'where':_0x5df656['where']};return db[_0x791a('0x2c')][_0x791a('0x1c')](_0x5bad7d)['then'](function(_0x415c44){_0x2e4ec8[_0x791a('0x1c')]=_0x415c44;if(_0x59d2c0[_0x791a('0x32')][_0x791a('0x3f')]){_0x5df656['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5df656);})[_0x791a('0x22')](function(_0x216dd3){_0x2e4ec8['rows']=_0x216dd3;return _0x2e4ec8;})[_0x791a('0x22')](respondWithFilteredResult(_0x1cdda9,_0x5df656))[_0x791a('0x40')](handleError(_0x1cdda9,null));};exports[_0x791a('0x41')]=function(_0x954164,_0x508727){var _0x11263d={'raw':!![],'where':{'id':_0x954164[_0x791a('0x42')]['id']}},_0x5911db={};_0x5911db[_0x791a('0x30')]=_[_0x791a('0x31')](db[_0x791a('0x2c')][_0x791a('0x2d')]);_0x5911db['query']=_[_0x791a('0x31')](_0x954164[_0x791a('0x32')]);_0x5911db[_0x791a('0x33')]=_[_0x791a('0x34')](_0x5911db[_0x791a('0x30')],_0x5911db['query']);_0x11263d[_0x791a('0x35')]=_[_0x791a('0x34')](_0x5911db['model'],qs['fields'](_0x954164[_0x791a('0x32')][_0x791a('0x36')]));_0x11263d[_0x791a('0x35')]=_0x11263d['attributes']['length']?_0x11263d[_0x791a('0x35')]:_0x5911db[_0x791a('0x30')];if(_0x954164['query'][_0x791a('0x3f')]){_0x11263d[_0x791a('0x43')]=[{'all':!![]}];}_0x11263d=_[_0x791a('0x3e')]({},_0x11263d,_0x954164['options']);return db['VoiceMail'][_0x791a('0x44')](_0x11263d)[_0x791a('0x22')](handleEntityNotFound(_0x508727,null))[_0x791a('0x22')](respondWithResult(_0x508727,null))[_0x791a('0x40')](handleError(_0x508727,null));};exports['create']=function(_0x2d7c7d,_0x9f768a){return db[_0x791a('0x2c')][_0x791a('0x45')](_0x2d7c7d['body'],{})[_0x791a('0x22')](function(_0x19654d){var _0xe0696b=_0x2d7c7d[_0x791a('0x46')][_0x791a('0x24')]({'plain':!![]});if(!_0xe0696b)throw new Error(_0x791a('0x47'));if(_0xe0696b[_0x791a('0x48')]==='user'){var _0xdcb1b=_0x19654d[_0x791a('0x24')]({'plain':!![]});var _0x4bffa6=_0x791a('0x25');return db[_0x791a('0x49')]['find']({'where':{'name':_0x4bffa6,'userProfileId':_0xe0696b[_0x791a('0x4a')]},'raw':!![]})[_0x791a('0x22')](function(_0x12178e){if(_0x12178e&&_0x12178e[_0x791a('0x4b')]===0x0){return db[_0x791a('0x4c')]['create']({'name':_0xdcb1b['name'],'resourceId':_0xdcb1b['id'],'type':_0x12178e['name'],'sectionId':_0x12178e['id']},{})[_0x791a('0x22')](function(){return _0x19654d;});}else{return _0x19654d;}})['catch'](function(_0x4c7555){logger[_0x791a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7555);throw _0x4c7555;});}return _0x19654d;})[_0x791a('0x22')](respondWithResult(_0x9f768a,0xc9))[_0x791a('0x40')](handleError(_0x9f768a,null));};exports['update']=function(_0x5166b5,_0x3599f6){if(_0x5166b5['body']['id']){delete _0x5166b5[_0x791a('0x4d')]['id'];}return db[_0x791a('0x2c')][_0x791a('0x44')]({'where':{'id':_0x5166b5['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x3599f6,null))[_0x791a('0x22')](saveUpdates(_0x5166b5['body'],null))[_0x791a('0x22')](respondWithResult(_0x3599f6,null))[_0x791a('0x40')](handleError(_0x3599f6,null));};exports[_0x791a('0x23')]=function(_0x34d53c,_0x450ad8){return db[_0x791a('0x2c')]['find']({'where':{'id':_0x34d53c['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0x450ad8,null))['then'](removeEntity(_0x450ad8,null))[_0x791a('0x40')](handleError(_0x450ad8,null));};exports[_0x791a('0x4e')]=function(_0x18ad89,_0xf11dea,_0x3b760c){return db[_0x791a('0x2c')][_0x791a('0x4f')]({'where':{'id':_0x18ad89['params']['id']}})[_0x791a('0x22')](handleEntityNotFound(_0xf11dea,null))[_0x791a('0x22')](function(_0xc34c5b){var _0x1a4376;var _0x2d671f={},_0xe062f1={};_0xe062f1[_0x791a('0x30')]=_['keys'](db[_0x791a('0x50')]['rawAttributes']);_0xe062f1['query']=_[_0x791a('0x31')](_0x18ad89[_0x791a('0x32')]);_0xe062f1[_0x791a('0x33')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],_0xe062f1[_0x791a('0x32')]);_0x2d671f[_0x791a('0x35')]=_[_0x791a('0x34')](_0xe062f1[_0x791a('0x30')],qs[_0x791a('0x36')](_0x18ad89[_0x791a('0x32')][_0x791a('0x36')]));_0x2d671f[_0x791a('0x35')]=_0x2d671f[_0x791a('0x35')][_0x791a('0x37')]?_0x2d671f[_0x791a('0x35')]:_0xe062f1[_0x791a('0x30')];if(!_0x18ad89[_0x791a('0x32')][_0x791a('0x38')](_0x791a('0x39'))){_0x2d671f['limit']=qs[_0x791a('0x3a')](_0x18ad89[_0x791a('0x32')][_0x791a('0x3a')]);_0x2d671f[_0x791a('0x1a')]=qs[_0x791a('0x1a')](_0x18ad89['query'][_0x791a('0x1a')]);}_0x2d671f[_0x791a('0x51')]=qs[_0x791a('0x3b')](_0x18ad89[_0x791a('0x32')]['sort']);_0x2d671f[_0x791a('0x3c')]=qs['filters'](_['pick'](_0x18ad89['query'],_0xe062f1['filters']));if(_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]){_0x2d671f[_0x791a('0x3c')]=_[_0x791a('0x3e')](_0x2d671f[_0x791a('0x3c')],{'$or':_[_0x791a('0x2b')](_0x2d671f[_0x791a('0x35')],function(_0x5dca78){var _0x522cb8={};_0x522cb8[_0x5dca78]={'$like':'%'+_0x18ad89[_0x791a('0x32')][_0x791a('0x3d')]+'%'};return _0x522cb8;})});}_0x2d671f['where']=_['merge'](_0x2d671f[_0x791a('0x3c')],{'mailboxuser':_0xc34c5b[_0x791a('0x52')]});_0x2d671f=_['merge']({},_0x2d671f,_0x18ad89[_0x791a('0x53')]);return db[_0x791a('0x50')][_0x791a('0x54')](_0x2d671f)[_0x791a('0x22')](respondWithFilteredResult(_0xf11dea,_0x2d671f));})['catch'](handleError(_0xf11dea,null));}; \ No newline at end of file +var _0x1be1=['set','Content-Range','apply','reject','save','update','then','get','Voicemails','destroy','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','findOne','VoiceMailMessage','length','mailbox','findAndCountAll','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count'];(function(_0x271d7c,_0x214c70){var _0x3baa23=function(_0x80ece1){while(--_0x80ece1){_0x271d7c['push'](_0x271d7c['shift']());}};_0x3baa23(++_0x214c70);}(_0x1be1,0x192));var _0x11be=function(_0x1552a,_0x44fee3){_0x1552a=_0x1552a-0x0;var _0x17346d=_0x1be1[_0x1552a];return _0x17346d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':!![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['VoiceMail'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));};exports['getMessages']=function(_0x568f20,_0x5aa6bf,_0x1a43df){return db[_0x11be('0x2d')][_0x11be('0x51')]({'where':{'id':_0x568f20[_0x11be('0x50')]['id']}})[_0x11be('0x22')](handleEntityNotFound(_0x5aa6bf,null))[_0x11be('0x22')](function(_0xb97604){var _0x55e79d;var _0x54e52a={},_0x7c1ee5={};_0x7c1ee5[_0x11be('0x31')]=_[_0x11be('0x33')](db[_0x11be('0x52')][_0x11be('0x2e')]);_0x7c1ee5[_0x11be('0x32')]=_[_0x11be('0x33')](_0x568f20[_0x11be('0x32')]);_0x7c1ee5[_0x11be('0x34')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],_0x7c1ee5[_0x11be('0x32')]);_0x54e52a[_0x11be('0x36')]=_['intersection'](_0x7c1ee5[_0x11be('0x31')],qs[_0x11be('0x37')](_0x568f20['query']['fields']));_0x54e52a[_0x11be('0x36')]=_0x54e52a[_0x11be('0x36')][_0x11be('0x53')]?_0x54e52a[_0x11be('0x36')]:_0x7c1ee5['model'];if(!_0x568f20[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x54e52a[_0x11be('0x1a')]=qs[_0x11be('0x1a')](_0x568f20[_0x11be('0x32')][_0x11be('0x1a')]);_0x54e52a[_0x11be('0x18')]=qs[_0x11be('0x18')](_0x568f20['query']['offset']);}_0x54e52a[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x568f20['query'][_0x11be('0x3b')]);_0x54e52a[_0x11be('0x3e')]=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x568f20[_0x11be('0x32')],_0x7c1ee5[_0x11be('0x34')]));if(_0x568f20[_0x11be('0x32')]['filter']){_0x54e52a['where']=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x54e52a['attributes'],function(_0x82c02c){var _0x422696={};_0x422696[_0x82c02c]={'$like':'%'+_0x568f20[_0x11be('0x32')][_0x11be('0x3d')]+'%'};return _0x422696;})});}_0x54e52a[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x54e52a[_0x11be('0x3e')],{'mailboxuser':_0xb97604[_0x11be('0x54')]});_0x54e52a=_[_0x11be('0x3f')]({},_0x54e52a,_0x568f20[_0x11be('0x45')]);return db[_0x11be('0x52')][_0x11be('0x55')](_0x54e52a)[_0x11be('0x22')](respondWithFilteredResult(_0x5aa6bf,_0x54e52a));})[_0x11be('0x47')](handleError(_0x5aa6bf,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 9599dc8..35882ad 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 _0x26ed=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x26ed,0x193));var _0xd26e=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x26ed[_0x1b02bb];return _0x131245;};'use strict';var _=require(_0xd26e('0x0'));var util=require(_0xd26e('0x1'));var logger=require(_0xd26e('0x2'))('api');var moment=require(_0xd26e('0x3'));var BPromise=require(_0xd26e('0x4'));var rp=require(_0xd26e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26e('0x6'));var config=require(_0xd26e('0x7'));var attributes=require('./voiceMail.attributes');module[_0xd26e('0x8')]=function(_0x2acda4,_0x5052b6){return _0x2acda4[_0xd26e('0x9')](_0xd26e('0xa'),attributes,{'tableName':_0xd26e('0xb'),'paranoid':![],'indexes':[{'name':_0xd26e('0xc'),'fields':[_0xd26e('0xd'),_0xd26e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05aa=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','mailbox','context'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x05aa,0xfc));var _0xa05a=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x05aa[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xa05a('0x0'));var util=require(_0xa05a('0x1'));var logger=require(_0xa05a('0x2'))('api');var moment=require(_0xa05a('0x3'));var BPromise=require(_0xa05a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa05a('0x5'));var rimraf=require(_0xa05a('0x6'));var config=require(_0xa05a('0x7'));var attributes=require(_0xa05a('0x8'));module[_0xa05a('0x9')]=function(_0x5982fb,_0x3fed3b){return _0x5982fb[_0xa05a('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xa05a('0xb'),'fields':[_0xa05a('0xc'),_0xa05a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 24d0c5d..4f7659f 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 _0x929c=['request\x20sent','debug','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x929c,0x193));var _0xc929=function(_0x45a2c2,_0x308ce6){_0x45a2c2=_0x45a2c2-0x0;var _0x36d360=_0x929c[_0x45a2c2];return _0x36d360;};'use strict';var _=require('lodash');var util=require(_0xc929('0x0'));var moment=require(_0xc929('0x1'));var BPromise=require(_0xc929('0x2'));var rs=require(_0xc929('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc929('0x4'))['db'];var utils=require(_0xc929('0x5'));var logger=require(_0xc929('0x6'))('rpc');var config=require(_0xc929('0x7'));var jayson=require(_0xc929('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fae73,_0x2a2361,_0x4c62a5){return new BPromise(function(_0x1c734e,_0x45b713){return client[_0xc929('0x9')](_0x2fae73,_0x4c62a5)['then'](function(_0xdbdaf9){logger[_0xc929('0xa')]('VoiceMail,\x20%s,\x20%s',_0x2a2361,_0xc929('0xb'));logger[_0xc929('0xc')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x2a2361,_0xc929('0xb'),JSON[_0xc929('0xd')](_0xdbdaf9));if(_0xdbdaf9[_0xc929('0xe')]){if(_0xdbdaf9['error'][_0xc929('0xf')]===0x1f4){logger[_0xc929('0xe')]('VoiceMail,\x20%s,\x20%s',_0x2a2361,_0xdbdaf9[_0xc929('0xe')][_0xc929('0x10')]);return _0x45b713(_0xdbdaf9['error'][_0xc929('0x10')]);}logger['error'](_0xc929('0x11'),_0x2a2361,_0xdbdaf9[_0xc929('0xe')][_0xc929('0x10')]);return _0x1c734e(_0xdbdaf9[_0xc929('0xe')]['message']);}else{logger['info'](_0xc929('0x11'),_0x2a2361,_0xc929('0xb'));_0x1c734e(_0xdbdaf9['result']['message']);}})['catch'](function(_0x4c3835){logger['error'](_0xc929('0x11'),_0x2a2361,_0x4c3835);_0x45b713(_0x4c3835);});});} \ No newline at end of file +var _0x2f6a=['VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x2f6a,0x1c0));var _0xa2f6=function(_0x162478,_0x2b3a7e){_0x162478=_0x162478-0x0;var _0x3e9671=_0x2f6a[_0x162478];return _0x3e9671;};'use strict';var _=require(_0xa2f6('0x0'));var util=require(_0xa2f6('0x1'));var moment=require(_0xa2f6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2f6('0x4'));var logger=require(_0xa2f6('0x5'))(_0xa2f6('0x6'));var config=require(_0xa2f6('0x7'));var jayson=require(_0xa2f6('0x8'));var client=jayson[_0xa2f6('0x9')][_0xa2f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ea494,_0x251f7b,_0x5820ab){return new BPromise(function(_0x4d7d20,_0x389296){return client[_0xa2f6('0xb')](_0x2ea494,_0x5820ab)[_0xa2f6('0xc')](function(_0x4ad60b){logger[_0xa2f6('0xd')](_0xa2f6('0xe'),_0x251f7b,_0xa2f6('0xf'));logger['debug'](_0xa2f6('0x10'),_0x251f7b,_0xa2f6('0xf'),JSON['stringify'](_0x4ad60b));if(_0x4ad60b[_0xa2f6('0x11')]){if(_0x4ad60b['error'][_0xa2f6('0x12')]===0x1f4){logger['error'](_0xa2f6('0xe'),_0x251f7b,_0x4ad60b[_0xa2f6('0x11')][_0xa2f6('0x13')]);return _0x389296(_0x4ad60b[_0xa2f6('0x11')][_0xa2f6('0x13')]);}logger[_0xa2f6('0x11')](_0xa2f6('0xe'),_0x251f7b,_0x4ad60b[_0xa2f6('0x11')]['message']);return _0x4d7d20(_0x4ad60b['error'][_0xa2f6('0x13')]);}else{logger[_0xa2f6('0xd')](_0xa2f6('0xe'),_0x251f7b,_0xa2f6('0xf'));_0x4d7d20(_0x4ad60b[_0xa2f6('0x14')][_0xa2f6('0x13')]);}})[_0xa2f6('0x15')](function(_0x4a791b){logger['error'](_0xa2f6('0xe'),_0x251f7b,_0x4a791b);_0x389296(_0x4a791b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0a190c7..f63c4db 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 _0xddef=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','/:id','destroy','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddef,0x1cc));var _0xfdde=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0xddef[_0x35b08a];return _0x20bc1a;};'use strict';var multer=require(_0xfdde('0x0'));var util=require('util');var path=require(_0xfdde('0x1'));var timeout=require(_0xfdde('0x2'));var express=require(_0xfdde('0x3'));var router=express[_0xfdde('0x4')]();var fs_extra=require(_0xfdde('0x5'));var auth=require(_0xfdde('0x6'));var interaction=require(_0xfdde('0x7'));var config=require(_0xfdde('0x8'));var controller=require('./voiceMailMessage.controller');router[_0xfdde('0x9')]('/',auth['isAuthenticated'](),controller[_0xfdde('0xa')]);router[_0xfdde('0x9')]('/:id',auth[_0xfdde('0xb')](),controller[_0xfdde('0xc')]);router[_0xfdde('0x9')](_0xfdde('0xd'),auth[_0xfdde('0xb')](),controller[_0xfdde('0xe')]);router[_0xfdde('0xf')]('/',auth[_0xfdde('0xb')](),controller[_0xfdde('0x10')]);router[_0xfdde('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfdde('0x12')]);router[_0xfdde('0x13')](_0xfdde('0x14'),auth[_0xfdde('0xb')](),controller[_0xfdde('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9c03=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1231f9,_0x28c21e){var _0x554f28=function(_0x52cc9a){while(--_0x52cc9a){_0x1231f9['push'](_0x1231f9['shift']());}};_0x554f28(++_0x28c21e);}(_0x9c03,0x19c));var _0x39c0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9c03[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x39c0('0x0'));var path=require('path');var timeout=require(_0x39c0('0x1'));var express=require(_0x39c0('0x2'));var router=express[_0x39c0('0x3')]();var fs_extra=require(_0x39c0('0x4'));var auth=require(_0x39c0('0x5'));var interaction=require(_0x39c0('0x6'));var config=require(_0x39c0('0x7'));var controller=require(_0x39c0('0x8'));router[_0x39c0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x39c0('0xa'),auth[_0x39c0('0xb')](),controller['show']);router[_0x39c0('0x9')]('/:id/download',auth[_0x39c0('0xb')](),controller['download']);router['post']('/',auth[_0x39c0('0xb')](),controller[_0x39c0('0xc')]);router[_0x39c0('0xd')](_0x39c0('0xa'),auth[_0x39c0('0xb')](),controller[_0x39c0('0xe')]);router[_0x39c0('0xf')](_0x39c0('0xa'),auth['isAuthenticated'](),controller[_0x39c0('0x10')]);module[_0x39c0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index b56610b..fc26881 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 _0xe74b=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','VIRTUAL','getDataValue'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xe74b,0xd6));var _0xbe74=function(_0x40b32e,_0x1aa3ec){_0x40b32e=_0x40b32e-0x0;var _0xf51c48=_0xe74b[_0x40b32e];return _0xf51c48;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbe74('0x0')],'get':function(_0x505a1f){return this[_0xbe74('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xbe74('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xbe74('0x4')](_0xbe74('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbe74('0x3')],'defaultValue':''},'stamp':{'type':_0xbe74('0x6'),'defaultValue':Sequelize[_0xbe74('0x7')](_0xbe74('0x8'))}}; \ No newline at end of file +var _0xba7f=['VIRTUAL','getDataValue','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x30b29f,_0x46f91e){var _0x3e3b53=function(_0x204e7b){while(--_0x204e7b){_0x30b29f['push'](_0x30b29f['shift']());}};_0x3e3b53(++_0x46f91e);}(_0xba7f,0x1a5));var _0xfba7=function(_0x36730d,_0x36596b){_0x36730d=_0x36730d-0x0;var _0x5a10ae=_0xba7f[_0x36730d];return _0x5a10ae;};'use strict';var Sequelize=require(_0xfba7('0x0'));module[_0xfba7('0x1')]={'name':{'type':Sequelize[_0xfba7('0x2')],'get':function(_0x77aca1){return this[_0xfba7('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xfba7('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfba7('0x4')],'defaultValue':''},'stamp':{'type':_0xfba7('0x6'),'defaultValue':Sequelize[_0xfba7('0x7')](_0xfba7('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 290452b..95189c9 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 _0xc4c3=['where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','keys','rawAttributes','find','create','update','body','params','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','VoiceMailMessage','fieldName','type','key','differenceBy','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filters'];(function(_0x31b26f,_0x4c2f38){var _0x4c1816=function(_0x2b1c92){while(--_0x2b1c92){_0x31b26f['push'](_0x31b26f['shift']());}};_0x4c1816(++_0x4c2f38);}(_0xc4c3,0xcc));var _0x3c4c=function(_0x32998b,_0x204eeb){_0x32998b=_0x32998b-0x0;var _0x3463ed=_0xc4c3[_0x32998b];return _0x3463ed;};'use strict';var emlformat=require(_0x3c4c('0x0'));var rimraf=require(_0x3c4c('0x1'));var zipdir=require(_0x3c4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c4c('0x3'));var moment=require(_0x3c4c('0x4'));var BPromise=require(_0x3c4c('0x5'));var Mustache=require(_0x3c4c('0x6'));var util=require(_0x3c4c('0x7'));var path=require(_0x3c4c('0x8'));var sox=require(_0x3c4c('0x9'));var csv=require('to-csv');var ejs=require(_0x3c4c('0xa'));var fs=require('fs');var fs_extra=require(_0x3c4c('0xb'));var _=require(_0x3c4c('0xc'));var squel=require(_0x3c4c('0xd'));var crypto=require(_0x3c4c('0xe'));var jsforce=require(_0x3c4c('0xf'));var deskjs=require(_0x3c4c('0x10'));var toCsv=require(_0x3c4c('0x11'));var querystring=require('querystring');var Papa=require(_0x3c4c('0x12'));var Redis=require(_0x3c4c('0x13'));var authService=require(_0x3c4c('0x14'));var qs=require(_0x3c4c('0x15'));var as=require(_0x3c4c('0x16'));var hardwareService=require(_0x3c4c('0x17'));var logger=require(_0x3c4c('0x18'))('api');var utils=require(_0x3c4c('0x19'));var config=require(_0x3c4c('0x1a'));var licenseUtil=require(_0x3c4c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16f24e,_0x6a471c){_0x6a471c=_0x6a471c||0xcc;return function(_0x84004f){if(_0x84004f){return _0x16f24e[_0x3c4c('0x1c')](_0x6a471c);}return _0x16f24e[_0x3c4c('0x1d')](_0x6a471c)[_0x3c4c('0x1e')]();};}function respondWithResult(_0x282326,_0x35fcbc){_0x35fcbc=_0x35fcbc||0xc8;return function(_0x5a6764){if(_0x5a6764){return _0x282326['status'](_0x35fcbc)[_0x3c4c('0x1f')](_0x5a6764);}};}function respondWithFilteredResult(_0x571da,_0x21a340){return function(_0x388303){if(_0x388303){var _0x25ed25=typeof _0x21a340[_0x3c4c('0x20')]==='undefined'&&typeof _0x21a340[_0x3c4c('0x21')]===_0x3c4c('0x22');var _0x558d84=_0x388303[_0x3c4c('0x23')];var _0x53a1e6=_0x25ed25?0x0:_0x21a340[_0x3c4c('0x20')];var _0x50b6f7=_0x25ed25?_0x388303[_0x3c4c('0x23')]:_0x21a340[_0x3c4c('0x20')]+_0x21a340[_0x3c4c('0x21')];var _0x45005d;if(_0x50b6f7>=_0x558d84){_0x50b6f7=_0x558d84;_0x45005d=0xc8;}else{_0x45005d=0xce;}_0x571da[_0x3c4c('0x1d')](_0x45005d);return _0x571da[_0x3c4c('0x24')](_0x3c4c('0x25'),_0x53a1e6+'-'+_0x50b6f7+'/'+_0x558d84)[_0x3c4c('0x1f')](_0x388303);}return null;};}function patchUpdates(_0x5c28d6){return function(_0x5c059c){try{jsonpatch[_0x3c4c('0x26')](_0x5c059c,_0x5c28d6,!![]);}catch(_0x1810f5){return BPromise[_0x3c4c('0x27')](_0x1810f5);}return _0x5c059c[_0x3c4c('0x28')]();};}function saveUpdates(_0x489562,_0x93ae5c){return function(_0x309a57){if(_0x309a57){return _0x309a57['update'](_0x489562)['then'](function(_0x41d134){return _0x41d134;});}return null;};}function removeEntity(_0xc3e3ac,_0x50a367){return function(_0x1b6034){if(_0x1b6034){return _0x1b6034[_0x3c4c('0x29')]()[_0x3c4c('0x2a')](function(){_0xc3e3ac['status'](0xcc)[_0x3c4c('0x1e')]();});}};}function handleEntityNotFound(_0x231652,_0x1d2dd2){return function(_0xaa522c){if(!_0xaa522c){_0x231652[_0x3c4c('0x1c')](0x194);}return _0xaa522c;};}function handleError(_0x4de857,_0x1b89e1){_0x1b89e1=_0x1b89e1||0x1f4;return function(_0xfbf0dd){logger[_0x3c4c('0x2b')](_0xfbf0dd[_0x3c4c('0x2c')]);if(_0xfbf0dd[_0x3c4c('0x2d')]){delete _0xfbf0dd[_0x3c4c('0x2d')];}_0x4de857[_0x3c4c('0x1d')](_0x1b89e1)[_0x3c4c('0x2e')](_0xfbf0dd);};}exports['index']=function(_0x55bfc3,_0x48a722){var _0x437ec3={},_0x5ce899={},_0x57d7a6={'count':0x0,'rows':[]};var _0x52ed98=_['map'](db[_0x3c4c('0x2f')]['rawAttributes'],function(_0x2e2bfc){return{'name':_0x2e2bfc[_0x3c4c('0x30')],'type':_0x2e2bfc[_0x3c4c('0x31')][_0x3c4c('0x32')]};});_0x5ce899['model']=_[_0x3c4c('0x33')](_['map'](_0x52ed98,'name'),['name']);_0x5ce899[_0x3c4c('0x34')]=_['keys'](_0x55bfc3[_0x3c4c('0x34')]);_0x5ce899['filters']=_[_0x3c4c('0x35')](_0x5ce899[_0x3c4c('0x36')],_0x5ce899[_0x3c4c('0x34')]);_0x437ec3['attributes']=_[_0x3c4c('0x35')](_0x5ce899[_0x3c4c('0x36')],qs[_0x3c4c('0x37')](_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x37')]));_0x437ec3['attributes']=_0x437ec3[_0x3c4c('0x38')][_0x3c4c('0x39')]?_0x437ec3[_0x3c4c('0x38')]:_0x5ce899['model'];if(!_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x3a')]('nolimit')){_0x437ec3[_0x3c4c('0x21')]=qs['limit'](_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x21')]);_0x437ec3[_0x3c4c('0x20')]=qs[_0x3c4c('0x20')](_0x55bfc3[_0x3c4c('0x34')]['offset']);}_0x437ec3[_0x3c4c('0x3b')]=qs[_0x3c4c('0x3c')](_0x55bfc3[_0x3c4c('0x34')]['sort']);_0x437ec3['where']=qs['filters'](_[_0x3c4c('0x3d')](_0x55bfc3[_0x3c4c('0x34')],_0x5ce899[_0x3c4c('0x3e')]),_0x52ed98);if(_0x55bfc3[_0x3c4c('0x34')]['filter']){_0x437ec3[_0x3c4c('0x3f')]=_['merge'](_0x437ec3['where'],{'$or':_[_0x3c4c('0x40')](_0x52ed98,function(_0x4287b4){if(_0x4287b4[_0x3c4c('0x31')]!==_0x3c4c('0x41')){var _0x53c2a4={};_0x53c2a4[_0x4287b4[_0x3c4c('0x2d')]]={'$like':'%'+_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x42')]+'%'};return _0x53c2a4;}})});}_0x437ec3=_[_0x3c4c('0x43')]({},_0x437ec3,_0x55bfc3[_0x3c4c('0x44')]);var _0x287965={'where':_0x437ec3[_0x3c4c('0x3f')]};return db[_0x3c4c('0x2f')][_0x3c4c('0x23')](_0x287965)['then'](function(_0x1057ee){_0x57d7a6[_0x3c4c('0x23')]=_0x1057ee;if(_0x55bfc3[_0x3c4c('0x34')][_0x3c4c('0x45')]){_0x437ec3[_0x3c4c('0x46')]=[{'all':!![]}];}return db[_0x3c4c('0x2f')][_0x3c4c('0x47')](_0x437ec3);})[_0x3c4c('0x2a')](function(_0x3006e2){_0x57d7a6['rows']=_0x3006e2;return _0x57d7a6;})[_0x3c4c('0x2a')](respondWithFilteredResult(_0x48a722,_0x437ec3))[_0x3c4c('0x48')](handleError(_0x48a722,null));};exports['show']=function(_0x429a6e,_0x285059){var _0x1f71cf={'raw':!![],'where':{'id':_0x429a6e['params']['id']}},_0x11615c={};_0x11615c[_0x3c4c('0x36')]=_[_0x3c4c('0x49')](db['VoiceMailMessage'][_0x3c4c('0x4a')]);_0x11615c[_0x3c4c('0x34')]=_['keys'](_0x429a6e[_0x3c4c('0x34')]);_0x11615c[_0x3c4c('0x3e')]=_[_0x3c4c('0x35')](_0x11615c[_0x3c4c('0x36')],_0x11615c[_0x3c4c('0x34')]);_0x1f71cf['attributes']=_[_0x3c4c('0x35')](_0x11615c[_0x3c4c('0x36')],qs['fields'](_0x429a6e[_0x3c4c('0x34')]['fields']));_0x1f71cf[_0x3c4c('0x38')]=_0x1f71cf[_0x3c4c('0x38')][_0x3c4c('0x39')]?_0x1f71cf['attributes']:_0x11615c[_0x3c4c('0x36')];if(_0x429a6e['query'][_0x3c4c('0x45')]){_0x1f71cf[_0x3c4c('0x46')]=[{'all':!![]}];}_0x1f71cf=_[_0x3c4c('0x43')]({},_0x1f71cf,_0x429a6e['options']);return db['VoiceMailMessage'][_0x3c4c('0x4b')](_0x1f71cf)[_0x3c4c('0x2a')](handleEntityNotFound(_0x285059,null))[_0x3c4c('0x2a')](respondWithResult(_0x285059,null))[_0x3c4c('0x48')](handleError(_0x285059,null));};exports[_0x3c4c('0x4c')]=function(_0x4f61a4,_0x51a7e6){return db['VoiceMailMessage'][_0x3c4c('0x4c')](_0x4f61a4['body'],{})[_0x3c4c('0x2a')](respondWithResult(_0x51a7e6,0xc9))[_0x3c4c('0x48')](handleError(_0x51a7e6,null));};exports[_0x3c4c('0x4d')]=function(_0x324dbd,_0x20637f){if(_0x324dbd[_0x3c4c('0x4e')]['id']){delete _0x324dbd['body']['id'];}return db[_0x3c4c('0x2f')]['find']({'where':{'id':_0x324dbd[_0x3c4c('0x4f')]['id']}})[_0x3c4c('0x2a')](handleEntityNotFound(_0x20637f,null))[_0x3c4c('0x2a')](saveUpdates(_0x324dbd['body'],null))[_0x3c4c('0x2a')](respondWithResult(_0x20637f,null))[_0x3c4c('0x48')](handleError(_0x20637f,null));};exports[_0x3c4c('0x29')]=function(_0x4cb527,_0x58d882){return db[_0x3c4c('0x2f')][_0x3c4c('0x4b')]({'where':{'id':_0x4cb527['params']['id']}})[_0x3c4c('0x2a')](handleEntityNotFound(_0x58d882,null))[_0x3c4c('0x2a')](removeEntity(_0x58d882,null))['catch'](handleError(_0x58d882,null));};exports[_0x3c4c('0x50')]=function(_0x213acd,_0x3d257e,_0x33de5d){return db[_0x3c4c('0x2f')][_0x3c4c('0x4b')]({'where':{'id':_0x213acd[_0x3c4c('0x4f')]['id']},'attributes':['id',_0x3c4c('0x51'),_0x3c4c('0x52')]})[_0x3c4c('0x2a')](handleEntityNotFound(_0x3d257e,null))['then'](function(_0x5b76bb){if(_0x5b76bb){if(!_0x5b76bb['recording']){throw new db[(_0x3c4c('0x53'))][(_0x3c4c('0x54'))]('VoiceMailMessage\x20not\x20found');}var _0x43af54={'Content-Type':_0x3c4c('0x55'),'Content-Disposition':_0x3c4c('0x56')};if(_0x5b76bb[_0x3c4c('0x52')]){_0x43af54[_0x3c4c('0x57')]=_0x3c4c('0x58')+_0x5b76bb['msg_id']+'.wav\x22';}_0x3d257e['set'](_0x43af54);return _0x3d257e[_0x3c4c('0x2e')](new Buffer(_0x5b76bb['recording']));}})[_0x3c4c('0x48')](handleError(_0x3d257e,null));}; \ No newline at end of file +var _0x1554=['params','length','create','body','find','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoiceMailMessage','then','includeAll','include','findAll','rows','catch','show'];(function(_0x58b643,_0x2122c4){var _0xdc1997=function(_0x26c44f){while(--_0x26c44f){_0x58b643['push'](_0x58b643['shift']());}};_0xdc1997(++_0x2122c4);}(_0x1554,0x66));var _0x4155=function(_0x12c944,_0x2dec14){_0x12c944=_0x12c944-0x0;var _0x4b0a02=_0x1554[_0x12c944];return _0x4b0a02;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4155('0x0'));var jsonpatch=require(_0x4155('0x1'));var rp=require(_0x4155('0x2'));var moment=require(_0x4155('0x3'));var BPromise=require(_0x4155('0x4'));var Mustache=require(_0x4155('0x5'));var util=require(_0x4155('0x6'));var path=require(_0x4155('0x7'));var sox=require(_0x4155('0x8'));var csv=require(_0x4155('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4155('0xa'));var _=require('lodash');var squel=require(_0x4155('0xb'));var crypto=require(_0x4155('0xc'));var jsforce=require(_0x4155('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4155('0x9'));var querystring=require(_0x4155('0xe'));var Papa=require(_0x4155('0xf'));var Redis=require(_0x4155('0x10'));var authService=require(_0x4155('0x11'));var qs=require(_0x4155('0x12'));var as=require(_0x4155('0x13'));var hardwareService=require(_0x4155('0x14'));var logger=require('../../config/logger')(_0x4155('0x15'));var utils=require(_0x4155('0x16'));var config=require(_0x4155('0x17'));var licenseUtil=require(_0x4155('0x18'));var db=require(_0x4155('0x19'))['db'];function respondWithStatusCode(_0x2b4dab,_0x94fee5){_0x94fee5=_0x94fee5||0xcc;return function(_0x1998e7){if(_0x1998e7){return _0x2b4dab[_0x4155('0x1a')](_0x94fee5);}return _0x2b4dab[_0x4155('0x1b')](_0x94fee5)[_0x4155('0x1c')]();};}function respondWithResult(_0x53346f,_0x4f6926){_0x4f6926=_0x4f6926||0xc8;return function(_0x52b526){if(_0x52b526){return _0x53346f[_0x4155('0x1b')](_0x4f6926)['json'](_0x52b526);}};}function respondWithFilteredResult(_0x2cd297,_0x36de53){return function(_0x1fab26){if(_0x1fab26){var _0x42e04a=typeof _0x36de53[_0x4155('0x1d')]===_0x4155('0x1e')&&typeof _0x36de53[_0x4155('0x1f')]===_0x4155('0x1e');var _0x169d98=_0x1fab26[_0x4155('0x20')];var _0x445872=_0x42e04a?0x0:_0x36de53[_0x4155('0x1d')];var _0x77f46c=_0x42e04a?_0x1fab26[_0x4155('0x20')]:_0x36de53[_0x4155('0x1d')]+_0x36de53[_0x4155('0x1f')];var _0x35b194;if(_0x77f46c>=_0x169d98){_0x77f46c=_0x169d98;_0x35b194=0xc8;}else{_0x35b194=0xce;}_0x2cd297[_0x4155('0x1b')](_0x35b194);return _0x2cd297['set']('Content-Range',_0x445872+'-'+_0x77f46c+'/'+_0x169d98)[_0x4155('0x21')](_0x1fab26);}return null;};}function patchUpdates(_0x2b91f0){return function(_0x8082e1){try{jsonpatch[_0x4155('0x22')](_0x8082e1,_0x2b91f0,!![]);}catch(_0x4276d8){return BPromise['reject'](_0x4276d8);}return _0x8082e1[_0x4155('0x23')]();};}function saveUpdates(_0xb9e11b,_0x44091){return function(_0x3b00dd){if(_0x3b00dd){return _0x3b00dd[_0x4155('0x24')](_0xb9e11b)['then'](function(_0x30007d){return _0x30007d;});}return null;};}function removeEntity(_0x5bcede,_0x1e9ef0){return function(_0x58ccfb){if(_0x58ccfb){return _0x58ccfb[_0x4155('0x25')]()['then'](function(){_0x5bcede[_0x4155('0x1b')](0xcc)[_0x4155('0x1c')]();});}};}function handleEntityNotFound(_0x3593d9,_0x5e22f0){return function(_0x4af5a1){if(!_0x4af5a1){_0x3593d9[_0x4155('0x1a')](0x194);}return _0x4af5a1;};}function handleError(_0x2633a2,_0x784a6e){_0x784a6e=_0x784a6e||0x1f4;return function(_0x40560b){logger[_0x4155('0x26')](_0x40560b[_0x4155('0x27')]);if(_0x40560b[_0x4155('0x28')]){delete _0x40560b['name'];}_0x2633a2['status'](_0x784a6e)['send'](_0x40560b);};}exports[_0x4155('0x29')]=function(_0x5b5536,_0x4a742c){var _0x5b14dd={},_0x443170={},_0x17b5b7={'count':0x0,'rows':[]};var _0x4f1871=_[_0x4155('0x2a')](db['VoiceMailMessage'][_0x4155('0x2b')],function(_0x31b3a4){return{'name':_0x31b3a4[_0x4155('0x2c')],'type':_0x31b3a4[_0x4155('0x2d')][_0x4155('0x2e')]};});_0x443170['model']=_[_0x4155('0x2f')](_[_0x4155('0x2a')](_0x4f1871,_0x4155('0x28')),[_0x4155('0x28')]);_0x443170[_0x4155('0x30')]=_[_0x4155('0x31')](_0x5b5536['query']);_0x443170[_0x4155('0x32')]=_[_0x4155('0x33')](_0x443170[_0x4155('0x34')],_0x443170['query']);_0x5b14dd[_0x4155('0x35')]=_[_0x4155('0x33')](_0x443170[_0x4155('0x34')],qs['fields'](_0x5b5536[_0x4155('0x30')][_0x4155('0x36')]));_0x5b14dd[_0x4155('0x35')]=_0x5b14dd['attributes']['length']?_0x5b14dd[_0x4155('0x35')]:_0x443170[_0x4155('0x34')];if(!_0x5b5536[_0x4155('0x30')][_0x4155('0x37')](_0x4155('0x38'))){_0x5b14dd[_0x4155('0x1f')]=qs[_0x4155('0x1f')](_0x5b5536[_0x4155('0x30')][_0x4155('0x1f')]);_0x5b14dd[_0x4155('0x1d')]=qs[_0x4155('0x1d')](_0x5b5536['query'][_0x4155('0x1d')]);}_0x5b14dd['order']=qs[_0x4155('0x39')](_0x5b5536['query']['sort']);_0x5b14dd[_0x4155('0x3a')]=qs['filters'](_['pick'](_0x5b5536[_0x4155('0x30')],_0x443170[_0x4155('0x32')]),_0x4f1871);if(_0x5b5536['query'][_0x4155('0x3b')]){_0x5b14dd[_0x4155('0x3a')]=_[_0x4155('0x3c')](_0x5b14dd[_0x4155('0x3a')],{'$or':_[_0x4155('0x2a')](_0x4f1871,function(_0x4d3972){if(_0x4d3972[_0x4155('0x2d')]!=='VIRTUAL'){var _0x58cbef={};_0x58cbef[_0x4d3972[_0x4155('0x28')]]={'$like':'%'+_0x5b5536[_0x4155('0x30')][_0x4155('0x3b')]+'%'};return _0x58cbef;}})});}_0x5b14dd=_[_0x4155('0x3c')]({},_0x5b14dd,_0x5b5536[_0x4155('0x3d')]);var _0x587985={'where':_0x5b14dd['where']};return db[_0x4155('0x3e')]['count'](_0x587985)[_0x4155('0x3f')](function(_0xfb4d17){_0x17b5b7[_0x4155('0x20')]=_0xfb4d17;if(_0x5b5536[_0x4155('0x30')][_0x4155('0x40')]){_0x5b14dd[_0x4155('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x4155('0x42')](_0x5b14dd);})[_0x4155('0x3f')](function(_0x1696b7){_0x17b5b7[_0x4155('0x43')]=_0x1696b7;return _0x17b5b7;})['then'](respondWithFilteredResult(_0x4a742c,_0x5b14dd))[_0x4155('0x44')](handleError(_0x4a742c,null));};exports[_0x4155('0x45')]=function(_0x40ab54,_0x2ce4d1){var _0x5817b7={'raw':!![],'where':{'id':_0x40ab54[_0x4155('0x46')]['id']}},_0x3319f6={};_0x3319f6['model']=_[_0x4155('0x31')](db['VoiceMailMessage'][_0x4155('0x2b')]);_0x3319f6[_0x4155('0x30')]=_['keys'](_0x40ab54[_0x4155('0x30')]);_0x3319f6['filters']=_['intersection'](_0x3319f6[_0x4155('0x34')],_0x3319f6['query']);_0x5817b7[_0x4155('0x35')]=_[_0x4155('0x33')](_0x3319f6[_0x4155('0x34')],qs[_0x4155('0x36')](_0x40ab54[_0x4155('0x30')]['fields']));_0x5817b7['attributes']=_0x5817b7['attributes'][_0x4155('0x47')]?_0x5817b7[_0x4155('0x35')]:_0x3319f6[_0x4155('0x34')];if(_0x40ab54[_0x4155('0x30')]['includeAll']){_0x5817b7[_0x4155('0x41')]=[{'all':!![]}];}_0x5817b7=_[_0x4155('0x3c')]({},_0x5817b7,_0x40ab54[_0x4155('0x3d')]);return db[_0x4155('0x3e')]['find'](_0x5817b7)[_0x4155('0x3f')](handleEntityNotFound(_0x2ce4d1,null))[_0x4155('0x3f')](respondWithResult(_0x2ce4d1,null))['catch'](handleError(_0x2ce4d1,null));};exports[_0x4155('0x48')]=function(_0x34b3d9,_0x294042){return db['VoiceMailMessage'][_0x4155('0x48')](_0x34b3d9['body'],{})['then'](respondWithResult(_0x294042,0xc9))[_0x4155('0x44')](handleError(_0x294042,null));};exports[_0x4155('0x24')]=function(_0x185c15,_0x453f14){if(_0x185c15[_0x4155('0x49')]['id']){delete _0x185c15[_0x4155('0x49')]['id'];}return db[_0x4155('0x3e')]['find']({'where':{'id':_0x185c15[_0x4155('0x46')]['id']}})[_0x4155('0x3f')](handleEntityNotFound(_0x453f14,null))[_0x4155('0x3f')](saveUpdates(_0x185c15['body'],null))[_0x4155('0x3f')](respondWithResult(_0x453f14,null))[_0x4155('0x44')](handleError(_0x453f14,null));};exports['destroy']=function(_0x3bc7e6,_0x416bae){return db[_0x4155('0x3e')][_0x4155('0x4a')]({'where':{'id':_0x3bc7e6['params']['id']}})[_0x4155('0x3f')](handleEntityNotFound(_0x416bae,null))[_0x4155('0x3f')](removeEntity(_0x416bae,null))['catch'](handleError(_0x416bae,null));};exports['download']=function(_0x27ddce,_0x2bcf17,_0x15c638){return db[_0x4155('0x3e')]['find']({'where':{'id':_0x27ddce[_0x4155('0x46')]['id']},'attributes':['id',_0x4155('0x4b'),_0x4155('0x4c')]})[_0x4155('0x3f')](handleEntityNotFound(_0x2bcf17,null))['then'](function(_0x2561e9){if(_0x2561e9){if(!_0x2561e9[_0x4155('0x4b')]){throw new db[(_0x4155('0x4d'))][(_0x4155('0x4e'))](_0x4155('0x4f'));}var _0x138f4b={'Content-Type':_0x4155('0x50'),'Content-Disposition':_0x4155('0x51')};if(_0x2561e9['msg_id']){_0x138f4b[_0x4155('0x52')]=_0x4155('0x53')+_0x2561e9[_0x4155('0x4c')]+_0x4155('0x54');}_0x2bcf17['set'](_0x138f4b);return _0x2bcf17[_0x4155('0x55')](new Buffer(_0x2561e9[_0x4155('0x4b')]));}})[_0x4155('0x44')](handleError(_0x2bcf17,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 4e5b584..fc96501 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 _0xdc88=['path','rimraf','../../config/environment','define','VoiceMailMessage','dir','../../config/logger','api','bluebird','request-promise'];(function(_0x1e655e,_0x1e9e21){var _0x10b355=function(_0xa8a8fa){while(--_0xa8a8fa){_0x1e655e['push'](_0x1e655e['shift']());}};_0x10b355(++_0x1e9e21);}(_0xdc88,0xa6));var _0x8dc8=function(_0x2a60e4,_0x496d64){_0x2a60e4=_0x2a60e4-0x0;var _0x4a433a=_0xdc88[_0x2a60e4];return _0x4a433a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8dc8('0x0'))(_0x8dc8('0x1'));var moment=require('moment');var BPromise=require(_0x8dc8('0x2'));var rp=require(_0x8dc8('0x3'));var fs=require('fs');var path=require(_0x8dc8('0x4'));var rimraf=require(_0x8dc8('0x5'));var config=require(_0x8dc8('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0xc28fd0,_0x1356bd){return _0xc28fd0[_0x8dc8('0x7')](_0x8dc8('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x8dc8('0x9'),'fields':[_0x8dc8('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc758=['lodash','moment','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','dir'];(function(_0x9b8773,_0x273003){var _0x2778f8=function(_0x1ed893){while(--_0x1ed893){_0x9b8773['push'](_0x9b8773['shift']());}};_0x2778f8(++_0x273003);}(_0xc758,0x186));var _0x8c75=function(_0x18f4fd,_0xed3630){_0x18f4fd=_0x18f4fd-0x0;var _0x2aab2b=_0xc758[_0x18f4fd];return _0x2aab2b;};'use strict';var _=require(_0x8c75('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8c75('0x1'));var BPromise=require('bluebird');var rp=require(_0x8c75('0x2'));var fs=require('fs');var path=require(_0x8c75('0x3'));var rimraf=require(_0x8c75('0x4'));var config=require(_0x8c75('0x5'));var attributes=require(_0x8c75('0x6'));module[_0x8c75('0x7')]=function(_0x470466,_0x6868a1){return _0x470466[_0x8c75('0x8')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x8c75('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6e789a1..9d1f7f1 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 _0xc0ba=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1e2e0a,_0xe026c2){var _0x51980a=function(_0x54bb2d){while(--_0x54bb2d){_0x1e2e0a['push'](_0x1e2e0a['shift']());}};_0x51980a(++_0xe026c2);}(_0xc0ba,0x18c));var _0xac0b=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xc0ba[_0x36665f];return _0x481d25;};'use strict';var _=require(_0xac0b('0x0'));var util=require(_0xac0b('0x1'));var moment=require(_0xac0b('0x2'));var BPromise=require(_0xac0b('0x3'));var rs=require(_0xac0b('0x4'));var fs=require('fs');var Redis=require(_0xac0b('0x5'));var db=require(_0xac0b('0x6'))['db'];var utils=require(_0xac0b('0x7'));var logger=require(_0xac0b('0x8'))(_0xac0b('0x9'));var config=require('../../config/environment');var jayson=require(_0xac0b('0xa'));var client=jayson[_0xac0b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9ee9dd,_0x314e01,_0x588c45){return new BPromise(function(_0x453302,_0x555554){return client[_0xac0b('0xc')](_0x9ee9dd,_0x588c45)[_0xac0b('0xd')](function(_0x5f48e3){logger[_0xac0b('0xe')](_0xac0b('0xf'),_0x314e01,_0xac0b('0x10'));logger[_0xac0b('0x11')](_0xac0b('0x12'),_0x314e01,_0xac0b('0x10'),JSON[_0xac0b('0x13')](_0x5f48e3));if(_0x5f48e3[_0xac0b('0x14')]){if(_0x5f48e3['error'][_0xac0b('0x15')]===0x1f4){logger[_0xac0b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0x5f48e3[_0xac0b('0x14')]['message']);return _0x555554(_0x5f48e3['error'][_0xac0b('0x16')]);}logger['error'](_0xac0b('0xf'),_0x314e01,_0x5f48e3[_0xac0b('0x14')][_0xac0b('0x16')]);return _0x453302(_0x5f48e3[_0xac0b('0x14')]['message']);}else{logger[_0xac0b('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0xac0b('0x10'));_0x453302(_0x5f48e3['result'][_0xac0b('0x16')]);}})[_0xac0b('0x17')](function(_0x2be3ba){logger[_0xac0b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x314e01,_0x2be3ba);_0x555554(_0x2be3ba);});});} \ No newline at end of file +var _0x33f0=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment'];(function(_0x3e2ea2,_0x12b2b8){var _0x1cac90=function(_0x11e5f5){while(--_0x11e5f5){_0x3e2ea2['push'](_0x3e2ea2['shift']());}};_0x1cac90(++_0x12b2b8);}(_0x33f0,0x131));var _0x033f=function(_0x2eadf8,_0x19e788){_0x2eadf8=_0x2eadf8-0x0;var _0xddce42=_0x33f0[_0x2eadf8];return _0xddce42;};'use strict';var _=require(_0x033f('0x0'));var util=require(_0x033f('0x1'));var moment=require(_0x033f('0x2'));var BPromise=require('bluebird');var rs=require(_0x033f('0x3'));var fs=require('fs');var Redis=require(_0x033f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x033f('0x5'));var logger=require(_0x033f('0x6'))(_0x033f('0x7'));var config=require(_0x033f('0x8'));var jayson=require(_0x033f('0x9'));var client=jayson[_0x033f('0xa')][_0x033f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x929ac7,_0x93345,_0x4ed8bc){return new BPromise(function(_0x3fdcd4,_0x5799d8){return client[_0x033f('0xc')](_0x929ac7,_0x4ed8bc)[_0x033f('0xd')](function(_0x16e2da){logger[_0x033f('0xe')](_0x033f('0xf'),_0x93345,_0x033f('0x10'));logger['debug'](_0x033f('0x11'),_0x93345,'request\x20sent',JSON[_0x033f('0x12')](_0x16e2da));if(_0x16e2da[_0x033f('0x13')]){if(_0x16e2da['error'][_0x033f('0x14')]===0x1f4){logger[_0x033f('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x93345,_0x16e2da[_0x033f('0x13')][_0x033f('0x15')]);return _0x5799d8(_0x16e2da[_0x033f('0x13')][_0x033f('0x15')]);}logger[_0x033f('0x13')](_0x033f('0xf'),_0x93345,_0x16e2da[_0x033f('0x13')][_0x033f('0x15')]);return _0x3fdcd4(_0x16e2da['error'][_0x033f('0x15')]);}else{logger['info'](_0x033f('0xf'),_0x93345,'request\x20sent');_0x3fdcd4(_0x16e2da['result'][_0x033f('0x15')]);}})['catch'](function(_0x51f6d6){logger[_0x033f('0x13')](_0x033f('0xf'),_0x93345,_0x51f6d6);_0x5799d8(_0x51f6d6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1b7344b..658e49d 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 _0x7ce0=['put','update','delete','/:id','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','getSounds','post','create','/:id/sounds','addSound'];(function(_0x10b65d,_0x2015f1){var _0x2ed8ba=function(_0x20ee23){while(--_0x20ee23){_0x10b65d['push'](_0x10b65d['shift']());}};_0x2ed8ba(++_0x2015f1);}(_0x7ce0,0x1ca));var _0x07ce=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x7ce0[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x07ce('0x0'));var util=require(_0x07ce('0x1'));var path=require(_0x07ce('0x2'));var timeout=require('connect-timeout');var express=require(_0x07ce('0x3'));var router=express[_0x07ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x07ce('0x5'));var interaction=require(_0x07ce('0x6'));var config=require('../../config/environment');var controller=require(_0x07ce('0x7'));router[_0x07ce('0x8')]('/',auth[_0x07ce('0x9')](),controller[_0x07ce('0xa')]);router[_0x07ce('0x8')]('/:id',auth[_0x07ce('0x9')](),controller[_0x07ce('0xb')]);router[_0x07ce('0x8')]('/:id/sounds',auth[_0x07ce('0x9')](),controller[_0x07ce('0xc')]);router[_0x07ce('0xd')]('/',auth[_0x07ce('0x9')](),controller[_0x07ce('0xe')]);router[_0x07ce('0xd')](_0x07ce('0xf'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x10')]);router[_0x07ce('0x11')]('/:id',auth[_0x07ce('0x9')](),controller[_0x07ce('0x12')]);router[_0x07ce('0x13')](_0x07ce('0x14'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x15')]);router['delete'](_0x07ce('0x16'),auth[_0x07ce('0x9')](),controller[_0x07ce('0x17')]);module[_0x07ce('0x18')]=router; \ No newline at end of file +var _0xdffc=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','/:id','getSounds','post','/:id/sounds','addSound'];(function(_0x492b57,_0x40f6ad){var _0xb13cc1=function(_0x1f9ea2){while(--_0x1f9ea2){_0x492b57['push'](_0x492b57['shift']());}};_0xb13cc1(++_0x40f6ad);}(_0xdffc,0xee));var _0xcdff=function(_0x238c4f,_0x546b00){_0x238c4f=_0x238c4f-0x0;var _0x4af0b6=_0xdffc[_0x238c4f];return _0x4af0b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcdff('0x0'));var timeout=require(_0xcdff('0x1'));var express=require(_0xcdff('0x2'));var router=express[_0xcdff('0x3')]();var fs_extra=require(_0xcdff('0x4'));var auth=require(_0xcdff('0x5'));var interaction=require(_0xcdff('0x6'));var config=require('../../config/environment');var controller=require(_0xcdff('0x7'));router['get']('/',auth[_0xcdff('0x8')](),controller['index']);router['get'](_0xcdff('0x9'),auth[_0xcdff('0x8')](),controller['show']);router['get']('/:id/sounds',auth[_0xcdff('0x8')](),controller[_0xcdff('0xa')]);router[_0xcdff('0xb')]('/',auth[_0xcdff('0x8')](),controller['create']);router[_0xcdff('0xb')](_0xcdff('0xc'),auth[_0xcdff('0x8')](),controller[_0xcdff('0xd')]);router[_0xcdff('0xe')](_0xcdff('0x9'),auth[_0xcdff('0x8')](),controller[_0xcdff('0xf')]);router['delete'](_0xcdff('0x9'),auth['isAuthenticated'](),controller[_0xcdff('0x10')]);router[_0xcdff('0x11')](_0xcdff('0x12'),auth[_0xcdff('0x8')](),controller[_0xcdff('0x13')]);module[_0xcdff('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b3a0227..877fdc5 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 _0x3f38=['TIMESTAMP','BOOLEAN','exports','STRING','name','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3f38,0x86));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x83f3('0x0')]={'name':{'type':Sequelize[_0x83f3('0x1')],'allowNull':![],'unique':_0x83f3('0x2')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x83f3('0x3'),_0x83f3('0x4'),_0x83f3('0x5'),_0x83f3('0x6')),'allowNull':!![],'defaultValue':_0x83f3('0x7')},'directory':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x83f3('0x8')},'format':{'type':Sequelize[_0x83f3('0x1')],'allowNull':!![]},'stamp':{'type':_0x83f3('0x9')},'defaultEntry':{'type':Sequelize[_0x83f3('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x469a=['alpha','TIMESTAMP','sequelize','exports','STRING','name','custom','files','quietmp3','mp3'];(function(_0x149222,_0xcad111){var _0x2fa1e6=function(_0x1b6dd1){while(--_0x1b6dd1){_0x149222['push'](_0x149222['shift']());}};_0x2fa1e6(++_0xcad111);}(_0x469a,0x1d8));var _0xa469=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0x469a[_0x3a3b9e];return _0x148103;};'use strict';var Sequelize=require(_0xa469('0x0'));module[_0xa469('0x1')]={'name':{'type':Sequelize[_0xa469('0x2')],'allowNull':![],'unique':_0xa469('0x3')},'mode':{'type':Sequelize['ENUM'](_0xa469('0x4'),_0xa469('0x5'),'mp3nb','quietmp3nb',_0xa469('0x6'),_0xa469('0x7')),'allowNull':!![],'defaultValue':_0xa469('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa469('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa469('0x2')],'allowNull':!![],'defaultValue':_0xa469('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa469('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7499cac..86c3425 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 _0x1575=['mkdirSync','directory','0777','user','role','autoAssociation','error','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','root','symlinkSync','removeSound','id2','getSounds','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','VoiceMusicOnHold','include','findAll','rows','catch','params','fields','options','find','body','create','sequelize','transaction','files','join'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x1575,0x1da));var _0x5157=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x1575[_0x2532a6];return _0x1d6b92;};'use strict';var emlformat=require(_0x5157('0x0'));var rimraf=require(_0x5157('0x1'));var zipdir=require(_0x5157('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5157('0x3'));var moment=require(_0x5157('0x4'));var BPromise=require(_0x5157('0x5'));var Mustache=require('mustache');var util=require(_0x5157('0x6'));var path=require(_0x5157('0x7'));var sox=require(_0x5157('0x8'));var csv=require(_0x5157('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5157('0xa'));var _=require(_0x5157('0xb'));var squel=require(_0x5157('0xc'));var crypto=require(_0x5157('0xd'));var jsforce=require(_0x5157('0xe'));var deskjs=require(_0x5157('0xf'));var toCsv=require(_0x5157('0x9'));var querystring=require('querystring');var Papa=require(_0x5157('0x10'));var Redis=require('ioredis');var authService=require(_0x5157('0x11'));var qs=require(_0x5157('0x12'));var as=require(_0x5157('0x13'));var hardwareService=require(_0x5157('0x14'));var logger=require('../../config/logger')(_0x5157('0x15'));var utils=require(_0x5157('0x16'));var config=require(_0x5157('0x17'));var licenseUtil=require(_0x5157('0x18'));var db=require(_0x5157('0x19'))['db'];function respondWithStatusCode(_0x9f4c8a,_0x5565b2){_0x5565b2=_0x5565b2||0xcc;return function(_0x4d15a0){if(_0x4d15a0){return _0x9f4c8a[_0x5157('0x1a')](_0x5565b2);}return _0x9f4c8a[_0x5157('0x1b')](_0x5565b2)[_0x5157('0x1c')]();};}function respondWithResult(_0x1c0b66,_0x3f8efc){_0x3f8efc=_0x3f8efc||0xc8;return function(_0x3a6f90){if(_0x3a6f90){return _0x1c0b66[_0x5157('0x1b')](_0x3f8efc)['json'](_0x3a6f90);}};}function respondWithFilteredResult(_0x5402a1,_0x5580d1){return function(_0x3153d2){if(_0x3153d2){var _0x4632de=typeof _0x5580d1[_0x5157('0x1d')]===_0x5157('0x1e')&&typeof _0x5580d1[_0x5157('0x1f')]===_0x5157('0x1e');var _0x4e6aa5=_0x3153d2[_0x5157('0x20')];var _0x513044=_0x4632de?0x0:_0x5580d1[_0x5157('0x1d')];var _0x216e84=_0x4632de?_0x3153d2[_0x5157('0x20')]:_0x5580d1[_0x5157('0x1d')]+_0x5580d1[_0x5157('0x1f')];var _0x3e28ce;if(_0x216e84>=_0x4e6aa5){_0x216e84=_0x4e6aa5;_0x3e28ce=0xc8;}else{_0x3e28ce=0xce;}_0x5402a1['status'](_0x3e28ce);return _0x5402a1[_0x5157('0x21')](_0x5157('0x22'),_0x513044+'-'+_0x216e84+'/'+_0x4e6aa5)[_0x5157('0x23')](_0x3153d2);}return null;};}function patchUpdates(_0x11e68c){return function(_0x2a45ba){try{jsonpatch[_0x5157('0x24')](_0x2a45ba,_0x11e68c,!![]);}catch(_0x2b2463){return BPromise['reject'](_0x2b2463);}return _0x2a45ba[_0x5157('0x25')]();};}function saveUpdates(_0x42a474,_0x27a65d){return function(_0x2c83ca){if(_0x2c83ca){return _0x2c83ca[_0x5157('0x26')](_0x42a474)['then'](function(_0x1c81ae){return _0x1c81ae;});}return null;};}function removeEntity(_0x2a6901,_0x293f53){return function(_0x1fa8cf){if(_0x1fa8cf){return _0x1fa8cf[_0x5157('0x27')]()[_0x5157('0x28')](function(){var _0x13ae1b=_0x1fa8cf[_0x5157('0x29')]({'plain':!![]});var _0x551caf=_0x5157('0x2a');return db[_0x5157('0x2b')][_0x5157('0x27')]({'where':{'type':_0x551caf,'resourceId':_0x13ae1b['id']}})[_0x5157('0x28')](function(){return _0x1fa8cf;});})['then'](function(){_0x2a6901[_0x5157('0x1b')](0xcc)[_0x5157('0x1c')]();});}};}function handleEntityNotFound(_0x40f7d7,_0x4d79fc){return function(_0x595ef0){if(!_0x595ef0){_0x40f7d7['sendStatus'](0x194);}return _0x595ef0;};}function handleError(_0x717eb7,_0x5d8436){_0x5d8436=_0x5d8436||0x1f4;return function(_0x424d27){logger['error'](_0x424d27[_0x5157('0x2c')]);if(_0x424d27[_0x5157('0x2d')]){delete _0x424d27[_0x5157('0x2d')];}_0x717eb7[_0x5157('0x1b')](_0x5d8436)[_0x5157('0x2e')](_0x424d27);};}exports[_0x5157('0x2f')]=function(_0x58a962,_0x5da464){var _0x5110f0={},_0x4aabeb={},_0x3d435c={'count':0x0,'rows':[]};var _0x66178d=_[_0x5157('0x30')](db['VoiceMusicOnHold'][_0x5157('0x31')],function(_0x25de4e){return{'name':_0x25de4e['fieldName'],'type':_0x25de4e[_0x5157('0x32')][_0x5157('0x33')]};});_0x4aabeb[_0x5157('0x34')]=_[_0x5157('0x30')](_0x66178d,'name');_0x4aabeb[_0x5157('0x35')]=_[_0x5157('0x36')](_0x58a962['query']);_0x4aabeb[_0x5157('0x37')]=_[_0x5157('0x38')](_0x4aabeb[_0x5157('0x34')],_0x4aabeb['query']);_0x5110f0[_0x5157('0x39')]=_[_0x5157('0x38')](_0x4aabeb[_0x5157('0x34')],qs['fields'](_0x58a962['query']['fields']));_0x5110f0[_0x5157('0x39')]=_0x5110f0['attributes'][_0x5157('0x3a')]?_0x5110f0[_0x5157('0x39')]:_0x4aabeb[_0x5157('0x34')];if(!_0x58a962[_0x5157('0x35')]['hasOwnProperty']('nolimit')){_0x5110f0['limit']=qs[_0x5157('0x1f')](_0x58a962['query'][_0x5157('0x1f')]);_0x5110f0[_0x5157('0x1d')]=qs[_0x5157('0x1d')](_0x58a962['query']['offset']);}_0x5110f0[_0x5157('0x3b')]=qs[_0x5157('0x3c')](_0x58a962[_0x5157('0x35')][_0x5157('0x3c')]);delete _0x58a962['query']['sort'];_0x5110f0[_0x5157('0x3d')]=qs[_0x5157('0x37')](_[_0x5157('0x3e')](_0x58a962[_0x5157('0x35')],_0x4aabeb[_0x5157('0x37')]),_0x66178d);if(_0x58a962[_0x5157('0x35')][_0x5157('0x3f')]){_0x5110f0[_0x5157('0x3d')]=_['merge'](_0x5110f0[_0x5157('0x3d')],{'$or':_[_0x5157('0x30')](_0x66178d,function(_0x5b0149){if(_0x5b0149[_0x5157('0x32')]!==_0x5157('0x40')){var _0x341e1b={};_0x341e1b[_0x5b0149['name']]={'$like':'%'+_0x58a962[_0x5157('0x35')][_0x5157('0x3f')]+'%'};return _0x341e1b;}})});}_0x5110f0=_[_0x5157('0x41')]({},_0x5110f0,_0x58a962['options']);var _0x3d12a0={'where':_0x5110f0[_0x5157('0x3d')]};return db[_0x5157('0x42')][_0x5157('0x20')](_0x3d12a0)[_0x5157('0x28')](function(_0x4e3618){_0x3d435c['count']=_0x4e3618;if(_0x58a962[_0x5157('0x35')]['includeAll']){_0x5110f0[_0x5157('0x43')]=[{'all':!![]}];}return db[_0x5157('0x42')][_0x5157('0x44')](_0x5110f0);})[_0x5157('0x28')](function(_0x2e2ce8){_0x3d435c[_0x5157('0x45')]=_0x2e2ce8;return _0x3d435c;})[_0x5157('0x28')](respondWithFilteredResult(_0x5da464,_0x5110f0))[_0x5157('0x46')](handleError(_0x5da464,null));};exports['show']=function(_0x150abb,_0x3eb3bd){var _0x3d88f8={'raw':![],'where':{'id':_0x150abb[_0x5157('0x47')]['id']}},_0x2d9285={};_0x2d9285[_0x5157('0x34')]=_[_0x5157('0x36')](db['VoiceMusicOnHold'][_0x5157('0x31')]);_0x2d9285['query']=_[_0x5157('0x36')](_0x150abb[_0x5157('0x35')]);_0x2d9285[_0x5157('0x37')]=_[_0x5157('0x38')](_0x2d9285[_0x5157('0x34')],_0x2d9285[_0x5157('0x35')]);_0x3d88f8[_0x5157('0x39')]=_['intersection'](_0x2d9285[_0x5157('0x34')],qs[_0x5157('0x48')](_0x150abb[_0x5157('0x35')][_0x5157('0x48')]));_0x3d88f8[_0x5157('0x39')]=_0x3d88f8[_0x5157('0x39')][_0x5157('0x3a')]?_0x3d88f8[_0x5157('0x39')]:_0x2d9285[_0x5157('0x34')];if(_0x150abb['query']['includeAll']){_0x3d88f8['include']=[{'all':!![]}];}_0x3d88f8=_[_0x5157('0x41')]({},_0x3d88f8,_0x150abb[_0x5157('0x49')]);return db[_0x5157('0x42')][_0x5157('0x4a')](_0x3d88f8)[_0x5157('0x28')](handleEntityNotFound(_0x3eb3bd,null))[_0x5157('0x28')](respondWithResult(_0x3eb3bd,null))[_0x5157('0x46')](handleError(_0x3eb3bd,null));};exports['update']=function(_0x193d7e,_0x15e9d2){if(_0x193d7e[_0x5157('0x4b')]['id']){delete _0x193d7e[_0x5157('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x5157('0x4a')]({'where':{'id':_0x193d7e[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x15e9d2,null))[_0x5157('0x28')](saveUpdates(_0x193d7e[_0x5157('0x4b')],null))[_0x5157('0x28')](respondWithResult(_0x15e9d2,null))[_0x5157('0x46')](handleError(_0x15e9d2,null));};exports[_0x5157('0x4c')]=function(_0x30c6dd,_0x4a1886,_0x3797a5){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x3a4e67){if(_0x30c6dd[_0x5157('0x4b')]['mode']===_0x5157('0x4f')){_0x30c6dd[_0x5157('0x4b')]['directory']=path[_0x5157('0x50')](config['root'],'server/files/moh',_0x30c6dd[_0x5157('0x4b')][_0x5157('0x2d')]);}return db[_0x5157('0x42')]['create'](_0x30c6dd[_0x5157('0x4b')],{'transaction':_0x3a4e67})['then'](function(_0x2e0775){if(_0x30c6dd[_0x5157('0x4b')]['mode']===_0x5157('0x4f')){fs[_0x5157('0x51')](_0x2e0775[_0x5157('0x52')],parseInt(_0x5157('0x53'),0x8));}var _0x3200e7=_0x30c6dd[_0x5157('0x54')][_0x5157('0x29')]({'plain':!![]});if(!_0x3200e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3200e7[_0x5157('0x55')]==='user'){var _0x19e97a=_0x2e0775[_0x5157('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x5157('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x3200e7['userProfileId']},'raw':!![]})[_0x5157('0x28')](function(_0x15a8ac){if(_0x15a8ac&&_0x15a8ac[_0x5157('0x56')]===0x0){return db['UserProfileResource'][_0x5157('0x4c')]({'name':_0x19e97a[_0x5157('0x2d')],'resourceId':_0x19e97a['id'],'type':_0x15a8ac['name'],'sectionId':_0x15a8ac['id']},{})[_0x5157('0x28')](function(){return _0x2e0775;});}else{return _0x2e0775;}})[_0x5157('0x46')](function(_0x573808){logger[_0x5157('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573808);});}return _0x2e0775;});})['then'](respondWithResult(_0x4a1886,0xc9))[_0x5157('0x46')](handleError(_0x4a1886,null));};exports['destroy']=function(_0x41e553,_0x3cfafd,_0x34746c){var _0x1efc8e;return db[_0x5157('0x42')][_0x5157('0x4a')]({'where':{'id':_0x41e553[_0x5157('0x47')]['id']}})[_0x5157('0x28')](function(_0x555023){if(_0x555023){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x43b3bc){return _0x555023[_0x5157('0x27')]({'transaction':_0x43b3bc,'raw':!![]})[_0x5157('0x28')](function(_0x3c6d16){if(_0x3c6d16[_0x5157('0x52')]){fs[_0x5157('0x58')](_0x3c6d16[_0x5157('0x52')])[_0x5157('0x59')](function(_0x3f88f6){fs[_0x5157('0x5a')](path[_0x5157('0x50')](_0x3c6d16[_0x5157('0x52')],_0x3f88f6));});fs['rmdirSync'](_0x3c6d16[_0x5157('0x52')]);}return _0x3c6d16;});})[_0x5157('0x46')](function(_0x2d8245){throw new db[(_0x5157('0x5b'))][(_0x5157('0x5c'))](_0x2d8245[_0x5157('0x5d')]);});}})['then'](handleEntityNotFound(_0x3cfafd,null))[_0x5157('0x28')](removeEntity(_0x3cfafd,null))[_0x5157('0x46')](handleError(_0x3cfafd,null));};exports['addSound']=function(_0x144fec,_0x48c49b,_0x2f0554){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x843ab0){var _0x40e2c2;return db[_0x5157('0x42')][_0x5157('0x4a')]({'where':{'id':_0x144fec[_0x5157('0x47')]['id']}})[_0x5157('0x28')](function(_0x413fca){if(_0x413fca){_0x40e2c2=_0x413fca;return _0x413fca[_0x5157('0x5e')](_0x144fec[_0x5157('0x4b')]['id'],{'transaction':_0x843ab0});}})[_0x5157('0x28')](function(_0x159494){if(_0x159494){return db[_0x5157('0x5f')][_0x5157('0x60')]({'where':{'id':_0x144fec[_0x5157('0x4b')]['id']},'attributes':['id',_0x5157('0x2d'),_0x5157('0x61'),_0x5157('0x62'),_0x5157('0x63')],'raw':!![]});}})[_0x5157('0x28')](function(_0x406885){if(_0x406885){var _0x2f3ef7=path[_0x5157('0x50')](config['root'],_0x5157('0x64'),util[_0x5157('0x65')](_0x5157('0x66'),path[_0x5157('0x67')](_0x406885[_0x5157('0x61')],path[_0x5157('0x68')](_0x406885[_0x5157('0x61')])),_0x406885['converted_format']));var _0x4c0c13=path[_0x5157('0x50')](config[_0x5157('0x69')],'server/files/moh',_0x40e2c2[_0x5157('0x2d')],util[_0x5157('0x65')](_0x5157('0x66'),_0x406885['name'],_0x406885[_0x5157('0x62')]));fs[_0x5157('0x6a')](_0x2f3ef7,_0x4c0c13);return _0x406885;}})[_0x5157('0x46')](function(_0x2cd462){throw new db[(_0x5157('0x5b'))]['ValidationError'](_0x2cd462['message']);});})[_0x5157('0x28')](handleEntityNotFound(_0x48c49b,null))[_0x5157('0x28')](respondWithResult(_0x48c49b,0xc9))['catch'](handleError(_0x48c49b,null));};exports[_0x5157('0x6b')]=function(_0x12e85d,_0x1d2ea4,_0x546b8b){return db[_0x5157('0x4d')][_0x5157('0x4e')](function(_0x5694b3){var _0x393593;return db[_0x5157('0x42')][_0x5157('0x60')]({'where':{'id':_0x12e85d[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x1d2ea4,null))['then'](function(_0x2f5e90){if(_0x2f5e90){_0x393593=_0x2f5e90;return _0x2f5e90[_0x5157('0x6b')](_0x12e85d[_0x5157('0x47')][_0x5157('0x6c')]);}})[_0x5157('0x28')](function(_0x2418de){if(_0x2418de){return db[_0x5157('0x5f')]['findOne']({'where':{'id':_0x12e85d[_0x5157('0x47')][_0x5157('0x6c')]},'attributes':['id',_0x5157('0x2d'),_0x5157('0x61'),_0x5157('0x62'),'createdAt'],'raw':!![]});}})['then'](function(_0x2dc30d){if(_0x2dc30d){fs[_0x5157('0x5a')](path[_0x5157('0x50')](_0x393593[_0x5157('0x52')],util['format']('%s.%s',_0x2dc30d[_0x5157('0x2d')],_0x2dc30d[_0x5157('0x62')])));return _0x2dc30d;}})[_0x5157('0x46')](function(_0x6e9382){throw new db[(_0x5157('0x5b'))][(_0x5157('0x5c'))](_0x6e9382[_0x5157('0x5d')]);});})['then'](handleEntityNotFound(_0x1d2ea4,null))[_0x5157('0x28')](respondWithStatusCode(_0x1d2ea4,0xcc))[_0x5157('0x46')](handleError(_0x1d2ea4,null));};exports[_0x5157('0x6d')]=function(_0x556db6,_0x2c0779,_0x19be93){var _0xc4bdfc={};var _0xae4571={};var _0x2b9935;var _0x2f7ed3;return db[_0x5157('0x42')][_0x5157('0x60')]({'where':{'id':_0x556db6[_0x5157('0x47')]['id']}})[_0x5157('0x28')](handleEntityNotFound(_0x2c0779,null))[_0x5157('0x28')](function(_0x2daf1e){if(_0x2daf1e){_0x2b9935=_0x2daf1e;_0xae4571[_0x5157('0x34')]=_[_0x5157('0x36')](db[_0x5157('0x5f')][_0x5157('0x31')]);_0xae4571[_0x5157('0x35')]=_[_0x5157('0x36')](_0x556db6[_0x5157('0x35')]);_0xae4571['filters']=_[_0x5157('0x38')](_0xae4571[_0x5157('0x34')],_0xae4571[_0x5157('0x35')]);_0xc4bdfc[_0x5157('0x39')]=_[_0x5157('0x38')](_0xae4571['model'],qs[_0x5157('0x48')](_0x556db6[_0x5157('0x35')][_0x5157('0x48')]));_0xc4bdfc['attributes']=_0xc4bdfc[_0x5157('0x39')][_0x5157('0x3a')]?_0xc4bdfc[_0x5157('0x39')]:_0xae4571[_0x5157('0x34')];_0xc4bdfc[_0x5157('0x3b')]=qs['sort'](_0x556db6['query'][_0x5157('0x3c')]);_0xc4bdfc[_0x5157('0x3d')]=qs[_0x5157('0x37')](_[_0x5157('0x3e')](_0x556db6[_0x5157('0x35')],_0xae4571[_0x5157('0x37')]));if(_0x556db6[_0x5157('0x35')]['filter']){_0xc4bdfc[_0x5157('0x3d')]=_['merge'](_0xc4bdfc['where'],{'$or':_[_0x5157('0x30')](_0xc4bdfc[_0x5157('0x39')],function(_0x40d3c4){var _0x56415a={};_0x56415a[_0x40d3c4]={'$like':'%'+_0x556db6[_0x5157('0x35')]['filter']+'%'};return _0x56415a;})});}_0xc4bdfc=_[_0x5157('0x41')]({},_0xc4bdfc,_0x556db6[_0x5157('0x49')]);return _0x2b9935[_0x5157('0x6d')](_0xc4bdfc);}})[_0x5157('0x28')](function(_0x1ca997){if(_0x1ca997){_0x2f7ed3=_0x1ca997[_0x5157('0x3a')];if(!_0x556db6[_0x5157('0x35')]['hasOwnProperty'](_0x5157('0x6e'))){_0xc4bdfc[_0x5157('0x1f')]=qs[_0x5157('0x1f')](_0x556db6[_0x5157('0x35')]['limit']);_0xc4bdfc[_0x5157('0x1d')]=qs[_0x5157('0x1d')](_0x556db6[_0x5157('0x35')][_0x5157('0x1d')]);}return _0x2b9935[_0x5157('0x6d')](_0xc4bdfc);}})['then'](function(_0x5e6dd7){if(_0x5e6dd7){return _0x5e6dd7?{'count':_0x2f7ed3,'rows':_0x5e6dd7}:null;}})[_0x5157('0x28')](respondWithResult(_0x2c0779,null))[_0x5157('0x46')](handleError(_0x2c0779,null));}; \ No newline at end of file +var _0x168a=['join','server/files/moh','files','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','root','%s.%s','removeSound','id2','unlinkSync','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','find','catch','update','body','create','sequelize','transaction','mode','directory'];(function(_0x13bf45,_0x2da000){var _0x247345=function(_0x5ee513){while(--_0x5ee513){_0x13bf45['push'](_0x13bf45['shift']());}};_0x247345(++_0x2da000);}(_0x168a,0x16b));var _0xa168=function(_0x1b1af8,_0x37c959){_0x1b1af8=_0x1b1af8-0x0;var _0x27c970=_0x168a[_0x1b1af8];return _0x27c970;};'use strict';var emlformat=require(_0xa168('0x0'));var rimraf=require(_0xa168('0x1'));var zipdir=require(_0xa168('0x2'));var jsonpatch=require(_0xa168('0x3'));var rp=require('request-promise');var moment=require(_0xa168('0x4'));var BPromise=require(_0xa168('0x5'));var Mustache=require(_0xa168('0x6'));var util=require(_0xa168('0x7'));var path=require(_0xa168('0x8'));var sox=require(_0xa168('0x9'));var csv=require(_0xa168('0xa'));var ejs=require(_0xa168('0xb'));var fs=require('fs');var fs_extra=require(_0xa168('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa168('0xd'));var jsforce=require(_0xa168('0xe'));var deskjs=require(_0xa168('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa168('0x10'));var Papa=require('papaparse');var Redis=require(_0xa168('0x11'));var authService=require(_0xa168('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa168('0x13'));var logger=require(_0xa168('0x14'))(_0xa168('0x15'));var utils=require(_0xa168('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa168('0x17'));var db=require(_0xa168('0x18'))['db'];function respondWithStatusCode(_0x514e9f,_0x7f4c08){_0x7f4c08=_0x7f4c08||0xcc;return function(_0x5984c9){if(_0x5984c9){return _0x514e9f[_0xa168('0x19')](_0x7f4c08);}return _0x514e9f[_0xa168('0x1a')](_0x7f4c08)[_0xa168('0x1b')]();};}function respondWithResult(_0xcfc8f8,_0x511248){_0x511248=_0x511248||0xc8;return function(_0x5bbf31){if(_0x5bbf31){return _0xcfc8f8[_0xa168('0x1a')](_0x511248)[_0xa168('0x1c')](_0x5bbf31);}};}function respondWithFilteredResult(_0x5cce1d,_0x441df8){return function(_0x4fc550){if(_0x4fc550){var _0x5f2c02=typeof _0x441df8[_0xa168('0x1d')]===_0xa168('0x1e')&&typeof _0x441df8[_0xa168('0x1f')]===_0xa168('0x1e');var _0x3a2f3f=_0x4fc550[_0xa168('0x20')];var _0x10ef16=_0x5f2c02?0x0:_0x441df8[_0xa168('0x1d')];var _0x35d05d=_0x5f2c02?_0x4fc550[_0xa168('0x20')]:_0x441df8[_0xa168('0x1d')]+_0x441df8[_0xa168('0x1f')];var _0x3c96dd;if(_0x35d05d>=_0x3a2f3f){_0x35d05d=_0x3a2f3f;_0x3c96dd=0xc8;}else{_0x3c96dd=0xce;}_0x5cce1d['status'](_0x3c96dd);return _0x5cce1d[_0xa168('0x21')]('Content-Range',_0x10ef16+'-'+_0x35d05d+'/'+_0x3a2f3f)[_0xa168('0x1c')](_0x4fc550);}return null;};}function patchUpdates(_0x1bd798){return function(_0x490736){try{jsonpatch[_0xa168('0x22')](_0x490736,_0x1bd798,!![]);}catch(_0x3cb4b2){return BPromise['reject'](_0x3cb4b2);}return _0x490736[_0xa168('0x23')]();};}function saveUpdates(_0x45d09f,_0x2b5540){return function(_0x425622){if(_0x425622){return _0x425622['update'](_0x45d09f)[_0xa168('0x24')](function(_0x486bd6){return _0x486bd6;});}return null;};}function removeEntity(_0x56b741,_0x4d7fb6){return function(_0x5f1d88){if(_0x5f1d88){return _0x5f1d88[_0xa168('0x25')]()['then'](function(){var _0x545760=_0x5f1d88[_0xa168('0x26')]({'plain':!![]});var _0x130b99=_0xa168('0x27');return db[_0xa168('0x28')][_0xa168('0x25')]({'where':{'type':_0x130b99,'resourceId':_0x545760['id']}})['then'](function(){return _0x5f1d88;});})[_0xa168('0x24')](function(){_0x56b741['status'](0xcc)[_0xa168('0x1b')]();});}};}function handleEntityNotFound(_0x5c03aa,_0x3abd2d){return function(_0x398470){if(!_0x398470){_0x5c03aa[_0xa168('0x19')](0x194);}return _0x398470;};}function handleError(_0x2d3060,_0x9be359){_0x9be359=_0x9be359||0x1f4;return function(_0x35a74d){logger[_0xa168('0x29')](_0x35a74d[_0xa168('0x2a')]);if(_0x35a74d['name']){delete _0x35a74d['name'];}_0x2d3060['status'](_0x9be359)[_0xa168('0x2b')](_0x35a74d);};}exports['index']=function(_0x248b84,_0xc77cfc){var _0x55886d={},_0x3b21b2={},_0x315d64={'count':0x0,'rows':[]};var _0x17ae6a=_[_0xa168('0x2c')](db[_0xa168('0x2d')][_0xa168('0x2e')],function(_0x3f8723){return{'name':_0x3f8723[_0xa168('0x2f')],'type':_0x3f8723[_0xa168('0x30')]['key']};});_0x3b21b2[_0xa168('0x31')]=_[_0xa168('0x2c')](_0x17ae6a,_0xa168('0x32'));_0x3b21b2[_0xa168('0x33')]=_[_0xa168('0x34')](_0x248b84[_0xa168('0x33')]);_0x3b21b2[_0xa168('0x35')]=_[_0xa168('0x36')](_0x3b21b2[_0xa168('0x31')],_0x3b21b2[_0xa168('0x33')]);_0x55886d[_0xa168('0x37')]=_[_0xa168('0x36')](_0x3b21b2[_0xa168('0x31')],qs[_0xa168('0x38')](_0x248b84[_0xa168('0x33')][_0xa168('0x38')]));_0x55886d['attributes']=_0x55886d['attributes'][_0xa168('0x39')]?_0x55886d[_0xa168('0x37')]:_0x3b21b2[_0xa168('0x31')];if(!_0x248b84[_0xa168('0x33')]['hasOwnProperty'](_0xa168('0x3a'))){_0x55886d[_0xa168('0x1f')]=qs[_0xa168('0x1f')](_0x248b84[_0xa168('0x33')][_0xa168('0x1f')]);_0x55886d[_0xa168('0x1d')]=qs['offset'](_0x248b84[_0xa168('0x33')][_0xa168('0x1d')]);}_0x55886d[_0xa168('0x3b')]=qs[_0xa168('0x3c')](_0x248b84[_0xa168('0x33')][_0xa168('0x3c')]);delete _0x248b84[_0xa168('0x33')][_0xa168('0x3c')];_0x55886d['where']=qs[_0xa168('0x35')](_[_0xa168('0x3d')](_0x248b84[_0xa168('0x33')],_0x3b21b2[_0xa168('0x35')]),_0x17ae6a);if(_0x248b84[_0xa168('0x33')]['filter']){_0x55886d[_0xa168('0x3e')]=_[_0xa168('0x3f')](_0x55886d[_0xa168('0x3e')],{'$or':_['map'](_0x17ae6a,function(_0x21bbd2){if(_0x21bbd2[_0xa168('0x30')]!==_0xa168('0x40')){var _0x2491a2={};_0x2491a2[_0x21bbd2[_0xa168('0x32')]]={'$like':'%'+_0x248b84[_0xa168('0x33')][_0xa168('0x41')]+'%'};return _0x2491a2;}})});}_0x55886d=_[_0xa168('0x3f')]({},_0x55886d,_0x248b84['options']);var _0x3a0016={'where':_0x55886d[_0xa168('0x3e')]};return db['VoiceMusicOnHold'][_0xa168('0x20')](_0x3a0016)[_0xa168('0x24')](function(_0x5a945b){_0x315d64[_0xa168('0x20')]=_0x5a945b;if(_0x248b84[_0xa168('0x33')][_0xa168('0x42')]){_0x55886d[_0xa168('0x43')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa168('0x44')](_0x55886d);})[_0xa168('0x24')](function(_0x4bf122){_0x315d64[_0xa168('0x45')]=_0x4bf122;return _0x315d64;})[_0xa168('0x24')](respondWithFilteredResult(_0xc77cfc,_0x55886d))['catch'](handleError(_0xc77cfc,null));};exports[_0xa168('0x46')]=function(_0x161242,_0x90bcb1){var _0x39f394={'raw':![],'where':{'id':_0x161242[_0xa168('0x47')]['id']}},_0x115f86={};_0x115f86[_0xa168('0x31')]=_[_0xa168('0x34')](db[_0xa168('0x2d')][_0xa168('0x2e')]);_0x115f86[_0xa168('0x33')]=_[_0xa168('0x34')](_0x161242[_0xa168('0x33')]);_0x115f86[_0xa168('0x35')]=_[_0xa168('0x36')](_0x115f86[_0xa168('0x31')],_0x115f86[_0xa168('0x33')]);_0x39f394[_0xa168('0x37')]=_[_0xa168('0x36')](_0x115f86[_0xa168('0x31')],qs[_0xa168('0x38')](_0x161242[_0xa168('0x33')][_0xa168('0x38')]));_0x39f394['attributes']=_0x39f394[_0xa168('0x37')][_0xa168('0x39')]?_0x39f394[_0xa168('0x37')]:_0x115f86['model'];if(_0x161242[_0xa168('0x33')]['includeAll']){_0x39f394['include']=[{'all':!![]}];}_0x39f394=_[_0xa168('0x3f')]({},_0x39f394,_0x161242['options']);return db[_0xa168('0x2d')][_0xa168('0x48')](_0x39f394)['then'](handleEntityNotFound(_0x90bcb1,null))[_0xa168('0x24')](respondWithResult(_0x90bcb1,null))[_0xa168('0x49')](handleError(_0x90bcb1,null));};exports[_0xa168('0x4a')]=function(_0x364f51,_0x576b58){if(_0x364f51['body']['id']){delete _0x364f51[_0xa168('0x4b')]['id'];}return db[_0xa168('0x2d')][_0xa168('0x48')]({'where':{'id':_0x364f51[_0xa168('0x47')]['id']}})[_0xa168('0x24')](handleEntityNotFound(_0x576b58,null))[_0xa168('0x24')](saveUpdates(_0x364f51[_0xa168('0x4b')],null))[_0xa168('0x24')](respondWithResult(_0x576b58,null))[_0xa168('0x49')](handleError(_0x576b58,null));};exports[_0xa168('0x4c')]=function(_0x2c2f54,_0x3ab162,_0x37fa4a){return db[_0xa168('0x4d')][_0xa168('0x4e')](function(_0x542a62){if(_0x2c2f54[_0xa168('0x4b')][_0xa168('0x4f')]==='files'){_0x2c2f54[_0xa168('0x4b')][_0xa168('0x50')]=path[_0xa168('0x51')](config['root'],_0xa168('0x52'),_0x2c2f54['body']['name']);}return db[_0xa168('0x2d')][_0xa168('0x4c')](_0x2c2f54[_0xa168('0x4b')],{'transaction':_0x542a62})[_0xa168('0x24')](function(_0x3259d4){if(_0x2c2f54[_0xa168('0x4b')][_0xa168('0x4f')]===_0xa168('0x53')){fs[_0xa168('0x54')](_0x3259d4[_0xa168('0x50')],parseInt('0777',0x8));}var _0x4ef6ad=_0x2c2f54['user'][_0xa168('0x26')]({'plain':!![]});if(!_0x4ef6ad)throw new Error(_0xa168('0x55'));if(_0x4ef6ad['role']===_0xa168('0x56')){var _0x3f5d27=_0x3259d4[_0xa168('0x26')]({'plain':!![]});return db[_0xa168('0x57')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x4ef6ad['userProfileId']},'raw':!![]})['then'](function(_0x1ad7c8){if(_0x1ad7c8&&_0x1ad7c8[_0xa168('0x58')]===0x0){return db[_0xa168('0x28')][_0xa168('0x4c')]({'name':_0x3f5d27[_0xa168('0x32')],'resourceId':_0x3f5d27['id'],'type':_0x1ad7c8['name'],'sectionId':_0x1ad7c8['id']},{})['then'](function(){return _0x3259d4;});}else{return _0x3259d4;}})[_0xa168('0x49')](function(_0x8d2231){logger[_0xa168('0x29')](_0xa168('0x59'),_0x8d2231);});}return _0x3259d4;});})[_0xa168('0x24')](respondWithResult(_0x3ab162,0xc9))[_0xa168('0x49')](handleError(_0x3ab162,null));};exports[_0xa168('0x25')]=function(_0x46c8eb,_0x5bc68d,_0x419aaa){var _0x308e92;return db[_0xa168('0x2d')][_0xa168('0x48')]({'where':{'id':_0x46c8eb[_0xa168('0x47')]['id']}})[_0xa168('0x24')](function(_0x21dbed){if(_0x21dbed){return db['sequelize']['transaction'](function(_0xbf1f07){return _0x21dbed[_0xa168('0x25')]({'transaction':_0xbf1f07,'raw':!![]})[_0xa168('0x24')](function(_0x744a0d){if(_0x744a0d[_0xa168('0x50')]){fs[_0xa168('0x5a')](_0x744a0d['directory'])['forEach'](function(_0x256702){fs['unlinkSync'](path[_0xa168('0x51')](_0x744a0d[_0xa168('0x50')],_0x256702));});fs[_0xa168('0x5b')](_0x744a0d[_0xa168('0x50')]);}return _0x744a0d;});})[_0xa168('0x49')](function(_0xf83ce){throw new db[(_0xa168('0x5c'))][(_0xa168('0x5d'))](_0xf83ce['message']);});}})['then'](handleEntityNotFound(_0x5bc68d,null))[_0xa168('0x24')](removeEntity(_0x5bc68d,null))['catch'](handleError(_0x5bc68d,null));};exports[_0xa168('0x5e')]=function(_0x1c6216,_0x45908f,_0x54b096){return db['sequelize'][_0xa168('0x4e')](function(_0x48604f){var _0x1fd6b9;return db[_0xa168('0x2d')][_0xa168('0x48')]({'where':{'id':_0x1c6216[_0xa168('0x47')]['id']}})[_0xa168('0x24')](function(_0x2e1d6f){if(_0x2e1d6f){_0x1fd6b9=_0x2e1d6f;return _0x2e1d6f[_0xa168('0x5e')](_0x1c6216[_0xa168('0x4b')]['id'],{'transaction':_0x48604f});}})['then'](function(_0x86f494){if(_0x86f494){return db[_0xa168('0x5f')][_0xa168('0x60')]({'where':{'id':_0x1c6216[_0xa168('0x4b')]['id']},'attributes':['id',_0xa168('0x32'),_0xa168('0x61'),_0xa168('0x62'),_0xa168('0x63')],'raw':!![]});}})[_0xa168('0x24')](function(_0xf315ee){if(_0xf315ee){var _0x2f68f5=path[_0xa168('0x51')](config['root'],_0xa168('0x64'),util[_0xa168('0x65')]('%s.%s',path[_0xa168('0x66')](_0xf315ee['save_name'],path[_0xa168('0x67')](_0xf315ee[_0xa168('0x61')])),_0xf315ee[_0xa168('0x62')]));var _0x2cf020=path[_0xa168('0x51')](config[_0xa168('0x68')],_0xa168('0x52'),_0x1fd6b9[_0xa168('0x32')],util[_0xa168('0x65')](_0xa168('0x69'),_0xf315ee[_0xa168('0x32')],_0xf315ee[_0xa168('0x62')]));fs['symlinkSync'](_0x2f68f5,_0x2cf020);return _0xf315ee;}})['catch'](function(_0x27e748){throw new db['Sequelize'][(_0xa168('0x5d'))](_0x27e748['message']);});})[_0xa168('0x24')](handleEntityNotFound(_0x45908f,null))['then'](respondWithResult(_0x45908f,0xc9))[_0xa168('0x49')](handleError(_0x45908f,null));};exports['removeSound']=function(_0x53fbe2,_0x5434d7,_0x43b314){return db[_0xa168('0x4d')]['transaction'](function(_0x35238e){var _0x4b6bc8;return db[_0xa168('0x2d')][_0xa168('0x60')]({'where':{'id':_0x53fbe2['params']['id']}})[_0xa168('0x24')](handleEntityNotFound(_0x5434d7,null))['then'](function(_0xfa56e8){if(_0xfa56e8){_0x4b6bc8=_0xfa56e8;return _0xfa56e8[_0xa168('0x6a')](_0x53fbe2[_0xa168('0x47')]['id2']);}})[_0xa168('0x24')](function(_0x27ca3b){if(_0x27ca3b){return db[_0xa168('0x5f')][_0xa168('0x60')]({'where':{'id':_0x53fbe2[_0xa168('0x47')][_0xa168('0x6b')]},'attributes':['id',_0xa168('0x32'),'save_name','converted_format',_0xa168('0x63')],'raw':!![]});}})[_0xa168('0x24')](function(_0x525c6b){if(_0x525c6b){fs[_0xa168('0x6c')](path[_0xa168('0x51')](_0x4b6bc8[_0xa168('0x50')],util[_0xa168('0x65')](_0xa168('0x69'),_0x525c6b[_0xa168('0x32')],_0x525c6b[_0xa168('0x62')])));return _0x525c6b;}})[_0xa168('0x49')](function(_0x323a94){throw new db[(_0xa168('0x5c'))][(_0xa168('0x5d'))](_0x323a94['message']);});})[_0xa168('0x24')](handleEntityNotFound(_0x5434d7,null))['then'](respondWithStatusCode(_0x5434d7,0xcc))[_0xa168('0x49')](handleError(_0x5434d7,null));};exports[_0xa168('0x6d')]=function(_0x231b60,_0x1b2c0f,_0x1bfe8){var _0x583c58={};var _0x5692d1={};var _0x22d84e;var _0x2a721c;return db[_0xa168('0x2d')][_0xa168('0x60')]({'where':{'id':_0x231b60[_0xa168('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b2c0f,null))['then'](function(_0x409fa0){if(_0x409fa0){_0x22d84e=_0x409fa0;_0x5692d1['model']=_[_0xa168('0x34')](db[_0xa168('0x5f')][_0xa168('0x2e')]);_0x5692d1[_0xa168('0x33')]=_[_0xa168('0x34')](_0x231b60[_0xa168('0x33')]);_0x5692d1[_0xa168('0x35')]=_[_0xa168('0x36')](_0x5692d1[_0xa168('0x31')],_0x5692d1[_0xa168('0x33')]);_0x583c58[_0xa168('0x37')]=_[_0xa168('0x36')](_0x5692d1['model'],qs['fields'](_0x231b60['query'][_0xa168('0x38')]));_0x583c58[_0xa168('0x37')]=_0x583c58[_0xa168('0x37')][_0xa168('0x39')]?_0x583c58[_0xa168('0x37')]:_0x5692d1[_0xa168('0x31')];_0x583c58[_0xa168('0x3b')]=qs[_0xa168('0x3c')](_0x231b60[_0xa168('0x33')]['sort']);_0x583c58[_0xa168('0x3e')]=qs['filters'](_[_0xa168('0x3d')](_0x231b60[_0xa168('0x33')],_0x5692d1['filters']));if(_0x231b60[_0xa168('0x33')][_0xa168('0x41')]){_0x583c58[_0xa168('0x3e')]=_['merge'](_0x583c58[_0xa168('0x3e')],{'$or':_[_0xa168('0x2c')](_0x583c58['attributes'],function(_0x41c2d2){var _0x4ab398={};_0x4ab398[_0x41c2d2]={'$like':'%'+_0x231b60[_0xa168('0x33')][_0xa168('0x41')]+'%'};return _0x4ab398;})});}_0x583c58=_['merge']({},_0x583c58,_0x231b60['options']);return _0x22d84e[_0xa168('0x6d')](_0x583c58);}})[_0xa168('0x24')](function(_0x597443){if(_0x597443){_0x2a721c=_0x597443['length'];if(!_0x231b60[_0xa168('0x33')][_0xa168('0x6e')](_0xa168('0x3a'))){_0x583c58[_0xa168('0x1f')]=qs[_0xa168('0x1f')](_0x231b60['query'][_0xa168('0x1f')]);_0x583c58[_0xa168('0x1d')]=qs[_0xa168('0x1d')](_0x231b60[_0xa168('0x33')][_0xa168('0x1d')]);}return _0x22d84e[_0xa168('0x6d')](_0x583c58);}})[_0xa168('0x24')](function(_0x60840d){if(_0x60840d){return _0x60840d?{'count':_0x2a721c,'rows':_0x60840d}:null;}})[_0xa168('0x24')](respondWithResult(_0x1b2c0f,null))[_0xa168('0x49')](handleError(_0x1b2c0f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 88deffc..e0b6089 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 _0xc9c5=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','api','moment','bluebird','path'];(function(_0x80e80,_0x3c044b){var _0xa774b8=function(_0x70e45d){while(--_0x70e45d){_0x80e80['push'](_0x80e80['shift']());}};_0xa774b8(++_0x3c044b);}(_0xc9c5,0x150));var _0x5c9c=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0xc9c5[_0x55cdc5];return _0x29acd5;};'use strict';var _=require(_0x5c9c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5c9c('0x1'));var moment=require(_0x5c9c('0x2'));var BPromise=require(_0x5c9c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c9c('0x4'));var rimraf=require('rimraf');var config=require(_0x5c9c('0x5'));var attributes=require(_0x5c9c('0x6'));module[_0x5c9c('0x7')]=function(_0x55bf4a,_0x2d13e1){return _0x55bf4a[_0x5c9c('0x8')](_0x5c9c('0x9'),attributes,{'tableName':_0x5c9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ed9=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment'];(function(_0xe2aa8,_0x4dc4a0){var _0xcfaa72=function(_0x2ed431){while(--_0x2ed431){_0xe2aa8['push'](_0xe2aa8['shift']());}};_0xcfaa72(++_0x4dc4a0);}(_0x9ed9,0x182));var _0x99ed=function(_0x3d0e2a,_0x4f7f8c){_0x3d0e2a=_0x3d0e2a-0x0;var _0x236246=_0x9ed9[_0x3d0e2a];return _0x236246;};'use strict';var _=require(_0x99ed('0x0'));var util=require('util');var logger=require(_0x99ed('0x1'))(_0x99ed('0x2'));var moment=require(_0x99ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x99ed('0x4'));var fs=require('fs');var path=require(_0x99ed('0x5'));var rimraf=require(_0x99ed('0x6'));var config=require(_0x99ed('0x7'));var attributes=require(_0x99ed('0x8'));module[_0x99ed('0x9')]=function(_0x1c861a,_0xd09e64){return _0x1c861a[_0x99ed('0xa')](_0x99ed('0xb'),attributes,{'tableName':_0x99ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index b198951..f8e6cbe 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(_0xb3086f,_0x1d3710){var _0x3b4f7a=function(_0x416735){while(--_0x416735){_0xb3086f['push'](_0xb3086f['shift']());}};_0x3b4f7a(++_0x1d3710);}(_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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5dcd55,_0x188fc5){var _0x5292d3=function(_0x23876a){while(--_0x23876a){_0x5dcd55['push'](_0x5dcd55['shift']());}};_0x5292d3(++_0x188fc5);}(_0x34e8,0x12c));var _0x834e=function(_0x516d49,_0x17980c){_0x516d49=_0x516d49-0x0;var _0x2ceefe=_0x34e8[_0x516d49];return _0x2ceefe;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 74e81fa..fc8ef07 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 _0xd6d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/users','getAgents','getTeams','create','post','addAgents','/:id/teams','put','update','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5f7c05,_0x55ef27){var _0x58fcdc=function(_0x2a5d99){while(--_0x2a5d99){_0x5f7c05['push'](_0x5f7c05['shift']());}};_0x58fcdc(++_0x55ef27);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4f2c68,_0x18d1b2){_0x4f2c68=_0x4f2c68-0x0;var _0x42234f=_0xd6d6[_0x4f2c68];return _0x42234f;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xa')](_0x6d6d('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6d6d('0xa')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x11')]);router[_0x6d6d('0xa')]('/:id/teams',auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6d6d('0x13')]);router[_0x6d6d('0x14')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x15')]);router[_0x6d6d('0x14')](_0x6d6d('0x16'),auth[_0x6d6d('0xd')](),controller['addTeams']);router[_0x6d6d('0x17')](_0x6d6d('0xf'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x18')]);router[_0x6d6d('0x19')]('/:id',auth[_0x6d6d('0xd')](),controller['destroy']);router[_0x6d6d('0x19')](_0x6d6d('0x10'),auth[_0x6d6d('0xd')](),controller['removeAgents']);router['delete'](_0x6d6d('0x16'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x1a')]);module[_0x6d6d('0x1b')]=router; \ No newline at end of file +var _0x3e68=['addAgents','addTeams','update','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','create','post'];(function(_0x37dcd5,_0x3ff499){var _0x20852c=function(_0x2ba6a3){while(--_0x2ba6a3){_0x37dcd5['push'](_0x37dcd5['shift']());}};_0x20852c(++_0x3ff499);}(_0x3e68,0x190));var _0x83e6=function(_0x3cf1ee,_0x15f079){_0x3cf1ee=_0x3cf1ee-0x0;var _0x13630a=_0x3e68[_0x3cf1ee];return _0x13630a;};'use strict';var multer=require(_0x83e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x83e6('0x1'));var express=require('express');var router=express[_0x83e6('0x2')]();var fs_extra=require(_0x83e6('0x3'));var auth=require(_0x83e6('0x4'));var interaction=require(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var controller=require(_0x83e6('0x7'));router['get']('/',auth[_0x83e6('0x8')](),controller[_0x83e6('0x9')]);router[_0x83e6('0xa')](_0x83e6('0xb'),auth[_0x83e6('0x8')](),controller[_0x83e6('0xc')]);router['get'](_0x83e6('0xd'),auth[_0x83e6('0x8')](),controller[_0x83e6('0xe')]);router[_0x83e6('0xa')](_0x83e6('0xf'),auth[_0x83e6('0x8')](),controller[_0x83e6('0x10')]);router[_0x83e6('0xa')](_0x83e6('0x11'),auth[_0x83e6('0x8')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller[_0x83e6('0x12')]);router[_0x83e6('0x13')](_0x83e6('0xf'),auth['isAuthenticated'](),controller[_0x83e6('0x14')]);router[_0x83e6('0x13')](_0x83e6('0x11'),auth['isAuthenticated'](),controller[_0x83e6('0x15')]);router['put'](_0x83e6('0xd'),auth[_0x83e6('0x8')](),controller[_0x83e6('0x16')]);router[_0x83e6('0x17')]('/:id',auth[_0x83e6('0x8')](),controller[_0x83e6('0x18')]);router[_0x83e6('0x17')](_0x83e6('0xf'),auth[_0x83e6('0x8')](),controller[_0x83e6('0x19')]);router['delete']('/:id/teams',auth[_0x83e6('0x8')](),controller[_0x83e6('0x1a')]);module[_0x83e6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 916ed84..0f6dfec 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 _0x2d49=['exports','STRING','name','VIRTUAL','INTEGER'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x2d49,0xc8));var _0x92d4=function(_0x1a9e10,_0x113c78){_0x1a9e10=_0x1a9e10-0x0;var _0x32707a=_0x2d49[_0x1a9e10];return _0x32707a;};'use strict';var Sequelize=require('sequelize');module[_0x92d4('0x0')]={'name':{'type':Sequelize[_0x92d4('0x1')],'allowNull':![],'unique':_0x92d4('0x2')},'prefix':{'type':Sequelize[_0x92d4('0x3')],'get':function(_0x4e3023){return'system-'+this['getDataValue'](_0x92d4('0x2'))+'-';}},'description':{'type':Sequelize[_0x92d4('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x92d4('0x4')]}}; \ No newline at end of file +var _0x0f4d=['system-','getDataValue','exports','STRING','name','VIRTUAL'];(function(_0x346a11,_0x10b2fe){var _0x1b7115=function(_0x59add0){while(--_0x59add0){_0x346a11['push'](_0x346a11['shift']());}};_0x1b7115(++_0x10b2fe);}(_0x0f4d,0x1f4));var _0xd0f4=function(_0x21b001,_0x1c4b61){_0x21b001=_0x21b001-0x0;var _0x56fb9a=_0x0f4d[_0x21b001];return _0x56fb9a;};'use strict';var Sequelize=require('sequelize');module[_0xd0f4('0x0')]={'name':{'type':Sequelize[_0xd0f4('0x1')],'allowNull':![],'unique':_0xd0f4('0x2')},'prefix':{'type':Sequelize[_0xd0f4('0x3')],'get':function(_0x720625){return _0xd0f4('0x4')+this[_0xd0f4('0x5')](_0xd0f4('0x2'))+'-';}},'description':{'type':Sequelize[_0xd0f4('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 2ae61d8..6f13a89 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 _0x4b17=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','params','rawAttributes','includeAll','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','context','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','isEmpty','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x4b17,0x10f));var _0x74b1=function(_0x28be72,_0x2b83af){_0x28be72=_0x28be72-0x0;var _0x46c5da=_0x4b17[_0x28be72];return _0x46c5da;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];config['redis']=_['defaults'](config[_0x74b1('0x17')],{'host':_0x74b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x74b1('0x19')](socket);function respondWithStatusCode(_0x5c12eb,_0x4e289b){_0x4e289b=_0x4e289b||0xcc;return function(_0x2ccba6){if(_0x2ccba6){return _0x5c12eb[_0x74b1('0x1a')](_0x4e289b);}return _0x5c12eb[_0x74b1('0x1b')](_0x4e289b)[_0x74b1('0x1c')]();};}function respondWithResult(_0x16b147,_0x10138e){_0x10138e=_0x10138e||0xc8;return function(_0x528e8c){if(_0x528e8c){return _0x16b147[_0x74b1('0x1b')](_0x10138e)[_0x74b1('0x1d')](_0x528e8c);}};}function respondWithFilteredResult(_0x1a0851,_0x2cfcc3){return function(_0xde2736){if(_0xde2736){var _0x8c9510=typeof _0x2cfcc3[_0x74b1('0x1e')]==='undefined'&&typeof _0x2cfcc3[_0x74b1('0x1f')]===_0x74b1('0x20');var _0x524ece=_0xde2736[_0x74b1('0x21')];var _0x38d932=_0x8c9510?0x0:_0x2cfcc3[_0x74b1('0x1e')];var _0x25704e=_0x8c9510?_0xde2736[_0x74b1('0x21')]:_0x2cfcc3[_0x74b1('0x1e')]+_0x2cfcc3[_0x74b1('0x1f')];var _0xaac5f7;if(_0x25704e>=_0x524ece){_0x25704e=_0x524ece;_0xaac5f7=0xc8;}else{_0xaac5f7=0xce;}_0x1a0851['status'](_0xaac5f7);return _0x1a0851[_0x74b1('0x22')]('Content-Range',_0x38d932+'-'+_0x25704e+'/'+_0x524ece)['json'](_0xde2736);}return null;};}function patchUpdates(_0x481bf2){return function(_0x27fd1a){try{jsonpatch[_0x74b1('0x23')](_0x27fd1a,_0x481bf2,!![]);}catch(_0x405a22){return BPromise[_0x74b1('0x24')](_0x405a22);}return _0x27fd1a[_0x74b1('0x25')]();};}function saveUpdates(_0x4ee88b,_0x3c78e5){return function(_0x4eca36){if(_0x4eca36){return _0x4eca36[_0x74b1('0x26')](_0x4ee88b)[_0x74b1('0x27')](function(_0xb5af0){return _0xb5af0;});}return null;};}function removeEntity(_0x14a651,_0x3239d8){return function(_0x322de5){if(_0x322de5){return _0x322de5[_0x74b1('0x28')]()[_0x74b1('0x27')](function(){var _0x4c7f05=_0x322de5[_0x74b1('0x29')]({'plain':!![]});var _0x42b69d=_0x74b1('0x2a');return db['UserProfileResource'][_0x74b1('0x28')]({'where':{'type':_0x42b69d,'resourceId':_0x4c7f05['id']}})[_0x74b1('0x27')](function(){return _0x322de5;});})[_0x74b1('0x27')](function(){_0x14a651[_0x74b1('0x1b')](0xcc)[_0x74b1('0x1c')]();});}};}function handleEntityNotFound(_0x273ff1,_0x436eda){return function(_0x3ce043){if(!_0x3ce043){_0x273ff1['sendStatus'](0x194);}return _0x3ce043;};}function handleError(_0xe74c82,_0x40b32a){_0x40b32a=_0x40b32a||0x1f4;return function(_0x51ce6d){logger[_0x74b1('0x2b')](_0x51ce6d[_0x74b1('0x2c')]);if(_0x51ce6d[_0x74b1('0x2d')]){delete _0x51ce6d['name'];}_0xe74c82[_0x74b1('0x1b')](_0x40b32a)[_0x74b1('0x2e')](_0x51ce6d);};}exports['index']=function(_0x3dbf18,_0x33ec7c){var _0x2211b2={},_0x31c321={},_0x68a3bd={'count':0x0,'rows':[]};var _0x32a8d6=_[_0x74b1('0x2f')](db[_0x74b1('0x30')]['rawAttributes'],function(_0x3d5fc0){return{'name':_0x3d5fc0['fieldName'],'type':_0x3d5fc0['type'][_0x74b1('0x31')]};});_0x31c321['model']=_['map'](_0x32a8d6,_0x74b1('0x2d'));_0x31c321[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x3dbf18[_0x74b1('0x32')]);_0x31c321[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x31c321[_0x74b1('0x36')],_0x31c321[_0x74b1('0x32')]);_0x2211b2['attributes']=_['intersection'](_0x31c321['model'],qs[_0x74b1('0x37')](_0x3dbf18['query']['fields']));_0x2211b2[_0x74b1('0x38')]=_0x2211b2[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2211b2['attributes']:_0x31c321[_0x74b1('0x36')];if(!_0x3dbf18['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2211b2['limit']=qs['limit'](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2211b2['offset']=qs['offset'](_0x3dbf18[_0x74b1('0x32')]['offset']);}_0x2211b2[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x2211b2[_0x74b1('0x3e')]=qs['filters'](_[_0x74b1('0x3f')](_0x3dbf18['query'],_0x31c321[_0x74b1('0x34')]),_0x32a8d6);if(_0x3dbf18['query'][_0x74b1('0x40')]){_0x2211b2['where']=_['merge'](_0x2211b2[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x32a8d6,function(_0x2725fd){if(_0x2725fd['type']!==_0x74b1('0x41')){var _0x327334={};_0x327334[_0x2725fd[_0x74b1('0x2d')]]={'$like':'%'+_0x3dbf18['query'][_0x74b1('0x40')]+'%'};return _0x327334;}})});}_0x2211b2=_[_0x74b1('0x42')]({},_0x2211b2,_0x3dbf18['options']);var _0x48ac05={'where':_0x2211b2[_0x74b1('0x3e')]};return db[_0x74b1('0x30')][_0x74b1('0x21')](_0x48ac05)[_0x74b1('0x27')](function(_0x1d9f5b){_0x68a3bd[_0x74b1('0x21')]=_0x1d9f5b;if(_0x3dbf18[_0x74b1('0x32')]['includeAll']){_0x2211b2[_0x74b1('0x43')]=[{'all':!![]}];}return db[_0x74b1('0x30')][_0x74b1('0x44')](_0x2211b2);})[_0x74b1('0x27')](function(_0x17a44f){_0x68a3bd['rows']=_0x17a44f;return _0x68a3bd;})[_0x74b1('0x27')](respondWithFilteredResult(_0x33ec7c,_0x2211b2))[_0x74b1('0x45')](handleError(_0x33ec7c,null));};exports['show']=function(_0x50d9de,_0x1b7a58){var _0x3c3c3c={'raw':![],'where':{'id':_0x50d9de[_0x74b1('0x46')]['id']}},_0x54c94b={};_0x54c94b[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x30')][_0x74b1('0x47')]);_0x54c94b[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x50d9de['query']);_0x54c94b['filters']=_['intersection'](_0x54c94b[_0x74b1('0x36')],_0x54c94b[_0x74b1('0x32')]);_0x3c3c3c[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x54c94b[_0x74b1('0x36')],qs['fields'](_0x50d9de[_0x74b1('0x32')][_0x74b1('0x37')]));_0x3c3c3c[_0x74b1('0x38')]=_0x3c3c3c[_0x74b1('0x38')][_0x74b1('0x39')]?_0x3c3c3c[_0x74b1('0x38')]:_0x54c94b[_0x74b1('0x36')];if(_0x50d9de[_0x74b1('0x32')][_0x74b1('0x48')]){_0x3c3c3c[_0x74b1('0x43')]=[{'all':!![]}];}_0x3c3c3c=_[_0x74b1('0x42')]({},_0x3c3c3c,_0x50d9de[_0x74b1('0x49')]);return db['VoicePrefix'][_0x74b1('0x4a')](_0x3c3c3c)[_0x74b1('0x27')](handleEntityNotFound(_0x1b7a58,null))['then'](respondWithResult(_0x1b7a58,null))[_0x74b1('0x45')](handleError(_0x1b7a58,null));};exports['destroy']=function(_0x4b1add,_0x2073eb){return db['VoicePrefix'][_0x74b1('0x4a')]({'where':{'id':_0x4b1add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2073eb,null))['then'](removeEntity(_0x2073eb,null))[_0x74b1('0x45')](handleError(_0x2073eb,null));};exports[_0x74b1('0x4b')]=function(_0x1b2d51,_0x3d199b){return db[_0x74b1('0x30')]['describe']()[_0x74b1('0x27')](respondWithResult(_0x3d199b,null))['catch'](handleError(_0x3d199b,null));};exports[_0x74b1('0x4c')]=function(_0x4085b8,_0x5e458c){var _0x1be639;return db[_0x74b1('0x4d')][_0x74b1('0x4e')](function(_0x54a221){return db[_0x74b1('0x30')][_0x74b1('0x4c')](_0x4085b8['body'],{'transaction':_0x54a221})[_0x74b1('0x27')](function(_0x4fdd6b){_0x1be639=_0x4fdd6b['get']({'plain':!![]});return db[_0x74b1('0x4f')][_0x74b1('0x4a')]({'where':{'id':_0x1be639[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x41b45f){return createVoicePrefixExtensions(_0x1be639,_0x41b45f,_0x54a221);});});})['then'](function(){var _0x145ce3=_0x4085b8[_0x74b1('0x51')]['get']({'plain':!![]});if(!_0x145ce3)throw new Error(_0x74b1('0x52'));if(_0x145ce3[_0x74b1('0x53')]===_0x74b1('0x51')){var _0x5634d1=_0x1be639;return db[_0x74b1('0x54')][_0x74b1('0x4a')]({'where':{'name':_0x74b1('0x2a'),'userProfileId':_0x145ce3['userProfileId']},'raw':!![]})[_0x74b1('0x27')](function(_0x3b4338){if(_0x3b4338&&_0x3b4338[_0x74b1('0x55')]===0x0){return db[_0x74b1('0x56')][_0x74b1('0x4c')]({'name':_0x5634d1[_0x74b1('0x2d')],'resourceId':_0x5634d1['id'],'type':_0x3b4338['name'],'sectionId':_0x3b4338['id']},{})[_0x74b1('0x27')](function(){return _0x1be639;});}else{return _0x1be639;}})['catch'](function(_0x5343c4){logger[_0x74b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5343c4);throw _0x5343c4;});}return _0x1be639;})['then'](respondWithResult(_0x5e458c,null))[_0x74b1('0x45')](handleError(_0x5e458c,null));};function Extension(_0x29ab63,_0x16db5c,_0x515a8e,_0x204b7d){this[_0x74b1('0x57')]=_0x74b1('0x58');this[_0x74b1('0x59')]=_0x29ab63;this[_0x74b1('0x5a')]=_0x515a8e;this[_0x74b1('0x5b')]=_0x74b1('0x5c');this[_0x74b1('0x5d')]=_0x74b1('0x5e');this[_0x74b1('0x5f')]=_0x16db5c;this[_0x74b1('0x60')]=_0x204b7d;}function createVoicePrefixExtensions(_0x112721,_0x516e44,_0x598daa){return new BPromise(function(_0x2a46ca,_0x553615){var _0x15eb38=new Extension(formatPrefixName(_0x112721[_0x74b1('0x61')]),0x1,'NoOp','Voice\x20Prefix');_0x15eb38[_0x74b1('0x62')]=_0x112721['id'];return db[_0x74b1('0x4f')][_0x74b1('0x4c')](_0x15eb38,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x3dd0c3){var _0x1f879f=_0x3dd0c3[_0x74b1('0x29')]({'plain':!![]});var _0x1fb137=_[_0x74b1('0x2f')](addVoicePrefixExtensions(_0x112721,_0x516e44),function(_0x128a7e){_0x128a7e[_0x74b1('0x50')]=_0x1f879f['id'];_0x128a7e[_0x74b1('0x62')]=_0x112721['id'];return _0x128a7e;});return db['VoiceExtension'][_0x74b1('0x63')](_0x1fb137,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x378f63){if(!_0x378f63){return _0x553615(_0x74b1('0x64'));}else{return _0x2a46ca(_0x378f63);}})['catch'](function(_0x308b98){return _0x553615(_0x308b98);});});;});};function addVoicePrefixExtensions(_0x1709d9,_0x5ada76){var _0x425f9f=[];var _0x4d2fcb=formatPrefixName(_0x1709d9[_0x74b1('0x61')]);_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x2,'Set',_0x74b1('0x66')+_0x1709d9[_0x74b1('0x2d')]));if(_0x1709d9[_0x74b1('0x67')]){_0x425f9f['push'](new Extension(_0x4d2fcb,0x3,_0x74b1('0x68'),'PREFIX-CALLERIDALL='+_0x1709d9[_0x74b1('0x67')]));}else{_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x3,_0x74b1('0x69'),_0x74b1('0x6a')));}_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x4,_0x74b1('0x6b'),_0x5ada76[_0x74b1('0x57')]+','+_0x74b1('0x6c')+(0x8+_0x1709d9[_0x74b1('0x2d')][_0x74b1('0x39')])+'}'+','+0x1));return _0x425f9f;}function formatPrefixName(_0x8b4902){var _0x44563d='_';for(var _0x2a33c9=0x0;_0x2a33c9<_0x8b4902['length'];_0x2a33c9++){if(_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)=='-'){_0x44563d+=_0x8b4902[_0x74b1('0x6d')](_0x2a33c9);}else{_0x44563d+='['+_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)+']';}}_0x44563d+='.';return _0x44563d;}exports[_0x74b1('0x26')]=function(_0x30692c,_0x228f8f,_0x2e94d6){var _0x7e2bcc=_0x30692c[_0x74b1('0x6e')];_0x7e2bcc['prefix']=_0x74b1('0x6f')+_0x7e2bcc['name']+'-';return db[_0x74b1('0x4d')]['transaction'](function(_0x5886d1){return db[_0x74b1('0x30')][_0x74b1('0x26')](_0x7e2bcc,{'where':{'id':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x28')]({'where':{'VoicePrefixId':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x4a')]({'where':{'id':_0x7e2bcc[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x21e767){return createVoicePrefixExtensions(_0x7e2bcc,_0x21e767,_0x5886d1);});});});})[_0x74b1('0x27')](function(){return db[_0x74b1('0x30')][_0x74b1('0x70')](_0x7e2bcc['id']);})[_0x74b1('0x27')](respondWithResult(_0x228f8f,null))[_0x74b1('0x45')](handleError(_0x228f8f,null));};exports[_0x74b1('0x71')]=function(_0x542ee7,_0x2b1119,_0x3267ef){return db[_0x74b1('0x30')]['find']({'where':{'id':_0x542ee7[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2b1119,null))[_0x74b1('0x27')](function(_0x1a6a70){if(_0x1a6a70){return _0x1a6a70[_0x74b1('0x71')](_0x542ee7['body'][_0x74b1('0x72')],_[_0x74b1('0x73')](_0x542ee7[_0x74b1('0x6e')],[_0x74b1('0x72'),'id'])||{})[_0x74b1('0x74')](function(_0x36733f){for(var _0x359e05=0x0;_0x359e05<_0x542ee7[_0x74b1('0x6e')]['ids'][_0x74b1('0x39')];_0x359e05+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':Number(_0x542ee7['body']['ids'][_0x359e05]),'VoicePrefixId':Number(_0x542ee7[_0x74b1('0x46')]['id'])});}return _0x36733f;});}})[_0x74b1('0x27')](respondWithResult(_0x2b1119,null))[_0x74b1('0x45')](handleError(_0x2b1119,null));};exports[_0x74b1('0x77')]=function(_0x2de935,_0x5d8729,_0x42a630){return db['VoicePrefix']['find']({'where':{'id':_0x2de935[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5d8729,null))[_0x74b1('0x27')](function(_0x2da0f2){if(_0x2da0f2){return _0x2da0f2[_0x74b1('0x77')](_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')])[_0x74b1('0x27')](function(){if(_['isArray'](_0x2de935['query']['ids'])){for(var _0x7ec28f=0x0;_0x7ec28f<_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x74b1('0x39')];_0x7ec28f+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x7ec28f]),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}}else{socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')]['ids']),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}});}})[_0x74b1('0x27')](respondWithStatusCode(_0x5d8729,null))[_0x74b1('0x45')](handleError(_0x5d8729,null));};exports[_0x74b1('0x79')]=function(_0x25f929,_0x138f79,_0x5a07a6){var _0x2567d7={};var _0x32eb2d={};var _0x21c54f;var _0x4b025c;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x25f929[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x138f79,null))['then'](function(_0x7d3f08){if(_0x7d3f08){_0x21c54f=_0x7d3f08;_0x32eb2d[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x7b')][_0x74b1('0x47')]);_0x32eb2d['query']=_[_0x74b1('0x33')](_0x25f929[_0x74b1('0x32')]);_0x32eb2d['filters']=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],_0x32eb2d['query']);_0x2567d7[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],qs[_0x74b1('0x37')](_0x25f929['query']['fields']));_0x2567d7[_0x74b1('0x38')]=_0x2567d7[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2567d7['attributes']:_0x32eb2d[_0x74b1('0x36')];_0x2567d7[_0x74b1('0x3c')]=qs['sort'](_0x25f929['query'][_0x74b1('0x3d')]);_0x2567d7[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_['pick'](_0x25f929[_0x74b1('0x32')],_0x32eb2d[_0x74b1('0x34')]));if(_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]){_0x2567d7['where']=_['merge'](_0x2567d7[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x2567d7['attributes'],function(_0x1bf4a4){var _0x258b8f={};_0x258b8f[_0x1bf4a4]={'$like':'%'+_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]+'%'};return _0x258b8f;})});}_0x2567d7=_[_0x74b1('0x42')]({},_0x2567d7,_0x25f929[_0x74b1('0x49')]);return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x21453e){if(_0x21453e){_0x4b025c=_0x21453e[_0x74b1('0x39')];if(!_0x25f929['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2567d7[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x25f929[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2567d7['offset']=qs[_0x74b1('0x1e')](_0x25f929['query'][_0x74b1('0x1e')]);}return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x4fcd9a){if(_0x4fcd9a){return _0x4fcd9a?{'count':_0x4b025c,'rows':_0x4fcd9a}:null;}})[_0x74b1('0x27')](respondWithResult(_0x138f79,null))[_0x74b1('0x45')](handleError(_0x138f79,null));};exports['getTeams']=function(_0x4a9ec5,_0x5c02fc,_0x1cbfde){var _0x6ac5ae={};var _0x1a223d={};var _0x25624b;var _0xb24035;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x4a9ec5[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5c02fc,null))[_0x74b1('0x27')](function(_0x220cbf){if(_0x220cbf){_0x25624b=_0x220cbf;_0x1a223d[_0x74b1('0x36')]=_['keys'](db[_0x74b1('0x7c')][_0x74b1('0x47')]);_0x1a223d[_0x74b1('0x32')]=_['keys'](_0x4a9ec5[_0x74b1('0x32')]);_0x1a223d[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x1a223d['model'],_0x1a223d[_0x74b1('0x32')]);_0x6ac5ae[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x1a223d['model'],qs[_0x74b1('0x37')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x37')]));_0x6ac5ae[_0x74b1('0x38')]=_0x6ac5ae[_0x74b1('0x38')][_0x74b1('0x39')]?_0x6ac5ae[_0x74b1('0x38')]:_0x1a223d[_0x74b1('0x36')];_0x6ac5ae[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x6ac5ae[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_[_0x74b1('0x3f')](_0x4a9ec5[_0x74b1('0x32')],_0x1a223d[_0x74b1('0x34')]));if(_0x4a9ec5['query'][_0x74b1('0x40')]){_0x6ac5ae[_0x74b1('0x3e')]=_['merge'](_0x6ac5ae[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x6ac5ae[_0x74b1('0x38')],function(_0x3e3dfb){var _0x1a5c1e={};_0x1a5c1e[_0x3e3dfb]={'$like':'%'+_0x4a9ec5[_0x74b1('0x32')]['filter']+'%'};return _0x1a5c1e;})});}_0x6ac5ae=_['merge']({},_0x6ac5ae,_0x4a9ec5[_0x74b1('0x49')]);return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x401599){if(_0x401599){_0xb24035=_0x401599[_0x74b1('0x39')];if(!_0x4a9ec5[_0x74b1('0x32')]['hasOwnProperty'](_0x74b1('0x3b'))){_0x6ac5ae[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x4a9ec5[_0x74b1('0x32')]['limit']);_0x6ac5ae[_0x74b1('0x1e')]=qs[_0x74b1('0x1e')](_0x4a9ec5['query'][_0x74b1('0x1e')]);}return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x29de45){if(_0x29de45){return _0x29de45?{'count':_0xb24035,'rows':_0x29de45}:null;}})[_0x74b1('0x27')](respondWithResult(_0x5c02fc,null))[_0x74b1('0x45')](handleError(_0x5c02fc,null));};exports[_0x74b1('0x7e')]=function(_0x33b136,_0x4f9b6a,_0x8366b){var _0x2d356c=_0x33b136['body'][_0x74b1('0x72')];var _0x3719d7;return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x2d356c},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':_0x74b1('0x7f'),'attributes':['id',_0x74b1('0x2d'),'online',_0x74b1('0x80'),'interface'],'raw':!![]}]})[_0x74b1('0x27')](function(_0x3bd788){if(_0x3bd788){_0x3719d7=_0x3bd788;var _0x5b4ecf=_[_0x74b1('0x81')](_0x3bd788,function(_0x5dbc1f){var _0x4aa62a=_0x5dbc1f[_0x74b1('0x29')]({'plain':!![]});return _0x4aa62a['Agents'];});return db[_0x74b1('0x30')]['find']({'where':{'id':_0x33b136[_0x74b1('0x46')]['id']}})['then'](function(_0x5b8ba6){return db[_0x74b1('0x4d')]['transaction'](function(_0x2ea97c){return _0x5b8ba6[_0x74b1('0x7e')](_0x2d356c,{'transaction':_0x2ea97c})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x3719d7,function(_0x433293){return db['TeamVoicePrefix'][_0x74b1('0x83')]({'TeamId':_0x433293['id'],'VoicePrefixId':_0x33b136['params']['id']},{'transaction':_0x2ea97c});});})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x5b4ecf,function(_0x110bb6){return db['UserVoicePrefix'][_0x74b1('0x84')]({'where':{'UserId':_0x110bb6['id'],'VoicePrefixId':_0x33b136[_0x74b1('0x46')]['id']},'transaction':_0x2ea97c});});})['then'](function(){_0x5b4ecf[_0x74b1('0x85')](function(_0xbaf7f4){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':_0xbaf7f4['id'],'VoicePrefixId':_0x5b8ba6['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9b6a,null))[_0x74b1('0x45')](handleError(_0x4f9b6a,null));};exports[_0x74b1('0x86')]=function(_0x1f2add,_0x1ab4ea,_0x5b3ae9){return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x1f2add['query'][_0x74b1('0x72')]},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b1('0x27')](handleEntityNotFound(_0x1ab4ea,null))[_0x74b1('0x27')](function(_0x39354d){var _0x484368=_['map'](_0x39354d,'id');var _0xfcd9b=[];var _0x1b3847=[];var _0x4880f6=squel['select']();_0x4880f6[_0x74b1('0x87')](_0x74b1('0x88'))['from'](_0x74b1('0x89'),'tq')[_0x74b1('0x8a')](_0x74b1('0x8b'),'ut',_0x74b1('0x8c'))[_0x74b1('0x3e')](_0x74b1('0x8d'),_0x1f2add[_0x74b1('0x46')]['id']);for(var _0x523ec1=0x0;_0x523ec1<_0x39354d[_0x74b1('0x39')];_0x523ec1+=0x1){let _0x304756=_0x39354d[_0x523ec1];for(var _0x3039d7=0x0;_0x3039d7<_0x304756[_0x74b1('0x7f')][_0x74b1('0x39')];_0x3039d7+=0x1){let _0x367373=_0x304756[_0x74b1('0x7f')][_0x3039d7];var _0x2ee3a7=_0x4880f6[_0x74b1('0x8e')]();_0x2ee3a7[_0x74b1('0x3e')]('ut.UserId\x20=\x20?',_0x367373['id']);_0x1b3847['push'](db['sequelize'][_0x74b1('0x32')](_0x2ee3a7[_0x74b1('0x8f')](),{'type':db['sequelize'][_0x74b1('0x90')][_0x74b1('0x91')]})[_0x74b1('0x27')](function(_0x399c7c){if(_0x399c7c['length']===0x1){return _0x367373['id'];}else{var _0xe421dc=_[_0x74b1('0x92')](_[_0x74b1('0x2f')](_0x399c7c,_0x74b1('0x93')),function(_0x58896f){return _['includes'](_0x484368,_0x58896f);});if(_0xe421dc){return _0x367373['id'];}}}));}}return BPromise['all'](_0x1b3847)[_0x74b1('0x27')](function(_0x20f41b){_0xfcd9b=_(_0xfcd9b)['union'](_0x20f41b)['compact']()['value']();return db[_0x74b1('0x30')]['find']({'where':{'id':_0x1f2add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](function(_0x1326b3){return db['sequelize'][_0x74b1('0x4e')](function(_0x155534){return _0x1326b3['removeTeams'](_0x1f2add[_0x74b1('0x32')][_0x74b1('0x72')],{'transaction':_0x155534})[_0x74b1('0x27')](function(){if(!_[_0x74b1('0x94')](_0xfcd9b)){return _0x1326b3['removeAgents'](_0xfcd9b,{'transaction':_0x155534});}})[_0x74b1('0x27')](function(){_0xfcd9b[_0x74b1('0x85')](function(_0x4a9046){socket[_0x74b1('0x75')]('userVoicePrefix:remove',{'UserId':_0x4a9046,'VoicePrefixId':_0x1326b3['id']});});});});});});})[_0x74b1('0x27')](respondWithStatusCode(_0x1ab4ea,null))[_0x74b1('0x45')](handleError(_0x1ab4ea,null));}; \ No newline at end of file +var _0xd824=['NoOp','charAt','system-','transaction','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','sort','pick','nolimit','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','select','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes','all','value','removeTeams','isEmpty','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','name','index','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','describe','create','sequelize','body','VoiceExtension','find','VoiceExtensionId','user','role','userProfileId','autoAssociation','UserProfileResource','context','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL='];(function(_0x5bd776,_0x119083){var _0x10fc41=function(_0x53e9dc){while(--_0x53e9dc){_0x5bd776['push'](_0x5bd776['shift']());}};_0x10fc41(++_0x119083);}(_0xd824,0xc2));var _0x4d82=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd824[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4d82('0x14')]=_[_0x4d82('0x15')](config[_0x4d82('0x14')],{'host':_0x4d82('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0x14')]));require(_0x4d82('0x17'))[_0x4d82('0x18')](socket);function respondWithStatusCode(_0x486152,_0x70c598){_0x70c598=_0x70c598||0xcc;return function(_0x4f4c45){if(_0x4f4c45){return _0x486152[_0x4d82('0x19')](_0x70c598);}return _0x486152['status'](_0x70c598)[_0x4d82('0x1a')]();};}function respondWithResult(_0x496f3b,_0x474acf){_0x474acf=_0x474acf||0xc8;return function(_0xb1640d){if(_0xb1640d){return _0x496f3b[_0x4d82('0x1b')](_0x474acf)[_0x4d82('0x1c')](_0xb1640d);}};}function respondWithFilteredResult(_0x2648a8,_0x7c03fc){return function(_0x258c59){if(_0x258c59){var _0x217b72=typeof _0x7c03fc[_0x4d82('0x1d')]==='undefined'&&typeof _0x7c03fc[_0x4d82('0x1e')]===_0x4d82('0x1f');var _0x1b1e39=_0x258c59[_0x4d82('0x20')];var _0xe6260=_0x217b72?0x0:_0x7c03fc[_0x4d82('0x1d')];var _0x1a513d=_0x217b72?_0x258c59[_0x4d82('0x20')]:_0x7c03fc[_0x4d82('0x1d')]+_0x7c03fc[_0x4d82('0x1e')];var _0xf2f5a5;if(_0x1a513d>=_0x1b1e39){_0x1a513d=_0x1b1e39;_0xf2f5a5=0xc8;}else{_0xf2f5a5=0xce;}_0x2648a8['status'](_0xf2f5a5);return _0x2648a8[_0x4d82('0x21')](_0x4d82('0x22'),_0xe6260+'-'+_0x1a513d+'/'+_0x1b1e39)['json'](_0x258c59);}return null;};}function patchUpdates(_0x1a419f){return function(_0x41f194){try{jsonpatch[_0x4d82('0x23')](_0x41f194,_0x1a419f,!![]);}catch(_0x14a2d4){return BPromise[_0x4d82('0x24')](_0x14a2d4);}return _0x41f194[_0x4d82('0x25')]();};}function saveUpdates(_0x11c043,_0x462258){return function(_0x12feab){if(_0x12feab){return _0x12feab[_0x4d82('0x26')](_0x11c043)[_0x4d82('0x27')](function(_0x395efc){return _0x395efc;});}return null;};}function removeEntity(_0x7404ba,_0x284c66){return function(_0x1940ef){if(_0x1940ef){return _0x1940ef['destroy']()['then'](function(){var _0x3dcb0f=_0x1940ef[_0x4d82('0x28')]({'plain':!![]});var _0x2a0572=_0x4d82('0x29');return db['UserProfileResource'][_0x4d82('0x2a')]({'where':{'type':_0x2a0572,'resourceId':_0x3dcb0f['id']}})[_0x4d82('0x27')](function(){return _0x1940ef;});})[_0x4d82('0x27')](function(){_0x7404ba[_0x4d82('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4081f6,_0x4a7444){return function(_0x4d9ac4){if(!_0x4d9ac4){_0x4081f6['sendStatus'](0x194);}return _0x4d9ac4;};}function handleError(_0x52533b,_0x3d2229){_0x3d2229=_0x3d2229||0x1f4;return function(_0x8cfbf1){logger[_0x4d82('0x2b')](_0x8cfbf1['stack']);if(_0x8cfbf1[_0x4d82('0x2c')]){delete _0x8cfbf1[_0x4d82('0x2c')];}_0x52533b['status'](_0x3d2229)['send'](_0x8cfbf1);};}exports[_0x4d82('0x2d')]=function(_0x46a058,_0x16d30a){var _0x175961={},_0x5447f8={},_0x33d2a9={'count':0x0,'rows':[]};var _0x59cd4f=_[_0x4d82('0x2e')](db[_0x4d82('0x2f')]['rawAttributes'],function(_0x583cc5){return{'name':_0x583cc5[_0x4d82('0x30')],'type':_0x583cc5[_0x4d82('0x31')][_0x4d82('0x32')]};});_0x5447f8[_0x4d82('0x33')]=_[_0x4d82('0x2e')](_0x59cd4f,_0x4d82('0x2c'));_0x5447f8[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x46a058[_0x4d82('0x34')]);_0x5447f8[_0x4d82('0x36')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],_0x5447f8[_0x4d82('0x34')]);_0x175961[_0x4d82('0x37')]=_['intersection'](_0x5447f8[_0x4d82('0x33')],qs[_0x4d82('0x38')](_0x46a058['query'][_0x4d82('0x38')]));_0x175961[_0x4d82('0x37')]=_0x175961[_0x4d82('0x37')]['length']?_0x175961[_0x4d82('0x37')]:_0x5447f8[_0x4d82('0x33')];if(!_0x46a058['query'][_0x4d82('0x39')]('nolimit')){_0x175961[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x46a058['query'][_0x4d82('0x1e')]);_0x175961['offset']=qs[_0x4d82('0x1d')](_0x46a058['query']['offset']);}_0x175961[_0x4d82('0x3a')]=qs['sort'](_0x46a058[_0x4d82('0x34')]['sort']);_0x175961[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0x46a058[_0x4d82('0x34')],_0x5447f8['filters']),_0x59cd4f);if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x175961['where']=_[_0x4d82('0x3d')](_0x175961['where'],{'$or':_[_0x4d82('0x2e')](_0x59cd4f,function(_0x54f714){if(_0x54f714[_0x4d82('0x31')]!==_0x4d82('0x3e')){var _0x1d9e8b={};_0x1d9e8b[_0x54f714[_0x4d82('0x2c')]]={'$like':'%'+_0x46a058['query'][_0x4d82('0x3c')]+'%'};return _0x1d9e8b;}})});}_0x175961=_[_0x4d82('0x3d')]({},_0x175961,_0x46a058[_0x4d82('0x3f')]);var _0x3e29a6={'where':_0x175961[_0x4d82('0x3b')]};return db[_0x4d82('0x2f')][_0x4d82('0x20')](_0x3e29a6)['then'](function(_0x3c80d6){_0x33d2a9[_0x4d82('0x20')]=_0x3c80d6;if(_0x46a058[_0x4d82('0x34')][_0x4d82('0x40')]){_0x175961[_0x4d82('0x41')]=[{'all':!![]}];}return db['VoicePrefix'][_0x4d82('0x42')](_0x175961);})[_0x4d82('0x27')](function(_0x3f0a9f){_0x33d2a9[_0x4d82('0x43')]=_0x3f0a9f;return _0x33d2a9;})[_0x4d82('0x27')](respondWithFilteredResult(_0x16d30a,_0x175961))[_0x4d82('0x44')](handleError(_0x16d30a,null));};exports[_0x4d82('0x45')]=function(_0x5847c0,_0xe8c15f){var _0x1909da={'raw':![],'where':{'id':_0x5847c0[_0x4d82('0x46')]['id']}},_0x55e2f7={};_0x55e2f7['model']=_[_0x4d82('0x35')](db[_0x4d82('0x2f')]['rawAttributes']);_0x55e2f7[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0x5847c0['query']);_0x55e2f7[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x55e2f7[_0x4d82('0x33')],_0x55e2f7['query']);_0x1909da[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x55e2f7['model'],qs['fields'](_0x5847c0[_0x4d82('0x34')][_0x4d82('0x38')]));_0x1909da[_0x4d82('0x37')]=_0x1909da[_0x4d82('0x37')][_0x4d82('0x48')]?_0x1909da[_0x4d82('0x37')]:_0x55e2f7[_0x4d82('0x33')];if(_0x5847c0['query'][_0x4d82('0x40')]){_0x1909da[_0x4d82('0x41')]=[{'all':!![]}];}_0x1909da=_[_0x4d82('0x3d')]({},_0x1909da,_0x5847c0[_0x4d82('0x3f')]);return db['VoicePrefix']['find'](_0x1909da)['then'](handleEntityNotFound(_0xe8c15f,null))[_0x4d82('0x27')](respondWithResult(_0xe8c15f,null))[_0x4d82('0x44')](handleError(_0xe8c15f,null));};exports[_0x4d82('0x2a')]=function(_0x34a08b,_0x25fc80){return db[_0x4d82('0x2f')]['find']({'where':{'id':_0x34a08b[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x25fc80,null))[_0x4d82('0x27')](removeEntity(_0x25fc80,null))[_0x4d82('0x44')](handleError(_0x25fc80,null));};exports[_0x4d82('0x49')]=function(_0x33f498,_0x127ef3){return db[_0x4d82('0x2f')][_0x4d82('0x49')]()['then'](respondWithResult(_0x127ef3,null))[_0x4d82('0x44')](handleError(_0x127ef3,null));};exports[_0x4d82('0x4a')]=function(_0x1822db,_0x25e8b9){var _0x1d853f;return db[_0x4d82('0x4b')]['transaction'](function(_0x5cf138){return db[_0x4d82('0x2f')][_0x4d82('0x4a')](_0x1822db[_0x4d82('0x4c')],{'transaction':_0x5cf138})[_0x4d82('0x27')](function(_0x2e373a){_0x1d853f=_0x2e373a[_0x4d82('0x28')]({'plain':!![]});return db[_0x4d82('0x4d')][_0x4d82('0x4e')]({'where':{'id':_0x1d853f[_0x4d82('0x4f')]},'raw':!![]})[_0x4d82('0x27')](function(_0x367c82){return createVoicePrefixExtensions(_0x1d853f,_0x367c82,_0x5cf138);});});})[_0x4d82('0x27')](function(){var _0x517f87=_0x1822db[_0x4d82('0x50')]['get']({'plain':!![]});if(!_0x517f87)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517f87[_0x4d82('0x51')]===_0x4d82('0x50')){var _0x257dc4=_0x1d853f;return db['UserProfileSection'][_0x4d82('0x4e')]({'where':{'name':_0x4d82('0x29'),'userProfileId':_0x517f87[_0x4d82('0x52')]},'raw':!![]})[_0x4d82('0x27')](function(_0x4aaa65){if(_0x4aaa65&&_0x4aaa65[_0x4d82('0x53')]===0x0){return db[_0x4d82('0x54')][_0x4d82('0x4a')]({'name':_0x257dc4[_0x4d82('0x2c')],'resourceId':_0x257dc4['id'],'type':_0x4aaa65[_0x4d82('0x2c')],'sectionId':_0x4aaa65['id']},{})['then'](function(){return _0x1d853f;});}else{return _0x1d853f;}})[_0x4d82('0x44')](function(_0x3297ce){logger[_0x4d82('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3297ce);throw _0x3297ce;});}return _0x1d853f;})[_0x4d82('0x27')](respondWithResult(_0x25e8b9,null))[_0x4d82('0x44')](handleError(_0x25e8b9,null));};function Extension(_0x131bb5,_0x189e3f,_0x14e621,_0x3148bd){this[_0x4d82('0x55')]='from-sip';this['exten']=_0x131bb5;this[_0x4d82('0x56')]=_0x14e621;this[_0x4d82('0x31')]=_0x4d82('0x57');this['description']=_0x4d82('0x58');this[_0x4d82('0x59')]=_0x189e3f;this[_0x4d82('0x5a')]=_0x3148bd;}function createVoicePrefixExtensions(_0x3d85c2,_0x238459,_0x2aec60){return new BPromise(function(_0xa2cdb3,_0xc70504){var _0x131a10=new Extension(formatPrefixName(_0x3d85c2[_0x4d82('0x5b')]),0x1,'NoOp','Voice\x20Prefix');_0x131a10[_0x4d82('0x5c')]=_0x3d85c2['id'];return db[_0x4d82('0x4d')][_0x4d82('0x4a')](_0x131a10,{'transaction':_0x2aec60})['then'](function(_0x471349){var _0xc80c61=_0x471349[_0x4d82('0x28')]({'plain':!![]});var _0x328991=_[_0x4d82('0x2e')](addVoicePrefixExtensions(_0x3d85c2,_0x238459),function(_0x43c72e){_0x43c72e[_0x4d82('0x4f')]=_0xc80c61['id'];_0x43c72e[_0x4d82('0x5c')]=_0x3d85c2['id'];return _0x43c72e;});return db['VoiceExtension'][_0x4d82('0x5d')](_0x328991,{'transaction':_0x2aec60})[_0x4d82('0x27')](function(_0x279172){if(!_0x279172){return _0xc70504('Extensions\x20creation\x20failed');}else{return _0xa2cdb3(_0x279172);}})['catch'](function(_0x1d3e90){return _0xc70504(_0x1d3e90);});});;});};function addVoicePrefixExtensions(_0xc5b353,_0x1a785a){var _0x15d620=[];var _0x2872bf=formatPrefixName(_0xc5b353[_0x4d82('0x5b')]);_0x15d620['push'](new Extension(_0x2872bf,0x2,_0x4d82('0x5e'),_0x4d82('0x5f')+_0xc5b353[_0x4d82('0x2c')]));if(_0xc5b353['callerIdAll']){_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x5e'),_0x4d82('0x61')+_0xc5b353['callerIdAll']));}else{_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x3,_0x4d82('0x62'),'No\x20callerid\x20available'));}_0x15d620[_0x4d82('0x60')](new Extension(_0x2872bf,0x4,'goto',_0x1a785a[_0x4d82('0x55')]+','+'${EXTEN:'+(0x8+_0xc5b353['name'][_0x4d82('0x48')])+'}'+','+0x1));return _0x15d620;}function formatPrefixName(_0x32e291){var _0x5279e3='_';for(var _0x307592=0x0;_0x307592<_0x32e291['length'];_0x307592++){if(_0x32e291[_0x4d82('0x63')](_0x307592)=='-'){_0x5279e3+=_0x32e291['charAt'](_0x307592);}else{_0x5279e3+='['+_0x32e291[_0x4d82('0x63')](_0x307592)+']';}}_0x5279e3+='.';return _0x5279e3;}exports[_0x4d82('0x26')]=function(_0x2fcf61,_0x75900c,_0x9c5e5c){var _0x456f33=_0x2fcf61[_0x4d82('0x4c')];_0x456f33[_0x4d82('0x5b')]=_0x4d82('0x64')+_0x456f33[_0x4d82('0x2c')]+'-';return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x14d697){return db[_0x4d82('0x2f')][_0x4d82('0x26')](_0x456f33,{'where':{'id':_0x456f33['id']},'transaction':_0x14d697})[_0x4d82('0x27')](function(){return db[_0x4d82('0x4d')][_0x4d82('0x2a')]({'where':{'VoicePrefixId':_0x456f33['id']},'transaction':_0x14d697})['then'](function(){return db['VoiceExtension'][_0x4d82('0x4e')]({'where':{'id':_0x456f33['VoiceExtensionId']},'raw':!![]})[_0x4d82('0x27')](function(_0x47644d){return createVoicePrefixExtensions(_0x456f33,_0x47644d,_0x14d697);});});});})[_0x4d82('0x27')](function(){return db[_0x4d82('0x2f')][_0x4d82('0x66')](_0x456f33['id']);})[_0x4d82('0x27')](respondWithResult(_0x75900c,null))['catch'](handleError(_0x75900c,null));};exports[_0x4d82('0x67')]=function(_0x220e87,_0x554778,_0x80d688){return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0x220e87[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x554778,null))[_0x4d82('0x27')](function(_0x212561){if(_0x212561){return _0x212561[_0x4d82('0x67')](_0x220e87['body']['ids'],_['omit'](_0x220e87['body'],['ids','id'])||{})[_0x4d82('0x68')](function(_0x245e97){for(var _0x1fe26a=0x0;_0x1fe26a<_0x220e87['body'][_0x4d82('0x69')][_0x4d82('0x48')];_0x1fe26a+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':Number(_0x220e87[_0x4d82('0x4c')]['ids'][_0x1fe26a]),'VoicePrefixId':Number(_0x220e87['params']['id'])});}return _0x245e97;});}})[_0x4d82('0x27')](respondWithResult(_0x554778,null))[_0x4d82('0x44')](handleError(_0x554778,null));};exports[_0x4d82('0x6c')]=function(_0x2471b8,_0xd64d2a,_0x353c18){return db['VoicePrefix'][_0x4d82('0x4e')]({'where':{'id':_0x2471b8['params']['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0xd64d2a,null))[_0x4d82('0x27')](function(_0x28a256){if(_0x28a256){return _0x28a256[_0x4d82('0x6c')](_0x2471b8[_0x4d82('0x34')]['ids'])[_0x4d82('0x27')](function(){if(_[_0x4d82('0x6d')](_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')])){for(var _0x2a50b3=0x0;_0x2a50b3<_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')][_0x4d82('0x48')];_0x2a50b3+=0x1){socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')]['ids'][_0x2a50b3]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}}else{socket[_0x4d82('0x6a')](_0x4d82('0x6e'),{'UserId':Number(_0x2471b8[_0x4d82('0x34')][_0x4d82('0x69')]),'VoicePrefixId':Number(_0x2471b8[_0x4d82('0x46')]['id'])});}});}})[_0x4d82('0x27')](respondWithStatusCode(_0xd64d2a,null))['catch'](handleError(_0xd64d2a,null));};exports[_0x4d82('0x6f')]=function(_0x3b7592,_0x5380ce,_0x21ea7c){var _0x588471={};var _0x634bfb={};var _0x5092ff;var _0x472666;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0x3b7592[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5380ce,null))['then'](function(_0x960e9){if(_0x960e9){_0x5092ff=_0x960e9;_0x634bfb[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x71')][_0x4d82('0x72')]);_0x634bfb[_0x4d82('0x34')]=_['keys'](_0x3b7592['query']);_0x634bfb[_0x4d82('0x36')]=_[_0x4d82('0x47')](_0x634bfb[_0x4d82('0x33')],_0x634bfb[_0x4d82('0x34')]);_0x588471[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x634bfb['model'],qs[_0x4d82('0x38')](_0x3b7592[_0x4d82('0x34')]['fields']));_0x588471[_0x4d82('0x37')]=_0x588471[_0x4d82('0x37')][_0x4d82('0x48')]?_0x588471['attributes']:_0x634bfb[_0x4d82('0x33')];_0x588471[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0x3b7592[_0x4d82('0x34')]['sort']);_0x588471[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_[_0x4d82('0x74')](_0x3b7592[_0x4d82('0x34')],_0x634bfb['filters']));if(_0x3b7592[_0x4d82('0x34')]['filter']){_0x588471['where']=_[_0x4d82('0x3d')](_0x588471[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x588471[_0x4d82('0x37')],function(_0xb2d707){var _0x49d4ed={};_0x49d4ed[_0xb2d707]={'$like':'%'+_0x3b7592[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x49d4ed;})});}_0x588471=_['merge']({},_0x588471,_0x3b7592[_0x4d82('0x3f')]);return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x210ed6){if(_0x210ed6){_0x472666=_0x210ed6['length'];if(!_0x3b7592[_0x4d82('0x34')]['hasOwnProperty'](_0x4d82('0x75'))){_0x588471[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x588471[_0x4d82('0x1d')]=qs['offset'](_0x3b7592[_0x4d82('0x34')][_0x4d82('0x1d')]);}return _0x5092ff[_0x4d82('0x6f')](_0x588471);}})[_0x4d82('0x27')](function(_0x2c80ae){if(_0x2c80ae){return _0x2c80ae?{'count':_0x472666,'rows':_0x2c80ae}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5380ce,null))[_0x4d82('0x44')](handleError(_0x5380ce,null));};exports['getTeams']=function(_0xfb0987,_0x5a65e4,_0x252db4){var _0x24a63a={};var _0x2d0b29={};var _0x44c35f;var _0x54fcd4;return db['VoicePrefix'][_0x4d82('0x70')]({'where':{'id':_0xfb0987[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](handleEntityNotFound(_0x5a65e4,null))[_0x4d82('0x27')](function(_0x45b2e3){if(_0x45b2e3){_0x44c35f=_0x45b2e3;_0x2d0b29[_0x4d82('0x33')]=_['keys'](db[_0x4d82('0x76')][_0x4d82('0x72')]);_0x2d0b29[_0x4d82('0x34')]=_[_0x4d82('0x35')](_0xfb0987[_0x4d82('0x34')]);_0x2d0b29['filters']=_[_0x4d82('0x47')](_0x2d0b29[_0x4d82('0x33')],_0x2d0b29[_0x4d82('0x34')]);_0x24a63a[_0x4d82('0x37')]=_[_0x4d82('0x47')](_0x2d0b29['model'],qs[_0x4d82('0x38')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x38')]));_0x24a63a[_0x4d82('0x37')]=_0x24a63a[_0x4d82('0x37')][_0x4d82('0x48')]?_0x24a63a['attributes']:_0x2d0b29['model'];_0x24a63a[_0x4d82('0x3a')]=qs[_0x4d82('0x73')](_0xfb0987[_0x4d82('0x34')]['sort']);_0x24a63a[_0x4d82('0x3b')]=qs[_0x4d82('0x36')](_['pick'](_0xfb0987[_0x4d82('0x34')],_0x2d0b29[_0x4d82('0x36')]));if(_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]){_0x24a63a[_0x4d82('0x3b')]=_[_0x4d82('0x3d')](_0x24a63a[_0x4d82('0x3b')],{'$or':_[_0x4d82('0x2e')](_0x24a63a['attributes'],function(_0x5471c3){var _0x1d1329={};_0x1d1329[_0x5471c3]={'$like':'%'+_0xfb0987[_0x4d82('0x34')][_0x4d82('0x3c')]+'%'};return _0x1d1329;})});}_0x24a63a=_['merge']({},_0x24a63a,_0xfb0987[_0x4d82('0x3f')]);return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})[_0x4d82('0x27')](function(_0x5a9056){if(_0x5a9056){_0x54fcd4=_0x5a9056[_0x4d82('0x48')];if(!_0xfb0987['query']['hasOwnProperty'](_0x4d82('0x75'))){_0x24a63a[_0x4d82('0x1e')]=qs[_0x4d82('0x1e')](_0xfb0987[_0x4d82('0x34')][_0x4d82('0x1e')]);_0x24a63a[_0x4d82('0x1d')]=qs[_0x4d82('0x1d')](_0xfb0987[_0x4d82('0x34')]['offset']);}return _0x44c35f[_0x4d82('0x77')](_0x24a63a);}})['then'](function(_0xc764bb){if(_0xc764bb){return _0xc764bb?{'count':_0x54fcd4,'rows':_0xc764bb}:null;}})[_0x4d82('0x27')](respondWithResult(_0x5a65e4,null))[_0x4d82('0x44')](handleError(_0x5a65e4,null));};exports['addTeams']=function(_0xead937,_0x59e1bc,_0x521566){var _0x1eda7c=_0xead937['body'][_0x4d82('0x69')];var _0x5ac864;return db[_0x4d82('0x76')][_0x4d82('0x42')]({'where':{'id':_0x1eda7c},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4d82('0x78'),'attributes':['id',_0x4d82('0x2c'),_0x4d82('0x79'),_0x4d82('0x7a'),_0x4d82('0x7b')],'raw':!![]}]})[_0x4d82('0x27')](function(_0x2b832e){if(_0x2b832e){_0x5ac864=_0x2b832e;var _0x402626=_[_0x4d82('0x7c')](_0x2b832e,function(_0x3be4f9){var _0x47c734=_0x3be4f9[_0x4d82('0x28')]({'plain':!![]});return _0x47c734[_0x4d82('0x78')];});return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xead937[_0x4d82('0x46')]['id']}})[_0x4d82('0x27')](function(_0x1768e2){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x1c61f5){return _0x1768e2[_0x4d82('0x7d')](_0x1eda7c,{'transaction':_0x1c61f5})[_0x4d82('0x27')](function(){return BPromise[_0x4d82('0x7e')](_0x5ac864,function(_0x44729c){return db[_0x4d82('0x7f')][_0x4d82('0x80')]({'TeamId':_0x44729c['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},{'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){return BPromise['each'](_0x402626,function(_0x2867e7){return db[_0x4d82('0x81')][_0x4d82('0x82')]({'where':{'UserId':_0x2867e7['id'],'VoicePrefixId':_0xead937[_0x4d82('0x46')]['id']},'transaction':_0x1c61f5});});})[_0x4d82('0x27')](function(){_0x402626['forEach'](function(_0x14b0cb){socket[_0x4d82('0x6a')](_0x4d82('0x6b'),{'UserId':_0x14b0cb['id'],'VoicePrefixId':_0x1768e2['id']});});});});});}})[_0x4d82('0x27')](respondWithStatusCode(_0x59e1bc,null))[_0x4d82('0x44')](handleError(_0x59e1bc,null));};exports['removeTeams']=function(_0xc56d02,_0x34234c,_0x23778f){return db['Team'][_0x4d82('0x42')]({'where':{'id':_0xc56d02['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x4d82('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x34234c,null))[_0x4d82('0x27')](function(_0x1d32c3){var _0x4d0047=_['map'](_0x1d32c3,'id');var _0x4f7c18=[];var _0x4277b7=[];var _0x2b7c2c=squel[_0x4d82('0x83')]();_0x2b7c2c['field']('tq.TeamId')[_0x4d82('0x84')](_0x4d82('0x85'),'tq')[_0x4d82('0x86')](_0x4d82('0x87'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4d82('0x3b')](_0x4d82('0x88'),_0xc56d02[_0x4d82('0x46')]['id']);for(var _0x2c18b2=0x0;_0x2c18b2<_0x1d32c3[_0x4d82('0x48')];_0x2c18b2+=0x1){let _0x37cac6=_0x1d32c3[_0x2c18b2];for(var _0x642d9=0x0;_0x642d9<_0x37cac6['Agents'][_0x4d82('0x48')];_0x642d9+=0x1){let _0x3097f8=_0x37cac6[_0x4d82('0x78')][_0x642d9];var _0x5ccadb=_0x2b7c2c['clone']();_0x5ccadb[_0x4d82('0x3b')](_0x4d82('0x89'),_0x3097f8['id']);_0x4277b7[_0x4d82('0x60')](db['sequelize'][_0x4d82('0x34')](_0x5ccadb[_0x4d82('0x8a')](),{'type':db[_0x4d82('0x4b')][_0x4d82('0x8b')]['SELECT']})[_0x4d82('0x27')](function(_0x3f0228){if(_0x3f0228['length']===0x1){return _0x3097f8['id'];}else{var _0x5f4633=_[_0x4d82('0x8c')](_['map'](_0x3f0228,'TeamId'),function(_0x3e4fb1){return _[_0x4d82('0x8d')](_0x4d0047,_0x3e4fb1);});if(_0x5f4633){return _0x3097f8['id'];}}}));}}return BPromise[_0x4d82('0x8e')](_0x4277b7)['then'](function(_0x4d6de5){_0x4f7c18=_(_0x4f7c18)['union'](_0x4d6de5)['compact']()[_0x4d82('0x8f')]();return db[_0x4d82('0x2f')][_0x4d82('0x4e')]({'where':{'id':_0xc56d02['params']['id']}})[_0x4d82('0x27')](function(_0x227e2c){return db[_0x4d82('0x4b')][_0x4d82('0x65')](function(_0x4f36f5){return _0x227e2c[_0x4d82('0x90')](_0xc56d02['query'][_0x4d82('0x69')],{'transaction':_0x4f36f5})[_0x4d82('0x27')](function(){if(!_[_0x4d82('0x91')](_0x4f7c18)){return _0x227e2c[_0x4d82('0x6c')](_0x4f7c18,{'transaction':_0x4f36f5});}})[_0x4d82('0x27')](function(){_0x4f7c18['forEach'](function(_0x3a0735){socket[_0x4d82('0x6a')]('userVoicePrefix:remove',{'UserId':_0x3a0735,'VoicePrefixId':_0x227e2c['id']});});});});});});})['then'](respondWithStatusCode(_0x34234c,null))['catch'](handleError(_0x34234c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 3c941b3..5cfe67d 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 _0x6d3b=['hook','exports','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0x341088,_0x5b3366){var _0x4f1da4=function(_0x3f4b7d){while(--_0x3f4b7d){_0x341088['push'](_0x341088['shift']());}};_0x4f1da4(++_0x5b3366);}(_0x6d3b,0x10a));var _0xb6d3=function(_0x29c440,_0x32e6b1){_0x29c440=_0x29c440-0x0;var _0x45879e=_0x6d3b[_0x29c440];return _0x45879e;};'use strict';var EventEmitter=require(_0xb6d3('0x0'));var VoicePrefix=require(_0xb6d3('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6d3('0x2'),'afterUpdate':'update','afterDestroy':_0xb6d3('0x3')};function emitEvent(_0x4951ec){return function(_0x5f0a70,_0x36533b,_0x5d3428){VoicePrefixEvents[_0xb6d3('0x4')](_0x4951ec+':'+_0x5f0a70['id'],_0x5f0a70);VoicePrefixEvents[_0xb6d3('0x4')](_0x4951ec,_0x5f0a70);_0x5d3428(null);};}for(var e in events){if(events[_0xb6d3('0x5')](e)){var event=events[e];VoicePrefix[_0xb6d3('0x6')](e,emitEvent(event));}}module[_0xb6d3('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x99e9=['exports','events','VoicePrefix','setMaxListeners','save','remove','emit','hook'];(function(_0xd2439c,_0x46f8fe){var _0x527fd0=function(_0x48c508){while(--_0x48c508){_0xd2439c['push'](_0xd2439c['shift']());}};_0x527fd0(++_0x46f8fe);}(_0x99e9,0x151));var _0x999e=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x99e9[_0x550e29];return _0x3515b6;};'use strict';var EventEmitter=require(_0x999e('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x999e('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x999e('0x2')](0x0);var events={'afterCreate':_0x999e('0x3'),'afterUpdate':'update','afterDestroy':_0x999e('0x4')};function emitEvent(_0x572df1){return function(_0x5a63a3,_0x411bab,_0xbd2ea2){VoicePrefixEvents[_0x999e('0x5')](_0x572df1+':'+_0x5a63a3['id'],_0x5a63a3);VoicePrefixEvents[_0x999e('0x5')](_0x572df1,_0x5a63a3);_0xbd2ea2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x999e('0x6')](e,emitEvent(event));}}module[_0x999e('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 86ff09d..62bf36d 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 _0xa8d5=['request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','lodash','../../config/logger','api','moment','bluebird'];(function(_0x212fad,_0x57222f){var _0x330849=function(_0x76ba07){while(--_0x76ba07){_0x212fad['push'](_0x212fad['shift']());}};_0x330849(++_0x57222f);}(_0xa8d5,0x193));var _0x5a8d=function(_0x151d07,_0x3d388e){_0x151d07=_0x151d07-0x0;var _0x4fa6f2=_0xa8d5[_0x151d07];return _0x4fa6f2;};'use strict';var _=require(_0x5a8d('0x0'));var util=require('util');var logger=require(_0x5a8d('0x1'))(_0x5a8d('0x2'));var moment=require(_0x5a8d('0x3'));var BPromise=require(_0x5a8d('0x4'));var rp=require(_0x5a8d('0x5'));var fs=require('fs');var path=require(_0x5a8d('0x6'));var rimraf=require(_0x5a8d('0x7'));var config=require(_0x5a8d('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x5a8d('0x9')]=function(_0x1dc9e2,_0x4ff055){return _0x1dc9e2[_0x5a8d('0xa')](_0x5a8d('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31d8=['voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','path','./voicePrefix.attributes','define','VoicePrefix'];(function(_0x2c3a33,_0x2c1575){var _0x25c374=function(_0x4be4d3){while(--_0x4be4d3){_0x2c3a33['push'](_0x2c3a33['shift']());}};_0x25c374(++_0x2c1575);}(_0x31d8,0x12a));var _0x831d=function(_0x3c6ec9,_0x40e417){_0x3c6ec9=_0x3c6ec9-0x0;var _0x178f0c=_0x31d8[_0x3c6ec9];return _0x178f0c;};'use strict';var _=require(_0x831d('0x0'));var util=require(_0x831d('0x1'));var logger=require(_0x831d('0x2'))(_0x831d('0x3'));var moment=require('moment');var BPromise=require(_0x831d('0x4'));var rp=require(_0x831d('0x5'));var fs=require('fs');var path=require(_0x831d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x831d('0x7'));module['exports']=function(_0x174606,_0x450811){return _0x174606[_0x831d('0x8')](_0x831d('0x9'),attributes,{'tableName':_0x831d('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 19e80e2..c8aec05 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 _0xcdd2=['./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3495e3,_0x32fe58){var _0x21f6f1=function(_0x4ad057){while(--_0x4ad057){_0x3495e3['push'](_0x3495e3['shift']());}};_0x21f6f1(++_0x32fe58);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});config[_0x2cdd('0xb')]=_[_0x2cdd('0xc')](config[_0x2cdd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2cdd('0xd'))['register'](socket);function respondWithRpcPromise(_0x12cdca,_0x3e3cf0,_0x370b33){return new BPromise(function(_0x555ba7,_0x3feff9){return client[_0x2cdd('0xe')](_0x12cdca,_0x370b33)[_0x2cdd('0xf')](function(_0x20ab30){logger[_0x2cdd('0x10')](_0x2cdd('0x11'),_0x3e3cf0,'request\x20sent');logger['debug'](_0x2cdd('0x12'),_0x3e3cf0,_0x2cdd('0x13'),JSON['stringify'](_0x20ab30));if(_0x20ab30[_0x2cdd('0x14')]){if(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x15')]===0x1f4){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30['error'][_0x2cdd('0x16')]);return _0x3feff9(_0x20ab30[_0x2cdd('0x14')]['message']);}logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);return _0x555ba7(_0x20ab30[_0x2cdd('0x14')][_0x2cdd('0x16')]);}else{logger['info'](_0x2cdd('0x11'),_0x3e3cf0,_0x2cdd('0x13'));_0x555ba7(_0x20ab30[_0x2cdd('0x17')][_0x2cdd('0x16')]);}})['catch'](function(_0x23f7a6){logger[_0x2cdd('0x14')](_0x2cdd('0x11'),_0x3e3cf0,_0x23f7a6);_0x3feff9(_0x23f7a6);});});} \ No newline at end of file +var _0xbd9e=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','info','request\x20sent','debug','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbd9e,0x108));var _0xebd9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xbd9e[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebd9('0x0'));var BPromise=require('bluebird');var rs=require(_0xebd9('0x1'));var fs=require('fs');var Redis=require(_0xebd9('0x2'));var db=require(_0xebd9('0x3'))['db'];var utils=require(_0xebd9('0x4'));var logger=require(_0xebd9('0x5'))('rpc');var config=require(_0xebd9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xebd9('0x7')][_0xebd9('0x8')]({'port':0x232a});config[_0xebd9('0x9')]=_[_0xebd9('0xa')](config[_0xebd9('0x9')],{'host':_0xebd9('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xebd9('0x9')]));require(_0xebd9('0xc'))[_0xebd9('0xd')](socket);function respondWithRpcPromise(_0x406705,_0x16537e,_0x4b1985){return new BPromise(function(_0x35fcfd,_0x5eda85){return client[_0xebd9('0xe')](_0x406705,_0x4b1985)['then'](function(_0x40c787){logger[_0xebd9('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x16537e,_0xebd9('0x10'));logger[_0xebd9('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x16537e,_0xebd9('0x10'),JSON[_0xebd9('0x12')](_0x40c787));if(_0x40c787[_0xebd9('0x13')]){if(_0x40c787[_0xebd9('0x13')]['code']===0x1f4){logger[_0xebd9('0x13')](_0xebd9('0x14'),_0x16537e,_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);return _0x5eda85(_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);}logger[_0xebd9('0x13')](_0xebd9('0x14'),_0x16537e,_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);return _0x35fcfd(_0x40c787[_0xebd9('0x13')][_0xebd9('0x15')]);}else{logger[_0xebd9('0xf')](_0xebd9('0x14'),_0x16537e,'request\x20sent');_0x35fcfd(_0x40c787[_0xebd9('0x16')][_0xebd9('0x15')]);}})[_0xebd9('0x17')](function(_0x4d793e){logger[_0xebd9('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x16537e,_0x4d793e);_0x5eda85(_0x4d793e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d2a7a88..d8bfe6e 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 _0xc5ba=['length','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x4e0dae,_0x5e96b5){var _0x1e9dec=function(_0x1bb51e){while(--_0x1bb51e){_0x4e0dae['push'](_0x4e0dae['shift']());}};_0x1e9dec(++_0x5e96b5);}(_0xc5ba,0xb9));var _0xac5b=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xc5ba[_0x12d812];return _0x3711ab;};'use strict';var VoicePrefixEvents=require(_0xac5b('0x0'));var events=[_0xac5b('0x1'),_0xac5b('0x2'),_0xac5b('0x3')];function createListener(_0x2faba9,_0x34fad9){return function(_0x3158cd){_0x34fad9[_0xac5b('0x4')](_0x2faba9,_0x3158cd);};}function removeListener(_0x3d0dc6,_0x3c48f1){return function(){VoicePrefixEvents[_0xac5b('0x5')](_0x3d0dc6,_0x3c48f1);};}exports[_0xac5b('0x6')]=function(_0x23cf2f){for(var _0x17fcf3=0x0,_0x38602a=events[_0xac5b('0x7')];_0x17fcf3<_0x38602a;_0x17fcf3++){var _0xc193a7=events[_0x17fcf3];var _0x4a7fc7=createListener('voicePrefix:'+_0xc193a7,_0x23cf2f);VoicePrefixEvents['on'](_0xc193a7,_0x4a7fc7);}}; \ No newline at end of file +var _0x4584=['remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x4584,0x1cf));var _0x4458=function(_0x264d6f,_0x2bf363){_0x264d6f=_0x264d6f-0x0;var _0x26bb6f=_0x4584[_0x264d6f];return _0x26bb6f;};'use strict';var VoicePrefixEvents=require(_0x4458('0x0'));var events=['save',_0x4458('0x1'),_0x4458('0x2')];function createListener(_0x23b438,_0x5340f5){return function(_0x570b9c){_0x5340f5[_0x4458('0x3')](_0x23b438,_0x570b9c);};}function removeListener(_0xde5996,_0x37118c){return function(){VoicePrefixEvents[_0x4458('0x4')](_0xde5996,_0x37118c);};}exports[_0x4458('0x5')]=function(_0xbf85ca){for(var _0x175c2d=0x0,_0x215b2d=events[_0x4458('0x6')];_0x175c2d<_0x215b2d;_0x175c2d++){var _0x51da14=events[_0x175c2d];var _0x14bb0f=createListener(_0x4458('0x7')+_0x51da14,_0xbf85ca);VoicePrefixEvents['on'](_0x51da14,_0x14bb0f);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 50bf196..bef376e 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x48bc0d,_0x30becd){_0x48bc0d=_0x48bc0d-0x0;var _0x35f641=_0xb10b[_0x48bc0d];return _0x35f641;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xe69bf1,_0x487cbc){var _0x1259d1=function(_0x5e610d){while(--_0x5e610d){_0xe69bf1['push'](_0xe69bf1['shift']());}};_0x1259d1(++_0x487cbc);}(_0xb10b,0x12a));var _0xbb10=function(_0x557bf4,_0x1f8dad){_0x557bf4=_0x557bf4-0x0;var _0x2916e2=_0xb10b[_0x557bf4];return _0x2916e2;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9b6027d..f87e9ee 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 _0x1758=['tTxX','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'];(function(_0x2e628b,_0xc7920){var _0x4beb0f=function(_0x4f1be1){while(--_0x4f1be1){_0x2e628b['push'](_0x2e628b['shift']());}};_0x4beb0f(++_0xc7920);}(_0x1758,0x111));var _0x8175=function(_0x4a456f,_0x283d9){_0x4a456f=_0x4a456f-0x0;var _0x4c6ca7=_0x1758[_0x4a456f];return _0x4c6ca7;};'use strict';var Sequelize=require(_0x8175('0x0'));module[_0x8175('0x1')]={'name':{'type':Sequelize[_0x8175('0x2')],'allowNull':![],'unique':_0x8175('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x5'),_0x8175('0x6')),'allowNull':![],'defaultValue':_0x8175('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x8175('0x7')},'announce':{'type':Sequelize[_0x8175('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x8175('0x4')]('rr',_0x8175('0x8'),_0x8175('0x9'),'fewestcalls',_0x8175('0xa'),_0x8175('0xb'),_0x8175('0xc'),'wrandom',_0x8175('0xd')),'allowNull':![],'defaultValue':_0x8175('0x8'),'set':function(_0x2b088c){this['setDataValue'](_0x8175('0xe'),_0x2b088c?_0x2b088c:_0x8175('0xb'));},'get':function(){var _0x5bcb69=this[_0x8175('0xf')](_0x8175('0x10'));var _0x5688b7=this['getDataValue'](_0x8175('0x11'));var _0x30e066=this[_0x8175('0xf')](_0x8175('0xe'));if(_0x5bcb69===_0x8175('0x6')){if(_0x5688b7===_0x8175('0x12')){return null;}if(_0x5688b7===_0x8175('0x13')&&![_0x8175('0xb'),_0x8175('0x14')][_0x8175('0x15')](_0x30e066)){this[_0x8175('0x16')](_0x8175('0xe'),_0x8175('0xb'));}}return _0x30e066;}},'servicelevel':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8175('0x17')](0xb)},'timeout':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8175('0x2')]},'weight':{'type':Sequelize[_0x8175('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':_0x8175('0x18')},'autopause':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8175('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8175('0x4')]('yes','no'),'defaultValue':_0x8175('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8175('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x8175('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8175('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x8175('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x8175('0x2')]},'queue_quantity1':{'type':Sequelize[_0x8175('0x2')]},'queue_quantity2':{'type':Sequelize[_0x8175('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x8175('0x2')]},'periodic_announce':{'type':Sequelize[_0x8175('0x19')],'set':function(_0xd9fd45){this[_0x8175('0x16')](_0x8175('0x1a'),_0xd9fd45?_0xd9fd45[_0x8175('0x1b')](','):[]);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1a'))?this[_0x8175('0xf')](_0x8175('0x1a'))[_0x8175('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x3d460b){this[_0x8175('0x16')](_0x8175('0x1d'),_0x3d460b?_0x3d460b['join'](','):undefined);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1d'))?this[_0x8175('0xf')](_0x8175('0x1d'))[_0x8175('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8175('0x2')],'defaultValue':'no','set':function(_0x4fc2ad){this[_0x8175('0x16')](_0x8175('0x1e'),_0x4fc2ad?_0x4fc2ad['join'](','):undefined);},'get':function(){return this[_0x8175('0xf')](_0x8175('0x1e'))?this[_0x8175('0xf')](_0x8175('0x1e'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x8175('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8175('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'set':function(_0x157e1a){this[_0x8175('0x16')]('acw',_0x157e1a);if(_0x157e1a){if(this[_0x8175('0xf')](_0x8175('0x20'))<0x2){this[_0x8175('0x16')](_0x8175('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x8175('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'comment':_0x8175('0x21')},'dialMethod':{'type':Sequelize[_0x8175('0x4')]('preview','progressive','power',_0x8175('0x22'),_0x8175('0x13')),'defaultValue':'progressive','comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x8175('0x17')](0x4)[_0x8175('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x8175('0x17')](0x4)[_0x8175('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8175('0x24')},'dialPowerLevel':{'type':Sequelize[_0x8175('0x25')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8175('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x8175('0x27')),'defaultValue':_0x8175('0x27'),'comment':_0x8175('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x8175('0x25')](0x2)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8175('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8175('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8175('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8175('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x8175('0x2b'),'comment':_0x8175('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x8175('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'comment':_0x8175('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8175('0x34')},'dialTimezone':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8175('0x2')],'defaultValue':_0x8175('0x35')},'dialPrefix':{'type':Sequelize[_0x8175('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x36'),_0x8175('0x37'),_0x8175('0x38')),'defaultValue':_0x8175('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8175('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8175('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8175('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8175('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8175('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8175('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8175('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8175('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8175('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8175('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8175('0x17')](0x9)[_0x8175('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':0x0,'comment':_0x8175('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8175('0x4')](_0x8175('0x42'),_0x8175('0x43')),'defaultValue':_0x8175('0x42')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x8175('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8175('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8175('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)[_0x8175('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8175('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8175('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8175('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x8175('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8175('0x4d'),'set':function(_0x3dd205){if(!_0x3dd205)this[_0x8175('0x16')]('mandatoryDispositionPauseId',null);this[_0x8175('0x16')](_0x8175('0x4e'),_0x3dd205);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8175('0x17')](0x3)[_0x8175('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x8175('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8175('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x8c9b=['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,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','dropRate','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x8c9b,0x11e));var _0xb8c9=function(_0x13211b,_0x3050c2){_0x13211b=_0x13211b-0x0;var _0x4adb44=_0x8c9b[_0x13211b];return _0x4adb44;};'use strict';var Sequelize=require(_0xb8c9('0x0'));module[_0xb8c9('0x1')]={'name':{'type':Sequelize[_0xb8c9('0x2')],'allowNull':![],'unique':_0xb8c9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x5'),_0xb8c9('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':_0xb8c9('0x7')},'announce':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0xb8c9('0x8'),_0xb8c9('0x9'),_0xb8c9('0xa'),_0xb8c9('0xb'),_0xb8c9('0xc'),_0xb8c9('0xd'),_0xb8c9('0xe')),'allowNull':![],'defaultValue':_0xb8c9('0xf'),'set':function(_0x4713d9){this[_0xb8c9('0x10')](_0xb8c9('0x11'),_0x4713d9?_0x4713d9:_0xb8c9('0xb'));},'get':function(){var _0x548d70=this[_0xb8c9('0x12')](_0xb8c9('0x13'));var _0x10c368=this[_0xb8c9('0x12')](_0xb8c9('0x14'));var _0x167059=this[_0xb8c9('0x12')](_0xb8c9('0x11'));if(_0x548d70===_0xb8c9('0x6')){if(_0x10c368==='preview'){return null;}if(_0x10c368===_0xb8c9('0x15')&&![_0xb8c9('0xb'),_0xb8c9('0x16')]['includes'](_0x167059)){this[_0xb8c9('0x10')]('strategy',_0xb8c9('0xb'));}}return _0x167059;}},'servicelevel':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xb8c9('0x17')](0xb)},'timeout':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb8c9('0x2')]},'weight':{'type':Sequelize[_0xb8c9('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0xb8c9('0x18'),'no',_0xb8c9('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb8c9('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xb8c9('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xb8c9('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xb8c9('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb8c9('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb8c9('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xb8c9('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':_0xb8c9('0x18')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xb8c9('0x18'),'no',_0xb8c9('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xb8c9('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb8c9('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xb8c9('0x2')]},'queue_youarenext':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb8c9('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xb8c9('0x2')]},'queue_quantity2':{'type':Sequelize[_0xb8c9('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xb8c9('0x2')]},'queue_less_than':{'type':Sequelize[_0xb8c9('0x2')]},'periodic_announce':{'type':Sequelize[_0xb8c9('0x1b')],'set':function(_0x2c9c6d){this[_0xb8c9('0x10')]('periodic_announce',_0x2c9c6d?_0x2c9c6d[_0xb8c9('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0xb8c9('0x1d'))?this[_0xb8c9('0x12')](_0xb8c9('0x1d'))[_0xb8c9('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xb8c9('0x18'),'set':function(_0xa38505){this['setDataValue'](_0xb8c9('0x1f'),_0xa38505?_0xa38505[_0xb8c9('0x1c')](','):undefined);},'get':function(){return this[_0xb8c9('0x12')]('joinempty')?this[_0xb8c9('0x12')](_0xb8c9('0x1f'))[_0xb8c9('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':'no','set':function(_0x4be122){this[_0xb8c9('0x10')](_0xb8c9('0x20'),_0x4be122?_0x4be122[_0xb8c9('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xb8c9('0x20'))?this[_0xb8c9('0x12')](_0xb8c9('0x20'))[_0xb8c9('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xb8c9('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb8c9('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb8c9('0x2')]},'description':{'type':Sequelize[_0xb8c9('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x2147c1){this[_0xb8c9('0x10')](_0xb8c9('0x21'),_0x2147c1);if(_0x2147c1){if(this[_0xb8c9('0x12')](_0xb8c9('0x22'))<0x2){this[_0xb8c9('0x10')](_0xb8c9('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xb8c9('0x23')],'defaultValue':0x0,'comment':_0xb8c9('0x24')},'dialMethod':{'type':Sequelize['ENUM'](_0xb8c9('0x25'),_0xb8c9('0x26'),_0xb8c9('0x27'),'predictive',_0xb8c9('0x15')),'defaultValue':'progressive','comment':_0xb8c9('0x28')},'dialLimitChannel':{'type':Sequelize[_0xb8c9('0x17')](0x4)[_0xb8c9('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb8c9('0x2a')},'dialLimitQueue':{'type':Sequelize[_0xb8c9('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb8c9('0x2b')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xb8c9('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xb8c9('0x4')]('agentBusyFactor',_0xb8c9('0x2c')),'defaultValue':_0xb8c9('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xb8c9('0x2d')](0x2)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xb8c9('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xb8c9('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb8c9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb8c9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x30')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xb8c9('0x31'),'comment':_0xb8c9('0x32')},'dialQueueTimeout':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xb8c9('0x2')],'comment':_0xb8c9('0x33')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x34')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb8c9('0x17')](0x5)[_0xb8c9('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xb8c9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x36')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb8c9('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb8c9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb8c9('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb8c9('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x39')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb8c9('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':_0xb8c9('0x3a')},'dialPrefix':{'type':Sequelize[_0xb8c9('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb8c9('0x4')]('always','never',_0xb8c9('0x3b')),'defaultValue':_0xb8c9('0x3c')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb8c9('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0xb8c9('0x17')](0x9)[_0xb8c9('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xb8c9('0x17')](0x9)[_0xb8c9('0x29')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb8c9('0x3e')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb8c9('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb8c9('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb8c9('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xb8c9('0x17')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb8c9('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb8c9('0x17')](0x9)[_0xb8c9('0x29')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb8c9('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb8c9('0x17')](0x9)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb8c9('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb8c9('0x17')](0x5)[_0xb8c9('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb8c9('0x17')](0x9)[_0xb8c9('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb8c9('0x43')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xb8c9('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xb8c9('0x44')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb8c9('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb8c9('0x4')](_0xb8c9('0x46'),'ASC'),'defaultValue':_0xb8c9('0x46')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xb8c9('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xb8c9('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb8c9('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb8c9('0x47')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xb8c9('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb8c9('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb8c9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb8c9('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x4d')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb8c9('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb8c9('0x4e')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb8c9('0x17')](0x5)[_0xb8c9('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x4f')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb8c9('0x17')](0x5)[_0xb8c9('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb8c9('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8c9('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb8c9('0x23')],'defaultValue':![],'comment':_0xb8c9('0x51'),'set':function(_0x335efc){if(!_0x335efc)this['setDataValue'](_0xb8c9('0x52'),null);this[_0xb8c9('0x10')](_0xb8c9('0x53'),_0x335efc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb8c9('0x17')](0x3)[_0xb8c9('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xb8c9('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xb8c9('0x17')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb8c9('0x23')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 93e7149..714defa 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','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)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x2464c4,_0x3423e6){var _0x167c42=function(_0x112dd5){while(--_0x112dd5){_0x2464c4['push'](_0x2464c4['shift']());}};_0x167c42(++_0x3423e6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x17f1a6,_0xc3a43c){_0x17f1a6=_0x17f1a6-0x0;var _0x4a0bf7=_0x8ef6[_0x17f1a6];return _0x4a0bf7;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,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(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'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 caa2e07..b2206cf 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 _0x6069=['update','remove','emit','hook','exports','events','VoiceQueue','save'];(function(_0x5a6e36,_0x211d86){var _0x5e1670=function(_0x1be644){while(--_0x1be644){_0x5a6e36['push'](_0x5a6e36['shift']());}};_0x5e1670(++_0x211d86);}(_0x6069,0x1e5));var _0x9606=function(_0x3dd07f,_0x535554){_0x3dd07f=_0x3dd07f-0x0;var _0x2d7820=_0x6069[_0x3dd07f];return _0x2d7820;};'use strict';var EventEmitter=require(_0x9606('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9606('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9606('0x2'),'afterUpdate':_0x9606('0x3'),'afterDestroy':_0x9606('0x4')};function emitEvent(_0x68a040){return function(_0x35c671,_0x3fe077,_0x1eae00){VoiceQueueEvents[_0x9606('0x5')](_0x68a040+':'+_0x35c671['id'],_0x35c671);VoiceQueueEvents[_0x9606('0x5')](_0x68a040,_0x35c671);_0x1eae00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9606('0x6')](e,emitEvent(event));}}module[_0x9606('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xcb2d=['exports','VoiceQueue','save','update','remove','emit'];(function(_0x12765a,_0x4c3686){var _0x3f009f=function(_0x57c77d){while(--_0x57c77d){_0x12765a['push'](_0x12765a['shift']());}};_0x3f009f(++_0x4c3686);}(_0xcb2d,0x181));var _0xdcb2=function(_0x1c362c,_0x593389){_0x1c362c=_0x1c362c-0x0;var _0x56d90a=_0xcb2d[_0x1c362c];return _0x56d90a;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xdcb2('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdcb2('0x1'),'afterUpdate':_0xdcb2('0x2'),'afterDestroy':_0xdcb2('0x3')};function emitEvent(_0x5b7e46){return function(_0x3d974e,_0x3714d9,_0x1b96b1){VoiceQueueEvents[_0xdcb2('0x4')](_0x5b7e46+':'+_0x3d974e['id'],_0x3d974e);VoiceQueueEvents[_0xdcb2('0x4')](_0x5b7e46,_0x3d974e);_0x1b96b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xdcb2('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index af8b461..fef433c 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2fbb34,_0x358b15){var _0x26914a=function(_0x240fc1){while(--_0x240fc1){_0x2fbb34['push'](_0x2fbb34['shift']());}};_0x26914a(++_0x358b15);}(_0x70e0,0x17b));var _0x070e=function(_0x7c1cfb,_0x50d170){_0x7c1cfb=_0x7c1cfb-0x0;var _0x31a441=_0x70e0[_0x7c1cfb];return _0x31a441;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x4651ae,_0x3d2bc0){var _0x29a97c=function(_0xf05c25){while(--_0xf05c25){_0x4651ae['push'](_0x4651ae['shift']());}};_0x29a97c(++_0x3d2bc0);}(_0x008c,0x188));var _0xc008=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x008c[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'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 32f4eba..8896b27 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 _0x4c48=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','raw','lodash'];(function(_0x22ae6d,_0xc5b751){var _0x1716ff=function(_0x4dc4e4){while(--_0x4dc4e4){_0x22ae6d['push'](_0x22ae6d['shift']());}};_0x1716ff(++_0xc5b751);}(_0x4c48,0xcc));var _0x84c4=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x4c48[_0x1fb1c1];return _0x1622df;};'use strict';var _=require(_0x84c4('0x0'));var util=require(_0x84c4('0x1'));var moment=require(_0x84c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x84c4('0x3'));var fs=require('fs');var Redis=require(_0x84c4('0x4'));var db=require(_0x84c4('0x5'))['db'];var utils=require(_0x84c4('0x6'));var logger=require(_0x84c4('0x7'))(_0x84c4('0x8'));var config=require(_0x84c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x84c4('0xa')][_0x84c4('0xb')]({'port':0x232a});config[_0x84c4('0xc')]=_[_0x84c4('0xd')](config[_0x84c4('0xc')],{'host':_0x84c4('0xe'),'port':0x18eb});var socket=require(_0x84c4('0xf'))(new Redis(config[_0x84c4('0xc')]));require('./voiceQueue.socket')[_0x84c4('0x10')](socket);function respondWithRpcPromise(_0x153494,_0x23957e,_0x5e94f4){return new BPromise(function(_0x297dc4,_0x506312){return client['request'](_0x153494,_0x5e94f4)['then'](function(_0x5ab187){logger[_0x84c4('0x11')](_0x84c4('0x12'),_0x23957e,'request\x20sent');logger[_0x84c4('0x13')](_0x84c4('0x14'),_0x23957e,'request\x20sent',JSON[_0x84c4('0x15')](_0x5ab187));if(_0x5ab187[_0x84c4('0x16')]){if(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x17')]===0x1f4){logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0x5ab187[_0x84c4('0x16')]['message']);return _0x506312(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x18')]);}logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0x5ab187['error'][_0x84c4('0x18')]);return _0x297dc4(_0x5ab187[_0x84c4('0x16')][_0x84c4('0x18')]);}else{logger[_0x84c4('0x11')](_0x84c4('0x12'),_0x23957e,_0x84c4('0x19'));_0x297dc4(_0x5ab187['result'][_0x84c4('0x18')]);}})[_0x84c4('0x1a')](function(_0xda80bb){logger[_0x84c4('0x16')](_0x84c4('0x12'),_0x23957e,_0xda80bb);_0x506312(_0xda80bb);});});}exports[_0x84c4('0x1b')]=function(_0x48a59b){var _0x42bc69=this;return new Promise(function(_0x5a1236,_0x16a19a){return db[_0x84c4('0x1c')][_0x84c4('0x1d')]({'raw':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x1f')]||null:null,'attributes':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b['options'][_0x84c4('0x20')]||null:null,'limit':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b['options'][_0x84c4('0x21')]||null:null,'include':_0x48a59b[_0x84c4('0x1e')]?_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x22')]?_[_0x84c4('0x23')](_0x48a59b[_0x84c4('0x1e')][_0x84c4('0x22')],function(_0x5aeb35){return{'model':db[_0x5aeb35[_0x84c4('0x24')]],'as':_0x5aeb35['as'],'attributes':_0x5aeb35[_0x84c4('0x20')],'include':_0x5aeb35['include']?_[_0x84c4('0x23')](_0x5aeb35['include'],function(_0xc391a3){return{'model':db[_0xc391a3[_0x84c4('0x24')]],'as':_0xc391a3['as'],'attributes':_0xc391a3[_0x84c4('0x20')],'include':_0xc391a3[_0x84c4('0x22')]?_['map'](_0xc391a3[_0x84c4('0x22')],function(_0x1ec81c){return{'model':db[_0x1ec81c[_0x84c4('0x24')]],'as':_0x1ec81c['as'],'attributes':_0x1ec81c['attributes']};}):[]};}):[]};}):[]:[]})[_0x84c4('0x25')](function(_0x1f50c2){logger['info'](_0x84c4('0x1b'),_0x48a59b);logger['debug'](_0x84c4('0x1b'),_0x48a59b,JSON[_0x84c4('0x15')](_0x1f50c2));_0x5a1236(_0x1f50c2);})[_0x84c4('0x1a')](function(_0x112e4e){logger[_0x84c4('0x16')]('GetVoiceQueue',_0x112e4e[_0x84c4('0x18')],_0x48a59b);_0x16a19a(_0x42bc69['error'](0x1f4,_0x112e4e[_0x84c4('0x18')]));});});};exports[_0x84c4('0x26')]=function(_0x5120b4){var _0x21f6f=this;return new Promise(function(_0x2aaf2f,_0x7feac1){return db[_0x84c4('0x1c')][_0x84c4('0x27')]({'raw':_0x5120b4['options']?_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x28')]===undefined?!![]:![]:!![],'where':_0x5120b4[_0x84c4('0x1e')]?_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x1f')]||null:null,'attributes':_0x5120b4[_0x84c4('0x1e')]?_0x5120b4[_0x84c4('0x1e')]['attributes']||null:null,'include':_0x5120b4['options']?_0x5120b4[_0x84c4('0x1e')]['include']?_[_0x84c4('0x23')](_0x5120b4[_0x84c4('0x1e')][_0x84c4('0x22')],function(_0xc3a557){return{'model':db[_0xc3a557[_0x84c4('0x24')]],'as':_0xc3a557['as'],'attributes':_0xc3a557[_0x84c4('0x20')],'include':_0xc3a557[_0x84c4('0x22')]?_[_0x84c4('0x23')](_0xc3a557[_0x84c4('0x22')],function(_0x23bcc9){return{'model':db[_0x23bcc9[_0x84c4('0x24')]],'as':_0x23bcc9['as'],'attributes':_0x23bcc9[_0x84c4('0x20')],'include':_0x23bcc9['include']?_[_0x84c4('0x23')](_0x23bcc9[_0x84c4('0x22')],function(_0xf50582){return{'model':db[_0xf50582['model']],'as':_0xf50582['as'],'attributes':_0xf50582['attributes']};}):[]};}):[]};}):[]:[]})[_0x84c4('0x25')](function(_0x385f33){logger[_0x84c4('0x11')](_0x84c4('0x26'),_0x5120b4);logger[_0x84c4('0x13')](_0x84c4('0x26'),_0x5120b4,JSON['stringify'](_0x385f33));_0x2aaf2f(_0x385f33);})[_0x84c4('0x1a')](function(_0x2a628c){logger[_0x84c4('0x16')](_0x84c4('0x26'),_0x2a628c[_0x84c4('0x18')],_0x5120b4);_0x7feac1(_0x21f6f['error'](0x1f4,_0x2a628c[_0x84c4('0x18')]));});});}; \ No newline at end of file +var _0x85f6=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x5af5a8,_0x10ce33){var _0x414545=function(_0xb57b5c){while(--_0xb57b5c){_0x5af5a8['push'](_0x5af5a8['shift']());}};_0x414545(++_0x10ce33);}(_0x85f6,0xcc));var _0x685f=function(_0x552914,_0x308b07){_0x552914=_0x552914-0x0;var _0xee44c5=_0x85f6[_0x552914];return _0xee44c5;};'use strict';var _=require(_0x685f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x685f('0x1'));var rs=require(_0x685f('0x2'));var fs=require('fs');var Redis=require(_0x685f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x685f('0x4'))(_0x685f('0x5'));var config=require('../../config/environment');var jayson=require(_0x685f('0x6'));var client=jayson[_0x685f('0x7')][_0x685f('0x8')]({'port':0x232a});config[_0x685f('0x9')]=_[_0x685f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x685f('0x9')]));require(_0x685f('0xb'))[_0x685f('0xc')](socket);function respondWithRpcPromise(_0x6ab75c,_0x37ae1c,_0x43cc75){return new BPromise(function(_0x302281,_0x348a03){return client[_0x685f('0xd')](_0x6ab75c,_0x43cc75)[_0x685f('0xe')](function(_0x217298){logger[_0x685f('0xf')](_0x685f('0x10'),_0x37ae1c,_0x685f('0x11'));logger[_0x685f('0x12')](_0x685f('0x13'),_0x37ae1c,'request\x20sent',JSON[_0x685f('0x14')](_0x217298));if(_0x217298[_0x685f('0x15')]){if(_0x217298[_0x685f('0x15')][_0x685f('0x16')]===0x1f4){logger[_0x685f('0x15')](_0x685f('0x10'),_0x37ae1c,_0x217298[_0x685f('0x15')][_0x685f('0x17')]);return _0x348a03(_0x217298['error'][_0x685f('0x17')]);}logger[_0x685f('0x15')](_0x685f('0x10'),_0x37ae1c,_0x217298[_0x685f('0x15')][_0x685f('0x17')]);return _0x302281(_0x217298['error'][_0x685f('0x17')]);}else{logger[_0x685f('0xf')](_0x685f('0x10'),_0x37ae1c,_0x685f('0x11'));_0x302281(_0x217298['result'][_0x685f('0x17')]);}})[_0x685f('0x18')](function(_0x45f011){logger[_0x685f('0x15')](_0x685f('0x10'),_0x37ae1c,_0x45f011);_0x348a03(_0x45f011);});});}exports[_0x685f('0x19')]=function(_0x55fb89){var _0x17d116=this;return new Promise(function(_0x339466,_0x5e95d3){return db[_0x685f('0x1a')]['findAll']({'raw':_0x55fb89[_0x685f('0x1b')]?_0x55fb89['options'][_0x685f('0x1c')]===undefined?!![]:![]:!![],'where':_0x55fb89['options']?_0x55fb89['options'][_0x685f('0x1d')]||null:null,'attributes':_0x55fb89['options']?_0x55fb89[_0x685f('0x1b')][_0x685f('0x1e')]||null:null,'limit':_0x55fb89[_0x685f('0x1b')]?_0x55fb89[_0x685f('0x1b')][_0x685f('0x1f')]||null:null,'include':_0x55fb89[_0x685f('0x1b')]?_0x55fb89[_0x685f('0x1b')][_0x685f('0x20')]?_[_0x685f('0x21')](_0x55fb89[_0x685f('0x1b')][_0x685f('0x20')],function(_0x5adb37){return{'model':db[_0x5adb37[_0x685f('0x22')]],'as':_0x5adb37['as'],'attributes':_0x5adb37[_0x685f('0x1e')],'include':_0x5adb37[_0x685f('0x20')]?_[_0x685f('0x21')](_0x5adb37[_0x685f('0x20')],function(_0x196594){return{'model':db[_0x196594[_0x685f('0x22')]],'as':_0x196594['as'],'attributes':_0x196594[_0x685f('0x1e')],'include':_0x196594['include']?_[_0x685f('0x21')](_0x196594['include'],function(_0x203f15){return{'model':db[_0x203f15[_0x685f('0x22')]],'as':_0x203f15['as'],'attributes':_0x203f15[_0x685f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4838ea){logger[_0x685f('0xf')](_0x685f('0x19'),_0x55fb89);logger[_0x685f('0x12')](_0x685f('0x19'),_0x55fb89,JSON[_0x685f('0x14')](_0x4838ea));_0x339466(_0x4838ea);})[_0x685f('0x18')](function(_0x1319b4){logger['error'](_0x685f('0x19'),_0x1319b4['message'],_0x55fb89);_0x5e95d3(_0x17d116['error'](0x1f4,_0x1319b4['message']));});});};exports[_0x685f('0x23')]=function(_0x56f93d){var _0x1c0e3c=this;return new Promise(function(_0x175c67,_0xcf1106){return db[_0x685f('0x1a')][_0x685f('0x24')]({'raw':_0x56f93d[_0x685f('0x1b')]?_0x56f93d['options'][_0x685f('0x1c')]===undefined?!![]:![]:!![],'where':_0x56f93d[_0x685f('0x1b')]?_0x56f93d['options'][_0x685f('0x1d')]||null:null,'attributes':_0x56f93d[_0x685f('0x1b')]?_0x56f93d[_0x685f('0x1b')][_0x685f('0x1e')]||null:null,'include':_0x56f93d['options']?_0x56f93d[_0x685f('0x1b')][_0x685f('0x20')]?_[_0x685f('0x21')](_0x56f93d[_0x685f('0x1b')][_0x685f('0x20')],function(_0x1c4625){return{'model':db[_0x1c4625[_0x685f('0x22')]],'as':_0x1c4625['as'],'attributes':_0x1c4625[_0x685f('0x1e')],'include':_0x1c4625['include']?_[_0x685f('0x21')](_0x1c4625[_0x685f('0x20')],function(_0x348444){return{'model':db[_0x348444['model']],'as':_0x348444['as'],'attributes':_0x348444[_0x685f('0x1e')],'include':_0x348444['include']?_[_0x685f('0x21')](_0x348444[_0x685f('0x20')],function(_0x16f27e){return{'model':db[_0x16f27e[_0x685f('0x22')]],'as':_0x16f27e['as'],'attributes':_0x16f27e[_0x685f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x685f('0xe')](function(_0x3c832c){logger[_0x685f('0xf')](_0x685f('0x23'),_0x56f93d);logger[_0x685f('0x12')](_0x685f('0x23'),_0x56f93d,JSON[_0x685f('0x14')](_0x3c832c));_0x175c67(_0x3c832c);})[_0x685f('0x18')](function(_0xb3f9e9){logger[_0x685f('0x15')](_0x685f('0x23'),_0xb3f9e9[_0x685f('0x17')],_0x56f93d);_0xcf1106(_0x1c0e3c[_0x685f('0x15')](0x1f4,_0xb3f9e9[_0x685f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0d3b969..db8d786 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 _0xb64f=['length','voiceQueue:','./voiceQueue.events','update','emit','removeListener'];(function(_0x52baf2,_0x342873){var _0x3740f3=function(_0x33248c){while(--_0x33248c){_0x52baf2['push'](_0x52baf2['shift']());}};_0x3740f3(++_0x342873);}(_0xb64f,0x1a6));var _0xfb64=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xb64f[_0x3afe18];return _0x19ed1f;};'use strict';var VoiceQueueEvents=require(_0xfb64('0x0'));var events=['save','remove',_0xfb64('0x1')];function createListener(_0x2b829b,_0x17a415){return function(_0x220dd9){_0x17a415[_0xfb64('0x2')](_0x2b829b,_0x220dd9);};}function removeListener(_0x9da130,_0x2d6e0f){return function(){VoiceQueueEvents[_0xfb64('0x3')](_0x9da130,_0x2d6e0f);};}exports['register']=function(_0x306912){for(var _0x3a93eb=0x0,_0x57ca1c=events[_0xfb64('0x4')];_0x3a93eb<_0x57ca1c;_0x3a93eb++){var _0x4eb419=events[_0x3a93eb];var _0x59b95b=createListener(_0xfb64('0x5')+_0x4eb419,_0x306912);VoiceQueueEvents['on'](_0x4eb419,_0x59b95b);}}; \ No newline at end of file +var _0x5e75=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5e75,0xd5));var _0x55e7=function(_0x4a8ca9,_0x417421){_0x4a8ca9=_0x4a8ca9-0x0;var _0xb3d6d8=_0x5e75[_0x4a8ca9];return _0xb3d6d8;};'use strict';var VoiceQueueEvents=require(_0x55e7('0x0'));var events=[_0x55e7('0x1'),_0x55e7('0x2'),_0x55e7('0x3')];function createListener(_0x8982bc,_0x35fb37){return function(_0x4836c0){_0x35fb37[_0x55e7('0x4')](_0x8982bc,_0x4836c0);};}function removeListener(_0x1f261f,_0x41c9ff){return function(){VoiceQueueEvents['removeListener'](_0x1f261f,_0x41c9ff);};}exports[_0x55e7('0x5')]=function(_0x1e9c4c){for(var _0x1552ac=0x0,_0x3c2644=events[_0x55e7('0x6')];_0x1552ac<_0x3c2644;_0x1552ac++){var _0x5e2552=events[_0x1552ac];var _0x1d847f=createListener(_0x55e7('0x7')+_0x5e2552,_0x1e9c4c);VoiceQueueEvents['on'](_0x5e2552,_0x1d847f);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index fd8e7fb..2bdc1f9 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 _0x9890=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','delete'];(function(_0x193e2a,_0x109411){var _0x10ed8f=function(_0x55c2c5){while(--_0x55c2c5){_0x193e2a['push'](_0x193e2a['shift']());}};_0x10ed8f(++_0x109411);}(_0x9890,0x144));var _0x0989=function(_0x1b7003,_0x52f380){_0x1b7003=_0x1b7003-0x0;var _0x144a89=_0x9890[_0x1b7003];return _0x144a89;};'use strict';var multer=require(_0x0989('0x0'));var util=require(_0x0989('0x1'));var path=require(_0x0989('0x2'));var timeout=require(_0x0989('0x3'));var express=require(_0x0989('0x4'));var router=express[_0x0989('0x5')]();var fs_extra=require(_0x0989('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0989('0x7'));var controller=require(_0x0989('0x8'));router[_0x0989('0x9')]('/',auth[_0x0989('0xa')](),controller[_0x0989('0xb')]);router['get']('/describe',auth[_0x0989('0xa')](),controller[_0x0989('0xc')]);router['get'](_0x0989('0xd'),auth[_0x0989('0xa')](),controller[_0x0989('0xe')]);router[_0x0989('0x9')](_0x0989('0xf'),auth[_0x0989('0xa')](),controller['show']);router[_0x0989('0x10')]('/',auth[_0x0989('0xa')](),controller[_0x0989('0x11')]);router[_0x0989('0x12')]('/:id',auth[_0x0989('0xa')](),controller[_0x0989('0x13')]);router[_0x0989('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0989('0x15')]);module[_0x0989('0x16')]=router; \ No newline at end of file +var _0xd7ea=['/index','getVoiceQueuesReport','show','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0xfb9315,_0x2ac76e){var _0x429e04=function(_0x13959c){while(--_0x13959c){_0xfb9315['push'](_0xfb9315['shift']());}};_0x429e04(++_0x2ac76e);}(_0xd7ea,0x17f));var _0xad7e=function(_0x10068a,_0x3f8ac0){_0x10068a=_0x10068a-0x0;var _0x59e91f=_0xd7ea[_0x10068a];return _0x59e91f;};'use strict';var multer=require(_0xad7e('0x0'));var util=require(_0xad7e('0x1'));var path=require(_0xad7e('0x2'));var timeout=require(_0xad7e('0x3'));var express=require(_0xad7e('0x4'));var router=express[_0xad7e('0x5')]();var fs_extra=require(_0xad7e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xad7e('0x7'));var config=require('../../config/environment');var controller=require(_0xad7e('0x8'));router[_0xad7e('0x9')]('/',auth['isAuthenticated'](),controller[_0xad7e('0xa')]);router[_0xad7e('0x9')](_0xad7e('0xb'),auth[_0xad7e('0xc')](),controller['describe']);router[_0xad7e('0x9')](_0xad7e('0xd'),auth['isAuthenticated'](),controller[_0xad7e('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xad7e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xad7e('0x10')]);router[_0xad7e('0x11')](_0xad7e('0x12'),auth['isAuthenticated'](),controller[_0xad7e('0x13')]);router[_0xad7e('0x14')](_0xad7e('0x12'),auth[_0xad7e('0xc')](),controller[_0xad7e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 78afd50..4951787 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 _0xbed5=['STRING','DATE','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x41a53a,_0x867c6c){var _0x244374=function(_0x35afe5){while(--_0x35afe5){_0x41a53a['push'](_0x41a53a['shift']());}};_0x244374(++_0x867c6c);}(_0xbed5,0x1bf));var _0x5bed=function(_0x12daf7,_0x4acb2d){_0x12daf7=_0x12daf7-0x0;var _0x4a979d=_0xbed5[_0x12daf7];return _0x4a979d;};'use strict';var Sequelize=require(_0x5bed('0x0'));var moment=require(_0x5bed('0x1'));module[_0x5bed('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5bed('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5bed('0x3')]},'queue':{'type':Sequelize[_0x5bed('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x5bed('0x4')],'set':function(_0x270e0c){var _0x4cba65=moment(_0x270e0c);var _0x2d21b4=moment(this['getDataValue'](_0x5bed('0x5')))[_0x5bed('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5773bc=_0x4cba65['diff'](_0x2d21b4,_0x5bed('0x7'));this[_0x5bed('0x8')](_0x5bed('0x9'),_0x270e0c);this[_0x5bed('0x8')](_0x5bed('0xa'),_0x5773bc||null);}},'position':{'type':Sequelize[_0x5bed('0xb')]},'count':{'type':Sequelize[_0x5bed('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerexit':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5bed('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5bed('0x3')],'comment':_0x5bed('0xd')},'originalposition':{'type':Sequelize[_0x5bed('0xb')]},'channel':{'type':Sequelize[_0x5bed('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5bed('0x3')]},'connectedlinename':{'type':Sequelize[_0x5bed('0x3')]},'accountcode':{'type':Sequelize[_0x5bed('0x3')]},'context':{'type':Sequelize[_0x5bed('0x3')]},'exten':{'type':Sequelize[_0x5bed('0x3')]},'priority':{'type':Sequelize[_0x5bed('0x3')]},'holdtime':{'type':Sequelize[_0x5bed('0xb')]},'mohtime':{'type':Sequelize[_0x5bed('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5bed('0x3')]},'transfer':{'type':Sequelize[_0x5bed('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5bed('0x3')],'comment':_0x5bed('0xe')},'transferexten':{'type':Sequelize[_0x5bed('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5bed('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5bed('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x5bed('0x3')]}}; \ No newline at end of file +var _0x016b=['queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','STRING','DATE'];(function(_0x269a6f,_0x4c43c5){var _0x29e1e6=function(_0xe6081e){while(--_0xe6081e){_0x269a6f['push'](_0x269a6f['shift']());}};_0x29e1e6(++_0x4c43c5);}(_0x016b,0xcd));var _0xb016=function(_0x23f16f,_0x1df014){_0x23f16f=_0x23f16f-0x0;var _0x40d5f3=_0x016b[_0x23f16f];return _0x40d5f3;};'use strict';var Sequelize=require(_0xb016('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xb016('0x1')]},'uniqueid':{'type':Sequelize[_0xb016('0x1')]},'calleridnum':{'type':Sequelize[_0xb016('0x1')]},'calleridname':{'type':Sequelize[_0xb016('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb016('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xb016('0x2')],'set':function(_0x476313){var _0x249efc=moment(_0x476313);var _0x2b0529=moment(this['getDataValue'](_0xb016('0x3')))[_0xb016('0x4')](_0xb016('0x5'));var _0x551f41=_0x249efc['diff'](_0x2b0529,_0xb016('0x6'));this['setDataValue'](_0xb016('0x7'),_0x476313);this[_0xb016('0x8')](_0xb016('0x9'),_0x551f41||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xb016('0xa')]},'queuecallerabandon':{'type':Sequelize[_0xb016('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xb016('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb016('0x2')]},'queuecallerexit':{'type':Sequelize[_0xb016('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb016('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xb016('0x1')],'comment':_0xb016('0xc')},'originalposition':{'type':Sequelize[_0xb016('0xa')]},'channel':{'type':Sequelize[_0xb016('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb016('0x1')]},'accountcode':{'type':Sequelize[_0xb016('0x1')]},'context':{'type':Sequelize[_0xb016('0x1')]},'exten':{'type':Sequelize[_0xb016('0x1')]},'priority':{'type':Sequelize[_0xb016('0x1')]},'holdtime':{'type':Sequelize[_0xb016('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb016('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb016('0x1')]},'transfer':{'type':Sequelize[_0xb016('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb016('0x1')]},'disposition':{'type':Sequelize[_0xb016('0x1')]},'secondDisposition':{'type':Sequelize[_0xb016('0x1')]},'thirdDisposition':{'type':Sequelize[_0xb016('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0xb016('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0xb016('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9282985..130ee83 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 _0xe666=['error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','getVoiceQueuesReport','order','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy'];(function(_0x2c680e,_0x463721){var _0x3d2191=function(_0x181ae7){while(--_0x181ae7){_0x2c680e['push'](_0x2c680e['shift']());}};_0x3d2191(++_0x463721);}(_0xe666,0x1ad));var _0x6e66=function(_0x1a3cb9,_0x3e513a){_0x1a3cb9=_0x1a3cb9-0x0;var _0x2004a1=_0xe666[_0x1a3cb9];return _0x2004a1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e66('0x0'));var jsonpatch=require(_0x6e66('0x1'));var rp=require(_0x6e66('0x2'));var moment=require('moment');var BPromise=require(_0x6e66('0x3'));var Mustache=require('mustache');var util=require(_0x6e66('0x4'));var path=require(_0x6e66('0x5'));var sox=require(_0x6e66('0x6'));var csv=require(_0x6e66('0x7'));var ejs=require(_0x6e66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e66('0x9'));var squel=require(_0x6e66('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e66('0xb'));var toCsv=require(_0x6e66('0x7'));var querystring=require('querystring');var Papa=require(_0x6e66('0xc'));var Redis=require('ioredis');var authService=require(_0x6e66('0xd'));var qs=require(_0x6e66('0xe'));var as=require(_0x6e66('0xf'));var hardwareService=require(_0x6e66('0x10'));var logger=require(_0x6e66('0x11'))('api');var utils=require(_0x6e66('0x12'));var config=require(_0x6e66('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e66('0x14'))['db'];config['redis']=_['defaults'](config[_0x6e66('0x15')],{'host':_0x6e66('0x16'),'port':0x18eb});var socket=require(_0x6e66('0x17'))(new Redis(config[_0x6e66('0x15')]));require(_0x6e66('0x18'))[_0x6e66('0x19')](socket);function respondWithStatusCode(_0x5deae7,_0x129abe){_0x129abe=_0x129abe||0xcc;return function(_0x4227a9){if(_0x4227a9){return _0x5deae7['sendStatus'](_0x129abe);}return _0x5deae7[_0x6e66('0x1a')](_0x129abe)[_0x6e66('0x1b')]();};}function respondWithResult(_0xc96f27,_0x10a28b){_0x10a28b=_0x10a28b||0xc8;return function(_0x55bae8){if(_0x55bae8){return _0xc96f27[_0x6e66('0x1a')](_0x10a28b)[_0x6e66('0x1c')](_0x55bae8);}};}function respondWithFilteredResult(_0x1650f1,_0x2cb11c){return function(_0x579097){if(_0x579097){var _0x3194ae=typeof _0x2cb11c['offset']==='undefined'&&typeof _0x2cb11c[_0x6e66('0x1d')]===_0x6e66('0x1e');var _0x173784=_0x579097[_0x6e66('0x1f')];var _0x212c00=_0x3194ae?0x0:_0x2cb11c[_0x6e66('0x20')];var _0x502e63=_0x3194ae?_0x579097[_0x6e66('0x1f')]:_0x2cb11c[_0x6e66('0x20')]+_0x2cb11c[_0x6e66('0x1d')];var _0x34f0a6;if(_0x502e63>=_0x173784){_0x502e63=_0x173784;_0x34f0a6=0xc8;}else{_0x34f0a6=0xce;}_0x1650f1[_0x6e66('0x1a')](_0x34f0a6);return _0x1650f1['set'](_0x6e66('0x21'),_0x212c00+'-'+_0x502e63+'/'+_0x173784)[_0x6e66('0x1c')](_0x579097);}return null;};}function patchUpdates(_0x4330e7){return function(_0x5ea2ff){try{jsonpatch[_0x6e66('0x22')](_0x5ea2ff,_0x4330e7,!![]);}catch(_0x1c3b69){return BPromise['reject'](_0x1c3b69);}return _0x5ea2ff[_0x6e66('0x23')]();};}function saveUpdates(_0x5842a8,_0x85685f){return function(_0x14a96f){if(_0x14a96f){return _0x14a96f[_0x6e66('0x24')](_0x5842a8)[_0x6e66('0x25')](function(_0x4d1e23){return _0x4d1e23;});}return null;};}function removeEntity(_0x498f67,_0x3665d7){return function(_0x1575b5){if(_0x1575b5){return _0x1575b5[_0x6e66('0x26')]()[_0x6e66('0x25')](function(){_0x498f67[_0x6e66('0x1a')](0xcc)[_0x6e66('0x1b')]();});}};}function handleEntityNotFound(_0x235a98,_0x163110){return function(_0x3cc84e){if(!_0x3cc84e){_0x235a98['sendStatus'](0x194);}return _0x3cc84e;};}function handleError(_0xa57b32,_0x4a0e4c){_0x4a0e4c=_0x4a0e4c||0x1f4;return function(_0x171840){logger[_0x6e66('0x27')](_0x171840[_0x6e66('0x28')]);if(_0x171840[_0x6e66('0x29')]){delete _0x171840[_0x6e66('0x29')];}_0xa57b32[_0x6e66('0x1a')](_0x4a0e4c)[_0x6e66('0x2a')](_0x171840);};}exports['index']=function(_0x14d593,_0x250d44){var _0x409783={},_0x400329={},_0x583c5f={'count':0x0,'rows':[]};var _0x280b06=_[_0x6e66('0x2b')](db[_0x6e66('0x2c')][_0x6e66('0x2d')],function(_0x183646){return{'name':_0x183646[_0x6e66('0x2e')],'type':_0x183646['type'][_0x6e66('0x2f')]};});_0x400329[_0x6e66('0x30')]=_[_0x6e66('0x2b')](_0x280b06,_0x6e66('0x29'));_0x400329[_0x6e66('0x31')]=_[_0x6e66('0x32')](_0x14d593[_0x6e66('0x31')]);_0x400329[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x400329[_0x6e66('0x30')],_0x400329[_0x6e66('0x31')]);_0x409783[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x400329['model'],qs[_0x6e66('0x36')](_0x14d593[_0x6e66('0x31')]['fields']));_0x409783[_0x6e66('0x35')]=_0x409783[_0x6e66('0x35')][_0x6e66('0x37')]?_0x409783[_0x6e66('0x35')]:_0x400329[_0x6e66('0x30')];if(!_0x14d593[_0x6e66('0x31')][_0x6e66('0x38')](_0x6e66('0x39'))){_0x409783[_0x6e66('0x1d')]=qs[_0x6e66('0x1d')](_0x14d593[_0x6e66('0x31')]['limit']);_0x409783['offset']=qs[_0x6e66('0x20')](_0x14d593['query']['offset']);}_0x409783['order']=qs[_0x6e66('0x3a')](_0x14d593[_0x6e66('0x31')]['sort']);_0x409783[_0x6e66('0x3b')]=qs[_0x6e66('0x33')](_[_0x6e66('0x3c')](_0x14d593['query'],_0x400329['filters']),_0x280b06);if(_0x14d593[_0x6e66('0x31')][_0x6e66('0x3d')]){_0x409783['where']=_[_0x6e66('0x3e')](_0x409783[_0x6e66('0x3b')],{'$or':_[_0x6e66('0x2b')](_0x280b06,function(_0x1efe38){if(_0x1efe38['type']!==_0x6e66('0x3f')){var _0x33356b={};_0x33356b[_0x1efe38[_0x6e66('0x29')]]={'$like':'%'+_0x14d593[_0x6e66('0x31')][_0x6e66('0x3d')]+'%'};return _0x33356b;}})});}_0x409783=_[_0x6e66('0x3e')]({},_0x409783,_0x14d593[_0x6e66('0x40')]);var _0x506f97={'where':_0x409783[_0x6e66('0x3b')]};return db[_0x6e66('0x2c')]['count'](_0x506f97)[_0x6e66('0x25')](function(_0x368f13){_0x583c5f[_0x6e66('0x1f')]=_0x368f13;if(_0x14d593[_0x6e66('0x31')][_0x6e66('0x41')]){_0x409783[_0x6e66('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6e66('0x43')](_0x409783);})[_0x6e66('0x25')](function(_0xc4ebfc){_0x583c5f[_0x6e66('0x44')]=_0xc4ebfc;return _0x583c5f;})[_0x6e66('0x25')](respondWithFilteredResult(_0x250d44,_0x409783))[_0x6e66('0x45')](handleError(_0x250d44,null));};exports[_0x6e66('0x46')]=function(_0x47472d,_0x55d122){var _0x5b95ce={'raw':![],'where':{'id':_0x47472d['params']['id']}},_0x515d2a={};_0x515d2a[_0x6e66('0x30')]=_[_0x6e66('0x32')](db['VoiceQueueReport'][_0x6e66('0x2d')]);_0x515d2a['query']=_[_0x6e66('0x32')](_0x47472d[_0x6e66('0x31')]);_0x515d2a[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x515d2a[_0x6e66('0x30')],_0x515d2a['query']);_0x5b95ce[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x515d2a[_0x6e66('0x30')],qs[_0x6e66('0x36')](_0x47472d[_0x6e66('0x31')]['fields']));_0x5b95ce[_0x6e66('0x35')]=_0x5b95ce[_0x6e66('0x35')][_0x6e66('0x37')]?_0x5b95ce[_0x6e66('0x35')]:_0x515d2a[_0x6e66('0x30')];if(_0x47472d['query'][_0x6e66('0x41')]){_0x5b95ce[_0x6e66('0x42')]=[{'all':!![]}];}_0x5b95ce=_['merge']({},_0x5b95ce,_0x47472d['options']);return db[_0x6e66('0x2c')][_0x6e66('0x47')](_0x5b95ce)[_0x6e66('0x25')](handleEntityNotFound(_0x55d122,null))[_0x6e66('0x25')](respondWithResult(_0x55d122,null))[_0x6e66('0x45')](handleError(_0x55d122,null));};exports[_0x6e66('0x48')]=function(_0x45b87b,_0x3bfd4a){return db[_0x6e66('0x2c')][_0x6e66('0x48')](_0x45b87b['body'],{})[_0x6e66('0x25')](respondWithResult(_0x3bfd4a,0xc9))['catch'](handleError(_0x3bfd4a,null));};exports[_0x6e66('0x24')]=function(_0x49288f,_0x2c80cc){if(_0x49288f[_0x6e66('0x49')]['id']){delete _0x49288f[_0x6e66('0x49')]['id'];}return db[_0x6e66('0x2c')]['find']({'where':{'id':_0x49288f[_0x6e66('0x4a')]['id']}})[_0x6e66('0x25')](handleEntityNotFound(_0x2c80cc,null))[_0x6e66('0x25')](saveUpdates(_0x49288f[_0x6e66('0x49')],null))[_0x6e66('0x25')](respondWithResult(_0x2c80cc,null))[_0x6e66('0x45')](handleError(_0x2c80cc,null));};exports[_0x6e66('0x26')]=function(_0x539281,_0x3adfe8){return db['VoiceQueueReport'][_0x6e66('0x47')]({'where':{'id':_0x539281[_0x6e66('0x4a')]['id']}})[_0x6e66('0x25')](handleEntityNotFound(_0x3adfe8,null))['then'](removeEntity(_0x3adfe8,null))[_0x6e66('0x45')](handleError(_0x3adfe8,null));};exports[_0x6e66('0x4b')]=function(_0x215c26,_0x529442){return db[_0x6e66('0x2c')]['describe']()[_0x6e66('0x25')](respondWithResult(_0x529442,null))[_0x6e66('0x45')](handleError(_0x529442,null));};exports[_0x6e66('0x4c')]=function(_0x2c0b51,_0x188924){var _0x4b7df3={},_0x2bd139={},_0x48dc42={'count':0x0,'rows':[]};_0x2bd139[_0x6e66('0x30')]=_['keys'](db['VoiceQueueReport'][_0x6e66('0x2d')]);_0x2bd139['query']=_['keys'](_0x2c0b51['query']);_0x2bd139[_0x6e66('0x33')]=_[_0x6e66('0x34')](_0x2bd139[_0x6e66('0x30')],_0x2bd139['query']);_0x4b7df3[_0x6e66('0x35')]=_[_0x6e66('0x34')](_0x2bd139[_0x6e66('0x30')],qs['fields'](_0x2c0b51[_0x6e66('0x31')][_0x6e66('0x36')]));_0x4b7df3[_0x6e66('0x35')]=_0x4b7df3[_0x6e66('0x35')][_0x6e66('0x37')]?_0x4b7df3[_0x6e66('0x35')]:_0x2bd139['model'];if(!_0x2c0b51[_0x6e66('0x31')][_0x6e66('0x38')](_0x6e66('0x39'))){_0x4b7df3[_0x6e66('0x1d')]=qs[_0x6e66('0x1d')](_0x2c0b51['query'][_0x6e66('0x1d')]);_0x4b7df3['offset']=qs[_0x6e66('0x20')](_0x2c0b51['query']['offset']);}_0x4b7df3[_0x6e66('0x4d')]=qs[_0x6e66('0x3a')](_0x2c0b51['query']['sort']);_0x4b7df3[_0x6e66('0x3b')]=qs[_0x6e66('0x33')](_['pick'](_0x2c0b51[_0x6e66('0x31')],_0x2bd139[_0x6e66('0x33')]));if(_0x2c0b51['query']['filter']){_0x4b7df3[_0x6e66('0x3b')]=_[_0x6e66('0x3e')](_0x4b7df3[_0x6e66('0x3b')],{'$or':_['map'](_0x4b7df3[_0x6e66('0x35')],function(_0x2517c3){var _0x6ee0e={};_0x6ee0e[_0x2517c3]={'$like':'%'+_0x2c0b51[_0x6e66('0x31')]['filter']+'%'};return _0x6ee0e;})});}_0x4b7df3=_[_0x6e66('0x3e')]({},_0x4b7df3,_0x2c0b51[_0x6e66('0x40')]);var _0x140f6a={'where':_0x4b7df3[_0x6e66('0x3b')]};return db[_0x6e66('0x2c')][_0x6e66('0x1f')](_0x140f6a)['then'](function(_0x11bc34){_0x48dc42[_0x6e66('0x1f')]=_0x11bc34;if(_0x2c0b51['query'][_0x6e66('0x41')]){_0x4b7df3[_0x6e66('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6e66('0x43')](_0x4b7df3);})[_0x6e66('0x25')](function(_0xa0ac7c){_0x48dc42[_0x6e66('0x44')]=_0xa0ac7c;return _0x48dc42;})[_0x6e66('0x25')](respondWithFilteredResult(_0x188924,_0x4b7df3,_0x6e66('0x4c')))[_0x6e66('0x45')](handleError(_0x188924,null,_0x6e66('0x4c')));}; \ No newline at end of file +var _0x15f6=['then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','VoiceQueueReport','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','includeAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','querystring','papaparse','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','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x299611,_0x2a97ff){var _0x443eae=function(_0x2fd58a){while(--_0x2fd58a){_0x299611['push'](_0x299611['shift']());}};_0x443eae(++_0x2a97ff);}(_0x15f6,0x1c9));var _0x615f=function(_0x3a60eb,_0x1b2a8f){_0x3a60eb=_0x3a60eb-0x0;var _0x300318=_0x15f6[_0x3a60eb];return _0x300318;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x615f('0x0'));var zipdir=require(_0x615f('0x1'));var jsonpatch=require(_0x615f('0x2'));var rp=require(_0x615f('0x3'));var moment=require(_0x615f('0x4'));var BPromise=require(_0x615f('0x5'));var Mustache=require('mustache');var util=require(_0x615f('0x6'));var path=require('path');var sox=require(_0x615f('0x7'));var csv=require(_0x615f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x615f('0x9'));var crypto=require(_0x615f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x615f('0xb'));var Papa=require(_0x615f('0xc'));var Redis=require(_0x615f('0xd'));var authService=require(_0x615f('0xe'));var qs=require(_0x615f('0xf'));var as=require(_0x615f('0x10'));var hardwareService=require(_0x615f('0x11'));var logger=require(_0x615f('0x12'))(_0x615f('0x13'));var utils=require('../../config/utils');var config=require(_0x615f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x615f('0x15'))['db'];config[_0x615f('0x16')]=_[_0x615f('0x17')](config[_0x615f('0x16')],{'host':_0x615f('0x18'),'port':0x18eb});var socket=require(_0x615f('0x19'))(new Redis(config[_0x615f('0x16')]));require(_0x615f('0x1a'))[_0x615f('0x1b')](socket);function respondWithStatusCode(_0x4c4158,_0x2c00fa){_0x2c00fa=_0x2c00fa||0xcc;return function(_0x4cd3be){if(_0x4cd3be){return _0x4c4158['sendStatus'](_0x2c00fa);}return _0x4c4158[_0x615f('0x1c')](_0x2c00fa)[_0x615f('0x1d')]();};}function respondWithResult(_0x14d6da,_0x333012){_0x333012=_0x333012||0xc8;return function(_0x47f99c){if(_0x47f99c){return _0x14d6da[_0x615f('0x1c')](_0x333012)[_0x615f('0x1e')](_0x47f99c);}};}function respondWithFilteredResult(_0x34ab75,_0x34e26f){return function(_0xced758){if(_0xced758){var _0x5d89ba=typeof _0x34e26f[_0x615f('0x1f')]===_0x615f('0x20')&&typeof _0x34e26f[_0x615f('0x21')]==='undefined';var _0x8dc43a=_0xced758[_0x615f('0x22')];var _0x5e7e88=_0x5d89ba?0x0:_0x34e26f['offset'];var _0x2925b3=_0x5d89ba?_0xced758['count']:_0x34e26f[_0x615f('0x1f')]+_0x34e26f[_0x615f('0x21')];var _0x3f5b74;if(_0x2925b3>=_0x8dc43a){_0x2925b3=_0x8dc43a;_0x3f5b74=0xc8;}else{_0x3f5b74=0xce;}_0x34ab75[_0x615f('0x1c')](_0x3f5b74);return _0x34ab75[_0x615f('0x23')](_0x615f('0x24'),_0x5e7e88+'-'+_0x2925b3+'/'+_0x8dc43a)[_0x615f('0x1e')](_0xced758);}return null;};}function patchUpdates(_0x20de8c){return function(_0x3e2a08){try{jsonpatch[_0x615f('0x25')](_0x3e2a08,_0x20de8c,!![]);}catch(_0x22dd1d){return BPromise[_0x615f('0x26')](_0x22dd1d);}return _0x3e2a08[_0x615f('0x27')]();};}function saveUpdates(_0x5bad4c,_0x3f1f92){return function(_0x4a35a7){if(_0x4a35a7){return _0x4a35a7[_0x615f('0x28')](_0x5bad4c)[_0x615f('0x29')](function(_0x29fd48){return _0x29fd48;});}return null;};}function removeEntity(_0x35e503,_0x148211){return function(_0x42e4f0){if(_0x42e4f0){return _0x42e4f0[_0x615f('0x2a')]()[_0x615f('0x29')](function(){_0x35e503['status'](0xcc)[_0x615f('0x1d')]();});}};}function handleEntityNotFound(_0xcf0028,_0x5cdd63){return function(_0x236493){if(!_0x236493){_0xcf0028[_0x615f('0x2b')](0x194);}return _0x236493;};}function handleError(_0x12a682,_0x33196b){_0x33196b=_0x33196b||0x1f4;return function(_0x54f1fa){logger[_0x615f('0x2c')](_0x54f1fa[_0x615f('0x2d')]);if(_0x54f1fa['name']){delete _0x54f1fa[_0x615f('0x2e')];}_0x12a682['status'](_0x33196b)[_0x615f('0x2f')](_0x54f1fa);};}exports[_0x615f('0x30')]=function(_0x53396a,_0x1f72ea){var _0x1013d0={},_0x20771e={},_0x15d9e4={'count':0x0,'rows':[]};var _0x3396cc=_[_0x615f('0x31')](db['VoiceQueueReport']['rawAttributes'],function(_0x14c88c){return{'name':_0x14c88c[_0x615f('0x32')],'type':_0x14c88c['type'][_0x615f('0x33')]};});_0x20771e['model']=_[_0x615f('0x31')](_0x3396cc,_0x615f('0x2e'));_0x20771e[_0x615f('0x34')]=_[_0x615f('0x35')](_0x53396a[_0x615f('0x34')]);_0x20771e[_0x615f('0x36')]=_[_0x615f('0x37')](_0x20771e[_0x615f('0x38')],_0x20771e[_0x615f('0x34')]);_0x1013d0['attributes']=_['intersection'](_0x20771e[_0x615f('0x38')],qs[_0x615f('0x39')](_0x53396a[_0x615f('0x34')][_0x615f('0x39')]));_0x1013d0['attributes']=_0x1013d0[_0x615f('0x3a')]['length']?_0x1013d0[_0x615f('0x3a')]:_0x20771e[_0x615f('0x38')];if(!_0x53396a[_0x615f('0x34')]['hasOwnProperty'](_0x615f('0x3b'))){_0x1013d0[_0x615f('0x21')]=qs[_0x615f('0x21')](_0x53396a['query']['limit']);_0x1013d0['offset']=qs[_0x615f('0x1f')](_0x53396a['query']['offset']);}_0x1013d0[_0x615f('0x3c')]=qs[_0x615f('0x3d')](_0x53396a[_0x615f('0x34')]['sort']);_0x1013d0[_0x615f('0x3e')]=qs[_0x615f('0x36')](_[_0x615f('0x3f')](_0x53396a[_0x615f('0x34')],_0x20771e[_0x615f('0x36')]),_0x3396cc);if(_0x53396a[_0x615f('0x34')][_0x615f('0x40')]){_0x1013d0[_0x615f('0x3e')]=_[_0x615f('0x41')](_0x1013d0[_0x615f('0x3e')],{'$or':_[_0x615f('0x31')](_0x3396cc,function(_0x5854fe){if(_0x5854fe['type']!=='VIRTUAL'){var _0x59450d={};_0x59450d[_0x5854fe[_0x615f('0x2e')]]={'$like':'%'+_0x53396a[_0x615f('0x34')][_0x615f('0x40')]+'%'};return _0x59450d;}})});}_0x1013d0=_['merge']({},_0x1013d0,_0x53396a[_0x615f('0x42')]);var _0x201290={'where':_0x1013d0['where']};return db[_0x615f('0x43')][_0x615f('0x22')](_0x201290)[_0x615f('0x29')](function(_0x8dda20){_0x15d9e4['count']=_0x8dda20;if(_0x53396a[_0x615f('0x34')]['includeAll']){_0x1013d0[_0x615f('0x44')]=[{'all':!![]}];}return db[_0x615f('0x43')][_0x615f('0x45')](_0x1013d0);})['then'](function(_0xf5df9a){_0x15d9e4[_0x615f('0x46')]=_0xf5df9a;return _0x15d9e4;})['then'](respondWithFilteredResult(_0x1f72ea,_0x1013d0))[_0x615f('0x47')](handleError(_0x1f72ea,null));};exports[_0x615f('0x48')]=function(_0x299e5d,_0x46342a){var _0x5dee93={'raw':![],'where':{'id':_0x299e5d[_0x615f('0x49')]['id']}},_0x1828cd={};_0x1828cd[_0x615f('0x38')]=_[_0x615f('0x35')](db[_0x615f('0x43')][_0x615f('0x4a')]);_0x1828cd[_0x615f('0x34')]=_[_0x615f('0x35')](_0x299e5d['query']);_0x1828cd[_0x615f('0x36')]=_[_0x615f('0x37')](_0x1828cd[_0x615f('0x38')],_0x1828cd['query']);_0x5dee93[_0x615f('0x3a')]=_['intersection'](_0x1828cd[_0x615f('0x38')],qs[_0x615f('0x39')](_0x299e5d[_0x615f('0x34')][_0x615f('0x39')]));_0x5dee93[_0x615f('0x3a')]=_0x5dee93['attributes'][_0x615f('0x4b')]?_0x5dee93[_0x615f('0x3a')]:_0x1828cd['model'];if(_0x299e5d[_0x615f('0x34')]['includeAll']){_0x5dee93[_0x615f('0x44')]=[{'all':!![]}];}_0x5dee93=_['merge']({},_0x5dee93,_0x299e5d['options']);return db['VoiceQueueReport'][_0x615f('0x4c')](_0x5dee93)[_0x615f('0x29')](handleEntityNotFound(_0x46342a,null))[_0x615f('0x29')](respondWithResult(_0x46342a,null))['catch'](handleError(_0x46342a,null));};exports[_0x615f('0x4d')]=function(_0x37ec44,_0x5adeb4){return db[_0x615f('0x43')][_0x615f('0x4d')](_0x37ec44[_0x615f('0x4e')],{})[_0x615f('0x29')](respondWithResult(_0x5adeb4,0xc9))[_0x615f('0x47')](handleError(_0x5adeb4,null));};exports[_0x615f('0x28')]=function(_0xdbc7a5,_0x1714ff){if(_0xdbc7a5['body']['id']){delete _0xdbc7a5['body']['id'];}return db[_0x615f('0x43')][_0x615f('0x4c')]({'where':{'id':_0xdbc7a5[_0x615f('0x49')]['id']}})[_0x615f('0x29')](handleEntityNotFound(_0x1714ff,null))['then'](saveUpdates(_0xdbc7a5[_0x615f('0x4e')],null))[_0x615f('0x29')](respondWithResult(_0x1714ff,null))['catch'](handleError(_0x1714ff,null));};exports['destroy']=function(_0x909a9d,_0xb9ee9c){return db['VoiceQueueReport'][_0x615f('0x4c')]({'where':{'id':_0x909a9d[_0x615f('0x49')]['id']}})[_0x615f('0x29')](handleEntityNotFound(_0xb9ee9c,null))[_0x615f('0x29')](removeEntity(_0xb9ee9c,null))[_0x615f('0x47')](handleError(_0xb9ee9c,null));};exports[_0x615f('0x4f')]=function(_0x1bb637,_0x920afd){return db[_0x615f('0x43')][_0x615f('0x4f')]()[_0x615f('0x29')](respondWithResult(_0x920afd,null))[_0x615f('0x47')](handleError(_0x920afd,null));};exports[_0x615f('0x50')]=function(_0x2b6cab,_0x28e8ab){var _0x24007a={},_0x2e9a84={},_0xed6cad={'count':0x0,'rows':[]};_0x2e9a84['model']=_[_0x615f('0x35')](db[_0x615f('0x43')]['rawAttributes']);_0x2e9a84['query']=_[_0x615f('0x35')](_0x2b6cab['query']);_0x2e9a84[_0x615f('0x36')]=_[_0x615f('0x37')](_0x2e9a84[_0x615f('0x38')],_0x2e9a84[_0x615f('0x34')]);_0x24007a[_0x615f('0x3a')]=_[_0x615f('0x37')](_0x2e9a84['model'],qs['fields'](_0x2b6cab[_0x615f('0x34')]['fields']));_0x24007a[_0x615f('0x3a')]=_0x24007a[_0x615f('0x3a')][_0x615f('0x4b')]?_0x24007a[_0x615f('0x3a')]:_0x2e9a84[_0x615f('0x38')];if(!_0x2b6cab['query'][_0x615f('0x51')](_0x615f('0x3b'))){_0x24007a[_0x615f('0x21')]=qs['limit'](_0x2b6cab['query']['limit']);_0x24007a[_0x615f('0x1f')]=qs[_0x615f('0x1f')](_0x2b6cab[_0x615f('0x34')][_0x615f('0x1f')]);}_0x24007a[_0x615f('0x3c')]=qs['sort'](_0x2b6cab[_0x615f('0x34')][_0x615f('0x3d')]);_0x24007a[_0x615f('0x3e')]=qs[_0x615f('0x36')](_[_0x615f('0x3f')](_0x2b6cab[_0x615f('0x34')],_0x2e9a84['filters']));if(_0x2b6cab[_0x615f('0x34')][_0x615f('0x40')]){_0x24007a[_0x615f('0x3e')]=_[_0x615f('0x41')](_0x24007a[_0x615f('0x3e')],{'$or':_[_0x615f('0x31')](_0x24007a[_0x615f('0x3a')],function(_0x229574){var _0x19c20d={};_0x19c20d[_0x229574]={'$like':'%'+_0x2b6cab[_0x615f('0x34')][_0x615f('0x40')]+'%'};return _0x19c20d;})});}_0x24007a=_['merge']({},_0x24007a,_0x2b6cab[_0x615f('0x42')]);var _0x1e2828={'where':_0x24007a[_0x615f('0x3e')]};return db[_0x615f('0x43')][_0x615f('0x22')](_0x1e2828)[_0x615f('0x29')](function(_0x42a415){_0xed6cad[_0x615f('0x22')]=_0x42a415;if(_0x2b6cab[_0x615f('0x34')][_0x615f('0x52')]){_0x24007a[_0x615f('0x44')]=[{'all':!![]}];}return db[_0x615f('0x43')]['findAll'](_0x24007a);})[_0x615f('0x29')](function(_0x2653d1){_0xed6cad[_0x615f('0x46')]=_0x2653d1;return _0xed6cad;})[_0x615f('0x29')](respondWithFilteredResult(_0x28e8ab,_0x24007a,_0x615f('0x50')))['catch'](handleError(_0x28e8ab,null,_0x615f('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 29a7915..25fbfcc 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 _0x49d2=['save','update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x29076f,_0x1f763e){var _0x41090c=function(_0x55f12b){while(--_0x55f12b){_0x29076f['push'](_0x29076f['shift']());}};_0x41090c(++_0x1f763e);}(_0x49d2,0x1e6));var _0x249d=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x49d2[_0x35d8af];return _0x1d08b0;};'use strict';var EventEmitter=require(_0x249d('0x0'));var VoiceQueueReport=require(_0x249d('0x1'))['db'][_0x249d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x249d('0x3')](0x0);var events={'afterCreate':_0x249d('0x4'),'afterUpdate':_0x249d('0x5'),'afterDestroy':_0x249d('0x6')};function emitEvent(_0x41df2f){return function(_0x380034,_0x15627b,_0x32c62c){VoiceQueueReportEvents[_0x249d('0x7')](_0x41df2f+':'+_0x380034['id'],_0x380034);VoiceQueueReportEvents[_0x249d('0x7')](_0x41df2f,_0x380034);_0x32c62c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x249d('0x8')](e,emitEvent(event));}}module[_0x249d('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb037=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x702c81,_0x439d8d){var _0x5b85da=function(_0x4fe418){while(--_0x4fe418){_0x702c81['push'](_0x702c81['shift']());}};_0x5b85da(++_0x439d8d);}(_0xb037,0x17a));var _0x7b03=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb037[_0x1b349a];return _0x5d1f7c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x7b03('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7b03('0x1')](0x0);var events={'afterCreate':_0x7b03('0x2'),'afterUpdate':_0x7b03('0x3'),'afterDestroy':_0x7b03('0x4')};function emitEvent(_0x11fca5){return function(_0x4a62e4,_0x3ffaef,_0x2d06e5){VoiceQueueReportEvents[_0x7b03('0x5')](_0x11fca5+':'+_0x4a62e4['id'],_0x4a62e4);VoiceQueueReportEvents['emit'](_0x11fca5,_0x4a62e4);_0x2d06e5(null);};}for(var e in events){if(events[_0x7b03('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 88457fc..f13b1ce 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 _0xb88b=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','VoiceQueueReport','report_queue'];(function(_0x4ddbd0,_0x4c7b11){var _0x260b32=function(_0x525f0d){while(--_0x525f0d){_0x4ddbd0['push'](_0x4ddbd0['shift']());}};_0x260b32(++_0x4c7b11);}(_0xb88b,0x1c2));var _0xbb88=function(_0x437462,_0x54ad8d){_0x437462=_0x437462-0x0;var _0xb5e19a=_0xb88b[_0x437462];return _0xb5e19a;};'use strict';var _=require(_0xbb88('0x0'));var util=require(_0xbb88('0x1'));var logger=require(_0xbb88('0x2'))(_0xbb88('0x3'));var moment=require(_0xbb88('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb88('0x5'));var fs=require('fs');var path=require(_0xbb88('0x6'));var rimraf=require(_0xbb88('0x7'));var config=require(_0xbb88('0x8'));var attributes=require(_0xbb88('0x9'));module['exports']=function(_0x3da421,_0x41520c){return _0x3da421['define'](_0xbb88('0xa'),attributes,{'tableName':_0xbb88('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb88('0xc')]},{'fields':[_0xbb88('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0462=['exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','api','request-promise','path','rimraf'];(function(_0x3c8bd4,_0x497316){var _0xb28304=function(_0x2250d3){while(--_0x2250d3){_0x3c8bd4['push'](_0x3c8bd4['shift']());}};_0xb28304(++_0x497316);}(_0x0462,0x1d4));var _0x2046=function(_0x56217d,_0x42c9dd){_0x56217d=_0x56217d-0x0;var _0x2f2806=_0x0462[_0x56217d];return _0x2f2806;};'use strict';var _=require(_0x2046('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2046('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2046('0x2'));var fs=require('fs');var path=require(_0x2046('0x3'));var rimraf=require(_0x2046('0x4'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x2046('0x5')]=function(_0x3f0a41,_0x2f8e8f){return _0x3f0a41[_0x2046('0x6')](_0x2046('0x7'),attributes,{'tableName':_0x2046('0x8'),'paranoid':![],'indexes':[{'fields':[_0x2046('0x9')]},{'fields':[_0x2046('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 12a9d74..354d20d 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 _0x4d4c=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d4c,0x14f));var _0xc4d4=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x4d4c[_0x1b51ea];return _0x18bbdc;};'use strict';var _=require(_0xc4d4('0x0'));var util=require(_0xc4d4('0x1'));var moment=require(_0xc4d4('0x2'));var BPromise=require(_0xc4d4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d4('0x4'));var db=require(_0xc4d4('0x5'))['db'];var utils=require(_0xc4d4('0x6'));var logger=require(_0xc4d4('0x7'))(_0xc4d4('0x8'));var config=require(_0xc4d4('0x9'));var jayson=require(_0xc4d4('0xa'));var client=jayson[_0xc4d4('0xb')][_0xc4d4('0xc')]({'port':0x232a});config[_0xc4d4('0xd')]=_['defaults'](config[_0xc4d4('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4d4('0xe'))(new Redis(config[_0xc4d4('0xd')]));require(_0xc4d4('0xf'))[_0xc4d4('0x10')](socket);function respondWithRpcPromise(_0x58af05,_0xb4ac89,_0x35d09d){return new BPromise(function(_0x491b8b,_0x47a0fb){return client[_0xc4d4('0x11')](_0x58af05,_0x35d09d)[_0xc4d4('0x12')](function(_0x244605){logger[_0xc4d4('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0xb4ac89,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0xb4ac89,_0xc4d4('0x14'),JSON['stringify'](_0x244605));if(_0x244605[_0xc4d4('0x15')]){if(_0x244605['error'][_0xc4d4('0x16')]===0x1f4){logger['error'](_0xc4d4('0x17'),_0xb4ac89,_0x244605[_0xc4d4('0x15')][_0xc4d4('0x18')]);return _0x47a0fb(_0x244605[_0xc4d4('0x15')]['message']);}logger[_0xc4d4('0x15')](_0xc4d4('0x17'),_0xb4ac89,_0x244605[_0xc4d4('0x15')]['message']);return _0x491b8b(_0x244605[_0xc4d4('0x15')][_0xc4d4('0x18')]);}else{logger[_0xc4d4('0x13')](_0xc4d4('0x17'),_0xb4ac89,_0xc4d4('0x14'));_0x491b8b(_0x244605[_0xc4d4('0x19')]['message']);}})[_0xc4d4('0x1a')](function(_0x57895d){logger[_0xc4d4('0x15')](_0xc4d4('0x17'),_0xb4ac89,_0x57895d);_0x47a0fb(_0x57895d);});});}exports[_0xc4d4('0x1b')]=function(_0x4b22d4){var _0x38e4fe=this;return new Promise(function(_0x15036c,_0x140af4){return db[_0xc4d4('0x1c')]['findAll']({'raw':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x1f')]||null:null,'attributes':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4['options'][_0xc4d4('0x20')]||null:null,'limit':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4[_0xc4d4('0x1d')][_0xc4d4('0x21')]||null:null,'include':_0x4b22d4[_0xc4d4('0x1d')]?_0x4b22d4[_0xc4d4('0x1d')]['include']?_[_0xc4d4('0x22')](_0x4b22d4[_0xc4d4('0x1d')][_0xc4d4('0x23')],function(_0x39bbb4){return{'model':db[_0x39bbb4[_0xc4d4('0x24')]],'as':_0x39bbb4['as'],'attributes':_0x39bbb4[_0xc4d4('0x20')],'include':_0x39bbb4[_0xc4d4('0x23')]?_[_0xc4d4('0x22')](_0x39bbb4[_0xc4d4('0x23')],function(_0x3ea7b0){return{'model':db[_0x3ea7b0[_0xc4d4('0x24')]],'as':_0x3ea7b0['as'],'attributes':_0x3ea7b0['attributes'],'include':_0x3ea7b0[_0xc4d4('0x23')]?_[_0xc4d4('0x22')](_0x3ea7b0[_0xc4d4('0x23')],function(_0x2e2d72){return{'model':db[_0x2e2d72[_0xc4d4('0x24')]],'as':_0x2e2d72['as'],'attributes':_0x2e2d72[_0xc4d4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc4d4('0x12')](function(_0x1d036c){logger['info']('GetVoiceQueueReport',_0x4b22d4);logger[_0xc4d4('0x25')](_0xc4d4('0x1b'),_0x4b22d4,JSON['stringify'](_0x1d036c));_0x15036c(_0x1d036c);})[_0xc4d4('0x1a')](function(_0x2847a8){logger[_0xc4d4('0x15')]('GetVoiceQueueReport',_0x2847a8[_0xc4d4('0x18')],_0x4b22d4);_0x140af4(_0x38e4fe['error'](0x1f4,_0x2847a8[_0xc4d4('0x18')]));});});};exports[_0xc4d4('0x26')]=function(_0x232c7a){var _0x32bd38=this;return new Promise(function(_0x51b2b1,_0x1f8cf4){return db[_0xc4d4('0x1c')]['create'](_0x232c7a[_0xc4d4('0x27')],{'raw':_0x232c7a[_0xc4d4('0x1d')]?_0x232c7a[_0xc4d4('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xc4d4('0x12')](function(_0x26e725){logger['info'](_0xc4d4('0x26'),_0x232c7a);logger['debug'](_0xc4d4('0x26'),_0x232c7a,JSON[_0xc4d4('0x28')](_0x26e725));_0x51b2b1(_0x26e725);})[_0xc4d4('0x1a')](function(_0x3eb121){logger[_0xc4d4('0x15')](_0xc4d4('0x26'),_0x3eb121['message'],_0x232c7a);_0x1f8cf4(_0x32bd38['error'](0x1f4,_0x3eb121['message']));});});};exports[_0xc4d4('0x29')]=function(_0x59ae80){var _0x39d05e=this;return new Promise(function(_0x4b10da,_0x321f86){return db[_0xc4d4('0x1c')][_0xc4d4('0x2a')](_0x59ae80[_0xc4d4('0x27')],{'raw':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x1f')]||null:null,'attributes':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80[_0xc4d4('0x1d')][_0xc4d4('0x20')]||null:null,'limit':_0x59ae80[_0xc4d4('0x1d')]?_0x59ae80['options'][_0xc4d4('0x21')]||null:null})[_0xc4d4('0x12')](function(_0x23c7da){logger[_0xc4d4('0x13')](_0xc4d4('0x29'),_0x59ae80);logger[_0xc4d4('0x25')](_0xc4d4('0x29'),_0x59ae80,JSON[_0xc4d4('0x28')](_0x23c7da));_0x4b10da(_0x23c7da);})[_0xc4d4('0x1a')](function(_0x4369a8){logger[_0xc4d4('0x15')](_0xc4d4('0x29'),_0x4369a8[_0xc4d4('0x18')],_0x59ae80);_0x321f86(_0x39d05e['error'](0x1f4,_0x4369a8[_0xc4d4('0x18')]));});});}; \ No newline at end of file +var _0x7a2f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0x7a2f,0x100));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var moment=require('moment');var BPromise=require(_0xf7a2('0x2'));var rs=require(_0xf7a2('0x3'));var fs=require('fs');var Redis=require(_0xf7a2('0x4'));var db=require(_0xf7a2('0x5'))['db'];var utils=require(_0xf7a2('0x6'));var logger=require(_0xf7a2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7a2('0x8'));var client=jayson[_0xf7a2('0x9')][_0xf7a2('0xa')]({'port':0x232a});config[_0xf7a2('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf7a2('0xc'))(new Redis(config[_0xf7a2('0xb')]));require(_0xf7a2('0xd'))[_0xf7a2('0xe')](socket);function respondWithRpcPromise(_0x3b655a,_0x3cb0b0,_0x44080f){return new BPromise(function(_0x1ce0ae,_0x15bc1a){return client['request'](_0x3b655a,_0x44080f)[_0xf7a2('0xf')](function(_0x523249){logger[_0xf7a2('0x10')](_0xf7a2('0x11'),_0x3cb0b0,_0xf7a2('0x12'));logger[_0xf7a2('0x13')](_0xf7a2('0x14'),_0x3cb0b0,_0xf7a2('0x12'),JSON[_0xf7a2('0x15')](_0x523249));if(_0x523249['error']){if(_0x523249[_0xf7a2('0x16')][_0xf7a2('0x17')]===0x1f4){logger[_0xf7a2('0x16')](_0xf7a2('0x11'),_0x3cb0b0,_0x523249[_0xf7a2('0x16')][_0xf7a2('0x18')]);return _0x15bc1a(_0x523249['error'][_0xf7a2('0x18')]);}logger['error'](_0xf7a2('0x11'),_0x3cb0b0,_0x523249[_0xf7a2('0x16')][_0xf7a2('0x18')]);return _0x1ce0ae(_0x523249[_0xf7a2('0x16')]['message']);}else{logger[_0xf7a2('0x10')](_0xf7a2('0x11'),_0x3cb0b0,_0xf7a2('0x12'));_0x1ce0ae(_0x523249[_0xf7a2('0x19')]['message']);}})[_0xf7a2('0x1a')](function(_0x5ec530){logger['error'](_0xf7a2('0x11'),_0x3cb0b0,_0x5ec530);_0x15bc1a(_0x5ec530);});});}exports[_0xf7a2('0x1b')]=function(_0x2fbc83){var _0x5a79cd=this;return new Promise(function(_0x3469b3,_0x4ae5cb){return db[_0xf7a2('0x1c')][_0xf7a2('0x1d')]({'raw':_0x2fbc83[_0xf7a2('0x1e')]?_0x2fbc83['options'][_0xf7a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x2fbc83[_0xf7a2('0x1e')]?_0x2fbc83[_0xf7a2('0x1e')][_0xf7a2('0x20')]||null:null,'attributes':_0x2fbc83['options']?_0x2fbc83[_0xf7a2('0x1e')][_0xf7a2('0x21')]||null:null,'limit':_0x2fbc83[_0xf7a2('0x1e')]?_0x2fbc83['options'][_0xf7a2('0x22')]||null:null,'include':_0x2fbc83['options']?_0x2fbc83[_0xf7a2('0x1e')][_0xf7a2('0x23')]?_[_0xf7a2('0x24')](_0x2fbc83[_0xf7a2('0x1e')][_0xf7a2('0x23')],function(_0x7ab8a8){return{'model':db[_0x7ab8a8[_0xf7a2('0x25')]],'as':_0x7ab8a8['as'],'attributes':_0x7ab8a8['attributes'],'include':_0x7ab8a8['include']?_['map'](_0x7ab8a8[_0xf7a2('0x23')],function(_0x59b11c){return{'model':db[_0x59b11c['model']],'as':_0x59b11c['as'],'attributes':_0x59b11c[_0xf7a2('0x21')],'include':_0x59b11c[_0xf7a2('0x23')]?_['map'](_0x59b11c[_0xf7a2('0x23')],function(_0x28bd77){return{'model':db[_0x28bd77[_0xf7a2('0x25')]],'as':_0x28bd77['as'],'attributes':_0x28bd77['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7a2('0xf')](function(_0x2c95e9){logger[_0xf7a2('0x10')](_0xf7a2('0x1b'),_0x2fbc83);logger[_0xf7a2('0x13')]('GetVoiceQueueReport',_0x2fbc83,JSON['stringify'](_0x2c95e9));_0x3469b3(_0x2c95e9);})['catch'](function(_0x4e9b00){logger['error'](_0xf7a2('0x1b'),_0x4e9b00[_0xf7a2('0x18')],_0x2fbc83);_0x4ae5cb(_0x5a79cd[_0xf7a2('0x16')](0x1f4,_0x4e9b00[_0xf7a2('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x50d76b){var _0x2b3c01=this;return new Promise(function(_0x48a528,_0x2c11b1){return db[_0xf7a2('0x1c')][_0xf7a2('0x26')](_0x50d76b[_0xf7a2('0x27')],{'raw':_0x50d76b[_0xf7a2('0x1e')]?_0x50d76b[_0xf7a2('0x1e')][_0xf7a2('0x1f')]===undefined?!![]:![]:!![]})[_0xf7a2('0xf')](function(_0xb3304c){logger[_0xf7a2('0x10')](_0xf7a2('0x28'),_0x50d76b);logger[_0xf7a2('0x13')](_0xf7a2('0x28'),_0x50d76b,JSON[_0xf7a2('0x15')](_0xb3304c));_0x48a528(_0xb3304c);})[_0xf7a2('0x1a')](function(_0x58bfe5){logger[_0xf7a2('0x16')](_0xf7a2('0x28'),_0x58bfe5[_0xf7a2('0x18')],_0x50d76b);_0x2c11b1(_0x2b3c01[_0xf7a2('0x16')](0x1f4,_0x58bfe5[_0xf7a2('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2f3d45){var _0x403bd8=this;return new Promise(function(_0x9f90c9,_0x4cb7a9){return db[_0xf7a2('0x1c')][_0xf7a2('0x29')](_0x2f3d45['body'],{'raw':_0x2f3d45[_0xf7a2('0x1e')]?_0x2f3d45[_0xf7a2('0x1e')][_0xf7a2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f3d45[_0xf7a2('0x1e')]?_0x2f3d45[_0xf7a2('0x1e')][_0xf7a2('0x20')]||null:null,'attributes':_0x2f3d45[_0xf7a2('0x1e')]?_0x2f3d45[_0xf7a2('0x1e')]['attributes']||null:null,'limit':_0x2f3d45[_0xf7a2('0x1e')]?_0x2f3d45[_0xf7a2('0x1e')]['limit']||null:null})[_0xf7a2('0xf')](function(_0x1ebfcf){logger['info']('UpdateVoiceQueueReport',_0x2f3d45);logger[_0xf7a2('0x13')]('UpdateVoiceQueueReport',_0x2f3d45,JSON[_0xf7a2('0x15')](_0x1ebfcf));_0x9f90c9(_0x1ebfcf);})[_0xf7a2('0x1a')](function(_0x14ea6c){logger[_0xf7a2('0x16')](_0xf7a2('0x2a'),_0x14ea6c[_0xf7a2('0x18')],_0x2f3d45);_0x4cb7a9(_0x403bd8['error'](0x1f4,_0x14ea6c[_0xf7a2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fb3320b..d7d756a 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 _0x6ec9=['./voiceQueueReport.events','remove','register','voiceQueueReport:'];(function(_0x4ff1f9,_0x3963b8){var _0x4393f7=function(_0x583d86){while(--_0x583d86){_0x4ff1f9['push'](_0x4ff1f9['shift']());}};_0x4393f7(++_0x3963b8);}(_0x6ec9,0x174));var _0x96ec=function(_0x2be44a,_0x788a2f){_0x2be44a=_0x2be44a-0x0;var _0x52b27f=_0x6ec9[_0x2be44a];return _0x52b27f;};'use strict';var VoiceQueueReportEvents=require(_0x96ec('0x0'));var events=['save',_0x96ec('0x1'),'update'];function createListener(_0x37c970,_0x4e91e7){return function(_0x15e89a){_0x4e91e7['emit'](_0x37c970,_0x15e89a);};}function removeListener(_0x112569,_0x286bd7){return function(){VoiceQueueReportEvents['removeListener'](_0x112569,_0x286bd7);};}exports[_0x96ec('0x2')]=function(_0x41a215){for(var _0x2fcbb7=0x0,_0x5bc079=events['length'];_0x2fcbb7<_0x5bc079;_0x2fcbb7++){var _0x5ee7a3=events[_0x2fcbb7];var _0x8214b2=createListener(_0x96ec('0x3')+_0x5ee7a3,_0x41a215);VoiceQueueReportEvents['on'](_0x5ee7a3,_0x8214b2);}}; \ No newline at end of file +var _0xd6d6=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x71a78a,_0x4ee13b){var _0x4ce8cd=function(_0x4dd271){while(--_0x4dd271){_0x71a78a['push'](_0x71a78a['shift']());}};_0x4ce8cd(++_0x4ee13b);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3e96db,_0x53b38c){_0x3e96db=_0x3e96db-0x0;var _0x53c76c=_0xd6d6[_0x3e96db];return _0x53c76c;};'use strict';var VoiceQueueReportEvents=require(_0x6d6d('0x0'));var events=[_0x6d6d('0x1'),_0x6d6d('0x2'),_0x6d6d('0x3')];function createListener(_0x536523,_0x2e1aed){return function(_0x3b743d){_0x2e1aed[_0x6d6d('0x4')](_0x536523,_0x3b743d);};}function removeListener(_0x2a838a,_0x5207c9){return function(){VoiceQueueReportEvents[_0x6d6d('0x5')](_0x2a838a,_0x5207c9);};}exports[_0x6d6d('0x6')]=function(_0x5702dc){for(var _0x210ff7=0x0,_0x1bf731=events[_0x6d6d('0x7')];_0x210ff7<_0x1bf731;_0x210ff7++){var _0x18f824=events[_0x210ff7];var _0xd49f57=createListener(_0x6d6d('0x8')+_0x18f824,_0x5702dc);VoiceQueueReportEvents['on'](_0x18f824,_0xd49f57);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ba52d12..f9792d9 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 _0x0e37=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','post','create','put','/:id','update','delete','exports','util','connect-timeout','express'];(function(_0x584291,_0x34e012){var _0x289305=function(_0x5d9b12){while(--_0x5d9b12){_0x584291['push'](_0x584291['shift']());}};_0x289305(++_0x34e012);}(_0x0e37,0xc9));var _0x70e3=function(_0x2e7517,_0x95b591){_0x2e7517=_0x2e7517-0x0;var _0x42f135=_0x0e37[_0x2e7517];return _0x42f135;};'use strict';var multer=require('multer');var util=require(_0x70e3('0x0'));var path=require('path');var timeout=require(_0x70e3('0x1'));var express=require(_0x70e3('0x2'));var router=express[_0x70e3('0x3')]();var fs_extra=require(_0x70e3('0x4'));var auth=require(_0x70e3('0x5'));var interaction=require(_0x70e3('0x6'));var config=require(_0x70e3('0x7'));var controller=require(_0x70e3('0x8'));router['get']('/',auth[_0x70e3('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x70e3('0xa')]('/',auth['isAuthenticated'](),controller[_0x70e3('0xb')]);router[_0x70e3('0xc')](_0x70e3('0xd'),auth[_0x70e3('0x9')](),controller[_0x70e3('0xe')]);router[_0x70e3('0xf')](_0x70e3('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x70e3('0x10')]=router; \ No newline at end of file +var _0x4b49=['post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','index','get','/:id','isAuthenticated','show'];(function(_0xf9b219,_0x2b3b07){var _0x231c8b=function(_0x5d432c){while(--_0x5d432c){_0xf9b219['push'](_0xf9b219['shift']());}};_0x231c8b(++_0x2b3b07);}(_0x4b49,0xef));var _0x94b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x94b4('0x0'));var util=require(_0x94b4('0x1'));var path=require(_0x94b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x94b4('0x3'));var router=express[_0x94b4('0x4')]();var fs_extra=require(_0x94b4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x94b4('0x6'));var config=require('../../config/environment');var controller=require(_0x94b4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x94b4('0x8')]);router[_0x94b4('0x9')](_0x94b4('0xa'),auth[_0x94b4('0xb')](),controller[_0x94b4('0xc')]);router[_0x94b4('0xd')]('/',auth[_0x94b4('0xb')](),controller[_0x94b4('0xe')]);router['put'](_0x94b4('0xa'),auth[_0x94b4('0xb')](),controller[_0x94b4('0xf')]);router['delete'](_0x94b4('0xa'),auth[_0x94b4('0xb')](),controller[_0x94b4('0x10')]);module[_0x94b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3dd7980..6b5a277 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 _0x5c54=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c54,0x1b1));var _0x45c5=function(_0x9c5524,_0x2912b9){_0x9c5524=_0x9c5524-0x0;var _0x25f8a7=_0x5c54[_0x9c5524];return _0x25f8a7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x45c5('0x0'));module[_0x45c5('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x45c5('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x45c5('0x3')](_0x45c5('0x4'))}}; \ No newline at end of file +var _0x516e=['sequelize','STRING'];(function(_0x4a5760,_0x134c15){var _0x2994b=function(_0x9c3df8){while(--_0x9c3df8){_0x4a5760['push'](_0x4a5760['shift']());}};_0x2994b(++_0x134c15);}(_0x516e,0x110));var _0xe516=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x516e[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xe516('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xe516('0x1')]},'callid':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe516('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8c29a44..ebe92e7 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 _0x4d73=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','VoiceQueuesLog','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','status','send','map','rawAttributes','fieldName','type','key','model'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x4d73,0x148));var _0x34d7=function(_0x228344,_0x4bbf3d){_0x228344=_0x228344-0x0;var _0x23df35=_0x4d73[_0x228344];return _0x23df35;};'use strict';var emlformat=require(_0x34d7('0x0'));var rimraf=require(_0x34d7('0x1'));var zipdir=require(_0x34d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34d7('0x3'));var moment=require('moment');var BPromise=require(_0x34d7('0x4'));var Mustache=require(_0x34d7('0x5'));var util=require(_0x34d7('0x6'));var path=require('path');var sox=require(_0x34d7('0x7'));var csv=require(_0x34d7('0x8'));var ejs=require(_0x34d7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34d7('0xa'));var squel=require('squel');var crypto=require(_0x34d7('0xb'));var jsforce=require(_0x34d7('0xc'));var deskjs=require(_0x34d7('0xd'));var toCsv=require(_0x34d7('0x8'));var querystring=require(_0x34d7('0xe'));var Papa=require(_0x34d7('0xf'));var Redis=require(_0x34d7('0x10'));var authService=require(_0x34d7('0x11'));var qs=require(_0x34d7('0x12'));var as=require(_0x34d7('0x13'));var hardwareService=require(_0x34d7('0x14'));var logger=require('../../config/logger')(_0x34d7('0x15'));var utils=require(_0x34d7('0x16'));var config=require(_0x34d7('0x17'));var licenseUtil=require(_0x34d7('0x18'));var db=require(_0x34d7('0x19'))['db'];function respondWithStatusCode(_0x1ad5e1,_0xc5ce63){_0xc5ce63=_0xc5ce63||0xcc;return function(_0x38d253){if(_0x38d253){return _0x1ad5e1[_0x34d7('0x1a')](_0xc5ce63);}return _0x1ad5e1['status'](_0xc5ce63)[_0x34d7('0x1b')]();};}function respondWithResult(_0x959a9f,_0x1415e8){_0x1415e8=_0x1415e8||0xc8;return function(_0x581e4c){if(_0x581e4c){return _0x959a9f['status'](_0x1415e8)[_0x34d7('0x1c')](_0x581e4c);}};}function respondWithFilteredResult(_0xf3f9b3,_0x5716a1){return function(_0xde3e96){if(_0xde3e96){var _0x3ae028=typeof _0x5716a1['offset']===_0x34d7('0x1d')&&typeof _0x5716a1[_0x34d7('0x1e')]==='undefined';var _0x8769a7=_0xde3e96[_0x34d7('0x1f')];var _0x15c9b5=_0x3ae028?0x0:_0x5716a1[_0x34d7('0x20')];var _0x2b1699=_0x3ae028?_0xde3e96['count']:_0x5716a1['offset']+_0x5716a1['limit'];var _0x73fddd;if(_0x2b1699>=_0x8769a7){_0x2b1699=_0x8769a7;_0x73fddd=0xc8;}else{_0x73fddd=0xce;}_0xf3f9b3['status'](_0x73fddd);return _0xf3f9b3[_0x34d7('0x21')](_0x34d7('0x22'),_0x15c9b5+'-'+_0x2b1699+'/'+_0x8769a7)[_0x34d7('0x1c')](_0xde3e96);}return null;};}function patchUpdates(_0x3fbee8){return function(_0x59422d){try{jsonpatch[_0x34d7('0x23')](_0x59422d,_0x3fbee8,!![]);}catch(_0x374df0){return BPromise[_0x34d7('0x24')](_0x374df0);}return _0x59422d[_0x34d7('0x25')]();};}function saveUpdates(_0x4dde64,_0x5a9ccc){return function(_0x402b44){if(_0x402b44){return _0x402b44[_0x34d7('0x26')](_0x4dde64)['then'](function(_0x433505){return _0x433505;});}return null;};}function removeEntity(_0x361189,_0x2fa7ff){return function(_0x58232e){if(_0x58232e){return _0x58232e[_0x34d7('0x27')]()[_0x34d7('0x28')](function(){_0x361189['status'](0xcc)[_0x34d7('0x1b')]();});}};}function handleEntityNotFound(_0x27cbae,_0x595c99){return function(_0x1c2d23){if(!_0x1c2d23){_0x27cbae[_0x34d7('0x1a')](0x194);}return _0x1c2d23;};}function handleError(_0x43f0d4,_0x44e711){_0x44e711=_0x44e711||0x1f4;return function(_0x5112ef){logger[_0x34d7('0x29')](_0x5112ef[_0x34d7('0x2a')]);if(_0x5112ef[_0x34d7('0x2b')]){delete _0x5112ef[_0x34d7('0x2b')];}_0x43f0d4[_0x34d7('0x2c')](_0x44e711)[_0x34d7('0x2d')](_0x5112ef);};}exports['index']=function(_0x2a22b0,_0x47bd7e){var _0x55501a={},_0x34b9fd={},_0x3ead60={'count':0x0,'rows':[]};var _0x2f6e27=_[_0x34d7('0x2e')](db['VoiceQueuesLog'][_0x34d7('0x2f')],function(_0x255bde){return{'name':_0x255bde[_0x34d7('0x30')],'type':_0x255bde[_0x34d7('0x31')][_0x34d7('0x32')]};});_0x34b9fd[_0x34d7('0x33')]=_[_0x34d7('0x2e')](_0x2f6e27,_0x34d7('0x2b'));_0x34b9fd['query']=_[_0x34d7('0x34')](_0x2a22b0[_0x34d7('0x35')]);_0x34b9fd[_0x34d7('0x36')]=_[_0x34d7('0x37')](_0x34b9fd['model'],_0x34b9fd[_0x34d7('0x35')]);_0x55501a[_0x34d7('0x38')]=_[_0x34d7('0x37')](_0x34b9fd[_0x34d7('0x33')],qs['fields'](_0x2a22b0['query'][_0x34d7('0x39')]));_0x55501a['attributes']=_0x55501a[_0x34d7('0x38')][_0x34d7('0x3a')]?_0x55501a['attributes']:_0x34b9fd['model'];if(!_0x2a22b0[_0x34d7('0x35')]['hasOwnProperty'](_0x34d7('0x3b'))){_0x55501a[_0x34d7('0x1e')]=qs[_0x34d7('0x1e')](_0x2a22b0['query']['limit']);_0x55501a[_0x34d7('0x20')]=qs[_0x34d7('0x20')](_0x2a22b0['query'][_0x34d7('0x20')]);}_0x55501a[_0x34d7('0x3c')]=qs['sort'](_0x2a22b0[_0x34d7('0x35')]['sort']);_0x55501a[_0x34d7('0x3d')]=qs[_0x34d7('0x36')](_[_0x34d7('0x3e')](_0x2a22b0[_0x34d7('0x35')],_0x34b9fd['filters']),_0x2f6e27);if(_0x2a22b0[_0x34d7('0x35')][_0x34d7('0x3f')]){_0x55501a[_0x34d7('0x3d')]=_[_0x34d7('0x40')](_0x55501a[_0x34d7('0x3d')],{'$or':_['map'](_0x2f6e27,function(_0x35170d){if(_0x35170d[_0x34d7('0x31')]!=='VIRTUAL'){var _0x1796ee={};_0x1796ee[_0x35170d[_0x34d7('0x2b')]]={'$like':'%'+_0x2a22b0[_0x34d7('0x35')][_0x34d7('0x3f')]+'%'};return _0x1796ee;}})});}_0x55501a=_[_0x34d7('0x40')]({},_0x55501a,_0x2a22b0[_0x34d7('0x41')]);var _0x104f6e={'where':_0x55501a[_0x34d7('0x3d')]};return db[_0x34d7('0x42')][_0x34d7('0x1f')](_0x104f6e)['then'](function(_0xe3c0a1){_0x3ead60[_0x34d7('0x1f')]=_0xe3c0a1;if(_0x2a22b0['query'][_0x34d7('0x43')]){_0x55501a[_0x34d7('0x44')]=[{'all':!![]}];}return db[_0x34d7('0x42')][_0x34d7('0x45')](_0x55501a);})[_0x34d7('0x28')](function(_0xa9aa1b){_0x3ead60['rows']=_0xa9aa1b;return _0x3ead60;})[_0x34d7('0x28')](respondWithFilteredResult(_0x47bd7e,_0x55501a))[_0x34d7('0x46')](handleError(_0x47bd7e,null));};exports[_0x34d7('0x47')]=function(_0x56ab5a,_0x599c62){var _0x15eb94={'raw':!![],'where':{'id':_0x56ab5a[_0x34d7('0x48')]['id']}},_0xf4ec12={};_0xf4ec12[_0x34d7('0x33')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0xf4ec12[_0x34d7('0x35')]=_['keys'](_0x56ab5a[_0x34d7('0x35')]);_0xf4ec12['filters']=_['intersection'](_0xf4ec12['model'],_0xf4ec12['query']);_0x15eb94[_0x34d7('0x38')]=_[_0x34d7('0x37')](_0xf4ec12['model'],qs[_0x34d7('0x39')](_0x56ab5a['query'][_0x34d7('0x39')]));_0x15eb94[_0x34d7('0x38')]=_0x15eb94['attributes'][_0x34d7('0x3a')]?_0x15eb94[_0x34d7('0x38')]:_0xf4ec12[_0x34d7('0x33')];if(_0x56ab5a[_0x34d7('0x35')][_0x34d7('0x43')]){_0x15eb94[_0x34d7('0x44')]=[{'all':!![]}];}_0x15eb94=_[_0x34d7('0x40')]({},_0x15eb94,_0x56ab5a['options']);return db[_0x34d7('0x42')][_0x34d7('0x49')](_0x15eb94)[_0x34d7('0x28')](handleEntityNotFound(_0x599c62,null))[_0x34d7('0x28')](respondWithResult(_0x599c62,null))[_0x34d7('0x46')](handleError(_0x599c62,null));};exports[_0x34d7('0x4a')]=function(_0x49cfac,_0x392e74){return db[_0x34d7('0x42')][_0x34d7('0x4a')](_0x49cfac['body'],{})[_0x34d7('0x28')](respondWithResult(_0x392e74,0xc9))[_0x34d7('0x46')](handleError(_0x392e74,null));};exports[_0x34d7('0x26')]=function(_0x517a4,_0x3f884d){if(_0x517a4['body']['id']){delete _0x517a4[_0x34d7('0x4b')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x517a4[_0x34d7('0x48')]['id']}})[_0x34d7('0x28')](handleEntityNotFound(_0x3f884d,null))['then'](saveUpdates(_0x517a4[_0x34d7('0x4b')],null))[_0x34d7('0x28')](respondWithResult(_0x3f884d,null))[_0x34d7('0x46')](handleError(_0x3f884d,null));};exports[_0x34d7('0x27')]=function(_0x5755c9,_0x44488f){return db[_0x34d7('0x42')][_0x34d7('0x49')]({'where':{'id':_0x5755c9[_0x34d7('0x48')]['id']}})[_0x34d7('0x28')](handleEntityNotFound(_0x44488f,null))[_0x34d7('0x28')](removeEntity(_0x44488f,null))['catch'](handleError(_0x44488f,null));}; \ No newline at end of file +var _0x271f=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','params','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x271f,0x186));var _0xf271=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x271f[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xf271('0x0'));var rimraf=require(_0xf271('0x1'));var zipdir=require(_0xf271('0x2'));var jsonpatch=require(_0xf271('0x3'));var rp=require('request-promise');var moment=require(_0xf271('0x4'));var BPromise=require(_0xf271('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf271('0x6'));var sox=require(_0xf271('0x7'));var csv=require(_0xf271('0x8'));var ejs=require(_0xf271('0x9'));var fs=require('fs');var fs_extra=require(_0xf271('0xa'));var _=require(_0xf271('0xb'));var squel=require(_0xf271('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf271('0xd'));var toCsv=require(_0xf271('0x8'));var querystring=require('querystring');var Papa=require(_0xf271('0xe'));var Redis=require('ioredis');var authService=require(_0xf271('0xf'));var qs=require(_0xf271('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf271('0x11'));var logger=require(_0xf271('0x12'))(_0xf271('0x13'));var utils=require(_0xf271('0x14'));var config=require(_0xf271('0x15'));var licenseUtil=require(_0xf271('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b19f,_0x26de60){_0x26de60=_0x26de60||0xcc;return function(_0x34bddb){if(_0x34bddb){return _0x43b19f[_0xf271('0x17')](_0x26de60);}return _0x43b19f[_0xf271('0x18')](_0x26de60)[_0xf271('0x19')]();};}function respondWithResult(_0xdd1ae9,_0x351c9a){_0x351c9a=_0x351c9a||0xc8;return function(_0x1a5419){if(_0x1a5419){return _0xdd1ae9['status'](_0x351c9a)[_0xf271('0x1a')](_0x1a5419);}};}function respondWithFilteredResult(_0xb130d9,_0x42c4df){return function(_0x5c5143){if(_0x5c5143){var _0x3b84d6=typeof _0x42c4df[_0xf271('0x1b')]===_0xf271('0x1c')&&typeof _0x42c4df['limit']===_0xf271('0x1c');var _0x24b67c=_0x5c5143[_0xf271('0x1d')];var _0x1752a0=_0x3b84d6?0x0:_0x42c4df['offset'];var _0x3928e9=_0x3b84d6?_0x5c5143['count']:_0x42c4df['offset']+_0x42c4df[_0xf271('0x1e')];var _0x3924be;if(_0x3928e9>=_0x24b67c){_0x3928e9=_0x24b67c;_0x3924be=0xc8;}else{_0x3924be=0xce;}_0xb130d9[_0xf271('0x18')](_0x3924be);return _0xb130d9[_0xf271('0x1f')](_0xf271('0x20'),_0x1752a0+'-'+_0x3928e9+'/'+_0x24b67c)[_0xf271('0x1a')](_0x5c5143);}return null;};}function patchUpdates(_0x37740e){return function(_0x218c0c){try{jsonpatch[_0xf271('0x21')](_0x218c0c,_0x37740e,!![]);}catch(_0x5050a9){return BPromise[_0xf271('0x22')](_0x5050a9);}return _0x218c0c[_0xf271('0x23')]();};}function saveUpdates(_0x256362,_0x2115af){return function(_0x3ba19b){if(_0x3ba19b){return _0x3ba19b[_0xf271('0x24')](_0x256362)[_0xf271('0x25')](function(_0x12c06e){return _0x12c06e;});}return null;};}function removeEntity(_0x58fb52,_0x338663){return function(_0x4f3ca2){if(_0x4f3ca2){return _0x4f3ca2[_0xf271('0x26')]()[_0xf271('0x25')](function(){_0x58fb52[_0xf271('0x18')](0xcc)[_0xf271('0x19')]();});}};}function handleEntityNotFound(_0x3e9310,_0x17df08){return function(_0x1fab9f){if(!_0x1fab9f){_0x3e9310[_0xf271('0x17')](0x194);}return _0x1fab9f;};}function handleError(_0x35f310,_0x283708){_0x283708=_0x283708||0x1f4;return function(_0xca8416){logger[_0xf271('0x27')](_0xca8416[_0xf271('0x28')]);if(_0xca8416[_0xf271('0x29')]){delete _0xca8416[_0xf271('0x29')];}_0x35f310[_0xf271('0x18')](_0x283708)[_0xf271('0x2a')](_0xca8416);};}exports[_0xf271('0x2b')]=function(_0x13041c,_0x12a498){var _0x2f15e2={},_0x173b64={},_0x1abdeb={'count':0x0,'rows':[]};var _0x1ef078=_[_0xf271('0x2c')](db[_0xf271('0x2d')][_0xf271('0x2e')],function(_0xcb0c70){return{'name':_0xcb0c70[_0xf271('0x2f')],'type':_0xcb0c70['type']['key']};});_0x173b64[_0xf271('0x30')]=_[_0xf271('0x2c')](_0x1ef078,_0xf271('0x29'));_0x173b64[_0xf271('0x31')]=_[_0xf271('0x32')](_0x13041c[_0xf271('0x31')]);_0x173b64[_0xf271('0x33')]=_[_0xf271('0x34')](_0x173b64[_0xf271('0x30')],_0x173b64[_0xf271('0x31')]);_0x2f15e2['attributes']=_[_0xf271('0x34')](_0x173b64[_0xf271('0x30')],qs[_0xf271('0x35')](_0x13041c[_0xf271('0x31')][_0xf271('0x35')]));_0x2f15e2[_0xf271('0x36')]=_0x2f15e2[_0xf271('0x36')][_0xf271('0x37')]?_0x2f15e2[_0xf271('0x36')]:_0x173b64[_0xf271('0x30')];if(!_0x13041c['query'][_0xf271('0x38')]('nolimit')){_0x2f15e2[_0xf271('0x1e')]=qs[_0xf271('0x1e')](_0x13041c[_0xf271('0x31')][_0xf271('0x1e')]);_0x2f15e2[_0xf271('0x1b')]=qs[_0xf271('0x1b')](_0x13041c[_0xf271('0x31')][_0xf271('0x1b')]);}_0x2f15e2[_0xf271('0x39')]=qs['sort'](_0x13041c[_0xf271('0x31')][_0xf271('0x3a')]);_0x2f15e2[_0xf271('0x3b')]=qs[_0xf271('0x33')](_[_0xf271('0x3c')](_0x13041c[_0xf271('0x31')],_0x173b64['filters']),_0x1ef078);if(_0x13041c['query'][_0xf271('0x3d')]){_0x2f15e2[_0xf271('0x3b')]=_['merge'](_0x2f15e2[_0xf271('0x3b')],{'$or':_[_0xf271('0x2c')](_0x1ef078,function(_0x1a3e52){if(_0x1a3e52['type']!==_0xf271('0x3e')){var _0x51702a={};_0x51702a[_0x1a3e52[_0xf271('0x29')]]={'$like':'%'+_0x13041c[_0xf271('0x31')][_0xf271('0x3d')]+'%'};return _0x51702a;}})});}_0x2f15e2=_['merge']({},_0x2f15e2,_0x13041c[_0xf271('0x3f')]);var _0x8057f1={'where':_0x2f15e2[_0xf271('0x3b')]};return db[_0xf271('0x2d')]['count'](_0x8057f1)[_0xf271('0x25')](function(_0x37fe4c){_0x1abdeb[_0xf271('0x1d')]=_0x37fe4c;if(_0x13041c['query'][_0xf271('0x40')]){_0x2f15e2[_0xf271('0x41')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf271('0x42')](_0x2f15e2);})['then'](function(_0x31ae5d){_0x1abdeb['rows']=_0x31ae5d;return _0x1abdeb;})[_0xf271('0x25')](respondWithFilteredResult(_0x12a498,_0x2f15e2))[_0xf271('0x43')](handleError(_0x12a498,null));};exports['show']=function(_0x22ba96,_0x4a325d){var _0x555fe9={'raw':!![],'where':{'id':_0x22ba96[_0xf271('0x44')]['id']}},_0x2ec5fd={};_0x2ec5fd[_0xf271('0x30')]=_[_0xf271('0x32')](db['VoiceQueuesLog'][_0xf271('0x2e')]);_0x2ec5fd[_0xf271('0x31')]=_['keys'](_0x22ba96[_0xf271('0x31')]);_0x2ec5fd['filters']=_[_0xf271('0x34')](_0x2ec5fd[_0xf271('0x30')],_0x2ec5fd[_0xf271('0x31')]);_0x555fe9[_0xf271('0x36')]=_['intersection'](_0x2ec5fd[_0xf271('0x30')],qs[_0xf271('0x35')](_0x22ba96['query'][_0xf271('0x35')]));_0x555fe9[_0xf271('0x36')]=_0x555fe9[_0xf271('0x36')][_0xf271('0x37')]?_0x555fe9['attributes']:_0x2ec5fd[_0xf271('0x30')];if(_0x22ba96[_0xf271('0x31')]['includeAll']){_0x555fe9[_0xf271('0x41')]=[{'all':!![]}];}_0x555fe9=_[_0xf271('0x45')]({},_0x555fe9,_0x22ba96[_0xf271('0x3f')]);return db[_0xf271('0x2d')][_0xf271('0x46')](_0x555fe9)[_0xf271('0x25')](handleEntityNotFound(_0x4a325d,null))[_0xf271('0x25')](respondWithResult(_0x4a325d,null))['catch'](handleError(_0x4a325d,null));};exports[_0xf271('0x47')]=function(_0x469774,_0xe2c063){return db[_0xf271('0x2d')][_0xf271('0x47')](_0x469774[_0xf271('0x48')],{})[_0xf271('0x25')](respondWithResult(_0xe2c063,0xc9))[_0xf271('0x43')](handleError(_0xe2c063,null));};exports[_0xf271('0x24')]=function(_0x1c9f31,_0xd257ca){if(_0x1c9f31[_0xf271('0x48')]['id']){delete _0x1c9f31[_0xf271('0x48')]['id'];}return db[_0xf271('0x2d')][_0xf271('0x46')]({'where':{'id':_0x1c9f31[_0xf271('0x44')]['id']}})['then'](handleEntityNotFound(_0xd257ca,null))[_0xf271('0x25')](saveUpdates(_0x1c9f31[_0xf271('0x48')],null))[_0xf271('0x25')](respondWithResult(_0xd257ca,null))[_0xf271('0x43')](handleError(_0xd257ca,null));};exports[_0xf271('0x26')]=function(_0x2369cb,_0xac0a3a){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2369cb[_0xf271('0x44')]['id']}})[_0xf271('0x25')](handleEntityNotFound(_0xac0a3a,null))[_0xf271('0x25')](removeEntity(_0xac0a3a,null))[_0xf271('0x43')](handleError(_0xac0a3a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 182c621..5fcd07b 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 _0x40d4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','event','dtm'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x40d4,0x16c));var _0x440d=function(_0x203d9f,_0x139878){_0x203d9f=_0x203d9f-0x0;var _0x4feb78=_0x40d4[_0x203d9f];return _0x4feb78;};'use strict';var _=require(_0x440d('0x0'));var util=require(_0x440d('0x1'));var logger=require(_0x440d('0x2'))(_0x440d('0x3'));var moment=require(_0x440d('0x4'));var BPromise=require(_0x440d('0x5'));var rp=require(_0x440d('0x6'));var fs=require('fs');var path=require(_0x440d('0x7'));var rimraf=require(_0x440d('0x8'));var config=require(_0x440d('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x440d('0xa')]=function(_0x15e3de,_0x3602b8){return _0x15e3de['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x440d('0xb'),_0x440d('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3045=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3045,0x134));var _0x5304=function(_0x41bab1,_0x4326e9){_0x41bab1=_0x41bab1-0x0;var _0x5eeaee=_0x3045[_0x41bab1];return _0x5eeaee;};'use strict';var _=require(_0x5304('0x0'));var util=require(_0x5304('0x1'));var logger=require(_0x5304('0x2'))('api');var moment=require(_0x5304('0x3'));var BPromise=require(_0x5304('0x4'));var rp=require(_0x5304('0x5'));var fs=require('fs');var path=require(_0x5304('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x373e94,_0x38684a){return _0x373e94['define'](_0x5304('0x7'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5304('0x8'),'fields':[_0x5304('0x9'),_0x5304('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e912252..580be8d 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 _0x781f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x781f,0x13f));var _0xf781=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x781f[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var moment=require('moment');var BPromise=require(_0xf781('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf781('0x3'));var db=require(_0xf781('0x4'))['db'];var utils=require(_0xf781('0x5'));var logger=require(_0xf781('0x6'))(_0xf781('0x7'));var config=require(_0xf781('0x8'));var jayson=require(_0xf781('0x9'));var client=jayson[_0xf781('0xa')][_0xf781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b958,_0x595a3a,_0x21b450){return new BPromise(function(_0x51678a,_0x3df5b0){return client[_0xf781('0xc')](_0x33b958,_0x21b450)['then'](function(_0x404523){logger[_0xf781('0xd')](_0xf781('0xe'),_0x595a3a,_0xf781('0xf'));logger[_0xf781('0x10')](_0xf781('0x11'),_0x595a3a,_0xf781('0xf'),JSON[_0xf781('0x12')](_0x404523));if(_0x404523[_0xf781('0x13')]){if(_0x404523[_0xf781('0x13')][_0xf781('0x14')]===0x1f4){logger[_0xf781('0x13')](_0xf781('0xe'),_0x595a3a,_0x404523['error']['message']);return _0x3df5b0(_0x404523[_0xf781('0x13')]['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x595a3a,_0x404523[_0xf781('0x13')][_0xf781('0x15')]);return _0x51678a(_0x404523['error'][_0xf781('0x15')]);}else{logger['info'](_0xf781('0xe'),_0x595a3a,_0xf781('0xf'));_0x51678a(_0x404523[_0xf781('0x16')][_0xf781('0x15')]);}})['catch'](function(_0x3e95e4){logger['error'](_0xf781('0xe'),_0x595a3a,_0x3e95e4);_0x3df5b0(_0x3e95e4);});});} \ No newline at end of file +var _0x9d3d=['code','message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9d3d,0x96));var _0xd9d3=function(_0x2bdafa,_0x4ce326){_0x2bdafa=_0x2bdafa-0x0;var _0x466360=_0x9d3d[_0x2bdafa];return _0x466360;};'use strict';var _=require('lodash');var util=require(_0xd9d3('0x0'));var moment=require(_0xd9d3('0x1'));var BPromise=require(_0xd9d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9d3('0x3'))['db'];var utils=require(_0xd9d3('0x4'));var logger=require(_0xd9d3('0x5'))(_0xd9d3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd9d3('0x7')][_0xd9d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x417f9c,_0x5cf97f,_0x4e59be){return new BPromise(function(_0x41f40b,_0x49b9c4){return client[_0xd9d3('0x9')](_0x417f9c,_0x4e59be)[_0xd9d3('0xa')](function(_0x1967e1){logger[_0xd9d3('0xb')](_0xd9d3('0xc'),_0x5cf97f,_0xd9d3('0xd'));logger[_0xd9d3('0xe')](_0xd9d3('0xf'),_0x5cf97f,'request\x20sent',JSON[_0xd9d3('0x10')](_0x1967e1));if(_0x1967e1[_0xd9d3('0x11')]){if(_0x1967e1['error'][_0xd9d3('0x12')]===0x1f4){logger[_0xd9d3('0x11')](_0xd9d3('0xc'),_0x5cf97f,_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);return _0x49b9c4(_0x1967e1['error'][_0xd9d3('0x13')]);}logger[_0xd9d3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5cf97f,_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);return _0x41f40b(_0x1967e1[_0xd9d3('0x11')][_0xd9d3('0x13')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5cf97f,_0xd9d3('0xd'));_0x41f40b(_0x1967e1[_0xd9d3('0x14')]['message']);}})['catch'](function(_0x3a9161){logger[_0xd9d3('0x11')](_0xd9d3('0xc'),_0x5cf97f,_0x3a9161);_0x49b9c4(_0x3a9161);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c043022..a1aabd6 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 _0x9651=['show','downloads','post','create','/:id/transcribe','runTranscribe','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x314dd6,_0x8576aa){var _0x53b99c=function(_0x2d4c47){while(--_0x2d4c47){_0x314dd6['push'](_0x314dd6['shift']());}};_0x53b99c(++_0x8576aa);}(_0x9651,0x1bb));var _0x1965=function(_0x20cf4d,_0x3babd6){_0x20cf4d=_0x20cf4d-0x0;var _0x13f0ca=_0x9651[_0x20cf4d];return _0x13f0ca;};'use strict';var multer=require(_0x1965('0x0'));var util=require(_0x1965('0x1'));var path=require(_0x1965('0x2'));var timeout=require(_0x1965('0x3'));var express=require(_0x1965('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1965('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1965('0x6'));var controller=require(_0x1965('0x7'));router[_0x1965('0x8')]('/',auth[_0x1965('0x9')](),controller[_0x1965('0xa')]);router[_0x1965('0x8')](_0x1965('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1965('0x8')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0xd')]);router[_0x1965('0x8')]('/:id/download',auth[_0x1965('0x9')](),controller['download']);router[_0x1965('0x8')]('/:id/downloads',controller[_0x1965('0xe')]);router['get']('/:id/transcribe',auth[_0x1965('0x9')](),controller['downloadTranscribe']);router[_0x1965('0xf')]('/',auth[_0x1965('0x9')](),controller[_0x1965('0x10')]);router[_0x1965('0xf')](_0x1965('0x11'),auth['isAuthenticated'](),controller[_0x1965('0x12')]);router[_0x1965('0x13')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0x14')]);router[_0x1965('0x15')](_0x1965('0xc'),auth[_0x1965('0x9')](),controller[_0x1965('0x16')]);module[_0x1965('0x17')]=router; \ No newline at end of file +var _0x57f1=['runTranscribe','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x3d3cfe,_0x2afef7){var _0x33d6b5=function(_0x3cb86e){while(--_0x3cb86e){_0x3d3cfe['push'](_0x3d3cfe['shift']());}};_0x33d6b5(++_0x2afef7);}(_0x57f1,0x1f2));var _0x157f=function(_0x483ef2,_0x5d64ef){_0x483ef2=_0x483ef2-0x0;var _0x25a326=_0x57f1[_0x483ef2];return _0x25a326;};'use strict';var multer=require(_0x157f('0x0'));var util=require(_0x157f('0x1'));var path=require(_0x157f('0x2'));var timeout=require(_0x157f('0x3'));var express=require(_0x157f('0x4'));var router=express['Router']();var fs_extra=require(_0x157f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x157f('0x6'));var config=require(_0x157f('0x7'));var controller=require('./voiceRecording.controller');router[_0x157f('0x8')]('/',auth['isAuthenticated'](),controller[_0x157f('0x9')]);router[_0x157f('0x8')](_0x157f('0xa'),auth[_0x157f('0xb')](),controller[_0x157f('0xc')]);router[_0x157f('0x8')](_0x157f('0xd'),auth[_0x157f('0xb')](),controller[_0x157f('0xe')]);router[_0x157f('0x8')]('/:id/download',auth[_0x157f('0xb')](),controller[_0x157f('0xf')]);router['get'](_0x157f('0x10'),controller[_0x157f('0x11')]);router['get'](_0x157f('0x12'),auth[_0x157f('0xb')](),controller[_0x157f('0x13')]);router[_0x157f('0x14')]('/',auth[_0x157f('0xb')](),controller[_0x157f('0x15')]);router[_0x157f('0x14')](_0x157f('0x12'),auth['isAuthenticated'](),controller[_0x157f('0x16')]);router[_0x157f('0x17')](_0x157f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x157f('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x157f('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1002d79..e8ec63f 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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 0bcb612..dba4150 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 _0x9851=['TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','key','model','map','format','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','filter','merge','type','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','ValidationError','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','basename','readFileSync','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created'];(function(_0x1808b2,_0x35f5a6){var _0x498147=function(_0x17d30a){while(--_0x17d30a){_0x1808b2['push'](_0x1808b2['shift']());}};_0x498147(++_0x35f5a6);}(_0x9851,0x14c));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'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(_0x1985('0x0'));var moment=require(_0x1985('0x1'));var BPromise=require(_0x1985('0x2'));var Mustache=require(_0x1985('0x3'));var util=require(_0x1985('0x4'));var path=require(_0x1985('0x5'));var sox=require(_0x1985('0x6'));var csv=require(_0x1985('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1985('0x8'));var _=require(_0x1985('0x9'));var squel=require('squel');var crypto=require(_0x1985('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1985('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1985('0xc'));var Papa=require(_0x1985('0xd'));var AWS=require(_0x1985('0xe'));var uuidv4=require(_0x1985('0xf'));var Redis=require(_0x1985('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1985('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1985('0x12'));var logger=require(_0x1985('0x13'))(_0x1985('0x14'));var utils=require(_0x1985('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1985('0x16'));var db=require(_0x1985('0x17'))['db'];function respondWithStatusCode(_0x2d46e9,_0x2baaee){_0x2baaee=_0x2baaee||0xcc;return function(_0x907835){if(_0x907835){return _0x2d46e9[_0x1985('0x18')](_0x2baaee);}return _0x2d46e9[_0x1985('0x19')](_0x2baaee)[_0x1985('0x1a')]();};}function respondWithResult(_0x147be6,_0x4a9eed){_0x4a9eed=_0x4a9eed||0xc8;return function(_0x23922b){if(_0x23922b){return _0x147be6[_0x1985('0x19')](_0x4a9eed)[_0x1985('0x1b')](_0x23922b);}};}function respondWithFilteredResult(_0x24e97d,_0x357bc7){return function(_0x38c9e0){if(_0x38c9e0){var _0x31dc9c=typeof _0x357bc7[_0x1985('0x1c')]==='undefined'&&typeof _0x357bc7[_0x1985('0x1d')]==='undefined';var _0x56e7bc=_0x38c9e0[_0x1985('0x1e')];var _0x1f0900=_0x31dc9c?0x0:_0x357bc7[_0x1985('0x1c')];var _0x384b7b=_0x31dc9c?_0x38c9e0[_0x1985('0x1e')]:_0x357bc7[_0x1985('0x1c')]+_0x357bc7[_0x1985('0x1d')];var _0x1e6ffa;if(_0x384b7b>=_0x56e7bc){_0x384b7b=_0x56e7bc;_0x1e6ffa=0xc8;}else{_0x1e6ffa=0xce;}_0x24e97d[_0x1985('0x19')](_0x1e6ffa);return _0x24e97d['set'](_0x1985('0x1f'),_0x1f0900+'-'+_0x384b7b+'/'+_0x56e7bc)[_0x1985('0x1b')](_0x38c9e0);}return null;};}function patchUpdates(_0x44b335){return function(_0x562b5b){try{jsonpatch[_0x1985('0x20')](_0x562b5b,_0x44b335,!![]);}catch(_0x15817d){return BPromise[_0x1985('0x21')](_0x15817d);}return _0x562b5b[_0x1985('0x22')]();};}function saveUpdates(_0x3a85ca,_0x2fa182){return function(_0x1dfb9e){if(_0x1dfb9e){return _0x1dfb9e[_0x1985('0x23')](_0x3a85ca)[_0x1985('0x24')](function(_0x201560){return _0x201560;});}return null;};}function removeEntity(_0xcafc6d,_0x57cd83){return function(_0x49923f){if(_0x49923f){return _0x49923f[_0x1985('0x25')]()[_0x1985('0x24')](function(){_0xcafc6d['status'](0xcc)[_0x1985('0x1a')]();});}};}function handleEntityNotFound(_0x25c3b5,_0x56854f){return function(_0x552d56){if(!_0x552d56){_0x25c3b5['sendStatus'](0x194);}return _0x552d56;};}function handleError(_0x59a648,_0x38c463){_0x38c463=_0x38c463||0x1f4;return function(_0x29bc0c){logger[_0x1985('0x26')](_0x29bc0c['stack']);if(_0x29bc0c[_0x1985('0x27')]){delete _0x29bc0c[_0x1985('0x27')];}_0x59a648[_0x1985('0x19')](_0x38c463)[_0x1985('0x28')](_0x29bc0c);};}exports[_0x1985('0x29')]=function(_0x66eb37,_0x14c887){var _0x3eabdc={},_0x361e0e={},_0x3a9334={'count':0x0,'rows':[]};var _0xec70fc=_['map'](db['VoiceRecording']['rawAttributes'],function(_0x28ec5a){return{'name':_0x28ec5a[_0x1985('0x2a')],'type':_0x28ec5a['type'][_0x1985('0x2b')]};});_0x361e0e[_0x1985('0x2c')]=_['differenceBy'](_[_0x1985('0x2d')](_0xec70fc,_0x1985('0x27')),[_0x1985('0x2e')]);_0x361e0e[_0x1985('0x2f')]=_[_0x1985('0x30')](_0x66eb37[_0x1985('0x2f')]);_0x361e0e[_0x1985('0x31')]=_['intersection'](_0x361e0e[_0x1985('0x2c')],_0x361e0e[_0x1985('0x2f')]);_0x3eabdc[_0x1985('0x32')]=_[_0x1985('0x33')](_0x361e0e[_0x1985('0x2c')],qs[_0x1985('0x34')](_0x66eb37[_0x1985('0x2f')]['fields']));_0x3eabdc['attributes']=_0x3eabdc['attributes']['length']?_0x3eabdc['attributes']:_0x361e0e[_0x1985('0x2c')];if(!_0x66eb37[_0x1985('0x2f')]['hasOwnProperty'](_0x1985('0x35'))){_0x3eabdc[_0x1985('0x1d')]=qs[_0x1985('0x1d')](_0x66eb37[_0x1985('0x2f')][_0x1985('0x1d')]);_0x3eabdc[_0x1985('0x1c')]=qs['offset'](_0x66eb37['query'][_0x1985('0x1c')]);}_0x3eabdc['order']=qs['sort'](_0x66eb37[_0x1985('0x2f')][_0x1985('0x36')]);_0x3eabdc[_0x1985('0x37')]=qs[_0x1985('0x31')](_['pick'](_0x66eb37[_0x1985('0x2f')],_0x361e0e[_0x1985('0x31')]),_0xec70fc);if(_0x66eb37['query'][_0x1985('0x38')]){_0x3eabdc[_0x1985('0x37')]=_[_0x1985('0x39')](_0x3eabdc[_0x1985('0x37')],{'$or':_[_0x1985('0x2d')](_0xec70fc,function(_0x15bbd3){if(_0x15bbd3[_0x1985('0x3a')]!==_0x1985('0x3b')){var _0x5b5125={};_0x5b5125[_0x15bbd3['name']]={'$like':'%'+_0x66eb37['query'][_0x1985('0x38')]+'%'};return _0x5b5125;}})});}_0x3eabdc=_[_0x1985('0x39')]({},_0x3eabdc,_0x66eb37[_0x1985('0x3c')]);var _0x1efcb1={'where':_0x3eabdc[_0x1985('0x37')]};return db[_0x1985('0x3d')][_0x1985('0x1e')](_0x1efcb1)['then'](function(_0x1b6a7a){_0x3a9334['count']=_0x1b6a7a;if(_0x66eb37[_0x1985('0x2f')][_0x1985('0x3e')]){_0x3eabdc[_0x1985('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1985('0x40')](_0x3eabdc);})['then'](function(_0x53667f){_0x3a9334[_0x1985('0x41')]=_0x53667f;return _0x3a9334;})[_0x1985('0x24')](respondWithFilteredResult(_0x14c887,_0x3eabdc))[_0x1985('0x42')](handleError(_0x14c887,null));};exports[_0x1985('0x43')]=function(_0x2aa6dd,_0x239651){var _0x9f0d82={'raw':![],'where':{'id':_0x2aa6dd[_0x1985('0x44')]['id']}},_0x4cf60d={};_0x4cf60d[_0x1985('0x2c')]=_[_0x1985('0x30')](db[_0x1985('0x3d')][_0x1985('0x45')]);_0x4cf60d[_0x1985('0x2f')]=_[_0x1985('0x30')](_0x2aa6dd[_0x1985('0x2f')]);_0x4cf60d['filters']=_[_0x1985('0x33')](_0x4cf60d[_0x1985('0x2c')],_0x4cf60d[_0x1985('0x2f')]);_0x9f0d82[_0x1985('0x32')]=_['intersection'](_0x4cf60d[_0x1985('0x2c')],qs[_0x1985('0x34')](_0x2aa6dd['query'][_0x1985('0x34')]));_0x9f0d82['attributes']=_0x9f0d82['attributes'][_0x1985('0x46')]?_0x9f0d82['attributes']:_0x4cf60d[_0x1985('0x2c')];if(_0x2aa6dd[_0x1985('0x2f')][_0x1985('0x3e')]){_0x9f0d82['include']=[{'all':!![]}];}_0x9f0d82=_['merge']({},_0x9f0d82,_0x2aa6dd['options']);return db[_0x1985('0x3d')][_0x1985('0x47')](_0x9f0d82)['then'](handleEntityNotFound(_0x239651,null))['then'](respondWithResult(_0x239651,null))[_0x1985('0x42')](handleError(_0x239651,null));};exports[_0x1985('0x48')]=function(_0x3460dc,_0x16e94a){return db[_0x1985('0x3d')][_0x1985('0x48')](_0x3460dc[_0x1985('0x49')],{})[_0x1985('0x24')](respondWithResult(_0x16e94a,0xc9))[_0x1985('0x42')](handleError(_0x16e94a,null));};exports['update']=function(_0xdfb6c9,_0x45452e){if(_0xdfb6c9[_0x1985('0x49')]['id']){delete _0xdfb6c9['body']['id'];}return db['VoiceRecording'][_0x1985('0x47')]({'where':{'id':_0xdfb6c9['params']['id']}})[_0x1985('0x24')](handleEntityNotFound(_0x45452e,null))['then'](saveUpdates(_0xdfb6c9[_0x1985('0x49')],null))[_0x1985('0x24')](respondWithResult(_0x45452e,null))[_0x1985('0x42')](handleError(_0x45452e,null));};exports['describe']=function(_0x2d3d38,_0x1bc0d4){return db['VoiceRecording'][_0x1985('0x4a')]()[_0x1985('0x24')](respondWithResult(_0x1bc0d4,null))[_0x1985('0x42')](handleError(_0x1bc0d4,null));};exports[_0x1985('0x4b')]=function(_0x5aa8c3,_0x12fdc6,_0x26ffcd){var _0x9c6f9d=require(_0x1985('0x4c'));var _0xe122bb=![];var _0x5ec719={};if(_0x5aa8c3[_0x1985('0x2f')]['type']&&_0x5aa8c3[_0x1985('0x2f')][_0x1985('0x3a')]===_0x1985('0x4d')){_0x5ec719[_0x1985('0x4d')]=_0x5aa8c3[_0x1985('0x44')]['id'];}else{_0x5ec719['id']=_0x5aa8c3[_0x1985('0x44')]['id'];}return db['VoiceRecording'][_0x1985('0x47')]({'where':_0x5ec719,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x12fdc6,null))[_0x1985('0x24')](function(_0xb8a459){if(_0xb8a459){var _0x2bbfbf=_0xb8a459[_0x1985('0x4e')];var _0x1ede83=util[_0x1985('0x2e')](_0x1985('0x4f'),_0x2bbfbf);if(fs[_0x1985('0x50')](_0x1ede83)){_0xe122bb=!![];return _0x9c6f9d[_0x1985('0x51')](_0x1ede83,_0x2bbfbf,config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0xb8a459;});}return _0xb8a459;}})['then'](function(_0x6f33ad){if(_0x6f33ad){var _0x47928e=_0x6f33ad[_0x1985('0x4e')];if(!fs[_0x1985('0x50')](_0x47928e)){throw new db[(_0x1985('0x54'))]['ValidationError'](_0x1985('0x55'));}if(_0x6f33ad[_0x1985('0x56')]){return _0x12fdc6[_0x1985('0x4b')](_0x47928e,_0x6f33ad[_0x1985('0x56')]+path['extname'](_0x47928e),function(){if(_0xe122bb){fs['unlink'](_0x47928e);}});}else{return _0x12fdc6[_0x1985('0x4b')](_0x47928e,function(_0x388462){if(_0xe122bb){fs[_0x1985('0x57')](_0x47928e);}});}}})['catch'](function(_0x5de5e4){if(_0x5de5e4[_0x1985('0x58')]===_0x1985('0x55')){_0x12fdc6[_0x1985('0x19')](0x194)[_0x1985('0x28')](_0x1985('0x59'));}else{return handleError(_0x12fdc6,null);}});};exports[_0x1985('0x5a')]=function(_0xd83593,_0xde3beb,_0x39e69d){var _0x5d7d5a=require(_0x1985('0x4c'));var _0x3f3722=![];var _0x4432cb={'$and':[db[_0x1985('0x5b')]['where'](db[_0x1985('0x5b')]['fn'](_0x1985('0x5c'),db[_0x1985('0x5b')][_0x1985('0x5d')](_0x1985('0x4d'))),_0xd83593['query'][_0x1985('0x5e')])]};if(_0xd83593[_0x1985('0x2f')][_0x1985('0x3a')]&&_0xd83593[_0x1985('0x2f')][_0x1985('0x3a')]===_0x1985('0x4d')){_0x4432cb[_0x1985('0x5f')]['push']({'uniqueid':_0xd83593['params']['id']});}else{_0x4432cb[_0x1985('0x5f')]['push']({'id':_0xd83593[_0x1985('0x44')]['id']});}return db[_0x1985('0x3d')][_0x1985('0x47')]({'where':_0x4432cb,'attributes':['id',_0x1985('0x4e')],'raw':!![]})[_0x1985('0x24')](handleEntityNotFound(_0xde3beb,null))[_0x1985('0x24')](function(_0x40f944){if(_0x40f944){var _0x629cef=util['format'](_0x1985('0x4f'),_0x40f944[_0x1985('0x4e')]);if(fs[_0x1985('0x50')](_0x629cef)){_0x3f3722=!![];return _0x5d7d5a[_0x1985('0x51')](_0x629cef,_0x40f944[_0x1985('0x4e')],config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0x40f944;});}return _0x40f944;}})[_0x1985('0x24')](function(_0x703f){if(_0x703f){if(!fs[_0x1985('0x50')](_0x703f[_0x1985('0x4e')])){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('VoiceRecording\x20not\x20found');}if(_0x703f[_0x1985('0x56')]){return _0xde3beb[_0x1985('0x4b')](_0x703f[_0x1985('0x4e')],_0x703f['filename']+path[_0x1985('0x61')](_0x703f[_0x1985('0x4e')]),function(){if(_0x3f3722){fs[_0x1985('0x57')](_0x703f[_0x1985('0x4e')]);}});}else{return _0xde3beb[_0x1985('0x4b')](_0x703f[_0x1985('0x4e')],function(_0x1769a7){if(_0x3f3722){fs[_0x1985('0x57')](_0x703f['value']);}});}}})[_0x1985('0x42')](handleError(_0xde3beb,null));};exports[_0x1985('0x25')]=function(_0x24a66d,_0x1fc723){return db[_0x1985('0x3d')][_0x1985('0x47')]({'where':{'id':_0x24a66d['params']['id']}})['then'](function(_0x5227e1){if(_[_0x1985('0x62')](_0x5227e1)){throw new ReferenceError(_0x1985('0x63'));}return _0x5227e1;})[_0x1985('0x24')](function(_0x2199b1){var _0x341ac8=_0x2199b1[_0x1985('0x4e')];logger[_0x1985('0x64')](_0x1985('0x65'),_0x341ac8);if(!_[_0x1985('0x62')](_0x2199b1['value'])&&fs[_0x1985('0x50')](_0x341ac8)){logger[_0x1985('0x64')](_0x1985('0x66')+_0x341ac8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1985('0x67')](_0x341ac8);}_0x341ac8=_0x341ac8+'.cypher';if(!_[_0x1985('0x62')](_0x2199b1[_0x1985('0x4e')])&&fs[_0x1985('0x50')](_0x341ac8)){logger[_0x1985('0x64')]('File:\x20\x22'+_0x341ac8+_0x1985('0x68'));fs['unlinkSync'](_0x341ac8);}return _0x2199b1;})['then'](function(_0x1a3d2e){if(!_0x1a3d2e)throw new InternalError();return _0x1a3d2e[_0x1985('0x25')]();})[_0x1985('0x24')](function(){_0x1fc723['status'](0xcc)[_0x1985('0x1a')]();})[_0x1985('0x42')](handleError(_0x1fc723,null));};function getBucketslist(_0x3b00b7,_0x423712,_0x2b68cf){return new Promise(function(_0xbca468,_0x28d967){var _0x2c0003=new AWS['S3']({'accessKeyId':_0x423712,'secretAccessKey':_0x3b00b7,'region':_0x2b68cf});_0x2c0003['listBuckets']({},function(_0x4b3e7e,_0x1b2a48){if(_0x4b3e7e){return _0x28d967(_0x4b3e7e);}else{return _0xbca468(_0x1b2a48);}});});}function createBucket(_0x5268f5,_0x2383d8,_0x4385f7,_0x39da33){return new Promise(function(_0x4f8814,_0x55badd){var _0x55f4aa=new AWS['S3']({'accessKeyId':_0x2383d8,'secretAccessKey':_0x5268f5,'region':_0x4385f7});_0x55f4aa[_0x1985('0x69')]({'Bucket':_0x39da33},function(_0x52e7a8,_0x2e0645){if(_0x52e7a8){return _0x55badd(_0x52e7a8);}else{return _0x4f8814(_0x2e0645);}});});}function uploadFile(_0x22ee4d,_0xa74cb3,_0x27f363,_0x1debac,_0x4279dd,_0x563dce){return new Promise(function(_0x52d8c6,_0x312976){var _0x2f8c51=new AWS['S3']({'accessKeyId':_0xa74cb3,'secretAccessKey':_0x22ee4d,'region':_0x27f363});_0x2f8c51[_0x1985('0x6a')]({'Bucket':_0x1debac,'Key':_0x4279dd,'Body':_0x563dce},function(_0x1d3133,_0x2ec281){if(_0x1d3133){return _0x312976(_0x1d3133);}else{return _0x52d8c6(_0x2ec281);}});});}function startTranscribe(_0x2cb23e,_0x5c97a9,_0x39f9d0,_0x1fe55e,_0x5b9552,_0x30fd9e){return new Promise(function(_0xbb9aee,_0x352d84){var _0x52aa0b=new AWS[(_0x1985('0x6b'))]({'accessKeyId':_0x5c97a9,'secretAccessKey':_0x2cb23e,'region':_0x39f9d0});_0x52aa0b['startTranscriptionJob']({'TranscriptionJobName':_0x1fe55e,'LanguageCode':_0x5b9552,'Media':{'MediaFileUri':_0x30fd9e}},function(_0x31bfb6,_0xb5b430){if(_0x31bfb6){return _0x352d84(_0x31bfb6);}else{return _0xbb9aee(_0xb5b430);}});});}function transcribe(_0x33014f,_0x24be6e,_0x5e5fbf,_0x3f10a2,_0x416544,_0x58015a,_0x1ec9cd){return new Promise(function(_0x3f8970,_0x4cccc3){var _0x50a161={};logger[_0x1985('0x64')](util[_0x1985('0x2e')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x33014f,_0x416544));return uploadFile(_0x24be6e,_0x5e5fbf,_0x3f10a2,_0x416544,path[_0x1985('0x6c')](_0x58015a),fs[_0x1985('0x6d')](_0x58015a))[_0x1985('0x24')](function(_0x36aee3){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x33014f,_0x416544,_0x36aee3['Location']));_0x50a161[_0x1985('0x6e')]=_0x36aee3['Bucket'];_0x50a161[_0x1985('0x6f')]=_0x36aee3[_0x1985('0x70')];logger[_0x1985('0x64')](util[_0x1985('0x2e')](_0x1985('0x71'),_0x33014f));return startTranscribe(_0x24be6e,_0x5e5fbf,_0x3f10a2,uuidv4(),_0x1ec9cd,_0x36aee3[_0x1985('0x70')]);})['then'](function(_0x257bf7){logger[_0x1985('0x64')](util['format'](_0x1985('0x72'),_0x33014f,_0x257bf7[_0x1985('0x73')][_0x1985('0x74')]));_0x50a161[_0x1985('0x75')]=_0x257bf7[_0x1985('0x73')][_0x1985('0x74')];_0x50a161[_0x1985('0x76')]=_0x257bf7[_0x1985('0x73')][_0x1985('0x77')];return _0x3f8970(_0x50a161);})[_0x1985('0x42')](function(_0x4e7d4b){return _0x4cccc3(_0x4e7d4b);});});}exports[_0x1985('0x78')]=function(_0x4aeb5d,_0x52a252,_0x5da780){var _0x483926;var _0xcb5455;var _0x2076c8;var _0x3c1a41=require(_0x1985('0x4c'));return db[_0x1985('0x3d')][_0x1985('0x79')]({'where':{'id':_0x4aeb5d[_0x1985('0x44')]['id']}})[_0x1985('0x24')](function(_0x409dcb){if(_0x409dcb){var _0x27f32f=util[_0x1985('0x2e')]('%s.cypher',_0x409dcb[_0x1985('0x4e')]);if(fs[_0x1985('0x50')](_0x27f32f)){cypher=!![];return _0x3c1a41[_0x1985('0x51')](_0x27f32f,_0x409dcb[_0x1985('0x4e')],config[_0x1985('0x52')][_0x1985('0x53')])[_0x1985('0x24')](function(){return _0x409dcb;});}return _0x409dcb;}})[_0x1985('0x24')](function(_0xad50dc){if(!_0xad50dc){throw new db['Sequelize'][(_0x1985('0x60'))]('Voice\x20Recording\x20not\x20found');}_0xcb5455=_0xad50dc;return db[_0x1985('0x7a')][_0x1985('0x79')]({'where':{'id':0x1}});})[_0x1985('0x24')](handleEntityNotFound(_0x52a252,null))[_0x1985('0x24')](function(_0x5a6d78){if(_0x5a6d78){_0x483926=_0x5a6d78;if(!_0x483926[_0x1985('0x7b')]||!_0x483926[_0x1985('0x7c')]||!_0x483926[_0x1985('0x7d')]||!_0x483926[_0x1985('0x7e')]||!_0x483926[_0x1985('0x6e')]){throw new db['Sequelize'][(_0x1985('0x60'))](_0x1985('0x7f'));}if(_0x4aeb5d[_0x1985('0x49')]['runSentiment']&&(!_0x483926[_0x1985('0x80')]||!_0x483926[_0x1985('0x81')]||!_0x483926[_0x1985('0x82')]||!_0x483926['language']||!_0x483926[_0x1985('0x6e')])){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))](_0x1985('0x83'));}return db[_0x1985('0x84')][_0x1985('0x79')]({'where':{'id':_0x483926[_0x1985('0x7c')]}});}})[_0x1985('0x24')](function(_0x57e805){if(!_0x57e805){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))](_0x1985('0x85'));}if(!_0x57e805[_0x1985('0x86')]||!_0x57e805['data2']){throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('Cloud\x20Provider\x20not\x20configured');}_0x2076c8=_0x57e805;return getBucketslist(_0x2076c8[_0x1985('0x86')],_0x2076c8[_0x1985('0x87')],_0x483926[_0x1985('0x7d')]);})[_0x1985('0x24')](function(_0x5ee8b7){if(_0x5ee8b7&&_0x5ee8b7[_0x1985('0x88')]){var _0x1a9fa3=_[_0x1985('0x47')](_0x5ee8b7['Buckets'],function(_0x29e422){return _0x29e422[_0x1985('0x89')]===_0x483926[_0x1985('0x6e')];});if(!_0x1a9fa3){logger['info'](util['format'](_0x1985('0x8a'),_0x4aeb5d['params']['id'],_0x483926['bucket']));return createBucket(_0x2076c8[_0x1985('0x86')],_0x2076c8['data2'],_0x483926[_0x1985('0x7d')],_0x483926[_0x1985('0x6e')]);}logger[_0x1985('0x64')](util[_0x1985('0x2e')](_0x1985('0x8b'),_0x4aeb5d['params']['id'],_0x483926['bucket']));return;}})[_0x1985('0x24')](function(_0x105559){if(_0xcb5455[_0x1985('0x76')]===_0x1985('0x8c')){return transcribe(_0x4aeb5d['params']['id'],_0x2076c8[_0x1985('0x86')],_0x2076c8[_0x1985('0x87')],_0x483926[_0x1985('0x7d')],_0x483926[_0x1985('0x6e')],_0xcb5455[_0x1985('0x4e')],_0x483926[_0x1985('0x7e')]);}else{logger['info'](util['format'](_0x1985('0x8d'),_0x4aeb5d[_0x1985('0x44')]['id']));return{'transcribeStatus':_0x1985('0x8e')};}})[_0x1985('0x24')](function(_0x1200e9){if(_0x1200e9){_0x1200e9['tempSentiment']=_0x4aeb5d[_0x1985('0x49')][_0x1985('0x8f')];return _0xcb5455[_0x1985('0x90')](_0x1200e9);}})['then'](respondWithResult(_0x52a252,null))[_0x1985('0x42')](handleError(_0x52a252,null));};function writeFile(_0x2e1684,_0x5a3444){return new Promise(function(_0x2fbb00,_0x29d09d){fs['writeFile'](_0x5a3444,_0x2e1684,function(_0x577d24,_0x612928){if(_0x577d24){return _0x29d09d(_0x577d24);}else{return _0x2fbb00(_0x612928);}});});}exports['downloadTranscribe']=function(_0x345683,_0x2194fe,_0x3e376a){return db['VoiceRecording'][_0x1985('0x79')]({'where':{'id':_0x345683[_0x1985('0x44')]['id']}})['then'](handleEntityNotFound(_0x2194fe))[_0x1985('0x24')](function(_0x169341){if(_0x169341&&_0x169341[_0x1985('0x91')]){var _0x239a03=_0x169341[_0x1985('0x91')];var _0x5cc2f9=config[_0x1985('0x92')]+_0x1985('0x93')+_0x169341['id']+_0x1985('0x94');if(fs[_0x1985('0x50')](_0x5cc2f9)){return _0x5cc2f9;}return writeFile(_0x239a03,_0x5cc2f9)[_0x1985('0x24')](function(){return _0x5cc2f9;});}else{throw new db[(_0x1985('0x54'))][(_0x1985('0x60'))]('Transcript\x20not\x20available');}})[_0x1985('0x24')](function(_0x47dd69){return _0x2194fe[_0x1985('0x4b')](_0x47dd69);})['catch'](handleError(_0x2194fe));}; \ No newline at end of file +var _0x0f21=['find','catch','create','body','params','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','Not\x20found','downloads','sequelize','MD5','$and','push','filename','download','isNil','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','includeAll','include'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0f21,0xdd));var _0x10f2=function(_0x8ccd38,_0x415834){_0x8ccd38=_0x8ccd38-0x0;var _0xbe27f6=_0x0f21[_0x8ccd38];return _0xbe27f6;};'use strict';var emlformat=require(_0x10f2('0x0'));var rimraf=require(_0x10f2('0x1'));var zipdir=require(_0x10f2('0x2'));var jsonpatch=require(_0x10f2('0x3'));var rp=require('request-promise');var moment=require(_0x10f2('0x4'));var BPromise=require(_0x10f2('0x5'));var Mustache=require(_0x10f2('0x6'));var util=require('util');var path=require(_0x10f2('0x7'));var sox=require(_0x10f2('0x8'));var csv=require(_0x10f2('0x9'));var ejs=require(_0x10f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x10f2('0xb'));var jsforce=require(_0x10f2('0xc'));var deskjs=require(_0x10f2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x10f2('0xe'));var AWS=require(_0x10f2('0xf'));var uuidv4=require(_0x10f2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x10f2('0x11'));var as=require(_0x10f2('0x12'));var hardwareService=require(_0x10f2('0x13'));var logger=require(_0x10f2('0x14'))('api');var utils=require(_0x10f2('0x15'));var config=require(_0x10f2('0x16'));var licenseUtil=require(_0x10f2('0x17'));var db=require(_0x10f2('0x18'))['db'];function respondWithStatusCode(_0x2a7784,_0x209f67){_0x209f67=_0x209f67||0xcc;return function(_0x1adf06){if(_0x1adf06){return _0x2a7784['sendStatus'](_0x209f67);}return _0x2a7784['status'](_0x209f67)[_0x10f2('0x19')]();};}function respondWithResult(_0x2f28b9,_0x591705){_0x591705=_0x591705||0xc8;return function(_0x5529fc){if(_0x5529fc){return _0x2f28b9[_0x10f2('0x1a')](_0x591705)[_0x10f2('0x1b')](_0x5529fc);}};}function respondWithFilteredResult(_0x5ee7a8,_0x34547b){return function(_0x9449fc){if(_0x9449fc){var _0x4e4b89=typeof _0x34547b['offset']==='undefined'&&typeof _0x34547b['limit']===_0x10f2('0x1c');var _0x3e3e7e=_0x9449fc[_0x10f2('0x1d')];var _0x3acc3f=_0x4e4b89?0x0:_0x34547b[_0x10f2('0x1e')];var _0x105422=_0x4e4b89?_0x9449fc['count']:_0x34547b['offset']+_0x34547b[_0x10f2('0x1f')];var _0x2d64a9;if(_0x105422>=_0x3e3e7e){_0x105422=_0x3e3e7e;_0x2d64a9=0xc8;}else{_0x2d64a9=0xce;}_0x5ee7a8[_0x10f2('0x1a')](_0x2d64a9);return _0x5ee7a8['set'](_0x10f2('0x20'),_0x3acc3f+'-'+_0x105422+'/'+_0x3e3e7e)[_0x10f2('0x1b')](_0x9449fc);}return null;};}function patchUpdates(_0x2e0908){return function(_0x3aa5ce){try{jsonpatch[_0x10f2('0x21')](_0x3aa5ce,_0x2e0908,!![]);}catch(_0x4a0885){return BPromise[_0x10f2('0x22')](_0x4a0885);}return _0x3aa5ce[_0x10f2('0x23')]();};}function saveUpdates(_0x3667b9,_0xca395a){return function(_0x15e05b){if(_0x15e05b){return _0x15e05b[_0x10f2('0x24')](_0x3667b9)[_0x10f2('0x25')](function(_0x42e385){return _0x42e385;});}return null;};}function removeEntity(_0x562900,_0x279cbf){return function(_0x302cc2){if(_0x302cc2){return _0x302cc2[_0x10f2('0x26')]()['then'](function(){_0x562900['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1443e7,_0x2afabb){return function(_0x1c2577){if(!_0x1c2577){_0x1443e7[_0x10f2('0x27')](0x194);}return _0x1c2577;};}function handleError(_0x197dea,_0x3191c8){_0x3191c8=_0x3191c8||0x1f4;return function(_0xf4a53c){logger[_0x10f2('0x28')](_0xf4a53c[_0x10f2('0x29')]);if(_0xf4a53c[_0x10f2('0x2a')]){delete _0xf4a53c[_0x10f2('0x2a')];}_0x197dea[_0x10f2('0x1a')](_0x3191c8)[_0x10f2('0x2b')](_0xf4a53c);};}exports[_0x10f2('0x2c')]=function(_0x1d5bdf,_0x1f6e52){var _0x900c63={},_0x5b1e96={},_0x4215c9={'count':0x0,'rows':[]};var _0x4f8d03=_[_0x10f2('0x2d')](db[_0x10f2('0x2e')][_0x10f2('0x2f')],function(_0x1b088f){return{'name':_0x1b088f[_0x10f2('0x30')],'type':_0x1b088f[_0x10f2('0x31')][_0x10f2('0x32')]};});_0x5b1e96[_0x10f2('0x33')]=_[_0x10f2('0x34')](_[_0x10f2('0x2d')](_0x4f8d03,_0x10f2('0x2a')),['format']);_0x5b1e96[_0x10f2('0x35')]=_[_0x10f2('0x36')](_0x1d5bdf[_0x10f2('0x35')]);_0x5b1e96[_0x10f2('0x37')]=_[_0x10f2('0x38')](_0x5b1e96[_0x10f2('0x33')],_0x5b1e96[_0x10f2('0x35')]);_0x900c63[_0x10f2('0x39')]=_[_0x10f2('0x38')](_0x5b1e96[_0x10f2('0x33')],qs[_0x10f2('0x3a')](_0x1d5bdf['query'][_0x10f2('0x3a')]));_0x900c63['attributes']=_0x900c63[_0x10f2('0x39')][_0x10f2('0x3b')]?_0x900c63[_0x10f2('0x39')]:_0x5b1e96[_0x10f2('0x33')];if(!_0x1d5bdf[_0x10f2('0x35')][_0x10f2('0x3c')](_0x10f2('0x3d'))){_0x900c63[_0x10f2('0x1f')]=qs[_0x10f2('0x1f')](_0x1d5bdf['query']['limit']);_0x900c63[_0x10f2('0x1e')]=qs[_0x10f2('0x1e')](_0x1d5bdf['query'][_0x10f2('0x1e')]);}_0x900c63[_0x10f2('0x3e')]=qs[_0x10f2('0x3f')](_0x1d5bdf['query'][_0x10f2('0x3f')]);_0x900c63[_0x10f2('0x40')]=qs[_0x10f2('0x37')](_[_0x10f2('0x41')](_0x1d5bdf[_0x10f2('0x35')],_0x5b1e96['filters']),_0x4f8d03);if(_0x1d5bdf[_0x10f2('0x35')][_0x10f2('0x42')]){_0x900c63[_0x10f2('0x40')]=_[_0x10f2('0x43')](_0x900c63[_0x10f2('0x40')],{'$or':_[_0x10f2('0x2d')](_0x4f8d03,function(_0x457f82){if(_0x457f82[_0x10f2('0x31')]!==_0x10f2('0x44')){var _0x14a003={};_0x14a003[_0x457f82[_0x10f2('0x2a')]]={'$like':'%'+_0x1d5bdf['query'][_0x10f2('0x42')]+'%'};return _0x14a003;}})});}_0x900c63=_['merge']({},_0x900c63,_0x1d5bdf['options']);var _0x7cbf0={'where':_0x900c63[_0x10f2('0x40')]};return db[_0x10f2('0x2e')]['count'](_0x7cbf0)[_0x10f2('0x25')](function(_0x82fe51){_0x4215c9[_0x10f2('0x1d')]=_0x82fe51;if(_0x1d5bdf[_0x10f2('0x35')]['includeAll']){_0x900c63['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x10f2('0x45')](_0x900c63);})[_0x10f2('0x25')](function(_0x3e7aa6){_0x4215c9[_0x10f2('0x46')]=_0x3e7aa6;return _0x4215c9;})[_0x10f2('0x25')](respondWithFilteredResult(_0x1f6e52,_0x900c63))['catch'](handleError(_0x1f6e52,null));};exports['show']=function(_0x104b13,_0x301330){var _0x379a44={'raw':![],'where':{'id':_0x104b13['params']['id']}},_0x3b793e={};_0x3b793e[_0x10f2('0x33')]=_[_0x10f2('0x36')](db[_0x10f2('0x2e')][_0x10f2('0x2f')]);_0x3b793e['query']=_[_0x10f2('0x36')](_0x104b13[_0x10f2('0x35')]);_0x3b793e[_0x10f2('0x37')]=_['intersection'](_0x3b793e[_0x10f2('0x33')],_0x3b793e[_0x10f2('0x35')]);_0x379a44[_0x10f2('0x39')]=_[_0x10f2('0x38')](_0x3b793e[_0x10f2('0x33')],qs[_0x10f2('0x3a')](_0x104b13['query']['fields']));_0x379a44[_0x10f2('0x39')]=_0x379a44['attributes']['length']?_0x379a44[_0x10f2('0x39')]:_0x3b793e['model'];if(_0x104b13[_0x10f2('0x35')][_0x10f2('0x47')]){_0x379a44[_0x10f2('0x48')]=[{'all':!![]}];}_0x379a44=_[_0x10f2('0x43')]({},_0x379a44,_0x104b13['options']);return db[_0x10f2('0x2e')][_0x10f2('0x49')](_0x379a44)[_0x10f2('0x25')](handleEntityNotFound(_0x301330,null))[_0x10f2('0x25')](respondWithResult(_0x301330,null))[_0x10f2('0x4a')](handleError(_0x301330,null));};exports[_0x10f2('0x4b')]=function(_0x2f64d4,_0x1f70f5){return db['VoiceRecording'][_0x10f2('0x4b')](_0x2f64d4[_0x10f2('0x4c')],{})[_0x10f2('0x25')](respondWithResult(_0x1f70f5,0xc9))[_0x10f2('0x4a')](handleError(_0x1f70f5,null));};exports[_0x10f2('0x24')]=function(_0x4c8619,_0x72bd31){if(_0x4c8619['body']['id']){delete _0x4c8619[_0x10f2('0x4c')]['id'];}return db[_0x10f2('0x2e')][_0x10f2('0x49')]({'where':{'id':_0x4c8619[_0x10f2('0x4d')]['id']}})[_0x10f2('0x25')](handleEntityNotFound(_0x72bd31,null))[_0x10f2('0x25')](saveUpdates(_0x4c8619[_0x10f2('0x4c')],null))[_0x10f2('0x25')](respondWithResult(_0x72bd31,null))[_0x10f2('0x4a')](handleError(_0x72bd31,null));};exports['describe']=function(_0x2d9867,_0x72ff94){return db['VoiceRecording'][_0x10f2('0x4e')]()[_0x10f2('0x25')](respondWithResult(_0x72ff94,null))[_0x10f2('0x4a')](handleError(_0x72ff94,null));};exports['download']=function(_0x3a4fdf,_0x397ee7,_0x47ee92){var _0x436bdc=require(_0x10f2('0x4f'));var _0x368f06=![];var _0x10072b={};if(_0x3a4fdf[_0x10f2('0x35')][_0x10f2('0x31')]&&_0x3a4fdf[_0x10f2('0x35')][_0x10f2('0x31')]==='uniqueid'){_0x10072b[_0x10f2('0x50')]=_0x3a4fdf[_0x10f2('0x4d')]['id'];}else{_0x10072b['id']=_0x3a4fdf[_0x10f2('0x4d')]['id'];}return db[_0x10f2('0x2e')][_0x10f2('0x49')]({'where':_0x10072b,'attributes':['id',_0x10f2('0x51')],'raw':!![]})[_0x10f2('0x25')](handleEntityNotFound(_0x397ee7,null))[_0x10f2('0x25')](function(_0x4b27ab){if(_0x4b27ab){var _0x503b64=_0x4b27ab['value'];var _0x2c3aef=util[_0x10f2('0x52')](_0x10f2('0x53'),_0x503b64);if(fs[_0x10f2('0x54')](_0x2c3aef)){_0x368f06=!![];return _0x436bdc['decryptFile'](_0x2c3aef,_0x503b64,config[_0x10f2('0x55')][_0x10f2('0x56')])[_0x10f2('0x25')](function(){return _0x4b27ab;});}return _0x4b27ab;}})[_0x10f2('0x25')](function(_0x327d87){if(_0x327d87){var _0xf079e6=_0x327d87['value'];if(!fs[_0x10f2('0x54')](_0xf079e6)){throw new db[(_0x10f2('0x57'))][(_0x10f2('0x58'))](_0x10f2('0x59'));}if(_0x327d87['filename']){return _0x397ee7['download'](_0xf079e6,_0x327d87['filename']+path[_0x10f2('0x5a')](_0xf079e6),function(){if(_0x368f06){fs[_0x10f2('0x5b')](_0xf079e6);}});}else{return _0x397ee7['download'](_0xf079e6,function(_0x563d98){if(_0x368f06){fs['unlink'](_0xf079e6);}});}}})[_0x10f2('0x4a')](function(_0x1740bc){if(_0x1740bc['message']==='VoiceRecording\x20not\x20found'){_0x397ee7[_0x10f2('0x1a')](0x194)['send'](_0x10f2('0x5c'));}else{return handleError(_0x397ee7,null);}});};exports[_0x10f2('0x5d')]=function(_0x6c9403,_0x40c077,_0x186bc1){var _0x8aa739=require(_0x10f2('0x4f'));var _0x2c2279=![];var _0x4f1e86={'$and':[db[_0x10f2('0x5e')][_0x10f2('0x40')](db['sequelize']['fn'](_0x10f2('0x5f'),db[_0x10f2('0x5e')]['col'](_0x10f2('0x50'))),_0x6c9403[_0x10f2('0x35')]['token'])]};if(_0x6c9403[_0x10f2('0x35')][_0x10f2('0x31')]&&_0x6c9403[_0x10f2('0x35')][_0x10f2('0x31')]==='uniqueid'){_0x4f1e86[_0x10f2('0x60')][_0x10f2('0x61')]({'uniqueid':_0x6c9403['params']['id']});}else{_0x4f1e86[_0x10f2('0x60')][_0x10f2('0x61')]({'id':_0x6c9403[_0x10f2('0x4d')]['id']});}return db['VoiceRecording'][_0x10f2('0x49')]({'where':_0x4f1e86,'attributes':['id',_0x10f2('0x51')],'raw':!![]})[_0x10f2('0x25')](handleEntityNotFound(_0x40c077,null))[_0x10f2('0x25')](function(_0x337236){if(_0x337236){var _0x5197f7=util[_0x10f2('0x52')](_0x10f2('0x53'),_0x337236[_0x10f2('0x51')]);if(fs['existsSync'](_0x5197f7)){_0x2c2279=!![];return _0x8aa739['decryptFile'](_0x5197f7,_0x337236[_0x10f2('0x51')],config[_0x10f2('0x55')]['recording'])['then'](function(){return _0x337236;});}return _0x337236;}})[_0x10f2('0x25')](function(_0xdbd178){if(_0xdbd178){if(!fs[_0x10f2('0x54')](_0xdbd178[_0x10f2('0x51')])){throw new db[(_0x10f2('0x57'))]['ValidationError'](_0x10f2('0x59'));}if(_0xdbd178[_0x10f2('0x62')]){return _0x40c077[_0x10f2('0x63')](_0xdbd178[_0x10f2('0x51')],_0xdbd178['filename']+path[_0x10f2('0x5a')](_0xdbd178[_0x10f2('0x51')]),function(){if(_0x2c2279){fs[_0x10f2('0x5b')](_0xdbd178[_0x10f2('0x51')]);}});}else{return _0x40c077[_0x10f2('0x63')](_0xdbd178['value'],function(_0x2b0bf8){if(_0x2c2279){fs['unlink'](_0xdbd178['value']);}});}}})['catch'](handleError(_0x40c077,null));};exports['destroy']=function(_0x34d99e,_0x1b7f0b){return db[_0x10f2('0x2e')][_0x10f2('0x49')]({'where':{'id':_0x34d99e[_0x10f2('0x4d')]['id']}})[_0x10f2('0x25')](function(_0x559ac5){if(_[_0x10f2('0x64')](_0x559ac5)){throw new ReferenceError('Entity\x20not\x20found');}return _0x559ac5;})[_0x10f2('0x25')](function(_0x4b6a79){var _0x2d1c80=_0x4b6a79[_0x10f2('0x51')];logger[_0x10f2('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d1c80);if(!_[_0x10f2('0x64')](_0x4b6a79['value'])&&fs[_0x10f2('0x54')](_0x2d1c80)){logger[_0x10f2('0x65')](_0x10f2('0x66')+_0x2d1c80+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x10f2('0x67')](_0x2d1c80);}_0x2d1c80=_0x2d1c80+'.cypher';if(!_[_0x10f2('0x64')](_0x4b6a79[_0x10f2('0x51')])&&fs['existsSync'](_0x2d1c80)){logger[_0x10f2('0x65')](_0x10f2('0x66')+_0x2d1c80+_0x10f2('0x68'));fs[_0x10f2('0x67')](_0x2d1c80);}return _0x4b6a79;})[_0x10f2('0x25')](function(_0x44329d){if(!_0x44329d)throw new InternalError();return _0x44329d[_0x10f2('0x26')]();})['then'](function(){_0x1b7f0b[_0x10f2('0x1a')](0xcc)[_0x10f2('0x19')]();})[_0x10f2('0x4a')](handleError(_0x1b7f0b,null));};function getBucketslist(_0x11edd3,_0x2be947,_0x3b191b){return new Promise(function(_0x490d2b,_0x52605c){var _0x410a3a=new AWS['S3']({'accessKeyId':_0x2be947,'secretAccessKey':_0x11edd3,'region':_0x3b191b});_0x410a3a[_0x10f2('0x69')]({},function(_0x1518de,_0x5894db){if(_0x1518de){return _0x52605c(_0x1518de);}else{return _0x490d2b(_0x5894db);}});});}function createBucket(_0x322570,_0x152797,_0x501201,_0x1f28d8){return new Promise(function(_0x718a7d,_0x4e7054){var _0x51f3dd=new AWS['S3']({'accessKeyId':_0x152797,'secretAccessKey':_0x322570,'region':_0x501201});_0x51f3dd['createBucket']({'Bucket':_0x1f28d8},function(_0x47ad44,_0x33ca59){if(_0x47ad44){return _0x4e7054(_0x47ad44);}else{return _0x718a7d(_0x33ca59);}});});}function uploadFile(_0x1345fb,_0x35e61c,_0x3db5a9,_0x2ba1d0,_0x2723bf,_0x2760c1){return new Promise(function(_0x2333f0,_0x5aaceb){var _0x47f3ac=new AWS['S3']({'accessKeyId':_0x35e61c,'secretAccessKey':_0x1345fb,'region':_0x3db5a9});_0x47f3ac[_0x10f2('0x6a')]({'Bucket':_0x2ba1d0,'Key':_0x2723bf,'Body':_0x2760c1},function(_0x6453a1,_0x876433){if(_0x6453a1){return _0x5aaceb(_0x6453a1);}else{return _0x2333f0(_0x876433);}});});}function startTranscribe(_0x24fe92,_0x1fdf08,_0x10943b,_0x396b14,_0x38aad8,_0x322220){return new Promise(function(_0x3b5489,_0x2988c4){var _0x15b785=new AWS['TranscribeService']({'accessKeyId':_0x1fdf08,'secretAccessKey':_0x24fe92,'region':_0x10943b});_0x15b785[_0x10f2('0x6b')]({'TranscriptionJobName':_0x396b14,'LanguageCode':_0x38aad8,'Media':{'MediaFileUri':_0x322220}},function(_0x5999c4,_0x550b93){if(_0x5999c4){return _0x2988c4(_0x5999c4);}else{return _0x3b5489(_0x550b93);}});});}function transcribe(_0x57768b,_0x4a7866,_0x281a4b,_0x2044b4,_0x2edd19,_0x5447a2,_0x308f5d){return new Promise(function(_0x21274a,_0x2bd992){var _0x2b6cbd={};logger[_0x10f2('0x65')](util[_0x10f2('0x52')](_0x10f2('0x6c'),_0x57768b,_0x2edd19));return uploadFile(_0x4a7866,_0x281a4b,_0x2044b4,_0x2edd19,path['basename'](_0x5447a2),fs[_0x10f2('0x6d')](_0x5447a2))[_0x10f2('0x25')](function(_0x176e9e){logger[_0x10f2('0x65')](util[_0x10f2('0x52')](_0x10f2('0x6e'),_0x57768b,_0x2edd19,_0x176e9e[_0x10f2('0x6f')]));_0x2b6cbd[_0x10f2('0x70')]=_0x176e9e[_0x10f2('0x71')];_0x2b6cbd[_0x10f2('0x72')]=_0x176e9e[_0x10f2('0x6f')];logger[_0x10f2('0x65')](util[_0x10f2('0x52')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x57768b));return startTranscribe(_0x4a7866,_0x281a4b,_0x2044b4,uuidv4(),_0x308f5d,_0x176e9e[_0x10f2('0x6f')]);})['then'](function(_0x322356){logger[_0x10f2('0x65')](util[_0x10f2('0x52')](_0x10f2('0x73'),_0x57768b,_0x322356[_0x10f2('0x74')]['TranscriptionJobName']));_0x2b6cbd[_0x10f2('0x75')]=_0x322356[_0x10f2('0x74')][_0x10f2('0x76')];_0x2b6cbd[_0x10f2('0x77')]=_0x322356[_0x10f2('0x74')][_0x10f2('0x78')];return _0x21274a(_0x2b6cbd);})[_0x10f2('0x4a')](function(_0x524027){return _0x2bd992(_0x524027);});});}exports[_0x10f2('0x79')]=function(_0x18135e,_0xfbf410,_0x360d64){var _0x306dc4;var _0x3b2f7a;var _0x43c1fe;var _0x48ad8d=require(_0x10f2('0x4f'));return db['VoiceRecording'][_0x10f2('0x7a')]({'where':{'id':_0x18135e[_0x10f2('0x4d')]['id']}})[_0x10f2('0x25')](function(_0x7c5999){if(_0x7c5999){var _0x4d1456=util['format'](_0x10f2('0x53'),_0x7c5999[_0x10f2('0x51')]);if(fs[_0x10f2('0x54')](_0x4d1456)){cypher=!![];return _0x48ad8d['decryptFile'](_0x4d1456,_0x7c5999[_0x10f2('0x51')],config['secrets'][_0x10f2('0x56')])[_0x10f2('0x25')](function(){return _0x7c5999;});}return _0x7c5999;}})[_0x10f2('0x25')](function(_0xce118e){if(!_0xce118e){throw new db[(_0x10f2('0x57'))][(_0x10f2('0x58'))](_0x10f2('0x7b'));}_0x3b2f7a=_0xce118e;return db['Setting'][_0x10f2('0x7a')]({'where':{'id':0x1}});})[_0x10f2('0x25')](handleEntityNotFound(_0xfbf410,null))[_0x10f2('0x25')](function(_0x179db4){if(_0x179db4){_0x306dc4=_0x179db4;if(!_0x306dc4['transcribe']||!_0x306dc4[_0x10f2('0x7c')]||!_0x306dc4['transcribeRegion']||!_0x306dc4[_0x10f2('0x7d')]||!_0x306dc4[_0x10f2('0x70')]){throw new db[(_0x10f2('0x57'))]['ValidationError'](_0x10f2('0x7e'));}if(_0x18135e[_0x10f2('0x4c')]['runSentiment']&&(!_0x306dc4[_0x10f2('0x7f')]||!_0x306dc4['sentimentAccountId']||!_0x306dc4[_0x10f2('0x80')]||!_0x306dc4[_0x10f2('0x7d')]||!_0x306dc4[_0x10f2('0x70')])){throw new db[(_0x10f2('0x57'))][(_0x10f2('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider']['findOne']({'where':{'id':_0x306dc4[_0x10f2('0x7c')]}});}})['then'](function(_0x42c5ba){if(!_0x42c5ba){throw new db['Sequelize'][(_0x10f2('0x58'))](_0x10f2('0x81'));}if(!_0x42c5ba[_0x10f2('0x82')]||!_0x42c5ba['data2']){throw new db[(_0x10f2('0x57'))]['ValidationError'](_0x10f2('0x83'));}_0x43c1fe=_0x42c5ba;return getBucketslist(_0x43c1fe[_0x10f2('0x82')],_0x43c1fe['data2'],_0x306dc4['transcribeRegion']);})[_0x10f2('0x25')](function(_0x4971c2){if(_0x4971c2&&_0x4971c2[_0x10f2('0x84')]){var _0x51bc62=_[_0x10f2('0x49')](_0x4971c2[_0x10f2('0x84')],function(_0x1159e9){return _0x1159e9['Name']===_0x306dc4[_0x10f2('0x70')];});if(!_0x51bc62){logger[_0x10f2('0x65')](util['format'](_0x10f2('0x85'),_0x18135e[_0x10f2('0x4d')]['id'],_0x306dc4[_0x10f2('0x70')]));return createBucket(_0x43c1fe[_0x10f2('0x82')],_0x43c1fe[_0x10f2('0x86')],_0x306dc4['transcribeRegion'],_0x306dc4[_0x10f2('0x70')]);}logger[_0x10f2('0x65')](util[_0x10f2('0x52')](_0x10f2('0x87'),_0x18135e[_0x10f2('0x4d')]['id'],_0x306dc4[_0x10f2('0x70')]));return;}})[_0x10f2('0x25')](function(_0x4c0ec3){if(_0x3b2f7a[_0x10f2('0x77')]===_0x10f2('0x88')){return transcribe(_0x18135e[_0x10f2('0x4d')]['id'],_0x43c1fe['data1'],_0x43c1fe[_0x10f2('0x86')],_0x306dc4[_0x10f2('0x89')],_0x306dc4[_0x10f2('0x70')],_0x3b2f7a[_0x10f2('0x51')],_0x306dc4[_0x10f2('0x7d')]);}else{logger[_0x10f2('0x65')](util['format'](_0x10f2('0x8a'),_0x18135e['params']['id']));return{'transcribeStatus':_0x10f2('0x8b')};}})['then'](function(_0x5d9dcd){if(_0x5d9dcd){_0x5d9dcd[_0x10f2('0x8c')]=_0x18135e[_0x10f2('0x4c')][_0x10f2('0x8d')];return _0x3b2f7a[_0x10f2('0x8e')](_0x5d9dcd);}})[_0x10f2('0x25')](respondWithResult(_0xfbf410,null))['catch'](handleError(_0xfbf410,null));};function writeFile(_0x528ac7,_0x1daf57){return new Promise(function(_0x7b4299,_0x1708e4){fs['writeFile'](_0x1daf57,_0x528ac7,function(_0x1c8519,_0x37d14d){if(_0x1c8519){return _0x1708e4(_0x1c8519);}else{return _0x7b4299(_0x37d14d);}});});}exports[_0x10f2('0x8f')]=function(_0x5df927,_0x35cd0b,_0x2ff479){return db[_0x10f2('0x2e')][_0x10f2('0x7a')]({'where':{'id':_0x5df927['params']['id']}})['then'](handleEntityNotFound(_0x35cd0b))['then'](function(_0x14591e){if(_0x14591e&&_0x14591e[_0x10f2('0x90')]){var _0x4cb70d=_0x14591e['fileText'];var _0x1ff362=config[_0x10f2('0x91')]+'/server/files/transcribes/transcribe_'+_0x14591e['id']+'.txt';if(fs['existsSync'](_0x1ff362)){return _0x1ff362;}return writeFile(_0x4cb70d,_0x1ff362)[_0x10f2('0x25')](function(){return _0x1ff362;});}else{throw new db[(_0x10f2('0x57'))][(_0x10f2('0x58'))](_0x10f2('0x92'));}})[_0x10f2('0x25')](function(_0xf21d53){return _0x35cd0b[_0x10f2('0x63')](_0xf21d53);})[_0x10f2('0x4a')](handleError(_0x35cd0b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 31ea6d0..0316223 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 _0x8a9c=['transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0x478365,_0x2164ee){var _0x172e1a=function(_0x238975){while(--_0x238975){_0x478365['push'](_0x478365['shift']());}};_0x172e1a(++_0x2164ee);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xc8a9('0x0'));module[_0xc8a9('0x1')]=function(_0x358e57,_0x788c0f){return _0x358e57[_0xc8a9('0x2')]('VoiceRecording',attributes,{'tableName':_0xc8a9('0x3'),'paranoid':![],'indexes':[{'name':_0xc8a9('0x4'),'fields':['uniqueid']},{'name':_0xc8a9('0x5'),'fields':[_0xc8a9('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','voice_recordings'];(function(_0x20bcb1,_0xbef22e){var _0x92cded=function(_0x3af808){while(--_0x3af808){_0x20bcb1['push'](_0x20bcb1['shift']());}};_0x92cded(++_0xbef22e);}(_0xdace,0xc5));var _0xedac=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xdace[_0x12b8ec];return _0x21af77;};'use strict';var attributes=require(_0xedac('0x0'));module['exports']=function(_0x1c76b2,_0x13adb5){return _0x1c76b2[_0xedac('0x1')]('VoiceRecording',attributes,{'tableName':_0xedac('0x2'),'paranoid':![],'indexes':[{'name':_0xedac('0x3'),'fields':[_0xedac('0x3')]},{'name':_0xedac('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2b73215..4e16888 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0xd943,0x15d));var _0x3d94=function(_0x1dc177,_0x3a2324){_0x1dc177=_0x1dc177-0x0;var _0x4da3dc=_0xd943[_0x1dc177];return _0x4da3dc;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x0120=['attributes','limit','then','debug','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','format','value','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateVoiceRecording','update','body','options','raw'];(function(_0x2a5f68,_0x412f2a){var _0x38c804=function(_0x59a0d4){while(--_0x59a0d4){_0x2a5f68['push'](_0x2a5f68['shift']());}};_0x38c804(++_0x412f2a);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['VoiceRecording'][_0x0012('0x17')](_0x1d0423[_0x0012('0x18')],{'raw':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')]['where']||null:null,'attributes':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')][_0x0012('0x1c')]||null:null})[_0x0012('0x1d')](function(_0x2c9a96){logger[_0x0012('0xd')]('UpdateVoiceRecording',_0x1d0423);logger[_0x0012('0x1e')](_0x0012('0x16'),_0x1d0423,JSON['stringify'](_0x2c9a96));_0x1e78ee(_0x2c9a96);})[_0x0012('0x1f')](function(_0x13a78e){logger[_0x0012('0x12')](_0x0012('0x16'),_0x13a78e[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1['error'](0x1f4,_0x13a78e[_0x0012('0x14')]));});});};exports[_0x0012('0x20')]=function(_0xbb5b55){var _0x2a0302=this;return new Promise(function(_0x173cb3,_0xb37ef5){var _0x15d48a=require(_0x0012('0x21'));var _0x300e13;return db[_0x0012('0x22')][_0x0012('0x23')]({'attributes':['id',_0x0012('0x24')],'where':{'id':0x1},'raw':!![]})[_0x0012('0x1d')](function(_0x3ce788){_0x300e13=_0x3ce788;return db[_0x0012('0x25')][_0x0012('0x26')](_0xbb5b55[_0x0012('0x18')]);})[_0x0012('0x1d')](function(_0x1c23e0){if(_0x300e13[_0x0012('0x24')]&&fs[_0x0012('0x27')](_0x1c23e0['value'])){var _0x283134=util[_0x0012('0x28')]('%s.cypher',_0x1c23e0[_0x0012('0x29')]);return _0x15d48a[_0x0012('0x2a')](_0x1c23e0[_0x0012('0x29')],_0x283134,config[_0x0012('0x2b')][_0x0012('0x2c')])['then'](function(){fs[_0x0012('0x2d')](_0x1c23e0[_0x0012('0x29')]);logger[_0x0012('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x1c23e0;});}return _0x1c23e0;})[_0x0012('0x1d')](function(_0x31225a){logger[_0x0012('0xd')](_0x0012('0x20'),_0xbb5b55);logger[_0x0012('0x1e')](_0x0012('0x20'),_0xbb5b55,JSON['stringify'](_0x31225a));_0x173cb3(_0x31225a);})[_0x0012('0x1f')](function(_0x30dfd8){logger[_0x0012('0x12')](_0x0012('0x20'),_0x30dfd8['message'],_0xbb5b55);_0xb37ef5(_0x2a0302['error'](0x1f4,_0x30dfd8[_0x0012('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a8ab05c..42696e1 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 _0x4353=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','update','delete','multer'];(function(_0x192014,_0x446e6f){var _0x5b511b=function(_0x311f5f){while(--_0x311f5f){_0x192014['push'](_0x192014['shift']());}};_0x5b511b(++_0x446e6f);}(_0x4353,0xe3));var _0x3435=function(_0x40087e,_0x29a342){_0x40087e=_0x40087e-0x0;var _0x379ce0=_0x4353[_0x40087e];return _0x379ce0;};'use strict';var multer=require(_0x3435('0x0'));var util=require(_0x3435('0x1'));var path=require(_0x3435('0x2'));var timeout=require(_0x3435('0x3'));var express=require(_0x3435('0x4'));var router=express[_0x3435('0x5')]();var fs_extra=require(_0x3435('0x6'));var auth=require(_0x3435('0x7'));var interaction=require(_0x3435('0x8'));var config=require(_0x3435('0x9'));var controller=require(_0x3435('0xa'));router['get']('/',auth[_0x3435('0xb')](),controller['index']);router[_0x3435('0xc')](_0x3435('0xd'),auth['isAuthenticated'](),controller[_0x3435('0xe')]);router[_0x3435('0xc')](_0x3435('0xf'),auth[_0x3435('0xb')](),controller['show']);router[_0x3435('0x10')]('/',auth[_0x3435('0xb')](),controller['create']);router['put'](_0x3435('0xf'),auth[_0x3435('0xb')](),controller[_0x3435('0x11')]);router[_0x3435('0x12')](_0x3435('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe472=['index','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x4fd51c,_0x212fca){var _0xde5b62=function(_0x2b865c){while(--_0x2b865c){_0x4fd51c['push'](_0x4fd51c['shift']());}};_0xde5b62(++_0x212fca);}(_0xe472,0x8e));var _0x2e47=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe472[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x2e47('0x0'));var util=require(_0x2e47('0x1'));var path=require('path');var timeout=require(_0x2e47('0x2'));var express=require(_0x2e47('0x3'));var router=express[_0x2e47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2e47('0x5'));var interaction=require(_0x2e47('0x6'));var config=require(_0x2e47('0x7'));var controller=require(_0x2e47('0x8'));router[_0x2e47('0x9')]('/',auth['isAuthenticated'](),controller[_0x2e47('0xa')]);router[_0x2e47('0x9')]('/describe',auth[_0x2e47('0xb')](),controller[_0x2e47('0xc')]);router[_0x2e47('0x9')](_0x2e47('0xd'),auth[_0x2e47('0xb')](),controller['show']);router[_0x2e47('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x2e47('0xd'),auth['isAuthenticated'](),controller[_0x2e47('0xf')]);router[_0x2e47('0x10')](_0x2e47('0xd'),auth[_0x2e47('0xb')](),controller[_0x2e47('0x11')]);module[_0x2e47('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b58c814..dc4ac37 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 _0xa940=['ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x48a6c3,_0x2f00c5){var _0x5546fb=function(_0x2262e5){while(--_0x2262e5){_0x48a6c3['push'](_0x48a6c3['shift']());}};_0x5546fb(++_0x2f00c5);}(_0xa940,0x10d));var _0x0a94=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0xa940[_0x4b3300];return _0x2d26d3;};'use strict';var Sequelize=require(_0x0a94('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x0a94('0x1')](_0x0a94('0x2'),_0x0a94('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0a94('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0a94('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0a94('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0a94('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x0a94('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0a94('0x4')]},'transfererexten':{'type':Sequelize[_0x0a94('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0a94('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x0a94('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x0a94('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x0a94('0x4')]},'transfereecontext':{'type':Sequelize[_0x0a94('0x4')]},'transfereeexten':{'type':Sequelize[_0x0a94('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x0a94('0x5'),'No')},'context':{'type':Sequelize[_0x0a94('0x4')]},'extension':{'type':Sequelize[_0x0a94('0x4')]}}; \ No newline at end of file +var _0xec66=['exports','ENUM','attended','STRING','moment'];(function(_0x3a92b2,_0x3bbe5f){var _0x3699d2=function(_0x136d98){while(--_0x136d98){_0x3a92b2['push'](_0x3a92b2['shift']());}};_0x3699d2(++_0x3bbe5f);}(_0xec66,0x1c6));var _0x6ec6=function(_0x5a558e,_0x2c0473){_0x5a558e=_0x5a558e-0x0;var _0x44eb26=_0xec66[_0x5a558e];return _0x44eb26;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6ec6('0x0'));module[_0x6ec6('0x1')]={'type':{'type':Sequelize[_0x6ec6('0x2')]('blind',_0x6ec6('0x3'))},'result':{'type':Sequelize[_0x6ec6('0x4')]},'transfererchannel':{'type':Sequelize[_0x6ec6('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x6ec6('0x4')]},'transferercalleridname':{'type':Sequelize[_0x6ec6('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6ec6('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x6ec6('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x6ec6('0x4')]},'transferercontext':{'type':Sequelize[_0x6ec6('0x4')]},'transfererexten':{'type':Sequelize[_0x6ec6('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x6ec6('0x4')]},'transfereechannel':{'type':Sequelize[_0x6ec6('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x6ec6('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x6ec6('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x6ec6('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x6ec6('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x6ec6('0x4')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x6ec6('0x4')]},'extension':{'type':Sequelize[_0x6ec6('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0465954..39aec74 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 _0x08de=['include','VoiceTransferReport','rows','catch','params','length','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','end','error','name','send','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','count','includeAll'];(function(_0x1e6011,_0x42aa38){var _0x10112e=function(_0x466611){while(--_0x466611){_0x1e6011['push'](_0x1e6011['shift']());}};_0x10112e(++_0x42aa38);}(_0x08de,0x15e));var _0xe08d=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x08de[_0x356e8d];return _0x39e65a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe08d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe08d('0x1'));var moment=require(_0xe08d('0x2'));var BPromise=require(_0xe08d('0x3'));var Mustache=require(_0xe08d('0x4'));var util=require(_0xe08d('0x5'));var path=require(_0xe08d('0x6'));var sox=require('sox');var csv=require(_0xe08d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe08d('0x8'));var squel=require(_0xe08d('0x9'));var crypto=require(_0xe08d('0xa'));var jsforce=require(_0xe08d('0xb'));var deskjs=require(_0xe08d('0xc'));var toCsv=require(_0xe08d('0x7'));var querystring=require(_0xe08d('0xd'));var Papa=require(_0xe08d('0xe'));var Redis=require(_0xe08d('0xf'));var authService=require(_0xe08d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe08d('0x11'));var hardwareService=require(_0xe08d('0x12'));var logger=require('../../config/logger')(_0xe08d('0x13'));var utils=require(_0xe08d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe08d('0x15'))['db'];function respondWithStatusCode(_0x869915,_0x48e6e1){_0x48e6e1=_0x48e6e1||0xcc;return function(_0x25a7c3){if(_0x25a7c3){return _0x869915[_0xe08d('0x16')](_0x48e6e1);}return _0x869915[_0xe08d('0x17')](_0x48e6e1)['end']();};}function respondWithResult(_0x21410c,_0xa1c01b){_0xa1c01b=_0xa1c01b||0xc8;return function(_0x108271){if(_0x108271){return _0x21410c['status'](_0xa1c01b)[_0xe08d('0x18')](_0x108271);}};}function respondWithFilteredResult(_0x936c80,_0x4e322a){return function(_0x1e1fc1){if(_0x1e1fc1){var _0x433b8b=typeof _0x4e322a[_0xe08d('0x19')]==='undefined'&&typeof _0x4e322a[_0xe08d('0x1a')]===_0xe08d('0x1b');var _0x4d4bf0=_0x1e1fc1['count'];var _0x4455d3=_0x433b8b?0x0:_0x4e322a[_0xe08d('0x19')];var _0x556e03=_0x433b8b?_0x1e1fc1['count']:_0x4e322a[_0xe08d('0x19')]+_0x4e322a[_0xe08d('0x1a')];var _0x3a9bf4;if(_0x556e03>=_0x4d4bf0){_0x556e03=_0x4d4bf0;_0x3a9bf4=0xc8;}else{_0x3a9bf4=0xce;}_0x936c80[_0xe08d('0x17')](_0x3a9bf4);return _0x936c80[_0xe08d('0x1c')](_0xe08d('0x1d'),_0x4455d3+'-'+_0x556e03+'/'+_0x4d4bf0)[_0xe08d('0x18')](_0x1e1fc1);}return null;};}function patchUpdates(_0x11cc5e){return function(_0x259c1c){try{jsonpatch['apply'](_0x259c1c,_0x11cc5e,!![]);}catch(_0x2146fa){return BPromise[_0xe08d('0x1e')](_0x2146fa);}return _0x259c1c[_0xe08d('0x1f')]();};}function saveUpdates(_0x18af45,_0x1d1ad6){return function(_0x2ca943){if(_0x2ca943){return _0x2ca943[_0xe08d('0x20')](_0x18af45)[_0xe08d('0x21')](function(_0x95f5bf){return _0x95f5bf;});}return null;};}function removeEntity(_0x4c14c8,_0x3bf712){return function(_0x14f585){if(_0x14f585){return _0x14f585['destroy']()[_0xe08d('0x21')](function(){_0x4c14c8['status'](0xcc)[_0xe08d('0x22')]();});}};}function handleEntityNotFound(_0x18d5ca,_0x1b99ee){return function(_0x271b3e){if(!_0x271b3e){_0x18d5ca['sendStatus'](0x194);}return _0x271b3e;};}function handleError(_0x38b29e,_0x1923f5){_0x1923f5=_0x1923f5||0x1f4;return function(_0x3e2cd7){logger[_0xe08d('0x23')](_0x3e2cd7['stack']);if(_0x3e2cd7[_0xe08d('0x24')]){delete _0x3e2cd7[_0xe08d('0x24')];}_0x38b29e[_0xe08d('0x17')](_0x1923f5)[_0xe08d('0x25')](_0x3e2cd7);};}exports['index']=function(_0x4ea446,_0x22737d){var _0x34dfea={},_0x1cdeb5={},_0x1f7ef9={'count':0x0,'rows':[]};var _0x48adec=_['map'](db['VoiceTransferReport'][_0xe08d('0x26')],function(_0x325726){return{'name':_0x325726['fieldName'],'type':_0x325726[_0xe08d('0x27')]['key']};});_0x1cdeb5[_0xe08d('0x28')]=_['map'](_0x48adec,_0xe08d('0x24'));_0x1cdeb5['query']=_[_0xe08d('0x29')](_0x4ea446[_0xe08d('0x2a')]);_0x1cdeb5[_0xe08d('0x2b')]=_[_0xe08d('0x2c')](_0x1cdeb5[_0xe08d('0x28')],_0x1cdeb5[_0xe08d('0x2a')]);_0x34dfea[_0xe08d('0x2d')]=_[_0xe08d('0x2c')](_0x1cdeb5[_0xe08d('0x28')],qs[_0xe08d('0x2e')](_0x4ea446['query']['fields']));_0x34dfea[_0xe08d('0x2d')]=_0x34dfea[_0xe08d('0x2d')]['length']?_0x34dfea[_0xe08d('0x2d')]:_0x1cdeb5['model'];if(!_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x2f')](_0xe08d('0x30'))){_0x34dfea[_0xe08d('0x1a')]=qs['limit'](_0x4ea446[_0xe08d('0x2a')]['limit']);_0x34dfea[_0xe08d('0x19')]=qs[_0xe08d('0x19')](_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x19')]);}_0x34dfea[_0xe08d('0x31')]=qs[_0xe08d('0x32')](_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x32')]);_0x34dfea[_0xe08d('0x33')]=qs[_0xe08d('0x2b')](_['pick'](_0x4ea446['query'],_0x1cdeb5[_0xe08d('0x2b')]),_0x48adec);if(_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x34')]){_0x34dfea[_0xe08d('0x33')]=_[_0xe08d('0x35')](_0x34dfea[_0xe08d('0x33')],{'$or':_[_0xe08d('0x36')](_0x48adec,function(_0x2be462){if(_0x2be462['type']!=='VIRTUAL'){var _0x507a1c={};_0x507a1c[_0x2be462[_0xe08d('0x24')]]={'$like':'%'+_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x34')]+'%'};return _0x507a1c;}})});}_0x34dfea=_[_0xe08d('0x35')]({},_0x34dfea,_0x4ea446[_0xe08d('0x37')]);var _0x2701c7={'where':_0x34dfea[_0xe08d('0x33')]};return db['VoiceTransferReport']['count'](_0x2701c7)[_0xe08d('0x21')](function(_0x1b3e42){_0x1f7ef9[_0xe08d('0x38')]=_0x1b3e42;if(_0x4ea446[_0xe08d('0x2a')][_0xe08d('0x39')]){_0x34dfea[_0xe08d('0x3a')]=[{'all':!![]}];}return db[_0xe08d('0x3b')]['findAll'](_0x34dfea);})[_0xe08d('0x21')](function(_0x495394){_0x1f7ef9[_0xe08d('0x3c')]=_0x495394;return _0x1f7ef9;})['then'](respondWithFilteredResult(_0x22737d,_0x34dfea))[_0xe08d('0x3d')](handleError(_0x22737d,null));};exports['show']=function(_0x3f926f,_0x3f6148){var _0x429414={'raw':!![],'where':{'id':_0x3f926f[_0xe08d('0x3e')]['id']}},_0x4fa651={};_0x4fa651['model']=_[_0xe08d('0x29')](db['VoiceTransferReport'][_0xe08d('0x26')]);_0x4fa651[_0xe08d('0x2a')]=_[_0xe08d('0x29')](_0x3f926f[_0xe08d('0x2a')]);_0x4fa651['filters']=_['intersection'](_0x4fa651[_0xe08d('0x28')],_0x4fa651[_0xe08d('0x2a')]);_0x429414[_0xe08d('0x2d')]=_[_0xe08d('0x2c')](_0x4fa651[_0xe08d('0x28')],qs['fields'](_0x3f926f['query'][_0xe08d('0x2e')]));_0x429414[_0xe08d('0x2d')]=_0x429414['attributes'][_0xe08d('0x3f')]?_0x429414['attributes']:_0x4fa651[_0xe08d('0x28')];if(_0x3f926f[_0xe08d('0x2a')]['includeAll']){_0x429414['include']=[{'all':!![]}];}_0x429414=_['merge']({},_0x429414,_0x3f926f[_0xe08d('0x37')]);return db[_0xe08d('0x3b')]['find'](_0x429414)[_0xe08d('0x21')](handleEntityNotFound(_0x3f6148,null))[_0xe08d('0x21')](respondWithResult(_0x3f6148,null))[_0xe08d('0x3d')](handleError(_0x3f6148,null));};exports[_0xe08d('0x40')]=function(_0xd91a29,_0xedcff6){return db[_0xe08d('0x3b')]['create'](_0xd91a29[_0xe08d('0x41')],{})['then'](respondWithResult(_0xedcff6,0xc9))[_0xe08d('0x3d')](handleError(_0xedcff6,null));};exports[_0xe08d('0x20')]=function(_0x170a1c,_0x49fb62){if(_0x170a1c[_0xe08d('0x41')]['id']){delete _0x170a1c['body']['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x170a1c['params']['id']}})[_0xe08d('0x21')](handleEntityNotFound(_0x49fb62,null))[_0xe08d('0x21')](saveUpdates(_0x170a1c[_0xe08d('0x41')],null))[_0xe08d('0x21')](respondWithResult(_0x49fb62,null))[_0xe08d('0x3d')](handleError(_0x49fb62,null));};exports['destroy']=function(_0x10b329,_0x2ea702){return db['VoiceTransferReport'][_0xe08d('0x42')]({'where':{'id':_0x10b329['params']['id']}})[_0xe08d('0x21')](handleEntityNotFound(_0x2ea702,null))[_0xe08d('0x21')](removeEntity(_0x2ea702,null))[_0xe08d('0x3d')](handleError(_0x2ea702,null));};exports[_0xe08d('0x43')]=function(_0x1a1e57,_0x50df59){return db[_0xe08d('0x3b')][_0xe08d('0x43')]()[_0xe08d('0x21')](respondWithResult(_0x50df59,null))[_0xe08d('0x3d')](handleError(_0x50df59,null));}; \ No newline at end of file +var _0xc043=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','VoiceTransferReport','findAll','rows','show','params','keys','fields','include','merge','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0xc4a635,_0x19223d){var _0xcbc406=function(_0x32507e){while(--_0x32507e){_0xc4a635['push'](_0xc4a635['shift']());}};_0xcbc406(++_0x19223d);}(_0xc043,0x14c));var _0x3c04=function(_0xdc5887,_0x1fb853){_0xdc5887=_0xdc5887-0x0;var _0x3ff9db=_0xc043[_0xdc5887];return _0x3ff9db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c04('0x0'));var zipdir=require(_0x3c04('0x1'));var jsonpatch=require(_0x3c04('0x2'));var rp=require(_0x3c04('0x3'));var moment=require('moment');var BPromise=require(_0x3c04('0x4'));var Mustache=require(_0x3c04('0x5'));var util=require(_0x3c04('0x6'));var path=require(_0x3c04('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c04('0x8'));var fs=require('fs');var fs_extra=require(_0x3c04('0x9'));var _=require(_0x3c04('0xa'));var squel=require(_0x3c04('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3c04('0xc'));var toCsv=require(_0x3c04('0xd'));var querystring=require(_0x3c04('0xe'));var Papa=require(_0x3c04('0xf'));var Redis=require(_0x3c04('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c04('0x11'));var as=require(_0x3c04('0x12'));var hardwareService=require(_0x3c04('0x13'));var logger=require(_0x3c04('0x14'))(_0x3c04('0x15'));var utils=require(_0x3c04('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3c04('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x408ee6,_0x5132cf){_0x5132cf=_0x5132cf||0xcc;return function(_0x183042){if(_0x183042){return _0x408ee6[_0x3c04('0x18')](_0x5132cf);}return _0x408ee6[_0x3c04('0x19')](_0x5132cf)[_0x3c04('0x1a')]();};}function respondWithResult(_0x53dfc5,_0x2833ad){_0x2833ad=_0x2833ad||0xc8;return function(_0x4d3a31){if(_0x4d3a31){return _0x53dfc5[_0x3c04('0x19')](_0x2833ad)[_0x3c04('0x1b')](_0x4d3a31);}};}function respondWithFilteredResult(_0x3872d3,_0xa11554){return function(_0x2d0f5c){if(_0x2d0f5c){var _0x9d6dfb=typeof _0xa11554[_0x3c04('0x1c')]===_0x3c04('0x1d')&&typeof _0xa11554[_0x3c04('0x1e')]==='undefined';var _0x3966e4=_0x2d0f5c[_0x3c04('0x1f')];var _0x162cee=_0x9d6dfb?0x0:_0xa11554['offset'];var _0x265368=_0x9d6dfb?_0x2d0f5c['count']:_0xa11554[_0x3c04('0x1c')]+_0xa11554['limit'];var _0x113c0c;if(_0x265368>=_0x3966e4){_0x265368=_0x3966e4;_0x113c0c=0xc8;}else{_0x113c0c=0xce;}_0x3872d3[_0x3c04('0x19')](_0x113c0c);return _0x3872d3['set'](_0x3c04('0x20'),_0x162cee+'-'+_0x265368+'/'+_0x3966e4)[_0x3c04('0x1b')](_0x2d0f5c);}return null;};}function patchUpdates(_0x36cf72){return function(_0x25e21b){try{jsonpatch['apply'](_0x25e21b,_0x36cf72,!![]);}catch(_0x42189e){return BPromise[_0x3c04('0x21')](_0x42189e);}return _0x25e21b[_0x3c04('0x22')]();};}function saveUpdates(_0x19a6fb,_0x2d2172){return function(_0x27336b){if(_0x27336b){return _0x27336b[_0x3c04('0x23')](_0x19a6fb)['then'](function(_0x7dfdb2){return _0x7dfdb2;});}return null;};}function removeEntity(_0x55d0a8,_0x333a1e){return function(_0x1b6e7c){if(_0x1b6e7c){return _0x1b6e7c['destroy']()[_0x3c04('0x24')](function(){_0x55d0a8['status'](0xcc)[_0x3c04('0x1a')]();});}};}function handleEntityNotFound(_0xb82133,_0x226dfc){return function(_0x4f6f02){if(!_0x4f6f02){_0xb82133[_0x3c04('0x18')](0x194);}return _0x4f6f02;};}function handleError(_0x569513,_0x1d26e4){_0x1d26e4=_0x1d26e4||0x1f4;return function(_0x3b6aee){logger[_0x3c04('0x25')](_0x3b6aee['stack']);if(_0x3b6aee[_0x3c04('0x26')]){delete _0x3b6aee['name'];}_0x569513[_0x3c04('0x19')](_0x1d26e4)['send'](_0x3b6aee);};}exports[_0x3c04('0x27')]=function(_0x328f5a,_0x44c74e){var _0x5c44bc={},_0xd9cdfc={},_0x5ec2a6={'count':0x0,'rows':[]};var _0x3a08f2=_[_0x3c04('0x28')](db['VoiceTransferReport'][_0x3c04('0x29')],function(_0x1a1d05){return{'name':_0x1a1d05[_0x3c04('0x2a')],'type':_0x1a1d05['type'][_0x3c04('0x2b')]};});_0xd9cdfc[_0x3c04('0x2c')]=_[_0x3c04('0x28')](_0x3a08f2,_0x3c04('0x26'));_0xd9cdfc[_0x3c04('0x2d')]=_['keys'](_0x328f5a[_0x3c04('0x2d')]);_0xd9cdfc[_0x3c04('0x2e')]=_[_0x3c04('0x2f')](_0xd9cdfc[_0x3c04('0x2c')],_0xd9cdfc[_0x3c04('0x2d')]);_0x5c44bc[_0x3c04('0x30')]=_[_0x3c04('0x2f')](_0xd9cdfc['model'],qs['fields'](_0x328f5a[_0x3c04('0x2d')]['fields']));_0x5c44bc[_0x3c04('0x30')]=_0x5c44bc['attributes'][_0x3c04('0x31')]?_0x5c44bc['attributes']:_0xd9cdfc[_0x3c04('0x2c')];if(!_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x32')](_0x3c04('0x33'))){_0x5c44bc[_0x3c04('0x1e')]=qs[_0x3c04('0x1e')](_0x328f5a['query'][_0x3c04('0x1e')]);_0x5c44bc[_0x3c04('0x1c')]=qs[_0x3c04('0x1c')](_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x1c')]);}_0x5c44bc[_0x3c04('0x34')]=qs['sort'](_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x35')]);_0x5c44bc['where']=qs[_0x3c04('0x2e')](_[_0x3c04('0x36')](_0x328f5a[_0x3c04('0x2d')],_0xd9cdfc['filters']),_0x3a08f2);if(_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x37')]){_0x5c44bc[_0x3c04('0x38')]=_['merge'](_0x5c44bc[_0x3c04('0x38')],{'$or':_[_0x3c04('0x28')](_0x3a08f2,function(_0x28d48f){if(_0x28d48f[_0x3c04('0x39')]!==_0x3c04('0x3a')){var _0x495845={};_0x495845[_0x28d48f['name']]={'$like':'%'+_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x37')]+'%'};return _0x495845;}})});}_0x5c44bc=_['merge']({},_0x5c44bc,_0x328f5a[_0x3c04('0x3b')]);var _0x183124={'where':_0x5c44bc[_0x3c04('0x38')]};return db['VoiceTransferReport']['count'](_0x183124)['then'](function(_0xf9b703){_0x5ec2a6['count']=_0xf9b703;if(_0x328f5a[_0x3c04('0x2d')][_0x3c04('0x3c')]){_0x5c44bc['include']=[{'all':!![]}];}return db[_0x3c04('0x3d')][_0x3c04('0x3e')](_0x5c44bc);})[_0x3c04('0x24')](function(_0xdcd23d){_0x5ec2a6[_0x3c04('0x3f')]=_0xdcd23d;return _0x5ec2a6;})[_0x3c04('0x24')](respondWithFilteredResult(_0x44c74e,_0x5c44bc))['catch'](handleError(_0x44c74e,null));};exports[_0x3c04('0x40')]=function(_0x2ca217,_0xd71c92){var _0x361be1={'raw':!![],'where':{'id':_0x2ca217[_0x3c04('0x41')]['id']}},_0xedc8b0={};_0xedc8b0[_0x3c04('0x2c')]=_[_0x3c04('0x42')](db[_0x3c04('0x3d')][_0x3c04('0x29')]);_0xedc8b0[_0x3c04('0x2d')]=_[_0x3c04('0x42')](_0x2ca217[_0x3c04('0x2d')]);_0xedc8b0[_0x3c04('0x2e')]=_[_0x3c04('0x2f')](_0xedc8b0[_0x3c04('0x2c')],_0xedc8b0[_0x3c04('0x2d')]);_0x361be1[_0x3c04('0x30')]=_['intersection'](_0xedc8b0[_0x3c04('0x2c')],qs[_0x3c04('0x43')](_0x2ca217[_0x3c04('0x2d')]['fields']));_0x361be1['attributes']=_0x361be1['attributes'][_0x3c04('0x31')]?_0x361be1[_0x3c04('0x30')]:_0xedc8b0[_0x3c04('0x2c')];if(_0x2ca217[_0x3c04('0x2d')][_0x3c04('0x3c')]){_0x361be1[_0x3c04('0x44')]=[{'all':!![]}];}_0x361be1=_[_0x3c04('0x45')]({},_0x361be1,_0x2ca217[_0x3c04('0x3b')]);return db['VoiceTransferReport']['find'](_0x361be1)[_0x3c04('0x24')](handleEntityNotFound(_0xd71c92,null))[_0x3c04('0x24')](respondWithResult(_0xd71c92,null))[_0x3c04('0x46')](handleError(_0xd71c92,null));};exports['create']=function(_0x53571d,_0x5fa848){return db[_0x3c04('0x3d')][_0x3c04('0x47')](_0x53571d[_0x3c04('0x48')],{})[_0x3c04('0x24')](respondWithResult(_0x5fa848,0xc9))[_0x3c04('0x46')](handleError(_0x5fa848,null));};exports[_0x3c04('0x23')]=function(_0x26d058,_0x4da3d1){if(_0x26d058['body']['id']){delete _0x26d058['body']['id'];}return db[_0x3c04('0x3d')]['find']({'where':{'id':_0x26d058['params']['id']}})['then'](handleEntityNotFound(_0x4da3d1,null))[_0x3c04('0x24')](saveUpdates(_0x26d058[_0x3c04('0x48')],null))['then'](respondWithResult(_0x4da3d1,null))['catch'](handleError(_0x4da3d1,null));};exports[_0x3c04('0x49')]=function(_0x4349b0,_0x366f9b){return db['VoiceTransferReport'][_0x3c04('0x4a')]({'where':{'id':_0x4349b0[_0x3c04('0x41')]['id']}})[_0x3c04('0x24')](handleEntityNotFound(_0x366f9b,null))[_0x3c04('0x24')](removeEntity(_0x366f9b,null))[_0x3c04('0x46')](handleError(_0x366f9b,null));};exports[_0x3c04('0x4b')]=function(_0x103603,_0x241070){return db['VoiceTransferReport'][_0x3c04('0x4b')]()[_0x3c04('0x24')](respondWithResult(_0x241070,null))[_0x3c04('0x46')](handleError(_0x241070,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index debff67..38860af 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 _0x5647=['bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment'];(function(_0xa30c0f,_0x37e076){var _0x7d45f3=function(_0x1ac992){while(--_0x1ac992){_0xa30c0f['push'](_0xa30c0f['shift']());}};_0x7d45f3(++_0x37e076);}(_0x5647,0x15b));var _0x7564=function(_0x115af5,_0x59dc08){_0x115af5=_0x115af5-0x0;var _0x55cbcd=_0x5647[_0x115af5];return _0x55cbcd;};'use strict';var _=require(_0x7564('0x0'));var util=require('util');var logger=require(_0x7564('0x1'))(_0x7564('0x2'));var moment=require(_0x7564('0x3'));var BPromise=require(_0x7564('0x4'));var rp=require(_0x7564('0x5'));var fs=require('fs');var path=require(_0x7564('0x6'));var rimraf=require('rimraf');var config=require(_0x7564('0x7'));var attributes=require(_0x7564('0x8'));module[_0x7564('0x9')]=function(_0x49bd4a,_0x255b29){return _0x49bd4a[_0x7564('0xa')](_0x7564('0xb'),attributes,{'tableName':_0x7564('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd893=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x511be4,_0x2e82e9){var _0xad68d0=function(_0x17b492){while(--_0x17b492){_0x511be4['push'](_0x511be4['shift']());}};_0xad68d0(++_0x2e82e9);}(_0xd893,0x110));var _0x3d89=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd893[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3d89('0x0'));var util=require(_0x3d89('0x1'));var logger=require(_0x3d89('0x2'))(_0x3d89('0x3'));var moment=require(_0x3d89('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d89('0x5'));var fs=require('fs');var path=require(_0x3d89('0x6'));var rimraf=require(_0x3d89('0x7'));var config=require(_0x3d89('0x8'));var attributes=require(_0x3d89('0x9'));module[_0x3d89('0xa')]=function(_0x2b24b5,_0x68e733){return _0x2b24b5[_0x3d89('0xb')](_0x3d89('0xc'),attributes,{'tableName':_0x3d89('0xd'),'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 01410d9..b97f563 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 _0xf841=['message','CreateVoiceTransferReport','VoiceTransferReport','options','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dc126,_0x13e0d7){var _0x451c2c=function(_0x5a69a9){while(--_0x5a69a9){_0x3dc126['push'](_0x3dc126['shift']());}};_0x451c2c(++_0x13e0d7);}(_0xf841,0x19e));var _0x1f84=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0xf841[_0x318410];return _0x2898a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f84('0x0'));var BPromise=require(_0x1f84('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f84('0x2'));var db=require(_0x1f84('0x3'))['db'];var utils=require(_0x1f84('0x4'));var logger=require(_0x1f84('0x5'))(_0x1f84('0x6'));var config=require(_0x1f84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1f84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8cc7c2,_0x1d00c3,_0x1a35bb){return new BPromise(function(_0x43b207,_0x4ca235){return client[_0x1f84('0x9')](_0x8cc7c2,_0x1a35bb)[_0x1f84('0xa')](function(_0x416638){logger[_0x1f84('0xb')](_0x1f84('0xc'),_0x1d00c3,_0x1f84('0xd'));logger[_0x1f84('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1d00c3,'request\x20sent',JSON[_0x1f84('0xf')](_0x416638));if(_0x416638['error']){if(_0x416638[_0x1f84('0x10')][_0x1f84('0x11')]===0x1f4){logger[_0x1f84('0x10')](_0x1f84('0xc'),_0x1d00c3,_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);return _0x4ca235(_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);}logger[_0x1f84('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x1d00c3,_0x416638[_0x1f84('0x10')][_0x1f84('0x12')]);return _0x43b207(_0x416638['error'][_0x1f84('0x12')]);}else{logger[_0x1f84('0xb')](_0x1f84('0xc'),_0x1d00c3,_0x1f84('0xd'));_0x43b207(_0x416638['result'][_0x1f84('0x12')]);}})['catch'](function(_0x83677a){logger[_0x1f84('0x10')](_0x1f84('0xc'),_0x1d00c3,_0x83677a);_0x4ca235(_0x83677a);});});}exports[_0x1f84('0x13')]=function(_0x5520de){var _0x538362=this;return new Promise(function(_0x1036ac,_0x44162a){return db[_0x1f84('0x14')]['create'](_0x5520de['body'],{'raw':_0x5520de[_0x1f84('0x15')]?_0x5520de[_0x1f84('0x15')][_0x1f84('0x16')]===undefined?!![]:![]:!![]})[_0x1f84('0xa')](function(_0x3306f4){logger[_0x1f84('0xb')]('CreateVoiceTransferReport',_0x5520de);logger[_0x1f84('0xe')](_0x1f84('0x13'),_0x5520de,JSON[_0x1f84('0xf')](_0x3306f4));_0x1036ac(_0x3306f4);})[_0x1f84('0x17')](function(_0x1c29d7){logger[_0x1f84('0x10')](_0x1f84('0x13'),_0x1c29d7[_0x1f84('0x12')],_0x5520de);_0x44162a(_0x538362[_0x1f84('0x10')](0x1f4,_0x1c29d7['message']));});});}; \ No newline at end of file +var _0x8cae=['jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceTransferReport','body','options','then','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b8d1f,_0x1f7bb7){var _0x4b2ccc=function(_0x43a79b){while(--_0x43a79b){_0x3b8d1f['push'](_0x3b8d1f['shift']());}};_0x4b2ccc(++_0x1f7bb7);}(_0x8cae,0x1dc));var _0xe8ca=function(_0xef0c58,_0x7067ac){_0xef0c58=_0xef0c58-0x0;var _0x2365e7=_0x8cae[_0xef0c58];return _0x2365e7;};'use strict';var _=require(_0xe8ca('0x0'));var util=require(_0xe8ca('0x1'));var moment=require(_0xe8ca('0x2'));var BPromise=require(_0xe8ca('0x3'));var rs=require(_0xe8ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ca('0x5'))['db'];var utils=require(_0xe8ca('0x6'));var logger=require(_0xe8ca('0x7'))(_0xe8ca('0x8'));var config=require(_0xe8ca('0x9'));var jayson=require(_0xe8ca('0xa'));var client=jayson[_0xe8ca('0xb')][_0xe8ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x181791,_0xd03f8a,_0x9ea559){return new BPromise(function(_0x5c126e,_0x1fe72c){return client['request'](_0x181791,_0x9ea559)['then'](function(_0x547073){logger[_0xe8ca('0xd')](_0xe8ca('0xe'),_0xd03f8a,_0xe8ca('0xf'));logger[_0xe8ca('0x10')](_0xe8ca('0x11'),_0xd03f8a,_0xe8ca('0xf'),JSON['stringify'](_0x547073));if(_0x547073['error']){if(_0x547073['error']['code']===0x1f4){logger[_0xe8ca('0x12')](_0xe8ca('0xe'),_0xd03f8a,_0x547073[_0xe8ca('0x12')][_0xe8ca('0x13')]);return _0x1fe72c(_0x547073[_0xe8ca('0x12')]['message']);}logger[_0xe8ca('0x12')](_0xe8ca('0xe'),_0xd03f8a,_0x547073['error'][_0xe8ca('0x13')]);return _0x5c126e(_0x547073[_0xe8ca('0x12')][_0xe8ca('0x13')]);}else{logger[_0xe8ca('0xd')](_0xe8ca('0xe'),_0xd03f8a,_0xe8ca('0xf'));_0x5c126e(_0x547073[_0xe8ca('0x14')][_0xe8ca('0x13')]);}})[_0xe8ca('0x15')](function(_0x9af4f6){logger[_0xe8ca('0x12')](_0xe8ca('0xe'),_0xd03f8a,_0x9af4f6);_0x1fe72c(_0x9af4f6);});});}exports['CreateVoiceTransferReport']=function(_0x936455){var _0x2038ed=this;return new Promise(function(_0x11f184,_0x32b2d4){return db[_0xe8ca('0x16')]['create'](_0x936455[_0xe8ca('0x17')],{'raw':_0x936455[_0xe8ca('0x18')]?_0x936455['options']['raw']===undefined?!![]:![]:!![]})[_0xe8ca('0x19')](function(_0x488cee){logger[_0xe8ca('0xd')](_0xe8ca('0x1a'),_0x936455);logger['debug']('CreateVoiceTransferReport',_0x936455,JSON['stringify'](_0x488cee));_0x11f184(_0x488cee);})[_0xe8ca('0x15')](function(_0x472c60){logger['error'](_0xe8ca('0x1a'),_0x472c60[_0xe8ca('0x13')],_0x936455);_0x32b2d4(_0x2038ed['error'](0x1f4,_0x472c60['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 07f46b0..2f9794f 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 _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x91a7,0xe7));var _0x791a=function(_0x17ce7f,_0x457ee1){_0x17ce7f=_0x17ce7f-0x0;var _0x47dae9=_0x91a7[_0x17ce7f];return _0x47dae9;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1e0cda7..79a44bd 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 _0x61a5=['redis','defaults','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','length','status','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x61a5,0xf0));var _0x561a=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0x61a5[_0x3145af];return _0x37758a;};'use strict';var path=require(_0x561a('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x561a('0x1'))['db'];var config=require(_0x561a('0x2'));var util=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var jayson=require(_0x561a('0x5'));var amiClient=jayson['client'][_0x561a('0x6')]({'port':0x232a});var logger=require(_0x561a('0x7'))('webbarapi');var Redis=require(_0x561a('0x8'));config[_0x561a('0x9')]=_[_0x561a('0xa')](config[_0x561a('0x9')],{'host':_0x561a('0xb'),'port':0x18eb});var io=require(_0x561a('0xc'))(new Redis(config[_0x561a('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x561a('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x11')]},'transferNumber':{'type':_0x561a('0xe'),'required':[!![],_0x561a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x561a('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x561a('0xd'),'required':[!![],_0x561a('0x10')]}});function emit(_0x28ad8b,_0x3d91be,_0x14f141){logger[_0x561a('0x13')](_0x28ad8b,_0x3d91be,JSON[_0x561a('0x14')](_0x14f141));io['to'](_0x28ad8b)[_0x561a('0x15')](_0x3d91be,_0x14f141);}function handleError(_0x48df6a){return function(_0x43c5aa){console[_0x561a('0x16')]('handleError:',_0x43c5aa,_0x43c5aa instanceof RangeError);logger[_0x561a('0x17')](_0x43c5aa[_0x561a('0x18')]);if(_0x43c5aa instanceof RangeError){if(_0x43c5aa['name']){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x194)['send'](_0x43c5aa);}else{if(_0x43c5aa[_0x561a('0x19')]){delete _0x43c5aa[_0x561a('0x19')];}_0x48df6a['status'](0x1f4)[_0x561a('0x1a')](_0x43c5aa);}};}function checkError(){return function(_0x88b2b5){if(!_0x88b2b5){throw new RangeError(_0x561a('0x1b'));}return _0x88b2b5;};}function respondWithRpcPromise(_0x3cf6c8,_0x345941){return new BPromise(function(_0x1bb8df,_0x4f9c3a){var _0x3e5509=amiClient;return _0x3e5509[_0x561a('0x1c')](_0x3cf6c8,_0x345941)[_0x561a('0x1d')](function(_0x527207){if(_0x527207['error']){if(_0x527207[_0x561a('0x17')][_0x561a('0x1e')]===0x1f4){return _0x4f9c3a(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}return _0x1bb8df(_0x527207[_0x561a('0x17')][_0x561a('0x1f')]);}else{_0x1bb8df(_0x527207[_0x561a('0x20')]);}})[_0x561a('0x21')](function(_0x5bf2fa){_0x4f9c3a(_0x5bf2fa);});});}function getAgent(_0x4c2752){return db[_0x561a('0x22')][_0x561a('0x23')]({'where':{'id':_0x4c2752,'role':_0x561a('0x24')}})[_0x561a('0x1d')](checkError());}function getAgentCheckSession(_0x5a0acd,_0x186862){return new BPromise(function(_0x3f0789,_0x44c851){var _0x23b489=respondWithRpcPromise(_0x561a('0x25'));var _0x47f93a=getAgent(_0x5a0acd);Promise[_0x561a('0x26')]([_0x23b489,_0x47f93a])[_0x561a('0x1d')](function(_0x4f0b23){var _0x401636=_0x4f0b23[0x0];var _0x276ae7=_0x4f0b23[0x1];var _0x58db23=_[_0x561a('0x27')](_0x401636['rows'],function(_0x54a47a){return _0x54a47a[_0x561a('0x28')]==_0x276ae7['id']&&_0x54a47a[_0x561a('0x29')]==_0x186862;});if(_0x58db23['length']==0x1){_0x3f0789(_0x276ae7);}else{_0x44c851(new RangeError(_0x561a('0x2a')+_0x186862+_0x561a('0x2b')));}});});}exports[_0x561a('0x2c')]=function(_0x278c7e,_0x169243){logger[_0x561a('0x13')](_0x561a('0x2d'),_0x278c7e[_0x561a('0x2e')]);var _0x506c2e=originateValidation[_0x561a('0x2f')](_0x278c7e[_0x561a('0x2e')]);if(_0x506c2e[_0x561a('0x30')]>0x0){return _0x169243[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x506c2e);}var _0x4ab97f=_0x278c7e[_0x561a('0x2e')][_0x561a('0x33')];var _0x2d0063=_0x278c7e[_0x561a('0x2e')]['callNumber'];var _0x9ea469=_0x278c7e[_0x561a('0x2e')][_0x561a('0x34')];var _0x48f470=_0x278c7e['body'][_0x561a('0x35')];return getAgent(_0x4ab97f)['then'](function(_0x5a45a4){logger['info'](_0x561a('0x36'),_0x5a45a4[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x5a45a4[_0x561a('0x19')]),_0x561a('0x39'),{'callNumber':_0x2d0063,'callerId':_0x9ea469,'callbackUrl':_0x48f470});return _0x169243['status'](0xc8)['json']({'error':![],'message':_0x561a('0x3a')});})[_0x561a('0x21')](handleError(_0x169243));};exports[_0x561a('0x3b')]=function(_0x4e7d95,_0x4d81f7){logger[_0x561a('0x13')](_0x561a('0x3c'),_0x4e7d95[_0x561a('0x2e')]);var _0x5865c7=hangupValidation[_0x561a('0x2f')](_0x4e7d95[_0x561a('0x2e')]);if(_0x5865c7[_0x561a('0x30')]>0x0){return _0x4d81f7[_0x561a('0x31')](0x190)['json'](_0x5865c7);}var _0xbd11c4=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x33')];var _0x5c59dc=_0x4e7d95[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0xbd11c4)[_0x561a('0x1d')](function(_0x16779d){logger[_0x561a('0x13')](_0x561a('0x36'),_0x16779d[_0x561a('0x19')]);emit(util['format'](_0x561a('0x38'),_0x16779d[_0x561a('0x19')]),_0x561a('0x3d'),{'sessionId':_0x5c59dc});return _0x4d81f7[_0x561a('0x31')](0xc8)[_0x561a('0x32')]({'error':![],'message':_0x561a('0x3e')});})['catch'](handleError(_0x4d81f7));};exports[_0x561a('0x3f')]=function(_0xd991f8,_0x3f0f44){logger[_0x561a('0x13')](_0x561a('0x40'),_0xd991f8[_0x561a('0x2e')]);var _0x293e11=answerValidation[_0x561a('0x2f')](_0xd991f8[_0x561a('0x2e')]);if(_0x293e11['length']>0x0){return _0x3f0f44[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x293e11);}var _0x5197b1=_0xd991f8[_0x561a('0x2e')]['userId'];var _0x141971=_0xd991f8[_0x561a('0x2e')][_0x561a('0x29')];return getAgent(_0x5197b1)[_0x561a('0x1d')](function(_0x93103b){logger['info'](_0x561a('0x36'),_0x93103b[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x93103b[_0x561a('0x19')]),_0x561a('0x41'),{'sessionId':_0x141971});return _0x3f0f44['status'](0xc8)['json']({'error':![],'message':_0x561a('0x42')});})['catch'](handleError(_0x3f0f44));};exports['hold']=function(_0x4d7a38,_0x5e9e37){logger['info'](_0x561a('0x43'),_0x4d7a38[_0x561a('0x2e')]);var _0x21858b=holdValidation['validate'](_0x4d7a38[_0x561a('0x2e')]);if(_0x21858b['length']>0x0){return _0x5e9e37['status'](0x190)[_0x561a('0x32')](_0x21858b);}var _0x13a2ad=_0x4d7a38[_0x561a('0x2e')]['userId'];var _0x3bfd1b=_0x4d7a38['body'][_0x561a('0x29')];return getAgent(_0x13a2ad)['then'](function(_0x1bd3df){logger[_0x561a('0x13')](_0x561a('0x36'),_0x1bd3df[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x1bd3df[_0x561a('0x19')]),_0x561a('0x44'),{'sessionId':_0x3bfd1b});return _0x5e9e37[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x45')});})[_0x561a('0x21')](handleError(_0x5e9e37));};exports[_0x561a('0x46')]=function(_0x48ed34,_0x14fe1b){logger[_0x561a('0x13')]('unhold\x20fired:',_0x48ed34[_0x561a('0x2e')]);var _0x99dc7f=unholdValidation[_0x561a('0x2f')](_0x48ed34['body']);if(_0x99dc7f[_0x561a('0x30')]>0x0){return _0x14fe1b[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x99dc7f);}var _0x2cd4e0=_0x48ed34[_0x561a('0x2e')][_0x561a('0x33')];var _0x3d9b63=_0x48ed34['body'][_0x561a('0x29')];return getAgent(_0x2cd4e0)[_0x561a('0x1d')](function(_0x2dc1a3){logger[_0x561a('0x13')](_0x561a('0x36'),_0x2dc1a3[_0x561a('0x19')]);emit(util[_0x561a('0x37')]('user:%s',_0x2dc1a3[_0x561a('0x19')]),_0x561a('0x47'),{'sessionId':_0x3d9b63});return _0x14fe1b[_0x561a('0x31')](0xc8)['json']({'error':![],'message':_0x561a('0x48')});})['catch'](handleError(_0x14fe1b));};exports[_0x561a('0x49')]=function(_0x3d03c5,_0x2e0351){logger[_0x561a('0x13')](_0x561a('0x4a'),_0x2e0351[_0x561a('0x2e')]);var _0x29d981=callsValidation['validate'](_0x3d03c5['body']);if(_0x29d981[_0x561a('0x30')]>0x0){return _0x2e0351[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x29d981);}var _0x2945c1=_0x3d03c5[_0x561a('0x2e')][_0x561a('0x33')];var _0x4d13c8=respondWithRpcPromise(_0x561a('0x25'));var _0x1b0ecf=getAgent(_0x2945c1);return Promise['all']([_0x4d13c8,_0x1b0ecf])[_0x561a('0x1d')](function(_0x574ee2){var _0x5194d5=_0x574ee2[0x0];var _0xc7447e=_0x574ee2[0x1];var _0x16daeb=_[_0x561a('0x27')](_0x5194d5[_0x561a('0x4b')],function(_0x4a714c){return _0x4a714c[_0x561a('0x28')]==_0xc7447e['id'];});return _0x2e0351['status'](0xc8)[_0x561a('0x32')]({'count':_0x16daeb[_0x561a('0x30')],'rows':_0x16daeb});})[_0x561a('0x21')](handleError(_0x2e0351));};exports['conference']=function(_0x4ec13c,_0x52074a){logger['info'](_0x561a('0x4c'),_0x4ec13c[_0x561a('0x2e')]);var _0x485b80=conferenceValidation[_0x561a('0x2f')](_0x4ec13c[_0x561a('0x2e')]);if(_0x485b80[_0x561a('0x30')]>0x0){return _0x52074a['status'](0x190)[_0x561a('0x32')](_0x485b80);}var _0xb046d8=_0x4ec13c[_0x561a('0x2e')][_0x561a('0x33')];return getAgent(_0xb046d8)[_0x561a('0x1d')](function(_0x849fe){logger[_0x561a('0x13')](_0x561a('0x36'),_0x849fe[_0x561a('0x19')]);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x849fe['name']),_0x561a('0x4d'));return _0x52074a[_0x561a('0x31')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x561a('0x21')](handleError(_0x52074a));};exports[_0x561a('0x4e')]=function(_0x565867,_0x40f22e){logger[_0x561a('0x13')](_0x561a('0x4f'),_0x565867[_0x561a('0x2e')]);var _0x30d2a7=transferValidation[_0x561a('0x2f')](_0x565867['body']);if(_0x30d2a7['length']>0x0){return _0x40f22e[_0x561a('0x31')](0x190)[_0x561a('0x32')](_0x30d2a7);}var _0x3c8b20=_0x565867[_0x561a('0x2e')][_0x561a('0x33')];var _0x1656b=_0x565867['body']['sessionId'];var _0x53a93a=_0x565867[_0x561a('0x2e')][_0x561a('0x50')];return getAgent(_0x3c8b20)[_0x561a('0x1d')](function(_0x57bffc){logger['info']('entityFound:',_0x57bffc['name']);emit(util[_0x561a('0x37')](_0x561a('0x38'),_0x57bffc['name']),_0x561a('0x51'),{'sessionId':_0x1656b,'transferNumber':_0x53a93a});return _0x40f22e['status'](0xc8)['json']({'error':![],'message':_0x561a('0x52')});})[_0x561a('0x21')](handleError(_0x40f22e));}; \ No newline at end of file +var _0xc788=['all','filter','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','name','send','status','NotFound','request','then','code','message','result','catch','findOne','agent','VoiceChannels'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xc788,0xc4));var _0x8c78=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0xc788[_0x718f1f];return _0x48b289;};'use strict';var path=require(_0x8c78('0x0'));var fs=require('fs');var _=require(_0x8c78('0x1'));var db=require(_0x8c78('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x8c78('0x3'));var jayson=require(_0x8c78('0x4'));var amiClient=jayson[_0x8c78('0x5')][_0x8c78('0x6')]({'port':0x232a});var logger=require(_0x8c78('0x7'))('webbarapi');var Redis=require(_0x8c78('0x8'));config[_0x8c78('0x9')]=_[_0x8c78('0xa')](config[_0x8c78('0x9')],{'host':_0x8c78('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c78('0x9')]));var Schema=require(_0x8c78('0xc'));var originateValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'callNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8c78('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]}});function emit(_0x293cfe,_0x57ad11,_0x45b85f){logger[_0x8c78('0x12')](_0x293cfe,_0x57ad11,JSON[_0x8c78('0x13')](_0x45b85f));io['to'](_0x293cfe)[_0x8c78('0x14')](_0x57ad11,_0x45b85f);}function handleError(_0x2a982c){return function(_0x461eff){console['log']('handleError:',_0x461eff,_0x461eff instanceof RangeError);logger[_0x8c78('0x15')](_0x461eff['stack']);if(_0x461eff instanceof RangeError){if(_0x461eff['name']){delete _0x461eff[_0x8c78('0x16')];}_0x2a982c['status'](0x194)[_0x8c78('0x17')](_0x461eff);}else{if(_0x461eff[_0x8c78('0x16')]){delete _0x461eff['name'];}_0x2a982c[_0x8c78('0x18')](0x1f4)['send'](_0x461eff);}};}function checkError(){return function(_0x2dba52){if(!_0x2dba52){throw new RangeError(_0x8c78('0x19'));}return _0x2dba52;};}function respondWithRpcPromise(_0x5a254d,_0xd1ae4d){return new BPromise(function(_0x188cc3,_0x499603){var _0x2bc595=amiClient;return _0x2bc595[_0x8c78('0x1a')](_0x5a254d,_0xd1ae4d)[_0x8c78('0x1b')](function(_0x9581c6){if(_0x9581c6[_0x8c78('0x15')]){if(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1c')]===0x1f4){return _0x499603(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1d')]);}return _0x188cc3(_0x9581c6['error'][_0x8c78('0x1d')]);}else{_0x188cc3(_0x9581c6[_0x8c78('0x1e')]);}})[_0x8c78('0x1f')](function(_0x49cccb){_0x499603(_0x49cccb);});});}function getAgent(_0x331bfe){return db['User'][_0x8c78('0x20')]({'where':{'id':_0x331bfe,'role':_0x8c78('0x21')}})[_0x8c78('0x1b')](checkError());}function getAgentCheckSession(_0x496c51,_0x583a74){return new BPromise(function(_0x2568d5,_0x4be49d){var _0x20b128=respondWithRpcPromise(_0x8c78('0x22'));var _0x394c1d=getAgent(_0x496c51);Promise[_0x8c78('0x23')]([_0x20b128,_0x394c1d])[_0x8c78('0x1b')](function(_0x2ab5cc){var _0x5ba7d4=_0x2ab5cc[0x0];var _0x1c3039=_0x2ab5cc[0x1];var _0x51add6=_[_0x8c78('0x24')](_0x5ba7d4[_0x8c78('0x25')],function(_0xb69c52){return _0xb69c52['UserId']==_0x1c3039['id']&&_0xb69c52[_0x8c78('0x26')]==_0x583a74;});if(_0x51add6[_0x8c78('0x27')]==0x1){_0x2568d5(_0x1c3039);}else{_0x4be49d(new RangeError('sessionId\x20'+_0x583a74+_0x8c78('0x28')));}});});}exports[_0x8c78('0x29')]=function(_0x32bc1f,_0x487a4c){logger[_0x8c78('0x12')](_0x8c78('0x2a'),_0x32bc1f[_0x8c78('0x2b')]);var _0x5348ab=originateValidation[_0x8c78('0xc')](_0x32bc1f[_0x8c78('0x2b')]);if(_0x5348ab['length']>0x0){return _0x487a4c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5348ab);}var _0x3a9372=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x5b5429=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2e')];var _0x201a43=_0x32bc1f[_0x8c78('0x2b')]['callerId'];var _0x3e9bf1=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2f')];return getAgent(_0x3a9372)[_0x8c78('0x1b')](function(_0x34481a){logger['info'](_0x8c78('0x30'),_0x34481a[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x34481a[_0x8c78('0x16')]),_0x8c78('0x32'),{'callNumber':_0x5b5429,'callerId':_0x201a43,'callbackUrl':_0x3e9bf1});return _0x487a4c['status'](0xc8)[_0x8c78('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0x8c78('0x1f')](handleError(_0x487a4c));};exports[_0x8c78('0x33')]=function(_0x245f62,_0x157b81){logger['info'](_0x8c78('0x34'),_0x245f62['body']);var _0x3b8f4f=hangupValidation[_0x8c78('0xc')](_0x245f62[_0x8c78('0x2b')]);if(_0x3b8f4f['length']>0x0){return _0x157b81['status'](0x190)[_0x8c78('0x2c')](_0x3b8f4f);}var _0x25d143=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x2eb3ef=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x25d143)[_0x8c78('0x1b')](function(_0x1f0a2b){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x1f0a2b[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x1f0a2b[_0x8c78('0x16')]),_0x8c78('0x35'),{'sessionId':_0x2eb3ef});return _0x157b81['status'](0xc8)['json']({'error':![],'message':_0x8c78('0x36')});})[_0x8c78('0x1f')](handleError(_0x157b81));};exports['answer']=function(_0x224c4b,_0x57ff42){logger['info'](_0x8c78('0x37'),_0x224c4b[_0x8c78('0x2b')]);var _0x57e2c7=answerValidation[_0x8c78('0xc')](_0x224c4b[_0x8c78('0x2b')]);if(_0x57e2c7[_0x8c78('0x27')]>0x0){return _0x57ff42[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x57e2c7);}var _0x4e4880=_0x224c4b['body'][_0x8c78('0x2d')];var _0x2f6a6b=_0x224c4b[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x4e4880)[_0x8c78('0x1b')](function(_0x460821){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x460821[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0x460821['name']),_0x8c78('0x39'),{'sessionId':_0x2f6a6b});return _0x57ff42[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x3a')});})[_0x8c78('0x1f')](handleError(_0x57ff42));};exports['hold']=function(_0x356e47,_0x4588cd){logger[_0x8c78('0x12')](_0x8c78('0x3b'),_0x356e47[_0x8c78('0x2b')]);var _0x5cc829=holdValidation[_0x8c78('0xc')](_0x356e47['body']);if(_0x5cc829['length']>0x0){return _0x4588cd[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5cc829);}var _0x61e20=_0x356e47['body'][_0x8c78('0x2d')];var _0xc6ba23=_0x356e47[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x61e20)[_0x8c78('0x1b')](function(_0x38083e){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x38083e[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x38083e[_0x8c78('0x16')]),_0x8c78('0x3c'),{'sessionId':_0xc6ba23});return _0x4588cd[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x3d')});})[_0x8c78('0x1f')](handleError(_0x4588cd));};exports[_0x8c78('0x3e')]=function(_0x431125,_0x53e75c){logger[_0x8c78('0x12')](_0x8c78('0x3f'),_0x431125[_0x8c78('0x2b')]);var _0x551e0f=unholdValidation[_0x8c78('0xc')](_0x431125['body']);if(_0x551e0f[_0x8c78('0x27')]>0x0){return _0x53e75c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x551e0f);}var _0xa87aba=_0x431125[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0xf68e0=_0x431125[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0xa87aba)[_0x8c78('0x1b')](function(_0x23e568){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x23e568[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x23e568[_0x8c78('0x16')]),_0x8c78('0x40'),{'sessionId':_0xf68e0});return _0x53e75c[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x41')});})[_0x8c78('0x1f')](handleError(_0x53e75c));};exports[_0x8c78('0x42')]=function(_0x2b9b18,_0x40025d){logger[_0x8c78('0x12')]('calls\x20fired:',_0x40025d[_0x8c78('0x2b')]);var _0x42a34e=callsValidation['validate'](_0x2b9b18[_0x8c78('0x2b')]);if(_0x42a34e['length']>0x0){return _0x40025d[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x42a34e);}var _0x257533=_0x2b9b18[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x35cf85=respondWithRpcPromise(_0x8c78('0x22'));var _0x49fa4c=getAgent(_0x257533);return Promise[_0x8c78('0x23')]([_0x35cf85,_0x49fa4c])[_0x8c78('0x1b')](function(_0x4e77a9){var _0x110e7b=_0x4e77a9[0x0];var _0x3529aa=_0x4e77a9[0x1];var _0x577361=_[_0x8c78('0x24')](_0x110e7b[_0x8c78('0x25')],function(_0x3e2160){return _0x3e2160[_0x8c78('0x43')]==_0x3529aa['id'];});return _0x40025d[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'count':_0x577361[_0x8c78('0x27')],'rows':_0x577361});})[_0x8c78('0x1f')](handleError(_0x40025d));};exports[_0x8c78('0x44')]=function(_0x1b3600,_0x25b8bc){logger[_0x8c78('0x12')](_0x8c78('0x45'),_0x1b3600[_0x8c78('0x2b')]);var _0x50ae7d=conferenceValidation[_0x8c78('0xc')](_0x1b3600['body']);if(_0x50ae7d[_0x8c78('0x27')]>0x0){return _0x25b8bc['status'](0x190)['json'](_0x50ae7d);}var _0x57a4b1=_0x1b3600[_0x8c78('0x2b')]['userId'];return getAgent(_0x57a4b1)['then'](function(_0x502991){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x502991[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x502991[_0x8c78('0x16')]),_0x8c78('0x46'));return _0x25b8bc[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x47')});})[_0x8c78('0x1f')](handleError(_0x25b8bc));};exports[_0x8c78('0x48')]=function(_0x54d561,_0x25c255){logger[_0x8c78('0x12')](_0x8c78('0x49'),_0x54d561[_0x8c78('0x2b')]);var _0x3e1ee0=transferValidation[_0x8c78('0xc')](_0x54d561['body']);if(_0x3e1ee0[_0x8c78('0x27')]>0x0){return _0x25c255['status'](0x190)[_0x8c78('0x2c')](_0x3e1ee0);}var _0x28d1a7=_0x54d561[_0x8c78('0x2b')]['userId'];var _0x97df9c=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x26')];var _0x4fa0b0=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x4a')];return getAgent(_0x28d1a7)['then'](function(_0xbfafd1){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0xbfafd1['name']);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0xbfafd1[_0x8c78('0x16')]),_0x8c78('0x4b'),{'sessionId':_0x97df9c,'transferNumber':_0x4fa0b0});return _0x25c255[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x4c')});})[_0x8c78('0x1f')](handleError(_0x25c255));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 354fb49..84294cb 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 _0x6091=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','addDisposition','addAnswer','post','addApplications','notify','/:id/send','send','update','delete','destroy','removeAnswers','multer','express','Router'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x6091,0x9d));var _0x1609=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x6091[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x1609('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1609('0x1'));var router=express[_0x1609('0x2')]();var fs_extra=require(_0x1609('0x3'));var auth=require(_0x1609('0x4'));var interaction=require(_0x1609('0x5'));var config=require(_0x1609('0x6'));var controller=require(_0x1609('0x7'));router['get']('/',auth[_0x1609('0x8')](),controller[_0x1609('0x9')]);router[_0x1609('0xa')](_0x1609('0xb'),auth[_0x1609('0x8')](),controller[_0x1609('0xc')]);router[_0x1609('0xa')](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0xe')]);router[_0x1609('0xa')](_0x1609('0xf'),auth['isAuthenticated'](),controller[_0x1609('0x10')]);router[_0x1609('0xa')](_0x1609('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1609('0xa')](_0x1609('0x12'),auth[_0x1609('0x8')](),controller[_0x1609('0x13')]);router[_0x1609('0xa')](_0x1609('0x14'),auth[_0x1609('0x8')](),controller['getApplications']);router['post']('/',auth[_0x1609('0x8')](),controller['create']);router['post'](_0x1609('0xf'),auth['isAuthenticated'](),controller[_0x1609('0x15')]);router['post']('/:id/canned_answers',auth[_0x1609('0x8')](),controller[_0x1609('0x16')]);router[_0x1609('0x17')](_0x1609('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1609('0x17')](_0x1609('0x14'),auth[_0x1609('0x8')](),controller[_0x1609('0x18')]);router[_0x1609('0x17')]('/:id/notify',controller[_0x1609('0x19')]);router[_0x1609('0x17')](_0x1609('0x1a'),auth[_0x1609('0x8')](),controller[_0x1609('0x1b')]);router['put'](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0x1c')]);router[_0x1609('0x1d')](_0x1609('0xd'),auth[_0x1609('0x8')](),controller[_0x1609('0x1e')]);router[_0x1609('0x1d')](_0x1609('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1609('0x1d')](_0x1609('0x11'),auth[_0x1609('0x8')](),controller[_0x1609('0x1f')]);router[_0x1609('0x1d')](_0x1609('0x12'),auth[_0x1609('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf965=['post','create','/:id/dispositions','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','update','delete','/:id','destroy','removeAnswers','removeAgents','exports','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','index','get','/describe','describe','isAuthenticated','show','getDispositions','getAnswers','getAgents','/:id/applications','getApplications'];(function(_0x38c5bd,_0x544add){var _0x1b6bfc=function(_0x589d24){while(--_0x589d24){_0x38c5bd['push'](_0x38c5bd['shift']());}};_0x1b6bfc(++_0x544add);}(_0xf965,0x13b));var _0x5f96=function(_0x59d46d,_0x400167){_0x59d46d=_0x59d46d-0x0;var _0x294f37=_0xf965[_0x59d46d];return _0x294f37;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5f96('0x0'));var interaction=require(_0x5f96('0x1'));var config=require(_0x5f96('0x2'));var controller=require(_0x5f96('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x5f96('0x4')]);router[_0x5f96('0x5')](_0x5f96('0x6'),auth['isAuthenticated'](),controller[_0x5f96('0x7')]);router[_0x5f96('0x5')]('/:id',auth[_0x5f96('0x8')](),controller[_0x5f96('0x9')]);router['get']('/:id/dispositions',auth[_0x5f96('0x8')](),controller[_0x5f96('0xa')]);router[_0x5f96('0x5')]('/:id/canned_answers',auth[_0x5f96('0x8')](),controller[_0x5f96('0xb')]);router[_0x5f96('0x5')]('/:id/users',auth[_0x5f96('0x8')](),controller[_0x5f96('0xc')]);router[_0x5f96('0x5')](_0x5f96('0xd'),auth[_0x5f96('0x8')](),controller[_0x5f96('0xe')]);router[_0x5f96('0xf')]('/',auth[_0x5f96('0x8')](),controller[_0x5f96('0x10')]);router[_0x5f96('0xf')](_0x5f96('0x11'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x12')]);router[_0x5f96('0xf')]('/:id/canned_answers',auth[_0x5f96('0x8')](),controller[_0x5f96('0x13')]);router['post'](_0x5f96('0x14'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x15')]);router[_0x5f96('0xf')](_0x5f96('0xd'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x16')]);router[_0x5f96('0xf')](_0x5f96('0x17'),controller[_0x5f96('0x18')]);router[_0x5f96('0xf')]('/:id/send',auth[_0x5f96('0x8')](),controller[_0x5f96('0x19')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5f96('0x1a')]);router[_0x5f96('0x1b')](_0x5f96('0x1c'),auth[_0x5f96('0x8')](),controller[_0x5f96('0x1d')]);router['delete']('/:id/dispositions',auth[_0x5f96('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x5f96('0x8')](),controller[_0x5f96('0x1e')]);router['delete']('/:id/users',auth[_0x5f96('0x8')](),controller[_0x5f96('0x1f')]);module[_0x5f96('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 58eda3b..0dbce42 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 _0x5092=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x5bbae9,_0xa7e306){var _0x117aec=function(_0x46a18f){while(--_0x46a18f){_0x5bbae9['push'](_0x5bbae9['shift']());}};_0x117aec(++_0xa7e306);}(_0x5092,0x147));var _0x2509=function(_0x31a58b,_0x24eec0){_0x31a58b=_0x31a58b-0x0;var _0x3b5f61=_0x5092[_0x31a58b];return _0x3b5f61;};'use strict';var Sequelize=require(_0x2509('0x0'));var rs=require(_0x2509('0x1'));module[_0x2509('0x2')]={'name':{'type':Sequelize[_0x2509('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x2509('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2509('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2509('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2509('0x5')]('twilio',_0x2509('0x6'))},'accountSid':{'type':Sequelize[_0x2509('0x3')]},'baseUrl':{'type':Sequelize[_0x2509('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2509('0x7')],'defaultValue':function(){return _0x2509('0x8');}},'notificationSound':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2509('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x2509('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2509('0x9')],'defaultValue':![],'comment':_0x2509('0xb'),'set':function(_0x29172e){if(!_0x29172e){this[_0x2509('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue']('mandatoryDisposition',_0x29172e);}},'description':{'type':Sequelize[_0x2509('0x3')]}}; \ No newline at end of file +var _0xe21d=['randomstring','exports','name','STRING','generate','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xe21d,0x159));var _0xde21=function(_0x1b36cb,_0x7f2fc1){_0x1b36cb=_0x1b36cb-0x0;var _0x29f42d=_0xe21d[_0x1b36cb];return _0x29f42d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xde21('0x0'));module[_0xde21('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xde21('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xde21('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xde21('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xde21('0x5'),_0xde21('0x6'))},'accountSid':{'type':Sequelize[_0xde21('0x3')]},'baseUrl':{'type':Sequelize[_0xde21('0x3')]},'authToken':{'type':Sequelize[_0xde21('0x3')]},'notificationTemplate':{'type':Sequelize[_0xde21('0x7')],'defaultValue':function(){return _0xde21('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xde21('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde21('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xde21('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde21('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde21('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde21('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xde21('0xa')],'comment':_0xde21('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xde21('0xc'),'set':function(_0x589887){if(!_0x589887){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xde21('0xd')](_0xde21('0xe'),_0x589887);}},'description':{'type':Sequelize[_0xde21('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 47d50b5..e6e29dd 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 _0x9158=['request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappAccount','includeAll','findAll','rows','show','keys','rawAttributes','intersection','include','options','find','create','user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2e4ca1,_0x317525){var _0x1a47e1=function(_0x38806f){while(--_0x38806f){_0x2e4ca1['push'](_0x2e4ca1['shift']());}};_0x1a47e1(++_0x317525);}(_0x9158,0x16e));var _0x8915=function(_0x5725e3,_0x4c7413){_0x5725e3=_0x5725e3-0x0;var _0x3fbb60=_0x9158[_0x5725e3];return _0x3fbb60;};'use strict';var emlformat=require(_0x8915('0x0'));var rimraf=require(_0x8915('0x1'));var zipdir=require(_0x8915('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8915('0x3'));var moment=require('moment');var BPromise=require(_0x8915('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8915('0x5'));var sox=require(_0x8915('0x6'));var csv=require(_0x8915('0x7'));var ejs=require(_0x8915('0x8'));var fs=require('fs');var fs_extra=require(_0x8915('0x9'));var _=require(_0x8915('0xa'));var squel=require(_0x8915('0xb'));var crypto=require(_0x8915('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8915('0xd'));var toCsv=require(_0x8915('0x7'));var querystring=require(_0x8915('0xe'));var Papa=require(_0x8915('0xf'));var Redis=require(_0x8915('0x10'));var authService=require(_0x8915('0x11'));var qs=require(_0x8915('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8915('0x13'))(_0x8915('0x14'));var utils=require(_0x8915('0x15'));var config=require(_0x8915('0x16'));var licenseUtil=require(_0x8915('0x17'));var db=require(_0x8915('0x18'))['db'];config['redis']=_[_0x8915('0x19')](config[_0x8915('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8915('0x1b'))(new Redis(config['redis']));require(_0x8915('0x1c'))['register'](socket);var jayson=require(_0x8915('0x1d'));var client=jayson[_0x8915('0x1e')][_0x8915('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x430741,_0x8dff4d,_0x57c012,_0x343b9f){return new BPromise(function(_0x30591f,_0xba802f){var _0x3f541c=_0x343b9f||client;return _0x3f541c[_0x8915('0x20')](_0x430741,_0x57c012)['then'](function(_0x1a0e04){logger[_0x8915('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,'request\x20sent');logger[_0x8915('0x22')](_0x8915('0x23'),_0x8dff4d,_0x8915('0x24'),JSON[_0x8915('0x25')](_0x1a0e04));if(_0x1a0e04[_0x8915('0x26')]){if(_0x1a0e04[_0x8915('0x26')][_0x8915('0x27')]===0x1f4){logger[_0x8915('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,_0x1a0e04['error'][_0x8915('0x28')]);return _0xba802f(_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);}logger[_0x8915('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x8dff4d,_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);return _0x30591f(_0x1a0e04[_0x8915('0x26')][_0x8915('0x28')]);}else{logger[_0x8915('0x21')](_0x8915('0x29'),_0x8dff4d,_0x8915('0x24'));_0x30591f(_0x1a0e04[_0x8915('0x2a')]['message']);}})[_0x8915('0x2b')](function(_0x4e5973){logger[_0x8915('0x26')](_0x8915('0x29'),_0x8dff4d,_0x4e5973);_0xba802f(_0x4e5973);});});}function respondWithStatusCode(_0x4bfcd2,_0x24d707){_0x24d707=_0x24d707||0xcc;return function(_0x3d5754){if(_0x3d5754){return _0x4bfcd2[_0x8915('0x2c')](_0x24d707);}return _0x4bfcd2[_0x8915('0x2d')](_0x24d707)[_0x8915('0x2e')]();};}function respondWithResult(_0x1a9ba2,_0x49373f){_0x49373f=_0x49373f||0xc8;return function(_0x5ea00f){if(_0x5ea00f){return _0x1a9ba2[_0x8915('0x2d')](_0x49373f)[_0x8915('0x2f')](_0x5ea00f);}};}function respondWithFilteredResult(_0x499e80,_0x2124cc){return function(_0x54d3c7){if(_0x54d3c7){var _0x3b133c=typeof _0x2124cc['offset']===_0x8915('0x30')&&typeof _0x2124cc[_0x8915('0x31')]==='undefined';var _0x33c87f=_0x54d3c7[_0x8915('0x32')];var _0x18296c=_0x3b133c?0x0:_0x2124cc[_0x8915('0x33')];var _0xd3eccb=_0x3b133c?_0x54d3c7['count']:_0x2124cc[_0x8915('0x33')]+_0x2124cc['limit'];var _0x37d151;if(_0xd3eccb>=_0x33c87f){_0xd3eccb=_0x33c87f;_0x37d151=0xc8;}else{_0x37d151=0xce;}_0x499e80[_0x8915('0x2d')](_0x37d151);return _0x499e80[_0x8915('0x34')]('Content-Range',_0x18296c+'-'+_0xd3eccb+'/'+_0x33c87f)['json'](_0x54d3c7);}return null;};}function patchUpdates(_0xbeab87){return function(_0x42d20c){try{jsonpatch['apply'](_0x42d20c,_0xbeab87,!![]);}catch(_0x3be0f0){return BPromise['reject'](_0x3be0f0);}return _0x42d20c[_0x8915('0x35')]();};}function saveUpdates(_0xdfb21b,_0x404c9c){return function(_0xca39df){if(_0xca39df){return _0xca39df[_0x8915('0x36')](_0xdfb21b)[_0x8915('0x37')](function(_0x135b73){return _0x135b73;});}return null;};}function removeEntity(_0x158151,_0x28f0d0){return function(_0x1bc7e7){if(_0x1bc7e7){return _0x1bc7e7['destroy']()[_0x8915('0x37')](function(){var _0x366686=_0x1bc7e7[_0x8915('0x38')]({'plain':!![]});var _0x480ab1='WhatsappAccounts';return db[_0x8915('0x39')][_0x8915('0x3a')]({'where':{'type':_0x480ab1,'resourceId':_0x366686['id']}})[_0x8915('0x37')](function(){return _0x1bc7e7;});})[_0x8915('0x37')](function(){_0x158151[_0x8915('0x2d')](0xcc)[_0x8915('0x2e')]();});}};}function handleEntityNotFound(_0x38b27e,_0x50d9c0){return function(_0x388843){if(!_0x388843){_0x38b27e[_0x8915('0x2c')](0x194);}return _0x388843;};}function handleError(_0x42b1d2,_0x15f1d4){_0x15f1d4=_0x15f1d4||0x1f4;return function(_0x2e55c0){logger[_0x8915('0x26')](_0x2e55c0[_0x8915('0x3b')]);if(_0x2e55c0[_0x8915('0x3c')]){delete _0x2e55c0[_0x8915('0x3c')];}_0x42b1d2[_0x8915('0x2d')](_0x15f1d4)[_0x8915('0x3d')](_0x2e55c0);};}exports[_0x8915('0x3e')]=function(_0xa04761,_0x5e7a61){var _0x1cb7da={'include':[{'model':db[_0x8915('0x3f')],'as':_0x8915('0x40')}]},_0x4caed3={},_0x764d8a={'count':0x0,'rows':[]};var _0x5f07de=_[_0x8915('0x41')](db['WhatsappAccount']['rawAttributes'],function(_0x2edfc0){return{'name':_0x2edfc0[_0x8915('0x42')],'type':_0x2edfc0[_0x8915('0x43')][_0x8915('0x44')]};});_0x4caed3['model']=_['map'](_0x5f07de,_0x8915('0x3c'));_0x4caed3[_0x8915('0x45')]=_['keys'](_0xa04761[_0x8915('0x45')]);_0x4caed3[_0x8915('0x46')]=_['intersection'](_0x4caed3['model'],_0x4caed3[_0x8915('0x45')]);_0x1cb7da[_0x8915('0x47')]=_['intersection'](_0x4caed3[_0x8915('0x48')],qs['fields'](_0xa04761[_0x8915('0x45')][_0x8915('0x49')]));_0x1cb7da[_0x8915('0x47')]=_0x1cb7da[_0x8915('0x47')][_0x8915('0x4a')]?_0x1cb7da['attributes']:_0x4caed3[_0x8915('0x48')];if(!_0xa04761[_0x8915('0x45')][_0x8915('0x4b')](_0x8915('0x4c'))){_0x1cb7da['limit']=qs[_0x8915('0x31')](_0xa04761[_0x8915('0x45')]['limit']);_0x1cb7da[_0x8915('0x33')]=qs[_0x8915('0x33')](_0xa04761['query']['offset']);}_0x1cb7da[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0xa04761[_0x8915('0x45')][_0x8915('0x4e')]);_0x1cb7da[_0x8915('0x4f')]=qs['filters'](_[_0x8915('0x50')](_0xa04761['query'],_0x4caed3[_0x8915('0x46')]),_0x5f07de);if(_0xa04761[_0x8915('0x45')][_0x8915('0x51')]){_0x1cb7da[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x1cb7da[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x5f07de,function(_0x5b9adc){if(_0x5b9adc[_0x8915('0x43')]!==_0x8915('0x53')){var _0x1f6b36={};_0x1f6b36[_0x5b9adc[_0x8915('0x3c')]]={'$like':'%'+_0xa04761[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x1f6b36;}})});}_0x1cb7da=_[_0x8915('0x52')]({},_0x1cb7da,_0xa04761['options']);var _0x31e2e0={'where':_0x1cb7da[_0x8915('0x4f')]};return db[_0x8915('0x54')][_0x8915('0x32')](_0x31e2e0)[_0x8915('0x37')](function(_0x5672ba){_0x764d8a['count']=_0x5672ba;if(_0xa04761[_0x8915('0x45')][_0x8915('0x55')]){_0x1cb7da['include']=[{'all':!![]}];}return db[_0x8915('0x54')][_0x8915('0x56')](_0x1cb7da);})[_0x8915('0x37')](function(_0x5eab00){_0x764d8a[_0x8915('0x57')]=_0x5eab00;return _0x764d8a;})[_0x8915('0x37')](respondWithFilteredResult(_0x5e7a61,_0x1cb7da))['catch'](handleError(_0x5e7a61,null));};exports[_0x8915('0x58')]=function(_0x235bf7,_0x20c198){var _0x33e91e={'raw':![],'where':{'id':_0x235bf7['params']['id']},'include':[{'model':db[_0x8915('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5a2822={};_0x5a2822['model']=_[_0x8915('0x59')](db[_0x8915('0x54')][_0x8915('0x5a')]);_0x5a2822[_0x8915('0x45')]=_[_0x8915('0x59')](_0x235bf7[_0x8915('0x45')]);_0x5a2822[_0x8915('0x46')]=_[_0x8915('0x5b')](_0x5a2822['model'],_0x5a2822[_0x8915('0x45')]);_0x33e91e[_0x8915('0x47')]=_[_0x8915('0x5b')](_0x5a2822[_0x8915('0x48')],qs[_0x8915('0x49')](_0x235bf7[_0x8915('0x45')][_0x8915('0x49')]));_0x33e91e[_0x8915('0x47')]=_0x33e91e[_0x8915('0x47')][_0x8915('0x4a')]?_0x33e91e[_0x8915('0x47')]:_0x5a2822['model'];if(_0x235bf7['query'][_0x8915('0x55')]){_0x33e91e[_0x8915('0x5c')]=[{'all':!![]}];}_0x33e91e=_[_0x8915('0x52')]({},_0x33e91e,_0x235bf7[_0x8915('0x5d')]);return db[_0x8915('0x54')][_0x8915('0x5e')](_0x33e91e)[_0x8915('0x37')](handleEntityNotFound(_0x20c198,null))[_0x8915('0x37')](respondWithResult(_0x20c198,null))[_0x8915('0x2b')](handleError(_0x20c198,null));};exports[_0x8915('0x5f')]=function(_0x5067dc,_0x26d035){return db['WhatsappAccount']['create'](_0x5067dc['body'],{})[_0x8915('0x37')](function(_0x7f760b){var _0x3b5ef6=_0x5067dc[_0x8915('0x60')][_0x8915('0x38')]({'plain':!![]});if(!_0x3b5ef6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b5ef6[_0x8915('0x61')]===_0x8915('0x60')){var _0x4df730=_0x7f760b[_0x8915('0x38')]({'plain':!![]});var _0x272966=_0x8915('0x62');return db[_0x8915('0x63')][_0x8915('0x5e')]({'where':{'name':_0x272966,'userProfileId':_0x3b5ef6['userProfileId']},'raw':!![]})[_0x8915('0x37')](function(_0x419985){if(_0x419985&&_0x419985[_0x8915('0x64')]===0x0){return db[_0x8915('0x39')][_0x8915('0x5f')]({'name':_0x4df730[_0x8915('0x3c')],'resourceId':_0x4df730['id'],'type':_0x419985[_0x8915('0x3c')],'sectionId':_0x419985['id']},{})[_0x8915('0x37')](function(){return _0x7f760b;});}else{return _0x7f760b;}})['catch'](function(_0x33b88e){logger['error'](_0x8915('0x65'),_0x33b88e);throw _0x33b88e;});}return _0x7f760b;})[_0x8915('0x37')](respondWithResult(_0x26d035,0xc9))['catch'](handleError(_0x26d035,null));};exports[_0x8915('0x36')]=function(_0x29926c,_0x2d1694){if(_0x29926c[_0x8915('0x66')]['id']){delete _0x29926c[_0x8915('0x66')]['id'];}return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x29926c[_0x8915('0x67')]['id']},'include':[{'model':db[_0x8915('0x3f')],'as':_0x8915('0x40')}]})[_0x8915('0x37')](handleEntityNotFound(_0x2d1694,null))['then'](saveUpdates(_0x29926c[_0x8915('0x66')],null))[_0x8915('0x37')](respondWithResult(_0x2d1694,null))[_0x8915('0x2b')](handleError(_0x2d1694,null));};exports['destroy']=function(_0x763454,_0x6c8883){return db[_0x8915('0x54')]['find']({'where':{'id':_0x763454[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x6c8883,null))[_0x8915('0x37')](removeEntity(_0x6c8883,null))[_0x8915('0x2b')](handleError(_0x6c8883,null));};exports[_0x8915('0x68')]=function(_0x2d6021,_0x3bf252){return db[_0x8915('0x54')][_0x8915('0x68')]()[_0x8915('0x37')](respondWithResult(_0x3bf252,null))[_0x8915('0x2b')](handleError(_0x3bf252,null));};exports[_0x8915('0x69')]=function(_0x51f060,_0x4912c1,_0x6fdd9e){if(_0x51f060[_0x8915('0x66')]['id']){delete _0x51f060['body']['id'];}return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x51f060['params']['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x4912c1,null))[_0x8915('0x37')](function(_0x473870){if(_0x473870){_0x51f060[_0x8915('0x66')][_0x8915('0x6a')]=_0x473870['id'];return db[_0x8915('0x6b')][_0x8915('0x5f')](_0x51f060[_0x8915('0x66')]);}})[_0x8915('0x37')](respondWithResult(_0x4912c1,null))[_0x8915('0x2b')](handleError(_0x4912c1,null));};exports[_0x8915('0x6c')]=function(_0x3d0330,_0x305fdf,_0x1fd4cc){var _0x2f1fc8={'raw':![],'where':{}};var _0x830289={};var _0x73aec5={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x3d0330[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x305fdf,null))['then'](function(_0x1d2266){if(_0x1d2266){_0x830289[_0x8915('0x48')]=_[_0x8915('0x59')](db['Disposition'][_0x8915('0x5a')]);_0x830289[_0x8915('0x45')]=_[_0x8915('0x59')](_0x3d0330[_0x8915('0x45')]);_0x830289['filters']=_['intersection'](_0x830289[_0x8915('0x48')],_0x830289[_0x8915('0x45')]);_0x2f1fc8[_0x8915('0x47')]=_['intersection'](_0x830289['model'],qs[_0x8915('0x49')](_0x3d0330['query'][_0x8915('0x49')]));_0x2f1fc8[_0x8915('0x47')]=_0x2f1fc8[_0x8915('0x47')][_0x8915('0x4a')]?_0x2f1fc8[_0x8915('0x47')]:_0x830289[_0x8915('0x48')];if(!_0x3d0330['query']['hasOwnProperty'](_0x8915('0x4c'))){_0x2f1fc8[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x3d0330[_0x8915('0x45')][_0x8915('0x31')]);_0x2f1fc8[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x3d0330['query'][_0x8915('0x33')]);}_0x2f1fc8[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x3d0330[_0x8915('0x45')][_0x8915('0x4e')]);_0x2f1fc8[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x3d0330[_0x8915('0x45')],_0x830289[_0x8915('0x46')]));_0x2f1fc8['where'][_0x8915('0x6a')]=_0x1d2266['id'];if(_0x3d0330[_0x8915('0x45')][_0x8915('0x51')]){_0x2f1fc8[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x2f1fc8[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x2f1fc8[_0x8915('0x47')],function(_0x2fc657){var _0x2a6d83={};_0x2a6d83[_0x2fc657]={'$like':'%'+_0x3d0330[_0x8915('0x45')]['filter']+'%'};return _0x2a6d83;})});}_0x2f1fc8=_['merge']({},_0x2f1fc8,_0x3d0330['options']);return db[_0x8915('0x6b')][_0x8915('0x32')]({'where':_0x2f1fc8['where']})['then'](function(_0x3cd8fb){_0x73aec5[_0x8915('0x32')]=_0x3cd8fb;if(_0x3d0330[_0x8915('0x45')][_0x8915('0x55')]){_0x2f1fc8[_0x8915('0x5c')]=[{'all':!![]}];}return db[_0x8915('0x6b')][_0x8915('0x56')](_0x2f1fc8);})['then'](function(_0x12e496){_0x73aec5[_0x8915('0x57')]=_0x12e496;return _0x73aec5;});}})[_0x8915('0x37')](respondWithFilteredResult(_0x305fdf,_0x2f1fc8))[_0x8915('0x2b')](handleError(_0x305fdf,null));};exports[_0x8915('0x6d')]=function(_0x10efb3,_0x2ea13e,_0x425ca6){return db[_0x8915('0x54')]['find']({'where':{'id':_0x10efb3[_0x8915('0x67')]['id']}})['then'](handleEntityNotFound(_0x2ea13e,null))[_0x8915('0x37')](function(_0x15fcc0){if(_0x15fcc0){return _0x15fcc0[_0x8915('0x6d')](_0x10efb3[_0x8915('0x45')][_0x8915('0x6e')]);}})[_0x8915('0x37')](respondWithStatusCode(_0x2ea13e,null))[_0x8915('0x2b')](handleError(_0x2ea13e,null));};exports[_0x8915('0x6f')]=function(_0x1c6447,_0x3450dd,_0x9b7cfa){if(_0x1c6447[_0x8915('0x66')]['id']){delete _0x1c6447[_0x8915('0x66')]['id'];}return db[_0x8915('0x54')]['find']({'where':{'id':_0x1c6447[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x3450dd,null))[_0x8915('0x37')](function(_0x22beed){if(_0x22beed){_0x1c6447[_0x8915('0x66')][_0x8915('0x6a')]=_0x22beed['id'];return db[_0x8915('0x70')]['create'](_0x1c6447[_0x8915('0x66')]);}})[_0x8915('0x37')](respondWithResult(_0x3450dd,null))[_0x8915('0x2b')](handleError(_0x3450dd,null));};exports['getAnswers']=function(_0x35e769,_0x202075,_0x4cbd38){var _0xdc805d={'raw':![],'where':{}};var _0x48a068={};var _0x4f4f50={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x8915('0x71')]({'where':{'id':_0x35e769[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x202075,null))['then'](function(_0x1deb41){if(_0x1deb41){_0x48a068[_0x8915('0x48')]=_[_0x8915('0x59')](db['CannedAnswer']['rawAttributes']);_0x48a068['query']=_[_0x8915('0x59')](_0x35e769[_0x8915('0x45')]);_0x48a068[_0x8915('0x46')]=_['intersection'](_0x48a068[_0x8915('0x48')],_0x48a068[_0x8915('0x45')]);_0xdc805d['attributes']=_['intersection'](_0x48a068[_0x8915('0x48')],qs[_0x8915('0x49')](_0x35e769[_0x8915('0x45')][_0x8915('0x49')]));_0xdc805d[_0x8915('0x47')]=_0xdc805d[_0x8915('0x47')][_0x8915('0x4a')]?_0xdc805d[_0x8915('0x47')]:_0x48a068[_0x8915('0x48')];if(!_0x35e769[_0x8915('0x45')]['hasOwnProperty'](_0x8915('0x4c'))){_0xdc805d[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x35e769[_0x8915('0x45')][_0x8915('0x31')]);_0xdc805d[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x35e769['query']['offset']);}_0xdc805d[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x35e769['query'][_0x8915('0x4e')]);_0xdc805d[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x35e769[_0x8915('0x45')],_0x48a068[_0x8915('0x46')]));_0xdc805d[_0x8915('0x4f')]['WhatsappAccountId']=_0x1deb41['id'];if(_0x35e769['query'][_0x8915('0x51')]){_0xdc805d[_0x8915('0x4f')]=_[_0x8915('0x52')](_0xdc805d[_0x8915('0x4f')],{'$or':_['map'](_0xdc805d[_0x8915('0x47')],function(_0x1139a4){var _0x38fa7f={};_0x38fa7f[_0x1139a4]={'$like':'%'+_0x35e769[_0x8915('0x45')]['filter']+'%'};return _0x38fa7f;})});}_0xdc805d=_[_0x8915('0x52')]({},_0xdc805d,_0x35e769[_0x8915('0x5d')]);return db[_0x8915('0x70')]['count']({'where':_0xdc805d[_0x8915('0x4f')]})[_0x8915('0x37')](function(_0x2f0a6d){_0x4f4f50[_0x8915('0x32')]=_0x2f0a6d;if(_0x35e769[_0x8915('0x45')][_0x8915('0x55')]){_0xdc805d[_0x8915('0x5c')]=[{'all':!![]}];}return db[_0x8915('0x70')]['findAll'](_0xdc805d);})[_0x8915('0x37')](function(_0x3c169b){_0x4f4f50[_0x8915('0x57')]=_0x3c169b;return _0x4f4f50;});}})['then'](respondWithFilteredResult(_0x202075,_0xdc805d))['catch'](handleError(_0x202075,null));};exports['removeAnswers']=function(_0x3858d7,_0x23dfad,_0x2a1828){return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x3858d7[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x23dfad,null))['then'](function(_0x4127c8){if(_0x4127c8){return _0x4127c8[_0x8915('0x72')](_0x3858d7[_0x8915('0x45')][_0x8915('0x6e')]);}})[_0x8915('0x37')](respondWithStatusCode(_0x23dfad,null))[_0x8915('0x2b')](handleError(_0x23dfad,null));};exports['addAgents']=function(_0x2d0471,_0x5194f2,_0x2d3e5e){return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x2d0471[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x5194f2,null))[_0x8915('0x37')](function(_0x25056f){if(_0x25056f){return _0x25056f['addAgents'](_0x2d0471[_0x8915('0x66')]['ids'],_[_0x8915('0x73')](_0x2d0471[_0x8915('0x66')],[_0x8915('0x6e'),'id'])||{})[_0x8915('0x74')](function(_0x3ba5e8){for(var _0x326463=0x0;_0x326463<_0x2d0471[_0x8915('0x66')][_0x8915('0x6e')][_0x8915('0x4a')];_0x326463+=0x1){socket[_0x8915('0x75')](_0x8915('0x76'),{'UserId':Number(_0x2d0471[_0x8915('0x66')][_0x8915('0x6e')][_0x326463]),'WhatsappAccountId':Number(_0x2d0471[_0x8915('0x67')]['id'])});}return _0x3ba5e8;});}})[_0x8915('0x37')](respondWithResult(_0x5194f2,null))['catch'](handleError(_0x5194f2,null));};exports[_0x8915('0x77')]=function(_0x49a520,_0x1fe13e,_0x2dcab2){return db[_0x8915('0x54')]['find']({'where':{'id':_0x49a520['params']['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x1fe13e,null))['then'](function(_0xffcd81){if(_0xffcd81){return _0xffcd81[_0x8915('0x77')](_0x49a520['query'][_0x8915('0x6e')])[_0x8915('0x37')](function(){if(_[_0x8915('0x78')](_0x49a520['query'][_0x8915('0x6e')])){for(var _0x9a7844=0x0;_0x9a7844<_0x49a520[_0x8915('0x45')][_0x8915('0x6e')][_0x8915('0x4a')];_0x9a7844+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x49a520['query']['ids'][_0x9a7844]),'WhatsappAccountId':Number(_0x49a520[_0x8915('0x67')]['id'])});}}else{socket[_0x8915('0x75')](_0x8915('0x79'),{'UserId':Number(_0x49a520[_0x8915('0x45')][_0x8915('0x6e')]),'WhatsappAccountId':Number(_0x49a520[_0x8915('0x67')]['id'])});}});}})[_0x8915('0x37')](respondWithStatusCode(_0x1fe13e,null))[_0x8915('0x2b')](handleError(_0x1fe13e,null));};exports[_0x8915('0x7a')]=function(_0x24cfad,_0x5e26ff,_0x4df8d6){var _0x32783a={};var _0x253081={};var _0x3d8feb;var _0x5dab30;return db[_0x8915('0x54')][_0x8915('0x71')]({'where':{'id':_0x24cfad[_0x8915('0x67')]['id']}})[_0x8915('0x37')](handleEntityNotFound(_0x5e26ff,null))[_0x8915('0x37')](function(_0x1637c6){if(_0x1637c6){_0x3d8feb=_0x1637c6;_0x253081[_0x8915('0x48')]=_['keys'](db[_0x8915('0x7b')][_0x8915('0x5a')]);_0x253081[_0x8915('0x45')]=_[_0x8915('0x59')](_0x24cfad[_0x8915('0x45')]);_0x253081[_0x8915('0x46')]=_[_0x8915('0x5b')](_0x253081['model'],_0x253081[_0x8915('0x45')]);_0x32783a[_0x8915('0x47')]=_['intersection'](_0x253081[_0x8915('0x48')],qs['fields'](_0x24cfad[_0x8915('0x45')][_0x8915('0x49')]));_0x32783a[_0x8915('0x47')]=_0x32783a['attributes'][_0x8915('0x4a')]?_0x32783a[_0x8915('0x47')]:_0x253081['model'];_0x32783a[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x24cfad[_0x8915('0x45')][_0x8915('0x4e')]);_0x32783a[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x24cfad[_0x8915('0x45')],_0x253081['filters']));if(_0x24cfad[_0x8915('0x45')][_0x8915('0x51')]){_0x32783a[_0x8915('0x4f')]=_[_0x8915('0x52')](_0x32783a['where'],{'$or':_[_0x8915('0x41')](_0x32783a[_0x8915('0x47')],function(_0x32688f){var _0x259c23={};_0x259c23[_0x32688f]={'$like':'%'+_0x24cfad[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x259c23;})});}_0x32783a=_['merge']({},_0x32783a,_0x24cfad['options']);return _0x3d8feb[_0x8915('0x7a')](_0x32783a);}})[_0x8915('0x37')](function(_0x50da3d){if(_0x50da3d){_0x5dab30=_0x50da3d[_0x8915('0x4a')];if(!_0x24cfad['query'][_0x8915('0x4b')](_0x8915('0x4c'))){_0x32783a[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x24cfad[_0x8915('0x45')][_0x8915('0x31')]);_0x32783a[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x24cfad[_0x8915('0x45')][_0x8915('0x33')]);}return _0x3d8feb[_0x8915('0x7a')](_0x32783a);}})[_0x8915('0x37')](function(_0x13af36){if(_0x13af36){return _0x13af36?{'count':_0x5dab30,'rows':_0x13af36}:null;}})[_0x8915('0x37')](respondWithResult(_0x5e26ff,null))[_0x8915('0x2b')](handleError(_0x5e26ff,null));};exports[_0x8915('0x7c')]=function(_0x28e90b,_0x26e748){var _0x59f127=_0x28e90b[_0x8915('0x67')]['id'];var _0x3a1798=_0x28e90b[_0x8915('0x66')];var _0x30c761=0xc8;var _0x224242=null;return db['sequelize'][_0x8915('0x7d')]({'isolationLevel':db[_0x8915('0x7e')][_0x8915('0x7f')][_0x8915('0x80')][_0x8915('0x81')]},function(_0x202ded){return db[_0x8915('0x54')][_0x8915('0x71')]({'where':{'id':_0x59f127},'transaction':_0x202ded})[_0x8915('0x37')](function(_0x2b3b3f){if(_0x2b3b3f){return db[_0x8915('0x82')][_0x8915('0x3a')]({'where':{'WhatsappAccountId':_0x59f127},'transaction':_0x202ded})[_0x8915('0x37')](function(){var _0x4e591e=_[_0x8915('0x41')](_0x3a1798,function(_0x554479){_0x554479['WhatsappAccountId']=_0x59f127;return _0x554479;});return db[_0x8915('0x82')]['bulkCreate'](_0x4e591e,{'transaction':_0x202ded});});}else{_0x30c761=0x194;_0x224242=[];}});})[_0x8915('0x37')](function(){if(_0x30c761!==0x194){return db['WhatsappApplication'][_0x8915('0x83')]({'where':{'WhatsappAccountId':_0x59f127},'order':_0x8915('0x84')})['then'](function(_0x5c4c04){_0x224242=_0x5c4c04;});}})[_0x8915('0x2b')](function(_0x5d2bb9){_0x30c761=0x1f4;logger['error'](_0x5d2bb9[_0x8915('0x3b')]);if(_0x5d2bb9['name']){delete _0x5d2bb9[_0x8915('0x3c')];}_0x224242=_0x5d2bb9;})['finally'](function(){if(_0x224242===null){_0x26e748[_0x8915('0x2c')](_0x30c761);}else{if(_0x30c761===0x1f4){_0x26e748[_0x8915('0x2d')](_0x30c761)[_0x8915('0x3d')](_0x224242);}else{_0x26e748['status'](_0x30c761)[_0x8915('0x2f')](_0x224242);}}});};exports['getApplications']=function(_0x420d2d,_0x28875b,_0x412189){var _0x484a62={};var _0x5063cc={};var _0x4200c3;var _0x4adadc;return db[_0x8915('0x54')]['findOne']({'where':{'id':_0x420d2d[_0x8915('0x67')]['id']}})['then'](handleEntityNotFound(_0x28875b,null))[_0x8915('0x37')](function(_0x2a6c7a){if(_0x2a6c7a){_0x4200c3=_0x2a6c7a;_0x5063cc[_0x8915('0x48')]=_['keys'](db['WhatsappApplication'][_0x8915('0x5a')]);_0x5063cc[_0x8915('0x45')]=_[_0x8915('0x59')](_0x420d2d[_0x8915('0x45')]);_0x5063cc['filters']=_[_0x8915('0x5b')](_0x5063cc[_0x8915('0x48')],_0x5063cc[_0x8915('0x45')]);_0x484a62[_0x8915('0x47')]=_[_0x8915('0x5b')](_0x5063cc['model'],qs[_0x8915('0x49')](_0x420d2d['query']['fields']));_0x484a62['attributes']=_0x484a62[_0x8915('0x47')][_0x8915('0x4a')]?_0x484a62[_0x8915('0x47')]:_0x5063cc[_0x8915('0x48')];_0x484a62[_0x8915('0x4d')]=qs[_0x8915('0x4e')](_0x420d2d[_0x8915('0x45')][_0x8915('0x4e')]);_0x484a62[_0x8915('0x4f')]=qs[_0x8915('0x46')](_[_0x8915('0x50')](_0x420d2d[_0x8915('0x45')],_0x5063cc[_0x8915('0x46')]));if(_0x420d2d[_0x8915('0x45')]['filter']){_0x484a62[_0x8915('0x4f')]=_['merge'](_0x484a62[_0x8915('0x4f')],{'$or':_[_0x8915('0x41')](_0x484a62[_0x8915('0x47')],function(_0x7916c7){var _0x4a7687={};_0x4a7687[_0x7916c7]={'$like':'%'+_0x420d2d[_0x8915('0x45')][_0x8915('0x51')]+'%'};return _0x4a7687;})});}_0x484a62=_['merge']({},_0x484a62,_0x420d2d[_0x8915('0x5d')]);return _0x4200c3['getApplications'](_0x484a62);}})['then'](function(_0x22f9da){if(_0x22f9da){_0x4adadc=_0x22f9da[_0x8915('0x4a')];if(!_0x420d2d['query'][_0x8915('0x4b')](_0x8915('0x4c'))){_0x484a62[_0x8915('0x31')]=qs[_0x8915('0x31')](_0x420d2d[_0x8915('0x45')]['limit']);_0x484a62['offset']=qs[_0x8915('0x33')](_0x420d2d[_0x8915('0x45')]['offset']);}return _0x4200c3['getApplications'](_0x484a62);}})[_0x8915('0x37')](function(_0x5dca0f){if(_0x5dca0f){return _0x5dca0f?{'count':_0x4adadc,'rows':_0x5dca0f}:null;}})['then'](respondWithResult(_0x28875b,null))[_0x8915('0x2b')](handleError(_0x28875b,null));};exports[_0x8915('0x85')]=function(_0x24ec63,_0x5ac0d2,_0x22b227){var _0x212458={'channel':_0x8915('0x86')};var _0x522296=[];var _0x36fccd=[];var _0x4175c1={};return db['WhatsappAccount'][_0x8915('0x5e')]({'where':{'id':_0x24ec63[_0x8915('0x67')]['id']},'include':[{'model':db[_0x8915('0x82')],'as':_0x8915('0x87')}]})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))[_0x8915('0x37')](function(_0x5b2a68){_0x212458['account']=_0x5b2a68;if(_0x212458[_0x8915('0x88')]&&_0x212458[_0x8915('0x88')][_0x8915('0x43')]===_0x8915('0x89')&&_0x24ec63['body'][_0x8915('0x8a')]){if(_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][_0x8915('0x4a')]===0x0)return;if(_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][0x0][_0x8915('0x8b')]!==_0x8915('0x8c'))return;return db[_0x8915('0x8d')][_0x8915('0x36')]({'read':!![],'readAt':_0x24ec63[_0x8915('0x66')]['statuses'][0x0][_0x8915('0x8e')]},{'where':{'messageId':_0x24ec63[_0x8915('0x66')][_0x8915('0x8a')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x5517da){return _0x5ac0d2[_0x8915('0x2d')](0xc8)[_0x8915('0x2f')](_0x5517da);});}_0x212458[_0x8915('0x8f')]=_['orderBy'](_0x5b2a68[_0x8915('0x87')],[_0x8915('0x84')],[_0x8915('0x90')]);if(_0x212458[_0x8915('0x88')][_0x8915('0x87')]){delete _0x212458['account'][_0x8915('0x87')];}return db['CmContact']['describe']()[_0x8915('0x37')](function(_0x218852){if(!_0x218852){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0x93'));}_0x522296=_['difference'](_[_0x8915('0x59')](_0x218852),[_0x8915('0x94'),_0x8915('0x95')]);_0x36fccd=_[_0x8915('0x96')](_[_0x8915('0x59')](_0x218852),['createdAt','updatedAt','CompanyId',_0x8915('0x97')]);_0x212458[_0x8915('0x66')]={'mapKey':_0x8915('0x98')};if(_0x212458[_0x8915('0x88')]&&_0x212458['account'][_0x8915('0x43')]===_0x8915('0x99')){_0x212458['body'][_0x8915('0x9a')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9b')]['replace'](_0x8915('0x9c'),'');_0x212458['body'][_0x8915('0x66')]=_0x24ec63[_0x8915('0x66')]['Body'];_0x212458['body'][_0x8915('0x9d')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9e')];}if(_0x212458[_0x8915('0x88')]&&_0x212458[_0x8915('0x88')][_0x8915('0x43')]==='sinch'){_0x212458[_0x8915('0x66')]['from']=_0x24ec63[_0x8915('0x66')]['notifications'][0x0][_0x8915('0x9a')];_0x212458['body']['body']=_0x24ec63[_0x8915('0x66')][_0x8915('0x9f')][0x0][_0x8915('0x28')][_0x8915('0x66')];_0x212458['body'][_0x8915('0x9d')]=_0x24ec63[_0x8915('0x66')][_0x8915('0x9f')][0x0][_0x8915('0xa0')];}if(_0x212458['body']['id']){delete _0x212458[_0x8915('0x66')]['id'];}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0x9a')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa2'));}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0x66')])||_0x212458['body'][_0x8915('0x66')]===''){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa3'));}if(_[_0x8915('0xa1')](_0x212458[_0x8915('0x66')][_0x8915('0xa4')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa5')+_0x36fccd);}if(!_['includes'](_0x36fccd,_0x212458[_0x8915('0x66')][_0x8915('0xa4')])){throw new db[(_0x8915('0x91'))][(_0x8915('0x92'))](_0x8915('0xa6')+_0x36fccd);}_0x4175c1[_0x212458[_0x8915('0x66')][_0x8915('0xa4')]]=_0x212458['body'][_0x8915('0x9a')];return db[_0x8915('0xa7')][_0x8915('0x5e')]({'where':{'id':_0x212458[_0x8915('0x88')][_0x8915('0x97')]},'include':[{'model':db[_0x8915('0xa8')],'as':_0x8915('0xa9'),'where':_0x4175c1,'limit':0x1,'order':[[_0x8915('0x95'),_0x8915('0xaa')]]}]});})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))['then'](function(_0x4033d6){if(_0x4033d6){_0x212458[_0x8915('0xab')]=_['omit'](_0x4033d6,[_0x8915('0xa9')]);if(_0x4033d6[_0x8915('0xa9')][_0x8915('0x4a')]){return _0x4033d6[_0x8915('0xa9')][0x0];}var _0x4d56c9=_[_0x8915('0x19')](_0x212458[_0x8915('0x66')],{'firstName':_0x212458[_0x8915('0x66')]['from'],'ListId':_0x4033d6['id']});_0x4d56c9[_0x212458[_0x8915('0x66')][_0x8915('0xa4')]]=_0x212458[_0x8915('0x66')]['from'];return db['CmContact'][_0x8915('0x5f')](_0x4d56c9,{'fields':_0x522296,'raw':!![]});}})[_0x8915('0x37')](handleEntityNotFound(_0x5ac0d2,null))[_0x8915('0x37')](function(_0x5303bd){if(_0x5303bd){_0x212458[_0x8915('0xac')]=_0x5303bd;var _0x4e3fe0={'ContactId':_0x5303bd['id'],'phone':_0x212458[_0x8915('0x66')][_0x8915('0x9a')],'WhatsappAccountId':_0x24ec63['params']['id']};var _0x28e9fc={'ContactId':_0x5303bd['id'],'WhatsappAccountId':_0x24ec63['params']['id'],'closed':![]};return db[_0x8915('0xad')][_0x8915('0x5e')]({'where':_0x28e9fc})[_0x8915('0x37')](function(_0x55d145){if(_0x55d145){return[_0x55d145,![]];}return db[_0x8915('0xad')][_0x8915('0x5f')](_0x4e3fe0)[_0x8915('0x37')](function(_0x155ee3){return[_0x155ee3,!![]];});});}})[_0x8915('0x74')](function(_0x373241,_0x193e67){_0x212458[_0x8915('0xae')]=_0x373241[_0x8915('0x38')]({'plain':!![]});_0x212458['interaction'][_0x8915('0xaf')]=![];if(_0x193e67){if(_0x212458[_0x8915('0x88')]['autoclose']){_0x212458[_0x8915('0x8f')][_0x8915('0xb0')]({'id':0x0,'priority':_0x212458[_0x8915('0x8f')]['length']+0x1,'app':_0x8915('0xb1'),'appdata':_0x8915('0xb2'),'interval':_0x8915('0xb3')});}_0x212458['interaction']['created']=!![];}return db['WhatsappMessage'][_0x8915('0x5f')]({'phone':_0x212458[_0x8915('0x66')]['from'],'messageId':_0x212458[_0x8915('0x66')][_0x8915('0x9d')],'body':_0x212458[_0x8915('0x66')]['body'],'WhatsappAccountId':_0x24ec63['params']['id'],'WhatsappInteractionId':_0x373241['id'],'direction':'in','ContactId':_0x373241['ContactId'],'AttachmentId':_0x212458[_0x8915('0x66')][_0x8915('0xb4')]});})[_0x8915('0x37')](function(_0x2de1b1){_0x212458[_0x8915('0x28')]=_0x2de1b1;if(!_0x212458[_0x8915('0xae')][_0x8915('0xb5')])return;return db['User'][_0x8915('0x5e')]({'attributes':['id',_0x8915('0x3c')],'where':{'id':_0x212458[_0x8915('0xae')][_0x8915('0xb5')]}});})[_0x8915('0x37')](function(_0x300a44){if(_0x300a44){_0x212458[_0x8915('0x8f')][_0x8915('0xb6')]({'id':0x0,'priority':0x0,'app':_0x8915('0xb7'),'appdata':_0x300a44[_0x8915('0x3c')]+','+(_0x212458[_0x8915('0x88')][_0x8915('0xb8')]||0xa),'interval':_0x8915('0xb3')});}if(!_0x212458[_0x8915('0xae')][_0x8915('0xb9')])return;return db[_0x8915('0xba')]['find']({'attributes':['id',_0x8915('0x3c')],'where':{'id':_0x212458['interaction'][_0x8915('0xb9')]}});})['then'](function(_0x4453af){if(_0x4453af){_0x212458[_0x8915('0x8f')]['unshift']({'id':0x0,'priority':0x1,'app':_0x8915('0xbb'),'appdata':_0x4453af[_0x8915('0x3c')]+','+(_0x212458['account'][_0x8915('0xbc')]||0x12c),'interval':_0x8915('0xb3')});}return respondWithRpcPromise(_0x8915('0xbd'),_0x8915('0xbe'),_0x212458);})['then'](function(_0x28fbe2){if(_0x28fbe2){var _0x2280d1=0xc8;var _0x5773b6=_0x8915('0xbf');logger['info'](_0x8915('0x23'),_0x5773b6,_0x2280d1,'entity\x20found');logger[_0x8915('0x22')](_0x8915('0xc0'),_0x5773b6,_0x2280d1,'entity\x20found',JSON[_0x8915('0x25')](_0x28fbe2));if(_0x212458[_0x8915('0x88')][_0x8915('0x43')]===_0x8915('0x99')){return _0x5ac0d2[_0x8915('0x2d')](_0x2280d1)[_0x8915('0x34')](_0x8915('0xc1'),_0x8915('0xc2'))[_0x8915('0x3d')](_0x8915('0xc3'));}else{return _0x5ac0d2[_0x8915('0x2d')](_0x2280d1)[_0x8915('0x2f')](_0x28fbe2);}}});})['catch'](handleError(_0x5ac0d2,null));};exports[_0x8915('0x3d')]=function(_0x5c5bdb,_0x11a301,_0x8a1ec3){var _0x581acb,_0x3edf64,_0x4d23ed;if(_[_0x8915('0xa1')](_0x5c5bdb[_0x8915('0x66')][_0x8915('0x66')])||_0x5c5bdb[_0x8915('0x66')]['body']===''){throw new db['Sequelize'][(_0x8915('0x92'))](_0x8915('0xa3'));}if(_['isNil'](_0x5c5bdb[_0x8915('0x66')]['to'])){throw new db[(_0x8915('0x91'))]['ValidationError'](_0x8915('0xc4'));}_0x581acb=_0x5c5bdb[_0x8915('0x66')]['to'];return db[_0x8915('0x54')][_0x8915('0x5e')]({'where':{'id':_0x5c5bdb[_0x8915('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x8915('0xc5'),'include':[{'model':db[_0x8915('0xa8')],'as':'Contacts','where':{'mobile':_0x581acb},'limit':0x1,'order':[[_0x8915('0x95'),'DESC']]}]}]})[_0x8915('0x37')](handleEntityNotFound(_0x11a301,null))['then'](function(_0x2cabf6){if(_0x2cabf6&&_0x2cabf6[_0x8915('0xc5')]){_0x3edf64=_0x2cabf6['get']({'plain':!![]});if(_0x3edf64[_0x8915('0xc5')]&&_0x3edf64['List'][_0x8915('0xa9')]['length']){return _0x3edf64['List'][_0x8915('0xa9')][0x0];}return db[_0x8915('0xa8')][_0x8915('0x5f')](_[_0x8915('0x19')](_0x5c5bdb['body'],{'firstName':_0x581acb,'mobile':_0x581acb,'phone':_0x581acb,'ListId':_0x3edf64[_0x8915('0x97')]}));}})[_0x8915('0x37')](handleEntityNotFound(_0x11a301,null))[_0x8915('0x37')](function(_0x33ef59){if(_0x33ef59){_0x4d23ed=_0x33ef59;return db[_0x8915('0xad')][_0x8915('0x5e')]({'where':{'ContactId':_0x4d23ed['id'],'closed':![],'WhatsappAccountId':_0x3edf64['id']}})[_0x8915('0x37')](function(_0x172a09){if(_0x172a09){return[_0x172a09,![]];}return db[_0x8915('0xad')][_0x8915('0x5f')]({'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id'],'WhatsappAccountId':_0x3edf64['id'],'phone':_0x581acb,'firstMsgDirection':_0x8915('0xc6'),'Messages':[_[_0x8915('0x52')](_0x5c5bdb['body'],{'read':![],'body':_0x5c5bdb[_0x8915('0x66')][_0x8915('0x66')],'phone':_0x581acb,'WhatsappAccountId':_0x3edf64['id'],'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id']})]},{'include':[{'model':db[_0x8915('0x8d')],'as':'Messages'}]})[_0x8915('0x37')](function(_0x4d464c){return[_0x4d464c,!![]];});});}})['spread'](function(_0x1abd5a,_0x1dd96f){if(_0x1dd96f){return _0x1abd5a;}return db[_0x8915('0x8d')]['create'](_[_0x8915('0x52')](_0x5c5bdb['body'],{'read':![],'body':_0x5c5bdb['body']['body'],'phone':_0x581acb,'WhatsappAccountId':_0x3edf64['id'],'WhatsappInteractionId':_0x1abd5a['id'],'UserId':_0x5c5bdb[_0x8915('0x60')]['id'],'ContactId':_0x4d23ed['id']}))[_0x8915('0x37')](function(_0x1a7a56){_0x1abd5a[_0x8915('0xc7')]['Messages']=[];_0x1abd5a['dataValues'][_0x8915('0xc8')][_0x8915('0xb0')](_0x1a7a56['dataValues']);return _0x1abd5a;});})[_0x8915('0x37')](respondWithResult(_0x11a301,null))[_0x8915('0x2b')](handleError(_0x11a301,null));}; \ No newline at end of file +var _0xd1fb=['then','info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','get','UserProfileResource','destroy','sendStatus','stack','name','mandatoryDispositionPause','map','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','type','WhatsappAccount','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','find','body','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','update','timestamp','message_id','applications','orderBy','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','replace','whatsapp:','notifications','messageId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','mapKey','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','request'];(function(_0x300a6f,_0x31a761){var _0x2219dd=function(_0x260cc4){while(--_0x260cc4){_0x300a6f['push'](_0x300a6f['shift']());}};_0x2219dd(++_0x31a761);}(_0xd1fb,0xa2));var _0xbd1f=function(_0x40899e,_0x3528b0){_0x40899e=_0x40899e-0x0;var _0x5881de=_0xd1fb[_0x40899e];return _0x5881de;};'use strict';var emlformat=require(_0xbd1f('0x0'));var rimraf=require(_0xbd1f('0x1'));var zipdir=require(_0xbd1f('0x2'));var jsonpatch=require(_0xbd1f('0x3'));var rp=require(_0xbd1f('0x4'));var moment=require(_0xbd1f('0x5'));var BPromise=require(_0xbd1f('0x6'));var Mustache=require(_0xbd1f('0x7'));var util=require(_0xbd1f('0x8'));var path=require(_0xbd1f('0x9'));var sox=require('sox');var csv=require(_0xbd1f('0xa'));var ejs=require(_0xbd1f('0xb'));var fs=require('fs');var fs_extra=require(_0xbd1f('0xc'));var _=require(_0xbd1f('0xd'));var squel=require(_0xbd1f('0xe'));var crypto=require(_0xbd1f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbd1f('0x10'));var toCsv=require(_0xbd1f('0xa'));var querystring=require(_0xbd1f('0x11'));var Papa=require(_0xbd1f('0x12'));var Redis=require(_0xbd1f('0x13'));var authService=require(_0xbd1f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd1f('0x15'));var logger=require(_0xbd1f('0x16'))(_0xbd1f('0x17'));var utils=require(_0xbd1f('0x18'));var config=require(_0xbd1f('0x19'));var licenseUtil=require(_0xbd1f('0x1a'));var db=require(_0xbd1f('0x1b'))['db'];config[_0xbd1f('0x1c')]=_[_0xbd1f('0x1d')](config[_0xbd1f('0x1c')],{'host':_0xbd1f('0x1e'),'port':0x18eb});var socket=require(_0xbd1f('0x1f'))(new Redis(config[_0xbd1f('0x1c')]));require(_0xbd1f('0x20'))[_0xbd1f('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xbd1f('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x1c7c53,_0x15c665,_0x56aa03,_0x452931){return new BPromise(function(_0x382251,_0x2c3c17){var _0x1253a0=_0x452931||client;return _0x1253a0[_0xbd1f('0x23')](_0x1c7c53,_0x56aa03)[_0xbd1f('0x24')](function(_0xb8d98f){logger[_0xbd1f('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x15c665,_0xbd1f('0x26'));logger[_0xbd1f('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x15c665,_0xbd1f('0x26'),JSON[_0xbd1f('0x28')](_0xb8d98f));if(_0xb8d98f[_0xbd1f('0x29')]){if(_0xb8d98f['error'][_0xbd1f('0x2a')]===0x1f4){logger[_0xbd1f('0x29')](_0xbd1f('0x2b'),_0x15c665,_0xb8d98f['error'][_0xbd1f('0x2c')]);return _0x2c3c17(_0xb8d98f['error'][_0xbd1f('0x2c')]);}logger['error'](_0xbd1f('0x2b'),_0x15c665,_0xb8d98f['error'][_0xbd1f('0x2c')]);return _0x382251(_0xb8d98f[_0xbd1f('0x29')][_0xbd1f('0x2c')]);}else{logger['info'](_0xbd1f('0x2b'),_0x15c665,_0xbd1f('0x26'));_0x382251(_0xb8d98f[_0xbd1f('0x2d')]['message']);}})[_0xbd1f('0x2e')](function(_0x4d9dc8){logger['error'](_0xbd1f('0x2b'),_0x15c665,_0x4d9dc8);_0x2c3c17(_0x4d9dc8);});});}function respondWithStatusCode(_0x479673,_0x5ee48b){_0x5ee48b=_0x5ee48b||0xcc;return function(_0x268548){if(_0x268548){return _0x479673['sendStatus'](_0x5ee48b);}return _0x479673['status'](_0x5ee48b)[_0xbd1f('0x2f')]();};}function respondWithResult(_0x448224,_0x3dd7d0){_0x3dd7d0=_0x3dd7d0||0xc8;return function(_0x121865){if(_0x121865){return _0x448224[_0xbd1f('0x30')](_0x3dd7d0)[_0xbd1f('0x31')](_0x121865);}};}function respondWithFilteredResult(_0x1a0ac5,_0x32f8e6){return function(_0x1c9525){if(_0x1c9525){var _0x47f7b7=typeof _0x32f8e6['offset']===_0xbd1f('0x32')&&typeof _0x32f8e6[_0xbd1f('0x33')]===_0xbd1f('0x32');var _0xcc0ea4=_0x1c9525[_0xbd1f('0x34')];var _0x5ae5c8=_0x47f7b7?0x0:_0x32f8e6[_0xbd1f('0x35')];var _0x318e4c=_0x47f7b7?_0x1c9525[_0xbd1f('0x34')]:_0x32f8e6[_0xbd1f('0x35')]+_0x32f8e6[_0xbd1f('0x33')];var _0x4884bd;if(_0x318e4c>=_0xcc0ea4){_0x318e4c=_0xcc0ea4;_0x4884bd=0xc8;}else{_0x4884bd=0xce;}_0x1a0ac5[_0xbd1f('0x30')](_0x4884bd);return _0x1a0ac5[_0xbd1f('0x36')](_0xbd1f('0x37'),_0x5ae5c8+'-'+_0x318e4c+'/'+_0xcc0ea4)[_0xbd1f('0x31')](_0x1c9525);}return null;};}function patchUpdates(_0x5c0b32){return function(_0x1c2ece){try{jsonpatch[_0xbd1f('0x38')](_0x1c2ece,_0x5c0b32,!![]);}catch(_0x17d96a){return BPromise[_0xbd1f('0x39')](_0x17d96a);}return _0x1c2ece[_0xbd1f('0x3a')]();};}function saveUpdates(_0x3e120e,_0x491b09){return function(_0x1fe6bc){if(_0x1fe6bc){return _0x1fe6bc['update'](_0x3e120e)[_0xbd1f('0x24')](function(_0x16ddd5){return _0x16ddd5;});}return null;};}function removeEntity(_0x3232cc,_0x46509f){return function(_0x385a1d){if(_0x385a1d){return _0x385a1d['destroy']()[_0xbd1f('0x24')](function(){var _0x5b1cfb=_0x385a1d[_0xbd1f('0x3b')]({'plain':!![]});var _0x5405ef='WhatsappAccounts';return db[_0xbd1f('0x3c')][_0xbd1f('0x3d')]({'where':{'type':_0x5405ef,'resourceId':_0x5b1cfb['id']}})['then'](function(){return _0x385a1d;});})[_0xbd1f('0x24')](function(){_0x3232cc['status'](0xcc)[_0xbd1f('0x2f')]();});}};}function handleEntityNotFound(_0x64fc7b,_0x273ffa){return function(_0x7452b4){if(!_0x7452b4){_0x64fc7b[_0xbd1f('0x3e')](0x194);}return _0x7452b4;};}function handleError(_0x3c0d29,_0x3a6fec){_0x3a6fec=_0x3a6fec||0x1f4;return function(_0x4667a7){logger[_0xbd1f('0x29')](_0x4667a7[_0xbd1f('0x3f')]);if(_0x4667a7[_0xbd1f('0x40')]){delete _0x4667a7[_0xbd1f('0x40')];}_0x3c0d29[_0xbd1f('0x30')](_0x3a6fec)['send'](_0x4667a7);};}exports['index']=function(_0x2ea7cc,_0x8ff3ec){var _0x3b7391={'include':[{'model':db['Pause'],'as':_0xbd1f('0x41')}]},_0x4ad0dc={},_0x3593b5={'count':0x0,'rows':[]};var _0x2a9c8d=_[_0xbd1f('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0x4cbdad){return{'name':_0x4cbdad['fieldName'],'type':_0x4cbdad['type']['key']};});_0x4ad0dc[_0xbd1f('0x43')]=_[_0xbd1f('0x42')](_0x2a9c8d,_0xbd1f('0x40'));_0x4ad0dc['query']=_['keys'](_0x2ea7cc[_0xbd1f('0x44')]);_0x4ad0dc['filters']=_[_0xbd1f('0x45')](_0x4ad0dc['model'],_0x4ad0dc['query']);_0x3b7391[_0xbd1f('0x46')]=_[_0xbd1f('0x45')](_0x4ad0dc['model'],qs['fields'](_0x2ea7cc['query'][_0xbd1f('0x47')]));_0x3b7391[_0xbd1f('0x46')]=_0x3b7391[_0xbd1f('0x46')][_0xbd1f('0x48')]?_0x3b7391[_0xbd1f('0x46')]:_0x4ad0dc['model'];if(!_0x2ea7cc[_0xbd1f('0x44')][_0xbd1f('0x49')](_0xbd1f('0x4a'))){_0x3b7391[_0xbd1f('0x33')]=qs[_0xbd1f('0x33')](_0x2ea7cc[_0xbd1f('0x44')][_0xbd1f('0x33')]);_0x3b7391[_0xbd1f('0x35')]=qs['offset'](_0x2ea7cc[_0xbd1f('0x44')][_0xbd1f('0x35')]);}_0x3b7391['order']=qs['sort'](_0x2ea7cc[_0xbd1f('0x44')]['sort']);_0x3b7391[_0xbd1f('0x4b')]=qs[_0xbd1f('0x4c')](_[_0xbd1f('0x4d')](_0x2ea7cc[_0xbd1f('0x44')],_0x4ad0dc[_0xbd1f('0x4c')]),_0x2a9c8d);if(_0x2ea7cc[_0xbd1f('0x44')][_0xbd1f('0x4e')]){_0x3b7391[_0xbd1f('0x4b')]=_[_0xbd1f('0x4f')](_0x3b7391[_0xbd1f('0x4b')],{'$or':_[_0xbd1f('0x42')](_0x2a9c8d,function(_0x7b90b5){if(_0x7b90b5[_0xbd1f('0x50')]!=='VIRTUAL'){var _0x2409cd={};_0x2409cd[_0x7b90b5[_0xbd1f('0x40')]]={'$like':'%'+_0x2ea7cc['query']['filter']+'%'};return _0x2409cd;}})});}_0x3b7391=_['merge']({},_0x3b7391,_0x2ea7cc['options']);var _0x24b59c={'where':_0x3b7391[_0xbd1f('0x4b')]};return db[_0xbd1f('0x51')][_0xbd1f('0x34')](_0x24b59c)['then'](function(_0x1cf7a9){_0x3593b5[_0xbd1f('0x34')]=_0x1cf7a9;if(_0x2ea7cc[_0xbd1f('0x44')][_0xbd1f('0x52')]){_0x3b7391[_0xbd1f('0x53')]=[{'all':!![]}];}return db[_0xbd1f('0x51')][_0xbd1f('0x54')](_0x3b7391);})[_0xbd1f('0x24')](function(_0x50e3ff){_0x3593b5[_0xbd1f('0x55')]=_0x50e3ff;return _0x3593b5;})[_0xbd1f('0x24')](respondWithFilteredResult(_0x8ff3ec,_0x3b7391))[_0xbd1f('0x2e')](handleError(_0x8ff3ec,null));};exports[_0xbd1f('0x56')]=function(_0x4dc9af,_0x4f7318){var _0x2230e7={'raw':![],'where':{'id':_0x4dc9af[_0xbd1f('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xbd1f('0x41')}]},_0x4e8d0b={};_0x4e8d0b[_0xbd1f('0x43')]=_[_0xbd1f('0x58')](db[_0xbd1f('0x51')][_0xbd1f('0x59')]);_0x4e8d0b[_0xbd1f('0x44')]=_[_0xbd1f('0x58')](_0x4dc9af[_0xbd1f('0x44')]);_0x4e8d0b[_0xbd1f('0x4c')]=_['intersection'](_0x4e8d0b[_0xbd1f('0x43')],_0x4e8d0b[_0xbd1f('0x44')]);_0x2230e7[_0xbd1f('0x46')]=_[_0xbd1f('0x45')](_0x4e8d0b[_0xbd1f('0x43')],qs['fields'](_0x4dc9af[_0xbd1f('0x44')][_0xbd1f('0x47')]));_0x2230e7[_0xbd1f('0x46')]=_0x2230e7[_0xbd1f('0x46')][_0xbd1f('0x48')]?_0x2230e7[_0xbd1f('0x46')]:_0x4e8d0b[_0xbd1f('0x43')];if(_0x4dc9af[_0xbd1f('0x44')][_0xbd1f('0x52')]){_0x2230e7['include']=[{'all':!![]}];}_0x2230e7=_[_0xbd1f('0x4f')]({},_0x2230e7,_0x4dc9af[_0xbd1f('0x5a')]);return db[_0xbd1f('0x51')][_0xbd1f('0x5b')](_0x2230e7)['then'](handleEntityNotFound(_0x4f7318,null))['then'](respondWithResult(_0x4f7318,null))[_0xbd1f('0x2e')](handleError(_0x4f7318,null));};exports['create']=function(_0x1e6c86,_0x284f55){return db[_0xbd1f('0x51')]['create'](_0x1e6c86[_0xbd1f('0x5c')],{})[_0xbd1f('0x24')](function(_0x597b5b){var _0x5644fb=_0x1e6c86[_0xbd1f('0x5d')][_0xbd1f('0x3b')]({'plain':!![]});if(!_0x5644fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5644fb[_0xbd1f('0x5e')]==='user'){var _0x570121=_0x597b5b[_0xbd1f('0x3b')]({'plain':!![]});var _0x14fdf7='WhatsappAccounts';return db['UserProfileSection'][_0xbd1f('0x5b')]({'where':{'name':_0x14fdf7,'userProfileId':_0x5644fb[_0xbd1f('0x5f')]},'raw':!![]})[_0xbd1f('0x24')](function(_0x4af647){if(_0x4af647&&_0x4af647[_0xbd1f('0x60')]===0x0){return db[_0xbd1f('0x3c')][_0xbd1f('0x61')]({'name':_0x570121[_0xbd1f('0x40')],'resourceId':_0x570121['id'],'type':_0x4af647[_0xbd1f('0x40')],'sectionId':_0x4af647['id']},{})[_0xbd1f('0x24')](function(){return _0x597b5b;});}else{return _0x597b5b;}})['catch'](function(_0x3d9038){logger[_0xbd1f('0x29')](_0xbd1f('0x62'),_0x3d9038);throw _0x3d9038;});}return _0x597b5b;})[_0xbd1f('0x24')](respondWithResult(_0x284f55,0xc9))[_0xbd1f('0x2e')](handleError(_0x284f55,null));};exports['update']=function(_0x59606a,_0x501511){if(_0x59606a['body']['id']){delete _0x59606a[_0xbd1f('0x5c')]['id'];}return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x59606a['params']['id']},'include':[{'model':db['Pause'],'as':_0xbd1f('0x41')}]})['then'](handleEntityNotFound(_0x501511,null))[_0xbd1f('0x24')](saveUpdates(_0x59606a[_0xbd1f('0x5c')],null))[_0xbd1f('0x24')](respondWithResult(_0x501511,null))[_0xbd1f('0x2e')](handleError(_0x501511,null));};exports['destroy']=function(_0x1cf187,_0x39ab83){return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x1cf187[_0xbd1f('0x57')]['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x39ab83,null))['then'](removeEntity(_0x39ab83,null))[_0xbd1f('0x2e')](handleError(_0x39ab83,null));};exports[_0xbd1f('0x63')]=function(_0x334bef,_0x4c6a0d){return db[_0xbd1f('0x51')][_0xbd1f('0x63')]()[_0xbd1f('0x24')](respondWithResult(_0x4c6a0d,null))[_0xbd1f('0x2e')](handleError(_0x4c6a0d,null));};exports[_0xbd1f('0x64')]=function(_0x2405b8,_0x1ab0b6,_0x22d9fa){if(_0x2405b8[_0xbd1f('0x5c')]['id']){delete _0x2405b8[_0xbd1f('0x5c')]['id'];}return db['WhatsappAccount'][_0xbd1f('0x5b')]({'where':{'id':_0x2405b8[_0xbd1f('0x57')]['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x1ab0b6,null))['then'](function(_0x275b69){if(_0x275b69){_0x2405b8['body'][_0xbd1f('0x65')]=_0x275b69['id'];return db[_0xbd1f('0x66')][_0xbd1f('0x61')](_0x2405b8['body']);}})['then'](respondWithResult(_0x1ab0b6,null))[_0xbd1f('0x2e')](handleError(_0x1ab0b6,null));};exports[_0xbd1f('0x67')]=function(_0x148f80,_0x1f3db8,_0x4c4a82){var _0x930547={'raw':![],'where':{}};var _0x24a8f1={};var _0x24315f={'count':0x0,'rows':[]};return db[_0xbd1f('0x51')]['findOne']({'where':{'id':_0x148f80[_0xbd1f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1f3db8,null))[_0xbd1f('0x24')](function(_0x995ae8){if(_0x995ae8){_0x24a8f1['model']=_[_0xbd1f('0x58')](db[_0xbd1f('0x66')][_0xbd1f('0x59')]);_0x24a8f1[_0xbd1f('0x44')]=_[_0xbd1f('0x58')](_0x148f80[_0xbd1f('0x44')]);_0x24a8f1['filters']=_['intersection'](_0x24a8f1[_0xbd1f('0x43')],_0x24a8f1[_0xbd1f('0x44')]);_0x930547['attributes']=_[_0xbd1f('0x45')](_0x24a8f1[_0xbd1f('0x43')],qs['fields'](_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x47')]));_0x930547[_0xbd1f('0x46')]=_0x930547[_0xbd1f('0x46')][_0xbd1f('0x48')]?_0x930547[_0xbd1f('0x46')]:_0x24a8f1['model'];if(!_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x49')](_0xbd1f('0x4a'))){_0x930547[_0xbd1f('0x33')]=qs['limit'](_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x33')]);_0x930547[_0xbd1f('0x35')]=qs[_0xbd1f('0x35')](_0x148f80['query'][_0xbd1f('0x35')]);}_0x930547['order']=qs[_0xbd1f('0x68')](_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x68')]);_0x930547[_0xbd1f('0x4b')]=qs[_0xbd1f('0x4c')](_[_0xbd1f('0x4d')](_0x148f80['query'],_0x24a8f1[_0xbd1f('0x4c')]));_0x930547[_0xbd1f('0x4b')][_0xbd1f('0x65')]=_0x995ae8['id'];if(_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x4e')]){_0x930547[_0xbd1f('0x4b')]=_[_0xbd1f('0x4f')](_0x930547[_0xbd1f('0x4b')],{'$or':_['map'](_0x930547[_0xbd1f('0x46')],function(_0x58828a){var _0x1a2b11={};_0x1a2b11[_0x58828a]={'$like':'%'+_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x4e')]+'%'};return _0x1a2b11;})});}_0x930547=_[_0xbd1f('0x4f')]({},_0x930547,_0x148f80[_0xbd1f('0x5a')]);return db['Disposition']['count']({'where':_0x930547['where']})[_0xbd1f('0x24')](function(_0x40d082){_0x24315f['count']=_0x40d082;if(_0x148f80[_0xbd1f('0x44')][_0xbd1f('0x52')]){_0x930547[_0xbd1f('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xbd1f('0x54')](_0x930547);})[_0xbd1f('0x24')](function(_0x23b28f){_0x24315f[_0xbd1f('0x55')]=_0x23b28f;return _0x24315f;});}})['then'](respondWithFilteredResult(_0x1f3db8,_0x930547))[_0xbd1f('0x2e')](handleError(_0x1f3db8,null));};exports['removeDispositions']=function(_0x7f7684,_0x2e956a,_0xb7e0c4){return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x7f7684[_0xbd1f('0x57')]['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x2e956a,null))[_0xbd1f('0x24')](function(_0xa448c2){if(_0xa448c2){return _0xa448c2[_0xbd1f('0x69')](_0x7f7684[_0xbd1f('0x44')][_0xbd1f('0x6a')]);}})[_0xbd1f('0x24')](respondWithStatusCode(_0x2e956a,null))[_0xbd1f('0x2e')](handleError(_0x2e956a,null));};exports[_0xbd1f('0x6b')]=function(_0x3d4000,_0x578393,_0x256ee1){if(_0x3d4000[_0xbd1f('0x5c')]['id']){delete _0x3d4000[_0xbd1f('0x5c')]['id'];}return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x3d4000[_0xbd1f('0x57')]['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x578393,null))[_0xbd1f('0x24')](function(_0x4dcbee){if(_0x4dcbee){_0x3d4000[_0xbd1f('0x5c')][_0xbd1f('0x65')]=_0x4dcbee['id'];return db[_0xbd1f('0x6c')][_0xbd1f('0x61')](_0x3d4000[_0xbd1f('0x5c')]);}})[_0xbd1f('0x24')](respondWithResult(_0x578393,null))[_0xbd1f('0x2e')](handleError(_0x578393,null));};exports[_0xbd1f('0x6d')]=function(_0x5e8b8e,_0x10ca1f,_0x245224){var _0x59015a={'raw':![],'where':{}};var _0x3a2f04={};var _0x3213e1={'count':0x0,'rows':[]};return db[_0xbd1f('0x51')][_0xbd1f('0x6e')]({'where':{'id':_0x5e8b8e[_0xbd1f('0x57')]['id']}})['then'](handleEntityNotFound(_0x10ca1f,null))[_0xbd1f('0x24')](function(_0x13950a){if(_0x13950a){_0x3a2f04[_0xbd1f('0x43')]=_[_0xbd1f('0x58')](db[_0xbd1f('0x6c')][_0xbd1f('0x59')]);_0x3a2f04[_0xbd1f('0x44')]=_[_0xbd1f('0x58')](_0x5e8b8e[_0xbd1f('0x44')]);_0x3a2f04['filters']=_[_0xbd1f('0x45')](_0x3a2f04[_0xbd1f('0x43')],_0x3a2f04[_0xbd1f('0x44')]);_0x59015a[_0xbd1f('0x46')]=_[_0xbd1f('0x45')](_0x3a2f04[_0xbd1f('0x43')],qs[_0xbd1f('0x47')](_0x5e8b8e[_0xbd1f('0x44')]['fields']));_0x59015a[_0xbd1f('0x46')]=_0x59015a[_0xbd1f('0x46')]['length']?_0x59015a[_0xbd1f('0x46')]:_0x3a2f04[_0xbd1f('0x43')];if(!_0x5e8b8e['query'][_0xbd1f('0x49')](_0xbd1f('0x4a'))){_0x59015a[_0xbd1f('0x33')]=qs[_0xbd1f('0x33')](_0x5e8b8e[_0xbd1f('0x44')][_0xbd1f('0x33')]);_0x59015a['offset']=qs['offset'](_0x5e8b8e[_0xbd1f('0x44')][_0xbd1f('0x35')]);}_0x59015a[_0xbd1f('0x6f')]=qs[_0xbd1f('0x68')](_0x5e8b8e[_0xbd1f('0x44')][_0xbd1f('0x68')]);_0x59015a['where']=qs[_0xbd1f('0x4c')](_[_0xbd1f('0x4d')](_0x5e8b8e[_0xbd1f('0x44')],_0x3a2f04[_0xbd1f('0x4c')]));_0x59015a['where'][_0xbd1f('0x65')]=_0x13950a['id'];if(_0x5e8b8e[_0xbd1f('0x44')][_0xbd1f('0x4e')]){_0x59015a[_0xbd1f('0x4b')]=_[_0xbd1f('0x4f')](_0x59015a[_0xbd1f('0x4b')],{'$or':_['map'](_0x59015a[_0xbd1f('0x46')],function(_0x335a10){var _0x1b9c6d={};_0x1b9c6d[_0x335a10]={'$like':'%'+_0x5e8b8e['query'][_0xbd1f('0x4e')]+'%'};return _0x1b9c6d;})});}_0x59015a=_[_0xbd1f('0x4f')]({},_0x59015a,_0x5e8b8e['options']);return db[_0xbd1f('0x6c')][_0xbd1f('0x34')]({'where':_0x59015a[_0xbd1f('0x4b')]})[_0xbd1f('0x24')](function(_0x21b38c){_0x3213e1[_0xbd1f('0x34')]=_0x21b38c;if(_0x5e8b8e[_0xbd1f('0x44')][_0xbd1f('0x52')]){_0x59015a[_0xbd1f('0x53')]=[{'all':!![]}];}return db[_0xbd1f('0x6c')][_0xbd1f('0x54')](_0x59015a);})['then'](function(_0x3ba7ef){_0x3213e1['rows']=_0x3ba7ef;return _0x3213e1;});}})[_0xbd1f('0x24')](respondWithFilteredResult(_0x10ca1f,_0x59015a))['catch'](handleError(_0x10ca1f,null));};exports[_0xbd1f('0x70')]=function(_0x5e7e04,_0x301f65,_0x3094b8){return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x5e7e04['params']['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x301f65,null))['then'](function(_0x420b20){if(_0x420b20){return _0x420b20[_0xbd1f('0x70')](_0x5e7e04['query']['ids']);}})[_0xbd1f('0x24')](respondWithStatusCode(_0x301f65,null))['catch'](handleError(_0x301f65,null));};exports[_0xbd1f('0x71')]=function(_0x21b155,_0xa55a3a,_0x4f74f6){return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x21b155['params']['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0xa55a3a,null))[_0xbd1f('0x24')](function(_0x21b08c){if(_0x21b08c){return _0x21b08c[_0xbd1f('0x71')](_0x21b155[_0xbd1f('0x5c')][_0xbd1f('0x6a')],_[_0xbd1f('0x72')](_0x21b155[_0xbd1f('0x5c')],[_0xbd1f('0x6a'),'id'])||{})[_0xbd1f('0x73')](function(_0x5f3cf3){for(var _0xfba769=0x0;_0xfba769<_0x21b155[_0xbd1f('0x5c')][_0xbd1f('0x6a')][_0xbd1f('0x48')];_0xfba769+=0x1){socket[_0xbd1f('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x21b155[_0xbd1f('0x5c')][_0xbd1f('0x6a')][_0xfba769]),'WhatsappAccountId':Number(_0x21b155[_0xbd1f('0x57')]['id'])});}return _0x5f3cf3;});}})['then'](respondWithResult(_0xa55a3a,null))['catch'](handleError(_0xa55a3a,null));};exports['removeAgents']=function(_0x418ae4,_0x879a13,_0x3ac6b0){return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x418ae4[_0xbd1f('0x57')]['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x879a13,null))[_0xbd1f('0x24')](function(_0x272289){if(_0x272289){return _0x272289[_0xbd1f('0x75')](_0x418ae4[_0xbd1f('0x44')][_0xbd1f('0x6a')])[_0xbd1f('0x24')](function(){if(_[_0xbd1f('0x76')](_0x418ae4[_0xbd1f('0x44')][_0xbd1f('0x6a')])){for(var _0x52771c=0x0;_0x52771c<_0x418ae4[_0xbd1f('0x44')][_0xbd1f('0x6a')]['length'];_0x52771c+=0x1){socket[_0xbd1f('0x74')](_0xbd1f('0x77'),{'UserId':Number(_0x418ae4['query'][_0xbd1f('0x6a')][_0x52771c]),'WhatsappAccountId':Number(_0x418ae4[_0xbd1f('0x57')]['id'])});}}else{socket[_0xbd1f('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x418ae4[_0xbd1f('0x44')]['ids']),'WhatsappAccountId':Number(_0x418ae4[_0xbd1f('0x57')]['id'])});}});}})[_0xbd1f('0x24')](respondWithStatusCode(_0x879a13,null))['catch'](handleError(_0x879a13,null));};exports[_0xbd1f('0x78')]=function(_0x859570,_0x4ada58,_0x12cd58){var _0x504f5e={};var _0x56ab8f={};var _0x57ac24;var _0x10d245;return db[_0xbd1f('0x51')][_0xbd1f('0x6e')]({'where':{'id':_0x859570[_0xbd1f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4ada58,null))[_0xbd1f('0x24')](function(_0x3fc73a){if(_0x3fc73a){_0x57ac24=_0x3fc73a;_0x56ab8f[_0xbd1f('0x43')]=_['keys'](db[_0xbd1f('0x79')][_0xbd1f('0x59')]);_0x56ab8f[_0xbd1f('0x44')]=_[_0xbd1f('0x58')](_0x859570[_0xbd1f('0x44')]);_0x56ab8f[_0xbd1f('0x4c')]=_[_0xbd1f('0x45')](_0x56ab8f['model'],_0x56ab8f['query']);_0x504f5e[_0xbd1f('0x46')]=_[_0xbd1f('0x45')](_0x56ab8f[_0xbd1f('0x43')],qs['fields'](_0x859570['query'][_0xbd1f('0x47')]));_0x504f5e[_0xbd1f('0x46')]=_0x504f5e[_0xbd1f('0x46')]['length']?_0x504f5e['attributes']:_0x56ab8f[_0xbd1f('0x43')];_0x504f5e[_0xbd1f('0x6f')]=qs[_0xbd1f('0x68')](_0x859570[_0xbd1f('0x44')][_0xbd1f('0x68')]);_0x504f5e[_0xbd1f('0x4b')]=qs[_0xbd1f('0x4c')](_[_0xbd1f('0x4d')](_0x859570[_0xbd1f('0x44')],_0x56ab8f['filters']));if(_0x859570[_0xbd1f('0x44')][_0xbd1f('0x4e')]){_0x504f5e[_0xbd1f('0x4b')]=_['merge'](_0x504f5e['where'],{'$or':_[_0xbd1f('0x42')](_0x504f5e[_0xbd1f('0x46')],function(_0x70742f){var _0x360719={};_0x360719[_0x70742f]={'$like':'%'+_0x859570['query'][_0xbd1f('0x4e')]+'%'};return _0x360719;})});}_0x504f5e=_[_0xbd1f('0x4f')]({},_0x504f5e,_0x859570[_0xbd1f('0x5a')]);return _0x57ac24['getAgents'](_0x504f5e);}})[_0xbd1f('0x24')](function(_0x5409f0){if(_0x5409f0){_0x10d245=_0x5409f0['length'];if(!_0x859570['query'][_0xbd1f('0x49')](_0xbd1f('0x4a'))){_0x504f5e[_0xbd1f('0x33')]=qs[_0xbd1f('0x33')](_0x859570[_0xbd1f('0x44')]['limit']);_0x504f5e[_0xbd1f('0x35')]=qs[_0xbd1f('0x35')](_0x859570[_0xbd1f('0x44')][_0xbd1f('0x35')]);}return _0x57ac24[_0xbd1f('0x78')](_0x504f5e);}})[_0xbd1f('0x24')](function(_0x410d38){if(_0x410d38){return _0x410d38?{'count':_0x10d245,'rows':_0x410d38}:null;}})[_0xbd1f('0x24')](respondWithResult(_0x4ada58,null))[_0xbd1f('0x2e')](handleError(_0x4ada58,null));};exports[_0xbd1f('0x7a')]=function(_0x1e07cd,_0x222b4f){var _0x245113=_0x1e07cd[_0xbd1f('0x57')]['id'];var _0x1e44c5=_0x1e07cd['body'];var _0x7c3f4d=0xc8;var _0x25c3b8=null;return db[_0xbd1f('0x7b')]['transaction']({'isolationLevel':db[_0xbd1f('0x7b')]['Transaction'][_0xbd1f('0x7c')]['READ_COMMITTED']},function(_0x10c02c){return db[_0xbd1f('0x51')]['findOne']({'where':{'id':_0x245113},'transaction':_0x10c02c})[_0xbd1f('0x24')](function(_0x365065){if(_0x365065){return db[_0xbd1f('0x7d')][_0xbd1f('0x3d')]({'where':{'WhatsappAccountId':_0x245113},'transaction':_0x10c02c})[_0xbd1f('0x24')](function(){var _0x4b6bf5=_[_0xbd1f('0x42')](_0x1e44c5,function(_0x2c3a56){_0x2c3a56[_0xbd1f('0x65')]=_0x245113;return _0x2c3a56;});return db['WhatsappApplication'][_0xbd1f('0x7e')](_0x4b6bf5,{'transaction':_0x10c02c});});}else{_0x7c3f4d=0x194;_0x25c3b8=[];}});})['then'](function(){if(_0x7c3f4d!==0x194){return db[_0xbd1f('0x7d')][_0xbd1f('0x7f')]({'where':{'WhatsappAccountId':_0x245113},'order':_0xbd1f('0x80')})[_0xbd1f('0x24')](function(_0x270941){_0x25c3b8=_0x270941;});}})[_0xbd1f('0x2e')](function(_0x5cd712){_0x7c3f4d=0x1f4;logger[_0xbd1f('0x29')](_0x5cd712['stack']);if(_0x5cd712[_0xbd1f('0x40')]){delete _0x5cd712[_0xbd1f('0x40')];}_0x25c3b8=_0x5cd712;})[_0xbd1f('0x81')](function(){if(_0x25c3b8===null){_0x222b4f[_0xbd1f('0x3e')](_0x7c3f4d);}else{if(_0x7c3f4d===0x1f4){_0x222b4f['status'](_0x7c3f4d)[_0xbd1f('0x82')](_0x25c3b8);}else{_0x222b4f[_0xbd1f('0x30')](_0x7c3f4d)[_0xbd1f('0x31')](_0x25c3b8);}}});};exports[_0xbd1f('0x83')]=function(_0x45a746,_0x4d1405,_0xd77af2){var _0x3238f9={};var _0x3515f8={};var _0x4a26c0;var _0x133ad7;return db[_0xbd1f('0x51')][_0xbd1f('0x6e')]({'where':{'id':_0x45a746['params']['id']}})[_0xbd1f('0x24')](handleEntityNotFound(_0x4d1405,null))[_0xbd1f('0x24')](function(_0x22e402){if(_0x22e402){_0x4a26c0=_0x22e402;_0x3515f8[_0xbd1f('0x43')]=_[_0xbd1f('0x58')](db[_0xbd1f('0x7d')][_0xbd1f('0x59')]);_0x3515f8[_0xbd1f('0x44')]=_[_0xbd1f('0x58')](_0x45a746[_0xbd1f('0x44')]);_0x3515f8[_0xbd1f('0x4c')]=_[_0xbd1f('0x45')](_0x3515f8[_0xbd1f('0x43')],_0x3515f8['query']);_0x3238f9[_0xbd1f('0x46')]=_[_0xbd1f('0x45')](_0x3515f8[_0xbd1f('0x43')],qs['fields'](_0x45a746['query']['fields']));_0x3238f9[_0xbd1f('0x46')]=_0x3238f9[_0xbd1f('0x46')]['length']?_0x3238f9['attributes']:_0x3515f8[_0xbd1f('0x43')];_0x3238f9[_0xbd1f('0x6f')]=qs[_0xbd1f('0x68')](_0x45a746['query'][_0xbd1f('0x68')]);_0x3238f9['where']=qs[_0xbd1f('0x4c')](_['pick'](_0x45a746['query'],_0x3515f8[_0xbd1f('0x4c')]));if(_0x45a746[_0xbd1f('0x44')][_0xbd1f('0x4e')]){_0x3238f9[_0xbd1f('0x4b')]=_['merge'](_0x3238f9[_0xbd1f('0x4b')],{'$or':_[_0xbd1f('0x42')](_0x3238f9[_0xbd1f('0x46')],function(_0x474a51){var _0x29f570={};_0x29f570[_0x474a51]={'$like':'%'+_0x45a746[_0xbd1f('0x44')][_0xbd1f('0x4e')]+'%'};return _0x29f570;})});}_0x3238f9=_[_0xbd1f('0x4f')]({},_0x3238f9,_0x45a746[_0xbd1f('0x5a')]);return _0x4a26c0['getApplications'](_0x3238f9);}})[_0xbd1f('0x24')](function(_0x55967e){if(_0x55967e){_0x133ad7=_0x55967e['length'];if(!_0x45a746[_0xbd1f('0x44')][_0xbd1f('0x49')](_0xbd1f('0x4a'))){_0x3238f9[_0xbd1f('0x33')]=qs['limit'](_0x45a746['query'][_0xbd1f('0x33')]);_0x3238f9[_0xbd1f('0x35')]=qs[_0xbd1f('0x35')](_0x45a746[_0xbd1f('0x44')]['offset']);}return _0x4a26c0[_0xbd1f('0x83')](_0x3238f9);}})['then'](function(_0x586bc7){if(_0x586bc7){return _0x586bc7?{'count':_0x133ad7,'rows':_0x586bc7}:null;}})[_0xbd1f('0x24')](respondWithResult(_0x4d1405,null))[_0xbd1f('0x2e')](handleError(_0x4d1405,null));};exports[_0xbd1f('0x84')]=function(_0x4ab6d9,_0x4a5e2c,_0x19a7b7){var _0x3df9fa={'channel':'whatsapp'};var _0x3471b8=[];var _0x4470c2=[];var _0x35d4b9={};return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x4ab6d9[_0xbd1f('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xbd1f('0x85')}]})[_0xbd1f('0x24')](handleEntityNotFound(_0x4a5e2c,null))['then'](function(_0x57b99d){_0x3df9fa['account']=_0x57b99d;if(_0x3df9fa[_0xbd1f('0x86')]&&_0x3df9fa[_0xbd1f('0x86')][_0xbd1f('0x50')]==='sinch'&&_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x87')]){if(_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x87')]['length']===0x0)return;if(_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x87')][0x0][_0xbd1f('0x88')]!==_0xbd1f('0x89'))return;return db[_0xbd1f('0x8a')][_0xbd1f('0x8b')]({'read':!![],'readAt':_0x4ab6d9['body'][_0xbd1f('0x87')][0x0][_0xbd1f('0x8c')]},{'where':{'messageId':_0x4ab6d9['body']['statuses'][0x0][_0xbd1f('0x8d')]},'individualHooks':!![]})[_0xbd1f('0x24')](function(_0x28140e){return _0x4a5e2c[_0xbd1f('0x30')](0xc8)[_0xbd1f('0x31')](_0x28140e);});}_0x3df9fa[_0xbd1f('0x8e')]=_[_0xbd1f('0x8f')](_0x57b99d['Applications'],[_0xbd1f('0x80')],[_0xbd1f('0x90')]);if(_0x3df9fa['account'][_0xbd1f('0x85')]){delete _0x3df9fa[_0xbd1f('0x86')][_0xbd1f('0x85')];}return db['CmContact']['describe']()['then'](function(_0x2310c1){if(!_0x2310c1){throw new db['Sequelize'][(_0xbd1f('0x91'))](_0xbd1f('0x92'));}_0x3471b8=_[_0xbd1f('0x93')](_[_0xbd1f('0x58')](_0x2310c1),[_0xbd1f('0x94'),_0xbd1f('0x95')]);_0x4470c2=_['difference'](_[_0xbd1f('0x58')](_0x2310c1),[_0xbd1f('0x94'),_0xbd1f('0x95'),'CompanyId',_0xbd1f('0x96')]);_0x3df9fa[_0xbd1f('0x5c')]={'mapKey':_0xbd1f('0x97')};if(_0x3df9fa['account']&&_0x3df9fa[_0xbd1f('0x86')]['type']===_0xbd1f('0x98')){_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x99')]=_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x9a')][_0xbd1f('0x9b')](_0xbd1f('0x9c'),'');_0x3df9fa[_0xbd1f('0x5c')]['body']=_0x4ab6d9[_0xbd1f('0x5c')]['Body'];_0x3df9fa['body']['messageId']=_0x4ab6d9[_0xbd1f('0x5c')]['MessageSid'];}if(_0x3df9fa[_0xbd1f('0x86')]&&_0x3df9fa[_0xbd1f('0x86')]['type']==='sinch'){_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x99')]=_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x9d')][0x0]['from'];_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x5c')]=_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x9d')][0x0]['message'][_0xbd1f('0x5c')];_0x3df9fa['body'][_0xbd1f('0x9e')]=_0x4ab6d9[_0xbd1f('0x5c')][_0xbd1f('0x9d')][0x0][_0xbd1f('0x8d')];}if(_0x3df9fa[_0xbd1f('0x5c')]['id']){delete _0x3df9fa[_0xbd1f('0x5c')]['id'];}if(_[_0xbd1f('0x9f')](_0x3df9fa['body'][_0xbd1f('0x99')])){throw new db[(_0xbd1f('0xa0'))]['ValidationError'](_0xbd1f('0xa1'));}if(_[_0xbd1f('0x9f')](_0x3df9fa[_0xbd1f('0x5c')]['body'])||_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x5c')]===''){throw new db[(_0xbd1f('0xa0'))][(_0xbd1f('0x91'))](_0xbd1f('0xa2'));}if(_[_0xbd1f('0x9f')](_0x3df9fa[_0xbd1f('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0xbd1f('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4470c2);}if(!_[_0xbd1f('0xa3')](_0x4470c2,_0x3df9fa[_0xbd1f('0x5c')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xbd1f('0xa4')+_0x4470c2);}_0x35d4b9[_0x3df9fa[_0xbd1f('0x5c')]['mapKey']]=_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x99')];return db[_0xbd1f('0xa5')][_0xbd1f('0x5b')]({'where':{'id':_0x3df9fa[_0xbd1f('0x86')][_0xbd1f('0x96')]},'include':[{'model':db[_0xbd1f('0xa6')],'as':_0xbd1f('0xa7'),'where':_0x35d4b9,'limit':0x1,'order':[[_0xbd1f('0x95'),_0xbd1f('0xa8')]]}]});})[_0xbd1f('0x24')](handleEntityNotFound(_0x4a5e2c,null))[_0xbd1f('0x24')](function(_0x2cf61c){if(_0x2cf61c){_0x3df9fa[_0xbd1f('0xa9')]=_[_0xbd1f('0x72')](_0x2cf61c,[_0xbd1f('0xa7')]);if(_0x2cf61c['Contacts'][_0xbd1f('0x48')]){return _0x2cf61c[_0xbd1f('0xa7')][0x0];}var _0x240de1=_[_0xbd1f('0x1d')](_0x3df9fa[_0xbd1f('0x5c')],{'firstName':_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x99')],'ListId':_0x2cf61c['id']});_0x240de1[_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0xaa')]]=_0x3df9fa[_0xbd1f('0x5c')]['from'];return db[_0xbd1f('0xa6')][_0xbd1f('0x61')](_0x240de1,{'fields':_0x3471b8,'raw':!![]});}})[_0xbd1f('0x24')](handleEntityNotFound(_0x4a5e2c,null))[_0xbd1f('0x24')](function(_0xcd5721){if(_0xcd5721){_0x3df9fa[_0xbd1f('0xab')]=_0xcd5721;var _0x46144e={'ContactId':_0xcd5721['id'],'phone':_0x3df9fa[_0xbd1f('0x5c')]['from'],'WhatsappAccountId':_0x4ab6d9['params']['id']};var _0x21b345={'ContactId':_0xcd5721['id'],'WhatsappAccountId':_0x4ab6d9[_0xbd1f('0x57')]['id'],'closed':![]};return db[_0xbd1f('0xac')][_0xbd1f('0x5b')]({'where':_0x21b345})[_0xbd1f('0x24')](function(_0x2bc5da){if(_0x2bc5da){return[_0x2bc5da,![]];}return db[_0xbd1f('0xac')][_0xbd1f('0x61')](_0x46144e)[_0xbd1f('0x24')](function(_0x3e333e){return[_0x3e333e,!![]];});});}})[_0xbd1f('0x73')](function(_0x558787,_0x57b151){_0x3df9fa[_0xbd1f('0xad')]=_0x558787[_0xbd1f('0x3b')]({'plain':!![]});_0x3df9fa[_0xbd1f('0xad')][_0xbd1f('0xae')]=![];if(_0x57b151){if(_0x3df9fa[_0xbd1f('0x86')][_0xbd1f('0xaf')]){_0x3df9fa[_0xbd1f('0x8e')][_0xbd1f('0xb0')]({'id':0x0,'priority':_0x3df9fa[_0xbd1f('0x8e')]['length']+0x1,'app':'close','appdata':_0xbd1f('0xb1'),'interval':_0xbd1f('0xb2')});}_0x3df9fa[_0xbd1f('0xad')][_0xbd1f('0xae')]=!![];}return db[_0xbd1f('0x8a')][_0xbd1f('0x61')]({'phone':_0x3df9fa['body'][_0xbd1f('0x99')],'messageId':_0x3df9fa['body']['messageId'],'body':_0x3df9fa[_0xbd1f('0x5c')][_0xbd1f('0x5c')],'WhatsappAccountId':_0x4ab6d9[_0xbd1f('0x57')]['id'],'WhatsappInteractionId':_0x558787['id'],'direction':'in','ContactId':_0x558787[_0xbd1f('0xb3')],'AttachmentId':_0x3df9fa[_0xbd1f('0x5c')]['AttachmentId']});})[_0xbd1f('0x24')](function(_0x50d43d){_0x3df9fa[_0xbd1f('0x2c')]=_0x50d43d;if(!_0x3df9fa[_0xbd1f('0xad')][_0xbd1f('0xb4')])return;return db[_0xbd1f('0x79')]['find']({'attributes':['id',_0xbd1f('0x40')],'where':{'id':_0x3df9fa[_0xbd1f('0xad')][_0xbd1f('0xb4')]}});})[_0xbd1f('0x24')](function(_0x517243){if(_0x517243){_0x3df9fa[_0xbd1f('0x8e')][_0xbd1f('0xb5')]({'id':0x0,'priority':0x0,'app':_0xbd1f('0xb6'),'appdata':_0x517243[_0xbd1f('0x40')]+','+(_0x3df9fa[_0xbd1f('0x86')]['waitForTheAssignedAgent']||0xa),'interval':_0xbd1f('0xb2')});}if(!_0x3df9fa['interaction']['queueId'])return;return db[_0xbd1f('0xb7')]['find']({'attributes':['id',_0xbd1f('0x40')],'where':{'id':_0x3df9fa[_0xbd1f('0xad')]['queueId']}});})[_0xbd1f('0x24')](function(_0x27360e){if(_0x27360e){_0x3df9fa[_0xbd1f('0x8e')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbd1f('0xb8'),'appdata':_0x27360e[_0xbd1f('0x40')]+','+(_0x3df9fa[_0xbd1f('0x86')][_0xbd1f('0xb9')]||0x12c),'interval':_0xbd1f('0xb2')});}return respondWithRpcPromise(_0xbd1f('0xba'),'startRouting',_0x3df9fa);})[_0xbd1f('0x24')](function(_0x481270){if(_0x481270){var _0x55aa1c=0xc8;var _0x14f43d=_0xbd1f('0xbb');logger[_0xbd1f('0x25')](_0xbd1f('0xbc'),_0x14f43d,_0x55aa1c,_0xbd1f('0xbd'));logger[_0xbd1f('0x27')](_0xbd1f('0xbe'),_0x14f43d,_0x55aa1c,'entity\x20found',JSON[_0xbd1f('0x28')](_0x481270));if(_0x3df9fa[_0xbd1f('0x86')]['type']==='twilio'){return _0x4a5e2c[_0xbd1f('0x30')](_0x55aa1c)[_0xbd1f('0x36')]('Content-Type',_0xbd1f('0xbf'))[_0xbd1f('0x82')](_0xbd1f('0xc0'));}else{return _0x4a5e2c[_0xbd1f('0x30')](_0x55aa1c)['json'](_0x481270);}}});})[_0xbd1f('0x2e')](handleError(_0x4a5e2c,null));};exports[_0xbd1f('0x82')]=function(_0x48d839,_0x3bde4d,_0x4ec7f9){var _0x11f24d,_0x286f14,_0x3c1d4d;if(_[_0xbd1f('0x9f')](_0x48d839[_0xbd1f('0x5c')][_0xbd1f('0x5c')])||_0x48d839[_0xbd1f('0x5c')][_0xbd1f('0x5c')]===''){throw new db[(_0xbd1f('0xa0'))][(_0xbd1f('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbd1f('0x9f')](_0x48d839['body']['to'])){throw new db[(_0xbd1f('0xa0'))][(_0xbd1f('0x91'))](_0xbd1f('0xc1'));}_0x11f24d=_0x48d839[_0xbd1f('0x5c')]['to'];return db[_0xbd1f('0x51')][_0xbd1f('0x5b')]({'where':{'id':_0x48d839[_0xbd1f('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xbd1f('0xc2'),'include':[{'model':db[_0xbd1f('0xa6')],'as':'Contacts','where':{'mobile':_0x11f24d},'limit':0x1,'order':[[_0xbd1f('0x95'),'DESC']]}]}]})[_0xbd1f('0x24')](handleEntityNotFound(_0x3bde4d,null))['then'](function(_0xffdcbc){if(_0xffdcbc&&_0xffdcbc[_0xbd1f('0xc2')]){_0x286f14=_0xffdcbc[_0xbd1f('0x3b')]({'plain':!![]});if(_0x286f14['List']&&_0x286f14[_0xbd1f('0xc2')][_0xbd1f('0xa7')][_0xbd1f('0x48')]){return _0x286f14[_0xbd1f('0xc2')][_0xbd1f('0xa7')][0x0];}return db[_0xbd1f('0xa6')][_0xbd1f('0x61')](_['defaults'](_0x48d839[_0xbd1f('0x5c')],{'firstName':_0x11f24d,'mobile':_0x11f24d,'phone':_0x11f24d,'ListId':_0x286f14[_0xbd1f('0x96')]}));}})[_0xbd1f('0x24')](handleEntityNotFound(_0x3bde4d,null))[_0xbd1f('0x24')](function(_0x497887){if(_0x497887){_0x3c1d4d=_0x497887;return db[_0xbd1f('0xac')][_0xbd1f('0x5b')]({'where':{'ContactId':_0x3c1d4d['id'],'closed':![],'WhatsappAccountId':_0x286f14['id']}})[_0xbd1f('0x24')](function(_0x258bf7){if(_0x258bf7){return[_0x258bf7,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x48d839[_0xbd1f('0x5d')]['id'],'ContactId':_0x3c1d4d['id'],'WhatsappAccountId':_0x286f14['id'],'phone':_0x11f24d,'firstMsgDirection':_0xbd1f('0xc3'),'Messages':[_[_0xbd1f('0x4f')](_0x48d839[_0xbd1f('0x5c')],{'read':![],'body':_0x48d839[_0xbd1f('0x5c')][_0xbd1f('0x5c')],'phone':_0x11f24d,'WhatsappAccountId':_0x286f14['id'],'UserId':_0x48d839[_0xbd1f('0x5d')]['id'],'ContactId':_0x3c1d4d['id']})]},{'include':[{'model':db[_0xbd1f('0x8a')],'as':_0xbd1f('0xc4')}]})[_0xbd1f('0x24')](function(_0x1dca7e){return[_0x1dca7e,!![]];});});}})['spread'](function(_0x1131ce,_0x10a52c){if(_0x10a52c){return _0x1131ce;}return db[_0xbd1f('0x8a')][_0xbd1f('0x61')](_[_0xbd1f('0x4f')](_0x48d839['body'],{'read':![],'body':_0x48d839[_0xbd1f('0x5c')][_0xbd1f('0x5c')],'phone':_0x11f24d,'WhatsappAccountId':_0x286f14['id'],'WhatsappInteractionId':_0x1131ce['id'],'UserId':_0x48d839['user']['id'],'ContactId':_0x3c1d4d['id']}))[_0xbd1f('0x24')](function(_0xd55137){_0x1131ce[_0xbd1f('0xc5')]['Messages']=[];_0x1131ce['dataValues'][_0xbd1f('0xc4')]['push'](_0xd55137['dataValues']);return _0x1131ce;});})[_0xbd1f('0x24')](respondWithResult(_0x3bde4d,null))[_0xbd1f('0x2e')](handleError(_0x3bde4d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 90618fc..78c4e80 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 _0xf697=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xf697,0x1c7));var _0x7f69=function(_0x4cd00b,_0x483633){_0x4cd00b=_0x4cd00b-0x0;var _0x488623=_0xf697[_0x4cd00b];return _0x488623;};'use strict';var EventEmitter=require(_0x7f69('0x0'));var WhatsappAccount=require(_0x7f69('0x1'))['db'][_0x7f69('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7f69('0x3')](0x0);var events={'afterCreate':_0x7f69('0x4'),'afterUpdate':_0x7f69('0x5'),'afterDestroy':_0x7f69('0x6')};function emitEvent(_0x21b103){return function(_0x4bf7a3,_0x3bfbe5,_0x38f049){WhatsappAccountEvents[_0x7f69('0x7')](_0x21b103+':'+_0x4bf7a3['id'],_0x4bf7a3);WhatsappAccountEvents[_0x7f69('0x7')](_0x21b103,_0x4bf7a3);_0x38f049(null);};}for(var e in events){if(events[_0x7f69('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xa899=['update','remove','emit','hasOwnProperty','hook','events','WhatsappAccount','save'];(function(_0x1d17b3,_0x2b5c6c){var _0x15dc5c=function(_0x45ed34){while(--_0x45ed34){_0x1d17b3['push'](_0x1d17b3['shift']());}};_0x15dc5c(++_0x2b5c6c);}(_0xa899,0xa5));var _0x9a89=function(_0x51cc1d,_0xaa88ae){_0x51cc1d=_0x51cc1d-0x0;var _0x2eb9f2=_0xa899[_0x51cc1d];return _0x2eb9f2;};'use strict';var EventEmitter=require(_0x9a89('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x9a89('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a89('0x2'),'afterUpdate':_0x9a89('0x3'),'afterDestroy':_0x9a89('0x4')};function emitEvent(_0x18777f){return function(_0x5754e3,_0x453c82,_0x485245){WhatsappAccountEvents[_0x9a89('0x5')](_0x18777f+':'+_0x5754e3['id'],_0x5754e3);WhatsappAccountEvents['emit'](_0x18777f,_0x5754e3);_0x485245(null);};}for(var e in events){if(events[_0x9a89('0x6')](e)){var event=events[e];WhatsappAccount[_0x9a89('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5c546fb..a2327f1 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 _0x572f=['util','api','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x572f,0x15d));var _0xf572=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x572f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf572('0x0'));var util=require(_0xf572('0x1'));var logger=require('../../config/logger')(_0xf572('0x2'));var moment=require('moment');var BPromise=require(_0xf572('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf572('0x4'));var rimraf=require(_0xf572('0x5'));var config=require(_0xf572('0x6'));var attributes=require(_0xf572('0x7'));module[_0xf572('0x8')]=function(_0x29b816,_0x52bb75){return _0x29b816['define']('WhatsappAccount',attributes,{'tableName':_0xf572('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13a3=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5e2ba1,_0x89ff9){var _0x5bc2dc=function(_0x5c668b){while(--_0x5c668b){_0x5e2ba1['push'](_0x5e2ba1['shift']());}};_0x5bc2dc(++_0x89ff9);}(_0x13a3,0x1d6));var _0x313a=function(_0x3a2064,_0x21430e){_0x3a2064=_0x3a2064-0x0;var _0x3a1253=_0x13a3[_0x3a2064];return _0x3a1253;};'use strict';var _=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var logger=require('../../config/logger')(_0x313a('0x2'));var moment=require(_0x313a('0x3'));var BPromise=require(_0x313a('0x4'));var rp=require(_0x313a('0x5'));var fs=require('fs');var path=require(_0x313a('0x6'));var rimraf=require(_0x313a('0x7'));var config=require(_0x313a('0x8'));var attributes=require(_0x313a('0x9'));module[_0x313a('0xa')]=function(_0x302dd9,_0x53c722){return _0x302dd9[_0x313a('0xb')](_0x313a('0xc'),attributes,{'tableName':_0x313a('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 6771212..5803fa6 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 _0xaa35=['code','message','info','result','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x4d9952,_0x53c3d1){var _0x18c159=function(_0x4a42ad){while(--_0x4a42ad){_0x4d9952['push'](_0x4d9952['shift']());}};_0x18c159(++_0x53c3d1);}(_0xaa35,0x112));var _0x5aa3=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xaa35[_0x36f47c];return _0x296c55;};'use strict';var _=require(_0x5aa3('0x0'));var util=require('util');var moment=require(_0x5aa3('0x1'));var BPromise=require('bluebird');var rs=require(_0x5aa3('0x2'));var fs=require('fs');var Redis=require(_0x5aa3('0x3'));var db=require(_0x5aa3('0x4'))['db'];var utils=require(_0x5aa3('0x5'));var logger=require('../../config/logger')(_0x5aa3('0x6'));var config=require(_0x5aa3('0x7'));var jayson=require(_0x5aa3('0x8'));var client=jayson[_0x5aa3('0x9')][_0x5aa3('0xa')]({'port':0x232a});config[_0x5aa3('0xb')]=_[_0x5aa3('0xc')](config[_0x5aa3('0xb')],{'host':_0x5aa3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5aa3('0xb')]));require(_0x5aa3('0xe'))['register'](socket);function respondWithRpcPromise(_0xeaea5e,_0x4e94cd,_0x4d1b51){return new BPromise(function(_0x2cc5f7,_0x3b7697){return client[_0x5aa3('0xf')](_0xeaea5e,_0x4d1b51)[_0x5aa3('0x10')](function(_0x5d5b2d){logger['info'](_0x5aa3('0x11'),_0x4e94cd,_0x5aa3('0x12'));logger[_0x5aa3('0x13')](_0x5aa3('0x14'),_0x4e94cd,_0x5aa3('0x12'),JSON['stringify'](_0x5d5b2d));if(_0x5d5b2d[_0x5aa3('0x15')]){if(_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x16')]===0x1f4){logger['error'](_0x5aa3('0x11'),_0x4e94cd,_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x17')]);return _0x3b7697(_0x5d5b2d[_0x5aa3('0x15')]['message']);}logger[_0x5aa3('0x15')](_0x5aa3('0x11'),_0x4e94cd,_0x5d5b2d['error'][_0x5aa3('0x17')]);return _0x2cc5f7(_0x5d5b2d[_0x5aa3('0x15')][_0x5aa3('0x17')]);}else{logger[_0x5aa3('0x18')](_0x5aa3('0x11'),_0x4e94cd,_0x5aa3('0x12'));_0x2cc5f7(_0x5d5b2d[_0x5aa3('0x19')][_0x5aa3('0x17')]);}})['catch'](function(_0x4d1dd2){logger[_0x5aa3('0x15')](_0x5aa3('0x11'),_0x4e94cd,_0x4d1dd2);_0x3b7697(_0x4d1dd2);});});}exports[_0x5aa3('0x1a')]=function(_0x40a8bf){var _0x433106=this;return new Promise(function(_0x1bf9cf,_0x4574bc){return db[_0x5aa3('0x1b')][_0x5aa3('0x1c')]({'raw':_0x40a8bf[_0x5aa3('0x1d')]?_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x1e')]===undefined?!![]:![]:!![],'where':_0x40a8bf[_0x5aa3('0x1d')]?_0x40a8bf['options'][_0x5aa3('0x1f')]||null:null,'attributes':_0x40a8bf['options']?_0x40a8bf['options'][_0x5aa3('0x20')]||null:null,'include':_0x40a8bf['options']?_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x40a8bf[_0x5aa3('0x1d')][_0x5aa3('0x21')],function(_0x46af2e){return{'model':db[_0x46af2e[_0x5aa3('0x23')]],'as':_0x46af2e['as'],'attributes':_0x46af2e[_0x5aa3('0x20')],'include':_0x46af2e[_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x46af2e[_0x5aa3('0x21')],function(_0x72fd68){return{'model':db[_0x72fd68[_0x5aa3('0x23')]],'as':_0x72fd68['as'],'attributes':_0x72fd68[_0x5aa3('0x20')],'include':_0x72fd68[_0x5aa3('0x21')]?_[_0x5aa3('0x22')](_0x72fd68[_0x5aa3('0x21')],function(_0x4a1706){return{'model':db[_0x4a1706[_0x5aa3('0x23')]],'as':_0x4a1706['as'],'attributes':_0x4a1706['attributes']};}):[]};}):[]};}):[]:[]})[_0x5aa3('0x10')](function(_0x2cedf2){logger[_0x5aa3('0x18')](_0x5aa3('0x1a'),_0x40a8bf);logger[_0x5aa3('0x13')](_0x5aa3('0x1a'),_0x40a8bf,JSON[_0x5aa3('0x24')](_0x2cedf2));_0x1bf9cf(_0x2cedf2);})['catch'](function(_0x59e8ae){logger['error'](_0x5aa3('0x1a'),_0x59e8ae['message'],_0x40a8bf);_0x4574bc(_0x433106[_0x5aa3('0x15')](0x1f4,_0x59e8ae[_0x5aa3('0x17')]));});});}; \ No newline at end of file +var _0x7831=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','options','raw','attributes','include','map','model'];(function(_0x1af1e1,_0x37bc24){var _0x5f3450=function(_0x1dc6fd){while(--_0x1dc6fd){_0x1af1e1['push'](_0x1af1e1['shift']());}};_0x5f3450(++_0x37bc24);}(_0x7831,0x1ba));var _0x1783=function(_0x1986a5,_0x1e7081){_0x1986a5=_0x1986a5-0x0;var _0x5a46f8=_0x7831[_0x1986a5];return _0x5a46f8;};'use strict';var _=require(_0x1783('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1783('0x1'));var rs=require(_0x1783('0x2'));var fs=require('fs');var Redis=require(_0x1783('0x3'));var db=require(_0x1783('0x4'))['db'];var utils=require(_0x1783('0x5'));var logger=require(_0x1783('0x6'))('rpc');var config=require(_0x1783('0x7'));var jayson=require(_0x1783('0x8'));var client=jayson[_0x1783('0x9')][_0x1783('0xa')]({'port':0x232a});config[_0x1783('0xb')]=_[_0x1783('0xc')](config['redis'],{'host':_0x1783('0xd'),'port':0x18eb});var socket=require(_0x1783('0xe'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x1783('0xf')](socket);function respondWithRpcPromise(_0x54dcf7,_0x494921,_0x3432d3){return new BPromise(function(_0x144eaf,_0x2142bb){return client[_0x1783('0x10')](_0x54dcf7,_0x3432d3)[_0x1783('0x11')](function(_0x273447){logger[_0x1783('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x494921,_0x1783('0x13'));logger['debug'](_0x1783('0x14'),_0x494921,_0x1783('0x13'),JSON[_0x1783('0x15')](_0x273447));if(_0x273447[_0x1783('0x16')]){if(_0x273447[_0x1783('0x16')][_0x1783('0x17')]===0x1f4){logger[_0x1783('0x16')](_0x1783('0x18'),_0x494921,_0x273447[_0x1783('0x16')]['message']);return _0x2142bb(_0x273447['error'][_0x1783('0x19')]);}logger[_0x1783('0x16')](_0x1783('0x18'),_0x494921,_0x273447[_0x1783('0x16')]['message']);return _0x144eaf(_0x273447['error'][_0x1783('0x19')]);}else{logger[_0x1783('0x12')](_0x1783('0x18'),_0x494921,_0x1783('0x13'));_0x144eaf(_0x273447['result']['message']);}})[_0x1783('0x1a')](function(_0x1c1fd1){logger[_0x1783('0x16')](_0x1783('0x18'),_0x494921,_0x1c1fd1);_0x2142bb(_0x1c1fd1);});});}exports[_0x1783('0x1b')]=function(_0x41b400){var _0x24a800=this;return new Promise(function(_0x1580a0,_0x20ccc){return db['WhatsappAccount']['find']({'raw':_0x41b400['options']?_0x41b400[_0x1783('0x1c')][_0x1783('0x1d')]===undefined?!![]:![]:!![],'where':_0x41b400[_0x1783('0x1c')]?_0x41b400[_0x1783('0x1c')]['where']||null:null,'attributes':_0x41b400[_0x1783('0x1c')]?_0x41b400[_0x1783('0x1c')][_0x1783('0x1e')]||null:null,'include':_0x41b400[_0x1783('0x1c')]?_0x41b400[_0x1783('0x1c')][_0x1783('0x1f')]?_[_0x1783('0x20')](_0x41b400['options']['include'],function(_0x1dc9de){return{'model':db[_0x1dc9de[_0x1783('0x21')]],'as':_0x1dc9de['as'],'attributes':_0x1dc9de[_0x1783('0x1e')],'include':_0x1dc9de['include']?_[_0x1783('0x20')](_0x1dc9de[_0x1783('0x1f')],function(_0x3df9a7){return{'model':db[_0x3df9a7[_0x1783('0x21')]],'as':_0x3df9a7['as'],'attributes':_0x3df9a7[_0x1783('0x1e')],'include':_0x3df9a7['include']?_['map'](_0x3df9a7[_0x1783('0x1f')],function(_0x247a00){return{'model':db[_0x247a00[_0x1783('0x21')]],'as':_0x247a00['as'],'attributes':_0x247a00['attributes']};}):[]};}):[]};}):[]:[]})[_0x1783('0x11')](function(_0x306a0d){logger[_0x1783('0x12')]('ShowWhatsappAccount',_0x41b400);logger['debug'](_0x1783('0x1b'),_0x41b400,JSON[_0x1783('0x15')](_0x306a0d));_0x1580a0(_0x306a0d);})[_0x1783('0x1a')](function(_0x47fc58){logger['error'](_0x1783('0x1b'),_0x47fc58[_0x1783('0x19')],_0x41b400);_0x20ccc(_0x24a800[_0x1783('0x16')](0x1f4,_0x47fc58[_0x1783('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8d3ecb5..abb433f 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 _0x5672=['./whatsappAccount.events','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5672,0xe0));var _0x2567=function(_0x255b94,_0x352b45){_0x255b94=_0x255b94-0x0;var _0xc5806b=_0x5672[_0x255b94];return _0xc5806b;};'use strict';var WhatsappAccountEvents=require(_0x2567('0x0'));var events=['save',_0x2567('0x1'),_0x2567('0x2')];function createListener(_0x482b47,_0x358c05){return function(_0x39f6f4){_0x358c05[_0x2567('0x3')](_0x482b47,_0x39f6f4);};}function removeListener(_0x47c357,_0x353e84){return function(){WhatsappAccountEvents[_0x2567('0x4')](_0x47c357,_0x353e84);};}exports[_0x2567('0x5')]=function(_0x368fc6){for(var _0x504082=0x0,_0x4d5291=events[_0x2567('0x6')];_0x504082<_0x4d5291;_0x504082++){var _0x2681cf=events[_0x504082];var _0x58be7a=createListener(_0x2567('0x7')+_0x2681cf,_0x368fc6);WhatsappAccountEvents['on'](_0x2681cf,_0x58be7a);}}; \ No newline at end of file +var _0x87f7=['length','update','removeListener','register'];(function(_0x2fd158,_0x26d2ab){var _0x1c3792=function(_0x4b993b){while(--_0x4b993b){_0x2fd158['push'](_0x2fd158['shift']());}};_0x1c3792(++_0x26d2ab);}(_0x87f7,0x129));var _0x787f=function(_0x3589ed,_0x57fc4d){_0x3589ed=_0x3589ed-0x0;var _0x57ddcd=_0x87f7[_0x3589ed];return _0x57ddcd;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save','remove',_0x787f('0x0')];function createListener(_0x1344bf,_0x336979){return function(_0x5c5f9a){_0x336979['emit'](_0x1344bf,_0x5c5f9a);};}function removeListener(_0x38635d,_0x1d68ce){return function(){WhatsappAccountEvents[_0x787f('0x1')](_0x38635d,_0x1d68ce);};}exports[_0x787f('0x2')]=function(_0xc391e4){for(var _0x30ffe8=0x0,_0x1971e8=events[_0x787f('0x3')];_0x30ffe8<_0x1971e8;_0x30ffe8++){var _0x135702=events[_0x30ffe8];var _0x340041=createListener('whatsappAccount:'+_0x135702,_0xc391e4);WhatsappAccountEvents['on'](_0x135702,_0x340041);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2ee11a2..2449b19 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 _0x8e18=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x8e18,0x1e1));var _0x88e1=function(_0x4a8826,_0x554de4){_0x4a8826=_0x4a8826-0x0;var _0x7fd780=_0x8e18[_0x4a8826];return _0x7fd780;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88e1('0x0'));var timeout=require('connect-timeout');var express=require(_0x88e1('0x1'));var router=express['Router']();var fs_extra=require(_0x88e1('0x2'));var auth=require(_0x88e1('0x3'));var interaction=require(_0x88e1('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x88e1('0x5')]('/',auth[_0x88e1('0x6')](),controller[_0x88e1('0x7')]);router[_0x88e1('0x5')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller[_0x88e1('0x9')]);router['post']('/',auth[_0x88e1('0x6')](),controller[_0x88e1('0xa')]);router[_0x88e1('0xb')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller['update']);router[_0x88e1('0xc')](_0x88e1('0x8'),auth[_0x88e1('0x6')](),controller[_0x88e1('0xd')]);module[_0x88e1('0xe')]=router; \ No newline at end of file +var _0xb755=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','create','put','/:id','delete','multer','util','path','express','Router','fs-extra'];(function(_0x1fe80a,_0x56458e){var _0x54e5bb=function(_0x4217e3){while(--_0x4217e3){_0x1fe80a['push'](_0x1fe80a['shift']());}};_0x54e5bb(++_0x56458e);}(_0xb755,0x198));var _0x5b75=function(_0x96b0a9,_0x2adc3c){_0x96b0a9=_0x96b0a9-0x0;var _0x1880eb=_0xb755[_0x96b0a9];return _0x1880eb;};'use strict';var multer=require(_0x5b75('0x0'));var util=require(_0x5b75('0x1'));var path=require(_0x5b75('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b75('0x3'));var router=express[_0x5b75('0x4')]();var fs_extra=require(_0x5b75('0x5'));var auth=require(_0x5b75('0x6'));var interaction=require(_0x5b75('0x7'));var config=require(_0x5b75('0x8'));var controller=require(_0x5b75('0x9'));router[_0x5b75('0xa')]('/',auth[_0x5b75('0xb')](),controller[_0x5b75('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b75('0xd')]);router['post']('/',auth[_0x5b75('0xb')](),controller[_0x5b75('0xe')]);router[_0x5b75('0xf')](_0x5b75('0x10'),auth[_0x5b75('0xb')](),controller['update']);router[_0x5b75('0x11')](_0x5b75('0x10'),auth[_0x5b75('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 299622a..90739f4 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 _0xeca9=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2c19de,_0x3a276e){var _0x361d14=function(_0x15597c){while(--_0x15597c){_0x2c19de['push'](_0x2c19de['shift']());}};_0x361d14(++_0x3a276e);}(_0xeca9,0x79));var _0x9eca=function(_0x382684,_0x51b6fc){_0x382684=_0x382684-0x0;var _0x25d7a8=_0xeca9[_0x382684];return _0x25d7a8;};'use strict';var Sequelize=require(_0x9eca('0x0'));module[_0x9eca('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9eca('0x2')],'allowNull':![],'defaultValue':_0x9eca('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9eca('0x2')],'defaultValue':_0x9eca('0x4')}}; \ No newline at end of file +var _0x56a0=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x56a0,0x101));var _0x056a=function(_0xc9cd47,_0x35a546){_0xc9cd47=_0xc9cd47-0x0;var _0x26827e=_0x56a0[_0xc9cd47];return _0x26827e;};'use strict';var Sequelize=require(_0x056a('0x0'));module[_0x056a('0x1')]={'priority':{'type':Sequelize[_0x056a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x056a('0x3')],'allowNull':![],'defaultValue':_0x056a('0x4')},'appdata':{'type':Sequelize[_0x056a('0x5')]()},'description':{'type':Sequelize[_0x056a('0x3')]},'interval':{'type':Sequelize[_0x056a('0x3')],'defaultValue':_0x056a('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 55cdf09..b7e38ac 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 _0xb8cb=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0x1dd3a9,_0xa4d964){var _0x49bfa5=function(_0x2ca222){while(--_0x2ca222){_0x1dd3a9['push'](_0x1dd3a9['shift']());}};_0x49bfa5(++_0xa4d964);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x505db3,_0x31b596){_0x505db3=_0x505db3-0x0;var _0x10abb1=_0xb8cb[_0x505db3];return _0x10abb1;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file +var _0x349f=['VIRTUAL','options','include','findAll','rows','catch','show','params','keys','WhatsappApplication','rawAttributes','fields','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0x362f9b,_0x2cb4a0){var _0xfcb36=function(_0x1371f0){while(--_0x1371f0){_0x362f9b['push'](_0x362f9b['shift']());}};_0xfcb36(++_0x2cb4a0);}(_0x349f,0xa8));var _0xf349=function(_0x18cf78,_0x2d4827){_0x18cf78=_0x18cf78-0x0;var _0x55328c=_0x349f[_0x18cf78];return _0x55328c;};'use strict';var emlformat=require(_0xf349('0x0'));var rimraf=require(_0xf349('0x1'));var zipdir=require(_0xf349('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf349('0x3'));var moment=require(_0xf349('0x4'));var BPromise=require(_0xf349('0x5'));var Mustache=require(_0xf349('0x6'));var util=require(_0xf349('0x7'));var path=require(_0xf349('0x8'));var sox=require(_0xf349('0x9'));var csv=require(_0xf349('0xa'));var ejs=require(_0xf349('0xb'));var fs=require('fs');var fs_extra=require(_0xf349('0xc'));var _=require('lodash');var squel=require(_0xf349('0xd'));var crypto=require(_0xf349('0xe'));var jsforce=require(_0xf349('0xf'));var deskjs=require(_0xf349('0x10'));var toCsv=require(_0xf349('0xa'));var querystring=require(_0xf349('0x11'));var Papa=require(_0xf349('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf349('0x13'));var as=require(_0xf349('0x14'));var hardwareService=require(_0xf349('0x15'));var logger=require(_0xf349('0x16'))(_0xf349('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf349('0x18'))['db'];function respondWithStatusCode(_0x238c96,_0x21cca8){_0x21cca8=_0x21cca8||0xcc;return function(_0x29d527){if(_0x29d527){return _0x238c96[_0xf349('0x19')](_0x21cca8);}return _0x238c96['status'](_0x21cca8)[_0xf349('0x1a')]();};}function respondWithResult(_0x35d833,_0x4ffa5f){_0x4ffa5f=_0x4ffa5f||0xc8;return function(_0x43b1ff){if(_0x43b1ff){return _0x35d833[_0xf349('0x1b')](_0x4ffa5f)['json'](_0x43b1ff);}};}function respondWithFilteredResult(_0x358412,_0x55479f){return function(_0x401ada){if(_0x401ada){var _0x3bc4e4=typeof _0x55479f[_0xf349('0x1c')]===_0xf349('0x1d')&&typeof _0x55479f[_0xf349('0x1e')]===_0xf349('0x1d');var _0x2666be=_0x401ada['count'];var _0x44aa98=_0x3bc4e4?0x0:_0x55479f['offset'];var _0x3b56cc=_0x3bc4e4?_0x401ada[_0xf349('0x1f')]:_0x55479f[_0xf349('0x1c')]+_0x55479f[_0xf349('0x1e')];var _0x363da1;if(_0x3b56cc>=_0x2666be){_0x3b56cc=_0x2666be;_0x363da1=0xc8;}else{_0x363da1=0xce;}_0x358412[_0xf349('0x1b')](_0x363da1);return _0x358412[_0xf349('0x20')](_0xf349('0x21'),_0x44aa98+'-'+_0x3b56cc+'/'+_0x2666be)['json'](_0x401ada);}return null;};}function patchUpdates(_0x282cc8){return function(_0x5eefe2){try{jsonpatch[_0xf349('0x22')](_0x5eefe2,_0x282cc8,!![]);}catch(_0x2b00f4){return BPromise[_0xf349('0x23')](_0x2b00f4);}return _0x5eefe2['save']();};}function saveUpdates(_0x311fc2,_0x1d2a26){return function(_0x236970){if(_0x236970){return _0x236970['update'](_0x311fc2)[_0xf349('0x24')](function(_0x35c9dd){return _0x35c9dd;});}return null;};}function removeEntity(_0x4d574a,_0x5752b5){return function(_0x55ed7a){if(_0x55ed7a){return _0x55ed7a[_0xf349('0x25')]()[_0xf349('0x24')](function(){_0x4d574a[_0xf349('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de06b,_0x2103a6){return function(_0x11dc06){if(!_0x11dc06){_0x3de06b[_0xf349('0x19')](0x194);}return _0x11dc06;};}function handleError(_0x142d95,_0x222e95){_0x222e95=_0x222e95||0x1f4;return function(_0x3da7b7){logger[_0xf349('0x26')](_0x3da7b7[_0xf349('0x27')]);if(_0x3da7b7[_0xf349('0x28')]){delete _0x3da7b7[_0xf349('0x28')];}_0x142d95[_0xf349('0x1b')](_0x222e95)[_0xf349('0x29')](_0x3da7b7);};}exports[_0xf349('0x2a')]=function(_0x53aa55,_0x58e542){var _0x554bc4={},_0x4f2ae2={},_0x38d1e5={'count':0x0,'rows':[]};var _0x4938fa=_[_0xf349('0x2b')](db['WhatsappApplication']['rawAttributes'],function(_0x5291ab){return{'name':_0x5291ab['fieldName'],'type':_0x5291ab[_0xf349('0x2c')][_0xf349('0x2d')]};});_0x4f2ae2[_0xf349('0x2e')]=_[_0xf349('0x2b')](_0x4938fa,_0xf349('0x28'));_0x4f2ae2['query']=_['keys'](_0x53aa55[_0xf349('0x2f')]);_0x4f2ae2[_0xf349('0x30')]=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],_0x4f2ae2[_0xf349('0x2f')]);_0x554bc4['attributes']=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],qs['fields'](_0x53aa55['query']['fields']));_0x554bc4[_0xf349('0x32')]=_0x554bc4[_0xf349('0x32')][_0xf349('0x33')]?_0x554bc4['attributes']:_0x4f2ae2[_0xf349('0x2e')];if(!_0x53aa55[_0xf349('0x2f')][_0xf349('0x34')](_0xf349('0x35'))){_0x554bc4[_0xf349('0x1e')]=qs['limit'](_0x53aa55[_0xf349('0x2f')]['limit']);_0x554bc4[_0xf349('0x1c')]=qs[_0xf349('0x1c')](_0x53aa55[_0xf349('0x2f')][_0xf349('0x1c')]);}_0x554bc4[_0xf349('0x36')]=qs[_0xf349('0x37')](_0x53aa55[_0xf349('0x2f')]['sort']);_0x554bc4['where']=qs['filters'](_[_0xf349('0x38')](_0x53aa55[_0xf349('0x2f')],_0x4f2ae2['filters']),_0x4938fa);if(_0x53aa55[_0xf349('0x2f')][_0xf349('0x39')]){_0x554bc4['where']=_[_0xf349('0x3a')](_0x554bc4[_0xf349('0x3b')],{'$or':_[_0xf349('0x2b')](_0x4938fa,function(_0x353b95){if(_0x353b95[_0xf349('0x2c')]!==_0xf349('0x3c')){var _0x5ec1c9={};_0x5ec1c9[_0x353b95[_0xf349('0x28')]]={'$like':'%'+_0x53aa55['query']['filter']+'%'};return _0x5ec1c9;}})});}_0x554bc4=_[_0xf349('0x3a')]({},_0x554bc4,_0x53aa55[_0xf349('0x3d')]);var _0x325279={'where':_0x554bc4[_0xf349('0x3b')]};return db['WhatsappApplication'][_0xf349('0x1f')](_0x325279)[_0xf349('0x24')](function(_0x562ac1){_0x38d1e5[_0xf349('0x1f')]=_0x562ac1;if(_0x53aa55['query']['includeAll']){_0x554bc4[_0xf349('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xf349('0x3f')](_0x554bc4);})['then'](function(_0x31c434){_0x38d1e5[_0xf349('0x40')]=_0x31c434;return _0x38d1e5;})['then'](respondWithFilteredResult(_0x58e542,_0x554bc4))[_0xf349('0x41')](handleError(_0x58e542,null));};exports[_0xf349('0x42')]=function(_0x1e6437,_0x491621){var _0x336dcb={'raw':!![],'where':{'id':_0x1e6437[_0xf349('0x43')]['id']}},_0x478069={};_0x478069['model']=_[_0xf349('0x44')](db[_0xf349('0x45')][_0xf349('0x46')]);_0x478069[_0xf349('0x2f')]=_[_0xf349('0x44')](_0x1e6437[_0xf349('0x2f')]);_0x478069['filters']=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],_0x478069['query']);_0x336dcb[_0xf349('0x32')]=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],qs[_0xf349('0x47')](_0x1e6437[_0xf349('0x2f')]['fields']));_0x336dcb[_0xf349('0x32')]=_0x336dcb[_0xf349('0x32')][_0xf349('0x33')]?_0x336dcb[_0xf349('0x32')]:_0x478069[_0xf349('0x2e')];if(_0x1e6437[_0xf349('0x2f')]['includeAll']){_0x336dcb['include']=[{'all':!![]}];}_0x336dcb=_['merge']({},_0x336dcb,_0x1e6437[_0xf349('0x3d')]);return db[_0xf349('0x45')][_0xf349('0x48')](_0x336dcb)[_0xf349('0x24')](handleEntityNotFound(_0x491621,null))[_0xf349('0x24')](respondWithResult(_0x491621,null))[_0xf349('0x41')](handleError(_0x491621,null));};exports[_0xf349('0x49')]=function(_0x2f54ae,_0x29b1b2){return db[_0xf349('0x45')]['create'](_0x2f54ae['body'],{})[_0xf349('0x24')](respondWithResult(_0x29b1b2,0xc9))['catch'](handleError(_0x29b1b2,null));};exports[_0xf349('0x4a')]=function(_0x1ad99a,_0x435193){if(_0x1ad99a[_0xf349('0x4b')]['id']){delete _0x1ad99a['body']['id'];}return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1ad99a[_0xf349('0x43')]['id']}})[_0xf349('0x24')](handleEntityNotFound(_0x435193,null))[_0xf349('0x24')](saveUpdates(_0x1ad99a[_0xf349('0x4b')],null))[_0xf349('0x24')](respondWithResult(_0x435193,null))[_0xf349('0x41')](handleError(_0x435193,null));};exports['destroy']=function(_0x1933d1,_0xb3dbea){return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1933d1[_0xf349('0x43')]['id']}})['then'](handleEntityNotFound(_0xb3dbea,null))[_0xf349('0x24')](removeEntity(_0xb3dbea,null))[_0xf349('0x41')](handleError(_0xb3dbea,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index bf229fd..4de8ce1 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 _0xd4b6=['lodash','util','api','moment','request-promise','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4'];(function(_0x11c294,_0x562d9d){var _0x5e7302=function(_0x360920){while(--_0x360920){_0x11c294['push'](_0x11c294['shift']());}};_0x5e7302(++_0x562d9d);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x5f3806,_0x248ff1){_0x5f3806=_0x5f3806-0x0;var _0x5de6d6=_0xd4b6[_0x5f3806];return _0x5de6d6;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var logger=require('../../config/logger')(_0x6d4b('0x2'));var moment=require(_0x6d4b('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6d4b('0x5'));module[_0x6d4b('0x6')]=function(_0x442164,_0x5daf08){return _0x442164[_0x6d4b('0x7')](_0x6d4b('0x8'),attributes,{'tableName':_0x6d4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d4b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1c9a=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x55bbea,_0x4e6103){_0x55bbea=_0x55bbea-0x0;var _0x466446=_0x1c9a[_0x55bbea];return _0x466446;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var logger=require('../../config/logger')(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var rp=require(_0xa1c9('0x5'));var fs=require('fs');var path=require(_0xa1c9('0x6'));var rimraf=require('rimraf');var config=require(_0xa1c9('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xa1c9('0x8')]=function(_0xdd22bf,_0x237862){return _0xdd22bf[_0xa1c9('0x9')](_0xa1c9('0xa'),attributes,{'tableName':_0xa1c9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1c9('0xc'),'collate':_0xa1c9('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0ee50c5..8eebff3 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 _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xeec6[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +var _0xd2ea=['../../config/environment','jayson/promise','client','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34a48e,_0x456633){var _0x184809=function(_0x1a665a){while(--_0x1a665a){_0x34a48e['push'](_0x34a48e['shift']());}};_0x184809(++_0x456633);}(_0xd2ea,0x15f));var _0xad2e=function(_0x485b7f,_0x53f048){_0x485b7f=_0x485b7f-0x0;var _0x5ab9bd=_0xd2ea[_0x485b7f];return _0x5ab9bd;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dd1d3b7..c208f01 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 _0xe132=['index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','whatsapp','addTags','put','whatsappinteraction:update','whatsappinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x3431df,_0x308f9f){var _0x1b2d6f=function(_0x202975){while(--_0x202975){_0x3431df['push'](_0x3431df['shift']());}};_0x1b2d6f(++_0x308f9f);}(_0xe132,0x162));var _0x2e13=function(_0x4f2f1a,_0x467eba){_0x4f2f1a=_0x4f2f1a-0x0;var _0x2244ec=_0xe132[_0x4f2f1a];return _0x2244ec;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['get'](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x10')]);router[_0x2e13('0xa')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x12')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);router[_0x2e13('0x14')](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x15')]);router[_0x2e13('0x14')]('/:id/tags',auth[_0x2e13('0x8')](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),'whatsappinteraction:addtags'),controller[_0x2e13('0x18')]);router[_0x2e13('0x19')](_0x2e13('0xd'),auth['isAuthenticated'](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),_0x2e13('0x1a')),controller['update']);router['delete'](_0x2e13('0xd'),auth[_0x2e13('0x8')](),interaction[_0x2e13('0x16')](_0x2e13('0x17'),_0x2e13('0x1b')),controller[_0x2e13('0x1c')]);router[_0x2e13('0x1d')](_0x2e13('0x1e'),auth['isAuthenticated'](),controller[_0x2e13('0x1f')]);module[_0x2e13('0x20')]=router; \ No newline at end of file +var _0x86f4=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','whatsapp','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x173092,_0xf3ab29){var _0xb506a4=function(_0xcc48ad){while(--_0xcc48ad){_0x173092['push'](_0x173092['shift']());}};_0xb506a4(++_0xf3ab29);}(_0x86f4,0x18a));var _0x486f=function(_0x239f5b,_0x3967e0){_0x239f5b=_0x239f5b-0x0;var _0x83566b=_0x86f4[_0x239f5b];return _0x83566b;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0x9')](_0x486f('0xf'),auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x9')](_0x486f('0x11'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);router[_0x486f('0x13')](_0x486f('0xf'),auth['isAuthenticated'](),controller[_0x486f('0x15')]);router['post'](_0x486f('0x16'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:addtags'),controller[_0x486f('0x18')]);router[_0x486f('0x19')]('/:id',auth[_0x486f('0xa')](),interaction[_0x486f('0x17')](_0x486f('0x1a'),'whatsappinteraction:update'),controller['update']);router[_0x486f('0x1b')](_0x486f('0xd'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:destroy'),controller[_0x486f('0x1c')]);router[_0x486f('0x1b')](_0x486f('0x16'),auth[_0x486f('0xa')](),controller[_0x486f('0x1d')]);module[_0x486f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4f57cce..8a056e5 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 _0x61d0=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x363803,_0x1cd8e9){var _0x1a08c6=function(_0x2790f3){while(--_0x2790f3){_0x363803['push'](_0x363803['shift']());}};_0x1a08c6(++_0x1cd8e9);}(_0x61d0,0x187));var _0x061d=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x61d0[_0x26bf51];return _0x503415;};'use strict';var Sequelize=require(_0x061d('0x0'));var moment=require('moment');module[_0x061d('0x1')]={'closed':{'type':Sequelize[_0x061d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x061d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x061d('0x3')]},'note':{'type':Sequelize[_0x061d('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x061d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x061d('0x5')]('in',_0x061d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x061d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x061d('0x5')]('in',_0x061d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x061d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfef3=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfef3,0x118));var _0x3fef=function(_0x1d5a32,_0x47974a){_0x1d5a32=_0x1d5a32-0x0;var _0x361ca0=_0xfef3[_0x1d5a32];return _0x361ca0;};'use strict';var Sequelize=require(_0x3fef('0x0'));var moment=require('moment');module[_0x3fef('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3fef('0x2')]},'disposition':{'type':Sequelize[_0x3fef('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3fef('0x3')]},'note':{'type':Sequelize[_0x3fef('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3fef('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3fef('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3fef('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3fef('0x4')]('in',_0x3fef('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3fef('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3fef('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index c6c794c..45874a5 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 _0x1534=['whatsapp','query','catch','params','model','WhatsappInteraction','keys','attributes','fields','length','include','merge','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','includeAll','rows','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','read','Account','Owner','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','error','stack','name','send','map','rawAttributes','key','getOptions','findAll'];(function(_0x441a06,_0x3b5fc5){var _0x4559ce=function(_0x22dac6){while(--_0x22dac6){_0x441a06['push'](_0x441a06['shift']());}};_0x4559ce(++_0x3b5fc5);}(_0x1534,0xda));var _0x4153=function(_0x2565a4,_0x5d6a87){_0x2565a4=_0x2565a4-0x0;var _0x5e87f4=_0x1534[_0x2565a4];return _0x5e87f4;};'use strict';var rimraf=require(_0x4153('0x0'));var zipdir=require(_0x4153('0x1'));var moment=require(_0x4153('0x2'));var BPromise=require('bluebird');var util=require(_0x4153('0x3'));var path=require(_0x4153('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4153('0x5'));var Redis=require(_0x4153('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x4153('0x7'));var pdf=require(_0x4153('0x8'));var logger=require(_0x4153('0x9'))(_0x4153('0xa'));var config=require(_0x4153('0xb'));var db=require(_0x4153('0xc'))['db'];config[_0x4153('0xd')]=_[_0x4153('0xe')](config[_0x4153('0xd')],{'host':_0x4153('0xf'),'port':0x18eb});var socket=require(_0x4153('0x10'))(new Redis(config['redis']));require(_0x4153('0x11'))[_0x4153('0x12')](socket);function respondWithStatusCode(_0x552ab8,_0x14c61d){_0x14c61d=_0x14c61d||0xcc;return function(_0x711e82){if(_0x711e82){return _0x552ab8[_0x4153('0x13')](_0x14c61d);}return _0x552ab8[_0x4153('0x14')](_0x14c61d)[_0x4153('0x15')]();};}function respondWithResult(_0x298649,_0x11a61c){_0x11a61c=_0x11a61c||0xc8;return function(_0xd1d003){if(_0xd1d003){return _0x298649[_0x4153('0x14')](_0x11a61c)[_0x4153('0x16')](_0xd1d003);}};}function respondWithFilteredResult(_0x264be4,_0x2b12ed){return function(_0x21d6a8){if(_0x21d6a8){var _0x135df8=typeof _0x2b12ed['offset']===_0x4153('0x17')&&typeof _0x2b12ed[_0x4153('0x18')]===_0x4153('0x17');var _0x33b78c=_0x21d6a8[_0x4153('0x19')];var _0x3d2a57=_0x135df8?0x0:_0x2b12ed[_0x4153('0x1a')];var _0x403dfe=_0x135df8?_0x21d6a8[_0x4153('0x19')]:_0x2b12ed[_0x4153('0x1a')]+_0x2b12ed[_0x4153('0x18')];var _0x4ed10b;if(_0x403dfe>=_0x33b78c){_0x403dfe=_0x33b78c;_0x4ed10b=0xc8;}else{_0x4ed10b=0xce;}_0x264be4['status'](_0x4ed10b);return _0x264be4[_0x4153('0x1b')](_0x4153('0x1c'),_0x3d2a57+'-'+_0x403dfe+'/'+_0x33b78c)['json'](_0x21d6a8);}return null;};}function saveUpdates(_0x3273bf){return function(_0x40004f){if(_0x40004f){return _0x40004f['update'](_0x3273bf)['then'](function(_0x1c06cc){return _0x1c06cc;});}return null;};}function removeEntity(_0x51790c){return function(_0x1bc5df){if(_0x1bc5df){return _0x1bc5df[_0x4153('0x1d')]()[_0x4153('0x1e')](function(){_0x51790c[_0x4153('0x14')](0xcc)[_0x4153('0x15')]();});}};}function handleEntityNotFound(_0x597013){return function(_0x3fc4d7){if(!_0x3fc4d7){_0x597013[_0x4153('0x13')](0x194);}return _0x3fc4d7;};}function handleError(_0x330ce7,_0xff6977){_0xff6977=_0xff6977||0x1f4;return function(_0x4bdd14){logger[_0x4153('0x1f')](_0x4bdd14[_0x4153('0x20')]);if(_0x4bdd14[_0x4153('0x21')]){delete _0x4bdd14['name'];}_0x330ce7[_0x4153('0x14')](_0xff6977)[_0x4153('0x22')](_0x4bdd14);};}exports['index']=function(_0x3ae872,_0x303465){var _0x4dd7a9={};var _0x50b73c=_[_0x4153('0x23')](db['WhatsappInteraction'][_0x4153('0x24')],function(_0x41b4f5){return{'name':_0x41b4f5['fieldName'],'type':_0x41b4f5['type'][_0x4153('0x25')]};});_0x4dd7a9=qs[_0x4153('0x26')](_0x50b73c,_0x3ae872);return interaction[_0x4153('0x27')](_0x4153('0x28'),_0x3ae872[_0x4153('0x29')],_0x3ae872['user'],_0x4dd7a9,_0x50b73c)['then'](respondWithFilteredResult(_0x303465,_0x4dd7a9))[_0x4153('0x2a')](handleError(_0x303465,null));};exports['show']=function(_0x7f8e20,_0x46417e){var _0x10a95b={'raw':![],'where':{'id':_0x7f8e20[_0x4153('0x2b')]['id']}},_0xf1bd76={};_0xf1bd76[_0x4153('0x2c')]=_['keys'](db[_0x4153('0x2d')]['rawAttributes']);_0xf1bd76['query']=_[_0x4153('0x2e')](_0x7f8e20[_0x4153('0x29')]);_0xf1bd76['filters']=_['intersection'](_0xf1bd76[_0x4153('0x2c')],_0xf1bd76[_0x4153('0x29')]);_0x10a95b[_0x4153('0x2f')]=_['intersection'](_0xf1bd76['model'],qs[_0x4153('0x30')](_0x7f8e20['query'][_0x4153('0x30')]));_0x10a95b[_0x4153('0x2f')]=_0x10a95b[_0x4153('0x2f')][_0x4153('0x31')]?_0x10a95b[_0x4153('0x2f')]:_0xf1bd76[_0x4153('0x2c')];if(_0x7f8e20[_0x4153('0x29')]['includeAll']){_0x10a95b[_0x4153('0x32')]=[{'all':!![]}];}_0x10a95b=_[_0x4153('0x33')]({},_0x10a95b,_0x7f8e20[_0x4153('0x34')]);return db['WhatsappInteraction'][_0x4153('0x35')](_0x10a95b)[_0x4153('0x1e')](handleEntityNotFound(_0x46417e,null))[_0x4153('0x1e')](respondWithResult(_0x46417e,null))[_0x4153('0x2a')](handleError(_0x46417e,null));};exports[_0x4153('0x36')]=function(_0xebc76,_0xbf5095){return db[_0x4153('0x2d')][_0x4153('0x36')](_0xebc76[_0x4153('0x37')],{})[_0x4153('0x1e')](respondWithResult(_0xbf5095,0xc9))['catch'](handleError(_0xbf5095,null));};exports[_0x4153('0x38')]=function(_0x375498,_0x127340){if(_0x375498[_0x4153('0x37')]['id']){delete _0x375498[_0x4153('0x37')]['id'];}return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x375498[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x127340,null))[_0x4153('0x1e')](saveUpdates(_0x375498[_0x4153('0x37')],null))[_0x4153('0x1e')](respondWithResult(_0x127340,null))[_0x4153('0x2a')](handleError(_0x127340,null));};exports[_0x4153('0x1d')]=function(_0x10bc35,_0x55a342){return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x10bc35['params']['id']}})['then'](handleEntityNotFound(_0x55a342,null))[_0x4153('0x1e')](removeEntity(_0x55a342,null))[_0x4153('0x2a')](handleError(_0x55a342,null));};exports['describe']=function(_0x36f28e,_0x577cb3){return db[_0x4153('0x2d')][_0x4153('0x39')]()[_0x4153('0x1e')](respondWithResult(_0x577cb3,null))[_0x4153('0x2a')](handleError(_0x577cb3,null));};exports[_0x4153('0x3a')]=function(_0x1da423,_0x5ac0e3){return db[_0x4153('0x3b')]['find']({'where':{'id':_0x1da423[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x5ac0e3,null))[_0x4153('0x1e')](function(_0x429325){if(_0x429325){return _0x429325[_0x4153('0x3a')](_0x1da423[_0x4153('0x37')][_0x4153('0x3c')],_[_0x4153('0x3d')](_0x1da423[_0x4153('0x37')],[_0x4153('0x3c'),'id'])||{});}})[_0x4153('0x1e')](respondWithResult(_0x5ac0e3,null))['catch'](handleError(_0x5ac0e3,null));};exports[_0x4153('0x3e')]=function(_0x1f3898,_0x59f0e6){var _0x29ed32={'raw':![],'where':{}};var _0x5c211c={};var _0x333dfc={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4153('0x3f')]({'where':{'id':_0x1f3898[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x59f0e6,null))[_0x4153('0x1e')](function(_0x2a0c0d){if(_0x2a0c0d){_0x5c211c[_0x4153('0x2c')]=_[_0x4153('0x2e')](db['WhatsappMessage'][_0x4153('0x24')]);_0x5c211c[_0x4153('0x29')]=_['keys'](_0x1f3898[_0x4153('0x29')]);_0x5c211c['filters']=_['intersection'](_0x5c211c[_0x4153('0x2c')],_0x5c211c[_0x4153('0x29')]);_0x29ed32[_0x4153('0x2f')]=_['intersection'](_0x5c211c[_0x4153('0x2c')],qs[_0x4153('0x30')](_0x1f3898[_0x4153('0x29')][_0x4153('0x30')]));_0x29ed32[_0x4153('0x2f')]=_0x29ed32[_0x4153('0x2f')][_0x4153('0x31')]?_0x29ed32[_0x4153('0x2f')]:_0x5c211c[_0x4153('0x2c')];if(!_0x1f3898[_0x4153('0x29')]['hasOwnProperty'](_0x4153('0x40'))){_0x29ed32['limit']=qs[_0x4153('0x18')](_0x1f3898['query']['limit']);_0x29ed32['offset']=qs['offset'](_0x1f3898['query'][_0x4153('0x1a')]);}_0x29ed32[_0x4153('0x41')]=qs[_0x4153('0x42')](_0x1f3898['query'][_0x4153('0x42')]);_0x29ed32[_0x4153('0x43')]=qs[_0x4153('0x44')](_[_0x4153('0x45')](_0x1f3898['query'],_0x5c211c[_0x4153('0x44')]));_0x29ed32[_0x4153('0x43')]['WhatsappInteractionId']=_0x2a0c0d['id'];if(_0x1f3898[_0x4153('0x29')][_0x4153('0x46')]){_0x29ed32[_0x4153('0x43')]=_['merge'](_0x29ed32['where'],{'$or':_[_0x4153('0x23')](_0x29ed32[_0x4153('0x2f')],function(_0x46ae1a){var _0x3bd058={};_0x3bd058[_0x46ae1a]={'$like':'%'+_0x1f3898['query'][_0x4153('0x46')]+'%'};return _0x3bd058;})});}if(_0x1f3898[_0x4153('0x29')][_0x4153('0x47')]){var _0x1c98ab=_0x1f3898[_0x4153('0x29')]['$gte'][_0x4153('0x48')](',');var _0x13d8db={};_0x13d8db[_0x1c98ab[0x0]]={'$gte':moment(_0x1c98ab[0x1])[_0x4153('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x29ed32[_0x4153('0x43')]=_[_0x4153('0x33')](_0x29ed32[_0x4153('0x43')],_0x13d8db);}_0x29ed32=_[_0x4153('0x33')]({},_0x29ed32,_0x1f3898[_0x4153('0x34')]);return db[_0x4153('0x3b')][_0x4153('0x19')]({'where':_0x29ed32[_0x4153('0x43')]})['then'](function(_0x2f6de8){_0x333dfc[_0x4153('0x19')]=_0x2f6de8;if(_0x1f3898['query'][_0x4153('0x4a')]){_0x29ed32[_0x4153('0x32')]=[{'all':!![]}];}return db[_0x4153('0x3b')][_0x4153('0x27')](_0x29ed32);})[_0x4153('0x1e')](function(_0x28e090){_0x333dfc[_0x4153('0x4b')]=_0x28e090;return _0x333dfc;});}})[_0x4153('0x1e')](respondWithFilteredResult(_0x59f0e6,_0x29ed32))[_0x4153('0x2a')](handleError(_0x59f0e6,null));};exports['addTags']=function(_0x32a72b,_0x195aaa){return db[_0x4153('0x2d')]['find']({'where':{'id':_0x32a72b[_0x4153('0x2b')]['id']}})[_0x4153('0x1e')](handleEntityNotFound(_0x195aaa,null))[_0x4153('0x1e')](function(_0x8246df){if(_0x8246df){return _0x8246df[_0x4153('0x4c')](_0x32a72b[_0x4153('0x37')][_0x4153('0x3c')],_[_0x4153('0x3d')](_0x32a72b[_0x4153('0x37')],[_0x4153('0x3c'),'id'])||{})[_0x4153('0x4d')](function(){return db[_0x4153('0x4e')][_0x4153('0x27')]({'attributes':['id',_0x4153('0x21'),'color'],'where':{'id':_0x32a72b[_0x4153('0x37')][_0x4153('0x3c')]}});})['then'](function(_0x2c70cc){socket['emit'](_0x4153('0x4f'),{'id':Number(_0x32a72b[_0x4153('0x2b')]['id']),'tags':_0x2c70cc||[]});return{'id':Number(_0x32a72b[_0x4153('0x2b')]['id']),'tags':_0x2c70cc||[]};});}})[_0x4153('0x1e')](respondWithResult(_0x195aaa,null))[_0x4153('0x2a')](handleError(_0x195aaa,null));};exports[_0x4153('0x50')]=function(_0x230126,_0x5ae906){return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x230126[_0x4153('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5ae906,null))[_0x4153('0x1e')](function(_0x1921c1){if(_0x1921c1){return _0x1921c1[_0x4153('0x50')](_0x230126['query']['ids']);}})[_0x4153('0x1e')](respondWithStatusCode(_0x5ae906,null))['catch'](handleError(_0x5ae906,null));};exports[_0x4153('0x51')]=function(_0x13e491,_0x48c236){var _0x2a595e=moment()[_0x4153('0x52')]()[_0x4153('0x53')]();var _0x3bec52=path['join'](config[_0x4153('0x54')],_0x4153('0x55'),_0x4153('0x56'),_0x4153('0x57'));var _0x27692d=path[_0x4153('0x58')](config['root'],_0x4153('0x55'),_0x4153('0x56'),_0x4153('0x59'));var _0x50d5b0=path['join'](_0x3bec52,_0x2a595e);var _0x42ae18=util[_0x4153('0x49')](_0x4153('0x5a'),_0x13e491[_0x4153('0x2b')]['id'],_0x2a595e);var _0x5515e8=path[_0x4153('0x58')](_0x3bec52,_0x42ae18);var _0x3b8879=[];_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x5c')],'as':_0x4153('0x5c'),'attributes':['id',_0x4153('0x5d')],'raw':!![]});_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x5e')],'as':_0x4153('0x5f'),'attributes':['id','firstName',_0x4153('0x60')],'raw':!![]});if(_0x13e491[_0x4153('0x29')][_0x4153('0x59')]){_0x3b8879[_0x4153('0x5b')]({'model':db[_0x4153('0x61')],'as':_0x4153('0x61'),'raw':!![]});}var _0x4108b1=[{'model':db[_0x4153('0x3b')],'as':_0x4153('0x62'),'attributes':['id',_0x4153('0x37'),_0x4153('0x63'),'direction',_0x4153('0x64'),_0x4153('0x65')],'include':_0x3b8879}];_0x4108b1[_0x4153('0x5b')]({'model':db['WhatsappAccount'],'as':_0x4153('0x66'),'attributes':['id',_0x4153('0x21')]});_0x4108b1[_0x4153('0x5b')]({'model':db[_0x4153('0x5c')],'as':_0x4153('0x67'),'attributes':['id',_0x4153('0x5d')]});return db[_0x4153('0x2d')][_0x4153('0x35')]({'where':{'id':_0x13e491[_0x4153('0x2b')]['id']},'include':_0x4108b1})['then'](handleEntityNotFound(_0x48c236,null))[_0x4153('0x1e')](function(_0x5997b9){if(_0x5997b9){var _0x4da1f1=_0x5997b9['get']({'plain':!![]});fs[_0x4153('0x68')](_0x50d5b0);var _0xd845d={'channel':_0x4153('0x69'),'account':_0x4da1f1[_0x4153('0x66')]['name'],'agent':_0x4da1f1[_0x4153('0x67')]?_0x4da1f1[_0x4153('0x67')]['fullname']:_0x4153('0x6a'),'createdAt':moment(_0x4da1f1[_0x4153('0x63')])[_0x4153('0x49')](_0x4153('0x6b'))['toString'](),'closedAt':_0x4da1f1[_0x4153('0x6c')]?moment(_0x4da1f1[_0x4153('0x6d')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4153('0x53')]():'','disposition':_0x4da1f1[_0x4153('0x6e')],'messages':_(_0x4da1f1[_0x4153('0x62')])[_0x4153('0x46')]({'secret':![]})[_0x4153('0x23')](function(_0x19fb4b){if(_0x19fb4b[_0x4153('0x61')]){var _0x11a691=path[_0x4153('0x58')](_0x27692d,_0x19fb4b[_0x4153('0x61')][_0x4153('0x6f')]);if(fs['existsSync'](_0x11a691)){fs[_0x4153('0x70')](_0x11a691)[_0x4153('0x71')](fs[_0x4153('0x72')](path['join'](_0x50d5b0,_0x19fb4b[_0x4153('0x61')][_0x4153('0x6f')])));}}return{'date':moment(_0x19fb4b[_0x4153('0x63')])[_0x4153('0x49')](_0x4153('0x6b'))[_0x4153('0x53')](),'sender':_0x19fb4b[_0x4153('0x73')]===_0x4153('0x74')?_0x19fb4b['User']?_0x19fb4b[_0x4153('0x5c')]['fullname']:_0x4153('0x75'):_0x19fb4b[_0x4153('0x5f')][_0x4153('0x76')]+(_0x19fb4b[_0x4153('0x5f')][_0x4153('0x60')]?'\x20'+_0x19fb4b[_0x4153('0x5f')][_0x4153('0x60')]:''),'body':_0x19fb4b['Attachment']?_0x19fb4b[_0x4153('0x61')]['basename']:_0x19fb4b[_0x4153('0x37')],'direction':_0x19fb4b['direction']===_0x4153('0x74')?'A':'C','secret':_0x19fb4b[_0x4153('0x64')],'read':_0x19fb4b[_0x4153('0x65')],'attachment':_0x19fb4b['Attachment']};})[_0x4153('0x77')]()};return ejs[_0x4153('0x78')](path[_0x4153('0x58')](config[_0x4153('0x54')],'server',_0x4153('0x79'),_0x4153('0x7a')),{'interaction':_0xd845d})[_0x4153('0x1e')](function(_0x2d64ff){var _0x508fcc=path[_0x4153('0x58')](_0x50d5b0,_0x4153('0x7b')+_0x4da1f1['id']+'-'+_0x2a595e+_0x4153('0x7c'));var _0xbe6be2={'path':_0x508fcc,'channel':'Whatsapp','interactionId':_0x4da1f1['id']};return pdf[_0x4153('0x7d')](_0x2d64ff,_0xbe6be2);})[_0x4153('0x1e')](function(){return new BPromise(function(_0x5960d7,_0x52b208){zipdir(_0x50d5b0,{'saveTo':_0x5515e8},function(_0x4ea60e,_0x2961f0){if(_0x4ea60e)return _0x52b208(_0x4ea60e);return _0x5960d7(_0x2961f0);});})[_0x4153('0x1e')](function(){return new BPromise(function(_0x49d57d,_0x246338){rimraf(_0x50d5b0,function(_0x8bb00d){if(_0x8bb00d)_0x246338(_0x8bb00d);return _0x49d57d();});});})['then'](function(){return _0x48c236[_0x4153('0x51')](_0x5515e8,_0x42ae18,function(_0x42ccc2){if(_0x42ccc2){console[_0x4153('0x7e')](_0x4153('0x7f'),_0x42ccc2);}else{fs[_0x4153('0x80')](_0x5515e8);}});});});}else{return _0x48c236[_0x4153('0x13')](0xc8);}})[_0x4153('0x2a')](handleError(_0x48c236,null));}; \ No newline at end of file +var _0x8da8=['.pdf','Whatsapp','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','then','destroy','end','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','options','create','body','update','find','describe','ids','omit','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','merge','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','createdAt','secret','read','Owner','get','mkdirSync','Account','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','direction','out','firstName','renderFile','views','downloadInteraction.ejs'];(function(_0x1f01dd,_0x409d4f){var _0x298af7=function(_0x573849){while(--_0x573849){_0x1f01dd['push'](_0x1f01dd['shift']());}};_0x298af7(++_0x409d4f);}(_0x8da8,0x187));var _0x88da=function(_0x511c36,_0x1a3d0a){_0x511c36=_0x511c36-0x0;var _0x5501a1=_0x8da8[_0x511c36];return _0x5501a1;};'use strict';var rimraf=require(_0x88da('0x0'));var zipdir=require(_0x88da('0x1'));var moment=require(_0x88da('0x2'));var BPromise=require(_0x88da('0x3'));var util=require(_0x88da('0x4'));var path=require(_0x88da('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88da('0x6'));var Redis=require(_0x88da('0x7'));var interaction=require(_0x88da('0x8'));var qs=require(_0x88da('0x9'));var pdf=require(_0x88da('0xa'));var logger=require(_0x88da('0xb'))('api');var config=require(_0x88da('0xc'));var db=require(_0x88da('0xd'))['db'];config[_0x88da('0xe')]=_[_0x88da('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x88da('0x10'))(new Redis(config[_0x88da('0xe')]));require(_0x88da('0x11'))[_0x88da('0x12')](socket);function respondWithStatusCode(_0x2f42d5,_0x448287){_0x448287=_0x448287||0xcc;return function(_0x4eb23f){if(_0x4eb23f){return _0x2f42d5[_0x88da('0x13')](_0x448287);}return _0x2f42d5[_0x88da('0x14')](_0x448287)['end']();};}function respondWithResult(_0x36fec5,_0xf83676){_0xf83676=_0xf83676||0xc8;return function(_0x8bfa1c){if(_0x8bfa1c){return _0x36fec5[_0x88da('0x14')](_0xf83676)['json'](_0x8bfa1c);}};}function respondWithFilteredResult(_0x23f848,_0x5df8c9){return function(_0x49a882){if(_0x49a882){var _0x5a9f92=typeof _0x5df8c9[_0x88da('0x15')]===_0x88da('0x16')&&typeof _0x5df8c9[_0x88da('0x17')]===_0x88da('0x16');var _0x4ef62b=_0x49a882[_0x88da('0x18')];var _0x59e8b9=_0x5a9f92?0x0:_0x5df8c9['offset'];var _0x44581c=_0x5a9f92?_0x49a882[_0x88da('0x18')]:_0x5df8c9['offset']+_0x5df8c9['limit'];var _0x2930aa;if(_0x44581c>=_0x4ef62b){_0x44581c=_0x4ef62b;_0x2930aa=0xc8;}else{_0x2930aa=0xce;}_0x23f848[_0x88da('0x14')](_0x2930aa);return _0x23f848[_0x88da('0x19')]('Content-Range',_0x59e8b9+'-'+_0x44581c+'/'+_0x4ef62b)[_0x88da('0x1a')](_0x49a882);}return null;};}function saveUpdates(_0xa20d60){return function(_0x31891f){if(_0x31891f){return _0x31891f['update'](_0xa20d60)[_0x88da('0x1b')](function(_0x140a0c){return _0x140a0c;});}return null;};}function removeEntity(_0x59b4a7){return function(_0x5dbd1a){if(_0x5dbd1a){return _0x5dbd1a[_0x88da('0x1c')]()[_0x88da('0x1b')](function(){_0x59b4a7[_0x88da('0x14')](0xcc)[_0x88da('0x1d')]();});}};}function handleEntityNotFound(_0x5a939b){return function(_0x7902ef){if(!_0x7902ef){_0x5a939b[_0x88da('0x13')](0x194);}return _0x7902ef;};}function handleError(_0x3a85bd,_0x5aae94){_0x5aae94=_0x5aae94||0x1f4;return function(_0x37ed97){logger[_0x88da('0x1e')](_0x37ed97[_0x88da('0x1f')]);if(_0x37ed97[_0x88da('0x20')]){delete _0x37ed97[_0x88da('0x20')];}_0x3a85bd['status'](_0x5aae94)[_0x88da('0x21')](_0x37ed97);};}exports[_0x88da('0x22')]=function(_0x20f60b,_0x1e266e){var _0x5787ab={};var _0xecd86f=_[_0x88da('0x23')](db[_0x88da('0x24')][_0x88da('0x25')],function(_0x57077a){return{'name':_0x57077a['fieldName'],'type':_0x57077a[_0x88da('0x26')]['key']};});_0x5787ab=qs[_0x88da('0x27')](_0xecd86f,_0x20f60b);return interaction[_0x88da('0x28')](_0x88da('0x29'),_0x20f60b[_0x88da('0x2a')],_0x20f60b[_0x88da('0x2b')],_0x5787ab,_0xecd86f)['then'](respondWithFilteredResult(_0x1e266e,_0x5787ab))[_0x88da('0x2c')](handleError(_0x1e266e,null));};exports[_0x88da('0x2d')]=function(_0x5e2370,_0x58ffde){var _0x792c52={'raw':![],'where':{'id':_0x5e2370[_0x88da('0x2e')]['id']}},_0x55964a={};_0x55964a[_0x88da('0x2f')]=_[_0x88da('0x30')](db['WhatsappInteraction'][_0x88da('0x25')]);_0x55964a['query']=_[_0x88da('0x30')](_0x5e2370[_0x88da('0x2a')]);_0x55964a[_0x88da('0x31')]=_['intersection'](_0x55964a['model'],_0x55964a['query']);_0x792c52[_0x88da('0x32')]=_[_0x88da('0x33')](_0x55964a[_0x88da('0x2f')],qs[_0x88da('0x34')](_0x5e2370[_0x88da('0x2a')][_0x88da('0x34')]));_0x792c52[_0x88da('0x32')]=_0x792c52['attributes'][_0x88da('0x35')]?_0x792c52['attributes']:_0x55964a[_0x88da('0x2f')];if(_0x5e2370[_0x88da('0x2a')][_0x88da('0x36')]){_0x792c52['include']=[{'all':!![]}];}_0x792c52=_['merge']({},_0x792c52,_0x5e2370[_0x88da('0x37')]);return db[_0x88da('0x24')]['find'](_0x792c52)['then'](handleEntityNotFound(_0x58ffde,null))[_0x88da('0x1b')](respondWithResult(_0x58ffde,null))[_0x88da('0x2c')](handleError(_0x58ffde,null));};exports['create']=function(_0x38d46a,_0x4f8217){return db['WhatsappInteraction'][_0x88da('0x38')](_0x38d46a[_0x88da('0x39')],{})['then'](respondWithResult(_0x4f8217,0xc9))[_0x88da('0x2c')](handleError(_0x4f8217,null));};exports[_0x88da('0x3a')]=function(_0x392339,_0xebd2c2){if(_0x392339[_0x88da('0x39')]['id']){delete _0x392339[_0x88da('0x39')]['id'];}return db[_0x88da('0x24')][_0x88da('0x3b')]({'where':{'id':_0x392339[_0x88da('0x2e')]['id']}})['then'](handleEntityNotFound(_0xebd2c2,null))[_0x88da('0x1b')](saveUpdates(_0x392339['body'],null))[_0x88da('0x1b')](respondWithResult(_0xebd2c2,null))[_0x88da('0x2c')](handleError(_0xebd2c2,null));};exports[_0x88da('0x1c')]=function(_0x330605,_0x115909){return db['WhatsappInteraction'][_0x88da('0x3b')]({'where':{'id':_0x330605[_0x88da('0x2e')]['id']}})[_0x88da('0x1b')](handleEntityNotFound(_0x115909,null))['then'](removeEntity(_0x115909,null))['catch'](handleError(_0x115909,null));};exports['describe']=function(_0x1ef67e,_0x3e5768){return db[_0x88da('0x24')][_0x88da('0x3c')]()[_0x88da('0x1b')](respondWithResult(_0x3e5768,null))['catch'](handleError(_0x3e5768,null));};exports['addMessage']=function(_0xe88b87,_0x264c39){return db['WhatsappMessage']['find']({'where':{'id':_0xe88b87[_0x88da('0x2e')]['id']}})['then'](handleEntityNotFound(_0x264c39,null))[_0x88da('0x1b')](function(_0x7ec826){if(_0x7ec826){return _0x7ec826['addMessage'](_0xe88b87[_0x88da('0x39')][_0x88da('0x3d')],_[_0x88da('0x3e')](_0xe88b87[_0x88da('0x39')],[_0x88da('0x3d'),'id'])||{});}})[_0x88da('0x1b')](respondWithResult(_0x264c39,null))[_0x88da('0x2c')](handleError(_0x264c39,null));};exports[_0x88da('0x3f')]=function(_0x564b9c,_0x13b6f1){var _0x4f9015={'raw':![],'where':{}};var _0x25e0b0={};var _0x154b8f={'count':0x0,'rows':[]};return db[_0x88da('0x24')][_0x88da('0x40')]({'where':{'id':_0x564b9c['params']['id']}})[_0x88da('0x1b')](handleEntityNotFound(_0x13b6f1,null))['then'](function(_0x13bd6c){if(_0x13bd6c){_0x25e0b0[_0x88da('0x2f')]=_[_0x88da('0x30')](db[_0x88da('0x41')]['rawAttributes']);_0x25e0b0['query']=_[_0x88da('0x30')](_0x564b9c['query']);_0x25e0b0[_0x88da('0x31')]=_[_0x88da('0x33')](_0x25e0b0[_0x88da('0x2f')],_0x25e0b0[_0x88da('0x2a')]);_0x4f9015[_0x88da('0x32')]=_['intersection'](_0x25e0b0[_0x88da('0x2f')],qs[_0x88da('0x34')](_0x564b9c[_0x88da('0x2a')][_0x88da('0x34')]));_0x4f9015[_0x88da('0x32')]=_0x4f9015[_0x88da('0x32')][_0x88da('0x35')]?_0x4f9015['attributes']:_0x25e0b0[_0x88da('0x2f')];if(!_0x564b9c[_0x88da('0x2a')][_0x88da('0x42')](_0x88da('0x43'))){_0x4f9015['limit']=qs[_0x88da('0x17')](_0x564b9c[_0x88da('0x2a')][_0x88da('0x17')]);_0x4f9015[_0x88da('0x15')]=qs[_0x88da('0x15')](_0x564b9c[_0x88da('0x2a')][_0x88da('0x15')]);}_0x4f9015[_0x88da('0x44')]=qs[_0x88da('0x45')](_0x564b9c['query'][_0x88da('0x45')]);_0x4f9015[_0x88da('0x46')]=qs[_0x88da('0x31')](_[_0x88da('0x47')](_0x564b9c[_0x88da('0x2a')],_0x25e0b0[_0x88da('0x31')]));_0x4f9015[_0x88da('0x46')][_0x88da('0x48')]=_0x13bd6c['id'];if(_0x564b9c[_0x88da('0x2a')][_0x88da('0x49')]){_0x4f9015[_0x88da('0x46')]=_[_0x88da('0x4a')](_0x4f9015[_0x88da('0x46')],{'$or':_['map'](_0x4f9015['attributes'],function(_0x3a9a11){var _0x52534a={};_0x52534a[_0x3a9a11]={'$like':'%'+_0x564b9c[_0x88da('0x2a')]['filter']+'%'};return _0x52534a;})});}if(_0x564b9c[_0x88da('0x2a')]['$gte']){var _0x11f719=_0x564b9c[_0x88da('0x2a')]['$gte'][_0x88da('0x4b')](',');var _0x4186cb={};_0x4186cb[_0x11f719[0x0]]={'$gte':moment(_0x11f719[0x1])[_0x88da('0x4c')](_0x88da('0x4d'))};_0x4f9015[_0x88da('0x46')]=_[_0x88da('0x4a')](_0x4f9015[_0x88da('0x46')],_0x4186cb);}_0x4f9015=_[_0x88da('0x4a')]({},_0x4f9015,_0x564b9c[_0x88da('0x37')]);return db[_0x88da('0x41')][_0x88da('0x18')]({'where':_0x4f9015[_0x88da('0x46')]})[_0x88da('0x1b')](function(_0x3e2505){_0x154b8f[_0x88da('0x18')]=_0x3e2505;if(_0x564b9c[_0x88da('0x2a')]['includeAll']){_0x4f9015[_0x88da('0x4e')]=[{'all':!![]}];}return db[_0x88da('0x41')][_0x88da('0x28')](_0x4f9015);})['then'](function(_0x106923){_0x154b8f['rows']=_0x106923;return _0x154b8f;});}})[_0x88da('0x1b')](respondWithFilteredResult(_0x13b6f1,_0x4f9015))[_0x88da('0x2c')](handleError(_0x13b6f1,null));};exports[_0x88da('0x4f')]=function(_0x181b75,_0x3020d4){return db[_0x88da('0x24')][_0x88da('0x3b')]({'where':{'id':_0x181b75[_0x88da('0x2e')]['id']}})[_0x88da('0x1b')](handleEntityNotFound(_0x3020d4,null))['then'](function(_0x12e8d0){if(_0x12e8d0){return _0x12e8d0[_0x88da('0x50')](_0x181b75['body'][_0x88da('0x3d')],_['omit'](_0x181b75[_0x88da('0x39')],[_0x88da('0x3d'),'id'])||{})[_0x88da('0x51')](function(){return db[_0x88da('0x52')][_0x88da('0x28')]({'attributes':['id',_0x88da('0x20'),_0x88da('0x53')],'where':{'id':_0x181b75[_0x88da('0x39')][_0x88da('0x3d')]}});})[_0x88da('0x1b')](function(_0x86b5a7){socket[_0x88da('0x54')]('whatsappInteractionTags:save',{'id':Number(_0x181b75['params']['id']),'tags':_0x86b5a7||[]});return{'id':Number(_0x181b75[_0x88da('0x2e')]['id']),'tags':_0x86b5a7||[]};});}})['then'](respondWithResult(_0x3020d4,null))[_0x88da('0x2c')](handleError(_0x3020d4,null));};exports[_0x88da('0x55')]=function(_0x56ba54,_0x503e7e){return db[_0x88da('0x24')][_0x88da('0x3b')]({'where':{'id':_0x56ba54[_0x88da('0x2e')]['id']}})['then'](handleEntityNotFound(_0x503e7e,null))[_0x88da('0x1b')](function(_0x4ba35a){if(_0x4ba35a){return _0x4ba35a[_0x88da('0x55')](_0x56ba54[_0x88da('0x2a')][_0x88da('0x3d')]);}})[_0x88da('0x1b')](respondWithStatusCode(_0x503e7e,null))[_0x88da('0x2c')](handleError(_0x503e7e,null));};exports[_0x88da('0x56')]=function(_0x2d7ae2,_0x2c3a6f){var _0x2c7260=moment()[_0x88da('0x57')]()[_0x88da('0x58')]();var _0x335bf9=path[_0x88da('0x59')](config[_0x88da('0x5a')],_0x88da('0x5b'),_0x88da('0x5c'),_0x88da('0x5d'));var _0x57ace8=path[_0x88da('0x59')](config['root'],'server',_0x88da('0x5c'),_0x88da('0x5e'));var _0x7f78e2=path['join'](_0x335bf9,_0x2c7260);var _0x273dd8=util[_0x88da('0x4c')](_0x88da('0x5f'),_0x2d7ae2[_0x88da('0x2e')]['id'],_0x2c7260);var _0x2af952=path['join'](_0x335bf9,_0x273dd8);var _0x4573b3=[];_0x4573b3[_0x88da('0x60')]({'model':db[_0x88da('0x61')],'as':_0x88da('0x61'),'attributes':['id',_0x88da('0x62')],'raw':!![]});_0x4573b3[_0x88da('0x60')]({'model':db[_0x88da('0x63')],'as':_0x88da('0x64'),'attributes':['id','firstName',_0x88da('0x65')],'raw':!![]});if(_0x2d7ae2[_0x88da('0x2a')][_0x88da('0x5e')]){_0x4573b3[_0x88da('0x60')]({'model':db[_0x88da('0x66')],'as':_0x88da('0x66'),'raw':!![]});}var _0x4cfa60=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0x88da('0x67'),'direction',_0x88da('0x68'),_0x88da('0x69')],'include':_0x4573b3}];_0x4cfa60[_0x88da('0x60')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x88da('0x20')]});_0x4cfa60[_0x88da('0x60')]({'model':db[_0x88da('0x61')],'as':_0x88da('0x6a'),'attributes':['id',_0x88da('0x62')]});return db[_0x88da('0x24')][_0x88da('0x3b')]({'where':{'id':_0x2d7ae2['params']['id']},'include':_0x4cfa60})[_0x88da('0x1b')](handleEntityNotFound(_0x2c3a6f,null))[_0x88da('0x1b')](function(_0x1bcaba){if(_0x1bcaba){var _0x4f044a=_0x1bcaba[_0x88da('0x6b')]({'plain':!![]});fs[_0x88da('0x6c')](_0x7f78e2);var _0x5b9b93={'channel':'Whatsapp','account':_0x4f044a[_0x88da('0x6d')][_0x88da('0x20')],'agent':_0x4f044a[_0x88da('0x6a')]?_0x4f044a[_0x88da('0x6a')]['fullname']:_0x88da('0x6e'),'createdAt':moment(_0x4f044a[_0x88da('0x67')])[_0x88da('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4f044a[_0x88da('0x6f')]?moment(_0x4f044a[_0x88da('0x70')])[_0x88da('0x4c')](_0x88da('0x4d'))['toString']():'','disposition':_0x4f044a[_0x88da('0x71')],'messages':_(_0x4f044a[_0x88da('0x72')])[_0x88da('0x49')]({'secret':![]})[_0x88da('0x23')](function(_0x485f0f){if(_0x485f0f[_0x88da('0x66')]){var _0x1e9f56=path[_0x88da('0x59')](_0x57ace8,_0x485f0f[_0x88da('0x66')][_0x88da('0x73')]);if(fs[_0x88da('0x74')](_0x1e9f56)){fs[_0x88da('0x75')](_0x1e9f56)['pipe'](fs[_0x88da('0x76')](path['join'](_0x7f78e2,_0x485f0f['Attachment'][_0x88da('0x73')])));}}return{'date':moment(_0x485f0f[_0x88da('0x67')])[_0x88da('0x4c')](_0x88da('0x4d'))['toString'](),'sender':_0x485f0f[_0x88da('0x77')]===_0x88da('0x78')?_0x485f0f[_0x88da('0x61')]?_0x485f0f[_0x88da('0x61')][_0x88da('0x62')]:'System':_0x485f0f['Contact'][_0x88da('0x79')]+(_0x485f0f[_0x88da('0x64')]['lastName']?'\x20'+_0x485f0f[_0x88da('0x64')]['lastName']:''),'body':_0x485f0f[_0x88da('0x66')]?_0x485f0f['Attachment'][_0x88da('0x73')]:_0x485f0f[_0x88da('0x39')],'direction':_0x485f0f[_0x88da('0x77')]===_0x88da('0x78')?'A':'C','secret':_0x485f0f['secret'],'read':_0x485f0f[_0x88da('0x69')],'attachment':_0x485f0f[_0x88da('0x66')]};})['value']()};return ejs[_0x88da('0x7a')](path[_0x88da('0x59')](config[_0x88da('0x5a')],_0x88da('0x5b'),_0x88da('0x7b'),_0x88da('0x7c')),{'interaction':_0x5b9b93})[_0x88da('0x1b')](function(_0xec3e99){var _0x9d6dcf=path['join'](_0x7f78e2,'transcript-'+_0x4f044a['id']+'-'+_0x2c7260+_0x88da('0x7d'));var _0x342d8e={'path':_0x9d6dcf,'channel':_0x88da('0x7e'),'interactionId':_0x4f044a['id']};return pdf['createPdfFromHTML'](_0xec3e99,_0x342d8e);})[_0x88da('0x1b')](function(){return new BPromise(function(_0x3096bf,_0x406414){zipdir(_0x7f78e2,{'saveTo':_0x2af952},function(_0x15a9b0,_0x4b6e04){if(_0x15a9b0)return _0x406414(_0x15a9b0);return _0x3096bf(_0x4b6e04);});})[_0x88da('0x1b')](function(){return new BPromise(function(_0x31f591,_0x278ea4){rimraf(_0x7f78e2,function(_0x552c65){if(_0x552c65)_0x278ea4(_0x552c65);return _0x31f591();});});})[_0x88da('0x1b')](function(){return _0x2c3a6f[_0x88da('0x56')](_0x2af952,_0x273dd8,function(_0x1245de){if(_0x1245de){console['log'](_0x88da('0x7f'),_0x1245de);}else{fs[_0x88da('0x80')](_0x2af952);}});});});}else{return _0x2c3a6f['sendStatus'](0xc8);}})['catch'](handleError(_0x2c3a6f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index c737636..3aa697d 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 _0x8b2b=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x2f7dda,_0x55b113){_0x2f7dda=_0x2f7dda-0x0;var _0x29dc08=_0x8b2b[_0x2f7dda];return _0x29dc08;};'use strict';var EventEmitter=require(_0xb8b2('0x0'));var WhatsappInteraction=require(_0xb8b2('0x1'))['db'][_0xb8b2('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xb8b2('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb8b2('0x4')](0x0);var events={'afterCreate':_0xb8b2('0x5'),'afterUpdate':_0xb8b2('0x6'),'afterDestroy':_0xb8b2('0x7')};function emitEvent(_0x2928a7){return function(_0x570c5d,_0x5bf172,_0xba7734){_0x570c5d[_0xb8b2('0x8')]({'attributes':['id'],'raw':!![]})[_0xb8b2('0x9')](function(_0x3590c8){_0x570c5d['setDataValue']('Users',_0x3590c8[_0xb8b2('0xa')](function(_0x1c8046){return{'id':_0x1c8046['id']};}));return WhatsappMessage[_0xb8b2('0xb')]({'where':{'WhatsappInteractionId':_0x570c5d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb8b2('0x9')](function(_0x3542b6){_0x570c5d['setDataValue'](_0xb8b2('0xc'),_0x3542b6['length']);WhatsappInteractionEvents['emit'](_0x2928a7+':'+_0x570c5d['id'],_0x570c5d);WhatsappInteractionEvents[_0xb8b2('0xd')](_0x2928a7,_0x570c5d);_0xba7734(null);})[_0xb8b2('0xe')](_0xba7734(null));};}for(var e in events){if(events[_0xb8b2('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb8b2('0x10')](e,emitEvent(event));}}module[_0xb8b2('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xc3b0=['WhatsappInteraction','save','update','getUsers','then','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x375602,_0x1d8b5e){var _0x360436=function(_0x494946){while(--_0x494946){_0x375602['push'](_0x375602['shift']());}};_0x360436(++_0x1d8b5e);}(_0xc3b0,0x166));var _0x0c3b=function(_0x1ccd5a,_0x592a64){_0x1ccd5a=_0x1ccd5a-0x0;var _0x6f5d23=_0xc3b0[_0x1ccd5a];return _0x6f5d23;};'use strict';var EventEmitter=require(_0x0c3b('0x0'));var WhatsappInteraction=require(_0x0c3b('0x1'))['db'][_0x0c3b('0x2')];var WhatsappMessage=require(_0x0c3b('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0c3b('0x3'),'afterUpdate':_0x0c3b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b13c6){return function(_0x10f089,_0x3dd591,_0x5ba7f1){_0x10f089[_0x0c3b('0x5')]({'attributes':['id'],'raw':!![]})[_0x0c3b('0x6')](function(_0x8e628a){_0x10f089['setDataValue']('Users',_0x8e628a['map'](function(_0x12a1e0){return{'id':_0x12a1e0['id']};}));return WhatsappMessage[_0x0c3b('0x7')]({'where':{'WhatsappInteractionId':_0x10f089['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0c3b('0x6')](function(_0x2062dd){_0x10f089[_0x0c3b('0x8')](_0x0c3b('0x9'),_0x2062dd[_0x0c3b('0xa')]);WhatsappInteractionEvents[_0x0c3b('0xb')](_0x2b13c6+':'+_0x10f089['id'],_0x10f089);WhatsappInteractionEvents[_0x0c3b('0xb')](_0x2b13c6,_0x10f089);_0x5ba7f1(null);})[_0x0c3b('0xc')](_0x5ba7f1(null));};}for(var e in events){if(events[_0x0c3b('0xd')](e)){var event=events[e];WhatsappInteraction[_0x0c3b('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c29e3c8..1731fd7 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 _0x1f92=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise','path','rimraf'];(function(_0x546a8a,_0x178ab4){var _0x33d008=function(_0x3c7227){while(--_0x3c7227){_0x546a8a['push'](_0x546a8a['shift']());}};_0x33d008(++_0x178ab4);}(_0x1f92,0x1ad));var _0x21f9=function(_0x2bf893,_0x4cd1b2){_0x2bf893=_0x2bf893-0x0;var _0x47daf7=_0x1f92[_0x2bf893];return _0x47daf7;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var logger=require(_0x21f9('0x1'))(_0x21f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21f9('0x3'));var fs=require('fs');var path=require(_0x21f9('0x4'));var rimraf=require(_0x21f9('0x5'));var config=require(_0x21f9('0x6'));var attributes=require(_0x21f9('0x7'));module[_0x21f9('0x8')]=function(_0x259f4e,_0x3be0f2){return _0x259f4e[_0x21f9('0x9')](_0x21f9('0xa'),attributes,{'tableName':_0x21f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x261881,_0x4abee7,_0x43d2ab){if(_0x261881[_0x21f9('0xc')](_0x21f9('0xd'))){_0x261881['closedAt']=moment()['format'](_0x21f9('0xe'));}_0x43d2ab(null,_0x261881);}}});}; \ No newline at end of file +var _0x8d43=['format','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x3e78f4,_0x5d4c9a){var _0x5ca5eb=function(_0x1161b6){while(--_0x1161b6){_0x3e78f4['push'](_0x3e78f4['shift']());}};_0x5ca5eb(++_0x5d4c9a);}(_0x8d43,0xd1));var _0x38d4=function(_0x2bdf32,_0x3331e5){_0x2bdf32=_0x2bdf32-0x0;var _0x3f2a0c=_0x8d43[_0x2bdf32];return _0x3f2a0c;};'use strict';var _=require(_0x38d4('0x0'));var util=require(_0x38d4('0x1'));var logger=require(_0x38d4('0x2'))(_0x38d4('0x3'));var moment=require(_0x38d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x38d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38d4('0x6'));var config=require(_0x38d4('0x7'));var attributes=require(_0x38d4('0x8'));module['exports']=function(_0x9e045a,_0x234ac9){return _0x9e045a[_0x38d4('0x9')](_0x38d4('0xa'),attributes,{'tableName':_0x38d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f454c,_0x5e1872,_0xce318f){if(_0x3f454c[_0x38d4('0xc')](_0x38d4('0xd'))){_0x3f454c[_0x38d4('0xe')]=moment()[_0x38d4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0xce318f(null,_0x3f454c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 095772a..a5af768 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 _0x6603=['register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','stringify','find','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0x6603,0x6a));var _0x3660=function(_0x512b62,_0x14df68){_0x512b62=_0x512b62-0x0;var _0x18b39e=_0x6603[_0x512b62];return _0x18b39e;};'use strict';var _=require('lodash');var util=require(_0x3660('0x0'));var moment=require(_0x3660('0x1'));var BPromise=require('bluebird');var rs=require(_0x3660('0x2'));var fs=require('fs');var Redis=require(_0x3660('0x3'));var db=require(_0x3660('0x4'))['db'];var utils=require(_0x3660('0x5'));var logger=require(_0x3660('0x6'))(_0x3660('0x7'));var config=require('../../config/environment');var jayson=require(_0x3660('0x8'));var client=jayson['client'][_0x3660('0x9')]({'port':0x232a});config[_0x3660('0xa')]=_[_0x3660('0xb')](config['redis'],{'host':_0x3660('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3660('0xa')]));require(_0x3660('0xd'))[_0x3660('0xe')](socket);function respondWithRpcPromise(_0x4abc4d,_0x335571,_0x2b15c9){return new BPromise(function(_0x12d1f1,_0x495252){return client[_0x3660('0xf')](_0x4abc4d,_0x2b15c9)[_0x3660('0x10')](function(_0x54730c){logger[_0x3660('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,'request\x20sent');logger[_0x3660('0x12')](_0x3660('0x13'),_0x335571,_0x3660('0x14'),JSON['stringify'](_0x54730c));if(_0x54730c['error']){if(_0x54730c[_0x3660('0x15')][_0x3660('0x16')]===0x1f4){logger[_0x3660('0x15')](_0x3660('0x17'),_0x335571,_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);return _0x495252(_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);}logger[_0x3660('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,_0x54730c[_0x3660('0x15')]['message']);return _0x12d1f1(_0x54730c[_0x3660('0x15')][_0x3660('0x18')]);}else{logger[_0x3660('0x11')](_0x3660('0x17'),_0x335571,'request\x20sent');_0x12d1f1(_0x54730c[_0x3660('0x19')][_0x3660('0x18')]);}})['catch'](function(_0x40b148){logger[_0x3660('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x335571,_0x40b148);_0x495252(_0x40b148);});});}exports[_0x3660('0x1a')]=function(_0x570c0b){var _0x13bdc4=this;return new Promise(function(_0x370375,_0x5d0e99){return db[_0x3660('0x1b')][_0x3660('0x1c')](_0x570c0b[_0x3660('0x1d')],{'raw':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x1f')]||null:null,'attributes':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x20')]||null:null,'limit':_0x570c0b[_0x3660('0x1e')]?_0x570c0b[_0x3660('0x1e')][_0x3660('0x21')]||null:null})[_0x3660('0x10')](function(_0x337ce6){logger['info'](_0x3660('0x1a'),_0x570c0b);logger[_0x3660('0x12')](_0x3660('0x1a'),_0x570c0b,JSON[_0x3660('0x22')](_0x337ce6));_0x370375(_0x337ce6);})['catch'](function(_0x2bcd28){logger[_0x3660('0x15')]('UpdateWhatsappInteraction',_0x2bcd28['message'],_0x570c0b);_0x5d0e99(_0x13bdc4[_0x3660('0x15')](0x1f4,_0x2bcd28[_0x3660('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x9d5eb0){return new Promise(function(_0x581cce,_0x3cca4d){return db[_0x3660('0x1b')][_0x3660('0x23')]({'where':_0x9d5eb0[_0x3660('0x1e')]?_0x9d5eb0[_0x3660('0x1e')][_0x3660('0x1f')]||null:null})[_0x3660('0x10')](function(_0x343eb6){if(_0x343eb6){return _0x343eb6[_0x3660('0x24')](_0x9d5eb0[_0x3660('0x1d')]['ids'],_['omit'](_0x9d5eb0[_0x3660('0x1d')],[_0x3660('0x25'),'id'])||{});}})[_0x3660('0x26')](function(_0x2e7d8e){logger['info']('AddTags',_0x9d5eb0);logger[_0x3660('0x12')](_0x3660('0x27'),_0x9d5eb0,JSON['stringify'](_0x2e7d8e));_0x581cce(_0x2e7d8e);})['catch'](function(_0x326c45){logger[_0x3660('0x15')](_0x3660('0x27'),_0x326c45['message'],_0x9d5eb0);_0x3cca4d(_this[_0x3660('0x15')](0x1f4,_0x326c45[_0x3660('0x18')]));});});}; \ No newline at end of file +var _0x81e3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','then','addTags','body','omit','ids','AddTags','moment','bluebird','randomstring'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x81e3,0x1e9));var _0x381e=function(_0x5ebec4,_0x474731){_0x5ebec4=_0x5ebec4-0x0;var _0x3b9d3b=_0x81e3[_0x5ebec4];return _0x3b9d3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x381e('0x0'));var BPromise=require(_0x381e('0x1'));var rs=require(_0x381e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x381e('0x3'))['db'];var utils=require(_0x381e('0x4'));var logger=require(_0x381e('0x5'))(_0x381e('0x6'));var config=require(_0x381e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x381e('0x8')][_0x381e('0x9')]({'port':0x232a});config[_0x381e('0xa')]=_[_0x381e('0xb')](config[_0x381e('0xa')],{'host':_0x381e('0xc'),'port':0x18eb});var socket=require(_0x381e('0xd'))(new Redis(config[_0x381e('0xa')]));require(_0x381e('0xe'))[_0x381e('0xf')](socket);function respondWithRpcPromise(_0x4f939b,_0x41f377,_0x23a28a){return new BPromise(function(_0x25821b,_0x38fd01){return client['request'](_0x4f939b,_0x23a28a)['then'](function(_0xe08293){logger[_0x381e('0x10')](_0x381e('0x11'),_0x41f377,_0x381e('0x12'));logger[_0x381e('0x13')](_0x381e('0x14'),_0x41f377,_0x381e('0x12'),JSON[_0x381e('0x15')](_0xe08293));if(_0xe08293['error']){if(_0xe08293[_0x381e('0x16')]['code']===0x1f4){logger['error'](_0x381e('0x11'),_0x41f377,_0xe08293['error']['message']);return _0x38fd01(_0xe08293[_0x381e('0x16')][_0x381e('0x17')]);}logger[_0x381e('0x16')](_0x381e('0x11'),_0x41f377,_0xe08293['error'][_0x381e('0x17')]);return _0x25821b(_0xe08293[_0x381e('0x16')][_0x381e('0x17')]);}else{logger[_0x381e('0x10')](_0x381e('0x11'),_0x41f377,'request\x20sent');_0x25821b(_0xe08293[_0x381e('0x18')][_0x381e('0x17')]);}})[_0x381e('0x19')](function(_0x406932){logger[_0x381e('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x41f377,_0x406932);_0x38fd01(_0x406932);});});}exports[_0x381e('0x1a')]=function(_0x4fccb1){var _0x1c6cec=this;return new Promise(function(_0x373561,_0x248a57){return db[_0x381e('0x1b')]['update'](_0x4fccb1['body'],{'raw':_0x4fccb1[_0x381e('0x1c')]?_0x4fccb1['options'][_0x381e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fccb1[_0x381e('0x1c')]?_0x4fccb1[_0x381e('0x1c')]['where']||null:null,'attributes':_0x4fccb1[_0x381e('0x1c')]?_0x4fccb1[_0x381e('0x1c')][_0x381e('0x1e')]||null:null,'limit':_0x4fccb1[_0x381e('0x1c')]?_0x4fccb1[_0x381e('0x1c')][_0x381e('0x1f')]||null:null})['then'](function(_0x266435){logger[_0x381e('0x10')](_0x381e('0x1a'),_0x4fccb1);logger[_0x381e('0x13')]('UpdateWhatsappInteraction',_0x4fccb1,JSON[_0x381e('0x15')](_0x266435));_0x373561(_0x266435);})['catch'](function(_0xef7a2f){logger[_0x381e('0x16')]('UpdateWhatsappInteraction',_0xef7a2f['message'],_0x4fccb1);_0x248a57(_0x1c6cec[_0x381e('0x16')](0x1f4,_0xef7a2f[_0x381e('0x17')]));});});};exports[_0x381e('0x20')]=function(_0x7be93d){return new Promise(function(_0x482488,_0x212376){return db[_0x381e('0x1b')][_0x381e('0x21')]({'where':_0x7be93d[_0x381e('0x1c')]?_0x7be93d[_0x381e('0x1c')][_0x381e('0x22')]||null:null})[_0x381e('0x23')](function(_0x84ad37){if(_0x84ad37){return _0x84ad37[_0x381e('0x24')](_0x7be93d[_0x381e('0x25')]['ids'],_[_0x381e('0x26')](_0x7be93d[_0x381e('0x25')],[_0x381e('0x27'),'id'])||{});}})['spread'](function(_0x4291b9){logger[_0x381e('0x10')](_0x381e('0x28'),_0x7be93d);logger[_0x381e('0x13')]('AddTags',_0x7be93d,JSON[_0x381e('0x15')](_0x4291b9));_0x482488(_0x4291b9);})['catch'](function(_0x4e3e4a){logger[_0x381e('0x16')](_0x381e('0x28'),_0x4e3e4a[_0x381e('0x17')],_0x7be93d);_0x212376(_this[_0x381e('0x16')](0x1f4,_0x4e3e4a[_0x381e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 34ff2db..8ef31b9 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 _0xc3f7=['emit','removeListener','register','whatsappInteraction:','remove','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc3f7,0x1c6));var _0x7c3f=function(_0x4d4a75,_0x513936){_0x4d4a75=_0x4d4a75-0x0;var _0x28a512=_0xc3f7[_0x4d4a75];return _0x28a512;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x7c3f('0x0'),_0x7c3f('0x1')];function createListener(_0x436621,_0x49dfe0){return function(_0x3fccaf){_0x49dfe0[_0x7c3f('0x2')](_0x436621,_0x3fccaf);};}function removeListener(_0x3c8039,_0xfb6553){return function(){WhatsappInteractionEvents[_0x7c3f('0x3')](_0x3c8039,_0xfb6553);};}exports[_0x7c3f('0x4')]=function(_0x2b7e35){for(var _0x79f8c=0x0,_0xb45014=events['length'];_0x79f8c<_0xb45014;_0x79f8c++){var _0x47330b=events[_0x79f8c];var _0x32854d=createListener(_0x7c3f('0x5')+_0x47330b,_0x2b7e35);WhatsappInteractionEvents['on'](_0x47330b,_0x32854d);}}; \ No newline at end of file +var _0x51a2=['register','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5a676f,_0x4f798a){var _0x237b68=function(_0x18d338){while(--_0x18d338){_0x5a676f['push'](_0x5a676f['shift']());}};_0x237b68(++_0x4f798a);}(_0x51a2,0x7f));var _0x251a=function(_0x52d74c,_0x1e39a0){_0x52d74c=_0x52d74c-0x0;var _0x76b83d=_0x51a2[_0x52d74c];return _0x76b83d;};'use strict';var WhatsappInteractionEvents=require(_0x251a('0x0'));var events=[_0x251a('0x1'),_0x251a('0x2'),_0x251a('0x3')];function createListener(_0x590ddb,_0x3898dc){return function(_0x16581c){_0x3898dc[_0x251a('0x4')](_0x590ddb,_0x16581c);};}function removeListener(_0x39a0f6,_0x51b686){return function(){WhatsappInteractionEvents[_0x251a('0x5')](_0x39a0f6,_0x51b686);};}exports[_0x251a('0x6')]=function(_0x47d82c){for(var _0x1b23ff=0x0,_0x43649a=events['length'];_0x1b23ff<_0x43649a;_0x1b23ff++){var _0xed6e56=events[_0x1b23ff];var _0x4acf02=createListener('whatsappInteraction:'+_0xed6e56,_0x47d82c);WhatsappInteractionEvents['on'](_0xed6e56,_0x4acf02);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 81ae51f..69f853f 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 _0x46ce=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','whatsapp','create','post','/:id/status','status'];(function(_0x1b1dca,_0x3abce4){var _0x43bec8=function(_0x53995f){while(--_0x53995f){_0x1b1dca['push'](_0x1b1dca['shift']());}};_0x43bec8(++_0x3abce4);}(_0x46ce,0x1da));var _0xe46c=function(_0x4328fd,_0x5da64a){_0x4328fd=_0x4328fd-0x0;var _0x3fdaa7=_0x46ce[_0x4328fd];return _0x3fdaa7;};'use strict';var multer=require(_0xe46c('0x0'));var util=require(_0xe46c('0x1'));var path=require(_0xe46c('0x2'));var timeout=require(_0xe46c('0x3'));var express=require(_0xe46c('0x4'));var router=express[_0xe46c('0x5')]();var fs_extra=require(_0xe46c('0x6'));var auth=require(_0xe46c('0x7'));var interaction=require(_0xe46c('0x8'));var config=require(_0xe46c('0x9'));var controller=require('./whatsappMessage.controller');router[_0xe46c('0xa')]('/',auth[_0xe46c('0xb')](),controller[_0xe46c('0xc')]);router[_0xe46c('0xa')](_0xe46c('0xd'),auth['isAuthenticated'](),controller[_0xe46c('0xe')]);router['get'](_0xe46c('0xf'),auth['isAuthenticated'](),controller[_0xe46c('0x10')]);router['post']('/',auth[_0xe46c('0xb')](),interaction['tracked'](_0xe46c('0x11'),'whatsappmessage:create'),controller[_0xe46c('0x12')]);router[_0xe46c('0x13')](_0xe46c('0x14'),controller[_0xe46c('0x15')]);router[_0xe46c('0x16')]('/:id',auth[_0xe46c('0xb')](),controller[_0xe46c('0x17')]);router['put'](_0xe46c('0x18'),auth['isAuthenticated'](),controller[_0xe46c('0x19')]);router['put'](_0xe46c('0x1a'),auth[_0xe46c('0xb')](),controller[_0xe46c('0x1b')]);router[_0xe46c('0x1c')](_0xe46c('0xf'),auth[_0xe46c('0xb')](),controller[_0xe46c('0x1d')]);module[_0xe46c('0x1e')]=router; \ No newline at end of file +var _0xf02d=['reject','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','status','put','update','accept','/:id/reject'];(function(_0x2d1406,_0x8a575e){var _0x31a9fb=function(_0x35ac19){while(--_0x35ac19){_0x2d1406['push'](_0x2d1406['shift']());}};_0x31a9fb(++_0x8a575e);}(_0xf02d,0x1bd));var _0xdf02=function(_0x1d9eb1,_0x3b192c){_0x1d9eb1=_0x1d9eb1-0x0;var _0x56f5f0=_0xf02d[_0x1d9eb1];return _0x56f5f0;};'use strict';var multer=require(_0xdf02('0x0'));var util=require(_0xdf02('0x1'));var path=require(_0xdf02('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf02('0x3'));var router=express['Router']();var fs_extra=require(_0xdf02('0x4'));var auth=require(_0xdf02('0x5'));var interaction=require(_0xdf02('0x6'));var config=require('../../config/environment');var controller=require(_0xdf02('0x7'));router[_0xdf02('0x8')]('/',auth[_0xdf02('0x9')](),controller[_0xdf02('0xa')]);router[_0xdf02('0x8')](_0xdf02('0xb'),auth[_0xdf02('0x9')](),controller[_0xdf02('0xc')]);router[_0xdf02('0x8')](_0xdf02('0xd'),auth[_0xdf02('0x9')](),controller[_0xdf02('0xe')]);router[_0xdf02('0xf')]('/',auth[_0xdf02('0x9')](),interaction[_0xdf02('0x10')](_0xdf02('0x11'),'whatsappmessage:create'),controller['create']);router[_0xdf02('0xf')]('/:id/status',controller[_0xdf02('0x12')]);router[_0xdf02('0x13')]('/:id',auth[_0xdf02('0x9')](),controller[_0xdf02('0x14')]);router['put']('/:id/accept',auth[_0xdf02('0x9')](),controller[_0xdf02('0x15')]);router[_0xdf02('0x13')](_0xdf02('0x16'),auth[_0xdf02('0x9')](),controller[_0xdf02('0x17')]);router[_0xdf02('0x18')](_0xdf02('0xd'),auth['isAuthenticated'](),controller[_0xdf02('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index abfcc7e..4904645 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 _0x7248=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports','medium'];(function(_0x586064,_0x1ef061){var _0x3a48c4=function(_0x4c37bb){while(--_0x4c37bb){_0x586064['push'](_0x586064['shift']());}};_0x3a48c4(++_0x1ef061);}(_0x7248,0x1b6));var _0x8724=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0x7248[_0x3dd0b9];return _0x4c0351;};'use strict';var Sequelize=require(_0x8724('0x0'));module[_0x8724('0x1')]={'body':{'type':Sequelize['TEXT'](_0x8724('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8724('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8724('0x4')]('in',_0x8724('0x5')),'defaultValue':_0x8724('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8724('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8724('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8724('0x6')]},'providerResponse':{'type':Sequelize[_0x8724('0x8')]}}; \ No newline at end of file +var _0x9033=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x49c39e,_0x82a56f){var _0x335c24=function(_0x1b09d8){while(--_0x1b09d8){_0x49c39e['push'](_0x49c39e['shift']());}};_0x335c24(++_0x82a56f);}(_0x9033,0xf7));var _0x3903=function(_0x2a96b1,_0x4d3da1){_0x2a96b1=_0x2a96b1-0x0;var _0x57fcb9=_0x9033[_0x2a96b1];return _0x57fcb9;};'use strict';var Sequelize=require(_0x3903('0x0'));module['exports']={'body':{'type':Sequelize[_0x3903('0x1')](_0x3903('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3903('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3903('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3903('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3903('0x5')]},'readAt':{'type':Sequelize[_0x3903('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3903('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 027fe92..226c697 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 _0xa24f=['acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','internal','interface','event','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','name','send','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','catch','show','params','fields','include','find','create','body','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','contact','fullname','email','SIP/%s','channel','motionChannel','EventManager'];(function(_0x4ccd32,_0x3b11c9){var _0x30b693=function(_0x1b816f){while(--_0x1b816f){_0x4ccd32['push'](_0x4ccd32['shift']());}};_0x30b693(++_0x3b11c9);}(_0xa24f,0x1cc));var _0xfa24=function(_0x4553e8,_0x480e3c){_0x4553e8=_0x4553e8-0x0;var _0x99e41=_0xa24f[_0x4553e8];return _0x99e41;};'use strict';var emlformat=require(_0xfa24('0x0'));var rimraf=require(_0xfa24('0x1'));var zipdir=require(_0xfa24('0x2'));var jsonpatch=require(_0xfa24('0x3'));var rp=require(_0xfa24('0x4'));var moment=require(_0xfa24('0x5'));var BPromise=require(_0xfa24('0x6'));var Mustache=require(_0xfa24('0x7'));var util=require(_0xfa24('0x8'));var path=require('path');var sox=require(_0xfa24('0x9'));var csv=require(_0xfa24('0xa'));var ejs=require(_0xfa24('0xb'));var fs=require('fs');var fs_extra=require(_0xfa24('0xc'));var _=require(_0xfa24('0xd'));var squel=require(_0xfa24('0xe'));var crypto=require(_0xfa24('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xfa24('0x10'));var toCsv=require(_0xfa24('0xa'));var querystring=require(_0xfa24('0x11'));var Papa=require(_0xfa24('0x12'));var Redis=require(_0xfa24('0x13'));var authService=require(_0xfa24('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa24('0x15'));var logger=require('../../config/logger')(_0xfa24('0x16'));var utils=require(_0xfa24('0x17'));var config=require(_0xfa24('0x18'));var licenseUtil=require(_0xfa24('0x19'));var db=require(_0xfa24('0x1a'))['db'];config[_0xfa24('0x1b')]=_[_0xfa24('0x1c')](config[_0xfa24('0x1b')],{'host':_0xfa24('0x1d'),'port':0x18eb});var socket=require(_0xfa24('0x1e'))(new Redis(config[_0xfa24('0x1b')]));require('./whatsappMessage.socket')[_0xfa24('0x1f')](socket);var jayson=require(_0xfa24('0x20'));var client=jayson['client'][_0xfa24('0x21')]({'port':0x232c});var client9002=jayson[_0xfa24('0x22')][_0xfa24('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4141c7,_0xfb15ae,_0x40de67,_0x14db47){return new BPromise(function(_0x1ee827,_0x54e6f9){var _0x932a12=_0x14db47||client;return _0x932a12[_0xfa24('0x23')](_0x4141c7,_0x40de67)[_0xfa24('0x24')](function(_0x4f25c8){logger[_0xfa24('0x25')](_0xfa24('0x26'),_0xfb15ae,_0xfa24('0x27'));logger[_0xfa24('0x28')](_0xfa24('0x29'),_0xfb15ae,'request\x20sent',JSON[_0xfa24('0x2a')](_0x4f25c8));if(_0x4f25c8[_0xfa24('0x2b')]){if(_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2c')]===0x1f4){logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);return _0x54e6f9(_0x4f25c8[_0xfa24('0x2b')]['message']);}logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);return _0x1ee827(_0x4f25c8[_0xfa24('0x2b')][_0xfa24('0x2d')]);}else{logger[_0xfa24('0x25')](_0xfa24('0x26'),_0xfb15ae,_0xfa24('0x27'));_0x1ee827(_0x4f25c8[_0xfa24('0x2e')]['message']);}})['catch'](function(_0xc82b23){logger[_0xfa24('0x2b')](_0xfa24('0x26'),_0xfb15ae,_0xc82b23);_0x54e6f9(_0xc82b23);});});}function respondWithStatusCode(_0x27fca5,_0x494533){_0x494533=_0x494533||0xcc;return function(_0x390403){if(_0x390403){return _0x27fca5[_0xfa24('0x2f')](_0x494533);}return _0x27fca5[_0xfa24('0x30')](_0x494533)[_0xfa24('0x31')]();};}function respondWithResult(_0x5f197a,_0x12e90d){_0x12e90d=_0x12e90d||0xc8;return function(_0x1a468d){if(_0x1a468d){return _0x5f197a[_0xfa24('0x30')](_0x12e90d)[_0xfa24('0x32')](_0x1a468d);}};}function respondWithFilteredResult(_0x561e69,_0x46c0cf){return function(_0x201330){if(_0x201330){var _0xda18e3=typeof _0x46c0cf[_0xfa24('0x33')]==='undefined'&&typeof _0x46c0cf[_0xfa24('0x34')]===_0xfa24('0x35');var _0x5bba66=_0x201330[_0xfa24('0x36')];var _0x203887=_0xda18e3?0x0:_0x46c0cf[_0xfa24('0x33')];var _0x2e9cac=_0xda18e3?_0x201330['count']:_0x46c0cf[_0xfa24('0x33')]+_0x46c0cf[_0xfa24('0x34')];var _0x5960c2;if(_0x2e9cac>=_0x5bba66){_0x2e9cac=_0x5bba66;_0x5960c2=0xc8;}else{_0x5960c2=0xce;}_0x561e69['status'](_0x5960c2);return _0x561e69[_0xfa24('0x37')](_0xfa24('0x38'),_0x203887+'-'+_0x2e9cac+'/'+_0x5bba66)['json'](_0x201330);}return null;};}function patchUpdates(_0x197fff){return function(_0x1a4df1){try{jsonpatch[_0xfa24('0x39')](_0x1a4df1,_0x197fff,!![]);}catch(_0x5124e1){return BPromise['reject'](_0x5124e1);}return _0x1a4df1[_0xfa24('0x3a')]();};}function saveUpdates(_0x1440c5,_0x4c6eee){return function(_0x6f95ce){if(_0x6f95ce){return _0x6f95ce[_0xfa24('0x3b')](_0x1440c5)[_0xfa24('0x24')](function(_0x17026e){return _0x17026e;});}return null;};}function removeEntity(_0x533693,_0x574507){return function(_0x14c3a6){if(_0x14c3a6){return _0x14c3a6['destroy']()['then'](function(){_0x533693[_0xfa24('0x30')](0xcc)[_0xfa24('0x31')]();});}};}function handleEntityNotFound(_0x57afaa,_0xae401e){return function(_0x97787){if(!_0x97787){_0x57afaa[_0xfa24('0x2f')](0x194);}return _0x97787;};}function handleError(_0x589432,_0x46b097){_0x46b097=_0x46b097||0x1f4;return function(_0x47cda7){logger[_0xfa24('0x2b')](_0x47cda7['stack']);if(_0x47cda7['name']){delete _0x47cda7[_0xfa24('0x3c')];}_0x589432[_0xfa24('0x30')](_0x46b097)[_0xfa24('0x3d')](_0x47cda7);};}exports['index']=function(_0x5a3f4b,_0x4880fd){var _0x2e6ffd={},_0x1d9370={},_0x386409={'count':0x0,'rows':[]};var _0x517a7a=_['map'](db[_0xfa24('0x3e')][_0xfa24('0x3f')],function(_0x4bd2e9){return{'name':_0x4bd2e9[_0xfa24('0x40')],'type':_0x4bd2e9['type'][_0xfa24('0x41')]};});_0x1d9370[_0xfa24('0x42')]=_[_0xfa24('0x43')](_0x517a7a,_0xfa24('0x3c'));_0x1d9370[_0xfa24('0x44')]=_[_0xfa24('0x45')](_0x5a3f4b['query']);_0x1d9370[_0xfa24('0x46')]=_['intersection'](_0x1d9370[_0xfa24('0x42')],_0x1d9370[_0xfa24('0x44')]);_0x2e6ffd[_0xfa24('0x47')]=_[_0xfa24('0x48')](_0x1d9370[_0xfa24('0x42')],qs['fields'](_0x5a3f4b[_0xfa24('0x44')]['fields']));_0x2e6ffd[_0xfa24('0x47')]=_0x2e6ffd[_0xfa24('0x47')][_0xfa24('0x49')]?_0x2e6ffd[_0xfa24('0x47')]:_0x1d9370['model'];if(!_0x5a3f4b['query'][_0xfa24('0x4a')](_0xfa24('0x4b'))){_0x2e6ffd[_0xfa24('0x34')]=qs[_0xfa24('0x34')](_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x34')]);_0x2e6ffd['offset']=qs[_0xfa24('0x33')](_0x5a3f4b[_0xfa24('0x44')]['offset']);}_0x2e6ffd['order']=qs[_0xfa24('0x4c')](_0x5a3f4b[_0xfa24('0x44')]['sort']);_0x2e6ffd[_0xfa24('0x4d')]=qs['filters'](_[_0xfa24('0x4e')](_0x5a3f4b[_0xfa24('0x44')],_0x1d9370[_0xfa24('0x46')]),_0x517a7a);if(_0x5a3f4b[_0xfa24('0x44')]['filter']){_0x2e6ffd[_0xfa24('0x4d')]=_[_0xfa24('0x4f')](_0x2e6ffd[_0xfa24('0x4d')],{'$or':_[_0xfa24('0x43')](_0x517a7a,function(_0x49eec0){if(_0x49eec0[_0xfa24('0x50')]!=='VIRTUAL'){var _0x7b91bf={};_0x7b91bf[_0x49eec0[_0xfa24('0x3c')]]={'$like':'%'+_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x51')]+'%'};return _0x7b91bf;}})});}_0x2e6ffd=_[_0xfa24('0x4f')]({},_0x2e6ffd,_0x5a3f4b[_0xfa24('0x52')]);var _0x44fbd0={'where':_0x2e6ffd[_0xfa24('0x4d')]};return db[_0xfa24('0x3e')][_0xfa24('0x36')](_0x44fbd0)[_0xfa24('0x24')](function(_0x5a36f3){_0x386409[_0xfa24('0x36')]=_0x5a36f3;if(_0x5a3f4b[_0xfa24('0x44')][_0xfa24('0x53')]){_0x2e6ffd['include']=[{'all':!![]}];}return db[_0xfa24('0x3e')]['findAll'](_0x2e6ffd);})[_0xfa24('0x24')](function(_0x4086ab){_0x386409['rows']=_0x4086ab;return _0x386409;})[_0xfa24('0x24')](respondWithFilteredResult(_0x4880fd,_0x2e6ffd))[_0xfa24('0x54')](handleError(_0x4880fd,null));};exports[_0xfa24('0x55')]=function(_0x3befc8,_0x541b2e){var _0x35d7f8={'raw':!![],'where':{'id':_0x3befc8[_0xfa24('0x56')]['id']}},_0x35c3e9={};_0x35c3e9[_0xfa24('0x42')]=_[_0xfa24('0x45')](db['WhatsappMessage']['rawAttributes']);_0x35c3e9[_0xfa24('0x44')]=_[_0xfa24('0x45')](_0x3befc8[_0xfa24('0x44')]);_0x35c3e9[_0xfa24('0x46')]=_['intersection'](_0x35c3e9[_0xfa24('0x42')],_0x35c3e9[_0xfa24('0x44')]);_0x35d7f8['attributes']=_['intersection'](_0x35c3e9[_0xfa24('0x42')],qs['fields'](_0x3befc8['query'][_0xfa24('0x57')]));_0x35d7f8[_0xfa24('0x47')]=_0x35d7f8[_0xfa24('0x47')][_0xfa24('0x49')]?_0x35d7f8[_0xfa24('0x47')]:_0x35c3e9['model'];if(_0x3befc8['query']['includeAll']){_0x35d7f8[_0xfa24('0x58')]=[{'all':!![]}];}_0x35d7f8=_[_0xfa24('0x4f')]({},_0x35d7f8,_0x3befc8[_0xfa24('0x52')]);return db[_0xfa24('0x3e')][_0xfa24('0x59')](_0x35d7f8)[_0xfa24('0x24')](handleEntityNotFound(_0x541b2e,null))[_0xfa24('0x24')](respondWithResult(_0x541b2e,null))[_0xfa24('0x54')](handleError(_0x541b2e,null));};exports[_0xfa24('0x5a')]=function(_0x43bfe5,_0x1a8d75){return db[_0xfa24('0x3e')]['create'](_0x43bfe5[_0xfa24('0x5b')],{})[_0xfa24('0x24')](respondWithResult(_0x1a8d75,0xc9))['catch'](handleError(_0x1a8d75,null));};exports['update']=function(_0x46fa51,_0x135fae){if(_0x46fa51[_0xfa24('0x5b')]['id']){delete _0x46fa51[_0xfa24('0x5b')]['id'];}return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x46fa51['params']['id']}})['then'](handleEntityNotFound(_0x135fae,null))[_0xfa24('0x24')](saveUpdates(_0x46fa51[_0xfa24('0x5b')],null))[_0xfa24('0x24')](respondWithResult(_0x135fae,null))[_0xfa24('0x54')](handleError(_0x135fae,null));};exports[_0xfa24('0x5c')]=function(_0x175b08,_0x49ea7b){return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x175b08['params']['id']}})[_0xfa24('0x24')](handleEntityNotFound(_0x49ea7b,null))[_0xfa24('0x24')](removeEntity(_0x49ea7b,null))['catch'](handleError(_0x49ea7b,null));};exports[_0xfa24('0x5d')]=function(_0x42b303,_0x203550){return db[_0xfa24('0x3e')]['describe']()[_0xfa24('0x24')](respondWithResult(_0x203550,null))['catch'](handleError(_0x203550,null));};var interaction_log=require(_0xfa24('0x5e'))(_0xfa24('0x5f'));exports[_0xfa24('0x60')]=function(_0x3483a0,_0x142cde,_0x124bff){var _0x5f2fd9={'agent':{},'channel':_0xfa24('0x61')};if(_0x3483a0[_0xfa24('0x5b')]['id']){delete _0x3483a0['body']['id'];}_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x62')]=!![];_0x3483a0['body']['readAt']=moment()[_0xfa24('0x63')](_0xfa24('0x64'));_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')]=_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')]||_0x3483a0['user']['id'];_0x5f2fd9[_0xfa24('0x66')]['id']=_0x3483a0['body']['UserId'];return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x3483a0[_0xfa24('0x56')]['id'],'UserId':null}})[_0xfa24('0x24')](handleEntityNotFound(_0x142cde,null))[_0xfa24('0x24')](saveUpdates(_0x3483a0['body'],null))['then'](function(_0x18ee71){if(_0x18ee71){_0x5f2fd9[_0xfa24('0x2d')]=_0x18ee71[_0xfa24('0x67')]({'plain':!![]});return db[_0xfa24('0x68')][_0xfa24('0x59')]({'where':{'id':_0x18ee71['WhatsappInteractionId']}});}return null;})[_0xfa24('0x24')](handleEntityNotFound(_0x142cde,null))['then'](function(_0x51105e){if(_0x51105e){return _0x51105e[_0xfa24('0x3b')]({'UserId':_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')],'read1stAt':_[_0xfa24('0x69')](_0x51105e[_0xfa24('0x6a')])?moment()['format'](_0xfa24('0x64')):undefined});}return null;})[_0xfa24('0x24')](function(_0x39495c){if(_0x39495c){_0x5f2fd9[_0xfa24('0x6b')]=_0x39495c[_0xfa24('0x67')]({'plain':!![]});interaction_log[_0xfa24('0x25')](_0xfa24('0x6c'),_0x3483a0[_0xfa24('0x6d')]['id'],_0x3483a0[_0xfa24('0x6d')]['name'],_0x3483a0[_0xfa24('0x6d')][_0xfa24('0x6e')],_0x5f2fd9[_0xfa24('0x6b')]['id'],_0x3483a0[_0xfa24('0x5b')]?JSON[_0xfa24('0x2a')](_0x3483a0['body']):_0xfa24('0x6f'));return respondWithRpcPromise(_0xfa24('0x70'),_0xfa24('0x71'),_0x5f2fd9);}return null;})['then'](function(_0x229f4d){var _0x46784f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x229f4d[_0xfa24('0x2d')][_0xfa24('0x72')];return db[_0xfa24('0x73')][_0xfa24('0x44')](_0x46784f,{'type':db['Sequelize'][_0xfa24('0x74')]['SELECT'],'raw':!![]})[_0xfa24('0x24')](function(_0x3a30c8){return _0x3a30c8;});})[_0xfa24('0x24')](function(_0x29cd1c){if(_0x29cd1c){_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x75')]=_0x29cd1c[0x0];if(!_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')])return;return db['User']['find']({'where':{'id':_0x3483a0[_0xfa24('0x5b')][_0xfa24('0x65')],'role':_0xfa24('0x66')},'attributes':['id','name',_0xfa24('0x76'),_0xfa24('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x229470){if(!_0x229470)return null;_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x66')]=_0x229470;return _0x5f2fd9;})[_0xfa24('0x24')](function(_0x4e805c){if(_0x4e805c){if(_0x3483a0[_0xfa24('0x5b')]['manual']){_0x5f2fd9['message']['interface']=util[_0xfa24('0x63')](_0xfa24('0x78'),_0x3483a0[_0xfa24('0x6d')][_0xfa24('0x3c')]);_0x5f2fd9['message'][_0xfa24('0x79')]=_0x5f2fd9[_0xfa24('0x79')];_0x5f2fd9[_0xfa24('0x2d')][_0xfa24('0x7a')]=_0x5f2fd9['channel'];_0x5f2fd9[_0xfa24('0x2d')]['event']='accept';return respondWithRpcPromise('EventManager',_0xfa24('0x7b'),{'event':_0xfa24('0x7c'),'message':_0x5f2fd9[_0xfa24('0x2d')]},client9002)[_0xfa24('0x24')](function(){return _0x5f2fd9;});}return _0x5f2fd9;}return null;})[_0xfa24('0x24')](respondWithResult(_0x142cde,null))[_0xfa24('0x54')](handleError(_0x142cde,null));};var interaction_log=require(_0xfa24('0x5e'))(_0xfa24('0x5f'));exports[_0xfa24('0x7d')]=function(_0x2f5b93,_0x3430e8,_0x190388){var _0x166233={'agent':{},'channel':_0xfa24('0x61')};if(_0x2f5b93[_0xfa24('0x5b')]['id']){delete _0x2f5b93['body']['id'];}_0x2f5b93['body'][_0xfa24('0x65')]=_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')]||_0x2f5b93[_0xfa24('0x6d')]['id'];_0x166233[_0xfa24('0x66')]['id']=_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')];return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x2f5b93[_0xfa24('0x56')]['id'],'UserId':null}})[_0xfa24('0x24')](handleEntityNotFound(_0x3430e8,null))[_0xfa24('0x24')](function(_0x6b5049){if(_0x6b5049){_0x166233[_0xfa24('0x2d')]=_0x6b5049[_0xfa24('0x67')]({'plain':!![]});return db['WhatsappInteraction'][_0xfa24('0x59')]({'where':{'id':_0x6b5049[_0xfa24('0x7e')]}});}return null;})[_0xfa24('0x24')](handleEntityNotFound(_0x3430e8,null))[_0xfa24('0x24')](function(_0x184ac4){if(_0x184ac4){_0x166233['interaction']=_0x184ac4['get']({'plain':!![]});interaction_log[_0xfa24('0x25')](_0xfa24('0x7f'),_0x2f5b93[_0xfa24('0x6d')]['id'],_0x2f5b93[_0xfa24('0x6d')]['name'],_0x2f5b93['user']['role'],_0x166233[_0xfa24('0x6b')]['id'],_0x2f5b93['body']?JSON[_0xfa24('0x2a')](_0x2f5b93[_0xfa24('0x5b')]):'null');return respondWithRpcPromise(_0xfa24('0x80'),_0xfa24('0x81'),_0x166233);}return null;})[_0xfa24('0x24')](function(_0x14adb9){var _0x12f486=_0xfa24('0x82')+_0x14adb9[_0xfa24('0x2d')][_0xfa24('0x72')];return db['sequelize']['query'](_0x12f486,{'type':db[_0xfa24('0x83')][_0xfa24('0x74')][_0xfa24('0x84')],'raw':!![]})[_0xfa24('0x24')](function(_0x1cca6e){return _0x1cca6e;});})[_0xfa24('0x24')](function(_0xf5fed){if(_0xf5fed){_0x166233['message']['contact']=_0xf5fed[0x0];if(!_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')])return;return db[_0xfa24('0x85')]['find']({'where':{'id':_0x2f5b93[_0xfa24('0x5b')][_0xfa24('0x65')],'role':'agent'},'attributes':['id',_0xfa24('0x3c'),_0xfa24('0x76'),'email',_0xfa24('0x86')],'raw':!![]});}return null;})[_0xfa24('0x24')](function(_0x139e1f){if(!_0x139e1f)return null;_0x166233['message'][_0xfa24('0x66')]=_0x139e1f;return _0x166233;})['then'](function(_0x542f0a){if(_0x542f0a){_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x87')]=util['format'](_0xfa24('0x78'),_0x2f5b93[_0xfa24('0x6d')]['name']);_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x79')]=_0x166233['channel'];_0x542f0a[_0xfa24('0x2d')][_0xfa24('0x7a')]=_0x166233[_0xfa24('0x79')];_0x542f0a['message'][_0xfa24('0x88')]=_0xfa24('0x7d');respondWithRpcPromise(_0xfa24('0x7b'),_0xfa24('0x7b'),{'event':'rejectmessage','message':_0x542f0a[_0xfa24('0x2d')]},client9002);return _0x166233;}return null;})[_0xfa24('0x24')](respondWithResult(_0x3430e8,null))[_0xfa24('0x54')](handleError(_0x3430e8,null));};exports[_0xfa24('0x30')]=function(_0x18422d,_0x405176,_0x58bba1){if(_0x18422d[_0xfa24('0x5b')]['id']){delete _0x18422d[_0xfa24('0x5b')]['id'];}var _0x23ca78;return db[_0xfa24('0x3e')][_0xfa24('0x59')]({'where':{'id':_0x18422d[_0xfa24('0x56')]['id']}})['then'](handleEntityNotFound(_0x405176,null))['then'](function(_0xab6769){if(_0xab6769){_0x23ca78=_0xab6769;return db[_0xfa24('0x89')][_0xfa24('0x59')]({'where':{'id':_0xab6769[_0xfa24('0x8a')]}});}})[_0xfa24('0x24')](handleEntityNotFound(_0x405176,null))['then'](function(_0x25d76f){if(_0x25d76f){logger[_0xfa24('0x28')](_0xfa24('0x8b'),_0xfa24('0x30'),_0xfa24('0x8c'),_0x25d76f[_0xfa24('0x50')],util[_0xfa24('0x8d')](_0x18422d[_0xfa24('0x5b')],{'showHidden':![],'depth':null}));switch(_0x25d76f[_0xfa24('0x50')]){case _0xfa24('0x8e'):if(_0x18422d[_0xfa24('0x5b')][_0xfa24('0x8f')]&&_0x18422d[_0xfa24('0x5b')]['MessageSid']===_0x23ca78['messageId']&&_0x18422d[_0xfa24('0x5b')][_0xfa24('0x90')]&&_0x18422d['body'][_0xfa24('0x90')]==='read'){return _0x23ca78['update']({'read':!![]});}else{logger[_0xfa24('0x2b')](_0xfa24('0x91'),_0xfa24('0x30'),_0xfa24('0x8e'),util[_0xfa24('0x8d')](_0x18422d['body'],{'showHidden':![],'depth':null}));}break;}return _0x23ca78;}})[_0xfa24('0x24')](respondWithResult(_0x405176,null))['catch'](handleError(_0x405176,null));}; \ No newline at end of file +var _0x21d3=['defaults','redis','localhost','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','find','create','body','params','describe','whatsapp-interactions','whatsapp','read','readAt','format','user','UserId','WhatsappInteraction','isNil','read1stAt','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x21d3,0x187));var _0x321d=function(_0x3c564b,_0x174a31){_0x3c564b=_0x3c564b-0x0;var _0x504b2e=_0x21d3[_0x3c564b];return _0x504b2e;};'use strict';var emlformat=require(_0x321d('0x0'));var rimraf=require(_0x321d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x321d('0x2'));var rp=require(_0x321d('0x3'));var moment=require(_0x321d('0x4'));var BPromise=require(_0x321d('0x5'));var Mustache=require(_0x321d('0x6'));var util=require(_0x321d('0x7'));var path=require(_0x321d('0x8'));var sox=require(_0x321d('0x9'));var csv=require(_0x321d('0xa'));var ejs=require(_0x321d('0xb'));var fs=require('fs');var fs_extra=require(_0x321d('0xc'));var _=require(_0x321d('0xd'));var squel=require('squel');var crypto=require(_0x321d('0xe'));var jsforce=require(_0x321d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x321d('0xa'));var querystring=require(_0x321d('0x10'));var Papa=require(_0x321d('0x11'));var Redis=require(_0x321d('0x12'));var authService=require(_0x321d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x321d('0x14'));var hardwareService=require(_0x321d('0x15'));var logger=require(_0x321d('0x16'))(_0x321d('0x17'));var utils=require('../../config/utils');var config=require(_0x321d('0x18'));var licenseUtil=require(_0x321d('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x321d('0x1a')](config[_0x321d('0x1b')],{'host':_0x321d('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x321d('0x1b')]));require(_0x321d('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x321d('0x1e')][_0x321d('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31a4c9,_0x2405aa,_0x239873,_0xc7412b){return new BPromise(function(_0x210576,_0x1e59c3){var _0x36a5ae=_0xc7412b||client;return _0x36a5ae[_0x321d('0x20')](_0x31a4c9,_0x239873)[_0x321d('0x21')](function(_0x251473){logger[_0x321d('0x22')](_0x321d('0x23'),_0x2405aa,'request\x20sent');logger[_0x321d('0x24')](_0x321d('0x25'),_0x2405aa,_0x321d('0x26'),JSON['stringify'](_0x251473));if(_0x251473[_0x321d('0x27')]){if(_0x251473['error']['code']===0x1f4){logger[_0x321d('0x27')](_0x321d('0x23'),_0x2405aa,_0x251473['error'][_0x321d('0x28')]);return _0x1e59c3(_0x251473[_0x321d('0x27')][_0x321d('0x28')]);}logger[_0x321d('0x27')](_0x321d('0x23'),_0x2405aa,_0x251473['error'][_0x321d('0x28')]);return _0x210576(_0x251473['error'][_0x321d('0x28')]);}else{logger[_0x321d('0x22')](_0x321d('0x23'),_0x2405aa,_0x321d('0x26'));_0x210576(_0x251473[_0x321d('0x29')]['message']);}})[_0x321d('0x2a')](function(_0x17cd55){logger['error'](_0x321d('0x23'),_0x2405aa,_0x17cd55);_0x1e59c3(_0x17cd55);});});}function respondWithStatusCode(_0x23a619,_0x5d47b1){_0x5d47b1=_0x5d47b1||0xcc;return function(_0x144cbf){if(_0x144cbf){return _0x23a619[_0x321d('0x2b')](_0x5d47b1);}return _0x23a619['status'](_0x5d47b1)['end']();};}function respondWithResult(_0x20e6ec,_0x105c45){_0x105c45=_0x105c45||0xc8;return function(_0x5c6a3a){if(_0x5c6a3a){return _0x20e6ec[_0x321d('0x2c')](_0x105c45)[_0x321d('0x2d')](_0x5c6a3a);}};}function respondWithFilteredResult(_0x524d5f,_0x4f588c){return function(_0x18c467){if(_0x18c467){var _0xc0e630=typeof _0x4f588c[_0x321d('0x2e')]===_0x321d('0x2f')&&typeof _0x4f588c[_0x321d('0x30')]==='undefined';var _0x35b3a4=_0x18c467[_0x321d('0x31')];var _0x3d58f2=_0xc0e630?0x0:_0x4f588c[_0x321d('0x2e')];var _0x4a1b91=_0xc0e630?_0x18c467[_0x321d('0x31')]:_0x4f588c['offset']+_0x4f588c['limit'];var _0x358470;if(_0x4a1b91>=_0x35b3a4){_0x4a1b91=_0x35b3a4;_0x358470=0xc8;}else{_0x358470=0xce;}_0x524d5f[_0x321d('0x2c')](_0x358470);return _0x524d5f[_0x321d('0x32')](_0x321d('0x33'),_0x3d58f2+'-'+_0x4a1b91+'/'+_0x35b3a4)[_0x321d('0x2d')](_0x18c467);}return null;};}function patchUpdates(_0x5377a9){return function(_0x2207be){try{jsonpatch['apply'](_0x2207be,_0x5377a9,!![]);}catch(_0x5e0793){return BPromise[_0x321d('0x34')](_0x5e0793);}return _0x2207be[_0x321d('0x35')]();};}function saveUpdates(_0x15d8a8,_0x4df7f8){return function(_0xbeb994){if(_0xbeb994){return _0xbeb994[_0x321d('0x36')](_0x15d8a8)['then'](function(_0x5a6e4b){return _0x5a6e4b;});}return null;};}function removeEntity(_0x22e7bf,_0x469ead){return function(_0x184981){if(_0x184981){return _0x184981['destroy']()['then'](function(){_0x22e7bf[_0x321d('0x2c')](0xcc)[_0x321d('0x37')]();});}};}function handleEntityNotFound(_0x3d397e,_0x3e2e47){return function(_0x4769ca){if(!_0x4769ca){_0x3d397e['sendStatus'](0x194);}return _0x4769ca;};}function handleError(_0x29f6f1,_0xae18e4){_0xae18e4=_0xae18e4||0x1f4;return function(_0x216025){logger[_0x321d('0x27')](_0x216025[_0x321d('0x38')]);if(_0x216025[_0x321d('0x39')]){delete _0x216025['name'];}_0x29f6f1[_0x321d('0x2c')](_0xae18e4)[_0x321d('0x3a')](_0x216025);};}exports[_0x321d('0x3b')]=function(_0x173796,_0x38de41){var _0x19241e={},_0x47fbbb={},_0x3b83c4={'count':0x0,'rows':[]};var _0x4363da=_[_0x321d('0x3c')](db[_0x321d('0x3d')][_0x321d('0x3e')],function(_0x2527ad){return{'name':_0x2527ad[_0x321d('0x3f')],'type':_0x2527ad['type'][_0x321d('0x40')]};});_0x47fbbb[_0x321d('0x41')]=_[_0x321d('0x3c')](_0x4363da,_0x321d('0x39'));_0x47fbbb[_0x321d('0x42')]=_['keys'](_0x173796[_0x321d('0x42')]);_0x47fbbb['filters']=_[_0x321d('0x43')](_0x47fbbb[_0x321d('0x41')],_0x47fbbb[_0x321d('0x42')]);_0x19241e[_0x321d('0x44')]=_[_0x321d('0x43')](_0x47fbbb['model'],qs['fields'](_0x173796[_0x321d('0x42')][_0x321d('0x45')]));_0x19241e[_0x321d('0x44')]=_0x19241e[_0x321d('0x44')][_0x321d('0x46')]?_0x19241e[_0x321d('0x44')]:_0x47fbbb[_0x321d('0x41')];if(!_0x173796[_0x321d('0x42')][_0x321d('0x47')](_0x321d('0x48'))){_0x19241e[_0x321d('0x30')]=qs['limit'](_0x173796[_0x321d('0x42')][_0x321d('0x30')]);_0x19241e[_0x321d('0x2e')]=qs[_0x321d('0x2e')](_0x173796[_0x321d('0x42')][_0x321d('0x2e')]);}_0x19241e[_0x321d('0x49')]=qs[_0x321d('0x4a')](_0x173796['query'][_0x321d('0x4a')]);_0x19241e[_0x321d('0x4b')]=qs[_0x321d('0x4c')](_['pick'](_0x173796[_0x321d('0x42')],_0x47fbbb[_0x321d('0x4c')]),_0x4363da);if(_0x173796[_0x321d('0x42')][_0x321d('0x4d')]){_0x19241e[_0x321d('0x4b')]=_[_0x321d('0x4e')](_0x19241e[_0x321d('0x4b')],{'$or':_[_0x321d('0x3c')](_0x4363da,function(_0x334415){if(_0x334415['type']!==_0x321d('0x4f')){var _0xdf72a7={};_0xdf72a7[_0x334415[_0x321d('0x39')]]={'$like':'%'+_0x173796[_0x321d('0x42')][_0x321d('0x4d')]+'%'};return _0xdf72a7;}})});}_0x19241e=_[_0x321d('0x4e')]({},_0x19241e,_0x173796[_0x321d('0x50')]);var _0x2dbf72={'where':_0x19241e[_0x321d('0x4b')]};return db[_0x321d('0x3d')][_0x321d('0x31')](_0x2dbf72)[_0x321d('0x21')](function(_0x2f369b){_0x3b83c4[_0x321d('0x31')]=_0x2f369b;if(_0x173796['query'][_0x321d('0x51')]){_0x19241e[_0x321d('0x52')]=[{'all':!![]}];}return db[_0x321d('0x3d')]['findAll'](_0x19241e);})['then'](function(_0x28d606){_0x3b83c4[_0x321d('0x53')]=_0x28d606;return _0x3b83c4;})[_0x321d('0x21')](respondWithFilteredResult(_0x38de41,_0x19241e))[_0x321d('0x2a')](handleError(_0x38de41,null));};exports['show']=function(_0x35b0e6,_0x388ade){var _0x55ab0b={'raw':!![],'where':{'id':_0x35b0e6['params']['id']}},_0x126b52={};_0x126b52[_0x321d('0x41')]=_[_0x321d('0x54')](db[_0x321d('0x3d')]['rawAttributes']);_0x126b52[_0x321d('0x42')]=_['keys'](_0x35b0e6[_0x321d('0x42')]);_0x126b52[_0x321d('0x4c')]=_['intersection'](_0x126b52[_0x321d('0x41')],_0x126b52[_0x321d('0x42')]);_0x55ab0b[_0x321d('0x44')]=_['intersection'](_0x126b52[_0x321d('0x41')],qs[_0x321d('0x45')](_0x35b0e6[_0x321d('0x42')][_0x321d('0x45')]));_0x55ab0b[_0x321d('0x44')]=_0x55ab0b['attributes']['length']?_0x55ab0b[_0x321d('0x44')]:_0x126b52['model'];if(_0x35b0e6[_0x321d('0x42')][_0x321d('0x51')]){_0x55ab0b[_0x321d('0x52')]=[{'all':!![]}];}_0x55ab0b=_[_0x321d('0x4e')]({},_0x55ab0b,_0x35b0e6[_0x321d('0x50')]);return db[_0x321d('0x3d')][_0x321d('0x55')](_0x55ab0b)[_0x321d('0x21')](handleEntityNotFound(_0x388ade,null))[_0x321d('0x21')](respondWithResult(_0x388ade,null))['catch'](handleError(_0x388ade,null));};exports[_0x321d('0x56')]=function(_0x18eee9,_0x454221){return db[_0x321d('0x3d')]['create'](_0x18eee9[_0x321d('0x57')],{})[_0x321d('0x21')](respondWithResult(_0x454221,0xc9))[_0x321d('0x2a')](handleError(_0x454221,null));};exports['update']=function(_0x4135e7,_0x35b4a6){if(_0x4135e7[_0x321d('0x57')]['id']){delete _0x4135e7[_0x321d('0x57')]['id'];}return db[_0x321d('0x3d')][_0x321d('0x55')]({'where':{'id':_0x4135e7['params']['id']}})[_0x321d('0x21')](handleEntityNotFound(_0x35b4a6,null))['then'](saveUpdates(_0x4135e7[_0x321d('0x57')],null))[_0x321d('0x21')](respondWithResult(_0x35b4a6,null))['catch'](handleError(_0x35b4a6,null));};exports['destroy']=function(_0x249a6c,_0xcc672f){return db[_0x321d('0x3d')][_0x321d('0x55')]({'where':{'id':_0x249a6c[_0x321d('0x58')]['id']}})['then'](handleEntityNotFound(_0xcc672f,null))['then'](removeEntity(_0xcc672f,null))[_0x321d('0x2a')](handleError(_0xcc672f,null));};exports[_0x321d('0x59')]=function(_0x581fa4,_0x16f2b9){return db[_0x321d('0x3d')]['describe']()[_0x321d('0x21')](respondWithResult(_0x16f2b9,null))[_0x321d('0x2a')](handleError(_0x16f2b9,null));};var interaction_log=require('../../config/logger')(_0x321d('0x5a'));exports['accept']=function(_0x53ff5c,_0x2dd132,_0x2a7961){var _0x1dd554={'agent':{},'channel':_0x321d('0x5b')};if(_0x53ff5c[_0x321d('0x57')]['id']){delete _0x53ff5c[_0x321d('0x57')]['id'];}_0x53ff5c[_0x321d('0x57')][_0x321d('0x5c')]=!![];_0x53ff5c[_0x321d('0x57')][_0x321d('0x5d')]=moment()[_0x321d('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x53ff5c[_0x321d('0x57')]['UserId']=_0x53ff5c[_0x321d('0x57')]['UserId']||_0x53ff5c[_0x321d('0x5f')]['id'];_0x1dd554['agent']['id']=_0x53ff5c[_0x321d('0x57')][_0x321d('0x60')];return db['WhatsappMessage'][_0x321d('0x55')]({'where':{'id':_0x53ff5c[_0x321d('0x58')]['id'],'UserId':null}})[_0x321d('0x21')](handleEntityNotFound(_0x2dd132,null))[_0x321d('0x21')](saveUpdates(_0x53ff5c['body'],null))[_0x321d('0x21')](function(_0x313d1c){if(_0x313d1c){_0x1dd554[_0x321d('0x28')]=_0x313d1c['get']({'plain':!![]});return db[_0x321d('0x61')][_0x321d('0x55')]({'where':{'id':_0x313d1c['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2dd132,null))['then'](function(_0x7f0cad){if(_0x7f0cad){return _0x7f0cad[_0x321d('0x36')]({'UserId':_0x53ff5c['body'][_0x321d('0x60')],'read1stAt':_[_0x321d('0x62')](_0x7f0cad[_0x321d('0x63')])?moment()[_0x321d('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x321d('0x21')](function(_0xef0a33){if(_0xef0a33){_0x1dd554[_0x321d('0x64')]=_0xef0a33[_0x321d('0x65')]({'plain':!![]});interaction_log[_0x321d('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53ff5c[_0x321d('0x5f')]['id'],_0x53ff5c[_0x321d('0x5f')][_0x321d('0x39')],_0x53ff5c[_0x321d('0x5f')][_0x321d('0x66')],_0x1dd554['interaction']['id'],_0x53ff5c['body']?JSON['stringify'](_0x53ff5c[_0x321d('0x57')]):_0x321d('0x67'));return respondWithRpcPromise(_0x321d('0x68'),_0x321d('0x69'),_0x1dd554);}return null;})[_0x321d('0x21')](function(_0x228d27){var _0x364f4f=_0x321d('0x6a')+_0x228d27['message'][_0x321d('0x6b')];return db[_0x321d('0x6c')][_0x321d('0x42')](_0x364f4f,{'type':db[_0x321d('0x6d')][_0x321d('0x6e')][_0x321d('0x6f')],'raw':!![]})['then'](function(_0x4b0ac3){return _0x4b0ac3;});})[_0x321d('0x21')](function(_0x495f4e){if(_0x495f4e){_0x1dd554[_0x321d('0x28')][_0x321d('0x70')]=_0x495f4e[0x0];if(!_0x53ff5c[_0x321d('0x57')][_0x321d('0x60')])return;return db[_0x321d('0x71')][_0x321d('0x55')]({'where':{'id':_0x53ff5c[_0x321d('0x57')]['UserId'],'role':_0x321d('0x72')},'attributes':['id','name',_0x321d('0x73'),_0x321d('0x74'),_0x321d('0x75')],'raw':!![]});}return null;})[_0x321d('0x21')](function(_0x3b8a15){if(!_0x3b8a15)return null;_0x1dd554[_0x321d('0x28')]['agent']=_0x3b8a15;return _0x1dd554;})[_0x321d('0x21')](function(_0x1f9483){if(_0x1f9483){if(_0x53ff5c[_0x321d('0x57')]['manual']){_0x1dd554[_0x321d('0x28')][_0x321d('0x76')]=util[_0x321d('0x5e')](_0x321d('0x77'),_0x53ff5c['user'][_0x321d('0x39')]);_0x1dd554['message'][_0x321d('0x78')]=_0x1dd554[_0x321d('0x78')];_0x1dd554[_0x321d('0x28')]['motionChannel']=_0x1dd554[_0x321d('0x78')];_0x1dd554['message'][_0x321d('0x79')]='accept';return respondWithRpcPromise(_0x321d('0x7a'),_0x321d('0x7a'),{'event':_0x321d('0x7b'),'message':_0x1dd554[_0x321d('0x28')]},client9002)['then'](function(){return _0x1dd554;});}return _0x1dd554;}return null;})[_0x321d('0x21')](respondWithResult(_0x2dd132,null))['catch'](handleError(_0x2dd132,null));};var interaction_log=require(_0x321d('0x16'))(_0x321d('0x5a'));exports['reject']=function(_0x344cbd,_0x3a9747,_0xf0b719){var _0x56de49={'agent':{},'channel':_0x321d('0x5b')};if(_0x344cbd[_0x321d('0x57')]['id']){delete _0x344cbd['body']['id'];}_0x344cbd[_0x321d('0x57')][_0x321d('0x60')]=_0x344cbd['body']['UserId']||_0x344cbd[_0x321d('0x5f')]['id'];_0x56de49[_0x321d('0x72')]['id']=_0x344cbd[_0x321d('0x57')][_0x321d('0x60')];return db[_0x321d('0x3d')][_0x321d('0x55')]({'where':{'id':_0x344cbd[_0x321d('0x58')]['id'],'UserId':null}})[_0x321d('0x21')](handleEntityNotFound(_0x3a9747,null))[_0x321d('0x21')](function(_0x54fe7){if(_0x54fe7){_0x56de49['message']=_0x54fe7[_0x321d('0x65')]({'plain':!![]});return db[_0x321d('0x61')][_0x321d('0x55')]({'where':{'id':_0x54fe7[_0x321d('0x7c')]}});}return null;})[_0x321d('0x21')](handleEntityNotFound(_0x3a9747,null))[_0x321d('0x21')](function(_0x3c47cb){if(_0x3c47cb){_0x56de49[_0x321d('0x64')]=_0x3c47cb[_0x321d('0x65')]({'plain':!![]});interaction_log[_0x321d('0x22')](_0x321d('0x7d'),_0x344cbd[_0x321d('0x5f')]['id'],_0x344cbd[_0x321d('0x5f')][_0x321d('0x39')],_0x344cbd['user'][_0x321d('0x66')],_0x56de49[_0x321d('0x64')]['id'],_0x344cbd[_0x321d('0x57')]?JSON[_0x321d('0x7e')](_0x344cbd[_0x321d('0x57')]):'null');return respondWithRpcPromise(_0x321d('0x7f'),_0x321d('0x80'),_0x56de49);}return null;})[_0x321d('0x21')](function(_0x4c6128){var _0x2c4e19=_0x321d('0x6a')+_0x4c6128[_0x321d('0x28')][_0x321d('0x6b')];return db[_0x321d('0x6c')][_0x321d('0x42')](_0x2c4e19,{'type':db[_0x321d('0x6d')][_0x321d('0x6e')][_0x321d('0x6f')],'raw':!![]})['then'](function(_0x461523){return _0x461523;});})['then'](function(_0x5ab607){if(_0x5ab607){_0x56de49['message'][_0x321d('0x70')]=_0x5ab607[0x0];if(!_0x344cbd[_0x321d('0x57')][_0x321d('0x60')])return;return db[_0x321d('0x71')]['find']({'where':{'id':_0x344cbd[_0x321d('0x57')][_0x321d('0x60')],'role':'agent'},'attributes':['id',_0x321d('0x39'),_0x321d('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x321d('0x21')](function(_0x50c3b1){if(!_0x50c3b1)return null;_0x56de49[_0x321d('0x28')][_0x321d('0x72')]=_0x50c3b1;return _0x56de49;})['then'](function(_0x3e8025){if(_0x3e8025){_0x3e8025[_0x321d('0x28')][_0x321d('0x76')]=util['format'](_0x321d('0x77'),_0x344cbd[_0x321d('0x5f')][_0x321d('0x39')]);_0x3e8025['message'][_0x321d('0x78')]=_0x56de49[_0x321d('0x78')];_0x3e8025['message']['motionChannel']=_0x56de49[_0x321d('0x78')];_0x3e8025[_0x321d('0x28')][_0x321d('0x79')]=_0x321d('0x34');respondWithRpcPromise(_0x321d('0x7a'),_0x321d('0x7a'),{'event':'rejectmessage','message':_0x3e8025[_0x321d('0x28')]},client9002);return _0x56de49;}return null;})[_0x321d('0x21')](respondWithResult(_0x3a9747,null))[_0x321d('0x2a')](handleError(_0x3a9747,null));};exports[_0x321d('0x2c')]=function(_0x24e6f8,_0xb2f4d6,_0x17f1da){if(_0x24e6f8['body']['id']){delete _0x24e6f8[_0x321d('0x57')]['id'];}var _0x181d6d;return db[_0x321d('0x3d')][_0x321d('0x55')]({'where':{'id':_0x24e6f8[_0x321d('0x58')]['id']}})[_0x321d('0x21')](handleEntityNotFound(_0xb2f4d6,null))[_0x321d('0x21')](function(_0x5f3fc8){if(_0x5f3fc8){_0x181d6d=_0x5f3fc8;return db['WhatsappAccount'][_0x321d('0x55')]({'where':{'id':_0x5f3fc8[_0x321d('0x81')]}});}})[_0x321d('0x21')](handleEntityNotFound(_0xb2f4d6,null))[_0x321d('0x21')](function(_0x68a0ff){if(_0x68a0ff){logger['debug'](_0x321d('0x82'),_0x321d('0x2c'),_0x321d('0x83'),_0x68a0ff[_0x321d('0x84')],util['inspect'](_0x24e6f8[_0x321d('0x57')],{'showHidden':![],'depth':null}));switch(_0x68a0ff[_0x321d('0x84')]){case _0x321d('0x85'):if(_0x24e6f8[_0x321d('0x57')][_0x321d('0x86')]&&_0x24e6f8[_0x321d('0x57')][_0x321d('0x86')]===_0x181d6d[_0x321d('0x87')]&&_0x24e6f8[_0x321d('0x57')][_0x321d('0x88')]&&_0x24e6f8[_0x321d('0x57')][_0x321d('0x88')]===_0x321d('0x5c')){return _0x181d6d['update']({'read':!![]});}else{logger[_0x321d('0x27')](_0x321d('0x89'),_0x321d('0x2c'),'twilio',util[_0x321d('0x8a')](_0x24e6f8[_0x321d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x181d6d;}})[_0x321d('0x21')](respondWithResult(_0xb2f4d6,null))[_0x321d('0x2a')](handleError(_0xb2f4d6,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8bb67d6..5132600 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 _0x657b=['../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x657b,0x131));var _0xb657=function(_0x1fadb1,_0x1cefa0){_0x1fadb1=_0x1fadb1-0x0;var _0x456764=_0x657b[_0x1fadb1];return _0x456764;};'use strict';var EventEmitter=require(_0xb657('0x0'));var WhatsappMessage=require(_0xb657('0x1'))['db'][_0xb657('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb657('0x3')](0x0);var events={'afterCreate':_0xb657('0x4'),'afterUpdate':'update','afterDestroy':_0xb657('0x5')};function emitEvent(_0xa41497){return function(_0x5da1bc,_0x175072,_0x322e57){WhatsappMessageEvents[_0xb657('0x6')](_0xa41497+':'+_0x5da1bc['id'],_0x5da1bc);WhatsappMessageEvents[_0xb657('0x6')](_0xa41497,_0x5da1bc);_0x322e57(null);};}for(var e in events){if(events[_0xb657('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb657('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x598a93,_0x1fcbf9){var _0x442881=function(_0x68160){while(--_0x68160){_0x598a93['push'](_0x598a93['shift']());}};_0x442881(++_0x1fcbf9);}(_0x13f6,0x124));var _0x613f=function(_0x3d64cb,_0x3af4c5){_0x3d64cb=_0x3d64cb-0x0;var _0x4b49ee=_0x13f6[_0x3d64cb];return _0x4b49ee;};'use strict';var EventEmitter=require(_0x613f('0x0'));var WhatsappMessage=require(_0x613f('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){WhatsappMessageEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);WhatsappMessageEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d6b899a..fead7d2 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 _0x3e67=['isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x2bd0be,_0xf63d47){var _0x3e8e85=function(_0xdc0fbc){while(--_0xdc0fbc){_0x2bd0be['push'](_0x2bd0be['shift']());}};_0x3e8e85(++_0xf63d47);}(_0x3e67,0xa5));var _0x73e6=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x3e67[_0x8e8ca7];return _0x561381;};'use strict';var _=require('lodash');var util=require(_0x73e6('0x0'));var logger=require(_0x73e6('0x1'))(_0x73e6('0x2'));var moment=require(_0x73e6('0x3'));var BPromise=require(_0x73e6('0x4'));var rp=require(_0x73e6('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x73e6('0x6'));var rimraf=require(_0x73e6('0x7'));var config=require(_0x73e6('0x8'));var attributes=require(_0x73e6('0x9'));module['exports']=function(_0x2947d3,_0x4b39df){return _0x2947d3[_0x73e6('0xa')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x73e6('0xb'),'fields':[_0x73e6('0xb')]},{'name':_0x73e6('0xc'),'fields':[_0x73e6('0xd')],'type':_0x73e6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a312,_0x5d4ec4,_0x484439){var _0x18e64f=_0x2947d3[_0x73e6('0xf')];var _0x528d12=_0x26a312[_0x73e6('0x10')]({'plain':!![]});if(_0x528d12['direction']['toLowerCase']()==='in'||_0x528d12[_0x73e6('0x11')][_0x73e6('0x12')]()===_0x73e6('0x13')&&!_0x528d12[_0x73e6('0x14')]&&!_[_0x73e6('0x15')](_0x528d12[_0x73e6('0x16')])){_0x18e64f[_0x73e6('0x17')][_0x73e6('0x18')]({'where':{'id':_0x528d12[_0x73e6('0x19')]}})[_0x73e6('0x1a')](function(_0x5d9348){if(_0x5d9348){_0x5d9348[_0x73e6('0x1b')]({'lastMsgAt':_0x528d12[_0x73e6('0x1c')],'lastMsgDirection':_0x528d12[_0x73e6('0x11')][_0x73e6('0x12')]()});}})['catch'](function(_0x1960e3){console[_0x73e6('0x1d')](_0x1960e3);});}if(_0x528d12[_0x73e6('0x11')]==='out'&&!_0x528d12[_0x73e6('0x14')]){var _0xc0fb7b;_0x18e64f[_0x73e6('0x1e')]['find']({'where':{'id':_0x528d12[_0x73e6('0x1f')]},'raw':!![]})['then'](function(_0x3358d8){_0xc0fb7b=_0x3358d8;if(_0xc0fb7b&&_0xc0fb7b['type']){switch(_0xc0fb7b[_0x73e6('0x20')]){case _0x73e6('0x21'):var _0x4f701b=require(_0x73e6('0x21'));if(_0xc0fb7b[_0x73e6('0x22')]&&_0xc0fb7b['authToken']&&_0xc0fb7b[_0x73e6('0x23')]){var _0x416e29=new _0x4f701b(_0xc0fb7b[_0x73e6('0x22')],_0xc0fb7b[_0x73e6('0x24')]);_0x416e29[_0x73e6('0x25')][_0x73e6('0x26')]({'body':_0x528d12[_0x73e6('0xd')],'to':_0x73e6('0x27')+_0x528d12[_0x73e6('0x23')],'from':_0x73e6('0x27')+_0xc0fb7b[_0x73e6('0x23')],'statusCallback':_0xc0fb7b[_0x73e6('0x28')]+_0x73e6('0x29')+_0x528d12['id']+_0x73e6('0x2a')+_0xc0fb7b[_0x73e6('0x2b')]})['then'](function(_0x89b6d){if(_0x89b6d[_0x73e6('0x2c')]){return _0x26a312[_0x73e6('0x1b')]({'messageId':_0x89b6d[_0x73e6('0x2c')]});}})['catch'](function(_0x4be204){logger['error'](_0x73e6('0x2d'),_0x73e6('0x2e'),'twilio',util['inspect'](_0x4be204,{'showHidden':![],'depth':null}));});}else{logger[_0x73e6('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x73e6('0x2e'),_0x73e6('0x21'),_0x73e6('0x2f'));}break;case _0x73e6('0x30'):var _0x3b00fc=_0xc0fb7b[_0x73e6('0x22')];var _0x3597d7=_0xc0fb7b[_0x73e6('0x24')];var _0x41585c=_0xc0fb7b[_0x73e6('0x31')]+_0x73e6('0x32')+_0x3b00fc+_0x73e6('0x33');var _0x338f6a={'to':[_0x528d12['phone']],'message':{'type':'text','text':_0x528d12[_0x73e6('0xd')]}};var _0x41a946={'method':_0x73e6('0x34'),'uri':_0x41585c,'headers':{'Authorization':_0x73e6('0x35')+_0x3597d7,'Content-Type':_0x73e6('0x36')},'body':_0x338f6a,'json':!![]};rp(_0x41a946)[_0x73e6('0x1a')](function(_0x3ff2ff){if(_0x3ff2ff[_0x73e6('0x37')][0x0][_0x73e6('0x38')]){return _0x26a312[_0x73e6('0x1b')]({'messageId':_0x3ff2ff[_0x73e6('0x37')][0x0][_0x73e6('0x38')]});}})[_0x73e6('0x39')](function(_0x1e7303){logger[_0x73e6('0x3a')]('WhatsappMessage,\x20%s',_0x1e7303);});break;}}})[_0x73e6('0x3b')](function(){_0x484439();});}else{_0x484439();}}},'charset':_0x73e6('0x3c'),'collate':_0x73e6('0x3d')});}; \ No newline at end of file +var _0xa535=['/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','POST','Bearer\x20','statuses','message_id','err','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/'];(function(_0x117730,_0x5dd7fd){var _0xd85024=function(_0x3e88b4){while(--_0x3e88b4){_0x117730['push'](_0x117730['shift']());}};_0xd85024(++_0x5dd7fd);}(_0xa535,0x1ad));var _0x5a53=function(_0xc4ae3,_0x75398a){_0xc4ae3=_0xc4ae3-0x0;var _0x22650b=_0xa535[_0xc4ae3];return _0x22650b;};'use strict';var _=require(_0x5a53('0x0'));var util=require(_0x5a53('0x1'));var logger=require(_0x5a53('0x2'))(_0x5a53('0x3'));var moment=require(_0x5a53('0x4'));var BPromise=require(_0x5a53('0x5'));var rp=require(_0x5a53('0x6'));var fetch=require(_0x5a53('0x7'));var fs=require('fs');var path=require(_0x5a53('0x8'));var rimraf=require(_0x5a53('0x9'));var config=require('../../config/environment');var attributes=require(_0x5a53('0xa'));module[_0x5a53('0xb')]=function(_0x1123ff,_0x148c7a){return _0x1123ff[_0x5a53('0xc')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5a53('0xd')]},{'name':_0x5a53('0xe'),'fields':[_0x5a53('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58bd99,_0x4d9c40,_0x5de760){var _0x3850a8=_0x1123ff[_0x5a53('0x10')];var _0x389fa1=_0x58bd99[_0x5a53('0x11')]({'plain':!![]});if(_0x389fa1[_0x5a53('0x12')][_0x5a53('0x13')]()==='in'||_0x389fa1[_0x5a53('0x12')][_0x5a53('0x13')]()===_0x5a53('0x14')&&!_0x389fa1[_0x5a53('0x15')]&&!_['isNil'](_0x389fa1[_0x5a53('0x16')])){_0x3850a8[_0x5a53('0x17')][_0x5a53('0x18')]({'where':{'id':_0x389fa1[_0x5a53('0x19')]}})[_0x5a53('0x1a')](function(_0x3377f0){if(_0x3377f0){_0x3377f0[_0x5a53('0x1b')]({'lastMsgAt':_0x389fa1[_0x5a53('0x1c')],'lastMsgDirection':_0x389fa1['direction'][_0x5a53('0x13')]()});}})[_0x5a53('0x1d')](function(_0x4ce8d2){console[_0x5a53('0x1e')](_0x4ce8d2);});}if(_0x389fa1[_0x5a53('0x12')]===_0x5a53('0x14')&&!_0x389fa1[_0x5a53('0x15')]){var _0x5c32f4;_0x3850a8[_0x5a53('0x1f')][_0x5a53('0x20')]({'where':{'id':_0x389fa1['WhatsappAccountId']},'raw':!![]})[_0x5a53('0x1a')](function(_0x1d94cd){_0x5c32f4=_0x1d94cd;if(_0x5c32f4&&_0x5c32f4[_0x5a53('0x21')]){switch(_0x5c32f4[_0x5a53('0x21')]){case _0x5a53('0x22'):var _0x256e8a=require(_0x5a53('0x22'));if(_0x5c32f4[_0x5a53('0x23')]&&_0x5c32f4[_0x5a53('0x24')]&&_0x5c32f4[_0x5a53('0x25')]){var _0x4863c6=new _0x256e8a(_0x5c32f4[_0x5a53('0x23')],_0x5c32f4['authToken']);_0x4863c6[_0x5a53('0x26')][_0x5a53('0x27')]({'body':_0x389fa1['body'],'to':_0x5a53('0x28')+_0x389fa1[_0x5a53('0x25')],'from':'whatsapp:'+_0x5c32f4[_0x5a53('0x25')],'statusCallback':_0x5c32f4[_0x5a53('0x29')]+_0x5a53('0x2a')+_0x389fa1['id']+_0x5a53('0x2b')+_0x5c32f4['token']})['then'](function(_0x83bb92){if(_0x83bb92[_0x5a53('0x2c')]){return _0x58bd99[_0x5a53('0x1b')]({'messageId':_0x83bb92[_0x5a53('0x2c')]});}})[_0x5a53('0x1d')](function(_0x2b9750){logger[_0x5a53('0x1e')](_0x5a53('0x2d'),_0x5a53('0x2e'),_0x5a53('0x22'),util[_0x5a53('0x2f')](_0x2b9750,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5a53('0x2d'),_0x5a53('0x2e'),_0x5a53('0x22'),_0x5a53('0x30'));}break;case _0x5a53('0x31'):var _0x4cc42f=_0x5c32f4['accountSid'];var _0x7d92ff=_0x5c32f4[_0x5a53('0x24')];var _0x35552f=_0x5c32f4[_0x5a53('0x32')]+'/whatsapp/v1/'+_0x4cc42f+_0x5a53('0x33');var _0x1bf44c={'to':[_0x389fa1[_0x5a53('0x25')]],'message':{'type':'text','text':_0x389fa1[_0x5a53('0xf')]}};var _0x3f8ee0={'method':_0x5a53('0x34'),'uri':_0x35552f,'headers':{'Authorization':_0x5a53('0x35')+_0x7d92ff,'Content-Type':'application/json'},'body':_0x1bf44c,'json':!![]};rp(_0x3f8ee0)[_0x5a53('0x1a')](function(_0x26d77d){if(_0x26d77d[_0x5a53('0x36')][0x0][_0x5a53('0x37')]){return _0x58bd99['update']({'messageId':_0x26d77d['statuses'][0x0][_0x5a53('0x37')]});}})[_0x5a53('0x1d')](function(_0x344f67){logger[_0x5a53('0x38')]('WhatsappMessage,\x20%s',_0x344f67);});break;}}})[_0x5a53('0x39')](function(){_0x5de760();});}else{_0x5de760();}}},'charset':_0x5a53('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 36785be..0a84c29 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 _0xb75e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','info','lodash','moment','bluebird'];(function(_0x4a5349,_0x156289){var _0x4075d0=function(_0x296748){while(--_0x296748){_0x4a5349['push'](_0x4a5349['shift']());}};_0x4075d0(++_0x156289);}(_0xb75e,0xe4));var _0xeb75=function(_0x99b0ac,_0x2aab96){_0x99b0ac=_0x99b0ac-0x0;var _0x59fa3a=_0xb75e[_0x99b0ac];return _0x59fa3a;};'use strict';var _=require(_0xeb75('0x0'));var util=require('util');var moment=require(_0xeb75('0x1'));var BPromise=require(_0xeb75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb75('0x3'));var db=require(_0xeb75('0x4'))['db'];var utils=require(_0xeb75('0x5'));var logger=require(_0xeb75('0x6'))('rpc');var config=require(_0xeb75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb75('0x8')][_0xeb75('0x9')]({'port':0x232a});config[_0xeb75('0xa')]=_[_0xeb75('0xb')](config[_0xeb75('0xa')],{'host':_0xeb75('0xc'),'port':0x18eb});var socket=require(_0xeb75('0xd'))(new Redis(config[_0xeb75('0xa')]));require('./whatsappMessage.socket')[_0xeb75('0xe')](socket);function respondWithRpcPromise(_0x223d89,_0x558776,_0x39419d){return new BPromise(function(_0x30f277,_0x48dc15){return client[_0xeb75('0xf')](_0x223d89,_0x39419d)[_0xeb75('0x10')](function(_0x5261be){logger['info'](_0xeb75('0x11'),_0x558776,_0xeb75('0x12'));logger[_0xeb75('0x13')](_0xeb75('0x14'),_0x558776,'request\x20sent',JSON[_0xeb75('0x15')](_0x5261be));if(_0x5261be['error']){if(_0x5261be[_0xeb75('0x16')][_0xeb75('0x17')]===0x1f4){logger[_0xeb75('0x16')](_0xeb75('0x11'),_0x558776,_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);return _0x48dc15(_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);}logger['error'](_0xeb75('0x11'),_0x558776,_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);return _0x30f277(_0x5261be[_0xeb75('0x16')][_0xeb75('0x18')]);}else{logger['info'](_0xeb75('0x11'),_0x558776,_0xeb75('0x12'));_0x30f277(_0x5261be[_0xeb75('0x19')][_0xeb75('0x18')]);}})[_0xeb75('0x1a')](function(_0x3ab44e){logger[_0xeb75('0x16')](_0xeb75('0x11'),_0x558776,_0x3ab44e);_0x48dc15(_0x3ab44e);});});}exports[_0xeb75('0x1b')]=function(_0x11b3b0){var _0x5dd926=this;return new Promise(function(_0x390f80,_0x15415f){return db[_0xeb75('0x1c')][_0xeb75('0x1d')](_0x11b3b0['body'],{'raw':_0x11b3b0[_0xeb75('0x1e')]?_0x11b3b0['options'][_0xeb75('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x348868){logger[_0xeb75('0x20')](_0xeb75('0x1b'),_0x11b3b0);logger['debug']('CreateWhatsappMessage',_0x11b3b0,JSON[_0xeb75('0x15')](_0x348868));_0x390f80(_0x348868);})[_0xeb75('0x1a')](function(_0x5deef5){logger['error']('CreateWhatsappMessage',_0x5deef5[_0xeb75('0x18')],_0x11b3b0);_0x15415f(_0x5dd926['error'](0x1f4,_0x5deef5[_0xeb75('0x18')]));});});}; \ No newline at end of file +var _0xf05a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options','raw','then','lodash','bluebird','randomstring'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xf05a,0x75));var _0xaf05=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf05a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xaf05('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf05('0x1'));var rs=require(_0xaf05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaf05('0x3'));var logger=require(_0xaf05('0x4'))(_0xaf05('0x5'));var config=require('../../config/environment');var jayson=require(_0xaf05('0x6'));var client=jayson[_0xaf05('0x7')][_0xaf05('0x8')]({'port':0x232a});config[_0xaf05('0x9')]=_[_0xaf05('0xa')](config[_0xaf05('0x9')],{'host':_0xaf05('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x513a98,_0x37c289,_0x3aa9ee){return new BPromise(function(_0x4d90c9,_0x4a989a){return client[_0xaf05('0xc')](_0x513a98,_0x3aa9ee)['then'](function(_0x57d469){logger[_0xaf05('0xd')](_0xaf05('0xe'),_0x37c289,'request\x20sent');logger[_0xaf05('0xf')](_0xaf05('0x10'),_0x37c289,_0xaf05('0x11'),JSON[_0xaf05('0x12')](_0x57d469));if(_0x57d469['error']){if(_0x57d469[_0xaf05('0x13')][_0xaf05('0x14')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x37c289,_0x57d469[_0xaf05('0x13')]['message']);return _0x4a989a(_0x57d469[_0xaf05('0x13')][_0xaf05('0x15')]);}logger[_0xaf05('0x13')](_0xaf05('0xe'),_0x37c289,_0x57d469[_0xaf05('0x13')][_0xaf05('0x15')]);return _0x4d90c9(_0x57d469[_0xaf05('0x13')]['message']);}else{logger[_0xaf05('0xd')](_0xaf05('0xe'),_0x37c289,_0xaf05('0x11'));_0x4d90c9(_0x57d469[_0xaf05('0x16')][_0xaf05('0x15')]);}})[_0xaf05('0x17')](function(_0x461867){logger[_0xaf05('0x13')](_0xaf05('0xe'),_0x37c289,_0x461867);_0x4a989a(_0x461867);});});}exports[_0xaf05('0x18')]=function(_0x17b2e5){var _0x3e1d42=this;return new Promise(function(_0x4e83ca,_0x5c659e){return db['WhatsappMessage'][_0xaf05('0x19')](_0x17b2e5[_0xaf05('0x1a')],{'raw':_0x17b2e5[_0xaf05('0x1b')]?_0x17b2e5['options'][_0xaf05('0x1c')]===undefined?!![]:![]:!![]})[_0xaf05('0x1d')](function(_0x4be7a5){logger[_0xaf05('0xd')](_0xaf05('0x18'),_0x17b2e5);logger[_0xaf05('0xf')]('CreateWhatsappMessage',_0x17b2e5,JSON[_0xaf05('0x12')](_0x4be7a5));_0x4e83ca(_0x4be7a5);})['catch'](function(_0x3f3f71){logger['error']('CreateWhatsappMessage',_0x3f3f71[_0xaf05('0x15')],_0x17b2e5);_0x5c659e(_0x3e1d42['error'](0x1f4,_0x3f3f71[_0xaf05('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7de7c18..c8e16ef 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 _0x1364=['register','length','whatsappMessage:','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1364,0xab));var _0x4136=function(_0x22627b,_0x1d78d5){_0x22627b=_0x22627b-0x0;var _0x28419e=_0x1364[_0x22627b];return _0x28419e;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4136('0x0'),_0x4136('0x1'),_0x4136('0x2')];function createListener(_0x42be4b,_0x8887ec){return function(_0xee6d7b){_0x8887ec[_0x4136('0x3')](_0x42be4b,_0xee6d7b);};}function removeListener(_0x499d01,_0x599967){return function(){WhatsappMessageEvents[_0x4136('0x4')](_0x499d01,_0x599967);};}exports[_0x4136('0x5')]=function(_0x1a1808){for(var _0x34494d=0x0,_0x5d2a02=events[_0x4136('0x6')];_0x34494d<_0x5d2a02;_0x34494d++){var _0x36f4f1=events[_0x34494d];var _0x10f168=createListener(_0x4136('0x7')+_0x36f4f1,_0x1a1808);WhatsappMessageEvents['on'](_0x36f4f1,_0x10f168);}}; \ No newline at end of file +var _0x76c8=['emit','removeListener','register','length','whatsappMessage:','update'];(function(_0x1c27dd,_0x2fe55a){var _0x3a345a=function(_0x46323){while(--_0x46323){_0x1c27dd['push'](_0x1c27dd['shift']());}};_0x3a345a(++_0x2fe55a);}(_0x76c8,0x1eb));var _0x876c=function(_0x1572a7,_0xc5f120){_0x1572a7=_0x1572a7-0x0;var _0xf85a14=_0x76c8[_0x1572a7];return _0xf85a14;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0x876c('0x0')];function createListener(_0x14afba,_0x48c3b5){return function(_0x4a6b1a){_0x48c3b5[_0x876c('0x1')](_0x14afba,_0x4a6b1a);};}function removeListener(_0x43ab8a,_0x4a217f){return function(){WhatsappMessageEvents[_0x876c('0x2')](_0x43ab8a,_0x4a217f);};}exports[_0x876c('0x3')]=function(_0x48200e){for(var _0x3410bd=0x0,_0x323843=events[_0x876c('0x4')];_0x3410bd<_0x323843;_0x3410bd++){var _0x5754d1=events[_0x3410bd];var _0x3238d6=createListener(_0x876c('0x5')+_0x5754d1,_0x48200e);WhatsappMessageEvents['on'](_0x5754d1,_0x3238d6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 882b353..a9bb847 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 _0x681a=['../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2c6991,_0x4b5775){var _0x4de9fa=function(_0x4ad213){while(--_0x4ad213){_0x2c6991['push'](_0x2c6991['shift']());}};_0x4de9fa(++_0x4b5775);}(_0x681a,0xff));var _0xa681=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x681a[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xa681('0x0'));var util=require(_0xa681('0x1'));var path=require(_0xa681('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa681('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa681('0x4'));var interaction=require(_0xa681('0x5'));var config=require('../../config/environment');var controller=require(_0xa681('0x6'));router[_0xa681('0x7')]('/',auth[_0xa681('0x8')](),controller[_0xa681('0x9')]);router[_0xa681('0x7')](_0xa681('0xa'),auth[_0xa681('0x8')](),controller['describe']);router['get']('/:id',auth[_0xa681('0x8')](),controller['show']);router[_0xa681('0x7')]('/:id/members',auth[_0xa681('0x8')](),controller[_0xa681('0xb')]);router['get'](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0xd')]);router[_0xa681('0x7')]('/:id/users',auth[_0xa681('0x8')](),controller[_0xa681('0xe')]);router[_0xa681('0xf')]('/',auth[_0xa681('0x8')](),controller['create']);router[_0xa681('0xf')](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0x10')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xa681('0x11')]);router[_0xa681('0x12')](_0xa681('0x13'),auth[_0xa681('0x8')](),controller[_0xa681('0x14')]);router['delete'](_0xa681('0x13'),auth['isAuthenticated'](),controller[_0xa681('0x15')]);router[_0xa681('0x16')](_0xa681('0xc'),auth[_0xa681('0x8')](),controller[_0xa681('0x17')]);router[_0xa681('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xa681('0x18')]);module[_0xa681('0x19')]=router; \ No newline at end of file +var _0x299d=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0x299d,0x82));var _0xd299=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x299d[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xd299('0x0'));var util=require(_0xd299('0x1'));var path=require('path');var timeout=require(_0xd299('0x2'));var express=require(_0xd299('0x3'));var router=express[_0xd299('0x4')]();var fs_extra=require(_0xd299('0x5'));var auth=require(_0xd299('0x6'));var interaction=require(_0xd299('0x7'));var config=require(_0xd299('0x8'));var controller=require(_0xd299('0x9'));router[_0xd299('0xa')]('/',auth[_0xd299('0xb')](),controller['index']);router[_0xd299('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd299('0xa')](_0xd299('0xc'),auth[_0xd299('0xb')](),controller[_0xd299('0xd')]);router[_0xd299('0xa')](_0xd299('0xe'),auth[_0xd299('0xb')](),controller['getMembers']);router['get'](_0xd299('0xf'),auth[_0xd299('0xb')](),controller[_0xd299('0x10')]);router[_0xd299('0xa')](_0xd299('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd299('0x12')]('/',auth[_0xd299('0xb')](),controller[_0xd299('0x13')]);router[_0xd299('0x12')]('/:id/teams',auth[_0xd299('0xb')](),controller[_0xd299('0x14')]);router[_0xd299('0x12')]('/:id/users',auth[_0xd299('0xb')](),controller[_0xd299('0x15')]);router['put'](_0xd299('0xc'),auth[_0xd299('0xb')](),controller[_0xd299('0x16')]);router[_0xd299('0x17')](_0xd299('0xc'),auth[_0xd299('0xb')](),controller['destroy']);router[_0xd299('0x17')]('/:id/teams',auth[_0xd299('0xb')](),controller[_0xd299('0x18')]);router[_0xd299('0x17')](_0xd299('0x11'),auth[_0xd299('0xb')](),controller[_0xd299('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 426205d..8a261cf 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 _0x757f=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0xc02aa5,_0x1c36bc){var _0x31f6a2=function(_0x32425d){while(--_0x32425d){_0xc02aa5['push'](_0xc02aa5['shift']());}};_0x31f6a2(++_0x1c36bc);}(_0x757f,0xee));var _0xf757=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x757f[_0xeaba4b];return _0x32f4fd;};'use strict';var Sequelize=require(_0xf757('0x0'));module['exports']={'name':{'type':Sequelize[_0xf757('0x1')],'unique':_0xf757('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf757('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf757('0x4')](_0xf757('0x5'),_0xf757('0x6'),_0xf757('0x7'))},'description':{'type':Sequelize[_0xf757('0x1')]}}; \ No newline at end of file +var _0x84e1=['INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x84e1,0x1dc));var _0x184e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x84e1[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x184e('0x0'));module[_0x184e('0x1')]={'name':{'type':Sequelize[_0x184e('0x2')],'unique':_0x184e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x184e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x184e('0x5')]('rrmemory',_0x184e('0x6'),_0x184e('0x7'))},'description':{'type':Sequelize[_0x184e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 45f0ccf..531c601 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 _0x3572=['autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','options','findAll','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','userWhatsappQueue:save','isArray','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3572,0x1ad));var _0x2357=function(_0x4ae5f9,_0x2023be){_0x4ae5f9=_0x4ae5f9-0x0;var _0x184bca=_0x3572[_0x4ae5f9];return _0x184bca;};'use strict';var BPromise=require('bluebird');var util=require(_0x2357('0x0'));var _=require(_0x2357('0x1'));var squel=require('squel');var Redis=require(_0x2357('0x2'));var qs=require(_0x2357('0x3'));var logger=require(_0x2357('0x4'))(_0x2357('0x5'));var config=require(_0x2357('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2357('0x7')](config[_0x2357('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2357('0x9'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x2357('0xa')](socket);function respondWithStatusCode(_0x271f50,_0xa5cd5d){_0xa5cd5d=_0xa5cd5d||0xcc;return function(_0xb1e626){if(_0xb1e626){return _0x271f50[_0x2357('0xb')](_0xa5cd5d);}return _0x271f50['status'](_0xa5cd5d)[_0x2357('0xc')]();};}function respondWithResult(_0x7ac535,_0xe1df09){_0xe1df09=_0xe1df09||0xc8;return function(_0x8d639c){if(_0x8d639c){return _0x7ac535[_0x2357('0xd')](_0xe1df09)[_0x2357('0xe')](_0x8d639c);}};}function respondWithFilteredResult(_0x48544f,_0x435c9b){return function(_0x2ddfb2){if(_0x2ddfb2){var _0x19a344=typeof _0x435c9b[_0x2357('0xf')]===_0x2357('0x10')&&typeof _0x435c9b[_0x2357('0x11')]===_0x2357('0x10');var _0x98ac50=_0x2ddfb2[_0x2357('0x12')];var _0x20028c=_0x19a344?0x0:_0x435c9b[_0x2357('0xf')];var _0x332b77=_0x19a344?_0x2ddfb2[_0x2357('0x12')]:_0x435c9b[_0x2357('0xf')]+_0x435c9b[_0x2357('0x11')];var _0x503562;if(_0x332b77>=_0x98ac50){_0x332b77=_0x98ac50;_0x503562=0xc8;}else{_0x503562=0xce;}_0x48544f[_0x2357('0xd')](_0x503562);return _0x48544f[_0x2357('0x13')](_0x2357('0x14'),_0x20028c+'-'+_0x332b77+'/'+_0x98ac50)[_0x2357('0xe')](_0x2ddfb2);}return null;};}function saveUpdates(_0x3451b4){return function(_0x4e9000){if(_0x4e9000){return _0x4e9000[_0x2357('0x15')](_0x3451b4)[_0x2357('0x16')](function(_0x1bc70a){return _0x1bc70a;});}return null;};}function removeEntity(_0x223d23){return function(_0x17792f){if(_0x17792f){return _0x17792f['destroy']()['then'](function(){var _0xce1101=_0x17792f[_0x2357('0x17')]({'plain':!![]});var _0x10cc1b=_0x2357('0x18');return db[_0x2357('0x19')][_0x2357('0x1a')]({'where':{'type':_0x10cc1b,'resourceId':_0xce1101['id']}})[_0x2357('0x16')](function(){return _0x17792f;});})[_0x2357('0x16')](function(){_0x223d23[_0x2357('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0a8d2){return function(_0xad19bd){if(!_0xad19bd){_0xa0a8d2[_0x2357('0xb')](0x194);}return _0xad19bd;};}function handleError(_0x1044fa,_0x31cb8f){_0x31cb8f=_0x31cb8f||0x1f4;return function(_0x4584ac){logger[_0x2357('0x1b')](_0x4584ac[_0x2357('0x1c')]);if(_0x4584ac[_0x2357('0x1d')]){delete _0x4584ac['name'];}_0x1044fa['status'](_0x31cb8f)['send'](_0x4584ac);};}exports[_0x2357('0x1e')]=function(_0x50676f,_0x4152f2){var _0x4a1871={};var _0x2d3060={'count':0x0,'rows':[]};var _0xa966a7=_[_0x2357('0x1f')](db[_0x2357('0x20')][_0x2357('0x21')],function(_0xdedf43){return{'name':_0xdedf43[_0x2357('0x22')],'type':_0xdedf43[_0x2357('0x23')]['key']};});_0x4a1871=qs[_0x2357('0x24')](_0xa966a7,_0x50676f);var _0x536ca5={'where':_0x4a1871[_0x2357('0x25')]};return db['WhatsappQueue'][_0x2357('0x12')](_0x536ca5)[_0x2357('0x16')](function(_0x5445f3){_0x2d3060['count']=_0x5445f3;_0x4a1871[_0x2357('0x26')]=qs[_0x2357('0x26')](_0x50676f[_0x2357('0x27')]);return db[_0x2357('0x20')]['findAll'](_0x4a1871);})[_0x2357('0x16')](function(_0x141440){_0x2d3060[_0x2357('0x28')]=_0x141440;return _0x2d3060;})['then'](respondWithFilteredResult(_0x4152f2,_0x4a1871))[_0x2357('0x29')](handleError(_0x4152f2,null));};exports[_0x2357('0x2a')]=function(_0x5c47fc,_0x142ea0){var _0x4a6ebf={'raw':!![],'where':{'id':_0x5c47fc[_0x2357('0x2b')]['id']}},_0x1dee4e={};_0x1dee4e[_0x2357('0x2c')]=_[_0x2357('0x2d')](db[_0x2357('0x20')][_0x2357('0x21')]);_0x1dee4e[_0x2357('0x27')]=_['keys'](_0x5c47fc[_0x2357('0x27')]);_0x1dee4e[_0x2357('0x2e')]=_[_0x2357('0x2f')](_0x1dee4e['model'],_0x1dee4e['query']);_0x4a6ebf[_0x2357('0x30')]=_[_0x2357('0x2f')](_0x1dee4e['model'],qs['fields'](_0x5c47fc[_0x2357('0x27')][_0x2357('0x31')]));_0x4a6ebf[_0x2357('0x30')]=_0x4a6ebf[_0x2357('0x30')]['length']?_0x4a6ebf['attributes']:_0x1dee4e[_0x2357('0x2c')];if(_0x5c47fc[_0x2357('0x27')]['includeAll']){_0x4a6ebf[_0x2357('0x26')]=[{'all':!![]}];}_0x4a6ebf=_[_0x2357('0x32')]({},_0x4a6ebf,_0x5c47fc['options']);return db[_0x2357('0x20')][_0x2357('0x33')](_0x4a6ebf)['then'](handleEntityNotFound(_0x142ea0,null))['then'](respondWithResult(_0x142ea0,null))['catch'](handleError(_0x142ea0,null));};exports[_0x2357('0x34')]=function(_0x307ccd,_0x54acdd){return db[_0x2357('0x20')]['create'](_0x307ccd[_0x2357('0x35')],{})[_0x2357('0x16')](function(_0x2a9d61){var _0x312b7a=_0x307ccd[_0x2357('0x36')][_0x2357('0x17')]({'plain':!![]});if(!_0x312b7a)throw new Error(_0x2357('0x37'));if(_0x312b7a[_0x2357('0x38')]===_0x2357('0x36')){var _0x57a31f=_0x2a9d61[_0x2357('0x17')]({'plain':!![]});var _0x123d10=_0x2357('0x18');return db[_0x2357('0x39')][_0x2357('0x33')]({'where':{'name':_0x123d10,'userProfileId':_0x312b7a[_0x2357('0x3a')]},'raw':!![]})[_0x2357('0x16')](function(_0x562db){if(_0x562db&&_0x562db[_0x2357('0x3b')]===0x0){return db[_0x2357('0x19')]['create']({'name':_0x57a31f['name'],'resourceId':_0x57a31f['id'],'type':_0x562db['name'],'sectionId':_0x562db['id']},{})[_0x2357('0x16')](function(){return _0x2a9d61;});}else{return _0x2a9d61;}})[_0x2357('0x29')](function(_0x344319){logger[_0x2357('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x344319);throw _0x344319;});}return _0x2a9d61;})['then'](respondWithResult(_0x54acdd,0xc9))['catch'](handleError(_0x54acdd,null));};exports['update']=function(_0x81f3c4,_0x52b724){if(_0x81f3c4[_0x2357('0x35')]['id']){delete _0x81f3c4[_0x2357('0x35')]['id'];}return db[_0x2357('0x20')][_0x2357('0x33')]({'where':{'id':_0x81f3c4[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x52b724,null))[_0x2357('0x16')](saveUpdates(_0x81f3c4[_0x2357('0x35')],null))[_0x2357('0x16')](respondWithResult(_0x52b724,null))[_0x2357('0x29')](handleError(_0x52b724,null));};exports[_0x2357('0x1a')]=function(_0x122d5d,_0x22bf00){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x122d5d[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x22bf00,null))[_0x2357('0x16')](removeEntity(_0x22bf00,null))[_0x2357('0x29')](handleError(_0x22bf00,null));};exports[_0x2357('0x3c')]=function(_0x4ca473,_0x540e38){return db[_0x2357('0x20')]['describe']()[_0x2357('0x16')](respondWithResult(_0x540e38,null))[_0x2357('0x29')](handleError(_0x540e38,null));};exports[_0x2357('0x3d')]=function(_0x91f06,_0x41d6b0){var _0x520faa={'raw':!![],'where':{}},_0x5b7319={},_0x4fa082;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x91f06[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x41d6b0,null))[_0x2357('0x16')](function(_0x3b5b21){if(_0x3b5b21){_0x4fa082=_0x3b5b21[_0x2357('0x17')]({'plain':!![]});_0x5b7319['model']=_[_0x2357('0x2d')](db[_0x2357('0x3f')][_0x2357('0x21')]);_0x5b7319[_0x2357('0x27')]=_[_0x2357('0x2d')](_0x91f06[_0x2357('0x27')]);_0x5b7319[_0x2357('0x2e')]=_['intersection'](_0x5b7319[_0x2357('0x2c')],_0x5b7319[_0x2357('0x27')]);_0x520faa[_0x2357('0x30')]=_[_0x2357('0x2f')](_0x5b7319[_0x2357('0x2c')],qs[_0x2357('0x31')](_0x91f06[_0x2357('0x27')][_0x2357('0x31')]));_0x520faa['attributes']=_0x520faa[_0x2357('0x30')][_0x2357('0x40')]?_0x520faa[_0x2357('0x30')]:_0x5b7319[_0x2357('0x2c')];if(!_0x91f06['query'][_0x2357('0x41')](_0x2357('0x42'))){_0x520faa[_0x2357('0x11')]=qs[_0x2357('0x11')](_0x91f06['query'][_0x2357('0x11')]);_0x520faa[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x91f06[_0x2357('0x27')][_0x2357('0xf')]);}_0x520faa[_0x2357('0x43')]=qs[_0x2357('0x44')](_0x91f06[_0x2357('0x27')]['sort']);_0x520faa[_0x2357('0x25')]=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x91f06[_0x2357('0x27')],_0x5b7319['filters']));_0x520faa['where'][_0x2357('0x46')]=_0x3b5b21['id'];if(_0x91f06['query'][_0x2357('0x47')]){_0x520faa[_0x2357('0x25')]=_[_0x2357('0x32')](_0x520faa[_0x2357('0x25')],{'$or':_[_0x2357('0x1f')](_0x520faa[_0x2357('0x30')],function(_0x3e0f22){var _0x2eccb7={};_0x2eccb7[_0x3e0f22]={'$like':'%'+_0x91f06['query'][_0x2357('0x47')]+'%'};return _0x2eccb7;})});}_0x520faa=_[_0x2357('0x32')]({},_0x520faa,_0x91f06[_0x2357('0x48')]);return db[_0x2357('0x3f')][_0x2357('0x49')](_0x520faa);}})['then'](function(_0x14b73a){if(_0x14b73a){return db[_0x2357('0x4a')][_0x2357('0x4b')]({'where':{'id':_[_0x2357('0x1f')](_0x14b73a,_0x2357('0x4c')),'role':'agent'},'attributes':['id',_0x2357('0x1d'),_0x2357('0x4d'),_0x2357('0x4e'),_0x2357('0x4f')]});}})[_0x2357('0x16')](function(_0x35982f){if(_0x35982f){return{'count':_0x35982f[_0x2357('0x12')],'rows':_['map'](_0x35982f['rows'],function(_0x4b2439){return{'membername':_0x4b2439[_0x2357('0x1d')],'UserId':_0x4b2439['id'],'queue_name':_0x4fa082[_0x2357('0x1d')],'WhatsappQueueId':_0x4fa082['id'],'interface':util[_0x2357('0x50')](_0x2357('0x51'),_0x2357('0x52'),_0x4b2439[_0x2357('0x1d')]),'penalty':0x0,'paused':_0x4b2439[_0x2357('0x4d')],'createdAt':_0x4b2439['createdAt'],'updatedAt':_0x4b2439['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2357('0x16')](respondWithFilteredResult(_0x41d6b0,_0x520faa))['catch'](handleError(_0x41d6b0,null));};exports[_0x2357('0x53')]=function(_0x86293,_0x30efd6){var _0x241faf={};var _0x536558={};var _0x399b78;var _0x393faf;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x86293[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x30efd6,null))['then'](function(_0x431666){if(_0x431666){_0x399b78=_0x431666;_0x536558[_0x2357('0x2c')]=_['keys'](db[_0x2357('0x54')][_0x2357('0x21')]);_0x536558[_0x2357('0x27')]=_['keys'](_0x86293['query']);_0x536558['filters']=_[_0x2357('0x2f')](_0x536558['model'],_0x536558[_0x2357('0x27')]);_0x241faf['attributes']=_[_0x2357('0x2f')](_0x536558[_0x2357('0x2c')],qs['fields'](_0x86293[_0x2357('0x27')]['fields']));_0x241faf[_0x2357('0x30')]=_0x241faf['attributes']['length']?_0x241faf[_0x2357('0x30')]:_0x536558[_0x2357('0x2c')];_0x241faf[_0x2357('0x43')]=qs['sort'](_0x86293['query'][_0x2357('0x44')]);_0x241faf[_0x2357('0x25')]=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x86293[_0x2357('0x27')],_0x536558['filters']));if(_0x86293[_0x2357('0x27')][_0x2357('0x47')]){_0x241faf[_0x2357('0x25')]=_[_0x2357('0x32')](_0x241faf['where'],{'$or':_['map'](_0x241faf[_0x2357('0x30')],function(_0x120f48){var _0x1a2869={};_0x1a2869[_0x120f48]={'$like':'%'+_0x86293['query'][_0x2357('0x47')]+'%'};return _0x1a2869;})});}_0x241faf=_[_0x2357('0x32')]({},_0x241faf,_0x86293[_0x2357('0x48')]);return _0x399b78['getTeams'](_0x241faf);}})[_0x2357('0x16')](function(_0x3c3935){if(_0x3c3935){_0x393faf=_0x3c3935['length'];if(!_0x86293['query']['hasOwnProperty']('nolimit')){_0x241faf['limit']=qs[_0x2357('0x11')](_0x86293[_0x2357('0x27')][_0x2357('0x11')]);_0x241faf[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x86293[_0x2357('0x27')][_0x2357('0xf')]);}return _0x399b78[_0x2357('0x53')](_0x241faf);}})[_0x2357('0x16')](function(_0x3536c1){if(_0x3536c1){return _0x3536c1?{'count':_0x393faf,'rows':_0x3536c1}:null;}})[_0x2357('0x16')](respondWithResult(_0x30efd6,null))[_0x2357('0x29')](handleError(_0x30efd6,null));};exports[_0x2357('0x55')]=function(_0xe0ab5e,_0x504df4){var _0xad4f31=_0xe0ab5e[_0x2357('0x35')][_0x2357('0x56')];return db[_0x2357('0x54')][_0x2357('0x49')]({'where':{'id':_0xad4f31},'attributes':['id'],'include':[{'model':db[_0x2357('0x4a')],'as':'Agents','attributes':['id',_0x2357('0x1d'),_0x2357('0x57'),_0x2357('0x58'),'interface'],'raw':!![]}]})[_0x2357('0x16')](function(_0x383e93){if(_0x383e93){var _0x81b271=_['flatMap'](_0x383e93,function(_0x549f80){var _0x183e6f=_0x549f80['get']({'plain':!![]});return _0x183e6f[_0x2357('0x59')];});return db[_0x2357('0x20')]['find']({'where':{'id':_0xe0ab5e[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](function(_0x216297){return db[_0x2357('0x5a')][_0x2357('0x5b')](function(_0x5a92e3){return _0x216297[_0x2357('0x55')](_0xad4f31,{'transaction':_0x5a92e3})[_0x2357('0x16')](function(){return BPromise[_0x2357('0x5c')](_0x81b271,function(_0x1ecbec){return db[_0x2357('0x3f')][_0x2357('0x5d')]({'where':{'UserId':_0x1ecbec['id'],'WhatsappQueueId':_0xe0ab5e[_0x2357('0x2b')]['id']},'transaction':_0x5a92e3});});})[_0x2357('0x16')](function(){_0x81b271['forEach'](function(_0x4570bf){socket[_0x2357('0x5e')]('userWhatsappQueue:save',{'UserId':_0x4570bf['id'],'WhatsappQueueId':_0x216297['id']});});});});});}})['then'](respondWithStatusCode(_0x504df4,null))['catch'](handleError(_0x504df4,null));};exports['removeTeams']=function(_0x424b48,_0x24c73f){return db['Team'][_0x2357('0x49')]({'where':{'id':_0x424b48['query'][_0x2357('0x56')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2357('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x24c73f,null))[_0x2357('0x16')](function(_0xa81aca){var _0x3e8e73=_[_0x2357('0x1f')](_0xa81aca,'id');var _0x360c78=[];var _0x34af76=[];var _0x5c08c4=squel[_0x2357('0x5f')]();_0x5c08c4[_0x2357('0x60')](_0x2357('0x61'))[_0x2357('0x62')](_0x2357('0x63'),'tq')[_0x2357('0x64')](_0x2357('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2357('0x25')](_0x2357('0x66'),_0x424b48[_0x2357('0x2b')]['id']);for(var _0x3b6202=0x0;_0x3b6202<_0xa81aca['length'];_0x3b6202+=0x1){let _0x42bfb6=_0xa81aca[_0x3b6202];for(var _0x3555a3=0x0;_0x3555a3<_0x42bfb6[_0x2357('0x59')][_0x2357('0x40')];_0x3555a3+=0x1){let _0xf7d916=_0x42bfb6[_0x2357('0x59')][_0x3555a3];var _0x1577df=_0x5c08c4[_0x2357('0x67')]();_0x1577df[_0x2357('0x25')](_0x2357('0x68'),_0xf7d916['id']);_0x34af76['push'](db[_0x2357('0x5a')][_0x2357('0x27')](_0x1577df[_0x2357('0x69')](),{'type':db['sequelize'][_0x2357('0x6a')]['SELECT']})[_0x2357('0x16')](function(_0x1396b3){if(_0x1396b3['length']===0x1){return _0xf7d916['id'];}else{var _0x60e1ee=_[_0x2357('0x6b')](_[_0x2357('0x1f')](_0x1396b3,_0x2357('0x6c')),function(_0xd06bd4){return _[_0x2357('0x6d')](_0x3e8e73,_0xd06bd4);});if(_0x60e1ee){return _0xf7d916['id'];}}}));}}return BPromise[_0x2357('0x6e')](_0x34af76)[_0x2357('0x16')](function(_0x44a8c8){_0x360c78=_(_0x360c78)[_0x2357('0x6f')](_0x44a8c8)[_0x2357('0x70')]()['value']();return db[_0x2357('0x20')][_0x2357('0x33')]({'where':{'id':_0x424b48[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](function(_0x5800c1){return db[_0x2357('0x5a')][_0x2357('0x5b')](function(_0x3f5047){return _0x5800c1['removeTeams'](_0x424b48[_0x2357('0x27')][_0x2357('0x56')],{'transaction':_0x3f5047})['then'](function(){if(!_[_0x2357('0x71')](_0x360c78)){return _0x5800c1[_0x2357('0x72')](_0x360c78,{'transaction':_0x3f5047});}})[_0x2357('0x16')](function(){_0x360c78[_0x2357('0x73')](function(_0x3194ca){socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':_0x3194ca,'WhatsappQueueId':_0x5800c1['id']});});});});});});})['then'](respondWithStatusCode(_0x24c73f,null))[_0x2357('0x29')](handleError(_0x24c73f,null));};exports[_0x2357('0x75')]=function(_0x5109a8,_0x2f7d48){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x5109a8[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x2f7d48,null))['then'](function(_0x3806c7){if(_0x3806c7){return _0x3806c7['addAgents'](_0x5109a8[_0x2357('0x35')][_0x2357('0x56')],_['omit'](_0x5109a8['body'],[_0x2357('0x56'),'id'])||{})[_0x2357('0x76')](function(_0x524ade){for(var _0x486afd=0x0;_0x486afd<_0x5109a8[_0x2357('0x35')][_0x2357('0x56')][_0x2357('0x40')];_0x486afd+=0x1){socket[_0x2357('0x5e')](_0x2357('0x77'),{'UserId':Number(_0x5109a8['body']['ids'][_0x486afd]),'WhatsappQueueId':Number(_0x5109a8[_0x2357('0x2b')]['id'])});}return _0x524ade;});}})[_0x2357('0x16')](respondWithResult(_0x2f7d48,null))[_0x2357('0x29')](handleError(_0x2f7d48,null));};exports['removeAgents']=function(_0x996e7e,_0x11beaa){return db['WhatsappQueue'][_0x2357('0x33')]({'where':{'id':_0x996e7e['params']['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x11beaa,null))[_0x2357('0x16')](function(_0x52f5c9){if(_0x52f5c9){return _0x52f5c9[_0x2357('0x72')](_0x996e7e[_0x2357('0x27')]['ids'])[_0x2357('0x16')](function(){if(_[_0x2357('0x78')](_0x996e7e[_0x2357('0x27')][_0x2357('0x56')])){for(var _0x206a0d=0x0;_0x206a0d<_0x996e7e[_0x2357('0x27')][_0x2357('0x56')][_0x2357('0x40')];_0x206a0d+=0x1){socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':Number(_0x996e7e[_0x2357('0x27')][_0x2357('0x56')][_0x206a0d]),'WhatsappQueueId':Number(_0x996e7e[_0x2357('0x2b')]['id'])});}}else{socket[_0x2357('0x5e')](_0x2357('0x74'),{'UserId':Number(_0x996e7e[_0x2357('0x27')][_0x2357('0x56')]),'WhatsappQueueId':Number(_0x996e7e[_0x2357('0x2b')]['id'])});}});}})[_0x2357('0x16')](respondWithStatusCode(_0x11beaa,null))[_0x2357('0x29')](handleError(_0x11beaa,null));};exports[_0x2357('0x79')]=function(_0x5940a8,_0x2688d9){var _0x3e2148={};var _0x30f37e={};var _0x19f224;var _0x519d45;return db[_0x2357('0x20')][_0x2357('0x3e')]({'where':{'id':_0x5940a8[_0x2357('0x2b')]['id']}})[_0x2357('0x16')](handleEntityNotFound(_0x2688d9,null))['then'](function(_0x4b9637){if(_0x4b9637){_0x19f224=_0x4b9637;_0x30f37e[_0x2357('0x2c')]=_[_0x2357('0x2d')](db['User'][_0x2357('0x21')]);_0x30f37e['query']=_[_0x2357('0x2d')](_0x5940a8['query']);_0x30f37e[_0x2357('0x2e')]=_[_0x2357('0x2f')](_0x30f37e[_0x2357('0x2c')],_0x30f37e[_0x2357('0x27')]);_0x3e2148['attributes']=_['intersection'](_0x30f37e['model'],qs['fields'](_0x5940a8[_0x2357('0x27')][_0x2357('0x31')]));_0x3e2148[_0x2357('0x30')]=_0x3e2148[_0x2357('0x30')][_0x2357('0x40')]?_0x3e2148[_0x2357('0x30')]:_0x30f37e[_0x2357('0x2c')];_0x3e2148[_0x2357('0x43')]=qs[_0x2357('0x44')](_0x5940a8[_0x2357('0x27')]['sort']);_0x3e2148['where']=qs[_0x2357('0x2e')](_[_0x2357('0x45')](_0x5940a8['query'],_0x30f37e[_0x2357('0x2e')]));if(_0x5940a8['query'][_0x2357('0x47')]){_0x3e2148[_0x2357('0x25')]=_['merge'](_0x3e2148['where'],{'$or':_['map'](_0x3e2148['attributes'],function(_0x2a0e18){var _0x41d683={};_0x41d683[_0x2a0e18]={'$like':'%'+_0x5940a8[_0x2357('0x27')]['filter']+'%'};return _0x41d683;})});}_0x3e2148=_['merge']({},_0x3e2148,_0x5940a8[_0x2357('0x48')]);return _0x19f224[_0x2357('0x79')](_0x3e2148);}})[_0x2357('0x16')](function(_0x507206){if(_0x507206){_0x519d45=_0x507206['length'];if(!_0x5940a8[_0x2357('0x27')][_0x2357('0x41')]('nolimit')){_0x3e2148['limit']=qs['limit'](_0x5940a8['query'][_0x2357('0x11')]);_0x3e2148[_0x2357('0xf')]=qs[_0x2357('0xf')](_0x5940a8[_0x2357('0x27')][_0x2357('0xf')]);}return _0x19f224[_0x2357('0x79')](_0x3e2148);}})['then'](function(_0x35153e){if(_0x35153e){return _0x35153e?{'count':_0x519d45,'rows':_0x35153e}:null;}})[_0x2357('0x16')](respondWithResult(_0x2688d9,null))['catch'](handleError(_0x2688d9,null));}; \ No newline at end of file +var _0xb027=['User','agent','whatsappPause','updatedAt','createdAt','%s/%s','Team','sort','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','bluebird','lodash','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','model','query','keys','attributes','intersection','fields','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','pick','WhatsappQueueId','merge','filter','options'];(function(_0xa80118,_0x199613){var _0x413991=function(_0x3c90a3){while(--_0x3c90a3){_0xa80118['push'](_0xa80118['shift']());}};_0x413991(++_0x199613);}(_0xb027,0xa7));var _0x7b02=function(_0x5c9da5,_0x2be520){_0x5c9da5=_0x5c9da5-0x0;var _0x685de6=_0xb027[_0x5c9da5];return _0x685de6;};'use strict';var BPromise=require(_0x7b02('0x0'));var util=require('util');var _=require(_0x7b02('0x1'));var squel=require(_0x7b02('0x2'));var Redis=require('ioredis');var qs=require(_0x7b02('0x3'));var logger=require('../../config/logger')(_0x7b02('0x4'));var config=require(_0x7b02('0x5'));var db=require(_0x7b02('0x6'))['db'];config[_0x7b02('0x7')]=_[_0x7b02('0x8')](config[_0x7b02('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b02('0x9'))(new Redis(config[_0x7b02('0x7')]));require(_0x7b02('0xa'))['register'](socket);function respondWithStatusCode(_0x3d06f1,_0x3df3b1){_0x3df3b1=_0x3df3b1||0xcc;return function(_0x2170a7){if(_0x2170a7){return _0x3d06f1[_0x7b02('0xb')](_0x3df3b1);}return _0x3d06f1[_0x7b02('0xc')](_0x3df3b1)[_0x7b02('0xd')]();};}function respondWithResult(_0x22ccb8,_0x5a37e7){_0x5a37e7=_0x5a37e7||0xc8;return function(_0x582721){if(_0x582721){return _0x22ccb8[_0x7b02('0xc')](_0x5a37e7)[_0x7b02('0xe')](_0x582721);}};}function respondWithFilteredResult(_0x4759d5,_0x32404f){return function(_0x178821){if(_0x178821){var _0xa6c6ea=typeof _0x32404f[_0x7b02('0xf')]===_0x7b02('0x10')&&typeof _0x32404f[_0x7b02('0x11')]==='undefined';var _0x1247ad=_0x178821[_0x7b02('0x12')];var _0x5e7be4=_0xa6c6ea?0x0:_0x32404f[_0x7b02('0xf')];var _0x31bff8=_0xa6c6ea?_0x178821['count']:_0x32404f[_0x7b02('0xf')]+_0x32404f[_0x7b02('0x11')];var _0xecf7ff;if(_0x31bff8>=_0x1247ad){_0x31bff8=_0x1247ad;_0xecf7ff=0xc8;}else{_0xecf7ff=0xce;}_0x4759d5[_0x7b02('0xc')](_0xecf7ff);return _0x4759d5[_0x7b02('0x13')](_0x7b02('0x14'),_0x5e7be4+'-'+_0x31bff8+'/'+_0x1247ad)[_0x7b02('0xe')](_0x178821);}return null;};}function saveUpdates(_0x21f08b){return function(_0x3741fd){if(_0x3741fd){return _0x3741fd[_0x7b02('0x15')](_0x21f08b)[_0x7b02('0x16')](function(_0x18d799){return _0x18d799;});}return null;};}function removeEntity(_0x468638){return function(_0x4f98d4){if(_0x4f98d4){return _0x4f98d4[_0x7b02('0x17')]()[_0x7b02('0x16')](function(){var _0x482fc4=_0x4f98d4[_0x7b02('0x18')]({'plain':!![]});var _0x209c4e=_0x7b02('0x19');return db['UserProfileResource'][_0x7b02('0x17')]({'where':{'type':_0x209c4e,'resourceId':_0x482fc4['id']}})[_0x7b02('0x16')](function(){return _0x4f98d4;});})[_0x7b02('0x16')](function(){_0x468638[_0x7b02('0xc')](0xcc)[_0x7b02('0xd')]();});}};}function handleEntityNotFound(_0x3e008d){return function(_0x2a79ad){if(!_0x2a79ad){_0x3e008d[_0x7b02('0xb')](0x194);}return _0x2a79ad;};}function handleError(_0x5e3c9c,_0x27a713){_0x27a713=_0x27a713||0x1f4;return function(_0x30663d){logger[_0x7b02('0x1a')](_0x30663d[_0x7b02('0x1b')]);if(_0x30663d[_0x7b02('0x1c')]){delete _0x30663d['name'];}_0x5e3c9c[_0x7b02('0xc')](_0x27a713)[_0x7b02('0x1d')](_0x30663d);};}exports[_0x7b02('0x1e')]=function(_0xaa5428,_0xaa7ee2){var _0x102064={};var _0x25c51a={'count':0x0,'rows':[]};var _0x34a095=_[_0x7b02('0x1f')](db[_0x7b02('0x20')][_0x7b02('0x21')],function(_0x598bc2){return{'name':_0x598bc2[_0x7b02('0x22')],'type':_0x598bc2[_0x7b02('0x23')][_0x7b02('0x24')]};});_0x102064=qs[_0x7b02('0x25')](_0x34a095,_0xaa5428);var _0x3f49f4={'where':_0x102064[_0x7b02('0x26')]};return db[_0x7b02('0x20')][_0x7b02('0x12')](_0x3f49f4)[_0x7b02('0x16')](function(_0x886378){_0x25c51a[_0x7b02('0x12')]=_0x886378;_0x102064[_0x7b02('0x27')]=qs['include'](_0xaa5428['query']);return db[_0x7b02('0x20')][_0x7b02('0x28')](_0x102064);})['then'](function(_0x1b53ba){_0x25c51a[_0x7b02('0x29')]=_0x1b53ba;return _0x25c51a;})[_0x7b02('0x16')](respondWithFilteredResult(_0xaa7ee2,_0x102064))['catch'](handleError(_0xaa7ee2,null));};exports[_0x7b02('0x2a')]=function(_0x4b9371,_0x590b8f){var _0x474b27={'raw':!![],'where':{'id':_0x4b9371[_0x7b02('0x2b')]['id']}},_0x54c761={};_0x54c761[_0x7b02('0x2c')]=_['keys'](db[_0x7b02('0x20')]['rawAttributes']);_0x54c761[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0x4b9371[_0x7b02('0x2d')]);_0x54c761['filters']=_['intersection'](_0x54c761[_0x7b02('0x2c')],_0x54c761[_0x7b02('0x2d')]);_0x474b27[_0x7b02('0x2f')]=_[_0x7b02('0x30')](_0x54c761[_0x7b02('0x2c')],qs[_0x7b02('0x31')](_0x4b9371[_0x7b02('0x2d')][_0x7b02('0x31')]));_0x474b27[_0x7b02('0x2f')]=_0x474b27[_0x7b02('0x2f')][_0x7b02('0x32')]?_0x474b27[_0x7b02('0x2f')]:_0x54c761[_0x7b02('0x2c')];if(_0x4b9371[_0x7b02('0x2d')][_0x7b02('0x33')]){_0x474b27[_0x7b02('0x27')]=[{'all':!![]}];}_0x474b27=_['merge']({},_0x474b27,_0x4b9371['options']);return db[_0x7b02('0x20')][_0x7b02('0x34')](_0x474b27)['then'](handleEntityNotFound(_0x590b8f,null))[_0x7b02('0x16')](respondWithResult(_0x590b8f,null))[_0x7b02('0x35')](handleError(_0x590b8f,null));};exports[_0x7b02('0x36')]=function(_0x4ae19f,_0x2a0108){return db[_0x7b02('0x20')][_0x7b02('0x36')](_0x4ae19f[_0x7b02('0x37')],{})[_0x7b02('0x16')](function(_0x4778d0){var _0x1a40d9=_0x4ae19f[_0x7b02('0x38')][_0x7b02('0x18')]({'plain':!![]});if(!_0x1a40d9)throw new Error(_0x7b02('0x39'));if(_0x1a40d9[_0x7b02('0x3a')]===_0x7b02('0x38')){var _0x34bfe1=_0x4778d0['get']({'plain':!![]});var _0x29d0c8=_0x7b02('0x19');return db[_0x7b02('0x3b')][_0x7b02('0x34')]({'where':{'name':_0x29d0c8,'userProfileId':_0x1a40d9['userProfileId']},'raw':!![]})['then'](function(_0x11b45c){if(_0x11b45c&&_0x11b45c['autoAssociation']===0x0){return db[_0x7b02('0x3c')][_0x7b02('0x36')]({'name':_0x34bfe1[_0x7b02('0x1c')],'resourceId':_0x34bfe1['id'],'type':_0x11b45c['name'],'sectionId':_0x11b45c['id']},{})[_0x7b02('0x16')](function(){return _0x4778d0;});}else{return _0x4778d0;}})[_0x7b02('0x35')](function(_0x11ca7e){logger[_0x7b02('0x1a')](_0x7b02('0x3d'),_0x11ca7e);throw _0x11ca7e;});}return _0x4778d0;})[_0x7b02('0x16')](respondWithResult(_0x2a0108,0xc9))[_0x7b02('0x35')](handleError(_0x2a0108,null));};exports[_0x7b02('0x15')]=function(_0x1deaa4,_0x2a579c){if(_0x1deaa4[_0x7b02('0x37')]['id']){delete _0x1deaa4[_0x7b02('0x37')]['id'];}return db[_0x7b02('0x20')]['find']({'where':{'id':_0x1deaa4[_0x7b02('0x2b')]['id']}})[_0x7b02('0x16')](handleEntityNotFound(_0x2a579c,null))[_0x7b02('0x16')](saveUpdates(_0x1deaa4['body'],null))[_0x7b02('0x16')](respondWithResult(_0x2a579c,null))[_0x7b02('0x35')](handleError(_0x2a579c,null));};exports['destroy']=function(_0x4615fe,_0xed8fda){return db['WhatsappQueue'][_0x7b02('0x34')]({'where':{'id':_0x4615fe[_0x7b02('0x2b')]['id']}})[_0x7b02('0x16')](handleEntityNotFound(_0xed8fda,null))[_0x7b02('0x16')](removeEntity(_0xed8fda,null))['catch'](handleError(_0xed8fda,null));};exports['describe']=function(_0x1f7561,_0xb2dfb0){return db['WhatsappQueue'][_0x7b02('0x3e')]()[_0x7b02('0x16')](respondWithResult(_0xb2dfb0,null))['catch'](handleError(_0xb2dfb0,null));};exports[_0x7b02('0x3f')]=function(_0xe6dd71,_0x2d845e){var _0x4039fc={'raw':!![],'where':{}},_0x40f16c={},_0x1533df;return db[_0x7b02('0x20')][_0x7b02('0x40')]({'where':{'id':_0xe6dd71['params']['id']}})['then'](handleEntityNotFound(_0x2d845e,null))[_0x7b02('0x16')](function(_0x7f92d5){if(_0x7f92d5){_0x1533df=_0x7f92d5['get']({'plain':!![]});_0x40f16c['model']=_[_0x7b02('0x2e')](db[_0x7b02('0x41')][_0x7b02('0x21')]);_0x40f16c[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0xe6dd71[_0x7b02('0x2d')]);_0x40f16c[_0x7b02('0x42')]=_['intersection'](_0x40f16c[_0x7b02('0x2c')],_0x40f16c[_0x7b02('0x2d')]);_0x4039fc[_0x7b02('0x2f')]=_[_0x7b02('0x30')](_0x40f16c[_0x7b02('0x2c')],qs[_0x7b02('0x31')](_0xe6dd71['query'][_0x7b02('0x31')]));_0x4039fc[_0x7b02('0x2f')]=_0x4039fc[_0x7b02('0x2f')][_0x7b02('0x32')]?_0x4039fc[_0x7b02('0x2f')]:_0x40f16c[_0x7b02('0x2c')];if(!_0xe6dd71['query'][_0x7b02('0x43')](_0x7b02('0x44'))){_0x4039fc[_0x7b02('0x11')]=qs[_0x7b02('0x11')](_0xe6dd71['query'][_0x7b02('0x11')]);_0x4039fc[_0x7b02('0xf')]=qs['offset'](_0xe6dd71[_0x7b02('0x2d')][_0x7b02('0xf')]);}_0x4039fc[_0x7b02('0x45')]=qs['sort'](_0xe6dd71[_0x7b02('0x2d')]['sort']);_0x4039fc[_0x7b02('0x26')]=qs[_0x7b02('0x42')](_[_0x7b02('0x46')](_0xe6dd71['query'],_0x40f16c[_0x7b02('0x42')]));_0x4039fc[_0x7b02('0x26')][_0x7b02('0x47')]=_0x7f92d5['id'];if(_0xe6dd71[_0x7b02('0x2d')]['filter']){_0x4039fc['where']=_[_0x7b02('0x48')](_0x4039fc[_0x7b02('0x26')],{'$or':_[_0x7b02('0x1f')](_0x4039fc['attributes'],function(_0x417c44){var _0x3dfeff={};_0x3dfeff[_0x417c44]={'$like':'%'+_0xe6dd71[_0x7b02('0x2d')][_0x7b02('0x49')]+'%'};return _0x3dfeff;})});}_0x4039fc=_[_0x7b02('0x48')]({},_0x4039fc,_0xe6dd71[_0x7b02('0x4a')]);return db[_0x7b02('0x41')][_0x7b02('0x28')](_0x4039fc);}})[_0x7b02('0x16')](function(_0x173e3d){if(_0x173e3d){return db[_0x7b02('0x4b')]['findAndCountAll']({'where':{'id':_[_0x7b02('0x1f')](_0x173e3d,'UserId'),'role':_0x7b02('0x4c')},'attributes':['id',_0x7b02('0x1c'),_0x7b02('0x4d'),_0x7b02('0x4e'),_0x7b02('0x4f')]});}})[_0x7b02('0x16')](function(_0x3edefa){if(_0x3edefa){return{'count':_0x3edefa[_0x7b02('0x12')],'rows':_[_0x7b02('0x1f')](_0x3edefa[_0x7b02('0x29')],function(_0x541a0b){return{'membername':_0x541a0b['name'],'UserId':_0x541a0b['id'],'queue_name':_0x1533df[_0x7b02('0x1c')],'WhatsappQueueId':_0x1533df['id'],'interface':util['format'](_0x7b02('0x50'),'SIP',_0x541a0b[_0x7b02('0x1c')]),'penalty':0x0,'paused':_0x541a0b[_0x7b02('0x4d')],'createdAt':_0x541a0b[_0x7b02('0x4f')],'updatedAt':_0x541a0b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d845e,_0x4039fc))['catch'](handleError(_0x2d845e,null));};exports['getTeams']=function(_0x2d2804,_0x1385f9){var _0xc619b9={};var _0x43636d={};var _0xc49796;var _0x102f8a;return db[_0x7b02('0x20')][_0x7b02('0x40')]({'where':{'id':_0x2d2804['params']['id']}})[_0x7b02('0x16')](handleEntityNotFound(_0x1385f9,null))[_0x7b02('0x16')](function(_0x2ec5a4){if(_0x2ec5a4){_0xc49796=_0x2ec5a4;_0x43636d[_0x7b02('0x2c')]=_[_0x7b02('0x2e')](db[_0x7b02('0x51')][_0x7b02('0x21')]);_0x43636d[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0x2d2804[_0x7b02('0x2d')]);_0x43636d[_0x7b02('0x42')]=_[_0x7b02('0x30')](_0x43636d[_0x7b02('0x2c')],_0x43636d[_0x7b02('0x2d')]);_0xc619b9[_0x7b02('0x2f')]=_['intersection'](_0x43636d[_0x7b02('0x2c')],qs[_0x7b02('0x31')](_0x2d2804['query'][_0x7b02('0x31')]));_0xc619b9[_0x7b02('0x2f')]=_0xc619b9['attributes'][_0x7b02('0x32')]?_0xc619b9[_0x7b02('0x2f')]:_0x43636d['model'];_0xc619b9[_0x7b02('0x45')]=qs[_0x7b02('0x52')](_0x2d2804[_0x7b02('0x2d')][_0x7b02('0x52')]);_0xc619b9[_0x7b02('0x26')]=qs['filters'](_[_0x7b02('0x46')](_0x2d2804[_0x7b02('0x2d')],_0x43636d[_0x7b02('0x42')]));if(_0x2d2804[_0x7b02('0x2d')]['filter']){_0xc619b9[_0x7b02('0x26')]=_[_0x7b02('0x48')](_0xc619b9['where'],{'$or':_[_0x7b02('0x1f')](_0xc619b9[_0x7b02('0x2f')],function(_0x3e130f){var _0xdcec54={};_0xdcec54[_0x3e130f]={'$like':'%'+_0x2d2804[_0x7b02('0x2d')][_0x7b02('0x49')]+'%'};return _0xdcec54;})});}_0xc619b9=_[_0x7b02('0x48')]({},_0xc619b9,_0x2d2804[_0x7b02('0x4a')]);return _0xc49796['getTeams'](_0xc619b9);}})[_0x7b02('0x16')](function(_0x365f58){if(_0x365f58){_0x102f8a=_0x365f58[_0x7b02('0x32')];if(!_0x2d2804[_0x7b02('0x2d')]['hasOwnProperty'](_0x7b02('0x44'))){_0xc619b9[_0x7b02('0x11')]=qs[_0x7b02('0x11')](_0x2d2804[_0x7b02('0x2d')][_0x7b02('0x11')]);_0xc619b9[_0x7b02('0xf')]=qs[_0x7b02('0xf')](_0x2d2804[_0x7b02('0x2d')][_0x7b02('0xf')]);}return _0xc49796['getTeams'](_0xc619b9);}})[_0x7b02('0x16')](function(_0xc5081a){if(_0xc5081a){return _0xc5081a?{'count':_0x102f8a,'rows':_0xc5081a}:null;}})[_0x7b02('0x16')](respondWithResult(_0x1385f9,null))[_0x7b02('0x35')](handleError(_0x1385f9,null));};exports['addTeams']=function(_0x7f9af4,_0x53a7d6){var _0x25e952=_0x7f9af4[_0x7b02('0x37')][_0x7b02('0x53')];return db[_0x7b02('0x51')][_0x7b02('0x28')]({'where':{'id':_0x25e952},'attributes':['id'],'include':[{'model':db[_0x7b02('0x4b')],'as':_0x7b02('0x54'),'attributes':['id','name',_0x7b02('0x55'),_0x7b02('0x56'),_0x7b02('0x57')],'raw':!![]}]})[_0x7b02('0x16')](function(_0x1f430b){if(_0x1f430b){var _0x2cd077=_[_0x7b02('0x58')](_0x1f430b,function(_0x2054ae){var _0x4e2bc4=_0x2054ae[_0x7b02('0x18')]({'plain':!![]});return _0x4e2bc4[_0x7b02('0x54')];});return db[_0x7b02('0x20')][_0x7b02('0x34')]({'where':{'id':_0x7f9af4[_0x7b02('0x2b')]['id']}})['then'](function(_0x622230){return db[_0x7b02('0x59')][_0x7b02('0x5a')](function(_0x3aeb2a){return _0x622230[_0x7b02('0x5b')](_0x25e952,{'transaction':_0x3aeb2a})[_0x7b02('0x16')](function(){return BPromise['each'](_0x2cd077,function(_0x5a9708){return db[_0x7b02('0x41')]['findOrCreate']({'where':{'UserId':_0x5a9708['id'],'WhatsappQueueId':_0x7f9af4[_0x7b02('0x2b')]['id']},'transaction':_0x3aeb2a});});})[_0x7b02('0x16')](function(){_0x2cd077[_0x7b02('0x5c')](function(_0x26bcde){socket[_0x7b02('0x5d')](_0x7b02('0x5e'),{'UserId':_0x26bcde['id'],'WhatsappQueueId':_0x622230['id']});});});});});}})[_0x7b02('0x16')](respondWithStatusCode(_0x53a7d6,null))['catch'](handleError(_0x53a7d6,null));};exports[_0x7b02('0x5f')]=function(_0x11535e,_0x58c44f){return db[_0x7b02('0x51')][_0x7b02('0x28')]({'where':{'id':_0x11535e[_0x7b02('0x2d')][_0x7b02('0x53')]},'attributes':['id'],'include':[{'model':db[_0x7b02('0x4b')],'as':_0x7b02('0x54'),'attributes':['id'],'raw':!![]}]})[_0x7b02('0x16')](handleEntityNotFound(_0x58c44f,null))[_0x7b02('0x16')](function(_0x4037a5){var _0x2dfd2d=_[_0x7b02('0x1f')](_0x4037a5,'id');var _0x1c8baf=[];var _0x1e8731=[];var _0x2ddd09=squel[_0x7b02('0x60')]();_0x2ddd09[_0x7b02('0x61')](_0x7b02('0x62'))[_0x7b02('0x63')](_0x7b02('0x64'),'tq')[_0x7b02('0x65')](_0x7b02('0x66'),'ut',_0x7b02('0x67'))[_0x7b02('0x26')]('WhatsappQueueId\x20=\x20?',_0x11535e[_0x7b02('0x2b')]['id']);for(var _0x5ee0c1=0x0;_0x5ee0c1<_0x4037a5[_0x7b02('0x32')];_0x5ee0c1+=0x1){let _0x528b47=_0x4037a5[_0x5ee0c1];for(var _0x8b6a75=0x0;_0x8b6a75<_0x528b47['Agents']['length'];_0x8b6a75+=0x1){let _0x4da543=_0x528b47[_0x7b02('0x54')][_0x8b6a75];var _0x247b25=_0x2ddd09['clone']();_0x247b25[_0x7b02('0x26')](_0x7b02('0x68'),_0x4da543['id']);_0x1e8731[_0x7b02('0x69')](db[_0x7b02('0x59')][_0x7b02('0x2d')](_0x247b25[_0x7b02('0x6a')](),{'type':db[_0x7b02('0x59')][_0x7b02('0x6b')]['SELECT']})[_0x7b02('0x16')](function(_0x29fc82){if(_0x29fc82[_0x7b02('0x32')]===0x1){return _0x4da543['id'];}else{var _0x29a4fb=_['every'](_[_0x7b02('0x1f')](_0x29fc82,_0x7b02('0x6c')),function(_0x24abef){return _[_0x7b02('0x6d')](_0x2dfd2d,_0x24abef);});if(_0x29a4fb){return _0x4da543['id'];}}}));}}return BPromise[_0x7b02('0x6e')](_0x1e8731)[_0x7b02('0x16')](function(_0x26d722){_0x1c8baf=_(_0x1c8baf)[_0x7b02('0x6f')](_0x26d722)[_0x7b02('0x70')]()[_0x7b02('0x71')]();return db[_0x7b02('0x20')]['find']({'where':{'id':_0x11535e[_0x7b02('0x2b')]['id']}})[_0x7b02('0x16')](function(_0x2b23a4){return db[_0x7b02('0x59')][_0x7b02('0x5a')](function(_0x386db7){return _0x2b23a4['removeTeams'](_0x11535e[_0x7b02('0x2d')][_0x7b02('0x53')],{'transaction':_0x386db7})[_0x7b02('0x16')](function(){if(!_[_0x7b02('0x72')](_0x1c8baf)){return _0x2b23a4[_0x7b02('0x73')](_0x1c8baf,{'transaction':_0x386db7});}})[_0x7b02('0x16')](function(){_0x1c8baf[_0x7b02('0x5c')](function(_0x359840){socket[_0x7b02('0x5d')](_0x7b02('0x74'),{'UserId':_0x359840,'WhatsappQueueId':_0x2b23a4['id']});});});});});});})['then'](respondWithStatusCode(_0x58c44f,null))[_0x7b02('0x35')](handleError(_0x58c44f,null));};exports[_0x7b02('0x75')]=function(_0x7e19f4,_0x38c499){return db['WhatsappQueue'][_0x7b02('0x34')]({'where':{'id':_0x7e19f4[_0x7b02('0x2b')]['id']}})['then'](handleEntityNotFound(_0x38c499,null))[_0x7b02('0x16')](function(_0x185524){if(_0x185524){return _0x185524['addAgents'](_0x7e19f4['body'][_0x7b02('0x53')],_[_0x7b02('0x76')](_0x7e19f4[_0x7b02('0x37')],[_0x7b02('0x53'),'id'])||{})[_0x7b02('0x77')](function(_0xaa6089){for(var _0x2c4b27=0x0;_0x2c4b27<_0x7e19f4[_0x7b02('0x37')][_0x7b02('0x53')][_0x7b02('0x32')];_0x2c4b27+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0x7e19f4[_0x7b02('0x37')][_0x7b02('0x53')][_0x2c4b27]),'WhatsappQueueId':Number(_0x7e19f4[_0x7b02('0x2b')]['id'])});}return _0xaa6089;});}})['then'](respondWithResult(_0x38c499,null))[_0x7b02('0x35')](handleError(_0x38c499,null));};exports['removeAgents']=function(_0x55e9db,_0x1a9a80){return db[_0x7b02('0x20')][_0x7b02('0x34')]({'where':{'id':_0x55e9db[_0x7b02('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1a9a80,null))[_0x7b02('0x16')](function(_0x46c1b0){if(_0x46c1b0){return _0x46c1b0[_0x7b02('0x73')](_0x55e9db[_0x7b02('0x2d')][_0x7b02('0x53')])[_0x7b02('0x16')](function(){if(_['isArray'](_0x55e9db[_0x7b02('0x2d')]['ids'])){for(var _0x553d14=0x0;_0x553d14<_0x55e9db[_0x7b02('0x2d')]['ids'][_0x7b02('0x32')];_0x553d14+=0x1){socket[_0x7b02('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x55e9db[_0x7b02('0x2d')]['ids'][_0x553d14]),'WhatsappQueueId':Number(_0x55e9db['params']['id'])});}}else{socket[_0x7b02('0x5d')](_0x7b02('0x74'),{'UserId':Number(_0x55e9db['query']['ids']),'WhatsappQueueId':Number(_0x55e9db[_0x7b02('0x2b')]['id'])});}});}})[_0x7b02('0x16')](respondWithStatusCode(_0x1a9a80,null))['catch'](handleError(_0x1a9a80,null));};exports[_0x7b02('0x78')]=function(_0x26ae75,_0x2a20c3){var _0x239a18={};var _0x49c03d={};var _0x484406;var _0x1049c5;return db['WhatsappQueue'][_0x7b02('0x40')]({'where':{'id':_0x26ae75[_0x7b02('0x2b')]['id']}})[_0x7b02('0x16')](handleEntityNotFound(_0x2a20c3,null))[_0x7b02('0x16')](function(_0xdddad8){if(_0xdddad8){_0x484406=_0xdddad8;_0x49c03d['model']=_[_0x7b02('0x2e')](db[_0x7b02('0x4b')]['rawAttributes']);_0x49c03d[_0x7b02('0x2d')]=_[_0x7b02('0x2e')](_0x26ae75[_0x7b02('0x2d')]);_0x49c03d[_0x7b02('0x42')]=_[_0x7b02('0x30')](_0x49c03d[_0x7b02('0x2c')],_0x49c03d['query']);_0x239a18[_0x7b02('0x2f')]=_[_0x7b02('0x30')](_0x49c03d[_0x7b02('0x2c')],qs[_0x7b02('0x31')](_0x26ae75[_0x7b02('0x2d')][_0x7b02('0x31')]));_0x239a18[_0x7b02('0x2f')]=_0x239a18[_0x7b02('0x2f')][_0x7b02('0x32')]?_0x239a18['attributes']:_0x49c03d[_0x7b02('0x2c')];_0x239a18[_0x7b02('0x45')]=qs[_0x7b02('0x52')](_0x26ae75[_0x7b02('0x2d')]['sort']);_0x239a18[_0x7b02('0x26')]=qs[_0x7b02('0x42')](_['pick'](_0x26ae75[_0x7b02('0x2d')],_0x49c03d['filters']));if(_0x26ae75['query'][_0x7b02('0x49')]){_0x239a18[_0x7b02('0x26')]=_[_0x7b02('0x48')](_0x239a18[_0x7b02('0x26')],{'$or':_['map'](_0x239a18[_0x7b02('0x2f')],function(_0xf096e1){var _0x605cd3={};_0x605cd3[_0xf096e1]={'$like':'%'+_0x26ae75[_0x7b02('0x2d')]['filter']+'%'};return _0x605cd3;})});}_0x239a18=_[_0x7b02('0x48')]({},_0x239a18,_0x26ae75['options']);return _0x484406[_0x7b02('0x78')](_0x239a18);}})[_0x7b02('0x16')](function(_0x3f3601){if(_0x3f3601){_0x1049c5=_0x3f3601['length'];if(!_0x26ae75['query'][_0x7b02('0x43')](_0x7b02('0x44'))){_0x239a18[_0x7b02('0x11')]=qs[_0x7b02('0x11')](_0x26ae75['query']['limit']);_0x239a18[_0x7b02('0xf')]=qs[_0x7b02('0xf')](_0x26ae75[_0x7b02('0x2d')]['offset']);}return _0x484406[_0x7b02('0x78')](_0x239a18);}})['then'](function(_0x56e76d){if(_0x56e76d){return _0x56e76d?{'count':_0x1049c5,'rows':_0x56e76d}:null;}})[_0x7b02('0x16')](respondWithResult(_0x2a20c3,null))['catch'](handleError(_0x2a20c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7941981..5737dad 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 _0x0f8f=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x205722,_0x211278){var _0x4da59c=function(_0x3e070e){while(--_0x3e070e){_0x205722['push'](_0x205722['shift']());}};_0x4da59c(++_0x211278);}(_0x0f8f,0x1af));var _0xf0f8=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x0f8f[_0x3d9176];return _0x12adc5;};'use strict';var EventEmitter=require(_0xf0f8('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf0f8('0x1')](0x0);var events={'afterCreate':_0xf0f8('0x2'),'afterUpdate':_0xf0f8('0x3'),'afterDestroy':_0xf0f8('0x4')};function emitEvent(_0x437b4e){return function(_0x8df88d,_0x59ebe2,_0x2b4b83){WhatsappQueueEvents[_0xf0f8('0x5')](_0x437b4e+':'+_0x8df88d['id'],_0x8df88d);WhatsappQueueEvents['emit'](_0x437b4e,_0x8df88d);_0x2b4b83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xf0f8('0x6')](e,emitEvent(event));}}module[_0xf0f8('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4d65=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1599b5,_0x28b24b){var _0x22b161=function(_0x3d936e){while(--_0x3d936e){_0x1599b5['push'](_0x1599b5['shift']());}};_0x22b161(++_0x28b24b);}(_0x4d65,0x15d));var _0x54d6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4d65[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x54d6('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x54d6('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x54d6('0x2')](0x0);var events={'afterCreate':_0x54d6('0x3'),'afterUpdate':_0x54d6('0x4'),'afterDestroy':_0x54d6('0x5')};function emitEvent(_0x4d8de6){return function(_0x5e68ee,_0x5be15a,_0x5207f5){WhatsappQueueEvents[_0x54d6('0x6')](_0x4d8de6+':'+_0x5e68ee['id'],_0x5e68ee);WhatsappQueueEvents[_0x54d6('0x6')](_0x4d8de6,_0x5e68ee);_0x5207f5(null);};}for(var e in events){if(events[_0x54d6('0x7')](e)){var event=events[e];WhatsappQueue[_0x54d6('0x8')](e,emitEvent(event));}}module[_0x54d6('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 11ceaca..e6c9dd2 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 _0xfc24=['rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xfc24,0x132));var _0x4fc2=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xfc24[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0x4fc2('0x0'));var util=require('util');var logger=require(_0x4fc2('0x1'))(_0x4fc2('0x2'));var moment=require(_0x4fc2('0x3'));var BPromise=require('bluebird');var rp=require(_0x4fc2('0x4'));var fs=require('fs');var path=require(_0x4fc2('0x5'));var rimraf=require(_0x4fc2('0x6'));var config=require(_0x4fc2('0x7'));var attributes=require(_0x4fc2('0x8'));module['exports']=function(_0x552f4e,_0x240b3c){return _0x552f4e[_0x4fc2('0x9')](_0x4fc2('0xa'),attributes,{'tableName':_0x4fc2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ecc=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xa090d9,_0x3382a9){var _0xfc6a6d=function(_0x2facf3){while(--_0x2facf3){_0xa090d9['push'](_0xa090d9['shift']());}};_0xfc6a6d(++_0x3382a9);}(_0x0ecc,0x118));var _0xc0ec=function(_0x3d0123,_0xcf2395){_0x3d0123=_0x3d0123-0x0;var _0x3ead32=_0x0ecc[_0x3d0123];return _0x3ead32;};'use strict';var _=require(_0xc0ec('0x0'));var util=require(_0xc0ec('0x1'));var logger=require(_0xc0ec('0x2'))(_0xc0ec('0x3'));var moment=require(_0xc0ec('0x4'));var BPromise=require(_0xc0ec('0x5'));var rp=require(_0xc0ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc0ec('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xc0ec('0x8')]=function(_0x86659,_0x38c347){return _0x86659[_0xc0ec('0x9')](_0xc0ec('0xa'),attributes,{'tableName':_0xc0ec('0xb'),'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 947aba2..09f4c92 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 _0xe480=['catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','model','include','map','ShowWhatsappQueue','find','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result'];(function(_0x11b516,_0x556ecb){var _0x98b5d8=function(_0x1372d){while(--_0x1372d){_0x11b516['push'](_0x11b516['shift']());}};_0x98b5d8(++_0x556ecb);}(_0xe480,0x89));var _0x0e48=function(_0x4be445,_0x590c14){_0x4be445=_0x4be445-0x0;var _0x3557d6=_0xe480[_0x4be445];return _0x3557d6;};'use strict';var _=require(_0x0e48('0x0'));var util=require('util');var moment=require(_0x0e48('0x1'));var BPromise=require(_0x0e48('0x2'));var rs=require(_0x0e48('0x3'));var fs=require('fs');var Redis=require(_0x0e48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e48('0x5'));var logger=require(_0x0e48('0x6'))(_0x0e48('0x7'));var config=require(_0x0e48('0x8'));var jayson=require(_0x0e48('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0e48('0xa')]=_[_0x0e48('0xb')](config[_0x0e48('0xa')],{'host':_0x0e48('0xc'),'port':0x18eb});var socket=require(_0x0e48('0xd'))(new Redis(config[_0x0e48('0xa')]));require(_0x0e48('0xe'))[_0x0e48('0xf')](socket);function respondWithRpcPromise(_0x165eab,_0x1c4ba7,_0x1aec59){return new BPromise(function(_0x1f06d7,_0x45a2b6){return client[_0x0e48('0x10')](_0x165eab,_0x1aec59)['then'](function(_0x5253bd){logger[_0x0e48('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x1c4ba7,_0x0e48('0x12'));logger[_0x0e48('0x13')](_0x0e48('0x14'),_0x1c4ba7,'request\x20sent',JSON[_0x0e48('0x15')](_0x5253bd));if(_0x5253bd[_0x0e48('0x16')]){if(_0x5253bd[_0x0e48('0x16')][_0x0e48('0x17')]===0x1f4){logger['error'](_0x0e48('0x18'),_0x1c4ba7,_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);return _0x45a2b6(_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);}logger[_0x0e48('0x16')](_0x0e48('0x18'),_0x1c4ba7,_0x5253bd[_0x0e48('0x16')][_0x0e48('0x19')]);return _0x1f06d7(_0x5253bd['error'][_0x0e48('0x19')]);}else{logger['info'](_0x0e48('0x18'),_0x1c4ba7,_0x0e48('0x12'));_0x1f06d7(_0x5253bd[_0x0e48('0x1a')][_0x0e48('0x19')]);}})[_0x0e48('0x1b')](function(_0x16f5cb){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1c4ba7,_0x16f5cb);_0x45a2b6(_0x16f5cb);});});}exports[_0x0e48('0x1c')]=function(_0x35468b){var _0x2dd8af=this;return new Promise(function(_0x4a0453,_0x36ae5a){return db['WhatsappQueue'][_0x0e48('0x1d')]({'raw':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')][_0x0e48('0x1f')]===undefined?!![]:![]:!![],'where':_0x35468b[_0x0e48('0x1e')]?_0x35468b['options'][_0x0e48('0x20')]||null:null,'attributes':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')][_0x0e48('0x21')]||null:null,'limit':_0x35468b[_0x0e48('0x1e')]?_0x35468b['options'][_0x0e48('0x22')]||null:null,'include':_0x35468b[_0x0e48('0x1e')]?_0x35468b[_0x0e48('0x1e')]['include']?_['map'](_0x35468b[_0x0e48('0x1e')]['include'],function(_0x2ff6ba){return{'model':db[_0x2ff6ba[_0x0e48('0x23')]],'as':_0x2ff6ba['as'],'attributes':_0x2ff6ba[_0x0e48('0x21')],'include':_0x2ff6ba[_0x0e48('0x24')]?_['map'](_0x2ff6ba['include'],function(_0x498de6){return{'model':db[_0x498de6[_0x0e48('0x23')]],'as':_0x498de6['as'],'attributes':_0x498de6['attributes'],'include':_0x498de6[_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x498de6['include'],function(_0x1eb87e){return{'model':db[_0x1eb87e['model']],'as':_0x1eb87e['as'],'attributes':_0x1eb87e[_0x0e48('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x93ea1d){logger['info'](_0x0e48('0x1c'),_0x35468b);logger[_0x0e48('0x13')](_0x0e48('0x1c'),_0x35468b,JSON[_0x0e48('0x15')](_0x93ea1d));_0x4a0453(_0x93ea1d);})[_0x0e48('0x1b')](function(_0x4d8745){logger[_0x0e48('0x16')](_0x0e48('0x1c'),_0x4d8745[_0x0e48('0x19')],_0x35468b);_0x36ae5a(_0x2dd8af[_0x0e48('0x16')](0x1f4,_0x4d8745[_0x0e48('0x19')]));});});};exports[_0x0e48('0x26')]=function(_0x40d992){var _0x5be978=this;return new Promise(function(_0x3137bd,_0x357973){return db['WhatsappQueue'][_0x0e48('0x27')]({'raw':_0x40d992[_0x0e48('0x1e')]?_0x40d992['options'][_0x0e48('0x1f')]===undefined?!![]:![]:!![],'where':_0x40d992['options']?_0x40d992['options'][_0x0e48('0x20')]||null:null,'attributes':_0x40d992['options']?_0x40d992[_0x0e48('0x1e')]['attributes']||null:null,'include':_0x40d992['options']?_0x40d992[_0x0e48('0x1e')][_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x40d992[_0x0e48('0x1e')][_0x0e48('0x24')],function(_0x5be415){return{'model':db[_0x5be415[_0x0e48('0x23')]],'as':_0x5be415['as'],'attributes':_0x5be415[_0x0e48('0x21')],'include':_0x5be415['include']?_[_0x0e48('0x25')](_0x5be415['include'],function(_0x15650f){return{'model':db[_0x15650f[_0x0e48('0x23')]],'as':_0x15650f['as'],'attributes':_0x15650f[_0x0e48('0x21')],'include':_0x15650f[_0x0e48('0x24')]?_[_0x0e48('0x25')](_0x15650f[_0x0e48('0x24')],function(_0x42c99a){return{'model':db[_0x42c99a[_0x0e48('0x23')]],'as':_0x42c99a['as'],'attributes':_0x42c99a['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e48('0x28')](function(_0x4c531e){logger[_0x0e48('0x11')](_0x0e48('0x26'),_0x40d992);logger[_0x0e48('0x13')](_0x0e48('0x26'),_0x40d992,JSON['stringify'](_0x4c531e));_0x3137bd(_0x4c531e);})[_0x0e48('0x1b')](function(_0x5e8ed5){logger[_0x0e48('0x16')](_0x0e48('0x26'),_0x5e8ed5['message'],_0x40d992);_0x357973(_0x5be978['error'](0x1f4,_0x5e8ed5[_0x0e48('0x19')]));});});}; \ No newline at end of file +var _0xd201=['register','then','info','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','options','where','attributes','limit','map','include','model','debug','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./whatsappQueue.socket'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd201,0x1c6));var _0x1d20=function(_0x24f870,_0x2c8a88){_0x24f870=_0x24f870-0x0;var _0x5d065b=_0xd201[_0x24f870];return _0x5d065b;};'use strict';var _=require(_0x1d20('0x0'));var util=require(_0x1d20('0x1'));var moment=require(_0x1d20('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d20('0x3'));var fs=require('fs');var Redis=require(_0x1d20('0x4'));var db=require(_0x1d20('0x5'))['db'];var utils=require(_0x1d20('0x6'));var logger=require('../../config/logger')(_0x1d20('0x7'));var config=require(_0x1d20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d20('0x9')]['http']({'port':0x232a});config[_0x1d20('0xa')]=_[_0x1d20('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1d20('0xc'))(new Redis(config['redis']));require(_0x1d20('0xd'))[_0x1d20('0xe')](socket);function respondWithRpcPromise(_0x3e6c18,_0x5025de,_0xfdef8c){return new BPromise(function(_0x5366f0,_0x2370a1){return client['request'](_0x3e6c18,_0xfdef8c)[_0x1d20('0xf')](function(_0x1ea2d2){logger[_0x1d20('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x5025de,_0x1d20('0x11'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x5025de,_0x1d20('0x11'),JSON[_0x1d20('0x12')](_0x1ea2d2));if(_0x1ea2d2['error']){if(_0x1ea2d2[_0x1d20('0x13')][_0x1d20('0x14')]===0x1f4){logger[_0x1d20('0x13')](_0x1d20('0x15'),_0x5025de,_0x1ea2d2[_0x1d20('0x13')][_0x1d20('0x16')]);return _0x2370a1(_0x1ea2d2['error']['message']);}logger[_0x1d20('0x13')](_0x1d20('0x15'),_0x5025de,_0x1ea2d2[_0x1d20('0x13')]['message']);return _0x5366f0(_0x1ea2d2['error'][_0x1d20('0x16')]);}else{logger[_0x1d20('0x10')](_0x1d20('0x15'),_0x5025de,_0x1d20('0x11'));_0x5366f0(_0x1ea2d2['result']['message']);}})[_0x1d20('0x17')](function(_0x50dca2){logger[_0x1d20('0x13')](_0x1d20('0x15'),_0x5025de,_0x50dca2);_0x2370a1(_0x50dca2);});});}exports['GetWhatsappQueue']=function(_0xe18b1c){var _0xa198ef=this;return new Promise(function(_0x4efcca,_0x2035c0){return db['WhatsappQueue']['findAll']({'raw':_0xe18b1c[_0x1d20('0x18')]?_0xe18b1c['options']['raw']===undefined?!![]:![]:!![],'where':_0xe18b1c['options']?_0xe18b1c['options'][_0x1d20('0x19')]||null:null,'attributes':_0xe18b1c[_0x1d20('0x18')]?_0xe18b1c['options'][_0x1d20('0x1a')]||null:null,'limit':_0xe18b1c[_0x1d20('0x18')]?_0xe18b1c[_0x1d20('0x18')][_0x1d20('0x1b')]||null:null,'include':_0xe18b1c[_0x1d20('0x18')]?_0xe18b1c[_0x1d20('0x18')]['include']?_[_0x1d20('0x1c')](_0xe18b1c['options'][_0x1d20('0x1d')],function(_0x541aa8){return{'model':db[_0x541aa8['model']],'as':_0x541aa8['as'],'attributes':_0x541aa8['attributes'],'include':_0x541aa8[_0x1d20('0x1d')]?_['map'](_0x541aa8['include'],function(_0x5604c0){return{'model':db[_0x5604c0[_0x1d20('0x1e')]],'as':_0x5604c0['as'],'attributes':_0x5604c0['attributes'],'include':_0x5604c0[_0x1d20('0x1d')]?_['map'](_0x5604c0[_0x1d20('0x1d')],function(_0x8e262a){return{'model':db[_0x8e262a[_0x1d20('0x1e')]],'as':_0x8e262a['as'],'attributes':_0x8e262a[_0x1d20('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1d20('0xf')](function(_0x53fcf){logger[_0x1d20('0x10')]('GetWhatsappQueue',_0xe18b1c);logger[_0x1d20('0x1f')](_0x1d20('0x20'),_0xe18b1c,JSON[_0x1d20('0x12')](_0x53fcf));_0x4efcca(_0x53fcf);})[_0x1d20('0x17')](function(_0x468f63){logger['error'](_0x1d20('0x20'),_0x468f63['message'],_0xe18b1c);_0x2035c0(_0xa198ef[_0x1d20('0x13')](0x1f4,_0x468f63[_0x1d20('0x16')]));});});};exports[_0x1d20('0x21')]=function(_0x21ab92){var _0x3ca012=this;return new Promise(function(_0x2a30e8,_0x535e08){return db[_0x1d20('0x22')]['find']({'raw':_0x21ab92['options']?_0x21ab92[_0x1d20('0x18')][_0x1d20('0x23')]===undefined?!![]:![]:!![],'where':_0x21ab92[_0x1d20('0x18')]?_0x21ab92[_0x1d20('0x18')]['where']||null:null,'attributes':_0x21ab92[_0x1d20('0x18')]?_0x21ab92[_0x1d20('0x18')]['attributes']||null:null,'include':_0x21ab92[_0x1d20('0x18')]?_0x21ab92['options']['include']?_[_0x1d20('0x1c')](_0x21ab92['options'][_0x1d20('0x1d')],function(_0x16819f){return{'model':db[_0x16819f['model']],'as':_0x16819f['as'],'attributes':_0x16819f[_0x1d20('0x1a')],'include':_0x16819f['include']?_['map'](_0x16819f[_0x1d20('0x1d')],function(_0x46ea4d){return{'model':db[_0x46ea4d['model']],'as':_0x46ea4d['as'],'attributes':_0x46ea4d['attributes'],'include':_0x46ea4d[_0x1d20('0x1d')]?_[_0x1d20('0x1c')](_0x46ea4d[_0x1d20('0x1d')],function(_0x2bad3d){return{'model':db[_0x2bad3d['model']],'as':_0x2bad3d['as'],'attributes':_0x2bad3d[_0x1d20('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1d20('0xf')](function(_0x546b80){logger[_0x1d20('0x10')]('ShowWhatsappQueue',_0x21ab92);logger['debug'](_0x1d20('0x21'),_0x21ab92,JSON[_0x1d20('0x12')](_0x546b80));_0x2a30e8(_0x546b80);})[_0x1d20('0x17')](function(_0xc31e6a){logger[_0x1d20('0x13')](_0x1d20('0x21'),_0xc31e6a['message'],_0x21ab92);_0x535e08(_0x3ca012['error'](0x1f4,_0xc31e6a[_0x1d20('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0ee48ae..8828bfd 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 _0x3c6e=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener'];(function(_0x2515db,_0x2715c){var _0x4d69dc=function(_0x346630){while(--_0x346630){_0x2515db['push'](_0x2515db['shift']());}};_0x4d69dc(++_0x2715c);}(_0x3c6e,0x16b));var _0xe3c6=function(_0x41c63b,_0x5be343){_0x41c63b=_0x41c63b-0x0;var _0x16ca9f=_0x3c6e[_0x41c63b];return _0x16ca9f;};'use strict';var WhatsappQueueEvents=require(_0xe3c6('0x0'));var events=[_0xe3c6('0x1'),_0xe3c6('0x2'),'update'];function createListener(_0x40ecb1,_0x4fb62d){return function(_0x276cdb){_0x4fb62d[_0xe3c6('0x3')](_0x40ecb1,_0x276cdb);};}function removeListener(_0x15392d,_0x22fe2e){return function(){WhatsappQueueEvents[_0xe3c6('0x4')](_0x15392d,_0x22fe2e);};}exports[_0xe3c6('0x5')]=function(_0x18a1d4){for(var _0x5190c2=0x0,_0x58bb94=events[_0xe3c6('0x6')];_0x5190c2<_0x58bb94;_0x5190c2++){var _0x4cd1e4=events[_0x5190c2];var _0x23b757=createListener(_0xe3c6('0x7')+_0x4cd1e4,_0x18a1d4);WhatsappQueueEvents['on'](_0x4cd1e4,_0x23b757);}}; \ No newline at end of file +var _0xcb69=['removeListener','register','length','whatsappQueue:','save','remove','update'];(function(_0x1afea6,_0x314555){var _0x3d54eb=function(_0x3eb1e2){while(--_0x3eb1e2){_0x1afea6['push'](_0x1afea6['shift']());}};_0x3d54eb(++_0x314555);}(_0xcb69,0xac));var _0x9cb6=function(_0x570245,_0x4fae67){_0x570245=_0x570245-0x0;var _0x2f9a4a=_0xcb69[_0x570245];return _0x2f9a4a;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x9cb6('0x0'),_0x9cb6('0x1'),_0x9cb6('0x2')];function createListener(_0x5bfb81,_0x58b309){return function(_0x359832){_0x58b309['emit'](_0x5bfb81,_0x359832);};}function removeListener(_0x5089c7,_0x4e2fd8){return function(){WhatsappQueueEvents[_0x9cb6('0x3')](_0x5089c7,_0x4e2fd8);};}exports[_0x9cb6('0x4')]=function(_0x5a337b){for(var _0x2b0a41=0x0,_0x19ac45=events[_0x9cb6('0x5')];_0x2b0a41<_0x19ac45;_0x2b0a41++){var _0x2d568=events[_0x2b0a41];var _0x5a875b=createListener(_0x9cb6('0x6')+_0x2d568,_0x5a337b);WhatsappQueueEvents['on'](_0x2d568,_0x5a875b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e83ca85..216d779 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 _0xfe7b=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x905c53,_0x34c448){var _0x3b334e=function(_0x226b8e){while(--_0x226b8e){_0x905c53['push'](_0x905c53['shift']());}};_0x3b334e(++_0x34c448);}(_0xfe7b,0x8d));var _0xbfe7=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xfe7b[_0x51bda1];return _0x1ce08c;};'use strict';var multer=require(_0xbfe7('0x0'));var util=require(_0xbfe7('0x1'));var path=require(_0xbfe7('0x2'));var timeout=require(_0xbfe7('0x3'));var express=require('express');var router=express[_0xbfe7('0x4')]();var fs_extra=require(_0xbfe7('0x5'));var auth=require(_0xbfe7('0x6'));var interaction=require(_0xbfe7('0x7'));var config=require(_0xbfe7('0x8'));var controller=require(_0xbfe7('0x9'));router['get']('/',auth[_0xbfe7('0xa')](),controller[_0xbfe7('0xb')]);router[_0xbfe7('0xc')](_0xbfe7('0xd'),auth[_0xbfe7('0xa')](),controller[_0xbfe7('0xe')]);router[_0xbfe7('0xc')](_0xbfe7('0xf'),auth[_0xbfe7('0xa')](),controller[_0xbfe7('0x10')]);router[_0xbfe7('0x11')]('/',auth[_0xbfe7('0xa')](),controller[_0xbfe7('0x12')]);router[_0xbfe7('0x13')](_0xbfe7('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xbfe7('0x14')](_0xbfe7('0xf'),auth['isAuthenticated'](),controller[_0xbfe7('0x15')]);module[_0xbfe7('0x16')]=router; \ No newline at end of file +var _0x08d4=['post','create','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','index','get','/describe','describe','isAuthenticated','show'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x08d4,0xcd));var _0x408d=function(_0x472d82,_0x3a5877){_0x472d82=_0x472d82-0x0;var _0x2cf07f=_0x08d4[_0x472d82];return _0x2cf07f;};'use strict';var multer=require(_0x408d('0x0'));var util=require(_0x408d('0x1'));var path=require(_0x408d('0x2'));var timeout=require(_0x408d('0x3'));var express=require(_0x408d('0x4'));var router=express['Router']();var fs_extra=require(_0x408d('0x5'));var auth=require(_0x408d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x408d('0x7'));var controller=require(_0x408d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x408d('0x9')]);router[_0x408d('0xa')](_0x408d('0xb'),auth['isAuthenticated'](),controller[_0x408d('0xc')]);router[_0x408d('0xa')]('/:id',auth[_0x408d('0xd')](),controller[_0x408d('0xe')]);router[_0x408d('0xf')]('/',auth['isAuthenticated'](),controller[_0x408d('0x10')]);router[_0x408d('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x408d('0x12')]('/:id',auth[_0x408d('0xd')](),controller['destroy']);module[_0x408d('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0a7598d..c67dad8 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x742f0c,_0x464bcb){var _0x1e87dc=function(_0x24a875){while(--_0x24a875){_0x742f0c['push'](_0x742f0c['shift']());}};_0x1e87dc(++_0x464bcb);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x33cb08,_0x2c3c32){var _0x2fa078=function(_0x62b01f){while(--_0x62b01f){_0x33cb08['push'](_0x33cb08['shift']());}};_0x2fa078(++_0x2c3c32);}(_0x7a54,0x106));var _0x47a5=function(_0x490f1f,_0x133d86){_0x490f1f=_0x490f1f-0x0;var _0x4e6133=_0x7a54[_0x490f1f];return _0x4e6133;};'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 2971956..af9b5b8 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 _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x4024,0x89));var _0x4402=function(_0x42cd74,_0x3d6956){_0x42cd74=_0x42cd74-0x0;var _0xe3b978=_0x4024[_0x42cd74];return _0xe3b978;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){_0x258d10['status'](0xcc)[_0x4402('0x15')]();});}};}function handleEntityNotFound(_0x4e1c04,_0x3733cd){return function(_0x5ab28d){if(!_0x5ab28d){_0x4e1c04[_0x4402('0x13')](0x194);}return _0x5ab28d;};}function handleError(_0x211424,_0x5a43d0){_0x5a43d0=_0x5a43d0||0x1f4;return function(_0x15c19f){logger['error'](_0x15c19f['stack']);if(_0x15c19f[_0x4402('0x21')]){delete _0x15c19f[_0x4402('0x21')];}_0x211424[_0x4402('0x14')](_0x5a43d0)[_0x4402('0x22')](_0x15c19f);};}exports[_0x4402('0x23')]=function(_0x514e41,_0x41de44){var _0x52e625={},_0x71da2f={},_0x1e2340={'count':0x0,'rows':[]};var _0x42dd32=_['map'](db[_0x4402('0x24')][_0x4402('0x25')],function(_0x316239){return{'name':_0x316239[_0x4402('0x26')],'type':_0x316239[_0x4402('0x27')][_0x4402('0x28')]};});_0x71da2f[_0x4402('0x29')]=_[_0x4402('0x2a')](_0x42dd32,_0x4402('0x21'));_0x71da2f[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x514e41['query']);_0x71da2f[_0x4402('0x2d')]=_['intersection'](_0x71da2f[_0x4402('0x29')],_0x71da2f['query']);_0x52e625[_0x4402('0x2e')]=_[_0x4402('0x2f')](_0x71da2f[_0x4402('0x29')],qs[_0x4402('0x30')](_0x514e41[_0x4402('0x2b')]['fields']));_0x52e625[_0x4402('0x2e')]=_0x52e625[_0x4402('0x2e')][_0x4402('0x31')]?_0x52e625['attributes']:_0x71da2f[_0x4402('0x29')];if(!_0x514e41[_0x4402('0x2b')]['hasOwnProperty'](_0x4402('0x32'))){_0x52e625[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x514e41[_0x4402('0x2b')][_0x4402('0x19')]);_0x52e625[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x514e41[_0x4402('0x2b')][_0x4402('0x17')]);}_0x52e625['order']=qs[_0x4402('0x33')](_0x514e41[_0x4402('0x2b')][_0x4402('0x33')]);_0x52e625['where']=qs[_0x4402('0x2d')](_[_0x4402('0x34')](_0x514e41['query'],_0x71da2f['filters']),_0x42dd32);if(_0x514e41[_0x4402('0x2b')][_0x4402('0x35')]){_0x52e625[_0x4402('0x36')]=_[_0x4402('0x37')](_0x52e625['where'],{'$or':_['map'](_0x42dd32,function(_0x4b0672){if(_0x4b0672[_0x4402('0x27')]!==_0x4402('0x38')){var _0xcbfa06={};_0xcbfa06[_0x4b0672[_0x4402('0x21')]]={'$like':'%'+_0x514e41['query'][_0x4402('0x35')]+'%'};return _0xcbfa06;}})});}_0x52e625=_[_0x4402('0x37')]({},_0x52e625,_0x514e41[_0x4402('0x39')]);var _0x57843d={'where':_0x52e625[_0x4402('0x36')]};return db['WhatsappQueueReport'][_0x4402('0x1a')](_0x57843d)[_0x4402('0x1f')](function(_0x5c74b1){_0x1e2340[_0x4402('0x1a')]=_0x5c74b1;if(_0x514e41['query'][_0x4402('0x3a')]){_0x52e625[_0x4402('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x4402('0x3c')](_0x52e625);})[_0x4402('0x1f')](function(_0x250f09){_0x1e2340[_0x4402('0x3d')]=_0x250f09;return _0x1e2340;})['then'](respondWithFilteredResult(_0x41de44,_0x52e625))['catch'](handleError(_0x41de44,null));};exports[_0x4402('0x3e')]=function(_0x47a3a3,_0x3a589b){var _0x2a6d78={'raw':!![],'where':{'id':_0x47a3a3[_0x4402('0x3f')]['id']}},_0xb9cf85={};_0xb9cf85[_0x4402('0x29')]=_[_0x4402('0x2c')](db[_0x4402('0x24')][_0x4402('0x25')]);_0xb9cf85[_0x4402('0x2b')]=_[_0x4402('0x2c')](_0x47a3a3['query']);_0xb9cf85[_0x4402('0x2d')]=_[_0x4402('0x2f')](_0xb9cf85['model'],_0xb9cf85[_0x4402('0x2b')]);_0x2a6d78[_0x4402('0x2e')]=_['intersection'](_0xb9cf85[_0x4402('0x29')],qs[_0x4402('0x30')](_0x47a3a3[_0x4402('0x2b')][_0x4402('0x30')]));_0x2a6d78[_0x4402('0x2e')]=_0x2a6d78['attributes'][_0x4402('0x31')]?_0x2a6d78[_0x4402('0x2e')]:_0xb9cf85[_0x4402('0x29')];if(_0x47a3a3[_0x4402('0x2b')][_0x4402('0x3a')]){_0x2a6d78[_0x4402('0x3b')]=[{'all':!![]}];}_0x2a6d78=_[_0x4402('0x37')]({},_0x2a6d78,_0x47a3a3[_0x4402('0x39')]);return db[_0x4402('0x24')][_0x4402('0x40')](_0x2a6d78)[_0x4402('0x1f')](handleEntityNotFound(_0x3a589b,null))['then'](respondWithResult(_0x3a589b,null))[_0x4402('0x41')](handleError(_0x3a589b,null));};exports['create']=function(_0xc45af6,_0x34ce00){return db['WhatsappQueueReport'][_0x4402('0x42')](_0xc45af6[_0x4402('0x43')],{})[_0x4402('0x1f')](respondWithResult(_0x34ce00,0xc9))[_0x4402('0x41')](handleError(_0x34ce00,null));};exports[_0x4402('0x1e')]=function(_0x2503eb,_0x5b094b){if(_0x2503eb[_0x4402('0x43')]['id']){delete _0x2503eb[_0x4402('0x43')]['id'];}return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x2503eb[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x5b094b,null))[_0x4402('0x1f')](saveUpdates(_0x2503eb[_0x4402('0x43')],null))[_0x4402('0x1f')](respondWithResult(_0x5b094b,null))['catch'](handleError(_0x5b094b,null));};exports['destroy']=function(_0x5ab12b,_0x4c2d2e){return db[_0x4402('0x24')][_0x4402('0x40')]({'where':{'id':_0x5ab12b[_0x4402('0x3f')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4c2d2e,null))['then'](removeEntity(_0x4c2d2e,null))[_0x4402('0x41')](handleError(_0x4c2d2e,null));};exports[_0x4402('0x44')]=function(_0x203b33,_0x2a4ea7){return db[_0x4402('0x24')][_0x4402('0x44')]()[_0x4402('0x1f')](respondWithResult(_0x2a4ea7,null))['catch'](handleError(_0x2a4ea7,null));}; \ No newline at end of file +var _0xdb94=['length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0x447bb5,_0x3d5de6){var _0x4f6138=function(_0x143f45){while(--_0x143f45){_0x447bb5['push'](_0x447bb5['shift']());}};_0x4f6138(++_0x3d5de6);}(_0xdb94,0xab));var _0x4db9=function(_0x11154e,_0x15d9ac){_0x11154e=_0x11154e-0x0;var _0x4a1be8=_0xdb94[_0x11154e];return _0x4a1be8;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31222b,_0x5e644c){_0x5e644c=_0x5e644c||0xcc;return function(_0x571685){if(_0x571685){return _0x31222b[_0x4db9('0x17')](_0x5e644c);}return _0x31222b[_0x4db9('0x18')](_0x5e644c)['end']();};}function respondWithResult(_0xd37d63,_0x1f9638){_0x1f9638=_0x1f9638||0xc8;return function(_0x452896){if(_0x452896){return _0xd37d63[_0x4db9('0x18')](_0x1f9638)['json'](_0x452896);}};}function respondWithFilteredResult(_0x5e04ab,_0x102274){return function(_0x34de1a){if(_0x34de1a){var _0x4a037f=typeof _0x102274[_0x4db9('0x19')]===_0x4db9('0x1a')&&typeof _0x102274['limit']==='undefined';var _0x250a80=_0x34de1a[_0x4db9('0x1b')];var _0x462af3=_0x4a037f?0x0:_0x102274[_0x4db9('0x19')];var _0x1d3c33=_0x4a037f?_0x34de1a['count']:_0x102274[_0x4db9('0x19')]+_0x102274[_0x4db9('0x1c')];var _0x11012e;if(_0x1d3c33>=_0x250a80){_0x1d3c33=_0x250a80;_0x11012e=0xc8;}else{_0x11012e=0xce;}_0x5e04ab['status'](_0x11012e);return _0x5e04ab[_0x4db9('0x1d')](_0x4db9('0x1e'),_0x462af3+'-'+_0x1d3c33+'/'+_0x250a80)[_0x4db9('0x1f')](_0x34de1a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x46b522){try{jsonpatch[_0x4db9('0x20')](_0x46b522,_0x4c92e8,!![]);}catch(_0x4553c2){return BPromise[_0x4db9('0x21')](_0x4553c2);}return _0x46b522[_0x4db9('0x22')]();};}function saveUpdates(_0x159d9b,_0x3585d5){return function(_0x5aef3b){if(_0x5aef3b){return _0x5aef3b[_0x4db9('0x23')](_0x159d9b)[_0x4db9('0x24')](function(_0xcde40c){return _0xcde40c;});}return null;};}function removeEntity(_0x319475,_0x4aaa84){return function(_0x213daa){if(_0x213daa){return _0x213daa[_0x4db9('0x25')]()['then'](function(){_0x319475[_0x4db9('0x18')](0xcc)[_0x4db9('0x26')]();});}};}function handleEntityNotFound(_0x2987c6,_0x4dbb1b){return function(_0x3c8237){if(!_0x3c8237){_0x2987c6[_0x4db9('0x17')](0x194);}return _0x3c8237;};}function handleError(_0x43b95e,_0x2d330e){_0x2d330e=_0x2d330e||0x1f4;return function(_0x3f9f7e){logger[_0x4db9('0x27')](_0x3f9f7e[_0x4db9('0x28')]);if(_0x3f9f7e[_0x4db9('0x29')]){delete _0x3f9f7e[_0x4db9('0x29')];}_0x43b95e[_0x4db9('0x18')](_0x2d330e)[_0x4db9('0x2a')](_0x3f9f7e);};}exports[_0x4db9('0x2b')]=function(_0x2d646d,_0x20f133){var _0x583861={},_0x5031fe={},_0x3951b2={'count':0x0,'rows':[]};var _0x331279=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x459131){return{'name':_0x459131['fieldName'],'type':_0x459131[_0x4db9('0x2f')]['key']};});_0x5031fe[_0x4db9('0x30')]=_[_0x4db9('0x2c')](_0x331279,_0x4db9('0x29'));_0x5031fe[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x2d646d['query']);_0x5031fe['filters']=_[_0x4db9('0x33')](_0x5031fe['model'],_0x5031fe[_0x4db9('0x31')]);_0x583861[_0x4db9('0x34')]=_['intersection'](_0x5031fe[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x2d646d[_0x4db9('0x31')]['fields']));_0x583861[_0x4db9('0x34')]=_0x583861['attributes'][_0x4db9('0x36')]?_0x583861[_0x4db9('0x34')]:_0x5031fe[_0x4db9('0x30')];if(!_0x2d646d['query']['hasOwnProperty'](_0x4db9('0x37'))){_0x583861[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x1c')]);_0x583861[_0x4db9('0x19')]=qs[_0x4db9('0x19')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x19')]);}_0x583861['order']=qs[_0x4db9('0x38')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x38')]);_0x583861[_0x4db9('0x39')]=qs['filters'](_[_0x4db9('0x3a')](_0x2d646d[_0x4db9('0x31')],_0x5031fe[_0x4db9('0x3b')]),_0x331279);if(_0x2d646d['query'][_0x4db9('0x3c')]){_0x583861[_0x4db9('0x39')]=_[_0x4db9('0x3d')](_0x583861[_0x4db9('0x39')],{'$or':_['map'](_0x331279,function(_0x5a78b4){if(_0x5a78b4[_0x4db9('0x2f')]!==_0x4db9('0x3e')){var _0x32e62b={};_0x32e62b[_0x5a78b4[_0x4db9('0x29')]]={'$like':'%'+_0x2d646d[_0x4db9('0x31')]['filter']+'%'};return _0x32e62b;}})});}_0x583861=_[_0x4db9('0x3d')]({},_0x583861,_0x2d646d[_0x4db9('0x3f')]);var _0x23affc={'where':_0x583861[_0x4db9('0x39')]};return db[_0x4db9('0x2d')]['count'](_0x23affc)[_0x4db9('0x24')](function(_0x324765){_0x3951b2[_0x4db9('0x1b')]=_0x324765;if(_0x2d646d['query'][_0x4db9('0x40')]){_0x583861[_0x4db9('0x41')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x42')](_0x583861);})[_0x4db9('0x24')](function(_0x24aa2a){_0x3951b2[_0x4db9('0x43')]=_0x24aa2a;return _0x3951b2;})[_0x4db9('0x24')](respondWithFilteredResult(_0x20f133,_0x583861))[_0x4db9('0x44')](handleError(_0x20f133,null));};exports[_0x4db9('0x45')]=function(_0x4bb740,_0x56bd68){var _0x48aaf5={'raw':!![],'where':{'id':_0x4bb740[_0x4db9('0x46')]['id']}},_0x22a021={};_0x22a021['model']=_[_0x4db9('0x32')](db[_0x4db9('0x2d')]['rawAttributes']);_0x22a021['query']=_[_0x4db9('0x32')](_0x4bb740['query']);_0x22a021[_0x4db9('0x3b')]=_[_0x4db9('0x33')](_0x22a021['model'],_0x22a021[_0x4db9('0x31')]);_0x48aaf5[_0x4db9('0x34')]=_['intersection'](_0x22a021[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x4bb740[_0x4db9('0x31')]['fields']));_0x48aaf5['attributes']=_0x48aaf5[_0x4db9('0x34')][_0x4db9('0x36')]?_0x48aaf5[_0x4db9('0x34')]:_0x22a021[_0x4db9('0x30')];if(_0x4bb740[_0x4db9('0x31')][_0x4db9('0x40')]){_0x48aaf5[_0x4db9('0x41')]=[{'all':!![]}];}_0x48aaf5=_[_0x4db9('0x3d')]({},_0x48aaf5,_0x4bb740[_0x4db9('0x3f')]);return db[_0x4db9('0x2d')][_0x4db9('0x47')](_0x48aaf5)[_0x4db9('0x24')](handleEntityNotFound(_0x56bd68,null))[_0x4db9('0x24')](respondWithResult(_0x56bd68,null))['catch'](handleError(_0x56bd68,null));};exports[_0x4db9('0x48')]=function(_0x2faacf,_0x3852f0){return db[_0x4db9('0x2d')][_0x4db9('0x48')](_0x2faacf[_0x4db9('0x49')],{})[_0x4db9('0x24')](respondWithResult(_0x3852f0,0xc9))[_0x4db9('0x44')](handleError(_0x3852f0,null));};exports[_0x4db9('0x23')]=function(_0x2d6094,_0x10dccb){if(_0x2d6094['body']['id']){delete _0x2d6094['body']['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0x2d6094[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x10dccb,null))[_0x4db9('0x24')](saveUpdates(_0x2d6094[_0x4db9('0x49')],null))[_0x4db9('0x24')](respondWithResult(_0x10dccb,null))[_0x4db9('0x44')](handleError(_0x10dccb,null));};exports['destroy']=function(_0xd8eae3,_0xcb832e){return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0xd8eae3[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0xcb832e,null))[_0x4db9('0x24')](removeEntity(_0xcb832e,null))[_0x4db9('0x44')](handleError(_0xcb832e,null));};exports['describe']=function(_0x45bc79,_0xd6701a){return db[_0x4db9('0x2d')][_0x4db9('0x4a')]()[_0x4db9('0x24')](respondWithResult(_0xd6701a,null))[_0x4db9('0x44')](handleError(_0xd6701a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 7e392c7..0c045f2 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 _0xa862=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xa862,0x15b));var _0x2a86=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xa862[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x2a86('0x0'));var util=require('util');var logger=require(_0x2a86('0x1'))('api');var moment=require(_0x2a86('0x2'));var BPromise=require(_0x2a86('0x3'));var rp=require(_0x2a86('0x4'));var fs=require('fs');var path=require(_0x2a86('0x5'));var rimraf=require('rimraf');var config=require(_0x2a86('0x6'));var attributes=require('./whatsappQueueReport.attributes');module[_0x2a86('0x7')]=function(_0x4b0149,_0x588728){return _0x4b0149[_0x2a86('0x8')](_0x2a86('0x9'),attributes,{'tableName':_0x2a86('0xa'),'paranoid':![],'indexes':[{'name':_0x2a86('0xb'),'fields':[_0x2a86('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf68=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x318dda,_0x1aa800){var _0x3f97ca=function(_0x1dc61a){while(--_0x1dc61a){_0x318dda['push'](_0x318dda['shift']());}};_0x3f97ca(++_0x1aa800);}(_0xcf68,0x1e8));var _0x8cf6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xcf68[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x8cf6('0x0'));var util=require('util');var logger=require(_0x8cf6('0x1'))(_0x8cf6('0x2'));var moment=require('moment');var BPromise=require(_0x8cf6('0x3'));var rp=require(_0x8cf6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cf6('0x5'));var config=require(_0x8cf6('0x6'));var attributes=require(_0x8cf6('0x7'));module['exports']=function(_0x3bc18d,_0x2805ab){return _0x3bc18d[_0x8cf6('0x8')](_0x8cf6('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8cf6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bd0bc68..ab7f314 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 _0x93dc=['message','result','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','update','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x521785,_0x2d6d56){var _0x1ff0fe=function(_0x98614e){while(--_0x98614e){_0x521785['push'](_0x521785['shift']());}};_0x1ff0fe(++_0x2d6d56);}(_0x93dc,0x161));var _0xc93d=function(_0x46d073,_0x11fb1f){_0x46d073=_0x46d073-0x0;var _0x2d21af=_0x93dc[_0x46d073];return _0x2d21af;};'use strict';var _=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var moment=require(_0xc93d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc93d('0x3'));var fs=require('fs');var Redis=require(_0xc93d('0x4'));var db=require(_0xc93d('0x5'))['db'];var utils=require(_0xc93d('0x6'));var logger=require('../../config/logger')(_0xc93d('0x7'));var config=require(_0xc93d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc93d('0x9')][_0xc93d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d7548,_0x5c935b,_0x28972f){return new BPromise(function(_0x4f3f8a,_0x4392ec){return client[_0xc93d('0xb')](_0x8d7548,_0x28972f)[_0xc93d('0xc')](function(_0x31bd87){logger[_0xc93d('0xd')](_0xc93d('0xe'),_0x5c935b,'request\x20sent');logger[_0xc93d('0xf')](_0xc93d('0x10'),_0x5c935b,_0xc93d('0x11'),JSON[_0xc93d('0x12')](_0x31bd87));if(_0x31bd87['error']){if(_0x31bd87['error'][_0xc93d('0x13')]===0x1f4){logger[_0xc93d('0x14')](_0xc93d('0xe'),_0x5c935b,_0x31bd87['error'][_0xc93d('0x15')]);return _0x4392ec(_0x31bd87[_0xc93d('0x14')]['message']);}logger['error'](_0xc93d('0xe'),_0x5c935b,_0x31bd87['error'][_0xc93d('0x15')]);return _0x4f3f8a(_0x31bd87[_0xc93d('0x14')][_0xc93d('0x15')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x5c935b,'request\x20sent');_0x4f3f8a(_0x31bd87[_0xc93d('0x16')][_0xc93d('0x15')]);}})[_0xc93d('0x17')](function(_0x4547ae){logger[_0xc93d('0x14')](_0xc93d('0xe'),_0x5c935b,_0x4547ae);_0x4392ec(_0x4547ae);});});}exports['CreateWhatsappQueueReport']=function(_0x30883a){var _0x5b3d2f=this;return new Promise(function(_0x5471ea,_0x1822f9){return db[_0xc93d('0x18')][_0xc93d('0x19')](_0x30883a[_0xc93d('0x1a')],{'raw':_0x30883a[_0xc93d('0x1b')]?_0x30883a[_0xc93d('0x1b')][_0xc93d('0x1c')]===undefined?!![]:![]:!![]})[_0xc93d('0xc')](function(_0x26fb2c){logger[_0xc93d('0xd')](_0xc93d('0x1d'),_0x30883a);logger['debug'](_0xc93d('0x1d'),_0x30883a,JSON[_0xc93d('0x12')](_0x26fb2c));_0x5471ea(_0x26fb2c);})[_0xc93d('0x17')](function(_0x5c211e){logger[_0xc93d('0x14')](_0xc93d('0x1d'),_0x5c211e['message'],_0x30883a);_0x1822f9(_0x5b3d2f[_0xc93d('0x14')](0x1f4,_0x5c211e[_0xc93d('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x6f9d01){var _0x3e1783=this;return new Promise(function(_0x178d45,_0x48dd65){return db[_0xc93d('0x18')][_0xc93d('0x1e')](_0x6f9d01[_0xc93d('0x1a')],{'raw':_0x6f9d01['options']?_0x6f9d01['options'][_0xc93d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f9d01['options']?_0x6f9d01[_0xc93d('0x1b')][_0xc93d('0x1f')]||null:null,'attributes':_0x6f9d01['options']?_0x6f9d01[_0xc93d('0x1b')][_0xc93d('0x20')]||null:null,'limit':_0x6f9d01[_0xc93d('0x1b')]?_0x6f9d01[_0xc93d('0x1b')]['limit']||null:null})[_0xc93d('0xc')](function(_0x6843e){logger[_0xc93d('0xd')](_0xc93d('0x21'),_0x6f9d01);logger['debug']('UpdateWhatsappQueueReport',_0x6f9d01,JSON[_0xc93d('0x12')](_0x6843e));_0x178d45(_0x6843e);})['catch'](function(_0xcb689d){logger[_0xc93d('0x14')](_0xc93d('0x21'),_0xcb689d[_0xc93d('0x15')],_0x6f9d01);_0x48dd65(_0x3e1783[_0xc93d('0x14')](0x1f4,_0xcb689d[_0xc93d('0x15')]));});});}; \ No newline at end of file +var _0x780f=['update','attributes','limit','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','UpdateWhatsappQueueReport'];(function(_0x39ffe8,_0x300334){var _0x342cdd=function(_0x3c6101){while(--_0x3c6101){_0x39ffe8['push'](_0x39ffe8['shift']());}};_0x342cdd(++_0x300334);}(_0x780f,0x163));var _0xf780=function(_0x163742,_0x467e36){_0x163742=_0x163742-0x0;var _0x1152ac=_0x780f[_0x163742];return _0x1152ac;};'use strict';var _=require('lodash');var util=require(_0xf780('0x0'));var moment=require(_0xf780('0x1'));var BPromise=require(_0xf780('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf780('0x3'))['db'];var utils=require(_0xf780('0x4'));var logger=require(_0xf780('0x5'))(_0xf780('0x6'));var config=require('../../config/environment');var jayson=require(_0xf780('0x7'));var client=jayson['client'][_0xf780('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a19b8,_0x49bcf9,_0x4d1da9){return new BPromise(function(_0x588504,_0x11d80d){return client[_0xf780('0x9')](_0x2a19b8,_0x4d1da9)[_0xf780('0xa')](function(_0x319c70){logger[_0xf780('0xb')](_0xf780('0xc'),_0x49bcf9,_0xf780('0xd'));logger[_0xf780('0xe')](_0xf780('0xf'),_0x49bcf9,_0xf780('0xd'),JSON[_0xf780('0x10')](_0x319c70));if(_0x319c70[_0xf780('0x11')]){if(_0x319c70[_0xf780('0x11')][_0xf780('0x12')]===0x1f4){logger[_0xf780('0x11')](_0xf780('0xc'),_0x49bcf9,_0x319c70[_0xf780('0x11')][_0xf780('0x13')]);return _0x11d80d(_0x319c70['error'][_0xf780('0x13')]);}logger['error'](_0xf780('0xc'),_0x49bcf9,_0x319c70[_0xf780('0x11')][_0xf780('0x13')]);return _0x588504(_0x319c70[_0xf780('0x11')][_0xf780('0x13')]);}else{logger[_0xf780('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x49bcf9,_0xf780('0xd'));_0x588504(_0x319c70[_0xf780('0x14')][_0xf780('0x13')]);}})['catch'](function(_0x499f4b){logger[_0xf780('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x49bcf9,_0x499f4b);_0x11d80d(_0x499f4b);});});}exports[_0xf780('0x15')]=function(_0x26e3e6){var _0x36c547=this;return new Promise(function(_0x5e5a0f,_0x453e34){return db[_0xf780('0x16')][_0xf780('0x17')](_0x26e3e6[_0xf780('0x18')],{'raw':_0x26e3e6[_0xf780('0x19')]?_0x26e3e6[_0xf780('0x19')][_0xf780('0x1a')]===undefined?!![]:![]:!![]})[_0xf780('0xa')](function(_0xeb55f5){logger[_0xf780('0xb')](_0xf780('0x15'),_0x26e3e6);logger[_0xf780('0xe')](_0xf780('0x15'),_0x26e3e6,JSON[_0xf780('0x10')](_0xeb55f5));_0x5e5a0f(_0xeb55f5);})[_0xf780('0x1b')](function(_0xaa2dfa){logger[_0xf780('0x11')]('CreateWhatsappQueueReport',_0xaa2dfa[_0xf780('0x13')],_0x26e3e6);_0x453e34(_0x36c547[_0xf780('0x11')](0x1f4,_0xaa2dfa[_0xf780('0x13')]));});});};exports[_0xf780('0x1c')]=function(_0x5bfa38){var _0x199c9a=this;return new Promise(function(_0x407078,_0x139f75){return db['WhatsappQueueReport'][_0xf780('0x1d')](_0x5bfa38[_0xf780('0x18')],{'raw':_0x5bfa38[_0xf780('0x19')]?_0x5bfa38[_0xf780('0x19')][_0xf780('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bfa38[_0xf780('0x19')]?_0x5bfa38[_0xf780('0x19')]['where']||null:null,'attributes':_0x5bfa38[_0xf780('0x19')]?_0x5bfa38[_0xf780('0x19')][_0xf780('0x1e')]||null:null,'limit':_0x5bfa38[_0xf780('0x19')]?_0x5bfa38[_0xf780('0x19')][_0xf780('0x1f')]||null:null})[_0xf780('0xa')](function(_0x4674e1){logger[_0xf780('0xb')](_0xf780('0x1c'),_0x5bfa38);logger['debug'](_0xf780('0x1c'),_0x5bfa38,JSON[_0xf780('0x10')](_0x4674e1));_0x407078(_0x4674e1);})[_0xf780('0x1b')](function(_0x215c89){logger['error']('UpdateWhatsappQueueReport',_0x215c89[_0xf780('0x13')],_0x5bfa38);_0x139f75(_0x199c9a[_0xf780('0x11')](0x1f4,_0x215c89['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e7fa522..1a176b8 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 _0x7435=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7435,0x1f2));var _0x5743=function(_0x14b072,_0x61759){_0x14b072=_0x14b072-0x0;var _0x2b1459=_0x7435[_0x14b072];return _0x2b1459;};'use strict';var multer=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var path=require(_0x5743('0x2'));var timeout=require(_0x5743('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5743('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5743('0x5'));var config=require(_0x5743('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x5743('0x7')](),controller[_0x5743('0x8')]);router[_0x5743('0x9')](_0x5743('0xa'),auth['isAuthenticated'](),controller[_0x5743('0xb')]);router[_0x5743('0x9')]('/:id',auth[_0x5743('0x7')](),controller['show']);router[_0x5743('0xc')]('/',auth[_0x5743('0x7')](),controller[_0x5743('0xd')]);router[_0x5743('0xe')](_0x5743('0xf'),auth[_0x5743('0x7')](),controller[_0x5743('0x10')]);router[_0x5743('0x11')](_0x5743('0xf'),auth[_0x5743('0x7')](),controller[_0x5743('0x12')]);module[_0x5743('0x13')]=router; \ No newline at end of file +var _0x1433=['show','post','isAuthenticated','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','describe'];(function(_0x3ba3d2,_0x397add){var _0xe19e9c=function(_0x360bde){while(--_0x360bde){_0x3ba3d2['push'](_0x3ba3d2['shift']());}};_0xe19e9c(++_0x397add);}(_0x1433,0x126));var _0x3143=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1433[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var path=require('path');var timeout=require(_0x3143('0x2'));var express=require(_0x3143('0x3'));var router=express[_0x3143('0x4')]();var fs_extra=require(_0x3143('0x5'));var auth=require(_0x3143('0x6'));var interaction=require(_0x3143('0x7'));var config=require(_0x3143('0x8'));var controller=require(_0x3143('0x9'));router[_0x3143('0xa')]('/',auth['isAuthenticated'](),controller[_0x3143('0xb')]);router[_0x3143('0xa')](_0x3143('0xc'),auth['isAuthenticated'](),controller[_0x3143('0xd')]);router[_0x3143('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3143('0xe')]);router[_0x3143('0xf')]('/',auth[_0x3143('0x10')](),controller[_0x3143('0x11')]);router[_0x3143('0x12')]('/:id',auth[_0x3143('0x10')](),controller[_0x3143('0x13')]);router[_0x3143('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3143('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d64c3ce..32f8f76 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 _0x87bc=['queue','sequelize','exports','ENUM'];(function(_0x3ec822,_0x59a9c2){var _0x5927c6=function(_0x56a240){while(--_0x56a240){_0x3ec822['push'](_0x3ec822['shift']());}};_0x5927c6(++_0x59a9c2);}(_0x87bc,0x189));var _0xc87b=function(_0x5bb3bd,_0x20afe3){_0x5bb3bd=_0x5bb3bd-0x0;var _0x477534=_0x87bc[_0x5bb3bd];return _0x477534;};'use strict';var Sequelize=require(_0xc87b('0x0'));module[_0xc87b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc87b('0x2')]('account','agent',_0xc87b('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xfa28=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x4a958c,_0x4ac392){var _0x4e187b=function(_0x181af7){while(--_0x181af7){_0x4a958c['push'](_0x4a958c['shift']());}};_0x4e187b(++_0x4ac392);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xfa28[_0x425716];return _0x2d39af;};'use strict';var Sequelize=require(_0x8fa2('0x0'));module[_0x8fa2('0x1')]={'uniqueid':{'type':Sequelize[_0x8fa2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8fa2('0x3')](_0x8fa2('0x4'),_0x8fa2('0x5'),_0x8fa2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8fa2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c3ea7dc..f58acdb 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 _0x0e89=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x4a0de1,_0x576d60){var _0x423190=function(_0x410d49){while(--_0x410d49){_0x4a0de1['push'](_0x4a0de1['shift']());}};_0x423190(++_0x576d60);}(_0x0e89,0x69));var _0x90e8=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x0e89[_0x173441];return _0x2423a8;};'use strict';var emlformat=require(_0x90e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90e8('0x2'));var moment=require(_0x90e8('0x3'));var BPromise=require(_0x90e8('0x4'));var Mustache=require(_0x90e8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x90e8('0x6'));var csv=require(_0x90e8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90e8('0x8'));var squel=require(_0x90e8('0x9'));var crypto=require('crypto');var jsforce=require(_0x90e8('0xa'));var deskjs=require(_0x90e8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x90e8('0xc'));var Papa=require(_0x90e8('0xd'));var Redis=require(_0x90e8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x90e8('0xf'));var as=require(_0x90e8('0x10'));var hardwareService=require(_0x90e8('0x11'));var logger=require(_0x90e8('0x12'))(_0x90e8('0x13'));var utils=require(_0x90e8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90e8('0x15'));var db=require(_0x90e8('0x16'))['db'];function respondWithStatusCode(_0x275497,_0x407c17){_0x407c17=_0x407c17||0xcc;return function(_0x255d39){if(_0x255d39){return _0x275497[_0x90e8('0x17')](_0x407c17);}return _0x275497[_0x90e8('0x18')](_0x407c17)[_0x90e8('0x19')]();};}function respondWithResult(_0x3b7141,_0x5b1148){_0x5b1148=_0x5b1148||0xc8;return function(_0x275063){if(_0x275063){return _0x3b7141[_0x90e8('0x18')](_0x5b1148)[_0x90e8('0x1a')](_0x275063);}};}function respondWithFilteredResult(_0x441643,_0x5b548e){return function(_0xb3d39b){if(_0xb3d39b){var _0xadb22e=typeof _0x5b548e[_0x90e8('0x1b')]==='undefined'&&typeof _0x5b548e['limit']==='undefined';var _0x494a4a=_0xb3d39b['count'];var _0x1128d6=_0xadb22e?0x0:_0x5b548e[_0x90e8('0x1b')];var _0x1c548a=_0xadb22e?_0xb3d39b[_0x90e8('0x1c')]:_0x5b548e[_0x90e8('0x1b')]+_0x5b548e[_0x90e8('0x1d')];var _0x333667;if(_0x1c548a>=_0x494a4a){_0x1c548a=_0x494a4a;_0x333667=0xc8;}else{_0x333667=0xce;}_0x441643[_0x90e8('0x18')](_0x333667);return _0x441643[_0x90e8('0x1e')](_0x90e8('0x1f'),_0x1128d6+'-'+_0x1c548a+'/'+_0x494a4a)[_0x90e8('0x1a')](_0xb3d39b);}return null;};}function patchUpdates(_0xd17942){return function(_0xcdf7cd){try{jsonpatch[_0x90e8('0x20')](_0xcdf7cd,_0xd17942,!![]);}catch(_0x428e92){return BPromise['reject'](_0x428e92);}return _0xcdf7cd[_0x90e8('0x21')]();};}function saveUpdates(_0x1171d6,_0x860ada){return function(_0x49211c){if(_0x49211c){return _0x49211c['update'](_0x1171d6)['then'](function(_0x379169){return _0x379169;});}return null;};}function removeEntity(_0x3df59b,_0x4e86c7){return function(_0x480e55){if(_0x480e55){return _0x480e55[_0x90e8('0x22')]()[_0x90e8('0x23')](function(){_0x3df59b[_0x90e8('0x18')](0xcc)[_0x90e8('0x19')]();});}};}function handleEntityNotFound(_0x96b8f4,_0x5195f8){return function(_0x309e2a){if(!_0x309e2a){_0x96b8f4[_0x90e8('0x17')](0x194);}return _0x309e2a;};}function handleError(_0x12d0b8,_0x20badc){_0x20badc=_0x20badc||0x1f4;return function(_0x226762){logger[_0x90e8('0x24')](_0x226762[_0x90e8('0x25')]);if(_0x226762['name']){delete _0x226762[_0x90e8('0x26')];}_0x12d0b8[_0x90e8('0x18')](_0x20badc)[_0x90e8('0x27')](_0x226762);};}exports[_0x90e8('0x28')]=function(_0x1dd730,_0x2c2001){var _0x2acedf={},_0x58851b={},_0x17f659={'count':0x0,'rows':[]};var _0x155f9d=_[_0x90e8('0x29')](db[_0x90e8('0x2a')][_0x90e8('0x2b')],function(_0x275b34){return{'name':_0x275b34[_0x90e8('0x2c')],'type':_0x275b34[_0x90e8('0x2d')][_0x90e8('0x2e')]};});_0x58851b[_0x90e8('0x2f')]=_[_0x90e8('0x29')](_0x155f9d,'name');_0x58851b[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x1dd730[_0x90e8('0x30')]);_0x58851b[_0x90e8('0x32')]=_[_0x90e8('0x33')](_0x58851b[_0x90e8('0x2f')],_0x58851b['query']);_0x2acedf[_0x90e8('0x34')]=_['intersection'](_0x58851b['model'],qs['fields'](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x35')]));_0x2acedf[_0x90e8('0x34')]=_0x2acedf['attributes']['length']?_0x2acedf[_0x90e8('0x34')]:_0x58851b[_0x90e8('0x2f')];if(!_0x1dd730[_0x90e8('0x30')]['hasOwnProperty'](_0x90e8('0x36'))){_0x2acedf[_0x90e8('0x1d')]=qs[_0x90e8('0x1d')](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x1d')]);_0x2acedf['offset']=qs[_0x90e8('0x1b')](_0x1dd730[_0x90e8('0x30')][_0x90e8('0x1b')]);}_0x2acedf[_0x90e8('0x37')]=qs['sort'](_0x1dd730['query'][_0x90e8('0x38')]);_0x2acedf['where']=qs[_0x90e8('0x32')](_['pick'](_0x1dd730[_0x90e8('0x30')],_0x58851b[_0x90e8('0x32')]),_0x155f9d);if(_0x1dd730[_0x90e8('0x30')][_0x90e8('0x39')]){_0x2acedf[_0x90e8('0x3a')]=_[_0x90e8('0x3b')](_0x2acedf[_0x90e8('0x3a')],{'$or':_['map'](_0x155f9d,function(_0x4884d2){if(_0x4884d2[_0x90e8('0x2d')]!==_0x90e8('0x3c')){var _0x8b7898={};_0x8b7898[_0x4884d2[_0x90e8('0x26')]]={'$like':'%'+_0x1dd730[_0x90e8('0x30')][_0x90e8('0x39')]+'%'};return _0x8b7898;}})});}_0x2acedf=_[_0x90e8('0x3b')]({},_0x2acedf,_0x1dd730['options']);var _0x39d0a9={'where':_0x2acedf[_0x90e8('0x3a')]};return db['WhatsappTransferReport']['count'](_0x39d0a9)[_0x90e8('0x23')](function(_0x18e5e7){_0x17f659[_0x90e8('0x1c')]=_0x18e5e7;if(_0x1dd730['query'][_0x90e8('0x3d')]){_0x2acedf[_0x90e8('0x3e')]=[{'all':!![]}];}return db[_0x90e8('0x2a')]['findAll'](_0x2acedf);})['then'](function(_0x20163b){_0x17f659[_0x90e8('0x3f')]=_0x20163b;return _0x17f659;})[_0x90e8('0x23')](respondWithFilteredResult(_0x2c2001,_0x2acedf))[_0x90e8('0x40')](handleError(_0x2c2001,null));};exports[_0x90e8('0x41')]=function(_0x6cf84b,_0x5b1479){var _0x339651={'raw':!![],'where':{'id':_0x6cf84b[_0x90e8('0x42')]['id']}},_0x9017de={};_0x9017de[_0x90e8('0x2f')]=_['keys'](db[_0x90e8('0x2a')]['rawAttributes']);_0x9017de[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x6cf84b[_0x90e8('0x30')]);_0x9017de[_0x90e8('0x32')]=_[_0x90e8('0x33')](_0x9017de['model'],_0x9017de[_0x90e8('0x30')]);_0x339651[_0x90e8('0x34')]=_['intersection'](_0x9017de[_0x90e8('0x2f')],qs['fields'](_0x6cf84b['query']['fields']));_0x339651[_0x90e8('0x34')]=_0x339651[_0x90e8('0x34')][_0x90e8('0x43')]?_0x339651[_0x90e8('0x34')]:_0x9017de[_0x90e8('0x2f')];if(_0x6cf84b[_0x90e8('0x30')]['includeAll']){_0x339651[_0x90e8('0x3e')]=[{'all':!![]}];}_0x339651=_[_0x90e8('0x3b')]({},_0x339651,_0x6cf84b[_0x90e8('0x44')]);return db[_0x90e8('0x2a')][_0x90e8('0x45')](_0x339651)[_0x90e8('0x23')](handleEntityNotFound(_0x5b1479,null))['then'](respondWithResult(_0x5b1479,null))[_0x90e8('0x40')](handleError(_0x5b1479,null));};exports[_0x90e8('0x46')]=function(_0x1d4779,_0x4423c8){return db[_0x90e8('0x2a')][_0x90e8('0x46')](_0x1d4779[_0x90e8('0x47')],{})[_0x90e8('0x23')](respondWithResult(_0x4423c8,0xc9))[_0x90e8('0x40')](handleError(_0x4423c8,null));};exports[_0x90e8('0x48')]=function(_0x4c5168,_0x2c33b8){if(_0x4c5168[_0x90e8('0x47')]['id']){delete _0x4c5168[_0x90e8('0x47')]['id'];}return db[_0x90e8('0x2a')][_0x90e8('0x45')]({'where':{'id':_0x4c5168[_0x90e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c33b8,null))[_0x90e8('0x23')](saveUpdates(_0x4c5168[_0x90e8('0x47')],null))['then'](respondWithResult(_0x2c33b8,null))[_0x90e8('0x40')](handleError(_0x2c33b8,null));};exports[_0x90e8('0x22')]=function(_0x5b2404,_0x468c7c){return db[_0x90e8('0x2a')][_0x90e8('0x45')]({'where':{'id':_0x5b2404[_0x90e8('0x42')]['id']}})['then'](handleEntityNotFound(_0x468c7c,null))[_0x90e8('0x23')](removeEntity(_0x468c7c,null))[_0x90e8('0x40')](handleError(_0x468c7c,null));};exports['describe']=function(_0x574bcb,_0x30f82b){return db[_0x90e8('0x2a')][_0x90e8('0x49')]()[_0x90e8('0x23')](respondWithResult(_0x30f82b,null))[_0x90e8('0x40')](handleError(_0x30f82b,null));}; \ No newline at end of file +var _0x2bab=['where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x34a833,_0xd79c43){var _0x1e5ae3=function(_0x28d2df){while(--_0x28d2df){_0x34a833['push'](_0x34a833['shift']());}};_0x1e5ae3(++_0xd79c43);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x8d29fd,_0x51fecd){_0x8d29fd=_0x8d29fd-0x0;var _0xb68e7b=_0x2bab[_0x8d29fd];return _0xb68e7b;};'use strict';var emlformat=require(_0xb2ba('0x0'));var rimraf=require(_0xb2ba('0x1'));var zipdir=require(_0xb2ba('0x2'));var jsonpatch=require(_0xb2ba('0x3'));var rp=require('request-promise');var moment=require(_0xb2ba('0x4'));var BPromise=require(_0xb2ba('0x5'));var Mustache=require(_0xb2ba('0x6'));var util=require('util');var path=require(_0xb2ba('0x7'));var sox=require(_0xb2ba('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2ba('0x9'));var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ba('0xb'));var querystring=require(_0xb2ba('0xc'));var Papa=require(_0xb2ba('0xd'));var Redis=require(_0xb2ba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2ba('0xf'));var as=require(_0xb2ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2ba('0x11'));var utils=require(_0xb2ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb2ba('0x13'));var db=require(_0xb2ba('0x14'))['db'];function respondWithStatusCode(_0x294301,_0x55317a){_0x55317a=_0x55317a||0xcc;return function(_0x44fe02){if(_0x44fe02){return _0x294301[_0xb2ba('0x15')](_0x55317a);}return _0x294301[_0xb2ba('0x16')](_0x55317a)[_0xb2ba('0x17')]();};}function respondWithResult(_0x14b5bc,_0x5d0455){_0x5d0455=_0x5d0455||0xc8;return function(_0x4f09a9){if(_0x4f09a9){return _0x14b5bc['status'](_0x5d0455)[_0xb2ba('0x18')](_0x4f09a9);}};}function respondWithFilteredResult(_0x1093cf,_0xaf8c1d){return function(_0x1f73a1){if(_0x1f73a1){var _0x52716a=typeof _0xaf8c1d['offset']===_0xb2ba('0x19')&&typeof _0xaf8c1d[_0xb2ba('0x1a')]===_0xb2ba('0x19');var _0x3a9fa6=_0x1f73a1[_0xb2ba('0x1b')];var _0x3e770f=_0x52716a?0x0:_0xaf8c1d[_0xb2ba('0x1c')];var _0x326b49=_0x52716a?_0x1f73a1[_0xb2ba('0x1b')]:_0xaf8c1d[_0xb2ba('0x1c')]+_0xaf8c1d[_0xb2ba('0x1a')];var _0x5189fa;if(_0x326b49>=_0x3a9fa6){_0x326b49=_0x3a9fa6;_0x5189fa=0xc8;}else{_0x5189fa=0xce;}_0x1093cf[_0xb2ba('0x16')](_0x5189fa);return _0x1093cf[_0xb2ba('0x1d')](_0xb2ba('0x1e'),_0x3e770f+'-'+_0x326b49+'/'+_0x3a9fa6)[_0xb2ba('0x18')](_0x1f73a1);}return null;};}function patchUpdates(_0x34aab5){return function(_0x5643a6){try{jsonpatch[_0xb2ba('0x1f')](_0x5643a6,_0x34aab5,!![]);}catch(_0x11a8f3){return BPromise[_0xb2ba('0x20')](_0x11a8f3);}return _0x5643a6[_0xb2ba('0x21')]();};}function saveUpdates(_0x19c0b8,_0x4639a9){return function(_0x588e34){if(_0x588e34){return _0x588e34[_0xb2ba('0x22')](_0x19c0b8)[_0xb2ba('0x23')](function(_0x45aeba){return _0x45aeba;});}return null;};}function removeEntity(_0x52d48d,_0xb4e5cf){return function(_0x2b22f5){if(_0x2b22f5){return _0x2b22f5[_0xb2ba('0x24')]()['then'](function(){_0x52d48d[_0xb2ba('0x16')](0xcc)[_0xb2ba('0x17')]();});}};}function handleEntityNotFound(_0x3684e3,_0xa86dbb){return function(_0x383c14){if(!_0x383c14){_0x3684e3[_0xb2ba('0x15')](0x194);}return _0x383c14;};}function handleError(_0xa64b7d,_0x4e9ae8){_0x4e9ae8=_0x4e9ae8||0x1f4;return function(_0x5ca398){logger[_0xb2ba('0x25')](_0x5ca398['stack']);if(_0x5ca398[_0xb2ba('0x26')]){delete _0x5ca398[_0xb2ba('0x26')];}_0xa64b7d[_0xb2ba('0x16')](_0x4e9ae8)['send'](_0x5ca398);};}exports[_0xb2ba('0x27')]=function(_0x5506f9,_0xba600a){var _0x2e63c9={},_0x254312={},_0x553cec={'count':0x0,'rows':[]};var _0x1248e7=_['map'](db[_0xb2ba('0x28')][_0xb2ba('0x29')],function(_0x4baaf5){return{'name':_0x4baaf5[_0xb2ba('0x2a')],'type':_0x4baaf5['type'][_0xb2ba('0x2b')]};});_0x254312[_0xb2ba('0x2c')]=_['map'](_0x1248e7,_0xb2ba('0x26'));_0x254312[_0xb2ba('0x2d')]=_[_0xb2ba('0x2e')](_0x5506f9['query']);_0x254312['filters']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],_0x254312[_0xb2ba('0x2d')]);_0x2e63c9['attributes']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],qs['fields'](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x30')]));_0x2e63c9['attributes']=_0x2e63c9[_0xb2ba('0x31')][_0xb2ba('0x32')]?_0x2e63c9[_0xb2ba('0x31')]:_0x254312['model'];if(!_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x33')](_0xb2ba('0x34'))){_0x2e63c9['limit']=qs[_0xb2ba('0x1a')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x1a')]);_0x2e63c9[_0xb2ba('0x1c')]=qs[_0xb2ba('0x1c')](_0x5506f9['query'][_0xb2ba('0x1c')]);}_0x2e63c9[_0xb2ba('0x35')]=qs[_0xb2ba('0x36')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x36')]);_0x2e63c9[_0xb2ba('0x37')]=qs[_0xb2ba('0x38')](_[_0xb2ba('0x39')](_0x5506f9[_0xb2ba('0x2d')],_0x254312['filters']),_0x1248e7);if(_0x5506f9['query'][_0xb2ba('0x3a')]){_0x2e63c9['where']=_[_0xb2ba('0x3b')](_0x2e63c9['where'],{'$or':_['map'](_0x1248e7,function(_0x444b01){if(_0x444b01[_0xb2ba('0x3c')]!=='VIRTUAL'){var _0x2b970c={};_0x2b970c[_0x444b01[_0xb2ba('0x26')]]={'$like':'%'+_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3a')]+'%'};return _0x2b970c;}})});}_0x2e63c9=_[_0xb2ba('0x3b')]({},_0x2e63c9,_0x5506f9[_0xb2ba('0x3d')]);var _0x356102={'where':_0x2e63c9[_0xb2ba('0x37')]};return db[_0xb2ba('0x28')][_0xb2ba('0x1b')](_0x356102)[_0xb2ba('0x23')](function(_0x4461c2){_0x553cec[_0xb2ba('0x1b')]=_0x4461c2;if(_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x2e63c9[_0xb2ba('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xb2ba('0x40')](_0x2e63c9);})[_0xb2ba('0x23')](function(_0x1f3541){_0x553cec[_0xb2ba('0x41')]=_0x1f3541;return _0x553cec;})['then'](respondWithFilteredResult(_0xba600a,_0x2e63c9))[_0xb2ba('0x42')](handleError(_0xba600a,null));};exports['show']=function(_0x789d99,_0x5a7811){var _0x51bb6b={'raw':!![],'where':{'id':_0x789d99[_0xb2ba('0x43')]['id']}},_0x13c316={};_0x13c316[_0xb2ba('0x2c')]=_[_0xb2ba('0x2e')](db['WhatsappTransferReport'][_0xb2ba('0x29')]);_0x13c316['query']=_[_0xb2ba('0x2e')](_0x789d99[_0xb2ba('0x2d')]);_0x13c316[_0xb2ba('0x38')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],_0x13c316['query']);_0x51bb6b[_0xb2ba('0x31')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],qs[_0xb2ba('0x30')](_0x789d99['query']['fields']));_0x51bb6b[_0xb2ba('0x31')]=_0x51bb6b[_0xb2ba('0x31')]['length']?_0x51bb6b[_0xb2ba('0x31')]:_0x13c316[_0xb2ba('0x2c')];if(_0x789d99[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x51bb6b[_0xb2ba('0x3f')]=[{'all':!![]}];}_0x51bb6b=_[_0xb2ba('0x3b')]({},_0x51bb6b,_0x789d99[_0xb2ba('0x3d')]);return db[_0xb2ba('0x28')][_0xb2ba('0x44')](_0x51bb6b)[_0xb2ba('0x23')](handleEntityNotFound(_0x5a7811,null))['then'](respondWithResult(_0x5a7811,null))[_0xb2ba('0x42')](handleError(_0x5a7811,null));};exports['create']=function(_0x1c496d,_0xd17afe){return db['WhatsappTransferReport']['create'](_0x1c496d[_0xb2ba('0x45')],{})[_0xb2ba('0x23')](respondWithResult(_0xd17afe,0xc9))[_0xb2ba('0x42')](handleError(_0xd17afe,null));};exports[_0xb2ba('0x22')]=function(_0x3ffde0,_0x4939d2){if(_0x3ffde0['body']['id']){delete _0x3ffde0['body']['id'];}return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x3ffde0['params']['id']}})['then'](handleEntityNotFound(_0x4939d2,null))[_0xb2ba('0x23')](saveUpdates(_0x3ffde0['body'],null))[_0xb2ba('0x23')](respondWithResult(_0x4939d2,null))['catch'](handleError(_0x4939d2,null));};exports[_0xb2ba('0x24')]=function(_0x44827d,_0x155320){return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x44827d[_0xb2ba('0x43')]['id']}})[_0xb2ba('0x23')](handleEntityNotFound(_0x155320,null))[_0xb2ba('0x23')](removeEntity(_0x155320,null))[_0xb2ba('0x42')](handleError(_0x155320,null));};exports['describe']=function(_0x50ed5f,_0x262c23){return db[_0xb2ba('0x28')][_0xb2ba('0x46')]()[_0xb2ba('0x23')](respondWithResult(_0x262c23,null))[_0xb2ba('0x42')](handleError(_0x262c23,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e248f6a..3b798d8 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 _0x7381=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x56ca38,_0xb8c2b7){var _0x139a5b=function(_0x2cb8a3){while(--_0x2cb8a3){_0x56ca38['push'](_0x56ca38['shift']());}};_0x139a5b(++_0xb8c2b7);}(_0x7381,0x1dd));var _0x1738=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x7381[_0xf9a6cf];return _0x59e2bc;};'use strict';var _=require(_0x1738('0x0'));var util=require(_0x1738('0x1'));var logger=require(_0x1738('0x2'))('api');var moment=require(_0x1738('0x3'));var BPromise=require('bluebird');var rp=require(_0x1738('0x4'));var fs=require('fs');var path=require(_0x1738('0x5'));var rimraf=require(_0x1738('0x6'));var config=require(_0x1738('0x7'));var attributes=require(_0x1738('0x8'));module[_0x1738('0x9')]=function(_0x3557e9,_0x2e55e6){return _0x3557e9[_0x1738('0xa')](_0x1738('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1738('0xc'),'fields':[_0x1738('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa6a3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x10e45e,_0x4fdc54){var _0x4d9ec7=function(_0xe9258){while(--_0xe9258){_0x10e45e['push'](_0x10e45e['shift']());}};_0x4d9ec7(++_0x4fdc54);}(_0xa6a3,0x11c));var _0x3a6a=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0xa6a3[_0x54bb5e];return _0x2cfe75;};'use strict';var _=require(_0x3a6a('0x0'));var util=require(_0x3a6a('0x1'));var logger=require('../../config/logger')(_0x3a6a('0x2'));var moment=require(_0x3a6a('0x3'));var BPromise=require(_0x3a6a('0x4'));var rp=require(_0x3a6a('0x5'));var fs=require('fs');var path=require(_0x3a6a('0x6'));var rimraf=require(_0x3a6a('0x7'));var config=require(_0x3a6a('0x8'));var attributes=require(_0x3a6a('0x9'));module[_0x3a6a('0xa')]=function(_0x138452,_0x351af9){return _0x138452['define'](_0x3a6a('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3a6a('0xc'),'fields':[_0x3a6a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 574adae..9056ef8 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 _0x961b=['message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x116be2,_0x1d65cc){var _0x489558=function(_0x11b3ba){while(--_0x11b3ba){_0x116be2['push'](_0x116be2['shift']());}};_0x489558(++_0x1d65cc);}(_0x961b,0x115));var _0xb961=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x961b[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb961('0x0'));var rs=require(_0xb961('0x1'));var fs=require('fs');var Redis=require(_0xb961('0x2'));var db=require(_0xb961('0x3'))['db'];var utils=require(_0xb961('0x4'));var logger=require('../../config/logger')(_0xb961('0x5'));var config=require('../../config/environment');var jayson=require(_0xb961('0x6'));var client=jayson[_0xb961('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5961db,_0x2729a3,_0x261467){return new BPromise(function(_0x5d2b1d,_0x1f170c){return client[_0xb961('0x8')](_0x5961db,_0x261467)[_0xb961('0x9')](function(_0xc224b4){logger['info'](_0xb961('0xa'),_0x2729a3,_0xb961('0xb'));logger[_0xb961('0xc')](_0xb961('0xd'),_0x2729a3,_0xb961('0xb'),JSON[_0xb961('0xe')](_0xc224b4));if(_0xc224b4[_0xb961('0xf')]){if(_0xc224b4[_0xb961('0xf')][_0xb961('0x10')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2729a3,_0xc224b4[_0xb961('0xf')][_0xb961('0x11')]);return _0x1f170c(_0xc224b4[_0xb961('0xf')]['message']);}logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0xc224b4['error'][_0xb961('0x11')]);return _0x5d2b1d(_0xc224b4['error'][_0xb961('0x11')]);}else{logger[_0xb961('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2729a3,'request\x20sent');_0x5d2b1d(_0xc224b4[_0xb961('0x13')][_0xb961('0x11')]);}})[_0xb961('0x14')](function(_0x140cf4){logger[_0xb961('0xf')](_0xb961('0xa'),_0x2729a3,_0x140cf4);_0x1f170c(_0x140cf4);});});} \ No newline at end of file +var _0xc1b8=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/logger','../../config/environment','client','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1b8,0x7c));var _0x8c1b=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc1b8[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x8c1b('0x0'));var util=require(_0x8c1b('0x1'));var moment=require(_0x8c1b('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c1b('0x4'))('rpc');var config=require(_0x8c1b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8c1b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47fd37,_0x491cd5,_0x367df6){return new BPromise(function(_0x4eaaad,_0x2b8c5d){return client[_0x8c1b('0x7')](_0x47fd37,_0x367df6)[_0x8c1b('0x8')](function(_0x152508){logger[_0x8c1b('0x9')](_0x8c1b('0xa'),_0x491cd5,_0x8c1b('0xb'));logger[_0x8c1b('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x491cd5,_0x8c1b('0xb'),JSON[_0x8c1b('0xd')](_0x152508));if(_0x152508[_0x8c1b('0xe')]){if(_0x152508['error'][_0x8c1b('0xf')]===0x1f4){logger[_0x8c1b('0xe')](_0x8c1b('0xa'),_0x491cd5,_0x152508[_0x8c1b('0xe')][_0x8c1b('0x10')]);return _0x2b8c5d(_0x152508['error']['message']);}logger[_0x8c1b('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x491cd5,_0x152508[_0x8c1b('0xe')][_0x8c1b('0x10')]);return _0x4eaaad(_0x152508[_0x8c1b('0xe')][_0x8c1b('0x10')]);}else{logger[_0x8c1b('0x9')](_0x8c1b('0xa'),_0x491cd5,'request\x20sent');_0x4eaaad(_0x152508[_0x8c1b('0x11')][_0x8c1b('0x10')]);}})[_0x8c1b('0x12')](function(_0x3112de){logger['error'](_0x8c1b('0xa'),_0x491cd5,_0x3112de);_0x2b8c5d(_0x3112de);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a5de943..247e656 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc91=['pm2_env','name','Online\x20apps:','map','online','join','Offline\x20apps:','None','catch','error','exit','./mysqldb','./config/license','./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','sync','default','then','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x37715d,_0xdb0d52){var _0x2caac8=function(_0x4a18e9){while(--_0x4a18e9){_0x37715d['push'](_0x37715d['shift']());}};_0x2caac8(++_0xdb0d52);}(_0xfc91,0xb5));var _0x1fc9=function(_0x38b944,_0x1b7a21){_0x38b944=_0x38b944-0x0;var _0x353d04=_0xfc91[_0x38b944];return _0x353d04;};'use strict';var _=require('lodash');var db=require(_0x1fc9('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x1fc9('0x1'));var rpc=require(_0x1fc9('0x2'));var config=require(_0x1fc9('0x3'));var logger=require(_0x1fc9('0x4'))(_0x1fc9('0x5'));var pm2=require(_0x1fc9('0x6'));var pm2Config=require(_0x1fc9('0x7'));var schedule=require(_0x1fc9('0x8'));var chat=require(_0x1fc9('0x9'));var whatsapp=require(_0x1fc9('0xa'));var transcribe=require(_0x1fc9('0xb'));var provider=require(_0x1fc9('0xc'));function main(){return db['sequelize'][_0x1fc9('0xd')]()['then'](function(){if(config['seedDB']){return seedDb[_0x1fc9('0xe')]();}})[_0x1fc9('0xf')](function(){return checkLicense[_0x1fc9('0xe')]();})[_0x1fc9('0xf')](function(){return rpc[_0x1fc9('0x10')]();})[_0x1fc9('0xf')](function(_0x43e0f0){logger[_0x1fc9('0x11')](_0x43e0f0);return chat[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return whatsapp[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return schedule[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return transcribe[_0x1fc9('0x12')]();})[_0x1fc9('0xf')](function(){return provider[_0x1fc9('0x12')]();})['then'](function(_0xeafb47){logger[_0x1fc9('0x11')](_0xeafb47);return pm2['start'](pm2Config);})[_0x1fc9('0xf')](function(_0x39fe61){var _0x2d55ae=_0x39fe61[_0x1fc9('0x13')](function(_0x3e0c75){return typeof _0x3e0c75[_0x1fc9('0x14')]==='number'&&_0x3e0c75['exitCode']>=0x0;});if(_0x2d55ae[_0x1fc9('0x15')]>0x0){throw new Error(_0x2d55ae['length']+_0x1fc9('0x16')+_['map'](_0x2d55ae,function(_0x533635){return'\x22'+_0x533635[_0x1fc9('0x17')][_0x1fc9('0x18')]+'\x22';}));}logger[_0x1fc9('0x11')](_0x1fc9('0x19'),_[_0x1fc9('0x1a')](_[_0x1fc9('0x13')](_0x39fe61,{'status':_0x1fc9('0x1b')}),_0x1fc9('0x18'))[_0x1fc9('0x1c')]());logger[_0x1fc9('0x11')](_0x1fc9('0x1d'),_[_0x1fc9('0x1a')](_[_0x1fc9('0x13')](_0x39fe61,function(_0x19d9bd){return _0x19d9bd['status']!=='online';}),_0x1fc9('0x18'))[_0x1fc9('0x1c')]()||_0x1fc9('0x1e'));console['log']('App\x20Ready!');})[_0x1fc9('0x1f')](function(_0x4f8493){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4f8493);logger[_0x1fc9('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4f8493);process[_0x1fc9('0x21')](0x1);});}main(); \ No newline at end of file +var _0xe14b=['default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','filter','online','join','status','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then'];(function(_0x50d7c7,_0x3cef1d){var _0x5cb0f5=function(_0x3c157c){while(--_0x3c157c){_0x50d7c7['push'](_0x50d7c7['shift']());}};_0x5cb0f5(++_0x3cef1d);}(_0xe14b,0x93));var _0xbe14=function(_0x2653f5,_0x568693){_0x2653f5=_0x2653f5-0x0;var _0x39039d=_0xe14b[_0x2653f5];return _0x39039d;};'use strict';var _=require(_0xbe14('0x0'));var db=require(_0xbe14('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xbe14('0x2'));var config=require(_0xbe14('0x3'));var logger=require('./config/logger')(_0xbe14('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0xbe14('0x5'));var chat=require(_0xbe14('0x6'));var whatsapp=require(_0xbe14('0x7'));var transcribe=require(_0xbe14('0x8'));var provider=require(_0xbe14('0x9'));function main(){return db[_0xbe14('0xa')][_0xbe14('0xb')]()['then'](function(){if(config['seedDB']){return seedDb['default']();}})[_0xbe14('0xc')](function(){return checkLicense[_0xbe14('0xd')]();})[_0xbe14('0xc')](function(){return rpc[_0xbe14('0xe')]();})['then'](function(_0x5b9fc6){logger[_0xbe14('0xf')](_0x5b9fc6);return chat[_0xbe14('0x10')]();})['then'](function(){return whatsapp[_0xbe14('0x10')]();})[_0xbe14('0xc')](function(){return schedule[_0xbe14('0x10')]();})[_0xbe14('0xc')](function(){return transcribe[_0xbe14('0x10')]();})[_0xbe14('0xc')](function(){return provider[_0xbe14('0x10')]();})[_0xbe14('0xc')](function(_0x16893f){logger[_0xbe14('0xf')](_0x16893f);return pm2[_0xbe14('0x10')](pm2Config);})[_0xbe14('0xc')](function(_0x813399){var _0x530538=_0x813399['filter'](function(_0x3f58f5){return typeof _0x3f58f5[_0xbe14('0x11')]===_0xbe14('0x12')&&_0x3f58f5[_0xbe14('0x11')]>=0x0;});if(_0x530538['length']>0x0){throw new Error(_0x530538[_0xbe14('0x13')]+_0xbe14('0x14')+_[_0xbe14('0x15')](_0x530538,function(_0x123ede){return'\x22'+_0x123ede[_0xbe14('0x16')][_0xbe14('0x17')]+'\x22';}));}logger[_0xbe14('0xf')]('Online\x20apps:',_[_0xbe14('0x15')](_[_0xbe14('0x18')](_0x813399,{'status':_0xbe14('0x19')}),_0xbe14('0x17'))[_0xbe14('0x1a')]());logger[_0xbe14('0xf')]('Offline\x20apps:',_[_0xbe14('0x15')](_[_0xbe14('0x18')](_0x813399,function(_0x417c8d){return _0x417c8d[_0xbe14('0x1b')]!==_0xbe14('0x19');}),'name')[_0xbe14('0x1a')]()||'None');console[_0xbe14('0x1c')]('App\x20Ready!');})[_0xbe14('0x1d')](function(_0x4a25fa){console[_0xbe14('0x1c')](_0xbe14('0x1e'),_0x4a25fa);logger['error'](_0xbe14('0x1f'),_0x4a25fa);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 498051a..19bbdd4 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 _0x2032=['interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','find','authenticate','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','add','blockDuration','minutes','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','Forbidden','isWebrtcLicence','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','generateApiKey','regenerateApiKey','test','ValidationError','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.','Sequelize','updatePasswordsHistory','length','splice','unshift','promisify','sign','secret','payload','verify','randomBytes','hex','floor','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','showWebBar','lastLoginAt','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk'];(function(_0x3970a6,_0x446ce1){var _0x2e00d2=function(_0x1541ed){while(--_0x1541ed){_0x3970a6['push'](_0x3970a6['shift']());}};_0x2e00d2(++_0x446ce1);}(_0x2032,0xd9));var _0x2203=function(_0x405581,_0x1cf70e){_0x405581=_0x405581-0x0;var _0x1eac4e=_0x2032[_0x405581];return _0x1eac4e;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2203('0x0'));var hardwareConf=require(_0x2203('0x1'));var licenseUtil=require(_0x2203('0x2'));var encryptor=require('../encryptor');var _=require(_0x2203('0x3'));var jwt=require(_0x2203('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x2203('0x5'));var basicAuth=require(_0x2203('0x6'));var crypto=require(_0x2203('0x7'));var BPromise=require(_0x2203('0x8'));var util=require(_0x2203('0x9'));var moment=require(_0x2203('0xa'));var validateJwt=expressJwt({'secret':config[_0x2203('0xb')][_0x2203('0xc')]});var userAttributes=['id',_0x2203('0xd'),_0x2203('0xe'),_0x2203('0xf'),'internal','email',_0x2203('0x10'),'permissions',_0x2203('0x11'),_0x2203('0x12'),_0x2203('0x13'),'mailPause',_0x2203('0x14'),'smsPause',_0x2203('0x15'),'pauseType',_0x2203('0x16'),_0x2203('0x17'),'lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias',_0x2203('0x18'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x2203('0x19'),_0x2203('0x1a'),_0x2203('0x1b'),_0x2203('0x1c'),_0x2203('0x1d'),_0x2203('0x1e'),_0x2203('0x1f'),_0x2203('0x20'),_0x2203('0x21'),_0x2203('0x22'),'privacyEnabled',_0x2203('0x23'),_0x2203('0x24'),'downloadVoiceRecordings',_0x2203('0x25'),_0x2203('0x26'),'ignorePauseForPreviewCalls',_0x2203('0x27'),'chatAutoanswer',_0x2203('0x28'),_0x2203('0x29'),_0x2203('0x2a'),_0x2203('0x2b'),_0x2203('0x2c'),_0x2203('0x2d'),'openchannelAutoanswerDelay',_0x2203('0x2e'),'faxAutoanswerDelay','whatsappAutoanswer',_0x2203('0x2f'),'messengerSoundNotification'];exports[_0x2203('0x30')]=function(){return this[_0x2203('0x31')](!![])['use'](function(_0x3ee25b,_0x5e29cd,_0x5c8da9){if(_0x3ee25b[_0x2203('0x32')]){_0x5c8da9();}else{return db[_0x2203('0x33')][_0x2203('0x34')]({'where':{'id':_0x3ee25b[_0x2203('0x35')]['id']},'attributes':['id',_0x2203('0x36'),_0x2203('0x37')],'raw':!![]})[_0x2203('0x38')](function(_0x250349){if(_0x250349&&_0x250349['closed']){return _0x5e29cd[_0x2203('0x39')](_0x250349[_0x2203('0x37')]===_0x2203('0x3a')?0x195:0x193)['json']({'message':_0x250349[_0x2203('0x37')]===_0x2203('0x3a')?'Unmanaged.':_0x2203('0x3b')});}else{_0x5c8da9();}})[_0x2203('0x3c')](function(_0x1c6a77){_0x5c8da9(_0x1c6a77);});}});};exports[_0x2203('0x31')]=function isAuthenticated(_0x28ae02){return compose()[_0x2203('0x3d')](function(_0x9c53f,_0x5a95c1,_0x34b8ba){var _0x616ed8;if(_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')]){if(_['startsWith'](_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')],_0x2203('0x40'))){var _0xf59954=basicAuth(_0x9c53f);db['User'][_0x2203('0x41')]({'where':{'name':_0xf59954[_0x2203('0xf')]}})['then'](function(_0x5c0157){if(!_0x5c0157||!_0x5c0157[_0x2203('0x42')](_0xf59954['pass'])){return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x44')});}_0x9c53f[_0x2203('0x32')]={'id':_0x5c0157['id']};_0x34b8ba();})[_0x2203('0x3c')](function(_0xf2801d){_0x34b8ba(_0xf2801d);});}else if(_['startsWith'](_0x9c53f[_0x2203('0x3e')][_0x2203('0x3f')],'Bearer')){validateJwt(_0x9c53f,_0x5a95c1,_0x34b8ba);}else{if(_0x28ae02){_0x34b8ba();}else{return _0x5a95c1[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x45')});}}}else if(_0x9c53f[_0x2203('0x46')][_0x2203('0x47')]){try{var _0x24d138={'audience':hardwareConf[_0x2203('0x48')](),'issuer':hardwareConf[_0x2203('0x48')]()};verifyJwt(_0x9c53f[_0x2203('0x46')]['apikey'],_0x24d138)[_0x2203('0x38')](function(_0x347d3e){return db['User']['find']({'where':{'id':_0x347d3e[_0x2203('0x49')]}})['then'](function(_0x25cc97){_0x616ed8=_0x25cc97;return db[_0x2203('0x4a')][_0x2203('0x34')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x2203('0x38')](function(_0x47c93a){if(!_0x616ed8||!_[_0x2203('0x4b')](_0x616ed8['apiKeyNonce'],_0x347d3e[_0x2203('0x4c')])){return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x4d')});}if(_0x616ed8[_0x2203('0x4e')]){return _0x5a95c1[_0x2203('0x39')](0x191)[_0x2203('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x616ed8['blocked']){if(_0x47c93a['blockDuration']>0x0){if(moment(_0x616ed8[_0x2203('0x4f')])[_0x2203('0x50')](_0x47c93a[_0x2203('0x51')],_0x2203('0x52'))>moment()){return _0x5a95c1[_0x2203('0x39')](0x191)[_0x2203('0x43')]({'message':_0x2203('0x53')});}}else{return _0x5a95c1['status'](0x191)[_0x2203('0x43')]({'message':_0x2203('0x53')});}}_0x9c53f[_0x2203('0x32')]={'id':_0x616ed8['id']};_0x34b8ba();});})[_0x2203('0x3c')](function(){return _0x5a95c1['status'](0x191)['json']({'message':_0x2203('0x53')});});}catch(_0x5494a1){_0x34b8ba(_0x5494a1);}}else if(_0x28ae02){_0x34b8ba();}else{return _0x5a95c1[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x45')});}})['use'](function(_0x5bba52,_0x1e7ebc,_0x3739f6){if(_0x5bba52[_0x2203('0x32')]){db[_0x2203('0x54')][_0x2203('0x41')]({'where':{'id':_0x5bba52[_0x2203('0x32')]['id']},'attributes':userAttributes})['then'](function(_0x15d3b6){if(!_0x15d3b6){return _0x1e7ebc[_0x2203('0x39')](0x194)[_0x2203('0x43')]({'message':_0x2203('0x55')});}_0x5bba52[_0x2203('0x32')]=_0x15d3b6;_0x3739f6();})[_0x2203('0x3c')](function(_0x5b4842){_0x3739f6(_0x5b4842);});}else if(_0x28ae02){_0x3739f6();}else{return _0x1e7ebc[_0x2203('0x39')](0x194)[_0x2203('0x43')]({'message':_0x2203('0x56')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2203('0x3d')](function(_0x24e773,_0x4aab80,_0x3b9981){return licenseUtil['getLicense']()['then'](function(_0x1c6661){if(_0x1c6661['update']){_0x3b9981();}else{return _0x4aab80[_0x2203('0x39')](0x193)[_0x2203('0x43')]({'message':_0x2203('0x57')});}})[_0x2203('0x3c')](function(_0x594148){_0x3b9981(_0x594148);});});};exports[_0x2203('0x58')]=function isWebrtcLicence(){return compose()[_0x2203('0x3d')](function(_0x5cd8c6,_0x29bd91,_0x381b3e){return licenseUtil[_0x2203('0x59')]()[_0x2203('0x38')](function(_0x5a71a5){if(_0x5a71a5['webrtc']){_0x381b3e();}else{return _0x29bd91[_0x2203('0x39')](0x193)['json']({'message':'Forbidden'});}})[_0x2203('0x3c')](function(_0x33b7b5){_0x381b3e(_0x33b7b5);});});};exports[_0x2203('0x5a')]=function(_0x49823a,_0x4c1496,_0x131aec){_0x49823a[_0x2203('0x5a')]=!![];return _0x131aec();};exports[_0x2203('0x5b')]=function signToken(_0x21d2d7){return signJwt(_0x21d2d7);};exports[_0x2203('0x5c')]=function(_0x21fd78,_0x4a7f4e){if(!_0x21fd78[_0x2203('0x32')]){return _0x4a7f4e['status'](0x194)[_0x2203('0x43')]({'message':_0x2203('0x5d')});}var _0x246aff={'payload':{'id':_0x21fd78[_0x2203('0x32')]['id'],'role':_0x21fd78['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x246aff)[_0x2203('0x38')](function(_0x1f772d){_0x4a7f4e[_0x2203('0x5e')](_0x2203('0x5f'),_0x1f772d);_0x4a7f4e['redirect']('/dashboards/general');})['catch'](function(_0x4064d5){return _0x4a7f4e[_0x2203('0x39')](0x1f4)['send'](_0x4064d5);});};exports[_0x2203('0x60')]=function(_0x267627){if(_['isNil'](_0x267627[_0x2203('0x61')])||_[_0x2203('0x62')](_0x267627[_0x2203('0x63')])){return null;}else{return createJwt(_0x267627);}};exports[_0x2203('0x64')]=function(_0x4bb6f1){_0x4bb6f1[_0x2203('0x61')]=generateNonce();_0x4bb6f1['apiKeyIat']=generateIssuedAt();return createJwt(_0x4bb6f1);};exports[_0x2203('0x65')]=function(_0x1de713,_0x4ee8cf){var _0x428b18=_0x1de713[_0x2203('0x46')][_0x2203('0x47')];if(_0x428b18){var _0x378132={'nonce':_0x4ee8cf[_0x2203('0x61')],'iat':_0x4ee8cf[_0x2203('0x63')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x428b18,_0x378132)[_0x2203('0x38')](function(){return generateApiKey(_0x4ee8cf);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0xfddc3b){var _0x33e5eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x33e5eb[_0x2203('0x66')](_0xfddc3b))throw new db['Sequelize'][(_0x2203('0x67'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0xeb6b44,_0x5be4b6,_0x54ec71){var _0x5efc59=encryptor[_0x2203('0x68')](_0x5be4b6)[_0x2203('0x69')](',');for(var _0x367122=0x0;_0x367122<_0x54ec71;_0x367122++){if(!_0x5efc59[_0x367122])break;if(_0xeb6b44[_0x2203('0x6a')]()===_0x5efc59[_0x367122][_0x2203('0x6a')]()){var _0x32f593=util[_0x2203('0x6b')](_0x2203('0x6c'),_0x54ec71);if(_0x54ec71===0x1){_0x32f593=_0x2203('0x6d');}throw new db[(_0x2203('0x6e'))][(_0x2203('0x67'))](_0x32f593);}}return;};exports[_0x2203('0x6f')]=function(_0x58ff57,_0x585bde){var _0x2cd752=_0x585bde?encryptor[_0x2203('0x68')](_0x585bde)[_0x2203('0x69')](','):[];if(_0x2cd752[_0x2203('0x70')]===0x5){_0x2cd752[_0x2203('0x71')](-0x1,0x1);}_0x2cd752[_0x2203('0x72')](_0x58ff57);return encryptor['encryptString'](_0x2cd752['join'](','));};function signJwt(_0xb49120){var _0x34358e=BPromise[_0x2203('0x73')](jwt[_0x2203('0x74')],{'context':jwt});var _0xcab922=_0xb49120[_0x2203('0x75')]||config[_0x2203('0xb')][_0x2203('0xc')];return new BPromise(function(_0x2c6bcc,_0x135272){_0x34358e(_0xb49120[_0x2203('0x76')],_0xcab922,_0xb49120['options'])[_0x2203('0x38')](function(_0x3ae12e){_0x2c6bcc(_0x3ae12e);})[_0x2203('0x3c')](function(_0x407fc2){_0x135272(_0x407fc2);});});}function verifyJwt(_0x41a938,_0x44e7ab,_0x52c159){var _0x544756=BPromise[_0x2203('0x73')](jwt[_0x2203('0x77')],{'context':jwt});var _0x49e795=_0x52c159||config[_0x2203('0xb')][_0x2203('0xc')];return new BPromise(function(_0x24179a,_0xc193b7){_0x544756(_0x41a938,_0x49e795,_0x44e7ab)[_0x2203('0x38')](function(_0x1e44c){_0x24179a(_0x1e44c);})[_0x2203('0x3c')](function(_0x8a9282){_0xc193b7(_0x8a9282);});});}function generateNonce(){return crypto[_0x2203('0x78')](0x10)['toString'](_0x2203('0x79'));}function generateIssuedAt(){return Math[_0x2203('0x7a')](Date[_0x2203('0x7b')]()/0x3e8)['toString']();}function createJwt(_0x68855d){var _0x3f73e1={'payload':{'iat':_0x68855d[_0x2203('0x63')],'nonce':_0x68855d[_0x2203('0x61')]},'options':{'algorithm':_0x2203('0x7c'),'subject':_0x68855d['id']['toString'](),'issuer':hardwareConf[_0x2203('0x48')](),'audience':hardwareConf[_0x2203('0x48')]()}};return signJwt(_0x3f73e1)[_0x2203('0x38')](function(_0x4dde80){return{'iat':_0x68855d['apiKeyIat'],'nonce':_0x68855d['apiKeyNonce'],'token':_0x4dde80};});} \ No newline at end of file +var _0x4213=['mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','closed','disposition','json','unmanaged','Unmanaged.','Forbidden.','headers','startsWith','Basic','User','authenticate','pass','status','Wrong\x20credentials.','user','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','findOne','allowedLoginAttempts','blockDuration','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','find','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','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.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','secrets','payload','options','promisify','verify','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','crypto','bluebird','util','moment','session','role','fullname','name','internal','userpic','voicePause'];(function(_0x33cffe,_0x1c059e){var _0x456ffb=function(_0x3a620f){while(--_0x3a620f){_0x33cffe['push'](_0x33cffe['shift']());}};_0x456ffb(++_0x1c059e);}(_0x4213,0x77));var _0x3421=function(_0x3ca542,_0x5b33be){_0x3ca542=_0x3ca542-0x0;var _0x2f01c3=_0x4213[_0x3ca542];return _0x2f01c3;};'use strict';var db=require(_0x3421('0x0'))['db'];var config=require(_0x3421('0x1'));var hardwareConf=require(_0x3421('0x2'));var licenseUtil=require(_0x3421('0x3'));var encryptor=require(_0x3421('0x4'));var _=require(_0x3421('0x5'));var jwt=require(_0x3421('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x3421('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x3421('0x8'));var BPromise=require(_0x3421('0x9'));var util=require(_0x3421('0xa'));var moment=require(_0x3421('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x3421('0xc')]});var userAttributes=['id',_0x3421('0xd'),_0x3421('0xe'),_0x3421('0xf'),_0x3421('0x10'),'email',_0x3421('0x11'),'permissions','md5secret',_0x3421('0x12'),'chatPause',_0x3421('0x13'),_0x3421('0x14'),_0x3421('0x15'),_0x3421('0x16'),_0x3421('0x17'),_0x3421('0x18'),_0x3421('0x19'),'lastPauseAt',_0x3421('0x1a'),_0x3421('0x1b'),_0x3421('0x1c'),_0x3421('0x1d'),_0x3421('0x1e'),_0x3421('0x1f'),_0x3421('0x20'),'phoneBarEnableRecording',_0x3421('0x21'),'phoneBarEnableSettings',_0x3421('0x22'),_0x3421('0x23'),'phoneBarRemoteControl',_0x3421('0x24'),'hotdesk',_0x3421('0x25'),_0x3421('0x26'),'privacyEnabled',_0x3421('0x27'),_0x3421('0x28'),_0x3421('0x29'),_0x3421('0x2a'),_0x3421('0x2b'),_0x3421('0x2c'),_0x3421('0x2d'),_0x3421('0x2e'),_0x3421('0x2f'),_0x3421('0x30'),_0x3421('0x31'),'smsAutoanswer',_0x3421('0x32'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0x3421('0x33'),_0x3421('0x34'),_0x3421('0x35'),_0x3421('0x36')];exports[_0x3421('0x37')]=function(){return this[_0x3421('0x38')](!![])[_0x3421('0x39')](function(_0x705591,_0xb9af5f,_0x34389e){if(_0x705591['user']){_0x34389e();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x705591[_0x3421('0x3a')]['id']},'attributes':['id',_0x3421('0x3b'),_0x3421('0x3c')],'raw':!![]})['then'](function(_0x506af4){if(_0x506af4&&_0x506af4[_0x3421('0x3b')]){return _0xb9af5f['status'](_0x506af4[_0x3421('0x3c')]==='unmanaged'?0x195:0x193)[_0x3421('0x3d')]({'message':_0x506af4[_0x3421('0x3c')]===_0x3421('0x3e')?_0x3421('0x3f'):_0x3421('0x40')});}else{_0x34389e();}})['catch'](function(_0x332017){_0x34389e(_0x332017);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5efe73){return compose()[_0x3421('0x39')](function(_0x5aa96b,_0x5074a2,_0xb4eaf4){var _0x4ee4aa;if(_0x5aa96b[_0x3421('0x41')]['authorization']){if(_[_0x3421('0x42')](_0x5aa96b[_0x3421('0x41')]['authorization'],_0x3421('0x43'))){var _0x3bc7c1=basicAuth(_0x5aa96b);db[_0x3421('0x44')]['find']({'where':{'name':_0x3bc7c1[_0x3421('0xf')]}})['then'](function(_0x2b5af4){if(!_0x2b5af4||!_0x2b5af4[_0x3421('0x45')](_0x3bc7c1[_0x3421('0x46')])){return _0x5074a2[_0x3421('0x47')](0x191)[_0x3421('0x3d')]({'message':_0x3421('0x48')});}_0x5aa96b[_0x3421('0x49')]={'id':_0x2b5af4['id']};_0xb4eaf4();})[_0x3421('0x4a')](function(_0x94559a){_0xb4eaf4(_0x94559a);});}else if(_[_0x3421('0x42')](_0x5aa96b['headers']['authorization'],_0x3421('0x4b'))){validateJwt(_0x5aa96b,_0x5074a2,_0xb4eaf4);}else{if(_0x5efe73){_0xb4eaf4();}else{return _0x5074a2[_0x3421('0x47')](0x193)['json']({'message':_0x3421('0x4c')});}}}else if(_0x5aa96b[_0x3421('0x4d')][_0x3421('0x4e')]){try{var _0x17292a={'audience':hardwareConf[_0x3421('0x4f')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5aa96b[_0x3421('0x4d')][_0x3421('0x4e')],_0x17292a)[_0x3421('0x50')](function(_0x5df941){return db[_0x3421('0x44')]['find']({'where':{'id':_0x5df941[_0x3421('0x51')]}})[_0x3421('0x50')](function(_0x9f7fd2){_0x4ee4aa=_0x9f7fd2;return db[_0x3421('0x52')][_0x3421('0x53')]({'where':{'id':0x1},'attributes':[_0x3421('0x54'),_0x3421('0x55')],'raw':!![]});})['then'](function(_0x550596){if(!_0x4ee4aa||!_['isEqual'](_0x4ee4aa[_0x3421('0x56')],_0x5df941['nonce'])){return _0x5074a2['status'](0x191)[_0x3421('0x3d')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x4ee4aa[_0x3421('0x57')]){return _0x5074a2[_0x3421('0x47')](0x191)['json']({'message':_0x3421('0x58')});}if(_0x4ee4aa[_0x3421('0x59')]){if(_0x550596[_0x3421('0x55')]>0x0){if(moment(_0x4ee4aa[_0x3421('0x5a')])['add'](_0x550596[_0x3421('0x55')],_0x3421('0x5b'))>moment()){return _0x5074a2[_0x3421('0x47')](0x191)[_0x3421('0x3d')]({'message':_0x3421('0x58')});}}else{return _0x5074a2['status'](0x191)[_0x3421('0x3d')]({'message':_0x3421('0x58')});}}_0x5aa96b['user']={'id':_0x4ee4aa['id']};_0xb4eaf4();});})[_0x3421('0x4a')](function(){return _0x5074a2['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x418e80){_0xb4eaf4(_0x418e80);}}else if(_0x5efe73){_0xb4eaf4();}else{return _0x5074a2[_0x3421('0x47')](0x193)[_0x3421('0x3d')]({'message':_0x3421('0x4c')});}})[_0x3421('0x39')](function(_0x417d6e,_0xe7fdfb,_0x4e3f1e){if(_0x417d6e[_0x3421('0x49')]){db[_0x3421('0x44')][_0x3421('0x5c')]({'where':{'id':_0x417d6e[_0x3421('0x49')]['id']},'attributes':userAttributes})[_0x3421('0x50')](function(_0x3d016d){if(!_0x3d016d){return _0xe7fdfb['status'](0x194)[_0x3421('0x3d')]({'message':_0x3421('0x5d')});}_0x417d6e[_0x3421('0x49')]=_0x3d016d;_0x4e3f1e();})[_0x3421('0x4a')](function(_0x4f8710){_0x4e3f1e(_0x4f8710);});}else if(_0x5efe73){_0x4e3f1e();}else{return _0xe7fdfb[_0x3421('0x47')](0x194)['json']({'message':_0x3421('0x5e')});}});};exports[_0x3421('0x5f')]=function canUpdate(){return compose()[_0x3421('0x39')](function(_0x176aef,_0x2f9a84,_0x60fb09){return licenseUtil[_0x3421('0x60')]()[_0x3421('0x50')](function(_0x1024eb){if(_0x1024eb[_0x3421('0x61')]){_0x60fb09();}else{return _0x2f9a84[_0x3421('0x47')](0x193)[_0x3421('0x3d')]({'message':_0x3421('0x62')});}})['catch'](function(_0x33394f){_0x60fb09(_0x33394f);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x3421('0x39')](function(_0x1a7661,_0x3e3cca,_0x29044d){return licenseUtil[_0x3421('0x60')]()[_0x3421('0x50')](function(_0x2a11a3){if(_0x2a11a3[_0x3421('0x63')]){_0x29044d();}else{return _0x3e3cca[_0x3421('0x47')](0x193)[_0x3421('0x3d')]({'message':'Forbidden'});}})[_0x3421('0x4a')](function(_0x4547da){_0x29044d(_0x4547da);});});};exports[_0x3421('0x64')]=function(_0x57bf06,_0x566f95,_0x43a94f){_0x57bf06[_0x3421('0x64')]=!![];return _0x43a94f();};exports[_0x3421('0x65')]=function signToken(_0x5099c9){return signJwt(_0x5099c9);};exports[_0x3421('0x66')]=function(_0x18eba6,_0x213e27){if(!_0x18eba6[_0x3421('0x49')]){return _0x213e27['status'](0x194)[_0x3421('0x3d')]({'message':_0x3421('0x67')});}var _0x3f7ff3={'payload':{'id':_0x18eba6['user']['id'],'role':_0x18eba6['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3f7ff3)[_0x3421('0x50')](function(_0x1021f8){_0x213e27['cookie']('motion.token',_0x1021f8);_0x213e27[_0x3421('0x68')](_0x3421('0x69'));})[_0x3421('0x4a')](function(_0x25b0d8){return _0x213e27[_0x3421('0x47')](0x1f4)['send'](_0x25b0d8);});};exports[_0x3421('0x6a')]=function(_0x2a81fa){if(_[_0x3421('0x6b')](_0x2a81fa[_0x3421('0x56')])||_['isNil'](_0x2a81fa[_0x3421('0x6c')])){return null;}else{return createJwt(_0x2a81fa);}};exports[_0x3421('0x6d')]=function(_0x219e1d){_0x219e1d['apiKeyNonce']=generateNonce();_0x219e1d[_0x3421('0x6c')]=generateIssuedAt();return createJwt(_0x219e1d);};exports['regenerateApiKey']=function(_0x598dfa,_0x11d30f){var _0x498be5=_0x598dfa[_0x3421('0x4d')][_0x3421('0x4e')];if(_0x498be5){var _0x12bd9a={'nonce':_0x11d30f['apiKeyNonce'],'iat':_0x11d30f[_0x3421('0x6c')],'audience':hardwareConf[_0x3421('0x4f')](),'issuer':hardwareConf[_0x3421('0x4f')]()};return verifyJwt(_0x498be5,_0x12bd9a)[_0x3421('0x50')](function(){return generateApiKey(_0x11d30f);});}else{throw{'message':_0x3421('0x6e')};}};exports[_0x3421('0x6f')]=function(_0x4e1103){var _0x21e3d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21e3d4[_0x3421('0x70')](_0x4e1103))throw new db['Sequelize'][(_0x3421('0x71'))](_0x3421('0x72'));return;};exports['validatePasswordHistory']=function(_0x3950fa,_0x11ad76,_0x394cb2){var _0x5df17c=encryptor[_0x3421('0x73')](_0x11ad76)[_0x3421('0x74')](',');for(var _0x447456=0x0;_0x447456<_0x394cb2;_0x447456++){if(!_0x5df17c[_0x447456])break;if(_0x3950fa[_0x3421('0x75')]()===_0x5df17c[_0x447456][_0x3421('0x75')]()){var _0x365626=util[_0x3421('0x76')](_0x3421('0x77'),_0x394cb2);if(_0x394cb2===0x1){_0x365626=_0x3421('0x78');}throw new db[(_0x3421('0x79'))][(_0x3421('0x71'))](_0x365626);}}return;};exports[_0x3421('0x7a')]=function(_0x5ac16a,_0x10be7c){var _0x3a8883=_0x10be7c?encryptor['decryptString'](_0x10be7c)[_0x3421('0x74')](','):[];if(_0x3a8883[_0x3421('0x7b')]===0x5){_0x3a8883[_0x3421('0x7c')](-0x1,0x1);}_0x3a8883[_0x3421('0x7d')](_0x5ac16a);return encryptor[_0x3421('0x7e')](_0x3a8883[_0x3421('0x7f')](','));};function signJwt(_0x32c9a7){var _0x374a6a=BPromise['promisify'](jwt[_0x3421('0x80')],{'context':jwt});var _0x5dc921=_0x32c9a7[_0x3421('0x81')]||config[_0x3421('0x82')][_0x3421('0xc')];return new BPromise(function(_0x897cde,_0x526d71){_0x374a6a(_0x32c9a7[_0x3421('0x83')],_0x5dc921,_0x32c9a7[_0x3421('0x84')])[_0x3421('0x50')](function(_0xba1f52){_0x897cde(_0xba1f52);})[_0x3421('0x4a')](function(_0x823366){_0x526d71(_0x823366);});});}function verifyJwt(_0x5e6c4d,_0x8a35b5,_0x1d23f1){var _0x1e9971=BPromise[_0x3421('0x85')](jwt[_0x3421('0x86')],{'context':jwt});var _0x1ba5e1=_0x1d23f1||config[_0x3421('0x82')][_0x3421('0xc')];return new BPromise(function(_0x4edb4e,_0xfbdb57){_0x1e9971(_0x5e6c4d,_0x1ba5e1,_0x8a35b5)[_0x3421('0x50')](function(_0x200958){_0x4edb4e(_0x200958);})[_0x3421('0x4a')](function(_0x347299){_0xfbdb57(_0x347299);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x3421('0x87'));}function generateIssuedAt(){return Math[_0x3421('0x88')](Date[_0x3421('0x89')]()/0x3e8)['toString']();}function createJwt(_0x3bf5de){var _0x4d6396={'payload':{'iat':_0x3bf5de[_0x3421('0x6c')],'nonce':_0x3bf5de['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x3bf5de['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4d6396)[_0x3421('0x50')](function(_0x2039b1){return{'iat':_0x3bf5de[_0x3421('0x6c')],'nonce':_0x3bf5de[_0x3421('0x56')],'token':_0x2039b1};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index ef68168..f7e8a0c 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 _0x910b=['buildContactsQuery','getFilteredContacts','rows','CmContact','describe','startsWith','map','CmCustomField','slice','all','length','cf_','type','keys','catch','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','count','User'];(function(_0x232a49,_0x13ecf9){var _0x3bdc0e=function(_0x281aae){while(--_0x281aae){_0x232a49['push'](_0x232a49['shift']());}};_0x3bdc0e(++_0x13ecf9);}(_0x910b,0x1cb));var _0xb910=function(_0x4756d5,_0x20560a){_0x4756d5=_0x4756d5-0x0;var _0xf834a8=_0x910b[_0x4756d5];return _0xf834a8;};'use strict';var _=require(_0xb910('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xb910('0x1'))['db'];exports[_0xb910('0x2')]=function(_0x112cc6,_0x65e23a,_0x48e687,_0x5cebde){var _0x3a7ea9={'count':0x0,'rows':[]};var _0xd1513f=sqlUtils[_0xb910('0x3')](_0x65e23a,_0x112cc6);if(_0xd1513f){return Promise[_0xb910('0x4')](_0x3a7ea9);}var _0x30e0c7=sqlUtils[_0xb910('0x5')]();var _0x536f7d={};var _0x19c2ae=![];var _0x41e6e5=![];return Promise[_0xb910('0x4')]()[_0xb910('0x6')](function(){if(_0x112cc6['search']){return sqlUtils[_0xb910('0x7')](_0x112cc6[_0xb910('0x8')],_0x5cebde);}else{return sqlUtils[_0xb910('0x9')](_0x112cc6,_0x5cebde);}})['then'](function(_0x183dbe){_0x30e0c7[_0xb910('0xa')](_0x183dbe[_0xb910('0xb')]);_0x30e0c7['where'](_0x183dbe[_0xb910('0xc')]);_0x30e0c7['where'](_0x183dbe[_0xb910('0xd')]);_0x30e0c7[_0xb910('0xa')](_0x183dbe[_0xb910('0xe')][_0xb910('0xf')]);_0x536f7d=_0x183dbe[_0xb910('0x10')];_0x41e6e5=_0x183dbe[_0xb910('0xe')][_0xb910('0x11')];return sqlUtils[_0xb910('0x12')](_0x65e23a,_0x112cc6,_0x41e6e5);})[_0xb910('0x6')](function(_0x361051){_0x30e0c7[_0xb910('0xa')](_0x361051);var _0x16391e=_0x112cc6[_0xb910('0x8')]?_0x536f7d[_0xb910('0x13')]:_0x112cc6['tag'];_0x19c2ae=_0x16391e?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e0c7,_0x16391e);})[_0xb910('0x6')](function(_0x4cd5b9){_0x3a7ea9[_0xb910('0x14')]=_0x4cd5b9;if(_0x3a7ea9[_0xb910('0x14')]===0x0){return;}if(_0x112cc6[_0xb910('0x15')]){_0x41e6e5=!![];}return sqlUtils[_0xb910('0x16')](_0x30e0c7,_0x112cc6[_0xb910('0xc')],_0x48e687,_0x19c2ae,_0x536f7d[_0xb910('0xf')],_0x41e6e5);})[_0xb910('0x6')](function(_0x217f88){if(!_0x217f88){return[];}return sqlUtils[_0xb910('0x17')](_0x217f88,_0x112cc6,_0x48e687);})[_0xb910('0x6')](function(_0x396c24){_0x3a7ea9[_0xb910('0x18')]=_0x396c24;return _0x3a7ea9;})['catch'](function(_0xea6e6d){throw _0xea6e6d;});};exports['describe']=function(){var _0x29e7de={};var _0x224fc7=[];return db[_0xb910('0x19')][_0xb910('0x1a')]()[_0xb910('0x6')](function(_0x14508b){_0x29e7de=_0x14508b;var _0x7c9ae1=Object['keys'](_0x29e7de)['filter'](function(_0x544188){return _[_0xb910('0x1b')](_0x544188,'cf_')?_0x544188:undefined;});var _0x3bd096=_0x7c9ae1[_0xb910('0x1c')](function(_0x57e9e6){return db[_0xb910('0x1d')]['findOne']({'where':{'id':_0x57e9e6[_0xb910('0x1e')](0x3)},'raw':!![]});});return Promise[_0xb910('0x1f')](_0x3bd096);})['then'](function(_0x4dc03c){for(var _0x1f07f0=0x0;_0x1f07f0<_0x4dc03c[_0xb910('0x20')];_0x1f07f0++){if(_0x4dc03c[_0x1f07f0]){var _0xad6b02=_0xb910('0x21')+_0x4dc03c[_0x1f07f0]['id'];_0x29e7de[_0xad6b02]['fieldType']=_0x4dc03c[_0x1f07f0][_0xb910('0x22')];}}_0x224fc7=_[_0xb910('0x1c')](Object[_0xb910('0x23')](_0x29e7de),function(_0x129059){return{'name':_0x129059,'type':_0x29e7de[_0x129059]['type']};});return _0x224fc7;})[_0xb910('0x24')](function(_0x23407e){throw _0x23407e;});}; \ No newline at end of file +var _0x4904=['parseAdvancedSearchFilter','search','default','where','filter','user','clause','tags','skip','checkListsRestrictions','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','CmContact','keys','startsWith','cf_','findOne','slice','all','length','fieldType','type','map','lodash','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then'];(function(_0x2a6b55,_0x572485){var _0x3dd7fd=function(_0x52837f){while(--_0x52837f){_0x2a6b55['push'](_0x2a6b55['shift']());}};_0x3dd7fd(++_0x572485);}(_0x4904,0x89));var _0x4490=function(_0x997776,_0xd11f04){_0x997776=_0x997776-0x0;var _0x3ca2c9=_0x4904[_0x997776];return _0x3ca2c9;};'use strict';var _=require(_0x4490('0x0'));var sqlUtils=require(_0x4490('0x1'));var db=require(_0x4490('0x2'))['db'];exports[_0x4490('0x3')]=function(_0x2e3d07,_0x15a4fc,_0xa630f7,_0x3015cd){var _0x5e8e7b={'count':0x0,'rows':[]};var _0x3129ab=sqlUtils['skipContactsQuery'](_0x15a4fc,_0x2e3d07);if(_0x3129ab){return Promise[_0x4490('0x4')](_0x5e8e7b);}var _0x512b65=sqlUtils[_0x4490('0x5')]();var _0x370fa3={};var _0x40a25c=![];var _0x581031=![];return Promise[_0x4490('0x4')]()[_0x4490('0x6')](function(){if(_0x2e3d07['search']){return sqlUtils[_0x4490('0x7')](_0x2e3d07[_0x4490('0x8')],_0x3015cd);}else{return sqlUtils['parseQueryParameters'](_0x2e3d07,_0x3015cd);}})[_0x4490('0x6')](function(_0x1d3f45){_0x512b65['where'](_0x1d3f45[_0x4490('0x9')]);_0x512b65[_0x4490('0xa')](_0x1d3f45['fields']);_0x512b65[_0x4490('0xa')](_0x1d3f45[_0x4490('0xb')]);_0x512b65[_0x4490('0xa')](_0x1d3f45[_0x4490('0xc')][_0x4490('0xd')]);_0x370fa3=_0x1d3f45[_0x4490('0xe')];_0x581031=_0x1d3f45[_0x4490('0xc')][_0x4490('0xf')];return sqlUtils[_0x4490('0x10')](_0x15a4fc,_0x2e3d07,_0x581031);})['then'](function(_0x180a76){_0x512b65['where'](_0x180a76);var _0x3d88a5=_0x2e3d07[_0x4490('0x8')]?_0x370fa3['ids']:_0x2e3d07['tag'];_0x40a25c=_0x3d88a5?!![]:![];return sqlUtils[_0x4490('0x11')](_0x512b65,_0x3d88a5);})['then'](function(_0x3c9b61){_0x5e8e7b[_0x4490('0x12')]=_0x3c9b61;if(_0x5e8e7b[_0x4490('0x12')]===0x0){return;}if(_0x2e3d07[_0x4490('0x13')]){_0x581031=!![];}return sqlUtils[_0x4490('0x14')](_0x512b65,_0x2e3d07[_0x4490('0x15')],_0xa630f7,_0x40a25c,_0x370fa3[_0x4490('0xd')],_0x581031);})['then'](function(_0xe25b20){if(!_0xe25b20){return[];}return sqlUtils[_0x4490('0x16')](_0xe25b20,_0x2e3d07,_0xa630f7);})[_0x4490('0x6')](function(_0x5b1ce7){_0x5e8e7b[_0x4490('0x17')]=_0x5b1ce7;return _0x5e8e7b;})[_0x4490('0x18')](function(_0x324afb){throw _0x324afb;});};exports['describe']=function(){var _0x3dcf24={};var _0x520f03=[];return db[_0x4490('0x19')]['describe']()[_0x4490('0x6')](function(_0x469b97){_0x3dcf24=_0x469b97;var _0x4cca77=Object[_0x4490('0x1a')](_0x3dcf24)['filter'](function(_0x56441c){return _[_0x4490('0x1b')](_0x56441c,_0x4490('0x1c'))?_0x56441c:undefined;});var _0x4486c5=_0x4cca77['map'](function(_0x387914){return db['CmCustomField'][_0x4490('0x1d')]({'where':{'id':_0x387914[_0x4490('0x1e')](0x3)},'raw':!![]});});return Promise[_0x4490('0x1f')](_0x4486c5);})[_0x4490('0x6')](function(_0x5c34e7){for(var _0x2e1b9c=0x0;_0x2e1b9c<_0x5c34e7[_0x4490('0x20')];_0x2e1b9c++){if(_0x5c34e7[_0x2e1b9c]){var _0x117ae8='cf_'+_0x5c34e7[_0x2e1b9c]['id'];_0x3dcf24[_0x117ae8][_0x4490('0x21')]=_0x5c34e7[_0x2e1b9c][_0x4490('0x22')];}}_0x520f03=_[_0x4490('0x23')](Object['keys'](_0x3dcf24),function(_0x500da8){return{'name':_0x500da8,'type':_0x3dcf24[_0x500da8][_0x4490('0x22')]};});return _0x520f03;})[_0x4490('0x18')](function(_0x5286b0){throw _0x5286b0;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 2f122ad..0138a8f 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 _0x9972=['start','map','tags','clause','and','user','uc.UserId\x20=\x20?','keys','some','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','Tag','findAll','color','keyBy','Sequelize','SELECT','sequelize','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','query','toString','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','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','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','castTo','buildExpression','default','text','value'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x9972,0xfc));var _0x2997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9972[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2997('0x0'));var squel=require(_0x2997('0x1'));var as=require(_0x2997('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2997('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4be996,_0x293400){var _0x29c9fa=![];if(_0x4be996[_0x2997('0x4')]===_0x2997('0x5')&&!_0x293400[_0x2997('0x6')]&&!_0x293400[_0x2997('0x7')]&&_0x293400[_0x2997('0x8')]!==_0x2997('0x9')){_0x29c9fa=!![];}return _0x29c9fa;}function getContactsSubquery(){return squel[_0x2997('0xa')]()[_0x2997('0xb')](_0x2997('0xc'),'c')[_0x2997('0xd')](_0x2997('0xe'));}function applyJoinClauses(_0x3a8c2e,_0x59304d){var _0x58b3ed=_0x59304d?'c':_0x2997('0xf');_0x3a8c2e[_0x2997('0x10')](_0x2997('0x11'),'uc',_0x2997('0x12')+_0x58b3ed+_0x2997('0x13'))[_0x2997('0x10')](_0x2997('0x14'),'ct',_0x2997('0x15')+_0x58b3ed+_0x2997('0x13'))[_0x2997('0x10')](_0x2997('0x16'),'t',_0x2997('0x17'));return _0x3a8c2e;}function addFieldsToQuery(_0x301c02,_0x3768a3,_0x222432,_0xb9c10f,_0x314a71){var _0x4bee2f=_0x314a71?'c':_0x2997('0xf');if(!_0x3768a3){_0x3768a3=['id',_0x2997('0x18'),'lastName',_0x2997('0x19'),_0x2997('0x1a'),_0x2997('0x1b'),_0x2997('0x1c'),'ListId',_0x2997('0x1d'),_0x2997('0x1e'),_0x2997('0x1f'),_0x2997('0x20'),_0x2997('0x21')];}else if(!_0x3768a3[_0x2997('0x22')]('id')){_0x3768a3[_0x2997('0x23')]('id');}var _0x56cc1e=_0x222432&&_0x314a71||!_0x222432&&!_0x314a71;if(_0xb9c10f){_0x56cc1e=_0xb9c10f&&_0x314a71||!_0xb9c10f&&!_0x314a71;}_0x3768a3[_0x2997('0x24')](function(_0x3ff808){if(_0x3ff808==='TagIds'){if(_0x56cc1e){_0x301c02[_0x2997('0x25')](_0x2997('0x26'),_0x3ff808);}else if(_0x222432||_0xb9c10f){_0x301c02[_0x2997('0x25')](_0x4bee2f+'.'+_0x3ff808);}}else{_0x301c02[_0x2997('0x25')](_0x4bee2f+'.'+_0x3ff808);}});return _0x301c02;}function getSqlClauses(){var _0x21ee02={'default':squel[_0x2997('0x27')](),'fields':squel[_0x2997('0x27')](),'filter':squel[_0x2997('0x27')](),'tags':{'clause':squel[_0x2997('0x27')](),'ids':null},'user':{'clause':squel[_0x2997('0x27')](),'skip':![]}};return _0x21ee02;}function parseTagParameter(_0xd59bba){var _0x1d8c0e=squel[_0x2997('0x27')]();if(_0xd59bba){var _0x4277d9=utils[_0x2997('0x28')](_0xd59bba);_0x4277d9[_0x2997('0x24')](function(_0xe99c80){_0x1d8c0e['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe99c80+',%');});}return _0x1d8c0e;}function parseSearchFilter(_0x22adc5){var _0x4fd59e=squel[_0x2997('0x27')]();if(_0x22adc5){var _0x19be10=_0x22adc5[_0x2997('0x29')]('\x5c','\x5c\x5c')[_0x2997('0x29')](/'/g,'\x27\x27');if(_0x19be10[_0x2997('0x2a')]('\x20')[_0x2997('0x2b')]>0x1){_0x4fd59e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2997('0x2c')](_0x19be10,!![]),null);}else{if(qs['isNumeric'](_0x19be10)){_0x4fd59e['or'](_0x2997('0x2d'),_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x2e'),_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x2f'),_0x19be10+'%');_0x4fd59e['or']('c.fax\x20LIKE\x20?',_0x19be10+'%');}else if(qs[_0x2997('0x30')](_0x19be10)){_0x4fd59e['or'](_0x2997('0x31'),_0x19be10+'%');}else{_0x4fd59e['or'](_0x2997('0x32'),'%'+_0x19be10+'%');_0x4fd59e['or'](_0x2997('0x33'),'%'+_0x19be10+'%');_0x4fd59e['or']('c.email\x20LIKE\x20?','%'+_0x19be10+'%');}}}return _0x4fd59e;}function parseAdvancedSearchFilter(_0x2f7bab,_0x329ac1){var _0x383346=getSqlClauses();var _0x272373=as[_0x2997('0x34')](_0x2f7bab);var _0x53e7ef=_0x272373[_0x2997('0x35')];for(var _0x14213e=0x0;_0x14213e<_0x272373[_0x2997('0x36')][_0x2997('0x2b')];_0x14213e++){var _0x50bfb6=_0x272373['conditions'][_0x14213e];var _0x50d64d='c';var _0x2c34c2=_[_0x2997('0x37')](_0x329ac1,[_0x2997('0x38'),_0x50bfb6[_0x2997('0x25')]]);if(_0x2c34c2){if(_0x50bfb6[_0x2997('0x25')]===_0x2997('0x39')||_0x2c34c2['fieldType']==='datetime'){_0x50bfb6[_0x2997('0x3a')]='DATE';}var _0x1c21d5=as[_0x2997('0x3b')](_0x50d64d,_0x2c34c2['type'],_0x50bfb6);_0x383346[_0x2997('0x3c')][_0x53e7ef](_0x1c21d5[_0x2997('0x3d')],_0x1c21d5[_0x2997('0x3e')][_0x2997('0x3f')],_0x1c21d5[_0x2997('0x3e')]['end']);}else{if(_0x50bfb6[_0x2997('0x25')]==='Tag'){var _0x86ea24=_0x50bfb6[_0x2997('0x3e')]['split'](',')[_0x2997('0x40')](function(_0xf8e482){return Number(_0xf8e482);});var _0x45ff4e=parseTagParameter(_0x86ea24);_0x383346[_0x2997('0x41')][_0x2997('0x42')][_0x2997('0x43')](_0x45ff4e);_0x383346[_0x2997('0x41')]['ids']=_0x86ea24;}else if(_0x50bfb6[_0x2997('0x25')]==='User'){_0x383346[_0x2997('0x44')][_0x2997('0x42')][_0x2997('0x43')](_0x2997('0x45'),_0x50bfb6['value']);_0x383346[_0x2997('0x44')]['skip']=!![];}}}return _0x383346;}function parseModelFields(_0x25c25a,_0x15abfa){var _0x505814=squel['expr']();var _0x585dda=_(_0x25c25a)[_0x2997('0x46')]()[_0x2997('0x40')](function(_0x57b9b0){return _[_0x2997('0x47')](_0x15abfa,[_0x2997('0x38'),_0x57b9b0])?_0x57b9b0:undefined;})['compact']()[_0x2997('0x3e')]();if(_0x25c25a[_0x2997('0x48')]){_0x585dda[_0x2997('0x23')]('Contact');}if(_0x25c25a['User']){_0x585dda[_0x2997('0x23')](_0x2997('0x49'));}if(_0x585dda[_0x2997('0x2b')]>0x0){_0x585dda['forEach'](function(_0x5b7d50){if(_0x5b7d50===_0x2997('0x7')){_0x505814[_0x2997('0x43')](_0x2997('0x4a'),[]['concat'](_0x25c25a[_0x5b7d50]));}else if(_0x5b7d50==='Contact'){var _0x61bcab='%'+_0x25c25a[_0x5b7d50]+'%';_0x505814[_0x2997('0x43')](_0x2997('0x4b'),_0x61bcab);}else if(_0x5b7d50===_0x2997('0x49')){_0x505814[_0x2997('0x43')](_0x2997('0x45'),_0x25c25a[_0x5b7d50]);}else{_0x505814[_0x2997('0x43')]('c.'+_0x5b7d50+_0x2997('0x4c'),_0x25c25a[_0x5b7d50]);}});}return _0x505814;}function parseQueryParameters(_0x4b1952,_0x275f09){var _0x572211=getSqlClauses();return Promise[_0x2997('0x4d')]()['then'](function(){return parseModelFields(_0x4b1952,_0x275f09);})[_0x2997('0x4e')](function(_0x203e95){_0x572211[_0x2997('0x4f')][_0x2997('0x43')](_0x203e95);return parseTagParameter(_0x4b1952['tag']);})[_0x2997('0x4e')](function(_0x39cd84){_0x572211[_0x2997('0x41')][_0x2997('0x42')][_0x2997('0x43')](_0x39cd84);return parseSearchFilter(_0x4b1952['filter']);})['then'](function(_0x3ba441){_0x572211[_0x2997('0x50')]=_0x3ba441;return _0x572211;});}function checkListsRestrictions(_0x3e58ca,_0x40645f,_0x304b20){var _0xcca2a8=squel[_0x2997('0x27')]();return Promise[_0x2997('0x4d')]()[_0x2997('0x4e')](function(){if(_0x40645f[_0x2997('0x6')]&&_0x3e58ca['role']===_0x2997('0x5')&&!_0x304b20){return _0x3e58ca[_0x2997('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x36ff31){if(_0x36ff31){if(_0x36ff31['length']===0x0){_0xcca2a8[_0x2997('0x43')](_0x2997('0x52'));}else{_0xcca2a8[_0x2997('0x43')](_0x2997('0x4a'),_[_0x2997('0x40')](_0x36ff31,'id'));}}})[_0x2997('0x4e')](function(){return _0xcca2a8;});}function buildContactsQuery(_0x815db3,_0x3f0f6d,_0xe335c5,_0x33f507,_0x4cdb37,_0x5ba907){if(_0x3f0f6d){_0x3f0f6d=_0xe335c5[_0x2997('0x53')];}_0x815db3=addFieldsToQuery(_0x815db3,_0x3f0f6d,_0x33f507,_0x5ba907,!![]);var _0x2bba25=squel[_0x2997('0xa')]();_0x2bba25=addFieldsToQuery(_0x2bba25,_0x3f0f6d,_0x33f507,_0x5ba907,![]);if(_0x33f507||_0x5ba907){_0x815db3=applyJoinClauses(_0x815db3,!![]);_0x815db3[_0x2997('0x54')](_0x2997('0x55'));if(_0xe335c5[_0x2997('0x56')]){_0x2bba25[_0x2997('0x56')](_0xe335c5[_0x2997('0x56')]);}if(_0xe335c5[_0x2997('0x57')]){_0x2bba25['offset'](_0xe335c5[_0x2997('0x57')]);}}else{_0x2bba25=applyJoinClauses(_0x2bba25,![]);_0x2bba25[_0x2997('0x54')]('subqry.id');if(_0xe335c5[_0x2997('0x56')]){_0x815db3['limit'](_0xe335c5['limit']);}if(_0xe335c5['offset']){_0x815db3[_0x2997('0x57')](_0xe335c5[_0x2997('0x57')]);}}_0x2bba25[_0x2997('0x58')](_0x4cdb37);if(_0xe335c5['order']){_0xe335c5[_0x2997('0x59')][_0x2997('0x24')](function(_0x2aa78c){_0x815db3[_0x2997('0x59')]('c.'+_0x2aa78c[0x0],_0x2aa78c[0x1]==='DESC'?![]:!![]);_0x2bba25[_0x2997('0x59')]('subqry.'+_0x2aa78c[0x0],_0x2aa78c[0x1]===_0x2997('0x5a')?![]:!![]);});}_0x2bba25[_0x2997('0xb')](_0x815db3,_0x2997('0xf'));return _0x2bba25;}function getFilteredContacts(_0x3936fc){var _0x37a798=[];return db[_0x2997('0x5b')][_0x2997('0x5c')]({'attributes':['id',_0x2997('0x38'),_0x2997('0x5d')],'raw':!![]})[_0x2997('0x4e')](function(_0x2090ef){_0x37a798=_[_0x2997('0x5e')](_0x2090ef,'id');var _0x3a3405={'type':db[_0x2997('0x5f')]['QueryTypes'][_0x2997('0x60')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x2997('0x61')]['query'](_0x3936fc['toString'](),_0x3a3405);})['then'](function(_0x419268){_0x419268[_0x2997('0x24')](function(_0x1efba3){if(_0x1efba3[_0x2997('0x21')]){_0x1efba3['Tags']=[];_0x1efba3[_0x2997('0x21')][_0x2997('0x2a')](',')['forEach'](function(_0x23fb65){_0x1efba3['Tags'][_0x2997('0x23')](_0x37a798[_0x23fb65]);});}delete _0x1efba3[_0x2997('0x21')];});return _0x419268;});}function countFilteredContacts(_0x48afd9,_0x41076a){var _0x3a6d4b=_0x48afd9[_0x2997('0x62')]();_0x3a6d4b[_0x2997('0x25')](_0x2997('0x63'));_0x3a6d4b=applyJoinClauses(_0x3a6d4b,!![]);_0x48afd9[_0x2997('0x54')](_0x2997('0x55'));var _0x3b0af7=utils[_0x2997('0x28')](_0x41076a);if(!_[_0x2997('0x64')](_0x3b0af7)){_0x3a6d4b[_0x2997('0xd')](_0x2997('0x65'),_0x3b0af7);}var _0x5539a3={'type':db[_0x2997('0x5f')]['QueryTypes'][_0x2997('0x60')],'raw':!![]};return db[_0x2997('0x61')][_0x2997('0x66')](_0x3a6d4b[_0x2997('0x67')](),_0x5539a3)[_0x2997('0x4e')](function(_0x4a9ce4){return _0x4a9ce4[0x0][_0x2997('0x63')];});}module[_0x2997('0x68')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x7e0b=['DESC','subqry.','from','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','t.id\x20IN\x20?','query','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','fax','email','CompanyId','createdAt','updatedAt','TagIds','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','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.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','value','Tag','map','tags','clause','and','ids','User','user','skip','some','compact','Contact','c.ListId\x20IN\x20?','concat','uc.UserId\x20=\x20?','\x20=\x20?','then','tag','filter','resolve','search','getLists','c.ListId\x20IS\x20NULL','group','c.id','limit','offset','subqry.id','having','order'];(function(_0x21a3f4,_0x2e50c3){var _0xbddcdd=function(_0x704dcc){while(--_0x704dcc){_0x21a3f4['push'](_0x21a3f4['shift']());}};_0xbddcdd(++_0x2e50c3);}(_0x7e0b,0xed));var _0xb7e0=function(_0x446e3b,_0x4a297a){_0x446e3b=_0x446e3b-0x0;var _0x46e6e8=_0x7e0b[_0x446e3b];return _0x46e6e8;};'use strict';var _=require(_0xb7e0('0x0'));var squel=require(_0xb7e0('0x1'));var as=require(_0xb7e0('0x2'));var qs=require(_0xb7e0('0x3'));var utils=require(_0xb7e0('0x4'));var db=require(_0xb7e0('0x5'))['db'];function skipContactsQuery(_0x4fc93f,_0x2ad271){var _0x395117=![];if(_0x4fc93f['role']===_0xb7e0('0x6')&&!_0x2ad271['search']&&!_0x2ad271[_0xb7e0('0x7')]&&_0x2ad271[_0xb7e0('0x8')]!==_0xb7e0('0x9')){_0x395117=!![];}return _0x395117;}function getContactsSubquery(){return squel[_0xb7e0('0xa')]()['from'](_0xb7e0('0xb'),'c')[_0xb7e0('0xc')](_0xb7e0('0xd'));}function applyJoinClauses(_0x3845a2,_0x330af9){var _0x4f94f0=_0x330af9?'c':_0xb7e0('0xe');_0x3845a2[_0xb7e0('0xf')](_0xb7e0('0x10'),'uc',_0xb7e0('0x11')+_0x4f94f0+_0xb7e0('0x12'))[_0xb7e0('0xf')]('cm_contact_has_tags','ct',_0xb7e0('0x13')+_0x4f94f0+'.id')[_0xb7e0('0xf')](_0xb7e0('0x14'),'t',_0xb7e0('0x15'));return _0x3845a2;}function addFieldsToQuery(_0x17396b,_0x34852e,_0x17be8e,_0x18ac70,_0x244771){var _0x13eb12=_0x244771?'c':_0xb7e0('0xe');if(!_0x34852e){_0x34852e=['id','firstName',_0xb7e0('0x16'),_0xb7e0('0x17'),'mobile',_0xb7e0('0x18'),_0xb7e0('0x19'),_0xb7e0('0x7'),_0xb7e0('0x1a'),_0xb7e0('0x1b'),_0xb7e0('0x1c'),'deletedAt',_0xb7e0('0x1d')];}else if(!_0x34852e['includes']('id')){_0x34852e[_0xb7e0('0x1e')]('id');}var _0x26eaba=_0x17be8e&&_0x244771||!_0x17be8e&&!_0x244771;if(_0x18ac70){_0x26eaba=_0x18ac70&&_0x244771||!_0x18ac70&&!_0x244771;}_0x34852e[_0xb7e0('0x1f')](function(_0x308c87){if(_0x308c87===_0xb7e0('0x1d')){if(_0x26eaba){_0x17396b['field'](_0xb7e0('0x20'),_0x308c87);}else if(_0x17be8e||_0x18ac70){_0x17396b[_0xb7e0('0x21')](_0x13eb12+'.'+_0x308c87);}}else{_0x17396b[_0xb7e0('0x21')](_0x13eb12+'.'+_0x308c87);}});return _0x17396b;}function getSqlClauses(){var _0x3bea12={'default':squel['expr'](),'fields':squel[_0xb7e0('0x22')](),'filter':squel[_0xb7e0('0x22')](),'tags':{'clause':squel[_0xb7e0('0x22')](),'ids':null},'user':{'clause':squel[_0xb7e0('0x22')](),'skip':![]}};return _0x3bea12;}function parseTagParameter(_0x12af97){var _0x3340a9=squel[_0xb7e0('0x22')]();if(_0x12af97){var _0xf943ef=utils[_0xb7e0('0x23')](_0x12af97);_0xf943ef[_0xb7e0('0x1f')](function(_0x5d391a){_0x3340a9['or'](_0xb7e0('0x24'),'%,'+_0x5d391a+',%');});}return _0x3340a9;}function parseSearchFilter(_0x8acefd){var _0x3fc185=squel[_0xb7e0('0x22')]();if(_0x8acefd){var _0x3d4485=_0x8acefd[_0xb7e0('0x25')]('\x5c','\x5c\x5c')[_0xb7e0('0x25')](/'/g,'\x27\x27');if(_0x3d4485[_0xb7e0('0x26')]('\x20')[_0xb7e0('0x27')]>0x1){_0x3fc185['or'](_0xb7e0('0x28'),qs['getFullTextValue'](_0x3d4485,!![]),null);}else{if(qs[_0xb7e0('0x29')](_0x3d4485)){_0x3fc185['or'](_0xb7e0('0x2a'),_0x3d4485+'%');_0x3fc185['or'](_0xb7e0('0x2b'),_0x3d4485+'%');_0x3fc185['or'](_0xb7e0('0x2c'),_0x3d4485+'%');_0x3fc185['or'](_0xb7e0('0x2d'),_0x3d4485+'%');}else if(qs[_0xb7e0('0x2e')](_0x3d4485)){_0x3fc185['or']('c.email\x20LIKE\x20?',_0x3d4485+'%');}else{_0x3fc185['or'](_0xb7e0('0x2f'),'%'+_0x3d4485+'%');_0x3fc185['or'](_0xb7e0('0x30'),'%'+_0x3d4485+'%');_0x3fc185['or'](_0xb7e0('0x31'),'%'+_0x3d4485+'%');}}}return _0x3fc185;}function parseAdvancedSearchFilter(_0x58c048,_0x52c0c0){var _0x2c9bd6=getSqlClauses();var _0x26dc5d=as[_0xb7e0('0x32')](_0x58c048);var _0x70b911=_0x26dc5d[_0xb7e0('0x33')];for(var _0x8df328=0x0;_0x8df328<_0x26dc5d['conditions']['length'];_0x8df328++){var _0x2b9592=_0x26dc5d[_0xb7e0('0x34')][_0x8df328];var _0x2a021c='c';var _0x558ce8=_[_0xb7e0('0x35')](_0x52c0c0,[_0xb7e0('0x36'),_0x2b9592[_0xb7e0('0x21')]]);if(_0x558ce8){if(_0x2b9592['field']===_0xb7e0('0x37')||_0x558ce8['fieldType']===_0xb7e0('0x38')){_0x2b9592[_0xb7e0('0x39')]=_0xb7e0('0x3a');}var _0x3a7172=as[_0xb7e0('0x3b')](_0x2a021c,_0x558ce8[_0xb7e0('0x3c')],_0x2b9592);_0x2c9bd6['default'][_0x70b911](_0x3a7172[_0xb7e0('0x3d')],_0x3a7172[_0xb7e0('0x3e')]['start'],_0x3a7172[_0xb7e0('0x3e')]['end']);}else{if(_0x2b9592[_0xb7e0('0x21')]===_0xb7e0('0x3f')){var _0x1a9c97=_0x2b9592[_0xb7e0('0x3e')][_0xb7e0('0x26')](',')[_0xb7e0('0x40')](function(_0x2109c0){return Number(_0x2109c0);});var _0x9ca954=parseTagParameter(_0x1a9c97);_0x2c9bd6[_0xb7e0('0x41')][_0xb7e0('0x42')][_0xb7e0('0x43')](_0x9ca954);_0x2c9bd6['tags'][_0xb7e0('0x44')]=_0x1a9c97;}else if(_0x2b9592['field']===_0xb7e0('0x45')){_0x2c9bd6[_0xb7e0('0x46')][_0xb7e0('0x42')][_0xb7e0('0x43')]('uc.UserId\x20=\x20?',_0x2b9592[_0xb7e0('0x3e')]);_0x2c9bd6[_0xb7e0('0x46')][_0xb7e0('0x47')]=!![];}}}return _0x2c9bd6;}function parseModelFields(_0x273144,_0x51fbd2){var _0x14c203=squel[_0xb7e0('0x22')]();var _0x42ef4e=_(_0x273144)['keys']()['map'](function(_0x3a3b68){return _[_0xb7e0('0x48')](_0x51fbd2,[_0xb7e0('0x36'),_0x3a3b68])?_0x3a3b68:undefined;})[_0xb7e0('0x49')]()['value']();if(_0x273144[_0xb7e0('0x4a')]){_0x42ef4e['push']('Contact');}if(_0x273144['User']){_0x42ef4e['push'](_0xb7e0('0x45'));}if(_0x42ef4e[_0xb7e0('0x27')]>0x0){_0x42ef4e['forEach'](function(_0x481702){if(_0x481702===_0xb7e0('0x7')){_0x14c203[_0xb7e0('0x43')](_0xb7e0('0x4b'),[][_0xb7e0('0x4c')](_0x273144[_0x481702]));}else if(_0x481702===_0xb7e0('0x4a')){var _0x4015e8='%'+_0x273144[_0x481702]+'%';_0x14c203[_0xb7e0('0x43')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4015e8);}else if(_0x481702==='User'){_0x14c203[_0xb7e0('0x43')](_0xb7e0('0x4d'),_0x273144[_0x481702]);}else{_0x14c203[_0xb7e0('0x43')]('c.'+_0x481702+_0xb7e0('0x4e'),_0x273144[_0x481702]);}});}return _0x14c203;}function parseQueryParameters(_0x17464a,_0x401071){var _0xaad265=getSqlClauses();return Promise['resolve']()[_0xb7e0('0x4f')](function(){return parseModelFields(_0x17464a,_0x401071);})[_0xb7e0('0x4f')](function(_0x5aafa2){_0xaad265['fields'][_0xb7e0('0x43')](_0x5aafa2);return parseTagParameter(_0x17464a[_0xb7e0('0x50')]);})[_0xb7e0('0x4f')](function(_0x1536f5){_0xaad265[_0xb7e0('0x41')][_0xb7e0('0x42')][_0xb7e0('0x43')](_0x1536f5);return parseSearchFilter(_0x17464a[_0xb7e0('0x51')]);})[_0xb7e0('0x4f')](function(_0x70fcc7){_0xaad265[_0xb7e0('0x51')]=_0x70fcc7;return _0xaad265;});}function checkListsRestrictions(_0x19f15c,_0x339af3,_0x2bbe81){var _0x426931=squel[_0xb7e0('0x22')]();return Promise[_0xb7e0('0x52')]()[_0xb7e0('0x4f')](function(){if(_0x339af3[_0xb7e0('0x53')]&&_0x19f15c['role']===_0xb7e0('0x6')&&!_0x2bbe81){return _0x19f15c[_0xb7e0('0x54')]({'attributes':['id'],'raw':!![]});}})[_0xb7e0('0x4f')](function(_0x2dde83){if(_0x2dde83){if(_0x2dde83[_0xb7e0('0x27')]===0x0){_0x426931['and'](_0xb7e0('0x55'));}else{_0x426931[_0xb7e0('0x43')](_0xb7e0('0x4b'),_[_0xb7e0('0x40')](_0x2dde83,'id'));}}})['then'](function(){return _0x426931;});}function buildContactsQuery(_0x54b2fb,_0x373ba2,_0x564219,_0x2f02,_0x57e187,_0x2bb1c8){if(_0x373ba2){_0x373ba2=_0x564219['attributes'];}_0x54b2fb=addFieldsToQuery(_0x54b2fb,_0x373ba2,_0x2f02,_0x2bb1c8,!![]);var _0x46cc84=squel['select']();_0x46cc84=addFieldsToQuery(_0x46cc84,_0x373ba2,_0x2f02,_0x2bb1c8,![]);if(_0x2f02||_0x2bb1c8){_0x54b2fb=applyJoinClauses(_0x54b2fb,!![]);_0x54b2fb[_0xb7e0('0x56')](_0xb7e0('0x57'));if(_0x564219['limit']){_0x46cc84[_0xb7e0('0x58')](_0x564219[_0xb7e0('0x58')]);}if(_0x564219[_0xb7e0('0x59')]){_0x46cc84[_0xb7e0('0x59')](_0x564219[_0xb7e0('0x59')]);}}else{_0x46cc84=applyJoinClauses(_0x46cc84,![]);_0x46cc84['group'](_0xb7e0('0x5a'));if(_0x564219[_0xb7e0('0x58')]){_0x54b2fb[_0xb7e0('0x58')](_0x564219[_0xb7e0('0x58')]);}if(_0x564219['offset']){_0x54b2fb[_0xb7e0('0x59')](_0x564219['offset']);}}_0x46cc84[_0xb7e0('0x5b')](_0x57e187);if(_0x564219[_0xb7e0('0x5c')]){_0x564219[_0xb7e0('0x5c')]['forEach'](function(_0x677674){_0x54b2fb[_0xb7e0('0x5c')]('c.'+_0x677674[0x0],_0x677674[0x1]===_0xb7e0('0x5d')?![]:!![]);_0x46cc84[_0xb7e0('0x5c')](_0xb7e0('0x5e')+_0x677674[0x0],_0x677674[0x1]===_0xb7e0('0x5d')?![]:!![]);});}_0x46cc84[_0xb7e0('0x5f')](_0x54b2fb,'subqry');return _0x46cc84;}function getFilteredContacts(_0x438869){var _0x1b17ee=[];return db['Tag']['findAll']({'attributes':['id',_0xb7e0('0x36'),_0xb7e0('0x60')],'raw':!![]})[_0xb7e0('0x4f')](function(_0x3bf582){_0x1b17ee=_[_0xb7e0('0x61')](_0x3bf582,'id');var _0x5c6fd4={'type':db[_0xb7e0('0x62')][_0xb7e0('0x63')][_0xb7e0('0x64')],'model':db[_0xb7e0('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xb7e0('0x66')]['query'](_0x438869[_0xb7e0('0x67')](),_0x5c6fd4);})[_0xb7e0('0x4f')](function(_0x1bc6bc){_0x1bc6bc[_0xb7e0('0x1f')](function(_0x34b4b9){if(_0x34b4b9[_0xb7e0('0x1d')]){_0x34b4b9[_0xb7e0('0x68')]=[];_0x34b4b9[_0xb7e0('0x1d')]['split'](',')[_0xb7e0('0x1f')](function(_0x26b521){_0x34b4b9['Tags'][_0xb7e0('0x1e')](_0x1b17ee[_0x26b521]);});}delete _0x34b4b9[_0xb7e0('0x1d')];});return _0x1bc6bc;});}function countFilteredContacts(_0x3dc5a1,_0x161ae4){var _0x41a6c5=_0x3dc5a1[_0xb7e0('0x69')]();_0x41a6c5['field']('COUNT(*)');_0x41a6c5=applyJoinClauses(_0x41a6c5,!![]);_0x3dc5a1[_0xb7e0('0x56')]('c.id');var _0x1c3869=utils[_0xb7e0('0x23')](_0x161ae4);if(!_['isEmpty'](_0x1c3869)){_0x41a6c5[_0xb7e0('0xc')](_0xb7e0('0x6a'),_0x1c3869);}var _0x1b29ea={'type':db['Sequelize'][_0xb7e0('0x63')][_0xb7e0('0x64')],'raw':!![]};return db[_0xb7e0('0x66')][_0xb7e0('0x6b')](_0x41a6c5[_0xb7e0('0x67')](),_0x1b29ea)[_0xb7e0('0x4f')](function(_0x28089a){return _0x28089a[0x0][_0xb7e0('0x6c')];});}module[_0xb7e0('0x6d')]={'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 29af737..9d7e04d 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 _0xe96e=['final','close','unlink','decryptFile','createWriteStream','createDecipher','encryptString','secret','base64','decryptString','utf8','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','encryptFile','createReadStream','createCipher','data','update','binary','write','end'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xe96e,0x146));var _0xee96=function(_0x940cb5,_0x5836ab){_0x940cb5=_0x940cb5-0x0;var _0x4d1e99=_0xe96e[_0x940cb5];return _0x4d1e99;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xee96('0x0'));var config=require(_0xee96('0x1'));var logger=require(_0xee96('0x2'))(_0xee96('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xee96('0x4')][_0xee96('0x5')],'algorithm':_0xee96('0x6')};const fileOptions={'algorithm':_0xee96('0x7')};if(config[_0xee96('0x8')]&&config['encrypt'][_0xee96('0x9')]){var isSupported=isAlgorithmSupported(config[_0xee96('0x8')]['algorithm']);if(isSupported){fileOptions[_0xee96('0x9')]=config[_0xee96('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xee96('0xa')](',\x20');logger['error'](config[_0xee96('0x8')][_0xee96('0x9')],_0xee96('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x6855ba){return AES_SUPPORTED_RX[_0xee96('0xc')](_0x6855ba);}function getSupportedCiphers(){return crypto[_0xee96('0xd')]()[_0xee96('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x274fa9){return getSupportedCiphers()[_0xee96('0xf')](_0x274fa9)>-0x1;}function combineOptions(_0x3b49cc){var _0x33e4af={};for(var _0x50e519 in fileOptions){if(fileOptions['hasOwnProperty'](_0x50e519)){_0x33e4af[_0x50e519]=fileOptions[_0x50e519];}}if(_0x3b49cc){for(var _0x5cd08b in _0x3b49cc){if(_0x3b49cc['hasOwnProperty'](_0x5cd08b)){_0x33e4af[_0x5cd08b]=_0x3b49cc[_0x5cd08b];}}}return _0x33e4af;}exports[_0xee96('0x10')]=function(_0x54daff,_0x359a37,_0x280d9f,_0x945b8e){return new BPromise(function(_0x3390ce,_0xde018b){_0x945b8e=combineOptions(_0x945b8e);var _0x376684=new Buffer(_0x280d9f);var _0x539d01=fs[_0xee96('0x11')](_0x54daff);var _0x3e481d=fs['createWriteStream'](_0x359a37);var _0x50ae49=crypto[_0xee96('0x12')](_0x945b8e[_0xee96('0x9')],_0x376684);_0x539d01['on'](_0xee96('0x13'),function(_0x54e7ec){var _0x1aae11=new Buffer(_0x50ae49[_0xee96('0x14')](_0x54e7ec),_0xee96('0x15'));_0x3e481d[_0xee96('0x16')](_0x1aae11);});_0x539d01['on'](_0xee96('0x17'),function(){try{var _0x673997=new Buffer(_0x50ae49[_0xee96('0x18')](_0xee96('0x15')),_0xee96('0x15'));_0x3e481d[_0xee96('0x16')](_0x673997);_0x3e481d[_0xee96('0x17')]();_0x3e481d['on'](_0xee96('0x19'),function(){return _0x3390ce(_0x359a37);});}catch(_0x4cf29b){fs[_0xee96('0x1a')](_0x359a37);return _0xde018b(_0x4cf29b);}});});};exports[_0xee96('0x1b')]=function(_0x6918be,_0x4b6953,_0x178bcf,_0x12c1b1){return new BPromise(function(_0x4f8c5b,_0x35cff4){_0x12c1b1=combineOptions(_0x12c1b1);var _0x35057d=new Buffer(_0x178bcf);var _0x5be4dd=fs['createReadStream'](_0x6918be);var _0x1b0496=fs[_0xee96('0x1c')](_0x4b6953);var _0x6146f0=crypto[_0xee96('0x1d')](_0x12c1b1[_0xee96('0x9')],_0x35057d);_0x5be4dd['on'](_0xee96('0x13'),function(_0x5c9e05){var _0x48af47=new Buffer(_0x6146f0['update'](_0x5c9e05),_0xee96('0x15'));_0x1b0496[_0xee96('0x16')](_0x48af47);});_0x5be4dd['on'](_0xee96('0x17'),function(){try{var _0x5ab2c8=new Buffer(_0x6146f0[_0xee96('0x18')]('binary'),_0xee96('0x15'));_0x1b0496[_0xee96('0x16')](_0x5ab2c8);_0x1b0496[_0xee96('0x17')]();_0x1b0496['on']('close',function(){return _0x4f8c5b(_0x4b6953);});}catch(_0x356b50){fs[_0xee96('0x1a')](_0x4b6953);return _0x35cff4(_0x356b50);}});});};exports[_0xee96('0x1e')]=function(_0x26728e,_0x2fa913,_0x147859){var _0x1f9cee=_0x147859||stringOptions[_0xee96('0x9')];var _0x3f9552=_0x2fa913||stringOptions[_0xee96('0x1f')];var _0x2c4224=crypto[_0xee96('0x12')](_0x1f9cee,_0x3f9552);var _0x2775bb=_0x2c4224[_0xee96('0x14')](_0x26728e,'utf8',_0xee96('0x20'));_0x2775bb+=_0x2c4224[_0xee96('0x18')](_0xee96('0x20'));return _0x2775bb;};exports[_0xee96('0x21')]=function(_0x36ebf8,_0x444f06,_0x1bcef9){var _0x32eea2=_0x1bcef9||stringOptions['algorithm'];var _0xa2bfd5=_0x444f06||stringOptions[_0xee96('0x1f')];var _0x4e9e99=crypto[_0xee96('0x1d')](_0x32eea2,_0xa2bfd5);var _0x3863da=_0x4e9e99[_0xee96('0x14')](_0x36ebf8,_0xee96('0x20'),_0xee96('0x22'));_0x3863da+=_0x4e9e99[_0xee96('0x18')](_0xee96('0x22'));return _0x3863da;}; \ No newline at end of file +var _0x2b3c=['encryptString','secret','utf8','base64','decryptString','bluebird','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','encryptFile','createWriteStream','createCipher','update','binary','write','end','final','close','unlink','createReadStream','createDecipher'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2b3c,0x81));var _0xc2b3=function(_0x4ff1bb,_0x5dd9b6){_0x4ff1bb=_0x4ff1bb-0x0;var _0x22de66=_0x2b3c[_0x4ff1bb];return _0x22de66;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc2b3('0x0'));var _=require('lodash');var config=require(_0xc2b3('0x1'));var logger=require(_0xc2b3('0x2'))(_0xc2b3('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc2b3('0x4')]['session'],'algorithm':_0xc2b3('0x5')};const fileOptions={'algorithm':_0xc2b3('0x6')};if(config[_0xc2b3('0x7')]&&config[_0xc2b3('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc2b3('0x7')][_0xc2b3('0x8')]);if(isSupported){fileOptions[_0xc2b3('0x8')]=config[_0xc2b3('0x7')][_0xc2b3('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xc2b3('0x9')](config[_0xc2b3('0x7')]['algorithm'],_0xc2b3('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x59bc01){return AES_SUPPORTED_RX[_0xc2b3('0xb')](_0x59bc01);}function getSupportedCiphers(){return crypto[_0xc2b3('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x291aa8){return getSupportedCiphers()[_0xc2b3('0xd')](_0x291aa8)>-0x1;}function combineOptions(_0x4149cb){var _0x5dd2e4={};for(var _0x3ed265 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3ed265)){_0x5dd2e4[_0x3ed265]=fileOptions[_0x3ed265];}}if(_0x4149cb){for(var _0x298c7d in _0x4149cb){if(_0x4149cb['hasOwnProperty'](_0x298c7d)){_0x5dd2e4[_0x298c7d]=_0x4149cb[_0x298c7d];}}}return _0x5dd2e4;}exports[_0xc2b3('0xe')]=function(_0x298194,_0x2577f3,_0x4f886b,_0xd4c2a9){return new BPromise(function(_0x38a33e,_0x4e7604){_0xd4c2a9=combineOptions(_0xd4c2a9);var _0x5c2c46=new Buffer(_0x4f886b);var _0x479737=fs['createReadStream'](_0x298194);var _0x3d8c74=fs[_0xc2b3('0xf')](_0x2577f3);var _0x4ba6c8=crypto[_0xc2b3('0x10')](_0xd4c2a9['algorithm'],_0x5c2c46);_0x479737['on']('data',function(_0x3d7011){var _0x540fbd=new Buffer(_0x4ba6c8[_0xc2b3('0x11')](_0x3d7011),_0xc2b3('0x12'));_0x3d8c74[_0xc2b3('0x13')](_0x540fbd);});_0x479737['on'](_0xc2b3('0x14'),function(){try{var _0x11ebef=new Buffer(_0x4ba6c8[_0xc2b3('0x15')](_0xc2b3('0x12')),_0xc2b3('0x12'));_0x3d8c74[_0xc2b3('0x13')](_0x11ebef);_0x3d8c74['end']();_0x3d8c74['on'](_0xc2b3('0x16'),function(){return _0x38a33e(_0x2577f3);});}catch(_0x5d28f0){fs[_0xc2b3('0x17')](_0x2577f3);return _0x4e7604(_0x5d28f0);}});});};exports['decryptFile']=function(_0x3c0e9f,_0x4a7602,_0x5c7c40,_0x46bcc7){return new BPromise(function(_0x2a4fba,_0x45c6bc){_0x46bcc7=combineOptions(_0x46bcc7);var _0x5eff15=new Buffer(_0x5c7c40);var _0x77774f=fs[_0xc2b3('0x18')](_0x3c0e9f);var _0x1d4713=fs[_0xc2b3('0xf')](_0x4a7602);var _0x2e9642=crypto[_0xc2b3('0x19')](_0x46bcc7[_0xc2b3('0x8')],_0x5eff15);_0x77774f['on']('data',function(_0x12cabb){var _0x1ae55d=new Buffer(_0x2e9642[_0xc2b3('0x11')](_0x12cabb),'binary');_0x1d4713['write'](_0x1ae55d);});_0x77774f['on'](_0xc2b3('0x14'),function(){try{var _0x3f425d=new Buffer(_0x2e9642[_0xc2b3('0x15')](_0xc2b3('0x12')),_0xc2b3('0x12'));_0x1d4713[_0xc2b3('0x13')](_0x3f425d);_0x1d4713[_0xc2b3('0x14')]();_0x1d4713['on'](_0xc2b3('0x16'),function(){return _0x2a4fba(_0x4a7602);});}catch(_0x1dce53){fs[_0xc2b3('0x17')](_0x4a7602);return _0x45c6bc(_0x1dce53);}});});};exports[_0xc2b3('0x1a')]=function(_0x312e3c,_0xea5192,_0x26a724){var _0x5e85b7=_0x26a724||stringOptions[_0xc2b3('0x8')];var _0x47753d=_0xea5192||stringOptions[_0xc2b3('0x1b')];var _0x228d33=crypto['createCipher'](_0x5e85b7,_0x47753d);var _0xb05881=_0x228d33['update'](_0x312e3c,_0xc2b3('0x1c'),'base64');_0xb05881+=_0x228d33['final'](_0xc2b3('0x1d'));return _0xb05881;};exports[_0xc2b3('0x1e')]=function(_0x29ac21,_0x15f354,_0x17e309){var _0x4a4390=_0x17e309||stringOptions[_0xc2b3('0x8')];var _0x441dda=_0x15f354||stringOptions['secret'];var _0x398521=crypto[_0xc2b3('0x19')](_0x4a4390,_0x441dda);var _0x55df31=_0x398521[_0xc2b3('0x11')](_0x29ac21,_0xc2b3('0x1d'),_0xc2b3('0x1c'));_0x55df31+=_0x398521[_0xc2b3('0x15')]('utf8');return _0x55df31;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c7de07d..7debd92 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 _0xfb8b=['length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.csv','join','mkdirSync','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfb8b,0x124));var _0xbfb8=function(_0x45072a,_0x1aaec4){_0x45072a=_0x45072a-0x0;var _0x3e4c64=_0xfb8b[_0x45072a];return _0x3e4c64;};'use strict';var util=require(_0xbfb8('0x0'));var path=require(_0xbfb8('0x1'));var _=require(_0xbfb8('0x2'));var csv=require(_0xbfb8('0x3'));var fs=require('fs');var BPromise=require(_0xbfb8('0x4'));var zipdir=require(_0xbfb8('0x5'));var rimraf=require(_0xbfb8('0x6'));var db=require(_0xbfb8('0x7'))['db'];var dbH=require(_0xbfb8('0x7'))[_0xbfb8('0x8')];var logger=require('../../config/logger')(_0xbfb8('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbfb8('0xa')][0x3];var PATH=process[_0xbfb8('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x50967d,_0x1051e8){var _0x43b903={'status':_0x50967d};var _0x810037={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1051e8){_0x43b903['savename']=_0x1051e8;}return db[_0xbfb8('0xb')][_0xbfb8('0xc')](_0x43b903,_0x810037);}function main(){var _0xce232b=0x1388;var _0x13aaa4;logger['info'](util[_0xbfb8('0xd')](_0xbfb8('0xe'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')));return db[_0xbfb8('0x10')][_0xbfb8('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbfb8('0x12'),_0xbfb8('0x13')]})[_0xbfb8('0x14')](function(_0x4ce9b9){if(_0x4ce9b9){_0x13aaa4=_0x4ce9b9;_0xce232b=_0x13aaa4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')](_0xbfb8('0x17'),QUERY),{'type':dbH[_0xbfb8('0x15')]['QueryTypes']['SELECT']});})[_0xbfb8('0x14')](function(_0x1a354a){if(!_0x1a354a[0x0][_0xbfb8('0x18')]){return analyticExtractedReport(_0xbfb8('0x19'));}var _0xc912a5=[];var _0x4bf17a=0x0;if(_0x13aaa4['split']){if(_0x1a354a&&_0x1a354a[_0xbfb8('0x1a')]){var _0x4e222e=_[_0xbfb8('0x1b')](_0x1a354a[0x0][_0xbfb8('0x18')]/_0xce232b);var _0x3a77fe=Number[_0xbfb8('0x1c')](_0x1a354a[0x0]['num']/_0xce232b)?_0x1a354a[0x0][_0xbfb8('0x18')]%_0xce232b:0x0;_0x4e222e[_0xbfb8('0x1d')](function(_0x4cbbcd){if(_0x4cbbcd>0x0){_0x4bf17a+=_0xce232b;}_0xc912a5[_0xbfb8('0x1e')](dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')](_0xbfb8('0x1f'),QUERY,_0xce232b,_0x4bf17a),{'type':dbH[_0xbfb8('0x15')]['QueryTypes'][_0xbfb8('0x20')]}));});if(_0x3a77fe>0x0){_0x4bf17a+=_0xce232b;_0xc912a5['push'](dbH[_0xbfb8('0x15')][_0xbfb8('0x16')](util[_0xbfb8('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3a77fe,_0x4bf17a),{'type':dbH[_0xbfb8('0x15')][_0xbfb8('0x21')]['SELECT']}));}}}else{_0xc912a5[_0xbfb8('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xbfb8('0x20')]}));}var _0x16f25c=path[_0xbfb8('0x22')](PATH);var _0x1de36e=path[_0xbfb8('0x23')](PATH,_0xbfb8('0x24'));var _0x434aa9=_0x13aaa4[_0xbfb8('0x12')]&&_0xc912a5[_0xbfb8('0x1a')]>0x1;var _0x5e4b16=[];if(!fs['existsSync'](path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e))&&_0x434aa9){fs[_0xbfb8('0x26')](path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e));}return BPromise['each'](_0xc912a5,function(_0x5d1c44){_0x5e4b16[_0xbfb8('0x1e')](_0x5d1c44);})[_0xbfb8('0x14')](function(){for(var _0x2a70ba=0x0;_0x2a70ba<_0x5e4b16[_0xbfb8('0x1a')];_0x2a70ba+=0x1){var _0x2a5ef1;var _0x2d4b1f=_0x5e4b16[_0x2a70ba];if(_0x434aa9){_0x2a5ef1=path['join'](_0x16f25c,_0x1de36e,util['format'](_0xbfb8('0x27'),_0x1de36e,_0x2a70ba,_0xbfb8('0x28')));}else{_0x2a5ef1=path[_0xbfb8('0x25')](_0x16f25c,util[_0xbfb8('0xd')]('%s.%s',_0x1de36e,_0xbfb8('0x28')));}fs[_0xbfb8('0x29')](_0x2a5ef1,csv(_0x2d4b1f));}})['then'](function(){if(_0x434aa9){return new Promise(function(_0x48b387){zipdir(path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e),{'saveTo':path[_0xbfb8('0x25')](_0x16f25c,util[_0xbfb8('0xd')](_0xbfb8('0x2a'),_0x1de36e,_0xbfb8('0x2b')))},function(_0x14567d,_0x304047){rimraf(path[_0xbfb8('0x25')](_0x16f25c,_0x1de36e),function(){});_0x48b387(_0xbfb8('0x2c'));});});}})[_0xbfb8('0x14')](function(){logger['info'](util[_0xbfb8('0xd')](_0xbfb8('0x2d'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')));return analyticExtractedReport('Completed',_0x434aa9?util[_0xbfb8('0xd')](_0xbfb8('0x2a'),_0x1de36e,_0x434aa9?_0xbfb8('0x2b'):_0xbfb8('0x28')):null);});})[_0xbfb8('0x2e')](function(_0x3b5799){logger[_0xbfb8('0x2f')](util[_0xbfb8('0xd')](_0xbfb8('0x30'),EXTRACTED_REPORT_ID,_0xbfb8('0xf')),util[_0xbfb8('0x31')](_0x3b5799,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbfb8('0x32'));})[_0xbfb8('0x33')](function(){process[_0xbfb8('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x69a4=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x53d1eb,_0x34354e){var _0x409880=function(_0x58868d){while(--_0x58868d){_0x53d1eb['push'](_0x53d1eb['shift']());}};_0x409880(++_0x34354e);}(_0x69a4,0x1c1));var _0x469a=function(_0xfe8969,_0xf652a5){_0xfe8969=_0xfe8969-0x0;var _0x1b2f5b=_0x69a4[_0xfe8969];return _0x1b2f5b;};'use strict';var util=require(_0x469a('0x0'));var path=require(_0x469a('0x1'));var _=require(_0x469a('0x2'));var csv=require(_0x469a('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x469a('0x4'));var rimraf=require('rimraf');var db=require(_0x469a('0x5'))['db'];var dbH=require(_0x469a('0x5'))[_0x469a('0x6')];var logger=require(_0x469a('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x469a('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x12e8f5,_0x49f5c5){var _0x388b2c={'status':_0x12e8f5};var _0x2203be={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49f5c5){_0x388b2c[_0x469a('0x9')]=_0x49f5c5;}return db[_0x469a('0xa')][_0x469a('0xb')](_0x388b2c,_0x2203be);}function main(){var _0x51ced8=0x1388;var _0x2f5570;logger['info'](util[_0x469a('0xc')](_0x469a('0xd'),EXTRACTED_REPORT_ID,_0x469a('0xe')));return db[_0x469a('0xf')][_0x469a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x469a('0x11'),_0x469a('0x12')]})['then'](function(_0x59e507){if(_0x59e507){_0x2f5570=_0x59e507;_0x51ced8=_0x2f5570[_0x469a('0x12')]||0x1388;}})[_0x469a('0x13')](function(){return dbH[_0x469a('0x14')][_0x469a('0x15')](util[_0x469a('0xc')](_0x469a('0x16'),QUERY),{'type':dbH[_0x469a('0x14')][_0x469a('0x17')][_0x469a('0x18')]});})[_0x469a('0x13')](function(_0x4dea34){if(!_0x4dea34[0x0][_0x469a('0x19')]){return analyticExtractedReport('Empty');}var _0x591b9c=[];var _0x23d055=0x0;if(_0x2f5570[_0x469a('0x11')]){if(_0x4dea34&&_0x4dea34[_0x469a('0x1a')]){var _0x54fe86=_[_0x469a('0x1b')](_0x4dea34[0x0][_0x469a('0x19')]/_0x51ced8);var _0x4f58be=Number['isInteger'](_0x4dea34[0x0]['num']/_0x51ced8)?_0x4dea34[0x0]['num']%_0x51ced8:0x0;_0x54fe86[_0x469a('0x1c')](function(_0x1ac2e7){if(_0x1ac2e7>0x0){_0x23d055+=_0x51ced8;}_0x591b9c[_0x469a('0x1d')](dbH[_0x469a('0x14')]['query'](util['format'](_0x469a('0x1e'),QUERY,_0x51ced8,_0x23d055),{'type':dbH['sequelize'][_0x469a('0x17')][_0x469a('0x18')]}));});if(_0x4f58be>0x0){_0x23d055+=_0x51ced8;_0x591b9c[_0x469a('0x1d')](dbH['sequelize'][_0x469a('0x15')](util[_0x469a('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f58be,_0x23d055),{'type':dbH['sequelize'][_0x469a('0x17')]['SELECT']}));}}}else{_0x591b9c[_0x469a('0x1d')](dbH['sequelize'][_0x469a('0x15')](QUERY,{'type':dbH[_0x469a('0x14')][_0x469a('0x17')][_0x469a('0x18')]}));}var _0x3dab5c=path[_0x469a('0x1f')](PATH);var _0x40f88f=path['basename'](PATH,_0x469a('0x20'));var _0x1d911b=_0x2f5570[_0x469a('0x11')]&&_0x591b9c[_0x469a('0x1a')]>0x1;var _0x493d56=[];if(!fs[_0x469a('0x21')](path[_0x469a('0x22')](_0x3dab5c,_0x40f88f))&&_0x1d911b){fs['mkdirSync'](path[_0x469a('0x22')](_0x3dab5c,_0x40f88f));}return BPromise[_0x469a('0x23')](_0x591b9c,function(_0x2e06df){_0x493d56[_0x469a('0x1d')](_0x2e06df);})['then'](function(){for(var _0x4e2ba6=0x0;_0x4e2ba6<_0x493d56[_0x469a('0x1a')];_0x4e2ba6+=0x1){var _0x33aba0;var _0x1291d1=_0x493d56[_0x4e2ba6];if(_0x1d911b){_0x33aba0=path[_0x469a('0x22')](_0x3dab5c,_0x40f88f,util[_0x469a('0xc')](_0x469a('0x24'),_0x40f88f,_0x4e2ba6,_0x469a('0x25')));}else{_0x33aba0=path[_0x469a('0x22')](_0x3dab5c,util['format'](_0x469a('0x26'),_0x40f88f,_0x469a('0x25')));}fs[_0x469a('0x27')](_0x33aba0,csv(_0x1291d1));}})[_0x469a('0x13')](function(){if(_0x1d911b){return new Promise(function(_0x39e29b){zipdir(path[_0x469a('0x22')](_0x3dab5c,_0x40f88f),{'saveTo':path[_0x469a('0x22')](_0x3dab5c,util[_0x469a('0xc')]('%s.%s',_0x40f88f,_0x469a('0x28')))},function(_0x512e8e,_0x1abc2f){rimraf(path[_0x469a('0x22')](_0x3dab5c,_0x40f88f),function(){});_0x39e29b(_0x469a('0x29'));});});}})[_0x469a('0x13')](function(){logger[_0x469a('0x2a')](util[_0x469a('0xc')](_0x469a('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x469a('0x2c'),_0x1d911b?util[_0x469a('0xc')](_0x469a('0x26'),_0x40f88f,_0x1d911b?_0x469a('0x28'):_0x469a('0x25')):null);});})['catch'](function(_0x51608c){logger[_0x469a('0x2a')](util[_0x469a('0xc')](_0x469a('0x2d'),EXTRACTED_REPORT_ID,_0x469a('0xe')),util[_0x469a('0x2e')](_0x51608c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x469a('0x2f')](function(){process[_0x469a('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ad6c0ae..ef1265d 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 _0x9ed4=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','createPdfFromHTML','createPdfKitDocument','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','toString','value','fill','body','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','splitSizePdf','then','split','length','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','each','flatten','%s%d.%s','pdf','all','join','%s.%s','zip','zip\x20finished'];(function(_0x2cea58,_0x153c15){var _0x192933=function(_0x4f1e9b){while(--_0x4f1e9b){_0x2cea58['push'](_0x2cea58['shift']());}};_0x192933(++_0x153c15);}(_0x9ed4,0x18b));var _0x49ed=function(_0x32f68b,_0x2733c6){_0x32f68b=_0x32f68b-0x0;var _0x9c007b=_0x9ed4[_0x32f68b];return _0x9c007b;};'use strict';var _=require(_0x49ed('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x49ed('0x1'));var moment=require(_0x49ed('0x2'));var htmlToPdfmake=require(_0x49ed('0x3'));var PdfPrinter=require(_0x49ed('0x4'));var zipdir=require(_0x49ed('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x49ed('0x6'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x49ed('0x7'));var db=require(_0x49ed('0x8'))['db'];var dbH=require(_0x49ed('0x8'))[_0x49ed('0x9')];var logger=require(_0x49ed('0xa'))(_0x49ed('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x49ed('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x49ed('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x49ed('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f9e59,_0x42024e){var _0x3f278c={'status':_0x2f9e59};var _0x22672d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x42024e){_0x3f278c['savename']=_0x42024e;}return db['AnalyticExtractedReport'][_0x49ed('0xe')](_0x3f278c,_0x22672d);}function getHeaders(_0x52c7fc){return _[_0x49ed('0xf')](_0x52c7fc,function(_0x2b3cca){return{'text':_0x2b3cca,'style':'tableHeader'};});}function getRows(_0x4f634,_0x3f9f8d){return _[_0x49ed('0xf')](_0x3f9f8d,function(_0x4ec1f1){return _(_0x4ec1f1)[_0x49ed('0x10')](_0x4f634)['map'](function(_0x5e8d21){return _0x5e8d21?_[_0x49ed('0x11')](_0x5e8d21):'';})[_0x49ed('0x12')]();});}function createTable(_0x433c07,_0x4c455e){var _0xbbd8b9={'widths':_[_0x49ed('0x13')](Array(_0x433c07['length']),0x91),'heights':function(_0x23ca9c){return _0x23ca9c===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x165950=getHeaders(_0x433c07);_0xbbd8b9[_0x49ed('0x14')]['push'](_0x165950);var _0x5a6050=getRows(_0x433c07,_0x4c455e);_0xbbd8b9[_0x49ed('0x14')]=_0xbbd8b9[_0x49ed('0x14')]['concat'](_0x5a6050);return _0xbbd8b9;}function createTables(_0x3917c1){var _0x583e56=[];var _0x155a14=_[_0x49ed('0x15')](Object[_0x49ed('0x16')](_0x3917c1[0x0]),0x5);_0x155a14[_0x49ed('0x17')](function(_0x1d90ae){_0x583e56[_0x49ed('0x18')](createTable(_0x1d90ae,_0x3917c1));});return _0x583e56;}function getPDFDocDefinition(_0x19c6a3){var _0x4f5d51=util[_0x49ed('0x19')](_0x49ed('0x1a'),NAME,EXTRACTED_REPORT[_0x49ed('0x1b')],moment(EXTRACTED_REPORT[_0x49ed('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x49ed('0x1d')])['format'](FORMAT));var _0x261209=[];for(var _0x2ffdba=0x0;_0x2ffdba<_0x19c6a3['length'];_0x2ffdba++){var _0x1fb5c8=[];if(_0x2ffdba===0x0){_0x1fb5c8[_0x49ed('0x18')]({'text':_0x4f5d51,'style':_0x49ed('0x1e')});}var _0x499967={'table':_0x19c6a3[_0x2ffdba]};if(_0x2ffdba>0x0){_0x499967[_0x49ed('0x1f')]='before';_0x499967[_0x49ed('0x20')]=[0x0,0x46,0x0,0x0];}_0x1fb5c8['push'](_0x499967);_0x261209['push'](_0x1fb5c8);}return{'pageSize':'A4','pageOrientation':_0x49ed('0x21'),'content':_0x261209,'footer':function(_0x426828,_0x41ec76){return{'text':_0x426828[_0x49ed('0x11')]()+_0x49ed('0x22')+_0x41ec76,'style':_0x49ed('0x23')};},'defaultStyle':{'font':_0x49ed('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x49ed('0x25')},'footer':{'alignment':_0x49ed('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x284042){var _0x683573=0x1388;var _0x2084c8;if(!_0x284042[0x0]['num']){return analyticExtractedReport(_0x49ed('0x27'));}return db[_0x49ed('0x28')][_0x49ed('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x49ed('0x2a')]})['then'](function(_0x307c62){if(_0x307c62){_0x2084c8=_0x307c62;_0x683573=_0x2084c8[_0x49ed('0x2a')]||0x3e8;}})[_0x49ed('0x2b')](function(){var _0x250e23=[];var _0x5ab7a6=0x0;if(_0x2084c8[_0x49ed('0x2c')]){if(_0x284042&&_0x284042[_0x49ed('0x2d')]){var _0xefb0f0=_['range'](_0x284042[0x0][_0x49ed('0x2e')]/_0x683573);var _0x2e3ca3=Number[_0x49ed('0x2f')](_0x284042[0x0]['num']/_0x683573)?_0x284042[0x0][_0x49ed('0x2e')]%_0x683573:0x0;_0xefb0f0[_0x49ed('0x17')](function(_0x4d5192){if(_0x4d5192>0x0){_0x5ab7a6+=_0x683573;}_0x250e23[_0x49ed('0x18')](dbH[_0x49ed('0x30')][_0x49ed('0x31')](util[_0x49ed('0x19')](_0x49ed('0x32'),QUERY,_0x683573,_0x5ab7a6),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]}));});if(_0x2e3ca3>0x0){_0x5ab7a6+=_0x683573;_0x250e23['push'](dbH[_0x49ed('0x30')][_0x49ed('0x31')](util[_0x49ed('0x19')](_0x49ed('0x32'),QUERY,_0x2e3ca3,_0x5ab7a6),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]}));}}}else{_0x250e23['push'](dbH[_0x49ed('0x30')][_0x49ed('0x31')](QUERY,{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')]['SELECT']}));}var _0x2928c1=path[_0x49ed('0x35')](PATH);var _0x284e99=path[_0x49ed('0x36')](PATH,'.pdf');var _0x3421a3=_0x2084c8[_0x49ed('0x2c')]&&_0x250e23[_0x49ed('0x2d')]>0x1;var _0xfad716=[];if(!fs[_0x49ed('0x37')](path['join'](_0x2928c1,_0x284e99))&&_0x3421a3){fs['mkdirSync'](path['join'](_0x2928c1,_0x284e99));}return BPromise[_0x49ed('0x38')](_0x250e23,function(_0x367dd7){_0xfad716['push'](_0x367dd7);})[_0x49ed('0x2b')](function(){var _0xecf59c=[];for(var _0x44a950=0x0;_0x44a950<_0xfad716[_0x49ed('0x2d')];_0x44a950+=0x1){var _0x2de0f7=_0xfad716[_0x44a950];var _0x986523=createTables(_[_0x49ed('0x39')](_0x2de0f7));var _0x3b5f65;var _0x19a813=getPDFDocDefinition(_0x986523);var _0x17c280=getPDFPrinter();var _0x216fc8=_0x17c280['createPdfKitDocument'](_0x19a813);if(_0x3421a3){_0x3b5f65=path['join'](_0x2928c1,_0x284e99,util['format'](_0x49ed('0x3a'),_0x284e99,_0x44a950,_0x49ed('0x3b')));}else{_0x3b5f65=path['join'](_0x2928c1,util[_0x49ed('0x19')]('%s.%s',_0x284e99,'pdf'));}_0xecf59c['push'](writePDFDocument(_0x216fc8,_0x3b5f65));}return Promise[_0x49ed('0x3c')](_0xecf59c);})['then'](function(){if(_0x3421a3){return new Promise(function(_0x478b4b){zipdir(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),{'saveTo':path[_0x49ed('0x3d')](_0x2928c1,util['format'](_0x49ed('0x3e'),_0x284e99,_0x49ed('0x3f')))},function(){rimraf(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),function(){});_0x478b4b(_0x49ed('0x40'));});});}})[_0x49ed('0x2b')](function(){if(!_0x3421a3)return;rimraf(path[_0x49ed('0x3d')](_0x2928c1,_0x284e99),function(){});})[_0x49ed('0x2b')](function(){logger[_0x49ed('0x41')](util[_0x49ed('0x19')](_0x49ed('0x42'),EXTRACTED_REPORT_ID,_0x49ed('0x43')));return analyticExtractedReport(_0x49ed('0x44'),_0x3421a3?util[_0x49ed('0x19')](_0x49ed('0x3e'),_0x284e99,_0x3421a3?'zip':_0x49ed('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x49ed('0x41')](util[_0x49ed('0x19')](_0x49ed('0x45'),EXTRACTED_REPORT_ID,_0x49ed('0x43')));return db[_0x49ed('0x46')][_0x49ed('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x3e6944){EXTRACTED_REPORT=_0x3e6944;return dbH[_0x49ed('0x30')][_0x49ed('0x31')](util['format'](_0x49ed('0x48'),QUERY),{'type':dbH[_0x49ed('0x30')][_0x49ed('0x33')][_0x49ed('0x34')]});})[_0x49ed('0x2b')](extractReport)[_0x49ed('0x49')](function(_0x74678){logger['info'](util[_0x49ed('0x19')](_0x49ed('0x4a'),EXTRACTED_REPORT_ID,'PDF'),util[_0x49ed('0x4b')](_0x74678,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x49ed('0x4c'));})[_0x49ed('0x4d')](function(){process[_0x49ed('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xca232a=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x49ed('0x4f'),'bolditalics':__dirname+_0x49ed('0x50')}});return _0xca232a;}function getPDFDocDefinitionFromHTML(_0x2fb0c1,_0x9f26c6){var _0x198d27=util['format'](_0x49ed('0x51'),_0x9f26c6[_0x49ed('0x52')],_0x9f26c6[_0x49ed('0x53')]);var _0x1be401=moment()['format']('YYYY-MM-DD')[_0x49ed('0x11')]();var _0x359e70=htmlToPdfmake(_0x2fb0c1,{'window':window,'tableAutoSize':!![]});return{'content':[_0x359e70],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x49ed('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x49ed('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x49ed('0x54')}},'header':function(){return[{'text':_0x49ed('0x55'),'style':_0x49ed('0x1e')}];},'footer':function(_0x501728,_0x50b786){return[{'text':util[_0x49ed('0x19')](_0x49ed('0x56'),_0x198d27,_0x501728,_0x50b786,_0x1be401),'style':'footer'}];}};}function writePDFDocument(_0xe65a00,_0x54d338){return new Promise(function(_0x9b4b49,_0x2d1085){var _0x18770d=_0xe65a00[_0x49ed('0x57')](fs[_0x49ed('0x58')](_0x54d338));_0x18770d['on'](_0x49ed('0x59'),function(){_0x9b4b49(_0x49ed('0x59'));});_0x18770d['on']('error',function(_0x49c5f3){_0x2d1085(_0x49c5f3);});_0xe65a00['end']();});}exports[_0x49ed('0x5a')]=function(_0x3339ad,_0x5be565){var _0xb6f736=getPDFPrinter();var _0x1b5859=getPDFDocDefinitionFromHTML(_0x3339ad,_0x5be565);var _0x27b256=_0xb6f736[_0x49ed('0x5b')](_0x1b5859);return writePDFDocument(_0x27b256,_0x5be565[_0x49ed('0x1')])['catch'](function(_0x1456dc){throw _0x1456dc;});}; \ No newline at end of file +var _0x9622=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','landscape','Arial','black','right','num','Setting','find','split','then','splitSizePdf','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','%s.%s'];(function(_0x404a53,_0x9c5cf0){var _0x2b5a55=function(_0x1a0570){while(--_0x1a0570){_0x404a53['push'](_0x404a53['shift']());}};_0x2b5a55(++_0x9c5cf0);}(_0x9622,0xcc));var _0x2962=function(_0x2b36fd,_0x156106){_0x2b36fd=_0x2b36fd-0x0;var _0x3df453=_0x9622[_0x2b36fd];return _0x3df453;};'use strict';var _=require(_0x2962('0x0'));var fs=require('fs');var util=require(_0x2962('0x1'));var path=require(_0x2962('0x2'));var moment=require(_0x2962('0x3'));var htmlToPdfmake=require(_0x2962('0x4'));var PdfPrinter=require(_0x2962('0x5'));var zipdir=require(_0x2962('0x6'));var rimraf=require('rimraf');var JSDOM=require(_0x2962('0x7'))[_0x2962('0x8')];var window=new JSDOM('')[_0x2962('0x9')];var BPromise=require('bluebird');var db=require(_0x2962('0xa'))['db'];var dbH=require(_0x2962('0xa'))[_0x2962('0xb')];var logger=require(_0x2962('0xc'))(_0x2962('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x2962('0xe')][0x2]);var QUERY=process[_0x2962('0xe')][0x3];var PATH=process[_0x2962('0xe')][0x4];var NAME=process[_0x2962('0xe')][0x5];var FORMAT=_0x2962('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5026cb,_0x163c2c){var _0x38e0c2={'status':_0x5026cb};var _0x2cbb9c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x163c2c){_0x38e0c2[_0x2962('0x10')]=_0x163c2c;}return db[_0x2962('0x11')][_0x2962('0x12')](_0x38e0c2,_0x2cbb9c);}function getHeaders(_0x349cda){return _[_0x2962('0x13')](_0x349cda,function(_0x530e4c){return{'text':_0x530e4c,'style':_0x2962('0x14')};});}function getRows(_0x5e336b,_0x561fbd){return _[_0x2962('0x13')](_0x561fbd,function(_0x503e44){return _(_0x503e44)[_0x2962('0x15')](_0x5e336b)[_0x2962('0x13')](function(_0x33386e){return _0x33386e?_[_0x2962('0x16')](_0x33386e):'';})['value']();});}function createTable(_0x56581e,_0x4cfbe1){var _0x5cf07c={'widths':_['fill'](Array(_0x56581e[_0x2962('0x17')]),0x91),'heights':function(_0x571ea2){return _0x571ea2===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x82555=getHeaders(_0x56581e);_0x5cf07c[_0x2962('0x18')][_0x2962('0x19')](_0x82555);var _0x10d211=getRows(_0x56581e,_0x4cfbe1);_0x5cf07c['body']=_0x5cf07c['body'][_0x2962('0x1a')](_0x10d211);return _0x5cf07c;}function createTables(_0xe85c44){var _0x5a28df=[];var _0x5bc9cb=_[_0x2962('0x1b')](Object[_0x2962('0x1c')](_0xe85c44[0x0]),0x5);_0x5bc9cb[_0x2962('0x1d')](function(_0x53172e){_0x5a28df[_0x2962('0x19')](createTable(_0x53172e,_0xe85c44));});return _0x5a28df;}function getPDFDocDefinition(_0x378d1a){var _0x56171b=util[_0x2962('0x1e')](_0x2962('0x1f'),NAME,EXTRACTED_REPORT[_0x2962('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0x2962('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x2962('0x1e')](FORMAT));var _0x3a708f=[];for(var _0x4a4fc7=0x0;_0x4a4fc7<_0x378d1a[_0x2962('0x17')];_0x4a4fc7++){var _0x35d175=[];if(_0x4a4fc7===0x0){_0x35d175[_0x2962('0x19')]({'text':_0x56171b,'style':_0x2962('0x21')});}var _0x2bff08={'table':_0x378d1a[_0x4a4fc7]};if(_0x4a4fc7>0x0){_0x2bff08['pageBreak']='before';_0x2bff08['margin']=[0x0,0x46,0x0,0x0];}_0x35d175[_0x2962('0x19')](_0x2bff08);_0x3a708f[_0x2962('0x19')](_0x35d175);}return{'pageSize':'A4','pageOrientation':_0x2962('0x22'),'content':_0x3a708f,'footer':function(_0x1ebdd4,_0x4b6a9c){return{'text':_0x1ebdd4[_0x2962('0x16')]()+'\x20/\x20'+_0x4b6a9c,'style':'footer'};},'defaultStyle':{'font':_0x2962('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x2962('0x24')},'footer':{'alignment':_0x2962('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x39ec58){var _0x465f8c=0x1388;var _0x32c6cb;if(!_0x39ec58[0x0][_0x2962('0x26')]){return analyticExtractedReport('Empty');}return db[_0x2962('0x27')][_0x2962('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2962('0x29'),'splitSizePdf']})[_0x2962('0x2a')](function(_0x2cf773){if(_0x2cf773){_0x32c6cb=_0x2cf773;_0x465f8c=_0x32c6cb[_0x2962('0x2b')]||0x3e8;}})[_0x2962('0x2a')](function(){var _0x1ba494=[];var _0x2cc8a0=0x0;if(_0x32c6cb['split']){if(_0x39ec58&&_0x39ec58[_0x2962('0x17')]){var _0x42a93d=_[_0x2962('0x2c')](_0x39ec58[0x0][_0x2962('0x26')]/_0x465f8c);var _0x579076=Number['isInteger'](_0x39ec58[0x0][_0x2962('0x26')]/_0x465f8c)?_0x39ec58[0x0]['num']%_0x465f8c:0x0;_0x42a93d[_0x2962('0x1d')](function(_0x38eb82){if(_0x38eb82>0x0){_0x2cc8a0+=_0x465f8c;}_0x1ba494[_0x2962('0x19')](dbH[_0x2962('0x2d')][_0x2962('0x2e')](util[_0x2962('0x1e')](_0x2962('0x2f'),QUERY,_0x465f8c,_0x2cc8a0),{'type':dbH[_0x2962('0x2d')][_0x2962('0x30')][_0x2962('0x31')]}));});if(_0x579076>0x0){_0x2cc8a0+=_0x465f8c;_0x1ba494[_0x2962('0x19')](dbH['sequelize'][_0x2962('0x2e')](util[_0x2962('0x1e')](_0x2962('0x2f'),QUERY,_0x579076,_0x2cc8a0),{'type':dbH[_0x2962('0x2d')]['QueryTypes'][_0x2962('0x31')]}));}}}else{_0x1ba494['push'](dbH[_0x2962('0x2d')][_0x2962('0x2e')](QUERY,{'type':dbH[_0x2962('0x2d')][_0x2962('0x30')][_0x2962('0x31')]}));}var _0x20ea61=path[_0x2962('0x32')](PATH);var _0x88a806=path[_0x2962('0x33')](PATH,_0x2962('0x34'));var _0x4a9ea6=_0x32c6cb[_0x2962('0x29')]&&_0x1ba494[_0x2962('0x17')]>0x1;var _0x76ed22=[];if(!fs['existsSync'](path[_0x2962('0x35')](_0x20ea61,_0x88a806))&&_0x4a9ea6){fs[_0x2962('0x36')](path[_0x2962('0x35')](_0x20ea61,_0x88a806));}return BPromise[_0x2962('0x37')](_0x1ba494,function(_0x4a063e){_0x76ed22[_0x2962('0x19')](_0x4a063e);})['then'](function(){var _0x503e25=[];for(var _0x1f1953=0x0;_0x1f1953<_0x76ed22[_0x2962('0x17')];_0x1f1953+=0x1){var _0x503987=_0x76ed22[_0x1f1953];var _0x4dd14a=createTables(_[_0x2962('0x38')](_0x503987));var _0x42ebc9;var _0x3e33cc=getPDFDocDefinition(_0x4dd14a);var _0x354ca3=getPDFPrinter();var _0x1f7ea9=_0x354ca3[_0x2962('0x39')](_0x3e33cc);if(_0x4a9ea6){_0x42ebc9=path[_0x2962('0x35')](_0x20ea61,_0x88a806,util['format'](_0x2962('0x3a'),_0x88a806,_0x1f1953,_0x2962('0x3b')));}else{_0x42ebc9=path[_0x2962('0x35')](_0x20ea61,util[_0x2962('0x1e')]('%s.%s',_0x88a806,_0x2962('0x3b')));}_0x503e25['push'](writePDFDocument(_0x1f7ea9,_0x42ebc9));}return Promise[_0x2962('0x3c')](_0x503e25);})[_0x2962('0x2a')](function(){if(_0x4a9ea6){return new Promise(function(_0x541eba){zipdir(path[_0x2962('0x35')](_0x20ea61,_0x88a806),{'saveTo':path[_0x2962('0x35')](_0x20ea61,util['format']('%s.%s',_0x88a806,_0x2962('0x3d')))},function(){rimraf(path[_0x2962('0x35')](_0x20ea61,_0x88a806),function(){});_0x541eba(_0x2962('0x3e'));});});}})['then'](function(){if(!_0x4a9ea6)return;rimraf(path['join'](_0x20ea61,_0x88a806),function(){});})[_0x2962('0x2a')](function(){logger[_0x2962('0x3f')](util[_0x2962('0x1e')](_0x2962('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x4a9ea6?util[_0x2962('0x1e')](_0x2962('0x41'),_0x88a806,_0x4a9ea6?_0x2962('0x3d'):_0x2962('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2962('0x3f')](util[_0x2962('0x1e')](_0x2962('0x42'),EXTRACTED_REPORT_ID,_0x2962('0x43')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x2962('0x2a')](function(_0x4887a6){EXTRACTED_REPORT=_0x4887a6;return dbH[_0x2962('0x2d')][_0x2962('0x2e')](util[_0x2962('0x1e')](_0x2962('0x44'),QUERY),{'type':dbH[_0x2962('0x2d')][_0x2962('0x30')][_0x2962('0x31')]});})['then'](extractReport)[_0x2962('0x45')](function(_0x31441d){logger[_0x2962('0x3f')](util[_0x2962('0x1e')](_0x2962('0x46'),EXTRACTED_REPORT_ID,_0x2962('0x43')),util['inspect'](_0x31441d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2962('0x47'));})[_0x2962('0x48')](function(){process[_0x2962('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x69cb22=new PdfPrinter({'Arial':{'normal':__dirname+_0x2962('0x4a'),'bold':__dirname+_0x2962('0x4b'),'italics':__dirname+_0x2962('0x4c'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x69cb22;}function getPDFDocDefinitionFromHTML(_0x3e076a,_0x3f5959){var _0x2a321c=util['format']('%s\x20#%d',_0x3f5959[_0x2962('0x4d')],_0x3f5959[_0x2962('0x4e')]);var _0x6f0e9f=moment()[_0x2962('0x1e')](_0x2962('0x4f'))[_0x2962('0x16')]();var _0x4a5343=htmlToPdfmake(_0x3e076a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4a5343],'defaultStyle':{'font':_0x2962('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x2962('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2962('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2962('0x50')}},'header':function(){return[{'text':_0x2962('0x51'),'style':_0x2962('0x21')}];},'footer':function(_0x552144,_0x4358ba){return[{'text':util[_0x2962('0x1e')](_0x2962('0x52'),_0x2a321c,_0x552144,_0x4358ba,_0x6f0e9f),'style':_0x2962('0x53')}];}};}function writePDFDocument(_0x153394,_0x579417){return new Promise(function(_0x1c803d,_0x44c3dc){var _0x53b5e1=_0x153394[_0x2962('0x54')](fs[_0x2962('0x55')](_0x579417));_0x53b5e1['on'](_0x2962('0x56'),function(){_0x1c803d(_0x2962('0x56'));});_0x53b5e1['on'](_0x2962('0x57'),function(_0x32b592){_0x44c3dc(_0x32b592);});_0x153394[_0x2962('0x58')]();});}exports[_0x2962('0x59')]=function(_0x24fdd0,_0x32bf2a){var _0x10d581=getPDFPrinter();var _0x46398e=getPDFDocDefinitionFromHTML(_0x24fdd0,_0x32bf2a);var _0x10481c=_0x10d581['createPdfKitDocument'](_0x46398e);return writePDFDocument(_0x10481c,_0x32bf2a['path'])[_0x2962('0x45')](function(_0x682b9d){throw _0x682b9d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index d5bc0db..9ad104b 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 _0xb01a=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Empty','split','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.xlsx','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xb01a,0x1a1));var _0xab01=function(_0x42ac42,_0x6e6a4b){_0x42ac42=_0x42ac42-0x0;var _0x50dc84=_0xb01a[_0x42ac42];return _0x50dc84;};'use strict';var util=require(_0xab01('0x0'));var path=require(_0xab01('0x1'));var _=require(_0xab01('0x2'));var fs=require('fs');var json2xls=require(_0xab01('0x3'));var BPromise=require(_0xab01('0x4'));var zipdir=require(_0xab01('0x5'));var rimraf=require(_0xab01('0x6'));var db=require(_0xab01('0x7'))['db'];var dbH=require(_0xab01('0x7'))[_0xab01('0x8')];var logger=require(_0xab01('0x9'))(_0xab01('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xab01('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xab01('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x21be3d,_0x4b413e){var _0x52146e={'status':_0x21be3d};var _0x71864b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b413e){_0x52146e[_0xab01('0xc')]=_0x4b413e;}return db['AnalyticExtractedReport'][_0xab01('0xd')](_0x52146e,_0x71864b);}function main(){var _0x48be78=0x1388;var _0x57b047;logger[_0xab01('0xe')](util['format'](_0xab01('0xf'),EXTRACTED_REPORT_ID,_0xab01('0x10')));return db['Setting'][_0xab01('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xab01('0x12')](function(_0x37088b){if(_0x37088b){_0x57b047=_0x37088b;_0x48be78=_0x57b047[_0xab01('0x13')]||0x1388;}})[_0xab01('0x12')](function(){return dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x17'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x32001d){if(!_0x32001d[0x0]['num']){return analyticExtractedReport(_0xab01('0x18'));}var _0x2d9c23=[];var _0x26af11=0x0;if(_0x57b047[_0xab01('0x19')]){if(_0x32001d&&_0x32001d['length']){var _0x3bea90=_['range'](_0x32001d[0x0][_0xab01('0x1a')]/_0x48be78);var _0xb59105=Number['isInteger'](_0x32001d[0x0]['num']/_0x48be78)?_0x32001d[0x0][_0xab01('0x1a')]%_0x48be78:0x0;_0x3bea90[_0xab01('0x1b')](function(_0xa9f649){if(_0xa9f649>0x0){_0x26af11+=_0x48be78;}_0x2d9c23[_0xab01('0x1c')](dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x1d'),QUERY,_0x48be78,_0x26af11),{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')]['SELECT']}));});if(_0xb59105>0x0){_0x26af11+=_0x48be78;_0x2d9c23[_0xab01('0x1c')](dbH[_0xab01('0x14')][_0xab01('0x15')](util[_0xab01('0x16')](_0xab01('0x1d'),QUERY,_0xb59105,_0x26af11),{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')][_0xab01('0x1f')]}));}}}else{_0x2d9c23['push'](dbH[_0xab01('0x14')][_0xab01('0x15')](QUERY,{'type':dbH[_0xab01('0x14')][_0xab01('0x1e')][_0xab01('0x1f')]}));}var _0x1ebc65=path[_0xab01('0x20')](PATH);var _0x55831d=path[_0xab01('0x21')](PATH,_0xab01('0x22'));var _0x2758d=_0x57b047[_0xab01('0x19')]&&_0x2d9c23[_0xab01('0x23')]>0x1;var _0x46088d=[];if(!fs[_0xab01('0x24')](path['join'](_0x1ebc65,_0x55831d))&&_0x2758d){fs[_0xab01('0x25')](path[_0xab01('0x26')](_0x1ebc65,_0x55831d));}return BPromise[_0xab01('0x27')](_0x2d9c23,function(_0x36c53f){_0x46088d[_0xab01('0x1c')](_0x36c53f);})[_0xab01('0x12')](function(){for(var _0x51a927=0x0;_0x51a927<_0x46088d[_0xab01('0x23')];_0x51a927+=0x1){var _0x209e10;var _0x4a22c0=_0x46088d[_0x51a927];if(_0x2758d){_0x209e10=path[_0xab01('0x26')](_0x1ebc65,_0x55831d,util[_0xab01('0x16')](_0xab01('0x28'),_0x55831d,_0x51a927,_0xab01('0x29')));}else{_0x209e10=path[_0xab01('0x26')](_0x1ebc65,util[_0xab01('0x16')](_0xab01('0x2a'),_0x55831d,_0xab01('0x29')));}fs['writeFileSync'](_0x209e10,json2xls(_0x4a22c0),_0xab01('0x2b'));}})[_0xab01('0x12')](function(){if(_0x2758d){return new Promise(function(_0x51a120){zipdir(path[_0xab01('0x26')](_0x1ebc65,_0x55831d),{'saveTo':path[_0xab01('0x26')](_0x1ebc65,util[_0xab01('0x16')](_0xab01('0x2a'),_0x55831d,_0xab01('0x2c')))},function(_0x3b9428,_0x4fce3b){rimraf(path[_0xab01('0x26')](_0x1ebc65,_0x55831d),function(){});_0x51a120(_0xab01('0x2d'));});});}})[_0xab01('0x12')](function(){logger[_0xab01('0xe')](util[_0xab01('0x16')](_0xab01('0x2e'),EXTRACTED_REPORT_ID,_0xab01('0x10')));return analyticExtractedReport('Completed',_0x2758d?util['format']('%s.%s',_0x55831d,_0x2758d?_0xab01('0x2c'):_0xab01('0x29')):null);});})[_0xab01('0x2f')](function(_0x1f75b1){logger[_0xab01('0xe')](util[_0xab01('0x16')](_0xab01('0x30'),EXTRACTED_REPORT_ID,_0xab01('0x10')),util[_0xab01('0x31')](_0x1f75b1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xab01('0x32'));})[_0xab01('0x33')](function(){process[_0xab01('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf29c=['find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','split','length','range','num','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting'];(function(_0x2b93bb,_0x51002a){var _0x2bedc9=function(_0x3ba914){while(--_0x3ba914){_0x2b93bb['push'](_0x2b93bb['shift']());}};_0x2bedc9(++_0x51002a);}(_0xf29c,0xf1));var _0xcf29=function(_0x216936,_0x3de096){_0x216936=_0x216936-0x0;var _0x726e8b=_0xf29c[_0x216936];return _0x726e8b;};'use strict';var util=require(_0xcf29('0x0'));var path=require(_0xcf29('0x1'));var _=require(_0xcf29('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xcf29('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xcf29('0x4'))['db'];var dbH=require('../../mysqldb')[_0xcf29('0x5')];var logger=require(_0xcf29('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcf29('0x7')][0x2]);var QUERY=process[_0xcf29('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x329bd5,_0x1ef44e){var _0xa47b6a={'status':_0x329bd5};var _0x3c41a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ef44e){_0xa47b6a[_0xcf29('0x8')]=_0x1ef44e;}return db[_0xcf29('0x9')][_0xcf29('0xa')](_0xa47b6a,_0x3c41a3);}function main(){var _0x1acc49=0x1388;var _0x21ee68;logger['info'](util[_0xcf29('0xb')](_0xcf29('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xcf29('0xd')][_0xcf29('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcf29('0xf')]})[_0xcf29('0x10')](function(_0x341ba7){if(_0x341ba7){_0x21ee68=_0x341ba7;_0x1acc49=_0x21ee68[_0xcf29('0xf')]||0x1388;}})[_0xcf29('0x10')](function(){return dbH['sequelize']['query'](util[_0xcf29('0xb')](_0xcf29('0x11'),QUERY),{'type':dbH[_0xcf29('0x12')][_0xcf29('0x13')][_0xcf29('0x14')]});})[_0xcf29('0x10')](function(_0x50bd00){if(!_0x50bd00[0x0]['num']){return analyticExtractedReport('Empty');}var _0x419556=[];var _0x57c9c7=0x0;if(_0x21ee68[_0xcf29('0x15')]){if(_0x50bd00&&_0x50bd00[_0xcf29('0x16')]){var _0xa6aed3=_[_0xcf29('0x17')](_0x50bd00[0x0][_0xcf29('0x18')]/_0x1acc49);var _0x1fc130=Number[_0xcf29('0x19')](_0x50bd00[0x0]['num']/_0x1acc49)?_0x50bd00[0x0][_0xcf29('0x18')]%_0x1acc49:0x0;_0xa6aed3[_0xcf29('0x1a')](function(_0x7114fc){if(_0x7114fc>0x0){_0x57c9c7+=_0x1acc49;}_0x419556['push'](dbH['sequelize'][_0xcf29('0x1b')](util['format'](_0xcf29('0x1c'),QUERY,_0x1acc49,_0x57c9c7),{'type':dbH['sequelize']['QueryTypes'][_0xcf29('0x14')]}));});if(_0x1fc130>0x0){_0x57c9c7+=_0x1acc49;_0x419556[_0xcf29('0x1d')](dbH[_0xcf29('0x12')][_0xcf29('0x1b')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1fc130,_0x57c9c7),{'type':dbH[_0xcf29('0x12')][_0xcf29('0x13')][_0xcf29('0x14')]}));}}}else{_0x419556[_0xcf29('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xcf29('0x12')][_0xcf29('0x13')][_0xcf29('0x14')]}));}var _0x1bdf1c=path[_0xcf29('0x1e')](PATH);var _0x3c1408=path['basename'](PATH,'.xlsx');var _0x288b2c=_0x21ee68[_0xcf29('0x15')]&&_0x419556[_0xcf29('0x16')]>0x1;var _0x5da4cb=[];if(!fs[_0xcf29('0x1f')](path[_0xcf29('0x20')](_0x1bdf1c,_0x3c1408))&&_0x288b2c){fs[_0xcf29('0x21')](path['join'](_0x1bdf1c,_0x3c1408));}return BPromise[_0xcf29('0x22')](_0x419556,function(_0x49e127){_0x5da4cb[_0xcf29('0x1d')](_0x49e127);})[_0xcf29('0x10')](function(){for(var _0x466416=0x0;_0x466416<_0x5da4cb['length'];_0x466416+=0x1){var _0x38dc2a;var _0x5e1610=_0x5da4cb[_0x466416];if(_0x288b2c){_0x38dc2a=path[_0xcf29('0x20')](_0x1bdf1c,_0x3c1408,util['format'](_0xcf29('0x23'),_0x3c1408,_0x466416,_0xcf29('0x24')));}else{_0x38dc2a=path[_0xcf29('0x20')](_0x1bdf1c,util['format'](_0xcf29('0x25'),_0x3c1408,_0xcf29('0x24')));}fs[_0xcf29('0x26')](_0x38dc2a,json2xls(_0x5e1610),_0xcf29('0x27'));}})[_0xcf29('0x10')](function(){if(_0x288b2c){return new Promise(function(_0x9b6b15){zipdir(path[_0xcf29('0x20')](_0x1bdf1c,_0x3c1408),{'saveTo':path[_0xcf29('0x20')](_0x1bdf1c,util[_0xcf29('0xb')](_0xcf29('0x25'),_0x3c1408,_0xcf29('0x28')))},function(_0x2aa618,_0x1f58f7){rimraf(path[_0xcf29('0x20')](_0x1bdf1c,_0x3c1408),function(){});_0x9b6b15(_0xcf29('0x29'));});});}})['then'](function(){logger[_0xcf29('0x2a')](util[_0xcf29('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xcf29('0x2b')));return analyticExtractedReport(_0xcf29('0x2c'),_0x288b2c?util[_0xcf29('0xb')](_0xcf29('0x25'),_0x3c1408,_0x288b2c?_0xcf29('0x28'):_0xcf29('0x24')):null);});})[_0xcf29('0x2d')](function(_0x58e5fe){logger[_0xcf29('0x2a')](util[_0xcf29('0xb')](_0xcf29('0x2e'),EXTRACTED_REPORT_ID,_0xcf29('0x2b')),util[_0xcf29('0x2f')](_0x58e5fe,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcf29('0x30'));})[_0xcf29('0x31')](function(){process[_0xcf29('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d4f72fb..e96fa6e 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 _0xe67a=['error','rewrite','lodash','util','findAll','then','models','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','*,*,*,*','map','filter','intervals','CDR(tag)=','tag','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','Hangup','concat','transaction','bulkCreate','catch'];(function(_0x493b81,_0x1c8994){var _0x1a27ee=function(_0x269ea2){while(--_0x269ea2){_0x493b81['push'](_0x493b81['shift']());}};_0x1a27ee(++_0x1c8994);}(_0xe67a,0xd7));var _0xae67=function(_0xef0b43,_0x2b3f5a){_0xef0b43=_0xef0b43-0x0;var _0x559e5f=_0xe67a[_0xef0b43];return _0x559e5f;};'use strict';var _=require(_0xae67('0x0'));var util=require(_0xae67('0x1'));function rewrite(_0x2de9ba,_0x31ac0f){var _0x472dbd=this;return _0x2de9ba['models']['Interval'][_0xae67('0x2')]({'raw':!![]})[_0xae67('0x3')](function(_0x2fe9d2){_0x472dbd['intervals']=_0x2fe9d2;return _0x2de9ba[_0xae67('0x4')][_0xae67('0x5')]['findAll']({'where':{'IntervalId':_0x31ac0f[_0xae67('0x6')]},'raw':!![]});})['then'](function(_0x209273){return _0x2de9ba['models'][_0xae67('0x5')][_0xae67('0x2')]({'where':{'exten':{'$in':_[_0xae67('0x7')](_['map'](_0x209273,_0xae67('0x8')))}},'order':[{'raw':_0xae67('0x9')}],'raw':!![]});})[_0xae67('0x3')](function(_0x51c619){var _0x4de64b=_['filter'](_0x51c619,{'priority':'1'});var _0x1a884d=_['filter'](_0x51c619,{'isApp':0x1});var _0x1490be=_[_0xae67('0xa')](_0x1a884d,_0xae67('0x8'));var _0x519098=[_0xae67('0xb'),_0xae67('0xc')];var _0x3e00ff=[];var _0x128d55=[];for(var _0x23ccdf in _0x1490be){if(_0x1490be[_0xae67('0xd')](_0x23ccdf)){_0x472dbd[_0xae67('0xe')]=0x2;_0x472dbd[_0xae67('0xf')]=[];_0x472dbd[_0xae67('0x10')]=_['find'](_0x4de64b,{'exten':_0x1490be[_0x23ccdf][0x0]['exten']});_0x472dbd['extensions']['push']({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':'Set','appdata':util[_0xae67('0x11')](_0xae67('0x12'),_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd['priority']++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]===_0xae67('0x16')){_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x19')+_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId'],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}else if(_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')]===_0xae67('0x1a')){if(_0x472dbd[_0xae67('0x10')]){_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x1b')+(_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]?_0xae67('0x1d')+_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]+'}':_0xae67('0x1e')),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x19')+_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});var _0x49c273=_0x472dbd['priority']++;_0x472dbd[_0xae67('0xf')]['push']({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x20')+(_0x49c273+0x2)+'):Goto('+(_0x49c273+0x1)+')','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x49c273,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x472dbd['extension']){_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0x472dbd[_0xae67('0x10')][_0xae67('0x1c')]?_0xae67('0x21')+_0x472dbd['extension']['cutdigits']+'}':_0xae67('0x22'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x472dbd[_0xae67('0xf')]['push']({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':'Set','appdata':'outboundrouteid='+_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')],'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0]['exten'],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});if(_0x472dbd[_0xae67('0x10')]&&_0x472dbd[_0xae67('0x10')][_0xae67('0xd')](_0xae67('0x23'))&&_0x472dbd['extension'][_0xae67('0x23')]!==_0xae67('0x24')){_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x472dbd['extensions']['push']({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x25')+_0x472dbd[_0xae67('0x10')][_0xae67('0x23')]||_0xae67('0x26'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd['priority']++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x27'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});_0x472dbd['extensions'][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':_0xae67('0x28'),'context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0]['type'],'app':_0xae67('0x18'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1490be[_0x23ccdf][0x0][_0xae67('0x14')],'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'priority':_0x472dbd[_0xae67('0xe')]++,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0]['VoiceExtensionId']});for(var _0x16d694=0x0,_0x468514=0x0;_0x16d694<_0x1490be[_0x23ccdf]['length'];_0x16d694+=0x1,_0x468514=0x0){var _0x292e68=_0x1490be[_0x23ccdf][_0x16d694];if(_0x292e68[_0xae67('0x13')]){_0x292e68[_0xae67('0x13')]=_0x292e68[_0xae67('0x13')][_0xae67('0x29')]();}var _0x40d114=[];var _0x266f2c=[];delete _0x292e68['id'];delete _0x292e68[_0xae67('0x2a')];delete _0x292e68[_0xae67('0x2b')];var _0x4cb3ba=_0x292e68['interval']!==_0xae67('0x2c')?[_0x292e68['interval']]:_0x292e68[_0xae67('0x6')]?_[_0xae67('0x2d')](_[_0xae67('0x2e')](_0x472dbd[_0xae67('0x2f')],{'IntervalId':_0x292e68['IntervalId']}),'interval'):[];if(_0x292e68[_0xae67('0xd')]('tag')){if(_0x292e68['tag']&&_0x292e68['tag']!=='--'){_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x18'),'appdata':_0xae67('0x30')+_0x292e68[_0xae67('0x31')],'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}if(_0x292e68[_0xae67('0x13')]===_0xae67('0x1a')&&_0x292e68['hasOwnProperty'](_0xae67('0x33'))){if(_0x292e68['callerID']){_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x1f'),'appdata':_0xae67('0x34')+_0x292e68['callerID']+')','context':_0x292e68['context'],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}else{_0x40d114[_0xae67('0x17')]({'type':_0x292e68[_0xae67('0x13')],'app':_0xae67('0x1f'),'appdata':_0xae67('0x35'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba['length']+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}if(_0x292e68[_0xae67('0xd')]('answer')){if(_0x519098[_0xae67('0x36')](_0x292e68['app'][_0xae67('0x29')]())>=0x0&&_0x292e68[_0xae67('0x37')]!==_0xae67('0x38')){if(_0x292e68['answer']){_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x39'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':'Set','appdata':_0xae67('0x3a'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}else{_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x1f'),'appdata':_0xae67('0x3b'),'context':_0x292e68[_0xae67('0x14')],'exten':_0x292e68['exten'],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});_0x40d114[_0xae67('0x17')]({'type':_0x292e68['type'],'app':_0xae67('0x18'),'appdata':_0xae67('0x3c'),'context':_0x292e68['context'],'exten':_0x292e68[_0xae67('0x8')],'priority':_0x4cb3ba[_0xae67('0x32')]+_0x472dbd[_0xae67('0xe')]+_0x468514++,'VoiceExtensionId':_0x292e68[_0xae67('0x15')]});}}}for(var _0x18cb16=0x0;_0x18cb16<_0x4cb3ba[_0xae67('0x32')];_0x18cb16+=0x1){var _0x1c6ef4=_0x472dbd[_0xae67('0xe')]+_0x4cb3ba['length'];var _0x236920=_0x18cb16===_0x4cb3ba[_0xae67('0x32')]-0x1?_0x472dbd[_0xae67('0xe')]+_0x40d114[_0xae67('0x32')]+_0x266f2c[_0xae67('0x32')]+0x2:_0x472dbd[_0xae67('0xe')]+_0x18cb16+0x1;_0x40d114[_0xae67('0x3d')](_0x18cb16,0x0,{'type':_0x292e68['type'],'app':_0xae67('0x3e'),'appdata':_0x4cb3ba[_0x18cb16]+'?'+_0x292e68['context']+',${EXTEN},'+_0x1c6ef4+':'+_0x292e68[_0xae67('0x14')]+',${EXTEN},'+_0x236920,'exten':_0x292e68[_0xae67('0x8')],'context':_0x292e68['context'],'priority':_0x472dbd['priority']+_0x18cb16,'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});}_0x292e68[_0xae67('0xe')]=_0x40d114[_0xae67('0x32')]?_[_0xae67('0x3f')](_0x40d114)[_0xae67('0xe')]+0x1:_0x472dbd[_0xae67('0xe')];_0x472dbd[_0xae67('0xe')]=(_0x266f2c[_0xae67('0x32')]?_[_0xae67('0x3f')](_0x266f2c)[_0xae67('0xe')]:_0x292e68[_0xae67('0xe')])+0x1;_0x472dbd[_0xae67('0xf')]=_['concat'](_0x472dbd['extensions'],_0x40d114,[_0x292e68],_0x266f2c);}_0x472dbd[_0xae67('0xf')][_0xae67('0x17')]({'type':_0x1490be[_0x23ccdf][0x0][_0xae67('0x13')],'app':_0xae67('0x40'),'exten':_0x1490be[_0x23ccdf][0x0][_0xae67('0x8')],'context':_0x1490be[_0x23ccdf][0x0]['context'],'priority':_0x472dbd[_0xae67('0xe')],'VoiceExtensionId':_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]});_0x3e00ff['push'](_0x1490be[_0x23ccdf][0x0][_0xae67('0x15')]);_0x128d55=_[_0xae67('0x41')](_0x128d55,_0x472dbd[_0xae67('0xf')]);}}return _0x2de9ba[_0xae67('0x42')](function(_0x541eb5){return _0x2de9ba['models'][_0xae67('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3e00ff}},'transaction':_0x541eb5})[_0xae67('0x3')](function(_0x22f12f){return _0x2de9ba['models'][_0xae67('0x5')][_0xae67('0x43')](_['sortBy'](_0x128d55,'priority'),{'transaction':_0x541eb5});});});})[_0xae67('0x44')](function(_0x45c5ae){console[_0xae67('0x45')](_0x45c5ae);});}exports[_0xae67('0x46')]=rewrite; \ No newline at end of file +var _0x2eea=['sortBy','catch','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','format','context','VoiceExtensionId','CDR(routeid)=','push','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate'];(function(_0x1dd7d8,_0x9ba9c9){var _0x81acc9=function(_0x1373b9){while(--_0x1373b9){_0x1dd7d8['push'](_0x1dd7d8['shift']());}};_0x81acc9(++_0x9ba9c9);}(_0x2eea,0xd4));var _0xa2ee=function(_0x26c874,_0x4dd7dd){_0x26c874=_0x26c874-0x0;var _0x167531=_0x2eea[_0x26c874];return _0x167531;};'use strict';var _=require(_0xa2ee('0x0'));var util=require(_0xa2ee('0x1'));function rewrite(_0x5ab20e,_0x10a11c){var _0x4b9475=this;return _0x5ab20e[_0xa2ee('0x2')][_0xa2ee('0x3')][_0xa2ee('0x4')]({'raw':!![]})[_0xa2ee('0x5')](function(_0x102291){_0x4b9475[_0xa2ee('0x6')]=_0x102291;return _0x5ab20e['models']['VoiceExtension'][_0xa2ee('0x4')]({'where':{'IntervalId':_0x10a11c[_0xa2ee('0x7')]},'raw':!![]});})['then'](function(_0x262d7e){return _0x5ab20e[_0xa2ee('0x2')][_0xa2ee('0x8')]['findAll']({'where':{'exten':{'$in':_[_0xa2ee('0x9')](_[_0xa2ee('0xa')](_0x262d7e,_0xa2ee('0xb')))}},'order':[{'raw':_0xa2ee('0xc')}],'raw':!![]});})[_0xa2ee('0x5')](function(_0x552e38){var _0x478045=_[_0xa2ee('0xd')](_0x552e38,{'priority':'1'});var _0x2b0b50=_[_0xa2ee('0xd')](_0x552e38,{'isApp':0x1});var _0x21a00f=_['groupBy'](_0x2b0b50,_0xa2ee('0xb'));var _0x22430c=[_0xa2ee('0xe'),_0xa2ee('0xf')];var _0x2d0290=[];var _0x602fc5=[];for(var _0x39e935 in _0x21a00f){if(_0x21a00f[_0xa2ee('0x10')](_0x39e935)){_0x4b9475[_0xa2ee('0x11')]=0x2;_0x4b9475[_0xa2ee('0x12')]=[];_0x4b9475[_0xa2ee('0x13')]=_[_0xa2ee('0x14')](_0x478045,{'exten':_0x21a00f[_0x39e935][0x0]['exten']});_0x4b9475[_0xa2ee('0x12')]['push']({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'Set','appdata':util[_0xa2ee('0x16')]('CDR(type)=%s',_0x21a00f[_0x39e935][0x0]['type']),'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0]['exten'],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});if(_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')]==='inbound'){_0x4b9475['extensions']['push']({'type':_0x21a00f[_0x39e935][0x0]['type'],'app':'Set','appdata':_0xa2ee('0x19')+_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')],'context':_0x21a00f[_0x39e935][0x0]['context'],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0]['VoiceExtensionId']});}else if(_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')]==='outbound'){if(_0x4b9475[_0xa2ee('0x13')]){_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':_0xa2ee('0x1c')+(_0x4b9475[_0xa2ee('0x13')][_0xa2ee('0x1d')]?_0xa2ee('0x1e')+_0x4b9475['extension'][_0xa2ee('0x1d')]+'}':_0xa2ee('0x1f')),'context':_0x21a00f[_0x39e935][0x0]['context'],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});}_0x4b9475['extensions'][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'Set','appdata':_0xa2ee('0x19')+_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')],'context':_0x21a00f[_0x39e935][0x0]['context'],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});var _0x1018f5=_0x4b9475[_0xa2ee('0x11')]++;_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1018f5+0x2)+_0xa2ee('0x20')+(_0x1018f5+0x1)+')','context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x1018f5,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});if(_0x4b9475[_0xa2ee('0x13')]){_0x4b9475['extensions'][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'Set','appdata':_0x4b9475[_0xa2ee('0x13')][_0xa2ee('0x1d')]?_0xa2ee('0x21')+_0x4b9475['extension'][_0xa2ee('0x1d')]+'}':_0xa2ee('0x22'),'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});}_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':_0xa2ee('0x23')+_0x21a00f[_0x39e935][0x0]['VoiceExtensionId'],'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});if(_0x4b9475['extension']&&_0x4b9475[_0xa2ee('0x13')][_0xa2ee('0x10')]('recordingFormat')&&_0x4b9475[_0xa2ee('0x13')][_0xa2ee('0x24')]!==_0xa2ee('0x25')){_0x4b9475[_0xa2ee('0x12')]['push']({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'Set','appdata':_0xa2ee('0x26'),'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4b9475[_0xa2ee('0x13')][_0xa2ee('0x24')]||_0xa2ee('0x27'),'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0]['exten'],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});}}_0x4b9475['extensions']['push']({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0]['exten'],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':_0xa2ee('0x28'),'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'priority':_0x4b9475[_0xa2ee('0x11')]++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':_0xa2ee('0x29'),'context':_0x21a00f[_0x39e935][0x0]['context'],'exten':_0x21a00f[_0x39e935][0x0]['exten'],'priority':_0x4b9475['priority']++,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});for(var _0x2774fc=0x0,_0x5b2e2a=0x0;_0x2774fc<_0x21a00f[_0x39e935][_0xa2ee('0x2a')];_0x2774fc+=0x1,_0x5b2e2a=0x0){var _0x12b451=_0x21a00f[_0x39e935][_0x2774fc];if(_0x12b451[_0xa2ee('0x15')]){_0x12b451[_0xa2ee('0x15')]=_0x12b451[_0xa2ee('0x15')][_0xa2ee('0x2b')]();}var _0x1dea04=[];var _0x45b2ee=[];delete _0x12b451['id'];delete _0x12b451[_0xa2ee('0x2c')];delete _0x12b451[_0xa2ee('0x2d')];var _0x7398c=_0x12b451[_0xa2ee('0x2e')]!==_0xa2ee('0x2f')?[_0x12b451['interval']]:_0x12b451['IntervalId']?_[_0xa2ee('0xa')](_[_0xa2ee('0xd')](_0x4b9475[_0xa2ee('0x6')],{'IntervalId':_0x12b451[_0xa2ee('0x7')]}),'interval'):[];if(_0x12b451[_0xa2ee('0x10')](_0xa2ee('0x30'))){if(_0x12b451[_0xa2ee('0x30')]&&_0x12b451[_0xa2ee('0x30')]!=='--'){_0x1dea04[_0xa2ee('0x1a')]({'type':_0x12b451[_0xa2ee('0x15')],'app':_0xa2ee('0x1b'),'appdata':'CDR(tag)='+_0x12b451[_0xa2ee('0x30')],'context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451['exten'],'priority':_0x7398c[_0xa2ee('0x2a')]+_0x4b9475[_0xa2ee('0x11')]+_0x5b2e2a++,'VoiceExtensionId':_0x12b451['VoiceExtensionId']});}}if(_0x12b451[_0xa2ee('0x15')]===_0xa2ee('0x31')&&_0x12b451[_0xa2ee('0x10')]('callerID')){if(_0x12b451[_0xa2ee('0x32')]){_0x1dea04[_0xa2ee('0x1a')]({'type':_0x12b451['type'],'app':_0xa2ee('0x33'),'appdata':_0xa2ee('0x34')+_0x12b451[_0xa2ee('0x32')]+')','context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451[_0xa2ee('0xb')],'priority':_0x7398c['length']+_0x4b9475[_0xa2ee('0x11')]+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});}else{_0x1dea04['push']({'type':_0x12b451['type'],'app':_0xa2ee('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451[_0xa2ee('0xb')],'priority':_0x7398c[_0xa2ee('0x2a')]+_0x4b9475[_0xa2ee('0x11')]+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});}}if(_0x12b451[_0xa2ee('0x10')](_0xa2ee('0x35'))){if(_0x22430c[_0xa2ee('0x36')](_0x12b451[_0xa2ee('0x37')]['toLowerCase']())>=0x0&&_0x12b451[_0xa2ee('0x38')]!==_0xa2ee('0x39')){if(_0x12b451['answer']){_0x1dea04['push']({'type':_0x12b451['type'],'app':_0xa2ee('0x33'),'appdata':_0xa2ee('0x3a'),'context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451[_0xa2ee('0xb')],'priority':_0x7398c[_0xa2ee('0x2a')]+_0x4b9475[_0xa2ee('0x11')]+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});_0x1dea04[_0xa2ee('0x1a')]({'type':_0x12b451[_0xa2ee('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451[_0xa2ee('0xb')],'priority':_0x7398c['length']+_0x4b9475['priority']+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});}else{_0x1dea04[_0xa2ee('0x1a')]({'type':_0x12b451[_0xa2ee('0x15')],'app':'ExecIf','appdata':_0xa2ee('0x3b'),'context':_0x12b451[_0xa2ee('0x17')],'exten':_0x12b451['exten'],'priority':_0x7398c[_0xa2ee('0x2a')]+_0x4b9475[_0xa2ee('0x11')]+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});_0x1dea04[_0xa2ee('0x1a')]({'type':_0x12b451[_0xa2ee('0x15')],'app':'Set','appdata':_0xa2ee('0x3c'),'context':_0x12b451['context'],'exten':_0x12b451[_0xa2ee('0xb')],'priority':_0x7398c[_0xa2ee('0x2a')]+_0x4b9475['priority']+_0x5b2e2a++,'VoiceExtensionId':_0x12b451[_0xa2ee('0x18')]});}}}for(var _0x4157b7=0x0;_0x4157b7<_0x7398c[_0xa2ee('0x2a')];_0x4157b7+=0x1){var _0x1d20e1=_0x4b9475[_0xa2ee('0x11')]+_0x7398c[_0xa2ee('0x2a')];var _0x42130c=_0x4157b7===_0x7398c[_0xa2ee('0x2a')]-0x1?_0x4b9475[_0xa2ee('0x11')]+_0x1dea04[_0xa2ee('0x2a')]+_0x45b2ee[_0xa2ee('0x2a')]+0x2:_0x4b9475['priority']+_0x4157b7+0x1;_0x1dea04[_0xa2ee('0x3d')](_0x4157b7,0x0,{'type':_0x12b451[_0xa2ee('0x15')],'app':_0xa2ee('0x3e'),'appdata':_0x7398c[_0x4157b7]+'?'+_0x12b451[_0xa2ee('0x17')]+_0xa2ee('0x3f')+_0x1d20e1+':'+_0x12b451[_0xa2ee('0x17')]+_0xa2ee('0x3f')+_0x42130c,'exten':_0x12b451['exten'],'context':_0x12b451[_0xa2ee('0x17')],'priority':_0x4b9475[_0xa2ee('0x11')]+_0x4157b7,'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});}_0x12b451[_0xa2ee('0x11')]=_0x1dea04[_0xa2ee('0x2a')]?_[_0xa2ee('0x40')](_0x1dea04)['priority']+0x1:_0x4b9475['priority'];_0x4b9475['priority']=(_0x45b2ee[_0xa2ee('0x2a')]?_[_0xa2ee('0x40')](_0x45b2ee)[_0xa2ee('0x11')]:_0x12b451[_0xa2ee('0x11')])+0x1;_0x4b9475[_0xa2ee('0x12')]=_[_0xa2ee('0x41')](_0x4b9475[_0xa2ee('0x12')],_0x1dea04,[_0x12b451],_0x45b2ee);}_0x4b9475[_0xa2ee('0x12')][_0xa2ee('0x1a')]({'type':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x15')],'app':'Hangup','exten':_0x21a00f[_0x39e935][0x0][_0xa2ee('0xb')],'context':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x17')],'priority':_0x4b9475[_0xa2ee('0x11')],'VoiceExtensionId':_0x21a00f[_0x39e935][0x0][_0xa2ee('0x18')]});_0x2d0290['push'](_0x21a00f[_0x39e935][0x0]['VoiceExtensionId']);_0x602fc5=_[_0xa2ee('0x41')](_0x602fc5,_0x4b9475['extensions']);}}return _0x5ab20e[_0xa2ee('0x42')](function(_0x2395a0){return _0x5ab20e['models']['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2d0290}},'transaction':_0x2395a0})['then'](function(_0x59944c){return _0x5ab20e[_0xa2ee('0x2')][_0xa2ee('0x8')][_0xa2ee('0x43')](_[_0xa2ee('0x44')](_0x602fc5,_0xa2ee('0x11')),{'transaction':_0x2395a0});});});})[_0xa2ee('0x45')](function(_0x179751){console['error'](_0x179751);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2e1a391..6d37a66 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 _0x4b01=['cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','query','onlyIfOpen','sequelize','VoiceQueueId','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','finally','contact:csv_','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','fromQuery','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum'];(function(_0x4a1c1b,_0x2a6026){var _0x48792f=function(_0x5bf17c){while(--_0x5bf17c){_0x4a1c1b['push'](_0x4a1c1b['shift']());}};_0x48792f(++_0x2a6026);}(_0x4b01,0xff));var _0x14b0=function(_0x9a5b30,_0x4fede2){_0x9a5b30=_0x9a5b30-0x0;var _0x9f7c7d=_0x4b01[_0x9a5b30];return _0x9f7c7d;};'use strict';var BPromise=require(_0x14b0('0x0'));var util=require(_0x14b0('0x1'));var _=require(_0x14b0('0x2'));var fs=require('fs');var squel=require(_0x14b0('0x3'));var Papa=require(_0x14b0('0x4'));var Redis=require(_0x14b0('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x14b0('0x6'));var logger=require(_0x14b0('0x7'))(_0x14b0('0x8'));config[_0x14b0('0x9')]=_['defaults'](config[_0x14b0('0x9')],{'host':_0x14b0('0xa'),'port':0x18eb});var socket=require(_0x14b0('0xb'))(new Redis(config['redis']));require(_0x14b0('0xc'))['register'](socket);try{if(!process[_0x14b0('0xd')][0x2]||process[_0x14b0('0xd')][0x2]===_0x14b0('0xe')||process['argv'][0x2]===_0x14b0('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x14b0('0xd')][0x2];if(!process[_0x14b0('0xd')][0x3]||process[_0x14b0('0xd')][0x3]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x3]==='null'||!process[_0x14b0('0xd')][0x4]||process['argv'][0x4]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x4]===_0x14b0('0xf')){throw new Error(_0x14b0('0x10'));}var FIELDS=_['zipObject'](process[_0x14b0('0xd')][0x3][_0x14b0('0x11')](','),process['argv'][0x4][_0x14b0('0x11')](','));if(!process[_0x14b0('0xd')][0x5]||process[_0x14b0('0xd')][0x5]===_0x14b0('0xe')||process[_0x14b0('0xd')][0x5]===_0x14b0('0xf')){throw new Error(_0x14b0('0x12'));}var LISTID=process[_0x14b0('0xd')][0x5];var COMPANYID=process[_0x14b0('0xd')][0x6]&&process[_0x14b0('0xd')][0x6]!==_0x14b0('0xe')&&process['argv'][0x6]!==_0x14b0('0xf')?process[_0x14b0('0xd')][0x6]:null;var DUPLICATES=process[_0x14b0('0xd')][0x7]&&process[_0x14b0('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x14b0('0xf')?process[_0x14b0('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x14b0('0xd')][0x8]==='undefined'||process['argv'][0x8]===_0x14b0('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x14b0('0xd')][0x8];}catch(_0x39a821){logger[_0x14b0('0x13')](_0x39a821);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(_0x44407b,_0x26d925,_0x8a384,_0x732883){var _0x321a3e={'message':_0x26d925};_0x321a3e[_0x44407b]=!![];if(_0x8a384){_0x321a3e['contact']=_0x8a384;}if(_0x732883){_0x321a3e[_0x14b0('0x14')]=_0x732883;}return _0x321a3e;}function isEmail(_0x10b3f9){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))*$/[_0x14b0('0x15')](_0x10b3f9);}function checkRow(_0x546f07,_0x4aaaa3,_0x1c42fe){return new BPromise(function(_0x268cf4,_0x34f7bd){if(_[_0x14b0('0x16')](_0x546f07)){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x17'),null,_0x1c42fe));}if(_0x546f07[_0x14b0('0x18')]&&_0x546f07[_0x14b0('0x18')][_0x14b0('0x19')]){var _0x13468c=_[_0x14b0('0x1a')](_0x546f07[_0x14b0('0x18')],_0x14b0('0x1b'))[_0x14b0('0x1c')](';');return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x13468c,null,_0x1c42fe));}var _0x33d8a3={};for(var _0x27f821 in FIELDS){if(FIELDS[_0x14b0('0x1d')](_0x27f821)&&FIELDS[_0x27f821]){_0x33d8a3[_0x27f821]=_0x546f07[_0x14b0('0x1e')][0x0][FIELDS[_0x27f821]]||_0x546f07[_0x14b0('0x1e')][0x0]['\ufeff'+FIELDS[_0x27f821]];}}if(!_0x33d8a3['firstName']){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),'firstName\x20not\x20specified!',null,_0x1c42fe));}if(!_0x33d8a3[_0x14b0('0x1f')]){return _0x34f7bd(handleCheckRowError('error',_0x14b0('0x20'),null,_0x1c42fe));}if(_0x33d8a3[_0x14b0('0x21')]){var _0x45adfb=moment(_0x33d8a3[_0x14b0('0x21')],_0x14b0('0x22'));if(!_0x45adfb[_0x14b0('0x23')]()){return _0x34f7bd(handleCheckRowError('error',_0x14b0('0x24'),null,_0x1c42fe));}}if(_0x33d8a3['email']){if(!isEmail(_0x33d8a3[_0x14b0('0x25')])){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x26'),null,_0x1c42fe));}}_0x33d8a3['ListId']=LISTID;_0x33d8a3[_0x14b0('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4aaaa3){var _0x270254={};for(var _0xa7407d=0x0,_0x430cbf=DUPLICATES[_0x14b0('0x19')];_0xa7407d<_0x430cbf;_0xa7407d+=0x1){_0x270254[DUPLICATES[_0xa7407d]]=_0x33d8a3[DUPLICATES[_0xa7407d]];}var _0x3779d8=_[_0x14b0('0x28')](_0x4aaaa3,_0x270254);if(_0x3779d8){return _0x34f7bd(handleCheckRowError(_0x14b0('0x29'),_0x14b0('0x2a'),_0x3779d8,_0x1c42fe));}}return db[_0x14b0('0x2b')]['create'](_0x33d8a3,{'raw':!![],'hooks':![],'fields':_[_0x14b0('0x2c')](_0x33d8a3)})[_0x14b0('0x2d')](function(_0xdef904){if(DUPLICATES&&DUPLICATES[_0x14b0('0x19')]&&_0x4aaaa3){_0x4aaaa3[_0x14b0('0x2e')](_[_0x14b0('0x2f')](_0x33d8a3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xdef904['id'];return _0x268cf4();})[_0x14b0('0x30')](function(_0x592a60){return _0x34f7bd(handleCheckRowError(_0x14b0('0x13'),_0x14b0('0x31')+(_0x592a60[_0x14b0('0x1b')]||JSON['stringify'](_0x592a60)),null,_0x1c42fe));});});}function checkHopper(){function _0x535395(){return function(_0x2295a7){logger['error']('cmContact',_0x14b0('0x32'),util[_0x14b0('0x33')](_0x2295a7,{'showHidden':![],'depth':null}));};}var _0x4e1066=function(_0x2cade0,_0x48b1dd){var _0x46fb06=squel[_0x14b0('0x34')]()[_0x14b0('0x35')](_0x14b0('0x36'))['fromQuery']([_0x14b0('0x1f'),_0x14b0('0x37'),_0x14b0('0x38'),_0x14b0('0x39'),_0x48b1dd,_0x14b0('0x3a'),_0x14b0('0x3b')],squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'),_0x14b0('0x1f'))[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))[_0x14b0('0x3d')](_0x2cade0['id'][_0x14b0('0x3f')](),_0x48b1dd)['field'](_0x14b0('0x3e'),'createdAt')[_0x14b0('0x3d')]('NOW()','updatedAt')['from'](_0x14b0('0x40'))[_0x14b0('0x41')](_0x14b0('0x42'))['where'](_0x14b0('0x43'),LISTID[_0x14b0('0x3f')]())[_0x14b0('0x41')](_0x14b0('0x44'))[_0x14b0('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')]('phone')[_0x14b0('0x45')]('cm_hopper')[_0x14b0('0x41')](_0x48b1dd+'\x20=\x20?',_0x2cade0['id'][_0x14b0('0x3f')]())))[_0x14b0('0x3f')]();return _0x46fb06;};var _0x156ead=function(_0x48cd50,_0x4dcac7){var _0x35f1c3=squel[_0x14b0('0x34')]()['into'](_0x14b0('0x36'))[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x37'),_0x14b0('0x38'),_0x14b0('0x39'),_0x4dcac7,'createdAt',_0x14b0('0x3b')],squel['select']()[_0x14b0('0x3d')](_0x14b0('0x1f'),'phone')[_0x14b0('0x3d')]('NOW()',_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))['field'](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x48cd50['id']['toString'](),_0x4dcac7)[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3a'))[_0x14b0('0x3d')]('NOW()',_0x14b0('0x3b'))[_0x14b0('0x45')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x14b0('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x14b0('0x47'),squel[_0x14b0('0x48')](hopperContacts))['where'](_0x14b0('0x44'))['where'](_0x14b0('0x49'),squel[_0x14b0('0x3c')]()['field'](_0x14b0('0x4a'))[_0x14b0('0x45')](_0x14b0('0x4b'))[_0x14b0('0x41')](_0x4dcac7+'\x20=\x20?',_0x48cd50['id']['toString']()))[_0x14b0('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'))[_0x14b0('0x45')](_0x14b0('0x36'))['where'](_0x4dcac7+_0x14b0('0x4c'),_0x48cd50['id'][_0x14b0('0x3f')]())))[_0x14b0('0x3f')]();return _0x35f1c3;};function _0x6c582b(_0x315d8a,_0x5e13a8){var _0x4f5d21=squel['insert']()[_0x14b0('0x35')]('cm_hopper')[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x37'),'ContactId',_0x14b0('0x39'),_0x5e13a8,'createdAt',_0x14b0('0x3b')],squel[_0x14b0('0x3c')]()[_0x14b0('0x3d')](_0x14b0('0x1f'),'phone')[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x37'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x315d8a['id'][_0x14b0('0x3f')](),_0x5e13a8)[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3a'))['field'](_0x14b0('0x3e'),_0x14b0('0x3b'))[_0x14b0('0x45')]('cm_contacts')[_0x14b0('0x41')](_0x14b0('0x42'))[_0x14b0('0x41')]('ListId\x20=\x20?',LISTID[_0x14b0('0x3f')]())['where'](_0x14b0('0x47'),squel['str'](hopperContacts))[_0x14b0('0x41')](_0x14b0('0x44')))[_0x14b0('0x3f')]();return _0x4f5d21;}function _0x146498(_0x3d75f9,_0x488798){var _0x5f87a3=squel[_0x14b0('0x34')]()[_0x14b0('0x35')](_0x14b0('0x4d'))[_0x14b0('0x46')]([_0x14b0('0x1f'),_0x14b0('0x38'),_0x14b0('0x39'),_0x488798,_0x14b0('0x3a'),_0x14b0('0x3b')],squel['select']()['field'](_0x14b0('0x1f'),_0x14b0('0x1f'))[_0x14b0('0x3d')]('id',_0x14b0('0x38'))[_0x14b0('0x3d')](LISTID[_0x14b0('0x3f')](),_0x14b0('0x39'))['field'](_0x3d75f9['id'][_0x14b0('0x3f')](),_0x488798)[_0x14b0('0x3d')]('NOW()',_0x14b0('0x3a'))[_0x14b0('0x3d')](_0x14b0('0x3e'),_0x14b0('0x3b'))[_0x14b0('0x45')](_0x14b0('0x40'))['where'](_0x14b0('0x42'))['where'](_0x14b0('0x43'),LISTID['toString']())[_0x14b0('0x41')](_0x14b0('0x47'),squel[_0x14b0('0x48')](hopperContacts))[_0x14b0('0x41')](_0x14b0('0x44')))[_0x14b0('0x3f')]();return _0x5f87a3;}return db[_0x14b0('0x4e')][_0x14b0('0x4f')]({'where':{'type':_0x14b0('0x50')},'attributes':['id',_0x14b0('0x51')],'include':[{'model':db['CmList'],'as':_0x14b0('0x52'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x22301a){var _0x2e48b9=[];if(_0x22301a){var _0x50bde0;for(var _0x2b47ef=0x0,_0x3763fc;_0x2b47ef<_0x22301a['length'];_0x2b47ef+=0x1){_0x3763fc=_0x22301a[_0x2b47ef][_0x14b0('0x53')]({'plain':!![]});switch(_0x3763fc[_0x14b0('0x51')]){case _0x14b0('0x54'):_0x2e48b9['push'](db['sequelize'][_0x14b0('0x55')](_0x156ead(_0x3763fc,'VoiceQueueId'))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));break;case _0x14b0('0x56'):_0x2e48b9[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x4e1066(_0x3763fc,'VoiceQueueId'))['then'](function(){})[_0x14b0('0x30')](_0x535395()));break;default:_0x2e48b9[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x6c582b(_0x3763fc,_0x14b0('0x58')))['then'](function(){})[_0x14b0('0x30')](_0x535395()));}}}return _0x2e48b9;})[_0x14b0('0x59')]()[_0x14b0('0x2d')](function(){return db[_0x14b0('0x4e')]['findAll']({'where':{'type':_0x14b0('0x50')},'attributes':['id'],'include':[{'model':db[_0x14b0('0x5a')],'as':_0x14b0('0x5b'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0xc941b3){var _0x343b93=[];if(_0xc941b3){var _0x4ba11f;for(var _0x177130=0x0,_0x11349a;_0x177130<_0xc941b3[_0x14b0('0x19')];_0x177130+=0x1){_0x11349a=_0xc941b3[_0x177130][_0x14b0('0x53')]({'plain':!![]});_0x343b93[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x146498(_0x11349a,_0x14b0('0x58')))['then'](function(){})[_0x14b0('0x30')](_0x535395()));}}return _0x343b93;})[_0x14b0('0x59')]();})['then'](function(){return db[_0x14b0('0x5c')][_0x14b0('0x4f')]({'attributes':['id',_0x14b0('0x51')],'include':[{'model':db['CmList'],'as':_0x14b0('0x52'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x48af6c){var _0x178853=[];if(_0x48af6c){for(var _0x44615d=0x0,_0x100b07;_0x44615d<_0x48af6c[_0x14b0('0x19')];_0x44615d+=0x1){_0x100b07=_0x48af6c[_0x44615d][_0x14b0('0x53')]({'plain':!![]});switch(_0x100b07[_0x14b0('0x51')]){case _0x14b0('0x54'):_0x178853[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x156ead(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})[_0x14b0('0x30')](_0x535395()));break;case _0x14b0('0x56'):_0x178853['push'](db[_0x14b0('0x57')]['query'](_0x4e1066(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));break;default:_0x178853[_0x14b0('0x2e')](db[_0x14b0('0x57')][_0x14b0('0x55')](_0x6c582b(_0x100b07,_0x14b0('0x5d')))[_0x14b0('0x2d')](function(){})['catch'](_0x535395()));}}}return _0x178853;})[_0x14b0('0x59')]();})[_0x14b0('0x2d')](function(){return db[_0x14b0('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x14b0('0x5a')],'as':_0x14b0('0x5b'),'where':{'id':LISTID}}]})[_0x14b0('0x2d')](function(_0x2bab9a){var _0x16ad30=[];if(_0x2bab9a){for(var _0x4dc3f2=0x0,_0x44d949;_0x4dc3f2<_0x2bab9a[_0x14b0('0x19')];_0x4dc3f2+=0x1){_0x44d949=_0x2bab9a[_0x4dc3f2][_0x14b0('0x53')]({'plain':!![]});_0x16ad30['push'](db['sequelize']['query'](_0x146498(_0x44d949,'CampaignId'))[_0x14b0('0x2d')](function(){})[_0x14b0('0x30')](_0x535395()));}}return _0x16ad30;})[_0x14b0('0x59')]();})[_0x14b0('0x30')](function(_0x15e7f3){logger['error'](_0x14b0('0x5e'),_0x14b0('0x5f'),_0x15e7f3[_0x14b0('0x1b')]);});}var processPromises=function(_0x5d6a4c){return BPromise[_0x14b0('0x59')](promises)[_0x14b0('0x2d')](function(_0x1f339d){})[_0x14b0('0x30')](function(_0x8dd5e3){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x14b0('0x60')](_0x8dd5e3));})[_0x14b0('0x61')](function(){socket['emit'](_0x14b0('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d6a4c){return _0x5d6a4c['resume']();}});};var endCsv=function(){return BPromise[_0x14b0('0x63')]()[_0x14b0('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x14b0('0x2d')](function(){socket[_0x14b0('0x64')](_0x14b0('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x14b0('0x65')](FILEPATH);}catch(_0x4559b4){logger['error'](_0x14b0('0x66'),JSON[_0x14b0('0x60')](_0x4559b4));}finally{process[_0x14b0('0x67')](0x0);}});};process['on'](_0x14b0('0x68'),function(){logger[_0x14b0('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x14b0('0x63')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x14b0('0x11')](',');return db[_0x14b0('0x2b')][_0x14b0('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x14b0('0x2d')](function(_0x4961ce){var _0x1d1db8=fs[_0x14b0('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x14b0('0x6b')](_0x1d1db8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dc823,_0xe5504f){total+=0x1;var _0x2b1ba0=total;promises[_0x14b0('0x2e')](checkRow(_0x4dc823,_0x4961ce,_0x2b1ba0)[_0x14b0('0x2d')](function(){success+=0x1;})[_0x14b0('0x30')](function(_0x425835){if(_0x425835[_0x14b0('0x13')]){errors+=0x1;delete _0x425835[_0x14b0('0x13')];}else if(_0x425835['duplicate']){duplicates+=0x1;delete _0x425835[_0x14b0('0x29')];}rows[_0x14b0('0x2e')](_0x425835);}));if(total%0xc8===0x0){_0xe5504f[_0x14b0('0x6c')]();return processPromises(_0xe5504f);}},'complete':function(){return processPromises()[_0x14b0('0x2d')](function(){logger['info'](_0x14b0('0x6d'));endCsv();});},'error':function(_0x137329,_0x182d95){logger[_0x14b0('0x69')]('CSV\x20parse\x20error',JSON['stringify'](_0x137329));endCsv();}});})['catch'](function(_0x39c370){logger[_0x14b0('0x13')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x14b0('0x60')](_0x39c370));});}main(); \ No newline at end of file +var _0x7ad1=['redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','phone','phone\x20not\x20specified!','birthDate','isValid','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','updatedAt','cm_contacts','where','ListId\x20=\x20?','from','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','always','CampaignId','all','Campaign','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults'];(function(_0x54c10d,_0x2f2251){var _0x1fa703=function(_0x508eb4){while(--_0x508eb4){_0x54c10d['push'](_0x54c10d['shift']());}};_0x1fa703(++_0x2f2251);}(_0x7ad1,0x1a0));var _0x17ad=function(_0x43e4ad,_0x45b9ed){_0x43e4ad=_0x43e4ad-0x0;var _0x294aaa=_0x7ad1[_0x43e4ad];return _0x294aaa;};'use strict';var BPromise=require(_0x17ad('0x0'));var util=require(_0x17ad('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x17ad('0x2'));var Redis=require(_0x17ad('0x3'));var db=require(_0x17ad('0x4'))['db'];var config=require(_0x17ad('0x5'));var logger=require(_0x17ad('0x6'))('api');config['redis']=_[_0x17ad('0x7')](config[_0x17ad('0x8')],{'host':_0x17ad('0x9'),'port':0x18eb});var socket=require(_0x17ad('0xa'))(new Redis(config['redis']));require(_0x17ad('0xb'))[_0x17ad('0xc')](socket);try{if(!process[_0x17ad('0xd')][0x2]||process['argv'][0x2]===_0x17ad('0xe')||process[_0x17ad('0xd')][0x2]===_0x17ad('0xf')){throw new Error(_0x17ad('0x10'));}var FILEPATH=process[_0x17ad('0xd')][0x2];if(!process[_0x17ad('0xd')][0x3]||process[_0x17ad('0xd')][0x3]===_0x17ad('0xe')||process[_0x17ad('0xd')][0x3]==='null'||!process['argv'][0x4]||process[_0x17ad('0xd')][0x4]==='undefined'||process[_0x17ad('0xd')][0x4]===_0x17ad('0xf')){throw new Error(_0x17ad('0x11'));}var FIELDS=_[_0x17ad('0x12')](process[_0x17ad('0xd')][0x3][_0x17ad('0x13')](','),process[_0x17ad('0xd')][0x4]['split'](','));if(!process[_0x17ad('0xd')][0x5]||process[_0x17ad('0xd')][0x5]==='undefined'||process['argv'][0x5]===_0x17ad('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x17ad('0xd')][0x6]&&process[_0x17ad('0xd')][0x6]!=='undefined'&&process[_0x17ad('0xd')][0x6]!==_0x17ad('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0x17ad('0xd')][0x7]&&process[_0x17ad('0xd')][0x7]!==_0x17ad('0xe')&&process[_0x17ad('0xd')][0x7]!==_0x17ad('0xf')?process[_0x17ad('0xd')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x17ad('0xd')][0x8]===_0x17ad('0xf')){throw new Error(_0x17ad('0x14'));}var SOCKET_TIMESTAMP=process[_0x17ad('0xd')][0x8];}catch(_0x6a2e2d){logger[_0x17ad('0x15')](_0x6a2e2d);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(_0x47bda4,_0x20cf40,_0x21c804,_0x1b50d8){var _0x37db89={'message':_0x20cf40};_0x37db89[_0x47bda4]=!![];if(_0x21c804){_0x37db89[_0x17ad('0x16')]=_0x21c804;}if(_0x1b50d8){_0x37db89[_0x17ad('0x17')]=_0x1b50d8;}return _0x37db89;}function isEmail(_0x1d1b3a){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))*$/[_0x17ad('0x18')](_0x1d1b3a);}function checkRow(_0x294531,_0x3725ec,_0x40b257){return new BPromise(function(_0x35b17d,_0x8ce856){if(_[_0x17ad('0x19')](_0x294531)){return _0x8ce856(handleCheckRowError(_0x17ad('0x15'),_0x17ad('0x1a'),null,_0x40b257));}if(_0x294531[_0x17ad('0x1b')]&&_0x294531[_0x17ad('0x1b')][_0x17ad('0x1c')]){var _0x17eb62=_[_0x17ad('0x1d')](_0x294531[_0x17ad('0x1b')],_0x17ad('0x1e'))['join'](';');return _0x8ce856(handleCheckRowError(_0x17ad('0x15'),_0x17eb62,null,_0x40b257));}var _0x288f04={};for(var _0x201f6b in FIELDS){if(FIELDS[_0x17ad('0x1f')](_0x201f6b)&&FIELDS[_0x201f6b]){_0x288f04[_0x201f6b]=_0x294531[_0x17ad('0x20')][0x0][FIELDS[_0x201f6b]]||_0x294531[_0x17ad('0x20')][0x0]['\ufeff'+FIELDS[_0x201f6b]];}}if(!_0x288f04[_0x17ad('0x21')]){return _0x8ce856(handleCheckRowError(_0x17ad('0x15'),'firstName\x20not\x20specified!',null,_0x40b257));}if(!_0x288f04[_0x17ad('0x22')]){return _0x8ce856(handleCheckRowError('error',_0x17ad('0x23'),null,_0x40b257));}if(_0x288f04[_0x17ad('0x24')]){var _0xc63e44=moment(_0x288f04['birthDate'],'YYYY-MM-DD');if(!_0xc63e44[_0x17ad('0x25')]()){return _0x8ce856(handleCheckRowError(_0x17ad('0x15'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x40b257));}}if(_0x288f04['email']){if(!isEmail(_0x288f04['email'])){return _0x8ce856(handleCheckRowError('error',_0x17ad('0x26'),null,_0x40b257));}}_0x288f04['ListId']=LISTID;_0x288f04[_0x17ad('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x17ad('0x1c')]&&_0x3725ec){var _0x17f92a={};for(var _0x54c822=0x0,_0x7c6895=DUPLICATES[_0x17ad('0x1c')];_0x54c822<_0x7c6895;_0x54c822+=0x1){_0x17f92a[DUPLICATES[_0x54c822]]=_0x288f04[DUPLICATES[_0x54c822]];}var _0x381be3=_[_0x17ad('0x28')](_0x3725ec,_0x17f92a);if(_0x381be3){return _0x8ce856(handleCheckRowError(_0x17ad('0x29'),_0x17ad('0x2a'),_0x381be3,_0x40b257));}}return db[_0x17ad('0x2b')]['create'](_0x288f04,{'raw':!![],'hooks':![],'fields':_[_0x17ad('0x2c')](_0x288f04)})[_0x17ad('0x2d')](function(_0x31893e){if(DUPLICATES&&DUPLICATES[_0x17ad('0x1c')]&&_0x3725ec){_0x3725ec[_0x17ad('0x2e')](_[_0x17ad('0x2f')](_0x288f04,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x31893e['id'];return _0x35b17d();})[_0x17ad('0x30')](function(_0x26d99a){return _0x8ce856(handleCheckRowError('error',_0x17ad('0x31')+(_0x26d99a[_0x17ad('0x1e')]||JSON[_0x17ad('0x32')](_0x26d99a)),null,_0x40b257));});});}function checkHopper(){function _0x9eb1f1(){return function(_0x3eb388){logger[_0x17ad('0x15')](_0x17ad('0x33'),_0x17ad('0x34'),util['inspect'](_0x3eb388,{'showHidden':![],'depth':null}));};}var _0x1a76a5=function(_0x3696c3,_0x17c762){var _0x2f5332=squel[_0x17ad('0x35')]()[_0x17ad('0x36')](_0x17ad('0x37'))[_0x17ad('0x38')](['phone',_0x17ad('0x39'),_0x17ad('0x3a'),_0x17ad('0x3b'),_0x17c762,_0x17ad('0x3c'),'updatedAt'],squel[_0x17ad('0x3d')]()['field'](_0x17ad('0x22'),_0x17ad('0x22'))[_0x17ad('0x3e')](_0x17ad('0x3f'),_0x17ad('0x39'))[_0x17ad('0x3e')]('id','ContactId')['field'](LISTID[_0x17ad('0x40')](),_0x17ad('0x3b'))['field'](_0x3696c3['id'][_0x17ad('0x40')](),_0x17c762)[_0x17ad('0x3e')](_0x17ad('0x3f'),_0x17ad('0x3c'))[_0x17ad('0x3e')]('NOW()',_0x17ad('0x41'))['from'](_0x17ad('0x42'))['where']('deletedAt\x20IS\x20NULL')[_0x17ad('0x43')](_0x17ad('0x44'),LISTID['toString']())[_0x17ad('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x17ad('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x17ad('0x3d')]()[_0x17ad('0x3e')](_0x17ad('0x22'))[_0x17ad('0x45')]('cm_hopper')['where'](_0x17c762+_0x17ad('0x46'),_0x3696c3['id'][_0x17ad('0x40')]())))[_0x17ad('0x40')]();return _0x2f5332;};var _0x564e53=function(_0x15c2a5,_0x1cb320){var _0x33a77c=squel[_0x17ad('0x35')]()[_0x17ad('0x36')](_0x17ad('0x37'))[_0x17ad('0x38')]([_0x17ad('0x22'),_0x17ad('0x39'),'ContactId',_0x17ad('0x3b'),_0x1cb320,_0x17ad('0x3c'),_0x17ad('0x41')],squel[_0x17ad('0x3d')]()[_0x17ad('0x3e')](_0x17ad('0x22'),'phone')[_0x17ad('0x3e')]('NOW()',_0x17ad('0x39'))[_0x17ad('0x3e')]('id',_0x17ad('0x3a'))[_0x17ad('0x3e')](LISTID[_0x17ad('0x40')](),'ListId')['field'](_0x15c2a5['id'][_0x17ad('0x40')](),_0x1cb320)[_0x17ad('0x3e')](_0x17ad('0x3f'),_0x17ad('0x3c'))[_0x17ad('0x3e')]('NOW()',_0x17ad('0x41'))[_0x17ad('0x45')](_0x17ad('0x42'))[_0x17ad('0x43')](_0x17ad('0x47'))['where'](_0x17ad('0x44'),LISTID[_0x17ad('0x40')]())['where'](_0x17ad('0x48'),squel[_0x17ad('0x49')](hopperContacts))[_0x17ad('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x17ad('0x43')](_0x17ad('0x4a'),squel[_0x17ad('0x3d')]()[_0x17ad('0x3e')]('calleridnum')[_0x17ad('0x45')]('cm_hopper_final')[_0x17ad('0x43')](_0x1cb320+_0x17ad('0x46'),_0x15c2a5['id'][_0x17ad('0x40')]()))[_0x17ad('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x17ad('0x3d')]()[_0x17ad('0x3e')](_0x17ad('0x22'))[_0x17ad('0x45')](_0x17ad('0x37'))[_0x17ad('0x43')](_0x1cb320+_0x17ad('0x46'),_0x15c2a5['id'][_0x17ad('0x40')]())))[_0x17ad('0x40')]();return _0x33a77c;};function _0x412d73(_0x2a70f4,_0x8b7af){var _0x47af59=squel[_0x17ad('0x35')]()[_0x17ad('0x36')](_0x17ad('0x37'))[_0x17ad('0x38')]([_0x17ad('0x22'),'scheduledAt',_0x17ad('0x3a'),_0x17ad('0x3b'),_0x8b7af,_0x17ad('0x3c'),'updatedAt'],squel['select']()[_0x17ad('0x3e')](_0x17ad('0x22'),_0x17ad('0x22'))['field'](_0x17ad('0x3f'),'scheduledAt')['field']('id',_0x17ad('0x3a'))[_0x17ad('0x3e')](LISTID[_0x17ad('0x40')](),_0x17ad('0x3b'))[_0x17ad('0x3e')](_0x2a70f4['id']['toString'](),_0x8b7af)[_0x17ad('0x3e')](_0x17ad('0x3f'),'createdAt')[_0x17ad('0x3e')](_0x17ad('0x3f'),'updatedAt')[_0x17ad('0x45')](_0x17ad('0x42'))['where'](_0x17ad('0x47'))['where'](_0x17ad('0x44'),LISTID[_0x17ad('0x40')]())[_0x17ad('0x43')](_0x17ad('0x48'),squel[_0x17ad('0x49')](hopperContacts))[_0x17ad('0x43')](_0x17ad('0x4b')))[_0x17ad('0x40')]();return _0x47af59;}function _0x564eda(_0x323667,_0x4c874d){var _0x1da1de=squel['insert']()['into'](_0x17ad('0x4c'))[_0x17ad('0x38')]([_0x17ad('0x22'),_0x17ad('0x3a'),_0x17ad('0x3b'),_0x4c874d,_0x17ad('0x3c'),_0x17ad('0x41')],squel[_0x17ad('0x3d')]()['field']('phone',_0x17ad('0x22'))[_0x17ad('0x3e')]('id','ContactId')[_0x17ad('0x3e')](LISTID[_0x17ad('0x40')](),_0x17ad('0x3b'))[_0x17ad('0x3e')](_0x323667['id'][_0x17ad('0x40')](),_0x4c874d)[_0x17ad('0x3e')]('NOW()','createdAt')['field'](_0x17ad('0x3f'),_0x17ad('0x41'))[_0x17ad('0x45')]('cm_contacts')[_0x17ad('0x43')](_0x17ad('0x47'))[_0x17ad('0x43')](_0x17ad('0x44'),LISTID[_0x17ad('0x40')]())[_0x17ad('0x43')](_0x17ad('0x48'),squel[_0x17ad('0x49')](hopperContacts))[_0x17ad('0x43')](_0x17ad('0x4b')))[_0x17ad('0x40')]();return _0x1da1de;}return db[_0x17ad('0x4d')][_0x17ad('0x4e')]({'where':{'type':_0x17ad('0x4f')},'attributes':['id',_0x17ad('0x50')],'include':[{'model':db[_0x17ad('0x51')],'as':_0x17ad('0x52'),'where':{'id':LISTID}}]})[_0x17ad('0x2d')](function(_0x5c56d7){var _0x4731d0=[];if(_0x5c56d7){var _0x4e5e8d;for(var _0x1fbcb3=0x0,_0x36f889;_0x1fbcb3<_0x5c56d7[_0x17ad('0x1c')];_0x1fbcb3+=0x1){_0x36f889=_0x5c56d7[_0x1fbcb3][_0x17ad('0x53')]({'plain':!![]});switch(_0x36f889[_0x17ad('0x50')]){case'always':_0x4731d0[_0x17ad('0x2e')](db[_0x17ad('0x54')][_0x17ad('0x55')](_0x564e53(_0x36f889,_0x17ad('0x56')))[_0x17ad('0x2d')](function(){})[_0x17ad('0x30')](_0x9eb1f1()));break;case _0x17ad('0x57'):_0x4731d0[_0x17ad('0x2e')](db['sequelize'][_0x17ad('0x55')](_0x1a76a5(_0x36f889,'VoiceQueueId'))[_0x17ad('0x2d')](function(){})['catch'](_0x9eb1f1()));break;default:_0x4731d0['push'](db[_0x17ad('0x54')]['query'](_0x412d73(_0x36f889,_0x17ad('0x56')))[_0x17ad('0x2d')](function(){})['catch'](_0x9eb1f1()));}}}return _0x4731d0;})['all']()[_0x17ad('0x2d')](function(){return db[_0x17ad('0x4d')][_0x17ad('0x4e')]({'where':{'type':_0x17ad('0x4f')},'attributes':['id'],'include':[{'model':db[_0x17ad('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x17ad('0x2d')](function(_0x3eebcf){var _0x20b18d=[];if(_0x3eebcf){var _0x526141;for(var _0x286ac1=0x0,_0x58c829;_0x286ac1<_0x3eebcf[_0x17ad('0x1c')];_0x286ac1+=0x1){_0x58c829=_0x3eebcf[_0x286ac1][_0x17ad('0x53')]({'plain':!![]});_0x20b18d[_0x17ad('0x2e')](db[_0x17ad('0x54')]['query'](_0x564eda(_0x58c829,_0x17ad('0x56')))['then'](function(){})[_0x17ad('0x30')](_0x9eb1f1()));}}return _0x20b18d;})['all']();})['then'](function(){return db['Campaign'][_0x17ad('0x4e')]({'attributes':['id',_0x17ad('0x50')],'include':[{'model':db['CmList'],'as':_0x17ad('0x52'),'where':{'id':LISTID}}]})[_0x17ad('0x2d')](function(_0x3c70bc){var _0x2456fe=[];if(_0x3c70bc){for(var _0x519fe0=0x0,_0x19708c;_0x519fe0<_0x3c70bc['length'];_0x519fe0+=0x1){_0x19708c=_0x3c70bc[_0x519fe0][_0x17ad('0x53')]({'plain':!![]});switch(_0x19708c[_0x17ad('0x50')]){case _0x17ad('0x58'):_0x2456fe[_0x17ad('0x2e')](db[_0x17ad('0x54')]['query'](_0x564e53(_0x19708c,_0x17ad('0x59')))['then'](function(){})['catch'](_0x9eb1f1()));break;case _0x17ad('0x57'):_0x2456fe[_0x17ad('0x2e')](db['sequelize'][_0x17ad('0x55')](_0x1a76a5(_0x19708c,_0x17ad('0x59')))[_0x17ad('0x2d')](function(){})[_0x17ad('0x30')](_0x9eb1f1()));break;default:_0x2456fe[_0x17ad('0x2e')](db['sequelize'][_0x17ad('0x55')](_0x412d73(_0x19708c,_0x17ad('0x59')))[_0x17ad('0x2d')](function(){})[_0x17ad('0x30')](_0x9eb1f1()));}}}return _0x2456fe;})[_0x17ad('0x5a')]();})[_0x17ad('0x2d')](function(){return db[_0x17ad('0x5b')][_0x17ad('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x17ad('0x51')],'as':_0x17ad('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x4f6cde){var _0x4e8e24=[];if(_0x4f6cde){for(var _0x585ad2=0x0,_0x25481a;_0x585ad2<_0x4f6cde[_0x17ad('0x1c')];_0x585ad2+=0x1){_0x25481a=_0x4f6cde[_0x585ad2][_0x17ad('0x53')]({'plain':!![]});_0x4e8e24[_0x17ad('0x2e')](db[_0x17ad('0x54')][_0x17ad('0x55')](_0x564eda(_0x25481a,'CampaignId'))[_0x17ad('0x2d')](function(){})[_0x17ad('0x30')](_0x9eb1f1()));}}return _0x4e8e24;})[_0x17ad('0x5a')]();})[_0x17ad('0x30')](function(_0x3e1304){logger[_0x17ad('0x15')](_0x17ad('0x5d'),'generalCheckHopper',_0x3e1304['message']);});}var processPromises=function(_0x1d6171){return BPromise[_0x17ad('0x5a')](promises)[_0x17ad('0x2d')](function(_0x540aeb){})[_0x17ad('0x30')](function(_0x25b025){logger['error'](_0x17ad('0x5e'),JSON[_0x17ad('0x32')](_0x25b025));})[_0x17ad('0x5f')](function(){socket[_0x17ad('0x60')](_0x17ad('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1d6171){return _0x1d6171['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x17ad('0x2d')](function(){socket[_0x17ad('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x17ad('0x62')](FILEPATH);}catch(_0x275d2a){logger[_0x17ad('0x15')](_0x17ad('0x63'),JSON[_0x17ad('0x32')](_0x275d2a));}finally{process[_0x17ad('0x64')](0x0);}});};process['on'](_0x17ad('0x65'),function(){logger[_0x17ad('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x17ad('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x17ad('0x13')](',');return db[_0x17ad('0x2b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4f76e9){var _0x3f22e7=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3f22e7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5035a1,_0x439e29){total+=0x1;var _0x198a00=total;promises[_0x17ad('0x2e')](checkRow(_0x5035a1,_0x4f76e9,_0x198a00)['then'](function(){success+=0x1;})[_0x17ad('0x30')](function(_0x564d88){if(_0x564d88[_0x17ad('0x15')]){errors+=0x1;delete _0x564d88[_0x17ad('0x15')];}else if(_0x564d88[_0x17ad('0x29')]){duplicates+=0x1;delete _0x564d88['duplicate'];}rows['push'](_0x564d88);}));if(total%0xc8===0x0){_0x439e29[_0x17ad('0x67')]();return processPromises(_0x439e29);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x2205b7,_0x3cb1aa){logger['info'](_0x17ad('0x68'),JSON[_0x17ad('0x32')](_0x2205b7));endCsv();}});})[_0x17ad('0x30')](function(_0x420cfd){logger[_0x17ad('0x15')](_0x17ad('0x69'),JSON[_0x17ad('0x32')](_0x420cfd));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5194e25..48d5759 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 _0xf58d=['ContactId','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.updatedAt','insert','ListId','createdAt','cm_hopper_black','toString','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','UserId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','all','timezones','dialTimezone','utcOffset','set','sequelize','main','stringify','binding','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','split','isNil','filter','findOne','CmContactHasItem','update','updated','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery'];(function(_0x432895,_0x5574aa){var _0x61986b=function(_0xf2d4b){while(--_0xf2d4b){_0x432895['push'](_0x432895['shift']());}};_0x61986b(++_0x5574aa);}(_0xf58d,0x149));var _0xdf58=function(_0x1cc2f8,_0x4cfe13){_0x1cc2f8=_0x1cc2f8-0x0;var _0x1e93d5=_0xf58d[_0x1cc2f8];return _0x1e93d5;};'use strict';var fs=require('fs');var path=require(_0xdf58('0x0'));var _=require(_0xdf58('0x1'));var Papa=require(_0xdf58('0x2'));var util=require(_0xdf58('0x3'));var BPromise=require(_0xdf58('0x4'));var moment=require(_0xdf58('0x5'));var squel=require(_0xdf58('0x6'));var Redis=require(_0xdf58('0x7'));var db=require(_0xdf58('0x8'))['db'];var config=require(_0xdf58('0x9'));var shared=require(_0xdf58('0xa'));var logger=require(_0xdf58('0xb'))(_0xdf58('0xc'));config[_0xdf58('0xd')]=_['defaults'](config['redis'],{'host':_0xdf58('0xe'),'port':0x18eb});var socket=require(_0xdf58('0xf'))(new Redis(config[_0xdf58('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xdf58('0x10')]('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()[_0xdf58('0x10')](_0xdf58('0x11'));function isEmail(_0x5b9a62){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))*$/[_0xdf58('0x12')](_0x5b9a62);}function selectNotIn(_0x51e0b4,_0x161fa9,_0x2aa994,_0x57722a,_0xd20a0f){return squel[_0xdf58('0x13')]()[_0xdf58('0x14')](_0xdf58('0x15'))[_0xdf58('0x16')](_0x57722a)['join'](_0x161fa9,null,_0x161fa9+'.id\x20=\x20'+_0x57722a+'.'+_0x2aa994)[_0xdf58('0x17')](_0x57722a+'.'+_0x2aa994+_0xdf58('0x18')+_0x51e0b4+'.'+_0x2aa994)[_0xdf58('0x17')](_0x161fa9+_0xdf58('0x19')+_0xd20a0f[_0xdf58('0x1a')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x104d64,_0x12bb9f){promisesAdditionalPhones=[];return db[_0xdf58('0x1b')][_0xdf58('0x1c')]({'raw':!![],'attributes':['id',_0xdf58('0x1d')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xdf58('0x1e')](function(_0x332303){if(_0x332303!==null){var _0x2d2dd6=[];for(var _0x84720c=0x0;_0x84720c<_0x332303[_0xdf58('0x1f')];_0x84720c++){var _0x55112a=_0x332303[_0x84720c];_0x2d2dd6[_0xdf58('0x20')](insertAdditionalPhones(_0x55112a));}}Promise['all'](_0x2d2dd6)['then'](function(){_0x104d64({'val':0x1});});});});}function insertAdditionalPhones(_0xaa2f68){return new Promise(function(_0x709548,_0x54eea1){var _0x2dfe4b=_0xaa2f68[_0xdf58('0x1d')];var _0x220b3c=_0x2dfe4b[_0xdf58('0x21')](';');var _0x39cf21=[];orderBy=0x0;for(var _0x4f0501=0x0;_0x4f0501<_0x220b3c['length'];_0x4f0501++){_0x39cf21[_0xdf58('0x20')](splitAdditionalPhone(_0xaa2f68['id'],_0x220b3c[_0x4f0501]));}Promise['all'](_0x39cf21)[_0xdf58('0x1e')](function(){_0x709548({'val':_0x220b3c['length']});});});}function splitAdditionalPhone(_0x3f7478,_0x35823b){return new Promise(function(_0x2dfac8,_0x35c135){var _0xfe4b3c=_0x35823b[_0xdf58('0x21')](':');var _0xcadaae=_0xfe4b3c[0x0];var _0x438646=_0xfe4b3c[0x1];if(!_[_0xdf58('0x22')](_0x438646)){var _0x10a90b=_0x438646[_0xdf58('0x21')]('|');var _0xab4fb4=[];for(var _0x44ac02=0x0;_0x44ac02<_0x10a90b['length'];_0x44ac02++){if(_0x10a90b[_0x44ac02]!==''){var _0x15cad8=_[_0xdf58('0x23')](promisesAdditionalPhones,{'contactId':_0x3f7478,'phone':_0x10a90b[_0x44ac02]});if(_0x15cad8[_0xdf58('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xdf58('0x20')]({'contactId':_0x3f7478,'contactTypeId':_0xcadaae,'phone':_0x10a90b[_0x44ac02],'orderBy':orderBy});}}}_0x2dfac8({'ok':0x1});}else _0x2dfac8({'res':0x0});});}function createAdditionalPhone(_0x436616,_0x344ab6,_0x59927f,_0x3e895d){var _0x501aad='';var _0x1e6822='';var _0x3584b8=_0x59927f[_0xdf58('0x21')]('§');_0x501aad=_0x3584b8[0x0];if(_0x3584b8[_0xdf58('0x1f')]==0x2)_0x1e6822=_0x3584b8[0x1];return new Promise(function(_0x1547b5,_0x5030bf){return db['CmContactHasItem'][_0xdf58('0x24')]({'where':{'CmContactId':_0x436616,'item':_0x501aad}})['then'](function(_0x21bb3a){if(_0x21bb3a){return db[_0xdf58('0x25')][_0xdf58('0x26')]({'ItemTypeId':_0x344ab6,'description':_0x1e6822,'OrderBy':_0x3e895d},{'where':{'CmContactId':_0x436616,'item':_0x501aad}})[_0xdf58('0x1e')](function(_0x2216ea){_0x1547b5({'res':_0xdf58('0x27')});});}else{return db[_0xdf58('0x25')]['create']({'CmContactId':_0x436616,'item':_0x501aad,'description':_0x1e6822,'ItemTypeId':_0x344ab6,'OrderBy':_0x3e895d,'ItemClass':_0xdf58('0x28')})[_0xdf58('0x1e')](function(_0x2ead1d){_0x1547b5({'res':_0xdf58('0x29')});});}});});}function insertCmHopper(_0x16e9a6,_0x4bb292,_0x4d3ac2,_0x1b25ee,_0x2b6101){var _0x480e62=['cm_contacts.phone',_0xdf58('0x2a'),_0xdf58('0x2b'),_0xdf58('0x2c'),_0x4bb292+'.'+_0x1b25ee,_0xdf58('0x2d'),'cm_contacts.updatedAt',_0xdf58('0x2e'),_0xdf58('0x2f'),'\x22'+_0x2b6101+'\x22'];return squel['insert']()[_0xdf58('0x30')](_0xdf58('0x31'))[_0xdf58('0x32')](['phone','scheduledat',_0xdf58('0x33'),'ListId',_0x1b25ee,'createdAt',_0xdf58('0x34'),_0xdf58('0x35'),'UserId',_0xdf58('0x36')],squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x480e62)[_0xdf58('0x16')](_0x4bb292)[_0xdf58('0x1a')](_0xdf58('0x38'),null,_0xdf58('0x39')+_0x4bb292+_0xdf58('0x3a'))[_0xdf58('0x1a')](_0x4d3ac2,null,_0x4d3ac2+_0xdf58('0x3b')+_0x4bb292+'.'+_0x1b25ee)[_0xdf58('0x17')](_0x4bb292+_0xdf58('0x3c'),_0x16e9a6)[_0xdf58('0x17')](_0xdf58('0x3d'),NOW)[_0xdf58('0x17')](_0xdf58('0x3e'),selectNotIn(_0x4bb292,_0x4d3ac2,_0x1b25ee,'cm_hopper',[_0xdf58('0x3f'),_0xdf58('0x40')]))['where'](_0xdf58('0x3e'),selectNotIn(_0x4bb292,_0x4d3ac2,_0x1b25ee,_0xdf58('0x31'),[_0xdf58('0x3f')])))['toString']();}function insertCmHopperBlack(_0x1520c8,_0x2f295a,_0x6bb964,_0x1974a5){var _0x5a1cbe=[_0xdf58('0x41'),_0xdf58('0x2b'),'cm_contacts.ListId',_0x2f295a+'.'+_0x1974a5,'cm_contacts.createdAt',_0xdf58('0x42')];return squel[_0xdf58('0x43')]()[_0xdf58('0x30')]('cm_hopper_black')[_0xdf58('0x32')]([_0xdf58('0x15'),_0xdf58('0x33'),_0xdf58('0x44'),_0x1974a5,_0xdf58('0x45'),_0xdf58('0x34')],squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x5a1cbe)['from'](_0x2f295a)[_0xdf58('0x1a')]('cm_contacts',null,_0xdf58('0x39')+_0x2f295a+_0xdf58('0x3a'))[_0xdf58('0x1a')](_0x6bb964,null,_0x6bb964+_0xdf58('0x3b')+_0x2f295a+'.'+_0x1974a5)[_0xdf58('0x17')](_0x2f295a+'.CmListId\x20=\x20?',_0x1520c8)[_0xdf58('0x17')](_0xdf58('0x3d'),NOW)[_0xdf58('0x17')](_0xdf58('0x3e'),squel[_0xdf58('0x13')]()[_0xdf58('0x14')](_0xdf58('0x15'))[_0xdf58('0x16')](_0xdf58('0x46'))[_0xdf58('0x17')]('ListId\x20=\x20?',_0x1520c8)[_0xdf58('0x17')](_0x1974a5+'\x20=\x20'+_0x2f295a+'.'+_0x1974a5)))[_0xdf58('0x47')]();}function insertTzCmHopper(_0xa54f31,_0x2d1d6b,_0x3d3e3a,_0x5e71bf,_0x5a32e3,_0x211366){var _0x474d0b=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x211366+_0xdf58('0x48'),_0xdf58('0x2b'),_0xdf58('0x2c'),_0x2d1d6b+'.'+_0x5e71bf,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0xdf58('0x2f'),'\x22'+_0x5a32e3+'\x22'];var _0x250acc=squel['insert']()['into'](_0xdf58('0x31'))['fromQuery']([_0xdf58('0x15'),_0xdf58('0x49'),_0xdf58('0x33'),_0xdf58('0x44'),_0x5e71bf,_0xdf58('0x45'),'updatedAt',_0xdf58('0x35'),_0xdf58('0x4a'),_0xdf58('0x36')],squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x474d0b)[_0xdf58('0x16')](_0x2d1d6b)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2d1d6b+_0xdf58('0x3a'))[_0xdf58('0x1a')](_0x3d3e3a,null,_0x3d3e3a+_0xdf58('0x3b')+_0x2d1d6b+'.'+_0x5e71bf)[_0xdf58('0x1a')](_0x211366,null,_0x211366+'.id\x20=\x20'+_0x2d1d6b+'.'+_0x5e71bf)['where'](_0x2d1d6b+'.CmListId\x20=\x20?',_0xa54f31)[_0xdf58('0x17')](_0xdf58('0x3d'),NOW)[_0xdf58('0x17')](_0xdf58('0x3e'),selectNotIn(_0x2d1d6b,_0x3d3e3a,_0x5e71bf,_0xdf58('0x31'),[_0xdf58('0x3f'),_0xdf58('0x40')]))[_0xdf58('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2d1d6b,_0x3d3e3a,_0x5e71bf,_0xdf58('0x31'),[_0xdf58('0x3f')])))[_0xdf58('0x47')]();return _0x250acc;}function insertTzCmHopperBlack(_0x1bc05d,_0x48a523,_0x330e53,_0x7cc12d){var _0x279669=[_0xdf58('0x41'),_0xdf58('0x2b'),'cm_contacts.ListId',_0x48a523+'.'+_0x7cc12d,_0xdf58('0x2d'),'cm_contacts.updatedAt'];return squel[_0xdf58('0x43')]()[_0xdf58('0x30')]('cm_hopper_black')[_0xdf58('0x32')]([_0xdf58('0x15'),'ContactId',_0xdf58('0x44'),_0x7cc12d,_0xdf58('0x45'),'updatedAt'],squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x279669)[_0xdf58('0x16')](_0x48a523)[_0xdf58('0x1a')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x48a523+'.CmListId')[_0xdf58('0x1a')](_0x330e53,null,_0x330e53+_0xdf58('0x3b')+_0x48a523+'.'+_0x7cc12d)[_0xdf58('0x17')](_0x48a523+_0xdf58('0x3c'),_0x1bc05d)['where'](_0xdf58('0x3d'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xdf58('0x13')]()[_0xdf58('0x14')](_0xdf58('0x15'))[_0xdf58('0x16')](_0xdf58('0x46'))[_0xdf58('0x17')](_0xdf58('0x4b'),_0x1bc05d)[_0xdf58('0x17')](_0x7cc12d+_0xdf58('0x18')+_0x48a523+'.'+_0x7cc12d)))[_0xdf58('0x47')]();}function insertCmHopperAdditionalPhones(_0x5bad48){var _0x3ffb19=[_0xdf58('0x4c'),_0xdf58('0x4d'),_0xdf58('0x4e'),'cm_contact_has_items.createdAt',_0xdf58('0x4f')];return squel[_0xdf58('0x43')]()[_0xdf58('0x30')](_0xdf58('0x50'))['fromQuery']([_0xdf58('0x51'),'phone',_0xdf58('0x52'),_0xdf58('0x45'),_0xdf58('0x34')],squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x3ffb19)[_0xdf58('0x16')](_0xdf58('0x31'))['join']('cm_contacts',null,_0xdf58('0x53'))['join'](_0xdf58('0x54'),null,_0xdf58('0x55'))[_0xdf58('0x17')](_0xdf58('0x56'),_0x5bad48)['where'](_0xdf58('0x3d'),NOW))[_0xdf58('0x47')]();}function insertCmContact(_0x2d66e5,_0x4b6dcf,_0x38bd99,_0x1c7c05){var _0x484e0c=_[_0xdf58('0x57')](_[_0xdf58('0x58')](_0x1c7c05),[_0xdf58('0x44'),_0xdf58('0x59'),_0xdf58('0x45'),'updatedAt',_0xdf58('0x5a')]);return squel[_0xdf58('0x43')]()[_0xdf58('0x30')](_0xdf58('0x38'))[_0xdf58('0x32')](_0x484e0c,squel[_0xdf58('0x13')]()[_0xdf58('0x37')](_0x484e0c)[_0xdf58('0x16')](_0x4b6dcf)[_0xdf58('0x17')]('('+_0x38bd99[_0xdf58('0x1a')](',')+')\x20NOT\x20IN\x20?',squel[_0xdf58('0x13')]()['fields'](_0x38bd99)['from']('cm_contacts')['where']('ListId\x20=\x20?',_0x2d66e5)['where'](_0xdf58('0x5b')))[_0xdf58('0x17')](_0xdf58('0x5c'),squel[_0xdf58('0x13')]()[_0xdf58('0x14')](_0xdf58('0x5d'),'min_id')[_0xdf58('0x16')](_0x4b6dcf)[_0xdf58('0x5e')](_0x38bd99[_0xdf58('0x1a')](','))))['toString']();}function handleStop(){logger[_0xdf58('0x5f')](_0xdf58('0x60'));stopped=!![];}function handleUncaughtException(_0x29beea){logger[_0xdf58('0x61')](_0x29beea[_0xdf58('0x62')]);process[_0xdf58('0x63')](0x1);}function handleError(_0x431fce,_0x5a273d){stats['errors']['push']({'name':_0x5a273d[_0xdf58('0x64')],'message':_0x5a273d[_0xdf58('0x62')],'row':_0x431fce});}function handleQuery(_0x3468c0){logger[_0xdf58('0x5f')](_0x3468c0);return db['sequelize'][_0xdf58('0x65')](_0x3468c0)[_0xdf58('0x66')](function(_0x33058a){results[_0xdf58('0x20')](_0x33058a);})[_0xdf58('0x67')](function(_0x26f0ae){logger['error'](_0x26f0ae[_0xdf58('0x62')]);});}function updateTzCampaigns(_0x5a27a5){return new Promise(function(_0x5aff03,_0x417b2a){var _0x5e4264=squel[_0xdf58('0x13')]()[_0xdf58('0x37')]([_0xdf58('0x68'),_0xdf58('0x69')])[_0xdf58('0x16')]('campaigns')[_0xdf58('0x1a')](_0xdf58('0x6a'),null,_0xdf58('0x6b'))[_0xdf58('0x17')](_0xdf58('0x6c')+_0x5a27a5);db['sequelize'][_0xdf58('0x65')](_0x5e4264[_0xdf58('0x47')]())[_0xdf58('0x66')](function(_0x2353dc){var _0x2f241f=[];for(var _0x161e15=0x0;_0x161e15<_0x2353dc[_0xdf58('0x1f')];_0x161e15++){_0x2f241f['push'](getTimezoneData(_0x2353dc[_0x161e15],tmp_campaigns));}BPromise['all'](_0x2f241f)['then'](function(){_0x5aff03({'val':0x1});});})[_0xdf58('0x67')](function(_0x421316){logger['error'](_0x421316['message']);_0x5aff03({'val':0x0});});});}function updateTzVoiceQueues(_0x4c5cd5){return new Promise(function(_0x3c290e,_0x92fadc){var _0x4d3ea5=squel['select']()['fields']([_0xdf58('0x6d'),'voice_queues.dialTimezone'])['from'](_0xdf58('0x6e'))[_0xdf58('0x1a')](_0xdf58('0x6f'),null,_0xdf58('0x70'))[_0xdf58('0x17')]('voice_queues_has_cm_lists.CmListId='+_0x4c5cd5);db['sequelize'][_0xdf58('0x65')](_0x4d3ea5[_0xdf58('0x47')]())[_0xdf58('0x66')](function(_0x1642e6){var _0x2e2b60=[];for(var _0x5572da=0x0;_0x5572da<_0x1642e6['length'];_0x5572da++){_0x2e2b60[_0xdf58('0x20')](getTimezoneData(_0x1642e6[_0x5572da],tmp_voice_queues));}BPromise[_0xdf58('0x71')](_0x2e2b60)[_0xdf58('0x1e')](function(){_0x3c290e({'val':0x1});});})[_0xdf58('0x67')](function(_0x49ad1e){logger[_0xdf58('0x61')](_0x49ad1e[_0xdf58('0x62')]);_0x3c290e({'val':0x0});});});}function getTimezoneData(_0x2284c8,_0x4edf51){return new Promise(function(_0x19da12,_0x182ed8){var _0x558e9a=shared[_0xdf58('0x72')];var _0x53c51e=_0x558e9a[_0x2284c8[_0xdf58('0x73')]];if(_[_0xdf58('0x22')](_0x53c51e)){_0x19da12({'ret':0x1});}else{var _0x687396=_0x53c51e[_0xdf58('0x74')];var _0x35c2d4=squel[_0xdf58('0x43')]()[_0xdf58('0x30')](_0x4edf51)[_0xdf58('0x75')]('id',_0x2284c8['id'])[_0xdf58('0x75')]('offset',_0x687396)[_0xdf58('0x75')](_0xdf58('0x73'),_0x2284c8[_0xdf58('0x73')])[_0xdf58('0x47')]();return db['sequelize'][_0xdf58('0x65')](_0x35c2d4)[_0xdf58('0x66')](function(_0x4afc29){_0x19da12({'ret':0x1});})[_0xdf58('0x67')](function(_0x4da597){logger['error'](_0x4da597[_0xdf58('0x62')]);_0x182ed8({'ret':0x1});});}});}function handleTZQuery(_0x4bd9b3){logger[_0xdf58('0x5f')](_0x4bd9b3);return db[_0xdf58('0x76')][_0xdf58('0x65')](_0x4bd9b3)['spread'](function(_0x52326e){})['catch'](function(_0x13fbee){logger[_0xdf58('0x61')](_0x13fbee[_0xdf58('0x62')]);});}function main(_0x5347db,_0x1bd8dd,_0x5acecb,_0x10a8a6){logger[_0xdf58('0x5f')](_0xdf58('0x77'),_0x5347db,JSON[_0xdf58('0x78')](_0x1bd8dd));process['send']('start');var _0x13ea56=_0x1bd8dd[_0xdf58('0x79')];var _0x1c3415=_['clone'](_0x13ea56);var _0x20c251=_0x1bd8dd[_0xdf58('0x7a')];var _0x16bd03=path[_0xdf58('0x1a')](config['root'],_0xdf58('0x7b'),_0x20c251+_0xdf58('0x7c'));hasTZ=_[_0xdf58('0x58')](_0x13ea56)[_0xdf58('0x7d')](_0xdf58('0x73'));var _0x5f4778=_[_0xdf58('0x58')](_0x13ea56)[_0xdf58('0x1a')]();logger[_0xdf58('0x5f')](_0xdf58('0x7e'),_0x5f4778);db[_0xdf58('0x7f')]['findAll']({'raw':!![],'attributes':['id',_0xdf58('0x80')]})[_0xdf58('0x1e')](function(_0x6a6900){for(var _0x3eef0b=0x0;_0x3eef0b<_0x6a6900['length'];_0x3eef0b++){if(_0x6a6900[_0x3eef0b][_0xdf58('0x80')]in _0x13ea56){contactItemTypes[_0xdf58('0x20')](_0x6a6900[_0x3eef0b]);delete _0x1c3415[_0x6a6900[_0x3eef0b][_0xdf58('0x80')]];hasAdditionalPhones=!![];}for(var _0x11806c in _0x13ea56){if(_0x6a6900[_0x3eef0b][_0xdf58('0x80')]+_0xdf58('0x81')===_0x11806c){phoneDescriptions[_0xdf58('0x20')]({'itemTypeId':_0x6a6900[_0x3eef0b]['id'],'description':_0x11806c});delete _0x1c3415[_0x11806c];}}}if(hasAdditionalPhones)_0x1c3415[_0xdf58('0x1d')]='';var _0x125ca8=_['keys'](_0x1c3415)[_0xdf58('0x1a')]();logger[_0xdf58('0x5f')](_0xdf58('0x7e'),_0x125ca8);fs['writeFileSync'](_0x16bd03,_0x125ca8+'\x0a');Papa[_0xdf58('0x82')](fs[_0xdf58('0x83')](_0x5347db),{'header':!![],'skipEmptyLines':!![],'step':function(_0xdf0ac0,_0x180f3b){try{for(var _0x19f3cf=0x0,_0x7ee676=[];_0x19f3cf<_0xdf0ac0[_0xdf58('0x84')][_0xdf58('0x1f')];_0x19f3cf++){stats[_0xdf58('0x85')]+=0x1;if(_0xdf0ac0[_0xdf58('0x86')][_0x19f3cf]){handleError(_0xdf0ac0['data'][_0x19f3cf],_0xdf0ac0['errors'][_0x19f3cf]);}else{var _0x39cb1c=[];var _0x1d057e=[];var _0x1fcb79={};for(var _0x24f8ac in _0x13ea56){let _0x376940=contactItemTypes[_0xdf58('0x87')](_0x25cf7d=>_0x25cf7d[_0xdf58('0x80')]===_0x24f8ac);let _0x455f41=contactItemTypes['find'](_0x44b566=>_0x44b566[_0xdf58('0x80')]+_0xdf58('0x81')===_0x24f8ac);if(_[_0xdf58('0x22')](_0x376940)&&_[_0xdf58('0x22')](_0x455f41)){if(_0x13ea56[_0xdf58('0x88')](_0x24f8ac)){if(_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]]){var _0x16efec=_[_0xdf58('0x89')](_0xdf0ac0['data'][_0x19f3cf][_0x13ea56[_0x24f8ac]][_0xdf58('0x8a')](/"/g,'\x27'));switch(_0x24f8ac){case'scheduledat':var _0x167891=moment(_0x16efec,_0xdf58('0x11'),!![]);if(_0x167891[_0xdf58('0x8b')]()){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xdf58('0x35'):var _0x50bb97=parseInt(_0x16efec);_0x16efec=_[_0xdf58('0x8c')](_0x50bb97)||_0x50bb97<0x0||_0x50bb97>0x4?_0x10a8a6?0x3:0x2:_0x50bb97;_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');break;case _0xdf58('0x4a'):var _0x137cdf=parseInt(_0x16efec);if(_[_0xdf58('0x8d')](_0x137cdf)&&_['includes'](_0x5acecb,_0x137cdf)){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x137cdf+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x8e'));}break;case _0xdf58('0x8f'):if(isEmail(_0x16efec)){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x90'));}break;case'dateOfBirth':var _0x32ecf5=moment(_0x16efec,_0xdf58('0x91'),!![]);if(_0x32ecf5[_0xdf58('0x8b')]()){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}else{_0x39cb1c[_0xdf58('0x20')](_0xdf58('0x92'));}break;case'dialTimezone':var _0x513ea9=shared['timezones'];var _0x378f25=_0x513ea9[_0x16efec];if(!_[_0xdf58('0x22')](_0x378f25)){var _0x576910=_0x378f25['utcOffset'];_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');_0x7ee676[_0xdf58('0x20')]('\x22'+_0x576910+'\x22');}break;default:_0x7ee676[_0xdf58('0x20')]('\x22'+_0x16efec+'\x22');}}else{switch(_0x24f8ac){case _0xdf58('0x93'):case _0xdf58('0x15'):_0x39cb1c['push'](_0x24f8ac+_0xdf58('0x94'));break;default:_0x7ee676[_0xdf58('0x20')]('\x22\x22');}}}}else{var _0x41b692='';if(!_[_0xdf58('0x22')](_0x376940)){if(!_0x1fcb79[_0xdf58('0x88')](_0x376940['id'])){if(!_[_0xdf58('0x22')](_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]])){var _0x16efec=_[_0xdf58('0x89')](_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf][_0x13ea56[_0x24f8ac]][_0xdf58('0x8a')](/"/g,'\x27'));var _0xc5d9a6=phoneDescriptions[_0xdf58('0x87')](_0x2294d9=>_0x2294d9['itemTypeId']===_0x376940['id']);if(!_['isNil'](_0xc5d9a6)){var _0x1a8871=_['trim'](_0xdf0ac0['data'][_0x19f3cf][_0x13ea56[_0xc5d9a6[_0xdf58('0x95')]]][_0xdf58('0x8a')](/"/g,'\x27'));if(!_[_0xdf58('0x22')](_0x1a8871))_0x16efec=_0x16efec+'§'+_0x1a8871;}if(_0x41b692=='')_0x41b692=_0x16efec;else _0x41b692+='|'+_0x16efec;}_0x1d057e['push'](_0x376940['id']+':'+_0x41b692);_0x1fcb79[_0x376940['id']]=0x1;}}}}if(hasAdditionalPhones){_0x7ee676[_0xdf58('0x20')]('\x22'+_0x1d057e[_0xdf58('0x1a')](';')+'\x22');}if(_0x39cb1c['length']){handleError(_0xdf0ac0[_0xdf58('0x84')][_0x19f3cf],{'code':_0xdf58('0x96'),'message':_0x39cb1c[_0xdf58('0x1a')]()});}else{fs['appendFileSync'](_0x16bd03,_0x7ee676[_0xdf58('0x1a')]()+'\x0a');}_0x7ee676=[];}if(!(stats[_0xdf58('0x85')]%0xc8)){socket[_0xdf58('0x97')](_0xdf58('0x98')+_0x20c251,stats);stats[_0xdf58('0x86')]=[];}}if(stopped){logger[_0xdf58('0x5f')](_0xdf58('0x99'));_0x180f3b[_0xdf58('0x9a')]();}}catch(_0x5e059c){handleError(_0xdf0ac0['data'][_0x19f3cf],{'code':_0xdf58('0x9b'),'message':_0x5e059c[_0xdf58('0x62')]});logger[_0xdf58('0x61')](_0xdf58('0x9c'),_0x5e059c[_0xdf58('0x62')]);}},'complete':function(){try{var _0x1c4306=[];var _0x342f17=[];var _0x330d76=_0xdf58('0x38');if(_0x1bd8dd[_0xdf58('0x9d')]&&_0x1bd8dd[_0xdf58('0x9d')]['length']){_0x330d76=_0xdf58('0x9e')+_0x20c251;_0x1c4306[_0xdf58('0x20')](_0xdf58('0x9f')+_0x330d76+_0xdf58('0xa0'));}tmp_campaigns=_0xdf58('0xa1')+_0x20c251;tmp_voice_queues=_0xdf58('0xa2')+_0x20c251;_0x342f17[_0xdf58('0x20')](_0xdf58('0x9f')+tmp_campaigns+_0xdf58('0xa3'));_0x342f17[_0xdf58('0x20')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xdf58('0xa3'));BPromise[_0xdf58('0xa4')](_0x342f17,handleTZQuery)[_0xdf58('0x1e')](function(_0x28a23c){updateTzCampaigns(_0x1bd8dd['ListId'])[_0xdf58('0x1e')](function(_0x28b576){updateTzVoiceQueues(_0x1bd8dd['ListId'])[_0xdf58('0x1e')](function(_0x5324dd){if(hasTZ)_0x125ca8=_0x125ca8['replace'](_0xdf58('0x73'),_0xdf58('0xa5'));var _0x596390=util[_0xdf58('0x10')]('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',_0x16bd03,_0x330d76,_0x125ca8,_0x1bd8dd['ListId'],_0x1bd8dd['CompanyId']||null,NOW,NOW);if(_[_0xdf58('0x22')](_0x13ea56[_0xdf58('0x49')])){_0x596390+=_0xdf58('0xa6');}_0x1c4306['push'](_0x596390);if(_0x1bd8dd[_0xdf58('0x9d')]&&_0x1bd8dd[_0xdf58('0x9d')]['length']){_0x1c4306[_0xdf58('0x20')](insertCmContact(_0x1bd8dd[_0xdf58('0x44')],_0x330d76,_0x1bd8dd[_0xdf58('0x9d')],_0x13ea56));_0x1c4306[_0xdf58('0x20')](_0xdf58('0xa7')+_0x330d76+';');}BPromise[_0xdf58('0xa4')](_0x1c4306,handleQuery)[_0xdf58('0x1e')](function(_0x2ae9ed){BPromise[_0xdf58('0x71')]([handleAdditionalPhones()])[_0xdf58('0x1e')](function(){_0x1c4306=[];for(var _0x4d9ea1=0x0;_0x4d9ea1\x20\x20');}var _0xc554c=path[_0xdf58('0x1a')](config['root'],_0xdf58('0x7b'),process[_0xdf58('0xb4')][0x2]);if(!fs[_0xdf58('0xb5')](_0xc554c)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3405a1={};try{_0x3405a1=JSON[_0xdf58('0x82')](process[_0xdf58('0xb4')][0x3]);if(!_0x3405a1[_0xdf58('0x79')]){throw new Error(_0xdf58('0xb6'));}if(!_0x3405a1['binding'][_0xdf58('0x15')]){throw new Error(_0xdf58('0xb7'));}if(!_0x3405a1[_0xdf58('0x79')][_0xdf58('0x93')]){throw new Error('firstName\x20is\x20mandatory');}var _0x130f09=0x0;if(_0x3405a1[_0xdf58('0x79')][_0xdf58('0x4a')]){_0x130f09=0x1;}if(!_0x3405a1[_0xdf58('0x44')]){throw new Error(_0xdf58('0xb8'));}}catch(_0x92b257){throw new Error(_0xdf58('0xb9'));}var _0x590ab4=[];try{_0x590ab4=_[_0xdf58('0xba')](JSON[_0xdf58('0x82')](process['argv'][0x4]),'id');}catch(_0x5d30a6){logger[_0xdf58('0x5f')](_0xdf58('0xbb'));}main(_0xc554c,_0x3405a1,_0x590ab4,_0x130f09);}validate();process['on'](_0xdf58('0xbc'),handleStop);process['on'](_0xdf58('0xbd'),handleUncaughtException); \ No newline at end of file +var _0x2f17=['cm_hopper','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','fromQuery','updatedAt','cm_contacts','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','cm_contacts.createdAt\x20=\x20?','field','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','errors','sequelize','query','spread','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','all','catch','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','root','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','replace','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','DROP\x20TABLE\x20','contactTypeId','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','defaults','redis','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','length','then','split','push','isNil','filter','findOne','CmContactHasItem','update','updated','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into'];(function(_0x4be5ca,_0x8eec00){var _0x1a0437=function(_0x29c166){while(--_0x29c166){_0x4be5ca['push'](_0x4be5ca['shift']());}};_0x1a0437(++_0x8eec00);}(_0x2f17,0x1e0));var _0x72f1=function(_0x3b7f8f,_0x4be761){_0x3b7f8f=_0x3b7f8f-0x0;var _0x240250=_0x2f17[_0x3b7f8f];return _0x240250;};'use strict';var fs=require('fs');var path=require(_0x72f1('0x0'));var _=require(_0x72f1('0x1'));var Papa=require(_0x72f1('0x2'));var util=require(_0x72f1('0x3'));var BPromise=require(_0x72f1('0x4'));var moment=require(_0x72f1('0x5'));var squel=require(_0x72f1('0x6'));var Redis=require(_0x72f1('0x7'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x72f1('0x8'));var logger=require(_0x72f1('0x9'))(_0x72f1('0xa'));config['redis']=_[_0x72f1('0xb')](config[_0x72f1('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72f1('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x72f1('0xd')]('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()[_0x72f1('0xd')](_0x72f1('0xe'));function isEmail(_0xb508c5){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'](_0xb508c5);}function selectNotIn(_0x1cc384,_0x52b2d7,_0x3c1cd4,_0x1fe2e3,_0x18b193){return squel[_0x72f1('0xf')]()['field'](_0x72f1('0x10'))[_0x72f1('0x11')](_0x1fe2e3)[_0x72f1('0x12')](_0x52b2d7,null,_0x52b2d7+_0x72f1('0x13')+_0x1fe2e3+'.'+_0x3c1cd4)[_0x72f1('0x14')](_0x1fe2e3+'.'+_0x3c1cd4+_0x72f1('0x15')+_0x1cc384+'.'+_0x3c1cd4)[_0x72f1('0x14')](_0x52b2d7+_0x72f1('0x16')+_0x18b193[_0x72f1('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5f55ea,_0x1e278b){promisesAdditionalPhones=[];return db[_0x72f1('0x17')]['findAll']({'raw':!![],'attributes':['id',_0x72f1('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x52b73b){if(_0x52b73b!==null){var _0x59b39f=[];for(var _0x599462=0x0;_0x599462<_0x52b73b[_0x72f1('0x19')];_0x599462++){var _0x5008e6=_0x52b73b[_0x599462];_0x59b39f['push'](insertAdditionalPhones(_0x5008e6));}}Promise['all'](_0x59b39f)[_0x72f1('0x1a')](function(){_0x5f55ea({'val':0x1});});});});}function insertAdditionalPhones(_0x45aea1){return new Promise(function(_0x276c05,_0x4d5d32){var _0x22fee4=_0x45aea1['AdditionalPhones'];var _0x31738a=_0x22fee4[_0x72f1('0x1b')](';');var _0x17e76d=[];orderBy=0x0;for(var _0x55603e=0x0;_0x55603e<_0x31738a[_0x72f1('0x19')];_0x55603e++){_0x17e76d[_0x72f1('0x1c')](splitAdditionalPhone(_0x45aea1['id'],_0x31738a[_0x55603e]));}Promise['all'](_0x17e76d)['then'](function(){_0x276c05({'val':_0x31738a[_0x72f1('0x19')]});});});}function splitAdditionalPhone(_0x2adc24,_0x517e3b){return new Promise(function(_0x1dbec7,_0x1214c0){var _0x36db7f=_0x517e3b['split'](':');var _0x1202f4=_0x36db7f[0x0];var _0x3a7c58=_0x36db7f[0x1];if(!_[_0x72f1('0x1d')](_0x3a7c58)){var _0x4e32dc=_0x3a7c58['split']('|');var _0x2aafe4=[];for(var _0x129f26=0x0;_0x129f26<_0x4e32dc[_0x72f1('0x19')];_0x129f26++){if(_0x4e32dc[_0x129f26]!==''){var _0x2ee9cd=_[_0x72f1('0x1e')](promisesAdditionalPhones,{'contactId':_0x2adc24,'phone':_0x4e32dc[_0x129f26]});if(_0x2ee9cd[_0x72f1('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x72f1('0x1c')]({'contactId':_0x2adc24,'contactTypeId':_0x1202f4,'phone':_0x4e32dc[_0x129f26],'orderBy':orderBy});}}}_0x1dbec7({'ok':0x1});}else _0x1dbec7({'res':0x0});});}function createAdditionalPhone(_0x568284,_0x4602a6,_0x11bc4f,_0x11ad16){var _0x205cd6='';var _0x34410f='';var _0x517ace=_0x11bc4f[_0x72f1('0x1b')]('§');_0x205cd6=_0x517ace[0x0];if(_0x517ace[_0x72f1('0x19')]==0x2)_0x34410f=_0x517ace[0x1];return new Promise(function(_0x57549a,_0x410d0f){return db['CmContactHasItem'][_0x72f1('0x1f')]({'where':{'CmContactId':_0x568284,'item':_0x205cd6}})[_0x72f1('0x1a')](function(_0x5b8b8c){if(_0x5b8b8c){return db[_0x72f1('0x20')][_0x72f1('0x21')]({'ItemTypeId':_0x4602a6,'description':_0x34410f,'OrderBy':_0x11ad16},{'where':{'CmContactId':_0x568284,'item':_0x205cd6}})[_0x72f1('0x1a')](function(_0xfd313e){_0x57549a({'res':_0x72f1('0x22')});});}else{return db['CmContactHasItem'][_0x72f1('0x23')]({'CmContactId':_0x568284,'item':_0x205cd6,'description':_0x34410f,'ItemTypeId':_0x4602a6,'OrderBy':_0x11ad16,'ItemClass':'PHONE'})[_0x72f1('0x1a')](function(_0x1f63ee){_0x57549a({'res':_0x72f1('0x24')});});}});});}function insertCmHopper(_0x5937b5,_0x3d2931,_0x1224f6,_0x4235b4,_0x1493da){var _0x1f4ecd=['cm_contacts.phone',_0x72f1('0x25'),_0x72f1('0x26'),_0x72f1('0x27'),_0x3d2931+'.'+_0x4235b4,'cm_contacts.createdAt',_0x72f1('0x28'),_0x72f1('0x29'),_0x72f1('0x2a'),'\x22'+_0x1493da+'\x22'];return squel[_0x72f1('0x2b')]()[_0x72f1('0x2c')](_0x72f1('0x2d'))['fromQuery']([_0x72f1('0x10'),'scheduledat',_0x72f1('0x2e'),_0x72f1('0x2f'),_0x4235b4,_0x72f1('0x30'),'updatedAt','priority',_0x72f1('0x31'),_0x72f1('0x32')],squel['select']()[_0x72f1('0x33')](_0x1f4ecd)[_0x72f1('0x11')](_0x3d2931)['join']('cm_contacts',null,_0x72f1('0x34')+_0x3d2931+_0x72f1('0x35'))[_0x72f1('0x12')](_0x1224f6,null,_0x1224f6+_0x72f1('0x13')+_0x3d2931+'.'+_0x4235b4)['where'](_0x3d2931+_0x72f1('0x36'),_0x5937b5)[_0x72f1('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x72f1('0x14')](_0x72f1('0x37'),selectNotIn(_0x3d2931,_0x1224f6,_0x4235b4,'cm_hopper',[_0x72f1('0x38'),_0x72f1('0x39')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3d2931,_0x1224f6,_0x4235b4,_0x72f1('0x2d'),[_0x72f1('0x38')])))[_0x72f1('0x3a')]();}function insertCmHopperBlack(_0x1a54bc,_0x398795,_0x1f3d15,_0x541344){var _0x332223=[_0x72f1('0x3b'),_0x72f1('0x26'),'cm_contacts.ListId',_0x398795+'.'+_0x541344,_0x72f1('0x3c'),_0x72f1('0x28')];return squel[_0x72f1('0x2b')]()[_0x72f1('0x2c')](_0x72f1('0x3d'))[_0x72f1('0x3e')]([_0x72f1('0x10'),'ContactId',_0x72f1('0x2f'),_0x541344,'createdAt',_0x72f1('0x3f')],squel[_0x72f1('0xf')]()[_0x72f1('0x33')](_0x332223)[_0x72f1('0x11')](_0x398795)[_0x72f1('0x12')](_0x72f1('0x40'),null,_0x72f1('0x34')+_0x398795+_0x72f1('0x35'))['join'](_0x1f3d15,null,_0x1f3d15+'.id\x20=\x20'+_0x398795+'.'+_0x541344)[_0x72f1('0x14')](_0x398795+_0x72f1('0x36'),_0x1a54bc)[_0x72f1('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x72f1('0x14')](_0x72f1('0x37'),squel['select']()['field']('phone')[_0x72f1('0x11')](_0x72f1('0x3d'))[_0x72f1('0x14')](_0x72f1('0x41'),_0x1a54bc)[_0x72f1('0x14')](_0x541344+_0x72f1('0x15')+_0x398795+'.'+_0x541344)))['toString']();}function insertTzCmHopper(_0x28cbc5,_0x29cb94,_0x5537db,_0x39407d,_0x59cc72,_0x1679f){var _0x2deefe=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x1679f+_0x72f1('0x42'),_0x72f1('0x26'),_0x72f1('0x27'),_0x29cb94+'.'+_0x39407d,_0x72f1('0x3c'),'cm_contacts.updatedAt',_0x72f1('0x29'),_0x72f1('0x2a'),'\x22'+_0x59cc72+'\x22'];var _0xf66611=squel[_0x72f1('0x2b')]()['into']('cm_hopper')[_0x72f1('0x3e')]([_0x72f1('0x10'),_0x72f1('0x43'),_0x72f1('0x2e'),_0x72f1('0x2f'),_0x39407d,_0x72f1('0x30'),_0x72f1('0x3f'),'priority',_0x72f1('0x31'),_0x72f1('0x32')],squel[_0x72f1('0xf')]()[_0x72f1('0x33')](_0x2deefe)[_0x72f1('0x11')](_0x29cb94)['join'](_0x72f1('0x40'),null,_0x72f1('0x34')+_0x29cb94+'.CmListId')[_0x72f1('0x12')](_0x5537db,null,_0x5537db+_0x72f1('0x13')+_0x29cb94+'.'+_0x39407d)[_0x72f1('0x12')](_0x1679f,null,_0x1679f+_0x72f1('0x13')+_0x29cb94+'.'+_0x39407d)[_0x72f1('0x14')](_0x29cb94+'.CmListId\x20=\x20?',_0x28cbc5)['where'](_0x72f1('0x44'),NOW)['where'](_0x72f1('0x37'),selectNotIn(_0x29cb94,_0x5537db,_0x39407d,'cm_hopper',[_0x72f1('0x38'),_0x72f1('0x39')]))[_0x72f1('0x14')](_0x72f1('0x37'),selectNotIn(_0x29cb94,_0x5537db,_0x39407d,'cm_hopper',[_0x72f1('0x38')])))[_0x72f1('0x3a')]();return _0xf66611;}function insertTzCmHopperBlack(_0x4f865a,_0x2c9bac,_0x30933a,_0x181f9c){var _0x119f82=[_0x72f1('0x3b'),_0x72f1('0x26'),'cm_contacts.ListId',_0x2c9bac+'.'+_0x181f9c,'cm_contacts.createdAt',_0x72f1('0x28')];return squel['insert']()['into']('cm_hopper_black')['fromQuery']([_0x72f1('0x10'),_0x72f1('0x2e'),'ListId',_0x181f9c,'createdAt',_0x72f1('0x3f')],squel[_0x72f1('0xf')]()[_0x72f1('0x33')](_0x119f82)[_0x72f1('0x11')](_0x2c9bac)['join'](_0x72f1('0x40'),null,_0x72f1('0x34')+_0x2c9bac+_0x72f1('0x35'))['join'](_0x30933a,null,_0x30933a+'.id\x20=\x20'+_0x2c9bac+'.'+_0x181f9c)[_0x72f1('0x14')](_0x2c9bac+_0x72f1('0x36'),_0x4f865a)[_0x72f1('0x14')](_0x72f1('0x44'),NOW)[_0x72f1('0x14')](_0x72f1('0x37'),squel['select']()[_0x72f1('0x45')](_0x72f1('0x10'))['from'](_0x72f1('0x3d'))[_0x72f1('0x14')](_0x72f1('0x41'),_0x4f865a)[_0x72f1('0x14')](_0x181f9c+_0x72f1('0x15')+_0x2c9bac+'.'+_0x181f9c)))[_0x72f1('0x3a')]();}function insertCmHopperAdditionalPhones(_0x2b9c97){var _0x3f8480=['cm_hopper.id',_0x72f1('0x46'),_0x72f1('0x47'),_0x72f1('0x48'),_0x72f1('0x49')];return squel['insert']()['into'](_0x72f1('0x4a'))[_0x72f1('0x3e')](['CmHopperId',_0x72f1('0x10'),_0x72f1('0x4b'),'createdAt',_0x72f1('0x3f')],squel[_0x72f1('0xf')]()[_0x72f1('0x33')](_0x3f8480)[_0x72f1('0x11')](_0x72f1('0x2d'))[_0x72f1('0x12')](_0x72f1('0x40'),null,_0x72f1('0x4c'))['join'](_0x72f1('0x4d'),null,_0x72f1('0x4e'))[_0x72f1('0x14')](_0x72f1('0x4f'),_0x2b9c97)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x72f1('0x3a')]();}function insertCmContact(_0xfd170,_0x1223ee,_0x3acfb0,_0x31349d){var _0x147abf=_[_0x72f1('0x50')](_['keys'](_0x31349d),[_0x72f1('0x2f'),_0x72f1('0x51'),_0x72f1('0x30'),_0x72f1('0x3f'),_0x72f1('0x52')]);return squel[_0x72f1('0x2b')]()['into'](_0x72f1('0x40'))[_0x72f1('0x3e')](_0x147abf,squel['select']()[_0x72f1('0x33')](_0x147abf)[_0x72f1('0x11')](_0x1223ee)[_0x72f1('0x14')]('('+_0x3acfb0['join'](',')+_0x72f1('0x53'),squel['select']()['fields'](_0x3acfb0)[_0x72f1('0x11')]('cm_contacts')[_0x72f1('0x14')](_0x72f1('0x41'),_0xfd170)[_0x72f1('0x14')](_0x72f1('0x54')))['where'](_0x72f1('0x55'),squel[_0x72f1('0xf')]()[_0x72f1('0x45')](_0x72f1('0x56'),'min_id')[_0x72f1('0x11')](_0x1223ee)['group'](_0x3acfb0[_0x72f1('0x12')](','))))['toString']();}function handleStop(){logger[_0x72f1('0x57')](_0x72f1('0x58'));stopped=!![];}function handleUncaughtException(_0x4ff289){logger[_0x72f1('0x59')](_0x4ff289[_0x72f1('0x5a')]);process['exit'](0x1);}function handleError(_0x5b0895,_0x566323){stats[_0x72f1('0x5b')][_0x72f1('0x1c')]({'name':_0x566323['code'],'message':_0x566323[_0x72f1('0x5a')],'row':_0x5b0895});}function handleQuery(_0x5d9da1){logger[_0x72f1('0x57')](_0x5d9da1);return db[_0x72f1('0x5c')][_0x72f1('0x5d')](_0x5d9da1)[_0x72f1('0x5e')](function(_0x24336b){results[_0x72f1('0x1c')](_0x24336b);})['catch'](function(_0x1fb8e4){logger['error'](_0x1fb8e4[_0x72f1('0x5a')]);});}function updateTzCampaigns(_0x38142b){return new Promise(function(_0x3ff9e8,_0x4fdbe3){var _0x5a2190=squel['select']()[_0x72f1('0x33')](['campaigns.id','campaigns.dialTimezone'])[_0x72f1('0x11')](_0x72f1('0x5f'))[_0x72f1('0x12')](_0x72f1('0x60'),null,_0x72f1('0x61'))[_0x72f1('0x14')]('campaigns_has_cm_lists.CmListId='+_0x38142b);db[_0x72f1('0x5c')][_0x72f1('0x5d')](_0x5a2190[_0x72f1('0x3a')]())[_0x72f1('0x5e')](function(_0x30626e){var _0x385050=[];for(var _0xbd0cab=0x0;_0xbd0cab<_0x30626e[_0x72f1('0x19')];_0xbd0cab++){_0x385050[_0x72f1('0x1c')](getTimezoneData(_0x30626e[_0xbd0cab],tmp_campaigns));}BPromise[_0x72f1('0x62')](_0x385050)[_0x72f1('0x1a')](function(){_0x3ff9e8({'val':0x1});});})[_0x72f1('0x63')](function(_0x3b0c7c){logger[_0x72f1('0x59')](_0x3b0c7c['message']);_0x3ff9e8({'val':0x0});});});}function updateTzVoiceQueues(_0xaa1a1){return new Promise(function(_0x53d375,_0x2fc7a2){var _0x24d227=squel[_0x72f1('0xf')]()[_0x72f1('0x33')]([_0x72f1('0x64'),'voice_queues.dialTimezone'])[_0x72f1('0x11')](_0x72f1('0x65'))[_0x72f1('0x12')](_0x72f1('0x66'),null,_0x72f1('0x67'))[_0x72f1('0x14')]('voice_queues_has_cm_lists.CmListId='+_0xaa1a1);db['sequelize'][_0x72f1('0x5d')](_0x24d227['toString']())[_0x72f1('0x5e')](function(_0x2c60e4){var _0x580803=[];for(var _0x10909f=0x0;_0x10909f<_0x2c60e4[_0x72f1('0x19')];_0x10909f++){_0x580803[_0x72f1('0x1c')](getTimezoneData(_0x2c60e4[_0x10909f],tmp_voice_queues));}BPromise[_0x72f1('0x62')](_0x580803)[_0x72f1('0x1a')](function(){_0x53d375({'val':0x1});});})['catch'](function(_0x14dd46){logger['error'](_0x14dd46[_0x72f1('0x5a')]);_0x53d375({'val':0x0});});});}function getTimezoneData(_0x5c9e6d,_0xdac4e4){return new Promise(function(_0x32edc8,_0xc98a4){var _0x514c00=shared[_0x72f1('0x68')];var _0x5551b7=_0x514c00[_0x5c9e6d[_0x72f1('0x69')]];if(_[_0x72f1('0x1d')](_0x5551b7)){_0x32edc8({'ret':0x1});}else{var _0x2c7166=_0x5551b7[_0x72f1('0x6a')];var _0xa1ded5=squel[_0x72f1('0x2b')]()[_0x72f1('0x2c')](_0xdac4e4)[_0x72f1('0x6b')]('id',_0x5c9e6d['id'])[_0x72f1('0x6b')](_0x72f1('0x6c'),_0x2c7166)[_0x72f1('0x6b')](_0x72f1('0x69'),_0x5c9e6d[_0x72f1('0x69')])[_0x72f1('0x3a')]();return db[_0x72f1('0x5c')][_0x72f1('0x5d')](_0xa1ded5)['spread'](function(_0xeb6791){_0x32edc8({'ret':0x1});})['catch'](function(_0x273b05){logger[_0x72f1('0x59')](_0x273b05[_0x72f1('0x5a')]);_0xc98a4({'ret':0x1});});}});}function handleTZQuery(_0x8d8ce5){logger[_0x72f1('0x57')](_0x8d8ce5);return db[_0x72f1('0x5c')]['query'](_0x8d8ce5)['spread'](function(_0x577a0f){})[_0x72f1('0x63')](function(_0x50a32d){logger['error'](_0x50a32d[_0x72f1('0x5a')]);});}function main(_0x589667,_0x2ac176,_0x5e3469,_0x43fbb2){logger['info'](_0x72f1('0x6d'),_0x589667,JSON[_0x72f1('0x6e')](_0x2ac176));process[_0x72f1('0x6f')]('start');var _0x212bce=_0x2ac176['binding'];var _0x451b46=_['clone'](_0x212bce);var _0x5713f5=_0x2ac176['socket_timestamp'];var _0x5b0cff=path[_0x72f1('0x12')](config[_0x72f1('0x70')],_0x72f1('0x71'),_0x5713f5+_0x72f1('0x72'));hasTZ=_[_0x72f1('0x73')](_0x212bce)[_0x72f1('0x74')](_0x72f1('0x69'));var _0x2eb12e=_[_0x72f1('0x73')](_0x212bce)[_0x72f1('0x12')]();logger[_0x72f1('0x57')](_0x72f1('0x75'),_0x2eb12e);db[_0x72f1('0x76')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x72f1('0x1a')](function(_0x5a9fa9){for(var _0x23617d=0x0;_0x23617d<_0x5a9fa9[_0x72f1('0x19')];_0x23617d++){if(_0x5a9fa9[_0x23617d][_0x72f1('0x77')]in _0x212bce){contactItemTypes[_0x72f1('0x1c')](_0x5a9fa9[_0x23617d]);delete _0x451b46[_0x5a9fa9[_0x23617d][_0x72f1('0x77')]];hasAdditionalPhones=!![];}for(var _0x56b5ab in _0x212bce){if(_0x5a9fa9[_0x23617d]['name']+_0x72f1('0x78')===_0x56b5ab){phoneDescriptions[_0x72f1('0x1c')]({'itemTypeId':_0x5a9fa9[_0x23617d]['id'],'description':_0x56b5ab});delete _0x451b46[_0x56b5ab];}}}if(hasAdditionalPhones)_0x451b46[_0x72f1('0x18')]='';var _0x452a89=_[_0x72f1('0x73')](_0x451b46)['join']();logger['info'](_0x72f1('0x75'),_0x452a89);fs[_0x72f1('0x79')](_0x5b0cff,_0x452a89+'\x0a');Papa[_0x72f1('0x7a')](fs[_0x72f1('0x7b')](_0x589667),{'header':!![],'skipEmptyLines':!![],'step':function(_0x51e181,_0xe39e6a){try{for(var _0x15cf05=0x0,_0x290848=[];_0x15cf05<_0x51e181[_0x72f1('0x7c')]['length'];_0x15cf05++){stats[_0x72f1('0x7d')]+=0x1;if(_0x51e181[_0x72f1('0x5b')][_0x15cf05]){handleError(_0x51e181[_0x72f1('0x7c')][_0x15cf05],_0x51e181[_0x72f1('0x5b')][_0x15cf05]);}else{var _0x1885ec=[];var _0x3bfd5c=[];var _0x3ca89f={};for(var _0x2817ef in _0x212bce){let _0xf80a5a=contactItemTypes[_0x72f1('0x7e')](_0xbcd4a9=>_0xbcd4a9['name']===_0x2817ef);let _0x55a292=contactItemTypes[_0x72f1('0x7e')](_0x5cf059=>_0x5cf059[_0x72f1('0x77')]+_0x72f1('0x78')===_0x2817ef);if(_[_0x72f1('0x1d')](_0xf80a5a)&&_[_0x72f1('0x1d')](_0x55a292)){if(_0x212bce[_0x72f1('0x7f')](_0x2817ef)){if(_0x51e181[_0x72f1('0x7c')][_0x15cf05][_0x212bce[_0x2817ef]]){var _0x2cbad4=_['trim'](_0x51e181['data'][_0x15cf05][_0x212bce[_0x2817ef]]['replace'](/"/g,'\x27'));switch(_0x2817ef){case _0x72f1('0x43'):var _0x16270f=moment(_0x2cbad4,_0x72f1('0xe'),!![]);if(_0x16270f[_0x72f1('0x80')]()){_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');}else{_0x1885ec[_0x72f1('0x1c')](_0x72f1('0x81'));}break;case'priority':var _0x5c3aa5=parseInt(_0x2cbad4);_0x2cbad4=_[_0x72f1('0x82')](_0x5c3aa5)||_0x5c3aa5<0x0||_0x5c3aa5>0x4?_0x43fbb2?0x3:0x2:_0x5c3aa5;_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');break;case _0x72f1('0x31'):var _0x343248=parseInt(_0x2cbad4);if(_[_0x72f1('0x83')](_0x343248)&&_['includes'](_0x5e3469,_0x343248)){_0x290848['push']('\x22'+_0x343248+'\x22');}else{_0x1885ec[_0x72f1('0x1c')](_0x72f1('0x84'));}break;case _0x72f1('0x85'):if(isEmail(_0x2cbad4)){_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');}else{_0x1885ec[_0x72f1('0x1c')](_0x72f1('0x86'));}break;case'dateOfBirth':var _0x2f9a9c=moment(_0x2cbad4,_0x72f1('0x87'),!![]);if(_0x2f9a9c[_0x72f1('0x80')]()){_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');}else{_0x1885ec[_0x72f1('0x1c')](_0x72f1('0x88'));}break;case _0x72f1('0x69'):var _0x38ecbc=shared[_0x72f1('0x68')];var _0x39efeb=_0x38ecbc[_0x2cbad4];if(!_[_0x72f1('0x1d')](_0x39efeb)){var _0xcdc8d0=_0x39efeb[_0x72f1('0x6a')];_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');_0x290848['push']('\x22'+_0xcdc8d0+'\x22');}break;default:_0x290848[_0x72f1('0x1c')]('\x22'+_0x2cbad4+'\x22');}}else{switch(_0x2817ef){case _0x72f1('0x89'):case'phone':_0x1885ec['push'](_0x2817ef+_0x72f1('0x8a'));break;default:_0x290848[_0x72f1('0x1c')]('\x22\x22');}}}}else{var _0x376832='';if(!_[_0x72f1('0x1d')](_0xf80a5a)){if(!_0x3ca89f[_0x72f1('0x7f')](_0xf80a5a['id'])){if(!_[_0x72f1('0x1d')](_0x51e181[_0x72f1('0x7c')][_0x15cf05][_0x212bce[_0x2817ef]])){var _0x2cbad4=_[_0x72f1('0x8b')](_0x51e181[_0x72f1('0x7c')][_0x15cf05][_0x212bce[_0x2817ef]][_0x72f1('0x8c')](/"/g,'\x27'));var _0x50b004=phoneDescriptions[_0x72f1('0x7e')](_0x438cb2=>_0x438cb2['itemTypeId']===_0xf80a5a['id']);if(!_[_0x72f1('0x1d')](_0x50b004)){var _0x5d514a=_[_0x72f1('0x8b')](_0x51e181[_0x72f1('0x7c')][_0x15cf05][_0x212bce[_0x50b004[_0x72f1('0x8d')]]][_0x72f1('0x8c')](/"/g,'\x27'));if(!_[_0x72f1('0x1d')](_0x5d514a))_0x2cbad4=_0x2cbad4+'§'+_0x5d514a;}if(_0x376832=='')_0x376832=_0x2cbad4;else _0x376832+='|'+_0x2cbad4;}_0x3bfd5c['push'](_0xf80a5a['id']+':'+_0x376832);_0x3ca89f[_0xf80a5a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x290848['push']('\x22'+_0x3bfd5c[_0x72f1('0x12')](';')+'\x22');}if(_0x1885ec[_0x72f1('0x19')]){handleError(_0x51e181[_0x72f1('0x7c')][_0x15cf05],{'code':_0x72f1('0x8e'),'message':_0x1885ec['join']()});}else{fs[_0x72f1('0x8f')](_0x5b0cff,_0x290848[_0x72f1('0x12')]()+'\x0a');}_0x290848=[];}if(!(stats[_0x72f1('0x7d')]%0xc8)){socket['emit'](_0x72f1('0x90')+_0x5713f5,stats);stats[_0x72f1('0x5b')]=[];}}if(stopped){logger[_0x72f1('0x57')](_0x72f1('0x91'));_0xe39e6a[_0x72f1('0x92')]();}}catch(_0x497d89){handleError(_0x51e181[_0x72f1('0x7c')][_0x15cf05],{'code':_0x72f1('0x93'),'message':_0x497d89[_0x72f1('0x5a')]});logger[_0x72f1('0x59')](_0x72f1('0x94'),_0x497d89[_0x72f1('0x5a')]);}},'complete':function(){try{var _0x41d465=[];var _0x29c045=[];var _0x595660=_0x72f1('0x40');if(_0x2ac176['duplicates']&&_0x2ac176[_0x72f1('0x95')][_0x72f1('0x19')]){_0x595660='cm_contacts_'+_0x5713f5;_0x41d465['push'](_0x72f1('0x96')+_0x595660+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x5713f5;tmp_voice_queues=_0x72f1('0x97')+_0x5713f5;_0x29c045[_0x72f1('0x1c')](_0x72f1('0x96')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x29c045['push'](_0x72f1('0x96')+tmp_voice_queues+_0x72f1('0x98'));BPromise[_0x72f1('0x99')](_0x29c045,handleTZQuery)[_0x72f1('0x1a')](function(_0x37f7c4){updateTzCampaigns(_0x2ac176['ListId'])[_0x72f1('0x1a')](function(_0xbda0d2){updateTzVoiceQueues(_0x2ac176[_0x72f1('0x2f')])[_0x72f1('0x1a')](function(_0x3d70d7){if(hasTZ)_0x452a89=_0x452a89[_0x72f1('0x8c')](_0x72f1('0x69'),'dialTimezone,utcOffset');var _0x26544d=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x5b0cff,_0x595660,_0x452a89,_0x2ac176[_0x72f1('0x2f')],_0x2ac176['CompanyId']||null,NOW,NOW);if(_[_0x72f1('0x1d')](_0x212bce[_0x72f1('0x43')])){_0x26544d+=',\x20scheduledAt\x20=\x20NOW()';}_0x41d465['push'](_0x26544d);if(_0x2ac176[_0x72f1('0x95')]&&_0x2ac176[_0x72f1('0x95')]['length']){_0x41d465['push'](insertCmContact(_0x2ac176['ListId'],_0x595660,_0x2ac176['duplicates'],_0x212bce));_0x41d465['push'](_0x72f1('0x9a')+_0x595660+';');}BPromise['each'](_0x41d465,handleQuery)[_0x72f1('0x1a')](function(_0x9008e2){BPromise[_0x72f1('0x62')]([handleAdditionalPhones()])[_0x72f1('0x1a')](function(){_0x41d465=[];for(var _0x1eb34a=0x0;_0x1eb34a_0xd28c15[_0x7147('0x69')]===_0x2177e1);let _0x520da9=contactItemTypes[_0x7147('0x70')](_0x198eac=>_0x198eac[_0x7147('0x69')]+_0x7147('0x6a')===_0x2177e1);if(_['isNil'](_0x1471f4)&&_['isNil'](_0x520da9)){if(_0x344709[_0x7147('0x71')](_0x2177e1)){if(_0x539c19['data'][_0x535c79][_0x344709[_0x2177e1]]){var _0xd300b5=_[_0x7147('0x72')](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x2177e1]][_0x7147('0x73')](/"/g,'\x27'));switch(_0x2177e1){case _0x7147('0x35'):var _0x394cd6=moment(_0xd300b5,_0x7147('0xc'),!![]);if(_0x394cd6[_0x7147('0x74')]()){_0x5249a6['push']('\x22'+_0xd300b5+'\x22');}else{_0x4a6721[_0x7147('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7147('0x75'):var _0x48bfe9=parseInt(_0xd300b5);_0xd300b5=_['isNaN'](_0x48bfe9)||_0x48bfe9<0x0||_0x48bfe9>0x4?_0x2afd97?0x3:0x2:_0x48bfe9;_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');break;case _0x7147('0x76'):var _0x2980bf=parseInt(_0xd300b5);if(_[_0x7147('0x77')](_0x2980bf)&&_[_0x7147('0x78')](_0x1add4a,_0x2980bf)){_0x5249a6[_0x7147('0x1b')]('\x22'+_0x2980bf+'\x22');}else{_0x4a6721[_0x7147('0x1b')](_0x7147('0x79'));}break;case _0x7147('0x7a'):if(isEmail(_0xd300b5)){_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}else{_0x4a6721['push'](_0x7147('0x7b'));}break;case _0x7147('0x7c'):var _0x4cddc2=moment(_0xd300b5,_0x7147('0x7d'),!![]);if(_0x4cddc2['isValid']()){_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}else{_0x4a6721[_0x7147('0x1b')](_0x7147('0x7e'));}break;default:_0x5249a6[_0x7147('0x1b')]('\x22'+_0xd300b5+'\x22');}}else{switch(_0x2177e1){case'firstName':case _0x7147('0x11'):_0x4a6721[_0x7147('0x1b')](_0x2177e1+'\x20not\x20specified');break;default:_0x5249a6[_0x7147('0x1b')]('\x22\x22');}}}}else{var _0x418be0='';if(!_[_0x7147('0x21')](_0x1471f4)){if(!_0x31747f['hasOwnProperty'](_0x1471f4['id'])){for(var _0x1f38df=0x0;_0x1f38df<_0x344709[_0x2177e1][_0x7147('0x1a')];_0x1f38df++){var _0xd300b5=_['trim'](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x2177e1][_0x1f38df]][_0x7147('0x73')](/"/g,'\x27'));var _0x29838c=phoneDescriptions['find'](_0x277f1f=>_0x277f1f[_0x7147('0x7f')]===_0x1471f4['id']);if(!_[_0x7147('0x21')](_0x29838c)){var _0x247d73=_[_0x7147('0x72')](_0x539c19[_0x7147('0x6f')][_0x535c79][_0x344709[_0x29838c[_0x7147('0x80')]][0x0]][_0x7147('0x73')](/"/g,'\x27'));if(!_[_0x7147('0x21')](_0x247d73))_0xd300b5=_0xd300b5+'§'+_0x247d73;}if(_0x418be0=='')_0x418be0=_0xd300b5;else _0x418be0+='|'+_0xd300b5;}_0x3f1d2f[_0x7147('0x1b')](_0x1471f4['id']+':'+_0x418be0);_0x31747f[_0x1471f4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5249a6[_0x7147('0x1b')]('\x22'+_0x3f1d2f[_0x7147('0x3a')](';')+'\x22');}if(_0x4a6721[_0x7147('0x1a')]){handleError(_0x539c19[_0x7147('0x6f')][_0x535c79],{'code':_0x7147('0x81'),'message':_0x4a6721[_0x7147('0x3a')]()});}else{fs[_0x7147('0x82')](_0x228d05,_0x5249a6[_0x7147('0x3a')]()+'\x0a');}_0x5249a6=[];}if(!(stats[_0x7147('0x83')]%0xc8)){socket[_0x7147('0x84')]('contact:import:'+_0x2fcdfc,stats);stats[_0x7147('0x5b')]=[];}}if(stopped){logger['info'](_0x7147('0x85'));_0x2f6bb8[_0x7147('0x86')]();}}catch(_0x1079b9){handleError(_0x539c19[_0x7147('0x6f')][_0x535c79],{'code':_0x7147('0x87'),'message':_0x1079b9[_0x7147('0x5a')]});logger[_0x7147('0x1f')](_0x7147('0x88'),_0x1079b9[_0x7147('0x5a')]);}},'complete':function(){try{var _0x1784f9=[];var _0x3f7f41=tempTableName;_0x1784f9[_0x7147('0x1b')](_0x7147('0x89')+_0x3f7f41+_0x7147('0x8a'));logger[_0x7147('0x5d')](_0x7147('0x8b'),contactItemTypes[_0x7147('0x1a')]);var _0x36cb3c=util[_0x7147('0x8c')](_0x7147('0x8d'),_0x228d05,_0x3f7f41,_0x13f87a,_0x2b11ce[_0x7147('0x36')],_0x2b11ce[_0x7147('0x8e')]||null,NOW,NOW);if(_[_0x7147('0x21')](_0x344709['scheduledat'])){_0x36cb3c+=_0x7147('0x8f');}_0x1784f9[_0x7147('0x1b')](_0x36cb3c);BPromise['each'](_0x1784f9,handleQuery)[_0x7147('0x1d')](function(_0x18897f){BPromise[_0x7147('0x1c')]([handleAdditionalPhones()])[_0x7147('0x1d')](function(){_0x1784f9=[];for(var _0x25697f=0x0;_0x25697f\x20\x20');}var _0x1f291e=path[_0x7147('0x3a')](config[_0x7147('0x65')],'server/files/tmp',process[_0x7147('0x99')][0x2]);if(!fs['existsSync'](_0x1f291e)){throw new Error(_0x7147('0x9a'));}var _0x5a3cec={};try{_0x5a3cec=JSON[_0x7147('0x6d')](process[_0x7147('0x99')][0x3]);if(!_0x5a3cec['binding']){throw new Error(_0x7147('0x9b'));}var _0x201875=0x0;if(_0x5a3cec[_0x7147('0x62')][_0x7147('0x76')]){_0x201875=0x1;}if(!_0x5a3cec[_0x7147('0x36')]){throw new Error(_0x7147('0x9c'));}}catch(_0x33c133){throw new Error(_0x7147('0x9d'));}var _0x36f5bc=[];try{_0x36f5bc=_[_0x7147('0x9e')](JSON['parse'](process[_0x7147('0x99')][0x4]),'id');}catch(_0x4cbb0d){logger[_0x7147('0x5d')]('No\x20agent\x20available');}main(_0x1f291e,_0x5a3cec,_0x36f5bc,_0x201875);}validate();process['on'](_0x7147('0x9f'),handleStop);process['on'](_0x7147('0xa0'),handleUncaughtException); \ No newline at end of file +var _0xd668=['cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.priority','insert','into','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_hopper','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','field','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','toString','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','code','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','rows','errors','find','trim','data','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','replace','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','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','contact','contactId','contactTypeId','orderBy','finish','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','path','lodash','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','all','then','catch','error','message','push','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','CmHopper'];(function(_0x172843,_0x65056){var _0x1ba979=function(_0x555543){while(--_0x555543){_0x172843['push'](_0x172843['shift']());}};_0x1ba979(++_0x65056);}(_0xd668,0x108));var _0x8d66=function(_0x51f7a3,_0x3f9940){_0x51f7a3=_0x51f7a3-0x0;var _0x174039=_0xd668[_0x51f7a3];return _0x174039;};'use strict';var fs=require('fs');var path=require(_0x8d66('0x0'));var _=require(_0x8d66('0x1'));var Papa=require(_0x8d66('0x2'));var util=require(_0x8d66('0x3'));var BPromise=require(_0x8d66('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x8d66('0x5'));var db=require(_0x8d66('0x6'))['db'];var config=require(_0x8d66('0x7'));var logger=require(_0x8d66('0x8'))('import');config['redis']=_[_0x8d66('0x9')](config[_0x8d66('0xa')],{'host':_0x8d66('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d66('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x8d66('0xc')](_0x8d66('0xd'));var tempTableName=_0x8d66('0xe')+moment()['format'](_0x8d66('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x224af3){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))*$/[_0x8d66('0x10')](_0x224af3);}function selectNotIn(_0x354d88,_0x5919a1,_0x3b9168,_0x3e6e00,_0xa49731){return squel[_0x8d66('0x11')]()['field'](_0x8d66('0x12'))[_0x8d66('0x13')](_0x3e6e00)[_0x8d66('0x14')](_0x5919a1,null,_0x5919a1+'.id\x20=\x20'+_0x3e6e00+'.'+_0x3b9168)[_0x8d66('0x15')](_0x3e6e00+'.'+_0x3b9168+_0x8d66('0x16')+_0x354d88+'.'+_0x3b9168)[_0x8d66('0x15')](_0x5919a1+_0x8d66('0x17')+_0xa49731['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4dcffa,_0x56c133){promisesAdditionalPhones=[];promisesContact=[];return db[_0x8d66('0x18')][_0x8d66('0x19')](_0x8d66('0x1a')+tempTableName)[_0x8d66('0x1b')](function(_0x542e11){if(_0x542e11!==null){var _0xd9e69a=[];for(var _0x2ece2d=0x0;_0x2ece2d<_0x542e11[_0x8d66('0x1c')];_0x2ece2d++){var _0x4717d4=_0x542e11[_0x2ece2d];if(!_['isNil'](_0x4717d4[_0x8d66('0x12')])){if(!_[_0x8d66('0x1d')](_0x4717d4['AdditionalPhones']))_0xd9e69a['push'](insertAdditionalPhones(_0x4717d4));promisesContact['push']({'contact':_0x4717d4});}}}Promise[_0x8d66('0x1e')](_0xd9e69a)[_0x8d66('0x1f')](function(){_0x4dcffa({'val':0x1});});})[_0x8d66('0x20')](function(_0x2472f6){logger[_0x8d66('0x21')](_0x2472f6[_0x8d66('0x22')]);});});}function insertAdditionalPhones(_0x1bab6c){return new Promise(function(_0x45449d,_0x2dd721){var _0x24f1b9=_0x1bab6c['AdditionalPhones'];if(_['isNil'](_0x24f1b9))_0x2dd721({'val':0x0});else{var _0x262df2=_0x24f1b9['split'](';');var _0x2c5695=[];orderBy=0x0;for(var _0x1caf4b=0x0;_0x1caf4b<_0x262df2[_0x8d66('0x1c')];_0x1caf4b++){_0x2c5695[_0x8d66('0x23')](splitAdditionalPhone(_0x1bab6c['id'],_0x262df2[_0x1caf4b]));}Promise[_0x8d66('0x1e')](_0x2c5695)['then'](function(){_0x45449d({'val':_0x262df2[_0x8d66('0x1c')]});});}});}function splitAdditionalPhone(_0x442a7d,_0x1ca112){return new Promise(function(_0x2eff95,_0x36443e){var _0x8bcda6=_0x1ca112['split'](':');var _0x33a66a=_0x8bcda6[0x0];var _0x1368fa=_0x8bcda6[0x1];if(_0x1368fa!==''){var _0x1313a2=_0x1368fa[_0x8d66('0x24')]('|');var _0x3802d4=[];for(var _0x132b62=0x0;_0x132b62<_0x1313a2[_0x8d66('0x1c')];_0x132b62++){if(_0x1313a2[_0x132b62]!==''){var _0x1b3950=_['filter'](promisesAdditionalPhones,{'contactId':_0x442a7d,'phone':_0x1313a2[_0x132b62]});if(_0x1b3950[_0x8d66('0x1c')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x442a7d,'contactTypeId':_0x33a66a,'phone':_0x1313a2[_0x132b62],'orderBy':orderBy});}}}_0x2eff95({'ok':0x1});}else _0x2eff95({'res':0x0});});}function createAdditionalPhone(_0x249f0b,_0x57f1ca,_0x4539e3,_0x5b71bb){var _0x5ccef8='';var _0x310068='';var _0x2bce11=_0x4539e3[_0x8d66('0x24')]('§');_0x5ccef8=_0x2bce11[0x0];if(_0x2bce11[_0x8d66('0x1c')]==0x2)_0x310068=_0x2bce11[0x1];return new Promise(function(_0x1a56e0,_0x20daa9){return db[_0x8d66('0x25')][_0x8d66('0x26')]({'where':{'CmContactId':_0x249f0b,'item':_0x5ccef8}})[_0x8d66('0x1f')](function(_0x18d09e){if(_0x18d09e){return db['CmContactHasItem'][_0x8d66('0x27')]({'ItemTypeId':_0x57f1ca,'description':_0x310068,'OrderBy':_0x5b71bb},{'where':{'CmContactId':_0x249f0b,'item':_0x5ccef8}})[_0x8d66('0x1f')](function(_0x1fd203){_0x1a56e0({'res':_0x8d66('0x28')});});}else{return db[_0x8d66('0x25')][_0x8d66('0x29')]({'CmContactId':_0x249f0b,'item':_0x5ccef8,'ItemTypeId':_0x57f1ca,'description':_0x310068,'OrderBy':_0x5b71bb,'ItemClass':_0x8d66('0x2a')})['then'](function(_0xb6d507){_0x1a56e0({'res':_0x8d66('0x2b')});});}});});}function updateContact(_0xf20a12){return new Promise(function(_0x50f52e,_0x92cdde){var _0x526aae=_0xf20a12['id'];delete _0xf20a12['id'];return db[_0x8d66('0x2c')][_0x8d66('0x27')](_0xf20a12,{'where':{'id':_0x526aae}})[_0x8d66('0x1f')](function(_0x554c08){updatedRows+=0x1;return db[_0x8d66('0x2d')]['update']({'phone':_0xf20a12[_0x8d66('0x12')]},{'where':{'ContactId':_0x526aae}})[_0x8d66('0x1f')](function(_0x1f1729){_0x50f52e({'ret':'OK'});});});});}function insertCmHopper(_0x2f573b,_0x6c8199,_0x388d46,_0x85657,_0x2f9bcb){var _0x2d548a=['cm_contacts.phone',_0x8d66('0x2e'),'cm_contacts.id',_0x8d66('0x2f'),_0x6c8199+'.'+_0x85657,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x8d66('0x30'),'cm_contacts.UserId','\x22'+_0x2f9bcb+'\x22'];return squel[_0x8d66('0x31')]()[_0x8d66('0x32')]('cm_hopper')[_0x8d66('0x33')]([_0x8d66('0x12'),'scheduledat',_0x8d66('0x34'),_0x8d66('0x35'),_0x85657,_0x8d66('0x36'),'updatedAt',_0x8d66('0x37'),_0x8d66('0x38'),_0x8d66('0x39')],squel[_0x8d66('0x11')]()[_0x8d66('0x3a')](_0x2d548a)[_0x8d66('0x13')](_0x6c8199)[_0x8d66('0x14')](_0x8d66('0x3b'),null,_0x8d66('0x3c')+_0x6c8199+_0x8d66('0x3d'))['join'](_0x388d46,null,_0x388d46+_0x8d66('0x3e')+_0x6c8199+'.'+_0x85657)[_0x8d66('0x15')](_0x6c8199+_0x8d66('0x3f'),_0x2f573b)[_0x8d66('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8d66('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x6c8199,_0x388d46,_0x85657,_0x8d66('0x40'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x8d66('0x15')](_0x8d66('0x41'),selectNotIn(_0x6c8199,_0x388d46,_0x85657,_0x8d66('0x40'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x5bc59e,_0x1adaf4,_0x250f7b,_0x4b6275){var _0x40f174=[_0x8d66('0x42'),_0x8d66('0x43'),_0x8d66('0x2f'),_0x1adaf4+'.'+_0x4b6275,_0x8d66('0x44'),_0x8d66('0x45')];return squel[_0x8d66('0x31')]()['into']('cm_hopper_black')[_0x8d66('0x33')]([_0x8d66('0x12'),_0x8d66('0x34'),_0x8d66('0x35'),_0x4b6275,_0x8d66('0x36'),'updatedAt'],squel[_0x8d66('0x11')]()['fields'](_0x40f174)[_0x8d66('0x13')](_0x1adaf4)[_0x8d66('0x14')](_0x8d66('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x1adaf4+'.CmListId')[_0x8d66('0x14')](_0x250f7b,null,_0x250f7b+'.id\x20=\x20'+_0x1adaf4+'.'+_0x4b6275)[_0x8d66('0x15')](_0x1adaf4+'.CmListId\x20=\x20?',_0x5bc59e)[_0x8d66('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x8d66('0x46')](_0x8d66('0x12'))['from'](_0x8d66('0x47'))[_0x8d66('0x15')](_0x8d66('0x48'),_0x5bc59e)['where'](_0x4b6275+'\x20=\x20?',_0x1adaf4+'.'+_0x4b6275)))['toString']();}function insertCmHopperAdditionalPhones(_0x5d29ee){var _0x4801cc=[_0x8d66('0x49'),_0x8d66('0x4a'),_0x8d66('0x4b'),'cm_contact_has_items.createdAt',_0x8d66('0x4c')];return squel['insert']()[_0x8d66('0x32')](_0x8d66('0x4d'))[_0x8d66('0x33')](['CmHopperId',_0x8d66('0x12'),_0x8d66('0x4e'),_0x8d66('0x36'),_0x8d66('0x4f')],squel[_0x8d66('0x11')]()[_0x8d66('0x3a')](_0x4801cc)[_0x8d66('0x13')](_0x8d66('0x40'))['join'](_0x8d66('0x3b'),null,_0x8d66('0x50'))[_0x8d66('0x14')](_0x8d66('0x51'),null,_0x8d66('0x52'))['where'](_0x8d66('0x53'),_0x5d29ee)[_0x8d66('0x15')](_0x8d66('0x54'),NOW))[_0x8d66('0x55')]();}function insertCmContact(_0x3378b5,_0x578126,_0x512cba,_0x57d920){var _0x12db09=_[_0x8d66('0x56')](_[_0x8d66('0x57')](_0x57d920),['ListId',_0x8d66('0x58'),_0x8d66('0x36'),_0x8d66('0x4f')]);return squel['insert']()[_0x8d66('0x32')]('cm_contacts')['fromQuery'](_0x12db09,squel[_0x8d66('0x11')]()['fields'](_0x12db09)[_0x8d66('0x13')](_0x578126)[_0x8d66('0x15')]('('+_0x512cba['join'](',')+_0x8d66('0x59'),squel[_0x8d66('0x11')]()['fields'](_0x512cba)[_0x8d66('0x13')](_0x8d66('0x3b'))[_0x8d66('0x15')]('ListId\x20=\x20?',_0x3378b5))[_0x8d66('0x15')](_0x8d66('0x5a'),squel[_0x8d66('0x11')]()[_0x8d66('0x46')](_0x8d66('0x5b'),_0x8d66('0x5c'))[_0x8d66('0x13')](_0x578126)[_0x8d66('0x5d')](_0x512cba[_0x8d66('0x14')](','))))['toString']();}function handleStop(){logger[_0x8d66('0x5e')](_0x8d66('0x5f'));stopped=!![];}function handleUncaughtException(_0x1b4e41){logger['error'](_0x1b4e41['message']);process['exit'](0x1);}function handleError(_0x4f376a,_0x4769f9){stats['errors'][_0x8d66('0x23')]({'name':_0x4769f9[_0x8d66('0x60')],'message':_0x4769f9[_0x8d66('0x22')],'row':_0x4f376a});}function handleQuery(_0x423e49){logger[_0x8d66('0x5e')](_0x423e49);return db[_0x8d66('0x18')]['query'](_0x423e49)[_0x8d66('0x1b')](function(_0x5eb436){results[_0x8d66('0x23')](_0x5eb436);})[_0x8d66('0x20')](function(_0x5cef8a){logger[_0x8d66('0x21')](_0x5cef8a['message']);});}function main(_0x4f06f3,_0x5d5b6c,_0x279f93,_0x15938e){logger[_0x8d66('0x5e')](_0x8d66('0x61'),_0x4f06f3,JSON[_0x8d66('0x62')](_0x5d5b6c));process[_0x8d66('0x63')]('start');var _0x45b753=_0x5d5b6c[_0x8d66('0x64')];var _0x32f15b=_['clone'](_0x45b753);var _0x5850aa=_0x5d5b6c[_0x8d66('0x65')];var _0x3e8080=path[_0x8d66('0x14')](config[_0x8d66('0x66')],_0x8d66('0x67'),_0x5850aa+'.csv');logger['info'](_0x8d66('0x68'),_0x5d5b6c);db[_0x8d66('0x69')][_0x8d66('0x6a')]({'raw':!![],'attributes':['id',_0x8d66('0x6b')]})[_0x8d66('0x1f')](function(_0xb0a332){for(var _0x451fe0=0x0;_0x451fe0<_0xb0a332[_0x8d66('0x1c')];_0x451fe0++){if(_0xb0a332[_0x451fe0][_0x8d66('0x6b')]in _0x45b753){contactItemTypes[_0x8d66('0x23')](_0xb0a332[_0x451fe0]);delete _0x32f15b[_0xb0a332[_0x451fe0][_0x8d66('0x6b')]];hasAdditionalPhones=!![];}for(var _0x577895 in _0x45b753){if(_0xb0a332[_0x451fe0][_0x8d66('0x6b')]+_0x8d66('0x6c')===_0x577895){phoneDescriptions[_0x8d66('0x23')]({'itemTypeId':_0xb0a332[_0x451fe0]['id'],'description':_0x577895});delete _0x32f15b[_0x577895];}}}if(hasAdditionalPhones)_0x32f15b['AdditionalPhones']='';var _0x345a6d=_['keys'](_0x32f15b)[_0x8d66('0x14')]();logger[_0x8d66('0x5e')](_0x8d66('0x6d'),_0x345a6d);fs[_0x8d66('0x6e')](_0x3e8080,_0x345a6d+'\x0a');Papa[_0x8d66('0x6f')](fs[_0x8d66('0x70')](_0x4f06f3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5af07d,_0x127fdf){try{for(var _0x251475=0x0,_0x4a5011=[];_0x251475<_0x5af07d['data'][_0x8d66('0x1c')];_0x251475++){stats[_0x8d66('0x71')]+=0x1;if(_0x5af07d[_0x8d66('0x72')][_0x251475]){handleError(_0x5af07d['data'][_0x251475],_0x5af07d[_0x8d66('0x72')][_0x251475]);}else{var _0x398fa=[];var _0x2939d2=[];var _0x1dd408={};for(var _0x94d445 in _0x45b753){let _0x3d8711=contactItemTypes[_0x8d66('0x73')](_0x30a2b0=>_0x30a2b0[_0x8d66('0x6b')]===_0x94d445);let _0x4468e9=contactItemTypes[_0x8d66('0x73')](_0x240359=>_0x240359[_0x8d66('0x6b')]+'_description'===_0x94d445);if(_['isNil'](_0x3d8711)&&_[_0x8d66('0x1d')](_0x4468e9)){if(_0x45b753['hasOwnProperty'](_0x94d445)){if(_0x5af07d['data'][_0x251475][_0x45b753[_0x94d445]]){var _0x3e2cb3=_[_0x8d66('0x74')](_0x5af07d[_0x8d66('0x75')][_0x251475][_0x45b753[_0x94d445]]['replace'](/"/g,'\x27'));switch(_0x94d445){case _0x8d66('0x76'):var _0x5273f7=moment(_0x3e2cb3,_0x8d66('0xd'),!![]);if(_0x5273f7[_0x8d66('0x77')]()){_0x4a5011['push']('\x22'+_0x3e2cb3+'\x22');}else{_0x398fa[_0x8d66('0x23')](_0x8d66('0x78'));}break;case'priority':var _0x345725=parseInt(_0x3e2cb3);_0x3e2cb3=_['isNaN'](_0x345725)||_0x345725<0x0||_0x345725>0x4?_0x15938e?0x3:0x2:_0x345725;_0x4a5011[_0x8d66('0x23')]('\x22'+_0x3e2cb3+'\x22');break;case _0x8d66('0x38'):var _0xa1abda=parseInt(_0x3e2cb3);if(_[_0x8d66('0x79')](_0xa1abda)&&_[_0x8d66('0x7a')](_0x279f93,_0xa1abda)){_0x4a5011[_0x8d66('0x23')]('\x22'+_0xa1abda+'\x22');}else{_0x398fa['push']('agent\x20not\x20exists');}break;case _0x8d66('0x7b'):if(isEmail(_0x3e2cb3)){_0x4a5011['push']('\x22'+_0x3e2cb3+'\x22');}else{_0x398fa[_0x8d66('0x23')](_0x8d66('0x7c'));}break;case _0x8d66('0x7d'):var _0x2edba9=moment(_0x3e2cb3,'YYYY-MM-DD',!![]);if(_0x2edba9[_0x8d66('0x77')]()){_0x4a5011[_0x8d66('0x23')]('\x22'+_0x3e2cb3+'\x22');}else{_0x398fa['push'](_0x8d66('0x7e'));}break;default:_0x4a5011[_0x8d66('0x23')]('\x22'+_0x3e2cb3+'\x22');}}else{switch(_0x94d445){case'firstName':case'phone':_0x398fa['push'](_0x94d445+_0x8d66('0x7f'));break;default:_0x4a5011['push']('\x22\x22');}}}}else{var _0x5947af='';if(!_[_0x8d66('0x1d')](_0x3d8711)){if(!_0x1dd408['hasOwnProperty'](_0x3d8711['id'])){for(var _0x3d9683=0x0;_0x3d9683<_0x45b753[_0x94d445][_0x8d66('0x1c')];_0x3d9683++){var _0x3e2cb3=_['trim'](_0x5af07d[_0x8d66('0x75')][_0x251475][_0x45b753[_0x94d445][_0x3d9683]][_0x8d66('0x80')](/"/g,'\x27'));var _0x1bc144=phoneDescriptions['find'](_0x29abd8=>_0x29abd8['itemTypeId']===_0x3d8711['id']);if(!_[_0x8d66('0x1d')](_0x1bc144)){var _0x37dbe8=_['trim'](_0x5af07d[_0x8d66('0x75')][_0x251475][_0x45b753[_0x1bc144['description']][0x0]][_0x8d66('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x37dbe8))_0x3e2cb3=_0x3e2cb3+'§'+_0x37dbe8;}if(_0x5947af=='')_0x5947af=_0x3e2cb3;else _0x5947af+='|'+_0x3e2cb3;}_0x2939d2[_0x8d66('0x23')](_0x3d8711['id']+':'+_0x5947af);_0x1dd408[_0x3d8711['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4a5011['push']('\x22'+_0x2939d2[_0x8d66('0x14')](';')+'\x22');}if(_0x398fa['length']){handleError(_0x5af07d[_0x8d66('0x75')][_0x251475],{'code':_0x8d66('0x81'),'message':_0x398fa['join']()});}else{fs[_0x8d66('0x82')](_0x3e8080,_0x4a5011['join']()+'\x0a');}_0x4a5011=[];}if(!(stats[_0x8d66('0x71')]%0xc8)){socket[_0x8d66('0x83')]('contact:import:'+_0x5850aa,stats);stats[_0x8d66('0x72')]=[];}}if(stopped){logger[_0x8d66('0x5e')](_0x8d66('0x84'));_0x127fdf[_0x8d66('0x85')]();}}catch(_0x3b0f5e){handleError(_0x5af07d[_0x8d66('0x75')][_0x251475],{'code':_0x8d66('0x86'),'message':_0x3b0f5e[_0x8d66('0x22')]});logger['error'](_0x8d66('0x87'),_0x3b0f5e[_0x8d66('0x22')]);}},'complete':function(){try{var _0x2046d6=[];var _0x3870a9=tempTableName;_0x2046d6[_0x8d66('0x23')](_0x8d66('0x88')+_0x3870a9+'\x20LIKE\x20cm_contacts;');logger[_0x8d66('0x5e')]('CIS\x20len',contactItemTypes[_0x8d66('0x1c')]);var _0xc07d04=util[_0x8d66('0xc')](_0x8d66('0x89'),_0x3e8080,_0x3870a9,_0x345a6d,_0x5d5b6c[_0x8d66('0x35')],_0x5d5b6c[_0x8d66('0x58')]||null,NOW,NOW);if(_['isNil'](_0x45b753[_0x8d66('0x76')])){_0xc07d04+=_0x8d66('0x8a');}_0x2046d6['push'](_0xc07d04);BPromise[_0x8d66('0x8b')](_0x2046d6,handleQuery)['then'](function(_0x4efe05){BPromise[_0x8d66('0x1e')]([handleAdditionalPhones()])[_0x8d66('0x1f')](function(){_0x2046d6=[];for(var _0x87aa48=0x0;_0x87aa48\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.closedAt','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','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.*','Contact.firstName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','offset','sequelize','Setting','enableEmailPreview'];(function(_0x5248e4,_0x22d9aa){var _0x565ccf=function(_0x7c589a){while(--_0x7c589a){_0x5248e4['push'](_0x5248e4['shift']());}};_0x565ccf(++_0x22d9aa);}(_0x96d4,0x9f));var _0x496d=function(_0x9e1984,_0xb2f245){_0x9e1984=_0x9e1984-0x0;var _0x1b0b0b=_0x96d4[_0x9e1984];return _0x1b0b0b;};'use strict';var _=require(_0x496d('0x0'));var squel=require(_0x496d('0x1'));var as=require(_0x496d('0x2'));var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x496d('0x3')];var utils=require(_0x496d('0x4'));var db=require(_0x496d('0x5'))['db'];function skipInteractionsQuery(_0x3707fb,_0x569169,_0x4007dd){var _0x5deefd=![];var _0x41d961=utils['getAccountFK'](_0x3707fb);if(_0x569169[_0x496d('0x6')]===_0x496d('0x7')&&!_0x4007dd['search']&&!_0x4007dd[_0x41d961]){_0x5deefd=!![];}return _0x5deefd;}function getTagsQuery(){return squel[_0x496d('0x8')]()[_0x496d('0x9')]('id')['field'](_0x496d('0xa'))[_0x496d('0x9')](_0x496d('0xb'))['from'](_0x496d('0xc'));}function getUsersQuery(_0x4bb40a,_0x167224){var _0x83a889=utils[_0x496d('0xd')](_0x4bb40a);var _0x1d8dd0=_0x496d('0xe')+_0x4bb40a+_0x496d('0xf');var _0x24fe78=squel['select']()[_0x496d('0x9')]('u.id')[_0x496d('0x9')](_0x496d('0x10'))[_0x496d('0x9')]('ui.'+_0x83a889)['from'](_0x1d8dd0,'ui')[_0x496d('0x11')](_0x496d('0x12'),'u',_0x496d('0x13'));if(_0x167224['length']>0x0){_0x24fe78[_0x496d('0x14')](_0x496d('0x15')+_0x83a889+'\x20IN\x20?',_[_0x496d('0x16')](_0x167224,'id'));}return _0x24fe78;}function getInteractionsQuery(_0x2039f8){var _0x42827f=utils[_0x496d('0x17')](_0x2039f8);var _0x340009=utils[_0x496d('0x18')](_0x2039f8);var _0x20edeb=utils[_0x496d('0xd')](_0x2039f8);return squel[_0x496d('0x8')]()[_0x496d('0x19')](_0x42827f[_0x496d('0x1a')],'i')[_0x496d('0x11')](_0x496d('0x1b'),'c',_0x496d('0x1c'))[_0x496d('0x11')](_0x496d('0x12'),'o',_0x496d('0x1d'))[_0x496d('0x11')](_0x42827f[_0x496d('0x1e')],'a',_0x496d('0x1f')+_0x340009)[_0x496d('0x11')](_0x42827f[_0x496d('0x20')],'me',_0x496d('0x21')+_0x20edeb+'\x20=\x20i.id')[_0x496d('0x11')](_0x42827f[_0x496d('0x22')],'it',_0x496d('0x23')+_0x20edeb+'\x20=\x20i.id')[_0x496d('0x11')](_0x496d('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x38627f={'body':squel[_0x496d('0x24')](),'contact':squel[_0x496d('0x24')](),'default':squel[_0x496d('0x24')](),'fields':squel[_0x496d('0x24')](),'filter':squel[_0x496d('0x24')](),'read':squel[_0x496d('0x24')](),'tags':{'clause':squel[_0x496d('0x24')](),'ids':null},'user':squel[_0x496d('0x24')]()};return _0x38627f;}function parseTagParameter(_0x492075){var _0x4929c7=squel[_0x496d('0x24')]();if(_0x492075){var _0x2b7f8d=utils[_0x496d('0x25')](_0x492075);_0x2b7f8d[_0x496d('0x26')](function(_0x2da436){_0x4929c7['or'](_0x496d('0x27'),'%,'+_0x2da436+',%');});}return _0x4929c7;}function parseReadParameter(_0x3831a1){var _0x274ccd='';if(_0x3831a1){_0x274ccd=_0x496d('0x28');if(_0x3831a1==='1'){_0x274ccd=_0x274ccd[_0x496d('0x29')](_0x496d('0x2a'),'=');}else{_0x274ccd=_0x274ccd['replace'](_0x496d('0x2a'),'>');}}return _0x274ccd;}function parseSearchFilter(_0x318579,_0x439423){var _0xa45fc0=squel[_0x496d('0x24')]();if(_0x439423){var _0x4e2269=_0x439423['replace']('\x5c','\x5c\x5c')[_0x496d('0x29')](/'/g,'\x27\x27');if(qs[_0x496d('0x2b')](_0x4e2269)){_0xa45fc0['or'](_0x496d('0x2c'),_0x4e2269+'%');if(['sms',_0x496d('0x2d')]['includes'](_0x318579)){_0xa45fc0['or']('i.phone\x20LIKE\x20?',_0x4e2269+'%');}else if(_0x318579===_0x496d('0x2e')){_0xa45fc0['or'](_0x496d('0x2f'),_0x4e2269+'%');}else if(_0x318579===_0x496d('0x30')){_0xa45fc0['or'](_0x496d('0x31'),_0x4e2269+'%');}}else if(_0x318579===_0x496d('0x32')&&qs[_0x496d('0x33')](_0x4e2269)){_0xa45fc0['or'](_0x496d('0x34'),_0x4e2269+'%');}else{if(_0x318579===_0x496d('0x32')){_0xa45fc0['or'](_0x496d('0x35'),qs['getFullTextValue'](_0x4e2269,!![]))['or'](_0x496d('0x36'),qs['getFullTextValue'](_0x4e2269));}else if(_0x318579!==_0x496d('0x2e')){_0xa45fc0['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x496d('0x37')](_0x4e2269));}_0xa45fc0['or'](_0x496d('0x38'),qs[_0x496d('0x37')](_0x4e2269,!![]),null);}}return _0xa45fc0;}function parseAdvancedSearchFilter(_0x47edc5,_0x16c6c4){var _0x8fe62f=getSqlClauses();var _0x36855d=as[_0x496d('0x39')](_0x47edc5);var _0x5428af=_0x36855d[_0x496d('0x3a')];for(var _0x249f32=0x0;_0x249f32<_0x36855d['conditions'][_0x496d('0x3b')];_0x249f32++){var _0x3745c=_0x36855d['conditions'][_0x249f32];var _0x37bd22='i';var _0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x3745c[_0x496d('0x9')]]);if(_0x17f320){var _0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320['type'],_0x3745c);_0x8fe62f[_0x496d('0x3e')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}else{switch(_0x3745c['field']){case _0x496d('0x43'):var _0x5bbbc5=parseReadParameter(_0x3745c[_0x496d('0x40')]);_0x8fe62f[_0x496d('0x44')][_0x496d('0x45')](_0x5bbbc5);break;case _0x496d('0x46'):if(_0x3745c[_0x496d('0x47')]===_0x496d('0x48')){if(_0x3745c[_0x496d('0x40')][_0x496d('0x49')]('\x20')[_0x496d('0x3b')]>0x1){_0x8fe62f['contact'][_0x5428af](_0x496d('0x38'),qs['getFullTextValue'](_0x3745c[_0x496d('0x40')],!![]),null);}else{var _0x1eaf75='%'+_0x3745c[_0x496d('0x40')]+'%';_0x8fe62f['contact'][_0x5428af](_0x496d('0x4a'),_0x1eaf75,_0x1eaf75,_0x1eaf75);}}else{_0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x496d('0x4b')]);_0x3745c[_0x496d('0x9')]=_0x496d('0x4b');_0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320[_0x496d('0x4c')],_0x3745c);_0x8fe62f[_0x496d('0x4d')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}break;case _0x496d('0x4e'):var _0x22b394=_0x3745c[_0x496d('0x40')]['split'](',')[_0x496d('0x16')](function(_0x36da67){return Number(_0x36da67);});var _0x21e78f=parseTagParameter(_0x22b394);_0x8fe62f[_0x496d('0x4f')]['clause'][_0x496d('0x45')](_0x21e78f);_0x8fe62f[_0x496d('0x4f')][_0x496d('0x50')]=_0x22b394;break;case'User':if(_0x3745c[_0x496d('0x47')]===_0x496d('0x48')){_0x8fe62f['user'][_0x5428af]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3745c['value']+'%',null);}else{_0x17f320=_[_0x496d('0x3c')](_0x16c6c4,[_0x496d('0xa'),_0x496d('0x51')]);_0x3745c[_0x496d('0x9')]=_0x496d('0x51');_0x7eef0f=as[_0x496d('0x3d')](_0x37bd22,_0x17f320[_0x496d('0x4c')],_0x3745c);_0x8fe62f[_0x496d('0x52')][_0x5428af](_0x7eef0f[_0x496d('0x3f')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')][_0x496d('0x42')]);}break;case _0x496d('0x53'):case _0x496d('0x54'):_0x7eef0f=as['buildExpression']('me',null,_0x3745c);_0x8fe62f[_0x496d('0x53')][_0x5428af](_0x7eef0f['text'],_0x7eef0f[_0x496d('0x40')][_0x496d('0x41')],_0x7eef0f[_0x496d('0x40')]['end']);break;}}}return _0x8fe62f;}function parseModelFields(_0x4b1125,_0x4461e4,_0x17e9c0){var _0x1b132e=utils[_0x496d('0x18')](_0x4b1125);var _0x49e591=squel[_0x496d('0x24')]();var _0x1a4146=_(_0x4461e4)[_0x496d('0x55')]()[_0x496d('0x16')](function(_0x1ac98b){return _['some'](_0x17e9c0,[_0x496d('0xa'),_0x1ac98b])?_0x1ac98b:undefined;})[_0x496d('0x56')]()['value']();if(_0x1a4146[_0x496d('0x3b')]>0x0){_0x1a4146[_0x496d('0x26')](function(_0x292a14){if(_0x292a14===_0x1b132e){_0x49e591[_0x496d('0x45')]('i.'+_0x1b132e+_0x496d('0x57'),[][_0x496d('0x58')](_0x4461e4[_0x292a14]));}else if(_0x292a14===_0x496d('0x59')){var _0x106e65=JSON[_0x496d('0x5a')](_0x4461e4[_0x292a14])[_0x496d('0x5b')];var _0x12a56e=JSON[_0x496d('0x5a')](_0x4461e4[_0x292a14])[_0x496d('0x5c')];_0x49e591['and'](_0x496d('0x5d'),_0x106e65,_0x12a56e);}else{if(_0x4461e4[_0x292a14]===_0x496d('0x5e')){_0x49e591[_0x496d('0x45')]('i.'+_0x292a14+_0x496d('0x5f'));}else{_0x49e591[_0x496d('0x45')]('i.'+_0x292a14+_0x496d('0x60'),_0x4461e4[_0x292a14]);}}});}return _0x49e591;}function parseQueryParameters(_0x445362,_0x58a2df,_0x3a69ac){var _0x10143b=getSqlClauses();return Promise['resolve']()[_0x496d('0x61')](function(){return parseModelFields(_0x445362,_0x58a2df,_0x3a69ac);})[_0x496d('0x61')](function(_0x1cfe27){_0x10143b[_0x496d('0x62')][_0x496d('0x45')](_0x1cfe27);return parseReadParameter(_0x58a2df[_0x496d('0x44')]);})['then'](function(_0x573224){_0x10143b[_0x496d('0x44')]['and'](_0x573224);return parseTagParameter(_0x58a2df[_0x496d('0x63')]);})[_0x496d('0x61')](function(_0x4a9474){_0x10143b[_0x496d('0x4f')][_0x496d('0x64')][_0x496d('0x45')](_0x4a9474);return parseSearchFilter(_0x445362,_0x58a2df[_0x496d('0x65')]);})['then'](function(_0x57681b){_0x10143b[_0x496d('0x65')]=_0x57681b;return _0x10143b;});}function checkAccountsRestrictions(_0x28042f,_0xf3dbcc,_0x40da68){var _0x493e2d=utils[_0x496d('0x18')](_0x28042f);var _0x5f319b='get'+_[_0x496d('0x66')](_0x28042f)+(_0x28042f==='chat'?'Websites':_0x496d('0x67'));var _0x14750d=squel[_0x496d('0x24')]();return Promise[_0x496d('0x68')]()['then'](function(){if(_0x40da68[_0x496d('0x69')]&&_0xf3dbcc[_0x496d('0x6')]===_0x496d('0x7')){return _0xf3dbcc[_0x5f319b]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x150101){if(_0x150101){if(_0x150101[_0x496d('0x3b')]===0x0){_0x14750d['and']('i.'+_0x493e2d+_0x496d('0x5f'));}else{_0x14750d[_0x496d('0x45')]('i.'+_0x493e2d+_0x496d('0x57'),_[_0x496d('0x16')](_0x150101,'id'));}}else if(!_0x40da68[_0x493e2d]){_0x14750d['and']('i.'+_0x493e2d+'\x20IS\x20NOT\x20NULL');}})[_0x496d('0x61')](function(){return _0x14750d;});}function getClosedOrderClause(_0x59e1cd,_0x4ee7cd){var _0x4df772='';var _0x4e36b0=['i.thirdDisposition',_0x496d('0x6a'),_0x496d('0x6b')];if(_0x59e1cd===_0x496d('0x32')){_0x4e36b0[_0x496d('0x6c')](_0x496d('0x6d'));}if(_0x4ee7cd[_0x496d('0x6e')]==='0'&&_0x59e1cd===_0x496d('0x32')){_0x4df772='i.substatus';}else{if(_0x4ee7cd[_0x496d('0x6e')]==='1'){_0x4e36b0[_0x496d('0x6f')]();}_0x4df772=_0x496d('0x70')+_0x4e36b0[_0x496d('0x71')](',\x20')+')';}return _0x4df772;}function getFilteredInteractions(_0x537736,_0x4359e3,_0x2bd581,_0x2f7bb0){var _0x1ae213=utils[_0x496d('0xd')](_0x537736);var _0x134a3d=_[_0x496d('0x66')](_0x537736)+'Interaction';var _0xef2626=[];var _0xef9929=getTagsQuery();var _0x14d97b={'type':db[_0x496d('0x72')][_0x496d('0x73')]['SELECT'],'raw':!![]};var _0x34b045=[];var _0x55b04f=[];return db['sequelize'][_0x496d('0x74')](_0xef9929[_0x496d('0x75')](),_0x14d97b)[_0x496d('0x61')](function(_0xca1a5d){_0xef2626=_[_0x496d('0x76')](_0xca1a5d,'id');_0x14d97b=_[_0x496d('0x77')](_0x14d97b,{'model':db[_0x134a3d],'mapToModel':!![],'nest':!![]});if(_0x2bd581[_0x496d('0x62')]){_0x2f7bb0[_0x496d('0x78')][_0x496d('0x26')](function(_0x1d4788){_0x4359e3[_0x496d('0x9')]('i.'+_0x1d4788);});}else{_0x4359e3['field'](_0x496d('0x79'),_0x496d('0x43'));_0x4359e3[_0x496d('0x9')]('a.key','Account.key');_0x4359e3[_0x496d('0x9')](_0x496d('0x7a'),_0x496d('0x7b'));if(_0x537736==='mail'){_0x4359e3[_0x496d('0x9')](_0x496d('0x7c'),_0x496d('0x7d'));_0x4359e3[_0x496d('0x9')](_0x496d('0x7e'),_0x496d('0x7f'));_0x4359e3[_0x496d('0x9')](_0x496d('0x80'));_0x4359e3[_0x496d('0x9')](_0x496d('0x81'));_0x4359e3[_0x496d('0x9')](_0x496d('0x82'));_0x4359e3[_0x496d('0x9')]('i.closed');_0x4359e3[_0x496d('0x9')](_0x496d('0x83'));_0x4359e3[_0x496d('0x9')]('i.attach');_0x4359e3[_0x496d('0x9')](_0x496d('0x84'));_0x4359e3[_0x496d('0x9')](_0x496d('0x85'));_0x4359e3['field']('i.subject');_0x4359e3[_0x496d('0x9')](_0x496d('0x6b'));_0x4359e3[_0x496d('0x9')](_0x496d('0x6a'));_0x4359e3[_0x496d('0x9')](_0x496d('0x86'));_0x4359e3[_0x496d('0x9')](_0x496d('0x6d'));_0x4359e3[_0x496d('0x9')](_0x496d('0x87'));_0x4359e3[_0x496d('0x9')](_0x496d('0x88'));_0x4359e3['field'](_0x496d('0x89'));_0x4359e3[_0x496d('0x9')](_0x496d('0x8a'));}else if(_0x537736===_0x496d('0x30')){_0x4359e3[_0x496d('0x9')](_0x496d('0x8b'),_0x496d('0x7f'));}else{_0x4359e3[_0x496d('0x9')](_0x496d('0x8c'),_0x496d('0x7f'));}if(_0x537736!==_0x496d('0x32')){_0x4359e3[_0x496d('0x9')](_0x496d('0x8d'));}_0x4359e3[_0x496d('0x9')]('c.firstName',_0x496d('0x8e'));_0x4359e3[_0x496d('0x9')]('c.lastName','Contact.lastName');_0x4359e3[_0x496d('0x9')](_0x496d('0x8f'),_0x496d('0x90'));_0x4359e3['field'](_0x496d('0x91'),'Contact.phone');_0x4359e3['field']('c.mobile',_0x496d('0x92'));_0x4359e3[_0x496d('0x9')](_0x496d('0x93'),_0x496d('0x94'));_0x4359e3[_0x496d('0x9')](_0x496d('0x95'),'Owner.fullname');_0x4359e3[_0x496d('0x9')]('o.internal',_0x496d('0x96'));_0x4359e3[_0x496d('0x9')](_0x496d('0x97'),_0x496d('0x98'));}if(_0x2f7bb0['limit']){_0x4359e3['limit'](_0x2f7bb0['limit']);}if(_0x2f7bb0[_0x496d('0x99')]){_0x4359e3['offset'](_0x2f7bb0[_0x496d('0x99')]);}return db[_0x496d('0x9a')][_0x496d('0x74')](_0x4359e3[_0x496d('0x75')](),_0x14d97b);})['then'](function(_0x5ec418){_0x34b045=_0x5ec418;var _0x5bcb98=getUsersQuery(_0x537736,_0x34b045);return db[_0x496d('0x9a')][_0x496d('0x74')](_0x5bcb98['toString'](),_0x14d97b);})[_0x496d('0x61')](function(_0x524268){_0x55b04f=_['groupBy'](_0x524268,_0x1ae213);if(_0x537736===_0x496d('0x32')){return db[_0x496d('0x9b')]['findOne']({'attributes':[_0x496d('0x9c')],'raw':!![]});}})[_0x496d('0x61')](function(_0x3ff5cc){var _0x3bd4a0=_0x3ff5cc?_0x3ff5cc['enableEmailPreview']:undefined;var _0x4ab7f5=_0x34b045[_0x496d('0x16')](function(_0x10c0bc){return updateInteraction(_0x10c0bc,_0xef2626,_0x55b04f,_0x3bd4a0);});return Promise['all'](_0x4ab7f5);});}function countFilteredInteractions(_0x32bfe0,_0x356571){var _0x51bbf7=_0x32bfe0['clone']();_0x51bbf7[_0x496d('0x9')]('COUNT(*)');_0x51bbf7[_0x496d('0x9')](_0x496d('0x79'),_0x496d('0x43'));var _0x1f692b=utils[_0x496d('0x25')](_0x356571);if(!_[_0x496d('0x9d')](_0x1f692b)){_0x51bbf7['where']('t.id\x20IN\x20?',_0x1f692b);}var _0x506578={'type':db[_0x496d('0x72')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0x496d('0x74')](_0x51bbf7[_0x496d('0x75')](),_0x506578);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x9fdb=['contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','start','keys','some','compact','forEach','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','then','fields','tag','filter','get','chat','Websites','Accounts','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','closed','shift','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','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','i.*','c.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','from','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','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','type','text','value','end','read','and','Contact','operator','$substring','split'];(function(_0x546100,_0x561bcc){var _0x38d639=function(_0x14323e){while(--_0x14323e){_0x546100['push'](_0x546100['shift']());}};_0x38d639(++_0x561bcc);}(_0x9fdb,0x1a9));var _0xb9fd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9fdb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb9fd('0x0'));var squel=require('squel');var as=require(_0xb9fd('0x1'));var qs=require(_0xb9fd('0x2'));var updateInteraction=require(_0xb9fd('0x3'))['updateInteraction'];var utils=require(_0xb9fd('0x4'));var db=require(_0xb9fd('0x5'))['db'];function skipInteractionsQuery(_0x61a0a3,_0x3790ea,_0x492cc6){var _0xdf9915=![];var _0x3c7745=utils[_0xb9fd('0x6')](_0x61a0a3);if(_0x3790ea[_0xb9fd('0x7')]==='agent'&&!_0x492cc6[_0xb9fd('0x8')]&&!_0x492cc6[_0x3c7745]){_0xdf9915=!![];}return _0xdf9915;}function getTagsQuery(){return squel[_0xb9fd('0x9')]()['field']('id')[_0xb9fd('0xa')](_0xb9fd('0xb'))[_0xb9fd('0xa')]('color')['from'](_0xb9fd('0xc'));}function getUsersQuery(_0x2f5eaf,_0x1caf2e){var _0x18894f=utils[_0xb9fd('0xd')](_0x2f5eaf);var _0x133be7=_0xb9fd('0xe')+_0x2f5eaf+_0xb9fd('0xf');var _0x2db125=squel[_0xb9fd('0x9')]()[_0xb9fd('0xa')](_0xb9fd('0x10'))[_0xb9fd('0xa')](_0xb9fd('0x11'))['field'](_0xb9fd('0x12')+_0x18894f)['from'](_0x133be7,'ui')['left_join']('users','u',_0xb9fd('0x13'));if(_0x1caf2e[_0xb9fd('0x14')]>0x0){_0x2db125[_0xb9fd('0x15')](_0xb9fd('0x12')+_0x18894f+_0xb9fd('0x16'),_[_0xb9fd('0x17')](_0x1caf2e,'id'));}return _0x2db125;}function getInteractionsQuery(_0xabf637){var _0x48ce4c=utils[_0xb9fd('0x18')](_0xabf637);var _0x492d40=utils['getAccountFK'](_0xabf637);var _0x4fbf0c=utils[_0xb9fd('0xd')](_0xabf637);return squel[_0xb9fd('0x9')]()[_0xb9fd('0x19')](_0x48ce4c['interactions'],'i')[_0xb9fd('0x1a')](_0xb9fd('0x1b'),'c',_0xb9fd('0x1c'))['left_join'](_0xb9fd('0x1d'),'o',_0xb9fd('0x1e'))[_0xb9fd('0x1a')](_0x48ce4c[_0xb9fd('0x1f')],'a',_0xb9fd('0x20')+_0x492d40)['left_join'](_0x48ce4c[_0xb9fd('0x21')],'me',_0xb9fd('0x22')+_0x4fbf0c+_0xb9fd('0x23'))['left_join'](_0x48ce4c[_0xb9fd('0x24')],'it',_0xb9fd('0x25')+_0x4fbf0c+_0xb9fd('0x23'))[_0xb9fd('0x1a')](_0xb9fd('0xc'),'t',_0xb9fd('0x26'));}function getSqlClauses(){var _0x22f690={'body':squel[_0xb9fd('0x27')](),'contact':squel[_0xb9fd('0x27')](),'default':squel[_0xb9fd('0x27')](),'fields':squel[_0xb9fd('0x27')](),'filter':squel[_0xb9fd('0x27')](),'read':squel[_0xb9fd('0x27')](),'tags':{'clause':squel[_0xb9fd('0x27')](),'ids':null},'user':squel[_0xb9fd('0x27')]()};return _0x22f690;}function parseTagParameter(_0x297fa4){var _0x3e2bf7=squel['expr']();if(_0x297fa4){var _0x7647cb=utils['getSelectedTags'](_0x297fa4);_0x7647cb['forEach'](function(_0x420265){_0x3e2bf7['or'](_0xb9fd('0x28'),'%,'+_0x420265+',%');});}return _0x3e2bf7;}function parseReadParameter(_0x353626){var _0x2ef1d0='';if(_0x353626){_0x2ef1d0=_0xb9fd('0x29');if(_0x353626==='1'){_0x2ef1d0=_0x2ef1d0['replace']('{OPERATOR}','=');}else{_0x2ef1d0=_0x2ef1d0[_0xb9fd('0x2a')]('{OPERATOR}','>');}}return _0x2ef1d0;}function parseSearchFilter(_0x11d875,_0x52d9c7){var _0x29be33=squel[_0xb9fd('0x27')]();if(_0x52d9c7){var _0x21f9df=_0x52d9c7['replace']('\x5c','\x5c\x5c')[_0xb9fd('0x2a')](/'/g,'\x27\x27');if(qs[_0xb9fd('0x2b')](_0x21f9df)){_0x29be33['or'](_0xb9fd('0x2c'),_0x21f9df+'%');if([_0xb9fd('0x2d'),_0xb9fd('0x2e')]['includes'](_0x11d875)){_0x29be33['or'](_0xb9fd('0x2f'),_0x21f9df+'%');}else if(_0x11d875==='fax'){_0x29be33['or'](_0xb9fd('0x30'),_0x21f9df+'%');}else if(_0x11d875===_0xb9fd('0x31')){_0x29be33['or'](_0xb9fd('0x32'),_0x21f9df+'%');}}else if(_0x11d875===_0xb9fd('0x33')&&qs['isEmail'](_0x21f9df)){_0x29be33['or'](_0xb9fd('0x34'),_0x21f9df+'%');}else{if(_0x11d875==='mail'){_0x29be33['or'](_0xb9fd('0x35'),qs[_0xb9fd('0x36')](_0x21f9df,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb9fd('0x36')](_0x21f9df));}else if(_0x11d875!==_0xb9fd('0x37')){_0x29be33['or'](_0xb9fd('0x38'),qs[_0xb9fd('0x36')](_0x21f9df));}_0x29be33['or'](_0xb9fd('0x39'),qs[_0xb9fd('0x36')](_0x21f9df,!![]),null);}}return _0x29be33;}function parseAdvancedSearchFilter(_0x254eee,_0x1cc2f0){var _0x12f244=getSqlClauses();var _0x1bfcae=as[_0xb9fd('0x3a')](_0x254eee);var _0x707da4=_0x1bfcae[_0xb9fd('0x3b')];for(var _0x2b0c35=0x0;_0x2b0c35<_0x1bfcae['conditions'][_0xb9fd('0x14')];_0x2b0c35++){var _0x29309e=_0x1bfcae[_0xb9fd('0x3c')][_0x2b0c35];var _0x5450bc='i';var _0xe606a9=_[_0xb9fd('0x3d')](_0x1cc2f0,['name',_0x29309e[_0xb9fd('0xa')]]);if(_0xe606a9){var _0x17f711=as[_0xb9fd('0x3e')](_0x5450bc,_0xe606a9[_0xb9fd('0x3f')],_0x29309e);_0x12f244['default'][_0x707da4](_0x17f711[_0xb9fd('0x40')],_0x17f711[_0xb9fd('0x41')]['start'],_0x17f711[_0xb9fd('0x41')][_0xb9fd('0x42')]);}else{switch(_0x29309e[_0xb9fd('0xa')]){case'unreadMessages':var _0xe0a128=parseReadParameter(_0x29309e[_0xb9fd('0x41')]);_0x12f244[_0xb9fd('0x43')][_0xb9fd('0x44')](_0xe0a128);break;case _0xb9fd('0x45'):if(_0x29309e[_0xb9fd('0x46')]===_0xb9fd('0x47')){if(_0x29309e[_0xb9fd('0x41')][_0xb9fd('0x48')]('\x20')[_0xb9fd('0x14')]>0x1){_0x12f244[_0xb9fd('0x49')][_0x707da4](_0xb9fd('0x39'),qs[_0xb9fd('0x36')](_0x29309e['value'],!![]),null);}else{var _0x5c33d4='%'+_0x29309e[_0xb9fd('0x41')]+'%';_0x12f244[_0xb9fd('0x49')][_0x707da4](_0xb9fd('0x4a'),_0x5c33d4,_0x5c33d4,_0x5c33d4);}}else{_0xe606a9=_[_0xb9fd('0x3d')](_0x1cc2f0,[_0xb9fd('0xb'),_0xb9fd('0x4b')]);_0x29309e[_0xb9fd('0xa')]=_0xb9fd('0x4b');_0x17f711=as[_0xb9fd('0x3e')](_0x5450bc,_0xe606a9[_0xb9fd('0x3f')],_0x29309e);_0x12f244[_0xb9fd('0x49')][_0x707da4](_0x17f711[_0xb9fd('0x40')],_0x17f711[_0xb9fd('0x41')]['start'],_0x17f711[_0xb9fd('0x41')]['end']);}break;case _0xb9fd('0x4c'):var _0x49ccd6=_0x29309e[_0xb9fd('0x41')][_0xb9fd('0x48')](',')[_0xb9fd('0x17')](function(_0x4e5af8){return Number(_0x4e5af8);});var _0x7e21af=parseTagParameter(_0x49ccd6);_0x12f244[_0xb9fd('0x4d')][_0xb9fd('0x4e')]['and'](_0x7e21af);_0x12f244['tags']['ids']=_0x49ccd6;break;case _0xb9fd('0x4f'):if(_0x29309e['operator']===_0xb9fd('0x47')){_0x12f244[_0xb9fd('0x50')][_0x707da4](_0xb9fd('0x51'),'%'+_0x29309e[_0xb9fd('0x41')]+'%',null);}else{_0xe606a9=_[_0xb9fd('0x3d')](_0x1cc2f0,[_0xb9fd('0xb'),'UserId']);_0x29309e[_0xb9fd('0xa')]=_0xb9fd('0x52');_0x17f711=as[_0xb9fd('0x3e')](_0x5450bc,_0xe606a9[_0xb9fd('0x3f')],_0x29309e);_0x12f244['user'][_0x707da4](_0x17f711[_0xb9fd('0x40')],_0x17f711[_0xb9fd('0x41')]['start'],_0x17f711[_0xb9fd('0x41')][_0xb9fd('0x42')]);}break;case _0xb9fd('0x53'):case _0xb9fd('0x54'):_0x17f711=as[_0xb9fd('0x3e')]('me',null,_0x29309e);_0x12f244['body'][_0x707da4](_0x17f711[_0xb9fd('0x40')],_0x17f711[_0xb9fd('0x41')][_0xb9fd('0x55')],_0x17f711[_0xb9fd('0x41')][_0xb9fd('0x42')]);break;}}}return _0x12f244;}function parseModelFields(_0x446f1f,_0x3d1933,_0x2a7b38){var _0x2a9bda=utils[_0xb9fd('0x6')](_0x446f1f);var _0x130fb6=squel['expr']();var _0x2fbc7a=_(_0x3d1933)[_0xb9fd('0x56')]()[_0xb9fd('0x17')](function(_0x118518){return _[_0xb9fd('0x57')](_0x2a7b38,[_0xb9fd('0xb'),_0x118518])?_0x118518:undefined;})[_0xb9fd('0x58')]()[_0xb9fd('0x41')]();if(_0x2fbc7a[_0xb9fd('0x14')]>0x0){_0x2fbc7a[_0xb9fd('0x59')](function(_0x173e1a){if(_0x173e1a===_0x2a9bda){_0x130fb6['and']('i.'+_0x2a9bda+_0xb9fd('0x16'),[]['concat'](_0x3d1933[_0x173e1a]));}else if(_0x173e1a===_0xb9fd('0x5a')){var _0x31e733=JSON['parse'](_0x3d1933[_0x173e1a])['$gte'];var _0x14558d=JSON[_0xb9fd('0x5b')](_0x3d1933[_0x173e1a])[_0xb9fd('0x5c')];_0x130fb6[_0xb9fd('0x44')](_0xb9fd('0x5d'),_0x31e733,_0x14558d);}else{if(_0x3d1933[_0x173e1a]===_0xb9fd('0x5e')){_0x130fb6[_0xb9fd('0x44')]('i.'+_0x173e1a+'\x20IS\x20NULL');}else{_0x130fb6[_0xb9fd('0x44')]('i.'+_0x173e1a+'\x20=\x20?',_0x3d1933[_0x173e1a]);}}});}return _0x130fb6;}function parseQueryParameters(_0x2e4ce7,_0x8b9879,_0x121749){var _0x82748d=getSqlClauses();return Promise['resolve']()[_0xb9fd('0x5f')](function(){return parseModelFields(_0x2e4ce7,_0x8b9879,_0x121749);})[_0xb9fd('0x5f')](function(_0x2bcb7f){_0x82748d[_0xb9fd('0x60')][_0xb9fd('0x44')](_0x2bcb7f);return parseReadParameter(_0x8b9879['read']);})[_0xb9fd('0x5f')](function(_0x3677ce){_0x82748d[_0xb9fd('0x43')][_0xb9fd('0x44')](_0x3677ce);return parseTagParameter(_0x8b9879[_0xb9fd('0x61')]);})[_0xb9fd('0x5f')](function(_0xe9e1bc){_0x82748d[_0xb9fd('0x4d')][_0xb9fd('0x4e')][_0xb9fd('0x44')](_0xe9e1bc);return parseSearchFilter(_0x2e4ce7,_0x8b9879[_0xb9fd('0x62')]);})['then'](function(_0x10aefc){_0x82748d[_0xb9fd('0x62')]=_0x10aefc;return _0x82748d;});}function checkAccountsRestrictions(_0x594c64,_0x4d0528,_0x5aa7ae){var _0xe87cf0=utils['getAccountFK'](_0x594c64);var _0x82a14c=_0xb9fd('0x63')+_['capitalize'](_0x594c64)+(_0x594c64===_0xb9fd('0x64')?_0xb9fd('0x65'):_0xb9fd('0x66'));var _0x5997da=squel['expr']();return Promise['resolve']()['then'](function(){if(_0x5aa7ae['search']&&_0x4d0528['role']===_0xb9fd('0x67')){return _0x4d0528[_0x82a14c]({'attributes':['id'],'raw':!![]});}})[_0xb9fd('0x5f')](function(_0xaa98cf){if(_0xaa98cf){if(_0xaa98cf['length']===0x0){_0x5997da['and']('i.'+_0xe87cf0+'\x20IS\x20NULL');}else{_0x5997da[_0xb9fd('0x44')]('i.'+_0xe87cf0+_0xb9fd('0x16'),_['map'](_0xaa98cf,'id'));}}else if(!_0x5aa7ae[_0xe87cf0]){_0x5997da[_0xb9fd('0x44')]('i.'+_0xe87cf0+_0xb9fd('0x68'));}})[_0xb9fd('0x5f')](function(){return _0x5997da;});}function getClosedOrderClause(_0x1513d9,_0x349293){var _0x4be109='';var _0x39b001=[_0xb9fd('0x69'),_0xb9fd('0x6a'),_0xb9fd('0x6b')];if(_0x1513d9===_0xb9fd('0x33')){_0x39b001['unshift']('i.substatus');}if(_0x349293[_0xb9fd('0x6c')]==='0'&&_0x1513d9===_0xb9fd('0x33')){_0x4be109='i.substatus';}else{if(_0x349293[_0xb9fd('0x6c')]==='1'){_0x39b001[_0xb9fd('0x6d')]();}_0x4be109='CONCAT_WS(\x27\x27,\x20'+_0x39b001[_0xb9fd('0x6e')](',\x20')+')';}return _0x4be109;}function getFilteredInteractions(_0x4fb246,_0x47b987,_0x51d136,_0x5b398d){var _0x42e3f4=utils[_0xb9fd('0xd')](_0x4fb246);var _0x21aebd=_['capitalize'](_0x4fb246)+_0xb9fd('0x6f');var _0x5b798f=[];var _0x104c70=getTagsQuery();var _0x46f1b3={'type':db[_0xb9fd('0x70')][_0xb9fd('0x71')][_0xb9fd('0x72')],'raw':!![]};var _0x187477=[];var _0x2fdc19=[];return db[_0xb9fd('0x73')][_0xb9fd('0x74')](_0x104c70[_0xb9fd('0x75')](),_0x46f1b3)[_0xb9fd('0x5f')](function(_0x94c637){_0x5b798f=_[_0xb9fd('0x76')](_0x94c637,'id');_0x46f1b3=_[_0xb9fd('0x77')](_0x46f1b3,{'model':db[_0x21aebd],'mapToModel':!![],'nest':!![]});if(_0x51d136[_0xb9fd('0x60')]){_0x5b398d['attributes'][_0xb9fd('0x59')](function(_0x36ccac){_0x47b987[_0xb9fd('0xa')]('i.'+_0x36ccac);});}else{_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x78'),_0xb9fd('0x79'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x7a'),_0xb9fd('0x7b'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x7c'),_0xb9fd('0x7d'));if(_0x4fb246===_0xb9fd('0x33')){_0x47b987['field'](_0xb9fd('0x7e'),_0xb9fd('0x7f'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x80'),_0xb9fd('0x81'));_0x47b987['field']('i.id');_0x47b987[_0xb9fd('0xa')]('i.createdAt');_0x47b987['field'](_0xb9fd('0x82'));_0x47b987['field']('i.closed');_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x83'));_0x47b987[_0xb9fd('0xa')]('i.attach');_0x47b987['field'](_0xb9fd('0x84'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x85'));_0x47b987['field'](_0xb9fd('0x86'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x6b'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x6a'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x69'));_0x47b987[_0xb9fd('0xa')]('i.substatus');_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x87'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x88'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x89'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x8a'));}else if(_0x4fb246===_0xb9fd('0x31')){_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x8b'),_0xb9fd('0x81'));}else{_0x47b987[_0xb9fd('0xa')]('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',_0xb9fd('0x81'));}if(_0x4fb246!=='mail'){_0x47b987['field'](_0xb9fd('0x8c'));}_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x8d'),'Contact.firstName');_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x8e'),'Contact.lastName');_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x8f'),'Contact.email');_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x90'),_0xb9fd('0x91'));_0x47b987[_0xb9fd('0xa')]('c.mobile',_0xb9fd('0x92'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x93'),_0xb9fd('0x94'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x95'),_0xb9fd('0x96'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x97'),_0xb9fd('0x98'));_0x47b987[_0xb9fd('0xa')](_0xb9fd('0x99'),_0xb9fd('0x9a'));}if(_0x5b398d[_0xb9fd('0x9b')]){_0x47b987[_0xb9fd('0x9b')](_0x5b398d[_0xb9fd('0x9b')]);}if(_0x5b398d[_0xb9fd('0x9c')]){_0x47b987[_0xb9fd('0x9c')](_0x5b398d['offset']);}return db[_0xb9fd('0x73')]['query'](_0x47b987['toString'](),_0x46f1b3);})[_0xb9fd('0x5f')](function(_0x4f13eb){_0x187477=_0x4f13eb;var _0x4cda9a=getUsersQuery(_0x4fb246,_0x187477);return db['sequelize'][_0xb9fd('0x74')](_0x4cda9a[_0xb9fd('0x75')](),_0x46f1b3);})['then'](function(_0x1f26a9){_0x2fdc19=_[_0xb9fd('0x9d')](_0x1f26a9,_0x42e3f4);if(_0x4fb246==='mail'){return db[_0xb9fd('0x9e')][_0xb9fd('0x9f')]({'attributes':[_0xb9fd('0xa0')],'raw':!![]});}})['then'](function(_0x5d6092){var _0x5f40c2=_0x5d6092?_0x5d6092[_0xb9fd('0xa0')]:undefined;var _0x29f758=_0x187477[_0xb9fd('0x17')](function(_0x1fd3ea){return updateInteraction(_0x1fd3ea,_0x5b798f,_0x2fdc19,_0x5f40c2);});return Promise[_0xb9fd('0xa1')](_0x29f758);});}function countFilteredInteractions(_0x341a7c,_0x4f4219){var _0x2d95aa=_0x341a7c[_0xb9fd('0xa2')]();_0x2d95aa[_0xb9fd('0xa')](_0xb9fd('0xa3'));_0x2d95aa[_0xb9fd('0xa')](_0xb9fd('0x78'),_0xb9fd('0x79'));var _0x448e36=utils[_0xb9fd('0xa4')](_0x4f4219);if(!_[_0xb9fd('0xa5')](_0x448e36)){_0x2d95aa[_0xb9fd('0x15')]('t.id\x20IN\x20?',_0x448e36);}var _0xb70272={'type':db[_0xb9fd('0x70')]['QueryTypes'][_0xb9fd('0x72')],'raw':!![]};return db['sequelize']['query'](_0x2d95aa[_0xb9fd('0x75')](),_0xb70272);}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 fd0eeb7..8a086ee 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 _0x5727=['closed','disposition','abandoned','UserId','MailMessage','out','-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','total'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x5727,0x154));var _0x7572=function(_0x283b7c,_0x53bb1f){_0x283b7c=_0x283b7c-0x0;var _0x2a26ea=_0x5727[_0x283b7c];return _0x2a26ea;};'use strict';var _=require('lodash');var db=require(_0x7572('0x0'))['db'];function getInteractionUsers(_0xdff30f,_0xa8dedf){return new Promise(function(_0x533923,_0x4978ea){try{var _0x166b95=[];if(_0xa8dedf[_0xdff30f]){_0x166b95=_0xa8dedf[_0xdff30f][_0x7572('0x1')](function(_0x58ec5a){return{'id':_0x58ec5a['id'],'fullname':_0x58ec5a[_0x7572('0x2')]};});}return _0x533923(_0x166b95);}catch(_0x22144a){_0x4978ea(_0x22144a);}});}function getInteractionTags(_0x2a33cf,_0x323137){var _0x56dbff=[];if(_0x2a33cf){_0x2a33cf[_0x7572('0x3')](',')[_0x7572('0x4')](function(_0x49b54c){_0x56dbff[_0x7572('0x5')](_0x323137[_0x49b54c]);});}return _0x56dbff;}function updateWaitingCounter(_0xf934c2){if(_0xf934c2[_0x7572('0x6')]){_0xf934c2[_0x7572('0x6')]-=0x1;}}function updateInteractionCounters(_0x70f015){_0x70f015[_0x7572('0x6')]=0x0;_0x70f015[_0x7572('0x7')]=0x0;_0x70f015[_0x7572('0x8')]=0x0;_0x70f015[_0x7572('0x9')]=0x0;_0x70f015['abandoned']=0x0;_0x70f015[_0x7572('0xa')]=0x0;if(_0x70f015[_0x7572('0xb')]){if(_0x70f015[_0x7572('0xc')]===_0x7572('0xd')){_0x70f015[_0x7572('0xd')]+=0x1;updateWaitingCounter(_0x70f015);}if(_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x8')]+=0x1;if(_0x70f015[_0x7572('0x7')]){_0x70f015[_0x7572('0x7')]-=0x1;}}else{if(_0x70f015[_0x7572('0xc')]){_0x70f015[_0x7572('0x9')]+=0x1;updateWaitingCounter(_0x70f015);}}}else{if(!_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x6')]+=0x1;}if(_0x70f015[_0x7572('0xe')]){_0x70f015[_0x7572('0x7')]+=0x1;updateWaitingCounter(_0x70f015);}}_0x70f015[_0x7572('0xa')]+=0x1;return _0x70f015;}function getLastMessageText(_0x4d2f34){return db[_0x7572('0xf')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4d2f34['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7572('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x7572('0x11'),'raw':!![]})[_0x7572('0x12')](function(_0x10012a){if(_0x10012a&&_0x10012a[_0x7572('0x13')]){_0x4d2f34[_0x7572('0x14')]=_[_0x7572('0x15')](_0x10012a[_0x7572('0x13')]);}return _0x4d2f34;})[_0x7572('0x16')](function(_0x1d4a45){throw _0x1d4a45;});}exports[_0x7572('0x17')]=function(_0x2b10b5,_0x104d98,_0x312896,_0x54143b){return new Promise(function(_0x4c8c82,_0x164e1c){return getInteractionUsers(_0x2b10b5['id'],_0x312896)['then'](function(_0x358cbd){_0x2b10b5[_0x7572('0x18')]=_0x358cbd;return getInteractionTags(_0x2b10b5[_0x7572('0x19')],_0x104d98);})[_0x7572('0x12')](function(_0x8fdae3){_0x2b10b5[_0x7572('0x1a')]=_0x8fdae3;delete _0x2b10b5[_0x7572('0x19')];return updateInteractionCounters(_0x2b10b5);})[_0x7572('0x12')](function(_0x235b90){if(_0x54143b){return getLastMessageText(_0x235b90);}else{return _0x235b90;}})['then'](function(_0x1c5e8b){_0x4c8c82(_0x1c5e8b);})[_0x7572('0x16')](function(_0x2078f7){_0x164e1c(_0x2078f7);});});}; \ No newline at end of file +var _0xadb6=['updateInteraction','then','Users','TagIds','Tags','lodash','../../mysqldb','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','findOne','out','plainBody','lastMsgText','trimStart','catch'];(function(_0x4ef05c,_0x2dcee1){var _0x3ea9e8=function(_0x66c867){while(--_0x66c867){_0x4ef05c['push'](_0x4ef05c['shift']());}};_0x3ea9e8(++_0x2dcee1);}(_0xadb6,0xf5));var _0x6adb=function(_0x49483d,_0xcff12d){_0x49483d=_0x49483d-0x0;var _0x23c29a=_0xadb6[_0x49483d];return _0x23c29a;};'use strict';var _=require(_0x6adb('0x0'));var db=require(_0x6adb('0x1'))['db'];function getInteractionUsers(_0x57af1e,_0x1aa13a){return new Promise(function(_0x261c73,_0x4edec8){try{var _0x187e9c=[];if(_0x1aa13a[_0x57af1e]){_0x187e9c=_0x1aa13a[_0x57af1e]['map'](function(_0x2c3fa1){return{'id':_0x2c3fa1['id'],'fullname':_0x2c3fa1[_0x6adb('0x2')]};});}return _0x261c73(_0x187e9c);}catch(_0x235e2a){_0x4edec8(_0x235e2a);}});}function getInteractionTags(_0x498207,_0x529b1b){var _0x5590db=[];if(_0x498207){_0x498207[_0x6adb('0x3')](',')['forEach'](function(_0xf9f2c0){_0x5590db[_0x6adb('0x4')](_0x529b1b[_0xf9f2c0]);});}return _0x5590db;}function updateWaitingCounter(_0x2c79d2){if(_0x2c79d2['waiting']){_0x2c79d2[_0x6adb('0x5')]-=0x1;}}function updateInteractionCounters(_0x35d9eb){_0x35d9eb['waiting']=0x0;_0x35d9eb[_0x6adb('0x6')]=0x0;_0x35d9eb[_0x6adb('0x7')]=0x0;_0x35d9eb[_0x6adb('0x8')]=0x0;_0x35d9eb[_0x6adb('0x9')]=0x0;_0x35d9eb[_0x6adb('0xa')]=0x0;if(_0x35d9eb['closed']){if(_0x35d9eb[_0x6adb('0xb')]===_0x6adb('0x9')){_0x35d9eb[_0x6adb('0x9')]+=0x1;updateWaitingCounter(_0x35d9eb);}if(_0x35d9eb['UserId']){_0x35d9eb['answered']+=0x1;if(_0x35d9eb[_0x6adb('0x6')]){_0x35d9eb['talking']-=0x1;}}else{if(_0x35d9eb[_0x6adb('0xb')]){_0x35d9eb[_0x6adb('0x8')]+=0x1;updateWaitingCounter(_0x35d9eb);}}}else{if(!_0x35d9eb[_0x6adb('0xc')]){_0x35d9eb[_0x6adb('0x5')]+=0x1;}if(_0x35d9eb[_0x6adb('0xc')]){_0x35d9eb[_0x6adb('0x6')]+=0x1;updateWaitingCounter(_0x35d9eb);}}_0x35d9eb[_0x6adb('0xa')]+=0x1;return _0x35d9eb;}function getLastMessageText(_0x3765b7){return db['MailMessage'][_0x6adb('0xd')]({'where':{'$and':[{'MailInteractionId':_0x3765b7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6adb('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6adb('0xf')],'order':'-id','raw':!![]})['then'](function(_0x410ac0){if(_0x410ac0&&_0x410ac0[_0x6adb('0xf')]){_0x3765b7[_0x6adb('0x10')]=_[_0x6adb('0x11')](_0x410ac0['plainBody']);}return _0x3765b7;})[_0x6adb('0x12')](function(_0x167e6a){throw _0x167e6a;});}exports[_0x6adb('0x13')]=function(_0x45a357,_0xb87153,_0x325578,_0x36d0d0){return new Promise(function(_0x51950a,_0x98b9f8){return getInteractionUsers(_0x45a357['id'],_0x325578)[_0x6adb('0x14')](function(_0x25c99d){_0x45a357[_0x6adb('0x15')]=_0x25c99d;return getInteractionTags(_0x45a357[_0x6adb('0x16')],_0xb87153);})['then'](function(_0x1d75b8){_0x45a357[_0x6adb('0x17')]=_0x1d75b8;delete _0x45a357[_0x6adb('0x16')];return updateInteractionCounters(_0x45a357);})[_0x6adb('0x14')](function(_0x51fd2b){if(_0x36d0d0){return getLastMessageText(_0x51fd2b);}else{return _0x51fd2b;}})['then'](function(_0x3a41ad){_0x51950a(_0x3a41ad);})['catch'](function(_0x73700c){_0x98b9f8(_0x73700c);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index dc569a0..c5d6a73 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 _0x6e2a=['null','Interaction','findOne','then','info','catch','error','exports','lodash','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','websites','_interactions','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e2a,0x140));var _0xa6e2=function(_0x4c14e1,_0x164882){_0x4c14e1=_0x4c14e1-0x0;var _0x4accda=_0x6e2a[_0x4c14e1];return _0x4accda;};'use strict';var _=require(_0xa6e2('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xa6e2('0x1'))('openchannel-interactions'),'mail':require(_0xa6e2('0x1'))(_0xa6e2('0x2')),'fax':require(_0xa6e2('0x1'))(_0xa6e2('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xa6e2('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xa6e2('0x4'))};function getAccountFK(_0x1d4228){return _[_0xa6e2('0x5')](_0x1d4228)+(_0x1d4228===_0xa6e2('0x6')?'Website':_0xa6e2('0x7'))+'Id';}function getInteractionFK(_0x49cf79){return _[_0xa6e2('0x5')](_0x49cf79)+_0xa6e2('0x8');}function getInteractionId(_0x3e3c4b,_0x5dac7b,_0x1af6d3){if(_0x3e3c4b&&_0x3e3c4b[_[_0xa6e2('0x9')](_0x1af6d3)+_0xa6e2('0x8')]){return _0x3e3c4b[_['upperFirst'](_0x1af6d3)+'InteractionId'];}else if(_0x3e3c4b&&_0x3e3c4b['id']){return _0x3e3c4b['id'];}else if(_0x5dac7b&&_0x5dac7b['id']){return _0x5dac7b['id'];}else{return'unknown';}}function getInteractionsTables(_0x8c645){return{'accounts':_0x8c645+'_'+(_0x8c645===_0xa6e2('0x6')?_0xa6e2('0xa'):'accounts'),'interactions':_0x8c645+_0xa6e2('0xb'),'interactionsTags':_0x8c645+'_interaction_has_tags','messages':_0x8c645+_0xa6e2('0xc'),'userInteractions':_0xa6e2('0xd')+_0x8c645+_0xa6e2('0xb')};}function getSelectedTags(_0x4ec6b6){var _0x5781b8=[];if(_0x4ec6b6){_0x5781b8=Array[_0xa6e2('0xe')](_0x4ec6b6)?_0x4ec6b6:[_0x4ec6b6];}return _0x5781b8;}function log(_0x49ae6a,_0x1a677c,_0x513f7b,_0x349f64,_0x19c77f,_0x369936){loggers[_0x19c77f['toLowerCase']()][_0x49ae6a](_0xa6e2('0xf'),_0x369936['toUpperCase'](),_0x1a677c?_0x1a677c['id']:null,_0x1a677c?_0x1a677c['name']:null,_0x1a677c?_0x1a677c[_0xa6e2('0x10')]:null,getInteractionId(_0x513f7b,_0x349f64,_0x19c77f),_0x513f7b?JSON[_0xa6e2('0x11')](_0x513f7b):_0xa6e2('0x12'));}function updateUser(_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857){db[_[_0xa6e2('0x9')](_0x220ecf)+_0xa6e2('0x13')][_0xa6e2('0x14')]({'where':{'id':getInteractionId(_0x4374c7,_0x4c06f3,_0x220ecf)}})[_0xa6e2('0x15')](function(_0x161ee0){if(_0x161ee0){return _0x161ee0['update']({'UserId':_0x466d6e?_0x466d6e['id']:null});}})['then'](function(_0x535c25){if(_0x535c25){log(_0xa6e2('0x16'),_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857);}})[_0xa6e2('0x17')](function(){log(_0xa6e2('0x18'),_0x466d6e,_0x4374c7,_0x4c06f3,_0x220ecf,_0x3ee857);});}module[_0xa6e2('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xeed2=['InteractionId','upperFirst','unknown','chat','websites','accounts','_interactions','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0xeed2,0xbc));var _0x2eed=function(_0x2c5b24,_0x3cf5dd){_0x2c5b24=_0x2c5b24-0x0;var _0x2080d1=_0xeed2[_0x2c5b24];return _0x2080d1;};'use strict';var _=require(_0x2eed('0x0'));var db=require(_0x2eed('0x1'))['db'];var loggers={'openchannel':require(_0x2eed('0x2'))('openchannel-interactions'),'mail':require(_0x2eed('0x2'))(_0x2eed('0x3')),'fax':require('../../config/logger')(_0x2eed('0x4')),'sms':require('../../config/logger')(_0x2eed('0x5')),'chat':require('../../config/logger')(_0x2eed('0x6')),'whatsapp':require(_0x2eed('0x2'))(_0x2eed('0x7'))};function getAccountFK(_0x260739){return _[_0x2eed('0x8')](_0x260739)+(_0x260739==='chat'?_0x2eed('0x9'):'Account')+'Id';}function getInteractionFK(_0x3086e6){return _[_0x2eed('0x8')](_0x3086e6)+_0x2eed('0xa');}function getInteractionId(_0x1ba80e,_0x311d10,_0x56d3cd){if(_0x1ba80e&&_0x1ba80e[_[_0x2eed('0xb')](_0x56d3cd)+_0x2eed('0xa')]){return _0x1ba80e[_['upperFirst'](_0x56d3cd)+_0x2eed('0xa')];}else if(_0x1ba80e&&_0x1ba80e['id']){return _0x1ba80e['id'];}else if(_0x311d10&&_0x311d10['id']){return _0x311d10['id'];}else{return _0x2eed('0xc');}}function getInteractionsTables(_0x2c1d8d){return{'accounts':_0x2c1d8d+'_'+(_0x2c1d8d===_0x2eed('0xd')?_0x2eed('0xe'):_0x2eed('0xf')),'interactions':_0x2c1d8d+_0x2eed('0x10'),'interactionsTags':_0x2c1d8d+'_interaction_has_tags','messages':_0x2c1d8d+'_messages','userInteractions':_0x2eed('0x11')+_0x2c1d8d+'_interactions'};}function getSelectedTags(_0x5730bc){var _0x4e09e0=[];if(_0x5730bc){_0x4e09e0=Array[_0x2eed('0x12')](_0x5730bc)?_0x5730bc:[_0x5730bc];}return _0x4e09e0;}function log(_0x61a0d1,_0x4048b6,_0x20ec8a,_0x476e0a,_0x4d5eea,_0x2202d7){loggers[_0x4d5eea[_0x2eed('0x13')]()][_0x61a0d1](_0x2eed('0x14'),_0x2202d7[_0x2eed('0x15')](),_0x4048b6?_0x4048b6['id']:null,_0x4048b6?_0x4048b6[_0x2eed('0x16')]:null,_0x4048b6?_0x4048b6[_0x2eed('0x17')]:null,getInteractionId(_0x20ec8a,_0x476e0a,_0x4d5eea),_0x20ec8a?JSON[_0x2eed('0x18')](_0x20ec8a):_0x2eed('0x19'));}function updateUser(_0x231067,_0x5433fc,_0x1ac247,_0x489ed6,_0x42efa2){db[_[_0x2eed('0xb')](_0x489ed6)+_0x2eed('0x1a')][_0x2eed('0x1b')]({'where':{'id':getInteractionId(_0x5433fc,_0x1ac247,_0x489ed6)}})[_0x2eed('0x1c')](function(_0x3eec7c){if(_0x3eec7c){return _0x3eec7c['update']({'UserId':_0x231067?_0x231067['id']:null});}})[_0x2eed('0x1c')](function(_0x25d8e3){if(_0x25d8e3){log(_0x2eed('0x1d'),_0x231067,_0x5433fc,_0x1ac247,_0x489ed6,_0x42efa2);}})[_0x2eed('0x1e')](function(){log(_0x2eed('0x1f'),_0x231067,_0x5433fc,_0x1ac247,_0x489ed6,_0x42efa2);});}module[_0x2eed('0x20')]={'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 f938bfa..5d7c094 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 _0x4dd7=['../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0x4dd7,0x1d2));var _0x74dd=function(_0x53ec25,_0x597be6){_0x53ec25=_0x53ec25-0x0;var _0x287975=_0x4dd7[_0x53ec25];return _0x287975;};'use strict';var crypto=require(_0x74dd('0x0'));var util=require('util');var compose=require(_0x74dd('0x1'));var db=require(_0x74dd('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1b344b,_0xc3947a){if(_0x1b344b&&_0xc3947a){if(_0xc3947a[_0x74dd('0x3')]&&_0xc3947a[_0x74dd('0x4')]){var _0x479e63=_0xc3947a[_0x74dd('0x3')];var _0x1f54b2=_0xc3947a['license'];var _0x1cba0c=_0x479e63[_0x74dd('0x5')]('-')[0x4];var _0x781317=_0x479e63[_0x74dd('0x5')]('-')[0x0];var _0x4f91ff=crypto[_0x74dd('0x6')](_0x74dd('0x7'),util[_0x74dd('0x8')]('%s:%s:%s',_0x1cba0c,_0x479e63,_0x781317));var _0x372da1=_0x4f91ff[_0x74dd('0x9')](_0x1f54b2,'base64',_0x74dd('0xa'));_0x372da1+=_0x4f91ff[_0x74dd('0xb')](_0x74dd('0xa'));var _0x739464=JSON[_0x74dd('0xc')](_0x372da1);return _0x739464[_0x74dd('0xd')](_0x1b344b)?_0x739464[_0x1b344b]:null;}}return null;}function isLimit(_0x84ab35,_0x589fc0,_0x5bdc99,_0x4c41de){var _0x562c30=_0x589fc0;return compose()[_0x74dd('0xe')](function(_0x50495f,_0x56779e,_0x4f0749){return db['License'][_0x74dd('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x74dd('0x10')](function(_0x2fe99e){var _0x4ffaba=getValueFromLicense(_0x84ab35,_0x2fe99e);return _0x4ffaba?_0x4ffaba:_0x562c30;})[_0x74dd('0x10')](function(_0x4155ac){_0x562c30=_0x4155ac;return _0x5bdc99[_0x74dd('0x11')](_0x4c41de);})[_0x74dd('0x10')](function(_0x51864f){if(_0x51864f>=_0x562c30){return _0x56779e[_0x74dd('0x12')](0x193)[_0x74dd('0x13')]({'message':util[_0x74dd('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x84ab35)});}_0x4f0749();})[_0x74dd('0x14')](function(_0xcc6db5){_0x4f0749(_0xcc6db5);});});}function isUserLimit(){return isLimit(_0x74dd('0x15'),0x1,db[_0x74dd('0x16')],{'where':{'$or':[{'role':_0x74dd('0x17')},{'role':_0x74dd('0x18')}]}});}exports[_0x74dd('0x19')]=isUserLimit; \ No newline at end of file +var _0xcff2=['license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1'];(function(_0x928a02,_0x2257cd){var _0x30705c=function(_0x5879a1){while(--_0x5879a1){_0x928a02['push'](_0x928a02['shift']());}};_0x30705c(++_0x2257cd);}(_0xcff2,0x172));var _0x2cff=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xcff2[_0x5dc03e];return _0x466a07;};'use strict';var crypto=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var compose=require(_0x2cff('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2cff('0x3'));function getValueFromLicense(_0x28f093,_0x24566d){if(_0x28f093&&_0x24566d){if(_0x24566d[_0x2cff('0x4')]&&_0x24566d[_0x2cff('0x5')]){var _0x86cb45=_0x24566d['data1'];var _0x5b74b2=_0x24566d['license'];var _0x28f429=_0x86cb45[_0x2cff('0x6')]('-')[0x4];var _0x47539c=_0x86cb45[_0x2cff('0x6')]('-')[0x0];var _0x409e97=crypto[_0x2cff('0x7')](_0x2cff('0x8'),util[_0x2cff('0x9')](_0x2cff('0xa'),_0x28f429,_0x86cb45,_0x47539c));var _0x5a3dda=_0x409e97['update'](_0x5b74b2,_0x2cff('0xb'),_0x2cff('0xc'));_0x5a3dda+=_0x409e97[_0x2cff('0xd')](_0x2cff('0xc'));var _0x4dc1d1=JSON[_0x2cff('0xe')](_0x5a3dda);return _0x4dc1d1[_0x2cff('0xf')](_0x28f093)?_0x4dc1d1[_0x28f093]:null;}}return null;}function isLimit(_0x225f23,_0x7a9b20,_0x5c81e4,_0x45df27){var _0x3e6734=_0x7a9b20;return compose()[_0x2cff('0x10')](function(_0x4ceaf9,_0x20eba3,_0x3ca6f2){return db[_0x2cff('0x11')][_0x2cff('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x2cff('0x13')](function(_0xeae4e3){var _0x1026a4=getValueFromLicense(_0x225f23,_0xeae4e3);return _0x1026a4?_0x1026a4:_0x3e6734;})['then'](function(_0x45fd09){_0x3e6734=_0x45fd09;return _0x5c81e4[_0x2cff('0x14')](_0x45df27);})[_0x2cff('0x13')](function(_0x41c1bc){if(_0x41c1bc>=_0x3e6734){return _0x20eba3['status'](0x193)['json']({'message':util['format'](_0x2cff('0x15'),_0x225f23)});}_0x3ca6f2();})['catch'](function(_0x47dca6){_0x3ca6f2(_0x47dca6);});});}function isUserLimit(){return isLimit(_0x2cff('0x16'),0x1,db[_0x2cff('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x2cff('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c047aed..8af3022 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 _0x6d1f=['$notIn','\x20IS\x20NULL)','IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','$gte','$in','$substring','start','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','shift','match','forEach','split','indexOf','map','conditions','push','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field'];(function(_0x2a1493,_0x2823df){var _0x46b988=function(_0x15c467){while(--_0x15c467){_0x2a1493['push'](_0x2a1493['shift']());}};_0x46b988(++_0x2823df);}(_0x6d1f,0x83));var _0xf6d1=function(_0x45de41,_0x18455e){_0x45de41=_0x45de41-0x0;var _0x51c8c9=_0x6d1f[_0x45de41];return _0x51c8c9;};'use strict';var _=require(_0xf6d1('0x0'));var moment=require(_0xf6d1('0x1'));exports[_0xf6d1('0x2')]=function(_0x2b7023){var _0x590b13={'conditions':[]};_0x590b13[_0xf6d1('0x3')]=_[_0xf6d1('0x4')](_0x2b7023,_0xf6d1('0x5'))?'or':'and';var _0xbd99ac=_0x2b7023[_0xf6d1('0x6')](_0xf6d1('0x7'),'')[_0xf6d1('0x6')](_0xf6d1('0x5'),'')['split']('||');for(var _0x294e47=0x0;_0x294e47<_0xbd99ac[_0xf6d1('0x8')];_0x294e47++){var _0x2ed6f3=_0xbd99ac[_0x294e47]['split'](':=');var _0x181d1a=_0x2ed6f3[0x0];var _0x2eb12e=_0x2ed6f3[_0xf6d1('0x9')](0x1);_0x2eb12e['forEach'](function(_0x4d2e86){var _0x453580=_0x4d2e86['split']('[')[_0xf6d1('0xa')]();var _0x9aced8=_0x4d2e86[_0xf6d1('0xb')](/\[(.*?)\]/g);_0x9aced8[_0xf6d1('0xc')](function(_0x481a8c){var _0x54d83a=_0x481a8c[_0xf6d1('0xd')]('[')['filter'](function(_0x5e688c){return _0x5e688c[_0xf6d1('0xe')](']')>-0x1;})[_0xf6d1('0xf')](function(_0x3532a2){return _0x3532a2[_0xf6d1('0xd')](']')[0x0];})[0x0];_0x590b13[_0xf6d1('0x10')][_0xf6d1('0x11')]({'field':_0x181d1a,'operator':_0x453580,'value':_0x54d83a});});});}return _0x590b13;};exports[_0xf6d1('0x12')]=function(_0x41e36d,_0x2e75d9,_0x4edcc1){var _0x4cd4dc={};if(_0x2e75d9==='DATE'){if(_0x4edcc1[_0xf6d1('0x13')]===_0xf6d1('0x14')){_0x4edcc1[_0xf6d1('0x13')]=_0xf6d1('0x15');_0x4edcc1['value']+=','+_0x4edcc1[_0xf6d1('0x16')];}else if(_[_0xf6d1('0x17')]([_0xf6d1('0x18'),_0xf6d1('0x19')],_0x4edcc1[_0xf6d1('0x13')])){_0x4edcc1[_0xf6d1('0x16')]=moment(_0x4edcc1[_0xf6d1('0x16')])[_0xf6d1('0x1a')](0x1,_0xf6d1('0x1b'))[_0xf6d1('0x1c')](_0xf6d1('0x1d'));}}if(_0x4edcc1[_0xf6d1('0x1e')]){_0x2e75d9=_0x4edcc1['castTo'];_0x4cd4dc[_0xf6d1('0x1f')]=_0xf6d1('0x20')+_0x41e36d+'.'+_0x4edcc1['field']+'\x20AS\x20'+_0x4edcc1[_0xf6d1('0x1e')]+')\x20'+parseOperator(_0x4edcc1[_0xf6d1('0x13')]);}else{_0x4cd4dc[_0xf6d1('0x1f')]=_0x41e36d+'.'+_0x4edcc1[_0xf6d1('0x21')]+'\x20'+parseOperator(_0x4edcc1['operator']);}if(_[_0xf6d1('0x17')](['$ne',_0xf6d1('0x22')],_0x4edcc1[_0xf6d1('0x13')]))_0x4cd4dc[_0xf6d1('0x1f')]='('+_0x4cd4dc[_0xf6d1('0x1f')]+'\x20OR\x20'+_0x41e36d+'.'+_0x4edcc1[_0xf6d1('0x21')]+_0xf6d1('0x23');_0x4cd4dc['value']=parseValue(_0x2e75d9,_0x4edcc1[_0xf6d1('0x13')],_0x4edcc1[_0xf6d1('0x16')]);return _0x4cd4dc;};function parseOperator(_0x116ee3){var _0x2e116b;switch(_0x116ee3){case'$in':_0x2e116b=_0xf6d1('0x24');break;case _0xf6d1('0x22'):_0x2e116b='NOT\x20IN\x20?';break;case'$eq':_0x2e116b=_0xf6d1('0x25');break;case _0xf6d1('0x26'):_0x2e116b=_0xf6d1('0x27');break;case'$substring':case _0xf6d1('0x28'):case _0xf6d1('0x29'):_0x2e116b='LIKE\x20?';break;case _0xf6d1('0x2a'):_0x2e116b=_0xf6d1('0x2b');break;case _0xf6d1('0x18'):_0x2e116b=_0xf6d1('0x2c');break;case _0xf6d1('0x19'):_0x2e116b='<=\x20?';break;case _0xf6d1('0x2d'):_0x2e116b='>=\x20?';break;case _0xf6d1('0x15'):_0x2e116b='BETWEEN\x20?\x20AND\x20?';break;}return _0x2e116b;}function parseValue(_0x435b06,_0x4cbeeb,_0x2312a2){var _0x1b95f6={'start':undefined,'end':undefined};switch(_0x4cbeeb){case _0xf6d1('0x2e'):case _0xf6d1('0x22'):_0x1b95f6['start']=_0x2312a2['split'](',');break;case _0xf6d1('0x2f'):_0x1b95f6['start']='%'+_0x2312a2+'%';break;case _0xf6d1('0x28'):_0x1b95f6[_0xf6d1('0x30')]=_0x2312a2+'%';break;case _0xf6d1('0x29'):_0x1b95f6[_0xf6d1('0x30')]='%'+_0x2312a2;break;case _0xf6d1('0x15'):var _0x1c4183=_0x2312a2['split'](',');var _0x2312a2=_0x1c4183['shift']();var _0x2ba8e0=_0x1c4183[_0xf6d1('0x31')]();if(_0x435b06===_0xf6d1('0x32')){_0x2312a2=moment(_0x2312a2)[_0xf6d1('0x33')](0x0,!![])[_0xf6d1('0x1c')]();_0x2ba8e0=moment(_0x2ba8e0)['utcOffset'](0x0,!![])[_0xf6d1('0x1a')](0x17,_0xf6d1('0x34'))[_0xf6d1('0x1a')](0x3b,_0xf6d1('0x35'))['add'](0x3b,_0xf6d1('0x36'))['format']();}_0x1b95f6={'start':_0x2312a2,'end':_0x2ba8e0};break;default:_0x1b95f6[_0xf6d1('0x30')]=_0x2312a2;break;}return _0x1b95f6;} \ No newline at end of file +var _0xfe89=['format','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','slice','shift','match','forEach','split','filter','push','buildExpression','operator','$eq','$between','value','includes','$lte','add','YYYY-MM-DD','castTo','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','$in','IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe89,0x68));var _0x9fe8=function(_0x55534b,_0x39ab51){_0x55534b=_0x55534b-0x0;var _0x15683e=_0xfe89[_0x55534b];return _0x15683e;};'use strict';var _=require('lodash');var moment=require(_0x9fe8('0x0'));exports[_0x9fe8('0x1')]=function(_0x2e246e){var _0x2ecf32={'conditions':[]};_0x2ecf32[_0x9fe8('0x2')]=_[_0x9fe8('0x3')](_0x2e246e,_0x9fe8('0x4'))?'or':_0x9fe8('0x5');var _0x74a286=_0x2e246e[_0x9fe8('0x6')](_0x9fe8('0x7'),'')['replace'](_0x9fe8('0x4'),'')['split']('||');for(var _0x1ac709=0x0;_0x1ac709<_0x74a286['length'];_0x1ac709++){var _0x48ea34=_0x74a286[_0x1ac709]['split'](':=');var _0x584f44=_0x48ea34[0x0];var _0x1a5cbf=_0x48ea34[_0x9fe8('0x8')](0x1);_0x1a5cbf['forEach'](function(_0x248c22){var _0x4b6003=_0x248c22['split']('[')[_0x9fe8('0x9')]();var _0x525cf7=_0x248c22[_0x9fe8('0xa')](/\[(.*?)\]/g);_0x525cf7[_0x9fe8('0xb')](function(_0x38e0b4){var _0x46ae84=_0x38e0b4[_0x9fe8('0xc')]('[')[_0x9fe8('0xd')](function(_0x3d0ceb){return _0x3d0ceb['indexOf'](']')>-0x1;})['map'](function(_0x300d93){return _0x300d93['split'](']')[0x0];})[0x0];_0x2ecf32['conditions'][_0x9fe8('0xe')]({'field':_0x584f44,'operator':_0x4b6003,'value':_0x46ae84});});});}return _0x2ecf32;};exports[_0x9fe8('0xf')]=function(_0x3e6161,_0x29459e,_0x2f0060){var _0x1be499={};if(_0x29459e==='DATE'){if(_0x2f0060[_0x9fe8('0x10')]===_0x9fe8('0x11')){_0x2f0060['operator']=_0x9fe8('0x12');_0x2f0060[_0x9fe8('0x13')]+=','+_0x2f0060[_0x9fe8('0x13')];}else if(_[_0x9fe8('0x14')](['$gt',_0x9fe8('0x15')],_0x2f0060['operator'])){_0x2f0060[_0x9fe8('0x13')]=moment(_0x2f0060['value'])[_0x9fe8('0x16')](0x1,'days')['format'](_0x9fe8('0x17'));}}if(_0x2f0060[_0x9fe8('0x18')]){_0x29459e=_0x2f0060[_0x9fe8('0x18')];_0x1be499['text']='CAST('+_0x3e6161+'.'+_0x2f0060[_0x9fe8('0x19')]+_0x9fe8('0x1a')+_0x2f0060[_0x9fe8('0x18')]+')\x20'+parseOperator(_0x2f0060[_0x9fe8('0x10')]);}else{_0x1be499[_0x9fe8('0x1b')]=_0x3e6161+'.'+_0x2f0060['field']+'\x20'+parseOperator(_0x2f0060[_0x9fe8('0x10')]);}if(_[_0x9fe8('0x14')]([_0x9fe8('0x1c'),_0x9fe8('0x1d')],_0x2f0060[_0x9fe8('0x10')]))_0x1be499[_0x9fe8('0x1b')]='('+_0x1be499[_0x9fe8('0x1b')]+_0x9fe8('0x1e')+_0x3e6161+'.'+_0x2f0060[_0x9fe8('0x19')]+'\x20IS\x20NULL)';_0x1be499['value']=parseValue(_0x29459e,_0x2f0060[_0x9fe8('0x10')],_0x2f0060['value']);return _0x1be499;};function parseOperator(_0x540693){var _0x2a234a;switch(_0x540693){case _0x9fe8('0x1f'):_0x2a234a=_0x9fe8('0x20');break;case _0x9fe8('0x1d'):_0x2a234a='NOT\x20IN\x20?';break;case _0x9fe8('0x11'):_0x2a234a=_0x9fe8('0x21');break;case _0x9fe8('0x1c'):_0x2a234a=_0x9fe8('0x22');break;case _0x9fe8('0x23'):case _0x9fe8('0x24'):case _0x9fe8('0x25'):_0x2a234a=_0x9fe8('0x26');break;case _0x9fe8('0x27'):_0x2a234a='<\x20?';break;case _0x9fe8('0x28'):_0x2a234a=_0x9fe8('0x29');break;case _0x9fe8('0x15'):_0x2a234a='<=\x20?';break;case _0x9fe8('0x2a'):_0x2a234a=_0x9fe8('0x2b');break;case _0x9fe8('0x12'):_0x2a234a=_0x9fe8('0x2c');break;}return _0x2a234a;}function parseValue(_0x2d9371,_0x1e78d5,_0x2a0722){var _0x14d757={'start':undefined,'end':undefined};switch(_0x1e78d5){case'$in':case _0x9fe8('0x1d'):_0x14d757[_0x9fe8('0x2d')]=_0x2a0722[_0x9fe8('0xc')](',');break;case _0x9fe8('0x23'):_0x14d757[_0x9fe8('0x2d')]='%'+_0x2a0722+'%';break;case _0x9fe8('0x24'):_0x14d757['start']=_0x2a0722+'%';break;case _0x9fe8('0x25'):_0x14d757[_0x9fe8('0x2d')]='%'+_0x2a0722;break;case _0x9fe8('0x12'):var _0x349af1=_0x2a0722[_0x9fe8('0xc')](',');var _0x2a0722=_0x349af1['shift']();var _0x4c9661=_0x349af1[_0x9fe8('0x2e')]();if(_0x2d9371===_0x9fe8('0x2f')){_0x2a0722=moment(_0x2a0722)[_0x9fe8('0x30')](0x0,!![])[_0x9fe8('0x31')]();_0x4c9661=moment(_0x4c9661)[_0x9fe8('0x30')](0x0,!![])['add'](0x17,'hours')['add'](0x3b,'minutes')[_0x9fe8('0x16')](0x3b,_0x9fe8('0x32'))['format']();}_0x14d757={'start':_0x2a0722,'end':_0x4c9661};break;default:_0x14d757[_0x9fe8('0x2d')]=_0x2a0722;break;}return _0x14d757;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 2f947c3..1fee118 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 _0xa6bb=['sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','fields','filters','forOwn','find','type','DATE','$gte','format','name','uniqueid','isArray','split','offset','sort','indexOf','priority','cast','col','unsigned','ASC','isEmpty','length','isObject','isString','omit','^[+]?[0-9]*$','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','replace','getOptions','query','$id','intersection','attributes','hasOwnProperty','limit','where','filter','object','columns','value','merge','map','VIRTUAL','lower','options','includeAll','include'];(function(_0x2d7842,_0x5e1932){var _0x35485d=function(_0x56843a){while(--_0x56843a){_0x2d7842['push'](_0x2d7842['shift']());}};_0x35485d(++_0x5e1932);}(_0xa6bb,0x12c));var _0xba6b=function(_0x88c524,_0x40a7f8){_0x88c524=_0x88c524-0x0;var _0x2c754b=_0xa6bb[_0x88c524];return _0x2c754b;};'use strict';var _=require('lodash');var sequelize=require(_0xba6b('0x0'));var moment=require(_0xba6b('0x1'));var db=require(_0xba6b('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x418373){var _0x112efb=['ne'];try{var _0x5f29e1=JSON['parse'](_0x418373);var _0x5d1f87=Object[_0xba6b('0x3')](_0x5f29e1)[0x0];return _0x112efb[_0xba6b('0x4')](_0x5d1f87);}catch(_0x316bd0){return![];}}function getOperatorValue(_0x517d10){var _0x4cc381=JSON[_0xba6b('0x5')](_0x517d10);var _0x4f6c6c=Object[_0xba6b('0x3')](_0x4cc381)[0x0];var _0x5506d6=_0x4cc381[_0x4f6c6c];return{['$'+_0x4f6c6c]:_0x5506d6};}function parseIncludeModel(_0x55f5c3){var _0x135892=JSON[_0xba6b('0x5')](_0x55f5c3);return{'model':db[_0x135892[_0xba6b('0x6')]],'as':_0x135892[_0xba6b('0x7')],'attributes':_0x135892[_0xba6b('0x8')],'raw':_0x135892['raw']};}exports[_0xba6b('0x8')]=function(_0x297f02){var _0x25c14d=null;if(_0x297f02){_0x25c14d=_0x297f02['split'](',');}return _0x25c14d;};exports[_0xba6b('0x9')]=function(_0x35e23d,_0x3bf240){var _0x11bcb9={};if(!_['isEmpty'](_0x35e23d)){_[_0xba6b('0xa')](_0x35e23d,function(_0x5b1d28,_0x12ae0b){try{if(_0x3bf240){var _0x1adc27=_[_0xba6b('0xb')](_0x3bf240,{'name':_0x12ae0b})||{};if(hasSequelizeOperator(_0x5b1d28)){_0x11bcb9[_0x12ae0b]=getOperatorValue(_0x5b1d28);}else if(_0x1adc27[_0xba6b('0xc')]===_0xba6b('0xd')&&_['isPlainObject'](_0x5b1d28)){var _0x309d5f=JSON[_0xba6b('0x5')](_0x5b1d28);var _0x50b58a={'$gte':moment(moment(_0x309d5f[_0xba6b('0xe')])[_0xba6b('0xf')]('YYYY-MM-DD'))['utc']()[_0xba6b('0xf')](),'$lte':moment(moment(_0x309d5f['$lte'])['format']('YYYY-MM-DD'))['utc']()['subtract'](0x1,'s')[_0xba6b('0xf')]()};_0x11bcb9[_0x12ae0b]=_0x50b58a;}else if(_0x1adc27[_0xba6b('0x10')]===_0xba6b('0x11')){_0x11bcb9[_0x12ae0b]=_0x5b1d28;}else{_0x11bcb9[_0x12ae0b]=_[_0xba6b('0x12')](_0x5b1d28)?_0x5b1d28:JSON[_0xba6b('0x5')](_0x5b1d28);}}else{_0x11bcb9[_0x12ae0b]=_[_0xba6b('0x12')](_0x5b1d28)?_0x5b1d28:JSON[_0xba6b('0x5')](_0x5b1d28);}}catch(_0x5697f8){_0x11bcb9[_0x12ae0b]=_0x5b1d28[_0xba6b('0x13')](',');}});}return _0x11bcb9;};exports['limit']=function(_0x54a392){_0x54a392=parseInt(_0x54a392,0xa);if(!_0x54a392||_0x54a392<0x0){_0x54a392=LIMIT_VALUE;}return _0x54a392;};exports[_0xba6b('0x14')]=function(_0x120157){_0x120157=parseInt(_0x120157,0xa);if(!_0x120157||_0x120157<0x0){_0x120157=0x0;}return _0x120157;};exports[_0xba6b('0x15')]=function(_0x1751f3){var _0x47b615,_0xa632cb=null;if(_0x1751f3){_0x47b615=_0x1751f3[_0xba6b('0x13')](',');_0xa632cb=_['map'](_0x47b615,function(_0x38c46a){if(_0x38c46a[_0xba6b('0x16')]('-')===0x0){return[_0x38c46a===_0xba6b('0x17')?sequelize[_0xba6b('0x18')](sequelize[_0xba6b('0x19')]('priority'),'unsigned'):_0x38c46a['substr'](0x1),'DESC'];}else{return[_0x38c46a===_0xba6b('0x17')?sequelize[_0xba6b('0x18')](sequelize[_0xba6b('0x19')](_0xba6b('0x17')),_0xba6b('0x1a')):_0x38c46a,_0xba6b('0x1b')];}});}return _0xa632cb;};exports['omit']=function(_0x876e58,_0x2b13f3){if(_[_0xba6b('0x1c')](_0x876e58)){return _0x876e58;}if(_['isArray'](_0x876e58)){for(var _0x47574c=0x0;_0x47574c<_0x876e58[_0xba6b('0x1d')];_0x47574c+=0x1){_0x876e58[_0x47574c]=this['omit'](_0x876e58[_0x47574c],_0x2b13f3);}return _0x876e58;}if(!_[_0xba6b('0x1e')](_0x876e58)){return _0x876e58;}if(_[_0xba6b('0x1f')](_0x2b13f3)){_0x2b13f3=[_0x2b13f3];}if(!_[_0xba6b('0x12')](_0x2b13f3)){return _0x876e58;}for(var _0x41a0e0=0x0;_0x41a0e0<_0x2b13f3[_0xba6b('0x1d')];_0x41a0e0+=0x1){_['unset'](_0x876e58,_0x2b13f3[_0x41a0e0]);}for(var _0x18a4c1 in _0x876e58){if(_0x876e58['hasOwnProperty'](_0x18a4c1)){_0x876e58[_0x18a4c1]=this[_0xba6b('0x20')](_0x876e58[_0x18a4c1],_0x2b13f3);}}return _0x876e58;};exports['isNumeric']=function(_0x1a6b93){return _0x1a6b93['match'](RegExp(_0xba6b('0x21')))?!![]:![];};exports['isEmail']=function(_0x205af9){return _0x205af9[_0xba6b('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xba6b('0x23')]=function(_0x474cc7,_0x5e87ed){var _0x2e9bda=[];var _0x563d5a=/[ `!@#$%^&*()_\-?~]/;var _0x58bf66=_0x5e87ed?_0xba6b('0x24'):_0xba6b('0x25');_0x474cc7['split'](/[ ,]+/)[_0xba6b('0x26')](function(_0x4f74a7){_0x4f74a7=_0x4f74a7['replace'](/([^:]")"+/g,'$1');_0x4f74a7='+'+_0x4f74a7+'*';var _0x2531b3=_0x4f74a7[_0xba6b('0x22')](_0x563d5a);if(_0x2531b3){_0x4f74a7='\x22'+_0x4f74a7+'\x22';}_0x2e9bda[_0xba6b('0x27')](_0x4f74a7);});_0x58bf66=_0x58bf66[_0xba6b('0x28')](_0xba6b('0x25'),_0x2e9bda['join']('\x20'));return _0x58bf66;};exports[_0xba6b('0x29')]=function(_0x471bcc,_0x356454,_0xd39097){var _0x27f665={},_0x1cd27a={};if(_0x356454[_0xba6b('0x2a')][_0xba6b('0x2b')]){_0x356454[_0xba6b('0x2a')]['id']=_0x356454['query'][_0xba6b('0x2b')];delete _0x356454[_0xba6b('0x2a')][_0xba6b('0x2b')];}_0x27f665[_0xba6b('0x6')]=_['map'](_0x471bcc,'name');_0x27f665[_0xba6b('0x2a')]=_[_0xba6b('0x3')](_0x356454[_0xba6b('0x2a')]);_0x27f665[_0xba6b('0x9')]=_['intersection'](_0x27f665[_0xba6b('0x6')],_0x27f665[_0xba6b('0x2a')]);_0x1cd27a['attributes']=_[_0xba6b('0x2c')](_0x27f665['model'],this[_0xba6b('0x8')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x8')]));_0x1cd27a['attributes']=_0x1cd27a[_0xba6b('0x2d')][_0xba6b('0x1d')]?_0x1cd27a['attributes']:_0x27f665[_0xba6b('0x6')];if(!_0x356454['query'][_0xba6b('0x2e')]('nolimit')){_0x1cd27a[_0xba6b('0x2f')]=this['limit'](_0x356454[_0xba6b('0x2a')]['limit']);_0x1cd27a[_0xba6b('0x14')]=this[_0xba6b('0x14')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x14')]);}_0x1cd27a['order']=this[_0xba6b('0x15')](_0x356454[_0xba6b('0x2a')][_0xba6b('0x15')]);_0x1cd27a[_0xba6b('0x30')]=this[_0xba6b('0x9')](_['pick'](_0x356454[_0xba6b('0x2a')],_0x27f665['filters']),_0x471bcc);if(_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]){var _0x5b710a=_0x471bcc;var _0x57e9b5=_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')];if(typeof _0x57e9b5===_0xba6b('0x32')){_0x5b710a=_[_0xba6b('0x31')](_0x471bcc,function(_0x5afbf6){return _[_0xba6b('0x4')](_0x57e9b5[_0xba6b('0x33')],_0x5afbf6[_0xba6b('0x10')]);});_0x57e9b5=_0x57e9b5[_0xba6b('0x34')];}_0x1cd27a['where']=_[_0xba6b('0x35')](_0x1cd27a[_0xba6b('0x30')],{'$or':_[_0xba6b('0x36')](_0x5b710a,function(_0x2a570f){if(_0x2a570f[_0xba6b('0xc')]!==_0xba6b('0x37')){if(_0xd39097){return sequelize['where'](sequelize['fn'](_0xba6b('0x38'),sequelize[_0xba6b('0x19')](_0x2a570f[_0xba6b('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]+'%')});}else{var _0x60fc1b={};_0x60fc1b[_0x2a570f[_0xba6b('0x10')]]={'$like':'%'+_0x356454[_0xba6b('0x2a')][_0xba6b('0x31')]+'%'};return _0x60fc1b;}}})});}_0x1cd27a=_[_0xba6b('0x35')]({},_0x1cd27a,_0x356454[_0xba6b('0x39')]);return _0x1cd27a;};exports['include']=function(_0x15e3c5){var _0x24c61b=[];if(_0x15e3c5[_0xba6b('0x3a')]){_0x24c61b['push']({'all':!![]});}else if(_0x15e3c5[_0xba6b('0x3b')]){if(Array[_0xba6b('0x12')](_0x15e3c5[_0xba6b('0x3b')])){_0x24c61b=Object[_0xba6b('0x3')](_0x15e3c5[_0xba6b('0x3b')])[_0xba6b('0x36')](function(_0x3ede2b){return parseIncludeModel(_0x15e3c5[_0xba6b('0x3b')][_0x3ede2b]);});}else{var _0x2dea62=parseIncludeModel(_0x15e3c5['include']);_0x24c61b[_0xba6b('0x27')](_0x2dea62);}}return _0x24c61b;}; \ No newline at end of file +var _0xc43c=['nolimit','where','filter','object','columns','value','merge','type','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','includes','keys','model','alias','fields','raw','split','filters','isEmpty','find','isPlainObject','$gte','format','$lte','YYYY-MM-DD','subtract','name','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','push','$id','query','map','intersection','attributes'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xc43c,0x152));var _0xcc43=function(_0x3e8682,_0x5d4355){_0x3e8682=_0x3e8682-0x0;var _0x1a4c86=_0xc43c[_0x3e8682];return _0x1a4c86;};'use strict';var _=require(_0xcc43('0x0'));var sequelize=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var db=require(_0xcc43('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x14352d){var _0x275c81=['ne'];try{var _0x53ef5e=JSON[_0xcc43('0x4')](_0x14352d);var _0x258c7e=Object['keys'](_0x53ef5e)[0x0];return _0x275c81[_0xcc43('0x5')](_0x258c7e);}catch(_0x456b6c){return![];}}function getOperatorValue(_0x217a5e){var _0x17d1a2=JSON[_0xcc43('0x4')](_0x217a5e);var _0x13c316=Object[_0xcc43('0x6')](_0x17d1a2)[0x0];var _0x3b8857=_0x17d1a2[_0x13c316];return{['$'+_0x13c316]:_0x3b8857};}function parseIncludeModel(_0x1913c6){var _0x74cf47=JSON['parse'](_0x1913c6);return{'model':db[_0x74cf47[_0xcc43('0x7')]],'as':_0x74cf47[_0xcc43('0x8')],'attributes':_0x74cf47[_0xcc43('0x9')],'raw':_0x74cf47[_0xcc43('0xa')]};}exports[_0xcc43('0x9')]=function(_0x3e6afd){var _0x486779=null;if(_0x3e6afd){_0x486779=_0x3e6afd[_0xcc43('0xb')](',');}return _0x486779;};exports[_0xcc43('0xc')]=function(_0x42b3e1,_0xca5a20){var _0xff523d={};if(!_[_0xcc43('0xd')](_0x42b3e1)){_['forOwn'](_0x42b3e1,function(_0x3587b8,_0x5aadbc){try{if(_0xca5a20){var _0xb3304a=_[_0xcc43('0xe')](_0xca5a20,{'name':_0x5aadbc})||{};if(hasSequelizeOperator(_0x3587b8)){_0xff523d[_0x5aadbc]=getOperatorValue(_0x3587b8);}else if(_0xb3304a['type']==='DATE'&&_[_0xcc43('0xf')](_0x3587b8)){var _0x20401f=JSON[_0xcc43('0x4')](_0x3587b8);var _0x3b9eff={'$gte':moment(moment(_0x20401f[_0xcc43('0x10')])[_0xcc43('0x11')]('YYYY-MM-DD'))['utc']()[_0xcc43('0x11')](),'$lte':moment(moment(_0x20401f[_0xcc43('0x12')])[_0xcc43('0x11')](_0xcc43('0x13')))['utc']()[_0xcc43('0x14')](0x1,'s')[_0xcc43('0x11')]()};_0xff523d[_0x5aadbc]=_0x3b9eff;}else if(_0xb3304a[_0xcc43('0x15')]==='uniqueid'){_0xff523d[_0x5aadbc]=_0x3587b8;}else{_0xff523d[_0x5aadbc]=_['isArray'](_0x3587b8)?_0x3587b8:JSON[_0xcc43('0x4')](_0x3587b8);}}else{_0xff523d[_0x5aadbc]=_[_0xcc43('0x16')](_0x3587b8)?_0x3587b8:JSON['parse'](_0x3587b8);}}catch(_0x596f8a){_0xff523d[_0x5aadbc]=_0x3587b8[_0xcc43('0xb')](',');}});}return _0xff523d;};exports[_0xcc43('0x17')]=function(_0x2418d3){_0x2418d3=parseInt(_0x2418d3,0xa);if(!_0x2418d3||_0x2418d3<0x0){_0x2418d3=LIMIT_VALUE;}return _0x2418d3;};exports[_0xcc43('0x18')]=function(_0xf0490a){_0xf0490a=parseInt(_0xf0490a,0xa);if(!_0xf0490a||_0xf0490a<0x0){_0xf0490a=0x0;}return _0xf0490a;};exports[_0xcc43('0x19')]=function(_0x3e1b5e){var _0x19c815,_0x216bdb=null;if(_0x3e1b5e){_0x19c815=_0x3e1b5e[_0xcc43('0xb')](',');_0x216bdb=_['map'](_0x19c815,function(_0x3507af){if(_0x3507af[_0xcc43('0x1a')]('-')===0x0){return[_0x3507af===_0xcc43('0x1b')?sequelize[_0xcc43('0x1c')](sequelize[_0xcc43('0x1d')]('priority'),_0xcc43('0x1e')):_0x3507af[_0xcc43('0x1f')](0x1),_0xcc43('0x20')];}else{return[_0x3507af===_0xcc43('0x1b')?sequelize[_0xcc43('0x1c')](sequelize['col'](_0xcc43('0x1b')),_0xcc43('0x1e')):_0x3507af,_0xcc43('0x21')];}});}return _0x216bdb;};exports[_0xcc43('0x22')]=function(_0x38b860,_0xbfd4d1){if(_[_0xcc43('0xd')](_0x38b860)){return _0x38b860;}if(_[_0xcc43('0x16')](_0x38b860)){for(var _0x20ee5b=0x0;_0x20ee5b<_0x38b860[_0xcc43('0x23')];_0x20ee5b+=0x1){_0x38b860[_0x20ee5b]=this['omit'](_0x38b860[_0x20ee5b],_0xbfd4d1);}return _0x38b860;}if(!_['isObject'](_0x38b860)){return _0x38b860;}if(_[_0xcc43('0x24')](_0xbfd4d1)){_0xbfd4d1=[_0xbfd4d1];}if(!_[_0xcc43('0x16')](_0xbfd4d1)){return _0x38b860;}for(var _0x1727e4=0x0;_0x1727e4<_0xbfd4d1[_0xcc43('0x23')];_0x1727e4+=0x1){_[_0xcc43('0x25')](_0x38b860,_0xbfd4d1[_0x1727e4]);}for(var _0x38c47e in _0x38b860){if(_0x38b860[_0xcc43('0x26')](_0x38c47e)){_0x38b860[_0x38c47e]=this[_0xcc43('0x22')](_0x38b860[_0x38c47e],_0xbfd4d1);}}return _0x38b860;};exports['isNumeric']=function(_0x409c86){return _0x409c86[_0xcc43('0x27')](RegExp(_0xcc43('0x28')))?!![]:![];};exports[_0xcc43('0x29')]=function(_0x26daf4){return _0x26daf4[_0xcc43('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xcc43('0x2a')]=function(_0x22c76f,_0x8b69d7){var _0x541596=[];var _0x9b885b=/[ `!@#$%^&*()_\-?~]/;var _0x226825=_0x8b69d7?'\x22{EXPR}\x22':_0xcc43('0x2b');_0x22c76f[_0xcc43('0xb')](/[ ,]+/)[_0xcc43('0x2c')](function(_0x3136f1){_0x3136f1=_0x3136f1[_0xcc43('0x2d')](/([^:]")"+/g,'$1');_0x3136f1='+'+_0x3136f1+'*';var _0x2fc85b=_0x3136f1['match'](_0x9b885b);if(_0x2fc85b){_0x3136f1='\x22'+_0x3136f1+'\x22';}_0x541596[_0xcc43('0x2e')](_0x3136f1);});_0x226825=_0x226825[_0xcc43('0x2d')](_0xcc43('0x2b'),_0x541596['join']('\x20'));return _0x226825;};exports['getOptions']=function(_0x20d4c,_0x486c15,_0x333499){var _0x5bc04b={},_0x368b26={};if(_0x486c15['query'][_0xcc43('0x2f')]){_0x486c15['query']['id']=_0x486c15[_0xcc43('0x30')]['$id'];delete _0x486c15[_0xcc43('0x30')]['$id'];}_0x5bc04b[_0xcc43('0x7')]=_[_0xcc43('0x31')](_0x20d4c,_0xcc43('0x15'));_0x5bc04b[_0xcc43('0x30')]=_[_0xcc43('0x6')](_0x486c15[_0xcc43('0x30')]);_0x5bc04b['filters']=_[_0xcc43('0x32')](_0x5bc04b[_0xcc43('0x7')],_0x5bc04b['query']);_0x368b26[_0xcc43('0x33')]=_[_0xcc43('0x32')](_0x5bc04b[_0xcc43('0x7')],this['fields'](_0x486c15[_0xcc43('0x30')][_0xcc43('0x9')]));_0x368b26[_0xcc43('0x33')]=_0x368b26[_0xcc43('0x33')]['length']?_0x368b26[_0xcc43('0x33')]:_0x5bc04b[_0xcc43('0x7')];if(!_0x486c15[_0xcc43('0x30')][_0xcc43('0x26')](_0xcc43('0x34'))){_0x368b26[_0xcc43('0x17')]=this[_0xcc43('0x17')](_0x486c15[_0xcc43('0x30')][_0xcc43('0x17')]);_0x368b26['offset']=this[_0xcc43('0x18')](_0x486c15[_0xcc43('0x30')][_0xcc43('0x18')]);}_0x368b26['order']=this[_0xcc43('0x19')](_0x486c15[_0xcc43('0x30')]['sort']);_0x368b26[_0xcc43('0x35')]=this[_0xcc43('0xc')](_['pick'](_0x486c15[_0xcc43('0x30')],_0x5bc04b[_0xcc43('0xc')]),_0x20d4c);if(_0x486c15['query'][_0xcc43('0x36')]){var _0x5b5ff4=_0x20d4c;var _0x5b4214=_0x486c15[_0xcc43('0x30')]['filter'];if(typeof _0x5b4214===_0xcc43('0x37')){_0x5b5ff4=_[_0xcc43('0x36')](_0x20d4c,function(_0x20b19e){return _[_0xcc43('0x5')](_0x5b4214[_0xcc43('0x38')],_0x20b19e[_0xcc43('0x15')]);});_0x5b4214=_0x5b4214[_0xcc43('0x39')];}_0x368b26[_0xcc43('0x35')]=_[_0xcc43('0x3a')](_0x368b26['where'],{'$or':_[_0xcc43('0x31')](_0x5b5ff4,function(_0x385457){if(_0x385457[_0xcc43('0x3b')]!==_0xcc43('0x3c')){if(_0x333499){return sequelize[_0xcc43('0x35')](sequelize['fn'](_0xcc43('0x3d'),sequelize['col'](_0x385457[_0xcc43('0x15')])),{'$like':sequelize['fn'](_0xcc43('0x3d'),'%'+_0x486c15[_0xcc43('0x30')][_0xcc43('0x36')]+'%')});}else{var _0x598207={};_0x598207[_0x385457[_0xcc43('0x15')]]={'$like':'%'+_0x486c15[_0xcc43('0x30')][_0xcc43('0x36')]+'%'};return _0x598207;}}})});}_0x368b26=_['merge']({},_0x368b26,_0x486c15[_0xcc43('0x3e')]);return _0x368b26;};exports[_0xcc43('0x3f')]=function(_0x54494b){var _0x322b41=[];if(_0x54494b[_0xcc43('0x40')]){_0x322b41['push']({'all':!![]});}else if(_0x54494b[_0xcc43('0x3f')]){if(Array[_0xcc43('0x16')](_0x54494b[_0xcc43('0x3f')])){_0x322b41=Object['keys'](_0x54494b[_0xcc43('0x3f')])[_0xcc43('0x31')](function(_0x53c71a){return parseIncludeModel(_0x54494b[_0xcc43('0x3f')][_0x53c71a]);});}else{var _0x3472b9=parseIncludeModel(_0x54494b[_0xcc43('0x3f')]);_0x322b41[_0xcc43('0x2e')](_0x3472b9);}}return _0x322b41;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 06e097d..e0aa4ec 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 _0x326f=['faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','filterAgentAttributes','role','chatStatusTime','whatsappStatusTime','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','filter','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0x3f8857,_0x26a8bb){var _0x37fcf2=function(_0xf8607a){while(--_0xf8607a){_0x3f8857['push'](_0x3f8857['shift']());}};_0x37fcf2(++_0x26a8bb);}(_0x326f,0xd1));var _0xf326=function(_0x2d6540,_0x4cafa2){_0x2d6540=_0x2d6540-0x0;var _0x2eee97=_0x326f[_0x2d6540];return _0x2eee97;};'use strict';var _=require(_0xf326('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232a});var routingClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232c});function isAgentPaused(_0x27e8d7,_0x120a26){var _0x9445c6=[_0x27e8d7[_0xf326('0x3')],_0x27e8d7[_0xf326('0x4')],_0x27e8d7[_0xf326('0x5')],_0x27e8d7['openchannelPause'],_0x27e8d7[_0xf326('0x6')],_0x27e8d7[_0xf326('0x7')],_0x27e8d7[_0xf326('0x8')]];if(!_0x120a26)return _[_0xf326('0x9')](_0x9445c6);var _0x515bfa=_['filter'](_0x9445c6);return _0x515bfa['length']>0x0&&_0x515bfa[_0xf326('0xa')]<_0x9445c6[_0xf326('0xa')]?!![]:![];}function isIdle(_0x163416){return _0x163416===_0xf326('0xb')||_0x163416===_0xf326('0xc')||_0x163416==='unavailable'||_0x163416===_0xf326('0xd')||_['isNil'](_0x163416);}function isAgentIdle(_0x1cf441){if(_0x1cf441['voiceStatus']!==_0xf326('0xb')&&_0x1cf441['voicePause']){_0x1cf441[_0xf326('0xe')]=_0xf326('0xf');return![];}return _['every']([_0x1cf441[_0xf326('0x10')],_0x1cf441[_0xf326('0x11')],_0x1cf441[_0xf326('0x12')],_0x1cf441[_0xf326('0x13')],_0x1cf441['smsStatus'],_0x1cf441[_0xf326('0xe')],_0x1cf441['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf326('0x14'),{})[_0xf326('0x15')](function(_0x1f2e5a){if(_0x1f2e5a[_0xf326('0x16')]){throw new Error(_0xf326('0x17'));}var _0x287a2a=_0x1f2e5a[_0xf326('0x18')];return routingClient[_0xf326('0x19')]('Agents',{})[_0xf326('0x15')](function(_0x453100){if(_0x453100[_0xf326('0x16')]){throw new Error(_0xf326('0x1a'));}var _0xcef2b5=_0x453100[_0xf326('0x18')];return _['merge']({},_0x287a2a,_0xcef2b5);});})['catch'](function(_0x56ad41){throw _0x56ad41;});}exports[_0xf326('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x289f4b){var _0x484cbe='unknown';if(isAgentPaused(_0x289f4b))_0x484cbe=_0xf326('0xf');else if(isAgentPaused(_0x289f4b,!![]))_0x484cbe='*pause';else if(isAgentIdle(_0x289f4b))_0x484cbe='idle';else _0x484cbe=_0xf326('0x1c');return _0x484cbe;}exports[_0xf326('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x549b46,_0x5aa184){var _0x19b8ba=_[_0xf326('0x1e')](_0x549b46)?_0x549b46:[_0x549b46];var _0x5f21a2=_[_0xf326('0x1f')](_0x5aa184)+_0xf326('0x20');var _0x43c53e=_[_0xf326('0x21')](_0x19b8ba,function(_0x17c157){return db[_0x5f21a2][_0xf326('0x22')]({'where':{'id':_0x17c157}})['then'](function(_0x55b9f4){if(!_0x55b9f4)return[];return _0x55b9f4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xf326('0x23')](_0x43c53e)[_0xf326('0x15')](function(_0x2cd45a){var _0x1ff2b5=_(_0x2cd45a)[_0xf326('0x24')]()[_0xf326('0x21')]('id')['uniq']()[_0xf326('0x25')]();return _0x1ff2b5;});}exports[_0xf326('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x212d5d,_0x581531,_0x1617d2){try{if(_0x581531['length']>0x0){_0x212d5d=_0x212d5d['filter'](function(_0x6a8e89){return _0x581531[_0xf326('0x27')](_0x6a8e89['id']);});}var _0x2fa28e=_0x212d5d['filter'](function(_0xc115d9){var _0x292500='busy';if(isAgentIdle(_0xc115d9)){_0x292500=_0xf326('0xb');}return _0x292500===_0x1617d2;});return _[_0xf326('0x21')](_0x2fa28e,'id');}catch(_0xd77aba){throw _0xd77aba;}}exports[_0xf326('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xa80156,_0x269be9,_0x161143){return Promise[_0xf326('0x29')]()[_0xf326('0x15')](function(){if(_0x269be9[_0xf326('0xa')]>0x0){_0xa80156=_0xa80156['filter'](function(_0x1035ed){return _0x269be9[_0xf326('0x27')](_0x1035ed['id']);});}return _0xa80156;})[_0xf326('0x15')](function(){return db['User'][_0xf326('0x2a')]({'attributes':['id',_0xf326('0x2b'),_0xf326('0x2c'),'chatPause','faxPause',_0xf326('0x5'),_0xf326('0x2d'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x2e')],'where':{'id':{'$in':_[_0xf326('0x21')](_0xa80156,'id')}},'raw':!![]});})[_0xf326('0x15')](function(_0x580374){return _0x580374[_0xf326('0x21')](function(_0x1981bc){var _0x51207a=_[_0xf326('0x2f')](_0xa80156,['id',_0x1981bc['id']]);var _0x4e5d7c=filterAgentAttributes(_0x51207a);_[_0xf326('0x30')](_0x1981bc,_0x4e5d7c);_0x1981bc['globalStatus']=getAgentStatus(_0x1981bc);return _0x1981bc;});})['then'](function(_0xadb020){var _0x4d8eac=sortAgentsByStatus(_0xadb020,_0x161143);return _[_0xf326('0x21')](_0x4d8eac,'id');})['catch'](function(_0x310dbb){throw _0x310dbb;});}exports[_0xf326('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2750ae){var _0x529cbb={'fields':[],'order':null};var _0x3dcc7e=_0x2750ae[_0xf326('0x32')](',');_0x529cbb['fields']=_[_0xf326('0x33')](_0x3dcc7e,function(_0xf64dd0){if(!_0xf64dd0[_0xf326('0x27')](_0xf326('0x34'))){return!![];}_0x529cbb['order']=_[_0xf326('0x35')](_0xf64dd0,'-')?_0xf326('0x36'):_0xf326('0x37');return![];});return _0x529cbb;}exports[_0xf326('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x1d88ed){if(!_0x1d88ed){_0x1d88ed='fullname,internal';}if(_0x1d88ed[_0xf326('0x27')](_0xf326('0x2c'))&&!_0x1d88ed['includes']('internal')){var _0x40564e=_0x1d88ed['substring'](0x0,_0x1d88ed['indexOf'](_0xf326('0x2c')));_0x1d88ed+=','+_0x40564e+'internal';}return _0x1d88ed;}exports[_0xf326('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x37a95b,_0x2c1e7f){var _0x39611e=_0x37a95b['sort'](function(_0x9dda89,_0x45d344){if(_0x9dda89[_0xf326('0x34')]===_0x45d344[_0xf326('0x34')]){if(_0x9dda89[_0xf326('0x34')]===_0xf326('0xf')){if(_0x2c1e7f===_0xf326('0x36')){return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344['fullname'][_0xf326('0x3a')]()?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89['globalStatus']<_0x45d344[_0xf326('0x34')]?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x34')]<_0x45d344['globalStatus']?-0x1:0x1;}}});return _0x39611e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x8e318d){var _0x269e89=[_0xf326('0x3b'),'online',_0xf326('0x3c'),_0xf326('0x3d'),_0xf326('0x2e'),_0xf326('0x3d'),_0xf326('0x3e'),_0xf326('0x3f'),_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),_0xf326('0x40'),_0xf326('0x41'),'mailCapacity',_0xf326('0x42'),_0xf326('0x43'),_0xf326('0x44'),_0xf326('0x45'),'openchannelCurrentCapacity',_0xf326('0x46'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x49'),'chatStatus',_0xf326('0x13'),_0xf326('0x12'),_0xf326('0x4a'),_0xf326('0x4b'),_0xf326('0x11'),'voiceStatus','chatStatusTime',_0xf326('0x4c'),_0xf326('0x4d'),_0xf326('0x4e'),'whatsappStatusTime',_0xf326('0x4f'),_0xf326('0x50'),_0xf326('0x51'),'destconnectedlinenum','screenrecording',_0xf326('0x52'),'phoneBarEnableAutomaticScreenRecording',_0xf326('0x53')];var _0x554277=[_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),'online'];var _0xcdaf3f=_(_0x8e318d)[_0xf326('0x54')](_0x554277)[_0xf326('0x55')](_0x269e89)['value']();return _0xcdaf3f;}exports[_0xf326('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf326('0x2b'),_0xf326('0x2c'),_0xf326('0x57'),_0xf326('0x3e'),'online',_0xf326('0x34'),_0xf326('0x3b'),_0xf326('0x3c'),_0xf326('0x2e'),'lastPauseAt',_0xf326('0x4'),_0xf326('0x3'),_0xf326('0x5'),_0xf326('0x2d'),'smsPause','voicePause',_0xf326('0x8'),_0xf326('0x10'),'faxStatus',_0xf326('0x12'),_0xf326('0x13'),_0xf326('0x4a'),_0xf326('0xe'),'whatsappStatus',_0xf326('0x58'),'faxStatusTime','mailStatusTime',_0xf326('0x4c'),'smsStatusTime',_0xf326('0x50'),_0xf326('0x59'),_0xf326('0x40'),'faxCapacity','mailCapacity',_0xf326('0x41'),_0xf326('0x42'),_0xf326('0x43'),'chatCurrentCapacity',_0xf326('0x49'),'mailCurrentCapacity',_0xf326('0x5a'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x52'),_0xf326('0x5b'),_0xf326('0x5c'),_0xf326('0x5d'),_0xf326('0x51'),_0xf326('0x53'),_0xf326('0x5e')];}exports[_0xf326('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x53ec=['faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','value','filterAgentAttributes','role','mailStatusTime','whatsappStatusTime','openchannelCapacity','destconnectedlinenum','onhold','routealias','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','smsPause','voicePause','every','filter','length','idle','unknown','isNil','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','map','getAgents','all','User','findAll','name','fullname','faxPause','openchannelPause','whatsappPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','includes','order','DESC','getUpdatedSortOptions','fullname,internal','internal','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','smsStatusTime'];(function(_0x4af3b7,_0x30c116){var _0x24727c=function(_0x3ae9a0){while(--_0x3ae9a0){_0x4af3b7['push'](_0x4af3b7['shift']());}};_0x24727c(++_0x30c116);}(_0x53ec,0x192));var _0xc53e=function(_0x350277,_0x25d306){_0x350277=_0x350277-0x0;var _0x5e418b=_0x53ec[_0x350277];return _0x5e418b;};'use strict';var _=require(_0xc53e('0x0'));var jayson=require(_0xc53e('0x1'));var db=require(_0xc53e('0x2'))['db'];var amiClient=jayson[_0xc53e('0x3')][_0xc53e('0x4')]({'port':0x232a});var routingClient=jayson[_0xc53e('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x266c42,_0x4e954a){var _0x2b90f6=[_0x266c42[_0xc53e('0x5')],_0x266c42['faxPause'],_0x266c42[_0xc53e('0x6')],_0x266c42['openchannelPause'],_0x266c42[_0xc53e('0x7')],_0x266c42[_0xc53e('0x8')],_0x266c42['whatsappPause']];if(!_0x4e954a)return _[_0xc53e('0x9')](_0x2b90f6);var _0x1ac6c0=_[_0xc53e('0xa')](_0x2b90f6);return _0x1ac6c0[_0xc53e('0xb')]>0x0&&_0x1ac6c0[_0xc53e('0xb')]<_0x2b90f6[_0xc53e('0xb')]?!![]:![];}function isIdle(_0xd82002){return _0xd82002===_0xc53e('0xc')||_0xd82002===_0xc53e('0xd')||_0xd82002==='unavailable'||_0xd82002==='ringing'||_[_0xc53e('0xe')](_0xd82002);}function isAgentIdle(_0x5a2da7){if(_0x5a2da7['voiceStatus']!==_0xc53e('0xc')&&_0x5a2da7[_0xc53e('0x8')]){_0x5a2da7[_0xc53e('0xf')]=_0xc53e('0x10');return![];}return _['every']([_0x5a2da7['chatStatus'],_0x5a2da7[_0xc53e('0x11')],_0x5a2da7[_0xc53e('0x12')],_0x5a2da7[_0xc53e('0x13')],_0x5a2da7[_0xc53e('0x14')],_0x5a2da7[_0xc53e('0xf')],_0x5a2da7[_0xc53e('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xc53e('0x16')](_0xc53e('0x17'),{})[_0xc53e('0x18')](function(_0x2ad6eb){if(_0x2ad6eb['error']){throw new Error(_0xc53e('0x19'));}var _0x191567=_0x2ad6eb[_0xc53e('0x1a')];return routingClient[_0xc53e('0x16')](_0xc53e('0x17'),{})[_0xc53e('0x18')](function(_0x164016){if(_0x164016[_0xc53e('0x1b')]){throw new Error(_0xc53e('0x1c'));}var _0x5d1098=_0x164016['result'];return _[_0xc53e('0x1d')]({},_0x191567,_0x5d1098);});})[_0xc53e('0x1e')](function(_0x421641){throw _0x421641;});}exports[_0xc53e('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x20066e){var _0x2cfe2b=_0xc53e('0xd');if(isAgentPaused(_0x20066e))_0x2cfe2b=_0xc53e('0x10');else if(isAgentPaused(_0x20066e,!![]))_0x2cfe2b=_0xc53e('0x20');else if(isAgentIdle(_0x20066e))_0x2cfe2b=_0xc53e('0xc');else _0x2cfe2b=_0xc53e('0x21');return _0x2cfe2b;}exports[_0xc53e('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x426467,_0x4fb695){var _0x47cfdd=_['isArray'](_0x426467)?_0x426467:[_0x426467];var _0x4f4304=_[_0xc53e('0x23')](_0x4fb695)+_0xc53e('0x24');var _0x4015c8=_[_0xc53e('0x25')](_0x47cfdd,function(_0x5009e1){return db[_0x4f4304]['findOne']({'where':{'id':_0x5009e1}})[_0xc53e('0x18')](function(_0x496167){if(!_0x496167)return[];return _0x496167[_0xc53e('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc53e('0x27')](_0x4015c8)[_0xc53e('0x18')](function(_0x1166e6){var _0x63c5dc=_(_0x1166e6)['flatten']()[_0xc53e('0x25')]('id')['uniq']()['value']();return _0x63c5dc;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3c5056,_0x57a1f5,_0x28240a){try{if(_0x57a1f5['length']>0x0){_0x3c5056=_0x3c5056[_0xc53e('0xa')](function(_0x5112d2){return _0x57a1f5['includes'](_0x5112d2['id']);});}var _0x8f0ee6=_0x3c5056[_0xc53e('0xa')](function(_0x42dec1){var _0x2fa20b=_0xc53e('0x21');if(isAgentIdle(_0x42dec1)){_0x2fa20b=_0xc53e('0xc');}return _0x2fa20b===_0x28240a;});return _[_0xc53e('0x25')](_0x8f0ee6,'id');}catch(_0x2a2ca9){throw _0x2a2ca9;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x437893,_0x311835,_0x2d36c0){return Promise['resolve']()[_0xc53e('0x18')](function(){if(_0x311835['length']>0x0){_0x437893=_0x437893[_0xc53e('0xa')](function(_0x2467f4){return _0x311835['includes'](_0x2467f4['id']);});}return _0x437893;})['then'](function(){return db[_0xc53e('0x28')][_0xc53e('0x29')]({'attributes':['id',_0xc53e('0x2a'),_0xc53e('0x2b'),_0xc53e('0x5'),_0xc53e('0x2c'),_0xc53e('0x6'),_0xc53e('0x2d'),'smsPause',_0xc53e('0x8'),_0xc53e('0x2e'),_0xc53e('0x2f')],'where':{'id':{'$in':_[_0xc53e('0x25')](_0x437893,'id')}},'raw':!![]});})[_0xc53e('0x18')](function(_0x12b32c){return _0x12b32c[_0xc53e('0x25')](function(_0x16942c){var _0x215abe=_['find'](_0x437893,['id',_0x16942c['id']]);var _0x3e395c=filterAgentAttributes(_0x215abe);_['merge'](_0x16942c,_0x3e395c);_0x16942c[_0xc53e('0x30')]=getAgentStatus(_0x16942c);return _0x16942c;});})[_0xc53e('0x18')](function(_0x5e9377){var _0x37452a=sortAgentsByStatus(_0x5e9377,_0x2d36c0);return _[_0xc53e('0x25')](_0x37452a,'id');})[_0xc53e('0x1e')](function(_0x5ed90b){throw _0x5ed90b;});}exports[_0xc53e('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x17ec92){var _0x10a90d={'fields':[],'order':null};var _0x78eb5e=_0x17ec92[_0xc53e('0x32')](',');_0x10a90d[_0xc53e('0x33')]=_[_0xc53e('0xa')](_0x78eb5e,function(_0x482085){if(!_0x482085[_0xc53e('0x34')](_0xc53e('0x30'))){return!![];}_0x10a90d[_0xc53e('0x35')]=_['startsWith'](_0x482085,'-')?_0xc53e('0x36'):'ASC';return![];});return _0x10a90d;}exports[_0xc53e('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0x15052d){if(!_0x15052d){_0x15052d=_0xc53e('0x38');}if(_0x15052d[_0xc53e('0x34')](_0xc53e('0x2b'))&&!_0x15052d['includes'](_0xc53e('0x39'))){var _0x3c72b1=_0x15052d['substring'](0x0,_0x15052d['indexOf']('fullname'));_0x15052d+=','+_0x3c72b1+'internal';}return _0x15052d;}exports[_0xc53e('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x9c3816,_0x49bd2c){var _0x460ee6=_0x9c3816['sort'](function(_0x55d07d,_0x53447e){if(_0x55d07d[_0xc53e('0x30')]===_0x53447e['globalStatus']){if(_0x55d07d['globalStatus']===_0xc53e('0x10')){if(_0x49bd2c==='DESC'){return(_0x55d07d[_0xc53e('0x2f')]||'')<(_0x53447e[_0xc53e('0x2f')]||'')||_0x55d07d['fullname'][_0xc53e('0x3b')]()>_0x53447e[_0xc53e('0x2b')]['toLowerCase']()?0x1:-0x1;}else{return(_0x55d07d[_0xc53e('0x2f')]||'')<(_0x53447e['pauseType']||'')||_0x55d07d['fullname']['toLowerCase']()>_0x53447e['fullname'][_0xc53e('0x3b')]()?-0x1:0x1;}}else{if(_0x49bd2c===_0xc53e('0x36')){return _0x55d07d[_0xc53e('0x2b')]['toLowerCase']()<_0x53447e[_0xc53e('0x2b')][_0xc53e('0x3b')]()?0x1:-0x1;}else{return _0x55d07d['fullname']['toLowerCase']()<_0x53447e[_0xc53e('0x2b')][_0xc53e('0x3b')]()?-0x1:0x1;}}}else{if(_0x49bd2c===_0xc53e('0x36')){return _0x55d07d['globalStatus']<_0x53447e[_0xc53e('0x30')]?0x1:-0x1;}else{return _0x55d07d[_0xc53e('0x30')]<_0x53447e[_0xc53e('0x30')]?-0x1:0x1;}}});return _0x460ee6;}exports[_0xc53e('0x3c')]=sortAgentsByStatus;function filterAgentAttributes(_0x1295cc){var _0x3428f4=[_0xc53e('0x3d'),'online',_0xc53e('0x3e'),_0xc53e('0x3f'),_0xc53e('0x2f'),'lastPauseAt',_0xc53e('0x39'),_0xc53e('0x40'),_0xc53e('0x5'),_0xc53e('0x2d'),_0xc53e('0x6'),_0xc53e('0x7'),'whatsappPause',_0xc53e('0x2c'),_0xc53e('0x8'),_0xc53e('0x41'),'openchannelCapacity',_0xc53e('0x42'),_0xc53e('0x43'),_0xc53e('0x44'),_0xc53e('0x45'),_0xc53e('0x46'),_0xc53e('0x47'),_0xc53e('0x48'),_0xc53e('0x49'),_0xc53e('0x4a'),_0xc53e('0x4b'),'chatStatus',_0xc53e('0x13'),_0xc53e('0x12'),_0xc53e('0x14'),_0xc53e('0x15'),_0xc53e('0x11'),'voiceStatus','chatStatusTime',_0xc53e('0x4c'),'mailStatusTime',_0xc53e('0x4d'),'whatsappStatusTime',_0xc53e('0x4e'),_0xc53e('0x4f'),_0xc53e('0x50'),'destconnectedlinenum',_0xc53e('0x51'),_0xc53e('0x52'),_0xc53e('0x53'),'routealias'];var _0x2f7df2=['chatPause',_0xc53e('0x2d'),_0xc53e('0x6'),'smsPause',_0xc53e('0x2e'),_0xc53e('0x2c'),'voicePause',_0xc53e('0x54')];var _0x36d321=_(_0x1295cc)[_0xc53e('0x55')](_0x2f7df2)[_0xc53e('0x56')](_0x3428f4)[_0xc53e('0x57')]();return _0x36d321;}exports[_0xc53e('0x58')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xc53e('0x2a'),_0xc53e('0x2b'),_0xc53e('0x59'),_0xc53e('0x39'),_0xc53e('0x54'),'globalStatus',_0xc53e('0x3d'),'lastLoginAt',_0xc53e('0x2f'),'lastPauseAt',_0xc53e('0x2c'),_0xc53e('0x5'),'mailPause',_0xc53e('0x2d'),_0xc53e('0x7'),_0xc53e('0x8'),_0xc53e('0x2e'),'chatStatus',_0xc53e('0x11'),_0xc53e('0x12'),'openchannelStatus','smsStatus',_0xc53e('0xf'),'whatsappStatus','chatStatusTime','faxStatusTime',_0xc53e('0x5a'),'openchannelStatusTime',_0xc53e('0x4d'),'voiceStatusTime',_0xc53e('0x5b'),_0xc53e('0x41'),_0xc53e('0x45'),_0xc53e('0x42'),_0xc53e('0x5c'),'smsCapacity','whatsappCapacity',_0xc53e('0x46'),_0xc53e('0x4b'),_0xc53e('0x48'),_0xc53e('0x47'),_0xc53e('0x49'),_0xc53e('0x4a'),_0xc53e('0x52'),_0xc53e('0x53'),_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x50'),_0xc53e('0x5f'),_0xc53e('0x51')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index f467e1e..615fe1f 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 _0xf51d=['invalid','onHold','ringing','ringInUse','talking','unavailable','unknown','originated','message','dialActive','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','outbound','map','get','loggedInDb','pTalking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse'];(function(_0x4b62da,_0x13c2d5){var _0xfd94f6=function(_0x1558b6){while(--_0x1558b6){_0x4b62da['push'](_0x4b62da['shift']());}};_0xfd94f6(++_0x13c2d5);}(_0xf51d,0x17d));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf51('0x0'));var jayson=require(_0xdf51('0x1'));var util=require(_0xdf51('0x2'));var amiClient=jayson[_0xdf51('0x3')][_0xdf51('0x4')]({'port':0x232a});var routingClient=jayson[_0xdf51('0x3')][_0xdf51('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdf51('0x5'),_0xdf51('0x6'),_0xdf51('0x7'),_0xdf51('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xdf51('0x9'),_0xdf51('0xa'),_0xdf51('0xb'),'loggedInDb','notInUse',_0xdf51('0xc'),_0xdf51('0xd'),_0xdf51('0xe'),_0xdf51('0xf'),_0xdf51('0x10'),_0xdf51('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xdf51('0x12'),_0xdf51('0x13'),'statusMessage',_0xdf51('0x14'),'dialMethod',_0xdf51('0x15'),_0xdf51('0x16'),'startProgressive',_0xdf51('0x17'),_0xdf51('0x18'),_0xdf51('0x19'),'erlangBusyFactor',_0xdf51('0x1a'),_0xdf51('0x1b'),_0xdf51('0x1c'),_0xdf51('0x1d'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xdf51('0x1e'),_0xdf51('0x1f'),_0xdf51('0x20')];function getRealtimeQueues(_0x2e5282,_0x57751d){var _0x3ae751=_0x57751d===_0xdf51('0x21')?amiClient:routingClient;return _0x3ae751[_0xdf51('0x22')](_[_0xdf51('0x23')](_0x57751d)+_0xdf51('0x24'),_0x2e5282)[_0xdf51('0x25')](function(_0x42ab4c){if(_0x42ab4c['error'])throw new Error(util['format'](_0xdf51('0x26'),_0x57751d));return _0x42ab4c['result'];})['catch'](function(_0x48c848){throw _0x48c848;});}exports[_0xdf51('0x27')]=getRealtimeQueues;function initializeQueues(_0xcb61f2,_0x4a2e96,_0x5b17ce,_0x267b9a){var _0x3e8ef0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5b17ce===_0xdf51('0x21')){if(_0x267b9a==='inbound'){_0x3e8ef0=_0x3e8ef0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x267b9a===_0xdf51('0x28')){_0x3e8ef0=_0x3e8ef0['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xcb61f2[_0xdf51('0x29')](function(_0x1f9b93){var _0x49a407=_0x1f9b93[_0xdf51('0x2a')]({'plain':!![]});_0x49a407[_0xdf51('0x7')]=0x0;_0x49a407[_0xdf51('0x2b')]=0x0;_0x49a407[_0xdf51('0x6')]=0x0;_0x49a407[_0xdf51('0x5')]=0x0;_0x49a407['waiting']=0x0;if(_0x5b17ce===_0xdf51('0x21')){_0x49a407[_0xdf51('0xf')]=0x0;_0x49a407[_0xdf51('0x9')]=0x0;if(_0x267b9a==='outbound'){_0x49a407[_0xdf51('0x2c')]=0x0;_0x49a407[_0xdf51('0x12')]=0x0;}}var _0x559281=_[_0xdf51('0x2d')](_0x4a2e96,['id',_0x49a407['id']]);if(_0x559281){_[_0xdf51('0x2e')](_0x49a407,_[_0xdf51('0x2f')](_0x559281,_0x3e8ef0));}return _0x49a407;});}exports[_0xdf51('0x30')]=initializeQueues; \ No newline at end of file +var _0xa467=['predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','concat','outbound','map','get','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','ringInUse','unavailable','unknown','pTalking','originated','dialActive','dialMethod','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x5ec688,_0x115f65){var _0x557ef0=function(_0x329696){while(--_0x329696){_0x5ec688['push'](_0x5ec688['shift']());}};_0x557ef0(++_0x115f65);}(_0xa467,0x163));var _0x7a46=function(_0x57ef65,_0x49c220){_0x57ef65=_0x57ef65-0x0;var _0x115b19=_0xa467[_0x57ef65];return _0x115b19;};'use strict';var _=require(_0x7a46('0x0'));var jayson=require(_0x7a46('0x1'));var util=require(_0x7a46('0x2'));var amiClient=jayson[_0x7a46('0x3')][_0x7a46('0x4')]({'port':0x232a});var routingClient=jayson[_0x7a46('0x3')][_0x7a46('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7a46('0x5'),_0x7a46('0x6'),_0x7a46('0x7'),_0x7a46('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x7a46('0x9'),_0x7a46('0xa'),_0x7a46('0xb'),_0x7a46('0xc'),'notInUse','onHold','ringing',_0x7a46('0xd'),'talking',_0x7a46('0xe'),_0x7a46('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7a46('0x10'),_0x7a46('0x11'),'message','statusMessage',_0x7a46('0x12'),_0x7a46('0x13'),'Trunk',_0x7a46('0x14'),_0x7a46('0x15'),'erlangCalls',_0x7a46('0x16'),_0x7a46('0x17'),_0x7a46('0x18'),_0x7a46('0x19'),'dialPredictiveIntervalMaxThreshold',_0x7a46('0x1a'),_0x7a46('0x1b'),_0x7a46('0x1c'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x7a46('0x1d'),_0x7a46('0x1e')];function getRealtimeQueues(_0x86f5eb,_0x5b1f41){var _0x36c05f=_0x5b1f41===_0x7a46('0x1f')?amiClient:routingClient;return _0x36c05f[_0x7a46('0x20')](_['startCase'](_0x5b1f41)+_0x7a46('0x21'),_0x86f5eb)['then'](function(_0x4b6213){if(_0x4b6213[_0x7a46('0x22')])throw new Error(util[_0x7a46('0x23')](_0x7a46('0x24'),_0x5b1f41));return _0x4b6213['result'];})[_0x7a46('0x25')](function(_0x175a25){throw _0x175a25;});}exports[_0x7a46('0x26')]=getRealtimeQueues;function initializeQueues(_0x2cb14b,_0x5f4813,_0x2a75bd,_0x26fa82){var _0x4d822d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2a75bd===_0x7a46('0x1f')){if(_0x26fa82==='inbound'){_0x4d822d=_0x4d822d[_0x7a46('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x26fa82===_0x7a46('0x28')){_0x4d822d=_0x4d822d[_0x7a46('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2cb14b[_0x7a46('0x29')](function(_0x3cb87c){var _0x562ce7=_0x3cb87c[_0x7a46('0x2a')]({'plain':!![]});_0x562ce7[_0x7a46('0x7')]=0x0;_0x562ce7[_0x7a46('0xc')]=0x0;_0x562ce7['loggedIn']=0x0;_0x562ce7[_0x7a46('0x5')]=0x0;_0x562ce7[_0x7a46('0x8')]=0x0;if(_0x2a75bd===_0x7a46('0x1f')){_0x562ce7[_0x7a46('0x2b')]=0x0;_0x562ce7[_0x7a46('0x9')]=0x0;if(_0x26fa82==='outbound'){_0x562ce7['pTalking']=0x0;_0x562ce7[_0x7a46('0x11')]=0x0;}}var _0x43e73c=_[_0x7a46('0x2c')](_0x5f4813,['id',_0x562ce7['id']]);if(_0x43e73c){_[_0x7a46('0x2d')](_0x562ce7,_[_0x7a46('0x2e')](_0x43e73c,_0x4d822d));}return _0x562ce7;});}exports[_0x7a46('0x2f')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 83456c3..b14de5a 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x43fdf8,_0x8426b3){var _0x1160c6=function(_0x281fb6){while(--_0x281fb6){_0x43fdf8['push'](_0x43fdf8['shift']());}};_0x1160c6(++_0x8426b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 16cc903..b27ace2 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 _0x8cb8=['getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','digest','substring','crypto','execSync','networkInterfaces','orderBy','keys','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','map','model','createHash','md5','hex'];(function(_0x2751dd,_0x2950b1){var _0x2b4058=function(_0x3290bd){while(--_0x3290bd){_0x2751dd['push'](_0x2751dd['shift']());}};_0x2b4058(++_0x2950b1);}(_0x8cb8,0xc0));var _0x88cb=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x8cb8[_0x45d1fd];return _0xd0e542;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x88cb('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x88cb('0x1')];var config=require('../environment');function getInterfaces(){var _0x2f5b77=[];var _0x48f61c=os[_0x88cb('0x2')]();var _0x1a98cc=_[_0x88cb('0x3')](_[_0x88cb('0x4')](_0x48f61c));for(var _0x2c85fd=0x0;_0x2c85fd<_0x1a98cc['length'];_0x2c85fd++){var _0x18a95b=_0x48f61c[_0x1a98cc[_0x2c85fd]]['filter'](function(_0x270613){return _0x270613[_0x88cb('0x5')]===_0x88cb('0x6')&&_0x270613[_0x88cb('0x7')]===![];});_0x2f5b77=_0x2f5b77[_0x88cb('0x8')](_0x18a95b);}return _0x2f5b77;}function getFirstInterface(){var _0x4ffae0=_['head'](getInterfaces());return{'macAddress':_0x4ffae0&&_0x4ffae0[_0x88cb('0x9')]?_0x4ffae0[_0x88cb('0x9')]:_0x88cb('0xa'),'ipAddress':_0x4ffae0&&_0x4ffae0[_0x88cb('0xb')]?_0x4ffae0['address']:_0x88cb('0xc')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x47b3fd=_[_0x88cb('0x3')](os['cpus']()[_0x88cb('0xd')](function(_0xe7e8a7){return _0xe7e8a7[_0x88cb('0xe')];}))['join'](':');return crypto[_0x88cb('0xf')](_0x88cb('0x10'))['update'](_0x47b3fd)['digest'](_0x88cb('0x11'));}exports[_0x88cb('0x12')]=function(){var _0x4720f0=os[_0x88cb('0x13')]();var _0x56bb7d=/[0-9a-f-]{36}/;if(config[_0x88cb('0x14')]&&_0x56bb7d[_0x88cb('0x15')](config[_0x88cb('0x14')])){return config[_0x88cb('0x14')];}else if(_0x4720f0===_0x88cb('0x16')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x88cb('0x17')})[_0x88cb('0x18')]('\x0d\x0a','');}else{var _0x206a14=getFirstInterface();var _0x315d4e=getCPUhash();var _0x688d0d=_0x315d4e+'|'+os[_0x88cb('0x19')]()+'|'+_0x206a14[_0x88cb('0x1a')]+'|'+_0x206a14[_0x88cb('0x1b')];var _0x1751c5=crypto[_0x88cb('0xf')]('md5')['update'](_0x688d0d)[_0x88cb('0x1c')](_0x88cb('0x11'));return _0x1751c5[_0x88cb('0x1d')](0x0,0x8)+'-'+_0x1751c5[_0x88cb('0x1d')](0x8,0xc)+'-'+_0x1751c5[_0x88cb('0x1d')](0xc,0x10)+'-'+_0x1751c5[_0x88cb('0x1d')](0x10,0x14)+'-'+_0x1751c5[_0x88cb('0x1d')](0x14);}}; \ No newline at end of file +var _0x10ca=['crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','keys','length','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','getFirstInterface','model','join','md5','update','digest','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','createHash','substring','lodash'];(function(_0xf4a659,_0x2f1a2b){var _0x20de78=function(_0xda906f){while(--_0xda906f){_0xf4a659['push'](_0xf4a659['shift']());}};_0x20de78(++_0x2f1a2b);}(_0x10ca,0xbf));var _0xa10c=function(_0x8625f7,_0x3e7e6a){_0x8625f7=_0x8625f7-0x0;var _0xdde818=_0x10ca[_0x8625f7];return _0xdde818;};'use strict';var _=require(_0xa10c('0x0'));var os=require('os');var crypto=require(_0xa10c('0x1'));var machine=require(_0xa10c('0x2'));var exec=require(_0xa10c('0x3'))[_0xa10c('0x4')];var config=require(_0xa10c('0x5'));function getInterfaces(){var _0xd5a4c1=[];var _0x312bdb=os['networkInterfaces']();var _0x15392a=_[_0xa10c('0x6')](_[_0xa10c('0x7')](_0x312bdb));for(var _0x476171=0x0;_0x476171<_0x15392a[_0xa10c('0x8')];_0x476171++){var _0x27077b=_0x312bdb[_0x15392a[_0x476171]]['filter'](function(_0x5c6ce5){return _0x5c6ce5[_0xa10c('0x9')]===_0xa10c('0xa')&&_0x5c6ce5[_0xa10c('0xb')]===![];});_0xd5a4c1=_0xd5a4c1[_0xa10c('0xc')](_0x27077b);}return _0xd5a4c1;}function getFirstInterface(){var _0x41010a=_['head'](getInterfaces());return{'macAddress':_0x41010a&&_0x41010a[_0xa10c('0xd')]?_0x41010a[_0xa10c('0xd')]:_0xa10c('0xe'),'ipAddress':_0x41010a&&_0x41010a['address']?_0x41010a[_0xa10c('0xf')]:'127.0.0.1'};}exports[_0xa10c('0x10')]=getFirstInterface;function getCPUhash(){var _0x24e665=_[_0xa10c('0x6')](os['cpus']()['map'](function(_0xdacfaa){return _0xdacfaa[_0xa10c('0x11')];}))[_0xa10c('0x12')](':');return crypto['createHash'](_0xa10c('0x13'))[_0xa10c('0x14')](_0x24e665)[_0xa10c('0x15')]('hex');}exports[_0xa10c('0x16')]=function(){var _0x16e21e=os['platform']();var _0xc0cb06=/[0-9a-f-]{36}/;if(config[_0xa10c('0x17')]&&_0xc0cb06['test'](config[_0xa10c('0x17')])){return config[_0xa10c('0x17')];}else if(_0x16e21e===_0xa10c('0x18')){return exec(_0xa10c('0x19'),{'encoding':_0xa10c('0x1a')})[_0xa10c('0x1b')]('\x0d\x0a','');}else{var _0x10ca90=getFirstInterface();var _0x51db80=getCPUhash();var _0x3ed242=_0x51db80+'|'+os[_0xa10c('0x1c')]()+'|'+_0x10ca90['macAddress']+'|'+_0x10ca90[_0xa10c('0x1d')];var _0x54c394=crypto[_0xa10c('0x1e')](_0xa10c('0x13'))[_0xa10c('0x14')](_0x3ed242)[_0xa10c('0x15')]('hex');return _0x54c394[_0xa10c('0x1f')](0x0,0x8)+'-'+_0x54c394['substring'](0x8,0xc)+'-'+_0x54c394[_0xa10c('0x1f')](0xc,0x10)+'-'+_0x54c394[_0xa10c('0x1f')](0x10,0x14)+'-'+_0x54c394['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index cff893b..91dcf49 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 _0xf15a=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','active','license','data2','info'];(function(_0x7a1e9e,_0x5b22f4){var _0xd6bdf3=function(_0x53c21a){while(--_0x53c21a){_0x7a1e9e['push'](_0x7a1e9e['shift']());}};_0xd6bdf3(++_0x5b22f4);}(_0xf15a,0x90));var _0xaf15=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf15a[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xaf15('0x0'));var moment=require(_0xaf15('0x1'));var rp=require(_0xaf15('0x2'));var BPromise=require(_0xaf15('0x3'));var pkginfo=require(_0xaf15('0x4'))(module,_0xaf15('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xaf15('0x6'));var hardware=require(_0xaf15('0x7'));var logger=require('../logger')('license');var HOST=_0xaf15('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x13b8fb){return new BPromise(function(_0x3a2afb,_0x5f0453){var _0x2d14f2=util[_0xaf15('0x9')](_0xaf15('0xa'),HOST,_0x13b8fb,module[_0xaf15('0xb')][_0xaf15('0x5')]);if(oldToken){_0x2d14f2=util[_0xaf15('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x13b8fb,module['exports'][_0xaf15('0x5')],oldToken);}var _0x3bd254={'uri':_0x2d14f2,'method':_0xaf15('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3bd254)[_0xaf15('0xd')](function(_0xa1a057){_0x3a2afb(_0xa1a057);})[_0xaf15('0xe')](function(_0x5ebcae){_0x5f0453(_0x5ebcae);});});}function manageLicense(_0x1036a6,_0x16bc3d){var _0x1ddfe6=_0x16bc3d[_0xaf15('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x1ddfe6['data1']!==_0x1036a6&&!_0x1ddfe6['data2']){oldToken=_0x1ddfe6['data1'];}httpRequest(_0x1036a6)[_0xaf15('0xd')](function(_0x23c2e9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x23c2e9[_0xaf15('0x10')]){isOldTokenSent=![];if(!_0x1ddfe6[_0xaf15('0x11')]&&_0x1ddfe6[_0xaf15('0x11')]!=_0x23c2e9[_0xaf15('0x11')]||_0x1ddfe6[_0xaf15('0x11')]&&_0x1ddfe6[_0xaf15('0x12')]){logger[_0xaf15('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1ddfe6[_0xaf15('0x11')]&&!_0x1ddfe6[_0xaf15('0x12')]&&_0x1ddfe6[_0xaf15('0x11')]!=_0x23c2e9['license']){logger[_0xaf15('0x13')](_0xaf15('0x14'));}if(_0x1ddfe6[_0xaf15('0x11')]&&!_0x1ddfe6[_0xaf15('0x12')]&&_0x1ddfe6['license']==_0x23c2e9[_0xaf15('0x11')]){return _0x16bc3d;}return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':_0x23c2e9[_0xaf15('0x11')]});}else{if(_0x23c2e9[_0xaf15('0x11')]||_0x1ddfe6['license']){if(!_0x1ddfe6[_0xaf15('0x12')]){if(_0x1ddfe6['data1']==_0x1036a6){GRAY_PERIOD_REASON=_0xaf15('0x16');logger[_0xaf15('0x13')](_0xaf15('0x17'));}else{GRAY_PERIOD_REASON=_0xaf15('0x18');logger['info'](_0xaf15('0x19'),_0x1ddfe6[_0xaf15('0x1a')],_0x1036a6);}logger[_0xaf15('0x13')](_0xaf15('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xaf15('0x9')](_0xaf15('0x1c')));return _0x16bc3d[_0xaf15('0x15')]({'data2':encryptor[_0xaf15('0x1d')](moment()[_0xaf15('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xaf15('0x1e')](encryptor[_0xaf15('0x1f')](_0x1ddfe6['data2']),'days')>DAYS){logger[_0xaf15('0x13')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xaf15('0x1c')));isOldTokenSent=![];return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':null});}}}else{if(_0x1ddfe6[_0xaf15('0x1a')]!=_0x1036a6){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1ddfe6[_0xaf15('0x1a')],_0x1036a6);return _0x16bc3d[_0xaf15('0x15')]({'data1':_0x1036a6,'data2':null,'license':null});}}}return _0x16bc3d;})[_0xaf15('0xd')](function(_0x4a77af){_0x16bc3d=_0x4a77af;})[_0xaf15('0xe')](function(_0x1565a6){logger[_0xaf15('0x20')](_0x1565a6['message']);})[_0xaf15('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xaf15('0x22')](),_0x16bc3d);},TIME);});}function defaultLicense(){var _0xdf0351=hardware[_0xaf15('0x22')]();if(_0xdf0351){return db[_0xaf15('0x23')][_0xaf15('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xdf0351}})[_0xaf15('0x25')](function(_0x2c1f13,_0x6103f){logger[_0xaf15('0x13')](_0xaf15('0x26'),_0xdf0351);manageLicense(_0xdf0351,_0x2c1f13);})[_0xaf15('0xe')](function(_0x24bc30){logger[_0xaf15('0x20')](_0x24bc30[_0xaf15('0x27')]);});}}exports[_0xaf15('0x28')]=defaultLicense; \ No newline at end of file +var _0x2f1d=['DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days'];(function(_0x176a54,_0x1feb91){var _0x396a3f=function(_0x25ef25){while(--_0x25ef25){_0x176a54['push'](_0x176a54['shift']());}};_0x396a3f(++_0x1feb91);}(_0x2f1d,0x1e3));var _0xd2f1=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x2f1d[_0x44bcb0];return _0xfaf881;};'use strict';var util=require(_0xd2f1('0x0'));var moment=require(_0xd2f1('0x1'));var rp=require(_0xd2f1('0x2'));var BPromise=require(_0xd2f1('0x3'));var pkginfo=require('pkginfo')(module,_0xd2f1('0x4'));var db=require(_0xd2f1('0x5'))['db'];var encryptor=require(_0xd2f1('0x6'));var hardware=require(_0xd2f1('0x7'));var logger=require(_0xd2f1('0x8'))(_0xd2f1('0x9'));var HOST=_0xd2f1('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3f421b){return new BPromise(function(_0x365a72,_0x35fe3f){var _0x2fd968=util['format'](_0xd2f1('0xb'),HOST,_0x3f421b,module['exports'][_0xd2f1('0x4')]);if(oldToken){_0x2fd968=util[_0xd2f1('0xc')](_0xd2f1('0xd'),HOST,_0x3f421b,module[_0xd2f1('0xe')][_0xd2f1('0x4')],oldToken);}var _0x4f8785={'uri':_0x2fd968,'method':_0xd2f1('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x4f8785)[_0xd2f1('0x10')](function(_0x292201){_0x365a72(_0x292201);})['catch'](function(_0x38ed55){_0x35fe3f(_0x38ed55);});});}function manageLicense(_0x40be07,_0x463180){var _0x42484c=_0x463180[_0xd2f1('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x42484c[_0xd2f1('0x12')]!==_0x40be07&&!_0x42484c['data2']){oldToken=_0x42484c[_0xd2f1('0x12')];}httpRequest(_0x40be07)['then'](function(_0x364b6e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x364b6e[_0xd2f1('0x13')]){isOldTokenSent=![];if(!_0x42484c[_0xd2f1('0x9')]&&_0x42484c[_0xd2f1('0x9')]!=_0x364b6e[_0xd2f1('0x9')]||_0x42484c[_0xd2f1('0x9')]&&_0x42484c['data2']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x42484c[_0xd2f1('0x9')]&&!_0x42484c['data2']&&_0x42484c[_0xd2f1('0x9')]!=_0x364b6e[_0xd2f1('0x9')]){logger[_0xd2f1('0x14')](_0xd2f1('0x15'));}if(_0x42484c['license']&&!_0x42484c[_0xd2f1('0x16')]&&_0x42484c[_0xd2f1('0x9')]==_0x364b6e[_0xd2f1('0x9')]){return _0x463180;}return _0x463180['update']({'data1':_0x40be07,'data2':null,'license':_0x364b6e[_0xd2f1('0x9')]});}else{if(_0x364b6e[_0xd2f1('0x9')]||_0x42484c[_0xd2f1('0x9')]){if(!_0x42484c[_0xd2f1('0x16')]){if(_0x42484c['data1']==_0x40be07){GRAY_PERIOD_REASON=_0xd2f1('0x17');logger[_0xd2f1('0x14')](_0xd2f1('0x18'));}else{GRAY_PERIOD_REASON=_0xd2f1('0x19');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x42484c[_0xd2f1('0x12')],_0x40be07);}logger[_0xd2f1('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xd2f1('0x1a')](),moment()[_0xd2f1('0xc')](_0xd2f1('0x1b')));return _0x463180[_0xd2f1('0x1c')]({'data2':encryptor[_0xd2f1('0x1d')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xd2f1('0x1e')](encryptor[_0xd2f1('0x1f')](_0x42484c[_0xd2f1('0x16')]),_0xd2f1('0x20'))>DAYS){logger[_0xd2f1('0x14')](_0xd2f1('0x21'),moment()[_0xd2f1('0xc')](_0xd2f1('0x1b')));isOldTokenSent=![];return _0x463180[_0xd2f1('0x1c')]({'data1':_0x40be07,'data2':null,'license':null});}}}else{if(_0x42484c['data1']!=_0x40be07){logger['info'](_0xd2f1('0x22'),_0x42484c[_0xd2f1('0x12')],_0x40be07);return _0x463180[_0xd2f1('0x1c')]({'data1':_0x40be07,'data2':null,'license':null});}}}return _0x463180;})[_0xd2f1('0x10')](function(_0x42bf6f){_0x463180=_0x42bf6f;})[_0xd2f1('0x23')](function(_0x26371d){logger[_0xd2f1('0x24')](_0x26371d[_0xd2f1('0x25')]);})[_0xd2f1('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xd2f1('0x27')](),_0x463180);},TIME);});}function defaultLicense(){var _0x18bd66=hardware['getUuid']();if(_0x18bd66){return db['License'][_0xd2f1('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x18bd66}})['spread'](function(_0x126cae,_0x23a49e){logger['info'](_0xd2f1('0x29'),_0x18bd66);manageLicense(_0x18bd66,_0x126cae);})['catch'](function(_0x24010c){logger[_0xd2f1('0x24')](_0x24010c[_0xd2f1('0x25')]);});}}exports[_0xd2f1('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4082e43..a8afc2d 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 _0xd83e=['user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','add','days','grayReason','uuid','disabled','message','User','findAll','role','sequelize','col','count','admin'];(function(_0x2947d1,_0x5e70b0){var _0x2b36a5=function(_0x37637c){while(--_0x37637c){_0x2947d1['push'](_0x2947d1['shift']());}};_0x2b36a5(++_0x5e70b0);}(_0xd83e,0x15a));var _0xed83=function(_0x422dbc,_0x14366b){_0x422dbc=_0x422dbc-0x0;var _0x250f76=_0xd83e[_0x422dbc];return _0x250f76;};'use strict';var util=require(_0xed83('0x0'));var _=require(_0xed83('0x1'));var moment=require(_0xed83('0x2'));var BPromise=require(_0xed83('0x3'));var hardware=require(_0xed83('0x4'));var encryptor=require(_0xed83('0x5'));var db=require(_0xed83('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xed83('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xed83('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xed83('0x9'),'machineUuid':hardware[_0xed83('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x37ca8f){return new BPromise(function(_0x5c425e,_0x5a1d83){return db[_0xed83('0xa')][_0xed83('0xb')](_['defaults'](_0x37ca8f,{'raw':!![],'where':{'id':0x1}}))[_0xed83('0xc')](function(_0xfa79a1){return checkLicense(_0xfa79a1,null);})['then'](function(_0x415adf){_0x5c425e(_0x415adf);return;})[_0xed83('0xd')](function(_0x231a20){_0x5a1d83(_0x231a20);});});}function checkLicense(_0x425867,_0x3788f9){if(!_0x425867){demoLicense['uuid']=_0x425867['data1'];return demoLicense;}try{var _0x1946e2=_0x3788f9||_0x425867[_0xed83('0xe')];if(_[_0xed83('0xf')](_0x1946e2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4078ff=_0x425867[_0xed83('0x10')];var _0x25760e=_0x425867[_0xed83('0x11')];var _0x520e15=_0x4078ff[_0xed83('0x12')]('-')[0x4];var _0x4bd846=_0x4078ff[_0xed83('0x12')]('-')[0x0];var _0x2d44fd=encryptor[_0xed83('0x13')](_0x1946e2,util[_0xed83('0x14')](_0xed83('0x15'),_0x520e15,_0x4078ff,_0x4bd846));var _0x545340=JSON[_0xed83('0x16')](_0x2d44fd);_0x545340['demo']=![];_0x545340['uuid']=_0x4078ff;_0x545340[_0xed83('0x17')]=hardware[_0xed83('0x7')]();if(_0x25760e){var _0x220f76=encryptor['decryptString'](_0x25760e);_0x545340[_0xed83('0x18')]=_0x220f76;_0x545340['deadline']=moment(_0x220f76)[_0xed83('0x19')](0x7,_0xed83('0x1a'))['format']();_0x545340[_0xed83('0x1b')]=_0x545340[_0xed83('0x1c')]!=_0x545340[_0xed83('0x17')]?'changed':_0xed83('0x1d');}return _0x545340;}catch(_0x457ec5){breakingLicense['uuid']=_0x425867['data1'];breakingLicense['message']=_0x457ec5[_0xed83('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47fb85,_0x4e8076){getLicense()[_0xed83('0xc')](function(_0x557855){return db[_0xed83('0x1f')][_0xed83('0x20')]({'attributes':[_0xed83('0x21'),[db['sequelize']['fn']('COUNT',db[_0xed83('0x22')][_0xed83('0x23')]('role')),_0xed83('0x24')]],'group':_0xed83('0x21'),'where':{'role':{'$or':[_0xed83('0x25'),_0xed83('0x26'),_0xed83('0x27')]}},'raw':!![]})['then'](function(_0x838ad9){var _0x5b4b6e={'user':_0x557855[_0xed83('0x28')]||0x0,'telephone':_0x557855[_0xed83('0x29')]||0x0};_0x838ad9[_0xed83('0x2a')](function(_0x2f18b2){var _0x4743c0=_0x2f18b2[_0xed83('0x21')]===_0xed83('0x25')?_0xed83('0x26'):_0x2f18b2[_0xed83('0x21')];_0x5b4b6e[_0x4743c0]-=_0x2f18b2[_0xed83('0x24')];if(_0x5b4b6e[_0x4743c0]<0x0)_0x5b4b6e[_0x4743c0]=0x0;});_0x47fb85(_0x5b4b6e);return;});})[_0xed83('0xd')](function(_0x3d001f){_0x4e8076(_0x3d001f);});});}function checkUserLimits(_0x338b20){return new BPromise(function(_0x3e4ac5,_0x431319){getLimits()[_0xed83('0xc')](function(_0x1e26a6){var _0x88f842=_[_0xed83('0x2b')](_[_0xed83('0x2c')](_0x338b20,'role'),[_0xed83('0x25'),_0xed83('0x26'),_0xed83('0x27')]);var _0x2f6f35=(_0x88f842[_0xed83('0x25')]||0x0)+(_0x88f842[_0xed83('0x26')]||0x0);var _0x4cf406=_0x88f842[_0xed83('0x27')]||0x0;if(_0x2f6f35>_0x1e26a6[_0xed83('0x26')])return _0x431319(_0xed83('0x2d'));if(_0x4cf406>_0x1e26a6[_0xed83('0x27')])return _0x431319(_0xed83('0x2e'));return _0x3e4ac5();})['catch'](function(_0x5bcbed){_0x431319(_0x5bcbed);});});}module[_0xed83('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6569=['getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','machineUuid','decryptString','gray','add','days','format','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','catch','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x6569,0x1ed));var _0x9656=function(_0x128db3,_0x4a4df9){_0x128db3=_0x128db3-0x0;var _0x282abf=_0x6569[_0x128db3];return _0x282abf;};'use strict';var util=require(_0x9656('0x0'));var _=require(_0x9656('0x1'));var moment=require('moment');var BPromise=require(_0x9656('0x2'));var hardware=require('./hardware');var encryptor=require(_0x9656('0x3'));var db=require(_0x9656('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9656('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9656('0x6'),'machineUuid':hardware[_0x9656('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9656('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9656('0x8'),'machineUuid':hardware[_0x9656('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21a130){return new BPromise(function(_0xf5423d,_0x47017c){return db[_0x9656('0x9')][_0x9656('0xa')](_[_0x9656('0xb')](_0x21a130,{'raw':!![],'where':{'id':0x1}}))[_0x9656('0xc')](function(_0xa1a213){return checkLicense(_0xa1a213,null);})[_0x9656('0xc')](function(_0x1bf7ec){_0xf5423d(_0x1bf7ec);return;})['catch'](function(_0x154786){_0x47017c(_0x154786);});});}function checkLicense(_0x3a5e9c,_0x2edb17){if(!_0x3a5e9c){demoLicense[_0x9656('0xd')]=_0x3a5e9c[_0x9656('0xe')];return demoLicense;}try{var _0x1c9981=_0x2edb17||_0x3a5e9c[_0x9656('0xf')];if(_['isEmpty'](_0x1c9981)){throw new Error(_0x9656('0x10'));}var _0x5ba268=_0x3a5e9c[_0x9656('0xe')];var _0x3495f8=_0x3a5e9c[_0x9656('0x11')];var _0x1af098=_0x5ba268['split']('-')[0x4];var _0x1dd11d=_0x5ba268[_0x9656('0x12')]('-')[0x0];var _0x16735d=encryptor['decryptString'](_0x1c9981,util['format'](_0x9656('0x13'),_0x1af098,_0x5ba268,_0x1dd11d));var _0x5f4865=JSON[_0x9656('0x14')](_0x16735d);_0x5f4865['demo']=![];_0x5f4865[_0x9656('0xd')]=_0x5ba268;_0x5f4865[_0x9656('0x15')]=hardware[_0x9656('0x7')]();if(_0x3495f8){var _0x46dba8=encryptor[_0x9656('0x16')](_0x3495f8);_0x5f4865[_0x9656('0x17')]=_0x46dba8;_0x5f4865['deadline']=moment(_0x46dba8)[_0x9656('0x18')](0x7,_0x9656('0x19'))[_0x9656('0x1a')]();_0x5f4865[_0x9656('0x1b')]=_0x5f4865[_0x9656('0xd')]!=_0x5f4865[_0x9656('0x15')]?_0x9656('0x1c'):_0x9656('0x1d');}return _0x5f4865;}catch(_0x2a63bd){breakingLicense['uuid']=_0x3a5e9c[_0x9656('0xe')];breakingLicense['message']=_0x2a63bd[_0x9656('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1dbbe6,_0x535d1e){getLicense()[_0x9656('0xc')](function(_0x20198a){return db[_0x9656('0x1f')][_0x9656('0x20')]({'attributes':[_0x9656('0x21'),[db[_0x9656('0x22')]['fn'](_0x9656('0x23'),db['sequelize'][_0x9656('0x24')]('role')),_0x9656('0x25')]],'group':_0x9656('0x21'),'where':{'role':{'$or':[_0x9656('0x26'),'user',_0x9656('0x27')]}},'raw':!![]})[_0x9656('0xc')](function(_0x635058){var _0x337df7={'user':_0x20198a[_0x9656('0x28')]||0x0,'telephone':_0x20198a[_0x9656('0x29')]||0x0};_0x635058[_0x9656('0x2a')](function(_0x1f61b8){var _0x338270=_0x1f61b8[_0x9656('0x21')]==='admin'?'user':_0x1f61b8['role'];_0x337df7[_0x338270]-=_0x1f61b8[_0x9656('0x25')];if(_0x337df7[_0x338270]<0x0)_0x337df7[_0x338270]=0x0;});_0x1dbbe6(_0x337df7);return;});})[_0x9656('0x2b')](function(_0x509305){_0x535d1e(_0x509305);});});}function checkUserLimits(_0x4a362e){return new BPromise(function(_0x5df5a8,_0x56443e){getLimits()[_0x9656('0xc')](function(_0x19128d){var _0x593cd4=_[_0x9656('0x2c')](_[_0x9656('0x2d')](_0x4a362e,_0x9656('0x21')),['admin',_0x9656('0x2e'),_0x9656('0x27')]);var _0x59fb68=(_0x593cd4[_0x9656('0x26')]||0x0)+(_0x593cd4[_0x9656('0x2e')]||0x0);var _0x27b3c8=_0x593cd4['telephone']||0x0;if(_0x59fb68>_0x19128d[_0x9656('0x2e')])return _0x56443e(_0x9656('0x2f'));if(_0x27b3c8>_0x19128d[_0x9656('0x27')])return _0x56443e(_0x9656('0x30'));return _0x5df5a8();})['catch'](function(_0x27aec3){_0x56443e(_0x27aec3);});});}module[_0x9656('0x31')]={'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 ec4017f..badcf32 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 _0x9f0e=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x3fce93,_0x28e616){var _0x672f75=function(_0x4387f8){while(--_0x4387f8){_0x3fce93['push'](_0x3fce93['shift']());}};_0x672f75(++_0x28e616);}(_0x9f0e,0x116));var _0xe9f0=function(_0x83608e,_0x18b90e){_0x83608e=_0x83608e-0x0;var _0xd14e44=_0x9f0e[_0x83608e];return _0xd14e44;};'use strict';module[_0xe9f0('0x0')]={'DOMAIN':_0xe9f0('0x1'),'SESSION_SECRET':_0xe9f0('0x2'),'GOOGLE_ID':_0xe9f0('0x3'),'GOOGLE_SECRET':_0xe9f0('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xed3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x120123,_0x4eff59){var _0x3bec4c=function(_0x182818){while(--_0x182818){_0x120123['push'](_0x120123['shift']());}};_0x3bec4c(++_0x4eff59);}(_0xed3c,0x1a6));var _0xced3=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0xed3c[_0x255c48];return _0xaebda3;};'use strict';module[_0xced3('0x0')]={'DOMAIN':_0xced3('0x1'),'SESSION_SECRET':_0xced3('0x2'),'GOOGLE_ID':_0xced3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3f68976..09a7545 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafe8=['exports','../utils/loggers'];(function(_0x137aa6,_0xc9ad62){var _0x24cb82=function(_0x278fcd){while(--_0x278fcd){_0x137aa6['push'](_0x137aa6['shift']());}};_0x24cb82(++_0xc9ad62);}(_0xafe8,0x175));var _0x8afe=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0xafe8[_0x234318];return _0x1ab719;};'use strict';var fileLogger=require(_0x8afe('0x0'))['fileLogger'];module[_0x8afe('0x1')]=fileLogger; \ No newline at end of file +var _0x02a7=['../utils/loggers','fileLogger'];(function(_0x5ce185,_0x4100a4){var _0x1e40c5=function(_0x70bbaf){while(--_0x70bbaf){_0x5ce185['push'](_0x5ce185['shift']());}};_0x1e40c5(++_0x4100a4);}(_0x02a7,0x80));var _0x702a=function(_0x1e6005,_0x489d70){_0x1e6005=_0x1e6005-0x0;var _0x59e8a4=_0x02a7[_0x1e6005];return _0x59e8a4;};'use strict';var fileLogger=require(_0x702a('0x0'))[_0x702a('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c38e944..4660143 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 _0xcdad=['express','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','../../config/environment','resolve','root'];(function(_0x4b7428,_0x29ef54){var _0x2b9514=function(_0x24d056){while(--_0x24d056){_0x4b7428['push'](_0x4b7428['shift']());}};_0x2b9514(++_0x29ef54);}(_0xcdad,0x15d));var _0xdcda=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xcdad[_0x1e172a];return _0x96338b;};'use strict';var path=require('path');var cfg=require(_0xdcda('0x0'));var env={'NODE_PATH':path[_0xdcda('0x1')](path['join'](cfg[_0xdcda('0x2')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xdcda('0x3'),'script':path[_0xdcda('0x4')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xdcda('0x5'),'script':path['join'](__dirname,_0xdcda('0x6')),'env':env},{'name':_0xdcda('0x7'),'script':path[_0xdcda('0x4')](__dirname,_0xdcda('0x8')),'env':env},{'name':_0xdcda('0x9'),'script':path['join'](__dirname,_0xdcda('0xa')),'env':env},{'name':_0xdcda('0xb'),'script':path[_0xdcda('0x4')](__dirname,_0xdcda('0xc')),'env':env},{'name':_0xdcda('0xd'),'script':path['join'](__dirname,_0xdcda('0xe')),'env':env}]};module[_0xdcda('0xf')]=pm2config; \ No newline at end of file +var _0x6a28=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','resolve','legacy-libs','../../services/express/index.js','ami','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a28,0x1e1));var _0x86a2=function(_0xcff3b8,_0x59ae1a){_0xcff3b8=_0xcff3b8-0x0;var _0x37794d=_0x6a28[_0xcff3b8];return _0x37794d;};'use strict';var path=require(_0x86a2('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x86a2('0x1')](path['join'](cfg['root'],_0x86a2('0x2')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0x86a2('0x3')),'env':env},{'name':_0x86a2('0x4'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x86a2('0x5'),'script':path['join'](__dirname,_0x86a2('0x6')),'env':env},{'name':_0x86a2('0x7'),'script':path['join'](__dirname,_0x86a2('0x8')),'env':env},{'name':_0x86a2('0x9'),'script':path['join'](__dirname,_0x86a2('0xa')),'env':env},{'name':_0x86a2('0xb'),'script':path['join'](__dirname,_0x86a2('0xc')),'env':env}]};module[_0x86a2('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b12e5b2..b053eec 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 _0x72e9=['saved','pm2','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x5e33e1,_0x512a38){var _0x274c02=function(_0x538a5b){while(--_0x538a5b){_0x5e33e1['push'](_0x5e33e1['shift']());}};_0x274c02(++_0x512a38);}(_0x72e9,0x7f));var _0x972e=function(_0x2b61c1,_0x2eb2d5){_0x2b61c1=_0x2b61c1-0x0;var _0x54cc6e=_0x72e9[_0x2b61c1];return _0x54cc6e;};'use strict';var pm2=require(_0x972e('0x0'));var BPromise=require(_0x972e('0x1'));var config=require(_0x972e('0x2'));function connect(){return new BPromise(function(_0x1f4654,_0x2e09ec){return pm2[_0x972e('0x3')](function(_0x18bf41){if(_0x18bf41){return _0x2e09ec(_0x18bf41);}return _0x1f4654('connected');});});};exports[_0x972e('0x4')]=function(_0x1cb667){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x432a76,_0x109d1e){return pm2[_0x972e('0x4')](_0x1cb667,function(_0x349595,_0x2f251f){if(_0x349595){return _0x109d1e(_0x349595);}pm2['disconnect']();return _0x432a76(_0x2f251f);});});});};exports[_0x972e('0x6')]=function(_0x29124d){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x3324f1,_0x81392a){return pm2[_0x972e('0x6')](_0x29124d,function(_0x4600c8,_0x3dd3c6){if(_0x4600c8){return _0x81392a(_0x4600c8);}pm2[_0x972e('0x7')]();return _0x3324f1(_0x3dd3c6);});});});};exports[_0x972e('0x8')]=function(_0x57018a){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x564186,_0x4d67c1){return pm2['restart'](_0x57018a,function(_0x5e97f2,_0x36342b){if(_0x5e97f2){return _0x4d67c1(_0x5e97f2);}pm2[_0x972e('0x7')]();return _0x564186(_0x36342b);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x4838a7,_0x42eac5){return pm2[_0x972e('0x9')](function(_0x215bf5,_0x42b887){if(_0x215bf5){return _0x42eac5(_0x215bf5);}pm2[_0x972e('0x7')]();return _0x4838a7(_0x42b887);});});});};exports[_0x972e('0xa')]=function(_0x317f58){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x75110f,_0x113932){return pm2[_0x972e('0xa')](_0x317f58,function(_0x3a9b52,_0x46508e){if(_0x3a9b52){return _0x113932(_0x3a9b52);}pm2['disconnect']();return _0x75110f(_0x46508e);});});});};exports[_0x972e('0xb')]=function(_0x15362c){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0xb074a1,_0x1029b6){return pm2[_0x972e('0xb')](_0x15362c,function(_0x3bb6c5,_0x1035a7){if(_0x3bb6c5){return _0x1029b6(_0x3bb6c5);}pm2['disconnect']();return _0xb074a1(_0x1035a7);});});});};exports[_0x972e('0xc')]=function(){return connect()[_0x972e('0x5')](function(){return new BPromise(function(_0x2131ed,_0x19327e){return pm2[_0x972e('0xc')](function(_0x37d307){if(_0x37d307){return _0x19327e(_0x37d307);}return _0x2131ed(_0x972e('0xd'));});});});}; \ No newline at end of file +var _0x7fc7=['restart','list','describe','dump','./config','connect','connected','start','then','disconnect','stop'];(function(_0x337bf8,_0x9ee2c){var _0xa616fc=function(_0x13c119){while(--_0x13c119){_0x337bf8['push'](_0x337bf8['shift']());}};_0xa616fc(++_0x9ee2c);}(_0x7fc7,0x117));var _0x77fc=function(_0x58d456,_0x4e297a){_0x58d456=_0x58d456-0x0;var _0x487b3c=_0x7fc7[_0x58d456];return _0x487b3c;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x77fc('0x0'));function connect(){return new BPromise(function(_0x39f808,_0xef6d27){return pm2[_0x77fc('0x1')](function(_0x232f72){if(_0x232f72){return _0xef6d27(_0x232f72);}return _0x39f808(_0x77fc('0x2'));});});};exports[_0x77fc('0x3')]=function(_0x467296){return connect()[_0x77fc('0x4')](function(){return new BPromise(function(_0x28ff2c,_0xd5fe06){return pm2['start'](_0x467296,function(_0x514d01,_0xcb4112){if(_0x514d01){return _0xd5fe06(_0x514d01);}pm2[_0x77fc('0x5')]();return _0x28ff2c(_0xcb4112);});});});};exports[_0x77fc('0x6')]=function(_0xf5f1f8){return connect()['then'](function(){return new BPromise(function(_0x2006de,_0x6bd244){return pm2['stop'](_0xf5f1f8,function(_0x52222a,_0x4893ed){if(_0x52222a){return _0x6bd244(_0x52222a);}pm2['disconnect']();return _0x2006de(_0x4893ed);});});});};exports[_0x77fc('0x7')]=function(_0x75815e){return connect()[_0x77fc('0x4')](function(){return new BPromise(function(_0x35cfdc,_0x247af8){return pm2['restart'](_0x75815e,function(_0x5395ea,_0x552e93){if(_0x5395ea){return _0x247af8(_0x5395ea);}pm2[_0x77fc('0x5')]();return _0x35cfdc(_0x552e93);});});});};exports[_0x77fc('0x8')]=function(){return connect()[_0x77fc('0x4')](function(){return new BPromise(function(_0x2bdf72,_0x58f590){return pm2[_0x77fc('0x8')](function(_0xf50011,_0xcd87c2){if(_0xf50011){return _0x58f590(_0xf50011);}pm2['disconnect']();return _0x2bdf72(_0xcd87c2);});});});};exports[_0x77fc('0x9')]=function(_0x1ea04e){return connect()[_0x77fc('0x4')](function(){return new BPromise(function(_0x7bd9f8,_0x25e1f3){return pm2[_0x77fc('0x9')](_0x1ea04e,function(_0x3f4b68,_0x40f03c){if(_0x3f4b68){return _0x25e1f3(_0x3f4b68);}pm2[_0x77fc('0x5')]();return _0x7bd9f8(_0x40f03c);});});});};exports['delete']=function(_0x315e06){return connect()['then'](function(){return new BPromise(function(_0x521e0e,_0x5b2aba){return pm2['delete'](_0x315e06,function(_0x4205ae,_0x11018c){if(_0x4205ae){return _0x5b2aba(_0x4205ae);}pm2[_0x77fc('0x5')]();return _0x521e0e(_0x11018c);});});});};exports[_0x77fc('0xa')]=function(){return connect()[_0x77fc('0x4')](function(){return new BPromise(function(_0x35a86f,_0xde4cdb){return pm2[_0x77fc('0xa')](function(_0x31ed3a){if(_0x31ed3a){return _0xde4cdb(_0x31ed3a);}return _0x35a86f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d2728a2..b996993 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 _0xb824=['Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter'];(function(_0x578509,_0x135233){var _0x1221d2=function(_0x580bdf){while(--_0x580bdf){_0x578509['push'](_0x578509['shift']());}};_0x1221d2(++_0x135233);}(_0xb824,0xfe));var _0x4b82=function(_0xb1df72,_0x28df22){_0xb1df72=_0xb1df72-0x0;var _0x4b74ea=_0xb824[_0xb1df72];return _0x4b74ea;};'use strict';var _=require('lodash');var moment=require(_0x4b82('0x0'));var Redis=require(_0x4b82('0x1'));var util=require(_0x4b82('0x2'));var config=require(_0x4b82('0x3'));var db=require(_0x4b82('0x4'))['db'];var logger=require(_0x4b82('0x5'))(_0x4b82('0x6'));config[_0x4b82('0x7')]=_['defaults'](config['redis'],{'host':_0x4b82('0x8'),'port':0x18eb});var io=require(_0x4b82('0x9'))(new Redis(config[_0x4b82('0x7')]));function closeInteractions(){var _0x340ac0=0x0;var _0x35fb36=[];return db[_0x4b82('0xa')][_0x4b82('0xb')]({'raw':!![],'attributes':['id',_0x4b82('0xc')],'where':{'id':0x1}})[_0x4b82('0xd')](function(_0x8ba162){_0x340ac0=_0x8ba162[_0x4b82('0xc')];if(_0x340ac0){return db[_0x4b82('0xe')][_0x4b82('0xf')]({'raw':!![],'attributes':['id',_0x4b82('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4b82('0x11')](_0x8ba162['chatTimeout'],_0x4b82('0x12'))}}});}else{return[];}})[_0x4b82('0xd')](function(_0x285791){if(_0x285791&&_0x285791[_0x4b82('0x13')]){_0x35fb36=_[_0x4b82('0x14')](_0x285791||[],'id');logger[_0x4b82('0x15')](_0x4b82('0x16'),_0x35fb36[_0x4b82('0x17')]());return db[_0x4b82('0xe')][_0x4b82('0x18')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x4b82('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x35fb36}});}})['then'](function(){if(_0x35fb36&&_0x35fb36[_0x4b82('0x13')]){logger[_0x4b82('0x15')](_0x4b82('0x1a'),_0x35fb36[_0x4b82('0x17')]());for(var _0x5b5a18=0x0;_0x5b5a18<_0x35fb36['length'];_0x5b5a18++){io[_0x4b82('0x1b')]('chatInteraction:update',{'id':_0x35fb36[_0x5b5a18],'closed':!![]});}}})[_0x4b82('0x1c')](function(_0xaf8c1b){logger[_0x4b82('0x1d')](_0x4b82('0x1e'),_0xaf8c1b?util[_0x4b82('0x1f')](_0xaf8c1b,{'showHidden':![],'depth':null}):'');});}exports[_0x4b82('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbebb=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xbebb,0x1cc));var _0xbbeb=function(_0x2aa0d5,_0x2bac85){_0x2aa0d5=_0x2aa0d5-0x0;var _0x224980=_0xbebb[_0x2aa0d5];return _0x224980;};'use strict';var _=require(_0xbbeb('0x0'));var moment=require(_0xbbeb('0x1'));var Redis=require(_0xbbeb('0x2'));var util=require(_0xbbeb('0x3'));var config=require(_0xbbeb('0x4'));var db=require(_0xbbeb('0x5'))['db'];var logger=require('../logger')(_0xbbeb('0x6'));config[_0xbbeb('0x7')]=_[_0xbbeb('0x8')](config[_0xbbeb('0x7')],{'host':_0xbbeb('0x9'),'port':0x18eb});var io=require(_0xbbeb('0xa'))(new Redis(config[_0xbbeb('0x7')]));function closeInteractions(){var _0x5cb0b3=0x0;var _0x173942=[];return db[_0xbbeb('0xb')][_0xbbeb('0xc')]({'raw':!![],'attributes':['id',_0xbbeb('0xd')],'where':{'id':0x1}})[_0xbbeb('0xe')](function(_0x3dafe5){_0x5cb0b3=_0x3dafe5['chatTimeout'];if(_0x5cb0b3){return db[_0xbbeb('0xf')][_0xbbeb('0x10')]({'raw':!![],'attributes':['id',_0xbbeb('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3dafe5[_0xbbeb('0xd')],_0xbbeb('0x12'))}}});}else{return[];}})['then'](function(_0x5455e2){if(_0x5455e2&&_0x5455e2[_0xbbeb('0x13')]){_0x173942=_[_0xbbeb('0x14')](_0x5455e2||[],'id');logger[_0xbbeb('0x15')](_0xbbeb('0x16'),_0x173942[_0xbbeb('0x17')]());return db[_0xbbeb('0xf')][_0xbbeb('0x18')]({'closeReason':_0xbbeb('0x19'),'disposition':_0xbbeb('0x1a'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x173942}});}})[_0xbbeb('0xe')](function(){if(_0x173942&&_0x173942[_0xbbeb('0x13')]){logger[_0xbbeb('0x15')](_0xbbeb('0x1b'),_0x173942[_0xbbeb('0x17')]());for(var _0x58ad96=0x0;_0x58ad96<_0x173942['length'];_0x58ad96++){io[_0xbbeb('0x1c')](_0xbbeb('0x1d'),{'id':_0x173942[_0x58ad96],'closed':!![]});}}})[_0xbbeb('0x1e')](function(_0xf98a75){logger[_0xbbeb('0x1f')](_0xbbeb('0x20'),_0xf98a75?util[_0xbbeb('0x21')](_0xf98a75,{'showHidden':![],'depth':null}):'');});}exports[_0xbbeb('0x22')]=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 1dd07e4..6280009 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 _0xddcc=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xddcc,0xe2));var _0xcddc=function(_0x4cd1ed,_0x9ab689){_0x4cd1ed=_0x4cd1ed-0x0;var _0xf17a22=_0xddcc[_0x4cd1ed];return _0xf17a22;};'use strict';function start(){var _0x57225b=require(_0xcddc('0x0'));return _0x57225b['startAllRefreshIntervals']();}module[_0xcddc('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x9cec=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cec,0x76));var _0xc9ce=function(_0x1c256e,_0x35cda3){_0x1c256e=_0x1c256e-0x0;var _0x5ef56c=_0x9cec[_0x1c256e];return _0x5ef56c;};'use strict';function start(){var _0x480e43=require(_0xc9ce('0x0'));return _0x480e43['startAllRefreshIntervals']();}module[_0xc9ce('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 9d32815..220ef09 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 _0x24a3=['getSmtpOptions','\x22%s\x22\x20<%s>','name','email','user','bcc','format','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','exists','stop','deleteJob','delete\x20cron','length','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','stop\x20cron','active','update','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x24a3,0x96));var _0x324a=function(_0x39e407,_0x5c81fe){_0x39e407=_0x39e407-0x0;var _0xb638a5=_0x24a3[_0x39e407];return _0xb638a5;};'use strict';var fs=require('fs');var util=require(_0x324a('0x0'));var path=require(_0x324a('0x1'));var _=require(_0x324a('0x2'));var moment=require(_0x324a('0x3'));var CronJobManager=require(_0x324a('0x4'));var jayson=require(_0x324a('0x5'));var BPromise=require(_0x324a('0x6'));var logger=require(_0x324a('0x7'))(_0x324a('0x8'));var db=require(_0x324a('0x9'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x324a('0xa'));var client=jayson[_0x324a('0xb')][_0x324a('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28a88d,_0x52a047){return function(){logger[_0x324a('0xd')](_0x324a('0xe'),_0x28a88d['email']);var _0x44c14a=!![];var _0x4714d0=_0x28a88d[_0x324a('0xf')][_0x324a('0x10')]();var _0x47f3ec={'account':_0x4714d0,'message':{'from':util['format'](_0x324a('0x11'),_0x28a88d[_0x324a('0xf')][_0x324a('0x12')],_0x28a88d['MailAccount'][_0x324a('0x13')]||_0x28a88d[_0x324a('0xf')]['Smtp'][_0x324a('0x14')]),'to':_0x28a88d[_0x324a('0x13')],'cc':_0x28a88d['cc'],'bcc':_0x28a88d[_0x324a('0x15')],'subject':util[_0x324a('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x52a047[_0x324a('0x12')],_0x28a88d[_0x324a('0x17')],_0x28a88d[_0x324a('0x18')])}};var _0x226763=path[_0x324a('0x19')](__dirname,_0x324a('0x1a'));var _0x3649c2=_0x52a047['savename'];var _0x4bd352=util[_0x324a('0x16')]('%s.%s',path[_0x324a('0x1b')](_0x52a047[_0x324a('0x1c')],path[_0x324a('0x1d')](_0x52a047[_0x324a('0x1c')])),_0x324a('0x1e'));var _0x3d62c1=path[_0x324a('0x19')](_0x226763,_0x3649c2);var _0x184a2f=path[_0x324a('0x19')](_0x226763,_0x4bd352);if(fs[_0x324a('0x1f')](_0x3d62c1)){_0x52a047[_0x324a('0x20')]=_0x324a('0x21');_0x47f3ec[_0x324a('0x22')][_0x324a('0x23')]=[{'filename':_0x3649c2,'path':_0x3d62c1}];_0x47f3ec[_0x324a('0x22')][_0x324a('0x24')]=util[_0x324a('0x16')](_0x324a('0x25'),JSON[_0x324a('0x26')](_0x52a047,null,0x2));}else if(fs['existsSync'](_0x184a2f)){_0x52a047[_0x324a('0x20')]='Sent';_0x47f3ec[_0x324a('0x22')][_0x324a('0x23')]=[{'filename':_0x4bd352,'path':_0x184a2f}];}else{_0x47f3ec[_0x324a('0x22')][_0x324a('0x24')]=_0x324a('0x27');if(!_0x28a88d['sendIfEmpty']){_0x44c14a=![];logger[_0x324a('0xd')](_0x324a('0x28'));}}if(_0x44c14a){return client[_0x324a('0x29')](_0x324a('0x2a'),_0x47f3ec)[_0x324a('0x2b')](function(_0x3150a7){if(_0x3150a7[_0x324a('0x2c')]){return logger[_0x324a('0x2c')](_0x324a('0x2d'),JSON[_0x324a('0x26')](_0x3150a7));}return logger[_0x324a('0xd')](_0x324a('0x2e'));})[_0x324a('0x2f')](function(_0x5a0d27){return logger[_0x324a('0x2c')](_0x324a('0x2d'),JSON[_0x324a('0x26')](_0x5a0d27));});}};}function handleError(){return function(_0x5e28e3){return logger[_0x324a('0x2c')](JSON[_0x324a('0x26')](_0x5e28e3));};}function handleResult(_0x780155){return function(_0x44f4c3){logger[_0x324a('0xd')]('data',JSON[_0x324a('0x26')](_0x44f4c3));if(_0x780155[_0x324a('0xf')]&&_0x780155[_0x324a('0xf')]['Smtp']&&!_[_0x324a('0x30')](_0x780155[_0x324a('0x13')])){setTimeout(handleSendEmail(_0x780155,_0x44f4c3),0x3c*0x3e8);}};}function handleJob(_0x46d9e2){return function(){try{if(_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x17')])){return logger[_0x324a('0xd')](_0x324a('0x31'));}if(_['isNil'](_0x46d9e2[_0x324a('0x18')])){return logger[_0x324a('0xd')](_0x324a('0x32'));}var _0x2bf688={'startDate':moment()[_0x324a('0x33')](_0x46d9e2[_0x324a('0x17')],_0x46d9e2[_0x324a('0x18')])[_0x324a('0x16')](_0x324a('0x34')),'endDate':moment()[_0x324a('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x324a('0x35'),'output':_0x46d9e2['output'],'name':_0x46d9e2[_0x324a('0x12')]};if(!_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x36')])){logger[_0x324a('0xd')]('exec\x20defaul\x20report\x20id:%s',_0x46d9e2['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x46d9e2[_0x324a('0x36')]},_0x2bf688)[_0x324a('0x2b')](handleResult(_0x46d9e2))['catch'](handleError());}if(!_[_0x324a('0x30')](_0x46d9e2[_0x324a('0x37')])){logger[_0x324a('0xd')]('exec\x20custom\x20report\x20id:%s',_0x46d9e2[_0x324a('0x37')]);return analyticCustomReportController[_0x324a('0x38')]({'id':_0x46d9e2['CustomReportId']},_0x2bf688)[_0x324a('0x2b')](handleResult(_0x46d9e2))['catch'](handleError());}}catch(_0x374c29){logger[_0x324a('0x2c')](JSON['stringify'](_0x374c29));}return logger[_0x324a('0xd')](_0x324a('0x39'));};}function getJobs(_0x1402b2){var _0x1064a0={};if(_0x1402b2){_0x1064a0['id']=_0x1402b2;}return db[_0x324a('0x3a')][_0x324a('0x3b')]({'where':_0x1064a0,'include':[{'model':db[_0x324a('0xf')],'attributes':['id','name',_0x324a('0x13')],'include':[{'model':db[_0x324a('0x3c')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x324a('0x3d')}]}]}]})[_0x324a('0x2b')](function(_0x1ca14c){var _0x5c4dd0=_['keys'](manager[_0x324a('0x3e')]);var _0x135c9d=_[_0x324a('0x3f')](_0x1ca14c,function(_0x31ba27){return _0x31ba27['id'][_0x324a('0x40')]();});var _0xc44388=_[_0x324a('0x41')](_0x1ca14c,function(_0x293ec6){return _0x293ec6['id'][_0x324a('0x40')]();});var _0xbbacb=_0x1402b2?_0x135c9d:_[_0x324a('0x42')](_0x135c9d,_0x5c4dd0);var _0x6baca7=_['intersection'](_0x135c9d,_0x5c4dd0);var _0x1c0605=_[_0x324a('0x42')](_0x5c4dd0,_0x135c9d);var _0x5819fa;var _0x10547f;for(_0x5819fa=0x0;_0x5819fa<_0x1c0605['length']&&!_0x1402b2;_0x5819fa+=0x1){_0x10547f=_0x1c0605[_0x5819fa][_0x324a('0x40')]();if(manager[_0x324a('0x43')](_0x10547f)){manager[_0x324a('0x44')](_0x10547f);manager[_0x324a('0x45')](_0x10547f);logger[_0x324a('0xd')](_0x324a('0x46'),_0x10547f);}}logger['info']('toRun',JSON['stringify'](_0xbbacb));for(_0x5819fa=0x0;_0x5819fa<_0xbbacb[_0x324a('0x47')];_0x5819fa+=0x1){_0x10547f=_0xbbacb[_0x5819fa][_0x324a('0x40')]();logger[_0x324a('0xd')]('index',_0x10547f);if(_0x1402b2){logger['info']('my\x20id',_0x1402b2);logger[_0x324a('0xd')](JSON[_0x324a('0x26')](_0xc44388[_0x10547f]));BPromise[_0x324a('0x48')]()[_0x324a('0x2b')](handleJob(_0xc44388[_0x10547f]));logger[_0x324a('0xd')](_0x324a('0x49'),_0xc44388[_0x10547f]['name'],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else if(_0xc44388[_0x10547f][_0x324a('0x4a')]&&_0xc44388[_0x10547f]['active']&&moment()[_0x324a('0x4b')](_0xc44388[_0x10547f][_0x324a('0x4c')],_0xc44388[_0x10547f][_0x324a('0x4d')])){manager[_0x324a('0x4e')](_0x10547f,_0xc44388[_0x10547f][_0x324a('0x4a')],handleJob(_0xc44388[_0x10547f]));manager[_0x324a('0x4f')](_0x10547f);logger[_0x324a('0xd')]('add\x20cron',_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else if(manager[_0x324a('0x43')](_0x10547f)){manager[_0x324a('0x44')](_0x10547f);manager[_0x324a('0x45')](_0x10547f);logger['info'](_0x324a('0x50'),_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f]['cron']);}}for(_0x5819fa=0x0,_0x10547f;_0x5819fa<_0x6baca7[_0x324a('0x47')]&&!_0x1402b2;_0x5819fa+=0x1){_0x10547f=_0x6baca7[_0x5819fa][_0x324a('0x40')]();if(manager['exists'](_0x10547f)){if(_0xc44388[_0x10547f][_0x324a('0x4a')]&&_0xc44388[_0x10547f][_0x324a('0x51')]&&moment()[_0x324a('0x4b')](_0xc44388[_0x10547f][_0x324a('0x4c')],_0xc44388[_0x10547f]['endAt'])){manager[_0x324a('0x52')](_0x10547f,_0xc44388[_0x10547f][_0x324a('0x4a')],handleJob(_0xc44388[_0x10547f]));logger[_0x324a('0xd')]('update\x20cron',_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}else{manager['stop'](_0x10547f);manager['deleteJob'](_0x10547f);logger['info'](_0x324a('0x50'),_0xc44388[_0x10547f][_0x324a('0x12')],_0xc44388[_0x10547f][_0x324a('0x4a')]);}}}})[_0x324a('0x2f')](function(_0x2a9753){logger[_0x324a('0x2c')](JSON[_0x324a('0x26')](_0x2a9753));});}exports['run']=function(_0x58b1f6){return getJobs(_0x58b1f6);};exports[_0x324a('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0db8=['catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','length','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop','stop\x20cron','exists','update','run','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','status','Sent','message','text','stringify','existsSync','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail'];(function(_0x5d36a2,_0x4fdb70){var _0x4fd84f=function(_0x32f4f7){while(--_0x32f4f7){_0x5d36a2['push'](_0x5d36a2['shift']());}};_0x4fd84f(++_0x4fdb70);}(_0x0db8,0xd4));var _0x80db=function(_0x3b07d7,_0x374e44){_0x3b07d7=_0x3b07d7-0x0;var _0x2a9b53=_0x0db8[_0x3b07d7];return _0x2a9b53;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x80db('0x0'));var _=require(_0x80db('0x1'));var moment=require(_0x80db('0x2'));var CronJobManager=require(_0x80db('0x3'));var jayson=require(_0x80db('0x4'));var BPromise=require('bluebird');var logger=require(_0x80db('0x5'))(_0x80db('0x6'));var db=require(_0x80db('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x80db('0x8'));var client=jayson[_0x80db('0x9')][_0x80db('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x50ac75,_0x41aab6){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x50ac75[_0x80db('0xb')]);var _0x43a3a9=!![];var _0x26b7b5=_0x50ac75[_0x80db('0xc')][_0x80db('0xd')]();var _0x54ba99={'account':_0x26b7b5,'message':{'from':util[_0x80db('0xe')](_0x80db('0xf'),_0x50ac75[_0x80db('0xc')][_0x80db('0x10')],_0x50ac75[_0x80db('0xc')][_0x80db('0xb')]||_0x50ac75[_0x80db('0xc')][_0x80db('0x11')][_0x80db('0x12')]),'to':_0x50ac75[_0x80db('0xb')],'cc':_0x50ac75['cc'],'bcc':_0x50ac75[_0x80db('0x13')],'subject':util[_0x80db('0xe')](_0x80db('0x14'),_0x41aab6[_0x80db('0x10')],_0x50ac75[_0x80db('0x15')],_0x50ac75[_0x80db('0x16')])}};var _0x13f1cf=path[_0x80db('0x17')](__dirname,_0x80db('0x18'));var _0x5cf526=_0x41aab6[_0x80db('0x19')];var _0x1044ed=util[_0x80db('0xe')](_0x80db('0x1a'),path[_0x80db('0x1b')](_0x41aab6[_0x80db('0x19')],path['extname'](_0x41aab6[_0x80db('0x19')])),'zip');var _0xb2ec3f=path[_0x80db('0x17')](_0x13f1cf,_0x5cf526);var _0x3d2e4c=path[_0x80db('0x17')](_0x13f1cf,_0x1044ed);if(fs['existsSync'](_0xb2ec3f)){_0x41aab6[_0x80db('0x1c')]=_0x80db('0x1d');_0x54ba99['message']['attachments']=[{'filename':_0x5cf526,'path':_0xb2ec3f}];_0x54ba99[_0x80db('0x1e')][_0x80db('0x1f')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x80db('0x20')](_0x41aab6,null,0x2));}else if(fs[_0x80db('0x21')](_0x3d2e4c)){_0x41aab6[_0x80db('0x1c')]=_0x80db('0x1d');_0x54ba99[_0x80db('0x1e')][_0x80db('0x22')]=[{'filename':_0x1044ed,'path':_0x3d2e4c}];}else{_0x54ba99[_0x80db('0x1e')]['text']=_0x80db('0x23');if(!_0x50ac75[_0x80db('0x24')]){_0x43a3a9=![];logger[_0x80db('0x25')](_0x80db('0x26'));}}if(_0x43a3a9){return client[_0x80db('0x27')](_0x80db('0x28'),_0x54ba99)['then'](function(_0x35a1a0){if(_0x35a1a0['error']){return logger[_0x80db('0x29')](_0x80db('0x2a'),JSON[_0x80db('0x20')](_0x35a1a0));}return logger[_0x80db('0x25')]('email\x20sent');})[_0x80db('0x2b')](function(_0xbb6522){return logger[_0x80db('0x29')](_0x80db('0x2a'),JSON['stringify'](_0xbb6522));});}};}function handleError(){return function(_0x5c2e34){return logger['error'](JSON[_0x80db('0x20')](_0x5c2e34));};}function handleResult(_0x4cac31){return function(_0x50a7b1){logger[_0x80db('0x25')](_0x80db('0x2c'),JSON['stringify'](_0x50a7b1));if(_0x4cac31[_0x80db('0xc')]&&_0x4cac31[_0x80db('0xc')][_0x80db('0x11')]&&!_[_0x80db('0x2d')](_0x4cac31[_0x80db('0xb')])){setTimeout(handleSendEmail(_0x4cac31,_0x50a7b1),0x3c*0x3e8);}};}function handleJob(_0x5941ff){return function(){try{if(_[_0x80db('0x2d')](_0x5941ff[_0x80db('0x15')])){return logger[_0x80db('0x25')](_0x80db('0x2e'));}if(_[_0x80db('0x2d')](_0x5941ff['subtractUnit'])){return logger[_0x80db('0x25')](_0x80db('0x2f'));}var _0x3bf25f={'startDate':moment()[_0x80db('0x30')](_0x5941ff[_0x80db('0x15')],_0x5941ff[_0x80db('0x16')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x80db('0x31'),'output':_0x5941ff['output'],'name':_0x5941ff[_0x80db('0x10')]};if(!_[_0x80db('0x2d')](_0x5941ff['DefaultReportId'])){logger['info'](_0x80db('0x32'),_0x5941ff['DefaultReportId']);return analyticDefaultReportController[_0x80db('0x33')]({'id':_0x5941ff['DefaultReportId']},_0x3bf25f)['then'](handleResult(_0x5941ff))[_0x80db('0x2b')](handleError());}if(!_[_0x80db('0x2d')](_0x5941ff[_0x80db('0x34')])){logger[_0x80db('0x25')](_0x80db('0x35'),_0x5941ff['CustomReportId']);return analyticCustomReportController[_0x80db('0x33')]({'id':_0x5941ff[_0x80db('0x34')]},_0x3bf25f)[_0x80db('0x36')](handleResult(_0x5941ff))[_0x80db('0x2b')](handleError());}}catch(_0x5af57f){logger[_0x80db('0x29')](JSON[_0x80db('0x20')](_0x5af57f));}return logger[_0x80db('0x25')](_0x80db('0x37'));};}function getJobs(_0x227526){var _0x1c25df={};if(_0x227526){_0x1c25df['id']=_0x227526;}return db[_0x80db('0x38')]['findAll']({'where':_0x1c25df,'include':[{'model':db[_0x80db('0xc')],'attributes':['id','name',_0x80db('0xb')],'include':[{'model':db[_0x80db('0x39')],'as':_0x80db('0x11'),'include':[{'model':db[_0x80db('0x3a')],'as':_0x80db('0x3a')}]}]}]})[_0x80db('0x36')](function(_0x495163){var _0x5da61e=_[_0x80db('0x3b')](manager[_0x80db('0x3c')]);var _0x46225c=_['map'](_0x495163,function(_0x5b3139){return _0x5b3139['id'][_0x80db('0x3d')]();});var _0x35eaf4=_[_0x80db('0x3e')](_0x495163,function(_0x2307fb){return _0x2307fb['id']['toString']();});var _0x2336cb=_0x227526?_0x46225c:_[_0x80db('0x3f')](_0x46225c,_0x5da61e);var _0x46326f=_[_0x80db('0x40')](_0x46225c,_0x5da61e);var _0x18dfe6=_[_0x80db('0x3f')](_0x5da61e,_0x46225c);var _0x3aa629;var _0x25c356;for(_0x3aa629=0x0;_0x3aa629<_0x18dfe6[_0x80db('0x41')]&&!_0x227526;_0x3aa629+=0x1){_0x25c356=_0x18dfe6[_0x3aa629][_0x80db('0x3d')]();if(manager['exists'](_0x25c356)){manager['stop'](_0x25c356);manager[_0x80db('0x42')](_0x25c356);logger[_0x80db('0x25')](_0x80db('0x43'),_0x25c356);}}logger['info'](_0x80db('0x44'),JSON[_0x80db('0x20')](_0x2336cb));for(_0x3aa629=0x0;_0x3aa629<_0x2336cb[_0x80db('0x41')];_0x3aa629+=0x1){_0x25c356=_0x2336cb[_0x3aa629]['toString']();logger[_0x80db('0x25')](_0x80db('0x45'),_0x25c356);if(_0x227526){logger['info'](_0x80db('0x46'),_0x227526);logger['info'](JSON[_0x80db('0x20')](_0x35eaf4[_0x25c356]));BPromise[_0x80db('0x47')]()[_0x80db('0x36')](handleJob(_0x35eaf4[_0x25c356]));logger[_0x80db('0x25')](_0x80db('0x48'),_0x35eaf4[_0x25c356]['name'],_0x35eaf4[_0x25c356][_0x80db('0x49')]);}else if(_0x35eaf4[_0x25c356][_0x80db('0x49')]&&_0x35eaf4[_0x25c356][_0x80db('0x4a')]&&moment()[_0x80db('0x4b')](_0x35eaf4[_0x25c356][_0x80db('0x4c')],_0x35eaf4[_0x25c356][_0x80db('0x4d')])){manager['add'](_0x25c356,_0x35eaf4[_0x25c356][_0x80db('0x49')],handleJob(_0x35eaf4[_0x25c356]));manager[_0x80db('0x4e')](_0x25c356);logger[_0x80db('0x25')](_0x80db('0x4f'),_0x35eaf4[_0x25c356]['name'],_0x35eaf4[_0x25c356]['cron']);}else if(manager['exists'](_0x25c356)){manager[_0x80db('0x50')](_0x25c356);manager[_0x80db('0x42')](_0x25c356);logger[_0x80db('0x25')](_0x80db('0x51'),_0x35eaf4[_0x25c356][_0x80db('0x10')],_0x35eaf4[_0x25c356][_0x80db('0x49')]);}}for(_0x3aa629=0x0,_0x25c356;_0x3aa629<_0x46326f['length']&&!_0x227526;_0x3aa629+=0x1){_0x25c356=_0x46326f[_0x3aa629]['toString']();if(manager[_0x80db('0x52')](_0x25c356)){if(_0x35eaf4[_0x25c356][_0x80db('0x49')]&&_0x35eaf4[_0x25c356]['active']&&moment()[_0x80db('0x4b')](_0x35eaf4[_0x25c356][_0x80db('0x4c')],_0x35eaf4[_0x25c356][_0x80db('0x4d')])){manager[_0x80db('0x53')](_0x25c356,_0x35eaf4[_0x25c356][_0x80db('0x49')],handleJob(_0x35eaf4[_0x25c356]));logger[_0x80db('0x25')]('update\x20cron',_0x35eaf4[_0x25c356][_0x80db('0x10')],_0x35eaf4[_0x25c356]['cron']);}else{manager[_0x80db('0x50')](_0x25c356);manager[_0x80db('0x42')](_0x25c356);logger[_0x80db('0x25')](_0x80db('0x51'),_0x35eaf4[_0x25c356][_0x80db('0x10')],_0x35eaf4[_0x25c356][_0x80db('0x49')]);}}}})[_0x80db('0x2b')](function(_0xb1fbab){logger[_0x80db('0x29')](JSON[_0x80db('0x20')](_0xb1fbab));});}exports[_0x80db('0x54')]=function(_0x252551){return getJobs(_0x252551);};exports[_0x80db('0x4e')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 3d8b2f9..4763bb8 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 _0x69af=['Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Mixed','COMPLETED','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','push','all','SequelizeValidationError','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','sentimentRegion','Positive','Negative','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','bucket'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x69af,0x17b));var _0xf69a=function(_0x2078d7,_0x55fee7){_0x2078d7=_0x2078d7-0x0;var _0x5a3815=_0x69af[_0x2078d7];return _0x5a3815;};var _=require('lodash');var AWS=require(_0xf69a('0x0'));var rp=require(_0xf69a('0x1'));var util=require(_0xf69a('0x2'));var BPromise=require(_0xf69a('0x3'));var db=require(_0xf69a('0x4'))['db'];var logger=require(_0xf69a('0x5'))('transcribe');function getTranscriptionJob(_0x1c543b,_0x10a24a,_0x297ae0,_0x2820d8){return new Promise(function(_0x723700,_0x5953c9){var _0x10c1b0=new AWS[(_0xf69a('0x6'))]({'accessKeyId':_0x10a24a,'secretAccessKey':_0x1c543b,'region':_0x297ae0});_0x10c1b0[_0xf69a('0x7')]({'TranscriptionJobName':_0x2820d8},function(_0x4ffe11,_0x4a3496){if(_0x4ffe11){return _0x5953c9(_0x4ffe11);}else{return _0x723700(_0x4a3496);}});});}function sentiment(_0x1f7f03,_0x185abe,_0x16a06e,_0x302b3a,_0x3c80f9){return new Promise(function(_0x4f9aeb,_0x518070){var _0x48bb54=new AWS[(_0xf69a('0x8'))]({'accessKeyId':_0x185abe,'secretAccessKey':_0x1f7f03,'region':_0x16a06e});_0x48bb54[_0xf69a('0x9')]({'Text':_0x302b3a,'LanguageCode':_0x3c80f9[_0xf69a('0xa')](0x0,0x2)},function(_0x2500ff,_0x4b2cda){if(_0x2500ff){return _0x518070(_0x2500ff);}else{return _0x4f9aeb(_0x4b2cda);}});});}function checkTranscribeJob(_0x44bc6d,_0x2f9dd7,_0x331bd4){var _0x1b053f;return new BPromise(function(_0x3930a2,_0x138d7f){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0xd'),_0x44bc6d['id'],_0x44bc6d[_0xf69a('0xe')]));return getTranscriptionJob(_0x331bd4['data1'],_0x331bd4[_0xf69a('0xf')],_0x2f9dd7[_0xf69a('0x10')],_0x44bc6d[_0xf69a('0xe')])[_0xf69a('0x11')](function(_0x510555){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x12'),_0x44bc6d['id'],_0x44bc6d[_0xf69a('0xe')],_0x510555[_0xf69a('0x13')][_0xf69a('0x14')]));if(!_0x44bc6d[_0xf69a('0x15')]){switch(_0x510555['TranscriptionJob']['TranscriptionJobStatus']){case'COMPLETED':var _0x32f29c={'transcribeStatus':_0x510555['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x510555['TranscriptionJob'][_0xf69a('0x16')][_0xf69a('0x17')]};logger[_0xf69a('0xb')](util[_0xf69a('0xc')]('[RECORDING:%d]\x20Get\x20transcript',_0x44bc6d['id']));return rp({'uri':_0x510555['TranscriptionJob'][_0xf69a('0x16')][_0xf69a('0x17')],'json':!![]})[_0xf69a('0x11')](function(_0x752c26){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x18'),_0x44bc6d['id']));if(_0x752c26&&_0x752c26[_0xf69a('0x19')]&&_0x752c26['results'][_0xf69a('0x1a')]&&_0x752c26[_0xf69a('0x19')][_0xf69a('0x1a')][_0xf69a('0x1b')]){_0x32f29c[_0xf69a('0x15')]='';for(var _0x451c92=0x0;_0x451c92<_0x752c26[_0xf69a('0x19')][_0xf69a('0x1a')]['length'];_0x451c92++){_0x32f29c[_0xf69a('0x15')]+=_0x752c26['results'][_0xf69a('0x1a')][_0x451c92][_0xf69a('0x1c')]+'';}}return _0x44bc6d[_0xf69a('0x1d')](_0x32f29c);})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x1e'),_0x44bc6d['id']));if(!_0x44bc6d[_0xf69a('0x1f')]){throw new db[(_0xf69a('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2f9dd7[_0xf69a('0x21')]||!_0x2f9dd7['sentimentAccountId']||!_0x2f9dd7['sentimentRegion']||!_0x2f9dd7[_0xf69a('0x22')]||!_0x2f9dd7['bucket']){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x24'));}if(!_0x32f29c[_0xf69a('0x15')]){throw new Error(_0xf69a('0x25'));}if(_0x2f9dd7[_0xf69a('0x26')]===_0x331bd4['id']){return _0x331bd4;}else{return db[_0xf69a('0x27')][_0xf69a('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xf69a('0x11')](function(_0x46c804){if(!_0x46c804){throw new db['Sequelize'][(_0xf69a('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x46c804['data1']||!_0x46c804['data2']){throw new db[(_0xf69a('0x20'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1b053f=_0x46c804;logger['info'](util['format'](_0xf69a('0x29'),_0x44bc6d['id']));return sentiment(_0x1b053f[_0xf69a('0x2a')],_0x1b053f['data2'],_0x2f9dd7[_0xf69a('0x2b')],_0x32f29c[_0xf69a('0x15')],_0x2f9dd7[_0xf69a('0x22')]);})[_0xf69a('0x11')](function(_0x4bd8bd){logger[_0xf69a('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x44bc6d['id']));return _0x44bc6d[_0xf69a('0x1d')]({'sentiment':_0x4bd8bd['Sentiment'],'sPositive':_0x4bd8bd['SentimentScore'][_0xf69a('0x2c')],'sNegative':_0x4bd8bd['SentimentScore'][_0xf69a('0x2d')],'sMixed':_0x4bd8bd[_0xf69a('0x2e')]['Mixed'],'sNeutral':_0x4bd8bd['SentimentScore'][_0xf69a('0x2f')]});})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util['format'](_0xf69a('0x1e'),_0x44bc6d['id']));_0x3930a2();});case _0xf69a('0x30'):return _0x44bc6d[_0xf69a('0x1d')]({'transcribeStatus':_0xf69a('0x30'),'failureReason':_0x510555[_0xf69a('0x13')][_0xf69a('0x31')]})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')](_0xf69a('0x1e'),_0x44bc6d['id']));_0x3930a2();});default:logger[_0xf69a('0xb')](util['format'](_0xf69a('0x32'),_0x44bc6d['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x44bc6d[_0xf69a('0x1f')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x33'));}if(!_0x2f9dd7[_0xf69a('0x21')]||!_0x2f9dd7['sentimentAccountId']||!_0x2f9dd7[_0xf69a('0x2b')]||!_0x2f9dd7[_0xf69a('0x22')]||!_0x2f9dd7[_0xf69a('0x34')]){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x24'));}if(!_0x44bc6d['fileText']){throw new Error(_0xf69a('0x25'));}if(_0x2f9dd7['sentimentAccountId']===_0x331bd4['id']){return _0x331bd4;}else{return db[_0xf69a('0x27')][_0xf69a('0x28')]({'where':{'id':_settings[_0xf69a('0x26')]}});}})['then'](function(_0x470f04){if(!_0x470f04){throw new db[(_0xf69a('0x20'))]['ValidationError'](_0xf69a('0x35'));}if(!_0x470f04[_0xf69a('0x2a')]||!_0x470f04[_0xf69a('0xf')]){throw new db[(_0xf69a('0x20'))]['ValidationError'](_0xf69a('0x36'));}_0x1b053f=_0x470f04;logger[_0xf69a('0xb')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x44bc6d['id']));return sentiment(_0x1b053f[_0xf69a('0x2a')],_0x1b053f[_0xf69a('0xf')],_0x2f9dd7[_0xf69a('0x2b')],_0x44bc6d['fileText'],_0x2f9dd7[_0xf69a('0x22')]);})['then'](function(_0x1fa9d5){logger[_0xf69a('0xb')](util['format'](_0xf69a('0x37'),_0x44bc6d['id']));return _0x44bc6d[_0xf69a('0x1d')]({'sentiment':_0x1fa9d5[_0xf69a('0x38')],'sPositive':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x2c')],'sNegative':_0x1fa9d5['SentimentScore'][_0xf69a('0x2d')],'sMixed':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x39')],'sNeutral':_0x1fa9d5[_0xf69a('0x2e')][_0xf69a('0x2f')],'transcribeStatus':_0xf69a('0x3a')});})[_0xf69a('0x11')](function(){logger[_0xf69a('0xb')](util[_0xf69a('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x44bc6d['id']));_0x3930a2();});}})['catch'](function(_0x41b4b9){if(_0x41b4b9){if(!_0x41b4b9['name']||_0x41b4b9[_0xf69a('0x3b')]!=='SequelizeValidationError'){logger[_0xf69a('0x3c')](util[_0xf69a('0xc')](_0xf69a('0x3d'),_0x44bc6d['id']),util[_0xf69a('0x3e')](_0x41b4b9,{'showHidden':![],'depth':null}));}}_0x3930a2();});});}function checkTranscribe(){var _0x3c00af;var _0x1bf067;var _0x927d70;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xf69a('0x3f')}})[_0xf69a('0x11')](function(_0x4a4795){if(!_0x4a4795||!_0x4a4795[_0xf69a('0x1b')]){throw new db['Sequelize'][(_0xf69a('0x23'))](_0xf69a('0x40'));}_0x3c00af=_0x4a4795;return db[_0xf69a('0x41')][_0xf69a('0x28')]({'where':{'id':0x1}});})[_0xf69a('0x11')](function(_0x14d64c){if(!_0x14d64c){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x42'));}_0x1bf067=_0x14d64c;if(!_0x1bf067['transcribe']||!_0x1bf067[_0xf69a('0x43')]||!_0x1bf067[_0xf69a('0x10')]||!_0x1bf067['language']||!_0x1bf067[_0xf69a('0x34')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))]('Transcribe\x20not\x20configured');}return db[_0xf69a('0x27')]['findOne']({'where':{'id':_0x1bf067[_0xf69a('0x43')]}});})[_0xf69a('0x11')](function(_0x5a5e7d){if(!_0x5a5e7d){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))](_0xf69a('0x35'));}if(!_0x5a5e7d[_0xf69a('0x2a')]||!_0x5a5e7d[_0xf69a('0xf')]){throw new db[(_0xf69a('0x20'))][(_0xf69a('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x927d70=_0x5a5e7d;var _0x278aec=[];_0x3c00af['forEach'](function(_0x1a42f6){_0x278aec[_0xf69a('0x44')](checkTranscribeJob(_0x1a42f6,_0x1bf067,_0x927d70));});return BPromise[_0xf69a('0x45')](_0x278aec);})['catch'](function(_0x906e2a){if(_0x906e2a){if(!_0x906e2a[_0xf69a('0x3b')]||_0x906e2a[_0xf69a('0x3b')]!==_0xf69a('0x46')){logger[_0xf69a('0x3c')](util[_0xf69a('0x3e')](_0x906e2a,{'showHidden':![],'depth':null}));}}});}exports[_0xf69a('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf603=['data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','catch','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1'];(function(_0x349648,_0x10c086){var _0x3a053f=function(_0x2dd8dd){while(--_0x2dd8dd){_0x349648['push'](_0x349648['shift']());}};_0x3a053f(++_0x10c086);}(_0xf603,0xeb));var _0x3f60=function(_0xcfcd09,_0x574211){_0xcfcd09=_0xcfcd09-0x0;var _0x37c093=_0xf603[_0xcfcd09];return _0x37c093;};var _=require(_0x3f60('0x0'));var AWS=require(_0x3f60('0x1'));var rp=require(_0x3f60('0x2'));var util=require('util');var BPromise=require(_0x3f60('0x3'));var db=require(_0x3f60('0x4'))['db'];var logger=require(_0x3f60('0x5'))(_0x3f60('0x6'));function getTranscriptionJob(_0x24aafb,_0x553e8b,_0x1b914a,_0x5559e4){return new Promise(function(_0x5914cd,_0x2910c7){var _0x1ec43c=new AWS[(_0x3f60('0x7'))]({'accessKeyId':_0x553e8b,'secretAccessKey':_0x24aafb,'region':_0x1b914a});_0x1ec43c[_0x3f60('0x8')]({'TranscriptionJobName':_0x5559e4},function(_0x434249,_0x9282dd){if(_0x434249){return _0x2910c7(_0x434249);}else{return _0x5914cd(_0x9282dd);}});});}function sentiment(_0x59b737,_0x326a7f,_0x33dcc8,_0x1fee5e,_0x3d4fa7){return new Promise(function(_0x526389,_0x54f45d){var _0x10373f=new AWS[(_0x3f60('0x9'))]({'accessKeyId':_0x326a7f,'secretAccessKey':_0x59b737,'region':_0x33dcc8});_0x10373f[_0x3f60('0xa')]({'Text':_0x1fee5e,'LanguageCode':_0x3d4fa7['substring'](0x0,0x2)},function(_0x177b6f,_0x98a478){if(_0x177b6f){return _0x54f45d(_0x177b6f);}else{return _0x526389(_0x98a478);}});});}function checkTranscribeJob(_0xad12ff,_0x4aef12,_0x50f2ef){var _0x1e52e3;return new BPromise(function(_0x77961f,_0x255708){logger[_0x3f60('0xb')](util[_0x3f60('0xc')](_0x3f60('0xd'),_0xad12ff['id'],_0xad12ff[_0x3f60('0xe')]));return getTranscriptionJob(_0x50f2ef['data1'],_0x50f2ef['data2'],_0x4aef12['transcribeRegion'],_0xad12ff[_0x3f60('0xe')])[_0x3f60('0xf')](function(_0x3d79b7){logger[_0x3f60('0xb')](util[_0x3f60('0xc')](_0x3f60('0x10'),_0xad12ff['id'],_0xad12ff[_0x3f60('0xe')],_0x3d79b7[_0x3f60('0x11')][_0x3f60('0x12')]));if(!_0xad12ff['fileText']){switch(_0x3d79b7[_0x3f60('0x11')][_0x3f60('0x12')]){case _0x3f60('0x13'):var _0xb7731f={'transcribeStatus':_0x3d79b7['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x3d79b7[_0x3f60('0x11')][_0x3f60('0x14')][_0x3f60('0x15')]};logger[_0x3f60('0xb')](util['format'](_0x3f60('0x16'),_0xad12ff['id']));return rp({'uri':_0x3d79b7[_0x3f60('0x11')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x3f60('0xf')](function(_0x8d2dc9){logger[_0x3f60('0xb')](util[_0x3f60('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0xad12ff['id']));if(_0x8d2dc9&&_0x8d2dc9[_0x3f60('0x17')]&&_0x8d2dc9[_0x3f60('0x17')][_0x3f60('0x18')]&&_0x8d2dc9[_0x3f60('0x17')][_0x3f60('0x18')][_0x3f60('0x19')]){_0xb7731f[_0x3f60('0x1a')]='';for(var _0x42beb9=0x0;_0x42beb9<_0x8d2dc9[_0x3f60('0x17')][_0x3f60('0x18')]['length'];_0x42beb9++){_0xb7731f[_0x3f60('0x1a')]+=_0x8d2dc9[_0x3f60('0x17')][_0x3f60('0x18')][_0x42beb9][_0x3f60('0x1b')]+'';}}return _0xad12ff[_0x3f60('0x1c')](_0xb7731f);})[_0x3f60('0xf')](function(){logger['info'](util[_0x3f60('0xc')](_0x3f60('0x1d'),_0xad12ff['id']));if(!_0xad12ff[_0x3f60('0x1e')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4aef12['sentiment']||!_0x4aef12[_0x3f60('0x1f')]||!_0x4aef12[_0x3f60('0x20')]||!_0x4aef12[_0x3f60('0x21')]||!_0x4aef12[_0x3f60('0x22')]){throw new db[(_0x3f60('0x23'))][(_0x3f60('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xb7731f[_0x3f60('0x1a')]){throw new Error('Transcript\x20not\x20available');}if(_0x4aef12[_0x3f60('0x1f')]===_0x50f2ef['id']){return _0x50f2ef;}else{return db[_0x3f60('0x25')][_0x3f60('0x26')]({'where':{'id':_settings[_0x3f60('0x1f')]}});}})['then'](function(_0xc0198b){if(!_0xc0198b){throw new db['Sequelize'][(_0x3f60('0x24'))](_0x3f60('0x27'));}if(!_0xc0198b[_0x3f60('0x28')]||!_0xc0198b[_0x3f60('0x29')]){throw new db['Sequelize']['ValidationError'](_0x3f60('0x2a'));}_0x1e52e3=_0xc0198b;logger[_0x3f60('0xb')](util[_0x3f60('0xc')](_0x3f60('0x2b'),_0xad12ff['id']));return sentiment(_0x1e52e3[_0x3f60('0x28')],_0x1e52e3[_0x3f60('0x29')],_0x4aef12[_0x3f60('0x20')],_0xb7731f['fileText'],_0x4aef12[_0x3f60('0x21')]);})['then'](function(_0x7577f1){logger['info'](util['format'](_0x3f60('0x2c'),_0xad12ff['id']));return _0xad12ff['update']({'sentiment':_0x7577f1[_0x3f60('0x2d')],'sPositive':_0x7577f1[_0x3f60('0x2e')][_0x3f60('0x2f')],'sNegative':_0x7577f1[_0x3f60('0x2e')][_0x3f60('0x30')],'sMixed':_0x7577f1[_0x3f60('0x2e')]['Mixed'],'sNeutral':_0x7577f1[_0x3f60('0x2e')][_0x3f60('0x31')]});})[_0x3f60('0xf')](function(){logger['info'](util[_0x3f60('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xad12ff['id']));_0x77961f();});case _0x3f60('0x32'):return _0xad12ff[_0x3f60('0x1c')]({'transcribeStatus':_0x3f60('0x32'),'failureReason':_0x3d79b7[_0x3f60('0x11')][_0x3f60('0x33')]})[_0x3f60('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xad12ff['id']));_0x77961f();});default:logger[_0x3f60('0xb')](util[_0x3f60('0xc')](_0x3f60('0x34'),_0xad12ff['id']));break;}}else{return BPromise[_0x3f60('0x35')]()[_0x3f60('0xf')](function(){if(!_0xad12ff[_0x3f60('0x1e')]){throw new db[(_0x3f60('0x23'))]['ValidationError'](_0x3f60('0x36'));}if(!_0x4aef12['sentiment']||!_0x4aef12[_0x3f60('0x1f')]||!_0x4aef12['sentimentRegion']||!_0x4aef12['language']||!_0x4aef12[_0x3f60('0x22')]){throw new db[(_0x3f60('0x23'))][(_0x3f60('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0xad12ff[_0x3f60('0x1a')]){throw new Error(_0x3f60('0x37'));}if(_0x4aef12[_0x3f60('0x1f')]===_0x50f2ef['id']){return _0x50f2ef;}else{return db[_0x3f60('0x25')][_0x3f60('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3f60('0xf')](function(_0x3555b2){if(!_0x3555b2){throw new db[(_0x3f60('0x23'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3555b2[_0x3f60('0x28')]||!_0x3555b2['data2']){throw new db['Sequelize'][(_0x3f60('0x24'))](_0x3f60('0x2a'));}_0x1e52e3=_0x3555b2;logger['info'](util[_0x3f60('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xad12ff['id']));return sentiment(_0x1e52e3['data1'],_0x1e52e3[_0x3f60('0x29')],_0x4aef12[_0x3f60('0x20')],_0xad12ff[_0x3f60('0x1a')],_0x4aef12[_0x3f60('0x21')]);})['then'](function(_0x56659c){logger[_0x3f60('0xb')](util[_0x3f60('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xad12ff['id']));return _0xad12ff['update']({'sentiment':_0x56659c[_0x3f60('0x2d')],'sPositive':_0x56659c[_0x3f60('0x2e')][_0x3f60('0x2f')],'sNegative':_0x56659c['SentimentScore']['Negative'],'sMixed':_0x56659c['SentimentScore']['Mixed'],'sNeutral':_0x56659c[_0x3f60('0x2e')][_0x3f60('0x31')],'transcribeStatus':_0x3f60('0x13')});})['then'](function(){logger[_0x3f60('0xb')](util[_0x3f60('0xc')](_0x3f60('0x1d'),_0xad12ff['id']));_0x77961f();});}})['catch'](function(_0x363ef3){if(_0x363ef3){if(!_0x363ef3['name']||_0x363ef3[_0x3f60('0x38')]!==_0x3f60('0x39')){logger[_0x3f60('0x3a')](util[_0x3f60('0xc')](_0x3f60('0x3b'),_0xad12ff['id']),util[_0x3f60('0x3c')](_0x363ef3,{'showHidden':![],'depth':null}));}}_0x77961f();});});}function checkTranscribe(){var _0x12fde7;var _0x38bb04;var _0x42bae0;return db['VoiceRecording'][_0x3f60('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x3f60('0xf')](function(_0x1d5e5f){if(!_0x1d5e5f||!_0x1d5e5f[_0x3f60('0x19')]){throw new db[(_0x3f60('0x23'))][(_0x3f60('0x24'))](_0x3f60('0x3e'));}_0x12fde7=_0x1d5e5f;return db['Setting'][_0x3f60('0x26')]({'where':{'id':0x1}});})['then'](function(_0x125431){if(!_0x125431){throw new db[(_0x3f60('0x23'))]['ValidationError'](_0x3f60('0x3f'));}_0x38bb04=_0x125431;if(!_0x38bb04['transcribe']||!_0x38bb04['transcribeAccountId']||!_0x38bb04[_0x3f60('0x40')]||!_0x38bb04[_0x3f60('0x21')]||!_0x38bb04[_0x3f60('0x22')]){throw new db['Sequelize'][(_0x3f60('0x24'))](_0x3f60('0x41'));}return db[_0x3f60('0x25')][_0x3f60('0x26')]({'where':{'id':_0x38bb04[_0x3f60('0x42')]}});})[_0x3f60('0xf')](function(_0xc558fc){if(!_0xc558fc){throw new db[(_0x3f60('0x23'))]['ValidationError'](_0x3f60('0x27'));}if(!_0xc558fc[_0x3f60('0x28')]||!_0xc558fc[_0x3f60('0x29')]){throw new db['Sequelize'][(_0x3f60('0x24'))]('Cloud\x20Provider\x20not\x20configured');}_0x42bae0=_0xc558fc;var _0x5a94a4=[];_0x12fde7['forEach'](function(_0x3e6728){_0x5a94a4['push'](checkTranscribeJob(_0x3e6728,_0x38bb04,_0x42bae0));});return BPromise['all'](_0x5a94a4);})[_0x3f60('0x43')](function(_0x139a5f){if(_0x139a5f){if(!_0x139a5f['name']||_0x139a5f[_0x3f60('0x38')]!==_0x3f60('0x39')){logger[_0x3f60('0x3a')](util['inspect'](_0x139a5f,{'showHidden':![],'depth':null}));}}});}exports[_0x3f60('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index b8572c1..02e05f8 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 _0xde1a=['localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','join','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis'];(function(_0x64ba51,_0x288dcc){var _0x248a46=function(_0x34a11d){while(--_0x34a11d){_0x64ba51['push'](_0x64ba51['shift']());}};_0x248a46(++_0x288dcc);}(_0xde1a,0xfd));var _0xade1=function(_0x57447d,_0xac84a6){_0x57447d=_0x57447d-0x0;var _0x4f887e=_0xde1a[_0x57447d];return _0x4f887e;};'use strict';var _=require('lodash');var moment=require(_0xade1('0x0'));var Redis=require(_0xade1('0x1'));var util=require(_0xade1('0x2'));var config=require(_0xade1('0x3'));var db=require(_0xade1('0x4'))['db'];var logger=require(_0xade1('0x5'))(_0xade1('0x6'));config[_0xade1('0x7')]=_['defaults'](config[_0xade1('0x7')],{'host':_0xade1('0x8'),'port':0x18eb});var io=require(_0xade1('0x9'))(new Redis(config[_0xade1('0x7')]));function closeInteractions(){var _0x3be6d5=[];return db[_0xade1('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xade1('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xade1('0xc')](0x18,_0xade1('0xd'))}}})[_0xade1('0xe')](function(_0x120f47){if(_0x120f47&&_0x120f47[_0xade1('0xf')]){_0x3be6d5=_[_0xade1('0x10')](_0x120f47||[],'id');logger[_0xade1('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3be6d5[_0xade1('0x12')]());return db[_0xade1('0xa')]['update']({'closeReason':_0xade1('0x13'),'disposition':_0xade1('0x14'),'closed':!![],'closedAt':moment()[_0xade1('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3be6d5}});}})[_0xade1('0xe')](function(){if(_0x3be6d5&&_0x3be6d5[_0xade1('0xf')]){logger[_0xade1('0x11')](_0xade1('0x16'),_0x3be6d5[_0xade1('0x12')]());for(var _0x1630da=0x0;_0x1630da<_0x3be6d5['length'];_0x1630da++){io[_0xade1('0x17')](_0xade1('0x18'),{'id':_0x3be6d5[_0x1630da],'closed':!![]});}}})[_0xade1('0x19')](function(_0x10773d){logger[_0xade1('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x10773d?util[_0xade1('0x1b')](_0x10773d,{'showHidden':![],'depth':null}):'');});}exports[_0xade1('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb96d=['update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','length','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','then','map','info','join'];(function(_0x3c88b0,_0x16f111){var _0x43d374=function(_0x2e832d){while(--_0x2e832d){_0x3c88b0['push'](_0x3c88b0['shift']());}};_0x43d374(++_0x16f111);}(_0xb96d,0x9e));var _0xdb96=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0xb96d[_0x54b062];return _0x255e41;};'use strict';var _=require('lodash');var moment=require(_0xdb96('0x0'));var Redis=require(_0xdb96('0x1'));var util=require(_0xdb96('0x2'));var config=require('../../config/environment');var db=require(_0xdb96('0x3'))['db'];var logger=require(_0xdb96('0x4'))(_0xdb96('0x5'));config['redis']=_['defaults'](config[_0xdb96('0x6')],{'host':_0xdb96('0x7'),'port':0x18eb});var io=require(_0xdb96('0x8'))(new Redis(config[_0xdb96('0x6')]));function closeInteractions(){var _0x4f5e6f=[];return db[_0xdb96('0x9')][_0xdb96('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdb96('0xb')](0x18,'hours')}}})[_0xdb96('0xc')](function(_0xaea492){if(_0xaea492&&_0xaea492['length']){_0x4f5e6f=_[_0xdb96('0xd')](_0xaea492||[],'id');logger[_0xdb96('0xe')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4f5e6f[_0xdb96('0xf')]());return db[_0xdb96('0x9')][_0xdb96('0x10')]({'closeReason':_0xdb96('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xdb96('0x12')](_0xdb96('0x13'))},{'where':{'id':_0x4f5e6f}});}})[_0xdb96('0xc')](function(){if(_0x4f5e6f&&_0x4f5e6f['length']){logger[_0xdb96('0xe')](_0xdb96('0x14'),_0x4f5e6f[_0xdb96('0xf')]());for(var _0x18a8c0=0x0;_0x18a8c0<_0x4f5e6f[_0xdb96('0x15')];_0x18a8c0++){io[_0xdb96('0x16')](_0xdb96('0x17'),{'id':_0x4f5e6f[_0x18a8c0],'closed':!![]});}}})[_0xdb96('0x18')](function(_0x12630d){logger[_0xdb96('0x19')](_0xdb96('0x1a'),_0x12630d?util[_0xdb96('0x1b')](_0x12630d,{'showHidden':![],'depth':null}):'');});}exports[_0xdb96('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5fdad2a..f02169f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbf0=['finished\x20populating','contacts1','CmHopper','destroy','bulkCreate','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','log'];(function(_0x39aa1e,_0x46a550){var _0x37a0c4=function(_0x454165){while(--_0x454165){_0x39aa1e['push'](_0x39aa1e['shift']());}};_0x37a0c4(++_0x46a550);}(_0xfbf0,0x1af));var _0x0fbf=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xfbf0[_0x160c73];return _0xd9302;};'use strict';var util=require(_0x0fbf('0x0'));var db=require(_0x0fbf('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0fbf('0x2')+i,'lastName':_0x0fbf('0x3')+i,'phone':0xf879fb460+i,'email':_0x0fbf('0x4')+i+_0x0fbf('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0fbf('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0fbf('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0fbf('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0fbf('0x6')]({'id':i,'firstName':_0x0fbf('0x2')+i,'lastName':_0x0fbf('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0fbf('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0fbf('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0fbf('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0fbf('0x7')](),'updatedAt':Date['now']()});}db[_0x0fbf('0x8')]['destroy']({'where':{}})[_0x0fbf('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x0fbf('0x9')](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),_0x0fbf('0xc'));return db[_0x0fbf('0xd')][_0x0fbf('0xe')]({'where':{}});})[_0x0fbf('0x9')](function(){return db[_0x0fbf('0xd')][_0x0fbf('0xf')](hopper);})[_0x0fbf('0x9')](function(){console['log'](_0x0fbf('0xb'),'hopper1');return db[_0x0fbf('0x8')][_0x0fbf('0xf')](contacts2);})[_0x0fbf('0x9')](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),'contacts2');return db['CmHopper'][_0x0fbf('0xf')](hopper2);})['then'](function(){console[_0x0fbf('0xa')](_0x0fbf('0xb'),'hopper2');})[_0x0fbf('0x10')](function(_0x1b197b){console[_0x0fbf('0xa')](_0x1b197b);}); \ No newline at end of file +var _0x0a30=['hopper1','contacts2','hopper2','Innocenzo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','finished\x20populating','CmHopper','log'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x0a30,0x16f));var _0x00a3=function(_0x3c1de9,_0x2aa6ba){_0x3c1de9=_0x3c1de9-0x0;var _0x3ea4dd=_0x0a30[_0x3c1de9];return _0x3ea4dd;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x00a3('0x0')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x00a3('0x1')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x00a3('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x00a3('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x00a3('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x00a3('0x2')]({'id':i,'firstName':_0x00a3('0x0')+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[_0x00a3('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x00a3('0x3')]()});}db[_0x00a3('0x4')][_0x00a3('0x5')]({'where':{}})[_0x00a3('0x6')](function(){return db[_0x00a3('0x4')][_0x00a3('0x7')](contacts);})[_0x00a3('0x6')](function(){console['log'](_0x00a3('0x8'),'contacts1');return db[_0x00a3('0x9')][_0x00a3('0x5')]({'where':{}});})[_0x00a3('0x6')](function(){return db[_0x00a3('0x9')]['bulkCreate'](hopper);})['then'](function(){console[_0x00a3('0xa')](_0x00a3('0x8'),_0x00a3('0xb'));return db[_0x00a3('0x4')]['bulkCreate'](contacts2);})[_0x00a3('0x6')](function(){console[_0x00a3('0xa')](_0x00a3('0x8'),_0x00a3('0xc'));return db['CmHopper'][_0x00a3('0x7')](hopper2);})[_0x00a3('0x6')](function(){console[_0x00a3('0xa')](_0x00a3('0x8'),_0x00a3('0xd'));})['catch'](function(_0x4d5306){console[_0x00a3('0xa')](_0x4d5306);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b4eb825..0bcca2f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bc8=['udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password'];(function(_0x4ef583,_0x47bb47){var _0x27f3a2=function(_0x132133){while(--_0x132133){_0x4ef583['push'](_0x4ef583['shift']());}};_0x27f3a2(++_0x47bb47);}(_0x9bc8,0x1b0));var _0x89bc=function(_0xbc8bbb,_0x45ee2f){_0xbc8bbb=_0xbc8bbb-0x0;var _0x2fbd5c=_0x9bc8[_0xbc8bbb];return _0x2fbd5c;};'use strict';var util=require(_0x89bc('0x0'));var db=require(_0x89bc('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x89bc('0x2')]({'name':util[_0x89bc('0x3')]('%s%s',_0x89bc('0x4'),i),'fullname':util['format'](_0x89bc('0x5'),_0x89bc('0x4'),i),'email':util[_0x89bc('0x3')](_0x89bc('0x6'),'agent',i),'role':_0x89bc('0x4'),'password':_0x89bc('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x89bc('0x8'),'ws','wss'],'disallow':[_0x89bc('0x9')],'allow':[_0x89bc('0xa')],'defaultuser':util[_0x89bc('0x3')]('%s%s',_0x89bc('0x4'),i),'encryption':_0x89bc('0xb'),'avpf':_0x89bc('0xb'),'force_avp':_0x89bc('0xb'),'icesupport':_0x89bc('0xb'),'dtlsenable':_0x89bc('0xb'),'dtlsverify':'no','dtlscertfile':_0x89bc('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x89bc('0xd'),'callerid':util[_0x89bc('0x3')](_0x89bc('0xe'),util[_0x89bc('0x3')](_0x89bc('0x5'),_0x89bc('0x4'),i),0xfa0+i)});}db[_0x89bc('0xf')]['bulkCreate'](users)[_0x89bc('0x10')](function(){console[_0x89bc('0x11')](_0x89bc('0x12'));})[_0x89bc('0x13')](function(_0x3d0a7e){console['log'](_0x3d0a7e);}); \ No newline at end of file +var _0x2524=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','catch','log','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','ulaw'];(function(_0x173fdf,_0x1ba573){var _0x147b6d=function(_0x5dc021){while(--_0x5dc021){_0x173fdf['push'](_0x173fdf['shift']());}};_0x147b6d(++_0x1ba573);}(_0x2524,0x14c));var _0x4252=function(_0x1dd439,_0x1ebb0d){_0x1dd439=_0x1dd439-0x0;var _0x2d3c52=_0x2524[_0x1dd439];return _0x2d3c52;};'use strict';var util=require(_0x4252('0x0'));var db=require(_0x4252('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x4252('0x2')](_0x4252('0x3'),_0x4252('0x4'),i),'fullname':util[_0x4252('0x2')](_0x4252('0x3'),_0x4252('0x4'),i),'email':util['format'](_0x4252('0x5'),_0x4252('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x4252('0x6'),'transport':[_0x4252('0x7'),'ws',_0x4252('0x8')],'disallow':['all'],'allow':[_0x4252('0x9')],'defaultuser':util[_0x4252('0x2')](_0x4252('0x3'),_0x4252('0x4'),i),'encryption':_0x4252('0xa'),'avpf':_0x4252('0xa'),'force_avp':_0x4252('0xa'),'icesupport':'yes','dtlsenable':_0x4252('0xa'),'dtlsverify':'no','dtlscertfile':_0x4252('0xb'),'dtlsprivatekey':_0x4252('0xc'),'dtlssetup':_0x4252('0xd'),'callerid':util['format'](_0x4252('0xe'),util[_0x4252('0x2')](_0x4252('0x3'),_0x4252('0x4'),i),0xfa0+i)});}db[_0x4252('0xf')][_0x4252('0x10')](users)['then'](function(){console['log']('add\x20user');})[_0x4252('0x11')](function(_0x437df9){console[_0x4252('0x12')](_0x437df9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index da11990..47a1e6f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e24=['MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueues','FaxQueues','SmsQueue','WhatsappQueue','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','length','voice','fax','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','role','agent','name','telephone','type','ivr','findOne','then','autoAssociation','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','%s:queue:%s','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions'];(function(_0x23d213,_0x4cfdf1){var _0x5962fd=function(_0x15a0f0){while(--_0x15a0f0){_0x23d213['push'](_0x23d213['shift']());}};_0x5962fd(++_0x4cfdf1);}(_0x3e24,0x167));var _0x43e2=function(_0x50a171,_0x46a5a7){_0x50a171=_0x50a171-0x0;var _0x51999c=_0x3e24[_0x50a171];return _0x51999c;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var BPromise=require(_0x43e2('0x2'));var db=require(_0x43e2('0x3'))['db'];var config=require(_0x43e2('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x43e2('0x5'),'model':db[_0x43e2('0x6')],'attributes':['id','name',_0x43e2('0x7')],'raw':!![],'where':{'role':_0x43e2('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x43e2('0x9')],'where':{'role':_0x43e2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x43e2('0x9')]};var queryAgents={'raw':!![],'attributes':['id',_0x43e2('0x9')],'where':{'role':_0x43e2('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x43e2('0xb')],'where':{'type':_0x43e2('0xc')}};function getAssociatedResources(_0x4bd2ce,_0x1c96f9,_0x2fdf85){return db['UserProfileSection'][_0x43e2('0xd')]({'where':{'name':_0x4bd2ce,'userProfileId':_0x1c96f9},'raw':!![]})[_0x43e2('0xe')](function(_0x52146c){if(_0x52146c){if(_0x52146c[_0x43e2('0xf')]){switch(_0x4bd2ce){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case _0x43e2('0x10'):case _0x43e2('0x11'):case _0x43e2('0x12'):case _0x43e2('0x13'):return db[_0x2fdf85][_0x43e2('0x14')](queryQueues);case _0x43e2('0x15'):return db[_0x2fdf85][_0x43e2('0x14')](queryTelephones);case _0x43e2('0x16'):return db[_0x2fdf85][_0x43e2('0x14')](queryTrunks);case _0x43e2('0x17'):return db[_0x2fdf85][_0x43e2('0x14')](queryCampaigns);}}else{return db[_0x43e2('0x18')]['findAll']({'attributes':[_0x43e2('0x19')],'where':{'sectionId':_0x52146c['id']},'raw':!![]})[_0x43e2('0xe')](function(_0xb929b5){if(_0xb929b5){var _0x2a0fb0={'where':{'id':_['map'](_0xb929b5,'resourceId')},'raw':!![]};switch(_0x2fdf85){case _0x43e2('0x6'):_0x2a0fb0[_0x43e2('0x1a')][_0x43e2('0x7')]=_0x43e2('0xa');break;case _0x43e2('0x1b'):_0x2a0fb0[_0x43e2('0x1a')][_0x43e2('0xb')]=_0x43e2('0xc');break;}return db[_0x2fdf85][_0x43e2('0x14')](_0x2a0fb0);}else{return[];}});}}else{return[];}})[_0x43e2('0xe')](function(_0x4879e9){return _0x4879e9;});}function joinOrLeaveQueues(_0x3ee34c,_0xb99e5d,_0x4de509,_0x115c0a){_0x3ee34c[_0xb99e5d](util['format'](_0x43e2('0x1c'),_0x4de509,_0x115c0a[_0x43e2('0x9')]));if(_0x115c0a[_0x43e2('0x5')]){for(var _0x23825c=0x0;_0x23825c<_0x115c0a[_0x43e2('0x5')]['length'];_0x23825c+=0x1){_0x3ee34c[_0xb99e5d](util[_0x43e2('0x1d')](_0x43e2('0x1e'),_0x115c0a[_0x43e2('0x5')][_0x23825c]['name']));}}}function joinOrLeave(_0x234a1d,_0x32f048,_0x43078f){var _0x11b285;if(_0x234a1d['handshake'][_0x43e2('0x1f')]['id']){db[_0x43e2('0x6')][_0x43e2('0x20')]({'attributes':['id',_0x43e2('0x9'),_0x43e2('0x7'),_0x43e2('0x21')],'where':{'id':_0x234a1d[_0x43e2('0x22')][_0x43e2('0x1f')]['id']},'include':[{'model':db[_0x43e2('0x23')],'as':_0x43e2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x25')],'as':_0x43e2('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x43e2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x29')],'as':_0x43e2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x43e2('0x2b')],'as':_0x43e2('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x43e2('0xe')](function(_0x5a896b){if(_0x5a896b){_0x11b285=_0x5a896b;_0x234a1d[_0x32f048](util[_0x43e2('0x1d')](_0x43e2('0x1e'),_0x5a896b[_0x43e2('0x9')]));var _0x3d8e16=[];switch(_0x5a896b[_0x43e2('0x7')]){case _0x43e2('0x2d'):_0x234a1d[_0x32f048]('voice:inbound');_0x234a1d[_0x32f048]('voice:outbound');if(queryQueues[_0x43e2('0x2e')](_0x43e2('0x2f'))){delete queryQueues[_0x43e2('0x2f')];}_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x31')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x32')][_0x43e2('0x14')](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x33')][_0x43e2('0x14')](queryQueues));_0x3d8e16[_0x43e2('0x30')](db['SmsQueue']['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x34')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x35')]['findAll'](queryQueues));_0x3d8e16[_0x43e2('0x30')](db['WhatsappQueue']['findAll'](queryQueues));_0x3d8e16['push'](db[_0x43e2('0x6')]['findAll'](queryTelephones));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x36')][_0x43e2('0x14')](queryTrunks));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x1b')][_0x43e2('0x14')](queryCampaigns));_0x3d8e16[_0x43e2('0x30')](db[_0x43e2('0x6')][_0x43e2('0x14')](queryAgents));break;case _0x43e2('0x37'):_0x234a1d[_0x32f048](_0x43e2('0x38'));_0x234a1d[_0x32f048](_0x43e2('0x39'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x3a'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x31')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources('ChatQueues',_0x5a896b['userProfileId'],'ChatQueue'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x3b'),_0x5a896b['userProfileId'],'FaxQueue'));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x10'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x3c')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x11'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x34')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x12'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x35')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x13'),_0x5a896b['userProfileId'],_0x43e2('0x3d')));_0x3d8e16['push'](getAssociatedResources(_0x43e2('0x15'),_0x5a896b['userProfileId'],_0x43e2('0x6')));_0x3d8e16[_0x43e2('0x30')](getAssociatedResources(_0x43e2('0x16'),_0x5a896b['userProfileId'],_0x43e2('0x36')));_0x3d8e16['push'](getAssociatedResources(_0x43e2('0x17'),_0x5a896b[_0x43e2('0x21')],_0x43e2('0x1b')));_0x3d8e16[_0x43e2('0x30')](db['User']['findAll'](queryAgents));break;case _0x43e2('0x8'):_0x234a1d[_0x32f048](_0x43e2('0x38'));_0x234a1d[_0x32f048](_0x43e2('0x39'));_0x3d8e16[_0x43e2('0x30')](_0x5a896b['getVoiceQueues']({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x3e')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b['getFaxQueues']({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x3f')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x40')]({'attributes':['id','name']}));_0x3d8e16['push'](_0x5a896b[_0x43e2('0x41')]({'attributes':['id',_0x43e2('0x9')]}));_0x3d8e16[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x42')]({'attributes':['id',_0x43e2('0x9')]}));break;}return BPromise['all'](_0x3d8e16);}})[_0x43e2('0xe')](function(_0x17aaa8){if(_0x17aaa8&&_0x17aaa8[_0x43e2('0x43')]){for(var _0xe5c04=0x0;_0xe5c04<_0x17aaa8[_0x43e2('0x43')];_0xe5c04+=0x1){for(var _0x4114ce=0x0;_0x4114ce<_0x17aaa8[_0xe5c04][_0x43e2('0x43')];_0x4114ce+=0x1){switch(_0xe5c04){case 0x0:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x44'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x1:joinOrLeaveQueues(_0x234a1d,_0x32f048,'chat',_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x2:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x45'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x3:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x46'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x4:joinOrLeaveQueues(_0x234a1d,_0x32f048,'mail',_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x5:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x47'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x6:joinOrLeaveQueues(_0x234a1d,_0x32f048,_0x43e2('0x48'),_0x17aaa8[_0xe5c04][_0x4114ce]);break;case 0x7:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util['format'](_0x43e2('0x49'),_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;case 0x8:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util[_0x43e2('0x1d')]('trunk:%s',_0x17aaa8[_0xe5c04][_0x4114ce]['name']));break;case 0x9:if(_0x11b285[_0x43e2('0x7')]!==_0x43e2('0x8'))_0x234a1d[_0x32f048](util['format'](_0x43e2('0x4a'),_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0xb')],_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;case 0xa:_0x234a1d[_0x32f048](util['format']('user:%s',_0x17aaa8[_0xe5c04][_0x4114ce][_0x43e2('0x9')]));break;}}}}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x475e58=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x24')],'id');return _0x11b285[_0x43e2('0x4d')](_0x475e58)[_0x43e2('0xe')](function(){for(var _0x2a0b40=0x0;_0x2a0b40<_0x475e58['length'];_0x2a0b40+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x475e58[_0x2a0b40]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x2f8894=_['map'](_0x11b285[_0x43e2('0x26')],'id');return _0x11b285[_0x43e2('0x4f')](_0x2f8894)[_0x43e2('0xe')](function(){for(var _0x4621a6=0x0;_0x4621a6<_0x2f8894[_0x43e2('0x43')];_0x4621a6+=0x1){_0x43078f[_0x43e2('0x4e')](_0x43e2('0x50'),{'MailInteractionId':Number(_0x2f8894[_0x4621a6]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x408a97=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x27')],'id');return _0x11b285[_0x43e2('0x51')](_0x408a97)['then'](function(){for(var _0x5c634e=0x0;_0x5c634e<_0x408a97['length'];_0x5c634e+=0x1){_0x43078f['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x408a97[_0x5c634e]),'UserId':Number(_0x11b285['id'])});}});}})['then'](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x54ab6e=_['map'](_0x11b285[_0x43e2('0x52')],'id');return _0x11b285['removeSmsInteractions'](_0x54ab6e)[_0x43e2('0xe')](function(){for(var _0x4940d3=0x0;_0x4940d3<_0x54ab6e[_0x43e2('0x43')];_0x4940d3+=0x1){_0x43078f[_0x43e2('0x4e')](_0x43e2('0x53'),{'SmsInteractionId':Number(_0x54ab6e[_0x4940d3]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048===_0x43e2('0x4b')){var _0x13685a=_[_0x43e2('0x4c')](_0x11b285[_0x43e2('0x2a')],'id');return _0x11b285[_0x43e2('0x54')](_0x13685a)[_0x43e2('0xe')](function(){for(var _0x5ab16e=0x0;_0x5ab16e<_0x13685a[_0x43e2('0x43')];_0x5ab16e+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x13685a[_0x5ab16e]),'UserId':Number(_0x11b285['id'])});}});}})[_0x43e2('0xe')](function(){if(_0x32f048==='leave'){var _0x5d6c3d=_['map'](_0x11b285['WhatsappInteractions'],'id');return _0x11b285['removeWhatsappInteractions'](_0x5d6c3d)[_0x43e2('0xe')](function(){for(var _0x1eb3b1=0x0;_0x1eb3b1<_0x5d6c3d[_0x43e2('0x43')];_0x1eb3b1+=0x1){_0x43078f[_0x43e2('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x5d6c3d[_0x1eb3b1]),'UserId':Number(_0x11b285['id'])});}});}})['catch'](function(_0x4145fd){_0x234a1d[_0x43e2('0x55')](_0x4145fd);});}}function onDisconnect(_0x9a221f,_0x2eb6e7){joinOrLeave(_0x9a221f,_0x43e2('0x4b'),_0x2eb6e7);}function onConnect(_0x25037d){joinOrLeave(_0x25037d,_0x43e2('0x56'));}exports[_0x43e2('0x57')]=function(_0x2eb2aa){_0x2eb2aa['on'](_0x43e2('0x58'),function(_0x1dd8c8){_0x1dd8c8['setMaxListeners'](0x0);_0x1dd8c8[_0x43e2('0x59')]=_0x1dd8c8[_0x43e2('0x5a')][_0x43e2('0x58')][_0x43e2('0x5b')]+':'+_0x1dd8c8[_0x43e2('0x5a')]['connection'][_0x43e2('0x5c')];_0x1dd8c8[_0x43e2('0x5d')]=new Date();_0x1dd8c8['log']=function(_0x137d0c){console['log'](_0x43e2('0x5e')+_0x1dd8c8[_0x43e2('0x5f')][_0x43e2('0x9')]+'['+_0x1dd8c8[_0x43e2('0x59')]+']',_0x137d0c);};_0x1dd8c8['on'](_0x43e2('0x60'),function(){onDisconnect(_0x1dd8c8,_0x2eb2aa);_0x1dd8c8[_0x43e2('0x55')](_0x43e2('0x61'));});onConnect(_0x1dd8c8);_0x1dd8c8[_0x43e2('0x55')](_0x43e2('0x62'));});}; \ No newline at end of file +var _0x48ac=['user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','format','Agents','length','user:%s','find','query','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','userProfileId','VoiceQueue','FaxQueue','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x48ac,0xe0));var _0xc48a=function(_0x475ffa,_0xdf882a){_0x475ffa=_0x475ffa-0x0;var _0x4fe1e9=_0x48ac[_0x475ffa];return _0x4fe1e9;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var BPromise=require('bluebird');var db=require(_0xc48a('0x1'))['db'];var config=require(_0xc48a('0x2'));var queryQueues={'attributes':['id',_0xc48a('0x3')],'include':[{'as':'Agents','model':db[_0xc48a('0x4')],'attributes':['id',_0xc48a('0x3'),_0xc48a('0x5')],'raw':!![],'where':{'role':_0xc48a('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc48a('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc48a('0x3'),_0xc48a('0x7')],'where':{'type':_0xc48a('0x8')}};function getAssociatedResources(_0x5a3d5b,_0x285082,_0x43461a){return db[_0xc48a('0x9')][_0xc48a('0xa')]({'where':{'name':_0x5a3d5b,'userProfileId':_0x285082},'raw':!![]})[_0xc48a('0xb')](function(_0x1c96ae){if(_0x1c96ae){if(_0x1c96ae[_0xc48a('0xc')]){switch(_0x5a3d5b){case _0xc48a('0xd'):case _0xc48a('0xe'):case _0xc48a('0xf'):case _0xc48a('0x10'):case'MailQueues':case _0xc48a('0x11'):case _0xc48a('0x12'):return db[_0x43461a][_0xc48a('0x13')](queryQueues);case'Telephones':return db[_0x43461a][_0xc48a('0x13')](queryTelephones);case _0xc48a('0x14'):return db[_0x43461a]['findAll'](queryTrunks);case _0xc48a('0x15'):return db[_0x43461a][_0xc48a('0x13')](queryCampaigns);}}else{return db[_0xc48a('0x16')]['findAll']({'attributes':[_0xc48a('0x17')],'where':{'sectionId':_0x1c96ae['id']},'raw':!![]})[_0xc48a('0xb')](function(_0x37d5d2){if(_0x37d5d2){var _0x50f232={'where':{'id':_[_0xc48a('0x18')](_0x37d5d2,_0xc48a('0x17'))},'raw':!![]};switch(_0x43461a){case'User':_0x50f232['where'][_0xc48a('0x5')]='telephone';break;case _0xc48a('0x19'):_0x50f232[_0xc48a('0x1a')][_0xc48a('0x7')]=_0xc48a('0x8');break;}return db[_0x43461a][_0xc48a('0x13')](_0x50f232);}else{return[];}});}}else{return[];}})[_0xc48a('0xb')](function(_0x16676a){return _0x16676a;});}function joinOrLeaveQueues(_0x4e5f52,_0x308703,_0x438b69,_0x5b750c){_0x4e5f52[_0x308703](util[_0xc48a('0x1b')]('%s:queue:%s',_0x438b69,_0x5b750c[_0xc48a('0x3')]));if(_0x5b750c['Agents']){for(var _0x303381=0x0;_0x303381<_0x5b750c[_0xc48a('0x1c')][_0xc48a('0x1d')];_0x303381+=0x1){_0x4e5f52[_0x308703](util[_0xc48a('0x1b')](_0xc48a('0x1e'),_0x5b750c[_0xc48a('0x1c')][_0x303381][_0xc48a('0x3')]));}}}function joinOrLeave(_0x409ca0,_0x1bb0f3,_0x3201bc){var _0x112874;if(_0x409ca0['handshake']['query']['id']){db[_0xc48a('0x4')][_0xc48a('0x1f')]({'attributes':['id',_0xc48a('0x3'),_0xc48a('0x5'),'userProfileId'],'where':{'id':_0x409ca0['handshake'][_0xc48a('0x20')]['id']},'include':[{'model':db[_0xc48a('0x21')],'as':_0xc48a('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xc48a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xc48a('0x24')],'as':_0xc48a('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xc48a('0x26')],'as':_0xc48a('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xc48a('0x28')],'as':_0xc48a('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xc48a('0x2a')],'as':_0xc48a('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xc48a('0xb')](function(_0x5da24d){if(_0x5da24d){_0x112874=_0x5da24d;_0x409ca0[_0x1bb0f3](util['format'](_0xc48a('0x1e'),_0x5da24d['name']));var _0xab328e=[];switch(_0x5da24d[_0xc48a('0x5')]){case'admin':_0x409ca0[_0x1bb0f3](_0xc48a('0x2c'));_0x409ca0[_0x1bb0f3](_0xc48a('0x2d'));if(queryQueues[_0xc48a('0x2e')]('include')){delete queryQueues[_0xc48a('0x2f')];}_0xab328e[_0xc48a('0x30')](db['VoiceQueue'][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x31')][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db['FaxQueue'][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x32')][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x33')][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db['OpenchannelQueue'][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x34')][_0xc48a('0x13')](queryQueues));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x4')][_0xc48a('0x13')](queryTelephones));_0xab328e['push'](db[_0xc48a('0x35')][_0xc48a('0x13')](queryTrunks));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x19')]['findAll'](queryCampaigns));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x4')]['findAll'](queryAgents));break;case _0xc48a('0x36'):_0x409ca0[_0x1bb0f3]('voice:inbound');_0x409ca0[_0x1bb0f3](_0xc48a('0x2d'));_0xab328e['push'](getAssociatedResources('VoiceQueues',_0x5da24d[_0xc48a('0x37')],_0xc48a('0x38')));_0xab328e['push'](getAssociatedResources(_0xc48a('0xe'),_0x5da24d[_0xc48a('0x37')],_0xc48a('0x31')));_0xab328e[_0xc48a('0x30')](getAssociatedResources('FaxQueues',_0x5da24d[_0xc48a('0x37')],_0xc48a('0x39')));_0xab328e[_0xc48a('0x30')](getAssociatedResources(_0xc48a('0x10'),_0x5da24d['userProfileId'],_0xc48a('0x32')));_0xab328e['push'](getAssociatedResources(_0xc48a('0x3a'),_0x5da24d[_0xc48a('0x37')],_0xc48a('0x33')));_0xab328e[_0xc48a('0x30')](getAssociatedResources(_0xc48a('0x11'),_0x5da24d[_0xc48a('0x37')],'OpenchannelQueue'));_0xab328e[_0xc48a('0x30')](getAssociatedResources(_0xc48a('0x12'),_0x5da24d[_0xc48a('0x37')],_0xc48a('0x34')));_0xab328e[_0xc48a('0x30')](getAssociatedResources('Telephones',_0x5da24d[_0xc48a('0x37')],_0xc48a('0x4')));_0xab328e[_0xc48a('0x30')](getAssociatedResources('Trunks',_0x5da24d[_0xc48a('0x37')],'Trunk'));_0xab328e['push'](getAssociatedResources(_0xc48a('0x15'),_0x5da24d[_0xc48a('0x37')],_0xc48a('0x19')));_0xab328e[_0xc48a('0x30')](db[_0xc48a('0x4')][_0xc48a('0x13')](queryAgents));break;case _0xc48a('0x6'):_0x409ca0[_0x1bb0f3]('voice:inbound');_0x409ca0[_0x1bb0f3]('voice:outbound');_0xab328e['push'](_0x5da24d[_0xc48a('0x3b')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e[_0xc48a('0x30')](_0x5da24d[_0xc48a('0x3c')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e[_0xc48a('0x30')](_0x5da24d[_0xc48a('0x3d')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e[_0xc48a('0x30')](_0x5da24d[_0xc48a('0x3e')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e['push'](_0x5da24d[_0xc48a('0x3f')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e[_0xc48a('0x30')](_0x5da24d[_0xc48a('0x40')]({'attributes':['id',_0xc48a('0x3')]}));_0xab328e[_0xc48a('0x30')](_0x5da24d[_0xc48a('0x41')]({'attributes':['id',_0xc48a('0x3')]}));break;}return BPromise[_0xc48a('0x42')](_0xab328e);}})['then'](function(_0x16ee60){if(_0x16ee60&&_0x16ee60[_0xc48a('0x1d')]){for(var _0x145aa0=0x0;_0x145aa0<_0x16ee60[_0xc48a('0x1d')];_0x145aa0+=0x1){for(var _0x5ab2e7=0x0;_0x5ab2e7<_0x16ee60[_0x145aa0][_0xc48a('0x1d')];_0x5ab2e7+=0x1){switch(_0x145aa0){case 0x0:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,_0xc48a('0x43'),_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x1:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,'chat',_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x2:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,_0xc48a('0x44'),_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x3:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,_0xc48a('0x45'),_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x4:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,_0xc48a('0x46'),_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x5:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,_0xc48a('0x47'),_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x6:joinOrLeaveQueues(_0x409ca0,_0x1bb0f3,'whatsapp',_0x16ee60[_0x145aa0][_0x5ab2e7]);break;case 0x7:if(_0x112874[_0xc48a('0x5')]!==_0xc48a('0x6'))_0x409ca0[_0x1bb0f3](util[_0xc48a('0x1b')](_0xc48a('0x48'),_0x16ee60[_0x145aa0][_0x5ab2e7]['name']));break;case 0x8:if(_0x112874['role']!=='agent')_0x409ca0[_0x1bb0f3](util[_0xc48a('0x1b')](_0xc48a('0x49'),_0x16ee60[_0x145aa0][_0x5ab2e7]['name']));break;case 0x9:if(_0x112874[_0xc48a('0x5')]!=='agent')_0x409ca0[_0x1bb0f3](util[_0xc48a('0x1b')](_0xc48a('0x4a'),_0x16ee60[_0x145aa0][_0x5ab2e7][_0xc48a('0x7')],_0x16ee60[_0x145aa0][_0x5ab2e7][_0xc48a('0x3')]));break;case 0xa:_0x409ca0[_0x1bb0f3](util[_0xc48a('0x1b')](_0xc48a('0x1e'),_0x16ee60[_0x145aa0][_0x5ab2e7][_0xc48a('0x3')]));break;}}}}})[_0xc48a('0xb')](function(){if(_0x1bb0f3===_0xc48a('0x4b')){var _0x5ad03f=_[_0xc48a('0x18')](_0x112874['ChatInteractions'],'id');return _0x112874[_0xc48a('0x4c')](_0x5ad03f)[_0xc48a('0xb')](function(){for(var _0x198a3f=0x0;_0x198a3f<_0x5ad03f[_0xc48a('0x1d')];_0x198a3f+=0x1){_0x3201bc[_0xc48a('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x5ad03f[_0x198a3f]),'UserId':Number(_0x112874['id'])});}});}})[_0xc48a('0xb')](function(){if(_0x1bb0f3==='leave'){var _0x94456=_[_0xc48a('0x18')](_0x112874[_0xc48a('0x23')],'id');return _0x112874[_0xc48a('0x4e')](_0x94456)[_0xc48a('0xb')](function(){for(var _0x338977=0x0;_0x338977<_0x94456['length'];_0x338977+=0x1){_0x3201bc[_0xc48a('0x4d')](_0xc48a('0x4f'),{'MailInteractionId':Number(_0x94456[_0x338977]),'UserId':Number(_0x112874['id'])});}});}})[_0xc48a('0xb')](function(){if(_0x1bb0f3==='leave'){var _0x3137d9=_[_0xc48a('0x18')](_0x112874[_0xc48a('0x25')],'id');return _0x112874['removeFaxInteractions'](_0x3137d9)[_0xc48a('0xb')](function(){for(var _0x4ab81c=0x0;_0x4ab81c<_0x3137d9[_0xc48a('0x1d')];_0x4ab81c+=0x1){_0x3201bc['emit'](_0xc48a('0x50'),{'FaxInteractionId':Number(_0x3137d9[_0x4ab81c]),'UserId':Number(_0x112874['id'])});}});}})[_0xc48a('0xb')](function(){if(_0x1bb0f3===_0xc48a('0x4b')){var _0x2e390f=_[_0xc48a('0x18')](_0x112874[_0xc48a('0x27')],'id');return _0x112874[_0xc48a('0x51')](_0x2e390f)[_0xc48a('0xb')](function(){for(var _0x43e613=0x0;_0x43e613<_0x2e390f['length'];_0x43e613+=0x1){_0x3201bc['emit'](_0xc48a('0x52'),{'SmsInteractionId':Number(_0x2e390f[_0x43e613]),'UserId':Number(_0x112874['id'])});}});}})['then'](function(){if(_0x1bb0f3===_0xc48a('0x4b')){var _0x38994c=_[_0xc48a('0x18')](_0x112874[_0xc48a('0x29')],'id');return _0x112874['removeOpenchannelInteractions'](_0x38994c)['then'](function(){for(var _0x155374=0x0;_0x155374<_0x38994c[_0xc48a('0x1d')];_0x155374+=0x1){_0x3201bc[_0xc48a('0x4d')](_0xc48a('0x53'),{'OpenchannelInteractionId':Number(_0x38994c[_0x155374]),'UserId':Number(_0x112874['id'])});}});}})['then'](function(){if(_0x1bb0f3===_0xc48a('0x4b')){var _0x39ecb0=_['map'](_0x112874[_0xc48a('0x2b')],'id');return _0x112874[_0xc48a('0x54')](_0x39ecb0)[_0xc48a('0xb')](function(){for(var _0x76335b=0x0;_0x76335b<_0x39ecb0[_0xc48a('0x1d')];_0x76335b+=0x1){_0x3201bc[_0xc48a('0x4d')](_0xc48a('0x55'),{'WhatsappInteractionId':Number(_0x39ecb0[_0x76335b]),'UserId':Number(_0x112874['id'])});}});}})[_0xc48a('0x56')](function(_0x1c9986){_0x409ca0['log'](_0x1c9986);});}}function onDisconnect(_0x5ec3ec,_0x40fba6){joinOrLeave(_0x5ec3ec,_0xc48a('0x4b'),_0x40fba6);}function onConnect(_0x440207){joinOrLeave(_0x440207,_0xc48a('0x57'));}exports[_0xc48a('0x58')]=function(_0x2786b3){_0x2786b3['on'](_0xc48a('0x59'),function(_0x4ec02c){_0x4ec02c[_0xc48a('0x5a')](0x0);_0x4ec02c[_0xc48a('0x5b')]=_0x4ec02c[_0xc48a('0x5c')][_0xc48a('0x59')][_0xc48a('0x5d')]+':'+_0x4ec02c[_0xc48a('0x5c')][_0xc48a('0x59')]['remotePort'];_0x4ec02c[_0xc48a('0x5e')]=new Date();_0x4ec02c[_0xc48a('0x5f')]=function(_0x4ea328){console[_0xc48a('0x5f')](_0xc48a('0x60')+_0x4ec02c[_0xc48a('0x61')][_0xc48a('0x3')]+'['+_0x4ec02c['address']+']',_0x4ea328);};_0x4ec02c['on'](_0xc48a('0x62'),function(){onDisconnect(_0x4ec02c,_0x2786b3);_0x4ec02c[_0xc48a('0x5f')](_0xc48a('0x63'));});onConnect(_0x4ec02c);_0x4ec02c[_0xc48a('0x5f')](_0xc48a('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 8c71a60..15b8dca 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 _0xe9e1=['Fax','FaxMessage','Mail','Openchannel','OpenchannelInteraction','request','then','Trigger,\x20%s','EventManager','error','code','catch','get','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','channel','incomingmessage','AfterCreateMessage','offlineMessage','opened','resolve','AfterCreate','changed','closed','substatus','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe9e1,0x113));var _0x1e9e=function(_0x3bd3a5,_0x31c18d){_0x3bd3a5=_0x3bd3a5-0x0;var _0x598406=_0xe9e1[_0x3bd3a5];return _0x598406;};'use strict';var util=require(_0x1e9e('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1e9e('0x1'));var logger=require(_0x1e9e('0x2'))(_0x1e9e('0x3'));var client=jayson[_0x1e9e('0x4')][_0x1e9e('0x5')]({'port':0x232a});var triggers=[{'channel':_0x1e9e('0x6'),'model':_0x1e9e('0x7'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0x9'),'callback':afterCreate},{'channel':_0x1e9e('0x6'),'model':_0x1e9e('0x7'),'event':_0x1e9e('0xa'),'condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage},{'channel':_0x1e9e('0x6'),'model':_0x1e9e('0xd'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x1e9e('0xe'),'model':_0x1e9e('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x1e9e('0xe'),'model':'SmsInteraction','event':_0x1e9e('0xa'),'condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':'Sms','model':_0x1e9e('0x10'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage},{'channel':_0x1e9e('0x11'),'model':_0x1e9e('0x12'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0x9'),'callback':afterCreate},{'channel':_0x1e9e('0x11'),'model':_0x1e9e('0x12'),'event':'afterUpdate','condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':_0x1e9e('0x11'),'model':_0x1e9e('0x13'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x1e9e('0x14'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0x9'),'callback':afterCreate},{'channel':_0x1e9e('0x15'),'model':_0x1e9e('0x14'),'event':_0x1e9e('0xa'),'condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':_0x1e9e('0x15'),'model':_0x1e9e('0x16'),'event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage},{'channel':_0x1e9e('0x17'),'model':'MailInteraction','event':_0x1e9e('0x8'),'condition':_0x1e9e('0x9'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':_0x1e9e('0x17'),'model':'MailMessage','event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage},{'channel':_0x1e9e('0x18'),'model':_0x1e9e('0x19'),'event':'afterCreate','condition':_0x1e9e('0x9'),'callback':afterCreate},{'channel':_0x1e9e('0x18'),'model':'OpenchannelInteraction','event':_0x1e9e('0xa'),'condition':_0x1e9e('0xb'),'callback':afterUpdate},{'channel':_0x1e9e('0x18'),'model':'OpenchannelMessage','event':_0x1e9e('0x8'),'condition':_0x1e9e('0xc'),'callback':afterCreateMessage}];function request(_0x561bf8){return client[_0x1e9e('0x1a')]('EventManager',_0x561bf8)[_0x1e9e('0x1b')](function(_0x3f7fb1){logger['info'](_0x1e9e('0x1c'),_0x1e9e('0x1d'),_0x3f7fb1);if(_0x3f7fb1[_0x1e9e('0x1e')]){if(_0x3f7fb1[_0x1e9e('0x1e')][_0x1e9e('0x1f')]===0x1f4){logger[_0x1e9e('0x1e')]('Trigger,\x20%s',_0x1e9e('0x1d'),_0x3f7fb1['error']);}}})[_0x1e9e('0x20')](function(_0x1af0fb){logger[_0x1e9e('0x1e')](_0x1e9e('0x1c'),'EventManager',_0x1af0fb);});}function afterCreateMessage(_0x1666a2){return function(_0x57e84d){_0x57e84d=_0x57e84d[_0x1e9e('0x21')]({'plain':!![]});_0x57e84d['channel']=_0x1666a2;_0x57e84d[_0x1e9e('0x22')]=_0x1666a2;_0x57e84d[_0x1e9e('0x23')]=_0x57e84d[_0x1e9e('0x24')];Promise['resolve']()[_0x1e9e('0x1b')](function(){if(typeof _0x57e84d[_0x1e9e('0x25')]===_0x1e9e('0x26'))return null;var _0x49d4a1=_0x1e9e('0x27')+_0x57e84d['ContactId'];return db[_0x1e9e('0x28')][_0x1e9e('0x29')](_0x49d4a1,{'type':db[_0x1e9e('0x2a')][_0x1e9e('0x2b')][_0x1e9e('0x2c')],'raw':!![]});})[_0x1e9e('0x1b')](function(_0x104ea3){if(_0x104ea3){_0x57e84d[_0x1e9e('0x2d')]=_0x104ea3[0x0];}if(typeof _0x57e84d['UserId']===_0x1e9e('0x26'))return;return getAgent(_0x57e84d[_0x1e9e('0x2e')]);})[_0x1e9e('0x1b')](function(_0x520bb6){if(_0x520bb6){_0x57e84d[_0x1e9e('0x2f')]=util[_0x1e9e('0x30')](_0x1e9e('0x31'),_0x520bb6[_0x1e9e('0x32')]);_0x57e84d[_0x1e9e('0x33')]=_0x520bb6;_0x57e84d[_0x1e9e('0x34')]=_0x1666a2;return request({'event':_0x1e9e('0x35'),'message':_0x57e84d});}else{return request({'event':'outgoingmessage','message':_0x57e84d});}})[_0x1e9e('0x20')](function(_0x583b31){logger[_0x1e9e('0x1e')](_0x1e9e('0x1c'),_0x1e9e('0x36'),_0x583b31);});};}function afterCreateOfflineMessage(_0x572be1){return function(_0x4ff0dc){_0x4ff0dc=_0x4ff0dc['get']({'plain':!![]});_0x4ff0dc[_0x1e9e('0x34')]=_0x572be1;_0x4ff0dc['motionChannel']=_0x572be1;_0x4ff0dc['event']=_0x1e9e('0x37');return request({'event':_0x4ff0dc[_0x1e9e('0x23')],'message':_0x4ff0dc});};}function afterCreate(_0x1447b1,_0x144b70){return function(_0x230b5f){_0x230b5f=_0x230b5f[_0x1e9e('0x21')]({'plain':!![]});_0x230b5f[_0x1e9e('0x34')]=_0x1447b1;_0x230b5f[_0x1e9e('0x22')]=_0x1447b1;_0x230b5f[_0x1e9e('0x23')]=_0x1e9e('0x38');Promise[_0x1e9e('0x39')]()[_0x1e9e('0x1b')](function(){var _0x41234a=_0x1e9e('0x27')+_0x230b5f[_0x1e9e('0x25')];return db[_0x1e9e('0x28')][_0x1e9e('0x29')](_0x41234a,{'type':db[_0x1e9e('0x2a')][_0x1e9e('0x2b')][_0x1e9e('0x2c')],'raw':!![]});})[_0x1e9e('0x1b')](function(_0x299744){if(_0x299744){_0x230b5f[_0x1e9e('0x2d')]=_0x299744[0x0];}if(typeof _0x230b5f[_0x1e9e('0x2e')]===_0x1e9e('0x26'))return;return getAgent(_0x230b5f[_0x1e9e('0x2e')]);})[_0x1e9e('0x1b')](function(_0x8fe305){if(_0x8fe305){_0x230b5f['interface']=util[_0x1e9e('0x30')]('SIP/%s',_0x8fe305[_0x1e9e('0x32')]);_0x230b5f[_0x1e9e('0x33')]=_0x8fe305;}return request({'event':_0x144b70,'message':_0x230b5f});})[_0x1e9e('0x20')](function(_0x291895){logger[_0x1e9e('0x1e')](_0x1e9e('0x1c'),_0x1e9e('0x3a'),_0x291895);});};}function afterUpdate(_0x751971){return function(_0x19fa4a){var _0x1dcd66=_0x19fa4a[_0x1e9e('0x3b')]('closed')&&_0x19fa4a[_0x1e9e('0x3c')];var _0x26e3c8=_0x19fa4a[_0x1e9e('0x3b')](_0x1e9e('0x3d'));if(_0x1dcd66||_0x26e3c8){var _0x1da867=_0x1dcd66?_0x1e9e('0xb'):_0x1e9e('0x3d');var _0x4edb95=_0x19fa4a[_0x1e9e('0x21')]({'plain':!![]});_0x4edb95['channel']=_0x751971;_0x4edb95[_0x1e9e('0x22')]=_0x751971;_0x4edb95[_0x1e9e('0x23')]=_0x1dcd66?_0x1e9e('0x3c'):_0x1e9e('0x3d');var _0xd1f219=_0x1e9e('0x27')+_0x4edb95['ContactId'];return db[_0x1e9e('0x28')]['query'](_0xd1f219,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x29398b){if(_0x29398b){_0x4edb95[_0x1e9e('0x2d')]=_0x29398b[0x0];}if(typeof _0x4edb95[_0x1e9e('0x2e')]==='undefined')return;return getAgent(_0x4edb95[_0x1e9e('0x2e')]);})[_0x1e9e('0x1b')](function(_0x2ebaec){if(_0x2ebaec){_0x4edb95[_0x1e9e('0x2f')]=util[_0x1e9e('0x30')](_0x1e9e('0x31'),_0x2ebaec['name']);_0x4edb95[_0x1e9e('0x33')]=_0x2ebaec;}return request({'event':_0x1da867,'message':_0x4edb95});})[_0x1e9e('0x20')](function(_0x591b91){logger['error']('Trigger,\x20%s','AfterUpdate',_0x591b91);});}};}function getAgent(_0x288b70){return db[_0x1e9e('0x3e')][_0x1e9e('0x3f')]({'where':{'id':_0x288b70},'attributes':['id',_0x1e9e('0x32'),_0x1e9e('0x40'),_0x1e9e('0x41'),_0x1e9e('0x42')],'raw':!![]})[_0x1e9e('0x1b')](function(_0x3b7cf1){return _0x3b7cf1;});}exports[_0x1e9e('0x43')]=function(){for(var _0x4b8395=0x0;_0x4b8395=_0x23e08a[_0x3f24('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x582516(_0x4c9197);})['catch'](function(_0x4904dd){_0x3532ed(_0x4904dd);});});}; \ No newline at end of file +var _0xe868=['agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','openchannel','toLowerCase','includes','clearBlockUser','blockedAt','updateAttributes','getLicense','User','count','then'];(function(_0x444fbc,_0x261204){var _0x45e163=function(_0x37cfbb){while(--_0x37cfbb){_0x444fbc['push'](_0x444fbc['shift']());}};_0x45e163(++_0x261204);}(_0xe868,0x114));var _0x8e86=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe868[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8e86('0x0'));var BPromise=require(_0x8e86('0x1'));var db=require(_0x8e86('0x2'))['db'];var util=require(_0x8e86('0x3'));var channels=[_0x8e86('0x4'),_0x8e86('0x5'),_0x8e86('0x6'),_0x8e86('0x7'),'sms','whatsapp',_0x8e86('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0xb1a47f){_0xb1a47f=_0xb1a47f[_0x8e86('0x9')]();return _[_0x8e86('0xa')](channels,_0xb1a47f);};exports[_0x8e86('0xb')]=function(_0x303160,_0x59b51f,_0x35da6c,_0x427d2d){var _0x1e1cb2={'loginAttempts':_0x59b51f,'blocked':_0x35da6c};if(!_['isUndefined'](_0x427d2d)){_0x1e1cb2[_0x8e86('0xc')]=_0x427d2d;}return _0x303160[_0x8e86('0xd')](_0x1e1cb2);};exports[_0x8e86('0xe')]=function(_0x1387d9){return new BPromise(function(_0x3ab139,_0xb64a55){var _0x30d349=0x0;if(_0x1387d9['role']!=='agent'){_0x3ab139(_0x1387d9);}db[_0x8e86('0xf')][_0x8e86('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1387d9['id']}}})[_0x8e86('0x11')](function(_0xd95b15){_0x30d349=_0xd95b15;return util['getLicense']();})[_0x8e86('0x11')](function(_0x2eb4cd){if(_0x2eb4cd&&_0x2eb4cd[_0x8e86('0x12')]&&_0x30d349>=_0x2eb4cd[_0x8e86('0x12')]){throw Error(_0x8e86('0x13'));}_0x3ab139(_0x1387d9);})[_0x8e86('0x14')](function(_0x52cf6a){_0xb64a55(_0x52cf6a);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e45a74d..e682bd0 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x6ed2db,_0x3e73b5){var _0x1c64be=function(_0x393fb3){while(--_0x393fb3){_0x6ed2db['push'](_0x6ed2db['shift']());}};_0x1c64be(++_0x3e73b5);}(_0x7a54,0x106));var _0x47a5=function(_0x5b2bb4,_0x4e6dc5){_0x5b2bb4=_0x5b2bb4-0x0;var _0x4a1406=_0x7a54[_0x5b2bb4];return _0x4a1406;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x3f23c3,_0x4d183f){var _0xf18b55=function(_0x17f516){while(--_0x17f516){_0x3f23c3['push'](_0x3f23c3['shift']());}};_0xf18b55(++_0x4d183f);}(_0x7a54,0x106));var _0x47a5=function(_0x3cde24,_0x3f67df){_0x3cde24=_0x3cde24-0x0;var _0x484835=_0x7a54[_0x3cde24];return _0x484835;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 104323d..c69b886 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49f5=['json','exports','404','status','render'];(function(_0x5c3e2e,_0x3c59a4){var _0x3a3883=function(_0x2b6caf){while(--_0x2b6caf){_0x5c3e2e['push'](_0x5c3e2e['shift']());}};_0x3a3883(++_0x3c59a4);}(_0x49f5,0x18c));var _0x549f=function(_0x375233,_0x165da0){_0x375233=_0x375233-0x0;var _0xb1fac5=_0x49f5[_0x375233];return _0xb1fac5;};'use strict';module[_0x549f('0x0')][0x194]=function pageNotFound(_0x23b763,_0x55f9d8){var _0x369711=_0x549f('0x1');var _0x2a1857=0x194;var _0x752caa={'status':_0x2a1857};_0x55f9d8[_0x549f('0x2')](_0x752caa['status']);_0x55f9d8[_0x549f('0x3')](_0x369711,{},function(_0x14acd0,_0x106a87){if(_0x14acd0){return _0x55f9d8[_0x549f('0x2')](_0x752caa[_0x549f('0x2')])[_0x549f('0x4')](_0x752caa);}_0x55f9d8['send'](_0x106a87);});}; \ No newline at end of file +var _0xe42a=['render','json','send','404','status'];(function(_0xcf9f83,_0x408717){var _0x3de39c=function(_0x2072b9){while(--_0x2072b9){_0xcf9f83['push'](_0xcf9f83['shift']());}};_0x3de39c(++_0x408717);}(_0xe42a,0x193));var _0xae42=function(_0x37c92b,_0x4c5e6a){_0x37c92b=_0x37c92b-0x0;var _0x3a7144=_0xe42a[_0x37c92b];return _0x3a7144;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1af9df,_0x1a3436){var _0x2b9f71=_0xae42('0x0');var _0x5ad5db=0x194;var _0x2ffdeb={'status':_0x5ad5db};_0x1a3436[_0xae42('0x1')](_0x2ffdeb['status']);_0x1a3436[_0xae42('0x2')](_0x2b9f71,{},function(_0x5d834d,_0x3302bb){if(_0x5d834d){return _0x1a3436[_0xae42('0x1')](_0x2ffdeb[_0xae42('0x1')])[_0xae42('0x3')](_0x2ffdeb);}_0x1a3436[_0xae42('0x4')](_0x3302bb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6595fb2..8d6afc3 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 06f35e8..9f15fed 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x177a=['./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./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/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/networks','./api/network','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','/www','static','root','/demo','/snippet','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./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/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxApplication','/api/fax/interactions'];(function(_0x2cffce,_0xa2c251){var _0x1a42bd=function(_0x4561f2){while(--_0x4561f2){_0x2cffce['push'](_0x2cffce['shift']());}};_0x1a42bd(++_0xa2c251);}(_0x177a,0xdd));var _0xa177=function(_0x3f57d3,_0x2339e0){_0x3f57d3=_0x3f57d3-0x0;var _0x42443e=_0x177a[_0x3f57d3];return _0x42443e;};'use strict';var path=require(_0xa177('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0xa177('0x1'));var setupLoggers=require(_0xa177('0x2'))[_0xa177('0x3')];var clientSideLogs=require(_0xa177('0x4'));exports[_0xa177('0x5')]=function(_0x471a81){return setupLoggers(_0x471a81)['then'](function(){_0x471a81[_0xa177('0x6')](_0xa177('0x7'),require(_0xa177('0x8')));_0x471a81[_0xa177('0x6')](_0xa177('0x9'),require(_0xa177('0xa')));_0x471a81[_0xa177('0x6')](_0xa177('0xb'),require('./api/voiceContext'));_0x471a81[_0xa177('0x6')]('/api/voice/extensions',require(_0xa177('0xc')));_0x471a81[_0xa177('0x6')](_0xa177('0xd'),require(_0xa177('0xe')));_0x471a81[_0xa177('0x6')](_0xa177('0xf'),require(_0xa177('0x10')));_0x471a81['use'](_0xa177('0x11'),require(_0xa177('0x12')));_0x471a81[_0xa177('0x6')](_0xa177('0x13'),require(_0xa177('0x14')));_0x471a81[_0xa177('0x6')](_0xa177('0x15'),require('./api/voiceMail'));_0x471a81['use'](_0xa177('0x16'),require(_0xa177('0x17')));_0x471a81[_0xa177('0x6')](_0xa177('0x18'),require(_0xa177('0x19')));_0x471a81[_0xa177('0x6')](_0xa177('0x1a'),require(_0xa177('0x1b')));_0x471a81[_0xa177('0x6')](_0xa177('0x1c'),require(_0xa177('0x1d')));_0x471a81[_0xa177('0x6')]('/api/voice/queues/reports',require(_0xa177('0x1e')));_0x471a81[_0xa177('0x6')]('/api/members/reports',require(_0xa177('0x1f')));_0x471a81[_0xa177('0x6')](_0xa177('0x20'),require(_0xa177('0x21')));_0x471a81['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x22'),require(_0xa177('0x23')));_0x471a81[_0xa177('0x6')]('/api/mail/accounts',require(_0xa177('0x24')));_0x471a81['use'](_0xa177('0x25'),require('./api/mailQueue'));_0x471a81[_0xa177('0x6')](_0xa177('0x26'),require(_0xa177('0x27')));_0x471a81[_0xa177('0x6')]('/api/mail/interactions',require(_0xa177('0x28')));_0x471a81[_0xa177('0x6')](_0xa177('0x29'),require('./api/mailMessage'));_0x471a81['use']('/api/mail/applications',require('./api/mailApplication'));_0x471a81[_0xa177('0x6')](_0xa177('0x2a'),require(_0xa177('0x2b')));_0x471a81[_0xa177('0x6')](_0xa177('0x2c'),require('./api/dashboard'));_0x471a81[_0xa177('0x6')](_0xa177('0x2d'),require('./api/dashboardItem'));_0x471a81['use'](_0xa177('0x2e'),require('./api/faxAccount'));_0x471a81['use']('/api/fax/applications',require(_0xa177('0x2f')));_0x471a81['use'](_0xa177('0x30'),require(_0xa177('0x31')));_0x471a81[_0xa177('0x6')]('/api/fax/messages',require(_0xa177('0x32')));_0x471a81[_0xa177('0x6')]('/api/fax/queues',require(_0xa177('0x33')));_0x471a81[_0xa177('0x6')](_0xa177('0x34'),require(_0xa177('0x35')));_0x471a81[_0xa177('0x6')](_0xa177('0x36'),require(_0xa177('0x37')));_0x471a81[_0xa177('0x6')]('/api/sms/applications',require(_0xa177('0x38')));_0x471a81[_0xa177('0x6')]('/api/sms/interactions',require(_0xa177('0x39')));_0x471a81[_0xa177('0x6')]('/api/sms/messages',require(_0xa177('0x3a')));_0x471a81[_0xa177('0x6')]('/api/sms/queues',require(_0xa177('0x3b')));_0x471a81[_0xa177('0x6')](_0xa177('0x3c'),require('./api/openchannelAccount'));_0x471a81['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x471a81['use'](_0xa177('0x3d'),require(_0xa177('0x3e')));_0x471a81[_0xa177('0x6')](_0xa177('0x3f'),require(_0xa177('0x40')));_0x471a81[_0xa177('0x6')]('/api/openchannel/queues',require(_0xa177('0x41')));_0x471a81[_0xa177('0x6')](_0xa177('0x42'),require(_0xa177('0x43')));_0x471a81[_0xa177('0x6')](_0xa177('0x44'),require(_0xa177('0x45')));_0x471a81[_0xa177('0x6')]('/api/chat/applications',require(_0xa177('0x46')));_0x471a81[_0xa177('0x6')]('/api/chat/interactions',require(_0xa177('0x47')));_0x471a81['use'](_0xa177('0x48'),require(_0xa177('0x49')));_0x471a81['use'](_0xa177('0x4a'),require(_0xa177('0x4b')));_0x471a81[_0xa177('0x6')](_0xa177('0x4c'),require(_0xa177('0x4d')));_0x471a81[_0xa177('0x6')](_0xa177('0x4e'),require(_0xa177('0x4f')));_0x471a81[_0xa177('0x6')](_0xa177('0x50'),require(_0xa177('0x51')));_0x471a81[_0xa177('0x6')]('/api/cm/companies',require('./api/cmCompany'));_0x471a81[_0xa177('0x6')](_0xa177('0x52'),require(_0xa177('0x53')));_0x471a81[_0xa177('0x6')](_0xa177('0x54'),require(_0xa177('0x55')));_0x471a81[_0xa177('0x6')](_0xa177('0x56'),require('./api/cmHopperBlack'));_0x471a81['use'](_0xa177('0x57'),require(_0xa177('0x58')));_0x471a81[_0xa177('0x6')](_0xa177('0x59'),require(_0xa177('0x5a')));_0x471a81[_0xa177('0x6')](_0xa177('0x5b'),require('./api/cmCustomField'));_0x471a81[_0xa177('0x6')]('/api/actions',require(_0xa177('0x5c')));_0x471a81[_0xa177('0x6')](_0xa177('0x5d'),require(_0xa177('0x5e')));_0x471a81[_0xa177('0x6')](_0xa177('0x5f'),require('./api/cannedAnswer'));_0x471a81[_0xa177('0x6')](_0xa177('0x60'),require(_0xa177('0x61')));_0x471a81[_0xa177('0x6')](_0xa177('0x62'),require(_0xa177('0x63')));_0x471a81['use'](_0xa177('0x64'),require(_0xa177('0x65')));_0x471a81[_0xa177('0x6')](_0xa177('0x66'),require(_0xa177('0x67')));_0x471a81[_0xa177('0x6')]('/api/cdr',require(_0xa177('0x68')));_0x471a81[_0xa177('0x6')](_0xa177('0x69'),require(_0xa177('0x6a')));_0x471a81[_0xa177('0x6')](_0xa177('0x6b'),require(_0xa177('0x6c')));_0x471a81[_0xa177('0x6')](_0xa177('0x6d'),require(_0xa177('0x6e')));_0x471a81[_0xa177('0x6')](_0xa177('0x6f'),require(_0xa177('0x70')));_0x471a81[_0xa177('0x6')](_0xa177('0x71'),require(_0xa177('0x72')));_0x471a81['use'](_0xa177('0x73'),require(_0xa177('0x74')));_0x471a81[_0xa177('0x6')](_0xa177('0x75'),require(_0xa177('0x76')));_0x471a81['use'](_0xa177('0x77'),require(_0xa177('0x78')));_0x471a81['use'](_0xa177('0x79'),require(_0xa177('0x7a')));_0x471a81[_0xa177('0x6')](_0xa177('0x7b'),require(_0xa177('0x7c')));_0x471a81[_0xa177('0x6')]('/api/integrations',require(_0xa177('0x7d')));_0x471a81[_0xa177('0x6')](_0xa177('0x7e'),require('./api/integrationReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x7f'),require(_0xa177('0x80')));_0x471a81[_0xa177('0x6')](_0xa177('0x81'),require(_0xa177('0x82')));_0x471a81[_0xa177('0x6')]('/api/analytics/extracted_reports',require(_0xa177('0x83')));_0x471a81[_0xa177('0x6')]('/api/analytics/metrics',require(_0xa177('0x84')));_0x471a81['use'](_0xa177('0x85'),require('./api/analyticFieldReport'));_0x471a81[_0xa177('0x6')](_0xa177('0x86'),require(_0xa177('0x87')));_0x471a81[_0xa177('0x6')](_0xa177('0x88'),require(_0xa177('0x89')));_0x471a81[_0xa177('0x6')](_0xa177('0x8a'),require(_0xa177('0x8b')));_0x471a81[_0xa177('0x6')](_0xa177('0x8c'),require(_0xa177('0x8d')));_0x471a81[_0xa177('0x6')]('/api/integrations/sugarcrm/accounts',require(_0xa177('0x8e')));_0x471a81[_0xa177('0x6')](_0xa177('0x8f'),require('./api/intSugarcrmConfiguration'));_0x471a81['use']('/api/integrations/sugarcrm/fields',require(_0xa177('0x90')));_0x471a81[_0xa177('0x6')](_0xa177('0x91'),require('./api/intDeskAccount'));_0x471a81[_0xa177('0x6')](_0xa177('0x92'),require(_0xa177('0x93')));_0x471a81[_0xa177('0x6')](_0xa177('0x94'),require(_0xa177('0x95')));_0x471a81[_0xa177('0x6')](_0xa177('0x96'),require(_0xa177('0x97')));_0x471a81[_0xa177('0x6')](_0xa177('0x98'),require(_0xa177('0x99')));_0x471a81[_0xa177('0x6')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x471a81[_0xa177('0x6')](_0xa177('0x9a'),require(_0xa177('0x9b')));_0x471a81[_0xa177('0x6')](_0xa177('0x9c'),require(_0xa177('0x9d')));_0x471a81[_0xa177('0x6')]('/api/integrations/zendesk/fields',require(_0xa177('0x9e')));_0x471a81[_0xa177('0x6')]('/api/integrations/freshdesk/accounts',require(_0xa177('0x9f')));_0x471a81[_0xa177('0x6')](_0xa177('0xa0'),require('./api/intFreshdeskConfiguration'));_0x471a81['use'](_0xa177('0xa1'),require(_0xa177('0xa2')));_0x471a81[_0xa177('0x6')](_0xa177('0xa3'),require(_0xa177('0xa4')));_0x471a81[_0xa177('0x6')](_0xa177('0xa5'),require('./api/intVtigerConfiguration'));_0x471a81[_0xa177('0x6')](_0xa177('0xa6'),require(_0xa177('0xa7')));_0x471a81[_0xa177('0x6')](_0xa177('0xa8'),require(_0xa177('0xa9')));_0x471a81['use']('/api/integrations/servicenow/configurations',require(_0xa177('0xaa')));_0x471a81[_0xa177('0x6')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x471a81[_0xa177('0x6')](_0xa177('0xab'),require(_0xa177('0xac')));_0x471a81[_0xa177('0x6')](_0xa177('0xad'),require(_0xa177('0xae')));_0x471a81[_0xa177('0x6')](_0xa177('0xaf'),require('./api/intDynamics365Field'));_0x471a81[_0xa177('0x6')](_0xa177('0xb0'),require('./api/intFreshsalesAccount'));_0x471a81[_0xa177('0x6')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x471a81[_0xa177('0x6')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x471a81['use'](_0xa177('0xb1'),require(_0xa177('0xb2')));_0x471a81[_0xa177('0x6')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x471a81['use'](_0xa177('0xb3'),require(_0xa177('0xb4')));_0x471a81[_0xa177('0x6')](_0xa177('0xb5'),require('./api/jscriptyAnswerReport'));_0x471a81['use'](_0xa177('0xb6'),require(_0xa177('0xb7')));_0x471a81['use'](_0xa177('0xb8'),require(_0xa177('0xb9')));_0x471a81[_0xa177('0x6')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x471a81['use'](_0xa177('0xba'),require(_0xa177('0xbb')));_0x471a81[_0xa177('0x6')](_0xa177('0xbc'),require(_0xa177('0xbd')));_0x471a81[_0xa177('0x6')](_0xa177('0xbe'),require(_0xa177('0xbf')));_0x471a81[_0xa177('0x6')](_0xa177('0xc0'),require(_0xa177('0xc1')));_0x471a81[_0xa177('0x6')](_0xa177('0xc2'),require(_0xa177('0xc3')));_0x471a81[_0xa177('0x6')](_0xa177('0xc4'),require(_0xa177('0xc5')));_0x471a81[_0xa177('0x6')]('/api/square/recordings',require(_0xa177('0xc6')));_0x471a81[_0xa177('0x6')]('/api/square/messages',require(_0xa177('0xc7')));_0x471a81[_0xa177('0x6')]('/api/teams',require(_0xa177('0xc8')));_0x471a81[_0xa177('0x6')](_0xa177('0xc9'),require(_0xa177('0xca')));_0x471a81[_0xa177('0x6')]('/api/campaigns',require(_0xa177('0xcb')));_0x471a81['use'](_0xa177('0xcc'),require(_0xa177('0xcd')));_0x471a81[_0xa177('0x6')]('/api/attachments',require(_0xa177('0xce')));_0x471a81[_0xa177('0x6')](_0xa177('0xcf'),require(_0xa177('0xd0')));_0x471a81['use'](_0xa177('0xd1'),require(_0xa177('0xd2')));_0x471a81['use']('/api/chat/reports/transfer',require(_0xa177('0xd3')));_0x471a81[_0xa177('0x6')](_0xa177('0xd4'),require(_0xa177('0xd5')));_0x471a81[_0xa177('0x6')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0x471a81[_0xa177('0x6')](_0xa177('0xd6'),require(_0xa177('0xd7')));_0x471a81['use'](_0xa177('0xd8'),require(_0xa177('0xd9')));_0x471a81['use']('/api/voice/prefixes',require(_0xa177('0xda')));_0x471a81['use'](_0xa177('0xdb'),require(_0xa177('0xdc')));_0x471a81[_0xa177('0x6')]('/api/userProfile/sections',require(_0xa177('0xdd')));_0x471a81['use'](_0xa177('0xde'),require('./api/userProfileResource'));_0x471a81[_0xa177('0x6')]('/api/userNotifications',require(_0xa177('0xdf')));_0x471a81[_0xa177('0x6')](_0xa177('0xe0'),require(_0xa177('0xe1')));_0x471a81['use'](_0xa177('0xe2'),require(_0xa177('0xe3')));_0x471a81[_0xa177('0x6')](_0xa177('0xe4'),require(_0xa177('0xe5')));_0x471a81[_0xa177('0x6')](_0xa177('0xe6'),require(_0xa177('0xe7')));_0x471a81[_0xa177('0x6')](_0xa177('0xe8'),require(_0xa177('0xe9')));_0x471a81[_0xa177('0x6')](_0xa177('0xea'),require(_0xa177('0xeb')));_0x471a81[_0xa177('0x6')](_0xa177('0xec'),require(_0xa177('0xed')));_0x471a81[_0xa177('0x6')](_0xa177('0xee'),require(_0xa177('0xef')));_0x471a81[_0xa177('0x6')](_0xa177('0xf0'),require(_0xa177('0xf1')));_0x471a81[_0xa177('0x6')]('/api/user-settings',require(_0xa177('0xf2')));_0x471a81[_0xa177('0x6')](_0xa177('0xf3'),require(_0xa177('0xf4')));_0x471a81[_0xa177('0x6')](_0xa177('0xf5'),require('./api/authGoogle'));_0x471a81[_0xa177('0x6')]('/api/auth/activedirectory',require(_0xa177('0xf6')));_0x471a81[_0xa177('0x6')](_0xa177('0xf7'),require(_0xa177('0xf8')));_0x471a81['use']('/api/rpc',require(_0xa177('0xf9')));_0x471a81[_0xa177('0x6')](_0xa177('0xfa'),require(_0xa177('0xfb')));_0x471a81[_0xa177('0x6')](_0xa177('0xfc'),require('./api/system'));_0x471a81[_0xa177('0x6')](_0xa177('0xfd'),require(_0xa177('0xfe')));_0x471a81['use']('/api/webbar',require(_0xa177('0xff')));_0x471a81['use']('/api/logs',clientSideLogs);_0x471a81[_0xa177('0x6')](_0xa177('0x100'),express['static'](path[_0xa177('0x101')](config['root'],_0xa177('0x100'))));_0x471a81['use'](_0xa177('0x102'),express[_0xa177('0x103')](path[_0xa177('0x101')](config[_0xa177('0x104')],_0xa177('0x102'))));_0x471a81[_0xa177('0x6')]('/demo',express['static'](path[_0xa177('0x101')](config[_0xa177('0x104')],_0xa177('0x105'))));_0x471a81['use'](_0xa177('0x106'),express[_0xa177('0x103')](path[_0xa177('0x101')](config[_0xa177('0x104')],'snippet','3.5.0')));_0x471a81[_0xa177('0x6')](_0xa177('0x107'),express[_0xa177('0x103')](path['join'](config[_0xa177('0x104')],_0xa177('0x108'))));_0x471a81[_0xa177('0x109')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xa177('0x10a')](errors[0x194]);_0x471a81[_0xa177('0x109')]('/*')[_0xa177('0x10a')](function(_0x1d381d,_0x11a7e4){_0x11a7e4['sendFile'](path[_0xa177('0x10b')](_0x471a81[_0xa177('0x10a')](_0xa177('0x10c'))+_0xa177('0x10d')));});return _0x471a81;});}; \ No newline at end of file +var _0x6873=['./api/disposition','./api/condition','/api/intervals','/api/pauses','./api/pause','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','/api/version','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','root','join','/demo','/snippet','3.5.0','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','use','/api/users','/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/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/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer'];(function(_0x12a63c,_0x1b9867){var _0x13fe51=function(_0x1b5100){while(--_0x1b5100){_0x12a63c['push'](_0x12a63c['shift']());}};_0x13fe51(++_0x1b9867);}(_0x6873,0xac));var _0x3687=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x6873[_0x1e172a];return _0x96338b;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x3687('0x0'));var config=require(_0x3687('0x1'));var setupLoggers=require(_0x3687('0x2'))[_0x3687('0x3')];var clientSideLogs=require(_0x3687('0x4'));exports['default']=function(_0x247d96){return setupLoggers(_0x247d96)['then'](function(){_0x247d96[_0x3687('0x5')](_0x3687('0x6'),require('./api/user'));_0x247d96[_0x3687('0x5')](_0x3687('0x7'),require(_0x3687('0x8')));_0x247d96[_0x3687('0x5')](_0x3687('0x9'),require(_0x3687('0xa')));_0x247d96[_0x3687('0x5')](_0x3687('0xb'),require(_0x3687('0xc')));_0x247d96['use'](_0x3687('0xd'),require(_0x3687('0xe')));_0x247d96['use'](_0x3687('0xf'),require(_0x3687('0x10')));_0x247d96[_0x3687('0x5')](_0x3687('0x11'),require(_0x3687('0x12')));_0x247d96['use'](_0x3687('0x13'),require(_0x3687('0x14')));_0x247d96['use'](_0x3687('0x15'),require(_0x3687('0x16')));_0x247d96[_0x3687('0x5')](_0x3687('0x17'),require(_0x3687('0x18')));_0x247d96[_0x3687('0x5')](_0x3687('0x19'),require(_0x3687('0x1a')));_0x247d96[_0x3687('0x5')]('/api/voice/dials/reports',require(_0x3687('0x1b')));_0x247d96[_0x3687('0x5')](_0x3687('0x1c'),require('./api/voiceAgentReport'));_0x247d96['use'](_0x3687('0x1d'),require(_0x3687('0x1e')));_0x247d96[_0x3687('0x5')](_0x3687('0x1f'),require(_0x3687('0x20')));_0x247d96[_0x3687('0x5')]('/api/trunks',require(_0x3687('0x21')));_0x247d96[_0x3687('0x5')](_0x3687('0x22'),require(_0x3687('0x23')));_0x247d96['use'](_0x3687('0x24'),require('./api/mailServerOut'));_0x247d96[_0x3687('0x5')](_0x3687('0x25'),require(_0x3687('0x26')));_0x247d96[_0x3687('0x5')](_0x3687('0x27'),require(_0x3687('0x28')));_0x247d96[_0x3687('0x5')](_0x3687('0x29'),require(_0x3687('0x2a')));_0x247d96[_0x3687('0x5')](_0x3687('0x2b'),require(_0x3687('0x2c')));_0x247d96[_0x3687('0x5')](_0x3687('0x2d'),require('./api/mailMessage'));_0x247d96['use']('/api/mail/applications',require(_0x3687('0x2e')));_0x247d96[_0x3687('0x5')](_0x3687('0x2f'),require(_0x3687('0x30')));_0x247d96[_0x3687('0x5')](_0x3687('0x31'),require(_0x3687('0x32')));_0x247d96['use']('/api/dashboards/items',require(_0x3687('0x33')));_0x247d96['use'](_0x3687('0x34'),require(_0x3687('0x35')));_0x247d96['use']('/api/fax/applications',require(_0x3687('0x36')));_0x247d96['use'](_0x3687('0x37'),require(_0x3687('0x38')));_0x247d96[_0x3687('0x5')](_0x3687('0x39'),require('./api/faxMessage'));_0x247d96[_0x3687('0x5')](_0x3687('0x3a'),require(_0x3687('0x3b')));_0x247d96['use'](_0x3687('0x3c'),require(_0x3687('0x3d')));_0x247d96[_0x3687('0x5')](_0x3687('0x3e'),require(_0x3687('0x3f')));_0x247d96[_0x3687('0x5')]('/api/sms/applications',require('./api/smsApplication'));_0x247d96[_0x3687('0x5')](_0x3687('0x40'),require('./api/smsInteraction'));_0x247d96['use'](_0x3687('0x41'),require(_0x3687('0x42')));_0x247d96[_0x3687('0x5')](_0x3687('0x43'),require('./api/smsQueue'));_0x247d96[_0x3687('0x5')](_0x3687('0x44'),require(_0x3687('0x45')));_0x247d96[_0x3687('0x5')]('/api/openchannel/applications',require(_0x3687('0x46')));_0x247d96['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x247d96[_0x3687('0x5')](_0x3687('0x47'),require(_0x3687('0x48')));_0x247d96[_0x3687('0x5')]('/api/openchannel/queues',require(_0x3687('0x49')));_0x247d96['use'](_0x3687('0x4a'),require(_0x3687('0x4b')));_0x247d96[_0x3687('0x5')](_0x3687('0x4c'),require('./api/openchannelQueueReport'));_0x247d96['use'](_0x3687('0x4d'),require('./api/chatApplication'));_0x247d96[_0x3687('0x5')](_0x3687('0x4e'),require(_0x3687('0x4f')));_0x247d96[_0x3687('0x5')](_0x3687('0x50'),require(_0x3687('0x51')));_0x247d96[_0x3687('0x5')](_0x3687('0x52'),require(_0x3687('0x53')));_0x247d96[_0x3687('0x5')](_0x3687('0x54'),require(_0x3687('0x55')));_0x247d96['use'](_0x3687('0x56'),require(_0x3687('0x57')));_0x247d96[_0x3687('0x5')]('/api/chat/proactive_actions',require(_0x3687('0x58')));_0x247d96['use'](_0x3687('0x59'),require(_0x3687('0x5a')));_0x247d96['use']('/api/cm/contacts',require(_0x3687('0x5b')));_0x247d96[_0x3687('0x5')]('/api/cm/hopper',require(_0x3687('0x5c')));_0x247d96[_0x3687('0x5')](_0x3687('0x5d'),require('./api/cmHopperBlack'));_0x247d96[_0x3687('0x5')](_0x3687('0x5e'),require('./api/cmHopperFinal'));_0x247d96['use'](_0x3687('0x5f'),require('./api/cmHopperHistory'));_0x247d96['use'](_0x3687('0x60'),require(_0x3687('0x61')));_0x247d96[_0x3687('0x5')](_0x3687('0x62'),require('./api/action'));_0x247d96[_0x3687('0x5')](_0x3687('0x63'),require(_0x3687('0x64')));_0x247d96[_0x3687('0x5')](_0x3687('0x65'),require(_0x3687('0x66')));_0x247d96[_0x3687('0x5')]('/api/dispositions',require(_0x3687('0x67')));_0x247d96[_0x3687('0x5')]('/api/conditions',require(_0x3687('0x68')));_0x247d96['use'](_0x3687('0x69'),require('./api/interval'));_0x247d96[_0x3687('0x5')](_0x3687('0x6a'),require(_0x3687('0x6b')));_0x247d96[_0x3687('0x5')]('/api/cdr',require('./api/cdr'));_0x247d96[_0x3687('0x5')]('/api/voiceQueuesLog',require(_0x3687('0x6c')));_0x247d96[_0x3687('0x5')]('/api/schedules',require('./api/schedule'));_0x247d96[_0x3687('0x5')](_0x3687('0x6d'),require(_0x3687('0x6e')));_0x247d96[_0x3687('0x5')](_0x3687('0x6f'),require(_0x3687('0x70')));_0x247d96[_0x3687('0x5')]('/api/contact_item_types',require('./api/contactItemType'));_0x247d96[_0x3687('0x5')](_0x3687('0x71'),require(_0x3687('0x72')));_0x247d96[_0x3687('0x5')]('/api/cm_hopper_additional_phones',require(_0x3687('0x73')));_0x247d96[_0x3687('0x5')](_0x3687('0x74'),require('./api/template'));_0x247d96[_0x3687('0x5')]('/api/triggers',require(_0x3687('0x75')));_0x247d96['use'](_0x3687('0x76'),require(_0x3687('0x77')));_0x247d96[_0x3687('0x5')](_0x3687('0x78'),require(_0x3687('0x79')));_0x247d96[_0x3687('0x5')]('/api/integrations/reports',require(_0x3687('0x7a')));_0x247d96[_0x3687('0x5')](_0x3687('0x7b'),require(_0x3687('0x7c')));_0x247d96[_0x3687('0x5')](_0x3687('0x7d'),require(_0x3687('0x7e')));_0x247d96['use'](_0x3687('0x7f'),require(_0x3687('0x80')));_0x247d96['use'](_0x3687('0x81'),require(_0x3687('0x82')));_0x247d96[_0x3687('0x5')](_0x3687('0x83'),require(_0x3687('0x84')));_0x247d96[_0x3687('0x5')](_0x3687('0x85'),require(_0x3687('0x86')));_0x247d96[_0x3687('0x5')](_0x3687('0x87'),require(_0x3687('0x88')));_0x247d96[_0x3687('0x5')](_0x3687('0x89'),require(_0x3687('0x8a')));_0x247d96[_0x3687('0x5')](_0x3687('0x8b'),require('./api/intSalesforceField'));_0x247d96[_0x3687('0x5')]('/api/integrations/sugarcrm/accounts',require(_0x3687('0x8c')));_0x247d96[_0x3687('0x5')](_0x3687('0x8d'),require(_0x3687('0x8e')));_0x247d96[_0x3687('0x5')](_0x3687('0x8f'),require(_0x3687('0x90')));_0x247d96[_0x3687('0x5')](_0x3687('0x91'),require(_0x3687('0x92')));_0x247d96['use'](_0x3687('0x93'),require(_0x3687('0x94')));_0x247d96['use'](_0x3687('0x95'),require(_0x3687('0x96')));_0x247d96[_0x3687('0x5')](_0x3687('0x97'),require(_0x3687('0x98')));_0x247d96[_0x3687('0x5')]('/api/integrations/zoho/configurations',require(_0x3687('0x99')));_0x247d96['use'](_0x3687('0x9a'),require(_0x3687('0x9b')));_0x247d96[_0x3687('0x5')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x247d96[_0x3687('0x5')](_0x3687('0x9c'),require(_0x3687('0x9d')));_0x247d96[_0x3687('0x5')](_0x3687('0x9e'),require(_0x3687('0x9f')));_0x247d96[_0x3687('0x5')](_0x3687('0xa0'),require(_0x3687('0xa1')));_0x247d96[_0x3687('0x5')](_0x3687('0xa2'),require(_0x3687('0xa3')));_0x247d96[_0x3687('0x5')]('/api/integrations/freshdesk/fields',require(_0x3687('0xa4')));_0x247d96[_0x3687('0x5')]('/api/integrations/vtiger/accounts',require(_0x3687('0xa5')));_0x247d96['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x247d96[_0x3687('0x5')](_0x3687('0xa6'),require(_0x3687('0xa7')));_0x247d96[_0x3687('0x5')](_0x3687('0xa8'),require(_0x3687('0xa9')));_0x247d96[_0x3687('0x5')](_0x3687('0xaa'),require(_0x3687('0xab')));_0x247d96['use'](_0x3687('0xac'),require(_0x3687('0xad')));_0x247d96[_0x3687('0x5')](_0x3687('0xae'),require(_0x3687('0xaf')));_0x247d96[_0x3687('0x5')](_0x3687('0xb0'),require(_0x3687('0xb1')));_0x247d96[_0x3687('0x5')](_0x3687('0xb2'),require(_0x3687('0xb3')));_0x247d96[_0x3687('0x5')]('/api/integrations/freshsales/accounts',require(_0x3687('0xb4')));_0x247d96[_0x3687('0x5')](_0x3687('0xb5'),require(_0x3687('0xb6')));_0x247d96[_0x3687('0x5')](_0x3687('0xb7'),require(_0x3687('0xb8')));_0x247d96[_0x3687('0x5')](_0x3687('0xb9'),require(_0x3687('0xba')));_0x247d96[_0x3687('0x5')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x247d96[_0x3687('0x5')]('/api/chat/internal/messages',require(_0x3687('0xbb')));_0x247d96[_0x3687('0x5')](_0x3687('0xbc'),require(_0x3687('0xbd')));_0x247d96[_0x3687('0x5')](_0x3687('0xbe'),require('./api/jscriptyQuestionReport'));_0x247d96[_0x3687('0x5')](_0x3687('0xbf'),require('./api/jscriptySessionReport'));_0x247d96[_0x3687('0x5')](_0x3687('0xc0'),require(_0x3687('0xc1')));_0x247d96[_0x3687('0x5')]('/api/square/reports',require(_0x3687('0xc2')));_0x247d96['use'](_0x3687('0xc3'),require(_0x3687('0xc4')));_0x247d96[_0x3687('0x5')](_0x3687('0xc5'),require(_0x3687('0xc6')));_0x247d96[_0x3687('0x5')](_0x3687('0xc7'),require(_0x3687('0xc8')));_0x247d96[_0x3687('0x5')](_0x3687('0xc9'),require(_0x3687('0xca')));_0x247d96[_0x3687('0x5')](_0x3687('0xcb'),require(_0x3687('0xcc')));_0x247d96[_0x3687('0x5')](_0x3687('0xcd'),require(_0x3687('0xce')));_0x247d96[_0x3687('0x5')]('/api/square/messages',require('./api/squareMessage'));_0x247d96['use'](_0x3687('0xcf'),require(_0x3687('0xd0')));_0x247d96[_0x3687('0x5')](_0x3687('0xd1'),require(_0x3687('0xd2')));_0x247d96['use'](_0x3687('0xd3'),require(_0x3687('0xd4')));_0x247d96[_0x3687('0x5')](_0x3687('0xd5'),require('./api/migration'));_0x247d96['use']('/api/attachments',require(_0x3687('0xd6')));_0x247d96[_0x3687('0x5')](_0x3687('0xd7'),require(_0x3687('0xd8')));_0x247d96[_0x3687('0x5')]('/api/mail/reports/transfer',require(_0x3687('0xd9')));_0x247d96[_0x3687('0x5')]('/api/chat/reports/transfer',require(_0x3687('0xda')));_0x247d96[_0x3687('0x5')]('/api/fax/reports/transfer',require(_0x3687('0xdb')));_0x247d96[_0x3687('0x5')]('/api/openchannel/reports/transfer',require(_0x3687('0xdc')));_0x247d96[_0x3687('0x5')]('/api/sms/reports/transfer',require(_0x3687('0xdd')));_0x247d96['use'](_0x3687('0xde'),require(_0x3687('0xdf')));_0x247d96[_0x3687('0x5')](_0x3687('0xe0'),require(_0x3687('0xe1')));_0x247d96[_0x3687('0x5')](_0x3687('0xe2'),require(_0x3687('0xe3')));_0x247d96['use'](_0x3687('0xe4'),require(_0x3687('0xe5')));_0x247d96[_0x3687('0x5')]('/api/userProfile/resources',require(_0x3687('0xe6')));_0x247d96[_0x3687('0x5')]('/api/userNotifications',require('./api/userNotification'));_0x247d96[_0x3687('0x5')](_0x3687('0xe7'),require(_0x3687('0xe8')));_0x247d96[_0x3687('0x5')](_0x3687('0xe9'),require(_0x3687('0xea')));_0x247d96[_0x3687('0x5')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x247d96[_0x3687('0x5')](_0x3687('0xeb'),require(_0x3687('0xec')));_0x247d96[_0x3687('0x5')](_0x3687('0xed'),require('./api/whatsappQueueReport'));_0x247d96[_0x3687('0x5')](_0x3687('0xee'),require(_0x3687('0xef')));_0x247d96[_0x3687('0x5')](_0x3687('0xf0'),require(_0x3687('0xf1')));_0x247d96[_0x3687('0x5')](_0x3687('0xf2'),require(_0x3687('0xf3')));_0x247d96['use'](_0x3687('0xf4'),require(_0x3687('0xf5')));_0x247d96[_0x3687('0x5')](_0x3687('0xf6'),require(_0x3687('0xf7')));_0x247d96['use']('/api/auth/local',require(_0x3687('0xf8')));_0x247d96[_0x3687('0x5')](_0x3687('0xf9'),require(_0x3687('0xfa')));_0x247d96[_0x3687('0x5')](_0x3687('0xfb'),require('./api/authActiveDirectory'));_0x247d96[_0x3687('0x5')](_0x3687('0xfc'),require('./api/jira'));_0x247d96[_0x3687('0x5')]('/api/rpc',require(_0x3687('0xfd')));_0x247d96[_0x3687('0x5')](_0x3687('0xfe'),require('./api/version'));_0x247d96[_0x3687('0x5')]('/api/system',require('./api/system'));_0x247d96[_0x3687('0x5')](_0x3687('0xff'),require(_0x3687('0x100')));_0x247d96[_0x3687('0x5')]('/api/webbar',require(_0x3687('0x101')));_0x247d96[_0x3687('0x5')](_0x3687('0x102'),clientSideLogs);_0x247d96[_0x3687('0x5')](_0x3687('0x103'),express[_0x3687('0x104')](path['join'](config[_0x3687('0x105')],_0x3687('0x103'))));_0x247d96[_0x3687('0x5')]('/www',express[_0x3687('0x104')](path[_0x3687('0x106')](config['root'],'/www')));_0x247d96[_0x3687('0x5')]('/demo',express[_0x3687('0x104')](path[_0x3687('0x106')](config[_0x3687('0x105')],_0x3687('0x107'))));_0x247d96[_0x3687('0x5')](_0x3687('0x108'),express[_0x3687('0x104')](path['join'](config[_0x3687('0x105')],'snippet',_0x3687('0x109'))));_0x247d96[_0x3687('0x5')](_0x3687('0x10a'),express['static'](path[_0x3687('0x106')](config[_0x3687('0x105')],_0x3687('0x10b'))));_0x247d96['route'](_0x3687('0x10c'))[_0x3687('0x10d')](errors[0x194]);_0x247d96[_0x3687('0x10e')]('/*')[_0x3687('0x10d')](function(_0x330a1d,_0x4d454f){_0x4d454f[_0x3687('0x10f')](path[_0x3687('0x110')](_0x247d96[_0x3687('0x10d')](_0x3687('0x111'))+_0x3687('0x112')));});return _0x247d96;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index d551b94..f861cf9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1823=['../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc'];(function(_0x4bcac2,_0x18bc5f){var _0xf1f9a1=function(_0x26ad6a){while(--_0x26ad6a){_0x4bcac2['push'](_0x4bcac2['shift']());}};_0xf1f9a1(++_0x18bc5f);}(_0x1823,0xe6));var _0x3182=function(_0x51dbba,_0x817f0d){_0x51dbba=_0x51dbba-0x0;var _0x34906d=_0x1823[_0x51dbba];return _0x34906d;};'use strict';var jayson=require(_0x3182('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x3182('0x1')]=function(){return new Promise(function(_0x4db0c4,_0x47cfdf){var _0x1d55f0={};_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x3')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x4')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x5')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x6')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x7')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x8')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x9')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xa')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0xb')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xc')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/mailServerIn/mailServerIn.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xd')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0xe')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0xf')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x10')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/mailApplication/mailApplication.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x11')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x12')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/faxApplication/faxApplication.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/faxInteraction/faxInteraction.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x13')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x14')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x15')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x16')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/smsInteraction/smsInteraction.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x17')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/smsQueue/smsQueue.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x18')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x19')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1a')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1b')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1c')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1d')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x1e')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x1f')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/cmHopper/cmHopper.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x20')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x21')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x22')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x23')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/interval/interval.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x24')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x25')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x26')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x27')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/trigger/trigger.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/variable/variable.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x28')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x29')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x2a')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2b')));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2c')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x2d')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2e')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/setting/setting.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareOdbc/squareOdbc.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/squareProject/squareProject.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x2f')));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x30')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/campaign/campaign.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require(_0x3182('0x31')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/plugin/plugin.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x32')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x33')));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1d55f0=_['merge'](_0x1d55f0,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1d55f0=_[_0x3182('0x2')](_0x1d55f0,require(_0x3182('0x34')));var _0x50db7b=jayson[_0x3182('0x35')](_0x1d55f0)[_0x3182('0x36')]();var _0x18d7b2=config[_0x3182('0x37')][_0x3182('0x38')]||config[_0x3182('0x38')]+0x1;var _0x3d5198=config[_0x3182('0x37')]['ip']||'localhost';_0x50db7b['on'](_0x3182('0x39'),function(_0xa6c970){return _0x47cfdf(_0xa6c970);});_0x50db7b[_0x3182('0x1')](_0x18d7b2,_0x3d5198,function(){console[_0x3182('0x3a')](_0x3182('0x3b'),_0x3d5198,_0x18d7b2);require(_0x3182('0x3c'))[_0x3182('0x3d')]();return _0x4db0c4('RPC\x20listening\x20on\x20'+_0x3d5198+':'+_0x18d7b2);});});}; \ No newline at end of file +var _0x2db5=['../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.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','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../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/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x4be149,_0x5482d0){var _0x33f931=function(_0x5b8746){while(--_0x5b8746){_0x4be149['push'](_0x4be149['shift']());}};_0x33f931(++_0x5482d0);}(_0x2db5,0x168));var _0x52db=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x2db5[_0x352d28];return _0x387d7e;};'use strict';var jayson=require('jayson/promise');var _=require(_0x52db('0x0'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x90b3e0,_0x5ae310){var _0x384f8d={};_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x1')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x2')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x3')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x5')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x6')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x7')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x8')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x9')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/memberReport/memberReport.rpc'));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0xa')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0xb')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0xc')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/mailServerIn/mailServerIn.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0xd')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0xe')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0xf')));_0x384f8d=_['merge'](_0x384f8d,require('../api/mailMessage/mailMessage.rpc'));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x10')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x11')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x12')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/faxInteraction/faxInteraction.rpc'));_0x384f8d=_['merge'](_0x384f8d,require('../api/faxMessage/faxMessage.rpc'));_0x384f8d=_['merge'](_0x384f8d,require('../api/faxQueue/faxQueue.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x13')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x14')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x15')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x16')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x17')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x18')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x19')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1a')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1b')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1c')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1d')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1e')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/cmHopper/cmHopper.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x1f')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x20')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x21')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/interval/interval.rpc'));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x22')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x23')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x24')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/trigger/trigger.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x25')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x26')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x27')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x28')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x29')));_0x384f8d=_['merge'](_0x384f8d,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x2a')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x2b')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x2c')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x2d')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x2e')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x2f')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x30')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/squareOdbc/squareOdbc.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/squareProject/squareProject.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x31')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x32')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/campaign/campaign.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x33')));_0x384f8d=_['merge'](_0x384f8d,require(_0x52db('0x34')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x35')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x36')));_0x384f8d=_[_0x52db('0x4')](_0x384f8d,require(_0x52db('0x37')));var _0xefc9f3=jayson['server'](_0x384f8d)[_0x52db('0x38')]();var _0x5b826b=config[_0x52db('0x39')]['port']||config[_0x52db('0x3a')]+0x1;var _0x411a79=config[_0x52db('0x39')]['ip']||_0x52db('0x3b');_0xefc9f3['on'](_0x52db('0x3c'),function(_0x266d13){return _0x5ae310(_0x266d13);});_0xefc9f3[_0x52db('0x3d')](_0x5b826b,_0x411a79,function(){console[_0x52db('0x3e')](_0x52db('0x3f'),_0x411a79,_0x5b826b);require(_0x52db('0x40'))[_0x52db('0x41')]();return _0x90b3e0(_0x52db('0x42')+_0x411a79+':'+_0x5b826b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f33b214..17c043a 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 _0x0a01=['no\x20code','indexOf','substr','split','length','match','error','code','close','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','EventEmitter','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring'];(function(_0x3d407c,_0x8127b5){var _0x7d17dc=function(_0xe3f088){while(--_0xe3f088){_0x3d407c['push'](_0x3d407c['shift']());}};_0x7d17dc(++_0x8127b5);}(_0x0a01,0x10b));var _0x10a0=function(_0x434148,_0x3fd957){_0x434148=_0x434148-0x0;var _0x27fabb=_0x0a01[_0x434148];return _0x27fabb;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0x10a0('0x0')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0xbfcec3){var _0x4c9f4a=this,_0x32a034=new AGIReply(),_0x3fc5fa=![],_0x290eb9={};EventEmitter[_0x10a0('0x1')](_0x4c9f4a);_0xbfcec3[_0x10a0('0x2')](_0x10a0('0x3'));_0xbfcec3['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x32a034[_0x10a0('0x2')](_0x10a0('0x3'));_0x32a034['on'](_0x10a0('0x4'),function(_0xee5289){for(var _0x46fc47 in _0xee5289){_0x4c9f4a[_0x46fc47]=_0xee5289[_0x46fc47];}_0x4c9f4a[_0x10a0('0x5')]('ready');});_0x32a034['on'](_0x10a0('0x6'),function(_0x1b9311){if(_0x1b9311[_0x10a0('0x7')]()=='hangup'){_0x4c9f4a['emit'](_0x10a0('0x8'));return;}if(_0x1b9311['substring'](0x0,0xb)=='520-Invalid'){_0x3fc5fa=!![];}if(_0x3fc5fa){_0x290eb9['rx']+=_0x1b9311+'\x0a';if(_0x1b9311[_0x10a0('0x9')](_0x10a0('0xa'))!=-0x1){_0x3fc5fa=![];}}else{_0x290eb9['rx']=_0x1b9311;}if(_0x3fc5fa){return;}if(typeof _0x290eb9['cb']==_0x10a0('0xb')){var _0x357800=_0x290eb9['rx'][_0x10a0('0xc')](0x0,0x3),_0x59eb39=null,_0x4fba55=null;_0x357800=parseInt(_0x357800);if(isNaN(_0x357800)){_0x290eb9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x10a0('0xd')});return;}if(_0x357800!=0xc8){_0x290eb9['cb'](null,{'code':_0x357800,'result':-0x1,'extra':'KO'});return;}_0x59eb39=_0x290eb9['rx'][_0x10a0('0xc')](0x4)['replace']('result=','');if(_0x59eb39[_0x10a0('0xe')]('\x20')!=-0x1){_0x59eb39=_0x59eb39[_0x10a0('0xf')](0x0,_0x59eb39[_0x10a0('0xe')]('\x20'));}if(_['startsWith'](_0x59eb39,'-1')){_0x59eb39=parseInt(_0x59eb39);}_0x4fba55=_0x290eb9['rx'][_0x10a0('0x10')]('\x20');if(_0x4fba55[_0x10a0('0x11')]==0x3){_0x4fba55=_0x4fba55[0x2]['substring'](0x1,_0x4fba55[0x2]['length']-0x1);}else if(_0x4fba55[_0x10a0('0x11')]>0x3){var _0x100d77=/\((.+)\)/;var _0x464cb3=_0x290eb9['rx'][_0x10a0('0x12')](_0x100d77);if(_0x464cb3){_0x4fba55=_0x464cb3[0x1];}else{_0x4fba55=null;}}else{_0x4fba55=null;}_0x290eb9['cb'](null,{'code':_0x357800,'result':_0x59eb39,'extra':_0x4fba55});}});_0xbfcec3['on'](_0x10a0('0x13'),function(_0xe57eae){_0x4c9f4a[_0x10a0('0x5')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0xe57eae[_0x10a0('0x14')]));});_0xbfcec3['on'](_0x10a0('0x15'),function(){_0x4c9f4a[_0x10a0('0x5')](_0x10a0('0x15'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0xbfcec3['on']('timeout',function(){_0x4c9f4a[_0x10a0('0x5')](_0x10a0('0x16'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0xbfcec3[_0x10a0('0x17')]();});_0xbfcec3['pipe'](_0x32a034);this[_0x10a0('0x18')]=function(_0x1a31ca,_0x108486){var _0x1a31ca=_0x1a31ca||'',_0x108486=typeof _0x108486==_0x10a0('0xb')?_0x108486:new Function();_0x290eb9={'tx':_0x1a31ca,'rx':'','cb':_0x108486};_0xbfcec3[_0x10a0('0x19')](_0x1a31ca+'\x0a');},this[_0x10a0('0x15')]=function(){_0xbfcec3[_0x10a0('0x17')]();};}util[_0x10a0('0x1a')](AGIChannel,EventEmitter);AGIChannel[_0x10a0('0x1b')][_0x10a0('0x1c')]=function(_0x36a7b9){return this[_0x10a0('0x18')][_0x10a0('0x1d')](this,_0x36a7b9);};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x1e')]=function(){return this['sendRequest'](_0x10a0('0x1f'));};AGIChannel['prototype'][_0x10a0('0x20')]=function(_0x50f56f,_0x1eda45,_0x41ffde){_0x50f56f=_0x50f56f===undefined?_0x10a0('0x21'):_0x50f56f;_0x1eda45=_0x1eda45===undefined?'5':_0x1eda45;_0x41ffde=_0x41ffde===undefined?'1':_0x41ffde;return this[_0x10a0('0x1c')](util[_0x10a0('0x22')](_0x10a0('0x23'),_0x50f56f,_0x1eda45*0x3e8,_0x41ffde));};AGIChannel['prototype'][_0x10a0('0x24')]=function(_0x5c1ec7){_0x5c1ec7=_0x5c1ec7||'NO\x20MESSAGE';return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('VERBOSE\x20\x22%s\x22',_0x5c1ec7));};AGIChannel[_0x10a0('0x1b')]['exec']=function(_0x926a0e,_0x1bc73f){if(_[_0x10a0('0x25')](_0x1bc73f)){return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('EXEC\x20%s\x20%s',_0x926a0e,_0x1bc73f[_0x10a0('0x26')](',')));}return this[_0x10a0('0x1c')](util[_0x10a0('0x22')](_0x10a0('0x27'),_0x926a0e,_0x1bc73f));};AGIChannel['prototype']['setContext']=function(_0x8d6bc4){return this['sendRequest'](util[_0x10a0('0x22')]('SET\x20CONTEXT\x20%s',_0x8d6bc4));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x28')]=function(_0x88275a){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x29'),_0x88275a));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x2a')]=function(_0x2cf451){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x2b'),_0x2cf451));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x8')]=function(){return this[_0x10a0('0x1c')](_0x10a0('0x2c'));};AGIChannel['prototype'][_0x10a0('0x2d')]=function(_0x2445ab,_0x64e896){var _0x5a097d=_['isBoolean'](_0x64e896)||_[_0x10a0('0x2e')](_0x64e896)?_0x64e896['toString']():_0x64e896;return this[_0x10a0('0x1c')](util['format'](_0x10a0('0x2f'),_0x2445ab,_0x5a097d?_0x5a097d[_0x10a0('0x30')]()[_0x10a0('0x31')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x3e3fc4,_0x359cce){return this['sendRequest'](util['format'](_0x10a0('0x32'),_0x3e3fc4,_0x359cce));};AGIChannel['prototype']['sayDigits']=function(_0x3c01c7,_0x3f7abb){return this['sendRequest'](util[_0x10a0('0x22')](_0x10a0('0x33'),_0x3c01c7,_0x3f7abb));};AGIChannel[_0x10a0('0x1b')]['sayPhonetic']=function(_0x59fe00,_0x5643c0){return this[_0x10a0('0x1c')](util[_0x10a0('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x59fe00,_0x5643c0));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x34')]=function(_0x510415,_0x2ee76f,_0x1f10b4){_0x2ee76f=_0x2ee76f||this[_0x10a0('0x35')];_0x1f10b4=_0x1f10b4||0x1;this[_0x10a0('0x36')](_0x510415);this['setExtension'](_0x2ee76f);this[_0x10a0('0x2a')](_0x1f10b4);return this[_0x10a0('0x24')](util[_0x10a0('0x22')](_0x10a0('0x37'),_0x510415,_0x2ee76f,_0x1f10b4));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x38')]=function(_0x7d2d9f){return this['sendRequest'](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x7d2d9f));};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x39')]=function(_0x4ee653,_0x3c6bde,_0x3b0471,_0x3a5540,_0x4a6ea9,_0x3a94eb){_0x3c6bde=_0x3c6bde||_0x10a0('0x3a');_0x3b0471=_0x3b0471||'';_0x3a5540=_0x3a5540===undefined?-0x1:_0x3a5540==='-1'?-0x1:_0x3a5540*0x3e8;_0x4a6ea9=_0x4a6ea9===undefined?'':'s='+_0x4a6ea9;_0x3a94eb=_0x3a94eb?_0x10a0('0x3b'):'';return this[_0x10a0('0x1c')](util['format'](_0x10a0('0x3c'),_0x4ee653,_0x3c6bde,_0x3b0471,_0x3a5540,_0x3a94eb,_0x4a6ea9));};AGIChannel['prototype']['streamFile']=function(_0x518355,_0x909de3){_0x909de3=_0x909de3||'';return this['sendRequest'](util['format'](_0x10a0('0x3d'),_0x518355,_0x909de3));};AGIChannel['prototype'][_0x10a0('0x3e')]=function(_0x5a92a7){return this[_0x10a0('0x3f')](_0x10a0('0x40'),_0x5a92a7);};AGIChannel[_0x10a0('0x1b')][_0x10a0('0x41')]=function(_0x7a7eda){return this['exec'](_0x10a0('0x42'),_0x7a7eda);};AGIChannel[_0x10a0('0x1b')]['error']=function(_0x923863,_0x579fdd){this[_0x10a0('0x24')](util[_0x10a0('0x22')](_0x10a0('0x43'),_0x923863['id'],_0x923863[_0x10a0('0x44')],_0x579fdd));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x10a0('0x45')]=AGIChannel; \ No newline at end of file +var _0x8ba4=['error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','prototype','command','sync','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','exec','AGI','wait','noop','exports','util','lodash','events','./reply','./error','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match'];(function(_0x362231,_0x1aaa40){var _0x2e8e0d=function(_0x1afe09){while(--_0x1afe09){_0x362231['push'](_0x362231['shift']());}};_0x2e8e0d(++_0x1aaa40);}(_0x8ba4,0x1ec));var _0x48ba=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0x8ba4[_0xa9eaa0];return _0x30897a;};'use strict';var util=require(_0x48ba('0x0'));var _=require(_0x48ba('0x1'));var EventEmitter=require(_0x48ba('0x2'))['EventEmitter'];var AGIReply=require(_0x48ba('0x3'));var AGIError=require(_0x48ba('0x4'));function AGIChannel(_0x312c35){var _0x36f6d4=this,_0x2f13d4=new AGIReply(),_0x1668d3=![],_0x59c3e3={};EventEmitter[_0x48ba('0x5')](_0x36f6d4);_0x312c35[_0x48ba('0x6')](_0x48ba('0x7'));_0x312c35[_0x48ba('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2f13d4[_0x48ba('0x6')](_0x48ba('0x7'));_0x2f13d4['on']('headers',function(_0x46d0b2){for(var _0x4db999 in _0x46d0b2){_0x36f6d4[_0x4db999]=_0x46d0b2[_0x4db999];}_0x36f6d4[_0x48ba('0x9')](_0x48ba('0xa'));});_0x2f13d4['on'](_0x48ba('0xb'),function(_0x363c0c){if(_0x363c0c[_0x48ba('0xc')]()==_0x48ba('0xd')){_0x36f6d4[_0x48ba('0x9')]('hangup');return;}if(_0x363c0c[_0x48ba('0xe')](0x0,0xb)=='520-Invalid'){_0x1668d3=!![];}if(_0x1668d3){_0x59c3e3['rx']+=_0x363c0c+'\x0a';if(_0x363c0c[_0x48ba('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x1668d3=![];}}else{_0x59c3e3['rx']=_0x363c0c;}if(_0x1668d3){return;}if(typeof _0x59c3e3['cb']==_0x48ba('0x10')){var _0x145e9b=_0x59c3e3['rx']['substring'](0x0,0x3),_0x13002c=null,_0x802aa6=null;_0x145e9b=parseInt(_0x145e9b);if(isNaN(_0x145e9b)){_0x59c3e3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x48ba('0x11')});return;}if(_0x145e9b!=0xc8){_0x59c3e3['cb'](null,{'code':_0x145e9b,'result':-0x1,'extra':'KO'});return;}_0x13002c=_0x59c3e3['rx'][_0x48ba('0xe')](0x4)[_0x48ba('0x12')](_0x48ba('0x13'),'');if(_0x13002c[_0x48ba('0x14')]('\x20')!=-0x1){_0x13002c=_0x13002c[_0x48ba('0x15')](0x0,_0x13002c[_0x48ba('0x14')]('\x20'));}if(_[_0x48ba('0x16')](_0x13002c,'-1')){_0x13002c=parseInt(_0x13002c);}_0x802aa6=_0x59c3e3['rx'][_0x48ba('0x17')]('\x20');if(_0x802aa6[_0x48ba('0x18')]==0x3){_0x802aa6=_0x802aa6[0x2][_0x48ba('0xe')](0x1,_0x802aa6[0x2]['length']-0x1);}else if(_0x802aa6[_0x48ba('0x18')]>0x3){var _0x1d0853=/\((.+)\)/;var _0x2977f2=_0x59c3e3['rx'][_0x48ba('0x19')](_0x1d0853);if(_0x2977f2){_0x802aa6=_0x2977f2[0x1];}else{_0x802aa6=null;}}else{_0x802aa6=null;}_0x59c3e3['cb'](null,{'code':_0x145e9b,'result':_0x13002c,'extra':_0x802aa6});}});_0x312c35['on'](_0x48ba('0x1a'),function(_0x450633){_0x36f6d4['emit'](_0x48ba('0x1a'),new AGIError(_0x48ba('0x1b'),_0x450633['code']));});_0x312c35['on'](_0x48ba('0x1c'),function(){_0x36f6d4[_0x48ba('0x9')](_0x48ba('0x1c'),new AGIError(_0x48ba('0x1d')));});_0x312c35['on'](_0x48ba('0x1e'),function(){_0x36f6d4[_0x48ba('0x9')](_0x48ba('0x1e'),new AGIError(_0x48ba('0x1f')));_0x312c35[_0x48ba('0x20')]();});_0x312c35['pipe'](_0x2f13d4);this['command']=function(_0x5b5d32,_0x42f1fa){var _0x5b5d32=_0x5b5d32||'',_0x42f1fa=typeof _0x42f1fa==_0x48ba('0x10')?_0x42f1fa:new Function();_0x59c3e3={'tx':_0x5b5d32,'rx':'','cb':_0x42f1fa};_0x312c35[_0x48ba('0x21')](_0x5b5d32+'\x0a');},this[_0x48ba('0x1c')]=function(){_0x312c35[_0x48ba('0x20')]();};}util[_0x48ba('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x48ba('0x23')]['sendRequest']=function(_0x306dff){return this[_0x48ba('0x24')][_0x48ba('0x25')](this,_0x306dff);};AGIChannel[_0x48ba('0x23')]['answer']=function(){return this[_0x48ba('0x26')](_0x48ba('0x27'));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x28')]=function(_0x454265,_0x1b8e74,_0x4b967c){_0x454265=_0x454265===undefined?'beep':_0x454265;_0x1b8e74=_0x1b8e74===undefined?'5':_0x1b8e74;_0x4b967c=_0x4b967c===undefined?'1':_0x4b967c;return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x2a'),_0x454265,_0x1b8e74*0x3e8,_0x4b967c));};AGIChannel[_0x48ba('0x23')]['noop']=function(_0x3d03ea){_0x3d03ea=_0x3d03ea||_0x48ba('0x2b');return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x2c'),_0x3d03ea));};AGIChannel[_0x48ba('0x23')]['exec']=function(_0x4775c9,_0x2bc5ff){if(_['isArray'](_0x2bc5ff)){return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x2d'),_0x4775c9,_0x2bc5ff['join'](',')));}return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x2d'),_0x4775c9,_0x2bc5ff));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x2e')]=function(_0x5e80f9){return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x2f'),_0x5e80f9));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x30')]=function(_0x1a4cc0){return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x31'),_0x1a4cc0));};AGIChannel[_0x48ba('0x23')]['setPriority']=function(_0x20d3bf){return this[_0x48ba('0x26')](util['format'](_0x48ba('0x32'),_0x20d3bf));};AGIChannel[_0x48ba('0x23')]['hangup']=function(){return this['sendRequest'](_0x48ba('0x33'));};AGIChannel['prototype'][_0x48ba('0x34')]=function(_0x509cc5,_0x5cf254){var _0x3f7f91=_[_0x48ba('0x35')](_0x5cf254)||_['isNumber'](_0x5cf254)?_0x5cf254['toString']():_0x5cf254;return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x36'),_0x509cc5,_0x3f7f91?_0x3f7f91['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x37')]=function(_0xbc16eb,_0x54a116){return this[_0x48ba('0x26')](util['format'](_0x48ba('0x38'),_0xbc16eb,_0x54a116));};AGIChannel[_0x48ba('0x23')]['sayDigits']=function(_0x4b0b26,_0x55c2fa){return this[_0x48ba('0x26')](util[_0x48ba('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x4b0b26,_0x55c2fa));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x39')]=function(_0x3e32e5,_0x59846b){return this[_0x48ba('0x26')](util['format'](_0x48ba('0x3a'),_0x3e32e5,_0x59846b));};AGIChannel['prototype'][_0x48ba('0x3b')]=function(_0x418c40,_0xf7f7f5,_0x244fb4){_0xf7f7f5=_0xf7f7f5||this[_0x48ba('0x3c')];_0x244fb4=_0x244fb4||0x1;this[_0x48ba('0x2e')](_0x418c40);this[_0x48ba('0x30')](_0xf7f7f5);this['setPriority'](_0x244fb4);return this['noop'](util[_0x48ba('0x29')](_0x48ba('0x3d'),_0x418c40,_0xf7f7f5,_0x244fb4));};AGIChannel['prototype'][_0x48ba('0x3e')]=function(_0x38fe56){return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x3f'),_0x38fe56));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x40')]=function(_0x7c5ece,_0x4b3625,_0x4e56aa,_0xe37981,_0x286f10,_0x482512){_0x4b3625=_0x4b3625||_0x48ba('0x41');_0x4e56aa=_0x4e56aa||'';_0xe37981=_0xe37981===undefined?-0x1:_0xe37981==='-1'?-0x1:_0xe37981*0x3e8;_0x286f10=_0x286f10===undefined?'':'s='+_0x286f10;_0x482512=_0x482512?'BEEP':'';return this['sendRequest'](util[_0x48ba('0x29')](_0x48ba('0x42'),_0x7c5ece,_0x4b3625,_0x4e56aa,_0xe37981,_0x482512,_0x286f10));};AGIChannel['prototype']['streamFile']=function(_0x1ce63a,_0x18ca70){_0x18ca70=_0x18ca70||'';return this[_0x48ba('0x26')](util[_0x48ba('0x29')](_0x48ba('0x43'),_0x1ce63a,_0x18ca70));};AGIChannel[_0x48ba('0x23')][_0x48ba('0x44')]=function(_0x45df07){return this[_0x48ba('0x45')](_0x48ba('0x46'),_0x45df07);};AGIChannel[_0x48ba('0x23')][_0x48ba('0x47')]=function(_0x5e1558){return this[_0x48ba('0x45')]('WAIT',_0x5e1558);};AGIChannel[_0x48ba('0x23')][_0x48ba('0x1a')]=function(_0x7fbfbe,_0xa5167f){this[_0x48ba('0x48')](util[_0x48ba('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x7fbfbe['id'],_0x7fbfbe['label'],_0xa5167f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x48ba('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9f94d14..434d18b 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 _0xdb2d=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','exports'];(function(_0x4931d4,_0x21cce4){var _0x2313c5=function(_0x1ba1f7){while(--_0x1ba1f7){_0x4931d4['push'](_0x4931d4['shift']());}};_0x2313c5(++_0x21cce4);}(_0xdb2d,0xb0));var _0xddb2=function(_0x3da616,_0xfb8402){_0x3da616=_0x3da616-0x0;var _0x1e290c=_0xdb2d[_0x3da616];return _0x1e290c;};'use strict';var util=require(_0xddb2('0x0'));var error={'E_AGI_UNDEFINED':_0xddb2('0x1'),'E_AGI_ARGUMENT_PORT':_0xddb2('0x2'),'E_AGI_SERVER_ERROR':_0xddb2('0x3'),'E_AGI_SERVER_CLOSE':_0xddb2('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xddb2('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xddb2('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xddb2('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xddb2('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xddb2('0x9'),'E_AGI_IVR_ENTRY':_0xddb2('0xa')};function AGIError(_0x5b35a7){var _0x5b35a7=_0x5b35a7||null,_0x418fff=_0x418fff||[],_0x26c36a=0x1,_0x1c5225='';if(!error[_0x5b35a7]){_0x5b35a7=_0xddb2('0xb');}_0x418fff[_0xddb2('0xc')](error[_0x5b35a7]);while(arguments[_0x26c36a]){_0x418fff[_0xddb2('0xc')](arguments[_0x26c36a]);_0x26c36a++;}_0x1c5225=util['format'][_0xddb2('0xd')](util,_0x418fff);this[_0xddb2('0xe')]=_0x1c5225;this['name']=_0x5b35a7;}module[_0xddb2('0xf')]=AGIError; \ No newline at end of file +var _0xf982=['E_AGI_UNDEFINED','push','format','apply','message','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x7a1565,_0x584f2e){var _0x1d2e21=function(_0x362fca){while(--_0x362fca){_0x7a1565['push'](_0x7a1565['shift']());}};_0x1d2e21(++_0x584f2e);}(_0xf982,0x132));var _0x2f98=function(_0x1dd9c2,_0x51f662){_0x1dd9c2=_0x1dd9c2-0x0;var _0xfc2283=_0xf982[_0x1dd9c2];return _0xfc2283;};'use strict';var util=require(_0x2f98('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x2f98('0x1'),'E_AGI_SERVER_ERROR':_0x2f98('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2f98('0x3'),'E_AGI_SOCKET_ERROR':_0x2f98('0x4'),'E_AGI_SOCKET_CLOSE':_0x2f98('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x2f98('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2f98('0x7'),'E_AGI_IVR_ENTRY':_0x2f98('0x8')};function AGIError(_0x3c48e6){var _0x3c48e6=_0x3c48e6||null,_0x4c2f2d=_0x4c2f2d||[],_0x535341=0x1,_0x487eca='';if(!error[_0x3c48e6]){_0x3c48e6=_0x2f98('0x9');}_0x4c2f2d[_0x2f98('0xa')](error[_0x3c48e6]);while(arguments[_0x535341]){_0x4c2f2d[_0x2f98('0xa')](arguments[_0x535341]);_0x535341++;}_0x487eca=util[_0x2f98('0xb')][_0x2f98('0xc')](util,_0x4c2f2d);this[_0x2f98('0xd')]=_0x487eca;this['name']=_0x3c48e6;}module[_0x2f98('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f5dda71..1314791 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 _0xc2a6=['subscribe','agi','emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2a6,0xe9));var _0x6c2a=function(_0x33fcae,_0x44f874){_0x33fcae=_0x33fcae-0x0;var _0x491ad3=_0xc2a6[_0x33fcae];return _0x491ad3;};'use strict';var _=require('lodash');var EventEmitter=require(_0x6c2a('0x0'))[_0x6c2a('0x1')];var Redis=require(_0x6c2a('0x2'));var AGIError=require(_0x6c2a('0x3'));var config=require(_0x6c2a('0x4'));config[_0x6c2a('0x5')]=_['defaults'](config['redis'],{'host':_0x6c2a('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x6c2a('0x5')]);sub[_0x6c2a('0x7')](_0x6c2a('0x8'),function(_0x29b269){if(_0x29b269)return eventEmitter[_0x6c2a('0x9')](_0x6c2a('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x29b269));});sub['on'](_0x6c2a('0xb'),function(_0x117833,_0x5ee7cc){if(_0x117833!=='agi')return;try{var _0x3b6644=JSON[_0x6c2a('0xc')](_0x5ee7cc);eventEmitter[_0x6c2a('0x9')](_0x6c2a('0xd'),_0x3b6644);}catch(_0x3c9ba9){eventEmitter[_0x6c2a('0x9')]('error',new AGIError(_0x6c2a('0xe'),_0x3c9ba9));}});module[_0x6c2a('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8a22=['lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi','E_AGI_SERVER_ERROR','message','parse','projectUpdate','emit','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8a22,0x1e0));var _0x28a2=function(_0x1560cd,_0x47f574){_0x1560cd=_0x1560cd-0x0;var _0x4ca3f1=_0x8a22[_0x1560cd];return _0x4ca3f1;};'use strict';var _=require(_0x28a2('0x0'));var EventEmitter=require(_0x28a2('0x1'))[_0x28a2('0x2')];var Redis=require(_0x28a2('0x3'));var AGIError=require(_0x28a2('0x4'));var config=require(_0x28a2('0x5'));config[_0x28a2('0x6')]=_['defaults'](config['redis'],{'host':_0x28a2('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x28a2('0x6')]);sub[_0x28a2('0x8')](_0x28a2('0x9'),function(_0x1074c8){if(_0x1074c8)return eventEmitter['emit']('error',new AGIError(_0x28a2('0xa'),_0x1074c8));});sub['on'](_0x28a2('0xb'),function(_0x20ebae,_0x2f1633){if(_0x20ebae!=='agi')return;try{var _0x296c70=JSON[_0x28a2('0xc')](_0x2f1633);eventEmitter['emit'](_0x28a2('0xd'),_0x296c70);}catch(_0x55f463){eventEmitter[_0x28a2('0xe')]('error',new AGIError(_0x28a2('0xa'),_0x55f463));}});module[_0x28a2('0xf')]={'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 217eda7..bd203cc 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 _0x0404=['edges','numberOfEdges','prototype','addVertex','push','size','vertices','getVertex','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','menu','getdigits','getsecretdigits'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x0404,0x12f));var _0x4040=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0x0404[_0x1a8bbc];return _0x212fc2;};'use strict';var _=require('lodash');var logger=require(_0x4040('0x0'))(_0x4040('0x1'));var verticesWithRetry=[_0x4040('0x2'),_0x4040('0x3'),_0x4040('0x4')];var Graph=function(){this['vertices']={};this[_0x4040('0x5')]={};this[_0x4040('0x6')]=0x0;};Graph[_0x4040('0x7')][_0x4040('0x8')]=function(_0x50d20a){this['vertices'][_0x50d20a['id']]=_0x50d20a;this[_0x4040('0x5')][_0x50d20a['id']]=[];};Graph[_0x4040('0x7')]['addEdge']=function(_0x19efd8,_0x2041b,_0x240e6e){this[_0x4040('0x5')][_0x19efd8][_0x4040('0x9')]({'target':_0x2041b,'condition':_0x240e6e});this['numberOfEdges']+=0x1;};Graph[_0x4040('0x7')]['size']=function(){return _[_0x4040('0xa')](this[_0x4040('0xb')]);};Graph[_0x4040('0x7')]['relations']=function(){return this[_0x4040('0x6')];};Graph[_0x4040('0x7')][_0x4040('0xc')]=function(_0x498714){return this[_0x4040('0xb')][_0x498714];};Graph[_0x4040('0x7')]['traverseBFS']=function(_0x5ecfb4,_0x343c74){if(!this[_0x4040('0xb')][_0x5ecfb4]){return logger[_0x4040('0xd')](_0x4040('0xe'));}var _0x47fb87=_0x343c74(this['vertices'][_0x5ecfb4]);if(!_0x47fb87){return logger[_0x4040('0xd')](_0x4040('0xf'));}if(this[_0x4040('0x5')][_0x5ecfb4][_0x4040('0x10')]===0x0){return logger[_0x4040('0xd')](_0x4040('0x11'));}for(var _0x38fb3a=0x0,_0x5cda3f=[],_0x2dc030=![];_0x38fb3a\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','then','catch','hasOwnProperty','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','close','find','handleNotFound','production','handleUnpublished','getLicense'];(function(_0x17ec16,_0x2436e3){var _0x1f59f5=function(_0x165b75){while(--_0x165b75){_0x17ec16['push'](_0x17ec16['shift']());}};_0x1f59f5(++_0x2436e3);}(_0xc9b9,0x152));var _0x9c9b=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0xc9b9[_0x4d45c1];return _0x244478;};'use strict';var _=require(_0x9c9b('0x0'));var syncho=require('syncho');var util=require(_0x9c9b('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x9c9b('0x2'));var utilLicense=require(_0x9c9b('0x3'));var rpc=require(_0x9c9b('0x4'));var Project=require(_0x9c9b('0x5'));var AGIEmitter=require(_0x9c9b('0x6'))[_0x9c9b('0x7')];var projects=[];config[_0x9c9b('0x2')]=_[_0x9c9b('0x8')](config['agi'],{'ip':_0x9c9b('0x9'),'port':0x11dd});AGIEmitter['on'](_0x9c9b('0xa'),projectUpdateHandler);function connectionHandler(_0x220688){process[_0x9c9b('0xb')](function(){syncho(function(){try{setChannelVariables(_0x220688);agiHandler(_0x220688);}catch(_0x13bdd4){logger['error'](_0x13bdd4[_0x9c9b('0xc')]);}});});}function projectUpdateHandler(_0x77f260){try{var _0x1dbb80=_['findIndex'](projects,['id',_0x77f260['id']]);if(_0x1dbb80>-0x1){if(_0x77f260['deleted']===!![]){projects['splice'](_0x1dbb80,0x1);}else{projects[_0x1dbb80]=_0x77f260;}}else{projects[_0x9c9b('0xd')](_0x77f260);}}catch(_0x4b48a2){logger[_0x9c9b('0xe')](_0x4b48a2[_0x9c9b('0xc')]);}}function listeningHandler(){console[_0x9c9b('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9c9b('0x2')][_0x9c9b('0x10')]);logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x13'),config[_0x9c9b('0x2')]['ip'],config[_0x9c9b('0x2')][_0x9c9b('0x10')]));}function errorHandler(_0x41cedf){if(_0x41cedf&&_0x41cedf[_0x9c9b('0x14')]&&_0x41cedf[_0x9c9b('0x15')]){logger[_0x9c9b('0xe')](util[_0x9c9b('0x12')](_0x9c9b('0x16'),_0x41cedf[_0x9c9b('0x14')],_0x41cedf[_0x9c9b('0x15')]));}else{logger['error'](util['format'](_0x9c9b('0x17'),_0x41cedf[_0x9c9b('0xc')]));}}function closeHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x18'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x242464){logger['error'](_0x242464[_0x9c9b('0xc')]);}}function timeoutHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x1c'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x1d'),this[_0x9c9b('0x19')],this['calleridname'],this[_0x9c9b('0x1a')],this[_0x9c9b('0x1b')],this[_0x9c9b('0x1e')]));this[_0x9c9b('0x1f')]=!![];}function createSquareReport(_0x4ae83d,_0x2c2963){rpc['createSquareReport'](_0x4ae83d)[_0x9c9b('0x20')](function(_0x1b1e8c){if(_0x2c2963){_0x2c2963(null,_0x1b1e8c);}})[_0x9c9b('0x21')](function(_0xcb2dba){if(_0x2c2963){_0x2c2963(null,_0xcb2dba);}});}function setChannelVariables(_0x5ad588){for(var _0x6ea8b2 in _0x5ad588){if(_0x5ad588[_0x9c9b('0x22')](_0x6ea8b2)){if(_0x6ea8b2['indexOf'](_0x9c9b('0x23'))===0x0){_0x5ad588[_0x6ea8b2[_0x9c9b('0x24')](0x4)]=_0x5ad588[_0x6ea8b2];delete _0x5ad588[_0x6ea8b2];}}}}function agiHandler(_0x5428cf){logger[_0x9c9b('0x25')]('variables',JSON[_0x9c9b('0x26')](_0x5428cf,null,0x2));logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x27'),_0x5428cf[_0x9c9b('0x19')],_0x5428cf[_0x9c9b('0x28')],_0x5428cf[_0x9c9b('0x1a')],_0x5428cf['dnid'],_0x5428cf[_0x9c9b('0x1e')]));_0x5428cf['on'](_0x9c9b('0xe'),errorHandler);_0x5428cf['on'](_0x9c9b('0x29'),closeHandler);_0x5428cf['on']('timeout',timeoutHandler);_0x5428cf[_0x9c9b('0x1f')]=![];_0x5428cf['on']('hangup',hangupHandler);var _0x3b4944=_[_0x9c9b('0x2a')](projects,[_0x9c9b('0x14'),_0x5428cf[_0x9c9b('0x19')]]);if(!_0x3b4944)return Project[_0x9c9b('0x2b')](_0x5428cf);if(!_0x3b4944[_0x9c9b('0x2c')])return Project[_0x9c9b('0x2d')](_0x5428cf);return Project['initialize'](_0x3b4944,_0x5428cf);}function main(){var _0x523e7b;return utilLicense[_0x9c9b('0x2e')]()[_0x9c9b('0x20')](function(_0x792e05){if(!_0x792e05)return;if(_0x792e05['voice']){if(_0x792e05[_0x9c9b('0x2f')]&&_0x792e05[_0x9c9b('0x2f')]>0x0){logger[_0x9c9b('0x11')](util[_0x9c9b('0x12')](_0x9c9b('0x30'),_0x792e05[_0x9c9b('0x2f')]));_0x523e7b=_0x792e05[_0x9c9b('0x2f')];}else{logger['info'](_0x9c9b('0x31'));}}else{logger[_0x9c9b('0x11')](_0x9c9b('0x32'));_0x523e7b=-0x1;}})['then'](function(){return Project['getAll']();})[_0x9c9b('0x20')](function(_0xb33edb){projects=_0xb33edb;return;})['catch'](function(_0x18fe45){logger[_0x9c9b('0xe')]('[LICENSE]',_0x18fe45['stack']);})[_0x9c9b('0x33')](function(){var _0x38a392=require(_0x9c9b('0x34'))(config[_0x9c9b('0x2')][_0x9c9b('0x10')],config[_0x9c9b('0x2')]['ip'],_0x523e7b);_0x38a392['on'](_0x9c9b('0xe'),errorHandler);_0x38a392['on'](_0x9c9b('0x35'),listeningHandler);_0x38a392['on'](_0x9c9b('0x36'),connectionHandler);_0x38a392['on'](_0x9c9b('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0x0e38=['catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','handleNotFound','production','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','close','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','findIndex','splice','push','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[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','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','createSquareReport','then'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x0e38,0xc4));var _0x80e3=function(_0x1bdb26,_0x1e7723){_0x1bdb26=_0x1bdb26-0x0;var _0x12c404=_0x0e38[_0x1bdb26];return _0x12c404;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x80e3('0x0'));var config=require(_0x80e3('0x1'));var logger=require(_0x80e3('0x2'))(_0x80e3('0x3'));var utilLicense=require(_0x80e3('0x4'));var rpc=require('./rpc');var Project=require(_0x80e3('0x5'));var AGIEmitter=require(_0x80e3('0x6'))[_0x80e3('0x7')];var projects=[];config['agi']=_[_0x80e3('0x8')](config[_0x80e3('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x80e3('0x9'),projectUpdateHandler);function connectionHandler(_0x105aff){process[_0x80e3('0xa')](function(){syncho(function(){try{setChannelVariables(_0x105aff);agiHandler(_0x105aff);}catch(_0x3c5b48){logger[_0x80e3('0xb')](_0x3c5b48['stack']);}});});}function projectUpdateHandler(_0x5301fb){try{var _0x1d9119=_[_0x80e3('0xc')](projects,['id',_0x5301fb['id']]);if(_0x1d9119>-0x1){if(_0x5301fb['deleted']===!![]){projects[_0x80e3('0xd')](_0x1d9119,0x1);}else{projects[_0x1d9119]=_0x5301fb;}}else{projects[_0x80e3('0xe')](_0x5301fb);}}catch(_0x9ec301){logger[_0x80e3('0xb')](_0x9ec301[_0x80e3('0xf')]);}}function listeningHandler(){console[_0x80e3('0x10')](_0x80e3('0x11'),config[_0x80e3('0x3')][_0x80e3('0x12')]);logger[_0x80e3('0x13')](util['format'](_0x80e3('0x14'),config[_0x80e3('0x3')]['ip'],config[_0x80e3('0x3')][_0x80e3('0x12')]));}function errorHandler(_0x1442b5){if(_0x1442b5&&_0x1442b5[_0x80e3('0x15')]&&_0x1442b5[_0x80e3('0x16')]){logger[_0x80e3('0xb')](util[_0x80e3('0x17')]('[%s]\x20%s',_0x1442b5[_0x80e3('0x15')],_0x1442b5['message']));}else{logger[_0x80e3('0xb')](util[_0x80e3('0x17')](_0x80e3('0x18'),_0x1442b5['stack']));}}function closeHandler(){logger[_0x80e3('0x13')](util['format'](_0x80e3('0x19'),this[_0x80e3('0x1a')],this[_0x80e3('0x1b')],this['callerid'],this['dnid'],this[_0x80e3('0x1c')]));try{createSquareReport(this);}catch(_0x425e4c){logger['error'](_0x425e4c[_0x80e3('0xf')]);}}function timeoutHandler(){logger[_0x80e3('0x13')](util['format'](_0x80e3('0x1d'),this[_0x80e3('0x1a')],this[_0x80e3('0x1b')],this['callerid'],this[_0x80e3('0x1e')],this[_0x80e3('0x1c')]));}function hangupHandler(){logger[_0x80e3('0x13')](util[_0x80e3('0x17')](_0x80e3('0x1f'),this[_0x80e3('0x1a')],this['calleridname'],this[_0x80e3('0x20')],this['dnid'],this[_0x80e3('0x1c')]));this[_0x80e3('0x21')]=!![];}function createSquareReport(_0x3abcbb,_0x533682){rpc[_0x80e3('0x22')](_0x3abcbb)[_0x80e3('0x23')](function(_0x11ea6a){if(_0x533682){_0x533682(null,_0x11ea6a);}})[_0x80e3('0x24')](function(_0x557f65){if(_0x533682){_0x533682(null,_0x557f65);}});}function setChannelVariables(_0x323445){for(var _0x93b670 in _0x323445){if(_0x323445[_0x80e3('0x25')](_0x93b670)){if(_0x93b670[_0x80e3('0x26')](_0x80e3('0x27'))===0x0){_0x323445[_0x93b670[_0x80e3('0x28')](0x4)]=_0x323445[_0x93b670];delete _0x323445[_0x93b670];}}}}function agiHandler(_0x1a01a9){logger['debug'](_0x80e3('0x29'),JSON[_0x80e3('0x2a')](_0x1a01a9,null,0x2));logger[_0x80e3('0x13')](util[_0x80e3('0x17')](_0x80e3('0x2b'),_0x1a01a9['arg_1'],_0x1a01a9['calleridname'],_0x1a01a9[_0x80e3('0x20')],_0x1a01a9[_0x80e3('0x1e')],_0x1a01a9[_0x80e3('0x1c')]));_0x1a01a9['on'](_0x80e3('0xb'),errorHandler);_0x1a01a9['on']('close',closeHandler);_0x1a01a9['on'](_0x80e3('0x2c'),timeoutHandler);_0x1a01a9[_0x80e3('0x21')]=![];_0x1a01a9['on'](_0x80e3('0x2d'),hangupHandler);var _0x53e900=_[_0x80e3('0x2e')](projects,[_0x80e3('0x15'),_0x1a01a9['arg_1']]);if(!_0x53e900)return Project[_0x80e3('0x2f')](_0x1a01a9);if(!_0x53e900[_0x80e3('0x30')])return Project['handleUnpublished'](_0x1a01a9);return Project[_0x80e3('0x31')](_0x53e900,_0x1a01a9);}function main(){var _0x4e11c3;return utilLicense[_0x80e3('0x32')]()[_0x80e3('0x23')](function(_0x3f59ac){if(!_0x3f59ac)return;if(_0x3f59ac['voice']){if(_0x3f59ac[_0x80e3('0x33')]&&_0x3f59ac['callysquare']>0x0){logger[_0x80e3('0x13')](util[_0x80e3('0x17')](_0x80e3('0x34'),_0x3f59ac[_0x80e3('0x33')]));_0x4e11c3=_0x3f59ac[_0x80e3('0x33')];}else{logger[_0x80e3('0x13')](_0x80e3('0x35'));}}else{logger[_0x80e3('0x13')](_0x80e3('0x36'));_0x4e11c3=-0x1;}})[_0x80e3('0x23')](function(){return Project[_0x80e3('0x37')]();})[_0x80e3('0x23')](function(_0x2a424c){projects=_0x2a424c;return;})['catch'](function(_0xff640b){logger[_0x80e3('0xb')](_0x80e3('0x38'),_0xff640b[_0x80e3('0xf')]);})['finally'](function(){var _0x433595=require('./server')(config['agi'][_0x80e3('0x12')],config['agi']['ip'],_0x4e11c3);_0x433595['on']('error',errorHandler);_0x433595['on']('listening',listeningHandler);_0x433595['on']('connection',connectionHandler);_0x433595['on'](_0x80e3('0x39'),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 73e3cf0..9eb6e34 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 _0xfe70=['message','catch','SendMail','jayson/promise','client','then'];(function(_0x66f7a9,_0x2ac4b5){var _0x5ba3d4=function(_0x1f7322){while(--_0x1f7322){_0x66f7a9['push'](_0x66f7a9['shift']());}};_0x5ba3d4(++_0x2ac4b5);}(_0xfe70,0x159));var _0x0fe7=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0xfe70[_0x487ab4];return _0x3bef77;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0fe7('0x0'));var client=jayson[_0x0fe7('0x1')]['http']({'port':0x232b});function request(_0x198e6f,_0x5423f9){return new BPromise(function(_0x35b18b,_0x1c5e05){return client['request'](_0x198e6f,_0x5423f9)[_0x0fe7('0x2')](function(_0x556535){if(_0x556535['error']){return _0x1c5e05(_0x556535['error'][_0x0fe7('0x3')]);}else{return _0x35b18b(_0x556535['result']);}})[_0x0fe7('0x4')](function(_0x2b60ec){return _0x1c5e05(_0x2b60ec);});});}exports['sendMailMessage']=function(_0x9d9bda,_0x41cc24){return request(_0x0fe7('0x5'),{'account':_0x9d9bda,'message':_0x41cc24});}; \ No newline at end of file +var _0xb4da=['catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message','result'];(function(_0x40af4c,_0x113e79){var _0xd6d632=function(_0x1c497f){while(--_0x1c497f){_0x40af4c['push'](_0x40af4c['shift']());}};_0xd6d632(++_0x113e79);}(_0xb4da,0x12c));var _0xab4d=function(_0xaf74e9,_0x1095cb){_0xaf74e9=_0xaf74e9-0x0;var _0x305840=_0xb4da[_0xaf74e9];return _0x305840;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xab4d('0x0'));var client=jayson[_0xab4d('0x1')][_0xab4d('0x2')]({'port':0x232b});function request(_0x2e6437,_0x32f9fc){return new BPromise(function(_0x1efe04,_0x2f84b7){return client[_0xab4d('0x3')](_0x2e6437,_0x32f9fc)[_0xab4d('0x4')](function(_0x326cae){if(_0x326cae[_0xab4d('0x5')]){return _0x2f84b7(_0x326cae[_0xab4d('0x5')][_0xab4d('0x6')]);}else{return _0x1efe04(_0x326cae[_0xab4d('0x7')]);}})[_0xab4d('0x8')](function(_0x1afadc){return _0x2f84b7(_0x1afadc);});});}exports[_0xab4d('0x9')]=function(_0x3e61d6,_0x21f61d){return request(_0xab4d('0xa'),{'account':_0x3e61d6,'message':_0x21f61d});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 5b65ef6..0000b59 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 _0x0ded=['exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[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','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0ded,0x1ba));var _0xd0de=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x0ded[_0x454e6d];return _0x4bc294;};'use strict';var _=require(_0xd0de('0x0'));var moment=require(_0xd0de('0x1'));var parser=require(_0xd0de('0x2'));var util=require(_0xd0de('0x3'));var logger=require(_0xd0de('0x4'))(_0xd0de('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xd0de('0x6'));var Graph=require(_0xd0de('0x7'));var Vertices=require(_0xd0de('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xd0de('0x9')]()['catch'](function(_0x253651){logger['error'](_0xd0de('0xa'),_0x253651[_0xd0de('0xb')]);return[];});}function addVertex(_0x5e331f,_0x5a362f,_0x307fb2){_0x5a362f[_0xd0de('0xc')]=_0x307fb2;if(_0x5a362f['hasOwnProperty'](_0xd0de('0xd'))){_0x5a362f[_0xd0de('0xe')]=parseInt(_0x5a362f[_0xd0de('0xd')],0xa);}_0x5e331f[_0xd0de('0xf')](_['omit'](_0x5a362f,_0xd0de('0x10')));}function initGraph(_0x230164,_0xd17e7){var _0x31dc3c=new Graph();for(var _0x1f2d9e in _0x230164){if(_0x230164['hasOwnProperty'](_0x1f2d9e)){if(_[_0xd0de('0x11')](_0x230164[_0x1f2d9e])){for(var _0x22c96b=0x0;_0x22c96b<_0x230164[_0x1f2d9e][_0xd0de('0x12')];_0x22c96b+=0x1){addVertex(_0x31dc3c,_0x230164[_0x1f2d9e][_0x22c96b],_0x1f2d9e);}}else{addVertex(_0x31dc3c,_0x230164[_0x1f2d9e],_0x1f2d9e);}}}for(var _0xe6b106=0x0;_0xe6b106<_0xd17e7[_0xd0de('0x12')];_0xe6b106+=0x1){if(_0xd17e7[_0xe6b106][_0xd0de('0x13')]&&_0xd17e7[_0xe6b106][_0xd0de('0x14')]){_0x31dc3c[_0xd0de('0x15')](_0xd17e7[_0xe6b106][_0xd0de('0x13')],_0xd17e7[_0xe6b106][_0xd0de('0x14')],_0xd17e7[_0xe6b106][_0xd0de('0x16')]);}}return _0x31dc3c;}function getRoot(_0x14d3cc){return parser[_0xd0de('0x17')](_0x14d3cc,{'object':!![]})[_0xd0de('0x18')][_0xd0de('0x19')];}function inspect(_0x168f50){return util[_0xd0de('0x1a')](_0x168f50,{'showHidden':![],'depth':null});}function initialize(_0x50a2c5,_0x4980f7){var _0x776498=getRoot(_0x50a2c5[_0xd0de('0x1b')]);if(!_0x776498||!_0x776498[_0xd0de('0x1c')])return;var _0x33309b,_0x4693d1,_0x30bfdb;logger[_0xd0de('0x1d')](_0xd0de('0x19'),JSON['stringify'](_0x776498,null,0x2));_0x4980f7[_0xd0de('0x1e')]=moment()[_0xd0de('0x1f')](_0xd0de('0x20'));_0x33309b=initGraph(_['omit'](_0x776498,'mxCell'),_0x776498['mxCell']);_0x4693d1=new Vertices(_0x4980f7,rpc,mailRpc);logger[_0xd0de('0x21')](util[_0xd0de('0x1f')](_0xd0de('0x22'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7[_0xd0de('0x25')],_0x4980f7[_0xd0de('0x26')],_0x4980f7[_0xd0de('0x27')]));_0x33309b[_0xd0de('0x28')](_0x776498[_0xd0de('0x1c')]['id'],function(_0x3395d4){try{_0x3395d4=_0x4693d1[_0xd0de('0x29')](_0x3395d4);logger[_0xd0de('0x1d')](_0xd0de('0x2a'),JSON[_0xd0de('0x2b')](_0x3395d4,null,0x2));if(_0x3395d4[_0xd0de('0xc')]===_0xd0de('0x2c')){logger['info'](_0xd0de('0x2d'));_0x4980f7[_0xd0de('0x2e')]=_0x3395d4[_0xd0de('0x2e')]||_0x4980f7['context'];_0x4980f7[_0xd0de('0x2f')]=_0x3395d4[_0xd0de('0x2f')];_0x4980f7[_0xd0de('0x30')]=_0x3395d4['priority']?_0x3395d4[_0xd0de('0x30')]-0x1:0x1;return null;}else if(_0x3395d4&&_0x4693d1[_0x3395d4[_0xd0de('0xc')]]){_0x30bfdb=_0x4693d1[_0x3395d4[_0xd0de('0xc')]](_0x3395d4);logger['info'](_0xd0de('0x31'),JSON[_0xd0de('0x2b')](_0x30bfdb,null,0x2));if(_0x30bfdb&&_0x30bfdb[_0xd0de('0x32')]===AGI_CODE_SUCCESS&&_0x30bfdb[_0xd0de('0x33')]!==AGI_RESULT_ERROR&&!_0x4980f7['evtHangup']){logger[_0xd0de('0x1d')](_0xd0de('0x31'),inspect(_0x30bfdb));return _[_0xd0de('0x34')](_0x30bfdb[_0xd0de('0x33')])?null:_0x30bfdb[_0xd0de('0x33')][_0xd0de('0x35')]();}else{logger[_0xd0de('0x36')](_0xd0de('0x31'),inspect(_0x30bfdb));return null;}}else{logger[_0xd0de('0x36')](_0xd0de('0x37'));return null;}}catch(_0x241988){logger[_0xd0de('0x36')](_0x241988[_0xd0de('0xb')]);return null;}});if(_0x776498[_0xd0de('0x38')]){logger[_0xd0de('0x21')](util['format'](_0xd0de('0x39'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7[_0xd0de('0x25')],_0x4980f7['dnid'],_0x4980f7['uniqueid']));_0x33309b[_0xd0de('0x28')](_0x776498[_0xd0de('0x38')]['id'],function(_0x4470d9){try{_0x4470d9=_0x4693d1[_0xd0de('0x29')](_0x4470d9);logger[_0xd0de('0x1d')](_0xd0de('0x2a'),JSON['stringify'](_0x4470d9,null,0x2));if(_0x4470d9&&_0x4693d1[_0x4470d9['agicommand']]){_0x30bfdb=_0x4693d1[_0x4470d9['agicommand']](_0x4470d9);if(_0x30bfdb){logger['debug'](_0xd0de('0x31'),inspect(_0x30bfdb));return _[_0xd0de('0x34')](_0x30bfdb[_0xd0de('0x33')])?null:_0x30bfdb[_0xd0de('0x33')]['toString']();}else{logger[_0xd0de('0x36')]('response',inspect(_0x30bfdb));return null;}}else{logger[_0xd0de('0x36')](_0xd0de('0x37'));return null;}}catch(_0x993253){logger[_0xd0de('0x36')](_0x993253['stack']);return null;}});}logger[_0xd0de('0x21')](util[_0xd0de('0x1f')](_0xd0de('0x3a'),_0x4980f7[_0xd0de('0x23')],_0x4980f7[_0xd0de('0x24')],_0x4980f7['callerid'],_0x4980f7[_0xd0de('0x26')],_0x4980f7[_0xd0de('0x27')]));logger[_0xd0de('0x21')](util['format'](_0xd0de('0x3b'),_0x4980f7[_0xd0de('0x2e')],_0x4980f7[_0xd0de('0x2f')],parseInt(_0x4980f7['priority'],0xa)+0x1));_0x4980f7[_0xd0de('0x3c')](_0x4980f7[_0xd0de('0x2e')],_0x4980f7[_0xd0de('0x2f')],parseInt(_0x4980f7[_0xd0de('0x30')],0xa)+0x1);_0x4980f7[_0xd0de('0x3d')]();}function handleNotFound(_0x33db50){logger[_0xd0de('0x36')](util[_0xd0de('0x1f')]('Project\x20%s\x20not\x20found',_0x33db50[_0xd0de('0x23')]));_0x33db50[_0xd0de('0x3c')](_0x33db50['context'],_0x33db50[_0xd0de('0x2f')],parseInt(_0x33db50[_0xd0de('0x30')],0xa)+0x1);_0x33db50['close']();}function handleUnpublished(_0x3823b5){logger[_0xd0de('0x36')](util['format']('Project\x20%s\x20not\x20published',_0x3823b5['arg_1']));_0x3823b5['continueAt'](_0x3823b5[_0xd0de('0x2e')],_0x3823b5[_0xd0de('0x2f')],parseInt(_0x3823b5[_0xd0de('0x30')],0xa)+0x1);_0x3823b5[_0xd0de('0x3d')]();}module[_0xd0de('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7982=['callerid','dnid','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','addEdge','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','traverseBFS','clear','gotoc','info','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally'];(function(_0x1b12e8,_0x3e5bbc){var _0x215d8c=function(_0x35f788){while(--_0x35f788){_0x1b12e8['push'](_0x1b12e8['shift']());}};_0x215d8c(++_0x3e5bbc);}(_0x7982,0x1d1));var _0x2798=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x7982[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x2798('0x0'));var moment=require(_0x2798('0x1'));var parser=require(_0x2798('0x2'));var util=require('util');var logger=require(_0x2798('0x3'))(_0x2798('0x4'));var rpc=require(_0x2798('0x5'));var mailRpc=require(_0x2798('0x6'));var Graph=require(_0x2798('0x7'));var Vertices=require(_0x2798('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2798('0x9')]()[_0x2798('0xa')](function(_0x494a7b){logger[_0x2798('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x494a7b[_0x2798('0xc')]);return[];});}function addVertex(_0xf3bdfd,_0x475c73,_0x43ac4d){_0x475c73[_0x2798('0xd')]=_0x43ac4d;if(_0x475c73[_0x2798('0xe')]('retry')){_0x475c73[_0x2798('0xf')]=parseInt(_0x475c73[_0x2798('0x10')],0xa);}_0xf3bdfd[_0x2798('0x11')](_[_0x2798('0x12')](_0x475c73,'mxCell'));}function initGraph(_0x2f5fe3,_0x2ecebd){var _0x3c6096=new Graph();for(var _0x55eee8 in _0x2f5fe3){if(_0x2f5fe3[_0x2798('0xe')](_0x55eee8)){if(_[_0x2798('0x13')](_0x2f5fe3[_0x55eee8])){for(var _0x29dd90=0x0;_0x29dd90<_0x2f5fe3[_0x55eee8][_0x2798('0x14')];_0x29dd90+=0x1){addVertex(_0x3c6096,_0x2f5fe3[_0x55eee8][_0x29dd90],_0x55eee8);}}else{addVertex(_0x3c6096,_0x2f5fe3[_0x55eee8],_0x55eee8);}}}for(var _0x57a665=0x0;_0x57a665<_0x2ecebd['length'];_0x57a665+=0x1){if(_0x2ecebd[_0x57a665]['source']&&_0x2ecebd[_0x57a665]['target']){_0x3c6096[_0x2798('0x15')](_0x2ecebd[_0x57a665][_0x2798('0x16')],_0x2ecebd[_0x57a665][_0x2798('0x17')],_0x2ecebd[_0x57a665][_0x2798('0x18')]);}}return _0x3c6096;}function getRoot(_0x56dc33){return parser[_0x2798('0x19')](_0x56dc33,{'object':!![]})[_0x2798('0x1a')][_0x2798('0x1b')];}function inspect(_0x3fbac9){return util[_0x2798('0x1c')](_0x3fbac9,{'showHidden':![],'depth':null});}function initialize(_0x49bb40,_0x37df6c){var _0x315729=getRoot(_0x49bb40[_0x2798('0x1d')]);if(!_0x315729||!_0x315729[_0x2798('0x1e')])return;var _0x66f4b7,_0x358956,_0x114884;logger[_0x2798('0x1f')](_0x2798('0x1b'),JSON[_0x2798('0x20')](_0x315729,null,0x2));_0x37df6c[_0x2798('0x21')]=moment()[_0x2798('0x22')](_0x2798('0x23'));_0x66f4b7=initGraph(_[_0x2798('0x12')](_0x315729,_0x2798('0x24')),_0x315729[_0x2798('0x24')]);_0x358956=new Vertices(_0x37df6c,rpc,mailRpc);logger['info'](util[_0x2798('0x22')](_0x2798('0x25'),_0x37df6c[_0x2798('0x26')],_0x37df6c[_0x2798('0x27')],_0x37df6c['callerid'],_0x37df6c['dnid'],_0x37df6c[_0x2798('0x28')]));_0x66f4b7[_0x2798('0x29')](_0x315729[_0x2798('0x1e')]['id'],function(_0x2edcd2){try{_0x2edcd2=_0x358956[_0x2798('0x2a')](_0x2edcd2);logger[_0x2798('0x1f')]('vertex',JSON[_0x2798('0x20')](_0x2edcd2,null,0x2));if(_0x2edcd2[_0x2798('0xd')]===_0x2798('0x2b')){logger[_0x2798('0x2c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x37df6c['context']=_0x2edcd2['context']||_0x37df6c[_0x2798('0x2d')];_0x37df6c[_0x2798('0x2e')]=_0x2edcd2[_0x2798('0x2e')];_0x37df6c[_0x2798('0x2f')]=_0x2edcd2['priority']?_0x2edcd2[_0x2798('0x2f')]-0x1:0x1;return null;}else if(_0x2edcd2&&_0x358956[_0x2edcd2['agicommand']]){_0x114884=_0x358956[_0x2edcd2[_0x2798('0xd')]](_0x2edcd2);logger[_0x2798('0x2c')](_0x2798('0x30'),JSON[_0x2798('0x20')](_0x114884,null,0x2));if(_0x114884&&_0x114884[_0x2798('0x31')]===AGI_CODE_SUCCESS&&_0x114884[_0x2798('0x32')]!==AGI_RESULT_ERROR&&!_0x37df6c['evtHangup']){logger[_0x2798('0x1f')](_0x2798('0x30'),inspect(_0x114884));return _[_0x2798('0x33')](_0x114884[_0x2798('0x32')])?null:_0x114884[_0x2798('0x32')][_0x2798('0x34')]();}else{logger[_0x2798('0xb')](_0x2798('0x30'),inspect(_0x114884));return null;}}else{logger[_0x2798('0xb')](_0x2798('0x35'));return null;}}catch(_0x1231c3){logger[_0x2798('0xb')](_0x1231c3['stack']);return null;}});if(_0x315729[_0x2798('0x36')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x37df6c[_0x2798('0x26')],_0x37df6c[_0x2798('0x27')],_0x37df6c[_0x2798('0x37')],_0x37df6c[_0x2798('0x38')],_0x37df6c[_0x2798('0x28')]));_0x66f4b7['traverseBFS'](_0x315729[_0x2798('0x36')]['id'],function(_0x4fc39a){try{_0x4fc39a=_0x358956[_0x2798('0x2a')](_0x4fc39a);logger[_0x2798('0x1f')](_0x2798('0x39'),JSON[_0x2798('0x20')](_0x4fc39a,null,0x2));if(_0x4fc39a&&_0x358956[_0x4fc39a[_0x2798('0xd')]]){_0x114884=_0x358956[_0x4fc39a[_0x2798('0xd')]](_0x4fc39a);if(_0x114884){logger[_0x2798('0x1f')](_0x2798('0x30'),inspect(_0x114884));return _[_0x2798('0x33')](_0x114884[_0x2798('0x32')])?null:_0x114884['result']['toString']();}else{logger['error'](_0x2798('0x30'),inspect(_0x114884));return null;}}else{logger['error'](_0x2798('0x35'));return null;}}catch(_0x2d2c77){logger[_0x2798('0xb')](_0x2d2c77[_0x2798('0xc')]);return null;}});}logger['info'](util[_0x2798('0x22')](_0x2798('0x3a'),_0x37df6c[_0x2798('0x26')],_0x37df6c[_0x2798('0x27')],_0x37df6c[_0x2798('0x37')],_0x37df6c[_0x2798('0x38')],_0x37df6c[_0x2798('0x28')]));logger[_0x2798('0x2c')](util[_0x2798('0x22')](_0x2798('0x3b'),_0x37df6c[_0x2798('0x2d')],_0x37df6c[_0x2798('0x2e')],parseInt(_0x37df6c[_0x2798('0x2f')],0xa)+0x1));_0x37df6c['continueAt'](_0x37df6c[_0x2798('0x2d')],_0x37df6c['extension'],parseInt(_0x37df6c[_0x2798('0x2f')],0xa)+0x1);_0x37df6c[_0x2798('0x3c')]();}function handleNotFound(_0x163e69){logger['error'](util[_0x2798('0x22')](_0x2798('0x3d'),_0x163e69['arg_1']));_0x163e69[_0x2798('0x3e')](_0x163e69[_0x2798('0x2d')],_0x163e69[_0x2798('0x2e')],parseInt(_0x163e69['priority'],0xa)+0x1);_0x163e69[_0x2798('0x3c')]();}function handleUnpublished(_0x165854){logger['error'](util[_0x2798('0x22')](_0x2798('0x3f'),_0x165854[_0x2798('0x26')]));_0x165854[_0x2798('0x3e')](_0x165854[_0x2798('0x2d')],_0x165854[_0x2798('0x2e')],parseInt(_0x165854[_0x2798('0x2f')],0xa)+0x1);_0x165854[_0x2798('0x3c')]();}module[_0x2798('0x40')]={'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 9289d21..67e037b 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 _0xee17=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','util','stream','call','_localBuffer'];(function(_0x62bff4,_0x29f6e5){var _0x350842=function(_0x3140f9){while(--_0x3140f9){_0x62bff4['push'](_0x62bff4['shift']());}};_0x350842(++_0x29f6e5);}(_0xee17,0x1c7));var _0x7ee1=function(_0x395179,_0x26c6c1){_0x395179=_0x395179-0x0;var _0x56239c=_0xee17[_0x395179];return _0x56239c;};'use strict';var util=require(_0x7ee1('0x0'));var Transform=require(_0x7ee1('0x1'))['Transform'];function AGIReply(_0x590690){Transform[_0x7ee1('0x2')](this,_0x590690);this[_0x7ee1('0x3')]='';this[_0x7ee1('0x4')]=![];}util[_0x7ee1('0x5')](AGIReply,Transform);AGIReply[_0x7ee1('0x6')][_0x7ee1('0x7')]=function(_0x7fba31,_0x206e15,_0x14c927){var _0x1e7ee4='\x0a',_0x231323=['\x0a\x0a',_0x7ee1('0x8')],_0x3e8598=-0x1,_0x56f94b=-0x1,_0x4beb09='',_0x247b0f=0x0,_0x3ed3ec='',_0x407c96='';this[_0x7ee1('0x3')]+=_0x7fba31[_0x7ee1('0x9')]();_0x3ed3ec=this[_0x7ee1('0x3')];if(!this[_0x7ee1('0x4')]){_0x247b0f=0x0;while(_0x231323[_0x247b0f]){while((_0x56f94b=_0x3ed3ec[_0x7ee1('0xa')](_0x231323[_0x247b0f]))!=-0x1){_0x4beb09=_0x231323[_0x247b0f];_0x407c96=_0x3ed3ec['substring'](0x0,_0x56f94b);_0x3ed3ec=_0x3ed3ec[_0x7ee1('0xb')](_0x56f94b+_0x4beb09[_0x7ee1('0xc')]);var _0x284015=_0x407c96['split'](_0x1e7ee4),_0x4b478f=0x0,_0x5cae0d={},_0x23074e='',_0x3571d5='',_0x1e2a9a=-0x1;while(_0x284015[_0x4b478f]){_0x1e2a9a=_0x284015[_0x4b478f][_0x7ee1('0xa')](':');if(_0x1e2a9a!=-0x1){_0x23074e=_0x284015[_0x4b478f][_0x7ee1('0xd')](0x0,_0x1e2a9a)[_0x7ee1('0xe')]();_0x3571d5=_0x284015[_0x4b478f][_0x7ee1('0xd')](_0x1e2a9a+0x1)[_0x7ee1('0xe')]();if(_0x23074e['length']>0x0){_0x5cae0d[_0x23074e]=_0x3571d5;}}else{}_0x4b478f++;}this[_0x7ee1('0xf')](_0x7ee1('0x10'),_0x5cae0d);this[_0x7ee1('0x4')]=!![];}_0x247b0f++;}this[_0x7ee1('0x3')]=_0x3ed3ec;}else{while((_0x3e8598=_0x3ed3ec[_0x7ee1('0xa')](_0x1e7ee4))!=-0x1){_0x407c96=_0x3ed3ec['substring'](0x0,_0x3e8598);this[_0x7ee1('0xf')]('line',_0x407c96);_0x3ed3ec=_0x3ed3ec[_0x7ee1('0xb')](_0x3e8598+_0x1e7ee4['length']);}this['_localBuffer']=_0x3ed3ec;}_0x14c927();};module['exports']=AGIReply; \ No newline at end of file +var _0xef88=['Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split','indexOf','trim','emit','headers','exports','stream'];(function(_0x1cf7af,_0x50f213){var _0x1b8088=function(_0x127b9e){while(--_0x127b9e){_0x1cf7af['push'](_0x1cf7af['shift']());}};_0x1b8088(++_0x50f213);}(_0xef88,0x10f));var _0x8ef8=function(_0x57cbbd,_0x394de6){_0x57cbbd=_0x57cbbd-0x0;var _0x3e5152=_0xef88[_0x57cbbd];return _0x3e5152;};'use strict';var util=require('util');var Transform=require(_0x8ef8('0x0'))[_0x8ef8('0x1')];function AGIReply(_0x97140e){Transform['call'](this,_0x97140e);this[_0x8ef8('0x2')]='';this[_0x8ef8('0x3')]=![];}util[_0x8ef8('0x4')](AGIReply,Transform);AGIReply[_0x8ef8('0x5')][_0x8ef8('0x6')]=function(_0x57dcb9,_0x3ffcc0,_0x443d5a){var _0x4400af='\x0a',_0x3cc25f=['\x0a\x0a',_0x8ef8('0x7')],_0x180179=-0x1,_0x565639=-0x1,_0x5e3464='',_0x10649a=0x0,_0x153ab5='',_0x3ae6e9='';this['_localBuffer']+=_0x57dcb9['toString']();_0x153ab5=this[_0x8ef8('0x2')];if(!this['_inBody']){_0x10649a=0x0;while(_0x3cc25f[_0x10649a]){while((_0x565639=_0x153ab5['indexOf'](_0x3cc25f[_0x10649a]))!=-0x1){_0x5e3464=_0x3cc25f[_0x10649a];_0x3ae6e9=_0x153ab5[_0x8ef8('0x8')](0x0,_0x565639);_0x153ab5=_0x153ab5[_0x8ef8('0x8')](_0x565639+_0x5e3464[_0x8ef8('0x9')]);var _0x1c02f7=_0x3ae6e9[_0x8ef8('0xa')](_0x4400af),_0x2e5c9c=0x0,_0x176129={},_0x5a2592='',_0x343973='',_0x2e3ca1=-0x1;while(_0x1c02f7[_0x2e5c9c]){_0x2e3ca1=_0x1c02f7[_0x2e5c9c][_0x8ef8('0xb')](':');if(_0x2e3ca1!=-0x1){_0x5a2592=_0x1c02f7[_0x2e5c9c]['slice'](0x0,_0x2e3ca1)[_0x8ef8('0xc')]();_0x343973=_0x1c02f7[_0x2e5c9c]['slice'](_0x2e3ca1+0x1)[_0x8ef8('0xc')]();if(_0x5a2592[_0x8ef8('0x9')]>0x0){_0x176129[_0x5a2592]=_0x343973;}}else{}_0x2e5c9c++;}this[_0x8ef8('0xd')](_0x8ef8('0xe'),_0x176129);this[_0x8ef8('0x3')]=!![];}_0x10649a++;}this[_0x8ef8('0x2')]=_0x153ab5;}else{while((_0x180179=_0x153ab5[_0x8ef8('0xb')](_0x4400af))!=-0x1){_0x3ae6e9=_0x153ab5[_0x8ef8('0x8')](0x0,_0x180179);this[_0x8ef8('0xd')]('line',_0x3ae6e9);_0x153ab5=_0x153ab5[_0x8ef8('0x8')](_0x180179+_0x4400af[_0x8ef8('0x9')]);}this[_0x8ef8('0x2')]=_0x153ab5;}_0x443d5a();};module[_0x8ef8('0xf')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 70f9310..9a8682c 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 _0xcb18=['createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','CloudProvider','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording'];(function(_0x28bb2e,_0x4f080d){var _0x5b508e=function(_0x440878){while(--_0x440878){_0x28bb2e['push'](_0x28bb2e['shift']());}};_0x5b508e(++_0x4f080d);}(_0xcb18,0x159));var _0x8cb1=function(_0x14a2b1,_0x10d0b7){_0x14a2b1=_0x14a2b1-0x0;var _0x14a5a8=_0xcb18[_0x14a2b1];return _0x14a5a8;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x8cb1('0x0'));var client=jayson['client'][_0x8cb1('0x1')]({'port':0x2329});function request(_0x50513d,_0x5e800d){return new Promise(function(_0x39e801,_0x87b1d3){return client[_0x8cb1('0x2')](_0x50513d,_0x5e800d)[_0x8cb1('0x3')](function(_0x28be22){if(_0x28be22['error']){return _0x87b1d3(_0x28be22[_0x8cb1('0x4')][_0x8cb1('0x5')]);}else{return _0x39e801(_0x28be22['result']);}})[_0x8cb1('0x6')](function(_0x510e92){return _0x87b1d3(_0x510e92);});});}exports[_0x8cb1('0x7')]=function(){return request(_0x8cb1('0x8'),{'options':{'raw':![],'attributes':['id','name',_0x8cb1('0x9')]}});};exports[_0x8cb1('0xa')]=function(_0x1a89e7){return request(_0x8cb1('0xb'),{'options':{'raw':![],'where':{'name':_0x1a89e7},'attributes':[_0x8cb1('0x9')]}});};exports['getMailAccountById']=function(_0x5ef3d0){return request(_0x8cb1('0xc'),{'options':{'raw':![],'where':{'id':_0x5ef3d0},'include':[{'model':_0x8cb1('0xd'),'as':'Smtp','include':[{'model':_0x8cb1('0xe'),'as':_0x8cb1('0xe')}]}],'attributes':['id',_0x8cb1('0xf'),_0x8cb1('0x10')],'smtp':!![]}});};exports[_0x8cb1('0x11')]=function(_0xb63f73){return request('ShowSquareProject',{'options':{'where':{'id':_0xb63f73},'attributes':[_0x8cb1('0xf')]}});};exports['getVoiceQueueById']=function(_0xacc6db){return request(_0x8cb1('0x12'),{'options':{'where':{'id':_0xacc6db},'attributes':[_0x8cb1('0xf')]}});};exports[_0x8cb1('0x13')]=function(_0x2a3e22){return request(_0x8cb1('0x14'),{'options':{'where':{'id':_0x2a3e22},'attributes':['name']}});};exports[_0x8cb1('0x15')]=function(_0x4b6320){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4b6320},'attributes':['dsn']}});};exports[_0x8cb1('0x16')]=function(_0x450d05){return request(_0x8cb1('0x17'),{'options':{'where':{'id':_0x450d05},'attributes':['name']}});};exports[_0x8cb1('0x18')]=function(_0x14c1fa){return request('GetContactByPhone',{'options':{'where':{'phone':_0x14c1fa['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x2ecfe5){return request('ShowTrunk',{'options':{'where':{'id':_0x2ecfe5},'attributes':[_0x8cb1('0xf')]}});};exports[_0x8cb1('0x19')]=function(_0x382d9c){return request(_0x8cb1('0x1a'),{'options':{'where':{'id':_0x382d9c},'attributes':['save_name']}});};exports[_0x8cb1('0x1b')]=function(_0x5df496){return request(_0x8cb1('0x1c'),{'options':{'raw':![],'where':{'id':_0x5df496},'include':[{'model':_0x8cb1('0x1d'),'as':_0x8cb1('0x1e')}]}});};exports['getSmsAccountById']=function(_0x3bc045){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3bc045},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x33cb0e){return request('CreateSmsMessage',{'body':_0x33cb0e});};exports[_0x8cb1('0x1f')]=function(_0x22eb2d){return request(_0x8cb1('0x20'),{'body':_0x22eb2d});};exports[_0x8cb1('0x21')]=function(_0x516134){return request(_0x8cb1('0x22'),{'body':_[_0x8cb1('0x23')](_0x516134,{'project_name':_0x516134['arg_1'],'prev_project_name':_0x516134['arg_2']||'','is_subproject':_0x516134[_0x8cb1('0x24')]?!![]:![],'leaveAt':moment()['format'](_0x8cb1('0x25'))})});};exports[_0x8cb1('0x26')]=function(_0xe9ef53){return request(_0x8cb1('0x27'),{'body':_0xe9ef53});};exports[_0x8cb1('0x28')]=function(_0x1d79ef){return request(_0x8cb1('0x29'),{'body':_0x1d79ef});};exports[_0x8cb1('0x2a')]=function(_0x26f399){return request(_0x8cb1('0x2b'),{'options':{'raw':![],'where':{'phone':_0x26f399[_0x8cb1('0x2c')],'ListId':_0x26f399['ListId']}}})[_0x8cb1('0x3')](function(_0x3e07ad){if(_0x3e07ad){return _0x3e07ad;}return request(_0x8cb1('0x2d'),{'body':_0x26f399});});};exports[_0x8cb1('0x2e')]=function(_0x2325f2){return request(_0x8cb1('0x2f'),{'options':{'where':{'id':_0x2325f2},'attributes':['name']}});};exports[_0x8cb1('0x30')]=function(_0x389790,_0x203cb3){return request('LoginUser',{'body':{'interface':_0x203cb3},'options':{'where':_0x389790}});};exports[_0x8cb1('0x31')]=function(_0x312f28,_0x499992,_0x8980e1){return request(_0x8cb1('0x32'),{'body':{'type':_0x499992,'uniqueid':_0x8980e1},'options':{'where':_0x312f28}});};exports[_0x8cb1('0x33')]=function(_0x111d7f){return request(_0x8cb1('0x34'),{'body':{},'options':{'where':_0x111d7f}});};exports[_0x8cb1('0x35')]=function(_0x5a8642){return request(_0x8cb1('0x36'),{'body':{},'options':{'where':_0x5a8642}});}; \ No newline at end of file +var _0x057a=['CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','lodash','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowSound','save_name','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x057a,0x1a6));var _0xa057=function(_0x5bc672,_0x2fb336){_0x5bc672=_0x5bc672-0x0;var _0x219898=_0x057a[_0x5bc672];return _0x219898;};'use strict';var _=require(_0xa057('0x0'));var moment=require(_0xa057('0x1'));var jayson=require(_0xa057('0x2'));var client=jayson['client'][_0xa057('0x3')]({'port':0x2329});function request(_0x51a623,_0x37ce08){return new Promise(function(_0x92634f,_0x5481b7){return client[_0xa057('0x4')](_0x51a623,_0x37ce08)[_0xa057('0x5')](function(_0x508f2c){if(_0x508f2c['error']){return _0x5481b7(_0x508f2c[_0xa057('0x6')][_0xa057('0x7')]);}else{return _0x92634f(_0x508f2c[_0xa057('0x8')]);}})[_0xa057('0x9')](function(_0x3ca78d){return _0x5481b7(_0x3ca78d);});});}exports[_0xa057('0xa')]=function(){return request(_0xa057('0xb'),{'options':{'raw':![],'attributes':['id',_0xa057('0xc'),_0xa057('0xd')]}});};exports[_0xa057('0xe')]=function(_0x3c1d3e){return request(_0xa057('0xf'),{'options':{'raw':![],'where':{'name':_0x3c1d3e},'attributes':[_0xa057('0xd')]}});};exports['getMailAccountById']=function(_0x509073){return request(_0xa057('0x10'),{'options':{'raw':![],'where':{'id':_0x509073},'include':[{'model':_0xa057('0x11'),'as':_0xa057('0x12'),'include':[{'model':'CloudProvider','as':_0xa057('0x13')}]}],'attributes':['id',_0xa057('0xc'),_0xa057('0x14')],'smtp':!![]}});};exports[_0xa057('0x15')]=function(_0x332938){return request('ShowSquareProject',{'options':{'where':{'id':_0x332938},'attributes':['name']}});};exports[_0xa057('0x16')]=function(_0x559681){return request(_0xa057('0x17'),{'options':{'where':{'id':_0x559681},'attributes':[_0xa057('0xc')]}});};exports['getVariableById']=function(_0x22e1fa){return request(_0xa057('0x18'),{'options':{'where':{'id':_0x22e1fa},'attributes':[_0xa057('0xc')]}});};exports[_0xa057('0x19')]=function(_0x5a32b7){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5a32b7},'attributes':['dsn']}});};exports[_0xa057('0x1a')]=function(_0x12f7a1){return request(_0xa057('0x1b'),{'options':{'where':{'id':_0x12f7a1},'attributes':[_0xa057('0xc')]}});};exports[_0xa057('0x1c')]=function(_0x1a4688){return request(_0xa057('0x1d'),{'options':{'where':{'phone':_0x1a4688[_0xa057('0x1e')]},'attributes':['id']}});};exports[_0xa057('0x1f')]=function(_0x56d991){return request('ShowTrunk',{'options':{'where':{'id':_0x56d991},'attributes':[_0xa057('0xc')]}});};exports['getSoundById']=function(_0x3c3ea7){return request(_0xa057('0x20'),{'options':{'where':{'id':_0x3c3ea7},'attributes':[_0xa057('0x21')]}});};exports['getIntervalById']=function(_0x5e9c19){return request(_0xa057('0x22'),{'options':{'raw':![],'where':{'id':_0x5e9c19},'include':[{'model':_0xa057('0x23'),'as':'Intervals'}]}});};exports[_0xa057('0x24')]=function(_0x3ae21e){return request(_0xa057('0x25'),{'options':{'where':{'id':_0x3ae21e},'attributes':['id','name']}});};exports[_0xa057('0x26')]=function(_0x2f1a24){return request(_0xa057('0x27'),{'body':_0x2f1a24});};exports[_0xa057('0x28')]=function(_0x66ee1d){return request('CreateSquareDetailsReport',{'body':_0x66ee1d});};exports['createSquareReport']=function(_0x32e921){return request(_0xa057('0x29'),{'body':_[_0xa057('0x2a')](_0x32e921,{'project_name':_0x32e921[_0xa057('0x2b')],'prev_project_name':_0x32e921['arg_2']||'','is_subproject':_0x32e921[_0xa057('0x2c')]?!![]:![],'leaveAt':moment()[_0xa057('0x2d')](_0xa057('0x2e'))})});};exports[_0xa057('0x2f')]=function(_0x5d6fe3){return request('CreateSquareRecording',{'body':_0x5d6fe3});};exports[_0xa057('0x30')]=function(_0x2ee78b){return request('CreateSquareMessage',{'body':_0x2ee78b});};exports[_0xa057('0x31')]=function(_0x58082e){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x58082e[_0xa057('0x1e')],'ListId':_0x58082e['ListId']}}})[_0xa057('0x5')](function(_0x205638){if(_0x205638){return _0x205638;}return request(_0xa057('0x32'),{'body':_0x58082e});});};exports[_0xa057('0x33')]=function(_0x1cb3f6){return request(_0xa057('0x34'),{'options':{'where':{'id':_0x1cb3f6},'attributes':[_0xa057('0xc')]}});};exports[_0xa057('0x35')]=function(_0x545105,_0x4fadb5){return request(_0xa057('0x36'),{'body':{'interface':_0x4fadb5},'options':{'where':_0x545105}});};exports[_0xa057('0x37')]=function(_0x5a9178,_0x1edecf,_0x1872ea){return request(_0xa057('0x38'),{'body':{'type':_0x1edecf,'uniqueid':_0x1872ea},'options':{'where':_0x5a9178}});};exports['agentUnpause']=function(_0x3a0d4f){return request(_0xa057('0x39'),{'body':{},'options':{'where':_0x3a0d4f}});};exports[_0xa057('0x3a')]=function(_0xeb9df0){return request('LogoutUser',{'body':{},'options':{'where':_0xeb9df0}});}; \ 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 90e92ea..ec0baca 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 _0x27a0=['exports','./lex'];(function(_0x526a74,_0x526a7c){var _0x372ed6=function(_0xe46b8){while(--_0xe46b8){_0x526a74['push'](_0x526a74['shift']());}};_0x372ed6(++_0x526a7c);}(_0x27a0,0xbf));var _0x027a=function(_0x40852d,_0x400ede){_0x40852d=_0x40852d-0x0;var _0x4f2f99=_0x27a0[_0x40852d];return _0x4f2f99;};var polly=require('./polly');var lex=require(_0x027a('0x0'));module[_0x027a('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x49c1=['exports','./polly'];(function(_0x569a85,_0x8c6fa2){var _0x4c850b=function(_0x44e19c){while(--_0x44e19c){_0x569a85['push'](_0x569a85['shift']());}};_0x4c850b(++_0x8c6fa2);}(_0x49c1,0xef));var _0x149c=function(_0x5662e4,_0x577132){_0x5662e4=_0x5662e4-0x0;var _0xbd92d2=_0x49c1[_0x5662e4];return _0xbd92d2;};var polly=require(_0x149c('0x0'));var lex=require('./lex');module[_0x149c('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 314223c..572d3b7 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 _0xda3f=['exports'];(function(_0x5be795,_0x1cb1b8){var _0x4e8a3b=function(_0x5584ef){while(--_0x5584ef){_0x5be795['push'](_0x5be795['shift']());}};_0x4e8a3b(++_0x1cb1b8);}(_0xda3f,0xec));var _0xfda3=function(_0x37fc81,_0x10a97e){_0x37fc81=_0x37fc81-0x0;var _0x179f04=_0xda3f[_0x37fc81];return _0x179f04;};'use strict';var lex=require('./lib/api');module[_0xfda3('0x0')]=function(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693){return lex(_0xf4e78,_0x534697,_0x5299b0,_0x5d7071,_0x3859fe,_0x581693);}; \ No newline at end of file +var _0x668b=['./lib/api','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x668b,0x140));var _0xb668=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x668b[_0x3fb9dd];return _0x20136a;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ 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 82ef238..343612c 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(_0x596665,_0x54c6ac){var _0xfa7639=function(_0x56035c){while(--_0x56035c){_0x596665['push'](_0x596665['shift']());}};_0xfa7639(++_0x54c6ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x59c268,_0x20fb7a){var _0x131cef=function(_0x5433c6){while(--_0x5433c6){_0x59c268['push'](_0x59c268['shift']());}};_0x131cef(++_0x20fb7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 03892b2..1ec02f0 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 _0x9554=['exports','./lib/api'];(function(_0x57f059,_0x370c8f){var _0x1f838a=function(_0x90d726){while(--_0x90d726){_0x57f059['push'](_0x57f059['shift']());}};_0x1f838a(++_0x370c8f);}(_0x9554,0x15f));var _0x4955=function(_0x14abd3,_0x18e027){_0x14abd3=_0x14abd3-0x0;var _0x5a97da=_0x9554[_0x14abd3];return _0x5a97da;};'use strict';var polly=require(_0x4955('0x0'));module[_0x4955('0x1')]=function(_0x4881cd,_0xc19f51,_0x750602,_0x464b93,_0x33b4ae,_0x4a7c7b,_0x553269){return polly(_0x4881cd,_0xc19f51,_0x750602,_0x464b93,_0x33b4ae,_0x4a7c7b,_0x553269);}; \ No newline at end of file +var _0x0af0=['exports','./lib/api'];(function(_0x76b986,_0x1cb211){var _0x3f5f18=function(_0x51e32a){while(--_0x51e32a){_0x76b986['push'](_0x76b986['shift']());}};_0x3f5f18(++_0x1cb211);}(_0x0af0,0xb3));var _0x00af=function(_0x1fc716,_0x263857){_0x1fc716=_0x1fc716-0x0;var _0x637fd3=_0x0af0[_0x1fc716];return _0x637fd3;};'use strict';var polly=require(_0x00af('0x0'));module[_0x00af('0x1')]=function(_0x1d176b,_0x334622,_0x163682,_0x43ae0b,_0x4f4b4d,_0x4d4d91,_0x5c124c){return polly(_0x1d176b,_0x334622,_0x163682,_0x43ae0b,_0x4f4b4d,_0x4d4d91,_0x5c124c);}; \ 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 101b514..d8113d8 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 _0x2cca=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cca,0xe6));var _0xa2cc=function(_0x2c4b5b,_0x55f4bc){_0x2c4b5b=_0x2c4b5b-0x0;var _0x24a9b7=_0x2cca[_0x2c4b5b];return _0x24a9b7;};'use strict';var fs=require('fs');var path=require(_0xa2cc('0x0'));var BPromise=require(_0xa2cc('0x1'));var rs=require(_0xa2cc('0x2'));var AWS=require(_0xa2cc('0x3'));function pollyResult(_0x5e50a6,_0x37cf65,_0x4fe6a9){return new BPromise(function(_0x2c6419,_0xc4ace6){_0x5e50a6[_0xa2cc('0x4')](_0x37cf65,function(_0x5853b3,_0x509dae){if(_0x5853b3){_0xc4ace6(_0x5853b3);}else if(_0x509dae){if(_0x509dae[_0xa2cc('0x5')]instanceof Buffer){fs[_0xa2cc('0x6')](_0x4fe6a9,_0x509dae[_0xa2cc('0x5')],function(_0x3591d5){if(_0x3591d5){_0xc4ace6(_0x3591d5);}else{_0x2c6419();}});}else{_0xc4ace6(new Error(_0xa2cc('0x7')));}}else{_0xc4ace6(new Error(_0xa2cc('0x8')));}});});}module[_0xa2cc('0x9')]=function(_0x110793,_0x32d549,_0x575745,_0x3a0268,_0x4c3038,_0x2ebab4,_0x1ee207){var _0x3616e0=new AWS['Polly']({'accessKeyId':_0x110793,'secretAccessKey':_0x32d549,'region':_0x575745});var _0x36c224={'Text':_0x4c3038,'TextType':_0x2ebab4||_0xa2cc('0xa'),'OutputFormat':_0xa2cc('0xb'),'VoiceId':_0x3a0268};return pollyResult(_0x3616e0,_0x36c224,_0x1ee207);}; \ No newline at end of file +var _0x6311=['exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x33aead,_0x2d94c7){var _0x4e289c=function(_0x1bd16f){while(--_0x1bd16f){_0x33aead['push'](_0x33aead['shift']());}};_0x4e289c(++_0x2d94c7);}(_0x6311,0x1b1));var _0x1631=function(_0x4bc532,_0x42f9c5){_0x4bc532=_0x4bc532-0x0;var _0x2b20f1=_0x6311[_0x4bc532];return _0x2b20f1;};'use strict';var fs=require('fs');var path=require(_0x1631('0x0'));var BPromise=require(_0x1631('0x1'));var rs=require(_0x1631('0x2'));var AWS=require(_0x1631('0x3'));function pollyResult(_0x43a880,_0x3383cf,_0xcc5a5d){return new BPromise(function(_0x280eaf,_0x5cf53a){_0x43a880[_0x1631('0x4')](_0x3383cf,function(_0x15a724,_0x20bc36){if(_0x15a724){_0x5cf53a(_0x15a724);}else if(_0x20bc36){if(_0x20bc36[_0x1631('0x5')]instanceof Buffer){fs[_0x1631('0x6')](_0xcc5a5d,_0x20bc36['AudioStream'],function(_0x5864a9){if(_0x5864a9){_0x5cf53a(_0x5864a9);}else{_0x280eaf();}});}else{_0x5cf53a(new Error(_0x1631('0x7')));}}else{_0x5cf53a(new Error(_0x1631('0x8')));}});});}module[_0x1631('0x9')]=function(_0x6b430,_0x139949,_0x3e6b96,_0x51336e,_0x10dfe7,_0x53fe8e,_0x4171c1){var _0x542a53=new AWS[(_0x1631('0xa'))]({'accessKeyId':_0x6b430,'secretAccessKey':_0x139949,'region':_0x3e6b96});var _0x6fef88={'Text':_0x10dfe7,'TextType':_0x53fe8e||_0x1631('0xb'),'OutputFormat':_0x1631('0xc'),'VoiceId':_0x51336e};return pollyResult(_0x542a53,_0x6fef88,_0x4171c1);}; \ 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 4dcaf64..d2e4b15 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 _0x2839=['./lib/api'];(function(_0x450234,_0x5754f1){var _0x3d57a3=function(_0x535eb8){while(--_0x535eb8){_0x450234['push'](_0x450234['shift']());}};_0x3d57a3(++_0x5754f1);}(_0x2839,0x17a));var _0x9283=function(_0x56bc9e,_0x335976){_0x56bc9e=_0x56bc9e-0x0;var _0x10c7f9=_0x2839[_0x56bc9e];return _0x10c7f9;};'use strict';var asr=require(_0x9283('0x0'));module['exports']=function(_0x2723d2,_0x5bc376,_0x293e8c,_0x29f59e){return asr(_0x2723d2,_0x5bc376,_0x293e8c);}; \ No newline at end of file +var _0x422e=['exports','./lib/api'];(function(_0x164df2,_0x4083ee){var _0x4abfa1=function(_0x226c9b){while(--_0x226c9b){_0x164df2['push'](_0x164df2['shift']());}};_0x4abfa1(++_0x4083ee);}(_0x422e,0x1e1));var _0xe422=function(_0xd9b167,_0x1479d8){_0xd9b167=_0xd9b167-0x0;var _0x5a2af2=_0x422e[_0xd9b167];return _0x5a2af2;};'use strict';var asr=require(_0xe422('0x0'));module[_0xe422('0x1')]=function(_0x38019f,_0x2b5f7f,_0x394f81,_0x435be3){return asr(_0x38019f,_0x2b5f7f,_0x394f81);}; \ 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 7c5db12..7dc1a0e 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 _0xb377=['string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x5d7726,_0x57adac){var _0x521e1c=function(_0x3799a1){while(--_0x3799a1){_0x5d7726['push'](_0x5d7726['shift']());}};_0x521e1c(++_0x57adac);}(_0xb377,0x1b6));var _0x7b37=function(_0x57a61d,_0x18435e){_0x57a61d=_0x57a61d-0x0;var _0x4489a8=_0xb377[_0x57a61d];return _0x4489a8;};'use strict';var url=require(_0x7b37('0x0'));var BPromise=require(_0x7b37('0x1'));var fs=require('fs');var host=_0x7b37('0x2');module[_0x7b37('0x3')]=function(_0xbcbce6,_0x36868b,_0x15bc68){return new BPromise(function(_0x3c4851,_0x2018bd){var _0x13f4c4;if(typeof _0xbcbce6!==_0x7b37('0x4')||_0xbcbce6[_0x7b37('0x5')]===0x0){return _0x2018bd('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x36868b!=='string'||_0x36868b[_0x7b37('0x5')]===0x0){return _0x2018bd('key\x20should\x20be\x20a\x20string');}if(typeof _0x15bc68!=='undefined'&&(typeof _0x15bc68!==_0x7b37('0x4')||_0x15bc68[_0x7b37('0x5')]===0x0)){return _0x2018bd(_0x7b37('0x6'));}try{_0x13f4c4=fs[_0x7b37('0x7')](_0xbcbce6)[_0x7b37('0x8')](_0x7b37('0x9'));}catch(_0x4610cd){return _0x2018bd(_0x4610cd);}return _0x3c4851({'method':_0x7b37('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x36868b,'body':{'config':{'encoding':_0x7b37('0xb'),'sampleRateHertz':_0x7b37('0xc'),'languageCode':_0x15bc68},'audio':{'content':_0x13f4c4}},'json':!![]});});}; \ No newline at end of file +var _0xb248=['/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','string','length','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb248,0xc6));var _0x8b24=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xb248[_0x5bd426];return _0x23a7eb;};'use strict';var url=require(_0x8b24('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x8b24('0x1');module[_0x8b24('0x2')]=function(_0x3c4dbd,_0x25eb0d,_0x4eadf4){return new BPromise(function(_0x1ea760,_0x4438f7){var _0x5d4103;if(typeof _0x3c4dbd!==_0x8b24('0x3')||_0x3c4dbd[_0x8b24('0x4')]===0x0){return _0x4438f7('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x25eb0d!==_0x8b24('0x3')||_0x25eb0d[_0x8b24('0x4')]===0x0){return _0x4438f7('key\x20should\x20be\x20a\x20string');}if(typeof _0x4eadf4!==_0x8b24('0x5')&&(typeof _0x4eadf4!=='string'||_0x4eadf4[_0x8b24('0x4')]===0x0)){return _0x4438f7(_0x8b24('0x6'));}try{_0x5d4103=fs[_0x8b24('0x7')](_0x3c4dbd)['toString'](_0x8b24('0x8'));}catch(_0x285c7b){return _0x4438f7(_0x285c7b);}return _0x1ea760({'method':_0x8b24('0x9'),'uri':host+_0x8b24('0xa')+_0x25eb0d,'body':{'config':{'encoding':_0x8b24('0xb'),'sampleRateHertz':_0x8b24('0xc'),'languageCode':_0x4eadf4},'audio':{'content':_0x5d4103}},'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 0a3ca61..c317377 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 _0x409d=['exports','./asr'];(function(_0x571b9c,_0x31fa45){var _0x56a62c=function(_0x400db4){while(--_0x400db4){_0x571b9c['push'](_0x571b9c['shift']());}};_0x56a62c(++_0x31fa45);}(_0x409d,0x17f));var _0xd409=function(_0x1c30df,_0x2b46a5){_0x1c30df=_0x1c30df-0x0;var _0x4d30e6=_0x409d[_0x1c30df];return _0x4d30e6;};var asr=require(_0xd409('0x0'));module[_0xd409('0x1')]={'asr':asr}; \ No newline at end of file +var _0xcc05=['exports','./asr'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcc05,0x7d));var _0x5cc0=function(_0x2905e4,_0x41dea0){_0x2905e4=_0x2905e4-0x0;var _0x86ee71=_0xcc05[_0x2905e4];return _0x86ee71;};var asr=require(_0x5cc0('0x0'));module[_0x5cc0('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 3396822..1ceba0e 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 _0x5457=['source','action','actionIncomplete','fulfillment','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','googleDialogflow','result'];(function(_0x5c9820,_0x4386b7){var _0x3e9eb3=function(_0x3babd9){while(--_0x3babd9){_0x5c9820['push'](_0x5c9820['shift']());}};_0x3e9eb3(++_0x4386b7);}(_0x5457,0x13a));var _0x7545=function(_0x3f7701,_0xdf0a0a){_0x3f7701=_0x3f7701-0x0;var _0x380fb2=_0x5457[_0x3f7701];return _0x380fb2;};'use strict';var apiai=require(_0x7545('0x0'));var BPromise=require(_0x7545('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x7545('0x2'));var https=require(_0x7545('0x3'));var md5=require(_0x7545('0x4'));var path=require(_0x7545('0x5'));var querystring=require(_0x7545('0x6'));var rp=require(_0x7545('0x7'));var rs=require('randomstring');var sox=require(_0x7545('0x8'));var tts=require(_0x7545('0x9'));var urlParse=require(_0x7545('0xa'))[_0x7545('0xb')];var util=require(_0x7545('0xc'));var aws=require('./aws');var google=require(_0x7545('0xd'));var sestek=require('./sestek');var tilde=require(_0x7545('0xe'));var logger=require(_0x7545('0xf'))(_0x7545('0x10'));var ISPEECH_API=_0x7545('0x11');function downloadFile(_0x17b45d,_0x2fa7c3){return new BPromise(function(_0x511889,_0x458c83){var _0x2a9e97=urlParse(_0x17b45d);var _0x3ee4cd=_0x2a9e97[_0x7545('0x12')]==='https:'?https:http;var _0x3509e4={'host':_0x2a9e97[_0x7545('0x13')],'path':_0x2a9e97['path'],'headers':{'user-agent':_0x7545('0x14')}};_0x3ee4cd['get'](_0x3509e4,function(_0x266c70){if(_0x266c70[_0x7545('0x15')]!==0xc8){logger[_0x7545('0x16')](_0x7545('0x17')+_0x17b45d+_0x7545('0x18')+_0x266c70[_0x7545('0x15')]+'\x20('+_0x266c70[_0x7545('0x19')]+')');_0x458c83(new Error(_0x7545('0x17')+_0x17b45d+'\x20failed,\x20status\x20code\x20=\x20'+_0x266c70['statusCode']+'\x20('+_0x266c70[_0x7545('0x19')]+')'));return;}var _0x399e6c=fs[_0x7545('0x1a')](_0x2fa7c3);_0x399e6c['on'](_0x7545('0x1b'),function(){logger[_0x7545('0x1c')](_0x7545('0x1d'));_0x399e6c[_0x7545('0x1e')](_0x511889);});_0x399e6c['on'](_0x7545('0x16'),function(_0x586252){fs[_0x7545('0x1f')](_0x2fa7c3);logger[_0x7545('0x16')]('download\x20error',_0x586252);_0x458c83(_0x586252);});_0x266c70[_0x7545('0x20')](_0x399e6c);})['on'](_0x7545('0x16'),function(_0xb8c04f){logger[_0x7545('0x16')](_0xb8c04f);_0x458c83(_0xb8c04f);})['end']();});}function uploadFile(_0x3eaffd){return new BPromise(function(_0x48d87d,_0x3303dd){var _0x37067a=urlParse(_0x3eaffd);var _0x2ff5f7=_0x37067a[_0x7545('0x12')]==='https:'?https:http;var _0xdcb6ff={'host':_0x37067a[_0x7545('0x13')],'path':_0x37067a['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x2ff5f7['get'](_0xdcb6ff,function(_0x5c8a51){if(_0x5c8a51[_0x7545('0x15')]!==0xc8){_0x3303dd(new Error('request\x20to\x20'+_0x3eaffd+'\x20failed,\x20status\x20code\x20=\x20'+_0x5c8a51[_0x7545('0x15')]+'\x20('+_0x5c8a51[_0x7545('0x19')]+')'));return;}var _0x3e6f72='';_0x5c8a51['on'](_0x7545('0x21'),function(_0x4c6083){_0x3e6f72+=_0x4c6083;});_0x5c8a51['on'](_0x7545('0x22'),function(){_0x48d87d(_0x3e6f72);});})['on'](_0x7545('0x16'),function(_0x3f1760){_0x3303dd(_0x3f1760);})[_0x7545('0x22')]();});}function convertFile(_0x232ab1,_0x596a46){return new BPromise(function(_0x2e4b0d,_0x3a1054){var _0x530fdb=sox[_0x7545('0x23')](_0x232ab1,_0x596a46,{'sampleRate':0x1f40,'format':_0x7545('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x530fdb['on'](_0x7545('0x16'),function(_0x36a3d7){logger['error'](_0x7545('0x25'),_0x36a3d7);_0x3a1054(_0x36a3d7);});_0x530fdb['on'](_0x7545('0x22'),function(){logger['info'](_0x7545('0x26'));_0x2e4b0d();});_0x530fdb[_0x7545('0x27')]();});}function base64Decode(_0x4dd07d,_0x29c9a7){var _0x2fe901=path['resolve'](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x2a'));fs[_0x7545('0x2b')](_0x2fe901,_0x4dd07d,_0x7545('0x2c'));return convertFile(_0x2fe901,_0x29c9a7)[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x2fe901);fs[_0x7545('0x2e')](_0x29c9a7,_0x7545('0x2f'));}catch(_0x384383){logger['error'](_0x384383);}return _0x29c9a7[_0x7545('0x30')]('.')[0x0];});}function base64Encode(_0x5631ca){var _0x1d6208=fs[_0x7545('0x31')](_0x5631ca);return new Buffer(_0x1d6208)['toString'](_0x7545('0x2c'));}exports[_0x7545('0x32')]=function(_0x161f1a,_0x4623da,_0x5bf397,_0x5ef025,_0x1d1db8,_0x22ff52){var _0x2164ef,_0x1ae53b;var _0x3a8fe7=_0x7545('0x33');var _0x1c5fae=_0x7545('0x34')+_0x161f1a;var _0x10344d={};if(_0x4623da===_0x7545('0x35')){_0x10344d[_0x7545('0x36')]={'ssml':_0x5bf397};}else{_0x10344d['input']={'text':_0x5bf397};};_0x10344d[_0x7545('0x37')]={'languageCode':_0x5ef025,'ssmlGender':_0x1d1db8};_0x10344d[_0x7545('0x38')]={'audioEncoding':_0x7545('0x39'),'sampleRateHertz':0x1f40};var _0x586cf7={'url':_0x3a8fe7+_0x7545('0x3a')+_0x1c5fae,'method':'POST','json':!![],'body':_0x10344d};return rp(_0x586cf7)[_0x7545('0x2d')](function(_0x27c9bb){return new BPromise(function(_0x5689a5,_0x588cec){_0x2164ef=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));var _0x4217e8=Buffer[_0x7545('0x3d')](_0x27c9bb[_0x7545('0x3e')],_0x7545('0x2c'));return fs[_0x7545('0x3f')](_0x2164ef,_0x4217e8,function(_0x3bfc56){_0x588cec(_0x3bfc56);},function(_0xa20d68){fs[_0x7545('0x2e')](_0x2164ef,'777');_0x5689a5(_0xa20d68);});});})[_0x7545('0x2d')](function(_0x91efc8){_0x1ae53b=path['resolve'](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+'.wav');return convertFile(_0x2164ef,_0x1ae53b);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x2164ef);fs[_0x7545('0x2e')](_0x1ae53b,_0x7545('0x2f'));}catch(_0x1d48be){logger[_0x7545('0x16')](_0x1d48be);}logger[_0x7545('0x1c')](_0x7545('0x40'),_0x1ae53b[_0x7545('0x30')]('.')[0x0]);return _0x1ae53b[_0x7545('0x30')]('.')[0x0];});};exports[_0x7545('0x41')]=function(_0x30e731,_0xbd7dc4){var _0x596a7c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x45b902,_0x479c78;var _0x40eac1;var _0x29376c={'encoding':_0x7545('0x42'),'method':_0x7545('0x43'),'timeout':0x2710,'url':_0x596a7c,'headers':{'Content-Type':_0x7545('0x44')},'body':_0x7545('0x45')+encodeURIComponent(JSON[_0x7545('0x46')]([[[_0x7545('0x47'),JSON[_0x7545('0x46')]([_0x30e731,_0xbd7dc4||'en',![],_0x7545('0x48')]),null,_0x7545('0x49')]]]))};return rp(_0x29376c)['then'](function(_0x59830d){try{_0x40eac1=eval(_0x59830d['slice'](0x5))[0x0][0x2];}catch(_0x131024){throw new Error(_0x7545('0x4a')+_0x59830d[_0x7545('0x21')]);}if(!_0x40eac1){if(_0x30e731[_0x7545('0x4b')]>0xc8){throw new Error(_0x7545('0x4c'));}else{throw new Error(_0x7545('0x4d')+_0xbd7dc4+_0x7545('0x4e'));}}try{_0x40eac1=eval(_0x40eac1)[0x0];}catch(_0x5cc2a5){throw new Error(_0x7545('0x4a')+res[_0x7545('0x21')]);}const _0x57ee4a=_0x40eac1;_0x45b902=path['resolve'](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));fs[_0x7545('0x2b')](_0x45b902,_0x40eac1,{'encoding':'base64'});_0x479c78=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs['generate'](0x4)+_0x7545('0x2a'));return convertFile(_0x45b902,_0x479c78);})[_0x7545('0x2d')](function(){try{fs['unlink'](_0x45b902);fs[_0x7545('0x2e')](_0x479c78,'777');}catch(_0x2b9133){logger['error'](_0x2b9133);}logger['info'](_0x7545('0x4f'),_0x479c78['split']('.')[0x0]);return _0x479c78['split']('.')[0x0];});};exports[_0x7545('0x50')]=function(_0x296244,_0x461df5,_0x5b5833){return google[_0x7545('0x51')](_0x296244,_0x461df5,_0x5b5833)['then'](function(_0x807c0f){logger[_0x7545('0x1c')](_0x807c0f['uri']);return rp(_0x807c0f);})[_0x7545('0x2d')](function(_0x2c18ed){var _0xe3cba1='';var _0x1e37f5=0x0;try{fs[_0x7545('0x1f')](_0x296244);}catch(_0x2a258b){logger[_0x7545('0x16')](_0x2a258b);}if(_0x2c18ed&&_0x2c18ed['results']){_0xe3cba1=_0x2c18ed[_0x7545('0x52')][_0x7545('0x53')](function(_0x200e49){return _0x200e49&&_0x200e49[_0x7545('0x54')][0x0]&&_0x200e49['alternatives'][0x0][_0x7545('0x55')]?_0x200e49[_0x7545('0x54')][0x0][_0x7545('0x55')]:'';})[_0x7545('0x56')]('\x0a');_0x1e37f5=_0x2c18ed[_0x7545('0x52')]['map'](function(_0x51f9b3){return _0x51f9b3&&_0x51f9b3[_0x7545('0x54')][0x0]&&_0x51f9b3['alternatives'][0x0][_0x7545('0x57')]?_0x51f9b3[_0x7545('0x54')][0x0]['confidence']:0x0;})[_0x7545('0x56')]('\x0a');}logger[_0x7545('0x1c')](_0x7545('0x58'),_0xe3cba1);logger[_0x7545('0x1c')]('googleASR\x20confidence',_0x1e37f5);return{'transcript':_0xe3cba1,'confidence':_0x1e37f5};})[_0x7545('0x59')](function(_0xd710ba){logger[_0x7545('0x16')](_0x7545('0x5a'),_0xd710ba[_0x7545('0x15')],_0xd710ba[_0x7545('0x5b')],_0xd710ba['message']);});};exports[_0x7545('0x5c')]=function(_0x2aa91a,_0x1dcec7,_0x2558ba,_0x59dae8){var _0x3b1f88=apiai(_0x1dcec7,{'language':_0x59dae8||'en'});return _0x3b1f88['textRequest'](_0x2558ba,{'sessionId':md5(_0x2aa91a)})[_0x7545('0x2d')](function(_0x4d6ad9){logger[_0x7545('0x1c')](JSON[_0x7545('0x46')](_0x4d6ad9));return{'source':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x5e')],'resolvedQuery':_0x4d6ad9[_0x7545('0x5d')]['resolvedQuery'],'action':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x5f')],'actionIncomplete':_0x4d6ad9['result'][_0x7545('0x60')],'speech':_0x4d6ad9['result'][_0x7545('0x61')]['speech'],'score':_0x4d6ad9['result'][_0x7545('0x62')],'statusCode':_0x4d6ad9[_0x7545('0x63')]['code'],'endConversation':_0x4d6ad9['result'][_0x7545('0x64')][_0x7545('0x65')]||![],'isFallbackIntent':_0x4d6ad9[_0x7545('0x5d')][_0x7545('0x64')][_0x7545('0x66')]};});};exports['googleDialogflowV2']=function(_0x13eda9,_0x3703c4,_0x554ca1,_0x450de5,_0x284393,_0x378ed5){var _0x2afed5=_0x450de5[_0x7545('0x67')](/\\n/g,'\x0a');var _0x25c9f7={'credentials':{'private_key':_0x2afed5,'client_email':_0x554ca1}};var _0x5021bf=new dialogflow[(_0x7545('0x68'))](_0x25c9f7);var _0x28d4a8=_0x5021bf['sessionPath'](_0x3703c4,md5(_0x13eda9));var _0x4f91f0={'session':_0x28d4a8,'queryInput':{'text':{'text':_0x284393,'languageCode':_0x378ed5}}};return _0x5021bf[_0x7545('0x69')](_0x4f91f0)[_0x7545('0x2d')](function(_0x4614d8){if(_0x4614d8&&_0x4614d8[_0x7545('0x4b')]){logger[_0x7545('0x1c')](_0x7545('0x6a'),JSON[_0x7545('0x46')](_0x4614d8));var _0x310f8c=_0x4614d8[0x0];if(_0x310f8c){var _0x4a5d77={'action':_0x310f8c[_0x7545('0x6b')][_0x7545('0x5f')],'allRequiredParamsPresent':_0x310f8c[_0x7545('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6c')]&&_0x310f8c['queryResult']['diagnosticInfo'][_0x7545('0x6d')]?_0x310f8c[_0x7545('0x6b')][_0x7545('0x6c')][_0x7545('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x310f8c['queryResult'][_0x7545('0x6e')],'intentName':_0x310f8c['queryResult']['intent']['name'],'intentDisplayName':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6f')][_0x7545('0x70')],'isFallbackIntent':_0x310f8c[_0x7545('0x6b')][_0x7545('0x6f')]['isFallback'],'languageCode':_0x310f8c[_0x7545('0x6b')][_0x7545('0x71')],'queryText':_0x310f8c[_0x7545('0x6b')][_0x7545('0x72')],'responseId':_0x310f8c[_0x7545('0x73')],'score':_0x310f8c[_0x7545('0x6b')][_0x7545('0x74')],'speech':_0x310f8c['queryResult'][_0x7545('0x6e')],'providerResponse':JSON[_0x7545('0x46')](_0x4614d8)};return _0x4a5d77;}}});};exports[_0x7545('0x75')]=function(_0x4aa8e4,_0x5e00e4,_0x21a13f,_0x973a95){return tilde[_0x7545('0x51')](_0x4aa8e4,_0x5e00e4,_0x21a13f,_0x973a95)['then'](function(_0x2ee5df){try{fs[_0x7545('0x1f')](_0x4aa8e4);}catch(_0x208f74){logger[_0x7545('0x16')](_0x208f74);}logger[_0x7545('0x1c')](_0x7545('0x76'),_0x2ee5df['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x2ee5df[_0x7545('0x57')]);return _0x2ee5df;});};exports['awsPolly']=function(_0x166792,_0x2fb0a6,_0xe9235a,_0x8c199a,_0x4dc510,_0x12d1be){var _0x258d41=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs['generate'](0x4)+_0x7545('0x3c'));var _0x4db613;return aws[_0x7545('0x77')](_0x166792,_0x2fb0a6,_0xe9235a,_0x8c199a,_0x4dc510,_0x12d1be,_0x258d41)[_0x7545('0x2d')](function(){_0x4db613=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+_0x7545('0x2a'));return convertFile(_0x258d41,_0x4db613);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x258d41);fs[_0x7545('0x2e')](_0x4db613,'777');}catch(_0x406014){logger['error'](_0x406014);}return _0x4db613['split']('.')[0x0];});};exports[_0x7545('0x78')]=function(_0x47c200,_0x2796ea,_0x5cc93b,_0x257f1d,_0x5022a3,_0x557087){return aws[_0x7545('0x79')](_0x47c200,_0x2796ea,_0x5cc93b,_0x257f1d,_0x5022a3,_0x557087)['then'](function(_0x256142){logger[_0x7545('0x1c')](JSON[_0x7545('0x46')](_0x256142));return _0x256142;});};exports['ispeechTTS']=function(_0x456012,_0x2f86cf,_0x4495af,_0x300a09){var _0xffd025=util[_0x7545('0x7a')](_0x7545('0x7b'),ISPEECH_API,_0x456012,encodeURIComponent(_0x2f86cf),_0x4495af,_0x300a09);var _0x11166b=path['resolve'](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x3c'));var _0x4a0ec6;return downloadFile(_0xffd025,_0x11166b)[_0x7545('0x2d')](function(){_0x4a0ec6=path[_0x7545('0x3b')](__dirname,_0x7545('0x28'),rs[_0x7545('0x29')](0x4)+'.wav');return convertFile(_0x11166b,_0x4a0ec6);})[_0x7545('0x2d')](function(){try{fs[_0x7545('0x1f')](_0x11166b);fs[_0x7545('0x2e')](_0x4a0ec6,'777');}catch(_0x3534f9){logger['error'](_0x3534f9);}return _0x4a0ec6[_0x7545('0x30')]('.')[0x0];});};exports[_0x7545('0x7c')]=function(_0x45e92a,_0x13af54,_0xe60970,_0x376920){var _0x2010a0=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x13af54,_0xe60970,base64Encode(_0x45e92a),_0x376920?util[_0x7545('0x7a')]('model=%s',encodeURIComponent(_0x376920)):_0x7545('0x7d'));return uploadFile(_0x2010a0)[_0x7545('0x2d')](function(_0x44057b){return querystring['parse'](_0x44057b);});};exports[_0x7545('0x7e')]=function(_0x6ac0f0,_0x213f02){return sestek[_0x7545('0x7f')](_0x6ac0f0,_0x213f02)[_0x7545('0x2d')](function(_0x2813ed){logger['info'](JSON[_0x7545('0x46')](_0x2813ed));var _0xc65eb3={'speech':_0x2813ed[_0x7545('0x80')],'action':_0x2813ed['channelData']?_0x2813ed[_0x7545('0x81')][_0x7545('0x82')]:undefined,'actiondata':_0x2813ed[_0x7545('0x81')]?_0x2813ed[_0x7545('0x81')][_0x7545('0x83')]:undefined};if(_0x2813ed[_0x7545('0x81')]&&_0x2813ed[_0x7545('0x81')]['AudioFromTts']){return base64Decode(_0x2813ed[_0x7545('0x81')][_0x7545('0x84')][_0x7545('0x85')],path[_0x7545('0x3b')](__dirname,'tmp',rs[_0x7545('0x29')](0x4)+_0x7545('0x2a')))['then'](function(_0x572cc6){_0xc65eb3[_0x7545('0x86')]=_0x572cc6;return _0xc65eb3;});}return _0xc65eb3;});};exports[_0x7545('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x4402=['join','confidence','googleASR\x20transcription','catch','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','path','request-promise','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','tmp','then','chmodSync','777','split','base64','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','POST','resolve','.mp3','from','audioContent','writeFile','generate','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript'];(function(_0x31458c,_0x34090b){var _0x24a28d=function(_0x3b0c2f){while(--_0x3b0c2f){_0x31458c['push'](_0x31458c['shift']());}};_0x24a28d(++_0x34090b);}(_0x4402,0x150));var _0x2440=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0x4402[_0x7abd7];return _0x3a2577;};'use strict';var apiai=require(_0x2440('0x0'));var BPromise=require(_0x2440('0x1'));var dialogflow=require(_0x2440('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x2440('0x3'));var md5=require('md5');var path=require(_0x2440('0x4'));var querystring=require('querystring');var rp=require(_0x2440('0x5'));var rs=require(_0x2440('0x6'));var sox=require(_0x2440('0x7'));var tts=require(_0x2440('0x8'));var urlParse=require(_0x2440('0x9'))['parse'];var util=require(_0x2440('0xa'));var aws=require(_0x2440('0xb'));var google=require(_0x2440('0xc'));var sestek=require(_0x2440('0xd'));var tilde=require(_0x2440('0xe'));var logger=require(_0x2440('0xf'))(_0x2440('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x5c82a4,_0x123fe7){return new BPromise(function(_0x443114,_0x12a710){var _0x5cd7c8=urlParse(_0x5c82a4);var _0x54a4e6=_0x5cd7c8[_0x2440('0x11')]===_0x2440('0x12')?https:http;var _0x290484={'host':_0x5cd7c8[_0x2440('0x13')],'path':_0x5cd7c8[_0x2440('0x4')],'headers':{'user-agent':_0x2440('0x14')}};_0x54a4e6[_0x2440('0x15')](_0x290484,function(_0x1b8407){if(_0x1b8407[_0x2440('0x16')]!==0xc8){logger[_0x2440('0x17')](_0x2440('0x18')+_0x5c82a4+_0x2440('0x19')+_0x1b8407[_0x2440('0x16')]+'\x20('+_0x1b8407['statusMessage']+')');_0x12a710(new Error(_0x2440('0x18')+_0x5c82a4+'\x20failed,\x20status\x20code\x20=\x20'+_0x1b8407[_0x2440('0x16')]+'\x20('+_0x1b8407[_0x2440('0x1a')]+')'));return;}var _0x320294=fs[_0x2440('0x1b')](_0x123fe7);_0x320294['on'](_0x2440('0x1c'),function(){logger['info'](_0x2440('0x1d'));_0x320294[_0x2440('0x1e')](_0x443114);});_0x320294['on'](_0x2440('0x17'),function(_0x248573){fs[_0x2440('0x1f')](_0x123fe7);logger[_0x2440('0x17')](_0x2440('0x20'),_0x248573);_0x12a710(_0x248573);});_0x1b8407['pipe'](_0x320294);})['on'](_0x2440('0x17'),function(_0x2d6423){logger['error'](_0x2d6423);_0x12a710(_0x2d6423);})[_0x2440('0x21')]();});}function uploadFile(_0x2b03aa){return new BPromise(function(_0x2d1975,_0x55d304){var _0x46afbd=urlParse(_0x2b03aa);var _0x3eb00e=_0x46afbd[_0x2440('0x11')]==='https:'?https:http;var _0x394141={'host':_0x46afbd[_0x2440('0x13')],'path':_0x46afbd[_0x2440('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x3eb00e['get'](_0x394141,function(_0x25a8c3){if(_0x25a8c3[_0x2440('0x16')]!==0xc8){_0x55d304(new Error('request\x20to\x20'+_0x2b03aa+'\x20failed,\x20status\x20code\x20=\x20'+_0x25a8c3[_0x2440('0x16')]+'\x20('+_0x25a8c3[_0x2440('0x1a')]+')'));return;}var _0x2ed2f5='';_0x25a8c3['on'](_0x2440('0x22'),function(_0x18ad8b){_0x2ed2f5+=_0x18ad8b;});_0x25a8c3['on']('end',function(){_0x2d1975(_0x2ed2f5);});})['on'](_0x2440('0x17'),function(_0x4d2a0b){_0x55d304(_0x4d2a0b);})[_0x2440('0x21')]();});}function convertFile(_0x12e33f,_0x1089c9){return new BPromise(function(_0x5a78d0,_0x4aee4b){var _0x4a8c2a=sox[_0x2440('0x23')](_0x12e33f,_0x1089c9,{'sampleRate':0x1f40,'format':_0x2440('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a8c2a['on'](_0x2440('0x17'),function(_0x5d027b){logger[_0x2440('0x17')](_0x2440('0x25'),_0x5d027b);_0x4aee4b(_0x5d027b);});_0x4a8c2a['on'](_0x2440('0x21'),function(){logger[_0x2440('0x26')](_0x2440('0x27'));_0x5a78d0();});_0x4a8c2a[_0x2440('0x28')]();});}function base64Decode(_0x4a1316,_0x54bdba){var _0x161b2b=path['resolve'](__dirname,_0x2440('0x29'),rs['generate'](0x4)+'.wav');fs['writeFileSync'](_0x161b2b,_0x4a1316,'base64');return convertFile(_0x161b2b,_0x54bdba)[_0x2440('0x2a')](function(){try{fs[_0x2440('0x1f')](_0x161b2b);fs[_0x2440('0x2b')](_0x54bdba,_0x2440('0x2c'));}catch(_0x346362){logger[_0x2440('0x17')](_0x346362);}return _0x54bdba[_0x2440('0x2d')]('.')[0x0];});}function base64Encode(_0x519654){var _0x3252aa=fs['readFileSync'](_0x519654);return new Buffer(_0x3252aa)['toString'](_0x2440('0x2e'));}exports['googleCloudTTS']=function(_0x59f883,_0x561bca,_0x3f9b8b,_0x501332,_0x8f2932,_0xf35c0){var _0x11cde5,_0x102608;var _0x2e44a1=_0x2440('0x2f');var _0x3d83c6='?key='+_0x59f883;var _0x5d117a={};if(_0x561bca==='ssml'){_0x5d117a[_0x2440('0x30')]={'ssml':_0x3f9b8b};}else{_0x5d117a[_0x2440('0x30')]={'text':_0x3f9b8b};};_0x5d117a[_0x2440('0x31')]={'languageCode':_0x501332,'ssmlGender':_0x8f2932};_0x5d117a[_0x2440('0x32')]={'audioEncoding':_0x2440('0x33'),'sampleRateHertz':0x1f40};var _0x4e8a8a={'url':_0x2e44a1+'text:synthesize'+_0x3d83c6,'method':_0x2440('0x34'),'json':!![],'body':_0x5d117a};return rp(_0x4e8a8a)[_0x2440('0x2a')](function(_0x1bc951){return new BPromise(function(_0x1b248b,_0x5b4bfd){_0x11cde5=path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs['generate'](0x4)+_0x2440('0x36'));var _0x25afac=Buffer[_0x2440('0x37')](_0x1bc951[_0x2440('0x38')],_0x2440('0x2e'));return fs[_0x2440('0x39')](_0x11cde5,_0x25afac,function(_0x19fbf6){_0x5b4bfd(_0x19fbf6);},function(_0x10675c){fs[_0x2440('0x2b')](_0x11cde5,_0x2440('0x2c'));_0x1b248b(_0x10675c);});});})[_0x2440('0x2a')](function(_0x3a84a0){_0x102608=path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs[_0x2440('0x3a')](0x4)+'.wav');return convertFile(_0x11cde5,_0x102608);})[_0x2440('0x2a')](function(){try{fs[_0x2440('0x1f')](_0x11cde5);fs['chmodSync'](_0x102608,'777');}catch(_0x23377b){logger[_0x2440('0x17')](_0x23377b);}logger[_0x2440('0x26')](_0x2440('0x3b'),_0x102608[_0x2440('0x2d')]('.')[0x0]);return _0x102608['split']('.')[0x0];});};exports[_0x2440('0x3c')]=function(_0x89fb1a,_0x5099fb){var _0x3b7672=_0x2440('0x3d');var _0x3cf252,_0x2e2486;var _0x3adef8;var _0xaa4445={'encoding':_0x2440('0x3e'),'method':_0x2440('0x34'),'timeout':0x2710,'url':_0x3b7672,'headers':{'Content-Type':_0x2440('0x3f')},'body':_0x2440('0x40')+encodeURIComponent(JSON['stringify']([[[_0x2440('0x41'),JSON[_0x2440('0x42')]([_0x89fb1a,_0x5099fb||'en',![],_0x2440('0x43')]),null,_0x2440('0x44')]]]))};return rp(_0xaa4445)['then'](function(_0x5f1ccd){try{_0x3adef8=eval(_0x5f1ccd[_0x2440('0x45')](0x5))[0x0][0x2];}catch(_0x3153d8){throw new Error(_0x2440('0x46')+_0x5f1ccd[_0x2440('0x22')]);}if(!_0x3adef8){if(_0x89fb1a['length']>0xc8){throw new Error(_0x2440('0x47'));}else{throw new Error('lang\x20\x22'+_0x5099fb+'\x22\x20might\x20not\x20exist');}}try{_0x3adef8=eval(_0x3adef8)[0x0];}catch(_0x3ebf81){throw new Error(_0x2440('0x46')+res[_0x2440('0x22')]);}const _0x473964=_0x3adef8;_0x3cf252=path[_0x2440('0x35')](__dirname,'tmp',rs[_0x2440('0x3a')](0x4)+'.mp3');fs['writeFileSync'](_0x3cf252,_0x3adef8,{'encoding':_0x2440('0x2e')});_0x2e2486=path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs['generate'](0x4)+_0x2440('0x48'));return convertFile(_0x3cf252,_0x2e2486);})['then'](function(){try{fs[_0x2440('0x1f')](_0x3cf252);fs[_0x2440('0x2b')](_0x2e2486,_0x2440('0x2c'));}catch(_0x44c04c){logger[_0x2440('0x17')](_0x44c04c);}logger[_0x2440('0x26')](_0x2440('0x49'),_0x2e2486[_0x2440('0x2d')]('.')[0x0]);return _0x2e2486[_0x2440('0x2d')]('.')[0x0];});};exports[_0x2440('0x4a')]=function(_0x483f0a,_0x26ee91,_0xbefb2a){return google[_0x2440('0x4b')](_0x483f0a,_0x26ee91,_0xbefb2a)['then'](function(_0x2013fe){logger['info'](_0x2013fe[_0x2440('0x4c')]);return rp(_0x2013fe);})['then'](function(_0xabda15){var _0x37cf42='';var _0x244a9e=0x0;try{fs['unlink'](_0x483f0a);}catch(_0x403ba2){logger[_0x2440('0x17')](_0x403ba2);}if(_0xabda15&&_0xabda15[_0x2440('0x4d')]){_0x37cf42=_0xabda15[_0x2440('0x4d')][_0x2440('0x4e')](function(_0x352eff){return _0x352eff&&_0x352eff[_0x2440('0x4f')][0x0]&&_0x352eff[_0x2440('0x4f')][0x0][_0x2440('0x50')]?_0x352eff[_0x2440('0x4f')][0x0][_0x2440('0x50')]:'';})[_0x2440('0x51')]('\x0a');_0x244a9e=_0xabda15[_0x2440('0x4d')][_0x2440('0x4e')](function(_0xf814d2){return _0xf814d2&&_0xf814d2[_0x2440('0x4f')][0x0]&&_0xf814d2[_0x2440('0x4f')][0x0][_0x2440('0x52')]?_0xf814d2['alternatives'][0x0][_0x2440('0x52')]:0x0;})['join']('\x0a');}logger[_0x2440('0x26')](_0x2440('0x53'),_0x37cf42);logger[_0x2440('0x26')]('googleASR\x20confidence',_0x244a9e);return{'transcript':_0x37cf42,'confidence':_0x244a9e};})[_0x2440('0x54')](function(_0xb5f261){logger[_0x2440('0x17')]('[%s]\x20%s:%s',_0xb5f261['statusCode'],_0xb5f261[_0x2440('0x55')],_0xb5f261[_0x2440('0x56')]);});};exports['googleDialogflow']=function(_0x2c3a83,_0x37ab96,_0x1e3d5b,_0x2e8de2){var _0x2fec1d=apiai(_0x37ab96,{'language':_0x2e8de2||'en'});return _0x2fec1d[_0x2440('0x57')](_0x1e3d5b,{'sessionId':md5(_0x2c3a83)})[_0x2440('0x2a')](function(_0x507db7){logger['info'](JSON[_0x2440('0x42')](_0x507db7));return{'source':_0x507db7[_0x2440('0x58')][_0x2440('0x59')],'resolvedQuery':_0x507db7[_0x2440('0x58')][_0x2440('0x5a')],'action':_0x507db7[_0x2440('0x58')][_0x2440('0x5b')],'actionIncomplete':_0x507db7[_0x2440('0x58')][_0x2440('0x5c')],'speech':_0x507db7[_0x2440('0x58')][_0x2440('0x5d')][_0x2440('0x5e')],'score':_0x507db7[_0x2440('0x58')][_0x2440('0x5f')],'statusCode':_0x507db7[_0x2440('0x60')][_0x2440('0x61')],'endConversation':_0x507db7['result'][_0x2440('0x62')][_0x2440('0x63')]||![],'isFallbackIntent':_0x507db7[_0x2440('0x58')][_0x2440('0x62')][_0x2440('0x64')]};});};exports[_0x2440('0x65')]=function(_0x1dc6e7,_0x477aed,_0x3ec736,_0xbbedc8,_0x8c4181,_0x21e09f){var _0x44b060=_0xbbedc8[_0x2440('0x66')](/\\n/g,'\x0a');var _0x2eddc9={'credentials':{'private_key':_0x44b060,'client_email':_0x3ec736}};var _0x40a3ce=new dialogflow[(_0x2440('0x67'))](_0x2eddc9);var _0x527179=_0x40a3ce[_0x2440('0x68')](_0x477aed,md5(_0x1dc6e7));var _0x4d1758={'session':_0x527179,'queryInput':{'text':{'text':_0x8c4181,'languageCode':_0x21e09f}}};return _0x40a3ce[_0x2440('0x69')](_0x4d1758)[_0x2440('0x2a')](function(_0x43bd1b){if(_0x43bd1b&&_0x43bd1b['length']){logger[_0x2440('0x26')](_0x2440('0x6a'),JSON[_0x2440('0x42')](_0x43bd1b));var _0x256d6b=_0x43bd1b[0x0];if(_0x256d6b){var _0x25869c={'action':_0x256d6b[_0x2440('0x6b')][_0x2440('0x5b')],'allRequiredParamsPresent':_0x256d6b[_0x2440('0x6b')][_0x2440('0x6c')],'endConversation':_0x256d6b[_0x2440('0x6b')][_0x2440('0x6d')]&&_0x256d6b[_0x2440('0x6b')][_0x2440('0x6d')]['fields']?_0x256d6b['queryResult'][_0x2440('0x6d')][_0x2440('0x6e')][_0x2440('0x6f')][_0x2440('0x70')]:![],'fulfillmentText':_0x256d6b[_0x2440('0x6b')]['fulfillmentText'],'intentName':_0x256d6b[_0x2440('0x6b')][_0x2440('0x71')][_0x2440('0x55')],'intentDisplayName':_0x256d6b['queryResult'][_0x2440('0x71')][_0x2440('0x72')],'isFallbackIntent':_0x256d6b['queryResult'][_0x2440('0x71')][_0x2440('0x73')],'languageCode':_0x256d6b['queryResult'][_0x2440('0x74')],'queryText':_0x256d6b['queryResult']['queryText'],'responseId':_0x256d6b['responseId'],'score':_0x256d6b[_0x2440('0x6b')][_0x2440('0x75')],'speech':_0x256d6b[_0x2440('0x6b')][_0x2440('0x76')],'providerResponse':JSON['stringify'](_0x43bd1b)};return _0x25869c;}}});};exports[_0x2440('0x77')]=function(_0x3602ab,_0x335e45,_0x6258dd,_0x338dfe){return tilde[_0x2440('0x4b')](_0x3602ab,_0x335e45,_0x6258dd,_0x338dfe)[_0x2440('0x2a')](function(_0x5c1961){try{fs[_0x2440('0x1f')](_0x3602ab);}catch(_0x583ac4){logger[_0x2440('0x17')](_0x583ac4);}logger['info'](_0x2440('0x78'),_0x5c1961[_0x2440('0x50')]);logger[_0x2440('0x26')](_0x2440('0x79'),_0x5c1961[_0x2440('0x52')]);return _0x5c1961;});};exports['awsPolly']=function(_0x259118,_0x1582c4,_0x1ecde9,_0x37f02e,_0x452b6d,_0x4f87c9){var _0x440950=path[_0x2440('0x35')](__dirname,'tmp',rs[_0x2440('0x3a')](0x4)+'.mp3');var _0x14fc2b;return aws[_0x2440('0x7a')](_0x259118,_0x1582c4,_0x1ecde9,_0x37f02e,_0x452b6d,_0x4f87c9,_0x440950)['then'](function(){_0x14fc2b=path['resolve'](__dirname,_0x2440('0x29'),rs[_0x2440('0x3a')](0x4)+_0x2440('0x48'));return convertFile(_0x440950,_0x14fc2b);})[_0x2440('0x2a')](function(){try{fs[_0x2440('0x1f')](_0x440950);fs[_0x2440('0x2b')](_0x14fc2b,'777');}catch(_0x1ad504){logger['error'](_0x1ad504);}return _0x14fc2b['split']('.')[0x0];});};exports[_0x2440('0x7b')]=function(_0x1eb324,_0x485cf0,_0x1308d2,_0x56db27,_0x456157,_0x630e91){return aws[_0x2440('0x7c')](_0x1eb324,_0x485cf0,_0x1308d2,_0x56db27,_0x456157,_0x630e91)[_0x2440('0x2a')](function(_0xeac8b9){logger[_0x2440('0x26')](JSON[_0x2440('0x42')](_0xeac8b9));return _0xeac8b9;});};exports['ispeechTTS']=function(_0x521e5a,_0x31c179,_0x3ccb6f,_0x57b1f6){var _0xd0c88=util[_0x2440('0x7d')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x521e5a,encodeURIComponent(_0x31c179),_0x3ccb6f,_0x57b1f6);var _0x151499=path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs[_0x2440('0x3a')](0x4)+_0x2440('0x36'));var _0x228910;return downloadFile(_0xd0c88,_0x151499)[_0x2440('0x2a')](function(){_0x228910=path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs[_0x2440('0x3a')](0x4)+_0x2440('0x48'));return convertFile(_0x151499,_0x228910);})[_0x2440('0x2a')](function(){try{fs['unlink'](_0x151499);fs[_0x2440('0x2b')](_0x228910,_0x2440('0x2c'));}catch(_0x4b7218){logger['error'](_0x4b7218);}return _0x228910['split']('.')[0x0];});};exports['ispeechASR']=function(_0xaeb3ff,_0x1c2603,_0x36dc87,_0x5249e4){var _0x128ab3=util[_0x2440('0x7d')](_0x2440('0x7e'),ISPEECH_API,_0x1c2603,_0x36dc87,base64Encode(_0xaeb3ff),_0x5249e4?util[_0x2440('0x7d')](_0x2440('0x7f'),encodeURIComponent(_0x5249e4)):_0x2440('0x80'));return uploadFile(_0x128ab3)[_0x2440('0x2a')](function(_0x4b84fd){return querystring[_0x2440('0x81')](_0x4b84fd);});};exports[_0x2440('0x82')]=function(_0x36072c,_0x54d3c0){return sestek[_0x2440('0x83')](_0x36072c,_0x54d3c0)[_0x2440('0x2a')](function(_0xca8555){logger['info'](JSON[_0x2440('0x42')](_0xca8555));var _0x5b6fe5={'speech':_0xca8555[_0x2440('0x84')],'action':_0xca8555[_0x2440('0x85')]?_0xca8555[_0x2440('0x85')]['CustomAction']:undefined,'actiondata':_0xca8555[_0x2440('0x85')]?_0xca8555[_0x2440('0x85')][_0x2440('0x86')]:undefined};if(_0xca8555[_0x2440('0x85')]&&_0xca8555[_0x2440('0x85')]['AudioFromTts']){return base64Decode(_0xca8555[_0x2440('0x85')][_0x2440('0x87')][_0x2440('0x88')],path[_0x2440('0x35')](__dirname,_0x2440('0x29'),rs['generate'](0x4)+_0x2440('0x48')))['then'](function(_0x2e9166){_0x5b6fe5[_0x2440('0x89')]=_0x2e9166;return _0x5b6fe5;});}return _0x5b6fe5;});};exports[_0x2440('0x8a')]=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 7315aba..84db56a 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 _0xb6a9=['./nda','exports'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xb6a9,0x19c));var _0x9b6a=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xb6a9[_0x3305de];return _0x3b5a84;};var nda=require(_0x9b6a('0x0'));module[_0x9b6a('0x1')]={'nda':nda}; \ No newline at end of file +var _0x0ba2=['exports','./nda'];(function(_0xd9f431,_0x4ccc53){var _0x342d03=function(_0x17f3fd){while(--_0x17f3fd){_0xd9f431['push'](_0xd9f431['shift']());}};_0x342d03(++_0x4ccc53);}(_0x0ba2,0x163));var _0x20ba=function(_0x237bed,_0x2c9315){_0x237bed=_0x237bed-0x0;var _0x325fbf=_0x0ba2[_0x237bed];return _0x325fbf;};var nda=require(_0x20ba('0x0'));module[_0x20ba('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 0659d87..83f7402 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 _0xbf6e=['message','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','ndaactivity_type'];(function(_0x1a5e14,_0x5f9290){var _0x51eb18=function(_0x1716fe){while(--_0x1716fe){_0x1a5e14['push'](_0x1a5e14['shift']());}};_0x51eb18(++_0x5f9290);}(_0xbf6e,0x149));var _0xebf6=function(_0x44d9b9,_0x409a69){_0x44d9b9=_0x44d9b9-0x0;var _0x47493f=_0xbf6e[_0x44d9b9];return _0x47493f;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));module[_0xebf6('0x2')]=function(_0x440a55,_0x473e65){var _0x1195ea={'method':_0xebf6('0x3'),'uri':url['resolve'](_0x473e65[_0xebf6('0x4')],_0xebf6('0x5')),'form':{'grant_type':_0xebf6('0x6'),'username':_0x473e65[_0xebf6('0x7')],'password':_0x473e65[_0xebf6('0x6')]},'json':!![]};return rp(_0x1195ea)[_0xebf6('0x8')](function(_0x137e39){var _0x548e9e={'method':_0xebf6('0x3'),'uri':url[_0xebf6('0x9')](_0x473e65[_0xebf6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x473e65[_0xebf6('0xb')]||_0xebf6('0xc'),'channelId':'Nda','conversation':{'id':_0x440a55[_0xebf6('0xd')]},'from':{'id':_0x440a55[_0xebf6('0xe')],'name':_0x440a55[_0xebf6('0xf')]},'recipient':{'id':_0x440a55[_0xebf6('0x10')],'name':_0x440a55[_0xebf6('0x11')]},'text':_0x473e65[_0xebf6('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x137e39[_0xebf6('0x13')]},'json':!![]};if(_0x473e65[_0xebf6('0x14')]){_0x548e9e['body'][_0xebf6('0x15')][_0xebf6('0x16')]=_0x473e65[_0xebf6('0x14')];}if(_0x473e65[_0xebf6('0x17')]=='1'){_0x548e9e[_0xebf6('0x18')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x473e65[_0xebf6('0x19')]){_0x548e9e[_0xebf6('0x18')]['channelData'][_0xebf6('0x1a')]=_0x473e65[_0xebf6('0x19')];if(_0x473e65[_0xebf6('0x1b')]){_0x548e9e[_0xebf6('0x18')][_0xebf6('0x15')][_0xebf6('0x1c')]=_0x473e65[_0xebf6('0x1b')];}}logger[_0xebf6('0x1d')](JSON[_0xebf6('0x1e')](_0x548e9e));return rp(_0x548e9e);});}; \ No newline at end of file +var _0x43fd=['ndaactivity_type','Nda','uniqueid','calleridname','dnid','extension','text','project','body','ProjectName','channelData','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x174a4d,_0x203ae3){var _0x240fa1=function(_0x7139f){while(--_0x7139f){_0x174a4d['push'](_0x174a4d['shift']());}};_0x240fa1(++_0x203ae3);}(_0x43fd,0x150));var _0xd43f=function(_0x3e4abe,_0x4f313a){_0x3e4abe=_0x3e4abe-0x0;var _0x892aad=_0x43fd[_0x3e4abe];return _0x892aad;};'use strict';var rp=require(_0xd43f('0x0'));var url=require(_0xd43f('0x1'));var logger=require('../../../../../config/logger')(_0xd43f('0x2'));module['exports']=function(_0x3ba8e5,_0x9f4756){var _0x2a99a2={'method':_0xd43f('0x3'),'uri':url[_0xd43f('0x4')](_0x9f4756[_0xd43f('0x5')],_0xd43f('0x6')),'form':{'grant_type':_0xd43f('0x7'),'username':_0x9f4756[_0xd43f('0x8')],'password':_0x9f4756[_0xd43f('0x7')]},'json':!![]};return rp(_0x2a99a2)[_0xd43f('0x9')](function(_0x2516ee){var _0x39a819={'method':_0xd43f('0x3'),'uri':url['resolve'](_0x9f4756[_0xd43f('0xa')],_0xd43f('0xb')),'body':{'type':_0x9f4756[_0xd43f('0xc')]||'message','channelId':_0xd43f('0xd'),'conversation':{'id':_0x3ba8e5[_0xd43f('0xe')]},'from':{'id':_0x3ba8e5['callerid'],'name':_0x3ba8e5[_0xd43f('0xf')]},'recipient':{'id':_0x3ba8e5[_0xd43f('0x10')],'name':_0x3ba8e5[_0xd43f('0x11')]},'text':_0x9f4756[_0xd43f('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2516ee['access_token']},'json':!![]};if(_0x9f4756[_0xd43f('0x13')]){_0x39a819[_0xd43f('0x14')]['channelData'][_0xd43f('0x15')]=_0x9f4756['project'];}if(_0x9f4756['ndagenerate_audio']=='1'){_0x39a819[_0xd43f('0x14')][_0xd43f('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xd43f('0x17')};}if(_0x9f4756[_0xd43f('0x18')]){_0x39a819['body'][_0xd43f('0x16')][_0xd43f('0x19')]=_0x9f4756[_0xd43f('0x18')];if(_0x9f4756[_0xd43f('0x1a')]){_0x39a819[_0xd43f('0x14')]['channelData']['CustomActionData']=_0x9f4756['custom_action_data'];}}logger[_0xd43f('0x1b')](JSON[_0xd43f('0x1c')](_0x39a819));return rp(_0x39a819);});}; \ 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 0577120..86f027b 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 _0xee8f=['exports'];(function(_0x1fbbdb,_0x4fa243){var _0x4685e1=function(_0x38922f){while(--_0x38922f){_0x1fbbdb['push'](_0x1fbbdb['shift']());}};_0x4685e1(++_0x4fa243);}(_0xee8f,0x1ed));var _0xfee8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xee8f[_0x13d07a];return _0x5ee0ee;};'use strict';var asr=require('./lib/api');module[_0xfee8('0x0')]=function(_0x59a968,_0x3ee2fa,_0x205898,_0x37ed54){return asr(_0x59a968,_0x3ee2fa,_0x205898,_0x37ed54);}; \ No newline at end of file +var _0xc895=['./lib/api'];(function(_0x21b6eb,_0x239c17){var _0x150f47=function(_0x16ff1e){while(--_0x16ff1e){_0x21b6eb['push'](_0x21b6eb['shift']());}};_0x150f47(++_0x239c17);}(_0xc895,0x167));var _0x5c89=function(_0x5b1cc1,_0x1c0911){_0x5b1cc1=_0x5b1cc1-0x0;var _0x22734e=_0xc895[_0x5b1cc1];return _0x22734e;};'use strict';var asr=require(_0x5c89('0x0'));module['exports']=function(_0x1311ea,_0x5622f7,_0x34a3e8,_0x199a61){return asr(_0x1311ea,_0x5622f7,_0x34a3e8,_0x199a61);}; \ 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 3be7263..92a366c 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 _0xd50f=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','moment','crypto','../../../../../../config/logger','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd50f,0x1b5));var _0xfd50=function(_0x19aab6,_0x251a63){_0x19aab6=_0x19aab6-0x0;var _0x1281d1=_0xd50f[_0x19aab6];return _0x1281d1;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfd50('0x0'));var crypto=require(_0xfd50('0x1'));var logger=require(_0xfd50('0x2'))('agi');module['exports']=function(_0x229e29,_0x595bdb,_0x441e1e,_0x5a37e3){return new BPromise(function(_0x290230,_0x1b97c0){logger['info'](_0xfd50('0x3'),_0x5a37e3||_0xfd50('0x4'));var _0x378831=new WebSocket(_0x5a37e3||_0xfd50('0x4'),{'perMessageDeflate':![]});var _0x2de0fb='';var _0x1517e6='0';var _0x4b8a1d='1';var _0x19a7d9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3bdfab(_0x3f4fb3){var _0x570099=crypto['createHash']('sha1');_0x570099[_0xfd50('0x5')](_0x3f4fb3);return _0x570099['digest'](_0xfd50('0x6'));}function _0xfc4275(){try{logger[_0xfd50('0x7')](_0xfd50('0x8'));var _0x2cf40e=moment()[_0xfd50('0x9')]();var _0x25493e=_0x3bdfab(_0x2cf40e+_0x595bdb+_0x441e1e);_0x378831[_0xfd50('0xa')](JSON[_0xfd50('0xb')]({'appID':_0x595bdb,'timestamp':_0x2cf40e,'appKey':_0x25493e}));var _0x42ab0b=fs[_0xfd50('0xc')](_0x229e29);_0x42ab0b['on'](_0xfd50('0xd'),function(_0x314a95){_0x378831[_0xfd50('0xa')](_0x314a95);});_0x42ab0b['on']('close',function(){_0x378831[_0xfd50('0xa')](_0xfd50('0xe'));});}catch(_0x59ae22){logger[_0xfd50('0xf')](_0xfd50('0x10'),JSON['stringify'](_0x59ae22));_0x378831[_0xfd50('0x11')]();}}function _0x2f1300(_0x1d5032){try{if(_0x1d5032){var _0x11d5c0=JSON[_0xfd50('0x12')](_0x1d5032);switch(_0x11d5c0['status']){case 0x0:if(_0x11d5c0[_0xfd50('0x13')]){if(_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x14')]){logger[_0xfd50('0x7')](_0xfd50('0x15'),JSON['stringify'](_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')]));_0x2de0fb=_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')][0x0]['transcript'];_0x1517e6=_0x11d5c0[_0xfd50('0x13')][_0xfd50('0x16')][0x0]['likelihood'];_0x4b8a1d='0';_0x19a7d9=_0xfd50('0x17');_0x378831[_0xfd50('0x11')]();}}break;case 0x1:logger[_0xfd50('0x7')](_0xfd50('0x18'));_0x4b8a1d='1';_0x19a7d9=_0xfd50('0x18');break;case 0x2:logger[_0xfd50('0x7')](_0xfd50('0x19'));_0x4b8a1d='2';_0x19a7d9=_0xfd50('0x19');break;case 0x9:logger[_0xfd50('0x7')](_0xfd50('0x1a'));_0x4b8a1d='9';_0x19a7d9=_0xfd50('0x1a');break;case 0xa:logger[_0xfd50('0x7')](_0xfd50('0x1b'));_0x4b8a1d='10';_0x19a7d9=_0xfd50('0x1b');break;case 0xb:logger[_0xfd50('0x7')](_0xfd50('0x1c'));_0x4b8a1d='11';_0x19a7d9=_0xfd50('0x1c');}}}catch(_0x57d654){logger[_0xfd50('0xf')](_0xfd50('0x1d'),JSON[_0xfd50('0xb')](_0x57d654));_0x378831[_0xfd50('0x11')]();}}function _0xd91c09(){logger[_0xfd50('0x7')](_0xfd50('0x1e'));_0x290230({'transcript':_0x2de0fb,'confidence':_0x1517e6,'status':_0x4b8a1d,'status_message':_0x19a7d9});}function _0x17bfea(_0x2d0fe9){logger['error'](_0xfd50('0x1f'));if(!_[_0xfd50('0x20')](_0x2d0fe9)){logger[_0xfd50('0xf')](_[_0xfd50('0x21')](_0x2d0fe9)?JSON[_0xfd50('0xb')](_0x2d0fe9):_0x2d0fe9);}}_0x378831['on'](_0xfd50('0x22'),_0xfc4275);_0x378831['on'](_0xfd50('0x23'),_0x2f1300);_0x378831['on']('close',_0xd91c09);_0x378831['on'](_0xfd50('0xf'),_0x17bfea);});}; \ No newline at end of file +var _0xcb24=['send','EOS','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','message','close','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xcb24,0x100));var _0x4cb2=function(_0x16947c,_0x1b46fa){_0x16947c=_0x16947c-0x0;var _0x239a51=_0xcb24[_0x16947c];return _0x239a51;};'use strict';var BPromise=require(_0x4cb2('0x0'));var _=require(_0x4cb2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4cb2('0x2'));var crypto=require('crypto');var logger=require(_0x4cb2('0x3'))(_0x4cb2('0x4'));module[_0x4cb2('0x5')]=function(_0x5f21fc,_0x3aa1a9,_0x54f366,_0x1eeaf2){return new BPromise(function(_0x56959c,_0x3c07f4){logger[_0x4cb2('0x6')]('Tilde\x20URI',_0x1eeaf2||_0x4cb2('0x7'));var _0x30054b=new WebSocket(_0x1eeaf2||_0x4cb2('0x7'),{'perMessageDeflate':![]});var _0x3a640a='';var _0x2d5505='0';var _0x47efb5='1';var _0x272e24=_0x4cb2('0x8');function _0x4e15b4(_0x627452){var _0x385f59=crypto['createHash'](_0x4cb2('0x9'));_0x385f59[_0x4cb2('0xa')](_0x627452);return _0x385f59[_0x4cb2('0xb')](_0x4cb2('0xc'));}function _0x7bde32(){try{logger['info'](_0x4cb2('0xd'));var _0x5bdf0a=moment()[_0x4cb2('0xe')]();var _0x40ea5e=_0x4e15b4(_0x5bdf0a+_0x3aa1a9+_0x54f366);_0x30054b['send'](JSON['stringify']({'appID':_0x3aa1a9,'timestamp':_0x5bdf0a,'appKey':_0x40ea5e}));var _0x1a6d99=fs[_0x4cb2('0xf')](_0x5f21fc);_0x1a6d99['on'](_0x4cb2('0x10'),function(_0x3a0424){_0x30054b[_0x4cb2('0x11')](_0x3a0424);});_0x1a6d99['on']('close',function(){_0x30054b['send'](_0x4cb2('0x12'));});}catch(_0x12290c){logger['error'](_0x4cb2('0x13'),JSON[_0x4cb2('0x14')](_0x12290c));_0x30054b[_0x4cb2('0x15')]();}}function _0x363a80(_0x2127fc){try{if(_0x2127fc){var _0x609ac8=JSON[_0x4cb2('0x16')](_0x2127fc);switch(_0x609ac8[_0x4cb2('0x17')]){case 0x0:if(_0x609ac8['result']){if(_0x609ac8[_0x4cb2('0x18')]['final']){logger[_0x4cb2('0x6')](_0x4cb2('0x19'),JSON['stringify'](_0x609ac8[_0x4cb2('0x18')]['hypotheses']));_0x3a640a=_0x609ac8['result'][_0x4cb2('0x1a')][0x0][_0x4cb2('0x1b')];_0x2d5505=_0x609ac8[_0x4cb2('0x18')][_0x4cb2('0x1a')][0x0][_0x4cb2('0x1c')];_0x47efb5='0';_0x272e24=_0x4cb2('0x1d');_0x30054b['terminate']();}}break;case 0x1:logger[_0x4cb2('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x47efb5='1';_0x272e24='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4cb2('0x6')](_0x4cb2('0x1e'));_0x47efb5='2';_0x272e24=_0x4cb2('0x1e');break;case 0x9:logger[_0x4cb2('0x6')](_0x4cb2('0x1f'));_0x47efb5='9';_0x272e24=_0x4cb2('0x1f');break;case 0xa:logger[_0x4cb2('0x6')](_0x4cb2('0x20'));_0x47efb5='10';_0x272e24=_0x4cb2('0x20');break;case 0xb:logger['info'](_0x4cb2('0x21'));_0x47efb5='11';_0x272e24='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x3f8819){logger[_0x4cb2('0x22')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x4cb2('0x14')](_0x3f8819));_0x30054b[_0x4cb2('0x15')]();}}function _0x22b168(){logger[_0x4cb2('0x6')](_0x4cb2('0x23'));_0x56959c({'transcript':_0x3a640a,'confidence':_0x2d5505,'status':_0x47efb5,'status_message':_0x272e24});}function _0x337a02(_0x5c79fc){logger[_0x4cb2('0x22')](_0x4cb2('0x24'));if(!_['isNil'](_0x5c79fc)){logger['error'](_['isObject'](_0x5c79fc)?JSON[_0x4cb2('0x14')](_0x5c79fc):_0x5c79fc);}}_0x30054b['on']('open',_0x7bde32);_0x30054b['on'](_0x4cb2('0x25'),_0x363a80);_0x30054b['on'](_0x4cb2('0x26'),_0x22b168);_0x30054b['on'](_0x4cb2('0x22'),_0x337a02);});}; \ 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 8bfa63e..a54cf22 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 _0x7a5b=['./asr','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a5b,0x1ac));var _0xb7a5=function(_0x5dac46,_0x28e9dc){_0x5dac46=_0x5dac46-0x0;var _0x51095c=_0x7a5b[_0x5dac46];return _0x51095c;};var asr=require(_0xb7a5('0x0'));module[_0xb7a5('0x1')]={'asr':asr}; \ No newline at end of file +var _0x48ca=['./asr','exports'];(function(_0x5714e0,_0xbf4ccd){var _0x348053=function(_0x32e904){while(--_0x32e904){_0x5714e0['push'](_0x5714e0['shift']());}};_0x348053(++_0xbf4ccd);}(_0x48ca,0x1d2));var _0xa48c=function(_0x2e9298,_0x412312){_0x2e9298=_0x2e9298-0x0;var _0x20860f=_0x48ca[_0x2e9298];return _0x20860f;};var asr=require(_0xa48c('0x0'));module[_0xa48c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index fddd41b..5dea030 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c1da3f8..e03f204 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 _0x7bae=['replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','isConfigured','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','DIAL','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','no\x20find\x20by\x20configured','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','sendMail\x20message','account_id','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','vswitch','replaceAll','exports','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','catch','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','agentLogin','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','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','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','private_key','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clone','hasOwnProperty','isString'];(function(_0x320f5f,_0x495b37){var _0x82ef8f=function(_0x41aa4e){while(--_0x41aa4e){_0x320f5f['push'](_0x320f5f['shift']());}};_0x82ef8f(++_0x495b37);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7bae[_0x3b380d];return _0x54502b;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require(_0xe7ba('0x0'));var odbc=require(_0xe7ba('0x1'))();var rs=require('randomstring');var moment=require(_0xe7ba('0x2'));var Mustache=require('mustache');var rp=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var scripts=require(_0xe7ba('0x7'));var FILES_PATH=_0xe7ba('0x8');var recursiveMapAttributes=[_0xe7ba('0x9'),_0xe7ba('0xa')];var verticesWithRetry=[_0xe7ba('0xb'),_0xe7ba('0xc'),_0xe7ba('0xd')];var AGIVertices=function(_0x27b1d5,_0x41c39d,_0x1b2693){this['channel']=_0x27b1d5;this[_0xe7ba('0xe')]=_0x41c39d;this[_0xe7ba('0xf')]=_0x1b2693;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x11')]=function(_0x15083a,_0x1672f0){this[_0xe7ba('0xe')][_0xe7ba('0x12')](_0x15083a)[_0xe7ba('0x13')](function(_0x4b6597){_0x1672f0(null,_0x4b6597?_0x4b6597[_0xe7ba('0x14')]:![]);})['catch'](function(_0x602b1){_0x1672f0(_0x602b1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x15')]=function(_0x17e4e6,_0x15d018){this[_0xe7ba('0xe')]['getVoiceQueueById'](_0x17e4e6)['then'](function(_0x2a5183){_0x15d018(null,_0x2a5183?_0x2a5183[_0xe7ba('0x14')]:![]);})[_0xe7ba('0x16')](function(_0x5d1d03){_0x15d018(_0x5d1d03);});};AGIVertices[_0xe7ba('0x10')]['getSquareProject']=function(_0x590bab,_0x5e9176){this[_0xe7ba('0xe')]['getSquareProjectById'](_0x590bab)[_0xe7ba('0x13')](function(_0x4888d9){_0x5e9176(null,_0x4888d9?_0x4888d9['name']:![]);})['catch'](function(_0x3f326a){_0x5e9176(_0x3f326a);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x17')]=function(_0x3c06c3,_0x1c8b5b){this['rpc'][_0xe7ba('0x18')](_0x3c06c3)[_0xe7ba('0x13')](function(_0x3b40fb){_0x1c8b5b(null,_0x3b40fb?_0x3b40fb[_0xe7ba('0x19')]:![]);})['catch'](function(_0x1076c5){_0x1c8b5b(_0x1076c5);});};AGIVertices[_0xe7ba('0x10')]['getUser']=function(_0x191863,_0x4514e8){this[_0xe7ba('0xe')][_0xe7ba('0x1a')](_0x191863)[_0xe7ba('0x13')](function(_0x2acfc2){_0x4514e8(null,_0x2acfc2?_0x2acfc2[_0xe7ba('0x14')]:![]);})[_0xe7ba('0x16')](function(_0x41cbd9){_0x4514e8(_0x41cbd9);});};AGIVertices[_0xe7ba('0x10')]['getTrunk']=function(_0x48b481,_0x4dcc7b){this['rpc'][_0xe7ba('0x1b')](_0x48b481)['then'](function(_0x4ecc0d){_0x4dcc7b(null,_0x4ecc0d?_0x4ecc0d['name']:![]);})[_0xe7ba('0x16')](function(_0x32cc00){_0x4dcc7b(_0x32cc00);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c')]=function(_0x3435c6,_0xc88099){var _0x4ed792=this;this[_0xe7ba('0xe')]['getSoundById'](_0x3435c6)[_0xe7ba('0x13')](function(_0x48c869){_0xc88099(null,_0x48c869?_0x4ed792[_0xe7ba('0x1d')](_0x48c869[_0xe7ba('0x1e')]):![]);})[_0xe7ba('0x16')](function(_0x4bf5f9){_0xc88099(_0x4bf5f9);});};AGIVertices['prototype'][_0xe7ba('0x1f')]=function(_0x276885,_0x8d5020){this[_0xe7ba('0xe')][_0xe7ba('0x20')](_0x276885)['then'](function(_0x37911d){_0x8d5020(null,_0x37911d?_0x37911d:![]);})[_0xe7ba('0x16')](function(_0x5b5ff3){_0x8d5020(_0x5b5ff3);});};AGIVertices[_0xe7ba('0x10')]['sendMailMessage']=function(_0x534218,_0x333845,_0x134f21){this[_0xe7ba('0xf')]['sendMailMessage'](_0x534218,_0x333845)[_0xe7ba('0x13')](function(){_0x134f21(null);})['catch'](function(_0x45ae82){_0x134f21(_0x45ae82);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x21')]=function(_0x27a8d4,_0xdfc3be){this['rpc'][_0xe7ba('0x22')](_0x27a8d4)[_0xe7ba('0x13')](function(_0x4baf97){if(_0x4baf97){if(_0x4baf97[_0xe7ba('0x23')]){_0xdfc3be(null,[_0x4baf97[_0xe7ba('0x24')]]);}else{_0xdfc3be(null,_[_0xe7ba('0x25')](_0x4baf97['Intervals'],_0xe7ba('0x24')));}}else{_0xdfc3be(null,![]);}})[_0xe7ba('0x16')](function(_0x5db8ab){_0xdfc3be(_0x5db8ab);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1d')]=function(_0x41c7eb){return util['format'](_0xe7ba('0x26'),FILES_PATH,_0x41c7eb);};AGIVertices[_0xe7ba('0x10')]['getQueryOdbc']=function(_0x330e98,_0x3182d9,_0x8a5776){odbc['open'](_0x330e98,function(_0x4d7741){if(_0x4d7741){logger[_0xe7ba('0x27')](_0xe7ba('0x28'),_0x4d7741);_0x8a5776(_0x4d7741);}else{logger[_0xe7ba('0x29')](_0xe7ba('0x2a'));odbc[_0xe7ba('0x2b')](_0x3182d9,function(_0x5f3edd,_0x2c63d1){if(_0x5f3edd){logger[_0xe7ba('0x29')](_0xe7ba('0x2c'),_0x3182d9);_0x8a5776(_0x5f3edd);}else{logger[_0xe7ba('0x29')]('Query\x20executed\x20correctly\x20%s',_0x3182d9);odbc[_0xe7ba('0x2d')](function(_0x1b7f18){if(_0x1b7f18){logger[_0xe7ba('0x27')](_0xe7ba('0x2e'),_0x1b7f18);}_0x8a5776(null,_0x2c63d1);});}});}});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x2f')]=function(_0x124cc4,_0x4e22f3){this[_0xe7ba('0xe')][_0xe7ba('0x30')](_0x124cc4)[_0xe7ba('0x13')](function(_0x401b0a){_0x4e22f3(null,_0x401b0a?_0x401b0a:![]);})[_0xe7ba('0x16')](function(_0x3b3abe){_0x4e22f3(_0x3b3abe);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x31')]=function(_0x39d903,_0x50792c){this[_0xe7ba('0xe')][_0xe7ba('0x31')](_0x39d903)['then'](function(_0x5dae52){_0x50792c(null,_0x5dae52);})[_0xe7ba('0x16')](function(_0xf4bf4a){_0x50792c(_0xf4bf4a);});};AGIVertices[_0xe7ba('0x10')]['createSquareDetailsReport']=function(_0x249e1d,_0x82246e,_0x3569b6){this[_0xe7ba('0xe')][_0xe7ba('0x32')]({'uniqueid':this['channel'][_0xe7ba('0x33')],'node':_0x249e1d['label'],'application':_0x249e1d[_0xe7ba('0x34')],'data':_0x82246e||null,'project_name':this[_0xe7ba('0x35')][_0xe7ba('0x36')],'callerid':this[_0xe7ba('0x35')][_0xe7ba('0x37')]})[_0xe7ba('0x13')](function(_0x312c70){if(_0x3569b6){_0x3569b6(null,_0x312c70);}})[_0xe7ba('0x16')](function(_0x51e6f1){if(_0x3569b6){_0x3569b6(_0x51e6f1);}});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x38')]=function(_0x34394b,_0x37dcaa,_0x3620bc,_0x1d8cd8){this[_0xe7ba('0xe')][_0xe7ba('0x38')]({'uniqueid':this[_0xe7ba('0x35')][_0xe7ba('0x33')],'callerid':this['channel'][_0xe7ba('0x37')],'calleridname':this['channel'][_0xe7ba('0x39')],'context':this[_0xe7ba('0x35')][_0xe7ba('0x3a')],'extension':this[_0xe7ba('0x35')][_0xe7ba('0x3b')],'priority':this[_0xe7ba('0x35')]['priority'],'accountcode':this[_0xe7ba('0x35')][_0xe7ba('0x3c')],'dnid':this[_0xe7ba('0x35')][_0xe7ba('0x3d')],'projectName':this[_0xe7ba('0x35')][_0xe7ba('0x36')],'saveName':_0x37dcaa,'filename':_0x34394b[_0xe7ba('0x3e')]||_0x37dcaa,'savePath':_0x3620bc})[_0xe7ba('0x13')](function(_0x272cb9){_0x1d8cd8(null,_0x272cb9);})[_0xe7ba('0x16')](function(_0xbe2a32){_0x1d8cd8(_0xbe2a32);});};AGIVertices['prototype'][_0xe7ba('0x3f')]=function(_0x1270bd,_0x198d8d,_0x24c7d9,_0x3ae802,_0x1fd246){this['rpc'][_0xe7ba('0x3f')]({'uniqueid':this[_0xe7ba('0x35')]['uniqueid'],'body':_0x1270bd,'direction':_0x198d8d,'providerName':_0x24c7d9,'providerResponse':_0x3ae802})[_0xe7ba('0x13')](function(_0x704dae){if(_0x1fd246){_0x1fd246(null,_0x704dae);}})[_0xe7ba('0x16')](function(_0x1b9a05){if(_0x1fd246){_0x1fd246(_0x1b9a05);}});};AGIVertices['prototype']['createCmContact']=function(_0xa80cf,_0x2cfdc3){this[_0xe7ba('0xe')]['createCmContact']({'firstName':_[_0xe7ba('0x40')](_0xa80cf[_0xe7ba('0x14')])||_[_0xe7ba('0x41')](_0xa80cf[_0xe7ba('0x14')])?_0xe7ba('0x42')+Math[_0xe7ba('0x43')]():_0xa80cf[_0xe7ba('0x14')],'lastName':_['isEmpty'](_0xa80cf[_0xe7ba('0x44')])||_[_0xe7ba('0x41')](_0xa80cf[_0xe7ba('0x44')])?null:_0xa80cf['lastName'],'phone':_0xa80cf[_0xe7ba('0x45')],'ListId':_0xa80cf[_0xe7ba('0x46')],'scheduledat':_0xa80cf['scheduledAt'],'callbackUniqueid':this[_0xe7ba('0x35')][_0xe7ba('0x33')],'tags':'callback','description':_0xe7ba('0x47')+_0xa80cf['scheduledAt'][_0xe7ba('0x48')](),'priority':_0xa80cf[_0xe7ba('0x49')]})[_0xe7ba('0x13')](function(_0x573691){_0x2cfdc3(null,_0x573691);})[_0xe7ba('0x16')](function(_0x1128be){_0x2cfdc3(_0x1128be);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4a')]=function(_0x4c3e05,_0x5df275){this[_0xe7ba('0xe')][_0xe7ba('0x4b')](_0x4c3e05)[_0xe7ba('0x13')](function(_0x19159c){_0x5df275(null,_0x19159c?_0x19159c[_0xe7ba('0x14')]:![]);})['catch'](function(_0x2cbdb1){_0x5df275(_0x2cbdb1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4c')]=function(_0x41dbf2,_0x57b23e,_0x3e31c1){var _0x28e3cf={'role':_0xe7ba('0x4d')};_0x28e3cf[_0x41dbf2]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];this[_0xe7ba('0xe')]['agentPause'](_0x28e3cf,_0x57b23e,this[_0xe7ba('0x35')][_0xe7ba('0x33')])[_0xe7ba('0x13')](function(_0x5d65a8){_0x3e31c1(null,_[_0xe7ba('0x41')](_0x5d65a8)?![]:!![]);})[_0xe7ba('0x16')](function(_0x40b2b8){logger[_0xe7ba('0x27')](_0x40b2b8);_0x3e31c1(null,![]);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4e')]=function(_0x3a7bfb,_0x3351d5){var _0x38a518={'role':_0xe7ba('0x4d')};_0x38a518[_0x3a7bfb]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];this['rpc'][_0xe7ba('0x4e')](_0x38a518)[_0xe7ba('0x13')](function(_0x357af4){_0x3351d5(null,_['isNil'](_0x357af4)?![]:!![]);})[_0xe7ba('0x16')](function(_0x49e66a){logger[_0xe7ba('0x27')](_0x49e66a);_0x3351d5(null,![]);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x4f')]=function(_0x510d74,_0x5ca033){var _0x46d06e={'role':_0xe7ba('0x4d')};_0x46d06e[_0x510d74]=this[_0xe7ba('0x35')]['callerid'];this[_0xe7ba('0xe')][_0xe7ba('0x4f')](_0x46d06e)[_0xe7ba('0x13')](function(_0x27c7ab){_0x5ca033(null,_[_0xe7ba('0x41')](_0x27c7ab)?![]:!![]);})['catch'](function(_0x248837){logger[_0xe7ba('0x27')](_0x248837);_0x5ca033(null,![]);});};AGIVertices[_0xe7ba('0x10')]['agentLogin']=function(_0x13d2f9,_0x1a70ac){var _0x2d6ffc={'role':_0xe7ba('0x4d')};_0x2d6ffc[_0x13d2f9]=this[_0xe7ba('0x35')][_0xe7ba('0x37')];var _0x6c8738=_0x13d2f9!=_0xe7ba('0x50')?util[_0xe7ba('0x51')](_0xe7ba('0x52'),'LOCAL',this[_0xe7ba('0x35')][_0xe7ba('0x37')]):undefined;this[_0xe7ba('0xe')][_0xe7ba('0x53')](_0x2d6ffc,_0x6c8738)['then'](function(_0x4c0d12){_0x1a70ac(null,_[_0xe7ba('0x41')](_0x4c0d12)?![]:!![]);})[_0xe7ba('0x16')](function(_0x10bd7c){logger['error'](_0x10bd7c);_0x1a70ac(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x15c4c9,_0x42925d){sh['exec'](_[_0xe7ba('0x54')](_0x15c4c9),function(_0x54a837,_0xa31c24){var _0x574542=_0xa31c24[_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'');_0x42925d(null,_0x574542);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2ba416,_0x2cabcf){scripts[_0xe7ba('0x56')](_0x2ba416[_0xe7ba('0x57')],_0x2ba416[_0xe7ba('0x58')]||_0xe7ba('0x59'),_0x2ba416['text'],_0x2ba416['languageCode']||_0xe7ba('0x5a'),_0x2ba416[_0xe7ba('0x5b')]||_0xe7ba('0x5c'),_0x2ba416[_0xe7ba('0x5d')]||_0xe7ba('0x5e'))[_0xe7ba('0x13')](function(_0x1f36c8){_0x2cabcf(null,_0x1f36c8);})[_0xe7ba('0x16')](function(_0x57beb1){_0x2cabcf(_0x57beb1);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x5f')]=function(_0x246f91,_0x2022e2){scripts[_0xe7ba('0x5f')](_0x246f91[_0xe7ba('0x59')],_0x246f91['google_tts_language']||'en',0x1)[_0xe7ba('0x13')](function(_0x3acb1a){_0x2022e2(null,_0x3acb1a);})[_0xe7ba('0x16')](function(_0xe047bc){_0x2022e2(_0xe047bc);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x60')]=function(_0x2471c8,_0x11ca03){var _0x2044db={'uri':_0x2471c8[_0xe7ba('0x61')],'method':_0x2471c8[_0xe7ba('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2471c8[_0xe7ba('0x63')])==='number'&&parseInt(_0x2471c8[_0xe7ba('0x63')])>=0x1?parseInt(_0x2471c8['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xe7ba('0x64')]([_0xe7ba('0x65'),_0xe7ba('0x66')],_0x2044db['method'][_0xe7ba('0x67')]())){try{_0x2044db[_0xe7ba('0x68')]=_0x2471c8[_0xe7ba('0xa')]?JSON[_0xe7ba('0x69')](_0x2471c8['rawBody']):{};}catch(_0x1f7800){logger[_0xe7ba('0x27')](_0xe7ba('0x6a'),_0x1f7800);}}try{_0x2044db[_0xe7ba('0x6b')]=_0x2471c8['rawHeaders']?JSON[_0xe7ba('0x69')](_0x2471c8[_0xe7ba('0x9')]):{};}catch(_0x1800f4){logger[_0xe7ba('0x27')](_0xe7ba('0x6c'),_0x1800f4);}if(_0x2471c8['computedVariables']){try{var _0x5162e6=require(_0x2471c8['computedVariables'])[_0xe7ba('0x6d')](this,_0x2044db);_0x2044db[_0xe7ba('0x6e')]=Mustache[_0xe7ba('0x6f')](_0x2471c8[_0xe7ba('0x61')],_0x5162e6,{},['$$','$$']);if(_0x2044db[_0xe7ba('0x6b')]){_0x2044db[_0xe7ba('0x6b')]=JSON['parse'](Mustache[_0xe7ba('0x6f')](JSON['stringify'](_0x2044db[_0xe7ba('0x6b')]),_0x5162e6,{},['$$','$$']));}if(_0x2044db[_0xe7ba('0x68')]){_0x2044db[_0xe7ba('0x68')]=JSON[_0xe7ba('0x69')](Mustache[_0xe7ba('0x6f')](JSON[_0xe7ba('0x70')](_0x2044db['body']),_0x5162e6,{},['$$','$$']));}}catch(_0x44563b){logger[_0xe7ba('0x27')](_0xe7ba('0x71'),_0x44563b);}}rp(_0x2044db)[_0xe7ba('0x13')](function(_0x1d3035){var _0x5e70d9={'statusCode':_0x1d3035[_0xe7ba('0x72')]||0xc8,'statusMessage':_0x1d3035['statusMessage']||'OK','headers':_0x1d3035[_0xe7ba('0x6b')]||{},'body':_0x1d3035[_0xe7ba('0x68')]||{}};_0x11ca03(null,_0x5e70d9);})[_0xe7ba('0x16')](function(_0x213411){var _0x43322f={'statusCode':_0x213411[_0xe7ba('0x72')]||0x1f4,'statusMessage':_0x213411[_0xe7ba('0x73')]||_0xe7ba('0x74'),'headers':_0x213411[_0xe7ba('0x75')][_0xe7ba('0x6b')]||{},'body':_0x213411[_0xe7ba('0x75')][_0xe7ba('0x68')]||{}};_0x11ca03(null,_0x43322f);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x76')]=function(_0x3129e5,_0x27eb0e){scripts[_0xe7ba('0x76')](this[_0xe7ba('0x35')][_0xe7ba('0x33')],_0x3129e5[_0xe7ba('0x77')],_0x3129e5[_0xe7ba('0x59')],_0x3129e5[_0xe7ba('0x78')]||'en')[_0xe7ba('0x13')](function(_0x36cf6d){_0x27eb0e(null,_0x36cf6d);})[_0xe7ba('0x16')](function(_0x4ae77d){_0x27eb0e(_0x4ae77d);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0xaccf6e,_0x2ecfac){scripts['googleDialogflowV2'](this['channel'][_0xe7ba('0x33')],_0xaccf6e[_0xe7ba('0x79')],_0xaccf6e['client_email'],_0xaccf6e[_0xe7ba('0x7a')],_0xaccf6e['text'],_0xaccf6e['dialogflowV2_language']||'en')['then'](function(_0x2575be){_0x2ecfac(null,_0x2575be);})[_0xe7ba('0x16')](function(_0x51cd4f){_0x2ecfac(_0x51cd4f);});};AGIVertices[_0xe7ba('0x10')]['sestekNDA']=function(_0xbb6770,_0x44ad00){scripts['sestekNDA'](this['channel'],_0xbb6770)[_0xe7ba('0x13')](function(_0x5d5722){_0x44ad00(null,_0x5d5722);})[_0xe7ba('0x16')](function(_0xb0b9d5){_0x44ad00(_0xb0b9d5);});};AGIVertices[_0xe7ba('0x10')]['ispeechTTS']=function(_0xcf7f12,_0x17391f){scripts[_0xe7ba('0x7b')](_0xcf7f12[_0xe7ba('0x77')],_0xcf7f12[_0xe7ba('0x59')],_0xcf7f12[_0xe7ba('0x7c')]||_0xe7ba('0x5a'),_0xcf7f12[_0xe7ba('0x7d')])[_0xe7ba('0x13')](function(_0x223a22){_0x17391f(null,_0x223a22);})[_0xe7ba('0x16')](function(_0x2237d6){_0x17391f(_0x2237d6);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x7e')]=function(_0x3f763c,_0x16b3df,_0x109f40){scripts[_0xe7ba('0x7e')](_0x16b3df,_0x3f763c[_0xe7ba('0x77')],_0x3f763c[_0xe7ba('0x7f')]||_0xe7ba('0x5a'),this['isConfigured'](_0x3f763c['model'])?_0x3f763c['model']:undefined)[_0xe7ba('0x13')](function(_0x28d616){_0x109f40(null,_0x28d616);})[_0xe7ba('0x16')](function(_0x88deaf){_0x109f40(_0x88deaf);});};AGIVertices[_0xe7ba('0x10')]['awsPolly']=function(_0x5514ba,_0x2c86d2){scripts['awsPolly'](_0x5514ba[_0xe7ba('0x80')],_0x5514ba[_0xe7ba('0x81')],_0x5514ba[_0xe7ba('0x82')],_0x5514ba[_0xe7ba('0x83')]||_0xe7ba('0x84'),_0x5514ba[_0xe7ba('0x59')],_0x5514ba[_0xe7ba('0x85')]||_0xe7ba('0x59'))['then'](function(_0x1c5aaa){_0x2c86d2(null,_0x1c5aaa);})[_0xe7ba('0x16')](function(_0x31c04c){_0x2c86d2(_0x31c04c);});};AGIVertices['prototype']['awsLex']=function(_0x361ccb,_0x2ff70a){scripts[_0xe7ba('0x86')](this[_0xe7ba('0x35')]['uniqueid'],_0x361ccb[_0xe7ba('0x80')],_0x361ccb[_0xe7ba('0x81')],_0x361ccb[_0xe7ba('0x87')],_0x361ccb[_0xe7ba('0x59')],_0x361ccb[_0xe7ba('0x88')])[_0xe7ba('0x13')](function(_0x342149){_0x2ff70a(null,_0x342149);})[_0xe7ba('0x16')](function(_0xf9a0af){_0x2ff70a(_0xf9a0af);});};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x89')]=function(_0x195342,_0x159951,_0x3a89fd){scripts[_0xe7ba('0x89')](_0x159951,_0x195342[_0xe7ba('0x77')],_0x195342['google_asr_language']||'en-US')['then'](function(_0x13384f){_0x3a89fd(null,_0x13384f);})[_0xe7ba('0x16')](function(_0x3a9ba3){_0x3a89fd(_0x3a9ba3);});};AGIVertices['prototype']['tildeASR']=function(_0x403e50,_0x3174b5,_0x4c754){scripts[_0xe7ba('0x8a')](_0x3174b5,_0x403e50[_0xe7ba('0x8b')],_0x403e50[_0xe7ba('0x8c')],_0x403e50[_0xe7ba('0x6e')])['then'](function(_0xd51fdc){_0x4c754(null,_0xd51fdc);})[_0xe7ba('0x16')](function(_0x2cdc45){_0x4c754(_0x2cdc45);});};AGIVertices[_0xe7ba('0x10')]['clear']=function(_0x406298){var _0x4ddfea=_[_0xe7ba('0x64')](verticesWithRetry,_0x406298[_0xe7ba('0x34')])?_0x406298:_[_0xe7ba('0x8d')](_0x406298);for(var _0x26759b in _0x4ddfea){if(_0x4ddfea[_0xe7ba('0x8e')](_0x26759b)){if(_0x4ddfea[_0x26759b]&&_[_0xe7ba('0x8f')](_0x4ddfea[_0x26759b])){if(_[_0xe7ba('0x64')](recursiveMapAttributes,_0x26759b)){_0x4ddfea[_0x26759b]=this[_0xe7ba('0x90')](_0x4ddfea[_0x26759b]);}else{_0x4ddfea[_0x26759b]=this[_0xe7ba('0x91')](_0x4ddfea[_0x26759b]);}}}}return _0x4ddfea;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x92')]=function(_0x1144df){for(var _0x371fa0 in _0x1144df){if(_0x1144df['hasOwnProperty'](_0x371fa0)){if(_[_0xe7ba('0x93')](_0x1144df[_0x371fa0])){this[_0xe7ba('0x92')](_0x1144df[_0x371fa0]);}else if(_[_0xe7ba('0x94')](_0x1144df[_0x371fa0])){for(var _0x13dbb6=0x0;_0x13dbb6<_0x1144df[_0x371fa0]['length'];_0x13dbb6++){this[_0xe7ba('0x92')](_0x1144df[_0x371fa0][_0x13dbb6]);}}else if(_['isString'](_0x1144df[_0x371fa0])){_0x1144df[_0x371fa0]=this['replaceAllVariables'](_0x1144df[_0x371fa0]);}}}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x95')]=function(_0x1297f1,_0x163eed){for(var _0x18a506 in _0x1297f1){if(_0x1297f1[_0xe7ba('0x8e')](_0x18a506)){if(_[_0xe7ba('0x93')](_0x1297f1[_0x18a506])){if(!_[_0xe7ba('0x40')](_0x1297f1[_0x18a506])){this['saveRestApiResult'](_0x1297f1[_0x18a506],util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x163eed,_0x18a506));}}else if(_['isArray'](_0x1297f1[_0x18a506])){for(var _0x3b8e10=0x0;_0x3b8e10<_0x1297f1[_0x18a506][_0xe7ba('0x97')];_0x3b8e10++){this[_0xe7ba('0x95')](_0x1297f1[_0x18a506][_0x3b8e10],util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x163eed,_0x18a506+'['+_0x3b8e10+']'));}}else{if(!_[_0xe7ba('0x41')](_0x1297f1[_0x18a506])){this[_0xe7ba('0x35')][_0xe7ba('0x98')](util['format'](_0xe7ba('0x96'),_0x163eed,_0x18a506),_0x1297f1[_0x18a506]);}}}}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x90')]=function(_0x26102c){try{var _0x5441c7=JSON[_0xe7ba('0x69')](_0x26102c);this[_0xe7ba('0x92')](_0x5441c7);return JSON[_0xe7ba('0x70')](_0x5441c7);}catch(_0x4576fd){return this[_0xe7ba('0x91')](_0x26102c);}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x91')]=function(_0x1dd328){var _0x2502e1=_0x1dd328[_0xe7ba('0x99')]('{');for(var _0x10e8ef=0x1;_0x10e8ef<_0x2502e1[_0xe7ba('0x97')];_0x10e8ef+=0x1){var _0x219538=_0x2502e1[_0x10e8ef][_0xe7ba('0x99')]('}');if(_0x219538['length']>0x1){_0x1dd328=_0x1dd328['replaceAll']('{'+_0x219538[0x0]+'}',this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0x219538[0x0])[_0xe7ba('0x9a')]||_0x219538[0x0]);}}if(_0x2502e1[_0xe7ba('0x97')]===0x1){return _0x1dd328[_0xe7ba('0x48')]();}return this[_0xe7ba('0x91')](_0x1dd328);};AGIVertices['prototype'][_0xe7ba('0x9b')]=function(_0x154e8c,_0x5d3d31){var _0x4c2936=this['channel'][_0xe7ba('0x11')](_0x154e8c);if(_0x4c2936[_0xe7ba('0x9c')]===-0x1){return _0x4c2936;}logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x9d'),_0x5d3d31,_0x4c2936[_0xe7ba('0x9a')]));return this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x5d3d31,_0x4c2936['extra']);};AGIVertices['prototype']['isConfigured']=function(_0x4a7071){return _0x4a7071&&_0x4a7071!=='0'&&_0x4a7071!=='-1'&&_0x4a7071!=='';};AGIVertices['prototype'][_0xe7ba('0x9e')]=function(_0x2d4926){this[_0xe7ba('0x32')]['sync'](this,_0x2d4926,'-');_0x2d4926['retry']=_0x2d4926['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x9f')]=function(_0x515f1f){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xa0'),_0x515f1f[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x515f1f[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}var _0x51030f='\x22'+_0x515f1f[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x515f1f['options'])){_0x51030f+=','+_0x515f1f[_0xe7ba('0x75')];}var _0x3336a6=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x51030f);if(_0x3336a6['result']===-0x1){return _0x3336a6;}return this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xa7'),_0x51030f));};AGIVertices['prototype'][_0xe7ba('0xa8')]=function(_0x24ce3b){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xa9'),_0x24ce3b[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x24ce3b[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20grammar\x20configured');}var _0x61c814=_0x24ce3b['grammar'];if(this[_0xe7ba('0xa2')](_0x24ce3b[_0xe7ba('0x75')])){_0x61c814+=','+_0x24ce3b[_0xe7ba('0x75')];}var _0x2b26c5=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('MRCPRecog',_0x61c814);if(_0x2b26c5[_0xe7ba('0x9c')]===-0x1){return _0x2b26c5;}var _0x31826f=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xac'));if(_0x31826f['result']===-0x1){return _0x31826f;}var _0x3c18d4=this[_0xe7ba('0x9b')](_0xe7ba('0xad'),_0xe7ba('0xae'));if(_0x3c18d4[_0xe7ba('0x9c')]===-0x1){return _0x3c18d4;}var _0x728099=this[_0xe7ba('0x9b')]('RECOG_INSTANCE()',_0xe7ba('0xaf'));if(_0x728099[_0xe7ba('0x9c')]===-0x1){return _0x728099;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x61c814));};AGIVertices['prototype'][_0xe7ba('0x5')]=function(_0x2bc0ac){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xb0'),_0x2bc0ac[_0xe7ba('0xa1')]));return this['channel']['agi']([_0x2bc0ac[_0xe7ba('0xb1')],_0x2bc0ac[_0xe7ba('0xb2')]]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xb3')]=function(_0x12932a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xb4'),_0x12932a[_0xe7ba('0xa1')]));if(this[_0xe7ba('0xa2')](_0x12932a[_0xe7ba('0x63')])){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x12932a[_0xe7ba('0x63')]));var _0x12de23=this[_0xe7ba('0x35')]['wait'](_0x12932a['timeout']);if(_0x12de23[_0xe7ba('0x9c')]===-0x1){return _0x12de23;}}return this[_0xe7ba('0x35')][_0xe7ba('0xb3')]();};AGIVertices['prototype'][_0xe7ba('0xb5')]=function(_0x2086b9){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xb6'),_0x2086b9[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x2086b9[_0xe7ba('0x46')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x2086b9,_0xe7ba('0xb7'));}_0x2086b9[_0xe7ba('0xb8')]=moment();if(this[_0xe7ba('0xa2')](_0x2086b9[_0xe7ba('0xb9')])){_0x2086b9[_0xe7ba('0xb8')]=moment()['add'](_0x2086b9['delay'],_0xe7ba('0xba'));}if(!this['isConfigured'](_0x2086b9['callback_priority'])){_0x2086b9[_0xe7ba('0x49')]=0x2;}this[_0xe7ba('0xbb')][_0xe7ba('0x6d')](this,_0x2086b9);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xbc'),_0x2086b9[_0xe7ba('0x45')],_0x2086b9[_0xe7ba('0x46')],_0x2086b9[_0xe7ba('0xb8')]));};AGIVertices['prototype'][_0xe7ba('0xbd')]=function(_0x382cd6){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xbe'),_0x382cd6[_0xe7ba('0xa1')]));var _0x3c5bbd=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0x382cd6[_0xe7ba('0xbf')],_0x382cd6[_0xe7ba('0x75')]);if(_0x3c5bbd[_0xe7ba('0x9c')]===-0x1){return _0x3c5bbd;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xc0'),_0x382cd6[_0xe7ba('0xbf')],_0x382cd6[_0xe7ba('0x75')]));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc1')]=function(_0x5e111a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xc2'),_0x5e111a[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5e111a[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xa4'));}var _0x4e1c56='\x22'+_0x5e111a[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x5e111a[_0xe7ba('0x75')])){_0x4e1c56+=','+_0x5e111a['options'];}var _0x34a44c=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x4e1c56);if(_0x34a44c[_0xe7ba('0x9c')]===-0x1){return _0x34a44c;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4e1c56));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc3')]=function(_0x2d6d14){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xc4'),_0x2d6d14['label']));if(!this[_0xe7ba('0xa2')](_0x2d6d14[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xa4'));}var _0x1ccb79='\x22'+_0x2d6d14[_0xe7ba('0x59')]+'\x22';if(this[_0xe7ba('0xa2')](_0x2d6d14[_0xe7ba('0x75')])){_0x1ccb79+=','+_0x2d6d14[_0xe7ba('0x75')];}var _0x397b66=this['channel'][_0xe7ba('0xa5')](_0xe7ba('0xa6'),_0x1ccb79);if(_0x397b66[_0xe7ba('0x9c')]===-0x1){return _0x397b66;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xa7'),_0x1ccb79));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xc5')]=function(_0x5b2f88){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5b2f88['label']));if(!this[_0xe7ba('0xa2')](_0x5b2f88[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xc6'));}var _0x253a16=_0x5b2f88[_0xe7ba('0xaa')];if(this[_0xe7ba('0xa2')](_0x5b2f88[_0xe7ba('0x75')])){_0x253a16+=','+_0x5b2f88[_0xe7ba('0x75')];}var _0x3f7332=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0xc7'),_0x253a16);if(_0x3f7332[_0xe7ba('0x9c')]===-0x1){return _0x3f7332;}var _0x32f5ba=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xc8'));if(_0x32f5ba[_0xe7ba('0x9c')]===-0x1){return _0x32f5ba;}var _0x4cae50=this[_0xe7ba('0x9b')](_0xe7ba('0xad'),_0xe7ba('0xc9'));if(_0x4cae50[_0xe7ba('0x9c')]===-0x1){return _0x4cae50;}var _0xf2f6df=this[_0xe7ba('0x9b')](_0xe7ba('0xca'),'LUMENVOX_ASR_INSTANCE');if(_0xf2f6df[_0xe7ba('0x9c')]===-0x1){return _0xf2f6df;}return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0xcb'),_0x253a16));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xcc')]=function(_0x47f647){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0xcd'),_0x47f647[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x47f647[_0xe7ba('0xaa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20grammar\x20configured');}var _0x3a6222=_0x47f647[_0xe7ba('0xaa')];if(this[_0xe7ba('0xa2')](_0x47f647[_0xe7ba('0x75')])){_0x3a6222+=','+_0x47f647[_0xe7ba('0x75')];}var _0x8e1f7=this['channel'][_0xe7ba('0xa5')]('MRCPRecog',_0x3a6222);if(_0x8e1f7[_0xe7ba('0x9c')]===-0x1){return _0x8e1f7;}var _0x4fa53f=this['getAndSetVariable'](_0xe7ba('0xab'),_0xe7ba('0xce'));if(_0x4fa53f[_0xe7ba('0x9c')]===-0x1){return _0x4fa53f;}var _0x571c7e=this['getAndSetVariable'](_0xe7ba('0xad'),_0xe7ba('0xcf'));if(_0x571c7e[_0xe7ba('0x9c')]===-0x1){return _0x571c7e;}var _0x4326e7=this[_0xe7ba('0x9b')]('RECOG_INSTANCE()',_0xe7ba('0xd0'));if(_0x4326e7['result']===-0x1){return _0x4326e7;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xcb'),_0x3a6222));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xd1')]=function(_0x3cbfb1){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0xd2'),_0x3cbfb1['label']));if(!this[_0xe7ba('0xa2')](_0x3cbfb1['odbc_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,_0xe7ba('0xd3'));}var _0x3e0c94=this['getSquareOdbc'][_0xe7ba('0x6d')](this,_0x3cbfb1['odbc_id']);if(!_0x3e0c94){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,'no\x20odbc\x20database\x20found');}if(!this[_0xe7ba('0xa2')](_0x3cbfb1[_0xe7ba('0x2b')])){return this['channel'][_0xe7ba('0x27')](_0x3cbfb1,_0xe7ba('0xd4'));}var _0x220f53=_0x3cbfb1[_0xe7ba('0x2b')][_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xd5'),_0x220f53));var _0x28877c=this[_0xe7ba('0xd6')][_0xe7ba('0x6d')](this,_0x3e0c94,_0x220f53);this[_0xe7ba('0x32')]['sync'](this,_0x3cbfb1,_0x220f53);if(!this['isConfigured'](_0x3cbfb1['variable_id'])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}var _0x1f6aa1=this[_0xe7ba('0x11')]['sync'](this,_0x3cbfb1[_0xe7ba('0xd8')]);if(!_0x1f6aa1){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3cbfb1,'no\x20variable\x20found');}var _0x334adc=this;_0x28877c['forEach'](function(_0x5ce535,_0x10d41b){Object[_0xe7ba('0xd9')](_0x5ce535)[_0xe7ba('0xda')](function(_0x418432){_0x334adc[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0xdb'),_0x1f6aa1,_0x10d41b,_0x418432),_0x5ce535[_0x418432]);});});this['channel']['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0xdc'),_0x1f6aa1),_0x28877c[_0xe7ba('0x97')]);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('variable\x20%s\x20set',_0x1f6aa1));};AGIVertices[_0xe7ba('0x10')]['dial']=function(_0x43d14d){logger[_0xe7ba('0xdd')](util[_0xe7ba('0x51')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x43d14d[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x43d14d[_0xe7ba('0xde')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x43d14d,_0xe7ba('0xdf'));}var _0x12b99c=this[_0xe7ba('0xe0')][_0xe7ba('0x6d')](this,_0x43d14d['sip_id']);if(!_0x12b99c){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x43d14d,_0xe7ba('0xe1'));}var _0x36cc2b=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('DIAL',[util[_0xe7ba('0x51')]('SIP/%s',_0x12b99c),_0x43d14d[_0xe7ba('0x63')],_0x43d14d[_0xe7ba('0xe2')],_0x43d14d[_0xe7ba('0x61')]]);if(_0x36cc2b[_0xe7ba('0x9c')]===-0x1){return _0x36cc2b;}return this['channel'][_0xe7ba('0xa3')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xe7ba('0xe3')]=function(_0x5dd240){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0xe4'),_0x5dd240[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5dd240[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x5dd240[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x5dd240);this[_0xe7ba('0x3f')](_0x5dd240[_0xe7ba('0x59')],'in','','');this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xe6'),_0x5dd240[_0xe7ba('0x59')]));var _0x5e82a5=this[_0xe7ba('0x76')][_0xe7ba('0x6d')](this,_0x5dd240);if(_0x5e82a5){for(var _0x9f917c in _0x5e82a5){if(_0x5e82a5[_0xe7ba('0x8e')](_0x9f917c)){this[_0xe7ba('0x35')]['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0xe7'),_0x9f917c[_0xe7ba('0x67')]()),_0x5e82a5[_0x9f917c]);}}this[_0xe7ba('0x3f')](_0x5e82a5[_0xe7ba('0xe8')],_0xe7ba('0xe9'),_0xe7ba('0xe3'),'');return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Dialogflow\x20Result\x20%s',_0x5e82a5['speech']));}return this['channel']['error'](_0x5dd240,_0xe7ba('0xea'));};AGIVertices['prototype']['dialogflowV2']=function(_0x313cf2){logger['info'](util['format'](_0xe7ba('0xeb'),_0x313cf2['label']));if(!this[_0xe7ba('0xa2')](_0x313cf2['dialogflowV2_project_id'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0xec'));}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0xed')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xee'));}if(!this[_0xe7ba('0xa2')](_0x313cf2['private_key'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20private_key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0xef')])){return this[_0xe7ba('0x35')]['noop']('no\x20anguage\x20configured');}if(!this[_0xe7ba('0xa2')](_0x313cf2[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x313cf2);this[_0xe7ba('0x3f')](_0x313cf2[_0xe7ba('0x59')],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0xf0'),_0x313cf2[_0xe7ba('0x59')]));var _0x433b41=this[_0xe7ba('0xf1')][_0xe7ba('0x6d')](this,_0x313cf2);if(_0x433b41){for(var _0x391abe in _0x433b41){if(_0x433b41[_0xe7ba('0x8e')](_0x391abe)){if(_0x391abe!==_0xe7ba('0xf2')){this['channel'][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0xe7'),_0x391abe[_0xe7ba('0x67')]()),_0x433b41[_0x391abe]);}}}this[_0xe7ba('0x3f')](_0x433b41[_0xe7ba('0xe8')],_0xe7ba('0xe9'),_0xe7ba('0xf3'),_0x433b41['providerResponse']);return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xf4'),_0x433b41['speech']));}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x313cf2,_0xe7ba('0xf5'));};AGIVertices[_0xe7ba('0x10')]['sesteknda']=function(_0x4bf371){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4bf371[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x4bf371[_0xe7ba('0xf6')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xf7'));}if(!this['isConfigured'](_0x4bf371[_0xe7ba('0xf8')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20username\x20configured');}if(!this[_0xe7ba('0xa2')](_0x4bf371['password'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xf9'));}if(!this[_0xe7ba('0xa2')](_0x4bf371[_0xe7ba('0xfa')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this['channel'][_0xe7ba('0xe5')]=!![];this[_0xe7ba('0x32')](_0x4bf371);this[_0xe7ba('0x3f')](_0x4bf371['text'],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xfb'),_0x4bf371['text']));var _0x519e2d=this[_0xe7ba('0xfc')]['sync'](this,_0x4bf371);if(_0x519e2d){for(var _0x557421 in _0x519e2d){if(_0x519e2d[_0xe7ba('0x8e')](_0x557421)){this['channel'][_0xe7ba('0x98')](util['format'](_0xe7ba('0xfd'),_0x557421['toUpperCase']()),_0x519e2d[_0x557421]);}}this[_0xe7ba('0x3f')](_0x519e2d[_0xe7ba('0xe8')],'out','sesteknda','');if(_0x519e2d[_0xe7ba('0xfe')]){this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x519e2d['audiofile']));var _0x5896c4=this['channel'][_0xe7ba('0xff')](_0x519e2d[_0xe7ba('0xfe')]);try{fs[_0xe7ba('0x100')](_0x519e2d[_0xe7ba('0xfe')]+_0xe7ba('0x101'));}catch(_0x32d9ed){logger['error'](_0x32d9ed);}return _0x5896c4;}else{return this['channel']['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x102'),_0x519e2d['speech']));}}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4bf371,_0xe7ba('0x103'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x104')]=function(_0x348fc2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x105'),_0x348fc2[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x104'));};AGIVertices['prototype'][_0xe7ba('0x106')]=function(_0x5b1cb3){logger['info'](util['format'](_0xe7ba('0x107'),_0x5b1cb3['label']));var _0x12321b='';if(_0x5b1cb3[_0xe7ba('0x108')]){if(!this[_0xe7ba('0xa2')](_0x5b1cb3['trunk_id'])){return this[_0xe7ba('0x35')]['error'](_0x5b1cb3,_0xe7ba('0x109'));}else{var _0x46af6f=parseInt(_0x5b1cb3[_0xe7ba('0x108')],0xa);if(isNaN(_0x46af6f)){_0x12321b=_0x5b1cb3[_0xe7ba('0x108')];}else{_0x12321b=this['getTrunk'][_0xe7ba('0x6d')](this,_0x5b1cb3[_0xe7ba('0x108')]);if(!_0x12321b){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5b1cb3,'no\x20trunk\x20found');}}}}else if(_0x5b1cb3[_0xe7ba('0x10a')]){_0x12321b=_0x5b1cb3[_0xe7ba('0x10a')];}else{return this['channel'][_0xe7ba('0x27')](_0x5b1cb3,_0xe7ba('0x109'));}var _0x16a1c4=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0x10b'),[util[_0xe7ba('0x51')](_0xe7ba('0x10c'),_0x12321b,_0x5b1cb3['phone']),_0x5b1cb3[_0xe7ba('0x63')],_0x5b1cb3['opts'],_0x5b1cb3[_0xe7ba('0x61')]]);if(_0x16a1c4['result']===-0x1){return _0x16a1c4;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x10d'),_0xe7ba('0x10b')));};AGIVertices['prototype'][_0xe7ba('0x10e')]=function(_0x580e58){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x10f'),_0x580e58['label']));return this['channel']['noop']('finally');};AGIVertices[_0xe7ba('0x10')]['getdigits']=function(_0x3d32a7){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x110'),_0x3d32a7[_0xe7ba('0xa1')]));if(_0x3d32a7[_0xe7ba('0x111')]===0x0){return this['maxRetry'](_0x3d32a7);}_0x3d32a7[_0xe7ba('0x111')]-=0x1;if(!this[_0xe7ba('0xa2')](_0x3d32a7[_0xe7ba('0x112')])){return this['channel']['error'](_0x3d32a7,_0xe7ba('0x113'));}var _0x102b60=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x3d32a7['file_id']);if(!_0x102b60){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x3d32a7,'no\x20file\x20audio\x20found');}if(!this[_0xe7ba('0xa2')](_0x3d32a7[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x49bda0=this['channel'][_0xe7ba('0x114')](_0x102b60,_0x3d32a7['response'],_0x3d32a7['maxdigit']);var _0x4a038e=_0x49bda0[_0xe7ba('0x9c')]?_0x49bda0[_0xe7ba('0x9c')]['toString']():'';logger[_0xe7ba('0x29')](_0xe7ba('0x115'),JSON[_0xe7ba('0x70')](_0x49bda0));if(_0x49bda0[_0xe7ba('0x9c')]===-0x1){this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x3d32a7,_0x4a038e);return _0x49bda0;}else if(_0x49bda0[_0xe7ba('0x9a')]==='timeout'){_0x49bda0[_0xe7ba('0x9c')]=_0x4a038e['length']>=parseInt(_0x3d32a7[_0xe7ba('0x116')])?'x':'i';}else{_0x49bda0[_0xe7ba('0x9c')]=_0x4a038e[_0xe7ba('0x97')]>=parseInt(_0x3d32a7[_0xe7ba('0x116')])&&_0x4a038e[_0xe7ba('0x97')]<=parseInt(_0x3d32a7['maxdigit'])?'x':'i';}var _0x3fbe87=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x3d32a7[_0xe7ba('0xd8')]);if(!_0x3fbe87){return this['channel'][_0xe7ba('0x27')](_0x3d32a7,_0xe7ba('0x117'));}this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x3fbe87,_0x4a038e);if(this['isConfigured'](_0x3d32a7[_0xe7ba('0x118')])){var _0xa06b36=parseInt(_0x3d32a7[_0xe7ba('0x118')],0xa);var _0x430369=rs[_0xe7ba('0x119')]({'charset':'*','length':_0xa06b36});var _0x57fa06=_0x4a038e[_0xe7ba('0x97')];if(_0x57fa06>0x0){if(_0x57fa06>_0xa06b36){this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x3d32a7,_0x3d32a7[_0xe7ba('0x11a')]===_0xe7ba('0x11b')?_0x430369+_0x4a038e[_0xe7ba('0x11c')](_0xa06b36):_0x4a038e[_0xe7ba('0x11c')](0x0,_0x57fa06-_0xa06b36)+_0x430369);}else{this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x3d32a7,rs['generate']({'charset':'*','length':_0x57fa06}));}}else{this[_0xe7ba('0x32')]['sync'](this,_0x3d32a7,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x3d32a7,_0x4a038e);}return _0x49bda0;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xd')]=function(_0x43bb5a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x43bb5a[_0xe7ba('0xa1')]));return this[_0xe7ba('0xc')](_0x43bb5a);};AGIVertices['prototype'][_0xe7ba('0x11d')]=function(_0xaf2ae9){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xaf2ae9['label']));this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0xaf2ae9,_0xaf2ae9[_0xe7ba('0x11e')]);return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('GOAL\x20%s',_0xaf2ae9[_0xe7ba('0x11e')]));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x11f')]=function(_0x371ed0){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x120'),_0x371ed0[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x371ed0['aws_access_key_id'])||!this['isConfigured'](_0x371ed0['aws_secret_access_key'])){return this['channel'][_0xe7ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x371ed0[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20text\x20configured');}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x121'),_0x371ed0['text']));var _0x5f2a2a=this[_0xe7ba('0x122')][_0xe7ba('0x6d')](this,_0x371ed0);if(_0x5f2a2a){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x123'),_0x5f2a2a));var _0x2d0848=this[_0xe7ba('0x35')][_0xe7ba('0xff')](_0x5f2a2a);try{fs[_0xe7ba('0x100')](_0x5f2a2a+_0xe7ba('0x101'));}catch(_0x2e3989){logger[_0xe7ba('0x27')](_0x2e3989);}return _0x2d0848;}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x371ed0,_0xe7ba('0x124'));};AGIVertices[_0xe7ba('0x10')]['awslex']=function(_0x4eafed){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4eafed['label']));if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x80')])||!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x81')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x88')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x125'));}if(!this[_0xe7ba('0xa2')](_0x4eafed[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')]['bot']=!![];this['createSquareDetailsReport'](_0x4eafed);this[_0xe7ba('0x3f')](_0x4eafed[_0xe7ba('0x59')],'in','','');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x126'),_0x4eafed[_0xe7ba('0x59')]));var _0x31e0c7=this[_0xe7ba('0x86')][_0xe7ba('0x6d')](this,_0x4eafed);if(_0x31e0c7){for(var _0x3ea4ee in _0x31e0c7){if(_0x31e0c7[_0xe7ba('0x8e')](_0x3ea4ee)&&_[_0xe7ba('0x8f')](_0x31e0c7[_0x3ea4ee])){this[_0xe7ba('0x35')]['setVariable'](util['format']('AWS_LEX_%s',_0x3ea4ee[_0xe7ba('0x67')]()),_0x31e0c7[_0x3ea4ee]);}}if(_[_0xe7ba('0x41')](_0x31e0c7[_0xe7ba('0x73')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x127'));}else{this[_0xe7ba('0x3f')](_0x31e0c7[_0xe7ba('0x73')],_0xe7ba('0xe9'),_0xe7ba('0x128'),'');return this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x129'),_0x31e0c7[_0xe7ba('0x73')]));}}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4eafed,_0xe7ba('0x12a'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x12b')]=function(_0x3abd00){logger['info'](util['format'](_0xe7ba('0x12c'),_0x3abd00[_0xe7ba('0xa1')],_0x3abd00[_0xe7ba('0x63')]));if(!this[_0xe7ba('0xa2')](_0x3abd00[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x12d'));}var _0x2a11b2=_0xe7ba('0x12e');var _0x58a074=util['format'](_0xe7ba('0x12f'),FILES_PATH,rs[_0xe7ba('0x119')](0x4));var _0x23cf9c=util[_0xe7ba('0x51')]('%s.%s',_0x58a074,_0x2a11b2);var _0x2436c0=!![];if(_0x3abd00[_0xe7ba('0x130')]===_0xe7ba('0x131')){_0x2436c0=![];}var _0x181979=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0x58a074,_0x2a11b2,_0x3abd00[_0xe7ba('0x133')],_0x3abd00[_0xe7ba('0x63')],undefined,_0x2436c0);if(_0x181979['result']!==-0x1){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x134'),_0x23cf9c));var _0x3de2a2=this[_0xe7ba('0x89')]['sync'](this,_0x3abd00,_0x23cf9c);if(_0x3de2a2){for(var _0x25dfa3 in _0x3de2a2){if(_0x3de2a2['hasOwnProperty'](_0x25dfa3)){this['channel'][_0xe7ba('0x98')](util['format']('GOOGLE_ASR_%s',_0x25dfa3[_0xe7ba('0x67')]()),_0x3de2a2[_0x25dfa3]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x135'),JSON[_0xe7ba('0x70')](_0x3de2a2)));}}return _0x181979;};AGIVertices[_0xe7ba('0x10')]['tildeasr']=function(_0x1c0507){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x136'),_0x1c0507[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x1c0507['appid'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x137'));}if(!this['isConfigured'](_0x1c0507[_0xe7ba('0x8c')])){return this['channel']['noop']('no\x20appsecret\x20configured');}var _0x46497e=_0xe7ba('0x12e');var _0xd09aff=util[_0xe7ba('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x4f0247=util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0xd09aff,_0x46497e);var _0x5022f3=!![];if(_0x1c0507[_0xe7ba('0x130')]===_0xe7ba('0x131')){_0x5022f3=![];}var _0x32c816=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0xd09aff,_0x46497e,_0x1c0507[_0xe7ba('0x133')],_0x1c0507['timeout'],undefined,_0x5022f3);if(_0x32c816['result']!==-0x1){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x138'),_0x4f0247));var _0x4d2c86=this['tildeASR'][_0xe7ba('0x6d')](this,_0x1c0507,_0x4f0247);if(_0x4d2c86){for(var _0x227e88 in _0x4d2c86){if(_0x4d2c86[_0xe7ba('0x8e')](_0x227e88)){this[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x139'),_0x227e88[_0xe7ba('0x67')]()),_0x4d2c86[_0x227e88]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xe7ba('0x70')](_0x4d2c86)));}}return _0x32c816;};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x13a')]=function(_0x57f632){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x57f632['label']));return this[_0xe7ba('0x35')][_0xe7ba('0x13b')](_0x57f632['context'],_0x57f632[_0xe7ba('0x3b')],_0x57f632[_0xe7ba('0x13c')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x13d')]=function(_0x507d35){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x13e'),_0x507d35[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x507d35[_0xe7ba('0x13f')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x507d35,_0xe7ba('0x140'));}try{var _0x724037=eval(_0x507d35['condition'])?'true':_0xe7ba('0x141');this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x142'),_0x507d35[_0xe7ba('0x13f')],_0x724037));return{'code':0xc8,'result':_0x724037};}catch(_0x3a1e7c){return{'code':0xc8,'result':_0xe7ba('0x141')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x143')]=function(_0x22af70){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x144'),_0x22af70[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x22af70[_0xe7ba('0x145')])){return this['channel'][_0xe7ba('0x27')](_0x22af70,_0xe7ba('0x146'));}var _0x18182b=this[_0xe7ba('0x21')][_0xe7ba('0x6d')](this,_0x22af70[_0xe7ba('0x145')]);if(!_0x18182b){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x22af70,'no\x20intervals\x20found');}for(var _0x5b3ac2=0x0;_0x5b3ac2<_0x18182b['length'];_0x5b3ac2+=0x1){var _0xe6c7ff=this[_0xe7ba('0x35')][_0xe7ba('0x11')](util[_0xe7ba('0x51')](_0xe7ba('0x147'),_0x18182b[_0x5b3ac2]));if(_0xe6c7ff['result']===-0x1){return _0xe6c7ff;}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],_0xe6c7ff[_0xe7ba('0x9a')]));if(_0xe6c7ff[_0xe7ba('0x9a')]===_0xe7ba('0x149')){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('IFTIME\x20%s\x20%s',_0x18182b[_0x5b3ac2],_0xe7ba('0x149')));this['channel'][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],'true'));return{'code':0xc8,'result':_0xe7ba('0x149')};}else{logger[_0xe7ba('0x29')](util['format']('IFTIME\x20%s\x20%s',_0x18182b[_0x5b3ac2],_0xe7ba('0x141')));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x148'),_0x18182b[_0x5b3ac2],_0xe7ba('0x141')));}}return{'code':0xc8,'result':_0xe7ba('0x141')};};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x14a')]=function(_0x15482c){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x14b'),_0x15482c['label']));return this['channel'][_0xe7ba('0x14a')]();};AGIVertices['prototype']['ispeechasr']=function(_0xdb6da2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x14c'),_0xdb6da2[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0xdb6da2[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x12d'));}var _0x1dafc4=_0xe7ba('0x12e');var _0x237fe2=util[_0xe7ba('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xa6d413=util[_0xe7ba('0x51')](_0xe7ba('0x96'),_0x237fe2,_0x1dafc4);var _0x239db0=!![];if(_0xdb6da2['beep']===_0xe7ba('0x131')){_0x239db0=![];}var _0x1e4ccb=this[_0xe7ba('0x35')][_0xe7ba('0x132')](_0x237fe2,_0x1dafc4,_0xdb6da2[_0xe7ba('0x133')],_0xdb6da2[_0xe7ba('0x63')],undefined,_0x239db0);if(_0x1e4ccb[_0xe7ba('0x9c')]!==-0x1){this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x14d'),_0xa6d413));var _0x495834=this['ispeechASR'][_0xe7ba('0x6d')](this,_0xdb6da2,_0xa6d413);if(_0x495834){for(var _0x53d9a6 in _0x495834){if(_0x495834[_0xe7ba('0x8e')](_0x53d9a6)){this['channel'][_0xe7ba('0x98')](util[_0xe7ba('0x51')]('ISPEECH_ASR_%s',_0x53d9a6[_0xe7ba('0x67')]()),_0x495834[_0x53d9a6]);}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x495834)));}}return _0x1e4ccb;};AGIVertices['prototype'][_0xe7ba('0x14e')]=function(_0x1034d4){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x14f'),_0x1034d4['label']));if(!this['isConfigured'](_0x1034d4[_0xe7ba('0x77')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')]('no\x20key\x20configured');}if(!this[_0xe7ba('0xa2')](_0x1034d4[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x150'),_0x1034d4[_0xe7ba('0x59')]));var _0x3a7a58=this[_0xe7ba('0x7b')][_0xe7ba('0x6d')](this,_0x1034d4);if(_0x3a7a58){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x14d'),_0x3a7a58));var _0x503805=this[_0xe7ba('0x35')][_0xe7ba('0xff')](_0x3a7a58,_0x1034d4[_0xe7ba('0x133')]);try{fs['unlink'](_0x3a7a58+_0xe7ba('0x101'));}catch(_0x496493){logger[_0xe7ba('0x27')](_0x496493);}return _0x503805;}return this[_0xe7ba('0x35')]['error'](_0x1034d4,_0xe7ba('0x151'));};AGIVertices[_0xe7ba('0x10')]['login']=function(_0x4260db){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x152'),_0x4260db[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x4260db[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4260db,'no\x20find\x20by\x20configured');}logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x154'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));var _0x221e2f=this[_0xe7ba('0x53')][_0xe7ba('0x6d')](this,_0x4260db[_0xe7ba('0x153')]);if(_0x221e2f){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x4260db['findBy']));this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this['channel'][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x4260db['findBy']));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x4260db[_0xe7ba('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xe7ba('0x158')]=function(_0x47a405){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x47a405[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x47a405[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x47a405,_0xe7ba('0x159'));}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x154'),this[_0xe7ba('0x35')]['callerid'],_0x47a405[_0xe7ba('0x153')]));var _0x339d01=this[_0xe7ba('0x4f')][_0xe7ba('0x6d')](this,_0x47a405[_0xe7ba('0x153')]);if(_0x339d01){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this['channel'][_0xe7ba('0x37')],_0x47a405['findBy']));this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x47a405['findBy']));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')]['callerid'],_0x47a405[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x47a405['findBy']));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices['prototype'][_0xe7ba('0x15b')]=function(_0x59e4ac){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x15c'),_0x59e4ac['label']));if(!this[_0xe7ba('0xa2')](_0x59e4ac[_0xe7ba('0x15d')])){return this['channel'][_0xe7ba('0x27')](_0x59e4ac,'no\x20operation\x20configured');}this['channel']['noop'](util['format']('math\x20%s',_0x59e4ac[_0xe7ba('0x15d')]));var _0x2971a3=eval(_0x59e4ac[_0xe7ba('0x15d')]);if(!this[_0xe7ba('0xa2')](_0x59e4ac[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}var _0x226362=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x59e4ac[_0xe7ba('0xd8')]);if(!_0x226362){return this[_0xe7ba('0x35')]['error'](_0x59e4ac,'no\x20variable\x20found');}if(_[_0xe7ba('0x94')](_0x2971a3)){var _0x539c3b=this;_0x2971a3['forEach'](function(_0x4c09c5,_0x5128df){_0x539c3b[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x15e'),_0x226362,_0x5128df),_0x4c09c5);});return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x15f'),_0x226362));}else{return this['channel']['setVariable'](_0x226362,_0x2971a3);}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0xb')]=function(_0x345192){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x160'),_0x345192[_0xe7ba('0xa1')]));if(_0x345192['retry']===0x0){return this[_0xe7ba('0x9e')](_0x345192);}_0x345192['retry']-=0x1;if(!this['isConfigured'](_0x345192[_0xe7ba('0x112')])){return this['channel'][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x113'));}var _0x56dfe6=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x345192['file_id']);if(!_0x56dfe6){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x161'));}var _0x53cebb=this['channel'][_0xe7ba('0x114')](_0x56dfe6,_0x345192['response'],_0x345192[_0xe7ba('0x162')]);var _0x3885a4=_0x53cebb[_0xe7ba('0x9c')];if(_0x53cebb['result']===-0x1){this[_0xe7ba('0x32')]['sync'](this,_0x345192,'-1');return _0x53cebb;}else if(_0x53cebb[_0xe7ba('0x9a')]===_0xe7ba('0x63')){_0x53cebb['result']=_0x53cebb[_0xe7ba('0x9c')][_0xe7ba('0x97')]>0x0?_0x53cebb[_0xe7ba('0x9c')]:'t';}else if(_[_0xe7ba('0x40')](_0x53cebb[_0xe7ba('0x9c')])){_0x53cebb[_0xe7ba('0x9c')]='#';_0x3885a4='#';}if(!this['isConfigured'](_0x345192[_0xe7ba('0xd8')])){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xd7'));}else{var _0x16d028=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x345192[_0xe7ba('0xd8')]);if(!_0x16d028){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x345192,_0xe7ba('0x117'));}this[_0xe7ba('0x35')]['setVariable'](_0x16d028,_0x3885a4);}this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x345192,_0x3885a4);return _0x53cebb;};AGIVertices[_0xe7ba('0x10')]['noop']=function(_0x2ddff1){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x163'),_0x2ddff1[_0xe7ba('0xa1')]));return this['channel'][_0xe7ba('0xa3')](_0x2ddff1[_0xe7ba('0x164')]||_0x2ddff1[_0xe7ba('0xa1')]);};AGIVertices[_0xe7ba('0x10')]['pause']=function(_0x2ec68f){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x165'),_0x2ec68f[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x2ec68f[_0xe7ba('0x153')])){return this[_0xe7ba('0x35')]['error'](_0x2ec68f,_0xe7ba('0x159'));}logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x154'),this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));var _0x3086b9=this[_0xe7ba('0x4a')][_0xe7ba('0x6d')](this,_0x2ec68f[_0xe7ba('0x166')]);var _0x737a9c=this[_0xe7ba('0x4c')]['sync'](this,_0x2ec68f[_0xe7ba('0x153')],_0x3086b9);if(_0x737a9c){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x2ec68f[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x2ec68f[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')]['callerid'],_0x2ec68f[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x167')]=function(_0xcef966){logger[_0xe7ba('0x29')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0xcef966[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0xcef966['file_id'])){return this[_0xe7ba('0x35')]['error'](_0xcef966,_0xe7ba('0x113'));}var _0x57b949=this['getSound'][_0xe7ba('0x6d')](this,_0xcef966[_0xe7ba('0x112')]);if(!_0x57b949){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0xcef966,_0xe7ba('0x161'));}var _0x64851e=this[_0xe7ba('0x35')][_0xe7ba('0xa5')]('PLAYBACK',[_0x57b949,_0xcef966['opts']]);if(_0x64851e['result']===-0x1){return _0x64851e;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x168'),_0x57b949));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x169')]=function(_0x5d43c0){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x16a'),_0x5d43c0[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x5d43c0['queue_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5d43c0,'no\x20queue\x20selected');}var _0x388e27='';var _0x340305=parseInt(_0x5d43c0[_0xe7ba('0x16b')],0xa);if(isNaN(_0x340305)){_0x388e27=_0x5d43c0[_0xe7ba('0x16b')];}else{_0x388e27=this[_0xe7ba('0x15')]['sync'](this,_0x5d43c0[_0xe7ba('0x16b')]);if(!_0x388e27){return this['channel'][_0xe7ba('0x27')](_0x5d43c0,_0xe7ba('0x16c'));}}var _0x4bb8b9='';if(this['isConfigured'](_0x5d43c0['file_id'])){var _0x5e62ba=this[_0xe7ba('0x1c')][_0xe7ba('0x6d')](this,_0x5d43c0[_0xe7ba('0x112')]);if(_0x5e62ba){_0x4bb8b9=_0x5e62ba;}}this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x5d43c0,_0x388e27);if(_0x5d43c0[_0xe7ba('0xe2')][_0xe7ba('0x16d')]('x')<0x0){_0x5d43c0[_0xe7ba('0xe2')]+='x';}if(_0x5d43c0[_0xe7ba('0xe2')]['indexOf']('X')<0x0){_0x5d43c0['opts']+='X';}this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0xe7ba('0x16e'),_0x388e27?_0x388e27[_0xe7ba('0x16f')]():'');var _0x22d2fc=this[_0xe7ba('0x35')][_0xe7ba('0xa5')](_0xe7ba('0x170'),[_0x388e27,_0x5d43c0[_0xe7ba('0xe2')],_0x5d43c0[_0xe7ba('0x61')],_0x4bb8b9,_0x5d43c0[_0xe7ba('0x63')],_0x5d43c0['agi'],_0x5d43c0[_0xe7ba('0x171')],_0x5d43c0[_0xe7ba('0x172')],'',_0x5d43c0[_0xe7ba('0x173')]]);if(_0x22d2fc[_0xe7ba('0x9c')]===-0x1){return _0x22d2fc;}return this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x170'),_0x388e27));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x174')]=function(_0xf3cd96){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x175'),_0xf3cd96[_0xe7ba('0xa1')]));var _0x1d1b01=_0xf3cd96['recordingFormat']||_0xe7ba('0x12e');var _0x4e1989=util[_0xe7ba('0x51')](_0xe7ba('0x176'),this['channel'][_0xe7ba('0x33')],rs[_0xe7ba('0x119')](0x5));var _0x1ac67c=util[_0xe7ba('0x51')](_0xe7ba('0x177'),FILES_PATH,_0x4e1989,_0x1d1b01);var _0x428e6b=util[_0xe7ba('0x51')](_0xe7ba('0x12f'),FILES_PATH,_0x4e1989);this[_0xe7ba('0x38')][_0xe7ba('0x6d')](this,_0xf3cd96,_0x4e1989,_0x1ac67c);this['channel'][_0xe7ba('0x98')](_0xe7ba('0x178'),_0x4e1989);logger['info'](_0xe7ba('0x179'),_0x428e6b,_0x1d1b01,_0xf3cd96[_0xe7ba('0x17a')],_0xf3cd96[_0xe7ba('0x63')]);return this[_0xe7ba('0x35')]['recordFile'](_0x428e6b,_0x1d1b01,_0xf3cd96[_0xe7ba('0x17a')],_0xf3cd96[_0xe7ba('0x63')],undefined,!![]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x17b')]=function(_0x4d7725){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x17c'),_0x4d7725[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x4d7725[_0xe7ba('0x61')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x17d'));}var _0x5b6f36=this[_0xe7ba('0x60')][_0xe7ba('0x6d')](this,_0x4d7725);logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Response:',util[_0xe7ba('0x17e')](_0x5b6f36,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d7725['variable_id'])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x17f'));}var _0x2b962f=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x4d7725['variable_id']);if(!_0x2b962f){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4d7725,_0xe7ba('0x117'));}this[_0xe7ba('0x35')][_0xe7ba('0x98')](util[_0xe7ba('0x51')](_0xe7ba('0x180'),_0x2b962f),_0x5b6f36[_0xe7ba('0x72')]?_0x5b6f36['statusCode']:_0xe7ba('0x181'));this[_0xe7ba('0x35')]['setVariable'](util[_0xe7ba('0x51')](_0xe7ba('0x182'),_0x2b962f),_0x5b6f36[_0xe7ba('0x183')]?_0x5b6f36[_0xe7ba('0x183')]:'OK');if(_0x5b6f36[_0xe7ba('0x68')]){try{this[_0xe7ba('0x95')](_0x5b6f36['body'],_0x2b962f);}catch(_0x7874ee){logger[_0xe7ba('0x27')](util['format'](_0xe7ba('0x184'),_0x2b962f));}}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x185'),_0x2b962f));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x186')]=function(_0x2a1448){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2a1448[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')][_0xe7ba('0x187')](_0x2a1448[_0xe7ba('0x188')][_0xe7ba('0x55')](/\s+/g,''),_0x2a1448[_0xe7ba('0x17a')]);};AGIVertices['prototype'][_0xe7ba('0x189')]=function(_0x3e2b44){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x18a'),_0x3e2b44[_0xe7ba('0xa1')]));return this['channel']['sayNumber'](_0x3e2b44[_0xe7ba('0x18b')][_0xe7ba('0x55')](/\s+/g,''),_0x3e2b44[_0xe7ba('0x17a')]);};AGIVertices['prototype'][_0xe7ba('0x18c')]=function(_0x26e912){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x26e912[_0xe7ba('0xa1')]));return this[_0xe7ba('0x35')]['sayPhonetic'](_0x26e912[_0xe7ba('0x59')],_0x26e912[_0xe7ba('0x17a')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x18d')]=function(_0x50357a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x18e'),_0x50357a[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x50357a['account_id'])){return this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x18f'));}var _0x539f01=this[_0xe7ba('0x1f')][_0xe7ba('0x6d')](this,_0x50357a['account_id']);if(!_0x539f01||!_0x539f01[_0xe7ba('0x190')]){return this[_0xe7ba('0x35')]['error'](_0x50357a,'no\x20mail\x20account\x20found');}var _0x360c34={'from':util[_0xe7ba('0x51')](_0xe7ba('0x191'),_0x539f01[_0xe7ba('0x14')],_0x539f01['email']||_0x539f01['Smtp'][_0xe7ba('0x192')]),'to':_0x50357a['to']||'','cc':_0x50357a['cc']||'','bcc':_0x50357a[_0xe7ba('0x193')]||'','subject':_0x50357a[_0xe7ba('0x194')],'html':_0x50357a['text'],'text':_0x50357a[_0xe7ba('0x59')]};if(this[_0xe7ba('0xa2')](_0x50357a['template_id'])){}logger['debug'](_0xe7ba('0x195'),JSON[_0xe7ba('0x70')](_0x360c34));this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x50357a,_0x50357a[_0xe7ba('0x196')]);this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x539f01[_0xe7ba('0x14')]));this[_0xe7ba('0x197')]['sync'](this,_0x539f01[_0xe7ba('0x198')],_0x360c34);return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x199'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x19a')]=function(_0x2f823b){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x2f823b['label']));return this['channel']['noop'](_0xe7ba('0x19b'));};AGIVertices['prototype'][_0xe7ba('0x19c')]=function(_0x361fc2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x19d'),_0x361fc2[_0xe7ba('0xa1')]));if(!this['isConfigured'](_0x361fc2[_0xe7ba('0x19e')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x19f'));}var _0xe0d919=this[_0xe7ba('0x2f')][_0xe7ba('0x6d')](this,_0x361fc2[_0xe7ba('0x19e')]);if(!_0xe0d919){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x361fc2,_0xe7ba('0x1a0'));}var _0x59b774={'body':_0x361fc2[_0xe7ba('0x1a1')],'phone':_0x361fc2['to']||'','SmsAccountId':_0xe0d919['id']};logger[_0xe7ba('0xdd')]('sendSMS\x20message',JSON[_0xe7ba('0x70')](_0x59b774));this['createSquareDetailsReport'][_0xe7ba('0x6d')](this,_0x361fc2,_0x361fc2[_0xe7ba('0x19e')]);this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1a2'),_0xe0d919['name']));this[_0xe7ba('0x31')]['sync'](this,_0x59b774);return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x1a3'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1a4')]=function(_0x5239aa){logger[_0xe7ba('0x29')](util['format'](_0xe7ba('0x1a5'),_0x5239aa[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x5239aa[_0xe7ba('0xd8')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5239aa,_0xe7ba('0x1a6'));}var _0x444968=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x5239aa[_0xe7ba('0xd8')]);if(!_0x444968){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x5239aa,_0xe7ba('0x117'));}return this[_0xe7ba('0x35')]['setVariable'](_0x444968,_0x5239aa[_0xe7ba('0x1a7')]);};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1a8')]=function(_0x5b0fef){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1a9'),_0x5b0fef[_0xe7ba('0xa1')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0x1aa'));var _0x235b6e=this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0xe7ba('0x1ab'));if(!_[_0xe7ba('0x40')](_0x235b6e[_0xe7ba('0x9a')])){this[_0xe7ba('0x35')]['uniqueid']=_0x235b6e[_0xe7ba('0x9a')];}if(_0x5b0fef['answer']==='yes'){this[_0xe7ba('0x35')]['noop'](_0xe7ba('0x1ac'));return this[_0xe7ba('0x35')][_0xe7ba('0xb3')]();}return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x1ad'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1ae')]=function(_0x515dd4){logger['info'](util[_0xe7ba('0x51')](_0xe7ba('0x1af'),_0x515dd4[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x515dd4[_0xe7ba('0x1b0')])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x515dd4,'no\x20subproject\x20selected');}var _0x10cf4e=this[_0xe7ba('0x1b1')]['sync'](this,_0x515dd4[_0xe7ba('0x1b0')]);if(!this[_0xe7ba('0xa2')](_0x10cf4e)){return this['channel']['error'](_0x515dd4,util[_0xe7ba('0x51')](_0xe7ba('0x1b2'),_0x515dd4['project_id']));}if(_0x10cf4e===this[_0xe7ba('0x35')][_0xe7ba('0x36')]){return this['channel'][_0xe7ba('0x27')](_0x515dd4,_0xe7ba('0x1b3'));}this[_0xe7ba('0x32')][_0xe7ba('0x6d')](this,_0x515dd4,_0x10cf4e);var _0x251c51=this[_0xe7ba('0x35')]['exec']('AGI',util[_0xe7ba('0x51')](_0xe7ba('0x1b4'),config['agi'][_0xe7ba('0x1b5')]||_0xe7ba('0x1b6'),_0x10cf4e,this['channel'][_0xe7ba('0x36')]));if(_0x251c51[_0xe7ba('0x9c')]===-0x1){return _0x251c51;}return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x1b7'),_0x10cf4e));};AGIVertices['prototype']['system']=function(_0x4c55d7){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1b8'),_0x4c55d7[_0xe7ba('0xa1')]));var _0x9ccc83=this[_0xe7ba('0x1b9')][_0xe7ba('0x6d')](this,_0x4c55d7['command']);this[_0xe7ba('0x32')]['sync'](this,_0x4c55d7,_0x4c55d7['command']);if(this[_0xe7ba('0xa2')](_0x4c55d7[_0xe7ba('0xd8')])){var _0x5e071e=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x4c55d7[_0xe7ba('0xd8')]);if(_0x5e071e){this[_0xe7ba('0x35')][_0xe7ba('0x98')](_0x5e071e,_0x9ccc83);return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1ba'),_0x4c55d7[_0xe7ba('0xb1')],_0x5e071e));}}return this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')](_0xe7ba('0x1bb'),_0x4c55d7['command']));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1bc')]=function(_0x4e988c){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1bd'),_0x4e988c['label']));_0x4e988c[_0xe7ba('0x59')]=_0x4e988c[_0xe7ba('0x59')][_0xe7ba('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe7ba('0xa2')](_0x4e988c[_0xe7ba('0x57')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0x1be'));}if(!this[_0xe7ba('0xa2')](_0x4e988c[_0xe7ba('0x59')])){return this['channel'][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x1bf'),_0x4e988c[_0xe7ba('0x59')]));var _0x30598a=this[_0xe7ba('0x56')][_0xe7ba('0x6d')](this,_0x4e988c);if(_0x30598a){this['channel'][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x1c0'),_0x30598a));var _0x29551a=this['channel']['streamFile'](_0x30598a);try{fs[_0xe7ba('0x100')](_0x30598a+'.wav');}catch(_0x34f41d){logger[_0xe7ba('0x27')](_0x34f41d);}return _0x29551a;}return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x4e988c,_0xe7ba('0x1c1'));};AGIVertices[_0xe7ba('0x10')]['tts']=function(_0x2861d0){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2861d0[_0xe7ba('0xa1')]));_0x2861d0['text']=_0x2861d0[_0xe7ba('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe7ba('0xa2')](_0x2861d0[_0xe7ba('0x59')])){return this[_0xe7ba('0x35')][_0xe7ba('0xa3')](_0xe7ba('0xa4'));}this[_0xe7ba('0x35')]['noop'](util[_0xe7ba('0x51')]('Trying\x20Google\x20TTS\x20%s',_0x2861d0[_0xe7ba('0x59')]));var _0x24086d=this[_0xe7ba('0x5f')]['sync'](this,_0x2861d0);if(_0x24086d){this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util[_0xe7ba('0x51')](_0xe7ba('0x1c2'),_0x24086d));var _0x5b829f=this['channel'][_0xe7ba('0xff')](_0x24086d);try{fs['unlink'](_0x24086d+_0xe7ba('0x101'));}catch(_0x98726b){logger[_0xe7ba('0x27')](_0x98726b);}return _0x5b829f;}return this[_0xe7ba('0x35')]['error'](_0x2861d0,_0xe7ba('0x1c3'));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c4')]=function(_0x21cfa0){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x1c5'),_0x21cfa0[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x21cfa0['findBy'])){return this[_0xe7ba('0x35')][_0xe7ba('0x27')](_0x21cfa0,_0xe7ba('0x159'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));var _0x27fda2=this[_0xe7ba('0x4e')][_0xe7ba('0x6d')](this,_0x21cfa0[_0xe7ba('0x153')]);if(_0x27fda2){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')](_0xe7ba('0x155'),this[_0xe7ba('0x35')]['callerid'],_0x21cfa0[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x156')};}else{logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe7ba('0x35')][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));this[_0xe7ba('0x35')][_0xe7ba('0xa3')](util['format'](_0xe7ba('0x157'),this['channel'][_0xe7ba('0x37')],_0x21cfa0[_0xe7ba('0x153')]));return{'code':0xc8,'result':_0xe7ba('0x15a')};}};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c6')]=function(_0x389e7a){logger[_0xe7ba('0x29')](util[_0xe7ba('0x51')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x389e7a[_0xe7ba('0xa1')]));var _0x47a3b0=this[_0xe7ba('0x35')]['exec'](_0xe7ba('0x1c7'),[_0x389e7a['mailbox'],_0x389e7a[_0xe7ba('0x75')]]);if(_0x47a3b0[_0xe7ba('0x9c')]===-0x1){return _0x47a3b0;}return this['channel']['noop'](util[_0xe7ba('0x51')](_0xe7ba('0xc0'),_0xe7ba('0x1c7'),_0x389e7a['mailbox']));};AGIVertices[_0xe7ba('0x10')][_0xe7ba('0x1c8')]=function(_0x1b9d74){logger['info'](util[_0xe7ba('0x51')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1b9d74[_0xe7ba('0xa1')]));if(!this[_0xe7ba('0xa2')](_0x1b9d74[_0xe7ba('0xd8')])){return this['channel'][_0xe7ba('0x27')](_0x1b9d74,_0xe7ba('0x1a6'));}var _0x42e28d=this[_0xe7ba('0x11')][_0xe7ba('0x6d')](this,_0x1b9d74[_0xe7ba('0xd8')]);if(!_0x42e28d){return this['channel']['error'](_0x1b9d74,'no\x20variable\x20found');}var _0x95e3fb=this[_0xe7ba('0x35')][_0xe7ba('0x11')](_0x42e28d);return{'code':0xc8,'result':_0x95e3fb['extra']?_0x95e3fb[_0xe7ba('0x9a')]:'-'};};String[_0xe7ba('0x10')][_0xe7ba('0x1c9')]=function(_0xd8ee85,_0x4edbfc){return this[_0xe7ba('0x99')](_0xd8ee85)['join'](_0x4edbfc);};module[_0xe7ba('0x1ca')]=AGIVertices; \ No newline at end of file +var _0x5fd1=['client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','agentLogout','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','shelljs','odbc','randomstring','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','error','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','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','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id'];(function(_0x505942,_0x47b4fc){var _0x30b622=function(_0x3afb8c){while(--_0x3afb8c){_0x505942['push'](_0x505942['shift']());}};_0x30b622(++_0x47b4fc);}(_0x5fd1,0x155));var _0x15fd=function(_0xb244fa,_0x25e200){_0xb244fa=_0xb244fa-0x0;var _0x229358=_0x5fd1[_0xb244fa];return _0x229358;};'use strict';var fs=require('fs');var util=require(_0x15fd('0x0'));var _=require('lodash');var sh=require(_0x15fd('0x1'));var odbc=require(_0x15fd('0x2'))();var rs=require(_0x15fd('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var scripts=require(_0x15fd('0x7'));var FILES_PATH=_0x15fd('0x8');var recursiveMapAttributes=[_0x15fd('0x9'),_0x15fd('0xa')];var verticesWithRetry=[_0x15fd('0xb'),'getdigits',_0x15fd('0xc')];var AGIVertices=function(_0x1ee117,_0x19806f,_0x4c861f){this[_0x15fd('0xd')]=_0x1ee117;this['rpc']=_0x19806f;this[_0x15fd('0xe')]=_0x4c861f;};AGIVertices[_0x15fd('0xf')]['getVariable']=function(_0x4883fd,_0x4ebde5){this[_0x15fd('0x10')][_0x15fd('0x11')](_0x4883fd)[_0x15fd('0x12')](function(_0x188905){_0x4ebde5(null,_0x188905?_0x188905[_0x15fd('0x13')]:![]);})[_0x15fd('0x14')](function(_0x346ab1){_0x4ebde5(_0x346ab1);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x15')]=function(_0x4cb391,_0x5b7af0){this['rpc'][_0x15fd('0x16')](_0x4cb391)[_0x15fd('0x12')](function(_0x624e9b){_0x5b7af0(null,_0x624e9b?_0x624e9b[_0x15fd('0x13')]:![]);})[_0x15fd('0x14')](function(_0x2ffa03){_0x5b7af0(_0x2ffa03);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x17')]=function(_0x5aae13,_0x4c7080){this[_0x15fd('0x10')]['getSquareProjectById'](_0x5aae13)[_0x15fd('0x12')](function(_0x579ee2){_0x4c7080(null,_0x579ee2?_0x579ee2[_0x15fd('0x13')]:![]);})[_0x15fd('0x14')](function(_0x855bae){_0x4c7080(_0x855bae);});};AGIVertices['prototype'][_0x15fd('0x18')]=function(_0x2ad0de,_0x8b7b9e){this[_0x15fd('0x10')][_0x15fd('0x19')](_0x2ad0de)[_0x15fd('0x12')](function(_0x3761db){_0x8b7b9e(null,_0x3761db?_0x3761db[_0x15fd('0x1a')]:![]);})[_0x15fd('0x14')](function(_0x1eab55){_0x8b7b9e(_0x1eab55);});};AGIVertices[_0x15fd('0xf')]['getUser']=function(_0x57b3de,_0x293d7b){this[_0x15fd('0x10')][_0x15fd('0x1b')](_0x57b3de)[_0x15fd('0x12')](function(_0x24bdaf){_0x293d7b(null,_0x24bdaf?_0x24bdaf[_0x15fd('0x13')]:![]);})[_0x15fd('0x14')](function(_0x50d493){_0x293d7b(_0x50d493);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1c')]=function(_0xc0883c,_0x5c7aa9){this[_0x15fd('0x10')]['getTrunkById'](_0xc0883c)[_0x15fd('0x12')](function(_0x1fc24f){_0x5c7aa9(null,_0x1fc24f?_0x1fc24f[_0x15fd('0x13')]:![]);})['catch'](function(_0x16b87c){_0x5c7aa9(_0x16b87c);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1d')]=function(_0x5d4789,_0x44e8c8){var _0x544685=this;this[_0x15fd('0x10')][_0x15fd('0x1e')](_0x5d4789)[_0x15fd('0x12')](function(_0x27d2c4){_0x44e8c8(null,_0x27d2c4?_0x544685[_0x15fd('0x1f')](_0x27d2c4[_0x15fd('0x20')]):![]);})[_0x15fd('0x14')](function(_0xe650a3){_0x44e8c8(_0xe650a3);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x21')]=function(_0x38993d,_0x5ca676){this[_0x15fd('0x10')][_0x15fd('0x22')](_0x38993d)['then'](function(_0x39e744){_0x5ca676(null,_0x39e744?_0x39e744:![]);})[_0x15fd('0x14')](function(_0x5f406a){_0x5ca676(_0x5f406a);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x23')]=function(_0x5dc5fe,_0x104fbd,_0x199647){this[_0x15fd('0xe')][_0x15fd('0x23')](_0x5dc5fe,_0x104fbd)[_0x15fd('0x12')](function(){_0x199647(null);})[_0x15fd('0x14')](function(_0x49cb6a){_0x199647(_0x49cb6a);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x24')]=function(_0x4228ea,_0x1c3d5e){this['rpc'][_0x15fd('0x25')](_0x4228ea)[_0x15fd('0x12')](function(_0x11b3a1){if(_0x11b3a1){if(_0x11b3a1[_0x15fd('0x26')]){_0x1c3d5e(null,[_0x11b3a1[_0x15fd('0x27')]]);}else{_0x1c3d5e(null,_[_0x15fd('0x28')](_0x11b3a1['Intervals'],_0x15fd('0x27')));}}else{_0x1c3d5e(null,![]);}})[_0x15fd('0x14')](function(_0x57c118){_0x1c3d5e(_0x57c118);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1f')]=function(_0xaa9244){return util['format'](_0x15fd('0x29'),FILES_PATH,_0xaa9244);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x2a')]=function(_0xbe50e7,_0x163380,_0x6b2ac8){odbc['open'](_0xbe50e7,function(_0x4baac6){if(_0x4baac6){logger['error'](_0x15fd('0x2b'),_0x4baac6);_0x6b2ac8(_0x4baac6);}else{logger[_0x15fd('0x2c')](_0x15fd('0x2d'));odbc['query'](_0x163380,function(_0x533585,_0x72dd02){if(_0x533585){logger['info']('Error\x20executing\x20query\x20%s',_0x163380);_0x6b2ac8(_0x533585);}else{logger['info'](_0x15fd('0x2e'),_0x163380);odbc[_0x15fd('0x2f')](function(_0x217300){if(_0x217300){logger['error'](_0x15fd('0x30'),_0x217300);}_0x6b2ac8(null,_0x72dd02);});}});}});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x31')]=function(_0x5beb6e,_0x1d693e){this[_0x15fd('0x10')][_0x15fd('0x32')](_0x5beb6e)[_0x15fd('0x12')](function(_0x2e8b0a){_0x1d693e(null,_0x2e8b0a?_0x2e8b0a:![]);})[_0x15fd('0x14')](function(_0x19a29f){_0x1d693e(_0x19a29f);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x33')]=function(_0x5dd3c4,_0x41eee0){this[_0x15fd('0x10')][_0x15fd('0x33')](_0x5dd3c4)[_0x15fd('0x12')](function(_0x2d2b6f){_0x41eee0(null,_0x2d2b6f);})[_0x15fd('0x14')](function(_0x320104){_0x41eee0(_0x320104);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x34')]=function(_0x104eef,_0x2eb6b6,_0x145eab){this[_0x15fd('0x10')][_0x15fd('0x34')]({'uniqueid':this[_0x15fd('0xd')]['uniqueid'],'node':_0x104eef[_0x15fd('0x35')],'application':_0x104eef[_0x15fd('0x36')],'data':_0x2eb6b6||null,'project_name':this[_0x15fd('0xd')][_0x15fd('0x37')],'callerid':this[_0x15fd('0xd')][_0x15fd('0x38')]})[_0x15fd('0x12')](function(_0x7a8cb7){if(_0x145eab){_0x145eab(null,_0x7a8cb7);}})['catch'](function(_0x4cd97b){if(_0x145eab){_0x145eab(_0x4cd97b);}});};AGIVertices[_0x15fd('0xf')]['createSquareRecording']=function(_0x2698ac,_0x2741d4,_0x5e4b62,_0x3c4b64){this[_0x15fd('0x10')][_0x15fd('0x39')]({'uniqueid':this[_0x15fd('0xd')][_0x15fd('0x3a')],'callerid':this[_0x15fd('0xd')]['callerid'],'calleridname':this[_0x15fd('0xd')][_0x15fd('0x3b')],'context':this[_0x15fd('0xd')][_0x15fd('0x3c')],'extension':this[_0x15fd('0xd')][_0x15fd('0x3d')],'priority':this[_0x15fd('0xd')][_0x15fd('0x3e')],'accountcode':this[_0x15fd('0xd')][_0x15fd('0x3f')],'dnid':this[_0x15fd('0xd')][_0x15fd('0x40')],'projectName':this['channel'][_0x15fd('0x37')],'saveName':_0x2741d4,'filename':_0x2698ac['file']||_0x2741d4,'savePath':_0x5e4b62})[_0x15fd('0x12')](function(_0x34c250){_0x3c4b64(null,_0x34c250);})[_0x15fd('0x14')](function(_0x5a1f32){_0x3c4b64(_0x5a1f32);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x41')]=function(_0x1db639,_0x155102,_0x4fe215,_0x1a1c01,_0x1a9605){this[_0x15fd('0x10')][_0x15fd('0x41')]({'uniqueid':this['channel'][_0x15fd('0x3a')],'body':_0x1db639,'direction':_0x155102,'providerName':_0x4fe215,'providerResponse':_0x1a1c01})[_0x15fd('0x12')](function(_0x5b608e){if(_0x1a9605){_0x1a9605(null,_0x5b608e);}})['catch'](function(_0x5da44c){if(_0x1a9605){_0x1a9605(_0x5da44c);}});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x42')]=function(_0x366c49,_0x10cf04){this[_0x15fd('0x10')][_0x15fd('0x42')]({'firstName':_['isEmpty'](_0x366c49[_0x15fd('0x13')])||_[_0x15fd('0x43')](_0x366c49[_0x15fd('0x13')])?'callback_'+Math[_0x15fd('0x44')]():_0x366c49['name'],'lastName':_[_0x15fd('0x45')](_0x366c49[_0x15fd('0x46')])||_[_0x15fd('0x43')](_0x366c49[_0x15fd('0x46')])?null:_0x366c49[_0x15fd('0x46')],'phone':_0x366c49[_0x15fd('0x47')],'ListId':_0x366c49[_0x15fd('0x48')],'scheduledat':_0x366c49[_0x15fd('0x49')],'callbackUniqueid':this[_0x15fd('0xd')][_0x15fd('0x3a')],'tags':_0x15fd('0x4a'),'description':_0x15fd('0x4b')+_0x366c49[_0x15fd('0x49')]['toString'](),'priority':_0x366c49[_0x15fd('0x4c')]})['then'](function(_0x341c3e){_0x10cf04(null,_0x341c3e);})['catch'](function(_0x25bdea){_0x10cf04(_0x25bdea);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x4d')]=function(_0x5426d0,_0x4d3e7e){this[_0x15fd('0x10')][_0x15fd('0x4e')](_0x5426d0)[_0x15fd('0x12')](function(_0x30ab06){_0x4d3e7e(null,_0x30ab06?_0x30ab06['name']:![]);})[_0x15fd('0x14')](function(_0x13306d){_0x4d3e7e(_0x13306d);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x4f')]=function(_0x387e7d,_0x321fe7,_0x59b3b4){var _0x8fd5c0={'role':_0x15fd('0x50')};_0x8fd5c0[_0x387e7d]=this[_0x15fd('0xd')][_0x15fd('0x38')];this[_0x15fd('0x10')][_0x15fd('0x4f')](_0x8fd5c0,_0x321fe7,this['channel']['uniqueid'])[_0x15fd('0x12')](function(_0x1b01a5){_0x59b3b4(null,_['isNil'](_0x1b01a5)?![]:!![]);})[_0x15fd('0x14')](function(_0x12178c){logger['error'](_0x12178c);_0x59b3b4(null,![]);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x51')]=function(_0x24c3a0,_0x53bfd7){var _0x13de6b={'role':_0x15fd('0x50')};_0x13de6b[_0x24c3a0]=this[_0x15fd('0xd')][_0x15fd('0x38')];this[_0x15fd('0x10')][_0x15fd('0x51')](_0x13de6b)[_0x15fd('0x12')](function(_0x290497){_0x53bfd7(null,_[_0x15fd('0x43')](_0x290497)?![]:!![]);})[_0x15fd('0x14')](function(_0x4e2301){logger[_0x15fd('0x52')](_0x4e2301);_0x53bfd7(null,![]);});};AGIVertices[_0x15fd('0xf')]['agentLogout']=function(_0x566099,_0x1ae6fc){var _0x39e6ee={'role':_0x15fd('0x50')};_0x39e6ee[_0x566099]=this[_0x15fd('0xd')][_0x15fd('0x38')];this[_0x15fd('0x10')]['agentLogout'](_0x39e6ee)[_0x15fd('0x12')](function(_0x5741d6){_0x1ae6fc(null,_[_0x15fd('0x43')](_0x5741d6)?![]:!![]);})[_0x15fd('0x14')](function(_0x7b4413){logger[_0x15fd('0x52')](_0x7b4413);_0x1ae6fc(null,![]);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x53')]=function(_0xe2e5e3,_0x25fc35){var _0x3e630d={'role':'agent'};_0x3e630d[_0xe2e5e3]=this['channel'][_0x15fd('0x38')];var _0x24ea9b=_0xe2e5e3!=_0x15fd('0x54')?util[_0x15fd('0x55')](_0x15fd('0x56'),_0x15fd('0x57'),this[_0x15fd('0xd')]['callerid']):undefined;this[_0x15fd('0x10')]['agentLogin'](_0x3e630d,_0x24ea9b)[_0x15fd('0x12')](function(_0x5abc5c){_0x25fc35(null,_[_0x15fd('0x43')](_0x5abc5c)?![]:!![]);})['catch'](function(_0x33bfd1){logger[_0x15fd('0x52')](_0x33bfd1);_0x25fc35(null,![]);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x58')]=function(_0x2e3c9a,_0x1e3bf7){sh[_0x15fd('0x59')](_[_0x15fd('0x5a')](_0x2e3c9a),function(_0x2cd8a8,_0x572aee){var _0x4efb15=_0x572aee[_0x15fd('0x5b')](/(\r\n|\n|\r)/gm,'');_0x1e3bf7(null,_0x4efb15);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x5c')]=function(_0x4a8659,_0x2614b6){scripts[_0x15fd('0x5c')](_0x4a8659[_0x15fd('0x5d')],_0x4a8659['google_cloud_tts_text_type']||_0x15fd('0x5e'),_0x4a8659[_0x15fd('0x5e')],_0x4a8659['languageCode']||_0x15fd('0x5f'),_0x4a8659['ssmlGender']||_0x15fd('0x60'),_0x4a8659[_0x15fd('0x61')]||_0x15fd('0x62'))[_0x15fd('0x12')](function(_0x35965f){_0x2614b6(null,_0x35965f);})['catch'](function(_0x30e036){_0x2614b6(_0x30e036);});};AGIVertices['prototype'][_0x15fd('0x63')]=function(_0x4a165f,_0x386c9b){scripts[_0x15fd('0x63')](_0x4a165f['text'],_0x4a165f[_0x15fd('0x64')]||'en',0x1)[_0x15fd('0x12')](function(_0x47f39a){_0x386c9b(null,_0x47f39a);})['catch'](function(_0xcf21c7){_0x386c9b(_0xcf21c7);});};AGIVertices['prototype'][_0x15fd('0x65')]=function(_0x2feba1,_0x166016){var _0x2121cb={'uri':_0x2feba1[_0x15fd('0x66')],'method':_0x2feba1['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2feba1[_0x15fd('0x67')])===_0x15fd('0x68')&&parseInt(_0x2feba1['timeout'])>=0x1?parseInt(_0x2feba1[_0x15fd('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x15fd('0x69')]([_0x15fd('0x6a'),_0x15fd('0x6b')],_0x2121cb[_0x15fd('0x6c')][_0x15fd('0x6d')]())){try{_0x2121cb[_0x15fd('0x6e')]=_0x2feba1[_0x15fd('0xa')]?JSON[_0x15fd('0x6f')](_0x2feba1[_0x15fd('0xa')]):{};}catch(_0x320f00){logger[_0x15fd('0x52')](_0x15fd('0x70'),_0x320f00);}}try{_0x2121cb[_0x15fd('0x71')]=_0x2feba1['rawHeaders']?JSON[_0x15fd('0x6f')](_0x2feba1['rawHeaders']):{};}catch(_0x3614dd){logger[_0x15fd('0x52')](_0x15fd('0x72'),_0x3614dd);}if(_0x2feba1[_0x15fd('0x73')]){try{var _0x58f942=require(_0x2feba1[_0x15fd('0x73')])[_0x15fd('0x74')](this,_0x2121cb);_0x2121cb[_0x15fd('0x75')]=Mustache[_0x15fd('0x76')](_0x2feba1['url'],_0x58f942,{},['$$','$$']);if(_0x2121cb[_0x15fd('0x71')]){_0x2121cb[_0x15fd('0x71')]=JSON['parse'](Mustache[_0x15fd('0x76')](JSON[_0x15fd('0x77')](_0x2121cb[_0x15fd('0x71')]),_0x58f942,{},['$$','$$']));}if(_0x2121cb['body']){_0x2121cb[_0x15fd('0x6e')]=JSON[_0x15fd('0x6f')](Mustache[_0x15fd('0x76')](JSON[_0x15fd('0x77')](_0x2121cb[_0x15fd('0x6e')]),_0x58f942,{},['$$','$$']));}}catch(_0x2d24a2){logger[_0x15fd('0x52')](_0x15fd('0x78'),_0x2d24a2);}}rp(_0x2121cb)[_0x15fd('0x12')](function(_0x32a2a0){var _0x3bd3fb={'statusCode':_0x32a2a0[_0x15fd('0x79')]||0xc8,'statusMessage':_0x32a2a0['statusMessage']||'OK','headers':_0x32a2a0[_0x15fd('0x71')]||{},'body':_0x32a2a0[_0x15fd('0x6e')]||{}};_0x166016(null,_0x3bd3fb);})[_0x15fd('0x14')](function(_0x291852){var _0x3ba646={'statusCode':_0x291852['statusCode']||0x1f4,'statusMessage':_0x291852['message']||_0x15fd('0x7a'),'headers':_0x291852[_0x15fd('0x7b')][_0x15fd('0x71')]||{},'body':_0x291852[_0x15fd('0x7b')][_0x15fd('0x6e')]||{}};_0x166016(null,_0x3ba646);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x7c')]=function(_0x27c8b4,_0x132613){scripts['googleDialogflow'](this[_0x15fd('0xd')][_0x15fd('0x3a')],_0x27c8b4['key'],_0x27c8b4[_0x15fd('0x5e')],_0x27c8b4[_0x15fd('0x7d')]||'en')[_0x15fd('0x12')](function(_0x35ad47){_0x132613(null,_0x35ad47);})['catch'](function(_0x3e4563){_0x132613(_0x3e4563);});};AGIVertices[_0x15fd('0xf')]['googleDialogflowV2']=function(_0x47529c,_0x1b5407){scripts[_0x15fd('0x7e')](this['channel'][_0x15fd('0x3a')],_0x47529c[_0x15fd('0x7f')],_0x47529c[_0x15fd('0x80')],_0x47529c[_0x15fd('0x81')],_0x47529c[_0x15fd('0x5e')],_0x47529c[_0x15fd('0x82')]||'en')[_0x15fd('0x12')](function(_0x3d548f){_0x1b5407(null,_0x3d548f);})['catch'](function(_0x471b2a){_0x1b5407(_0x471b2a);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x83')]=function(_0x4530db,_0x1b1fee){scripts[_0x15fd('0x83')](this[_0x15fd('0xd')],_0x4530db)[_0x15fd('0x12')](function(_0x3a4731){_0x1b1fee(null,_0x3a4731);})[_0x15fd('0x14')](function(_0x1c9b8e){_0x1b1fee(_0x1c9b8e);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x84')]=function(_0x29aa91,_0x4221df){scripts[_0x15fd('0x84')](_0x29aa91[_0x15fd('0x85')],_0x29aa91[_0x15fd('0x5e')],_0x29aa91[_0x15fd('0x86')]||_0x15fd('0x5f'),_0x29aa91[_0x15fd('0x87')])[_0x15fd('0x12')](function(_0x3c5f21){_0x4221df(null,_0x3c5f21);})[_0x15fd('0x14')](function(_0x126e66){_0x4221df(_0x126e66);});};AGIVertices[_0x15fd('0xf')]['ispeechASR']=function(_0x2217eb,_0x39e232,_0x585541){scripts[_0x15fd('0x88')](_0x39e232,_0x2217eb[_0x15fd('0x85')],_0x2217eb[_0x15fd('0x89')]||_0x15fd('0x5f'),this['isConfigured'](_0x2217eb['model'])?_0x2217eb[_0x15fd('0x8a')]:undefined)['then'](function(_0x3f4d0d){_0x585541(null,_0x3f4d0d);})[_0x15fd('0x14')](function(_0x33b3c8){_0x585541(_0x33b3c8);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x8b')]=function(_0x35de8f,_0x1bd38c){scripts['awsPolly'](_0x35de8f['aws_access_key_id'],_0x35de8f[_0x15fd('0x8c')],_0x35de8f[_0x15fd('0x8d')],_0x35de8f[_0x15fd('0x8e')]||_0x15fd('0x8f'),_0x35de8f[_0x15fd('0x5e')],_0x35de8f[_0x15fd('0x90')]||'text')['then'](function(_0x26b2ab){_0x1bd38c(null,_0x26b2ab);})[_0x15fd('0x14')](function(_0x196619){_0x1bd38c(_0x196619);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x91')]=function(_0x17e8c5,_0x4bf526){scripts[_0x15fd('0x91')](this['channel'][_0x15fd('0x3a')],_0x17e8c5[_0x15fd('0x92')],_0x17e8c5[_0x15fd('0x8c')],_0x17e8c5[_0x15fd('0x93')],_0x17e8c5['text'],_0x17e8c5[_0x15fd('0x94')])['then'](function(_0x3f82be){_0x4bf526(null,_0x3f82be);})['catch'](function(_0x534b17){_0x4bf526(_0x534b17);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x95')]=function(_0x2e4052,_0x333b37,_0x3945ff){scripts[_0x15fd('0x95')](_0x333b37,_0x2e4052['key'],_0x2e4052[_0x15fd('0x96')]||'en-US')[_0x15fd('0x12')](function(_0x3f4ff0){_0x3945ff(null,_0x3f4ff0);})[_0x15fd('0x14')](function(_0x4079d3){_0x3945ff(_0x4079d3);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x97')]=function(_0x3701b8,_0x2d17ae,_0x102c3d){scripts[_0x15fd('0x97')](_0x2d17ae,_0x3701b8[_0x15fd('0x98')],_0x3701b8[_0x15fd('0x99')],_0x3701b8['uri'])[_0x15fd('0x12')](function(_0x2cb43e){_0x102c3d(null,_0x2cb43e);})[_0x15fd('0x14')](function(_0x13c61b){_0x102c3d(_0x13c61b);});};AGIVertices[_0x15fd('0xf')][_0x15fd('0x9a')]=function(_0x481c29){var _0x4c77f5=_[_0x15fd('0x69')](verticesWithRetry,_0x481c29[_0x15fd('0x36')])?_0x481c29:_[_0x15fd('0x9b')](_0x481c29);for(var _0xc9a733 in _0x4c77f5){if(_0x4c77f5['hasOwnProperty'](_0xc9a733)){if(_0x4c77f5[_0xc9a733]&&_['isString'](_0x4c77f5[_0xc9a733])){if(_[_0x15fd('0x69')](recursiveMapAttributes,_0xc9a733)){_0x4c77f5[_0xc9a733]=this[_0x15fd('0x9c')](_0x4c77f5[_0xc9a733]);}else{_0x4c77f5[_0xc9a733]=this[_0x15fd('0x9d')](_0x4c77f5[_0xc9a733]);}}}}return _0x4c77f5;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x339185){for(var _0xc0599e in _0x339185){if(_0x339185[_0x15fd('0x9e')](_0xc0599e)){if(_[_0x15fd('0x9f')](_0x339185[_0xc0599e])){this[_0x15fd('0xa0')](_0x339185[_0xc0599e]);}else if(_[_0x15fd('0xa1')](_0x339185[_0xc0599e])){for(var _0x399a59=0x0;_0x399a59<_0x339185[_0xc0599e][_0x15fd('0xa2')];_0x399a59++){this[_0x15fd('0xa0')](_0x339185[_0xc0599e][_0x399a59]);}}else if(_[_0x15fd('0xa3')](_0x339185[_0xc0599e])){_0x339185[_0xc0599e]=this['replaceAllVariables'](_0x339185[_0xc0599e]);}}}};AGIVertices['prototype'][_0x15fd('0xa4')]=function(_0x37d900,_0x8edaeb){for(var _0x2fb1dd in _0x37d900){if(_0x37d900[_0x15fd('0x9e')](_0x2fb1dd)){if(_[_0x15fd('0x9f')](_0x37d900[_0x2fb1dd])){if(!_[_0x15fd('0x45')](_0x37d900[_0x2fb1dd])){this['saveRestApiResult'](_0x37d900[_0x2fb1dd],util[_0x15fd('0x55')]('%s.%s',_0x8edaeb,_0x2fb1dd));}}else if(_['isArray'](_0x37d900[_0x2fb1dd])){for(var _0x11aa1f=0x0;_0x11aa1f<_0x37d900[_0x2fb1dd][_0x15fd('0xa2')];_0x11aa1f++){this['saveRestApiResult'](_0x37d900[_0x2fb1dd][_0x11aa1f],util[_0x15fd('0x55')](_0x15fd('0xa5'),_0x8edaeb,_0x2fb1dd+'['+_0x11aa1f+']'));}}else{if(!_[_0x15fd('0x43')](_0x37d900[_0x2fb1dd])){this['channel'][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0xa5'),_0x8edaeb,_0x2fb1dd),_0x37d900[_0x2fb1dd]);}}}}};AGIVertices[_0x15fd('0xf')][_0x15fd('0x9c')]=function(_0x1da6b2){try{var _0x1380f3=JSON[_0x15fd('0x6f')](_0x1da6b2);this[_0x15fd('0xa0')](_0x1380f3);return JSON[_0x15fd('0x77')](_0x1380f3);}catch(_0x2340e6){return this['replaceAllVariables'](_0x1da6b2);}};AGIVertices[_0x15fd('0xf')]['replaceAllVariables']=function(_0x17c423){var _0x38ed3e=_0x17c423[_0x15fd('0xa7')]('{');for(var _0x1c5471=0x1;_0x1c5471<_0x38ed3e[_0x15fd('0xa2')];_0x1c5471+=0x1){var _0x281e40=_0x38ed3e[_0x1c5471][_0x15fd('0xa7')]('}');if(_0x281e40[_0x15fd('0xa2')]>0x1){_0x17c423=_0x17c423[_0x15fd('0xa8')]('{'+_0x281e40[0x0]+'}',this[_0x15fd('0xd')][_0x15fd('0xa9')](_0x281e40[0x0])['extra']||_0x281e40[0x0]);}}if(_0x38ed3e['length']===0x1){return _0x17c423[_0x15fd('0xaa')]();}return this[_0x15fd('0x9d')](_0x17c423);};AGIVertices[_0x15fd('0xf')][_0x15fd('0xab')]=function(_0x2cec23,_0x56dae9){var _0x4c4919=this[_0x15fd('0xd')][_0x15fd('0xa9')](_0x2cec23);if(_0x4c4919[_0x15fd('0xac')]===-0x1){return _0x4c4919;}logger[_0x15fd('0x2c')](util['format'](_0x15fd('0xad'),_0x56dae9,_0x4c4919['extra']));return this[_0x15fd('0xd')]['setVariable'](_0x56dae9,_0x4c4919[_0x15fd('0xae')]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0xaf')]=function(_0xfbe3f1){return _0xfbe3f1&&_0xfbe3f1!=='0'&&_0xfbe3f1!=='-1'&&_0xfbe3f1!=='';};AGIVertices[_0x15fd('0xf')][_0x15fd('0xb0')]=function(_0x57f717){this['createSquareDetailsReport'][_0x15fd('0x74')](this,_0x57f717,'-');_0x57f717[_0x15fd('0xb1')]=_0x57f717[_0x15fd('0xb0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x15fd('0xf')][_0x15fd('0xb2')]=function(_0x405b48){logger[_0x15fd('0x2c')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x405b48[_0x15fd('0x35')]));if(!this['isConfigured'](_0x405b48[_0x15fd('0x5e')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xb4'));}var _0x37a2f0='\x22'+_0x405b48[_0x15fd('0x5e')]+'\x22';if(this[_0x15fd('0xaf')](_0x405b48[_0x15fd('0x7b')])){_0x37a2f0+=','+_0x405b48[_0x15fd('0x7b')];}var _0x57872e=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x15fd('0xb5'),_0x37a2f0);if(_0x57872e[_0x15fd('0xac')]===-0x1){return _0x57872e;}return this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')]('Executed\x20command\x20MRCPSynth\x20%s',_0x37a2f0));};AGIVertices[_0x15fd('0xf')][_0x15fd('0xb6')]=function(_0x355625){logger[_0x15fd('0x2c')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x355625[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x355625['grammar'])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xb7'));}var _0x3d43b7=_0x355625[_0x15fd('0xb8')];if(this[_0x15fd('0xaf')](_0x355625[_0x15fd('0x7b')])){_0x3d43b7+=','+_0x355625[_0x15fd('0x7b')];}var _0x4ce87c=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x15fd('0xb9'),_0x3d43b7);if(_0x4ce87c[_0x15fd('0xac')]===-0x1){return _0x4ce87c;}var _0x458df9=this[_0x15fd('0xab')](_0x15fd('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0x458df9[_0x15fd('0xac')]===-0x1){return _0x458df9;}var _0x50f55e=this['getAndSetVariable'](_0x15fd('0xbb'),_0x15fd('0xbc'));if(_0x50f55e[_0x15fd('0xac')]===-0x1){return _0x50f55e;}var _0x3dd797=this[_0x15fd('0xab')](_0x15fd('0xbd'),_0x15fd('0xbe'));if(_0x3dd797[_0x15fd('0xac')]===-0x1){return _0x3dd797;}return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xbf'),_0x3d43b7));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x6')]=function(_0x12fd73){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x12fd73[_0x15fd('0x35')]));return this[_0x15fd('0xd')][_0x15fd('0x6')]([_0x12fd73[_0x15fd('0xc0')],_0x12fd73[_0x15fd('0xc1')]]);};AGIVertices['prototype'][_0x15fd('0xc2')]=function(_0x387f4b){logger['info'](util[_0x15fd('0x55')](_0x15fd('0xc3'),_0x387f4b[_0x15fd('0x35')]));if(this[_0x15fd('0xaf')](_0x387f4b[_0x15fd('0x67')])){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xc4'),_0x387f4b[_0x15fd('0x67')]));var _0x982d6d=this[_0x15fd('0xd')][_0x15fd('0xc5')](_0x387f4b[_0x15fd('0x67')]);if(_0x982d6d[_0x15fd('0xac')]===-0x1){return _0x982d6d;}}return this[_0x15fd('0xd')][_0x15fd('0xc2')]();};AGIVertices[_0x15fd('0xf')][_0x15fd('0x4a')]=function(_0x162d66){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xc6'),_0x162d66[_0x15fd('0x35')]));if(!this['isConfigured'](_0x162d66['list_id'])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x162d66,_0x15fd('0xc7'));}_0x162d66[_0x15fd('0x49')]=moment();if(this['isConfigured'](_0x162d66[_0x15fd('0xc8')])){_0x162d66[_0x15fd('0x49')]=moment()[_0x15fd('0xc9')](_0x162d66['delay'],_0x15fd('0xca'));}if(!this[_0x15fd('0xaf')](_0x162d66[_0x15fd('0x4c')])){_0x162d66[_0x15fd('0x4c')]=0x2;}this[_0x15fd('0x42')]['sync'](this,_0x162d66);return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x162d66[_0x15fd('0x47')],_0x162d66[_0x15fd('0x48')],_0x162d66[_0x15fd('0x49')]));};AGIVertices[_0x15fd('0xf')][_0x15fd('0xcb')]=function(_0x493346){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xcc'),_0x493346[_0x15fd('0x35')]));var _0x4fac67=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x493346[_0x15fd('0xcd')],_0x493346[_0x15fd('0x7b')]);if(_0x4fac67[_0x15fd('0xac')]===-0x1){return _0x4fac67;}return this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0xce'),_0x493346[_0x15fd('0xcd')],_0x493346[_0x15fd('0x7b')]));};AGIVertices[_0x15fd('0xf')][_0x15fd('0xcf')]=function(_0xf0d9c){logger['info'](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0xf0d9c[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0xf0d9c[_0x15fd('0x5e')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xb4'));}var _0x116cf4='\x22'+_0xf0d9c[_0x15fd('0x5e')]+'\x22';if(this[_0x15fd('0xaf')](_0xf0d9c[_0x15fd('0x7b')])){_0x116cf4+=','+_0xf0d9c[_0x15fd('0x7b')];}var _0x2997c4=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x15fd('0xb5'),_0x116cf4);if(_0x2997c4[_0x15fd('0xac')]===-0x1){return _0x2997c4;}return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xd0'),_0x116cf4));};AGIVertices[_0x15fd('0xf')]['sestektts']=function(_0x1adde6){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xd1'),_0x1adde6[_0x15fd('0x35')]));if(!this['isConfigured'](_0x1adde6[_0x15fd('0x5e')])){return this[_0x15fd('0xd')]['noop']('no\x20text\x20configured');}var _0x10a997='\x22'+_0x1adde6[_0x15fd('0x5e')]+'\x22';if(this[_0x15fd('0xaf')](_0x1adde6[_0x15fd('0x7b')])){_0x10a997+=','+_0x1adde6[_0x15fd('0x7b')];}var _0x295573=this[_0x15fd('0xd')]['exec'](_0x15fd('0xb5'),_0x10a997);if(_0x295573[_0x15fd('0xac')]===-0x1){return _0x295573;}return this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0xd0'),_0x10a997));};AGIVertices['prototype'][_0x15fd('0xd2')]=function(_0x479e69){logger['info'](util['format'](_0x15fd('0xd3'),_0x479e69['label']));if(!this[_0x15fd('0xaf')](_0x479e69['grammar'])){return this['channel'][_0x15fd('0xb3')](_0x15fd('0xb7'));}var _0x52ced0=_0x479e69[_0x15fd('0xb8')];if(this[_0x15fd('0xaf')](_0x479e69[_0x15fd('0x7b')])){_0x52ced0+=','+_0x479e69['options'];}var _0x2354cd=this[_0x15fd('0xd')]['exec'](_0x15fd('0xb9'),_0x52ced0);if(_0x2354cd[_0x15fd('0xac')]===-0x1){return _0x2354cd;}var _0x2c1f18=this[_0x15fd('0xab')]('RECOG_CONFIDENCE()',_0x15fd('0xd4'));if(_0x2c1f18[_0x15fd('0xac')]===-0x1){return _0x2c1f18;}var _0xcc72f2=this[_0x15fd('0xab')](_0x15fd('0xbb'),_0x15fd('0xd5'));if(_0xcc72f2[_0x15fd('0xac')]===-0x1){return _0xcc72f2;}var _0x57d70b=this[_0x15fd('0xab')]('RECOG_INSTANCE()',_0x15fd('0xd6'));if(_0x57d70b['result']===-0x1){return _0x57d70b;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x52ced0));};AGIVertices['prototype'][_0x15fd('0xd7')]=function(_0x5c0f11){logger['info'](util[_0x15fd('0x55')](_0x15fd('0xd8'),_0x5c0f11[_0x15fd('0x35')]));if(!this['isConfigured'](_0x5c0f11[_0x15fd('0xb8')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')]('no\x20grammar\x20configured');}var _0x4c24a7=_0x5c0f11[_0x15fd('0xb8')];if(this[_0x15fd('0xaf')](_0x5c0f11[_0x15fd('0x7b')])){_0x4c24a7+=','+_0x5c0f11[_0x15fd('0x7b')];}var _0x4305f4=this[_0x15fd('0xd')][_0x15fd('0x59')]('MRCPRecog',_0x4c24a7);if(_0x4305f4[_0x15fd('0xac')]===-0x1){return _0x4305f4;}var _0x3d9e8e=this['getAndSetVariable'](_0x15fd('0xba'),_0x15fd('0xd9'));if(_0x3d9e8e[_0x15fd('0xac')]===-0x1){return _0x3d9e8e;}var _0x30ba1f=this[_0x15fd('0xab')]('RECOG_INPUT()',_0x15fd('0xda'));if(_0x30ba1f['result']===-0x1){return _0x30ba1f;}var _0x2fa9fa=this[_0x15fd('0xab')](_0x15fd('0xbd'),_0x15fd('0xdb'));if(_0x2fa9fa[_0x15fd('0xac')]===-0x1){return _0x2fa9fa;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4c24a7));};AGIVertices[_0x15fd('0xf')]['database']=function(_0xe71fc5){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xdc'),_0xe71fc5[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0xe71fc5[_0x15fd('0xdd')])){return this['channel'][_0x15fd('0x52')](_0xe71fc5,_0x15fd('0xde'));}var _0x1ea6d0=this['getSquareOdbc']['sync'](this,_0xe71fc5[_0x15fd('0xdd')]);if(!_0x1ea6d0){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0xe71fc5,_0x15fd('0xdf'));}if(!this[_0x15fd('0xaf')](_0xe71fc5[_0x15fd('0xe0')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0xe71fc5,_0x15fd('0xe1'));}var _0x55489f=_0xe71fc5[_0x15fd('0xe0')][_0x15fd('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format']('query:\x20%s',_0x55489f));var _0x2332bd=this[_0x15fd('0x2a')][_0x15fd('0x74')](this,_0x1ea6d0,_0x55489f);this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0xe71fc5,_0x55489f);if(!this['isConfigured'](_0xe71fc5[_0x15fd('0xe2')])){return this['channel'][_0x15fd('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58da89=this[_0x15fd('0xa9')][_0x15fd('0x74')](this,_0xe71fc5[_0x15fd('0xe2')]);if(!_0x58da89){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0xe71fc5,'no\x20variable\x20found');}var _0x1a4777=this;_0x2332bd[_0x15fd('0xe3')](function(_0x179fbe,_0x165cba){Object[_0x15fd('0xe4')](_0x179fbe)['forEach'](function(_0xbb4e13){_0x1a4777[_0x15fd('0xd')][_0x15fd('0xa6')](util['format'](_0x15fd('0xe5'),_0x58da89,_0x165cba,_0xbb4e13),_0x179fbe[_0xbb4e13]);});});this[_0x15fd('0xd')][_0x15fd('0xa6')](util['format'](_0x15fd('0xe6'),_0x58da89),_0x2332bd[_0x15fd('0xa2')]);return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xe7'),_0x58da89));};AGIVertices[_0x15fd('0xf')][_0x15fd('0xe8')]=function(_0xfa4844){logger[_0x15fd('0xe9')](util['format'](_0x15fd('0xea'),_0xfa4844[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0xfa4844[_0x15fd('0xeb')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0xfa4844,_0x15fd('0xec'));}var _0x12ce80=this['getUser']['sync'](this,_0xfa4844['sip_id']);if(!_0x12ce80){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0xfa4844,'no\x20user\x20found');}var _0x5818dd=this[_0x15fd('0xd')]['exec'](_0x15fd('0xed'),[util['format'](_0x15fd('0xee'),_0x12ce80),_0xfa4844[_0x15fd('0x67')],_0xfa4844[_0x15fd('0xef')],_0xfa4844[_0x15fd('0x66')]]);if(_0x5818dd[_0x15fd('0xac')]===-0x1){return _0x5818dd;}return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xf0'),'DIAL'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0xf1')]=function(_0x11379c){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xf2'),_0x11379c[_0x15fd('0x35')]));if(!this['isConfigured'](_0x11379c[_0x15fd('0x85')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xf3'));}if(!this[_0x15fd('0xaf')](_0x11379c['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x15fd('0xd')][_0x15fd('0xf4')]=!![];this[_0x15fd('0x34')](_0x11379c);this[_0x15fd('0x41')](_0x11379c['text'],'in','','');this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xf5'),_0x11379c[_0x15fd('0x5e')]));var _0x2c6186=this[_0x15fd('0x7c')][_0x15fd('0x74')](this,_0x11379c);if(_0x2c6186){for(var _0x134459 in _0x2c6186){if(_0x2c6186[_0x15fd('0x9e')](_0x134459)){this['channel'][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0xf6'),_0x134459[_0x15fd('0x6d')]()),_0x2c6186[_0x134459]);}}this['createSquareMessage'](_0x2c6186[_0x15fd('0xf7')],_0x15fd('0xf8'),_0x15fd('0xf1'),'');return this[_0x15fd('0xd')]['noop'](util['format']('Dialogflow\x20Result\x20%s',_0x2c6186['speech']));}return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x11379c,_0x15fd('0xf9'));};AGIVertices[_0x15fd('0xf')]['dialogflowV2']=function(_0x20ba25){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0xfa'),_0x20ba25['label']));if(!this['isConfigured'](_0x20ba25['dialogflowV2_project_id'])){return this['channel'][_0x15fd('0xb3')](_0x15fd('0xfb'));}if(!this[_0x15fd('0xaf')](_0x20ba25['client_email'])){return this['channel'][_0x15fd('0xb3')]('no\x20client_email\x20configured');}if(!this[_0x15fd('0xaf')](_0x20ba25['private_key'])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xfc'));}if(!this['isConfigured'](_0x20ba25[_0x15fd('0x82')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x20ba25[_0x15fd('0x5e')])){return this[_0x15fd('0xd')]['noop'](_0x15fd('0xb4'));}this[_0x15fd('0xd')][_0x15fd('0xf4')]=!![];this[_0x15fd('0x34')](_0x20ba25);this['createSquareMessage'](_0x20ba25[_0x15fd('0x5e')],'in','','');this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Trying\x20DialogflowV2:\x20%s',_0x20ba25[_0x15fd('0x5e')]));var _0x2c07f4=this[_0x15fd('0x7e')][_0x15fd('0x74')](this,_0x20ba25);if(_0x2c07f4){for(var _0x2d5f95 in _0x2c07f4){if(_0x2c07f4[_0x15fd('0x9e')](_0x2d5f95)){if(_0x2d5f95!==_0x15fd('0xfd')){this[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0xf6'),_0x2d5f95[_0x15fd('0x6d')]()),_0x2c07f4[_0x2d5f95]);}}}this['createSquareMessage'](_0x2c07f4['speech'],_0x15fd('0xf8'),'dialogflowV2',_0x2c07f4[_0x15fd('0xfd')]);return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xfe'),_0x2c07f4[_0x15fd('0xf7')]));}return this['channel'][_0x15fd('0x52')](_0x20ba25,_0x15fd('0xff'));};AGIVertices[_0x15fd('0xf')]['sesteknda']=function(_0x209759){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x100'),_0x209759[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x209759[_0x15fd('0x101')])){return this['channel'][_0x15fd('0xb3')](_0x15fd('0x102'));}if(!this['isConfigured'](_0x209759[_0x15fd('0x103')])){return this[_0x15fd('0xd')]['noop']('no\x20username\x20configured');}if(!this[_0x15fd('0xaf')](_0x209759[_0x15fd('0x104')])){return this['channel'][_0x15fd('0xb3')](_0x15fd('0x105'));}if(!this['isConfigured'](_0x209759['ndassistant_url'])){return this['channel']['noop'](_0x15fd('0xb4'));}this[_0x15fd('0xd')]['bot']=!![];this[_0x15fd('0x34')](_0x209759);this['createSquareMessage'](_0x209759[_0x15fd('0x5e')],'in','','');this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x106'),_0x209759[_0x15fd('0x5e')]));var _0x76d279=this[_0x15fd('0x83')]['sync'](this,_0x209759);if(_0x76d279){for(var _0x45f41f in _0x76d279){if(_0x76d279[_0x15fd('0x9e')](_0x45f41f)){this[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')]('SESTEK_NDA_%s',_0x45f41f['toUpperCase']()),_0x76d279[_0x45f41f]);}}this[_0x15fd('0x41')](_0x76d279[_0x15fd('0xf7')],_0x15fd('0xf8'),_0x15fd('0x107'),'');if(_0x76d279[_0x15fd('0x108')]){this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0x109'),_0x76d279[_0x15fd('0x108')]));var _0x59dccc=this[_0x15fd('0xd')][_0x15fd('0x10a')](_0x76d279[_0x15fd('0x108')]);try{fs[_0x15fd('0x10b')](_0x76d279[_0x15fd('0x108')]+_0x15fd('0x10c'));}catch(_0x4d467b){logger[_0x15fd('0x52')](_0x4d467b);}return _0x59dccc;}else{return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')]('SestekNDA\x20Result\x20%s',_0x76d279[_0x15fd('0xf7')]));}}return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x209759,_0x15fd('0x10d'));};AGIVertices['prototype'][_0x15fd('0x10e')]=function(_0x101fa6){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20END\x20(%s)\x20block',_0x101fa6[_0x15fd('0x35')]));return this[_0x15fd('0xd')]['noop'](_0x15fd('0x10e'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x10f')]=function(_0x1144d0){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1144d0[_0x15fd('0x35')]));var _0x10ff5c='';if(_0x1144d0[_0x15fd('0x110')]){if(!this[_0x15fd('0xaf')](_0x1144d0[_0x15fd('0x110')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x1144d0,'no\x20trunk\x20selected');}else{var _0x560382=parseInt(_0x1144d0[_0x15fd('0x110')],0xa);if(isNaN(_0x560382)){_0x10ff5c=_0x1144d0[_0x15fd('0x110')];}else{_0x10ff5c=this[_0x15fd('0x1c')]['sync'](this,_0x1144d0['trunk_id']);if(!_0x10ff5c){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x1144d0,_0x15fd('0x111'));}}}}else if(_0x1144d0[_0x15fd('0x112')]){_0x10ff5c=_0x1144d0[_0x15fd('0x112')];}else{return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x1144d0,'no\x20trunk\x20selected');}var _0x57cccd=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x15fd('0xed'),[util[_0x15fd('0x55')](_0x15fd('0x113'),_0x10ff5c,_0x1144d0[_0x15fd('0x47')]),_0x1144d0[_0x15fd('0x67')],_0x1144d0[_0x15fd('0xef')],_0x1144d0[_0x15fd('0x66')]]);if(_0x57cccd[_0x15fd('0xac')]===-0x1){return _0x57cccd;}return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Executed\x20command\x20%s',_0x15fd('0xed')));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x114')]=function(_0x1450c8){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1450c8['label']));return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x114'));};AGIVertices[_0x15fd('0xf')]['getdigits']=function(_0x172307){logger['info'](util[_0x15fd('0x55')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x172307[_0x15fd('0x35')]));if(_0x172307['retry']===0x0){return this[_0x15fd('0xb0')](_0x172307);}_0x172307[_0x15fd('0xb1')]-=0x1;if(!this[_0x15fd('0xaf')](_0x172307[_0x15fd('0x115')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x172307,_0x15fd('0x116'));}var _0x41495a=this[_0x15fd('0x1d')][_0x15fd('0x74')](this,_0x172307[_0x15fd('0x115')]);if(!_0x41495a){return this[_0x15fd('0xd')]['error'](_0x172307,_0x15fd('0x117'));}if(!this[_0x15fd('0xaf')](_0x172307[_0x15fd('0xe2')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x15fd('0x118'));}var _0x29b441=this[_0x15fd('0xd')][_0x15fd('0x119')](_0x41495a,_0x172307['response'],_0x172307[_0x15fd('0x11a')]);var _0x25b36b=_0x29b441['result']?_0x29b441['result'][_0x15fd('0xaa')]():'';logger[_0x15fd('0x2c')](_0x15fd('0x11b'),JSON[_0x15fd('0x77')](_0x29b441));if(_0x29b441['result']===-0x1){this['createSquareDetailsReport'][_0x15fd('0x74')](this,_0x172307,_0x25b36b);return _0x29b441;}else if(_0x29b441[_0x15fd('0xae')]==='timeout'){_0x29b441['result']=_0x25b36b[_0x15fd('0xa2')]>=parseInt(_0x172307['mindigit'])?'x':'i';}else{_0x29b441[_0x15fd('0xac')]=_0x25b36b['length']>=parseInt(_0x172307[_0x15fd('0x11c')])&&_0x25b36b[_0x15fd('0xa2')]<=parseInt(_0x172307[_0x15fd('0x11a')])?'x':'i';}var _0x47e063=this[_0x15fd('0xa9')][_0x15fd('0x74')](this,_0x172307[_0x15fd('0xe2')]);if(!_0x47e063){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x172307,_0x15fd('0x11d'));}this[_0x15fd('0xd')][_0x15fd('0xa6')](_0x47e063,_0x25b36b);if(this['isConfigured'](_0x172307[_0x15fd('0x11e')])){var _0x5c8414=parseInt(_0x172307['hiddendigitsnum'],0xa);var _0x28041f=rs[_0x15fd('0x11f')]({'charset':'*','length':_0x5c8414});var _0x44949e=_0x25b36b['length'];if(_0x44949e>0x0){if(_0x44949e>_0x5c8414){this['createSquareDetailsReport'][_0x15fd('0x74')](this,_0x172307,_0x172307[_0x15fd('0x120')]===_0x15fd('0x121')?_0x28041f+_0x25b36b[_0x15fd('0x122')](_0x5c8414):_0x25b36b['substr'](0x0,_0x44949e-_0x5c8414)+_0x28041f);}else{this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x172307,rs['generate']({'charset':'*','length':_0x44949e}));}}else{this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x172307,'');}}else{this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x172307,_0x25b36b);}return _0x29b441;};AGIVertices['prototype'][_0x15fd('0xc')]=function(_0x1175a8){logger['info'](util[_0x15fd('0x55')](_0x15fd('0x123'),_0x1175a8['label']));return this['getdigits'](_0x1175a8);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x124')]=function(_0x19feac){logger[_0x15fd('0x2c')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x19feac[_0x15fd('0x35')]));this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x19feac,_0x19feac[_0x15fd('0x125')]);return this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0x126'),_0x19feac['goalname']));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x127')]=function(_0x4fb195){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x128'),_0x4fb195[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x4fb195['aws_access_key_id'])||!this['isConfigured'](_0x4fb195['aws_secret_access_key'])){return this[_0x15fd('0xd')][_0x15fd('0xb3')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x15fd('0xaf')](_0x4fb195[_0x15fd('0x5e')])){return this['channel'][_0x15fd('0xb3')](_0x15fd('0xb4'));}this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Trying\x20aws\x20Polly\x20%s',_0x4fb195[_0x15fd('0x5e')]));var _0x53d483=this['awsPolly'][_0x15fd('0x74')](this,_0x4fb195);if(_0x53d483){this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x129'),_0x53d483));var _0x458c81=this[_0x15fd('0xd')][_0x15fd('0x10a')](_0x53d483);try{fs[_0x15fd('0x10b')](_0x53d483+'.wav');}catch(_0x591a22){logger[_0x15fd('0x52')](_0x591a22);}return _0x458c81;}return this['channel'][_0x15fd('0x52')](_0x4fb195,_0x15fd('0x12a'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x12b')]=function(_0x4d109d){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x12c'),_0x4d109d[_0x15fd('0x35')]));if(!this['isConfigured'](_0x4d109d[_0x15fd('0x92')])||!this[_0x15fd('0xaf')](_0x4d109d[_0x15fd('0x8c')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x12d'));}if(!this[_0x15fd('0xaf')](_0x4d109d[_0x15fd('0x94')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x12e'));}if(!this['isConfigured'](_0x4d109d[_0x15fd('0x5e')])){return this[_0x15fd('0xd')]['noop'](_0x15fd('0xb4'));}this[_0x15fd('0xd')][_0x15fd('0xf4')]=!![];this['createSquareDetailsReport'](_0x4d109d);this[_0x15fd('0x41')](_0x4d109d[_0x15fd('0x5e')],'in','','');this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x12f'),_0x4d109d['text']));var _0x140592=this[_0x15fd('0x91')][_0x15fd('0x74')](this,_0x4d109d);if(_0x140592){for(var _0x570eee in _0x140592){if(_0x140592[_0x15fd('0x9e')](_0x570eee)&&_[_0x15fd('0xa3')](_0x140592[_0x570eee])){this[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0x130'),_0x570eee[_0x15fd('0x6d')]()),_0x140592[_0x570eee]);}}if(_['isNil'](_0x140592[_0x15fd('0x131')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x132'));}else{this[_0x15fd('0x41')](_0x140592['message'],_0x15fd('0xf8'),_0x15fd('0x133'),'');return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x134'),_0x140592[_0x15fd('0x131')]));}}return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x4d109d,_0x15fd('0x135'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x136')]=function(_0x52d726){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x52d726[_0x15fd('0x35')],_0x52d726[_0x15fd('0x67')]));if(!this[_0x15fd('0xaf')](_0x52d726[_0x15fd('0x85')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x15088e='wav';var _0x5bd784=util['format'](_0x15fd('0x137'),FILES_PATH,rs['generate'](0x4));var _0x419dea=util[_0x15fd('0x55')](_0x15fd('0xa5'),_0x5bd784,_0x15088e);var _0x5a0646=!![];if(_0x52d726[_0x15fd('0x138')]==='NOBEEP'){_0x5a0646=![];}var _0x2d1239=this[_0x15fd('0xd')][_0x15fd('0x139')](_0x5bd784,_0x15088e,_0x52d726[_0x15fd('0x13a')],_0x52d726['timeout'],undefined,_0x5a0646);if(_0x2d1239['result']!==-0x1){this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x13b'),_0x419dea));var _0x3108d2=this[_0x15fd('0x95')][_0x15fd('0x74')](this,_0x52d726,_0x419dea);if(_0x3108d2){for(var _0x102c9c in _0x3108d2){if(_0x3108d2['hasOwnProperty'](_0x102c9c)){this[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0x13c'),_0x102c9c[_0x15fd('0x6d')]()),_0x3108d2[_0x102c9c]);}}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x13d'),JSON[_0x15fd('0x77')](_0x3108d2)));}}return _0x2d1239;};AGIVertices['prototype'][_0x15fd('0x13e')]=function(_0x4a50fb){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x13f'),_0x4a50fb[_0x15fd('0x35')]));if(!this['isConfigured'](_0x4a50fb['appid'])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x140'));}if(!this[_0x15fd('0xaf')](_0x4a50fb[_0x15fd('0x99')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x141'));}var _0x1555f7=_0x15fd('0x142');var _0x4317b2=util['format'](_0x15fd('0x137'),FILES_PATH,rs[_0x15fd('0x11f')](0x4));var _0x2da998=util[_0x15fd('0x55')](_0x15fd('0xa5'),_0x4317b2,_0x1555f7);var _0x5b5b4b=!![];if(_0x4a50fb['beep']==='NOBEEP'){_0x5b5b4b=![];}var _0x246541=this[_0x15fd('0xd')][_0x15fd('0x139')](_0x4317b2,_0x1555f7,_0x4a50fb[_0x15fd('0x13a')],_0x4a50fb[_0x15fd('0x67')],undefined,_0x5b5b4b);if(_0x246541['result']!==-0x1){this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0x143'),_0x2da998));var _0x27c51e=this[_0x15fd('0x97')]['sync'](this,_0x4a50fb,_0x2da998);if(_0x27c51e){for(var _0x2bb3be in _0x27c51e){if(_0x27c51e['hasOwnProperty'](_0x2bb3be)){this[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0x144'),_0x2bb3be[_0x15fd('0x6d')]()),_0x27c51e[_0x2bb3be]);}}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x27c51e)));}}return _0x246541;};AGIVertices[_0x15fd('0xf')]['gotoc']=function(_0x264992){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x145'),_0x264992[_0x15fd('0x35')]));return this[_0x15fd('0xd')]['continueAt'](_0x264992[_0x15fd('0x3c')],_0x264992[_0x15fd('0x3d')],_0x264992[_0x15fd('0x3e')]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x146')]=function(_0x158b1c){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x147'),_0x158b1c[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x158b1c[_0x15fd('0x148')])){return this['channel'][_0x15fd('0x52')](_0x158b1c,_0x15fd('0x149'));}try{var _0x507e6a=eval(_0x158b1c[_0x15fd('0x148')])?_0x15fd('0x14a'):_0x15fd('0x14b');this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x14c'),_0x158b1c[_0x15fd('0x148')],_0x507e6a));return{'code':0xc8,'result':_0x507e6a};}catch(_0x1999cb){return{'code':0xc8,'result':_0x15fd('0x14b')};}};AGIVertices[_0x15fd('0xf')][_0x15fd('0x14d')]=function(_0x56dd8d){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x14e'),_0x56dd8d[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x56dd8d[_0x15fd('0x14f')])){return this[_0x15fd('0xd')]['error'](_0x56dd8d,_0x15fd('0x150'));}var _0x1e99ca=this[_0x15fd('0x24')][_0x15fd('0x74')](this,_0x56dd8d['interval_id']);if(!_0x1e99ca){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x56dd8d,_0x15fd('0x151'));}for(var _0x8f3c6a=0x0;_0x8f3c6a<_0x1e99ca[_0x15fd('0xa2')];_0x8f3c6a+=0x1){var _0x58f078=this['channel']['getVariable'](util[_0x15fd('0x55')](_0x15fd('0x152'),_0x1e99ca[_0x8f3c6a]));if(_0x58f078[_0x15fd('0xac')]===-0x1){return _0x58f078;}logger['info'](util[_0x15fd('0x55')]('IFTIME\x20%s\x20%s',_0x1e99ca[_0x8f3c6a],_0x58f078[_0x15fd('0xae')]));if(_0x58f078[_0x15fd('0xae')]===_0x15fd('0x14a')){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('IFTIME\x20%s\x20%s',_0x1e99ca[_0x8f3c6a],'true'));this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0x153'),_0x1e99ca[_0x8f3c6a],_0x15fd('0x14a')));return{'code':0xc8,'result':_0x15fd('0x14a')};}else{logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('IFTIME\x20%s\x20%s',_0x1e99ca[_0x8f3c6a],_0x15fd('0x14b')));this['channel']['noop'](util['format'](_0x15fd('0x153'),_0x1e99ca[_0x8f3c6a],_0x15fd('0x14b')));}}return{'code':0xc8,'result':_0x15fd('0x14b')};};AGIVertices[_0x15fd('0xf')]['hangup']=function(_0x4378ae){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x154'),_0x4378ae[_0x15fd('0x35')]));return this['channel'][_0x15fd('0x155')]();};AGIVertices[_0x15fd('0xf')][_0x15fd('0x156')]=function(_0x5387e1){logger['info'](util['format'](_0x15fd('0x157'),_0x5387e1['label']));if(!this[_0x15fd('0xaf')](_0x5387e1[_0x15fd('0x85')])){return this[_0x15fd('0xd')]['noop'](_0x15fd('0xf3'));}var _0x4536a8=_0x15fd('0x142');var _0x607349=util['format'](_0x15fd('0x137'),FILES_PATH,rs[_0x15fd('0x11f')](0x4));var _0xdfa29f=util['format'](_0x15fd('0xa5'),_0x607349,_0x4536a8);var _0x12108e=!![];if(_0x5387e1[_0x15fd('0x138')]===_0x15fd('0x158')){_0x12108e=![];}var _0x1924a0=this[_0x15fd('0xd')][_0x15fd('0x139')](_0x607349,_0x4536a8,_0x5387e1[_0x15fd('0x13a')],_0x5387e1[_0x15fd('0x67')],undefined,_0x12108e);if(_0x1924a0['result']!==-0x1){this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x159'),_0xdfa29f));var _0x31f684=this[_0x15fd('0x88')][_0x15fd('0x74')](this,_0x5387e1,_0xdfa29f);if(_0x31f684){for(var _0x2b176e in _0x31f684){if(_0x31f684[_0x15fd('0x9e')](_0x2b176e)){this[_0x15fd('0xd')]['setVariable'](util['format'](_0x15fd('0x15a'),_0x2b176e[_0x15fd('0x6d')]()),_0x31f684[_0x2b176e]);}}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x15b'),JSON[_0x15fd('0x77')](_0x31f684)));}}return _0x1924a0;};AGIVertices[_0x15fd('0xf')][_0x15fd('0x15c')]=function(_0x4d11f8){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x15d'),_0x4d11f8[_0x15fd('0x35')]));if(!this['isConfigured'](_0x4d11f8[_0x15fd('0x85')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')]('no\x20key\x20configured');}if(!this[_0x15fd('0xaf')](_0x4d11f8['text'])){return this[_0x15fd('0xd')]['noop'](_0x15fd('0xb4'));}this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x15e'),_0x4d11f8[_0x15fd('0x5e')]));var _0x5838a9=this[_0x15fd('0x84')][_0x15fd('0x74')](this,_0x4d11f8);if(_0x5838a9){this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x159'),_0x5838a9));var _0x1ea404=this[_0x15fd('0xd')]['streamFile'](_0x5838a9,_0x4d11f8[_0x15fd('0x13a')]);try{fs['unlink'](_0x5838a9+_0x15fd('0x10c'));}catch(_0x1a26e4){logger[_0x15fd('0x52')](_0x1a26e4);}return _0x1ea404;}return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x4d11f8,_0x15fd('0x15f'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x160')]=function(_0x290cb6){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x161'),_0x290cb6[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x290cb6[_0x15fd('0x162')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x290cb6,_0x15fd('0x163'));}logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x164'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x290cb6[_0x15fd('0x162')]));var _0x42dd2e=this[_0x15fd('0x53')][_0x15fd('0x74')](this,_0x290cb6[_0x15fd('0x162')]);if(_0x42dd2e){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x165'),this['channel'][_0x15fd('0x38')],_0x290cb6[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format'](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x290cb6['findBy']));return{'code':0xc8,'result':_0x15fd('0x166')};}else{logger['info'](util['format'](_0x15fd('0x167'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x290cb6[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x167'),this['channel'][_0x15fd('0x38')],_0x290cb6[_0x15fd('0x162')]));return{'code':0xc8,'result':_0x15fd('0x168')};}};AGIVertices[_0x15fd('0xf')]['logout']=function(_0x53f069){logger['info'](util[_0x15fd('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x53f069[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x53f069[_0x15fd('0x162')])){return this[_0x15fd('0xd')]['error'](_0x53f069,_0x15fd('0x163'));}logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x15fd('0xd')]['callerid'],_0x53f069[_0x15fd('0x162')]));var _0xc38b39=this[_0x15fd('0x169')][_0x15fd('0x74')](this,_0x53f069[_0x15fd('0x162')]);if(_0xc38b39){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x53f069[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x53f069['findBy']));return{'code':0xc8,'result':_0x15fd('0x166')};}else{logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x167'),this['channel'][_0x15fd('0x38')],_0x53f069[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x167'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x53f069[_0x15fd('0x162')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x15fd('0x16a')]=function(_0x48949b){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x16b'),_0x48949b[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x48949b[_0x15fd('0x16c')])){return this[_0x15fd('0xd')]['error'](_0x48949b,'no\x20operation\x20configured');}this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x16d'),_0x48949b[_0x15fd('0x16c')]));var _0x4a4e0d=eval(_0x48949b['operation']);if(!this[_0x15fd('0xaf')](_0x48949b[_0x15fd('0xe2')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x118'));}var _0x17843f=this['getVariable'][_0x15fd('0x74')](this,_0x48949b[_0x15fd('0xe2')]);if(!_0x17843f){return this['channel'][_0x15fd('0x52')](_0x48949b,'no\x20variable\x20found');}if(_[_0x15fd('0xa1')](_0x4a4e0d)){var _0x5db24f=this;_0x4a4e0d[_0x15fd('0xe3')](function(_0x2dad94,_0x2d6803){_0x5db24f[_0x15fd('0xd')][_0x15fd('0xa6')](util[_0x15fd('0x55')](_0x15fd('0x16e'),_0x17843f,_0x2d6803),_0x2dad94);});return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x16f'),_0x17843f));}else{return this[_0x15fd('0xd')][_0x15fd('0xa6')](_0x17843f,_0x4a4e0d);}};AGIVertices['prototype'][_0x15fd('0xb')]=function(_0x58f42a){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x170'),_0x58f42a['label']));if(_0x58f42a[_0x15fd('0xb1')]===0x0){return this[_0x15fd('0xb0')](_0x58f42a);}_0x58f42a[_0x15fd('0xb1')]-=0x1;if(!this[_0x15fd('0xaf')](_0x58f42a[_0x15fd('0x115')])){return this['channel'][_0x15fd('0x52')](_0x58f42a,_0x15fd('0x116'));}var _0x592c7e=this[_0x15fd('0x1d')][_0x15fd('0x74')](this,_0x58f42a['file_id']);if(!_0x592c7e){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x58f42a,_0x15fd('0x117'));}var _0x281569=this[_0x15fd('0xd')]['getData'](_0x592c7e,_0x58f42a[_0x15fd('0x171')],_0x58f42a['digit']);var _0x4816f1=_0x281569[_0x15fd('0xac')];if(_0x281569[_0x15fd('0xac')]===-0x1){this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x58f42a,'-1');return _0x281569;}else if(_0x281569['extra']===_0x15fd('0x67')){_0x281569[_0x15fd('0xac')]=_0x281569[_0x15fd('0xac')]['length']>0x0?_0x281569['result']:'t';}else if(_[_0x15fd('0x45')](_0x281569['result'])){_0x281569['result']='#';_0x4816f1='#';}if(!this[_0x15fd('0xaf')](_0x58f42a[_0x15fd('0xe2')])){this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x118'));}else{var _0xf5ced4=this['getVariable']['sync'](this,_0x58f42a[_0x15fd('0xe2')]);if(!_0xf5ced4){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x58f42a,'no\x20variable\x20found');}this[_0x15fd('0xd')]['setVariable'](_0xf5ced4,_0x4816f1);}this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x58f42a,_0x4816f1);return _0x281569;};AGIVertices[_0x15fd('0xf')][_0x15fd('0xb3')]=function(_0x560440){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x560440[_0x15fd('0x35')]));return this[_0x15fd('0xd')]['noop'](_0x560440[_0x15fd('0x172')]||_0x560440[_0x15fd('0x35')]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x173')]=function(_0x36e2a6){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x174'),_0x36e2a6[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x36e2a6[_0x15fd('0x162')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x36e2a6,'no\x20find\x20by\x20configured');}logger['info'](util[_0x15fd('0x55')](_0x15fd('0x164'),this[_0x15fd('0xd')]['callerid'],_0x36e2a6[_0x15fd('0x162')]));var _0x537a92=this['getPause'][_0x15fd('0x74')](this,_0x36e2a6[_0x15fd('0x175')]);var _0x5b0b2a=this[_0x15fd('0x4f')]['sync'](this,_0x36e2a6[_0x15fd('0x162')],_0x537a92);if(_0x5b0b2a){logger['info'](util[_0x15fd('0x55')](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x36e2a6[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format'](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x36e2a6['findBy']));return{'code':0xc8,'result':_0x15fd('0x166')};}else{logger['info'](util['format'](_0x15fd('0x167'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x36e2a6[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x36e2a6[_0x15fd('0x162')]));return{'code':0xc8,'result':_0x15fd('0x168')};}};AGIVertices[_0x15fd('0xf')][_0x15fd('0x176')]=function(_0x45e3b1){logger[_0x15fd('0x2c')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x45e3b1[_0x15fd('0x35')]));if(!this['isConfigured'](_0x45e3b1[_0x15fd('0x115')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x45e3b1,_0x15fd('0x116'));}var _0xc247c9=this[_0x15fd('0x1d')][_0x15fd('0x74')](this,_0x45e3b1[_0x15fd('0x115')]);if(!_0xc247c9){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x45e3b1,_0x15fd('0x117'));}var _0x19a2c3=this[_0x15fd('0xd')]['exec'](_0x15fd('0x177'),[_0xc247c9,_0x45e3b1[_0x15fd('0xef')]]);if(_0x19a2c3['result']===-0x1){return _0x19a2c3;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format'](_0x15fd('0xce'),_0x15fd('0x177'),_0xc247c9));};AGIVertices['prototype'][_0x15fd('0x178')]=function(_0x2e9a57){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2e9a57[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x2e9a57[_0x15fd('0x179')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x2e9a57,_0x15fd('0x17a'));}var _0x4044e1='';var _0x2ea448=parseInt(_0x2e9a57[_0x15fd('0x179')],0xa);if(isNaN(_0x2ea448)){_0x4044e1=_0x2e9a57[_0x15fd('0x179')];}else{_0x4044e1=this[_0x15fd('0x15')][_0x15fd('0x74')](this,_0x2e9a57[_0x15fd('0x179')]);if(!_0x4044e1){return this['channel'][_0x15fd('0x52')](_0x2e9a57,_0x15fd('0x17b'));}}var _0x1f7797='';if(this[_0x15fd('0xaf')](_0x2e9a57[_0x15fd('0x115')])){var _0x1252e4=this[_0x15fd('0x1d')][_0x15fd('0x74')](this,_0x2e9a57[_0x15fd('0x115')]);if(_0x1252e4){_0x1f7797=_0x1252e4;}}this['createSquareDetailsReport']['sync'](this,_0x2e9a57,_0x4044e1);if(_0x2e9a57[_0x15fd('0xef')][_0x15fd('0x17c')]('x')<0x0){_0x2e9a57[_0x15fd('0xef')]+='x';}if(_0x2e9a57[_0x15fd('0xef')]['indexOf']('X')<0x0){_0x2e9a57[_0x15fd('0xef')]+='X';}this[_0x15fd('0xd')][_0x15fd('0xa6')](_0x15fd('0x17d'),_0x4044e1?_0x4044e1[_0x15fd('0x17e')]():'');var _0x2e5d3e=this[_0x15fd('0xd')][_0x15fd('0x59')](_0x15fd('0x17f'),[_0x4044e1,_0x2e9a57[_0x15fd('0xef')],_0x2e9a57['url'],_0x1f7797,_0x2e9a57['timeout'],_0x2e9a57[_0x15fd('0x6')],_0x2e9a57[_0x15fd('0x180')],_0x2e9a57['gosub'],'',_0x2e9a57[_0x15fd('0x181')]]);if(_0x2e5d3e[_0x15fd('0xac')]===-0x1){return _0x2e5d3e;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format'](_0x15fd('0xce'),_0x15fd('0x17f'),_0x4044e1));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x182')]=function(_0x33833c){logger['info'](util[_0x15fd('0x55')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x33833c[_0x15fd('0x35')]));var _0xa07bad=_0x33833c[_0x15fd('0x183')]||'wav';var _0xd5d37a=util['format']('%s_%s',this[_0x15fd('0xd')][_0x15fd('0x3a')],rs[_0x15fd('0x11f')](0x5));var _0x532b37=util[_0x15fd('0x55')](_0x15fd('0x184'),FILES_PATH,_0xd5d37a,_0xa07bad);var _0x39bede=util[_0x15fd('0x55')](_0x15fd('0x137'),FILES_PATH,_0xd5d37a);this[_0x15fd('0x39')][_0x15fd('0x74')](this,_0x33833c,_0xd5d37a,_0x532b37);this[_0x15fd('0xd')][_0x15fd('0xa6')](_0x15fd('0x185'),_0xd5d37a);logger[_0x15fd('0x2c')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x39bede,_0xa07bad,_0x33833c[_0x15fd('0x186')],_0x33833c[_0x15fd('0x67')]);return this[_0x15fd('0xd')][_0x15fd('0x139')](_0x39bede,_0xa07bad,_0x33833c['escape_digits'],_0x33833c[_0x15fd('0x67')],undefined,!![]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x187')]=function(_0x5ce95a){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x188'),_0x5ce95a['label']));if(!this[_0x15fd('0xaf')](_0x5ce95a['url'])){return this[_0x15fd('0xd')]['noop']('no\x20url\x20configured');}var _0x1dcaeb=this[_0x15fd('0x65')][_0x15fd('0x74')](this,_0x5ce95a);logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x189'),util[_0x15fd('0x18a')](_0x1dcaeb,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5ce95a['variable_id'])){return this[_0x15fd('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x720d4f=this[_0x15fd('0xa9')][_0x15fd('0x74')](this,_0x5ce95a[_0x15fd('0xe2')]);if(!_0x720d4f){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x5ce95a,_0x15fd('0x11d'));}this[_0x15fd('0xd')][_0x15fd('0xa6')](util['format'](_0x15fd('0x18b'),_0x720d4f),_0x1dcaeb[_0x15fd('0x79')]?_0x1dcaeb[_0x15fd('0x79')]:_0x15fd('0x18c'));this[_0x15fd('0xd')]['setVariable'](util[_0x15fd('0x55')]('%s_STATUS_MESSAGE',_0x720d4f),_0x1dcaeb[_0x15fd('0x18d')]?_0x1dcaeb[_0x15fd('0x18d')]:'OK');if(_0x1dcaeb[_0x15fd('0x6e')]){try{this[_0x15fd('0xa4')](_0x1dcaeb[_0x15fd('0x6e')],_0x720d4f);}catch(_0x855855){logger[_0x15fd('0x52')](util['format'](_0x15fd('0x18e'),_0x720d4f));}}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format']('variable\x20%s\x20set',_0x720d4f));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x18f')]=function(_0x2b6c85){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x190'),_0x2b6c85[_0x15fd('0x35')]));return this[_0x15fd('0xd')][_0x15fd('0x191')](_0x2b6c85[_0x15fd('0x192')][_0x15fd('0x5b')](/\s+/g,''),_0x2b6c85['escape_digits']);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x193')]=function(_0x2f1cc5){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x194'),_0x2f1cc5[_0x15fd('0x35')]));return this[_0x15fd('0xd')][_0x15fd('0x195')](_0x2f1cc5[_0x15fd('0x68')]['replace'](/\s+/g,''),_0x2f1cc5[_0x15fd('0x186')]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x196')]=function(_0x1c0ca0){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1c0ca0[_0x15fd('0x35')]));return this[_0x15fd('0xd')][_0x15fd('0x197')](_0x1c0ca0[_0x15fd('0x5e')],_0x1c0ca0['escape_digits']);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x198')]=function(_0x3f2593){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x199'),_0x3f2593[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x3f2593[_0x15fd('0x19a')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x19b'));}var _0x3e8472=this[_0x15fd('0x21')]['sync'](this,_0x3f2593[_0x15fd('0x19a')]);if(!_0x3e8472||!_0x3e8472[_0x15fd('0x19c')]){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x3f2593,_0x15fd('0x19d'));}var _0x48d59f={'from':util[_0x15fd('0x55')](_0x15fd('0x19e'),_0x3e8472[_0x15fd('0x13')],_0x3e8472[_0x15fd('0x19f')]||_0x3e8472[_0x15fd('0x19c')]['user']),'to':_0x3f2593['to']||'','cc':_0x3f2593['cc']||'','bcc':_0x3f2593[_0x15fd('0x1a0')]||'','subject':_0x3f2593[_0x15fd('0x1a1')],'html':_0x3f2593[_0x15fd('0x5e')],'text':_0x3f2593['text']};if(this['isConfigured'](_0x3f2593[_0x15fd('0x1a2')])){}logger[_0x15fd('0xe9')](_0x15fd('0x1a3'),JSON[_0x15fd('0x77')](_0x48d59f));this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x3f2593,_0x3f2593[_0x15fd('0x19a')]);this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')](_0x15fd('0x1a4'),_0x3e8472['name']));this[_0x15fd('0x23')][_0x15fd('0x74')](this,_0x3e8472['smtpOptions'],_0x48d59f);return this[_0x15fd('0xd')]['noop'](_0x15fd('0x1a5'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1a6')]=function(_0x234161){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x1a7'),_0x234161[_0x15fd('0x35')]));return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x1a8'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1a9')]=function(_0x35d5dd){logger['info'](util[_0x15fd('0x55')](_0x15fd('0x1aa'),_0x35d5dd[_0x15fd('0x35')]));if(!this[_0x15fd('0xaf')](_0x35d5dd[_0x15fd('0x1ab')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x1ac'));}var _0x1bd3c2=this[_0x15fd('0x31')][_0x15fd('0x74')](this,_0x35d5dd[_0x15fd('0x1ab')]);if(!_0x1bd3c2){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x35d5dd,_0x15fd('0x1ad'));}var _0x2e64bc={'body':_0x35d5dd[_0x15fd('0x1ae')],'phone':_0x35d5dd['to']||'','SmsAccountId':_0x1bd3c2['id']};logger[_0x15fd('0xe9')](_0x15fd('0x1af'),JSON[_0x15fd('0x77')](_0x2e64bc));this['createSquareDetailsReport'][_0x15fd('0x74')](this,_0x35d5dd,_0x35d5dd[_0x15fd('0x1ab')]);this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x1b0'),_0x1bd3c2['name']));this[_0x15fd('0x33')][_0x15fd('0x74')](this,_0x2e64bc);return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x1b1'));};AGIVertices[_0x15fd('0xf')]['set']=function(_0x55a745){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x1b2'),_0x55a745[_0x15fd('0x35')]));if(!this['isConfigured'](_0x55a745[_0x15fd('0xe2')])){return this['channel'][_0x15fd('0x52')](_0x55a745,_0x15fd('0x1b3'));}var _0x58f816=this[_0x15fd('0xa9')][_0x15fd('0x74')](this,_0x55a745[_0x15fd('0xe2')]);if(!_0x58f816){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x55a745,_0x15fd('0x11d'));}return this[_0x15fd('0xd')]['setVariable'](_0x58f816,_0x55a745[_0x15fd('0x1b4')]);};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1b5')]=function(_0x208518){logger['info'](util[_0x15fd('0x55')](_0x15fd('0x1b6'),_0x208518[_0x15fd('0x35')]));this['channel'][_0x15fd('0xb3')]('START\x20CALLY\x20SQUARE');var _0x467ca2=this[_0x15fd('0xd')][_0x15fd('0xa9')](_0x15fd('0x1b7'));if(!_['isEmpty'](_0x467ca2['extra'])){this['channel'][_0x15fd('0x3a')]=_0x467ca2[_0x15fd('0xae')];}if(_0x208518[_0x15fd('0xc2')]===_0x15fd('0x1b8')){this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x1b9'));return this[_0x15fd('0xd')]['answer']();}return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0x1ba'));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1bb')]=function(_0x527a81){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x527a81['label']));if(!this[_0x15fd('0xaf')](_0x527a81[_0x15fd('0x1bc')])){return this['channel'][_0x15fd('0x52')](_0x527a81,_0x15fd('0x1bd'));}var _0x47dd96=this['getSquareProject'][_0x15fd('0x74')](this,_0x527a81['project_id']);if(!this['isConfigured'](_0x47dd96)){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x527a81,util[_0x15fd('0x55')](_0x15fd('0x1be'),_0x527a81[_0x15fd('0x1bc')]));}if(_0x47dd96===this[_0x15fd('0xd')][_0x15fd('0x37')]){return this[_0x15fd('0xd')]['error'](_0x527a81,_0x15fd('0x1bf'));}this[_0x15fd('0x34')]['sync'](this,_0x527a81,_0x47dd96);var _0x92b1fc=this[_0x15fd('0xd')]['exec'](_0x15fd('0x1c0'),util[_0x15fd('0x55')](_0x15fd('0x1c1'),config['agi'][_0x15fd('0x1c2')]||_0x15fd('0x1c3'),_0x47dd96,this[_0x15fd('0xd')]['arg_1']));if(_0x92b1fc[_0x15fd('0xac')]===-0x1){return _0x92b1fc;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0xce'),'AGI',_0x47dd96));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1c4')]=function(_0x5c6268){logger['info'](util['format'](_0x15fd('0x1c5'),_0x5c6268[_0x15fd('0x35')]));var _0x32aa4d=this[_0x15fd('0x58')]['sync'](this,_0x5c6268[_0x15fd('0xc0')]);this[_0x15fd('0x34')][_0x15fd('0x74')](this,_0x5c6268,_0x5c6268[_0x15fd('0xc0')]);if(this[_0x15fd('0xaf')](_0x5c6268[_0x15fd('0xe2')])){var _0x2fef86=this['getVariable'][_0x15fd('0x74')](this,_0x5c6268[_0x15fd('0xe2')]);if(_0x2fef86){this[_0x15fd('0xd')][_0x15fd('0xa6')](_0x2fef86,_0x32aa4d);return this['channel'][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x1c6'),_0x5c6268[_0x15fd('0xc0')],_0x2fef86));}}return this[_0x15fd('0xd')]['noop'](util['format'](_0x15fd('0x1c7'),_0x5c6268['command']));};AGIVertices[_0x15fd('0xf')]['google_cloud_tts']=function(_0x3098c2){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x1c8'),_0x3098c2[_0x15fd('0x35')]));_0x3098c2[_0x15fd('0x5e')]=_0x3098c2['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x15fd('0xaf')](_0x3098c2[_0x15fd('0x5d')])){return this[_0x15fd('0xd')]['noop'](_0x15fd('0x1c9'));}if(!this[_0x15fd('0xaf')](_0x3098c2[_0x15fd('0x5e')])){return this[_0x15fd('0xd')]['noop']('no\x20text\x20configured');}this[_0x15fd('0xd')]['noop'](util[_0x15fd('0x55')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x3098c2['text']));var _0x261e2f=this[_0x15fd('0x5c')][_0x15fd('0x74')](this,_0x3098c2);if(_0x261e2f){this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x1ca'),_0x261e2f));var _0x46be6f=this['channel'][_0x15fd('0x10a')](_0x261e2f);try{fs[_0x15fd('0x10b')](_0x261e2f+_0x15fd('0x10c'));}catch(_0x4f0f48){logger[_0x15fd('0x52')](_0x4f0f48);}return _0x46be6f;}return this['channel'][_0x15fd('0x52')](_0x3098c2,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x14b218){logger[_0x15fd('0x2c')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x14b218['label']));_0x14b218[_0x15fd('0x5e')]=_0x14b218['text'][_0x15fd('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x15fd('0xaf')](_0x14b218[_0x15fd('0x5e')])){return this[_0x15fd('0xd')][_0x15fd('0xb3')](_0x15fd('0xb4'));}this['channel']['noop'](util['format'](_0x15fd('0x1cb'),_0x14b218[_0x15fd('0x5e')]));var _0x41948a=this[_0x15fd('0x63')][_0x15fd('0x74')](this,_0x14b218);if(_0x41948a){this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x1cc'),_0x41948a));var _0x31efb8=this[_0x15fd('0xd')][_0x15fd('0x10a')](_0x41948a);try{fs['unlink'](_0x41948a+_0x15fd('0x10c'));}catch(_0x10c621){logger[_0x15fd('0x52')](_0x10c621);}return _0x31efb8;}return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x14b218,_0x15fd('0x1cd'));};AGIVertices[_0x15fd('0xf')]['unpause']=function(_0x3a2ec4){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x3a2ec4['label']));if(!this[_0x15fd('0xaf')](_0x3a2ec4[_0x15fd('0x162')])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x3a2ec4,_0x15fd('0x163'));}logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x164'),this['channel'][_0x15fd('0x38')],_0x3a2ec4[_0x15fd('0x162')]));var _0x357db3=this[_0x15fd('0x51')][_0x15fd('0x74')](this,_0x3a2ec4[_0x15fd('0x162')]);if(_0x357db3){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x3a2ec4[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util['format'](_0x15fd('0x165'),this[_0x15fd('0xd')][_0x15fd('0x38')],_0x3a2ec4['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x15fd('0x55')](_0x15fd('0x167'),this['channel'][_0x15fd('0x38')],_0x3a2ec4[_0x15fd('0x162')]));this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')](_0x15fd('0x167'),this['channel'][_0x15fd('0x38')],_0x3a2ec4[_0x15fd('0x162')]));return{'code':0xc8,'result':_0x15fd('0x168')};}};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1ce')]=function(_0x66c800){logger[_0x15fd('0x2c')](util['format'](_0x15fd('0x1cf'),_0x66c800['label']));var _0x398683=this[_0x15fd('0xd')]['exec'](_0x15fd('0x1d0'),[_0x66c800[_0x15fd('0x1d1')],_0x66c800[_0x15fd('0x7b')]]);if(_0x398683['result']===-0x1){return _0x398683;}return this[_0x15fd('0xd')][_0x15fd('0xb3')](util[_0x15fd('0x55')]('Executed\x20command\x20%s\x20%s',_0x15fd('0x1d0'),_0x66c800[_0x15fd('0x1d1')]));};AGIVertices[_0x15fd('0xf')][_0x15fd('0x1d2')]=function(_0x12abf9){logger[_0x15fd('0x2c')](util[_0x15fd('0x55')](_0x15fd('0x1d3'),_0x12abf9['label']));if(!this[_0x15fd('0xaf')](_0x12abf9['variable_id'])){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x12abf9,_0x15fd('0x1b3'));}var _0xbc94c8=this[_0x15fd('0xa9')]['sync'](this,_0x12abf9[_0x15fd('0xe2')]);if(!_0xbc94c8){return this[_0x15fd('0xd')][_0x15fd('0x52')](_0x12abf9,_0x15fd('0x11d'));}var _0x5916d4=this[_0x15fd('0xd')][_0x15fd('0xa9')](_0xbc94c8);return{'code':0xc8,'result':_0x5916d4['extra']?_0x5916d4[_0x15fd('0xae')]:'-'};};String[_0x15fd('0xf')][_0x15fd('0xa8')]=function(_0x5098e2,_0x1069f1){return this[_0x15fd('0xa7')](_0x5098e2)['join'](_0x1069f1);};module[_0x15fd('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index ee83e73..ad3c8ad 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 _0xdfcc=['diff','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','agents','resolve','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','YYYY-MM-DD\x20HH:mm:ss','acwTimeout','finally','[ACW][START]\x20%s','message','stopAcw','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds'];(function(_0x4d77d0,_0x2f91a0){var _0x2f4699=function(_0x4dcc6c){while(--_0x4dcc6c){_0x4d77d0['push'](_0x4d77d0['shift']());}};_0x2f4699(++_0x2f91a0);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xdfcc[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xcdfc('0x0'));var moment=require(_0xcdfc('0x1'));var ami=require(_0xcdfc('0x2'));var logger=require('../../../config/logger')(_0xcdfc('0x3'));var RpcUser=require(_0xcdfc('0x4'));var RpcVoiceAgentReport=require(_0xcdfc('0x5'));function Acw(_0x4aef49){this[_0xcdfc('0x6')]=_0x4aef49['voiceQueues'];this['agents']=_0x4aef49['agents'];this[_0xcdfc('0x7')]=_0x4aef49[_0xcdfc('0x7')];this['channels']={};ami['on'](_0xcdfc('0x8'),this[_0xcdfc('0x9')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xb'),this['syncHangupRequest'][_0xcdfc('0xa')](this));ami['on']('hangup',this[_0xcdfc('0xc')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xd'),this[_0xcdfc('0xe')][_0xcdfc('0xa')](this));ami['on'](_0xcdfc('0xf'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xcdfc('0x10'),this[_0xcdfc('0x11')]['bind'](this));ami['on'](_0xcdfc('0x12'),this[_0xcdfc('0x13')]['bind'](this));}function getDiff(_0x23ed41){var _0x29e684=moment()[_0xcdfc('0x14')](0x0);var _0x4c6e77=moment(_0x23ed41)[_0xcdfc('0x14')](0x0);return _0x29e684[_0xcdfc('0x15')](_0x4c6e77,'seconds');}Acw[_0xcdfc('0x16')][_0xcdfc('0x17')]=function(_0x1e2282,_0x5189bd){var _0x3834aa=this;var _0x1a8095=getDiff(_0x3834aa['timers'][_0x1e2282][_0xcdfc('0x18')]);clearTimeout(_0x3834aa[_0xcdfc('0x7')][_0x1e2282]['timer']);_0x3834aa[_0xcdfc('0x7')][_0x1e2282][_0xcdfc('0x19')]=![];return RpcVoiceAgentReport[_0xcdfc('0x1a')]({'acwtime':_0x1a8095},_0x3834aa['timers'][_0x1e2282][_0xcdfc('0x1b')],_0x1e2282)[_0xcdfc('0x1c')](function(_0x5ad601){logger[_0xcdfc('0x1d')](_0xcdfc('0x1e'),_0x5189bd,_0x1a8095,_0x5ad601);})[_0xcdfc('0x1f')](function(_0x179566){logger[_0xcdfc('0x20')](_0xcdfc('0x21'),_0x5189bd,_0x179566);})['finally'](function(){delete _0x3834aa[_0xcdfc('0x7')][_0x1e2282];});};Acw['prototype'][_0xcdfc('0x22')]=function(_0x23d000){try{var _0x2b7868=this;var _0x578f36=this['channels'][_0x23d000][_0xcdfc('0x23')];var _0x1949df=this[_0xcdfc('0x24')][_0x23d000][_0xcdfc('0x25')];var _0x2b9084=this[_0xcdfc('0x6')][_0x1949df];var _0x101ba0=![];var _0x3bdd7f=_0xcdfc('0x26');if(_0x2b9084[_0xcdfc('0x27')]&&_0x2b9084[_0xcdfc('0x28')]['name']){_0x101ba0=!![];_0x3bdd7f=_0x2b9084[_0xcdfc('0x28')]['name'];}if(!_0x2b7868[_0xcdfc('0x29')][_0x578f36]){return Promise[_0xcdfc('0x2a')]();}return RpcUser[_0xcdfc('0x2b')](_0x2b7868[_0xcdfc('0x29')][_0x578f36]['id'])[_0xcdfc('0x1c')](function(_0x180198){if(!_0x180198||_0x180198[_0xcdfc('0x2c')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x23d000,_0x578f36,_0x1949df);return;}logger[_0xcdfc('0x1d')](_0xcdfc('0x2d'),_0x23d000,_0x578f36,_0x1949df);var _0x1df906=_0x2b7868[_0xcdfc('0x24')][_0x23d000]['attended']&&_0x2b7868[_0xcdfc('0x24')][_0x23d000][_0xcdfc('0x2e')]?_0x2b7868['channels'][_0x23d000]['destlinkedid']:_0x23d000;return RpcUser[_0xcdfc('0x2f')](_0x2b7868[_0xcdfc('0x29')][_0x578f36],_0x3bdd7f,_0x1df906);})[_0xcdfc('0x1c')](function(_0x4b56c4){if(_0x101ba0||!_0x4b56c4){return;}_0x2b7868[_0xcdfc('0x7')][_0x578f36]={};logger[_0xcdfc('0x1d')](_0xcdfc('0x30'),_0x23d000,_0x2b7868[_0xcdfc('0x6')][_0x1949df]['acwTimeout'],_0x578f36,_0x1949df);_0x2b7868[_0xcdfc('0x7')][_0x578f36]['timer']=setTimeout(_0x2b7868['stopAcw'][_0xcdfc('0xa')](_0x2b7868,_0x578f36),_0x2b7868[_0xcdfc('0x6')][_0x1949df]['acwTimeout']*0x3e8);_0x2b7868['timers'][_0x578f36][_0xcdfc('0x18')]=moment()['format'](_0xcdfc('0x31'));_0x2b7868[_0xcdfc('0x7')][_0x578f36][_0xcdfc('0x1b')]=_0x23d000;_0x2b7868['timers'][_0x578f36][_0xcdfc('0x25')]=_0x1949df;_0x2b7868[_0xcdfc('0x7')][_0x578f36][_0xcdfc('0x17')]=_0x2b7868[_0xcdfc('0x17')][_0xcdfc('0xa')](_0x2b7868,_0x578f36,_0x23d000);})['catch'](function(){logger[_0xcdfc('0x20')](_0xcdfc('0x30'),_0x23d000,_0x2b7868[_0xcdfc('0x6')][_0x1949df][_0xcdfc('0x32')],_0x578f36,_0x1949df);})[_0xcdfc('0x33')](function(){delete _0x2b7868[_0xcdfc('0x24')][_0x23d000];});}catch(_0x22237e){logger[_0xcdfc('0x20')](_0xcdfc('0x34'),_0x22237e[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x36')]=function(_0x55a2a7){try{var _0x2f1b8a=this;if(_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7]){_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7][_0xcdfc('0x19')]=![];var _0x2ad049=_0x2f1b8a['timers'][_0x55a2a7][_0xcdfc('0x1b')];var _0x233a7a=_0x2f1b8a[_0xcdfc('0x7')][_0x55a2a7][_0xcdfc('0x25')];var _0x1d6d53=_0x2f1b8a['voiceQueues'][_0x233a7a][_0xcdfc('0x32')];logger[_0xcdfc('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x2ad049,_0x55a2a7);RpcUser[_0xcdfc('0x2b')](this[_0xcdfc('0x29')][_0x55a2a7]['id'])[_0xcdfc('0x1c')](function(_0x3cb50d){if(_0x3cb50d['pauseType']==='ACW'){return RpcUser['saveUnpause'](_0x2f1b8a[_0xcdfc('0x29')][_0x55a2a7]);}});RpcVoiceAgentReport[_0xcdfc('0x1a')]({'acwtime':_0x1d6d53,'agentacw':!![]},_0x2ad049,_0x55a2a7)['then'](function(_0x41982f){logger[_0xcdfc('0x1d')](_0xcdfc('0x1e'),_0x2ad049,_0x1d6d53,_0x41982f);})[_0xcdfc('0x1f')](function(_0x4f772d){logger[_0xcdfc('0x20')]('[%s][UPDATE][ERRORS:%s]',_0x2ad049,_0x4f772d);});}else{logger[_0xcdfc('0x20')](_0xcdfc('0x37'),_0x55a2a7);if(_0x2f1b8a[_0xcdfc('0x7')]){logger[_0xcdfc('0x1d')]('[ACW][TIMERS]',JSON[_0xcdfc('0x38')](_0x2f1b8a[_0xcdfc('0x7')]));}}}catch(_0x4b5c2b){logger['error'](_0xcdfc('0x39'),_0x4b5c2b[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')]['syncAgentConnect']=function(_0x602fc6){try{if(this[_0xcdfc('0x6')][_0x602fc6[_0xcdfc('0x25')]]&&(this[_0xcdfc('0x6')][_0x602fc6[_0xcdfc('0x25')]][_0xcdfc('0x3')]||this['voiceQueues'][_0x602fc6[_0xcdfc('0x25')]]['mandatoryDisposition'])){if(this[_0xcdfc('0x29')][_0x602fc6[_0xcdfc('0x23')]]){this['channels'][_0x602fc6['uniqueid']]={'queue':_0x602fc6[_0xcdfc('0x25')],'interface':_0x602fc6[_0xcdfc('0x23')],'destlinkedid':_0x602fc6[_0xcdfc('0x2e')]};}}}catch(_0x23095e){logger[_0xcdfc('0x20')](_0xcdfc('0x3a'),_0x23095e['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x13')]=function(_0x1bccc9){try{if(this[_0xcdfc('0x6')][_0x1bccc9[_0xcdfc('0x25')]]&&(this[_0xcdfc('0x6')][_0x1bccc9[_0xcdfc('0x25')]][_0xcdfc('0x3')]||this[_0xcdfc('0x6')][_0x1bccc9['queue']][_0xcdfc('0x27')])){if(this[_0xcdfc('0x29')][_0x1bccc9[_0xcdfc('0x23')]]){this['channels'][_0x1bccc9['uniqueid']]={'queue':_0x1bccc9[_0xcdfc('0x25')],'interface':_0x1bccc9['interface']};}}}catch(_0x70a97c){logger[_0xcdfc('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x70a97c['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x3b')]=function(_0x3f915f){try{if(this[_0xcdfc('0x24')][_0x3f915f[_0xcdfc('0x1b')]]&&_[_0xcdfc('0x3c')](this[_0xcdfc('0x24')][_0x3f915f['uniqueid']][_0xcdfc('0x3d')])){logger[_0xcdfc('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x3f915f[_0xcdfc('0x1b')]);this[_0xcdfc('0x22')](_0x3f915f[_0xcdfc('0x1b')]);}else if(this[_0xcdfc('0x24')][_0x3f915f[_0xcdfc('0x3e')]]&&_[_0xcdfc('0x3c')](this['channels'][_0x3f915f['linkedid']]['attended'])){logger[_0xcdfc('0x1d')]('[%s][HANGUP:LINKEDID]',_0x3f915f['linkedid']);this['startAcw'](_0x3f915f[_0xcdfc('0x3e')]);}}catch(_0x4c111b){logger[_0xcdfc('0x20')]('[ACW][syncHangupRequest]\x20%s',_0x4c111b[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')][_0xcdfc('0xc')]=function(_0x418efa){try{if(this[_0xcdfc('0x24')][_0x418efa[_0xcdfc('0x1b')]]&&this['channels'][_0x418efa[_0xcdfc('0x1b')]]['attended']){logger[_0xcdfc('0x1d')](_0xcdfc('0x3f'),_0x418efa['uniqueid']);this[_0xcdfc('0x22')](_0x418efa[_0xcdfc('0x1b')]);}else if(this[_0xcdfc('0x24')][_0x418efa['linkedid']]&&this[_0xcdfc('0x24')][_0x418efa[_0xcdfc('0x3e')]][_0xcdfc('0x3d')]){logger['info'](_0xcdfc('0x40'),_0x418efa[_0xcdfc('0x3e')]);this['startAcw'](_0x418efa[_0xcdfc('0x3e')]);}}catch(_0x488cea){logger[_0xcdfc('0x20')](_0xcdfc('0x41'),_0x488cea['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0x42')]=function(_0x32be7f){try{if(!_[_0xcdfc('0x43')](this[_0xcdfc('0x24')][_0x32be7f['transfereeuniqueid']])){this['startAcw'](_0x32be7f[_0xcdfc('0x44')]);if(this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x45')]]){this[_0xcdfc('0x24')][_0x32be7f['secondtransfereruniqueid']][_0xcdfc('0x3d')]=!![];this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x46')]]=this['channels'][_0x32be7f[_0xcdfc('0x45')]];delete this[_0xcdfc('0x24')][_0x32be7f['secondtransfereruniqueid']];}}else if(!_[_0xcdfc('0x43')](this[_0xcdfc('0x24')][_0x32be7f['transfertargetuniqueid']])){this['startAcw'](_0x32be7f[_0xcdfc('0x46')]);if(this['channels'][_0x32be7f[_0xcdfc('0x47')]]){this['channels'][_0x32be7f['origtransfereruniqueid']][_0xcdfc('0x3d')]=!![];this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x44')]]=this[_0xcdfc('0x24')][_0x32be7f[_0xcdfc('0x47')]];delete this[_0xcdfc('0x24')][_0x32be7f['origtransfereruniqueid']];}}}catch(_0xa06333){logger[_0xcdfc('0x20')]('[ACW][syncAttendedTransfer]\x20%s',_0xa06333[_0xcdfc('0x35')]);}};Acw[_0xcdfc('0x16')]['syncBlindTransfer']=function(_0x1a9928){try{if(this[_0xcdfc('0x24')][_0x1a9928[_0xcdfc('0x48')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x49'),JSON['stringify'](_0x1a9928['transfereruniqueid']));this[_0xcdfc('0x22')](_0x1a9928[_0xcdfc('0x48')]);}else if(this[_0xcdfc('0x24')][_0x1a9928[_0xcdfc('0x4a')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x4b'),JSON[_0xcdfc('0x38')](_0x1a9928['transfererlinkedid']));this[_0xcdfc('0x22')](_0x1a9928['transfererlinkedid']);}}catch(_0x368f44){logger[_0xcdfc('0x20')](_0xcdfc('0x4c'),_0x368f44['message']);}};Acw[_0xcdfc('0x16')][_0xcdfc('0xe')]=function(_0x19bfd9){try{if(this[_0xcdfc('0x6')][_0x19bfd9[_0xcdfc('0x25')]]&&this['voiceQueues'][_0x19bfd9['queue']]['autopause']==='all'){if(this[_0xcdfc('0x29')][_0x19bfd9[_0xcdfc('0x23')]]){logger[_0xcdfc('0x1d')](_0xcdfc('0x4d'),_0x19bfd9[_0xcdfc('0x1b')],_0x19bfd9[_0xcdfc('0x23')],_0x19bfd9[_0xcdfc('0x25')]);return RpcUser[_0xcdfc('0x2f')](this[_0xcdfc('0x29')][_0x19bfd9[_0xcdfc('0x23')]],_0xcdfc('0x4e'),_0x19bfd9[_0xcdfc('0x1b')]);}}}catch(_0x1850f6){logger[_0xcdfc('0x20')](_0xcdfc('0x4f'),_0x1850f6[_0xcdfc('0x35')]);}};module[_0xcdfc('0x50')]=Acw; \ No newline at end of file +var _0x01d3=['ACW','mandatoryDisposition','name','mandatoryDispositionPause','resolve','getAgent','voicePause','attended','destlinkedid','savePause','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','queue','catch','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface'];(function(_0x3c2e27,_0x1f0b8c){var _0x3fc1e3=function(_0x5bc3da){while(--_0x5bc3da){_0x3c2e27['push'](_0x3c2e27['shift']());}};_0x3fc1e3(++_0x1f0b8c);}(_0x01d3,0xdb));var _0x301d=function(_0x28a418,_0x287ef9){_0x28a418=_0x28a418-0x0;var _0x13fed9=_0x01d3[_0x28a418];return _0x13fed9;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0x301d('0x0'));var logger=require(_0x301d('0x1'))(_0x301d('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x301d('0x3'));function Acw(_0x27dc62){this[_0x301d('0x4')]=_0x27dc62[_0x301d('0x4')];this[_0x301d('0x5')]=_0x27dc62['agents'];this[_0x301d('0x6')]=_0x27dc62[_0x301d('0x6')];this[_0x301d('0x7')]={};ami['on'](_0x301d('0x8'),this[_0x301d('0x9')]['bind'](this));ami['on'](_0x301d('0xa'),this[_0x301d('0xb')][_0x301d('0xc')](this));ami['on'](_0x301d('0xd'),this[_0x301d('0xe')][_0x301d('0xc')](this));ami['on'](_0x301d('0xf'),this[_0x301d('0x10')][_0x301d('0xc')](this));ami['on']('attendedtransfer',this[_0x301d('0x11')][_0x301d('0xc')](this));ami['on']('blindtransfer',this[_0x301d('0x12')][_0x301d('0xc')](this));ami['on'](_0x301d('0x13'),this[_0x301d('0x14')]['bind'](this));}function getDiff(_0x175871){var _0x3218dc=moment()[_0x301d('0x15')](0x0);var _0x377c7f=moment(_0x175871)[_0x301d('0x15')](0x0);return _0x3218dc[_0x301d('0x16')](_0x377c7f,_0x301d('0x17'));}Acw['prototype'][_0x301d('0x18')]=function(_0xc35239,_0x4fd833){var _0x10d277=this;var _0x223c48=getDiff(_0x10d277[_0x301d('0x6')][_0xc35239][_0x301d('0x19')]);clearTimeout(_0x10d277[_0x301d('0x6')][_0xc35239][_0x301d('0x1a')]);_0x10d277[_0x301d('0x6')][_0xc35239][_0x301d('0x1a')]=![];return RpcVoiceAgentReport[_0x301d('0x1b')]({'acwtime':_0x223c48},_0x10d277[_0x301d('0x6')][_0xc35239][_0x301d('0x1c')],_0xc35239)[_0x301d('0x1d')](function(_0x5ac7f1){logger[_0x301d('0x1e')](_0x301d('0x1f'),_0x4fd833,_0x223c48,_0x5ac7f1);})['catch'](function(_0x51d0a5){logger['error'](_0x301d('0x20'),_0x4fd833,_0x51d0a5);})[_0x301d('0x21')](function(){delete _0x10d277[_0x301d('0x6')][_0xc35239];});};Acw['prototype'][_0x301d('0x22')]=function(_0x312ed6){try{var _0x5b6631=this;var _0x485f96=this[_0x301d('0x7')][_0x312ed6][_0x301d('0x23')];var _0x355d5c=this[_0x301d('0x7')][_0x312ed6]['queue'];var _0x1119da=this[_0x301d('0x4')][_0x355d5c];var _0x10dd5a=![];var _0x3a7484=_0x301d('0x24');if(_0x1119da[_0x301d('0x25')]&&_0x1119da['mandatoryDispositionPause'][_0x301d('0x26')]){_0x10dd5a=!![];_0x3a7484=_0x1119da[_0x301d('0x27')][_0x301d('0x26')];}if(!_0x5b6631[_0x301d('0x5')][_0x485f96]){return Promise[_0x301d('0x28')]();}return RpcUser[_0x301d('0x29')](_0x5b6631[_0x301d('0x5')][_0x485f96]['id'])[_0x301d('0x1d')](function(_0x5d05db){if(!_0x5d05db||_0x5d05db[_0x301d('0x2a')]){logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x312ed6,_0x485f96,_0x355d5c);return;}logger[_0x301d('0x1e')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x312ed6,_0x485f96,_0x355d5c);var _0x326722=_0x5b6631[_0x301d('0x7')][_0x312ed6][_0x301d('0x2b')]&&_0x5b6631[_0x301d('0x7')][_0x312ed6][_0x301d('0x2c')]?_0x5b6631['channels'][_0x312ed6][_0x301d('0x2c')]:_0x312ed6;return RpcUser[_0x301d('0x2d')](_0x5b6631[_0x301d('0x5')][_0x485f96],_0x3a7484,_0x326722);})[_0x301d('0x1d')](function(_0x4a8356){if(_0x10dd5a||!_0x4a8356){return;}_0x5b6631['timers'][_0x485f96]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x312ed6,_0x5b6631[_0x301d('0x4')][_0x355d5c][_0x301d('0x2e')],_0x485f96,_0x355d5c);_0x5b6631[_0x301d('0x6')][_0x485f96][_0x301d('0x1a')]=setTimeout(_0x5b6631[_0x301d('0x2f')][_0x301d('0xc')](_0x5b6631,_0x485f96),_0x5b6631[_0x301d('0x4')][_0x355d5c][_0x301d('0x2e')]*0x3e8);_0x5b6631[_0x301d('0x6')][_0x485f96][_0x301d('0x19')]=moment()['format'](_0x301d('0x30'));_0x5b6631[_0x301d('0x6')][_0x485f96][_0x301d('0x1c')]=_0x312ed6;_0x5b6631[_0x301d('0x6')][_0x485f96][_0x301d('0x31')]=_0x355d5c;_0x5b6631[_0x301d('0x6')][_0x485f96][_0x301d('0x18')]=_0x5b6631[_0x301d('0x18')][_0x301d('0xc')](_0x5b6631,_0x485f96,_0x312ed6);})[_0x301d('0x32')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x312ed6,_0x5b6631[_0x301d('0x4')][_0x355d5c][_0x301d('0x2e')],_0x485f96,_0x355d5c);})[_0x301d('0x21')](function(){delete _0x5b6631[_0x301d('0x7')][_0x312ed6];});}catch(_0x362e53){logger['error'](_0x301d('0x33'),_0x362e53[_0x301d('0x34')]);}};Acw[_0x301d('0x35')]['stopAcw']=function(_0x3fa06f){try{var _0x4b5acd=this;if(_0x4b5acd[_0x301d('0x6')][_0x3fa06f]){_0x4b5acd[_0x301d('0x6')][_0x3fa06f][_0x301d('0x1a')]=![];var _0x8b9544=_0x4b5acd[_0x301d('0x6')][_0x3fa06f][_0x301d('0x1c')];var _0x32035b=_0x4b5acd[_0x301d('0x6')][_0x3fa06f]['queue'];var _0x114daa=_0x4b5acd[_0x301d('0x4')][_0x32035b][_0x301d('0x2e')];logger[_0x301d('0x1e')](_0x301d('0x36'),_0x8b9544,_0x3fa06f);RpcUser['getAgent'](this['agents'][_0x3fa06f]['id'])['then'](function(_0x26bd3b){if(_0x26bd3b['pauseType']===_0x301d('0x24')){return RpcUser[_0x301d('0x37')](_0x4b5acd[_0x301d('0x5')][_0x3fa06f]);}});RpcVoiceAgentReport[_0x301d('0x1b')]({'acwtime':_0x114daa,'agentacw':!![]},_0x8b9544,_0x3fa06f)[_0x301d('0x1d')](function(_0x5ee9cc){logger[_0x301d('0x1e')]('[%s][UPDATE][ACWTIME:%s]',_0x8b9544,_0x114daa,_0x5ee9cc);})['catch'](function(_0x3329f8){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x8b9544,_0x3329f8);});}else{logger[_0x301d('0x38')](_0x301d('0x39'),_0x3fa06f);if(_0x4b5acd[_0x301d('0x6')]){logger[_0x301d('0x1e')](_0x301d('0x3a'),JSON[_0x301d('0x3b')](_0x4b5acd['timers']));}}}catch(_0x16a7ca){logger[_0x301d('0x38')](_0x301d('0x3c'),_0x16a7ca[_0x301d('0x34')]);}};Acw[_0x301d('0x35')][_0x301d('0x9')]=function(_0x235586){try{if(this['voiceQueues'][_0x235586[_0x301d('0x31')]]&&(this['voiceQueues'][_0x235586['queue']][_0x301d('0x2')]||this[_0x301d('0x4')][_0x235586['queue']][_0x301d('0x25')])){if(this[_0x301d('0x5')][_0x235586['interface']]){this['channels'][_0x235586[_0x301d('0x1c')]]={'queue':_0x235586[_0x301d('0x31')],'interface':_0x235586[_0x301d('0x23')],'destlinkedid':_0x235586['destlinkedid']};}}}catch(_0x5acb46){logger[_0x301d('0x38')](_0x301d('0x3d'),_0x5acb46[_0x301d('0x34')]);}};Acw[_0x301d('0x35')][_0x301d('0x14')]=function(_0x5dcd35){try{if(this[_0x301d('0x4')][_0x5dcd35[_0x301d('0x31')]]&&(this[_0x301d('0x4')][_0x5dcd35['queue']][_0x301d('0x2')]||this[_0x301d('0x4')][_0x5dcd35[_0x301d('0x31')]][_0x301d('0x25')])){if(this['agents'][_0x5dcd35[_0x301d('0x23')]]){this['channels'][_0x5dcd35[_0x301d('0x1c')]]={'queue':_0x5dcd35['queue'],'interface':_0x5dcd35[_0x301d('0x23')]};}}}catch(_0x3662ce){logger[_0x301d('0x38')](_0x301d('0x3e'),_0x3662ce[_0x301d('0x34')]);}};Acw[_0x301d('0x35')][_0x301d('0xb')]=function(_0x2751da){try{if(this[_0x301d('0x7')][_0x2751da['uniqueid']]&&_[_0x301d('0x3f')](this[_0x301d('0x7')][_0x2751da[_0x301d('0x1c')]][_0x301d('0x2b')])){logger['info'](_0x301d('0x40'),_0x2751da['uniqueid']);this['startAcw'](_0x2751da['uniqueid']);}else if(this[_0x301d('0x7')][_0x2751da['linkedid']]&&_['isUndefined'](this[_0x301d('0x7')][_0x2751da[_0x301d('0x41')]][_0x301d('0x2b')])){logger[_0x301d('0x1e')](_0x301d('0x42'),_0x2751da[_0x301d('0x41')]);this[_0x301d('0x22')](_0x2751da[_0x301d('0x41')]);}}catch(_0x46c232){logger[_0x301d('0x38')](_0x301d('0x43'),_0x46c232[_0x301d('0x34')]);}};Acw[_0x301d('0x35')][_0x301d('0xe')]=function(_0xd3206a){try{if(this[_0x301d('0x7')][_0xd3206a[_0x301d('0x1c')]]&&this[_0x301d('0x7')][_0xd3206a['uniqueid']][_0x301d('0x2b')]){logger[_0x301d('0x1e')](_0x301d('0x44'),_0xd3206a[_0x301d('0x1c')]);this[_0x301d('0x22')](_0xd3206a[_0x301d('0x1c')]);}else if(this[_0x301d('0x7')][_0xd3206a['linkedid']]&&this[_0x301d('0x7')][_0xd3206a[_0x301d('0x41')]]['attended']){logger[_0x301d('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xd3206a['linkedid']);this['startAcw'](_0xd3206a[_0x301d('0x41')]);}}catch(_0x362d87){logger[_0x301d('0x38')]('[ACW][syncHangup]\x20%s',_0x362d87[_0x301d('0x34')]);}};Acw['prototype'][_0x301d('0x11')]=function(_0x39c5c8){try{if(!_[_0x301d('0x45')](this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x46')]])){this[_0x301d('0x22')](_0x39c5c8['transfereeuniqueid']);if(this[_0x301d('0x7')][_0x39c5c8['secondtransfereruniqueid']]){this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x47')]][_0x301d('0x2b')]=!![];this['channels'][_0x39c5c8['transfertargetuniqueid']]=this['channels'][_0x39c5c8[_0x301d('0x47')]];delete this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x47')]];}}else if(!_['isNil'](this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x48')]])){this[_0x301d('0x22')](_0x39c5c8[_0x301d('0x48')]);if(this['channels'][_0x39c5c8[_0x301d('0x49')]]){this['channels'][_0x39c5c8[_0x301d('0x49')]][_0x301d('0x2b')]=!![];this[_0x301d('0x7')][_0x39c5c8['transfereeuniqueid']]=this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x49')]];delete this[_0x301d('0x7')][_0x39c5c8[_0x301d('0x49')]];}}}catch(_0x5c39f7){logger[_0x301d('0x38')](_0x301d('0x4a'),_0x5c39f7[_0x301d('0x34')]);}};Acw[_0x301d('0x35')][_0x301d('0x12')]=function(_0x459032){try{if(this['channels'][_0x459032[_0x301d('0x4b')]]){logger[_0x301d('0x1e')](_0x301d('0x4c'),JSON['stringify'](_0x459032['transfereruniqueid']));this['startAcw'](_0x459032[_0x301d('0x4b')]);}else if(this[_0x301d('0x7')][_0x459032[_0x301d('0x4d')]]){logger[_0x301d('0x1e')](_0x301d('0x4e'),JSON[_0x301d('0x3b')](_0x459032['transfererlinkedid']));this['startAcw'](_0x459032[_0x301d('0x4d')]);}}catch(_0xd9ea83){logger[_0x301d('0x38')](_0x301d('0x4f'),_0xd9ea83[_0x301d('0x34')]);}};Acw['prototype'][_0x301d('0x10')]=function(_0x4e8423){try{if(this[_0x301d('0x4')][_0x4e8423['queue']]&&this[_0x301d('0x4')][_0x4e8423['queue']][_0x301d('0x50')]==='all'){if(this['agents'][_0x4e8423[_0x301d('0x23')]]){logger['info'](_0x301d('0x51'),_0x4e8423[_0x301d('0x1c')],_0x4e8423[_0x301d('0x23')],_0x4e8423[_0x301d('0x31')]);return RpcUser[_0x301d('0x2d')](this[_0x301d('0x5')][_0x4e8423['interface']],_0x301d('0x52'),_0x4e8423[_0x301d('0x1c')]);}}}catch(_0x22d091){logger[_0x301d('0x38')](_0x301d('0x53'),_0x22d091[_0x301d('0x34')]);}};module[_0x301d('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9700f59..cf20bbd 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 _0xbf1f=['bluebird','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','[ami.js][fullybooted]','close','asterisk-manager'];(function(_0x327950,_0x1d741f){var _0x225835=function(_0x2b0cff){while(--_0x2b0cff){_0x327950['push'](_0x327950['shift']());}};_0x225835(++_0x1d741f);}(_0xbf1f,0x1ed));var _0xfbf1=function(_0x3f993e,_0x2d5757){_0x3f993e=_0x3f993e-0x0;var _0x39c135=_0xbf1f[_0x3f993e];return _0x39c135;};'use strict';var Manager=require(_0xfbf1('0x0'));var BPromise=require(_0xfbf1('0x1'));var util=require(_0xfbf1('0x2'));var logger=require(_0xfbf1('0x3'))(_0xfbf1('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0xfbf1('0x5')]['port'],config[_0xfbf1('0x5')]['ip'],config['asterisk'][_0xfbf1('0x6')],config[_0xfbf1('0x5')][_0xfbf1('0x7')],!![]);ami[_0xfbf1('0x8')]();ami[_0xfbf1('0x9')]=BPromise[_0xfbf1('0xa')](ami[_0xfbf1('0xb')]);function error(_0x4a41bc){logger[_0xfbf1('0xc')](util[_0xfbf1('0xd')](_0xfbf1('0xe'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')],util[_0xfbf1('0x10')](_0x4a41bc,![],null)));}function close(){logger['error'](util[_0xfbf1('0xd')](_0xfbf1('0x11'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config['asterisk'][_0xfbf1('0xf')]));}ami[_0xfbf1('0x12')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xfbf1('0x13')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x14')});};};ami[_0xfbf1('0x15')]=function(){return function(){return ami['Action']({'action':_0xfbf1('0x16')});};};ami[_0xfbf1('0x17')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x18')});};};ami[_0xfbf1('0x19')]=function(){return function(){return ami[_0xfbf1('0x9')]({'action':_0xfbf1('0x1a')});};};function connect(){logger[_0xfbf1('0x1b')](util[_0xfbf1('0xd')](_0xfbf1('0x1c'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')]));ami[_0xfbf1('0x1d')]('error',error);ami[_0xfbf1('0x1d')]('close',close);}ami['on']('connect',connect);ami['on'](_0xfbf1('0x1e'),function(_0x136c62){logger[_0xfbf1('0x1b')](util[_0xfbf1('0xd')](_0xfbf1('0x1f'),config[_0xfbf1('0x5')][_0xfbf1('0x6')],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')],util[_0xfbf1('0x10')](_0x136c62,![],null)));});ami['on'](_0xfbf1('0x20'),function(){logger[_0xfbf1('0x1b')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xfbf1('0x5')]['username'],config[_0xfbf1('0x5')]['ip'],config[_0xfbf1('0x5')][_0xfbf1('0xf')]));return Promise[_0xfbf1('0x21')]()[_0xfbf1('0x22')](ami[_0xfbf1('0x12')]())[_0xfbf1('0x22')](ami[_0xfbf1('0x13')]())[_0xfbf1('0x22')](ami[_0xfbf1('0x15')]())[_0xfbf1('0x22')](ami['actionQueueSummary']())[_0xfbf1('0x22')](ami[_0xfbf1('0x19')]())[_0xfbf1('0x23')](function(_0x3c16e5){logger[_0xfbf1('0xc')](_0xfbf1('0x24'),util['inspect'](_0x3c16e5,{'showHidden':![],'depth':null}));});});ami[_0xfbf1('0x1d')](_0xfbf1('0xc'),error);ami[_0xfbf1('0x1d')](_0xfbf1('0x25'),close);module['exports']=ami; \ No newline at end of file +var _0x21f7=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','bluebird','../../config/logger','asterisk','port','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x21f7,0x86));var _0x721f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x21f7[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x721f('0x0'));var util=require('util');var logger=require(_0x721f('0x1'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x721f('0x2')][_0x721f('0x3')],config[_0x721f('0x2')]['ip'],config[_0x721f('0x2')]['username'],config[_0x721f('0x2')][_0x721f('0x4')],!![]);ami[_0x721f('0x5')]();ami[_0x721f('0x6')]=BPromise[_0x721f('0x7')](ami[_0x721f('0x8')]);function error(_0x546b46){logger[_0x721f('0x9')](util[_0x721f('0xa')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x721f('0x2')]['username'],config[_0x721f('0x2')]['ip'],config[_0x721f('0x2')][_0x721f('0x3')],util['inspect'](_0x546b46,![],null)));}function close(){logger['error'](util[_0x721f('0xa')](_0x721f('0xb'),config[_0x721f('0x2')][_0x721f('0xc')],config['asterisk']['ip'],config[_0x721f('0x2')][_0x721f('0x3')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x721f('0x6')]({'action':_0x721f('0xd')});};};ami[_0x721f('0xe')]=function(){return function(){return ami['Action']({'action':_0x721f('0xf')});};};ami[_0x721f('0x10')]=function(){return function(){return ami[_0x721f('0x6')]({'action':_0x721f('0x11')});};};ami[_0x721f('0x12')]=function(){return function(){return ami[_0x721f('0x6')]({'action':'queuesummary'});};};ami[_0x721f('0x13')]=function(){return function(){return ami[_0x721f('0x6')]({'action':'coreshowchannels'});};};function connect(){logger[_0x721f('0x14')](util[_0x721f('0xa')](_0x721f('0x15'),config['asterisk'][_0x721f('0xc')],config[_0x721f('0x2')]['ip'],config[_0x721f('0x2')][_0x721f('0x3')]));ami['once'](_0x721f('0x9'),error);ami[_0x721f('0x16')](_0x721f('0x17'),close);}ami['on']('connect',connect);ami['on'](_0x721f('0x18'),function(_0x23dde9){logger[_0x721f('0x14')](util[_0x721f('0xa')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x721f('0x2')][_0x721f('0xc')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x721f('0x19')](_0x23dde9,![],null)));});ami['on']('fullybooted',function(){logger[_0x721f('0x14')](util['format'](_0x721f('0x1a'),config['asterisk'][_0x721f('0xc')],config[_0x721f('0x2')]['ip'],config[_0x721f('0x2')]['port']));return Promise['resolve']()[_0x721f('0x1b')](ami[_0x721f('0x1c')]())['then'](ami[_0x721f('0xe')]())[_0x721f('0x1b')](ami[_0x721f('0x10')]())[_0x721f('0x1b')](ami['actionQueueSummary']())['then'](ami[_0x721f('0x13')]())[_0x721f('0x1d')](function(_0xb5938d){logger[_0x721f('0x9')](_0x721f('0x1e'),util[_0x721f('0x19')](_0xb5938d,{'showHidden':![],'depth':null}));});});ami['once'](_0x721f('0x9'),error);ami[_0x721f('0x16')](_0x721f('0x17'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6c5e827..b817409 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae24a,_0x7d32f9){_0x3ae24a=_0x3ae24a-0x0;var _0x18690f=_0xe706[_0x3ae24a];return _0x18690f;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xe706,0xa3));var _0x6e70=function(_0x388da2,_0x571cad){_0x388da2=_0x388da2-0x0;var _0x2b1a45=_0xe706[_0x388da2];return _0x2b1a45;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 809d15e..9051de5 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 _0xe0e1=['isOutboundQueue','\x22%s,%s%s,,,%s\x22','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','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','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','dropRate','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','erlangCallToSecond','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','lodash','uuid','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/final','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','debug','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','iftime\x20%s,%s','timezones','content','indexOf','push','Action','true','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','launchHandleIvr','dialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','dropreason','countglobal','dialDropRetryFrequency','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedMaxRetry','ContactId','ListId','VoiceQueueId','createHistory','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','rrmemory','roundrobin','actionid','isNil','agents','stateinterface','locked','idHopper','paused','preview','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','pick','contactAgent-idHopper:\x20','run','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','responsetime','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','AMD','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','reason19\x20machine....','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','[syncHangupIvr]','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','checkDialMethod','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','getVoiceQueueRtPauses','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x57ea02,_0x5cedee){var _0x3172cd=function(_0x37ac1d){while(--_0x37ac1d){_0x57ea02['push'](_0x57ea02['shift']());}};_0x3172cd(++_0x5cedee);}(_0xe0e1,0xbf));var _0x1e0e=function(_0x132ca8,_0x574511){_0x132ca8=_0x132ca8-0x0;var _0x2e7e6a=_0xe0e1[_0x132ca8];return _0x2e7e6a;};'use strict';var util=require('util');var _=require(_0x1e0e('0x0'));var uuid=require(_0x1e0e('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x1e0e('0x2'));var hopperUtils=require(_0x1e0e('0x3'));var ut=require(_0x1e0e('0x4'));var config=require('../../../config/environment/');var logger=require(_0x1e0e('0x5'))(_0x1e0e('0x6'));var loggerBooked=require(_0x1e0e('0x5'))(_0x1e0e('0x7'));var loggerPredictive=require(_0x1e0e('0x5'))(_0x1e0e('0x8'));var loggerPredictiveCalls=require(_0x1e0e('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x1e0e('0x5'))(_0x1e0e('0x9'));var ami=require(_0x1e0e('0xa'));config['redis']=_[_0x1e0e('0xb')](config[_0x1e0e('0xc')],{'host':_0x1e0e('0xd'),'port':0x18eb});var io=require(_0x1e0e('0xe'))(new Redis(config[_0x1e0e('0xc')]));var cmHopper=require(_0x1e0e('0xf'));var voiceQueueRt=require(_0x1e0e('0x10'));var RpcSetting=require(_0x1e0e('0x11'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x1e0e('0x12'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x1e0e('0x13'));var Hangup=require(_0x1e0e('0x14'));var ipAgi=process['env'][_0x1e0e('0x15')]||_0x1e0e('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1e0e('0x17')][_0x1e0e('0x18')]=function(_0x4769a6){this[_0x1e0e('0x19')]=this[_0x1e0e('0x19')]?this[_0x1e0e('0x19')][_0x1e0e('0x1a')](_0x4769a6):_0x4769a6();};function Dialer(_0x1a9ea,_0x6dbafc){this[_0x1e0e('0x1b')]=new Sequence();this['preview']=_0x6dbafc;this[_0x1e0e('0x1c')]=_0x1a9ea['voiceQueues'];this['campaigns']=_0x1a9ea[_0x1e0e('0x1d')];this['agents']=_0x1a9ea['agents'];this[_0x1e0e('0x1e')]=_0x1a9ea[_0x1e0e('0x1e')];this['maxNumberOriginate']=config[_0x1e0e('0x1f')]||0x2;this[_0x1e0e('0x20')]={};this[_0x1e0e('0x21')]={};this[_0x1e0e('0x22')]={};this['uniqueId']={};this[_0x1e0e('0x23')]={};this[_0x1e0e('0x24')]={};this[_0x1e0e('0x25')]={};this[_0x1e0e('0x26')]={};this[_0x1e0e('0x27')]={};this['queueBookedRR']={};this[_0x1e0e('0x28')]={};ami['on']('agentconnect',this[_0x1e0e('0x29')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x2b'),this[_0x1e0e('0x2c')]['bind'](this));ami['on'](_0x1e0e('0x2d'),this[_0x1e0e('0x2e')]['bind'](this));ami['on']('agentcomplete',this[_0x1e0e('0x2f')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x30'),this[_0x1e0e('0x9')]['bind'](this));ami['on'](_0x1e0e('0x31'),this[_0x1e0e('0x32')][_0x1e0e('0x2a')](this));ami['on']('hangup',this[_0x1e0e('0x33')]['bind'](this));ami['on'](_0x1e0e('0x34'),this[_0x1e0e('0x35')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x36'),this[_0x1e0e('0x37')][_0x1e0e('0x2a')](this));ami['on']('queuemember',this[_0x1e0e('0x38')][_0x1e0e('0x2a')](this));ami['on'](_0x1e0e('0x39'),this[_0x1e0e('0x3a')][_0x1e0e('0x2a')](this));this[_0x1e0e('0x3b')]();this[_0x1e0e('0x3c')]();RpcSetting[_0x1e0e('0x3d')]()[_0x1e0e('0x3e')](function(_0x314bc6){previewRecallmeReminderInterval=_0x314bc6[_0x1e0e('0x3f')];});}function isNotNull(_0x1e95fb){return _0x1e95fb!==null&&!_['isUndefined'](_0x1e95fb);}function msgResponse(_0x157402,_0x235dd4,_0x451674){return{'action':_0x157402,'response':_0x235dd4,'message':_0x451674,'stack':_0x451674};}function emit(_0x41a406,_0x2490ea,_0x24810b){io['to'](_0x41a406)[_0x1e0e('0x40')](_0x2490ea,_0x24810b);}function emitOutboundVoiceQueueSummary(_0xeb263d){if(_0xeb263d[_0x1e0e('0x41')]===_0x1e0e('0x42')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util['inspect'](_0xeb263d,{'showHidden':![],'depth':null}));emit(util[_0x1e0e('0x43')](_0x1e0e('0x44'),_0xeb263d[_0x1e0e('0x45')]),_0x1e0e('0x46'),_0xeb263d);}}function checkGetDataPredictive(_0x1b19f1){if(isNotNull(_0x1b19f1)&&!_['isEmpty'](_0x1b19f1)){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x48'));loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x49'),_0x1b19f1['predictiveIntervalTotalCalls']);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x4a'),_0x1b19f1[_0x1e0e('0x4b')]);loggerPredictive[_0x1e0e('0x47')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b19f1[_0x1e0e('0x4c')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x4d'),_0x1b19f1[_0x1e0e('0x4e')]);loggerPredictive['info'](_0x1e0e('0x4f'),_0x1b19f1[_0x1e0e('0x50')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1b19f1[_0x1e0e('0x51')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));if(_0x1b19f1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x1e0e('0x53')](_0x1b19f1['predictiveIntervalAvgTalktime'])&&_0x1b19f1[_0x1e0e('0x51')]>0x0){return!![];}loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x54'));if(!_['isUndefined'](_0x1b19f1[_0x1e0e('0x50')])&&_0x1b19f1[_0x1e0e('0x50')]>0x0){return!![];}loggerPredictive['info'](_0x1e0e('0x55'));}else{loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x56'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5c3083){return function(_0x28cdad){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x57'));loggerPredictive[_0x1e0e('0x47')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x58')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad['erlangCallToSecond']);loggerPredictive['info'](_0x1e0e('0x59'),_0x28cdad[_0x1e0e('0x5a')]);loggerPredictive[_0x1e0e('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x5b')]);loggerPredictive[_0x1e0e('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28cdad[_0x1e0e('0x5a')]);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));_[_0x1e0e('0x5c')](_0x5c3083,_0x28cdad);};}function ifInterval(_0x47e587,_0x228d59){if(_[_0x1e0e('0x53')](_0x228d59)){return![];}return utils['getSeconds'](undefined,_0x228d59)<_0x47e587*0x3c;}function clearPredictiveAttributes(_0x23be91){if(_0x23be91['startProgressive']){_0x23be91[_0x1e0e('0x25')]=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x5e'));}if(_0x23be91[_0x1e0e('0x24')]){_0x23be91[_0x1e0e('0x24')]=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x5f'));}if(_0x23be91['handlePredictive']){clearInterval(_0x23be91[_0x1e0e('0x60')]);_0x23be91['handlePredictive']=undefined;loggerPredictive[_0x1e0e('0x5d')](_0x23be91[_0x1e0e('0x45')],_0x1e0e('0x61'));}}function loggerCatchPredictive(_0x4441de,_0x509a9b){return function(_0x2f197d){loggerPredictive[_0x1e0e('0x62')](_0x509a9b[_0x1e0e('0x45')],_0x4441de);loggerPredictive['error'](_0x2f197d[_0x1e0e('0x63')]);clearPredictiveAttributes(_0x509a9b);};}function loggerCatch(_0x2bb1ef){return function(_0x4dfcde){logger[_0x1e0e('0x62')](_0x2bb1ef,util[_0x1e0e('0x64')](_0x4dfcde,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4b5e61,_0x2fb4ad,_0x5ae4d0){return function(_0x35e5fe){utils[_0x1e0e('0x65')](_0x2fb4ad,_0x5ae4d0,0x0);_0x2fb4ad[_0x1e0e('0x66')]=0x0;logger[_0x1e0e('0x62')](_0x4b5e61,util[_0x1e0e('0x64')](_0x35e5fe,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x162ab9){return function(_0x1b249d){if(isNotNull(_0x1b249d)&&isNotNull(_0x1b249d[0x0])){if(_0x1b249d[0x0][_0x1e0e('0x67')]>0x0){_0x162ab9['message']=utils[_0x1e0e('0x68')][_0x1e0e('0x69')];logger[_0x1e0e('0x47')](_0x1e0e('0x6a')+_0x162ab9[_0x1e0e('0x45')],_0x1b249d[0x0][_0x1e0e('0x67')],_0x1e0e('0x6b'));}else{_0x162ab9[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x6d')];logger[_0x1e0e('0x47')](_0x1e0e('0x6e')+_0x162ab9[_0x1e0e('0x45')]);}}};}function createObjHistory(_0xee56fc,_0x572c4f,_0x439da3,_0x5d11ba,_0x4ddc5c){_0xee56fc[_0x1e0e('0x6c')]=_0x439da3;var _0xa31547=new Action(_0xee56fc,_0x572c4f);var _0x2c65f7=new History(_0xa31547);_0x2c65f7[_0x1e0e('0x6f')]=_0x5d11ba;_0x2c65f7['statedesc']=_0x4ddc5c;_0x2c65f7[_0x1e0e('0x70')]=_0xa31547[_0x1e0e('0x71')];return _0x2c65f7;}function unlockQueueStatus(_0x4a7d5d,_0x5c7472){setTimeout(function(){if(_['isUndefined'](_0x4a7d5d[_0x1e0e('0x72')])){loggerBooked[_0x1e0e('0x62')](_0x1e0e('0x73'),_0x5c7472);}_0x4a7d5d['queueStatusComplete']=!![];loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x74'),_0x5c7472,JSON[_0x1e0e('0x75')](_['pick'](_0x4a7d5d,[_0x1e0e('0x45'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x4bc3c2){return function(){if(!isNotNull(_0x4bc3c2[_0x1e0e('0x76')])){_0x4bc3c2[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x77')];throw _0x4bc3c2['name']+_0x1e0e('0x78');}if(!isNotNull(_0x4bc3c2[_0x1e0e('0x76')]['Intervals'])){_0x4bc3c2[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x77')];throw _0x4bc3c2[_0x1e0e('0x45')]+_0x1e0e('0x78');}if(!isNotNull(_[_0x1e0e('0x79')](_0x4bc3c2[_0x1e0e('0x76')][_0x1e0e('0x7a')]))){_0x4bc3c2[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4bc3c2[_0x1e0e('0x45')]+_0x1e0e('0x78');}};}function checkIsIVRCampaignActive(_0x517e49){return function(){if(!utils['isIVRCampaignActive'](_0x517e49)){_0x517e49[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x7b')];throw _0x517e49[_0x1e0e('0x45')]+_0x1e0e('0x7c');}};}function emitCampaignSummary(_0x11cc9b){if(utils[_0x1e0e('0x7d')](_0x11cc9b)){emit(util[_0x1e0e('0x43')](_0x1e0e('0x7e'),_0x11cc9b[_0x1e0e('0x45')]),_0x1e0e('0x7f'),_0x11cc9b);}}function loggerCatchQueueSummary(_0x3a7500,_0x10c18d){return function(_0x397848){clearPredictiveAttributes(_0x10c18d);emitCampaignSummary(_0x10c18d);loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x3a7500,util[_0x1e0e('0x64')](_0x397848,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x5d8b52){if(_0x5d8b52['sendMessageOneNotActive']){if(_0x5d8b52[_0x1e0e('0x80')]===0x0){_0x5d8b52[_0x1e0e('0x81')]=![];_0x5d8b52[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x7b')];loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x1e0e('0x82'),_0x5d8b52['name'],_0x1e0e('0x83'));}else{_0x5d8b52[_0x1e0e('0x6c')]=utils['CAMPAIGN_STATUS'][_0x1e0e('0x84')];loggerSyncQueueSummary[_0x1e0e('0x5d')](_0x1e0e('0x82'),_0x5d8b52[_0x1e0e('0x45')],_0x1e0e('0x85'));}emitCampaignSummary(_0x5d8b52);}}function myreject(_0x183e88){return function(_0x261277){return _0x183e88(msgResponse(_0x1e0e('0x86'),_0x1e0e('0x87'),JSON[_0x1e0e('0x75')](_0x261277)));};}Dialer[_0x1e0e('0x17')][_0x1e0e('0x88')]=function(_0x19daa8){return!_['isUndefined'](_0x19daa8)&&_0x19daa8&&!_[_0x1e0e('0x53')](_0x19daa8[_0x1e0e('0x45')])&&!_[_0x1e0e('0x53')](_0x19daa8[_0x1e0e('0x89')])&&_0x19daa8['active']&&(this['trunks'][util[_0x1e0e('0x43')](_0x1e0e('0x8a'),_0x19daa8['name'])]['status']===_0x1e0e('0x8b')||this['trunks'][util[_0x1e0e('0x43')]('SIP/%s',_0x19daa8[_0x1e0e('0x45')])][_0x1e0e('0x8c')]===_0x1e0e('0x8d'));};Dialer[_0x1e0e('0x17')][_0x1e0e('0x8e')]=function(_0x53f1b7){var _0x3af246=this;return function(){if(!_0x3af246[_0x1e0e('0x88')](_0x53f1b7[_0x1e0e('0x8f')])){if(!_0x3af246[_0x1e0e('0x88')](_0x53f1b7[_0x1e0e('0x90')])){_0x53f1b7[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x91')];throw _0x53f1b7[_0x1e0e('0x45')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x92')]=function(_0x923be9,_0x2c0d61,_0x1fa499,_0xeb54f7){var _0x253443=this;return function(){var _0x1e7ba9=!![];return _0x253443[_0x1e0e('0x93')](_0x923be9,_0x2c0d61,_0x1fa499,_0xeb54f7,_0x1e7ba9);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x94')]=function(_0x10464b,_0x584764,_0xdcc65d,_0xd25152){var _0xaf9f6a=this;return function(){var _0x4d91bf=![];return _0xaf9f6a[_0x1e0e('0x93')](_0x10464b[_0x1e0e('0x7a')],_0x584764,_0xdcc65d,_0xd25152,_0x4d91bf);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x93')]=function(_0x41ee17,_0x128bc7,_0xf07239,_0x50c9c4,_0x2cb313){var _0x5741ad=[];return new Promise(function(_0x13be70,_0x3933a2){if(!isNotNull(_0x41ee17)){_0x50c9c4['message']=utils['CAMPAIGN_STATUS'][_0x1e0e('0x77')];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x1e0e('0x79')](_0x41ee17)){_0x50c9c4[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')]['EMPTY_INTERVAL'];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+'\x20Intervals\x20is\x20empty\x20'));}if(_0x128bc7&&_[_0x1e0e('0x53')](config['timezones'][_0x128bc7])){_0x50c9c4[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x97')];return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),_0xf07239+_0x1e0e('0x98')+_0x128bc7));}if(_['isArray'](_0x41ee17)){for(var _0x96d843=0x0;_0x96d843<_0x41ee17[_0x1e0e('0x99')];_0x96d843+=0x1){_0x5741ad['push'](ami['Action']({'action':'command','command':util[_0x1e0e('0x43')](_0x1e0e('0x9a'),_0x41ee17[_0x96d843]['interval'],!_[_0x1e0e('0x53')](config[_0x1e0e('0x9b')][_0x128bc7])?_0x128bc7:'')})[_0x1e0e('0x3e')](function(_0x52fef5){return _0x52fef5[_0x1e0e('0x9c')][_0x1e0e('0x9d')]('true')>=0x0;})['catch'](myreject(_0x3933a2)));}}else{_0x5741ad[_0x1e0e('0x9e')](ami[_0x1e0e('0x9f')]({'action':'command','command':util[_0x1e0e('0x43')]('iftime\x20%s,%s',_0x41ee17,!_[_0x1e0e('0x53')](config[_0x1e0e('0x9b')][_0x128bc7])?_0x128bc7:'')})[_0x1e0e('0x3e')](function(_0x3fb7a8){return _0x3fb7a8[_0x1e0e('0x9c')]['indexOf'](_0x1e0e('0xa0'))>=0x0;})['catch'](myreject(_0x3933a2)));}Promise['all'](_0x5741ad)[_0x1e0e('0x3e')](function(_0x16317f){var _0x1e6a17=_[_0x1e0e('0xa1')](_0x16317f);if(_0x1e6a17){return _0x13be70(_0x1e6a17);}else{_0x50c9c4[_0x1e0e('0x6c')]=_0x2cb313?utils[_0x1e0e('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1e0e('0x68')][_0x1e0e('0xa2')];return _0x3933a2(msgResponse(_0x1e0e('0xa3'),_0x1e0e('0x96'),_0x1e0e('0xa4')+_0x2cb313+'\x20'+_0xf07239+_0x1e0e('0xa5')+util[_0x1e0e('0x64')](_0x41ee17,{'showHidden':![],'depth':null})+_0x1e0e('0xa6')+_0x128bc7));}})[_0x1e0e('0xa7')](function(_0x12f3d1){return _0x3933a2(msgResponse(_0x1e0e('0x95'),_0x1e0e('0x96'),JSON[_0x1e0e('0x75')](_0x12f3d1)));});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x3b')]=function(){var _0x59b111=this;return cmHopper[_0x1e0e('0xa8')]({'active':![]},{'where':{'active':!![]}})[_0x1e0e('0x3e')](function(){setInterval(function(){_0x59b111[_0x1e0e('0xa9')]();},0x3e8);});};Dialer['prototype'][_0x1e0e('0xa9')]=function(){var _0x33be93=this;var _0x17a23a;for(var _0x2ffd0f in this[_0x1e0e('0x1d')]){if(typeof this[_0x1e0e('0x1d')][_0x2ffd0f]!==_0x1e0e('0xaa')){_0x17a23a=this['campaigns'][_0x2ffd0f];if(utils[_0x1e0e('0x7d')](_0x17a23a)&&utils[_0x1e0e('0xab')](_0x17a23a)){_0x17a23a['sendMessageOneNotActive']=!![];Promise[_0x1e0e('0xac')]()['then'](checkIsIVRCampaignActive(_0x17a23a))[_0x1e0e('0x3e')](checkInterval(_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x8e')](_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x92')](_0x17a23a['dialGlobalInterval'],_0x17a23a[_0x1e0e('0xad')],_0x17a23a[_0x1e0e('0x45')],_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0x94')](_0x17a23a['Interval'],_0x17a23a[_0x1e0e('0xad')],_0x17a23a[_0x1e0e('0x45')],_0x17a23a))[_0x1e0e('0x3e')](_0x33be93[_0x1e0e('0xae')](_0x17a23a))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x17a23a));}else{notSendMessagesCampaign(_0x17a23a);}}}};Dialer[_0x1e0e('0x17')]['checkDialMethod']=function(_0x493cc6){if(_0x493cc6[_0x1e0e('0xaf')]!=='predictive'){clearPredictiveAttributes(_0x493cc6);}switch(_0x493cc6[_0x1e0e('0xaf')]){case _0x1e0e('0xb0'):this[_0x1e0e('0xb1')](_0x493cc6,0x1);break;case _0x1e0e('0xb2'):this[_0x1e0e('0xb1')](_0x493cc6,_0x493cc6['dialPowerLevel']);break;case _0x1e0e('0x8'):this[_0x1e0e('0x8')](_0x493cc6);break;case'booked':this['handlePower'](_0x493cc6,0x1);break;default:logger[_0x1e0e('0x62')](_0x1e0e('0xb3'),_0x493cc6[_0x1e0e('0x45')],_0x1e0e('0xb4'));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x95')]=function(_0x46bf81,_0x4f04fe){var _0x338715=_0x46bf81['dialTimezone'];var _0x1e2a13=_0x4f04fe?_0x46bf81[_0x1e0e('0xb5')]:_0x46bf81[_0x1e0e('0x76')][_0x1e0e('0x7a')];logger[_0x1e0e('0xb6')](_0x1e0e('0xb7'),_0x1e2a13,_0x338715,_0x46bf81[_0x1e0e('0x45')],util[_0x1e0e('0x43')]('Voice\x20Queue\x20%s\x20$s',_0x46bf81[_0x1e0e('0x45')],_0x46bf81['id']));var _0x27d326=null;return Interval['intervalIftime'](_0x1e2a13,_0x338715)[_0x1e0e('0x3e')](function(_0x51fd9a){if(_0x51fd9a===!![]){return _0x51fd9a;}else{_0x46bf81[_0x1e0e('0x6c')]=_0x4f04fe?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1e0e('0x68')][_0x1e0e('0xa2')];_0x27d326=msgResponse(_0x1e0e('0xa3'),'Failure','Global:\x20'+_0x4f04fe+'\x20'+_0x46bf81[_0x1e0e('0x45')]+_0x1e0e('0xa5')+util[_0x1e0e('0x64')](_0x1e2a13,{'showHidden':![],'depth':null})+_0x1e0e('0xa6')+_0x338715);}if(_0x27d326!==null){logger[_0x1e0e('0xb6')](_0x1e0e('0xb8'),_0x27d326);_0x27d326[_0x1e0e('0xb9')]=_0x4f04fe;throw _0x27d326;}})[_0x1e0e('0xa7')](function(_0xdf069e){logger['error'](_0x1e0e('0xba'),_0xdf069e);throw msgResponse('[ifTime][Action]','Error',util[_0x1e0e('0x64')](_0xdf069e,{'showHidden':![],'depth':null}));});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x29')]=function(_0x420186){if(this['voiceQueues'][_0x420186[_0x1e0e('0xbb')]]){if(this[_0x1e0e('0xbc')][_0x420186[_0x1e0e('0xbd')]]&&this['uniqueId'][_0x420186[_0x1e0e('0xbd')]][_0x1e0e('0x41')]!==_0x1e0e('0xbe')){this[_0x1e0e('0xbf')](this[_0x1e0e('0x1c')][_0x420186[_0x1e0e('0xbb')]]);this['uniqueId'][_0x420186[_0x1e0e('0xbd')]]['answertime']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));}}};Dialer['prototype'][_0x1e0e('0x2f')]=function(_0x4f5c4b){var _0x3e6a38=this['uniqueId'][_0x4f5c4b[_0x1e0e('0xbd')]];if(this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]]){if(_0x3e6a38&&_0x3e6a38['type']!==_0x1e0e('0xbe')){delete this[_0x1e0e('0xbc')][_0x4f5c4b[_0x1e0e('0xbd')]];this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc1')]+=0x1;var _0x2c9293=new AgentComplete(_0x3e6a38,_0x4f5c4b);if(_0x4f5c4b[_0x1e0e('0xc2')]===_0x1e0e('0xc3')){_0x2c9293[_0x1e0e('0xc4')]=this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc5')]&&this[_0x1e0e('0x1c')][_0x4f5c4b[_0x1e0e('0xbb')]][_0x1e0e('0xc6')]?moment()[_0x1e0e('0x43')](_0x1e0e('0xc0')):undefined;}hopperUtils['createHistory'](_0x2c9293)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xc7')));hopperUtils[_0x1e0e('0xc8')](_0x2c9293)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xc9')));}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x2c')]=function(_0x3de452){var _0x47973e=this[_0x1e0e('0xbc')][_0x3de452[_0x1e0e('0xbd')]];var _0x12dd33=this;var _0x24c120=![];var _0x12d449;var _0x38770c;if(this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]){if(_0x47973e&&_0x47973e[_0x1e0e('0x41')]!=='ivr'){delete this[_0x1e0e('0xbc')][_0x3de452['uniqueid']];this['updateOriginated'](this[_0x1e0e('0x1c')][_0x3de452['queue']]);_0x47973e['droptime']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));var _0x231444=new QueueCallerAbandon(_0x47973e,_0x3de452);if(utils[_0x1e0e('0xca')](_0x47973e['droptime'],_0x47973e['responsetime'])>=_0x47973e[_0x1e0e('0xcb')]){this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xcc')]+=0x1;_0x231444[_0x1e0e('0x6f')]=0xa;_0x231444[_0x1e0e('0xcd')]='Drop';_0x231444[_0x1e0e('0xce')]='TIMEOUT';_0x231444[_0x1e0e('0xc4')]=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xc5')]?moment()[_0x1e0e('0x43')](_0x1e0e('0xc0')):undefined;_0x231444['countdropretry']+=0x1;_0x231444[_0x1e0e('0xcf')]+=0x1;_0x12d449=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd0')];_0x38770c=this['voiceQueues'][_0x3de452[_0x1e0e('0xbb')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x231444,_0x231444[_0x1e0e('0x6f')],_0x47973e[_0x1e0e('0xd1')])['then'](function(_0x38f63d){_0x24c120=_0x38f63d[_0x1e0e('0xd2')]==0x1;if(_0x231444[_0x1e0e('0xd3')]>=_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd4')]){_0x12dd33[_0x1e0e('0xd5')](_0x231444,_0x38f63d[_0x1e0e('0xd2')]);}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countdropretry':_0x231444['countdropretry'],'scheduledat':moment()[_0x1e0e('0xd7')](_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xd0')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x47973e['ContactId'],'ListId':_0x47973e['ListId'],'VoiceQueueId':_0x47973e['VoiceQueueId']||undefined,'CampaignId':_0x47973e[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xda')));var _0xb805f8=new History(_0x231444);_0xb805f8[_0x1e0e('0x6f')]=0xa;_0xb805f8['statedesc']='Drop';_0xb805f8[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));_0xb805f8[_0x1e0e('0x70')]=_0xb805f8[_0x1e0e('0x71')];_0xb805f8[_0x1e0e('0xdb')]=_0x231444[_0x1e0e('0xdb')];_0xb805f8[_0x1e0e('0xdc')]=_0x231444[_0x1e0e('0xdc')];hopperUtils['createHistory'](_0xb805f8)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x1e0e('0x3e')](function(){if(_0x24c120)hopperUtils['swapAdditionalPhones'](_0x231444,_0x12d449,_0x38770c)[_0x1e0e('0x3e')](function(){return 0x1;});});}else{this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]]['outboundDropCallsDayCallersExit']+=0x1;_0x231444[_0x1e0e('0x6f')]=0xb;_0x231444[_0x1e0e('0xcd')]=_0x1e0e('0xdd');_0x231444[_0x1e0e('0xce')]=_0x1e0e('0xde');_0x231444[_0x1e0e('0xdf')]+=0x1;_0x231444[_0x1e0e('0xcf')]+=0x1;_0x12d449=this['voiceQueues'][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe0')];_0x38770c=this[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe1')];hopperUtils[_0x1e0e('0xe2')](_0x231444,_0x231444[_0x1e0e('0x6f')],_0x47973e[_0x1e0e('0xd1')])['then'](function(_0x555276){if(_0x231444[_0x1e0e('0xdf')]>=_0x12dd33[_0x1e0e('0x1c')][_0x3de452[_0x1e0e('0xbb')]][_0x1e0e('0xe3')]){_0x12dd33['queueCallerAbandonCreateState'](_0x231444,_0x555276[_0x1e0e('0xd2')]);}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countabandonedretry':_0x231444[_0x1e0e('0xdf')],'scheduledat':moment()[_0x1e0e('0xd7')](_0x12dd33[_0x1e0e('0x1c')][_0x3de452['queue']][_0x1e0e('0xe0')],_0x1e0e('0xd8'))[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x47973e[_0x1e0e('0xe4')],'ListId':_0x47973e[_0x1e0e('0xe5')],'VoiceQueueId':_0x47973e[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x47973e['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x266488=new History(_0x231444);_0x266488['state']=0xb;_0x266488[_0x1e0e('0xcd')]='Abandoned';_0x266488[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x266488[_0x1e0e('0x70')]=_0x266488['starttime'];_0x266488[_0x1e0e('0xdb')]=_0x231444[_0x1e0e('0xdb')];_0x266488[_0x1e0e('0xdc')]=_0x231444['calleridnum'];hopperUtils[_0x1e0e('0xe7')](_0x266488)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xe8')));}})[_0x1e0e('0x3e')](function(){if(_0x24c120)hopperUtils[_0x1e0e('0xe9')](_0x231444,_0x12d449,_0x38770c)[_0x1e0e('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x35')]=function(_0x248074){if(this[_0x1e0e('0x21')][_0x248074[_0x1e0e('0xbd')]]){this[_0x1e0e('0x21')][_0x248074['uniqueid']][_0x1e0e('0xea')]=_0x248074[_0x1e0e('0xea')];}if(this[_0x1e0e('0xbc')][_0x248074[_0x1e0e('0xbd')]]){this[_0x1e0e('0xbc')][_0x248074[_0x1e0e('0xbd')]][_0x1e0e('0xea')]=_0x248074[_0x1e0e('0xea')];}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x38')]=function(_0x23d04a){if(!this[_0x1e0e('0x21')][_0x23d04a['actionid']]){return;}var _0x1005a3=this[_0x1e0e('0x1c')][this[_0x1e0e('0x21')][_0x23d04a['actionid']][_0x1e0e('0xbb')]]['strategy']||_0x1e0e('0xeb');if(_0x1005a3===_0x1e0e('0xec')){if(this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]&&_[_0x1e0e('0xee')](this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]['locked'])&&_0x23d04a[_0x1e0e('0x8c')]==='1'&&_0x23d04a['paused']==='0'){if(this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]){if(!this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]['locked']){this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]][_0x1e0e('0xf1')]=!![];this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]['locked']=!![];this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]][_0x1e0e('0xf0')]=_0x23d04a[_0x1e0e('0xf0')];}}}}else if(_0x1005a3===_0x1e0e('0xeb')){if(this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]]){if(this[_0x1e0e('0xef')][_0x23d04a[_0x1e0e('0xf0')]]){this[_0x1e0e('0x21')][_0x23d04a['actionid']][_0x1e0e('0xf0')]=_0x23d04a[_0x1e0e('0xf0')];if(_[_0x1e0e('0xee')](this[_0x1e0e('0x27')][this['actions'][_0x23d04a['actionid']][_0x1e0e('0xbb')]])){this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x23d04a[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]=[];}this['queueBooked'][this[_0x1e0e('0x21')][_0x23d04a['actionid']]['queue']]['push'](_[_0x1e0e('0x5c')](_['pick'](this['actions'][_0x23d04a['actionid']],[_0x1e0e('0xf2'),'stateinterface']),{'status':_0x23d04a['status'],'paused':_0x23d04a[_0x1e0e('0xf3')]}));}}}};Dialer[_0x1e0e('0x17')]['syncQueueStatusComplete']=function(_0x56a7f4){if(!this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]){return;}var _0x40e20e=this;var _0x21b036=this['voiceQueues'][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']];var _0x15b491=_0x21b036['strategy']||'rrmemory';if(_0x15b491===_0x1e0e('0xec')){if(this[_0x1e0e('0x21')][_0x56a7f4['actionid']]&&this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xf0')]){this[_0x1e0e('0xf4')]['run'](this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xf2')],this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xf0')])[_0x1e0e('0xa7')](function(_0x1d2709){logger[_0x1e0e('0x62')](_0x1e0e('0xf5'),util['inspect'](_0x1d2709,{'showHidden':![],'depth':null}));})[_0x1e0e('0x1a')](function(){_0x40e20e[_0x1e0e('0xbf')](_0x40e20e[_0x1e0e('0x1c')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]);_0x40e20e[_0x1e0e('0xef')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xf0')]]['locked']=![];delete _0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]];unlockQueueStatus(_0x21b036);});}else{this[_0x1e0e('0xbf')](this['voiceQueues'][this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xbb')]]);hopperUtils[_0x1e0e('0xd6')]({'active':![],'ContactId':this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xe4')],'ListId':this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xe5')],'VoiceQueueId':this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xe6')]||undefined,'CampaignId':this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xf6')));delete this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]];unlockQueueStatus(_0x21b036);}}else if(_0x15b491===_0x1e0e('0xeb')){var _0x54267d;if(this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]&&!_['isEmpty'](this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]])){if(this[_0x1e0e('0xf7')][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']]){this['queueBookedRR'][_0x40e20e[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]=this['queueBookedRR'][this[_0x1e0e('0x21')][_0x56a7f4['actionid']]['queue']]?this['queueBookedRR'][this['actions'][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]]:this[_0x1e0e('0x27')][this['actions'][_0x56a7f4['actionid']][_0x1e0e('0xbb')]]?this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]][_0x1e0e('0xbb')]][_0x1e0e('0xf8')]||0x0:0x0;}this[_0x1e0e('0x27')][this[_0x1e0e('0x21')][_0x56a7f4['actionid']][_0x1e0e('0xbb')]][_0x1e0e('0xf8')]=this[_0x1e0e('0xf7')][this[_0x1e0e('0x21')][_0x56a7f4[_0x1e0e('0xed')]]['queue']];for(var _0x4da047=0x0;_0x4da047=_0x48a8fb[_0x1e0e('0x118')]){_0x36aa73[_0x1e0e('0x119')](_0x46900c,_0x41b94c,_0x3becd0,'reason19\x20machine....');}else{if(_0x46900c[_0x1e0e('0x113')]>=_0x48a8fb[_0x1e0e('0x11a')]){_0x36aa73[_0x1e0e('0x11b')](_0x46900c,_0x41b94c,_0x3becd0,'reason\x2019\x20machine....');}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0x46900c['countmachineretry'],'scheduledat':moment()[_0x1e0e('0xd7')](_0x48a8fb[_0x1e0e('0x11c')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x46900c[_0x1e0e('0xe4')],'ListId':_0x46900c['ListId'],'VoiceQueueId':_0x46900c[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x46900c[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x11d')));_0x41b94c({'reschedule':0x1});}}});}if(_0x4e745f[_0x1e0e('0x41')]===_0x1e0e('0xbe')&&this[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0x107')]&&_0x35f4f6[_0x1e0e('0x108')]===_0x1e0e('0x109')){delete this[_0x1e0e('0xbc')][_0x35f4f6['uniqueid']];this[_0x1e0e('0xbf')](this[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]]);_0x4a1f84=new Hangup(_0x4e745f,_0x35f4f6);_0x4a1f84['state']=0x12;_0x4a1f84[_0x1e0e('0xcd')]=_0x1e0e('0x11e');_0x4a1f84[_0x1e0e('0x10b')]=_0x1e0e('0x112');ami[_0x1e0e('0x40')](_0x1e0e('0x10c'),ut[_0x1e0e('0x10d')](_0x4a1f84,_0x1e0e('0x10e')));this[_0x1e0e('0x11f')](_0x4a1f84,_0x1e0e('0x120'),_0x1e0e('0x121'));}if(_0x4e745f[_0x1e0e('0x41')]===_0x1e0e('0xbe')&&this[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0x107')]&&_0x35f4f6[_0x1e0e('0x108')]===_0x1e0e('0x110')){return new Promise(function(_0x2d6a69,_0x5a960b){delete _0x36aa73['uniqueId'][_0x35f4f6['uniqueid']];_0x36aa73['updateOriginated'](_0x36aa73[_0x1e0e('0x1d')][_0x4e745f['queue']]);_0x36aa73[_0x1e0e('0x1d')][_0x4e745f['queue']][_0x1e0e('0xc1')]+=0x1;_0x36aa73[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]][_0x1e0e('0x10a')]+=0x1;var _0x21b6c1=_0x36aa73[_0x1e0e('0x1d')][_0x4e745f[_0x1e0e('0xbb')]];var _0xecba18=new Hangup(_0x4e745f,_0x35f4f6);_0xecba18[_0x1e0e('0x6f')]=0x13;_0xecba18[_0x1e0e('0xcd')]=_0x1e0e('0x111');_0xecba18[_0x1e0e('0x10b')]='AMD';_0xecba18[_0x1e0e('0x113')]+=0x1;_0xecba18[_0x1e0e('0xcf')]+=0x1;_0xecba18[_0x1e0e('0x10e')]=!![];ami[_0x1e0e('0x40')](_0x1e0e('0x10c'),ut[_0x1e0e('0x10d')](_0xecba18,_0x1e0e('0x10e')));hopperUtils[_0x1e0e('0xe7')](_0xecba18)[_0x1e0e('0xa7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xecba18['countbusyretry']+_0xecba18[_0x1e0e('0x115')]+_0xecba18[_0x1e0e('0x116')]+_0xecba18[_0x1e0e('0x117')]+_0xecba18[_0x1e0e('0xd3')]+_0xecba18['countabandonedretry']+_0xecba18[_0x1e0e('0x113')]+_0xecba18[_0x1e0e('0x122')]>=_0x21b6c1['dialGlobalMaxRetry']){_0x36aa73[_0x1e0e('0x119')](_0xecba18,_0x2d6a69,_0x5a960b,_0x1e0e('0x123'));}else{if(_0xecba18['countmachineretry']>=_0x21b6c1['dialMachineMaxRetry']){_0x36aa73['createStateFinal'](_0xecba18,_0x2d6a69,_0x5a960b,_0x1e0e('0x124'));}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0xecba18[_0x1e0e('0x113')],'scheduledat':moment()[_0x1e0e('0xd7')](_0x21b6c1['dialMachineRetryFrequency'],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0xecba18['ContactId'],'ListId':_0xecba18[_0x1e0e('0xe5')],'VoiceQueueId':_0xecba18[_0x1e0e('0xe6')]||undefined,'CampaignId':_0xecba18[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch('[rescheduleContact][Machine]'));_0x2d6a69({'reschedule':0x1});}}});}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x33')]=function(_0x4edb34){var _0xf9bfe5=this['uniqueId'][_0x4edb34[_0x1e0e('0xbd')]];var _0x352078;if(_0xf9bfe5&&_0xf9bfe5[_0x1e0e('0x41')]===_0x1e0e('0xbe')){delete this['uniqueId'][_0x4edb34[_0x1e0e('0xbd')]];this[_0x1e0e('0xbf')](this[_0x1e0e('0x1d')][_0xf9bfe5[_0x1e0e('0xbb')]]);this['campaigns'][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x125')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);hopperUtils[_0x1e0e('0xe7')](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x126')));hopperUtils['moveContactManagedDialer'](_0x352078)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0xf9bfe5&&_0xf9bfe5[_0x1e0e('0x41')]!==_0x1e0e('0xbe')&&isNotNull(this['voiceQueues'][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x127')])){delete this[_0x1e0e('0xbc')][_0x4edb34[_0x1e0e('0xbd')]];this['updateOriginated'](this[_0x1e0e('0x1c')][_0xf9bfe5['queue']]);this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]['outboundAnswerCallsDay']+=0x1;this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x10a')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);_0x352078[_0x1e0e('0x6f')]=0x10;_0x352078['statedesc']=_0x1e0e('0x128');_0x352078[_0x1e0e('0x10b')]=_0x1e0e('0x129');hopperUtils['createHistory'](_0x352078)['catch'](loggerCatch(_0x1e0e('0x126')));hopperUtils['moveContactManagedDialer'](_0x352078)[_0x1e0e('0xa7')](loggerCatch('[syncHangupIvr]'));}if(_0xf9bfe5&&_0xf9bfe5['type']!==_0x1e0e('0xbe')&&!isNotNull(this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]['dialQueueProject'])){delete this[_0x1e0e('0xbc')][_0x4edb34[_0x1e0e('0xbd')]];this['updateOriginated'](this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]]);this[_0x1e0e('0x1c')][_0xf9bfe5[_0x1e0e('0xbb')]][_0x1e0e('0x12a')]+=0x1;_0x352078=new Hangup(_0xf9bfe5,_0x4edb34);_0x352078['state']=0xc;_0x352078[_0x1e0e('0xcd')]=_0x4edb34['cause-txt'];_0x352078[_0x1e0e('0x10b')]=_0x1e0e('0x12b');hopperUtils['createHistory'](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x126')));hopperUtils[_0x1e0e('0xc8')](_0x352078)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x12c')));}};Dialer[_0x1e0e('0x17')]['syncQueueSummary']=function(_0x52a6a2){var _0x56f0b6=this;if(!_0x56f0b6['queuesSummary'][_0x52a6a2['name']]){_0x56f0b6['queuesSummary'][_0x52a6a2[_0x1e0e('0x45')]]={'running':![]};}else if(_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2[_0x1e0e('0x45')]]['running']===!![]){return;}else if(_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2[_0x1e0e('0x45')]][_0x1e0e('0x12d')]===![]){_0x56f0b6[_0x1e0e('0x28')][_0x52a6a2['name']]['running']=!![];}var _0x1861ac=_0x56f0b6[_0x1e0e('0x1c')][_0x52a6a2[_0x1e0e('0x45')]];var _0x5ddddf=_0x1861ac[_0x1e0e('0x6c')]!==utils[_0x1e0e('0x68')][_0x1e0e('0x7b')];var _0x77cb28=utils[_0x1e0e('0x12e')](_0x1861ac);_0x1861ac['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x1861ac,_0x56f0b6[_0x1e0e('0x1e')]);Promise[_0x1e0e('0xac')]()['then'](function(){if(_0x1861ac[_0x1e0e('0x12f')]===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x5ddddf){clearPredictiveAttributes(_0x1861ac);_0x52a6a2[_0x1e0e('0x24')]=undefined;_0x52a6a2['startProgressive']=undefined;}if(_0x1861ac['statusMessage']===utils[_0x1e0e('0x68')]['INACTIVE']){_0x52a6a2[_0x1e0e('0x130')]=0x0;_0x52a6a2[_0x1e0e('0xf3')]=0x0;_0x52a6a2['inUse']=0x0;_0x52a6a2[_0x1e0e('0x131')]=0x0;_0x52a6a2[_0x1e0e('0x132')]=0x0;}}else if(_0x1861ac['statusMessage']===utils[_0x1e0e('0x68')][_0x1e0e('0x133')]&&!_0x77cb28){return _0x56f0b6[_0x1e0e('0x95')](_0x1861ac,!![])[_0x1e0e('0x3e')](function(){return _0x56f0b6['ifTime'](_0x1861ac,![]);})[_0x1e0e('0x3e')](function(){return _0x56f0b6[_0x1e0e('0x134')](_0x1861ac);})[_0x1e0e('0xa7')](function(_0xc1256c){loggerSyncQueueSummary['debug']('[syncQueueSummary]',util[_0x1e0e('0x64')](_0xc1256c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1861ac);});}else{clearPredictiveAttributes(_0x1861ac);}})[_0x1e0e('0x3e')](function(){var _0x3ba52d=_0x52a6a2[_0x1e0e('0x135')](_0x1861ac);if(_0x3ba52d||_0x1861ac[_0x1e0e('0x136')]){_0x1861ac[_0x1e0e('0x136')]=![];_0x52a6a2[_0x1e0e('0x137')](_0x1861ac);Object[_0x1e0e('0x138')](_0x1861ac,_0x52a6a2);emitOutboundVoiceQueueSummary(_0x52a6a2);}_0x56f0b6['queuesSummary'][_0x1861ac['name']][_0x1e0e('0x12d')]=![];})[_0x1e0e('0xa7')](function(_0x499f8c){logger[_0x1e0e('0x62')]('[syncQueueSummary]',util['inspect'](_0x499f8c,{'showHidden':![],'depth':null}));_0x56f0b6['queuesSummary'][_0x1861ac[_0x1e0e('0x45')]][_0x1e0e('0x12d')]=![];});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x32')]=_[_0x1e0e('0x139')](function(){var _0x2c0c4c=_['filter'](this[_0x1e0e('0x1c')],function(_0x55b0c1){return _0x55b0c1[_0x1e0e('0x13a')];});var _0x195466=_[_0x1e0e('0x13b')](this[_0x1e0e('0xef')],function(_0xa2ccf0){return _0xa2ccf0[_0x1e0e('0x13c')]&&_0xa2ccf0[_0x1e0e('0x8c')]==='reachable';});if(_0x2c0c4c[_0x1e0e('0x99')]>0x0&&_0x195466[_0x1e0e('0x99')]>0x0){return Promise[_0x1e0e('0xac')]()[_0x1e0e('0x3e')](cmHopper[_0x1e0e('0x13d')](_[_0x1e0e('0x13e')](_0x2c0c4c,'id'),previewRecallmeReminderInterval,_[_0x1e0e('0x13e')](_0x195466,'id')))[_0x1e0e('0x3e')](function(_0x203967){for(var _0x363484=0x0;_0x363484<_0x203967[_0x1e0e('0x99')];_0x363484++){var _0xa7b169=_0x203967[_0x363484][_0x1e0e('0x13f')][_0x1e0e('0x45')];if(_0xa7b169)io['to'](util[_0x1e0e('0x43')](_0x1e0e('0x140'),_0xa7b169))[_0x1e0e('0x40')](_0x1e0e('0x141'),{'hopper':_0x203967[_0x363484]});}})[_0x1e0e('0xa7')](function(_0x22c9cb){logger[_0x1e0e('0x62')](_0x1e0e('0x142'),_0x22c9cb);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1e0e('0x17')][_0x1e0e('0x3c')]=function(){var _0x1b26f8=this;setInterval(function(){_0x1b26f8[_0x1e0e('0x143')](_0x1b26f8['uniqueId'],_0x1e0e('0x144'));_0x1b26f8[_0x1e0e('0x143')](_0x1b26f8['actions'],_0x1e0e('0x145'));},0x32c8);};Dialer[_0x1e0e('0x17')][_0x1e0e('0x143')]=function(_0x21230d,_0x3780fa){var _0x222634=this;for(var _0x53cb61 in _0x21230d){if(typeof _0x21230d[_0x53cb61]!==_0x1e0e('0xaa')){this[_0x1e0e('0x1b')][_0x1e0e('0x18')](function(){if(!_[_0x1e0e('0xee')](_0x21230d[_0x53cb61])){return ami[_0x1e0e('0x9f')]({'action':_0x1e0e('0x8c'),'channel':_0x21230d[_0x53cb61][_0x1e0e('0xea')]})[_0x1e0e('0xa7')](function(_0x1c39a0){if(_0x1c39a0[_0x1e0e('0x6c')]===_0x1e0e('0x146')){setTimeout(function(){if(_0x21230d[_0x53cb61]&&_0x21230d[_0x53cb61][_0x1e0e('0x41')]!==_0x1e0e('0xbe')){_0x222634[_0x1e0e('0xbf')](_0x222634[_0x1e0e('0x1c')][_0x21230d[_0x53cb61][_0x1e0e('0xbb')]]);logger[_0x1e0e('0x62')]('[Dialer][checkChannel]',_0x3780fa,_0x53cb61,_0x21230d[_0x53cb61][_0x1e0e('0xbb')]);delete _0x21230d[_0x53cb61];}if(_0x21230d[_0x53cb61]&&_0x21230d[_0x53cb61][_0x1e0e('0x41')]===_0x1e0e('0xbe')){_0x222634[_0x1e0e('0xbf')](_0x222634[_0x1e0e('0x1d')][_0x21230d[_0x53cb61][_0x1e0e('0xbb')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x3780fa,_0x53cb61,_0x21230d[_0x53cb61][_0x1e0e('0xbb')]);delete _0x21230d[_0x53cb61];}},0x2328);}});}});}}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x147')]=function(_0x1275e8){return Promise['resolve']()[_0x1e0e('0x3e')](voiceQueueRt[_0x1e0e('0x147')](_0x1275e8))[_0x1e0e('0xa7')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x1e0e('0x17')][_0x1e0e('0xbf')]=function(_0x573954){if(!_[_0x1e0e('0x53')](_0x573954)&&_0x573954!==null){if(typeof _0x573954[_0x1e0e('0x80')]!=='undefined'){if(_0x573954[_0x1e0e('0x80')]>0x0){_0x573954[_0x1e0e('0x80')]-=0x1;}else{logger[_0x1e0e('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1e0e('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x148')]=function(_0x2c75ad,_0x2d9b61){var _0x2258ed=this;return function(_0x141e78){_0x2258ed[_0x1e0e('0xbf')](_0x2d9b61);logger[_0x1e0e('0x62')](_0x2c75ad,util[_0x1e0e('0x64')](_0x141e78,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x289f67,_0x453a1d,_0x5cb0b1){var _0x27342b={'state':0x19,'statedesc':_0x1e0e('0x149')};this['updateOriginated'](_0x453a1d);this[_0x1e0e('0x11f')](_['merge'](_0x27342b,_['pick'](_0x5cb0b1,[_0x1e0e('0xe4'),_0x1e0e('0xe5'),'UserId',_0x1e0e('0xe6'),_0x1e0e('0xd9')])),_0x1e0e('0x14a'),_0x1e0e('0x14b'));logger[_0x1e0e('0x62')](_0x289f67);};Dialer[_0x1e0e('0x17')][_0x1e0e('0x11f')]=function(_0x5ddeaa,_0x37afd6,_0x38ca8d){hopperUtils[_0x1e0e('0xe7')](_0x5ddeaa)[_0x1e0e('0xa7')](loggerCatch(_0x37afd6));hopperUtils[_0x1e0e('0xc8')](_0x5ddeaa)['catch'](loggerCatch(_0x38ca8d));};Dialer[_0x1e0e('0x17')]['queueCallerAbandonCreateState']=function(_0x427967,_0x1cfe2c){hopperUtils[_0x1e0e('0xe7')](_0x427967)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1cfe2c==0x0){hopperUtils[_0x1e0e('0xc8')](_0x427967)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x14c')));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x142')]=function(_0x2fcd5c){return Promise[_0x1e0e('0xac')]()[_0x1e0e('0x3e')](cmHopper[_0x1e0e('0x13d')](_0x2fcd5c['id'],previewRecallmeReminderInterval))[_0x1e0e('0x3e')](function(_0x3059e6){for(var _0x51b548=0x0;_0x51b548<_0x3059e6[_0x1e0e('0x99')];_0x51b548++){var _0xcc72ed=_0x3059e6[_0x51b548]['Agent'][_0x1e0e('0x45')];if(_0xcc72ed)io['to'](util['format'](_0x1e0e('0x140'),_0xcc72ed))[_0x1e0e('0x40')](_0x1e0e('0x141'),{'hopper':_0x3059e6[_0x51b548]});}})[_0x1e0e('0xa7')](function(){});};Dialer[_0x1e0e('0x17')][_0x1e0e('0xae')]=function(_0x3f778f){var _0x57d700=this;return function(){_0x57d700['handleIvr'](_0x3f778f);};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x14d')]=function(_0x4fb3e3,_0x2b8c03){var _0x3dafe2=this;var _0x47a21a=uuid['v4']();this[_0x1e0e('0x21')][_0x47a21a]=new Action(_0x4fb3e3,_0x2b8c03,_0x47a21a);return new Promise(function(_0x5172c5,_0x4ff479){if(_['isUndefined'](_0x4fb3e3)&&typeof _0x4fb3e3!==_0x1e0e('0x14e')){return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x96'),_0x1e0e('0x150')));}if(_[_0x1e0e('0x53')](_0x2b8c03[_0x1e0e('0x151')])||_0x2b8c03[_0x1e0e('0x151')]===null){return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x96'),'contact\x20is\x20undefine'));}var _0x1b2e1b={'XMD-CALLERID':_0x3dafe2[_0x1e0e('0x21')][_0x47a21a][_0x1e0e('0x152')](),'XMD-AGI':_0x4fb3e3[_0x1e0e('0x127')]?util[_0x1e0e('0x43')](_0x1e0e('0x153'),ipAgi,_0x4fb3e3[_0x1e0e('0x127')]):_0x1e0e('0x154'),'XMD-AGIAFTER':_0x4fb3e3[_0x1e0e('0xc5')]?util[_0x1e0e('0x43')](_0x1e0e('0x153'),ipAgi,_0x4fb3e3[_0x1e0e('0xc5')]):_0x1e0e('0x154'),'XMD-QUEUE':utils[_0x1e0e('0x155')](_0x4fb3e3)?util[_0x1e0e('0x43')](_0x1e0e('0x156'),_0x4fb3e3['name'],_0x4fb3e3['dialQueueOptions']||'',_0x4fb3e3['dialAgiAfterHangupAgent']?'c':'',_0x4fb3e3['dialQueueTimeout']||0x3):_0x1e0e('0x154'),'XMD-CONTACTID':_0x2b8c03[_0x1e0e('0xe4')],'XMD-CDRTYPE':_0x1e0e('0x6'),'CALLERID(all)':_0x3dafe2['actions'][_0x47a21a][_0x1e0e('0x152')](),'XMD-AMD':_0x4fb3e3[_0x1e0e('0x107')]?_0x1e0e('0x133'):_0x1e0e('0x154'),'XMD-DESTINATION':_0x1e0e('0x106')};if(_0x4fb3e3[_0x1e0e('0x107')]){_0x1b2e1b[_0x1e0e('0x157')]=_0x4fb3e3['dialAMDInitialSilence']||0x9c4;_0x1b2e1b[_0x1e0e('0x158')]=_0x4fb3e3['dialAMDGreeting']||0x5dc;_0x1b2e1b[_0x1e0e('0x159')]=_0x4fb3e3[_0x1e0e('0x15a')]||0x320;_0x1b2e1b[_0x1e0e('0x15b')]=_0x4fb3e3[_0x1e0e('0x15c')]||0x1388;_0x1b2e1b['XMD-AMDMINWORDLENGTH']=_0x4fb3e3[_0x1e0e('0x15d')]||0x64;_0x1b2e1b[_0x1e0e('0x15e')]=_0x4fb3e3[_0x1e0e('0x15f')]||0x32;_0x1b2e1b[_0x1e0e('0x160')]=_0x4fb3e3[_0x1e0e('0x161')]||0x3;_0x1b2e1b[_0x1e0e('0x162')]=_0x4fb3e3[_0x1e0e('0x163')]||0x100;_0x1b2e1b[_0x1e0e('0x164')]=_0x4fb3e3[_0x1e0e('0x165')]||0x1388;}if(utils[_0x1e0e('0x155')](_0x4fb3e3)){_0x1b2e1b[_0x1e0e('0x166')]=_0x2b8c03[_0x1e0e('0xe6')];}else{_0x1b2e1b['XMD-CAMPAIGNID']=_0x2b8c03[_0x1e0e('0xd9')];}var _0x4359d3=utils[_0x1e0e('0x167')](_0x2b8c03[_0x1e0e('0x168')]);Object['assign'](_0x1b2e1b,_0x4359d3);var _0xe3c6e4=_0x3dafe2['isTrunkReachable'](_0x4fb3e3[_0x1e0e('0x8f')])?utils[_0x1e0e('0x169')](_0x4fb3e3['Trunk'][_0x1e0e('0x16a')],_0x4fb3e3[_0x1e0e('0x16b')],_0x4fb3e3[_0x1e0e('0x16c')]>0x0?utils['getCallerIdRandom'](_0x4fb3e3[_0x1e0e('0x16d')],_0x4fb3e3[_0x1e0e('0x16c')]):_0x4fb3e3[_0x1e0e('0x16d')]):utils[_0x1e0e('0x169')](_[_0x1e0e('0xee')](_0x4fb3e3[_0x1e0e('0x90')])?_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x16a')]:_0x4fb3e3[_0x1e0e('0x90')]['callerid'],_0x4fb3e3[_0x1e0e('0x16b')],_0x4fb3e3[_0x1e0e('0x16c')]>0x0?utils[_0x1e0e('0x16e')](_0x4fb3e3[_0x1e0e('0x16d')],_0x4fb3e3[_0x1e0e('0x16c')]):_0x4fb3e3[_0x1e0e('0x16d')]);if(_0xe3c6e4){_0x1b2e1b[_0x1e0e('0x16f')]=_0x3dafe2[_0x1e0e('0x21')][_0x47a21a][_0x1e0e('0x170')]=utils['extractCalleridName'](_0xe3c6e4);_0x1b2e1b['XMD-ORIGINATECALLERIDNUM']=_0x2b8c03[_0x1e0e('0x151')];}_0x4fb3e3[_0x1e0e('0x171')]=_0x1b2e1b;return ami['Action']({'actionid':_0x47a21a,'action':'originate','channel':_0x3dafe2[_0x1e0e('0x88')](_0x4fb3e3[_0x1e0e('0x8f')])?util['format'](_0x1e0e('0x172'),_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x45')],isNotNull(_0x4fb3e3[_0x1e0e('0x173')])?_0x4fb3e3[_0x1e0e('0x173')][_0x1e0e('0x174')]()||'':'',_0x4fb3e3[_0x1e0e('0x175')]>0x0?_0x2b8c03[_0x1e0e('0x151')][_0x1e0e('0x176')](_0x4fb3e3[_0x1e0e('0x175')]):_0x2b8c03[_0x1e0e('0x151')]):util[_0x1e0e('0x43')](_0x1e0e('0x172'),_[_0x1e0e('0xee')](_0x4fb3e3[_0x1e0e('0x90')])?_0x4fb3e3[_0x1e0e('0x8f')][_0x1e0e('0x45')]:_0x4fb3e3[_0x1e0e('0x90')][_0x1e0e('0x45')],isNotNull(_0x4fb3e3['dialPrefix'])?_0x4fb3e3[_0x1e0e('0x173')][_0x1e0e('0x174')]()||'':'',_0x4fb3e3[_0x1e0e('0x175')]>0x0?_0x2b8c03['phone'][_0x1e0e('0x176')](_0x4fb3e3['dialCutDigit']):_0x2b8c03['phone']),'callerid':_0xe3c6e4,'Exten':_0x1e0e('0x106'),'Context':_0x1e0e('0x177'),'Priority':'1','variable':_0x1b2e1b,'timeout':(_0x4fb3e3[_0x1e0e('0x178')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47a21a})[_0x1e0e('0x3e')](function(_0x1bcfdd){return _0x5172c5(_0x1bcfdd);})[_0x1e0e('0xa7')](function(_0x591444){_0x4fb3e3[_0x1e0e('0x179')]+=0x1;var _0x26f81d=new History(_0x3dafe2['actions'][_0x47a21a]);logger[_0x1e0e('0x62')](util['format'](_0x1e0e('0x17a'),JSON[_0x1e0e('0x75')](_0x591444)));_0x26f81d[_0x1e0e('0x6f')]=0xe;_0x26f81d[_0x1e0e('0xcd')]=_0x1e0e('0x17b');_0x26f81d[_0x1e0e('0x71')]=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));_0x26f81d[_0x1e0e('0x70')]=_0x26f81d[_0x1e0e('0x71')];hopperUtils['createHistory'](_0x26f81d)[_0x1e0e('0xa7')](loggerCatch('[originate][error]'));_0x3dafe2[_0x1e0e('0xc8')](_0x26f81d)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x17c')))[_0x1e0e('0x1a')](function(){delete _0x3dafe2[_0x1e0e('0x21')][_0x47a21a];return _0x4ff479(msgResponse(_0x1e0e('0x14f'),_0x1e0e('0x87'),_0x1e0e('0x17d')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x336a86,_0xf0e72c,_0x476240){var _0x15cd49=new History(_0xf0e72c);if(_0x15cd49[_0x1e0e('0x17e')]+_0x15cd49[_0x1e0e('0x115')]+_0x15cd49['countnoanswerretry']+_0x15cd49['countnosuchnumberretry']+_0x15cd49[_0x1e0e('0xd3')]+_0x15cd49['countabandonedretry']+_0x15cd49[_0x1e0e('0x113')]+_0x15cd49[_0x1e0e('0x122')]>=_0x476240['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x336a86){case 0x3:if(_0x15cd49[_0x1e0e('0x116')]>=_0x476240[_0x1e0e('0x17f')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countnoanswerretry':_0x15cd49[_0x1e0e('0x116')]+=0x1,'scheduledat':moment()['add'](_0x476240[_0x1e0e('0x180')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x181')));break;case 0x5:if(_0x15cd49[_0x1e0e('0x17e')]>=_0x476240[_0x1e0e('0x182')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countbusyretry':_0x15cd49[_0x1e0e('0x17e')]+=0x1,'scheduledat':moment()['add'](_0x476240[_0x1e0e('0x183')],_0x1e0e('0xd8'))['format'](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49['ListId'],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x184')));break;case 0x8:if(_0x15cd49['countcongestionretry']>=_0x476240[_0x1e0e('0x185')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countcongestionretry':_0x15cd49[_0x1e0e('0x115')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240['dialCongestionRetryFrequency'],'minutes')[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})['catch'](loggerCatch(_0x1e0e('0x186')));break;case 0x0:if(_0x15cd49['countnosuchnumberretry']>=_0x476240['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x1e0e('0xd6')]({'active':![],'countnosuchnumberretry':_0x15cd49[_0x1e0e('0x117')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x187')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x15cd49[_0x1e0e('0xd3')]>=_0x476240[_0x1e0e('0xd4')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countdropretry':_0x15cd49[_0x1e0e('0xd3')]+=0x1,'scheduledat':moment()['add'](_0x476240['dialDropRetryFrequency'],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0xda')));break;case 0xb:if(_0x15cd49[_0x1e0e('0xdf')]>=_0x476240[_0x1e0e('0xe3')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countabandonedretry':_0x15cd49[_0x1e0e('0xdf')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0xe0')],_0x1e0e('0xd8'))[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49['ListId'],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x188')));break;case 0x13:if(_0x15cd49[_0x1e0e('0x113')]>=_0x476240[_0x1e0e('0x11a')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countmachineretry':_0x15cd49[_0x1e0e('0x113')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x11c')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49['ContactId'],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x11d')));break;case 0x14:if(_0x15cd49[_0x1e0e('0x122')]>=_0x476240[_0x1e0e('0x189')]-0x1){return!![];}hopperUtils[_0x1e0e('0xd6')]({'active':![],'countagentrejectretry':_0x15cd49[_0x1e0e('0x122')]+=0x1,'scheduledat':moment()[_0x1e0e('0xd7')](_0x476240[_0x1e0e('0x18a')],_0x1e0e('0xd8'))[_0x1e0e('0x43')](_0x1e0e('0xc0')),'ContactId':_0x15cd49[_0x1e0e('0xe4')],'ListId':_0x15cd49[_0x1e0e('0xe5')],'VoiceQueueId':_0x15cd49[_0x1e0e('0xe6')]||undefined,'CampaignId':_0x15cd49['CampaignId']||undefined})['catch'](loggerCatch(_0x1e0e('0x18b')));break;default:return!![];}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x102')]=function(_0x3d7a55,_0x47d681,_0x345d3c){var _0x43e54a=this;var _0x1194c9=new History(_0x3d7a55);var _0x4caa0f=![];var _0x1aa5f8;var _0x33fd47;return new Promise(function(_0x3de314,_0x1b63b5){if(_[_0x1e0e('0x53')](_0x47d681)&&typeof _0x47d681!==_0x1e0e('0x14e')){return _0x1b63b5(msgResponse('[callProgressDetecting]',_0x1e0e('0x96'),_0x1e0e('0x18c')));}if(_[_0x1e0e('0x53')](_0x345d3c)&&typeof _0x345d3c!=='object'){return _0x1b63b5(msgResponse(_0x1e0e('0x18d'),_0x1e0e('0x96'),_0x1e0e('0x18e')));}hopperUtils[_0x1e0e('0xe2')](_0x1194c9,_0x345d3c[_0x1e0e('0xc2')],_0x47d681)[_0x1e0e('0x3e')](function(_0x4114e2){if(_0x4114e2[_0x1e0e('0xd2')]==0x1)_0x4caa0f=!![];switch(_0x345d3c[_0x1e0e('0xc2')]){case'0':_0x47d681[_0x1e0e('0x18f')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x0;_0x1194c9['statedesc']=_0x1e0e('0x190');_0x1194c9[_0x1e0e('0x117')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;ami[_0x1e0e('0x40')](_0x1e0e('0x191'),ut['buildObj'](_0x3d7a55,'nosuchnumber'));_0x1aa5f8=_0x47d681[_0x1e0e('0x187')];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x114')));if(_0x43e54a[_0x1e0e('0x192')](0x0,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x117')]>=_0x47d681[_0x1e0e('0x193')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,'reason\x200\x20no\x20such\x20number....');}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x194'));}}break;case'3':_0x47d681[_0x1e0e('0x195')]+=0x1;_0x1194c9['state']=0x3;_0x1194c9['statedesc']=_0x1e0e('0x196');_0x1194c9[_0x1e0e('0x116')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;var _0x437491=ut['buildNoAnswerEventPayload'](_0x3d7a55,_0x47d681);ami[_0x1e0e('0x40')](_0x1e0e('0x197'),_0x437491);_0x1aa5f8=_0x47d681[_0x1e0e('0x180')];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x198')));if(_0x43e54a[_0x1e0e('0x192')](0x3,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x116')]>=_0x47d681[_0x1e0e('0x17f')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x199'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x199'));}}break;case'5':_0x47d681[_0x1e0e('0x19a')]+=0x1;_0x1194c9['state']=0x5;_0x1194c9[_0x1e0e('0xcd')]='Busy';_0x1194c9[_0x1e0e('0x17e')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;ami['emit']('custom:agentbusy',ut[_0x1e0e('0x10d')](_0x3d7a55,'busy'));_0x1aa5f8=_0x47d681['dialBusyRetryFrequency'];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x19b')));if(_0x43e54a[_0x1e0e('0x192')](0x5,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x17e')]>=_0x47d681['dialBusyMaxRetry']){_0x43e54a['createStateFinal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x19c'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x19c'));}}break;case'8':_0x47d681['outboundCongestionCallsDay']+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x8;_0x1194c9['statedesc']=_0x1e0e('0x19d');_0x1194c9[_0x1e0e('0x115')]+=0x1;_0x1194c9['countglobal']+=0x1;_0x1aa5f8=_0x47d681[_0x1e0e('0x19e')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];ami[_0x1e0e('0x40')](_0x1e0e('0x19f'),ut[_0x1e0e('0x10d')](_0x3d7a55,'congestion'));hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a0')));if(_0x43e54a[_0x1e0e('0x192')](0x8,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x115')]>=_0x47d681[_0x1e0e('0x185')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a1'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,'reason\x208\x20congestion');}}break;case'11':_0x47d681[_0x1e0e('0x1a2')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0xb;_0x1194c9[_0x1e0e('0xcd')]='Abandoned';_0x1194c9[_0x1e0e('0xdf')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;_0x1aa5f8=_0x47d681['dialAbandonedRetryFrequency'];_0x33fd47=_0x47d681['callAdditionalPhoneAfterMin'];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x43e54a[_0x1e0e('0x192')](0xb,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0xdf')]>=_0x47d681[_0x1e0e('0xe3')]){_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a3'));}else{_0x43e54a[_0x1e0e('0x119')](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a3'));}}break;case'20':_0x47d681['outboundRejectCallsDay']+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0x14;_0x1194c9[_0x1e0e('0xcd')]=_0x1e0e('0x1a4');_0x1194c9[_0x1e0e('0x122')]+=0x1;_0x1194c9[_0x1e0e('0xcf')]+=0x1;_0x1aa5f8=_0x47d681[_0x1e0e('0x18a')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];ami['emit'](_0x1e0e('0x1a5'),ut[_0x1e0e('0x10d')](_0x3d7a55,_0x1e0e('0x1a6')));hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a7')));if(_0x43e54a[_0x1e0e('0x192')](0x14,_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9[_0x1e0e('0x122')]>=_0x47d681[_0x1e0e('0x189')]){_0x43e54a['createStateFinal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a8'));}else{_0x43e54a['stateGlobal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x1e0e('0x1a8'));}}break;default:_0x47d681[_0x1e0e('0x12a')]+=0x1;_0x1194c9[_0x1e0e('0x6f')]=0xc;_0x1194c9['statedesc']=_0x345d3c[_0x1e0e('0xc2')];_0x1aa5f8=_0x47d681[_0x1e0e('0x18a')];_0x33fd47=_0x47d681[_0x1e0e('0xe1')];hopperUtils[_0x1e0e('0xe7')](_0x1194c9)[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1a9')));if(_0x43e54a[_0x1e0e('0x192')](_0x345d3c[_0x1e0e('0xc2')],_0x3d7a55,_0x47d681)&&!_0x4caa0f){if(_0x1194c9['countbusyretry']+_0x1194c9[_0x1e0e('0x115')]+_0x1194c9[_0x1e0e('0x116')]+_0x1194c9[_0x1e0e('0x117')]+_0x1194c9[_0x1e0e('0xd3')]+_0x1194c9[_0x1e0e('0xdf')]+_0x1194c9[_0x1e0e('0x113')]+_0x1194c9[_0x1e0e('0x122')]>=_0x47d681[_0x1e0e('0x118')]){_0x43e54a['stateGlobal'](_0x1194c9,_0x3de314,_0x1b63b5,_0x345d3c[_0x1e0e('0xc2')]);}else{_0x43e54a[_0x1e0e('0x11b')](_0x1194c9,_0x3de314,_0x1b63b5,_0x345d3c[_0x1e0e('0xc2')]);}}}})[_0x1e0e('0x3e')](function(){if(_0x4caa0f){hopperUtils[_0x1e0e('0xe9')](_0x1194c9,_0x1aa5f8,_0x33fd47)['then'](function(){return _0x3de314(0x1);});}});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x119')]=function(_0x48c11e,_0x11b54c,_0x323d49,_0x3cfb4d){var _0x3c782a=new Final(_0x48c11e);_0x3c782a[_0x1e0e('0x6f')]=0xf;_0x3c782a[_0x1e0e('0xcd')]='Global';this[_0x1e0e('0x11b')](_0x3c782a,_0x11b54c,_0x323d49,_0x3cfb4d);};Dialer['prototype'][_0x1e0e('0x11b')]=function(_0x3d01fb,_0xfef5c8,_0x5b3071,_0x542b99){hopperUtils[_0x1e0e('0xc8')](_0x3d01fb)[_0x1e0e('0x3e')](function(){return _0xfef5c8(msgResponse(_0x1e0e('0x18d'),_0x1e0e('0x1aa'),_0x542b99));})[_0x1e0e('0xa7')](function(){return _0x5b3071(msgResponse(_0x1e0e('0x1ab'),_0x1e0e('0x96'),'contact\x20not\x20moved'));});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x8')]=function(_0x352ee5){var _0x2e27b8=_0x352ee5[_0x1e0e('0x1ac')]/0x64;var _0x56e06a=_0x352ee5[_0x1e0e('0x1ad')]/(_0x352ee5[_0x1e0e('0x1ad')]+_0x352ee5[_0x1e0e('0xc1')]);var _0x240e47=Math[_0x1e0e('0x1ae')](_0x352ee5[_0x1e0e('0x1af')]*(_0x352ee5[_0x1e0e('0x1b0')]/0x64));var _0x23acdf=Math[_0x1e0e('0x1ae')](_0x352ee5['predictiveIntervalAvailable']*(_0x352ee5[_0x1e0e('0x1b1')]/0x64));var _0x4247af=_0x352ee5[_0x1e0e('0x130')]+_0x352ee5[_0x1e0e('0x131')];var _0x58a0fa=Math[_0x1e0e('0x1b2')](_0x352ee5['erlangCalls']*_0x352ee5['erlangAbandonmentRate']*_0x352ee5[_0x1e0e('0x1b3')]*_0x352ee5[_0x1e0e('0x1b4')]);if(_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x25')])){if(!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x24')])){_0x352ee5[_0x1e0e('0x24')]=undefined;loggerPredictive[_0x1e0e('0x62')](_0x1e0e('0x1b5'),_0x1e0e('0x1b6'));}if(!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x60')])){loggerPredictive['error'](_0x1e0e('0x1b5'),_0x1e0e('0x1b7'));clearInterval(_0x352ee5[_0x1e0e('0x60')]);_0x352ee5[_0x1e0e('0x60')]=undefined;}_0x352ee5[_0x1e0e('0x25')]=moment()['format'](_0x1e0e('0xc0'));loggerPredictive[_0x1e0e('0x47')](_0x352ee5[_0x1e0e('0x45')],_0x1e0e('0x1b8'),_0x352ee5[_0x1e0e('0x25')]);this[_0x1e0e('0xb1')](_0x352ee5,0x1);}else if(ifInterval(_0x352ee5[_0x1e0e('0x1b9')],_0x352ee5['startProgressive'])){this[_0x1e0e('0xb1')](_0x352ee5,0x1);loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x1ba'),_0x352ee5[_0x1e0e('0x25')],_0x352ee5[_0x1e0e('0x45')]);_0x352ee5[_0x1e0e('0x58')]=0x0;_0x352ee5[_0x1e0e('0xcc')]=0x0;}else if(_0x2e27b8<_0x56e06a&&_0x352ee5['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x1bb'),_0x1e0e('0x1bc'),_0x56e06a,_0x1e0e('0x25'),_0x352ee5[_0x1e0e('0x45')]);}else if(_0x58a0fa<_0x352ee5['predictiveIntervalErlangCallsDroppedCalls']&&_0x352ee5[_0x1e0e('0x1bd')]==='dropRate'){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x1be'),_0x1e0e('0x1bf'),_0x58a0fa,'Drop\x20in\x20this\x20interval',_0x352ee5[_0x1e0e('0xcc')],_0x1e0e('0x25'),_0x352ee5['name']);}else if(!ifInterval(_0x352ee5[_0x1e0e('0x1b9')],_0x352ee5[_0x1e0e('0x25')])&&_['isUndefined'](_0x352ee5[_0x1e0e('0x24')])&&!_[_0x1e0e('0x53')](_0x352ee5[_0x1e0e('0x25')])){_0x352ee5['startPredictive']=moment()[_0x1e0e('0x43')](_0x1e0e('0xc0'));loggerPredictive['info'](_0x352ee5[_0x1e0e('0x45')],'started\x20in\x20predictive\x20at',_0x352ee5[_0x1e0e('0x24')]);hopperUtils[_0x1e0e('0x1c0')](_0x352ee5[_0x1e0e('0x1b9')])['then'](this['getDataPredictive'](_0x352ee5))[_0x1e0e('0x3e')](mergeDataErlangB(_0x352ee5))[_0x1e0e('0x3e')](this[_0x1e0e('0x1c1')](_0x352ee5))[_0x1e0e('0xa7')](loggerCatchPredictive(_0x1e0e('0x1c2'),_0x352ee5));}else if(!ifInterval(_0x352ee5['dialPredictiveInterval'],_0x352ee5['startPredictive'])){_0x352ee5['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x352ee5[_0x1e0e('0x24')]=moment()[_0x1e0e('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x352ee5['name'],_0x1e0e('0x1c3'),_0x352ee5['startPredictive']);clearInterval(_0x352ee5['handlePredictive']);_0x352ee5['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x352ee5[_0x1e0e('0x1b9')])['then'](this[_0x1e0e('0x1c4')](_0x352ee5))['then'](mergeDataErlangB(_0x352ee5))[_0x1e0e('0x3e')](this[_0x1e0e('0x1c1')](_0x352ee5))[_0x1e0e('0xa7')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x352ee5));}else if(_0x352ee5[_0x1e0e('0x1af')]&&_0x4247af<_0x352ee5[_0x1e0e('0x1af')]-_0x23acdf){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x352ee5['name'],_0x1e0e('0x1c5'),_0x4247af,_0x1e0e('0x1c6'),_0x352ee5[_0x1e0e('0x1af')],'-',_0x23acdf,'=',_0x352ee5[_0x1e0e('0x1af')]-_0x23acdf,')');}else if(_0x352ee5[_0x1e0e('0x1af')]&&_0x4247af>_0x352ee5[_0x1e0e('0x1af')]+_0x240e47){clearPredictiveAttributes(_0x352ee5);loggerPredictive[_0x1e0e('0x47')](_0x352ee5['name'],_0x1e0e('0x1c5'),_0x4247af,_0x1e0e('0x1c7'),_0x352ee5[_0x1e0e('0x1af')],'+',_0x240e47,'=',_0x352ee5[_0x1e0e('0x1af')]+_0x240e47,')');}};Dialer[_0x1e0e('0x17')]['getDataPredictive']=function(_0x26e8c7){var _0x1a2e30=this;return function(_0x1e3313){return new Promise(function(_0x4e4e0f,_0x24ee83){_[_0x1e0e('0x5c')](_0x26e8c7,_0x1e3313[0x0]);if(checkGetDataPredictive(_0x1e3313[0x0])){var _0x43961e=_0x26e8c7['predictiveIntervalAvailable']=_0x26e8c7['talking']+_0x26e8c7[_0x1e0e('0x130')];var _0x1c0ff2=_0x26e8c7[_0x1e0e('0x1b9')]*0x3c;var _0x365a2b=_0x1e3313[0x0][_0x1e0e('0x51')]+_0x1e3313[0x0][_0x1e0e('0x50')];var _0x4fdfd8=(_0x1e3313[0x0][_0x1e0e('0x4b')]+_0x1e3313[0x0][_0x1e0e('0x4c')]+_0x1e3313[0x0][_0x1e0e('0x4e')])/_0x1e3313[0x0][_0x1e0e('0x1c8')];_0x26e8c7['predictiveIntervalHitRate']=_0x4fdfd8>0x0?_0x4fdfd8:0x1;switch(_0x26e8c7[_0x1e0e('0x1bd')]){case'dropRate':var _0x148f64=_0x26e8c7[_0x1e0e('0x1ac')]/0x64;return _0x1a2e30[_0x1e0e('0x1c9')](_0x43961e,_0x1c0ff2,_0x365a2b,_0x4fdfd8,_0x148f64)[_0x1e0e('0x3e')](function(_0x37a3c8){return _0x4e4e0f(_0x37a3c8);});case _0x1e0e('0x1ca'):var _0x2ce380=_0x26e8c7[_0x1e0e('0x1ac')]/0x64;return _0x1a2e30[_0x1e0e('0x1cb')](_0x43961e,_0x1c0ff2,_0x365a2b,_0x4fdfd8,_0x2ce380)[_0x1e0e('0x3e')](function(_0x2576ad){return _0x4e4e0f(_0x2576ad);});default:return _0x24ee83(msgResponse(_0x1e0e('0x1cc'),_0x1e0e('0x96'),_0x1e0e('0x1cd')));}}else{return _0x24ee83(msgResponse('[getDataPredictive]',_0x1e0e('0x96'),'check\x20failure'));}});};};Dialer['prototype'][_0x1e0e('0x1ce')]=function(_0x11108d){var _0x42b96d=this;return function(_0x4d8bd2){return new Promise(function(_0x585d16,_0x3a0f54){_[_0x1e0e('0x5c')](_0x11108d,_0x4d8bd2[0x0]);if(checkGetDataPredictive(_0x4d8bd2[0x0])){loggerPredictive[_0x1e0e('0x47')](JSON[_0x1e0e('0x75')](_0x4d8bd2[0x0]));if(_0x11108d[_0x1e0e('0x1bd')]===_0x1e0e('0x1cf')){return _0x42b96d[_0x1e0e('0x147')](_0x11108d['id'])[_0x1e0e('0x3e')](function(_0x5d1673){var _0x220e98=_0x11108d[_0x1e0e('0x1d0')]-_0x5d1673[0x0][_0x1e0e('0x1d1')];var _0x58ae29=_0x11108d[_0x1e0e('0x1b9')]*0x3c;var _0x36dd6a=_0x4d8bd2[0x0][_0x1e0e('0x51')]+_0x4d8bd2[0x0][_0x1e0e('0x50')];var _0x5c13c3=(_0x4d8bd2[0x0][_0x1e0e('0x4b')]+_0x4d8bd2[0x0][_0x1e0e('0x4c')]+_0x4d8bd2[0x0][_0x1e0e('0x4e')])/_0x4d8bd2[0x0][_0x1e0e('0x1c8')];var _0x236347=_0x11108d[_0x1e0e('0x1ac')]/0x64;_0x11108d[_0x1e0e('0x1d2')]=_0x5d1673[0x0]['outboundQueuePauses']||0x0;_0x11108d['predictiveIntervalHitRate']=_0x5c13c3>0x0?_0x5c13c3:0x1;return _0x42b96d[_0x1e0e('0x1c9')](_0x220e98,_0x58ae29,_0x36dd6a,_0x5c13c3,_0x236347);})[_0x1e0e('0x3e')](function(_0x30ec34){return _0x585d16(_0x30ec34);})[_0x1e0e('0xa7')](function(_0x246942){return _0x3a0f54(msgResponse(_0x1e0e('0x1d3'),_0x1e0e('0x96'),JSON[_0x1e0e('0x75')](_0x246942)));});}if(_0x11108d[_0x1e0e('0x1bd')]===_0x1e0e('0x1ca')){return _0x42b96d[_0x1e0e('0x147')](_0x11108d['id'])['then'](function(_0x287424){var _0x2caef0=_0x11108d[_0x1e0e('0x1d0')]-_0x287424[0x0][_0x1e0e('0x1d1')];var _0xcf443e=_0x11108d[_0x1e0e('0x1b9')]*0x3c;var _0x442045=_0x4d8bd2[0x0][_0x1e0e('0x51')]+_0x4d8bd2[0x0][_0x1e0e('0x50')];var _0x151ab9=(_0x4d8bd2[0x0][_0x1e0e('0x4b')]+_0x4d8bd2[0x0][_0x1e0e('0x4c')]+_0x4d8bd2[0x0][_0x1e0e('0x4e')])/_0x4d8bd2[0x0][_0x1e0e('0x1c8')];var _0x95d09d=_0x11108d[_0x1e0e('0x1ac')]/0x64;_0x11108d['predictiveIntervalPauses']=_0x287424[0x0][_0x1e0e('0x1d1')]||0x0;_0x11108d['predictiveIntervalHitRate']=_0x151ab9>0x0?_0x151ab9:0x1;return _0x42b96d[_0x1e0e('0x1cb')](_0x2caef0,_0xcf443e,_0x442045,_0x151ab9,_0x95d09d);})[_0x1e0e('0x3e')](function(_0x30c0f4){return _0x585d16(_0x30c0f4);})[_0x1e0e('0xa7')](function(_0x5cae4c){return _0x3a0f54(msgResponse(_0x1e0e('0x1d3'),_0x1e0e('0x96'),JSON['stringify'](_0x5cae4c)));});}}else{return _0x3a0f54(msgResponse(_0x1e0e('0x1cc'),_0x1e0e('0x96'),_0x1e0e('0x1d4')));}});};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1c1')]=function(_0x35eeff){var _0x12dd85=this;return function(){var _0x2913de=0x0;var _0x229531=Math[_0x1e0e('0x1b2')](_0x35eeff[_0x1e0e('0x1d5')]*0x3e8);if(_0x229531>0x0){_0x229531=_0x229531<0x64?0x64:_0x229531;loggerPredictive[_0x1e0e('0x47')](_0x35eeff[_0x1e0e('0x45')],'one\x20call\x20every:',_0x229531,_0x1e0e('0x1d6'));_0x35eeff[_0x1e0e('0x60')]=setInterval(function(){_0x12dd85[_0x1e0e('0x60')](_0x35eeff);loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x1d7'),_0x2913de+=0x1);},_0x229531);}else{loggerPredictive[_0x1e0e('0x47')](_0x35eeff[_0x1e0e('0x45')],_0x1e0e('0x1d8'));}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1d9')]=function(_0x2d5122,_0x3e7352){var _0x4fd0fc=this;return function(_0x2ad3f3){if(_[_0x1e0e('0x79')](_0x2ad3f3)){if(_[_0x1e0e('0xee')](_0x3e7352[_0x1e0e('0x1da')])||!_0x3e7352[_0x1e0e('0x1db')]){if(_0x2d5122[_0x1e0e('0xaf')]==='booked'){_0x2d5122[_0x1e0e('0x72')]=_[_0x1e0e('0x53')](_0x2d5122[_0x1e0e('0x72')])?!![]:_0x2d5122[_0x1e0e('0x72')];var _0x31bd7d=uuid['v4']();_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]=new Action(_0x2d5122,_0x3e7352,_0x31bd7d);loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x1dc'),_0x31bd7d,_0x1e0e('0x1dd'),JSON[_0x1e0e('0x75')](_0x2d5122[_0x1e0e('0x72')]),_0x1e0e('0x1de'),_0x2d5122[_0x1e0e('0x45')]);if(_0x2d5122['queueStatusComplete']){_0x2d5122[_0x1e0e('0x72')]=![];_0x4fd0fc['queueBooked'][_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xbb')]]=[];ami['Action']({'actionid':_0x31bd7d,'action':_0x1e0e('0x1df'),'queue':_0x2d5122['name']})[_0x1e0e('0xa7')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);hopperUtils[_0x1e0e('0xd6')]({'active':![],'ContactId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe4')],'ListId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe5')],'VoiceQueueId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe6')]||undefined,'CampaignId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e0')));delete _0x4fd0fc['actions'][_0x31bd7d];});}else{loggerBooked[_0x1e0e('0x47')](_0x1e0e('0x1e1'),JSON[_0x1e0e('0x75')](_0x2d5122[_0x1e0e('0x72')]),_0x1e0e('0x1de'),_0x2d5122['name']);_0x4fd0fc['updateOriginated'](_0x2d5122);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe4')],'ListId':_0x4fd0fc['actions'][_0x31bd7d][_0x1e0e('0xe5')],'VoiceQueueId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d][_0x1e0e('0xe6')]||undefined,'CampaignId':_0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d]['CampaignId']||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e0')));delete _0x4fd0fc[_0x1e0e('0x21')][_0x31bd7d];}}else{return _0x4fd0fc[_0x1e0e('0x14d')](_0x2d5122,_0x3e7352);}}else{if(utils['getSeconds'](undefined,_0x3e7352[_0x1e0e('0x1e2')])<_0x2d5122[_0x1e0e('0x1e3')]*0x3c){if(_0x3e7352['Agent']&&!_0x3e7352[_0x1e0e('0x13f')]['voicePause']){_0x4fd0fc['preview']['run'](_0x3e7352['id'])[_0x1e0e('0x1a')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);});}else{hopperUtils[_0x1e0e('0x1e4')]({'active':![]},_0x3e7352['id'],0x1)[_0x1e0e('0x1a')](function(){_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);});}}else{_0x2d5122[_0x1e0e('0x1e5')]+=0x1;_0x4fd0fc[_0x1e0e('0xbf')](_0x2d5122);if(_0x2d5122[_0x1e0e('0x1e6')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e7352[_0x1e0e('0xe4')],'ListId':_0x3e7352['ListId'],'VoiceQueueId':_0x3e7352['VoiceQueueId']||undefined,'CampaignId':_0x3e7352[_0x1e0e('0xd9')]||undefined})[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e7')));hopperUtils[_0x1e0e('0xe7')](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')]['QUEUE_RECALL'],0x17,_0x1e0e('0x1e8')))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1e9')));}else{_0x4fd0fc['saveInDb'](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')][_0x1e0e('0x1ea')],0x16,'RecallFailedTimeout'),_0x1e0e('0x1eb'),_0x1e0e('0x1ec'));}}}}else{_0x2d5122[_0x1e0e('0x1ed')]+=0x1;_0x4fd0fc['saveInDb'](createObjHistory(_0x2d5122,_0x3e7352,utils[_0x1e0e('0x68')][_0x1e0e('0x1ee')],0xd,_0x1e0e('0x1ef')),'[Originate][historyBlacklist]',_0x1e0e('0x1f0'));throw _0x1e0e('0x1f1');}};};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1f2')]=function(_0x5aa065){var _0x195a99=this;var _0x11ea29=_0x5aa065[_0x1e0e('0x1f3')]-_0x5aa065['originated'];emitCampaignSummary(_0x5aa065);if(_0x11ea29>0x0&&_0x5aa065[_0x1e0e('0x66')]==0x0){if(_0x11ea29>this[_0x1e0e('0x1f')]){_0x11ea29=this['maxNumberOriginate'];}_0x5aa065[_0x1e0e('0x66')]=0x1;hopperUtils['getContactDialerIvr'](_0x5aa065,_0x11ea29)['then'](function(_0x11d074){_0x5aa065[_0x1e0e('0x66')]=0x0;if(_0x11d074){if(!utils[_0x1e0e('0x1f4')](_0x11d074)){_0x5aa065[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x6d')];logger[_0x1e0e('0x47')](_0x1e0e('0x1f5')+_0x5aa065[_0x1e0e('0x45')]);}else{_0x5aa065[_0x1e0e('0x80')]+=_0x11d074[_0x1e0e('0x99')];_0x5aa065['message']=utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];for(var _0x59b9ca=0x0;_0x59b9ca<_0x11d074['length'];_0x59b9ca+=0x1){_0x5aa065[_0x1e0e('0x1f7')]+=0x1;if(_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca])||_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca][_0x1e0e('0x168')])||_[_0x1e0e('0xee')](_0x11d074[_0x59b9ca]['phone'])){_0x195a99[_0x1e0e('0x1f8')](_0x1e0e('0x1f9'),_0x5aa065,_0x11d074[_0x59b9ca]);}else{hopperUtils['checkIsBlackListIvr'](_['pick'](_0x11d074[_0x59b9ca],[_0x1e0e('0xd9'),_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x195a99[_0x1e0e('0x1d9')](_0x5aa065,_0x11d074[_0x59b9ca]))[_0x1e0e('0xa7')](_0x195a99['loggerHandler'](_0x1e0e('0x1fa'),_0x5aa065));}}}}})[_0x1e0e('0xa7')](loggerGetContactDialer('[getContactCampaign2]',_0x5aa065,_0x11ea29));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0xb1')]=function(_0x1940c1,_0x3d9d5b){var _0x2f7559=this;var _0x4db282=[];if(_0x3d9d5b<0x1||_0x1940c1[_0x1e0e('0xaf')]===_0x1e0e('0x7')){_0x3d9d5b=0x1;}var _0x96d4cd=Math['floor'](_0x1940c1[_0x1e0e('0x130')]*_0x3d9d5b)-_0x1940c1['originated'];if(_0x1940c1[_0x1e0e('0x1fb')]>0x0){var _0x338e83=_0x1940c1[_0x1e0e('0x1fb')]-_0x1940c1[_0x1e0e('0x80')]-_0x1940c1[_0x1e0e('0x131')]-_0x1940c1['pTalking'];if(_0x96d4cd>_0x338e83){_0x96d4cd=_0x338e83;}}if(_0x96d4cd>0x0&&_0x1940c1[_0x1e0e('0x66')]==0x0){if(_0x1940c1[_0x1e0e('0xaf')]==='booked'){_0x96d4cd=0x1;}if(_0x96d4cd>this[_0x1e0e('0x1f')]){_0x96d4cd=this[_0x1e0e('0x1f')];}for(var _0x150c2d in this[_0x1e0e('0xef')]){if(typeof this['agents'][_0x150c2d]!=='undefined'){if(this[_0x1e0e('0xef')][_0x150c2d][_0x1e0e('0x6f')]===_0x1e0e('0x1fc')&&this[_0x1e0e('0xef')][_0x150c2d]['status']===_0x1e0e('0x8b')){_0x4db282[_0x1e0e('0x9e')](this['agents'][_0x150c2d]['id']);}}}_0x1940c1['temp']=0x1;hopperUtils['getContactDialer'](_0x1940c1,_0x4db282,_0x96d4cd)[_0x1e0e('0x3e')](function(_0x1b55f6){_0x1940c1[_0x1e0e('0x66')]=0x0;if(_0x1b55f6){if(!utils[_0x1e0e('0x1f4')](_0x1b55f6)){hopperUtils[_0x1e0e('0x1fd')](_0x1940c1)[_0x1e0e('0x3e')](sendMessageReschedule(_0x1940c1))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1fe')));}else{_0x1940c1['originated']+=_0x1b55f6[_0x1e0e('0x99')];_0x1940c1[_0x1e0e('0x6c')]=_0x1940c1[_0x1e0e('0xaf')]===_0x1e0e('0x7')?utils[_0x1e0e('0x68')][_0x1e0e('0x133')]:utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];for(var _0x281ac1=0x0;_0x281ac1<_0x1b55f6[_0x1e0e('0x99')];_0x281ac1+=0x1){if(_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1])||_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1]['Contact'])||_[_0x1e0e('0xee')](_0x1b55f6[_0x281ac1][_0x1e0e('0x151')])){_0x2f7559[_0x1e0e('0x1f8')]('[actionOriginate]\x20',_0x1940c1,_0x1b55f6[_0x281ac1]);}else{hopperUtils[_0x1e0e('0x1ff')](_['pick'](_0x1b55f6[_0x281ac1],[_0x1e0e('0xe6'),_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x2f7559['checkContactBlack'](_0x1940c1,_0x1b55f6[_0x281ac1]))[_0x1e0e('0xa7')](_0x2f7559['loggerHandler'](_0x1e0e('0x1f9'),_0x1940c1));}}}}})[_0x1e0e('0xa7')](loggerGetContactDialer(_0x1e0e('0x200'),_0x1940c1,_0x96d4cd));}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x60')]=function(_0x8a70be){if(_0x8a70be['dialLimitQueue']>0x0){var _0x2701a6=_0x8a70be[_0x1e0e('0x1fb')]-_0x8a70be['originated']-_0x8a70be['talking'];if(_0x2701a6>0x0&&_0x8a70be[_0x1e0e('0x66')]==0x0){this['tryOriginatePredictive'](_0x8a70be);}else{loggerPredictiveCalls[_0x1e0e('0x47')](_0x1e0e('0x201'));}}else{this['tryOriginatePredictive'](_0x8a70be);}};Dialer[_0x1e0e('0x17')][_0x1e0e('0x202')]=function(_0x81c83a){var _0x36f6b9=this;var _0x32d4a6=[];_0x81c83a['originated']+=0x1;for(var _0x4c9800 in this[_0x1e0e('0xef')]){if(typeof this[_0x1e0e('0xef')][_0x4c9800]!==_0x1e0e('0xaa')){if(this['agents'][_0x4c9800][_0x1e0e('0x6f')]===_0x1e0e('0x1fc')&&this[_0x1e0e('0xef')][_0x4c9800][_0x1e0e('0x8c')]===_0x1e0e('0x8b')){_0x32d4a6['push'](this[_0x1e0e('0xef')][_0x4c9800]['id']);}}}_0x81c83a[_0x1e0e('0x66')]=0x1;return this[_0x1e0e('0x203')](_0x81c83a['id'],_0x32d4a6,0x1,_0x81c83a['dialOrderByScheduledAt'],_0x81c83a)['then'](function(_0x40c004){_0x81c83a[_0x1e0e('0x66')]=0x1;if(_0x40c004){if(!utils[_0x1e0e('0x1f4')](_0x40c004)){utils[_0x1e0e('0x65')](_0x81c83a,0x1,0x0);return hopperUtils['countReScheduled'](_0x81c83a)[_0x1e0e('0x3e')](sendMessageReschedule(_0x81c83a))[_0x1e0e('0xa7')](loggerCatch(_0x1e0e('0x1fe')));}else{_0x81c83a[_0x1e0e('0x6c')]=utils[_0x1e0e('0x68')][_0x1e0e('0x1f6')];if(_[_0x1e0e('0xee')](_0x40c004[0x0])||_[_0x1e0e('0xee')](_0x40c004[0x0][_0x1e0e('0x168')])||_[_0x1e0e('0xee')](_0x40c004[0x0][_0x1e0e('0x151')])){_0x36f6b9[_0x1e0e('0x1f8')](_0x1e0e('0x1f9'),_0x81c83a,_0x40c004[0x0]);}else{return hopperUtils[_0x1e0e('0x1ff')](_['pick'](_0x40c004[0x0],['VoiceQueueId',_0x1e0e('0x151')]))[_0x1e0e('0x3e')](_0x36f6b9[_0x1e0e('0x1d9')](_0x81c83a,_0x40c004[0x0]))['catch'](_0x36f6b9[_0x1e0e('0x148')]('[actionOriginatePredictive]\x20',_0x81c83a));}}}})[_0x1e0e('0xa7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x81c83a,0x1));};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1c9')]=function(_0x1f8e3b,_0x2f7dfb,_0x4f250c,_0x3cc724,_0x45ed0b,_0x45e97c){loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x204'));loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x205'),_0x1f8e3b);loggerPredictive[_0x1e0e('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f7dfb);loggerPredictive['info'](_0x1e0e('0x206'),_0x4f250c);loggerPredictive['info'](_0x1e0e('0x207'),_0x3cc724);loggerPredictive[_0x1e0e('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45ed0b);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));return new Promise(function(_0x4bb09b,_0x4303d3){if(_0x1f8e3b<=0x0||isNaN(_0x1f8e3b)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),_0x1e0e('0x87'),'m\x20=\x20'+_0x1f8e3b));}if(_0x4f250c<=0x0||isNaN(_0x4f250c)){return _0x4303d3(msgResponse('[abandonmentRate]',_0x1e0e('0x87'),_0x1e0e('0x209')+_0x4f250c));}if(_0x3cc724<=0x0||isNaN(_0x3cc724)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),'Error',_0x1e0e('0x20a')+_0x3cc724));}if(_0x2f7dfb<=0x0||isNaN(_0x2f7dfb)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),_0x1e0e('0x87'),_0x1e0e('0x20b')+_0x2f7dfb));}if(_0x45ed0b<=0x0||isNaN(_0x45ed0b)){return _0x4303d3(msgResponse(_0x1e0e('0x208'),'Error',_0x1e0e('0x20c')+_0x45ed0b));}_0x45e97c=_0x45e97c||0x0;var _0x287229=0x1/_0x4f250c;var _0x4cabea=0x0;var _0x13e664=0x0;var _0x5deafc=0x0;var _0x4e3394=0x0;for(var _0x29a5f7=0x0;_0x5deafc<_0x45ed0b;_0x29a5f7+=0x1){_0x13e664=_0x29a5f7/_0x2f7dfb;_0x4cabea=(_0x3cc724*_0x13e664+_0x45e97c)/_0x287229;_0x5deafc=utils[_0x1e0e('0x20d')](_0x4cabea,_0x1f8e3b);_0x4e3394=_0x4cabea/_0x1f8e3b*(0x1-utils[_0x1e0e('0x20d')](_0x4cabea,_0x1f8e3b));}return _0x4bb09b({'erlangCalls':_0x29a5f7,'erlangCallToSecond':_0x2f7dfb/_0x29a5f7,'erlangAbandonmentRate':_0x5deafc,'erlangBusyFactor':_0x4e3394});});};Dialer[_0x1e0e('0x17')][_0x1e0e('0x1cb')]=function(_0x463d69,_0x573e93,_0x3097dc,_0x4a284d,_0x178d60,_0x597e9e){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x205'),_0x463d69);loggerPredictive['info'](_0x1e0e('0x20e'),_0x573e93);loggerPredictive['info'](_0x1e0e('0x206'),_0x3097dc);loggerPredictive['info'](_0x1e0e('0x207'),_0x4a284d);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x20f'),_0x178d60);loggerPredictive[_0x1e0e('0x47')](_0x1e0e('0x52'));return new Promise(function(_0x8cf134,_0x3503b5){if(_0x463d69<=0x0||isNaN(_0x463d69)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),_0x1e0e('0x211')+_0x463d69));}if(_0x3097dc<=0x0||isNaN(_0x3097dc)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),'Error','Ts\x20=\x20'+_0x3097dc));}if(_0x4a284d<=0x0||isNaN(_0x4a284d)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),'p\x20=\x20'+_0x4a284d));}if(_0x573e93<=0x0||isNaN(_0x573e93)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),'Error','interval\x20=\x20'+_0x573e93));}if(_0x178d60<=0x0||isNaN(_0x178d60)){return _0x3503b5(msgResponse(_0x1e0e('0x210'),_0x1e0e('0x87'),_0x1e0e('0x212')+_0x178d60));}_0x597e9e=_0x597e9e||0x0;var _0x4c35f2=0x1/_0x3097dc;var _0x1e7cbb=0x0;var _0x1f7b64=0x0;var _0x41cbb5=0x0;var _0xddea6d=0x0;for(var _0x4a5cfe=0x0;_0xddea6d<_0x178d60;_0x4a5cfe+=0x1){_0x1f7b64=_0x4a5cfe/_0x573e93;_0x1e7cbb=(_0x4a284d*_0x1f7b64+_0x597e9e)/_0x4c35f2;_0x41cbb5=utils[_0x1e0e('0x20d')](_0x1e7cbb,_0x463d69);_0xddea6d=_0x1e7cbb/_0x463d69*(0x1-utils[_0x1e0e('0x20d')](_0x1e7cbb,_0x463d69));}return _0x8cf134({'erlangCalls':_0x4a5cfe,'erlangCallToSecond':_0x573e93/_0x4a5cfe,'erlangAbandonmentRate':_0x41cbb5,'erlangBusyFactor':_0xddea6d});});};module[_0x1e0e('0x213')]=Dialer; \ No newline at end of file +var _0x15d4=['bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','syncQueueSummary','custom:queuesummarycomplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\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','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','isArray','length','Action','command','interval','content','push','iftime\x20%s,%s','indexOf','catch','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','checkIfTime','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncCampaigns]','checkDialMethod','power','handlePower','dialPowerLevel','Queue','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','type','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','TIMEOUT','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','countdropretry','queueCallerAbandonCreateState','rescheduleContact','minutes','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','ListId','[rescheduleContact][Abandoned]','Abandoned','channel','actionid','strategy','rrmemory','isNil','locked','stateinterface','pick','idHopper','syncQueueStatusComplete','roundrobin','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','paused','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','dialGlobalMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','statusMessage','getQueueCampaignStatusMessage','INACTIVE','available','talking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','syncQueueSummaryComplete','throttle','filter','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','object','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','dialMethod','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','getSeconds','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','ACTIVE','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','interval\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x15d4,0x1f0));var _0x415d=function(_0x1bc3de,_0x2a0ea9){_0x1bc3de=_0x1bc3de-0x0;var _0x48e0c6=_0x15d4[_0x1bc3de];return _0x48e0c6;};'use strict';var util=require(_0x415d('0x0'));var _=require(_0x415d('0x1'));var uuid=require('uuid');var moment=require(_0x415d('0x2'));var rr=require('rr');var Redis=require(_0x415d('0x3'));var utils=require(_0x415d('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x415d('0x5'));var config=require(_0x415d('0x6'));var logger=require(_0x415d('0x7'))(_0x415d('0x8'));var loggerBooked=require(_0x415d('0x7'))(_0x415d('0x9'));var loggerPredictive=require(_0x415d('0x7'))(_0x415d('0xa'));var loggerPredictiveCalls=require(_0x415d('0x7'))(_0x415d('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x415d('0xc'));config[_0x415d('0xd')]=_[_0x415d('0xe')](config['redis'],{'host':_0x415d('0xf'),'port':0x18eb});var io=require(_0x415d('0x10'))(new Redis(config[_0x415d('0xd')]));var cmHopper=require(_0x415d('0x11'));var voiceQueueRt=require(_0x415d('0x12'));var RpcSetting=require(_0x415d('0x13'));var Interval=require(_0x415d('0x14'));var Action=require(_0x415d('0x15'));var History=require(_0x415d('0x16'));var Final=require(_0x415d('0x17'));var AgentComplete=require(_0x415d('0x18'));var QueueCallerAbandon=require(_0x415d('0x19'));var Hangup=require(_0x415d('0x1a'));var ipAgi=process[_0x415d('0x1b')][_0x415d('0x1c')]||_0x415d('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x415d('0x1e')]['enqueue']=function(_0x245aad){this[_0x415d('0x1f')]=this['tail']?this[_0x415d('0x1f')][_0x415d('0x20')](_0x245aad):_0x245aad();};function Dialer(_0x360cf6,_0x5678e3){this[_0x415d('0x21')]=new Sequence();this[_0x415d('0x22')]=_0x5678e3;this[_0x415d('0x23')]=_0x360cf6[_0x415d('0x23')];this['campaigns']=_0x360cf6[_0x415d('0x24')];this[_0x415d('0x25')]=_0x360cf6[_0x415d('0x25')];this[_0x415d('0x26')]=_0x360cf6[_0x415d('0x26')];this[_0x415d('0x27')]=config[_0x415d('0x27')]||0x2;this[_0x415d('0x28')]={};this[_0x415d('0x29')]={};this[_0x415d('0x2a')]={};this[_0x415d('0x2b')]={};this[_0x415d('0x2c')]={};this['startPredictive']={};this[_0x415d('0x2d')]={};this[_0x415d('0x2e')]={};this[_0x415d('0x2f')]={};this[_0x415d('0x30')]={};this[_0x415d('0x31')]={};ami['on'](_0x415d('0x32'),this[_0x415d('0x33')][_0x415d('0x34')](this));ami['on'](_0x415d('0x35'),this['syncQueueCallerAbandon'][_0x415d('0x34')](this));ami['on']('originateresponse',this[_0x415d('0x36')][_0x415d('0x34')](this));ami['on']('agentcomplete',this[_0x415d('0x37')]['bind'](this));ami['on']('custom:queuesummary',this[_0x415d('0x38')][_0x415d('0x34')](this));ami['on'](_0x415d('0x39'),this['syncQueueSummaryComplete'][_0x415d('0x34')](this));ami['on'](_0x415d('0x3a'),this[_0x415d('0x3b')][_0x415d('0x34')](this));ami['on'](_0x415d('0x3c'),this[_0x415d('0x3d')]['bind'](this));ami['on'](_0x415d('0x3e'),this['syncVarSet'][_0x415d('0x34')](this));ami['on'](_0x415d('0x3f'),this[_0x415d('0x40')]['bind'](this));ami['on'](_0x415d('0x41'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x415d('0x42')]()[_0x415d('0x43')](function(_0x15b3d2){previewRecallmeReminderInterval=_0x15b3d2[_0x415d('0x44')];});}function isNotNull(_0x81d6fc){return _0x81d6fc!==null&&!_[_0x415d('0x45')](_0x81d6fc);}function msgResponse(_0x505a50,_0x11609f,_0x203872){return{'action':_0x505a50,'response':_0x11609f,'message':_0x203872,'stack':_0x203872};}function emit(_0x4ba753,_0x570f6e,_0x77a61){io['to'](_0x4ba753)[_0x415d('0x46')](_0x570f6e,_0x77a61);}function emitOutboundVoiceQueueSummary(_0x383831){if(_0x383831['type']===_0x415d('0x47')){logger['debug'](_0x415d('0x48'),util[_0x415d('0x49')](_0x383831,{'showHidden':![],'depth':null}));emit(util['format'](_0x415d('0x4a'),_0x383831[_0x415d('0x4b')]),_0x415d('0x4c'),_0x383831);}}function checkGetDataPredictive(_0x1293cb){if(isNotNull(_0x1293cb)&&!_[_0x415d('0x4d')](_0x1293cb)){loggerPredictive[_0x415d('0x4e')](_0x415d('0x4f'));loggerPredictive[_0x415d('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1293cb[_0x415d('0x50')]);loggerPredictive[_0x415d('0x4e')](_0x415d('0x51'),_0x1293cb[_0x415d('0x52')]);loggerPredictive['info'](_0x415d('0x53'),_0x1293cb[_0x415d('0x54')]);loggerPredictive[_0x415d('0x4e')](_0x415d('0x55'),_0x1293cb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x415d('0x4e')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1293cb[_0x415d('0x56')]);loggerPredictive[_0x415d('0x4e')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1293cb[_0x415d('0x57')]);loggerPredictive[_0x415d('0x4e')](_0x415d('0x58'));if(_0x1293cb['predictiveIntervalTotalCalls']>0x0){if(!_[_0x415d('0x45')](_0x1293cb[_0x415d('0x57')])&&_0x1293cb[_0x415d('0x57')]>0x0){return!![];}loggerPredictive[_0x415d('0x4e')](_0x415d('0x59'));if(!_[_0x415d('0x45')](_0x1293cb['predictiveIntervalAvgHoldtime'])&&_0x1293cb[_0x415d('0x56')]>0x0){return!![];}loggerPredictive[_0x415d('0x4e')](_0x415d('0x5a'));}else{loggerPredictive['info'](_0x415d('0x5b'));}}else{loggerPredictive[_0x415d('0x4e')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x244826){return function(_0x4d14d0){loggerPredictive[_0x415d('0x4e')](_0x415d('0x5c'));loggerPredictive[_0x415d('0x4e')](_0x415d('0x5d'),_0x4d14d0[_0x415d('0x5e')]);loggerPredictive[_0x415d('0x4e')](_0x415d('0x5f'),_0x4d14d0[_0x415d('0x60')]);loggerPredictive['info'](_0x415d('0x61'),_0x4d14d0['erlangAbandonmentRate']);loggerPredictive[_0x415d('0x4e')](_0x415d('0x62'),_0x4d14d0[_0x415d('0x63')]);loggerPredictive[_0x415d('0x4e')](_0x415d('0x61'),_0x4d14d0['erlangAbandonmentRate']);loggerPredictive[_0x415d('0x4e')](_0x415d('0x58'));_[_0x415d('0x64')](_0x244826,_0x4d14d0);};}function ifInterval(_0x7a8f83,_0x5124ae){if(_[_0x415d('0x45')](_0x5124ae)){return![];}return utils['getSeconds'](undefined,_0x5124ae)<_0x7a8f83*0x3c;}function clearPredictiveAttributes(_0x25ed4f){if(_0x25ed4f['startProgressive']){_0x25ed4f[_0x415d('0x2d')]=undefined;loggerPredictive[_0x415d('0x65')](_0x25ed4f[_0x415d('0x4b')],_0x415d('0x66'));}if(_0x25ed4f[_0x415d('0x67')]){_0x25ed4f['startPredictive']=undefined;loggerPredictive[_0x415d('0x65')](_0x25ed4f['name'],_0x415d('0x68'));}if(_0x25ed4f[_0x415d('0x69')]){clearInterval(_0x25ed4f[_0x415d('0x69')]);_0x25ed4f[_0x415d('0x69')]=undefined;loggerPredictive[_0x415d('0x65')](_0x25ed4f[_0x415d('0x4b')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x4edaac,_0x215db3){return function(_0x69f722){loggerPredictive[_0x415d('0x6a')](_0x215db3[_0x415d('0x4b')],_0x4edaac);loggerPredictive['error'](_0x69f722[_0x415d('0x6b')]);clearPredictiveAttributes(_0x215db3);};}function loggerCatch(_0x49ba0b){return function(_0x3cd7fb){logger[_0x415d('0x6a')](_0x49ba0b,util[_0x415d('0x49')](_0x3cd7fb,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4498e1,_0x51d248,_0x12a9ea){return function(_0x54cbd0){utils[_0x415d('0x6c')](_0x51d248,_0x12a9ea,0x0);_0x51d248[_0x415d('0x6d')]=0x0;logger[_0x415d('0x6a')](_0x4498e1,util['inspect'](_0x54cbd0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1fc3d1){return function(_0x40acd){if(isNotNull(_0x40acd)&&isNotNull(_0x40acd[0x0])){if(_0x40acd[0x0][_0x415d('0x6e')]>0x0){_0x1fc3d1[_0x415d('0x6f')]=utils[_0x415d('0x70')][_0x415d('0x71')];logger['info']('[getContactDialer2][ReScheduled]'+_0x1fc3d1[_0x415d('0x4b')],_0x40acd[0x0][_0x415d('0x6e')],_0x415d('0x72'));}else{_0x1fc3d1['message']=utils[_0x415d('0x70')][_0x415d('0x73')];logger[_0x415d('0x4e')](_0x415d('0x74')+_0x1fc3d1[_0x415d('0x4b')]);}}};}function createObjHistory(_0x38384f,_0x44419e,_0x3e39be,_0x18921e,_0xd13f43){_0x38384f[_0x415d('0x6f')]=_0x3e39be;var _0x2ba972=new Action(_0x38384f,_0x44419e);var _0x1cfd4c=new History(_0x2ba972);_0x1cfd4c[_0x415d('0x75')]=_0x18921e;_0x1cfd4c['statedesc']=_0xd13f43;_0x1cfd4c[_0x415d('0x76')]=_0x2ba972[_0x415d('0x77')];return _0x1cfd4c;}function unlockQueueStatus(_0x295a98,_0x29aeb7){setTimeout(function(){if(_[_0x415d('0x45')](_0x295a98[_0x415d('0x78')])){loggerBooked[_0x415d('0x6a')](_0x415d('0x79'),_0x29aeb7);}_0x295a98[_0x415d('0x78')]=!![];loggerBooked['info'](_0x415d('0x7a'),_0x29aeb7,JSON[_0x415d('0x7b')](_['pick'](_0x295a98,[_0x415d('0x4b'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x66caa8){return function(){if(!isNotNull(_0x66caa8['Interval'])){_0x66caa8[_0x415d('0x6f')]=utils[_0x415d('0x70')][_0x415d('0x7c')];throw _0x66caa8['name']+_0x415d('0x7d');}if(!isNotNull(_0x66caa8[_0x415d('0x7e')][_0x415d('0x7f')])){_0x66caa8[_0x415d('0x6f')]=utils[_0x415d('0x70')]['NULL_INTERVAL'];throw _0x66caa8[_0x415d('0x4b')]+_0x415d('0x7d');}if(!isNotNull(_[_0x415d('0x4d')](_0x66caa8[_0x415d('0x7e')][_0x415d('0x7f')]))){_0x66caa8[_0x415d('0x6f')]=utils[_0x415d('0x70')][_0x415d('0x7c')];throw _0x66caa8[_0x415d('0x4b')]+_0x415d('0x7d');}};}function checkIsIVRCampaignActive(_0x5e1237){return function(){if(!utils[_0x415d('0x80')](_0x5e1237)){_0x5e1237['message']=utils[_0x415d('0x70')]['INACTIVE'];throw _0x5e1237[_0x415d('0x4b')]+_0x415d('0x81');}};}function emitCampaignSummary(_0x5e0f0e){if(utils[_0x415d('0x82')](_0x5e0f0e)){emit(util[_0x415d('0x83')](_0x415d('0x84'),_0x5e0f0e[_0x415d('0x4b')]),_0x415d('0x85'),_0x5e0f0e);}}function loggerCatchQueueSummary(_0x3ba91c,_0xb87b80){return function(_0x149e00){clearPredictiveAttributes(_0xb87b80);emitCampaignSummary(_0xb87b80);loggerSyncQueueSummary[_0x415d('0x65')](_0x3ba91c,util[_0x415d('0x49')](_0x149e00,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x593635){if(_0x593635[_0x415d('0x86')]){if(_0x593635['originated']===0x0){_0x593635['sendMessageOneNotActive']=![];_0x593635[_0x415d('0x6f')]=utils['CAMPAIGN_STATUS']['INACTIVE'];loggerSyncQueueSummary[_0x415d('0x65')](_0x415d('0x87'),_0x593635['name'],_0x415d('0x88'));}else{_0x593635[_0x415d('0x6f')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary['debug'](_0x415d('0x87'),_0x593635[_0x415d('0x4b')],_0x415d('0x89'));}emitCampaignSummary(_0x593635);}}function myreject(_0x5318af){return function(_0x4f88ae){return _0x5318af(msgResponse(_0x415d('0x8a'),_0x415d('0x8b'),JSON['stringify'](_0x4f88ae)));};}Dialer[_0x415d('0x1e')][_0x415d('0x8c')]=function(_0x2ff958){return!_[_0x415d('0x45')](_0x2ff958)&&_0x2ff958&&!_['isUndefined'](_0x2ff958[_0x415d('0x4b')])&&!_[_0x415d('0x45')](_0x2ff958[_0x415d('0x8d')])&&_0x2ff958['active']&&(this[_0x415d('0x26')][util[_0x415d('0x83')](_0x415d('0x8e'),_0x2ff958[_0x415d('0x4b')])]['status']==='reachable'||this['trunks'][util[_0x415d('0x83')](_0x415d('0x8e'),_0x2ff958[_0x415d('0x4b')])][_0x415d('0x8f')]===_0x415d('0x90'));};Dialer[_0x415d('0x1e')][_0x415d('0x91')]=function(_0x38445f){var _0x251d18=this;return function(){if(!_0x251d18[_0x415d('0x8c')](_0x38445f[_0x415d('0x92')])){if(!_0x251d18[_0x415d('0x8c')](_0x38445f[_0x415d('0x93')])){_0x38445f[_0x415d('0x6f')]=utils[_0x415d('0x70')]['TRUNK_NOT_REACHABLE'];throw _0x38445f[_0x415d('0x4b')]+_0x415d('0x94');}}};};Dialer[_0x415d('0x1e')]['checkIfTime']=function(_0x1b3516,_0x22e41b,_0x57260f,_0x45ad9b){var _0x46c9aa=this;return function(){var _0x35b0ec=!![];return _0x46c9aa['ifTimeIvr'](_0x1b3516,_0x22e41b,_0x57260f,_0x45ad9b,_0x35b0ec);};};Dialer[_0x415d('0x1e')]['checkIfTimeIntervals']=function(_0x4399f7,_0x3633c9,_0x1c60ed,_0x168b3e){var _0x54c321=this;return function(){var _0x3937c8=![];return _0x54c321['ifTimeIvr'](_0x4399f7['Intervals'],_0x3633c9,_0x1c60ed,_0x168b3e,_0x3937c8);};};Dialer[_0x415d('0x1e')][_0x415d('0x95')]=function(_0x22465a,_0xc7a287,_0x12d00f,_0x425e46,_0x5cd71e){var _0x1457fe=[];return new Promise(function(_0xc8a087,_0x3cc160){if(!isNotNull(_0x22465a)){_0x425e46[_0x415d('0x6f')]=utils[_0x415d('0x70')]['NULL_INTERVAL'];return _0x3cc160(msgResponse('ifTime',_0x415d('0x96'),_0x12d00f+_0x415d('0x97')));}if(_[_0x415d('0x4d')](_0x22465a)){_0x425e46[_0x415d('0x6f')]=utils[_0x415d('0x70')][_0x415d('0x98')];return _0x3cc160(msgResponse('ifTime',_0x415d('0x96'),_0x12d00f+_0x415d('0x99')));}if(_0xc7a287&&_[_0x415d('0x45')](config[_0x415d('0x9a')][_0xc7a287])){_0x425e46[_0x415d('0x6f')]=utils[_0x415d('0x70')][_0x415d('0x9b')];return _0x3cc160(msgResponse(_0x415d('0x9c'),_0x415d('0x96'),_0x12d00f+'\x20Timezone\x20unknow\x20'+_0xc7a287));}if(_[_0x415d('0x9d')](_0x22465a)){for(var _0x60a700=0x0;_0x60a700<_0x22465a[_0x415d('0x9e')];_0x60a700+=0x1){_0x1457fe['push'](ami[_0x415d('0x9f')]({'action':_0x415d('0xa0'),'command':util[_0x415d('0x83')]('iftime\x20%s,%s',_0x22465a[_0x60a700][_0x415d('0xa1')],!_[_0x415d('0x45')](config[_0x415d('0x9a')][_0xc7a287])?_0xc7a287:'')})[_0x415d('0x43')](function(_0x241fc4){return _0x241fc4[_0x415d('0xa2')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x3cc160)));}}else{_0x1457fe[_0x415d('0xa3')](ami['Action']({'action':'command','command':util[_0x415d('0x83')](_0x415d('0xa4'),_0x22465a,!_[_0x415d('0x45')](config[_0x415d('0x9a')][_0xc7a287])?_0xc7a287:'')})[_0x415d('0x43')](function(_0xbfbeb){return _0xbfbeb[_0x415d('0xa2')][_0x415d('0xa5')]('true')>=0x0;})[_0x415d('0xa6')](myreject(_0x3cc160)));}Promise[_0x415d('0xa7')](_0x1457fe)[_0x415d('0x43')](function(_0x580db2){var _0x2d6344=_[_0x415d('0xa8')](_0x580db2);if(_0x2d6344){return _0xc8a087(_0x2d6344);}else{_0x425e46[_0x415d('0x6f')]=_0x5cd71e?utils[_0x415d('0x70')][_0x415d('0xa9')]:utils[_0x415d('0x70')]['OVERTIME_INTERVAL'];return _0x3cc160(msgResponse(_0x415d('0xaa'),_0x415d('0x96'),_0x415d('0xab')+_0x5cd71e+'\x20'+_0x12d00f+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x22465a,{'showHidden':![],'depth':null})+_0x415d('0xac')+_0xc7a287));}})[_0x415d('0xa6')](function(_0x10ef69){return _0x3cc160(msgResponse(_0x415d('0x9c'),_0x415d('0x96'),JSON[_0x415d('0x7b')](_0x10ef69)));});});};Dialer[_0x415d('0x1e')][_0x415d('0xad')]=function(){var _0x302a2e=this;return cmHopper[_0x415d('0xae')]({'active':![]},{'where':{'active':!![]}})[_0x415d('0x43')](function(){setInterval(function(){_0x302a2e[_0x415d('0xaf')]();},0x3e8);});};Dialer['prototype'][_0x415d('0xaf')]=function(){var _0x3518d4=this;var _0x1ab4da;for(var _0x43dbdb in this[_0x415d('0x24')]){if(typeof this[_0x415d('0x24')][_0x43dbdb]!==_0x415d('0xb0')){_0x1ab4da=this['campaigns'][_0x43dbdb];if(utils[_0x415d('0x82')](_0x1ab4da)&&utils[_0x415d('0x80')](_0x1ab4da)){_0x1ab4da['sendMessageOneNotActive']=!![];Promise[_0x415d('0xb1')]()[_0x415d('0x43')](checkIsIVRCampaignActive(_0x1ab4da))[_0x415d('0x43')](checkInterval(_0x1ab4da))[_0x415d('0x43')](_0x3518d4[_0x415d('0x91')](_0x1ab4da))[_0x415d('0x43')](_0x3518d4[_0x415d('0xb2')](_0x1ab4da[_0x415d('0xb3')],_0x1ab4da['dialTimezone'],_0x1ab4da[_0x415d('0x4b')],_0x1ab4da))['then'](_0x3518d4[_0x415d('0xb4')](_0x1ab4da[_0x415d('0x7e')],_0x1ab4da[_0x415d('0xb5')],_0x1ab4da[_0x415d('0x4b')],_0x1ab4da))[_0x415d('0x43')](_0x3518d4['launchHandleIvr'](_0x1ab4da))[_0x415d('0xa6')](loggerCatchQueueSummary(_0x415d('0xb6'),_0x1ab4da));}else{notSendMessagesCampaign(_0x1ab4da);}}}};Dialer[_0x415d('0x1e')][_0x415d('0xb7')]=function(_0x2bcf2a){if(_0x2bcf2a['dialMethod']!=='predictive'){clearPredictiveAttributes(_0x2bcf2a);}switch(_0x2bcf2a['dialMethod']){case'progressive':this['handlePower'](_0x2bcf2a,0x1);break;case _0x415d('0xb8'):this[_0x415d('0xb9')](_0x2bcf2a,_0x2bcf2a[_0x415d('0xba')]);break;case _0x415d('0xa'):this['predictive'](_0x2bcf2a);break;case _0x415d('0x9'):this[_0x415d('0xb9')](_0x2bcf2a,0x1);break;default:logger[_0x415d('0x6a')](_0x415d('0xbb'),_0x2bcf2a['name'],'method\x20not\x20recognized');}};Dialer[_0x415d('0x1e')][_0x415d('0x9c')]=function(_0x29b73c,_0x814dac){var _0x2deb1e=_0x29b73c[_0x415d('0xb5')];var _0x304c5e=_0x814dac?_0x29b73c[_0x415d('0xb3')]:_0x29b73c[_0x415d('0x7e')]['Intervals'];logger['silly'](_0x415d('0xbc'),_0x304c5e,_0x2deb1e,_0x29b73c[_0x415d('0x4b')],util[_0x415d('0x83')](_0x415d('0xbd'),_0x29b73c[_0x415d('0x4b')],_0x29b73c['id']));var _0x4f1f4c=null;return Interval['intervalIftime'](_0x304c5e,_0x2deb1e)['then'](function(_0x1f8f04){if(_0x1f8f04===!![]){return _0x1f8f04;}else{_0x29b73c['message']=_0x814dac?utils[_0x415d('0x70')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x415d('0xbe')];_0x4f1f4c=msgResponse(_0x415d('0xaa'),'Failure',_0x415d('0xab')+_0x814dac+'\x20'+_0x29b73c[_0x415d('0x4b')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x304c5e,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2deb1e);}if(_0x4f1f4c!==null){logger[_0x415d('0xbf')](_0x415d('0xc0'),_0x4f1f4c);_0x4f1f4c[_0x415d('0xc1')]=_0x814dac;throw _0x4f1f4c;}})[_0x415d('0xa6')](function(_0x42d92b){logger['error'](_0x415d('0xc2'),_0x42d92b);throw msgResponse(_0x415d('0x8a'),_0x415d('0x8b'),util[_0x415d('0x49')](_0x42d92b,{'showHidden':![],'depth':null}));});};Dialer[_0x415d('0x1e')]['syncAgentConnect']=function(_0x3446c2){if(this[_0x415d('0x23')][_0x3446c2['queue']]){if(this[_0x415d('0x2b')][_0x3446c2[_0x415d('0xc3')]]&&this[_0x415d('0x2b')][_0x3446c2[_0x415d('0xc3')]][_0x415d('0xc4')]!==_0x415d('0xc5')){this[_0x415d('0xc6')](this[_0x415d('0x23')][_0x3446c2['queue']]);this[_0x415d('0x2b')][_0x3446c2[_0x415d('0xc3')]][_0x415d('0xc7')]=moment()['format'](_0x415d('0xc8'));}}};Dialer[_0x415d('0x1e')]['syncAgentComplete']=function(_0x27738a){var _0x19197d=this['uniqueId'][_0x27738a['uniqueid']];if(this['voiceQueues'][_0x27738a[_0x415d('0xc9')]]){if(_0x19197d&&_0x19197d[_0x415d('0xc4')]!==_0x415d('0xc5')){delete this[_0x415d('0x2b')][_0x27738a[_0x415d('0xc3')]];this[_0x415d('0x23')][_0x27738a['queue']]['outboundAnswerCallsDay']+=0x1;var _0x4645ab=new AgentComplete(_0x19197d,_0x27738a);if(_0x27738a[_0x415d('0xca')]===_0x415d('0xcb')){_0x4645ab[_0x415d('0xcc')]=this['voiceQueues'][_0x27738a[_0x415d('0xc9')]][_0x415d('0xcd')]&&this['voiceQueues'][_0x27738a[_0x415d('0xc9')]][_0x415d('0xce')]?moment()['format'](_0x415d('0xc8')):undefined;}hopperUtils[_0x415d('0xcf')](_0x4645ab)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x415d('0xd0')](_0x4645ab)['catch'](loggerCatch(_0x415d('0xd1')));}}};Dialer['prototype'][_0x415d('0xd2')]=function(_0x236d53){var _0xb71ee1=this[_0x415d('0x2b')][_0x236d53['uniqueid']];var _0x48d8a7=this;var _0x200c0a=![];var _0x2289e1;var _0x177aea;if(this[_0x415d('0x23')][_0x236d53['queue']]){if(_0xb71ee1&&_0xb71ee1[_0x415d('0xc4')]!==_0x415d('0xc5')){delete this['uniqueId'][_0x236d53[_0x415d('0xc3')]];this[_0x415d('0xc6')](this['voiceQueues'][_0x236d53[_0x415d('0xc9')]]);_0xb71ee1[_0x415d('0xd3')]=moment()[_0x415d('0x83')](_0x415d('0xc8'));var _0x247797=new QueueCallerAbandon(_0xb71ee1,_0x236d53);if(utils['getSeconds'](_0xb71ee1['droptime'],_0xb71ee1['responsetime'])>=_0xb71ee1[_0x415d('0xd4')]){this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x415d('0x23')][_0x236d53['queue']][_0x415d('0xd5')]+=0x1;this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x247797[_0x415d('0x75')]=0xa;_0x247797[_0x415d('0xd6')]=_0x415d('0xd7');_0x247797[_0x415d('0xd8')]=_0x415d('0xd9');_0x247797[_0x415d('0xcc')]=this['voiceQueues'][_0x236d53[_0x415d('0xc9')]][_0x415d('0xcd')]?moment()[_0x415d('0x83')](_0x415d('0xc8')):undefined;_0x247797['countdropretry']+=0x1;_0x247797[_0x415d('0xda')]+=0x1;_0x2289e1=this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]][_0x415d('0xdb')];_0x177aea=this[_0x415d('0x23')][_0x236d53['queue']][_0x415d('0xdc')];hopperUtils[_0x415d('0xdd')](_0x247797,_0x247797[_0x415d('0x75')],_0xb71ee1['voiceQueue'])[_0x415d('0x43')](function(_0x5be00a){_0x200c0a=_0x5be00a[_0x415d('0xde')]==0x1;if(_0x247797[_0x415d('0xdf')]>=_0x48d8a7[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]]['dialDropMaxRetry']){_0x48d8a7[_0x415d('0xe0')](_0x247797,_0x5be00a[_0x415d('0xde')]);}else{hopperUtils[_0x415d('0xe1')]({'active':![],'countdropretry':_0x247797[_0x415d('0xdf')],'scheduledat':moment()['add'](_0x48d8a7['voiceQueues'][_0x236d53[_0x415d('0xc9')]][_0x415d('0xdb')],_0x415d('0xe2'))[_0x415d('0x83')](_0x415d('0xc8')),'ContactId':_0xb71ee1[_0x415d('0xe3')],'ListId':_0xb71ee1['ListId'],'VoiceQueueId':_0xb71ee1[_0x415d('0xe4')]||undefined,'CampaignId':_0xb71ee1[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0xe6')));var _0x3be159=new History(_0x247797);_0x3be159[_0x415d('0x75')]=0xa;_0x3be159[_0x415d('0xd6')]=_0x415d('0xd7');_0x3be159['starttime']=moment()[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss');_0x3be159['endtime']=_0x3be159[_0x415d('0x77')];_0x3be159[_0x415d('0xe7')]=_0x247797[_0x415d('0xe7')];_0x3be159['calleridnum']=_0x247797[_0x415d('0xe8')];hopperUtils[_0x415d('0xcf')](_0x3be159)[_0x415d('0xa6')](loggerCatch(_0x415d('0xe9')));}})[_0x415d('0x43')](function(){if(_0x200c0a)hopperUtils[_0x415d('0xea')](_0x247797,_0x2289e1,_0x177aea)['then'](function(){return 0x1;});});}else{this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]][_0x415d('0xeb')]+=0x1;this[_0x415d('0x23')][_0x236d53['queue']][_0x415d('0xec')]+=0x1;_0x247797[_0x415d('0x75')]=0xb;_0x247797[_0x415d('0xd6')]='Abandoned';_0x247797[_0x415d('0xd8')]=_0x415d('0xed');_0x247797[_0x415d('0xee')]+=0x1;_0x247797[_0x415d('0xda')]+=0x1;_0x2289e1=this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]]['dialAbandonedRetryFrequency'];_0x177aea=this[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]][_0x415d('0xdc')];hopperUtils[_0x415d('0xdd')](_0x247797,_0x247797[_0x415d('0x75')],_0xb71ee1[_0x415d('0xef')])[_0x415d('0x43')](function(_0xe26fcf){if(_0x247797[_0x415d('0xee')]>=_0x48d8a7[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]][_0x415d('0xf0')]){_0x48d8a7['queueCallerAbandonCreateState'](_0x247797,_0xe26fcf[_0x415d('0xde')]);}else{hopperUtils[_0x415d('0xe1')]({'active':![],'countabandonedretry':_0x247797[_0x415d('0xee')],'scheduledat':moment()['add'](_0x48d8a7[_0x415d('0x23')][_0x236d53[_0x415d('0xc9')]][_0x415d('0xf1')],'minutes')['format'](_0x415d('0xc8')),'ContactId':_0xb71ee1[_0x415d('0xe3')],'ListId':_0xb71ee1[_0x415d('0xf2')],'VoiceQueueId':_0xb71ee1[_0x415d('0xe4')]||undefined,'CampaignId':_0xb71ee1['CampaignId']||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0xf3')));var _0x1a18b3=new History(_0x247797);_0x1a18b3['state']=0xb;_0x1a18b3[_0x415d('0xd6')]=_0x415d('0xf4');_0x1a18b3[_0x415d('0x77')]=moment()[_0x415d('0x83')](_0x415d('0xc8'));_0x1a18b3['endtime']=_0x1a18b3[_0x415d('0x77')];_0x1a18b3[_0x415d('0xe7')]=_0x247797[_0x415d('0xe7')];_0x1a18b3[_0x415d('0xe8')]=_0x247797['calleridnum'];hopperUtils['createHistory'](_0x1a18b3)[_0x415d('0xa6')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x415d('0x43')](function(){if(_0x200c0a)hopperUtils[_0x415d('0xea')](_0x247797,_0x2289e1,_0x177aea)['then'](function(){return 0x1;});});}}}};Dialer[_0x415d('0x1e')][_0x415d('0x3d')]=function(_0x403e3c){if(this['actions'][_0x403e3c[_0x415d('0xc3')]]){this[_0x415d('0x29')][_0x403e3c['uniqueid']][_0x415d('0xf5')]=_0x403e3c[_0x415d('0xf5')];}if(this['uniqueId'][_0x403e3c[_0x415d('0xc3')]]){this['uniqueId'][_0x403e3c[_0x415d('0xc3')]][_0x415d('0xf5')]=_0x403e3c[_0x415d('0xf5')];}};Dialer[_0x415d('0x1e')][_0x415d('0x40')]=function(_0x2c7556){if(!this['actions'][_0x2c7556[_0x415d('0xf6')]]){return;}var _0x1829fb=this[_0x415d('0x23')][this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]]['queue']][_0x415d('0xf7')]||_0x415d('0xf8');if(_0x1829fb==='roundrobin'){if(this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]]&&_[_0x415d('0xf9')](this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xfa')])&&_0x2c7556[_0x415d('0x8f')]==='1'&&_0x2c7556['paused']==='0'){if(this['agents'][_0x2c7556[_0x415d('0xfb')]]){if(!this['agents'][_0x2c7556['stateinterface']][_0x415d('0xfa')]){this[_0x415d('0x25')][_0x2c7556[_0x415d('0xfb')]]['locked']=!![];this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xfa')]=!![];this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xfb')]=_0x2c7556[_0x415d('0xfb')];}}}}else if(_0x1829fb==='rrmemory'){if(this[_0x415d('0x29')][_0x2c7556['actionid']]){if(this[_0x415d('0x25')][_0x2c7556[_0x415d('0xfb')]]){this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xfb')]=_0x2c7556['stateinterface'];if(_[_0x415d('0xf9')](this[_0x415d('0x2f')][this['actions'][_0x2c7556['actionid']][_0x415d('0xc9')]])){this[_0x415d('0x2f')][this['actions'][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xc9')]]=[];}this[_0x415d('0x2f')][this['actions'][_0x2c7556[_0x415d('0xf6')]][_0x415d('0xc9')]][_0x415d('0xa3')](_[_0x415d('0x64')](_[_0x415d('0xfc')](this[_0x415d('0x29')][_0x2c7556[_0x415d('0xf6')]],[_0x415d('0xfd'),_0x415d('0xfb')]),{'status':_0x2c7556[_0x415d('0x8f')],'paused':_0x2c7556['paused']}));}}}};Dialer[_0x415d('0x1e')][_0x415d('0xfe')]=function(_0x45340b){if(!this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]){return;}var _0x36ac10=this;var _0x1cb527=this[_0x415d('0x23')][this['actions'][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]];var _0x1fec62=_0x1cb527[_0x415d('0xf7')]||_0x415d('0xf8');if(_0x1fec62===_0x415d('0xff')){if(this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]&&this['actions'][_0x45340b[_0x415d('0xf6')]][_0x415d('0xfb')]){this[_0x415d('0x22')][_0x415d('0x100')](this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xfd')],this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xfb')])[_0x415d('0xa6')](function(_0x17214c){logger[_0x415d('0x6a')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x415d('0x49')](_0x17214c,{'showHidden':![],'depth':null}));})['finally'](function(){_0x36ac10[_0x415d('0xc6')](_0x36ac10[_0x415d('0x23')][_0x36ac10[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]]);_0x36ac10[_0x415d('0x25')][_0x36ac10[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xfb')]]['locked']=![];delete _0x36ac10[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]];unlockQueueStatus(_0x1cb527);});}else{this['updateOriginated'](this['voiceQueues'][this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]['queue']]);hopperUtils[_0x415d('0xe1')]({'active':![],'ContactId':this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xe3')],'ListId':this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]['ListId'],'VoiceQueueId':this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xe4')]||undefined,'CampaignId':this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]['CampaignId']||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x101')));delete this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]];unlockQueueStatus(_0x1cb527);}}else if(_0x1fec62===_0x415d('0xf8')){var _0x3c63a4;if(this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]&&!_[_0x415d('0x4d')](this['queueBooked'][this['actions'][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]])){if(this[_0x415d('0x30')][_0x36ac10['actions'][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]]){this[_0x415d('0x30')][_0x36ac10[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]]=this[_0x415d('0x30')][this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]]?this['queueBookedRR'][this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]]:this[_0x415d('0x2f')][this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]]['queue']]?this[_0x415d('0x2f')][this[_0x415d('0x29')][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]][_0x415d('0x102')]||0x0:0x0;}this[_0x415d('0x2f')][this[_0x415d('0x29')][_0x45340b['actionid']][_0x415d('0xc9')]][_0x415d('0x102')]=this[_0x415d('0x30')][this['actions'][_0x45340b[_0x415d('0xf6')]][_0x415d('0xc9')]];for(var _0x168bdf=0x0;_0x168bdf=_0x103a04['dialGlobalMaxRetry']){_0x195a35[_0x415d('0x12a')](_0x2b7edc,_0x2753d4,_0x1e357e,_0x415d('0x12b'));}else{if(_0x2b7edc[_0x415d('0x124')]>=_0x103a04[_0x415d('0x12c')]){_0x195a35[_0x415d('0x12d')](_0x2b7edc,_0x2753d4,_0x1e357e,_0x415d('0x12e'));}else{hopperUtils[_0x415d('0xe1')]({'active':![],'countmachineretry':_0x2b7edc[_0x415d('0x124')],'scheduledat':moment()[_0x415d('0x12f')](_0x103a04[_0x415d('0x130')],'minutes')[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b7edc['ContactId'],'ListId':_0x2b7edc[_0x415d('0xf2')],'VoiceQueueId':_0x2b7edc['VoiceQueueId']||undefined,'CampaignId':_0x2b7edc[_0x415d('0xe5')]||undefined})['catch'](loggerCatch(_0x415d('0x131')));_0x2753d4({'reschedule':0x1});}}});}if(_0x122b61[_0x415d('0xc4')]===_0x415d('0xc5')&&this[_0x415d('0x24')][_0x122b61[_0x415d('0xc9')]][_0x415d('0x116')]&&_0x4b22ab[_0x415d('0x117')]===_0x415d('0x118')){delete this['uniqueId'][_0x4b22ab['uniqueid']];this['updateOriginated'](this[_0x415d('0x24')][_0x122b61[_0x415d('0xc9')]]);_0x5cd325=new Hangup(_0x122b61,_0x4b22ab);_0x5cd325[_0x415d('0x75')]=0x12;_0x5cd325[_0x415d('0xd6')]='HangupInAMD';_0x5cd325[_0x415d('0x11b')]=_0x415d('0x11c');ami[_0x415d('0x46')](_0x415d('0x11d'),ut['buildObj'](_0x5cd325,_0x415d('0x11f')));this[_0x415d('0x132')](_0x5cd325,_0x415d('0x133'),_0x415d('0x134'));}if(_0x122b61[_0x415d('0xc4')]==='ivr'&&this[_0x415d('0x24')][_0x122b61['queue']][_0x415d('0x116')]&&_0x4b22ab[_0x415d('0x117')]===_0x415d('0x122')){return new Promise(function(_0xd12b1e,_0x3a9c8e){delete _0x195a35['uniqueId'][_0x4b22ab['uniqueid']];_0x195a35[_0x415d('0xc6')](_0x195a35[_0x415d('0x24')][_0x122b61[_0x415d('0xc9')]]);_0x195a35[_0x415d('0x24')][_0x122b61['queue']]['outboundAnswerCallsDay']+=0x1;_0x195a35[_0x415d('0x24')][_0x122b61['queue']][_0x415d('0x11a')]+=0x1;var _0x503dc3=_0x195a35['campaigns'][_0x122b61[_0x415d('0xc9')]];var _0x2a00eb=new Hangup(_0x122b61,_0x4b22ab);_0x2a00eb[_0x415d('0x75')]=0x13;_0x2a00eb['statedesc']='Machine';_0x2a00eb[_0x415d('0x11b')]=_0x415d('0x11c');_0x2a00eb[_0x415d('0x124')]+=0x1;_0x2a00eb[_0x415d('0xda')]+=0x1;_0x2a00eb[_0x415d('0x11f')]=!![];ami['emit'](_0x415d('0x11d'),ut[_0x415d('0x11e')](_0x2a00eb,_0x415d('0x11f')));hopperUtils[_0x415d('0xcf')](_0x2a00eb)[_0x415d('0xa6')](loggerCatch(_0x415d('0x125')));if(_0x2a00eb[_0x415d('0x126')]+_0x2a00eb[_0x415d('0x127')]+_0x2a00eb[_0x415d('0x135')]+_0x2a00eb['countnosuchnumberretry']+_0x2a00eb['countdropretry']+_0x2a00eb[_0x415d('0xee')]+_0x2a00eb[_0x415d('0x124')]+_0x2a00eb[_0x415d('0x129')]>=_0x503dc3[_0x415d('0x136')]){_0x195a35['stateGlobal'](_0x2a00eb,_0xd12b1e,_0x3a9c8e,_0x415d('0x12b'));}else{if(_0x2a00eb[_0x415d('0x124')]>=_0x503dc3['dialMachineMaxRetry']){_0x195a35['createStateFinal'](_0x2a00eb,_0xd12b1e,_0x3a9c8e,_0x415d('0x12e'));}else{hopperUtils[_0x415d('0xe1')]({'active':![],'countmachineretry':_0x2a00eb[_0x415d('0x124')],'scheduledat':moment()[_0x415d('0x12f')](_0x503dc3[_0x415d('0x130')],_0x415d('0xe2'))[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a00eb[_0x415d('0xe3')],'ListId':_0x2a00eb[_0x415d('0xf2')],'VoiceQueueId':_0x2a00eb[_0x415d('0xe4')]||undefined,'CampaignId':_0x2a00eb[_0x415d('0xe5')]||undefined})['catch'](loggerCatch(_0x415d('0x131')));_0xd12b1e({'reschedule':0x1});}}});}}};Dialer[_0x415d('0x1e')]['syncHangup']=function(_0x59e299){var _0x4406a4=this[_0x415d('0x2b')][_0x59e299['uniqueid']];var _0x327999;if(_0x4406a4&&_0x4406a4['type']==='ivr'){delete this[_0x415d('0x2b')][_0x59e299['uniqueid']];this[_0x415d('0xc6')](this['campaigns'][_0x4406a4[_0x415d('0xc9')]]);this[_0x415d('0x24')][_0x4406a4[_0x415d('0xc9')]][_0x415d('0x137')]+=0x1;_0x327999=new Hangup(_0x4406a4,_0x59e299);hopperUtils[_0x415d('0xcf')](_0x327999)[_0x415d('0xa6')](loggerCatch(_0x415d('0x138')));hopperUtils[_0x415d('0xd0')](_0x327999)[_0x415d('0xa6')](loggerCatch(_0x415d('0x139')));}if(_0x4406a4&&_0x4406a4[_0x415d('0xc4')]!==_0x415d('0xc5')&&isNotNull(this[_0x415d('0x23')][_0x4406a4[_0x415d('0xc9')]][_0x415d('0x13a')])){delete this[_0x415d('0x2b')][_0x59e299[_0x415d('0xc3')]];this[_0x415d('0xc6')](this[_0x415d('0x23')][_0x4406a4['queue']]);this[_0x415d('0x23')][_0x4406a4[_0x415d('0xc9')]][_0x415d('0x119')]+=0x1;this[_0x415d('0x23')][_0x4406a4['queue']][_0x415d('0x11a')]+=0x1;_0x327999=new Hangup(_0x4406a4,_0x59e299);_0x327999['state']=0x10;_0x327999[_0x415d('0xd6')]=_0x415d('0x13b');_0x327999[_0x415d('0x11b')]=_0x415d('0x13c');hopperUtils['createHistory'](_0x327999)[_0x415d('0xa6')](loggerCatch(_0x415d('0x138')));hopperUtils[_0x415d('0xd0')](_0x327999)[_0x415d('0xa6')](loggerCatch(_0x415d('0x139')));}if(_0x4406a4&&_0x4406a4[_0x415d('0xc4')]!==_0x415d('0xc5')&&!isNotNull(this[_0x415d('0x23')][_0x4406a4['queue']][_0x415d('0x13a')])){delete this[_0x415d('0x2b')][_0x59e299[_0x415d('0xc3')]];this[_0x415d('0xc6')](this['voiceQueues'][_0x4406a4[_0x415d('0xc9')]]);this[_0x415d('0x23')][_0x4406a4[_0x415d('0xc9')]][_0x415d('0x13d')]+=0x1;_0x327999=new Hangup(_0x4406a4,_0x59e299);_0x327999[_0x415d('0x75')]=0xc;_0x327999[_0x415d('0xd6')]=_0x59e299[_0x415d('0x13e')];_0x327999[_0x415d('0x11b')]=_0x415d('0x13f');hopperUtils['createHistory'](_0x327999)[_0x415d('0xa6')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x415d('0xd0')](_0x327999)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncQueueSummary']=function(_0x51b06d){var _0x23caef=this;if(!_0x23caef['queuesSummary'][_0x51b06d['name']]){_0x23caef[_0x415d('0x31')][_0x51b06d[_0x415d('0x4b')]]={'running':![]};}else if(_0x23caef[_0x415d('0x31')][_0x51b06d['name']][_0x415d('0x140')]===!![]){return;}else if(_0x23caef[_0x415d('0x31')][_0x51b06d[_0x415d('0x4b')]]['running']===![]){_0x23caef[_0x415d('0x31')][_0x51b06d['name']][_0x415d('0x140')]=!![];}var _0x1e5fe9=_0x23caef[_0x415d('0x23')][_0x51b06d[_0x415d('0x4b')]];var _0x2c1307=_0x1e5fe9[_0x415d('0x6f')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x189e24=utils['isPreviewCampaign'](_0x1e5fe9);_0x1e5fe9[_0x415d('0x141')]=utils[_0x415d('0x142')](_0x1e5fe9,_0x23caef[_0x415d('0x26')]);Promise[_0x415d('0xb1')]()[_0x415d('0x43')](function(){if(_0x1e5fe9[_0x415d('0x141')]===utils['CAMPAIGN_STATUS'][_0x415d('0x143')]){if(_0x2c1307){clearPredictiveAttributes(_0x1e5fe9);_0x51b06d['startPredictive']=undefined;_0x51b06d[_0x415d('0x2d')]=undefined;}if(_0x1e5fe9[_0x415d('0x141')]===utils[_0x415d('0x70')][_0x415d('0x143')]){_0x51b06d[_0x415d('0x144')]=0x0;_0x51b06d[_0x415d('0x107')]=0x0;_0x51b06d['inUse']=0x0;_0x51b06d[_0x415d('0x145')]=0x0;_0x51b06d['pTalking']=0x0;}}else if(_0x1e5fe9[_0x415d('0x141')]===utils[_0x415d('0x70')]['ACTIVE']&&!_0x189e24){return _0x23caef['ifTime'](_0x1e5fe9,!![])[_0x415d('0x43')](function(){return _0x23caef[_0x415d('0x9c')](_0x1e5fe9,![]);})[_0x415d('0x43')](function(){return _0x23caef[_0x415d('0xb7')](_0x1e5fe9);})[_0x415d('0xa6')](function(_0x41a849){loggerSyncQueueSummary[_0x415d('0x65')](_0x415d('0x146'),util['inspect'](_0x41a849,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1e5fe9);});}else{clearPredictiveAttributes(_0x1e5fe9);}})[_0x415d('0x43')](function(){var _0x34ad96=_0x51b06d['compareToOutboundQueue'](_0x1e5fe9);if(_0x34ad96||_0x1e5fe9[_0x415d('0x147')]){_0x1e5fe9['queueSummaryCountersUpdated']=![];_0x51b06d[_0x415d('0x148')](_0x1e5fe9);Object['assign'](_0x1e5fe9,_0x51b06d);emitOutboundVoiceQueueSummary(_0x51b06d);}_0x23caef[_0x415d('0x31')][_0x1e5fe9[_0x415d('0x4b')]][_0x415d('0x140')]=![];})[_0x415d('0xa6')](function(_0x469cf2){logger['error'](_0x415d('0x146'),util[_0x415d('0x49')](_0x469cf2,{'showHidden':![],'depth':null}));_0x23caef[_0x415d('0x31')][_0x1e5fe9[_0x415d('0x4b')]]['running']=![];});};Dialer[_0x415d('0x1e')][_0x415d('0x149')]=_[_0x415d('0x14a')](function(){var _0x795a98=_[_0x415d('0x14b')](this[_0x415d('0x23')],function(_0xc9a906){return _0xc9a906['dialPreviewRecallmeReminder'];});var _0x4e9dc2=_['filter'](this[_0x415d('0x25')],function(_0x2f4086){return _0x2f4086[_0x415d('0x14c')]&&_0x2f4086['status']===_0x415d('0x14d');});if(_0x795a98[_0x415d('0x9e')]>0x0&&_0x4e9dc2['length']>0x0){return Promise[_0x415d('0xb1')]()[_0x415d('0x43')](cmHopper[_0x415d('0x14e')](_[_0x415d('0x14f')](_0x795a98,'id'),previewRecallmeReminderInterval,_[_0x415d('0x14f')](_0x4e9dc2,'id')))[_0x415d('0x43')](function(_0x438b77){for(var _0x25f1e2=0x0;_0x25f1e2<_0x438b77['length'];_0x25f1e2++){var _0x499cc6=_0x438b77[_0x25f1e2][_0x415d('0x150')][_0x415d('0x4b')];if(_0x499cc6)io['to'](util[_0x415d('0x83')](_0x415d('0x151'),_0x499cc6))['emit'](_0x415d('0x152'),{'hopper':_0x438b77[_0x25f1e2]});}})[_0x415d('0xa6')](function(_0x26bef5){logger[_0x415d('0x6a')](_0x415d('0x153'),_0x26bef5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x415d('0x1e')]['loopClearZombieChannels']=function(){var _0x28087a=this;setInterval(function(){_0x28087a[_0x415d('0x154')](_0x28087a[_0x415d('0x2b')],'[uniqueid]');_0x28087a[_0x415d('0x154')](_0x28087a['actions'],'[actions]');},0x32c8);};Dialer[_0x415d('0x1e')]['clearZombieChannels']=function(_0x5b11fc,_0x32587e){var _0x2140ec=this;for(var _0x15bc7b in _0x5b11fc){if(typeof _0x5b11fc[_0x15bc7b]!==_0x415d('0xb0')){this['sequence'][_0x415d('0x155')](function(){if(!_[_0x415d('0xf9')](_0x5b11fc[_0x15bc7b])){return ami[_0x415d('0x9f')]({'action':_0x415d('0x8f'),'channel':_0x5b11fc[_0x15bc7b]['channel']})[_0x415d('0xa6')](function(_0x5be7b3){if(_0x5be7b3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5b11fc[_0x15bc7b]&&_0x5b11fc[_0x15bc7b][_0x415d('0xc4')]!==_0x415d('0xc5')){_0x2140ec[_0x415d('0xc6')](_0x2140ec['voiceQueues'][_0x5b11fc[_0x15bc7b][_0x415d('0xc9')]]);logger[_0x415d('0x6a')](_0x415d('0x156'),_0x32587e,_0x15bc7b,_0x5b11fc[_0x15bc7b][_0x415d('0xc9')]);delete _0x5b11fc[_0x15bc7b];}if(_0x5b11fc[_0x15bc7b]&&_0x5b11fc[_0x15bc7b][_0x415d('0xc4')]===_0x415d('0xc5')){_0x2140ec[_0x415d('0xc6')](_0x2140ec['campaigns'][_0x5b11fc[_0x15bc7b][_0x415d('0xc9')]]);logger[_0x415d('0x6a')](_0x415d('0x157'),_0x32587e,_0x15bc7b,_0x5b11fc[_0x15bc7b][_0x415d('0xc9')]);delete _0x5b11fc[_0x15bc7b];}},0x2328);}});}});}}};Dialer[_0x415d('0x1e')][_0x415d('0x158')]=function(_0x25d470){return Promise[_0x415d('0xb1')]()[_0x415d('0x43')](voiceQueueRt[_0x415d('0x158')](_0x25d470))[_0x415d('0xa6')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x415d('0xc6')]=function(_0x1b1916){if(!_['isUndefined'](_0x1b1916)&&_0x1b1916!==null){if(typeof _0x1b1916[_0x415d('0x159')]!==_0x415d('0xb0')){if(_0x1b1916['originated']>0x0){_0x1b1916[_0x415d('0x159')]-=0x1;}else{logger['error'](_0x415d('0x15a'));}}}else{logger['error'](_0x415d('0x15b'));}};Dialer[_0x415d('0x1e')][_0x415d('0x15c')]=function(_0x4e52b7,_0x12b97a){var _0x5797ad=this;return function(_0x5f41eb){_0x5797ad[_0x415d('0xc6')](_0x12b97a);logger[_0x415d('0x6a')](_0x4e52b7,util[_0x415d('0x49')](_0x5f41eb,{'showHidden':![],'depth':null}));};};Dialer[_0x415d('0x1e')][_0x415d('0x15d')]=function(_0x569f18,_0x4cdcce,_0xcfc432){var _0x52ad61={'state':0x19,'statedesc':_0x415d('0x15e')};this[_0x415d('0xc6')](_0x4cdcce);this[_0x415d('0x132')](_['merge'](_0x52ad61,_[_0x415d('0xfc')](_0xcfc432,[_0x415d('0xe3'),_0x415d('0xf2'),_0x415d('0x15f'),_0x415d('0xe4'),_0x415d('0xe5')])),_0x415d('0x160'),_0x415d('0x161'));logger[_0x415d('0x6a')](_0x569f18);};Dialer[_0x415d('0x1e')][_0x415d('0x132')]=function(_0xec880d,_0xab9649,_0x5001bc){hopperUtils[_0x415d('0xcf')](_0xec880d)[_0x415d('0xa6')](loggerCatch(_0xab9649));hopperUtils[_0x415d('0xd0')](_0xec880d)[_0x415d('0xa6')](loggerCatch(_0x5001bc));};Dialer['prototype'][_0x415d('0xe0')]=function(_0x226376,_0x3c4da1){hopperUtils[_0x415d('0xcf')](_0x226376)[_0x415d('0xa6')](loggerCatch(_0x415d('0x162')));if(_0x3c4da1==0x0){hopperUtils[_0x415d('0xd0')](_0x226376)[_0x415d('0xa6')](loggerCatch(_0x415d('0x163')));}};Dialer[_0x415d('0x1e')][_0x415d('0x153')]=function(_0x5e83f8){return Promise[_0x415d('0xb1')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x5e83f8['id'],previewRecallmeReminderInterval))['then'](function(_0x285b66){for(var _0x54d1bf=0x0;_0x54d1bf<_0x285b66[_0x415d('0x9e')];_0x54d1bf++){var _0x5a81d8=_0x285b66[_0x54d1bf]['Agent']['name'];if(_0x5a81d8)io['to'](util[_0x415d('0x83')](_0x415d('0x151'),_0x5a81d8))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x285b66[_0x54d1bf]});}})[_0x415d('0xa6')](function(){});};Dialer[_0x415d('0x1e')]['launchHandleIvr']=function(_0x368e8c){var _0x1a5014=this;return function(){_0x1a5014[_0x415d('0x164')](_0x368e8c);};};Dialer['prototype'][_0x415d('0x165')]=function(_0xe7745d,_0x25b8f2){var _0x57f308=this;var _0x35fc1c=uuid['v4']();this['actions'][_0x35fc1c]=new Action(_0xe7745d,_0x25b8f2,_0x35fc1c);return new Promise(function(_0x16e0bd,_0x532b9b){if(_['isUndefined'](_0xe7745d)&&typeof _0xe7745d!=='object'){return _0x532b9b(msgResponse(_0x415d('0x166'),'Failure',_0x415d('0x167')));}if(_[_0x415d('0x45')](_0x25b8f2[_0x415d('0x168')])||_0x25b8f2[_0x415d('0x168')]===null){return _0x532b9b(msgResponse(_0x415d('0x166'),_0x415d('0x96'),_0x415d('0x169')));}var _0x134d4c={'XMD-CALLERID':_0x57f308['actions'][_0x35fc1c][_0x415d('0x16a')](),'XMD-AGI':_0xe7745d[_0x415d('0x13a')]?util[_0x415d('0x83')](_0x415d('0x16b'),ipAgi,_0xe7745d[_0x415d('0x13a')]):_0x415d('0x16c'),'XMD-AGIAFTER':_0xe7745d[_0x415d('0xcd')]?util['format'](_0x415d('0x16b'),ipAgi,_0xe7745d[_0x415d('0xcd')]):_0x415d('0x16c'),'XMD-QUEUE':utils[_0x415d('0x16d')](_0xe7745d)?util[_0x415d('0x83')]('\x22%s,%s%s,,,%s\x22',_0xe7745d['name'],_0xe7745d['dialQueueOptions']||'',_0xe7745d['dialAgiAfterHangupAgent']?'c':'',_0xe7745d[_0x415d('0xd4')]||0x3):_0x415d('0x16c'),'XMD-CONTACTID':_0x25b8f2[_0x415d('0xe3')],'XMD-CDRTYPE':_0x415d('0x8'),'CALLERID(all)':_0x57f308['actions'][_0x35fc1c][_0x415d('0x16a')](),'XMD-AMD':_0xe7745d[_0x415d('0x116')]?'ACTIVE':'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0xe7745d[_0x415d('0x116')]){_0x134d4c[_0x415d('0x16e')]=_0xe7745d[_0x415d('0x16f')]||0x9c4;_0x134d4c['XMD-AMDGREETING']=_0xe7745d['dialAMDGreeting']||0x5dc;_0x134d4c[_0x415d('0x170')]=_0xe7745d[_0x415d('0x171')]||0x320;_0x134d4c[_0x415d('0x172')]=_0xe7745d[_0x415d('0x173')]||0x1388;_0x134d4c[_0x415d('0x174')]=_0xe7745d[_0x415d('0x175')]||0x64;_0x134d4c['XMD-AMDBETWEENWORDSSILENCE']=_0xe7745d['dialAMDBetweenWordsSilence']||0x32;_0x134d4c['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xe7745d['dialAMDMaximumNumberOfWords']||0x3;_0x134d4c[_0x415d('0x176')]=_0xe7745d[_0x415d('0x177')]||0x100;_0x134d4c[_0x415d('0x178')]=_0xe7745d[_0x415d('0x179')]||0x1388;}if(utils[_0x415d('0x16d')](_0xe7745d)){_0x134d4c[_0x415d('0x17a')]=_0x25b8f2['VoiceQueueId'];}else{_0x134d4c[_0x415d('0x17b')]=_0x25b8f2[_0x415d('0xe5')];}var _0x373967=utils[_0x415d('0x17c')](_0x25b8f2[_0x415d('0x17d')]);Object[_0x415d('0x17e')](_0x134d4c,_0x373967);var _0x2462e4=_0x57f308[_0x415d('0x8c')](_0xe7745d[_0x415d('0x92')])?utils['getCallerId'](_0xe7745d['Trunk'][_0x415d('0x17f')],_0xe7745d[_0x415d('0x180')],_0xe7745d[_0x415d('0x181')]>0x0?utils[_0x415d('0x182')](_0xe7745d[_0x415d('0x183')],_0xe7745d['dialRandomLastDigitCallerIdNumber']):_0xe7745d[_0x415d('0x183')]):utils[_0x415d('0x184')](_['isNil'](_0xe7745d[_0x415d('0x93')])?_0xe7745d[_0x415d('0x92')]['callerid']:_0xe7745d[_0x415d('0x93')][_0x415d('0x17f')],_0xe7745d[_0x415d('0x180')],_0xe7745d['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x415d('0x182')](_0xe7745d[_0x415d('0x183')],_0xe7745d[_0x415d('0x181')]):_0xe7745d[_0x415d('0x183')]);if(_0x2462e4){_0x134d4c['XMD-ORIGINATECALLERIDNAME']=_0x57f308[_0x415d('0x29')][_0x35fc1c][_0x415d('0x185')]=utils[_0x415d('0x186')](_0x2462e4);_0x134d4c[_0x415d('0x187')]=_0x25b8f2['phone'];}_0xe7745d[_0x415d('0x188')]=_0x134d4c;return ami[_0x415d('0x9f')]({'actionid':_0x35fc1c,'action':_0x415d('0x166'),'channel':_0x57f308[_0x415d('0x8c')](_0xe7745d[_0x415d('0x92')])?util[_0x415d('0x83')](_0x415d('0x189'),_0xe7745d[_0x415d('0x92')][_0x415d('0x4b')],isNotNull(_0xe7745d['dialPrefix'])?_0xe7745d[_0x415d('0x18a')]['trim']()||'':'',_0xe7745d[_0x415d('0x18b')]>0x0?_0x25b8f2[_0x415d('0x168')][_0x415d('0x18c')](_0xe7745d[_0x415d('0x18b')]):_0x25b8f2[_0x415d('0x168')]):util[_0x415d('0x83')](_0x415d('0x189'),_['isNil'](_0xe7745d[_0x415d('0x93')])?_0xe7745d[_0x415d('0x92')]['name']:_0xe7745d['TrunkBackup'][_0x415d('0x4b')],isNotNull(_0xe7745d[_0x415d('0x18a')])?_0xe7745d[_0x415d('0x18a')][_0x415d('0x18d')]()||'':'',_0xe7745d[_0x415d('0x18b')]>0x0?_0x25b8f2[_0x415d('0x168')]['substring'](_0xe7745d['dialCutDigit']):_0x25b8f2[_0x415d('0x168')]),'callerid':_0x2462e4,'Exten':'xcally-motion-dialer','Context':_0x415d('0x18e'),'Priority':'1','variable':_0x134d4c,'timeout':(_0xe7745d[_0x415d('0x18f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35fc1c})['then'](function(_0x43f672){return _0x16e0bd(_0x43f672);})[_0x415d('0xa6')](function(_0x3985e2){_0xe7745d[_0x415d('0x190')]+=0x1;var _0x3f1a6a=new History(_0x57f308[_0x415d('0x29')][_0x35fc1c]);logger[_0x415d('0x6a')](util[_0x415d('0x83')](_0x415d('0x191'),JSON[_0x415d('0x7b')](_0x3985e2)));_0x3f1a6a[_0x415d('0x75')]=0xe;_0x3f1a6a[_0x415d('0xd6')]=_0x415d('0x192');_0x3f1a6a['starttime']=moment()[_0x415d('0x83')](_0x415d('0xc8'));_0x3f1a6a[_0x415d('0x76')]=_0x3f1a6a[_0x415d('0x77')];hopperUtils[_0x415d('0xcf')](_0x3f1a6a)['catch'](loggerCatch(_0x415d('0x193')));_0x57f308[_0x415d('0xd0')](_0x3f1a6a)['catch'](loggerCatch(_0x415d('0x193')))[_0x415d('0x20')](function(){delete _0x57f308[_0x415d('0x29')][_0x35fc1c];return _0x532b9b(msgResponse(_0x415d('0x166'),_0x415d('0x8b'),_0x415d('0x194')));});});});};Dialer['prototype'][_0x415d('0x195')]=function(_0x2d71f9,_0x44d816,_0x28659b){var _0x332019=new History(_0x44d816);if(_0x332019['countbusyretry']+_0x332019[_0x415d('0x127')]+_0x332019[_0x415d('0x135')]+_0x332019[_0x415d('0x128')]+_0x332019[_0x415d('0xdf')]+_0x332019[_0x415d('0xee')]+_0x332019[_0x415d('0x124')]+_0x332019[_0x415d('0x129')]>=_0x28659b[_0x415d('0x136')]-0x1){return!![];}switch(_0x2d71f9){case 0x3:if(_0x332019[_0x415d('0x135')]>=_0x28659b[_0x415d('0x196')]-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countnoanswerretry':_0x332019['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x415d('0x12f')](_0x28659b[_0x415d('0x197')],_0x415d('0xe2'))[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x332019[_0x415d('0xe3')],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})['catch'](loggerCatch(_0x415d('0x198')));break;case 0x5:if(_0x332019[_0x415d('0x126')]>=_0x28659b['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x332019[_0x415d('0x126')]+=0x1,'scheduledat':moment()['add'](_0x28659b[_0x415d('0x199')],_0x415d('0xe2'))[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x332019[_0x415d('0xe3')],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019['VoiceQueueId']||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x19a')));break;case 0x8:if(_0x332019[_0x415d('0x127')]>=_0x28659b[_0x415d('0x19b')]-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countcongestionretry':_0x332019[_0x415d('0x127')]+=0x1,'scheduledat':moment()['add'](_0x28659b[_0x415d('0x19c')],'minutes')[_0x415d('0x83')](_0x415d('0xc8')),'ContactId':_0x332019['ContactId'],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019['VoiceQueueId']||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x19d')));break;case 0x0:if(_0x332019[_0x415d('0x128')]>=_0x28659b[_0x415d('0x19e')]-0x1){return!![];}else{hopperUtils[_0x415d('0xe1')]({'active':![],'countnosuchnumberretry':_0x332019[_0x415d('0x128')]+=0x1,'scheduledat':moment()['add'](_0x28659b[_0x415d('0x19f')],_0x415d('0xe2'))[_0x415d('0x83')](_0x415d('0xc8')),'ContactId':_0x332019[_0x415d('0xe3')],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x1a0')));}break;case 0xa:if(_0x332019[_0x415d('0xdf')]>=_0x28659b[_0x415d('0x1a1')]-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countdropretry':_0x332019[_0x415d('0xdf')]+=0x1,'scheduledat':moment()['add'](_0x28659b[_0x415d('0xdb')],_0x415d('0xe2'))[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x332019[_0x415d('0xe3')],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x332019['countabandonedretry']>=_0x28659b[_0x415d('0xf0')]-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countabandonedretry':_0x332019[_0x415d('0xee')]+=0x1,'scheduledat':moment()[_0x415d('0x12f')](_0x28659b[_0x415d('0xf1')],'minutes')[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x332019['ContactId'],'ListId':_0x332019['ListId'],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0xf3')));break;case 0x13:if(_0x332019['countmachineretry']>=_0x28659b[_0x415d('0x12c')]-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countmachineretry':_0x332019[_0x415d('0x124')]+=0x1,'scheduledat':moment()[_0x415d('0x12f')](_0x28659b[_0x415d('0x130')],_0x415d('0xe2'))[_0x415d('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x332019[_0x415d('0xe3')],'ListId':_0x332019[_0x415d('0xf2')],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x332019['countagentrejectretry']>=_0x28659b['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x415d('0xe1')]({'active':![],'countagentrejectretry':_0x332019[_0x415d('0x129')]+=0x1,'scheduledat':moment()[_0x415d('0x12f')](_0x28659b[_0x415d('0x1a2')],_0x415d('0xe2'))[_0x415d('0x83')](_0x415d('0xc8')),'ContactId':_0x332019['ContactId'],'ListId':_0x332019['ListId'],'VoiceQueueId':_0x332019[_0x415d('0xe4')]||undefined,'CampaignId':_0x332019[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x1a3')));break;default:return!![];}};Dialer[_0x415d('0x1e')][_0x415d('0x111')]=function(_0x5ce05a,_0x1cee56,_0x451b7e){var _0x4703c7=this;var _0x39a5da=new History(_0x5ce05a);var _0x1c0468=![];var _0x425a39;var _0x3d281a;return new Promise(function(_0x3fc10d,_0x519340){if(_[_0x415d('0x45')](_0x1cee56)&&typeof _0x1cee56!=='object'){return _0x519340(msgResponse(_0x415d('0x1a4'),_0x415d('0x96'),'entity\x20is\x20undefine'));}if(_[_0x415d('0x45')](_0x451b7e)&&typeof _0x451b7e!==_0x415d('0x1a5')){return _0x519340(msgResponse(_0x415d('0x1a4'),_0x415d('0x96'),_0x415d('0x1a6')));}hopperUtils[_0x415d('0xdd')](_0x39a5da,_0x451b7e['reason'],_0x1cee56)[_0x415d('0x43')](function(_0xf7d09c){if(_0xf7d09c[_0x415d('0xde')]==0x1)_0x1c0468=!![];switch(_0x451b7e[_0x415d('0xca')]){case'0':_0x1cee56[_0x415d('0x1a7')]+=0x1;_0x39a5da[_0x415d('0x75')]=0x0;_0x39a5da[_0x415d('0xd6')]=_0x415d('0x1a8');_0x39a5da['countnosuchnumberretry']+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x5ce05a,_0x415d('0x1a9')));_0x425a39=_0x1cee56['dialNoSuchNumberRetryFrequency'];_0x3d281a=_0x1cee56[_0x415d('0xdc')];hopperUtils[_0x415d('0xcf')](_0x39a5da)['catch'](loggerCatch(_0x415d('0x125')));if(_0x4703c7['checkRetriveMax'](0x0,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da[_0x415d('0x128')]>=_0x1cee56[_0x415d('0x19e')]){_0x4703c7['createStateFinal'](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1aa'));}else{_0x4703c7[_0x415d('0x12a')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1aa'));}}break;case'3':_0x1cee56['outboundNoAnswerCallsDay']+=0x1;_0x39a5da[_0x415d('0x75')]=0x3;_0x39a5da[_0x415d('0xd6')]=_0x415d('0x1ab');_0x39a5da[_0x415d('0x135')]+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;var _0x40c450=ut['buildNoAnswerEventPayload'](_0x5ce05a,_0x1cee56);ami[_0x415d('0x46')]('custom:agentnoanswer',_0x40c450);_0x425a39=_0x1cee56[_0x415d('0x197')];_0x3d281a=_0x1cee56[_0x415d('0xdc')];hopperUtils['createHistory'](_0x39a5da)[_0x415d('0xa6')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x4703c7[_0x415d('0x195')](0x3,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da['countnoanswerretry']>=_0x1cee56[_0x415d('0x196')]){_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4703c7[_0x415d('0x12a')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1ac'));}}break;case'5':_0x1cee56['outboundBusyCallsDay']+=0x1;_0x39a5da[_0x415d('0x75')]=0x5;_0x39a5da[_0x415d('0xd6')]=_0x415d('0x1ad');_0x39a5da[_0x415d('0x126')]+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;ami['emit'](_0x415d('0x1ae'),ut[_0x415d('0x11e')](_0x5ce05a,_0x415d('0x1af')));_0x425a39=_0x1cee56[_0x415d('0x199')];_0x3d281a=_0x1cee56[_0x415d('0xdc')];hopperUtils[_0x415d('0xcf')](_0x39a5da)[_0x415d('0xa6')](loggerCatch(_0x415d('0x1b0')));if(_0x4703c7[_0x415d('0x195')](0x5,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da[_0x415d('0x126')]>=_0x1cee56[_0x415d('0x1b1')]){_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b2'));}else{_0x4703c7[_0x415d('0x12a')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b2'));}}break;case'8':_0x1cee56[_0x415d('0x1b3')]+=0x1;_0x39a5da[_0x415d('0x75')]=0x8;_0x39a5da['statedesc']=_0x415d('0x1b4');_0x39a5da[_0x415d('0x127')]+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;_0x425a39=_0x1cee56[_0x415d('0x19c')];_0x3d281a=_0x1cee56['callAdditionalPhoneAfterMin'];ami[_0x415d('0x46')](_0x415d('0x1b5'),ut[_0x415d('0x11e')](_0x5ce05a,'congestion'));hopperUtils[_0x415d('0xcf')](_0x39a5da)[_0x415d('0xa6')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4703c7[_0x415d('0x195')](0x8,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da['countcongestionretry']>=_0x1cee56[_0x415d('0x19b')]){_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b6'));}else{_0x4703c7['stateGlobal'](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b6'));}}break;case'11':_0x1cee56[_0x415d('0x1b7')]+=0x1;_0x39a5da[_0x415d('0x75')]=0xb;_0x39a5da[_0x415d('0xd6')]=_0x415d('0xf4');_0x39a5da[_0x415d('0xee')]+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;_0x425a39=_0x1cee56[_0x415d('0xf1')];_0x3d281a=_0x1cee56['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x39a5da)[_0x415d('0xa6')](loggerCatch(_0x415d('0x1b8')));if(_0x4703c7[_0x415d('0x195')](0xb,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da[_0x415d('0xee')]>=_0x1cee56[_0x415d('0xf0')]){_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b9'));}else{_0x4703c7[_0x415d('0x12a')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1b9'));}}break;case'20':_0x1cee56['outboundRejectCallsDay']+=0x1;_0x39a5da['state']=0x14;_0x39a5da[_0x415d('0xd6')]=_0x415d('0x1ba');_0x39a5da[_0x415d('0x129')]+=0x1;_0x39a5da[_0x415d('0xda')]+=0x1;_0x425a39=_0x1cee56[_0x415d('0x1a2')];_0x3d281a=_0x1cee56[_0x415d('0xdc')];ami[_0x415d('0x46')](_0x415d('0x1bb'),ut[_0x415d('0x11e')](_0x5ce05a,_0x415d('0x1bc')));hopperUtils[_0x415d('0xcf')](_0x39a5da)[_0x415d('0xa6')](loggerCatch(_0x415d('0x1bd')));if(_0x4703c7['checkRetriveMax'](0x14,_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da[_0x415d('0x129')]>=_0x1cee56[_0x415d('0x1be')]){_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,'reason\x2020\x20agentreject');}else{_0x4703c7[_0x415d('0x12a')](_0x39a5da,_0x3fc10d,_0x519340,_0x415d('0x1bf'));}}break;default:_0x1cee56[_0x415d('0x13d')]+=0x1;_0x39a5da['state']=0xc;_0x39a5da[_0x415d('0xd6')]=_0x451b7e[_0x415d('0xca')];_0x425a39=_0x1cee56[_0x415d('0x1a2')];_0x3d281a=_0x1cee56[_0x415d('0xdc')];hopperUtils[_0x415d('0xcf')](_0x39a5da)[_0x415d('0xa6')](loggerCatch(_0x415d('0x1c0')));if(_0x4703c7[_0x415d('0x195')](_0x451b7e[_0x415d('0xca')],_0x5ce05a,_0x1cee56)&&!_0x1c0468){if(_0x39a5da['countbusyretry']+_0x39a5da[_0x415d('0x127')]+_0x39a5da['countnoanswerretry']+_0x39a5da[_0x415d('0x128')]+_0x39a5da[_0x415d('0xdf')]+_0x39a5da[_0x415d('0xee')]+_0x39a5da[_0x415d('0x124')]+_0x39a5da['countagentrejectretry']>=_0x1cee56['dialGlobalMaxRetry']){_0x4703c7['stateGlobal'](_0x39a5da,_0x3fc10d,_0x519340,_0x451b7e[_0x415d('0xca')]);}else{_0x4703c7[_0x415d('0x12d')](_0x39a5da,_0x3fc10d,_0x519340,_0x451b7e[_0x415d('0xca')]);}}}})['then'](function(){if(_0x1c0468){hopperUtils[_0x415d('0xea')](_0x39a5da,_0x425a39,_0x3d281a)[_0x415d('0x43')](function(){return _0x3fc10d(0x1);});}});});};Dialer[_0x415d('0x1e')]['stateGlobal']=function(_0x483876,_0x38f56d,_0x3a896b,_0x4054a9){var _0x4bf402=new Final(_0x483876);_0x4bf402[_0x415d('0x75')]=0xf;_0x4bf402[_0x415d('0xd6')]=_0x415d('0x1c1');this['createStateFinal'](_0x4bf402,_0x38f56d,_0x3a896b,_0x4054a9);};Dialer[_0x415d('0x1e')][_0x415d('0x12d')]=function(_0x503408,_0xcf8a66,_0x3d3e2d,_0x3fd115){hopperUtils[_0x415d('0xd0')](_0x503408)['then'](function(){return _0xcf8a66(msgResponse(_0x415d('0x1a4'),_0x415d('0x110'),_0x3fd115));})[_0x415d('0xa6')](function(){return _0x3d3e2d(msgResponse('[moveContactManagedDialer][0]',_0x415d('0x96'),_0x415d('0x1c2')));});};Dialer[_0x415d('0x1e')][_0x415d('0xa')]=function(_0x49c864){var _0x15e905=_0x49c864[_0x415d('0x1c3')]/0x64;var _0x584d86=_0x49c864[_0x415d('0xd5')]/(_0x49c864[_0x415d('0xd5')]+_0x49c864[_0x415d('0x119')]);var _0x5c5525=Math[_0x415d('0x1c4')](_0x49c864['predictiveIntervalAvailable']*(_0x49c864['predictiveIntervalMaxThreshold']/0x64));var _0x14f763=Math[_0x415d('0x1c4')](_0x49c864[_0x415d('0x1c5')]*(_0x49c864['predictiveIntervalMinThreshold']/0x64));var _0x2ef289=_0x49c864[_0x415d('0x144')]+_0x49c864[_0x415d('0x145')];var _0x419eb2=Math[_0x415d('0x1c6')](_0x49c864[_0x415d('0x5e')]*_0x49c864[_0x415d('0x1c7')]*_0x49c864[_0x415d('0x1c8')]*_0x49c864[_0x415d('0x1c9')]);if(_[_0x415d('0x45')](_0x49c864[_0x415d('0x2d')])){if(!_[_0x415d('0x45')](_0x49c864[_0x415d('0x67')])){_0x49c864[_0x415d('0x67')]=undefined;loggerPredictive[_0x415d('0x6a')](_0x415d('0x1ca'),_0x415d('0x1cb'));}if(!_[_0x415d('0x45')](_0x49c864[_0x415d('0x69')])){loggerPredictive[_0x415d('0x6a')](_0x415d('0x1ca'),_0x415d('0x1cc'));clearInterval(_0x49c864[_0x415d('0x69')]);_0x49c864[_0x415d('0x69')]=undefined;}_0x49c864[_0x415d('0x2d')]=moment()[_0x415d('0x83')](_0x415d('0xc8'));loggerPredictive[_0x415d('0x4e')](_0x49c864[_0x415d('0x4b')],_0x415d('0x1cd'),_0x49c864[_0x415d('0x2d')]);this[_0x415d('0xb9')](_0x49c864,0x1);}else if(ifInterval(_0x49c864['dialPredictiveInterval'],_0x49c864['startProgressive'])){this[_0x415d('0xb9')](_0x49c864,0x1);loggerPredictiveCalls['info'](_0x415d('0x1ce'),_0x49c864[_0x415d('0x2d')],_0x49c864[_0x415d('0x4b')]);_0x49c864[_0x415d('0x5e')]=0x0;_0x49c864['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x15e905<_0x584d86&&_0x49c864[_0x415d('0x1cf')]===_0x415d('0x1d0')){clearPredictiveAttributes(_0x49c864);loggerPredictive[_0x415d('0x4e')](_0x415d('0x1d1'),_0x415d('0x1d2'),_0x584d86,_0x415d('0x2d'),_0x49c864['name']);}else if(_0x419eb2<_0x49c864[_0x415d('0x1d3')]&&_0x49c864[_0x415d('0x1cf')]===_0x415d('0x1d0')){clearPredictiveAttributes(_0x49c864);loggerPredictive[_0x415d('0x4e')](_0x415d('0x1d4'),_0x415d('0x1d5'),_0x419eb2,_0x415d('0x1d6'),_0x49c864[_0x415d('0x1d3')],'startProgressive',_0x49c864[_0x415d('0x4b')]);}else if(!ifInterval(_0x49c864[_0x415d('0x1d7')],_0x49c864['startProgressive'])&&_[_0x415d('0x45')](_0x49c864[_0x415d('0x67')])&&!_[_0x415d('0x45')](_0x49c864[_0x415d('0x2d')])){_0x49c864[_0x415d('0x67')]=moment()[_0x415d('0x83')](_0x415d('0xc8'));loggerPredictive['info'](_0x49c864[_0x415d('0x4b')],_0x415d('0x1d8'),_0x49c864[_0x415d('0x67')]);hopperUtils['avgHandleTime'](_0x49c864[_0x415d('0x1d7')])[_0x415d('0x43')](this[_0x415d('0x1d9')](_0x49c864))[_0x415d('0x43')](mergeDataErlangB(_0x49c864))[_0x415d('0x43')](this['startMethodPredictive'](_0x49c864))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x49c864));}else if(!ifInterval(_0x49c864[_0x415d('0x1d7')],_0x49c864['startPredictive'])){_0x49c864[_0x415d('0x1d3')]=0x0;_0x49c864[_0x415d('0x67')]=moment()[_0x415d('0x83')](_0x415d('0xc8'));loggerPredictive['info'](_0x49c864['name'],_0x415d('0x1da'),_0x49c864[_0x415d('0x67')]);clearInterval(_0x49c864[_0x415d('0x69')]);_0x49c864[_0x415d('0x69')]=undefined;hopperUtils['avgHandleTime'](_0x49c864['dialPredictiveInterval'])[_0x415d('0x43')](this[_0x415d('0x1d9')](_0x49c864))[_0x415d('0x43')](mergeDataErlangB(_0x49c864))[_0x415d('0x43')](this[_0x415d('0x1db')](_0x49c864))[_0x415d('0xa6')](loggerCatchPredictive(_0x415d('0x1dc'),_0x49c864));}else if(_0x49c864[_0x415d('0x1c5')]&&_0x2ef289<_0x49c864[_0x415d('0x1c5')]-_0x14f763){clearPredictiveAttributes(_0x49c864);loggerPredictive['info'](_0x49c864['name'],_0x415d('0x1dd'),_0x2ef289,_0x415d('0x1de'),_0x49c864['predictiveIntervalAvailable'],'-',_0x14f763,'=',_0x49c864['predictiveIntervalAvailable']-_0x14f763,')');}else if(_0x49c864[_0x415d('0x1c5')]&&_0x2ef289>_0x49c864[_0x415d('0x1c5')]+_0x5c5525){clearPredictiveAttributes(_0x49c864);loggerPredictive[_0x415d('0x4e')](_0x49c864[_0x415d('0x4b')],_0x415d('0x1dd'),_0x2ef289,_0x415d('0x1df'),_0x49c864[_0x415d('0x1c5')],'+',_0x5c5525,'=',_0x49c864['predictiveIntervalAvailable']+_0x5c5525,')');}};Dialer[_0x415d('0x1e')][_0x415d('0x1d9')]=function(_0x4fcc32){var _0x226b4a=this;return function(_0x34fe2d){return new Promise(function(_0x3a12b8,_0x2fddd0){_[_0x415d('0x64')](_0x4fcc32,_0x34fe2d[0x0]);if(checkGetDataPredictive(_0x34fe2d[0x0])){var _0x518f59=_0x4fcc32[_0x415d('0x1c5')]=_0x4fcc32['talking']+_0x4fcc32['available'];var _0x51f0c7=_0x4fcc32[_0x415d('0x1d7')]*0x3c;var _0x5b6c08=_0x34fe2d[0x0][_0x415d('0x57')]+_0x34fe2d[0x0]['predictiveIntervalAvgHoldtime'];var _0x2bdaad=(_0x34fe2d[0x0][_0x415d('0x52')]+_0x34fe2d[0x0][_0x415d('0x54')]+_0x34fe2d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x34fe2d[0x0][_0x415d('0x50')];_0x4fcc32[_0x415d('0x1c8')]=_0x2bdaad>0x0?_0x2bdaad:0x1;switch(_0x4fcc32[_0x415d('0x1cf')]){case _0x415d('0x1d0'):var _0x377300=_0x4fcc32[_0x415d('0x1c3')]/0x64;return _0x226b4a[_0x415d('0x1e0')](_0x518f59,_0x51f0c7,_0x5b6c08,_0x2bdaad,_0x377300)['then'](function(_0x10dd25){return _0x3a12b8(_0x10dd25);});case _0x415d('0x1e1'):var _0x168230=_0x4fcc32[_0x415d('0x1c3')]/0x64;return _0x226b4a['busyFactor'](_0x518f59,_0x51f0c7,_0x5b6c08,_0x2bdaad,_0x168230)['then'](function(_0x2f9eb5){return _0x3a12b8(_0x2f9eb5);});default:return _0x2fddd0(msgResponse(_0x415d('0x1e2'),_0x415d('0x96'),_0x415d('0x1e3')));}}else{return _0x2fddd0(msgResponse(_0x415d('0x1e2'),'Failure',_0x415d('0x1e4')));}});};};Dialer[_0x415d('0x1e')]['getDataPredictiveOld']=function(_0x13c0cf){var _0x2beb0a=this;return function(_0x27ef59){return new Promise(function(_0x318feb,_0x4e25db){_[_0x415d('0x64')](_0x13c0cf,_0x27ef59[0x0]);if(checkGetDataPredictive(_0x27ef59[0x0])){loggerPredictive['info'](JSON[_0x415d('0x7b')](_0x27ef59[0x0]));if(_0x13c0cf[_0x415d('0x1cf')]===_0x415d('0x1d0')){return _0x2beb0a[_0x415d('0x158')](_0x13c0cf['id'])[_0x415d('0x43')](function(_0x34e05){var _0x5abc24=_0x13c0cf[_0x415d('0x1e5')]-_0x34e05[0x0][_0x415d('0x1e6')];var _0x54b07a=_0x13c0cf[_0x415d('0x1d7')]*0x3c;var _0x153c09=_0x27ef59[0x0][_0x415d('0x57')]+_0x27ef59[0x0][_0x415d('0x56')];var _0x2e0053=(_0x27ef59[0x0]['predictiveIntervalAnsweredCalls']+_0x27ef59[0x0][_0x415d('0x54')]+_0x27ef59[0x0][_0x415d('0xeb')])/_0x27ef59[0x0][_0x415d('0x50')];var _0x3a9c8=_0x13c0cf[_0x415d('0x1c3')]/0x64;_0x13c0cf[_0x415d('0x1e7')]=_0x34e05[0x0][_0x415d('0x1e6')]||0x0;_0x13c0cf[_0x415d('0x1c8')]=_0x2e0053>0x0?_0x2e0053:0x1;return _0x2beb0a['abandonmentRate'](_0x5abc24,_0x54b07a,_0x153c09,_0x2e0053,_0x3a9c8);})[_0x415d('0x43')](function(_0x2d710c){return _0x318feb(_0x2d710c);})[_0x415d('0xa6')](function(_0x11bc3d){return _0x4e25db(msgResponse('[CatchErlangB]','Failure',JSON[_0x415d('0x7b')](_0x11bc3d)));});}if(_0x13c0cf[_0x415d('0x1cf')]===_0x415d('0x1e1')){return _0x2beb0a[_0x415d('0x158')](_0x13c0cf['id'])['then'](function(_0x3195ce){var _0x14fe85=_0x13c0cf[_0x415d('0x1e5')]-_0x3195ce[0x0][_0x415d('0x1e6')];var _0x46e150=_0x13c0cf['dialPredictiveInterval']*0x3c;var _0x51d25e=_0x27ef59[0x0]['predictiveIntervalAvgTalktime']+_0x27ef59[0x0]['predictiveIntervalAvgHoldtime'];var _0x33306e=(_0x27ef59[0x0][_0x415d('0x52')]+_0x27ef59[0x0][_0x415d('0x54')]+_0x27ef59[0x0][_0x415d('0xeb')])/_0x27ef59[0x0][_0x415d('0x50')];var _0x491c3e=_0x13c0cf[_0x415d('0x1c3')]/0x64;_0x13c0cf[_0x415d('0x1e7')]=_0x3195ce[0x0][_0x415d('0x1e6')]||0x0;_0x13c0cf[_0x415d('0x1c8')]=_0x33306e>0x0?_0x33306e:0x1;return _0x2beb0a['busyFactor'](_0x14fe85,_0x46e150,_0x51d25e,_0x33306e,_0x491c3e);})[_0x415d('0x43')](function(_0x229ec2){return _0x318feb(_0x229ec2);})[_0x415d('0xa6')](function(_0x3f4dc5){return _0x4e25db(msgResponse(_0x415d('0x1e8'),'Failure',JSON[_0x415d('0x7b')](_0x3f4dc5)));});}}else{return _0x4e25db(msgResponse('[getDataPredictive]',_0x415d('0x96'),_0x415d('0x1e4')));}});};};Dialer['prototype'][_0x415d('0x1db')]=function(_0x58cb3c){var _0x588980=this;return function(){var _0x28db92=0x0;var _0xf03bfc=Math['floor'](_0x58cb3c[_0x415d('0x60')]*0x3e8);if(_0xf03bfc>0x0){_0xf03bfc=_0xf03bfc<0x64?0x64:_0xf03bfc;loggerPredictive[_0x415d('0x4e')](_0x58cb3c[_0x415d('0x4b')],_0x415d('0x1e9'),_0xf03bfc,'milliseconds');_0x58cb3c['handlePredictive']=setInterval(function(){_0x588980[_0x415d('0x69')](_0x58cb3c);loggerPredictiveCalls['info'](_0x415d('0x1ea'),_0x28db92+=0x1);},_0xf03bfc);}else{loggerPredictive[_0x415d('0x4e')](_0x58cb3c[_0x415d('0x4b')],_0x415d('0x1eb'));}};};Dialer['prototype'][_0x415d('0x1ec')]=function(_0x183ac3,_0x13c777){var _0x2e13ac=this;return function(_0x43771d){if(_[_0x415d('0x4d')](_0x43771d)){if(_[_0x415d('0xf9')](_0x13c777[_0x415d('0x15f')])||!_0x13c777['recallme']){if(_0x183ac3[_0x415d('0x1ed')]===_0x415d('0x9')){_0x183ac3[_0x415d('0x78')]=_[_0x415d('0x45')](_0x183ac3[_0x415d('0x78')])?!![]:_0x183ac3[_0x415d('0x78')];var _0x1ecc10=uuid['v4']();_0x2e13ac[_0x415d('0x29')][_0x1ecc10]=new Action(_0x183ac3,_0x13c777,_0x1ecc10);loggerBooked[_0x415d('0x4e')](_0x415d('0x1ee'),_0x1ecc10,_0x415d('0x1ef'),JSON[_0x415d('0x7b')](_0x183ac3[_0x415d('0x78')]),_0x415d('0x1f0'),_0x183ac3[_0x415d('0x4b')]);if(_0x183ac3['queueStatusComplete']){_0x183ac3[_0x415d('0x78')]=![];_0x2e13ac[_0x415d('0x2f')][_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xc9')]]=[];ami[_0x415d('0x9f')]({'actionid':_0x1ecc10,'action':_0x415d('0x1f1'),'queue':_0x183ac3[_0x415d('0x4b')]})['catch'](function(){_0x2e13ac[_0x415d('0xc6')](_0x183ac3);hopperUtils[_0x415d('0xe1')]({'active':![],'ContactId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10]['ContactId'],'ListId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xf2')],'VoiceQueueId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10]['VoiceQueueId']||undefined,'CampaignId':_0x2e13ac['actions'][_0x1ecc10][_0x415d('0xe5')]||undefined})['catch'](loggerCatch(_0x415d('0x1f2')));delete _0x2e13ac[_0x415d('0x29')][_0x1ecc10];});}else{loggerBooked['info'](_0x415d('0x1f3'),JSON[_0x415d('0x7b')](_0x183ac3[_0x415d('0x78')]),_0x415d('0x1f0'),_0x183ac3[_0x415d('0x4b')]);_0x2e13ac['updateOriginated'](_0x183ac3);hopperUtils[_0x415d('0xe1')]({'active':![],'ContactId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xe3')],'ListId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xf2')],'VoiceQueueId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xe4')]||undefined,'CampaignId':_0x2e13ac[_0x415d('0x29')][_0x1ecc10][_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x1f2')));delete _0x2e13ac[_0x415d('0x29')][_0x1ecc10];}}else{return _0x2e13ac[_0x415d('0x165')](_0x183ac3,_0x13c777);}}else{if(utils[_0x415d('0x1f4')](undefined,_0x13c777['scheduledat'])<_0x183ac3[_0x415d('0x1f5')]*0x3c){if(_0x13c777[_0x415d('0x150')]&&!_0x13c777[_0x415d('0x150')][_0x415d('0x1f6')]){_0x2e13ac[_0x415d('0x22')][_0x415d('0x100')](_0x13c777['id'])[_0x415d('0x20')](function(){_0x2e13ac[_0x415d('0xc6')](_0x183ac3);});}else{hopperUtils['unlockContact']({'active':![]},_0x13c777['id'],0x1)[_0x415d('0x20')](function(){_0x2e13ac[_0x415d('0xc6')](_0x183ac3);});}}else{_0x183ac3['outboundReCallsDay']+=0x1;_0x2e13ac['updateOriginated'](_0x183ac3);if(_0x183ac3['dialRecallInQueue']){hopperUtils[_0x415d('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x13c777['ContactId'],'ListId':_0x13c777[_0x415d('0xf2')],'VoiceQueueId':_0x13c777[_0x415d('0xe4')]||undefined,'CampaignId':_0x13c777[_0x415d('0xe5')]||undefined})[_0x415d('0xa6')](loggerCatch(_0x415d('0x1f7')));hopperUtils[_0x415d('0xcf')](createObjHistory(_0x183ac3,_0x13c777,utils[_0x415d('0x70')][_0x415d('0x1f8')],0x17,_0x415d('0x1f9')))[_0x415d('0xa6')](loggerCatch(_0x415d('0x1fa')));}else{_0x2e13ac['saveInDb'](createObjHistory(_0x183ac3,_0x13c777,utils[_0x415d('0x70')]['RECALL_TIMEOUT'],0x16,_0x415d('0x1fb')),_0x415d('0x1fc'),'[Originate][HistoryRecallClose]');}}}}else{_0x183ac3[_0x415d('0x1fd')]+=0x1;_0x2e13ac[_0x415d('0x132')](createObjHistory(_0x183ac3,_0x13c777,utils[_0x415d('0x70')][_0x415d('0x1fe')],0xd,_0x415d('0x1ff')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x415d('0x200');}};};Dialer[_0x415d('0x1e')]['handleIvr']=function(_0x1d6d05){var _0x719a0b=this;var _0xaf6a61=_0x1d6d05[_0x415d('0x201')]-_0x1d6d05[_0x415d('0x159')];emitCampaignSummary(_0x1d6d05);if(_0xaf6a61>0x0&&_0x1d6d05[_0x415d('0x6d')]==0x0){if(_0xaf6a61>this[_0x415d('0x27')]){_0xaf6a61=this[_0x415d('0x27')];}_0x1d6d05['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x1d6d05,_0xaf6a61)[_0x415d('0x43')](function(_0x1be035){_0x1d6d05['temp']=0x0;if(_0x1be035){if(!utils[_0x415d('0x202')](_0x1be035)){_0x1d6d05[_0x415d('0x6f')]=utils['CAMPAIGN_STATUS'][_0x415d('0x73')];logger[_0x415d('0x4e')](_0x415d('0x203')+_0x1d6d05[_0x415d('0x4b')]);}else{_0x1d6d05[_0x415d('0x159')]+=_0x1be035[_0x415d('0x9e')];_0x1d6d05[_0x415d('0x6f')]=utils['CAMPAIGN_STATUS'][_0x415d('0x204')];for(var _0x6d3d5f=0x0;_0x6d3d5f<_0x1be035[_0x415d('0x9e')];_0x6d3d5f+=0x1){_0x1d6d05[_0x415d('0x205')]+=0x1;if(_['isNil'](_0x1be035[_0x6d3d5f])||_[_0x415d('0xf9')](_0x1be035[_0x6d3d5f]['Contact'])||_[_0x415d('0xf9')](_0x1be035[_0x6d3d5f]['phone'])){_0x719a0b[_0x415d('0x15d')](_0x415d('0x206'),_0x1d6d05,_0x1be035[_0x6d3d5f]);}else{hopperUtils[_0x415d('0x207')](_[_0x415d('0xfc')](_0x1be035[_0x6d3d5f],[_0x415d('0xe5'),_0x415d('0x168')]))['then'](_0x719a0b[_0x415d('0x1ec')](_0x1d6d05,_0x1be035[_0x6d3d5f]))[_0x415d('0xa6')](_0x719a0b[_0x415d('0x15c')]('[actionOriginateIvr]\x20',_0x1d6d05));}}}}})['catch'](loggerGetContactDialer(_0x415d('0x208'),_0x1d6d05,_0xaf6a61));}};Dialer['prototype'][_0x415d('0xb9')]=function(_0x1a34b6,_0x3dc2b5){var _0x1bfc0f=this;var _0x1db1fd=[];if(_0x3dc2b5<0x1||_0x1a34b6[_0x415d('0x1ed')]==='booked'){_0x3dc2b5=0x1;}var _0x1feec8=Math[_0x415d('0x1c6')](_0x1a34b6[_0x415d('0x144')]*_0x3dc2b5)-_0x1a34b6['originated'];if(_0x1a34b6[_0x415d('0x209')]>0x0){var _0x49ef5a=_0x1a34b6[_0x415d('0x209')]-_0x1a34b6[_0x415d('0x159')]-_0x1a34b6['talking']-_0x1a34b6['pTalking'];if(_0x1feec8>_0x49ef5a){_0x1feec8=_0x49ef5a;}}if(_0x1feec8>0x0&&_0x1a34b6[_0x415d('0x6d')]==0x0){if(_0x1a34b6[_0x415d('0x1ed')]===_0x415d('0x9')){_0x1feec8=0x1;}if(_0x1feec8>this[_0x415d('0x27')]){_0x1feec8=this[_0x415d('0x27')];}for(var _0x1181f0 in this[_0x415d('0x25')]){if(typeof this[_0x415d('0x25')][_0x1181f0]!=='undefined'){if(this[_0x415d('0x25')][_0x1181f0][_0x415d('0x75')]==='not_inuse'&&this[_0x415d('0x25')][_0x1181f0][_0x415d('0x8f')]===_0x415d('0x14d')){_0x1db1fd[_0x415d('0xa3')](this[_0x415d('0x25')][_0x1181f0]['id']);}}}_0x1a34b6['temp']=0x1;hopperUtils[_0x415d('0x20a')](_0x1a34b6,_0x1db1fd,_0x1feec8)['then'](function(_0x232018){_0x1a34b6['temp']=0x0;if(_0x232018){if(!utils[_0x415d('0x202')](_0x232018)){hopperUtils[_0x415d('0x20b')](_0x1a34b6)[_0x415d('0x43')](sendMessageReschedule(_0x1a34b6))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1a34b6[_0x415d('0x159')]+=_0x232018[_0x415d('0x9e')];_0x1a34b6[_0x415d('0x6f')]=_0x1a34b6[_0x415d('0x1ed')]===_0x415d('0x9')?utils[_0x415d('0x70')][_0x415d('0x20c')]:utils['CAMPAIGN_STATUS'][_0x415d('0x204')];for(var _0x100cb4=0x0;_0x100cb4<_0x232018[_0x415d('0x9e')];_0x100cb4+=0x1){if(_[_0x415d('0xf9')](_0x232018[_0x100cb4])||_[_0x415d('0xf9')](_0x232018[_0x100cb4][_0x415d('0x17d')])||_[_0x415d('0xf9')](_0x232018[_0x100cb4]['phone'])){_0x1bfc0f['emptyContact'](_0x415d('0x206'),_0x1a34b6,_0x232018[_0x100cb4]);}else{hopperUtils[_0x415d('0x20d')](_['pick'](_0x232018[_0x100cb4],[_0x415d('0xe4'),_0x415d('0x168')]))[_0x415d('0x43')](_0x1bfc0f['checkContactBlack'](_0x1a34b6,_0x232018[_0x100cb4]))[_0x415d('0xa6')](_0x1bfc0f[_0x415d('0x15c')](_0x415d('0x206'),_0x1a34b6));}}}}})['catch'](loggerGetContactDialer(_0x415d('0x20e'),_0x1a34b6,_0x1feec8));}};Dialer[_0x415d('0x1e')][_0x415d('0x69')]=function(_0x102894){if(_0x102894[_0x415d('0x209')]>0x0){var _0xa50408=_0x102894[_0x415d('0x209')]-_0x102894['originated']-_0x102894[_0x415d('0x145')];if(_0xa50408>0x0&&_0x102894['temp']==0x0){this['tryOriginatePredictive'](_0x102894);}else{loggerPredictiveCalls['info'](_0x415d('0x20f'));}}else{this[_0x415d('0x210')](_0x102894);}};Dialer['prototype'][_0x415d('0x210')]=function(_0x390e29){var _0x39d7e9=this;var _0x437c3a=[];_0x390e29[_0x415d('0x159')]+=0x1;for(var _0x4bf9bd in this[_0x415d('0x25')]){if(typeof this[_0x415d('0x25')][_0x4bf9bd]!==_0x415d('0xb0')){if(this[_0x415d('0x25')][_0x4bf9bd]['state']==='not_inuse'&&this[_0x415d('0x25')][_0x4bf9bd][_0x415d('0x8f')]==='reachable'){_0x437c3a[_0x415d('0xa3')](this['agents'][_0x4bf9bd]['id']);}}}_0x390e29[_0x415d('0x6d')]=0x1;return this[_0x415d('0x20a')](_0x390e29['id'],_0x437c3a,0x1,_0x390e29[_0x415d('0x211')],_0x390e29)['then'](function(_0x379713){_0x390e29[_0x415d('0x6d')]=0x1;if(_0x379713){if(!utils[_0x415d('0x202')](_0x379713)){utils[_0x415d('0x6c')](_0x390e29,0x1,0x0);return hopperUtils[_0x415d('0x20b')](_0x390e29)[_0x415d('0x43')](sendMessageReschedule(_0x390e29))[_0x415d('0xa6')](loggerCatch(_0x415d('0x212')));}else{_0x390e29['message']=utils['CAMPAIGN_STATUS'][_0x415d('0x204')];if(_[_0x415d('0xf9')](_0x379713[0x0])||_[_0x415d('0xf9')](_0x379713[0x0][_0x415d('0x17d')])||_['isNil'](_0x379713[0x0][_0x415d('0x168')])){_0x39d7e9[_0x415d('0x15d')](_0x415d('0x206'),_0x390e29,_0x379713[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x415d('0xfc')](_0x379713[0x0],[_0x415d('0xe4'),_0x415d('0x168')]))[_0x415d('0x43')](_0x39d7e9[_0x415d('0x1ec')](_0x390e29,_0x379713[0x0]))['catch'](_0x39d7e9[_0x415d('0x15c')](_0x415d('0x213'),_0x390e29));}}}})[_0x415d('0xa6')](loggerGetContactDialer('[getContactDialerPredictive]',_0x390e29,0x1));};Dialer['prototype'][_0x415d('0x1e0')]=function(_0x1fa48d,_0x27d073,_0x125a25,_0x25c950,_0x16645c,_0x363d89){loggerPredictive[_0x415d('0x4e')](_0x415d('0x214'));loggerPredictive[_0x415d('0x4e')](_0x415d('0x215'),_0x1fa48d);loggerPredictive[_0x415d('0x4e')](_0x415d('0x216'),_0x27d073);loggerPredictive[_0x415d('0x4e')]('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',_0x125a25);loggerPredictive[_0x415d('0x4e')]('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',_0x25c950);loggerPredictive[_0x415d('0x4e')](_0x415d('0x217'),_0x16645c);loggerPredictive[_0x415d('0x4e')]('---------------------------');return new Promise(function(_0x16a788,_0x9c8237){if(_0x1fa48d<=0x0||isNaN(_0x1fa48d)){return _0x9c8237(msgResponse(_0x415d('0x218'),_0x415d('0x8b'),_0x415d('0x219')+_0x1fa48d));}if(_0x125a25<=0x0||isNaN(_0x125a25)){return _0x9c8237(msgResponse(_0x415d('0x218'),_0x415d('0x8b'),_0x415d('0x21a')+_0x125a25));}if(_0x25c950<=0x0||isNaN(_0x25c950)){return _0x9c8237(msgResponse(_0x415d('0x218'),_0x415d('0x8b'),'p\x20=\x20'+_0x25c950));}if(_0x27d073<=0x0||isNaN(_0x27d073)){return _0x9c8237(msgResponse(_0x415d('0x218'),_0x415d('0x8b'),_0x415d('0x21b')+_0x27d073));}if(_0x16645c<=0x0||isNaN(_0x16645c)){return _0x9c8237(msgResponse(_0x415d('0x218'),'Error','Amax\x20=\x20'+_0x16645c));}_0x363d89=_0x363d89||0x0;var _0x525c84=0x1/_0x125a25;var _0x1876e9=0x0;var _0x342802=0x0;var _0x3e0a7f=0x0;var _0x32df98=0x0;for(var _0x291306=0x0;_0x3e0a7f<_0x16645c;_0x291306+=0x1){_0x342802=_0x291306/_0x27d073;_0x1876e9=(_0x25c950*_0x342802+_0x363d89)/_0x525c84;_0x3e0a7f=utils[_0x415d('0x21c')](_0x1876e9,_0x1fa48d);_0x32df98=_0x1876e9/_0x1fa48d*(0x1-utils['erlangb'](_0x1876e9,_0x1fa48d));}return _0x16a788({'erlangCalls':_0x291306,'erlangCallToSecond':_0x27d073/_0x291306,'erlangAbandonmentRate':_0x3e0a7f,'erlangBusyFactor':_0x32df98});});};Dialer['prototype'][_0x415d('0x21d')]=function(_0x33834f,_0x5d8097,_0x3a8ac8,_0x405d18,_0x30f722,_0x4a77e8){loggerPredictive['info'](_0x415d('0x21e'));loggerPredictive[_0x415d('0x4e')](_0x415d('0x215'),_0x33834f);loggerPredictive[_0x415d('0x4e')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d8097);loggerPredictive[_0x415d('0x4e')](_0x415d('0x21f'),_0x3a8ac8);loggerPredictive['info']('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',_0x405d18);loggerPredictive[_0x415d('0x4e')](_0x415d('0x220'),_0x30f722);loggerPredictive[_0x415d('0x4e')](_0x415d('0x58'));return new Promise(function(_0x2191c5,_0x2ed262){if(_0x33834f<=0x0||isNaN(_0x33834f)){return _0x2ed262(msgResponse('[busyFactor]',_0x415d('0x8b'),'m\x20=\x20'+_0x33834f));}if(_0x3a8ac8<=0x0||isNaN(_0x3a8ac8)){return _0x2ed262(msgResponse('[busyFactor]',_0x415d('0x8b'),_0x415d('0x21a')+_0x3a8ac8));}if(_0x405d18<=0x0||isNaN(_0x405d18)){return _0x2ed262(msgResponse(_0x415d('0x221'),'Error','p\x20=\x20'+_0x405d18));}if(_0x5d8097<=0x0||isNaN(_0x5d8097)){return _0x2ed262(msgResponse(_0x415d('0x221'),_0x415d('0x8b'),'interval\x20=\x20'+_0x5d8097));}if(_0x30f722<=0x0||isNaN(_0x30f722)){return _0x2ed262(msgResponse('[busyFactor]',_0x415d('0x8b'),_0x415d('0x222')+_0x30f722));}_0x4a77e8=_0x4a77e8||0x0;var _0x167da0=0x1/_0x3a8ac8;var _0x336ae7=0x0;var _0x1362ca=0x0;var _0x3f2311=0x0;var _0x4b65d1=0x0;for(var _0x160ea3=0x0;_0x4b65d1<_0x30f722;_0x160ea3+=0x1){_0x1362ca=_0x160ea3/_0x5d8097;_0x336ae7=(_0x405d18*_0x1362ca+_0x4a77e8)/_0x167da0;_0x3f2311=utils['erlangb'](_0x336ae7,_0x33834f);_0x4b65d1=_0x336ae7/_0x33834f*(0x1-utils[_0x415d('0x21c')](_0x336ae7,_0x33834f));}return _0x2191c5({'erlangCalls':_0x160ea3,'erlangCallToSecond':_0x5d8097/_0x160ea3,'erlangAbandonmentRate':_0x3f2311,'erlangBusyFactor':_0x4b65d1});});};module[_0x415d('0x223')]=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 1db510b..9e8dec6 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 _0x2cd2=['dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type'];(function(_0x1b3f76,_0x3c8e1b){var _0x563721=function(_0x59f22e){while(--_0x59f22e){_0x1b3f76['push'](_0x1b3f76['shift']());}};_0x563721(++_0x3c8e1b);}(_0x2cd2,0x1ee));var _0x22cd=function(_0x162e09,_0x139b77){_0x162e09=_0x162e09-0x0;var _0x2b2d3a=_0x2cd2[_0x162e09];return _0x2b2d3a;};'use strict';var util=require('util');var _=require(_0x22cd('0x0'));var moment=require('moment');function checkNameSurname(_0x147b47,_0xb23371,_0x3839dd){var _0x1ad411='';if(!_[_0x22cd('0x1')](_0xb23371)&&_0x22cd('0x2')===typeof _0xb23371){_0x1ad411+=_0xb23371;}if(!_[_0x22cd('0x1')](_0x3839dd)&&_0x22cd('0x2')===typeof _0x3839dd){_0x1ad411+='\x20'+_0x3839dd;}if(_0x1ad411!==''){return _0x1ad411;}return _0x147b47;}function Action(_0x51d06a,_0x4bf947,_0x1ba3eb){this[_0x22cd('0x3')]=_0x51d06a;this['uniqueid']=_0x1ba3eb||undefined;this['name']=checkNameSurname(_0x4bf947[_0x22cd('0x4')][_0x22cd('0x5')],_0x4bf947[_0x22cd('0x4')][_0x22cd('0x6')],_0x4bf947[_0x22cd('0x4')][_0x22cd('0x7')]);this[_0x22cd('0x8')]=_0x4bf947[_0x22cd('0x5')];this[_0x22cd('0x9')]=_0x51d06a[_0x22cd('0xa')];this[_0x22cd('0xb')]=_0x4bf947['active']||![];this[_0x22cd('0xc')]=_0x51d06a[_0x22cd('0xc')];this[_0x22cd('0xd')]=_0x51d06a['dialQueueTimeout']||0x3;this['scheduledat']=_0x4bf947['scheduledat'];this[_0x22cd('0xe')]=_0x4bf947['countbusyretry'];this[_0x22cd('0xf')]=_0x4bf947['countcongestionretry'];this[_0x22cd('0x10')]=_0x4bf947['countnoanswerretry'];this[_0x22cd('0x11')]=_0x4bf947[_0x22cd('0x11')];this[_0x22cd('0x12')]=_0x4bf947['countdropretry'];this['countabandonedretry']=_0x4bf947[_0x22cd('0x13')];this['countmachineretry']=_0x4bf947[_0x22cd('0x14')];this[_0x22cd('0x15')]=_0x4bf947[_0x22cd('0x15')];this[_0x22cd('0x16')]=_0x4bf947[_0x22cd('0x16')];this[_0x22cd('0x17')]=_0x4bf947['ListId'];this[_0x22cd('0x18')]=_0x4bf947[_0x22cd('0x18')];this[_0x22cd('0x19')]=_0x4bf947[_0x22cd('0x19')];this[_0x22cd('0x1a')]=_0x4bf947[_0x22cd('0x1a')];this[_0x22cd('0x1b')]=_0x4bf947['id'];this[_0x22cd('0x1c')]=_0x4bf947[_0x22cd('0x4')]['firstName']||'';this['starttime']=moment()[_0x22cd('0x1d')](_0x22cd('0x1e'));this[_0x22cd('0x1f')]=_0x4bf947[_0x22cd('0x1f')];this['callbackuniqueid']=_0x4bf947['callbackuniqueid'];this[_0x22cd('0x20')]=_0x4bf947[_0x22cd('0x20')];this[_0x22cd('0x21')]=_0x4bf947['recallme'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x22cd('0x22')]['getCaller']=function(){return util[_0x22cd('0x1d')](_0x22cd('0x23'),this[_0x22cd('0xa')],this[_0x22cd('0x3')][_0x22cd('0x24')]>0x0?this[_0x22cd('0x8')][_0x22cd('0x25')](this['voiceQueue'][_0x22cd('0x24')]):this[_0x22cd('0x8')]);};Action[_0x22cd('0x22')]['getQueue']=function(){return this[_0x22cd('0x9')];};module[_0x22cd('0x26')]=Action; \ No newline at end of file +var _0x3526=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','name','phone','Contact','firstName','queue','active','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3526,0x93));var _0x6352=function(_0x4e1236,_0x24b693){_0x4e1236=_0x4e1236-0x0;var _0x275474=_0x3526[_0x4e1236];return _0x275474;};'use strict';var util=require('util');var _=require(_0x6352('0x0'));var moment=require(_0x6352('0x1'));function checkNameSurname(_0x286041,_0x2dd326,_0x2f83d0){var _0x3193c3='';if(!_[_0x6352('0x2')](_0x2dd326)&&_0x6352('0x3')===typeof _0x2dd326){_0x3193c3+=_0x2dd326;}if(!_['isNil'](_0x2f83d0)&&'string'===typeof _0x2f83d0){_0x3193c3+='\x20'+_0x2f83d0;}if(_0x3193c3!==''){return _0x3193c3;}return _0x286041;}function Action(_0xdcea9,_0x181009,_0x42979f){this[_0x6352('0x4')]=_0xdcea9;this['uniqueid']=_0x42979f||undefined;this[_0x6352('0x5')]=checkNameSurname(_0x181009['Contact'][_0x6352('0x6')],_0x181009[_0x6352('0x7')][_0x6352('0x8')],_0x181009[_0x6352('0x7')]['lastName']);this['number']=_0x181009['phone'];this[_0x6352('0x9')]=_0xdcea9[_0x6352('0x5')];this[_0x6352('0xa')]=_0x181009[_0x6352('0xa')]||![];this['type']=_0xdcea9['type'];this[_0x6352('0xb')]=_0xdcea9[_0x6352('0xb')]||0x3;this[_0x6352('0xc')]=_0x181009[_0x6352('0xc')];this['countbusyretry']=_0x181009['countbusyretry'];this[_0x6352('0xd')]=_0x181009[_0x6352('0xd')];this[_0x6352('0xe')]=_0x181009['countnoanswerretry'];this[_0x6352('0xf')]=_0x181009['countnosuchnumberretry'];this[_0x6352('0x10')]=_0x181009[_0x6352('0x10')];this[_0x6352('0x11')]=_0x181009[_0x6352('0x11')];this[_0x6352('0x12')]=_0x181009[_0x6352('0x12')];this[_0x6352('0x13')]=_0x181009['countagentrejectretry'];this['ContactId']=_0x181009[_0x6352('0x14')];this[_0x6352('0x15')]=_0x181009[_0x6352('0x15')];this[_0x6352('0x16')]=_0x181009[_0x6352('0x16')];this['VoiceQueueId']=_0x181009[_0x6352('0x17')];this['CampaignId']=_0x181009[_0x6352('0x18')];this[_0x6352('0x19')]=_0x181009['id'];this[_0x6352('0x1a')]=_0x181009[_0x6352('0x7')][_0x6352('0x8')]||'';this[_0x6352('0x1b')]=moment()['format'](_0x6352('0x1c'));this[_0x6352('0x1d')]=_0x181009[_0x6352('0x1d')];this[_0x6352('0x1e')]=_0x181009['callbackuniqueid'];this[_0x6352('0x1f')]=_0x181009[_0x6352('0x1f')];this['recallme']=_0x181009[_0x6352('0x20')];this[_0x6352('0x21')]='';this[_0x6352('0x22')]='';}Action[_0x6352('0x23')][_0x6352('0x24')]=function(){return util[_0x6352('0x25')](_0x6352('0x26'),this[_0x6352('0x5')],this['voiceQueue'][_0x6352('0x27')]>0x0?this[_0x6352('0x28')][_0x6352('0x29')](this[_0x6352('0x4')][_0x6352('0x27')]):this[_0x6352('0x28')]);};Action['prototype'][_0x6352('0x2a')]=function(){return this[_0x6352('0x9')];};module[_0x6352('0x2b')]=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 5beab01..d0eafb9 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 _0x10ba=['campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type'];(function(_0x5e0224,_0x33da9d){var _0x1ce215=function(_0x3a9f57){while(--_0x3a9f57){_0x5e0224['push'](_0x5e0224['shift']());}};_0x1ce215(++_0x33da9d);}(_0x10ba,0x18e));var _0xa10b=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x10ba[_0x529abc];return _0x453afa;};'use strict';var moment=require(_0xa10b('0x0'));var utils=require(_0xa10b('0x1'));function AgentComplete(_0x3704f4,_0x3847bc){this[_0xa10b('0x2')]=0x4;this[_0xa10b('0x3')]=_0xa10b('0x4');this[_0xa10b('0x5')]=_0x3704f4[_0xa10b('0x5')];this[_0xa10b('0x6')]=_0x3704f4[_0xa10b('0x6')];this[_0xa10b('0x7')]=_0x3704f4['type']===_0xa10b('0x8')?'queue':_0x3704f4[_0xa10b('0x6')];this[_0xa10b('0x9')]=_0x3704f4['countbusyretry'];this['countcongestionretry']=_0x3704f4[_0xa10b('0xa')];this[_0xa10b('0xb')]=_0x3704f4[_0xa10b('0xb')];this[_0xa10b('0xc')]=_0x3704f4[_0xa10b('0x9')]+_0x3704f4[_0xa10b('0xa')]+_0x3704f4[_0xa10b('0xb')]+_0x3704f4[_0xa10b('0xd')]+_0x3704f4[_0xa10b('0xe')]+_0x3704f4[_0xa10b('0xf')]+_0x3704f4['countmachineretry']+_0x3704f4[_0xa10b('0x10')];this['countnosuchnumberretry']=_0x3704f4[_0xa10b('0xd')];this[_0xa10b('0xe')]=_0x3704f4[_0xa10b('0xe')];this[_0xa10b('0xf')]=_0x3704f4[_0xa10b('0xf')];this['countmachineretry']=_0x3704f4[_0xa10b('0x11')];this[_0xa10b('0x10')]=_0x3704f4[_0xa10b('0x10')];this[_0xa10b('0x12')]=_0x3847bc['uniqueid'];this['calleridname']=_0x3704f4[_0xa10b('0x13')];this[_0xa10b('0x14')]=_0x3704f4['number'];this[_0xa10b('0x15')]=_0x3704f4[_0xa10b('0x15')];this[_0xa10b('0x16')]=_0x3704f4['responsetime'];this[_0xa10b('0x17')]=_0x3704f4[_0xa10b('0x17')];this['endtime']=moment()[_0xa10b('0x18')](_0xa10b('0x19'));this['ringtime']=utils[_0xa10b('0x1a')](_0x3704f4['responsetime'],_0x3704f4[_0xa10b('0x15')]);this['holdtime']=utils[_0xa10b('0x1a')](_0x3704f4[_0xa10b('0x17')],_0x3704f4[_0xa10b('0x16')]);this[_0xa10b('0x1b')]=utils[_0xa10b('0x1a')](this[_0xa10b('0x1c')],_0x3704f4['answertime']);this[_0xa10b('0x1d')]=_0x3847bc[_0xa10b('0x1d')];this[_0xa10b('0x1e')]=_0x3847bc[_0xa10b('0x1e')];this[_0xa10b('0x1f')]=_0x3847bc[_0xa10b('0x1f')];this[_0xa10b('0x20')]=_0x3704f4[_0xa10b('0x20')];this[_0xa10b('0x21')]=_0x3704f4[_0xa10b('0x21')];this['callbackat']=_0x3704f4[_0xa10b('0x22')];this[_0xa10b('0x23')]=_0x3704f4[_0xa10b('0x23')];this[_0xa10b('0x24')]=_0x3704f4[_0xa10b('0x24')];this['ListId']=_0x3704f4[_0xa10b('0x25')];this[_0xa10b('0x26')]=_0x3704f4[_0xa10b('0x26')];this[_0xa10b('0x27')]=_0x3704f4[_0xa10b('0x27')];this['CampaignId']=_0x3704f4[_0xa10b('0x28')];this[_0xa10b('0x29')]=_0x3704f4[_0xa10b('0x29')]||'';this[_0xa10b('0x2a')]=_0x3704f4[_0xa10b('0x2a')]||'';this[_0xa10b('0x2b')]=_0x3704f4[_0xa10b('0x2b')];}module[_0xa10b('0x2c')]=AgentComplete; \ No newline at end of file +var _0xbb97=['countagentrejectretry','countmachineretry','uniqueid','name','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','answertime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xbb97,0x1d6));var _0x7bb9=function(_0x2366ea,_0x100507){_0x2366ea=_0x2366ea-0x0;var _0x3321c8=_0xbb97[_0x2366ea];return _0x3321c8;};'use strict';var moment=require('moment');var utils=require(_0x7bb9('0x0'));function AgentComplete(_0x28713d,_0x43d0f0){this['state']=0x4;this[_0x7bb9('0x1')]=_0x7bb9('0x2');this[_0x7bb9('0x3')]=_0x28713d['scheduledat'];this[_0x7bb9('0x4')]=_0x28713d[_0x7bb9('0x4')];this[_0x7bb9('0x5')]=_0x28713d[_0x7bb9('0x4')]===_0x7bb9('0x6')?'queue':_0x28713d[_0x7bb9('0x4')];this[_0x7bb9('0x7')]=_0x28713d[_0x7bb9('0x7')];this[_0x7bb9('0x8')]=_0x28713d[_0x7bb9('0x8')];this[_0x7bb9('0x9')]=_0x28713d[_0x7bb9('0x9')];this[_0x7bb9('0xa')]=_0x28713d[_0x7bb9('0x7')]+_0x28713d[_0x7bb9('0x8')]+_0x28713d[_0x7bb9('0x9')]+_0x28713d[_0x7bb9('0xb')]+_0x28713d[_0x7bb9('0xc')]+_0x28713d[_0x7bb9('0xd')]+_0x28713d['countmachineretry']+_0x28713d[_0x7bb9('0xe')];this[_0x7bb9('0xb')]=_0x28713d[_0x7bb9('0xb')];this['countdropretry']=_0x28713d[_0x7bb9('0xc')];this[_0x7bb9('0xd')]=_0x28713d[_0x7bb9('0xd')];this[_0x7bb9('0xf')]=_0x28713d[_0x7bb9('0xf')];this[_0x7bb9('0xe')]=_0x28713d[_0x7bb9('0xe')];this[_0x7bb9('0x10')]=_0x43d0f0[_0x7bb9('0x10')];this['calleridname']=_0x28713d[_0x7bb9('0x11')];this['calleridnum']=_0x28713d[_0x7bb9('0x12')];this[_0x7bb9('0x13')]=_0x28713d[_0x7bb9('0x13')];this['responsetime']=_0x28713d['responsetime'];this['answertime']=_0x28713d['answertime'];this[_0x7bb9('0x14')]=moment()[_0x7bb9('0x15')](_0x7bb9('0x16'));this[_0x7bb9('0x17')]=utils[_0x7bb9('0x18')](_0x28713d[_0x7bb9('0x19')],_0x28713d[_0x7bb9('0x13')]);this[_0x7bb9('0x1a')]=utils[_0x7bb9('0x18')](_0x28713d[_0x7bb9('0x1b')],_0x28713d[_0x7bb9('0x19')]);this['talktime']=utils[_0x7bb9('0x18')](this[_0x7bb9('0x14')],_0x28713d[_0x7bb9('0x1b')]);this[_0x7bb9('0x1c')]=_0x43d0f0[_0x7bb9('0x1c')];this[_0x7bb9('0x1d')]=_0x43d0f0['membername'];this['reason']=_0x43d0f0[_0x7bb9('0x1e')];this[_0x7bb9('0x1f')]=_0x28713d['callback'];this[_0x7bb9('0x20')]=_0x28713d['callbackuniqueid'];this[_0x7bb9('0x21')]=_0x28713d[_0x7bb9('0x21')];this['recallme']=_0x28713d[_0x7bb9('0x22')];this[_0x7bb9('0x23')]=_0x28713d[_0x7bb9('0x23')];this[_0x7bb9('0x24')]=_0x28713d[_0x7bb9('0x24')];this[_0x7bb9('0x25')]=_0x28713d['UserId'];this[_0x7bb9('0x26')]=_0x28713d[_0x7bb9('0x26')];this[_0x7bb9('0x27')]=_0x28713d[_0x7bb9('0x27')];this['originatecalleridnum']=_0x28713d[_0x7bb9('0x28')]||'';this[_0x7bb9('0x29')]=_0x28713d['originatecalleridname']||'';this[_0x7bb9('0x2a')]=_0x28713d[_0x7bb9('0x2a')];}module[_0x7bb9('0x2b')]=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 726ec0c..2a6e307 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 _0xd22e=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xd22e,0x141));var _0xed22=function(_0x17971a,_0x8014bf){_0x17971a=_0x17971a-0x0;var _0x11f2cc=_0xd22e[_0x17971a];return _0x11f2cc;};'use strict';function Final(_0x339afa){this[_0xed22('0x0')]=_0x339afa[_0xed22('0x0')];this[_0xed22('0x1')]=_0x339afa[_0xed22('0x1')];this[_0xed22('0x2')]=_0x339afa['type'];this[_0xed22('0x3')]=_0x339afa[_0xed22('0x2')]==='outbound'?_0xed22('0x4'):_0x339afa[_0xed22('0x2')];this[_0xed22('0x5')]=_0x339afa['countbusyretry'];this[_0xed22('0x6')]=_0x339afa[_0xed22('0x6')];this[_0xed22('0x7')]=_0x339afa[_0xed22('0x7')];this['countglobal']=_0x339afa[_0xed22('0x5')]+_0x339afa[_0xed22('0x6')]+_0x339afa['countnoanswerretry']+_0x339afa[_0xed22('0x8')]+_0x339afa[_0xed22('0x9')]+_0x339afa[_0xed22('0xa')]+_0x339afa[_0xed22('0xb')]+_0x339afa[_0xed22('0xc')];this[_0xed22('0x8')]=_0x339afa['countnosuchnumberretry'];this[_0xed22('0x9')]=_0x339afa[_0xed22('0x9')];this[_0xed22('0xa')]=_0x339afa[_0xed22('0xa')];this['countmachineretry']=_0x339afa[_0xed22('0xb')];this['countagentrejectretry']=_0x339afa[_0xed22('0xc')];this['queue']=_0x339afa['queue'];this['calleridname']=_0x339afa[_0xed22('0xd')];this[_0xed22('0xe')]=_0x339afa[_0xed22('0xe')];this['starttime']=_0x339afa[_0xed22('0xf')];this[_0xed22('0x10')]=_0x339afa['responsetime'];this['endtime']=_0x339afa[_0xed22('0x10')];this['ringtime']=_0x339afa[_0xed22('0x11')]||0x0;this[_0xed22('0x12')]=_0x339afa['holdtime']||0x0;this[_0xed22('0x13')]=_0x339afa[_0xed22('0x13')]||0x0;this['callback']=_0x339afa[_0xed22('0x14')];this['callbackuniqueid']=_0x339afa[_0xed22('0x15')];this[_0xed22('0x16')]=_0x339afa[_0xed22('0x16')];this['recallme']=_0x339afa[_0xed22('0x17')];this[_0xed22('0x18')]=_0x339afa['ContactId'];this['ListId']=_0x339afa[_0xed22('0x19')];this[_0xed22('0x1a')]=_0x339afa[_0xed22('0x1a')];this['VoiceQueueId']=_0x339afa[_0xed22('0x1b')];this[_0xed22('0x1c')]=_0x339afa['CampaignId'];this[_0xed22('0x1d')]=_0x339afa[_0xed22('0x1d')]||'';this['originatecalleridname']=_0x339afa[_0xed22('0x1e')]||'';this[_0xed22('0x1f')]=_0x339afa[_0xed22('0x1f')];this[_0xed22('0x20')]=_0x339afa[_0xed22('0x20')];}module[_0xed22('0x21')]=Final; \ No newline at end of file +var _0x3b06=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b06,0x199));var _0x63b0=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x3b06[_0x218972];return _0x1bb1a8;};'use strict';function Final(_0x1fbab4){this[_0x63b0('0x0')]=_0x1fbab4[_0x63b0('0x0')];this[_0x63b0('0x1')]=_0x1fbab4[_0x63b0('0x1')];this[_0x63b0('0x2')]=_0x1fbab4[_0x63b0('0x2')];this['campaigntype']=_0x1fbab4[_0x63b0('0x2')]===_0x63b0('0x3')?_0x63b0('0x4'):_0x1fbab4[_0x63b0('0x2')];this[_0x63b0('0x5')]=_0x1fbab4[_0x63b0('0x5')];this[_0x63b0('0x6')]=_0x1fbab4[_0x63b0('0x6')];this[_0x63b0('0x7')]=_0x1fbab4[_0x63b0('0x7')];this[_0x63b0('0x8')]=_0x1fbab4[_0x63b0('0x5')]+_0x1fbab4[_0x63b0('0x6')]+_0x1fbab4[_0x63b0('0x7')]+_0x1fbab4['countnosuchnumberretry']+_0x1fbab4[_0x63b0('0x9')]+_0x1fbab4[_0x63b0('0xa')]+_0x1fbab4[_0x63b0('0xb')]+_0x1fbab4[_0x63b0('0xc')];this[_0x63b0('0xd')]=_0x1fbab4['countnosuchnumberretry'];this[_0x63b0('0x9')]=_0x1fbab4[_0x63b0('0x9')];this[_0x63b0('0xa')]=_0x1fbab4[_0x63b0('0xa')];this[_0x63b0('0xb')]=_0x1fbab4[_0x63b0('0xb')];this['countagentrejectretry']=_0x1fbab4[_0x63b0('0xc')];this[_0x63b0('0x4')]=_0x1fbab4[_0x63b0('0x4')];this[_0x63b0('0xe')]=_0x1fbab4[_0x63b0('0xe')];this[_0x63b0('0xf')]=_0x1fbab4[_0x63b0('0xf')];this[_0x63b0('0x10')]=_0x1fbab4[_0x63b0('0x10')];this['responsetime']=_0x1fbab4[_0x63b0('0x11')];this[_0x63b0('0x12')]=_0x1fbab4['responsetime'];this[_0x63b0('0x13')]=_0x1fbab4['ringtime']||0x0;this[_0x63b0('0x14')]=_0x1fbab4[_0x63b0('0x14')]||0x0;this[_0x63b0('0x15')]=_0x1fbab4[_0x63b0('0x15')]||0x0;this[_0x63b0('0x16')]=_0x1fbab4[_0x63b0('0x16')];this[_0x63b0('0x17')]=_0x1fbab4[_0x63b0('0x17')];this[_0x63b0('0x18')]=_0x1fbab4[_0x63b0('0x18')];this[_0x63b0('0x19')]=_0x1fbab4[_0x63b0('0x19')];this['ContactId']=_0x1fbab4[_0x63b0('0x1a')];this[_0x63b0('0x1b')]=_0x1fbab4[_0x63b0('0x1b')];this[_0x63b0('0x1c')]=_0x1fbab4[_0x63b0('0x1c')];this[_0x63b0('0x1d')]=_0x1fbab4[_0x63b0('0x1d')];this[_0x63b0('0x1e')]=_0x1fbab4['CampaignId'];this[_0x63b0('0x1f')]=_0x1fbab4['originatecalleridnum']||'';this[_0x63b0('0x20')]=_0x1fbab4[_0x63b0('0x20')]||'';this[_0x63b0('0x21')]=_0x1fbab4[_0x63b0('0x21')];this[_0x63b0('0x22')]=_0x1fbab4[_0x63b0('0x22')];}module[_0x63b0('0x23')]=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 f9965df..b2e1ca8 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 _0x2d71=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d71,0x131));var _0x12d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2d71[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x12d7('0x0'));var utils=require(_0x12d7('0x1'));function Hangup(_0x19334e,_0x2d4b24){this[_0x12d7('0x2')]=0x4;this[_0x12d7('0x3')]=_0x12d7('0x4');this[_0x12d7('0x5')]=_0x19334e[_0x12d7('0x5')];this[_0x12d7('0x6')]=_0x19334e[_0x12d7('0x6')];this[_0x12d7('0x7')]=_0x19334e[_0x12d7('0x6')]===_0x12d7('0x8')?_0x12d7('0x9'):_0x19334e[_0x12d7('0x6')];this[_0x12d7('0xa')]=_0x19334e['amd']||![];this[_0x12d7('0xb')]=_0x19334e[_0x12d7('0xb')];this[_0x12d7('0xc')]=_0x19334e[_0x12d7('0xc')];this['countnoanswerretry']=_0x19334e[_0x12d7('0xd')];this[_0x12d7('0xe')]=_0x19334e[_0x12d7('0xb')]+_0x19334e[_0x12d7('0xc')]+_0x19334e['countnoanswerretry']+_0x19334e['countnosuchnumberretry']+_0x19334e[_0x12d7('0xf')]+_0x19334e[_0x12d7('0x10')]+_0x19334e[_0x12d7('0x11')]+_0x19334e[_0x12d7('0x12')];this[_0x12d7('0x13')]=_0x19334e[_0x12d7('0x13')];this[_0x12d7('0xf')]=_0x19334e[_0x12d7('0xf')];this[_0x12d7('0x10')]=_0x19334e[_0x12d7('0x10')];this['countmachineretry']=_0x19334e['countmachineretry'];this[_0x12d7('0x12')]=_0x19334e[_0x12d7('0x12')];this[_0x12d7('0x14')]=_0x2d4b24['uniqueid'];this[_0x12d7('0x15')]=_0x19334e[_0x12d7('0x16')];this[_0x12d7('0x17')]=_0x19334e[_0x12d7('0x18')];this[_0x12d7('0x19')]=_0x19334e[_0x12d7('0x19')];this[_0x12d7('0x1a')]=_0x19334e[_0x12d7('0x1a')];this[_0x12d7('0x1b')]=moment()[_0x12d7('0x1c')](_0x12d7('0x1d'));this['ringtime']=utils[_0x12d7('0x1e')](_0x19334e[_0x12d7('0x1a')],_0x19334e['starttime']);this['holdtime']=0x0;this[_0x12d7('0x1f')]=utils[_0x12d7('0x1e')](this[_0x12d7('0x1b')],_0x19334e['responsetime']);this[_0x12d7('0x9')]=_0x19334e['queue'];this[_0x12d7('0x20')]=_0x12d7('0x21');this[_0x12d7('0x22')]=_0x2d4b24[_0x12d7('0x23')];this[_0x12d7('0x24')]=_0x19334e[_0x12d7('0x24')];this[_0x12d7('0x25')]=_0x19334e['callbackuniqueid'];this[_0x12d7('0x26')]=_0x19334e[_0x12d7('0x26')];this[_0x12d7('0x27')]=_0x19334e['recallme'];this[_0x12d7('0x28')]=_0x19334e[_0x12d7('0x28')];this['ListId']=_0x19334e[_0x12d7('0x29')];this['UserId']=_0x19334e[_0x12d7('0x2a')];this[_0x12d7('0x2b')]=_0x19334e[_0x12d7('0x2b')];this[_0x12d7('0x2c')]=_0x19334e[_0x12d7('0x2c')];}module[_0x12d7('0x2d')]=Hangup; \ No newline at end of file +var _0xbe5c=['CampaignId','moment','../utils','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xbe5c,0x119));var _0xcbe5=function(_0x1d086d,_0x4e33a9){_0x1d086d=_0x1d086d-0x0;var _0x1bc8ca=_0xbe5c[_0x1d086d];return _0x1bc8ca;};'use strict';var moment=require(_0xcbe5('0x0'));var utils=require(_0xcbe5('0x1'));function Hangup(_0x2b0918,_0x70eff0){this[_0xcbe5('0x2')]=0x4;this['statedesc']=_0xcbe5('0x3');this[_0xcbe5('0x4')]=_0x2b0918['scheduledat'];this['type']=_0x2b0918['type'];this['campaigntype']=_0x2b0918[_0xcbe5('0x5')]===_0xcbe5('0x6')?_0xcbe5('0x7'):_0x2b0918['type'];this[_0xcbe5('0x8')]=_0x2b0918['amd']||![];this[_0xcbe5('0x9')]=_0x2b0918[_0xcbe5('0x9')];this['countcongestionretry']=_0x2b0918[_0xcbe5('0xa')];this[_0xcbe5('0xb')]=_0x2b0918[_0xcbe5('0xb')];this[_0xcbe5('0xc')]=_0x2b0918['countbusyretry']+_0x2b0918[_0xcbe5('0xa')]+_0x2b0918[_0xcbe5('0xb')]+_0x2b0918['countnosuchnumberretry']+_0x2b0918[_0xcbe5('0xd')]+_0x2b0918['countabandonedretry']+_0x2b0918[_0xcbe5('0xe')]+_0x2b0918[_0xcbe5('0xf')];this[_0xcbe5('0x10')]=_0x2b0918['countnosuchnumberretry'];this[_0xcbe5('0xd')]=_0x2b0918[_0xcbe5('0xd')];this[_0xcbe5('0x11')]=_0x2b0918[_0xcbe5('0x11')];this['countmachineretry']=_0x2b0918[_0xcbe5('0xe')];this['countagentrejectretry']=_0x2b0918['countagentrejectretry'];this[_0xcbe5('0x12')]=_0x70eff0[_0xcbe5('0x12')];this[_0xcbe5('0x13')]=_0x2b0918['name'];this[_0xcbe5('0x14')]=_0x2b0918[_0xcbe5('0x15')];this[_0xcbe5('0x16')]=_0x2b0918[_0xcbe5('0x16')];this[_0xcbe5('0x17')]=_0x2b0918['responsetime'];this[_0xcbe5('0x18')]=moment()['format'](_0xcbe5('0x19'));this[_0xcbe5('0x1a')]=utils['getSeconds'](_0x2b0918['responsetime'],_0x2b0918[_0xcbe5('0x16')]);this['holdtime']=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x2b0918[_0xcbe5('0x17')]);this[_0xcbe5('0x7')]=_0x2b0918['queue'];this[_0xcbe5('0x1b')]=_0xcbe5('0x1c');this[_0xcbe5('0x1d')]=_0x70eff0[_0xcbe5('0x1e')];this[_0xcbe5('0x1f')]=_0x2b0918[_0xcbe5('0x1f')];this[_0xcbe5('0x20')]=_0x2b0918[_0xcbe5('0x20')];this[_0xcbe5('0x21')]=_0x2b0918['callbackat'];this['recallme']=_0x2b0918[_0xcbe5('0x22')];this[_0xcbe5('0x23')]=_0x2b0918['ContactId'];this[_0xcbe5('0x24')]=_0x2b0918[_0xcbe5('0x24')];this[_0xcbe5('0x25')]=_0x2b0918[_0xcbe5('0x25')];this[_0xcbe5('0x26')]=_0x2b0918[_0xcbe5('0x26')];this[_0xcbe5('0x27')]=_0x2b0918[_0xcbe5('0x27')];}module['exports']=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 fd29b70..3c85d86 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 _0x0dce=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x3037b8,_0x5a886b){var _0x1ed148=function(_0x11a83e){while(--_0x11a83e){_0x3037b8['push'](_0x3037b8['shift']());}};_0x1ed148(++_0x5a886b);}(_0x0dce,0x16b));var _0xe0dc=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x0dce[_0x36eaaa];return _0x461349;};'use strict';var utils=require(_0xe0dc('0x0'));function History(_0x16a44c){this[_0xe0dc('0x1')]=_0x16a44c[_0xe0dc('0x1')];this[_0xe0dc('0x2')]=_0x16a44c['scheduledat']||undefined;this[_0xe0dc('0x3')]=_0x16a44c['type'];this[_0xe0dc('0x4')]=_0x16a44c['type']===_0xe0dc('0x5')?_0xe0dc('0x6'):_0x16a44c[_0xe0dc('0x3')];this[_0xe0dc('0x7')]=_0x16a44c[_0xe0dc('0x7')];this['countcongestionretry']=_0x16a44c[_0xe0dc('0x8')];this[_0xe0dc('0x9')]=_0x16a44c[_0xe0dc('0x9')];this['countglobal']=_0x16a44c[_0xe0dc('0x7')]+_0x16a44c[_0xe0dc('0x8')]+_0x16a44c[_0xe0dc('0x9')]+_0x16a44c[_0xe0dc('0xa')]+_0x16a44c[_0xe0dc('0xb')]+_0x16a44c['countabandonedretry']+_0x16a44c['countmachineretry']+_0x16a44c[_0xe0dc('0xc')];this[_0xe0dc('0xa')]=_0x16a44c[_0xe0dc('0xa')];this['countdropretry']=_0x16a44c[_0xe0dc('0xb')];this['countabandonedretry']=_0x16a44c[_0xe0dc('0xd')];this[_0xe0dc('0xe')]=_0x16a44c[_0xe0dc('0xe')];this[_0xe0dc('0xc')]=_0x16a44c[_0xe0dc('0xc')];this[_0xe0dc('0x6')]=_0x16a44c[_0xe0dc('0x6')];this[_0xe0dc('0xf')]=_0x16a44c[_0xe0dc('0x10')];this[_0xe0dc('0x11')]=_0x16a44c['number'];this['starttime']=_0x16a44c[_0xe0dc('0x12')];this[_0xe0dc('0x13')]=_0x16a44c[_0xe0dc('0x13')];this['endtime']=_0x16a44c[_0xe0dc('0x13')];this[_0xe0dc('0x14')]=utils[_0xe0dc('0x15')](_0x16a44c['responsetime'],_0x16a44c['starttime']);this[_0xe0dc('0x16')]=0x0;this[_0xe0dc('0x17')]=0x0;this[_0xe0dc('0x18')]=_0x16a44c[_0xe0dc('0x18')];this[_0xe0dc('0x19')]=_0x16a44c[_0xe0dc('0x19')];this[_0xe0dc('0x1a')]=_0x16a44c[_0xe0dc('0x1a')];this[_0xe0dc('0x1b')]=_0x16a44c[_0xe0dc('0x1b')];this[_0xe0dc('0x1c')]=_0x16a44c['ContactId'];this[_0xe0dc('0x1d')]=_0x16a44c[_0xe0dc('0x1d')];this[_0xe0dc('0x1e')]=_0x16a44c['UserId'];this[_0xe0dc('0x1f')]=_0x16a44c[_0xe0dc('0x1f')];this[_0xe0dc('0x20')]=_0x16a44c['CampaignId'];this[_0xe0dc('0x21')]=_0x16a44c[_0xe0dc('0x21')]||'';this['originatecalleridname']=_0x16a44c['originatecalleridname']||'';this[_0xe0dc('0x22')]=_0x16a44c[_0xe0dc('0x22')];this[_0xe0dc('0x23')]=_0x16a44c[_0xe0dc('0x23')];}module[_0xe0dc('0x24')]=History; \ No newline at end of file +var _0x84a0=['../utils','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','name','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x274a80,_0x963945){var _0x526b7c=function(_0x38f0fe){while(--_0x38f0fe){_0x274a80['push'](_0x274a80['shift']());}};_0x526b7c(++_0x963945);}(_0x84a0,0x66));var _0x084a=function(_0x15eb2d,_0x34e2a7){_0x15eb2d=_0x15eb2d-0x0;var _0xa7408b=_0x84a0[_0x15eb2d];return _0xa7408b;};'use strict';var utils=require(_0x084a('0x0'));function History(_0x1538c2){this[_0x084a('0x1')]=_0x1538c2[_0x084a('0x1')];this['scheduledat']=_0x1538c2[_0x084a('0x2')]||undefined;this[_0x084a('0x3')]=_0x1538c2['type'];this['campaigntype']=_0x1538c2[_0x084a('0x3')]===_0x084a('0x4')?'queue':_0x1538c2[_0x084a('0x3')];this[_0x084a('0x5')]=_0x1538c2[_0x084a('0x5')];this[_0x084a('0x6')]=_0x1538c2[_0x084a('0x6')];this['countnoanswerretry']=_0x1538c2[_0x084a('0x7')];this[_0x084a('0x8')]=_0x1538c2[_0x084a('0x5')]+_0x1538c2[_0x084a('0x6')]+_0x1538c2[_0x084a('0x7')]+_0x1538c2['countnosuchnumberretry']+_0x1538c2['countdropretry']+_0x1538c2[_0x084a('0x9')]+_0x1538c2[_0x084a('0xa')]+_0x1538c2[_0x084a('0xb')];this[_0x084a('0xc')]=_0x1538c2[_0x084a('0xc')];this['countdropretry']=_0x1538c2['countdropretry'];this[_0x084a('0x9')]=_0x1538c2[_0x084a('0x9')];this[_0x084a('0xa')]=_0x1538c2[_0x084a('0xa')];this[_0x084a('0xb')]=_0x1538c2[_0x084a('0xb')];this[_0x084a('0xd')]=_0x1538c2[_0x084a('0xd')];this['calleridname']=_0x1538c2[_0x084a('0xe')];this['calleridnum']=_0x1538c2[_0x084a('0xf')];this[_0x084a('0x10')]=_0x1538c2[_0x084a('0x10')];this[_0x084a('0x11')]=_0x1538c2[_0x084a('0x11')];this['endtime']=_0x1538c2[_0x084a('0x11')];this['ringtime']=utils[_0x084a('0x12')](_0x1538c2[_0x084a('0x11')],_0x1538c2['starttime']);this[_0x084a('0x13')]=0x0;this[_0x084a('0x14')]=0x0;this[_0x084a('0x15')]=_0x1538c2[_0x084a('0x15')];this[_0x084a('0x16')]=_0x1538c2[_0x084a('0x16')];this[_0x084a('0x17')]=_0x1538c2[_0x084a('0x17')];this[_0x084a('0x18')]=_0x1538c2[_0x084a('0x18')];this[_0x084a('0x19')]=_0x1538c2[_0x084a('0x19')];this[_0x084a('0x1a')]=_0x1538c2[_0x084a('0x1a')];this[_0x084a('0x1b')]=_0x1538c2['UserId'];this[_0x084a('0x1c')]=_0x1538c2[_0x084a('0x1c')];this[_0x084a('0x1d')]=_0x1538c2[_0x084a('0x1d')];this[_0x084a('0x1e')]=_0x1538c2['originatecalleridnum']||'';this[_0x084a('0x1f')]=_0x1538c2[_0x084a('0x1f')]||'';this[_0x084a('0x20')]=_0x1538c2[_0x084a('0x20')];this[_0x084a('0x21')]=_0x1538c2[_0x084a('0x21')];}module['exports']=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 d14494e..a8291a1 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 _0x2116=['starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x6fa1c9,_0x1834f2){var _0x3ebf6f=function(_0x132805){while(--_0x132805){_0x6fa1c9['push'](_0x6fa1c9['shift']());}};_0x3ebf6f(++_0x1834f2);}(_0x2116,0x1f2));var _0x6211=function(_0xf29fa8,_0x4e2f6b){_0xf29fa8=_0xf29fa8-0x0;var _0x5a7b84=_0x2116[_0xf29fa8];return _0x5a7b84;};'use strict';var utils=require(_0x6211('0x0'));function QueueCallerAbandon(_0x5a3613,_0x57c015){this[_0x6211('0x1')]=_0x5a3613[_0x6211('0x1')];this[_0x6211('0x2')]=_0x5a3613[_0x6211('0x2')];this[_0x6211('0x3')]=_0x5a3613['type']===_0x6211('0x4')?'queue':_0x5a3613[_0x6211('0x2')];this[_0x6211('0x5')]=_0x5a3613[_0x6211('0x5')];this[_0x6211('0x6')]=_0x5a3613[_0x6211('0x6')];this[_0x6211('0x7')]=_0x5a3613[_0x6211('0x7')];this[_0x6211('0x8')]=_0x5a3613[_0x6211('0x5')]+_0x5a3613[_0x6211('0x6')]+_0x5a3613[_0x6211('0x7')]+_0x5a3613[_0x6211('0x9')]+_0x5a3613[_0x6211('0xa')]+_0x5a3613[_0x6211('0xb')]+_0x5a3613[_0x6211('0xc')]+_0x5a3613[_0x6211('0xd')];this['countnosuchnumberretry']=_0x5a3613['countnosuchnumberretry'];this[_0x6211('0xa')]=_0x5a3613[_0x6211('0xa')];this[_0x6211('0xb')]=_0x5a3613[_0x6211('0xb')];this[_0x6211('0xc')]=_0x5a3613[_0x6211('0xc')];this['countagentrejectretry']=_0x5a3613[_0x6211('0xd')];this[_0x6211('0xe')]=_0x57c015['uniqueid'];this[_0x6211('0xf')]=_0x5a3613[_0x6211('0x10')];this[_0x6211('0x11')]=_0x5a3613[_0x6211('0x12')];this[_0x6211('0x13')]=_0x5a3613['starttime'];this[_0x6211('0x14')]=_0x5a3613[_0x6211('0x14')];this[_0x6211('0x15')]=_0x5a3613['droptime'];this['dropreason']=_0x5a3613[_0x6211('0x16')];this[_0x6211('0x17')]=this[_0x6211('0x15')];this[_0x6211('0x18')]=utils[_0x6211('0x19')](_0x5a3613[_0x6211('0x14')],_0x5a3613[_0x6211('0x13')]);this[_0x6211('0x1a')]=utils[_0x6211('0x19')](this[_0x6211('0x15')],_0x5a3613['responsetime']);this[_0x6211('0x1b')]=0x0;this[_0x6211('0x1c')]=_0x57c015[_0x6211('0x1c')];this[_0x6211('0x1d')]=_0x57c015[_0x6211('0x1e')];this[_0x6211('0x1f')]=_0x57c015['reason'];this[_0x6211('0x20')]=_0x5a3613[_0x6211('0x20')];this['callbackuniqueid']=_0x5a3613[_0x6211('0x21')];this[_0x6211('0x22')]=_0x5a3613[_0x6211('0x22')];this[_0x6211('0x23')]=_0x5a3613[_0x6211('0x23')];this[_0x6211('0x24')]=_0x5a3613['ContactId'];this[_0x6211('0x25')]=_0x5a3613[_0x6211('0x25')];this[_0x6211('0x26')]=_0x5a3613[_0x6211('0x26')];this[_0x6211('0x27')]=_0x5a3613[_0x6211('0x27')];this[_0x6211('0x28')]=_0x5a3613[_0x6211('0x28')];this[_0x6211('0x29')]=_0x5a3613['originatecalleridnum']||'';this[_0x6211('0x2a')]=_0x5a3613['originatecalleridname']||'';this['agiafterat']=_0x5a3613[_0x6211('0x2b')];this[_0x6211('0x2c')]=_0x5a3613['state'];this[_0x6211('0x2d')]=_0x5a3613['statedesc'];}module[_0x6211('0x2e')]=QueueCallerAbandon; \ No newline at end of file +var _0x9daf=['dropreason','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9daf,0x16d));var _0xf9da=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9daf[_0x6cf19c];return _0xce14f3;};'use strict';var utils=require(_0xf9da('0x0'));function QueueCallerAbandon(_0x2998b8,_0x586740){this[_0xf9da('0x1')]=_0x2998b8[_0xf9da('0x1')];this[_0xf9da('0x2')]=_0x2998b8['type'];this[_0xf9da('0x3')]=_0x2998b8[_0xf9da('0x2')]===_0xf9da('0x4')?_0xf9da('0x5'):_0x2998b8[_0xf9da('0x2')];this[_0xf9da('0x6')]=_0x2998b8[_0xf9da('0x6')];this[_0xf9da('0x7')]=_0x2998b8[_0xf9da('0x7')];this[_0xf9da('0x8')]=_0x2998b8[_0xf9da('0x8')];this[_0xf9da('0x9')]=_0x2998b8[_0xf9da('0x6')]+_0x2998b8[_0xf9da('0x7')]+_0x2998b8[_0xf9da('0x8')]+_0x2998b8[_0xf9da('0xa')]+_0x2998b8['countdropretry']+_0x2998b8['countabandonedretry']+_0x2998b8[_0xf9da('0xb')]+_0x2998b8['countagentrejectretry'];this[_0xf9da('0xa')]=_0x2998b8[_0xf9da('0xa')];this[_0xf9da('0xc')]=_0x2998b8['countdropretry'];this['countabandonedretry']=_0x2998b8['countabandonedretry'];this['countmachineretry']=_0x2998b8[_0xf9da('0xb')];this[_0xf9da('0xd')]=_0x2998b8[_0xf9da('0xd')];this['uniqueid']=_0x586740[_0xf9da('0xe')];this[_0xf9da('0xf')]=_0x2998b8[_0xf9da('0x10')];this[_0xf9da('0x11')]=_0x2998b8[_0xf9da('0x12')];this['starttime']=_0x2998b8[_0xf9da('0x13')];this['responsetime']=_0x2998b8[_0xf9da('0x14')];this[_0xf9da('0x15')]=_0x2998b8[_0xf9da('0x15')];this[_0xf9da('0x16')]=_0x2998b8[_0xf9da('0x16')];this['endtime']=this[_0xf9da('0x15')];this[_0xf9da('0x17')]=utils[_0xf9da('0x18')](_0x2998b8['responsetime'],_0x2998b8['starttime']);this['holdtime']=utils[_0xf9da('0x18')](this[_0xf9da('0x15')],_0x2998b8[_0xf9da('0x14')]);this[_0xf9da('0x19')]=0x0;this[_0xf9da('0x5')]=_0x586740['queue'];this[_0xf9da('0x1a')]=_0x586740['connectedlinename'];this['reason']=_0x586740[_0xf9da('0x1b')];this[_0xf9da('0x1c')]=_0x2998b8[_0xf9da('0x1c')];this[_0xf9da('0x1d')]=_0x2998b8[_0xf9da('0x1d')];this['callbackat']=_0x2998b8[_0xf9da('0x1e')];this[_0xf9da('0x1f')]=_0x2998b8[_0xf9da('0x1f')];this[_0xf9da('0x20')]=_0x2998b8['ContactId'];this[_0xf9da('0x21')]=_0x2998b8[_0xf9da('0x21')];this[_0xf9da('0x22')]=_0x2998b8['UserId'];this['VoiceQueueId']=_0x2998b8[_0xf9da('0x23')];this[_0xf9da('0x24')]=_0x2998b8[_0xf9da('0x24')];this['originatecalleridnum']=_0x2998b8[_0xf9da('0x25')]||'';this[_0xf9da('0x26')]=_0x2998b8[_0xf9da('0x26')]||'';this[_0xf9da('0x27')]=_0x2998b8[_0xf9da('0x27')];this[_0xf9da('0x28')]=_0x2998b8[_0xf9da('0x28')];this[_0xf9da('0x29')]=_0x2998b8[_0xf9da('0x29')];}module[_0xf9da('0x2a')]=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 d450753..0a0ded1 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 _0xf072=['dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','[rescheduleContact]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x13c625,_0xc65b8e){var _0x1f2506=function(_0x318ccc){while(--_0x318ccc){_0x13c625['push'](_0x13c625['shift']());}};_0x1f2506(++_0xc65b8e);}(_0xf072,0x1cf));var _0x2f07=function(_0x575b97,_0xb2deb0){_0x575b97=_0x575b97-0x0;var _0x16e419=_0xf072[_0x575b97];return _0x16e419;};'use strict';var util=require(_0x2f07('0x0'));var logger=require(_0x2f07('0x1'))(_0x2f07('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x2f07('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x2f07('0x4'));function inspectError(_0x432696){return util[_0x2f07('0x5')](_0x432696,{'showHidden':![],'depth':null});}function getContactDialer(_0x48d7b6,_0x1d5a33,_0x14d6e6){return cmHopper[_0x2f07('0x6')](_0x48d7b6['id'],_0x1d5a33,_0x14d6e6,_0x48d7b6[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0xf73d1a){_0x48d7b6[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xb'),inspectError(_0xf73d1a));});}exports[_0x2f07('0x6')]=getContactDialer;function getContactDialerIvr(_0x30c638,_0x2e372c){return cmHopper[_0x2f07('0xc')](_0x30c638['id'],_0x2e372c,_0x30c638[_0x2f07('0x7')])[_0x2f07('0x8')](function(_0x564260){_0x30c638[_0x2f07('0x9')]=0x0;logger[_0x2f07('0xa')](_0x2f07('0xd'),inspectError(_0x564260));});}exports[_0x2f07('0xc')]=getContactDialerIvr;function countReScheduled(_0x496d87){return cmHopper['countReScheduled'](_0x496d87)[_0x2f07('0x8')](function(_0x1e291d){logger['error'](_0x2f07('0xe'),inspectError(_0x1e291d));});}exports[_0x2f07('0xf')]=countReScheduled;function rescheduleContact(_0x26edfa){return cmHopper['rescheduleContact'](_0x26edfa)[_0x2f07('0x8')](function(_0x443fdc){logger[_0x2f07('0xa')](_0x2f07('0x10'),inspectError(_0x443fdc));});}exports[_0x2f07('0x11')]=rescheduleContact;function unlockContact(_0x309908,_0x5d32d6,_0x8475cf){return cmHopper['unlockContact'](_0x309908,_0x5d32d6,_0x8475cf)[_0x2f07('0x8')](function(_0xe8cf4d){logger[_0x2f07('0xa')](_0x2f07('0x12'),inspectError(_0xe8cf4d));});}exports[_0x2f07('0x13')]=unlockContact;function moveContactManagedDialer(_0x46c9b4){return cmHopper[_0x2f07('0x14')](_0x46c9b4)[_0x2f07('0x8')](function(_0x55bd60){logger[_0x2f07('0xa')]('[moveContactManagedDialer]',inspectError(_0x55bd60));});}exports[_0x2f07('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x2df6ed){return cmHopperBlack[_0x2f07('0x15')](_0x2df6ed)[_0x2f07('0x8')](function(_0x2ef47d){logger['error'](_0x2f07('0x16'),inspectError(_0x2ef47d));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x5db56b){return cmHopperBlack['checkIsBlackListIvr'](_0x5db56b)[_0x2f07('0x8')](function(_0x51c285){logger[_0x2f07('0xa')]('[checkIsBlackListIvr]',inspectError(_0x51c285));});}exports[_0x2f07('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2c495f,_0x12a2a5,_0x307888){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2c495f,_0x12a2a5,_0x307888)[_0x2f07('0x8')](function(_0x428d8c){logger[_0x2f07('0xa')]('[verifyAdditionalPhone]',inspectError(_0x428d8c));});}exports[_0x2f07('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x113916,_0x522006,_0x1dcedc){return cmHopperAdditionalPhone[_0x2f07('0x19')](_0x113916,_0x522006,_0x1dcedc)['catch'](function(_0x427e13){logger['error'](_0x2f07('0x1a'),inspectError(_0x427e13));});}exports[_0x2f07('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x27bd72){return cmHopperHistory[_0x2f07('0x1b')](_0x27bd72)[_0x2f07('0x8')](function(_0x139ea8){logger[_0x2f07('0xa')](_0x2f07('0x1c'),inspectError(_0x139ea8));});}exports[_0x2f07('0x1b')]=avgHandleTime;function createHistory(_0x468cd8){return cmHopperHistory[_0x2f07('0x1d')](_0x468cd8)[_0x2f07('0x8')](function(_0x4c607a){logger[_0x2f07('0xa')](_0x2f07('0x1e'),inspectError(_0x4c607a));});}exports[_0x2f07('0x1d')]=createHistory; \ No newline at end of file +var _0x1623=['swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','catch','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]'];(function(_0x527a47,_0x2d4a52){var _0x4f8f1c=function(_0x2cd21a){while(--_0x2cd21a){_0x527a47['push'](_0x527a47['shift']());}};_0x4f8f1c(++_0x2d4a52);}(_0x1623,0xab));var _0x3162=function(_0x5afe67,_0x2fd892){_0x5afe67=_0x5afe67-0x0;var _0x5728b4=_0x1623[_0x5afe67];return _0x5728b4;};'use strict';var util=require(_0x3162('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0x3162('0x1'));var cmHopperAdditionalPhone=require(_0x3162('0x2'));var cmHopperBlack=require(_0x3162('0x3'));var cmHopperHistory=require(_0x3162('0x4'));function inspectError(_0x428dd7){return util['inspect'](_0x428dd7,{'showHidden':![],'depth':null});}function getContactDialer(_0x5d49d0,_0x7a4559,_0x4b77c4){return cmHopper[_0x3162('0x5')](_0x5d49d0['id'],_0x7a4559,_0x4b77c4,_0x5d49d0[_0x3162('0x6')])['catch'](function(_0xffe9b6){_0x5d49d0[_0x3162('0x7')]=0x0;logger[_0x3162('0x8')](_0x3162('0x9'),inspectError(_0xffe9b6));});}exports[_0x3162('0x5')]=getContactDialer;function getContactDialerIvr(_0x382676,_0xe43099){return cmHopper[_0x3162('0xa')](_0x382676['id'],_0xe43099,_0x382676['dialOrderByScheduledAt'])['catch'](function(_0x270de3){_0x382676[_0x3162('0x7')]=0x0;logger[_0x3162('0x8')](_0x3162('0xb'),inspectError(_0x270de3));});}exports[_0x3162('0xa')]=getContactDialerIvr;function countReScheduled(_0x208f4e){return cmHopper[_0x3162('0xc')](_0x208f4e)[_0x3162('0xd')](function(_0x157ab8){logger['error'](_0x3162('0xe'),inspectError(_0x157ab8));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x3b9faf){return cmHopper[_0x3162('0xf')](_0x3b9faf)['catch'](function(_0x4a393a){logger[_0x3162('0x8')](_0x3162('0x10'),inspectError(_0x4a393a));});}exports[_0x3162('0xf')]=rescheduleContact;function unlockContact(_0x4b8a3b,_0x15e348,_0x3d0bea){return cmHopper[_0x3162('0x11')](_0x4b8a3b,_0x15e348,_0x3d0bea)['catch'](function(_0x78a56c){logger[_0x3162('0x8')](_0x3162('0x12'),inspectError(_0x78a56c));});}exports[_0x3162('0x11')]=unlockContact;function moveContactManagedDialer(_0x930415){return cmHopper[_0x3162('0x13')](_0x930415)[_0x3162('0xd')](function(_0x4b2bf3){logger[_0x3162('0x8')](_0x3162('0x14'),inspectError(_0x4b2bf3));});}exports[_0x3162('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x36ca97){return cmHopperBlack['checkIsBlackList'](_0x36ca97)[_0x3162('0xd')](function(_0x5a5141){logger['error'](_0x3162('0x15'),inspectError(_0x5a5141));});}exports[_0x3162('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x31946d){return cmHopperBlack['checkIsBlackListIvr'](_0x31946d)['catch'](function(_0x27133e){logger[_0x3162('0x8')](_0x3162('0x17'),inspectError(_0x27133e));});}exports[_0x3162('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x31b27b,_0x14cbba,_0x52ae25){return cmHopperAdditionalPhone[_0x3162('0x19')](_0x31b27b,_0x14cbba,_0x52ae25)['catch'](function(_0xd283d6){logger[_0x3162('0x8')](_0x3162('0x1a'),inspectError(_0xd283d6));});}exports[_0x3162('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c9992,_0x3c543e,_0x30552f){return cmHopperAdditionalPhone[_0x3162('0x1b')](_0x1c9992,_0x3c543e,_0x30552f)[_0x3162('0xd')](function(_0x356c5d){logger[_0x3162('0x8')](_0x3162('0x1c'),inspectError(_0x356c5d));});}exports[_0x3162('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x48de45){return cmHopperHistory[_0x3162('0x1d')](_0x48de45)['catch'](function(_0x37acdd){logger[_0x3162('0x8')](_0x3162('0x1e'),inspectError(_0x37acdd));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x4903e7){return cmHopperHistory[_0x3162('0x1f')](_0x4903e7)[_0x3162('0xd')](function(_0x14df16){logger[_0x3162('0x8')](_0x3162('0x20'),inspectError(_0x14df16));});}exports['createHistory']=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 59fb2ba..12408c4 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 _0x4913=['AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','NULL_INTERVAL','isEmpty','dialGlobalInterval','Intervals','EMPTY_INTERVAL','SIP/','reachable','includes','TrunkBackup','status','INACTIVE','loggedIn','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','%s%s','toUpperCase','setXMDContactVariables','moment','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x194a8c,_0x25aeb1){var _0x33da37=function(_0x22d879){while(--_0x22d879){_0x194a8c['push'](_0x194a8c['shift']());}};_0x33da37(++_0x25aeb1);}(_0x4913,0x149));var _0x3491=function(_0x583f6d,_0x5d5eee){_0x583f6d=_0x583f6d-0x0;var _0x3ecc90=_0x4913[_0x583f6d];return _0x3ecc90;};'use strict';var _=require('lodash');var moment=require(_0x3491('0x0'));var util=require(_0x3491('0x1'));var logger=require(_0x3491('0x2'))('dialer');var timezones=require(_0x3491('0x3'))[_0x3491('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x3491('0x5'),'BLACKLIST':_0x3491('0x6'),'CONTACTS_RESCHEDULED':_0x3491('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x3491('0x8'),'EMPTY_INTERVAL':_0x3491('0x9'),'INACTIVE':_0x3491('0xa'),'NO_AGENTS_LOGGED':_0x3491('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x3491('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x3491('0xd'),'QUEUE_RECALL':_0x3491('0xe'),'RECALL_TIMEOUT':_0x3491('0xf'),'RUNNING':_0x3491('0x10'),'UNKNOWN_TIMEZONE':_0x3491('0x11'),'UNREACHABLE_TRUNK':_0x3491('0x12')};exports[_0x3491('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x145171){return _0x145171[_0x3491('0x14')]===_0x3491('0x15');}exports[_0x3491('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x5d8b3b){return _0x5d8b3b['type']===_0x3491('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x15fc27){return _0x15fc27['type']===_0x3491('0x18');}exports[_0x3491('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x589904){return _0x589904[_0x3491('0x1a')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x416f69){return _0x416f69[_0x3491('0x1b')];}exports[_0x3491('0x1c')]=isIVRCampaignActive;function getSeconds(_0x28bdc3,_0x14bbb1){var _0x3d516c=moment(_0x28bdc3)[_0x3491('0x1d')](0x0);var _0x15048e=moment(_0x14bbb1)['milliseconds'](0x0);return _0x3d516c['diff'](_0x15048e,_0x3491('0x1e'));}exports[_0x3491('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0xa1a3ff,_0x3cd1b8){var _0x29b24b=![];var _0x38aa30=_0xa1a3ff['dialMethod']!==_0x3cd1b8[_0x3491('0x14')]||_0xa1a3ff[_0x3491('0x1a')]!==_0x3cd1b8[_0x3491('0x1a')]||_0xa1a3ff[_0x3491('0x20')]!==_0x3cd1b8[_0x3491('0x20')];var _0x2b4a8c=_0xa1a3ff['available']!==_0x3cd1b8[_0x3491('0x21')]||_0xa1a3ff['loggedIn']!==_0x3cd1b8['loggedIn']||_0xa1a3ff[_0x3491('0x22')]!==_0x3cd1b8[_0x3491('0x22')]||_0xa1a3ff[_0x3491('0x23')]!==_0x3cd1b8[_0x3491('0x23')]||_0xa1a3ff['talking']!==_0x3cd1b8[_0x3491('0x24')]||_0xa1a3ff[_0x3491('0x25')]!==_0x3cd1b8[_0x3491('0x25')]||_0xa1a3ff[_0x3491('0x26')]!==_0x3cd1b8['waiting']||_0xa1a3ff['inUse']!==_0x3cd1b8['inUse']||_0xa1a3ff[_0x3491('0x27')]!==_0x3cd1b8[_0x3491('0x27')];if(_0xa1a3ff['Trunk']&&_0x3cd1b8[_0x3491('0x28')]){_0x29b24b=_0xa1a3ff['Trunk'][_0x3491('0x29')]!==_0x3cd1b8['Trunk'][_0x3491('0x29')]||_0xa1a3ff[_0x3491('0x28')][_0x3491('0x1b')]!==_0x3cd1b8[_0x3491('0x28')][_0x3491('0x1b')];}return _0x38aa30||_0x2b4a8c||_0x29b24b;}exports[_0x3491('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3b1d26){var _0x95bd40=null;var _0x4cc8b9=_0x3b1d26[_0x3491('0x2b')];if(_[_0x3491('0x2c')](_0x3b1d26['dialGlobalInterval'])||_[_0x3491('0x2c')](_0x3b1d26[_0x3491('0x2d')])||_['isNil'](_0x3b1d26[_0x3491('0x2d')]['Intervals'])){_0x95bd40=CAMPAIGN_STATUS[_0x3491('0x2e')];}else if(_[_0x3491('0x2f')](_0x3b1d26[_0x3491('0x30')])||_[_0x3491('0x2f')](_0x3b1d26['Interval'][_0x3491('0x31')])){_0x95bd40=CAMPAIGN_STATUS[_0x3491('0x32')];}else if(_0x4cc8b9&&!timezones[_0x4cc8b9]){_0x95bd40=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x95bd40;}function checkAnyValidTrunk(_0x61059c,_0x441dc1){var _0xb93902=null;var _0x3f1f5b=_0x3491('0x33');var _0x30e8d3=[_0x3491('0x34'),'unmonitored'];var _0x5d5d0d=!![];if(_0x61059c[_0x3491('0x28')]&&_0x61059c[_0x3491('0x28')]['active']){_0x3f1f5b+=_0x61059c[_0x3491('0x28')]['name'];_0xb93902=_0x441dc1[_0x3f1f5b];_0x5d5d0d=_0x30e8d3[_0x3491('0x35')](_0xb93902['status']);}else if(_0x61059c[_0x3491('0x36')]&&_0x61059c[_0x3491('0x36')][_0x3491('0x1b')]){_0x3f1f5b+=_0x61059c[_0x3491('0x36')][_0x3491('0x29')];_0xb93902=_0x441dc1[_0x3f1f5b];_0x5d5d0d=_0x30e8d3[_0x3491('0x35')](_0xb93902[_0x3491('0x37')]);}return _0x5d5d0d;}function getQueueCampaignStatusMessage(_0x493374,_0x3153ab){var _0x20dc95=CAMPAIGN_STATUS[_0x3491('0x5')];var _0x4e4359=isPreviewCampaign(_0x493374);if(!isQueueCampaignActive(_0x493374)){if(_0x4e4359){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x38')];}else{if(_0x493374['originated']===0x0&&_0x493374[_0x3491('0x24')]===0x0&&_0x493374['waiting']===0x0&&(_0x493374[_0x3491('0x25')]||0x0)===0x0){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x38')];}else{_0x20dc95=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x493374[_0x3491('0x39')]===0x0){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x3a')];}else if(!checkAnyValidTrunk(_0x493374,_0x3153ab)){_0x20dc95=CAMPAIGN_STATUS[_0x3491('0x3b')];}else if(!isPreviewCampaign(_0x493374)){var _0x537254=checkAnyValidQueueCampaignInterval(_0x493374);if(_0x537254){_0x20dc95=_0x537254;}}return _0x20dc95;}exports[_0x3491('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1e39ed){var _0x5aa839=CAMPAIGN_STATUS[_0x3491('0x3d')];if(_0x1e39ed[_0x3491('0x27')]===0x0&&_0x1e39ed['talking']===0x0&&_0x1e39ed['waiting']===0x0&&(_0x1e39ed[_0x3491('0x25')]||0x0)===0x0){_0x5aa839=CAMPAIGN_STATUS[_0x3491('0x38')];}return _0x5aa839;}exports[_0x3491('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1b9bd9){var _0x31c025=_0x1b9bd9[_0x3491('0x3f')](/"(.*?)"/);return _0x31c025?_0x31c025[0x1]:_0x1b9bd9;}exports[_0x3491('0x40')]=extractCalleridName;function getCallerId(_0x52226e,_0x1cd4a3,_0x1e4776){if(!_[_0x3491('0x41')](_0x1e4776)&&typeof _0x1e4776==='string'&&!_[_0x3491('0x2f')](_0x1e4776)){if(!_[_0x3491('0x41')](_0x1cd4a3)&&typeof _0x1cd4a3===_0x3491('0x42')&&!_[_0x3491('0x2f')](_0x1cd4a3)){return util[_0x3491('0x43')]('\x22%s\x22\x20<%s>',_0x1cd4a3,_0x1e4776);}return util[_0x3491('0x43')]('\x22%s\x22\x20<%s>',_0x1e4776,_0x1e4776);}if(!_[_0x3491('0x41')](_0x52226e)&&typeof _0x52226e===_0x3491('0x42')&&!_[_0x3491('0x2f')](_0x52226e)){return _0x52226e;}return _0x3491('0x44');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x370141,_0x4db08f){var _0x16070a;var _0x427627;var _0x579cf2;if(_0x4db08f<=0x0){_0x4db08f=0x1;}_0x16070a=new RegExp(_0x3491('0x45')+_0x4db08f+'}$');_0x427627=Math[_0x3491('0x46')](0xa,_0x4db08f-0x1);_0x579cf2=Math[_0x3491('0x46')](0xa,_0x4db08f)-0x1;return util[_0x3491('0x43')]('%s',_[_0x3491('0x47')](_0x370141,_0x16070a,_[_0x3491('0x48')](_0x427627,_0x579cf2)['toString']()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x56399e){if(_0x56399e['originated']&&_0x56399e['originated']>0x0){_0x56399e[_0x3491('0x27')]-=0x1;}else{logger[_0x3491('0x49')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x3491('0x4a')]=decrementOriginate;function checkContactEmpty(_0x2a7500){return _0x2a7500&&_0x2a7500['length']>0x0;}exports[_0x3491('0x4b')]=checkContactEmpty;function erlangb(_0x476947,_0x5a5d3d){if(_0x5a5d3d===0x0){return 0x0;}var _0x3417ab=0x1;for(var _0x1e7067=0x1;_0x1e7067<=_0x5a5d3d;_0x1e7067+=0x1){_0x3417ab=0x1+_0x3417ab*_0x1e7067/_0x476947;}return 0x1/_0x3417ab;}exports[_0x3491('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0xbaf0a8,_0x1c252e,_0x2dc173){if(_0x1c252e>_0x2dc173){for(var _0x5b1585=0x0;_0x5b1585<_0x1c252e-_0x2dc173;_0x5b1585+=0x1){decrementOriginate(_0xbaf0a8);}}}exports[_0x3491('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x286521){var _0x2801cb={};var _0x9058b2=['id',_0x3491('0x4e'),'description',_0x3491('0x4f'),_0x3491('0x50')];if(_0x286521){for(var _0x27bcb0 in _0x286521){if(typeof _0x286521[_0x27bcb0]!==_0x3491('0x51')){if(!_[_0x3491('0x2c')](_0x286521[_0x27bcb0])&&!_0x9058b2[_0x3491('0x35')](_0x27bcb0)){_0x2801cb[util[_0x3491('0x43')](_0x3491('0x52'),'XMD-',_0x27bcb0[_0x3491('0x53')]())]=_0x286521[_0x27bcb0];}}}}return _0x2801cb;}exports[_0x3491('0x54')]=setXMDContactVariables; \ No newline at end of file +var _0xe523=['EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','DISACTIVED','loggedIn','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','format','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','description','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','ivr','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xe523,0xe1));var _0x3e52=function(_0xccde23,_0x424198){_0xccde23=_0xccde23-0x0;var _0x353848=_0xe523[_0xccde23];return _0x353848;};'use strict';var _=require(_0x3e52('0x0'));var moment=require(_0x3e52('0x1'));var util=require(_0x3e52('0x2'));var logger=require(_0x3e52('0x3'))(_0x3e52('0x4'));var timezones=require(_0x3e52('0x5'))[_0x3e52('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x3e52('0x7'),'BLACKLIST':_0x3e52('0x8'),'CONTACTS_RESCHEDULED':_0x3e52('0x9'),'DEACTIVATED':_0x3e52('0xa'),'DISACTIVED':_0x3e52('0xb'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x3e52('0xc'),'NO_AGENTS_LOGGED':_0x3e52('0xd'),'NO_AVAILABLE_CONTACTS':_0x3e52('0xe'),'NULL_INTERVAL':_0x3e52('0xf'),'OVERTIME_INTERVAL':_0x3e52('0x10'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x3e52('0x11'),'RECALL_TIMEOUT':_0x3e52('0x12'),'RUNNING':_0x3e52('0x13'),'UNKNOWN_TIMEZONE':_0x3e52('0x14'),'UNREACHABLE_TRUNK':_0x3e52('0x15')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x473b5e){return _0x473b5e[_0x3e52('0x16')]===_0x3e52('0x17');}exports[_0x3e52('0x18')]=isPreviewCampaign;function isIVRCampaign(_0x3dd683){return _0x3dd683['type']===_0x3e52('0x19');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x573331){return _0x573331[_0x3e52('0x1a')]===_0x3e52('0x1b');}exports[_0x3e52('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x504903){return _0x504903[_0x3e52('0x1d')];}exports[_0x3e52('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5823db){return _0x5823db[_0x3e52('0x1f')];}exports[_0x3e52('0x20')]=isIVRCampaignActive;function getSeconds(_0x812b2d,_0x3c157a){var _0x2bb21d=moment(_0x812b2d)[_0x3e52('0x21')](0x0);var _0x1160c3=moment(_0x3c157a)['milliseconds'](0x0);return _0x2bb21d['diff'](_0x1160c3,_0x3e52('0x22'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x10cb03,_0x5d8219){var _0x133536=![];var _0x4780cb=_0x10cb03[_0x3e52('0x16')]!==_0x5d8219['dialMethod']||_0x10cb03['dialActive']!==_0x5d8219[_0x3e52('0x1d')]||_0x10cb03['message']!==_0x5d8219[_0x3e52('0x23')];var _0xeca371=_0x10cb03[_0x3e52('0x24')]!==_0x5d8219[_0x3e52('0x24')]||_0x10cb03['loggedIn']!==_0x5d8219['loggedIn']||_0x10cb03[_0x3e52('0x25')]!==_0x5d8219['loggedInDb']||_0x10cb03['paused']!==_0x5d8219[_0x3e52('0x26')]||_0x10cb03['talking']!==_0x5d8219[_0x3e52('0x27')]||_0x10cb03[_0x3e52('0x28')]!==_0x5d8219[_0x3e52('0x28')]||_0x10cb03[_0x3e52('0x29')]!==_0x5d8219[_0x3e52('0x29')]||_0x10cb03[_0x3e52('0x2a')]!==_0x5d8219[_0x3e52('0x2a')]||_0x10cb03['originated']!==_0x5d8219[_0x3e52('0x2b')];if(_0x10cb03[_0x3e52('0x2c')]&&_0x5d8219['Trunk']){_0x133536=_0x10cb03[_0x3e52('0x2c')][_0x3e52('0x2d')]!==_0x5d8219[_0x3e52('0x2c')][_0x3e52('0x2d')]||_0x10cb03['Trunk'][_0x3e52('0x1f')]!==_0x5d8219['Trunk']['active'];}return _0x4780cb||_0xeca371||_0x133536;}exports[_0x3e52('0x2e')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x19f964){var _0x1d4940=null;var _0x2ac4dc=_0x19f964[_0x3e52('0x2f')];if(_[_0x3e52('0x30')](_0x19f964['dialGlobalInterval'])||_[_0x3e52('0x30')](_0x19f964[_0x3e52('0x31')])||_[_0x3e52('0x30')](_0x19f964[_0x3e52('0x31')][_0x3e52('0x32')])){_0x1d4940=CAMPAIGN_STATUS[_0x3e52('0x33')];}else if(_[_0x3e52('0x34')](_0x19f964[_0x3e52('0x35')])||_[_0x3e52('0x34')](_0x19f964[_0x3e52('0x31')][_0x3e52('0x32')])){_0x1d4940=CAMPAIGN_STATUS[_0x3e52('0x36')];}else if(_0x2ac4dc&&!timezones[_0x2ac4dc]){_0x1d4940=CAMPAIGN_STATUS[_0x3e52('0x37')];}return _0x1d4940;}function checkAnyValidTrunk(_0x5ca35b,_0x40682e){var _0x125cef=null;var _0x3024a7=_0x3e52('0x38');var _0x147253=[_0x3e52('0x39'),_0x3e52('0x3a')];var _0x30c82e=!![];if(_0x5ca35b[_0x3e52('0x2c')]&&_0x5ca35b[_0x3e52('0x2c')][_0x3e52('0x1f')]){_0x3024a7+=_0x5ca35b[_0x3e52('0x2c')]['name'];_0x125cef=_0x40682e[_0x3024a7];_0x30c82e=_0x147253['includes'](_0x125cef[_0x3e52('0x3b')]);}else if(_0x5ca35b[_0x3e52('0x3c')]&&_0x5ca35b[_0x3e52('0x3c')][_0x3e52('0x1f')]){_0x3024a7+=_0x5ca35b[_0x3e52('0x3c')][_0x3e52('0x2d')];_0x125cef=_0x40682e[_0x3024a7];_0x30c82e=_0x147253[_0x3e52('0x3d')](_0x125cef[_0x3e52('0x3b')]);}return _0x30c82e;}function getQueueCampaignStatusMessage(_0x4342c2,_0x2e5a5a){var _0x333b6a=CAMPAIGN_STATUS[_0x3e52('0x7')];var _0x4afc58=isPreviewCampaign(_0x4342c2);if(!isQueueCampaignActive(_0x4342c2)){if(_0x4afc58){_0x333b6a=CAMPAIGN_STATUS[_0x3e52('0x3e')];}else{if(_0x4342c2[_0x3e52('0x2b')]===0x0&&_0x4342c2[_0x3e52('0x27')]===0x0&&_0x4342c2[_0x3e52('0x29')]===0x0&&(_0x4342c2[_0x3e52('0x28')]||0x0)===0x0){_0x333b6a=CAMPAIGN_STATUS['INACTIVE'];}else{_0x333b6a=CAMPAIGN_STATUS[_0x3e52('0x3f')];}}}else if(_0x4342c2[_0x3e52('0x40')]===0x0){_0x333b6a=CAMPAIGN_STATUS[_0x3e52('0x41')];}else if(!checkAnyValidTrunk(_0x4342c2,_0x2e5a5a)){_0x333b6a=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x4342c2)){var _0x489492=checkAnyValidQueueCampaignInterval(_0x4342c2);if(_0x489492){_0x333b6a=_0x489492;}}return _0x333b6a;}exports[_0x3e52('0x42')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x376342){var _0x5f4daa=CAMPAIGN_STATUS[_0x3e52('0x3f')];if(_0x376342[_0x3e52('0x2b')]===0x0&&_0x376342[_0x3e52('0x27')]===0x0&&_0x376342[_0x3e52('0x29')]===0x0&&(_0x376342[_0x3e52('0x28')]||0x0)===0x0){_0x5f4daa=CAMPAIGN_STATUS[_0x3e52('0x3e')];}return _0x5f4daa;}exports[_0x3e52('0x43')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x16b36e){var _0x52e657=_0x16b36e[_0x3e52('0x44')](/"(.*?)"/);return _0x52e657?_0x52e657[0x1]:_0x16b36e;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x32bf2e,_0x22cd48,_0x3a13e6){if(!_['isUndefined'](_0x3a13e6)&&typeof _0x3a13e6==='string'&&!_[_0x3e52('0x34')](_0x3a13e6)){if(!_[_0x3e52('0x45')](_0x22cd48)&&typeof _0x22cd48===_0x3e52('0x46')&&!_[_0x3e52('0x34')](_0x22cd48)){return util['format'](_0x3e52('0x47'),_0x22cd48,_0x3a13e6);}return util['format'](_0x3e52('0x47'),_0x3a13e6,_0x3a13e6);}if(!_[_0x3e52('0x45')](_0x32bf2e)&&typeof _0x32bf2e===_0x3e52('0x46')&&!_[_0x3e52('0x34')](_0x32bf2e)){return _0x32bf2e;}return _0x3e52('0x48');}exports[_0x3e52('0x49')]=getCallerId;function getCallerIdRandom(_0xe98d4a,_0x1cbd0b){var _0x22df65;var _0x2748ed;var _0x5cbe97;if(_0x1cbd0b<=0x0){_0x1cbd0b=0x1;}_0x22df65=new RegExp(_0x3e52('0x4a')+_0x1cbd0b+'}$');_0x2748ed=Math[_0x3e52('0x4b')](0xa,_0x1cbd0b-0x1);_0x5cbe97=Math[_0x3e52('0x4b')](0xa,_0x1cbd0b)-0x1;return util[_0x3e52('0x4c')]('%s',_[_0x3e52('0x4d')](_0xe98d4a,_0x22df65,_[_0x3e52('0x4e')](_0x2748ed,_0x5cbe97)[_0x3e52('0x4f')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x179476){if(_0x179476['originated']&&_0x179476[_0x3e52('0x2b')]>0x0){_0x179476[_0x3e52('0x2b')]-=0x1;}else{logger[_0x3e52('0x50')](_0x3e52('0x51'));}}exports[_0x3e52('0x52')]=decrementOriginate;function checkContactEmpty(_0x1b2d12){return _0x1b2d12&&_0x1b2d12[_0x3e52('0x53')]>0x0;}exports[_0x3e52('0x54')]=checkContactEmpty;function erlangb(_0x500c8c,_0xb7c988){if(_0xb7c988===0x0){return 0x0;}var _0x3e1d0d=0x1;for(var _0x34f492=0x1;_0x34f492<=_0xb7c988;_0x34f492+=0x1){_0x3e1d0d=0x1+_0x3e1d0d*_0x34f492/_0x500c8c;}return 0x1/_0x3e1d0d;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0xdc19cc,_0x50e774,_0x5a7fef){if(_0x50e774>_0x5a7fef){for(var _0x5cd352=0x0;_0x5cd352<_0x50e774-_0x5a7fef;_0x5cd352+=0x1){decrementOriginate(_0xdc19cc);}}}exports[_0x3e52('0x55')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0xcd9209){var _0x17bfa4={};var _0x36245e=['id','createdAt',_0x3e52('0x56'),'tags',_0x3e52('0x57')];if(_0xcd9209){for(var _0x2618ec in _0xcd9209){if(typeof _0xcd9209[_0x2618ec]!==_0x3e52('0x58')){if(!_['isNil'](_0xcd9209[_0x2618ec])&&!_0x36245e[_0x3e52('0x3d')](_0x2618ec)){_0x17bfa4[util['format'](_0x3e52('0x59'),_0x3e52('0x5a'),_0x2618ec[_0x3e52('0x5b')]())]=_0xcd9209[_0x2618ec];}}}}return _0x17bfa4;}exports[_0x3e52('0x5c')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9336ff7..9e6fba4 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(_0x347d79,_0x2f36c0){var _0x1028d9=function(_0xf4eddd){while(--_0xf4eddd){_0x347d79['push'](_0x347d79['shift']());}};_0x1028d9(++_0x2f36c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x280a60,_0xc658b6){var _0x81d7c4=function(_0x4f297e){while(--_0x4f297e){_0x280a60['push'](_0x280a60['shift']());}};_0x81d7c4(++_0xc658b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 ce9a60d..d9c3de2 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 _0x8529=['[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','bluebird','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][Updated]','updateStatus','update','[Fax][Message][Updated]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax'];(function(_0x53c681,_0x1ebf78){var _0x462181=function(_0x4e9a9a){while(--_0x4e9a9a){_0x53c681['push'](_0x53c681['shift']());}};_0x462181(++_0x1ebf78);}(_0x8529,0x73));var _0x9852=function(_0x198390,_0x407c9c){_0x198390=_0x198390-0x0;var _0x8079a9=_0x8529[_0x198390];return _0x8079a9;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x9852('0x0'));var uuid=require(_0x9852('0x1'));var moment=require(_0x9852('0x2'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0x9852('0x3'));var logger=require(_0x9852('0x4'))(_0x9852('0x5'));var ami=require(_0x9852('0x6'));var rpcDb=require(_0x9852('0x7'));var Channel=require(_0x9852('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x9852('0x9'));var attachment=require(_0x9852('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5d0fce){this[_0x9852('0xb')]={};this[_0x9852('0xc')]=_0x5d0fce['faxAccounts'];this[_0x9852('0xd')]=_0x5d0fce[_0x9852('0xd')];this['actions']={};ami['on'](_0x9852('0xe'),this['syncNewchannel'][_0x9852('0xf')](this));ami['on'](_0x9852('0x10'),this[_0x9852('0x11')][_0x9852('0xf')](this));ami['on']('newstate',this[_0x9852('0x12')][_0x9852('0xf')](this));ami['on']('newexten',this[_0x9852('0x13')][_0x9852('0xf')](this));ami['on'](_0x9852('0x14'),this[_0x9852('0x15')][_0x9852('0xf')](this));ami['on'](_0x9852('0x16'),this['syncReceiveFax'][_0x9852('0xf')](this));ami['on'](_0x9852('0x17'),this[_0x9852('0x18')]['bind'](this));ami['on'](_0x9852('0x19'),this[_0x9852('0x1a')][_0x9852('0xf')](this));}Fax[_0x9852('0x1b')][_0x9852('0x1c')]=function(_0x1ab705){if(_0x1ab705[_0x9852('0x1d')]==='from-voip-provider'){for(var _0x31d989 in this['faxAccounts']){if(this[_0x9852('0xc')][_0x9852('0x1e')](_0x31d989)){if(_0x1ab705[_0x9852('0x1f')]===this[_0x9852('0xc')][_0x31d989]['localstationid']){this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]]={};this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]][_0x9852('0x21')]=_0x1ab705[_0x9852('0x21')];this['channels'][_0x1ab705[_0x9852('0x20')]]['id']=this[_0x9852('0xc')][_0x31d989]['id'];this['channels'][_0x1ab705[_0x9852('0x20')]]['name']=this['faxAccounts'][_0x31d989][_0x9852('0x22')];logger[_0x9852('0x23')](_0x1ab705[_0x9852('0x20')],_0x9852('0x24'));}}}}if(this[_0x9852('0x25')][_0x1ab705[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]]={};this[_0x9852('0xb')][_0x1ab705[_0x9852('0x20')]][_0x9852('0x21')]=_0x1ab705['channel'];logger['info'](_0x1ab705[_0x9852('0x20')],_0x9852('0x24'));}};Fax['prototype'][_0x9852('0x11')]=function(_0x59f2d3){if(this[_0x9852('0xb')][_0x59f2d3[_0x9852('0x20')]]){for(var _0x33775e in _0x59f2d3[_0x9852('0x26')]){if(_0x59f2d3[_0x9852('0x26')][_0x9852('0x1e')](_0x33775e)){this[_0x9852('0xb')][_0x59f2d3[_0x9852('0x20')]][_0x33775e]=_0x59f2d3['value'];}}}};Fax[_0x9852('0x1b')]['syncNewState']=function(_0x460205){if(this[_0x9852('0xb')][_0x460205[_0x9852('0x20')]]){this['channels'][_0x460205[_0x9852('0x20')]][_0x9852('0x27')]=_0x460205['channelstate'];this[_0x9852('0xb')][_0x460205[_0x9852('0x20')]][_0x9852('0x28')]=_0x460205['channelstatedesc'];}};Fax[_0x9852('0x1b')][_0x9852('0x13')]=function(_0x12b72d){if(this['channels'][_0x12b72d[_0x9852('0x20')]]){for(var _0x4edbd0 in _0x12b72d['variable']){if(_0x12b72d[_0x9852('0x26')]['hasOwnProperty'](_0x4edbd0)){this[_0x9852('0xb')][_0x12b72d[_0x9852('0x20')]][_0x4edbd0]=_0x12b72d[_0x9852('0x29')];}}}};Fax[_0x9852('0x1b')][_0x9852('0x15')]=function(_0x17c413){if(this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]][_0x9852('0x2a')]=_0x17c413[_0x9852('0x2a')];this[_0x9852('0xb')][_0x17c413['uniqueid']][_0x9852('0x2b')]=_0x17c413[_0x9852('0x2b')];this[_0x9852('0xb')][_0x17c413[_0x9852('0x20')]][_0x9852('0x2c')]=_0x17c413['localstationid'];this[_0x9852('0xb')][_0x17c413['uniqueid']][_0x9852('0x2d')]=_0x17c413[_0x9852('0x2d')];logger[_0x9852('0x23')](_0x17c413['uniqueid'],_0x9852('0x2e'));}};Fax['prototype'][_0x9852('0x2f')]=function(_0x1218d1){var _0x267a10=this;if(this['channels'][_0x1218d1[_0x9852('0x20')]]){var _0x8c0516=this[_0x9852('0xb')][_0x1218d1['uniqueid']]['id'];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x30')]=_0x1218d1[_0x9852('0x30')];this['channels'][_0x1218d1[_0x9852('0x20')]]['pagestransferred']=_0x1218d1[_0x9852('0x31')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x2c')]=_0x1218d1[_0x9852('0x2c')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x32')]=_0x1218d1[_0x9852('0x32')];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x33')]=_0x1218d1[_0x9852('0x33')];this['channels'][_0x1218d1[_0x9852('0x20')]][_0x9852('0x2d')]=_0x1218d1['filename'];this[_0x9852('0xb')][_0x1218d1[_0x9852('0x20')]][_0x9852('0x34')]=_0x1218d1['calleridnum'];if(this[_0x9852('0xb')][_0x1218d1['uniqueid']][_0x9852('0x31')]>0x0){tiff2pdf(_0x1218d1[_0x9852('0x2d')],_0x9852('0x35'),function(_0x51b019){logger[_0x9852('0x23')](_0x1218d1['uniqueid'],_0x9852('0x36'),_0x51b019[_0x9852('0x37')]);attachment['create']({'name':path[_0x9852('0x38')](_0x1218d1[_0x9852('0x2d')])[_0x9852('0x22')],'basename':path['parse'](_0x1218d1[_0x9852('0x2d')])[_0x9852('0x22')]+'.pdf','type':_0x9852('0x39')})[_0x9852('0x3a')](function(_0x1c5add){faxAccount[_0x9852('0x3b')](_0x8c0516,{'from':_0x1218d1[_0x9852('0x34')],'mapKey':_0x9852('0x5'),'body':path['parse'](_0x1218d1['filename'])[_0x9852('0x22')]+'.pdf','AttachmentId':_0x1c5add['id']})['catch'](function(_0x2d9df5){logger[_0x9852('0x3c')](_0x1218d1[_0x9852('0x20')],_0x9852('0x3d'),JSON[_0x9852('0x3e')](_0x2d9df5));});})[_0x9852('0x3f')](function(_0x57fb15){logger['error'](_0x1218d1[_0x9852('0x20')],_0x9852('0x40'),JSON[_0x9852('0x3e')](_0x57fb15));});});}logger[_0x9852('0x23')](_0x1218d1['uniqueid'],_0x9852('0x40'));}};Fax[_0x9852('0x1b')][_0x9852('0x1a')]=function(_0x599529){if(this['actions'][_0x599529['uniqueid']]){_[_0x9852('0x41')](this['channels'][_0x599529[_0x9852('0x20')]],_['pick'](_0x599529,[_0x9852('0x42'),_0x9852('0x43')]));}};function updateStatus(_0x3500c6){if(_0x3500c6[_0x9852('0x44')]){faxMessage['update'](_0x3500c6['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x9852('0x3a')](function(_0x266788){ut[_0x9852('0x45')](_0x9852('0x46'),_0x266788);})[_0x9852('0x3f')](function(_0x213885){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x213885);});}else{ut[_0x9852('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x9852('0x1b')][_0x9852('0x47')]=function(_0x155b64,_0x4706a5,_0x18f431){var _0x1a74b0=this;var _0xd150f2={};if(_0x4706a5){_0xd150f2={'read':_0x4706a5};}else{_0xd150f2={'failMessage':_0x18f431};}if(this['actions'][_0x155b64][_0x9852('0x44')]){faxMessage[_0x9852('0x48')](this[_0x9852('0x25')][_0x155b64]['AttachmentId'],_0xd150f2)[_0x9852('0x3a')](function(_0x23af25){ut[_0x9852('0x45')](_0x9852('0x49'),_0x23af25);})['catch'](function(_0x5bae8c){ut['logger']('[Fax][Message][NoUpdate1]',_0x5bae8c);})['finally'](function(){delete _0x1a74b0['channels'][_0x155b64];delete _0x1a74b0[_0x9852('0x25')][_0x155b64];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x9852('0xb')][_0x155b64];delete this[_0x9852('0x25')][_0x155b64];}};Fax[_0x9852('0x1b')]['syncHangup']=function(_0x3cab36){var _0x272d34=this;if(this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]){if(this['actions'][_0x3cab36[_0x9852('0x20')]]){this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['id']=this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]['id'];this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]][_0x9852('0x22')]=this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]['name'];}logger[_0x9852('0x23')](_0x3cab36['uniqueid'],this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]?_0x9852('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0x9852('0x3e')](this['channels'][_0x3cab36[_0x9852('0x20')]]));if(this[_0x9852('0x25')][_0x3cab36[_0x9852('0x20')]]){if(this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['faxpages']>0x0&&this['channels'][_0x3cab36[_0x9852('0x20')]][_0x9852('0x14')]===_0x9852('0x4b')){this['updateStatus'](_0x3cab36[_0x9852('0x20')],!![]);}else{this[_0x9852('0x47')](_0x3cab36[_0x9852('0x20')],![],this[_0x9852('0xb')][_0x3cab36[_0x9852('0x20')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x3cab36[_0x9852('0x20')]][_0x9852('0x4c')]:_0x9852('0x4d'));}}}};Fax[_0x9852('0x1b')][_0x9852('0x4e')]=function(_0x16e3f1){var _0x4b71a2=this;return new BPromise(function(_0x441eb6,_0x34e225){_0x4b71a2[_0x9852('0x4f')](_0x16e3f1,_0x4b71a2['faxAccounts'][_0x16e3f1[_0x9852('0x50')]])[_0x9852('0x3a')](function(_0xae3353){ut[_0x9852('0x45')](_0x9852('0x51'),_0xae3353);_0x441eb6(ut[_0x9852('0x37')](_0x9852('0x52')));})[_0x9852('0x3f')](function(_0x5c7f3d){ut[_0x9852('0x45')]('[Fax][execOriginate][failure]',_0x5c7f3d);updateStatus(_0x16e3f1);_0x34e225(ut[_0x9852('0x37')]('Fax\x20failed'));});});};Fax['prototype'][_0x9852('0x53')]=function(_0xb46d3e){var _0x205074=this;return new BPromise(function(_0x39201c,_0x47f68a){var _0x5016af=_0x205074[_0x9852('0x54')](_0x205074[_0x9852('0xc')][_0xb46d3e[_0x9852('0x50')]][_0x9852('0x55')],_0xb46d3e);if(_0x5016af[_0x9852('0x56')]){_0x39201c(ut[_0x9852('0x37')](_0x9852('0x57')));}else{_0x47f68a(ut[_0x9852('0x37')](_0x5016af['message']));}});};function originate(_0x267be5,_0x21a33b,_0x5498bf){return new BPromise(function(_0x5cfd52,_0x37292f){if(_0x5498bf){var _0x22e356=util[_0x9852('0x58')](_0x9852('0x59'),path[_0x9852('0x38')](_0x267be5[_0x9852('0x5a')])['name'],_0x267be5[_0x9852('0x5a')]);gs[_0x9852('0x5b')](_0x22e356)['then'](function(){_0x267be5[_0x9852('0x5a')]=util[_0x9852('0x58')](_0x9852('0x5c'),path[_0x9852('0x38')](_0x267be5['path'])[_0x9852('0x5d')],path['parse'](_0x267be5[_0x9852('0x5a')])[_0x9852('0x22')]);_0x21a33b[_0x9852('0x5e')]=_0x267be5[_0x9852('0x5a')];ut[_0x9852('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x9852('0x5f')](ut[_0x9852('0x60')](_0x267be5,_0x21a33b))['then'](function(_0x1066e2){_0x5cfd52(_0x1066e2);})[_0x9852('0x3f')](function(_0x3323e9){_0x37292f(_0x3323e9);});})[_0x9852('0x3f')](function(_0xea978){_0x37292f(_0xea978);});}else{ami[_0x9852('0x5f')](ut[_0x9852('0x60')](_0x267be5,_0x21a33b))[_0x9852('0x3a')](function(_0x5d862a){_0x5cfd52(_0x5d862a);})[_0x9852('0x3f')](function(_0x3d7eaf){_0x37292f(_0x3d7eaf);});}});}Fax[_0x9852('0x1b')][_0x9852('0x4f')]=function(_0x21d870,_0x5450b7){var _0x2344c2=this;return new BPromise(function(_0x458be2,_0x51bc77){var _0x13e103=uuid['v4']();var _0xd88523=ut['addVariables'](_0x21d870,_0x5450b7);_0x2344c2['actions'][_0x13e103]=new Action(_0x13e103,_0x5450b7,_0x21d870);var _0x50a4a2=_0x2344c2[_0x9852('0x25')][_0x13e103];if(path['parse'](_0x21d870['path'])[_0x9852('0x61')]===_0x9852('0x62')){originate(_0x50a4a2,_0xd88523,!![])[_0x9852('0x3a')](function(_0x2284ff){_0x458be2(_0x2284ff);})[_0x9852('0x3f')](function(_0x3e0456){_0x51bc77(_0x3e0456);});}else{originate(_0x50a4a2,_0xd88523,![])[_0x9852('0x3a')](function(_0x30283d){_0x458be2(_0x30283d);})['catch'](function(_0x56732a){_0x51bc77(_0x56732a);});}});};Fax['prototype'][_0x9852('0x63')]=function(_0x572999){return!_['isNil'](_0x572999)&&!_['isNil'](_0x572999[_0x9852('0x22')])&&!_[_0x9852('0x64')](_0x572999[_0x9852('0x65')])&&_0x572999[_0x9852('0x65')]&&!_['isNil'](this[_0x9852('0xd')][util[_0x9852('0x58')](_0x9852('0x66'),_0x572999[_0x9852('0x22')])])&&!_[_0x9852('0x64')](this[_0x9852('0xd')][util['format'](_0x9852('0x66'),_0x572999['name'])][_0x9852('0x2b')])&&(this['trunks'][util[_0x9852('0x58')]('SIP/%s',_0x572999[_0x9852('0x22')])][_0x9852('0x2b')]===_0x9852('0x67')||this[_0x9852('0xd')][util[_0x9852('0x58')](_0x9852('0x66'),_0x572999[_0x9852('0x22')])][_0x9852('0x2b')]===_0x9852('0x68'));};Fax[_0x9852('0x1b')][_0x9852('0x54')]=function(_0x49068c,_0x95f763){if(!this[_0x9852('0x63')](_0x49068c)){ut[_0x9852('0x45')](_0x9852('0x69'),_[_0x9852('0x64')](_0x49068c)?'':_0x49068c[_0x9852('0x22')]+_0x9852('0x6a'));return{'isValid':![],'message':_0x9852('0x6b')};}if(_[_0x9852('0x64')](_0x95f763[_0x9852('0x5')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x9852('0x3e')](_0x95f763));return{'isValid':![],'message':_0x9852('0x6c')};}if(_[_0x9852('0x64')](_0x95f763[_0x9852('0x5a')])){ut[_0x9852('0x45')](_0x9852('0x6d'),JSON[_0x9852('0x3e')](_0x95f763));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x9852('0x6e')};};module[_0x9852('0x6f')]=Fax; \ No newline at end of file +var _0x3ca3=['exten','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','info','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','\x20notify\x20','stringify','catch','error','\x20receiveFax\x20','merge','pick','response','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','AttachmentId','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxstatus','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','ext','isNil','active','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','hangup','syncHangup','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty'];(function(_0x14cd9b,_0x4650fc){var _0x593a6e=function(_0x3fae26){while(--_0x3fae26){_0x14cd9b['push'](_0x14cd9b['shift']());}};_0x593a6e(++_0x4650fc);}(_0x3ca3,0x1a2));var _0x33ca=function(_0xefc2a5,_0x2c0ba5){_0xefc2a5=_0xefc2a5-0x0;var _0x56562f=_0x3ca3[_0xefc2a5];return _0x56562f;};'use strict';var util=require(_0x33ca('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x33ca('0x1'));var path=require(_0x33ca('0x2'));var tiff2pdf=require(_0x33ca('0x3'));var gs=require('./util/gs');var logger=require(_0x33ca('0x4'))(_0x33ca('0x5'));var ami=require(_0x33ca('0x6'));var rpcDb=require(_0x33ca('0x7'));var Channel=require('./channel');var ut=require(_0x33ca('0x8'));var Action=require(_0x33ca('0x9'));var faxAccount=require(_0x33ca('0xa'));var attachment=require(_0x33ca('0xb'));var faxMessage=require(_0x33ca('0xc'));function Fax(_0x1a8fc8){this[_0x33ca('0xd')]={};this[_0x33ca('0xe')]=_0x1a8fc8['faxAccounts'];this[_0x33ca('0xf')]=_0x1a8fc8['trunks'];this[_0x33ca('0x10')]={};ami['on'](_0x33ca('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0x33ca('0x12'),this[_0x33ca('0x13')][_0x33ca('0x14')](this));ami['on'](_0x33ca('0x15'),this[_0x33ca('0x16')][_0x33ca('0x14')](this));ami['on'](_0x33ca('0x17'),this[_0x33ca('0x18')][_0x33ca('0x14')](this));ami['on']('faxstatus',this[_0x33ca('0x19')]['bind'](this));ami['on']('receivefax',this['syncReceiveFax'][_0x33ca('0x14')](this));ami['on'](_0x33ca('0x1a'),this[_0x33ca('0x1b')]['bind'](this));ami['on']('originateresponse',this[_0x33ca('0x1c')][_0x33ca('0x14')](this));}Fax[_0x33ca('0x1d')][_0x33ca('0x1e')]=function(_0x38d82d){if(_0x38d82d[_0x33ca('0x1f')]===_0x33ca('0x20')){for(var _0x54826b in this[_0x33ca('0xe')]){if(this[_0x33ca('0xe')][_0x33ca('0x21')](_0x54826b)){if(_0x38d82d[_0x33ca('0x22')]===this['faxAccounts'][_0x54826b]['localstationid']){this['channels'][_0x38d82d[_0x33ca('0x23')]]={};this[_0x33ca('0xd')][_0x38d82d[_0x33ca('0x23')]][_0x33ca('0x24')]=_0x38d82d[_0x33ca('0x24')];this[_0x33ca('0xd')][_0x38d82d[_0x33ca('0x23')]]['id']=this['faxAccounts'][_0x54826b]['id'];this[_0x33ca('0xd')][_0x38d82d[_0x33ca('0x23')]]['name']=this[_0x33ca('0xe')][_0x54826b][_0x33ca('0x25')];logger['info'](_0x38d82d[_0x33ca('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0x33ca('0x10')][_0x38d82d[_0x33ca('0x23')]]){this[_0x33ca('0xd')][_0x38d82d[_0x33ca('0x23')]]={};this[_0x33ca('0xd')][_0x38d82d[_0x33ca('0x23')]]['channel']=_0x38d82d[_0x33ca('0x24')];logger['info'](_0x38d82d[_0x33ca('0x23')],_0x33ca('0x26'));}};Fax['prototype'][_0x33ca('0x13')]=function(_0x3bda68){if(this[_0x33ca('0xd')][_0x3bda68[_0x33ca('0x23')]]){for(var _0x42c8a4 in _0x3bda68[_0x33ca('0x27')]){if(_0x3bda68[_0x33ca('0x27')]['hasOwnProperty'](_0x42c8a4)){this['channels'][_0x3bda68[_0x33ca('0x23')]][_0x42c8a4]=_0x3bda68[_0x33ca('0x28')];}}}};Fax[_0x33ca('0x1d')]['syncNewState']=function(_0x33ba55){if(this[_0x33ca('0xd')][_0x33ba55[_0x33ca('0x23')]]){this[_0x33ca('0xd')][_0x33ba55[_0x33ca('0x23')]]['channelstate']=_0x33ba55[_0x33ca('0x29')];this[_0x33ca('0xd')][_0x33ba55[_0x33ca('0x23')]][_0x33ca('0x2a')]=_0x33ba55[_0x33ca('0x2a')];}};Fax[_0x33ca('0x1d')][_0x33ca('0x18')]=function(_0x72f552){if(this[_0x33ca('0xd')][_0x72f552[_0x33ca('0x23')]]){for(var _0x5cae6d in _0x72f552[_0x33ca('0x27')]){if(_0x72f552[_0x33ca('0x27')]['hasOwnProperty'](_0x5cae6d)){this[_0x33ca('0xd')][_0x72f552[_0x33ca('0x23')]][_0x5cae6d]=_0x72f552['value'];}}}};Fax['prototype'][_0x33ca('0x19')]=function(_0x9a41ca){if(this[_0x33ca('0xd')][_0x9a41ca[_0x33ca('0x23')]]){this[_0x33ca('0xd')][_0x9a41ca[_0x33ca('0x23')]]['operation']=_0x9a41ca[_0x33ca('0x2b')];this[_0x33ca('0xd')][_0x9a41ca['uniqueid']][_0x33ca('0x2c')]=_0x9a41ca[_0x33ca('0x2c')];this['channels'][_0x9a41ca['uniqueid']][_0x33ca('0x2d')]=_0x9a41ca[_0x33ca('0x2d')];this[_0x33ca('0xd')][_0x9a41ca[_0x33ca('0x23')]][_0x33ca('0x2e')]=_0x9a41ca[_0x33ca('0x2e')];logger[_0x33ca('0x2f')](_0x9a41ca[_0x33ca('0x23')],_0x33ca('0x30'));}};Fax['prototype']['syncReceiveFax']=function(_0x1d899b){var _0x221726=this;if(this['channels'][_0x1d899b[_0x33ca('0x23')]]){var _0x18b1ff=this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]]['id'];this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]]['remotestationid']=_0x1d899b[_0x33ca('0x31')];this['channels'][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x32')]=_0x1d899b['pagestransferred'];this['channels'][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x2d')]=_0x1d899b[_0x33ca('0x2d')];this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x33')]=_0x1d899b[_0x33ca('0x33')];this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x34')]=_0x1d899b[_0x33ca('0x34')];this['channels'][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x2e')]=_0x1d899b[_0x33ca('0x2e')];this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x35')]=_0x1d899b[_0x33ca('0x35')];if(this[_0x33ca('0xd')][_0x1d899b[_0x33ca('0x23')]][_0x33ca('0x32')]>0x0){tiff2pdf(_0x1d899b[_0x33ca('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x3d4e7f){logger[_0x33ca('0x2f')](_0x1d899b[_0x33ca('0x23')],_0x33ca('0x36'),_0x3d4e7f['message']);attachment[_0x33ca('0x37')]({'name':path[_0x33ca('0x38')](_0x1d899b['filename'])[_0x33ca('0x25')],'basename':path[_0x33ca('0x38')](_0x1d899b[_0x33ca('0x2e')])['name']+_0x33ca('0x39'),'type':'application/pdf'})[_0x33ca('0x3a')](function(_0x33bf59){faxAccount[_0x33ca('0x3b')](_0x18b1ff,{'from':_0x1d899b[_0x33ca('0x35')],'mapKey':_0x33ca('0x5'),'body':path['parse'](_0x1d899b[_0x33ca('0x2e')])[_0x33ca('0x25')]+_0x33ca('0x39'),'AttachmentId':_0x33bf59['id']})['catch'](function(_0x261e3f){logger['error'](_0x1d899b[_0x33ca('0x23')],_0x33ca('0x3c'),JSON[_0x33ca('0x3d')](_0x261e3f));});})[_0x33ca('0x3e')](function(_0x3164ce){logger[_0x33ca('0x3f')](_0x1d899b[_0x33ca('0x23')],_0x33ca('0x40'),JSON[_0x33ca('0x3d')](_0x3164ce));});});}logger[_0x33ca('0x2f')](_0x1d899b[_0x33ca('0x23')],_0x33ca('0x40'));}};Fax[_0x33ca('0x1d')][_0x33ca('0x1c')]=function(_0x2b2526){if(this['actions'][_0x2b2526[_0x33ca('0x23')]]){_[_0x33ca('0x41')](this[_0x33ca('0xd')][_0x2b2526['uniqueid']],_[_0x33ca('0x42')](_0x2b2526,[_0x33ca('0x43'),'reason']));}};function updateStatus(_0x34565b){if(_0x34565b['AttachmentId']){faxMessage[_0x33ca('0x44')](_0x34565b['AttachmentId'],{'failMessage':_0x33ca('0x45')})['then'](function(_0x3aea0b){ut['logger'](_0x33ca('0x46'),_0x3aea0b);})['catch'](function(_0x492acb){ut[_0x33ca('0x47')](_0x33ca('0x48'),_0x492acb);});}else{ut[_0x33ca('0x47')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x33ca('0x1d')][_0x33ca('0x49')]=function(_0x3b1836,_0x3e023f,_0x1284d9){var _0x27a293=this;var _0x42fcc3={};if(_0x3e023f){_0x42fcc3={'read':_0x3e023f};}else{_0x42fcc3={'failMessage':_0x1284d9};}if(this[_0x33ca('0x10')][_0x3b1836][_0x33ca('0x4a')]){faxMessage[_0x33ca('0x44')](this[_0x33ca('0x10')][_0x3b1836][_0x33ca('0x4a')],_0x42fcc3)[_0x33ca('0x3a')](function(_0x1efe3b){ut[_0x33ca('0x47')](_0x33ca('0x4b'),_0x1efe3b);})['catch'](function(_0x36aee4){ut[_0x33ca('0x47')]('[Fax][Message][NoUpdate1]',_0x36aee4);})[_0x33ca('0x4c')](function(){delete _0x27a293[_0x33ca('0xd')][_0x3b1836];delete _0x27a293[_0x33ca('0x10')][_0x3b1836];});}else{ut[_0x33ca('0x47')](_0x33ca('0x4d'));delete this[_0x33ca('0xd')][_0x3b1836];delete this['actions'][_0x3b1836];}};Fax[_0x33ca('0x1d')][_0x33ca('0x1b')]=function(_0x4f821f){var _0x241302=this;if(this[_0x33ca('0xd')][_0x4f821f['uniqueid']]){if(this[_0x33ca('0x10')][_0x4f821f[_0x33ca('0x23')]]){this[_0x33ca('0xd')][_0x4f821f[_0x33ca('0x23')]]['id']=this[_0x33ca('0x10')][_0x4f821f[_0x33ca('0x23')]]['id'];this['channels'][_0x4f821f[_0x33ca('0x23')]][_0x33ca('0x25')]=this[_0x33ca('0x10')][_0x4f821f[_0x33ca('0x23')]][_0x33ca('0x25')];}logger[_0x33ca('0x2f')](_0x4f821f[_0x33ca('0x23')],this[_0x33ca('0x10')][_0x4f821f['uniqueid']]?_0x33ca('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x33ca('0x3d')](this['channels'][_0x4f821f[_0x33ca('0x23')]]));if(this[_0x33ca('0x10')][_0x4f821f[_0x33ca('0x23')]]){if(this[_0x33ca('0xd')][_0x4f821f[_0x33ca('0x23')]]['faxpages']>0x0&&this[_0x33ca('0xd')][_0x4f821f[_0x33ca('0x23')]][_0x33ca('0x4f')]===_0x33ca('0x50')){this['updateStatus'](_0x4f821f['uniqueid'],!![]);}else{this['updateStatus'](_0x4f821f['uniqueid'],![],this['channels'][_0x4f821f[_0x33ca('0x23')]]['faxstatusstring']?_0x33ca('0x51')+this['channels'][_0x4f821f[_0x33ca('0x23')]][_0x33ca('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0x33ca('0x1d')][_0x33ca('0x53')]=function(_0x12d511){var _0x4087f9=this;return new BPromise(function(_0x234254,_0x4bd981){_0x4087f9[_0x33ca('0x54')](_0x12d511,_0x4087f9['faxAccounts'][_0x12d511[_0x33ca('0x55')]])[_0x33ca('0x3a')](function(_0x5bcc55){ut['logger']('[Fax][execOriginate][success]',_0x5bcc55);_0x234254(ut[_0x33ca('0x56')](_0x33ca('0x57')));})[_0x33ca('0x3e')](function(_0x4bd15f){ut[_0x33ca('0x47')](_0x33ca('0x58'),_0x4bd15f);updateStatus(_0x12d511);_0x4bd981(ut['message'](_0x33ca('0x59')));});});};Fax[_0x33ca('0x1d')][_0x33ca('0x5a')]=function(_0x326cff){var _0x29d92e=this;return new BPromise(function(_0x1c495d,_0x2897ef){var _0x42790c=_0x29d92e[_0x33ca('0x5b')](_0x29d92e[_0x33ca('0xe')][_0x326cff[_0x33ca('0x55')]][_0x33ca('0x5c')],_0x326cff);if(_0x42790c[_0x33ca('0x5d')]){_0x1c495d(ut[_0x33ca('0x56')](_0x33ca('0x5e')));}else{_0x2897ef(ut[_0x33ca('0x56')](_0x42790c[_0x33ca('0x56')]));}});};function originate(_0x393ce4,_0x2224b3,_0x2defe7){return new BPromise(function(_0x1d3b84,_0x1d415d){if(_0x2defe7){var _0x38f49f=util['format'](_0x33ca('0x5f'),path[_0x33ca('0x38')](_0x393ce4['path'])[_0x33ca('0x25')],_0x393ce4['path']);gs['execute'](_0x38f49f)[_0x33ca('0x3a')](function(){_0x393ce4['path']=util[_0x33ca('0x60')](_0x33ca('0x61'),path[_0x33ca('0x38')](_0x393ce4['path'])['dir'],path[_0x33ca('0x38')](_0x393ce4['path'])['name']);_0x2224b3[_0x33ca('0x62')]=_0x393ce4[_0x33ca('0x2')];ut[_0x33ca('0x47')](_0x33ca('0x63'),'');ami[_0x33ca('0x64')](ut['variablesAction'](_0x393ce4,_0x2224b3))[_0x33ca('0x3a')](function(_0x4bf375){_0x1d3b84(_0x4bf375);})[_0x33ca('0x3e')](function(_0x5e001b){_0x1d415d(_0x5e001b);});})[_0x33ca('0x3e')](function(_0xe4a4bf){_0x1d415d(_0xe4a4bf);});}else{ami[_0x33ca('0x64')](ut['variablesAction'](_0x393ce4,_0x2224b3))[_0x33ca('0x3a')](function(_0x43c83f){_0x1d3b84(_0x43c83f);})[_0x33ca('0x3e')](function(_0x4a64ab){_0x1d415d(_0x4a64ab);});}});}Fax[_0x33ca('0x1d')]['execOriginate']=function(_0x40749a,_0x2f74f4){var _0x57f611=this;return new BPromise(function(_0x3b0d49,_0x3485d5){var _0x34acc7=uuid['v4']();var _0x1e288a=ut['addVariables'](_0x40749a,_0x2f74f4);_0x57f611[_0x33ca('0x10')][_0x34acc7]=new Action(_0x34acc7,_0x2f74f4,_0x40749a);var _0x108041=_0x57f611[_0x33ca('0x10')][_0x34acc7];if(path[_0x33ca('0x38')](_0x40749a[_0x33ca('0x2')])[_0x33ca('0x65')]===_0x33ca('0x39')){originate(_0x108041,_0x1e288a,!![])[_0x33ca('0x3a')](function(_0x59048f){_0x3b0d49(_0x59048f);})[_0x33ca('0x3e')](function(_0x171568){_0x3485d5(_0x171568);});}else{originate(_0x108041,_0x1e288a,![])['then'](function(_0x1377f4){_0x3b0d49(_0x1377f4);})[_0x33ca('0x3e')](function(_0x385af9){_0x3485d5(_0x385af9);});}});};Fax[_0x33ca('0x1d')]['isTrunkReachable']=function(_0x12aed7){return!_['isNil'](_0x12aed7)&&!_[_0x33ca('0x66')](_0x12aed7[_0x33ca('0x25')])&&!_[_0x33ca('0x66')](_0x12aed7[_0x33ca('0x67')])&&_0x12aed7[_0x33ca('0x67')]&&!_['isNil'](this[_0x33ca('0xf')][util['format'](_0x33ca('0x68'),_0x12aed7[_0x33ca('0x25')])])&&!_[_0x33ca('0x66')](this[_0x33ca('0xf')][util[_0x33ca('0x60')](_0x33ca('0x68'),_0x12aed7['name'])][_0x33ca('0x2c')])&&(this[_0x33ca('0xf')][util['format'](_0x33ca('0x68'),_0x12aed7[_0x33ca('0x25')])][_0x33ca('0x2c')]==='reachable'||this[_0x33ca('0xf')][util['format'](_0x33ca('0x68'),_0x12aed7[_0x33ca('0x25')])][_0x33ca('0x2c')]==='unmonitored');};Fax[_0x33ca('0x1d')][_0x33ca('0x5b')]=function(_0x3cc754,_0x302447){if(!this[_0x33ca('0x69')](_0x3cc754)){ut[_0x33ca('0x47')](_0x33ca('0x6a'),_[_0x33ca('0x66')](_0x3cc754)?'':_0x3cc754[_0x33ca('0x25')]+_0x33ca('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x302447[_0x33ca('0x5')])){ut[_0x33ca('0x47')](_0x33ca('0x6c'),JSON[_0x33ca('0x3d')](_0x302447));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x33ca('0x66')](_0x302447[_0x33ca('0x2')])){ut[_0x33ca('0x47')](_0x33ca('0x6d'),JSON[_0x33ca('0x3d')](_0x302447));return{'isValid':![],'message':_0x33ca('0x6e')};}return{'isValid':!![],'message':_0x33ca('0x6f')};};module[_0x33ca('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 57a6a12..bfc6f4a 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 _0x2c6d=['../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','catch','[Notify]\x20','util','bluebird'];(function(_0x1103d1,_0x2dbdba){var _0xbc0ce9=function(_0xa02d85){while(--_0xa02d85){_0x1103d1['push'](_0x1103d1['shift']());}};_0xbc0ce9(++_0x2dbdba);}(_0x2c6d,0x1b6));var _0xd2c6=function(_0x189564,_0x419229){_0x189564=_0x189564-0x0;var _0x531d23=_0x2c6d[_0x189564];return _0x531d23;};'use strict';var util=require(_0xd2c6('0x0'));var BPromise=require(_0xd2c6('0x1'));var logger=require(_0xd2c6('0x2'))(_0xd2c6('0x3'));var _=require('lodash');var faxAccount=require(_0xd2c6('0x4'));function loggerCatch(_0x5656b0){return function(_0x5df16b){logger[_0xd2c6('0x5')](_0x5656b0,util['inspect'](_0x5df16b,{'showHidden':![],'depth':null}));};}exports[_0xd2c6('0x6')]=function(_0x3458e4,_0x1b25b3){return BPromise[_0xd2c6('0x7')]()['then'](faxAccount[_0xd2c6('0x6')](_0x3458e4,_0x1b25b3))[_0xd2c6('0x8')](loggerCatch(_0xd2c6('0x9')));}; \ No newline at end of file +var _0x8837=['util','bluebird','lodash','../rpc/faxAccount','error','inspect','resolve','notify','catch'];(function(_0x287acd,_0x2a2dd7){var _0x4332a9=function(_0x216d66){while(--_0x216d66){_0x287acd['push'](_0x287acd['shift']());}};_0x4332a9(++_0x2a2dd7);}(_0x8837,0xc6));var _0x7883=function(_0x2fbc68,_0x3028b8){_0x2fbc68=_0x2fbc68-0x0;var _0x4cc65b=_0x8837[_0x2fbc68];return _0x4cc65b;};'use strict';var util=require(_0x7883('0x0'));var BPromise=require(_0x7883('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x7883('0x2'));var faxAccount=require(_0x7883('0x3'));function loggerCatch(_0x24cb56){return function(_0x322237){logger[_0x7883('0x4')](_0x24cb56,util[_0x7883('0x5')](_0x322237,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4cff5c,_0x2bcb27){return BPromise[_0x7883('0x6')]()['then'](faxAccount[_0x7883('0x7')](_0x4cff5c,_0x2bcb27))[_0x7883('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 0799f40..b88165b 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 _0x38d5=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','execute'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x38d5,0x1b2));var _0x538d=function(_0x36c67b,_0x53e7ac){_0x36c67b=_0x36c67b-0x0;var _0x81eef2=_0x38d5[_0x36c67b];return _0x81eef2;};'use strict';var util=require(_0x538d('0x0'));var logger=require(_0x538d('0x1'))(_0x538d('0x2'));var BPromise=require(_0x538d('0x3'));var exec=require(_0x538d('0x4'))['exec'];exports[_0x538d('0x5')]=function(_0x3b9e46){return new BPromise(function(_0x4370b4,_0x2ebf44){exec(_0x3b9e46,function(_0x42f347,_0x4a3e6e,_0x3aaf20){logger[_0x538d('0x6')]('Exec\x20gs',_0x4a3e6e);if(_0x42f347){logger[_0x538d('0x6')](_0x538d('0x7'),_0x538d('0x8'),util[_0x538d('0x9')](_0x42f347,{'showHidden':![],'depth':null}),_0x4a3e6e,_0x3aaf20);_0x2ebf44(_0x42f347);}_0x4370b4(_0x4a3e6e);});});}; \ No newline at end of file +var _0x1e27=['../../../../config/logger','fax','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x39a78e,_0x170344){var _0x2faeb0=function(_0x35a9ae){while(--_0x35a9ae){_0x39a78e['push'](_0x39a78e['shift']());}};_0x2faeb0(++_0x170344);}(_0x1e27,0x6f));var _0x71e2=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x1e27[_0x58d5ac];return _0x37985c;};'use strict';var util=require(_0x71e2('0x0'));var logger=require(_0x71e2('0x1'))(_0x71e2('0x2'));var BPromise=require(_0x71e2('0x3'));var exec=require(_0x71e2('0x4'))['exec'];exports['execute']=function(_0x46f166){return new BPromise(function(_0x1a87fb,_0x9daf21){exec(_0x46f166,function(_0x44c8af,_0x580c84,_0x540b0f){logger[_0x71e2('0x5')]('Exec\x20gs',_0x580c84);if(_0x44c8af){logger[_0x71e2('0x5')](_0x71e2('0x6'),_0x71e2('0x7'),util['inspect'](_0x44c8af,{'showHidden':![],'depth':null}),_0x580c84,_0x540b0f);_0x9daf21(_0x44c8af);}_0x1a87fb(_0x580c84);});});}; \ 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 f91f3e8..31c5375 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 _0xd557=['moment','../../../../config/logger','fax','message','logger','info','inspect','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash'];(function(_0xa277de,_0x2ad712){var _0x27c2da=function(_0x349646){while(--_0x349646){_0xa277de['push'](_0xa277de['shift']());}};_0x27c2da(++_0x2ad712);}(_0xd557,0x7b));var _0x7d55=function(_0x105698,_0x3d84f6){_0x105698=_0x105698-0x0;var _0x5cc1a0=_0xd557[_0x105698];return _0x5cc1a0;};'use strict';var util=require(_0x7d55('0x0'));var _=require(_0x7d55('0x1'));var moment=require(_0x7d55('0x2'));var logger=require(_0x7d55('0x3'))(_0x7d55('0x4'));exports[_0x7d55('0x5')]=function(_0x42e4bf){return{'message':_0x42e4bf};};exports[_0x7d55('0x6')]=function(_0x192fa2,_0x22379a){logger[_0x7d55('0x7')](_0x192fa2,util[_0x7d55('0x8')](_0x22379a,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4f7aad,_0x1dce1f){var _0x3cbe30={'XMF-ECM':_0x1dce1f['ecm'],'XMF-HEADERINFO':_0x1dce1f['headerinfo'],'XMF-MINRATE':_0x1dce1f[_0x7d55('0x9')],'XMF-MAXRATE':_0x1dce1f[_0x7d55('0xa')],'XMF-MODEM':util['format'](_0x7d55('0xb'),_0x1dce1f[_0x7d55('0xc')]),'XMF-GATEWAY':_0x1dce1f[_0x7d55('0xd')],'XMF-FAXDETECT':_0x1dce1f[_0x7d55('0xe')],'XMF-T38TIMEOUT':_0x1dce1f['t38timeout'],'XMF-LOCALSTATIONID':_0x1dce1f[_0x7d55('0xf')],'XMF-PATH':_0x4f7aad[_0x7d55('0x10')]};return _0x3cbe30;};exports[_0x7d55('0x11')]=function(_0x5afe77,_0x4a3828){return{'actionid':_0x5afe77[_0x7d55('0x12')],'action':_0x7d55('0x13'),'channel':_0x5afe77[_0x7d55('0x14')],'Exten':_0x7d55('0x15'),'Context':_0x7d55('0x16'),'Priority':'1','callerid':util['format'](_0x7d55('0x17'),_0x5afe77[_0x7d55('0x18')]?_0x5afe77[_0x7d55('0x18')]:'',_0x5afe77[_0x7d55('0xf')]),'variable':_0x4a3828,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5afe77['uniqueid']};}; \ No newline at end of file +var _0x30ec=['headerinfo','maxrate','faxdetect','t38timeout','path','variablesAction','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','lodash','moment','../../../../config/logger','fax','message','logger','inspect','addVariables'];(function(_0x354bd6,_0x3c538e){var _0x5f2112=function(_0x332bf9){while(--_0x332bf9){_0x354bd6['push'](_0x354bd6['shift']());}};_0x5f2112(++_0x3c538e);}(_0x30ec,0x19a));var _0xc30e=function(_0x41dfac,_0x278319){_0x41dfac=_0x41dfac-0x0;var _0x12900b=_0x30ec[_0x41dfac];return _0x12900b;};'use strict';var util=require('util');var _=require(_0xc30e('0x0'));var moment=require(_0xc30e('0x1'));var logger=require(_0xc30e('0x2'))(_0xc30e('0x3'));exports[_0xc30e('0x4')]=function(_0x42c4e0){return{'message':_0x42c4e0};};exports[_0xc30e('0x5')]=function(_0x198115,_0xbc7298){logger['info'](_0x198115,util[_0xc30e('0x6')](_0xbc7298,{'showHidden':![],'depth':null}));};exports[_0xc30e('0x7')]=function(_0x239a5c,_0x2581b4){var _0x5302ed={'XMF-ECM':_0x2581b4['ecm'],'XMF-HEADERINFO':_0x2581b4[_0xc30e('0x8')],'XMF-MINRATE':_0x2581b4['minrate'],'XMF-MAXRATE':_0x2581b4[_0xc30e('0x9')],'XMF-MODEM':util['format']('\x22%s\x22',_0x2581b4['modem']),'XMF-GATEWAY':_0x2581b4['gateway'],'XMF-FAXDETECT':_0x2581b4[_0xc30e('0xa')],'XMF-T38TIMEOUT':_0x2581b4[_0xc30e('0xb')],'XMF-LOCALSTATIONID':_0x2581b4['localstationid'],'XMF-PATH':_0x239a5c[_0xc30e('0xc')]};return _0x5302ed;};exports[_0xc30e('0xd')]=function(_0x139b9b,_0x42ac4c){return{'actionid':_0x139b9b[_0xc30e('0xe')],'action':'originate','channel':_0x139b9b['channel'],'Exten':_0xc30e('0xf'),'Context':_0xc30e('0x10'),'Priority':'1','callerid':util['format'](_0xc30e('0x11'),_0x139b9b[_0xc30e('0x8')]?_0x139b9b['headerinfo']:'',_0x139b9b[_0xc30e('0x12')]),'variable':_0x42ac4c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x139b9b['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b0e9e89..9f42379 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 _0x18e4=['get','hour','resolve','initAgents','then','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','moment','./realtime','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x26fcd1,_0x2c6399){var _0x155458=function(_0x4f9a7a){while(--_0x4f9a7a){_0x26fcd1['push'](_0x26fcd1['shift']());}};_0x155458(++_0x2c6399);}(_0x18e4,0xff));var _0x418e=function(_0x1a7edf,_0x5c4e04){_0x1a7edf=_0x1a7edf-0x0;var _0x56c1d9=_0x18e4[_0x1a7edf];return _0x56c1d9;};'use strict';var util=require('util');var moment=require(_0x418e('0x0'));var server=require('./server');var Realtime=require(_0x418e('0x1'));var Report=require(_0x418e('0x2'));var Acw=require(_0x418e('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x418e('0x4'));var Preview=require(_0x418e('0x5'));var Fax=require('./fax');var user=require(_0x418e('0x6'));var voiceQueue=require(_0x418e('0x7'));var voiceQueueReport=require(_0x418e('0x8'));var voiceCallReport=require(_0x418e('0x9'));var trunk=require(_0x418e('0xa'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x418e('0xb'));var campaign=require(_0x418e('0xc'));var voiceExtension=require(_0x418e('0xd'));var faxAccount=require(_0x418e('0xe'));var zendesk=require(_0x418e('0xf'));var salesforce=require(_0x418e('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x418e('0x11'));var desk=require(_0x418e('0x12'));var zoho=require(_0x418e('0x13'));var vtiger=require(_0x418e('0x14'));var freshsales=require(_0x418e('0x15'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x418e('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x418e('0x17'))(_0x418e('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x418e('0x19')](_0x418e('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x418e('0x19')](_0x418e('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x418e('0x1b')]()['then'](user['getAgents']())['then'](realtime[_0x418e('0x1c')]())[_0x418e('0x1d')](user['getTelephones']())[_0x418e('0x1d')](realtime[_0x418e('0x1e')]())[_0x418e('0x1d')](trunk[_0x418e('0x1f')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x418e('0x20')]())[_0x418e('0x1d')](realtime['initVoiceQueues']())['then'](trigger[_0x418e('0x21')]())[_0x418e('0x1d')](realtime[_0x418e('0x22')]())[_0x418e('0x1d')](template[_0x418e('0x23')]())[_0x418e('0x1d')](realtime[_0x418e('0x24')]())['then'](zendesk[_0x418e('0x25')]())[_0x418e('0x1d')](realtime['initZendeskAccounts']())[_0x418e('0x1d')](salesforce[_0x418e('0x26')]())['then'](realtime['initSalesforceAccounts']())[_0x418e('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x418e('0x1d')](realtime[_0x418e('0x27')]())['then'](freshdesk[_0x418e('0x28')]())['then'](realtime[_0x418e('0x29')]())[_0x418e('0x1d')](desk[_0x418e('0x2a')]())[_0x418e('0x1d')](realtime[_0x418e('0x2b')]())[_0x418e('0x1d')](zoho[_0x418e('0x2c')]())['then'](realtime[_0x418e('0x2d')]())[_0x418e('0x1d')](vtiger[_0x418e('0x2e')]())[_0x418e('0x1d')](realtime['initVtigerAccounts']())['then'](freshsales[_0x418e('0x2f')]())[_0x418e('0x1d')](realtime['initFreshsalesAccounts']())[_0x418e('0x1d')](servicenow[_0x418e('0x30')]())[_0x418e('0x1d')](realtime[_0x418e('0x31')]())[_0x418e('0x1d')](dynamics365[_0x418e('0x32')]())[_0x418e('0x1d')](realtime[_0x418e('0x33')]())[_0x418e('0x1d')](campaign[_0x418e('0x34')]())['then'](realtime[_0x418e('0x35')]())[_0x418e('0x1d')](voiceExtension[_0x418e('0x36')]())[_0x418e('0x1d')](realtime[_0x418e('0x37')]())[_0x418e('0x1d')](faxAccount['getFaxAccounts']())['then'](realtime[_0x418e('0x38')]())[_0x418e('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0x418e('0x1b')]()[_0x418e('0x1d')](voiceQueueReport[_0x418e('0x39')]())['then'](realtime[_0x418e('0x3a')]())[_0x418e('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x418e('0x1d')](realtime[_0x418e('0x3b')]())[_0x418e('0x1d')](cmHopperHistory[_0x418e('0x3c')]())[_0x418e('0x1d')](realtime[_0x418e('0x3d')]())[_0x418e('0x1d')](voiceCallReport[_0x418e('0x3e')]())[_0x418e('0x1d')](realtime[_0x418e('0x3f')]())[_0x418e('0x40')](function(_0x9fc894){logger[_0x418e('0x41')]('[index.js][initParams]',util[_0x418e('0x42')](_0x9fc894,{'showHidden':![],'depth':null}));});}function main(){return server[_0x418e('0x43')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})[_0x418e('0x1d')](function(){report[_0x418e('0x44')]();setInterval(initRealtime,0x1388);})[_0x418e('0x40')](function(_0x570296){logger[_0x418e('0x41')](_0x418e('0x45'),util[_0x418e('0x42')](_0x570296,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x2d78=['getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','inspect','./realtime','./report','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory'];(function(_0x248932,_0x4bb9d4){var _0x504a63=function(_0x210b9c){while(--_0x210b9c){_0x248932['push'](_0x248932['shift']());}};_0x504a63(++_0x4bb9d4);}(_0x2d78,0xff));var _0x82d7=function(_0x57c662,_0x2c9ffe){_0x57c662=_0x57c662-0x0;var _0x216916=_0x2d78[_0x57c662];return _0x216916;};'use strict';var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0x82d7('0x0'));var Report=require(_0x82d7('0x1'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0x82d7('0x2'));var Preview=require(_0x82d7('0x3'));var Fax=require(_0x82d7('0x4'));var user=require(_0x82d7('0x5'));var voiceQueue=require(_0x82d7('0x6'));var voiceQueueReport=require(_0x82d7('0x7'));var voiceCallReport=require(_0x82d7('0x8'));var trunk=require(_0x82d7('0x9'));var trigger=require(_0x82d7('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x82d7('0xb'));var campaign=require(_0x82d7('0xc'));var voiceExtension=require(_0x82d7('0xd'));var faxAccount=require(_0x82d7('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x82d7('0xf'));var sugarcrm=require(_0x82d7('0x10'));var freshdesk=require(_0x82d7('0x11'));var desk=require(_0x82d7('0x12'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x82d7('0x13'));var freshsales=require(_0x82d7('0x14'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x82d7('0x15'));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(_0x82d7('0x16'))(_0x82d7('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x82d7('0x18')](_0x82d7('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x82d7('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x82d7('0x1a')]()[_0x82d7('0x1b')](user['getAgents']())[_0x82d7('0x1b')](realtime[_0x82d7('0x1c')]())[_0x82d7('0x1b')](user[_0x82d7('0x1d')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x1e')]())[_0x82d7('0x1b')](trunk['getTrunks']())[_0x82d7('0x1b')](realtime[_0x82d7('0x1f')]())[_0x82d7('0x1b')](voiceQueue[_0x82d7('0x20')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x21')]())[_0x82d7('0x1b')](trigger[_0x82d7('0x22')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x23')]())[_0x82d7('0x1b')](template['getTemplates']())[_0x82d7('0x1b')](realtime[_0x82d7('0x24')]())['then'](zendesk[_0x82d7('0x25')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x26')]())['then'](salesforce[_0x82d7('0x27')]())[_0x82d7('0x1b')](realtime['initSalesforceAccounts']())[_0x82d7('0x1b')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())[_0x82d7('0x1b')](freshdesk['getFreshdeskAccounts']())[_0x82d7('0x1b')](realtime['initFreshdeskAccounts']())[_0x82d7('0x1b')](desk['getDeskAccounts']())[_0x82d7('0x1b')](realtime['initDeskAccounts']())['then'](zoho[_0x82d7('0x28')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x29')]())['then'](vtiger[_0x82d7('0x2a')]())['then'](realtime['initVtigerAccounts']())[_0x82d7('0x1b')](freshsales[_0x82d7('0x2b')]())[_0x82d7('0x1b')](realtime['initFreshsalesAccounts']())[_0x82d7('0x1b')](servicenow[_0x82d7('0x2c')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x2d')]())['then'](dynamics365[_0x82d7('0x2e')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x2f')]())['then'](campaign[_0x82d7('0x30')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x31')]())[_0x82d7('0x1b')](voiceExtension[_0x82d7('0x32')]())['then'](realtime['initVoiceExtensions']())[_0x82d7('0x1b')](faxAccount['getFaxAccounts']())[_0x82d7('0x1b')](realtime['initFaxAccounts']())[_0x82d7('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x82d7('0x1a')]()[_0x82d7('0x1b')](voiceQueueReport[_0x82d7('0x33')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x34')]())[_0x82d7('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x82d7('0x1b')](realtime[_0x82d7('0x35')]())[_0x82d7('0x1b')](cmHopperHistory[_0x82d7('0x36')]())[_0x82d7('0x1b')](realtime['initCampaignHopperHistory']())[_0x82d7('0x1b')](voiceCallReport[_0x82d7('0x37')]())[_0x82d7('0x1b')](realtime[_0x82d7('0x38')]())[_0x82d7('0x39')](function(_0x139601){logger[_0x82d7('0x3a')](_0x82d7('0x3b'),util['inspect'](_0x139601,{'showHidden':![],'depth':null}));});}function main(){return server[_0x82d7('0x3c')](realtime,preview,fax)[_0x82d7('0x1b')](function(){return initRealtime();})[_0x82d7('0x1b')](function(){return initParams();})[_0x82d7('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x82d7('0x39')](function(_0x1f8681){logger[_0x82d7('0x3a')]('[index.js][main]',util[_0x82d7('0x3d')](_0x1f8681,{'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 562c7e7..7157026 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 _0xb4e4=['socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','not_inuse','idle','inuse','toNumber','format','stringify','user:%s','emit','user:ami:update','omit','exports','lodash','util','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xb4e4,0x1b1));var _0x4b4e=function(_0x618099,_0x256fef){_0x618099=_0x618099-0x0;var _0xa706a9=_0xb4e4[_0x618099];return _0xa706a9;};'use strict';var _=require(_0x4b4e('0x0'));var util=require(_0x4b4e('0x1'));var moment=require('moment');var md5=require(_0x4b4e('0x2'));var Redis=require('ioredis');var config=require(_0x4b4e('0x3'));config[_0x4b4e('0x4')]=_[_0x4b4e('0x5')](config[_0x4b4e('0x4')],{'host':_0x4b4e('0x6'),'port':0x18eb});var io=require(_0x4b4e('0x7'))(new Redis(config[_0x4b4e('0x4')]));function Agent(_0x24ebc2){this['id']=_0x24ebc2['id']||0x0;this['name']=_0x24ebc2[_0x4b4e('0x8')]||'';this[_0x4b4e('0x9')]=_0x24ebc2[_0x4b4e('0x9')]||'';this[_0x4b4e('0xa')]=_0x24ebc2['accountcode']||'';this[_0x4b4e('0xb')]=_0x24ebc2['fullname']||'';this[_0x4b4e('0xc')]=_0x4b4e('0xd');this[_0x4b4e('0xe')]=0x0;this[_0x4b4e('0xf')]=_0x4b4e('0xd');this[_0x4b4e('0x10')]='';this[_0x4b4e('0x11')]='';this[_0x4b4e('0x12')]='';this[_0x4b4e('0x13')]='';this[_0x4b4e('0x14')]=_0x24ebc2[_0x4b4e('0x14')]||![];this[_0x4b4e('0x15')]=_0x4b4e('0xd');this[_0x4b4e('0x16')]=0x0;this[_0x4b4e('0x17')]='';this[_0x4b4e('0x18')]='';this[_0x4b4e('0x19')]=![];this[_0x4b4e('0x1a')]=![];this['md5']='';}Agent[_0x4b4e('0x1b')][_0x4b4e('0x1c')]=function(_0x4d7d85){var _0x462a92;if(_0x4d7d85&&_0x4d7d85[_0x4b4e('0xc')]){_0x462a92=_0x4d7d85[_0x4b4e('0xc')]['toLowerCase']();switch(_0x462a92){case _0x4b4e('0x1d'):_0x462a92=_0x4b4e('0x1e');break;case _0x4b4e('0x1f'):_0x462a92='talking';break;}}if(_0x462a92&&this['voiceStatus']!==_0x462a92||_0x4d7d85['statePause']){this[_0x4b4e('0x16')]=_[_0x4b4e('0x20')](moment()[_0x4b4e('0x21')]('x'));}if(_0x462a92){this[_0x4b4e('0x15')]=_0x462a92;}var _0x121e34={'id':this['id'],'name':this[_0x4b4e('0x8')],'email':this[_0x4b4e('0x9')],'accountcode':this[_0x4b4e('0xa')],'fullname':this[_0x4b4e('0xb')],'state':this[_0x4b4e('0xc')],'stateTime':this[_0x4b4e('0xe')],'status':this[_0x4b4e('0xf')],'address':this[_0x4b4e('0x10')],'online':this[_0x4b4e('0x14')],'voiceStatus':this[_0x4b4e('0x15')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x4b4e('0x17')],'voiceStatusQueue':this[_0x4b4e('0x18')],'interface':this[_0x4b4e('0x13')],'onhold':this[_0x4b4e('0x19')]};var _0x49a01b=md5(JSON[_0x4b4e('0x22')](_0x121e34));if(this['md5']!==_0x49a01b){this[_0x4b4e('0x2')]=_0x49a01b;io['to'](util[_0x4b4e('0x21')](_0x4b4e('0x23'),_0x121e34[_0x4b4e('0x8')]))[_0x4b4e('0x24')](_0x4b4e('0x25'),_[_0x4b4e('0x26')](_0x121e34,['online']));io[_0x4b4e('0x24')]('user:presence',_0x121e34);}};module[_0x4b4e('0x27')]=Agent; \ No newline at end of file +var _0x385d=['md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown','stateTime','status','address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','statePause','toNumber','format','fullname','interface','stringify','emit','user:presence','exports','lodash'];(function(_0x1e2a66,_0x5ccab7){var _0x306da9=function(_0x234e8f){while(--_0x234e8f){_0x1e2a66['push'](_0x1e2a66['shift']());}};_0x306da9(++_0x5ccab7);}(_0x385d,0x1a3));var _0xd385=function(_0x3e1d95,_0x1ac4d6){_0x3e1d95=_0x3e1d95-0x0;var _0xd2297=_0x385d[_0x3e1d95];return _0xd2297;};'use strict';var _=require(_0xd385('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0xd385('0x1'));var Redis=require(_0xd385('0x2'));var config=require(_0xd385('0x3'));config[_0xd385('0x4')]=_['defaults'](config[_0xd385('0x4')],{'host':_0xd385('0x5'),'port':0x18eb});var io=require(_0xd385('0x6'))(new Redis(config[_0xd385('0x4')]));function Agent(_0xb03298){this['id']=_0xb03298['id']||0x0;this[_0xd385('0x7')]=_0xb03298[_0xd385('0x7')]||'';this[_0xd385('0x8')]=_0xb03298[_0xd385('0x8')]||'';this[_0xd385('0x9')]=_0xb03298[_0xd385('0x9')]||'';this['fullname']=_0xb03298['fullname']||'';this[_0xd385('0xa')]=_0xd385('0xb');this[_0xd385('0xc')]=0x0;this[_0xd385('0xd')]=_0xd385('0xb');this[_0xd385('0xe')]='';this[_0xd385('0xf')]='';this['mobile']='';this['interface']='';this['online']=_0xb03298[_0xd385('0x10')]||![];this[_0xd385('0x11')]='unknown';this[_0xd385('0x12')]=0x0;this[_0xd385('0x13')]='';this['voiceStatusQueue']='';this[_0xd385('0x14')]=![];this[_0xd385('0x15')]=![];this[_0xd385('0x1')]='';}Agent[_0xd385('0x16')][_0xd385('0x17')]=function(_0x526309){var _0x448656;if(_0x526309&&_0x526309['state']){_0x448656=_0x526309[_0xd385('0xa')][_0xd385('0x18')]();switch(_0x448656){case'not_inuse':_0x448656=_0xd385('0x19');break;case'inuse':_0x448656='talking';break;}}if(_0x448656&&this[_0xd385('0x11')]!==_0x448656||_0x526309[_0xd385('0x1a')]){this[_0xd385('0x12')]=_[_0xd385('0x1b')](moment()[_0xd385('0x1c')]('x'));}if(_0x448656){this['voiceStatus']=_0x448656;}var _0x4c960e={'id':this['id'],'name':this[_0xd385('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0xd385('0x1d')],'state':this['state'],'stateTime':this[_0xd385('0xc')],'status':this[_0xd385('0xd')],'address':this['address'],'online':this[_0xd385('0x10')],'voiceStatus':this[_0xd385('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xd385('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd385('0x1e')],'onhold':this[_0xd385('0x14')]};var _0x305742=md5(JSON[_0xd385('0x1f')](_0x4c960e));if(this[_0xd385('0x1')]!==_0x305742){this[_0xd385('0x1')]=_0x305742;io['to'](util[_0xd385('0x1c')]('user:%s',_0x4c960e[_0xd385('0x7')]))[_0xd385('0x20')]('user:ami:update',_['omit'](_0x4c960e,[_0xd385('0x10')]));io['emit'](_0xd385('0x21'),_0x4c960e);}};module[_0xd385('0x22')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 204dbbc..cd04b01 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 _0xcb96=['name','type','originated','ivrAnswerCallsDay','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports'];(function(_0x18c55f,_0x327651){var _0x334690=function(_0x4510b0){while(--_0x4510b0){_0x18c55f['push'](_0x18c55f['shift']());}};_0x334690(++_0x327651);}(_0xcb96,0x1d6));var _0x6cb9=function(_0x2a9a51,_0x245276){_0x2a9a51=_0x2a9a51-0x0;var _0x53f436=_0xcb96[_0x2a9a51];return _0x53f436;};'use strict';function Campaign(_0x374c1d){this['id']=_0x374c1d['id']||0x0;this[_0x6cb9('0x0')]=_0x374c1d[_0x6cb9('0x0')]||'';this[_0x6cb9('0x1')]=_0x374c1d[_0x6cb9('0x1')]||'campaign';this[_0x6cb9('0x2')]=0x0;this['temp']=0x0;this[_0x6cb9('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x6cb9('0x4')]=!![];this[_0x6cb9('0x5')]=_0x374c1d[_0x6cb9('0x5')];this['limitCalls']=_0x374c1d[_0x6cb9('0x6')];this[_0x6cb9('0x7')]=_0x374c1d[_0x6cb9('0x7')]||null;this[_0x6cb9('0x8')]=_0x374c1d['dialGlobalInterval']?_0x374c1d[_0x6cb9('0x8')]:null;this['dialOriginateCallerIdName']=_0x374c1d['dialOriginateCallerIdName'];this[_0x6cb9('0x9')]=_0x374c1d[_0x6cb9('0x9')];this[_0x6cb9('0xa')]=_0x374c1d['dialOriginateTimeout']||0x1e;this[_0x6cb9('0xb')]=_0x374c1d[_0x6cb9('0xb')];this['dialCongestionRetryFrequency']=_0x374c1d[_0x6cb9('0xc')];this[_0x6cb9('0xd')]=_0x374c1d[_0x6cb9('0xd')];this[_0x6cb9('0xe')]=_0x374c1d[_0x6cb9('0xe')];this['dialNoAnswerMaxRetry']=_0x374c1d[_0x6cb9('0xf')];this[_0x6cb9('0x10')]=_0x374c1d[_0x6cb9('0x10')];this[_0x6cb9('0x11')]=_0x374c1d[_0x6cb9('0x11')];this[_0x6cb9('0x12')]=_0x374c1d[_0x6cb9('0x12')]||0x3;this[_0x6cb9('0x13')]=_0x374c1d[_0x6cb9('0x13')]||0x96;this[_0x6cb9('0x14')]=_0x374c1d[_0x6cb9('0x14')]||0x3;this['dialDropRetryFrequency']=_0x374c1d['dialDropRetryFrequency']||0x96;this[_0x6cb9('0x15')]=_0x374c1d[_0x6cb9('0x15')]||0x3;this[_0x6cb9('0x16')]=_0x374c1d[_0x6cb9('0x16')]||0x96;this[_0x6cb9('0x17')]=_0x374c1d['dialMachineMaxRetry']||0x3;this[_0x6cb9('0x18')]=_0x374c1d[_0x6cb9('0x18')]||0x96;this[_0x6cb9('0x19')]=_0x374c1d[_0x6cb9('0x19')]||0x3;this[_0x6cb9('0x1a')]=_0x374c1d[_0x6cb9('0x1a')]||0x96;this[_0x6cb9('0x1b')]=_0x374c1d[_0x6cb9('0x1b')]||_0x6cb9('0x1c');this[_0x6cb9('0x1d')]=_0x374c1d[_0x6cb9('0x1d')]||undefined;this[_0x6cb9('0x1e')]=_0x374c1d[_0x6cb9('0x1e')]||undefined;this['dialCutDigit']=_0x374c1d[_0x6cb9('0x1f')]||undefined;this[_0x6cb9('0x20')]=_0x374c1d['TrunkBackup']?_0x374c1d[_0x6cb9('0x20')]:undefined;this[_0x6cb9('0x21')]=_0x374c1d[_0x6cb9('0x21')]?_0x374c1d[_0x6cb9('0x21')]:undefined;this[_0x6cb9('0x22')]=_0x374c1d[_0x6cb9('0x22')]?_0x374c1d[_0x6cb9('0x22')]:undefined;this[_0x6cb9('0x23')]=_0x374c1d[_0x6cb9('0x23')]?_0x374c1d[_0x6cb9('0x23')]:undefined;this[_0x6cb9('0x24')]=_0x374c1d[_0x6cb9('0x23')]?_0x374c1d[_0x6cb9('0x23')][_0x6cb9('0x0')]:undefined;this[_0x6cb9('0x25')]=_0x374c1d[_0x6cb9('0x25')]||![];this[_0x6cb9('0x26')]=_0x374c1d[_0x6cb9('0x26')];this[_0x6cb9('0x27')]=_0x374c1d['dialAMDGreeting'];this[_0x6cb9('0x28')]=_0x374c1d[_0x6cb9('0x28')];this['dialAMDTotalAnalysisTime']=_0x374c1d['dialAMDTotalAnalysisTime'];this[_0x6cb9('0x29')]=_0x374c1d['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x374c1d[_0x6cb9('0x2a')];this[_0x6cb9('0x2b')]=_0x374c1d['dialAMDMaximumNumberOfWords'];this[_0x6cb9('0x2c')]=_0x374c1d[_0x6cb9('0x2c')];this['dialAMDMaximumWordLength']=_0x374c1d[_0x6cb9('0x2d')];}module[_0x6cb9('0x2e')]=Campaign; \ No newline at end of file +var _0xa10d=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x41b006,_0x2f540b){var _0x3c3326=function(_0x459e52){while(--_0x459e52){_0x41b006['push'](_0x41b006['shift']());}};_0x3c3326(++_0x2f540b);}(_0xa10d,0x17c));var _0xda10=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa10d[_0x4e676e];return _0x336a3c;};'use strict';function Campaign(_0xc0f8be){this['id']=_0xc0f8be['id']||0x0;this['name']=_0xc0f8be['name']||'';this['type']=_0xc0f8be['type']||_0xda10('0x0');this[_0xda10('0x1')]=0x0;this['temp']=0x0;this[_0xda10('0x2')]=0x0;this[_0xda10('0x3')]=0x0;this[_0xda10('0x4')]='';this[_0xda10('0x5')]=!![];this['active']=_0xc0f8be['active'];this['limitCalls']=_0xc0f8be[_0xda10('0x6')];this[_0xda10('0x7')]=_0xc0f8be['dialTimezone']||null;this[_0xda10('0x8')]=_0xc0f8be[_0xda10('0x8')]?_0xc0f8be[_0xda10('0x8')]:null;this[_0xda10('0x9')]=_0xc0f8be[_0xda10('0x9')];this[_0xda10('0xa')]=_0xc0f8be[_0xda10('0xa')];this[_0xda10('0xb')]=_0xc0f8be[_0xda10('0xb')]||0x1e;this[_0xda10('0xc')]=_0xc0f8be[_0xda10('0xc')];this[_0xda10('0xd')]=_0xc0f8be[_0xda10('0xd')];this[_0xda10('0xe')]=_0xc0f8be[_0xda10('0xe')];this[_0xda10('0xf')]=_0xc0f8be[_0xda10('0xf')];this[_0xda10('0x10')]=_0xc0f8be['dialNoAnswerMaxRetry'];this[_0xda10('0x11')]=_0xc0f8be[_0xda10('0x11')];this[_0xda10('0x12')]=_0xc0f8be[_0xda10('0x12')];this[_0xda10('0x13')]=_0xc0f8be['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xc0f8be[_0xda10('0x14')]||0x96;this[_0xda10('0x15')]=_0xc0f8be[_0xda10('0x15')]||0x3;this[_0xda10('0x16')]=_0xc0f8be['dialDropRetryFrequency']||0x96;this[_0xda10('0x17')]=_0xc0f8be[_0xda10('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0xc0f8be[_0xda10('0x18')]||0x96;this[_0xda10('0x19')]=_0xc0f8be['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0xc0f8be[_0xda10('0x1a')]||0x96;this[_0xda10('0x1b')]=_0xc0f8be[_0xda10('0x1b')]||0x3;this[_0xda10('0x1c')]=_0xc0f8be[_0xda10('0x1c')]||0x96;this[_0xda10('0x1d')]=_0xc0f8be['dialOrderByScheduledAt']||_0xda10('0x1e');this[_0xda10('0x1f')]=_0xc0f8be[_0xda10('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xc0f8be[_0xda10('0x20')]||undefined;this[_0xda10('0x21')]=_0xc0f8be['dialCutDigit']||undefined;this[_0xda10('0x22')]=_0xc0f8be['TrunkBackup']?_0xc0f8be[_0xda10('0x22')]:undefined;this[_0xda10('0x23')]=_0xc0f8be[_0xda10('0x23')]?_0xc0f8be[_0xda10('0x23')]:undefined;this[_0xda10('0x24')]=_0xc0f8be[_0xda10('0x24')]?_0xc0f8be['Interval']:undefined;this[_0xda10('0x25')]=_0xc0f8be[_0xda10('0x25')]?_0xc0f8be[_0xda10('0x25')]:undefined;this[_0xda10('0x26')]=_0xc0f8be[_0xda10('0x25')]?_0xc0f8be[_0xda10('0x25')][_0xda10('0x27')]:undefined;this[_0xda10('0x28')]=_0xc0f8be['dialAMDActive']||![];this[_0xda10('0x29')]=_0xc0f8be[_0xda10('0x29')];this['dialAMDGreeting']=_0xc0f8be[_0xda10('0x2a')];this['dialAMDAfterGreetingSilence']=_0xc0f8be['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0xc0f8be[_0xda10('0x2b')];this['dialAMDMinWordLength']=_0xc0f8be[_0xda10('0x2c')];this[_0xda10('0x2d')]=_0xc0f8be[_0xda10('0x2d')];this[_0xda10('0x2e')]=_0xc0f8be[_0xda10('0x2e')];this[_0xda10('0x2f')]=_0xc0f8be[_0xda10('0x2f')];this[_0xda10('0x30')]=_0xc0f8be[_0xda10('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1c66b21..abfe47d 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 _0x8d62=['endtime','abandoned','lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime'];(function(_0x20e1fd,_0x506bf0){var _0x3be635=function(_0x530079){while(--_0x530079){_0x20e1fd['push'](_0x20e1fd['shift']());}};_0x3be635(++_0x506bf0);}(_0x8d62,0xf8));var _0x28d6=function(_0x588c41,_0x382e7a){_0x588c41=_0x588c41-0x0;var _0x339530=_0x8d62[_0x588c41];return _0x339530;};'use strict';function Channel(){this['starttime']=null;this[_0x28d6('0x0')]='';this[_0x28d6('0x1')]='';this[_0x28d6('0x2')]=0x0;this[_0x28d6('0x3')]='';this[_0x28d6('0x4')]=undefined;this[_0x28d6('0x5')]=undefined;this[_0x28d6('0x6')]=0x0;this[_0x28d6('0x7')]='';this[_0x28d6('0x8')]=0x0;this[_0x28d6('0x9')]=0x0;this[_0x28d6('0xa')]=0x0;this[_0x28d6('0xb')]=![];this[_0x28d6('0xc')]=null;this[_0x28d6('0xd')]=null;this['unmanaged']=![];this[_0x28d6('0xe')]=![];this[_0x28d6('0xf')]='';this[_0x28d6('0x10')]='';this['duration']=0x0;this[_0x28d6('0x11')]=0x0;this['holdtime']=0x0;this[_0x28d6('0x12')]=null;this[_0x28d6('0x13')]=null;this[_0x28d6('0x14')]=null;this[_0x28d6('0x15')]=![];this[_0x28d6('0x16')]=null;this['queue']=null;this[_0x28d6('0x17')]=[];this[_0x28d6('0x18')]=undefined;this[_0x28d6('0x19')]=undefined;this[_0x28d6('0x1a')]=undefined;this[_0x28d6('0x1b')]=0x0;}module[_0x28d6('0x1c')]=Channel; \ No newline at end of file +var _0x1a4d=['transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x3efc72,_0x405ab7){var _0x5a4457=function(_0x2e2ef0){while(--_0x2e2ef0){_0x3efc72['push'](_0x3efc72['shift']());}};_0x5a4457(++_0x405ab7);}(_0x1a4d,0x189));var _0xd1a4=function(_0x3fc6d7,_0x16dd05){_0x3fc6d7=_0x3fc6d7-0x0;var _0x2b1f09=_0x1a4d[_0x3fc6d7];return _0x2b1f09;};'use strict';function Channel(){this[_0xd1a4('0x0')]=null;this[_0xd1a4('0x1')]='';this['destinationchannel']='';this[_0xd1a4('0x2')]=0x0;this[_0xd1a4('0x3')]='';this[_0xd1a4('0x4')]=undefined;this[_0xd1a4('0x5')]=undefined;this[_0xd1a4('0x6')]=0x0;this[_0xd1a4('0x7')]='';this[_0xd1a4('0x8')]=0x0;this[_0xd1a4('0x9')]=0x0;this['exten']=0x0;this[_0xd1a4('0xa')]=![];this[_0xd1a4('0xb')]=null;this[_0xd1a4('0xc')]=null;this[_0xd1a4('0xd')]=![];this[_0xd1a4('0xe')]=![];this[_0xd1a4('0xf')]='';this[_0xd1a4('0x10')]='';this[_0xd1a4('0x11')]=0x0;this[_0xd1a4('0x12')]=0x0;this[_0xd1a4('0x13')]=0x0;this['type']=null;this[_0xd1a4('0x14')]=null;this['disposition']=null;this[_0xd1a4('0x15')]=![];this[_0xd1a4('0x16')]=null;this[_0xd1a4('0x17')]=null;this[_0xd1a4('0x18')]=[];this[_0xd1a4('0x19')]=undefined;this[_0xd1a4('0x1a')]=undefined;this[_0xd1a4('0x1b')]=undefined;this[_0xd1a4('0x1c')]=0x0;}module[_0xd1a4('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 40a1cc0..52d1f80 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 _0xfae9=['password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','name','username','remoteUri','authType'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xfae9,0x146));var _0x9fae=function(_0x3f6f3e,_0x4862c1){_0x3f6f3e=_0x3f6f3e-0x0;var _0x268808=_0xfae9[_0x3f6f3e];return _0x268808;};'use strict';function DeskAccount(_0x4b3171){this['id']=_0x4b3171['id']||0x0;this[_0x9fae('0x0')]=_0x4b3171[_0x9fae('0x0')]||'';this['username']=_0x4b3171[_0x9fae('0x1')]||'';this[_0x9fae('0x2')]=_0x4b3171[_0x9fae('0x2')]||'';this[_0x9fae('0x3')]=_0x4b3171['authType']||'';this[_0x9fae('0x4')]=_0x4b3171[_0x9fae('0x4')]||'';this[_0x9fae('0x5')]=_0x4b3171['consumerKey']||'';this[_0x9fae('0x6')]=_0x4b3171[_0x9fae('0x6')]||'';this[_0x9fae('0x7')]=_0x4b3171[_0x9fae('0x7')]||'';this[_0x9fae('0x8')]=_0x4b3171['tokenSecret']||'';this[_0x9fae('0x9')]=_0x4b3171['type']||'';this['serverUrl']=_0x4b3171['serverUrl']||'';this['Configurations']=_0x4b3171[_0x9fae('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x5759=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x2b7e46,_0x319579){var _0xf846c5=function(_0x205be9){while(--_0x205be9){_0x2b7e46['push'](_0x2b7e46['shift']());}};_0xf846c5(++_0x319579);}(_0x5759,0x19b));var _0x9575=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5759[_0x4d8ed9];return _0x1e2140;};'use strict';function DeskAccount(_0x1c8677){this['id']=_0x1c8677['id']||0x0;this[_0x9575('0x0')]=_0x1c8677[_0x9575('0x0')]||'';this[_0x9575('0x1')]=_0x1c8677[_0x9575('0x1')]||'';this['remoteUri']=_0x1c8677[_0x9575('0x2')]||'';this[_0x9575('0x3')]=_0x1c8677['authType']||'';this['password']=_0x1c8677[_0x9575('0x4')]||'';this['consumerKey']=_0x1c8677[_0x9575('0x5')]||'';this['consumerSecret']=_0x1c8677[_0x9575('0x6')]||'';this[_0x9575('0x7')]=_0x1c8677[_0x9575('0x7')]||'';this[_0x9575('0x8')]=_0x1c8677['tokenSecret']||'';this[_0x9575('0x9')]=_0x1c8677[_0x9575('0x9')]||'';this[_0x9575('0xa')]=_0x1c8677['serverUrl']||'';this[_0x9575('0xb')]=_0x1c8677[_0x9575('0xb')]||{};}module[_0x9575('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 f4f4122..bf85ddc 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 _0xe92d=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe92d,0xee));var _0xde92=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe92d[_0x14add3];return _0x4a174f;};'use strict';function Dynamics365Account(_0x503d92){this['id']=_0x503d92['id']||0x0;this[_0xde92('0x0')]=_0x503d92[_0xde92('0x0')]||'';this[_0xde92('0x1')]=_0x503d92['username']||'';this[_0xde92('0x2')]=_0x503d92['password']||'';this['remoteUri']=_0x503d92[_0xde92('0x3')]||'';this[_0xde92('0x4')]=_0x503d92[_0xde92('0x4')]||'';this[_0xde92('0x5')]=_0x503d92[_0xde92('0x5')]||'';this[_0xde92('0x6')]=_0x503d92[_0xde92('0x6')]||{};this[_0xde92('0x7')]=_0x503d92[_0xde92('0x7')]||'';this[_0xde92('0x8')]=_0x503d92[_0xde92('0x8')]||![];this[_0xde92('0x9')]=_0x503d92['Configurations']||{};this[_0xde92('0xa')]=_0x503d92[_0xde92('0xa')]||{};}module[_0xde92('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xe620=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x20f0f0,_0x4c5094){var _0x415dd3=function(_0x2a91fb){while(--_0x2a91fb){_0x20f0f0['push'](_0x20f0f0['shift']());}};_0x415dd3(++_0x4c5094);}(_0xe620,0x123));var _0x0e62=function(_0x465661,_0x150fd5){_0x465661=_0x465661-0x0;var _0x316de9=_0xe620[_0x465661];return _0x316de9;};'use strict';function Dynamics365Account(_0x4e6042){this['id']=_0x4e6042['id']||0x0;this['name']=_0x4e6042[_0x0e62('0x0')]||'';this['username']=_0x4e6042[_0x0e62('0x1')]||'';this[_0x0e62('0x2')]=_0x4e6042[_0x0e62('0x2')]||'';this[_0x0e62('0x3')]=_0x4e6042[_0x0e62('0x3')]||'';this[_0x0e62('0x4')]=_0x4e6042['tenantId']||'';this[_0x0e62('0x5')]=_0x4e6042[_0x0e62('0x5')]||'';this['clientSecret']=_0x4e6042['clientSecret']||{};this[_0x0e62('0x6')]=_0x4e6042['serverUrl']||'';this[_0x0e62('0x7')]=_0x4e6042[_0x0e62('0x7')]||![];this[_0x0e62('0x8')]=_0x4e6042[_0x0e62('0x8')]||{};this[_0x0e62('0x9')]=_0x4e6042[_0x0e62('0x9')]||{};}module[_0x0e62('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 642e074..d9dcc1a 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 _0x07a0=['headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','description','ecm'];(function(_0x4d6015,_0x4cb603){var _0x1180fb=function(_0xc4ce79){while(--_0xc4ce79){_0x4d6015['push'](_0x4d6015['shift']());}};_0x1180fb(++_0x4cb603);}(_0x07a0,0xfd));var _0x007a=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x07a0[_0x2e9b5b];return _0x734c46;};'use strict';function FaxAccount(_0x52bc04){this['id']=_0x52bc04['id']||0x0;this['name']=_0x52bc04['name']||'';this['description']=_0x52bc04[_0x007a('0x0')];this[_0x007a('0x1')]=_0x52bc04[_0x007a('0x1')];this[_0x007a('0x2')]=_0x52bc04[_0x007a('0x2')];this[_0x007a('0x3')]=_0x52bc04[_0x007a('0x3')];this[_0x007a('0x4')]=_0x52bc04[_0x007a('0x4')]||0x960;this[_0x007a('0x5')]=_0x52bc04['maxrate']||0x3840;this[_0x007a('0x6')]=_0x52bc04['modem']||'v17,v27,v29';this[_0x007a('0x7')]=_0x52bc04[_0x007a('0x7')]||'no';this[_0x007a('0x8')]=_0x52bc04[_0x007a('0x8')]||'no';this[_0x007a('0x9')]=_0x52bc04[_0x007a('0x9')]||0x1388;this['tech']=_0x52bc04['tech']||_0x007a('0xa');this[_0x007a('0xb')]=_0x52bc04['Trunk']?_0x52bc04[_0x007a('0xb')]:undefined;this[_0x007a('0xc')]=_0x52bc04[_0x007a('0xc')];this[_0x007a('0xd')]=_0x52bc04[_0x007a('0xd')];}module[_0x007a('0xe')]=FaxAccount; \ No newline at end of file +var _0xaf21=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','SIP','Trunk','ListId','key'];(function(_0x2ed2a1,_0x2c269e){var _0x3003b4=function(_0x8676fd){while(--_0x8676fd){_0x2ed2a1['push'](_0x2ed2a1['shift']());}};_0x3003b4(++_0x2c269e);}(_0xaf21,0x151));var _0x1af2=function(_0x29f777,_0x253e62){_0x29f777=_0x29f777-0x0;var _0x4e0b1c=_0xaf21[_0x29f777];return _0x4e0b1c;};'use strict';function FaxAccount(_0x4dcacf){this['id']=_0x4dcacf['id']||0x0;this[_0x1af2('0x0')]=_0x4dcacf[_0x1af2('0x0')]||'';this['description']=_0x4dcacf[_0x1af2('0x1')];this[_0x1af2('0x2')]=_0x4dcacf[_0x1af2('0x2')];this[_0x1af2('0x3')]=_0x4dcacf[_0x1af2('0x3')];this[_0x1af2('0x4')]=_0x4dcacf[_0x1af2('0x4')];this[_0x1af2('0x5')]=_0x4dcacf['minrate']||0x960;this['maxrate']=_0x4dcacf[_0x1af2('0x6')]||0x3840;this[_0x1af2('0x7')]=_0x4dcacf[_0x1af2('0x7')]||_0x1af2('0x8');this['gateway']=_0x4dcacf['gateway']||'no';this[_0x1af2('0x9')]=_0x4dcacf['faxdetect']||'no';this[_0x1af2('0xa')]=_0x4dcacf['t38timeout']||0x1388;this['tech']=_0x4dcacf['tech']||_0x1af2('0xb');this[_0x1af2('0xc')]=_0x4dcacf[_0x1af2('0xc')]?_0x4dcacf['Trunk']:undefined;this[_0x1af2('0xd')]=_0x4dcacf[_0x1af2('0xd')];this['key']=_0x4dcacf[_0x1af2('0xe')];}module[_0x1af2('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 8c58e1e..818e673 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 _0x4897=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x49a814,_0x20d1dd){var _0x5b71e3=function(_0x3fb8fd){while(--_0x3fb8fd){_0x49a814['push'](_0x49a814['shift']());}};_0x5b71e3(++_0x20d1dd);}(_0x4897,0x1a9));var _0x7489=function(_0x4ff8b7,_0x437988){_0x4ff8b7=_0x4ff8b7-0x0;var _0xa85c40=_0x4897[_0x4ff8b7];return _0xa85c40;};'use strict';function FreshdeskAccount(_0x4c804f){this['id']=_0x4c804f['id']||0x0;this[_0x7489('0x0')]=_0x4c804f[_0x7489('0x0')]||'';this[_0x7489('0x1')]=_0x4c804f['username']||'';this[_0x7489('0x2')]=_0x4c804f[_0x7489('0x3')]||'';this[_0x7489('0x4')]=_0x4c804f['remoteUri']||'';this['serverUrl']=_0x4c804f[_0x7489('0x5')]||'';this[_0x7489('0x6')]=_0x4c804f['Configurations']||{};}module[_0x7489('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xaa84=['serverUrl','exports','name','username','apiKey','token','remoteUri'];(function(_0x335391,_0x1984f8){var _0x4fadee=function(_0x5930cd){while(--_0x5930cd){_0x335391['push'](_0x335391['shift']());}};_0x4fadee(++_0x1984f8);}(_0xaa84,0x1ec));var _0x4aa8=function(_0x1e229c,_0x206d5f){_0x1e229c=_0x1e229c-0x0;var _0x2e9c92=_0xaa84[_0x1e229c];return _0x2e9c92;};'use strict';function FreshdeskAccount(_0xe0a69a){this['id']=_0xe0a69a['id']||0x0;this[_0x4aa8('0x0')]=_0xe0a69a[_0x4aa8('0x0')]||'';this[_0x4aa8('0x1')]=_0xe0a69a['username']||'';this[_0x4aa8('0x2')]=_0xe0a69a[_0x4aa8('0x3')]||'';this[_0x4aa8('0x4')]=_0xe0a69a[_0x4aa8('0x4')]||'';this['serverUrl']=_0xe0a69a[_0x4aa8('0x5')]||'';this['Configurations']=_0xe0a69a['Configurations']||{};}module[_0x4aa8('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 2e95c04..247140d 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 _0x374c=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x58862d,_0x5df471){var _0x322bcc=function(_0x4bcb14){while(--_0x4bcb14){_0x58862d['push'](_0x58862d['shift']());}};_0x322bcc(++_0x5df471);}(_0x374c,0x1e3));var _0xc374=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x374c[_0x502c7d];return _0x30b7ed;};'use strict';function FreshsalesAccount(_0x18a19e){this['id']=_0x18a19e['id']||0x0;this[_0xc374('0x0')]=_0x18a19e[_0xc374('0x0')]||'';this[_0xc374('0x1')]=_0x18a19e[_0xc374('0x1')]||'';this[_0xc374('0x2')]=_0x18a19e['token']||'';this[_0xc374('0x3')]=_0x18a19e['remoteUri']||'';this[_0xc374('0x4')]=_0x18a19e[_0xc374('0x4')]||'';this['Configurations']=_0x18a19e[_0xc374('0x5')]||{};}module[_0xc374('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xfd7b=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x12cbe4,_0x1b3529){var _0x48ee42=function(_0x2f16c2){while(--_0x2f16c2){_0x12cbe4['push'](_0x12cbe4['shift']());}};_0x48ee42(++_0x1b3529);}(_0xfd7b,0x1df));var _0xbfd7=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xfd7b[_0xabfec4];return _0x7bafa2;};'use strict';function FreshsalesAccount(_0x3cf772){this['id']=_0x3cf772['id']||0x0;this[_0xbfd7('0x0')]=_0x3cf772[_0xbfd7('0x0')]||'';this[_0xbfd7('0x1')]=_0x3cf772[_0xbfd7('0x1')]||'';this[_0xbfd7('0x2')]=_0x3cf772[_0xbfd7('0x3')]||'';this[_0xbfd7('0x4')]=_0x3cf772[_0xbfd7('0x4')]||'';this[_0xbfd7('0x5')]=_0x3cf772[_0xbfd7('0x5')]||'';this[_0xbfd7('0x6')]=_0x3cf772[_0xbfd7('0x6')]||{};}module[_0xbfd7('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 d8d7918..b8694fa 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 _0x02dc=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','variables','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon'];(function(_0x1a36d1,_0x306adc){var _0x143752=function(_0x10258f){while(--_0x10258f){_0x1a36d1['push'](_0x1a36d1['shift']());}};_0x143752(++_0x306adc);}(_0x02dc,0x1dd));var _0xc02d=function(_0x396048,_0x5f428c){_0x396048=_0x396048-0x0;var _0x9240e8=_0x02dc[_0x396048];return _0x9240e8;};'use strict';function QueueReport(){this['type']=_0xc02d('0x0');this[_0xc02d('0x1')]='';this[_0xc02d('0x2')]='';this[_0xc02d('0x3')]='';this[_0xc02d('0x4')]='';this['queuecallerjoinAt']=null;this[_0xc02d('0x5')]=null;this[_0xc02d('0x6')]=0x1;this[_0xc02d('0x7')]=0x1;this[_0xc02d('0x8')]=![];this[_0xc02d('0x9')]=null;this[_0xc02d('0xa')]=![];this[_0xc02d('0xb')]=null;this[_0xc02d('0xc')]=![];this[_0xc02d('0xd')]=null;this[_0xc02d('0xe')]=0x1;this['channel']='';this[_0xc02d('0xf')]='';this[_0xc02d('0x10')]='';this[_0xc02d('0x11')]='';this[_0xc02d('0x12')]='';this[_0xc02d('0x13')]='';this[_0xc02d('0x14')]='';this[_0xc02d('0x15')]=0x0;this[_0xc02d('0x16')]=![];this[_0xc02d('0x17')]='';this[_0xc02d('0x18')]='voice';this['routealias']=null;this[_0xc02d('0x19')]=0x0;this[_0xc02d('0x1a')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xcfea=['holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','type','inbound','calleridname','queue','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority'];(function(_0x4a4437,_0x36702a){var _0x4eb03c=function(_0x3a4e6b){while(--_0x3a4e6b){_0x4a4437['push'](_0x4a4437['shift']());}};_0x4eb03c(++_0x36702a);}(_0xcfea,0x18d));var _0xacfe=function(_0x236456,_0x105aa9){_0x236456=_0x236456-0x0;var _0x4c2031=_0xcfea[_0x236456];return _0x4c2031;};'use strict';function QueueReport(){this[_0xacfe('0x0')]=_0xacfe('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xacfe('0x2')]='';this[_0xacfe('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xacfe('0x4')]=0x1;this[_0xacfe('0x5')]=![];this[_0xacfe('0x6')]=null;this[_0xacfe('0x7')]=![];this['queuecallercompleteAt']=null;this[_0xacfe('0x8')]=![];this[_0xacfe('0x9')]=null;this['originalposition']=0x1;this[_0xacfe('0xa')]='';this[_0xacfe('0xb')]='';this[_0xacfe('0xc')]='';this[_0xacfe('0xd')]='';this[_0xacfe('0xe')]='';this[_0xacfe('0xf')]='';this[_0xacfe('0x10')]='';this[_0xacfe('0x11')]=0x0;this[_0xacfe('0x12')]=![];this[_0xacfe('0x13')]='';this[_0xacfe('0x14')]=_0xacfe('0x15');this['routealias']=null;this[_0xacfe('0x16')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 49db93f..e6b2bce 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 _0x896e=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x133078,_0x337ba5){var _0x3aafd1=function(_0x320aa4){while(--_0x320aa4){_0x133078['push'](_0x133078['shift']());}};_0x3aafd1(++_0x337ba5);}(_0x896e,0x1e9));var _0xe896=function(_0x2a4392,_0x55be14){_0x2a4392=_0x2a4392-0x0;var _0x561995=_0x896e[_0x2a4392];return _0x561995;};'use strict';function SalesforceAccount(_0xc62635){this['id']=_0xc62635['id']||0x0;this[_0xe896('0x0')]=_0xc62635[_0xe896('0x0')]||'';this[_0xe896('0x1')]=_0xc62635[_0xe896('0x1')]||'';this[_0xe896('0x2')]=_0xc62635[_0xe896('0x2')]||'';this[_0xe896('0x3')]=_0xc62635[_0xe896('0x3')]||'';this[_0xe896('0x4')]=_0xc62635[_0xe896('0x4')]||'';this[_0xe896('0x5')]=_0xc62635['clientSecret']||'';this[_0xe896('0x6')]=_0xc62635[_0xe896('0x6')]||'';this[_0xe896('0x7')]=_0xc62635[_0xe896('0x7')]||_0xe896('0x8');this['serverUrl']=_0xc62635[_0xe896('0x9')]||'';this[_0xe896('0xa')]=_0xc62635[_0xe896('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x9a66=['integrationTab','serverUrl','Configurations','exports','name','remoteUri','password','clientId','securityToken','type'];(function(_0x1109eb,_0x68f359){var _0x120d4e=function(_0x570cff){while(--_0x570cff){_0x1109eb['push'](_0x1109eb['shift']());}};_0x120d4e(++_0x68f359);}(_0x9a66,0xae));var _0x69a6=function(_0x384375,_0x39b439){_0x384375=_0x384375-0x0;var _0xd77e26=_0x9a66[_0x384375];return _0xd77e26;};'use strict';function SalesforceAccount(_0x11cc21){this['id']=_0x11cc21['id']||0x0;this[_0x69a6('0x0')]=_0x11cc21[_0x69a6('0x0')]||'';this['username']=_0x11cc21['username']||'';this[_0x69a6('0x1')]=_0x11cc21['remoteUri']||'';this[_0x69a6('0x2')]=_0x11cc21['password']||'';this['clientId']=_0x11cc21[_0x69a6('0x3')]||'';this['clientSecret']=_0x11cc21['clientSecret']||'';this[_0x69a6('0x4')]=_0x11cc21['securityToken']||'';this[_0x69a6('0x5')]=_0x11cc21[_0x69a6('0x5')]||_0x69a6('0x6');this[_0x69a6('0x7')]=_0x11cc21['serverUrl']||'';this[_0x69a6('0x8')]=_0x11cc21[_0x69a6('0x8')]||{};}module[_0x69a6('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fa6f631..8112699 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 _0xe367=['name','password','remoteUri','serverUrl','Configurations'];(function(_0x287234,_0x4b9e28){var _0x4bfc27=function(_0x2089b5){while(--_0x2089b5){_0x287234['push'](_0x287234['shift']());}};_0x4bfc27(++_0x4b9e28);}(_0xe367,0x1e5));var _0x7e36=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xe367[_0x29d94e];return _0x106237;};'use strict';function ServicenowAccount(_0x3e1c07){this['id']=_0x3e1c07['id']||0x0;this['name']=_0x3e1c07[_0x7e36('0x0')]||'';this['username']=_0x3e1c07['username']||'';this[_0x7e36('0x1')]=_0x3e1c07[_0x7e36('0x1')]||'';this[_0x7e36('0x2')]=_0x3e1c07[_0x7e36('0x2')]||'';this[_0x7e36('0x3')]=_0x3e1c07[_0x7e36('0x3')]||'';this[_0x7e36('0x4')]=_0x3e1c07[_0x7e36('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x108f=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x108f,0x13d));var _0xf108=function(_0x2ef3f7,_0x54062e){_0x2ef3f7=_0x2ef3f7-0x0;var _0x27326e=_0x108f[_0x2ef3f7];return _0x27326e;};'use strict';function ServicenowAccount(_0x36128f){this['id']=_0x36128f['id']||0x0;this[_0xf108('0x0')]=_0x36128f[_0xf108('0x0')]||'';this[_0xf108('0x1')]=_0x36128f[_0xf108('0x1')]||'';this[_0xf108('0x2')]=_0x36128f['password']||'';this[_0xf108('0x3')]=_0x36128f[_0xf108('0x3')]||'';this[_0xf108('0x4')]=_0x36128f['serverUrl']||'';this[_0xf108('0x5')]=_0x36128f[_0xf108('0x5')]||{};}module[_0xf108('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 90fac85..454e078 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 _0x6a96=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x120c03,_0x1a8eab){var _0x2f04a8=function(_0x4685c9){while(--_0x4685c9){_0x120c03['push'](_0x120c03['shift']());}};_0x2f04a8(++_0x1a8eab);}(_0x6a96,0x77));var _0x66a9=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x6a96[_0xed9fea];return _0x198f12;};'use strict';function SugarcrmAccount(_0x2ba336){this['id']=_0x2ba336['id']||0x0;this[_0x66a9('0x0')]=_0x2ba336[_0x66a9('0x0')]||'';this[_0x66a9('0x1')]=_0x2ba336[_0x66a9('0x1')]||'';this[_0x66a9('0x2')]=_0x2ba336[_0x66a9('0x2')]||'';this[_0x66a9('0x3')]=_0x2ba336[_0x66a9('0x3')]||'';this[_0x66a9('0x4')]=_0x2ba336['serverUrl']||'';this[_0x66a9('0x5')]=_0x2ba336['Configurations']||{};}module[_0x66a9('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x75b8=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3910a8,_0x11cc48){var _0x34acb4=function(_0x4e89dd){while(--_0x4e89dd){_0x3910a8['push'](_0x3910a8['shift']());}};_0x34acb4(++_0x11cc48);}(_0x75b8,0x198));var _0x875b=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x75b8[_0x21af3a];return _0x268a49;};'use strict';function SugarcrmAccount(_0x4b60fd){this['id']=_0x4b60fd['id']||0x0;this[_0x875b('0x0')]=_0x4b60fd[_0x875b('0x0')]||'';this[_0x875b('0x1')]=_0x4b60fd[_0x875b('0x1')]||'';this[_0x875b('0x2')]=_0x4b60fd[_0x875b('0x2')]||'';this[_0x875b('0x3')]=_0x4b60fd[_0x875b('0x3')]||'';this[_0x875b('0x4')]=_0x4b60fd[_0x875b('0x4')]||'';this['Configurations']=_0x4b60fd[_0x875b('0x5')]||{};}module[_0x875b('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 843805b..a49d20a 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 _0x28a3=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x50bff8,_0x2a417f){var _0x56626a=function(_0x256e4c){while(--_0x256e4c){_0x50bff8['push'](_0x50bff8['shift']());}};_0x56626a(++_0x2a417f);}(_0x28a3,0x79));var _0x328a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x28a3[_0x42cae2];return _0x5f256f;};'use strict';function Telephone(_0x5bf432){this['id']=_0x5bf432['id']||0x0;this[_0x328a('0x0')]=_0x5bf432[_0x328a('0x0')]||'';this[_0x328a('0x1')]=_0x5bf432[_0x328a('0x1')]||'';this[_0x328a('0x2')]=_0x328a('0x3');this[_0x328a('0x4')]=0x0;this[_0x328a('0x5')]=_0x328a('0x3');this[_0x328a('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x804e=['stateTime','status','unknown','address','exports','name','accountcode'];(function(_0x555be6,_0x3da896){var _0x3f365e=function(_0x48d8d){while(--_0x48d8d){_0x555be6['push'](_0x555be6['shift']());}};_0x3f365e(++_0x3da896);}(_0x804e,0x6e));var _0xe804=function(_0x10d697,_0x45d5f1){_0x10d697=_0x10d697-0x0;var _0x2c8400=_0x804e[_0x10d697];return _0x2c8400;};'use strict';function Telephone(_0x2d8772){this['id']=_0x2d8772['id']||0x0;this[_0xe804('0x0')]=_0x2d8772['name']||'';this[_0xe804('0x1')]=_0x2d8772[_0xe804('0x1')]||'';this['state']='unknown';this[_0xe804('0x2')]=0x0;this[_0xe804('0x3')]=_0xe804('0x4');this[_0xe804('0x5')]='';}module[_0xe804('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 69e5712..78937de 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(_0x352d84,_0x1543e0){var _0xcf3e=function(_0x13845e){while(--_0x13845e){_0x352d84['push'](_0x352d84['shift']());}};_0xcf3e(++_0x1543e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x35eede,_0x27e4df){var _0x3a123a=function(_0x37201a){while(--_0x37201a){_0x35eede['push'](_0x35eede['shift']());}};_0x3a123a(++_0x27e4df);}(_0xb10b,0x12a));var _0xbb10=function(_0x187f4b,_0x12fd52){_0x187f4b=_0x187f4b-0x0;var _0x132087=_0xb10b[_0x187f4b];return _0x132087;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5cdb7fd..bc22831 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(_0x566133,_0x123ab4){var _0x540c58=function(_0x27d9dc){while(--_0x27d9dc){_0x566133['push'](_0x566133['shift']());}};_0x540c58(++_0x123ab4);}(_0xda2d,0x102));var _0xdda2=function(_0x571c14,_0x5dea02){_0x571c14=_0x571c14-0x0;var _0x3f6887=_0xda2d[_0x571c14];return _0x3f6887;};'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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x405b9a,_0x52a69b){var _0x43074f=function(_0x54567a){while(--_0x54567a){_0x405b9a['push'](_0x405b9a['shift']());}};_0x43074f(++_0x52a69b);}(_0xb10b,0x12a));var _0xbb10=function(_0x403112,_0x2c1dc3){_0x403112=_0x403112-0x0;var _0x91f216=_0xb10b[_0x403112];return _0x91f216;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 070020b..b48210a 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 _0x7ece=['indexOf','host','domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x7ece,0x109));var _0xe7ec=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7ece[_0x465a0c];return _0x1e202e;};'use strict';function Trunk(_0x451d94){this['id']=_0x451d94['id']||0x0;this[_0xe7ec('0x0')]=_0x451d94[_0xe7ec('0x0')]||![];this[_0xe7ec('0x1')]=_0x451d94[_0xe7ec('0x1')]||'';this[_0xe7ec('0x2')]=_0xe7ec('0x3');this[_0xe7ec('0x4')]=0x0;this[_0xe7ec('0x5')]='unknown';this[_0xe7ec('0x6')]=_0x451d94[_0xe7ec('0x6')]&&_0x451d94[_0xe7ec('0x6')][_0xe7ec('0x7')](':')?_0x451d94[_0xe7ec('0x6')]['split'](':')[0x0]:'';this[_0xe7ec('0x8')]='';this['port']='';this[_0xe7ec('0x9')]='';this['domainport']='';this[_0xe7ec('0xa')]='';this[_0xe7ec('0xb')]='unknown';this[_0xe7ec('0xc')]='';this[_0xe7ec('0xd')]='';this[_0xe7ec('0xe')]=_0x451d94['defaultuser']||'';}module[_0xe7ec('0xf')]=Trunk; \ No newline at end of file +var _0x23eb=['domain','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','status','registry','split','host'];(function(_0x302550,_0x1c385){var _0x4f7261=function(_0x494f70){while(--_0x494f70){_0x302550['push'](_0x302550['shift']());}};_0x4f7261(++_0x1c385);}(_0x23eb,0xfd));var _0xb23e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23eb[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x41ca9d){this['id']=_0x41ca9d['id']||0x0;this[_0xb23e('0x0')]=_0x41ca9d[_0xb23e('0x0')]||![];this[_0xb23e('0x1')]=_0x41ca9d[_0xb23e('0x1')]||'';this[_0xb23e('0x2')]='unknown';this['stateTime']=0x0;this[_0xb23e('0x3')]='unknown';this[_0xb23e('0x4')]=_0x41ca9d[_0xb23e('0x4')]&&_0x41ca9d[_0xb23e('0x4')]['indexOf'](':')?_0x41ca9d[_0xb23e('0x4')][_0xb23e('0x5')](':')[0x0]:'';this[_0xb23e('0x6')]='';this['port']='';this[_0xb23e('0x7')]='';this[_0xb23e('0x8')]='';this['refresh']='';this[_0xb23e('0x9')]='unknown';this[_0xb23e('0xa')]='';this[_0xb23e('0xb')]='';this['defaultuser']=_0x41ca9d[_0xb23e('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 30d154b..b9e1087 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 _0x09ff=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x6e0fca,_0x23cb98){var _0x3f3c35=function(_0x2e6b52){while(--_0x2e6b52){_0x6e0fca['push'](_0x6e0fca['shift']());}};_0x3f3c35(++_0x23cb98);}(_0x09ff,0x107));var _0xf09f=function(_0x1983d5,_0x46da60){_0x1983d5=_0x1983d5-0x0;var _0x593f8b=_0x09ff[_0x1983d5];return _0x593f8b;};'use strict';function voiceExtension(_0x1dced8){this['id']=_0x1dced8['id']||0x0;this['exten']=_0x1dced8[_0xf09f('0x0')]||'';this[_0xf09f('0x1')]=_0x1dced8[_0xf09f('0x1')]||_0xf09f('0x2');this[_0xf09f('0x3')]=_0x1dced8[_0xf09f('0x3')]||![];}module[_0xf09f('0x4')]=voiceExtension; \ No newline at end of file +var _0x9dee=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x465666,_0x293684){var _0x323f24=function(_0x1bb7c2){while(--_0x1bb7c2){_0x465666['push'](_0x465666['shift']());}};_0x323f24(++_0x293684);}(_0x9dee,0x98));var _0xe9de=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x9dee[_0x34bc6c];return _0x168820;};'use strict';function voiceExtension(_0x50c7b7){this['id']=_0x50c7b7['id']||0x0;this['exten']=_0x50c7b7[_0xe9de('0x0')]||'';this[_0xe9de('0x1')]=_0x50c7b7['recordingFormat']||'none';this[_0xe9de('0x2')]=_0x50c7b7[_0xe9de('0x2')]||![];}module[_0xe9de('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1b9ad66..fd2704d 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 _0x174d=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startProgressive','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','gsm','fewestcalls','leastrecent','random','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x332d11,_0x1a2cc3){var _0x25418c=function(_0x52b970){while(--_0x52b970){_0x332d11['push'](_0x332d11['shift']());}};_0x25418c(++_0x1a2cc3);}(_0x174d,0x1ca));var _0xd174=function(_0x4723d1,_0x515d2e){_0x4723d1=_0x4723d1-0x0;var _0x335b7f=_0x174d[_0x4723d1];return _0x335b7f;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0xd174('0x0')};var strategy={'fewestcalls':_0xd174('0x1'),'leastrecent':_0xd174('0x2'),'linear':'linear','random':_0xd174('0x3'),'ringall':'ringall','rr':_0xd174('0x4'),'rrmemory':'rrmemory','rrordered':_0xd174('0x5'),'wrandom':_0xd174('0x6')};function VoiceQueue(_0x35ae3f){this['id']=_0x35ae3f['id']||0x0;this['name']=_0x35ae3f[_0xd174('0x7')]||'';this[_0xd174('0x8')]=_0x35ae3f[_0xd174('0x8')]||'';this['type']=_0x35ae3f[_0xd174('0x9')]||_0xd174('0xa');this['waiting']=0x0;this[_0xd174('0xb')]=0x0;this[_0xd174('0xc')]=0x0;this[_0xd174('0xd')]=0x0;this[_0xd174('0xe')]=0x0;this[_0xd174('0xf')]=0x0;this[_0xd174('0x10')]=0x0;this[_0xd174('0x11')]=0x0;this[_0xd174('0x12')]=0x0;this[_0xd174('0x13')]=0x0;this[_0xd174('0x14')]=0x0;this[_0xd174('0x15')]=0x0;this[_0xd174('0x16')]=0x0;this[_0xd174('0x17')]=0x0;this[_0xd174('0x18')]=0x0;this[_0xd174('0x19')]=0x0;this[_0xd174('0x1a')]=0x0;this[_0xd174('0x1b')]=0x0;this[_0xd174('0x1c')]=0x0;this[_0xd174('0x1d')]=0x0;this['unknown']=0x0;this[_0xd174('0x1e')]=_0x35ae3f['acw']||![];this[_0xd174('0x1f')]=_0x35ae3f[_0xd174('0x1f')]||0xa;this['autopause']=_0x35ae3f['autopause']||'no';this[_0xd174('0x20')]=!![];this[_0xd174('0x21')]='';this[_0xd174('0x22')]='';this[_0xd174('0x23')]=0x0;this[_0xd174('0x24')]=0x0;this[_0xd174('0x25')]=_0x35ae3f['dialTimezone']||null;this[_0xd174('0x26')]=_0x35ae3f[_0xd174('0x26')]?_0x35ae3f['dialGlobalInterval']:null;this[_0xd174('0x27')]=_0x35ae3f[_0xd174('0x27')];this[_0xd174('0x28')]=_0x35ae3f[_0xd174('0x28')]||_0xd174('0x29');this[_0xd174('0x2a')]=_0x35ae3f['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x35ae3f[_0xd174('0x2b')]||0x0;this[_0xd174('0x2c')]=_0x35ae3f['dialPowerLevel']||0x1;this[_0xd174('0x2d')]=_0x35ae3f[_0xd174('0x2d')]||_0xd174('0x2e');this[_0xd174('0x2f')]=_0x35ae3f[_0xd174('0x2f')]||0.03;this[_0xd174('0x30')]=_0x35ae3f[_0xd174('0x30')]||0x258;this['dialOriginateCallerIdName']=_0x35ae3f[_0xd174('0x31')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x35ae3f[_0xd174('0x32')]||_0xd174('0x33');this[_0xd174('0x34')]=_0x35ae3f[_0xd174('0x34')]||0x1e;this['dialQueueOptions']=_0x35ae3f[_0xd174('0x35')]||_0xd174('0x36');this[_0xd174('0x37')]=_0x35ae3f[_0xd174('0x37')]||0x3;this['dialQueueProject']=_0x35ae3f['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x35ae3f['dialCongestionMaxRetry']||0x3;this[_0xd174('0x38')]=_0x35ae3f[_0xd174('0x38')]||0x96;this[_0xd174('0x39')]=_0x35ae3f[_0xd174('0x39')]||0x3;this[_0xd174('0x3a')]=_0x35ae3f['dialBusyRetryFrequency']||0x96;this[_0xd174('0x3b')]=_0x35ae3f[_0xd174('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x35ae3f[_0xd174('0x3c')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x35ae3f[_0xd174('0x3d')]||0x3;this[_0xd174('0x3e')]=_0x35ae3f[_0xd174('0x3e')]||0x96;this[_0xd174('0x3f')]=_0x35ae3f[_0xd174('0x3f')]||0x3;this[_0xd174('0x40')]=_0x35ae3f[_0xd174('0x40')]||0x96;this[_0xd174('0x41')]=_0x35ae3f['dialAbandonedMaxRetry']||0x3;this[_0xd174('0x42')]=_0x35ae3f['dialAbandonedRetryFrequency']||0x96;this[_0xd174('0x43')]=_0x35ae3f[_0xd174('0x43')]||0x3;this['dialMachineRetryFrequency']=_0x35ae3f[_0xd174('0x44')]||0x96;this[_0xd174('0x45')]=_0x35ae3f[_0xd174('0x45')]||0x3;this[_0xd174('0x46')]=_0x35ae3f[_0xd174('0x46')]||0x96;this[_0xd174('0x47')]=_0x35ae3f['callAdditionalPhoneAfterMin']||0x3;this[_0xd174('0x48')]=_0x35ae3f['dialGlobalMaxRetry']||0x4;this[_0xd174('0x49')]=_0x35ae3f[_0xd174('0x49')]?_0x35ae3f[_0xd174('0x49')]:undefined;this[_0xd174('0x4a')]=_0x35ae3f[_0xd174('0x4a')]?_0x35ae3f['TrunkBackup']:undefined;this['dialPrefix']=_0x35ae3f[_0xd174('0x4b')]||undefined;this['Interval']=_0x35ae3f[_0xd174('0x4c')]?_0x35ae3f[_0xd174('0x4c')]:undefined;this[_0xd174('0x4d')]=_0x35ae3f['dialOrderByScheduledAt']||_0xd174('0x4e');this[_0xd174('0x4f')]=_0x35ae3f[_0xd174('0x4f')]||undefined;this[_0xd174('0x50')]=_0x35ae3f['dialCutDigit']||undefined;this[_0xd174('0x51')]=strategy[_0x35ae3f['strategy']];this[_0xd174('0x52')]=!![];this[_0xd174('0x53')]=_0x35ae3f[_0xd174('0x53')]||![];this['dialAMDInitialSilence']=_0x35ae3f[_0xd174('0x54')];this[_0xd174('0x55')]=_0x35ae3f[_0xd174('0x55')];this[_0xd174('0x56')]=_0x35ae3f[_0xd174('0x56')];this[_0xd174('0x57')]=_0x35ae3f['dialAMDTotalAnalysisTime'];this[_0xd174('0x58')]=_0x35ae3f[_0xd174('0x58')];this[_0xd174('0x59')]=_0x35ae3f[_0xd174('0x59')];this[_0xd174('0x5a')]=_0x35ae3f['dialAMDMaximumNumberOfWords'];this[_0xd174('0x5b')]=_0x35ae3f[_0xd174('0x5b')];this[_0xd174('0x5c')]=_0x35ae3f[_0xd174('0x5c')];this[_0xd174('0x5d')]=0x0;this[_0xd174('0x5e')]=0x0;this[_0xd174('0x5f')]=_0x35ae3f[_0xd174('0x5f')];this[_0xd174('0x60')]=0x0;this[_0xd174('0x61')]=0x0;this[_0xd174('0x62')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xd174('0x63')]=0x0;this[_0xd174('0x64')]=0x0;this[_0xd174('0x65')]=0x0;this[_0xd174('0x66')]=0x0;this[_0xd174('0x67')]=0x0;this[_0xd174('0x68')]=0x0;this[_0xd174('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0xd174('0x6a')]=undefined;this[_0xd174('0x6b')]=undefined;this[_0xd174('0x6c')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xd174('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xd174('0x6e')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xd174('0x6f')]=0x0;this[_0xd174('0x70')]=0x0;this[_0xd174('0x71')]=0x0;this[_0xd174('0x72')]=_0x35ae3f[_0xd174('0x73')]||0x14;this[_0xd174('0x74')]=_0x35ae3f[_0xd174('0x73')]||0xa;this[_0xd174('0x75')]=0x0;this[_0xd174('0x76')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xd174('0x77')]=0x0;this[_0xd174('0x78')]=0x0;this[_0xd174('0x79')]=0x0;this[_0xd174('0x7a')]=0x0;this['dialRecallMeTimeout']=_0x35ae3f[_0xd174('0x7b')]||0x1e;this[_0xd174('0x7c')]=_0x35ae3f['dialRecallInQueue']||![];this[_0xd174('0x7d')]=!!_0x35ae3f[_0xd174('0x7d')]||![];this[_0xd174('0x7e')]=!!_0x35ae3f[_0xd174('0x7e')]||![];this[_0xd174('0x7f')]=_0x35ae3f[_0xd174('0x7f')]||undefined;this[_0xd174('0x80')]=_0x35ae3f[_0xd174('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x35ae3f[_0xd174('0x81')]||![];this['monitor_format']=monitorFormat[_0x35ae3f[_0xd174('0x8')]]?monitorFormat[_0x35ae3f[_0xd174('0x8')]]:undefined;this[_0xd174('0x82')]=_0x35ae3f['mandatoryDisposition']||![];this[_0xd174('0x83')]=_0x35ae3f['mandatoryDispositionPause']?_0x35ae3f[_0xd174('0x83')]:undefined;this[_0xd174('0x84')]=![];}module[_0xd174('0x85')]=VoiceQueue; \ No newline at end of file +var _0x8910=['dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x8910,0x1ef));var _0x0891=function(_0x3e5ba5,_0x28e9cd){_0x3e5ba5=_0x3e5ba5-0x0;var _0x4ab4d8=_0x8910[_0x3e5ba5];return _0x4ab4d8;};'use strict';var monitorFormat={'wav':_0x0891('0x0'),'wav49':_0x0891('0x1'),'gsm':_0x0891('0x2')};var strategy={'fewestcalls':_0x0891('0x3'),'leastrecent':'leastrecent','linear':_0x0891('0x4'),'random':_0x0891('0x5'),'ringall':_0x0891('0x6'),'rr':_0x0891('0x7'),'rrmemory':_0x0891('0x8'),'rrordered':_0x0891('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x2499ed){this['id']=_0x2499ed['id']||0x0;this['name']=_0x2499ed['name']||'';this[_0x0891('0xa')]=_0x2499ed['monitor_format']||'';this[_0x0891('0xb')]=_0x2499ed[_0x0891('0xb')]||_0x0891('0xc');this[_0x0891('0xd')]=0x0;this[_0x0891('0xe')]=0x0;this[_0x0891('0xf')]=0x0;this[_0x0891('0x10')]=0x0;this[_0x0891('0x11')]=0x0;this[_0x0891('0x12')]=0x0;this[_0x0891('0x13')]=0x0;this[_0x0891('0x14')]=0x0;this[_0x0891('0x15')]=0x0;this[_0x0891('0x16')]=0x0;this[_0x0891('0x17')]=0x0;this['invalid']=0x0;this[_0x0891('0x18')]=0x0;this[_0x0891('0x19')]=0x0;this[_0x0891('0x1a')]=0x0;this[_0x0891('0x1b')]=0x0;this[_0x0891('0x1c')]=0x0;this[_0x0891('0x1d')]=0x0;this[_0x0891('0x1e')]=0x0;this[_0x0891('0x1f')]=0x0;this[_0x0891('0x20')]=0x0;this[_0x0891('0x21')]=_0x2499ed[_0x0891('0x21')]||![];this[_0x0891('0x22')]=_0x2499ed[_0x0891('0x22')]||0xa;this[_0x0891('0x23')]=_0x2499ed[_0x0891('0x23')]||'no';this[_0x0891('0x24')]=!![];this[_0x0891('0x25')]='';this[_0x0891('0x26')]='';this[_0x0891('0x27')]=0x0;this[_0x0891('0x28')]=0x0;this[_0x0891('0x29')]=_0x2499ed[_0x0891('0x29')]||null;this[_0x0891('0x2a')]=_0x2499ed[_0x0891('0x2a')]?_0x2499ed[_0x0891('0x2a')]:null;this[_0x0891('0x2b')]=_0x2499ed[_0x0891('0x2b')];this[_0x0891('0x2c')]=_0x2499ed['dialMethod']||_0x0891('0x2d');this['dialLimitChannel']=_0x2499ed['dialLimitChannel']||0x0;this[_0x0891('0x2e')]=_0x2499ed[_0x0891('0x2e')]||0x0;this[_0x0891('0x2f')]=_0x2499ed[_0x0891('0x2f')]||0x1;this[_0x0891('0x30')]=_0x2499ed[_0x0891('0x30')]||_0x0891('0x31');this[_0x0891('0x32')]=_0x2499ed[_0x0891('0x32')]||0.03;this[_0x0891('0x33')]=_0x2499ed['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x2499ed[_0x0891('0x34')]||'anonymous';this[_0x0891('0x35')]=_0x2499ed[_0x0891('0x35')]||_0x0891('0x36');this['dialOriginateTimeout']=_0x2499ed[_0x0891('0x37')]||0x1e;this[_0x0891('0x38')]=_0x2499ed[_0x0891('0x38')]||_0x0891('0x39');this[_0x0891('0x3a')]=_0x2499ed[_0x0891('0x3a')]||0x3;this[_0x0891('0x3b')]=_0x2499ed[_0x0891('0x3b')]||undefined;this[_0x0891('0x3c')]=_0x2499ed[_0x0891('0x3c')]||0x3;this[_0x0891('0x3d')]=_0x2499ed[_0x0891('0x3d')]||0x96;this['dialBusyMaxRetry']=_0x2499ed['dialBusyMaxRetry']||0x3;this[_0x0891('0x3e')]=_0x2499ed[_0x0891('0x3e')]||0x96;this[_0x0891('0x3f')]=_0x2499ed[_0x0891('0x3f')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2499ed[_0x0891('0x40')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2499ed[_0x0891('0x41')]||0x3;this[_0x0891('0x42')]=_0x2499ed[_0x0891('0x42')]||0x96;this[_0x0891('0x43')]=_0x2499ed[_0x0891('0x43')]||0x3;this[_0x0891('0x44')]=_0x2499ed[_0x0891('0x44')]||0x96;this[_0x0891('0x45')]=_0x2499ed[_0x0891('0x45')]||0x3;this[_0x0891('0x46')]=_0x2499ed[_0x0891('0x46')]||0x96;this[_0x0891('0x47')]=_0x2499ed[_0x0891('0x47')]||0x3;this[_0x0891('0x48')]=_0x2499ed[_0x0891('0x48')]||0x96;this['dialAgentRejectMaxRetry']=_0x2499ed[_0x0891('0x49')]||0x3;this[_0x0891('0x4a')]=_0x2499ed[_0x0891('0x4a')]||0x96;this[_0x0891('0x4b')]=_0x2499ed['callAdditionalPhoneAfterMin']||0x3;this[_0x0891('0x4c')]=_0x2499ed[_0x0891('0x4c')]||0x4;this[_0x0891('0x4d')]=_0x2499ed[_0x0891('0x4d')]?_0x2499ed[_0x0891('0x4d')]:undefined;this[_0x0891('0x4e')]=_0x2499ed['TrunkBackup']?_0x2499ed[_0x0891('0x4e')]:undefined;this[_0x0891('0x4f')]=_0x2499ed[_0x0891('0x4f')]||undefined;this['Interval']=_0x2499ed['Interval']?_0x2499ed[_0x0891('0x50')]:undefined;this[_0x0891('0x51')]=_0x2499ed['dialOrderByScheduledAt']||_0x0891('0x52');this[_0x0891('0x53')]=_0x2499ed['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x0891('0x54')]=_0x2499ed[_0x0891('0x54')]||undefined;this[_0x0891('0x55')]=strategy[_0x2499ed[_0x0891('0x55')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x2499ed['dialAMDActive']||![];this[_0x0891('0x56')]=_0x2499ed[_0x0891('0x56')];this[_0x0891('0x57')]=_0x2499ed[_0x0891('0x57')];this[_0x0891('0x58')]=_0x2499ed[_0x0891('0x58')];this[_0x0891('0x59')]=_0x2499ed[_0x0891('0x59')];this[_0x0891('0x5a')]=_0x2499ed['dialAMDMinWordLength'];this[_0x0891('0x5b')]=_0x2499ed['dialAMDBetweenWordsSilence'];this[_0x0891('0x5c')]=_0x2499ed[_0x0891('0x5c')];this[_0x0891('0x5d')]=_0x2499ed[_0x0891('0x5d')];this[_0x0891('0x5e')]=_0x2499ed[_0x0891('0x5e')];this[_0x0891('0x5f')]=0x0;this[_0x0891('0x60')]=0x0;this['timeout']=_0x2499ed[_0x0891('0x61')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x0891('0x62')]=0x0;this[_0x0891('0x63')]=0x0;this[_0x0891('0x64')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x0891('0x65')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x0891('0x66')]=0x0;this[_0x0891('0x67')]=0x0;this[_0x0891('0x68')]=0x0;this[_0x0891('0x69')]=0x0;this[_0x0891('0x6a')]=undefined;this[_0x0891('0x6b')]=undefined;this['handlePredictive']=undefined;this[_0x0891('0x6c')]=1.05;this[_0x0891('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x0891('0x6e')]=0x0;this[_0x0891('0x6f')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x0891('0x70')]=0x0;this[_0x0891('0x71')]=0x0;this[_0x0891('0x72')]=0x0;this[_0x0891('0x73')]=_0x2499ed[_0x0891('0x74')]||0x14;this[_0x0891('0x75')]=_0x2499ed[_0x0891('0x74')]||0xa;this[_0x0891('0x76')]=0x0;this[_0x0891('0x77')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x0891('0x78')]=0x0;this[_0x0891('0x79')]=0x0;this[_0x0891('0x7a')]=0x0;this[_0x0891('0x7b')]=_0x2499ed[_0x0891('0x7b')]||0x1e;this[_0x0891('0x7c')]=_0x2499ed['dialRecallInQueue']||![];this[_0x0891('0x7d')]=!!_0x2499ed[_0x0891('0x7d')]||![];this[_0x0891('0x7e')]=!!_0x2499ed[_0x0891('0x7e')]||![];this[_0x0891('0x7f')]=_0x2499ed[_0x0891('0x7f')]||undefined;this[_0x0891('0x80')]=_0x2499ed[_0x0891('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x2499ed[_0x0891('0x81')]||![];this['monitor_format']=monitorFormat[_0x2499ed[_0x0891('0xa')]]?monitorFormat[_0x2499ed['monitor_format']]:undefined;this['mandatoryDisposition']=_0x2499ed[_0x0891('0x82')]||![];this[_0x0891('0x83')]=_0x2499ed['mandatoryDispositionPause']?_0x2499ed[_0x0891('0x83')]:undefined;this[_0x0891('0x84')]=![];}module[_0x0891('0x85')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 0180246..2d20a9b 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 _0x4af9=['predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','online','incall','status','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','available','loggedIn','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','paused','pTalking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','loggedInDb','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls'];(function(_0x1e5505,_0x3d9797){var _0x53c123=function(_0x5b2f3a){while(--_0x5b2f3a){_0x1e5505['push'](_0x1e5505['shift']());}};_0x53c123(++_0x3d9797);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var INBOUND_COUNTERS=[_0x94af('0x0'),_0x94af('0x1'),'loggedInDb','paused',_0x94af('0x2'),_0x94af('0x3'),_0x94af('0x4')];var OUTBOUND_COUNTERS=[_0x94af('0x0'),_0x94af('0x5'),_0x94af('0x6'),_0x94af('0x1'),'loggedInDb',_0x94af('0x7'),_0x94af('0x8'),_0x94af('0x9'),_0x94af('0xa'),'outboundBusyCallsDay',_0x94af('0xb'),_0x94af('0xc'),_0x94af('0xd'),'outboundReCallsDay','outboundRejectCallsDay',_0x94af('0xe'),_0x94af('0xf'),_0x94af('0x10'),_0x94af('0x3'),_0x94af('0x11'),_0x94af('0x12'),'total',_0x94af('0x4')];function VoiceQueueSummary(_0x3a1610){this['id']=_0x3a1610['id'];this['name']=_0x3a1610[_0x94af('0x13')];this[_0x94af('0x14')]=_0x3a1610[_0x94af('0x14')];this[_0x94af('0x15')]=_0x3a1610[_0x94af('0x15')]||0x0;this['answered']=_0x3a1610[_0x94af('0x5')]||0x0;this['available']=_0x3a1610['available']||0x0;this['busy']=_0x3a1610[_0x94af('0x16')]||0x0;this[_0x94af('0x6')]=_0x3a1610[_0x94af('0x6')]||0x0;this[_0x94af('0x17')]=_0x3a1610['invalid']||0x0;this[_0x94af('0x1')]=_0x3a1610[_0x94af('0x1')]||0x0;this['loggedInDb']=_0x3a1610[_0x94af('0x18')]||0x0;this[_0x94af('0x19')]=_0x3a1610[_0x94af('0x19')]||0x0;this[_0x94af('0x1a')]=_0x3a1610[_0x94af('0x1a')]||0x0;this[_0x94af('0xf')]=_0x3a1610[_0x94af('0xf')]||0x0;this[_0x94af('0x2')]=_0x3a1610[_0x94af('0x2')]||0x0;this[_0x94af('0x1b')]=_0x3a1610['ringInUse'];this['sumBillable']=_0x3a1610[_0x94af('0x11')];this[_0x94af('0x12')]=_0x3a1610[_0x94af('0x12')];this[_0x94af('0x1c')]=_0x3a1610[_0x94af('0x1c')]||0x0;this[_0x94af('0x3')]=_0x3a1610['talking']||0x0;this[_0x94af('0x1d')]=_0x3a1610['total']||0x0;this[_0x94af('0x1e')]=_0x3a1610['type'];this[_0x94af('0x1f')]=_0x3a1610[_0x94af('0x1f')]||0x0;this[_0x94af('0x20')]=_0x3a1610['unknown']||0x0;this[_0x94af('0x21')]=_0x3a1610[_0x94af('0x21')]||0x0;this[_0x94af('0x4')]=_0x3a1610[_0x94af('0x4')]||0x0;if(_0x3a1610['type']===_0x94af('0x22')){this[_0x94af('0x10')]=_0x3a1610[_0x94af('0x10')]||0x0;this[_0x94af('0x23')]=_0x3a1610[_0x94af('0x23')];this[_0x94af('0x24')]=_0x3a1610[_0x94af('0x24')];this[_0x94af('0x25')]=_0x3a1610[_0x94af('0x25')];this['dialOriginateCallerIdNumber']=_0x3a1610[_0x94af('0x26')];this['dialOriginateTimeout']=_0x3a1610[_0x94af('0x27')];this[_0x94af('0x28')]=_0x3a1610[_0x94af('0x28')];this['temp']=_0x3a1610[_0x94af('0x29')];this[_0x94af('0x2a')]=_0x3a1610['outboundAnswerAgiCallsDay'];this[_0x94af('0x9')]=_0x3a1610[_0x94af('0x9')];this[_0x94af('0xa')]=_0x3a1610[_0x94af('0xa')];this[_0x94af('0x2b')]=_0x3a1610[_0x94af('0x2b')];this['outboundCongestionCallsDay']=_0x3a1610[_0x94af('0xb')];this['outboundDropCallsDayACS']=_0x3a1610['outboundDropCallsDayACS'];this[_0x94af('0x2c')]=_0x3a1610[_0x94af('0x2c')];this[_0x94af('0x2d')]=_0x3a1610[_0x94af('0x2d')];this[_0x94af('0xc')]=_0x3a1610['outboundNoAnswerCallsDay'];this[_0x94af('0xd')]=_0x3a1610[_0x94af('0xd')];this['outboundOriginateFailureCallsDay']=_0x3a1610[_0x94af('0x2e')];this[_0x94af('0x2f')]=_0x3a1610[_0x94af('0x2f')];this[_0x94af('0x30')]=_0x3a1610[_0x94af('0x30')];this[_0x94af('0xe')]=_0x3a1610[_0x94af('0xe')];this['predictiveIntervalAnsweredCalls']=_0x3a1610[_0x94af('0x31')];this[_0x94af('0x32')]=_0x3a1610[_0x94af('0x32')];this[_0x94af('0x33')]=_0x3a1610[_0x94af('0x33')];this[_0x94af('0x34')]=_0x3a1610[_0x94af('0x34')];this[_0x94af('0x35')]=_0x3a1610[_0x94af('0x35')];this['predictiveIntervalErlangCalls']=_0x3a1610[_0x94af('0x36')];this[_0x94af('0x37')]=_0x3a1610[_0x94af('0x37')];this[_0x94af('0x38')]=_0x3a1610[_0x94af('0x38')];this['predictiveIntervalMultiplicativeFactor']=_0x3a1610[_0x94af('0x39')];this[_0x94af('0x3a')]=_0x3a1610[_0x94af('0x3a')];this[_0x94af('0x3b')]=_0x3a1610['predictiveIntervalAvailable'];this[_0x94af('0x3c')]=_0x3a1610['predictiveIntervalTotalCalls'];this['originated']=_0x3a1610['originated'];this[_0x94af('0x3d')]=_0x3a1610[_0x94af('0x3d')];this['erlangCallToSecond']=_0x3a1610[_0x94af('0x3e')];this['erlangAbandonmentRate']=_0x3a1610[_0x94af('0x3f')];this['erlangBusyFactor']=_0x3a1610[_0x94af('0x40')];this[_0x94af('0x41')]=_0x3a1610[_0x94af('0x41')];this[_0x94af('0x42')]=_0x3a1610[_0x94af('0x42')];this[_0x94af('0x43')]=_0x3a1610[_0x94af('0x43')];this[_0x94af('0x44')]=_0x3a1610[_0x94af('0x44')];}if(_0x3a1610[_0x94af('0x45')]){this[_0x94af('0x45')]={'id':_0x3a1610['Trunk']['id'],'name':_0x3a1610[_0x94af('0x45')][_0x94af('0x13')],'active':_0x3a1610['Trunk'][_0x94af('0x46')],'callerid':_0x3a1610['Trunk'][_0x94af('0x47')]};}}VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x49')]=function(_0x4cf8b9,_0x36646a,_0x554938,_0x326dce){this[_0x94af('0x18')]=0x0;this['talking']=0x0;this[_0x94af('0xf')]=0x0;this[_0x94af('0x20')]=0x0;this[_0x94af('0x1a')]=0x0;this[_0x94af('0x6')]=0x0;this[_0x94af('0x16')]=0x0;this[_0x94af('0x17')]=0x0;this[_0x94af('0x1f')]=0x0;this[_0x94af('0x2')]=0x0;this['ringInUse']=0x0;this[_0x94af('0x19')]=0x0;if(_0x554938){if(_0x554938['available']){this[_0x94af('0x0')]=Number(_0x554938[_0x94af('0x0')]);}if(_0x554938[_0x94af('0x4a')]){this[_0x94af('0x1')]=Number(_0x554938[_0x94af('0x4a')]);}if(_0x554938[_0x94af('0x4b')]){this['waiting']=Number(_0x554938[_0x94af('0x4b')]);}}for(var _0x10ebe4=0x0;_0x10ebe4<_0x4cf8b9[_0x94af('0x4c')];_0x10ebe4++){var _0x4475bd=_0x36646a['SIP/'+_0x4cf8b9[_0x10ebe4][_0x94af('0x13')]];if(_0x4475bd&&_0x4475bd[_0x94af('0x4d')]){this[_0x94af('0x18')]+=0x1;}if(_0x4cf8b9[_0x10ebe4][_0x94af('0x4e')]==='1'){this[_0x94af('0x3')]+=0x1;}if(_0x4cf8b9[_0x10ebe4][_0x94af('0xf')]==='1'&&!['2','7','8']['includes'](_0x4cf8b9[_0x10ebe4]['status'])){this[_0x94af('0xf')]+=0x1;}switch(_0x4cf8b9[_0x10ebe4][_0x94af('0x4f')]){case'0':this[_0x94af('0x20')]+=0x1;break;case'1':this[_0x94af('0x1a')]+=0x1;break;case'2':this[_0x94af('0x6')]+=0x1;break;case'3':this[_0x94af('0x16')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x94af('0x1f')]+=0x1;break;case'6':this[_0x94af('0x2')]+=0x1;break;case'7':this[_0x94af('0x1b')]+=0x1;break;case'8':this[_0x94af('0x19')]+=0x1;break;}}if(this[_0x94af('0x24')]===_0x94af('0x50')){var _0x111d30=Object['keys'](_0x326dce);for(var _0x321cf6=0x0;_0x321cf6<_0x111d30['length'];_0x321cf6++){var _0x260f66=_0x111d30[_0x321cf6];var _0x390467=_0x326dce[_0x260f66];if(_0x390467[_0x94af('0x51')]===this[_0x94af('0x13')]&&_0x390467[_0x94af('0x1e')]===_0x94af('0x52')&&_0x390467[_0x94af('0x53')]===_0x94af('0x54')){this[_0x94af('0x3')]+=0x1;}}if(this[_0x94af('0x3')]>this[_0x94af('0x6')]){this[_0x94af('0x3')]=this[_0x94af('0x6')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x55')]=function(_0x2deeb7){var _0x38069e=![];if(_0x2deeb7){_0x38069e=INBOUND_COUNTERS[_0x94af('0x56')](function(_0x21e35f){return this[_0x21e35f]!==_0x2deeb7[_0x21e35f];},this);}return _0x38069e;};VoiceQueueSummary[_0x94af('0x48')]['compareToOutboundQueue']=function(_0x36cb23){var _0x81a391=![];var _0x2483ee=![];var _0x440ff1=![];if(_0x36cb23){_0x81a391=this['dialMethod']!==_0x36cb23[_0x94af('0x24')]||this['dialActive']!==_0x36cb23[_0x94af('0x23')]||this[_0x94af('0x43')]!==_0x36cb23['message']||this[_0x94af('0x44')]!==_0x36cb23['statusMessage'];_0x2483ee=OUTBOUND_COUNTERS['some'](function(_0x5ed398){return this[_0x5ed398]!==_0x36cb23[_0x5ed398];},this);if(this[_0x94af('0x45')]&&_0x36cb23[_0x94af('0x45')]){_0x440ff1=this[_0x94af('0x45')][_0x94af('0x13')]!==_0x36cb23['Trunk'][_0x94af('0x13')]||this[_0x94af('0x45')][_0x94af('0x46')]!==_0x36cb23[_0x94af('0x45')][_0x94af('0x46')];}}return _0x81a391||_0x2483ee||_0x440ff1;};VoiceQueueSummary[_0x94af('0x48')][_0x94af('0x57')]=function(_0x44e646){this[_0x94af('0x5')]=_0x44e646[_0x94af('0x5')];this[_0x94af('0x43')]=_0x44e646[_0x94af('0x43')];this['statusMessage']=_0x44e646[_0x94af('0x44')];this[_0x94af('0x7')]=_0x44e646[_0x94af('0x7')];this[_0x94af('0x8')]=_0x44e646['outboundAbandonedCallsDay'];this[_0x94af('0x9')]=_0x44e646[_0x94af('0x9')];this[_0x94af('0xa')]=_0x44e646[_0x94af('0xa')];this[_0x94af('0x2b')]=_0x44e646['outboundBusyCallsDay'];this[_0x94af('0xb')]=_0x44e646[_0x94af('0xb')];this['outboundNoAnswerCallsDay']=_0x44e646[_0x94af('0xc')];this[_0x94af('0xd')]=_0x44e646[_0x94af('0xd')];this[_0x94af('0x2f')]=_0x44e646[_0x94af('0x2f')];this[_0x94af('0x30')]=_0x44e646[_0x94af('0x30')];this[_0x94af('0xe')]=_0x44e646[_0x94af('0xe')];this['sumBillable']=_0x44e646[_0x94af('0x11')];this['sumDuration']=_0x44e646[_0x94af('0x12')];this['total']=_0x44e646[_0x94af('0x1d')];if(this[_0x94af('0x24')]===_0x94af('0x58')){this[_0x94af('0x10')]=_0x44e646[_0x94af('0x10')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xa990=['predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','inUse','loggedin','callers','length','incall','status','booked','keys','queue','dialer','exten','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0xa990,0xc9));var _0x0a99=function(_0x5601f2,_0x71d8f7){_0x5601f2=_0x5601f2-0x0;var _0x9ade90=_0xa990[_0x5601f2];return _0x9ade90;};'use strict';var INBOUND_COUNTERS=[_0x0a99('0x0'),_0x0a99('0x1'),_0x0a99('0x2'),_0x0a99('0x3'),_0x0a99('0x4'),_0x0a99('0x5'),_0x0a99('0x6')];var OUTBOUND_COUNTERS=[_0x0a99('0x0'),'answered','inUse',_0x0a99('0x1'),_0x0a99('0x2'),_0x0a99('0x7'),_0x0a99('0x8'),_0x0a99('0x9'),_0x0a99('0xa'),_0x0a99('0xb'),_0x0a99('0xc'),_0x0a99('0xd'),_0x0a99('0xe'),_0x0a99('0xf'),'outboundRejectCallsDay',_0x0a99('0x10'),_0x0a99('0x3'),'pTalking','talking',_0x0a99('0x11'),_0x0a99('0x12'),_0x0a99('0x13'),_0x0a99('0x6')];function VoiceQueueSummary(_0x376f89){this['id']=_0x376f89['id'];this['name']=_0x376f89[_0x0a99('0x14')];this[_0x0a99('0x15')]=_0x376f89['strategy'];this[_0x0a99('0x16')]=_0x376f89[_0x0a99('0x16')]||0x0;this[_0x0a99('0x17')]=_0x376f89[_0x0a99('0x17')]||0x0;this[_0x0a99('0x0')]=_0x376f89[_0x0a99('0x0')]||0x0;this[_0x0a99('0x18')]=_0x376f89[_0x0a99('0x18')]||0x0;this['inUse']=_0x376f89['inUse']||0x0;this[_0x0a99('0x19')]=_0x376f89[_0x0a99('0x19')]||0x0;this[_0x0a99('0x1')]=_0x376f89['loggedIn']||0x0;this[_0x0a99('0x2')]=_0x376f89['loggedInDb']||0x0;this['onHold']=_0x376f89[_0x0a99('0x1a')]||0x0;this[_0x0a99('0x1b')]=_0x376f89[_0x0a99('0x1b')]||0x0;this[_0x0a99('0x3')]=_0x376f89['paused']||0x0;this['ringing']=_0x376f89[_0x0a99('0x4')]||0x0;this[_0x0a99('0x1c')]=_0x376f89[_0x0a99('0x1c')];this[_0x0a99('0x11')]=_0x376f89['sumBillable'];this['sumDuration']=_0x376f89[_0x0a99('0x12')];this['sumHoldTime']=_0x376f89[_0x0a99('0x1d')]||0x0;this['talking']=_0x376f89[_0x0a99('0x5')]||0x0;this['total']=_0x376f89[_0x0a99('0x13')]||0x0;this[_0x0a99('0x1e')]=_0x376f89[_0x0a99('0x1e')];this[_0x0a99('0x1f')]=_0x376f89[_0x0a99('0x1f')]||0x0;this[_0x0a99('0x20')]=_0x376f89[_0x0a99('0x20')]||0x0;this[_0x0a99('0x21')]=_0x376f89[_0x0a99('0x21')]||0x0;this['waiting']=_0x376f89['waiting']||0x0;if(_0x376f89[_0x0a99('0x1e')]===_0x0a99('0x22')){this[_0x0a99('0x23')]=_0x376f89['pTalking']||0x0;this['dialActive']=_0x376f89[_0x0a99('0x24')];this[_0x0a99('0x25')]=_0x376f89[_0x0a99('0x25')];this[_0x0a99('0x26')]=_0x376f89[_0x0a99('0x26')];this[_0x0a99('0x27')]=_0x376f89[_0x0a99('0x27')];this[_0x0a99('0x28')]=_0x376f89[_0x0a99('0x28')];this['dialPrefix']=_0x376f89[_0x0a99('0x29')];this['temp']=_0x376f89['temp'];this['outboundAnswerAgiCallsDay']=_0x376f89[_0x0a99('0x2a')];this[_0x0a99('0x9')]=_0x376f89[_0x0a99('0x9')];this[_0x0a99('0xa')]=_0x376f89[_0x0a99('0xa')];this[_0x0a99('0xb')]=_0x376f89[_0x0a99('0xb')];this['outboundCongestionCallsDay']=_0x376f89[_0x0a99('0xc')];this[_0x0a99('0x2b')]=_0x376f89[_0x0a99('0x2b')];this[_0x0a99('0x2c')]=_0x376f89['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x376f89['outboundDropCallsDayTimeout'];this[_0x0a99('0xd')]=_0x376f89[_0x0a99('0xd')];this[_0x0a99('0xe')]=_0x376f89['outboundNoSuchCallsDay'];this[_0x0a99('0x2d')]=_0x376f89[_0x0a99('0x2d')];this[_0x0a99('0xf')]=_0x376f89[_0x0a99('0xf')];this[_0x0a99('0x2e')]=_0x376f89[_0x0a99('0x2e')];this[_0x0a99('0x10')]=_0x376f89['outboundUnknownCallsDay'];this[_0x0a99('0x2f')]=_0x376f89[_0x0a99('0x2f')];this[_0x0a99('0x30')]=_0x376f89[_0x0a99('0x30')];this[_0x0a99('0x31')]=_0x376f89['predictiveIntervalAvgTalktime'];this[_0x0a99('0x32')]=_0x376f89['predictiveIntervalDroppedCallsCallersExit'];this['predictiveIntervalDroppedCallsTimeout']=_0x376f89['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x376f89[_0x0a99('0x33')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x376f89[_0x0a99('0x34')];this[_0x0a99('0x35')]=_0x376f89[_0x0a99('0x35')];this[_0x0a99('0x36')]=_0x376f89[_0x0a99('0x36')];this[_0x0a99('0x37')]=_0x376f89[_0x0a99('0x37')];this[_0x0a99('0x38')]=_0x376f89[_0x0a99('0x38')];this[_0x0a99('0x39')]=_0x376f89[_0x0a99('0x39')];this[_0x0a99('0x7')]=_0x376f89[_0x0a99('0x7')];this['erlangCalls']=_0x376f89[_0x0a99('0x3a')];this[_0x0a99('0x3b')]=_0x376f89['erlangCallToSecond'];this[_0x0a99('0x3c')]=_0x376f89['erlangAbandonmentRate'];this[_0x0a99('0x3d')]=_0x376f89['erlangBusyFactor'];this[_0x0a99('0x3e')]=_0x376f89[_0x0a99('0x3e')];this[_0x0a99('0x3f')]=_0x376f89[_0x0a99('0x3f')];this['message']=_0x376f89[_0x0a99('0x40')];this[_0x0a99('0x41')]=_0x376f89[_0x0a99('0x41')];}if(_0x376f89['Trunk']){this[_0x0a99('0x42')]={'id':_0x376f89[_0x0a99('0x42')]['id'],'name':_0x376f89[_0x0a99('0x42')][_0x0a99('0x14')],'active':_0x376f89['Trunk'][_0x0a99('0x43')],'callerid':_0x376f89['Trunk']['callerid']};}}VoiceQueueSummary[_0x0a99('0x44')]['createReport']=function(_0x185495,_0x583dca,_0x39dd72,_0x2cfd3d){this[_0x0a99('0x2')]=0x0;this[_0x0a99('0x5')]=0x0;this['paused']=0x0;this[_0x0a99('0x20')]=0x0;this[_0x0a99('0x1b')]=0x0;this[_0x0a99('0x45')]=0x0;this[_0x0a99('0x18')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this[_0x0a99('0x1c')]=0x0;this['onHold']=0x0;if(_0x39dd72){if(_0x39dd72[_0x0a99('0x0')]){this['available']=Number(_0x39dd72['available']);}if(_0x39dd72['loggedin']){this['loggedIn']=Number(_0x39dd72[_0x0a99('0x46')]);}if(_0x39dd72['callers']){this[_0x0a99('0x6')]=Number(_0x39dd72[_0x0a99('0x47')]);}}for(var _0x58795f=0x0;_0x58795f<_0x185495[_0x0a99('0x48')];_0x58795f++){var _0x122af5=_0x583dca['SIP/'+_0x185495[_0x58795f][_0x0a99('0x14')]];if(_0x122af5&&_0x122af5['online']){this[_0x0a99('0x2')]+=0x1;}if(_0x185495[_0x58795f][_0x0a99('0x49')]==='1'){this['talking']+=0x1;}if(_0x185495[_0x58795f][_0x0a99('0x3')]==='1'&&!['2','7','8']['includes'](_0x185495[_0x58795f]['status'])){this[_0x0a99('0x3')]+=0x1;}switch(_0x185495[_0x58795f][_0x0a99('0x4a')]){case'0':this[_0x0a99('0x20')]+=0x1;break;case'1':this[_0x0a99('0x1b')]+=0x1;break;case'2':this[_0x0a99('0x45')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x0a99('0x19')]+=0x1;break;case'5':this[_0x0a99('0x1f')]+=0x1;break;case'6':this[_0x0a99('0x4')]+=0x1;break;case'7':this[_0x0a99('0x1c')]+=0x1;break;case'8':this[_0x0a99('0x1a')]+=0x1;break;}}if(this[_0x0a99('0x25')]===_0x0a99('0x4b')){var _0x18fc71=Object[_0x0a99('0x4c')](_0x2cfd3d);for(var _0x1621d9=0x0;_0x1621d9<_0x18fc71['length'];_0x1621d9++){var _0x50e04f=_0x18fc71[_0x1621d9];var _0x4ce9dd=_0x2cfd3d[_0x50e04f];if(_0x4ce9dd[_0x0a99('0x4d')]===this[_0x0a99('0x14')]&&_0x4ce9dd[_0x0a99('0x1e')]===_0x0a99('0x4e')&&_0x4ce9dd[_0x0a99('0x4f')]==='xcally-motion-preview'){this[_0x0a99('0x5')]+=0x1;}}if(this[_0x0a99('0x5')]>this['inUse']){this[_0x0a99('0x5')]=this[_0x0a99('0x45')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x0a99('0x44')][_0x0a99('0x50')]=function(_0x25595d){var _0x2befdc=![];if(_0x25595d){_0x2befdc=INBOUND_COUNTERS[_0x0a99('0x51')](function(_0x2411ea){return this[_0x2411ea]!==_0x25595d[_0x2411ea];},this);}return _0x2befdc;};VoiceQueueSummary[_0x0a99('0x44')]['compareToOutboundQueue']=function(_0x3b5581){var _0x1b6873=![];var _0x1e9e9d=![];var _0x5a6762=![];if(_0x3b5581){_0x1b6873=this[_0x0a99('0x25')]!==_0x3b5581[_0x0a99('0x25')]||this[_0x0a99('0x24')]!==_0x3b5581['dialActive']||this[_0x0a99('0x40')]!==_0x3b5581[_0x0a99('0x40')]||this[_0x0a99('0x41')]!==_0x3b5581[_0x0a99('0x41')];_0x1e9e9d=OUTBOUND_COUNTERS[_0x0a99('0x51')](function(_0x42d1d1){return this[_0x42d1d1]!==_0x3b5581[_0x42d1d1];},this);if(this['Trunk']&&_0x3b5581[_0x0a99('0x42')]){_0x5a6762=this['Trunk'][_0x0a99('0x14')]!==_0x3b5581[_0x0a99('0x42')][_0x0a99('0x14')]||this[_0x0a99('0x42')]['active']!==_0x3b5581[_0x0a99('0x42')]['active'];}}return _0x1b6873||_0x1e9e9d||_0x5a6762;};VoiceQueueSummary[_0x0a99('0x44')][_0x0a99('0x52')]=function(_0xdf36c0){this[_0x0a99('0x17')]=_0xdf36c0[_0x0a99('0x17')];this[_0x0a99('0x40')]=_0xdf36c0[_0x0a99('0x40')];this[_0x0a99('0x41')]=_0xdf36c0[_0x0a99('0x41')];this[_0x0a99('0x7')]=_0xdf36c0[_0x0a99('0x7')];this[_0x0a99('0x8')]=_0xdf36c0[_0x0a99('0x8')];this['outboundAnswerCallsDay']=_0xdf36c0[_0x0a99('0x9')];this[_0x0a99('0xa')]=_0xdf36c0[_0x0a99('0xa')];this['outboundBusyCallsDay']=_0xdf36c0[_0x0a99('0xb')];this[_0x0a99('0xc')]=_0xdf36c0[_0x0a99('0xc')];this['outboundNoAnswerCallsDay']=_0xdf36c0[_0x0a99('0xd')];this[_0x0a99('0xe')]=_0xdf36c0[_0x0a99('0xe')];this[_0x0a99('0xf')]=_0xdf36c0['outboundReCallsDay'];this[_0x0a99('0x2e')]=_0xdf36c0[_0x0a99('0x2e')];this[_0x0a99('0x10')]=_0xdf36c0['outboundUnknownCallsDay'];this['sumBillable']=_0xdf36c0[_0x0a99('0x11')];this['sumDuration']=_0xdf36c0['sumDuration'];this['total']=_0xdf36c0[_0x0a99('0x13')];if(this['dialMethod']===_0x0a99('0x53')){this[_0x0a99('0x23')]=_0xdf36c0[_0x0a99('0x23')];}};module[_0x0a99('0x54')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index c161b91..d67af4b 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 _0x69f4=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x456200,_0x3d4c03){var _0x551f2e=function(_0x807f2d){while(--_0x807f2d){_0x456200['push'](_0x456200['shift']());}};_0x551f2e(++_0x3d4c03);}(_0x69f4,0x1b5));var _0x469f=function(_0x4981e9,_0x2d8b39){_0x4981e9=_0x4981e9-0x0;var _0x3ea69b=_0x69f4[_0x4981e9];return _0x3ea69b;};'use strict';function VtigerAccount(_0xee595c){this['id']=_0xee595c['id']||0x0;this[_0x469f('0x0')]=_0xee595c[_0x469f('0x0')]||'';this[_0x469f('0x1')]=_0xee595c[_0x469f('0x1')]||'';this[_0x469f('0x2')]=_0xee595c[_0x469f('0x2')]||'';this[_0x469f('0x3')]=_0xee595c[_0x469f('0x3')]||'';this[_0x469f('0x4')]=_0xee595c[_0x469f('0x4')]||'';this[_0x469f('0x5')]=_0xee595c['Configurations']||{};}module[_0x469f('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb00d=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x12df03,_0x3afef7){var _0x4c7bc2=function(_0x18fda5){while(--_0x18fda5){_0x12df03['push'](_0x12df03['shift']());}};_0x4c7bc2(++_0x3afef7);}(_0xb00d,0x1d0));var _0xdb00=function(_0x1190c2,_0x2c078b){_0x1190c2=_0x1190c2-0x0;var _0x6ec988=_0xb00d[_0x1190c2];return _0x6ec988;};'use strict';function VtigerAccount(_0x4697a9){this['id']=_0x4697a9['id']||0x0;this[_0xdb00('0x0')]=_0x4697a9['name']||'';this['username']=_0x4697a9[_0xdb00('0x1')]||'';this[_0xdb00('0x2')]=_0x4697a9[_0xdb00('0x2')]||'';this[_0xdb00('0x3')]=_0x4697a9[_0xdb00('0x3')]||'';this['serverUrl']=_0x4697a9[_0xdb00('0x4')]||'';this[_0xdb00('0x5')]=_0x4697a9[_0xdb00('0x5')]||{};}module[_0xdb00('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 27c9a78..f70d063 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 _0xd9ff=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','exports'];(function(_0x1e1a7a,_0x2d4cc0){var _0x4dc71b=function(_0x2e1094){while(--_0x2e1094){_0x1e1a7a['push'](_0x1e1a7a['shift']());}};_0x4dc71b(++_0x2d4cc0);}(_0xd9ff,0x1f4));var _0xfd9f=function(_0x197297,_0x42596f){_0x197297=_0x197297-0x0;var _0x5eb41a=_0xd9ff[_0x197297];return _0x5eb41a;};'use strict';function ZendeskAccount(_0x482d90){this['id']=_0x482d90['id']||0x0;this[_0xfd9f('0x0')]=_0x482d90[_0xfd9f('0x0')]||'';this[_0xfd9f('0x1')]=_0x482d90[_0xfd9f('0x1')]||'';this[_0xfd9f('0x2')]=_0x482d90[_0xfd9f('0x2')]||'';this[_0xfd9f('0x3')]=_0x482d90[_0xfd9f('0x3')]||'';this['remoteUri']=_0x482d90[_0xfd9f('0x4')]||'';this[_0xfd9f('0x5')]=_0x482d90['authType']||'';this[_0xfd9f('0x6')]=_0x482d90[_0xfd9f('0x6')]||_0xfd9f('0x7');this[_0xfd9f('0x8')]=_0x482d90[_0xfd9f('0x8')]||'';this['Configurations']=_0x482d90['Configurations']||{};}module[_0xfd9f('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xd5d9=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd5d9,0x193));var _0x9d5d=function(_0xbbc163,_0x202519){_0xbbc163=_0xbbc163-0x0;var _0x33a016=_0xd5d9[_0xbbc163];return _0x33a016;};'use strict';function ZendeskAccount(_0x4d19f2){this['id']=_0x4d19f2['id']||0x0;this[_0x9d5d('0x0')]=_0x4d19f2[_0x9d5d('0x0')]||'';this['username']=_0x4d19f2[_0x9d5d('0x1')]||'';this['password']=_0x4d19f2[_0x9d5d('0x2')]||'';this['token']=_0x4d19f2[_0x9d5d('0x3')]||'';this[_0x9d5d('0x4')]=_0x4d19f2[_0x9d5d('0x4')]||'';this['authType']=_0x4d19f2[_0x9d5d('0x5')]||'';this[_0x9d5d('0x6')]=_0x4d19f2[_0x9d5d('0x6')]||_0x9d5d('0x7');this[_0x9d5d('0x8')]=_0x4d19f2['serverUrl']||'';this[_0x9d5d('0x9')]=_0x4d19f2[_0x9d5d('0x9')]||{};}module[_0x9d5d('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 085b29e..88f2e18 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 _0x03dc=['Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x03dc,0x1ce));var _0xc03d=function(_0x3cc6bf,_0x2f59dd){_0x3cc6bf=_0x3cc6bf-0x0;var _0x1b8ec1=_0x03dc[_0x3cc6bf];return _0x1b8ec1;};'use strict';function ZohoAccount(_0x5d2442){this['id']=_0x5d2442['id']||0x0;this['name']=_0x5d2442['name']||'';this[_0xc03d('0x0')]=_0x5d2442[_0xc03d('0x0')]||'';this[_0xc03d('0x1')]=_0x5d2442[_0xc03d('0x1')]||'';this['zone']=_0x5d2442[_0xc03d('0x2')]||'';this[_0xc03d('0x3')]=_0x5d2442['clientId']||'';this['clientSecret']=_0x5d2442[_0xc03d('0x4')]||'';this['serverUrl']=_0x5d2442[_0xc03d('0x5')]||'';this[_0xc03d('0x6')]=_0x5d2442['code']||'';this['refreshToken']=_0x5d2442[_0xc03d('0x7')]||'';this[_0xc03d('0x8')]=_0x5d2442[_0xc03d('0x8')]||{};}module[_0xc03d('0x9')]=ZohoAccount; \ No newline at end of file +var _0xc43e=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x5d94cb,_0x41f9f5){var _0x3fe216=function(_0x183473){while(--_0x183473){_0x5d94cb['push'](_0x5d94cb['shift']());}};_0x3fe216(++_0x41f9f5);}(_0xc43e,0x198));var _0xec43=function(_0x377fb0,_0x34bff6){_0x377fb0=_0x377fb0-0x0;var _0x5403db=_0xc43e[_0x377fb0];return _0x5403db;};'use strict';function ZohoAccount(_0xddfd7a){this['id']=_0xddfd7a['id']||0x0;this[_0xec43('0x0')]=_0xddfd7a['name']||'';this[_0xec43('0x1')]=_0xddfd7a[_0xec43('0x1')]||'';this[_0xec43('0x2')]=_0xddfd7a[_0xec43('0x2')]||'';this['zone']=_0xddfd7a[_0xec43('0x3')]||'';this[_0xec43('0x4')]=_0xddfd7a['clientId']||'';this[_0xec43('0x5')]=_0xddfd7a[_0xec43('0x5')]||'';this[_0xec43('0x6')]=_0xddfd7a[_0xec43('0x6')]||'';this[_0xec43('0x7')]=_0xddfd7a['code']||'';this['refreshToken']=_0xddfd7a[_0xec43('0x8')]||'';this[_0xec43('0x9')]=_0xddfd7a['Configurations']||{};}module[_0xec43('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1e41b57..a095e78 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 _0x1c9a=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util','moment','string','isNil','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x493528,_0x1d4651){var _0x7136cb=function(_0x466b5e){while(--_0x466b5e){_0x493528['push'](_0x493528['shift']());}};_0x7136cb(++_0x1d4651);}(_0x1c9a,0x98));var _0xa1c9=function(_0x2af579,_0x2fc4ea){_0x2af579=_0x2af579-0x0;var _0x5405b3=_0x1c9a[_0x2af579];return _0x5405b3;};'use strict';var util=require(_0xa1c9('0x0'));var _=require('lodash');var moment=require(_0xa1c9('0x1'));function checkNameSurname(_0x5c45c5,_0x1a771d,_0x1d631b){var _0x1a05a3='';if(!_['isNil'](_0x1a771d)&&_0xa1c9('0x2')===typeof _0x1a771d){_0x1a05a3+=_0x1a771d;}if(!_[_0xa1c9('0x3')](_0x1d631b)&&_0xa1c9('0x2')===typeof _0x1d631b){_0x1a05a3+='\x20'+_0x1d631b;}if(_0x1a05a3!==''){return _0x1a05a3;}return _0x5c45c5;}function Action(_0x3a4387,_0x572229,_0x144e91,_0x5448f2,_0x222624){this[_0xa1c9('0x4')]=_0x144e91||undefined;this[_0xa1c9('0x5')]=_0x3a4387['id'];this['queue']=_0x572229[_0xa1c9('0x6')];this[_0xa1c9('0x7')]=_0x572229[_0xa1c9('0x7')];this[_0xa1c9('0x8')]='queue';this[_0xa1c9('0x9')]=![];this[_0xa1c9('0xa')]=_[_0xa1c9('0x3')](_0x3a4387[_0xa1c9('0xb')])?undefined:_0x3a4387[_0xa1c9('0xb')][_0xa1c9('0x6')];this[_0xa1c9('0xc')]=this[_0xa1c9('0xa')]?util[_0xa1c9('0xd')](_0xa1c9('0xe'),this['membername']):_0x5448f2||undefined;this[_0xa1c9('0xf')]=checkNameSurname(_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x11')],_0x3a4387[_0xa1c9('0x10')][_0xa1c9('0x12')],_0x3a4387['Contact'][_0xa1c9('0x13')]);this[_0xa1c9('0x14')]=_0x3a4387[_0xa1c9('0x14')]||![];this[_0xa1c9('0x15')]=_0x3a4387[_0xa1c9('0x11')];this[_0xa1c9('0x16')]=_0x3a4387[_0xa1c9('0x16')];this[_0xa1c9('0x17')]=_0x3a4387[_0xa1c9('0x17')]||0x0;this[_0xa1c9('0x18')]=_0x3a4387['countcongestionretry']||0x0;this[_0xa1c9('0x19')]=_0x3a4387[_0xa1c9('0x19')]||0x0;this[_0xa1c9('0x1a')]=(_0x3a4387['countbusyretry']||0x0)+(_0x3a4387[_0xa1c9('0x18')]||0x0)+(_0x3a4387['countnoanswerretry']||0x0)+(_0x3a4387[_0xa1c9('0x1b')]||0x0)+(_0x3a4387[_0xa1c9('0x1c')]||0x0)+(_0x3a4387[_0xa1c9('0x1d')]||0x0)+(_0x3a4387['countmachineretry']||0x0)+(_0x3a4387[_0xa1c9('0x1e')]||0x0);this[_0xa1c9('0x1b')]=_0x3a4387[_0xa1c9('0x1b')]||0x0;this['countdropretry']=_0x3a4387[_0xa1c9('0x1c')]||0x0;this[_0xa1c9('0x1d')]=_0x3a4387['countabandonedretry']||0x0;this[_0xa1c9('0x1f')]=_0x3a4387[_0xa1c9('0x1f')]||0x0;this[_0xa1c9('0x1e')]=_0x3a4387['countagentrejectretry']||0x0;this[_0xa1c9('0x20')]=_0x3a4387[_0xa1c9('0x20')];this[_0xa1c9('0x21')]=_0x3a4387[_0xa1c9('0x21')];this[_0xa1c9('0x22')]=_0x3a4387['callbackat'];this['recallme']=_0x3a4387[_0xa1c9('0x23')];this['ContactId']=_0x3a4387[_0xa1c9('0x24')];this[_0xa1c9('0x25')]=_0x3a4387[_0xa1c9('0x25')];this[_0xa1c9('0x26')]=_[_0xa1c9('0x3')](_0x3a4387['Agent'])?_0x3a4387[_0xa1c9('0x26')]:_0x3a4387[_0xa1c9('0xb')]['id'];this[_0xa1c9('0x27')]=_0x3a4387['VoiceQueueId'];this[_0xa1c9('0x28')]='';this[_0xa1c9('0x29')]='';}Action[_0xa1c9('0x2a')]['getCaller']=function(){return util[_0xa1c9('0xd')](_0xa1c9('0x2b'),this['calleridname'],this[_0xa1c9('0x2c')]);};module['exports']=Action; \ No newline at end of file +var _0x1a37=['VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x203a0e,_0x1fbbfc){var _0x19c91b=function(_0xa5c21f){while(--_0xa5c21f){_0x203a0e['push'](_0x203a0e['shift']());}};_0x19c91b(++_0x1fbbfc);}(_0x1a37,0xb4));var _0x71a3=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x1a37[_0x11ce46];return _0x368a1e;};'use strict';var util=require(_0x71a3('0x0'));var _=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));function checkNameSurname(_0x28e254,_0x353cf0,_0x20d8a7){var _0x348395='';if(!_[_0x71a3('0x3')](_0x353cf0)&&_0x71a3('0x4')===typeof _0x353cf0){_0x348395+=_0x353cf0;}if(!_[_0x71a3('0x3')](_0x20d8a7)&&'string'===typeof _0x20d8a7){_0x348395+='\x20'+_0x20d8a7;}if(_0x348395!==''){return _0x348395;}return _0x28e254;}function Action(_0x11e8a8,_0x4f6b7a,_0xd09f7,_0x45050a,_0x231ea7){this[_0x71a3('0x5')]=_0xd09f7||undefined;this['idContact']=_0x11e8a8['id'];this['queue']=_0x4f6b7a['name'];this['type']=_0x4f6b7a[_0x71a3('0x6')];this[_0x71a3('0x7')]=_0x71a3('0x8');this[_0x71a3('0x9')]=![];this[_0x71a3('0xa')]=_[_0x71a3('0x3')](_0x11e8a8[_0x71a3('0xb')])?undefined:_0x11e8a8[_0x71a3('0xb')]['name'];this['channelAgent']=this['membername']?util[_0x71a3('0xc')](_0x71a3('0xd'),this[_0x71a3('0xa')]):_0x45050a||undefined;this[_0x71a3('0xe')]=checkNameSurname(_0x11e8a8[_0x71a3('0xf')][_0x71a3('0x10')],_0x11e8a8[_0x71a3('0xf')][_0x71a3('0x11')],_0x11e8a8[_0x71a3('0xf')][_0x71a3('0x12')]);this[_0x71a3('0x13')]=_0x11e8a8['active']||![];this[_0x71a3('0x14')]=_0x11e8a8[_0x71a3('0x10')];this['scheduledat']=_0x11e8a8['scheduledat'];this[_0x71a3('0x15')]=_0x11e8a8[_0x71a3('0x15')]||0x0;this[_0x71a3('0x16')]=_0x11e8a8[_0x71a3('0x16')]||0x0;this[_0x71a3('0x17')]=_0x11e8a8[_0x71a3('0x17')]||0x0;this['countglobal']=(_0x11e8a8[_0x71a3('0x15')]||0x0)+(_0x11e8a8[_0x71a3('0x16')]||0x0)+(_0x11e8a8['countnoanswerretry']||0x0)+(_0x11e8a8['countnosuchnumberretry']||0x0)+(_0x11e8a8[_0x71a3('0x18')]||0x0)+(_0x11e8a8[_0x71a3('0x19')]||0x0)+(_0x11e8a8[_0x71a3('0x1a')]||0x0)+(_0x11e8a8[_0x71a3('0x1b')]||0x0);this[_0x71a3('0x1c')]=_0x11e8a8['countnosuchnumberretry']||0x0;this[_0x71a3('0x18')]=_0x11e8a8[_0x71a3('0x18')]||0x0;this[_0x71a3('0x19')]=_0x11e8a8[_0x71a3('0x19')]||0x0;this[_0x71a3('0x1a')]=_0x11e8a8['countmachineretry']||0x0;this[_0x71a3('0x1b')]=_0x11e8a8['countagentrejectretry']||0x0;this[_0x71a3('0x1d')]=_0x11e8a8[_0x71a3('0x1d')];this[_0x71a3('0x1e')]=_0x11e8a8[_0x71a3('0x1e')];this[_0x71a3('0x1f')]=_0x11e8a8[_0x71a3('0x1f')];this['recallme']=_0x11e8a8[_0x71a3('0x20')];this[_0x71a3('0x21')]=_0x11e8a8[_0x71a3('0x21')];this[_0x71a3('0x22')]=_0x11e8a8[_0x71a3('0x22')];this['UserId']=_[_0x71a3('0x3')](_0x11e8a8[_0x71a3('0xb')])?_0x11e8a8['UserId']:_0x11e8a8[_0x71a3('0xb')]['id'];this['VoiceQueueId']=_0x11e8a8[_0x71a3('0x23')];this[_0x71a3('0x24')]='';this[_0x71a3('0x25')]='';}Action[_0x71a3('0x26')][_0x71a3('0x27')]=function(){return util[_0x71a3('0xc')](_0x71a3('0x28'),this[_0x71a3('0xe')],this[_0x71a3('0x29')]);};module[_0x71a3('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7101ccc..33978f4 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 _0x9c49=['outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','isTrunkReachable','active','SIP/%s','unmonitored','run','execRun','pick','getContactPreview','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','actionid','lookAgent','logLookAgent','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','cause','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','../../../config/environment','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','message','CAMPAIGN_STATUS','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','originated:\x20','dialAnswer','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','activeContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','[syncHangup][talking][decrement]','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','unlockAgent','incrementPreviewCounters','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION'];(function(_0x495b3d,_0x4d3da4){var _0x4cb329=function(_0xdef9f0){while(--_0xdef9f0){_0x495b3d['push'](_0x495b3d['shift']());}};_0x4cb329(++_0x4d3da4);}(_0x9c49,0x1c8));var _0x99c4=function(_0x3a1721,_0x5409d8){_0x3a1721=_0x3a1721-0x0;var _0x2c6285=_0x9c49[_0x3a1721];return _0x2c6285;};'use strict';var util=require(_0x99c4('0x0'));var _=require(_0x99c4('0x1'));var uuid=require('uuid');var moment=require(_0x99c4('0x2'));var Redis=require('ioredis');var config=require(_0x99c4('0x3'));var logger=require('../../../config/logger')(_0x99c4('0x4'));var loggerAction=require('../../../config/logger')(_0x99c4('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x99c4('0x6'));var Action=require(_0x99c4('0x7'));var ut=require('./util/util');var utils=require(_0x99c4('0x8'));config[_0x99c4('0x9')]=_['defaults'](config[_0x99c4('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x99c4('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x99c4('0xa')]=function(_0x6c32e1){this['tail']=this[_0x99c4('0xb')]?this[_0x99c4('0xb')][_0x99c4('0xc')](_0x6c32e1):_0x6c32e1();};function Preview(_0x482e1c){this[_0x99c4('0xd')]=new Sequence();this[_0x99c4('0xe')]=_0x482e1c[_0x99c4('0xf')];this[_0x99c4('0x10')]=_0x482e1c[_0x99c4('0x10')];this[_0x99c4('0x11')]={};this[_0x99c4('0x12')]=_0x482e1c['agents'];this[_0x99c4('0x13')]=0x0;ami['on'](_0x99c4('0x14'),this[_0x99c4('0x15')][_0x99c4('0x16')](this));ami['on']('hangup',this[_0x99c4('0x17')]['bind'](this));ami['on'](_0x99c4('0x18'),this[_0x99c4('0x19')]['bind'](this));ami['on'](_0x99c4('0x1a'),this['syncDialEnd']['bind'](this));ami['on'](_0x99c4('0x1b'),this[_0x99c4('0x1c')][_0x99c4('0x16')](this));ami['on'](_0x99c4('0x1d'),this[_0x99c4('0x1e')][_0x99c4('0x16')](this));ami['on'](_0x99c4('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x99c4('0x20'),this[_0x99c4('0x21')][_0x99c4('0x16')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x16cf06,_0x25d76f,_0x4f3fbf){io['to'](_0x16cf06)[_0x99c4('0x22')](_0x25d76f,_0x4f3fbf);}function emitVoiceQueueChannelRemove(_0x282959){logger[_0x99c4('0x23')](_0x99c4('0x24'),JSON[_0x99c4('0x25')](_0x282959));emit(util[_0x99c4('0x26')]('voice:queue:%s',_0x282959[_0x99c4('0x27')]),_0x99c4('0x28'),_0x282959);io[_0x99c4('0x22')](_0x99c4('0x29'),_0x282959);}function notSendMessagesQueue(_0x8add87){if(_0x8add87['sendMessageOneNotActive']){if(_0x8add87[_0x99c4('0x2a')]===0x0&&_0x8add87[_0x99c4('0x2b')]===0x0){_0x8add87[_0x99c4('0x2c')]=![];_0x8add87['available']=0x0;_0x8add87[_0x99c4('0x2d')]=0x0;_0x8add87[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')]['INACTIVE'];ut[_0x99c4('0x30')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x8add87[_0x99c4('0x27')]+_0x99c4('0x31'));}else{_0x8add87[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x32')];ut[_0x99c4('0x30')](_0x99c4('0x33'),_0x8add87['name']+_0x99c4('0x34'));}}}Preview[_0x99c4('0x35')][_0x99c4('0x36')]=function(){var _0x1ff165=this;setInterval(function(){_0x1ff165[_0x99c4('0x37')]();},0x7cf);};Preview['prototype'][_0x99c4('0x37')]=function(){var _0x1658e4=this[_0x99c4('0xe')];this[_0x99c4('0x13')]+=0x1;for(var _0x4c1100 in _0x1658e4){if(_0x1658e4[_0x99c4('0x38')](_0x4c1100)&&(_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x4')||_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x3a'))&&_0x1658e4[_0x4c1100][_0x99c4('0x3b')]===_0x99c4('0x3c')){if(this[_0x99c4('0x13')]>0x7){this[_0x99c4('0x13')]=0x0;this[_0x99c4('0x3d')]();}}if(_0x1658e4[_0x99c4('0x38')](_0x4c1100)&&_0x1658e4[_0x4c1100][_0x99c4('0x39')]===_0x99c4('0x4')&&_0x1658e4[_0x4c1100][_0x99c4('0x3b')]===_0x99c4('0x3c')){if(_0x1658e4[_0x4c1100][_0x99c4('0x3e')]){this[_0x99c4('0x3f')](_0x1658e4[_0x4c1100]);if(_0x1658e4[_0x4c1100][_0x99c4('0x40')])this[_0x99c4('0x41')](_0x1658e4[_0x4c1100]);}else{notSendMessagesQueue(_0x1658e4[_0x4c1100]);}}}};Preview['prototype'][_0x99c4('0x42')]=function(_0xf1a25e){var _0x13f495=this;this[_0x99c4('0xd')][_0x99c4('0xa')](function(){if(!_[_0x99c4('0x43')](_0x13f495[_0x99c4('0x11')][_0xf1a25e])){loggerAction[_0x99c4('0x23')](_0x99c4('0x44'),_0xf1a25e,'Queue',_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')],_0x99c4('0x46'),JSON[_0x99c4('0x25')](_0x13f495['campaignsPreview'][_0x13f495['actions'][_0xf1a25e][_0x99c4('0x45')]]['originated']),'pTalking:\x20',JSON[_0x99c4('0x25')](_0x13f495[_0x99c4('0xe')][_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]][_0x99c4('0x2b')]),JSON['stringify'](_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x47')]),JSON[_0x99c4('0x25')](_['pick'](_0x13f495[_0x99c4('0x11')][_0xf1a25e],['contactId','UserId','VoiceQueueId',_0x99c4('0x48')])));return ami[_0x99c4('0x49')]({'action':_0x99c4('0x4a'),'channel':_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x4b')]})[_0x99c4('0x4c')](function(_0xa8039c){if(_0xa8039c[_0x99c4('0x2e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x13f495[_0x99c4('0x11')][_0xf1a25e]){ut[_0x99c4('0x4d')](_0x13f495['campaignsPreview'][_0x13f495[_0x99c4('0x11')][_0xf1a25e]['queue']],_0x99c4('0x4e'));if(_0x13f495['actions'][_0xf1a25e][_0x99c4('0x47')]===!![]){ut[_0x99c4('0x4f')](_0x13f495['campaignsPreview'][_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]],'[clearZombieChannel]');ut[_0x99c4('0x50')](_0x99c4('0x51')+_0xf1a25e,_0x13f495[_0x99c4('0x11')][_0xf1a25e][_0x99c4('0x45')]);}ut[_0x99c4('0x50')](_0x99c4('0x52')+_0xf1a25e,_0x13f495['actions'][_0xf1a25e][_0x99c4('0x45')]);delete _0x13f495['actions'][_0xf1a25e];}},0x2328);}});}});};Preview[_0x99c4('0x35')][_0x99c4('0x3d')]=function(){var _0x4b466a=this;loggerAction['info'](_0x99c4('0x53'),_[_0x99c4('0x54')](this[_0x99c4('0x11')]));for(var _0x1f992a in this[_0x99c4('0x11')]){if(_0x4b466a[_0x99c4('0x11')][_0x99c4('0x38')](_0x1f992a)){_0x4b466a['clearZombieChannel'](_0x1f992a);}}};Preview[_0x99c4('0x35')]['recallMe']=function(_0x566cb7){var _0x585839=this;rpcDb['getContactRecallMe'](_0x566cb7['id'],ut[_0x99c4('0x55')](this[_0x99c4('0x12')]))[_0x99c4('0x56')](function(_0x2e4feb){if(!_['isNil'](_0x2e4feb)){for(var _0xbecee2=0x0;_0xbecee2<_0x2e4feb['length'];_0xbecee2+=0x1){if(ut[_0x99c4('0x57')](_0x2e4feb[_0xbecee2][_0x99c4('0x58')])<_0x566cb7[_0x99c4('0x59')]*0x3c){if(_0x2e4feb[_0xbecee2]['Agent']&&!_0x2e4feb[_0xbecee2][_0x99c4('0x5a')][_0x99c4('0x5b')]){_0x585839['run'](_0x2e4feb[_0xbecee2]['id'])['then'](ut[_0x99c4('0x5c')](_0x99c4('0x5d')))[_0x99c4('0x4c')](ut[_0x99c4('0x5c')]('[RecallMe]'));}else{rpcDb[_0x99c4('0x5e')](_0x2e4feb[_0xbecee2]['id']);}}else{var _0x4e1202=new Action(_0x2e4feb[_0xbecee2],_0x566cb7);_0x4e1202[_0x99c4('0x5f')]=moment()[_0x99c4('0x26')](_0x99c4('0x60'));_0x566cb7[_0x99c4('0x61')]+=0x1;ut[_0x99c4('0x62')](_0x4e1202,0x17,_0x99c4('0x63'));if(_0x566cb7[_0x99c4('0x64')]){rpcDb['rescheduleContactInQueue'](ut[_0x99c4('0x65')](_0x2e4feb[_0xbecee2]));rpcDb[_0x99c4('0x66')](_0x4e1202,_0x99c4('0x67'));}else{ut[_0x99c4('0x62')](_0x4e1202,0x16,_0x99c4('0x68'));rpcDb['createCustomerHistory'](_0x4e1202,'[HistoryRecallClose]');rpcDb[_0x99c4('0x69')](_0x4e1202,'[HistoryRecallClose]');}}}}})[_0x99c4('0x4c')](ut['logger2'](_0x99c4('0x6a')));};Preview[_0x99c4('0x35')][_0x99c4('0x3f')]=function(_0x2652fe){_0x2652fe[_0x99c4('0x2c')]=!![];if(ut['IsNotLoggedIn'](_0x2652fe[_0x99c4('0x6b')])){_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x6c')];}else if(!ut[_0x99c4('0x6d')](_0x2652fe[_0x99c4('0x3e')])){_0x2652fe[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x6e')];}else if(!this['isTrunkReachable'](_0x2652fe[_0x99c4('0x6f')])){if(!this['isTrunkReachable'](_0x2652fe[_0x99c4('0x70')])){_0x2652fe[_0x99c4('0x2e')]=utils['CAMPAIGN_STATUS'][_0x99c4('0x71')];}else{_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];}}else{_0x2652fe[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];}};Preview[_0x99c4('0x35')][_0x99c4('0x73')]=function(_0x52d620,_0x50b94f,_0x164da0){var _0x8ffc02=this;var _0x5ccbba=this[_0x99c4('0x11')][_0x50b94f];var _0x29d33f=this['campaignsPreview'][_0x5ccbba['queue']];var _0x4e72e1;var _0xdb2757=![];var _0x1b21c9=0x2;var _0x3fa372=0x3;if(_0x29d33f){switch(_0x164da0){case'1':_0x29d33f[_0x99c4('0x74')]+=0x1;_0x5ccbba[_0x99c4('0x75')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x0,_0x99c4('0x78'));ami['emit'](_0x99c4('0x79'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0x7b')));rpcDb[_0x99c4('0x66')](_0x5ccbba,'[callProgressDetectingCustomer][logNoSuch]');_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'0',_0x29d33f)[_0x99c4('0x56')](function(_0x3e9105){_0xdb2757=_0x3e9105[_0x99c4('0x7d')]==0x1;_0x1b21c9=_0x29d33f[_0x99c4('0x7e')];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut['cloneAction'](_0x5ccbba,0xf,'Global');rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0x81'));}else{if(_0x5ccbba[_0x99c4('0x75')]>=_0x29d33f[_0x99c4('0x82')]){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0x81'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0x75'),_0x29d33f[_0x99c4('0x7e')]),_0x5ccbba['unlockAgent'],_0x5ccbba[_0x99c4('0x85')]);}}delete this[_0x99c4('0x11')][_0x52d620['linkedid']];}else{_0x5ccbba[_0x99c4('0x75')]++;logger['info']('actioncountonusuch',_0x5ccbba[_0x99c4('0x75')]);logger[_0x99c4('0x23')]('id',_0x5ccbba['idContact']);_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba['idContact'],'field':{'countnosuchnumberretry':_0x5ccbba[_0x99c4('0x75')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0x87'):var _0x1ab087=moment()['format'](_0x99c4('0x60'));_0x5ccbba[_0x99c4('0x88')]=_0x1ab087;_0x5ccbba[_0x99c4('0x89')]=_0x1ab087;_0x5ccbba['dialAnswer']=!![];_0x29d33f[_0x99c4('0x2b')]+=0x1;logger[_0x99c4('0x23')](_0x99c4('0x8a'),_0x5ccbba[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x29d33f['name'],'pTalking:\x20',_0x29d33f[_0x99c4('0x2b')]);ami[_0x99c4('0x22')](_0x99c4('0x8d'),ut[_0x99c4('0x7a')](_0x5ccbba,'connect',this[_0x99c4('0xe')][_0x5ccbba[_0x99c4('0x45')]]));if(_0x29d33f[_0x99c4('0x8e')]){ami[_0x99c4('0x22')](_0x99c4('0x8f'),ut[_0x99c4('0x90')](_0x5ccbba));}break;case'16':ami['emit'](_0x99c4('0x91'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0x92'),this[_0x99c4('0xe')][_0x5ccbba[_0x99c4('0x45')]]));emitVoiceQueueChannelRemove(ut[_0x99c4('0x7a')](_0x5ccbba,'complete'));_0x29d33f['outboundAnswerCallsDay']+=0x1;_0x29d33f[_0x99c4('0x93')]+=0x1;_0x29d33f[_0x99c4('0x94')]+=0x1;ut['decrementTalkink'](_0x29d33f,_0x99c4('0x95'));_0x5ccbba['countglobal']=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x4,_0x99c4('0x96'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0x97'));rpcDb[_0x99c4('0x69')](_0x5ccbba,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x5ccbba);_0x29d33f[_0x99c4('0x98')]+=_0x5ccbba[_0x99c4('0x99')];_0x29d33f['sumBillable']+=_0x5ccbba['talktime'];logger[_0x99c4('0x23')](_0x99c4('0x9a'),_0x5ccbba['uniqueid'],_0x99c4('0x8c'),_0x29d33f[_0x99c4('0x27')],_0x99c4('0x9b'),_0x29d33f['pTalking']);delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;case _0x99c4('0x9d'):_0x29d33f[_0x99c4('0x9e')]+=0x1;_0x5ccbba[_0x99c4('0x9f')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut['totalGlobal'](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x5,_0x99c4('0xa0'));_0x1b21c9=_0x29d33f[_0x99c4('0xa1')];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];ami[_0x99c4('0x22')](_0x99c4('0xa2'),ut['buildObj'](_0x5ccbba,_0x99c4('0xa3')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xa4'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'5',_0x29d33f)[_0x99c4('0x56')](function(_0x22f70d){_0xdb2757=_0x22f70d[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut['cloneAction'](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xa6'));}else{if(_0x5ccbba[_0x99c4('0x9f')]>=_0x29d33f['dialBusyMaxRetry']){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xa4'));}else{rpcDb[_0x99c4('0x83')](ut['scheduledAt'](_0x5ccbba,_0x99c4('0x9f'),_0x29d33f['dialBusyRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0x9f')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countbusyretry':_0x5ccbba['countbusyretry']}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0xaa'):_0x29d33f[_0x99c4('0xab')]+=0x1;_0x5ccbba[_0x99c4('0xac')]+=0x1;_0x5ccbba['countglobal']=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x3,_0x99c4('0xad'));_0x1b21c9=_0x29d33f[_0x99c4('0xae')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];var _0x5c2423=ut[_0x99c4('0xaf')](_0x5ccbba,_0x29d33f);ami[_0x99c4('0x22')]('custom:agentnoanswer',_0x5c2423);rpcDb[_0x99c4('0x66')](_0x5ccbba,'[callProgressDetectingCustomer][logNoAnswer]');_0x8ffc02['verifyAdditionalPhones'](_0x5ccbba,'3',_0x29d33f)[_0x99c4('0x56')](function(_0x480ea8){_0xdb2757=_0x480ea8['additional']==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb['createCustomerFinal'](_0x4e72e1,_0x99c4('0xb1'));}else{if(_0x5ccbba['countnoanswerretry']>=_0x29d33f['dialNoAnswerMaxRetry']){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xb2'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xac'),_0x29d33f[_0x99c4('0xae')]),_0x5ccbba['unlockAgent'],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba['countnoanswerretry']}})[_0x99c4('0x56')](function(){_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});break;case _0x99c4('0xb3'):_0x29d33f[_0x99c4('0xb4')]+=0x1;_0x5ccbba[_0x99c4('0xb5')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x8,_0x99c4('0xb6'));_0x1b21c9=_0x29d33f[_0x99c4('0xb7')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];ami[_0x99c4('0x22')](_0x99c4('0xb8'),ut['buildObj'](_0x5ccbba,'congestion'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xb9'));_0x8ffc02['verifyAdditionalPhones'](_0x5ccbba,'8',_0x29d33f)[_0x99c4('0x56')](function(_0x473118){_0xdb2757=_0x473118[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xba'));}else{if(_0x5ccbba[_0x99c4('0xb5')]>=_0x29d33f['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xb9'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,'countcongestionretry',_0x29d33f[_0x99c4('0xa1')]),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba['activeContact']);}}}else{_0x5ccbba[_0x99c4('0xb5')]++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countcongestionretry':_0x5ccbba[_0x99c4('0xb5')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case _0x99c4('0xbb'):_0x29d33f[_0x99c4('0xbc')]+=0x1;_0x5ccbba[_0x99c4('0xbd')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x14,'AgentReject');_0x1b21c9=_0x29d33f['dialAgentRejectRetryFrequency'];_0x3fa372=_0x29d33f[_0x99c4('0x7f')];ami[_0x99c4('0x22')](_0x99c4('0xbe'),ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0xbf')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xc0'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'20',_0x29d33f)[_0x99c4('0x56')](function(_0x38240d){_0xdb2757=_0x38240d['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0x14,_0x99c4('0xc1'));rpcDb['createCustomerFinal'](_0x4e72e1,_0x99c4('0xc2'));}else{if(_0x5ccbba['countagentrejectretry']>=_0x29d33f[_0x99c4('0xc3')]){rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xc2'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xbd'),_0x29d33f['dialAgentRejectRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});break;case'ABANDONED':_0x29d33f[_0x99c4('0xc4')]+=0x1;_0x5ccbba['countabandonedretry']+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut['totalGlobal'](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0xb,_0x99c4('0xc5'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xc6'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'11',_0x29d33f)[_0x99c4('0x56')](function(_0x22270b){_0xdb2757=_0x22270b[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xc6'));}else{if(_0x5ccbba[_0x99c4('0xc7')]>=_0x29d33f[_0x99c4('0xc8')]){rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xc6'));}else{rpcDb[_0x99c4('0x83')](ut[_0x99c4('0x84')](_0x5ccbba,_0x99c4('0xc9'),_0x29d33f['dialAbandonedRetryFrequency']),_0x5ccbba[_0x99c4('0xa7')],_0x5ccbba[_0x99c4('0x85')]);}}}else{_0x5ccbba['countnoanswerretry']++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});break;case'18':_0x29d33f['outboundUnknownCallsDay']+=0x1;_0x5ccbba[_0x99c4('0xca')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x12,_0x52d620[_0x99c4('0xcb')]||_0x52d620[_0x99c4('0xcc')]);ami[_0x99c4('0x22')]('custom:amd',ut[_0x99c4('0x7a')](_0x5ccbba,_0x99c4('0xcd')));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xce'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'18',_0x29d33f)[_0x99c4('0x56')](function(_0x3877b2){_0xdb2757=_0x3877b2['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f['dialGlobalMaxRetry']){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0x12,'Global');rpcDb[_0x99c4('0x69')](_0x4e72e1,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xce'));}}else{_0x5ccbba['countnoanswerretry']++;_0x8ffc02[_0x99c4('0xa8')]({'id':_0x5ccbba['idContact'],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});});}});delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;case'19':_0x29d33f[_0x99c4('0xcf')]+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0x13,_0x52d620[_0x99c4('0xcb')]||_0x52d620[_0x99c4('0xcc')]);ami[_0x99c4('0x22')](_0x99c4('0xd0'),ut[_0x99c4('0x7a')](_0x5ccbba,'amd'));rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xd1'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'18',_0x29d33f)[_0x99c4('0x56')](function(_0x1bd01f){_0xdb2757=_0x1bd01f[_0x99c4('0x7d')]==0x1;if(!_0xdb2757){if(ut['totalGlobal'](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,_0x99c4('0xd1'));}else{rpcDb[_0x99c4('0x69')](_0x5ccbba,_0x99c4('0xd1'));}}else{_0x5ccbba[_0x99c4('0xac')]++;_0x8ffc02['incrementPreviewCounters']({'id':_0x5ccbba[_0x99c4('0xa9')],'field':{'countnoanswerretry':_0x5ccbba[_0x99c4('0xac')]}})[_0x99c4('0x56')](function(){_0x8ffc02[_0x99c4('0x86')](_0x5ccbba,_0x1b21c9,_0x3fa372)[_0x99c4('0x56')](function(){});});}});delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];break;default:if(_0x5ccbba[_0x99c4('0x47')]){ut[_0x99c4('0x4f')](_0x29d33f,_0x99c4('0xd2'));ut['loggerError'](_0x99c4('0xd3')+_0x29d33f[_0x99c4('0x27')],_0x52d620);}_0x29d33f['outboundUnknownCallsDay']+=0x1;_0x5ccbba[_0x99c4('0x76')]=ut[_0x99c4('0x77')](_0x5ccbba);ut[_0x99c4('0x62')](_0x5ccbba,0xc,_0x52d620[_0x99c4('0xcb')]||_0x52d620['dialstatus']);_0x1b21c9=_0x29d33f[_0x99c4('0xd4')];_0x3fa372=_0x29d33f['callAdditionalPhoneAfterMin'];rpcDb[_0x99c4('0x66')](_0x5ccbba,_0x99c4('0xd5'));_0x8ffc02[_0x99c4('0x7c')](_0x5ccbba,'20',_0x29d33f)['then'](function(_0x581fc4){_0xdb2757=_0x581fc4['additional']==0x1;if(!_0xdb2757){if(ut[_0x99c4('0x77')](_0x5ccbba)>=_0x29d33f[_0x99c4('0x80')]){_0x4e72e1=ut[_0x99c4('0xb0')](_0x5ccbba,0xf,_0x99c4('0xa5'));rpcDb[_0x99c4('0x69')](_0x4e72e1,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x5ccbba,_0x99c4('0xd6'));}delete this['actions'][_0x52d620[_0x99c4('0x9c')]];}else{_0x8ffc02['swapAdditionalPhones'](_0x5ccbba,_0x1b21c9,_0x3fa372)['then'](function(){});}});}if(!(_0x5ccbba[_0x99c4('0x47')]&&_0x164da0==='16')){ut[_0x99c4('0x4d')](_0x29d33f,_0x99c4('0xd7'));logger['info'](_0x99c4('0xd8'),_0x5ccbba[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x29d33f[_0x99c4('0x27')],_0x99c4('0x46'),_0x29d33f['originated']);}if(_0x164da0!=='ANSWER'){delete this[_0x99c4('0x11')][_0x52d620[_0x99c4('0x9c')]];delete this[_0x99c4('0x11')][_0x52d620['destlinkedid']];}_0x29d33f[_0x99c4('0xd9')]=!![];}};Preview[_0x99c4('0x35')][_0x99c4('0xda')]=function(_0x304ceb,_0x1bd526,_0x43562f){if(_['isUndefined'](_0x1bd526)&&_0x99c4('0xdb')!==typeof _0x1bd526){return;}if(_[_0x99c4('0xdc')](_0x43562f)&&_0x99c4('0xdb')!==typeof _0x43562f){return;}switch(_0x43562f[_0x99c4('0xdd')]){case'0':ut[_0x99c4('0xde')](_0x304ceb,0x0,_0x99c4('0x78'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe0'));break;case'3':ut[_0x99c4('0xde')](_0x304ceb,0x3,_0x99c4('0xad'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe1'));break;case'5':ut[_0x99c4('0xde')](_0x304ceb,0x5,'Busy');rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe2'));break;case'8':ut[_0x99c4('0xde')](_0x304ceb,0x8,_0x99c4('0xb6'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe3'));break;case'22':ut[_0x99c4('0xde')](_0x304ceb,0x16,_0x99c4('0xe4'));rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe5'));break;default:ut[_0x99c4('0xde')](_0x304ceb,0xc,_0x43562f[_0x99c4('0xdd')]);rpcDb[_0x99c4('0xdf')](_0x304ceb,_0x99c4('0xe3'));}ut[_0x99c4('0x4d')](_0x1bd526,_0x99c4('0xe6'));logger[_0x99c4('0x23')](_0x99c4('0xe7'),_0x304ceb[_0x99c4('0x8b')],_0x99c4('0x8c'),_0x1bd526[_0x99c4('0x27')],_0x99c4('0x46'),_0x1bd526['originated']);delete this[_0x99c4('0x11')][_0x304ceb[_0x99c4('0x8b')]];};Preview['prototype'][_0x99c4('0x7c')]=function(_0x52f991,_0x2c6664,_0x21f0fe){return cmHopperAdditionalPhone[_0x99c4('0x7c')](_0x52f991,_0x2c6664,_0x21f0fe)[_0x99c4('0x4c')](logger[_0x99c4('0x23')](_0x99c4('0xe8')));};Preview[_0x99c4('0x35')][_0x99c4('0x86')]=function(_0x1344b4,_0x464918,_0x312af0){return cmHopperAdditionalPhone[_0x99c4('0x86')](_0x1344b4,_0x464918,_0x312af0)[_0x99c4('0x4c')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0x99c4('0x35')][_0x99c4('0xa8')]=function(_0xa8b313){return Promise[_0x99c4('0xe9')]()[_0x99c4('0x56')](cmHopperAdditionalPhone[_0x99c4('0xa8')](_0xa8b313))[_0x99c4('0x4c')](logger[_0x99c4('0x23')](_0x99c4('0xea')));};Preview['prototype'][_0x99c4('0xeb')]=function(_0x586087,_0x4956fe,_0x4b1109,_0x10f0fd,_0x2b4bbe){var _0x52f500=this;return new Promise(function(_0x3e7247,_0x58ddff){if(_[_0x99c4('0x43')](_0x4956fe)||_[_0x99c4('0x43')](_0x4956fe['Contact'])||_[_0x99c4('0x43')](_0x4956fe[_0x99c4('0xec')])||_['isNil'](_0x4956fe[_0x99c4('0xed')])){_0x58ddff(ut['message'](_0x99c4('0xee'),_0x10f0fd,_0x2b4bbe));return;}var _0x5b363a=uuid['v4']();var _0x37b5c4=_0x52f500[_0x99c4('0xe')][_0x4956fe[_0x99c4('0xef')][_0x99c4('0x27')]];var _0x254e9d=_0x4b1109?_0x52f500[_0x99c4('0x12')][_0x4b1109]['id']:undefined;_0x52f500[_0x99c4('0x11')][_0x5b363a]=new Action(_0x4956fe,_0x37b5c4,_0x5b363a,_0x4b1109,_0x254e9d);var _0x8c7947=_0x52f500[_0x99c4('0x11')][_0x5b363a];_0x8c7947[_0x99c4('0xa7')]=_0x10f0fd;_0x8c7947[_0x99c4('0x85')]=_0x2b4bbe;_0x8c7947['lookAgent']=_0x4b1109;if(_[_0x99c4('0xf0')](_0x586087)){_0x52f500[_0x99c4('0xf1')](_0x8c7947,_0x37b5c4,_0x4956fe,_0x4b1109)[_0x99c4('0x56')](function(_0x5b7bd5){logger['info'](_0x99c4('0xf2'),'Queue:\x20'+_0x8c7947[_0x99c4('0x45')]+_0x99c4('0xf3')+_0x8c7947[_0x99c4('0xa9')],JSON['stringify'](_0x5b7bd5));ami[_0x99c4('0x22')](_0x99c4('0xf4'),ut['buildObj'](_0x8c7947,_0x99c4('0xf5'),_0x52f500[_0x99c4('0xe')][_0x8c7947[_0x99c4('0x45')]]));_0x3e7247(ut[_0x99c4('0x2e')](_0x99c4('0xf6')));})['catch'](function(_0x414e6a){ut[_0x99c4('0x30')]('[Preview][execCall][failure]',_0x414e6a);_0x58ddff(ut[_0x99c4('0x2e')](_0x99c4('0xf7'),_0x10f0fd,_0x2b4bbe));});}else{_0x37b5c4['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x8c7947);rpcDb[_0x99c4('0xf8')](_0x8c7947,_0x99c4('0xf9'));delete _0x52f500['actions'][_0x5b363a];_0x58ddff(ut['message']('Contact\x20in\x20black\x20List',_0x10f0fd,_0x2b4bbe));}});};Preview[_0x99c4('0x35')][_0x99c4('0xfa')]=function(_0x2d3644){return!_['isNil'](_0x2d3644)&&!_[_0x99c4('0x43')](_0x2d3644[_0x99c4('0x27')])&&!_['isNil'](_0x2d3644['active'])&&_0x2d3644[_0x99c4('0xfb')]&&!_[_0x99c4('0x43')](this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])])&&!_[_0x99c4('0x43')](this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])][_0x99c4('0x4a')])&&(this[_0x99c4('0x10')][util['format'](_0x99c4('0xfc'),_0x2d3644['name'])][_0x99c4('0x4a')]==='reachable'||this[_0x99c4('0x10')][util[_0x99c4('0x26')](_0x99c4('0xfc'),_0x2d3644[_0x99c4('0x27')])][_0x99c4('0x4a')]===_0x99c4('0xfd'));};Preview['prototype'][_0x99c4('0xfe')]=function(_0x3dc2b4,_0x9a8a52){return this[_0x99c4('0xff')](_0x3dc2b4,_0x9a8a52)[_0x99c4('0x56')](function(_0x1f9ec0){return _[_0x99c4('0x100')](_0x1f9ec0,['message']);})['catch'](function(_0x47cbbe){if(_0x47cbbe['unlock']){rpcDb['unlockContact'](_0x3dc2b4);}if(_0x47cbbe['active']){rpcDb['disableContact'](_0x3dc2b4);}throw _[_0x99c4('0x100')](_0x47cbbe,[_0x99c4('0x2e')]);});};Preview[_0x99c4('0x35')][_0x99c4('0xff')]=function(_0x50d3c0,_0x7430f8){var _0x3f3d82=this;var _0x139d02,_0x1d1412;return rpcDb[_0x99c4('0x101')](_0x50d3c0)['then'](function(_0x54bba0){if(!_[_0x99c4('0x43')](_0x54bba0[0x0])){_0x1d1412=_0x54bba0[0x0]['recallme']?![]:!![];_0x139d02=_0x54bba0[0x0]['recallme']?!![]:![];_0x139d02=_0x7430f8?!![]:_0x139d02;}var _0x579e6d=_0x3f3d82[_0x99c4('0x102')](_0x54bba0);if(_0x579e6d['isValid']){rpcDb[_0x99c4('0x103')](_[_0x99c4('0x100')](_0x54bba0[0x0],[_0x99c4('0xed'),'phone']))[_0x99c4('0x56')](function(_0x1fe180){_0x3f3d82[_0x99c4('0xeb')](_0x1fe180,_0x54bba0[0x0],_0x7430f8,_0x1d1412,_0x139d02)[_0x99c4('0x56')](function(_0x399daa){return _0x399daa;})[_0x99c4('0x4c')](function(_0x359165){throw _0x359165;});})[_0x99c4('0x4c')](function(_0x179ad6){ut[_0x99c4('0x30')](_0x99c4('0x104'),_0x179ad6);throw ut['message'](_0x99c4('0x105'),_0x1d1412,_0x139d02);});}else{throw ut[_0x99c4('0x2e')](_0x579e6d[_0x99c4('0x2e')],_0x1d1412,_0x139d02);}})[_0x99c4('0x4c')](function(_0x319c86){ut[_0x99c4('0x30')]('[Preview][getContactPreview]',_0x319c86);throw ut[_0x99c4('0x2e')](_0x99c4('0x105'),![],!![]);});};Preview[_0x99c4('0x35')][_0x99c4('0x102')]=function(_0x31323c){if(_['isNil'](_0x31323c)||_[_0x99c4('0xf0')](_0x31323c)||!_[_0x99c4('0x43')](_0x31323c[0x0]['Agent'])&&_[_0x99c4('0x43')](_0x31323c[0x0][_0x99c4('0x5a')][_0x99c4('0x27')])){ut['logger'](_0x99c4('0x106'),_0x31323c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2bdbe5=this[_0x99c4('0xe')][_0x31323c[0x0][_0x99c4('0xef')][_0x99c4('0x27')]];_0x2bdbe5[_0x99c4('0x2e')]=utils[_0x99c4('0x2f')][_0x99c4('0x72')];if(_[_0x99c4('0x43')](_0x2bdbe5)){ut['logger'](_0x99c4('0x107'),_0x2bdbe5);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2bdbe5['Trunk'])){ut[_0x99c4('0x30')](_0x99c4('0x108'),_0x99c4('0x109')+_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10a'));if(!this['isTrunkReachable'](_0x2bdbe5[_0x99c4('0x70')])){ut[_0x99c4('0x30')](_0x99c4('0x108'),_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10b'));return{'isValid':![],'message':_0x99c4('0x10c')};}}if(!ut[_0x99c4('0x6d')](_0x2bdbe5[_0x99c4('0x3e')])){ut[_0x99c4('0x30')]('[Preview][validateContact][Campaign\x20Active]',_0x2bdbe5[_0x99c4('0x27')]+_0x99c4('0x10d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2bdbe5['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x99c4('0x35')][_0x99c4('0xf1')]=function(_0x309640,_0xd62142,_0x2fc39e,_0x5787d2){var _0x4ffb54=this;return new Promise(function(_0x4879c5,_0x92e305){var _0x4f0291=_0x309640[_0x99c4('0x8b')];var _0x3e4407=_0x4ffb54[_0x99c4('0xfa')](_0xd62142[_0x99c4('0x6f')])?util[_0x99c4('0x26')](_0x99c4('0x10e'),_0xd62142[_0x99c4('0x6f')][_0x99c4('0x27')],_[_0x99c4('0x43')](_0xd62142[_0x99c4('0x10f')])?'':_0xd62142[_0x99c4('0x10f')][_0x99c4('0x110')]()||'',_0xd62142['dialCutDigit']>0x0?_0x2fc39e[_0x99c4('0xec')][_0x99c4('0x111')](_0xd62142['dialCutDigit']):_0x2fc39e[_0x99c4('0xec')]):util[_0x99c4('0x26')](_0x99c4('0x10e'),_[_0x99c4('0x43')](_0xd62142['TrunkBackup'])?_0xd62142[_0x99c4('0x6f')][_0x99c4('0x27')]:_0xd62142[_0x99c4('0x70')]['name'],_['isNil'](_0xd62142[_0x99c4('0x10f')])?'':_0xd62142[_0x99c4('0x10f')][_0x99c4('0x110')]()||'',_0xd62142['dialCutDigit']>0x0?_0x2fc39e[_0x99c4('0xec')]['substring'](_0xd62142[_0x99c4('0x112')]):_0x2fc39e['phone']);var _0x1a25a8=_0x4ffb54['isTrunkReachable'](_0xd62142[_0x99c4('0x6f')])?ut[_0x99c4('0x113')](_0xd62142[_0x99c4('0x6f')][_0x99c4('0x114')],_0xd62142['dialOriginateCallerIdName'],_0xd62142['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99c4('0x115')](_0xd62142[_0x99c4('0x116')],_0xd62142[_0x99c4('0x117')]):_0xd62142[_0x99c4('0x116')]):ut[_0x99c4('0x113')](_[_0x99c4('0x43')](_0xd62142[_0x99c4('0x70')])?_0xd62142[_0x99c4('0x6f')][_0x99c4('0x114')]:_0xd62142[_0x99c4('0x70')][_0x99c4('0x114')],_0xd62142['dialOriginateCallerIdName'],_0xd62142['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99c4('0x115')](_0xd62142['dialOriginateCallerIdNumber'],_0xd62142[_0x99c4('0x117')]):_0xd62142[_0x99c4('0x116')]);if(_0x1a25a8){_0x309640[_0x99c4('0x118')]=ut[_0x99c4('0x119')](_0x1a25a8);_0x309640[_0x99c4('0x11a')]=ut[_0x99c4('0x11b')](_0x1a25a8);}var _0xa90a91=ut[_0x99c4('0x11c')](_0xd62142,_0x2fc39e,_0x3e4407,_0x1a25a8,_0x4f0291,_0x309640);var _0x497192=utils[_0x99c4('0x11d')](_0x2fc39e[_0x99c4('0x11e')]);Object[_0x99c4('0x11f')](_0xa90a91,_0x497192);_[_0x99c4('0x120')](_0x309640,ut[_0x99c4('0x121')](_0xa90a91));_0x309640['starttime']=moment()[_0x99c4('0x26')]('YYYY-MM-DD\x20HH:mm:ss');_0xd62142[_0x99c4('0x122')]=_0xa90a91;var _0x4a212e=ut[_0x99c4('0x123')](_0x309640,_0xd62142,_0xa90a91,_0x309640[_0x99c4('0x85')],_0x5787d2);return ami[_0x99c4('0x49')](_0x4a212e)['then'](function(_0x3b793d){_0xd62142[_0x99c4('0x2a')]+=0x1;logger[_0x99c4('0x23')](_0x99c4('0x124'),_0x4f0291,_0x99c4('0x8c'),_0xd62142['name'],_0x99c4('0x46'),_0xd62142['originated']);_0x4879c5(_0x3b793d);})[_0x99c4('0x4c')](function(_0x548a05){ut[_0x99c4('0xde')](_0x309640,0xe,'OriginateError');rpcDb[_0x99c4('0xdf')](_0x309640,'[originateFailure][logOriginateFailure]');_0x92e305(_0x548a05);});});};Preview['prototype'][_0x99c4('0x1c')]=function(_0x1df6f5){if(this[_0x99c4('0x11')][_0x1df6f5['linkedid']]){this[_0x99c4('0x11')][_0x1df6f5[_0x99c4('0x9c')]][_0x99c4('0x4b')]=_0x1df6f5[_0x99c4('0x4b')];}};Preview[_0x99c4('0x35')][_0x99c4('0x15')]=function(_0x383875){var _0x1cb947=this;var _0x234d3b=this[_0x99c4('0x11')][_0x383875[_0x99c4('0x125')]];if(_0x234d3b){if(_0x234d3b[_0x99c4('0x126')]&&this[_0x99c4('0x12')][_0x234d3b[_0x99c4('0x126')]]){ut[_0x99c4('0x127')](_0x234d3b,this[_0x99c4('0x12')][_0x234d3b[_0x99c4('0x126')]]['name'],this[_0x99c4('0x12')][_0x234d3b['lookAgent']]['id']);}var _0x4a91a4=_['clone'](_0x234d3b);_0x4a91a4['responsetime']=moment()[_0x99c4('0x26')](_0x99c4('0x60'));var _0xdaca6c=_0x1cb947[_0x99c4('0xe')][_0x234d3b[_0x99c4('0x45')]];if(ut[_0x99c4('0x128')](_0x383875[_0x99c4('0x129')])){if(_0x234d3b[_0x99c4('0xa7')]){rpcDb[_0x99c4('0x12a')](_0x234d3b[_0x99c4('0xa9')]);}if(_0x234d3b[_0x99c4('0x85')]){rpcDb[_0x99c4('0x5e')](_0x234d3b['idContact']);}ami['emit'](_0x99c4('0x12b'),ut[_0x99c4('0x7a')](_0x234d3b,_0x99c4('0x12c'),this[_0x99c4('0xe')][_0x234d3b[_0x99c4('0x45')]]));this[_0x99c4('0xda')](_0x4a91a4,_0xdaca6c,_0x383875);}else{_0x234d3b['starttime']=moment()[_0x99c4('0x26')](_0x99c4('0x60'));ut[_0x99c4('0xde')](_0x4a91a4,0x4,_0x99c4('0x96'));rpcDb[_0x99c4('0xdf')](_0x4a91a4,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x99c4('0x35')][_0x99c4('0x17')]=function(_0x1fdab7){var _0x39ba89=this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]];var _0x233949;if(_0x39ba89){_0x233949=this[_0x99c4('0xe')][_0x39ba89[_0x99c4('0x45')]];logger['info']('[syncHangup][talking]',_0x1fdab7[_0x99c4('0x9c')],'\x20Queue',_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949['pTalking']);}if(this['actions'][_0x1fdab7[_0x99c4('0x9c')]]&&_0x1fdab7[_0x99c4('0x9c')]!==_0x1fdab7[_0x99c4('0x8b')]){if(_0x1fdab7[_0x99c4('0x12d')]==='16'&&this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')]);}else if(this['actions'][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){logger[_0x99c4('0x23')]('[syncHangup][talking][cause]',_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')],_0x99c4('0x8c'),_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949['pTalking']);this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7[_0x99c4('0x12d')]);}}else if(_0x39ba89&&_[_0x99c4('0x43')](_0x39ba89[_0x99c4('0x12e')])&&_0x233949['dialQueueProject']&&_0x1fdab7[_0x99c4('0x9c')]===_0x1fdab7['uniqueid']&&_[_0x99c4('0x43')](_0x1fdab7[_0x99c4('0xdd')])&&_0x1fdab7[_0x99c4('0x12d')]==='16'&&_0x1fdab7[_0x99c4('0x12f')]==='6'&&_['isUndefined'](_0x39ba89['transfer'])){if(_0x39ba89[_0x99c4('0xa7')]){rpcDb[_0x99c4('0x12a')](_0x39ba89[_0x99c4('0xa9')]);}if(_0x39ba89[_0x99c4('0x85')]){rpcDb[_0x99c4('0x5e')](_0x39ba89[_0x99c4('0xa9')]);}_0x1fdab7[_0x99c4('0xdd')]='22';this['callProgressDetectingAgent'](_0x39ba89,_0x233949,_0x1fdab7);}else if(_0x39ba89&&_0x39ba89[_0x99c4('0x130')]){if(_0x1fdab7[_0x99c4('0x12d')]==='16'&&this[_0x99c4('0x11')][_0x1fdab7[_0x99c4('0x9c')]][_0x99c4('0x47')]){logger[_0x99c4('0x23')](_0x99c4('0x131'),_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7['cause'],_0x99c4('0x8c'),_0x233949[_0x99c4('0x27')],_0x99c4('0x9b'),_0x233949[_0x99c4('0x2b')]);this[_0x99c4('0x73')](_0x1fdab7,_0x1fdab7[_0x99c4('0x9c')],_0x1fdab7['cause']);}else if(this[_0x99c4('0x11')][_0x1fdab7['linkedid']]['dialAnswer']){logger[_0x99c4('0x23')]('[syncHangup][talking][cause]',_0x1fdab7['linkedid'],_0x1fdab7[_0x99c4('0x12d')],_0x99c4('0x8c'),_0x233949['name'],_0x99c4('0x9b'),_0x233949[_0x99c4('0x2b')]);this['callProgressDetectingCustomer'](_0x1fdab7,_0x1fdab7['linkedid'],_0x1fdab7['cause']);}}};Preview[_0x99c4('0x35')][_0x99c4('0x132')]=function(_0x577fcb){if(this[_0x99c4('0x11')][_0x577fcb[_0x99c4('0x133')]]&&_0x577fcb[_0x99c4('0x133')]!==_0x577fcb['destuniqueid']){this[_0x99c4('0x73')](_0x577fcb,_0x577fcb[_0x99c4('0x133')],_0x577fcb['dialstatus']);}};Preview[_0x99c4('0x35')][_0x99c4('0x19')]=function(_0x30f125){if(this[_0x99c4('0x11')][_0x30f125[_0x99c4('0x9c')]]&&_0x30f125[_0x99c4('0x9c')]!==_0x30f125[_0x99c4('0x8b')]&&!this[_0x99c4('0x11')][_0x30f125[_0x99c4('0x9c')]][_0x99c4('0x47')]){if(_0x30f125[_0x99c4('0x12d')]==='1'){this[_0x99c4('0x73')](_0x30f125,_0x30f125[_0x99c4('0x9c')],_0x30f125['cause']);}}};Preview[_0x99c4('0x35')]['addVariable']=function(_0xcbde57,_0x18fef7,_0x164b8c){if(this[_0x99c4('0x11')][_0xcbde57]){if(_['isNil'](this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')])){this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')]={};}this[_0x99c4('0x11')][_0xcbde57][_0x99c4('0x122')][_0x18fef7]=_0x164b8c;}};Preview[_0x99c4('0x35')]['syncVarSet']=function(_0x4f8522){try{if(!_[_0x99c4('0x43')](_0x4f8522)){if(ut['filterKey'](_[_0x99c4('0x134')](_0x4f8522[_0x99c4('0x135')])[0x0])){this[_0x99c4('0x136')](_0x4f8522[_0x99c4('0x8b')],_[_0x99c4('0x134')](_0x4f8522[_0x99c4('0x135')])[0x0],_0x4f8522[_0x99c4('0x137')]);}}}catch(_0x3cc10e){logger[_0x99c4('0x138')](_0x99c4('0x139'),util[_0x99c4('0x13a')](_0x3cc10e,{'showHidden':![],'depth':null}));}};Preview[_0x99c4('0x35')]['syncAttendedTransfer']=function(_0x26b78d){if(_0x26b78d){if(this['actions'][_0x26b78d[_0x99c4('0x13b')]]){this[_0x99c4('0x11')][_0x26b78d[_0x99c4('0x13b')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x5b76d9){if(_0x5b76d9){if(this[_0x99c4('0x11')][_0x5b76d9[_0x99c4('0x13c')]]){this[_0x99c4('0x11')][_0x5b76d9[_0x99c4('0x13c')]]['transfer']=!![];}}};module[_0x99c4('0x13d')]=Preview; \ No newline at end of file +var _0x312d=['[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','actions','originateresponse','syncOriginateResponse','hangup','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','type','clearZombieChannels','outbound','dialActive','setMessage','recallMe','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][Preview]','size','clearZombieChannel','getContactRecallMe','agentReadyId','agents','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','answered','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','additional','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','isNil','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','trunks','SIP/%s','reachable','unmonitored','unlock','unlockContact','active','execRun','getContactPreview','recallme','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x312d,0x14d));var _0xd312=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x312d[_0x3826ad];return _0x17b900;};'use strict';var util=require(_0xd312('0x0'));var _=require(_0xd312('0x1'));var uuid=require(_0xd312('0x2'));var moment=require(_0xd312('0x3'));var Redis=require(_0xd312('0x4'));var config=require(_0xd312('0x5'));var logger=require(_0xd312('0x6'))(_0xd312('0x7'));var loggerAction=require(_0xd312('0x6'))(_0xd312('0x8'));var ami=require('../ami');var rpcDb=require(_0xd312('0x9'));var cmHopperAdditionalPhone=require(_0xd312('0xa'));var Action=require('./action');var ut=require(_0xd312('0xb'));var utils=require(_0xd312('0xc'));config['redis']=_[_0xd312('0xd')](config[_0xd312('0xe')],{'host':_0xd312('0xf'),'port':0x18eb});var io=require(_0xd312('0x10'))(new Redis(config[_0xd312('0xe')]));var Sequence=function(){};Sequence[_0xd312('0x11')][_0xd312('0x12')]=function(_0x4ba2e7){this['tail']=this['tail']?this[_0xd312('0x13')][_0xd312('0x14')](_0x4ba2e7):_0x4ba2e7();};function Preview(_0x2dff45){this[_0xd312('0x15')]=new Sequence();this[_0xd312('0x16')]=_0x2dff45['voiceQueues'];this['trunks']=_0x2dff45['trunks'];this[_0xd312('0x17')]={};this['agents']=_0x2dff45['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xd312('0x18'),this[_0xd312('0x19')]['bind'](this));ami['on'](_0xd312('0x1a'),this['syncHangup'][_0xd312('0x1b')](this));ami['on']('hanguprequest',this[_0xd312('0x1c')][_0xd312('0x1b')](this));ami['on'](_0xd312('0x1d'),this[_0xd312('0x1e')]['bind'](this));ami['on'](_0xd312('0x1f'),this[_0xd312('0x20')]['bind'](this));ami['on'](_0xd312('0x21'),this['syncVarSet']['bind'](this));ami['on'](_0xd312('0x22'),this[_0xd312('0x23')][_0xd312('0x1b')](this));ami['on'](_0xd312('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xd312('0x25')](this[_0xd312('0x16')]);}function emit(_0x224d5a,_0x21810b,_0x2d0b4f){io['to'](_0x224d5a)[_0xd312('0x26')](_0x21810b,_0x2d0b4f);}function emitVoiceQueueChannelRemove(_0x52d4f6){logger['info'](_0xd312('0x27'),JSON[_0xd312('0x28')](_0x52d4f6));emit(util[_0xd312('0x29')](_0xd312('0x2a'),_0x52d4f6[_0xd312('0x2b')]),'voice_queue_channel:remove',_0x52d4f6);io[_0xd312('0x26')](_0xd312('0x2c'),_0x52d4f6);}function notSendMessagesQueue(_0x105bb7){if(_0x105bb7[_0xd312('0x2d')]){if(_0x105bb7[_0xd312('0x2e')]===0x0&&_0x105bb7[_0xd312('0x2f')]===0x0){_0x105bb7[_0xd312('0x2d')]=![];_0x105bb7[_0xd312('0x30')]=0x0;_0x105bb7[_0xd312('0x31')]=0x0;_0x105bb7[_0xd312('0x32')]=utils[_0xd312('0x33')]['INACTIVE'];ut[_0xd312('0x34')](_0xd312('0x35'),_0x105bb7[_0xd312('0x2b')]+'\x20is\x20not\x20active');}else{_0x105bb7[_0xd312('0x32')]=utils[_0xd312('0x33')][_0xd312('0x36')];ut[_0xd312('0x34')](_0xd312('0x35'),_0x105bb7[_0xd312('0x2b')]+_0xd312('0x37'));}}}Preview['prototype'][_0xd312('0x25')]=function(){var _0x16f60e=this;setInterval(function(){_0x16f60e[_0xd312('0x38')]();},0x7cf);};Preview[_0xd312('0x11')][_0xd312('0x38')]=function(){var _0x2dc845=this[_0xd312('0x16')];this[_0xd312('0x39')]+=0x1;for(var _0x35c5a3 in _0x2dc845){if(_0x2dc845[_0xd312('0x3a')](_0x35c5a3)&&(_0x2dc845[_0x35c5a3][_0xd312('0x3b')]==='preview'||_0x2dc845[_0x35c5a3][_0xd312('0x3b')]==='booked')&&_0x2dc845[_0x35c5a3][_0xd312('0x3c')]==='outbound'){if(this[_0xd312('0x39')]>0x7){this[_0xd312('0x39')]=0x0;this[_0xd312('0x3d')]();}}if(_0x2dc845[_0xd312('0x3a')](_0x35c5a3)&&_0x2dc845[_0x35c5a3][_0xd312('0x3b')]===_0xd312('0x7')&&_0x2dc845[_0x35c5a3][_0xd312('0x3c')]===_0xd312('0x3e')){if(_0x2dc845[_0x35c5a3][_0xd312('0x3f')]){this[_0xd312('0x40')](_0x2dc845[_0x35c5a3]);if(_0x2dc845[_0x35c5a3]['dialPreviewAutoRecallMe'])this[_0xd312('0x41')](_0x2dc845[_0x35c5a3]);}else{notSendMessagesQueue(_0x2dc845[_0x35c5a3]);}}}};Preview[_0xd312('0x11')]['clearZombieChannel']=function(_0x43beea){var _0x5e062f=this;this[_0xd312('0x15')][_0xd312('0x12')](function(){if(!_['isNil'](_0x5e062f[_0xd312('0x17')][_0x43beea])){loggerAction[_0xd312('0x42')](_0xd312('0x43'),_0x43beea,_0xd312('0x44'),_0x5e062f[_0xd312('0x17')][_0x43beea][_0xd312('0x45')],_0xd312('0x46'),JSON['stringify'](_0x5e062f[_0xd312('0x16')][_0x5e062f[_0xd312('0x17')][_0x43beea][_0xd312('0x45')]][_0xd312('0x2e')]),_0xd312('0x47'),JSON[_0xd312('0x28')](_0x5e062f[_0xd312('0x16')][_0x5e062f[_0xd312('0x17')][_0x43beea][_0xd312('0x45')]][_0xd312('0x2f')]),JSON[_0xd312('0x28')](_0x5e062f[_0xd312('0x17')][_0x43beea][_0xd312('0x48')]),JSON[_0xd312('0x28')](_[_0xd312('0x49')](_0x5e062f['actions'][_0x43beea],[_0xd312('0x4a'),_0xd312('0x4b'),_0xd312('0x4c'),'ListId'])));return ami[_0xd312('0x4d')]({'action':_0xd312('0x4e'),'channel':_0x5e062f[_0xd312('0x17')][_0x43beea]['channel']})[_0xd312('0x4f')](function(_0x331669){if(_0x331669['message']===_0xd312('0x50')){setTimeout(function(){if(_0x5e062f[_0xd312('0x17')][_0x43beea]){ut[_0xd312('0x51')](_0x5e062f[_0xd312('0x16')][_0x5e062f['actions'][_0x43beea][_0xd312('0x45')]],_0xd312('0x52'));if(_0x5e062f['actions'][_0x43beea][_0xd312('0x48')]===!![]){ut[_0xd312('0x53')](_0x5e062f[_0xd312('0x16')][_0x5e062f[_0xd312('0x17')][_0x43beea][_0xd312('0x45')]],_0xd312('0x52'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x43beea,_0x5e062f['actions'][_0x43beea][_0xd312('0x45')]);}ut['loggerError'](_0xd312('0x54')+_0x43beea,_0x5e062f[_0xd312('0x17')][_0x43beea]['queue']);delete _0x5e062f[_0xd312('0x17')][_0x43beea];}},0x2328);}});}});};Preview[_0xd312('0x11')][_0xd312('0x3d')]=function(){var _0x19889b=this;loggerAction[_0xd312('0x42')]('[action]',_[_0xd312('0x55')](this[_0xd312('0x17')]));for(var _0x314021 in this['actions']){if(_0x19889b[_0xd312('0x17')][_0xd312('0x3a')](_0x314021)){_0x19889b[_0xd312('0x56')](_0x314021);}}};Preview[_0xd312('0x11')][_0xd312('0x41')]=function(_0x225f08){var _0x4c87c1=this;rpcDb[_0xd312('0x57')](_0x225f08['id'],ut[_0xd312('0x58')](this[_0xd312('0x59')]))[_0xd312('0x5a')](function(_0x5a3b4e){if(!_['isNil'](_0x5a3b4e)){for(var _0xeb5bad=0x0;_0xeb5bad<_0x5a3b4e['length'];_0xeb5bad+=0x1){if(ut[_0xd312('0x5b')](_0x5a3b4e[_0xeb5bad][_0xd312('0x5c')])<_0x225f08[_0xd312('0x5d')]*0x3c){if(_0x5a3b4e[_0xeb5bad][_0xd312('0x5e')]&&!_0x5a3b4e[_0xeb5bad][_0xd312('0x5e')][_0xd312('0x5f')]){_0x4c87c1[_0xd312('0x60')](_0x5a3b4e[_0xeb5bad]['id'])[_0xd312('0x5a')](ut[_0xd312('0x61')]('[RecallMe]'))[_0xd312('0x4f')](ut[_0xd312('0x61')](_0xd312('0x62')));}else{rpcDb[_0xd312('0x63')](_0x5a3b4e[_0xeb5bad]['id']);}}else{var _0x3a0358=new Action(_0x5a3b4e[_0xeb5bad],_0x225f08);_0x3a0358[_0xd312('0x64')]=moment()[_0xd312('0x29')](_0xd312('0x65'));_0x225f08[_0xd312('0x66')]+=0x1;ut['logCustomer'](_0x3a0358,0x17,_0xd312('0x67'));if(_0x225f08[_0xd312('0x68')]){rpcDb[_0xd312('0x69')](ut['createBody'](_0x5a3b4e[_0xeb5bad]));rpcDb[_0xd312('0x6a')](_0x3a0358,_0xd312('0x6b'));}else{ut[_0xd312('0x6c')](_0x3a0358,0x16,'RecallFailedTimeout');rpcDb[_0xd312('0x6a')](_0x3a0358,_0xd312('0x6d'));rpcDb[_0xd312('0x6e')](_0x3a0358,_0xd312('0x6d'));}}}}})['catch'](ut[_0xd312('0x61')](_0xd312('0x6f')));};Preview[_0xd312('0x11')]['setMessage']=function(_0x567cf5){_0x567cf5['sendMessageOneNotActive']=!![];if(ut[_0xd312('0x70')](_0x567cf5[_0xd312('0x71')])){_0x567cf5['message']=utils[_0xd312('0x33')][_0xd312('0x72')];}else if(!ut[_0xd312('0x73')](_0x567cf5['dialActive'])){_0x567cf5[_0xd312('0x32')]=utils['CAMPAIGN_STATUS'][_0xd312('0x74')];}else if(!this[_0xd312('0x75')](_0x567cf5[_0xd312('0x76')])){if(!this[_0xd312('0x75')](_0x567cf5[_0xd312('0x77')])){_0x567cf5['message']=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x567cf5[_0xd312('0x32')]=utils[_0xd312('0x33')]['ACTIVE'];}}else{_0x567cf5['message']=utils[_0xd312('0x33')][_0xd312('0x78')];}};Preview[_0xd312('0x11')][_0xd312('0x79')]=function(_0x364c0c,_0x1478b6,_0x4d732a){var _0x145030=this;var _0x45d820=this[_0xd312('0x17')][_0x1478b6];var _0x19dbf3=this[_0xd312('0x16')][_0x45d820['queue']];var _0x2cb7e2;var _0x3bed61=![];var _0x42d003=0x2;var _0x284ab6=0x3;if(_0x19dbf3){switch(_0x4d732a){case'1':_0x19dbf3[_0xd312('0x7a')]+=0x1;_0x45d820[_0xd312('0x7b')]+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut['logCustomer'](_0x45d820,0x0,_0xd312('0x7e'));ami[_0xd312('0x26')](_0xd312('0x7f'),ut[_0xd312('0x80')](_0x45d820,_0xd312('0x81')));rpcDb[_0xd312('0x6a')](_0x45d820,'[callProgressDetectingCustomer][logNoSuch]');_0x145030[_0xd312('0x82')](_0x45d820,'0',_0x19dbf3)[_0xd312('0x5a')](function(_0x3faa38){_0x3bed61=_0x3faa38['additional']==0x1;_0x42d003=_0x19dbf3['dialNoSuchNumberRetryFrequency'];_0x284ab6=_0x19dbf3[_0xd312('0x83')];if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut['cloneAction'](_0x45d820,0xf,_0xd312('0x85'));rpcDb['createCustomerFinal'](_0x2cb7e2,_0xd312('0x86'));}else{if(_0x45d820['countnosuchnumberretry']>=_0x19dbf3[_0xd312('0x87')]){rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0x86'));}else{rpcDb['rescheduleContact'](ut[_0xd312('0x88')](_0x45d820,_0xd312('0x7b'),_0x19dbf3['dialNoSuchNumberRetryFrequency']),_0x45d820[_0xd312('0x89')],_0x45d820[_0xd312('0x8a')]);}}delete this[_0xd312('0x17')][_0x364c0c['linkedid']];}else{_0x45d820[_0xd312('0x7b')]++;logger[_0xd312('0x42')](_0xd312('0x8b'),_0x45d820[_0xd312('0x7b')]);logger['info']('id',_0x45d820[_0xd312('0x8c')]);_0x145030[_0xd312('0x8d')]({'id':_0x45d820['idContact'],'field':{'countnosuchnumberretry':_0x45d820[_0xd312('0x7b')]}})[_0xd312('0x5a')](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});break;case'ANSWER':var _0x324ac3=moment()[_0xd312('0x29')](_0xd312('0x65'));_0x45d820[_0xd312('0x8f')]=_0x324ac3;_0x45d820[_0xd312('0x90')]=_0x324ac3;_0x45d820[_0xd312('0x48')]=!![];_0x19dbf3[_0xd312('0x2f')]+=0x1;logger['info'](_0xd312('0x91'),_0x45d820['uniqueid'],_0xd312('0x92'),_0x19dbf3['name'],_0xd312('0x47'),_0x19dbf3[_0xd312('0x2f')]);ami[_0xd312('0x26')]('custom:agentconnect',ut['buildObj'](_0x45d820,_0xd312('0x93'),this['campaignsPreview'][_0x45d820['queue']]));if(_0x19dbf3[_0xd312('0x94')]){ami[_0xd312('0x26')](_0xd312('0x95'),ut['buildAcw'](_0x45d820));}break;case'16':ami['emit'](_0xd312('0x96'),ut[_0xd312('0x80')](_0x45d820,'complete',this[_0xd312('0x16')][_0x45d820[_0xd312('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xd312('0x80')](_0x45d820,'complete'));_0x19dbf3['outboundAnswerCallsDay']+=0x1;_0x19dbf3['total']+=0x1;_0x19dbf3[_0xd312('0x97')]+=0x1;ut[_0xd312('0x53')](_0x19dbf3,_0xd312('0x98'));_0x45d820['countglobal']=ut['totalGlobal'](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x4,'Answer');rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0x99'));rpcDb[_0xd312('0x6e')](_0x45d820,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xd312('0x9a')](_0x45d820);_0x19dbf3[_0xd312('0x9b')]+=_0x45d820[_0xd312('0x9c')];_0x19dbf3[_0xd312('0x9d')]+=_0x45d820[_0xd312('0x9c')];logger['info'](_0xd312('0x9e'),_0x45d820['uniqueid'],_0xd312('0x92'),_0x19dbf3[_0xd312('0x2b')],_0xd312('0x47'),_0x19dbf3['pTalking']);delete this[_0xd312('0x17')][_0x364c0c[_0xd312('0x9f')]];break;case'BUSY':_0x19dbf3[_0xd312('0xa0')]+=0x1;_0x45d820[_0xd312('0xa1')]+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x5,_0xd312('0xa2'));_0x42d003=_0x19dbf3['dialBusyRetryFrequency'];_0x284ab6=_0x19dbf3[_0xd312('0x83')];ami[_0xd312('0x26')]('custom:agentbusy',ut[_0xd312('0x80')](_0x45d820,'busy'));rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0xa3'));_0x145030['verifyAdditionalPhones'](_0x45d820,'5',_0x19dbf3)[_0xd312('0x5a')](function(_0xa51b01){_0x3bed61=_0xa51b01[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut['cloneAction'](_0x45d820,0xf,_0xd312('0x85'));rpcDb[_0xd312('0x6e')](_0x2cb7e2,_0xd312('0xa5'));}else{if(_0x45d820[_0xd312('0xa1')]>=_0x19dbf3[_0xd312('0xa6')]){rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0xa3'));}else{rpcDb[_0xd312('0xa7')](ut[_0xd312('0x88')](_0x45d820,_0xd312('0xa1'),_0x19dbf3[_0xd312('0xa8')]),_0x45d820[_0xd312('0x89')],_0x45d820[_0xd312('0x8a')]);}}}else{_0x45d820[_0xd312('0xa1')]++;_0x145030['incrementPreviewCounters']({'id':_0x45d820[_0xd312('0x8c')],'field':{'countbusyretry':_0x45d820[_0xd312('0xa1')]}})[_0xd312('0x5a')](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)['then'](function(){});});}});break;case'NOANSWER':_0x19dbf3[_0xd312('0xa9')]+=0x1;_0x45d820[_0xd312('0xaa')]+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x3,_0xd312('0xab'));_0x42d003=_0x19dbf3[_0xd312('0xac')];_0x284ab6=_0x19dbf3[_0xd312('0x83')];var _0xcebb1f=ut['buildNoAnswerEventPayload'](_0x45d820,_0x19dbf3);ami[_0xd312('0x26')]('custom:agentnoanswer',_0xcebb1f);rpcDb['createCustomerHistory'](_0x45d820,_0xd312('0xad'));_0x145030['verifyAdditionalPhones'](_0x45d820,'3',_0x19dbf3)[_0xd312('0x5a')](function(_0x3afddc){_0x3bed61=_0x3afddc[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0xf,_0xd312('0x85'));rpcDb['createCustomerFinal'](_0x2cb7e2,_0xd312('0xaf'));}else{if(_0x45d820[_0xd312('0xaa')]>=_0x19dbf3['dialNoAnswerMaxRetry']){rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0xad'));}else{rpcDb[_0xd312('0xa7')](ut[_0xd312('0x88')](_0x45d820,_0xd312('0xaa'),_0x19dbf3[_0xd312('0xac')]),_0x45d820[_0xd312('0x89')],_0x45d820[_0xd312('0x8a')]);}}}else{_0x45d820[_0xd312('0xaa')]++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820[_0xd312('0x8c')],'field':{'countnoanswerretry':_0x45d820[_0xd312('0xaa')]}})[_0xd312('0x5a')](function(){_0x145030['swapAdditionalPhones'](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});break;case _0xd312('0xb0'):_0x19dbf3[_0xd312('0xb1')]+=0x1;_0x45d820['countcongestionretry']+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x8,_0xd312('0xb2'));_0x42d003=_0x19dbf3['dialCongestionRetryFrequency'];_0x284ab6=_0x19dbf3[_0xd312('0x83')];ami[_0xd312('0x26')](_0xd312('0xb3'),ut[_0xd312('0x80')](_0x45d820,_0xd312('0xb4')));rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0xb5'));_0x145030[_0xd312('0x82')](_0x45d820,'8',_0x19dbf3)['then'](function(_0x24ee94){_0x3bed61=_0x24ee94[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0xf,'Global');rpcDb[_0xd312('0x6e')](_0x2cb7e2,_0xd312('0xb6'));}else{if(_0x45d820[_0xd312('0xb7')]>=_0x19dbf3[_0xd312('0xb8')]){rpcDb['createCustomerFinal'](_0x45d820,_0xd312('0xb5'));}else{rpcDb[_0xd312('0xa7')](ut[_0xd312('0x88')](_0x45d820,_0xd312('0xb7'),_0x19dbf3['dialBusyRetryFrequency']),_0x45d820['unlockAgent'],_0x45d820[_0xd312('0x8a')]);}}}else{_0x45d820['countcongestionretry']++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820[_0xd312('0x8c')],'field':{'countcongestionretry':_0x45d820[_0xd312('0xb7')]}})['then'](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});break;case _0xd312('0xb9'):_0x19dbf3[_0xd312('0xba')]+=0x1;_0x45d820[_0xd312('0xbb')]+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x14,_0xd312('0xbc'));_0x42d003=_0x19dbf3[_0xd312('0xbd')];_0x284ab6=_0x19dbf3[_0xd312('0x83')];ami['emit'](_0xd312('0xbe'),ut['buildObj'](_0x45d820,_0xd312('0xbf')));rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0xc0'));_0x145030[_0xd312('0x82')](_0x45d820,'20',_0x19dbf3)[_0xd312('0x5a')](function(_0xf52972){_0x3bed61=_0xf52972[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3['dialGlobalMaxRetry']){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0x14,_0xd312('0xbc'));rpcDb[_0xd312('0x6e')](_0x2cb7e2,_0xd312('0xc1'));}else{if(_0x45d820[_0xd312('0xbb')]>=_0x19dbf3[_0xd312('0xc2')]){rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0xc1'));}else{rpcDb[_0xd312('0xa7')](ut[_0xd312('0x88')](_0x45d820,'countagentrejectretry',_0x19dbf3[_0xd312('0xbd')]),_0x45d820[_0xd312('0x89')],_0x45d820[_0xd312('0x8a')]);}}}else{_0x45d820['countnoanswerretry']++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820['idContact'],'field':{'countnoanswerretry':_0x45d820['countnoanswerretry']}})['then'](function(){_0x145030['swapAdditionalPhones'](_0x45d820,_0x42d003,_0x284ab6)['then'](function(){});});}});break;case _0xd312('0xc3'):_0x19dbf3[_0xd312('0xc4')]+=0x1;_0x45d820['countabandonedretry']+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut['logCustomer'](_0x45d820,0xb,'Abandoned');rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0xc5'));_0x145030['verifyAdditionalPhones'](_0x45d820,'11',_0x19dbf3)[_0xd312('0x5a')](function(_0x2de17b){_0x3bed61=_0x2de17b[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut['totalGlobal'](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0xf,'Global');rpcDb['createCustomerFinal'](_0x2cb7e2,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x45d820['countabandonedetry']>=_0x19dbf3['dialAbandonedMaxRety']){rpcDb[_0xd312('0x6e')](_0x45d820,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xd312('0xa7')](ut[_0xd312('0x88')](_0x45d820,'countabandonedretry',_0x19dbf3[_0xd312('0xc6')]),_0x45d820[_0xd312('0x89')],_0x45d820[_0xd312('0x8a')]);}}}else{_0x45d820[_0xd312('0xaa')]++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820[_0xd312('0x8c')],'field':{'countnoanswerretry':_0x45d820[_0xd312('0xaa')]}})[_0xd312('0x5a')](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});break;case'18':_0x19dbf3['outboundUnknownCallsDay']+=0x1;_0x45d820['countmachineretry']+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x12,_0x364c0c[_0xd312('0xc7')]||_0x364c0c[_0xd312('0xc8')]);ami[_0xd312('0x26')](_0xd312('0xc9'),ut['buildObj'](_0x45d820,_0xd312('0xca')));rpcDb['createCustomerHistory'](_0x45d820,_0xd312('0xcb'));_0x145030[_0xd312('0x82')](_0x45d820,'18',_0x19dbf3)[_0xd312('0x5a')](function(_0x26abe0){_0x3bed61=_0x26abe0['additional']==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0x12,_0xd312('0x85'));rpcDb[_0xd312('0x6e')](_0x2cb7e2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0xcb'));}}else{_0x45d820[_0xd312('0xaa')]++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820[_0xd312('0x8c')],'field':{'countnoanswerretry':_0x45d820[_0xd312('0xaa')]}})[_0xd312('0x5a')](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});delete this[_0xd312('0x17')][_0x364c0c[_0xd312('0x9f')]];break;case'19':_0x19dbf3[_0xd312('0xcc')]+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut[_0xd312('0x6c')](_0x45d820,0x13,_0x364c0c[_0xd312('0xc7')]||_0x364c0c[_0xd312('0xc8')]);ami[_0xd312('0x26')](_0xd312('0xc9'),ut[_0xd312('0x80')](_0x45d820,_0xd312('0xca')));rpcDb[_0xd312('0x6a')](_0x45d820,_0xd312('0xcd'));_0x145030[_0xd312('0x82')](_0x45d820,'18',_0x19dbf3)[_0xd312('0x5a')](function(_0x306e2c){_0x3bed61=_0x306e2c[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3['dialGlobalMaxRetry']){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0xf,_0xd312('0x85'));rpcDb[_0xd312('0x6e')](_0x2cb7e2,_0xd312('0xcd'));}else{rpcDb[_0xd312('0x6e')](_0x45d820,'[callProgressDetectingCustomer][machine]');}}else{_0x45d820[_0xd312('0xaa')]++;_0x145030[_0xd312('0x8d')]({'id':_0x45d820[_0xd312('0x8c')],'field':{'countnoanswerretry':_0x45d820[_0xd312('0xaa')]}})['then'](function(){_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});});}});delete this[_0xd312('0x17')][_0x364c0c[_0xd312('0x9f')]];break;default:if(_0x45d820['dialAnswer']){ut[_0xd312('0x53')](_0x19dbf3,_0xd312('0xce'));ut['loggerError'](_0xd312('0xcf')+_0x19dbf3['name'],_0x364c0c);}_0x19dbf3['outboundUnknownCallsDay']+=0x1;_0x45d820[_0xd312('0x7c')]=ut[_0xd312('0x7d')](_0x45d820);ut['logCustomer'](_0x45d820,0xc,_0x364c0c[_0xd312('0xc7')]||_0x364c0c['dialstatus']);_0x42d003=_0x19dbf3[_0xd312('0xbd')];_0x284ab6=_0x19dbf3[_0xd312('0x83')];rpcDb[_0xd312('0x6a')](_0x45d820,'[callProgressDetectingCustomer][logUnknown]');_0x145030[_0xd312('0x82')](_0x45d820,'20',_0x19dbf3)[_0xd312('0x5a')](function(_0x58a679){_0x3bed61=_0x58a679[_0xd312('0xa4')]==0x1;if(!_0x3bed61){if(ut[_0xd312('0x7d')](_0x45d820)>=_0x19dbf3[_0xd312('0x84')]){_0x2cb7e2=ut[_0xd312('0xae')](_0x45d820,0xf,'Global');rpcDb[_0xd312('0x6e')](_0x2cb7e2,_0xd312('0xd0'));}else{rpcDb[_0xd312('0x6e')](_0x45d820,_0xd312('0xd0'));}delete this['actions'][_0x364c0c[_0xd312('0x9f')]];}else{_0x145030[_0xd312('0x8e')](_0x45d820,_0x42d003,_0x284ab6)[_0xd312('0x5a')](function(){});}});}if(!(_0x45d820[_0xd312('0x48')]&&_0x4d732a==='16')){ut['updateOriginated'](_0x19dbf3,'[callProgressDetectingCustomer]');logger['info'](_0xd312('0xd1'),_0x45d820[_0xd312('0xd2')],_0xd312('0x92'),_0x19dbf3['name'],_0xd312('0x46'),_0x19dbf3[_0xd312('0x2e')]);}if(_0x4d732a!==_0xd312('0xd3')){delete this['actions'][_0x364c0c[_0xd312('0x9f')]];delete this['actions'][_0x364c0c[_0xd312('0xd4')]];}_0x19dbf3[_0xd312('0xd5')]=!![];}};Preview[_0xd312('0x11')][_0xd312('0xd6')]=function(_0x2b9d07,_0x1479bf,_0x1f50bd){if(_[_0xd312('0xd7')](_0x1479bf)&&'object'!==typeof _0x1479bf){return;}if(_[_0xd312('0xd7')](_0x1f50bd)&&_0xd312('0xd8')!==typeof _0x1f50bd){return;}switch(_0x1f50bd[_0xd312('0xd9')]){case'0':ut['logAgent'](_0x2b9d07,0x0,_0xd312('0x7e'));rpcDb[_0xd312('0xda')](_0x2b9d07,_0xd312('0xdb'));break;case'3':ut['logAgent'](_0x2b9d07,0x3,_0xd312('0xab'));rpcDb[_0xd312('0xda')](_0x2b9d07,_0xd312('0xdc'));break;case'5':ut[_0xd312('0xdd')](_0x2b9d07,0x5,_0xd312('0xa2'));rpcDb[_0xd312('0xda')](_0x2b9d07,_0xd312('0xde'));break;case'8':ut[_0xd312('0xdd')](_0x2b9d07,0x8,_0xd312('0xb2'));rpcDb['createAgentHistory'](_0x2b9d07,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd312('0xdd')](_0x2b9d07,0x16,_0xd312('0xdf'));rpcDb['createAgentHistory'](_0x2b9d07,_0xd312('0xe0'));break;default:ut[_0xd312('0xdd')](_0x2b9d07,0xc,_0x1f50bd['reason']);rpcDb['createAgentHistory'](_0x2b9d07,_0xd312('0xe1'));}ut['updateOriginated'](_0x1479bf,'[callProgressDetectingAgent]');logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2b9d07[_0xd312('0xd2')],_0xd312('0x92'),_0x1479bf[_0xd312('0x2b')],_0xd312('0x46'),_0x1479bf[_0xd312('0x2e')]);delete this['actions'][_0x2b9d07[_0xd312('0xd2')]];};Preview[_0xd312('0x11')][_0xd312('0x82')]=function(_0x4ac32d,_0x14e3f6,_0x2133fc){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4ac32d,_0x14e3f6,_0x2133fc)[_0xd312('0x4f')](logger[_0xd312('0x42')](_0xd312('0xe2')));};Preview[_0xd312('0x11')][_0xd312('0x8e')]=function(_0x10ac53,_0x74a859,_0x8a878b){return cmHopperAdditionalPhone[_0xd312('0x8e')](_0x10ac53,_0x74a859,_0x8a878b)[_0xd312('0x4f')](logger[_0xd312('0x42')](_0xd312('0xe3')));};Preview[_0xd312('0x11')]['incrementPreviewCounters']=function(_0x5909f5){return Promise[_0xd312('0xe4')]()[_0xd312('0x5a')](cmHopperAdditionalPhone[_0xd312('0x8d')](_0x5909f5))[_0xd312('0x4f')](logger[_0xd312('0x42')](_0xd312('0xe5')));};Preview[_0xd312('0x11')][_0xd312('0xe6')]=function(_0x3e6678,_0x175488,_0x2b90df,_0xc4f67c,_0x3e0531){var _0x579826=this;return new Promise(function(_0x294688,_0x2b8162){if(_[_0xd312('0xe7')](_0x175488)||_['isNil'](_0x175488[_0xd312('0xe8')])||_[_0xd312('0xe7')](_0x175488[_0xd312('0xe9')])||_[_0xd312('0xe7')](_0x175488[_0xd312('0x4c')])){_0x2b8162(ut['message'](_0xd312('0xea'),_0xc4f67c,_0x3e0531));return;}var _0x24297f=uuid['v4']();var _0x2fad64=_0x579826[_0xd312('0x16')][_0x175488[_0xd312('0x44')][_0xd312('0x2b')]];var _0xbb3f94=_0x2b90df?_0x579826[_0xd312('0x59')][_0x2b90df]['id']:undefined;_0x579826[_0xd312('0x17')][_0x24297f]=new Action(_0x175488,_0x2fad64,_0x24297f,_0x2b90df,_0xbb3f94);var _0x1ea440=_0x579826['actions'][_0x24297f];_0x1ea440[_0xd312('0x89')]=_0xc4f67c;_0x1ea440[_0xd312('0x8a')]=_0x3e0531;_0x1ea440['lookAgent']=_0x2b90df;if(_[_0xd312('0xeb')](_0x3e6678)){_0x579826[_0xd312('0xec')](_0x1ea440,_0x2fad64,_0x175488,_0x2b90df)[_0xd312('0x5a')](function(_0x5f447b){logger[_0xd312('0x42')](_0xd312('0xed'),_0xd312('0xee')+_0x1ea440[_0xd312('0x45')]+_0xd312('0xef')+_0x1ea440[_0xd312('0x8c')],JSON['stringify'](_0x5f447b));ami[_0xd312('0x26')](_0xd312('0xf0'),ut['buildObj'](_0x1ea440,'called',_0x579826[_0xd312('0x16')][_0x1ea440[_0xd312('0x45')]]));_0x294688(ut[_0xd312('0x32')]('Calling'));})[_0xd312('0x4f')](function(_0xe45797){ut[_0xd312('0x34')](_0xd312('0xf1'),_0xe45797);_0x2b8162(ut[_0xd312('0x32')]('Call\x20failed',_0xc4f67c,_0x3e0531));});}else{_0x2fad64[_0xd312('0xf2')]+=0x1;ut[_0xd312('0xf3')](_0x1ea440);rpcDb[_0xd312('0xf4')](_0x1ea440,_0xd312('0xf5'));delete _0x579826[_0xd312('0x17')][_0x24297f];_0x2b8162(ut[_0xd312('0x32')]('Contact\x20in\x20black\x20List',_0xc4f67c,_0x3e0531));}});};Preview[_0xd312('0x11')][_0xd312('0x75')]=function(_0x53149d){return!_[_0xd312('0xe7')](_0x53149d)&&!_[_0xd312('0xe7')](_0x53149d[_0xd312('0x2b')])&&!_[_0xd312('0xe7')](_0x53149d['active'])&&_0x53149d['active']&&!_[_0xd312('0xe7')](this['trunks'][util[_0xd312('0x29')]('SIP/%s',_0x53149d['name'])])&&!_['isNil'](this[_0xd312('0xf6')][util[_0xd312('0x29')](_0xd312('0xf7'),_0x53149d[_0xd312('0x2b')])][_0xd312('0x4e')])&&(this[_0xd312('0xf6')][util[_0xd312('0x29')](_0xd312('0xf7'),_0x53149d[_0xd312('0x2b')])][_0xd312('0x4e')]===_0xd312('0xf8')||this[_0xd312('0xf6')][util[_0xd312('0x29')]('SIP/%s',_0x53149d['name'])][_0xd312('0x4e')]===_0xd312('0xf9'));};Preview[_0xd312('0x11')]['run']=function(_0x4e877e,_0x3faf5f){return this['execRun'](_0x4e877e,_0x3faf5f)[_0xd312('0x5a')](function(_0x2c1ee7){return _['pick'](_0x2c1ee7,[_0xd312('0x32')]);})['catch'](function(_0x4de633){if(_0x4de633[_0xd312('0xfa')]){rpcDb[_0xd312('0xfb')](_0x4e877e);}if(_0x4de633[_0xd312('0xfc')]){rpcDb['disableContact'](_0x4e877e);}throw _[_0xd312('0x49')](_0x4de633,[_0xd312('0x32')]);});};Preview[_0xd312('0x11')][_0xd312('0xfd')]=function(_0x4b4b58,_0x18e8d7){var _0x192073=this;var _0x31a5c8,_0xbbeca6;return rpcDb[_0xd312('0xfe')](_0x4b4b58)[_0xd312('0x5a')](function(_0x37b865){if(!_['isNil'](_0x37b865[0x0])){_0xbbeca6=_0x37b865[0x0][_0xd312('0xff')]?![]:!![];_0x31a5c8=_0x37b865[0x0][_0xd312('0xff')]?!![]:![];_0x31a5c8=_0x18e8d7?!![]:_0x31a5c8;}var _0x199e53=_0x192073['validateContact'](_0x37b865);if(_0x199e53[_0xd312('0x100')]){rpcDb['checkIsBlackList'](_[_0xd312('0x49')](_0x37b865[0x0],[_0xd312('0x4c'),_0xd312('0xe9')]))[_0xd312('0x5a')](function(_0x1238b5){_0x192073[_0xd312('0xe6')](_0x1238b5,_0x37b865[0x0],_0x18e8d7,_0xbbeca6,_0x31a5c8)['then'](function(_0x2eb69d){return _0x2eb69d;})[_0xd312('0x4f')](function(_0x5a8377){throw _0x5a8377;});})[_0xd312('0x4f')](function(_0x5313fc){ut[_0xd312('0x34')](_0xd312('0x101'),_0x5313fc);throw ut[_0xd312('0x32')]('Call\x20unsuccessful',_0xbbeca6,_0x31a5c8);});}else{throw ut['message'](_0x199e53[_0xd312('0x32')],_0xbbeca6,_0x31a5c8);}})[_0xd312('0x4f')](function(_0x37cb8b){ut[_0xd312('0x34')](_0xd312('0x102'),_0x37cb8b);throw ut[_0xd312('0x32')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xd312('0x11')][_0xd312('0x103')]=function(_0x3f83f4){if(_[_0xd312('0xe7')](_0x3f83f4)||_['isEmpty'](_0x3f83f4)||!_['isNil'](_0x3f83f4[0x0][_0xd312('0x5e')])&&_[_0xd312('0xe7')](_0x3f83f4[0x0][_0xd312('0x5e')][_0xd312('0x2b')])){ut[_0xd312('0x34')](_0xd312('0x104'),_0x3f83f4);return{'isValid':![],'message':_0xd312('0x105')};}var _0x1288b3=this[_0xd312('0x16')][_0x3f83f4[0x0][_0xd312('0x44')]['name']];_0x1288b3[_0xd312('0x32')]=utils['CAMPAIGN_STATUS'][_0xd312('0x78')];if(_[_0xd312('0xe7')](_0x1288b3)){ut[_0xd312('0x34')](_0xd312('0x106'),_0x1288b3);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xd312('0x75')](_0x1288b3['Trunk'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xd312('0x107')+_0x1288b3[_0xd312('0x2b')]+_0xd312('0x108'));if(!this[_0xd312('0x75')](_0x1288b3[_0xd312('0x77')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x1288b3[_0xd312('0x2b')]+_0xd312('0x109'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xd312('0x73')](_0x1288b3[_0xd312('0x3f')])){ut[_0xd312('0x34')](_0xd312('0x10a'),_0x1288b3[_0xd312('0x2b')]+_0xd312('0x10b'));return{'isValid':![],'message':_0xd312('0x107')+_0x1288b3[_0xd312('0x2b')]+_0xd312('0x10b')};}return{'isValid':!![],'message':_0xd312('0x10c')};};Preview['prototype'][_0xd312('0xec')]=function(_0x4120f7,_0x514207,_0x58ccee,_0x29a6d0){var _0xc4ee4e=this;return new Promise(function(_0x1a9721,_0x2655f4){var _0x2ca624=_0x4120f7['uniqueid'];var _0x3ffe94=_0xc4ee4e['isTrunkReachable'](_0x514207[_0xd312('0x76')])?util[_0xd312('0x29')](_0xd312('0x10d'),_0x514207['Trunk'][_0xd312('0x2b')],_[_0xd312('0xe7')](_0x514207[_0xd312('0x10e')])?'':_0x514207[_0xd312('0x10e')][_0xd312('0x10f')]()||'',_0x514207['dialCutDigit']>0x0?_0x58ccee[_0xd312('0xe9')][_0xd312('0x110')](_0x514207[_0xd312('0x111')]):_0x58ccee[_0xd312('0xe9')]):util[_0xd312('0x29')](_0xd312('0x10d'),_[_0xd312('0xe7')](_0x514207['TrunkBackup'])?_0x514207[_0xd312('0x76')][_0xd312('0x2b')]:_0x514207[_0xd312('0x77')][_0xd312('0x2b')],_[_0xd312('0xe7')](_0x514207[_0xd312('0x10e')])?'':_0x514207['dialPrefix'][_0xd312('0x10f')]()||'',_0x514207[_0xd312('0x111')]>0x0?_0x58ccee[_0xd312('0xe9')]['substring'](_0x514207[_0xd312('0x111')]):_0x58ccee[_0xd312('0xe9')]);var _0x29b5b6=_0xc4ee4e['isTrunkReachable'](_0x514207[_0xd312('0x76')])?ut[_0xd312('0x112')](_0x514207[_0xd312('0x76')][_0xd312('0x113')],_0x514207['dialOriginateCallerIdName'],_0x514207['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd312('0x114')](_0x514207[_0xd312('0x115')],_0x514207[_0xd312('0x116')]):_0x514207[_0xd312('0x115')]):ut['getCallerId'](_[_0xd312('0xe7')](_0x514207[_0xd312('0x77')])?_0x514207[_0xd312('0x76')][_0xd312('0x113')]:_0x514207[_0xd312('0x77')]['callerid'],_0x514207['dialOriginateCallerIdName'],_0x514207[_0xd312('0x116')]>0x0?ut[_0xd312('0x114')](_0x514207['dialOriginateCallerIdNumber'],_0x514207[_0xd312('0x116')]):_0x514207[_0xd312('0x115')]);if(_0x29b5b6){_0x4120f7[_0xd312('0x117')]=ut[_0xd312('0x118')](_0x29b5b6);_0x4120f7[_0xd312('0x119')]=ut[_0xd312('0x11a')](_0x29b5b6);}var _0x2c716b=ut[_0xd312('0x11b')](_0x514207,_0x58ccee,_0x3ffe94,_0x29b5b6,_0x2ca624,_0x4120f7);var _0x3a3c56=utils[_0xd312('0x11c')](_0x58ccee[_0xd312('0xe8')]);Object[_0xd312('0x11d')](_0x2c716b,_0x3a3c56);_[_0xd312('0x11e')](_0x4120f7,ut['toLowerVariables'](_0x2c716b));_0x4120f7[_0xd312('0x64')]=moment()[_0xd312('0x29')](_0xd312('0x65'));_0x514207[_0xd312('0x11f')]=_0x2c716b;var _0x53ecbe=ut[_0xd312('0x120')](_0x4120f7,_0x514207,_0x2c716b,_0x4120f7[_0xd312('0x8a')],_0x29a6d0);return ami[_0xd312('0x4d')](_0x53ecbe)[_0xd312('0x5a')](function(_0x5824d){_0x514207['originated']+=0x1;logger[_0xd312('0x42')]('[originated][increment]',_0x2ca624,'\x20Queue',_0x514207[_0xd312('0x2b')],_0xd312('0x46'),_0x514207[_0xd312('0x2e')]);_0x1a9721(_0x5824d);})['catch'](function(_0x29c698){ut[_0xd312('0xdd')](_0x4120f7,0xe,_0xd312('0x121'));rpcDb[_0xd312('0xda')](_0x4120f7,_0xd312('0x122'));_0x2655f4(_0x29c698);});});};Preview[_0xd312('0x11')][_0xd312('0x20')]=function(_0x3d67d2){if(this['actions'][_0x3d67d2[_0xd312('0x9f')]]){this[_0xd312('0x17')][_0x3d67d2[_0xd312('0x9f')]]['channel']=_0x3d67d2['channel'];}};Preview[_0xd312('0x11')][_0xd312('0x19')]=function(_0x349f72){var _0x1aea4d=this;var _0x36e4ea=this[_0xd312('0x17')][_0x349f72[_0xd312('0x123')]];if(_0x36e4ea){if(_0x36e4ea[_0xd312('0x124')]&&this['agents'][_0x36e4ea['lookAgent']]){ut['logLookAgent'](_0x36e4ea,this[_0xd312('0x59')][_0x36e4ea['lookAgent']][_0xd312('0x2b')],this[_0xd312('0x59')][_0x36e4ea[_0xd312('0x124')]]['id']);}var _0x45e97d=_[_0xd312('0x125')](_0x36e4ea);_0x45e97d[_0xd312('0x8f')]=moment()[_0xd312('0x29')]('YYYY-MM-DD\x20HH:mm:ss');var _0x539623=_0x1aea4d['campaignsPreview'][_0x36e4ea['queue']];if(ut[_0xd312('0x126')](_0x349f72[_0xd312('0x127')])){if(_0x36e4ea['unlockAgent']){rpcDb['unlockContact'](_0x36e4ea[_0xd312('0x8c')]);}if(_0x36e4ea[_0xd312('0x8a')]){rpcDb[_0xd312('0x63')](_0x36e4ea['idContact']);}ami[_0xd312('0x26')](_0xd312('0x128'),ut[_0xd312('0x80')](_0x36e4ea,_0xd312('0x129'),this[_0xd312('0x16')][_0x36e4ea[_0xd312('0x45')]]));this[_0xd312('0xd6')](_0x45e97d,_0x539623,_0x349f72);}else{_0x36e4ea[_0xd312('0x64')]=moment()[_0xd312('0x29')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xd312('0xdd')](_0x45e97d,0x4,_0xd312('0x12a'));rpcDb[_0xd312('0xda')](_0x45e97d,_0xd312('0x12b'));}}};Preview[_0xd312('0x11')][_0xd312('0x12c')]=function(_0xcfea5e){var _0x5f5cf2=this['actions'][_0xcfea5e['linkedid']];var _0x38bc16;if(_0x5f5cf2){_0x38bc16=this[_0xd312('0x16')][_0x5f5cf2['queue']];logger['info'](_0xd312('0x12d'),_0xcfea5e[_0xd312('0x9f')],_0xd312('0x92'),_0x38bc16[_0xd312('0x2b')],_0xd312('0x47'),_0x38bc16[_0xd312('0x2f')]);}if(this[_0xd312('0x17')][_0xcfea5e[_0xd312('0x9f')]]&&_0xcfea5e[_0xd312('0x9f')]!==_0xcfea5e['uniqueid']){if(_0xcfea5e[_0xd312('0x12e')]==='16'&&this[_0xd312('0x17')][_0xcfea5e[_0xd312('0x9f')]][_0xd312('0x48')]){this[_0xd312('0x79')](_0xcfea5e,_0xcfea5e[_0xd312('0x9f')],_0xcfea5e['cause']);}else if(this[_0xd312('0x17')][_0xcfea5e[_0xd312('0x9f')]][_0xd312('0x48')]){logger[_0xd312('0x42')](_0xd312('0x12f'),_0xcfea5e[_0xd312('0x9f')],_0xcfea5e[_0xd312('0x12e')],_0xd312('0x92'),_0x38bc16['name'],_0xd312('0x47'),_0x38bc16[_0xd312('0x2f')]);this[_0xd312('0x79')](_0xcfea5e,_0xcfea5e[_0xd312('0x9f')],_0xcfea5e[_0xd312('0x12e')]);}}else if(_0x5f5cf2&&_[_0xd312('0xe7')](_0x5f5cf2[_0xd312('0x130')])&&_0x38bc16[_0xd312('0x131')]&&_0xcfea5e[_0xd312('0x9f')]===_0xcfea5e[_0xd312('0xd2')]&&_[_0xd312('0xe7')](_0xcfea5e[_0xd312('0xd9')])&&_0xcfea5e[_0xd312('0x12e')]==='16'&&_0xcfea5e[_0xd312('0x132')]==='6'&&_['isUndefined'](_0x5f5cf2['transfer'])){if(_0x5f5cf2['unlockAgent']){rpcDb[_0xd312('0xfb')](_0x5f5cf2['idContact']);}if(_0x5f5cf2[_0xd312('0x8a')]){rpcDb[_0xd312('0x63')](_0x5f5cf2[_0xd312('0x8c')]);}_0xcfea5e[_0xd312('0xd9')]='22';this[_0xd312('0xd6')](_0x5f5cf2,_0x38bc16,_0xcfea5e);}else if(_0x5f5cf2&&_0x5f5cf2[_0xd312('0x133')]){if(_0xcfea5e['cause']==='16'&&this[_0xd312('0x17')][_0xcfea5e[_0xd312('0x9f')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0xcfea5e[_0xd312('0x9f')],_0xcfea5e[_0xd312('0x12e')],'\x20Queue',_0x38bc16[_0xd312('0x2b')],_0xd312('0x47'),_0x38bc16[_0xd312('0x2f')]);this[_0xd312('0x79')](_0xcfea5e,_0xcfea5e[_0xd312('0x9f')],_0xcfea5e['cause']);}else if(this[_0xd312('0x17')][_0xcfea5e[_0xd312('0x9f')]][_0xd312('0x48')]){logger[_0xd312('0x42')](_0xd312('0x12f'),_0xcfea5e[_0xd312('0x9f')],_0xcfea5e['cause'],_0xd312('0x92'),_0x38bc16[_0xd312('0x2b')],_0xd312('0x47'),_0x38bc16[_0xd312('0x2f')]);this[_0xd312('0x79')](_0xcfea5e,_0xcfea5e['linkedid'],_0xcfea5e[_0xd312('0x12e')]);}}};Preview[_0xd312('0x11')]['syncDialEnd']=function(_0x1005f6){if(this['actions'][_0x1005f6[_0xd312('0xd4')]]&&_0x1005f6[_0xd312('0xd4')]!==_0x1005f6[_0xd312('0x134')]){this[_0xd312('0x79')](_0x1005f6,_0x1005f6['destlinkedid'],_0x1005f6['dialstatus']);}};Preview[_0xd312('0x11')]['syncHangupRequest']=function(_0x5135b0){if(this[_0xd312('0x17')][_0x5135b0['linkedid']]&&_0x5135b0[_0xd312('0x9f')]!==_0x5135b0[_0xd312('0xd2')]&&!this['actions'][_0x5135b0['linkedid']][_0xd312('0x48')]){if(_0x5135b0[_0xd312('0x12e')]==='1'){this[_0xd312('0x79')](_0x5135b0,_0x5135b0['linkedid'],_0x5135b0[_0xd312('0x12e')]);}}};Preview[_0xd312('0x11')][_0xd312('0x135')]=function(_0x52dfbf,_0xb233b6,_0x411ca0){if(this[_0xd312('0x17')][_0x52dfbf]){if(_[_0xd312('0xe7')](this['actions'][_0x52dfbf][_0xd312('0x11f')])){this['actions'][_0x52dfbf]['variables']={};}this[_0xd312('0x17')][_0x52dfbf]['variables'][_0xb233b6]=_0x411ca0;}};Preview[_0xd312('0x11')]['syncVarSet']=function(_0x254fd6){try{if(!_[_0xd312('0xe7')](_0x254fd6)){if(ut[_0xd312('0x136')](_[_0xd312('0x137')](_0x254fd6[_0xd312('0x138')])[0x0])){this[_0xd312('0x135')](_0x254fd6[_0xd312('0xd2')],_[_0xd312('0x137')](_0x254fd6[_0xd312('0x138')])[0x0],_0x254fd6['value']);}}}catch(_0xc5e917){logger['error'](_0xd312('0x139'),util[_0xd312('0x13a')](_0xc5e917,{'showHidden':![],'depth':null}));}};Preview[_0xd312('0x11')]['syncAttendedTransfer']=function(_0x432e6a){if(_0x432e6a){if(this[_0xd312('0x17')][_0x432e6a[_0xd312('0x13b')]]){this[_0xd312('0x17')][_0x432e6a[_0xd312('0x13b')]][_0xd312('0x133')]=!![];}}};Preview[_0xd312('0x11')][_0xd312('0x13c')]=function(_0x1cc13c){if(_0x1cc13c){if(this[_0xd312('0x17')][_0x1cc13c['transfererlinkedid']]){this['actions'][_0x1cc13c[_0xd312('0x13d')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 67a6a0e..0067d4c 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 _0x3f32=['inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3f32,0x8d));var _0x23f3=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x3f32[_0xb83ec2];return _0x4d2fbf;};'use strict';var util=require(_0x23f3('0x0'));var BPromise=require('bluebird');var logger=require(_0x23f3('0x1'))(_0x23f3('0x2'));var cmHopper=require(_0x23f3('0x3'));var cmHopperHistory=require(_0x23f3('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x23f3('0x5'));function loggerCatch(_0x5a211d){return function(_0x28041a){logger['error'](_0x5a211d,util[_0x23f3('0x6')](_0x28041a,{'showHidden':![],'depth':null}));};}function create(_0x3a9cd0){return cmHopperHistory[_0x23f3('0x7')](_0x3a9cd0)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x9')));}function createAgent(_0x5360c7){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](agentReportPreview[_0x23f3('0x7')](_0x5360c7))['catch'](loggerCatch(_0x23f3('0x9')));}function moveContact(_0x3422f6){return cmHopper[_0x23f3('0xc')](_0x3422f6,!![])[_0x23f3('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x23f3('0xd')]=function(_0x25ffaa){return cmHopperBlack[_0x23f3('0xd')](_0x25ffaa)[_0x23f3('0x8')](loggerCatch(_0x23f3('0xe')));};exports[_0x23f3('0xf')]=function(_0x1a1f64){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](cmHopper[_0x23f3('0xf')](_0x1a1f64))['catch'](loggerCatch(_0x23f3('0x10')));};exports['createHistory']=function(_0x51da5c,_0x25f1a7){create(_0x51da5c)[_0x23f3('0x8')](loggerCatch(_0x25f1a7));moveContact(_0x51da5c)[_0x23f3('0x8')](loggerCatch(_0x25f1a7));};exports['createAgentHistory']=function(_0x47169d,_0x719fa4){createAgent(_0x47169d)[_0x23f3('0x8')](loggerCatch(_0x719fa4));};exports['createCustomerHistory']=function(_0x4f27a2,_0x1e3ca8){create(_0x4f27a2)[_0x23f3('0x8')](loggerCatch(_0x1e3ca8));};exports['createCustomerFinal']=function(_0x2fd311,_0x1921e4){moveContact(_0x2fd311)[_0x23f3('0x8')](loggerCatch(_0x1921e4));};exports[_0x23f3('0x11')]=function(_0x16af01,_0x271a13,_0x215493){if(_0x271a13){_0x16af01['UserId']=null;}if(_0x215493){_0x16af01[_0x23f3('0x12')]=![];}return cmHopper[_0x23f3('0x11')](_0x16af01)['catch'](loggerCatch(_0x23f3('0x13')));};exports[_0x23f3('0x14')]=function(_0x3b44e5){return cmHopper[_0x23f3('0x14')](_0x3b44e5)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x15')));};exports['unlockContact']=function(_0x601354){return cmHopper[_0x23f3('0x16')]({'UserId':null},_0x601354,0x1)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x17')));};exports[_0x23f3('0x18')]=function(_0x1bfc96){return cmHopper[_0x23f3('0x16')]({'active':![]},_0x1bfc96,0x1)[_0x23f3('0x8')](loggerCatch(_0x23f3('0x19')));};exports[_0x23f3('0x1a')]=function(_0x31e256){var _0x21f125={};_0x21f125['type']=_0x31e256['type'];_0x21f125[_0x23f3('0x1b')]=_0x31e256['uniqueid'];_0x21f125[_0x23f3('0x1c')]=_0x31e256['calleridnum'];_0x21f125[_0x23f3('0x1d')]=_0x31e256[_0x23f3('0x1d')];_0x21f125[_0x23f3('0x1e')]=_0x31e256[_0x23f3('0x1e')];_0x21f125['queuecallerjoinAt']=_0x31e256[_0x23f3('0x1f')];_0x21f125[_0x23f3('0x20')]=_0x31e256[_0x23f3('0x1f')];_0x21f125['queuecallercomplete']=0x1;_0x21f125[_0x23f3('0x21')]=_0x31e256[_0x23f3('0x22')];_0x21f125[_0x23f3('0x23')]=_0x31e256[_0x23f3('0x24')];_0x21f125[_0x23f3('0x25')]=_0x23f3('0x26');_0x21f125['exten']=_0x23f3('0x27');_0x21f125[_0x23f3('0x28')]=0x0;_0x21f125[_0x23f3('0x29')]=0x1;_0x21f125[_0x23f3('0x2a')]=_0x31e256['membername'];_0x21f125[_0x23f3('0x2b')]=_0x23f3('0x2c');return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](voiceQueueReport['create'](_0x21f125))[_0x23f3('0x8')](loggerCatch(_0x23f3('0x2d')));};exports[_0x23f3('0x2e')]=function(_0x1685d4,_0xf8674e){return BPromise[_0x23f3('0xa')]()[_0x23f3('0xb')](cmHopper[_0x23f3('0x2e')](_0x1685d4,_0xf8674e))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x23f3('0x2f')]=function(_0x27307a){return cmHopper[_0x23f3('0x11')](_0x27307a,!![],!![])[_0x23f3('0x8')](loggerCatch(_0x23f3('0x30')));}; \ No newline at end of file +var _0x047a=['[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','from-sip','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue'];(function(_0x3737c6,_0x3367b2){var _0x353f64=function(_0x57fd67){while(--_0x57fd67){_0x3737c6['push'](_0x3737c6['shift']());}};_0x353f64(++_0x3367b2);}(_0x047a,0xa0));var _0xa047=function(_0x59137b,_0x20880e){_0x59137b=_0x59137b-0x0;var _0x267490=_0x047a[_0x59137b];return _0x267490;};'use strict';var util=require(_0xa047('0x0'));var BPromise=require('bluebird');var logger=require(_0xa047('0x1'))(_0xa047('0x2'));var cmHopper=require(_0xa047('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa047('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x38b32b){return function(_0x2fc16a){logger[_0xa047('0x5')](_0x38b32b,util[_0xa047('0x6')](_0x2fc16a,{'showHidden':![],'depth':null}));};}function create(_0x455943){return cmHopperHistory[_0xa047('0x7')](_0x455943)[_0xa047('0x8')](loggerCatch(_0xa047('0x9')));}function createAgent(_0x4b267a){return BPromise[_0xa047('0xa')]()[_0xa047('0xb')](agentReportPreview[_0xa047('0x7')](_0x4b267a))['catch'](loggerCatch(_0xa047('0x9')));}function moveContact(_0x174a17){return cmHopper[_0xa047('0xc')](_0x174a17,!![])[_0xa047('0x8')](loggerCatch(_0xa047('0xd')));}exports[_0xa047('0xe')]=function(_0x5e54df){return cmHopperBlack[_0xa047('0xe')](_0x5e54df)[_0xa047('0x8')](loggerCatch(_0xa047('0xf')));};exports['getContactPreview']=function(_0x2d2dda){return BPromise[_0xa047('0xa')]()[_0xa047('0xb')](cmHopper[_0xa047('0x10')](_0x2d2dda))[_0xa047('0x8')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x3d686e,_0x1cacea){create(_0x3d686e)[_0xa047('0x8')](loggerCatch(_0x1cacea));moveContact(_0x3d686e)[_0xa047('0x8')](loggerCatch(_0x1cacea));};exports['createAgentHistory']=function(_0x37d72a,_0x32fb1d){createAgent(_0x37d72a)[_0xa047('0x8')](loggerCatch(_0x32fb1d));};exports[_0xa047('0x11')]=function(_0x49122e,_0x5761e2){create(_0x49122e)[_0xa047('0x8')](loggerCatch(_0x5761e2));};exports[_0xa047('0x12')]=function(_0x38097c,_0x17b934){moveContact(_0x38097c)[_0xa047('0x8')](loggerCatch(_0x17b934));};exports['rescheduleContact']=function(_0x26aa83,_0x49ff4e,_0x3f3cd0){if(_0x49ff4e){_0x26aa83[_0xa047('0x13')]=null;}if(_0x3f3cd0){_0x26aa83[_0xa047('0x14')]=![];}return cmHopper[_0xa047('0x15')](_0x26aa83)[_0xa047('0x8')](loggerCatch(_0xa047('0x16')));};exports['countReScheduled']=function(_0x5f5b36){return cmHopper[_0xa047('0x17')](_0x5f5b36)[_0xa047('0x8')](loggerCatch(_0xa047('0x18')));};exports[_0xa047('0x19')]=function(_0x45f47b){return cmHopper['unlockContact']({'UserId':null},_0x45f47b,0x1)[_0xa047('0x8')](loggerCatch(_0xa047('0x1a')));};exports[_0xa047('0x1b')]=function(_0x42e069){return cmHopper[_0xa047('0x19')]({'active':![]},_0x42e069,0x1)[_0xa047('0x8')](loggerCatch(_0xa047('0x1c')));};exports[_0xa047('0x1d')]=function(_0x5e8901){var _0x39bbc5={};_0x39bbc5['type']=_0x5e8901[_0xa047('0x1e')];_0x39bbc5[_0xa047('0x1f')]=_0x5e8901[_0xa047('0x1f')];_0x39bbc5['calleridnum']=_0x5e8901[_0xa047('0x20')];_0x39bbc5['calleridname']=_0x5e8901['calleridname'];_0x39bbc5[_0xa047('0x21')]=_0x5e8901[_0xa047('0x21')];_0x39bbc5[_0xa047('0x22')]=_0x5e8901['answertime'];_0x39bbc5[_0xa047('0x23')]=_0x5e8901[_0xa047('0x24')];_0x39bbc5[_0xa047('0x25')]=0x1;_0x39bbc5['queuecallercompleteAt']=_0x5e8901[_0xa047('0x26')];_0x39bbc5[_0xa047('0x27')]=_0x5e8901[_0xa047('0x28')];_0x39bbc5['context']=_0xa047('0x29');_0x39bbc5['exten']='xcally-motion-preview';_0x39bbc5[_0xa047('0x2a')]=0x0;_0x39bbc5[_0xa047('0x2b')]=0x1;_0x39bbc5[_0xa047('0x2c')]=_0x5e8901[_0xa047('0x28')];_0x39bbc5[_0xa047('0x2d')]=_0xa047('0x2e');return BPromise[_0xa047('0xa')]()['then'](voiceQueueReport[_0xa047('0x2f')](_0x39bbc5))[_0xa047('0x8')](loggerCatch(_0xa047('0x30')));};exports[_0xa047('0x31')]=function(_0x18dd3d,_0xadcf18){return BPromise[_0xa047('0xa')]()[_0xa047('0xb')](cmHopper[_0xa047('0x31')](_0x18dd3d,_0xadcf18))[_0xa047('0x8')](loggerCatch(_0xa047('0x32')));};exports[_0xa047('0x33')]=function(_0x3a3377){return cmHopper[_0xa047('0x15')](_0x3a3377,!![],!![])[_0xa047('0x8')](loggerCatch(_0xa047('0x34')));}; \ 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 11b3ea5..3718a9e 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 _0xbeb5=['[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','idContact','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','ContactId','dialer','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','getSeconds','starttime','logLookAgent','membername','UserId','statedesc','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','scheduledAt','active','scheduledat','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative'];(function(_0x53f2b9,_0x572f3e){var _0x2eab82=function(_0x2b2ed1){while(--_0x2b2ed1){_0x53f2b9['push'](_0x53f2b9['shift']());}};_0x2eab82(++_0x572f3e);}(_0xbeb5,0x14c));var _0x5beb=function(_0x5deed2,_0x498a8b){_0x5deed2=_0x5deed2-0x0;var _0x25172f=_0xbeb5[_0x5deed2];return _0x25172f;};'use strict';var util=require('util');var _=require(_0x5beb('0x0'));var moment=require(_0x5beb('0x1'));var logger=require(_0x5beb('0x2'))(_0x5beb('0x3'));var ipAgi=process[_0x5beb('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x5beb('0x5'));exports[_0x5beb('0x6')]=function(_0x2c54a2){return function(_0x2d89ac){logger[_0x5beb('0x7')](_0x2c54a2,util[_0x5beb('0x8')](_0x2d89ac,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x181c2e,_0xcd1d97){logger[_0x5beb('0x9')](_0x181c2e,util[_0x5beb('0x8')](_0xcd1d97,{'showHidden':![],'depth':null}));};exports[_0x5beb('0xa')]=function(_0x28e5f6,_0x313d73){logger[_0x5beb('0x7')](_0x28e5f6,util['inspect'](_0x313d73,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x489605){return function(_0x4923e4){logger['info'](_0x489605,util[_0x5beb('0x8')](_0x4923e4,{'showHidden':![],'depth':null}));};};exports[_0x5beb('0xb')]=function(_0x17d062,_0x4352aa,_0x691b93){return{'message':_0x17d062,'unlock':_0x4352aa,'active':_0x691b93};};exports[_0x5beb('0xc')]=function(_0x59d373,_0x22db24,_0x2dcb97){if(!_[_0x5beb('0xd')](_0x2dcb97)&&_0x5beb('0xe')===typeof _0x2dcb97&&!_[_0x5beb('0xf')](_0x2dcb97)){if(!_[_0x5beb('0xd')](_0x22db24)&&'string'===typeof _0x22db24&&!_[_0x5beb('0xf')](_0x22db24)){return util['format'](_0x5beb('0x10'),_0x22db24,_0x2dcb97);}return util[_0x5beb('0x11')]('\x22%s\x22\x20<%s>',_0x2dcb97,_0x2dcb97);}if(!_[_0x5beb('0xd')](_0x59d373)&&_0x5beb('0xe')===typeof _0x59d373&&!_['isEmpty'](_0x59d373)){return _0x59d373;}return _0x5beb('0x12');};exports['isActive']=function(_0x4c99d6){if(_[_0x5beb('0x13')](_0x4c99d6)){return![];}return _0x4c99d6;};exports[_0x5beb('0x14')]=function(_0x16e4cc,_0x174145,_0x1a58c7,_0x26f196,_0x5a7964,_0x1ee2a9){var _0x4b1c7f={'XMD-QUEUE':_0x174145[_0x5beb('0x15')]?_0x174145[_0x5beb('0x15')]['name']:'','XMD-CALLERID':_0x26f196,'XMD-CALLERID-PREVIEW':_0x1ee2a9?util[_0x5beb('0x11')](_0x5beb('0x10'),_0x1ee2a9[_0x5beb('0x16')],_0x1ee2a9['calleridnum']):_0x26f196,'XMD-DIALID':_0x5a7964,'XMD-CONTACTID':_0x174145[_0x5beb('0x17')],'XMD-CDRTYPE':_0x5beb('0x18'),'CALLERID(all)':_0x26f196,'XMD-VOICEQUEUEID':_0x174145['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1a58c7,'XMD-DIALTIMEOUT':_0x16e4cc[_0x5beb('0x19')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x16e4cc[_0x5beb('0x1a')]?'g':'',_[_0x5beb('0xf')](_0x16e4cc[_0x5beb('0x1b')])?'':_0x5beb('0x1c')),'XMD-DIALURL':_0x16e4cc['dialPreviewUrl']||'','XMD-AGI':_0x16e4cc[_0x5beb('0x1d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x16e4cc['dialQueueProject']):_0x5beb('0x1e'),'XMD-AGIAFTER':_0x16e4cc['dialQueueProject2']?util['format'](_0x5beb('0x1f'),ipAgi,_0x16e4cc[_0x5beb('0x1a')]):_0x5beb('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x1ee2a9?_0x1ee2a9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1ee2a9?_0x1ee2a9[_0x5beb('0x20')]:'','XMD-DESTINATION':_0x5beb('0x21'),'SIPADDHEADER':_0x5beb('0x22')};if(!_[_0x5beb('0xf')](_0x16e4cc[_0x5beb('0x1b')])){_0x4b1c7f[util[_0x5beb('0x11')]('%s',_0x5beb('0x23'))]=_0x16e4cc[_0x5beb('0x1b')];_0x4b1c7f[util[_0x5beb('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5a7964;}return _0x4b1c7f;};exports[_0x5beb('0x24')]=function(_0x572847){var _0x18cb1a={};for(var _0x4edf06 in _0x572847){if(_0x572847[_0x5beb('0x25')](_0x4edf06)){_0x18cb1a[util['format']('%s',_[_0x5beb('0x26')](_0x4edf06))]=_0x572847[_0x4edf06];}}return{'variables':_0x18cb1a};};exports[_0x5beb('0x27')]=function(_0x1d0217,_0x2f7716){if(!_[_0x5beb('0x13')](_0x1d0217)){if(_0x1d0217[_0x5beb('0x25')](_0x5beb('0x28'))){if(_0x1d0217['originated']>0x0){_0x1d0217['originated']-=0x1;}else{logger[_0x5beb('0x7')](_0x5beb('0x29'),_0x2f7716);}}}else{logger[_0x5beb('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2f7716);}};exports[_0x5beb('0x2a')]=function(_0x1b5eba){var _0x4ba02f=moment()[_0x5beb('0x11')](_0x5beb('0x2b'));_0x1b5eba[_0x5beb('0x2c')]=0xd;_0x1b5eba['statedesc']=_0x5beb('0x2d');_0x1b5eba['starttime']=_0x4ba02f;_0x1b5eba[_0x5beb('0x2e')]=_0x4ba02f;_0x1b5eba[_0x5beb('0x2f')]=_0x4ba02f;};exports['logAgent']=function(_0x2b2840,_0x3f4a1c,_0xb026be){var _0x1a152b=moment()['format'](_0x5beb('0x2b'));_0x2b2840['state']=_0x3f4a1c;_0x2b2840['statedesc']=_0xb026be;_0x2b2840[_0x5beb('0x2e')]=_0x1a152b;_0x2b2840['ringtime']=utils[_0x5beb('0x30')](_0x2b2840['responsetime'],_0x2b2840[_0x5beb('0x31')]);};exports[_0x5beb('0x32')]=function(_0x2d3db0,_0x24be48,_0x1054de){_0x2d3db0[_0x5beb('0x33')]=_0x24be48;_0x2d3db0[_0x5beb('0x34')]=_0x1054de;};exports['logCustomer']=function(_0x1239ae,_0x3012f5,_0x168890){var _0xb7479d=moment()['format'](_0x5beb('0x2b'));_0x1239ae['state']=_0x3012f5;_0x1239ae[_0x5beb('0x35')]=_0x168890;_0x1239ae[_0x5beb('0x2e')]=_0x1239ae[_0x5beb('0x2e')]?_0x1239ae['responsetime']:_0xb7479d;_0x1239ae[_0x5beb('0x2f')]=_0x1239ae[_0x5beb('0x2f')]?_0x1239ae[_0x5beb('0x2f')]:_0xb7479d;_0x1239ae['ringtime']=utils[_0x5beb('0x30')](_0x1239ae['responsetime']||0x0,_0x1239ae[_0x5beb('0x31')]||0x0);_0x1239ae['talktime']=_0x1239ae['answertime']?utils['getSeconds'](_0x1239ae[_0x5beb('0x2f')],_0x1239ae[_0x5beb('0x36')]):0x0;};exports[_0x5beb('0x37')]=function(_0x505351){return _0x505351===_0x5beb('0x38');};exports['variablesAction']=function(_0x4f95d7,_0x2f11c8,_0x1d1db2,_0x284584,_0x40b7eb){var _0x1c34ad=_0x284584?_0x5beb('0x39'):_0x4f95d7[_0x5beb('0x16')];_0x1c34ad=_0x40b7eb?_0x5beb('0x3a'):_0x1c34ad;return{'actionid':_0x4f95d7[_0x5beb('0x3b')],'action':_0x5beb('0x3c'),'channel':_0x4f95d7[_0x5beb('0x3d')],'callerid':util[_0x5beb('0x11')](_0x5beb('0x10'),_0x1c34ad,_0x4f95d7['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x5beb('0x3e'),'Priority':'1','variable':_0x1d1db2,'timeout':(_0x2f11c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4f95d7['uniqueid']};};exports['totalGlobal']=function(_0x49b8ca){return _0x49b8ca[_0x5beb('0x3f')]+_0x49b8ca[_0x5beb('0x40')]+_0x49b8ca[_0x5beb('0x41')]+_0x49b8ca[_0x5beb('0x42')]+_0x49b8ca['countnosuchnumberretry'];};exports['cloneAction']=function(_0x23dfe9){var _0x90c400=_[_0x5beb('0x43')](_0x23dfe9);_0x90c400['state']=0xf;_0x90c400[_0x5beb('0x35')]=_0x5beb('0x44');return _0x90c400;};exports[_0x5beb('0x45')]=function(_0x18ece8,_0x548195,_0x40520f){var _0x16a254={};_0x16a254[_0x548195]=_0x18ece8[_0x548195];_0x16a254[_0x5beb('0x46')]=![];_0x16a254[_0x5beb('0x47')]=moment()['add'](_0x40520f,'minutes')[_0x5beb('0x11')](_0x5beb('0x2b'));_0x16a254['ContactId']=_0x18ece8[_0x5beb('0x17')];_0x16a254[_0x5beb('0x48')]=_0x18ece8[_0x5beb('0x48')];_0x16a254[_0x5beb('0x49')]=_0x18ece8[_0x5beb('0x49')]||undefined;return _0x16a254;};exports['decrementTalkink']=function(_0x3ad0eb,_0x211b23){if(!_[_0x5beb('0x13')](_0x3ad0eb)){if(_0x3ad0eb[_0x5beb('0x4a')]>0x0){_0x3ad0eb['pTalking']-=0x1;}else{logger[_0x5beb('0x7')](_0x211b23,_0x5beb('0x4b'));}}else{logger[_0x5beb('0x7')](_0x211b23,_0x5beb('0x4c'));}};exports[_0x5beb('0x4d')]=function(_0x200a7a){if(_0x200a7a<=0x0){return!![];}return![];};function buildObj(_0x4c343f,_0xf68ab3,_0x4aab63){_0x4c343f[_0x5beb('0x4e')]=_0xf68ab3;_0x4c343f[_0x5beb('0x4f')]=_0x4c343f[_0x5beb('0x50')];_0x4c343f['interface']=_0x4c343f['channelAgent'];_0x4c343f[_0x5beb('0x51')]=_0x5beb('0x52');if(_0x4aab63){_0x4c343f[_0x5beb('0x53')]=_0x4aab63[_0x5beb('0x53')];}return _0x4c343f;}exports[_0x5beb('0x54')]=buildObj;exports[_0x5beb('0x55')]=function(_0x179130){var _0x35ecf6={};_0x35ecf6[_0x5beb('0x50')]=_0x179130[_0x5beb('0x50')];_0x35ecf6[_0x5beb('0x56')]=_0x179130[_0x5beb('0x3d')];_0x35ecf6[_0x5beb('0x3b')]=_0x179130[_0x5beb('0x3b')];return _0x35ecf6;};exports[_0x5beb('0x57')]=function(_0x4b4901){var _0x2bb268=[];for(var _0x549677 in _0x4b4901){if(_0x4b4901[_0x5beb('0x25')](_0x549677)){if(!_['isNil'](_0x4b4901[_0x549677])&&_0x4b4901[_0x549677]['state']===_0x5beb('0x58')&&_0x4b4901[_0x549677][_0x5beb('0x59')]===_0x5beb('0x5a')){_0x2bb268[_0x5beb('0x5b')](_0x4b4901[_0x549677]['id']);}}}return _0x2bb268;};exports[_0x5beb('0x5c')]=function(_0x54dc14){var _0x13d668=moment()[_0x5beb('0x5d')](0x0);var _0x20dd4a=moment(_0x54dc14)['milliseconds'](0x0);return _0x13d668[_0x5beb('0x5e')](_0x20dd4a,_0x5beb('0x5f'));};exports['createBody']=function(_0x2b7bf8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b7bf8['ContactId'],'ListId':_0x2b7bf8[_0x5beb('0x48')],'VoiceQueueId':_0x2b7bf8[_0x5beb('0x49')]||undefined,'CampaignId':_0x2b7bf8[_0x5beb('0x60')]||undefined};};exports['filterKey']=function(_0xb22d80){if(_0xb22d80===_0x5beb('0x3b')||_0xb22d80===_0x5beb('0x61')||_0xb22d80==='queue'||_0xb22d80==='type'||_0xb22d80===_0x5beb('0x62')||_0xb22d80===_0x5beb('0x63')||_0xb22d80===_0x5beb('0x33')||_0xb22d80===_0x5beb('0x3d')||_0xb22d80===_0x5beb('0x16')||_0xb22d80==='active'||_0xb22d80==='calleridnum'||_0xb22d80===_0x5beb('0x47')||_0xb22d80===_0x5beb('0x3f')||_0xb22d80===_0x5beb('0x40')||_0xb22d80==='countnoanswerretry'||_0xb22d80===_0x5beb('0x64')||_0xb22d80===_0x5beb('0x65')||_0xb22d80===_0x5beb('0x66')||_0xb22d80===_0x5beb('0x67')||_0xb22d80==='recallme'||_0xb22d80===_0x5beb('0x17')||_0xb22d80==='ListId'||_0xb22d80===_0x5beb('0x34')||_0xb22d80===_0x5beb('0x49')||_0xb22d80==='sipcallid'||_0xb22d80===_0x5beb('0x68')||_0xb22d80==='xmd-queue'||_0xb22d80==='xmd-phone'||_0xb22d80===_0x5beb('0x69')||_0xb22d80===_0x5beb('0x6a')||_0xb22d80===_0x5beb('0x6b')||_0xb22d80===_0x5beb('0x6c')||_0xb22d80===_0x5beb('0x6d')||_0xb22d80===_0x5beb('0x6e')||_0xb22d80===_0x5beb('0x6f')||_0xb22d80==='xmd-cdrtype'||_0xb22d80===_0x5beb('0x70')||_0xb22d80==='xmd-agiafter'||_0xb22d80===_0x5beb('0x71')||_0xb22d80===_0x5beb('0x72')||_0xb22d80===_0x5beb('0x73')||_0xb22d80==='rtpaudioqosjitter'||_0xb22d80===_0x5beb('0x74')||_0xb22d80===_0x5beb('0x75')||_0xb22d80===_0x5beb('0x76')||_0xb22d80===_0x5beb('0x77')||_0xb22d80===_0x5beb('0x78')||_0xb22d80===_0x5beb('0x72')||_0xb22d80===_0x5beb('0x73')||_0xb22d80===_0x5beb('0x79')||_0xb22d80===_0x5beb('0x74')||_0xb22d80===_0x5beb('0x75')||_0xb22d80===_0x5beb('0x76')||_0xb22d80===_0x5beb('0x77')||_0xb22d80===_0x5beb('0x78')||_0xb22d80===_0x5beb('0x7a')||_0xb22d80===_0x5beb('0x7b')||_0xb22d80===_0x5beb('0x2c')||_0xb22d80===_0x5beb('0x35')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4ff12c,_0x1dd893){var _0x3deeaf,_0x599c48,_0x33b197;if(_0x1dd893<=0x0){_0x1dd893=0x1;}_0x3deeaf=new RegExp(_0x5beb('0x7c')+_0x1dd893+'}$');_0x599c48=Math['pow'](0xa,_0x1dd893-0x1);_0x33b197=Math[_0x5beb('0x7d')](0xa,_0x1dd893)-0x1;return util['format']('%s',_[_0x5beb('0x7e')](_0x4ff12c,_0x3deeaf,_[_0x5beb('0x7f')](_0x599c48,_0x33b197)));};exports[_0x5beb('0x80')]=function(_0x474126){var _0x4b792f=_0x474126[_0x5beb('0x81')](/"(.*?)"/);return _0x4b792f?_0x4b792f[0x1]:_0x474126;};exports[_0x5beb('0x82')]=function(_0x302d60){var _0x228a44=_0x302d60[_0x5beb('0x81')](/<(.*?)>/);return _0x228a44?_0x228a44[0x1]:_0x302d60;};function buildNoAnswerEventPayload(_0x486062,_0x234335){var _0xeebff2=buildObj(_0x486062,_0x5beb('0x83'));if(!_[_0x5beb('0xf')](_0x234335[_0x5beb('0x84')])){Object[_0x5beb('0x85')](_0x234335[_0x5beb('0x84')])[_0x5beb('0x86')](function(_0x7b1be3){_0xeebff2[_0x7b1be3[_0x5beb('0x87')]()]=_0x234335[_0x5beb('0x84')][_0x7b1be3];});}return _0xeebff2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x254a=['string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','starttime','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','error','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','mandatoryDisposition','agentReadyId','hasOwnProperty','not_inuse','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','message','isUndefined'];(function(_0x3e0f8f,_0x23bb44){var _0x99b31b=function(_0x5e835d){while(--_0x5e835d){_0x3e0f8f['push'](_0x3e0f8f['shift']());}};_0x99b31b(++_0x23bb44);}(_0x254a,0x7d));var _0xa254=function(_0x3e2810,_0x104d34){_0x3e2810=_0x3e2810-0x0;var _0x577d18=_0x254a[_0x3e2810];return _0x577d18;};'use strict';var util=require('util');var _=require(_0xa254('0x0'));var moment=require(_0xa254('0x1'));var logger=require('../../../../config/logger')(_0xa254('0x2'));var ipAgi=process[_0xa254('0x3')][_0xa254('0x4')]||_0xa254('0x5');var utils=require(_0xa254('0x6'));exports[_0xa254('0x7')]=function(_0x1784ca){return function(_0x55386d){logger['error'](_0x1784ca,util[_0xa254('0x8')](_0x55386d,{'showHidden':![],'depth':null}));};};exports[_0xa254('0x9')]=function(_0x57c0b3,_0x36c12e){logger[_0xa254('0xa')](_0x57c0b3,util['inspect'](_0x36c12e,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3b7539,_0x2edeae){logger['error'](_0x3b7539,util['inspect'](_0x2edeae,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2ec525){return function(_0x4a356e){logger[_0xa254('0xa')](_0x2ec525,util[_0xa254('0x8')](_0x4a356e,{'showHidden':![],'depth':null}));};};exports[_0xa254('0xb')]=function(_0x3b61e0,_0x152444,_0x2f1345){return{'message':_0x3b61e0,'unlock':_0x152444,'active':_0x2f1345};};exports['getCallerId']=function(_0x302f7f,_0x5d7eb4,_0x5b11ac){if(!_[_0xa254('0xc')](_0x5b11ac)&&_0xa254('0xd')===typeof _0x5b11ac&&!_['isEmpty'](_0x5b11ac)){if(!_[_0xa254('0xc')](_0x5d7eb4)&&_0xa254('0xd')===typeof _0x5d7eb4&&!_[_0xa254('0xe')](_0x5d7eb4)){return util[_0xa254('0xf')](_0xa254('0x10'),_0x5d7eb4,_0x5b11ac);}return util[_0xa254('0xf')]('\x22%s\x22\x20<%s>',_0x5b11ac,_0x5b11ac);}if(!_[_0xa254('0xc')](_0x302f7f)&&'string'===typeof _0x302f7f&&!_[_0xa254('0xe')](_0x302f7f)){return _0x302f7f;}return _0xa254('0x11');};exports['isActive']=function(_0x3d2688){if(_['isNil'](_0x3d2688)){return![];}return _0x3d2688;};exports[_0xa254('0x12')]=function(_0x38ba6d,_0x2cb215,_0x4a3645,_0x1dc4c4,_0x1403ed,_0x45c664){var _0x214f5c={'XMD-QUEUE':_0x2cb215['Queue']?_0x2cb215[_0xa254('0x13')][_0xa254('0x14')]:'','XMD-CALLERID':_0x1dc4c4,'XMD-CALLERID-PREVIEW':_0x45c664?util[_0xa254('0xf')]('\x22%s\x22\x20<%s>',_0x45c664[_0xa254('0x15')],_0x45c664[_0xa254('0x16')]):_0x1dc4c4,'XMD-DIALID':_0x1403ed,'XMD-CONTACTID':_0x2cb215[_0xa254('0x17')],'XMD-CDRTYPE':_0xa254('0x18'),'CALLERID(all)':_0x1dc4c4,'XMD-VOICEQUEUEID':_0x2cb215[_0xa254('0x19')],'XMD-DIALCHANNEL':_0x4a3645,'XMD-DIALTIMEOUT':_0x38ba6d[_0xa254('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xa254('0xf')](_0xa254('0x1b'),_0x38ba6d[_0xa254('0x1c')]?'g':'',_[_0xa254('0xe')](_0x38ba6d[_0xa254('0x1d')])?'':_0xa254('0x1e')),'XMD-DIALURL':_0x38ba6d['dialPreviewUrl']||'','XMD-AGI':_0x38ba6d[_0xa254('0x1f')]?util['format'](_0xa254('0x20'),ipAgi,_0x38ba6d[_0xa254('0x1f')]):_0xa254('0x21'),'XMD-AGIAFTER':_0x38ba6d[_0xa254('0x1c')]?util[_0xa254('0xf')](_0xa254('0x20'),ipAgi,_0x38ba6d['dialQueueProject2']):_0xa254('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x45c664?_0x45c664['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x45c664?_0x45c664[_0xa254('0x22')]:'','XMD-DESTINATION':_0xa254('0x23'),'SIPADDHEADER':_0xa254('0x24')};if(!_['isEmpty'](_0x38ba6d[_0xa254('0x1d')])){_0x214f5c[util['format']('%s',_0xa254('0x25'))]=_0x38ba6d[_0xa254('0x1d')];_0x214f5c[util['format']('%s',_0xa254('0x26'))]=_0x1403ed;}return _0x214f5c;};exports[_0xa254('0x27')]=function(_0x3fa7fa){var _0x15f175={};for(var _0x8ce87c in _0x3fa7fa){if(_0x3fa7fa['hasOwnProperty'](_0x8ce87c)){_0x15f175[util[_0xa254('0xf')]('%s',_[_0xa254('0x28')](_0x8ce87c))]=_0x3fa7fa[_0x8ce87c];}}return{'variables':_0x15f175};};exports[_0xa254('0x29')]=function(_0x37ac7a,_0x231441){if(!_['isNil'](_0x37ac7a)){if(_0x37ac7a['hasOwnProperty'](_0xa254('0x2a'))){if(_0x37ac7a['originated']>0x0){_0x37ac7a['originated']-=0x1;}else{logger['error'](_0xa254('0x2b'),_0x231441);}}}else{logger['error'](_0xa254('0x2c'),_0x231441);}};exports['logBlacklist']=function(_0x488d36){var _0x366715=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x488d36[_0xa254('0x2d')]=0xd;_0x488d36[_0xa254('0x2e')]='Blacklist';_0x488d36[_0xa254('0x2f')]=_0x366715;_0x488d36['responsetime']=_0x366715;_0x488d36['endtime']=_0x366715;};exports['logAgent']=function(_0x87fcba,_0x40b9d6,_0x11e9fa){var _0x1c84a6=moment()['format'](_0xa254('0x30'));_0x87fcba['state']=_0x40b9d6;_0x87fcba[_0xa254('0x2e')]=_0x11e9fa;_0x87fcba[_0xa254('0x31')]=_0x1c84a6;_0x87fcba[_0xa254('0x32')]=utils[_0xa254('0x33')](_0x87fcba[_0xa254('0x31')],_0x87fcba[_0xa254('0x2f')]);};exports[_0xa254('0x34')]=function(_0x2305d4,_0x56136a,_0x56b08f){_0x2305d4[_0xa254('0x35')]=_0x56136a;_0x2305d4[_0xa254('0x36')]=_0x56b08f;};exports['logCustomer']=function(_0x43b21b,_0x114cc5,_0x43039e){var _0x5d46dd=moment()[_0xa254('0xf')](_0xa254('0x30'));_0x43b21b[_0xa254('0x2d')]=_0x114cc5;_0x43b21b[_0xa254('0x2e')]=_0x43039e;_0x43b21b[_0xa254('0x31')]=_0x43b21b[_0xa254('0x31')]?_0x43b21b[_0xa254('0x31')]:_0x5d46dd;_0x43b21b[_0xa254('0x37')]=_0x43b21b['endtime']?_0x43b21b[_0xa254('0x37')]:_0x5d46dd;_0x43b21b[_0xa254('0x32')]=utils[_0xa254('0x33')](_0x43b21b['responsetime']||0x0,_0x43b21b[_0xa254('0x2f')]||0x0);_0x43b21b[_0xa254('0x38')]=_0x43b21b[_0xa254('0x39')]?utils[_0xa254('0x33')](_0x43b21b[_0xa254('0x37')],_0x43b21b[_0xa254('0x39')]):0x0;};exports[_0xa254('0x3a')]=function(_0x389029){return _0x389029===_0xa254('0x3b');};exports[_0xa254('0x3c')]=function(_0x1d8d11,_0x3d71b5,_0x96e08,_0x4fa3e1,_0x4cdb18){var _0x3e6e69=_0x4fa3e1?_0xa254('0x3d'):_0x1d8d11[_0xa254('0x15')];_0x3e6e69=_0x4cdb18?_0xa254('0x3e'):_0x3e6e69;return{'actionid':_0x1d8d11[_0xa254('0x3f')],'action':_0xa254('0x40'),'channel':_0x1d8d11[_0xa254('0x41')],'callerid':util[_0xa254('0xf')](_0xa254('0x10'),_0x3e6e69,_0x1d8d11[_0xa254('0x16')]),'Exten':'xcally-motion-preview','Context':_0xa254('0x42'),'Priority':'1','variable':_0x96e08,'timeout':(_0x3d71b5['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1d8d11[_0xa254('0x3f')]};};exports[_0xa254('0x43')]=function(_0x5a3d75){return _0x5a3d75[_0xa254('0x44')]+_0x5a3d75[_0xa254('0x45')]+_0x5a3d75[_0xa254('0x46')]+_0x5a3d75['countagentrejectretry']+_0x5a3d75['countnosuchnumberretry'];};exports[_0xa254('0x47')]=function(_0xb87de9){var _0x371502=_[_0xa254('0x48')](_0xb87de9);_0x371502[_0xa254('0x2d')]=0xf;_0x371502['statedesc']=_0xa254('0x49');return _0x371502;};exports[_0xa254('0x4a')]=function(_0x3323ea,_0x36c7df,_0x1ea601){var _0xfa1878={};_0xfa1878[_0x36c7df]=_0x3323ea[_0x36c7df];_0xfa1878[_0xa254('0x4b')]=![];_0xfa1878[_0xa254('0x4c')]=moment()[_0xa254('0x4d')](_0x1ea601,_0xa254('0x4e'))[_0xa254('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0xfa1878[_0xa254('0x17')]=_0x3323ea[_0xa254('0x17')];_0xfa1878['ListId']=_0x3323ea[_0xa254('0x4f')];_0xfa1878[_0xa254('0x19')]=_0x3323ea['VoiceQueueId']||undefined;return _0xfa1878;};exports[_0xa254('0x50')]=function(_0x5d82d3,_0x5229f9){if(!_[_0xa254('0x51')](_0x5d82d3)){if(_0x5d82d3[_0xa254('0x52')]>0x0){_0x5d82d3[_0xa254('0x52')]-=0x1;}else{logger['error'](_0x5229f9,_0xa254('0x53'));}}else{logger[_0xa254('0x54')](_0x5229f9,_0xa254('0x55'));}};exports['IsNotLoggedIn']=function(_0x5b999a){if(_0x5b999a<=0x0){return!![];}return![];};function buildObj(_0x2f11d4,_0x54eee8,_0x907845){_0x2f11d4[_0xa254('0x56')]=_0x54eee8;_0x2f11d4[_0xa254('0x14')]=_0x2f11d4[_0xa254('0x57')];_0x2f11d4[_0xa254('0x58')]=_0x2f11d4['channelAgent'];_0x2f11d4[_0xa254('0x59')]='voice';if(_0x907845){_0x2f11d4[_0xa254('0x5a')]=_0x907845[_0xa254('0x5a')];}return _0x2f11d4;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x13cbdb){var _0xb32ac8={};_0xb32ac8[_0xa254('0x57')]=_0x13cbdb['queue'];_0xb32ac8[_0xa254('0x58')]=_0x13cbdb[_0xa254('0x41')];_0xb32ac8[_0xa254('0x3f')]=_0x13cbdb[_0xa254('0x3f')];return _0xb32ac8;};exports[_0xa254('0x5b')]=function(_0x3cfb27){var _0x36b529=[];for(var _0x241cf6 in _0x3cfb27){if(_0x3cfb27[_0xa254('0x5c')](_0x241cf6)){if(!_[_0xa254('0x51')](_0x3cfb27[_0x241cf6])&&_0x3cfb27[_0x241cf6][_0xa254('0x2d')]===_0xa254('0x5d')&&_0x3cfb27[_0x241cf6]['status']===_0xa254('0x5e')){_0x36b529[_0xa254('0x5f')](_0x3cfb27[_0x241cf6]['id']);}}}return _0x36b529;};exports[_0xa254('0x60')]=function(_0x199e7f){var _0x3398df=moment()[_0xa254('0x61')](0x0);var _0x218487=moment(_0x199e7f)[_0xa254('0x61')](0x0);return _0x3398df[_0xa254('0x62')](_0x218487,'seconds');};exports[_0xa254('0x63')]=function(_0x2cf0be){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2cf0be[_0xa254('0x17')],'ListId':_0x2cf0be[_0xa254('0x4f')],'VoiceQueueId':_0x2cf0be['VoiceQueueId']||undefined,'CampaignId':_0x2cf0be[_0xa254('0x64')]||undefined};};exports[_0xa254('0x65')]=function(_0x520731){if(_0x520731==='uniqueid'||_0x520731==='idContact'||_0x520731===_0xa254('0x57')||_0x520731===_0xa254('0x66')||_0x520731===_0xa254('0x67')||_0x520731===_0xa254('0x68')||_0x520731===_0xa254('0x35')||_0x520731===_0xa254('0x41')||_0x520731===_0xa254('0x15')||_0x520731===_0xa254('0x4b')||_0x520731==='calleridnum'||_0x520731===_0xa254('0x4c')||_0x520731==='countbusyretry'||_0x520731===_0xa254('0x45')||_0x520731==='countnoanswerretry'||_0x520731==='countglobal'||_0x520731==='callback'||_0x520731==='callbackuniqueid'||_0x520731==='callbackat'||_0x520731===_0xa254('0x69')||_0x520731===_0xa254('0x17')||_0x520731==='ListId'||_0x520731===_0xa254('0x36')||_0x520731===_0xa254('0x19')||_0x520731===_0xa254('0x6a')||_0x520731===_0xa254('0x6b')||_0x520731===_0xa254('0x6c')||_0x520731===_0xa254('0x6d')||_0x520731==='xmd-listid'||_0x520731===_0xa254('0x6e')||_0x520731===_0xa254('0x6f')||_0x520731===_0xa254('0x70')||_0x520731===_0xa254('0x71')||_0x520731===_0xa254('0x72')||_0x520731===_0xa254('0x73')||_0x520731==='xmd-cdrtype'||_0x520731===_0xa254('0x74')||_0x520731===_0xa254('0x75')||_0x520731===_0xa254('0x76')||_0x520731===_0xa254('0x77')||_0x520731===_0xa254('0x78')||_0x520731===_0xa254('0x79')||_0x520731==='rtpaudioqosjitterbridged'||_0x520731===_0xa254('0x7a')||_0x520731==='rtpaudioqoslossbridged'||_0x520731===_0xa254('0x7b')||_0x520731==='rtpaudioqosrttbridged'||_0x520731==='rtpaudioqos'||_0x520731===_0xa254('0x78')||_0x520731===_0xa254('0x79')||_0x520731===_0xa254('0x7c')||_0x520731===_0xa254('0x7a')||_0x520731===_0xa254('0x7d')||_0x520731===_0xa254('0x7b')||_0x520731==='rtpaudioqosrttbridged'||_0x520731===_0xa254('0x7e')||_0x520731===_0xa254('0x7f')||_0x520731===_0xa254('0x2d')||_0x520731===_0xa254('0x2e')){return![];}return!![];};exports[_0xa254('0x80')]=function(_0x1242ad,_0x56b3de){var _0x390166,_0x4242d3,_0x278a63;if(_0x56b3de<=0x0){_0x56b3de=0x1;}_0x390166=new RegExp('\x5cw{0,'+_0x56b3de+'}$');_0x4242d3=Math['pow'](0xa,_0x56b3de-0x1);_0x278a63=Math[_0xa254('0x81')](0xa,_0x56b3de)-0x1;return util[_0xa254('0xf')]('%s',_['replace'](_0x1242ad,_0x390166,_['random'](_0x4242d3,_0x278a63)));};exports[_0xa254('0x82')]=function(_0x9c7eec){var _0xb5fcc3=_0x9c7eec[_0xa254('0x83')](/"(.*?)"/);return _0xb5fcc3?_0xb5fcc3[0x1]:_0x9c7eec;};exports[_0xa254('0x84')]=function(_0x2c08fd){var _0x2e7925=_0x2c08fd[_0xa254('0x83')](/<(.*?)>/);return _0x2e7925?_0x2e7925[0x1]:_0x2c08fd;};function buildNoAnswerEventPayload(_0x18e298,_0x2349c2){var _0x3d14b2=buildObj(_0x18e298,_0xa254('0x85'));if(!_[_0xa254('0xe')](_0x2349c2[_0xa254('0x86')])){Object[_0xa254('0x87')](_0x2349c2[_0xa254('0x86')])[_0xa254('0x88')](function(_0x13ca63){_0x3d14b2[_0x13ca63[_0xa254('0x89')]()]=_0x2349c2[_0xa254('0x86')][_0x13ca63];});}return _0x3d14b2;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index ff57429..15e495f 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 _0x59b4=['queueremove','queuepause','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x255caf,_0x2f893b){var _0x25e862=function(_0xffbed9){while(--_0xffbed9){_0x255caf['push'](_0x255caf['shift']());}};_0x25e862(++_0x2f893b);}(_0x59b4,0x149));var _0x459b=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x59b4[_0x3ab51d];return _0x29a04e;};'use strict';exports[_0x459b('0x0')]={'queue':{'type':_0x459b('0x1'),'required':!![]},'interface':{'type':_0x459b('0x1'),'required':!![]},'membername':{'type':_0x459b('0x1'),'required':!![]},'penalty':{'type':_0x459b('0x2'),'required':![]},'paused':{'type':_0x459b('0x3'),'required':![]}};exports[_0x459b('0x4')]={'queue':{'type':_0x459b('0x1'),'required':!![]},'interface':{'type':_0x459b('0x1'),'required':!![]}};exports[_0x459b('0x5')]={'interface':{'type':_0x459b('0x1'),'required':!![]},'paused':{'type':_0x459b('0x3')},'reason':{'type':_0x459b('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x459b('0x1'),'required':![]}};exports[_0x459b('0x6')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x459b('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x459b('0x1')}};exports[_0x459b('0x7')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]}};exports[_0x459b('0x8')]={'uniqueid':{'type':_0x459b('0x1'),'required':!![]},'exten':{'type':_0x459b('0x1'),'required':!![]},'context':{'type':_0x459b('0x1')}}; \ No newline at end of file +var _0x3770=['string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3770,0x182));var _0x0377=function(_0x5ebe5e,_0x3b3408){_0x5ebe5e=_0x5ebe5e-0x0;var _0x29cadd=_0x3770[_0x5ebe5e];return _0x29cadd;};'use strict';exports[_0x0377('0x0')]={'queue':{'type':_0x0377('0x1'),'required':!![]},'interface':{'type':_0x0377('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x0377('0x2'),'required':![]},'paused':{'type':_0x0377('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0377('0x1'),'required':!![]},'interface':{'type':_0x0377('0x1'),'required':!![]}};exports[_0x0377('0x4')]={'interface':{'type':_0x0377('0x1'),'required':!![]},'paused':{'type':_0x0377('0x3')},'reason':{'type':_0x0377('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x0377('0x1'),'required':![]}};exports[_0x0377('0x5')]={'uniqueid':{'type':_0x0377('0x1'),'required':!![]}};exports[_0x0377('0x6')]={'uniqueid':{'type':_0x0377('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x0377('0x1')},'mixmonitorid':{'type':_0x0377('0x1')}};exports[_0x0377('0x7')]={'uniqueid':{'type':_0x0377('0x1'),'required':!![]}};exports[_0x0377('0x8')]={'uniqueid':{'type':_0x0377('0x1'),'required':!![]},'exten':{'type':_0x0377('0x1'),'required':!![]},'context':{'type':_0x0377('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b9814d9..335f4a2 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x178eea,_0x18ab57){var _0x540165=function(_0x1d8f9f){while(--_0x1d8f9f){_0x178eea['push'](_0x178eea['shift']());}};_0x540165(++_0x18ab57);}(_0xadb5,0xad));var _0x5adb=function(_0x5276a8,_0x47527e){_0x5276a8=_0x5276a8-0x0;var _0x4229e0=_0xadb5[_0x5276a8];return _0x4229e0;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x1181d8,_0x4d9548){var _0x1d20cf=function(_0x25574e){while(--_0x25574e){_0x1181d8['push'](_0x1181d8['shift']());}};_0x1d20cf(++_0x4d9548);}(_0xadb5,0xad));var _0x5adb=function(_0x22d61c,_0x4e3496){_0x22d61c=_0x22d61c-0x0;var _0x4b0bda=_0xadb5[_0x22d61c];return _0x4b0bda;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 9435796..10ce45d 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 _0x757b=['hasOwnProperty','assign'];(function(_0x714d36,_0x187e6c){var _0x2c405f=function(_0x3b2d6a){while(--_0x3b2d6a){_0x714d36['push'](_0x714d36['shift']());}};_0x2c405f(++_0x187e6c);}(_0x757b,0x10b));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0xc0155,_0xc643be){var _0x1cc803=Object[_0xb757('0x0')]({},_0xc0155);for(var _0x4c7615 in _0xc643be){if(_0x1cc803[_0xb757('0x1')](_0x4c7615)){_0x1cc803[_0x4c7615]=_0xc643be[_0x4c7615];}}return _0x1cc803;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x8363=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x32753a,_0x313eff){var _0x5cc638=function(_0x87e14c){while(--_0x87e14c){_0x32753a['push'](_0x32753a['shift']());}};_0x5cc638(++_0x313eff);}(_0x8363,0xd8));var _0x3836=function(_0xd4d2c1,_0x4e0b73){_0xd4d2c1=_0xd4d2c1-0x0;var _0x371e96=_0x8363[_0xd4d2c1];return _0x371e96;};'use strict';function mergeDBDataToRealtime(_0x58119a,_0x26847f){var _0x2e4c95=Object[_0x3836('0x0')]({},_0x58119a);for(var _0x302ff0 in _0x26847f){if(_0x2e4c95[_0x3836('0x1')](_0x302ff0)){_0x2e4c95[_0x302ff0]=_0x26847f[_0x302ff0];}}return _0x2e4c95;}exports[_0x3836('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d823fec..4ece76d 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 _0x291e=['./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','accountcode','name','isNil','find','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','destination','exten','type','dialer','queue','context','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','create','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport'];(function(_0x3f430a,_0x2ff03b){var _0x102ddc=function(_0x492d72){while(--_0x492d72){_0x3f430a['push'](_0x3f430a['shift']());}};_0x102ddc(++_0x2ff03b);}(_0x291e,0x10c));var _0xe291=function(_0x21d12c,_0xf9e371){_0x21d12c=_0x21d12c-0x0;var _0x5a2ba5=_0x291e[_0x21d12c];return _0x5a2ba5;};'use strict';var _=require(_0xe291('0x0'));var moment=require(_0xe291('0x1'));var util=require(_0xe291('0x2'));var config=require(_0xe291('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xe291('0x4'));var RpcVoiceCallReport=require(_0xe291('0x5'));var RpcVoiceDialReport=require(_0xe291('0x6'));var RpcMemberReport=require(_0xe291('0x7'));var RpcVoiceQueueReport=require(_0xe291('0x8'));var RpcVoiceRecording=require(_0xe291('0x9'));var RpcVoiceTransferReport=require(_0xe291('0xa'));var VoiceQueueReport=require(_0xe291('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xe291('0xc'));var VoiceDialReport=require(_0xe291('0xd'));var UserReport=require('./userReport');function Report(_0x407d37){this[_0xe291('0xe')]=_0x407d37;this[_0xe291('0xf')]=_0x407d37[_0xe291('0xf')];this[_0xe291('0x10')]=_0x407d37['telephones'];}Report[_0xe291('0x11')][_0xe291('0x12')]=function(_0x1edc9d){var _0x442f49=new VoiceQueueReport(this['realtime']);var _0x2d8a63=new VoiceAgentReport(this[_0xe291('0xe')]);var _0x5880dd=new VoiceDialReport(this['realtime']);var _0x1f1c1f=new VoiceCallReport(this['realtime']);var _0x1866df=new UserReport(this[_0xe291('0xe')]);if(config[_0xe291('0x13')]&&config[_0xe291('0x13')][_0xe291('0x14')]){ami['on'](_0xe291('0x15'),this[_0xe291('0x16')][_0xe291('0x17')](this));ami['on'](_0xe291('0x18'),this['voiceCallReport']['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xe291('0x19')]['bind'](this));ami['on'](_0xe291('0x1a'),this[_0xe291('0x1b')]['bind'](this));ami['on'](_0xe291('0x1c'),this[_0xe291('0x1d')][_0xe291('0x17')](this));ami['on'](_0xe291('0x1e'),this[_0xe291('0x1f')][_0xe291('0x17')](this));}};Report[_0xe291('0x11')]['findAgent']=function(_0x4ecbd2){var _0x4ede8c;_0x4ede8c=_['find'](this[_0xe291('0xf')],function(_0x46b442){return _0x46b442[_0xe291('0x20')]==_0x4ecbd2||_0x46b442[_0xe291('0x21')]==_0x4ecbd2;});if(_[_0xe291('0x22')](_0x4ede8c)){var _0x84b8f2=_['find'](this[_0xe291('0x10')],function(_0x318e13){return _0x318e13[_0xe291('0x20')]==_0x4ecbd2||_0x318e13[_0xe291('0x21')]==_0x4ecbd2;});if(_0x84b8f2){_0x4ede8c=_[_0xe291('0x23')](this[_0xe291('0xf')],function(_0x491815){return _0x491815[_0xe291('0x24')]==util[_0xe291('0x25')]('SIP/%s',_0x84b8f2[_0xe291('0x21')]);});}}return _0x4ede8c;};Report[_0xe291('0x11')]['voiceQueueReport']=function(_0x37d57e){for(var _0x5356f9=0x0;_0x5356f9<_0x37d57e[_0xe291('0x26')];_0x5356f9+=0x1){var _0x461d87=this[_0xe291('0x27')](_0x37d57e[_0x5356f9][_0xe291('0x28')]);if(_0x461d87){_0x37d57e[_0x5356f9][_0xe291('0x20')]=_0x461d87['accountcode'];_0x37d57e[_0x5356f9][_0xe291('0x29')]=!![];_0x37d57e[_0x5356f9][_0xe291('0x2a')]=_0x461d87[_0xe291('0x21')];_0x37d57e[_0x5356f9]['interface']=_[_0xe291('0x22')](_0x461d87['interface'])?util[_0xe291('0x25')](_0xe291('0x2b'),_0x461d87['name']):_0x461d87[_0xe291('0x24')];if(_0x37d57e[_0x5356f9][_0xe291('0x2c')]){_0x37d57e[_0x5356f9][_0xe291('0x2d')]=moment()[_0xe291('0x25')](_0xe291('0x2e'));}if(_0x37d57e[_0x5356f9][_0xe291('0x2f')]){_0x37d57e[_0x5356f9][_0xe291('0x30')]=moment()[_0xe291('0x25')](_0xe291('0x2e'));}RpcMemberReport[_0xe291('0x16')](_0x37d57e[_0x5356f9]);}RpcVoiceQueueReport['create'](_0x37d57e[_0x5356f9]);}};function extractCalleridNumber(_0x2083ee){var _0x15c64f=_0x2083ee[_0xe291('0x31')](/<(.*?)>/);return _0x15c64f?_0x15c64f[0x1]:_0x2083ee;}Report['prototype'][_0xe291('0x32')]=function(_0xccf4e9){for(var _0x298590=0x0;_0x298590','calleridname','transfers','linkedid','isNil','getCallType','UserId','split','create','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','voiceDialReport','channel','startsWith','Local','substring','indexOf','mobile','membername','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer'];(function(_0x3f37c8,_0x2de1ad){var _0x1c3bc2=function(_0x45caf0){while(--_0x45caf0){_0x3f37c8['push'](_0x3f37c8['shift']());}};_0x1c3bc2(++_0x2de1ad);}(_0x44a5,0x9d));var _0x544a=function(_0x49392e,_0x441b28){_0x49392e=_0x49392e-0x0;var _0xe978bb=_0x44a5[_0x49392e];return _0xe978bb;};'use strict';var _=require(_0x544a('0x0'));var moment=require(_0x544a('0x1'));var util=require(_0x544a('0x2'));var config=require(_0x544a('0x3'));var ami=require(_0x544a('0x4'));var RpcVoiceAgentReport=require(_0x544a('0x5'));var RpcVoiceCallReport=require(_0x544a('0x6'));var RpcVoiceDialReport=require(_0x544a('0x7'));var RpcMemberReport=require(_0x544a('0x8'));var RpcVoiceQueueReport=require(_0x544a('0x9'));var RpcVoiceRecording=require(_0x544a('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x544a('0xb'));var VoiceCallReport=require(_0x544a('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x544a('0xd'));function Report(_0x218579){this['realtime']=_0x218579;this['agents']=_0x218579[_0x544a('0xe')];this[_0x544a('0xf')]=_0x218579['telephones'];}Report[_0x544a('0x10')]['sync']=function(_0x3ef33d){var _0x7add2c=new VoiceQueueReport(this[_0x544a('0x11')]);var _0x3cfd50=new VoiceAgentReport(this[_0x544a('0x11')]);var _0xd3baf2=new VoiceDialReport(this[_0x544a('0x11')]);var _0x5bc9c8=new VoiceCallReport(this[_0x544a('0x11')]);var _0x5b6b10=new UserReport(this[_0x544a('0x11')]);if(config['xdr']&&config[_0x544a('0x12')][_0x544a('0x13')]){ami['on'](_0x544a('0x14'),this[_0x544a('0x15')][_0x544a('0x16')](this));ami['on'](_0x544a('0x17'),this[_0x544a('0x18')][_0x544a('0x16')](this));ami['on'](_0x544a('0x19'),this['voiceAgentReport'][_0x544a('0x16')](this));ami['on'](_0x544a('0x1a'),this['voiceDialReport'][_0x544a('0x16')](this));ami['on'](_0x544a('0x1b'),this[_0x544a('0x1c')]['bind'](this));ami['on'](_0x544a('0x1d'),this[_0x544a('0x1e')][_0x544a('0x16')](this));}};Report[_0x544a('0x10')]['findAgent']=function(_0x508572){var _0x511a45;_0x511a45=_[_0x544a('0x1f')](this[_0x544a('0xe')],function(_0x3816c3){return _0x3816c3['accountcode']==_0x508572||_0x3816c3[_0x544a('0x20')]==_0x508572;});if(_['isNil'](_0x511a45)){var _0xf9ad43=_[_0x544a('0x1f')](this[_0x544a('0xf')],function(_0x4786df){return _0x4786df[_0x544a('0x21')]==_0x508572||_0x4786df['name']==_0x508572;});if(_0xf9ad43){_0x511a45=_[_0x544a('0x1f')](this['agents'],function(_0xff62bf){return _0xff62bf[_0x544a('0x22')]==util[_0x544a('0x23')](_0x544a('0x24'),_0xf9ad43[_0x544a('0x20')]);});}}return _0x511a45;};Report['prototype'][_0x544a('0x15')]=function(_0x8765f3){for(var _0x28d308=0x0;_0x28d308<_0x8765f3[_0x544a('0x25')];_0x28d308+=0x1){var _0x189ddb=this[_0x544a('0x26')](_0x8765f3[_0x28d308][_0x544a('0x27')]);if(_0x189ddb){_0x8765f3[_0x28d308][_0x544a('0x21')]=_0x189ddb[_0x544a('0x21')];_0x8765f3[_0x28d308][_0x544a('0x28')]=!![];_0x8765f3[_0x28d308][_0x544a('0x29')]=_0x189ddb[_0x544a('0x20')];_0x8765f3[_0x28d308][_0x544a('0x22')]=_['isNil'](_0x189ddb[_0x544a('0x22')])?util[_0x544a('0x23')](_0x544a('0x24'),_0x189ddb[_0x544a('0x20')]):_0x189ddb[_0x544a('0x22')];if(_0x8765f3[_0x28d308][_0x544a('0x2a')]){_0x8765f3[_0x28d308][_0x544a('0x2b')]=moment()['format'](_0x544a('0x2c'));}if(_0x8765f3[_0x28d308]['queuecallerexit']){_0x8765f3[_0x28d308][_0x544a('0x2d')]=moment()[_0x544a('0x23')](_0x544a('0x2c'));}RpcMemberReport['voiceQueueReport'](_0x8765f3[_0x28d308]);}RpcVoiceQueueReport['create'](_0x8765f3[_0x28d308]);}};function extractCalleridNumber(_0x2dda4c){var _0xc90b90=_0x2dda4c[_0x544a('0x2e')](/<(.*?)>/);return _0xc90b90?_0xc90b90[0x1]:_0x2dda4c;}Report[_0x544a('0x10')]['getAgentByInternal']=function(_0x21d9d7){for(var _0x2290e5=0x0;_0x2290e50x0?!![]:![];if(!_0xb7c658){return this[_0x7b2a('0x19')](this['summary'][_0x7b2a('0x65')]);}};VoiceQueueReport['prototype'][_0x7b2a('0x1b')]=function(_0x3f9f85){var _0x46cd85=this[_0x7b2a('0x14')]['id'];if(this[_0x7b2a('0x14')]['queuestatus'][_0x46cd85]&&this[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x46cd85][_0x3f9f85[_0x7b2a('0x5a')]]){this[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x46cd85][_0x3f9f85[_0x7b2a('0x5a')]][_0x7b2a('0xf')]['push'](_0x3f9f85);}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x16')]=function(_0x4075e8){var _0x315518=this;try{if(this['isNotNull'](_0x4075e8)&&this[_0x7b2a('0x66')](_0x4075e8[_0x7b2a('0x4d')])){logger['debug'](_0x7b2a('0x67'),util[_0x7b2a('0x3c')](_0x4075e8,{'showHidden':![],'depth':null}));var _0x62cdcf=this[_0x7b2a('0x12')][_0x4075e8[_0x7b2a('0x4d')]];if(_0x62cdcf){logger[_0x7b2a('0x48')](_0x7b2a('0x68'),_0x62cdcf[_0x7b2a('0x57')]);this[_0x7b2a('0x14')]['queues'][_0x62cdcf[_0x7b2a('0x57')]]={'summaryEvent':_0x4075e8};this[_0x7b2a('0x14')]['statusRequests']+=0x1;return ami[_0x7b2a('0x37')]({'action':_0x7b2a('0x5c'),'queue':_0x62cdcf[_0x7b2a('0x57')]})[_0x7b2a('0x69')](function(_0x38cf88){if(!_0x315518['summary'][_0x7b2a('0x5c')][_0x4075e8[_0x7b2a('0x5a')]]){_0x315518[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x4075e8[_0x7b2a('0x5a')]]={};}_0x315518[_0x7b2a('0x14')][_0x7b2a('0x5c')][_0x4075e8['actionid']][_0x38cf88[_0x7b2a('0x5a')]]={'queue':_0x62cdcf['name'],'agents':[]};})['catch'](function(_0x2895e3){throw _0x2895e3;});}}}catch(_0x2eda9e){logger[_0x7b2a('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x2eda9e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7b2a('0x19')]=function(_0x5708ef){if(this[_0x7b2a('0x14')][_0x7b2a('0x64')]>0x0){this[_0x7b2a('0x14')][_0x7b2a('0x65')]=_0x5708ef;return;}logger[_0x7b2a('0x48')](_0x7b2a('0x6a'),util[_0x7b2a('0x3c')](_0x5708ef,{'showHidden':![],'depth':null}));this[_0x7b2a('0x14')]=initializeSummary();ami[_0x7b2a('0x47')](_0x7b2a('0x6b'),{});};VoiceQueueReport[_0x7b2a('0x41')]['syncQueueCallerJoin']=function(_0x4b9eaf){try{if(this['isNotNull'](_0x4b9eaf)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x4b9eaf[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x4b9eaf,{'showHidden':![],'depth':null}));if(_[_0x7b2a('0x6c')](this['queueReports'][_0x4b9eaf[_0x7b2a('0x50')]])){this['queueReports'][_0x4b9eaf[_0x7b2a('0x50')]]=[];}if(_[_0x7b2a('0x6c')](this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]])){this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]]={};}var _0x12ad3b=new QueueReport();_0x12ad3b['queue']=_0x4b9eaf[_0x7b2a('0x4d')];_0x12ad3b['type']=this['voiceQueues'][_0x12ad3b['queue']]&&this[_0x7b2a('0x12')][_0x12ad3b[_0x7b2a('0x4d')]][_0x7b2a('0x54')]?this['voiceQueues'][_0x12ad3b[_0x7b2a('0x4d')]]['type']||_0x7b2a('0x55'):_0x7b2a('0x55');_0x12ad3b[_0x7b2a('0x6d')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x12ad3b[_0x7b2a('0x6f')]=_0x4b9eaf[_0x7b2a('0x6f')];_0x12ad3b[_0x7b2a('0x70')]=_0x4b9eaf[_0x7b2a('0x70')];_0x12ad3b[_0x7b2a('0x50')]=_0x4b9eaf[_0x7b2a('0x50')];_0x12ad3b['routealias']=this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]][_0x7b2a('0x71')];logger[_0x7b2a('0x72')](_0x7b2a('0x73'),_0x12ad3b[_0x7b2a('0x4d')],_0x12ad3b[_0x7b2a('0x54')]);Object[_0x7b2a('0x60')](_0x12ad3b,_[_0x7b2a('0x74')](_0x4b9eaf,_['keys'](_0x12ad3b)));this[_0x7b2a('0xd')][_0x4b9eaf['uniqueid']][_0x7b2a('0x75')](_0x12ad3b);this[_0x7b2a('0x10')][_0x4b9eaf[_0x7b2a('0x50')]]=_0x12ad3b;this['emitVoiceQueueChannelSave'](_0x12ad3b,_0x7b2a('0x1e'));}}catch(_0x26dc26){logger['error'](_0x7b2a('0x76'),_0x4b9eaf[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x26dc26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')]['syncQueueCallerAbandon']=function(_0x7364f7){try{if(this['isNotNull'](_0x7364f7)){logger[_0x7b2a('0x48')](_0x7b2a('0x77'),_0x7364f7[_0x7b2a('0x50')],util['inspect'](_0x7364f7,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x7364f7['uniqueid']]){var _0x256395=_[_0x7b2a('0x78')](this['queueReports'][_0x7364f7['uniqueid']]);_0x256395['queuecallercomplete']=![];_0x256395[_0x7b2a('0x79')]=null;_0x256395[_0x7b2a('0x7a')]=_0x7364f7['holdtime'];_0x256395[_0x7b2a('0x7b')]=_0x7364f7[_0x7b2a('0x7b')];_0x256395[_0x7b2a('0x35')]=!![];_0x256395[_0x7b2a('0x7c')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x256395['queuecallerexitreason']=_0x7b2a('0x7d');_0x256395['lastAssignedTo']=null;logger[_0x7b2a('0x72')](_0x7b2a('0x7e'),_0x256395[_0x7b2a('0x4d')],_0x256395['type']);this[_0x7b2a('0x10')][_0x7364f7[_0x7b2a('0x50')]]=_0x256395;this[_0x7b2a('0x45')](_0x256395,_0x7b2a('0x35'));}}}catch(_0x1c8592){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x7364f7[_0x7b2a('0x50')],util['inspect'](_0x1c8592,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x20')]=function(_0x4a6a7c){try{if(this['isNotNull'](_0x4a6a7c)){logger[_0x7b2a('0x48')](_0x7b2a('0x7f'),_0x4a6a7c['uniqueid'],util['inspect'](_0x4a6a7c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a6a7c[_0x7b2a('0x50')]]){var _0x1c5af6=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x4a6a7c[_0x7b2a('0x50')]]);_0x1c5af6[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1c5af6[_0x7b2a('0x81')]=_0x4a6a7c[_0x7b2a('0x81')];_0x1c5af6[_0x7b2a('0x82')]=_0x4a6a7c['connectedlinename'];logger[_0x7b2a('0x72')](_0x7b2a('0x83'),_0x1c5af6[_0x7b2a('0x4d')],_0x1c5af6[_0x7b2a('0x54')],_0x4a6a7c['connectedlinenum'],_0x4a6a7c[_0x7b2a('0x82')]);this['channels'][_0x4a6a7c[_0x7b2a('0x50')]]=_0x1c5af6;this[_0x7b2a('0x84')](_0x1c5af6,'queuecallerleave');}}}catch(_0x20d84b){logger[_0x7b2a('0x3d')](_0x7b2a('0x7f'),_0x4a6a7c[_0x7b2a('0x50')],util['inspect'](_0x20d84b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0x23')]=function(_0x11ac9a){try{if(this['isNotNull'](_0x11ac9a)){logger[_0x7b2a('0x48')](_0x7b2a('0x85'),_0x11ac9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x11ac9a,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x11ac9a[_0x7b2a('0x50')]]){var _0x7aa282=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x11ac9a[_0x7b2a('0x50')]]);_0x7aa282[_0x7b2a('0x86')]=!![];_0x7aa282[_0x7b2a('0x87')]=_0x7b2a('0x88');logger[_0x7b2a('0x72')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x7aa282[_0x7b2a('0x4d')],_0x7aa282[_0x7b2a('0x54')]);}}}catch(_0x33b925){logger[_0x7b2a('0x3d')](_0x7b2a('0x85'),_0x11ac9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x33b925,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7b2a('0x89')]=function(_0x395a9a){try{if(this['isNotNull'](_0x395a9a)){logger['debug'](_0x7b2a('0x8a'),_0x395a9a[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x395a9a,{'showHidden':![],'depth':null}));if(this[_0x7b2a('0xd')][_0x395a9a['uniqueid']]){var _0x19310d=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x395a9a['uniqueid']]);_0x19310d['queuecallerabandon']=![];_0x19310d[_0x7b2a('0x7c')]=null;_0x19310d[_0x7b2a('0x8b')]=!![];_0x19310d[_0x7b2a('0x8c')]=_0x395a9a[_0x7b2a('0x8d')];_0x19310d[_0x7b2a('0x7a')]=_0x395a9a[_0x7b2a('0x7a')];_0x19310d[_0x7b2a('0x86')]=!![];_0x19310d['queuecallerexit']=![];_0x19310d[_0x7b2a('0x8e')]=null;if(!_0x19310d['transfer']){if(_0x395a9a[_0x7b2a('0x8f')]=='transfer'){_0x19310d['queuecallerexitreason']=_0x7b2a('0x90');logger['info'](_0x7b2a('0x91'),_0x19310d[_0x7b2a('0x4d')],_0x19310d[_0x7b2a('0x54')]);}else{if(_[_0x7b2a('0x92')](_0x395a9a[_0x7b2a('0x38')]['toLowerCase'](),_0x7b2a('0x93'))){if(this[_0x7b2a('0xd')][_0x395a9a[_0x7b2a('0x94')]]){var _0x23c961=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x395a9a['linkedid']]);_0x23c961[_0x7b2a('0x86')]=![];_0x23c961['queuecallerexit']=!![];_0x23c961[_0x7b2a('0x8e')]=moment(_0x19310d[_0x7b2a('0x6d')])[_0x7b2a('0x95')](_0x395a9a[_0x7b2a('0x7a')],_0x7b2a('0x96'))[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x23c961[_0x7b2a('0x87')]=_0x7b2a('0x97');_0x23c961[_0x7b2a('0x98')]=!![];_0x23c961[_0x7b2a('0x99')]=_0x7b2a('0x9a');_0x23c961[_0x7b2a('0x9b')]=_0x395a9a[_0x7b2a('0x9c')];_0x23c961['transferuniqueid']=_0x395a9a[_0x7b2a('0x50')];logger[_0x7b2a('0x72')](_0x7b2a('0x9d'),_0x23c961[_0x7b2a('0x4d')],_0x23c961[_0x7b2a('0x54')]);var _0x28335b=this[_0x7b2a('0xd')][_0x395a9a[_0x7b2a('0x94')]];this['queueReports'][_0x395a9a[_0x7b2a('0x94')]]=this['queueReports'][_0x395a9a['uniqueid']];this['queueReports'][_0x395a9a[_0x7b2a('0x50')]]=_0x28335b;}}else{_0x19310d[_0x7b2a('0x87')]=_0x7b2a('0x9e')+_0x395a9a[_0x7b2a('0x8f')]['toUpperCase']();logger[_0x7b2a('0x72')](_0x7b2a('0x9f'),_0x19310d[_0x7b2a('0x4d')],_0x19310d[_0x7b2a('0x54')],_0x19310d[_0x7b2a('0x87')]);}}}this['channels'][_0x395a9a[_0x7b2a('0x50')]]=_0x19310d;}}}catch(_0x12284f){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x395a9a['uniqueid'],util[_0x7b2a('0x3c')](_0x12284f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xa0')]=function(_0x2e738b){try{if(this['isNotNull'](_0x2e738b)){logger[_0x7b2a('0x48')](_0x7b2a('0xa1'),_0x2e738b[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x2e738b,{'showHidden':![],'depth':null}));this['addVariable'](_0x2e738b[_0x7b2a('0x50')],_[_0x7b2a('0xa2')](_0x2e738b[_0x7b2a('0xa3')])[0x0],_0x2e738b[_0x7b2a('0xa4')]);if(this['queueReports'][_0x2e738b['uniqueid']]){var _0x1f779a=_[_0x7b2a('0x78')](this[_0x7b2a('0xd')][_0x2e738b[_0x7b2a('0x50')]]);if(_0x1f779a){if(this[_0x7b2a('0x66')](_0x2e738b['variable'])&&this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')]['queuestatus'])){switch(_0x2e738b[_0x7b2a('0xa4')]){case _0x7b2a('0xa5'):_0x1f779a[_0x7b2a('0x34')]=![];_0x1f779a[_0x7b2a('0x8e')]=null;break;case _0x7b2a('0xa6'):_0x1f779a[_0x7b2a('0xa7')]='timeout';_0x1f779a[_0x7b2a('0x34')]=!![];_0x1f779a['queuecallerexitAt']=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x80')]=moment()['format'](_0x7b2a('0x6e'));logger[_0x7b2a('0x48')](_0x7b2a('0xa8'),_0x2e738b['uniqueid'],util[_0x7b2a('0x3c')](_0x1f779a,{'showHidden':![],'depth':null}));ami[_0x7b2a('0x47')](_0x7b2a('0xa9'),_0x1f779a);break;default:_0x1f779a['queuecallerexit']=!![];_0x1f779a['queuecallerexitAt']=moment()[_0x7b2a('0x4b')](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1f779a[_0x7b2a('0x35')]=![];_0x1f779a[_0x7b2a('0x7c')]=null;_0x1f779a[_0x7b2a('0x87')]=_0x2e738b[_0x7b2a('0xa4')];this[_0x7b2a('0x10')][_0x2e738b[_0x7b2a('0x50')]]=_0x1f779a;this[_0x7b2a('0x45')](_0x1f779a,_0x7b2a('0xaa'));}else if(this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')])&&this[_0x7b2a('0x66')](_0x2e738b[_0x7b2a('0xa3')][_0x7b2a('0xab')])){if(!_0x1f779a[_0x7b2a('0x35')]){_0x1f779a[_0x7b2a('0x34')]=!![];_0x1f779a['queuecallerexitAt']=moment()['format'](_0x7b2a('0x6e'));_0x1f779a[_0x7b2a('0x87')]=_0x7b2a('0xac');_0x1f779a[_0x7b2a('0x80')]=moment()[_0x7b2a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7b2a('0x10')][_0x2e738b[_0x7b2a('0x50')]]=_0x1f779a;}}logger['info'](_0x7b2a('0xad'),_0x2e738b[_0x7b2a('0x50')],_0x1f779a['queue'],_0x1f779a['type'],_[_0x7b2a('0xa2')](_0x2e738b['variable'])[0x0],_0x2e738b['value']);_0x1f779a[_0x7b2a('0x3f')]=this[_0x7b2a('0x3f')][_0x2e738b[_0x7b2a('0x50')]];}}}}catch(_0x41154a){logger[_0x7b2a('0x3d')]('[%s][voiceQueueReport][varset]',_0x2e738b[_0x7b2a('0x50')],util[_0x7b2a('0x3c')](_0x41154a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xae')]=function(_0x1ff24f,_0x297164,_0x25355a){var _0x3e6408=[_0x7b2a('0xaf'),'rtpaudioqosbridged',_0x7b2a('0xb0'),_0x7b2a('0xb1'),_0x7b2a('0xb2'),'rtpaudioqoslossbridged',_0x7b2a('0xb3'),_0x7b2a('0xb4'),_0x7b2a('0xb5'),_0x7b2a('0xb6'),_0x7b2a('0xb7'),'bridgepvtcallid',_0x7b2a('0xb8'),_0x7b2a('0xb9'),_0x7b2a('0xba'),_0x7b2a('0xbb'),'membername','memberpenalty',_0x7b2a('0xbc')];if(!_[_0x7b2a('0xbd')](_0x297164)&&!_['includes'](_0x3e6408,_0x297164)){if(_[_0x7b2a('0x6c')](this['variables'][_0x1ff24f])){this[_0x7b2a('0x3f')][_0x1ff24f]={};}this[_0x7b2a('0x3f')][_0x1ff24f][_0x297164]=_0x25355a;}};VoiceQueueReport[_0x7b2a('0x41')][_0x7b2a('0xbe')]=function(_0x28dc63,_0x5cbfb2,_0x2ec81b){try{var _0x302e1c={};if(this[_0x7b2a('0xd')][_0x28dc63]){for(var _0x119a55=0x0;_0x119a550x0?!![]:![];if(!_0x1ce5ff){return this[_0x7011('0x1a')](this[_0x7011('0x15')][_0x7011('0x6c')]);}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x1d')]=function(_0x5537ec){var _0x45ce29=this['summary']['id'];if(this[_0x7011('0x15')][_0x7011('0x69')][_0x45ce29]&&this[_0x7011('0x15')][_0x7011('0x69')][_0x45ce29][_0x5537ec[_0x7011('0x62')]]){this[_0x7011('0x15')][_0x7011('0x69')][_0x45ce29][_0x5537ec['actionid']][_0x7011('0x10')][_0x7011('0x6d')](_0x5537ec);}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x18')]=function(_0x4997bc){var _0x5d287c=this;try{if(this[_0x7011('0x6e')](_0x4997bc)&&this[_0x7011('0x6e')](_0x4997bc['queue'])){logger['debug'](_0x7011('0x6f'),util[_0x7011('0x47')](_0x4997bc,{'showHidden':![],'depth':null}));var _0x1658e9=this['voiceQueues'][_0x4997bc[_0x7011('0x58')]];if(_0x1658e9){logger['debug'](_0x7011('0x70'),_0x1658e9[_0x7011('0x5d')]);this[_0x7011('0x15')][_0x7011('0x60')][_0x1658e9[_0x7011('0x5d')]]={'summaryEvent':_0x4997bc};this[_0x7011('0x15')][_0x7011('0x6b')]+=0x1;return ami[_0x7011('0x40')]({'action':_0x7011('0x69'),'queue':_0x1658e9['name']})['then'](function(_0x26da16){if(!_0x5d287c[_0x7011('0x15')][_0x7011('0x69')][_0x4997bc[_0x7011('0x62')]]){_0x5d287c[_0x7011('0x15')][_0x7011('0x69')][_0x4997bc[_0x7011('0x62')]]={};}_0x5d287c[_0x7011('0x15')][_0x7011('0x69')][_0x4997bc[_0x7011('0x62')]][_0x26da16[_0x7011('0x62')]]={'queue':_0x1658e9[_0x7011('0x5d')],'agents':[]};})[_0x7011('0x42')](function(_0x45a826){throw _0x45a826;});}}}catch(_0xa2699e){logger[_0x7011('0x45')]('[voiceQueueReport][queuesummary]',util[_0x7011('0x47')](_0xa2699e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x1a')]=function(_0x3be0ac){if(this[_0x7011('0x15')][_0x7011('0x6b')]>0x0){this['summary'][_0x7011('0x6c')]=_0x3be0ac;return;}logger[_0x7011('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x3be0ac,{'showHidden':![],'depth':null}));this[_0x7011('0x15')]=initializeSummary();ami[_0x7011('0x4c')](_0x7011('0x71'),{});};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x72')]=function(_0x18feae){try{if(this[_0x7011('0x6e')](_0x18feae)){logger[_0x7011('0x4e')](_0x7011('0x73'),_0x18feae[_0x7011('0x56')],util['inspect'](_0x18feae,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x7011('0xe')][_0x18feae[_0x7011('0x56')]])){this['queueReports'][_0x18feae[_0x7011('0x56')]]=[];}if(_[_0x7011('0x74')](this[_0x7011('0x11')][_0x18feae[_0x7011('0x56')]])){this[_0x7011('0x11')][_0x18feae[_0x7011('0x56')]]={};}var _0x3f8afe=new QueueReport();_0x3f8afe[_0x7011('0x58')]=_0x18feae['queue'];_0x3f8afe[_0x7011('0x5c')]=this['voiceQueues'][_0x3f8afe[_0x7011('0x58')]]&&this[_0x7011('0x13')][_0x3f8afe['queue']]['type']?this[_0x7011('0x13')][_0x3f8afe['queue']]['type']||_0x7011('0x75'):_0x7011('0x75');_0x3f8afe['queuecallerjoinAt']=moment()[_0x7011('0x50')](_0x7011('0x76'));_0x3f8afe[_0x7011('0x77')]=_0x18feae[_0x7011('0x77')];_0x3f8afe[_0x7011('0x78')]=_0x18feae[_0x7011('0x78')];_0x3f8afe[_0x7011('0x56')]=_0x18feae[_0x7011('0x56')];_0x3f8afe[_0x7011('0x79')]=this[_0x7011('0x11')][_0x18feae['uniqueid']][_0x7011('0x79')];logger['info'](_0x7011('0x7a'),_0x3f8afe['queue'],_0x3f8afe[_0x7011('0x5c')]);Object[_0x7011('0x7b')](_0x3f8afe,_[_0x7011('0x7c')](_0x18feae,_[_0x7011('0x7d')](_0x3f8afe)));this[_0x7011('0xe')][_0x18feae['uniqueid']][_0x7011('0x6d')](_0x3f8afe);this[_0x7011('0x11')][_0x18feae[_0x7011('0x56')]]=_0x3f8afe;this['emitVoiceQueueChannelSave'](_0x3f8afe,_0x7011('0x20'));}}catch(_0x141058){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x18feae[_0x7011('0x56')],util[_0x7011('0x47')](_0x141058,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x22')]=function(_0x23de8b){try{if(this[_0x7011('0x6e')](_0x23de8b)){logger[_0x7011('0x4e')](_0x7011('0x7e'),_0x23de8b[_0x7011('0x56')],util[_0x7011('0x47')](_0x23de8b,{'showHidden':![],'depth':null}));if(this[_0x7011('0xe')][_0x23de8b[_0x7011('0x56')]]){var _0x49dc2b=_[_0x7011('0x7f')](this[_0x7011('0xe')][_0x23de8b[_0x7011('0x56')]]);_0x49dc2b[_0x7011('0x3c')]=![];_0x49dc2b[_0x7011('0x80')]=null;_0x49dc2b[_0x7011('0x81')]=_0x23de8b['holdtime'];_0x49dc2b[_0x7011('0x82')]=_0x23de8b[_0x7011('0x82')];_0x49dc2b[_0x7011('0x21')]=!![];_0x49dc2b['queuecallerabandonAt']=moment()[_0x7011('0x50')](_0x7011('0x76'));_0x49dc2b[_0x7011('0x83')]=_0x7011('0x84');_0x49dc2b[_0x7011('0x85')]=null;logger[_0x7011('0x86')](_0x7011('0x87'),_0x49dc2b['queue'],_0x49dc2b['type']);this[_0x7011('0x11')][_0x23de8b[_0x7011('0x56')]]=_0x49dc2b;this[_0x7011('0x53')](_0x49dc2b,_0x7011('0x21'));}}}catch(_0x3b070f){logger[_0x7011('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x23de8b[_0x7011('0x56')],util[_0x7011('0x47')](_0x3b070f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')]['syncQueueCallerLeave']=function(_0x26d9c5){try{if(this[_0x7011('0x6e')](_0x26d9c5)){logger[_0x7011('0x4e')](_0x7011('0x88'),_0x26d9c5[_0x7011('0x56')],util[_0x7011('0x47')](_0x26d9c5,{'showHidden':![],'depth':null}));if(this[_0x7011('0xe')][_0x26d9c5[_0x7011('0x56')]]){var _0x5e6864=_[_0x7011('0x7f')](this[_0x7011('0xe')][_0x26d9c5['uniqueid']]);_0x5e6864['queuecallerleaveAt']=moment()[_0x7011('0x50')](_0x7011('0x76'));_0x5e6864['connectedlinenum']=_0x26d9c5[_0x7011('0x89')];_0x5e6864[_0x7011('0x8a')]=_0x26d9c5[_0x7011('0x8a')];logger[_0x7011('0x86')](_0x7011('0x8b'),_0x5e6864[_0x7011('0x58')],_0x5e6864[_0x7011('0x5c')],_0x26d9c5[_0x7011('0x89')],_0x26d9c5[_0x7011('0x8a')]);this[_0x7011('0x11')][_0x26d9c5['uniqueid']]=_0x5e6864;this[_0x7011('0x4d')](_0x5e6864,_0x7011('0x23'));}}}catch(_0x324ce1){logger[_0x7011('0x45')](_0x7011('0x88'),_0x26d9c5[_0x7011('0x56')],util[_0x7011('0x47')](_0x324ce1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x28')]=function(_0x1477ac){try{if(this['isNotNull'](_0x1477ac)){logger[_0x7011('0x4e')]('[%s][voiceQueueReport][agentconnect]',_0x1477ac[_0x7011('0x56')],util['inspect'](_0x1477ac,{'showHidden':![],'depth':null}));if(this[_0x7011('0xe')][_0x1477ac['uniqueid']]){var _0x2f5250=_['last'](this['queueReports'][_0x1477ac[_0x7011('0x56')]]);_0x2f5250[_0x7011('0x3c')]=!![];_0x2f5250[_0x7011('0x83')]='COMPLETEDBYAGENT';logger[_0x7011('0x86')](_0x7011('0x8c'),_0x2f5250[_0x7011('0x58')],_0x2f5250[_0x7011('0x5c')]);}}}catch(_0x4db26d){logger[_0x7011('0x45')](_0x7011('0x8d'),_0x1477ac[_0x7011('0x56')],util[_0x7011('0x47')](_0x4db26d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x26')]=function(_0x18c63c){try{if(this[_0x7011('0x6e')](_0x18c63c)){logger[_0x7011('0x4e')](_0x7011('0x8e'),_0x18c63c['uniqueid'],util[_0x7011('0x47')](_0x18c63c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18c63c['uniqueid']]){var _0x1d5359=_['last'](this[_0x7011('0xe')][_0x18c63c[_0x7011('0x56')]]);_0x1d5359[_0x7011('0x21')]=![];_0x1d5359[_0x7011('0x8f')]=null;_0x1d5359[_0x7011('0x90')]=!![];_0x1d5359['lastAssignedTo']=_0x18c63c['membername'];_0x1d5359['holdtime']=_0x18c63c['holdtime'];_0x1d5359['queuecallercomplete']=!![];_0x1d5359[_0x7011('0x91')]=![];_0x1d5359[_0x7011('0x92')]=null;if(!_0x1d5359[_0x7011('0x93')]){if(_0x18c63c[_0x7011('0x94')]==_0x7011('0x93')){_0x1d5359['queuecallerexitreason']=_0x7011('0x95');logger[_0x7011('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1d5359[_0x7011('0x58')],_0x1d5359[_0x7011('0x5c')]);}else{if(_['startsWith'](_0x18c63c[_0x7011('0x41')][_0x7011('0x96')](),'local/')){if(this[_0x7011('0xe')][_0x18c63c[_0x7011('0x97')]]){var _0x3e3bd5=_[_0x7011('0x7f')](this[_0x7011('0xe')][_0x18c63c[_0x7011('0x97')]]);_0x3e3bd5['queuecallercomplete']=![];_0x3e3bd5['queuecallerexit']=!![];_0x3e3bd5[_0x7011('0x92')]=moment(_0x1d5359[_0x7011('0x98')])['add'](_0x18c63c[_0x7011('0x81')],'seconds')['format'](_0x7011('0x76'));_0x3e3bd5[_0x7011('0x83')]='FORWARDTRANSFER';_0x3e3bd5[_0x7011('0x93')]=!![];_0x3e3bd5['transfertype']=_0x7011('0x99');_0x3e3bd5[_0x7011('0x9a')]=_0x18c63c[_0x7011('0x9b')];_0x3e3bd5[_0x7011('0x9c')]=_0x18c63c['uniqueid'];logger[_0x7011('0x86')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x3e3bd5[_0x7011('0x58')],_0x3e3bd5['type']);var _0x5678bb=this[_0x7011('0xe')][_0x18c63c[_0x7011('0x97')]];this[_0x7011('0xe')][_0x18c63c[_0x7011('0x97')]]=this['queueReports'][_0x18c63c[_0x7011('0x56')]];this[_0x7011('0xe')][_0x18c63c['uniqueid']]=_0x5678bb;}}else{_0x1d5359[_0x7011('0x83')]=_0x7011('0x9d')+_0x18c63c[_0x7011('0x94')]['toUpperCase']();logger[_0x7011('0x86')](_0x7011('0x9e'),_0x1d5359[_0x7011('0x58')],_0x1d5359[_0x7011('0x5c')],_0x1d5359[_0x7011('0x83')]);}}}this['channels'][_0x18c63c[_0x7011('0x56')]]=_0x1d5359;}}}catch(_0x51058d){logger[_0x7011('0x45')](_0x7011('0x8e'),_0x18c63c['uniqueid'],util[_0x7011('0x47')](_0x51058d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')][_0x7011('0x29')]=function(_0x325fcd){try{if(this[_0x7011('0x6e')](_0x325fcd)){logger[_0x7011('0x4e')](_0x7011('0x9f'),_0x325fcd['uniqueid'],util['inspect'](_0x325fcd,{'showHidden':![],'depth':null}));this[_0x7011('0xa0')](_0x325fcd[_0x7011('0x56')],_[_0x7011('0x7d')](_0x325fcd[_0x7011('0xa1')])[0x0],_0x325fcd['value']);if(this['queueReports'][_0x325fcd['uniqueid']]){var _0x4a5b39=_[_0x7011('0x7f')](this[_0x7011('0xe')][_0x325fcd[_0x7011('0x56')]]);if(_0x4a5b39){if(this['isNotNull'](_0x325fcd['variable'])&&this[_0x7011('0x6e')](_0x325fcd[_0x7011('0xa1')][_0x7011('0x69')])){switch(_0x325fcd[_0x7011('0xa2')]){case _0x7011('0xa3'):_0x4a5b39[_0x7011('0x91')]=![];_0x4a5b39[_0x7011('0x92')]=null;break;case _0x7011('0xa4'):_0x4a5b39[_0x7011('0xa5')]=_0x7011('0xa6');_0x4a5b39[_0x7011('0x91')]=!![];_0x4a5b39[_0x7011('0x92')]=moment()[_0x7011('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a5b39['queuecallerleaveAt']=moment()[_0x7011('0x50')](_0x7011('0x76'));logger['debug'](_0x7011('0xa7'),_0x325fcd[_0x7011('0x56')],util['inspect'](_0x4a5b39,{'showHidden':![],'depth':null}));ami[_0x7011('0x4c')](_0x7011('0xa8'),_0x4a5b39);break;default:_0x4a5b39[_0x7011('0x91')]=!![];_0x4a5b39['queuecallerexitAt']=moment()[_0x7011('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a5b39['queuecallerleaveAt']=moment()[_0x7011('0x50')](_0x7011('0x76'));}_0x4a5b39[_0x7011('0x21')]=![];_0x4a5b39[_0x7011('0x8f')]=null;_0x4a5b39[_0x7011('0x83')]=_0x325fcd[_0x7011('0xa2')];this[_0x7011('0x11')][_0x325fcd[_0x7011('0x56')]]=_0x4a5b39;this[_0x7011('0x53')](_0x4a5b39,_0x7011('0xa9'));}else if(this['isNotNull'](_0x325fcd[_0x7011('0xa1')])&&this[_0x7011('0x6e')](_0x325fcd[_0x7011('0xa1')][_0x7011('0xaa')])){if(!_0x4a5b39['queuecallerabandon']){_0x4a5b39[_0x7011('0x91')]=!![];_0x4a5b39[_0x7011('0x92')]=moment()[_0x7011('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a5b39[_0x7011('0x83')]=_0x7011('0xab');_0x4a5b39['queuecallerleaveAt']=moment()[_0x7011('0x50')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7011('0x11')][_0x325fcd[_0x7011('0x56')]]=_0x4a5b39;}}logger[_0x7011('0x86')](_0x7011('0xac'),_0x325fcd['uniqueid'],_0x4a5b39['queue'],_0x4a5b39[_0x7011('0x5c')],_[_0x7011('0x7d')](_0x325fcd['variable'])[0x0],_0x325fcd[_0x7011('0xa2')]);_0x4a5b39[_0x7011('0x16')]=this[_0x7011('0x16')][_0x325fcd[_0x7011('0x56')]];}}}}catch(_0x2c5336){logger['error']('[%s][voiceQueueReport][varset]',_0x325fcd[_0x7011('0x56')],util[_0x7011('0x47')](_0x2c5336,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7011('0xa')]['addVariable']=function(_0x2db41f,_0x337add,_0x3090cf){var _0xce32f7=['rtpaudioqos',_0x7011('0xad'),'rtpaudioqosjitter',_0x7011('0xae'),_0x7011('0xaf'),_0x7011('0xb0'),'rtpaudioqosrtt',_0x7011('0xb1'),'sipcallid',_0x7011('0xb2'),'bridgepeer','bridgepvtcallid',_0x7011('0xb3'),_0x7011('0xb4'),_0x7011('0xb5'),'memberlastcall','membername',_0x7011('0xb6'),_0x7011('0xb7')];if(!_[_0x7011('0x3f')](_0x337add)&&!_['includes'](_0xce32f7,_0x337add)){if(_['isUndefined'](this[_0x7011('0x16')][_0x2db41f])){this[_0x7011('0x16')][_0x2db41f]={};}this['variables'][_0x2db41f][_0x337add]=_0x3090cf;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x51c36f,_0x26a63f,_0x36ea09){try{var _0x3cc8a1={};if(this[_0x7011('0xe')][_0x51c36f]){for(var _0x4ef3ed=0x0;_0x4ef3ed=0x0?moment(_0x14adec[_0x9984('0x18')])[_0x9984('0xf')](_0x14adec['starttime'],_0x9984('0x10')):null,'data1':_0x9984('0x1a'),'data2':_0x14adec[_0x9984('0x1b')],'data3':_0x14adec[_0x9984('0x13')],'data4':_0x14adec[_0x9984('0x1c')]||null,'role':_0x9984('0x15'),'internal':_0x14adec[_0x9984('0x1b')]?_['toNumber'](_0x14adec[_0x9984('0x1b')]):undefined,'uniqueid':_0x14adec['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xf1a4=['moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent','accountcode','uniqueid','voiceDialReport','membername','interface','endtime','starttime','exten','dialstring','toNumber'];(function(_0x55c72d,_0x5d7876){var _0x3b64b6=function(_0x22de97){while(--_0x22de97){_0x55c72d['push'](_0x55c72d['shift']());}};_0x3b64b6(++_0x5d7876);}(_0xf1a4,0x168));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x4f1a('0x0'));var _=require(_0x4f1a('0x1'));var util=require('util');var client=require(_0x4f1a('0x2'));exports[_0x4f1a('0x3')]=function(_0x4d5861){var _0x3cf6fa=_0x4d5861[_0x4f1a('0x4')]||_0x4d5861['queuecallerexitAt'];return client[_0x4f1a('0x5')](_0x4f1a('0x6'),{'body':{'channel':_0x4f1a('0x7'),'membername':_0x4d5861[_0x4f1a('0x8')],'interface':_[_0x4f1a('0x9')](_0x4d5861['interface'])?util[_0x4f1a('0xa')](_0x4f1a('0xb'),_0x4d5861['lastAssignedTo']):_0x4d5861['interface'],'type':_0x4f1a('0xc'),'enterAt':_0x4d5861['queuecallerleaveAt'],'exitAt':_0x3cf6fa,'duration':moment(_0x3cf6fa)[_0x4f1a('0xd')](_0x4d5861[_0x4f1a('0xe')],_0x4f1a('0xf')),'data1':_0x4f1a('0x10'),'data2':_0x4d5861[_0x4f1a('0x11')],'data3':_0x4d5861['exten'],'data4':null,'data5':_0x4d5861[_0x4f1a('0x12')],'role':_0x4f1a('0x13'),'internal':_0x4d5861[_0x4f1a('0x14')]?_['toNumber'](_0x4d5861['accountcode']):undefined,'uniqueid':_0x4d5861[_0x4f1a('0x15')]},'log':_0x4f1a('0x6')});};exports[_0x4f1a('0x16')]=function(_0x2e980f){return client[_0x4f1a('0x5')](_0x4f1a('0x6'),{'body':{'channel':_0x4f1a('0x7'),'membername':_0x2e980f[_0x4f1a('0x17')],'interface':_0x2e980f[_0x4f1a('0x18')],'type':_0x4f1a('0xc'),'enterAt':_0x2e980f['starttime'],'exitAt':_0x2e980f['endtime'],'duration':moment(_0x2e980f[_0x4f1a('0x19')])[_0x4f1a('0xd')](_0x2e980f['starttime'],_0x4f1a('0xf'))>=0x0?moment(_0x2e980f[_0x4f1a('0x19')])[_0x4f1a('0xd')](_0x2e980f[_0x4f1a('0x1a')],_0x4f1a('0xf')):null,'data1':'outbound','data2':_0x2e980f['accountcode'],'data3':_0x2e980f[_0x4f1a('0x1b')],'data4':_0x2e980f[_0x4f1a('0x1c')]||null,'role':_0x4f1a('0x13'),'internal':_0x2e980f[_0x4f1a('0x14')]?_[_0x4f1a('0x1d')](_0x2e980f[_0x4f1a('0x14')]):undefined,'uniqueid':_0x2e980f[_0x4f1a('0x15')]},'log':_0x4f1a('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ba3408d..2330851 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 _0x3a27=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x16bfbb,_0x3c3e70){var _0x5c1d6c=function(_0xd4abe1){while(--_0xd4abe1){_0x16bfbb['push'](_0x16bfbb['shift']());}};_0x5c1d6c(++_0x3c3e70);}(_0x3a27,0x19c));var _0x73a2=function(_0x237cbb,_0x27ed4b){_0x237cbb=_0x237cbb-0x0;var _0x33ba22=_0x3a27[_0x237cbb];return _0x33ba22;};'use strict';var client=require(_0x73a2('0x0'));exports[_0x73a2('0x1')]=function(){return client[_0x73a2('0x2')](_0x73a2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x73a2('0x4'),_0x73a2('0x5')]},'log':_0x73a2('0x6')});}; \ No newline at end of file +var _0x1aab=['../client','getSettings','Request','stopRecordingOnTransfer','GetSettings'];(function(_0x532fd9,_0x1ffee7){var _0x292a5c=function(_0x49e044){while(--_0x49e044){_0x532fd9['push'](_0x532fd9['shift']());}};_0x292a5c(++_0x1ffee7);}(_0x1aab,0x122));var _0xb1aa=function(_0x20a459,_0xdde012){_0x20a459=_0x20a459-0x0;var _0x433126=_0x1aab[_0x20a459];return _0x433126;};'use strict';var client=require(_0xb1aa('0x0'));exports[_0xb1aa('0x1')]=function(){return client[_0xb1aa('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb1aa('0x3'),'previewRecallmeReminderInterval']},'log':_0xb1aa('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index c3e727b..1f41900 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 _0x74cc=['Request','name','html','GetTemplate','../client','getTemplates'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x74cc,0x184));var _0xc74c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x74cc[_0x31e29a];return _0x32d892;};'use strict';var client=require(_0xc74c('0x0'));exports[_0xc74c('0x1')]=function(_0xd8916f){return function(_0x41fb1a){return client[_0xc74c('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xc74c('0x3'),_0xc74c('0x4')]},'log':_0xc74c('0x5')});};}; \ No newline at end of file +var _0xa9a7=['GetTemplate','name','getTemplates'];(function(_0x48c9b3,_0x1fb678){var _0x4c782f=function(_0x4b3842){while(--_0x4b3842){_0x48c9b3['push'](_0x48c9b3['shift']());}};_0x4c782f(++_0x1fb678);}(_0xa9a7,0x197));var _0x7a9a=function(_0x20f752,_0x58b67b){_0x20f752=_0x20f752-0x0;var _0x4412b2=_0xa9a7[_0x20f752];return _0x4412b2;};'use strict';var client=require('../client');exports[_0x7a9a('0x0')]=function(_0x4b9f22){return function(_0x3588ec){return client['Request'](_0x7a9a('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7a9a('0x2'),'html']},'log':_0x7a9a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2bf39c9..fb596a5 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 _0x6ab6=['status','Condition','field','operator','value','Action','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x26b130,_0x50a2d1){var _0x2d980c=function(_0x2cdf59){while(--_0x2cdf59){_0x26b130['push'](_0x26b130['shift']());}};_0x2d980c(++_0x50a2d1);}(_0x6ab6,0x11b));var _0x66ab=function(_0x45ac03,_0x2390df){_0x45ac03=_0x45ac03-0x0;var _0x433e26=_0x6ab6[_0x45ac03];return _0x433e26;};'use strict';var client=require(_0x66ab('0x0'));exports[_0x66ab('0x1')]=function(_0x564f6b){return function(_0xfd6cc3){return client['Request'](_0x66ab('0x2'),{'options':{'raw':![],'attributes':['id',_0x66ab('0x3'),_0x66ab('0x4'),_0x66ab('0x5')],'include':[{'model':_0x66ab('0x6'),'as':'AllConditions','attributes':['id',_0x66ab('0x7'),_0x66ab('0x8'),_0x66ab('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x66ab('0x7'),_0x66ab('0x8'),_0x66ab('0x9')]},{'model':_0x66ab('0xa'),'as':'Actions','attributes':['id','action','data1',_0x66ab('0xb'),_0x66ab('0xc'),_0x66ab('0xd'),'data5',_0x66ab('0xe'),_0x66ab('0xf')]}]},'log':_0x66ab('0x2')});};}; \ No newline at end of file +var _0x8b35=['Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data5','data6','data7','getTriggers','GetTrigger','name','channel','status'];(function(_0x165664,_0x4dc8d9){var _0x18c2bb=function(_0x589705){while(--_0x589705){_0x165664['push'](_0x165664['shift']());}};_0x18c2bb(++_0x4dc8d9);}(_0x8b35,0x1c7));var _0x58b3=function(_0x3feb63,_0x520928){_0x3feb63=_0x3feb63-0x0;var _0x3e4834=_0x8b35[_0x3feb63];return _0x3e4834;};'use strict';var client=require('../client');exports[_0x58b3('0x0')]=function(_0x46f589){return function(_0x59114c){return client['Request'](_0x58b3('0x1'),{'options':{'raw':![],'attributes':['id',_0x58b3('0x2'),_0x58b3('0x3'),_0x58b3('0x4')],'include':[{'model':_0x58b3('0x5'),'as':_0x58b3('0x6'),'attributes':['id',_0x58b3('0x7'),_0x58b3('0x8'),_0x58b3('0x9')]},{'model':_0x58b3('0x5'),'as':_0x58b3('0xa'),'attributes':['id',_0x58b3('0x7'),'operator','value']},{'model':_0x58b3('0xb'),'as':_0x58b3('0xc'),'attributes':['id',_0x58b3('0xd'),_0x58b3('0xe'),_0x58b3('0xf'),_0x58b3('0x10'),'data4',_0x58b3('0x11'),_0x58b3('0x12'),_0x58b3('0x13')]}]},'log':_0x58b3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a9748f0..811d610 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 _0x0506=['GetTrunk','../client','getTrunks','registry'];(function(_0x3f625c,_0xbdf76){var _0x5c80ba=function(_0x180b1d){while(--_0x180b1d){_0x3f625c['push'](_0x3f625c['shift']());}};_0x5c80ba(++_0xbdf76);}(_0x0506,0x1d1));var _0x6050=function(_0x5e0a17,_0x22165c){_0x5e0a17=_0x5e0a17-0x0;var _0x518109=_0x0506[_0x5e0a17];return _0x518109;};'use strict';var client=require(_0x6050('0x0'));exports[_0x6050('0x1')]=function(_0x1ba949){return function(_0x5592e4){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6050('0x2'),'defaultuser']},'log':_0x6050('0x3')});};}; \ No newline at end of file +var _0xe700=['GetTrunk','../client','getTrunks','Request','registry','defaultuser'];(function(_0x221272,_0x29146a){var _0xe0a9d7=function(_0x44ee43){while(--_0x44ee43){_0x221272['push'](_0x221272['shift']());}};_0xe0a9d7(++_0x29146a);}(_0xe700,0xf7));var _0x0e70=function(_0x33f87f,_0x5a9c32){_0x33f87f=_0x33f87f-0x0;var _0x364611=_0xe700[_0x33f87f];return _0x364611;};'use strict';var client=require(_0x0e70('0x0'));exports[_0x0e70('0x1')]=function(_0x3a3c2){return function(_0x5c0365){return client[_0x0e70('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x0e70('0x3'),_0x0e70('0x4')]},'log':_0x0e70('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 359455c..128a2c1 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x5c1cc9,_0xe04ed9){var _0x546668=function(_0x4bca96){while(--_0x4bca96){_0x5c1cc9['push'](_0x5c1cc9['shift']());}};_0x546668(++_0xe04ed9);}(_0xedd9,0xfc));var _0x9edd=function(_0x128d1e,_0x556496){_0x128d1e=_0x128d1e-0x0;var _0x2bb46b=_0xedd9[_0x128d1e];return _0x2bb46b;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x546204,_0x17d5a1){var _0x4a0c78=function(_0x37436c){while(--_0x37436c){_0x546204['push'](_0x546204['shift']());}};_0x4a0c78(++_0x17d5a1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7b1e69a..e97348e 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 _0x69b4=['UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update','Request'];(function(_0x5535d2,_0x58f54e){var _0x3ea8bb=function(_0x197a04){while(--_0x197a04){_0x5535d2['push'](_0x5535d2['shift']());}};_0x3ea8bb(++_0x58f54e);}(_0x69b4,0x15f));var _0x469b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x69b4[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x469b('0x0'));exports['create']=function(_0x38f777){return client['Request'](_0x469b('0x1'),{'body':_0x38f777,'log':_0x469b('0x1')});};exports[_0x469b('0x2')]=function(_0x200b31,_0x96e962,_0x1d9cc9){return client[_0x469b('0x3')](_0x469b('0x4'),{'body':_0x200b31,'options':{'where':{'uniqueid':_0x96e962,'interface':_0x1d9cc9,'agentcomplete':!![]}},'log':_0x469b('0x4')});}; \ No newline at end of file +var _0xf8f5=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x9e2a5a,_0x2875f5){var _0x44eb23=function(_0x1c308e){while(--_0x1c308e){_0x9e2a5a['push'](_0x9e2a5a['shift']());}};_0x44eb23(++_0x2875f5);}(_0xf8f5,0x9c));var _0x5f8f=function(_0x2f79c1,_0x58c2e9){_0x2f79c1=_0x2f79c1-0x0;var _0x17e7a6=_0xf8f5[_0x2f79c1];return _0x17e7a6;};'use strict';var client=require(_0x5f8f('0x0'));exports[_0x5f8f('0x1')]=function(_0xa46988){return client[_0x5f8f('0x2')](_0x5f8f('0x3'),{'body':_0xa46988,'log':_0x5f8f('0x3')});};exports[_0x5f8f('0x4')]=function(_0x36b927,_0x97755,_0x4cb376){return client[_0x5f8f('0x2')](_0x5f8f('0x5'),{'body':_0x36b927,'options':{'where':{'uniqueid':_0x97755,'interface':_0x4cb376,'agentcomplete':!![]}},'log':_0x5f8f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a2ff611..f9a211a 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 _0xa4df=['calleridnum','context','callerid','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0xc84590,_0x267aca){var _0x28441f=function(_0x59ddb8){while(--_0x59ddb8){_0xc84590['push'](_0xc84590['shift']());}};_0x28441f(++_0x267aca);}(_0xa4df,0x189));var _0xfa4d=function(_0x470226,_0x317b93){_0x470226=_0x470226-0x0;var _0x5267f2=_0xa4df[_0x470226];return _0x5267f2;};'use strict';var moment=require('moment');var util=require(_0xfa4d('0x0'));var _=require(_0xfa4d('0x1'));var client=require(_0xfa4d('0x2'));exports[_0xfa4d('0x3')]=function(_0x262ad9){return client[_0xfa4d('0x4')](_0xfa4d('0x5'),{'body':_[_0xfa4d('0x6')](_0x262ad9,{'source':_0x262ad9[_0xfa4d('0x7')],'destinationcontext':_0x262ad9[_0xfa4d('0x8')],'callerid':_0x262ad9[_0xfa4d('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0xfa4d('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfa4d('0xa')](_0xfa4d('0xb'))[_0xfa4d('0xc')](_0xfa4d('0xd')),moment()[_0xfa4d('0xe')](_0xfa4d('0xb'))[_0xfa4d('0xc')](_0xfa4d('0xd'))]}},'attributes':[_0xfa4d('0xf'),_0xfa4d('0x10'),_0xfa4d('0x11'),_0xfa4d('0x12')]},'log':_0xfa4d('0x13')});};}; \ No newline at end of file +var _0xd7d8=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','util','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','format'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xd7d8,0x147));var _0x8d7d=function(_0x171bb2,_0x164192){_0x171bb2=_0x171bb2-0x0;var _0x7884aa=_0xd7d8[_0x171bb2];return _0x7884aa;};'use strict';var moment=require('moment');var util=require(_0x8d7d('0x0'));var _=require(_0x8d7d('0x1'));var client=require(_0x8d7d('0x2'));exports['create']=function(_0x4fac0f){return client['Request'](_0x8d7d('0x3'),{'body':_[_0x8d7d('0x4')](_0x4fac0f,{'source':_0x4fac0f[_0x8d7d('0x5')],'destinationcontext':_0x4fac0f[_0x8d7d('0x6')],'callerid':_0x4fac0f[_0x8d7d('0x7')],'amaflags':_0x8d7d('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x8d7d('0x9')]=function(){return function(){return client[_0x8d7d('0xa')](_0x8d7d('0xb'),{'options':{'where':{'type':[_0x8d7d('0xc')],'createdAt':{'$between':[moment()[_0x8d7d('0xd')]('day')[_0x8d7d('0xe')](_0x8d7d('0xf')),moment()[_0x8d7d('0x10')]('day')[_0x8d7d('0xe')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x8d7d('0x11'),'disposition','duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fd6339d..f58c0cf 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 _0xc055=['create','Request','CreateVoiceDialReport','../client'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0xc055,0x73));var _0x5c05=function(_0x2c3b20,_0x23bada){_0x2c3b20=_0x2c3b20-0x0;var _0x26f206=_0xc055[_0x2c3b20];return _0x26f206;};'use strict';var client=require(_0x5c05('0x0'));exports[_0x5c05('0x1')]=function(_0x35ed91){return client[_0x5c05('0x2')](_0x5c05('0x3'),{'body':_0x35ed91,'log':_0x5c05('0x3')});}; \ No newline at end of file +var _0x9df1=['../client','create','CreateVoiceDialReport'];(function(_0xcd2a07,_0x51d27f){var _0x4e753c=function(_0x1a3970){while(--_0x1a3970){_0xcd2a07['push'](_0xcd2a07['shift']());}};_0x4e753c(++_0x51d27f);}(_0x9df1,0x192));var _0x19df=function(_0x21851a,_0x1d8a17){_0x21851a=_0x21851a-0x0;var _0x3abb47=_0x9df1[_0x21851a];return _0x3abb47;};'use strict';var client=require(_0x19df('0x0'));exports[_0x19df('0x1')]=function(_0x5d1a19){return client['Request'](_0x19df('0x2'),{'body':_0x5d1a19,'log':_0x19df('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5800a74..0ff13ac 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 _0x1123=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x74ffb5,_0x57e314){var _0x424663=function(_0x3c566b){while(--_0x3c566b){_0x74ffb5['push'](_0x74ffb5['shift']());}};_0x424663(++_0x57e314);}(_0x1123,0x118));var _0x3112=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1123[_0x21a9d9];return _0x46adce;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x3112('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3112('0x1'),_0x3112('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x3112('0x3')});};}; \ No newline at end of file +var _0x3f8c=['Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x3c0aba,_0x4520ca){var _0x78226b=function(_0x440d94){while(--_0x440d94){_0x3c0aba['push'](_0x3c0aba['shift']());}};_0x78226b(++_0x4520ca);}(_0x3f8c,0x104));var _0xc3f8=function(_0x51bea5,_0x153131){_0x51bea5=_0x51bea5-0x0;var _0x31306e=_0x3f8c[_0x51bea5];return _0x31306e;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xc3f8('0x0')](_0xc3f8('0x1'),{'options':{'raw':!![],'attributes':['id',_0xc3f8('0x2'),_0xc3f8('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8a5383a..1ee83f8 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 _0x4cd4=['dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x4cd4,0x112));var _0x44cd=function(_0x15fe46,_0x40dc50){_0x15fe46=_0x15fe46-0x0;var _0x4b7827=_0x4cd4[_0x15fe46];return _0x4b7827;};'use strict';var client=require(_0x44cd('0x0'));exports[_0x44cd('0x1')]=function(){return function(){return client[_0x44cd('0x2')](_0x44cd('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x44cd('0x4'),'acwTimeout',_0x44cd('0x5'),_0x44cd('0x6'),_0x44cd('0x7'),'dialActive','dialMethod',_0x44cd('0x8'),_0x44cd('0x9'),_0x44cd('0xa'),_0x44cd('0xb'),_0x44cd('0xc'),'dialPredictiveInterval',_0x44cd('0xd'),_0x44cd('0xe'),_0x44cd('0xf'),'dialQueueOptions',_0x44cd('0x10'),'dialQueueProject','dialCongestionMaxRetry',_0x44cd('0x11'),_0x44cd('0x12'),'dialBusyRetryFrequency',_0x44cd('0x13'),_0x44cd('0x14'),_0x44cd('0x15'),_0x44cd('0x16'),_0x44cd('0x17'),_0x44cd('0x18'),_0x44cd('0x19'),_0x44cd('0x1a'),'dialAMDInitialSilence',_0x44cd('0x1b'),_0x44cd('0x1c'),'dialAMDTotalAnalysisTime',_0x44cd('0x1d'),_0x44cd('0x1e'),_0x44cd('0x1f'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout',_0x44cd('0x20'),_0x44cd('0x21'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x44cd('0x22'),_0x44cd('0x6'),_0x44cd('0x23'),_0x44cd('0x24'),_0x44cd('0x25'),_0x44cd('0x26'),_0x44cd('0x27'),_0x44cd('0x28'),_0x44cd('0x29'),_0x44cd('0x2a'),_0x44cd('0x2b'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x44cd('0x2c'),_0x44cd('0x2d'),_0x44cd('0x2e'),_0x44cd('0x2f'),_0x44cd('0x30'),_0x44cd('0x31'),_0x44cd('0x32')],'include':[{'model':_0x44cd('0x33'),'as':'Trunk','attributes':['id',_0x44cd('0x34'),'callerid','active']},{'model':'Pause','as':_0x44cd('0x35'),'attributes':['id',_0x44cd('0x34')]},{'model':_0x44cd('0x33'),'as':_0x44cd('0x36'),'attributes':['id',_0x44cd('0x34'),_0x44cd('0x37'),'active']},{'model':_0x44cd('0x38'),'as':_0x44cd('0x38'),'attributes':['id',_0x44cd('0x34')],'include':[{'model':_0x44cd('0x38'),'as':_0x44cd('0x39'),'attributes':['id',_0x44cd('0x34'),'interval']}]}]},'log':_0x44cd('0x1')});};}; \ No newline at end of file +var _0xa251=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0xe67253,_0x2bcfb5){var _0x2c4e20=function(_0x370d12){while(--_0x370d12){_0xe67253['push'](_0xe67253['shift']());}};_0x2c4e20(++_0x2bcfb5);}(_0xa251,0x1de));var _0x1a25=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0xa251[_0x2e76a7];return _0x454cde;};'use strict';var client=require(_0x1a25('0x0'));exports[_0x1a25('0x1')]=function(){return function(){return client[_0x1a25('0x2')](_0x1a25('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1a25('0x4'),_0x1a25('0x5'),_0x1a25('0x6'),_0x1a25('0x7'),'type',_0x1a25('0x8'),_0x1a25('0x9'),_0x1a25('0xa'),_0x1a25('0xb'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x1a25('0xc'),_0x1a25('0xd'),'dialOriginateCallerIdNumber',_0x1a25('0xe'),'dialQueueOptions',_0x1a25('0xf'),_0x1a25('0x10'),_0x1a25('0x11'),_0x1a25('0x12'),_0x1a25('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x1a25('0x14'),_0x1a25('0x15'),_0x1a25('0x16'),'dialGlobalInterval',_0x1a25('0x17'),_0x1a25('0x18'),'dialAMDActive',_0x1a25('0x19'),_0x1a25('0x1a'),_0x1a25('0x1b'),_0x1a25('0x1c'),_0x1a25('0x1d'),_0x1a25('0x1e'),_0x1a25('0x1f'),_0x1a25('0x20'),_0x1a25('0x21'),_0x1a25('0x22'),_0x1a25('0x23'),_0x1a25('0x24'),'dialOrderByScheduledAt',_0x1a25('0x25'),'dialAgiAfterHangupClient',_0x1a25('0x26'),_0x1a25('0x7'),_0x1a25('0x27'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x1a25('0x28'),_0x1a25('0x29'),_0x1a25('0x2a'),_0x1a25('0x2b'),'dialAbandonedMaxRetry',_0x1a25('0x2c'),_0x1a25('0x2d'),_0x1a25('0x2e'),_0x1a25('0x2f'),_0x1a25('0x30'),_0x1a25('0x31'),_0x1a25('0x32'),_0x1a25('0x33'),_0x1a25('0x34'),_0x1a25('0x35')],'include':[{'model':_0x1a25('0x36'),'as':_0x1a25('0x36'),'attributes':['id',_0x1a25('0x37'),_0x1a25('0x38'),_0x1a25('0x39')]},{'model':_0x1a25('0x3a'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x1a25('0x36'),'as':_0x1a25('0x3b'),'attributes':['id',_0x1a25('0x37'),_0x1a25('0x38'),_0x1a25('0x39')]},{'model':_0x1a25('0x3c'),'as':_0x1a25('0x3c'),'attributes':['id',_0x1a25('0x37')],'include':[{'model':_0x1a25('0x3c'),'as':'Intervals','attributes':['id',_0x1a25('0x37'),_0x1a25('0x3d')]}]}]},'log':_0x1a25('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 76e2349..0ff9e4f 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(_0x24ea8c,_0x2d71d0){var _0x4327d3=function(_0x242b2a){while(--_0x242b2a){_0x24ea8c['push'](_0x24ea8c['shift']());}};_0x4327d3(++_0x2d71d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x1cc40d,_0x1cbfb2){var _0x2b72bf=function(_0x55a932){while(--_0x55a932){_0x1cc40d['push'](_0x1cc40d['shift']());}};_0x2b72bf(++_0x1cbfb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 5e64da0..ccd4ecc 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 _0x7ba4=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x29e684,_0x1d6a24){var _0x12e7be=function(_0x415d4c){while(--_0x415d4c){_0x29e684['push'](_0x29e684['shift']());}};_0x12e7be(++_0x1d6a24);}(_0x7ba4,0x16c));var _0x47ba=function(_0x215ad1,_0x57a34b){_0x215ad1=_0x215ad1-0x0;var _0x36487e=_0x7ba4[_0x215ad1];return _0x36487e;};'use strict';var client=require('../client');exports[_0x47ba('0x0')]=function(_0x5116ae){return function(){return client[_0x47ba('0x1')](_0x47ba('0x2'),{'options':{'where':{'VoiceQueueId':_0x5116ae,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb194=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0xb194,0x72));var _0x4b19=function(_0xd9ad81,_0x511fdf){_0xd9ad81=_0xd9ad81-0x0;var _0x4ba037=_0xb194[_0xd9ad81];return _0x4ba037;};'use strict';var client=require(_0x4b19('0x0'));exports[_0x4b19('0x1')]=function(_0x41633c){return function(){return client[_0x4b19('0x2')](_0x4b19('0x3'),{'options':{'where':{'VoiceQueueId':_0x41633c,'paused':!![]},'raw':!![]},'log':_0x4b19('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 205aa50..250f43a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x17f113,_0x7279dd){var _0x325ccd=function(_0x3849a8){while(--_0x3849a8){_0x17f113['push'](_0x17f113['shift']());}};_0x325ccd(++_0x7279dd);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2c9198,_0x5b90b7){var _0x83c679=function(_0x30afa3){while(--_0x30afa3){_0x2c9198['push'](_0x2c9198['shift']());}};_0x83c679(++_0x5b90b7);}(_0x7a54,0x106));var _0x47a5=function(_0x2a7ee2,_0x2f406b){_0x2a7ee2=_0x2a7ee2-0x0;var _0x18251d=_0x7a54[_0x2a7ee2];return _0x18251d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index dda6fdd..53b17e7 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 _0xe014=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe014,0x148));var _0x4e01=function(_0x109a9e,_0x404cbd){_0x109a9e=_0x109a9e-0x0;var _0x1f4c19=_0xe014[_0x109a9e];return _0x1f4c19;};'use strict';var client=require('../client');exports[_0x4e01('0x0')]={};exports[_0x4e01('0x1')]=function(_0x535044){return client[_0x4e01('0x2')](_0x4e01('0x3'),{'body':{'result':_0x535044[_0x4e01('0x4')],'transfererchannel':_0x535044[_0x4e01('0x5')],'transferercalleridnum':_0x535044[_0x4e01('0x6')],'transferercalleridname':_0x535044[_0x4e01('0x7')],'transfererconnectedlinenum':_0x535044[_0x4e01('0x8')],'transfererconnectedlinename':_0x535044[_0x4e01('0x9')],'transfereraccountcode':_0x535044[_0x4e01('0xa')],'transferercontext':_0x535044[_0x4e01('0xb')],'transfererexten':_0x535044['transfererexten'],'transfererlinkedid':_0x535044[_0x4e01('0xc')],'transfereechannel':_0x535044[_0x4e01('0xd')],'transfereecalleridnum':_0x535044[_0x4e01('0xe')],'transfereecalleridname':_0x535044[_0x4e01('0xf')],'transfereeconnectedlinenum':_0x535044[_0x4e01('0x10')],'transfereeconnectedlinename':_0x535044[_0x4e01('0x11')],'transfereeaccountcode':_0x535044[_0x4e01('0x12')],'transfereecontext':_0x535044[_0x4e01('0x13')],'transfereeexten':_0x535044[_0x4e01('0x14')],'transfereelinkedid':_0x535044[_0x4e01('0x15')],'isexternal':_0x535044[_0x4e01('0x16')],'context':_0x535044[_0x4e01('0x17')],'extension':_0x535044[_0x4e01('0x18')],'type':_0x4e01('0x19')},'log':_0x4e01('0x3')});};exports[_0x4e01('0x1a')]=function(_0x559dec){return client['Request'](_0x4e01('0x3'),{'body':{'result':_0x559dec[_0x4e01('0x4')],'transfererchannel':_0x559dec[_0x4e01('0x1b')],'transferercalleridnum':_0x559dec[_0x4e01('0x1c')],'transferercalleridname':_0x559dec[_0x4e01('0x1d')],'transfererconnectedlinenum':_0x559dec[_0x4e01('0x1e')],'transfererconnectedlinename':_0x559dec['secondtransfererconnectedlinename'],'transfereraccountcode':_0x559dec[_0x4e01('0x1f')],'transferercontext':_0x559dec[_0x4e01('0x20')],'transfererexten':_0x559dec[_0x4e01('0x21')],'transfererlinkedid':_0x559dec[_0x4e01('0x22')],'transfereechannel':_0x559dec[_0x4e01('0x23')],'transfereecalleridnum':_0x559dec[_0x4e01('0x24')],'transfereecalleridname':_0x559dec['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x559dec[_0x4e01('0x25')],'transfereeconnectedlinename':_0x559dec['transfertargetconnectedlinename'],'transfereeaccountcode':_0x559dec[_0x4e01('0x26')],'transfereecontext':_0x559dec[_0x4e01('0x27')],'transfereeexten':_0x559dec['transfertargetexten'],'transfereelinkedid':_0x559dec['transfertargetlinkedid'],'isexternal':_0x559dec[_0x4e01('0x16')],'context':_0x559dec[_0x4e01('0x28')],'extension':_0x559dec[_0x4e01('0x29')],'type':'attended'},'log':_0x4e01('0x3')});}; \ No newline at end of file +var _0x3631=['isexternal','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid'];(function(_0x5aa0cc,_0x254cb8){var _0x395426=function(_0x114e2a){while(--_0x114e2a){_0x5aa0cc['push'](_0x5aa0cc['shift']());}};_0x395426(++_0x254cb8);}(_0x3631,0x16b));var _0x1363=function(_0x498c78,_0x2eab48){_0x498c78=_0x498c78-0x0;var _0xb7697f=_0x3631[_0x498c78];return _0xb7697f;};'use strict';var client=require(_0x1363('0x0'));exports['transfers']={};exports[_0x1363('0x1')]=function(_0x20350d){return client[_0x1363('0x2')](_0x1363('0x3'),{'body':{'result':_0x20350d[_0x1363('0x4')],'transfererchannel':_0x20350d[_0x1363('0x5')],'transferercalleridnum':_0x20350d[_0x1363('0x6')],'transferercalleridname':_0x20350d['transferercalleridname'],'transfererconnectedlinenum':_0x20350d[_0x1363('0x7')],'transfererconnectedlinename':_0x20350d['transfererconnectedlinename'],'transfereraccountcode':_0x20350d[_0x1363('0x8')],'transferercontext':_0x20350d[_0x1363('0x9')],'transfererexten':_0x20350d[_0x1363('0xa')],'transfererlinkedid':_0x20350d[_0x1363('0xb')],'transfereechannel':_0x20350d[_0x1363('0xc')],'transfereecalleridnum':_0x20350d[_0x1363('0xd')],'transfereecalleridname':_0x20350d[_0x1363('0xe')],'transfereeconnectedlinenum':_0x20350d[_0x1363('0xf')],'transfereeconnectedlinename':_0x20350d[_0x1363('0x10')],'transfereeaccountcode':_0x20350d[_0x1363('0x11')],'transfereecontext':_0x20350d[_0x1363('0x12')],'transfereeexten':_0x20350d[_0x1363('0x13')],'transfereelinkedid':_0x20350d['transfereelinkedid'],'isexternal':_0x20350d['isexternal'],'context':_0x20350d[_0x1363('0x14')],'extension':_0x20350d[_0x1363('0x15')],'type':_0x1363('0x16')},'log':_0x1363('0x3')});};exports[_0x1363('0x17')]=function(_0xc25dc5){return client[_0x1363('0x2')](_0x1363('0x3'),{'body':{'result':_0xc25dc5[_0x1363('0x4')],'transfererchannel':_0xc25dc5[_0x1363('0x18')],'transferercalleridnum':_0xc25dc5[_0x1363('0x19')],'transferercalleridname':_0xc25dc5[_0x1363('0x1a')],'transfererconnectedlinenum':_0xc25dc5[_0x1363('0x1b')],'transfererconnectedlinename':_0xc25dc5[_0x1363('0x1c')],'transfereraccountcode':_0xc25dc5['origtransfereraccountcode'],'transferercontext':_0xc25dc5[_0x1363('0x1d')],'transfererexten':_0xc25dc5['secondtransfererexten'],'transfererlinkedid':_0xc25dc5['origtransfererlinkedid'],'transfereechannel':_0xc25dc5[_0x1363('0x1e')],'transfereecalleridnum':_0xc25dc5[_0x1363('0x1f')],'transfereecalleridname':_0xc25dc5[_0x1363('0x20')],'transfereeconnectedlinenum':_0xc25dc5[_0x1363('0x21')],'transfereeconnectedlinename':_0xc25dc5[_0x1363('0x22')],'transfereeaccountcode':_0xc25dc5['transfertargetaccountcode'],'transfereecontext':_0xc25dc5[_0x1363('0x23')],'transfereeexten':_0xc25dc5['transfertargetexten'],'transfereelinkedid':_0xc25dc5[_0x1363('0x24')],'isexternal':_0xc25dc5[_0x1363('0x25')],'context':_0xc25dc5[_0x1363('0x26')],'extension':_0xc25dc5['origtransfererexten'],'type':_0x1363('0x27')},'log':_0x1363('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7a9cba7..f1e25f0 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x53a301,_0x213873){var _0x3ffcca=function(_0x27f530){while(--_0x27f530){_0x53a301['push'](_0x53a301['shift']());}};_0x3ffcca(++_0x213873);}(_0x7a54,0x106));var _0x47a5=function(_0x57fbac,_0x353e70){_0x57fbac=_0x57fbac-0x0;var _0xbeb7e8=_0x7a54[_0x57fbac];return _0xbeb7e8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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(_0x34cd13,_0x3a8e23){var _0x2bcfb3=function(_0x2c2690){while(--_0x2c2690){_0x34cd13['push'](_0x34cd13['shift']());}};_0x2bcfb3(++_0x3a8e23);}(_0xb10b,0x12a));var _0xbb10=function(_0x5dde65,_0x1eb6f7){_0x5dde65=_0x5dde65-0x0;var _0x1e9245=_0xb10b[_0x5dde65];return _0x1e9245;};'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 25733d4..661a31a 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 _0x9bc8=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','firstName','calleridname','','destcalleridname','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','push','format','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','localhost','socket.io-emitter','info','stringify','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','fax','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9bc8,0xa6));var _0x89bc=function(_0xe4db4b,_0x54f6af){_0xe4db4b=_0xe4db4b-0x0;var _0x5d7ac0=_0x9bc8[_0xe4db4b];return _0x5d7ac0;};'use strict';var _=require(_0x89bc('0x0'));var BPromise=require(_0x89bc('0x1'));var Redis=require(_0x89bc('0x2'));var util=require(_0x89bc('0x3'));var config=require(_0x89bc('0x4'));var logger=require(_0x89bc('0x5'))(_0x89bc('0x6'));var cmContactRpc=require(_0x89bc('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0x89bc('0x8'),'port':0x18eb});var io=require(_0x89bc('0x9'))(new Redis(config['redis']));function emit(_0x24ab05,_0xfe1182,_0xfc7b72,_0x1ef70a,_0x3ce421){logger[_0x89bc('0xa')]('[CM][%s][%s]',_0x24ab05,_0xfe1182['id'],_0xfc7b72,_0x1ef70a,JSON[_0x89bc('0xb')](_0x3ce421));io['to'](_0xfc7b72)[_0x89bc('0xc')](_0x1ef70a,_0x3ce421);}exports[_0x89bc('0xd')]=function(_0x162316,_0x480e16,_0x22d594,_0x453f00){var _0x42bd9e,_0x41ba91;var _0x5cb51f={};var _0x113949;var _0x3e149b=Number(_0x22d594['data1']);var _0x10642d=_0x22d594[_0x89bc('0xe')]?Boolean(Number(_0x22d594['data2'])):![];var _0xe22438;var _0x1a0900=![];if(!_[_0x89bc('0xf')](_0x22d594['data5'])){if(_0x22d594[_0x89bc('0x10')]=='1')_0x1a0900=!![];}if(!_0x1a0900){if(_0x453f00[_0x89bc('0x11')]){_0x5cb51f['id']=_0x453f00['xmd-contactid'];}}if(!_0x5cb51f['id']){_0x5cb51f[_0x89bc('0x12')]=_0x3e149b;_0xe22438=_0x22d594[_0x89bc('0x13')]&&_0x22d594[_0x89bc('0x13')]!=='0'?_0x22d594[_0x89bc('0x13')][_0x89bc('0x14')](','):[_0x89bc('0x15')];_0x5cb51f[_0x89bc('0x16')]=_[_0x89bc('0x17')](_0xe22438,function(_0x57efbf){var _0xfee75={};_0xfee75[_0x57efbf]=_0x453f00[_0x89bc('0x18')]?_0x453f00[_0x89bc('0x19')]:_0x453f00[_0x89bc('0x1a')];return _0xfee75;});_0x113949=_0x453f00[_0x89bc('0x18')]?_0x453f00[_0x89bc('0x19')]:_0x453f00[_0x89bc('0x1a')];}var _0x5e85a5=['id','firstName',_0x89bc('0x1b'),'phone','mobile',_0x89bc('0x1c'),'ListId','createdAt',_0x89bc('0x1d'),'updatedAt'];var _0x5b3dc2=_[_0x89bc('0x1e')](_0x5e85a5,_0xe22438);BPromise[_0x89bc('0x1f')]()['then'](cmContactRpc['getContacts']({'attributes':_0x5b3dc2,'where':_0x5cb51f,'phone':_0x113949}))[_0x89bc('0x20')](function(_0x1a2f21){_0x41ba91=_0x1a2f21;if(!_[_0x89bc('0x21')](_0x41ba91)){if(_0x41ba91[_0x89bc('0x22')]===0x1){_0x42bd9e=_0x41ba91[0x0];logger[_0x89bc('0xa')](_0x89bc('0x23'),_0x453f00['uniqueid'],_0x480e16['id'],_0x42bd9e['id']);}else{logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x453f00[_0x89bc('0x24')],_0x480e16['id'],_[_0x89bc('0x17')](_0x41ba91,'id')[_0x89bc('0x25')](','));}return;}else{logger[_0x89bc('0xa')](_0x89bc('0x26'),_0x453f00[_0x89bc('0x24')],_0x480e16['id']);var _0xd23455={'ListId':_0x3e149b};var _0x3d7c1e=_0x22d594[_0x89bc('0x27')]&&_0x22d594[_0x89bc('0x27')]!=='0'?_0x22d594[_0x89bc('0x27')]:_0x89bc('0x15');if(_0x10642d){logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x453f00['uniqueid'],_0x480e16['id']);_0xd23455[_0x3d7c1e]=_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])?_0x453f00['calleridnum']:_0x453f00['destcalleridnum'];if(_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])){_0xd23455[_0x89bc('0x28')]=_0x453f00[_0x89bc('0x29')]&&_0x453f00[_0x89bc('0x29')]!==_0x89bc('0x2a')?_0x453f00[_0x89bc('0x29')]:'Unknown';}else{_0xd23455['firstName']=_0x453f00[_0x89bc('0x2b')]&&_0x453f00[_0x89bc('0x2b')]!==_0x89bc('0x2a')?_0x453f00['destcalleridname']:'Unknown';}return BPromise[_0x89bc('0x1f')]()['then'](cmContactRpc[_0x89bc('0x2c')](_0xd23455))[_0x89bc('0x20')](function(_0x195075){_0x42bd9e=_0x195075;_0x41ba91['push'](_0x195075);if(_0x42bd9e){logger[_0x89bc('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x453f00['uniqueid'],_0x480e16['id'],_0x42bd9e['id']);}return;});}else{logger[_0x89bc('0xa')](_0x89bc('0x2d'),_0x453f00['uniqueid'],_0x480e16['id']);_0xd23455[_0x3d7c1e]=_['isNil'](_0x453f00['routeId'])?_0x453f00['calleridnum']:_0x453f00[_0x89bc('0x19')];if(_[_0x89bc('0xf')](_0x453f00[_0x89bc('0x18')])){_0xd23455[_0x89bc('0x28')]=_0x453f00[_0x89bc('0x29')]&&_0x453f00[_0x89bc('0x29')]!==_0x89bc('0x2a')?_0x453f00['calleridname']:_0x89bc('0x2e');}else{_0xd23455[_0x89bc('0x28')]=_0x453f00['destcalleridname']&&_0x453f00[_0x89bc('0x2b')]!==_0x89bc('0x2a')?_0x453f00[_0x89bc('0x2b')]:_0x89bc('0x2e');}_0x42bd9e=_0xd23455;_0x41ba91[_0x89bc('0x2f')](_0xd23455);return;}}})['then'](function(){if(_0x162316){emit(_0x453f00[_0x89bc('0x24')],_0x480e16,util['format']('user:%s',_0x162316['name']),util[_0x89bc('0x30')]('trigger:%s',_0x22d594[_0x89bc('0x31')][_0x89bc('0x32')]()),{'evt':_['merge'](_0x453f00,{'autoCreate':_0x10642d}),'contact':_0x42bd9e===undefined?{}:_0x42bd9e,'contacts':_0x41ba91[_0x89bc('0x22')]===0x0?undefined:_0x41ba91});}});}; \ No newline at end of file +var _0x711a=['[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','destcalleridnum','calleridnum','routeId','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x711a,0xf3));var _0xa711=function(_0x5ae029,_0x4de414){_0x5ae029=_0x5ae029-0x0;var _0x4c415a=_0x711a[_0x5ae029];return _0x4c415a;};'use strict';var _=require(_0xa711('0x0'));var BPromise=require(_0xa711('0x1'));var Redis=require(_0xa711('0x2'));var util=require(_0xa711('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa711('0x4'))(_0xa711('0x5'));var cmContactRpc=require(_0xa711('0x6'));config[_0xa711('0x7')]=_[_0xa711('0x8')](config[_0xa711('0x7')],{'host':_0xa711('0x9'),'port':0x18eb});var io=require(_0xa711('0xa'))(new Redis(config[_0xa711('0x7')]));function emit(_0x41a5cc,_0x2ca467,_0xa431ec,_0x84ea8,_0x111ff9){logger[_0xa711('0xb')](_0xa711('0xc'),_0x41a5cc,_0x2ca467['id'],_0xa431ec,_0x84ea8,JSON[_0xa711('0xd')](_0x111ff9));io['to'](_0xa431ec)['emit'](_0x84ea8,_0x111ff9);}exports[_0xa711('0xe')]=function(_0x9c9939,_0x41bc4e,_0xdb9a00,_0x576178){var _0x46c109,_0x41ce84;var _0x376133={};var _0x3de99d;var _0x275104=Number(_0xdb9a00[_0xa711('0xf')]);var _0x133ab4=_0xdb9a00['data2']?Boolean(Number(_0xdb9a00['data2'])):![];var _0x5ed169;var _0x61e782=![];if(!_[_0xa711('0x10')](_0xdb9a00['data5'])){if(_0xdb9a00[_0xa711('0x11')]=='1')_0x61e782=!![];}if(!_0x61e782){if(_0x576178[_0xa711('0x12')]){_0x376133['id']=_0x576178[_0xa711('0x12')];}}if(!_0x376133['id']){_0x376133[_0xa711('0x13')]=_0x275104;_0x5ed169=_0xdb9a00['data3']&&_0xdb9a00[_0xa711('0x14')]!=='0'?_0xdb9a00[_0xa711('0x14')][_0xa711('0x15')](','):[_0xa711('0x16')];_0x376133[_0xa711('0x17')]=_['map'](_0x5ed169,function(_0x150d69){var _0x5e0be3={};_0x5e0be3[_0x150d69]=_0x576178['routeId']?_0x576178[_0xa711('0x18')]:_0x576178[_0xa711('0x19')];return _0x5e0be3;});_0x3de99d=_0x576178[_0xa711('0x1a')]?_0x576178['destcalleridnum']:_0x576178[_0xa711('0x19')];}var _0x482ae7=['id','firstName',_0xa711('0x1b'),_0xa711('0x16'),'mobile',_0xa711('0x1c'),'ListId',_0xa711('0x1d'),_0xa711('0x1e'),_0xa711('0x1f')];var _0xd781c3=_[_0xa711('0x20')](_0x482ae7,_0x5ed169);BPromise[_0xa711('0x21')]()[_0xa711('0x22')](cmContactRpc[_0xa711('0x23')]({'attributes':_0xd781c3,'where':_0x376133,'phone':_0x3de99d}))[_0xa711('0x22')](function(_0x285f0e){_0x41ce84=_0x285f0e;if(!_['isEmpty'](_0x41ce84)){if(_0x41ce84[_0xa711('0x24')]===0x1){_0x46c109=_0x41ce84[0x0];logger[_0xa711('0xb')](_0xa711('0x25'),_0x576178[_0xa711('0x26')],_0x41bc4e['id'],_0x46c109['id']);}else{logger[_0xa711('0xb')](_0xa711('0x27'),_0x576178[_0xa711('0x26')],_0x41bc4e['id'],_[_0xa711('0x28')](_0x41ce84,'id')[_0xa711('0x29')](','));}return;}else{logger['info'](_0xa711('0x2a'),_0x576178[_0xa711('0x26')],_0x41bc4e['id']);var _0x4b0cc3={'ListId':_0x275104};var _0x3eae75=_0xdb9a00[_0xa711('0x2b')]&&_0xdb9a00[_0xa711('0x2b')]!=='0'?_0xdb9a00['data4']:'phone';if(_0x133ab4){logger[_0xa711('0xb')](_0xa711('0x2c'),_0x576178[_0xa711('0x26')],_0x41bc4e['id']);_0x4b0cc3[_0x3eae75]=_[_0xa711('0x10')](_0x576178[_0xa711('0x1a')])?_0x576178[_0xa711('0x19')]:_0x576178['destcalleridnum'];if(_[_0xa711('0x10')](_0x576178['routeId'])){_0x4b0cc3[_0xa711('0x2d')]=_0x576178[_0xa711('0x2e')]&&_0x576178[_0xa711('0x2e')]!==_0xa711('0x2f')?_0x576178[_0xa711('0x2e')]:_0xa711('0x30');}else{_0x4b0cc3['firstName']=_0x576178[_0xa711('0x31')]&&_0x576178[_0xa711('0x31')]!==''?_0x576178[_0xa711('0x31')]:_0xa711('0x30');}return BPromise['resolve']()['then'](cmContactRpc[_0xa711('0x32')](_0x4b0cc3))[_0xa711('0x22')](function(_0x2e33a3){_0x46c109=_0x2e33a3;_0x41ce84[_0xa711('0x33')](_0x2e33a3);if(_0x46c109){logger[_0xa711('0xb')](_0xa711('0x34'),_0x576178['uniqueid'],_0x41bc4e['id'],_0x46c109['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x576178[_0xa711('0x26')],_0x41bc4e['id']);_0x4b0cc3[_0x3eae75]=_['isNil'](_0x576178[_0xa711('0x1a')])?_0x576178[_0xa711('0x19')]:_0x576178[_0xa711('0x18')];if(_[_0xa711('0x10')](_0x576178[_0xa711('0x1a')])){_0x4b0cc3['firstName']=_0x576178[_0xa711('0x2e')]&&_0x576178[_0xa711('0x2e')]!==''?_0x576178[_0xa711('0x2e')]:_0xa711('0x30');}else{_0x4b0cc3[_0xa711('0x2d')]=_0x576178[_0xa711('0x31')]&&_0x576178[_0xa711('0x31')]!==_0xa711('0x2f')?_0x576178['destcalleridname']:'Unknown';}_0x46c109=_0x4b0cc3;_0x41ce84[_0xa711('0x33')](_0x4b0cc3);return;}}})[_0xa711('0x22')](function(){if(_0x9c9939){emit(_0x576178[_0xa711('0x26')],_0x41bc4e,util[_0xa711('0x35')](_0xa711('0x36'),_0x9c9939[_0xa711('0x37')]),util[_0xa711('0x35')](_0xa711('0x38'),_0xdb9a00[_0xa711('0x39')][_0xa711('0x3a')]()),{'evt':_['merge'](_0x576178,{'autoCreate':_0x133ab4}),'contact':_0x46c109===undefined?{}:_0x46c109,'contacts':_0x41ce84[_0xa711('0x24')]===0x0?undefined:_0x41ce84});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6535036..d848aeb 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 _0x1324=['vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','voice','inspect','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','data5','800','windowHeight','data6','winApplication','winArguments','format','trigger:%s:%s','toLowerCase','jscripty','user:%s','name','trigger:%s','exec','integration','queue','urlforward','script','parse','query','replace','channel','AllConditions','checkConditions','some','AnyConditions','debug','checkTrigger:\x20trigger','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','event','agent','membername','lastevent','routeId','null','offlineMessage','created','equals','lodash','url','ioredis','./urlforward','./cmContact','./script','../../../config/environment','trigger','../ami','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts'];(function(_0x37b937,_0x15d276){var _0x35c013=function(_0x4d98a1){while(--_0x4d98a1){_0x37b937['push'](_0x37b937['shift']());}};_0x35c013(++_0x15d276);}(_0x1324,0x163));var _0x4132=function(_0x1c2f21,_0x2d0eb2){_0x1c2f21=_0x1c2f21-0x0;var _0x3c6704=_0x1324[_0x1c2f21];return _0x3c6704;};'use strict';var util=require('util');var _=require(_0x4132('0x0'));var url=require(_0x4132('0x1'));var Mustache=require('mustache');var Redis=require(_0x4132('0x2'));var urlforward=require(_0x4132('0x3'));var integration=require('./integration');var cmContact=require(_0x4132('0x4'));var script=require(_0x4132('0x5'));var config=require(_0x4132('0x6'));var logger=require('../../../config/logger')(_0x4132('0x7'));var ami=require(_0x4132('0x8'));config['redis']=_[_0x4132('0x9')](config[_0x4132('0xa')],{'host':_0x4132('0xb'),'port':0x18eb});var io=require(_0x4132('0xc'))(new Redis(config[_0x4132('0xa')]));var operators={'equals':function(_0x47ba53,_0x2ee3e9){return _0x47ba53==_0x2ee3e9;},'not_equals':function(_0x3298b4,_0x3908e4){return _0x3298b4!=_0x3908e4;}};var barAndWebActions=[_0x4132('0xd'),'url',_0x4132('0xe')];function Trigger(_0xa3be7c){this['triggers']=_0xa3be7c[_0x4132('0xf')];this[_0x4132('0x10')]=_0xa3be7c['agents'];this[_0x4132('0x11')]=_0xa3be7c[_0x4132('0x11')];this[_0x4132('0x12')]=_0xa3be7c[_0x4132('0x12')];this[_0x4132('0x13')]=_0xa3be7c[_0x4132('0x13')];this[_0x4132('0x14')]=_0xa3be7c['zendeskAccounts'];this[_0x4132('0x15')]=_0xa3be7c[_0x4132('0x15')];this[_0x4132('0x16')]=_0xa3be7c[_0x4132('0x16')];this[_0x4132('0x17')]=_0xa3be7c[_0x4132('0x17')];this[_0x4132('0x18')]=_0xa3be7c['zohoAccounts'];this[_0x4132('0x19')]=_0xa3be7c[_0x4132('0x19')];this[_0x4132('0x1a')]=_0xa3be7c['vtigerAccounts'];this[_0x4132('0x1b')]=_0xa3be7c[_0x4132('0x1b')];this['dynamics365Accounts']=_0xa3be7c[_0x4132('0x1c')];this[_0x4132('0x1d')]=_0xa3be7c[_0x4132('0x1d')];this[_0x4132('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x4132('0x16')],'freshdesk':this[_0x4132('0x15')],'sugarcrm':this[_0x4132('0x17')],'zoho':this[_0x4132('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x4132('0x1a')],'dynamics365':this[_0x4132('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x4132('0x1b')]};ami['on'](_0x4132('0x1f'),this[_0x4132('0x20')]['bind'](this));ami['on']('custom:agentconnect',this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x22'),this['syncCustomEvent'][_0x4132('0x21')](this));ami['on'](_0x4132('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4132('0x24'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on']('custom:agentnoanswer',this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x25'),this[_0x4132('0x20')]['bind'](this));ami['on'](_0x4132('0x26'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on']('custom:agentreject',this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x27'),this['syncCustomEvent']['bind'](this));ami['on'](_0x4132('0x28'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x29'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x2a'),this[_0x4132('0x2b')][_0x4132('0x21')](this));ami['on'](_0x4132('0x2c'),this['syncAgentDial'][_0x4132('0x21')](this));ami['on'](_0x4132('0x2d'),this[_0x4132('0x2b')][_0x4132('0x21')](this));ami['on'](_0x4132('0x2e'),this[_0x4132('0x20')]['bind'](this));ami['on'](_0x4132('0x2f'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on']('custom:substatus',this[_0x4132('0x20')]['bind'](this));ami['on'](_0x4132('0x30'),this['syncCustomEvent'][_0x4132('0x21')](this));ami['on'](_0x4132('0x31'),this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on']('custom:acceptmessage',this[_0x4132('0x20')][_0x4132('0x21')](this));ami['on'](_0x4132('0x32'),this[_0x4132('0x20')]['bind'](this));ami['on'](_0x4132('0x33'),this[_0x4132('0x20')][_0x4132('0x21')](this));}Trigger[_0x4132('0x34')][_0x4132('0x35')]=function(_0x418ef6,_0xc196f9,_0x1e4776){logger[_0x4132('0x36')](_0x418ef6,_0xc196f9,JSON[_0x4132('0x37')](_0x1e4776));io['to'](_0x418ef6)[_0x4132('0x35')](_0xc196f9,_0x1e4776);};Trigger[_0x4132('0x34')][_0x4132('0x20')]=function(_0x3f4754){var _0x346797=_[_0x4132('0x38')](_0x3f4754);if(typeof _0x346797[_0x4132('0x39')]==='undefined'){_0x346797[_0x4132('0x39')]=_0x4132('0x3a');}logger['debug'](_0x4132('0x20'),util[_0x4132('0x3b')](_0x346797,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x346797);};Trigger[_0x4132('0x34')][_0x4132('0x2b')]=function(_0x1a6b3f){if(this['agents'][_0x1a6b3f['interface']]){this[_0x4132('0x20')](_0x1a6b3f);}};Trigger['prototype']['checkTriggers']=function(_0x30cbf4){var _0x546dba;for(var _0x2845da in this['triggers']){if(this[_0x4132('0xf')][_0x4132('0x3c')](_0x2845da)){if(this[_0x4132('0xf')][_0x2845da][_0x4132('0x3d')]){_0x546dba=this[_0x4132('0x3e')](this[_0x4132('0xf')][_0x2845da],_0x30cbf4);if(_0x546dba){_[_0x4132('0x3f')](_0x30cbf4,_0x30cbf4[_0x4132('0x40')]);for(var _0x17b018=0x0,_0x45bd78,_0x48ee87,_0x46274e;_0x17b0180x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x228938,_0x82fa2c){var _0x26e507=function(_0x435f8c){while(--_0x435f8c){_0x228938['push'](_0x228938['shift']());}};_0x26e507(++_0x82fa2c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 76856e7..cde4314 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 _0x7e76=['contacts','userId','body','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','customField','idField','indexOf','content','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','/systemusers(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data5','POST','clientId','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum'];(function(_0x40ad6f,_0x7f4e4){var _0x341e74=function(_0x31a529){while(--_0x31a529){_0x40ad6f['push'](_0x40ad6f['shift']());}};_0x341e74(++_0x7f4e4);}(_0x7e76,0xb2));var _0x67e7=function(_0x3be62c,_0x356009){_0x3be62c=_0x3be62c-0x0;var _0x29f993=_0x7e76[_0x3be62c];return _0x29f993;};'use strict';var _=require('lodash');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x67e7('0x0'));var md5=require(_0x67e7('0x1'));var Redis=require('ioredis');var logger=require(_0x67e7('0x2'))(_0x67e7('0x3'));var config=require(_0x67e7('0x4'));config[_0x67e7('0x5')]=_[_0x67e7('0x6')](config[_0x67e7('0x5')],{'host':_0x67e7('0x7'),'port':0x18eb});var io=require(_0x67e7('0x8'))(new Redis(config['redis']));function getAuthToken(_0x1a7457,_0x20dfc8,_0x2ffb5f){if(_0x1a7457[_0x67e7('0x9')]){_0x1a7457[_0x67e7('0xa')]=_0x1a7457[_0x67e7('0xb')][_0x67e7('0xc')];_0x1a7457['tenantId']=_0x1a7457[_0x67e7('0xb')]['data2'];return Promise['resolve'](_0x1a7457[_0x67e7('0xb')][_0x67e7('0xd')]);}var _0x49891d={'method':_0x67e7('0xe'),'uri':_0x20dfc8,'form':{'client_id':_0x1a7457[_0x67e7('0xf')],'resource':_0x1a7457[_0x67e7('0xa')],'username':_0x1a7457[_0x67e7('0x10')],'password':_0x1a7457[_0x67e7('0x11')],'grant_type':_0x67e7('0x11'),'client_secret':_0x1a7457[_0x67e7('0x12')]},'json':!![]};return rp(_0x49891d)['then'](function(_0x30fe2e){return _0x30fe2e[_0x67e7('0x13')];})[_0x67e7('0x14')](function(_0x5188a2){logger[_0x67e7('0x15')]('['+[_0x2ffb5f[_0x67e7('0x16')]()]+_0x67e7('0x17'));return _0x5188a2['message'];});}function getUser(_0x465656,_0x1e2bbc,_0x367dc5,_0x2c9454,_0x315a17,_0x407024){return new Promise(function(_0x2267cd,_0x1c2313){return getAuthToken(_0x1e2bbc,_0x2c9454,_0x407024)[_0x67e7('0x18')](function(_0x1fd68e){var _0x579bd5={'method':_0x67e7('0x19'),'uri':_0x315a17+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x67e7('0x1a')+_0x1fd68e,'OData-Version':_0x67e7('0x1b')},'json':!![]};return rp(_0x579bd5);})[_0x67e7('0x18')](function(_0x1ab5f0){var _0xf1b98e=_0x1ab5f0['value'];var _0x1bfeb6=![];var _0x27700d=null;if(!_[_0x67e7('0x1c')](_0x367dc5)){if(intUtil[_0x67e7('0x1d')](_0x367dc5[_0x67e7('0x1e')])){_0x465656['userEmail']=_0x367dc5['email'];for(_0x27700d=0x0;_0x27700d<_0xf1b98e[_0x67e7('0x1f')];_0x27700d++){if(_0xf1b98e[_0x27700d][_0x67e7('0x20')]===_0x367dc5[_0x67e7('0x1e')]&&!_0xf1b98e[_0x27700d]['isdisabled']){_0x1bfeb6=!![];logger[_0x67e7('0x21')]('['+[_0x407024['toUpperCase']()]+']\x20Agent\x20found\x20'+_0xf1b98e[_0x27700d][_0x67e7('0x22')]+'!');_0x465656['userId']=_0xf1b98e[_0x27700d][_0x67e7('0x22')];}}}}if(!_0x1bfeb6){logger[_0x67e7('0x21')]('['+[_0x407024[_0x67e7('0x16')]()]+_0x67e7('0x23'));_0x465656['userEmail']=_0x1e2bbc[_0x67e7('0x10')];for(_0x27700d=0x0;_0x27700d<_0xf1b98e[_0x67e7('0x1f')];_0x27700d++){if(_0xf1b98e[_0x27700d][_0x67e7('0x20')]===_0x1e2bbc[_0x67e7('0x10')]){_0x465656['userId']=_0xf1b98e[_0x27700d]['systemuserid'];}}}_0x2267cd(_0x465656);})[_0x67e7('0x14')](function(_0x1d4238){_0x1c2313(_0x1d4238[_0x67e7('0x24')]);});});}function createEndUser(_0x2658d9,_0x34600c,_0x2b66a9,_0x18cbf3,_0x2eee3b,_0x2c29ee,_0x58d2f0){return new Promise(function(_0x529f5c,_0x209b23){return getAuthToken(_0x34600c,_0x2b66a9,_0x2c29ee)[_0x67e7('0x18')](function(_0x2d67a9){var _0x89d75f=_0x2c29ee[_0x67e7('0x25')]()===_0x67e7('0x26')?_0x2eee3b[_0x67e7('0x27')]:_0x2eee3b['calleridnum'];var _0x4c95c3={'method':'POST','uri':_0x18cbf3+_0x67e7('0x28'),'body':{'fullname':_0x89d75f,'firstname':_0x89d75f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2658d9[_0x67e7('0x29')]+')'},'headers':{'Authorization':_0x67e7('0x1a')+_0x2d67a9,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x4c95c3[_0x67e7('0x2a')][_0x58d2f0]=_0x89d75f;return rp(_0x4c95c3);})[_0x67e7('0x18')](function(_0x30c16e){var _0x4db292=_0x30c16e[_0x67e7('0x2b')][_0x67e7('0x2c')];var _0x4c133c=_0x4db292[_0x67e7('0x2d')](_0x4db292['lastIndexOf']('(')+0x1,_0x4db292[_0x67e7('0x2e')](')'));_0x2658d9[_0x67e7('0x2f')]=_0x4c133c;_0x529f5c(_0x2658d9);})['catch'](function(_0x2fd9c4){_0x209b23(_0x2fd9c4[_0x67e7('0x24')]);});});}function getEndUser(_0xdf4bd8,_0x93c408,_0x508d80,_0x400a79,_0x47654a,_0x527bcf,_0x336e54,_0x59c610){var _0xcfab11=_0x527bcf[_0x67e7('0x25')]()===_0x67e7('0x26')?_0x47654a[_0x67e7('0x27')]:_0x47654a[_0x67e7('0x30')];return getAuthToken(_0x93c408,_0x508d80,_0x527bcf)['then'](function(_0x3bcaac){_0x59c610=_0x59c610?_0x59c610:'telephone1';var _0x366f1e={'method':_0x67e7('0x19'),'uri':_0x400a79+_0x67e7('0x31')+_0x59c610+_0x67e7('0x32')+_0x59c610+_0x67e7('0x33')+_0xcfab11[_0x67e7('0x34')]('+',_0x67e7('0x35'))+'\x27','headers':{'Authorization':_0x67e7('0x1a')+_0x3bcaac,'If-None-Match':null,'OData-Version':_0x67e7('0x1b')},'json':!![]};return rp(_0x366f1e);})[_0x67e7('0x18')](function(_0xf3d2b8){var _0x3916f8=![];if(!_0xf3d2b8)return _0x3916f8;var _0x20f3ab=_0xf3d2b8[_0x67e7('0x36')];for(var _0x19c1d7=0x0;_0x19c1d7<_0x20f3ab['length'];_0x19c1d7++){if(_0x20f3ab[_0x19c1d7][_0x59c610]===_0xcfab11){_0x3916f8=!![];_0xdf4bd8[_0x67e7('0x2f')]=_0x20f3ab[_0x19c1d7][_0x67e7('0x37')];}}return _0x3916f8;})['then'](function(_0x5cf2c4){if(_0x5cf2c4)return _0xdf4bd8;if(_0x336e54===_0x67e7('0x38')){logger[_0x67e7('0x21')]('['+[_0x527bcf[_0x67e7('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xdf4bd8;}return createEndUser(_0xdf4bd8,_0x93c408,_0x508d80,_0x400a79,_0x47654a,_0x527bcf,_0x59c610)['then'](function(_0x4e0f77){logger[_0x67e7('0x21')]('['+[_0x527bcf['toUpperCase']()]+_0x67e7('0x39'),_0x4e0f77[_0x67e7('0x2f')]);return _0x4e0f77;});});}function getCustomFields(_0x32e526,_0x54656b,_0x2d3036){var _0x41c333={};if(_0x32e526[_0x67e7('0x1f')]>0x0){_[_0x67e7('0x3a')](_0x32e526,function(_0x326f47){if(_['includes']([_0x67e7('0x3b'),_0x67e7('0x3c')],_0x326f47[_0x67e7('0x3d')])&&_0x326f47['nameField']&&!_0x326f47[_0x67e7('0x3e')]){var _0x13e52c=_0x326f47[_0x67e7('0x3f')][_0x67e7('0x25')]();var _0x5e9521=_0x13e52c['substring'](0x0,_0x13e52c['indexOf']('_'));var _0x1395a6=_0x13e52c[_0x67e7('0x2d')](_0x13e52c[_0x67e7('0x40')]('_')+0x1);if(_0x5e9521===_0x2d3036){_0x41c333[_0x1395a6]=_0x326f47[_0x67e7('0x41')];}}});}return _0x41c333;}function getTicket(_0x225d4c,_0x34a17c,_0x5aa9a4,_0x4278b7,_0x3a24b3,_0x23c95a,_0x4f91cb){return new Promise(function(_0x5157cf,_0x5d3282){var _0xec815b;return getAuthToken(_0x34a17c,_0x5aa9a4,_0x4f91cb)[_0x67e7('0x18')](function(_0x72fd6f){if(_0x23c95a['ticketType']===_0x67e7('0x42')){_0xec815b={'method':_0x67e7('0xe'),'uri':_0x4278b7+_0x67e7('0x43'),'body':Object[_0x67e7('0x44')]({},{'title':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x46')],_0x3a24b3,'\x20'),'description':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x47')],_0x3a24b3,'\x0a'),'customerid_contact@odata.bind':_0x225d4c[_0x67e7('0x2f')]?_0x67e7('0x48')+_0x225d4c[_0x67e7('0x2f')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x225d4c[_0x67e7('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x23c95a[_0x67e7('0x49')],_0x3a24b3,_0x23c95a[_0x67e7('0x4a')])),'headers':{'Authorization':_0x67e7('0x1a')+_0x72fd6f,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x23c95a[_0x67e7('0x4a')]==='phonecall'){var _0x583050=_0x225d4c[_0x67e7('0x2f')]?[{'partyid_systemuser@odata.bind':_0x67e7('0x4b')+_0x225d4c[_0x67e7('0x29')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x67e7('0x48')+_0x225d4c[_0x67e7('0x2f')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x67e7('0x4b')+_0x225d4c[_0x67e7('0x29')]+')','participationtypemask':_0x225d4c[_0x67e7('0x4c')]===_0x67e7('0x4d')?0x2:0x1}];_0xec815b={'method':_0x67e7('0xe'),'uri':_0x4278b7+'phonecalls','body':Object[_0x67e7('0x44')]({},{'subject':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x46')],_0x3a24b3,'\x20'),'phonenumber':String(_0x3a24b3['calleridnum']),'description':intUtil[_0x67e7('0x45')](_0x23c95a[_0x67e7('0x47')],_0x3a24b3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x225d4c['enduserId']?'/contacts('+_0x225d4c['enduserId']+')':undefined,'ownerid@odata.bind':_0x67e7('0x4b')+_0x225d4c['userId']+')','directioncode':_0x225d4c['callDirection']===_0x67e7('0x4d')?![]:!![],'phonecall_activity_parties':_0x583050},getCustomFields(_0x23c95a[_0x67e7('0x49')],_0x3a24b3,_0x23c95a[_0x67e7('0x4a')])),'headers':{'Authorization':_0x67e7('0x1a')+_0x72fd6f,'OData-Version':_0x67e7('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xec815b);})[_0x67e7('0x18')](function(_0x4b49dd){var _0x1507dc=_0x4b49dd[_0x67e7('0x2b')][_0x67e7('0x2c')];var _0xda2f54=_0x1507dc[_0x67e7('0x2d')](_0x1507dc[_0x67e7('0x2e')]('(')+0x1,_0x1507dc[_0x67e7('0x2e')](')'));_0x225d4c[_0x67e7('0x4e')]=_0xda2f54;_0x5157cf(_0x225d4c);})['catch'](function(_0x81a9bf){_0x5d3282(_0x81a9bf['message']);});});}function emit(_0x1d114e,_0x43c1c0,_0x2423ec,_0x2574ef){var _0x12f054={'uri':util[_0x67e7('0x4f')](_0x67e7('0x50'),_0x1d114e,_0x2423ec,_0x2574ef)};io['to'](util['format']('user:%s',_0x43c1c0))[_0x67e7('0x51')](_0x67e7('0x52'),_0x12f054);}exports['cs']=function(_0x46b54b,_0x443667,_0x553e3a,_0x1f7168,_0x235db3,_0x3b923f,_0x1ef83f,_0x4f2712){var _0x193823={};_0x3b923f['remoteUri']=_0x3b923f[_0x67e7('0x9')]?intUtil[_0x67e7('0x53')](_0x3b923f[_0x67e7('0xb')]['data7']):intUtil[_0x67e7('0x53')](_0x3b923f[_0x67e7('0xa')]);_0x3b923f['serverUrl']=intUtil['stripTrailingSlash'](_0x3b923f['serverUrl']);_0x193823[_0x67e7('0x4c')]=_0x4f2712===_0x67e7('0x4d')||_0x4f2712===_0x67e7('0x54')?'queue':'outbound';var _0x28d423=_0x3b923f['modernAuthentication']?util[_0x67e7('0x4f')](_0x67e7('0x55'),_0x3b923f[_0x67e7('0xb')][_0x67e7('0xc')]):util[_0x67e7('0x4f')](_0x67e7('0x55'),_0x3b923f['remoteUri']);var _0x56433a=util['format'](_0x67e7('0x56'),_0x3b923f[_0x67e7('0x57')]);var _0x33fda5=util['format'](_0x67e7('0x58'),_0x3b923f[_0x67e7('0x59')],_0x443667[_0x67e7('0x5a')],md5(_0x443667['uniqueid']));if(_0x235db3&&_0x235db3[_0x67e7('0x5b')]){logger[_0x67e7('0x21')](_0x67e7('0x5c'),_0x67e7('0x5d'));_0x443667[_0x67e7('0x5e')]=_0x33fda5;}else if(_0x1ef83f&&_0x1ef83f[_0x67e7('0x5f')]&&_0x1ef83f['recordingFormat']!==_0x67e7('0x60')){logger['info'](_0x67e7('0x61'),_0x67e7('0x5d'));_0x443667['recordingURL']=_0x33fda5;}else{_0x443667[_0x67e7('0x5e')]='';}return getUser(_0x193823,_0x3b923f,_0x1f7168,_0x56433a,_0x28d423,_0x4f2712)[_0x67e7('0x18')](function(_0x54a205){logger['info']('['+_0x4f2712['toUpperCase']()+_0x67e7('0x62'),_0x54a205['userId']);logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+']\x20The\x20User\x20email\x20is:',_0x54a205[_0x67e7('0x63')]);return getEndUser(_0x54a205,_0x3b923f,_0x56433a,_0x28d423,_0x443667,_0x4f2712,_0x553e3a[_0x67e7('0x64')],_0x553e3a[_0x67e7('0x65')]);})[_0x67e7('0x18')](function(_0x1ab7d0){logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x66'),_0x1ab7d0[_0x67e7('0x2f')]);logger[_0x67e7('0x21')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x67'),_0x443667['calleridnum']);return getTicket(_0x1ab7d0,_0x3b923f,_0x56433a,_0x28d423,_0x443667,_0x553e3a,_0x4f2712);})[_0x67e7('0x18')](function(_0x18dc1b){logger[_0x67e7('0x21')](util[_0x67e7('0x4f')]('['+_0x4f2712['toUpperCase']()+_0x67e7('0x68'),_0x553e3a['ticketType'],_0x18dc1b[_0x67e7('0x4e')]));logger[_0x67e7('0x21')](util[_0x67e7('0x4f')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x69'),_0x4f2712));if(_0x4f2712!==_0x67e7('0x54')&&_0x553e3a['openNewTab']){logger[_0x67e7('0x21')]('['+_0x4f2712['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3b923f[_0x67e7('0xa')],_0x1f7168[_0x67e7('0x6a')],_0x553e3a[_0x67e7('0x4a')],_0x18dc1b[_0x67e7('0x4e')]);}})[_0x67e7('0x14')](function(_0x5d5b5c){logger[_0x67e7('0x15')]('['+_0x4f2712[_0x67e7('0x16')]()+_0x67e7('0x6b'),_0x5d5b5c['message']);console['error'](_0x67e7('0x6c'),_0x5d5b5c);});}; \ No newline at end of file +var _0x9671=['password','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','userId','catch','toLowerCase','outbound','POST','contacts','lastIndexOf','enduserId','destcalleridnum','calleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','value',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','substring','indexOf','content','ticketType','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','/systemusers(','phonecalls','headers','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','resolve','data5','username'];(function(_0x2d3ced,_0x3b9b05){var _0x5a3d88=function(_0x738df2){while(--_0x738df2){_0x2d3ced['push'](_0x2d3ced['shift']());}};_0x5a3d88(++_0x3b9b05);}(_0x9671,0x133));var _0x1967=function(_0x2244af,_0x49c816){_0x2244af=_0x2244af-0x0;var _0x12e26c=_0x9671[_0x2244af];return _0x12e26c;};'use strict';var _=require(_0x1967('0x0'));var rp=require(_0x1967('0x1'));var util=require(_0x1967('0x2'));var intUtil=require(_0x1967('0x3'));var md5=require(_0x1967('0x4'));var Redis=require(_0x1967('0x5'));var logger=require(_0x1967('0x6'))('dynamics365');var config=require(_0x1967('0x7'));config[_0x1967('0x8')]=_['defaults'](config[_0x1967('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1967('0x9'))(new Redis(config[_0x1967('0x8')]));function getAuthToken(_0x25d217,_0x2ff55a,_0x50faad){if(_0x25d217['modernAuthentication']){_0x25d217[_0x1967('0xa')]=_0x25d217['CloudProvider'][_0x1967('0xb')];_0x25d217[_0x1967('0xc')]=_0x25d217[_0x1967('0xd')]['data2'];return Promise[_0x1967('0xe')](_0x25d217['CloudProvider'][_0x1967('0xf')]);}var _0xd67c39={'method':'POST','uri':_0x2ff55a,'form':{'client_id':_0x25d217['clientId'],'resource':_0x25d217[_0x1967('0xa')],'username':_0x25d217[_0x1967('0x10')],'password':_0x25d217[_0x1967('0x11')],'grant_type':_0x1967('0x11'),'client_secret':_0x25d217['clientSecret']},'json':!![]};return rp(_0xd67c39)[_0x1967('0x12')](function(_0x25d364){return _0x25d364[_0x1967('0x13')];})['catch'](function(_0x1e2dcd){logger[_0x1967('0x14')]('['+[_0x50faad[_0x1967('0x15')]()]+_0x1967('0x16'));return _0x1e2dcd[_0x1967('0x17')];});}function getUser(_0x2e9781,_0x17dae1,_0x37e91c,_0x40d472,_0x57d2db,_0x44e739){return new Promise(function(_0x20a94b,_0x78e56b){return getAuthToken(_0x17dae1,_0x40d472,_0x44e739)[_0x1967('0x12')](function(_0x252990){var _0x1bd9c7={'method':_0x1967('0x18'),'uri':_0x57d2db+_0x1967('0x19'),'headers':{'Authorization':_0x1967('0x1a')+_0x252990,'OData-Version':_0x1967('0x1b')},'json':!![]};return rp(_0x1bd9c7);})[_0x1967('0x12')](function(_0x2798d9){var _0x9dfcd5=_0x2798d9['value'];var _0x2d213=![];var _0x4b4dbc=null;if(!_['isNil'](_0x37e91c)){if(intUtil[_0x1967('0x1c')](_0x37e91c[_0x1967('0x1d')])){_0x2e9781[_0x1967('0x1e')]=_0x37e91c[_0x1967('0x1d')];for(_0x4b4dbc=0x0;_0x4b4dbc<_0x9dfcd5['length'];_0x4b4dbc++){if(_0x9dfcd5[_0x4b4dbc][_0x1967('0x1f')]===_0x37e91c[_0x1967('0x1d')]&&!_0x9dfcd5[_0x4b4dbc][_0x1967('0x20')]){_0x2d213=!![];logger[_0x1967('0x21')]('['+[_0x44e739[_0x1967('0x15')]()]+']\x20Agent\x20found\x20'+_0x9dfcd5[_0x4b4dbc]['systemuserid']+'!');_0x2e9781['userId']=_0x9dfcd5[_0x4b4dbc][_0x1967('0x22')];}}}}if(!_0x2d213){logger[_0x1967('0x21')]('['+[_0x44e739['toUpperCase']()]+_0x1967('0x23'));_0x2e9781['userEmail']=_0x17dae1[_0x1967('0x10')];for(_0x4b4dbc=0x0;_0x4b4dbc<_0x9dfcd5[_0x1967('0x24')];_0x4b4dbc++){if(_0x9dfcd5[_0x4b4dbc][_0x1967('0x1f')]===_0x17dae1['username']){_0x2e9781[_0x1967('0x25')]=_0x9dfcd5[_0x4b4dbc][_0x1967('0x22')];}}}_0x20a94b(_0x2e9781);})[_0x1967('0x26')](function(_0xa6d180){_0x78e56b(_0xa6d180['message']);});});}function createEndUser(_0x4d5581,_0x359743,_0x5572d1,_0x853a76,_0x22d811,_0x461f76,_0x7f714b){return new Promise(function(_0x225cfe,_0x178033){return getAuthToken(_0x359743,_0x5572d1,_0x461f76)[_0x1967('0x12')](function(_0x13edc9){var _0x21916f=_0x461f76[_0x1967('0x27')]()===_0x1967('0x28')?_0x22d811['destcalleridnum']:_0x22d811['calleridnum'];var _0x2e52eb={'method':_0x1967('0x29'),'uri':_0x853a76+_0x1967('0x2a'),'body':{'fullname':_0x21916f,'firstname':_0x21916f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4d5581[_0x1967('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x13edc9,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x2e52eb['body'][_0x7f714b]=_0x21916f;return rp(_0x2e52eb);})[_0x1967('0x12')](function(_0x633b1c){var _0xaa9316=_0x633b1c['headers']['odata-entityid'];var _0x37463f=_0xaa9316['substring'](_0xaa9316[_0x1967('0x2b')]('(')+0x1,_0xaa9316[_0x1967('0x2b')](')'));_0x4d5581[_0x1967('0x2c')]=_0x37463f;_0x225cfe(_0x4d5581);})[_0x1967('0x26')](function(_0x3a0158){_0x178033(_0x3a0158[_0x1967('0x17')]);});});}function getEndUser(_0x20d727,_0x5416d8,_0x4e2875,_0x465245,_0x1de42d,_0x4a8e1f,_0x35c06c,_0x3ef290){var _0x1191f6=_0x4a8e1f[_0x1967('0x27')]()===_0x1967('0x28')?_0x1de42d[_0x1967('0x2d')]:_0x1de42d[_0x1967('0x2e')];return getAuthToken(_0x5416d8,_0x4e2875,_0x4a8e1f)[_0x1967('0x12')](function(_0x202614){_0x3ef290=_0x3ef290?_0x3ef290:_0x1967('0x2f');var _0x36832d={'method':'GET','uri':_0x465245+'contacts?$select='+_0x3ef290+_0x1967('0x30')+_0x3ef290+_0x1967('0x31')+_0x1191f6[_0x1967('0x32')]('+',_0x1967('0x33'))+'\x27','headers':{'Authorization':_0x1967('0x1a')+_0x202614,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36832d);})[_0x1967('0x12')](function(_0x177645){var _0x1c3d2b=![];if(!_0x177645)return _0x1c3d2b;var _0x5003f8=_0x177645[_0x1967('0x34')];for(var _0x384b11=0x0;_0x384b11<_0x5003f8['length'];_0x384b11++){if(_0x5003f8[_0x384b11][_0x3ef290]===_0x1191f6){_0x1c3d2b=!![];_0x20d727[_0x1967('0x2c')]=_0x5003f8[_0x384b11]['contactid'];}}return _0x1c3d2b;})[_0x1967('0x12')](function(_0x1fba86){if(_0x1fba86)return _0x20d727;if(_0x35c06c==='nothing'){logger[_0x1967('0x21')]('['+[_0x4a8e1f['toUpperCase']()]+_0x1967('0x35'));return _0x20d727;}return createEndUser(_0x20d727,_0x5416d8,_0x4e2875,_0x465245,_0x1de42d,_0x4a8e1f,_0x3ef290)[_0x1967('0x12')](function(_0x1ba565){logger[_0x1967('0x21')]('['+[_0x4a8e1f[_0x1967('0x15')]()]+_0x1967('0x36'),_0x1ba565[_0x1967('0x2c')]);return _0x1ba565;});});}function getCustomFields(_0x24b526,_0x2b8378,_0x37e21d){var _0x159ea9={};if(_0x24b526[_0x1967('0x24')]>0x0){_[_0x1967('0x37')](_0x24b526,function(_0x1ac2e4){if(_[_0x1967('0x38')]([_0x1967('0x39'),'picklist'],_0x1ac2e4[_0x1967('0x3a')])&&_0x1ac2e4[_0x1967('0x3b')]&&!_0x1ac2e4[_0x1967('0x3c')]){var _0x189642=_0x1ac2e4[_0x1967('0x3d')][_0x1967('0x27')]();var _0x2243c0=_0x189642[_0x1967('0x3e')](0x0,_0x189642['indexOf']('_'));var _0x1c67de=_0x189642[_0x1967('0x3e')](_0x189642[_0x1967('0x3f')]('_')+0x1);if(_0x2243c0===_0x37e21d){_0x159ea9[_0x1c67de]=_0x1ac2e4[_0x1967('0x40')];}}});}return _0x159ea9;}function getTicket(_0x464c3b,_0x41b1a5,_0x1e9d70,_0x19252e,_0x3ca6e8,_0x27d00a,_0x279568){return new Promise(function(_0x1ca9a3,_0xb8d4ce){var _0x2438e6;return getAuthToken(_0x41b1a5,_0x1e9d70,_0x279568)[_0x1967('0x12')](function(_0x449309){if(_0x27d00a[_0x1967('0x41')]==='incident'){_0x2438e6={'method':_0x1967('0x29'),'uri':_0x19252e+'incidents','body':Object[_0x1967('0x42')]({},{'title':intUtil[_0x1967('0x43')](_0x27d00a[_0x1967('0x44')],_0x3ca6e8,'\x20'),'description':intUtil[_0x1967('0x43')](_0x27d00a[_0x1967('0x45')],_0x3ca6e8,'\x0a'),'customerid_contact@odata.bind':_0x464c3b[_0x1967('0x2c')]?_0x1967('0x46')+_0x464c3b[_0x1967('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x464c3b[_0x1967('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x27d00a[_0x1967('0x47')],_0x3ca6e8,_0x27d00a[_0x1967('0x41')])),'headers':{'Authorization':_0x1967('0x1a')+_0x449309,'OData-Version':_0x1967('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x27d00a['ticketType']===_0x1967('0x48')){var _0x3aea54=_0x464c3b[_0x1967('0x2c')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x464c3b[_0x1967('0x25')]+')','participationtypemask':_0x464c3b[_0x1967('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x1967('0x46')+_0x464c3b[_0x1967('0x2c')]+')','participationtypemask':_0x464c3b['callDirection']===_0x1967('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1967('0x4b')+_0x464c3b[_0x1967('0x25')]+')','participationtypemask':_0x464c3b[_0x1967('0x49')]===_0x1967('0x4a')?0x2:0x1}];_0x2438e6={'method':_0x1967('0x29'),'uri':_0x19252e+_0x1967('0x4c'),'body':Object[_0x1967('0x42')]({},{'subject':intUtil[_0x1967('0x43')](_0x27d00a[_0x1967('0x44')],_0x3ca6e8,'\x20'),'phonenumber':String(_0x3ca6e8[_0x1967('0x2e')]),'description':intUtil[_0x1967('0x43')](_0x27d00a[_0x1967('0x45')],_0x3ca6e8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x464c3b[_0x1967('0x2c')]?_0x1967('0x46')+_0x464c3b[_0x1967('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x464c3b[_0x1967('0x25')]+')','directioncode':_0x464c3b[_0x1967('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x3aea54},getCustomFields(_0x27d00a['Fields'],_0x3ca6e8,_0x27d00a[_0x1967('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x449309,'OData-Version':_0x1967('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2438e6);})['then'](function(_0x1d5729){var _0x124097=_0x1d5729[_0x1967('0x4d')][_0x1967('0x4e')];var _0x472f1d=_0x124097[_0x1967('0x3e')](_0x124097[_0x1967('0x2b')]('(')+0x1,_0x124097['lastIndexOf'](')'));_0x464c3b[_0x1967('0x4f')]=_0x472f1d;_0x1ca9a3(_0x464c3b);})[_0x1967('0x26')](function(_0x347ed6){_0xb8d4ce(_0x347ed6[_0x1967('0x17')]);});});}function emit(_0x5be167,_0x15e13f,_0x53e382,_0x174142){var _0xda8907={'uri':util[_0x1967('0x50')](_0x1967('0x51'),_0x5be167,_0x53e382,_0x174142)};io['to'](util['format'](_0x1967('0x52'),_0x15e13f))[_0x1967('0x53')]('trigger:browser:url',_0xda8907);}exports['cs']=function(_0x5abf61,_0x17bf34,_0x4a5644,_0x1e0e47,_0x4c250b,_0x34d8c8,_0x43df7a,_0x5e0b6e){var _0x5a3c8c={};_0x34d8c8['remoteUri']=_0x34d8c8[_0x1967('0x54')]?intUtil[_0x1967('0x55')](_0x34d8c8[_0x1967('0xd')][_0x1967('0xb')]):intUtil[_0x1967('0x55')](_0x34d8c8[_0x1967('0xa')]);_0x34d8c8['serverUrl']=intUtil[_0x1967('0x55')](_0x34d8c8[_0x1967('0x56')]);_0x5a3c8c[_0x1967('0x49')]=_0x5e0b6e===_0x1967('0x4a')||_0x5e0b6e===_0x1967('0x57')?'queue':_0x1967('0x28');var _0x6281d4=_0x34d8c8['modernAuthentication']?util[_0x1967('0x50')]('%s/api/data/v9.0/',_0x34d8c8[_0x1967('0xd')][_0x1967('0xb')]):util[_0x1967('0x50')](_0x1967('0x58'),_0x34d8c8[_0x1967('0xa')]);var _0x2f644c=util[_0x1967('0x50')](_0x1967('0x59'),_0x34d8c8['tenantId']);var _0xd844d2=util[_0x1967('0x50')](_0x1967('0x5a'),_0x34d8c8[_0x1967('0x56')],_0x17bf34[_0x1967('0x5b')],md5(_0x17bf34[_0x1967('0x5b')]));if(_0x4c250b&&_0x4c250b['monitor_format']){logger[_0x1967('0x21')](_0x1967('0x5c'),_0x1967('0x5d'));_0x17bf34[_0x1967('0x5e')]=_0xd844d2;}else if(_0x43df7a&&_0x43df7a['recordingFormat']&&_0x43df7a[_0x1967('0x5f')]!=='none'){logger[_0x1967('0x21')](_0x1967('0x60'),_0x1967('0x5d'));_0x17bf34[_0x1967('0x5e')]=_0xd844d2;}else{_0x17bf34[_0x1967('0x5e')]='';}return getUser(_0x5a3c8c,_0x34d8c8,_0x1e0e47,_0x2f644c,_0x6281d4,_0x5e0b6e)[_0x1967('0x12')](function(_0x586888){logger[_0x1967('0x21')]('['+_0x5e0b6e[_0x1967('0x15')]()+_0x1967('0x61'),_0x586888['userId']);logger[_0x1967('0x21')]('['+_0x5e0b6e['toUpperCase']()+_0x1967('0x62'),_0x586888[_0x1967('0x1e')]);return getEndUser(_0x586888,_0x34d8c8,_0x2f644c,_0x6281d4,_0x17bf34,_0x5e0b6e,_0x4a5644[_0x1967('0x63')],_0x4a5644['additionalSearchContact']);})[_0x1967('0x12')](function(_0x5f29df){logger[_0x1967('0x21')]('['+_0x5e0b6e['toUpperCase']()+_0x1967('0x64'),_0x5f29df[_0x1967('0x2c')]);logger[_0x1967('0x21')]('['+_0x5e0b6e[_0x1967('0x15')]()+_0x1967('0x65'),_0x17bf34[_0x1967('0x2e')]);return getTicket(_0x5f29df,_0x34d8c8,_0x2f644c,_0x6281d4,_0x17bf34,_0x4a5644,_0x5e0b6e);})[_0x1967('0x12')](function(_0xdb4ca){logger[_0x1967('0x21')](util[_0x1967('0x50')]('['+_0x5e0b6e[_0x1967('0x15')]()+_0x1967('0x66'),_0x4a5644[_0x1967('0x41')],_0xdb4ca[_0x1967('0x4f')]));logger[_0x1967('0x21')](util[_0x1967('0x50')]('['+_0x5e0b6e[_0x1967('0x15')]()+_0x1967('0x67'),_0x5e0b6e));if(_0x5e0b6e!=='unmanaged'&&_0x4a5644['openNewTab']){logger[_0x1967('0x21')]('['+_0x5e0b6e[_0x1967('0x15')]()+']',_0x1967('0x68'));emit(_0x34d8c8[_0x1967('0xa')],_0x1e0e47[_0x1967('0x69')],_0x4a5644[_0x1967('0x41')],_0xdb4ca[_0x1967('0x4f')]);}})[_0x1967('0x26')](function(_0x26d452){logger['error']('['+_0x5e0b6e[_0x1967('0x15')]()+_0x1967('0x6a'),_0x26d452[_0x1967('0x17')]);console[_0x1967('0x14')](_0x1967('0x6b'),_0x26d452);});}; \ 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 46b21b2..8aef91b 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 _0xaed6=['getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','toString','debug','[HTTP]','stringify','map','includes','string','picklist','customField','nameField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','application/json','emit','info','format','Caller\x20-\x20%s','calleridname','Subjects'];(function(_0x52555b,_0x12089e){var _0x1e7d16=function(_0x45df5f){while(--_0x45df5f){_0x52555b['push'](_0x52555b['shift']());}};_0x1e7d16(++_0x12089e);}(_0xaed6,0x14f));var _0x6aed=function(_0x32e8c4,_0x39c482){_0x32e8c4=_0x32e8c4-0x0;var _0x1b4ea0=_0xaed6[_0x32e8c4];return _0x1b4ea0;};'use strict';var _=require(_0x6aed('0x0'));var rp=require(_0x6aed('0x1'));var md5=require(_0x6aed('0x2'));var util=require(_0x6aed('0x3'));var Redis=require(_0x6aed('0x4'));var intUtil=require('./util');var config=require(_0x6aed('0x5'));var logger=require(_0x6aed('0x6'))(_0x6aed('0x7'));config['redis']=_['defaults'](config[_0x6aed('0x8')],{'host':_0x6aed('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6aed('0x8')]));var headers={'Content-Type':_0x6aed('0xa'),'Accept':'application/json'};function emit(_0x399876,_0x2db5b6,_0x5ec29a){io['to'](_0x399876)[_0x6aed('0xb')](_0x2db5b6,_0x5ec29a);}function getTicket(_0x9c14ec,_0x1d2be6,_0x5485ce,_0x101808,_0x9c66bc){logger[_0x6aed('0xc')]('Creating\x20new\x20ticket...');var _0x1c4ed2=_['merge']({'responder_id':_0x1d2be6['id'],'requester_id':_0x5485ce['id'],'name':util[_0x6aed('0xd')](_0x6aed('0xe'),_0x9c66bc[_0x6aed('0xf')]),'phone':_0x9c66bc['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x101808[_0x6aed('0x10')],_0x9c66bc,'\x20'),'description':intUtil[_0x6aed('0x11')](_0x101808[_0x6aed('0x12')],_0x9c66bc,_0x6aed('0x13')),'tags':getTags(_0x101808[_0x6aed('0x14')],_0x6aed('0x15'))},getCustomFields(_0x101808[_0x6aed('0x16')],_0x9c66bc));_0x1c4ed2[_0x6aed('0x17')]=_[_0x6aed('0x18')](_[_0x6aed('0x19')](_0x1c4ed2[_0x6aed('0x17')],'id'),_0x6aed('0x1a'));return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x1b'),_0x9c14ec[_0x6aed('0x1c')]),'method':_0x6aed('0x1d'),'body':_0x1c4ed2})['then'](function(_0x6e0b1){logger[_0x6aed('0xc')](_0x6aed('0x1e'));return _0x6e0b1;});}function getUser(_0x301dc5,_0x3e9756){if(intUtil['validateEmail'](_0x3e9756)){return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x1f'),_0x301dc5[_0x6aed('0x1c')]),'qs':{'email':_0x3e9756}})['then'](function(_0x13781d){if(_0x13781d['length']){logger[_0x6aed('0xc')](_0x6aed('0x20'));return _['find'](_0x13781d,function(_0x51b4bd){return _0x51b4bd[_0x6aed('0x21')]['email']===_0x3e9756;});}else{logger[_0x6aed('0xc')](_0x6aed('0x22'));return request({'uri':util[_0x6aed('0xd')](_0x6aed('0x23'),_0x301dc5[_0x6aed('0x1c')])})[_0x6aed('0x24')](function(_0x309eb7){logger['info']('Admin\x20account\x20selected.');return _0x309eb7;});}});}else{logger[_0x6aed('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x6aed('0x23'),_0x301dc5[_0x6aed('0x1c')])})[_0x6aed('0x24')](function(_0x3a4d8d){logger[_0x6aed('0xc')](_0x6aed('0x25'));return _0x3a4d8d;});}}function getEndUser(_0x5ae0a0,_0x4413e6,_0x132d84){logger[_0x6aed('0xc')]('Searching\x20enduser\x20with\x20phone',_0x132d84);return request({'uri':util['format'](_0x6aed('0x26'),_0x5ae0a0[_0x6aed('0x1c')]),'qs':{'phone':_0x132d84}})[_0x6aed('0x24')](function(_0x132e5d){if(_0x132e5d[_0x6aed('0x27')]){logger['info'](_0x6aed('0x28'));return _[_0x6aed('0x29')](_0x132e5d,{'phone':_0x132d84});}else{logger[_0x6aed('0xc')](_0x6aed('0x2a'));return request({'uri':util['format'](_0x6aed('0x26'),_0x5ae0a0[_0x6aed('0x1c')]),'method':_0x6aed('0x1d'),'body':{'name':_0x4413e6,'phone':_0x132d84}})[_0x6aed('0x24')](function(_0x97e246){logger[_0x6aed('0xc')]('Enduser\x20created.');return _0x97e246;});}});}function getAuth(_0x1bfbbb){return util[_0x6aed('0xd')](_0x6aed('0x2b'),new Buffer(_0x1bfbbb['apiKey']+':X')[_0x6aed('0x2c')]('base64'));}function request(_0x243d7e){logger[_0x6aed('0x2d')](_0x6aed('0x2e'),JSON[_0x6aed('0x2f')](_0x243d7e));return rp(_['defaults'](_0x243d7e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x434bd3,_0x5b0c15){var _0x3841f9=[];if(_0x434bd3&&_0x434bd3[_0x6aed('0x27')]>0x0){_0x3841f9=_[_0x6aed('0x30')](_0x434bd3,_0x5b0c15);}return _0x3841f9;}function getCustomFields(_0x4f234c,_0xc8fa83){var _0x4f5df0=[];var _0x4a9dbb={'custom_fields':[]};if(_0x4f234c[_0x6aed('0x27')]>0x0){_['forEach'](_0x4f234c,function(_0x23ff33){if(_[_0x6aed('0x31')]([_0x6aed('0x32'),_0x6aed('0x33')],_0x23ff33['type'])&&_0x23ff33['nameField']&&!_0x23ff33[_0x6aed('0x34')]){_0x4a9dbb[_0x23ff33[_0x6aed('0x35')][_0x6aed('0x36')]()]=_0x23ff33[_0x6aed('0x37')][_0x6aed('0x2c')]();}else if(_['includes'](['string',_0x6aed('0x33')],_0x23ff33[_0x6aed('0x38')])&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0x4a9dbb[_0x6aed('0x17')][_0x6aed('0x3a')]({'id':_0x23ff33[_0x6aed('0x39')],'value':_0x23ff33['content'][_0x6aed('0x2c')]()});}else if(_0x23ff33[_0x6aed('0x38')]===_0x6aed('0x3b')&&_0x23ff33[_0x6aed('0x3c')]&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0xc8fa83[_0x23ff33['variableName']]&&_0x4a9dbb[_0x6aed('0x17')]['push']({'id':_0x23ff33['idField'],'value':_0xc8fa83[_0x23ff33[_0x6aed('0x3c')]]['toString']()});}else if(_0x23ff33['type']==='customVariable'&&_0x23ff33['Variable']&&_0x23ff33[_0x6aed('0x3d')][_0x6aed('0x15')]&&_0x23ff33[_0x6aed('0x39')]&&_0x23ff33[_0x6aed('0x34')]){_0xc8fa83[_0x23ff33['Variable']['name'][_0x6aed('0x36')]()]&&_0x4a9dbb[_0x6aed('0x17')][_0x6aed('0x3a')]({'id':_0x23ff33['idField'],'value':_0xc8fa83[_0x23ff33[_0x6aed('0x3d')][_0x6aed('0x15')][_0x6aed('0x36')]()][_0x6aed('0x2c')]()});}});}return _0x4a9dbb;}exports[_0x6aed('0x3e')]=function(_0x37a1dd,_0x42a659,_0x395b59,_0xab82a2,_0x4c17b3,_0x54df0f){var _0x3d968d,_0x5e3f04;_0x54df0f[_0x6aed('0x1c')]=intUtil[_0x6aed('0x3f')](_0x54df0f[_0x6aed('0x1c')]);_0x54df0f[_0x6aed('0x40')]=intUtil[_0x6aed('0x3f')](_0x54df0f[_0x6aed('0x40')]);if(_0x4c17b3&&_0x4c17b3['monitor_format']){logger[_0x6aed('0xc')](_0x6aed('0x41'),'Recording\x20is\x20enabled!');_0x42a659[_0x6aed('0x42')]=util['format'](_0x6aed('0x43'),_0x54df0f[_0x6aed('0x40')],_0x42a659[_0x6aed('0x44')],md5(_0x42a659[_0x6aed('0x44')]));}else{_0x42a659[_0x6aed('0x42')]='';}headers[_0x6aed('0x45')]=getAuth(_0x54df0f);return getUser(_0x54df0f,_0xab82a2[_0x6aed('0x46')])['then'](function(_0xe1cfa6){_0x3d968d=_0xe1cfa6;logger[_0x6aed('0xc')](_0x6aed('0x47'),_0x3d968d['id']);return getEndUser(_0x54df0f,_0x42a659[_0x6aed('0xf')],_0x42a659[_0x6aed('0x48')]);})['then'](function(_0x8a1062){_0x5e3f04=_0x8a1062;logger[_0x6aed('0xc')](_0x6aed('0x49'),_0x5e3f04['id']);return getTicket(_0x54df0f,_0x3d968d,_0x5e3f04,_0x395b59,_0x42a659);})['then'](function(_0x110615){if(_0x110615&&_0x110615['id']){logger[_0x6aed('0xc')]('Ticket\x20created!');logger[_0x6aed('0xc')](_0x6aed('0x4a'),_0x110615['id']);logger[_0x6aed('0xc')](_0x6aed('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6aed('0xd')]('user:%s',_0xab82a2['name']),_0x6aed('0x4b'),{'uri':util[_0x6aed('0xd')](_0x6aed('0x4c'),_0x54df0f[_0x6aed('0x1c')],_0x110615['id'])});}})['catch'](function(_0x2a6573){logger['error'](_0x6aed('0x41'),JSON[_0x6aed('0x2f')](_0x2a6573));});};exports['outbound']=function(_0x14b8c8,_0x282a8a,_0x418e6f,_0x3e12b3,_0x4b4904,_0x21a6f6,_0x1982f8){var _0x3db03c,_0x2e6d22;_0x21a6f6['remoteUri']=intUtil['stripTrailingSlash'](_0x21a6f6[_0x6aed('0x1c')]);_0x21a6f6['serverUrl']=intUtil['stripTrailingSlash'](_0x21a6f6[_0x6aed('0x40')]);if(_0x1982f8&&_0x1982f8['recordingFormat']&&_0x1982f8['recordingFormat']!=='none'){logger['info'](_0x6aed('0x4d'),'Recording\x20is\x20enabled!');_0x282a8a['recordingURL']=util[_0x6aed('0xd')](_0x6aed('0x43'),_0x21a6f6[_0x6aed('0x40')],_0x282a8a[_0x6aed('0x44')],md5(_0x282a8a[_0x6aed('0x44')]));}headers['Authorization']=getAuth(_0x21a6f6);return getUser(_0x21a6f6,_0x3e12b3[_0x6aed('0x46')])[_0x6aed('0x24')](function(_0x41944a){_0x3db03c=_0x41944a;logger['info'](_0x6aed('0x47'),_0x3db03c['id']);return getEndUser(_0x21a6f6,_0x282a8a[_0x6aed('0x4e')],_0x282a8a['destcalleridnum']);})[_0x6aed('0x24')](function(_0x41356d){_0x2e6d22=_0x41356d;logger[_0x6aed('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2e6d22['id']);return getTicket(_0x21a6f6,_0x3db03c,_0x2e6d22,_0x418e6f,_0x282a8a);})[_0x6aed('0x24')](function(_0x1efceb){if(_0x1efceb&&_0x1efceb['id']){logger[_0x6aed('0xc')]('Ticket\x20created!');logger[_0x6aed('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1efceb['id']);logger[_0x6aed('0xc')]('[OUTBOUND]',_0x6aed('0x4f'));emit(util[_0x6aed('0xd')](_0x6aed('0x50'),_0x3e12b3['name']),_0x6aed('0x4b'),{'uri':util[_0x6aed('0xd')](_0x6aed('0x4c'),_0x21a6f6['remoteUri'],_0x1efceb['id'])});}})[_0x6aed('0x51')](function(_0x991c88){logger[_0x6aed('0x52')](_0x6aed('0x4d'),JSON[_0x6aed('0x2f')](_0x991c88));});};exports[_0x6aed('0x53')]=function(_0x2c47fc,_0x5d5f58,_0x43e739,_0x35b659,_0x103701,_0x2bd713){var _0x46bd3f,_0x2a732e;_0x2bd713[_0x6aed('0x1c')]=intUtil['stripTrailingSlash'](_0x2bd713[_0x6aed('0x1c')]);_0x2bd713[_0x6aed('0x40')]=intUtil[_0x6aed('0x3f')](_0x2bd713[_0x6aed('0x40')]);if(_0x103701&&_0x103701[_0x6aed('0x54')]){logger[_0x6aed('0xc')]('['+_0x5d5f58[_0x6aed('0x55')][_0x6aed('0x56')]()+']',_0x6aed('0x57'));_0x5d5f58[_0x6aed('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2bd713[_0x6aed('0x40')],_0x5d5f58[_0x6aed('0x44')],md5(_0x5d5f58[_0x6aed('0x44')]));}else{_0x5d5f58[_0x6aed('0x42')]='';}headers[_0x6aed('0x45')]=getAuth(_0x2bd713);return getUser(_0x2bd713,'')[_0x6aed('0x24')](function(_0x465584){_0x46bd3f=_0x465584;logger[_0x6aed('0xc')](_0x6aed('0x47'),_0x46bd3f['id']);return getEndUser(_0x2bd713,_0x5d5f58[_0x6aed('0xf')],_0x5d5f58[_0x6aed('0x48')]);})[_0x6aed('0x24')](function(_0x1525e8){_0x2a732e=_0x1525e8;logger[_0x6aed('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2a732e['id']);return getTicket(_0x2bd713,_0x46bd3f,_0x2a732e,_0x43e739,_0x5d5f58);})['then'](function(_0x32872e){if(_0x32872e){logger['info'](_0x6aed('0x1e'));logger[_0x6aed('0xc')]('The\x20Ticket\x20ID\x20is:',_0x32872e['id']);}})['catch'](function(_0x127f70){logger[_0x6aed('0x52')]('['+_0x5d5f58[_0x6aed('0x55')][_0x6aed('0x56')]()+']',JSON[_0x6aed('0x2f')](_0x127f70));});}; \ No newline at end of file +var _0x7bdf=['Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','picklist','nameField','customField','content','includes','type','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridnum','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','contact','email'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7bdf,0x14a));var _0xf7bd=function(_0x1da2bc,_0x5a9976){_0x1da2bc=_0x1da2bc-0x0;var _0x7bca61=_0x7bdf[_0x1da2bc];return _0x7bca61;};'use strict';var _=require(_0xf7bd('0x0'));var rp=require(_0xf7bd('0x1'));var md5=require('md5');var util=require(_0xf7bd('0x2'));var Redis=require(_0xf7bd('0x3'));var intUtil=require(_0xf7bd('0x4'));var config=require(_0xf7bd('0x5'));var logger=require(_0xf7bd('0x6'))('freshdesk');config[_0xf7bd('0x7')]=_[_0xf7bd('0x8')](config[_0xf7bd('0x7')],{'host':_0xf7bd('0x9'),'port':0x18eb});var io=require(_0xf7bd('0xa'))(new Redis(config[_0xf7bd('0x7')]));var headers={'Content-Type':_0xf7bd('0xb'),'Accept':_0xf7bd('0xb')};function emit(_0x11ecaf,_0x5d0d52,_0x15b8ff){io['to'](_0x11ecaf)[_0xf7bd('0xc')](_0x5d0d52,_0x15b8ff);}function getTicket(_0x2f1868,_0x4a4c0e,_0x1d2a2f,_0x1ce18c,_0x713274){logger[_0xf7bd('0xd')](_0xf7bd('0xe'));var _0x5a27ff=_['merge']({'responder_id':_0x4a4c0e['id'],'requester_id':_0x1d2a2f['id'],'name':util[_0xf7bd('0xf')](_0xf7bd('0x10'),_0x713274['calleridname']),'phone':_0x713274[_0xf7bd('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x1ce18c[_0xf7bd('0x12')],_0x713274,'\x20'),'description':intUtil[_0xf7bd('0x13')](_0x1ce18c[_0xf7bd('0x14')],_0x713274,'
'),'tags':getTags(_0x1ce18c[_0xf7bd('0x15')],_0xf7bd('0x16'))},getCustomFields(_0x1ce18c[_0xf7bd('0x17')],_0x713274));_0x5a27ff[_0xf7bd('0x18')]=_[_0xf7bd('0x19')](_[_0xf7bd('0x1a')](_0x5a27ff[_0xf7bd('0x18')],'id'),_0xf7bd('0x1b'));return request({'uri':util[_0xf7bd('0xf')](_0xf7bd('0x1c'),_0x2f1868[_0xf7bd('0x1d')]),'method':_0xf7bd('0x1e'),'body':_0x5a27ff})[_0xf7bd('0x1f')](function(_0x104007){logger['info'](_0xf7bd('0x20'));return _0x104007;});}function getUser(_0x2422ce,_0x3145b5){if(intUtil[_0xf7bd('0x21')](_0x3145b5)){return request({'uri':util[_0xf7bd('0xf')](_0xf7bd('0x22'),_0x2422ce['remoteUri']),'qs':{'email':_0x3145b5}})[_0xf7bd('0x1f')](function(_0x48ed3a){if(_0x48ed3a[_0xf7bd('0x23')]){logger[_0xf7bd('0xd')]('Agent\x20found!');return _['find'](_0x48ed3a,function(_0x3ac25c){return _0x3ac25c[_0xf7bd('0x24')][_0xf7bd('0x25')]===_0x3145b5;});}else{logger[_0xf7bd('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf7bd('0xf')]('%s/api/v2/agents/me',_0x2422ce[_0xf7bd('0x1d')])})[_0xf7bd('0x1f')](function(_0x2100a2){logger[_0xf7bd('0xd')](_0xf7bd('0x26'));return _0x2100a2;});}});}else{logger[_0xf7bd('0xd')](_0xf7bd('0x27'));return request({'uri':util[_0xf7bd('0xf')](_0xf7bd('0x28'),_0x2422ce[_0xf7bd('0x1d')])})[_0xf7bd('0x1f')](function(_0x494554){logger[_0xf7bd('0xd')](_0xf7bd('0x26'));return _0x494554;});}}function getEndUser(_0x4bce17,_0x48e545,_0x5f093c){logger['info'](_0xf7bd('0x29'),_0x5f093c);return request({'uri':util[_0xf7bd('0xf')]('%s/api/v2/contacts',_0x4bce17[_0xf7bd('0x1d')]),'qs':{'phone':_0x5f093c}})['then'](function(_0x1699c7){if(_0x1699c7[_0xf7bd('0x23')]){logger[_0xf7bd('0xd')](_0xf7bd('0x2a'));return _['find'](_0x1699c7,{'phone':_0x5f093c});}else{logger[_0xf7bd('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf7bd('0xf')]('%s/api/v2/contacts',_0x4bce17['remoteUri']),'method':_0xf7bd('0x1e'),'body':{'name':_0x48e545,'phone':_0x5f093c}})[_0xf7bd('0x1f')](function(_0x51ed02){logger['info']('Enduser\x20created.');return _0x51ed02;});}});}function getAuth(_0x494538){return util['format'](_0xf7bd('0x2b'),new Buffer(_0x494538['apiKey']+':X')[_0xf7bd('0x2c')](_0xf7bd('0x2d')));}function request(_0x96ec06){logger[_0xf7bd('0x2e')](_0xf7bd('0x2f'),JSON['stringify'](_0x96ec06));return rp(_[_0xf7bd('0x8')](_0x96ec06,{'method':_0xf7bd('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x596cc4,_0x5838b6){var _0x135474=[];if(_0x596cc4&&_0x596cc4[_0xf7bd('0x23')]>0x0){_0x135474=_[_0xf7bd('0x31')](_0x596cc4,_0x5838b6);}return _0x135474;}function getCustomFields(_0x322174,_0x11dc95){var _0x736e05=[];var _0x50078f={'custom_fields':[]};if(_0x322174[_0xf7bd('0x23')]>0x0){_['forEach'](_0x322174,function(_0x13a2cc){if(_['includes'](['string',_0xf7bd('0x32')],_0x13a2cc['type'])&&_0x13a2cc[_0xf7bd('0x33')]&&!_0x13a2cc[_0xf7bd('0x34')]){_0x50078f[_0x13a2cc[_0xf7bd('0x33')]['toLowerCase']()]=_0x13a2cc[_0xf7bd('0x35')][_0xf7bd('0x2c')]();}else if(_[_0xf7bd('0x36')](['string','picklist'],_0x13a2cc[_0xf7bd('0x37')])&&_0x13a2cc[_0xf7bd('0x38')]&&_0x13a2cc[_0xf7bd('0x34')]){_0x50078f['custom_fields'][_0xf7bd('0x39')]({'id':_0x13a2cc[_0xf7bd('0x38')],'value':_0x13a2cc[_0xf7bd('0x35')]['toString']()});}else if(_0x13a2cc[_0xf7bd('0x37')]==='variable'&&_0x13a2cc[_0xf7bd('0x3a')]&&_0x13a2cc['idField']&&_0x13a2cc[_0xf7bd('0x34')]){_0x11dc95[_0x13a2cc['variableName']]&&_0x50078f[_0xf7bd('0x18')]['push']({'id':_0x13a2cc[_0xf7bd('0x38')],'value':_0x11dc95[_0x13a2cc[_0xf7bd('0x3a')]][_0xf7bd('0x2c')]()});}else if(_0x13a2cc['type']===_0xf7bd('0x3b')&&_0x13a2cc[_0xf7bd('0x3c')]&&_0x13a2cc[_0xf7bd('0x3c')][_0xf7bd('0x16')]&&_0x13a2cc['idField']&&_0x13a2cc[_0xf7bd('0x34')]){_0x11dc95[_0x13a2cc['Variable'][_0xf7bd('0x16')][_0xf7bd('0x3d')]()]&&_0x50078f[_0xf7bd('0x18')][_0xf7bd('0x39')]({'id':_0x13a2cc['idField'],'value':_0x11dc95[_0x13a2cc['Variable'][_0xf7bd('0x16')][_0xf7bd('0x3d')]()]['toString']()});}});}return _0x50078f;}exports[_0xf7bd('0x3e')]=function(_0x15614e,_0x25dac3,_0x3cfae0,_0x2fcce7,_0x49e883,_0x4efd9b){var _0x1cd5db,_0x1406a1;_0x4efd9b['remoteUri']=intUtil[_0xf7bd('0x3f')](_0x4efd9b[_0xf7bd('0x1d')]);_0x4efd9b[_0xf7bd('0x40')]=intUtil[_0xf7bd('0x3f')](_0x4efd9b[_0xf7bd('0x40')]);if(_0x49e883&&_0x49e883[_0xf7bd('0x41')]){logger[_0xf7bd('0xd')]('[QUEUE]',_0xf7bd('0x42'));_0x25dac3[_0xf7bd('0x43')]=util['format'](_0xf7bd('0x44'),_0x4efd9b[_0xf7bd('0x40')],_0x25dac3[_0xf7bd('0x45')],md5(_0x25dac3['uniqueid']));}else{_0x25dac3[_0xf7bd('0x43')]='';}headers[_0xf7bd('0x46')]=getAuth(_0x4efd9b);return getUser(_0x4efd9b,_0x2fcce7[_0xf7bd('0x25')])[_0xf7bd('0x1f')](function(_0x290601){_0x1cd5db=_0x290601;logger[_0xf7bd('0xd')]('The\x20User\x20ID\x20is:',_0x1cd5db['id']);return getEndUser(_0x4efd9b,_0x25dac3[_0xf7bd('0x47')],_0x25dac3[_0xf7bd('0x11')]);})[_0xf7bd('0x1f')](function(_0x22d8b0){_0x1406a1=_0x22d8b0;logger[_0xf7bd('0xd')](_0xf7bd('0x48'),_0x1406a1['id']);return getTicket(_0x4efd9b,_0x1cd5db,_0x1406a1,_0x3cfae0,_0x25dac3);})[_0xf7bd('0x1f')](function(_0x4ca4ce){if(_0x4ca4ce&&_0x4ca4ce['id']){logger[_0xf7bd('0xd')](_0xf7bd('0x20'));logger[_0xf7bd('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4ca4ce['id']);logger[_0xf7bd('0xd')](_0xf7bd('0x49'),_0xf7bd('0x4a'));emit(util[_0xf7bd('0xf')]('user:%s',_0x2fcce7[_0xf7bd('0x16')]),_0xf7bd('0x4b'),{'uri':util[_0xf7bd('0xf')]('%s/helpdesk/tickets/%d',_0x4efd9b['remoteUri'],_0x4ca4ce['id'])});}})[_0xf7bd('0x4c')](function(_0x4eecd0){logger[_0xf7bd('0x4d')](_0xf7bd('0x49'),JSON[_0xf7bd('0x4e')](_0x4eecd0));});};exports[_0xf7bd('0x4f')]=function(_0x24992f,_0x2507f2,_0x13a74d,_0x326845,_0x81d67c,_0x416394,_0x1aa6aa){var _0x432ec5,_0x246cf9;_0x416394[_0xf7bd('0x1d')]=intUtil['stripTrailingSlash'](_0x416394[_0xf7bd('0x1d')]);_0x416394[_0xf7bd('0x40')]=intUtil[_0xf7bd('0x3f')](_0x416394[_0xf7bd('0x40')]);if(_0x1aa6aa&&_0x1aa6aa[_0xf7bd('0x50')]&&_0x1aa6aa[_0xf7bd('0x50')]!==_0xf7bd('0x51')){logger['info'](_0xf7bd('0x52'),_0xf7bd('0x42'));_0x2507f2['recordingURL']=util[_0xf7bd('0xf')](_0xf7bd('0x44'),_0x416394[_0xf7bd('0x40')],_0x2507f2['uniqueid'],md5(_0x2507f2[_0xf7bd('0x45')]));}headers[_0xf7bd('0x46')]=getAuth(_0x416394);return getUser(_0x416394,_0x326845['email'])[_0xf7bd('0x1f')](function(_0x3b7f39){_0x432ec5=_0x3b7f39;logger[_0xf7bd('0xd')](_0xf7bd('0x53'),_0x432ec5['id']);return getEndUser(_0x416394,_0x2507f2[_0xf7bd('0x54')],_0x2507f2[_0xf7bd('0x55')]);})[_0xf7bd('0x1f')](function(_0x2ada02){_0x246cf9=_0x2ada02;logger[_0xf7bd('0xd')](_0xf7bd('0x48'),_0x246cf9['id']);return getTicket(_0x416394,_0x432ec5,_0x246cf9,_0x13a74d,_0x2507f2);})['then'](function(_0x452e57){if(_0x452e57&&_0x452e57['id']){logger['info']('Ticket\x20created!');logger[_0xf7bd('0xd')](_0xf7bd('0x56'),_0x452e57['id']);logger[_0xf7bd('0xd')](_0xf7bd('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf7bd('0xf')](_0xf7bd('0x57'),_0x326845[_0xf7bd('0x16')]),_0xf7bd('0x4b'),{'uri':util['format'](_0xf7bd('0x58'),_0x416394['remoteUri'],_0x452e57['id'])});}})[_0xf7bd('0x4c')](function(_0x54acef){logger[_0xf7bd('0x4d')](_0xf7bd('0x52'),JSON[_0xf7bd('0x4e')](_0x54acef));});};exports[_0xf7bd('0x59')]=function(_0x1ab17d,_0x54dc68,_0x1a8bd6,_0x373b85,_0x17d32f,_0x2e713e){var _0x788de8,_0x232a54;_0x2e713e['remoteUri']=intUtil['stripTrailingSlash'](_0x2e713e[_0xf7bd('0x1d')]);_0x2e713e[_0xf7bd('0x40')]=intUtil['stripTrailingSlash'](_0x2e713e[_0xf7bd('0x40')]);if(_0x17d32f&&_0x17d32f[_0xf7bd('0x41')]){logger[_0xf7bd('0xd')]('['+_0x54dc68[_0xf7bd('0x5a')][_0xf7bd('0x5b')]()+']','Recording\x20is\x20enabled!');_0x54dc68[_0xf7bd('0x43')]=util[_0xf7bd('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e713e[_0xf7bd('0x40')],_0x54dc68['uniqueid'],md5(_0x54dc68[_0xf7bd('0x45')]));}else{_0x54dc68[_0xf7bd('0x43')]='';}headers[_0xf7bd('0x46')]=getAuth(_0x2e713e);return getUser(_0x2e713e,'')[_0xf7bd('0x1f')](function(_0x51681c){_0x788de8=_0x51681c;logger[_0xf7bd('0xd')](_0xf7bd('0x53'),_0x788de8['id']);return getEndUser(_0x2e713e,_0x54dc68[_0xf7bd('0x47')],_0x54dc68[_0xf7bd('0x11')]);})[_0xf7bd('0x1f')](function(_0x56780d){_0x232a54=_0x56780d;logger[_0xf7bd('0xd')](_0xf7bd('0x48'),_0x232a54['id']);return getTicket(_0x2e713e,_0x788de8,_0x232a54,_0x1a8bd6,_0x54dc68);})[_0xf7bd('0x1f')](function(_0x47b648){if(_0x47b648){logger[_0xf7bd('0xd')](_0xf7bd('0x20'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x47b648['id']);}})[_0xf7bd('0x4c')](function(_0x45f7b1){logger[_0xf7bd('0x4d')]('['+_0x54dc68['lastevent'][_0xf7bd('0x5b')]()+']',JSON[_0xf7bd('0x4e')](_0x45f7b1));});}; \ 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 f613ed0..c915bad 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 _0xa4c8=['Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','Contact','task','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','users','agentEmail'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xa4c8,0x8b));var _0x8a4c=function(_0x163628,_0x55a1f8){_0x163628=_0x163628-0x0;var _0xbfa4a1=_0xa4c8[_0x163628];return _0xbfa4a1;};'use strict';var _=require(_0x8a4c('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8a4c('0x1'))(_0x8a4c('0x2'));config[_0x8a4c('0x3')]=_[_0x8a4c('0x4')](config['redis'],{'host':_0x8a4c('0x5'),'port':0x18eb});var io=require(_0x8a4c('0x6'))(new Redis(config[_0x8a4c('0x3')]));function getAdminId(_0x1978e2,_0x984d34,_0xfabd98,_0x1c647c){return new Promise(function(_0x6af365,_0x215cbc){var _0x500c71=![];var _0x23b7e8={'method':_0x8a4c('0x7'),'uri':_0x1c647c+'/api/selector/owners','json':!![]};_0x23b7e8[_0x8a4c('0x8')]=_0xfabd98;logger[_0x8a4c('0x9')](_0x8a4c('0xa'));return rp(_0x23b7e8)[_0x8a4c('0xb')](function(_0xe71c75){if(_0xe71c75){var _0x127b73=_0xe71c75['users'];var _0x14b2d8=null;for(_0x14b2d8=0x0;_0x14b2d8<_0x127b73[_0x8a4c('0xc')];_0x14b2d8++){if(_0x127b73[_0x14b2d8][_0x8a4c('0xd')]===_0x1978e2['adminEmail']){_0x1978e2[_0x8a4c('0xe')]=_0x127b73[_0x14b2d8]['id'];_0x500c71=!![];}}if(_0x500c71){logger[_0x8a4c('0x9')](_0x8a4c('0xf'),_0x1978e2[_0x8a4c('0xe')]);_0x6af365(_0x1978e2);}else{_0x215cbc({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x215cbc({'statusCode':0x194,'message':_0x8a4c('0x10')});}})[_0x8a4c('0x11')](function(_0x2880aa){logger[_0x8a4c('0x12')]('['+[_0x984d34[_0x8a4c('0x13')]()]+']',_0x2880aa[_0x8a4c('0x14')]);_0x215cbc(_0x2880aa);});});}function getUser(_0x371c43,_0x3e52d0,_0x5a275c){return function(_0x343c5d){return new Promise(function(_0x304519,_0x228f5e){var _0x4ebddb={'method':'GET','uri':_0x5a275c+_0x8a4c('0x15'),'json':!![]};_0x4ebddb[_0x8a4c('0x8')]=_0x3e52d0;logger[_0x8a4c('0x9')](_0x8a4c('0x16'));return rp(_0x4ebddb)['then'](function(_0x1f5d66){if(_0x1f5d66){var _0x5f42d8=_0x1f5d66[_0x8a4c('0x17')];var _0x1717f1=![];var _0xc607d7=null;if(_0x343c5d[_0x8a4c('0x18')]!==null){logger[_0x8a4c('0x9')](_0x8a4c('0x19'),_0x343c5d[_0x8a4c('0x18')]);_0x343c5d[_0x8a4c('0x1a')]=_0x343c5d['agentEmail'];for(_0xc607d7=0x0;_0xc607d7<_0x5f42d8['length'];_0xc607d7++){if(_0x5f42d8[_0xc607d7]['email']===_0x343c5d[_0x8a4c('0x18')]){_0x1717f1=!![];_0x343c5d[_0x8a4c('0x1b')]=_0x5f42d8[_0xc607d7]['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x1c'),_0x343c5d[_0x8a4c('0x1b')]);}}}if(!_0x1717f1){logger['info'](_0x8a4c('0x1d'));_0x343c5d['userEmail']=_0x343c5d[_0x8a4c('0x1e')];_0x343c5d['userId']=_0x343c5d[_0x8a4c('0xe')];_0x1717f1=!![];}if(_0x1717f1){_0x304519(_0x343c5d);}else{_0x228f5e({'statusCode':0x194,'message':_0x8a4c('0x10')});}}else{_0x228f5e({'statusCode':0x194,'message':_0x8a4c('0x10')});}})[_0x8a4c('0x11')](function(_0x7240c2){logger[_0x8a4c('0x12')]('['+[_0x371c43[_0x8a4c('0x13')]()]+']',_0x7240c2[_0x8a4c('0x14')]);_0x228f5e(_0x7240c2);});});};}function searchContact(_0xf8c95f,_0x18f474,_0x16e95d,_0x151d74){return new Promise(function(_0x1b3a4a,_0x156d69){var _0x32dad8={'method':'GET','headers':_0x18f474,'uri':_0xf8c95f+_0x8a4c('0x1f')+_0x151d74+_0x8a4c('0x20')+_0x16e95d+_0x8a4c('0x21'),'json':!![]};rp(_0x32dad8)[_0x8a4c('0xb')](function(_0x169878){var _0x2e678a=_[_0x8a4c('0x22')](_0x169878[_0x8a4c('0x23')][_0x8a4c('0x23')],[_0x16e95d,_0x151d74]);_0x1b3a4a(_0x2e678a);})[_0x8a4c('0x11')](function(_0x4bf1d3){_0x156d69(_0x4bf1d3);});});}function getEndUser(_0x5f031c,_0x389ba7,_0x240f9d){return function(_0x44ad5d){return new Promise(function(_0x34fe0d,_0x421c84){logger['info'](util['format'](_0x8a4c('0x24'),_0x44ad5d['contactNumber']));searchContact(_0x240f9d,_0x389ba7,_0x8a4c('0x25'),_0x44ad5d[_0x8a4c('0x26')])[_0x8a4c('0xb')](function(_0x149918){if(_0x149918){_0x44ad5d[_0x8a4c('0x27')]=_0x149918['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x28'),_0x44ad5d[_0x8a4c('0x27')]);return _0x34fe0d(_0x44ad5d);}searchContact(_0x240f9d,_0x389ba7,_0x8a4c('0x29'),_0x44ad5d[_0x8a4c('0x26')])[_0x8a4c('0xb')](function(_0x5041b9){if(_0x5041b9){_0x44ad5d[_0x8a4c('0x27')]=_0x5041b9['id'];logger[_0x8a4c('0x9')](_0x8a4c('0x2a'),_0x44ad5d[_0x8a4c('0x27')]);return _0x34fe0d(_0x44ad5d);}createEndUser(_0x44ad5d,_0x5f031c,_0x389ba7,_0x240f9d)[_0x8a4c('0xb')](function(_0x23099e){logger[_0x8a4c('0x9')]('Contact\x20created:',_0x23099e[_0x8a4c('0x27')]);return _0x34fe0d(_0x23099e);});});})[_0x8a4c('0x11')](function(_0x5c529f){_0x421c84(_0x5c529f);});});};}function createEndUser(_0x364567,_0x233ed9,_0x2f5dbe,_0xa58995){return new Promise(function(_0x1ba073,_0x3ffeb9){var _0x1cc595=moment();var _0x3c86a7={'method':_0x8a4c('0x2b'),'uri':_0xa58995+_0x8a4c('0x2c'),'body':{'contact':{'last_name':_0x364567[_0x8a4c('0x26')],'work_number':_0x364567[_0x8a4c('0x26')],'mobile_number':_0x364567[_0x8a4c('0x26')],'owner_id':_0x364567['userId'],'created_at':_0x1cc595[_0x8a4c('0x2d')](_0x8a4c('0x2e'))}},'json':!![]};_0x3c86a7['headers']=_0x2f5dbe;logger['info'](_0x8a4c('0x2f'));return rp(_0x3c86a7)[_0x8a4c('0xb')](function(_0x50cf82){_0x364567[_0x8a4c('0x27')]=_0x50cf82[_0x8a4c('0x30')]['id'];_0x1ba073(_0x364567);})[_0x8a4c('0x11')](function(_0x3fd251){logger['error']('['+[_0x233ed9['toUpperCase']()]+']',_0x3fd251[_0x8a4c('0x14')]);_0x3ffeb9(_0x3fd251[_0x8a4c('0x14')]);});});}function getTicket(_0x1b234f,_0x3ac42f,_0x3b7940,_0x42d4ef,_0x2264ba){return function(_0x418f7f){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x17133a,_0x1c1a9d){var _0x7f0c43=moment();var _0x1c972e={'method':_0x8a4c('0x2b'),'uri':_0x3b7940+_0x8a4c('0x31'),'body':{'title':intUtil[_0x8a4c('0x32')](_0x42d4ef[_0x8a4c('0x33')],_0x2264ba,'\x20'),'description':intUtil[_0x8a4c('0x32')](_0x42d4ef[_0x8a4c('0x34')],_0x2264ba,'\x0a'),'owner_id':_0x418f7f[_0x8a4c('0x1b')],'creater_id':_0x418f7f[_0x8a4c('0xe')],'targetable_id':_0x418f7f[_0x8a4c('0x27')],'targetable_type':_0x8a4c('0x35'),'created_at':_0x7f0c43[_0x8a4c('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x7f0c43['add'](0x1e,'m')[_0x8a4c('0x2d')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1c972e[_0x8a4c('0x8')]=_0x3ac42f;return rp(_0x1c972e)[_0x8a4c('0xb')](function(_0xe951a){_0x418f7f['ticketId']=_0xe951a[_0x8a4c('0x36')]['id'];logger[_0x8a4c('0x9')]('Task\x20created:',_0x418f7f[_0x8a4c('0x37')]);_0x17133a(_0x418f7f);})['catch'](function(_0x334cfd){logger[_0x8a4c('0x12')]('['+[_0x1b234f[_0x8a4c('0x13')]()]+']',_0x334cfd[_0x8a4c('0x14')]);_0x1c1a9d(_0x334cfd[_0x8a4c('0x14')]);});});};}function emit(_0x2a85b4,_0x515443,_0x3eedfa){var _0x5b2036={'uri':_0x2a85b4+_0x8a4c('0x38')+_0x3eedfa};io['to'](util[_0x8a4c('0x2d')](_0x8a4c('0x39'),_0x515443))[_0x8a4c('0x3a')](_0x8a4c('0x3b'),_0x5b2036);}exports['cs']=function(_0x466a11,_0x2a7088,_0x3bf0c4,_0x2c5b88,_0x14c9e5,_0x58126a,_0x40176f,_0x5cd90c){var _0x341ab3={};var _0x40cdff={'Authorization':_0x8a4c('0x3c')+_0x58126a[_0x8a4c('0x3d')]};_0x58126a[_0x8a4c('0x3e')]=intUtil[_0x8a4c('0x3f')](_0x58126a[_0x8a4c('0x3e')]);_0x58126a['serverUrl']=intUtil['stripTrailingSlash'](_0x58126a[_0x8a4c('0x40')]);var _0x577c8a=_0x58126a[_0x8a4c('0x3e')];_0x341ab3[_0x8a4c('0x1e')]=_0x58126a[_0x8a4c('0x41')];_0x341ab3['contactNumber']=_0x5cd90c[_0x8a4c('0x42')]()===_0x8a4c('0x43')?_0x2a7088[_0x8a4c('0x44')]:_0x2a7088[_0x8a4c('0x45')];_0x341ab3['callDirection']=_0x5cd90c===_0x8a4c('0x46')||_0x5cd90c==='unmanaged'?'queue':_0x8a4c('0x43');if(_0x2c5b88){_0x341ab3[_0x8a4c('0x18')]=_0x2c5b88[_0x8a4c('0xd')];}var _0x5aeb18=util[_0x8a4c('0x2d')](_0x8a4c('0x47'),_0x58126a[_0x8a4c('0x40')],_0x2a7088['uniqueid'],md5(_0x2a7088['uniqueid']));if(_0x14c9e5&&_0x14c9e5[_0x8a4c('0x48')]){logger[_0x8a4c('0x9')](_0x8a4c('0x49'),_0x8a4c('0x4a'));_0x2a7088[_0x8a4c('0x4b')]=_0x5aeb18;}else if(_0x40176f&&_0x40176f['recordingFormat']&&_0x40176f[_0x8a4c('0x4c')]!=='none'){logger['info'](_0x8a4c('0x4d'),_0x8a4c('0x4a'));_0x2a7088[_0x8a4c('0x4b')]=_0x5aeb18;}else{_0x2a7088['recordingURL']='';}return getAdminId(_0x341ab3,_0x5cd90c,_0x40cdff,_0x577c8a)[_0x8a4c('0xb')](getUser(_0x5cd90c,_0x40cdff,_0x577c8a))[_0x8a4c('0xb')](getEndUser(_0x5cd90c,_0x40cdff,_0x577c8a))[_0x8a4c('0xb')](getTicket(_0x5cd90c,_0x40cdff,_0x577c8a,_0x3bf0c4,_0x2a7088))[_0x8a4c('0xb')](function(_0x339c1b){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x339c1b[_0x8a4c('0x37')]));if(_0x5cd90c!==_0x8a4c('0x4e')){logger[_0x8a4c('0x9')]('['+[_0x5cd90c[_0x8a4c('0x13')]()]+']',_0x8a4c('0x4f'));emit(_0x577c8a,_0x2c5b88[_0x8a4c('0x50')],_0x339c1b[_0x8a4c('0x27')]);}})[_0x8a4c('0x11')](function(_0x1eb70a){logger[_0x8a4c('0x12')]('['+[_0x5cd90c[_0x8a4c('0x13')]()]+_0x8a4c('0x51'),util['inspect'](_0x1eb70a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1a64=['then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information'];(function(_0x5134eb,_0x1cd454){var _0x4ffcd6=function(_0x10ddd4){while(--_0x10ddd4){_0x5134eb['push'](_0x5134eb['shift']());}};_0x4ffcd6(++_0x1cd454);}(_0x1a64,0x1e9));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x41a6('0x0'));var md5=require(_0x41a6('0x1'));var util=require(_0x41a6('0x2'));var moment=require('moment');var Promise=require(_0x41a6('0x3'));var Redis=require(_0x41a6('0x4'));var intUtil=require(_0x41a6('0x5'));var config=require(_0x41a6('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x41a6('0x7')]=_[_0x41a6('0x8')](config[_0x41a6('0x7')],{'host':_0x41a6('0x9'),'port':0x18eb});var io=require(_0x41a6('0xa'))(new Redis(config[_0x41a6('0x7')]));function getAdminId(_0x288250,_0x3a261e,_0x165b27,_0x205a98){return new Promise(function(_0x4b5c96,_0x101af0){var _0x3d4965=![];var _0x86fc0d={'method':_0x41a6('0xb'),'uri':_0x205a98+_0x41a6('0xc'),'json':!![]};_0x86fc0d['headers']=_0x165b27;logger[_0x41a6('0xd')](_0x41a6('0xe'));return rp(_0x86fc0d)[_0x41a6('0xf')](function(_0x585862){if(_0x585862){var _0x1a2beb=_0x585862[_0x41a6('0x10')];var _0x2605ff=null;for(_0x2605ff=0x0;_0x2605ff<_0x1a2beb[_0x41a6('0x11')];_0x2605ff++){if(_0x1a2beb[_0x2605ff]['email']===_0x288250[_0x41a6('0x12')]){_0x288250[_0x41a6('0x13')]=_0x1a2beb[_0x2605ff]['id'];_0x3d4965=!![];}}if(_0x3d4965){logger[_0x41a6('0xd')](_0x41a6('0x14'),_0x288250[_0x41a6('0x13')]);_0x4b5c96(_0x288250);}else{_0x101af0({'statusCode':0x194,'message':_0x41a6('0x15')});}}else{_0x101af0({'statusCode':0x194,'message':_0x41a6('0x15')});}})[_0x41a6('0x16')](function(_0x1e0089){logger[_0x41a6('0x17')]('['+[_0x3a261e[_0x41a6('0x18')]()]+']',_0x1e0089[_0x41a6('0x19')]);_0x101af0(_0x1e0089);});});}function getUser(_0x3bb181,_0x2ad9fb,_0x320a45){return function(_0x3adaaa){return new Promise(function(_0x5eabbe,_0x399b21){var _0x2e124a={'method':_0x41a6('0xb'),'uri':_0x320a45+'/api/selector/owners','json':!![]};_0x2e124a[_0x41a6('0x1a')]=_0x2ad9fb;logger['info'](_0x41a6('0x1b'));return rp(_0x2e124a)['then'](function(_0x1a69a3){if(_0x1a69a3){var _0x3e0ec8=_0x1a69a3[_0x41a6('0x10')];var _0x266237=![];var _0x37322e=null;if(_0x3adaaa[_0x41a6('0x1c')]!==null){logger[_0x41a6('0xd')](_0x41a6('0x1d'),_0x3adaaa[_0x41a6('0x1c')]);_0x3adaaa[_0x41a6('0x1e')]=_0x3adaaa[_0x41a6('0x1c')];for(_0x37322e=0x0;_0x37322e<_0x3e0ec8['length'];_0x37322e++){if(_0x3e0ec8[_0x37322e][_0x41a6('0x1f')]===_0x3adaaa[_0x41a6('0x1c')]){_0x266237=!![];_0x3adaaa[_0x41a6('0x20')]=_0x3e0ec8[_0x37322e]['id'];logger['info'](_0x41a6('0x21'),_0x3adaaa[_0x41a6('0x20')]);}}}if(!_0x266237){logger[_0x41a6('0xd')](_0x41a6('0x22'));_0x3adaaa[_0x41a6('0x1e')]=_0x3adaaa['adminEmail'];_0x3adaaa['userId']=_0x3adaaa[_0x41a6('0x13')];_0x266237=!![];}if(_0x266237){_0x5eabbe(_0x3adaaa);}else{_0x399b21({'statusCode':0x194,'message':_0x41a6('0x15')});}}else{_0x399b21({'statusCode':0x194,'message':_0x41a6('0x15')});}})[_0x41a6('0x16')](function(_0x1bcbfa){logger[_0x41a6('0x17')]('['+[_0x3bb181[_0x41a6('0x18')]()]+']',_0x1bcbfa['message']);_0x399b21(_0x1bcbfa);});});};}function searchContact(_0x295e42,_0x36a373,_0x16a9c8,_0x290dd8){return new Promise(function(_0x32e50d,_0x2a5b0e){var _0x13785c={'method':_0x41a6('0xb'),'headers':_0x36a373,'uri':_0x295e42+'/api/lookup?q='+_0x290dd8+'&f='+_0x16a9c8+_0x41a6('0x23'),'json':!![]};rp(_0x13785c)[_0x41a6('0xf')](function(_0x2b2eba){var _0xe78cd7=_['find'](_0x2b2eba[_0x41a6('0x24')][_0x41a6('0x24')],[_0x16a9c8,_0x290dd8]);_0x32e50d(_0xe78cd7);})['catch'](function(_0x3e3c1f){_0x2a5b0e(_0x3e3c1f);});});}function getEndUser(_0x39b231,_0x57d20e,_0x20b4c6){return function(_0x1d9036){return new Promise(function(_0x53cf45,_0xb70edc){logger[_0x41a6('0xd')](util[_0x41a6('0x25')](_0x41a6('0x26'),_0x1d9036[_0x41a6('0x27')]));searchContact(_0x20b4c6,_0x57d20e,_0x41a6('0x28'),_0x1d9036[_0x41a6('0x27')])['then'](function(_0x5b3f41){if(_0x5b3f41){_0x1d9036[_0x41a6('0x29')]=_0x5b3f41['id'];logger['info'](_0x41a6('0x2a'),_0x1d9036[_0x41a6('0x29')]);return _0x53cf45(_0x1d9036);}searchContact(_0x20b4c6,_0x57d20e,'work_number',_0x1d9036[_0x41a6('0x27')])[_0x41a6('0xf')](function(_0x5325b8){if(_0x5325b8){_0x1d9036['endUserId']=_0x5325b8['id'];logger[_0x41a6('0xd')](_0x41a6('0x2b'),_0x1d9036['endUserId']);return _0x53cf45(_0x1d9036);}createEndUser(_0x1d9036,_0x39b231,_0x57d20e,_0x20b4c6)[_0x41a6('0xf')](function(_0x21826a){logger[_0x41a6('0xd')](_0x41a6('0x2c'),_0x21826a[_0x41a6('0x29')]);return _0x53cf45(_0x21826a);});});})[_0x41a6('0x16')](function(_0x2b47e4){_0xb70edc(_0x2b47e4);});});};}function createEndUser(_0x2f4cc0,_0x40eb87,_0x50c400,_0x6ce81e){return new Promise(function(_0x3cfbfb,_0x25098e){var _0x56e333=moment();var _0x2b36b3={'method':_0x41a6('0x2d'),'uri':_0x6ce81e+_0x41a6('0x2e'),'body':{'contact':{'last_name':_0x2f4cc0['contactNumber'],'work_number':_0x2f4cc0['contactNumber'],'mobile_number':_0x2f4cc0[_0x41a6('0x27')],'owner_id':_0x2f4cc0[_0x41a6('0x20')],'created_at':_0x56e333[_0x41a6('0x25')](_0x41a6('0x2f'))}},'json':!![]};_0x2b36b3[_0x41a6('0x1a')]=_0x50c400;logger[_0x41a6('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2b36b3)['then'](function(_0x3b8b22){_0x2f4cc0[_0x41a6('0x29')]=_0x3b8b22[_0x41a6('0x30')]['id'];_0x3cfbfb(_0x2f4cc0);})[_0x41a6('0x16')](function(_0x1da1d3){logger['error']('['+[_0x40eb87['toUpperCase']()]+']',_0x1da1d3[_0x41a6('0x19')]);_0x25098e(_0x1da1d3[_0x41a6('0x19')]);});});}function getTicket(_0x531dc6,_0x42045c,_0x41c53b,_0x5ad59a,_0x4a7747){return function(_0x23acc2){logger[_0x41a6('0xd')](_0x41a6('0x31'));return new Promise(function(_0x39b8f5,_0xa34b91){var _0x4e4b07=moment();var _0x2f1c1c={'method':_0x41a6('0x2d'),'uri':_0x41c53b+_0x41a6('0x32'),'body':{'title':intUtil[_0x41a6('0x33')](_0x5ad59a['Subjects'],_0x4a7747,'\x20'),'description':intUtil['getString'](_0x5ad59a['Descriptions'],_0x4a7747,'\x0a'),'owner_id':_0x23acc2[_0x41a6('0x20')],'creater_id':_0x23acc2[_0x41a6('0x13')],'targetable_id':_0x23acc2['endUserId'],'targetable_type':_0x41a6('0x34'),'created_at':_0x4e4b07[_0x41a6('0x25')](_0x41a6('0x2f')),'due_date':_0x4e4b07[_0x41a6('0x35')](0x1e,'m')[_0x41a6('0x25')](_0x41a6('0x2f'))},'json':!![]};_0x2f1c1c[_0x41a6('0x1a')]=_0x42045c;return rp(_0x2f1c1c)[_0x41a6('0xf')](function(_0x325d12){_0x23acc2['ticketId']=_0x325d12[_0x41a6('0x36')]['id'];logger[_0x41a6('0xd')](_0x41a6('0x37'),_0x23acc2[_0x41a6('0x38')]);_0x39b8f5(_0x23acc2);})[_0x41a6('0x16')](function(_0x43dfd7){logger['error']('['+[_0x531dc6[_0x41a6('0x18')]()]+']',_0x43dfd7['message']);_0xa34b91(_0x43dfd7[_0x41a6('0x19')]);});});};}function emit(_0x37cc2f,_0x522e89,_0x7d2ba1){var _0x1d98b3={'uri':_0x37cc2f+_0x41a6('0x39')+_0x7d2ba1};io['to'](util['format'](_0x41a6('0x3a'),_0x522e89))[_0x41a6('0x3b')]('trigger:browser:url',_0x1d98b3);}exports['cs']=function(_0x11e7f5,_0x2b62da,_0x1be107,_0xcd94e2,_0x58fde7,_0x274315,_0x27ddb1,_0x4597cc){var _0xe0662b={};var _0x16a3d3={'Authorization':_0x41a6('0x3c')+_0x274315[_0x41a6('0x3d')]};_0x274315[_0x41a6('0x3e')]=intUtil['stripTrailingSlash'](_0x274315[_0x41a6('0x3e')]);_0x274315[_0x41a6('0x3f')]=intUtil[_0x41a6('0x40')](_0x274315['serverUrl']);var _0x2509ac=_0x274315[_0x41a6('0x3e')];_0xe0662b[_0x41a6('0x12')]=_0x274315[_0x41a6('0x41')];_0xe0662b[_0x41a6('0x27')]=_0x4597cc[_0x41a6('0x42')]()==='outbound'?_0x2b62da[_0x41a6('0x43')]:_0x2b62da[_0x41a6('0x44')];_0xe0662b[_0x41a6('0x45')]=_0x4597cc===_0x41a6('0x46')||_0x4597cc===_0x41a6('0x47')?_0x41a6('0x46'):_0x41a6('0x48');if(_0xcd94e2){_0xe0662b[_0x41a6('0x1c')]=_0xcd94e2[_0x41a6('0x1f')];}var _0x4abbb2=util['format'](_0x41a6('0x49'),_0x274315[_0x41a6('0x3f')],_0x2b62da[_0x41a6('0x4a')],md5(_0x2b62da[_0x41a6('0x4a')]));if(_0x58fde7&&_0x58fde7[_0x41a6('0x4b')]){logger[_0x41a6('0xd')](_0x41a6('0x4c'),'Recording\x20is\x20enabled!');_0x2b62da[_0x41a6('0x4d')]=_0x4abbb2;}else if(_0x27ddb1&&_0x27ddb1['recordingFormat']&&_0x27ddb1['recordingFormat']!==_0x41a6('0x4e')){logger[_0x41a6('0xd')](_0x41a6('0x4f'),_0x41a6('0x50'));_0x2b62da[_0x41a6('0x4d')]=_0x4abbb2;}else{_0x2b62da[_0x41a6('0x4d')]='';}return getAdminId(_0xe0662b,_0x4597cc,_0x16a3d3,_0x2509ac)[_0x41a6('0xf')](getUser(_0x4597cc,_0x16a3d3,_0x2509ac))[_0x41a6('0xf')](getEndUser(_0x4597cc,_0x16a3d3,_0x2509ac))[_0x41a6('0xf')](getTicket(_0x4597cc,_0x16a3d3,_0x2509ac,_0x1be107,_0x2b62da))[_0x41a6('0xf')](function(_0x40bfc9){logger[_0x41a6('0xd')](util['format'](_0x41a6('0x51'),_0x40bfc9[_0x41a6('0x38')]));if(_0x4597cc!==_0x41a6('0x47')){logger[_0x41a6('0xd')]('['+[_0x4597cc[_0x41a6('0x18')]()]+']',_0x41a6('0x52'));emit(_0x2509ac,_0xcd94e2['name'],_0x40bfc9[_0x41a6('0x29')]);}})[_0x41a6('0x16')](function(_0x420679){logger[_0x41a6('0x17')]('['+[_0x4597cc[_0x41a6('0x18')]()]+_0x41a6('0x53'),util['inspect'](_0x420679,{'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 9bdfebd..23a91f3 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 _0x805b=['salesforce','zoho','log','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged'];(function(_0x4a3cce,_0x1e378b){var _0x11bc80=function(_0x4eaa89){while(--_0x4eaa89){_0x4a3cce['push'](_0x4a3cce['shift']());}};_0x11bc80(++_0x1e378b);}(_0x805b,0xad));var _0xb805=function(_0xa128c1,_0x132b77){_0xa128c1=_0xa128c1-0x0;var _0xec9b75=_0x805b[_0xa128c1];return _0xec9b75;};'use strict';var _=require(_0xb805('0x0'));var util=require(_0xb805('0x1'));var zendesk=require(_0xb805('0x2'));var salesforce=require(_0xb805('0x3'));var sugarcrm=require(_0xb805('0x4'));var freshdesk=require(_0xb805('0x5'));var zoho=require(_0xb805('0x6'));var desk=require(_0xb805('0x7'));var vtiger=require(_0xb805('0x8'));var servicenow=require(_0xb805('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0xb805('0xa'));var integrations=[_0xb805('0xb'),'salesforce',_0xb805('0xc'),_0xb805('0xd'),'zoho',_0xb805('0xe'),_0xb805('0xf'),_0xb805('0x10'),_0xb805('0x11'),_0xb805('0x12')];exports[_0xb805('0x13')]=function(_0x87f04d,_0x5f4f0b,_0x5c0461,_0x54f8d8,_0x3a64e5,_0x4efa0b){if(_0x5c0461){if(_[_0xb805('0x14')](integrations,_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]())){try{var _0x95ca13=null;var _0x3ce023='';var _0x35144a=_0x5c0461[_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]()];if(_0x35144a){var _0xb21378=_0x35144a[_0x87f04d[_0xb805('0x17')]];if(_0xb21378){var _0x44b55d=_[_0xb805('0x18')](_0xb21378[_0xb805('0x19')],{'id':parseInt(_0x87f04d[_0xb805('0x1a')],0xa)});if(_0x44b55d){if(_0x54f8d8){if(_0x3a64e5&&_0x5f4f0b[_0xb805('0x1b')]){_0x3ce023=_0xb805('0x1b');}else if(_0x5f4f0b[_0xb805('0x1c')]){_0x3ce023=_0xb805('0x1d');}else{console['log'](_0xb805('0x1e'),_0x5f4f0b);}}else{_0x3ce023=_0xb805('0x1f');}switch(_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]()){case'zendesk':zendesk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x20'):salesforce[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xc'):sugarcrm[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xd'):freshdesk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x21'):zoho[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xe'):desk[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0xf'):vtiger[_0x3ce023](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b);break;case _0xb805('0x11'):freshsales['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;case _0xb805('0x12'):servicenow['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;case _0xb805('0x10'):dynamics365['cs'](_0x87f04d,_0x5f4f0b,_0x44b55d,_0x54f8d8,_0x3a64e5,_0xb21378,_0x4efa0b,_0x3ce023);break;default:console[_0xb805('0x22')](_0xb805('0x23'));}}else{_0x95ca13=require('../../../../config/logger')(_0x87f04d[_0xb805('0x15')][_0xb805('0x16')]());_0x95ca13[_0xb805('0x24')](_0xb805('0x25'),util[_0xb805('0x26')]('%s\x20configuration\x20#%s\x20not\x20found',_0x87f04d[_0xb805('0x15')]['toLowerCase'](),_0x87f04d[_0xb805('0x1a')]));}}else{_0x95ca13=require(_0xb805('0x27'))(_0x87f04d['data1'][_0xb805('0x16')]());_0x95ca13[_0xb805('0x24')](_0xb805('0x25'),util['format'](_0xb805('0x28'),_0x87f04d['data1']['toLowerCase'](),_0x87f04d[_0xb805('0x17')]));}}else{}}catch(_0x32a630){console[_0xb805('0x24')](_0x32a630);}}}}; \ No newline at end of file +var _0x581c=['zendesk','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged'];(function(_0x3e757a,_0x166fd5){var _0x1c3a05=function(_0x4461ef){while(--_0x4461ef){_0x3e757a['push'](_0x3e757a['shift']());}};_0x1c3a05(++_0x166fd5);}(_0x581c,0x185));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xc581('0x1'));var sugarcrm=require(_0xc581('0x2'));var freshdesk=require(_0xc581('0x3'));var zoho=require(_0xc581('0x4'));var desk=require(_0xc581('0x5'));var vtiger=require(_0xc581('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xc581('0x7'));var freshsales=require(_0xc581('0x8'));var integrations=['zendesk',_0xc581('0x9'),_0xc581('0xa'),_0xc581('0xb'),_0xc581('0xc'),_0xc581('0xd'),_0xc581('0xe'),_0xc581('0xf'),_0xc581('0x10'),_0xc581('0x11')];exports[_0xc581('0x12')]=function(_0x104b6b,_0x5555ce,_0x2c4343,_0x456ac0,_0x51e535,_0x407664){if(_0x2c4343){if(_['includes'](integrations,_0x104b6b[_0xc581('0x13')][_0xc581('0x14')]())){try{var _0x11f69a=null;var _0x9854c2='';var _0x2b0a68=_0x2c4343[_0x104b6b[_0xc581('0x13')][_0xc581('0x14')]()];if(_0x2b0a68){var _0x98f66=_0x2b0a68[_0x104b6b[_0xc581('0x15')]];if(_0x98f66){var _0x18561d=_[_0xc581('0x16')](_0x98f66['Configurations'],{'id':parseInt(_0x104b6b[_0xc581('0x17')],0xa)});if(_0x18561d){if(_0x456ac0){if(_0x51e535&&_0x5555ce[_0xc581('0x18')]){_0x9854c2='queue';}else if(_0x5555ce[_0xc581('0x19')]){_0x9854c2=_0xc581('0x1a');}else{console['log'](_0xc581('0x1b'),_0x5555ce);}}else{_0x9854c2=_0xc581('0x1c');}switch(_0x104b6b['data1'][_0xc581('0x14')]()){case _0xc581('0x1d'):zendesk[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0x9'):salesforce[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0xa'):sugarcrm[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0xb'):freshdesk[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0xc'):zoho[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0xd'):desk[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case'vtiger':vtiger[_0x9854c2](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664);break;case _0xc581('0x10'):freshsales['cs'](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664,_0x9854c2);break;case'servicenow':servicenow['cs'](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664,_0x9854c2);break;case _0xc581('0xf'):dynamics365['cs'](_0x104b6b,_0x5555ce,_0x18561d,_0x456ac0,_0x51e535,_0x98f66,_0x407664,_0x9854c2);break;default:console[_0xc581('0x1e')](_0xc581('0x1f'));}}else{_0x11f69a=require(_0xc581('0x20'))(_0x104b6b[_0xc581('0x13')][_0xc581('0x14')]());_0x11f69a[_0xc581('0x21')](_0xc581('0x22'),util[_0xc581('0x23')](_0xc581('0x24'),_0x104b6b[_0xc581('0x13')]['toLowerCase'](),_0x104b6b[_0xc581('0x17')]));}}else{_0x11f69a=require(_0xc581('0x20'))(_0x104b6b[_0xc581('0x13')][_0xc581('0x14')]());_0x11f69a[_0xc581('0x21')](_0xc581('0x22'),util[_0xc581('0x23')](_0xc581('0x25'),_0x104b6b['data1'][_0xc581('0x14')](),_0x104b6b[_0xc581('0x15')]));}}else{}}catch(_0x56a300){console['error'](_0x56a300);}}}}; \ 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 93df31e..ebdc8ca 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 _0x2338=['outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','%s/%s/e','error','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','ioredis','../../../../config/environment','salesforce','defaults','redis','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','$or','Contact','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','additionalSearchContact','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','string','picklist','idField','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','https://login.salesforce.com','clientId','clientSecret','username','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','instanceUrl','catch'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x2338,0x8d));var _0x8233=function(_0x52c856,_0x47fd69){_0x52c856=_0x52c856-0x0;var _0x41f172=_0x2338[_0x52c856];return _0x41f172;};'use strict';var _=require(_0x8233('0x0'));var rp=require(_0x8233('0x1'));var moment=require(_0x8233('0x2'));var BPromise=require('bluebird');var md5=require(_0x8233('0x3'));var jsforce=require(_0x8233('0x4'));var util=require('util');var Redis=require(_0x8233('0x5'));var intUtil=require('./util');var config=require(_0x8233('0x6'));var logger=require('../../../../config/logger')(_0x8233('0x7'));config['redis']=_[_0x8233('0x8')](config[_0x8233('0x9')],{'host':_0x8233('0xa'),'port':0x18eb});var io=require(_0x8233('0xb'))(new Redis(config[_0x8233('0x9')]));function emit(_0x4daa0e,_0x311d34,_0x388033){io['to'](_0x4daa0e)['emit'](_0x311d34,_0x388033);}function getTicket(_0x1c39d5,_0x4a8508,_0x216975,_0x540b25,_0x28f86f,_0x61af20,_0x98e303,_0x552b40){var _0xbd037d=Object[_0x8233('0xc')]({},{'OwnerId':_0x4a8508['id'],'Subject':intUtil[_0x8233('0xd')](_0x540b25['Subjects'],_0x28f86f,'\x20'),'Description':intUtil[_0x8233('0xd')](_0x540b25[_0x8233('0xe')],_0x28f86f,'\x0a')},getCustomFields(_0x61af20,_0x28f86f));if(_0x216975){if(_0x540b25[_0x8233('0xf')]===_0x8233('0x10')){_0xbd037d[_0x8233('0x11')]=moment['utc']();_0xbd037d[_0x8233('0x12')]=![];_0xbd037d[_0x8233('0x13')]=![];if(_0x216975[_0x8233('0x14')]===_0x8233('0x15')||_0x216975[_0x8233('0x14')]===_0x8233('0x16')){_0xbd037d['WhoId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x17')){_0xbd037d[_0x8233('0x18')]=_0x216975['id'];}}else if(_0x540b25['ticketType']==='Case'){if(_0x216975['endUserType']===_0x8233('0x15')){_0xbd037d['ContactId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x17')){_0xbd037d['AccountId']=_0x216975['id'];}else if(_0x216975[_0x8233('0x14')]===_0x8233('0x16')&&_0x540b25[_0x8233('0x19')]){_0xbd037d[_0x540b25['leadId']]=_0x216975['id'];}else{logger[_0x8233('0x1a')](_0x8233('0x1b'));}}}return _0x98e303[_0x8233('0x1c')](_0x540b25[_0x8233('0xf')])['create'](_0xbd037d);}function getUser(_0x2f19ec,_0x31f8f5,_0x547c7){if(!_[_0x8233('0x1d')](_0x31f8f5)&&intUtil[_0x8233('0x1e')](_0x31f8f5)){var _0x12d67b={'Email':_0x31f8f5};var _0x55ea86={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x547c7[_0x8233('0x1c')](_0x8233('0x1f'))[_0x8233('0x20')](_0x12d67b,_0x55ea86)[_0x8233('0x21')]()[_0x8233('0x22')](function(_0x5f3be2){if(_0x5f3be2[_0x8233('0x23')]){var _0x213e06=_[_0x8233('0x20')](_0x5f3be2,function(_0x3c1839){return _0x3c1839[_0x8233('0x24')]===_0x31f8f5;});if(_0x213e06){logger[_0x8233('0x1a')]('Agent\x20%s\x20found.',_0x31f8f5);return BPromise['resolve']({'id':_0x213e06['Id'],'name':_0x213e06[_0x8233('0x25')]});}}else{logger[_0x8233('0x1a')](_0x8233('0x26'),_0x31f8f5);return _0x547c7[_0x8233('0x27')]()[_0x8233('0x22')](function(_0x909a15){return BPromise['resolve']({'id':_0x909a15[_0x8233('0x28')],'name':_0x909a15['display_name']});});}});}else{logger['info'](_0x8233('0x26'),_0x31f8f5);return _0x547c7[_0x8233('0x27')]()[_0x8233('0x22')](function(_0x2c4e3a){return BPromise[_0x8233('0x29')]({'id':_0x2c4e3a[_0x8233('0x28')],'name':_0x2c4e3a['display_name']});});}}function getEndUser(_0x400cb9,_0x30f984,_0x117722,_0x9fc398,_0x4d844f){var _0x3fbd20={'$or':{'Phone':_0x9fc398}};var _0x10a77c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8233('0x29')]()[_0x8233('0x22')](function(){logger[_0x8233('0x1a')](_0x8233('0x2a'),_0x9fc398,_0x30f984[_0x8233('0x2b')]);switch(_0x30f984[_0x8233('0x2b')]){case _0x8233('0x2c'):var _0x4ab4f7=_['cloneDeep'](_0x3fbd20);if(_0x30f984['additionalSearchContact']){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchContact']]=_0x9fc398;_[_0x8233('0x2d')](_0x4ab4f7[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x2f'))[_0x8233('0x20')](_0x4ab4f7,_0x10a77c)[_0x8233('0x21')]()['then'](function(_0x2140fa){if(_0x2140fa&&_0x2140fa[_0x8233('0x23')]){return _0x2140fa;}else{var _0xfd9025=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchLead']){var _0x3affac={};_0x3affac[_0x30f984[_0x8233('0x31')]]=_0x9fc398;_[_0x8233('0x2d')](_0xfd9025[_0x8233('0x2e')],_0x3affac);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x32'))[_0x8233('0x20')](_0xfd9025,_0x10a77c);}});case'account_contact_lead':var _0x28f312=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x33')]){var _0x59a78={};_0x59a78[_0x30f984[_0x8233('0x33')]]=_0x9fc398;_[_0x8233('0x2d')](_0x28f312[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x34'))[_0x8233('0x20')](_0x28f312,_0x10a77c)['execute']()[_0x8233('0x22')](function(_0x512651){if(_0x512651&&_0x512651['length']){return _0x512651;}else{var _0x1f8c80=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x35')]){var _0xd03460={};_0xd03460[_0x30f984[_0x8233('0x35')]]=_0x9fc398;_[_0x8233('0x2d')](_0x1f8c80[_0x8233('0x2e')],_0xd03460);}return _0x4d844f['sobject'](_0x8233('0x2f'))[_0x8233('0x20')](_0x1f8c80,_0x10a77c)[_0x8233('0x22')](function(_0x3981b0){if(_0x3981b0&&_0x3981b0[_0x8233('0x23')]){return _0x3981b0;}else{var _0x173185=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchLead']){var _0x3e7750={};_0x3e7750[_0x30f984['additionalSearchLead']]=_0x9fc398;_['merge'](_0x173185['$or'],_0x3e7750);}return _0x4d844f['sobject'](_0x8233('0x32'))[_0x8233('0x20')](_0x173185,_0x10a77c);}});}});case _0x8233('0x15'):var _0x4ab4f7=_[_0x8233('0x30')](_0x3fbd20);if(_0x30f984['additionalSearchContact']){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchContact']]=_0x9fc398;_[_0x8233('0x2d')](_0x4ab4f7[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x2f'))['find'](_0x4ab4f7,_0x10a77c)[_0x8233('0x21')]();case'lead':var _0x2cb45a=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x31')]){var _0x59a78={};_0x59a78[_0x30f984[_0x8233('0x31')]]=_0x9fc398;_[_0x8233('0x2d')](_0x2cb45a['$or'],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x32'))[_0x8233('0x20')](_0x2cb45a,_0x10a77c);case _0x8233('0x17'):var _0x28f312=_['cloneDeep'](_0x3fbd20);if(_0x30f984[_0x8233('0x33')]){var _0x59a78={};_0x59a78[_0x30f984['additionalSearchAccount']]=_0x9fc398;_['merge'](_0x28f312[_0x8233('0x2e')],_0x59a78);}return _0x4d844f[_0x8233('0x1c')](_0x8233('0x34'))[_0x8233('0x20')](_0x28f312,_0x10a77c);default:return null;}})['then'](function(_0x53fad0){if(_0x53fad0&&_0x53fad0[_0x8233('0x23')]){var _0x5731b6=_['first'](_0x53fad0);if(_0x5731b6){return BPromise[_0x8233('0x29')]({'id':_0x5731b6['Id'],'name':_0x5731b6['Name'],'phone':_0x5731b6[_0x8233('0x36')],'endUserType':_0x5731b6[_0x8233('0x37')][_0x8233('0x38')]['toLowerCase']()});}}})['then'](function(_0x4ebd89){if(_0x4ebd89){logger[_0x8233('0x1a')](_0x8233('0x39'),_0x4ebd89[_0x8233('0x14')],_0x9fc398);return BPromise[_0x8233('0x29')](_0x4ebd89);}else{logger['info'](_0x8233('0x3a'),_0x9fc398);var _0x67d222={'Phone':_0x9fc398};if(_0x30f984[_0x8233('0x3b')]){if(_0x30f984[_0x8233('0x3b')]===_0x8233('0x15')){logger[_0x8233('0x1a')](_0x8233('0x3c'),_0x9fc398,_0x30f984[_0x8233('0x3b')]);_0x67d222[_0x8233('0x3d')]=_0x117722!==_0x8233('0x3e')?_0x117722:util[_0x8233('0x3f')](_0x8233('0x40'),_0x9fc398);}else if(_0x30f984['moduleCreate']===_0x8233('0x16')){logger[_0x8233('0x1a')](_0x8233('0x3c'),_0x9fc398,_0x30f984['moduleCreate']);_0x67d222[_0x8233('0x3d')]=_0x117722!==_0x8233('0x3e')?_0x117722:util['format']('Caller\x20-\x20%s',_0x9fc398);_0x67d222[_0x8233('0x41')]=_0x8233('0x42');}else if(_0x30f984[_0x8233('0x3b')]===_0x8233('0x17')){logger['info'](_0x8233('0x3c'),_0x9fc398,_0x30f984[_0x8233('0x3b')]);_0x67d222[_0x8233('0x25')]=_0x117722!==_0x8233('0x3e')?_0x117722:util[_0x8233('0x3f')](_0x8233('0x40'),_0x9fc398);}else{return null;}}return _0x4d844f[_0x8233('0x1c')](_[_0x8233('0x43')](_0x30f984[_0x8233('0x3b')]))['create'](_0x67d222)[_0x8233('0x22')](function(_0x249b09){return BPromise['resolve']({'id':_0x249b09['id'],'endUserType':_0x30f984['moduleCreate']});});}});}function getCustomFields(_0x2a26dd,_0x3027d0){var _0x1eee17={};if(_0x2a26dd[_0x8233('0x23')]>0x0){_[_0x8233('0x44')](_0x2a26dd,function(_0x8ca4f5){if(_['includes']([_0x8233('0x45'),_0x8233('0x46')],_0x8ca4f5['type'])&&_0x8ca4f5['idField']){_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x8ca4f5['content'][_0x8233('0x48')]();}else if(_0x8ca4f5[_0x8233('0x38')]==='variable'&&_0x8ca4f5[_0x8233('0x49')]&&_0x8ca4f5[_0x8233('0x47')]){_0x3027d0[_0x8ca4f5[_0x8233('0x49')]]&&(_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x3027d0[_0x8ca4f5['variableName']][_0x8233('0x48')]());}else if(_0x8ca4f5['type']===_0x8233('0x4a')&&_0x8ca4f5[_0x8233('0x4b')]&&_0x8ca4f5[_0x8233('0x4b')][_0x8233('0x4c')]&&_0x8ca4f5[_0x8233('0x47')]){_0x3027d0[_0x8ca4f5[_0x8233('0x4b')]['name'][_0x8233('0x4d')]()]&&(_0x1eee17[_0x8ca4f5[_0x8233('0x47')]]=_0x3027d0[_0x8ca4f5[_0x8233('0x4b')][_0x8233('0x4c')]['toLowerCase']()][_0x8233('0x48')]());}});}return _0x1eee17;}function getConnection(_0x19ba69){var _0x5eb552=_0x19ba69[_0x8233('0x4e')][_0x8233('0x4f')](_0x19ba69['securityToken']);var _0x2a9a0d=new jsforce[(_0x8233('0x50'))]({'oauth2':{'loginUrl':_0x19ba69['remoteUri']||_0x8233('0x51'),'clientId':_0x19ba69[_0x8233('0x52')],'clientSecret':_0x19ba69[_0x8233('0x53')]}});return _0x2a9a0d['login'](_0x19ba69[_0x8233('0x54')],_0x5eb552)[_0x8233('0x22')](function(){logger[_0x8233('0x1a')]('Connection\x20established.');return _0x2a9a0d;});}exports['queue']=function(_0x5ac22d,_0x42ba16,_0x57f316,_0x26375d,_0x2d4071,_0x859450){var _0x29a358,_0x48999d,_0x36be82,_0x1af445;_0x859450[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x859450[_0x8233('0x55')]);_0x859450[_0x8233('0x57')]=intUtil[_0x8233('0x56')](_0x859450[_0x8233('0x57')]);if(_0x2d4071&&_0x2d4071[_0x8233('0x58')]){logger[_0x8233('0x1a')](_0x8233('0x59'),_0x8233('0x5a'));_0x42ba16['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x859450[_0x8233('0x55')],_0x42ba16[_0x8233('0x5b')],md5(_0x42ba16['uniqueid']));}else{_0x42ba16[_0x8233('0x5c')]='';}return getConnection(_0x859450)[_0x8233('0x22')](function(_0x500f4f){_0x1af445=_0x500f4f;return getUser(_0x859450,_0x26375d[_0x8233('0x5d')],_0x1af445);})[_0x8233('0x22')](function(_0x1e9b5e){_0x29a358=_0x1e9b5e;return getEndUser(_0x859450,_0x57f316,_0x42ba16[_0x8233('0x5e')],_0x42ba16[_0x8233('0x5f')],_0x1af445);})[_0x8233('0x22')](function(_0x400a62){_0x48999d=_0x400a62;return getTicket(_0x859450,_0x29a358,_0x48999d,_0x57f316,_0x42ba16,_0x57f316[_0x8233('0x60')],_0x1af445,_0x8233('0x61'));})[_0x8233('0x22')](function(_0x1874c1){_0x36be82=_0x1874c1;logger[_0x8233('0x1a')](_0x8233('0x62'),_0x36be82['id']);logger[_0x8233('0x1a')](_0x8233('0x63'),_0x36be82['id'],_0x26375d['name'],_0x859450[_0x8233('0x38')]);switch(_0x859450[_0x8233('0x38')]){case _0x8233('0x64'):emit(util['format'](_0x8233('0x65'),_0x26375d[_0x8233('0x4c')]),'trigger:salesforce:display',{'recordId':_0x36be82['id']});break;case _0x8233('0x66'):emit(util[_0x8233('0x3f')](_0x8233('0x65'),_0x26375d[_0x8233('0x4c')]),'trigger:browser:url',{'uri':util[_0x8233('0x3f')]('%s/%s/e',_0x1af445[_0x8233('0x67')],_0x36be82['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8233('0x68')](function(_0x246bb6){logger['error'](_0x8233('0x59'),_0x246bb6);});};exports[_0x8233('0x69')]=function(_0x2dff1c,_0x5700fb,_0x1e45c2,_0x1af173,_0x4d3964,_0x46f99d,_0x18f004){var _0x40b50f,_0x55759c,_0x15fc6b,_0x3c3848;_0x46f99d[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x46f99d[_0x8233('0x55')]);_0x46f99d[_0x8233('0x57')]=intUtil[_0x8233('0x56')](_0x46f99d[_0x8233('0x57')]);if(_0x18f004&&_0x18f004[_0x8233('0x6a')]&&_0x18f004['recordingFormat']!==_0x8233('0x6b')){logger[_0x8233('0x1a')](_0x8233('0x6c'),_0x8233('0x5a'));_0x5700fb[_0x8233('0x5c')]=util['format'](_0x8233('0x6d'),_0x46f99d[_0x8233('0x55')],_0x5700fb[_0x8233('0x5b')],md5(_0x5700fb[_0x8233('0x5b')]));}return getConnection(_0x46f99d)[_0x8233('0x22')](function(_0x2b5c26){_0x3c3848=_0x2b5c26;return getUser(_0x46f99d,_0x1af173['email'],_0x3c3848);})[_0x8233('0x22')](function(_0xbbc957){_0x40b50f=_0xbbc957;return getEndUser(_0x46f99d,_0x1e45c2,_0x5700fb[_0x8233('0x6e')],_0x5700fb[_0x8233('0x6f')],_0x3c3848);})['then'](function(_0x17407a){_0x55759c=_0x17407a;return getTicket(_0x46f99d,_0x40b50f,_0x55759c,_0x1e45c2,_0x5700fb,_0x1e45c2[_0x8233('0x60')],_0x3c3848,'outbound');})[_0x8233('0x22')](function(_0x2fd9cb){_0x15fc6b=_0x2fd9cb;logger['info'](_0x8233('0x70'),_0x15fc6b['id']);logger['info'](_0x8233('0x71'),_0x15fc6b['id'],_0x1af173['name'],_0x46f99d[_0x8233('0x38')]);switch(_0x46f99d['type']){case _0x8233('0x64'):emit(util[_0x8233('0x3f')](_0x8233('0x65'),_0x1af173[_0x8233('0x4c')]),_0x8233('0x72'),{'recordId':_0x15fc6b['id']});break;case _0x8233('0x66'):emit(util['format'](_0x8233('0x65'),_0x1af173[_0x8233('0x4c')]),_0x8233('0x73'),{'uri':util[_0x8233('0x3f')](_0x8233('0x74'),_0x3c3848['instanceUrl'],_0x15fc6b['id'])});break;default:logger[_0x8233('0x75')](_0x8233('0x6c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x8233('0x68')](function(_0x337c45){logger['error'](_0x8233('0x6c'),_0x337c45);});};exports[_0x8233('0x76')]=function(_0x11e53e,_0x5eeeaa,_0x5d4ba0,_0x3b12a9,_0x2efcee,_0x5d3e01){var _0x2cc6e2,_0x318153,_0x5a7a94,_0x239576;_0x5d3e01[_0x8233('0x55')]=intUtil[_0x8233('0x56')](_0x5d3e01['serverUrl']);_0x5d3e01['remoteUri']=intUtil[_0x8233('0x56')](_0x5d3e01[_0x8233('0x57')]);if(_0x2efcee&&_0x2efcee[_0x8233('0x58')]){logger[_0x8233('0x1a')]('['+_0x5eeeaa[_0x8233('0x77')][_0x8233('0x78')]()+']',_0x8233('0x5a'));_0x5eeeaa[_0x8233('0x5c')]=util['format'](_0x8233('0x6d'),_0x5d3e01[_0x8233('0x55')],_0x5eeeaa[_0x8233('0x5b')],md5(_0x5eeeaa['uniqueid']));}else{_0x5eeeaa[_0x8233('0x5c')]='';}return getConnection(_0x5d3e01)[_0x8233('0x22')](function(_0x5b004c){_0x239576=_0x5b004c;if(!_['isNil'](_0x3b12a9)){return getUser(_0x5d3e01,_0x3b12a9[_0x8233('0x4c')],_0x239576);}else{return getUser(_0x5d3e01,null,_0x239576);}})[_0x8233('0x22')](function(_0x598ef7){_0x2cc6e2=_0x598ef7;return getEndUser(_0x5d3e01,_0x5d4ba0,_0x5eeeaa[_0x8233('0x5e')],_0x5eeeaa['calleridnum'],_0x239576);})['then'](function(_0x5308d9){_0x318153=_0x5308d9;return getTicket(_0x5d3e01,_0x2cc6e2,_0x318153,_0x5d4ba0,_0x5eeeaa,_0x5d4ba0[_0x8233('0x60')],_0x239576);})[_0x8233('0x22')](function(_0x2984a){_0x5a7a94=_0x2984a;logger['info']('['+_0x5eeeaa[_0x8233('0x77')][_0x8233('0x78')]()+_0x8233('0x79'),_0x5a7a94['id']);logger[_0x8233('0x1a')]('['+_0x5eeeaa[_0x8233('0x77')]['toUpperCase']()+_0x8233('0x7a'),_0x5d3e01[_0x8233('0x38')]);})['catch'](function(_0x51f7bd){logger[_0x8233('0x75')]('['+_0x5eeeaa['lastevent'][_0x8233('0x78')]()+']',_0x51f7bd);});}; \ No newline at end of file +var _0xd40f=['string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','monitor_format','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase','lodash','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','assign','Subjects','Descriptions','Task','utc','IsReminderSet','contact','endUserType','lead','account','WhatId','ticketType','ContactId','AccountId','leadId','info','create','isNil','sobject','User','execute','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','$or','Contact','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','Lead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','includes'];(function(_0x1a0ce4,_0x358e7c){var _0x469b10=function(_0x2a52fe){while(--_0x2a52fe){_0x1a0ce4['push'](_0x1a0ce4['shift']());}};_0x469b10(++_0x358e7c);}(_0xd40f,0x1b5));var _0xfd40=function(_0x3cd025,_0x1e2adf){_0x3cd025=_0x3cd025-0x0;var _0xaa86eb=_0xd40f[_0x3cd025];return _0xaa86eb;};'use strict';var _=require(_0xfd40('0x0'));var rp=require('request-promise');var moment=require(_0xfd40('0x1'));var BPromise=require('bluebird');var md5=require(_0xfd40('0x2'));var jsforce=require(_0xfd40('0x3'));var util=require('util');var Redis=require(_0xfd40('0x4'));var intUtil=require(_0xfd40('0x5'));var config=require(_0xfd40('0x6'));var logger=require(_0xfd40('0x7'))('salesforce');config[_0xfd40('0x8')]=_[_0xfd40('0x9')](config[_0xfd40('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xfd40('0xa'))(new Redis(config['redis']));function emit(_0xf6b2a1,_0x3e7655,_0x205c61){io['to'](_0xf6b2a1)[_0xfd40('0xb')](_0x3e7655,_0x205c61);}function getTicket(_0x33c5fd,_0x2fcad2,_0x37e783,_0x562d8a,_0x3aa9d8,_0x2df5fc,_0x1dd051,_0x4160a2){var _0x26ccc1=Object[_0xfd40('0xc')]({},{'OwnerId':_0x2fcad2['id'],'Subject':intUtil['getString'](_0x562d8a[_0xfd40('0xd')],_0x3aa9d8,'\x20'),'Description':intUtil['getString'](_0x562d8a[_0xfd40('0xe')],_0x3aa9d8,'\x0a')},getCustomFields(_0x2df5fc,_0x3aa9d8));if(_0x37e783){if(_0x562d8a['ticketType']===_0xfd40('0xf')){_0x26ccc1['ActivityDate']=moment[_0xfd40('0x10')]();_0x26ccc1[_0xfd40('0x11')]=![];_0x26ccc1['IsRecurrence']=![];if(_0x37e783['endUserType']===_0xfd40('0x12')||_0x37e783[_0xfd40('0x13')]===_0xfd40('0x14')){_0x26ccc1['WhoId']=_0x37e783['id'];}else if(_0x37e783[_0xfd40('0x13')]===_0xfd40('0x15')){_0x26ccc1[_0xfd40('0x16')]=_0x37e783['id'];}}else if(_0x562d8a[_0xfd40('0x17')]==='Case'){if(_0x37e783[_0xfd40('0x13')]==='contact'){_0x26ccc1[_0xfd40('0x18')]=_0x37e783['id'];}else if(_0x37e783[_0xfd40('0x13')]===_0xfd40('0x15')){_0x26ccc1[_0xfd40('0x19')]=_0x37e783['id'];}else if(_0x37e783['endUserType']==='lead'&&_0x562d8a[_0xfd40('0x1a')]){_0x26ccc1[_0x562d8a[_0xfd40('0x1a')]]=_0x37e783['id'];}else{logger[_0xfd40('0x1b')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x1dd051['sobject'](_0x562d8a[_0xfd40('0x17')])[_0xfd40('0x1c')](_0x26ccc1);}function getUser(_0x2ad7ae,_0x51d8a5,_0x1991b5){if(!_[_0xfd40('0x1d')](_0x51d8a5)&&intUtil['validateEmail'](_0x51d8a5)){var _0x11cc2a={'Email':_0x51d8a5};var _0x4a3153={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1991b5[_0xfd40('0x1e')](_0xfd40('0x1f'))['find'](_0x11cc2a,_0x4a3153)[_0xfd40('0x20')]()[_0xfd40('0x21')](function(_0x33f7d2){if(_0x33f7d2[_0xfd40('0x22')]){var _0x11f2f8=_[_0xfd40('0x23')](_0x33f7d2,function(_0x3aa518){return _0x3aa518[_0xfd40('0x24')]===_0x51d8a5;});if(_0x11f2f8){logger[_0xfd40('0x1b')]('Agent\x20%s\x20found.',_0x51d8a5);return BPromise[_0xfd40('0x25')]({'id':_0x11f2f8['Id'],'name':_0x11f2f8[_0xfd40('0x26')]});}}else{logger[_0xfd40('0x1b')](_0xfd40('0x27'),_0x51d8a5);return _0x1991b5['identity']()['then'](function(_0x2655b3){return BPromise[_0xfd40('0x25')]({'id':_0x2655b3[_0xfd40('0x28')],'name':_0x2655b3[_0xfd40('0x29')]});});}});}else{logger[_0xfd40('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x51d8a5);return _0x1991b5['identity']()[_0xfd40('0x21')](function(_0x185a85){return BPromise[_0xfd40('0x25')]({'id':_0x185a85[_0xfd40('0x28')],'name':_0x185a85[_0xfd40('0x29')]});});}}function getEndUser(_0x3429bc,_0x42333b,_0x254bd6,_0x42570e,_0x2ec9d2){var _0x12ba5f={'$or':{'Phone':_0x42570e}};var _0xa1d776={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xfd40('0x21')](function(){logger['info'](_0xfd40('0x2a'),_0x42570e,_0x42333b[_0xfd40('0x2b')]);switch(_0x42333b[_0xfd40('0x2b')]){case _0xfd40('0x2c'):var _0x4bee8f=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b['additionalSearchContact']){var _0x5cd018={};_0x5cd018[_0x42333b['additionalSearchContact']]=_0x42570e;_['merge'](_0x4bee8f[_0xfd40('0x2e')],_0x5cd018);}return _0x2ec9d2[_0xfd40('0x1e')](_0xfd40('0x2f'))[_0xfd40('0x23')](_0x4bee8f,_0xa1d776)[_0xfd40('0x20')]()[_0xfd40('0x21')](function(_0x3ec56c){if(_0x3ec56c&&_0x3ec56c['length']){return _0x3ec56c;}else{var _0x58ee24=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b[_0xfd40('0x30')]){var _0x42ace3={};_0x42ace3[_0x42333b[_0xfd40('0x30')]]=_0x42570e;_[_0xfd40('0x31')](_0x58ee24['$or'],_0x42ace3);}return _0x2ec9d2['sobject']('Lead')['find'](_0x58ee24,_0xa1d776);}});case _0xfd40('0x32'):var _0x1fd8c4=_['cloneDeep'](_0x12ba5f);if(_0x42333b[_0xfd40('0x33')]){var _0x5cd018={};_0x5cd018[_0x42333b[_0xfd40('0x33')]]=_0x42570e;_[_0xfd40('0x31')](_0x1fd8c4[_0xfd40('0x2e')],_0x5cd018);}return _0x2ec9d2[_0xfd40('0x1e')](_0xfd40('0x34'))[_0xfd40('0x23')](_0x1fd8c4,_0xa1d776)[_0xfd40('0x20')]()[_0xfd40('0x21')](function(_0x4ed0fb){if(_0x4ed0fb&&_0x4ed0fb[_0xfd40('0x22')]){return _0x4ed0fb;}else{var _0xf48aa=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b[_0xfd40('0x35')]){var _0x578fb8={};_0x578fb8[_0x42333b['additionalSearchContact']]=_0x42570e;_[_0xfd40('0x31')](_0xf48aa[_0xfd40('0x2e')],_0x578fb8);}return _0x2ec9d2['sobject'](_0xfd40('0x2f'))[_0xfd40('0x23')](_0xf48aa,_0xa1d776)[_0xfd40('0x21')](function(_0xcf8f1d){if(_0xcf8f1d&&_0xcf8f1d[_0xfd40('0x22')]){return _0xcf8f1d;}else{var _0x4d6ef6=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b['additionalSearchLead']){var _0x342da9={};_0x342da9[_0x42333b[_0xfd40('0x30')]]=_0x42570e;_[_0xfd40('0x31')](_0x4d6ef6['$or'],_0x342da9);}return _0x2ec9d2['sobject']('Lead')['find'](_0x4d6ef6,_0xa1d776);}});}});case _0xfd40('0x12'):var _0x4bee8f=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b['additionalSearchContact']){var _0x5cd018={};_0x5cd018[_0x42333b[_0xfd40('0x35')]]=_0x42570e;_[_0xfd40('0x31')](_0x4bee8f[_0xfd40('0x2e')],_0x5cd018);}return _0x2ec9d2['sobject'](_0xfd40('0x2f'))['find'](_0x4bee8f,_0xa1d776)[_0xfd40('0x20')]();case'lead':var _0x544f41=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b[_0xfd40('0x30')]){var _0x5cd018={};_0x5cd018[_0x42333b[_0xfd40('0x30')]]=_0x42570e;_[_0xfd40('0x31')](_0x544f41[_0xfd40('0x2e')],_0x5cd018);}return _0x2ec9d2['sobject'](_0xfd40('0x36'))[_0xfd40('0x23')](_0x544f41,_0xa1d776);case _0xfd40('0x15'):var _0x1fd8c4=_[_0xfd40('0x2d')](_0x12ba5f);if(_0x42333b['additionalSearchAccount']){var _0x5cd018={};_0x5cd018[_0x42333b['additionalSearchAccount']]=_0x42570e;_['merge'](_0x1fd8c4[_0xfd40('0x2e')],_0x5cd018);}return _0x2ec9d2[_0xfd40('0x1e')](_0xfd40('0x34'))[_0xfd40('0x23')](_0x1fd8c4,_0xa1d776);default:return null;}})[_0xfd40('0x21')](function(_0x193d24){if(_0x193d24&&_0x193d24[_0xfd40('0x22')]){var _0x36e77f=_[_0xfd40('0x37')](_0x193d24);if(_0x36e77f){return BPromise[_0xfd40('0x25')]({'id':_0x36e77f['Id'],'name':_0x36e77f[_0xfd40('0x26')],'phone':_0x36e77f[_0xfd40('0x38')],'endUserType':_0x36e77f['attributes'][_0xfd40('0x39')][_0xfd40('0x3a')]()});}}})[_0xfd40('0x21')](function(_0x24849b){if(_0x24849b){logger[_0xfd40('0x1b')](_0xfd40('0x3b'),_0x24849b[_0xfd40('0x13')],_0x42570e);return BPromise['resolve'](_0x24849b);}else{logger['info'](_0xfd40('0x3c'),_0x42570e);var _0x4b389c={'Phone':_0x42570e};if(_0x42333b[_0xfd40('0x3d')]){if(_0x42333b[_0xfd40('0x3d')]==='contact'){logger[_0xfd40('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42570e,_0x42333b[_0xfd40('0x3d')]);_0x4b389c[_0xfd40('0x3e')]=_0x254bd6!==_0xfd40('0x3f')?_0x254bd6:util['format'](_0xfd40('0x40'),_0x42570e);}else if(_0x42333b[_0xfd40('0x3d')]===_0xfd40('0x14')){logger[_0xfd40('0x1b')](_0xfd40('0x41'),_0x42570e,_0x42333b[_0xfd40('0x3d')]);_0x4b389c[_0xfd40('0x3e')]=_0x254bd6!==_0xfd40('0x3f')?_0x254bd6:util[_0xfd40('0x42')](_0xfd40('0x40'),_0x42570e);_0x4b389c[_0xfd40('0x43')]=_0xfd40('0x44');}else if(_0x42333b['moduleCreate']===_0xfd40('0x15')){logger[_0xfd40('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x42570e,_0x42333b[_0xfd40('0x3d')]);_0x4b389c['Name']=_0x254bd6!==_0xfd40('0x3f')?_0x254bd6:util['format'](_0xfd40('0x40'),_0x42570e);}else{return null;}}return _0x2ec9d2['sobject'](_[_0xfd40('0x45')](_0x42333b[_0xfd40('0x3d')]))[_0xfd40('0x1c')](_0x4b389c)[_0xfd40('0x21')](function(_0x26bfe3){return BPromise[_0xfd40('0x25')]({'id':_0x26bfe3['id'],'endUserType':_0x42333b[_0xfd40('0x3d')]});});}});}function getCustomFields(_0x357e40,_0x2d18e3){var _0x3b636b={};if(_0x357e40['length']>0x0){_['forEach'](_0x357e40,function(_0x24582d){if(_[_0xfd40('0x46')]([_0xfd40('0x47'),_0xfd40('0x48')],_0x24582d[_0xfd40('0x39')])&&_0x24582d[_0xfd40('0x49')]){_0x3b636b[_0x24582d[_0xfd40('0x49')]]=_0x24582d[_0xfd40('0x4a')][_0xfd40('0x4b')]();}else if(_0x24582d[_0xfd40('0x39')]===_0xfd40('0x4c')&&_0x24582d[_0xfd40('0x4d')]&&_0x24582d[_0xfd40('0x49')]){_0x2d18e3[_0x24582d['variableName']]&&(_0x3b636b[_0x24582d[_0xfd40('0x49')]]=_0x2d18e3[_0x24582d['variableName']][_0xfd40('0x4b')]());}else if(_0x24582d[_0xfd40('0x39')]===_0xfd40('0x4e')&&_0x24582d[_0xfd40('0x4f')]&&_0x24582d[_0xfd40('0x4f')]['name']&&_0x24582d[_0xfd40('0x49')]){_0x2d18e3[_0x24582d[_0xfd40('0x4f')][_0xfd40('0x50')][_0xfd40('0x3a')]()]&&(_0x3b636b[_0x24582d['idField']]=_0x2d18e3[_0x24582d[_0xfd40('0x4f')]['name'][_0xfd40('0x3a')]()][_0xfd40('0x4b')]());}});}return _0x3b636b;}function getConnection(_0x453665){var _0x4d4d07=_0x453665[_0xfd40('0x51')][_0xfd40('0x52')](_0x453665[_0xfd40('0x53')]);var _0x348137=new jsforce[(_0xfd40('0x54'))]({'oauth2':{'loginUrl':_0x453665[_0xfd40('0x55')]||_0xfd40('0x56'),'clientId':_0x453665['clientId'],'clientSecret':_0x453665[_0xfd40('0x57')]}});return _0x348137['login'](_0x453665[_0xfd40('0x58')],_0x4d4d07)[_0xfd40('0x21')](function(){logger[_0xfd40('0x1b')](_0xfd40('0x59'));return _0x348137;});}exports['queue']=function(_0x3f5946,_0x51bc1f,_0x3fd170,_0x5330a1,_0x18d7d7,_0x29df8f){var _0x1cda4b,_0x28b963,_0x4522c8,_0x106a6e;_0x29df8f[_0xfd40('0x5a')]=intUtil[_0xfd40('0x5b')](_0x29df8f['serverUrl']);_0x29df8f['remoteUri']=intUtil[_0xfd40('0x5b')](_0x29df8f[_0xfd40('0x55')]);if(_0x18d7d7&&_0x18d7d7['monitor_format']){logger[_0xfd40('0x1b')](_0xfd40('0x5c'),'Recording\x20is\x20enabled!');_0x51bc1f[_0xfd40('0x5d')]=util[_0xfd40('0x42')](_0xfd40('0x5e'),_0x29df8f[_0xfd40('0x5a')],_0x51bc1f[_0xfd40('0x5f')],md5(_0x51bc1f[_0xfd40('0x5f')]));}else{_0x51bc1f[_0xfd40('0x5d')]='';}return getConnection(_0x29df8f)[_0xfd40('0x21')](function(_0x10734d){_0x106a6e=_0x10734d;return getUser(_0x29df8f,_0x5330a1[_0xfd40('0x60')],_0x106a6e);})[_0xfd40('0x21')](function(_0x457fed){_0x1cda4b=_0x457fed;return getEndUser(_0x29df8f,_0x3fd170,_0x51bc1f[_0xfd40('0x61')],_0x51bc1f[_0xfd40('0x62')],_0x106a6e);})[_0xfd40('0x21')](function(_0x5449ac){_0x28b963=_0x5449ac;return getTicket(_0x29df8f,_0x1cda4b,_0x28b963,_0x3fd170,_0x51bc1f,_0x3fd170[_0xfd40('0x63')],_0x106a6e,_0xfd40('0x64'));})[_0xfd40('0x21')](function(_0x5559dd){_0x4522c8=_0x5559dd;logger[_0xfd40('0x1b')](_0xfd40('0x65'),_0x4522c8['id']);logger[_0xfd40('0x1b')](_0xfd40('0x66'),_0x4522c8['id'],_0x5330a1['name'],_0x29df8f[_0xfd40('0x39')]);switch(_0x29df8f[_0xfd40('0x39')]){case _0xfd40('0x67'):emit(util[_0xfd40('0x42')](_0xfd40('0x68'),_0x5330a1[_0xfd40('0x50')]),_0xfd40('0x69'),{'recordId':_0x4522c8['id']});break;case _0xfd40('0x6a'):emit(util[_0xfd40('0x42')]('user:%s',_0x5330a1[_0xfd40('0x50')]),_0xfd40('0x6b'),{'uri':util[_0xfd40('0x42')](_0xfd40('0x6c'),_0x106a6e[_0xfd40('0x6d')],_0x4522c8['id'])});break;default:logger[_0xfd40('0x6e')](_0xfd40('0x6f'));}})[_0xfd40('0x70')](function(_0xacbd74){logger[_0xfd40('0x6e')]('[QUEUE]',_0xacbd74);});};exports[_0xfd40('0x71')]=function(_0x27b826,_0x16dc99,_0xe78945,_0x56b2d0,_0xe7b1f5,_0x201456,_0x1d7c98){var _0x14e460,_0x4274da,_0x1289a6,_0x45a62e;_0x201456[_0xfd40('0x5a')]=intUtil[_0xfd40('0x5b')](_0x201456[_0xfd40('0x5a')]);_0x201456['remoteUri']=intUtil[_0xfd40('0x5b')](_0x201456[_0xfd40('0x55')]);if(_0x1d7c98&&_0x1d7c98[_0xfd40('0x72')]&&_0x1d7c98[_0xfd40('0x72')]!==_0xfd40('0x73')){logger['info']('[OUTBOUND]',_0xfd40('0x74'));_0x16dc99[_0xfd40('0x5d')]=util[_0xfd40('0x42')](_0xfd40('0x5e'),_0x201456[_0xfd40('0x5a')],_0x16dc99[_0xfd40('0x5f')],md5(_0x16dc99[_0xfd40('0x5f')]));}return getConnection(_0x201456)[_0xfd40('0x21')](function(_0x289891){_0x45a62e=_0x289891;return getUser(_0x201456,_0x56b2d0['email'],_0x45a62e);})[_0xfd40('0x21')](function(_0x27a6aa){_0x14e460=_0x27a6aa;return getEndUser(_0x201456,_0xe78945,_0x16dc99[_0xfd40('0x75')],_0x16dc99[_0xfd40('0x76')],_0x45a62e);})[_0xfd40('0x21')](function(_0x21a0f5){_0x4274da=_0x21a0f5;return getTicket(_0x201456,_0x14e460,_0x4274da,_0xe78945,_0x16dc99,_0xe78945[_0xfd40('0x63')],_0x45a62e,_0xfd40('0x71'));})['then'](function(_0x5f4a96){_0x1289a6=_0x5f4a96;logger[_0xfd40('0x1b')](_0xfd40('0x77'),_0x1289a6['id']);logger['info'](_0xfd40('0x78'),_0x1289a6['id'],_0x56b2d0[_0xfd40('0x50')],_0x201456[_0xfd40('0x39')]);switch(_0x201456['type']){case'integrationTab':emit(util[_0xfd40('0x42')]('user:%s',_0x56b2d0[_0xfd40('0x50')]),_0xfd40('0x69'),{'recordId':_0x1289a6['id']});break;case _0xfd40('0x6a'):emit(util[_0xfd40('0x42')](_0xfd40('0x68'),_0x56b2d0[_0xfd40('0x50')]),_0xfd40('0x6b'),{'uri':util['format'](_0xfd40('0x6c'),_0x45a62e[_0xfd40('0x6d')],_0x1289a6['id'])});break;default:logger[_0xfd40('0x6e')](_0xfd40('0x79'),_0xfd40('0x7a'));}})['catch'](function(_0x11d7dc){logger[_0xfd40('0x6e')](_0xfd40('0x79'),_0x11d7dc);});};exports['unmanaged']=function(_0x4f3fbe,_0x45e3a7,_0x3a0e10,_0x2c014b,_0x4600b0,_0x116fbe){var _0x51b19a,_0x4193eb,_0x3b04a1,_0x46bd50;_0x116fbe[_0xfd40('0x5a')]=intUtil[_0xfd40('0x5b')](_0x116fbe[_0xfd40('0x5a')]);_0x116fbe[_0xfd40('0x55')]=intUtil[_0xfd40('0x5b')](_0x116fbe['remoteUri']);if(_0x4600b0&&_0x4600b0[_0xfd40('0x7b')]){logger[_0xfd40('0x1b')]('['+_0x45e3a7[_0xfd40('0x7c')]['toUpperCase']()+']',_0xfd40('0x74'));_0x45e3a7['recordingURL']=util[_0xfd40('0x42')](_0xfd40('0x5e'),_0x116fbe[_0xfd40('0x5a')],_0x45e3a7['uniqueid'],md5(_0x45e3a7['uniqueid']));}else{_0x45e3a7[_0xfd40('0x5d')]='';}return getConnection(_0x116fbe)['then'](function(_0x104dee){_0x46bd50=_0x104dee;if(!_[_0xfd40('0x1d')](_0x2c014b)){return getUser(_0x116fbe,_0x2c014b['name'],_0x46bd50);}else{return getUser(_0x116fbe,null,_0x46bd50);}})['then'](function(_0x4fda65){_0x51b19a=_0x4fda65;return getEndUser(_0x116fbe,_0x3a0e10,_0x45e3a7[_0xfd40('0x61')],_0x45e3a7[_0xfd40('0x62')],_0x46bd50);})[_0xfd40('0x21')](function(_0x130bfc){_0x4193eb=_0x130bfc;return getTicket(_0x116fbe,_0x51b19a,_0x4193eb,_0x3a0e10,_0x45e3a7,_0x3a0e10[_0xfd40('0x63')],_0x46bd50);})[_0xfd40('0x21')](function(_0x5552ac){_0x3b04a1=_0x5552ac;logger[_0xfd40('0x1b')]('['+_0x45e3a7[_0xfd40('0x7c')]['toUpperCase']()+_0xfd40('0x7d'),_0x3b04a1['id']);logger[_0xfd40('0x1b')]('['+_0x45e3a7['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x116fbe[_0xfd40('0x39')]);})[_0xfd40('0x70')](function(_0x941a32){logger[_0xfd40('0x6e')]('['+_0x45e3a7['lastevent'][_0xfd40('0x7e')]()+']',_0x941a32);});}; \ 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 c468c5a..6880a81 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 _0x2e52=['Incident\x20-\x20','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','format','remoteUri','isNil','email','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','ioredis','./util','servicenow','redis','localhost','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','error','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','catch','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','incident'];(function(_0x5d4366,_0x1ea497){var _0x373165=function(_0x3d0da1){while(--_0x3d0da1){_0x5d4366['push'](_0x5d4366['shift']());}};_0x373165(++_0x1ea497);}(_0x2e52,0x1d8));var _0x22e5=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x2e52[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x22e5('0x0'));var Promise=require(_0x22e5('0x1'));var rp=require(_0x22e5('0x2'));var util=require(_0x22e5('0x3'));var md5=require('md5');var Redis=require(_0x22e5('0x4'));var intUtil=require(_0x22e5('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x22e5('0x6'));config[_0x22e5('0x7')]=_['defaults'](config['redis'],{'host':_0x22e5('0x8'),'port':0x18eb});var io=require(_0x22e5('0x9'))(new Redis(config[_0x22e5('0x7')]));function getAdminUser(_0xdfbc7,_0x1d5d6e,_0x42459e,_0x1f4f08,_0x21fcd3,_0x250002){return new Promise(function(_0x136292,_0x522abd){var _0x205a9e={'method':_0x22e5('0xa'),'uri':_0x1f4f08+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x21fcd3+'&'+_0x250002,'auth':_0x1d5d6e,'json':!![]};return rp(_0x205a9e)[_0x22e5('0xb')](function(_0x4af649){if(_0x4af649[_0x22e5('0xc')][_0x22e5('0xd')]>0x0){_0x42459e[_0x22e5('0xe')]=_0x4af649[_0x22e5('0xc')][0x0][_0x22e5('0xf')];}logger[_0x22e5('0x10')]('['+[_0xdfbc7[_0x22e5('0x11')]()]+'],\x20getAdminUser\x20crm',_0x42459e);_0x136292(_0x42459e);})['catch'](function(_0x4140fa){logger[_0x22e5('0x12')]('['+[_0xdfbc7[_0x22e5('0x11')]()]+']',_0x4140fa['message']);_0x522abd(_0x4140fa['message']);});});}function getUser(_0x5aab0e,_0x36cf22,_0x25beb2,_0x39859a,_0xb4edaf){return function(_0x5aec4b){logger['info']('['+[_0x5aab0e[_0x22e5('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x5aec4b);return new Promise(function(_0x18730f,_0x21f0d1){if(intUtil[_0x22e5('0x13')](_0x5aec4b[_0x22e5('0x14')])){var _0xd678f6={'method':'GET','uri':_0x25beb2+_0x22e5('0x15')+_0x5aec4b[_0x22e5('0x14')]+'&'+_0x39859a+'&'+_0xb4edaf,'auth':_0x36cf22,'json':!![]};logger[_0x22e5('0x10')]('['+[_0x5aab0e['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xd678f6);return rp(_0xd678f6)['then'](function(_0x5ed7fe){logger[_0x22e5('0x10')]('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x16'),_0x5ed7fe);if(_0x5ed7fe['result']['length']>0x0&&String(_0x5ed7fe[_0x22e5('0xc')][0x0][_0x22e5('0x17')])===_0x22e5('0x18')){_0x5aec4b[_0x22e5('0x19')]=_0x5ed7fe[_0x22e5('0xc')][0x0][_0x22e5('0xf')];}else{_0x5aec4b[_0x22e5('0x19')]=_0x5aec4b['adminId'];_0x5aec4b[_0x22e5('0x14')]=_0x5aec4b[_0x22e5('0x1a')];}logger['info']('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x1b'),_0x5aec4b);_0x18730f(_0x5aec4b);})['catch'](function(_0x2dc17a){logger['error']('['+[_0x5aab0e[_0x22e5('0x11')]()]+']',_0x2dc17a[_0x22e5('0x1c')]);_0x21f0d1(_0x2dc17a[_0x22e5('0x1c')]);});}else{logger[_0x22e5('0x10')]('['+[_0x5aab0e[_0x22e5('0x11')]()]+_0x22e5('0x1d'));_0x5aec4b[_0x22e5('0x19')]=_0x5aec4b[_0x22e5('0xe')];_0x5aec4b[_0x22e5('0x14')]=_0x5aec4b[_0x22e5('0x1a')];_0x18730f(_0x5aec4b);}});};}function createEndUser(_0x2d511a,_0x6d02a0,_0xd44e82,_0x1acdd2,_0x309999){logger['info']('['+[_0x2d511a['toUpperCase']()]+_0x22e5('0x1e'),_0xd44e82);return new Promise(function(_0x20bbe5,_0x185f40){var _0x16f479={'method':'POST','uri':_0x1acdd2+_0x22e5('0x1f')+_0x309999,'body':{'user_name':_0xd44e82[_0x22e5('0x20')],'roles':_0x22e5('0x21'),'first_name':_0xd44e82[_0x22e5('0x20')],'active':_0x22e5('0x18'),'date_format':_0x22e5('0x22'),'phone':_0xd44e82[_0x22e5('0x20')]},'auth':_0x6d02a0,'json':!![]};return rp(_0x16f479)[_0x22e5('0xb')](function(_0x466c92){logger[_0x22e5('0x10')]('['+[_0x2d511a[_0x22e5('0x11')]()]+_0x22e5('0x23'),_0x466c92[_0x22e5('0xc')]);_0xd44e82[_0x22e5('0x24')]=_0x466c92[_0x22e5('0xc')][_0x22e5('0xf')];_0x20bbe5(_0xd44e82);})['catch'](function(_0x3a7758){logger[_0x22e5('0x12')]('['+[_0x2d511a[_0x22e5('0x11')]()]+']',_0x3a7758[_0x22e5('0x1c')]);_0x185f40(_0x3a7758[_0x22e5('0x1c')]);});});}function getEndUser(_0x3fb12b,_0x2f1fc9,_0xd7bea2,_0x388ea4,_0x3fda5f){return function(_0x8aa05d){logger[_0x22e5('0x10')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+_0x22e5('0x25'),_0x8aa05d);return new Promise(function(_0xc61839,_0xe641cc){var _0x30b7a7={'method':'GET','uri':_0xd7bea2+_0x22e5('0x26')+_0x8aa05d[_0x22e5('0x20')]+'&'+_0x388ea4+'&'+_0x3fda5f,'auth':_0x2f1fc9,'json':!![]};return rp(_0x30b7a7)[_0x22e5('0xb')](function(_0x993a8d){if(_0x993a8d[_0x22e5('0xc')]['length']>0x0){_0x8aa05d['endUserId']=_0x993a8d['result'][0x0][_0x22e5('0xf')];logger[_0x22e5('0x10')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+'],\x20getEndUser\x20crm',_0x8aa05d);_0xc61839(_0x8aa05d);}else{return createEndUser(_0x3fb12b,_0x2f1fc9,_0x8aa05d,_0xd7bea2,_0x388ea4)[_0x22e5('0xb')](function(_0x4baaba){logger['info']('['+[_0x3fb12b[_0x22e5('0x11')]()]+_0x22e5('0x27'),_0x4baaba);_0xc61839(_0x4baaba);});}})[_0x22e5('0x28')](function(_0xec2438){logger[_0x22e5('0x12')]('['+[_0x3fb12b[_0x22e5('0x11')]()]+']',_0xec2438[_0x22e5('0x1c')]);_0xe641cc(_0xec2438['message']);});});};}function getCustomFields(_0x490b25,_0x64d247){var _0x8659f={};if(_0x490b25[_0x22e5('0xd')]>0x0){_['forEach'](_0x490b25,function(_0x1dc5a0){if(_[_0x22e5('0x29')]([_0x22e5('0x2a'),_0x22e5('0x2b')],_0x1dc5a0['type'])&&_0x1dc5a0[_0x22e5('0x2c')]&&!_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0[_0x22e5('0x2c')][_0x22e5('0x2e')]()]=_0x1dc5a0[_0x22e5('0x2f')][_0x22e5('0x30')]();}else if(_[_0x22e5('0x29')](['string',_0x22e5('0x2b')],_0x1dc5a0[_0x22e5('0x31')])&&_0x1dc5a0['idField']&&_0x1dc5a0['customField']){_0x8659f[_0x1dc5a0[_0x22e5('0x32')][_0x22e5('0x2e')]()]=_0x1dc5a0['content'][_0x22e5('0x30')]();}else if(_0x1dc5a0[_0x22e5('0x31')]===_0x22e5('0x33')&&_0x1dc5a0['variableName']&&_0x1dc5a0[_0x22e5('0x32')]&&_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0['idField'][_0x22e5('0x2e')]()]=_0x64d247[_0x1dc5a0['variableName']]['toString']();}else if(_0x1dc5a0[_0x22e5('0x31')]===_0x22e5('0x34')&&_0x1dc5a0[_0x22e5('0x35')]&&_0x1dc5a0['Variable']['name']&&_0x1dc5a0['idField']&&_0x1dc5a0[_0x22e5('0x2d')]){_0x8659f[_0x1dc5a0[_0x22e5('0x32')][_0x22e5('0x2e')]()]=_0x64d247[_0x1dc5a0[_0x22e5('0x35')][_0x22e5('0x36')][_0x22e5('0x2e')]()][_0x22e5('0x30')]();}});}return _0x8659f;}function getTicket(_0x376168,_0x31ef9e,_0x572199,_0x460692,_0x432a11,_0x116d00){return function(_0x2a812d){logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x37'),_0x2a812d);return new Promise(function(_0x2ca47a,_0x51926c){var _0x5ed245=_0x376168[_0x22e5('0x2e')]()==='outbound'?_0x2a812d[_0x22e5('0x19')]:_0x2a812d['endUserId'];var _0x44b3d3={'method':_0x22e5('0x38'),'uri':_0x572199+'incident'+'?'+_0x116d00,'body':Object[_0x22e5('0x39')]({},{'active':'true','caller_id':_0x5ed245,'assigned_to':_0x2a812d[_0x22e5('0x19')],'short_description':intUtil[_0x22e5('0x3a')](_0x460692['Subjects'],_0x432a11,'\x20'),'description':intUtil[_0x22e5('0x3a')](_0x460692[_0x22e5('0x3b')],_0x432a11,'\x0a')},getCustomFields(_0x460692[_0x22e5('0x3c')],_0x432a11)),'auth':_0x31ef9e,'json':!![]};return rp(_0x44b3d3)[_0x22e5('0xb')](function(_0x2fc012){logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x3d'),_0x2fc012[_0x22e5('0xc')]);_0x2a812d[_0x22e5('0x3e')]=_0x2fc012[_0x22e5('0xc')]['sys_id'];_0x2a812d[_0x22e5('0x3f')]=_0x2fc012['result']['number'];logger[_0x22e5('0x10')]('['+[_0x376168[_0x22e5('0x11')]()]+_0x22e5('0x40'),_0x2a812d);_0x2ca47a(_0x2a812d);})[_0x22e5('0x28')](function(_0x2b8c0e){logger[_0x22e5('0x12')]('['+[_0x376168['toUpperCase']()]+']',_0x2b8c0e['message']);_0x51926c(_0x2b8c0e[_0x22e5('0x1c')]);});});};}function createRemoteTag(_0x4e08be,_0x59359a,_0x384a5d,_0x8c9b4a){return new Promise(function(_0x5a45a5,_0x250820){var _0x4850ed={'method':_0x22e5('0x38'),'uri':_0x384a5d+_0x22e5('0x41')+'?'+_0x8c9b4a,'body':{'short_description':_0x4e08be,'global':!![],'active':!![],'name':_0x4e08be},'auth':_0x59359a,'json':!![]};return rp(_0x4850ed)[_0x22e5('0xb')](function(_0x38585f){var _0x46a6bb=_0x38585f[_0x22e5('0xc')][_0x22e5('0xf')];_0x5a45a5(_0x46a6bb);});});}function getRemoteTag(_0x30357e,_0x15b7aa,_0x26fdd4,_0x171ba1,_0x5e7a6f){return new Promise(function(_0x3facbb,_0x4c9072){var _0x307ef0={'method':_0x22e5('0xa'),'uri':_0x26fdd4+_0x22e5('0x41')+'?sysparm_query=name%3D'+_0x30357e+'&'+_0x171ba1,'auth':_0x15b7aa,'json':!![]};return rp(_0x307ef0)[_0x22e5('0xb')](function(_0x34250d){if(_0x34250d[_0x22e5('0xc')]['length']>0x0){var _0x5291be=_0x34250d[_0x22e5('0xc')][0x0][_0x22e5('0xf')];_0x3facbb(_0x5291be);}else{return createRemoteTag(_0x30357e,_0x15b7aa,_0x26fdd4,_0x171ba1)['then'](function(_0x400b64){_0x3facbb(_0x400b64);});}});});}function assignTagToIncident(_0xffd22c,_0x4eb0cf,_0x29fb42,_0x299da9,_0x13e277){return new Promise(function(_0x3763ab,_0x40c700){var _0x146507={'method':'POST','uri':_0x29fb42+_0x22e5('0x42')+'?'+_0x13e277,'body':{'label':_0xffd22c,'table':_0x22e5('0x43'),'id_type':'Incident','table_key':_0x299da9[_0x22e5('0x3e')],'title':_0x22e5('0x44')+_0x299da9[_0x22e5('0x3f')],'id_display':_0x299da9[_0x22e5('0x3f')]},'auth':_0x4eb0cf,'json':!![]};return rp(_0x146507)['then'](function(_0x5e9412){_0x3763ab();})['catch'](function(){_0x3763ab();});});}function manageTags(_0x2b5491,_0xbbed07,_0x244dca,_0x1da435,_0x1b2107,_0x494316,_0x4c7340){return new Promise(function(_0x296a1b,_0x38f340){var _0x451141=[];_0xbbed07[_0x22e5('0x45')](function(_0x1cb009){_0x451141[_0x22e5('0x46')](getRemoteTag(_0x1cb009,_0x244dca,_0x1da435,_0x494316,_0x4c7340));});return Promise[_0x22e5('0x47')](_0x451141)['then'](function(_0x4cdaee){if(_0x4cdaee[_0x22e5('0xd')]){logger[_0x22e5('0x10')]('['+[_0x2b5491['toUpperCase']()]+_0x22e5('0x48'),_0x4cdaee);var _0x5e00ae=[];_0x4cdaee[_0x22e5('0x45')](function(_0x3e5c6d){_0x5e00ae[_0x22e5('0x46')](assignTagToIncident(_0x3e5c6d,_0x244dca,_0x1da435,_0x1b2107,_0x494316));});return Promise[_0x22e5('0x47')](_0x5e00ae)[_0x22e5('0xb')](function(){_0x296a1b();})[_0x22e5('0x28')](function(){_0x296a1b();});}else{_0x296a1b();}});});}function getTags(_0x66b209,_0x55792b,_0x163497,_0x3ff498,_0x2f16db,_0x1ec68d){return function(_0x36c2ec){return new Promise(function(_0x530d27,_0x36f619){var _0x5a7574=[];var _0x12d441=_0x3ff498[_0x22e5('0x49')];if(_0x12d441&&_0x12d441[_0x22e5('0xd')]>0x0){_0x5a7574=_['map'](_0x12d441,_0x22e5('0x36'));}if(_0x5a7574[_0x22e5('0xd')]>0x0){return manageTags(_0x66b209,_0x5a7574,_0x55792b,_0x163497,_0x36c2ec,_0x2f16db,_0x1ec68d)['then'](function(){_0x530d27(_0x36c2ec);});}else{_0x530d27(_0x36c2ec);}});};}function emit(_0x5e91b5,_0x315334,_0x37e7b4){var _0x1626ad=_0x22e5('0x4a')+_0x22e5('0x4b')+_0x22e5('0x4c')+'%255EORDERBYDESCnumber';var _0x458b9a={'uri':_0x5e91b5+_0x22e5('0x4d')+_0x37e7b4+_0x1626ad};io['to'](util['format'](_0x22e5('0x4e'),_0x315334))[_0x22e5('0x4f')](_0x22e5('0x50'),_0x458b9a);}exports['cs']=function(_0x178089,_0x5984d6,_0x407068,_0x40b53a,_0x312083,_0x3073f6,_0x1cd5bb,_0x101ed8){var _0x4862cc={};var _0x403c9d={'user':_0x3073f6[_0x22e5('0x51')],'pass':_0x3073f6[_0x22e5('0x52')]};var _0x49786e=_0x22e5('0x53');var _0x51ad89=_0x22e5('0x54');_0x3073f6['remoteUri']=intUtil['stripTrailingSlash'](_0x3073f6['remoteUri']);_0x3073f6[_0x22e5('0x55')]=intUtil[_0x22e5('0x56')](_0x3073f6[_0x22e5('0x55')]);var _0x58ee88=util[_0x22e5('0x57')]('%s/api/now/table/',_0x3073f6[_0x22e5('0x58')]);_0x4862cc['userEmail']=!_[_0x22e5('0x59')](_0x40b53a)?_0x40b53a['email']:null;_0x4862cc[_0x22e5('0x1a')]=_0x3073f6[_0x22e5('0x5a')];_0x4862cc[_0x22e5('0x20')]=_0x101ed8[_0x22e5('0x2e')]()===_0x22e5('0x5b')?_0x5984d6['destcalleridnum']:_0x5984d6[_0x22e5('0x5c')];_0x4862cc[_0x22e5('0x5d')]=_0x101ed8===_0x22e5('0x5e')||_0x101ed8===_0x22e5('0x5f')?_0x22e5('0x5e'):_0x22e5('0x5b');var _0x35f833=util[_0x22e5('0x57')](_0x22e5('0x60'),_0x3073f6['serverUrl'],_0x5984d6['uniqueid'],md5(_0x5984d6['uniqueid']));if(_0x312083&&_0x312083[_0x22e5('0x61')]){logger[_0x22e5('0x10')](_0x22e5('0x62'),'Recording\x20is\x20enabled!');_0x5984d6[_0x22e5('0x63')]=_0x35f833;}else if(_0x1cd5bb&&_0x1cd5bb[_0x22e5('0x64')]&&_0x1cd5bb[_0x22e5('0x64')]!==_0x22e5('0x65')){logger[_0x22e5('0x10')](_0x22e5('0x66'),_0x22e5('0x67'));_0x5984d6[_0x22e5('0x63')]=_0x35f833;}else{_0x5984d6[_0x22e5('0x63')]='';}return getAdminUser(_0x101ed8,_0x403c9d,_0x4862cc,_0x58ee88,_0x51ad89,_0x49786e)[_0x22e5('0xb')](getUser(_0x101ed8,_0x403c9d,_0x58ee88,_0x51ad89,_0x49786e))['then'](getEndUser(_0x101ed8,_0x403c9d,_0x58ee88,_0x51ad89,_0x49786e))['then'](getTicket(_0x101ed8,_0x403c9d,_0x58ee88,_0x407068,_0x5984d6,_0x51ad89))[_0x22e5('0xb')](function(_0x3560c0){logger['info'](util[_0x22e5('0x57')](_0x22e5('0x68'),_0x3560c0[_0x22e5('0x3e')]));logger['info'](util[_0x22e5('0x57')](_0x22e5('0x69'),_0x101ed8));if(_0x101ed8!==_0x22e5('0x5f')){logger['info']('['+[_0x101ed8[_0x22e5('0x11')]()]+']',_0x22e5('0x6a'));emit(_0x3073f6[_0x22e5('0x58')],_0x40b53a[_0x22e5('0x36')],_0x3560c0[_0x22e5('0x3e')]);}})[_0x22e5('0x28')](function(_0x1891c9){logger['error']('['+[_0x101ed8[_0x22e5('0x11')]()]+_0x22e5('0x6b'),util['inspect'](_0x1891c9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5dc4=['redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','active','true','userId','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','user','endUserNumber','System','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','customField','nameField','content','toString','includes','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','incident','Incident','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','adminEmail','calleridnum','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger'];(function(_0x8e2219,_0x2443ef){var _0x3974fc=function(_0x2c7d96){while(--_0x2c7d96){_0x8e2219['push'](_0x8e2219['shift']());}};_0x3974fc(++_0x2443ef);}(_0x5dc4,0x65));var _0x45dc=function(_0x4157a5,_0x336a94){_0x4157a5=_0x4157a5-0x0;var _0x124c28=_0x5dc4[_0x4157a5];return _0x124c28;};'use strict';var _=require(_0x45dc('0x0'));var Promise=require(_0x45dc('0x1'));var rp=require(_0x45dc('0x2'));var util=require('util');var md5=require(_0x45dc('0x3'));var Redis=require(_0x45dc('0x4'));var intUtil=require(_0x45dc('0x5'));var config=require(_0x45dc('0x6'));var logger=require(_0x45dc('0x7'))('servicenow');config[_0x45dc('0x8')]=_[_0x45dc('0x9')](config[_0x45dc('0x8')],{'host':_0x45dc('0xa'),'port':0x18eb});var io=require(_0x45dc('0xb'))(new Redis(config['redis']));function getAdminUser(_0x4244cd,_0x53bea2,_0x6b8f92,_0x33abeb,_0x4d01d8,_0x49bd4e){return new Promise(function(_0x515ffb,_0x5c9aa9){var _0x2e347f={'method':'GET','uri':_0x33abeb+_0x45dc('0xc')+'&'+_0x4d01d8+'&'+_0x49bd4e,'auth':_0x53bea2,'json':!![]};return rp(_0x2e347f)[_0x45dc('0xd')](function(_0x17435c){if(_0x17435c[_0x45dc('0xe')][_0x45dc('0xf')]>0x0){_0x6b8f92[_0x45dc('0x10')]=_0x17435c[_0x45dc('0xe')][0x0][_0x45dc('0x11')];}logger[_0x45dc('0x12')]('['+[_0x4244cd['toUpperCase']()]+_0x45dc('0x13'),_0x6b8f92);_0x515ffb(_0x6b8f92);})[_0x45dc('0x14')](function(_0x5983a2){logger[_0x45dc('0x15')]('['+[_0x4244cd[_0x45dc('0x16')]()]+']',_0x5983a2[_0x45dc('0x17')]);_0x5c9aa9(_0x5983a2[_0x45dc('0x17')]);});});}function getUser(_0x14e433,_0x418b03,_0x491297,_0x1c9ba2,_0x33d312){return function(_0x48a415){logger[_0x45dc('0x12')]('['+[_0x14e433[_0x45dc('0x16')]()]+_0x45dc('0x18'),_0x48a415);return new Promise(function(_0x557662,_0xd499d1){if(intUtil[_0x45dc('0x19')](_0x48a415[_0x45dc('0x1a')])){var _0x5e3202={'method':'GET','uri':_0x491297+'sys_user?sysparm_query=email%3D'+_0x48a415['userEmail']+'&'+_0x1c9ba2+'&'+_0x33d312,'auth':_0x418b03,'json':!![]};logger['info']('['+[_0x14e433[_0x45dc('0x16')]()]+_0x45dc('0x1b'),_0x5e3202);return rp(_0x5e3202)['then'](function(_0xdda064){logger['info']('['+[_0x14e433[_0x45dc('0x16')]()]+'],\x20getUser\x20entity',_0xdda064);if(_0xdda064[_0x45dc('0xe')][_0x45dc('0xf')]>0x0&&String(_0xdda064[_0x45dc('0xe')][0x0][_0x45dc('0x1c')])===_0x45dc('0x1d')){_0x48a415[_0x45dc('0x1e')]=_0xdda064[_0x45dc('0xe')][0x0][_0x45dc('0x11')];}else{_0x48a415[_0x45dc('0x1e')]=_0x48a415[_0x45dc('0x10')];_0x48a415[_0x45dc('0x1a')]=_0x48a415['adminEmail'];}logger[_0x45dc('0x12')]('['+[_0x14e433['toUpperCase']()]+_0x45dc('0x1f'),_0x48a415);_0x557662(_0x48a415);})['catch'](function(_0x27e614){logger['error']('['+[_0x14e433[_0x45dc('0x16')]()]+']',_0x27e614[_0x45dc('0x17')]);_0xd499d1(_0x27e614[_0x45dc('0x17')]);});}else{logger['info']('['+[_0x14e433[_0x45dc('0x16')]()]+']\x20using\x20admin\x20profile');_0x48a415[_0x45dc('0x1e')]=_0x48a415[_0x45dc('0x10')];_0x48a415['userEmail']=_0x48a415['adminEmail'];_0x557662(_0x48a415);}});};}function createEndUser(_0x5ddb1e,_0x11e472,_0x549601,_0xcd564e,_0x2eb93c){logger[_0x45dc('0x12')]('['+[_0x5ddb1e[_0x45dc('0x16')]()]+_0x45dc('0x20'),_0x549601);return new Promise(function(_0x483686,_0x52bf47){var _0x153d2a={'method':_0x45dc('0x21'),'uri':_0xcd564e+'sys_user?'+_0x2eb93c,'body':{'user_name':_0x549601['endUserNumber'],'roles':_0x45dc('0x22'),'first_name':_0x549601[_0x45dc('0x23')],'active':_0x45dc('0x1d'),'date_format':_0x45dc('0x24'),'phone':_0x549601['endUserNumber']},'auth':_0x11e472,'json':!![]};return rp(_0x153d2a)['then'](function(_0xf0bd98){logger[_0x45dc('0x12')]('['+[_0x5ddb1e['toUpperCase']()]+'],\x20EndUser\x20schema',_0xf0bd98['result']);_0x549601['endUserId']=_0xf0bd98[_0x45dc('0xe')]['sys_id'];_0x483686(_0x549601);})[_0x45dc('0x14')](function(_0xab089){logger[_0x45dc('0x15')]('['+[_0x5ddb1e[_0x45dc('0x16')]()]+']',_0xab089[_0x45dc('0x17')]);_0x52bf47(_0xab089['message']);});});}function getEndUser(_0xc5e780,_0x2560de,_0x319a28,_0x194584,_0x1008fc){return function(_0x55bc1c){logger[_0x45dc('0x12')]('['+[_0xc5e780['toUpperCase']()]+_0x45dc('0x25'),_0x55bc1c);return new Promise(function(_0x5cc136,_0x200197){var _0x2000fb={'method':_0x45dc('0x26'),'uri':_0x319a28+_0x45dc('0x27')+_0x55bc1c['endUserNumber']+'&'+_0x194584+'&'+_0x1008fc,'auth':_0x2560de,'json':!![]};return rp(_0x2000fb)['then'](function(_0x4a9d7c){if(_0x4a9d7c['result'][_0x45dc('0xf')]>0x0){_0x55bc1c[_0x45dc('0x28')]=_0x4a9d7c[_0x45dc('0xe')][0x0][_0x45dc('0x11')];logger[_0x45dc('0x12')]('['+[_0xc5e780[_0x45dc('0x16')]()]+_0x45dc('0x29'),_0x55bc1c);_0x5cc136(_0x55bc1c);}else{return createEndUser(_0xc5e780,_0x2560de,_0x55bc1c,_0x319a28,_0x194584)[_0x45dc('0xd')](function(_0x5e1e7c){logger[_0x45dc('0x12')]('['+[_0xc5e780['toUpperCase']()]+_0x45dc('0x2a'),_0x5e1e7c);_0x5cc136(_0x5e1e7c);});}})[_0x45dc('0x14')](function(_0x15176f){logger[_0x45dc('0x15')]('['+[_0xc5e780['toUpperCase']()]+']',_0x15176f[_0x45dc('0x17')]);_0x200197(_0x15176f['message']);});});};}function getCustomFields(_0x505f3d,_0x5f3e1e){var _0x1b51c0={};if(_0x505f3d[_0x45dc('0xf')]>0x0){_['forEach'](_0x505f3d,function(_0x1642e7){if(_['includes']([_0x45dc('0x2b'),_0x45dc('0x2c')],_0x1642e7[_0x45dc('0x2d')])&&_0x1642e7['nameField']&&!_0x1642e7[_0x45dc('0x2e')]){_0x1b51c0[_0x1642e7[_0x45dc('0x2f')]['toLowerCase']()]=_0x1642e7[_0x45dc('0x30')][_0x45dc('0x31')]();}else if(_[_0x45dc('0x32')](['string',_0x45dc('0x2c')],_0x1642e7[_0x45dc('0x2d')])&&_0x1642e7[_0x45dc('0x33')]&&_0x1642e7['customField']){_0x1b51c0[_0x1642e7[_0x45dc('0x33')][_0x45dc('0x34')]()]=_0x1642e7[_0x45dc('0x30')][_0x45dc('0x31')]();}else if(_0x1642e7[_0x45dc('0x2d')]===_0x45dc('0x35')&&_0x1642e7[_0x45dc('0x36')]&&_0x1642e7[_0x45dc('0x33')]&&_0x1642e7[_0x45dc('0x2e')]){_0x1b51c0[_0x1642e7[_0x45dc('0x33')][_0x45dc('0x34')]()]=_0x5f3e1e[_0x1642e7[_0x45dc('0x36')]][_0x45dc('0x31')]();}else if(_0x1642e7['type']===_0x45dc('0x37')&&_0x1642e7[_0x45dc('0x38')]&&_0x1642e7[_0x45dc('0x38')][_0x45dc('0x39')]&&_0x1642e7['idField']&&_0x1642e7[_0x45dc('0x2e')]){_0x1b51c0[_0x1642e7[_0x45dc('0x33')][_0x45dc('0x34')]()]=_0x5f3e1e[_0x1642e7[_0x45dc('0x38')][_0x45dc('0x39')][_0x45dc('0x34')]()][_0x45dc('0x31')]();}});}return _0x1b51c0;}function getTicket(_0x1fc84f,_0x3e41f5,_0x5016f9,_0x3510e4,_0x2244c5,_0x336993){return function(_0x3a93f5){logger[_0x45dc('0x12')]('['+[_0x1fc84f['toUpperCase']()]+_0x45dc('0x3a'),_0x3a93f5);return new Promise(function(_0x12503e,_0x181c27){var _0x5e98c3=_0x1fc84f[_0x45dc('0x34')]()===_0x45dc('0x3b')?_0x3a93f5[_0x45dc('0x1e')]:_0x3a93f5[_0x45dc('0x28')];var _0x3b7f39={'method':_0x45dc('0x21'),'uri':_0x5016f9+'incident'+'?'+_0x336993,'body':Object[_0x45dc('0x3c')]({},{'active':_0x45dc('0x1d'),'caller_id':_0x5e98c3,'assigned_to':_0x3a93f5[_0x45dc('0x1e')],'short_description':intUtil['getString'](_0x3510e4['Subjects'],_0x2244c5,'\x20'),'description':intUtil[_0x45dc('0x3d')](_0x3510e4[_0x45dc('0x3e')],_0x2244c5,'\x0a')},getCustomFields(_0x3510e4[_0x45dc('0x3f')],_0x2244c5)),'auth':_0x3e41f5,'json':!![]};return rp(_0x3b7f39)[_0x45dc('0xd')](function(_0x28b068){logger[_0x45dc('0x12')]('['+[_0x1fc84f[_0x45dc('0x16')]()]+_0x45dc('0x40'),_0x28b068['result']);_0x3a93f5[_0x45dc('0x41')]=_0x28b068[_0x45dc('0xe')]['sys_id'];_0x3a93f5[_0x45dc('0x42')]=_0x28b068['result'][_0x45dc('0x43')];logger[_0x45dc('0x12')]('['+[_0x1fc84f[_0x45dc('0x16')]()]+_0x45dc('0x44'),_0x3a93f5);_0x12503e(_0x3a93f5);})[_0x45dc('0x14')](function(_0x3d1117){logger[_0x45dc('0x15')]('['+[_0x1fc84f[_0x45dc('0x16')]()]+']',_0x3d1117['message']);_0x181c27(_0x3d1117[_0x45dc('0x17')]);});});};}function createRemoteTag(_0x379b44,_0x40a5ee,_0x98e6ea,_0x9eb670){return new Promise(function(_0x573f87,_0x18a5b){var _0x1e3437={'method':_0x45dc('0x21'),'uri':_0x98e6ea+_0x45dc('0x45')+'?'+_0x9eb670,'body':{'short_description':_0x379b44,'global':!![],'active':!![],'name':_0x379b44},'auth':_0x40a5ee,'json':!![]};return rp(_0x1e3437)[_0x45dc('0xd')](function(_0x380211){var _0x31dcaa=_0x380211[_0x45dc('0xe')]['sys_id'];_0x573f87(_0x31dcaa);});});}function getRemoteTag(_0x4648f3,_0x219df6,_0x3a218b,_0x5efdd9,_0x36b2d5){return new Promise(function(_0x2e4e4c,_0x1226c9){var _0x47b12c={'method':_0x45dc('0x26'),'uri':_0x3a218b+_0x45dc('0x45')+'?sysparm_query=name%3D'+_0x4648f3+'&'+_0x5efdd9,'auth':_0x219df6,'json':!![]};return rp(_0x47b12c)['then'](function(_0x429e5f){if(_0x429e5f['result'][_0x45dc('0xf')]>0x0){var _0x47834f=_0x429e5f[_0x45dc('0xe')][0x0]['sys_id'];_0x2e4e4c(_0x47834f);}else{return createRemoteTag(_0x4648f3,_0x219df6,_0x3a218b,_0x5efdd9)[_0x45dc('0xd')](function(_0xf26e9){_0x2e4e4c(_0xf26e9);});}});});}function assignTagToIncident(_0x21902d,_0x594593,_0x30e42f,_0x14bbef,_0x2c31b3){return new Promise(function(_0x321370,_0x300a10){var _0x300044={'method':_0x45dc('0x21'),'uri':_0x30e42f+'label_entry'+'?'+_0x2c31b3,'body':{'label':_0x21902d,'table':_0x45dc('0x46'),'id_type':_0x45dc('0x47'),'table_key':_0x14bbef['ticketId'],'title':'Incident\x20-\x20'+_0x14bbef[_0x45dc('0x42')],'id_display':_0x14bbef[_0x45dc('0x42')]},'auth':_0x594593,'json':!![]};return rp(_0x300044)[_0x45dc('0xd')](function(_0x39eb08){_0x321370();})[_0x45dc('0x14')](function(){_0x321370();});});}function manageTags(_0x20cdf5,_0x559a94,_0x2c4ba3,_0x1d04e8,_0x5d7966,_0x11451c,_0x5426d3){return new Promise(function(_0x54d17d,_0x505362){var _0x52a9ab=[];_0x559a94[_0x45dc('0x48')](function(_0x1fd6a1){_0x52a9ab[_0x45dc('0x49')](getRemoteTag(_0x1fd6a1,_0x2c4ba3,_0x1d04e8,_0x11451c,_0x5426d3));});return Promise['all'](_0x52a9ab)[_0x45dc('0xd')](function(_0x486fb8){if(_0x486fb8[_0x45dc('0xf')]){logger['info']('['+[_0x20cdf5['toUpperCase']()]+_0x45dc('0x4a'),_0x486fb8);var _0x1dc4ec=[];_0x486fb8[_0x45dc('0x48')](function(_0x1149aa){_0x1dc4ec[_0x45dc('0x49')](assignTagToIncident(_0x1149aa,_0x2c4ba3,_0x1d04e8,_0x5d7966,_0x11451c));});return Promise['all'](_0x1dc4ec)[_0x45dc('0xd')](function(){_0x54d17d();})['catch'](function(){_0x54d17d();});}else{_0x54d17d();}});});}function getTags(_0x27819e,_0xa3d60,_0x239939,_0x2bbfd9,_0x7662cf,_0x2cc4ea){return function(_0x11103a){return new Promise(function(_0x339a6e,_0x379bee){var _0x1d5dfc=[];var _0x26085a=_0x2bbfd9['Tags'];if(_0x26085a&&_0x26085a[_0x45dc('0xf')]>0x0){_0x1d5dfc=_[_0x45dc('0x4b')](_0x26085a,'name');}if(_0x1d5dfc[_0x45dc('0xf')]>0x0){return manageTags(_0x27819e,_0x1d5dfc,_0xa3d60,_0x239939,_0x11103a,_0x7662cf,_0x2cc4ea)[_0x45dc('0xd')](function(){_0x339a6e(_0x11103a);});}else{_0x339a6e(_0x11103a);}});};}function emit(_0x500df9,_0x52fe3a,_0x2387de){var _0x8760d2=_0x45dc('0x4c')+_0x45dc('0x4d')+_0x45dc('0x4e')+_0x45dc('0x4f');var _0x44e6d8={'uri':_0x500df9+_0x45dc('0x50')+_0x2387de+_0x8760d2};io['to'](util['format'](_0x45dc('0x51'),_0x52fe3a))[_0x45dc('0x52')](_0x45dc('0x53'),_0x44e6d8);}exports['cs']=function(_0x52d156,_0xa81a6b,_0x257cc4,_0x467cd2,_0x3b0783,_0x3912d5,_0x21a1e7,_0x259321){var _0x3f2b74={};var _0x1ecac4={'user':_0x3912d5[_0x45dc('0x54')],'pass':_0x3912d5[_0x45dc('0x55')]};var _0x164721=_0x45dc('0x56');var _0xc20017='sysparm_display_value=true';_0x3912d5[_0x45dc('0x57')]=intUtil['stripTrailingSlash'](_0x3912d5['remoteUri']);_0x3912d5[_0x45dc('0x58')]=intUtil[_0x45dc('0x59')](_0x3912d5[_0x45dc('0x58')]);var _0x557509=util['format'](_0x45dc('0x5a'),_0x3912d5['remoteUri']);_0x3f2b74[_0x45dc('0x1a')]=!_[_0x45dc('0x5b')](_0x467cd2)?_0x467cd2[_0x45dc('0x5c')]:null;_0x3f2b74[_0x45dc('0x5d')]=_0x3912d5['email'];_0x3f2b74['endUserNumber']=_0x259321['toLowerCase']()===_0x45dc('0x3b')?_0xa81a6b['destcalleridnum']:_0xa81a6b[_0x45dc('0x5e')];_0x3f2b74['callDirection']=_0x259321===_0x45dc('0x5f')||_0x259321===_0x45dc('0x60')?_0x45dc('0x5f'):_0x45dc('0x3b');var _0x3faabf=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3912d5[_0x45dc('0x58')],_0xa81a6b[_0x45dc('0x61')],md5(_0xa81a6b['uniqueid']));if(_0x3b0783&&_0x3b0783['monitor_format']){logger[_0x45dc('0x12')](_0x45dc('0x62'),_0x45dc('0x63'));_0xa81a6b[_0x45dc('0x64')]=_0x3faabf;}else if(_0x21a1e7&&_0x21a1e7[_0x45dc('0x65')]&&_0x21a1e7['recordingFormat']!==_0x45dc('0x66')){logger[_0x45dc('0x12')](_0x45dc('0x67'),_0x45dc('0x63'));_0xa81a6b[_0x45dc('0x64')]=_0x3faabf;}else{_0xa81a6b[_0x45dc('0x64')]='';}return getAdminUser(_0x259321,_0x1ecac4,_0x3f2b74,_0x557509,_0xc20017,_0x164721)['then'](getUser(_0x259321,_0x1ecac4,_0x557509,_0xc20017,_0x164721))['then'](getEndUser(_0x259321,_0x1ecac4,_0x557509,_0xc20017,_0x164721))[_0x45dc('0xd')](getTicket(_0x259321,_0x1ecac4,_0x557509,_0x257cc4,_0xa81a6b,_0xc20017))[_0x45dc('0xd')](function(_0xd9d9a1){logger[_0x45dc('0x12')](util[_0x45dc('0x68')](_0x45dc('0x69'),_0xd9d9a1[_0x45dc('0x41')]));logger[_0x45dc('0x12')](util[_0x45dc('0x68')](_0x45dc('0x6a'),_0x259321));if(_0x259321!==_0x45dc('0x60')){logger['info']('['+[_0x259321[_0x45dc('0x16')]()]+']',_0x45dc('0x6b'));emit(_0x3912d5[_0x45dc('0x57')],_0x467cd2[_0x45dc('0x39')],_0xd9d9a1[_0x45dc('0x41')]);}})[_0x45dc('0x14')](function(_0xe6e525){logger[_0x45dc('0x15')]('['+[_0x259321[_0x45dc('0x16')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x45dc('0x6c')](_0xe6e525,{'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 752cbdd..31cc97e 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 _0x4b35=['Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','variableName','push','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','user_id','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','string','nameField','customField','toLowerCase','content','custom_fields','variable','idField','Variable','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','users','trigger:browser:url','error','lastevent','toUpperCase','Inbound','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4b35,0xea));var _0x54b3=function(_0x3d2c91,_0x2f965f){_0x3d2c91=_0x3d2c91-0x0;var _0x4ea4df=_0x4b35[_0x3d2c91];return _0x4ea4df;};'use strict';var _=require('lodash');var rp=require(_0x54b3('0x0'));var BPromise=require(_0x54b3('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x54b3('0x2'));var intUtil=require(_0x54b3('0x3'));var config=require(_0x54b3('0x4'));var logger=require(_0x54b3('0x5'))(_0x54b3('0x6'));config[_0x54b3('0x7')]=_[_0x54b3('0x8')](config[_0x54b3('0x7')],{'host':_0x54b3('0x9'),'port':0x18eb});var io=require(_0x54b3('0xa'))(new Redis(config['redis']));var def={'method':_0x54b3('0xb'),'json':!![]};function emit(_0x444e65,_0xd19c8d,_0x5cc40c){io['to'](_0x444e65)[_0x54b3('0xc')](_0xd19c8d,_0x5cc40c);}function getTicket(_0x31f36b,_0x1092ec,_0x2b3f7d,_0x557b24,_0x3efffd,_0x1b4645,_0x128ae7,_0x3be979){logger[_0x54b3('0xd')](_0x54b3('0xe'));var _0x5a4a84=new Date();var _0x373b57=[{'name':_0x54b3('0xf'),'value':intUtil[_0x54b3('0x10')](_0x557b24[_0x54b3('0x11')],_0x3efffd,'\x20')},{'name':_0x54b3('0x12'),'value':_0x1092ec['id']},{'name':_0x54b3('0x13'),'value':_0x1092ec['id']},{'name':'description','value':intUtil[_0x54b3('0x10')](_0x557b24[_0x54b3('0x14')],_0x3efffd,'\x0a')},{'name':_0x54b3('0x15'),'value':_0x5a4a84[_0x54b3('0x16')]()[_0x54b3('0x17')](0x0,0x13)[_0x54b3('0x18')]('T','\x20')},{'name':_0x54b3('0x19'),'value':'0'},{'name':_0x54b3('0x1a'),'value':'15'},{'name':_0x54b3('0x1b'),'value':_0x2b3f7d['id']},{'name':'parent_type','value':_0x54b3('0x1c')},{'name':_0x54b3('0x1d'),'value':_0x2b3f7d[_0x54b3('0xf')]},{'name':_0x54b3('0x1e'),'value':_0x3be979}];if(_0x1b4645[_0x54b3('0x1f')]){_['forEach'](_0x1b4645,function(_0x378f67){if(_0x3efffd[_0x378f67[_0x54b3('0x20')]]){_0x373b57[_0x54b3('0x21')]({'name':_0x378f67['idField'],'value':_0x3efffd[_0x378f67[_0x54b3('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x54b3('0x22')]({'session':_0x128ae7['id'],'module_name':_0x54b3('0x23'),'name_value_list':_0x373b57})}});}function getAuth(_0x1f46be){return util[_0x54b3('0x24')](_0x54b3('0x25'),new Buffer(_0x1f46be[_0x54b3('0x26')]+':X')[_0x54b3('0x27')](_0x54b3('0x28')));}function getServerInfo(_0x57bf7d){return request({'form':{'method':_0x54b3('0x29'),'input_type':_0x54b3('0x2a'),'response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x57bf7d['id']})}});}function getUser(_0x56c15a,_0x1664c8,_0x4f80b3){if(!_[_0x54b3('0x2b')](_0x1664c8)){logger[_0x54b3('0xd')](_0x54b3('0x2c'),_0x1664c8);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x4f80b3['id'],'module_name':_0x54b3('0x2d'),'query':util[_0x54b3('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x1664c8),'order_by':'','offset':'0','select_fields':['id',_0x54b3('0xf'),_0x54b3('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x54b3('0x2f')](function(_0x4db8c5){if(_0x4db8c5[_0x54b3('0x30')][_0x54b3('0x1f')]){var _0x2332b5=_[_0x54b3('0x31')](_0x4db8c5['entry_list'],function(_0x4428b2){return _0x4428b2['name_value_list']['user_name'][_0x54b3('0x32')]===_0x1664c8;});if(_0x2332b5){logger[_0x54b3('0xd')](_0x54b3('0x33'));return BPromise['resolve']({'id':_0x2332b5['name_value_list']['id'][_0x54b3('0x32')],'name':_0x2332b5[_0x54b3('0x34')][_0x54b3('0xf')]['value']});}}logger[_0x54b3('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x4f80b3['name_value_list'][_0x54b3('0x35')][_0x54b3('0x32')],'name':_0x4f80b3[_0x54b3('0x34')]['user_name']['value']});});}else{logger[_0x54b3('0xd')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x54b3('0x36')]({'id':_0x4f80b3[_0x54b3('0x34')][_0x54b3('0x35')][_0x54b3('0x32')],'name':_0x4f80b3[_0x54b3('0x34')]['user_name'][_0x54b3('0x32')]});}}function getEndUser(_0x429050,_0x520659,_0x280d54,_0x55cf88){logger[_0x54b3('0xd')](_0x54b3('0x37'),_0x280d54);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x55cf88['id'],'module_name':_0x54b3('0x1c'),'query':util[_0x54b3('0x24')](_0x54b3('0x38'),_0x280d54),'order_by':'','offset':'0','select_fields':['id',_0x54b3('0xf'),_0x54b3('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4c01cf){if(_0x4c01cf['entry_list'][_0x54b3('0x1f')]){var _0x160b5c=_[_0x54b3('0x31')](_0x4c01cf[_0x54b3('0x30')],function(_0x3f00de){return _0x3f00de[_0x54b3('0x34')]['phone_home']['value']===_0x280d54;});if(_0x160b5c){logger[_0x54b3('0xd')](_0x54b3('0x3a'));return BPromise['resolve']({'id':_0x160b5c['name_value_list']['id'][_0x54b3('0x32')],'name':_0x160b5c['name_value_list'][_0x54b3('0xf')][_0x54b3('0x32')],'phone':_0x160b5c[_0x54b3('0x34')][_0x54b3('0x39')][_0x54b3('0x32')]});}}else{logger[_0x54b3('0xd')](_0x54b3('0x3b'));return request({'form':{'method':_0x54b3('0x3c'),'input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x55cf88['id'],'module_name':_0x54b3('0x1c'),'name_value_list':[{'name':'first_name','value':_0x520659!==_0x54b3('0x3d')?_0x520659:util[_0x54b3('0x24')](_0x54b3('0x3e'),_0x280d54)},{'name':_0x54b3('0x39'),'value':_0x280d54}]})}})['then'](function(_0x58e53d){logger[_0x54b3('0xd')](_0x54b3('0x3f'));return BPromise[_0x54b3('0x36')]({'id':_0x58e53d['id'],'name':_0x58e53d[_0x54b3('0x30')][_0x54b3('0x40')]['value'],'phone':_0x58e53d['entry_list'][_0x54b3('0x39')][_0x54b3('0x32')]});});}});}function request(_0x9b248c){logger[_0x54b3('0x41')](_0x54b3('0x42'),JSON[_0x54b3('0x22')](_0x9b248c));return rp(_[_0x54b3('0x43')](def,_0x9b248c));}function getTags(_0x45ba16,_0x130495){var _0x2ff28e=[];if(_0x45ba16&&_0x45ba16[_0x54b3('0x1f')]>0x0){_0x2ff28e=_['map'](_0x45ba16,_0x130495);}return _0x2ff28e;}function getCustomFields(_0x326f4d,_0x10def0){var _0x1ba511=[];var _0x528c6a={'custom_fields':[]};if(_0x326f4d[_0x54b3('0x1f')]>0x0){_['forEach'](_0x326f4d,function(_0x236496){if(_0x236496['type']===_0x54b3('0x44')&&_0x236496[_0x54b3('0x45')]&&!_0x236496[_0x54b3('0x46')]){_0x528c6a[_0x236496[_0x54b3('0x45')][_0x54b3('0x47')]()]=_0x236496[_0x54b3('0x48')][_0x54b3('0x27')]();}else if(_0x236496['type']===_0x54b3('0x44')&&_0x236496['idField']&&_0x236496[_0x54b3('0x46')]){_0x528c6a[_0x54b3('0x49')]['push']({'id':_0x236496['idField'],'value':_0x236496[_0x54b3('0x48')]['toString']()});}else if(_0x236496['type']===_0x54b3('0x4a')&&_0x236496[_0x54b3('0x20')]&&_0x236496['idField']&&_0x236496[_0x54b3('0x46')]){_0x10def0[_0x236496[_0x54b3('0x20')]]&&_0x528c6a[_0x54b3('0x49')][_0x54b3('0x21')]({'id':_0x236496[_0x54b3('0x4b')],'value':_0x10def0[_0x236496[_0x54b3('0x20')]][_0x54b3('0x27')]()});}else if(_0x236496['type']==='customVariable'&&_0x236496[_0x54b3('0x4c')]&&_0x236496['Variable']['name']&&_0x236496[_0x54b3('0x4b')]&&_0x236496[_0x54b3('0x46')]){_0x10def0[_0x236496[_0x54b3('0x4c')][_0x54b3('0xf')][_0x54b3('0x47')]()]&&_0x528c6a['custom_fields'][_0x54b3('0x21')]({'id':_0x236496[_0x54b3('0x4b')],'value':_0x10def0[_0x236496['Variable']['name'][_0x54b3('0x47')]()][_0x54b3('0x27')]()});}});}return _0x528c6a;}function getConnection(_0x5d9083){return request({'method':_0x54b3('0xb'),'form':{'method':_0x54b3('0x4d'),'input_type':_0x54b3('0x2a'),'response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'user_auth':{'user_name':_0x5d9083[_0x54b3('0x4e')],'password':_0x5d9083[_0x54b3('0x4f')],'encryption':_0x54b3('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x300c08){var _0x5427e9=_0x300c08;if(_0x5427e9['id']){def[_0x54b3('0x51')]=_0x5427e9['id'];return BPromise[_0x54b3('0x36')](_0x5427e9);}else{throw new Error(util[_0x54b3('0x24')](_0x54b3('0x52'),_0x5d9083['id']));}});}function setRelationship(_0x20fc8a,_0x21f002,_0x25bfa9,_0x3e5ef8){return request({'form':{'method':_0x54b3('0x53'),'input_type':'JSON','response_type':_0x54b3('0x2a'),'rest_data':JSON[_0x54b3('0x22')]({'session':_0x20fc8a['id'],'module_name':_0x54b3('0x23'),'module_id':_0x25bfa9['id'],'link_field_name':_0x3e5ef8,'related_ids':[_0x21f002['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x54b3('0x54')]=function(_0x1a09b1,_0x57e88a,_0x342d8e,_0x11c289,_0x1c6ff7,_0x32833a){var _0x597da8,_0x8f2f83,_0x369e9a,_0x4415f4;_0x32833a[_0x54b3('0x55')]=intUtil[_0x54b3('0x56')](_0x32833a['remoteUri']);_0x32833a[_0x54b3('0x57')]=intUtil['stripTrailingSlash'](_0x32833a[_0x54b3('0x57')]);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x32833a[_0x54b3('0x55')]);if(_0x1c6ff7&&_0x1c6ff7[_0x54b3('0x5a')]){logger['info']('[QUEUE]',_0x54b3('0x5b'));_0x57e88a['recordingURL']=util[_0x54b3('0x24')](_0x54b3('0x5c'),_0x32833a[_0x54b3('0x57')],_0x57e88a[_0x54b3('0x5d')],md5(_0x57e88a[_0x54b3('0x5d')]));}else{_0x57e88a[_0x54b3('0x5e')]='';}return getConnection(_0x32833a)[_0x54b3('0x2f')](function(_0x541836){_0x4415f4=_0x541836;return getUser(_0x32833a,_0x11c289[_0x54b3('0xf')],_0x4415f4);})[_0x54b3('0x2f')](function(_0xd544c6){_0x597da8=_0xd544c6;logger[_0x54b3('0xd')]('The\x20User\x20ID\x20is:',_0x597da8['id']);return getEndUser(_0x32833a,_0x57e88a[_0x54b3('0x5f')],_0x57e88a[_0x54b3('0x60')],_0x4415f4);})['then'](function(_0x6a5e1a){_0x8f2f83=_0x6a5e1a;logger[_0x54b3('0xd')](_0x54b3('0x61'),_0x8f2f83['id']);return getTicket(_0x32833a,_0x597da8,_0x8f2f83,_0x342d8e,_0x57e88a,_0x342d8e[_0x54b3('0x62')],_0x4415f4,'Inbound');})[_0x54b3('0x2f')](function(_0x5ed0a3){_0x369e9a=_0x5ed0a3;logger[_0x54b3('0xd')](_0x54b3('0x63'));logger[_0x54b3('0xd')](_0x54b3('0x64'),_0x369e9a['id']);return setRelationship(_0x4415f4,_0x597da8,_0x369e9a,'users');})[_0x54b3('0x2f')](function(){return setRelationship(_0x4415f4,_0x8f2f83,_0x369e9a,_0x54b3('0x65'));})[_0x54b3('0x2f')](function(){return getServerInfo(_0x4415f4);})[_0x54b3('0x2f')](function(_0x47ea16){var _0x2d65fa=parseInt(_0x47ea16[_0x54b3('0x66')][_0x54b3('0x67')](0x0));var _0x256396=util[_0x54b3('0x24')](_0x54b3('0x68'),_0x32833a['remoteUri'],_0x369e9a['id']);if(_0x2d65fa>0x6){_0x256396=util['format'](_0x54b3('0x69'),_0x32833a[_0x54b3('0x55')],_0x369e9a['id']);}logger[_0x54b3('0xd')](_0x54b3('0x6a'),_0x54b3('0x6b'));emit(util[_0x54b3('0x24')](_0x54b3('0x6c'),_0x11c289[_0x54b3('0xf')]),'trigger:browser:url',{'uri':_0x256396});})[_0x54b3('0x6d')](function(_0x3c7903){logger['error']('[QUEUE]',JSON[_0x54b3('0x22')](_0x3c7903));});};exports[_0x54b3('0x6e')]=function(_0x305a4a,_0x400016,_0x3de4fa,_0x4d9272,_0x4948aa,_0x6ee705,_0x2d9e07){var _0x3a04de,_0x1d697a,_0x13b749,_0x22f10c;_0x6ee705['remoteUri']=intUtil[_0x54b3('0x56')](_0x6ee705['remoteUri']);_0x6ee705[_0x54b3('0x57')]=intUtil[_0x54b3('0x56')](_0x6ee705['serverUrl']);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x6ee705[_0x54b3('0x55')]);if(_0x2d9e07&&_0x2d9e07[_0x54b3('0x6f')]&&_0x2d9e07['recordingFormat']!==_0x54b3('0x70')){logger['info'](_0x54b3('0x71'),_0x54b3('0x5b'));_0x400016[_0x54b3('0x5e')]=util[_0x54b3('0x24')](_0x54b3('0x5c'),_0x6ee705['serverUrl'],_0x400016[_0x54b3('0x5d')],md5(_0x400016[_0x54b3('0x5d')]));}return getConnection(_0x6ee705)[_0x54b3('0x2f')](function(_0x1f29dd){_0x22f10c=_0x1f29dd;return getUser(_0x6ee705,_0x4d9272['name'],_0x22f10c);})[_0x54b3('0x2f')](function(_0x58fb18){_0x3a04de=_0x58fb18;logger['info'](_0x54b3('0x72'),_0x3a04de['id']);return getEndUser(_0x6ee705,_0x400016[_0x54b3('0x73')],_0x400016[_0x54b3('0x74')],_0x22f10c);})[_0x54b3('0x2f')](function(_0x1a7434){_0x1d697a=_0x1a7434;logger[_0x54b3('0xd')]('The\x20Enduser\x20ID\x20is:',_0x1d697a['id']);return getTicket(_0x6ee705,_0x3a04de,_0x1d697a,_0x3de4fa,_0x400016,_0x3de4fa[_0x54b3('0x62')],_0x22f10c,_0x54b3('0x75'));})[_0x54b3('0x2f')](function(_0x2305af){_0x13b749=_0x2305af;logger['info'](_0x54b3('0x63'));logger[_0x54b3('0xd')]('The\x20Ticket\x20ID\x20is:',_0x13b749['id']);return setRelationship(_0x22f10c,_0x3a04de,_0x13b749,_0x54b3('0x76'));})[_0x54b3('0x2f')](function(){return setRelationship(_0x22f10c,_0x1d697a,_0x13b749,'contacts');})[_0x54b3('0x2f')](function(){return getServerInfo(_0x22f10c);})[_0x54b3('0x2f')](function(_0x12cda0){var _0x1cf8a=parseInt(_0x12cda0['version']['charAt'](0x0));var _0x10ff42=util[_0x54b3('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6ee705[_0x54b3('0x55')],_0x13b749['id']);if(_0x1cf8a>0x6){_0x10ff42=util[_0x54b3('0x24')](_0x54b3('0x69'),_0x6ee705[_0x54b3('0x55')],_0x13b749['id']);}logger[_0x54b3('0xd')](_0x54b3('0x71'),_0x54b3('0x6b'));emit(util['format'](_0x54b3('0x6c'),_0x4d9272[_0x54b3('0xf')]),_0x54b3('0x77'),{'uri':_0x10ff42});})[_0x54b3('0x6d')](function(_0x1455a6){logger[_0x54b3('0x78')](_0x54b3('0x71'),JSON[_0x54b3('0x22')](_0x1455a6));});};exports['unmanaged']=function(_0x3b978c,_0x2492f4,_0x20d12a,_0xc5d0cb,_0x4cc998,_0x4f8bf8){var _0x3b1126,_0x311c72,_0x5b2c1d,_0x1ba0cc;_0x4f8bf8[_0x54b3('0x55')]=intUtil[_0x54b3('0x56')](_0x4f8bf8[_0x54b3('0x55')]);_0x4f8bf8[_0x54b3('0x57')]=intUtil['stripTrailingSlash'](_0x4f8bf8[_0x54b3('0x57')]);def[_0x54b3('0x58')]=util[_0x54b3('0x24')](_0x54b3('0x59'),_0x4f8bf8[_0x54b3('0x55')]);if(_0x4cc998&&_0x4cc998[_0x54b3('0x5a')]){logger[_0x54b3('0xd')]('['+_0x2492f4[_0x54b3('0x79')][_0x54b3('0x7a')]()+']','Recording\x20is\x20enabled!');_0x2492f4[_0x54b3('0x5e')]=util['format'](_0x54b3('0x5c'),_0x4f8bf8[_0x54b3('0x57')],_0x2492f4[_0x54b3('0x5d')],md5(_0x2492f4['uniqueid']));}else{_0x2492f4[_0x54b3('0x5e')]='';}return getConnection(_0x4f8bf8)[_0x54b3('0x2f')](function(_0x465417){_0x1ba0cc=_0x465417;if(!_[_0x54b3('0x2b')](_0xc5d0cb)){return getUser(_0x4f8bf8,_0xc5d0cb[_0x54b3('0xf')],_0x1ba0cc);}else{return getUser(_0x4f8bf8,null,_0x1ba0cc);}})[_0x54b3('0x2f')](function(_0x1a7562){_0x3b1126=_0x1a7562;logger[_0x54b3('0xd')]('The\x20User\x20ID\x20is:',_0x3b1126['id']);return getEndUser(_0x4f8bf8,_0x2492f4['calleridname'],_0x2492f4[_0x54b3('0x60')],_0x1ba0cc);})[_0x54b3('0x2f')](function(_0x1427d3){_0x311c72=_0x1427d3;logger['info'](_0x54b3('0x61'),_0x311c72['id']);return getTicket(_0x4f8bf8,_0x3b1126,_0x311c72,_0x20d12a,_0x2492f4,_0x20d12a['Fields'],_0x1ba0cc,_0x54b3('0x7b'));})[_0x54b3('0x2f')](function(_0x17bedf){_0x5b2c1d=_0x17bedf;logger['info'](_0x54b3('0x63'));logger[_0x54b3('0xd')](_0x54b3('0x64'),_0x5b2c1d['id']);return setRelationship(_0x1ba0cc,_0x3b1126,_0x5b2c1d,_0x54b3('0x76'));})[_0x54b3('0x2f')](function(){return setRelationship(_0x1ba0cc,_0x311c72,_0x5b2c1d,'contacts');})[_0x54b3('0x2f')](function(){return getServerInfo(_0x1ba0cc);})[_0x54b3('0x6d')](function(_0x3e2c41){logger[_0x54b3('0x78')]('['+_0x2492f4[_0x54b3('0x79')][_0x54b3('0x7a')]()+']',JSON[_0x54b3('0x22')](_0x3e2c41));});}; \ No newline at end of file +var _0x237b=['users','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','getString','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','format','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','string','type','variable','Variable','custom_fields','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridname','Outbound'];(function(_0x213f42,_0x4a639f){var _0x4bf347=function(_0x418589){while(--_0x418589){_0x213f42['push'](_0x213f42['shift']());}};_0x4bf347(++_0x4a639f);}(_0x237b,0x16b));var _0xb237=function(_0x342270,_0x1fb150){_0x342270=_0x342270-0x0;var _0x810423=_0x237b[_0x342270];return _0x810423;};'use strict';var _=require(_0xb237('0x0'));var rp=require(_0xb237('0x1'));var BPromise=require(_0xb237('0x2'));var md5=require('md5');var util=require(_0xb237('0x3'));var Redis=require(_0xb237('0x4'));var intUtil=require(_0xb237('0x5'));var config=require(_0xb237('0x6'));var logger=require(_0xb237('0x7'))(_0xb237('0x8'));config[_0xb237('0x9')]=_[_0xb237('0xa')](config[_0xb237('0x9')],{'host':_0xb237('0xb'),'port':0x18eb});var io=require(_0xb237('0xc'))(new Redis(config['redis']));var def={'method':_0xb237('0xd'),'json':!![]};function emit(_0x3c36c0,_0x6db7ff,_0x3d06fa){io['to'](_0x3c36c0)[_0xb237('0xe')](_0x6db7ff,_0x3d06fa);}function getTicket(_0x2428c2,_0xc72ce7,_0x3f9d9d,_0x24bc97,_0x47bb87,_0x37eeda,_0xa3c30e,_0x54098b){logger[_0xb237('0xf')](_0xb237('0x10'));var _0x412839=new Date();var _0x213025=[{'name':_0xb237('0x11'),'value':intUtil['getString'](_0x24bc97[_0xb237('0x12')],_0x47bb87,'\x20')},{'name':_0xb237('0x13'),'value':_0xc72ce7['id']},{'name':_0xb237('0x14'),'value':_0xc72ce7['id']},{'name':'description','value':intUtil[_0xb237('0x15')](_0x24bc97['Descriptions'],_0x47bb87,'\x0a')},{'name':_0xb237('0x16'),'value':_0x412839[_0xb237('0x17')]()['slice'](0x0,0x13)[_0xb237('0x18')]('T','\x20')},{'name':_0xb237('0x19'),'value':'0'},{'name':_0xb237('0x1a'),'value':'15'},{'name':_0xb237('0x1b'),'value':_0x3f9d9d['id']},{'name':_0xb237('0x1c'),'value':_0xb237('0x1d')},{'name':_0xb237('0x1e'),'value':_0x3f9d9d['name']},{'name':_0xb237('0x1f'),'value':_0x54098b}];if(_0x37eeda[_0xb237('0x20')]){_[_0xb237('0x21')](_0x37eeda,function(_0x8cd8a4){if(_0x47bb87[_0x8cd8a4[_0xb237('0x22')]]){_0x213025[_0xb237('0x23')]({'name':_0x8cd8a4[_0xb237('0x24')],'value':_0x47bb87[_0x8cd8a4[_0xb237('0x22')]]});}});}return request({'form':{'method':_0xb237('0x25'),'input_type':'JSON','response_type':_0xb237('0x26'),'rest_data':JSON[_0xb237('0x27')]({'session':_0xa3c30e['id'],'module_name':'Calls','name_value_list':_0x213025})}});}function getAuth(_0x4266ba){return util[_0xb237('0x28')]('Basic\x20%s',new Buffer(_0x4266ba[_0xb237('0x29')]+':X')[_0xb237('0x2a')](_0xb237('0x2b')));}function getServerInfo(_0x529fae){return request({'form':{'method':'get_server_info','input_type':_0xb237('0x26'),'response_type':_0xb237('0x26'),'rest_data':JSON['stringify']({'session':_0x529fae['id']})}});}function getUser(_0x3f82a7,_0x2877f2,_0x4baebf){if(!_[_0xb237('0x2c')](_0x2877f2)){logger['info'](_0xb237('0x2d'),_0x2877f2);return request({'form':{'method':_0xb237('0x2e'),'input_type':_0xb237('0x26'),'response_type':'JSON','rest_data':JSON[_0xb237('0x27')]({'session':_0x4baebf['id'],'module_name':_0xb237('0x2f'),'query':util[_0xb237('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2877f2),'order_by':'','offset':'0','select_fields':['id',_0xb237('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb237('0x30')](function(_0x1bd0c5){if(_0x1bd0c5[_0xb237('0x31')][_0xb237('0x20')]){var _0x5e593e=_[_0xb237('0x32')](_0x1bd0c5[_0xb237('0x31')],function(_0x5ca63b){return _0x5ca63b[_0xb237('0x33')][_0xb237('0x34')]['value']===_0x2877f2;});if(_0x5e593e){logger[_0xb237('0xf')](_0xb237('0x35'));return BPromise[_0xb237('0x36')]({'id':_0x5e593e[_0xb237('0x33')]['id']['value'],'name':_0x5e593e[_0xb237('0x33')][_0xb237('0x11')][_0xb237('0x37')]});}}logger['info'](_0xb237('0x38'));return BPromise['resolve']({'id':_0x4baebf[_0xb237('0x33')]['user_id'][_0xb237('0x37')],'name':_0x4baebf[_0xb237('0x33')]['user_name']['value']});});}else{logger[_0xb237('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb237('0x36')]({'id':_0x4baebf['name_value_list'][_0xb237('0x39')][_0xb237('0x37')],'name':_0x4baebf[_0xb237('0x33')][_0xb237('0x34')][_0xb237('0x37')]});}}function getEndUser(_0x12318f,_0x505d3e,_0x42f929,_0x4bdadf){logger['info'](_0xb237('0x3a'),_0x42f929);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xb237('0x26'),'rest_data':JSON[_0xb237('0x27')]({'session':_0x4bdadf['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x42f929),'order_by':'','offset':'0','select_fields':['id',_0xb237('0x11'),_0xb237('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb237('0x30')](function(_0x2ec2e2){if(_0x2ec2e2[_0xb237('0x31')][_0xb237('0x20')]){var _0x4e4392=_['find'](_0x2ec2e2[_0xb237('0x31')],function(_0x40c337){return _0x40c337['name_value_list'][_0xb237('0x3b')][_0xb237('0x37')]===_0x42f929;});if(_0x4e4392){logger['info'](_0xb237('0x3c'));return BPromise[_0xb237('0x36')]({'id':_0x4e4392[_0xb237('0x33')]['id'][_0xb237('0x37')],'name':_0x4e4392['name_value_list']['name']['value'],'phone':_0x4e4392[_0xb237('0x33')]['phone_home'][_0xb237('0x37')]});}}else{logger[_0xb237('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb237('0x25'),'input_type':'JSON','response_type':_0xb237('0x26'),'rest_data':JSON['stringify']({'session':_0x4bdadf['id'],'module_name':'Contacts','name_value_list':[{'name':_0xb237('0x3d'),'value':_0x505d3e!==_0xb237('0x3e')?_0x505d3e:util['format']('Caller\x20-\x20%s',_0x42f929)},{'name':'phone_home','value':_0x42f929}]})}})[_0xb237('0x30')](function(_0x38e61c){logger[_0xb237('0xf')](_0xb237('0x3f'));return BPromise[_0xb237('0x36')]({'id':_0x38e61c['id'],'name':_0x38e61c['entry_list'][_0xb237('0x3d')][_0xb237('0x37')],'phone':_0x38e61c[_0xb237('0x31')]['phone_home'][_0xb237('0x37')]});});}});}function request(_0x2ede6a){logger[_0xb237('0x40')](_0xb237('0x41'),JSON['stringify'](_0x2ede6a));return rp(_[_0xb237('0x42')](def,_0x2ede6a));}function getTags(_0x5721ea,_0x2ee40e){var _0x163703=[];if(_0x5721ea&&_0x5721ea[_0xb237('0x20')]>0x0){_0x163703=_[_0xb237('0x43')](_0x5721ea,_0x2ee40e);}return _0x163703;}function getCustomFields(_0x2af853,_0x4425ba){var _0x5a4bf5=[];var _0x5bbed2={'custom_fields':[]};if(_0x2af853[_0xb237('0x20')]>0x0){_[_0xb237('0x21')](_0x2af853,function(_0x477186){if(_0x477186['type']==='string'&&_0x477186[_0xb237('0x44')]&&!_0x477186[_0xb237('0x45')]){_0x5bbed2[_0x477186['nameField'][_0xb237('0x46')]()]=_0x477186[_0xb237('0x47')]['toString']();}else if(_0x477186['type']===_0xb237('0x48')&&_0x477186[_0xb237('0x24')]&&_0x477186['customField']){_0x5bbed2['custom_fields']['push']({'id':_0x477186[_0xb237('0x24')],'value':_0x477186[_0xb237('0x47')]['toString']()});}else if(_0x477186[_0xb237('0x49')]===_0xb237('0x4a')&&_0x477186[_0xb237('0x22')]&&_0x477186[_0xb237('0x24')]&&_0x477186['customField']){_0x4425ba[_0x477186['variableName']]&&_0x5bbed2['custom_fields'][_0xb237('0x23')]({'id':_0x477186[_0xb237('0x24')],'value':_0x4425ba[_0x477186['variableName']][_0xb237('0x2a')]()});}else if(_0x477186[_0xb237('0x49')]==='customVariable'&&_0x477186[_0xb237('0x4b')]&&_0x477186[_0xb237('0x4b')][_0xb237('0x11')]&&_0x477186['idField']&&_0x477186[_0xb237('0x45')]){_0x4425ba[_0x477186[_0xb237('0x4b')][_0xb237('0x11')][_0xb237('0x46')]()]&&_0x5bbed2[_0xb237('0x4c')]['push']({'id':_0x477186['idField'],'value':_0x4425ba[_0x477186[_0xb237('0x4b')][_0xb237('0x11')][_0xb237('0x46')]()][_0xb237('0x2a')]()});}});}return _0x5bbed2;}function getConnection(_0x1d728c){return request({'method':_0xb237('0xd'),'form':{'method':'login','input_type':_0xb237('0x26'),'response_type':_0xb237('0x26'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1d728c[_0xb237('0x4d')],'password':_0x1d728c[_0xb237('0x4e')],'encryption':'PLAIN'},'application':_0xb237('0x4f')})}})['then'](function(_0x5a20f0){var _0x5807c1=_0x5a20f0;if(_0x5807c1['id']){def['sessionID']=_0x5807c1['id'];return BPromise[_0xb237('0x36')](_0x5807c1);}else{throw new Error(util[_0xb237('0x28')](_0xb237('0x50'),_0x1d728c['id']));}});}function setRelationship(_0x2a0c21,_0x41870d,_0x49ebd4,_0x22317e){return request({'form':{'method':'set_relationship','input_type':_0xb237('0x26'),'response_type':_0xb237('0x26'),'rest_data':JSON[_0xb237('0x27')]({'session':_0x2a0c21['id'],'module_name':_0xb237('0x51'),'module_id':_0x49ebd4['id'],'link_field_name':_0x22317e,'related_ids':[_0x41870d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb237('0x52')]=function(_0x3249b3,_0x47148d,_0x397ff5,_0x801b21,_0x321b62,_0x793656){var _0x4996f9,_0x45aca,_0xf05180,_0x8afe7e;_0x793656[_0xb237('0x53')]=intUtil['stripTrailingSlash'](_0x793656['remoteUri']);_0x793656['serverUrl']=intUtil['stripTrailingSlash'](_0x793656[_0xb237('0x54')]);def[_0xb237('0x55')]=util[_0xb237('0x28')](_0xb237('0x56'),_0x793656['remoteUri']);if(_0x321b62&&_0x321b62[_0xb237('0x57')]){logger['info'](_0xb237('0x58'),_0xb237('0x59'));_0x47148d[_0xb237('0x5a')]=util['format'](_0xb237('0x5b'),_0x793656[_0xb237('0x54')],_0x47148d[_0xb237('0x5c')],md5(_0x47148d[_0xb237('0x5c')]));}else{_0x47148d[_0xb237('0x5a')]='';}return getConnection(_0x793656)[_0xb237('0x30')](function(_0x8e537f){_0x8afe7e=_0x8e537f;return getUser(_0x793656,_0x801b21[_0xb237('0x11')],_0x8afe7e);})['then'](function(_0x10d190){_0x4996f9=_0x10d190;logger[_0xb237('0xf')](_0xb237('0x5d'),_0x4996f9['id']);return getEndUser(_0x793656,_0x47148d[_0xb237('0x5e')],_0x47148d['calleridnum'],_0x8afe7e);})[_0xb237('0x30')](function(_0x380e2a){_0x45aca=_0x380e2a;logger[_0xb237('0xf')](_0xb237('0x5f'),_0x45aca['id']);return getTicket(_0x793656,_0x4996f9,_0x45aca,_0x397ff5,_0x47148d,_0x397ff5[_0xb237('0x60')],_0x8afe7e,'Inbound');})['then'](function(_0x101df5){_0xf05180=_0x101df5;logger[_0xb237('0xf')](_0xb237('0x61'));logger[_0xb237('0xf')](_0xb237('0x62'),_0xf05180['id']);return setRelationship(_0x8afe7e,_0x4996f9,_0xf05180,'users');})[_0xb237('0x30')](function(){return setRelationship(_0x8afe7e,_0x45aca,_0xf05180,_0xb237('0x63'));})[_0xb237('0x30')](function(){return getServerInfo(_0x8afe7e);})[_0xb237('0x30')](function(_0x30407a){var _0x5a0085=parseInt(_0x30407a[_0xb237('0x64')]['charAt'](0x0));var _0x3804f4=util[_0xb237('0x28')](_0xb237('0x65'),_0x793656[_0xb237('0x53')],_0xf05180['id']);if(_0x5a0085>0x6){_0x3804f4=util[_0xb237('0x28')](_0xb237('0x66'),_0x793656[_0xb237('0x53')],_0xf05180['id']);}logger[_0xb237('0xf')](_0xb237('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb237('0x28')](_0xb237('0x67'),_0x801b21[_0xb237('0x11')]),_0xb237('0x68'),{'uri':_0x3804f4});})[_0xb237('0x69')](function(_0x37ddb7){logger[_0xb237('0x6a')](_0xb237('0x58'),JSON[_0xb237('0x27')](_0x37ddb7));});};exports[_0xb237('0x6b')]=function(_0x54b90e,_0x219dbe,_0x29938f,_0x147368,_0x233db7,_0xc025cf,_0x36ef7a){var _0x325ac2,_0x57200b,_0x3b44c3,_0x4186c3;_0xc025cf[_0xb237('0x53')]=intUtil[_0xb237('0x6c')](_0xc025cf['remoteUri']);_0xc025cf[_0xb237('0x54')]=intUtil[_0xb237('0x6c')](_0xc025cf['serverUrl']);def[_0xb237('0x55')]=util[_0xb237('0x28')](_0xb237('0x56'),_0xc025cf[_0xb237('0x53')]);if(_0x36ef7a&&_0x36ef7a[_0xb237('0x6d')]&&_0x36ef7a[_0xb237('0x6d')]!=='none'){logger[_0xb237('0xf')](_0xb237('0x6e'),'Recording\x20is\x20enabled!');_0x219dbe['recordingURL']=util[_0xb237('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc025cf[_0xb237('0x54')],_0x219dbe[_0xb237('0x5c')],md5(_0x219dbe['uniqueid']));}return getConnection(_0xc025cf)['then'](function(_0x2b73f4){_0x4186c3=_0x2b73f4;return getUser(_0xc025cf,_0x147368[_0xb237('0x11')],_0x4186c3);})[_0xb237('0x30')](function(_0x5f2393){_0x325ac2=_0x5f2393;logger[_0xb237('0xf')](_0xb237('0x5d'),_0x325ac2['id']);return getEndUser(_0xc025cf,_0x219dbe[_0xb237('0x6f')],_0x219dbe['destcalleridnum'],_0x4186c3);})[_0xb237('0x30')](function(_0x13979f){_0x57200b=_0x13979f;logger[_0xb237('0xf')]('The\x20Enduser\x20ID\x20is:',_0x57200b['id']);return getTicket(_0xc025cf,_0x325ac2,_0x57200b,_0x29938f,_0x219dbe,_0x29938f[_0xb237('0x60')],_0x4186c3,_0xb237('0x70'));})['then'](function(_0x329c61){_0x3b44c3=_0x329c61;logger[_0xb237('0xf')]('Ticket\x20created!');logger[_0xb237('0xf')](_0xb237('0x62'),_0x3b44c3['id']);return setRelationship(_0x4186c3,_0x325ac2,_0x3b44c3,_0xb237('0x71'));})['then'](function(){return setRelationship(_0x4186c3,_0x57200b,_0x3b44c3,'contacts');})['then'](function(){return getServerInfo(_0x4186c3);})[_0xb237('0x30')](function(_0x40e77f){var _0xc366a9=parseInt(_0x40e77f['version'][_0xb237('0x72')](0x0));var _0x228c9c=util[_0xb237('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0xc025cf[_0xb237('0x53')],_0x3b44c3['id']);if(_0xc366a9>0x6){_0x228c9c=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xc025cf[_0xb237('0x53')],_0x3b44c3['id']);}logger['info'](_0xb237('0x6e'),_0xb237('0x73'));emit(util[_0xb237('0x28')](_0xb237('0x67'),_0x147368[_0xb237('0x11')]),_0xb237('0x68'),{'uri':_0x228c9c});})[_0xb237('0x69')](function(_0x59aef5){logger[_0xb237('0x6a')](_0xb237('0x6e'),JSON[_0xb237('0x27')](_0x59aef5));});};exports['unmanaged']=function(_0x4b6d41,_0x10e3e9,_0x425682,_0x226b77,_0xc64f4b,_0x340d17){var _0x5461f7,_0x10dfa8,_0x2cd5a5,_0x64481b;_0x340d17['remoteUri']=intUtil[_0xb237('0x6c')](_0x340d17[_0xb237('0x53')]);_0x340d17[_0xb237('0x54')]=intUtil[_0xb237('0x6c')](_0x340d17[_0xb237('0x54')]);def['uri']=util[_0xb237('0x28')](_0xb237('0x56'),_0x340d17['remoteUri']);if(_0xc64f4b&&_0xc64f4b['monitor_format']){logger[_0xb237('0xf')]('['+_0x10e3e9[_0xb237('0x74')][_0xb237('0x75')]()+']',_0xb237('0x59'));_0x10e3e9[_0xb237('0x5a')]=util['format'](_0xb237('0x5b'),_0x340d17[_0xb237('0x54')],_0x10e3e9[_0xb237('0x5c')],md5(_0x10e3e9[_0xb237('0x5c')]));}else{_0x10e3e9[_0xb237('0x5a')]='';}return getConnection(_0x340d17)[_0xb237('0x30')](function(_0x493f82){_0x64481b=_0x493f82;if(!_['isNil'](_0x226b77)){return getUser(_0x340d17,_0x226b77[_0xb237('0x11')],_0x64481b);}else{return getUser(_0x340d17,null,_0x64481b);}})[_0xb237('0x30')](function(_0x391f68){_0x5461f7=_0x391f68;logger['info'](_0xb237('0x5d'),_0x5461f7['id']);return getEndUser(_0x340d17,_0x10e3e9[_0xb237('0x5e')],_0x10e3e9[_0xb237('0x76')],_0x64481b);})[_0xb237('0x30')](function(_0x4b14bb){_0x10dfa8=_0x4b14bb;logger[_0xb237('0xf')](_0xb237('0x5f'),_0x10dfa8['id']);return getTicket(_0x340d17,_0x5461f7,_0x10dfa8,_0x425682,_0x10e3e9,_0x425682[_0xb237('0x60')],_0x64481b,'Inbound');})['then'](function(_0x18b531){_0x2cd5a5=_0x18b531;logger[_0xb237('0xf')]('Ticket\x20created!');logger[_0xb237('0xf')]('The\x20Ticket\x20ID\x20is:',_0x2cd5a5['id']);return setRelationship(_0x64481b,_0x5461f7,_0x2cd5a5,_0xb237('0x71'));})[_0xb237('0x30')](function(){return setRelationship(_0x64481b,_0x10dfa8,_0x2cd5a5,_0xb237('0x63'));})[_0xb237('0x30')](function(){return getServerInfo(_0x64481b);})[_0xb237('0x69')](function(_0x2d2433){logger[_0xb237('0x6a')]('['+_0x10e3e9[_0xb237('0x74')][_0xb237('0x75')]()+']',JSON[_0xb237('0x27')](_0x2d2433));});}; \ 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 f015adc..e23f154 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 _0x7d22=['validateEmail','isNil','test','lodash','getString','sortBy','length','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','push','format','variable','%s:\x20%s','join','substring'];(function(_0x36f8ef,_0x44716d){var _0x443b23=function(_0x55a44c){while(--_0x55a44c){_0x36f8ef['push'](_0x36f8ef['shift']());}};_0x443b23(++_0x44716d);}(_0x7d22,0x1b3));var _0x27d2=function(_0xf6a2ee,_0x24bc47){_0xf6a2ee=_0xf6a2ee-0x0;var _0xaf3bac=_0x7d22[_0xf6a2ee];return _0xaf3bac;};'use strict';var _=require(_0x27d2('0x0'));var util=require('util');exports[_0x27d2('0x1')]=function(_0x5d74b0,_0x39aa00,_0x3da9a8){var _0x38efc5=[];if(_0x5d74b0['length']>0x0){var _0x1d7b3f=_[_0x27d2('0x2')](_0x5d74b0,['id']);for(var _0x23d237=0x0;_0x23d237<_0x1d7b3f[_0x27d2('0x3')];_0x23d237++){var _0x55b2d6=_0x1d7b3f[_0x23d237];if(_0x55b2d6[_0x27d2('0x4')]==='string'){_0x38efc5['push'](_0x55b2d6['content']);}else if(_0x55b2d6[_0x27d2('0x4')]==='variable'&&_0x55b2d6[_0x27d2('0x5')]){_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]&&_0x38efc5['push'](_0x39aa00[_0x55b2d6[_0x27d2('0x5')]][_0x27d2('0x6')]());}else if(_0x55b2d6[_0x27d2('0x4')]===_0x27d2('0x7')&&_0x55b2d6[_0x27d2('0x8')]&&_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]){_0x39aa00[_0x55b2d6['Variable'][_0x27d2('0x9')][_0x27d2('0xa')]()]&&_0x38efc5['push'](_0x39aa00[_0x55b2d6['Variable']['name'][_0x27d2('0xa')]()]['toString']());}else if(_0x55b2d6[_0x27d2('0x4')]===_0x27d2('0xb')){if(_0x55b2d6[_0x27d2('0xc')]===_0x27d2('0xd')&&_0x55b2d6[_0x27d2('0xe')]){_0x38efc5[_0x27d2('0xf')](util[_0x27d2('0x10')]('%s:\x20%s',_0x55b2d6['key'],_0x55b2d6['keyContent']));}else if(_0x55b2d6['keyType']===_0x27d2('0x11')&&_0x55b2d6['variableName']&&_0x55b2d6[_0x27d2('0xe')]){_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]&&_0x38efc5[_0x27d2('0xf')](util[_0x27d2('0x10')]('%s:\x20%s',_0x55b2d6[_0x27d2('0xe')],_0x39aa00[_0x55b2d6[_0x27d2('0x5')]]));}else if(_0x55b2d6['keyType']===_0x27d2('0x7')&&_0x55b2d6[_0x27d2('0x8')]&&_0x55b2d6['Variable']['name']&&_0x55b2d6['key']){_0x39aa00[_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]['toLowerCase']()]&&_0x38efc5[_0x27d2('0xf')](util['format'](_0x27d2('0x12'),_0x55b2d6[_0x27d2('0xe')],_0x39aa00[_0x55b2d6[_0x27d2('0x8')][_0x27d2('0x9')]['toLowerCase']()]));}}}}return _0x38efc5[_0x27d2('0x13')](_0x3da9a8);};exports['stripTrailingSlash']=function(_0x5d153b){var _0x324b51=_0x5d153b['slice'](-0x1);if(_0x324b51==='/'){_0x5d153b=_0x5d153b[_0x27d2('0x14')](0x0,_0x5d153b['lastIndexOf'](_0x324b51));}return _0x5d153b;};exports[_0x27d2('0x15')]=function(_0x27916e){if(!_[_0x27d2('0x16')](_0x27916e)&&_0x27916e!==''){var _0x165a7f=/^(([^<>()\[\]\\.,;:\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 _0x165a7f[_0x27d2('0x17')](String(_0x27916e)[_0x27d2('0xa')]());}else{return![];}}; \ No newline at end of file +var _0xcc07=['Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','variable','variableName','push','toString','customVariable'];(function(_0x16cb49,_0x531ce8){var _0x53d3e0=function(_0x2a5814){while(--_0x2a5814){_0x16cb49['push'](_0x16cb49['shift']());}};_0x53d3e0(++_0x531ce8);}(_0xcc07,0x189));var _0x7cc0=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xcc07[_0x1139d0];return _0xcc01a6;};'use strict';var _=require(_0x7cc0('0x0'));var util=require(_0x7cc0('0x1'));exports[_0x7cc0('0x2')]=function(_0x2269e4,_0x2e6e97,_0x51f548){var _0x22dc37=[];if(_0x2269e4[_0x7cc0('0x3')]>0x0){var _0x237102=_[_0x7cc0('0x4')](_0x2269e4,['id']);for(var _0x2cbcb0=0x0;_0x2cbcb0<_0x237102[_0x7cc0('0x3')];_0x2cbcb0++){var _0x1a6dd0=_0x237102[_0x2cbcb0];if(_0x1a6dd0[_0x7cc0('0x5')]===_0x7cc0('0x6')){_0x22dc37['push'](_0x1a6dd0['content']);}else if(_0x1a6dd0[_0x7cc0('0x5')]===_0x7cc0('0x7')&&_0x1a6dd0[_0x7cc0('0x8')]){_0x2e6e97[_0x1a6dd0[_0x7cc0('0x8')]]&&_0x22dc37[_0x7cc0('0x9')](_0x2e6e97[_0x1a6dd0['variableName']][_0x7cc0('0xa')]());}else if(_0x1a6dd0['type']===_0x7cc0('0xb')&&_0x1a6dd0[_0x7cc0('0xc')]&&_0x1a6dd0[_0x7cc0('0xc')][_0x7cc0('0xd')]){_0x2e6e97[_0x1a6dd0[_0x7cc0('0xc')][_0x7cc0('0xd')][_0x7cc0('0xe')]()]&&_0x22dc37[_0x7cc0('0x9')](_0x2e6e97[_0x1a6dd0['Variable'][_0x7cc0('0xd')][_0x7cc0('0xe')]()][_0x7cc0('0xa')]());}else if(_0x1a6dd0['type']===_0x7cc0('0xf')){if(_0x1a6dd0[_0x7cc0('0x10')]==='string'&&_0x1a6dd0['key']){_0x22dc37['push'](util[_0x7cc0('0x11')](_0x7cc0('0x12'),_0x1a6dd0[_0x7cc0('0x13')],_0x1a6dd0[_0x7cc0('0x14')]));}else if(_0x1a6dd0[_0x7cc0('0x10')]===_0x7cc0('0x7')&&_0x1a6dd0[_0x7cc0('0x8')]&&_0x1a6dd0['key']){_0x2e6e97[_0x1a6dd0[_0x7cc0('0x8')]]&&_0x22dc37[_0x7cc0('0x9')](util['format'](_0x7cc0('0x12'),_0x1a6dd0[_0x7cc0('0x13')],_0x2e6e97[_0x1a6dd0[_0x7cc0('0x8')]]));}else if(_0x1a6dd0[_0x7cc0('0x10')]==='customVariable'&&_0x1a6dd0['Variable']&&_0x1a6dd0[_0x7cc0('0xc')][_0x7cc0('0xd')]&&_0x1a6dd0[_0x7cc0('0x13')]){_0x2e6e97[_0x1a6dd0[_0x7cc0('0xc')]['name'][_0x7cc0('0xe')]()]&&_0x22dc37[_0x7cc0('0x9')](util[_0x7cc0('0x11')](_0x7cc0('0x12'),_0x1a6dd0[_0x7cc0('0x13')],_0x2e6e97[_0x1a6dd0[_0x7cc0('0xc')][_0x7cc0('0xd')][_0x7cc0('0xe')]()]));}}}}return _0x22dc37[_0x7cc0('0x15')](_0x51f548);};exports[_0x7cc0('0x16')]=function(_0x59571b){var _0x5ab874=_0x59571b['slice'](-0x1);if(_0x5ab874==='/'){_0x59571b=_0x59571b[_0x7cc0('0x17')](0x0,_0x59571b['lastIndexOf'](_0x5ab874));}return _0x59571b;};exports[_0x7cc0('0x18')]=function(_0x2f9f9f){if(!_[_0x7cc0('0x19')](_0x2f9f9f)&&_0x2f9f9f!==''){var _0x67ca3c=/^(([^<>()\[\]\\.,;:\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 _0x67ca3c[_0x7cc0('0x1a')](String(_0x2f9f9f)[_0x7cc0('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 98d9257..18f89e5 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(_0x157bd8,_0x39eeb6){var _0x390fa5=function(_0x330586){while(--_0x330586){_0x157bd8['push'](_0x157bd8['shift']());}};_0x390fa5(++_0x39eeb6);}(_0x34e8,0x12c));var _0x834e=function(_0x3e9552,_0x3f2bde){_0x3e9552=_0x3e9552-0x0;var _0x3b0dfa=_0x34e8[_0x3e9552];return _0x3b0dfa;};'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(_0x3f638a,_0x3a44c9){var _0x3bbc7c=function(_0x2f52af){while(--_0x2f52af){_0x3f638a['push'](_0x3f638a['shift']());}};_0x3bbc7c(++_0x3a44c9);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 7c4a7ad..e68498e 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 _0xa4fe=['The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','zendesk','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','%s/search.json','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','results','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','Basic\x20%s','toString','[HTTP]','stringify','GET','forEach','includes','string','picklist','nameField','customField','toLowerCase','type','idField','custom_fields','push','content','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum'];(function(_0x487cdc,_0x3c9092){var _0x81895a=function(_0x26e2a5){while(--_0x26e2a5){_0x487cdc['push'](_0x487cdc['shift']());}};_0x81895a(++_0x3c9092);}(_0xa4fe,0x76));var _0xea4f=function(_0x2bd452,_0x133b87){_0x2bd452=_0x2bd452-0x0;var _0x2685ce=_0xa4fe[_0x2bd452];return _0x2685ce;};'use strict';var _=require('lodash');var rp=require(_0xea4f('0x0'));var md5=require(_0xea4f('0x1'));var util=require('util');var Redis=require(_0xea4f('0x2'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xea4f('0x3'));config[_0xea4f('0x4')]=_[_0xea4f('0x5')](config['redis'],{'host':_0xea4f('0x6'),'port':0x18eb});var io=require(_0xea4f('0x7'))(new Redis(config['redis']));function emit(_0x548108,_0xe24c80,_0x1f1a6a){io['to'](_0x548108)['emit'](_0xe24c80,_0x1f1a6a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0xd2a0a1,_0x407a8e,_0x1da506,_0xac59e0,_0x564043){logger[_0xea4f('0x8')](_0xea4f('0x9'));return request({'uri':util[_0xea4f('0xa')](_0xea4f('0xb'),_0xd2a0a1[_0xea4f('0xc')]),'method':_0xea4f('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x1da506['id'],'submitter_id':_0x407a8e?_0x407a8e['id']:undefined,'assignee_id':_0x407a8e?_0x407a8e['id']:undefined,'tags':getTags(_0xac59e0[_0xea4f('0xe')],_0xea4f('0xf')),'subject':intUtil[_0xea4f('0x10')](_0xac59e0['Subjects'],_0x564043,'\x20'),'description':intUtil['getString'](_0xac59e0['Descriptions'],_0x564043,'\x0a'),'comment':{'public':![],'body':intUtil[_0xea4f('0x10')](_0xac59e0[_0xea4f('0x11')],_0x564043,'\x0a')}},getCustomFields(_0xac59e0[_0xea4f('0x12')],_0x564043))}})[_0xea4f('0x13')](function(_0xf371f8){logger['info'](_0xea4f('0x14'));return _0xf371f8[_0xea4f('0x15')];});}function getUser(_0x21629e,_0x1172fd){if(intUtil['validateEmail'](_0x1172fd)){logger[_0xea4f('0x8')]('Getting\x20agent\x20with\x20email',_0x1172fd);return request({'uri':util['format'](_0xea4f('0x16'),_0x21629e['remoteUri']),'qs':{'query':util[_0xea4f('0xa')]('type:user\x20role:agent\x20email:%s',_0x1172fd)}})[_0xea4f('0x13')](function(_0x36f82c){if(_0x36f82c[_0xea4f('0x17')]){logger['info'](_0xea4f('0x18'));return _[_0xea4f('0x19')](_0x36f82c['results'],{'email':_0x1172fd,'role':_0xea4f('0x1a')});}else{logger[_0xea4f('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x1b'),_0x21629e[_0xea4f('0xc')])})[_0xea4f('0x13')](function(_0x69f68b){logger[_0xea4f('0x8')](_0xea4f('0x1c'));return _0x69f68b[_0xea4f('0x1d')];});}});}else{logger[_0xea4f('0x8')](_0xea4f('0x1e'));return request({'uri':util[_0xea4f('0xa')]('%s/users/me.json',_0x21629e[_0xea4f('0xc')])})[_0xea4f('0x13')](function(_0x3824e3){logger['info']('Admin\x20account\x20selected.');return _0x3824e3[_0xea4f('0x1d')];});}}function getEndUser(_0x457fac,_0x2c0bfc,_0x59062b){logger['info'](_0xea4f('0x1f'),_0x59062b);return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x16'),_0x457fac['remoteUri']),'qs':{'query':util[_0xea4f('0xa')](_0xea4f('0x20'),_0x59062b)}})[_0xea4f('0x13')](function(_0x2943b1){var _0x2e819b;if(_0x2943b1[_0xea4f('0x21')]['length']){_0x2943b1[_0xea4f('0x21')]=_[_0xea4f('0x22')](_0x2943b1[_0xea4f('0x21')],{'suspended':![],'role':_0xea4f('0x23')});if(_0x2943b1[_0xea4f('0x21')][_0xea4f('0x24')]){_0x2e819b=_[_0xea4f('0x25')](_0x2943b1[_0xea4f('0x21')]);}}if(_0x2e819b){logger[_0xea4f('0x8')](_0xea4f('0x26'));return _0x2e819b;}else{logger['info'](_0xea4f('0x27'));return request({'uri':util[_0xea4f('0xa')](_0xea4f('0x28'),_0x457fac['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0xea4f('0xa')]('Caller\x20-\x20%s',_0x2c0bfc||_0x59062b),'phone':_0x59062b}}})[_0xea4f('0x13')](function(_0x13b71c){logger[_0xea4f('0x8')](_0xea4f('0x29'));return _0x13b71c[_0xea4f('0x1d')];});}});}function getAuth(_0xbe6772){var _0x3d0198;if(_0xbe6772[_0xea4f('0x2a')]===_0xea4f('0x2b')){_0x3d0198=util[_0xea4f('0xa')](_0xea4f('0x2c'),_0xbe6772['username'],_0xbe6772[_0xea4f('0x2b')]);}else if(_0xbe6772[_0xea4f('0x2a')]==='token'){_0x3d0198=util[_0xea4f('0xa')]('%s/token:%s',_0xbe6772[_0xea4f('0x2d')],_0xbe6772['token']);}return util[_0xea4f('0xa')](_0xea4f('0x2e'),new Buffer(_0x3d0198)[_0xea4f('0x2f')]('base64'));}function request(_0x5e13f1){logger['debug'](_0xea4f('0x30'),JSON[_0xea4f('0x31')](_0x5e13f1));return rp(_[_0xea4f('0x5')](_0x5e13f1,{'method':_0xea4f('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5364fa,_0x302132){var _0x540d07=[];if(_0x5364fa&&_0x5364fa[_0xea4f('0x24')]>0x0){_0x540d07=_['map'](_0x5364fa,_0x302132);}return _0x540d07;}function getCustomFields(_0x3f9bb2,_0x3bf627){var _0x217120=[];var _0x16999d={'custom_fields':[]};if(_0x3f9bb2['length']>0x0){_[_0xea4f('0x33')](_0x3f9bb2,function(_0x511724){if(_[_0xea4f('0x34')]([_0xea4f('0x35'),_0xea4f('0x36')],_0x511724['type'])&&_0x511724[_0xea4f('0x37')]&&!_0x511724[_0xea4f('0x38')]){_0x16999d[_0x511724[_0xea4f('0x37')][_0xea4f('0x39')]()]=_0x511724['content'][_0xea4f('0x2f')]();}else if(_[_0xea4f('0x34')](['string',_0xea4f('0x36')],_0x511724[_0xea4f('0x3a')])&&_0x511724[_0xea4f('0x3b')]&&_0x511724[_0xea4f('0x38')]){_0x16999d[_0xea4f('0x3c')][_0xea4f('0x3d')]({'id':_0x511724[_0xea4f('0x3b')],'value':_0x511724[_0xea4f('0x3e')]['toString']()});}else if(_0x511724[_0xea4f('0x3a')]==='variable'&&_0x511724[_0xea4f('0x3f')]&&_0x511724[_0xea4f('0x3b')]&&_0x511724['customField']){_0x3bf627[_0x511724[_0xea4f('0x3f')]]&&_0x16999d[_0xea4f('0x3c')]['push']({'id':_0x511724[_0xea4f('0x3b')],'value':_0x3bf627[_0x511724[_0xea4f('0x3f')]]['toString']()});}else if(_0x511724[_0xea4f('0x3a')]==='customVariable'&&_0x511724['Variable']&&_0x511724['Variable'][_0xea4f('0xf')]&&_0x511724['idField']&&_0x511724[_0xea4f('0x38')]){_0x3bf627[_0x511724[_0xea4f('0x40')][_0xea4f('0xf')]['toLowerCase']()]&&_0x16999d[_0xea4f('0x3c')][_0xea4f('0x3d')]({'id':_0x511724[_0xea4f('0x3b')],'value':_0x3bf627[_0x511724[_0xea4f('0x40')]['name'][_0xea4f('0x39')]()][_0xea4f('0x2f')]()});}});}return _0x16999d;}exports[_0xea4f('0x41')]=function(_0x5e5620,_0x1baa37,_0x3d6aae,_0x3438dc,_0x1fa1c7,_0x5996ca){var _0x22c909,_0x5c9fcf;_0x5996ca[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x5996ca[_0xea4f('0xc')]);_0x5996ca['serverUrl']=intUtil['stripTrailingSlash'](_0x5996ca[_0xea4f('0x43')]);if(_0x1fa1c7&&_0x1fa1c7['monitor_format']){logger[_0xea4f('0x8')](_0xea4f('0x44'),'Recording\x20is\x20enabled!');_0x1baa37[_0xea4f('0x45')]=util[_0xea4f('0xa')](_0xea4f('0x46'),_0x5996ca[_0xea4f('0x43')],_0x1baa37[_0xea4f('0x47')],md5(_0x1baa37[_0xea4f('0x47')]));}else{_0x1baa37[_0xea4f('0x45')]='';}headers[_0xea4f('0x48')]=getAuth(_0x5996ca);return getUser(_0x5996ca,_0x3438dc[_0xea4f('0x49')])[_0xea4f('0x13')](function(_0x1e542b){_0x22c909=_0x1e542b;logger['info'](_0xea4f('0x4a'),_0x22c909['id']);return getEndUser(_0x5996ca,_0x1baa37[_0xea4f('0x4b')],_0x1baa37['calleridnum']);})[_0xea4f('0x13')](function(_0x344c2d){_0x5c9fcf=_0x344c2d;logger['info'](_0xea4f('0x4c'),_0x5c9fcf['id']);return getTicket(_0x5996ca,_0x22c909,_0x5c9fcf,_0x3d6aae,_0x1baa37);})['then'](function(_0xd14fc2){if(_0xd14fc2){logger[_0xea4f('0x8')]('The\x20Ticket\x20ID\x20is:',_0xd14fc2['id']);switch(_0x5996ca[_0xea4f('0x3a')]){case'integrationTab':logger[_0xea4f('0x8')]('[QUEUE]',_0xea4f('0x4d'));return request({'uri':util['format'](_0xea4f('0x4e'),_0x5996ca[_0xea4f('0xc')],_0x22c909['id'],_0xd14fc2['id']),'method':_0xea4f('0xd')});case _0xea4f('0x4f'):logger[_0xea4f('0x8')]('[QUEUE]',_0xea4f('0x50'));emit(util[_0xea4f('0xa')]('user:%s',_0x3438dc[_0xea4f('0xf')]),_0xea4f('0x51'),{'uri':util[_0xea4f('0xa')](_0xea4f('0x52'),_0x5996ca[_0xea4f('0xc')][_0xea4f('0x53')](_0xea4f('0x54'),''),_0xd14fc2['id'])});break;default:logger['error']('[QUEUE]',_0xea4f('0x55'));}}})[_0xea4f('0x56')](function(_0x2898f9){logger[_0xea4f('0x57')](_0xea4f('0x58'),util['inspect'](_0x2898f9,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x158de2,_0x5378c4,_0x16acf7,_0x5b9c7a,_0x225ed2,_0x4d2ffb,_0xb98a8f){var _0x519b95,_0x510280;_0x4d2ffb[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x4d2ffb['remoteUri']);_0x4d2ffb[_0xea4f('0x43')]=intUtil[_0xea4f('0x42')](_0x4d2ffb[_0xea4f('0x43')]);if(_0xb98a8f&&_0xb98a8f[_0xea4f('0x59')]&&_0xb98a8f[_0xea4f('0x59')]!==_0xea4f('0x5a')){logger[_0xea4f('0x8')]('[OUTBOUND]',_0xea4f('0x5b'));_0x5378c4[_0xea4f('0x45')]=util[_0xea4f('0xa')](_0xea4f('0x46'),_0x4d2ffb[_0xea4f('0x43')],_0x5378c4[_0xea4f('0x47')],md5(_0x5378c4[_0xea4f('0x47')]));}headers[_0xea4f('0x48')]=getAuth(_0x4d2ffb);return getUser(_0x4d2ffb,_0x5b9c7a[_0xea4f('0x49')])[_0xea4f('0x13')](function(_0x2fc090){_0x519b95=_0x2fc090;logger[_0xea4f('0x8')](_0xea4f('0x4a'),_0x519b95['id']);return getEndUser(_0x4d2ffb,_0x5378c4[_0xea4f('0x5c')],_0x5378c4[_0xea4f('0x5d')]);})[_0xea4f('0x13')](function(_0x23c295){_0x510280=_0x23c295;logger[_0xea4f('0x8')](_0xea4f('0x4c'),_0x510280['id']);return getTicket(_0x4d2ffb,_0x519b95,_0x510280,_0x16acf7,_0x5378c4);})[_0xea4f('0x13')](function(_0x50fcf4){if(_0x50fcf4){logger['info'](_0xea4f('0x5e'),_0x50fcf4['id']);switch(_0x4d2ffb['type']){case _0xea4f('0x5f'):logger['info']('[OUTBOUND]',_0xea4f('0x4d'));return request({'uri':util['format'](_0xea4f('0x4e'),_0x4d2ffb[_0xea4f('0xc')],_0x519b95['id'],_0x50fcf4['id']),'method':_0xea4f('0xd')});case'newTab':logger[_0xea4f('0x8')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xea4f('0xa')](_0xea4f('0x60'),_0x5b9c7a[_0xea4f('0xf')]),'trigger:browser:url',{'uri':util[_0xea4f('0xa')]('%s/agent/tickets/%s',_0x4d2ffb['remoteUri'][_0xea4f('0x53')](_0xea4f('0x54'),''),_0x50fcf4['id'])});break;default:logger[_0xea4f('0x57')](_0xea4f('0x61'),_0xea4f('0x55'));}}})[_0xea4f('0x56')](function(_0x120f6e){logger[_0xea4f('0x57')](_0xea4f('0x62'),util[_0xea4f('0x63')](_0x120f6e,{'showHidden':!![],'depth':null}));});};exports[_0xea4f('0x64')]=function(_0x3bc38c,_0x1a9195,_0x7ed5ad,_0x45887a,_0x51431c,_0x3b9dc4){var _0x2b3c2d,_0x140d9b;_0x3b9dc4[_0xea4f('0xc')]=intUtil[_0xea4f('0x42')](_0x3b9dc4[_0xea4f('0xc')]);_0x3b9dc4[_0xea4f('0x43')]=intUtil[_0xea4f('0x42')](_0x3b9dc4['serverUrl']);if(_0x51431c&&_0x51431c[_0xea4f('0x65')]){logger[_0xea4f('0x8')]('['+_0x1a9195[_0xea4f('0x66')][_0xea4f('0x67')]()+']','Recording\x20is\x20enabled!');_0x1a9195['recordingURL']=util['format'](_0xea4f('0x46'),_0x3b9dc4['serverUrl'],_0x1a9195[_0xea4f('0x47')],md5(_0x1a9195[_0xea4f('0x47')]));}else{_0x1a9195[_0xea4f('0x45')]='';}headers[_0xea4f('0x48')]=getAuth(_0x3b9dc4);return getUser(_0x3b9dc4)['then'](function(_0x416ff7){_0x2b3c2d=_0x416ff7;logger['info'](_0xea4f('0x4a'),_0x2b3c2d['id']);return getEndUser(_0x3b9dc4,_0x1a9195[_0xea4f('0x4b')],_0x1a9195[_0xea4f('0x68')]);})['then'](function(_0x1ac8d2){_0x140d9b=_0x1ac8d2;logger[_0xea4f('0x8')](_0xea4f('0x4c'),_0x140d9b['id']);return getTicket(_0x3b9dc4,_0x2b3c2d,_0x140d9b,_0x7ed5ad,_0x1a9195);})[_0xea4f('0x13')](function(_0x115a03){if(_0x115a03){logger['info'](_0xea4f('0x5e'),_0x115a03['id']);}})[_0xea4f('0x56')](function(_0x2bc398){logger[_0xea4f('0x57')]('['+_0x1a9195['lastevent'][_0xea4f('0x67')]()+']'+_0xea4f('0x69'),util[_0xea4f('0x63')](_0x2bc398,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd406=['push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','ioredis','../../../../config/environment','redis','defaults','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','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','toString','debug','[HTTP]','GET','length','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xd406,0x104));var _0x6d40=function(_0x28fdb8,_0x3400c1){_0x28fdb8=_0x28fdb8-0x0;var _0x2fc23f=_0xd406[_0x28fdb8];return _0x2fc23f;};'use strict';var _=require('lodash');var rp=require(_0x6d40('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x6d40('0x1'));var intUtil=require('./util');var config=require(_0x6d40('0x2'));var logger=require('../../../../config/logger')('zendesk');config[_0x6d40('0x3')]=_[_0x6d40('0x4')](config[_0x6d40('0x3')],{'host':_0x6d40('0x5'),'port':0x18eb});var io=require(_0x6d40('0x6'))(new Redis(config[_0x6d40('0x3')]));function emit(_0x3a3a4f,_0x597579,_0x34ed20){io['to'](_0x3a3a4f)[_0x6d40('0x7')](_0x597579,_0x34ed20);}var headers={'Content-Type':_0x6d40('0x8'),'Accept':_0x6d40('0x8')};function getTicket(_0x39c4c3,_0x39527f,_0x3d2015,_0x5afbaf,_0x4360b0){logger[_0x6d40('0x9')](_0x6d40('0xa'));return request({'uri':util[_0x6d40('0xb')](_0x6d40('0xc'),_0x39c4c3[_0x6d40('0xd')]),'method':_0x6d40('0xe'),'body':{'ticket':_[_0x6d40('0xf')]({'requester_id':_0x3d2015['id'],'submitter_id':_0x39527f?_0x39527f['id']:undefined,'assignee_id':_0x39527f?_0x39527f['id']:undefined,'tags':getTags(_0x5afbaf[_0x6d40('0x10')],_0x6d40('0x11')),'subject':intUtil[_0x6d40('0x12')](_0x5afbaf[_0x6d40('0x13')],_0x4360b0,'\x20'),'description':intUtil[_0x6d40('0x12')](_0x5afbaf[_0x6d40('0x14')],_0x4360b0,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6d40('0x12')](_0x5afbaf[_0x6d40('0x14')],_0x4360b0,'\x0a')}},getCustomFields(_0x5afbaf[_0x6d40('0x15')],_0x4360b0))}})[_0x6d40('0x16')](function(_0x1a845c){logger[_0x6d40('0x9')](_0x6d40('0x17'));return _0x1a845c[_0x6d40('0x18')];});}function getUser(_0x1b3a8c,_0x3f40b0){if(intUtil['validateEmail'](_0x3f40b0)){logger[_0x6d40('0x9')](_0x6d40('0x19'),_0x3f40b0);return request({'uri':util[_0x6d40('0xb')](_0x6d40('0x1a'),_0x1b3a8c[_0x6d40('0xd')]),'qs':{'query':util[_0x6d40('0xb')](_0x6d40('0x1b'),_0x3f40b0)}})['then'](function(_0x280753){if(_0x280753[_0x6d40('0x1c')]){logger[_0x6d40('0x9')]('Agent\x20found!');return _['find'](_0x280753[_0x6d40('0x1d')],{'email':_0x3f40b0,'role':_0x6d40('0x1e')});}else{logger[_0x6d40('0x9')](_0x6d40('0x1f'));return request({'uri':util['format'](_0x6d40('0x20'),_0x1b3a8c[_0x6d40('0xd')])})[_0x6d40('0x16')](function(_0x1f771e){logger[_0x6d40('0x9')]('Admin\x20account\x20selected.');return _0x1f771e[_0x6d40('0x21')];});}});}else{logger[_0x6d40('0x9')](_0x6d40('0x1f'));return request({'uri':util[_0x6d40('0xb')]('%s/users/me.json',_0x1b3a8c[_0x6d40('0xd')])})['then'](function(_0x375931){logger[_0x6d40('0x9')](_0x6d40('0x22'));return _0x375931[_0x6d40('0x21')];});}}function getEndUser(_0x214776,_0x503a8b,_0x1b7866){logger[_0x6d40('0x9')](_0x6d40('0x23'),_0x1b7866);return request({'uri':util[_0x6d40('0xb')](_0x6d40('0x1a'),_0x214776[_0x6d40('0xd')]),'qs':{'query':util[_0x6d40('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x1b7866)}})[_0x6d40('0x16')](function(_0x5b0e42){var _0x1196d3;if(_0x5b0e42[_0x6d40('0x1d')]['length']){_0x5b0e42['results']=_[_0x6d40('0x24')](_0x5b0e42[_0x6d40('0x1d')],{'suspended':![],'role':_0x6d40('0x25')});if(_0x5b0e42[_0x6d40('0x1d')]['length']){_0x1196d3=_[_0x6d40('0x26')](_0x5b0e42[_0x6d40('0x1d')]);}}if(_0x1196d3){logger['info'](_0x6d40('0x27'));return _0x1196d3;}else{logger[_0x6d40('0x9')](_0x6d40('0x28'));return request({'uri':util[_0x6d40('0xb')](_0x6d40('0x29'),_0x214776[_0x6d40('0xd')]),'method':_0x6d40('0xe'),'body':{'user':{'role':_0x6d40('0x25'),'name':util[_0x6d40('0xb')](_0x6d40('0x2a'),_0x503a8b||_0x1b7866),'phone':_0x1b7866}}})[_0x6d40('0x16')](function(_0x3e95a1){logger['info'](_0x6d40('0x2b'));return _0x3e95a1[_0x6d40('0x21')];});}});}function getAuth(_0x48f4e4){var _0x398be5;if(_0x48f4e4[_0x6d40('0x2c')]===_0x6d40('0x2d')){_0x398be5=util['format'](_0x6d40('0x2e'),_0x48f4e4[_0x6d40('0x2f')],_0x48f4e4[_0x6d40('0x2d')]);}else if(_0x48f4e4[_0x6d40('0x2c')]==='token'){_0x398be5=util[_0x6d40('0xb')](_0x6d40('0x30'),_0x48f4e4[_0x6d40('0x2f')],_0x48f4e4['token']);}return util[_0x6d40('0xb')]('Basic\x20%s',new Buffer(_0x398be5)[_0x6d40('0x31')]('base64'));}function request(_0xd8d623){logger[_0x6d40('0x32')](_0x6d40('0x33'),JSON['stringify'](_0xd8d623));return rp(_[_0x6d40('0x4')](_0xd8d623,{'method':_0x6d40('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x471b0e,_0x54ee8b){var _0x54583a=[];if(_0x471b0e&&_0x471b0e[_0x6d40('0x35')]>0x0){_0x54583a=_['map'](_0x471b0e,_0x54ee8b);}return _0x54583a;}function getCustomFields(_0x24569f,_0x1d72bb){var _0x2478dd=[];var _0x115424={'custom_fields':[]};if(_0x24569f[_0x6d40('0x35')]>0x0){_['forEach'](_0x24569f,function(_0x20b882){if(_['includes']([_0x6d40('0x36'),_0x6d40('0x37')],_0x20b882[_0x6d40('0x38')])&&_0x20b882[_0x6d40('0x39')]&&!_0x20b882[_0x6d40('0x3a')]){_0x115424[_0x20b882[_0x6d40('0x39')][_0x6d40('0x3b')]()]=_0x20b882[_0x6d40('0x3c')][_0x6d40('0x31')]();}else if(_[_0x6d40('0x3d')]([_0x6d40('0x36'),_0x6d40('0x37')],_0x20b882[_0x6d40('0x38')])&&_0x20b882[_0x6d40('0x3e')]&&_0x20b882[_0x6d40('0x3a')]){_0x115424[_0x6d40('0x3f')][_0x6d40('0x40')]({'id':_0x20b882['idField'],'value':_0x20b882[_0x6d40('0x3c')][_0x6d40('0x31')]()});}else if(_0x20b882[_0x6d40('0x38')]===_0x6d40('0x41')&&_0x20b882['variableName']&&_0x20b882['idField']&&_0x20b882[_0x6d40('0x3a')]){_0x1d72bb[_0x20b882[_0x6d40('0x42')]]&&_0x115424[_0x6d40('0x3f')][_0x6d40('0x40')]({'id':_0x20b882[_0x6d40('0x3e')],'value':_0x1d72bb[_0x20b882['variableName']][_0x6d40('0x31')]()});}else if(_0x20b882[_0x6d40('0x38')]===_0x6d40('0x43')&&_0x20b882[_0x6d40('0x44')]&&_0x20b882[_0x6d40('0x44')][_0x6d40('0x11')]&&_0x20b882[_0x6d40('0x3e')]&&_0x20b882[_0x6d40('0x3a')]){_0x1d72bb[_0x20b882['Variable'][_0x6d40('0x11')]['toLowerCase']()]&&_0x115424['custom_fields'][_0x6d40('0x40')]({'id':_0x20b882[_0x6d40('0x3e')],'value':_0x1d72bb[_0x20b882[_0x6d40('0x44')][_0x6d40('0x11')][_0x6d40('0x3b')]()][_0x6d40('0x31')]()});}});}return _0x115424;}exports[_0x6d40('0x45')]=function(_0x29e9cc,_0xd1e789,_0x2f3e94,_0xb23b91,_0x218e90,_0x298c12){var _0x2b61c8,_0x47d21b;_0x298c12[_0x6d40('0xd')]=intUtil[_0x6d40('0x46')](_0x298c12[_0x6d40('0xd')]);_0x298c12['serverUrl']=intUtil[_0x6d40('0x46')](_0x298c12[_0x6d40('0x47')]);if(_0x218e90&&_0x218e90[_0x6d40('0x48')]){logger[_0x6d40('0x9')](_0x6d40('0x49'),_0x6d40('0x4a'));_0xd1e789[_0x6d40('0x4b')]=util[_0x6d40('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x298c12[_0x6d40('0x47')],_0xd1e789[_0x6d40('0x4c')],md5(_0xd1e789[_0x6d40('0x4c')]));}else{_0xd1e789[_0x6d40('0x4b')]='';}headers[_0x6d40('0x4d')]=getAuth(_0x298c12);return getUser(_0x298c12,_0xb23b91['email'])[_0x6d40('0x16')](function(_0x3fc680){_0x2b61c8=_0x3fc680;logger[_0x6d40('0x9')]('The\x20User\x20ID\x20is:',_0x2b61c8['id']);return getEndUser(_0x298c12,_0xd1e789['calleridname'],_0xd1e789[_0x6d40('0x4e')]);})[_0x6d40('0x16')](function(_0x532be1){_0x47d21b=_0x532be1;logger[_0x6d40('0x9')](_0x6d40('0x4f'),_0x47d21b['id']);return getTicket(_0x298c12,_0x2b61c8,_0x47d21b,_0x2f3e94,_0xd1e789);})[_0x6d40('0x16')](function(_0x18a19e){if(_0x18a19e){logger[_0x6d40('0x9')]('The\x20Ticket\x20ID\x20is:',_0x18a19e['id']);switch(_0x298c12[_0x6d40('0x38')]){case _0x6d40('0x50'):logger['info'](_0x6d40('0x49'),_0x6d40('0x51'));return request({'uri':util[_0x6d40('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x298c12[_0x6d40('0xd')],_0x2b61c8['id'],_0x18a19e['id']),'method':_0x6d40('0xe')});case _0x6d40('0x52'):logger[_0x6d40('0x9')](_0x6d40('0x49'),_0x6d40('0x53'));emit(util['format'](_0x6d40('0x54'),_0xb23b91[_0x6d40('0x11')]),_0x6d40('0x55'),{'uri':util['format']('%s/agent/tickets/%s',_0x298c12[_0x6d40('0xd')]['replace']('/api/v2',''),_0x18a19e['id'])});break;default:logger[_0x6d40('0x56')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x6d40('0x57')](function(_0x11da71){logger[_0x6d40('0x56')](_0x6d40('0x58'),util[_0x6d40('0x59')](_0x11da71,{'showHidden':!![],'depth':null}));});};exports[_0x6d40('0x5a')]=function(_0x229c5a,_0x2de9e0,_0x182b80,_0x122ce7,_0x2829b3,_0x5444e5,_0x3da100){var _0x1153a0,_0x25ae43;_0x5444e5['remoteUri']=intUtil['stripTrailingSlash'](_0x5444e5[_0x6d40('0xd')]);_0x5444e5[_0x6d40('0x47')]=intUtil[_0x6d40('0x46')](_0x5444e5[_0x6d40('0x47')]);if(_0x3da100&&_0x3da100[_0x6d40('0x5b')]&&_0x3da100[_0x6d40('0x5b')]!=='none'){logger[_0x6d40('0x9')](_0x6d40('0x5c'),_0x6d40('0x4a'));_0x2de9e0['recordingURL']=util[_0x6d40('0xb')](_0x6d40('0x5d'),_0x5444e5[_0x6d40('0x47')],_0x2de9e0[_0x6d40('0x4c')],md5(_0x2de9e0['uniqueid']));}headers[_0x6d40('0x4d')]=getAuth(_0x5444e5);return getUser(_0x5444e5,_0x122ce7[_0x6d40('0x5e')])[_0x6d40('0x16')](function(_0x3e9285){_0x1153a0=_0x3e9285;logger[_0x6d40('0x9')]('The\x20User\x20ID\x20is:',_0x1153a0['id']);return getEndUser(_0x5444e5,_0x2de9e0[_0x6d40('0x5f')],_0x2de9e0[_0x6d40('0x60')]);})[_0x6d40('0x16')](function(_0x3f7fc5){_0x25ae43=_0x3f7fc5;logger[_0x6d40('0x9')](_0x6d40('0x4f'),_0x25ae43['id']);return getTicket(_0x5444e5,_0x1153a0,_0x25ae43,_0x182b80,_0x2de9e0);})['then'](function(_0x324e46){if(_0x324e46){logger[_0x6d40('0x9')](_0x6d40('0x61'),_0x324e46['id']);switch(_0x5444e5[_0x6d40('0x38')]){case'integrationTab':logger[_0x6d40('0x9')](_0x6d40('0x5c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x6d40('0xb')](_0x6d40('0x62'),_0x5444e5[_0x6d40('0xd')],_0x1153a0['id'],_0x324e46['id']),'method':_0x6d40('0xe')});case _0x6d40('0x52'):logger[_0x6d40('0x9')](_0x6d40('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6d40('0xb')](_0x6d40('0x54'),_0x122ce7[_0x6d40('0x11')]),'trigger:browser:url',{'uri':util[_0x6d40('0xb')](_0x6d40('0x63'),_0x5444e5[_0x6d40('0xd')][_0x6d40('0x64')](_0x6d40('0x65'),''),_0x324e46['id'])});break;default:logger[_0x6d40('0x56')](_0x6d40('0x5c'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x32bf3a){logger['error'](_0x6d40('0x66'),util[_0x6d40('0x59')](_0x32bf3a,{'showHidden':!![],'depth':null}));});};exports[_0x6d40('0x67')]=function(_0x414acb,_0x5cefef,_0x301b7b,_0x22aae9,_0x5c7876,_0x544450){var _0x9c6d0b,_0x33c216;_0x544450['remoteUri']=intUtil[_0x6d40('0x46')](_0x544450['remoteUri']);_0x544450['serverUrl']=intUtil[_0x6d40('0x46')](_0x544450[_0x6d40('0x47')]);if(_0x5c7876&&_0x5c7876['monitor_format']){logger['info']('['+_0x5cefef[_0x6d40('0x68')]['toUpperCase']()+']',_0x6d40('0x4a'));_0x5cefef[_0x6d40('0x4b')]=util[_0x6d40('0xb')](_0x6d40('0x5d'),_0x544450[_0x6d40('0x47')],_0x5cefef['uniqueid'],md5(_0x5cefef['uniqueid']));}else{_0x5cefef['recordingURL']='';}headers[_0x6d40('0x4d')]=getAuth(_0x544450);return getUser(_0x544450)[_0x6d40('0x16')](function(_0x55ece0){_0x9c6d0b=_0x55ece0;logger[_0x6d40('0x9')](_0x6d40('0x69'),_0x9c6d0b['id']);return getEndUser(_0x544450,_0x5cefef['calleridname'],_0x5cefef['calleridnum']);})[_0x6d40('0x16')](function(_0x25a41c){_0x33c216=_0x25a41c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x33c216['id']);return getTicket(_0x544450,_0x9c6d0b,_0x33c216,_0x301b7b,_0x5cefef);})[_0x6d40('0x16')](function(_0x53c2a8){if(_0x53c2a8){logger[_0x6d40('0x9')](_0x6d40('0x61'),_0x53c2a8['id']);}})[_0x6d40('0x57')](function(_0x1217eb){logger[_0x6d40('0x56')]('['+_0x5cefef[_0x6d40('0x68')][_0x6d40('0x6a')]()+']'+_0x6d40('0x6b'),util[_0x6d40('0x59')](_0x1217eb,{'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 c2f5bb4..91845cb 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 _0x795a=['trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','unmanaged','monitor_format','toUpperCase','calleridnum','request-promise','md5','./util','ioredis','bluebird','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','access_token','isBefore','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','refresh_token','expires_in','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','isNil','findIndex','email','info','Using\x20the\x20admin\x20account!','users','user','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','then','code','SUCCESS','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','lastevent','called','Call_Result','Called','connect','Answered','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x26d4ea,_0x939346){var _0x9ee3b3=function(_0x9e08f7){while(--_0x9e08f7){_0x26d4ea['push'](_0x26d4ea['shift']());}};_0x9ee3b3(++_0x939346);}(_0x795a,0xa2));var _0xa795=function(_0x5e3740,_0xb01758){_0x5e3740=_0x5e3740-0x0;var _0x534f06=_0x795a[_0x5e3740];return _0x534f06;};'use strict';var _=require('lodash');var rp=require(_0xa795('0x0'));var md5=require(_0xa795('0x1'));var util=require('util');var intUtil=require(_0xa795('0x2'));var moment=require('moment');var Redis=require(_0xa795('0x3'));var BPromise=require(_0xa795('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xa795('0x5'));config[_0xa795('0x6')]=_[_0xa795('0x7')](config[_0xa795('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa795('0x8'))(new Redis(config['redis']));function emit(_0x36a3a9,_0x5027d1,_0x4bb5b5){io['to'](_0x36a3a9)[_0xa795('0x9')](_0x5027d1,_0x4bb5b5);}function request(_0x3f8c04){logger[_0xa795('0xa')](_0xa795('0xb'),JSON[_0xa795('0xc')](_0x3f8c04));return rp(_0x3f8c04);}function getCustomFields(_0x37a1f0,_0x255749){var _0x3db82a={};if(_0x37a1f0['length']>0x0){_['forEach'](_0x37a1f0,function(_0x15a7b3){if(_[_0xa795('0xd')]([_0xa795('0xe'),'picklist'],_0x15a7b3[_0xa795('0xf')])&&_0x15a7b3[_0xa795('0x10')]){_0x3db82a[_0x15a7b3['idField']]=_0x15a7b3[_0xa795('0x11')][_0xa795('0x12')]();}else if(_0x15a7b3[_0xa795('0xf')]===_0xa795('0x13')&&_0x15a7b3[_0xa795('0x14')]&&_0x15a7b3[_0xa795('0x10')]&&_0x255749[_0x15a7b3[_0xa795('0x14')]]){_0x3db82a[_0x15a7b3['idField']]=_0x255749[_0x15a7b3[_0xa795('0x14')]][_0xa795('0x12')]();}else if(_0x15a7b3['type']==='customVariable'&&_0x15a7b3[_0xa795('0x15')]&&_0x15a7b3['Variable'][_0xa795('0x16')]&&_0x15a7b3[_0xa795('0x10')]&&_0x255749[_0x15a7b3[_0xa795('0x15')][_0xa795('0x16')][_0xa795('0x17')]()]){_0x3db82a[_0x15a7b3['idField']]=_0x255749[_0x15a7b3[_0xa795('0x15')][_0xa795('0x16')][_0xa795('0x17')]()][_0xa795('0x12')]();}});}return _0x3db82a;}function getName(_0x21fb7e){if(_0x21fb7e[_0xa795('0x18')]('\x20')>0x0){var _0xaca56=_0x21fb7e['split'](/ (.+)/);if(_0xaca56[0x1]){return _0xaca56;}}return[_0x21fb7e,_0x21fb7e];}var accountsTokens={};function getAccessToken(_0x4c252e){return new Promise(function(_0x12c85e,_0x348b97){if(!_['isNil'](accountsTokens[_0x4c252e['id']])&&!_['isNil'](accountsTokens[_0x4c252e['id']][_0xa795('0x19')])){if(moment()[_0xa795('0x1a')](accountsTokens[_0x4c252e['id']]['expires_in'])){_0x12c85e(accountsTokens[_0x4c252e['id']][_0xa795('0x19')]);}}var _0xf2f6f1;switch(_0x4c252e['zone']){case'US':_0xf2f6f1=_0xa795('0x1b');break;case'AU':_0xf2f6f1=_0xa795('0x1c');break;case'EU':_0xf2f6f1=_0xa795('0x1d');break;case'IN':_0xf2f6f1=_0xa795('0x1e');break;case'CN':_0xf2f6f1=_0xa795('0x1f');break;default:_0xf2f6f1=_0xa795('0x1d');break;}var _0x219d26={'method':_0xa795('0x20'),'uri':_0xf2f6f1+_0xa795('0x21'),'qs':{'refresh_token':_0x4c252e[_0xa795('0x22')],'client_id':_0x4c252e[_0xa795('0x23')],'client_secret':_0x4c252e['clientSecret'],'grant_type':_0xa795('0x24')},'json':!![]};return rp(_0x219d26)['then'](function(_0x384701){accountsTokens[_0x4c252e['id']]={'access_token':_0x384701[_0xa795('0x19')],'expires_in':moment()['add'](_0x384701[_0xa795('0x25')],'seconds')};_0x12c85e(_0x384701['access_token']);})['catch'](function(_0x2facb7){logger['error'](_0xa795('0x26'),_0x2facb7[_0xa795('0x27')]);_0x348b97(_0x2facb7);});});}function getUser(_0x4b0569,_0x432587,_0x546b34,_0x56be5c){logger['info'](_0xa795('0x28'));return request({'method':_0xa795('0x29'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x432587),'qs':{'type':_0xa795('0x2a')},'headers':{'Authorization':_0xa795('0x2b')+_0x4b0569},'json':!![]})['then'](function(_0x84e0d8){if(_0x84e0d8['users']){var _0x3a25c5=-0x1;if(_[_0xa795('0x2c')](_0x84e0d8['users'])){if(!_[_0xa795('0x2d')](_0x56be5c)){_0x3a25c5=_[_0xa795('0x2e')](_0x84e0d8['users'],function(_0x2d696b){return _0x2d696b[_0xa795('0x2f')]===_0x56be5c;});}if(_0x3a25c5>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xa795('0x30')](_0xa795('0x31'));_0x3a25c5=_['findIndex'](_0x84e0d8[_0xa795('0x32')],function(_0x5b9866){return _0x5b9866['profile'][_0xa795('0x16')]==='Administrator';});}return _0x84e0d8[_0xa795('0x32')][_0x3a25c5];}else{if(_0x84e0d8[_0xa795('0x33')][_0xa795('0x34')]['name']===_0xa795('0x35')){logger[_0xa795('0x30')]('Using\x20the\x20admin\x20account!');user=_0x84e0d8['user'];return user;}else{logger[_0xa795('0x36')](_0xa795('0x37'),JSON['stringify'](_0x84e0d8));throw new Error(_0xa795('0x38')+JSON[_0xa795('0xc')](_0x84e0d8));}}}else{logger[_0xa795('0x36')](_0xa795('0x37'),JSON[_0xa795('0xc')](_0x84e0d8));throw new Error(_0xa795('0x38')+JSON[_0xa795('0xc')](_0x84e0d8));}})['catch'](function(_0x58905e){console['error'](_0x58905e);});}function getZohoUser(_0x2fc1e3,_0x487490){return new BPromise(function(_0x219052,_0x19abe6){request(_0x2fc1e3)['then'](function(_0xa45ef6){var _0x74b7e1=null;if(_0xa45ef6){_0x74b7e1=_0xa45ef6[_0xa795('0x39')][0x0];_0x74b7e1[_0xa795('0x3a')]=_0x487490;}_0x219052(_0x74b7e1);})[_0xa795('0x3b')](function(_0x4e8449){_0x19abe6(_0x4e8449);});});}function createEndUser(_0x49a1f6,_0x4e38f3,_0x44aa8c,_0x511d4e,_0x16a227,_0x31d717){var _0x44aa8c=getName(_0x44aa8c);return request({'method':_0xa795('0x20'),'uri':_0xa795('0x3c')+_0x4e38f3+_0xa795('0x3d')+_[_0xa795('0x3e')](_0x31d717[_0xa795('0x3f')])+'s','body':{'data':[{'Last_Name':_0x44aa8c[0x1],'First_Name':_0x44aa8c[0x0],'Phone':_0x511d4e,'Owner':{'name':!_['isNil'](_0x16a227[_0xa795('0x40')][_0xa795('0x16')])?_0x16a227[_0xa795('0x40')][_0xa795('0x16')]:!_[_0xa795('0x2d')](_0x16a227[_0xa795('0x41')])?_0x16a227[_0xa795('0x41')]+'\x20'+_0x16a227['last_name']:_0x16a227[_0xa795('0x42')],'id':_0x16a227['id']}}]},'headers':{'Authorization':_0xa795('0x2b')+_0x49a1f6},'json':!![]})[_0xa795('0x43')](function(_0x223a13){if(_0x223a13&&_0x223a13['data'][0x0][_0xa795('0x44')]===_0xa795('0x45')){var _0xf43528=_0x223a13['data'][0x0]['details'];_0xf43528['enduserType']=_[_0xa795('0x3e')](_0x31d717['moduleCreate'])+'s';return _0xf43528;}logger['error']('The\x20failing\x20result\x20is',JSON[_0xa795('0xc')](data));throw new Error(_0xa795('0x46')+JSON[_0xa795('0xc')](data));})[_0xa795('0x3b')](function(_0xbf01e9){console[_0xa795('0x47')]('CREATE\x20ERROR',_0xbf01e9);});}function getEndUser(_0x49c525,_0xddc72f,_0x4b86d0,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb){var _0x7e7d7b={'method':'GET','uri':'','headers':{'Authorization':_0xa795('0x2b')+_0x49c525},'json':!![]};switch(_0x516ffb[_0xa795('0x48')]){case _0xa795('0x49'):_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4b')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4c'))[_0xa795('0x43')](function(_0x5823d5){if(_0x5823d5)return _0x5823d5;_0x7e7d7b['uri']=_0xa795('0x3c')+_0xddc72f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4d'))[_0xa795('0x43')](function(_0x21f063){if(_0x21f063)return _0x21f063;if(_0x516ffb[_0xa795('0x3f')]!=_0xa795('0x4e')){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});});break;case'contact':_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4b')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4c'))['then'](function(_0xa749c7){if(_0xa749c7)return _0xa749c7;if(_0x516ffb[_0xa795('0x3f')]!='nothing'){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});break;case'lead':_0x7e7d7b[_0xa795('0x4a')]=_0xa795('0x3c')+_0xddc72f+_0xa795('0x4f')+_0x1c41c1+'))';return getZohoUser(_0x7e7d7b,_0xa795('0x4d'))[_0xa795('0x43')](function(_0x54fa6f){if(_0x54fa6f)return _0x54fa6f;if(_0x516ffb[_0xa795('0x3f')]!=_0xa795('0x4e')){return createEndUser(_0x49c525,_0xddc72f,_0x1656a7,_0x1c41c1,_0x45b3d2,_0x516ffb);}else{return{};}});break;}}function getCall(_0xd97c6d,_0x196134,_0x138b0e,_0x1f4eeb,_0x95b4dd,_0x599ce1,_0x490faf,_0x52821c){logger[_0xa795('0x30')](_0xa795('0x50'));var _0x160dbf={};_0x160dbf[_0xa795('0x51')]={'name':!_['isNil'](_0x1f4eeb[_0xa795('0x40')]['name'])&&!_[_0xa795('0x2d')](_0x1f4eeb[_0xa795('0x34')][_0xa795('0x16')])&&_0x1f4eeb[_0xa795('0x34')][_0xa795('0x16')]===_0xa795('0x52')?_0x1f4eeb[_0xa795('0x40')][_0xa795('0x16')]:!_[_0xa795('0x2d')](_0x1f4eeb['first_name'])?_0x1f4eeb[_0xa795('0x41')]+'\x20'+_0x1f4eeb['last_name']:_0x1f4eeb['last_name'],'id':_0x1f4eeb['id']};_0x160dbf[_0xa795('0x53')]=intUtil[_0xa795('0x54')](_0x599ce1[_0xa795('0x55')],_0x490faf,'\x20');_0x160dbf[_0xa795('0x56')]=intUtil[_0xa795('0x54')](_0x599ce1[_0xa795('0x57')],_0x490faf,'\x0a');if(_0x95b4dd[_0xa795('0x3a')]===_0xa795('0x4c')){_0x160dbf[_0xa795('0x58')]={'name':!_[_0xa795('0x2d')](_0x95b4dd[_0xa795('0x59')])?_0x95b4dd[_0xa795('0x59')]:!_[_0xa795('0x2d')](_0x95b4dd['First_Name'])?_0x95b4dd[_0xa795('0x5a')]+'\x20'+_0x95b4dd[_0xa795('0x5b')]:_0x95b4dd[_0xa795('0x5b')],'id':_0x95b4dd['id']};}if(_0x95b4dd[_0xa795('0x3a')]===_0xa795('0x4d')){_0x160dbf['What_Id']={'name':!_[_0xa795('0x2d')](_0x95b4dd['Full_Name'])?_0x95b4dd[_0xa795('0x59')]:!_[_0xa795('0x2d')](_0x95b4dd[_0xa795('0x5a')])?_0x95b4dd[_0xa795('0x5a')]+'\x20'+_0x95b4dd[_0xa795('0x5b')]:_0x95b4dd['Last_Name'],'id':_0x95b4dd['id']};_0x160dbf['$se_module']=_[_0xa795('0x3e')](_0x95b4dd[_0xa795('0x3a')]);}if(_0x490faf['talktime']){_0x160dbf[_0xa795('0x5c')]=moment['utc'](parseInt(_0x490faf[_0xa795('0x5d')])*0x3e8)['format'](_0xa795('0x5e'));}else if(_0x490faf[_0xa795('0x5f')]&&_0x490faf[_0xa795('0x60')]){_0x160dbf[_0xa795('0x5c')]=moment[_0xa795('0x61')](moment(_0x490faf[_0xa795('0x60')],_0xa795('0x62'))[_0xa795('0x63')](moment(_0x490faf[_0xa795('0x64')],_0xa795('0x62'))))[_0xa795('0x65')](_0xa795('0x5e'));}switch(_0x490faf[_0xa795('0x66')]){case _0xa795('0x67'):_0x160dbf[_0xa795('0x68')]=_0xa795('0x69');break;case'complete':case _0xa795('0x6a'):_0x160dbf['Call_Result']=_0xa795('0x6b');break;case'rejected':_0x160dbf[_0xa795('0x68')]=_0xa795('0x6c');break;case'abandoned':_0x160dbf[_0xa795('0x68')]=_0xa795('0x6d');break;case _0xa795('0x6e'):_0x160dbf[_0xa795('0x68')]=_0xa795('0x6f');default:}_0x160dbf[_0xa795('0x70')]=(_0x52821c===_0xa795('0x71')?moment(_0x490faf[_0xa795('0x64')])[_0xa795('0x65')](_0xa795('0x62')):moment(_0x490faf[_0xa795('0x72')])[_0xa795('0x65')](_0xa795('0x62')))||moment()[_0xa795('0x65')](_0xa795('0x62'));_0x160dbf[_0xa795('0x73')]=_0x52821c||'Inbound';_0x160dbf=_[_0xa795('0x74')](_0x160dbf,getCustomFields(_0x599ce1[_0xa795('0x75')],_0x490faf));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x196134+_0xa795('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd97c6d},'body':{'data':[_0x160dbf]},'json':!![]})[_0xa795('0x43')](function(_0x318991){if(_0x318991&&_0x318991['data'][0x0][_0xa795('0x44')]==='SUCCESS'){logger[_0xa795('0x30')](_0xa795('0x77'));return{'id':_0x318991[_0xa795('0x39')][0x0]['details']['id']};}})[_0xa795('0x3b')](function(_0x155d91){logger[_0xa795('0x30')](_0xa795('0x78'),_0x155d91['stack']);console['log']('err',_0x155d91);});}exports['queue']=function(_0x1acda2,_0x5a4e6b,_0x34ec30,_0x32240f,_0x4a5d7f,_0xc5e5f0){var _0xd918eb,_0x5f1e78,_0x10a1a3;_0xc5e5f0[_0xa795('0x79')]=intUtil[_0xa795('0x7a')](_0xc5e5f0[_0xa795('0x79')]);_0xc5e5f0[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0xc5e5f0[_0xa795('0x7b')]);if(_0x4a5d7f&&_0x4a5d7f['monitor_format']){logger[_0xa795('0x30')](_0xa795('0x7c'),_0xa795('0x7d'));_0x5a4e6b[_0xa795('0x7e')]=_0xc5e5f0[_0xa795('0x7b')]+_0xa795('0x7f')+_0x5a4e6b[_0xa795('0x80')]+_0xa795('0x81')+md5(_0x5a4e6b[_0xa795('0x80')]);}else{_0x5a4e6b['recordingURL']='';}var _0x3c3dbe=_0xc5e5f0[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0xc5e5f0)[_0xa795('0x43')](function(_0x3a8e26){_0x10a1a3=_0x3a8e26;return getUser(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0x32240f[_0xa795('0x2f')]);})[_0xa795('0x43')](function(_0x5de3de){_0xd918eb=_0x5de3de;logger[_0xa795('0x30')]('The\x20User\x20ID\x20is:',_0xd918eb['id']);return getEndUser(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0x5a4e6b['calleridname'],_0x5a4e6b['calleridnum'],_0xd918eb,_0x34ec30);})[_0xa795('0x43')](function(_0x15525f){_0x5f1e78=_0x15525f;return getCall(_0x10a1a3,_0x3c3dbe,_0xc5e5f0,_0xd918eb,_0x5f1e78,_0x34ec30,_0x5a4e6b,_0xa795('0x84'));})['then'](function(_0x116f7f){if(_0x116f7f){logger[_0xa795('0x30')](_0xa795('0x85'),_0x116f7f['id']);logger['info'](_0xa795('0x7c'),_0xa795('0x86'));emit(util[_0xa795('0x65')](_0xa795('0x87'),_0x32240f[_0xa795('0x16')]),_0xa795('0x88'),{'uri':_0xa795('0x89')+_0xc5e5f0[_0xa795('0x79')]+_0xa795('0x8a')+_0x116f7f['id']});}})[_0xa795('0x3b')](function(_0x1dba99){logger[_0xa795('0x36')]('[QUEUE]',JSON[_0xa795('0xc')](_0x1dba99));});};exports[_0xa795('0x71')]=function(_0x2dc67e,_0x31ec65,_0x56e2b9,_0x449518,_0x36cd21,_0x3cc19e,_0x38cf49){var _0x5531e0,_0x5c17a7,_0x236a62;_0x3cc19e['host']=intUtil[_0xa795('0x7a')](_0x3cc19e[_0xa795('0x79')]);_0x3cc19e[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0x3cc19e[_0xa795('0x7b')]);if(_0x38cf49&&_0x38cf49[_0xa795('0x8b')]&&_0x38cf49[_0xa795('0x8b')]!==_0xa795('0x8c')){logger[_0xa795('0x30')](_0xa795('0x8d'),_0xa795('0x7d'));_0x31ec65[_0xa795('0x7e')]=_0x3cc19e[_0xa795('0x7b')]+_0xa795('0x7f')+_0x31ec65[_0xa795('0x80')]+_0xa795('0x81')+md5(_0x31ec65[_0xa795('0x80')]);}var _0xf1400c=_0x3cc19e[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0x3cc19e)[_0xa795('0x43')](function(_0x6bc550){_0x236a62=_0x6bc550;return getUser(_0x236a62,_0xf1400c,_0x3cc19e,_0x449518['email']);})[_0xa795('0x43')](function(_0x1b399a){_0x5531e0=_0x1b399a;logger[_0xa795('0x30')](_0xa795('0x8e'),_0x5531e0['id']);return getEndUser(_0x236a62,_0xf1400c,_0x3cc19e,_0x31ec65[_0xa795('0x8f')],_0x31ec65['destcalleridnum'],_0x5531e0,_0x56e2b9);})[_0xa795('0x43')](function(_0x34d953){_0x5c17a7=_0x34d953;return getCall(_0x236a62,_0xf1400c,_0x3cc19e,_0x5531e0,_0x5c17a7,_0x56e2b9,_0x31ec65,_0xa795('0x90'));})[_0xa795('0x43')](function(_0x14f9c3){if(_0x14f9c3){logger[_0xa795('0x30')](_0xa795('0x85'),_0x14f9c3['id']);logger[_0xa795('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa795('0x65')]('user:%s',_0x449518['name']),'trigger:browser:url',{'uri':_0xa795('0x89')+_0x3cc19e[_0xa795('0x79')]+_0xa795('0x8a')+_0x14f9c3['id']});}})[_0xa795('0x3b')](function(_0x44ffce){logger[_0xa795('0x36')]('[OUTBOUND]',JSON[_0xa795('0xc')](_0x44ffce));});};exports[_0xa795('0x91')]=function(_0x14ef2a,_0xe2a826,_0x5bcb25,_0x144073,_0x4d6825,_0x5c15c3){var _0x5984dd,_0x524c29,_0x15e867;_0x5c15c3[_0xa795('0x79')]=intUtil[_0xa795('0x7a')](_0x5c15c3[_0xa795('0x79')]);_0x5c15c3[_0xa795('0x7b')]=intUtil[_0xa795('0x7a')](_0x5c15c3[_0xa795('0x7b')]);if(_0x4d6825&&_0x4d6825[_0xa795('0x92')]){logger[_0xa795('0x30')]('['+_0xe2a826[_0xa795('0x66')][_0xa795('0x93')]()+']',_0xa795('0x7d'));_0xe2a826[_0xa795('0x7e')]=_0x5c15c3['serverUrl']+_0xa795('0x7f')+_0xe2a826['uniqueid']+_0xa795('0x81')+md5(_0xe2a826[_0xa795('0x80')]);}else{_0xe2a826[_0xa795('0x7e')]='';}var _0x3e75fe=_0x5c15c3[_0xa795('0x79')]===_0xa795('0x82')?'eu':_0xa795('0x83');return getAccessToken(_0x5c15c3)['then'](function(_0x27601a){_0x15e867=_0x27601a;return getUser(_0x15e867,_0x3e75fe,_0x5c15c3);})['then'](function(_0x2f01b8){_0x5984dd=_0x2f01b8;logger[_0xa795('0x30')]('The\x20User\x20ID\x20is:',_0x5984dd['id']);return getEndUser(_0x15e867,_0x3e75fe,_0x5c15c3,_0xe2a826['calleridname'],_0xe2a826[_0xa795('0x94')],_0x5984dd,_0x5bcb25);})[_0xa795('0x43')](function(_0x3de1a0){_0x524c29=_0x3de1a0;return getCall(_0x15e867,_0x3e75fe,_0x5c15c3,_0x5984dd,_0x524c29,_0x5bcb25,_0xe2a826,_0xa795('0x84'));})['then'](function(_0x284448){if(_0x284448){logger['info'](_0xa795('0x85'),_0x284448['id']);}})['catch'](function(_0x1740d1){logger['error']('['+_0xe2a826[_0xa795('0x66')][_0xa795('0x93')]()+']',JSON[_0xa795('0xc')](_0x1740d1));});}; \ No newline at end of file +var _0x4f7b=['add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','format','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','toUpperCase','/api/voice/recordings/','The\x20Call\x20ID\x20is:','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','localhost','socket.io-emitter','redis','emit','debug','forEach','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','then'];(function(_0x1f68d6,_0x44fd9c){var _0x5a97cb=function(_0x4fea37){while(--_0x4fea37){_0x1f68d6['push'](_0x1f68d6['shift']());}};_0x5a97cb(++_0x44fd9c);}(_0x4f7b,0x115));var _0xb4f7=function(_0x4fee21,_0x49e12c){_0x4fee21=_0x4fee21-0x0;var _0x12bb1b=_0x4f7b[_0x4fee21];return _0x12bb1b;};'use strict';var _=require(_0xb4f7('0x0'));var rp=require(_0xb4f7('0x1'));var md5=require(_0xb4f7('0x2'));var util=require(_0xb4f7('0x3'));var intUtil=require(_0xb4f7('0x4'));var moment=require(_0xb4f7('0x5'));var Redis=require(_0xb4f7('0x6'));var BPromise=require(_0xb4f7('0x7'));var config=require('../../../../config/environment');var logger=require(_0xb4f7('0x8'))(_0xb4f7('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xb4f7('0xa'),'port':0x18eb});var io=require(_0xb4f7('0xb'))(new Redis(config[_0xb4f7('0xc')]));function emit(_0x2b160e,_0x371cdb,_0x5ca116){io['to'](_0x2b160e)[_0xb4f7('0xd')](_0x371cdb,_0x5ca116);}function request(_0x685246){logger[_0xb4f7('0xe')]('[HTTP]',JSON['stringify'](_0x685246));return rp(_0x685246);}function getCustomFields(_0x56c345,_0x3ff669){var _0x5a4f7e={};if(_0x56c345['length']>0x0){_[_0xb4f7('0xf')](_0x56c345,function(_0x35968){if(_['includes']([_0xb4f7('0x10'),'picklist'],_0x35968[_0xb4f7('0x11')])&&_0x35968['idField']){_0x5a4f7e[_0x35968[_0xb4f7('0x12')]]=_0x35968[_0xb4f7('0x13')][_0xb4f7('0x14')]();}else if(_0x35968[_0xb4f7('0x11')]===_0xb4f7('0x15')&&_0x35968[_0xb4f7('0x16')]&&_0x35968['idField']&&_0x3ff669[_0x35968['variableName']]){_0x5a4f7e[_0x35968[_0xb4f7('0x12')]]=_0x3ff669[_0x35968[_0xb4f7('0x16')]][_0xb4f7('0x14')]();}else if(_0x35968['type']===_0xb4f7('0x17')&&_0x35968[_0xb4f7('0x18')]&&_0x35968[_0xb4f7('0x18')][_0xb4f7('0x19')]&&_0x35968['idField']&&_0x3ff669[_0x35968[_0xb4f7('0x18')][_0xb4f7('0x19')][_0xb4f7('0x1a')]()]){_0x5a4f7e[_0x35968[_0xb4f7('0x12')]]=_0x3ff669[_0x35968[_0xb4f7('0x18')][_0xb4f7('0x19')]['toLowerCase']()][_0xb4f7('0x14')]();}});}return _0x5a4f7e;}function getName(_0x4adb8b){if(_0x4adb8b[_0xb4f7('0x1b')]('\x20')>0x0){var _0x4b3d01=_0x4adb8b[_0xb4f7('0x1c')](/ (.+)/);if(_0x4b3d01[0x1]){return _0x4b3d01;}}return[_0x4adb8b,_0x4adb8b];}var accountsTokens={};function getAccessToken(_0x550559){return new Promise(function(_0xbb3e13,_0x1fb7a0){if(!_[_0xb4f7('0x1d')](accountsTokens[_0x550559['id']])&&!_['isNil'](accountsTokens[_0x550559['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x550559['id']][_0xb4f7('0x1e')])){_0xbb3e13(accountsTokens[_0x550559['id']][_0xb4f7('0x1f')]);}}var _0x4570c4;switch(_0x550559[_0xb4f7('0x20')]){case'US':_0x4570c4=_0xb4f7('0x21');break;case'AU':_0x4570c4=_0xb4f7('0x22');break;case'EU':_0x4570c4=_0xb4f7('0x23');break;case'IN':_0x4570c4=_0xb4f7('0x24');break;case'CN':_0x4570c4=_0xb4f7('0x25');break;default:_0x4570c4=_0xb4f7('0x23');break;}var _0x196aa9={'method':_0xb4f7('0x26'),'uri':_0x4570c4+'/oauth/v2/token','qs':{'refresh_token':_0x550559[_0xb4f7('0x27')],'client_id':_0x550559[_0xb4f7('0x28')],'client_secret':_0x550559['clientSecret'],'grant_type':_0xb4f7('0x29')},'json':!![]};return rp(_0x196aa9)[_0xb4f7('0x2a')](function(_0x4db478){accountsTokens[_0x550559['id']]={'access_token':_0x4db478[_0xb4f7('0x1f')],'expires_in':moment()[_0xb4f7('0x2b')](_0x4db478[_0xb4f7('0x1e')],_0xb4f7('0x2c'))};_0xbb3e13(_0x4db478[_0xb4f7('0x1f')]);})[_0xb4f7('0x2d')](function(_0x30f660){logger[_0xb4f7('0x2e')](_0xb4f7('0x2f'),_0x30f660[_0xb4f7('0x30')]);_0x1fb7a0(_0x30f660);});});}function getUser(_0x23c842,_0x1336b2,_0x348265,_0x2a3693){logger['info'](_0xb4f7('0x31'));return request({'method':_0xb4f7('0x32'),'uri':util['format'](_0xb4f7('0x33'),_0x1336b2),'qs':{'type':_0xb4f7('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23c842},'json':!![]})[_0xb4f7('0x2a')](function(_0x948db1){if(_0x948db1['users']){var _0x24e09c=-0x1;if(_['isArrayLikeObject'](_0x948db1[_0xb4f7('0x35')])){if(!_[_0xb4f7('0x1d')](_0x2a3693)){_0x24e09c=_[_0xb4f7('0x36')](_0x948db1[_0xb4f7('0x35')],function(_0x341881){return _0x341881[_0xb4f7('0x37')]===_0x2a3693;});}if(_0x24e09c>=0x0){logger[_0xb4f7('0x38')](_0xb4f7('0x39'));}else{logger[_0xb4f7('0x38')](_0xb4f7('0x3a'));_0x24e09c=_[_0xb4f7('0x36')](_0x948db1[_0xb4f7('0x35')],function(_0x1cd9ae){return _0x1cd9ae[_0xb4f7('0x3b')][_0xb4f7('0x19')]===_0xb4f7('0x3c');});}return _0x948db1[_0xb4f7('0x35')][_0x24e09c];}else{if(_0x948db1['user'][_0xb4f7('0x3b')]['name']==='Administrator'){logger['info'](_0xb4f7('0x3a'));user=_0x948db1[_0xb4f7('0x3d')];return user;}else{logger[_0xb4f7('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xb4f7('0x3e')](_0x948db1));throw new Error(_0xb4f7('0x3f')+JSON['stringify'](_0x948db1));}}}else{logger['error'](_0xb4f7('0x40'),JSON[_0xb4f7('0x3e')](_0x948db1));throw new Error(_0xb4f7('0x3f')+JSON[_0xb4f7('0x3e')](_0x948db1));}})['catch'](function(_0x102040){console[_0xb4f7('0x2e')](_0x102040);});}function getZohoUser(_0x4d19eb,_0x1f2538){return new BPromise(function(_0x3b10b1,_0x3cd05e){request(_0x4d19eb)[_0xb4f7('0x2a')](function(_0x2f9af0){var _0x5b4bbb=null;if(_0x2f9af0){_0x5b4bbb=_0x2f9af0[_0xb4f7('0x41')][0x0];_0x5b4bbb[_0xb4f7('0x42')]=_0x1f2538;}_0x3b10b1(_0x5b4bbb);})[_0xb4f7('0x2d')](function(_0x28caa8){_0x3cd05e(_0x28caa8);});});}function createEndUser(_0x2fa025,_0x82c5e3,_0x14839e,_0x3b5e3a,_0x5532ce,_0x232469){var _0x14839e=getName(_0x14839e);return request({'method':_0xb4f7('0x26'),'uri':_0xb4f7('0x43')+_0x82c5e3+_0xb4f7('0x44')+_[_0xb4f7('0x45')](_0x232469[_0xb4f7('0x46')])+'s','body':{'data':[{'Last_Name':_0x14839e[0x1],'First_Name':_0x14839e[0x0],'Phone':_0x3b5e3a,'Owner':{'name':!_[_0xb4f7('0x1d')](_0x5532ce['role'][_0xb4f7('0x19')])?_0x5532ce[_0xb4f7('0x47')][_0xb4f7('0x19')]:!_[_0xb4f7('0x1d')](_0x5532ce['first_name'])?_0x5532ce[_0xb4f7('0x48')]+'\x20'+_0x5532ce['last_name']:_0x5532ce[_0xb4f7('0x49')],'id':_0x5532ce['id']}}]},'headers':{'Authorization':_0xb4f7('0x4a')+_0x2fa025},'json':!![]})[_0xb4f7('0x2a')](function(_0x13c8ba){if(_0x13c8ba&&_0x13c8ba[_0xb4f7('0x41')][0x0][_0xb4f7('0x4b')]===_0xb4f7('0x4c')){var _0x233035=_0x13c8ba[_0xb4f7('0x41')][0x0][_0xb4f7('0x4d')];_0x233035['enduserType']=_['startCase'](_0x232469['moduleCreate'])+'s';return _0x233035;}logger[_0xb4f7('0x2e')](_0xb4f7('0x40'),JSON[_0xb4f7('0x3e')](data));throw new Error(_0xb4f7('0x4e')+JSON['stringify'](data));})[_0xb4f7('0x2d')](function(_0x4c0773){console[_0xb4f7('0x4f')](_0xb4f7('0x50'),_0x4c0773);});}function getEndUser(_0x36beb5,_0x33d80b,_0x5f36d7,_0x2e1c29,_0x466fd0,_0x3b2e81,_0x3edc31){var _0x1f83a2={'method':'GET','uri':'','headers':{'Authorization':_0xb4f7('0x4a')+_0x36beb5},'json':!![]};switch(_0x3edc31['moduleSearch']){case _0xb4f7('0x51'):_0x1f83a2['uri']=_0xb4f7('0x43')+_0x33d80b+_0xb4f7('0x52')+_0x466fd0+'))';return getZohoUser(_0x1f83a2,_0xb4f7('0x53'))[_0xb4f7('0x2a')](function(_0x1f260b){if(_0x1f260b)return _0x1f260b;_0x1f83a2[_0xb4f7('0x54')]='https://www.zohoapis.'+_0x33d80b+_0xb4f7('0x55')+_0x466fd0+'))';return getZohoUser(_0x1f83a2,_0xb4f7('0x56'))[_0xb4f7('0x2a')](function(_0x590bc7){if(_0x590bc7)return _0x590bc7;if(_0x3edc31['moduleCreate']!=_0xb4f7('0x57')){return createEndUser(_0x36beb5,_0x33d80b,_0x2e1c29,_0x466fd0,_0x3b2e81,_0x3edc31);}else{return{};}});});break;case'contact':_0x1f83a2[_0xb4f7('0x54')]=_0xb4f7('0x43')+_0x33d80b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x466fd0+'))';return getZohoUser(_0x1f83a2,_0xb4f7('0x53'))[_0xb4f7('0x2a')](function(_0x39fb94){if(_0x39fb94)return _0x39fb94;if(_0x3edc31[_0xb4f7('0x46')]!=_0xb4f7('0x57')){return createEndUser(_0x36beb5,_0x33d80b,_0x2e1c29,_0x466fd0,_0x3b2e81,_0x3edc31);}else{return{};}});break;case _0xb4f7('0x58'):_0x1f83a2[_0xb4f7('0x54')]=_0xb4f7('0x43')+_0x33d80b+_0xb4f7('0x55')+_0x466fd0+'))';return getZohoUser(_0x1f83a2,_0xb4f7('0x56'))[_0xb4f7('0x2a')](function(_0x2f327d){if(_0x2f327d)return _0x2f327d;if(_0x3edc31[_0xb4f7('0x46')]!=_0xb4f7('0x57')){return createEndUser(_0x36beb5,_0x33d80b,_0x2e1c29,_0x466fd0,_0x3b2e81,_0x3edc31);}else{return{};}});break;}}function getCall(_0x5749fc,_0xa1dccf,_0x138fdc,_0x2c530b,_0x5836e3,_0x142d6f,_0x5be75a,_0x4ec92b){logger[_0xb4f7('0x38')]('Creating\x20new\x20call...');var _0x4c7293={};_0x4c7293['Owner']={'name':!_[_0xb4f7('0x1d')](_0x2c530b[_0xb4f7('0x47')][_0xb4f7('0x19')])&&!_[_0xb4f7('0x1d')](_0x2c530b[_0xb4f7('0x3b')][_0xb4f7('0x19')])&&_0x2c530b[_0xb4f7('0x3b')]['name']===_0xb4f7('0x59')?_0x2c530b[_0xb4f7('0x47')][_0xb4f7('0x19')]:!_[_0xb4f7('0x1d')](_0x2c530b['first_name'])?_0x2c530b[_0xb4f7('0x48')]+'\x20'+_0x2c530b[_0xb4f7('0x49')]:_0x2c530b[_0xb4f7('0x49')],'id':_0x2c530b['id']};_0x4c7293[_0xb4f7('0x5a')]=intUtil[_0xb4f7('0x5b')](_0x142d6f[_0xb4f7('0x5c')],_0x5be75a,'\x20');_0x4c7293[_0xb4f7('0x5d')]=intUtil[_0xb4f7('0x5b')](_0x142d6f[_0xb4f7('0x5e')],_0x5be75a,'\x0a');if(_0x5836e3[_0xb4f7('0x42')]===_0xb4f7('0x53')){_0x4c7293[_0xb4f7('0x5f')]={'name':!_['isNil'](_0x5836e3[_0xb4f7('0x60')])?_0x5836e3[_0xb4f7('0x60')]:!_['isNil'](_0x5836e3[_0xb4f7('0x61')])?_0x5836e3[_0xb4f7('0x61')]+'\x20'+_0x5836e3[_0xb4f7('0x62')]:_0x5836e3[_0xb4f7('0x62')],'id':_0x5836e3['id']};}if(_0x5836e3[_0xb4f7('0x42')]===_0xb4f7('0x56')){_0x4c7293[_0xb4f7('0x63')]={'name':!_[_0xb4f7('0x1d')](_0x5836e3[_0xb4f7('0x60')])?_0x5836e3[_0xb4f7('0x60')]:!_[_0xb4f7('0x1d')](_0x5836e3[_0xb4f7('0x61')])?_0x5836e3['First_Name']+'\x20'+_0x5836e3[_0xb4f7('0x62')]:_0x5836e3['Last_Name'],'id':_0x5836e3['id']};_0x4c7293[_0xb4f7('0x64')]=_['startCase'](_0x5836e3[_0xb4f7('0x42')]);}if(_0x5be75a['talktime']){_0x4c7293[_0xb4f7('0x65')]=moment[_0xb4f7('0x66')](parseInt(_0x5be75a[_0xb4f7('0x67')])*0x3e8)['format'](_0xb4f7('0x68'));}else if(_0x5be75a['answertime']&&_0x5be75a[_0xb4f7('0x69')]){_0x4c7293['Call_Duration']=moment['utc'](moment(_0x5be75a['endtime'],_0xb4f7('0x6a'))[_0xb4f7('0x6b')](moment(_0x5be75a[_0xb4f7('0x6c')],_0xb4f7('0x6a'))))['format'](_0xb4f7('0x68'));}switch(_0x5be75a[_0xb4f7('0x6d')]){case _0xb4f7('0x6e'):_0x4c7293[_0xb4f7('0x6f')]=_0xb4f7('0x70');break;case _0xb4f7('0x71'):case _0xb4f7('0x72'):_0x4c7293[_0xb4f7('0x6f')]=_0xb4f7('0x73');break;case _0xb4f7('0x74'):_0x4c7293['Call_Result']=_0xb4f7('0x75');break;case _0xb4f7('0x76'):_0x4c7293[_0xb4f7('0x6f')]=_0xb4f7('0x77');break;case _0xb4f7('0x78'):_0x4c7293[_0xb4f7('0x6f')]=_0xb4f7('0x79');default:}_0x4c7293[_0xb4f7('0x7a')]=(_0x4ec92b===_0xb4f7('0x7b')?moment(_0x5be75a['starttime'])['format'](_0xb4f7('0x6a')):moment(_0x5be75a[_0xb4f7('0x7c')])['format'](_0xb4f7('0x6a')))||moment()[_0xb4f7('0x7d')](_0xb4f7('0x6a'));_0x4c7293[_0xb4f7('0x7e')]=_0x4ec92b||_0xb4f7('0x7f');_0x4c7293=_[_0xb4f7('0x80')](_0x4c7293,getCustomFields(_0x142d6f[_0xb4f7('0x81')],_0x5be75a));return request({'method':_0xb4f7('0x26'),'uri':'https://www.zohoapis.'+_0xa1dccf+'/crm/v2/Calls','headers':{'Authorization':_0xb4f7('0x4a')+_0x5749fc},'body':{'data':[_0x4c7293]},'json':!![]})['then'](function(_0x4a2b83){if(_0x4a2b83&&_0x4a2b83['data'][0x0]['code']==='SUCCESS'){logger[_0xb4f7('0x38')](_0xb4f7('0x82'));return{'id':_0x4a2b83[_0xb4f7('0x41')][0x0][_0xb4f7('0x4d')]['id']};}})[_0xb4f7('0x2d')](function(_0xe7a1aa){logger[_0xb4f7('0x38')](_0xb4f7('0x83'),_0xe7a1aa[_0xb4f7('0x30')]);console[_0xb4f7('0x4f')](_0xb4f7('0x83'),_0xe7a1aa);});}exports[_0xb4f7('0x84')]=function(_0x27e822,_0x462f4f,_0x318687,_0xc3c66f,_0x509d11,_0x2c0eb2){var _0x2ed1fb,_0x5aa38a,_0x18c13d;_0x2c0eb2[_0xb4f7('0x85')]=intUtil[_0xb4f7('0x86')](_0x2c0eb2[_0xb4f7('0x85')]);_0x2c0eb2[_0xb4f7('0x87')]=intUtil[_0xb4f7('0x86')](_0x2c0eb2[_0xb4f7('0x87')]);if(_0x509d11&&_0x509d11[_0xb4f7('0x88')]){logger[_0xb4f7('0x38')](_0xb4f7('0x89'),_0xb4f7('0x8a'));_0x462f4f[_0xb4f7('0x8b')]=_0x2c0eb2[_0xb4f7('0x87')]+'/api/voice/recordings/'+_0x462f4f[_0xb4f7('0x8c')]+_0xb4f7('0x8d')+md5(_0x462f4f['uniqueid']);}else{_0x462f4f[_0xb4f7('0x8b')]='';}var _0x397fd7=_0x2c0eb2[_0xb4f7('0x85')]===_0xb4f7('0x8e')?'eu':_0xb4f7('0x8f');return getAccessToken(_0x2c0eb2)['then'](function(_0x1eeeb3){_0x18c13d=_0x1eeeb3;return getUser(_0x18c13d,_0x397fd7,_0x2c0eb2,_0xc3c66f['email']);})[_0xb4f7('0x2a')](function(_0x1c08ac){_0x2ed1fb=_0x1c08ac;logger['info'](_0xb4f7('0x90'),_0x2ed1fb['id']);return getEndUser(_0x18c13d,_0x397fd7,_0x2c0eb2,_0x462f4f[_0xb4f7('0x91')],_0x462f4f[_0xb4f7('0x92')],_0x2ed1fb,_0x318687);})[_0xb4f7('0x2a')](function(_0x21f25d){_0x5aa38a=_0x21f25d;return getCall(_0x18c13d,_0x397fd7,_0x2c0eb2,_0x2ed1fb,_0x5aa38a,_0x318687,_0x462f4f,'Inbound');})[_0xb4f7('0x2a')](function(_0x4c4d87){if(_0x4c4d87){logger[_0xb4f7('0x38')]('The\x20Call\x20ID\x20is:',_0x4c4d87['id']);logger[_0xb4f7('0x38')](_0xb4f7('0x89'),_0xb4f7('0x93'));emit(util[_0xb4f7('0x7d')](_0xb4f7('0x94'),_0xc3c66f[_0xb4f7('0x19')]),_0xb4f7('0x95'),{'uri':_0xb4f7('0x96')+_0x2c0eb2[_0xb4f7('0x85')]+_0xb4f7('0x97')+_0x4c4d87['id']});}})[_0xb4f7('0x2d')](function(_0xb5300a){logger[_0xb4f7('0x2e')]('[QUEUE]',JSON['stringify'](_0xb5300a));});};exports['outbound']=function(_0x3a242c,_0x48f75e,_0x500a7c,_0x111456,_0x10d7cc,_0x43db08,_0x45dc41){var _0x29674c,_0x5c9af3,_0x1cfb60;_0x43db08['host']=intUtil[_0xb4f7('0x86')](_0x43db08[_0xb4f7('0x85')]);_0x43db08[_0xb4f7('0x87')]=intUtil[_0xb4f7('0x86')](_0x43db08[_0xb4f7('0x87')]);if(_0x45dc41&&_0x45dc41['recordingFormat']&&_0x45dc41['recordingFormat']!==_0xb4f7('0x98')){logger['info'](_0xb4f7('0x99'),_0xb4f7('0x8a'));_0x48f75e['recordingURL']=_0x43db08['serverUrl']+'/api/voice/recordings/'+_0x48f75e[_0xb4f7('0x8c')]+_0xb4f7('0x8d')+md5(_0x48f75e[_0xb4f7('0x8c')]);}var _0x304f4d=_0x43db08[_0xb4f7('0x85')]==='zoho.eu'?'eu':_0xb4f7('0x8f');return getAccessToken(_0x43db08)['then'](function(_0x19f5c1){_0x1cfb60=_0x19f5c1;return getUser(_0x1cfb60,_0x304f4d,_0x43db08,_0x111456[_0xb4f7('0x37')]);})['then'](function(_0x38ea94){_0x29674c=_0x38ea94;logger[_0xb4f7('0x38')](_0xb4f7('0x90'),_0x29674c['id']);return getEndUser(_0x1cfb60,_0x304f4d,_0x43db08,_0x48f75e[_0xb4f7('0x9a')],_0x48f75e[_0xb4f7('0x9b')],_0x29674c,_0x500a7c);})[_0xb4f7('0x2a')](function(_0x3f3db6){_0x5c9af3=_0x3f3db6;return getCall(_0x1cfb60,_0x304f4d,_0x43db08,_0x29674c,_0x5c9af3,_0x500a7c,_0x48f75e,'Outbound');})[_0xb4f7('0x2a')](function(_0x4c9e35){if(_0x4c9e35){logger[_0xb4f7('0x38')]('The\x20Call\x20ID\x20is:',_0x4c9e35['id']);logger[_0xb4f7('0x38')](_0xb4f7('0x99'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x111456['name']),_0xb4f7('0x95'),{'uri':_0xb4f7('0x96')+_0x43db08[_0xb4f7('0x85')]+_0xb4f7('0x97')+_0x4c9e35['id']});}})['catch'](function(_0x547dbb){logger['error'](_0xb4f7('0x99'),JSON['stringify'](_0x547dbb));});};exports[_0xb4f7('0x9c')]=function(_0x594f19,_0x35174a,_0x8540c6,_0x1c116d,_0x4dcfad,_0x2f2015){var _0x41f5db,_0x3d78d0,_0x4b3761;_0x2f2015[_0xb4f7('0x85')]=intUtil['stripTrailingSlash'](_0x2f2015[_0xb4f7('0x85')]);_0x2f2015[_0xb4f7('0x87')]=intUtil['stripTrailingSlash'](_0x2f2015[_0xb4f7('0x87')]);if(_0x4dcfad&&_0x4dcfad[_0xb4f7('0x88')]){logger['info']('['+_0x35174a['lastevent'][_0xb4f7('0x9d')]()+']',_0xb4f7('0x8a'));_0x35174a[_0xb4f7('0x8b')]=_0x2f2015['serverUrl']+_0xb4f7('0x9e')+_0x35174a['uniqueid']+_0xb4f7('0x8d')+md5(_0x35174a[_0xb4f7('0x8c')]);}else{_0x35174a[_0xb4f7('0x8b')]='';}var _0x449ea6=_0x2f2015[_0xb4f7('0x85')]===_0xb4f7('0x8e')?'eu':_0xb4f7('0x8f');return getAccessToken(_0x2f2015)['then'](function(_0xbbcea5){_0x4b3761=_0xbbcea5;return getUser(_0x4b3761,_0x449ea6,_0x2f2015);})[_0xb4f7('0x2a')](function(_0x50b03d){_0x41f5db=_0x50b03d;logger[_0xb4f7('0x38')](_0xb4f7('0x90'),_0x41f5db['id']);return getEndUser(_0x4b3761,_0x449ea6,_0x2f2015,_0x35174a[_0xb4f7('0x91')],_0x35174a[_0xb4f7('0x92')],_0x41f5db,_0x8540c6);})['then'](function(_0x2db55a){_0x3d78d0=_0x2db55a;return getCall(_0x4b3761,_0x449ea6,_0x2f2015,_0x41f5db,_0x3d78d0,_0x8540c6,_0x35174a,'Inbound');})[_0xb4f7('0x2a')](function(_0x1c0270){if(_0x1c0270){logger[_0xb4f7('0x38')](_0xb4f7('0x9f'),_0x1c0270['id']);}})[_0xb4f7('0x2d')](function(_0x19d815){logger[_0xb4f7('0x2e')]('['+_0x35174a[_0xb4f7('0x6d')][_0xb4f7('0x9d')]()+']',JSON['stringify'](_0x19d815));});}; \ 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 e29b84e..d73d1fe 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 _0x85d3=['../../../../config/logger','trigger','exec','data2','Script','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x85d3,0x11c));var _0x385d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x85d3[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x385d('0x0'));var sh=require('shelljs');var Mustache=require(_0x385d('0x1'));var logger=require(_0x385d('0x2'))(_0x385d('0x3'));exports[_0x385d('0x4')]=function(_0x3f395e,_0xbc92f2){var _0xaebbfc=_0x3f395e['data2']?_0x3f395e[_0x385d('0x5')]:_0x385d('0x6');var _0x4d0614=_0x3f395e[_0x385d('0x7')]?Mustache['render'](_0x3f395e[_0x385d('0x7')],_0xbc92f2):_0xbc92f2;sh[_0x385d('0x4')](_0x4d0614,function(_0x7dd9c,_0x2e40ca,_0x5730c1){if(_0x7dd9c!==0x0){logger[_0x385d('0x8')](util[_0x385d('0x9')](_0x385d('0xa'),_0xaebbfc,_0x4d0614,_0x7dd9c,_0x5730c1));}else{logger[_0x385d('0xb')](util[_0x385d('0x9')](_0x385d('0xc'),_0xaebbfc,_0x4d0614,_0x2e40ca));}});}; \ No newline at end of file +var _0xe439=['mustache','../../../../config/logger','trigger','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe439,0x11c));var _0x9e43=function(_0x8eaf34,_0x18e59a){_0x8eaf34=_0x8eaf34-0x0;var _0x5e67d2=_0xe439[_0x8eaf34];return _0x5e67d2;};'use strict';var util=require(_0x9e43('0x0'));var sh=require(_0x9e43('0x1'));var Mustache=require(_0x9e43('0x2'));var logger=require(_0x9e43('0x3'))(_0x9e43('0x4'));exports['exec']=function(_0x682598,_0x3f73db){var _0x5af6d4=_0x682598[_0x9e43('0x5')]?_0x682598[_0x9e43('0x5')]:'Script';var _0xbe3864=_0x682598[_0x9e43('0x6')]?Mustache[_0x9e43('0x7')](_0x682598[_0x9e43('0x6')],_0x3f73db):_0x3f73db;sh['exec'](_0xbe3864,function(_0x203b5d,_0x53b652,_0x417389){if(_0x203b5d!==0x0){logger[_0x9e43('0x8')](util[_0x9e43('0x9')](_0x9e43('0xa'),_0x5af6d4,_0xbe3864,_0x203b5d,_0x417389));}else{logger[_0x9e43('0xb')](util[_0x9e43('0x9')](_0x9e43('0xc'),_0x5af6d4,_0xbe3864,_0x53b652));}});}; \ 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 c9cb3e6..9bc5108 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 _0xc538=['then','isNil',',\x20request\x20body:\x20','object','format','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','mustache','exec','data1','toUpperCase','render','data5','number','error','stack','GET','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xc538,0xdd));var _0x8c53=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc538[_0x110c3d];return _0x226d67;};'use strict';var rp=require(_0x8c53('0x0'));var util=require(_0x8c53('0x1'));var _=require('lodash');var Mustache=require(_0x8c53('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x8c53('0x3')]=function(_0xb68c80,_0xf208fb){var _0x1dba1f,_0x5017b9;var _0xc2ada={'method':_0xb68c80[_0x8c53('0x4')][_0x8c53('0x5')](),'uri':Mustache[_0x8c53('0x6')](_0xb68c80['data2'],_0xf208fb),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xb68c80[_0x8c53('0x7')])===_0x8c53('0x8')&&parseInt(_0xb68c80[_0x8c53('0x7')])>=0x1&&parseInt(_0xb68c80[_0x8c53('0x7')])<=0xa?parseInt(_0xb68c80[_0x8c53('0x7')])*0x3e8:0x5*0x3e8};try{_0xc2ada['headers']=_0xb68c80['data6']?JSON['parse'](Mustache['render'](_0xb68c80['data6'],_0xf208fb)):{};}catch(_0x1b8ac9){logger[_0x8c53('0x9')](_0x1b8ac9[_0x8c53('0xa')]);}switch(_0xb68c80[_0x8c53('0x4')][_0x8c53('0x5')]()){case _0x8c53('0xb'):case'DELETE':_0x1dba1f=null;_0xc2ada['qs']=_0xf208fb;break;case _0x8c53('0xc'):case'PUT':if(_0xb68c80[_0x8c53('0xd')]){try{_0x1dba1f=JSON[_0x8c53('0xe')](Mustache[_0x8c53('0x6')](_0xb68c80[_0x8c53('0xd')],_0xf208fb));_0xc2ada[_0x8c53('0xf')]=_0x1dba1f;}catch(_0xa838b4){logger[_0x8c53('0x9')](_0xa838b4[_0x8c53('0xa')]);logger[_0x8c53('0x9')](_0x8c53('0x10'));}}else{_0x1dba1f=_0xf208fb;_0xc2ada['body']=_0x1dba1f;}break;}logger[_0x8c53('0x11')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xb68c80['data1'],_0xb68c80['data2'],JSON[_0x8c53('0x12')](_0xc2ada)));rp(_0xc2ada)[_0x8c53('0x13')](function(_0x256ca4){_0x1dba1f=!_[_0x8c53('0x14')](_0x1dba1f)?_0x8c53('0x15')+_0x1dba1f:'';_0x5017b9=typeof _0x256ca4[_0x8c53('0xf')]===_0x8c53('0x16')?JSON['stringify'](_0x256ca4[_0x8c53('0xf')]):_0x256ca4[_0x8c53('0xf')];logger[_0x8c53('0x11')](util[_0x8c53('0x17')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xb68c80[_0x8c53('0x4')],_0xb68c80[_0x8c53('0x18')],_0x256ca4['statusCode'],_0x5017b9));})[_0x8c53('0x19')](function(_0x4c0bdf){logger[_0x8c53('0x9')](util[_0x8c53('0x17')](_0x8c53('0x1a'),_0xb68c80[_0x8c53('0x4')],_0xb68c80[_0x8c53('0x18')],_0x4c0bdf[_0x8c53('0x1b')],_0x4c0bdf[_0x8c53('0x1c')],_0x4c0bdf[_0x8c53('0x1d')]));});}; \ No newline at end of file +var _0xb054=['stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data5','data6','parse','data1','toUpperCase','POST','PUT','data7','body','error'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xb054,0x186));var _0x4b05=function(_0x1f8fee,_0x1a0bff){_0x1f8fee=_0x1f8fee-0x0;var _0x51643b=_0xb054[_0x1f8fee];return _0x51643b;};'use strict';var rp=require(_0x4b05('0x0'));var util=require(_0x4b05('0x1'));var _=require(_0x4b05('0x2'));var Mustache=require(_0x4b05('0x3'));var logger=require(_0x4b05('0x4'))(_0x4b05('0x5'));exports[_0x4b05('0x6')]=function(_0x4f1e77,_0x304e2e){var _0x137e5b,_0x1f9145;var _0x1ec03b={'method':_0x4f1e77['data1']['toUpperCase'](),'uri':Mustache[_0x4b05('0x7')](_0x4f1e77['data2'],_0x304e2e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4f1e77['data5'])==='number'&&parseInt(_0x4f1e77['data5'])>=0x1&&parseInt(_0x4f1e77[_0x4b05('0x8')])<=0xa?parseInt(_0x4f1e77[_0x4b05('0x8')])*0x3e8:0x5*0x3e8};try{_0x1ec03b['headers']=_0x4f1e77[_0x4b05('0x9')]?JSON[_0x4b05('0xa')](Mustache[_0x4b05('0x7')](_0x4f1e77[_0x4b05('0x9')],_0x304e2e)):{};}catch(_0x71273f){logger['error'](_0x71273f['stack']);}switch(_0x4f1e77[_0x4b05('0xb')][_0x4b05('0xc')]()){case'GET':case'DELETE':_0x137e5b=null;_0x1ec03b['qs']=_0x304e2e;break;case _0x4b05('0xd'):case _0x4b05('0xe'):if(_0x4f1e77[_0x4b05('0xf')]){try{_0x137e5b=JSON[_0x4b05('0xa')](Mustache[_0x4b05('0x7')](_0x4f1e77[_0x4b05('0xf')],_0x304e2e));_0x1ec03b[_0x4b05('0x10')]=_0x137e5b;}catch(_0x49daf){logger[_0x4b05('0x11')](_0x49daf[_0x4b05('0x12')]);logger['error'](_0x4b05('0x13'));}}else{_0x137e5b=_0x304e2e;_0x1ec03b['body']=_0x137e5b;}break;}logger[_0x4b05('0x14')](util['format'](_0x4b05('0x15'),_0x4f1e77['data1'],_0x4f1e77['data2'],JSON[_0x4b05('0x16')](_0x1ec03b)));rp(_0x1ec03b)[_0x4b05('0x17')](function(_0x30f82d){_0x137e5b=!_[_0x4b05('0x18')](_0x137e5b)?_0x4b05('0x19')+_0x137e5b:'';_0x1f9145=typeof _0x30f82d['body']==='object'?JSON[_0x4b05('0x16')](_0x30f82d[_0x4b05('0x10')]):_0x30f82d['body'];logger[_0x4b05('0x14')](util[_0x4b05('0x1a')](_0x4b05('0x1b'),_0x4f1e77[_0x4b05('0xb')],_0x4f1e77[_0x4b05('0x1c')],_0x30f82d['statusCode'],_0x1f9145));})[_0x4b05('0x1d')](function(_0x119f05){logger[_0x4b05('0x11')](util[_0x4b05('0x1a')](_0x4b05('0x1e'),_0x4f1e77['data1'],_0x4f1e77['data2'],_0x119f05[_0x4b05('0x1f')],_0x119f05[_0x4b05('0x20')],_0x119f05[_0x4b05('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 77e048c..5c71a74 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 _0x46cf=['http','Request','then','rpc','error','message','result','exports','jayson/promise','bluebird','routing','client'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x46cf,0x80));var _0xf46c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46cf[_0x4ae6ef];return _0x3cbb4e;};'use strict';var jayson=require(_0xf46c('0x0'));var BPromise=require(_0xf46c('0x1'));var logger=require('../../config/logger')(_0xf46c('0x2'));var client=jayson[_0xf46c('0x3')][_0xf46c('0x4')]({'port':0x2329});client[_0xf46c('0x5')]=function(_0x283d71,_0x745091){return new BPromise(function(_0x11003d,_0x5828a9){return client['request'](_0x283d71,_0x745091)[_0xf46c('0x6')](function(_0x2bc115){logger['debug'](_0xf46c('0x7'),_0xf46c('0x2'),_0x283d71,_0x745091,_0x2bc115);if(_0x2bc115[_0xf46c('0x8')]){logger['error']('rpc',_0xf46c('0x2'),_0x283d71,_0x2bc115['error']['message'],_0x745091);return _0x5828a9(_0x2bc115[_0xf46c('0x8')][_0xf46c('0x9')]);}else{return _0x11003d(_0x2bc115[_0xf46c('0xa')]);}})['catch'](function(_0x3eee93){logger['error'](_0xf46c('0x7'),'routing',_0x283d71,_0x3eee93,_0x745091);return _0x5828a9(_0x3eee93);});});};module[_0xf46c('0xb')]=client; \ No newline at end of file +var _0xab87=['http','Request','request','then','debug','error','rpc','message','result','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x48d2dc,_0x33eb3f){var _0x21810d=function(_0x257617){while(--_0x257617){_0x48d2dc['push'](_0x48d2dc['shift']());}};_0x21810d(++_0x33eb3f);}(_0xab87,0x1ae));var _0x7ab8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xab87[_0x3bf83f];return _0x22c4a9;};'use strict';var jayson=require(_0x7ab8('0x0'));var BPromise=require('bluebird');var logger=require(_0x7ab8('0x1'))(_0x7ab8('0x2'));var client=jayson[_0x7ab8('0x3')][_0x7ab8('0x4')]({'port':0x2329});client[_0x7ab8('0x5')]=function(_0x1daed8,_0x1fe160){return new BPromise(function(_0x279dcf,_0x1b5d70){return client[_0x7ab8('0x6')](_0x1daed8,_0x1fe160)[_0x7ab8('0x7')](function(_0x3551d2){logger[_0x7ab8('0x8')]('rpc',_0x7ab8('0x2'),_0x1daed8,_0x1fe160,_0x3551d2);if(_0x3551d2[_0x7ab8('0x9')]){logger[_0x7ab8('0x9')](_0x7ab8('0xa'),_0x7ab8('0x2'),_0x1daed8,_0x3551d2[_0x7ab8('0x9')][_0x7ab8('0xb')],_0x1fe160);return _0x1b5d70(_0x3551d2[_0x7ab8('0x9')][_0x7ab8('0xb')]);}else{return _0x279dcf(_0x3551d2[_0x7ab8('0xc')]);}})['catch'](function(_0x5f0efb){logger[_0x7ab8('0x9')](_0x7ab8('0xa'),_0x7ab8('0x2'),_0x1daed8,_0x5f0efb,_0x1fe160);return _0x1b5d70(_0x5f0efb);});});};module[_0x7ab8('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b248cc7..8d6f2d1 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 _0x519b=['resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x51489a,_0x3863fe){var _0x8a28d2=function(_0x27ab8c){while(--_0x27ab8c){_0x51489a['push'](_0x51489a['shift']());}};_0x8a28d2(++_0x3863fe);}(_0x519b,0xf8));var _0xb519=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x519b[_0x3f6bcf];return _0x1c5350;};'use strict';var server=require(_0xb519('0x0'));var Realtime=require(_0xb519('0x1'));var EmailChannel=require(_0xb519('0x2'));var mailAccount=require(_0xb519('0x3'));var setting=require(_0xb519('0x4'));var logger=require(_0xb519('0x5'))(_0xb519('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb519('0x7')]()[_0xb519('0x8')](mailAccount[_0xb519('0x9')]())[_0xb519('0x8')](realtime[_0xb519('0xa')]())[_0xb519('0x8')](function(){email[_0xb519('0xb')](realtime[_0xb519('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xb519('0x8')](function(){return initRealtime();})[_0xb519('0x8')](function(){return setting[_0xb519('0xd')]();})['then'](function(_0x3291a7){return setInterval(initRealtime,_0x3291a7['loginMailFrequency']*0x3e8);})[_0xb519('0xe')](function(_0xa53f87){logger[_0xb519('0xf')](_0xb519('0x10'),_0xa53f87);});}main(); \ No newline at end of file +var _0x9f0d=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','refresh','getSettings','loginMailFrequency','catch'];(function(_0x4fa4cc,_0x3c0b8c){var _0x147cb0=function(_0x235f68){while(--_0x235f68){_0x4fa4cc['push'](_0x4fa4cc['shift']());}};_0x147cb0(++_0x3c0b8c);}(_0x9f0d,0x6b));var _0xd9f0=function(_0x2182db,_0x53cbd0){_0x2182db=_0x2182db-0x0;var _0x384f63=_0x9f0d[_0x2182db];return _0x384f63;};'use strict';var server=require(_0xd9f0('0x0'));var Realtime=require(_0xd9f0('0x1'));var EmailChannel=require(_0xd9f0('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xd9f0('0x3'));var logger=require(_0xd9f0('0x4'))(_0xd9f0('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd9f0('0x6')]()[_0xd9f0('0x7')](mailAccount[_0xd9f0('0x8')]())[_0xd9f0('0x7')](realtime['initMailAccounts']())[_0xd9f0('0x7')](function(){email[_0xd9f0('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd9f0('0x7')](function(){return initRealtime();})[_0xd9f0('0x7')](function(){return setting[_0xd9f0('0xa')]();})[_0xd9f0('0x7')](function(_0x33caa2){return setInterval(initRealtime,_0x33caa2[_0xd9f0('0xb')]*0x3e8);})[_0xd9f0('0xc')](function(_0x5c32f8){logger[_0xd9f0('0xd')](_0xd9f0('0xe'),_0x5c32f8);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 4f07b6c..94ae047 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 _0xdd35=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','error','sendMail','send','verifySmtp','Smtp','lastSync','verify','lodash','bluebird','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','service','provider','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','connected','messages'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xdd35,0xb6));var _0x5dd3=function(_0x2041bf,_0x292d27){_0x2041bf=_0x2041bf-0x0;var _0x256e1f=_0xdd35[_0x2041bf];return _0x256e1f;};'use strict';var _=require(_0x5dd3('0x0'));var moment=require('moment');var BPromise=require(_0x5dd3('0x1'));var md5=require(_0x5dd3('0x2'));var Redis=require('ioredis');var config=require(_0x5dd3('0x3'));var logger=require('../../../config/logger')('email');config[_0x5dd3('0x4')]=_[_0x5dd3('0x5')](config[_0x5dd3('0x4')],{'host':_0x5dd3('0x6'),'port':0x18eb});var io=require(_0x5dd3('0x7'))(new Redis(config[_0x5dd3('0x4')]));var EmailImap=require(_0x5dd3('0x8'));var EmailSmtp=require(_0x5dd3('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x482d94){logger[_0x5dd3('0xa')](_0x5dd3('0xb'));this[_0x5dd3('0xc')]=_0x482d94[_0x5dd3('0xc')];this[_0x5dd3('0xd')]={};this[_0x5dd3('0xe')]=new EmailSmtp();}EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x10')]=function(_0x46a0bf){var _0x432cf8=this['mailAccounts'][_0x46a0bf];var _0x302e55={'id':_0x432cf8['id'],'name':_0x432cf8[_0x5dd3('0x11')],'key':_0x432cf8[_0x5dd3('0x12')],'active':_0x432cf8[_0x5dd3('0x13')],'Imap':{'status':_0x432cf8['Imap'][_0x5dd3('0x14')],'messageStatus':_0x432cf8[_0x5dd3('0x15')][_0x5dd3('0x16')],'total':_0x432cf8[_0x5dd3('0x15')][_0x5dd3('0x17')]}};if(_[_0x5dd3('0x18')](md5Accounts[_0x46a0bf])){md5Accounts[_0x46a0bf]={};}var _0x3e8359=md5(JSON[_0x5dd3('0x19')](_0x302e55));if(md5Accounts[_0x46a0bf][_0x5dd3('0x2')]!==_0x3e8359){md5Accounts[_0x46a0bf][_0x5dd3('0x2')]=_0x3e8359;io[_0x5dd3('0x10')](_0x5dd3('0x1a'),_0x302e55);}};EmailChannel['prototype'][_0x5dd3('0x1b')]=function(_0x3b649c){for(var _0x584c0f in _0x3b649c){if(_0x3b649c['hasOwnProperty'](_0x584c0f)){if(_0x3b649c[_0x584c0f][_0x5dd3('0x15')]&&_0x3b649c[_0x584c0f][_0x5dd3('0x13')]){var _0x5bea1c=_0x3b649c[_0x584c0f][_0x5dd3('0x15')];if(!_0x5bea1c[_0x5dd3('0x1c')]&&_0x3b649c[_0x584c0f][_0x5dd3('0x1d')]!=='custom')_0x5bea1c['service']=_0x3b649c[_0x584c0f]['provider'];if(!this['imapAccounts'][_0x5dd3('0x1e')](_0x5bea1c['id'])){this[_0x5dd3('0xd')][_0x5bea1c['id']]=new EmailImap(_0x5bea1c,_0x3b649c[_0x584c0f][_0x5dd3('0x1f')]);this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x20'),this[_0x5dd3('0x21')][_0x5dd3('0x22')](this,_0x584c0f));this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x1f'),this[_0x5dd3('0x23')][_0x5dd3('0x22')](this,_0x584c0f));this[_0x5dd3('0xd')][_0x5bea1c['id']]['on'](_0x5dd3('0x24'),this[_0x5dd3('0x25')][_0x5dd3('0x22')](this,_0x584c0f));this['imapAccounts'][_0x5bea1c['id']]['on']('error',this[_0x5dd3('0x26')][_0x5dd3('0x22')](this,_0x584c0f));}}else{if(_[_0x5dd3('0x18')](this['mailAccounts'][_0x584c0f][_0x5dd3('0x15')])){this[_0x5dd3('0xc')][_0x584c0f][_0x5dd3('0x15')]={};}this[_0x5dd3('0xc')][_0x584c0f]['Imap'][_0x5dd3('0x14')]=_0x5dd3('0x27');this[_0x5dd3('0xc')][_0x584c0f][_0x5dd3('0x15')][_0x5dd3('0x16')]='';this[_0x5dd3('0x10')](_0x584c0f);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x563fa9,_0x2386fa){if(this[_0x5dd3('0xc')][_0x563fa9]){this[_0x5dd3('0xc')][_0x563fa9][_0x5dd3('0x15')][_0x5dd3('0x14')]=_0x5dd3('0x28');this['mailAccounts'][_0x563fa9]['Imap']['messageStatus']=_0x2386fa[_0x5dd3('0x11')];if(_0x2386fa['messages']){this[_0x5dd3('0xc')][_0x563fa9][_0x5dd3('0x15')]['total']=_0x2386fa[_0x5dd3('0x29')][_0x5dd3('0x17')];}return this['emit'](_0x563fa9);}};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x23')]=function(_0x2956e0,_0x509ec3){logger[_0x5dd3('0xa')](_0x5dd3('0x2a'),_0x509ec3['firstName'],_0x509ec3[_0x5dd3('0x2b')],_0x509ec3['from'],_0x2956e0);if(this['mailAccounts'][_0x2956e0]){return mailAccount[_0x5dd3('0x2c')](_0x2956e0,_0x509ec3)[_0x5dd3('0x2d')](function(_0x3f45eb){if(_0x3f45eb){logger['info'](_0x5dd3('0x2e'));}})[_0x5dd3('0x2f')](function(_0x58a02d){logger['error'](_0x5dd3('0x30'),JSON['stringify'](_0x58a02d));});}};EmailChannel['prototype'][_0x5dd3('0x25')]=function(_0x3d6253){if(this[_0x5dd3('0xc')][_0x3d6253]&&this['mailAccounts'][_0x3d6253][_0x5dd3('0x15')]){if(this[_0x5dd3('0xd')][this[_0x5dd3('0xc')][_0x3d6253][_0x5dd3('0x15')]['id']]){delete this[_0x5dd3('0xd')][this[_0x5dd3('0xc')][_0x3d6253]['Imap']['id']];}this[_0x5dd3('0xc')][_0x3d6253][_0x5dd3('0x15')]['lastSync']=moment();this['emit'](_0x3d6253);}};EmailChannel[_0x5dd3('0xf')]['handleImapError']=function(_0x241d4d,_0x5b5a6a){if(this[_0x5dd3('0xc')][_0x241d4d]){this[_0x5dd3('0xc')][_0x241d4d][_0x5dd3('0x15')][_0x5dd3('0x14')]=_0x5dd3('0x31');this[_0x5dd3('0xc')][_0x241d4d][_0x5dd3('0x15')]['messageStatus']=_0x5b5a6a;return this[_0x5dd3('0x10')](_0x241d4d);}};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x32')]=function(_0x325211,_0xf7499e){return this['smtp'][_0x5dd3('0x33')](_0x325211,_0xf7499e);};EmailChannel[_0x5dd3('0xf')][_0x5dd3('0x34')]=function(_0x40d5dc){var _0x2bb6c1=this;if(this[_0x5dd3('0xc')][_0x40d5dc['id']]){if(_[_0x5dd3('0x18')](this[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')])){this[_0x5dd3('0xc')][_0x40d5dc['id']]['Smtp']={};}this[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')][_0x5dd3('0x36')]=moment();return new BPromise(function(_0x29584d,_0x3e7b01){return _0x2bb6c1[_0x5dd3('0xe')][_0x5dd3('0x37')](_0x40d5dc)[_0x5dd3('0x2d')](function(_0x302e0a){_0x2bb6c1['mailAccounts'][_0x40d5dc['id']][_0x5dd3('0x35')]['status']='verified';_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')][_0x5dd3('0x16')]='';_0x2bb6c1['emit'](_0x40d5dc['id']);_0x29584d(_0x302e0a);})[_0x5dd3('0x2f')](function(_0x4696e6){_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']]['Smtp']['status']=_0x5dd3('0x31');_0x2bb6c1[_0x5dd3('0xc')][_0x40d5dc['id']][_0x5dd3('0x35')]['messageStatus']=_0x4696e6;_0x2bb6c1[_0x5dd3('0x10')](_0x40d5dc['id']);_0x3e7b01(_0x4696e6);});});}return this[_0x5dd3('0xe')][_0x5dd3('0x37')](_0x40d5dc);};module['exports']=EmailChannel; \ No newline at end of file +var _0x6130=['status','Imap','messageStatus','total','stringify','refresh','hasOwnProperty','active','service','provider','custom','bind','handleImapEmail','handleImapEnd','disabled','handleImapBox','connected','messages','firstName','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','send','verifySmtp','isNil','Smtp','verify','verified','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key'];(function(_0x1d2726,_0x1d13a5){var _0x2c8cb6=function(_0x1902c0){while(--_0x1902c0){_0x1d2726['push'](_0x1d2726['shift']());}};_0x2c8cb6(++_0x1d13a5);}(_0x6130,0x1f4));var _0x0613=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x6130[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var moment=require(_0x0613('0x0'));var BPromise=require('bluebird');var md5=require(_0x0613('0x1'));var Redis=require(_0x0613('0x2'));var config=require(_0x0613('0x3'));var logger=require(_0x0613('0x4'))(_0x0613('0x5'));config[_0x0613('0x6')]=_[_0x0613('0x7')](config[_0x0613('0x6')],{'host':_0x0613('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0613('0x6')]));var EmailImap=require(_0x0613('0x9'));var EmailSmtp=require(_0x0613('0xa'));var mailAccount=require(_0x0613('0xb'));var md5Accounts={};function EmailChannel(_0x1db383){logger[_0x0613('0xc')]('start\x20email\x20channel');this[_0x0613('0xd')]=_0x1db383[_0x0613('0xd')];this[_0x0613('0xe')]={};this[_0x0613('0xf')]=new EmailSmtp();}EmailChannel[_0x0613('0x10')][_0x0613('0x11')]=function(_0x1fdc62){var _0x85daaf=this[_0x0613('0xd')][_0x1fdc62];var _0x9178e2={'id':_0x85daaf['id'],'name':_0x85daaf[_0x0613('0x12')],'key':_0x85daaf[_0x0613('0x13')],'active':_0x85daaf['active'],'Imap':{'status':_0x85daaf['Imap'][_0x0613('0x14')],'messageStatus':_0x85daaf[_0x0613('0x15')][_0x0613('0x16')],'total':_0x85daaf['Imap'][_0x0613('0x17')]}};if(_['isNil'](md5Accounts[_0x1fdc62])){md5Accounts[_0x1fdc62]={};}var _0x24279d=md5(JSON[_0x0613('0x18')](_0x9178e2));if(md5Accounts[_0x1fdc62][_0x0613('0x1')]!==_0x24279d){md5Accounts[_0x1fdc62][_0x0613('0x1')]=_0x24279d;io[_0x0613('0x11')]('mailAccount:update',_0x9178e2);}};EmailChannel['prototype'][_0x0613('0x19')]=function(_0x40572b){for(var _0x4db474 in _0x40572b){if(_0x40572b[_0x0613('0x1a')](_0x4db474)){if(_0x40572b[_0x4db474][_0x0613('0x15')]&&_0x40572b[_0x4db474][_0x0613('0x1b')]){var _0x406341=_0x40572b[_0x4db474][_0x0613('0x15')];if(!_0x406341[_0x0613('0x1c')]&&_0x40572b[_0x4db474][_0x0613('0x1d')]!==_0x0613('0x1e'))_0x406341[_0x0613('0x1c')]=_0x40572b[_0x4db474]['provider'];if(!this[_0x0613('0xe')][_0x0613('0x1a')](_0x406341['id'])){this[_0x0613('0xe')][_0x406341['id']]=new EmailImap(_0x406341,_0x40572b[_0x4db474][_0x0613('0x5')]);this['imapAccounts'][_0x406341['id']]['on']('box',this['handleImapBox'][_0x0613('0x1f')](this,_0x4db474));this[_0x0613('0xe')][_0x406341['id']]['on'](_0x0613('0x5'),this[_0x0613('0x20')]['bind'](this,_0x4db474));this['imapAccounts'][_0x406341['id']]['on']('end',this[_0x0613('0x21')]['bind'](this,_0x4db474));this[_0x0613('0xe')][_0x406341['id']]['on']('error',this['handleImapError'][_0x0613('0x1f')](this,_0x4db474));}}else{if(_['isNil'](this[_0x0613('0xd')][_0x4db474][_0x0613('0x15')])){this['mailAccounts'][_0x4db474][_0x0613('0x15')]={};}this[_0x0613('0xd')][_0x4db474]['Imap'][_0x0613('0x14')]=_0x0613('0x22');this[_0x0613('0xd')][_0x4db474]['Imap'][_0x0613('0x16')]='';this[_0x0613('0x11')](_0x4db474);}}}};EmailChannel[_0x0613('0x10')][_0x0613('0x23')]=function(_0x54b333,_0x2ff137){if(this[_0x0613('0xd')][_0x54b333]){this[_0x0613('0xd')][_0x54b333]['Imap'][_0x0613('0x14')]=_0x0613('0x24');this[_0x0613('0xd')][_0x54b333][_0x0613('0x15')][_0x0613('0x16')]=_0x2ff137[_0x0613('0x12')];if(_0x2ff137['messages']){this[_0x0613('0xd')][_0x54b333][_0x0613('0x15')][_0x0613('0x17')]=_0x2ff137[_0x0613('0x25')]['total'];}return this[_0x0613('0x11')](_0x54b333);}};EmailChannel[_0x0613('0x10')][_0x0613('0x20')]=function(_0x380c55,_0x1e6092){logger[_0x0613('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x1e6092[_0x0613('0x26')],_0x1e6092['lastName'],_0x1e6092['from'],_0x380c55);if(this[_0x0613('0xd')][_0x380c55]){return mailAccount[_0x0613('0x27')](_0x380c55,_0x1e6092)['then'](function(_0x2f7e70){if(_0x2f7e70){logger[_0x0613('0xc')](_0x0613('0x28'));}})[_0x0613('0x29')](function(_0x5eac1){logger[_0x0613('0x2a')](_0x0613('0x2b'),JSON[_0x0613('0x18')](_0x5eac1));});}};EmailChannel[_0x0613('0x10')]['handleImapEnd']=function(_0x4f9e5a){if(this[_0x0613('0xd')][_0x4f9e5a]&&this['mailAccounts'][_0x4f9e5a][_0x0613('0x15')]){if(this['imapAccounts'][this[_0x0613('0xd')][_0x4f9e5a][_0x0613('0x15')]['id']]){delete this[_0x0613('0xe')][this['mailAccounts'][_0x4f9e5a]['Imap']['id']];}this[_0x0613('0xd')][_0x4f9e5a][_0x0613('0x15')][_0x0613('0x2c')]=moment();this[_0x0613('0x11')](_0x4f9e5a);}};EmailChannel[_0x0613('0x10')][_0x0613('0x2d')]=function(_0x4b1088,_0xc624fa){if(this[_0x0613('0xd')][_0x4b1088]){this[_0x0613('0xd')][_0x4b1088][_0x0613('0x15')][_0x0613('0x14')]=_0x0613('0x2a');this[_0x0613('0xd')][_0x4b1088][_0x0613('0x15')]['messageStatus']=_0xc624fa;return this[_0x0613('0x11')](_0x4b1088);}};EmailChannel[_0x0613('0x10')]['sendMail']=function(_0x10a9f6,_0x6cae04){return this[_0x0613('0xf')][_0x0613('0x2e')](_0x10a9f6,_0x6cae04);};EmailChannel[_0x0613('0x10')][_0x0613('0x2f')]=function(_0x264e33){var _0x152480=this;if(this[_0x0613('0xd')][_0x264e33['id']]){if(_[_0x0613('0x30')](this['mailAccounts'][_0x264e33['id']][_0x0613('0x31')])){this[_0x0613('0xd')][_0x264e33['id']][_0x0613('0x31')]={};}this[_0x0613('0xd')][_0x264e33['id']][_0x0613('0x31')]['lastSync']=moment();return new BPromise(function(_0x5674ef,_0x28a098){return _0x152480[_0x0613('0xf')][_0x0613('0x32')](_0x264e33)['then'](function(_0x256195){_0x152480[_0x0613('0xd')][_0x264e33['id']][_0x0613('0x31')][_0x0613('0x14')]=_0x0613('0x33');_0x152480['mailAccounts'][_0x264e33['id']][_0x0613('0x31')][_0x0613('0x16')]='';_0x152480[_0x0613('0x11')](_0x264e33['id']);_0x5674ef(_0x256195);})['catch'](function(_0x44fdd0){_0x152480[_0x0613('0xd')][_0x264e33['id']][_0x0613('0x31')][_0x0613('0x14')]='error';_0x152480[_0x0613('0xd')][_0x264e33['id']]['Smtp']['messageStatus']=_0x44fdd0;_0x152480[_0x0613('0x11')](_0x264e33['id']);_0x28a098(_0x44fdd0);});});}return this[_0x0613('0xf')][_0x0613('0x32')](_0x264e33);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index fa7e7e1..bda34d6 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 _0x18e0=['handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','handleFetchEnd','handleFetchError','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv','events','../../../config/logger','email','mailbox','account','imap','once','ready'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x18e0,0xa2));var _0x018e=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x18e0[_0x4c445a];return _0x2f611c;};'use strict';var _=require('lodash');var util=require(_0x018e('0x0'));var Imap=require('imap');var simpleParser=require(_0x018e('0x1'))[_0x018e('0x2')];var Iconv=require(_0x018e('0x3'))['Iconv'];var EventEmitter=require(_0x018e('0x4'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x018e('0x5'))(_0x018e('0x6'));function EmailImap(_0x1b90dd,_0x50450b){this['mailbox']=_0x1b90dd[_0x018e('0x7')];this[_0x018e('0x8')]=this['getAccount'](_0x1b90dd,_0x50450b);this[_0x018e('0x9')]=new Imap(this[_0x018e('0x8')]);this[_0x018e('0x9')][_0x018e('0xa')](_0x018e('0xb'),this[_0x018e('0xc')]['bind'](this));this[_0x018e('0x9')]['once']('end',this['handleEnd'][_0x018e('0xd')](this));this[_0x018e('0x9')]['on'](_0x018e('0xe'),this[_0x018e('0xf')][_0x018e('0xd')](this));this[_0x018e('0x9')][_0x018e('0x10')]();}util[_0x018e('0x11')](EmailImap,EventEmitter);EmailImap[_0x018e('0x12')]['getAccount']=function(_0xec531a,_0x3b1e5e){var _0x2d6aa0={'connTimeout':_0xec531a[_0x018e('0x13')]?_0xec531a[_0x018e('0x13')]*0x3e8:0x2710,'authTimeout':_0xec531a['authTimeout']?_0xec531a[_0x018e('0x14')]*0x3e8:0x1388};if(_0xec531a[_0x018e('0x15')]){_0x2d6aa0[_0x018e('0x16')]=_0xec531a[_0x018e('0x16')];if(_0xec531a['modernAuthentication']){_0x2d6aa0[_0x018e('0x17')]=utils[_0x018e('0x18')](_0xec531a['CloudProvider'][_0x018e('0x19')],_0xec531a[_0x018e('0x16')]);}else{_0x2d6aa0[_0x018e('0x1a')]=_0xec531a[_0x018e('0x1a')];}}else{if(_0xec531a[_0x018e('0x1b')]){_0x2d6aa0['user']=_0xec531a[_0x018e('0x16')];_0x2d6aa0[_0x018e('0x1a')]=_0xec531a[_0x018e('0x1a')];}}_0x2d6aa0[_0x018e('0x6')]=_0x3b1e5e||_0xec531a[_0x018e('0x16')]||_0x018e('0x1c');_0x2d6aa0[_0x018e('0x1d')]=_0xec531a['host'];_0x2d6aa0[_0x018e('0x1e')]=_0xec531a[_0x018e('0x1e')]||0x3e1;if(_0xec531a[_0x018e('0x1f')]){_0x2d6aa0[_0x018e('0x1f')]=!![];}else{_0x2d6aa0[_0x018e('0x1f')]=![];_0x2d6aa0['autotls']='required';}return _0x2d6aa0;};EmailImap[_0x018e('0x12')][_0x018e('0xc')]=function(){this[_0x018e('0x9')][_0x018e('0x20')](this[_0x018e('0x7')],![],this[_0x018e('0x21')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x21')]=function(_0x1d0baa,_0x35f9a3){if(_0x1d0baa){this[_0x018e('0xf')](_0x1d0baa,!![]);}else{this['emit'](_0x018e('0x22'),_0x35f9a3);this[_0x018e('0x23')]();}};EmailImap[_0x018e('0x12')][_0x018e('0x24')]=function(_0x2167e6){if(_0x2167e6){this[_0x018e('0xf')](_0x2167e6,!![]);}else{this[_0x018e('0x9')][_0x018e('0x25')]();}};EmailImap[_0x018e('0x12')][_0x018e('0x23')]=function(){this['imap'][_0x018e('0x26')]([_0x018e('0x27')],this['handleReadUnseen'][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x28')]=function(_0x2836b1,_0x13929e){if(_0x2836b1){this[_0x018e('0xf')](_0x2836b1,!![]);}else{if(_0x13929e['length']){try{var _0x2db83e=this[_0x018e('0x9')]['fetch'](_0x13929e,{'bodies':'','markSeen':!![]});_0x2db83e['on'](_0x018e('0x29'),this[_0x018e('0x2a')][_0x018e('0xd')](this));_0x2db83e[_0x018e('0xa')](_0x018e('0xe'),this['handleFetchError'][_0x018e('0xd')](this));_0x2db83e[_0x018e('0xa')](_0x018e('0x25'),this['handleFetchEnd'][_0x018e('0xd')](this));}catch(_0x4d0ed8){logger[_0x018e('0xe')](_0x4d0ed8);}}else{this[_0x018e('0x9')]['closeBox'](!![],this['handleCloseBox'][_0x018e('0xd')](this));}}};EmailImap[_0x018e('0x12')][_0x018e('0x2a')]=function(_0x37f8f6){_0x37f8f6['on'](_0x018e('0x2b'),this['handleMessageBody'][_0x018e('0xd')](this));_0x37f8f6[_0x018e('0xa')](_0x018e('0x2c'),this['handleMessageAttributes']['bind'](this));_0x37f8f6[_0x018e('0xa')](_0x018e('0x25'),this[_0x018e('0x2d')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x2e')]=function(_0x581a9e){simpleParser(_0x581a9e,{'Iconv':Iconv},this[_0x018e('0x2f')][_0x018e('0xd')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x018e('0x2d')]=function(){};EmailImap[_0x018e('0x12')][_0x018e('0x2f')]=function(_0x1705b7,_0x46344c){if(_0x1705b7){logger['error'](_0x1705b7);}else{var _0x465f38=this;utils['parser'](this[_0x018e('0x8')],_0x46344c,function(_0x2d079b){_0x465f38[_0x018e('0x30')](_0x018e('0x6'),_0x2d079b);});}};EmailImap['prototype'][_0x018e('0x31')]=function(){this[_0x018e('0x9')]['closeBox'](!![],this['handleCloseBox'][_0x018e('0xd')](this));};EmailImap['prototype'][_0x018e('0x32')]=function(_0x16b12d){this['handleError'](_0x16b12d);this[_0x018e('0x9')][_0x018e('0x33')](!![],this[_0x018e('0x24')][_0x018e('0xd')](this));};EmailImap[_0x018e('0x12')][_0x018e('0x34')]=function(){this[_0x018e('0x30')](_0x018e('0x25'));};EmailImap['prototype'][_0x018e('0xf')]=function(_0x1386a0,_0x481a10){logger[_0x018e('0xe')](_0x018e('0xf'),this[_0x018e('0x8')][_0x018e('0x6')],JSON[_0x018e('0x35')](_0x1386a0));var _0x51548a='';if(_0x1386a0){if(_0x1386a0[_0x018e('0x36')]){_0x51548a=_0x1386a0['textCode'];}else{for(var _0x396b2e in _0x1386a0){if(_0x1386a0[_0x018e('0x37')](_0x396b2e)){_0x51548a+=_[_0x018e('0x38')](_0x396b2e)+':\x20'+_0x1386a0[_0x396b2e]+'\x0a';}}}}if(_0x481a10){this[_0x018e('0x9')]['end']();}else{this[_0x018e('0x30')](_0x018e('0xe'),_0x51548a);this['emit'](_0x018e('0x25'));}};module[_0x018e('0x39')]=EmailImap; \ No newline at end of file +var _0x4b0e=['account','once','handleReady','bind','error','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','handleError','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleEnd','textCode','hasOwnProperty','exports','lodash','imap','mailparser','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount'];(function(_0x513b34,_0x5e150e){var _0x48a6d4=function(_0x2b9ae2){while(--_0x2b9ae2){_0x513b34['push'](_0x513b34['shift']());}};_0x48a6d4(++_0x5e150e);}(_0x4b0e,0xe3));var _0xe4b0=function(_0x3ff7bb,_0x493a91){_0x3ff7bb=_0x3ff7bb-0x0;var _0x92e69c=_0x4b0e[_0x3ff7bb];return _0x92e69c;};'use strict';var _=require(_0xe4b0('0x0'));var util=require('util');var Imap=require(_0xe4b0('0x1'));var simpleParser=require(_0xe4b0('0x2'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')[_0xe4b0('0x3')];var utils=require(_0xe4b0('0x4'));var logger=require(_0xe4b0('0x5'))(_0xe4b0('0x6'));function EmailImap(_0x1d7ba6,_0x26a4dd){this[_0xe4b0('0x7')]=_0x1d7ba6[_0xe4b0('0x7')];this['account']=this[_0xe4b0('0x8')](_0x1d7ba6,_0x26a4dd);this[_0xe4b0('0x1')]=new Imap(this[_0xe4b0('0x9')]);this['imap'][_0xe4b0('0xa')]('ready',this[_0xe4b0('0xb')]['bind'](this));this['imap'][_0xe4b0('0xa')]('end',this['handleEnd'][_0xe4b0('0xc')](this));this['imap']['on'](_0xe4b0('0xd'),this['handleError'][_0xe4b0('0xc')](this));this[_0xe4b0('0x1')]['connect']();}util[_0xe4b0('0xe')](EmailImap,EventEmitter);EmailImap[_0xe4b0('0xf')]['getAccount']=function(_0x11436d,_0x340eb7){var _0x54b564={'connTimeout':_0x11436d[_0xe4b0('0x10')]?_0x11436d[_0xe4b0('0x10')]*0x3e8:0x2710,'authTimeout':_0x11436d[_0xe4b0('0x11')]?_0x11436d[_0xe4b0('0x11')]*0x3e8:0x1388};if(_0x11436d[_0xe4b0('0x12')]){_0x54b564[_0xe4b0('0x13')]=_0x11436d[_0xe4b0('0x13')];if(_0x11436d[_0xe4b0('0x14')]){_0x54b564[_0xe4b0('0x15')]=utils[_0xe4b0('0x16')](_0x11436d[_0xe4b0('0x17')]['data5'],_0x11436d[_0xe4b0('0x13')]);}else{_0x54b564[_0xe4b0('0x18')]=_0x11436d[_0xe4b0('0x18')];}}else{if(_0x11436d[_0xe4b0('0x19')]){_0x54b564[_0xe4b0('0x13')]=_0x11436d[_0xe4b0('0x13')];_0x54b564[_0xe4b0('0x18')]=_0x11436d['password'];}}_0x54b564[_0xe4b0('0x6')]=_0x340eb7||_0x11436d[_0xe4b0('0x13')]||'anonymous@xcally.com';_0x54b564['host']=_0x11436d[_0xe4b0('0x1a')];_0x54b564['port']=_0x11436d[_0xe4b0('0x1b')]||0x3e1;if(_0x11436d[_0xe4b0('0x1c')]){_0x54b564[_0xe4b0('0x1c')]=!![];}else{_0x54b564[_0xe4b0('0x1c')]=![];_0x54b564[_0xe4b0('0x1d')]=_0xe4b0('0x1e');}return _0x54b564;};EmailImap[_0xe4b0('0xf')]['handleReady']=function(){this[_0xe4b0('0x1')][_0xe4b0('0x1f')](this[_0xe4b0('0x7')],![],this[_0xe4b0('0x20')][_0xe4b0('0xc')](this));};EmailImap['prototype'][_0xe4b0('0x20')]=function(_0x5acab7,_0x2065c1){if(_0x5acab7){this['handleError'](_0x5acab7,!![]);}else{this[_0xe4b0('0x21')](_0xe4b0('0x22'),_0x2065c1);this[_0xe4b0('0x23')]();}};EmailImap[_0xe4b0('0xf')]['handleCloseBox']=function(_0x12c169){if(_0x12c169){this[_0xe4b0('0x24')](_0x12c169,!![]);}else{this[_0xe4b0('0x1')][_0xe4b0('0x25')]();}};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x23')]=function(){this['imap']['search']([_0xe4b0('0x26')],this[_0xe4b0('0x27')][_0xe4b0('0xc')](this));};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x27')]=function(_0x1e1697,_0x368250){if(_0x1e1697){this[_0xe4b0('0x24')](_0x1e1697,!![]);}else{if(_0x368250[_0xe4b0('0x28')]){try{var _0x5c9d0f=this[_0xe4b0('0x1')][_0xe4b0('0x29')](_0x368250,{'bodies':'','markSeen':!![]});_0x5c9d0f['on'](_0xe4b0('0x2a'),this[_0xe4b0('0x2b')][_0xe4b0('0xc')](this));_0x5c9d0f['once'](_0xe4b0('0xd'),this[_0xe4b0('0x2c')][_0xe4b0('0xc')](this));_0x5c9d0f[_0xe4b0('0xa')](_0xe4b0('0x25'),this['handleFetchEnd']['bind'](this));}catch(_0x2ca53c){logger[_0xe4b0('0xd')](_0x2ca53c);}}else{this['imap'][_0xe4b0('0x2d')](!![],this[_0xe4b0('0x2e')][_0xe4b0('0xc')](this));}}};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x2b')]=function(_0x3656ea){_0x3656ea['on'](_0xe4b0('0x2f'),this[_0xe4b0('0x30')][_0xe4b0('0xc')](this));_0x3656ea[_0xe4b0('0xa')](_0xe4b0('0x31'),this[_0xe4b0('0x32')][_0xe4b0('0xc')](this));_0x3656ea['once'](_0xe4b0('0x25'),this[_0xe4b0('0x33')][_0xe4b0('0xc')](this));};EmailImap['prototype'][_0xe4b0('0x30')]=function(_0x51ddb3){simpleParser(_0x51ddb3,{'Iconv':Iconv},this[_0xe4b0('0x34')][_0xe4b0('0xc')](this));};EmailImap[_0xe4b0('0xf')]['handleMessageAttributes']=function(){};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x33')]=function(){};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x34')]=function(_0x5cde11,_0x17ec7a){if(_0x5cde11){logger[_0xe4b0('0xd')](_0x5cde11);}else{var _0x536009=this;utils[_0xe4b0('0x35')](this['account'],_0x17ec7a,function(_0x1ca5ef){_0x536009[_0xe4b0('0x21')]('email',_0x1ca5ef);});}};EmailImap['prototype'][_0xe4b0('0x36')]=function(){this[_0xe4b0('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xe4b0('0xc')](this));};EmailImap[_0xe4b0('0xf')]['handleFetchError']=function(_0xf597a1){this[_0xe4b0('0x24')](_0xf597a1);this[_0xe4b0('0x1')][_0xe4b0('0x2d')](!![],this['handleCloseBox'][_0xe4b0('0xc')](this));};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x37')]=function(){this[_0xe4b0('0x21')](_0xe4b0('0x25'));};EmailImap[_0xe4b0('0xf')][_0xe4b0('0x24')]=function(_0x1e3e85,_0x21de91){logger[_0xe4b0('0xd')](_0xe4b0('0x24'),this[_0xe4b0('0x9')][_0xe4b0('0x6')],JSON['stringify'](_0x1e3e85));var _0x400221='';if(_0x1e3e85){if(_0x1e3e85[_0xe4b0('0x38')]){_0x400221=_0x1e3e85[_0xe4b0('0x38')];}else{for(var _0x37e6dd in _0x1e3e85){if(_0x1e3e85[_0xe4b0('0x39')](_0x37e6dd)){_0x400221+=_['upperFirst'](_0x37e6dd)+':\x20'+_0x1e3e85[_0x37e6dd]+'\x0a';}}}}if(_0x21de91){this['imap'][_0xe4b0('0x25')]();}else{this[_0xe4b0('0x21')]('error',_0x400221);this[_0xe4b0('0x21')](_0xe4b0('0x25'));}};module[_0xe4b0('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 939be98..55779f8 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 _0x258f=['nodemailer-plugin-inline-base64','send','use','prototype','verify','toString','Not\x20verifired','exports'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x258f,0x180));var _0xf258=function(_0x19ba18,_0xf6f979){_0x19ba18=_0x19ba18-0x0;var _0x554c75=_0x258f[_0x19ba18];return _0x554c75;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xf258('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0xf258('0x1')]=function(_0x312939,_0x73b3e2){return new Promise(function(_0x5496d0,_0x1ac7e9){var _0x18824a=nodemailer['createTransport'](_0x312939);_0x18824a[_0xf258('0x2')]('compile',inlineBase64());_0x18824a['sendMail'](_0x73b3e2,function(_0x37ead2,_0x17e084){if(_0x37ead2){_0x1ac7e9(_0x37ead2['toString']());}else{_0x5496d0(_0x17e084);}});});};EmailSmtp[_0xf258('0x3')][_0xf258('0x4')]=function(_0x846fb9){return new Promise(function(_0x3f7809,_0x41b59a){var _0x15a098=nodemailer['createTransport'](_0x846fb9);_0x15a098[_0xf258('0x4')](function(_0xa3b882,_0x2a85c3){if(_0xa3b882){_0x41b59a(_0xa3b882[_0xf258('0x5')]());}else{if(_0x2a85c3){_0x3f7809(_0x2a85c3);}else{_0x41b59a(_0xf258('0x6'));}}});});};module[_0xf258('0x7')]=EmailSmtp; \ No newline at end of file +var _0x9940=['createTransport','use','compile','sendMail','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x1f6f4a,_0x1fe8fb){var _0x3f08e9=function(_0x1cf0ef){while(--_0x1cf0ef){_0x1f6f4a['push'](_0x1f6f4a['shift']());}};_0x3f08e9(++_0x1fe8fb);}(_0x9940,0x85));var _0x0994=function(_0xd85267,_0x1e43ad){_0xd85267=_0xd85267-0x0;var _0x1c26de=_0x9940[_0xd85267];return _0x1c26de;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x0994('0x0'));function EmailSmtp(){}EmailSmtp[_0x0994('0x1')]['send']=function(_0x137476,_0x590214){return new Promise(function(_0x1dec59,_0x4ac138){var _0x330725=nodemailer[_0x0994('0x2')](_0x137476);_0x330725[_0x0994('0x3')](_0x0994('0x4'),inlineBase64());_0x330725[_0x0994('0x5')](_0x590214,function(_0xf26450,_0x52beb8){if(_0xf26450){_0x4ac138(_0xf26450['toString']());}else{_0x1dec59(_0x52beb8);}});});};EmailSmtp[_0x0994('0x1')][_0x0994('0x6')]=function(_0x33c609){return new Promise(function(_0x148db0,_0x1a8c6c){var _0x4565f6=nodemailer[_0x0994('0x2')](_0x33c609);_0x4565f6[_0x0994('0x6')](function(_0x5e5b48,_0x45a794){if(_0x5e5b48){_0x1a8c6c(_0x5e5b48['toString']());}else{if(_0x45a794){_0x148db0(_0x45a794);}else{_0x1a8c6c(_0x0994('0x7'));}}});});};module[_0x0994('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 62596be..07e7cdc 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 _0x79c0=['originTo','type','attachment-','format','%s-%s','root','server/files/attachments/','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','parser','from','subject','inReplyTo','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','pop','isEmpty','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x46b4c6[_0x079c('0x12')](0x0,-0x1)['join']('\x20'):_0x48942e[_0x079c('0xd')];}return'Anonymous';}function getLastName(_0xc6b1d6){var _0x4c058a=_[_0x079c('0x7')](_0xc6b1d6[_0x079c('0x8')]);if(_0x4c058a&&_0x4c058a['name']){var _0x15c7a3=_0x4c058a[_0x079c('0xd')][_0x079c('0x10')](/\s+/);return _0x15c7a3['length']>0x1?_0x15c7a3[_0x079c('0x13')]():'';}return'';}function getMails(_0x67854e,_0x50d609){var _0x352c0d='';for(var _0x2b526a=0x0;_0x2b526a<_0x50d609[_0x079c('0x8')][_0x079c('0x11')];_0x2b526a+=0x1){if(_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]!==_0x67854e){if(!_[_0x079c('0x14')](_0x352c0d)){_0x352c0d+=',';}_0x352c0d+=_0x50d609[_0x079c('0x8')][_0x2b526a]['name']||_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]||'';_0x352c0d+='\x20<';_0x352c0d+=_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]?_0x50d609[_0x079c('0x8')][_0x2b526a][_0x079c('0x9')]:_0x079c('0xa')+random[_0x079c('0xb')](0x6)+'@xcally.com';_0x352c0d+='>';}}return _0x352c0d;}function parseEmail(_0x4d67c0,_0xab7397,_0xc1056a){if(_0xab7397[_0x079c('0x15')]){var _0x1844ff=/)<[^<]*)*<\/script>/gi;while(_0x1844ff[_0x079c('0x16')](_0xab7397['html'])){_0xab7397[_0x079c('0x15')]=_0xab7397[_0x079c('0x15')][_0x079c('0x17')](_0x1844ff,'');}if(_0xab7397['html'][_0x079c('0x18')]('{_0xcf4c96[_0x079c('0x1b')](_0x171db0[_0x079c('0x1c')]);});var _0x10ae02=/]+>/g;var _0x5343c0=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4f12cf=_0xab7397[_0x079c('0x15')][_0x079c('0x17')](_0x5343c0,_0x079c('0x1d'));var _0x15c06d=_0x4f12cf['replace'](_0x10ae02,'_IMG');for(let _0x1eb4b4=0x0;_0x1eb4b4<_0xcf4c96['length'];_0x1eb4b4++){var _0x4bfbaf=_0x15c06d['replace'](_0x079c('0x1e'),_0x079c('0x1f')+_0xcf4c96[_0x1eb4b4]+_0x079c('0x20'));_0x15c06d=_0x4bfbaf;}_0xab7397[_0x079c('0x15')]=_0x15c06d;}_0xc1056a[_0x079c('0x21')]=_0xab7397[_0x079c('0x15')];}else{_0xc1056a[_0x079c('0x21')]=_0xab7397[_0x079c('0x22')];}if(_0xc1056a[_0x079c('0x21')]){_0xc1056a[_0x079c('0x21')]=_0xc1056a[_0x079c('0x21')][_0x079c('0x17')](/0x0){var _0x14b381=[_0x079c('0x2f'),_0x079c('0x30'),'Precedence:\x20auto_reply'];for(var _0x4f6428=0x0;_0x4f6428<_0xab7397[_0x079c('0x2e')][_0x079c('0x11')];_0x4f6428++){var _0x5bfc0f=_[_0x079c('0xf')](_0x14b381,_0xab7397[_0x079c('0x2e')][_0x4f6428][_0x079c('0x31')]);if(_0x5bfc0f>=0x0){_0xc1056a[_0x079c('0x32')]=!![];}}}return _0xc1056a;}exports[_0x079c('0x33')]=function(_0x3ba5ce,_0x4d4ade,_0x5bb261){var _0x2395ca={'from':getAddress(_0x4d4ade['from']),'firstName':getFirstName(_0x4d4ade[_0x079c('0x34')]),'lastName':getLastName(_0x4d4ade[_0x079c('0x34')]),'mapKey':_0x079c('0x5'),'message':{'from':getMails(_0x3ba5ce[_0x079c('0x5')],_0x4d4ade[_0x079c('0x34')]),'to':_0x3ba5ce[_0x079c('0x5')],'cc':'','subject':_0x4d4ade[_0x079c('0x35')]||'','messageId':_0x4d4ade['messageId'],'inReplyTo':_0x4d4ade[_0x079c('0x36')],'sentAt':moment(_0x4d4ade['date'])[_0x079c('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4d4ade[_0x079c('0x15')]&&!_0x4d4ade['textAsHtml']){var _0x530101=_[_0x079c('0x37')](_0x4d4ade[_0x079c('0x19')],{'contentType':_0x079c('0x38')});if(_0x530101['length']){logger['info'](util[_0x079c('0x29')](_0x079c('0x39'),_0x4d4ade[_0x079c('0x3a')]));tnef[_0x079c('0x3b')](_[_0x079c('0x3c')](_0x530101)['content'],function(_0x37561e,_0x42c4d0){if(_0x42c4d0){_0x4d4ade[_0x079c('0x15')]=_0x42c4d0[_0x079c('0x3d')]||'

Empty\x20message

';if(_0x42c4d0['Attachments']){for(var _0x514a7b=0x0;_0x514a7b<_0x42c4d0[_0x079c('0x3e')][_0x079c('0x11')];_0x514a7b++){var _0x106fd1=_0x42c4d0[_0x079c('0x3e')][_0x514a7b];_0x2395ca[_0x079c('0x24')][_0x079c('0x19')][_0x079c('0x1b')]({'filename':_0x106fd1[_0x079c('0x3f')],'content':Buffer[_0x079c('0x34')](_0x106fd1[_0x079c('0x40')])});}}}_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));});}else{_0x4d4ade[_0x079c('0x15')]=_0x079c('0x41');_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));}}else{_0x5bb261(parseEmail(_0x3ba5ce,_0x4d4ade,_0x2395ca));}};exports[_0x079c('0x42')]=function(_0x55fcf5,_0x195504){var _0x163db4=[_0x079c('0x43')+(_0x195504||''),_0x079c('0x44')+_0x55fcf5,'',''];return Buffer[_0x079c('0x34')](_0x163db4[_0x079c('0x45')](''),_0x079c('0x46'))[_0x079c('0x47')](_0x079c('0x48'));}; \ No newline at end of file +var _0x521e=['randomstring','path','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','length','slice','Anonymous','split','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','push','Title','user=','auth=Bearer\x20','join','utf-8','toString','lodash','moment'];(function(_0x38bca5,_0x382a4a){var _0x38bd18=function(_0x32b386){while(--_0x32b386){_0x38bca5['push'](_0x38bca5['shift']());}};_0x38bd18(++_0x382a4a);}(_0x521e,0x175));var _0xe521=function(_0x38ffc3,_0x54dac2){_0x38ffc3=_0x38ffc3-0x0;var _0x5628f4=_0x521e[_0x38ffc3];return _0x5628f4;};'use strict';var _=require(_0xe521('0x0'));var moment=require(_0xe521('0x1'));var random=require(_0xe521('0x2'));var fs=require('fs');var path=require(_0xe521('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0xe521('0x4'))('email');var config=require(_0xe521('0x5'));function getAddress(_0x181610){var _0x1a25d0=_[_0xe521('0x6')](_0x181610[_0xe521('0x7')]);return _0x1a25d0&&_0x1a25d0[_0xe521('0x8')]?_0x1a25d0[_0xe521('0x8')]:_0xe521('0x9')+random[_0xe521('0xa')](0x6)+_0xe521('0xb');}function getFirstName(_0x55552e){var _0x2731c2=_['head'](_0x55552e['value']);if(_0x2731c2&&_0x2731c2[_0xe521('0xc')]){if(_0x2731c2[_0xe521('0xc')]==_0x2731c2[_0xe521('0x8')]){return _0x2731c2[_0xe521('0xc')][_0xe521('0xd')](0x0,_0x2731c2[_0xe521('0xc')][_0xe521('0xe')]('@'));}var _0x424fb5=_0x2731c2['name']['split'](/\s+/);return _0x424fb5[_0xe521('0xf')]>0x1?_0x424fb5[_0xe521('0x10')](0x0,-0x1)['join']('\x20'):_0x2731c2[_0xe521('0xc')];}return _0xe521('0x11');}function getLastName(_0x332ab7){var _0x45af01=_[_0xe521('0x6')](_0x332ab7[_0xe521('0x7')]);if(_0x45af01&&_0x45af01[_0xe521('0xc')]){var _0x57a728=_0x45af01[_0xe521('0xc')][_0xe521('0x12')](/\s+/);return _0x57a728[_0xe521('0xf')]>0x1?_0x57a728[_0xe521('0x13')]():'';}return'';}function getMails(_0x420d1e,_0x305d0b){var _0x59bca8='';for(var _0x51fd4d=0x0;_0x51fd4d<_0x305d0b[_0xe521('0x7')][_0xe521('0xf')];_0x51fd4d+=0x1){if(_0x305d0b['value'][_0x51fd4d]['address']!==_0x420d1e){if(!_[_0xe521('0x14')](_0x59bca8)){_0x59bca8+=',';}_0x59bca8+=_0x305d0b[_0xe521('0x7')][_0x51fd4d][_0xe521('0xc')]||_0x305d0b[_0xe521('0x7')][_0x51fd4d][_0xe521('0x8')]||'';_0x59bca8+='\x20<';_0x59bca8+=_0x305d0b['value'][_0x51fd4d]['address']?_0x305d0b['value'][_0x51fd4d][_0xe521('0x8')]:_0xe521('0x9')+random[_0xe521('0xa')](0x6)+_0xe521('0xb');_0x59bca8+='>';}}return _0x59bca8;}function parseEmail(_0x3575d2,_0x934e5b,_0x45e263){if(_0x934e5b[_0xe521('0x15')]){var _0x31ae8f=/)<[^<]*)*<\/script>/gi;while(_0x31ae8f[_0xe521('0x16')](_0x934e5b[_0xe521('0x15')])){_0x934e5b[_0xe521('0x15')]=_0x934e5b[_0xe521('0x15')][_0xe521('0x17')](_0x31ae8f,'');}if(_0x934e5b['html'][_0xe521('0x18')](_0xe521('0x19'))){var _0x2d84f5=[];_0x934e5b[_0xe521('0x1a')][_0xe521('0x1b')](_0x4734d6=>{_0x2d84f5['push'](_0x4734d6[_0xe521('0x1c')]);});var _0x35dd1c=/]+>/g;var _0x28b6c4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x20a3a2=_0x934e5b['html'][_0xe521('0x17')](_0x28b6c4,_0xe521('0x1d'));var _0x99be84=_0x20a3a2[_0xe521('0x17')](_0x35dd1c,_0xe521('0x1e'));for(let _0x47405f=0x0;_0x47405f<_0x2d84f5[_0xe521('0xf')];_0x47405f++){var _0x21b3ef=_0x99be84[_0xe521('0x17')](_0xe521('0x1e'),_0xe521('0x1f')+_0x2d84f5[_0x47405f]+_0xe521('0x20'));_0x99be84=_0x21b3ef;}_0x934e5b[_0xe521('0x15')]=_0x99be84;}_0x45e263[_0xe521('0x21')]=_0x934e5b[_0xe521('0x15')];}else{_0x45e263[_0xe521('0x21')]=_0x934e5b[_0xe521('0x22')];}if(_0x45e263[_0xe521('0x21')]){_0x45e263['body']=_0x45e263[_0xe521('0x21')][_0xe521('0x17')](/0x0){var _0x2aba1b=['Auto-Submitted:\x20auto-replied',_0xe521('0x32'),_0xe521('0x33')];for(var _0x4db2b9=0x0;_0x4db2b9<_0x934e5b[_0xe521('0x31')][_0xe521('0xf')];_0x4db2b9++){var _0x5e6d47=_['indexOf'](_0x2aba1b,_0x934e5b[_0xe521('0x31')][_0x4db2b9][_0xe521('0x34')]);if(_0x5e6d47>=0x0){_0x45e263[_0xe521('0x35')]=!![];}}}return _0x45e263;}exports[_0xe521('0x36')]=function(_0x38a2f1,_0x4be226,_0x1ae3b6){var _0x46600d={'from':getAddress(_0x4be226[_0xe521('0x37')]),'firstName':getFirstName(_0x4be226[_0xe521('0x37')]),'lastName':getLastName(_0x4be226[_0xe521('0x37')]),'mapKey':_0xe521('0x27'),'message':{'from':getMails(_0x38a2f1[_0xe521('0x27')],_0x4be226[_0xe521('0x37')]),'to':_0x38a2f1[_0xe521('0x27')],'cc':'','subject':_0x4be226[_0xe521('0x38')]||'','messageId':_0x4be226[_0xe521('0x39')],'inReplyTo':_0x4be226[_0xe521('0x3a')],'sentAt':moment(_0x4be226['date'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x4be226[_0xe521('0x15')]&&!_0x4be226[_0xe521('0x22')]){var _0x589ba2=_['filter'](_0x4be226[_0xe521('0x1a')],{'contentType':_0xe521('0x3b')});if(_0x589ba2['length']){logger[_0xe521('0x3c')](util[_0xe521('0x3d')](_0xe521('0x3e'),_0x4be226[_0xe521('0x39')]));tnef[_0xe521('0x3f')](_[_0xe521('0x40')](_0x589ba2)[_0xe521('0x30')],function(_0x3b95bb,_0x63912b){if(_0x63912b){_0x4be226[_0xe521('0x15')]=_0x63912b[_0xe521('0x41')]||_0xe521('0x42');if(_0x63912b[_0xe521('0x43')]){for(var _0x534fd5=0x0;_0x534fd5<_0x63912b['Attachments'][_0xe521('0xf')];_0x534fd5++){var _0x3dc86b=_0x63912b[_0xe521('0x43')][_0x534fd5];_0x46600d[_0xe521('0x24')][_0xe521('0x1a')][_0xe521('0x44')]({'filename':_0x3dc86b[_0xe521('0x45')],'content':Buffer[_0xe521('0x37')](_0x3dc86b['Data'])});}}}_0x1ae3b6(parseEmail(_0x38a2f1,_0x4be226,_0x46600d));});}else{_0x4be226['html']=_0xe521('0x42');_0x1ae3b6(parseEmail(_0x38a2f1,_0x4be226,_0x46600d));}}else{_0x1ae3b6(parseEmail(_0x38a2f1,_0x4be226,_0x46600d));}};exports['generateXOAuth2Token']=function(_0x4db4cd,_0x42b3df){var _0x3d95f1=[_0xe521('0x46')+(_0x42b3df||''),_0xe521('0x47')+_0x4db4cd,'',''];return Buffer[_0xe521('0x37')](_0x3d95f1[_0xe521('0x48')](''),_0xe521('0x49'))[_0xe521('0x4a')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 77bedb9..613e5c5 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 _0xdd40=['Service','key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x159fd2,_0x3ae329){var _0x59ee66=function(_0x5d5551){while(--_0x5d5551){_0x159fd2['push'](_0x159fd2['shift']());}};_0x59ee66(++_0x3ae329);}(_0xdd40,0x142));var _0x0dd4=function(_0x6ad65,_0x1a955a){_0x6ad65=_0x6ad65-0x0;var _0x159041=_0xdd40[_0x6ad65];return _0x159041;};'use strict';var _=require(_0x0dd4('0x0'));function MailAccount(_0x2cb7d5){this['id']=_0x2cb7d5['id']||0x0;this[_0x0dd4('0x1')]=_0x2cb7d5['name']||_0x0dd4('0x2');this[_0x0dd4('0x3')]=_0x2cb7d5[_0x0dd4('0x3')]||_0x0dd4('0x4');this[_0x0dd4('0x5')]=_0x2cb7d5[_0x0dd4('0x5')]||![];this[_0x0dd4('0x6')]=_0x2cb7d5[_0x0dd4('0x6')]||[];this[_0x0dd4('0x7')]=_0x2cb7d5[_0x0dd4('0x7')]||[];}module[_0x0dd4('0x8')]=MailAccount; \ No newline at end of file +var _0xb250=['Service','key','active','Smtp','lodash'];(function(_0x4a3b34,_0x3c0745){var _0x496776=function(_0x1a8f69){while(--_0x1a8f69){_0x4a3b34['push'](_0x4a3b34['shift']());}};_0x496776(++_0x3c0745);}(_0xb250,0xfe));var _0x0b25=function(_0x31d621,_0x595c02){_0x31d621=_0x31d621-0x0;var _0x43723f=_0xb250[_0x31d621];return _0x43723f;};'use strict';var _=require(_0x0b25('0x0'));function MailAccount(_0x4f2145){this['id']=_0x4f2145['id']||0x0;this['name']=_0x4f2145['name']||_0x0b25('0x1');this[_0x0b25('0x2')]=_0x4f2145['key']||'SERV';this['active']=_0x4f2145[_0x0b25('0x3')]||![];this['Imap']=_0x4f2145['Imap']||[];this[_0x0b25('0x4')]=_0x4f2145[_0x0b25('0x4')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 178297a..15d1ee4 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 _0xef24=['lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','isUndefined','merge','exports'];(function(_0x15d604,_0x5893ca){var _0x1cfcf1=function(_0x3ec1d6){while(--_0x3ec1d6){_0x15d604['push'](_0x15d604['shift']());}};_0x1cfcf1(++_0x5893ca);}(_0xef24,0xb4));var _0x4ef2=function(_0x1bb139,_0x2ef244){_0x1bb139=_0x1bb139-0x0;var _0x58d7b2=_0xef24[_0x1bb139];return _0x58d7b2;};'use strict';var _=require(_0x4ef2('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x4ef2('0x1')]={};};function freeIsNotKey(_0x51a56f,_0x2c55f2,_0x3ca169){var _0x470f7a=_[_0x4ef2('0x2')](_0x51a56f,function(_0x1b7f07,_0x331b59){return _0x1b7f07[_0x3ca169];});for(var _0x385e0f in _0x2c55f2){if(_0x2c55f2[_0x4ef2('0x3')](_0x385e0f)){if(!_0x470f7a[_0x385e0f]){delete _0x2c55f2[_0x385e0f];}}}}Realtime['prototype'][_0x4ef2('0x4')]=function(_0x311302,_0xa514ff){for(var _0x1a94c7 in _0xa514ff){if(_0x311302[_0x4ef2('0x3')](_0x1a94c7)){_0x311302[_0x1a94c7]=_0xa514ff[_0x1a94c7];}}};Realtime[_0x4ef2('0x5')][_0x4ef2('0x6')]=function(){var _0x52a69b=this;return function(_0x3b7893){if(_0x3b7893){freeIsNotKey(_0x3b7893,_0x52a69b[_0x4ef2('0x1')],'id');for(var _0xe37685=0x0,_0x1554f2={},_0x567caf={};_0xe37685<_0x3b7893['length'];_0xe37685+=0x1){_0x1554f2=_0x3b7893[_0xe37685];if(_[_0x4ef2('0x7')](_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']])){_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']]=new MailAccount(_0x1554f2);}else{_[_0x4ef2('0x8')](_0x52a69b[_0x4ef2('0x1')][_0x1554f2['id']],_0x1554f2);}}}return _0x52a69b[_0x4ef2('0x1')];};};module[_0x4ef2('0x9')]=Realtime; \ No newline at end of file +var _0x605c=['prototype','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x605c,0xcd));var _0xc605=function(_0x10ec1b,_0x408ff5){_0x10ec1b=_0x10ec1b-0x0;var _0x9de411=_0x605c[_0x10ec1b];return _0x9de411;};'use strict';var _=require(_0xc605('0x0'));var MailAccount=require(_0xc605('0x1'));var Realtime=function(){this[_0xc605('0x2')]={};};function freeIsNotKey(_0x5cc2ad,_0x32a7a0,_0x457a7e){var _0x3b1f6a=_[_0xc605('0x3')](_0x5cc2ad,function(_0x4439d8,_0x12f4a0){return _0x4439d8[_0x457a7e];});for(var _0x2333e6 in _0x32a7a0){if(_0x32a7a0[_0xc605('0x4')](_0x2333e6)){if(!_0x3b1f6a[_0x2333e6]){delete _0x32a7a0[_0x2333e6];}}}}Realtime[_0xc605('0x5')]['mergeFromDatabase']=function(_0x42dcef,_0x3f9981){for(var _0xd5e9c6 in _0x3f9981){if(_0x42dcef[_0xc605('0x4')](_0xd5e9c6)){_0x42dcef[_0xd5e9c6]=_0x3f9981[_0xd5e9c6];}}};Realtime[_0xc605('0x5')]['initMailAccounts']=function(){var _0xeeaf84=this;return function(_0x39657e){if(_0x39657e){freeIsNotKey(_0x39657e,_0xeeaf84[_0xc605('0x2')],'id');for(var _0x2ec99e=0x0,_0x364b67={},_0x2404fa={};_0x2ec99e<_0x39657e[_0xc605('0x6')];_0x2ec99e+=0x1){_0x364b67=_0x39657e[_0x2ec99e];if(_[_0xc605('0x7')](_0xeeaf84[_0xc605('0x2')][_0x364b67['id']])){_0xeeaf84['mailAccounts'][_0x364b67['id']]=new MailAccount(_0x364b67);}else{_[_0xc605('0x8')](_0xeeaf84[_0xc605('0x2')][_0x364b67['id']],_0x364b67);}}}return _0xeeaf84[_0xc605('0x2')];};};module[_0xc605('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d1147cc..61e061a 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 _0x5c84=['notify','NotifyMailAccount','../client','Request','GetMailAccount','provider','service','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c84,0x1ca));var _0x45c8=function(_0x17d45a,_0x334044){_0x17d45a=_0x17d45a-0x0;var _0x1f669c=_0x5c84[_0x17d45a];return _0x1f669c;};'use strict';var client=require(_0x45c8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x45c8('0x1')](_0x45c8('0x2'),{'options':{'attributes':['id','name',_0x45c8('0x3'),_0x45c8('0x4'),'email',_0x45c8('0x5'),'key',_0x45c8('0x6'),_0x45c8('0x7')],'raw':![],'include':[{'model':_0x45c8('0x8'),'as':_0x45c8('0x9'),'include':[{'model':_0x45c8('0xa'),'attributes':['id',_0x45c8('0xb'),_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]},{'model':_0x45c8('0xe'),'as':_0x45c8('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]}]},'log':_0x45c8('0x10')});};};exports[_0x45c8('0x11')]=function(_0x3d6c2f,_0x2da758){return client[_0x45c8('0x1')](_0x45c8('0x12'),{'account':{'id':_0x3d6c2f},'body':_0x2da758,'log':_0x45c8('0x12')});}; \ No newline at end of file +var _0xc0a4=['GetMailAccount','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','MailServerOut','data5','getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts'];(function(_0x2b7474,_0x12bbec){var _0x365141=function(_0x2d80dd){while(--_0x2d80dd){_0x2b7474['push'](_0x2b7474['shift']());}};_0x365141(++_0x12bbec);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x3ea7bd,_0x3f52ec){_0x3ea7bd=_0x3ea7bd-0x0;var _0x148157=_0xc0a4[_0x3ea7bd];return _0x148157;};'use strict';var client=require(_0x4c0a('0x0'));exports[_0x4c0a('0x1')]=function(){return function(){return client['Request'](_0x4c0a('0x2'),{'options':{'attributes':['id','name',_0x4c0a('0x3'),_0x4c0a('0x4'),_0x4c0a('0x5'),_0x4c0a('0x6'),_0x4c0a('0x7'),_0x4c0a('0x8'),_0x4c0a('0x9')],'raw':![],'include':[{'model':_0x4c0a('0xa'),'as':_0x4c0a('0xb'),'include':[{'model':_0x4c0a('0xc'),'attributes':['id','name',_0x4c0a('0x4'),_0x4c0a('0xd'),'data5'],'as':_0x4c0a('0xc')}]},{'model':_0x4c0a('0xe'),'as':'Smtp','include':[{'model':_0x4c0a('0xc'),'attributes':['id','name',_0x4c0a('0x4'),_0x4c0a('0xd'),_0x4c0a('0xf')],'as':_0x4c0a('0xc')}]}]},'log':_0x4c0a('0x10')});};};exports[_0x4c0a('0x11')]=function(_0x4e86fc,_0x4b75ee){return client[_0x4c0a('0x12')](_0x4c0a('0x13'),{'account':{'id':_0x4e86fc},'body':_0x4b75ee,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 7f8be62..30768e3 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 _0x2ea3=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x1695ca,_0x1b0227){var _0x594851=function(_0x487178){while(--_0x487178){_0x1695ca['push'](_0x1695ca['shift']());}};_0x594851(++_0x1b0227);}(_0x2ea3,0x12f));var _0x32ea=function(_0x32e833,_0x46dbdf){_0x32e833=_0x32e833-0x0;var _0xa31d8f=_0x2ea3[_0x32e833];return _0xa31d8f;};'use strict';var client=require(_0x32ea('0x0'));exports[_0x32ea('0x1')]=function(){return client['Request'](_0x32ea('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x32ea('0x3')]},'log':_0x32ea('0x4')});}; \ No newline at end of file +var _0x31fc=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0xf90c74,_0x1ea5ca){var _0x3e5b3a=function(_0x581d90){while(--_0x581d90){_0xf90c74['push'](_0xf90c74['shift']());}};_0x3e5b3a(++_0x1ea5ca);}(_0x31fc,0xd2));var _0xc31f=function(_0x4336a6,_0xc235ca){_0x4336a6=_0x4336a6-0x0;var _0x4012f3=_0x31fc[_0x4336a6];return _0x4012f3;};'use strict';var client=require(_0xc31f('0x0'));exports[_0xc31f('0x1')]=function(){return client[_0xc31f('0x2')](_0xc31f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc31f('0x4')]},'log':_0xc31f('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 080db99..8c4488b 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 e5887d7..517553c 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 _0x62fe=['lodash','http','ioredis','createServer','timeout','listen','socket.io','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','once','listening','log','port'];(function(_0x6b695f,_0x1607cf){var _0x39536a=function(_0x542d5a){while(--_0x542d5a){_0x6b695f['push'](_0x6b695f['shift']());}};_0x39536a(++_0x1607cf);}(_0x62fe,0xbe));var _0xe62f=function(_0x23d94c,_0x2081ab){_0x23d94c=_0x23d94c-0x0;var _0x37d99d=_0x62fe[_0x23d94c];return _0x37d99d;};'use strict';var _=require(_0xe62f('0x0'));var http=require(_0xe62f('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xe62f('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0xe62f('0x3')](app);server[_0xe62f('0x4')]=0xdbba0;if(sticky[_0xe62f('0x5')](server,config['port'])){var socketio=require(_0xe62f('0x6'))(server,{'transports':['websocket',_0xe62f('0x7')]});config[_0xe62f('0x8')]=_['defaults'](config['redis'],{'host':_0xe62f('0x9'),'port':0x18eb});socketio[_0xe62f('0xa')](require(_0xe62f('0xb'))({'pubClient':new Redis(config[_0xe62f('0x8')]),'subClient':new Redis(config[_0xe62f('0x8')])}));require(_0xe62f('0xc'))[_0xe62f('0xd')]();require('../../config/socketio')[_0xe62f('0xd')](socketio);require(_0xe62f('0xe'))[_0xe62f('0xd')](app);require('../../routes')[_0xe62f('0xd')](app);}else{server[_0xe62f('0xf')](_0xe62f('0x10'),function(){console[_0xe62f('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe62f('0x12')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xbf7e=['listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0xbf7e,0x1b2));var _0xebf7=function(_0x3894ef,_0x461601){_0x3894ef=_0x3894ef-0x0;var _0x315ff6=_0xbf7e[_0x3894ef];return _0x315ff6;};'use strict';var _=require(_0xebf7('0x0'));var http=require(_0xebf7('0x1'));var express=require(_0xebf7('0x2'));var sticky=require(_0xebf7('0x3'));var Redis=require(_0xebf7('0x4'));var config=require(_0xebf7('0x5'));var app=express();var server=http[_0xebf7('0x6')](app);server[_0xebf7('0x7')]=0xdbba0;if(sticky[_0xebf7('0x8')](server,config[_0xebf7('0x9')])){var socketio=require(_0xebf7('0xa'))(server,{'transports':[_0xebf7('0xb'),_0xebf7('0xc')]});config[_0xebf7('0xd')]=_[_0xebf7('0xe')](config[_0xebf7('0xd')],{'host':_0xebf7('0xf'),'port':0x18eb});socketio[_0xebf7('0x10')](require(_0xebf7('0x11'))({'pubClient':new Redis(config[_0xebf7('0xd')]),'subClient':new Redis(config[_0xebf7('0xd')])}));require(_0xebf7('0x12'))[_0xebf7('0x13')]();require(_0xebf7('0x14'))[_0xebf7('0x13')](socketio);require(_0xebf7('0x15'))[_0xebf7('0x13')](app);require(_0xebf7('0x16'))['default'](app);}else{server[_0xebf7('0x17')](_0xebf7('0x18'),function(){console[_0xebf7('0x19')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xebf7('0x9')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a7bd7b8..374f285 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 _0x2814=['rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x72f47d,_0x573fca){var _0x4cfc6a=function(_0x592f07){while(--_0x592f07){_0x72f47d['push'](_0x72f47d['shift']());}};_0x4cfc6a(++_0x573fca);}(_0x2814,0x1aa));var _0x4281=function(_0x53ee1d,_0x12d490){_0x53ee1d=_0x53ee1d-0x0;var _0x58192e=_0x2814[_0x53ee1d];return _0x58192e;};'use strict';var jayson=require(_0x4281('0x0'));var BPromise=require(_0x4281('0x1'));var logger=require(_0x4281('0x2'))(_0x4281('0x3'));var client=jayson[_0x4281('0x4')][_0x4281('0x5')]({'port':0x2329});client[_0x4281('0x6')]=function(_0xb8f77d,_0x37a56a){return new BPromise(function(_0x22f861,_0x3c4b5b){return client[_0x4281('0x7')](_0xb8f77d,_0x37a56a)[_0x4281('0x8')](function(_0x3576fc){logger['debug'](_0x4281('0x9'),_0x4281('0x3'),_0xb8f77d,_0x37a56a,_0x3576fc);if(_0x3576fc[_0x4281('0xa')]){logger[_0x4281('0xa')](_0x4281('0x9'),_0x4281('0x3'),_0xb8f77d,_0x3576fc[_0x4281('0xa')]['message'],_0x37a56a);return _0x3c4b5b(_0x3576fc[_0x4281('0xa')][_0x4281('0xb')]);}else{return _0x22f861(_0x3576fc[_0x4281('0xc')]);}})[_0x4281('0xd')](function(_0x2c87ac){logger[_0x4281('0xa')](_0x4281('0x9'),'routing',_0xb8f77d,_0x2c87ac,_0x37a56a);return _0x3c4b5b(_0x2c87ac);});});};module[_0x4281('0xe')]=client; \ No newline at end of file +var _0x6e1d=['client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','routing'];(function(_0x2d18be,_0x583cc5){var _0x1780a2=function(_0x1023f3){while(--_0x1023f3){_0x2d18be['push'](_0x2d18be['shift']());}};_0x1780a2(++_0x583cc5);}(_0x6e1d,0x1a1));var _0xd6e1=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0x6e1d[_0x4d1ee9];return _0x9a5456;};'use strict';var jayson=require(_0xd6e1('0x0'));var BPromise=require(_0xd6e1('0x1'));var logger=require('../../config/logger')(_0xd6e1('0x2'));var client=jayson[_0xd6e1('0x3')][_0xd6e1('0x4')]({'port':0x2329});client[_0xd6e1('0x5')]=function(_0x2cb35c,_0x5a127a){return new BPromise(function(_0x1dbe2c,_0x1413e9){return client[_0xd6e1('0x6')](_0x2cb35c,_0x5a127a)[_0xd6e1('0x7')](function(_0x35d59e){logger[_0xd6e1('0x8')](_0xd6e1('0x9'),'routing',_0x2cb35c,_0x5a127a,_0x35d59e);if(_0x35d59e[_0xd6e1('0xa')]){logger['error'](_0xd6e1('0x9'),_0xd6e1('0x2'),_0x2cb35c,_0x35d59e[_0xd6e1('0xa')][_0xd6e1('0xb')],_0x5a127a);return _0x1413e9(_0x35d59e[_0xd6e1('0xa')][_0xd6e1('0xb')]);}else{return _0x1dbe2c(_0x35d59e[_0xd6e1('0xc')]);}})[_0xd6e1('0xd')](function(_0x5ae6b6){logger['error'](_0xd6e1('0x9'),_0xd6e1('0x2'),_0x2cb35c,_0x5ae6b6,_0x5a127a);return _0x1413e9(_0x5ae6b6);});});};module[_0xd6e1('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 9b80fa9..962acbf 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 _0xfabf=['./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','initFaxQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x16dce0,_0x241147){var _0x2f3a04=function(_0x17910e){while(--_0x17910e){_0x16dce0['push'](_0x16dce0['shift']());}};_0x2f3a04(++_0x241147);}(_0xfabf,0x7d));var _0xffab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfabf[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xffab('0x0'));var server=require(_0xffab('0x1'));var Realtime=require(_0xffab('0x2'));var user=require(_0xffab('0x3'));var interval=require(_0xffab('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xffab('0x5'));var smsQueue=require(_0xffab('0x6'));var mailQueue=require(_0xffab('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xffab('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xffab('0x9')]()[_0xffab('0xa')](user[_0xffab('0xb')]())['then'](realtime[_0xffab('0xc')]())['then'](interval['getIntervals']())['then'](realtime[_0xffab('0xd')]())[_0xffab('0xa')](openchannelQueue[_0xffab('0xe')]())['then'](realtime['initOpenchannelQueues']())[_0xffab('0xa')](chatQueue[_0xffab('0xf')]())[_0xffab('0xa')](realtime[_0xffab('0x10')]())['then'](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0xffab('0xa')](mailQueue[_0xffab('0x11')]())[_0xffab('0xa')](realtime[_0xffab('0x12')]())[_0xffab('0xa')](faxQueue['getFaxQueues']())[_0xffab('0xa')](realtime[_0xffab('0x13')]())['then'](whatsappQueue['getWhatsappQueues']())[_0xffab('0xa')](realtime['initWhatsappQueues']())[_0xffab('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x709b92){return initRealtime();})[_0xffab('0xa')](function(_0x50edf8){return setInterval(initRealtime,0x1388);})[_0xffab('0x14')](function(_0x7d35f2){console[_0xffab('0x15')](_0x7d35f2);});}main(); \ No newline at end of file +var _0xc8c4=['getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x52c312,_0x452c2e){var _0xb00357=function(_0x54ec5e){while(--_0x54ec5e){_0x52c312['push'](_0x52c312['shift']());}};_0xb00357(++_0x452c2e);}(_0xc8c4,0x1a6));var _0x4c8c=function(_0x7299bd,_0x543ab8){_0x7299bd=_0x7299bd-0x0;var _0x10052d=_0xc8c4[_0x7299bd];return _0x10052d;};'use strict';var BPromise=require('bluebird');var server=require(_0x4c8c('0x0'));var Realtime=require(_0x4c8c('0x1'));var user=require(_0x4c8c('0x2'));var interval=require(_0x4c8c('0x3'));var openchannelQueue=require(_0x4c8c('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x4c8c('0x5'));var mailQueue=require(_0x4c8c('0x6'));var faxQueue=require(_0x4c8c('0x7'));var whatsappQueue=require(_0x4c8c('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x4c8c('0x9')](user[_0x4c8c('0xa')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0xb')]())[_0x4c8c('0x9')](interval[_0x4c8c('0xc')]())[_0x4c8c('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x4c8c('0xd')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0xe')]())[_0x4c8c('0x9')](chatQueue[_0x4c8c('0xf')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0x10')]())[_0x4c8c('0x9')](smsQueue['getSmsQueues']())[_0x4c8c('0x9')](realtime[_0x4c8c('0x11')]())[_0x4c8c('0x9')](mailQueue[_0x4c8c('0x12')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0x13')]())[_0x4c8c('0x9')](faxQueue[_0x4c8c('0x14')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0x15')]())['then'](whatsappQueue[_0x4c8c('0x16')]())[_0x4c8c('0x9')](realtime[_0x4c8c('0x17')]())['then'](function(){return realtime;});}function main(){return server[_0x4c8c('0x18')](realtime)[_0x4c8c('0x9')](function(_0x16cfda){return initRealtime();})[_0x4c8c('0x9')](function(_0x5de621){return setInterval(initRealtime,0x1388);})['catch'](function(_0x2b22c5){console[_0x4c8c('0x19')](_0x2b22c5);});}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 fbd726c..b47a495 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 _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2ab514,_0x55e9c3){var _0x44deb9=function(_0x50a679){while(--_0x50a679){_0x2ab514['push'](_0x2ab514['shift']());}};_0x44deb9(++_0x55e9c3);}(_0x7a54,0x106));var _0x47a5=function(_0x11d3c9,_0x3f9e35){_0x11d3c9=_0x11d3c9-0x0;var _0x52f19a=_0x7a54[_0x11d3c9];return _0x52f19a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5b36ca,_0x209a69){var _0xffb46e=function(_0x27aabd){while(--_0x27aabd){_0x5b36ca['push'](_0x5b36ca['shift']());}};_0xffb46e(++_0x209a69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3ec1707..62cfc20 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 _0xb65f=['http','request','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x1f2104,_0x3d1a56){var _0x590031=function(_0x16e37d){while(--_0x16e37d){_0x1f2104['push'](_0x1f2104['shift']());}};_0x590031(++_0x3d1a56);}(_0xb65f,0xcf));var _0xfb65=function(_0x42d33b,_0x107611){_0x42d33b=_0x42d33b-0x0;var _0x304c5c=_0xb65f[_0x42d33b];return _0x304c5c;};'use strict';var BPromise=require(_0xfb65('0x0'));var jayson=require(_0xfb65('0x1'));var client=jayson[_0xfb65('0x2')][_0xfb65('0x3')]({'port':0x232b});function request(_0x3f0012,_0x19507f){return new BPromise(function(_0x4d7afc,_0x58c606){return client[_0xfb65('0x4')](_0x3f0012,_0x19507f)['then'](function(_0x5b90cd){if(_0x5b90cd['error']){return _0x58c606(_0x5b90cd[_0xfb65('0x5')][_0xfb65('0x6')]);}else{return _0x4d7afc(_0x5b90cd[_0xfb65('0x7')]);}})[_0xfb65('0x8')](function(_0x97c9c9){return _0x58c606(_0x97c9c9);});});}exports[_0xfb65('0x9')]=function(_0x568c2a,_0x36f8a7){return request('SendMail',{'account':_0x568c2a,'message':_0x36f8a7});}; \ No newline at end of file +var _0x7a3c=['jayson/promise','client','request','then','error','result','sendMailMessage','SendMail'];(function(_0x10580f,_0x47e4ab){var _0x515db6=function(_0x23d159){while(--_0x23d159){_0x10580f['push'](_0x10580f['shift']());}};_0x515db6(++_0x47e4ab);}(_0x7a3c,0x1e0));var _0xc7a3=function(_0x3c46dd,_0x37756d){_0x3c46dd=_0x3c46dd-0x0;var _0x4d0a8d=_0x7a3c[_0x3c46dd];return _0x4d0a8d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xc7a3('0x0'));var client=jayson[_0xc7a3('0x1')]['http']({'port':0x232b});function request(_0x20419b,_0x431433){return new BPromise(function(_0x19a9bb,_0x216d3b){return client[_0xc7a3('0x2')](_0x20419b,_0x431433)[_0xc7a3('0x3')](function(_0x1d0872){if(_0x1d0872[_0xc7a3('0x4')]){return _0x216d3b(_0x1d0872[_0xc7a3('0x4')]['message']);}else{return _0x19a9bb(_0x1d0872[_0xc7a3('0x5')]);}})['catch'](function(_0x3655ff){return _0x216d3b(_0x3655ff);});});}exports[_0xc7a3('0x6')]=function(_0x179b0a,_0x5165df){return request(_0xc7a3('0x7'),{'account':_0x179b0a,'message':_0x5165df});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 36b87ae..09836ed 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 _0xeb3b=['mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','openchannel','sms','whatsapp','length','StatusTime','toNumber','chatStatus','mailStatusTime','mailCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappCurrentCapacity','openchannelCapacity','busy','smsWaitingInteractions','stringify','emit','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus'];(function(_0x10def4,_0x4cc347){var _0x4f7382=function(_0x33b437){while(--_0x33b437){_0x10def4['push'](_0x10def4['shift']());}};_0x4f7382(++_0x4cc347);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2dfd28,_0x153b3c){_0x2dfd28=_0x2dfd28-0x0;var _0x49c016=_0xeb3b[_0x2dfd28];return _0x49c016;};'use strict';var _=require(_0xbeb3('0x0'));var md5=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var Redis=require(_0xbeb3('0x3'));var config=require(_0xbeb3('0x4'));config['redis']=_['defaults'](config[_0xbeb3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbeb3('0x6'))(new Redis(config['redis']));function Agent(_0x2e8a69){this['id']=_0x2e8a69['id']||0x0;this[_0xbeb3('0x7')]=_0x2e8a69[_0xbeb3('0x7')]||'';this[_0xbeb3('0x8')]=_0x2e8a69[_0xbeb3('0x8')]||!![];this[_0xbeb3('0x9')]=_0x2e8a69['voicePause']||![];this[_0xbeb3('0xa')]=_0x2e8a69[_0xbeb3('0xa')]||![];this[_0xbeb3('0xb')]=_0x2e8a69[_0xbeb3('0xb')]||![];this[_0xbeb3('0xc')]=_0x2e8a69[_0xbeb3('0xc')]||![];this[_0xbeb3('0xd')]=_0x2e8a69['smsPause']||![];this[_0xbeb3('0xe')]=_0x2e8a69[_0xbeb3('0xe')]||![];this['chatStatus']=_0xbeb3('0xf');this[_0xbeb3('0x10')]=0x0;this[_0xbeb3('0x11')]=_0x2e8a69[_0xbeb3('0x11')]||0x0;this[_0xbeb3('0x12')]=0x0;this[_0xbeb3('0x13')]='unknown';this['mailStatusTime']=0x0;this[_0xbeb3('0x14')]=_0x2e8a69[_0xbeb3('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xbeb3('0xf');this[_0xbeb3('0x15')]=0x0;this[_0xbeb3('0x16')]=_0x2e8a69[_0xbeb3('0x16')]||0x0;this[_0xbeb3('0x17')]=0x0;this['smsStatus']=_0xbeb3('0xf');this['smsStatusTime']=0x0;this[_0xbeb3('0x18')]=_0x2e8a69['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xbeb3('0xf');this[_0xbeb3('0x19')]=0x0;this[_0xbeb3('0x1a')]=_0x2e8a69[_0xbeb3('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xbeb3('0x1b')]=_0xbeb3('0xf');this[_0xbeb3('0x1c')]=0x0;this['openchannelCapacity']=_0x2e8a69['openchannelCapacity']||0x0;this[_0xbeb3('0x1d')]=0x0;this['busy']=![];this[_0xbeb3('0x1e')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0xbeb3('0x1f')]={};this[_0xbeb3('0x20')]={};this[_0xbeb3('0x21')]={};this['smsWaitingInteractions']={};this[_0xbeb3('0x22')]={};this[_0xbeb3('0x23')]();}Agent['prototype'][_0xbeb3('0x24')]=function(_0x366bdb){if(this[_0x366bdb+'CurrentCapacity']>0x0){if(this[_0x366bdb+_0xbeb3('0x25')]>0x0&&this[_0x366bdb+_0xbeb3('0x26')]>=this[_0x366bdb+_0xbeb3('0x25')]){return _0xbeb3('0x27');}else{return _0xbeb3('0x28');}}else{return _0xbeb3('0x29');}};Agent[_0xbeb3('0x2a')][_0xbeb3('0x23')]=function(){var _0x46fe17=['mail','chat',_0xbeb3('0x2b'),'fax',_0xbeb3('0x2c'),_0xbeb3('0x2d')];for(var _0x138adf=0x0;_0x138adf<_0x46fe17[_0xbeb3('0x2e')];_0x138adf+=0x1){var _0x4fa3c7=this[_0xbeb3('0x24')](_0x46fe17[_0x138adf]);if(this[_0x46fe17[_0x138adf]+'Status']!==_0x4fa3c7){this[_0x46fe17[_0x138adf]+_0xbeb3('0x2f')]=_[_0xbeb3('0x30')](moment()['format']('x'));}this[_0x46fe17[_0x138adf]+'Status']=_0x4fa3c7;}var _0x9b8f13={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xbeb3('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xbeb3('0xc')],'openchannelPause':this[_0xbeb3('0xe')],'chatStatus':this[_0xbeb3('0x31')],'chatStatusTime':this[_0xbeb3('0x10')],'chatCapacity':this[_0xbeb3('0x11')],'chatCurrentCapacity':this[_0xbeb3('0x12')],'mailStatus':this[_0xbeb3('0x13')],'mailStatusTime':this[_0xbeb3('0x32')],'mailCapacity':this[_0xbeb3('0x14')],'mailCurrentCapacity':this[_0xbeb3('0x33')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xbeb3('0x15')],'faxCapacity':this[_0xbeb3('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xbeb3('0x34')],'smsStatusTime':this[_0xbeb3('0x35')],'smsCapacity':this[_0xbeb3('0x18')],'smsCurrentCapacity':this[_0xbeb3('0x36')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xbeb3('0x19')],'whatsappCapacity':this[_0xbeb3('0x1a')],'whatsappCurrentCapacity':this[_0xbeb3('0x37')],'openchannelStatus':this[_0xbeb3('0x1b')],'openchannelStatusTime':this[_0xbeb3('0x1c')],'openchannelCapacity':this[_0xbeb3('0x38')],'openchannelCurrentCapacity':this[_0xbeb3('0x1d')],'busy':this[_0xbeb3('0x39')],'busyQueue':this[_0xbeb3('0x1e')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xbeb3('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xbeb3('0x21')],'smsWaitingInteractions':this[_0xbeb3('0x3a')],'whatsappWaitingInteractions':this[_0xbeb3('0x22')]};var _0xaacc67=md5(JSON[_0xbeb3('0x3b')](_0x9b8f13));if(this[_0xbeb3('0x1')]!==_0xaacc67){this[_0xbeb3('0x1')]=_0xaacc67;io[_0xbeb3('0x3c')]('user:routing:update',_[_0xbeb3('0x3d')](_0x9b8f13,['online']));}};module['exports']=Agent; \ No newline at end of file +var _0xd824=['defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','whatsapp','Status','StatusTime','format','mailPause','chatCapacity','whatsappCurrentCapacity','mailWaitingInteractions','whatsappWaitingInteractions','stringify','emit','omit','exports','lodash','md5','../../../config/environment','redis'];(function(_0x2ab8ce,_0xebb423){var _0xa501a=function(_0x24987b){while(--_0x24987b){_0x2ab8ce['push'](_0x2ab8ce['shift']());}};_0xa501a(++_0xebb423);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4d82('0x0'));var md5=require(_0x4d82('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x4d82('0x2'));config[_0x4d82('0x3')]=_[_0x4d82('0x4')](config[_0x4d82('0x3')],{'host':_0x4d82('0x5'),'port':0x18eb});var io=require(_0x4d82('0x6'))(new Redis(config['redis']));function Agent(_0x57850a){this['id']=_0x57850a['id']||0x0;this[_0x4d82('0x7')]=_0x57850a['name']||'';this['online']=_0x57850a[_0x4d82('0x8')]||!![];this[_0x4d82('0x9')]=_0x57850a[_0x4d82('0x9')]||![];this['chatPause']=_0x57850a[_0x4d82('0xa')]||![];this['mailPause']=_0x57850a['mailPause']||![];this[_0x4d82('0xb')]=_0x57850a[_0x4d82('0xb')]||![];this[_0x4d82('0xc')]=_0x57850a['smsPause']||![];this[_0x4d82('0xd')]=_0x57850a['openchannelPause']||![];this[_0x4d82('0xe')]=_0x4d82('0xf');this[_0x4d82('0x10')]=0x0;this['chatCapacity']=_0x57850a['chatCapacity']||0x0;this[_0x4d82('0x11')]=0x0;this[_0x4d82('0x12')]=_0x4d82('0xf');this[_0x4d82('0x13')]=0x0;this['mailCapacity']=_0x57850a[_0x4d82('0x14')]||0x0;this[_0x4d82('0x15')]=0x0;this[_0x4d82('0x16')]='unknown';this[_0x4d82('0x17')]=0x0;this['faxCapacity']=_0x57850a[_0x4d82('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x4d82('0x19')]='unknown';this[_0x4d82('0x1a')]=0x0;this[_0x4d82('0x1b')]=_0x57850a[_0x4d82('0x1b')]||0x0;this[_0x4d82('0x1c')]=0x0;this[_0x4d82('0x1d')]=_0x4d82('0xf');this[_0x4d82('0x1e')]=0x0;this[_0x4d82('0x1f')]=_0x57850a[_0x4d82('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x4d82('0x20')]=_0x4d82('0xf');this[_0x4d82('0x21')]=0x0;this[_0x4d82('0x22')]=_0x57850a[_0x4d82('0x22')]||0x0;this[_0x4d82('0x23')]=0x0;this[_0x4d82('0x24')]=![];this[_0x4d82('0x25')]=undefined;this[_0x4d82('0x1')]='';this[_0x4d82('0x26')]={};this[_0x4d82('0x27')]={};this['mailWaitingInteractions']={};this[_0x4d82('0x28')]={};this[_0x4d82('0x29')]={};this['whatsappWaitingInteractions']={};this[_0x4d82('0x2a')]();}Agent[_0x4d82('0x2b')][_0x4d82('0x2c')]=function(_0x14a2d4){if(this[_0x14a2d4+_0x4d82('0x2d')]>0x0){if(this[_0x14a2d4+_0x4d82('0x2e')]>0x0&&this[_0x14a2d4+_0x4d82('0x2d')]>=this[_0x14a2d4+_0x4d82('0x2e')]){return _0x4d82('0x2f');}else{return _0x4d82('0x30');}}else{return _0x4d82('0x31');}};Agent[_0x4d82('0x2b')][_0x4d82('0x2a')]=function(){var _0x284c66=[_0x4d82('0x32'),'chat','openchannel',_0x4d82('0x33'),_0x4d82('0x34'),_0x4d82('0x35')];for(var _0x3348d9=0x0;_0x3348d9<_0x284c66['length'];_0x3348d9+=0x1){var _0x19d3a9=this[_0x4d82('0x2c')](_0x284c66[_0x3348d9]);if(this[_0x284c66[_0x3348d9]+_0x4d82('0x36')]!==_0x19d3a9){this[_0x284c66[_0x3348d9]+_0x4d82('0x37')]=_['toNumber'](moment()[_0x4d82('0x38')]('x'));}this[_0x284c66[_0x3348d9]+'Status']=_0x19d3a9;}var _0x4d9ac4={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x4d82('0x9')],'chatPause':this[_0x4d82('0xa')],'mailPause':this[_0x4d82('0x39')],'smsPause':this['smsPause'],'faxPause':this[_0x4d82('0xb')],'openchannelPause':this[_0x4d82('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4d82('0x3a')],'chatCurrentCapacity':this[_0x4d82('0x11')],'mailStatus':this[_0x4d82('0x12')],'mailStatusTime':this[_0x4d82('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x4d82('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4d82('0x17')],'faxCapacity':this[_0x4d82('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x4d82('0x1a')],'smsCapacity':this[_0x4d82('0x1b')],'smsCurrentCapacity':this[_0x4d82('0x1c')],'whatsappStatus':this[_0x4d82('0x1d')],'whatsappStatusTime':this[_0x4d82('0x1e')],'whatsappCapacity':this[_0x4d82('0x1f')],'whatsappCurrentCapacity':this[_0x4d82('0x3b')],'openchannelStatus':this[_0x4d82('0x20')],'openchannelStatusTime':this[_0x4d82('0x21')],'openchannelCapacity':this[_0x4d82('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x4d82('0x24')],'busyQueue':this[_0x4d82('0x25')],'chatWaitingInteractions':this[_0x4d82('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x4d82('0x3c')],'openchannelWaitingInteractions':this[_0x4d82('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x4d82('0x3d')]};var _0x11d8c3=md5(JSON[_0x4d82('0x3e')](_0x4d9ac4));if(this['md5']!==_0x11d8c3){this[_0x4d82('0x1')]=_0x11d8c3;io[_0x4d82('0x3f')]('user:routing:update',_[_0x4d82('0x40')](_0x4d9ac4,['online']));}};module[_0x4d82('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 704fcbf..041e271 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 _0xdf33=['loggedIn','paused','length','online','chatPause','available','stringify','emit','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x2b8682,_0x2492fe){var _0x51ae26=function(_0x1dd294){while(--_0x1dd294){_0x2b8682['push'](_0x2b8682['shift']());}};_0x51ae26(++_0x2492fe);}(_0xdf33,0x183));var _0x3df3=function(_0x15e42e,_0x2c4612){_0x15e42e=_0x15e42e-0x0;var _0x128ba7=_0xdf33[_0x15e42e];return _0x128ba7;};'use strict';var _=require(_0x3df3('0x0'));var md5=require(_0x3df3('0x1'));var util=require('util');var Redis=require(_0x3df3('0x2'));var config=require(_0x3df3('0x3'));config['redis']=_[_0x3df3('0x4')](config['redis'],{'host':_0x3df3('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0xc635c9){this['id']=_0xc635c9['id']||0x0;this[_0x3df3('0x6')]=_0xc635c9[_0x3df3('0x6')]||'';this[_0x3df3('0x7')]=_0xc635c9[_0x3df3('0x7')]||0xa;this[_0x3df3('0x8')]=_0xc635c9[_0x3df3('0x8')]||_0x3df3('0x9');this[_0x3df3('0xa')]=_0xc635c9[_0x3df3('0xa')];this[_0x3df3('0xb')]={};this[_0x3df3('0xc')]=0x0;this[_0x3df3('0x1')]='';this[_0x3df3('0xd')]();this[_0x3df3('0xe')]();}ChatQueue[_0x3df3('0xf')][_0x3df3('0xd')]=function(){var _0x17887c=this['mapAgentsId'][_0x3df3('0x10')];this[_0x3df3('0xb')]=_[_0x3df3('0x11')](this[_0x3df3('0xa')],'id');this[_0x3df3('0xb')]['_rr']=_0x17887c;};ChatQueue[_0x3df3('0xf')]['updateRealtime']=function(){this[_0x3df3('0x12')]=0x0;this[_0x3df3('0x13')]=0x0;for(var _0x487939=0x0;_0x487939=0x0?this['available']:0x0;var _0x255528={'id':this['id'],'available':this[_0x3df3('0x17')],'loggedIn':this[_0x3df3('0x12')],'name':this[_0x3df3('0x6')],'paused':this['paused'],'waiting':this[_0x3df3('0xc')]};var _0x2caa7d=md5(JSON[_0x3df3('0x18')](_0x255528));if(this[_0x3df3('0x1')]!==_0x2caa7d){this[_0x3df3('0x1')]=_0x2caa7d;io['to'](util['format']('chat:queue:%s',_0x255528[_0x3df3('0x6')]))[_0x3df3('0x19')]('chat_queue:save',_0x255528);}};module[_0x3df3('0x1a')]=ChatQueue; \ No newline at end of file +var _0x9d78=['socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','updateRouting','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d78,0xd3));var _0x89d7=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x9d78[_0x91384];return _0x44daa0;};'use strict';var _=require(_0x89d7('0x0'));var md5=require('md5');var util=require(_0x89d7('0x1'));var Redis=require('ioredis');var config=require(_0x89d7('0x2'));config[_0x89d7('0x3')]=_[_0x89d7('0x4')](config['redis'],{'host':_0x89d7('0x5'),'port':0x18eb});var io=require(_0x89d7('0x6'))(new Redis(config[_0x89d7('0x3')]));function ChatQueue(_0x55e2d2){this['id']=_0x55e2d2['id']||0x0;this[_0x89d7('0x7')]=_0x55e2d2['name']||'';this[_0x89d7('0x8')]=_0x55e2d2['timeout']||0xa;this[_0x89d7('0x9')]=_0x55e2d2[_0x89d7('0x9')]||_0x89d7('0xa');this[_0x89d7('0xb')]=_0x55e2d2[_0x89d7('0xb')];this['mapAgentsId']={};this[_0x89d7('0xc')]=0x0;this[_0x89d7('0xd')]='';this['updateRouting']();this[_0x89d7('0xe')]();}ChatQueue['prototype'][_0x89d7('0xf')]=function(){var _0x40b0a8=this[_0x89d7('0x10')]['_rr'];this[_0x89d7('0x10')]=_[_0x89d7('0x11')](this[_0x89d7('0xb')],'id');this['mapAgentsId'][_0x89d7('0x12')]=_0x40b0a8;};ChatQueue[_0x89d7('0x13')]['updateRealtime']=function(){this[_0x89d7('0x14')]=0x0;this[_0x89d7('0x15')]=0x0;for(var _0x304d0f=0x0;_0x304d0f=0x0?this[_0x89d7('0x19')]:0x0;var _0x5decf6={'id':this['id'],'available':this[_0x89d7('0x19')],'loggedIn':this[_0x89d7('0x14')],'name':this['name'],'paused':this[_0x89d7('0x15')],'waiting':this[_0x89d7('0xc')]};var _0x3f464f=md5(JSON[_0x89d7('0x1a')](_0x5decf6));if(this[_0x89d7('0xd')]!==_0x3f464f){this[_0x89d7('0xd')]=_0x3f464f;io['to'](util[_0x89d7('0x1b')](_0x89d7('0x1c'),_0x5decf6[_0x89d7('0x7')]))[_0x89d7('0x1d')](_0x89d7('0x1e'),_0x5decf6);}};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 3a7df13..f48eb02 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 _0x6564=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','md5','../../../config/environment','redis'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x6564,0x169));var _0x4656=function(_0x446de8,_0x25d27d){_0x446de8=_0x446de8-0x0;var _0x219cd7=_0x6564[_0x446de8];return _0x219cd7;};'use strict';var _=require('lodash');var md5=require(_0x4656('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4656('0x1'));config[_0x4656('0x2')]=_[_0x4656('0x3')](config[_0x4656('0x2')],{'host':_0x4656('0x4'),'port':0x18eb});var io=require(_0x4656('0x5'))(new Redis(config[_0x4656('0x2')]));function FaxQueue(_0xbcf9a6){this['id']=_0xbcf9a6['id']||0x0;this[_0x4656('0x6')]=_0xbcf9a6[_0x4656('0x6')]||'';this['timeout']=_0xbcf9a6[_0x4656('0x7')]||0xa;this['strategy']=_0xbcf9a6[_0x4656('0x8')]||'beepall';this[_0x4656('0x9')]=_0xbcf9a6[_0x4656('0x9')];this['mapAgentsId']={};this[_0x4656('0xa')]=0x0;this[_0x4656('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x4656('0xb')][_0x4656('0xc')]=function(){var _0x532b5a=this[_0x4656('0xd')][_0x4656('0xe')];this['mapAgentsId']=_['map'](this[_0x4656('0x9')],'id');this['mapAgentsId'][_0x4656('0xe')]=_0x532b5a;};FaxQueue[_0x4656('0xb')][_0x4656('0xf')]=function(){this[_0x4656('0x10')]=0x0;this[_0x4656('0x11')]=0x0;for(var _0x466f49=0x0;_0x466f49=0x0?this[_0x4656('0x14')]:0x0;var _0x384fcb={'id':this['id'],'available':this[_0x4656('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x4656('0x11')],'waiting':this[_0x4656('0xa')]};var _0x5dfd75=md5(JSON['stringify'](_0x384fcb));if(this[_0x4656('0x0')]!==_0x5dfd75){this['md5']=_0x5dfd75;io['to'](util[_0x4656('0x15')](_0x4656('0x16'),_0x384fcb['name']))[_0x4656('0x17')](_0x4656('0x18'),_0x384fcb);}};module[_0x4656('0x19')]=FaxQueue; \ No newline at end of file +var _0xc6ec=['md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','exports','lodash'];(function(_0x38f51f,_0x3f80f5){var _0x1216dd=function(_0x3e298c){while(--_0x3e298c){_0x38f51f['push'](_0x38f51f['shift']());}};_0x1216dd(++_0x3f80f5);}(_0xc6ec,0xe7));var _0xcc6e=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0xc6ec[_0xe896bf];return _0x4c7a8a;};'use strict';var _=require(_0xcc6e('0x0'));var md5=require(_0xcc6e('0x1'));var util=require(_0xcc6e('0x2'));var Redis=require(_0xcc6e('0x3'));var config=require('../../../config/environment');config[_0xcc6e('0x4')]=_[_0xcc6e('0x5')](config['redis'],{'host':_0xcc6e('0x6'),'port':0x18eb});var io=require(_0xcc6e('0x7'))(new Redis(config[_0xcc6e('0x4')]));function FaxQueue(_0x1b662a){this['id']=_0x1b662a['id']||0x0;this[_0xcc6e('0x8')]=_0x1b662a[_0xcc6e('0x8')]||'';this[_0xcc6e('0x9')]=_0x1b662a['timeout']||0xa;this['strategy']=_0x1b662a[_0xcc6e('0xa')]||_0xcc6e('0xb');this[_0xcc6e('0xc')]=_0x1b662a[_0xcc6e('0xc')];this[_0xcc6e('0xd')]={};this[_0xcc6e('0xe')]=0x0;this[_0xcc6e('0x1')]='';this['updateRouting']();this[_0xcc6e('0xf')]();}FaxQueue[_0xcc6e('0x10')]['updateRouting']=function(){var _0x4bb6e1=this['mapAgentsId'][_0xcc6e('0x11')];this[_0xcc6e('0xd')]=_[_0xcc6e('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xcc6e('0x11')]=_0x4bb6e1;};FaxQueue['prototype'][_0xcc6e('0xf')]=function(){this[_0xcc6e('0x13')]=0x0;this[_0xcc6e('0x14')]=0x0;for(var _0x205162=0x0;_0x205162=0x0?this[_0xcc6e('0x18')]:0x0;var _0x1a9654={'id':this['id'],'available':this[_0xcc6e('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xcc6e('0x8')],'paused':this['paused'],'waiting':this[_0xcc6e('0xe')]};var _0x54e368=md5(JSON[_0xcc6e('0x19')](_0x1a9654));if(this[_0xcc6e('0x1')]!==_0x54e368){this['md5']=_0x54e368;io['to'](util[_0xcc6e('0x1a')](_0xcc6e('0x1b'),_0x1a9654['name']))['emit']('fax_queue:save',_0x1a9654);}};module[_0xcc6e('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 552d395..e42c20f 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 _0x53b8=['Intervals','exports','name'];(function(_0x4ee0e9,_0x2ff82a){var _0x2605ff=function(_0x4d4194){while(--_0x4d4194){_0x4ee0e9['push'](_0x4ee0e9['shift']());}};_0x2605ff(++_0x2ff82a);}(_0x53b8,0x1f1));var _0x853b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53b8[_0xfae23b];return _0x200640;};'use strict';function Interval(_0x2d57a0){this['id']=_0x2d57a0['id']||0x0;this['name']=_0x2d57a0[_0x853b('0x0')]||'';this['Intervals']=_0x2d57a0[_0x853b('0x1')]||{};}module[_0x853b('0x2')]=Interval; \ No newline at end of file +var _0xb67c=['exports','name','Intervals'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb67c,0xcd));var _0xcb67=function(_0x466a1a,_0x37933b){_0x466a1a=_0x466a1a-0x0;var _0x577165=_0xb67c[_0x466a1a];return _0x577165;};'use strict';function Interval(_0x35c548){this['id']=_0x35c548['id']||0x0;this[_0xcb67('0x0')]=_0x35c548[_0xcb67('0x0')]||'';this[_0xcb67('0x1')]=_0x35c548[_0xcb67('0x1')]||{};}module[_0xcb67('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 d4d31c2..94202ae 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 _0x1815=['mailPause','available','stringify','emit','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','map','loggedIn','paused','length'];(function(_0x5d2926,_0x14ebd6){var _0x117a63=function(_0x2309da){while(--_0x2309da){_0x5d2926['push'](_0x5d2926['shift']());}};_0x117a63(++_0x14ebd6);}(_0x1815,0x9a));var _0x5181=function(_0xc06638,_0x68dc26){_0xc06638=_0xc06638-0x0;var _0x34e96c=_0x1815[_0xc06638];return _0x34e96c;};'use strict';var _=require(_0x5181('0x0'));var md5=require(_0x5181('0x1'));var util=require(_0x5181('0x2'));var Redis=require(_0x5181('0x3'));var config=require(_0x5181('0x4'));config[_0x5181('0x5')]=_['defaults'](config[_0x5181('0x5')],{'host':_0x5181('0x6'),'port':0x18eb});var io=require(_0x5181('0x7'))(new Redis(config[_0x5181('0x5')]));function MailQueue(_0x60ef7c){this['id']=_0x60ef7c['id']||0x0;this[_0x5181('0x8')]=_0x60ef7c[_0x5181('0x8')]||'';this[_0x5181('0x9')]=_0x60ef7c[_0x5181('0x9')]||0xa;this[_0x5181('0xa')]=_0x60ef7c[_0x5181('0xa')]||_0x5181('0xb');this['Agents']=_0x60ef7c[_0x5181('0xc')];this['mapAgentsId']={};this[_0x5181('0xd')]=0x0;this[_0x5181('0x1')]='';this[_0x5181('0xe')]();this[_0x5181('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x5743ad=this[_0x5181('0x10')]['_rr'];this[_0x5181('0x10')]=_[_0x5181('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x5743ad;};MailQueue['prototype'][_0x5181('0xf')]=function(){this[_0x5181('0x12')]=0x0;this[_0x5181('0x13')]=0x0;for(var _0x4b8391=0x0;_0x4b8391=0x0?this[_0x5181('0x16')]:0x0;var _0x373e57={'id':this['id'],'available':this[_0x5181('0x16')],'loggedIn':this[_0x5181('0x12')],'name':this[_0x5181('0x8')],'paused':this[_0x5181('0x13')],'waiting':this[_0x5181('0xd')]};var _0x452fbc=md5(JSON[_0x5181('0x17')](_0x373e57));if(this[_0x5181('0x1')]!==_0x452fbc){this[_0x5181('0x1')]=_0x452fbc;io['to'](util['format']('mail:queue:%s',_0x373e57[_0x5181('0x8')]))[_0x5181('0x18')]('mail_queue:save',_0x373e57);}};module['exports']=MailQueue; \ No newline at end of file +var _0x13da=['paused','available','waiting','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','mailPause'];(function(_0x3dc8f9,_0x373910){var _0x13319a=function(_0x3ae41d){while(--_0x3ae41d){_0x3dc8f9['push'](_0x3dc8f9['shift']());}};_0x13319a(++_0x373910);}(_0x13da,0x1e8));var _0xa13d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x13da[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa13d('0x0'));var md5=require(_0xa13d('0x1'));var util=require(_0xa13d('0x2'));var Redis=require(_0xa13d('0x3'));var config=require(_0xa13d('0x4'));config[_0xa13d('0x5')]=_['defaults'](config['redis'],{'host':_0xa13d('0x6'),'port':0x18eb});var io=require(_0xa13d('0x7'))(new Redis(config[_0xa13d('0x5')]));function MailQueue(_0xc95594){this['id']=_0xc95594['id']||0x0;this[_0xa13d('0x8')]=_0xc95594['name']||'';this[_0xa13d('0x9')]=_0xc95594[_0xa13d('0x9')]||0xa;this[_0xa13d('0xa')]=_0xc95594[_0xa13d('0xa')]||_0xa13d('0xb');this[_0xa13d('0xc')]=_0xc95594['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa13d('0x1')]='';this[_0xa13d('0xd')]();this[_0xa13d('0xe')]();}MailQueue[_0xa13d('0xf')][_0xa13d('0xd')]=function(){var _0x4d43f6=this[_0xa13d('0x10')][_0xa13d('0x11')];this[_0xa13d('0x10')]=_[_0xa13d('0x12')](this[_0xa13d('0xc')],'id');this[_0xa13d('0x10')][_0xa13d('0x11')]=_0x4d43f6;};MailQueue[_0xa13d('0xf')][_0xa13d('0xe')]=function(){this[_0xa13d('0x13')]=0x0;this['paused']=0x0;for(var _0x500b09=0x0;_0x500b09=0x0?this[_0xa13d('0x17')]:0x0;var _0x2a9b24={'id':this['id'],'available':this[_0xa13d('0x17')],'loggedIn':this[_0xa13d('0x13')],'name':this[_0xa13d('0x8')],'paused':this['paused'],'waiting':this[_0xa13d('0x18')]};var _0x3035f6=md5(JSON[_0xa13d('0x19')](_0x2a9b24));if(this[_0xa13d('0x1')]!==_0x3035f6){this[_0xa13d('0x1')]=_0x3035f6;io['to'](util[_0xa13d('0x1a')](_0xa13d('0x1b'),_0x2a9b24[_0xa13d('0x8')]))['emit'](_0xa13d('0x1c'),_0x2a9b24);}};module[_0xa13d('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index fd2556f..035e7d3 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x15a11b,_0x3a1948){var _0x4b2487=function(_0x20c9ec){while(--_0x20c9ec){_0x15a11b['push'](_0x15a11b['shift']());}};_0x4b2487(++_0x3a1948);}(_0x814b,0x1a2));var _0xb814=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x814b[_0x4b6507];return _0x2001ec;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _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(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ac75a1a..faea562 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 _0x097c=['map','length','online','paused','loggedIn','available','format','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x097c,0x1d5));var _0xc097=function(_0x2320fb,_0x1fe38b){_0x2320fb=_0x2320fb-0x0;var _0x5189de=_0x097c[_0x2320fb];return _0x5189de;};'use strict';var _=require(_0xc097('0x0'));var md5=require(_0xc097('0x1'));var util=require(_0xc097('0x2'));var Redis=require('ioredis');var config=require(_0xc097('0x3'));config[_0xc097('0x4')]=_[_0xc097('0x5')](config[_0xc097('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc097('0x6'))(new Redis(config['redis']));function SmsQueue(_0x22fe81){this['id']=_0x22fe81['id']||0x0;this[_0xc097('0x7')]=_0x22fe81[_0xc097('0x7')]||'';this[_0xc097('0x8')]=_0x22fe81['timeout']||0xa;this[_0xc097('0x9')]=_0x22fe81['strategy']||'beepall';this[_0xc097('0xa')]=_0x22fe81[_0xc097('0xa')];this[_0xc097('0xb')]={};this[_0xc097('0xc')]=0x0;this[_0xc097('0x1')]='';this[_0xc097('0xd')]();this[_0xc097('0xe')]();}SmsQueue[_0xc097('0xf')][_0xc097('0xd')]=function(){var _0x48c376=this[_0xc097('0xb')][_0xc097('0x10')];this['mapAgentsId']=_[_0xc097('0x11')](this[_0xc097('0xa')],'id');this[_0xc097('0xb')][_0xc097('0x10')]=_0x48c376;};SmsQueue[_0xc097('0xf')][_0xc097('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x42fd3a=0x0;_0x42fd3a=0x0?this[_0xc097('0x16')]:0x0;var _0x560cbb={'id':this['id'],'available':this[_0xc097('0x16')],'loggedIn':this[_0xc097('0x15')],'name':this[_0xc097('0x7')],'paused':this[_0xc097('0x14')],'waiting':this['waiting']};var _0x38da65=md5(JSON['stringify'](_0x560cbb));if(this['md5']!==_0x38da65){this['md5']=_0x38da65;io['to'](util[_0xc097('0x17')]('sms:queue:%s',_0x560cbb['name']))[_0xc097('0x18')](_0xc097('0x19'),_0x560cbb);}};module[_0xc097('0x1a')]=SmsQueue; \ No newline at end of file +var _0xd52a=['stringify','format','name','emit','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','paused','length','online','smsPause','available'];(function(_0x28f34b,_0x291397){var _0x487bee=function(_0x42057c){while(--_0x42057c){_0x28f34b['push'](_0x28f34b['shift']());}};_0x487bee(++_0x291397);}(_0xd52a,0xca));var _0xad52=function(_0x9fd1d1,_0x1529a2){_0x9fd1d1=_0x9fd1d1-0x0;var _0x28079e=_0xd52a[_0x9fd1d1];return _0x28079e;};'use strict';var _=require('lodash');var md5=require(_0xad52('0x0'));var util=require('util');var Redis=require(_0xad52('0x1'));var config=require(_0xad52('0x2'));config[_0xad52('0x3')]=_['defaults'](config[_0xad52('0x3')],{'host':_0xad52('0x4'),'port':0x18eb});var io=require(_0xad52('0x5'))(new Redis(config[_0xad52('0x3')]));function SmsQueue(_0x4ed1e9){this['id']=_0x4ed1e9['id']||0x0;this['name']=_0x4ed1e9['name']||'';this[_0xad52('0x6')]=_0x4ed1e9['timeout']||0xa;this[_0xad52('0x7')]=_0x4ed1e9['strategy']||_0xad52('0x8');this[_0xad52('0x9')]=_0x4ed1e9['Agents'];this[_0xad52('0xa')]={};this['waiting']=0x0;this[_0xad52('0x0')]='';this['updateRouting']();this[_0xad52('0xb')]();}SmsQueue[_0xad52('0xc')][_0xad52('0xd')]=function(){var _0x119cdc=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0xad52('0xe')](this[_0xad52('0x9')],'id');this[_0xad52('0xa')][_0xad52('0xf')]=_0x119cdc;};SmsQueue[_0xad52('0xc')][_0xad52('0xb')]=function(){this[_0xad52('0x10')]=0x0;this[_0xad52('0x11')]=0x0;for(var _0x3d2df6=0x0;_0x3d2df6=0x0?this[_0xad52('0x15')]:0x0;var _0x351440={'id':this['id'],'available':this[_0xad52('0x15')],'loggedIn':this[_0xad52('0x10')],'name':this['name'],'paused':this[_0xad52('0x11')],'waiting':this['waiting']};var _0x164ffd=md5(JSON[_0xad52('0x16')](_0x351440));if(this[_0xad52('0x0')]!==_0x164ffd){this['md5']=_0x164ffd;io['to'](util[_0xad52('0x17')]('sms:queue:%s',_0x351440[_0xad52('0x18')]))[_0xad52('0x19')](_0xad52('0x1a'),_0x351440);}};module[_0xad52('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 64da7e7..9590740 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 _0x347f=['util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','whatsappPause','paused','available','format','exports','lodash','md5'];(function(_0x50b20c,_0x219378){var _0x4dcedd=function(_0x2032d6){while(--_0x2032d6){_0x50b20c['push'](_0x50b20c['shift']());}};_0x4dcedd(++_0x219378);}(_0x347f,0x15d));var _0xf347=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x347f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xf347('0x0'));var md5=require(_0xf347('0x1'));var util=require(_0xf347('0x2'));var Redis=require(_0xf347('0x3'));var config=require('../../../config/environment');config[_0xf347('0x4')]=_[_0xf347('0x5')](config['redis'],{'host':_0xf347('0x6'),'port':0x18eb});var io=require(_0xf347('0x7'))(new Redis(config[_0xf347('0x4')]));function WhatsappQueue(_0xa87e3){this['id']=_0xa87e3['id']||0x0;this[_0xf347('0x8')]=_0xa87e3['name']||'';this[_0xf347('0x9')]=_0xa87e3['timeout']||0xa;this[_0xf347('0xa')]=_0xa87e3[_0xf347('0xa')]||'beepall';this[_0xf347('0xb')]=_0xa87e3['Agents'];this['mapAgentsId']={};this[_0xf347('0xc')]=0x0;this['md5']='';this[_0xf347('0xd')]();this[_0xf347('0xe')]();}WhatsappQueue[_0xf347('0xf')][_0xf347('0xd')]=function(){var _0x45d8fa=this['mapAgentsId'][_0xf347('0x10')];this[_0xf347('0x11')]=_[_0xf347('0x12')](this[_0xf347('0xb')],'id');this[_0xf347('0x11')][_0xf347('0x10')]=_0x45d8fa;};WhatsappQueue[_0xf347('0xf')][_0xf347('0xe')]=function(){this[_0xf347('0x13')]=0x0;this['paused']=0x0;for(var _0x1b4fb7=0x0;_0x1b4fb7=0x0?this[_0xf347('0x18')]:0x0;var _0x4d9cb={'id':this['id'],'available':this[_0xf347('0x18')],'loggedIn':this[_0xf347('0x13')],'name':this[_0xf347('0x8')],'paused':this['paused'],'waiting':this[_0xf347('0xc')]};var _0x6a40fd=md5(JSON['stringify'](_0x4d9cb));if(this[_0xf347('0x1')]!==_0x6a40fd){this[_0xf347('0x1')]=_0x6a40fd;io['to'](util[_0xf347('0x19')]('whatsapp:queue:%s',_0x4d9cb[_0xf347('0x8')]))['emit']('whatsapp_queue:save',_0x4d9cb);}};module[_0xf347('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x8aeb=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','paused','length','online','whatsappPause','loggedIn','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save'];(function(_0x12b26b,_0x151360){var _0x4f38a7=function(_0x5ad080){while(--_0x5ad080){_0x12b26b['push'](_0x12b26b['shift']());}};_0x4f38a7(++_0x151360);}(_0x8aeb,0x91));var _0xb8ae=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x8aeb[_0x6dd5c];return _0x5a87fa;};'use strict';var _=require(_0xb8ae('0x0'));var md5=require(_0xb8ae('0x1'));var util=require(_0xb8ae('0x2'));var Redis=require(_0xb8ae('0x3'));var config=require(_0xb8ae('0x4'));config[_0xb8ae('0x5')]=_[_0xb8ae('0x6')](config[_0xb8ae('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xb8ae('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x54ddab){this['id']=_0x54ddab['id']||0x0;this['name']=_0x54ddab[_0xb8ae('0x8')]||'';this[_0xb8ae('0x9')]=_0x54ddab['timeout']||0xa;this[_0xb8ae('0xa')]=_0x54ddab['strategy']||_0xb8ae('0xb');this['Agents']=_0x54ddab[_0xb8ae('0xc')];this[_0xb8ae('0xd')]={};this['waiting']=0x0;this[_0xb8ae('0x1')]='';this[_0xb8ae('0xe')]();this[_0xb8ae('0xf')]();}WhatsappQueue[_0xb8ae('0x10')][_0xb8ae('0xe')]=function(){var _0xaeb6d1=this[_0xb8ae('0xd')][_0xb8ae('0x11')];this[_0xb8ae('0xd')]=_['map'](this['Agents'],'id');this[_0xb8ae('0xd')][_0xb8ae('0x11')]=_0xaeb6d1;};WhatsappQueue[_0xb8ae('0x10')][_0xb8ae('0xf')]=function(){this['loggedIn']=0x0;this[_0xb8ae('0x12')]=0x0;for(var _0x28b3a1=0x0;_0x28b3a1=0x0?this[_0xb8ae('0x17')]:0x0;var _0x3e4fb0={'id':this['id'],'available':this[_0xb8ae('0x17')],'loggedIn':this[_0xb8ae('0x16')],'name':this[_0xb8ae('0x8')],'paused':this[_0xb8ae('0x12')],'waiting':this[_0xb8ae('0x18')]};var _0x55d2a7=md5(JSON[_0xb8ae('0x19')](_0x3e4fb0));if(this[_0xb8ae('0x1')]!==_0x55d2a7){this['md5']=_0x55d2a7;io['to'](util[_0xb8ae('0x1a')](_0xb8ae('0x1b'),_0x3e4fb0['name']))['emit'](_0xb8ae('0x1c'),_0x3e4fb0);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c124223..290db60 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 39d9e87..f56c133 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 _0x32c8=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x32c8,0x1db));var _0x832c=function(_0x2432b8,_0x29591e){_0x2432b8=_0x2432b8-0x0;var _0x10680c=_0x32c8[_0x2432b8];return _0x10680c;};'use strict';var client=require(_0x832c('0x0'));exports[_0x832c('0x1')]=function(_0x10740e,_0xfec291){return client[_0x832c('0x2')](_0x832c('0x3'),{'body':_0xfec291,'options':{'where':{'id':_0x10740e}},'log':'updateChatInteraction'});};exports[_0x832c('0x4')]=function(_0x12d535,_0x13dc4f){return client[_0x832c('0x2')]('AddTagsToChatInteraction',{'body':_0x13dc4f,'options':{'where':{'id':_0x12d535}},'log':_0x832c('0x5')});}; \ No newline at end of file +var _0xe6c4=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe6c4,0xfa));var _0x4e6c=function(_0x7b7f49,_0x1cdd70){_0x7b7f49=_0x7b7f49-0x0;var _0x5227b8=_0xe6c4[_0x7b7f49];return _0x5227b8;};'use strict';var client=require(_0x4e6c('0x0'));exports['update']=function(_0x20fed2,_0x5342f7){return client[_0x4e6c('0x1')](_0x4e6c('0x2'),{'body':_0x5342f7,'options':{'where':{'id':_0x20fed2}},'log':_0x4e6c('0x3')});};exports[_0x4e6c('0x4')]=function(_0x306350,_0xd45200){return client[_0x4e6c('0x1')](_0x4e6c('0x5'),{'body':_0xd45200,'options':{'where':{'id':_0x306350}},'log':_0x4e6c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index f0d81d3..4d338ba 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 _0x8782=['Request','../client'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x8782,0x1d7));var _0x2878=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0x8782[_0x20f96d];return _0x9a7524;};'use strict';var client=require(_0x2878('0x0'));exports['create']=function(_0x1dd58f){return client[_0x2878('0x1')]('CreateChatMessage',{'body':_0x1dd58f,'log':'createChatMessage'});}; \ No newline at end of file +var _0x11bc=['create','CreateChatMessage'];(function(_0x4e83a9,_0x4b7ea8){var _0x2f1065=function(_0x58b9e2){while(--_0x58b9e2){_0x4e83a9['push'](_0x4e83a9['shift']());}};_0x2f1065(++_0x4b7ea8);}(_0x11bc,0x19e));var _0xc11b=function(_0x28d122,_0x583e20){_0x28d122=_0x28d122-0x0;var _0x57af16=_0x11bc[_0x28d122];return _0x57af16;};'use strict';var client=require('../client');exports[_0xc11b('0x0')]=function(_0x37aaef){return client['Request'](_0xc11b('0x1'),{'body':_0x37aaef,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index d24c7d9..c0ccefd 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 _0x10af=['chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x315b3a,_0x5f2c70){var _0x418fd4=function(_0x3b8af1){while(--_0x3b8af1){_0x315b3a['push'](_0x315b3a['shift']());}};_0x418fd4(++_0x5f2c70);}(_0x10af,0xfc));var _0xf10a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x10af[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0xf10a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xf10a('0x1')](_0xf10a('0x2'),{'options':{'raw':![],'attributes':['id',_0xf10a('0x3'),_0xf10a('0x4'),_0xf10a('0x5')],'include':[{'model':_0xf10a('0x6'),'as':_0xf10a('0x7'),'attributes':['id',_0xf10a('0x3'),'online',_0xf10a('0x8')]}]},'log':_0xf10a('0x9')});};}; \ No newline at end of file +var _0x9f02=['../client','name','timeout','strategy','User','Agents','online','getChatQueues'];(function(_0x4a26e7,_0x232272){var _0x13c81b=function(_0x15c69f){while(--_0x15c69f){_0x4a26e7['push'](_0x4a26e7['shift']());}};_0x13c81b(++_0x232272);}(_0x9f02,0x68));var _0x29f0=function(_0x2f9d25,_0x2a00bd){_0x2f9d25=_0x2f9d25-0x0;var _0xdd196d=_0x9f02[_0x2f9d25];return _0xdd196d;};'use strict';var client=require(_0x29f0('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x29f0('0x1'),_0x29f0('0x2'),_0x29f0('0x3')],'include':[{'model':_0x29f0('0x4'),'as':_0x29f0('0x5'),'attributes':['id','name',_0x29f0('0x6'),'chatPause']}]},'log':_0x29f0('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5619efb..138b569 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 _0x9b67=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x9b67,0xf6));var _0x79b6=function(_0x4bcb7b,_0x3aae0b){_0x4bcb7b=_0x4bcb7b-0x0;var _0x2f1a53=_0x9b67[_0x4bcb7b];return _0x2f1a53;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(_0xfb9138){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'body':_0xfb9138,'log':'CreateChatQueueReport'});};exports[_0x79b6('0x4')]=function(_0x1aeb24,_0x5297d0){return client['Request'](_0x79b6('0x5'),{'body':_0x5297d0,'options':{'where':{'uniqueid':_0x1aeb24},'order':[['id',_0x79b6('0x6')]],'limit':0x1},'log':_0x79b6('0x5')});}; \ No newline at end of file +var _0xeb5d=['CreateChatQueueReport','UpdateChatQueueReport','DESC','create','Request'];(function(_0x5bd4b0,_0x1ba7b8){var _0x30dc0d=function(_0x565852){while(--_0x565852){_0x5bd4b0['push'](_0x5bd4b0['shift']());}};_0x30dc0d(++_0x1ba7b8);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xeb5d[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xdeb5('0x0')]=function(_0x1ede03){return client[_0xdeb5('0x1')](_0xdeb5('0x2'),{'body':_0x1ede03,'log':'CreateChatQueueReport'});};exports['update']=function(_0x17d77f,_0x16c31b){return client['Request'](_0xdeb5('0x3'),{'body':_0x16c31b,'options':{'where':{'uniqueid':_0x17d77f},'order':[['id',_0xdeb5('0x4')]],'limit':0x1},'log':_0xdeb5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 25baff5..affad50 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x4ccd63,_0x16efa0){var _0x19e206=function(_0x30f418){while(--_0x30f418){_0x4ccd63['push'](_0x4ccd63['shift']());}};_0x19e206(++_0x16efa0);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x7a54,0x106));var _0x47a5=function(_0x3d6988,_0x146b73){_0x3d6988=_0x3d6988-0x0;var _0x4af678=_0x7a54[_0x3d6988];return _0x4af678;};'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 4f5532a..d7a9150 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 _0x378f=['CreateFaxMessage','../client','create'];(function(_0x3878c5,_0x23029c){var _0x37d0cf=function(_0x4066c9){while(--_0x4066c9){_0x3878c5['push'](_0x3878c5['shift']());}};_0x37d0cf(++_0x23029c);}(_0x378f,0x127));var _0xf378=function(_0x3b8fe2,_0x362a80){_0x3b8fe2=_0x3b8fe2-0x0;var _0x13d1d1=_0x378f[_0x3b8fe2];return _0x13d1d1;};'use strict';var client=require(_0xf378('0x0'));exports[_0xf378('0x1')]=function(_0x305f19){return client['Request'](_0xf378('0x2'),{'body':_0x305f19,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x5346=['CreateFaxMessage','../client','Request'];(function(_0x2617ab,_0x2698ae){var _0x578fcc=function(_0x5bf217){while(--_0x5bf217){_0x2617ab['push'](_0x2617ab['shift']());}};_0x578fcc(++_0x2698ae);}(_0x5346,0x18d));var _0x6534=function(_0x2aa253,_0x13aee2){_0x2aa253=_0x2aa253-0x0;var _0x261e68=_0x5346[_0x2aa253];return _0x261e68;};'use strict';var client=require(_0x6534('0x0'));exports['create']=function(_0x426c05){return client[_0x6534('0x1')](_0x6534('0x2'),{'body':_0x426c05,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e414334..a4dbf61 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 _0xc504=['name','User','online','getFaxQueues','Request','GetFaxQueue'];(function(_0x52a569,_0xec66b0){var _0x1cfcae=function(_0x2b13c1){while(--_0x2b13c1){_0x52a569['push'](_0x52a569['shift']());}};_0x1cfcae(++_0xec66b0);}(_0xc504,0x130));var _0x4c50=function(_0x534c99,_0xf630c5){_0x534c99=_0x534c99-0x0;var _0x5db938=_0xc504[_0x534c99];return _0x5db938;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x4c50('0x0')](_0x4c50('0x1'),{'options':{'raw':![],'attributes':['id',_0x4c50('0x2'),'timeout','strategy'],'include':[{'model':_0x4c50('0x3'),'as':'Agents','attributes':['id',_0x4c50('0x2'),_0x4c50('0x4'),'faxPause']}]},'log':_0x4c50('0x5')});};}; \ No newline at end of file +var _0x625f=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0x182dd0,_0x4e440d){var _0x4f37fe=function(_0x579d96){while(--_0x579d96){_0x182dd0['push'](_0x182dd0['shift']());}};_0x4f37fe(++_0x4e440d);}(_0x625f,0x14a));var _0xf625=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x625f[_0x1cd47d];return _0x29d52f;};'use strict';var client=require('../client');exports[_0xf625('0x0')]=function(){return function(){return client[_0xf625('0x1')](_0xf625('0x2'),{'options':{'raw':![],'attributes':['id',_0xf625('0x3'),_0xf625('0x4'),_0xf625('0x5')],'include':[{'model':_0xf625('0x6'),'as':_0xf625('0x7'),'attributes':['id',_0xf625('0x3'),_0xf625('0x8'),_0xf625('0x9')]}]},'log':_0xf625('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e76323a..f295acf 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 _0xd46d=['DESC','create','Request','CreateFaxQueueReport','update'];(function(_0x6c6cfa,_0xa4be99){var _0x523282=function(_0xaab07b){while(--_0xaab07b){_0x6c6cfa['push'](_0x6c6cfa['shift']());}};_0x523282(++_0xa4be99);}(_0xd46d,0x169));var _0xdd46=function(_0x319fb6,_0xa69d58){_0x319fb6=_0x319fb6-0x0;var _0x4a80f0=_0xd46d[_0x319fb6];return _0x4a80f0;};'use strict';var client=require('../client');exports[_0xdd46('0x0')]=function(_0x308920){return client[_0xdd46('0x1')](_0xdd46('0x2'),{'body':_0x308920,'log':_0xdd46('0x2')});};exports[_0xdd46('0x3')]=function(_0x3484fd,_0x592fc9){return client[_0xdd46('0x1')]('UpdateFaxQueueReport',{'body':_0x592fc9,'options':{'where':{'uniqueid':_0x3484fd},'order':[['id',_0xdd46('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xe6cf=['CreateFaxQueueReport','Request','UpdateFaxQueueReport','../client'];(function(_0x3529ae,_0x406c95){var _0x32dfd9=function(_0x38e908){while(--_0x38e908){_0x3529ae['push'](_0x3529ae['shift']());}};_0x32dfd9(++_0x406c95);}(_0xe6cf,0x73));var _0xfe6c=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0xe6cf[_0x471268];return _0x1298f3;};'use strict';var client=require(_0xfe6c('0x0'));exports['create']=function(_0x438ddc){return client['Request'](_0xfe6c('0x1'),{'body':_0x438ddc,'log':_0xfe6c('0x1')});};exports['update']=function(_0x5af6f3,_0x6666be){return client[_0xfe6c('0x2')](_0xfe6c('0x3'),{'body':_0x6666be,'options':{'where':{'uniqueid':_0x5af6f3},'order':[['id','DESC']],'limit':0x1},'log':_0xfe6c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index c2ccad8..8678592 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 _0xb79c=['GetInterval','name','Interval','interval','../client','getIntervals','Request'];(function(_0x45b0e7,_0x276c66){var _0x29d69f=function(_0x9335ad){while(--_0x9335ad){_0x45b0e7['push'](_0x45b0e7['shift']());}};_0x29d69f(++_0x276c66);}(_0xb79c,0x82));var _0xcb79=function(_0x201132,_0x44998d){_0x201132=_0x201132-0x0;var _0x59ec2a=_0xb79c[_0x201132];return _0x59ec2a;};'use strict';var client=require(_0xcb79('0x0'));exports[_0xcb79('0x1')]=function(){return function(){return client[_0xcb79('0x2')](_0xcb79('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcb79('0x4')],'include':[{'model':_0xcb79('0x5'),'as':'Intervals','attributes':['id',_0xcb79('0x4'),_0xcb79('0x6')]}]},'log':_0xcb79('0x1')});};}; \ No newline at end of file +var _0xd761=['getIntervals','GetInterval','Intervals','interval'];(function(_0x212dc3,_0x3cf6a5){var _0x84e6c6=function(_0x5874c2){while(--_0x5874c2){_0x212dc3['push'](_0x212dc3['shift']());}};_0x84e6c6(++_0x3cf6a5);}(_0xd761,0x1cd));var _0x1d76=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xd761[_0x3f59b1];return _0x11d2e8;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request'](_0x1d76('0x0'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x1d76('0x1'),'attributes':['id','name',_0x1d76('0x2')]}]},'log':_0x1d76('0x3')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ef80b67..913876c 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 _0x1399=['UpdateMailInteraction','updateMailInteraction','addTags','Request','../client','update'];(function(_0x175678,_0x52b9b2){var _0x25cd8f=function(_0x36cac0){while(--_0x36cac0){_0x175678['push'](_0x175678['shift']());}};_0x25cd8f(++_0x52b9b2);}(_0x1399,0x16c));var _0x9139=function(_0x231473,_0x33b93e){_0x231473=_0x231473-0x0;var _0x16d666=_0x1399[_0x231473];return _0x16d666;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(_0x5740a9,_0x474911){return client['Request'](_0x9139('0x2'),{'body':_0x474911,'options':{'where':{'id':_0x5740a9}},'log':_0x9139('0x3')});};exports[_0x9139('0x4')]=function(_0x28f155,_0x251798){return client[_0x9139('0x5')]('AddTagsToMailInteraction',{'body':_0x251798,'options':{'where':{'id':_0x28f155}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0xc44c82,_0x7b5c5e){var _0x359a49=function(_0x556a9b){while(--_0x556a9b){_0xc44c82['push'](_0xc44c82['shift']());}};_0x359a49(++_0x7b5c5e);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 48ffa2a..b79b7e6 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 _0x8a4e=['createMailMessage','../client'];(function(_0x3b0b09,_0x87e6cc){var _0x448d98=function(_0x10d07f){while(--_0x10d07f){_0x3b0b09['push'](_0x3b0b09['shift']());}};_0x448d98(++_0x87e6cc);}(_0x8a4e,0x199));var _0xe8a4=function(_0x530ddb,_0x3008f8){_0x530ddb=_0x530ddb-0x0;var _0x4fa295=_0x8a4e[_0x530ddb];return _0x4fa295;};'use strict';var client=require(_0xe8a4('0x0'));exports['create']=function(_0x48e388){return client['Request']('CreateMailMessage',{'body':_0x48e388,'log':_0xe8a4('0x1')});}; \ No newline at end of file +var _0x9daf=['Request','CreateMailMessage','create'];(function(_0xf7cca,_0x21c532){var _0x53298f=function(_0x2a956b){while(--_0x2a956b){_0xf7cca['push'](_0xf7cca['shift']());}};_0x53298f(++_0x21c532);}(_0x9daf,0xb9));var _0xf9da=function(_0x978971,_0x4ca3cb){_0x978971=_0x978971-0x0;var _0x48572f=_0x9daf[_0x978971];return _0x48572f;};'use strict';var client=require('../client');exports[_0xf9da('0x0')]=function(_0x5200e7){return client[_0xf9da('0x1')](_0xf9da('0x2'),{'body':_0x5200e7,'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 2738a00..81198a6 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 _0x242d=['Request','GetMailQueue','name','timeout','strategy','User','Agents','mailPause','getMailQueues'];(function(_0xa6bc35,_0x5c42b1){var _0x4503de=function(_0x51c4a8){while(--_0x51c4a8){_0xa6bc35['push'](_0xa6bc35['shift']());}};_0x4503de(++_0x5c42b1);}(_0x242d,0x19d));var _0xd242=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x242d[_0x364a36];return _0x5cd6fa;};'use strict';var client=require('../client');exports[_0xd242('0x0')]=function(){return function(){return client[_0xd242('0x1')](_0xd242('0x2'),{'options':{'raw':![],'attributes':['id',_0xd242('0x3'),_0xd242('0x4'),_0xd242('0x5')],'include':[{'model':_0xd242('0x6'),'as':_0xd242('0x7'),'attributes':['id',_0xd242('0x3'),'online',_0xd242('0x8')]}]},'log':_0xd242('0x0')});};}; \ No newline at end of file +var _0x2f12=['name','online','getMailQueues','timeout','strategy','User','Agents'];(function(_0x107fa0,_0x245987){var _0x4f67ba=function(_0x420294){while(--_0x420294){_0x107fa0['push'](_0x107fa0['shift']());}};_0x4f67ba(++_0x245987);}(_0x2f12,0x1f4));var _0x22f1=function(_0x393070,_0x28e7d2){_0x393070=_0x393070-0x0;var _0x2cf5a2=_0x2f12[_0x393070];return _0x2cf5a2;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x22f1('0x0'),_0x22f1('0x1')],'include':[{'model':_0x22f1('0x2'),'as':_0x22f1('0x3'),'attributes':['id',_0x22f1('0x4'),_0x22f1('0x5'),'mailPause']}]},'log':_0x22f1('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index f5c29b0..aec2cd0 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 _0xa36a=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x55f1cc,_0x2dd4e8){var _0x91df6c=function(_0x469345){while(--_0x469345){_0x55f1cc['push'](_0x55f1cc['shift']());}};_0x91df6c(++_0x2dd4e8);}(_0xa36a,0x88));var _0xaa36=function(_0x26340a,_0x59bea0){_0x26340a=_0x26340a-0x0;var _0xc7b8fb=_0xa36a[_0x26340a];return _0xc7b8fb;};'use strict';var client=require(_0xaa36('0x0'));exports[_0xaa36('0x1')]=function(_0x44e291){return client[_0xaa36('0x2')](_0xaa36('0x3'),{'body':_0x44e291,'log':_0xaa36('0x3')});};exports[_0xaa36('0x4')]=function(_0x538c8c,_0x132591){return client[_0xaa36('0x2')](_0xaa36('0x5'),{'body':_0x132591,'options':{'where':{'uniqueid':_0x538c8c},'order':[['id',_0xaa36('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x8314=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x8314,0xbd));var _0x4831=function(_0x1ec2b5,_0x312b6e){_0x1ec2b5=_0x1ec2b5-0x0;var _0x4f4dc2=_0x8314[_0x1ec2b5];return _0x4f4dc2;};'use strict';var client=require(_0x4831('0x0'));exports[_0x4831('0x1')]=function(_0x5c4c5e){return client['Request'](_0x4831('0x2'),{'body':_0x5c4c5e,'log':'CreateMailQueueReport'});};exports[_0x4831('0x3')]=function(_0x4cae00,_0x1d8ca7){return client[_0x4831('0x4')](_0x4831('0x5'),{'body':_0x1d8ca7,'options':{'where':{'uniqueid':_0x4cae00},'order':[['id',_0x4831('0x6')]],'limit':0x1},'log':_0x4831('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 67e5700..2efae40 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 _0xc44b=['addTags','Request','AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xc44b,0xab));var _0xbc44=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0xc44b[_0x19dd7a];return _0x3feb6a;};'use strict';var client=require(_0xbc44('0x0'));exports[_0xbc44('0x1')]=function(_0x391bb4,_0x26157f){return client['Request'](_0xbc44('0x2'),{'body':_0x26157f,'options':{'where':{'id':_0x391bb4}},'log':_0xbc44('0x3')});};exports[_0xbc44('0x4')]=function(_0x508ffa,_0x46fd76){return client[_0xbc44('0x5')](_0xbc44('0x6'),{'body':_0x46fd76,'options':{'where':{'id':_0x508ffa}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4911=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x507fad,_0x143753){var _0x44e396=function(_0x1f81e7){while(--_0x1f81e7){_0x507fad['push'](_0x507fad['shift']());}};_0x44e396(++_0x143753);}(_0x4911,0x17a));var _0x1491=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x4911[_0x3d8d0a];return _0x5b9df5;};'use strict';var client=require(_0x1491('0x0'));exports[_0x1491('0x1')]=function(_0x1ea49c,_0x2133f3){return client[_0x1491('0x2')](_0x1491('0x3'),{'body':_0x2133f3,'options':{'where':{'id':_0x1ea49c}},'log':_0x1491('0x4')});};exports[_0x1491('0x5')]=function(_0x30ea85,_0x29a260){return client[_0x1491('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x29a260,'options':{'where':{'id':_0x30ea85}},'log':_0x1491('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index be5767b..058b110 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 _0x4a18=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x3fbacd,_0x1df49f){var _0x3e2df3=function(_0x351727){while(--_0x351727){_0x3fbacd['push'](_0x3fbacd['shift']());}};_0x3e2df3(++_0x1df49f);}(_0x4a18,0x147));var _0x84a1=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4a18[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0x84a1('0x0'));exports[_0x84a1('0x1')]=function(_0xb0e026){return client[_0x84a1('0x2')](_0x84a1('0x3'),{'body':_0xb0e026,'log':_0x84a1('0x4')});}; \ No newline at end of file +var _0x179a=['Request','../client'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x179a,0x89));var _0xa179=function(_0x3c487b,_0x44c5e2){_0x3c487b=_0x3c487b-0x0;var _0x1d65f6=_0x179a[_0x3c487b];return _0x1d65f6;};'use strict';var client=require(_0xa179('0x0'));exports['create']=function(_0x127d98){return client[_0xa179('0x1')]('CreateOpenchannelMessage',{'body':_0x127d98,'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 1bc3358..6c849a8 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 _0xfc68=['name','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','Agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc68,0xb6));var _0x8fc6=function(_0xa77016,_0x1de579){_0xa77016=_0xa77016-0x0;var _0x30ed8c=_0xfc68[_0xa77016];return _0x30ed8c;};'use strict';var client=require(_0x8fc6('0x0'));exports[_0x8fc6('0x1')]=function(){return function(){return client[_0x8fc6('0x2')](_0x8fc6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x8fc6('0x4'),_0x8fc6('0x5')],'include':[{'model':'User','as':_0x8fc6('0x6'),'attributes':['id',_0x8fc6('0x7'),_0x8fc6('0x8'),'openchannelPause']}]},'log':_0x8fc6('0x1')});};}; \ No newline at end of file +var _0xc37d=['Agents','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xc37d,0x174));var _0xdc37=function(_0x4feaa1,_0x40da1b){_0x4feaa1=_0x4feaa1-0x0;var _0x2bf4a1=_0xc37d[_0x4feaa1];return _0x2bf4a1;};'use strict';var client=require('../client');exports[_0xdc37('0x0')]=function(){return function(){return client['Request'](_0xdc37('0x1'),{'options':{'raw':![],'attributes':['id',_0xdc37('0x2'),_0xdc37('0x3'),_0xdc37('0x4')],'include':[{'model':_0xdc37('0x5'),'as':_0xdc37('0x6'),'attributes':['id',_0xdc37('0x2'),_0xdc37('0x7'),_0xdc37('0x8')]}]},'log':_0xdc37('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7274746..c475af9 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 _0x808e=['UpdateOpenchannelQueueReport','DESC','../client','CreateOpenchannelQueueReport','update','Request'];(function(_0x39e50e,_0x570052){var _0x5f1ca1=function(_0x207e52){while(--_0x207e52){_0x39e50e['push'](_0x39e50e['shift']());}};_0x5f1ca1(++_0x570052);}(_0x808e,0x104));var _0xe808=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x808e[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0xe808('0x0'));exports['create']=function(_0x4e99e3){return client['Request'](_0xe808('0x1'),{'body':_0x4e99e3,'log':'CreateOpenchannelQueueReport'});};exports[_0xe808('0x2')]=function(_0xf0b07b,_0x152117){return client[_0xe808('0x3')](_0xe808('0x4'),{'body':_0x152117,'options':{'where':{'uniqueid':_0xf0b07b},'order':[['id',_0xe808('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x2e76=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0xe097bb,_0xd58a98){var _0x23ba23=function(_0x269a47){while(--_0x269a47){_0xe097bb['push'](_0xe097bb['shift']());}};_0x23ba23(++_0xd58a98);}(_0x2e76,0x199));var _0x62e7=function(_0x334284,_0x227df8){_0x334284=_0x334284-0x0;var _0xeb46a7=_0x2e76[_0x334284];return _0xeb46a7;};'use strict';var client=require(_0x62e7('0x0'));exports['create']=function(_0x5dcc4c){return client[_0x62e7('0x1')]('CreateOpenchannelQueueReport',{'body':_0x5dcc4c,'log':_0x62e7('0x2')});};exports[_0x62e7('0x3')]=function(_0x21ff1f,_0x2f33e5){return client[_0x62e7('0x1')]('UpdateOpenchannelQueueReport',{'body':_0x2f33e5,'options':{'where':{'uniqueid':_0x21ff1f},'order':[['id','DESC']],'limit':0x1},'log':_0x62e7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 06b9fcb..37b8801 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 _0x2dd3=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x2dd3,0x6e));var _0x32dd=function(_0x47fe81,_0x54d6a2){_0x47fe81=_0x47fe81-0x0;var _0xe9139b=_0x2dd3[_0x47fe81];return _0xe9139b;};'use strict';var client=require('../client');exports[_0x32dd('0x0')]=function(_0x29bb49,_0x225c50){return client[_0x32dd('0x1')](_0x32dd('0x2'),{'body':_0x225c50,'options':{'where':{'id':_0x29bb49}},'log':_0x32dd('0x3')});};exports['addTags']=function(_0x36e50d,_0x144ee4){return client[_0x32dd('0x1')](_0x32dd('0x4'),{'body':_0x144ee4,'options':{'where':{'id':_0x36e50d}},'log':_0x32dd('0x5')});}; \ No newline at end of file +var _0xa74a=['../client','update','Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x215da5,_0x24c800){var _0x4ce052=function(_0x43104a){while(--_0x43104a){_0x215da5['push'](_0x215da5['shift']());}};_0x4ce052(++_0x24c800);}(_0xa74a,0x66));var _0xaa74=function(_0xf73711,_0x53be69){_0xf73711=_0xf73711-0x0;var _0x4ada77=_0xa74a[_0xf73711];return _0x4ada77;};'use strict';var client=require(_0xaa74('0x0'));exports[_0xaa74('0x1')]=function(_0xa53b49,_0x2d804a){return client[_0xaa74('0x2')](_0xaa74('0x3'),{'body':_0x2d804a,'options':{'where':{'id':_0xa53b49}},'log':'updateSmsInteraction'});};exports[_0xaa74('0x4')]=function(_0x2a487d,_0x453f66){return client['Request']('AddTagsToSmsInteraction',{'body':_0x453f66,'options':{'where':{'id':_0x2a487d}},'log':_0xaa74('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index eff839a..077b51b 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 _0xf5ce=['Request','createSmsMessage'];(function(_0x1ac485,_0xde9db2){var _0x2bb13a=function(_0x40ecfd){while(--_0x40ecfd){_0x1ac485['push'](_0x1ac485['shift']());}};_0x2bb13a(++_0xde9db2);}(_0xf5ce,0x16e));var _0xef5c=function(_0xea8649,_0x4560cc){_0xea8649=_0xea8649-0x0;var _0x481e57=_0xf5ce[_0xea8649];return _0x481e57;};'use strict';var client=require('../client');exports['create']=function(_0x3c66fb){return client[_0xef5c('0x0')]('CreateSmsMessage',{'body':_0x3c66fb,'log':_0xef5c('0x1')});}; \ No newline at end of file +var _0xa1aa=['CreateSmsMessage','create','Request'];(function(_0x4851e7,_0x78771a){var _0x5b5e20=function(_0x3ea5c2){while(--_0x3ea5c2){_0x4851e7['push'](_0x4851e7['shift']());}};_0x5b5e20(++_0x78771a);}(_0xa1aa,0xee));var _0xaa1a=function(_0x5c8058,_0x3828d4){_0x5c8058=_0x5c8058-0x0;var _0x1c3c02=_0xa1aa[_0x5c8058];return _0x1c3c02;};'use strict';var client=require('../client');exports[_0xaa1a('0x0')]=function(_0x567ad7){return client[_0xaa1a('0x1')](_0xaa1a('0x2'),{'body':_0x567ad7,'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 777ecc6..a897545 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x219cfd,_0x2ac503){var _0x1fb5a4=function(_0x117971){while(--_0x117971){_0x219cfd['push'](_0x219cfd['shift']());}};_0x1fb5a4(++_0x2ac503);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x56424c,_0x1d5bcb){var _0x2fe397=function(_0xf9e59e){while(--_0xf9e59e){_0x56424c['push'](_0x56424c['shift']());}};_0x2fe397(++_0x1d5bcb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 56909d0..5c9ae76 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x160c76,_0x3c98aa){var _0x4c8231=function(_0x35e777){while(--_0x35e777){_0x160c76['push'](_0x160c76['shift']());}};_0x4c8231(++_0x3c98aa);}(_0x3e74,0x175));var _0x43e7=function(_0x1a14ac,_0x125c6d){_0x1a14ac=_0x1a14ac-0x0;var _0xb766ca=_0x3e74[_0x1a14ac];return _0xb766ca;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x447524,_0x9fa957){var _0x52ad0b=function(_0x500e2b){while(--_0x500e2b){_0x447524['push'](_0x447524['shift']());}};_0x52ad0b(++_0x9fa957);}(_0x34e8,0x12c));var _0x834e=function(_0x2a124e,_0x1a98fd){_0x2a124e=_0x2a124e-0x0;var _0x169173=_0x34e8[_0x2a124e];return _0x169173;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 3f8f017..e14a9d3 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(_0x244712,_0x4ea208){var _0x1ea352=function(_0x4fc684){while(--_0x4fc684){_0x244712['push'](_0x244712['shift']());}};_0x1ea352(++_0x4ea208);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x307165,_0x186dca){var _0x5caf15=function(_0x17300f){while(--_0x17300f){_0x307165['push'](_0x307165['shift']());}};_0x5caf15(++_0x186dca);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 051fe9b..dccc980 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 _0x8d0a=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x8d0a,0x172));var _0xa8d0=function(_0x18aea4,_0xe06048){_0x18aea4=_0x18aea4-0x0;var _0x303d08=_0x8d0a[_0x18aea4];return _0x303d08;};'use strict';var client=require(_0xa8d0('0x0'));exports[_0xa8d0('0x1')]=function(_0x42a78b,_0x51c455){return client[_0xa8d0('0x2')](_0xa8d0('0x3'),{'body':_0x51c455,'options':{'where':{'id':_0x42a78b}},'log':'updateWhatsappInteraction'});};exports[_0xa8d0('0x4')]=function(_0x3812b4,_0x33c4b1){return client['Request'](_0xa8d0('0x5'),{'body':_0x33c4b1,'options':{'where':{'id':_0x3812b4}},'log':_0xa8d0('0x6')});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x4f3d00,_0x188abc){var _0x484889=function(_0x13eb9c){while(--_0x13eb9c){_0x4f3d00['push'](_0x4f3d00['shift']());}};_0x484889(++_0x188abc);}(_0x4bd3,0x174));var _0x34bd=function(_0x40f1d7,_0x39cd51){_0x40f1d7=_0x40f1d7-0x0;var _0x56070f=_0x4bd3[_0x40f1d7];return _0x56070f;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateWhatsappInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateWhatsappInteraction'});};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/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 5df656e..ec73b4f 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 _0x3319=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0x3319,0x1c9));var _0x9331=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3319[_0x4e9628];return _0x27bc8c;};'use strict';var client=require(_0x9331('0x0'));exports[_0x9331('0x1')]=function(_0x327c03){return client[_0x9331('0x2')](_0x9331('0x3'),{'body':_0x327c03,'log':_0x9331('0x4')});}; \ No newline at end of file +var _0x87be=['../client','create','Request','createWhatsappMessage'];(function(_0x48a66e,_0x19751f){var _0x4ab41a=function(_0x3b740a){while(--_0x3b740a){_0x48a66e['push'](_0x48a66e['shift']());}};_0x4ab41a(++_0x19751f);}(_0x87be,0xb4));var _0xe87b=function(_0x26dec7,_0xb3ece){_0x26dec7=_0x26dec7-0x0;var _0x804167=_0x87be[_0x26dec7];return _0x804167;};'use strict';var client=require(_0xe87b('0x0'));exports[_0xe87b('0x1')]=function(_0x267168){return client[_0xe87b('0x2')]('CreateWhatsappMessage',{'body':_0x267168,'log':_0xe87b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 4d37c02..ecce08c 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 _0xc9c1=['online','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','timeout','strategy','User','Agents','name'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xc9c1,0x14d));var _0x1c9c=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc9c1[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x1c9c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x1c9c('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x1c9c('0x2'),_0x1c9c('0x3')],'include':[{'model':_0x1c9c('0x4'),'as':_0x1c9c('0x5'),'attributes':['id',_0x1c9c('0x6'),_0x1c9c('0x7'),_0x1c9c('0x8')]}]},'log':_0x1c9c('0x9')});};}; \ No newline at end of file +var _0x8986=['strategy','User','Agents','online','whatsappPause','getWhatsappQueues','Request','name','timeout'];(function(_0x55dca4,_0x55723f){var _0x3fa237=function(_0x46f46f){while(--_0x46f46f){_0x55dca4['push'](_0x55dca4['shift']());}};_0x3fa237(++_0x55723f);}(_0x8986,0xc3));var _0x6898=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8986[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x6898('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x6898('0x1'),_0x6898('0x2'),_0x6898('0x3')],'include':[{'model':_0x6898('0x4'),'as':_0x6898('0x5'),'attributes':['id','name',_0x6898('0x6'),_0x6898('0x7')]}]},'log':_0x6898('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4185bbb..dbe40ef 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 _0xba3d=['UpdateWhatsappQueueReport','DESC','../client','Request','update'];(function(_0x4b079d,_0x19b2c3){var _0x2e4c1e=function(_0x431ea8){while(--_0x431ea8){_0x4b079d['push'](_0x4b079d['shift']());}};_0x2e4c1e(++_0x19b2c3);}(_0xba3d,0xa2));var _0xdba3=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xba3d[_0x28aea5];return _0x6a55f9;};'use strict';var client=require(_0xdba3('0x0'));exports['create']=function(_0x33f7ac){return client[_0xdba3('0x1')]('CreateWhatsappQueueReport',{'body':_0x33f7ac,'log':'CreateWhatsappQueueReport'});};exports[_0xdba3('0x2')]=function(_0x493f10,_0x41541a){return client[_0xdba3('0x1')](_0xdba3('0x3'),{'body':_0x41541a,'options':{'where':{'uniqueid':_0x493f10},'order':[['id',_0xdba3('0x4')]],'limit':0x1},'log':_0xdba3('0x3')});}; \ No newline at end of file +var _0xec9f=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0xbed42c,_0x608da4){var _0x45086a=function(_0x2ed0b4){while(--_0x2ed0b4){_0xbed42c['push'](_0xbed42c['shift']());}};_0x45086a(++_0x608da4);}(_0xec9f,0x15e));var _0xfec9=function(_0x360483,_0xcaf71c){_0x360483=_0x360483-0x0;var _0x1abcce=_0xec9f[_0x360483];return _0x1abcce;};'use strict';var client=require(_0xfec9('0x0'));exports[_0xfec9('0x1')]=function(_0x3eba0b){return client[_0xfec9('0x2')](_0xfec9('0x3'),{'body':_0x3eba0b,'log':'CreateWhatsappQueueReport'});};exports[_0xfec9('0x4')]=function(_0x452103,_0x1cf0b9){return client['Request'](_0xfec9('0x5'),{'body':_0x1cf0b9,'options':{'where':{'uniqueid':_0x452103},'order':[['id',_0xfec9('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index aab2957..9f28dc2 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 _0xbbfe=['timeout','atimeout','channel','format','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','error','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find'];(function(_0x1af747,_0x190c72){var _0x41d936=function(_0x2e73c6){while(--_0x2e73c6){_0x1af747['push'](_0x1af747['shift']());}};_0x41d936(++_0x190c72);}(_0xbbfe,0xfc));var _0xebbf=function(_0x54b723,_0x2b54ee){_0x54b723=_0x54b723-0x0;var _0x57fd0f=_0xbbfe[_0x54b723];return _0x57fd0f;};'use strict';var schema=require(_0xebbf('0x0'));var _=require('lodash');var util=require(_0xebbf('0x1'));var seqqueue=require(_0xebbf('0x2'));var logger=require(_0xebbf('0x3'))(_0xebbf('0x4'));var strategy=require(_0xebbf('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xebbf('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x5a9bcb,_0x2b6fca,_0x2a25df){return logger['info'](util['format'](_0xebbf('0x7'),_0x5a9bcb,_0x2b6fca[_0xebbf('0x8')],_0x2a25df));}function handleFindAgent(_0x5ed37e){return function(_0x58d2ee){return _0x58d2ee[_0xebbf('0x8')][_0xebbf('0x9')]()===_0x5ed37e['toLowerCase']();};}exports[_0xebbf('0xa')]=function(_0x53dd95,_0x1637dd,_0x137d80,_0x1f36ac){return function(_0x135da2){try{var _0x3c60d3={'name':_0x1637dd[0x0],'timeout':_0x1637dd[0x1]};var _0x4edbfa=queue[_0xebbf('0x0')](_0x3c60d3,{'typecast':!![]});if(_0x4edbfa[_0xebbf('0xb')]){logger['error'](_0xebbf('0xc'),_0x53dd95,_[_0xebbf('0xd')](_0x4edbfa,_0xebbf('0xe'))[_0xebbf('0xf')](',\x20'));_0x135da2[_0xebbf('0x10')]();}else{var _0x1365a4=_[_0xebbf('0x11')](_0x137d80['agents'],handleFindAgent(_0x3c60d3[_0xebbf('0x8')]));if(_0x1365a4){var _0x515b7b=(_0x3c60d3[_0xebbf('0x12')]||0xa)*0x3e8;var _0x5264bb,_0x2ec07f;var _0x4d7631=seqqueue['createQueue'](_0x515b7b);_0x4d7631['id']=_0x53dd95;_0x4d7631[_0xebbf('0x13')]=_0x515b7b;_0x4d7631[_0xebbf('0x14')]=_0x1f36ac[_0xebbf('0x14')];writeLog(_0x53dd95,_0x1365a4,util[_0xebbf('0x15')](_0xebbf('0x16'),_0x515b7b));_0x137d80[_0xebbf('0x17')][_0x53dd95]['on'](_0xebbf('0x18'),function(){logger[_0xebbf('0x19')](_0xebbf('0x1a'),_0x53dd95);clearTimeout(_0x2ec07f);_0x2ec07f=undefined;_0x4d7631[_0xebbf('0x1b')]();if(_0x137d80[_0xebbf('0x17')][_0x53dd95]){delete _0x137d80['rules'][_0x53dd95];}_0x135da2[_0xebbf('0x10')]();});_0x137d80[_0xebbf('0x17')][_0x53dd95]['on']('complete',function(){if(_0x137d80[_0xebbf('0x17')][_0x53dd95]){delete _0x137d80[_0xebbf('0x17')][_0x53dd95];}});_0x2ec07f=setTimeout(function(){logger[_0xebbf('0x19')]('[%s][AGENT]\x20ROUTING\x20END',_0x53dd95);clearTimeout(_0x2ec07f);_0x4d7631['close']();_0x135da2['next']();},_0x515b7b);strategy['agent'](_0x4d7631,_0x1365a4,_0x137d80,_0x1f36ac);}else{logger[_0xebbf('0x1c')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x53dd95,_0x3c60d3['name']);_0x135da2[_0xebbf('0x10')]();}}}catch(_0x59eeb6){console['log'](_0x59eeb6);logger[_0xebbf('0x1c')]('[%s][QUEUE]\x20%s',_0x53dd95,_0x59eeb6[_0xebbf('0x1d')]);_0x135da2[_0xebbf('0x10')]();}};}; \ No newline at end of file +var _0xf1a4=['util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash'];(function(_0x4a88ea,_0x371c5b){var _0x3c6d82=function(_0x3d2d7a){while(--_0x3d2d7a){_0x4a88ea['push'](_0x4a88ea['shift']());}};_0x3c6d82(++_0x371c5b);}(_0xf1a4,0xee));var _0x4f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a4[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x4f1a('0x0'));var _=require(_0x4f1a('0x1'));var util=require(_0x4f1a('0x2'));var seqqueue=require(_0x4f1a('0x3'));var logger=require(_0x4f1a('0x4'))(_0x4f1a('0x5'));var strategy=require(_0x4f1a('0x6'));var queue=schema({'name':{'type':_0x4f1a('0x7'),'required':!![],'message':_0x4f1a('0x8')},'timeout':{'type':_0x4f1a('0x9'),'message':_0x4f1a('0xa')}});function writeLog(_0x937ac7,_0x388dae,_0x27c891){return logger['info'](util[_0x4f1a('0xb')](_0x4f1a('0xc'),_0x937ac7,_0x388dae[_0x4f1a('0xd')],_0x27c891));}function handleFindAgent(_0x7c1207){return function(_0x2927b2){return _0x2927b2[_0x4f1a('0xd')][_0x4f1a('0xe')]()===_0x7c1207[_0x4f1a('0xe')]();};}exports[_0x4f1a('0xf')]=function(_0x216643,_0x3b01da,_0x592bdd,_0x3d9e81){return function(_0x536a9d){try{var _0x4d1dfc={'name':_0x3b01da[0x0],'timeout':_0x3b01da[0x1]};var _0x4fd95a=queue[_0x4f1a('0x0')](_0x4d1dfc,{'typecast':!![]});if(_0x4fd95a[_0x4f1a('0x10')]){logger[_0x4f1a('0x11')](_0x4f1a('0x12'),_0x216643,_['map'](_0x4fd95a,'message')['join'](',\x20'));_0x536a9d[_0x4f1a('0x13')]();}else{var _0x5beec0=_[_0x4f1a('0x14')](_0x592bdd[_0x4f1a('0x15')],handleFindAgent(_0x4d1dfc[_0x4f1a('0xd')]));if(_0x5beec0){var _0x32ed36=(_0x4d1dfc[_0x4f1a('0x16')]||0xa)*0x3e8;var _0x3eb36d,_0x4e2209;var _0x25994b=seqqueue[_0x4f1a('0x17')](_0x32ed36);_0x25994b['id']=_0x216643;_0x25994b[_0x4f1a('0x18')]=_0x32ed36;_0x25994b[_0x4f1a('0x19')]=_0x3d9e81['channel'];writeLog(_0x216643,_0x5beec0,util[_0x4f1a('0xb')](_0x4f1a('0x1a'),_0x32ed36));_0x592bdd[_0x4f1a('0x1b')][_0x216643]['on'](_0x4f1a('0x1c'),function(){logger[_0x4f1a('0x1d')](_0x4f1a('0x1e'),_0x216643);clearTimeout(_0x4e2209);_0x4e2209=undefined;_0x25994b[_0x4f1a('0x1f')]();if(_0x592bdd[_0x4f1a('0x1b')][_0x216643]){delete _0x592bdd[_0x4f1a('0x1b')][_0x216643];}_0x536a9d[_0x4f1a('0x13')]();});_0x592bdd['rules'][_0x216643]['on'](_0x4f1a('0x20'),function(){if(_0x592bdd[_0x4f1a('0x1b')][_0x216643]){delete _0x592bdd[_0x4f1a('0x1b')][_0x216643];}});_0x4e2209=setTimeout(function(){logger[_0x4f1a('0x1d')](_0x4f1a('0x21'),_0x216643);clearTimeout(_0x4e2209);_0x25994b[_0x4f1a('0x1f')]();_0x536a9d[_0x4f1a('0x22')]();},_0x32ed36);strategy[_0x4f1a('0x23')](_0x25994b,_0x5beec0,_0x592bdd,_0x3d9e81);}else{logger[_0x4f1a('0x11')](_0x4f1a('0x24'),_0x216643,_0x4d1dfc['name']);_0x536a9d[_0x4f1a('0x13')]();}}}catch(_0x3b530e){console[_0x4f1a('0x25')](_0x3b530e);logger['error'](_0x4f1a('0x26'),_0x216643,_0x3b530e[_0x4f1a('0x27')]);_0x536a9d['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 0ab9a69..40ba3a2 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 _0x9d60=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','providerResponse','dialogState','Failed','lodash','moment','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify'];(function(_0x52e64,_0x6ba4e8){var _0x282b80=function(_0xc11939){while(--_0xc11939){_0x52e64['push'](_0x52e64['shift']());}};_0x282b80(++_0x6ba4e8);}(_0x9d60,0xcd));var _0x09d6=function(_0x3e99cb,_0x1d2fe0){_0x3e99cb=_0x3e99cb-0x0;var _0x1bc729=_0x9d60[_0x3e99cb];return _0x1bc729;};'use strict';var _=require(_0x09d6('0x0'));var moment=require(_0x09d6('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x09d6('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x09d6('0x3')),'smsMessage':require(_0x09d6('0x4')),'faxMessage':require(_0x09d6('0x5')),'whatsappMessage':require(_0x09d6('0x6'))};exports[_0x09d6('0x7')]=function(_0x858d1c,_0x3f9bd5){return function(_0x267321){try{if(!_[_0x09d6('0x8')](this[_0x09d6('0x9')]['UserId'])){logger[_0x09d6('0xa')](_0x09d6('0xb'),_0x858d1c,_0x09d6('0xc'));return _0x267321[_0x09d6('0xd')]();}var _0x30566e={'ContactId':this[_0x09d6('0xe')]['id'],'sentAt':moment()[_0x09d6('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x09d6('0x10')]===_0x09d6('0x11')||this[_0x09d6('0x10')]===_0x09d6('0x12')){_0x30566e[_0x09d6('0x13')]=this[_0x09d6('0x9')][_0x09d6('0x13')];}var _0x429daf=this['channel'];if(_0x429daf===_0x09d6('0x14')){_0x30566e[_0x09d6('0x15')]=this[_0x09d6('0x16')]['id'];}else{_0x30566e[_[_0x09d6('0x17')](_0x429daf)+_0x09d6('0x18')]=this[_0x09d6('0x16')]['id'];}_0x30566e[_[_0x09d6('0x17')](_0x429daf)+'InteractionId']=this[_0x09d6('0x9')]['id'];if(this[_0x09d6('0x9')][_0x09d6('0x19')]){var _0xf3141a=_0x3f9bd5[0x4];if(!_[_0x09d6('0x1a')](_0xf3141a)){_0x30566e[_0x09d6('0x1b')]=utils[_0x09d6('0x1c')](_0xf3141a,this);return rpc[_0x429daf+_0x09d6('0x1d')][_0x09d6('0x1e')](_0x30566e)[_0x09d6('0x1f')](function(_0x475d77){logger[_0x09d6('0xa')](_0x09d6('0xb'),_0x858d1c,_0x30566e[_0x09d6('0x1b')]);})[_0x09d6('0x20')](function(_0x5515e9){logger[_0x09d6('0x21')](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x5515e9));})[_0x09d6('0x23')](function(){logger[_0x09d6('0xa')](_0x09d6('0x24'),_0x858d1c);_0x267321[_0x09d6('0x25')]();});}else{logger[_0x09d6('0xa')](_0x09d6('0x26'),_0x858d1c);_0x267321[_0x09d6('0x25')]();}}else{var _0xc484d5=this;var _0x4111ee=new AWS[(_0x09d6('0x27'))]({'accessKeyId':_0x3f9bd5[0x0],'secretAccessKey':_0x3f9bd5[0x1],'region':_0x3f9bd5[0x2]});var _0x39999d={'botAlias':'$LATEST','botName':_0x3f9bd5[0x3],'inputText':this[_0x09d6('0x28')][_0x09d6('0x1b')],'userId':this['channel']+':'+this['interaction']['id'][_0x09d6('0x29')]()};_0x4111ee[_0x09d6('0x2a')](_0x39999d,function(_0xc96fa1,_0x57a07f){if(_0xc96fa1){logger['error'](_0x09d6('0xb'),_0x858d1c,_0xc96fa1[_0x09d6('0x28')]);_0x267321['next']();}else if(_0x57a07f&&_0x57a07f['message']){_0xc484d5[_0x09d6('0x1b')]['amazonlex']=_0x57a07f;_0x30566e['body']=_0x57a07f[_0x09d6('0x28')];_0x30566e[_0x09d6('0x2b')]=_0x09d6('0x2c');_0x30566e[_0x09d6('0x2d')]=JSON[_0x09d6('0x22')](_0x57a07f);return rpc[_0x429daf+_0x09d6('0x1d')]['create'](_0x30566e)[_0x09d6('0x1f')](function(_0x189d5a){logger[_0x09d6('0xa')]('[%s][AMAZONLEX]\x20%s',_0x858d1c,_0x30566e[_0x09d6('0x1b')]);if(_0x57a07f[_0x09d6('0x2e')]==_0x09d6('0x2f')){_0x267321[_0x09d6('0xd')]();}else{_0x267321['stop']();}})['catch'](function(_0x31f087){logger[_0x09d6('0x21')](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x31f087));_0x267321['next']();});}else{_0x267321[_0x09d6('0xd')]();}});}}catch(_0x105bb1){logger['error'](_0x09d6('0xb'),_0x858d1c,JSON[_0x09d6('0x22')](_0x105bb1));_0x267321[_0x09d6('0x25')]();}};}; \ No newline at end of file +var _0x31c2=['LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','then','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop'];(function(_0x23402b,_0x421ac9){var _0x3a21c7=function(_0x3608ec){while(--_0x3608ec){_0x23402b['push'](_0x23402b['shift']());}};_0x3a21c7(++_0x421ac9);}(_0x31c2,0x192));var _0x231c=function(_0x2eb8f8,_0x58b504){_0x2eb8f8=_0x2eb8f8-0x0;var _0x5770c1=_0x31c2[_0x2eb8f8];return _0x5770c1;};'use strict';var _=require(_0x231c('0x0'));var moment=require(_0x231c('0x1'));var AWS=require(_0x231c('0x2'));var utils=require(_0x231c('0x3'));var logger=require('../../../../config/logger')(_0x231c('0x4'));var rpc={'chatMessage':require(_0x231c('0x5')),'openchannelMessage':require(_0x231c('0x6')),'mailMessage':require(_0x231c('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x231c('0x8'))};exports['consequence']=function(_0x5532c6,_0x5187c2){return function(_0x2ce3bc){try{if(!_[_0x231c('0x9')](this[_0x231c('0xa')][_0x231c('0xb')])){logger[_0x231c('0xc')](_0x231c('0xd'),_0x5532c6,_0x231c('0xe'));return _0x2ce3bc[_0x231c('0xf')]();}var _0x3dcc80={'ContactId':this[_0x231c('0x10')]['id'],'sentAt':moment()[_0x231c('0x11')](_0x231c('0x12')),'direction':_0x231c('0x13')};if(this[_0x231c('0x14')]===_0x231c('0x15')||this[_0x231c('0x14')]==='whatsapp'){_0x3dcc80['phone']=this[_0x231c('0xa')][_0x231c('0x16')];}var _0x58ff08=this[_0x231c('0x14')];if(_0x58ff08==='chat'){_0x3dcc80[_0x231c('0x17')]=this[_0x231c('0x18')]['id'];}else{_0x3dcc80[_[_0x231c('0x19')](_0x58ff08)+_0x231c('0x1a')]=this[_0x231c('0x18')]['id'];}_0x3dcc80[_[_0x231c('0x19')](_0x58ff08)+_0x231c('0x1b')]=this[_0x231c('0xa')]['id'];if(this[_0x231c('0xa')]['created']){var _0x57e5fa=_0x5187c2[0x4];if(!_[_0x231c('0x1c')](_0x57e5fa)){_0x3dcc80[_0x231c('0x1d')]=utils[_0x231c('0x1e')](_0x57e5fa,this);return rpc[_0x58ff08+'Message'][_0x231c('0x1f')](_0x3dcc80)['then'](function(_0x4824a4){logger[_0x231c('0xc')](_0x231c('0xd'),_0x5532c6,_0x3dcc80[_0x231c('0x1d')]);})[_0x231c('0x20')](function(_0x296264){logger[_0x231c('0x21')](_0x231c('0xd'),_0x5532c6,JSON[_0x231c('0x22')](_0x296264));})[_0x231c('0x23')](function(){logger['info'](_0x231c('0x24'),_0x5532c6);_0x2ce3bc['stop']();});}else{logger['info'](_0x231c('0x25'),_0x5532c6);_0x2ce3bc[_0x231c('0x26')]();}}else{var _0x2f712d=this;var _0x2e0381=new AWS[(_0x231c('0x27'))]({'accessKeyId':_0x5187c2[0x0],'secretAccessKey':_0x5187c2[0x1],'region':_0x5187c2[0x2]});var _0x243de7={'botAlias':_0x231c('0x28'),'botName':_0x5187c2[0x3],'inputText':this[_0x231c('0x29')][_0x231c('0x1d')],'userId':this[_0x231c('0x14')]+':'+this['interaction']['id'][_0x231c('0x2a')]()};_0x2e0381[_0x231c('0x2b')](_0x243de7,function(_0x450946,_0x518b8b){if(_0x450946){logger['error']('[%s][AMAZONLEX]\x20%s',_0x5532c6,_0x450946[_0x231c('0x29')]);_0x2ce3bc[_0x231c('0xf')]();}else if(_0x518b8b&&_0x518b8b['message']){_0x2f712d['body'][_0x231c('0x2c')]=_0x518b8b;_0x3dcc80[_0x231c('0x1d')]=_0x518b8b[_0x231c('0x29')];_0x3dcc80[_0x231c('0x2d')]='amazonlex';_0x3dcc80[_0x231c('0x2e')]=JSON['stringify'](_0x518b8b);return rpc[_0x58ff08+_0x231c('0x2f')][_0x231c('0x1f')](_0x3dcc80)[_0x231c('0x30')](function(_0x307431){logger[_0x231c('0xc')]('[%s][AMAZONLEX]\x20%s',_0x5532c6,_0x3dcc80[_0x231c('0x1d')]);if(_0x518b8b['dialogState']=='Failed'){_0x2ce3bc[_0x231c('0xf')]();}else{_0x2ce3bc['stop']();}})[_0x231c('0x20')](function(_0x304b6a){logger[_0x231c('0x21')]('[%s][AMAZONLEX]\x20%s',_0x5532c6,JSON[_0x231c('0x22')](_0x304b6a));_0x2ce3bc['next']();});}else{_0x2ce3bc[_0x231c('0xf')]();}});}}catch(_0x20b0b9){logger[_0x231c('0x21')](_0x231c('0xd'),_0x5532c6,JSON[_0x231c('0x22')](_0x20b0b9));_0x2ce3bc[_0x231c('0x26')]();}};}; \ 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 19bd6b4..2bbe8f2 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 _0x3812=['One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','upperFirst','AccountId','InteractionId','Message','messageId','','replace','','headers','All','account','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3812,0x135));var _0x2381=function(_0x5792cd,_0x2fadad){_0x5792cd=_0x5792cd-0x0;var _0x1c0293=_0x3812[_0x5792cd];return _0x1c0293;};'use strict';var _=require(_0x2381('0x0'));var moment=require(_0x2381('0x1'));var utils=require('./utils');var logger=require(_0x2381('0x2'))(_0x2381('0x3'));var rpc={'chatMessage':require(_0x2381('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2381('0x5')),'smsMessage':require(_0x2381('0x6')),'faxMessage':require(_0x2381('0x7')),'whatsappMessage':require(_0x2381('0x8')),'chatInteraction':require(_0x2381('0x9')),'openchannelInteraction':require(_0x2381('0xa')),'mailInteraction':require(_0x2381('0xb')),'smsInteraction':require(_0x2381('0xc')),'faxInteraction':require(_0x2381('0xd')),'whatsappInteraction':require(_0x2381('0xe'))};var mailRpc=require(_0x2381('0xf'));exports['consequence']=function(_0x2ba8e5,_0x33159b,_0x1ec883,_0x3934f8){return function(_0x23a197){try{var _0x7c67be=this['channel'];if(_0x7c67be===_0x2381('0x10')&&_0x3934f8[_0x2381('0x11')]['isAutoreply']){logger[_0x2381('0x12')](_0x2381('0x13'),_0x2ba8e5,_0x2381('0x14'));return _0x23a197[_0x2381('0x15')]();}if(_0x33159b[0x0]==='1'&&(_[_0x2381('0x16')](this['interaction'][_0x2381('0x17')])||!this[_0x2381('0x18')][_0x2381('0x17')])){logger[_0x2381('0x12')](_0x2381('0x13'),_0x2ba8e5,'Autoreply\x20already\x20sent');return _0x23a197[_0x2381('0x15')]();}if(_0x33159b[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,_0x2381('0x1a'));return _0x23a197['next']();}var _0x5835b8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2381('0x1b')](_0x2381('0x1c')),'direction':_0x2381('0x1d')};if(this[_0x2381('0x1e')]===_0x2381('0x10')){_0x5835b8[_0x2381('0x11')]=utils['getMustacheRender'](_0x33159b[0x2],this);}else{_0x5835b8[_0x2381('0x11')]=utils[_0x2381('0x1f')](_0x33159b[0x1],this);}if(this[_0x2381('0x20')]){_0x5835b8['to']=this[_0x2381('0x20')][_0x2381('0x21')]||'';if(this[_0x2381('0x1e')]===_0x2381('0x10')&&_0x33159b[0x1]==='1'){_0x5835b8['cc']=this[_0x2381('0x20')]['cc']||'';}_0x5835b8['from']=this[_0x2381('0x20')]['to']||'';_0x5835b8['phone']=this['message'][_0x2381('0x22')]||'';_0x5835b8[_0x2381('0x23')]=!![];if(this[_0x2381('0x20')][_0x2381('0x24')]){_0x5835b8['subject']='';_0x5835b8[_0x2381('0x24')]+=_[_0x2381('0x25')](this[_0x2381('0x20')][_0x2381('0x24')],_0x2381('0x26'))?'':_0x2381('0x27');_0x5835b8[_0x2381('0x24')]+=this[_0x2381('0x20')][_0x2381('0x24')];}}if(this[_0x2381('0x1e')]==='chat'){_0x5835b8[_0x2381('0x28')]=this['account']['id'];}else{_0x5835b8[_[_0x2381('0x29')](this['channel'])+_0x2381('0x2a')]=this['account']['id'];}_0x5835b8[_[_0x2381('0x29')](this[_0x2381('0x1e')])+_0x2381('0x2b')]=this[_0x2381('0x18')]['id'];var _0x311b7f=this[_0x2381('0x18')];if(rpc[this[_0x2381('0x1e')]+_0x2381('0x2c')]){if(this[_0x2381('0x1e')]===_0x2381('0x10')){_0x5835b8['inReplyTo']=this[_0x2381('0x20')][_0x2381('0x2d')];_0x5835b8['html']=_0x2381('0x2e')+_[_0x2381('0x2f')](_0x5835b8[_0x2381('0x11')],_0x2381('0x30'),_0x2381('0x31'))+_0x2381('0x32');_0x5835b8[_0x2381('0x33')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2381('0x34'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x2381('0x35')]['smtpOptions'],_0x5835b8)[_0x2381('0x36')](function(_0xa1d5a6){logger[_0x2381('0x12')](_0x2381('0x37'),_0x2ba8e5);_0x5835b8['messageId']=_0xa1d5a6[_0x2381('0x20')][_0x2381('0x2d')];return rpc[_0x7c67be+_0x2381('0x2c')][_0x2381('0x38')](_0x5835b8);})[_0x2381('0x36')](function(_0x3e789e){logger['info'](_0x2381('0x13'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x3e789e));})[_0x2381('0x3a')](function(_0x279f9a){logger[_0x2381('0x3b')](_0x2381('0x3c'),_0x2ba8e5,JSON['stringify'](_0x279f9a));})[_0x2381('0x3d')](function(){Promise['resolve']()[_0x2381('0x36')](function(){if(_0x33159b[0x0]!=='2'||_0x311b7f['autoreplyExecuted'])return;return rpc[_0x7c67be+'Interaction']['update'](_0x311b7f['id'],{'autoreplyExecuted':!![]})['then'](function(_0x323240){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,JSON['stringify'](_0x323240));})[_0x2381('0x3a')](function(_0x1dde10){logger[_0x2381('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2ba8e5,JSON[_0x2381('0x39')](_0x1dde10));});})[_0x2381('0x36')](function(){_0x23a197['next']();});});}else{return rpc[this[_0x2381('0x1e')]+_0x2381('0x2c')]['create'](_0x5835b8)[_0x2381('0x36')](function(){logger[_0x2381('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2ba8e5,_0x5835b8[_0x2381('0x11')]);})['catch'](function(_0x2b16a6){logger[_0x2381('0x3b')](_0x2381('0x13'),_0x2ba8e5,JSON['stringify'](_0x2b16a6));})[_0x2381('0x3d')](function(){Promise[_0x2381('0x3e')]()[_0x2381('0x36')](function(){if(_0x33159b[0x0]!=='2'||_0x311b7f['autoreplyExecuted'])return;return rpc[_0x7c67be+_0x2381('0x3f')][_0x2381('0x40')](_0x311b7f['id'],{'autoreplyExecuted':!![]})[_0x2381('0x36')](function(_0x3d426a){logger[_0x2381('0x12')](_0x2381('0x19'),_0x2ba8e5,JSON['stringify'](_0x3d426a));})[_0x2381('0x3a')](function(_0x1e9782){logger[_0x2381('0x3b')](_0x2381('0x41'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x1e9782));});})['then'](function(){_0x23a197[_0x2381('0x15')]();});});}}}catch(_0x2c3ac3){logger[_0x2381('0x3b')](_0x2381('0x13'),_0x2ba8e5,JSON[_0x2381('0x39')](_0x2c3ac3));_0x23a197[_0x2381('0x42')]();}};}; \ No newline at end of file +var _0x03f6=['../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','finally','resolve','autoreplyExecuted','Interaction','update','create','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3d3868,_0x418502){var _0x103850=function(_0xc4cc15){while(--_0xc4cc15){_0x3d3868['push'](_0x3d3868['shift']());}};_0x103850(++_0x418502);}(_0x03f6,0x157));var _0x603f=function(_0x526b62,_0xa25476){_0x526b62=_0x526b62-0x0;var _0x148bb6=_0x03f6[_0x526b62];return _0x148bb6;};'use strict';var _=require(_0x603f('0x0'));var moment=require(_0x603f('0x1'));var utils=require(_0x603f('0x2'));var logger=require(_0x603f('0x3'))('routing');var rpc={'chatMessage':require(_0x603f('0x4')),'openchannelMessage':require(_0x603f('0x5')),'mailMessage':require(_0x603f('0x6')),'smsMessage':require(_0x603f('0x7')),'faxMessage':require(_0x603f('0x8')),'whatsappMessage':require(_0x603f('0x9')),'chatInteraction':require(_0x603f('0xa')),'openchannelInteraction':require(_0x603f('0xb')),'mailInteraction':require(_0x603f('0xc')),'smsInteraction':require(_0x603f('0xd')),'faxInteraction':require(_0x603f('0xe')),'whatsappInteraction':require(_0x603f('0xf'))};var mailRpc=require(_0x603f('0x10'));exports[_0x603f('0x11')]=function(_0x1c3271,_0x4d4970,_0x2de189,_0x328be5){return function(_0x561a09){try{var _0x2f5ee9=this[_0x603f('0x12')];if(_0x2f5ee9==='mail'&&_0x328be5[_0x603f('0x13')][_0x603f('0x14')]){logger[_0x603f('0x15')](_0x603f('0x16'),_0x1c3271,_0x603f('0x17'));return _0x561a09['next']();}if(_0x4d4970[0x0]==='1'&&(_[_0x603f('0x18')](this[_0x603f('0x19')][_0x603f('0x1a')])||!this[_0x603f('0x19')]['created'])){logger[_0x603f('0x15')](_0x603f('0x16'),_0x1c3271,'Autoreply\x20already\x20sent');return _0x561a09[_0x603f('0x1b')]();}if(_0x4d4970[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0x603f('0x1c'),_0x1c3271,'One\x20Time\x20already\x20sent');return _0x561a09[_0x603f('0x1b')]();}var _0x3c341a={'ContactId':this[_0x603f('0x1d')]['id'],'sentAt':moment()[_0x603f('0x1e')](_0x603f('0x1f')),'direction':_0x603f('0x20')};if(this[_0x603f('0x12')]===_0x603f('0x21')){_0x3c341a[_0x603f('0x13')]=utils[_0x603f('0x22')](_0x4d4970[0x2],this);}else{_0x3c341a['body']=utils[_0x603f('0x22')](_0x4d4970[0x1],this);}if(this[_0x603f('0x23')]){_0x3c341a['to']=this['message'][_0x603f('0x24')]||'';if(this[_0x603f('0x12')]===_0x603f('0x21')&&_0x4d4970[0x1]==='1'){_0x3c341a['cc']=this[_0x603f('0x23')]['cc']||'';}_0x3c341a[_0x603f('0x24')]=this['message']['to']||'';_0x3c341a[_0x603f('0x25')]=this['message'][_0x603f('0x25')]||'';_0x3c341a[_0x603f('0x26')]=!![];if(this['message'][_0x603f('0x27')]){_0x3c341a[_0x603f('0x27')]='';_0x3c341a[_0x603f('0x27')]+=_[_0x603f('0x28')](this[_0x603f('0x23')]['subject'],_0x603f('0x29'))?'':'Re:\x20';_0x3c341a[_0x603f('0x27')]+=this[_0x603f('0x23')][_0x603f('0x27')];}}if(this[_0x603f('0x12')]===_0x603f('0x2a')){_0x3c341a[_0x603f('0x2b')]=this[_0x603f('0x2c')]['id'];}else{_0x3c341a[_[_0x603f('0x2d')](this[_0x603f('0x12')])+'AccountId']=this[_0x603f('0x2c')]['id'];}_0x3c341a[_[_0x603f('0x2d')](this[_0x603f('0x12')])+'InteractionId']=this[_0x603f('0x19')]['id'];var _0x55a21f=this[_0x603f('0x19')];if(rpc[this[_0x603f('0x12')]+_0x603f('0x2e')]){if(this[_0x603f('0x12')]===_0x603f('0x21')){_0x3c341a[_0x603f('0x2f')]=this[_0x603f('0x23')][_0x603f('0x30')];_0x3c341a[_0x603f('0x31')]=_0x603f('0x32')+_[_0x603f('0x33')](_0x3c341a[_0x603f('0x13')],_0x603f('0x34'),']+(>|$)/g,''),'priorityTrue':_0x20309f[0x1],'priorityFalse':_0x20309f[0x2]};var _0x4185a8=gotoif[_0x4096('0x0')](_0xd0791e,{'typecast':!![]});if(_0x4185a8['length']){logger[_0x4096('0xc')]('[%s][GOTOIF]\x20%s',_0x16e68b,_[_0x4096('0xd')](_0x4185a8,'message')[_0x4096('0xe')](',\x20'));_0x1cfca4[_0x4096('0xf')]();}else{try{var _0x2604b1=eval('('+_0xd0791e['condition']+')');var _0x20a9dc=_0x2604b1?_0xd0791e[_0x4096('0x10')]:_0xd0791e['priorityFalse'];logger['info'](_0x4096('0x11'),_0x16e68b,_0xd0791e[_0x4096('0x12')],_0x2604b1,_0x20a9dc||'next');if(_0x20a9dc){var _0x4eeb4=_['findIndex'](_0x1cfca4['rules'](),{'p':_0x20a9dc});if(_0x4eeb4>=0x0){logger[_0x4096('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x16e68b,_0x20a9dc||_0x4096('0x14'),_0x4eeb4);_0x1cfca4[_0x4096('0x14')](_0x4eeb4);}else{logger[_0x4096('0x13')](_0x4096('0x15'),_0x16e68b,_0x20a9dc||_0x4096('0x14'));_0x1cfca4['stop']();}}else{_0x1cfca4[_0x4096('0x14')]();}}catch(_0x3c926f){logger[_0x4096('0xc')](_0x4096('0x16'),_0x16e68b,_0x3c926f[_0x4096('0x17')]);_0x1cfca4[_0x4096('0xf')]();}}}catch(_0x4a37f8){logger[_0x4096('0xc')](_0x4096('0x18'),_0x16e68b,JSON[_0x4096('0x19')](_0x4a37f8));_0x1cfca4[_0x4096('0xf')]();}};}; \ No newline at end of file +var _0x7bf4=['stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','error','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','getMustacheRender','validate','length','[%s][GOTOIF]\x20%s','map'];(function(_0x1cfb1b,_0x565fad){var _0x22bd89=function(_0x51c85d){while(--_0x51c85d){_0x1cfb1b['push'](_0x1cfb1b['shift']());}};_0x22bd89(++_0x565fad);}(_0x7bf4,0x78));var _0x47bf=function(_0x162b6a,_0xaa8814){_0x162b6a=_0x162b6a-0x0;var _0x2478c6=_0x7bf4[_0x162b6a];return _0x2478c6;};'use strict';var schema=require('validate');var _=require(_0x47bf('0x0'));var htmlToText=require(_0x47bf('0x1'));var utils=require(_0x47bf('0x2'));var logger=require(_0x47bf('0x3'))(_0x47bf('0x4'));var gotoif=schema({'condition':{'type':_0x47bf('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x47bf('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x1b68f4,_0x1ac758){return function(_0x4b8e17){try{var _0x46f508={'condition':htmlToText['fromString'](utils[_0x47bf('0x7')](_0x1ac758[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ac758[0x1],'priorityFalse':_0x1ac758[0x2]};var _0x1136dc=gotoif[_0x47bf('0x8')](_0x46f508,{'typecast':!![]});if(_0x1136dc[_0x47bf('0x9')]){logger['error'](_0x47bf('0xa'),_0x1b68f4,_[_0x47bf('0xb')](_0x1136dc,'message')['join'](',\x20'));_0x4b8e17[_0x47bf('0xc')]();}else{try{var _0x4054ac=eval('('+_0x46f508[_0x47bf('0xd')]+')');var _0xae3152=_0x4054ac?_0x46f508[_0x47bf('0xe')]:_0x46f508[_0x47bf('0xf')];logger[_0x47bf('0x10')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1b68f4,_0x46f508[_0x47bf('0xd')],_0x4054ac,_0xae3152||_0x47bf('0x11'));if(_0xae3152){var _0x28f9ee=_['findIndex'](_0x4b8e17[_0x47bf('0x12')](),{'p':_0xae3152});if(_0x28f9ee>=0x0){logger[_0x47bf('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1b68f4,_0xae3152||_0x47bf('0x11'),_0x28f9ee);_0x4b8e17[_0x47bf('0x11')](_0x28f9ee);}else{logger[_0x47bf('0x10')](_0x47bf('0x13'),_0x1b68f4,_0xae3152||'next');_0x4b8e17[_0x47bf('0xc')]();}}else{_0x4b8e17[_0x47bf('0x11')]();}}catch(_0x33fd65){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1b68f4,_0x33fd65[_0x47bf('0x14')]);_0x4b8e17['stop']();}}}catch(_0x2916fd){logger[_0x47bf('0x15')](_0x47bf('0xa'),_0x1b68f4,JSON['stringify'](_0x2916fd));_0x4b8e17[_0x47bf('0xc')]();}};}; \ 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 a721989..954b41f 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 _0x3ed6=['[%s][GOTOP]\x20%s','map','message','join','stop','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error'];(function(_0x17edac,_0x30535a){var _0x1e96d6=function(_0x5b9e00){while(--_0x5b9e00){_0x17edac['push'](_0x17edac['shift']());}};_0x1e96d6(++_0x30535a);}(_0x3ed6,0x107));var _0x63ed=function(_0x81a792,_0x1cd2be){_0x81a792=_0x81a792-0x0;var _0x35d356=_0x3ed6[_0x81a792];return _0x35d356;};'use strict';var schema=require(_0x63ed('0x0'));var _=require(_0x63ed('0x1'));var logger=require(_0x63ed('0x2'))('routing');var gotop=schema({'priority':{'type':_0x63ed('0x3'),'required':!![],'message':_0x63ed('0x4')}});exports['consequence']=function(_0x18656a,_0xb5130a){return function(_0x14763f){try{var _0xe624bd={'priority':_0xb5130a[0x0]};var _0x10aa22=gotop[_0x63ed('0x0')](_0xe624bd,{'typecast':!![]});if(_0x10aa22[_0x63ed('0x5')]){logger[_0x63ed('0x6')](_0x63ed('0x7'),_0x18656a,_[_0x63ed('0x8')](_0x10aa22,_0x63ed('0x9'))[_0x63ed('0xa')](',\x20'));_0x14763f[_0x63ed('0xb')]();}else{logger[_0x63ed('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x18656a,_0xe624bd[_0x63ed('0xd')]);if(_0xe624bd['priority']){var _0x20f4e8=_[_0x63ed('0xe')](_0x14763f['rules'](),{'p':_0xe624bd[_0x63ed('0xd')]});if(_0x20f4e8>=0x0){logger[_0x63ed('0xc')](_0x63ed('0xf'),_0x18656a,_0xe624bd['priority']||_0x63ed('0x10'),_0x20f4e8);_0x14763f['next'](_0x20f4e8);}else{logger[_0x63ed('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x18656a,_0xe624bd['priority']||_0x63ed('0x10'));_0x14763f[_0x63ed('0xb')]();}}else{_0x14763f['next']();}}}catch(_0x11508f){logger[_0x63ed('0x6')](_0x63ed('0x7'),_0x18656a,JSON[_0x63ed('0x11')](_0x11508f));_0x14763f[_0x63ed('0xb')]();}};}; \ No newline at end of file +var _0x7fbe=['findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','lodash','../../../../config/logger','number','consequence','validate','error','[%s][GOTOP]\x20%s','map','join','stop','priority'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7fbe,0x105));var _0xe7fb=function(_0x423dd4,_0x287532){_0x423dd4=_0x423dd4-0x0;var _0xb29406=_0x7fbe[_0x423dd4];return _0xb29406;};'use strict';var schema=require('validate');var _=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))('routing');var gotop=schema({'priority':{'type':_0xe7fb('0x2'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xe7fb('0x3')]=function(_0x1aa5f2,_0x3ba7d8){return function(_0x4b9adb){try{var _0x5ecf67={'priority':_0x3ba7d8[0x0]};var _0x26e07f=gotop[_0xe7fb('0x4')](_0x5ecf67,{'typecast':!![]});if(_0x26e07f['length']){logger[_0xe7fb('0x5')](_0xe7fb('0x6'),_0x1aa5f2,_[_0xe7fb('0x7')](_0x26e07f,'message')[_0xe7fb('0x8')](',\x20'));_0x4b9adb[_0xe7fb('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x1aa5f2,_0x5ecf67['priority']);if(_0x5ecf67[_0xe7fb('0xa')]){var _0x567a3c=_[_0xe7fb('0xb')](_0x4b9adb[_0xe7fb('0xc')](),{'p':_0x5ecf67[_0xe7fb('0xa')]});if(_0x567a3c>=0x0){logger[_0xe7fb('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1aa5f2,_0x5ecf67[_0xe7fb('0xa')]||_0xe7fb('0xe'),_0x567a3c);_0x4b9adb['next'](_0x567a3c);}else{logger[_0xe7fb('0xd')](_0xe7fb('0xf'),_0x1aa5f2,_0x5ecf67['priority']||_0xe7fb('0xe'));_0x4b9adb['stop']();}}else{_0x4b9adb['next']();}}}catch(_0x547def){logger[_0xe7fb('0x5')]('[%s][GOTOP]\x20%s',_0x1aa5f2,JSON['stringify'](_0x547def));_0x4b9adb[_0xe7fb('0x9')]();}};}; \ 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 40a2d6f..6e5bd35 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 _0x0abf=['[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','interaction','Message','create','then','info'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var utils=require('./utils');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf0ab('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf0ab('0x4')),'whatsappMessage':require(_0xf0ab('0x5'))};exports[_0xf0ab('0x6')]=function(_0xbb1f91,_0x2ab7d6){return function(_0x4d2ea8){try{var _0x233afe={'body':utils['getMustacheRender'](_0x2ab7d6[0x0],this),'ContactId':this[_0xf0ab('0x7')]['id']};if(this[_0xf0ab('0x8')]===_0xf0ab('0x9')){_0x233afe[_0xf0ab('0xa')]=this['account']['id'];}else{_0x233afe[_[_0xf0ab('0xb')](this[_0xf0ab('0x8')])+_0xf0ab('0xc')]=this['account']['id'];}_0x233afe[_['upperFirst'](this[_0xf0ab('0x8')])+'InteractionId']=this[_0xf0ab('0xd')]['id'];if(rpc[this[_0xf0ab('0x8')]+_0xf0ab('0xe')]){return rpc[this[_0xf0ab('0x8')]+_0xf0ab('0xe')][_0xf0ab('0xf')](_0x233afe)[_0xf0ab('0x10')](function(_0x4fdd5f){logger[_0xf0ab('0x11')](_0xf0ab('0x12'),_0xbb1f91,_0x233afe[_0xf0ab('0x13')]);_0x4d2ea8[_0xf0ab('0x14')]();})[_0xf0ab('0x15')](function(_0x36cabe){logger[_0xf0ab('0x16')](_0xf0ab('0x12'),_0xbb1f91,JSON[_0xf0ab('0x17')](_0x36cabe));_0x4d2ea8[_0xf0ab('0x18')]();});}}catch(_0x20f453){logger[_0xf0ab('0x16')](_0xf0ab('0x12'),_0xbb1f91,JSON[_0xf0ab('0x17')](_0x20f453));_0x4d2ea8[_0xf0ab('0x18')]();}};}; \ No newline at end of file +var _0x2d6d=['channel','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','interaction','Message','create','then','info','body','next','catch','stringify','stop','error','[%s][MESSAGE]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender'];(function(_0x5835d1,_0x48b47c){var _0x931c2a=function(_0x46a810){while(--_0x46a810){_0x5835d1['push'](_0x5835d1['shift']());}};_0x931c2a(++_0x48b47c);}(_0x2d6d,0x66));var _0xd2d6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x2d6d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xd2d6('0x0'));var utils=require(_0xd2d6('0x1'));var logger=require(_0xd2d6('0x2'))(_0xd2d6('0x3'));var rpc={'chatMessage':require(_0xd2d6('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd2d6('0x5')),'faxMessage':require(_0xd2d6('0x6')),'whatsappMessage':require(_0xd2d6('0x7'))};exports[_0xd2d6('0x8')]=function(_0x2f954f,_0xb06e5d){return function(_0x3cdb37){try{var _0x24207a={'body':utils[_0xd2d6('0x9')](_0xb06e5d[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd2d6('0xa')]==='chat'){_0x24207a[_0xd2d6('0xb')]=this['account']['id'];}else{_0x24207a[_['upperFirst'](this[_0xd2d6('0xa')])+_0xd2d6('0xc')]=this[_0xd2d6('0xd')]['id'];}_0x24207a[_[_0xd2d6('0xe')](this[_0xd2d6('0xa')])+_0xd2d6('0xf')]=this[_0xd2d6('0x10')]['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xd2d6('0xa')]+_0xd2d6('0x11')][_0xd2d6('0x12')](_0x24207a)[_0xd2d6('0x13')](function(_0x38a8be){logger[_0xd2d6('0x14')]('[%s][MESSAGE]\x20%s',_0x2f954f,_0x24207a[_0xd2d6('0x15')]);_0x3cdb37[_0xd2d6('0x16')]();})[_0xd2d6('0x17')](function(_0x439e3d){logger['error']('[%s][MESSAGE]\x20%s',_0x2f954f,JSON[_0xd2d6('0x18')](_0x439e3d));_0x3cdb37[_0xd2d6('0x19')]();});}}catch(_0x2a4b1a){logger[_0xd2d6('0x1a')](_0xd2d6('0x1b'),_0x2f954f,JSON[_0xd2d6('0x18')](_0x2a4b1a));_0x3cdb37['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 1a0b505..283182a 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 _0xc492=['stringify','stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','error'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xc492,0x146));var _0x2c49=function(_0x268c94,_0x3cf72d){_0x268c94=_0x268c94-0x0;var _0x3c60a4=_0xc492[_0x268c94];return _0x3c60a4;};'use strict';var utils=require('./utils');var logger=require(_0x2c49('0x0'))(_0x2c49('0x1'));exports[_0x2c49('0x2')]=function(_0x103f61,_0x4aae40){return function(_0x18afd2){try{logger[_0x2c49('0x3')](_0x2c49('0x4'),_0x103f61,utils[_0x2c49('0x5')](_0x4aae40[0x0],this));_0x18afd2['next']();}catch(_0x1043c1){logger[_0x2c49('0x6')](_0x2c49('0x4'),_0x103f61,JSON[_0x2c49('0x7')](_0x1043c1));_0x18afd2[_0x2c49('0x8')]();}};}; \ No newline at end of file +var _0x106b=['getMustacheRender','next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x528f23,_0x213659){var _0x556acd=function(_0x3770a2){while(--_0x3770a2){_0x528f23['push'](_0x528f23['shift']());}};_0x556acd(++_0x213659);}(_0x106b,0x1c7));var _0xb106=function(_0x4ba380,_0x259bee){_0x4ba380=_0x4ba380-0x0;var _0x4b111b=_0x106b[_0x4ba380];return _0x4b111b;};'use strict';var utils=require(_0xb106('0x0'));var logger=require('../../../../config/logger')(_0xb106('0x1'));exports[_0xb106('0x2')]=function(_0x16a501,_0x14f7b4){return function(_0x50a85c){try{logger[_0xb106('0x3')](_0xb106('0x4'),_0x16a501,utils[_0xb106('0x5')](_0x14f7b4[0x0],this));_0x50a85c[_0xb106('0x6')]();}catch(_0x31abbe){logger[_0xb106('0x7')]('[%s][NOOP]\x20%s',_0x16a501,JSON[_0xb106('0x8')](_0x31abbe));_0x50a85c[_0xb106('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 383bddd..dc3ccf6 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 _0x9390=['from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','../../../../config/environment','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','joinAt','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x27ca07,_0x326280){var _0x54d51a=function(_0xf7a0ed){while(--_0xf7a0ed){_0x27ca07['push'](_0x27ca07['shift']());}};_0x54d51a(++_0x326280);}(_0x9390,0xc7));var _0x0939=function(_0x4ba96e,_0x2469d4){_0x4ba96e=_0x4ba96e-0x0;var _0x263fa4=_0x9390[_0x4ba96e];return _0x263fa4;};'use strict';var schema=require(_0x0939('0x0'));var _=require('lodash');var util=require(_0x0939('0x1'));var seqqueue=require(_0x0939('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0939('0x3'));var logger=require('../../../../config/logger')(_0x0939('0x4'));var strategy=require(_0x0939('0x5'));config[_0x0939('0x6')]=_['defaults'](config[_0x0939('0x6')],{'host':_0x0939('0x7'),'port':0x18eb});var io=require(_0x0939('0x8'))(new Redis(config[_0x0939('0x6')]));var attributes=['id',_0x0939('0x9'),_0x0939('0xa'),_0x0939('0xb'),'from',_0x0939('0xc')];function emit(_0x5b562b,_0x21c90b,_0xcf172a){io['to'](_0x5b562b)['emit'](_0x21c90b,_0xcf172a);}function emitChannelQueueInteraction(_0x1ef392,_0xb0052e,_0x566522,_0x45ad9,_0x1f62eb,_0x164b66,_0xb36312,_0x54a538){var _0x34c8a9=_['clone'](_0x566522);_0x34c8a9['queue_id']=_0x54a538;_0x34c8a9['queue']=_0xb0052e;_0x34c8a9['account']=_0x45ad9;_0x34c8a9['id']=_0x1f62eb;if(_0x164b66){attributes['push'](_['capitalize'](_0x1ef392)+'InteractionId');_0xb36312[util[_0x0939('0xd')](_0x0939('0xe'),_0x1ef392)][_0x1f62eb]=_[_0x0939('0xf')](_0x34c8a9,attributes);}else{delete _0xb36312[util[_0x0939('0xd')](_0x0939('0xe'),_0x1ef392)][_0x1f62eb];}emit(util[_0x0939('0xd')](_0x0939('0x10'),_0x1ef392,_0xb0052e),util[_0x0939('0xd')](_0x0939('0x11'),_0x1ef392,_0x164b66?_0x0939('0x12'):'remove'),_[_0x0939('0xf')](_0x34c8a9,attributes));}var rpc={'openchannelQueueReport':require(_0x0939('0x13')),'mailQueueReport':require(_0x0939('0x14')),'chatQueueReport':require(_0x0939('0x15')),'smsQueueReport':require(_0x0939('0x16')),'faxQueueReport':require(_0x0939('0x17')),'whatsappQueueReport':require(_0x0939('0x18')),'chatInteraction':require(_0x0939('0x19')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x0939('0x1a')),'openchannelInteraction':require(_0x0939('0x1b')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0939('0x1c'),'message':_0x0939('0x1d')}});function startRouting(_0x5ec9f2,_0x1ba61b,_0x89da51,_0x3e01d2){if(_0x5ec9f2&&_0x1ba61b&&_0x89da51){_0x1ba61b[_0x0939('0x1e')]+=0x1;var _0x3aa422={'uniqueid':_0x5ec9f2,'from':_0x89da51['body']?_0x89da51[_0x0939('0x1f')][_0x0939('0x20')]:'','joinAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'ContactId':_0x89da51[_0x0939('0x22')]?_0x89da51[_0x0939('0x22')]['id']:null,'ListId':_0x89da51[_0x0939('0x23')]?_0x89da51[_0x0939('0x23')]['id']:null};_0x3aa422[_['upperFirst'](_0x89da51[_0x0939('0x24')])+_0x0939('0x25')]=_0x1ba61b['id']||null;_0x3aa422[_[_0x0939('0x26')](_0x89da51[_0x0939('0x24')])+'InteractionId']=_0x89da51[_0x0939('0x27')]?_0x89da51[_0x0939('0x27')]['id']:null;_0x3aa422[_[_0x0939('0x26')](_0x89da51[_0x0939('0x24')])+_0x0939('0x28')]=_0x89da51[_0x0939('0x29')]?_0x89da51[_0x0939('0x29')]['id']:null;_0x3aa422[_['upperFirst'](_0x89da51[_0x0939('0x24')])+(_0x89da51[_0x0939('0x24')]!=='chat'?_0x0939('0x2a'):'WebsiteId')]=_0x89da51['account']?_0x89da51[_0x0939('0xa')]['id']:null;logger['info'](util[_0x0939('0xd')](_0x0939('0x2b'),_0x5ec9f2,_0x1ba61b[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x89da51[_0x0939('0x24')],_0x1ba61b[_0x0939('0x2c')],_0x3aa422,_0x89da51[_0x0939('0xa')]['name'],_0x89da51[_0x0939('0x29')]['id'],!![],_0x3e01d2,_0x1ba61b['id']);if(rpc[_0x89da51['channel']+_0x0939('0x2d')]){return rpc[_0x89da51[_0x0939('0x24')]+_0x0939('0x2d')][_0x0939('0x2e')](_0x3aa422)[_0x0939('0x2f')](function(_0x6ac200){logger['error'](_0x0939('0x30'),_0x6ac200);});}}}function stopRouting(_0x5aa1d3,_0x5e86ed,_0x3c4b1e,_0x3b708f){if(_0x5aa1d3&&_0x5e86ed){_0x5e86ed[_0x0939('0x1e')]-=0x1;var _0x26ef4c={'leaveAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'acceptAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'reason':'accepted'};logger[_0x0939('0x31')](util[_0x0939('0xd')](_0x0939('0x32'),_0x5aa1d3,_0x5e86ed[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x3c4b1e['channel'],_0x5e86ed['name'],_0x3c4b1e[_0x0939('0x1f')],_0x3c4b1e[_0x0939('0xa')][_0x0939('0x2c')],_0x3c4b1e['message']['id'],![],_0x3b708f,_0x5e86ed['id']);return rpc[_0x3c4b1e[_0x0939('0x24')]+_0x0939('0x33')][_0x0939('0x34')](_0x3c4b1e[_0x0939('0x27')]['id'],{'queueId':_0x5e86ed['id']})['then'](function(){if(rpc[_0x3c4b1e['channel']+'QueueReport']){return rpc[_0x3c4b1e['channel']+_0x0939('0x2d')][_0x0939('0x34')](_0x5aa1d3,_0x26ef4c)[_0x0939('0x2f')](function(_0x3257b5){logger[_0x0939('0x35')](_0x0939('0x36'),_0x3257b5);});}});}}function endRouting(_0x138cb9,_0x1e5134,_0x59f06a,_0x3671c0){if(_0x138cb9&&_0x1e5134){_0x1e5134['waiting']-=0x1;var _0x25f1de={'leaveAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'exitAt':moment()[_0x0939('0xd')](_0x0939('0x21')),'reason':_0x0939('0x37')};logger[_0x0939('0x31')](util[_0x0939('0xd')](_0x0939('0x38'),_0x138cb9,_0x1e5134[_0x0939('0x2c')]));emitChannelQueueInteraction(_0x59f06a[_0x0939('0x24')],_0x1e5134[_0x0939('0x2c')],_0x59f06a[_0x0939('0x1f')],_0x59f06a[_0x0939('0xa')]['name'],_0x59f06a['message']['id'],![],_0x3671c0);if(rpc[_0x59f06a[_0x0939('0x24')]+_0x0939('0x2d')]){return rpc[_0x59f06a[_0x0939('0x24')]+_0x0939('0x2d')][_0x0939('0x34')](_0x138cb9,_0x25f1de)[_0x0939('0x2f')](function(_0x4384f1){logger[_0x0939('0x35')]('update\x20queue\x20report',_0x4384f1);});}}}function handleFindQueue(_0x1814ab){return function(_0x116481){return _0x116481[_0x0939('0x2c')][_0x0939('0x39')]()===_0x1814ab['toLowerCase']();};}exports[_0x0939('0x3a')]=function(_0xfd0c6d,_0x291f9f,_0x3cfdcc,_0x504f5c){return function(_0x4d4644){try{var _0x1a1c4d={'name':_0x291f9f[0x0],'timeout':_0x291f9f[0x1]};var _0xe8b51d=queue[_0x0939('0x0')](_0x1a1c4d,{'typecast':!![]});if(_0xe8b51d[_0x0939('0x3b')]){logger[_0x0939('0x35')](_0x0939('0x3c'),_0xfd0c6d,_[_0x0939('0x3d')](_0xe8b51d,_0x0939('0x29'))[_0x0939('0x3e')](',\x20'));_0x4d4644[_0x0939('0x3f')]();}else{var _0x21600f=_[_0x0939('0x40')](_0x3cfdcc[_0x504f5c[_0x0939('0x24')]+_0x0939('0x41')],handleFindQueue(_0x1a1c4d[_0x0939('0x2c')]));if(_0x21600f){startRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);var _0x912b72=(_0x21600f[_0x0939('0x37')]||0xa)*0x3e8;var _0x164693=(_0x1a1c4d[_0x0939('0x37')]||0x14)*0x3e8;var _0x2cc29b;if(_0x912b72>_0x164693){_0x164693=_0x912b72;}var _0x2839ac=seqqueue['createQueue'](_0x912b72);_0x2839ac['id']=_0xfd0c6d;_0x2839ac[_0x0939('0x42')]=_0x912b72;_0x2839ac[_0x0939('0x43')]=_0x164693;_0x2839ac[_0x0939('0x24')]=_0x504f5c[_0x0939('0x24')];_0x3cfdcc['rules'][_0xfd0c6d]['on'](_0x0939('0x44'),function(){logger[_0x0939('0x31')](_0x0939('0x45'),_0xfd0c6d);stopRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);clearTimeout(_0x2cc29b);_0x2cc29b=undefined;_0x2839ac['close'](!![]);if(_0x3cfdcc['rules'][_0xfd0c6d]){delete _0x3cfdcc[_0x0939('0x46')][_0xfd0c6d];}_0x4d4644[_0x0939('0x3f')]();});_0x3cfdcc[_0x0939('0x46')][_0xfd0c6d]['on'](_0x0939('0x47'),function(){if(_0x3cfdcc[_0x0939('0x46')][_0xfd0c6d]){delete _0x3cfdcc['rules'][_0xfd0c6d];}});_0x2cc29b=setTimeout(function(){logger['info'](_0x0939('0x48'),_0xfd0c6d);endRouting(_0xfd0c6d,_0x21600f,_0x504f5c,_0x3cfdcc);clearTimeout(_0x2cc29b);_0x2839ac['close'](!![]);_0x4d4644['next']();},_0x164693);switch(_0x21600f[_0x0939('0x49')]){case _0x0939('0x4a'):strategy['rrmemory'](_0x2839ac,_0x21600f,_0x3cfdcc,_0x504f5c);break;default:strategy['beepall'](_0x2839ac,_0x21600f,_0x3cfdcc,_0x504f5c);}}else{logger[_0x0939('0x35')](_0x0939('0x4b'),_0xfd0c6d,_0x1a1c4d[_0x0939('0x2c')]);_0x4d4644[_0x0939('0x3f')]();}}}catch(_0x473716){logger[_0x0939('0x35')](_0x0939('0x3c'),_0xfd0c6d,_0x473716[_0x0939('0x4c')]);_0x4d4644[_0x0939('0x3f')]();}};}; \ No newline at end of file +var _0xc6ef=['lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','number','timeout\x20is\x20a\x20number','waiting','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','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','Queues','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6ef,0x199));var _0xfc6e=function(_0x6bed71,_0x200826){_0x6bed71=_0x6bed71-0x0;var _0x10388f=_0xc6ef[_0x6bed71];return _0x10388f;};'use strict';var schema=require(_0xfc6e('0x0'));var _=require(_0xfc6e('0x1'));var util=require('util');var seqqueue=require(_0xfc6e('0x2'));var moment=require('moment');var Redis=require(_0xfc6e('0x3'));var config=require(_0xfc6e('0x4'));var logger=require(_0xfc6e('0x5'))(_0xfc6e('0x6'));var strategy=require('./strategy');config[_0xfc6e('0x7')]=_['defaults'](config[_0xfc6e('0x7')],{'host':_0xfc6e('0x8'),'port':0x18eb});var io=require(_0xfc6e('0x9'))(new Redis(config['redis']));var attributes=['id',_0xfc6e('0xa'),_0xfc6e('0xb'),_0xfc6e('0xc'),_0xfc6e('0xd'),_0xfc6e('0xe')];function emit(_0x3f4b90,_0x54c532,_0x537d8b){io['to'](_0x3f4b90)[_0xfc6e('0xf')](_0x54c532,_0x537d8b);}function emitChannelQueueInteraction(_0x20b4ff,_0x25b16d,_0x30330c,_0x657a88,_0x37e915,_0x2c8fbf,_0x2208af,_0xb7c0bd){var _0x33f56d=_[_0xfc6e('0x10')](_0x30330c);_0x33f56d[_0xfc6e('0xa')]=_0xb7c0bd;_0x33f56d['queue']=_0x25b16d;_0x33f56d[_0xfc6e('0xb')]=_0x657a88;_0x33f56d['id']=_0x37e915;if(_0x2c8fbf){attributes['push'](_[_0xfc6e('0x11')](_0x20b4ff)+_0xfc6e('0x12'));_0x2208af[util[_0xfc6e('0x13')](_0xfc6e('0x14'),_0x20b4ff)][_0x37e915]=_[_0xfc6e('0x15')](_0x33f56d,attributes);}else{delete _0x2208af[util[_0xfc6e('0x13')](_0xfc6e('0x14'),_0x20b4ff)][_0x37e915];}emit(util['format']('%s:queue:%s',_0x20b4ff,_0x25b16d),util[_0xfc6e('0x13')](_0xfc6e('0x16'),_0x20b4ff,_0x2c8fbf?_0xfc6e('0x17'):_0xfc6e('0x18')),_[_0xfc6e('0x15')](_0x33f56d,attributes));}var rpc={'openchannelQueueReport':require(_0xfc6e('0x19')),'mailQueueReport':require(_0xfc6e('0x1a')),'chatQueueReport':require(_0xfc6e('0x1b')),'smsQueueReport':require(_0xfc6e('0x1c')),'faxQueueReport':require(_0xfc6e('0x1d')),'whatsappQueueReport':require(_0xfc6e('0x1e')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xfc6e('0x1f')),'mailInteraction':require(_0xfc6e('0x20')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xfc6e('0x21'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xfc6e('0x22'),'message':_0xfc6e('0x23')}});function startRouting(_0x20fa4d,_0xa17b2c,_0x93a09,_0x3b4642){if(_0x20fa4d&&_0xa17b2c&&_0x93a09){_0xa17b2c[_0xfc6e('0x24')]+=0x1;var _0x5f074a={'uniqueid':_0x20fa4d,'from':_0x93a09[_0xfc6e('0x25')]?_0x93a09[_0xfc6e('0x25')][_0xfc6e('0xd')]:'','joinAt':moment()['format'](_0xfc6e('0x26')),'ContactId':_0x93a09[_0xfc6e('0x27')]?_0x93a09['contact']['id']:null,'ListId':_0x93a09[_0xfc6e('0x28')]?_0x93a09[_0xfc6e('0x28')]['id']:null};_0x5f074a[_[_0xfc6e('0x29')](_0x93a09[_0xfc6e('0x2a')])+_0xfc6e('0x2b')]=_0xa17b2c['id']||null;_0x5f074a[_[_0xfc6e('0x29')](_0x93a09[_0xfc6e('0x2a')])+'InteractionId']=_0x93a09[_0xfc6e('0x2c')]?_0x93a09[_0xfc6e('0x2c')]['id']:null;_0x5f074a[_['upperFirst'](_0x93a09[_0xfc6e('0x2a')])+_0xfc6e('0x2d')]=_0x93a09['message']?_0x93a09[_0xfc6e('0x2e')]['id']:null;_0x5f074a[_[_0xfc6e('0x29')](_0x93a09[_0xfc6e('0x2a')])+(_0x93a09[_0xfc6e('0x2a')]!==_0xfc6e('0x2f')?_0xfc6e('0x30'):'WebsiteId')]=_0x93a09[_0xfc6e('0xb')]?_0x93a09[_0xfc6e('0xb')]['id']:null;logger[_0xfc6e('0x31')](util[_0xfc6e('0x13')](_0xfc6e('0x32'),_0x20fa4d,_0xa17b2c['name']));emitChannelQueueInteraction(_0x93a09[_0xfc6e('0x2a')],_0xa17b2c[_0xfc6e('0x33')],_0x5f074a,_0x93a09[_0xfc6e('0xb')]['name'],_0x93a09['message']['id'],!![],_0x3b4642,_0xa17b2c['id']);if(rpc[_0x93a09[_0xfc6e('0x2a')]+_0xfc6e('0x34')]){return rpc[_0x93a09[_0xfc6e('0x2a')]+'QueueReport'][_0xfc6e('0x35')](_0x5f074a)[_0xfc6e('0x36')](function(_0xc08d02){logger[_0xfc6e('0x37')](_0xfc6e('0x38'),_0xc08d02);});}}}function stopRouting(_0x2356e5,_0x349a5f,_0x89927d,_0x1b193e){if(_0x2356e5&&_0x349a5f){_0x349a5f[_0xfc6e('0x24')]-=0x1;var _0x40009f={'leaveAt':moment()[_0xfc6e('0x13')](_0xfc6e('0x26')),'acceptAt':moment()['format'](_0xfc6e('0x26')),'reason':_0xfc6e('0x39')};logger[_0xfc6e('0x31')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x2356e5,_0x349a5f[_0xfc6e('0x33')]));emitChannelQueueInteraction(_0x89927d[_0xfc6e('0x2a')],_0x349a5f[_0xfc6e('0x33')],_0x89927d[_0xfc6e('0x25')],_0x89927d[_0xfc6e('0xb')][_0xfc6e('0x33')],_0x89927d[_0xfc6e('0x2e')]['id'],![],_0x1b193e,_0x349a5f['id']);return rpc[_0x89927d['channel']+'Interaction'][_0xfc6e('0x3a')](_0x89927d[_0xfc6e('0x2c')]['id'],{'queueId':_0x349a5f['id']})['then'](function(){if(rpc[_0x89927d[_0xfc6e('0x2a')]+_0xfc6e('0x34')]){return rpc[_0x89927d[_0xfc6e('0x2a')]+'QueueReport']['update'](_0x2356e5,_0x40009f)[_0xfc6e('0x36')](function(_0x30a04a){logger[_0xfc6e('0x37')](_0xfc6e('0x3b'),_0x30a04a);});}});}}function endRouting(_0x3f3e2a,_0x4001ba,_0x487abc,_0x26b34d){if(_0x3f3e2a&&_0x4001ba){_0x4001ba['waiting']-=0x1;var _0x54f7cb={'leaveAt':moment()[_0xfc6e('0x13')](_0xfc6e('0x26')),'exitAt':moment()[_0xfc6e('0x13')](_0xfc6e('0x26')),'reason':_0xfc6e('0x3c')};logger[_0xfc6e('0x31')](util[_0xfc6e('0x13')](_0xfc6e('0x3d'),_0x3f3e2a,_0x4001ba[_0xfc6e('0x33')]));emitChannelQueueInteraction(_0x487abc[_0xfc6e('0x2a')],_0x4001ba[_0xfc6e('0x33')],_0x487abc['body'],_0x487abc['account'][_0xfc6e('0x33')],_0x487abc['message']['id'],![],_0x26b34d);if(rpc[_0x487abc['channel']+_0xfc6e('0x34')]){return rpc[_0x487abc[_0xfc6e('0x2a')]+'QueueReport'][_0xfc6e('0x3a')](_0x3f3e2a,_0x54f7cb)[_0xfc6e('0x36')](function(_0x3d52c6){logger[_0xfc6e('0x37')]('update\x20queue\x20report',_0x3d52c6);});}}}function handleFindQueue(_0x479656){return function(_0x5bf1fa){return _0x5bf1fa[_0xfc6e('0x33')][_0xfc6e('0x3e')]()===_0x479656[_0xfc6e('0x3e')]();};}exports[_0xfc6e('0x3f')]=function(_0x1d5a38,_0x8bf05,_0x19f44a,_0x3b3e78){return function(_0x313ac9){try{var _0x3c6368={'name':_0x8bf05[0x0],'timeout':_0x8bf05[0x1]};var _0x5bed94=queue[_0xfc6e('0x0')](_0x3c6368,{'typecast':!![]});if(_0x5bed94[_0xfc6e('0x40')]){logger[_0xfc6e('0x37')]('[%s][QUEUE]\x20%s',_0x1d5a38,_[_0xfc6e('0x41')](_0x5bed94,_0xfc6e('0x2e'))[_0xfc6e('0x42')](',\x20'));_0x313ac9[_0xfc6e('0x43')]();}else{var _0x270ddc=_[_0xfc6e('0x44')](_0x19f44a[_0x3b3e78[_0xfc6e('0x2a')]+_0xfc6e('0x45')],handleFindQueue(_0x3c6368['name']));if(_0x270ddc){startRouting(_0x1d5a38,_0x270ddc,_0x3b3e78,_0x19f44a);var _0x1a67a5=(_0x270ddc[_0xfc6e('0x3c')]||0xa)*0x3e8;var _0x387282=(_0x3c6368['timeout']||0x14)*0x3e8;var _0x496f21;if(_0x1a67a5>_0x387282){_0x387282=_0x1a67a5;}var _0x4c0acf=seqqueue['createQueue'](_0x1a67a5);_0x4c0acf['id']=_0x1d5a38;_0x4c0acf[_0xfc6e('0x46')]=_0x1a67a5;_0x4c0acf[_0xfc6e('0x47')]=_0x387282;_0x4c0acf[_0xfc6e('0x2a')]=_0x3b3e78[_0xfc6e('0x2a')];_0x19f44a['rules'][_0x1d5a38]['on'](_0xfc6e('0x48'),function(){logger[_0xfc6e('0x31')](_0xfc6e('0x49'),_0x1d5a38);stopRouting(_0x1d5a38,_0x270ddc,_0x3b3e78,_0x19f44a);clearTimeout(_0x496f21);_0x496f21=undefined;_0x4c0acf[_0xfc6e('0x4a')](!![]);if(_0x19f44a[_0xfc6e('0x4b')][_0x1d5a38]){delete _0x19f44a[_0xfc6e('0x4b')][_0x1d5a38];}_0x313ac9[_0xfc6e('0x43')]();});_0x19f44a[_0xfc6e('0x4b')][_0x1d5a38]['on']('complete',function(){if(_0x19f44a[_0xfc6e('0x4b')][_0x1d5a38]){delete _0x19f44a['rules'][_0x1d5a38];}});_0x496f21=setTimeout(function(){logger[_0xfc6e('0x31')](_0xfc6e('0x4c'),_0x1d5a38);endRouting(_0x1d5a38,_0x270ddc,_0x3b3e78,_0x19f44a);clearTimeout(_0x496f21);_0x4c0acf[_0xfc6e('0x4a')](!![]);_0x313ac9[_0xfc6e('0x4d')]();},_0x387282);switch(_0x270ddc['strategy']){case _0xfc6e('0x4e'):strategy['rrmemory'](_0x4c0acf,_0x270ddc,_0x19f44a,_0x3b3e78);break;default:strategy[_0xfc6e('0x4f')](_0x4c0acf,_0x270ddc,_0x19f44a,_0x3b3e78);}}else{logger[_0xfc6e('0x37')](_0xfc6e('0x50'),_0x1d5a38,_0x3c6368['name']);_0x313ac9[_0xfc6e('0x43')]();}}}catch(_0x756926){logger['error'](_0xfc6e('0x51'),_0x1d5a38,_0x756926['stack']);_0x313ac9[_0xfc6e('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 d7e9f23..617ac45 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 _0xa8a8=['./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','drained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid'];(function(_0x44fae1,_0xea074f){var _0x44bf89=function(_0x202318){while(--_0x202318){_0x44fae1['push'](_0x44fae1['shift']());}};_0x44bf89(++_0xea074f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x49469d,_0x4e7cb3){_0x49469d=_0x49469d-0x0;var _0x208616=_0xa8a8[_0x49469d];return _0x208616;};'use strict';var _=require(_0x8a8a('0x0'));var uuid=require(_0x8a8a('0x1'));var util=require(_0x8a8a('0x2'));var logger=require(_0x8a8a('0x3'))('routing');var Agent=function(_0x2a2676,_0x3296a6,_0xf11a08,_0x3ed1de){this[_0x8a8a('0x4')]=uuid['v4']();this[_0x8a8a('0x5')]=_0x2a2676;this[_0x8a8a('0x6')]=_0x3296a6;this[_0x8a8a('0x7')]=_0xf11a08;this[_0x8a8a('0x8')]=_0x3ed1de;this[_0x8a8a('0x5')][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')][_0x8a8a('0xb')](this));this['squeue']['on']('timeout',this[_0x8a8a('0xc')]['bind'](this));this[_0x8a8a('0x5')]['on'](_0x8a8a('0xd'),this['handleDrained'][_0x8a8a('0xb')](this));};Agent[_0x8a8a('0xe')][_0x8a8a('0x9')]=function(){this['squeue'][_0x8a8a('0x9')](this[_0x8a8a('0xa')][_0x8a8a('0xb')](this),this[_0x8a8a('0xc')]['bind'](this));};Agent[_0x8a8a('0xe')]['handleDrained']=function(){this[_0x8a8a('0xc')](!![]);};Agent[_0x8a8a('0xe')][_0x8a8a('0xa')]=function(){logger[_0x8a8a('0xf')](_0x8a8a('0x10'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);if(_['isNil'](this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']])){logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}else{if(this[_0x8a8a('0x8')][_0x8a8a('0x12')]||util[_0x8a8a('0x13')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this['agent']['id']],this['squeue']['channel'],![])){this['realtime'][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x15')]=!![];this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x17')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x19')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],null,this[_0x8a8a('0x8')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']],_0x8a8a('0x1b')+(this[_0x8a8a('0x8')]['forcedOwnership']?':FORCED':''));}else{logger[_0x8a8a('0xf')](_0x8a8a('0x1c'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x8a8a('0xb')](this),0x3e8);}}};Agent['prototype'][_0x8a8a('0xc')]=function(_0xdd6221){if(_['isNil'](this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']])){return logger[_0x8a8a('0xf')](_0x8a8a('0x11'),this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x6')]['id']);}else{logger[_0x8a8a('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util[_0x8a8a('0x1d')](this[_0x8a8a('0x4')],this['squeue']['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']],null,this[_0x8a8a('0x8')]);this[_0x8a8a('0x7')][_0x8a8a('0x14')][this['agent']['id']]['busy']=![];this[_0x8a8a('0x7')]['agents'][this[_0x8a8a('0x6')]['id']][_0x8a8a('0x16')]=undefined;util[_0x8a8a('0x1e')](this[_0x8a8a('0x7')],this[_0x8a8a('0x8')],this[_0x8a8a('0x6')],this[_0x8a8a('0x5')][_0x8a8a('0x18')]);util[_0x8a8a('0x1a')](this[_0x8a8a('0x5')]['id'],this[_0x8a8a('0x7')][_0x8a8a('0x14')][this[_0x8a8a('0x6')]['id']],_0xdd6221?_0x8a8a('0x1f'):_0x8a8a('0x20'));}if(!_0xdd6221){setTimeout(this[_0x8a8a('0x9')][_0x8a8a('0xb')](this),0x3e8);}};function agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01){return new Agent(_0x29d187,_0x4c8003,_0x4cc605,_0x53da01);}module[_0x8a8a('0x21')]=agent; \ No newline at end of file +var _0x425d=['[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x425d,0x1e0));var _0xd425=function(_0x1a1072,_0x84a807){_0x1a1072=_0x1a1072-0x0;var _0x415142=_0x425d[_0x1a1072];return _0x415142;};'use strict';var _=require(_0xd425('0x0'));var uuid=require('uuid');var util=require(_0xd425('0x1'));var logger=require(_0xd425('0x2'))(_0xd425('0x3'));var Agent=function(_0x97e370,_0x183caa,_0x44ba48,_0x47043f){this['notificationId']=uuid['v4']();this[_0xd425('0x4')]=_0x97e370;this[_0xd425('0x5')]=_0x183caa;this[_0xd425('0x6')]=_0x44ba48;this[_0xd425('0x3')]=_0x47043f;this[_0xd425('0x4')][_0xd425('0x7')](this['handleRun'][_0xd425('0x8')](this),this[_0xd425('0x9')][_0xd425('0x8')](this));this[_0xd425('0x4')]['on'](_0xd425('0xa'),this[_0xd425('0x9')][_0xd425('0x8')](this));this[_0xd425('0x4')]['on'](_0xd425('0xb'),this[_0xd425('0xc')][_0xd425('0x8')](this));};Agent[_0xd425('0xd')][_0xd425('0x7')]=function(){this[_0xd425('0x4')][_0xd425('0x7')](this[_0xd425('0xe')][_0xd425('0x8')](this),this[_0xd425('0x9')][_0xd425('0x8')](this));};Agent[_0xd425('0xd')]['handleDrained']=function(){this[_0xd425('0x9')](!![]);};Agent[_0xd425('0xd')][_0xd425('0xe')]=function(){logger['debug'](_0xd425('0xf'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);if(_[_0xd425('0x10')](this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']])){logger[_0xd425('0x11')](_0xd425('0x12'),this[_0xd425('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}else{if(this[_0xd425('0x3')][_0xd425('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime']['agents'][this[_0xd425('0x5')]['id']],this[_0xd425('0x4')][_0xd425('0x14')],![])){this['realtime'][_0xd425('0x15')][this[_0xd425('0x5')]['id']]['busy']=!![];this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']][_0xd425('0x16')]=undefined;util[_0xd425('0x17')](this[_0xd425('0x6')],this[_0xd425('0x3')],this[_0xd425('0x5')],this[_0xd425('0x4')][_0xd425('0x14')]);util[_0xd425('0x18')](this[_0xd425('0x19')],this['squeue']['id'],this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']],null,this[_0xd425('0x3')]);util[_0xd425('0x1a')](this[_0xd425('0x4')]['id'],this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']],_0xd425('0x1b')+(this[_0xd425('0x3')]['forcedOwnership']?_0xd425('0x1c'):''));}else{logger[_0xd425('0x11')](_0xd425('0x1d'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}}};Agent[_0xd425('0xd')][_0xd425('0x9')]=function(_0x1cac61){if(_['isNil'](this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']])){return logger[_0xd425('0x11')](_0xd425('0x12'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);}else{logger[_0xd425('0x11')](_0xd425('0x1e'),this[_0xd425('0x4')]['id'],this[_0xd425('0x5')]['id']);util['hideNotification'](this[_0xd425('0x19')],this[_0xd425('0x4')]['id'],this[_0xd425('0x6')][_0xd425('0x15')][this[_0xd425('0x5')]['id']],null,this['routing']);this[_0xd425('0x6')][_0xd425('0x15')][this['agent']['id']]['busy']=![];this['realtime'][_0xd425('0x15')][this[_0xd425('0x5')]['id']][_0xd425('0x16')]=undefined;util[_0xd425('0x1f')](this['realtime'],this[_0xd425('0x3')],this[_0xd425('0x5')],this[_0xd425('0x4')][_0xd425('0x14')]);util[_0xd425('0x1a')](this[_0xd425('0x4')]['id'],this[_0xd425('0x6')]['agents'][this[_0xd425('0x5')]['id']],_0x1cac61?'STOP':_0xd425('0x20'));}if(!_0x1cac61){setTimeout(this[_0xd425('0x7')][_0xd425('0x8')](this),0x3e8);}};function agent(_0x4ef4ab,_0x3ccbed,_0x26806c,_0xbbb05f){return new Agent(_0x4ef4ab,_0x3ccbed,_0x26806c,_0xbbb05f);}module[_0xd425('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 996c56d..463e264 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 _0x31ed=['handleDrained','prototype','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','busy','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','drained'];(function(_0x596053,_0x1a9efd){var _0x1fb180=function(_0x14ccdf){while(--_0x14ccdf){_0x596053['push'](_0x596053['shift']());}};_0x1fb180(++_0x1a9efd);}(_0x31ed,0xbe));var _0xd31e=function(_0x308f11,_0x2f2de0){_0x308f11=_0x308f11-0x0;var _0x5da67a=_0x31ed[_0x308f11];return _0x5da67a;};'use strict';var _=require('lodash');var uuid=require(_0xd31e('0x0'));var util=require(_0xd31e('0x1'));var logger=require(_0xd31e('0x2'))(_0xd31e('0x3'));var Beepall=function(_0x3217cf,_0x846574,_0x226399,_0x2223e0){this[_0xd31e('0x4')]=uuid['v4']();this[_0xd31e('0x5')]=_0x3217cf;this[_0xd31e('0x6')]=_0x846574;this[_0xd31e('0x7')]=_0x226399;this[_0xd31e('0x3')]=_0x2223e0;this['squeue'][_0xd31e('0x8')](this[_0xd31e('0x9')][_0xd31e('0xa')](this),this['handleTimeout']['bind'](this));this[_0xd31e('0x5')]['on'](_0xd31e('0xb'),this[_0xd31e('0xc')][_0xd31e('0xa')](this));this[_0xd31e('0x5')]['on'](_0xd31e('0xd'),this[_0xd31e('0xe')][_0xd31e('0xa')](this));};Beepall[_0xd31e('0xf')][_0xd31e('0x8')]=function(){this[_0xd31e('0x5')][_0xd31e('0x8')](this[_0xd31e('0x9')]['bind'](this),this[_0xd31e('0xc')][_0xd31e('0xa')](this));};Beepall[_0xd31e('0xf')][_0xd31e('0xe')]=function(){this[_0xd31e('0xc')](!![]);};Beepall[_0xd31e('0xf')][_0xd31e('0x9')]=function(){var _0x42dc96=!![];if(!_[_0xd31e('0x10')](this['queue'])&&!_['isNil'](this[_0xd31e('0x6')][_0xd31e('0x11')])&&this['queue']['Agents'][_0xd31e('0x12')]>0x0){for(var _0x6ccdcd=0x0,_0x11df49;_0x6ccdcd0x0){for(var _0x245536=0x0,_0x3c8325;_0x2455360x0&&_0x55e322[_0x51b75d+_0x7ece('0x24')]>=_0x55e322[_0x51b75d+_0x7ece('0x23')]){writeLog(_0x1483d2,_0x55e322,_0x51b75d[_0x7ece('0x25')]()+_0x7ece('0x26'));return![];}}return!![];};exports[_0x7ece('0x27')]=function(_0x400086,_0x4965e4,_0x15c038,_0x25b451,_0x3bd523){return sendNotification(!![],_0x400086,_0x4965e4,_0x15c038,_0x25b451,_0x3bd523);};exports[_0x7ece('0x28')]=function(_0x18a804,_0x2066f3,_0x4af234,_0x5434a1,_0x198e81){return sendNotification(![],_0x18a804,_0x2066f3,_0x4af234,_0x5434a1,_0x198e81);};exports[_0x7ece('0x29')]=function(_0x1893e2,_0x578b68,_0x40ed78){var _0x3d721f=_0x578b68[_0x7ece('0x2a')][_0x7ece('0x2b')];if(!_0x3d721f&&_0x40ed78){_0x3d721f=_0x40ed78['id'];}var _0x599108=_[_0x7ece('0x2c')](_0x1893e2[_0x578b68['channel']+_0x7ece('0x2d')],function(_0x100d93){var _0x5968c6=_[_0x7ece('0x2e')](_0x578b68[_0x7ece('0x2f')])+'InteractionId';return _0x100d93[_0x5968c6]===_0x578b68[_0x7ece('0x2a')]['id'];});if(!_0x599108&&_0x3d721f&&_0x1893e2[_0x7ece('0x30')][_0x3d721f]){_0x599108=_[_0x7ece('0x2c')](_0x1893e2['agents'][_0x3d721f][_0x578b68['channel']+_0x7ece('0x31')],function(_0x4bf2d9){return _0x4bf2d9['id']===_0x578b68[_0x7ece('0x2a')]['id'];});}return _0x599108;};exports['saveWaitingNotification']=function(_0x477df7,_0x7d4fa7,_0x24f16b,_0x73df12){if(_0x24f16b&&_0x24f16b['id']&&_0x477df7[_0x7ece('0x30')]&&_0x477df7['agents'][_0x24f16b['id']]){_0x477df7['agents'][_0x24f16b['id']][_0x73df12+_0x7ece('0x31')][_0x7d4fa7[_0x7ece('0x14')]['id']]={'id':_0x7d4fa7[_0x7ece('0x2a')]['id']};}};exports[_0x7ece('0x32')]=function(_0x236e29,_0x58968a,_0x5ca7cd,_0x2d1385){if(_0x5ca7cd&&_0x5ca7cd['id']&&_0x236e29[_0x7ece('0x30')]&&_0x236e29[_0x7ece('0x30')][_0x5ca7cd['id']]){delete _0x236e29[_0x7ece('0x30')][_0x5ca7cd['id']][_0x2d1385+'WaitingInteractions'][_0x58968a[_0x7ece('0x14')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0x0ce9=['interaction','agents','some','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationShake','body','queue','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','format','user:%s','emit','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','UserId','channel','InteractionId'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x0ce9,0x9a));var _0x90ce=function(_0x1d5845,_0x2beeb1){_0x1d5845=_0x1d5845-0x0;var _0x296ae5=_0x0ce9[_0x1d5845];return _0x296ae5;};'use strict';var _=require(_0x90ce('0x0'));var util=require(_0x90ce('0x1'));var utils=require(_0x90ce('0x2'));var Redis=require(_0x90ce('0x3'));var config=require(_0x90ce('0x4'));var logger=require('../../../../../config/logger')(_0x90ce('0x5'));config[_0x90ce('0x6')]=_[_0x90ce('0x7')](config['redis'],{'host':_0x90ce('0x8'),'port':0x18eb});var io=require(_0x90ce('0x9'))(new Redis(config[_0x90ce('0x6')]));function sendNotification(_0x14d075,_0x41b1a0,_0x5dc8e1,_0x10fd8b,_0x59e48c,_0x508912){var _0x38d189=_0x508912||{};var _0x22a1b5=_0x5dc8e1[_0x90ce('0xa')]('.');var _0x14e36b={'uniqueid':_0x41b1a0,'channel':_0x22a1b5[0x0],'id':_0x22a1b5[0x1],'title':_0x22a1b5[0x0]+_0x90ce('0xb'),'interactionId':_0x22a1b5[0x2],'queue':_0x59e48c?_0x59e48c[_0x90ce('0xc')]:null,'sound':_0x38d189[_0x90ce('0xd')]['notificationSound'],'shake':_0x38d189['account'][_0x90ce('0xe')]};try{if(!_0x38d189[_0x90ce('0xf')]){_0x38d189['body']={};}if(_0x59e48c){_0x38d189['body']['queue']=_0x59e48c;}else if(_0x38d189[_0x90ce('0xf')][_0x90ce('0x10')]){delete _0x38d189['body'][_0x90ce('0x10')];}_0x14e36b['msg']=utils[_0x90ce('0x11')](_0x38d189[_0x90ce('0xd')]['notificationTemplate'],_0x38d189);}catch(_0x4605e6){_0x14e36b['msg']=_0x90ce('0x12');logger['error'](util['format'](_0x90ce('0x13'),_0x41b1a0,_0x4605e6[_0x90ce('0x14')]));}io['to'](util[_0x90ce('0x15')](_0x90ce('0x16'),_0x10fd8b[_0x90ce('0xc')]))[_0x90ce('0x17')](util['format']('notification:%s',_0x14d075?_0x90ce('0x18'):_0x90ce('0x19')),_0x14e36b);}function writeLog(_0x583fad,_0x21cc1b,_0x5d30df){return logger['debug'](util[_0x90ce('0x15')](_0x90ce('0x1a'),_0x583fad,_0x21cc1b[_0x90ce('0xc')],_0x5d30df));}exports[_0x90ce('0x1b')]=function(_0x426f0f,_0x4c1970,_0x2e9408,_0x5419a8){if(_0x4c1970[_0x90ce('0x1c')]){writeLog(_0x426f0f,_0x4c1970,_0x90ce('0x1d'));return![];}if(!_0x4c1970['online']){writeLog(_0x426f0f,_0x4c1970,'OFFLINE');return![];}if(_0x4c1970[_0x2e9408+_0x90ce('0x1e')]){writeLog(_0x426f0f,_0x4c1970,_0x90ce('0x1f'));return![];}if(_0x5419a8&&_0x4c1970[_0x90ce('0x20')](_0x2e9408+'Capacity')&&_0x4c1970[_0x90ce('0x20')](_0x2e9408+_0x90ce('0x21'))){if(_0x4c1970[_0x2e9408+'Capacity']>0x0&&_0x4c1970[_0x2e9408+_0x90ce('0x21')]>=_0x4c1970[_0x2e9408+_0x90ce('0x22')]){writeLog(_0x426f0f,_0x4c1970,_0x2e9408[_0x90ce('0x23')]()+_0x90ce('0x24'));return![];}}return!![];};exports[_0x90ce('0x25')]=function(_0xf37828,_0x3dd86a,_0x38c6c9,_0x560466,_0x501acf){return sendNotification(!![],_0xf37828,_0x3dd86a,_0x38c6c9,_0x560466,_0x501acf);};exports[_0x90ce('0x26')]=function(_0x470763,_0x45eaff,_0x43f90c,_0x292c7a,_0x1956ca){return sendNotification(![],_0x470763,_0x45eaff,_0x43f90c,_0x292c7a,_0x1956ca);};exports['checkWaitingNotifications']=function(_0x181244,_0x32a6d8,_0x583eb2){var _0x5d19df=_0x32a6d8['interaction'][_0x90ce('0x27')];if(!_0x5d19df&&_0x583eb2){_0x5d19df=_0x583eb2['id'];}var _0x5e6ee6=_['some'](_0x181244[_0x32a6d8[_0x90ce('0x28')]+'QueuesWaitingInteractions'],function(_0x1a627c){var _0x1741d9=_['capitalize'](_0x32a6d8['channel'])+_0x90ce('0x29');return _0x1a627c[_0x1741d9]===_0x32a6d8[_0x90ce('0x2a')]['id'];});if(!_0x5e6ee6&&_0x5d19df&&_0x181244[_0x90ce('0x2b')][_0x5d19df]){_0x5e6ee6=_[_0x90ce('0x2c')](_0x181244['agents'][_0x5d19df][_0x32a6d8[_0x90ce('0x28')]+_0x90ce('0x2d')],function(_0xf967f2){return _0xf967f2['id']===_0x32a6d8[_0x90ce('0x2a')]['id'];});}return _0x5e6ee6;};exports[_0x90ce('0x2e')]=function(_0x2aff46,_0xb567c5,_0x317104,_0x34fd76){if(_0x317104&&_0x317104['id']&&_0x2aff46[_0x90ce('0x2b')]&&_0x2aff46['agents'][_0x317104['id']]){_0x2aff46[_0x90ce('0x2b')][_0x317104['id']][_0x34fd76+_0x90ce('0x2d')][_0xb567c5['message']['id']]={'id':_0xb567c5[_0x90ce('0x2a')]['id']};}};exports[_0x90ce('0x2f')]=function(_0x2b36b3,_0x3cfe3e,_0x548b13,_0x17b5db){if(_0x548b13&&_0x548b13['id']&&_0x2b36b3[_0x90ce('0x2b')]&&_0x2b36b3[_0x90ce('0x2b')][_0x548b13['id']]){delete _0x2b36b3['agents'][_0x548b13['id']][_0x17b5db+'WaitingInteractions'][_0x3cfe3e['message']['id']];}};exports[_0x90ce('0x30')]=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 4afdd21..a4d4a0d 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 _0x629d=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','shelljs','lodash','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x46b1c6,_0x54d0ea){var _0x3e9cbe=function(_0x446c5b){while(--_0x446c5b){_0x46b1c6['push'](_0x46b1c6['shift']());}};_0x3e9cbe(++_0x54d0ea);}(_0x629d,0x197));var _0xd629=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x629d[_0x1d3a5d];return _0x257078;};'use strict';var schema=require('validate');var sh=require(_0xd629('0x0'));var _=require(_0xd629('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xd629('0x2'));var system=schema({'command':{'type':_0xd629('0x3'),'required':!![],'message':_0xd629('0x4')}});exports[_0xd629('0x5')]=function(_0x56f8dc,_0x708570){return function(_0x280732){try{var _0x9b7ea8={'command':_0x708570[0x0]};var _0x14f0a7=system[_0xd629('0x6')](_0x9b7ea8,{'typecast':!![]});if(_0x14f0a7['length']){logger[_0xd629('0x7')](_0xd629('0x8'),_0x56f8dc,_[_0xd629('0x9')](_0x14f0a7,_0xd629('0xa'))[_0xd629('0xb')](',\x20'));logger[_0xd629('0xc')](_0xd629('0xd'),_0x56f8dc);_0x280732[_0xd629('0xe')]();}else{var _0x1a11f2=this;var _0x50d370=utils[_0xd629('0xf')](_0x708570[0x0],this);logger['info'](_0xd629('0x10'),_0x56f8dc,_0x50d370);sh['exec'](_[_0xd629('0x11')](_0x50d370),function(_0x58c200,_0x19d62e){logger[_0xd629('0xc')](_0xd629('0x12'),_0x56f8dc,_0x58c200);if(_0x58c200==0x0){var _0x33e595=_0x19d62e[_0xd629('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0xd629('0x14')](_0x708570[0x1])||_['isEmpty'](_0x708570[0x1])){logger[_0xd629('0xc')](_0xd629('0x15'),_0x56f8dc);_0x1a11f2['body'][_0x708570[0x1]]=_0x33e595;}else{logger[_0xd629('0xc')](_0xd629('0x16'),_0x56f8dc,_0x708570[0x1],_0x33e595);_0x1a11f2[_0xd629('0x17')][_0x708570[0x1]]=_0x33e595;}}_0x280732[_0xd629('0xe')]();});}}catch(_0x4b027b){logger[_0xd629('0x7')](_0xd629('0x8'),_0x56f8dc,_['isObject'](_0x4b027b)?JSON[_0xd629('0x18')](_0x4b027b):_0x4b027b);logger[_0xd629('0xc')](_0xd629('0xd'),_0x56f8dc);_0x280732[_0xd629('0xe')]();}};}; \ No newline at end of file +var _0x2ec2=['map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x5936fd,_0x11290f){var _0x4d02be=function(_0x1ec110){while(--_0x1ec110){_0x5936fd['push'](_0x5936fd['shift']());}};_0x4d02be(++_0x11290f);}(_0x2ec2,0xe7));var _0x22ec=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x2ec2[_0x2c0dc0];return _0x4c0990;};'use strict';var schema=require(_0x22ec('0x0'));var sh=require('shelljs');var _=require(_0x22ec('0x1'));var utils=require(_0x22ec('0x2'));var logger=require(_0x22ec('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x22ec('0x4')}});exports[_0x22ec('0x5')]=function(_0x5e487a,_0x23a66f){return function(_0x23ac74){try{var _0x5baa27={'command':_0x23a66f[0x0]};var _0xe5e2d4=system[_0x22ec('0x0')](_0x5baa27,{'typecast':!![]});if(_0xe5e2d4[_0x22ec('0x6')]){logger[_0x22ec('0x7')](_0x22ec('0x8'),_0x5e487a,_[_0x22ec('0x9')](_0xe5e2d4,_0x22ec('0xa'))[_0x22ec('0xb')](',\x20'));logger[_0x22ec('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5e487a);_0x23ac74[_0x22ec('0xd')]();}else{var _0x231a9c=this;var _0x4221a0=utils[_0x22ec('0xe')](_0x23a66f[0x0],this);logger['info'](_0x22ec('0xf'),_0x5e487a,_0x4221a0);sh['exec'](_[_0x22ec('0x10')](_0x4221a0),function(_0x6cf28c,_0x415b5c){logger[_0x22ec('0xc')](_0x22ec('0x11'),_0x5e487a,_0x6cf28c);if(_0x6cf28c==0x0){var _0x1120fa=_0x415b5c[_0x22ec('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x22ec('0x13')](_0x23a66f[0x1])||_['isEmpty'](_0x23a66f[0x1])){logger[_0x22ec('0xc')](_0x22ec('0x14'),_0x5e487a);_0x231a9c[_0x22ec('0x15')][_0x23a66f[0x1]]=_0x1120fa;}else{logger[_0x22ec('0xc')](_0x22ec('0x16'),_0x5e487a,_0x23a66f[0x1],_0x1120fa);_0x231a9c[_0x22ec('0x15')][_0x23a66f[0x1]]=_0x1120fa;}}_0x23ac74[_0x22ec('0xd')]();});}}catch(_0x235522){logger['error']('[%s][SYSTEM]\x20%s',_0x5e487a,_['isObject'](_0x235522)?JSON['stringify'](_0x235522):_0x235522);logger['info'](_0x22ec('0x17'),_0x5e487a);_0x23ac74[_0x22ec('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index babbe4c..31001c1 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 _0x7b0d=['Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','next','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x7b0d,0xf1));var _0xd7b0=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7b0d[_0x491a7f];return _0x3d8f44;};'use strict';var schema=require(_0xd7b0('0x0'));var _=require(_0xd7b0('0x1'));var rpc={'chatInteraction':require(_0xd7b0('0x2')),'openchannelInteraction':require(_0xd7b0('0x3')),'smsInteraction':require(_0xd7b0('0x4')),'mailInteraction':require(_0xd7b0('0x5')),'faxInteraction':require(_0xd7b0('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xd7b0('0x7'))(_0xd7b0('0x8'));var tag=schema({'tag':{'type':_0xd7b0('0x9'),'required':!![],'message':_0xd7b0('0xa')}});exports['consequence']=function(_0x322eb6,_0xb641b1,_0x3c8b3a,_0x5cab72){return function(_0x389541){try{var _0x10dbf1={'tag':_0xb641b1[0x0]};var _0xe85d01=tag[_0xd7b0('0x0')](_0x10dbf1,{'typecast':!![]});if(_0xe85d01['length']){logger[_0xd7b0('0xb')](_0xd7b0('0xc'),_0x322eb6,_[_0xd7b0('0xd')](_0xe85d01,_0xd7b0('0xe'))[_0xd7b0('0xf')](',\x20'));logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);_0x389541['next']();}else{var _0x389e48={'ids':[_0xb641b1[0x0]]};if(rpc[_0x5cab72[_0xd7b0('0x12')]+_0xd7b0('0x13')]){rpc[_0x5cab72[_0xd7b0('0x12')]+'Interaction']['addTags'](_0x5cab72[_0xd7b0('0x14')]['id'],_0x389e48)['then'](function(_0x46abec){logger['info'](_0xd7b0('0x15'),_0x322eb6,_0xb641b1[0x1],_0x5cab72[_0xd7b0('0x12')],_0x5cab72[_0xd7b0('0x14')]['id']);})[_0xd7b0('0x16')](function(_0x61bd78){logger[_0xd7b0('0xb')](_0xd7b0('0xc'),_0x322eb6,JSON['stringify'](_0x61bd78));logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);})['finally'](function(){_0x389541[_0xd7b0('0x17')]();});}}}catch(_0x3fec1a){logger['error'](_0xd7b0('0xc'),_0x322eb6,_[_0xd7b0('0x18')](_0x3fec1a)?JSON[_0xd7b0('0x19')](_0x3fec1a):_0x3fec1a);logger[_0xd7b0('0x10')](_0xd7b0('0x11'),_0x322eb6);_0x389541[_0xd7b0('0x17')]();}};}; \ No newline at end of file +var _0x5904=['channel','Interaction','addTags','then','catch','error','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','info','next'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x5904,0x11b));var _0x4590=function(_0xb7d27c,_0x3d818b){_0xb7d27c=_0xb7d27c-0x0;var _0x367a7a=_0x5904[_0xb7d27c];return _0x367a7a;};'use strict';var schema=require(_0x4590('0x0'));var _=require(_0x4590('0x1'));var rpc={'chatInteraction':require(_0x4590('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x4590('0x3')),'mailInteraction':require(_0x4590('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4590('0x5'))};var logger=require(_0x4590('0x6'))(_0x4590('0x7'));var tag=schema({'tag':{'type':_0x4590('0x8'),'required':!![],'message':_0x4590('0x9')}});exports[_0x4590('0xa')]=function(_0xb633b,_0x51c977,_0x421ec2,_0x11a62d){return function(_0x3a768e){try{var _0xae6677={'tag':_0x51c977[0x0]};var _0x38d24a=tag[_0x4590('0x0')](_0xae6677,{'typecast':!![]});if(_0x38d24a['length']){logger['error'](_0x4590('0xb'),_0xb633b,_[_0x4590('0xc')](_0x38d24a,'message')[_0x4590('0xd')](',\x20'));logger[_0x4590('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xb633b);_0x3a768e[_0x4590('0xf')]();}else{var _0x49ad5c={'ids':[_0x51c977[0x0]]};if(rpc[_0x11a62d[_0x4590('0x10')]+_0x4590('0x11')]){rpc[_0x11a62d[_0x4590('0x10')]+_0x4590('0x11')][_0x4590('0x12')](_0x11a62d['interaction']['id'],_0x49ad5c)[_0x4590('0x13')](function(_0x2153c1){logger[_0x4590('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xb633b,_0x51c977[0x1],_0x11a62d['channel'],_0x11a62d['interaction']['id']);})[_0x4590('0x14')](function(_0x580f53){logger[_0x4590('0x15')]('[%s][TAG]\x20%s',_0xb633b,JSON['stringify'](_0x580f53));logger[_0x4590('0xe')](_0x4590('0x16'),_0xb633b);})['finally'](function(){_0x3a768e[_0x4590('0xf')]();});}}}catch(_0x2f038d){logger[_0x4590('0x15')](_0x4590('0xb'),_0xb633b,_['isObject'](_0x2f038d)?JSON['stringify'](_0x2f038d):_0x2f038d);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xb633b);_0x3a768e[_0x4590('0xf')]();}};}; \ 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 a0354da..79abadc 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 _0xce64=['2.0','login','params','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc'];(function(_0x58e0d8,_0x4e4d66){var _0x266e24=function(_0xca680){while(--_0xca680){_0x58e0d8['push'](_0x58e0d8['shift']());}};_0x266e24(++_0x4e4d66);}(_0xce64,0xfb));var _0x4ce6=function(_0x449051,_0x296cd4){_0x449051=_0x449051-0x0;var _0x4599aa=_0xce64[_0x449051];return _0x4599aa;};'use strict';var rp=require(_0x4ce6('0x0'));var logger=require(_0x4ce6('0x1'))(_0x4ce6('0x2'));var _=require(_0x4ce6('0x3'));var arr=[];exports[_0x4ce6('0x4')]=function(_0x29ebda,_0x56b6f2){return function(_0x565fb3){var _0x6a351b=_0x56b6f2[0xa];var _0x338bf=_0x56b6f2[0xb];var _0x37c49d=_0x56b6f2[0xc];var _0x14f131=_0x56b6f2[0xd];var _0x3477d0=_0x56b6f2[0xe];var _0x559745=_0x56b6f2[0xf]['replace'](/\n/g,_0x4ce6('0x5'));var _0x1c1e94=_0x56b6f2[0x10][_0x4ce6('0x6')](/\n/g,'\x20');if(!arr[_0x4ce6('0x7')](_0x338bf)){arr[_0x4ce6('0x8')](_0x338bf);var _0x29a1cf=_0x56b6f2[0x3];var _0x4d58e7=_0x56b6f2[0x4];var _0x2b351e=_0x56b6f2[0x1];var _0x201a5d=_0x56b6f2[0x0];var _0x46aa89={};_0x46aa89[_0x4ce6('0x9')]=_0x56b6f2[0x8]+_0x4ce6('0xa')+_0x37c49d+'|'+_0x6a351b+'|'+_0x14f131+'|'+_0x338bf+'|'+_0x3477d0;_0x46aa89[_0x4ce6('0xb')]=_0x56b6f2[0x7]+'?params='+_0x37c49d+'|'+_0x6a351b+'|'+_0x14f131+'|'+_0x338bf+'|'+_0x3477d0+'|'+_0x559745+'|'+_0x1c1e94;_0x46aa89['title']=_0x56b6f2[0x9];var _0x5cac74={};_0x5cac74[_0x4ce6('0xc')]=_0x4ce6('0xd');_0x5cac74['method']=_0x4ce6('0xe');var _0x2a8f97=[];_0x2a8f97[_0x4ce6('0x8')](_0x56b6f2[0x2]);_0x2a8f97['push'](_0x56b6f2[0x5]);_0x2a8f97['push'](_0x56b6f2[0x6]);_0x5cac74[_0x4ce6('0xf')]=_0x2a8f97;_0x5cac74['id']=0x1;var _0x35d61f=JSON['stringify'](_0x5cac74);var _0x157823={'encoding':_0x4ce6('0x10'),'method':'POST','timeout':0x2710,'url':_0x29a1cf,'headers':{'Content-Type':_0x4ce6('0x11')},'body':_0x35d61f};return rp(_0x157823)[_0x4ce6('0x12')](function(_0x109a79){const _0x3503ba=JSON[_0x4ce6('0x13')](_0x109a79);if(!_0x3503ba[_0x4ce6('0x14')][_0x4ce6('0x15')]){throw new Error(_0x4ce6('0x16'));}var _0x109d21=_0x338bf;var _0x44478f='channelId='+_0x2b351e+_0x4ce6('0x17')+_0x201a5d+'&sessionId='+_0x109d21+'&data='+JSON[_0x4ce6('0x18')](_0x46aa89);var _0x17f6f5=_0x4d58e7+'?'+_0x44478f;return rp(_0x17f6f5);})[_0x4ce6('0x12')](function(_0x5c5cf5){logger[_0x4ce6('0x19')](_0x4ce6('0x1a'),_0x29ebda,_0x5c5cf5);_0x565fb3[_0x4ce6('0x1b')]();})[_0x4ce6('0x1c')](function(_0x1160a0){logger[_0x4ce6('0x1d')](_0x4ce6('0x1e'),_0x29ebda,_[_0x4ce6('0x1f')](_0x1160a0)?JSON[_0x4ce6('0x18')](_0x1160a0):_0x1160a0);_0x565fb3[_0x4ce6('0x1b')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x29ebda);_0x565fb3[_0x4ce6('0x20')]();}};}; \ No newline at end of file +var _0xe195=['params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','routing','consequence','replace','includes','push','?params=','urlOnRing','title','jsonrpc','2.0','login'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0xe195,0xb5));var _0x5e19=function(_0x485bfe,_0x4b8d05){_0x485bfe=_0x485bfe-0x0;var _0x11dba6=_0xe195[_0x485bfe];return _0x11dba6;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0x5e19('0x0'));var _=require('lodash');var arr=[];exports[_0x5e19('0x1')]=function(_0x4f89dc,_0x5964e3){return function(_0x233901){var _0x1c1392=_0x5964e3[0xa];var _0xffd2a2=_0x5964e3[0xb];var _0x5356ab=_0x5964e3[0xc];var _0x47f63b=_0x5964e3[0xd];var _0xa1fb0=_0x5964e3[0xe];var _0x3c3bb8=_0x5964e3[0xf][_0x5e19('0x2')](/\n/g,'\x20-\x20');var _0x446fc5=_0x5964e3[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x5e19('0x3')](_0xffd2a2)){arr[_0x5e19('0x4')](_0xffd2a2);var _0x17dbbb=_0x5964e3[0x3];var _0x361c15=_0x5964e3[0x4];var _0x53aeb5=_0x5964e3[0x1];var _0xa7fb5e=_0x5964e3[0x0];var _0x2a0e6c={};_0x2a0e6c['urlOnAnswer']=_0x5964e3[0x8]+_0x5e19('0x5')+_0x5356ab+'|'+_0x1c1392+'|'+_0x47f63b+'|'+_0xffd2a2+'|'+_0xa1fb0;_0x2a0e6c[_0x5e19('0x6')]=_0x5964e3[0x7]+_0x5e19('0x5')+_0x5356ab+'|'+_0x1c1392+'|'+_0x47f63b+'|'+_0xffd2a2+'|'+_0xa1fb0+'|'+_0x3c3bb8+'|'+_0x446fc5;_0x2a0e6c[_0x5e19('0x7')]=_0x5964e3[0x9];var _0x24bd66={};_0x24bd66[_0x5e19('0x8')]=_0x5e19('0x9');_0x24bd66['method']=_0x5e19('0xa');var _0x1665c2=[];_0x1665c2['push'](_0x5964e3[0x2]);_0x1665c2[_0x5e19('0x4')](_0x5964e3[0x5]);_0x1665c2[_0x5e19('0x4')](_0x5964e3[0x6]);_0x24bd66[_0x5e19('0xb')]=_0x1665c2;_0x24bd66['id']=0x1;var _0x46e8a4=JSON[_0x5e19('0xc')](_0x24bd66);var _0xfb45a6={'encoding':_0x5e19('0xd'),'method':_0x5e19('0xe'),'timeout':0x2710,'url':_0x17dbbb,'headers':{'Content-Type':_0x5e19('0xf')},'body':_0x46e8a4};return rp(_0xfb45a6)[_0x5e19('0x10')](function(_0x50e8b9){const _0x11b5d1=JSON[_0x5e19('0x11')](_0x50e8b9);if(!_0x11b5d1[_0x5e19('0x12')][_0x5e19('0x13')]){throw new Error(_0x5e19('0x14'));}var _0x505d37=_0xffd2a2;var _0x20c06a=_0x5e19('0x15')+_0x53aeb5+'&serviceId='+_0xa7fb5e+_0x5e19('0x16')+_0x505d37+_0x5e19('0x17')+JSON['stringify'](_0x2a0e6c);var _0xb1535c=_0x361c15+'?'+_0x20c06a;return rp(_0xb1535c);})[_0x5e19('0x10')](function(_0x4447a8){logger[_0x5e19('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4f89dc,_0x4447a8);_0x233901['stop']();})[_0x5e19('0x19')](function(_0x1f90ee){logger[_0x5e19('0x1a')](_0x5e19('0x1b'),_0x4f89dc,_[_0x5e19('0x1c')](_0x1f90ee)?JSON['stringify'](_0x1f90ee):_0x1f90ee);_0x233901[_0x5e19('0x1d')]();});}else{logger[_0x5e19('0x18')](_0x5e19('0x1e'),_0x4f89dc);_0x233901[_0x5e19('0x1f')]();}};}; \ 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 26920a6..4340f3e 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x410958,_0x29e7de){var _0x2e80d8=function(_0x1ae0c4){while(--_0x1ae0c4){_0x410958['push'](_0x410958['shift']());}};_0x2e80d8(++_0x29e7de);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x1277a3,_0x496bef){var _0x4f4ed0=function(_0x23782f){while(--_0x23782f){_0x1277a3['push'](_0x1277a3['shift']());}};_0x4f4ed0(++_0x496bef);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 0de174b..ea95dcf 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 _0x887b=['rules','channel','message','interaction','transfer','applications','isArray','existsSync','app','toLowerCase','autoreply','appdata','split','push','slice','length','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','end','update','UserId','catch','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen'];(function(_0x4f5ed6,_0x5c7f19){var _0x305c18=function(_0x10cbb5){while(--_0x10cbb5){_0x4f5ed6['push'](_0x4f5ed6['shift']());}};_0x305c18(++_0x5c7f19);}(_0x887b,0x185));var _0xb887=function(_0xf7bd9a,_0x509931){_0xf7bd9a=_0xf7bd9a-0x0;var _0x3cb61b=_0x887b[_0xf7bd9a];return _0x3cb61b;};'use strict';var _=require(_0xb887('0x0'));var util=require(_0xb887('0x1'));var path=require(_0xb887('0x2'));var fs=require('fs');var jayson=require(_0xb887('0x3'));var BPromise=require(_0xb887('0x4'));var utils=require(_0xb887('0x5'));var sUtils=require(_0xb887('0x6'));var logger=require(_0xb887('0x7'))(_0xb887('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb887('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb887('0xa'))};var RuleEngine=require(_0xb887('0xb'));function getId(_0x59707f,_0x4a1c1e,_0x32ace2){return util[_0xb887('0xc')]('%s.%s.%s',_0x59707f,_0x4a1c1e||0x0,_0x32ace2||0x0);}function getIntervals(_0x49962f,_0x51370e){var _0x368e22=[];if(!_[_0xb887('0xd')](_0x51370e['IntervalId'])&&!_[_0xb887('0xd')](_0x49962f[_0x51370e['IntervalId']])&&!_[_0xb887('0xd')](_0x49962f[_0x51370e[_0xb887('0xe')]][_0xb887('0xf')])){_0x368e22=_[_0xb887('0x10')](_0x49962f[_0x51370e['IntervalId']]['Intervals'],_0xb887('0x11'));}else if(!_[_0xb887('0xd')](_0x51370e[_0xb887('0x11')])){_0x368e22=[_0x51370e[_0xb887('0x11')]];}return _0x368e22;}exports[_0xb887('0x12')]=function(_0x5899bb){_0x5899bb[_0xb887('0x13')]={};return new BPromise(function(_0xae7291,_0x28bda6){var _0x34174a={'Start':function(_0x7bac36){var _0x1b193c=this;return new Promise(function(_0x2008e4,_0x2b0f05){if(_0x7bac36){try{var _0x36f47b=[];var _0xcb6e66=getId(_0x7bac36[_0xb887('0x14')],_0x7bac36[_0xb887('0x15')]?_0x7bac36['message']['id']:0x0,_0x7bac36['interaction']?_0x7bac36[_0xb887('0x16')]['id']:0x0);var _0x33b7e0=sUtils['checkWaitingNotifications'](_0x5899bb,_0x7bac36);if(_0x7bac36[_0xb887('0x17')]||!_0x33b7e0&&_0x7bac36[_0xb887('0x18')]&&_[_0xb887('0x19')](_0x7bac36[_0xb887('0x18')])&&_0x7bac36[_0xb887('0x18')]['length']){for(var _0x2b1943=0x0;_0x2b1943<_0x7bac36['applications']['length'];_0x2b1943+=0x1){var _0x68ef0a=_0x7bac36[_0xb887('0x18')][_0x2b1943];if(fs[_0xb887('0x1a')](path['join'](__dirname,'applications',_0x68ef0a[_0xb887('0x1b')]+'.js'))){var _0x321cb6=[];switch(_0x68ef0a[_0xb887('0x1b')][_0xb887('0x1c')]()){case _0xb887('0x1d'):var _0x49a401=_0x68ef0a[_0xb887('0x1e')][_0xb887('0x1f')](',');if(_0x7bac36[_0xb887('0x14')]==='mail'){_0x321cb6[_0xb887('0x20')](_0x49a401[0x0]);_0x321cb6['push'](_0x49a401[0x1]);_0x321cb6[_0xb887('0x20')](_0x49a401[_0xb887('0x21')](0x2,_0x49a401[_0xb887('0x22')])['join'](','));}else{_0x321cb6['push'](_0x49a401[0x0]);_0x321cb6[_0xb887('0x20')](_0x49a401[_0xb887('0x21')](0x1,_0x49a401[_0xb887('0x22')])[_0xb887('0x23')](','));}break;case _0xb887('0x24'):var _0x233e78=_0x68ef0a['appdata'][_0xb887('0x1f')](',');_0x321cb6[_0xb887('0x20')](_0x233e78[0x0]);_0x321cb6[_0xb887('0x20')](_0x233e78[0x1]);_0x321cb6[_0xb887('0x20')](_0x233e78['slice'](0x2,_0x233e78[_0xb887('0x22')])['join'](','));break;case _0xb887('0x25'):var _0x3e99f7=_0x68ef0a[_0xb887('0x1e')][_0xb887('0x1f')](',');_0x321cb6['push'](_0x3e99f7[0x0]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[0x1]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[0x2]);_0x321cb6['push'](_0x3e99f7[0x3]);_0x321cb6[_0xb887('0x20')](_0x3e99f7[_0xb887('0x21')](0x4,_0x3e99f7[_0xb887('0x22')])['join'](','));break;case _0xb887('0x26'):var _0x49aed6=_0x68ef0a[_0xb887('0x1e')]['split'](',');_0x321cb6[_0xb887('0x20')](_0x49aed6[0x0]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x1]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x2]);_0x321cb6[_0xb887('0x20')](_0x49aed6[0x3]);_0x321cb6['push'](_0x49aed6[_0xb887('0x21')](0x4,_0x49aed6[_0xb887('0x22')])[_0xb887('0x23')](','));break;case _0xb887('0x15'):_0x321cb6['push'](_0x68ef0a[_0xb887('0x1e')]);break;case _0xb887('0x27'):_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x28')]);_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x1e')]);break;case _0xb887('0x29'):var _0x4dac2f=utils[_0xb887('0x2a')](_0x7bac36[_0xb887('0x2b')]['notificationTemplate'],_0x7bac36);var _0x1a2aa8=_0x68ef0a[_0xb887('0x1e')]['split'](',');_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x0]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x1]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x2]);_0x321cb6['push'](_0x1a2aa8[0x3]);_0x321cb6['push'](_0x1a2aa8[0x4]);_0x321cb6['push'](_0x1a2aa8[0x5]);_0x321cb6['push'](_0x1a2aa8[0x6]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x7]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0x8]);_0x321cb6['push'](_0x1a2aa8[0x9]);_0x321cb6[_0xb887('0x20')](_0x1a2aa8[0xa]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x16')]['id']);_0x321cb6['push'](_0x7bac36[_0xb887('0x15')]['id']);_0x321cb6[_0xb887('0x20')](_0x68ef0a[_0xb887('0x2c')]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x16')][_0xb887('0x2d')]);_0x321cb6[_0xb887('0x20')](_0x7bac36[_0xb887('0x2e')][_0xb887('0x2e')]);_0x321cb6[_0xb887('0x20')](_0x4dac2f);break;default:_0x321cb6=_[_0xb887('0xd')](_0x68ef0a[_0xb887('0x1e')])?[]:_0x68ef0a['appdata']['split'](',');}var _0x9a1895={'id':util[_0xb887('0xc')](_0xb887('0x2f'),_0xcb6e66,_0x68ef0a['id'],_0x68ef0a[_0xb887('0x1b')]),'condition':require(_0xb887('0x30'))[_0xb887('0x31')](_0xcb6e66,getIntervals(_0x5899bb[_0xb887('0x32')],_0x68ef0a),_0x5899bb),'consequence':require('./applications/'+_0x68ef0a['app'])[_0xb887('0x33')](_0xcb6e66,_0x321cb6,_0x5899bb,_0x7bac36),'p':_0x68ef0a[_0xb887('0x34')]||0x0};logger[_0xb887('0x35')](_0xb887('0x36'),_0x9a1895['id'],'on\x20interval',getIntervals(_0x5899bb['intervals'],_0x68ef0a)[_0xb887('0x23')](_0xb887('0x37')));_0x36f47b[_0xb887('0x20')](_0x9a1895);}else{logger[_0xb887('0x38')](_0xb887('0x39'),path[_0xb887('0x23')](__dirname,_0xb887('0x18'),_0x68ef0a[_0xb887('0x1b')]+'.js'));}}_0x5899bb[_0xb887('0x13')][_0xcb6e66]=new RuleEngine(_0x36f47b);_0x5899bb['rules'][_0xcb6e66][_0xb887('0x3a')](_0x7bac36,function(_0x448cd2){logger['info']('Applications\x20executed',JSON[_0xb887('0x3b')](_0x448cd2[_0xb887('0x3c')]));if(_0x5899bb[_0xb887('0x13')][_0xcb6e66]){_0x5899bb[_0xb887('0x13')][_0xcb6e66][_0xb887('0x3d')](_0xb887('0x3e'));}});return _0x2008e4({'code':0xc8,'message':_0x7bac36});}else{if(_0x33b7e0){logger[_0xb887('0x35')](util[_0xb887('0xc')](_0xb887('0x3f'),_0xcb6e66));}else{logger[_0xb887('0x35')](_0xb887('0x40'));}return _0x2008e4({'code':0xc8,'message':_0x7bac36});}}catch(_0x5aa990){logger[_0xb887('0x38')](_0x5aa990['stack']);return _0x2b0f05(_0x1b193c['error'](0x1f4,_0x5aa990));}}return _0x2b0f05(_0xb887('0x41'));});},'AcceptMessage':function(_0x9c4384){var _0x235766=this;return new Promise(function(_0x18fa99,_0x28c234){if(_0x9c4384[_0xb887('0x42')]&&_0x9c4384['agent']['id']){if(_0x5899bb['agents'][_0x9c4384['agent']['id']]){_0x5899bb[_0xb887('0x43')][_0x9c4384[_0xb887('0x42')]['id']][_0xb887('0x44')]=![];_0x5899bb[_0xb887('0x43')][_0x9c4384['agent']['id']]['busyQueue']=undefined;}}if(_0x9c4384[_0xb887('0x15')]&&_0x9c4384[_0xb887('0x15')]['id']){try{var _0x17fadb=getId(_0x9c4384[_0xb887('0x14')],_0x9c4384[_0xb887('0x15')]?_0x9c4384['message']['id']:0x0,_0x9c4384[_0xb887('0x16')]?_0x9c4384[_0xb887('0x16')]['id']:0x0);if(_0x5899bb[_0xb887('0x13')][_0x17fadb]){_0x5899bb[_0xb887('0x13')][_0x17fadb][_0xb887('0x3d')](_0xb887('0x45'));if(rpc[_0x9c4384[_0xb887('0x14')]+'QueueReport']){rpc[_0x9c4384[_0xb887('0x14')]+'QueueReport'][_0xb887('0x46')](_0x17fadb,{'UserId':_0x9c4384['message'][_0xb887('0x47')]})[_0xb887('0x48')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x18fa99({'code':0xc8,'message':_0x9c4384});}catch(_0x707746){logger[_0xb887('0x38')](_0x707746[_0xb887('0x49')]);return _0x28c234(_0x235766['error'](0x1f4,_0x707746));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x28c234(_0x235766['error'](0x1f4,_0xb887('0x4a')));});},'RejectMessage':function(_0x3bb13a){var _0x4b1d94=this;return new Promise(function(_0x4dd0b9,_0x3be3a0){if(_0x3bb13a[_0xb887('0x42')]&&_0x3bb13a[_0xb887('0x42')]['id']){try{if(_0x5899bb['agents'][_0x3bb13a[_0xb887('0x42')]['id']]){_0x5899bb[_0xb887('0x43')][_0x3bb13a['agent']['id']][_0xb887('0x44')]=![];_0x5899bb[_0xb887('0x43')][_0x3bb13a[_0xb887('0x42')]['id']]['busyQueue']=undefined;}return _0x4dd0b9({'code':0xc8,'message':_0x3bb13a});}catch(_0x412fb4){logger['error'](_0x412fb4[_0xb887('0x49')]);return _0x3be3a0(_0x4b1d94[_0xb887('0x38')](0x1f4,_0x412fb4));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x3be3a0(_0x4b1d94[_0xb887('0x38')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x4a8c89){var _0x2bf461=this;return new Promise(function(_0x56b033,_0x21e062){if(_0x4a8c89[_0xb887('0x14')]&&_0x4a8c89['interaction']&&_0x4a8c89['interaction']['id']){try{var _0xf1bc8a=getId(_0x4a8c89['channel'],_0x4a8c89[_0xb887('0x15')]?_0x4a8c89[_0xb887('0x15')]['id']:0x0,_0x4a8c89['interaction']?_0x4a8c89[_0xb887('0x16')]['id']:0x0);if(_0x5899bb[_0xb887('0x13')][_0xf1bc8a]){_0x5899bb[_0xb887('0x13')][_0xf1bc8a][_0xb887('0x3d')](_0xb887('0x45'));}return _0x56b033({'code':0xc8,'message':_0x4a8c89});}catch(_0xe50f5){logger['error'](_0xe50f5[_0xb887('0x49')]);return _0x21e062(_0x2bf461['error'](0x1f4,_0xe50f5));}}logger[_0xb887('0x38')](_0xb887('0x4a'));return _0x21e062(_0x2bf461['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x57e39e){var _0x53fdd3=this;return new Promise(function(_0x10f7db,_0x593f3e){if(_0x5899bb[_0xb887('0x43')]['hasOwnProperty'](_0x57e39e['id'])){for(var _0x359283 in _0x57e39e[_0xb887('0x4b')]){if(_0x57e39e[_0xb887('0x4b')][_0xb887('0x4c')](_0x359283)){if(_0x5899bb[_0xb887('0x43')][_0x57e39e['id']][_0xb887('0x4c')](_0x359283+_0xb887('0x4d'))){_0x5899bb[_0xb887('0x43')][_0x57e39e['id']][_0x359283+_0xb887('0x4d')]=parseInt(_0x57e39e['capacity'][_0x359283],0xa);}}}_0x5899bb[_0xb887('0x43')][_0x57e39e['id']]['updateRealtime']();return _0x10f7db({'code':0xc8,'message':_0x5899bb['agents'][_0x57e39e['id']]});}else{return _0x593f3e(_0x53fdd3['error'](0x1f4,_0xb887('0x4e')));}});},'Agents':function(_0x274fbb){return new Promise(function(_0xbd5373){var _0x1a07b8=_['values'](_0x5899bb[_0xb887('0x43')]);if(_0x274fbb&&_0x274fbb['id']){var _0x3564f5=_[_0xb887('0x4f')](_0x1a07b8,function(_0x2dd54c){return _0x2dd54c['id']===_0x274fbb['id'];});_0xbd5373(_0x3564f5);}else{_0xbd5373({'count':_0x1a07b8[_0xb887('0x22')],'rows':_0x1a07b8});}});},'ChatQueues':function(){return new Promise(function(_0x135ca9){var _0x36876c=[];for(var _0x4a1df0 in _0x5899bb[_0xb887('0x50')]){if(_0x5899bb[_0xb887('0x50')][_0xb887('0x4c')](_0x4a1df0)){var _0x4e15fb=_0x5899bb['chatQueues'][_0x4a1df0];var _0x17795f={'id':_0x4e15fb['id'],'available':_0x4e15fb['available'],'loggedIn':_0x4e15fb[_0xb887('0x51')],'name':_0x4e15fb[_0xb887('0x52')],'paused':_0x4e15fb[_0xb887('0x53')],'waiting':_0x4e15fb[_0xb887('0x54')]};_0x36876c[_0xb887('0x20')](_0x17795f);}}_0x135ca9({'count':_0x36876c[_0xb887('0x22')],'rows':_0x36876c});});},'MailQueues':function(){return new Promise(function(_0x41fbe0){var _0x2f3cd9=[];for(var _0x569cc1 in _0x5899bb['mailQueues']){if(_0x5899bb[_0xb887('0x55')][_0xb887('0x4c')](_0x569cc1)){var _0x45e256=_0x5899bb[_0xb887('0x55')][_0x569cc1];var _0x548dd7={'id':_0x45e256['id'],'available':_0x45e256[_0xb887('0x56')],'loggedIn':_0x45e256['loggedIn'],'name':_0x45e256[_0xb887('0x52')],'paused':_0x45e256['paused'],'waiting':_0x45e256[_0xb887('0x54')]};_0x2f3cd9[_0xb887('0x20')](_0x548dd7);}}_0x41fbe0({'count':_0x2f3cd9[_0xb887('0x22')],'rows':_0x2f3cd9});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a92e9){var _0x52eeb0=[];for(var _0x12ec80 in _0x5899bb[_0xb887('0x57')]){if(_0x5899bb[_0xb887('0x57')]['hasOwnProperty'](_0x12ec80)){var _0x3adc6e=_0x5899bb[_0xb887('0x57')][_0x12ec80];var _0x5a7cdc={'id':_0x3adc6e['id'],'available':_0x3adc6e['available'],'loggedIn':_0x3adc6e[_0xb887('0x51')],'name':_0x3adc6e['name'],'paused':_0x3adc6e[_0xb887('0x53')],'waiting':_0x3adc6e[_0xb887('0x54')]};_0x52eeb0[_0xb887('0x20')](_0x5a7cdc);}}_0x4a92e9({'count':_0x52eeb0[_0xb887('0x22')],'rows':_0x52eeb0});});},'SmsQueues':function(){return new Promise(function(_0x1fe2a3){var _0x28298e=[];for(var _0x476c75 in _0x5899bb[_0xb887('0x58')]){if(_0x5899bb[_0xb887('0x58')]['hasOwnProperty'](_0x476c75)){var _0x58ca3b=_0x5899bb['smsQueues'][_0x476c75];var _0x364e36={'id':_0x58ca3b['id'],'available':_0x58ca3b[_0xb887('0x56')],'loggedIn':_0x58ca3b['loggedIn'],'name':_0x58ca3b[_0xb887('0x52')],'paused':_0x58ca3b[_0xb887('0x53')],'waiting':_0x58ca3b[_0xb887('0x54')]};_0x28298e[_0xb887('0x20')](_0x364e36);}}_0x1fe2a3({'count':_0x28298e['length'],'rows':_0x28298e});});},'FaxQueues':function(){return new Promise(function(_0xa30ed6){var _0x4e032d=[];for(var _0x14958d in _0x5899bb[_0xb887('0x59')]){if(_0x5899bb[_0xb887('0x59')][_0xb887('0x4c')](_0x14958d)){var _0x348f18=_0x5899bb['faxQueues'][_0x14958d];var _0x524a17={'id':_0x348f18['id'],'available':_0x348f18['available'],'loggedIn':_0x348f18['loggedIn'],'name':_0x348f18[_0xb887('0x52')],'paused':_0x348f18[_0xb887('0x53')],'waiting':_0x348f18['waiting']};_0x4e032d[_0xb887('0x20')](_0x524a17);}}_0xa30ed6({'count':_0x4e032d['length'],'rows':_0x4e032d});});},'WhatsappQueues':function(){return new Promise(function(_0x3b320c){var _0x4b44f0=[];for(var _0x47f32d in _0x5899bb[_0xb887('0x5a')]){if(_0x5899bb[_0xb887('0x5a')][_0xb887('0x4c')](_0x47f32d)){var _0x29ac0b=_0x5899bb[_0xb887('0x5a')][_0x47f32d];var _0x223186={'id':_0x29ac0b['id'],'available':_0x29ac0b[_0xb887('0x56')],'loggedIn':_0x29ac0b['loggedIn'],'name':_0x29ac0b['name'],'paused':_0x29ac0b['paused'],'waiting':_0x29ac0b[_0xb887('0x54')]};_0x4b44f0['push'](_0x223186);}}_0x3b320c({'count':_0x4b44f0[_0xb887('0x22')],'rows':_0x4b44f0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1f8b02){var _0x559224=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5c')]);_0x1f8b02({'count':_0x559224['length'],'rows':_0x559224});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3b450e){var _0x2d6ef1=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5d')]);_0x3b450e({'count':_0x2d6ef1[_0xb887('0x22')],'rows':_0x2d6ef1});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x49e29f){var _0x5f33bb=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5e')]);_0x49e29f({'count':_0x5f33bb['length'],'rows':_0x5f33bb});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x5839c1){var _0x3fc349=_['values'](_0x5899bb['smsQueuesWaitingInteractions']);_0x5839c1({'count':_0x3fc349[_0xb887('0x22')],'rows':_0x3fc349});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5cc14c){var _0x15f23c=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x5f')]);_0x5cc14c({'count':_0x15f23c[_0xb887('0x22')],'rows':_0x15f23c});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1e9f07){var _0x1f3a81=_[_0xb887('0x5b')](_0x5899bb[_0xb887('0x60')]);_0x1e9f07({'count':_0x1f3a81[_0xb887('0x22')],'rows':_0x1f3a81});});}};var _0x3a8c6b=jayson[_0xb887('0x61')](_0x34174a)[_0xb887('0x62')]();_0x3a8c6b['on'](_0xb887('0x38'),function(_0x1196db){logger[_0xb887('0x38')](JSON[_0xb887('0x3b')](_0x1196db));return _0x28bda6(_0x1196db);});_0x3a8c6b[_0xb887('0x12')](0x232c,_0xb887('0x63'),function(){console['log'](_0xb887('0x64'),0x232c);return _0xae7291(_0xb887('0x65')+0x232c);});});}; \ No newline at end of file +var _0xf7a1=['UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','interaction','applications','isArray','length','app','.js','autoreply','appdata','split','channel','mail','push','slice','join','dialogflow','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','message','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update'];(function(_0x5b144b,_0x29e58d){var _0x153a81=function(_0x27c1b4){while(--_0x27c1b4){_0x5b144b['push'](_0x5b144b['shift']());}};_0x153a81(++_0x29e58d);}(_0xf7a1,0xed));var _0x1f7a=function(_0x5874ca,_0xf90b52){_0x5874ca=_0x5874ca-0x0;var _0x4b41d7=_0xf7a1[_0x5874ca];return _0x4b41d7;};'use strict';var _=require(_0x1f7a('0x0'));var util=require(_0x1f7a('0x1'));var path=require(_0x1f7a('0x2'));var fs=require('fs');var jayson=require(_0x1f7a('0x3'));var BPromise=require(_0x1f7a('0x4'));var utils=require(_0x1f7a('0x5'));var sUtils=require(_0x1f7a('0x6'));var logger=require('../../../config/logger')(_0x1f7a('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x1f7a('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x1f7a('0x9')),'whatsappQueueReport':require(_0x1f7a('0xa'))};var RuleEngine=require(_0x1f7a('0xb'));function getId(_0x1ff20a,_0x4c4f12,_0x3971ab){return util[_0x1f7a('0xc')](_0x1f7a('0xd'),_0x1ff20a,_0x4c4f12||0x0,_0x3971ab||0x0);}function getIntervals(_0x32d27b,_0x5d357a){var _0x527b0a=[];if(!_['isNil'](_0x5d357a[_0x1f7a('0xe')])&&!_[_0x1f7a('0xf')](_0x32d27b[_0x5d357a['IntervalId']])&&!_[_0x1f7a('0xf')](_0x32d27b[_0x5d357a['IntervalId']][_0x1f7a('0x10')])){_0x527b0a=_[_0x1f7a('0x11')](_0x32d27b[_0x5d357a[_0x1f7a('0xe')]][_0x1f7a('0x10')],_0x1f7a('0x12'));}else if(!_[_0x1f7a('0xf')](_0x5d357a[_0x1f7a('0x12')])){_0x527b0a=[_0x5d357a[_0x1f7a('0x12')]];}return _0x527b0a;}exports[_0x1f7a('0x13')]=function(_0x3abda2){_0x3abda2[_0x1f7a('0x14')]={};return new BPromise(function(_0xbc6854,_0x3d7e0f){var _0x43c89b={'Start':function(_0x2de9bf){var _0x44762b=this;return new Promise(function(_0x4d3601,_0x44a419){if(_0x2de9bf){try{var _0x29dff4=[];var _0x2ef907=getId(_0x2de9bf['channel'],_0x2de9bf['message']?_0x2de9bf['message']['id']:0x0,_0x2de9bf[_0x1f7a('0x15')]?_0x2de9bf[_0x1f7a('0x15')]['id']:0x0);var _0x29d0f5=sUtils['checkWaitingNotifications'](_0x3abda2,_0x2de9bf);if(_0x2de9bf['transfer']||!_0x29d0f5&&_0x2de9bf[_0x1f7a('0x16')]&&_[_0x1f7a('0x17')](_0x2de9bf[_0x1f7a('0x16')])&&_0x2de9bf[_0x1f7a('0x16')]['length']){for(var _0x33151b=0x0;_0x33151b<_0x2de9bf[_0x1f7a('0x16')][_0x1f7a('0x18')];_0x33151b+=0x1){var _0x1cdf43=_0x2de9bf[_0x1f7a('0x16')][_0x33151b];if(fs['existsSync'](path['join'](__dirname,_0x1f7a('0x16'),_0x1cdf43[_0x1f7a('0x19')]+_0x1f7a('0x1a')))){var _0x189434=[];switch(_0x1cdf43[_0x1f7a('0x19')]['toLowerCase']()){case _0x1f7a('0x1b'):var _0x2ca312=_0x1cdf43[_0x1f7a('0x1c')][_0x1f7a('0x1d')](',');if(_0x2de9bf[_0x1f7a('0x1e')]===_0x1f7a('0x1f')){_0x189434[_0x1f7a('0x20')](_0x2ca312[0x0]);_0x189434[_0x1f7a('0x20')](_0x2ca312[0x1]);_0x189434[_0x1f7a('0x20')](_0x2ca312[_0x1f7a('0x21')](0x2,_0x2ca312[_0x1f7a('0x18')])['join'](','));}else{_0x189434[_0x1f7a('0x20')](_0x2ca312[0x0]);_0x189434['push'](_0x2ca312['slice'](0x1,_0x2ca312[_0x1f7a('0x18')])[_0x1f7a('0x22')](','));}break;case _0x1f7a('0x23'):var _0x527139=_0x1cdf43['appdata'][_0x1f7a('0x1d')](',');_0x189434[_0x1f7a('0x20')](_0x527139[0x0]);_0x189434[_0x1f7a('0x20')](_0x527139[0x1]);_0x189434[_0x1f7a('0x20')](_0x527139[_0x1f7a('0x21')](0x2,_0x527139['length'])['join'](','));break;case'dialogflowv2':var _0x1d4086=_0x1cdf43[_0x1f7a('0x1c')][_0x1f7a('0x1d')](',');_0x189434['push'](_0x1d4086[0x0]);_0x189434[_0x1f7a('0x20')](_0x1d4086[0x1]);_0x189434[_0x1f7a('0x20')](_0x1d4086[0x2]);_0x189434[_0x1f7a('0x20')](_0x1d4086[0x3]);_0x189434[_0x1f7a('0x20')](_0x1d4086[_0x1f7a('0x21')](0x4,_0x1d4086[_0x1f7a('0x18')])[_0x1f7a('0x22')](','));break;case _0x1f7a('0x24'):var _0x2d13b0=_0x1cdf43[_0x1f7a('0x1c')]['split'](',');_0x189434[_0x1f7a('0x20')](_0x2d13b0[0x0]);_0x189434[_0x1f7a('0x20')](_0x2d13b0[0x1]);_0x189434[_0x1f7a('0x20')](_0x2d13b0[0x2]);_0x189434[_0x1f7a('0x20')](_0x2d13b0[0x3]);_0x189434[_0x1f7a('0x20')](_0x2d13b0[_0x1f7a('0x21')](0x4,_0x2d13b0[_0x1f7a('0x18')])[_0x1f7a('0x22')](','));break;case'message':_0x189434[_0x1f7a('0x20')](_0x1cdf43[_0x1f7a('0x1c')]);break;case _0x1f7a('0x25'):_0x189434[_0x1f7a('0x20')](_0x1cdf43[_0x1f7a('0x26')]);_0x189434[_0x1f7a('0x20')](_0x1cdf43[_0x1f7a('0x1c')]);break;case'tvox':var _0x5abf5e=utils[_0x1f7a('0x27')](_0x2de9bf[_0x1f7a('0x28')][_0x1f7a('0x29')],_0x2de9bf);var _0x4de2f2=_0x1cdf43[_0x1f7a('0x1c')]['split'](',');_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x0]);_0x189434['push'](_0x4de2f2[0x1]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x2]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x3]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x4]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x5]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x6]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x7]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x8]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0x9]);_0x189434[_0x1f7a('0x20')](_0x4de2f2[0xa]);_0x189434[_0x1f7a('0x20')](_0x2de9bf[_0x1f7a('0x15')]['id']);_0x189434[_0x1f7a('0x20')](_0x2de9bf[_0x1f7a('0x2a')]['id']);_0x189434['push'](_0x1cdf43[_0x1f7a('0x2b')]);_0x189434[_0x1f7a('0x20')](_0x2de9bf[_0x1f7a('0x15')][_0x1f7a('0x2c')]);_0x189434[_0x1f7a('0x20')](_0x2de9bf['body'][_0x1f7a('0x2d')]);_0x189434[_0x1f7a('0x20')](_0x5abf5e);break;default:_0x189434=_[_0x1f7a('0xf')](_0x1cdf43['appdata'])?[]:_0x1cdf43[_0x1f7a('0x1c')][_0x1f7a('0x1d')](',');}var _0x38200f={'id':util['format'](_0x1f7a('0x2e'),_0x2ef907,_0x1cdf43['id'],_0x1cdf43['app']),'condition':require(_0x1f7a('0x2f'))[_0x1f7a('0x30')](_0x2ef907,getIntervals(_0x3abda2['intervals'],_0x1cdf43),_0x3abda2),'consequence':require(_0x1f7a('0x31')+_0x1cdf43['app'])[_0x1f7a('0x32')](_0x2ef907,_0x189434,_0x3abda2,_0x2de9bf),'p':_0x1cdf43[_0x1f7a('0x33')]||0x0};logger[_0x1f7a('0x34')]('Push\x20new\x20rule',_0x38200f['id'],_0x1f7a('0x35'),getIntervals(_0x3abda2['intervals'],_0x1cdf43)[_0x1f7a('0x22')](_0x1f7a('0x36')));_0x29dff4[_0x1f7a('0x20')](_0x38200f);}else{logger[_0x1f7a('0x37')](_0x1f7a('0x38'),path[_0x1f7a('0x22')](__dirname,_0x1f7a('0x16'),_0x1cdf43[_0x1f7a('0x19')]+'.js'));}}_0x3abda2['rules'][_0x2ef907]=new RuleEngine(_0x29dff4);_0x3abda2[_0x1f7a('0x14')][_0x2ef907][_0x1f7a('0x39')](_0x2de9bf,function(_0x451260){logger[_0x1f7a('0x34')](_0x1f7a('0x3a'),JSON[_0x1f7a('0x3b')](_0x451260['matchPath']));if(_0x3abda2[_0x1f7a('0x14')][_0x2ef907]){_0x3abda2['rules'][_0x2ef907][_0x1f7a('0x3c')](_0x1f7a('0x3d'));}});return _0x4d3601({'code':0xc8,'message':_0x2de9bf});}else{if(_0x29d0f5){logger[_0x1f7a('0x34')](util[_0x1f7a('0xc')](_0x1f7a('0x3e'),_0x2ef907));}else{logger['info'](_0x1f7a('0x3f'));}return _0x4d3601({'code':0xc8,'message':_0x2de9bf});}}catch(_0x595640){logger[_0x1f7a('0x37')](_0x595640['stack']);return _0x44a419(_0x44762b[_0x1f7a('0x37')](0x1f4,_0x595640));}}return _0x44a419(_0x1f7a('0x40'));});},'AcceptMessage':function(_0x19e5be){var _0x59dcd0=this;return new Promise(function(_0x5efd10,_0x42ed1c){if(_0x19e5be[_0x1f7a('0x41')]&&_0x19e5be[_0x1f7a('0x41')]['id']){if(_0x3abda2['agents'][_0x19e5be[_0x1f7a('0x41')]['id']]){_0x3abda2[_0x1f7a('0x42')][_0x19e5be[_0x1f7a('0x41')]['id']][_0x1f7a('0x43')]=![];_0x3abda2[_0x1f7a('0x42')][_0x19e5be[_0x1f7a('0x41')]['id']][_0x1f7a('0x44')]=undefined;}}if(_0x19e5be[_0x1f7a('0x2a')]&&_0x19e5be[_0x1f7a('0x2a')]['id']){try{var _0x43bdce=getId(_0x19e5be[_0x1f7a('0x1e')],_0x19e5be[_0x1f7a('0x2a')]?_0x19e5be['message']['id']:0x0,_0x19e5be[_0x1f7a('0x15')]?_0x19e5be[_0x1f7a('0x15')]['id']:0x0);if(_0x3abda2[_0x1f7a('0x14')][_0x43bdce]){_0x3abda2[_0x1f7a('0x14')][_0x43bdce][_0x1f7a('0x3c')](_0x1f7a('0x45'));if(rpc[_0x19e5be['channel']+_0x1f7a('0x46')]){rpc[_0x19e5be[_0x1f7a('0x1e')]+'QueueReport'][_0x1f7a('0x47')](_0x43bdce,{'UserId':_0x19e5be[_0x1f7a('0x2a')][_0x1f7a('0x48')]})['catch'](function(){logger[_0x1f7a('0x37')](_0x1f7a('0x49'));});}}return _0x5efd10({'code':0xc8,'message':_0x19e5be});}catch(_0x29e759){logger[_0x1f7a('0x37')](_0x29e759[_0x1f7a('0x4a')]);return _0x42ed1c(_0x59dcd0[_0x1f7a('0x37')](0x1f4,_0x29e759));}}logger['error'](_0x1f7a('0x4b'));return _0x42ed1c(_0x59dcd0['error'](0x1f4,_0x1f7a('0x4b')));});},'RejectMessage':function(_0x40981e){var _0x1b2b50=this;return new Promise(function(_0x42c673,_0x17cedd){if(_0x40981e[_0x1f7a('0x41')]&&_0x40981e['agent']['id']){try{if(_0x3abda2[_0x1f7a('0x42')][_0x40981e[_0x1f7a('0x41')]['id']]){_0x3abda2[_0x1f7a('0x42')][_0x40981e[_0x1f7a('0x41')]['id']][_0x1f7a('0x43')]=![];_0x3abda2[_0x1f7a('0x42')][_0x40981e[_0x1f7a('0x41')]['id']][_0x1f7a('0x44')]=undefined;}return _0x42c673({'code':0xc8,'message':_0x40981e});}catch(_0x5dc206){logger['error'](_0x5dc206['stack']);return _0x17cedd(_0x1b2b50[_0x1f7a('0x37')](0x1f4,_0x5dc206));}}logger[_0x1f7a('0x37')]('message\x20is\x20empty');return _0x17cedd(_0x1b2b50['error'](0x1f4,_0x1f7a('0x4b')));});},'AbandonInteraction':function(_0xfbccf1){var _0x4102b6=this;return new Promise(function(_0x482329,_0x4ba2d7){if(_0xfbccf1['channel']&&_0xfbccf1[_0x1f7a('0x15')]&&_0xfbccf1[_0x1f7a('0x15')]['id']){try{var _0xc27293=getId(_0xfbccf1[_0x1f7a('0x1e')],_0xfbccf1[_0x1f7a('0x2a')]?_0xfbccf1['message']['id']:0x0,_0xfbccf1['interaction']?_0xfbccf1['interaction']['id']:0x0);if(_0x3abda2['rules'][_0xc27293]){_0x3abda2[_0x1f7a('0x14')][_0xc27293][_0x1f7a('0x3c')](_0x1f7a('0x45'));}return _0x482329({'code':0xc8,'message':_0xfbccf1});}catch(_0x4c6357){logger[_0x1f7a('0x37')](_0x4c6357[_0x1f7a('0x4a')]);return _0x4ba2d7(_0x4102b6[_0x1f7a('0x37')](0x1f4,_0x4c6357));}}logger[_0x1f7a('0x37')](_0x1f7a('0x4b'));return _0x4ba2d7(_0x4102b6['error'](0x1f4,_0x1f7a('0x4b')));});},'AgentCapacity':function(_0xd77420){var _0x5e3711=this;return new Promise(function(_0xdd2d6c,_0x5c8688){if(_0x3abda2['agents']['hasOwnProperty'](_0xd77420['id'])){for(var _0x48099f in _0xd77420[_0x1f7a('0x4c')]){if(_0xd77420['capacity']['hasOwnProperty'](_0x48099f)){if(_0x3abda2[_0x1f7a('0x42')][_0xd77420['id']][_0x1f7a('0x4d')](_0x48099f+_0x1f7a('0x4e'))){_0x3abda2[_0x1f7a('0x42')][_0xd77420['id']][_0x48099f+'CurrentCapacity']=parseInt(_0xd77420[_0x1f7a('0x4c')][_0x48099f],0xa);}}}_0x3abda2['agents'][_0xd77420['id']][_0x1f7a('0x4f')]();return _0xdd2d6c({'code':0xc8,'message':_0x3abda2[_0x1f7a('0x42')][_0xd77420['id']]});}else{return _0x5c8688(_0x5e3711[_0x1f7a('0x37')](0x1f4,_0x1f7a('0x50')));}});},'Agents':function(_0x49f38f){return new Promise(function(_0x5782d3){var _0x9841c9=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x42')]);if(_0x49f38f&&_0x49f38f['id']){var _0x112861=_[_0x1f7a('0x52')](_0x9841c9,function(_0x11a4a5){return _0x11a4a5['id']===_0x49f38f['id'];});_0x5782d3(_0x112861);}else{_0x5782d3({'count':_0x9841c9[_0x1f7a('0x18')],'rows':_0x9841c9});}});},'ChatQueues':function(){return new Promise(function(_0xce59aa){var _0x34cf88=[];for(var _0x1c4e8f in _0x3abda2['chatQueues']){if(_0x3abda2['chatQueues']['hasOwnProperty'](_0x1c4e8f)){var _0x3c008e=_0x3abda2['chatQueues'][_0x1c4e8f];var _0x1bbdb8={'id':_0x3c008e['id'],'available':_0x3c008e['available'],'loggedIn':_0x3c008e[_0x1f7a('0x53')],'name':_0x3c008e['name'],'paused':_0x3c008e[_0x1f7a('0x54')],'waiting':_0x3c008e[_0x1f7a('0x55')]};_0x34cf88['push'](_0x1bbdb8);}}_0xce59aa({'count':_0x34cf88[_0x1f7a('0x18')],'rows':_0x34cf88});});},'MailQueues':function(){return new Promise(function(_0x3322c9){var _0x570dbb=[];for(var _0x5bfcbf in _0x3abda2[_0x1f7a('0x56')]){if(_0x3abda2['mailQueues'][_0x1f7a('0x4d')](_0x5bfcbf)){var _0x5d32fd=_0x3abda2['mailQueues'][_0x5bfcbf];var _0x217ecc={'id':_0x5d32fd['id'],'available':_0x5d32fd[_0x1f7a('0x57')],'loggedIn':_0x5d32fd[_0x1f7a('0x53')],'name':_0x5d32fd[_0x1f7a('0x58')],'paused':_0x5d32fd[_0x1f7a('0x54')],'waiting':_0x5d32fd[_0x1f7a('0x55')]};_0x570dbb[_0x1f7a('0x20')](_0x217ecc);}}_0x3322c9({'count':_0x570dbb[_0x1f7a('0x18')],'rows':_0x570dbb});});},'OpenchannelQueues':function(){return new Promise(function(_0x1c2dc7){var _0x2024e2=[];for(var _0xa038af in _0x3abda2[_0x1f7a('0x59')]){if(_0x3abda2['openchannelQueues'][_0x1f7a('0x4d')](_0xa038af)){var _0x335054=_0x3abda2[_0x1f7a('0x59')][_0xa038af];var _0x508bc5={'id':_0x335054['id'],'available':_0x335054[_0x1f7a('0x57')],'loggedIn':_0x335054[_0x1f7a('0x53')],'name':_0x335054[_0x1f7a('0x58')],'paused':_0x335054['paused'],'waiting':_0x335054[_0x1f7a('0x55')]};_0x2024e2['push'](_0x508bc5);}}_0x1c2dc7({'count':_0x2024e2[_0x1f7a('0x18')],'rows':_0x2024e2});});},'SmsQueues':function(){return new Promise(function(_0x1198b0){var _0x3089b1=[];for(var _0x17aaa9 in _0x3abda2[_0x1f7a('0x5a')]){if(_0x3abda2[_0x1f7a('0x5a')][_0x1f7a('0x4d')](_0x17aaa9)){var _0x2466ec=_0x3abda2[_0x1f7a('0x5a')][_0x17aaa9];var _0x358c3e={'id':_0x2466ec['id'],'available':_0x2466ec['available'],'loggedIn':_0x2466ec['loggedIn'],'name':_0x2466ec[_0x1f7a('0x58')],'paused':_0x2466ec[_0x1f7a('0x54')],'waiting':_0x2466ec['waiting']};_0x3089b1[_0x1f7a('0x20')](_0x358c3e);}}_0x1198b0({'count':_0x3089b1[_0x1f7a('0x18')],'rows':_0x3089b1});});},'FaxQueues':function(){return new Promise(function(_0x2c22b3){var _0x5ce727=[];for(var _0x2a044 in _0x3abda2['faxQueues']){if(_0x3abda2[_0x1f7a('0x5b')][_0x1f7a('0x4d')](_0x2a044)){var _0x3151ff=_0x3abda2[_0x1f7a('0x5b')][_0x2a044];var _0x24f7b8={'id':_0x3151ff['id'],'available':_0x3151ff[_0x1f7a('0x57')],'loggedIn':_0x3151ff[_0x1f7a('0x53')],'name':_0x3151ff[_0x1f7a('0x58')],'paused':_0x3151ff['paused'],'waiting':_0x3151ff[_0x1f7a('0x55')]};_0x5ce727['push'](_0x24f7b8);}}_0x2c22b3({'count':_0x5ce727[_0x1f7a('0x18')],'rows':_0x5ce727});});},'WhatsappQueues':function(){return new Promise(function(_0x43befb){var _0x5c7cc2=[];for(var _0x543b94 in _0x3abda2[_0x1f7a('0x5c')]){if(_0x3abda2[_0x1f7a('0x5c')]['hasOwnProperty'](_0x543b94)){var _0x42d717=_0x3abda2[_0x1f7a('0x5c')][_0x543b94];var _0x4673cd={'id':_0x42d717['id'],'available':_0x42d717[_0x1f7a('0x57')],'loggedIn':_0x42d717[_0x1f7a('0x53')],'name':_0x42d717[_0x1f7a('0x58')],'paused':_0x42d717[_0x1f7a('0x54')],'waiting':_0x42d717[_0x1f7a('0x55')]};_0x5c7cc2[_0x1f7a('0x20')](_0x4673cd);}}_0x43befb({'count':_0x5c7cc2[_0x1f7a('0x18')],'rows':_0x5c7cc2});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x20564e){var _0x432e2c=_[_0x1f7a('0x51')](_0x3abda2['chatQueuesWaitingInteractions']);_0x20564e({'count':_0x432e2c[_0x1f7a('0x18')],'rows':_0x432e2c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x404173){var _0xe238c7=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x5d')]);_0x404173({'count':_0xe238c7[_0x1f7a('0x18')],'rows':_0xe238c7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x475fae){var _0xecb41d=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x5e')]);_0x475fae({'count':_0xecb41d['length'],'rows':_0xecb41d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1d74e0){var _0x40f579=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x5f')]);_0x1d74e0({'count':_0x40f579[_0x1f7a('0x18')],'rows':_0x40f579});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x581e3f){var _0x18e032=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x60')]);_0x581e3f({'count':_0x18e032['length'],'rows':_0x18e032});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xd13435){var _0x5309df=_[_0x1f7a('0x51')](_0x3abda2[_0x1f7a('0x61')]);_0xd13435({'count':_0x5309df['length'],'rows':_0x5309df});});}};var _0x19d9ce=jayson[_0x1f7a('0x62')](_0x43c89b)['http']();_0x19d9ce['on'](_0x1f7a('0x37'),function(_0x57e5d3){logger[_0x1f7a('0x37')](JSON[_0x1f7a('0x3b')](_0x57e5d3));return _0x3d7e0f(_0x57e5d3);});_0x19d9ce['listen'](0x232c,_0x1f7a('0x63'),function(){console[_0x1f7a('0x64')](_0x1f7a('0x65'),0x232c);return _0xbc6854(_0x1f7a('0x66')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ce645c0..2e488c3 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 _0x8f4b=['../../../utils/iftime','condition','rules','info','stop','map','some','join','\x20|\x20','when'];(function(_0x4179a7,_0x2b4ae9){var _0x22a841=function(_0x1badb1){while(--_0x1badb1){_0x4179a7['push'](_0x4179a7['shift']());}};_0x22a841(++_0x2b4ae9);}(_0x8f4b,0x1a4));var _0xb8f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f4b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var iftime=require(_0xb8f4('0x0'))['iftime'];var logger=require('../../../config/logger')('routing');exports[_0xb8f4('0x1')]=function(_0x3d540b,_0x1c8f0a,_0x457279){return function(_0x415ea9){if(_0x457279[_0xb8f4('0x2')]&&!_0x457279[_0xb8f4('0x2')][_0x3d540b]){logger[_0xb8f4('0x3')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3d540b);return _0x415ea9[_0xb8f4('0x4')]();}var _0x1f92f4=_0x1c8f0a[_0xb8f4('0x5')](function(_0x9991ed){return iftime(_0x9991ed);});var _0x308881=_[_0xb8f4('0x6')](_0x1f92f4);if(_0x308881){logger[_0xb8f4('0x3')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x3d540b,_0x1c8f0a[_0xb8f4('0x7')](_0xb8f4('0x8')),_0x308881);_0x415ea9[_0xb8f4('0x9')](_0x308881);}else{logger[_0xb8f4('0x3')]('[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s',_0x3d540b,_0x1c8f0a['join'](_0xb8f4('0x8')));_0x415ea9[_0xb8f4('0x4')]();}};}; \ No newline at end of file +var _0xc2d1=['condition','rules','info','stop','map','some','join','\x20|\x20','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','../../../utils/iftime','routing'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0xc2d1,0x1d7));var _0x1c2d=function(_0x1d8b9d,_0x534299){_0x1d8b9d=_0x1d8b9d-0x0;var _0x65192d=_0xc2d1[_0x1d8b9d];return _0x65192d;};'use strict';var _=require('lodash');var iftime=require(_0x1c2d('0x0'))['iftime'];var logger=require('../../../config/logger')(_0x1c2d('0x1'));exports[_0x1c2d('0x2')]=function(_0x301333,_0x537703,_0x2b06ed){return function(_0x31d9fc){if(_0x2b06ed[_0x1c2d('0x3')]&&!_0x2b06ed[_0x1c2d('0x3')][_0x301333]){logger[_0x1c2d('0x4')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x301333);return _0x31d9fc[_0x1c2d('0x5')]();}var _0xfb5ef0=_0x537703[_0x1c2d('0x6')](function(_0x543660){return iftime(_0x543660);});var _0x2c2833=_[_0x1c2d('0x7')](_0xfb5ef0);if(_0x2c2833){logger[_0x1c2d('0x4')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x301333,_0x537703[_0x1c2d('0x8')](_0x1c2d('0x9')),_0x2c2833);_0x31d9fc['when'](_0x2c2833);}else{logger[_0x1c2d('0x4')](_0x1c2d('0xa'),_0x301333,_0x537703[_0x1c2d('0x8')](_0x1c2d('0x9')));_0x31d9fc[_0x1c2d('0x5')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a74a0c7..80ad892 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 _0x4e81=['[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete'];(function(_0x2a5ff0,_0x43476f){var _0x28166e=function(_0x20dc8a){while(--_0x20dc8a){_0x2a5ff0['push'](_0x2a5ff0['shift']());}};_0x28166e(++_0x43476f);}(_0x4e81,0x1bc));var _0x14e8=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x4e81[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var utils=require(_0x14e8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x533fb3,_0x4b9800){utils['info'](util[_0x14e8('0x3')](_0x14e8('0x4'),_0x533fb3[_0x14e8('0x5')],_0x533fb3[_0x14e8('0x6')],_0x533fb3[_0x14e8('0x7')],_0x533fb3[_0x14e8('0x8')],_0x533fb3['interface'],_0x533fb3['calleridnum'],_0x533fb3[_0x14e8('0x9')],_0x533fb3[_0x14e8('0xa')]));if(_0x533fb3[_0x14e8('0x7')]){utils[_0x14e8('0xb')](_0x533fb3[_0x14e8('0x7')])[_0x14e8('0xc')](function(_0x39127a){if(_0x39127a){_0x533fb3[_0x14e8('0xd')]=_0x39127a[_0x14e8('0xd')];_0x533fb3['agentacw']=_0x533fb3[_0x14e8('0xe')]?_0x39127a[_0x14e8('0xf')]:![];_0x533fb3[_0x14e8('0x10')]=_0x533fb3[_0x14e8('0x11')]?_0x39127a[_0x14e8('0x12')]:0x0;}utils[_0x14e8('0x13')](_0x14e8('0x14'),_0x533fb3);});}else{utils[_0x14e8('0x13')]('CreateVoiceAgentReport',_0x533fb3);}if(_0x4b9800){delete transfers[_0x533fb3[_0x14e8('0x5')]];}else{delete agents[_0x533fb3['destuniqueid']];}}exports[_0x14e8('0x15')]=function(_0x341d40){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x17'),_0x341d40['uniqueid']),_0x341d40);agents[_0x341d40[_0x14e8('0x18')]]=_0x341d40;agents[_0x341d40['destuniqueid']][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0xa')]='called';agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x9')]=null;agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x1b')]=null;utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x1d'),_0x341d40[_0x14e8('0x5')],agents[_0x341d40['destuniqueid']][_0x14e8('0x8')],_0x341d40[_0x14e8('0x18')]));}catch(_0x151f16){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][agentcalled]',_0x341d40[_0x14e8('0x5')]),_0x151f16);}};exports[_0x14e8('0x1f')]=function(_0x2abfec){try{if(!_['isNil'](agents[_0x2abfec[_0x14e8('0x18')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x20'),_0x2abfec[_0x14e8('0x5')]),_0x2abfec);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x2abfec[_0x14e8('0x5')],agents[_0x2abfec['destuniqueid']][_0x14e8('0x8')],_0x2abfec[_0x14e8('0x18')]));agents[_0x2abfec['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2abfec['destuniqueid']][_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x22');agents[_0x2abfec['destuniqueid']][_0x14e8('0x23')]=_0x14e8('0x22');agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0x24')]=_0x2abfec[_0x14e8('0x25')]?parseInt(_0x2abfec[_0x14e8('0x25')])/0x3e8:0x0;agents[_0x2abfec[_0x14e8('0x18')]]['talktime']=0x0;unanswered[_0x14e8('0x26')](_0x2abfec[_0x14e8('0x18')]);}}catch(_0x393ab0){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x2abfec[_0x14e8('0x5')]),_0x393ab0);}};exports[_0x14e8('0x27')]=function(_0x567385){try{_[_0x14e8('0x28')](agents,function(_0x1d71ca,_0x176e8f){if(_0x1d71ca[_0x14e8('0x5')]==_0x567385['uniqueid']&&!_[_0x14e8('0x29')](unanswered,_0x1d71ca[_0x14e8('0x18')])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')](_0x14e8('0x2a'),_0x567385['uniqueid']),_0x567385);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x2b'),_0x567385[_0x14e8('0x5')],_0x1d71ca['membername'],_0x1d71ca[_0x14e8('0x18')]));_0x1d71ca['agentringnoanswer']=!![];_0x1d71ca[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1d71ca[_0x14e8('0xa')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x23')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x24')]=_0x567385[_0x14e8('0x24')];_0x1d71ca[_0x14e8('0x2d')]=0x0;writeDB(_0x1d71ca);}});}catch(_0x2acf6a){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][queuecallerabandon]',_0x567385['uniqueid']),_0x2acf6a);}};exports['agentconnect']=function(_0x16ff09){try{if(agents[_0x16ff09['destuniqueid']]){utils[_0x14e8('0x16')](util['format'](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x16ff09);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ff09[_0x14e8('0x5')],agents[_0x16ff09['destuniqueid']][_0x14e8('0x8')],_0x16ff09[_0x14e8('0x18')]));agents[_0x16ff09[_0x14e8('0x18')]][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();agents[_0x16ff09[_0x14e8('0x18')]]['connectedlinenum']=_0x16ff09[_0x14e8('0x9')];agents[_0x16ff09['destuniqueid']][_0x14e8('0x1b')]=_0x16ff09[_0x14e8('0x1b')];agents[_0x16ff09[_0x14e8('0x18')]]['holdtime']=_0x16ff09[_0x14e8('0x25')];agents[_0x16ff09[_0x14e8('0x18')]]['lastevent']=_0x14e8('0x30');_[_0x14e8('0x28')](agents,function(_0x1f429a,_0x3a7aa7){if(_0x1f429a[_0x14e8('0x18')]!=_0x16ff09[_0x14e8('0x18')]&&_0x1f429a[_0x14e8('0x5')]==_0x16ff09[_0x14e8('0x5')]){_0x1f429a[_0x14e8('0x2d')]=0x0;_0x1f429a[_0x14e8('0x24')]=_0x16ff09[_0x14e8('0x25')];_0x1f429a[_0x14e8('0x1f')]=!![];_0x1f429a[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1f429a[_0x14e8('0xa')]='answered_elsewhere';_0x1f429a[_0x14e8('0x23')]='answered_elsewhere';_0x1f429a['answeredelsewheredestinationuniqueid']=_0x16ff09['destuniqueid'];_0x1f429a[_0x14e8('0x31')]=_0x16ff09['membername'];writeDB(_0x1f429a);}});}}catch(_0x46a3c4){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x46a3c4);}};exports[_0x14e8('0xe')]=function(_0x125af5){try{if(!_[_0x14e8('0x32')](agents[_0x125af5[_0x14e8('0x18')]])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')]('[%s][agents][agentcomplete]',_0x125af5[_0x14e8('0x5')]),_0x125af5);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x33'),_0x125af5['uniqueid'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x8')],_0x125af5['destuniqueid']));agents[_0x125af5['destuniqueid']][_0x14e8('0xe')]=!![];agents[_0x125af5['destuniqueid']]['agentcompleteAt']=utils[_0x14e8('0x1a')]();agents[_0x125af5[_0x14e8('0x18')]]['talktime']=utils[_0x14e8('0x34')](agents[_0x125af5[_0x14e8('0x18')]]['agentcompleteAt'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x2f')]);agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x23')]=_0x125af5[_0x14e8('0x23')];agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x35');writeDB(agents[_0x125af5[_0x14e8('0x18')]]);}}catch(_0x42180d){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x36'),_0x125af5[_0x14e8('0x5')]),_0x42180d);}};exports[_0x14e8('0x37')]=function(_0x1f50bc){try{if(!_['isNil'](agents[_0x1f50bc[_0x14e8('0x38')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x1f50bc);utils[_0x14e8('0x1c')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1f50bc['uniqueid'],agents[_0x1f50bc[_0x14e8('0x38')]]['membername'],agents[_0x1f50bc['transfereruniqueid']][_0x14e8('0x5')]));agents[_0x1f50bc[_0x14e8('0x38')]]['transfer']=!![];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3a')]=_0x14e8('0x3b');agents[_0x1f50bc[_0x14e8('0x38')]]['transferexten']=_0x1f50bc['extension'];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3c')]=agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x5')];}}catch(_0x41b5ab){utils[_0x14e8('0x1e')](util['format'](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x41b5ab);}};exports[_0x14e8('0x3d')]=function(_0xd5adc1){try{utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0xd5adc1);if(_0xd5adc1[_0x14e8('0x3f')]==_0xd5adc1['origtransfererlinkedid']){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x40')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x41'),_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x8')]));agents[_0xd5adc1['secondtransfereruniqueid']]['transfer']=!![];agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x43')]=_0xd5adc1['origtransfererexten'];agents[_0xd5adc1['secondtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x3f')];}if(_0xd5adc1[_0x14e8('0x44')]&&agents[_0xd5adc1[_0x14e8('0x44')]]){agents[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x44')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfereeuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x47')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x48')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x48')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x45')]=0x2;}}else if(_0xd5adc1[_0x14e8('0x40')]==_0xd5adc1[_0x14e8('0x49')]){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x3f')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x3f')]]['membername']));agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x4a')]=!![];agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x43')]=_0xd5adc1['secondtransfererexten'];agents[_0xd5adc1['origtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x40')];}if(_0xd5adc1[_0x14e8('0x4b')]&&agents[_0xd5adc1[_0x14e8('0x4b')]]){agents[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x4b')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfertargetuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x47')]=agents[_0xd5adc1['origtransfereruniqueid']][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x4b')]]['calleridname']=agents[_0xd5adc1['origtransfereruniqueid']]['calleridname'];transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]]['agentconnectAt']=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x2;}}}catch(_0x36d0e5){utils['error'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0x36d0e5);}};exports['hangup']=function(_0x5add74){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x4c'),_0x5add74['uniqueid']),_0x5add74);if(agents[_0x5add74[_0x14e8('0x5')]]&&agents[_0x5add74['uniqueid']][_0x14e8('0x23')]===_0x14e8('0x22')){if(_0x5add74['cause']==='21'){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x4d');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x4d');}utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']]['lastevent']));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);var _0x52f0a7=unanswered[_0x14e8('0x4f')](_0x5add74['uniqueid']);if(_0x52f0a7>-0x1){unanswered[_0x14e8('0x50')](_0x52f0a7,0x1);}}if(transfers[_0x5add74['uniqueid']]){transfers[_0x5add74['uniqueid']]['agentcomplete']=!![];transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();transfers[_0x5add74['uniqueid']][_0x14e8('0x2d')]=utils['diffTime'](transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]);transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x52');transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]='complete';utils[_0x14e8('0x1c')](util['format'](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]));writeDB(transfers[_0x5add74[_0x14e8('0x5')]],!![]);}if(agents[_0x5add74['uniqueid']]&&agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xe')]=!![];agents[_0x5add74['uniqueid']][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2d')]=utils['diffTime'](agents[_0x5add74[_0x14e8('0x5')]]['agentcompleteAt'],agents[_0x5add74[_0x14e8('0x5')]]['agentconnectAt']);agents[_0x5add74['uniqueid']][_0x14e8('0x23')]=agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x4a')]?_0x14e8('0x4a'):_0x14e8('0x52');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x35');utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74['uniqueid'],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']][_0x14e8('0xa')]));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);}}catch(_0xc3ebbc){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x4c'),_0x5add74[_0x14e8('0x5')]),_0xc3ebbc);}}; \ No newline at end of file +var _0x2e54=['connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','error','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2e54,0x1dd));var _0x42e5=function(_0x226ad,_0x6f7b0){_0x226ad=_0x226ad-0x0;var _0x43df7b=_0x2e54[_0x226ad];return _0x43df7b;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x216de4,_0x23f008){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x3'),_0x216de4[_0x42e5('0x4')],_0x216de4[_0x42e5('0x5')],_0x216de4['queue'],_0x216de4[_0x42e5('0x6')],_0x216de4[_0x42e5('0x7')],_0x216de4[_0x42e5('0x8')],_0x216de4['connectedlinenum'],_0x216de4[_0x42e5('0x9')]));if(_0x216de4['queue']){utils[_0x42e5('0xa')](_0x216de4['queue'])[_0x42e5('0xb')](function(_0x224b11){if(_0x224b11){_0x216de4[_0x42e5('0xc')]=_0x224b11[_0x42e5('0xc')];_0x216de4[_0x42e5('0xd')]=_0x216de4[_0x42e5('0xe')]?_0x224b11[_0x42e5('0xf')]:![];_0x216de4[_0x42e5('0x10')]=_0x216de4[_0x42e5('0xd')]?_0x224b11['acwTimeout']:0x0;}utils[_0x42e5('0x11')](_0x42e5('0x12'),_0x216de4);});}else{utils['request'](_0x42e5('0x12'),_0x216de4);}if(_0x23f008){delete transfers[_0x216de4[_0x42e5('0x4')]];}else{delete agents[_0x216de4[_0x42e5('0x13')]];}}exports[_0x42e5('0x14')]=function(_0x144fb4){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4[_0x42e5('0x4')]),_0x144fb4);agents[_0x144fb4[_0x42e5('0x13')]]=_0x144fb4;agents[_0x144fb4['destuniqueid']][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x19');agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1a')]=null;agents[_0x144fb4[_0x42e5('0x13')]][_0x42e5('0x1b')]=null;utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x1c'),_0x144fb4[_0x42e5('0x4')],agents[_0x144fb4[_0x42e5('0x13')]]['membername'],_0x144fb4[_0x42e5('0x13')]));}catch(_0x4a129e){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x16'),_0x144fb4['uniqueid']),_0x4a129e);}};exports[_0x42e5('0x1d')]=function(_0x39a3e2){try{if(!_[_0x42e5('0x1e')](agents[_0x39a3e2[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2['uniqueid']),_0x39a3e2);utils['info'](util[_0x42e5('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x39a3e2[_0x42e5('0x4')],agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x6')],_0x39a3e2[_0x42e5('0x13')]));agents[_0x39a3e2[_0x42e5('0x13')]]['agentringnoanswer']=!![];agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x20')]=utils[_0x42e5('0x18')]();agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x9')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x21')]='timeout';agents[_0x39a3e2['destuniqueid']][_0x42e5('0x22')]=_0x39a3e2['ringtime']?parseInt(_0x39a3e2[_0x42e5('0x23')])/0x3e8:0x0;agents[_0x39a3e2[_0x42e5('0x13')]][_0x42e5('0x24')]=0x0;unanswered[_0x42e5('0x25')](_0x39a3e2[_0x42e5('0x13')]);}}catch(_0x2f1edc){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x1f'),_0x39a3e2[_0x42e5('0x4')]),_0x2f1edc);}};exports[_0x42e5('0x26')]=function(_0x1d22ba){try{_[_0x42e5('0x27')](agents,function(_0x383e97,_0x282cbf){if(_0x383e97[_0x42e5('0x4')]==_0x1d22ba[_0x42e5('0x4')]&&!_[_0x42e5('0x28')](unanswered,_0x383e97[_0x42e5('0x13')])){utils[_0x42e5('0x15')](util['format'](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x1d22ba);utils[_0x42e5('0x1')](util[_0x42e5('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1d22ba['uniqueid'],_0x383e97[_0x42e5('0x6')],_0x383e97['destuniqueid']));_0x383e97[_0x42e5('0x1d')]=!![];_0x383e97['agentringnoanswerAt']=utils[_0x42e5('0x18')]();_0x383e97[_0x42e5('0x9')]=_0x42e5('0x2a');_0x383e97['reason']=_0x42e5('0x2a');_0x383e97[_0x42e5('0x22')]=_0x1d22ba['holdtime'];_0x383e97[_0x42e5('0x24')]=0x0;writeDB(_0x383e97);}});}catch(_0x57558d){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x29'),_0x1d22ba[_0x42e5('0x4')]),_0x57558d);}};exports[_0x42e5('0x2c')]=function(_0x41f891){try{if(agents[_0x41f891[_0x42e5('0x13')]]){utils['debug'](util['format'](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x41f891);utils[_0x42e5('0x1')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x41f891['uniqueid'],agents[_0x41f891['destuniqueid']][_0x42e5('0x6')],_0x41f891[_0x42e5('0x13')]));agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x1a')]=_0x41f891[_0x42e5('0x1a')];agents[_0x41f891['destuniqueid']][_0x42e5('0x1b')]=_0x41f891['connectedlinename'];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x22')]=_0x41f891[_0x42e5('0x23')];agents[_0x41f891[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x2f');_[_0x42e5('0x27')](agents,function(_0x5ab9b8,_0x20f372){if(_0x5ab9b8[_0x42e5('0x13')]!=_0x41f891['destuniqueid']&&_0x5ab9b8[_0x42e5('0x4')]==_0x41f891['uniqueid']){_0x5ab9b8['talktime']=0x0;_0x5ab9b8['holdtime']=_0x41f891[_0x42e5('0x23')];_0x5ab9b8[_0x42e5('0x1d')]=!![];_0x5ab9b8[_0x42e5('0x20')]=utils[_0x42e5('0x18')]();_0x5ab9b8[_0x42e5('0x9')]=_0x42e5('0x30');_0x5ab9b8[_0x42e5('0x21')]='answered_elsewhere';_0x5ab9b8[_0x42e5('0x31')]=_0x41f891[_0x42e5('0x13')];_0x5ab9b8['answeredelsewheremembername']=_0x41f891[_0x42e5('0x6')];writeDB(_0x5ab9b8);}});}}catch(_0x1c697a){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x2d'),_0x41f891[_0x42e5('0x4')]),_0x1c697a);}};exports[_0x42e5('0xe')]=function(_0x424304){try{if(!_['isNil'](agents[_0x424304[_0x42e5('0x13')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x32'),_0x424304['uniqueid']),_0x424304);utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x33'),_0x424304[_0x42e5('0x4')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x6')],_0x424304[_0x42e5('0x13')]));agents[_0x424304[_0x42e5('0x13')]]['agentcomplete']=!![];agents[_0x424304[_0x42e5('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x35')],agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x2e')]);agents[_0x424304['destuniqueid']][_0x42e5('0x21')]=_0x424304[_0x42e5('0x21')];agents[_0x424304[_0x42e5('0x13')]][_0x42e5('0x9')]=_0x42e5('0x36');writeDB(agents[_0x424304[_0x42e5('0x13')]]);}}catch(_0x3d910a){utils[_0x42e5('0x2b')](util['format'](_0x42e5('0x32'),_0x424304[_0x42e5('0x4')]),_0x3d910a);}};exports[_0x42e5('0x37')]=function(_0x48757e){try{if(!_[_0x42e5('0x1e')](agents[_0x48757e[_0x42e5('0x38')]])){utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e['uniqueid']),_0x48757e);utils[_0x42e5('0x1')](util['format'](_0x42e5('0x3a'),_0x48757e[_0x42e5('0x4')],agents[_0x48757e[_0x42e5('0x38')]]['membername'],agents[_0x48757e['transfereruniqueid']]['uniqueid']));agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3b')]=!![];agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3c')]='blind';agents[_0x48757e[_0x42e5('0x38')]][_0x42e5('0x3d')]=_0x48757e[_0x42e5('0x3e')];agents[_0x48757e['transfereruniqueid']][_0x42e5('0x3f')]=agents[_0x48757e['transfereruniqueid']][_0x42e5('0x4')];}}catch(_0x2583cd){utils['error'](util[_0x42e5('0x2')](_0x42e5('0x39'),_0x48757e[_0x42e5('0x4')]),_0x2583cd);}};exports[_0x42e5('0x40')]=function(_0x24682c){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x41'),_0x24682c[_0x42e5('0x42')]),_0x24682c);if(_0x24682c[_0x42e5('0x42')]==_0x24682c['origtransfererlinkedid']){if(!_[_0x42e5('0x1e')](agents[_0x24682c[_0x42e5('0x43')]])){utils[_0x42e5('0x1')](util[_0x42e5('0x2')](_0x42e5('0x44'),_0x24682c['origtransfereruniqueid'],agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3d')]=_0x24682c['origtransfererexten'];agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x3f')]=_0x24682c[_0x42e5('0x42')];}if(_0x24682c[_0x42e5('0x45')]&&agents[_0x24682c[_0x42e5('0x45')]]){agents[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x45')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfereeuniqueid']]);transfers[_0x24682c[_0x42e5('0x45')]]['calleridnum']=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x43')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x17')]=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x45')]][_0x42e5('0x2e')]=utils['now']();transfers[_0x24682c[_0x42e5('0x45')]]['holdtime']=0x0;transfers[_0x24682c[_0x42e5('0x45')]]['agententerreason']=0x2;}}else if(_0x24682c[_0x42e5('0x43')]==_0x24682c[_0x42e5('0x49')]){if(!_['isNil'](agents[_0x24682c[_0x42e5('0x42')]])){utils[_0x42e5('0x1')](util['format'](_0x42e5('0x44'),_0x24682c[_0x42e5('0x42')],agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x6')]));agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3b')]=!![];agents[_0x24682c['origtransfereruniqueid']][_0x42e5('0x3c')]=_0x42e5('0x4a');agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x3d')]=_0x24682c['secondtransfererexten'];agents[_0x24682c[_0x42e5('0x42')]]['transferuniqueid']=_0x24682c[_0x42e5('0x43')];}if(_0x24682c[_0x42e5('0x4b')]&&agents[_0x24682c[_0x42e5('0x4b')]]){agents[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x1;transfers[_0x24682c[_0x42e5('0x4b')]]=_[_0x42e5('0x47')](agents[_0x24682c['transfertargetuniqueid']]);transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x8')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x8')];transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x48')]=agents[_0x24682c[_0x42e5('0x42')]][_0x42e5('0x48')];transfers[_0x24682c[_0x42e5('0x4b')]]['agentcalledAt']=utils[_0x42e5('0x18')]();transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x2e')]=utils[_0x42e5('0x18')]();transfers[_0x24682c['transfertargetuniqueid']][_0x42e5('0x22')]=0x0;transfers[_0x24682c[_0x42e5('0x4b')]][_0x42e5('0x46')]=0x2;}}}catch(_0x3a0942){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x24682c[_0x42e5('0x42')]),_0x3a0942);}};exports[_0x42e5('0x4c')]=function(_0x8c7c57){try{utils[_0x42e5('0x15')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57[_0x42e5('0x4')]),_0x8c7c57);if(agents[_0x8c7c57[_0x42e5('0x4')]]&&agents[_0x8c7c57[_0x42e5('0x4')]]['reason']===_0x42e5('0x4e')){if(_0x8c7c57[_0x42e5('0x4f')]==='21'){agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=_0x42e5('0x50');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x50');}utils['info'](util['format'](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57['uniqueid']]['membername'],agents[_0x8c7c57['uniqueid']][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);var _0x3603df=unanswered['indexOf'](_0x8c7c57[_0x42e5('0x4')]);if(_0x3603df>-0x1){unanswered[_0x42e5('0x52')](_0x3603df,0x1);}}if(transfers[_0x8c7c57['uniqueid']]){transfers[_0x8c7c57[_0x42e5('0x4')]]['agentcomplete']=!![];transfers[_0x8c7c57['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils['diffTime'](transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]='agent';transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]='complete';utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],transfers[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],transfers[_0x8c7c57['uniqueid']]['lastevent']));writeDB(transfers[_0x8c7c57['uniqueid']],!![]);}if(agents[_0x8c7c57['uniqueid']]&&agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]){agents[_0x8c7c57['uniqueid']][_0x42e5('0xe')]=!![];agents[_0x8c7c57['uniqueid']][_0x42e5('0x35')]=utils[_0x42e5('0x18')]();agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x24')]=utils[_0x42e5('0x34')](agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x35')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x2e')]);agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')]=agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x3b')]?_0x42e5('0x3b'):_0x42e5('0x53');agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x9')]=_0x42e5('0x36');utils['info'](util[_0x42e5('0x2')](_0x42e5('0x51'),_0x8c7c57[_0x42e5('0x4')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x6')],agents[_0x8c7c57[_0x42e5('0x4')]][_0x42e5('0x21')],agents[_0x8c7c57[_0x42e5('0x4')]]['lastevent']));writeDB(agents[_0x8c7c57[_0x42e5('0x4')]]);}}catch(_0x5777c2){utils[_0x42e5('0x2b')](util[_0x42e5('0x2')](_0x42e5('0x4d'),_0x8c7c57['uniqueid']),_0x5777c2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9c728b3..30f134d 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 _0xe865=['[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lastdata','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','channel','queue','calleridnum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','context','exten','now','DOCUMENTATION','error','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten'];(function(_0x1c37fe,_0x10a098){var _0x45e904=function(_0x2b69f4){while(--_0x2b69f4){_0x1c37fe['push'](_0x1c37fe['shift']());}};_0x45e904(++_0x10a098);}(_0xe865,0x1a7));var _0x5e86=function(_0x1353bc,_0x432b07){_0x1353bc=_0x1353bc-0x0;var _0x3097a6=_0xe865[_0x1353bc];return _0x3097a6;};'use strict';var _=require(_0x5e86('0x0'));var util=require(_0x5e86('0x1'));var utils=require('./utils');var dispositions=[_0x5e86('0x2'),'FAILED',_0x5e86('0x3'),_0x5e86('0x2'),_0x5e86('0x2'),_0x5e86('0x2'),'ANSWERED',_0x5e86('0x4'),'FAILED','FAILED',_0x5e86('0x3')];var channels={};function writeDB(_0x56bb0){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x56bb0[_0x5e86('0x7')],_0x56bb0[_0x5e86('0x8')],_0x56bb0[_0x5e86('0x9')],_0x56bb0['membername'],_0x56bb0['interface'],_0x56bb0[_0x5e86('0xa')],_0x56bb0['connectedlinenum'],_0x56bb0[_0x5e86('0xb')]));if(_0x56bb0[_0x5e86('0xc')]){utils[_0x5e86('0xd')](_0x56bb0[_0x5e86('0xc')])['then'](function(_0x433ecb){if(_0x433ecb){_0x56bb0['UserId']=_0x433ecb['id'];}utils[_0x5e86('0xe')](_0x5e86('0xf'),_0x56bb0);});}else{utils[_0x5e86('0xe')](_0x5e86('0xf'),_0x56bb0);}if(channels[_0x56bb0[_0x5e86('0x7')]]){delete channels[_0x56bb0[_0x5e86('0x7')]];}}exports[_0x5e86('0x10')]=function(_0x351151){try{utils['debug'](util['format'](_0x5e86('0x11'),_0x351151[_0x5e86('0x7')]),_0x351151);if(_0x351151['uniqueid']==_0x351151[_0x5e86('0x12')]&&_0x351151[_0x5e86('0x8')]!='OutgoingSpoolFailed'){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x351151[_0x5e86('0x7')],_0x351151[_0x5e86('0x13')],_0x351151[_0x5e86('0x14')]));channels[_0x351151[_0x5e86('0x7')]]={'uniqueid':_0x351151['uniqueid'],'accountcode':_0x351151['accountcode'],'source':_0x351151['calleridnum'],'destination':_0x351151[_0x5e86('0x14')],'destinationcontext':_0x351151['context'],'channel':_0x351151[_0x5e86('0x8')],'starttime':utils[_0x5e86('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5e86('0x2'),'amaflags':_0x5e86('0x16')};}}catch(_0x4bb143){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x11'),_0x351151[_0x5e86('0x7')]),_0x4bb143);}};exports['newstate']=function(_0x5815e8){try{utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x19'),_0x5815e8[_0x5e86('0x7')]),_0x5815e8);if(!_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x7')]])&&_0x5815e8[_0x5e86('0x1b')]==0x6){utils['info'](util[_0x5e86('0x6')](_0x5e86('0x1c'),_0x5815e8[_0x5e86('0x7')],_0x5815e8[_0x5e86('0x13')],_0x5815e8[_0x5e86('0x8')]));if(_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x7')]]['systemanswertime'])){channels[_0x5815e8[_0x5e86('0x7')]][_0x5e86('0x1d')]=utils[_0x5e86('0x15')]();}}else if(!_[_0x5e86('0x1a')](channels[_0x5815e8[_0x5e86('0x12')]])&&_0x5815e8[_0x5e86('0x1b')]==0x6&&_0x5815e8['context']!=_0x5e86('0x1e')){utils[_0x5e86('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5815e8[_0x5e86('0x7')],_0x5815e8['linkedid'],_0x5815e8[_0x5e86('0x13')],_0x5815e8[_0x5e86('0x8')]));channels[_0x5815e8[_0x5e86('0x12')]][_0x5e86('0xc')]=_0x5815e8[_0x5e86('0xc')];channels[_0x5815e8['linkedid']]['destinationchannel']=_0x5815e8['channel'];if(_[_0x5e86('0x1a')](channels[_0x5815e8['linkedid']][_0x5e86('0x1f')])){channels[_0x5815e8['linkedid']][_0x5e86('0x1f')]=utils[_0x5e86('0x15')]();}channels[_0x5815e8['linkedid']][_0x5e86('0x20')]=dispositions[_[_0x5e86('0x21')](_0x5815e8[_0x5e86('0x1b')])]||_0x5e86('0x22');}}catch(_0x280888){utils['error'](util[_0x5e86('0x6')](_0x5e86('0x19'),_0x5815e8[_0x5e86('0x7')]),_0x280888);}};exports[_0x5e86('0x23')]=function(_0x283d82){try{if(!_[_0x5e86('0x1a')](channels[_0x283d82['uniqueid']])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x24'),_0x283d82[_0x5e86('0x7')]),_0x283d82);if(_[_0x5e86('0x1a')](channels[_0x283d82[_0x5e86('0x7')]]['callerid'])){channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x25')]=_0x283d82[_0x5e86('0x26')]+'\x20<'+_0x283d82['calleridnum']+'>';}utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x27'),_0x283d82[_0x5e86('0x7')],channels[_0x283d82[_0x5e86('0x7')]]['callerid'],_0x283d82[_0x5e86('0x28')]));channels[_0x283d82[_0x5e86('0x7')]]['endtime']=utils['now']();channels[_0x283d82['uniqueid']]['duration']=utils['diffTime'](channels[_0x283d82['uniqueid']][_0x5e86('0x29')],channels[_0x283d82['uniqueid']][_0x5e86('0x2a')]);channels[_0x283d82['uniqueid']][_0x5e86('0x2b')]=channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x1f')]?utils[_0x5e86('0x2c')](channels[_0x283d82['uniqueid']][_0x5e86('0x29')],channels[_0x283d82[_0x5e86('0x7')]][_0x5e86('0x1f')]):0x0;writeDB(channels[_0x283d82[_0x5e86('0x7')]]);}}catch(_0x43b227){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x24'),_0x283d82[_0x5e86('0x7')]),_0x43b227);}};exports[_0x5e86('0x2d')]=function(_0x2e41eb){try{if(!_[_0x5e86('0x1a')](channels[_0x2e41eb[_0x5e86('0x2e')]])){utils['debug'](util[_0x5e86('0x6')]('[%s][calls][attendedtransfer]',_0x2e41eb[_0x5e86('0x2f')]),_0x2e41eb);if(channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x8')]==_0x2e41eb[_0x5e86('0x30')]){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x31'),_0x2e41eb[_0x5e86('0x2f')],_0x2e41eb[_0x5e86('0x2e')],_0x2e41eb[_0x5e86('0x32')]));channels[_0x2e41eb[_0x5e86('0x2e')]]['destinationchannel']=_0x2e41eb[_0x5e86('0x32')];channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x33')]=_0x5e86('0x34');}else if(channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x8')]=_0x2e41eb['transfertargetchannel']){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x31'),_0x2e41eb[_0x5e86('0x2f')],_0x2e41eb[_0x5e86('0x2e')],_0x2e41eb[_0x5e86('0x35')]));channels[_0x2e41eb[_0x5e86('0x2e')]]['destinationchannel']=_0x2e41eb[_0x5e86('0x35')];channels[_0x2e41eb[_0x5e86('0x2e')]][_0x5e86('0x33')]='_attended';}}}catch(_0x2d2412){utils['error'](util[_0x5e86('0x6')](_0x5e86('0x36'),_0x2e41eb[_0x5e86('0x2f')]),_0x2d2412);}};exports[_0x5e86('0x37')]=function(_0xe6aa7f){try{if(!_[_0x5e86('0x1a')](channels[_0xe6aa7f[_0x5e86('0x7')]])){utils['debug'](util[_0x5e86('0x6')]('[%s][calls][musiconholdstart]',_0xe6aa7f['uniqueid']),_0xe6aa7f);channels[_0xe6aa7f[_0x5e86('0x7')]][_0x5e86('0x38')]=utils[_0x5e86('0x15')]();utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x39'),_0xe6aa7f[_0x5e86('0x7')],channels[_0xe6aa7f[_0x5e86('0x7')]][_0x5e86('0x38')]));}}catch(_0x427b63){utils[_0x5e86('0x17')](util['format'](_0x5e86('0x3a'),_0xe6aa7f[_0x5e86('0x7')]),_0x427b63);}};exports[_0x5e86('0x3b')]=function(_0x5c2b29){try{if(!_[_0x5e86('0x1a')](channels[_0x5c2b29['uniqueid']])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x3c'),_0x5c2b29['uniqueid']),_0x5c2b29);if(!_[_0x5e86('0x1a')](channels[_0x5c2b29[_0x5e86('0x7')]][_0x5e86('0x38')])){channels[_0x5c2b29[_0x5e86('0x7')]][_0x5e86('0x3d')]+=utils[_0x5e86('0x2c')](utils[_0x5e86('0x15')](),channels[_0x5c2b29['uniqueid']][_0x5e86('0x38')]);utils[_0x5e86('0x5')](util['format'](_0x5e86('0x3e'),_0x5c2b29[_0x5e86('0x7')],channels[_0x5c2b29['uniqueid']]['mohtime']));delete channels[_0x5c2b29[_0x5e86('0x7')]]['musiconholdstartAt'];}}}catch(_0x3152f8){utils[_0x5e86('0x17')](util[_0x5e86('0x6')](_0x5e86('0x3c'),_0x5c2b29[_0x5e86('0x7')]),_0x3152f8);}};exports[_0x5e86('0x3f')]=function(_0x330903){try{if(!_[_0x5e86('0x1a')](channels[_0x330903[_0x5e86('0x7')]])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x40'),_0x330903[_0x5e86('0x7')]),_0x330903);if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x42')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x330903[_0x5e86('0x7')],_0x330903['value']));channels[_0x330903['uniqueid']][_0x5e86('0x43')]=_0x330903['value'];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x44')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x45'),_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x47')]=_0x330903[_0x5e86('0x46')];channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x25')]='\x22'+_0x330903[_0x5e86('0x46')]+_0x5e86('0x48')+_0x330903[_0x5e86('0x46')]+'>';}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x49')])||!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4a')])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x4b'),_0x330903[_0x5e86('0x7')],!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x49')])?_0x5e86('0x49'):_0x5e86('0x4a'),_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['callerid']=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x4c')])||!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x4d')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x4b'),_0x330903['uniqueid'],!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4c')])?_0x5e86('0x4c'):'xmcs-queue',_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['lastapplication']='Queue';channels[_0x330903[_0x5e86('0x7')]]['lastdata']=_0x330903[_0x5e86('0x46')];channels[_0x330903[_0x5e86('0x7')]]['queue']=!![];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')][_0x5e86('0x4e')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')](_0x5e86('0x4f'),_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x50')]=_0x330903['value'];}if(!_[_0x5e86('0x1a')](_0x330903[_0x5e86('0x41')]['xmd-cdrtype'])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x51'),_0x330903[_0x5e86('0x7')],_0x330903['value']));channels[_0x330903[_0x5e86('0x7')]]['type']=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x52')])){utils[_0x5e86('0x5')](util[_0x5e86('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x330903[_0x5e86('0x7')],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x53')]=_0x330903[_0x5e86('0x46')];}if(!_[_0x5e86('0x1a')](_0x330903['variable'][_0x5e86('0x54')])){utils[_0x5e86('0x5')](util['format'](_0x5e86('0x55'),_0x330903['uniqueid'],_0x330903[_0x5e86('0x46')]));channels[_0x330903[_0x5e86('0x7')]][_0x5e86('0x54')]=_0x330903[_0x5e86('0x46')];}}}catch(_0xa7eebb){utils[_0x5e86('0x17')](util['format'](_0x5e86('0x40'),_0x330903['uniqueid']),_0xa7eebb);}};exports[_0x5e86('0x56')]=function(_0x380f51){try{if(!_[_0x5e86('0x1a')](channels[_0x380f51[_0x5e86('0x7')]])){utils[_0x5e86('0x18')](util[_0x5e86('0x6')](_0x5e86('0x57'),_0x380f51['uniqueid']),_0x380f51);utils['info'](util['format'](_0x5e86('0x58'),_0x380f51[_0x5e86('0x7')],_0x380f51[_0x5e86('0x59')],_0x380f51[_0x5e86('0x5a')]));if(_0x380f51[_0x5e86('0x59')][_0x5e86('0x5b')]()==_0x5e86('0x5c')&&_['startsWith'](_0x380f51[_0x5e86('0x5a')]['toLowerCase'](),_0x5e86('0x5d'))){var _0x30e543=_0x380f51[_0x5e86('0x5a')]['split']('=');var _0x34d524=_0x30e543[0x0][_0x5e86('0x5e')](_0x30e543[0x0]['lastIndexOf']('(')+0x1,_0x30e543[0x0][_0x5e86('0x5f')](')'));var _0x5931fd=_0x30e543[0x1];channels[_0x380f51[_0x5e86('0x7')]][_0x34d524]=_0x5931fd;}if(!_[_0x5e86('0x60')](['hangup',_0x5e86('0x61'),_0x5e86('0x62'),'set',_0x5e86('0x63')],_0x380f51[_0x5e86('0x59')]['toLowerCase']())){channels[_0x380f51[_0x5e86('0x7')]][_0x5e86('0x64')]=_0x380f51[_0x5e86('0x59')];channels[_0x380f51[_0x5e86('0x7')]][_0x5e86('0x65')]=_0x380f51['appdata'];}}}catch(_0x3a30c8){utils[_0x5e86('0x17')](util[_0x5e86('0x6')]('[%s][calls][newexten]',_0x380f51[_0x5e86('0x7')]),_0x3a30c8);}}; \ No newline at end of file +var _0x64d1=['answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','destinationchannel','_attended','[%s][calls][attendedtransfer]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','cdr','substring','lastIndexOf','includes','noop','set','toLowerCase','lastapplication','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','uniqueid','channel','queue','membername','calleridnum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','isNil','systemanswertime','linkedid','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s'];(function(_0xeaba4b,_0x1eab4b){var _0x32f4fd=function(_0x43ec5b){while(--_0x43ec5b){_0xeaba4b['push'](_0xeaba4b['shift']());}};_0x32f4fd(++_0x1eab4b);}(_0x64d1,0x10a));var _0x164d=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x64d1[_0xbb14db];return _0x36bed7;};'use strict';var _=require(_0x164d('0x0'));var util=require(_0x164d('0x1'));var utils=require(_0x164d('0x2'));var dispositions=[_0x164d('0x3'),_0x164d('0x4'),_0x164d('0x4'),_0x164d('0x3'),_0x164d('0x3'),_0x164d('0x3'),_0x164d('0x5'),_0x164d('0x6'),_0x164d('0x4'),_0x164d('0x4'),'FAILED'];var channels={};function writeDB(_0x458e29){utils[_0x164d('0x7')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x458e29[_0x164d('0x8')],_0x458e29[_0x164d('0x9')],_0x458e29[_0x164d('0xa')],_0x458e29[_0x164d('0xb')],_0x458e29['interface'],_0x458e29[_0x164d('0xc')],_0x458e29['connectedlinenum'],_0x458e29[_0x164d('0xd')]));if(_0x458e29[_0x164d('0xe')]){utils['getUserByInternal'](_0x458e29['accountcode'])['then'](function(_0x1cc5b6){if(_0x1cc5b6){_0x458e29[_0x164d('0xf')]=_0x1cc5b6['id'];}utils[_0x164d('0x10')](_0x164d('0x11'),_0x458e29);});}else{utils[_0x164d('0x10')](_0x164d('0x11'),_0x458e29);}if(channels[_0x458e29[_0x164d('0x8')]]){delete channels[_0x458e29[_0x164d('0x8')]];}}exports[_0x164d('0x12')]=function(_0x827aed){try{utils[_0x164d('0x13')](util[_0x164d('0x14')]('[%s][calls][newchannel]',_0x827aed[_0x164d('0x8')]),_0x827aed);if(_0x827aed[_0x164d('0x8')]==_0x827aed['linkedid']&&_0x827aed[_0x164d('0x9')]!='OutgoingSpoolFailed'){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x15'),_0x827aed['uniqueid'],_0x827aed[_0x164d('0x16')],_0x827aed[_0x164d('0x17')]));channels[_0x827aed[_0x164d('0x8')]]={'uniqueid':_0x827aed[_0x164d('0x8')],'accountcode':_0x827aed[_0x164d('0xe')],'source':_0x827aed[_0x164d('0xc')],'destination':_0x827aed['exten'],'destinationcontext':_0x827aed[_0x164d('0x16')],'channel':_0x827aed[_0x164d('0x9')],'starttime':utils[_0x164d('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x164d('0x3'),'amaflags':_0x164d('0x19')};}}catch(_0x5c4933){utils[_0x164d('0x1a')](util[_0x164d('0x14')](_0x164d('0x1b'),_0x827aed[_0x164d('0x8')]),_0x5c4933);}};exports[_0x164d('0x1c')]=function(_0x335ef0){try{utils['debug'](util[_0x164d('0x14')]('[%s][calls][newstate]',_0x335ef0['uniqueid']),_0x335ef0);if(!_[_0x164d('0x1d')](channels[_0x335ef0[_0x164d('0x8')]])&&_0x335ef0['channelstate']==0x6){utils[_0x164d('0x7')](util[_0x164d('0x14')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x335ef0[_0x164d('0x8')],_0x335ef0[_0x164d('0x16')],_0x335ef0[_0x164d('0x9')]));if(_[_0x164d('0x1d')](channels[_0x335ef0[_0x164d('0x8')]][_0x164d('0x1e')])){channels[_0x335ef0[_0x164d('0x8')]][_0x164d('0x1e')]=utils['now']();}}else if(!_[_0x164d('0x1d')](channels[_0x335ef0[_0x164d('0x1f')]])&&_0x335ef0[_0x164d('0x20')]==0x6&&_0x335ef0['context']!='transfer'){utils['info'](util[_0x164d('0x14')](_0x164d('0x21'),_0x335ef0[_0x164d('0x8')],_0x335ef0[_0x164d('0x1f')],_0x335ef0[_0x164d('0x16')],_0x335ef0['channel']));channels[_0x335ef0[_0x164d('0x1f')]][_0x164d('0xe')]=_0x335ef0['accountcode'];channels[_0x335ef0[_0x164d('0x1f')]]['destinationchannel']=_0x335ef0[_0x164d('0x9')];if(_[_0x164d('0x1d')](channels[_0x335ef0[_0x164d('0x1f')]][_0x164d('0x22')])){channels[_0x335ef0['linkedid']][_0x164d('0x22')]=utils[_0x164d('0x18')]();}channels[_0x335ef0[_0x164d('0x1f')]][_0x164d('0x23')]=dispositions[_['toNumber'](_0x335ef0[_0x164d('0x20')])]||_0x164d('0x5');}}catch(_0xe581d9){utils['error'](util[_0x164d('0x14')]('[%s][calls][newstate]',_0x335ef0['uniqueid']),_0xe581d9);}};exports[_0x164d('0x24')]=function(_0x5313e5){try{if(!_[_0x164d('0x1d')](channels[_0x5313e5[_0x164d('0x8')]])){utils[_0x164d('0x13')](util[_0x164d('0x14')](_0x164d('0x25'),_0x5313e5[_0x164d('0x8')]),_0x5313e5);if(_[_0x164d('0x1d')](channels[_0x5313e5['uniqueid']][_0x164d('0x26')])){channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x26')]=_0x5313e5[_0x164d('0x27')]+'\x20<'+_0x5313e5[_0x164d('0xc')]+'>';}utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x28'),_0x5313e5['uniqueid'],channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x26')],_0x5313e5['cause-txt']));channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x29')]=utils[_0x164d('0x18')]();channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x2a')]=utils[_0x164d('0x2b')](channels[_0x5313e5[_0x164d('0x8')]]['endtime'],channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x2c')]);channels[_0x5313e5[_0x164d('0x8')]]['billableseconds']=channels[_0x5313e5['uniqueid']][_0x164d('0x22')]?utils[_0x164d('0x2b')](channels[_0x5313e5['uniqueid']][_0x164d('0x29')],channels[_0x5313e5[_0x164d('0x8')]][_0x164d('0x22')]):0x0;writeDB(channels[_0x5313e5[_0x164d('0x8')]]);}}catch(_0x426a68){utils[_0x164d('0x1a')](util[_0x164d('0x14')](_0x164d('0x25'),_0x5313e5[_0x164d('0x8')]),_0x426a68);}};exports[_0x164d('0x2d')]=function(_0x1c4888){try{if(!_[_0x164d('0x1d')](channels[_0x1c4888[_0x164d('0x2e')]])){utils['debug'](util[_0x164d('0x14')]('[%s][calls][attendedtransfer]',_0x1c4888[_0x164d('0x2f')]),_0x1c4888);if(channels[_0x1c4888[_0x164d('0x2e')]][_0x164d('0x9')]==_0x1c4888[_0x164d('0x30')]){utils[_0x164d('0x7')](util[_0x164d('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1c4888['origtransfereruniqueid'],_0x1c4888[_0x164d('0x2e')],_0x1c4888['secondtransfererchannel']));channels[_0x1c4888[_0x164d('0x2e')]]['destinationchannel']=_0x1c4888[_0x164d('0x31')];channels[_0x1c4888['localtwolinkedid']][_0x164d('0x32')]='_attended';}else if(channels[_0x1c4888[_0x164d('0x2e')]][_0x164d('0x9')]=_0x1c4888['transfertargetchannel']){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x33'),_0x1c4888[_0x164d('0x2f')],_0x1c4888[_0x164d('0x2e')],_0x1c4888[_0x164d('0x34')]));channels[_0x1c4888[_0x164d('0x2e')]][_0x164d('0x35')]=_0x1c4888[_0x164d('0x34')];channels[_0x1c4888[_0x164d('0x2e')]][_0x164d('0x32')]=_0x164d('0x36');}}}catch(_0x23d259){utils[_0x164d('0x1a')](util[_0x164d('0x14')](_0x164d('0x37'),_0x1c4888[_0x164d('0x2f')]),_0x23d259);}};exports['musiconholdstart']=function(_0x29b376){try{if(!_[_0x164d('0x1d')](channels[_0x29b376['uniqueid']])){utils[_0x164d('0x13')](util[_0x164d('0x14')]('[%s][calls][musiconholdstart]',_0x29b376[_0x164d('0x8')]),_0x29b376);channels[_0x29b376[_0x164d('0x8')]][_0x164d('0x38')]=utils['now']();utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x39'),_0x29b376[_0x164d('0x8')],channels[_0x29b376[_0x164d('0x8')]][_0x164d('0x38')]));}}catch(_0x449513){utils[_0x164d('0x1a')](util[_0x164d('0x14')](_0x164d('0x3a'),_0x29b376['uniqueid']),_0x449513);}};exports[_0x164d('0x3b')]=function(_0xa41660){try{if(!_[_0x164d('0x1d')](channels[_0xa41660[_0x164d('0x8')]])){utils['debug'](util['format'](_0x164d('0x3c'),_0xa41660[_0x164d('0x8')]),_0xa41660);if(!_[_0x164d('0x1d')](channels[_0xa41660[_0x164d('0x8')]]['musiconholdstartAt'])){channels[_0xa41660[_0x164d('0x8')]]['mohtime']+=utils[_0x164d('0x2b')](utils[_0x164d('0x18')](),channels[_0xa41660[_0x164d('0x8')]][_0x164d('0x38')]);utils[_0x164d('0x7')](util['format'](_0x164d('0x3d'),_0xa41660[_0x164d('0x8')],channels[_0xa41660['uniqueid']][_0x164d('0x3e')]));delete channels[_0xa41660[_0x164d('0x8')]][_0x164d('0x38')];}}}catch(_0x38592e){utils[_0x164d('0x1a')](util['format'](_0x164d('0x3c'),_0xa41660[_0x164d('0x8')]),_0x38592e);}};exports['varset']=function(_0x5c0c17){try{if(!_[_0x164d('0x1d')](channels[_0x5c0c17['uniqueid']])){utils['debug'](util[_0x164d('0x14')](_0x164d('0x3f'),_0x5c0c17['uniqueid']),_0x5c0c17);if(!_[_0x164d('0x1d')](_0x5c0c17['variable']['xmd-originatecalleridnum'])){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x40'),_0x5c0c17[_0x164d('0x8')],_0x5c0c17[_0x164d('0x41')]));channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0x42')]=_0x5c0c17[_0x164d('0x41')];}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')]['xmd-phone'])){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x44'),_0x5c0c17['uniqueid'],_0x5c0c17[_0x164d('0x41')]));channels[_0x5c0c17[_0x164d('0x8')]]['destination']=_0x5c0c17[_0x164d('0x41')];channels[_0x5c0c17['uniqueid']][_0x164d('0x26')]='\x22'+_0x5c0c17[_0x164d('0x41')]+_0x164d('0x45')+_0x5c0c17['value']+'>';}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x46')])||!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x47')])){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x48'),_0x5c0c17[_0x164d('0x8')],!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x46')])?_0x164d('0x46'):_0x164d('0x47'),_0x5c0c17['value']));channels[_0x5c0c17[_0x164d('0x8')]]['callerid']=_0x5c0c17[_0x164d('0x41')];}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x49')])||!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')]['xmcs-queue'])){utils['info'](util[_0x164d('0x14')](_0x164d('0x48'),_0x5c0c17['uniqueid'],!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')]['xmd-queue'])?_0x164d('0x49'):'xmcs-queue',_0x5c0c17[_0x164d('0x41')]));channels[_0x5c0c17[_0x164d('0x8')]]['lastapplication']=_0x164d('0x4a');channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0x4b')]=_0x5c0c17['value'];channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0xa')]=!![];}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x4c')])){utils['info'](util['format'](_0x164d('0x4d'),_0x5c0c17[_0x164d('0x8')],_0x5c0c17['value']));channels[_0x5c0c17['uniqueid']][_0x164d('0x4e')]=_0x5c0c17[_0x164d('0x41')];}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x4f')])){utils[_0x164d('0x7')](util[_0x164d('0x14')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5c0c17[_0x164d('0x8')],_0x5c0c17['value']));channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0x50')]=_0x5c0c17[_0x164d('0x41')];}if(!_['isNil'](_0x5c0c17[_0x164d('0x43')][_0x164d('0x51')])){utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x52'),_0x5c0c17[_0x164d('0x8')],_0x5c0c17['value']));channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0x53')]=_0x5c0c17['value'];}if(!_[_0x164d('0x1d')](_0x5c0c17[_0x164d('0x43')][_0x164d('0x54')])){utils['info'](util[_0x164d('0x14')](_0x164d('0x55'),_0x5c0c17[_0x164d('0x8')],_0x5c0c17[_0x164d('0x41')]));channels[_0x5c0c17[_0x164d('0x8')]][_0x164d('0x54')]=_0x5c0c17[_0x164d('0x41')];}}}catch(_0x4c8439){utils[_0x164d('0x1a')](util[_0x164d('0x14')]('[%s][calls][varset]',_0x5c0c17[_0x164d('0x8')]),_0x4c8439);}};exports[_0x164d('0x56')]=function(_0x333eba){try{if(!_[_0x164d('0x1d')](channels[_0x333eba[_0x164d('0x8')]])){utils['debug'](util[_0x164d('0x14')]('[%s][calls][newexten]',_0x333eba[_0x164d('0x8')]),_0x333eba);utils[_0x164d('0x7')](util[_0x164d('0x14')](_0x164d('0x57'),_0x333eba[_0x164d('0x8')],_0x333eba[_0x164d('0x58')],_0x333eba['appdata']));if(_0x333eba[_0x164d('0x58')]['toLowerCase']()=='set'&&_[_0x164d('0x59')](_0x333eba[_0x164d('0x5a')]['toLowerCase'](),_0x164d('0x5b'))){var _0x304883=_0x333eba[_0x164d('0x5a')]['split']('=');var _0x4dc2d8=_0x304883[0x0][_0x164d('0x5c')](_0x304883[0x0][_0x164d('0x5d')]('(')+0x1,_0x304883[0x0][_0x164d('0x5d')](')'));var _0x39da1a=_0x304883[0x1];channels[_0x333eba[_0x164d('0x8')]][_0x4dc2d8]=_0x39da1a;}if(!_[_0x164d('0x5e')]([_0x164d('0x24'),_0x164d('0x5f'),'execif',_0x164d('0x60'),'gotoif'],_0x333eba['application'][_0x164d('0x61')]())){channels[_0x333eba[_0x164d('0x8')]][_0x164d('0x62')]=_0x333eba['application'];channels[_0x333eba[_0x164d('0x8')]]['lastdata']=_0x333eba[_0x164d('0x5a')];}}}catch(_0x3d9150){utils['error'](util['format'](_0x164d('0x63'),_0x333eba[_0x164d('0x8')]),_0x3d9150);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5356ad8..6abe7ba 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 _0xb6a3=['info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x12ece4,_0xc1346a){var _0x1f0e67=function(_0x47c284){while(--_0x47c284){_0x12ece4['push'](_0x12ece4['shift']());}};_0x1f0e67(++_0xc1346a);}(_0xb6a3,0xa6));var _0x3b6a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb6a3[_0x2be8c2];return _0x97f531;};'use strict';var utils=require(_0x3b6a('0x0'));exports[_0x3b6a('0x1')]=function(){utils[_0x3b6a('0x2')]('[core]\x20connected');};exports[_0x3b6a('0x3')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0x4'));};exports[_0x3b6a('0x5')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0x6'));};exports[_0x3b6a('0x7')]=function(_0x35dcb2){utils['error'](_0x3b6a('0x8'),_0x35dcb2);};exports[_0x3b6a('0x9')]=function(){utils[_0x3b6a('0x2')](_0x3b6a('0xa'));};exports[_0x3b6a('0xb')]=function(_0xd0f99c){}; \ No newline at end of file +var _0xd70b=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','managerevent','./utils'];(function(_0xd7d8bf,_0x1a50cb){var _0x58c800=function(_0x3aadbd){while(--_0x3aadbd){_0xd7d8bf['push'](_0xd7d8bf['shift']());}};_0x58c800(++_0x1a50cb);}(_0xd70b,0x17b));var _0xbd70=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0xd70b[_0x340380];return _0x49ce1c;};'use strict';var utils=require(_0xbd70('0x0'));exports[_0xbd70('0x1')]=function(){utils[_0xbd70('0x2')](_0xbd70('0x3'));};exports[_0xbd70('0x4')]=function(){utils[_0xbd70('0x2')](_0xbd70('0x5'));};exports['fullybooted']=function(){utils[_0xbd70('0x2')](_0xbd70('0x6'));};exports[_0xbd70('0x7')]=function(_0xdf1835){utils[_0xbd70('0x7')](_0xbd70('0x8'),_0xdf1835);};exports['close']=function(){utils[_0xbd70('0x2')]('[core]\x20close');};exports[_0xbd70('0x9')]=function(_0x1c414c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 79fbfc7..76fec0a 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 _0xd90d=['split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','ANSWER','answertime','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','diffTime','endtime','starttime','holdtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','application','set','startsWith','appdata','toLowerCase','cdr(routeid)'];(function(_0x139db9,_0x31ce3a){var _0x1dc75b=function(_0x1735dd){while(--_0x1735dd){_0x139db9['push'](_0x139db9['shift']());}};_0x1dc75b(++_0x31ce3a);}(_0xd90d,0x150));var _0xdd90=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xd90d[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xdd90('0x0'));var util=require(_0xdd90('0x1'));var utils=require(_0xdd90('0x2'));var dials={};function writeDB(_0x50b39d){utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x5'),_0x50b39d['uniqueid'],_0x50b39d['channel'],_0x50b39d['dialstring'],_0x50b39d[_0xdd90('0x6')],_0x50b39d[_0xdd90('0x7')],_0x50b39d[_0xdd90('0x8')]));utils[_0xdd90('0x9')](_0xdd90('0xa'),_0x50b39d);delete dials[_0x50b39d[_0xdd90('0xb')]];}exports[_0xdd90('0xc')]=function(_0x1f8311){try{utils[_0xdd90('0xd')](util['format'](_0xdd90('0xe'),_0x1f8311[_0xdd90('0xb')]),_0x1f8311);utils[_0xdd90('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1f8311['uniqueid'],_0x1f8311[_0xdd90('0xf')],_0x1f8311['appdata']));if(_0x1f8311['application']['toLowerCase']()==_0xdd90('0x10')&&_[_0xdd90('0x11')](_0x1f8311[_0xdd90('0x12')][_0xdd90('0x13')](),_0xdd90('0x14'))){var _0x556671=_0x1f8311['appdata'][_0xdd90('0x15')]('=');dials[_0x1f8311[_0xdd90('0xb')]]={'routeId':_0x556671[0x1]};}}catch(_0x4ee2c1){utils[_0xdd90('0x16')](util['format'](_0xdd90('0xe'),_0x1f8311[_0xdd90('0xb')]),_0x4ee2c1);}};exports[_0xdd90('0x17')]=function(_0x7ea57){try{utils['debug'](util['format'](_0xdd90('0x18'),_0x7ea57[_0xdd90('0xb')]),_0x7ea57);if(!_['isNil'](_0x7ea57[_0xdd90('0x19')][_0xdd90('0x1a')])){utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x1b'),_0x7ea57['uniqueid'],_0x7ea57[_0xdd90('0x1c')]));dials[_0x7ea57[_0xdd90('0xb')]]={'routeId':_0x7ea57['value']};}}catch(_0x129703){utils['error'](util['format'](_0xdd90('0x18'),_0x7ea57[_0xdd90('0xb')]),_0x129703);}};exports[_0xdd90('0x1d')]=function(_0x24b8e8){try{if(!_['isNil'](dials[_0x24b8e8[_0xdd90('0xb')]])){utils['debug'](util[_0xdd90('0x4')](_0xdd90('0x1e'),_0x24b8e8[_0xdd90('0xb')]),_0x24b8e8);dials[_0x24b8e8[_0xdd90('0xb')]]=_[_0xdd90('0x1f')](dials[_0x24b8e8[_0xdd90('0xb')]],_0x24b8e8);dials[_0x24b8e8[_0xdd90('0xb')]]['starttime']=utils['now']();dials[_0x24b8e8['uniqueid']]['lastevent']='called';utils['info'](util[_0xdd90('0x4')](_0xdd90('0x20'),_0x24b8e8[_0xdd90('0xb')],dials[_0x24b8e8[_0xdd90('0xb')]]['starttime']));}}catch(_0xee8a34){utils['error'](util[_0xdd90('0x4')](_0xdd90('0x1e'),_0x24b8e8[_0xdd90('0xb')]),_0xee8a34);}};exports[_0xdd90('0x21')]=function(_0x25d78b){try{if(!_[_0xdd90('0x22')](dials[_0x25d78b[_0xdd90('0xb')]])){utils['debug'](util[_0xdd90('0x4')](_0xdd90('0x23'),_0x25d78b[_0xdd90('0xb')]),_0x25d78b);dials[_0x25d78b['uniqueid']][_0xdd90('0x8')]=_0x25d78b[_0xdd90('0x8')];if(_0x25d78b[_0xdd90('0x8')]==_0xdd90('0x24')){dials[_0x25d78b[_0xdd90('0xb')]]=_[_0xdd90('0x1f')](dials[_0x25d78b[_0xdd90('0xb')]],_0x25d78b);dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x25')]=utils[_0xdd90('0x26')]();dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x27')]=_0xdd90('0x28');utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x29'),_0x25d78b[_0xdd90('0xb')],_0x25d78b[_0xdd90('0x8')],dials[_0x25d78b[_0xdd90('0xb')]][_0xdd90('0x25')]));}else{utils[_0xdd90('0x3')](util[_0xdd90('0x4')](_0xdd90('0x2a'),_0x25d78b[_0xdd90('0xb')],_0x25d78b[_0xdd90('0x8')]));}}}catch(_0x40f679){utils[_0xdd90('0x16')](util[_0xdd90('0x4')](_0xdd90('0x23'),_0x25d78b[_0xdd90('0xb')]),_0x40f679);}};exports[_0xdd90('0x2b')]=function(_0x48ab47){try{if(!_['isNil'](dials[_0x48ab47[_0xdd90('0xb')]])){utils[_0xdd90('0xd')](util[_0xdd90('0x4')](_0xdd90('0x2c'),_0x48ab47[_0xdd90('0xb')]),_0x48ab47);utils[_0xdd90('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x48ab47[_0xdd90('0xb')],_0x48ab47[_0xdd90('0x6')],_0x48ab47[_0xdd90('0x2d')],_0x48ab47[_0xdd90('0x2e')]));dials[_0x48ab47[_0xdd90('0xb')]]=_['assign'](dials[_0x48ab47[_0xdd90('0xb')]],{'endtime':utils[_0xdd90('0x26')](),'lastevent':'complete'});dials[_0x48ab47['uniqueid']]['duration']=utils[_0xdd90('0x2f')](dials[_0x48ab47['uniqueid']][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x31')]);dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x32')]=utils['diffTime'](dials[_0x48ab47['uniqueid']][_0xdd90('0x25')]||dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]]['starttime']);dials[_0x48ab47[_0xdd90('0xb')]]['billableseconds']=dials[_0x48ab47[_0xdd90('0xb')]]['answertime']?utils[_0xdd90('0x2f')](dials[_0x48ab47[_0xdd90('0xb')]][_0xdd90('0x30')],dials[_0x48ab47[_0xdd90('0xb')]]['answertime']):0x0;writeDB(dials[_0x48ab47[_0xdd90('0xb')]]);}}catch(_0x315465){utils[_0xdd90('0x16')](util[_0xdd90('0x4')](_0xdd90('0x2c'),_0x48ab47['uniqueid']),_0x315465);}}; \ No newline at end of file +var _0x94de=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','application','appdata','toLowerCase','cdr(routeid)','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','endtime','diffTime','billableseconds','./utils','info','format'];(function(_0x113b80,_0x94203d){var _0x1e842a=function(_0x76d92f){while(--_0x76d92f){_0x113b80['push'](_0x113b80['shift']());}};_0x1e842a(++_0x94203d);}(_0x94de,0xe3));var _0xe94d=function(_0x432b84,_0x5c9834){_0x432b84=_0x432b84-0x0;var _0x5c9006=_0x94de[_0x432b84];return _0x5c9006;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xe94d('0x0'));var dials={};function writeDB(_0x3b082c){utils[_0xe94d('0x1')](util[_0xe94d('0x2')](_0xe94d('0x3'),_0x3b082c[_0xe94d('0x4')],_0x3b082c[_0xe94d('0x5')],_0x3b082c[_0xe94d('0x6')],_0x3b082c[_0xe94d('0x7')],_0x3b082c['connectedlinenum'],_0x3b082c[_0xe94d('0x8')]));utils[_0xe94d('0x9')](_0xe94d('0xa'),_0x3b082c);delete dials[_0x3b082c['uniqueid']];}exports[_0xe94d('0xb')]=function(_0xe390ae){try{utils[_0xe94d('0xc')](util[_0xe94d('0x2')](_0xe94d('0xd'),_0xe390ae[_0xe94d('0x4')]),_0xe390ae);utils[_0xe94d('0x1')](util[_0xe94d('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xe390ae[_0xe94d('0x4')],_0xe390ae[_0xe94d('0xe')],_0xe390ae[_0xe94d('0xf')]));if(_0xe390ae[_0xe94d('0xe')][_0xe94d('0x10')]()=='set'&&_['startsWith'](_0xe390ae[_0xe94d('0xf')]['toLowerCase'](),_0xe94d('0x11'))){var _0x57286e=_0xe390ae[_0xe94d('0xf')][_0xe94d('0x12')]('=');dials[_0xe390ae['uniqueid']]={'routeId':_0x57286e[0x1]};}}catch(_0x2fa413){utils[_0xe94d('0x13')](util[_0xe94d('0x2')](_0xe94d('0xd'),_0xe390ae[_0xe94d('0x4')]),_0x2fa413);}};exports['varset']=function(_0xc1371f){try{utils[_0xe94d('0xc')](util['format'](_0xe94d('0x14'),_0xc1371f['uniqueid']),_0xc1371f);if(!_[_0xe94d('0x15')](_0xc1371f[_0xe94d('0x16')][_0xe94d('0x17')])){utils[_0xe94d('0x1')](util['format'](_0xe94d('0x18'),_0xc1371f[_0xe94d('0x4')],_0xc1371f[_0xe94d('0x19')]));dials[_0xc1371f[_0xe94d('0x4')]]={'routeId':_0xc1371f[_0xe94d('0x19')]};}}catch(_0x59770d){utils[_0xe94d('0x13')](util[_0xe94d('0x2')](_0xe94d('0x14'),_0xc1371f[_0xe94d('0x4')]),_0x59770d);}};exports['dialbegin']=function(_0x7a456e){try{if(!_[_0xe94d('0x15')](dials[_0x7a456e[_0xe94d('0x4')]])){utils[_0xe94d('0xc')](util[_0xe94d('0x2')](_0xe94d('0x1a'),_0x7a456e[_0xe94d('0x4')]),_0x7a456e);dials[_0x7a456e[_0xe94d('0x4')]]=_[_0xe94d('0x1b')](dials[_0x7a456e[_0xe94d('0x4')]],_0x7a456e);dials[_0x7a456e['uniqueid']]['starttime']=utils[_0xe94d('0x1c')]();dials[_0x7a456e[_0xe94d('0x4')]][_0xe94d('0x1d')]=_0xe94d('0x1e');utils[_0xe94d('0x1')](util[_0xe94d('0x2')](_0xe94d('0x1f'),_0x7a456e[_0xe94d('0x4')],dials[_0x7a456e['uniqueid']][_0xe94d('0x20')]));}}catch(_0x122b52){utils[_0xe94d('0x13')](util[_0xe94d('0x2')]('[%s][dials][dialbegin]',_0x7a456e['uniqueid']),_0x122b52);}};exports['dialend']=function(_0x4a7703){try{if(!_[_0xe94d('0x15')](dials[_0x4a7703[_0xe94d('0x4')]])){utils['debug'](util[_0xe94d('0x2')](_0xe94d('0x21'),_0x4a7703[_0xe94d('0x4')]),_0x4a7703);dials[_0x4a7703['uniqueid']][_0xe94d('0x8')]=_0x4a7703[_0xe94d('0x8')];if(_0x4a7703[_0xe94d('0x8')]=='ANSWER'){dials[_0x4a7703[_0xe94d('0x4')]]=_[_0xe94d('0x1b')](dials[_0x4a7703[_0xe94d('0x4')]],_0x4a7703);dials[_0x4a7703['uniqueid']][_0xe94d('0x22')]=utils[_0xe94d('0x1c')]();dials[_0x4a7703[_0xe94d('0x4')]]['lastevent']=_0xe94d('0x23');utils[_0xe94d('0x1')](util[_0xe94d('0x2')](_0xe94d('0x24'),_0x4a7703[_0xe94d('0x4')],_0x4a7703[_0xe94d('0x8')],dials[_0x4a7703[_0xe94d('0x4')]][_0xe94d('0x22')]));}else{utils[_0xe94d('0x1')](util[_0xe94d('0x2')](_0xe94d('0x25'),_0x4a7703[_0xe94d('0x4')],_0x4a7703[_0xe94d('0x8')]));}}}catch(_0x471277){utils[_0xe94d('0x13')](util['format']('[%s][dials][dialend]',_0x4a7703['uniqueid']),_0x471277);}};exports['hangup']=function(_0x1c683e){try{if(!_[_0xe94d('0x15')](dials[_0x1c683e[_0xe94d('0x4')]])){utils[_0xe94d('0xc')](util[_0xe94d('0x2')](_0xe94d('0x26'),_0x1c683e['uniqueid']),_0x1c683e);utils[_0xe94d('0x1')](util['format'](_0xe94d('0x27'),_0x1c683e['uniqueid'],_0x1c683e['calleridnum'],_0x1c683e[_0xe94d('0x28')],_0x1c683e[_0xe94d('0x29')]));dials[_0x1c683e['uniqueid']]=_[_0xe94d('0x1b')](dials[_0x1c683e['uniqueid']],{'endtime':utils[_0xe94d('0x1c')](),'lastevent':'complete'});dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x2a')]=utils['diffTime'](dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x2b')],dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x20')]);dials[_0x1c683e['uniqueid']]['holdtime']=utils[_0xe94d('0x2c')](dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x22')]||dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x2b')],dials[_0x1c683e[_0xe94d('0x4')]]['starttime']);dials[_0x1c683e[_0xe94d('0x4')]][_0xe94d('0x2d')]=dials[_0x1c683e['uniqueid']][_0xe94d('0x22')]?utils[_0xe94d('0x2c')](dials[_0x1c683e[_0xe94d('0x4')]]['endtime'],dials[_0x1c683e['uniqueid']][_0xe94d('0x22')]):0x0;writeDB(dials[_0x1c683e[_0xe94d('0x4')]]);}}catch(_0x4a1343){utils[_0xe94d('0x13')](util[_0xe94d('0x2')](_0xe94d('0x26'),_0x1c683e[_0xe94d('0x4')]),_0x4a1343);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c8c4250..f4ef15c 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 _0x9b89=['blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','port','asterisk','username','keepConnected','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','error','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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]'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9b89,0x17d));var _0x99b8=function(_0xa89e00,_0x321240){_0xa89e00=_0xa89e00-0x0;var _0x12bcc8=_0x9b89[_0xa89e00];return _0x12bcc8;};var AsteriskManager=require(_0x99b8('0x0'));var config=require(_0x99b8('0x1'));var utils=require(_0x99b8('0x2'));var util=require(_0x99b8('0x3'));var isXDREnabled=config[_0x99b8('0x4')]&&config[_0x99b8('0x4')][_0x99b8('0x5')]?!config[_0x99b8('0x4')]['disabled']:!![];var isProduction=config[_0x99b8('0x6')]===_0x99b8('0x7')||![];var isLocalAsterisk=config[_0x99b8('0x4')]&&config[_0x99b8('0x4')][_0x99b8('0x8')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x99b8('0x9')],config['asterisk']['ip'],config[_0x99b8('0xa')][_0x99b8('0xb')],config[_0x99b8('0xa')]['password'],!![]);ami[_0x99b8('0xc')]();if(!isXDREnabled){utils['info'](_0x99b8('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x99b8('0xe')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x99b8('0xf'));var calls=require(_0x99b8('0x10'));var queues=require(_0x99b8('0x11'));var recordings=require(_0x99b8('0x12'));var members=require(_0x99b8('0x13'));var dials=require(_0x99b8('0x14'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x99b8('0x15'),core[_0x99b8('0x15')]);ami['on'](_0x99b8('0x16'),core[_0x99b8('0x16')]);ami['on']('fullybooted',core[_0x99b8('0x17')]);ami['on']('error',core['error']);ami['on'](_0x99b8('0x18'),core[_0x99b8('0x18')]);ami['on'](_0x99b8('0x19'),core[_0x99b8('0x19')]);ami['on'](_0x99b8('0x1a'),function(_0x47de39){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x1c'),_0x47de39[_0x99b8('0x1d')]),_0x47de39);members[_0x99b8('0x1a')](_0x47de39);}catch(_0x3bd349){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x1c'),_0x47de39[_0x99b8('0x1d')]),_0x3bd349);}});ami['on']('agentcalled',function(_0x34f173){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x1f'),_0x34f173[_0x99b8('0x20')]),_0x34f173);agents[_0x99b8('0x21')](_0x34f173);}catch(_0x438015){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x1f'),_0x34f173[_0x99b8('0x20')]),_0x438015);}});ami['on'](_0x99b8('0x22'),function(_0x222093){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x24'),_0x222093[_0x99b8('0x20')]),_0x222093);agents['agentringnoanswer'](_0x222093);}catch(_0x10d245){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x24'),_0x222093['uniqueid']),_0x10d245);}});ami['on'](_0x99b8('0x25'),function(_0x2e8689){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x26'),_0x2e8689[_0x99b8('0x20')]),_0x2e8689);agents[_0x99b8('0x25')](_0x2e8689);queues[_0x99b8('0x25')](_0x2e8689);}catch(_0x1c244f){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x26'),_0x2e8689[_0x99b8('0x20')]),_0x1c244f);}});ami['on'](_0x99b8('0x27'),function(_0x26f47c){try{utils['debug'](util['format'](_0x99b8('0x28'),_0x26f47c[_0x99b8('0x20')]),_0x26f47c);agents['agentcomplete'](_0x26f47c);queues['agentcomplete'](_0x26f47c);members[_0x99b8('0x27')](_0x26f47c);}catch(_0x5bc2ac){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x28'),_0x26f47c[_0x99b8('0x20')]),_0x5bc2ac);}});ami['on'](_0x99b8('0x29'),function(_0x9e6ec6){try{utils['debug'](util['format'](_0x99b8('0x2a'),_0x9e6ec6[_0x99b8('0x20')]),_0x9e6ec6);agents[_0x99b8('0x29')](_0x9e6ec6);queues[_0x99b8('0x29')](_0x9e6ec6);}catch(_0xe7de73){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x2a'),_0x9e6ec6[_0x99b8('0x20')]),_0xe7de73);}});ami['on']('queuecallerjoin',function(_0x7205d6){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x2b'),_0x7205d6['uniqueid']),_0x7205d6);queues[_0x99b8('0x2c')](_0x7205d6);recordings['queuecallerjoin'](_0x7205d6);}catch(_0x4123ef){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x2b'),_0x7205d6[_0x99b8('0x20')]),_0x4123ef);}});ami['on'](_0x99b8('0x2d'),function(_0x5d7aab){try{utils['debug'](util[_0x99b8('0x1b')]('[%s][index][queuecallerleave]',_0x5d7aab[_0x99b8('0x20')]),_0x5d7aab);queues[_0x99b8('0x2d')](_0x5d7aab);}catch(_0x32f453){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x2e'),_0x5d7aab['uniqueid']),_0x32f453);}});ami['on'](_0x99b8('0x2f'),function(_0x3e7291){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x30'),_0x3e7291[_0x99b8('0x20')]),_0x3e7291);queues[_0x99b8('0x2f')](_0x3e7291);calls['musiconholdstart'](_0x3e7291);}catch(_0x63b902){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][musiconholdstart]',_0x3e7291[_0x99b8('0x20')]),_0x63b902);}});ami['on'](_0x99b8('0x31'),function(_0x1c00ac){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x32'),_0x1c00ac[_0x99b8('0x20')]),_0x1c00ac);queues[_0x99b8('0x31')](_0x1c00ac);calls[_0x99b8('0x31')](_0x1c00ac);}catch(_0x31ad0d){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x32'),_0x1c00ac[_0x99b8('0x20')]),_0x31ad0d);}});ami['on'](_0x99b8('0x33'),function(_0x2ce65e){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x34'),_0x2ce65e[_0x99b8('0x20')]),_0x2ce65e);calls[_0x99b8('0x33')](_0x2ce65e);recordings[_0x99b8('0x33')](_0x2ce65e);}catch(_0x5564b9){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x34'),_0x2ce65e[_0x99b8('0x20')]),_0x5564b9);}});ami['on'](_0x99b8('0x35'),function(_0x342df4){try{utils[_0x99b8('0x23')](util['format'](_0x99b8('0x36'),_0x342df4[_0x99b8('0x20')]),_0x342df4);calls[_0x99b8('0x35')](_0x342df4);recordings[_0x99b8('0x35')](_0x342df4);dials[_0x99b8('0x35')](_0x342df4);agents[_0x99b8('0x35')](_0x342df4);queues['hangup'](_0x342df4);}catch(_0x27a42c){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x36'),_0x342df4['uniqueid']),_0x27a42c);}});ami['on'](_0x99b8('0x37'),function(_0x25dea8){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x38'),_0x25dea8[_0x99b8('0x20')]),_0x25dea8);members[_0x99b8('0x37')](_0x25dea8);}catch(_0x290804){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x38'),_0x25dea8[_0x99b8('0x20')]),_0x290804);}});ami['on'](_0x99b8('0x39'),function(_0x1f8517){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')]('[%s][index][blindtransfer]',_0x1f8517[_0x99b8('0x20')]),_0x1f8517);queues['blindtransfer'](_0x1f8517);agents[_0x99b8('0x39')](_0x1f8517);transfers['blindtransfer'](_0x1f8517);}catch(_0x1ac566){utils['error'](util[_0x99b8('0x1b')](_0x99b8('0x3a'),_0x1f8517[_0x99b8('0x20')]),_0x1ac566);}});ami['on'](_0x99b8('0x3b'),function(_0x101821){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x3c'),_0x101821[_0x99b8('0x3d')]),_0x101821);queues['attendedtransfer'](_0x101821);transfers[_0x99b8('0x3b')](_0x101821);agents[_0x99b8('0x3b')](_0x101821);calls[_0x99b8('0x3b')](_0x101821);}catch(_0x5007c8){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][attendedtransfer]',_0x101821['origtransfereruniqueid']),_0x5007c8);}});ami['on'](_0x99b8('0x3e'),function(_0x31a0c4){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x3f'),_0x31a0c4[_0x99b8('0x20')]),_0x31a0c4);queues['varset'](_0x31a0c4);recordings['varset'](_0x31a0c4);calls[_0x99b8('0x3e')](_0x31a0c4);dials[_0x99b8('0x3e')](_0x31a0c4);}catch(_0x4a5c99){utils[_0x99b8('0x1e')](util['format'](_0x99b8('0x3f'),_0x31a0c4['uniqueid']),_0x4a5c99);}});ami['on']('newexten',function(_0xb80da){try{utils[_0x99b8('0x23')](util['format'](_0x99b8('0x40'),_0xb80da[_0x99b8('0x20')]),_0xb80da);calls[_0x99b8('0x41')](_0xb80da);recordings['newexten'](_0xb80da);dials[_0x99b8('0x41')](_0xb80da);}catch(_0x49d103){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x40'),_0xb80da[_0x99b8('0x20')]),_0x49d103);}});ami['on'](_0x99b8('0x42'),function(_0x3783e1){try{utils[_0x99b8('0x23')](util[_0x99b8('0x1b')](_0x99b8('0x43'),_0x3783e1[_0x99b8('0x20')]),_0x3783e1);calls['newchannel'](_0x3783e1);recordings[_0x99b8('0x42')](_0x3783e1);}catch(_0x1aff19){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')]('[%s][index][newchannel]',_0x3783e1[_0x99b8('0x20')]),_0x1aff19);}});ami['on'](_0x99b8('0x44'),function(_0x5c3446){try{utils['debug'](util[_0x99b8('0x1b')](_0x99b8('0x45'),_0x5c3446[_0x99b8('0x20')]),_0x5c3446);dials[_0x99b8('0x44')](_0x5c3446);}catch(_0x4fed2f){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x46'),_0x5c3446[_0x99b8('0x20')]),_0x4fed2f);}});ami['on']('dialend',function(_0x30a78b){try{utils['debug'](util[_0x99b8('0x1b')]('[%s][index][dialend]',_0x30a78b[_0x99b8('0x20')]),_0x30a78b);dials[_0x99b8('0x47')](_0x30a78b);}catch(_0x39efe0){utils[_0x99b8('0x1e')](util[_0x99b8('0x1b')](_0x99b8('0x48'),_0x30a78b[_0x99b8('0x20')]),_0x39efe0);}});} \ No newline at end of file +var _0x05ab=['fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','port','asterisk','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','connect','shutdown'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x05ab,0xff));var _0xb05a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x05ab[_0x5608a3];return _0x1ed50a;};var AsteriskManager=require(_0xb05a('0x0'));var config=require(_0xb05a('0x1'));var utils=require(_0xb05a('0x2'));var util=require('util');var isXDREnabled=config[_0xb05a('0x3')]&&config[_0xb05a('0x3')][_0xb05a('0x4')]?!config[_0xb05a('0x3')][_0xb05a('0x4')]:!![];var isProduction=config[_0xb05a('0x5')]===_0xb05a('0x6')||![];var isLocalAsterisk=config[_0xb05a('0x3')]&&config[_0xb05a('0x3')][_0xb05a('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xb05a('0x8')],config[_0xb05a('0x9')]['ip'],config['asterisk'][_0xb05a('0xa')],config['asterisk']['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xb05a('0xb')](_0xb05a('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb05a('0xb')](_0xb05a('0xd'));}else{var agents=require(_0xb05a('0xe'));var calls=require(_0xb05a('0xf'));var queues=require(_0xb05a('0x10'));var recordings=require('./recordings.controller');var members=require(_0xb05a('0x11'));var dials=require(_0xb05a('0x12'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on']('connect',core[_0xb05a('0x13')]);ami['on'](_0xb05a('0x14'),core[_0xb05a('0x14')]);ami['on'](_0xb05a('0x15'),core[_0xb05a('0x15')]);ami['on'](_0xb05a('0x16'),core[_0xb05a('0x16')]);ami['on']('close',core[_0xb05a('0x17')]);ami['on'](_0xb05a('0x18'),core[_0xb05a('0x18')]);ami['on'](_0xb05a('0x19'),function(_0x59fc24){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x1c'),_0x59fc24[_0xb05a('0x1d')]),_0x59fc24);members[_0xb05a('0x19')](_0x59fc24);}catch(_0x1a9658){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')]('[%s][index][devicestatechange]',_0x59fc24[_0xb05a('0x1d')]),_0x1a9658);}});ami['on']('agentcalled',function(_0x3da4dd){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x1e'),_0x3da4dd[_0xb05a('0x1f')]),_0x3da4dd);agents[_0xb05a('0x20')](_0x3da4dd);}catch(_0x1118db){utils[_0xb05a('0x16')](util['format']('[%s][index][agentcalled]',_0x3da4dd[_0xb05a('0x1f')]),_0x1118db);}});ami['on'](_0xb05a('0x21'),function(_0x499e6e){try{utils[_0xb05a('0x1a')](util['format'](_0xb05a('0x22'),_0x499e6e[_0xb05a('0x1f')]),_0x499e6e);agents[_0xb05a('0x21')](_0x499e6e);}catch(_0x253df0){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x22'),_0x499e6e[_0xb05a('0x1f')]),_0x253df0);}});ami['on'](_0xb05a('0x23'),function(_0x8f2ab5){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x24'),_0x8f2ab5['uniqueid']),_0x8f2ab5);agents[_0xb05a('0x23')](_0x8f2ab5);queues[_0xb05a('0x23')](_0x8f2ab5);}catch(_0x38f6d6){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')]('[%s][index][agentconnect]',_0x8f2ab5[_0xb05a('0x1f')]),_0x38f6d6);}});ami['on']('agentcomplete',function(_0x22c113){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x25'),_0x22c113[_0xb05a('0x1f')]),_0x22c113);agents[_0xb05a('0x26')](_0x22c113);queues[_0xb05a('0x26')](_0x22c113);members[_0xb05a('0x26')](_0x22c113);}catch(_0x5a19e0){utils['error'](util['format'](_0xb05a('0x25'),_0x22c113[_0xb05a('0x1f')]),_0x5a19e0);}});ami['on'](_0xb05a('0x27'),function(_0x543f61){try{utils['debug'](util[_0xb05a('0x1b')](_0xb05a('0x28'),_0x543f61[_0xb05a('0x1f')]),_0x543f61);agents[_0xb05a('0x27')](_0x543f61);queues[_0xb05a('0x27')](_0x543f61);}catch(_0x52fa7c){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x28'),_0x543f61[_0xb05a('0x1f')]),_0x52fa7c);}});ami['on']('queuecallerjoin',function(_0x29c43e){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x29'),_0x29c43e[_0xb05a('0x1f')]),_0x29c43e);queues[_0xb05a('0x2a')](_0x29c43e);recordings[_0xb05a('0x2a')](_0x29c43e);}catch(_0x3331a9){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')]('[%s][index][queuecallerjoin]',_0x29c43e[_0xb05a('0x1f')]),_0x3331a9);}});ami['on'](_0xb05a('0x2b'),function(_0x2ba6b6){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x2c'),_0x2ba6b6[_0xb05a('0x1f')]),_0x2ba6b6);queues[_0xb05a('0x2b')](_0x2ba6b6);}catch(_0x564555){utils[_0xb05a('0x16')](util['format']('[%s][index][queuecallerleave]',_0x2ba6b6[_0xb05a('0x1f')]),_0x564555);}});ami['on'](_0xb05a('0x2d'),function(_0x51022e){try{utils['debug'](util['format'](_0xb05a('0x2e'),_0x51022e[_0xb05a('0x1f')]),_0x51022e);queues[_0xb05a('0x2d')](_0x51022e);calls[_0xb05a('0x2d')](_0x51022e);}catch(_0x147bcd){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x2e'),_0x51022e['uniqueid']),_0x147bcd);}});ami['on'](_0xb05a('0x2f'),function(_0x3dff28){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x30'),_0x3dff28[_0xb05a('0x1f')]),_0x3dff28);queues[_0xb05a('0x2f')](_0x3dff28);calls[_0xb05a('0x2f')](_0x3dff28);}catch(_0x328d0a){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x30'),_0x3dff28[_0xb05a('0x1f')]),_0x328d0a);}});ami['on'](_0xb05a('0x31'),function(_0x161c77){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x32'),_0x161c77[_0xb05a('0x1f')]),_0x161c77);calls[_0xb05a('0x31')](_0x161c77);recordings[_0xb05a('0x31')](_0x161c77);}catch(_0x3a837c){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x32'),_0x161c77['uniqueid']),_0x3a837c);}});ami['on'](_0xb05a('0x33'),function(_0x28da0f){try{utils[_0xb05a('0x1a')](util['format'](_0xb05a('0x34'),_0x28da0f[_0xb05a('0x1f')]),_0x28da0f);calls['hangup'](_0x28da0f);recordings[_0xb05a('0x33')](_0x28da0f);dials['hangup'](_0x28da0f);agents['hangup'](_0x28da0f);queues[_0xb05a('0x33')](_0x28da0f);}catch(_0x1bb2d3){utils['error'](util[_0xb05a('0x1b')]('[%s][index][hangup]',_0x28da0f[_0xb05a('0x1f')]),_0x1bb2d3);}});ami['on']('cdr',function(_0x3b7601){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x35'),_0x3b7601[_0xb05a('0x1f')]),_0x3b7601);members[_0xb05a('0x36')](_0x3b7601);}catch(_0xc90d6d){utils['error'](util[_0xb05a('0x1b')](_0xb05a('0x35'),_0x3b7601['uniqueid']),_0xc90d6d);}});ami['on'](_0xb05a('0x37'),function(_0x2ea6e8){try{utils[_0xb05a('0x1a')](util['format']('[%s][index][blindtransfer]',_0x2ea6e8[_0xb05a('0x1f')]),_0x2ea6e8);queues[_0xb05a('0x37')](_0x2ea6e8);agents[_0xb05a('0x37')](_0x2ea6e8);transfers['blindtransfer'](_0x2ea6e8);}catch(_0xd9f604){utils['error'](util[_0xb05a('0x1b')]('[%s][index][blindtransfer]',_0x2ea6e8[_0xb05a('0x1f')]),_0xd9f604);}});ami['on'](_0xb05a('0x38'),function(_0xa1279b){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')]('[%s][index][attendedtransfer]',_0xa1279b['origtransfereruniqueid']),_0xa1279b);queues[_0xb05a('0x38')](_0xa1279b);transfers[_0xb05a('0x38')](_0xa1279b);agents['attendedtransfer'](_0xa1279b);calls['attendedtransfer'](_0xa1279b);}catch(_0x50d306){utils['error'](util[_0xb05a('0x1b')](_0xb05a('0x39'),_0xa1279b[_0xb05a('0x3a')]),_0x50d306);}});ami['on'](_0xb05a('0x3b'),function(_0x28a6c4){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x3c'),_0x28a6c4[_0xb05a('0x1f')]),_0x28a6c4);queues[_0xb05a('0x3b')](_0x28a6c4);recordings['varset'](_0x28a6c4);calls[_0xb05a('0x3b')](_0x28a6c4);dials[_0xb05a('0x3b')](_0x28a6c4);}catch(_0x256f79){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x3c'),_0x28a6c4[_0xb05a('0x1f')]),_0x256f79);}});ami['on'](_0xb05a('0x3d'),function(_0xfb8689){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')]('[%s][index][newexten]',_0xfb8689[_0xb05a('0x1f')]),_0xfb8689);calls[_0xb05a('0x3d')](_0xfb8689);recordings[_0xb05a('0x3d')](_0xfb8689);dials[_0xb05a('0x3d')](_0xfb8689);}catch(_0x7f3362){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x3e'),_0xfb8689[_0xb05a('0x1f')]),_0x7f3362);}});ami['on'](_0xb05a('0x3f'),function(_0x4ded63){try{utils[_0xb05a('0x1a')](util['format'](_0xb05a('0x40'),_0x4ded63[_0xb05a('0x1f')]),_0x4ded63);calls[_0xb05a('0x3f')](_0x4ded63);recordings['newchannel'](_0x4ded63);}catch(_0x150531){utils['error'](util[_0xb05a('0x1b')]('[%s][index][newchannel]',_0x4ded63[_0xb05a('0x1f')]),_0x150531);}});ami['on'](_0xb05a('0x41'),function(_0x3061e7){try{utils[_0xb05a('0x1a')](util['format']('[%s][index][dialbegin]',_0x3061e7['uniqueid']),_0x3061e7);dials['dialbegin'](_0x3061e7);}catch(_0x30526f){utils[_0xb05a('0x16')](util[_0xb05a('0x1b')](_0xb05a('0x42'),_0x3061e7[_0xb05a('0x1f')]),_0x30526f);}});ami['on'](_0xb05a('0x43'),function(_0x4e9d47){try{utils[_0xb05a('0x1a')](util[_0xb05a('0x1b')](_0xb05a('0x44'),_0x4e9d47['uniqueid']),_0x4e9d47);dials['dialend'](_0x4e9d47);}catch(_0x5580f0){utils['error'](util['format']('[%s][index][dialend]',_0x4e9d47[_0xb05a('0x1f')]),_0x5580f0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index acfb5c9..8b073c1 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 _0x8664=['[%s][members][cdr]','channel','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','data2','membername','type','getUserByInterface','name','internal','CreateMemberReport','getUserByName','split','then','request','catch','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr'];(function(_0x28a8ec,_0xce6f28){var _0x5e6961=function(_0x357a49){while(--_0x357a49){_0x28a8ec['push'](_0x28a8ec['shift']());}};_0x5e6961(++_0xce6f28);}(_0x8664,0x11a));var _0x4866=function(_0x4441f1,_0x53efdc){_0x4441f1=_0x4441f1-0x0;var _0x37daff=_0x8664[_0x4441f1];return _0x37daff;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var utils=require(_0x4866('0x2'));var members={};var exclude=[_0x4866('0x3'),_0x4866('0x4')];function writeDB(_0x65c74c){utils[_0x4866('0x5')](util[_0x4866('0x6')](_0x4866('0x7'),_0x65c74c['uniqueid'],_0x65c74c[_0x4866('0x8')],_0x65c74c['channel'],_0x65c74c[_0x4866('0x9')],_0x65c74c[_0x4866('0xa')],_0x65c74c[_0x4866('0xb')]));if(_0x65c74c[_0x4866('0x8')]){utils[_0x4866('0xc')](_0x65c74c[_0x4866('0x8')])['then'](function(_0x4185f2){if(_0x4185f2){_0x65c74c[_0x4866('0xa')]=_0x4185f2[_0x4866('0xd')];_0x65c74c[_0x4866('0xe')]=_0x4185f2[_0x4866('0xe')];utils['request'](_0x4866('0xf'),_0x65c74c);}else{utils[_0x4866('0x10')](_0x65c74c['interface'][_0x4866('0x11')]('/')[0x1])[_0x4866('0x12')](function(_0x5f11ca){if(_0x5f11ca){_0x65c74c['membername']=_0x5f11ca['name'];_0x65c74c[_0x4866('0xe')]=_0x5f11ca[_0x4866('0xe')];utils[_0x4866('0x13')](_0x4866('0xf'),_0x65c74c);}});}})[_0x4866('0x14')](function(_0x36aa92){utils['error'](util[_0x4866('0x6')](_0x4866('0x15'),_0x65c74c['uniqueid']),_0x36aa92);});}delete members[_0x65c74c[_0x4866('0x8')]];}function startsWith(_0x348996,_0x3f8f56){return _[_0x4866('0x16')](_0x348996,function(_0x16b7ff){return _[_0x4866('0x17')](_0x3f8f56,_0x16b7ff);});}exports[_0x4866('0x18')]=function(_0x653916){try{utils[_0x4866('0x19')](util['format']('[%s][members][devicestatechange]',members[_0x653916[_0x4866('0x1a')]]?members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]:_0x653916['device']),_0x653916);utils['info'](util[_0x4866('0x6')](_0x4866('0x1c'),members[_0x653916['device']]?members[_0x653916[_0x4866('0x1a')]]['uniqueid']:_0x653916[_0x4866('0x1a')],_0x653916['state'],_0x653916[_0x4866('0x1a')]));switch(_0x653916[_0x4866('0x1d')]){case _0x4866('0x1e'):case _0x4866('0x1f'):if(!startsWith(exclude,_0x653916[_0x4866('0x1a')])){members[_0x653916['device']]={'channel':'voice','interface':_0x653916[_0x4866('0x1a')],'type':_0x4866('0x20'),'enterAt':utils[_0x4866('0x21')](),'role':'agent'};}break;case _0x4866('0x22'):if(!_['isNil'](members[_0x653916['device']])){members[_0x653916[_0x4866('0x1a')]][_0x4866('0x23')]=utils['now']();members[_0x653916[_0x4866('0x1a')]][_0x4866('0x24')]=utils[_0x4866('0x25')](members[_0x653916[_0x4866('0x1a')]][_0x4866('0x23')],members[_0x653916[_0x4866('0x1a')]][_0x4866('0x26')]);if(members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]){writeDB(members[_0x653916[_0x4866('0x1a')]]);}}break;default:break;}}catch(_0x278471){utils['error'](util[_0x4866('0x6')](_0x4866('0x27'),members[_0x653916[_0x4866('0x1a')]]?members[_0x653916[_0x4866('0x1a')]][_0x4866('0x1b')]:_0x653916[_0x4866('0x1a')]),_0x278471);}};exports[_0x4866('0x28')]=function(_0xe51cb4){try{if(!_[_0x4866('0x29')](members[_0xe51cb4[_0x4866('0x8')]])){utils[_0x4866('0x19')](util[_0x4866('0x6')](_0x4866('0x2a'),_0xe51cb4[_0x4866('0x1b')]),_0xe51cb4);utils[_0x4866('0x5')](util[_0x4866('0x6')](_0x4866('0x2b'),_0xe51cb4[_0x4866('0x1b')],_0xe51cb4[_0x4866('0x8')],_0xe51cb4[_0x4866('0x2c')]));members[_0xe51cb4[_0x4866('0x8')]]=_[_0x4866('0x2d')](members[_0xe51cb4['interface']],{'data4':_0xe51cb4['queue'],'uniqueid':_0xe51cb4[_0x4866('0x1b')]});}}catch(_0x1bef8d){utils[_0x4866('0x2e')](util[_0x4866('0x6')](_0x4866('0x2a'),_0xe51cb4['uniqueid']),_0x1bef8d);}};exports[_0x4866('0x2f')]=function(_0x21ad2b){try{utils[_0x4866('0x19')](util[_0x4866('0x6')](_0x4866('0x30'),_0x21ad2b['uniqueid']),_0x21ad2b);if(_0x21ad2b[_0x4866('0x31')]){var _0x4055f0=_0x21ad2b[_0x4866('0x31')][_0x4866('0x11')]('-')[0x0];if(!_[_0x4866('0x29')](members[_0x4055f0])){members[_0x4055f0]=_[_0x4866('0x2d')](members[_0x4055f0],{'data1':members[_0x4055f0][_0x4866('0x32')]||_0x21ad2b[_0x4866('0xb')],'data2':members[_0x4055f0][_0x4866('0x9')]||_0x21ad2b['source'],'data3':members[_0x4055f0][_0x4866('0x33')]||_0x21ad2b[_0x4866('0x34')],'uniqueid':members[_0x4055f0]['uniqueid']||_0x21ad2b[_0x4866('0x1b')]});utils[_0x4866('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x21ad2b['uniqueid'],members[_0x4055f0]['data1'],members[_0x4055f0][_0x4866('0x9')],members[_0x4055f0][_0x4866('0x33')]));if(members[_0x4055f0]['exitAt']){writeDB(members[_0x4055f0]);}}}if(_0x21ad2b['destinationchannel']){var _0x4fbe06=_0x21ad2b[_0x4866('0x35')]['split']('-')[0x0];if(!_[_0x4866('0x29')](members[_0x4fbe06])){members[_0x4fbe06]=_['assign'](members[_0x4fbe06],{'data1':members[_0x4fbe06][_0x4866('0x32')]||_0x21ad2b['type'],'data2':members[_0x4fbe06][_0x4866('0x9')]||_0x21ad2b[_0x4866('0x36')],'data3':members[_0x4fbe06][_0x4866('0x33')]||_0x21ad2b[_0x4866('0x34')],'uniqueid':members[_0x4fbe06][_0x4866('0x1b')]||_0x21ad2b[_0x4866('0x1b')]});utils[_0x4866('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x21ad2b[_0x4866('0x1b')],members[_0x4fbe06][_0x4866('0x32')],members[_0x4fbe06][_0x4866('0x9')],members[_0x4fbe06][_0x4866('0x33')]));if(members[_0x4fbe06][_0x4866('0x23')]){writeDB(members[_0x4fbe06]);}}}}catch(_0x26484b){utils['error'](util[_0x4866('0x6')](_0x4866('0x30'),_0x21ad2b['uniqueid']),_0x26484b);}}; \ No newline at end of file +var _0x2305=['debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','exitAt','duration','error','isNil','interface','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','channel','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','[%s][members][writeDB]','some','startsWith'];(function(_0x25a9c5,_0x4ece97){var _0x549d23=function(_0x159cdd){while(--_0x159cdd){_0x25a9c5['push'](_0x25a9c5['shift']());}};_0x549d23(++_0x4ece97);}(_0x2305,0x122));var _0x5230=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x2305[_0x45518f];return _0x198175;};'use strict';var _=require(_0x5230('0x0'));var util=require(_0x5230('0x1'));var utils=require(_0x5230('0x2'));var members={};var exclude=[_0x5230('0x3'),_0x5230('0x4')];function writeDB(_0x372d74){utils[_0x5230('0x5')](util[_0x5230('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x372d74[_0x5230('0x7')],_0x372d74['interface'],_0x372d74['channel'],_0x372d74[_0x5230('0x8')],_0x372d74[_0x5230('0x9')],_0x372d74[_0x5230('0xa')]));if(_0x372d74['interface']){utils[_0x5230('0xb')](_0x372d74['interface'])[_0x5230('0xc')](function(_0x2ba2f2){if(_0x2ba2f2){_0x372d74['membername']=_0x2ba2f2[_0x5230('0xd')];_0x372d74[_0x5230('0xe')]=_0x2ba2f2[_0x5230('0xe')];utils[_0x5230('0xf')](_0x5230('0x10'),_0x372d74);}else{utils[_0x5230('0x11')](_0x372d74['interface']['split']('/')[0x1])[_0x5230('0xc')](function(_0x38b403){if(_0x38b403){_0x372d74[_0x5230('0x9')]=_0x38b403[_0x5230('0xd')];_0x372d74['internal']=_0x38b403[_0x5230('0xe')];utils['request'](_0x5230('0x10'),_0x372d74);}});}})[_0x5230('0x12')](function(_0x36d89b){utils['error'](util[_0x5230('0x6')](_0x5230('0x13'),_0x372d74['uniqueid']),_0x36d89b);});}delete members[_0x372d74['interface']];}function startsWith(_0x417e64,_0x552af5){return _[_0x5230('0x14')](_0x417e64,function(_0x3c4498){return _[_0x5230('0x15')](_0x552af5,_0x3c4498);});}exports['devicestatechange']=function(_0x3b3ada){try{utils[_0x5230('0x16')](util[_0x5230('0x6')](_0x5230('0x17'),members[_0x3b3ada['device']]?members[_0x3b3ada[_0x5230('0x18')]]['uniqueid']:_0x3b3ada[_0x5230('0x18')]),_0x3b3ada);utils[_0x5230('0x5')](util[_0x5230('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3b3ada[_0x5230('0x18')]]?members[_0x3b3ada['device']]['uniqueid']:_0x3b3ada['device'],_0x3b3ada[_0x5230('0x19')],_0x3b3ada[_0x5230('0x18')]));switch(_0x3b3ada[_0x5230('0x19')]){case _0x5230('0x1a'):case _0x5230('0x1b'):if(!startsWith(exclude,_0x3b3ada[_0x5230('0x18')])){members[_0x3b3ada['device']]={'channel':_0x5230('0x1c'),'interface':_0x3b3ada[_0x5230('0x18')],'type':_0x5230('0x1d'),'enterAt':utils[_0x5230('0x1e')](),'role':_0x5230('0x1f')};}break;case _0x5230('0x20'):if(!_['isNil'](members[_0x3b3ada[_0x5230('0x18')]])){members[_0x3b3ada['device']][_0x5230('0x21')]=utils['now']();members[_0x3b3ada['device']][_0x5230('0x22')]=utils['diffTime'](members[_0x3b3ada[_0x5230('0x18')]][_0x5230('0x21')],members[_0x3b3ada[_0x5230('0x18')]]['enterAt']);if(members[_0x3b3ada[_0x5230('0x18')]][_0x5230('0x7')]){writeDB(members[_0x3b3ada['device']]);}}break;default:break;}}catch(_0xc0f32d){utils[_0x5230('0x23')](util['format'](_0x5230('0x17'),members[_0x3b3ada[_0x5230('0x18')]]?members[_0x3b3ada[_0x5230('0x18')]]['uniqueid']:_0x3b3ada['device']),_0xc0f32d);}};exports['agentcomplete']=function(_0x42bac7){try{if(!_[_0x5230('0x24')](members[_0x42bac7[_0x5230('0x25')]])){utils[_0x5230('0x16')](util[_0x5230('0x6')](_0x5230('0x26'),_0x42bac7[_0x5230('0x7')]),_0x42bac7);utils[_0x5230('0x5')](util['format'](_0x5230('0x27'),_0x42bac7['uniqueid'],_0x42bac7[_0x5230('0x25')],_0x42bac7['queue']));members[_0x42bac7[_0x5230('0x25')]]=_[_0x5230('0x28')](members[_0x42bac7[_0x5230('0x25')]],{'data4':_0x42bac7[_0x5230('0x29')],'uniqueid':_0x42bac7['uniqueid']});}}catch(_0x739d1f){utils[_0x5230('0x23')](util['format']('[%s][members][agentcomplete]',_0x42bac7['uniqueid']),_0x739d1f);}};exports[_0x5230('0x2a')]=function(_0x47b6f4){try{utils[_0x5230('0x16')](util[_0x5230('0x6')]('[%s][members][cdr]',_0x47b6f4[_0x5230('0x7')]),_0x47b6f4);if(_0x47b6f4[_0x5230('0x2b')]){var _0x26a590=_0x47b6f4[_0x5230('0x2b')][_0x5230('0x2c')]('-')[0x0];if(!_[_0x5230('0x24')](members[_0x26a590])){members[_0x26a590]=_['assign'](members[_0x26a590],{'data1':members[_0x26a590][_0x5230('0x2d')]||_0x47b6f4[_0x5230('0xa')],'data2':members[_0x26a590][_0x5230('0x8')]||_0x47b6f4[_0x5230('0x2e')],'data3':members[_0x26a590][_0x5230('0x2f')]||_0x47b6f4[_0x5230('0x30')],'uniqueid':members[_0x26a590][_0x5230('0x7')]||_0x47b6f4[_0x5230('0x7')]});utils[_0x5230('0x5')](util[_0x5230('0x6')](_0x5230('0x31'),_0x47b6f4[_0x5230('0x7')],members[_0x26a590][_0x5230('0x2d')],members[_0x26a590][_0x5230('0x8')],members[_0x26a590]['data3']));if(members[_0x26a590][_0x5230('0x21')]){writeDB(members[_0x26a590]);}}}if(_0x47b6f4['destinationchannel']){var _0x4b173b=_0x47b6f4[_0x5230('0x32')]['split']('-')[0x0];if(!_[_0x5230('0x24')](members[_0x4b173b])){members[_0x4b173b]=_[_0x5230('0x28')](members[_0x4b173b],{'data1':members[_0x4b173b][_0x5230('0x2d')]||_0x47b6f4['type'],'data2':members[_0x4b173b][_0x5230('0x8')]||_0x47b6f4['source'],'data3':members[_0x4b173b][_0x5230('0x2f')]||_0x47b6f4[_0x5230('0x30')],'uniqueid':members[_0x4b173b][_0x5230('0x7')]||_0x47b6f4[_0x5230('0x7')]});utils[_0x5230('0x5')](util[_0x5230('0x6')](_0x5230('0x31'),_0x47b6f4[_0x5230('0x7')],members[_0x4b173b]['data1'],members[_0x4b173b]['data2'],members[_0x4b173b][_0x5230('0x2f')]));if(members[_0x4b173b][_0x5230('0x21')]){writeDB(members[_0x4b173b]);}}}}catch(_0x51dd2c){utils[_0x5230('0x23')](util[_0x5230('0x6')](_0x5230('0x33'),_0x47b6f4[_0x5230('0x7')]),_0x51dd2c);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b333f79..62fefb4 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 _0x3ffe=['transfertargetlinkedid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','error','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','variable','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','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'];(function(_0x188bf0,_0x3ba7bb){var _0x1d9ebf=function(_0x30b3cf){while(--_0x30b3cf){_0x188bf0['push'](_0x188bf0['shift']());}};_0x1d9ebf(++_0x3ba7bb);}(_0x3ffe,0x136));var _0xe3ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ffe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe3ff('0x0'));var utils=require(_0xe3ff('0x1'));var queues={};function writeDB(_0x253962){utils['info'](util[_0xe3ff('0x2')](_0xe3ff('0x3'),_0x253962[_0xe3ff('0x4')],_0x253962[_0xe3ff('0x5')],_0x253962[_0xe3ff('0x6')],_0x253962[_0xe3ff('0x7')],_0x253962[_0xe3ff('0x8')],_0x253962['accountcode'],_0x253962[_0xe3ff('0x9')]));if(_0x253962[_0xe3ff('0x6')]){utils[_0xe3ff('0xa')](_0x253962[_0xe3ff('0x6')])[_0xe3ff('0xb')](function(_0x5bcbdc){if(_0x5bcbdc){_0x253962[_0xe3ff('0xc')]=_0x5bcbdc['type'];}utils[_0xe3ff('0xd')](_0xe3ff('0xe'),_0x253962);});}else{utils[_0xe3ff('0xd')]('CreateVoiceQueueReport',_0x253962);}if(_0x253962[_0xe3ff('0xf')]){delete queues[_0x253962[_0xe3ff('0xf')]];}else{delete queues[_0x253962['uniqueid']];}}exports['queuecallerjoin']=function(_0x544402){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x11'),_0x544402[_0xe3ff('0x4')]),_0x544402);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x544402[_0xe3ff('0x4')],_0x544402[_0xe3ff('0x6')],_0x544402[_0xe3ff('0x13')]));queues[_0x544402[_0xe3ff('0x4')]]=_[_0xe3ff('0x14')](_0x544402,{'originalposition':_0x544402[_0xe3ff('0x13')],'queuecallerjoinAt':utils[_0xe3ff('0x15')](),'mohtime':0x0});}catch(_0x49df5c){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x11'),_0x544402['uniqueid']),_0x49df5c);}};exports[_0xe3ff('0x16')]=function(_0x13c05a){try{if(!_[_0xe3ff('0x17')](queues[_0x13c05a[_0xe3ff('0x4')]])){utils[_0xe3ff('0x10')](util['format'](_0xe3ff('0x18'),_0x13c05a[_0xe3ff('0x4')]),_0x13c05a);if(queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallerleaveAt']){if(!queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallerabandon']&&!queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x19')]){queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x1a')]=!![];queues[_0x13c05a[_0xe3ff('0x4')]]['queuecallercompleteAt']=utils[_0xe3ff('0x15')]();queues[_0x13c05a['uniqueid']][_0xe3ff('0x9')]=_0xe3ff('0x1b');}utils[_0xe3ff('0x12')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x13c05a[_0xe3ff('0x4')],queues[_0x13c05a[_0xe3ff('0x4')]]['name'],queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0x9')]));writeDB(queues[_0x13c05a['uniqueid']]);}else if(queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x13c05a[_0xe3ff('0x4')],queues[_0x13c05a[_0xe3ff('0x4')]]['name'],queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]));queues[queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]]=queues[_0x13c05a[_0xe3ff('0x4')]];queues[queues[_0x13c05a[_0xe3ff('0x4')]][_0xe3ff('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x13c05a[_0xe3ff('0x4')]];}}}catch(_0x399efc){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x18'),_0x13c05a[_0xe3ff('0x4')]),_0x399efc);}};exports[_0xe3ff('0x1d')]=function(_0x306c25){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x1e'),_0x306c25['uniqueid']),_0x306c25);if(!_[_0xe3ff('0x17')](_0x306c25['variable'][_0xe3ff('0x1f')])&&_0x306c25[_0xe3ff('0x20')][_0xe3ff('0x21')]()!=='CONTINUE'){if(!_[_0xe3ff('0x17')](queues[_0x306c25['uniqueid']])){queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x23')]=null;queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x19')]=!![];queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x24')]=utils[_0xe3ff('0x15')]();queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0x306c25[_0xe3ff('0x20')][_0xe3ff('0x21')]();utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x25'),_0x306c25['uniqueid'],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x306c25[_0xe3ff('0x20')],queues[_0x306c25['uniqueid']][_0xe3ff('0x9')]));writeDB(queues[_0x306c25[_0xe3ff('0x4')]]);}}else if(!_['isNil'](_0x306c25[_0xe3ff('0x27')][_0xe3ff('0x28')])){if(!_[_0xe3ff('0x17')](queues[_0x306c25[_0xe3ff('0x4')]])&&!queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerabandon']){queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerabandonAt']=null;queues[_0x306c25[_0xe3ff('0x4')]]['queuecallerexit']=!![];queues[_0x306c25['uniqueid']]['queuecallerexitAt']=utils[_0xe3ff('0x15')]();queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0xe3ff('0x29');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x306c25[_0xe3ff('0x4')],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x306c25[_0xe3ff('0x20')],queues[_0x306c25[_0xe3ff('0x4')]][_0xe3ff('0x9')]));}}}catch(_0x46cfc0){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x1e'),_0x306c25[_0xe3ff('0x4')]),_0x46cfc0);}};exports[_0xe3ff('0x22')]=function(_0x5ab9e4){try{if(!_[_0xe3ff('0x17')](queues[_0x5ab9e4['uniqueid']])){utils['debug'](util['format']('[%s][queues][queuecallerabandon]',_0x5ab9e4[_0xe3ff('0x4')]),_0x5ab9e4);queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x19')]=![];queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x24')]=null;queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x22')]=!![];queues[_0x5ab9e4['uniqueid']][_0xe3ff('0x23')]=utils[_0xe3ff('0x15')]();queues[_0x5ab9e4[_0xe3ff('0x4')]]['queuecallerexitreason']=_0xe3ff('0x2a');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5ab9e4[_0xe3ff('0x4')],queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x26')],queues[_0x5ab9e4[_0xe3ff('0x4')]][_0xe3ff('0x9')]));}}catch(_0x435888){utils[_0xe3ff('0x1c')](util['format'](_0xe3ff('0x2b'),_0x5ab9e4[_0xe3ff('0x4')]),_0x435888);}};exports['queuecallerleave']=function(_0x4eff9d){try{if(!_[_0xe3ff('0x17')](queues[_0x4eff9d[_0xe3ff('0x4')]])){utils['debug'](util['format'](_0xe3ff('0x2c'),_0x4eff9d[_0xe3ff('0x4')]),_0x4eff9d);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x2d'),_0x4eff9d[_0xe3ff('0x4')],queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x4eff9d[_0xe3ff('0x2e')],_0x4eff9d[_0xe3ff('0x2f')]));queues[_0x4eff9d['uniqueid']]['queuecallerleave']=!![];queues[_0x4eff9d['uniqueid']][_0xe3ff('0x30')]=utils[_0xe3ff('0x15')]();queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x31')]=utils[_0xe3ff('0x32')](queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x30')],queues[_0x4eff9d['uniqueid']][_0xe3ff('0x33')]);queues[_0x4eff9d['uniqueid']]['position']=_0x4eff9d[_0xe3ff('0x13')];queues[_0x4eff9d['uniqueid']][_0xe3ff('0x34')]=_0x4eff9d[_0xe3ff('0x34')];queues[_0x4eff9d[_0xe3ff('0x4')]]['connectedlinenum']=_0x4eff9d['connectedlinenum'];queues[_0x4eff9d[_0xe3ff('0x4')]][_0xe3ff('0x2f')]=_0x4eff9d['connectedlinename'];}}catch(_0x302323){utils['error'](util[_0xe3ff('0x2')](_0xe3ff('0x2c'),_0x4eff9d[_0xe3ff('0x4')]),_0x302323);}};exports[_0xe3ff('0x35')]=function(_0x46a8fe){try{if(!_['isNil'](queues[_0x46a8fe[_0xe3ff('0x4')]])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x36'),_0x46a8fe['uniqueid']),_0x46a8fe);utils[_0xe3ff('0x12')](util['format'](_0xe3ff('0x37'),_0x46a8fe[_0xe3ff('0x4')],queues[_0x46a8fe[_0xe3ff('0x4')]]['name'],_0x46a8fe[_0xe3ff('0x38')],_0x46a8fe[_0xe3ff('0x39')]));queues[_0x46a8fe['uniqueid']][_0xe3ff('0x22')]=![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x46a8fe['uniqueid']][_0xe3ff('0x23')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x19')]=![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x9')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x24')]=null;queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x3a')]=!![];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x3b')]=_0x46a8fe['destaccountcode'];queues[_0x46a8fe[_0xe3ff('0x4')]][_0xe3ff('0x7')]=_0x46a8fe['membername'];}}catch(_0x34ff35){utils['error'](util['format'](_0xe3ff('0x36'),_0x46a8fe[_0xe3ff('0x4')]),_0x34ff35);}};exports[_0xe3ff('0x3c')]=function(_0x2d1460){try{if(!_[_0xe3ff('0x17')](queues[_0x2d1460['uniqueid']])){if(queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x30')]){utils['debug'](util['format'](_0xe3ff('0x3d'),_0x2d1460[_0xe3ff('0x4')]),_0x2d1460);queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x22')]=![];queues[_0x2d1460['uniqueid']]['queuecallerabandon']=![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x23')]=null;queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexit']=![];queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexitAt']=null;queues[_0x2d1460[_0xe3ff('0x4')]]['assigned']=!![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x7')]=_0x2d1460[_0xe3ff('0x38')];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x1a')]=!![];queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x3e')]=utils[_0xe3ff('0x15')]();if(_0x2d1460[_0xe3ff('0x3f')]==_0xe3ff('0x40')){if(!queues[_0x2d1460[_0xe3ff('0x4')]]['transfer']){queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x9')]=_0xe3ff('0x41');}}else{queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x9')]='COMPLETEDBY'+_0x2d1460[_0xe3ff('0x3f')][_0xe3ff('0x21')]();}utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x42'),_0x2d1460[_0xe3ff('0x4')],queues[_0x2d1460[_0xe3ff('0x4')]][_0xe3ff('0x26')],_0x2d1460[_0xe3ff('0x38')],queues[_0x2d1460[_0xe3ff('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x2d1460[_0xe3ff('0x4')]]);}}}catch(_0x21ea05){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x3d'),_0x2d1460['uniqueid']),_0x21ea05);}};exports[_0xe3ff('0x43')]=function(_0x30674e){try{if(!_[_0xe3ff('0x17')](queues[_0x30674e[_0xe3ff('0x44')]])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x45'),_0x30674e[_0xe3ff('0x4')]),_0x30674e);queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x40')]=!![];queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x46')]=_0xe3ff('0x47');queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x48')]=_0x30674e[_0xe3ff('0x49')];queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x4a')]=_0x30674e[_0xe3ff('0x44')];queues[_0x30674e['transfereeuniqueid']][_0xe3ff('0x9')]=_0xe3ff('0x4b');utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x4c'),_0x30674e[_0xe3ff('0x4')],queues[_0x30674e[_0xe3ff('0x44')]][_0xe3ff('0x26')],_0x30674e[_0xe3ff('0x44')],_0x30674e[_0xe3ff('0x49')]));}}catch(_0x2d2750){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x45'),_0x30674e[_0xe3ff('0x4')]),_0x2d2750);}};exports['attendedtransfer']=function(_0x40b4b0){try{utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x4d'),_0x40b4b0[_0xe3ff('0x4e')]),_0x40b4b0);if(_0x40b4b0['origtransfereruniqueid']==_0x40b4b0['origtransfererlinkedid']){if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x4f')]])){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x50'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x51')]));queues[_0x40b4b0[_0xe3ff('0x4f')]]['transfer']=!![];queues[_0x40b4b0['secondtransfererlinkedid']][_0xe3ff('0x46')]=_0xe3ff('0x52');queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x48')]=_0x40b4b0['origtransfererexten'];queues[_0x40b4b0['secondtransfererlinkedid']]['transferuniqueid']=_0x40b4b0[_0xe3ff('0x4e')];queues[_0x40b4b0['secondtransfererlinkedid']]['queuecallerexitreason']=_0xe3ff('0x53');}if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x54')]])){if(_0x40b4b0[_0xe3ff('0x55')]&&queues[_0x40b4b0[_0xe3ff('0x55')]]){queues[_0x40b4b0[_0xe3ff('0x55')]][_0xe3ff('0x56')]=0x1;queues[_0x40b4b0[_0xe3ff('0x44')]]=_[_0xe3ff('0x57')](queues[_0x40b4b0[_0xe3ff('0x55')]]);queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x58')];queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerenterreason']=0x2;queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridnum']=queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x8')];queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridname']=queues[_0x40b4b0['secondtransfererlinkedid']]['calleridname'];queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerjoinAt']=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x44')]]['queuecallerleaveAt']=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x31')]=0x0;queues[_0x40b4b0['transfereeuniqueid']][_0xe3ff('0x59')]=0x0;utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5a'),_0x40b4b0[_0xe3ff('0x4e')],queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x26')],queues[_0x40b4b0[_0xe3ff('0x44')]][_0xe3ff('0x8')],queues[_0x40b4b0[_0xe3ff('0x44')]]['calleridname']));}else{utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5b'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x54')]]['name'],_0x40b4b0['secondtransfererlinkedid']));queues[_0x40b4b0[_0xe3ff('0x54')]]['transfereduniqueid']=_0x40b4b0[_0xe3ff('0x4f')];}}}else if(_0x40b4b0[_0xe3ff('0x5c')]==_0x40b4b0[_0xe3ff('0x4f')]){if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x54')]])){utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5d'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x5c')],_0x40b4b0['secondtransfererexten']));queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x40')]=!![];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x46')]=_0xe3ff('0x52');queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x48')]=_0x40b4b0['secondtransfererexten'];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x4a')]=_0x40b4b0['secondtransfereruniqueid'];queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x9')]=_0xe3ff('0x53');}if(!_[_0xe3ff('0x17')](queues[_0x40b4b0[_0xe3ff('0x4f')]])){if(_0x40b4b0[_0xe3ff('0x5e')]&&queues[_0x40b4b0[_0xe3ff('0x5e')]]){queues[_0x40b4b0['transfertargetlinkedid']][_0xe3ff('0x56')]=0x1;queues[_0x40b4b0[_0xe3ff('0x58')]]=_[_0xe3ff('0x57')](queues[_0x40b4b0['transfertargetlinkedid']]);queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x58')];queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x56')]=0x2;queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x8')]=queues[_0x40b4b0['origtransfererlinkedid']][_0xe3ff('0x8')];queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x5f')]=queues[_0x40b4b0[_0xe3ff('0x54')]][_0xe3ff('0x5f')];queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x33')]=utils['now']();queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x30')]=utils[_0xe3ff('0x15')]();queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x31')]=0x0;queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x59')]=0x0;utils['info'](util[_0xe3ff('0x2')](_0xe3ff('0x60'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x58')]][_0xe3ff('0x26')],queues[_0x40b4b0[_0xe3ff('0x58')]]['transfereduniqueid'],queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x8')],queues[_0x40b4b0['transfertargetuniqueid']][_0xe3ff('0x5f')]));}else{utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')](_0xe3ff('0x5b'),_0x40b4b0['origtransfereruniqueid'],queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0x26')],_0x40b4b0[_0xe3ff('0x54')]));queues[_0x40b4b0[_0xe3ff('0x4f')]][_0xe3ff('0xf')]=_0x40b4b0[_0xe3ff('0x54')];}}}}catch(_0x389a5b){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x4d'),_0x40b4b0[_0xe3ff('0x4e')]),_0x389a5b);}};exports[_0xe3ff('0x61')]=function(_0x3c8773){try{if(!_[_0xe3ff('0x17')](queues[_0x3c8773[_0xe3ff('0x4')]])){utils['debug'](util[_0xe3ff('0x2')](_0xe3ff('0x62'),_0x3c8773[_0xe3ff('0x4')]),_0x3c8773);queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x63')]=utils[_0xe3ff('0x15')]();utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3c8773[_0xe3ff('0x4')],queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x26')],queues[_0x3c8773[_0xe3ff('0x4')]][_0xe3ff('0x63')]));}}catch(_0xa24b9a){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x62'),_0x3c8773[_0xe3ff('0x4')]),_0xa24b9a);}};exports['musiconholdstop']=function(_0x1e9983){try{if(!_[_0xe3ff('0x17')](queues[_0x1e9983[_0xe3ff('0x4')]])){if(!_[_0xe3ff('0x17')](queues[_0x1e9983[_0xe3ff('0x4')]]['musiconholdstartAt'])){utils[_0xe3ff('0x10')](util[_0xe3ff('0x2')](_0xe3ff('0x64'),_0x1e9983[_0xe3ff('0x4')]),_0x1e9983);queues[_0x1e9983[_0xe3ff('0x4')]][_0xe3ff('0x59')]+=utils['diffTime'](utils[_0xe3ff('0x15')](),queues[_0x1e9983[_0xe3ff('0x4')]][_0xe3ff('0x63')]);utils[_0xe3ff('0x12')](util[_0xe3ff('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x1e9983['uniqueid'],queues[_0x1e9983[_0xe3ff('0x4')]]['name'],queues[_0x1e9983[_0xe3ff('0x4')]]['mohtime']));delete queues[_0x1e9983[_0xe3ff('0x4')]]['musiconholdstartAt'];}}}catch(_0x51c988){utils[_0xe3ff('0x1c')](util[_0xe3ff('0x2')](_0xe3ff('0x64'),_0x1e9983[_0xe3ff('0x4')]),_0x51c988);}}; \ No newline at end of file +var _0xf365=['queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','isNil','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','lastAssignedTo','transfer','TRANSFER','COMPLETEDBY','reason','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transferuniqueid','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','queue','position','assign','now','error','hangup','queuecallerleaveAt','queuecallerabandon','queuecallercomplete'];(function(_0x2aa389,_0x39ddcc){var _0x222fe9=function(_0x4a83cf){while(--_0x4a83cf){_0x2aa389['push'](_0x2aa389['shift']());}};_0x222fe9(++_0x39ddcc);}(_0xf365,0x11c));var _0x5f36=function(_0xdbc93e,_0x4fcd8e){_0xdbc93e=_0xdbc93e-0x0;var _0x29df2c=_0xf365[_0xdbc93e];return _0x29df2c;};'use strict';var _=require(_0x5f36('0x0'));var util=require(_0x5f36('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x35cda4){utils['info'](util[_0x5f36('0x2')](_0x5f36('0x3'),_0x35cda4[_0x5f36('0x4')],_0x35cda4[_0x5f36('0x5')],_0x35cda4['queue'],_0x35cda4['lastAssignedTo'],_0x35cda4[_0x5f36('0x6')],_0x35cda4['accountcode'],_0x35cda4[_0x5f36('0x7')]));if(_0x35cda4['queue']){utils[_0x5f36('0x8')](_0x35cda4['queue'])[_0x5f36('0x9')](function(_0x26d499){if(_0x26d499){_0x35cda4['type']=_0x26d499[_0x5f36('0xa')];}utils[_0x5f36('0xb')](_0x5f36('0xc'),_0x35cda4);});}else{utils['request'](_0x5f36('0xc'),_0x35cda4);}if(_0x35cda4[_0x5f36('0xd')]){delete queues[_0x35cda4['transfereduniqueid']];}else{delete queues[_0x35cda4[_0x5f36('0x4')]];}}exports[_0x5f36('0xe')]=function(_0x35e1a6){try{utils[_0x5f36('0xf')](util[_0x5f36('0x2')](_0x5f36('0x10'),_0x35e1a6['uniqueid']),_0x35e1a6);utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x12'),_0x35e1a6[_0x5f36('0x4')],_0x35e1a6[_0x5f36('0x13')],_0x35e1a6[_0x5f36('0x14')]));queues[_0x35e1a6[_0x5f36('0x4')]]=_[_0x5f36('0x15')](_0x35e1a6,{'originalposition':_0x35e1a6[_0x5f36('0x14')],'queuecallerjoinAt':utils[_0x5f36('0x16')](),'mohtime':0x0});}catch(_0x1baa40){utils[_0x5f36('0x17')](util['format'](_0x5f36('0x10'),_0x35e1a6[_0x5f36('0x4')]),_0x1baa40);}};exports[_0x5f36('0x18')]=function(_0x52d556){try{if(!_['isNil'](queues[_0x52d556['uniqueid']])){utils['debug'](util[_0x5f36('0x2')]('[%s][queues][hangup]',_0x52d556['uniqueid']),_0x52d556);if(queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0x19')]){if(!queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0x1a')]&&!queues[_0x52d556[_0x5f36('0x4')]]['queuecallerexit']){queues[_0x52d556['uniqueid']][_0x5f36('0x1b')]=!![];queues[_0x52d556['uniqueid']][_0x5f36('0x1c')]=utils[_0x5f36('0x16')]();queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0x7')]='COMPLETEDBYAGENT';}utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x1d'),_0x52d556['uniqueid'],queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0x1e')],queues[_0x52d556[_0x5f36('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x52d556[_0x5f36('0x4')]]);}else if(queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0xd')]){utils['info'](util[_0x5f36('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x52d556[_0x5f36('0x4')],queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0x1e')],queues[_0x52d556[_0x5f36('0x4')]][_0x5f36('0xd')]));queues[queues[_0x52d556['uniqueid']][_0x5f36('0xd')]]=queues[_0x52d556['uniqueid']];queues[queues[_0x52d556[_0x5f36('0x4')]]['transfereduniqueid']][_0x5f36('0x1f')]=0x2;delete queues[_0x52d556[_0x5f36('0x4')]];}}}catch(_0x3b4cb8){utils[_0x5f36('0x17')](util[_0x5f36('0x2')](_0x5f36('0x20'),_0x52d556[_0x5f36('0x4')]),_0x3b4cb8);}};exports['varset']=function(_0x36b08b){try{utils[_0x5f36('0xf')](util[_0x5f36('0x2')]('[%s][queues][varset]',_0x36b08b[_0x5f36('0x4')]),_0x36b08b);if(!_[_0x5f36('0x21')](_0x36b08b[_0x5f36('0x22')][_0x5f36('0x23')])&&_0x36b08b[_0x5f36('0x24')]['toUpperCase']()!==_0x5f36('0x25')){if(!_['isNil'](queues[_0x36b08b[_0x5f36('0x4')]])){queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x1a')]=![];queues[_0x36b08b['uniqueid']][_0x5f36('0x26')]=null;queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x27')]=!![];queues[_0x36b08b['uniqueid']][_0x5f36('0x28')]=utils[_0x5f36('0x16')]();queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x7')]=_0x36b08b[_0x5f36('0x24')][_0x5f36('0x29')]();utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x2a'),_0x36b08b['uniqueid'],queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x1e')],_0x36b08b[_0x5f36('0x24')],queues[_0x36b08b['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x36b08b[_0x5f36('0x4')]]);}}else if(!_['isNil'](_0x36b08b[_0x5f36('0x22')][_0x5f36('0x2b')])){if(!_['isNil'](queues[_0x36b08b['uniqueid']])&&!queues[_0x36b08b[_0x5f36('0x4')]]['queuecallerabandon']){queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x1a')]=![];queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x26')]=null;queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x27')]=!![];queues[_0x36b08b[_0x5f36('0x4')]]['queuecallerexitAt']=utils[_0x5f36('0x16')]();queues[_0x36b08b[_0x5f36('0x4')]][_0x5f36('0x7')]=_0x5f36('0x2c');utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x2d'),_0x36b08b['uniqueid'],queues[_0x36b08b['uniqueid']][_0x5f36('0x1e')],_0x36b08b['value'],queues[_0x36b08b['uniqueid']][_0x5f36('0x7')]));}}}catch(_0xc7497d){utils[_0x5f36('0x17')](util[_0x5f36('0x2')]('[%s][queues][varset]',_0x36b08b[_0x5f36('0x4')]),_0xc7497d);}};exports[_0x5f36('0x1a')]=function(_0x14f757){try{if(!_[_0x5f36('0x21')](queues[_0x14f757[_0x5f36('0x4')]])){utils['debug'](util[_0x5f36('0x2')](_0x5f36('0x2e'),_0x14f757[_0x5f36('0x4')]),_0x14f757);queues[_0x14f757['uniqueid']]['queuecallerexit']=![];queues[_0x14f757[_0x5f36('0x4')]][_0x5f36('0x28')]=null;queues[_0x14f757[_0x5f36('0x4')]][_0x5f36('0x1a')]=!![];queues[_0x14f757['uniqueid']][_0x5f36('0x26')]=utils[_0x5f36('0x16')]();queues[_0x14f757[_0x5f36('0x4')]][_0x5f36('0x7')]=_0x5f36('0x2f');utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x30'),_0x14f757[_0x5f36('0x4')],queues[_0x14f757[_0x5f36('0x4')]][_0x5f36('0x1e')],queues[_0x14f757[_0x5f36('0x4')]][_0x5f36('0x7')]));}}catch(_0x2006fc){utils[_0x5f36('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x14f757[_0x5f36('0x4')]),_0x2006fc);}};exports['queuecallerleave']=function(_0xe4b6c6){try{if(!_[_0x5f36('0x21')](queues[_0xe4b6c6[_0x5f36('0x4')]])){utils[_0x5f36('0xf')](util[_0x5f36('0x2')](_0x5f36('0x31'),_0xe4b6c6[_0x5f36('0x4')]),_0xe4b6c6);utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x32'),_0xe4b6c6[_0x5f36('0x4')],queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x1e')],_0xe4b6c6['connectedlinenum'],_0xe4b6c6[_0x5f36('0x33')]));queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x34')]=!![];queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x19')]=utils['now']();queues[_0xe4b6c6[_0x5f36('0x4')]]['holdtime']=utils[_0x5f36('0x35')](queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x19')],queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x36')]);queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x14')]=_0xe4b6c6[_0x5f36('0x14')];queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x37')]=_0xe4b6c6[_0x5f36('0x37')];queues[_0xe4b6c6[_0x5f36('0x4')]]['connectedlinenum']=_0xe4b6c6[_0x5f36('0x38')];queues[_0xe4b6c6[_0x5f36('0x4')]][_0x5f36('0x33')]=_0xe4b6c6[_0x5f36('0x33')];}}catch(_0x477edf){utils[_0x5f36('0x17')](util['format'](_0x5f36('0x31'),_0xe4b6c6['uniqueid']),_0x477edf);}};exports[_0x5f36('0x39')]=function(_0x28e91){try{if(!_[_0x5f36('0x21')](queues[_0x28e91['uniqueid']])){utils[_0x5f36('0xf')](util['format'](_0x5f36('0x3a'),_0x28e91[_0x5f36('0x4')]),_0x28e91);utils[_0x5f36('0x11')](util['format'](_0x5f36('0x3b'),_0x28e91[_0x5f36('0x4')],queues[_0x28e91[_0x5f36('0x4')]][_0x5f36('0x1e')],_0x28e91[_0x5f36('0x3c')],_0x28e91[_0x5f36('0x3d')]));queues[_0x28e91['uniqueid']][_0x5f36('0x1a')]=![];queues[_0x28e91[_0x5f36('0x4')]]['queuecallerabandon']=![];queues[_0x28e91[_0x5f36('0x4')]]['queuecallerabandonAt']=null;queues[_0x28e91[_0x5f36('0x4')]][_0x5f36('0x27')]=![];queues[_0x28e91[_0x5f36('0x4')]]['queuecallerexitreason']=null;queues[_0x28e91[_0x5f36('0x4')]][_0x5f36('0x28')]=null;queues[_0x28e91[_0x5f36('0x4')]][_0x5f36('0x3e')]=!![];queues[_0x28e91['uniqueid']][_0x5f36('0x3f')]=_0x28e91[_0x5f36('0x3d')];queues[_0x28e91[_0x5f36('0x4')]]['lastAssignedTo']=_0x28e91[_0x5f36('0x3c')];}}catch(_0x485d51){utils[_0x5f36('0x17')](util['format'](_0x5f36('0x3a'),_0x28e91['uniqueid']),_0x485d51);}};exports[_0x5f36('0x40')]=function(_0x32a02c){try{if(!_[_0x5f36('0x21')](queues[_0x32a02c['uniqueid']])){if(queues[_0x32a02c['uniqueid']]['queuecallerleaveAt']){utils[_0x5f36('0xf')](util[_0x5f36('0x2')](_0x5f36('0x41'),_0x32a02c['uniqueid']),_0x32a02c);queues[_0x32a02c['uniqueid']][_0x5f36('0x1a')]=![];queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x1a')]=![];queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x26')]=null;queues[_0x32a02c['uniqueid']][_0x5f36('0x27')]=![];queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x28')]=null;queues[_0x32a02c['uniqueid']]['assigned']=!![];queues[_0x32a02c['uniqueid']][_0x5f36('0x42')]=_0x32a02c[_0x5f36('0x3c')];queues[_0x32a02c['uniqueid']]['queuecallercomplete']=!![];queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x1c')]=utils['now']();if(_0x32a02c['reason']==_0x5f36('0x43')){if(!queues[_0x32a02c['uniqueid']][_0x5f36('0x43')]){queues[_0x32a02c[_0x5f36('0x4')]]['queuecallerexitreason']=_0x5f36('0x44');}}else{queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x7')]=_0x5f36('0x45')+_0x32a02c[_0x5f36('0x46')]['toUpperCase']();}utils[_0x5f36('0x11')](util[_0x5f36('0x2')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x32a02c[_0x5f36('0x4')],queues[_0x32a02c['uniqueid']]['name'],_0x32a02c[_0x5f36('0x3c')],queues[_0x32a02c[_0x5f36('0x4')]][_0x5f36('0x7')]));writeDB(queues[_0x32a02c['uniqueid']]);}}}catch(_0x284bfb){utils['error'](util[_0x5f36('0x2')]('[%s][queues][agentcomplete]',_0x32a02c[_0x5f36('0x4')]),_0x284bfb);}};exports['blindtransfer']=function(_0x5cff78){try{if(!_[_0x5f36('0x21')](queues[_0x5cff78[_0x5f36('0x47')]])){utils['debug'](util[_0x5f36('0x2')]('[%s][queues][blindtransfer]',_0x5cff78[_0x5f36('0x4')]),_0x5cff78);queues[_0x5cff78[_0x5f36('0x47')]][_0x5f36('0x43')]=!![];queues[_0x5cff78[_0x5f36('0x47')]][_0x5f36('0x48')]='BLIND';queues[_0x5cff78[_0x5f36('0x47')]]['transferexten']=_0x5cff78[_0x5f36('0x49')];queues[_0x5cff78[_0x5f36('0x47')]]['transferuniqueid']=_0x5cff78['transfereeuniqueid'];queues[_0x5cff78[_0x5f36('0x47')]]['queuecallerexitreason']=_0x5f36('0x4a');utils[_0x5f36('0x11')](util['format'](_0x5f36('0x4b'),_0x5cff78['uniqueid'],queues[_0x5cff78[_0x5f36('0x47')]]['name'],_0x5cff78[_0x5f36('0x47')],_0x5cff78['extension']));}}catch(_0x41f207){utils['error'](util['format'](_0x5f36('0x4c'),_0x5cff78[_0x5f36('0x4')]),_0x41f207);}};exports[_0x5f36('0x4d')]=function(_0x5d6d36){try{utils['debug'](util[_0x5f36('0x2')](_0x5f36('0x4e'),_0x5d6d36['origtransfereruniqueid']),_0x5d6d36);if(_0x5d6d36[_0x5f36('0x4f')]==_0x5d6d36['origtransfererlinkedid']){if(!_['isNil'](queues[_0x5d6d36[_0x5f36('0x50')]])){utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x51'),_0x5d6d36[_0x5f36('0x4f')],queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x1e')],_0x5d6d36[_0x5f36('0x52')]));queues[_0x5d6d36['secondtransfererlinkedid']][_0x5f36('0x43')]=!![];queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x48')]=_0x5f36('0x53');queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x54')]=_0x5d6d36[_0x5f36('0x52')];queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x55')]=_0x5d6d36[_0x5f36('0x4f')];queues[_0x5d6d36['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x5f36('0x21')](queues[_0x5d6d36[_0x5f36('0x56')]])){if(_0x5d6d36[_0x5f36('0x57')]&&queues[_0x5d6d36[_0x5f36('0x57')]]){queues[_0x5d6d36[_0x5f36('0x57')]][_0x5f36('0x1f')]=0x1;queues[_0x5d6d36['transfereeuniqueid']]=_['clone'](queues[_0x5d6d36[_0x5f36('0x57')]]);queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0xd')]=_0x5d6d36[_0x5f36('0x58')];queues[_0x5d6d36['transfereeuniqueid']][_0x5f36('0x1f')]=0x2;queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x6')]=queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x6')];queues[_0x5d6d36[_0x5f36('0x47')]]['calleridname']=queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x59')];queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x36')]=utils[_0x5f36('0x16')]();queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x19')]=utils[_0x5f36('0x16')]();queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x5a')]=0x0;queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x5b')]=0x0;utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x5c'),_0x5d6d36[_0x5f36('0x4f')],queues[_0x5d6d36['transfereeuniqueid']][_0x5f36('0x1e')],queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x6')],queues[_0x5d6d36[_0x5f36('0x47')]][_0x5f36('0x59')]));}else{utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x5d'),_0x5d6d36[_0x5f36('0x4f')],queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x1e')],_0x5d6d36[_0x5f36('0x50')]));queues[_0x5d6d36[_0x5f36('0x56')]]['transfereduniqueid']=_0x5d6d36[_0x5f36('0x50')];}}}else if(_0x5d6d36[_0x5f36('0x5e')]==_0x5d6d36[_0x5f36('0x50')]){if(!_[_0x5f36('0x21')](queues[_0x5d6d36[_0x5f36('0x56')]])){utils[_0x5f36('0x11')](util[_0x5f36('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5d6d36['origtransfereruniqueid'],queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x1e')],_0x5d6d36[_0x5f36('0x5e')],_0x5d6d36[_0x5f36('0x5f')]));queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x43')]=!![];queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x48')]=_0x5f36('0x53');queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x54')]=_0x5d6d36['secondtransfererexten'];queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x55')]=_0x5d6d36[_0x5f36('0x5e')];queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x7')]=_0x5f36('0x60');}if(!_[_0x5f36('0x21')](queues[_0x5d6d36[_0x5f36('0x50')]])){if(_0x5d6d36[_0x5f36('0x61')]&&queues[_0x5d6d36[_0x5f36('0x61')]]){queues[_0x5d6d36[_0x5f36('0x61')]][_0x5f36('0x1f')]=0x1;queues[_0x5d6d36[_0x5f36('0x58')]]=_[_0x5f36('0x62')](queues[_0x5d6d36[_0x5f36('0x61')]]);queues[_0x5d6d36[_0x5f36('0x58')]]['transfereduniqueid']=_0x5d6d36[_0x5f36('0x58')];queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x1f')]=0x2;queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x6')]=queues[_0x5d6d36[_0x5f36('0x56')]]['calleridnum'];queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x59')]=queues[_0x5d6d36[_0x5f36('0x56')]][_0x5f36('0x59')];queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x36')]=utils[_0x5f36('0x16')]();queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x19')]=utils['now']();queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x5a')]=0x0;queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x5b')]=0x0;utils['info'](util['format'](_0x5f36('0x63'),_0x5d6d36['origtransfereruniqueid'],queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x1e')],queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0xd')],queues[_0x5d6d36[_0x5f36('0x58')]][_0x5f36('0x6')],queues[_0x5d6d36['transfertargetuniqueid']][_0x5f36('0x59')]));}else{utils[_0x5f36('0x11')](util[_0x5f36('0x2')](_0x5f36('0x5d'),_0x5d6d36['origtransfereruniqueid'],queues[_0x5d6d36[_0x5f36('0x50')]][_0x5f36('0x1e')],_0x5d6d36['origtransfererlinkedid']));queues[_0x5d6d36['secondtransfererlinkedid']]['transfereduniqueid']=_0x5d6d36['origtransfererlinkedid'];}}}}catch(_0x597f66){utils[_0x5f36('0x17')](util['format'](_0x5f36('0x4e'),_0x5d6d36['origtransfereruniqueid']),_0x597f66);}};exports['musiconholdstart']=function(_0x2ccaab){try{if(!_[_0x5f36('0x21')](queues[_0x2ccaab[_0x5f36('0x4')]])){utils[_0x5f36('0xf')](util[_0x5f36('0x2')]('[%s][queues][musiconholdstart]',_0x2ccaab[_0x5f36('0x4')]),_0x2ccaab);queues[_0x2ccaab['uniqueid']][_0x5f36('0x64')]=utils['now']();utils[_0x5f36('0x11')](util[_0x5f36('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x2ccaab[_0x5f36('0x4')],queues[_0x2ccaab['uniqueid']][_0x5f36('0x1e')],queues[_0x2ccaab[_0x5f36('0x4')]][_0x5f36('0x64')]));}}catch(_0xb2d4cb){utils[_0x5f36('0x17')](util[_0x5f36('0x2')](_0x5f36('0x65'),_0x2ccaab[_0x5f36('0x4')]),_0xb2d4cb);}};exports[_0x5f36('0x66')]=function(_0x2c4e24){try{if(!_[_0x5f36('0x21')](queues[_0x2c4e24['uniqueid']])){if(!_[_0x5f36('0x21')](queues[_0x2c4e24['uniqueid']][_0x5f36('0x64')])){utils['debug'](util[_0x5f36('0x2')](_0x5f36('0x67'),_0x2c4e24[_0x5f36('0x4')]),_0x2c4e24);queues[_0x2c4e24[_0x5f36('0x4')]]['mohtime']+=utils[_0x5f36('0x35')](utils[_0x5f36('0x16')](),queues[_0x2c4e24['uniqueid']][_0x5f36('0x64')]);utils[_0x5f36('0x11')](util[_0x5f36('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x2c4e24[_0x5f36('0x4')],queues[_0x2c4e24[_0x5f36('0x4')]][_0x5f36('0x1e')],queues[_0x2c4e24[_0x5f36('0x4')]]['mohtime']));delete queues[_0x2c4e24[_0x5f36('0x4')]][_0x5f36('0x64')];}}}catch(_0x4c87c5){utils[_0x5f36('0x17')](util[_0x5f36('0x2')](_0x5f36('0x67'),_0x2c4e24['uniqueid']),_0x4c87c5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e48a978..bb806df 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 _0x697c=['lodash','util','./utils','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','newchannel','linkedid','context','channel','newstate','debug','format','[%s][recordings][newstate]','isNil','info','[%s][recordings][newstate]\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue'];(function(_0x2f023d,_0x29dfe5){var _0x4ef240=function(_0x49f1ec){while(--_0x49f1ec){_0x2f023d['push'](_0x2f023d['shift']());}};_0x4ef240(++_0x29dfe5);}(_0x697c,0xd8));var _0xc697=function(_0x7e7286,_0x3b14e5){_0x7e7286=_0x7e7286-0x0;var _0x3c6e4e=_0x697c[_0x7e7286];return _0x3c6e4e;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var utils=require(_0xc697('0x2'));var recordings={};function writeDB(_0x5f4ca3){utils['info'](util['format'](_0xc697('0x3'),_0x5f4ca3[_0xc697('0x4')]));if(_0x5f4ca3[_0xc697('0x5')]){utils[_0xc697('0x6')](_0x5f4ca3[_0xc697('0x5')])[_0xc697('0x7')](function(_0x225a0b){if(_0x225a0b){_0x5f4ca3['membername']=_0x225a0b['name'];_0x5f4ca3['UserId']=_0x225a0b['id'];}utils['request']('CreateVoiceRecording',_0x5f4ca3);});}else{utils['request']('CreateVoiceRecording',_0x5f4ca3);}}exports[_0xc697('0x8')]=function(_0x3da258){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x3da258[_0xc697('0x4')]),_0x3da258);if(_0x3da258['uniqueid']==_0x3da258[_0xc697('0x9')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x3da258[_0xc697('0x4')],_0x3da258[_0xc697('0xa')],_0x3da258['exten']));recordings[_0x3da258[_0xc697('0x4')]]={'uniqueid':_0x3da258[_0xc697('0x4')],'accountcode':_0x3da258[_0xc697('0x5')],'exten':_0x3da258['exten'],'context':_0x3da258[_0xc697('0xa')],'channel':_0x3da258[_0xc697('0xb')],'monitors':[]};}}catch(_0x51075b){utils['error'](util['format']('[%s][recordings][newchannel]',_0x3da258[_0xc697('0x4')]),_0x51075b);}};exports[_0xc697('0xc')]=function(_0x1740ae){try{utils[_0xc697('0xd')](util[_0xc697('0xe')](_0xc697('0xf'),_0x1740ae['uniqueid']),_0x1740ae);if(!_[_0xc697('0x10')](recordings[_0x1740ae[_0xc697('0x4')]])&&_0x1740ae['channelstate']==0x6){utils[_0xc697('0x11')](util[_0xc697('0xe')](_0xc697('0x12'),_0x1740ae[_0xc697('0x4')],_0x1740ae[_0xc697('0xa')],_0x1740ae[_0xc697('0xb')]));}else if(!_[_0xc697('0x10')](recordings[_0x1740ae[_0xc697('0x9')]])&&_0x1740ae['channelstate']==0x6&&_0x1740ae['context']!='transfer'){utils[_0xc697('0x11')](util[_0xc697('0xe')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1740ae[_0xc697('0x4')],_0x1740ae[_0xc697('0x9')],_0x1740ae[_0xc697('0xa')],_0x1740ae['channel']));recordings[_0x1740ae[_0xc697('0x9')]][_0xc697('0x5')]=_0x1740ae['accountcode'];}}catch(_0x4cebee){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][newstate]',_0x1740ae[_0xc697('0x4')]),_0x4cebee);}};exports[_0xc697('0x14')]=function(_0x161f7f){try{if(!_[_0xc697('0x10')](_0x161f7f[_0xc697('0x15')])&&!_[_0xc697('0x10')](_0x161f7f[_0xc697('0x15')][_0xc697('0x16')])){utils['debug'](util[_0xc697('0xe')](_0xc697('0x17'),_0x161f7f[_0xc697('0x4')]),_0x161f7f);utils[_0xc697('0x11')](util['format'](_0xc697('0x18'),_0x161f7f['uniqueid'],_0x161f7f['variable'],_0x161f7f[_0xc697('0x19')]));if(_['endsWith'](_0x161f7f[_0xc697('0x19')],'.wav49')){_0x161f7f[_0xc697('0x19')]=_0x161f7f[_0xc697('0x19')][_0xc697('0x1a')](_0xc697('0x1b'),_0xc697('0x1c'));}if(recordings[_0x161f7f[_0xc697('0x9')]]){var _0xce4f49=_[_0xc697('0x1d')](recordings[_0x161f7f[_0xc697('0x9')]][_0xc697('0x1e')],{'value':_0x161f7f[_0xc697('0x19')]});if(_[_0xc697('0x10')](_0xce4f49)){recordings[_0x161f7f[_0xc697('0x9')]]['monitors'][_0xc697('0x1f')]({'value':_0x161f7f['value']});}}}}catch(_0x54ee02){utils[_0xc697('0x13')](util['format']('[%s][recordings][varset]',_0x161f7f[_0xc697('0x4')]),_0x54ee02);}};exports[_0xc697('0x20')]=function(_0x4876c9){try{if(!_[_0xc697('0x10')](recordings[_0x4876c9['uniqueid']])){utils[_0xc697('0xd')](util['format'](_0xc697('0x21'),_0x4876c9['uniqueid']),_0x4876c9);utils[_0xc697('0x11')](util['format'](_0xc697('0x22'),_0x4876c9['uniqueid'],_0x4876c9[_0xc697('0x23')],_0x4876c9[_0xc697('0x24')],_0x4876c9[_0xc697('0x25')]));recordings[_0x4876c9['uniqueid']][_0xc697('0x23')]=_0x4876c9['calleridnum'];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x24')]=_0x4876c9[_0xc697('0x24')];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x26')]=_0x4876c9[_0xc697('0x26')];recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x27')]=_0x4876c9[_0xc697('0x27')];if(recordings[_0x4876c9[_0xc697('0x4')]]['type']==_0xc697('0x28')&&recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x5')]){recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x26')]=recordings[_0x4876c9[_0xc697('0x4')]][_0xc697('0x5')];recordings[_0x4876c9['uniqueid']][_0xc697('0x27')]='';}recordings[_0x4876c9['uniqueid']][_0xc697('0x1e')]['forEach'](function(_0x533311){var _0x5cdb31=_['clone'](recordings[_0x4876c9[_0xc697('0x4')]]);_0x5cdb31[_0xc697('0x19')]=_0x533311['value'];writeDB(_0x5cdb31);});delete recordings[_0x4876c9[_0xc697('0x4')]];}}catch(_0x1e2dbf){utils['error'](util[_0xc697('0xe')]('[%s][recordings][hangup]',_0x4876c9[_0xc697('0x4')]),_0x1e2dbf);}};exports['newexten']=function(_0xa9f4f8){try{if(!_['isNil'](recordings[_0xa9f4f8['uniqueid']])){utils[_0xc697('0xd')](util[_0xc697('0xe')](_0xc697('0x29'),_0xa9f4f8[_0xc697('0x4')]),_0xa9f4f8);utils[_0xc697('0x11')](util[_0xc697('0xe')](_0xc697('0x2a'),_0xa9f4f8[_0xc697('0x4')],_0xa9f4f8[_0xc697('0x2b')],_0xa9f4f8[_0xc697('0x2c')]));if(_0xa9f4f8[_0xc697('0x2b')]['toLowerCase']()==_0xc697('0x2d')&&_[_0xc697('0x2e')](_0xa9f4f8[_0xc697('0x2c')][_0xc697('0x2f')](),_0xc697('0x30'))){var _0x41d36e=_0xa9f4f8[_0xc697('0x2c')][_0xc697('0x31')]('=');var _0x1c99ed=_0x41d36e[0x0][_0xc697('0x32')](_0x41d36e[0x0][_0xc697('0x33')]('(')+0x1,_0x41d36e[0x0][_0xc697('0x33')](')'));var _0x1b4970=_0x41d36e[0x1];recordings[_0xa9f4f8[_0xc697('0x4')]][_0x1c99ed]=_0x1b4970;}}}catch(_0x5eb863){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][newexten]',_0xa9f4f8[_0xc697('0x4')]),_0x5eb863);}};exports['queuecallerjoin']=function(_0xc03a92){try{if(!_[_0xc697('0x10')](recordings[_0xc03a92[_0xc697('0x4')]])){utils[_0xc697('0xd')](util[_0xc697('0xe')]('[%s][recordings][queuecallerjoin]',_0xc03a92[_0xc697('0x4')]),_0xc03a92);utils['info'](util[_0xc697('0xe')](_0xc697('0x34'),_0xc03a92[_0xc697('0x4')],_0xc03a92[_0xc697('0x35')]));recordings[_0xc03a92['uniqueid']][_0xc697('0x35')]=_0xc03a92[_0xc697('0x35')];}}catch(_0x386a98){utils[_0xc697('0x13')](util[_0xc697('0xe')]('[%s][recordings][queuecallerjoin]',_0xc03a92['uniqueid']),_0x386a98);}}; \ No newline at end of file +var _0x2420=['clone','newexten','[%s][recordings][newexten]','appdata','application','set','startsWith','toLowerCase','split','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','util','./utils','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2420,0x163));var _0x0242=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x2420[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var utils=require(_0x0242('0x2'));var recordings={};function writeDB(_0x2e0085){utils['info'](util[_0x0242('0x3')](_0x0242('0x4'),_0x2e0085[_0x0242('0x5')]));if(_0x2e0085[_0x0242('0x6')]){utils[_0x0242('0x7')](_0x2e0085[_0x0242('0x6')])['then'](function(_0x35a52a){if(_0x35a52a){_0x2e0085[_0x0242('0x8')]=_0x35a52a[_0x0242('0x9')];_0x2e0085[_0x0242('0xa')]=_0x35a52a['id'];}utils['request']('CreateVoiceRecording',_0x2e0085);});}else{utils[_0x0242('0xb')]('CreateVoiceRecording',_0x2e0085);}}exports['newchannel']=function(_0x57891a){try{utils[_0x0242('0xc')](util[_0x0242('0x3')](_0x0242('0xd'),_0x57891a['uniqueid']),_0x57891a);if(_0x57891a[_0x0242('0x5')]==_0x57891a[_0x0242('0xe')]){utils['info'](util['format'](_0x0242('0xf'),_0x57891a[_0x0242('0x5')],_0x57891a['context'],_0x57891a[_0x0242('0x10')]));recordings[_0x57891a[_0x0242('0x5')]]={'uniqueid':_0x57891a[_0x0242('0x5')],'accountcode':_0x57891a['accountcode'],'exten':_0x57891a[_0x0242('0x10')],'context':_0x57891a[_0x0242('0x11')],'channel':_0x57891a[_0x0242('0x12')],'monitors':[]};}}catch(_0x62e179){utils[_0x0242('0x13')](util[_0x0242('0x3')](_0x0242('0xd'),_0x57891a[_0x0242('0x5')]),_0x62e179);}};exports[_0x0242('0x14')]=function(_0x2c957c){try{utils[_0x0242('0xc')](util[_0x0242('0x3')](_0x0242('0x15'),_0x2c957c[_0x0242('0x5')]),_0x2c957c);if(!_[_0x0242('0x16')](recordings[_0x2c957c['uniqueid']])&&_0x2c957c[_0x0242('0x17')]==0x6){utils[_0x0242('0x18')](util[_0x0242('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2c957c['uniqueid'],_0x2c957c[_0x0242('0x11')],_0x2c957c[_0x0242('0x12')]));}else if(!_[_0x0242('0x16')](recordings[_0x2c957c['linkedid']])&&_0x2c957c['channelstate']==0x6&&_0x2c957c[_0x0242('0x11')]!='transfer'){utils['info'](util[_0x0242('0x3')](_0x0242('0x19'),_0x2c957c['uniqueid'],_0x2c957c[_0x0242('0xe')],_0x2c957c[_0x0242('0x11')],_0x2c957c[_0x0242('0x12')]));recordings[_0x2c957c[_0x0242('0xe')]][_0x0242('0x6')]=_0x2c957c['accountcode'];}}catch(_0x4b4478){utils[_0x0242('0x13')](util[_0x0242('0x3')]('[%s][recordings][newstate]',_0x2c957c[_0x0242('0x5')]),_0x4b4478);}};exports['varset']=function(_0x2b182d){try{if(!_['isNil'](_0x2b182d['variable'])&&!_['isNil'](_0x2b182d['variable']['mixmonitor_filename'])){utils[_0x0242('0xc')](util[_0x0242('0x3')]('[%s][recordings][varset]',_0x2b182d[_0x0242('0x5')]),_0x2b182d);utils[_0x0242('0x18')](util[_0x0242('0x3')](_0x0242('0x1a'),_0x2b182d[_0x0242('0x5')],_0x2b182d['variable'],_0x2b182d[_0x0242('0x1b')]));if(_[_0x0242('0x1c')](_0x2b182d['value'],_0x0242('0x1d'))){_0x2b182d['value']=_0x2b182d['value']['replace']('.wav49','.WAV');}if(recordings[_0x2b182d[_0x0242('0xe')]]){var _0x55cda8=_[_0x0242('0x1e')](recordings[_0x2b182d[_0x0242('0xe')]][_0x0242('0x1f')],{'value':_0x2b182d[_0x0242('0x1b')]});if(_[_0x0242('0x16')](_0x55cda8)){recordings[_0x2b182d[_0x0242('0xe')]][_0x0242('0x1f')]['push']({'value':_0x2b182d[_0x0242('0x1b')]});}}}}catch(_0x1ccee4){utils[_0x0242('0x13')](util['format'](_0x0242('0x20'),_0x2b182d[_0x0242('0x5')]),_0x1ccee4);}};exports[_0x0242('0x21')]=function(_0x52a1d3){try{if(!_[_0x0242('0x16')](recordings[_0x52a1d3[_0x0242('0x5')]])){utils[_0x0242('0xc')](util[_0x0242('0x3')](_0x0242('0x22'),_0x52a1d3['uniqueid']),_0x52a1d3);utils[_0x0242('0x18')](util['format'](_0x0242('0x23'),_0x52a1d3[_0x0242('0x5')],_0x52a1d3[_0x0242('0x24')],_0x52a1d3['calleridname'],_0x52a1d3[_0x0242('0x25')]));recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x24')]=_0x52a1d3['calleridnum'];recordings[_0x52a1d3['uniqueid']][_0x0242('0x26')]=_0x52a1d3['calleridname'];recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x27')]=_0x52a1d3[_0x0242('0x27')];recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x28')]=_0x52a1d3['connectedlinename'];if(recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x29')]==_0x0242('0x2a')&&recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x6')]){recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x27')]=recordings[_0x52a1d3['uniqueid']][_0x0242('0x6')];recordings[_0x52a1d3[_0x0242('0x5')]]['connectedlinename']='';}recordings[_0x52a1d3[_0x0242('0x5')]][_0x0242('0x1f')][_0x0242('0x2b')](function(_0x2109cf){var _0x3b99ca=_[_0x0242('0x2c')](recordings[_0x52a1d3[_0x0242('0x5')]]);_0x3b99ca[_0x0242('0x1b')]=_0x2109cf[_0x0242('0x1b')];writeDB(_0x3b99ca);});delete recordings[_0x52a1d3[_0x0242('0x5')]];}}catch(_0x280607){utils['error'](util[_0x0242('0x3')](_0x0242('0x22'),_0x52a1d3['uniqueid']),_0x280607);}};exports[_0x0242('0x2d')]=function(_0x4935d3){try{if(!_[_0x0242('0x16')](recordings[_0x4935d3[_0x0242('0x5')]])){utils[_0x0242('0xc')](util[_0x0242('0x3')](_0x0242('0x2e'),_0x4935d3[_0x0242('0x5')]),_0x4935d3);utils[_0x0242('0x18')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4935d3[_0x0242('0x5')],_0x4935d3['application'],_0x4935d3[_0x0242('0x2f')]));if(_0x4935d3[_0x0242('0x30')]['toLowerCase']()==_0x0242('0x31')&&_[_0x0242('0x32')](_0x4935d3[_0x0242('0x2f')][_0x0242('0x33')](),'cdr')){var _0x45a6e3=_0x4935d3[_0x0242('0x2f')][_0x0242('0x34')]('=');var _0x1b9082=_0x45a6e3[0x0]['substring'](_0x45a6e3[0x0][_0x0242('0x35')]('(')+0x1,_0x45a6e3[0x0]['lastIndexOf'](')'));var _0x490775=_0x45a6e3[0x1];recordings[_0x4935d3[_0x0242('0x5')]][_0x1b9082]=_0x490775;}}}catch(_0x2e6779){utils[_0x0242('0x13')](util[_0x0242('0x3')]('[%s][recordings][newexten]',_0x4935d3['uniqueid']),_0x2e6779);}};exports[_0x0242('0x36')]=function(_0x40595e){try{if(!_[_0x0242('0x16')](recordings[_0x40595e[_0x0242('0x5')]])){utils[_0x0242('0xc')](util[_0x0242('0x3')]('[%s][recordings][queuecallerjoin]',_0x40595e[_0x0242('0x5')]),_0x40595e);utils[_0x0242('0x18')](util[_0x0242('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x40595e[_0x0242('0x5')],_0x40595e[_0x0242('0x37')]));recordings[_0x40595e['uniqueid']][_0x0242('0x37')]=_0x40595e[_0x0242('0x37')];}}catch(_0x74ccbf){utils[_0x0242('0x13')](util[_0x0242('0x3')](_0x0242('0x38'),_0x40595e[_0x0242('0x5')]),_0x74ccbf);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d1511bf..6e6450d 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 _0xe0af=['origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x56de82,_0x2a0650){var _0xb4a459=function(_0x367036){while(--_0x367036){_0x56de82['push'](_0x56de82['shift']());}};_0xb4a459(++_0x2a0650);}(_0xe0af,0x1c9));var _0xfe0a=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xe0af[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var utils=require(_0xfe0a('0x2'));function writeDB(_0x529e14){utils[_0xfe0a('0x3')](util[_0xfe0a('0x4')](_0xfe0a('0x5'),_0x529e14[_0xfe0a('0x6')]===_0xfe0a('0x7')?_0x529e14[_0xfe0a('0x8')]:_0x529e14[_0xfe0a('0x9')],_0x529e14[_0xfe0a('0x6')]));utils[_0xfe0a('0xa')]('CreateVoiceTransferReport',_0x529e14);}exports['blindtransfer']=function(_0x1251cf){try{utils[_0xfe0a('0xb')](util['format'](_0xfe0a('0xc'),_0x1251cf[_0xfe0a('0x9')]),_0x1251cf);utils['info'](util[_0xfe0a('0x4')](_0xfe0a('0xd'),_0x1251cf[_0xfe0a('0x9')],_0x1251cf[_0xfe0a('0xe')],_0x1251cf['transferercalleridname'],_0x1251cf[_0xfe0a('0xf')],_0x1251cf[_0xfe0a('0x10')]));_0x1251cf[_0xfe0a('0x6')]=_0xfe0a('0x11');writeDB(_0x1251cf);}catch(_0x2ffc9d){utils[_0xfe0a('0x12')](util['format'](_0xfe0a('0xc'),_0x1251cf[_0xfe0a('0x9')]),_0x2ffc9d);}};exports['attendedtransfer']=function(_0x16b62d){try{utils[_0xfe0a('0xb')](util[_0xfe0a('0x4')](_0xfe0a('0x13'),_0x16b62d['origtransfereruniqueid']),_0x16b62d);utils[_0xfe0a('0x3')](util['format'](_0xfe0a('0x14'),_0x16b62d[_0xfe0a('0x8')],_0x16b62d['origtransferercalleridnum'],_0x16b62d['origtransferercalleridname'],_0x16b62d[_0xfe0a('0x15')],_0x16b62d[_0xfe0a('0x16')]));_0x16b62d=_['assign'](_0x16b62d,{'transfererchannel':_0x16b62d[_0xfe0a('0x17')],'transferercalleridnum':_0x16b62d[_0xfe0a('0x18')],'transferercalleridname':_0x16b62d[_0xfe0a('0x19')],'transfererconnectedlinenum':_0x16b62d[_0xfe0a('0x1a')],'transfererconnectedlinename':_0x16b62d[_0xfe0a('0x1b')],'transfereraccountcode':_0x16b62d['origtransfereraccountcode'],'transferercontext':_0x16b62d[_0xfe0a('0x1c')],'transfererexten':_0x16b62d[_0xfe0a('0x1d')],'transfererlinkedid':_0x16b62d['origtransfererlinkedid'],'context':_0x16b62d[_0xfe0a('0x1e')],'extension':_0x16b62d[_0xfe0a('0x1f')],'type':_0xfe0a('0x7')});if(_[_0xfe0a('0x20')](_0x16b62d[_0xfe0a('0x21')])){_0x16b62d=_[_0xfe0a('0x22')](_0x16b62d,{'transfereechannel':_0x16b62d['transfertargetchannel'],'transfereecalleridnum':_0x16b62d[_0xfe0a('0x15')],'transfereecalleridname':_0x16b62d['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x16b62d[_0xfe0a('0x23')],'transfereeconnectedlinename':_0x16b62d[_0xfe0a('0x24')],'transfereeaccountcode':_0x16b62d[_0xfe0a('0x25')],'transfereecontext':_0x16b62d['transfertargetcontext'],'transfereeexten':_0x16b62d[_0xfe0a('0x26')],'transfereelinkedid':_0x16b62d[_0xfe0a('0x27')]});}writeDB(_0x16b62d);}catch(_0x34912e){utils['error'](util[_0xfe0a('0x4')](_0xfe0a('0x13'),_0x16b62d[_0xfe0a('0x8')]),_0x34912e);}}; \ No newline at end of file +var _0x4d88=['secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','type','attended','uniqueid','request','blindtransfer','format','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0x4d88,0x100));var _0x84d8=function(_0x3664e0,_0x1cfec0){_0x3664e0=_0x3664e0-0x0;var _0x11b14e=_0x4d88[_0x3664e0];return _0x11b14e;};'use strict';var _=require(_0x84d8('0x0'));var util=require(_0x84d8('0x1'));var utils=require('./utils');function writeDB(_0x46d8ea){utils[_0x84d8('0x2')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x46d8ea[_0x84d8('0x3')]===_0x84d8('0x4')?_0x46d8ea['origtransfereruniqueid']:_0x46d8ea[_0x84d8('0x5')],_0x46d8ea[_0x84d8('0x3')]));utils[_0x84d8('0x6')]('CreateVoiceTransferReport',_0x46d8ea);}exports[_0x84d8('0x7')]=function(_0x409791){try{utils['debug'](util[_0x84d8('0x8')](_0x84d8('0x9'),_0x409791['uniqueid']),_0x409791);utils[_0x84d8('0x2')](util[_0x84d8('0x8')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x409791[_0x84d8('0x5')],_0x409791[_0x84d8('0xa')],_0x409791[_0x84d8('0xb')],_0x409791['transfereecalleridnum'],_0x409791['transfereecalleridname']));_0x409791[_0x84d8('0x3')]=_0x84d8('0xc');writeDB(_0x409791);}catch(_0x5a3e13){utils[_0x84d8('0xd')](util[_0x84d8('0x8')](_0x84d8('0x9'),_0x409791['uniqueid']),_0x5a3e13);}};exports[_0x84d8('0xe')]=function(_0x21b4ca){try{utils['debug'](util[_0x84d8('0x8')](_0x84d8('0xf'),_0x21b4ca[_0x84d8('0x10')]),_0x21b4ca);utils['info'](util['format'](_0x84d8('0x11'),_0x21b4ca[_0x84d8('0x10')],_0x21b4ca['origtransferercalleridnum'],_0x21b4ca[_0x84d8('0x12')],_0x21b4ca[_0x84d8('0x13')],_0x21b4ca[_0x84d8('0x14')]));_0x21b4ca=_['assign'](_0x21b4ca,{'transfererchannel':_0x21b4ca['origtransfererchannel'],'transferercalleridnum':_0x21b4ca['origtransferercalleridnum'],'transferercalleridname':_0x21b4ca['origtransferercalleridname'],'transfererconnectedlinenum':_0x21b4ca['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x21b4ca[_0x84d8('0x15')],'transfereraccountcode':_0x21b4ca[_0x84d8('0x16')],'transferercontext':_0x21b4ca[_0x84d8('0x17')],'transfererexten':_0x21b4ca[_0x84d8('0x18')],'transfererlinkedid':_0x21b4ca['origtransfererlinkedid'],'context':_0x21b4ca[_0x84d8('0x19')],'extension':_0x21b4ca[_0x84d8('0x1a')],'type':'attended'});if(_[_0x84d8('0x1b')](_0x21b4ca[_0x84d8('0x1c')])){_0x21b4ca=_[_0x84d8('0x1d')](_0x21b4ca,{'transfereechannel':_0x21b4ca['transfertargetchannel'],'transfereecalleridnum':_0x21b4ca[_0x84d8('0x13')],'transfereecalleridname':_0x21b4ca[_0x84d8('0x14')],'transfereeconnectedlinenum':_0x21b4ca[_0x84d8('0x1e')],'transfereeconnectedlinename':_0x21b4ca['transfertargetconnectedlinename'],'transfereeaccountcode':_0x21b4ca[_0x84d8('0x1f')],'transfereecontext':_0x21b4ca[_0x84d8('0x20')],'transfereeexten':_0x21b4ca[_0x84d8('0x21')],'transfereelinkedid':_0x21b4ca[_0x84d8('0x22')]});}writeDB(_0x21b4ca);}catch(_0x320ce4){utils[_0x84d8('0xd')](util['format'](_0x84d8('0xf'),_0x21b4ca['origtransfereruniqueid']),_0x320ce4);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fb585db..bf268a6 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 _0xc1fa=['[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','catch','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then'];(function(_0x1deb1c,_0x2cb6be){var _0x199621=function(_0x4ced52){while(--_0x4ced52){_0x1deb1c['push'](_0x1deb1c['shift']());}};_0x199621(++_0x2cb6be);}(_0xc1fa,0x83));var _0xac1f=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xc1fa[_0x44216d];return _0xeca523;};'use strict';var BPromise=require(_0xac1f('0x0'));var jayson=require(_0xac1f('0x1'));var moment=require(_0xac1f('0x2'));var util=require(_0xac1f('0x3'));var client=jayson[_0xac1f('0x4')][_0xac1f('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0xac1f('0x6'));exports[_0xac1f('0x7')]=function(_0x22cf15,_0x271b4b){logger[_0xac1f('0x7')](_0x22cf15,_0x271b4b?util[_0xac1f('0x8')](_0x271b4b,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0x9')]=function(_0x406495,_0x306807){logger[_0xac1f('0x9')](_0x406495,_0x306807?util[_0xac1f('0x8')](_0x306807,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0xa')]=function(_0x49c4c0,_0xf701a6){logger[_0xac1f('0xa')](_0x49c4c0,_0xf701a6?util[_0xac1f('0x8')](_0xf701a6,{'showHidden':![],'depth':null}):'');};exports[_0xac1f('0xb')]=function(_0x221222,_0x50fbcb){return client['request'](_0x221222,{'body':_0x50fbcb})[_0xac1f('0xc')](function(_0x5a1bad){logger['debug'](_0xac1f('0xd'),_0x221222,_0x5a1bad?util[_0xac1f('0x8')](_0x5a1bad,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1be117){logger[_0xac1f('0xa')](_0xac1f('0xd'),_0x221222,_0x1be117?util[_0xac1f('0x8')](_0x1be117,{'showHidden':![],'depth':null}):'');});};function getUser(_0xb5005b){return client[_0xac1f('0xb')](_0xac1f('0xe'),{'options':{'raw':!![],'attributes':['id',_0xac1f('0xf'),_0xac1f('0x10'),_0xac1f('0x11')],'where':_0xb5005b,'limit':0x1}})[_0xac1f('0xc')](function(_0x2671ec){logger[_0xac1f('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xac1f('0x12')](_0xb5005b),_0x2671ec?util[_0xac1f('0x8')](_0x2671ec,{'showHidden':![],'depth':null}):'');return _0x2671ec[_0xac1f('0x13')]['length']?_0x2671ec[_0xac1f('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0xb825f3){return new BPromise(function(_0x1c5e74,_0x120b4e){if(_0xb825f3){return getUser({'internal':_0xb825f3})[_0xac1f('0xc')](function(_0x518180){logger[_0xac1f('0x7')](_0xac1f('0x14'),_0xb825f3,_0x518180?'found':_0xac1f('0x15'));return _0x1c5e74(_0x518180);})['catch'](function(_0x342495){logger[_0xac1f('0xa')](_0xac1f('0x16'),_0x342495?util[_0xac1f('0x8')](_0x342495,{'showHidden':![],'depth':null}):'');return _0x1c5e74(null);});}return _0x1c5e74(null);});};exports[_0xac1f('0x17')]=function(_0x1d1158){return new BPromise(function(_0xba5665,_0x1348e6){if(_0x1d1158){return getUser({'interface':_0x1d1158})['then'](function(_0x51180a){logger[_0xac1f('0x7')](_0xac1f('0x18'),_0x1d1158,_0x51180a?_0xac1f('0x19'):_0xac1f('0x15'));return _0xba5665(_0x51180a);})[_0xac1f('0x1a')](function(_0x2718d3){logger[_0xac1f('0xa')]('[utils][getUserByInterface]',_0x2718d3?util[_0xac1f('0x8')](_0x2718d3,{'showHidden':![],'depth':null}):'');return _0xba5665(null);});}return _0xba5665(null);});};exports[_0xac1f('0x1b')]=function(_0x2747cd){return new BPromise(function(_0x5b69ce,_0x479293){if(_0x2747cd){return getUser({'name':_0x2747cd})[_0xac1f('0xc')](function(_0x3dab27){logger[_0xac1f('0x7')](_0xac1f('0x1c'),_0x2747cd,_0x3dab27?_0xac1f('0x19'):_0xac1f('0x15'));return _0x5b69ce(_0x3dab27);})[_0xac1f('0x1a')](function(_0x2c18bb){logger[_0xac1f('0xa')]('[utils][getUserByName]',_0x2c18bb?util[_0xac1f('0x8')](_0x2c18bb,{'showHidden':![],'depth':null}):'');return _0x5b69ce(null);});}return _0x5b69ce(null);});};exports[_0xac1f('0x1d')]=function(_0x2b5116){return new BPromise(function(_0x550694,_0x537e92){if(_0x2b5116){return client[_0xac1f('0xb')](_0xac1f('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xac1f('0x10'),'type','acw',_0xac1f('0x1f')],'where':{'name':_0x2b5116},'limit':0x1}})[_0xac1f('0xc')](function(_0x3a930d){logger[_0xac1f('0x9')](_0xac1f('0x20'),_0x2b5116,_0x3a930d?util[_0xac1f('0x8')](_0x3a930d,{'showHidden':![],'depth':null}):'');logger[_0xac1f('0x7')](_0xac1f('0x21'),_0x2b5116,_0x3a930d?_0xac1f('0x19'):_0xac1f('0x15'));return _0x550694(_0x3a930d[_0xac1f('0x13')][_0xac1f('0x22')]?_0x3a930d[_0xac1f('0x13')][0x0]:null);})[_0xac1f('0x1a')](function(_0x1bb37a){logger[_0xac1f('0xa')](_0xac1f('0x23'),_0x1bb37a?util['inspect'](_0x1bb37a,{'showHidden':![],'depth':null}):'');return _0x550694(null);});}return _0x550694(null);});};exports[_0xac1f('0x24')]=function(_0x170690,_0x122c3d){return moment(_0x170690)['add'](_0x122c3d,_0xac1f('0x25'))[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x28')]=function(_0x3f7847,_0x4a8d06){return moment(_0x3f7847)[_0xac1f('0x29')](_0x4a8d06,_0xac1f('0x25'))[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x2a')]=function(_0x1e3e7e,_0x1878a5){return moment(_0x1e3e7e)[_0xac1f('0x2b')](moment(_0x1878a5),_0xac1f('0x25'));};exports[_0xac1f('0x2c')]=function(_0x1da6fe,_0xf1393c){return parseInt(_0x1da6fe,0xa)+parseInt(_0xf1393c,0xa);};exports[_0xac1f('0x2d')]=function(){return moment()[_0xac1f('0x26')](_0xac1f('0x27'));};exports[_0xac1f('0x2e')]=function(_0x4ddcd4,_0x4bebd0){if(_0x4bebd0){return moment(_0x4ddcd4)[_0xac1f('0x2e')](_0x4bebd0);}return!![];};exports[_0xac1f('0x2f')]=function(_0x5a59be,_0x5810fe){if(_0x5810fe){return moment(_0x5a59be)[_0xac1f('0x2f')](_0x5810fe);}else if(_0x5a59be){return!![];}return![];}; \ No newline at end of file +var _0xe451=['sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','request','[utils][request]\x20name:%s','error','internal','name','then','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtract','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x8a0140,_0x4a1b16){var _0x1be8a8=function(_0x3f18a9){while(--_0x3f18a9){_0x8a0140['push'](_0x8a0140['shift']());}};_0x1be8a8(++_0x4a1b16);}(_0xe451,0x94));var _0x1e45=function(_0x541c81,_0x5a2634){_0x541c81=_0x541c81-0x0;var _0x5206e2=_0xe451[_0x541c81];return _0x5206e2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1e45('0x0'));var moment=require(_0x1e45('0x1'));var util=require(_0x1e45('0x2'));var client=jayson[_0x1e45('0x3')][_0x1e45('0x4')]({'port':0x2329});var logger=require(_0x1e45('0x5'))('xdr');exports[_0x1e45('0x6')]=function(_0x3e7c28,_0x3404c4){logger['info'](_0x3e7c28,_0x3404c4?util[_0x1e45('0x7')](_0x3404c4,{'showHidden':![],'depth':null}):'');};exports[_0x1e45('0x8')]=function(_0x880ff3,_0x230c37){logger[_0x1e45('0x8')](_0x880ff3,_0x230c37?util['inspect'](_0x230c37,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3e735f,_0x1d853e){logger['error'](_0x3e735f,_0x1d853e?util[_0x1e45('0x7')](_0x1d853e,{'showHidden':![],'depth':null}):'');};exports[_0x1e45('0x9')]=function(_0x4ae816,_0x2effec){return client['request'](_0x4ae816,{'body':_0x2effec})['then'](function(_0x75ac4d){logger['debug'](_0x1e45('0xa'),_0x4ae816,_0x75ac4d?util[_0x1e45('0x7')](_0x75ac4d,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x188e66){logger[_0x1e45('0xb')]('[utils][request]\x20name:%s',_0x4ae816,_0x188e66?util[_0x1e45('0x7')](_0x188e66,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2597ef){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x1e45('0xc'),_0x1e45('0xd'),'interface'],'where':_0x2597ef,'limit':0x1}})[_0x1e45('0xe')](function(_0x1902dd){logger[_0x1e45('0x8')](_0x1e45('0xf'),JSON[_0x1e45('0x10')](_0x2597ef),_0x1902dd?util[_0x1e45('0x7')](_0x1902dd,{'showHidden':![],'depth':null}):'');return _0x1902dd[_0x1e45('0x11')][_0x1e45('0x12')]?_0x1902dd[_0x1e45('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x37138d){return new BPromise(function(_0xae7af7,_0x5f52a5){if(_0x37138d){return getUser({'internal':_0x37138d})['then'](function(_0x1f14a1){logger[_0x1e45('0x6')](_0x1e45('0x13'),_0x37138d,_0x1f14a1?'found':_0x1e45('0x14'));return _0xae7af7(_0x1f14a1);})['catch'](function(_0x45e537){logger[_0x1e45('0xb')](_0x1e45('0x15'),_0x45e537?util[_0x1e45('0x7')](_0x45e537,{'showHidden':![],'depth':null}):'');return _0xae7af7(null);});}return _0xae7af7(null);});};exports['getUserByInterface']=function(_0xedeeab){return new BPromise(function(_0x3f91c7,_0x47cd4f){if(_0xedeeab){return getUser({'interface':_0xedeeab})[_0x1e45('0xe')](function(_0x4fcad5){logger['info'](_0x1e45('0x16'),_0xedeeab,_0x4fcad5?_0x1e45('0x17'):_0x1e45('0x14'));return _0x3f91c7(_0x4fcad5);})[_0x1e45('0x18')](function(_0x4cf5f7){logger[_0x1e45('0xb')](_0x1e45('0x19'),_0x4cf5f7?util[_0x1e45('0x7')](_0x4cf5f7,{'showHidden':![],'depth':null}):'');return _0x3f91c7(null);});}return _0x3f91c7(null);});};exports[_0x1e45('0x1a')]=function(_0x5cd2e5){return new BPromise(function(_0xf7731c,_0x171039){if(_0x5cd2e5){return getUser({'name':_0x5cd2e5})[_0x1e45('0xe')](function(_0x40cbd2){logger['info'](_0x1e45('0x1b'),_0x5cd2e5,_0x40cbd2?_0x1e45('0x17'):_0x1e45('0x14'));return _0xf7731c(_0x40cbd2);})[_0x1e45('0x18')](function(_0x9c3b8c){logger[_0x1e45('0xb')](_0x1e45('0x1c'),_0x9c3b8c?util[_0x1e45('0x7')](_0x9c3b8c,{'showHidden':![],'depth':null}):'');return _0xf7731c(null);});}return _0xf7731c(null);});};exports[_0x1e45('0x1d')]=function(_0x18ef66){return new BPromise(function(_0x581c51,_0x4d7c87){if(_0x18ef66){return client[_0x1e45('0x9')](_0x1e45('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x1e45('0xd'),_0x1e45('0x1f'),_0x1e45('0x20'),_0x1e45('0x21')],'where':{'name':_0x18ef66},'limit':0x1}})[_0x1e45('0xe')](function(_0x264d81){logger[_0x1e45('0x8')](_0x1e45('0x22'),_0x18ef66,_0x264d81?util[_0x1e45('0x7')](_0x264d81,{'showHidden':![],'depth':null}):'');logger['info'](_0x1e45('0x23'),_0x18ef66,_0x264d81?_0x1e45('0x17'):_0x1e45('0x14'));return _0x581c51(_0x264d81[_0x1e45('0x11')][_0x1e45('0x12')]?_0x264d81[_0x1e45('0x11')][0x0]:null);})['catch'](function(_0x2e291b){logger['error'](_0x1e45('0x24'),_0x2e291b?util[_0x1e45('0x7')](_0x2e291b,{'showHidden':![],'depth':null}):'');return _0x581c51(null);});}return _0x581c51(null);});};exports[_0x1e45('0x25')]=function(_0x47b1c8,_0x57449b){return moment(_0x47b1c8)[_0x1e45('0x26')](_0x57449b,_0x1e45('0x27'))[_0x1e45('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x507bb8,_0x2ea2d8){return moment(_0x507bb8)[_0x1e45('0x29')](_0x2ea2d8,_0x1e45('0x27'))[_0x1e45('0x28')](_0x1e45('0x2a'));};exports['diffTime']=function(_0xa7d71b,_0x5237e7){return moment(_0xa7d71b)[_0x1e45('0x2b')](moment(_0x5237e7),_0x1e45('0x27'));};exports[_0x1e45('0x2c')]=function(_0x3c5302,_0x12cd8b){return parseInt(_0x3c5302,0xa)+parseInt(_0x12cd8b,0xa);};exports[_0x1e45('0x2d')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1e45('0x2e')]=function(_0x34183d,_0x23683f){if(_0x23683f){return moment(_0x34183d)[_0x1e45('0x2e')](_0x23683f);}return!![];};exports['isBefore']=function(_0x1286f5,_0x20b371){if(_0x20b371){return moment(_0x1286f5)[_0x1e45('0x2f')](_0x20b371);}else if(_0x1286f5){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 fb15d82..2d6a0f4 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 _0xceac=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','method','statusCode','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','log','join','client','ensureDir','catch','user','then','data','timestamp','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','x-forwarded-for','headers','connection','remoteAddress','url','responseTime','name','role','inspect'];(function(_0x27d72e,_0x3bd77e){var _0xc33f0b=function(_0x58a99f){while(--_0x58a99f){_0x27d72e['push'](_0x27d72e['shift']());}};_0xc33f0b(++_0x3bd77e);}(_0xceac,0xeb));var _0xccea=function(_0x2bdb91,_0x22518c){_0x2bdb91=_0x2bdb91-0x0;var _0x2163f9=_0xceac[_0x2bdb91];return _0x2163f9;};var fs=require(_0xccea('0x0'));var _=require(_0xccea('0x1'));var ewinston=require(_0xccea('0x2'));var path=require('path');var util=require(_0xccea('0x3'));var fileLogger=require(_0xccea('0x4'))[_0xccea('0x5')];var safeTemplate=require(_0xccea('0x6'))[_0xccea('0x7')];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x330c33(_0x562e1c){var _0xfc2846=path['join']('/var',_0xccea('0x8'),'xcally');var _0x3ef578=path[_0xccea('0x9')](_0xccea('0xa'),_0x562e1c['role']+'-'+_0x562e1c['name']);return fs[_0xccea('0xb')](path[_0xccea('0x9')](_0xfc2846,_0x3ef578))['then'](function(){var _0x1f4d59=fileLogger(_0xccea('0xa'),path[_0xccea('0x9')](_0xfc2846,_0x3ef578));return _0x1f4d59;})[_0xccea('0xc')](function(_0x28e69d){throw _0x28e69d;});}this[_0xccea('0x8')]=function(_0x3a9d33,_0x54c805,_0x2027b1,_0x2e9562){return _0x330c33(_0x3a9d33[_0xccea('0xd')])[_0xccea('0xe')](function(_0x527441){var _0x2e82cb=_0x527441[_0x54c805];return _0x2e82cb;})[_0xccea('0xe')](function(_0x6b244d){var _0x24aa53=_0x3a9d33[_0xccea('0xd')]?_0x3a9d33[_0xccea('0xd')]['id']:'no-user';var _0x32b21d=_0x2e9562[_0xccea('0xf')];var _0x210686=_0x2e9562[_0xccea('0x10')];var _0xe41ea8=new Date(Number(_0x210686));return _0x6b244d(_0x24aa53,_0xe41ea8,_0x2027b1,_0x32b21d);})['catch'](function(_0x600939){fileLogger('client')['error'](_0x600939);});};}function setupLoggers(_0x4217a0){return new Promise(function(_0xb13265){var _0x79b607=new ClientSideLogger();var _0xa83bd5=fileLogger(_0xccea('0x11'));var _0x28ac3f=fileLogger(_0xccea('0x12'));_0x4217a0['set'](_0xccea('0x13'),_0x79b607);_0x4217a0[_0xccea('0x14')](ewinston[_0xccea('0x15')]({'winstonInstance':_0xa83bd5,'meta':![],'statusLevels':!![],'msg':function(_0x2ac028,_0x107063){var _0x5cbeed=_0xccea('0x16');if(!_[_0xccea('0x17')](_0x2ac028['body'])){_0x5cbeed+=_0xccea('0x18');var _0x403540=_0x2ac028[_0xccea('0x19')];maskSensitiveData(_0x403540);}return safeTemplate(util['format'](_0x5cbeed,_0x2ac028['method'],_0x2ac028['headers'][_0xccea('0x1a')]?_0x2ac028[_0xccea('0x1b')][_0xccea('0x1a')]:_0x2ac028[_0xccea('0x1c')][_0xccea('0x1d')]||_0x2ac028['ip'],_0x2ac028[_0xccea('0x1e')],_0x107063['statusCode'],_0x107063[_0xccea('0x1f')],_0x2ac028['user']?_0x2ac028[_0xccea('0xd')]['id']:null,_0x2ac028[_0xccea('0xd')]?_0x2ac028['user'][_0xccea('0x20')]:null,_0x2ac028[_0xccea('0xd')]?_0x2ac028[_0xccea('0xd')][_0xccea('0x21')]:null,_0x403540?util[_0xccea('0x22')](_0x403540,![],null):''));}}));_0x4217a0[_0xccea('0x14')](ewinston[_0xccea('0x15')]({'winstonInstance':_0x28ac3f,'meta':![],'statusLevels':!![],'msg':function(_0x23bcd5,_0x25e5b5){var _0x38e0a8=_0xccea('0x23');if(_0x23bcd5['body']&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]&&_0x23bcd5['body'][_0xccea('0x25')]){_0x38e0a8='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xccea('0x26')](_0x38e0a8,_0x23bcd5[_0xccea('0x27')],_0x23bcd5[_0xccea('0x1b')]['x-forwarded-for']?_0x23bcd5[_0xccea('0x1b')][_0xccea('0x1a')]:_0x23bcd5[_0xccea('0x1c')]['remoteAddress']||_0x23bcd5['ip'],_0x23bcd5[_0xccea('0x1e')],_0x25e5b5[_0xccea('0x28')],_0x25e5b5[_0xccea('0x1f')],_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')]['id']:null,_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')][_0xccea('0x20')]:null,_0x23bcd5[_0xccea('0xd')]?_0x23bcd5[_0xccea('0xd')]['role']:null,_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]?_0x23bcd5[_0xccea('0x19')][_0xccea('0x24')]:_0xccea('0x29'),_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5['body'][_0xccea('0x25')]?_0x23bcd5['body'][_0xccea('0x25')]:'',_0x23bcd5[_0xccea('0x19')]&&_0x23bcd5[_0xccea('0x19')][_0xccea('0x2a')]?_0x23bcd5[_0xccea('0x19')]['agent_name']:'');},'ignoreRoute':function(_0x18cd8c){var _0x32f73f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x32f73f[_0xccea('0x2b')](_0x18cd8c[_0xccea('0x1e')]);}}));return _0xb13265();});}exports[_0xccea('0x2c')]=setupLoggers; \ No newline at end of file +var _0x6bc4=['user','no-user','data','timestamp','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','log','xcally','join','role','name','ensureDir','client','catch','then'];(function(_0x5c01af,_0x1ab6f8){var _0x51299b=function(_0xd7163e){while(--_0xd7163e){_0x5c01af['push'](_0x5c01af['shift']());}};_0x51299b(++_0x1ab6f8);}(_0x6bc4,0x102));var _0x46bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6bc4[_0x3dd15e];return _0x231fd0;};var fs=require(_0x46bc('0x0'));var _=require(_0x46bc('0x1'));var ewinston=require(_0x46bc('0x2'));var path=require('path');var util=require(_0x46bc('0x3'));var fileLogger=require('./loggers')[_0x46bc('0x4')];var safeTemplate=require(_0x46bc('0x5'))[_0x46bc('0x6')];var maskSensitiveData=require(_0x46bc('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x2cf4af(_0x534bc9){var _0x24549b=path['join'](_0x46bc('0x8'),_0x46bc('0x9'),_0x46bc('0xa'));var _0x8c204e=path[_0x46bc('0xb')]('client',_0x534bc9[_0x46bc('0xc')]+'-'+_0x534bc9[_0x46bc('0xd')]);return fs[_0x46bc('0xe')](path[_0x46bc('0xb')](_0x24549b,_0x8c204e))['then'](function(){var _0x518748=fileLogger(_0x46bc('0xf'),path[_0x46bc('0xb')](_0x24549b,_0x8c204e));return _0x518748;})[_0x46bc('0x10')](function(_0x27724c){throw _0x27724c;});}this[_0x46bc('0x9')]=function(_0x5f5255,_0x4a5296,_0x34bc25,_0xa2a26c){return _0x2cf4af(_0x5f5255['user'])[_0x46bc('0x11')](function(_0x9627af){var _0x5ea3c1=_0x9627af[_0x4a5296];return _0x5ea3c1;})[_0x46bc('0x11')](function(_0x1c12f3){var _0x177853=_0x5f5255[_0x46bc('0x12')]?_0x5f5255[_0x46bc('0x12')]['id']:_0x46bc('0x13');var _0x249e62=_0xa2a26c[_0x46bc('0x14')];var _0x564f9e=_0xa2a26c[_0x46bc('0x15')];var _0x4de41f=new Date(Number(_0x564f9e));return _0x1c12f3(_0x177853,_0x4de41f,_0x34bc25,_0x249e62);})[_0x46bc('0x10')](function(_0x362ffa){fileLogger(_0x46bc('0xf'))['error'](_0x362ffa);});};}function setupLoggers(_0x4d8cdb){return new Promise(function(_0x12e1ca){var _0xb7a66f=new ClientSideLogger();var _0x478137=fileLogger(_0x46bc('0x16'));var _0x3cfe19=fileLogger(_0x46bc('0x17'));_0x4d8cdb[_0x46bc('0x18')](_0x46bc('0x19'),_0xb7a66f);_0x4d8cdb['use'](ewinston[_0x46bc('0x1a')]({'winstonInstance':_0x478137,'meta':![],'statusLevels':!![],'msg':function(_0x50933c,_0x239d38){var _0x572035=_0x46bc('0x1b');if(!_[_0x46bc('0x1c')](_0x50933c[_0x46bc('0x1d')])){_0x572035+=_0x46bc('0x1e');var _0x37cf06=_0x50933c['body'];maskSensitiveData(_0x37cf06);}return safeTemplate(util[_0x46bc('0x1f')](_0x572035,_0x50933c[_0x46bc('0x20')],_0x50933c[_0x46bc('0x21')]['x-forwarded-for']?_0x50933c[_0x46bc('0x21')][_0x46bc('0x22')]:_0x50933c['connection'][_0x46bc('0x23')]||_0x50933c['ip'],_0x50933c[_0x46bc('0x24')],_0x239d38['statusCode'],_0x239d38['responseTime'],_0x50933c['user']?_0x50933c[_0x46bc('0x12')]['id']:null,_0x50933c[_0x46bc('0x12')]?_0x50933c['user'][_0x46bc('0xd')]:null,_0x50933c[_0x46bc('0x12')]?_0x50933c[_0x46bc('0x12')][_0x46bc('0xc')]:null,_0x37cf06?util[_0x46bc('0x25')](_0x37cf06,![],null):''));}}));_0x4d8cdb['use'](ewinston['logger']({'winstonInstance':_0x3cfe19,'meta':![],'statusLevels':!![],'msg':function(_0x303bf3,_0x4e9efa){var _0x4cfdbc=_0x46bc('0x26');if(_0x303bf3[_0x46bc('0x1d')]&&_0x303bf3[_0x46bc('0x1d')][_0x46bc('0x27')]&&_0x303bf3[_0x46bc('0x1d')]['agent_id']){_0x4cfdbc=_0x46bc('0x28');}return util[_0x46bc('0x1f')](_0x4cfdbc,_0x303bf3[_0x46bc('0x20')],_0x303bf3['headers']['x-forwarded-for']?_0x303bf3[_0x46bc('0x21')][_0x46bc('0x22')]:_0x303bf3['connection'][_0x46bc('0x23')]||_0x303bf3['ip'],_0x303bf3[_0x46bc('0x24')],_0x4e9efa[_0x46bc('0x29')],_0x4e9efa['responseTime'],_0x303bf3[_0x46bc('0x12')]?_0x303bf3[_0x46bc('0x12')]['id']:null,_0x303bf3[_0x46bc('0x12')]?_0x303bf3[_0x46bc('0x12')][_0x46bc('0xd')]:null,_0x303bf3['user']?_0x303bf3[_0x46bc('0x12')][_0x46bc('0xc')]:null,_0x303bf3[_0x46bc('0x1d')]&&_0x303bf3[_0x46bc('0x1d')][_0x46bc('0x27')]?_0x303bf3['body']['device']:'other',_0x303bf3[_0x46bc('0x1d')]&&_0x303bf3['body'][_0x46bc('0x2a')]?_0x303bf3[_0x46bc('0x1d')]['agent_id']:'',_0x303bf3[_0x46bc('0x1d')]&&_0x303bf3['body'][_0x46bc('0x2b')]?_0x303bf3[_0x46bc('0x1d')][_0x46bc('0x2b')]:'');},'ignoreRoute':function(_0x5c570c){var _0x12c367=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x12c367[_0x46bc('0x2c')](_0x5c570c['url']);}}));return _0x12e1ca();});}exports[_0x46bc('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index f77cfa3..b11c247 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x215f=['monthCompare','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x215f,0x18b));var _0xf215=function(_0x11bf10,_0x3d2485){_0x11bf10=_0x11bf10-0x0;var _0x4c7a2c=_0x215f[_0x11bf10];return _0x4c7a2c;};var _=require(_0xf215('0x0'));var moment=require(_0xf215('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][_0xf215('0x2')](function(_0x14640f){return _0x14640f[_0xf215('0x3')];})[_0xf215('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xf215('0x5');var EINVALID_DATE=_0xf215('0x6');function throwIfDateNotValid(_0x4837f2){if(!_0x4837f2[_0xf215('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x11b1db){var _0x1d9d70=_0x11b1db[_0xf215('0x8')](':')[_0xf215('0x2')](function(_0x494215){return parseInt(_0x494215,0xa);});var _0x1843ca=_0x1d9d70[0x0];var _0x5b9180=_0x1d9d70[0x1];if(_0x1843ca<0x0||_0x1843ca>0x17||_0x5b9180<0x0||_0x5b9180>0x3b){throw new Error(EINVALID_DATE);}return[_0x1843ca,_0x5b9180];}function circularDoWInterval(_0x23a348,_0xe37fe){if(_0x23a348===_0xe37fe){return[_0x23a348];}else{var _0x2e544f=moment[_0xf215('0x9')]();moment[_0xf215('0x9')]('en');var _0x27580d=moment[_0xf215('0xa')]()[_0xf215('0x2')](function(_0x53979f){return _0x53979f[_0xf215('0xb')]();});moment[_0xf215('0x9')](_0x2e544f);var _0x1d8748=_0x27580d[_0xf215('0xc')](_0x23a348);var _0x4a6e9b=_0x27580d[_0xf215('0xc')](_0xe37fe);if(_0x4a6e9b>_0x1d8748){return _0x27580d[_0xf215('0xd')](_0x1d8748,_0x4a6e9b+0x1);}else{var _0x644795=_0x27580d[_0xf215('0xd')](0x0,_0x4a6e9b+0x1);var _0x9b78bc=_0x27580d[_0xf215('0xd')](_0x1d8748);return _0x9b78bc[_0xf215('0xe')](_0x644795);}}}module[_0xf215('0xf')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1cfbb5,_0x5b2d1d){if(_0x1cfbb5===_0x5b2d1d){return[_0x1cfbb5];}else{var _0x555adb=moment[_0xf215('0x9')]();moment[_0xf215('0x9')]('en');var _0x556de7=moment[_0xf215('0x10')]()[_0xf215('0x2')](function(_0x5503ca){return _0x5503ca[_0xf215('0xb')]();});moment[_0xf215('0x9')](_0x555adb);var _0x3c869b=_0x556de7['indexOf'](_0x1cfbb5);var _0x489e87=_0x556de7[_0xf215('0xc')](_0x5b2d1d);if(_0x489e87>_0x3c869b){return _0x556de7['slice'](_0x3c869b,_0x489e87+0x1);}else{var _0x13e5f4=_0x556de7['slice'](0x0,_0x489e87+0x1);var _0x24378f=_0x556de7[_0xf215('0xd')](_0x3c869b);return _0x24378f[_0xf215('0xe')](_0x13e5f4);}}}module[_0xf215('0xf')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x11b874){var _0x2b5256=parseInt(_0x11b874,0xa);if(_0x2b5256<0x1||_0x2b5256>0x1f){throw new Error(EINVALID_DATE);}return _0x2b5256;}function timeCompare(_0xf9e6ef,_0x545975,_0x4526ba){var _0x3b60f3=_0xf9e6ef[_0xf215('0x11')]();var _0x2fa99e=extractTime(_0x545975);var _0x9a83c7=_0x2fa99e[0x0];var _0x1f3dd6=_0x2fa99e[0x1];var _0x2cd36d=_0xf9e6ef[_0xf215('0x11')]()[_0xf215('0x12')](_0x9a83c7)[_0xf215('0x13')](_0x1f3dd6);throwIfDateNotValid(_0x2cd36d);var _0x41632f=extractTime(_0x4526ba);var _0x23990f=_0x41632f[0x0];var _0x1ad070=_0x41632f[0x1];var _0xcb159e=_0xf9e6ef[_0xf215('0x11')]()['hours'](_0x23990f)[_0xf215('0x13')](_0x1ad070);throwIfDateNotValid(_0xcb159e);if(_0xcb159e[_0xf215('0x14')](_0x2cd36d)){var _0x35c977=_0x3b60f3[_0xf215('0x11')]()[_0xf215('0x15')](_0xf215('0x16'));var _0x24e207=_0x3b60f3[_0xf215('0x11')]()[_0xf215('0x17')]('day');return _0x3b60f3[_0xf215('0x18')](_0x2cd36d,_0x24e207,undefined,'[]')||_0x3b60f3['isBetween'](_0x35c977,_0xcb159e,undefined,'[]');}else{return _0x3b60f3['isBetween'](_0x2cd36d,_0xcb159e,undefined,'[]');}}module['exports']['timeCompare']=timeCompare;function dowCompare(_0x2bdce8,_0x461979,_0x3719f6){var _0x1a7830=_0x2bdce8[_0xf215('0x9')]('en')[_0xf215('0x19')]('ddd')[_0xf215('0xb')]();return circularDoWInterval(_0x461979,_0x3719f6)['includes'](_0x1a7830);}module[_0xf215('0xf')][_0xf215('0x1a')]=dowCompare;function domCompare(_0x5e822f,_0x1ae88e,_0x122029){var _0x2f740d=_0x5e822f[_0xf215('0x1b')]();if(_0x1ae88e===_0x122029){return _0x2f740d===_0x1ae88e;}else{var _0x1269b1=_0x5e822f[_0xf215('0x1c')]();var _0x30fc53=_0x1ae88e<_0x122029;let _0x192f1d=![];var _0x3b5de9=0x0;var _0x29962d=0x0;if(_0x30fc53){_0x3b5de9=Math[_0xf215('0x1d')](0x1,_0x1ae88e);_0x29962d=Math['min'](_0x122029,_0x1269b1);_0x192f1d=_0x2f740d>=_0x3b5de9&&_0x2f740d<=_0x29962d;}else{_0x3b5de9=Math[_0xf215('0x1e')](_0x1ae88e,_0x1269b1);_0x29962d=Math[_0xf215('0x1d')](0x1,_0x122029);_0x192f1d=_0x2f740d>=_0x3b5de9||_0x2f740d<=_0x29962d;}return _0x192f1d;}}module['exports'][_0xf215('0x1f')]=domCompare;function monthCompare(_0x46eaad,_0xe787c3,_0x52c652){var _0x3d0f06=_0x46eaad['locale']('en')[_0xf215('0x19')](_0xf215('0x20'))[_0xf215('0xb')]();return circularMonthInterval(_0xe787c3,_0x52c652)[_0xf215('0x21')](_0x3d0f06);}module['exports'][_0xf215('0x22')]=monthCompare;function iftime(_0x382fb9,_0x26dede=moment['tz']['guess'](),_0x3b37db=moment()){if(!validateRx['test'](_0x382fb9)){throw new Error(EINVALID_STRING);}else{var _0x283146=(moment[_0xf215('0x23')](_0x3b37db)?_0x3b37db['clone']():moment(_0x3b37db))['tz'](_0x26dede)['locale']('en');throwIfDateNotValid(_0x283146);var _0x173fb8=_0x382fb9['split'](',');var _0x5409bd=_0x173fb8[0x0];var _0xcda6e0=_0x173fb8[0x1];var _0x3d18e6=_0x173fb8[0x2];var _0xf3ed07=_0x173fb8[0x3];let _0x2d80b9=!![];if(_0x5409bd!=='*'){var _0x21d4d9=_0x5409bd['split']('-');var _0x5aed64=_[_0xf215('0x24')](_0x21d4d9[0x0],0x5,'0');var _0x1acb72=_0x21d4d9[_0xf215('0x25')]===0x2?_[_0xf215('0x24')](_0x21d4d9[0x1],0x5,'0'):_0x5aed64;_0x2d80b9=timeCompare(_0x283146,_0x5aed64,_0x1acb72);}let _0x3f3ef6=!![];if(_0xcda6e0!=='*'){var _0x1341fb=_0xcda6e0[_0xf215('0x8')]('-');var _0x3aa4a6=_0x1341fb[0x0];var _0x1c2917=_0x1341fb[_0xf215('0x25')]===0x2?_0x1341fb[0x1]:_0x3aa4a6;_0x3f3ef6=dowCompare(_0x283146,_0x3aa4a6,_0x1c2917);}let _0x79abe2=!![];if(_0x3d18e6!=='*'){var _0x585140=_0x3d18e6[_0xf215('0x8')]('-');var _0x4ff834=parseDom(_0x585140[0x0]);var _0x8e1c97=_0x585140[_0xf215('0x25')]===0x2?parseDom(_0x585140[0x1]):_0x4ff834;_0x79abe2=domCompare(_0x283146,_0x4ff834,_0x8e1c97);}let _0x32378e=!![];if(_0xf3ed07!=='*'){var _0x52069d=_0xf3ed07[_0xf215('0x8')]('-');var _0x4c71c2=_0x52069d[0x0];var _0x3cfa8d=_0x52069d['length']===0x2?_0x52069d[0x1]:_0x52069d[0x0];_0x32378e=monthCompare(_0x283146,_0x4c71c2,_0x3cfa8d);}return _0x2d80b9&&_0x3f3ef6&&_0x79abe2&&_0x32378e;}}module[_0xf215('0xf')][_0xf215('0x26')]=iftime; \ No newline at end of file +var _0xd536=['max','min','domCompare','MMM','includes','monthCompare','guess','split','length','padStart','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','endOf','day','timeCompare','format','ddd','daysInMonth'];(function(_0x14bf84,_0x5da235){var _0x1cc30c=function(_0x1965ad){while(--_0x1965ad){_0x14bf84['push'](_0x14bf84['shift']());}};_0x1cc30c(++_0x5da235);}(_0xd536,0x18b));var _0x6d53=function(_0x1214e6,_0x42ea35){_0x1214e6=_0x1214e6-0x0;var _0x5326d7=_0xd536[_0x1214e6];return _0x5326d7;};var _=require(_0x6d53('0x0'));var moment=require(_0x6d53('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]['map'](function(_0x2b969f){return _0x2b969f[_0x6d53('0x2')];})[_0x6d53('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6d53('0x4');var EINVALID_DATE=_0x6d53('0x5');function throwIfDateNotValid(_0x3d5b52){if(!_0x3d5b52['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x2d1910){var _0x5b740c=_0x2d1910['split'](':')[_0x6d53('0x6')](function(_0xa838a1){return parseInt(_0xa838a1,0xa);});var _0x4ca398=_0x5b740c[0x0];var _0x54bd78=_0x5b740c[0x1];if(_0x4ca398<0x0||_0x4ca398>0x17||_0x54bd78<0x0||_0x54bd78>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ca398,_0x54bd78];}function circularDoWInterval(_0x4f30ae,_0x326e2a){if(_0x4f30ae===_0x326e2a){return[_0x4f30ae];}else{var _0xc8290d=moment[_0x6d53('0x7')]();moment['locale']('en');var _0x46c4d8=moment['weekdaysShort']()[_0x6d53('0x6')](function(_0x244765){return _0x244765[_0x6d53('0x8')]();});moment['locale'](_0xc8290d);var _0x3fafbe=_0x46c4d8['indexOf'](_0x4f30ae);var _0x2b3891=_0x46c4d8[_0x6d53('0x9')](_0x326e2a);if(_0x2b3891>_0x3fafbe){return _0x46c4d8[_0x6d53('0xa')](_0x3fafbe,_0x2b3891+0x1);}else{var _0x195d62=_0x46c4d8[_0x6d53('0xa')](0x0,_0x2b3891+0x1);var _0x5c9712=_0x46c4d8[_0x6d53('0xa')](_0x3fafbe);return _0x5c9712[_0x6d53('0xb')](_0x195d62);}}}module[_0x6d53('0xc')][_0x6d53('0xd')]=circularDoWInterval;function circularMonthInterval(_0x10c3d5,_0x32e509){if(_0x10c3d5===_0x32e509){return[_0x10c3d5];}else{var _0x647fd8=moment[_0x6d53('0x7')]();moment[_0x6d53('0x7')]('en');var _0xbc3d82=moment[_0x6d53('0xe')]()['map'](function(_0x1db659){return _0x1db659[_0x6d53('0x8')]();});moment[_0x6d53('0x7')](_0x647fd8);var _0x113c1c=_0xbc3d82['indexOf'](_0x10c3d5);var _0x2fd642=_0xbc3d82[_0x6d53('0x9')](_0x32e509);if(_0x2fd642>_0x113c1c){return _0xbc3d82[_0x6d53('0xa')](_0x113c1c,_0x2fd642+0x1);}else{var _0x11f654=_0xbc3d82[_0x6d53('0xa')](0x0,_0x2fd642+0x1);var _0x4a2e2f=_0xbc3d82[_0x6d53('0xa')](_0x113c1c);return _0x4a2e2f[_0x6d53('0xb')](_0x11f654);}}}module[_0x6d53('0xc')][_0x6d53('0xf')]=circularMonthInterval;function parseDom(_0x1ec393){var _0x4346cb=parseInt(_0x1ec393,0xa);if(_0x4346cb<0x1||_0x4346cb>0x1f){throw new Error(EINVALID_DATE);}return _0x4346cb;}function timeCompare(_0x1ee8d5,_0x17cdfe,_0x20deef){var _0x2b0640=_0x1ee8d5[_0x6d53('0x10')]();var _0x13dd08=extractTime(_0x17cdfe);var _0xe581ac=_0x13dd08[0x0];var _0x3489f2=_0x13dd08[0x1];var _0x25b207=_0x1ee8d5[_0x6d53('0x10')]()[_0x6d53('0x11')](_0xe581ac)['minutes'](_0x3489f2);throwIfDateNotValid(_0x25b207);var _0x4e2f43=extractTime(_0x20deef);var _0x3baa1f=_0x4e2f43[0x0];var _0x17113b=_0x4e2f43[0x1];var _0x5823d1=_0x1ee8d5[_0x6d53('0x10')]()[_0x6d53('0x11')](_0x3baa1f)[_0x6d53('0x12')](_0x17113b);throwIfDateNotValid(_0x5823d1);if(_0x5823d1['isBefore'](_0x25b207)){var _0x3f5b40=_0x2b0640[_0x6d53('0x10')]()['startOf']('day');var _0x43d8cc=_0x2b0640['clone']()[_0x6d53('0x13')](_0x6d53('0x14'));return _0x2b0640['isBetween'](_0x25b207,_0x43d8cc,undefined,'[]')||_0x2b0640['isBetween'](_0x3f5b40,_0x5823d1,undefined,'[]');}else{return _0x2b0640['isBetween'](_0x25b207,_0x5823d1,undefined,'[]');}}module[_0x6d53('0xc')][_0x6d53('0x15')]=timeCompare;function dowCompare(_0x31a72e,_0x418d80,_0x539f90){var _0x31280a=_0x31a72e[_0x6d53('0x7')]('en')[_0x6d53('0x16')](_0x6d53('0x17'))[_0x6d53('0x8')]();return circularDoWInterval(_0x418d80,_0x539f90)['includes'](_0x31280a);}module[_0x6d53('0xc')]['dowCompare']=dowCompare;function domCompare(_0x1a317e,_0x358f2c,_0x107924){var _0x30ce66=_0x1a317e['date']();if(_0x358f2c===_0x107924){return _0x30ce66===_0x358f2c;}else{var _0x482df7=_0x1a317e[_0x6d53('0x18')]();var _0x48f0ab=_0x358f2c<_0x107924;let _0x17e390=![];var _0xe6dd6b=0x0;var _0x52d9f9=0x0;if(_0x48f0ab){_0xe6dd6b=Math[_0x6d53('0x19')](0x1,_0x358f2c);_0x52d9f9=Math[_0x6d53('0x1a')](_0x107924,_0x482df7);_0x17e390=_0x30ce66>=_0xe6dd6b&&_0x30ce66<=_0x52d9f9;}else{_0xe6dd6b=Math[_0x6d53('0x1a')](_0x358f2c,_0x482df7);_0x52d9f9=Math[_0x6d53('0x19')](0x1,_0x107924);_0x17e390=_0x30ce66>=_0xe6dd6b||_0x30ce66<=_0x52d9f9;}return _0x17e390;}}module[_0x6d53('0xc')][_0x6d53('0x1b')]=domCompare;function monthCompare(_0x3e1813,_0x2ef4d6,_0x36ff94){var _0x3d036c=_0x3e1813[_0x6d53('0x7')]('en')['format'](_0x6d53('0x1c'))[_0x6d53('0x8')]();return circularMonthInterval(_0x2ef4d6,_0x36ff94)[_0x6d53('0x1d')](_0x3d036c);}module['exports'][_0x6d53('0x1e')]=monthCompare;function iftime(_0x226e18,_0x55fc74=moment['tz'][_0x6d53('0x1f')](),_0x150db0=moment()){if(!validateRx['test'](_0x226e18)){throw new Error(EINVALID_STRING);}else{var _0x185431=(moment['isMoment'](_0x150db0)?_0x150db0[_0x6d53('0x10')]():moment(_0x150db0))['tz'](_0x55fc74)[_0x6d53('0x7')]('en');throwIfDateNotValid(_0x185431);var _0x40514b=_0x226e18['split'](',');var _0x33e046=_0x40514b[0x0];var _0x57b13e=_0x40514b[0x1];var _0x4214a0=_0x40514b[0x2];var _0x1f3e9d=_0x40514b[0x3];let _0x210d2f=!![];if(_0x33e046!=='*'){var _0x2a1545=_0x33e046[_0x6d53('0x20')]('-');var _0x1d020f=_['padStart'](_0x2a1545[0x0],0x5,'0');var _0xb54fa7=_0x2a1545[_0x6d53('0x21')]===0x2?_[_0x6d53('0x22')](_0x2a1545[0x1],0x5,'0'):_0x1d020f;_0x210d2f=timeCompare(_0x185431,_0x1d020f,_0xb54fa7);}let _0x597eb1=!![];if(_0x57b13e!=='*'){var _0x3bf7c1=_0x57b13e[_0x6d53('0x20')]('-');var _0x49011b=_0x3bf7c1[0x0];var _0x9a4f0d=_0x3bf7c1[_0x6d53('0x21')]===0x2?_0x3bf7c1[0x1]:_0x49011b;_0x597eb1=dowCompare(_0x185431,_0x49011b,_0x9a4f0d);}let _0x3a7cc7=!![];if(_0x4214a0!=='*'){var _0x20498b=_0x4214a0[_0x6d53('0x20')]('-');var _0x454ac8=parseDom(_0x20498b[0x0]);var _0x166cc5=_0x20498b[_0x6d53('0x21')]===0x2?parseDom(_0x20498b[0x1]):_0x454ac8;_0x3a7cc7=domCompare(_0x185431,_0x454ac8,_0x166cc5);}let _0x3f0907=!![];if(_0x1f3e9d!=='*'){var _0x5e4f77=_0x1f3e9d[_0x6d53('0x20')]('-');var _0x34e7ad=_0x5e4f77[0x0];var _0x13b1a0=_0x5e4f77[_0x6d53('0x21')]===0x2?_0x5e4f77[0x1]:_0x5e4f77[0x0];_0x3f0907=monthCompare(_0x185431,_0x34e7ad,_0x13b1a0);}return _0x210d2f&&_0x597eb1&&_0x3a7cc7&&_0x3f0907;}}module[_0x6d53('0xc')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index e33b4e6..7833bc8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf95=['bold\x20blue','bold\x20cyan','addColors','format','%s-%s.log','message','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','meta','keys','length','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','transports','Console','File','%s-%s','error','warn','consoleLogger','fileLogger','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','bold\x20magenta'];(function(_0x46a2b4,_0x57e4e3){var _0x4e3f71=function(_0x1cf628){while(--_0x1cf628){_0x46a2b4['push'](_0x46a2b4['shift']());}};_0x4e3f71(++_0x57e4e3);}(_0xdf95,0x15c));var _0x5df9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xdf95[_0x15bc81];return _0x59440e;};'use strict';var path=require('path');var util=require(_0x5df9('0x0'));var moment=require(_0x5df9('0x1'));var winston=require(_0x5df9('0x2'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x5df9('0x3')][_0x5df9('0x4')]():_0x5df9('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5df9('0x6'),'error':_0x5df9('0x7'),'warn':_0x5df9('0x8'),'info':'white','print':_0x5df9('0x9'),'success':_0x5df9('0xa'),'http':'gray','verbose':_0x5df9('0xb'),'debug':_0x5df9('0xc'),'silly':_0x5df9('0xd')};winston[_0x5df9('0xe')](XC_LOG_COLORS);function getLogFileName(_0x3c7546,_0x5a6eac,_0x32f13e){var _0x98f7a9=_0x3c7546||'/var/log/xcally';return path['join'](_0x98f7a9,util[_0x5df9('0xf')](_0x5df9('0x10'),_0x5a6eac,_0x32f13e));}function formatter(_0x1bd9bf,_0x68d8f0){_0x68d8f0['message']=_0x68d8f0[_0x5df9('0x11')]['replace'](/@@{/g,_0x5df9('0x12'))['replace'](/}@@/g,_0x5df9('0x13'))['replace'](/@{/g,'{{')[_0x5df9('0x14')](/}@/g,'}}');return util['format'](_0x5df9('0x15'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x68d8f0['level']['toUpperCase'](),_0x1bd9bf,_0x68d8f0[_0x5df9('0x11')]);}function fileFormat(_0x5f03f5,_0x5d2836){_0x5d2836['message']=_0x5d2836[_0x5df9('0x11')][_0x5df9('0x14')](/@@{/g,_0x5df9('0x12'))[_0x5df9('0x14')](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x49e8e7=_0x5d2836[_0x5df9('0x16')]&&Object[_0x5df9('0x17')](_0x5d2836['meta'])[_0x5df9('0x18')]?'\x0a\x09'+JSON['stringify'](_0x5d2836[_0x5df9('0x16')]):'';return util[_0x5df9('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x5df9('0xf')](_0x5df9('0x19')),_0x5d2836['level'][_0x5df9('0x1a')](),_0x5f03f5,_0x5d2836[_0x5df9('0x11')],_0x49e8e7);}function consoleLogger(){var _0x258c75=new winston[(_0x5df9('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x23ddb6){return formatter('',_0x23ddb6);}})]});return _0x258c75;}function fileLogger(_0x5a7b67,_0x3fd2a3){var _0x589420=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1e'))]({'name':util[_0x5df9('0xf')](_0x5df9('0x1f'),_0x5a7b67,_0x5df9('0x20')),'filename':getLogFileName(_0x3fd2a3,_0x5a7b67,_0x5df9('0x20')),'level':_0x5df9('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x76b36){return fileFormat(_0x5a7b67,_0x76b36);}}),new winston[(_0x5df9('0x1c'))][(_0x5df9('0x1e'))]({'name':util[_0x5df9('0xf')](_0x5df9('0x1f'),_0x5a7b67,debugLevel),'filename':getLogFileName(_0x3fd2a3,_0x5a7b67,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f7ecd){return fileFormat(_0x5a7b67,_0x2f7ecd);}}),new winston[(_0x5df9('0x1c'))]['Console']({'level':_0x5df9('0x21'),'json':![],'formatter':function(_0x340414){return fileFormat(_0x5a7b67,_0x340414);}})]});return _0x589420;}exports[_0x5df9('0x22')]=consoleLogger;exports[_0x5df9('0x23')]=fileLogger; \ No newline at end of file +var _0x8983=['%s-%s','transports','warn','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20white','bold\x20green','bold\x20cyan','addColors','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','error','File'];(function(_0x3b40ca,_0x2686e7){var _0x115aa7=function(_0x3f59bb){while(--_0x3f59bb){_0x3b40ca['push'](_0x3b40ca['shift']());}};_0x115aa7(++_0x2686e7);}(_0x8983,0x1a8));var _0x3898=function(_0x2631b7,_0x1ac33e){_0x2631b7=_0x2631b7-0x0;var _0x28a048=_0x8983[_0x2631b7];return _0x28a048;};'use strict';var path=require(_0x3898('0x0'));var util=require(_0x3898('0x1'));var moment=require(_0x3898('0x2'));var winston=require(_0x3898('0x3'));var config=require(_0x3898('0x4'));var debugLevel=config['debugLevel']?config[_0x3898('0x5')][_0x3898('0x6')]():'info';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':_0x3898('0x7'),'error':_0x3898('0x8'),'warn':'bold\x20yellow','info':'white','print':_0x3898('0x9'),'success':_0x3898('0xa'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x3898('0xb')};winston[_0x3898('0xc')](XC_LOG_COLORS);function getLogFileName(_0x1255bf,_0x368464,_0x39624e){var _0x1d9086=_0x1255bf||'/var/log/xcally';return path[_0x3898('0xd')](_0x1d9086,util[_0x3898('0xe')](_0x3898('0xf'),_0x368464,_0x39624e));}function formatter(_0x2e0449,_0x9b1812){_0x9b1812[_0x3898('0x10')]=_0x9b1812[_0x3898('0x10')][_0x3898('0x11')](/@@{/g,_0x3898('0x12'))[_0x3898('0x11')](/}@@/g,_0x3898('0x13'))['replace'](/@{/g,'{{')[_0x3898('0x11')](/}@/g,'}}');return util['format'](_0x3898('0x14'),moment()[_0x3898('0xe')](_0x3898('0x15')),_0x9b1812['level'][_0x3898('0x16')](),_0x2e0449,_0x9b1812[_0x3898('0x10')]);}function fileFormat(_0x56731e,_0x5711ee){_0x5711ee[_0x3898('0x10')]=_0x5711ee[_0x3898('0x10')]['replace'](/@@{/g,_0x3898('0x12'))[_0x3898('0x11')](/}@@/g,_0x3898('0x13'))['replace'](/@{/g,'{{')[_0x3898('0x11')](/}@/g,'}}');var _0x43f51e=_0x5711ee[_0x3898('0x17')]&&Object[_0x3898('0x18')](_0x5711ee[_0x3898('0x17')])[_0x3898('0x19')]?'\x0a\x09'+JSON[_0x3898('0x1a')](_0x5711ee[_0x3898('0x17')]):'';return util['format'](_0x3898('0x1b'),moment()[_0x3898('0xe')](_0x3898('0x15')),_0x5711ee['level'][_0x3898('0x16')](),_0x56731e,_0x5711ee[_0x3898('0x10')],_0x43f51e);}function consoleLogger(){var _0x2683f5=new winston[(_0x3898('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':'warn','json':![],'formatter':function(_0x37619c){return formatter('',_0x37619c);}})]});return _0x2683f5;}function fileLogger(_0x5d7285,_0x46cbbf){var _0xe3945b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0x3898('0xe')]('%s-%s',_0x5d7285,_0x3898('0x1d')),'filename':getLogFileName(_0x46cbbf,_0x5d7285,_0x3898('0x1d')),'level':_0x3898('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c9ec0){return fileFormat(_0x5d7285,_0x1c9ec0);}}),new winston['transports'][(_0x3898('0x1e'))]({'name':util[_0x3898('0xe')](_0x3898('0x1f'),_0x5d7285,debugLevel),'filename':getLogFileName(_0x46cbbf,_0x5d7285,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3c3edf){return fileFormat(_0x5d7285,_0x3c3edf);}}),new winston[(_0x3898('0x20'))]['Console']({'level':_0x3898('0x21'),'json':![],'formatter':function(_0x331793){return fileFormat(_0x5d7285,_0x331793);}})]});return _0xe3945b;}exports['consoleLogger']=consoleLogger;exports[_0x3898('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a8fab70..e409082 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x5f4297,_0x4dd180){var _0x4ef805=function(_0x2210c4){while(--_0x2210c4){_0x5f4297['push'](_0x5f4297['shift']());}};_0x4ef805(++_0x4dd180);}(_0xda2d,0x102));var _0xdda2=function(_0x3a3e34,_0x42d986){_0x3a3e34=_0x3a3e34-0x0;var _0x17c6dc=_0xda2d[_0x3a3e34];return _0x17c6dc;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x578afd,_0x149805){var _0x45585a=function(_0x1ce78e){while(--_0x1ce78e){_0x578afd['push'](_0x578afd['shift']());}};_0x45585a(++_0x149805);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x0b0e[_0x4bdf64];return _0x9a1a19;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 4277417..c5077e4 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 _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0xf39bd8,_0x4ed072){var _0x3a6cee=function(_0x1bb229){while(--_0x1bb229){_0xf39bd8['push'](_0xf39bd8['shift']());}};_0x3a6cee(++_0x4ed072);}(_0x4fc2,0x111));var _0x24fc=function(_0x13d4d2,_0xd2780f){_0x13d4d2=_0x13d4d2-0x0;var _0x4a2592=_0x4fc2[_0x13d4d2];return _0x4a2592;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file +var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 6873a7e..d63698b 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 _0xe43b=['motion2','string','env','pathExists','then','updated','info','writeJSON','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name'];(function(_0x5af44f,_0x24e89f){var _0x183108=function(_0x100c70){while(--_0x100c70){_0x5af44f['push'](_0x5af44f['shift']());}};_0x183108(++_0x24e89f);}(_0xe43b,0x88));var _0xbe43=function(_0x448747,_0x52303a){_0x448747=_0x448747-0x0;var _0x34b9f4=_0xe43b[_0x448747];return _0x34b9f4;};var fs=require('fs-extra');var path=require('path');var config=require(_0xbe43('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0xbe43('0x1')](root,_0xbe43('0x2'));var NODEPATH=path[_0xbe43('0x1')](root,_0xbe43('0x3'));function setLegacyLibsNodeEnvPath(_0x5e123a){let _0x56d5af=![];if(Array[_0xbe43('0x4')](_0x5e123a[_0xbe43('0x5')])){var _0x2bc77c=_0x5e123a[_0xbe43('0x5')][_0xbe43('0x6')](function(_0x3763f8){return _0x3763f8[_0xbe43('0x7')]===_0xbe43('0x8');});if(_0x2bc77c>-0x1){var _0x3f80ba=_0x5e123a[_0xbe43('0x5')][_0x2bc77c];if(typeof _0x3f80ba['env']['NODE_PATH']!==_0xbe43('0x9')){_0x3f80ba[_0xbe43('0xa')]['NODE_PATH']=NODEPATH;_0x56d5af=!![];}}return{'appConfig':_0x5e123a,'updated':_0x56d5af};}}function updateAppConfig(_0x136bcb){return fs[_0xbe43('0xb')](APP_JSON_PATH)[_0xbe43('0xc')](function(_0x13fc1a){if(_0x13fc1a){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x35103a){var _0x1b6c9b=setLegacyLibsNodeEnvPath(_0x35103a);if(_0x1b6c9b[_0xbe43('0xd')]){_0x136bcb[_0xbe43('0xe')]('Updating\x20app.json');return fs[_0xbe43('0xf')](APP_JSON_PATH,_0x35103a,{'spaces':0x2});}else{return Promise[_0xbe43('0x1')]();}});}else{return Promise[_0xbe43('0x1')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x1f63=['then','Updating\x20app.json','writeJSON','exports','path','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name','NODE_PATH','env','readJSON'];(function(_0x51b6d5,_0xca1304){var _0x13241a=function(_0x499e90){while(--_0x499e90){_0x51b6d5['push'](_0x51b6d5['shift']());}};_0x13241a(++_0xca1304);}(_0x1f63,0xe4));var _0x31f6=function(_0x2a1df7,_0x53075e){_0x2a1df7=_0x2a1df7-0x0;var _0x25a75c=_0x1f63[_0x2a1df7];return _0x25a75c;};var fs=require('fs-extra');var path=require(_0x31f6('0x0'));var config=require(_0x31f6('0x1'));var root=config[_0x31f6('0x2')];var APP_JSON_PATH=path[_0x31f6('0x3')](root,'server/app.json');var NODEPATH=path[_0x31f6('0x3')](root,_0x31f6('0x4'));function setLegacyLibsNodeEnvPath(_0x108a8a){let _0x201caf=![];if(Array[_0x31f6('0x5')](_0x108a8a[_0x31f6('0x6')])){var _0x3286ae=_0x108a8a[_0x31f6('0x6')][_0x31f6('0x7')](function(_0x5a1584){return _0x5a1584[_0x31f6('0x8')]==='motion2';});if(_0x3286ae>-0x1){var _0x1188fe=_0x108a8a[_0x31f6('0x6')][_0x3286ae];if(typeof _0x1188fe['env'][_0x31f6('0x9')]!=='string'){_0x1188fe[_0x31f6('0xa')][_0x31f6('0x9')]=NODEPATH;_0x201caf=!![];}}return{'appConfig':_0x108a8a,'updated':_0x201caf};}}function updateAppConfig(_0x539487){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x5caf4f){if(_0x5caf4f){return fs[_0x31f6('0xb')](APP_JSON_PATH)[_0x31f6('0xc')](function(_0x11bae4){var _0x1dbd43=setLegacyLibsNodeEnvPath(_0x11bae4);if(_0x1dbd43['updated']){_0x539487['info'](_0x31f6('0xd'));return fs[_0x31f6('0xe')](APP_JSON_PATH,_0x11bae4,{'spaces':0x2});}else{return Promise[_0x31f6('0x3')]();}});}else{return Promise[_0x31f6('0x3')]();}});}module[_0x31f6('0xf')]=updateAppConfig; \ No newline at end of file